aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-08-09 11:51:35 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-08-09 11:51:35 -0400
commitc973b112c76c9d8fd042991128f218a738cc8d0a (patch)
treee813b0da5d0a0e19e06de6462d145a29ad683026
parentc5fbc3966f48279dbebfde10248c977014aa9988 (diff)
parent00dd1e433967872f3997a45d5adf35056fdf2f56 (diff)
Merge with /shiny/git/linux-2.6/.git
-rw-r--r--CREDITS10
-rw-r--r--Documentation/Changes1
-rw-r--r--Documentation/SubmittingPatches5
-rw-r--r--Documentation/dontdiff1
-rw-r--r--Documentation/fb/vesafb.txt16
-rw-r--r--Documentation/infiniband/core_locking.txt114
-rw-r--r--Documentation/infiniband/user_mad.txt53
-rw-r--r--Documentation/kprobes.txt588
-rw-r--r--Documentation/networking/bonding.txt978
-rw-r--r--Documentation/pcmcia/driver-changes.txt9
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt44
-rw-r--r--Documentation/stable_api_nonsense.txt2
-rw-r--r--Documentation/stable_kernel_rules.txt58
-rw-r--r--Documentation/usb/usbmon.txt2
-rw-r--r--Documentation/video4linux/CARDLIST.cx881
-rw-r--r--Documentation/video4linux/CARDLIST.tuner2
-rw-r--r--Documentation/video4linux/bttv/Insmod-options3
-rw-r--r--Documentation/x86_64/boot-options.txt15
-rw-r--r--MAINTAINERS10
-rw-r--r--Makefile2
-rw-r--r--README10
-rw-r--r--REPORTING-BUGS21
-rw-r--r--arch/alpha/kernel/pci.c16
-rw-r--r--arch/alpha/kernel/systbls.S5
-rw-r--r--arch/arm/kernel/bios32.c17
-rw-r--r--arch/arm/kernel/smp.c1
-rw-r--r--arch/arm/lib/bitops.h8
-rw-r--r--arch/arm/mach-integrator/platsmp.c2
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c16
-rw-r--r--arch/arm/mach-sa1100/jornada720.c1
-rw-r--r--arch/arm/mm/fault.c6
-rw-r--r--arch/arm/mm/proc-xscale.S136
-rw-r--r--arch/arm/nwfpe/double_cpdo.c24
-rw-r--r--arch/arm/nwfpe/extended_cpdo.c24
-rw-r--r--arch/arm/nwfpe/fpa11.c30
-rw-r--r--arch/arm/nwfpe/fpa11.h11
-rw-r--r--arch/arm/nwfpe/fpa11_cpdo.c28
-rw-r--r--arch/arm/nwfpe/fpa11_cpdt.c22
-rw-r--r--arch/arm/nwfpe/fpa11_cprt.c28
-rw-r--r--arch/arm/nwfpe/fpmodule.c15
-rw-r--r--arch/arm/nwfpe/single_cpdo.c24
-rw-r--r--arch/arm/nwfpe/softfloat.c334
-rw-r--r--arch/arm/nwfpe/softfloat.h68
-rw-r--r--arch/arm/oprofile/backtrace.c2
-rw-r--r--arch/arm/vfp/vfpdouble.c3
-rw-r--r--arch/arm26/mm/fault.c17
-rw-r--r--arch/cris/Kconfig.debug5
-rw-r--r--arch/cris/Makefile66
-rw-r--r--arch/cris/arch-v10/Kconfig31
-rw-r--r--arch/cris/arch-v10/boot/Makefile9
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile43
-rw-r--r--arch/cris/arch-v10/boot/compressed/head.S22
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile45
-rw-r--r--arch/cris/arch-v10/boot/rescue/head.S33
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig250
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c5
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c71
-rw-r--r--arch/cris/arch-v10/drivers/eeprom.c29
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c201
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c62
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c20
-rw-r--r--arch/cris/arch-v10/kernel/Makefile5
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c273
-rw-r--r--arch/cris/arch-v10/kernel/dma.c287
-rw-r--r--arch/cris/arch-v10/kernel/entry.S54
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c55
-rw-r--r--arch/cris/arch-v10/kernel/head.S126
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c879
-rw-r--r--arch/cris/arch-v10/kernel/irq.c76
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c17
-rw-r--r--arch/cris/arch-v10/kernel/process.c3
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c9
-rw-r--r--arch/cris/arch-v10/kernel/shadows.c3
-rw-r--r--arch/cris/arch-v10/kernel/traps.c37
-rw-r--r--arch/cris/arch-v10/mm/fault.c26
-rw-r--r--arch/cris/arch-v10/mm/init.c2
-rw-r--r--arch/cris/arch-v10/mm/tlb.c49
-rw-r--r--arch/cris/arch-v32/Kconfig296
-rw-r--r--arch/cris/arch-v32/boot/Makefile14
-rw-r--r--arch/cris/arch-v32/boot/compressed/Makefile41
-rw-r--r--arch/cris/arch-v32/boot/compressed/README25
-rw-r--r--arch/cris/arch-v32/boot/compressed/decompress.ld30
-rw-r--r--arch/cris/arch-v32/boot/compressed/head.S193
-rw-r--r--arch/cris/arch-v32/boot/compressed/misc.c318
-rw-r--r--arch/cris/arch-v32/boot/rescue/Makefile36
-rw-r--r--arch/cris/arch-v32/boot/rescue/head.S39
-rw-r--r--arch/cris/arch-v32/boot/rescue/rescue.ld20
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig625
-rw-r--r--arch/cris/arch-v32/drivers/Makefile13
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c455
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c3522
-rw-r--r--arch/cris/arch-v32/drivers/gpio.c766
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c611
-rw-r--r--arch/cris/arch-v32/drivers/i2c.h15
-rw-r--r--arch/cris/arch-v32/drivers/iop_fw_load.c219
-rw-r--r--arch/cris/arch-v32/drivers/nandflash.c157
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c341
-rw-r--r--arch/cris/arch-v32/drivers/pci/Makefile5
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c131
-rw-r--r--arch/cris/arch-v32/drivers/pci/dma.c149
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c1283
-rw-r--r--arch/cris/arch-v32/kernel/Makefile21
-rw-r--r--arch/cris/arch-v32/kernel/arbiter.c297
-rw-r--r--arch/cris/arch-v32/kernel/asm-offsets.c49
-rw-r--r--arch/cris/arch-v32/kernel/crisksyms.c24
-rw-r--r--arch/cris/arch-v32/kernel/debugport.c461
-rw-r--r--arch/cris/arch-v32/kernel/dma.c224
-rw-r--r--arch/cris/arch-v32/kernel/entry.S820
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c996
-rw-r--r--arch/cris/arch-v32/kernel/head.S448
-rw-r--r--arch/cris/arch-v32/kernel/io.c154
-rw-r--r--arch/cris/arch-v32/kernel/irq.c413
-rw-r--r--arch/cris/arch-v32/kernel/kgdb.c1660
-rw-r--r--arch/cris/arch-v32/kernel/kgdb_asm.S552
-rw-r--r--arch/cris/arch-v32/kernel/pinmux.c229
-rw-r--r--arch/cris/arch-v32/kernel/process.c270
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c597
-rw-r--r--arch/cris/arch-v32/kernel/setup.c118
-rw-r--r--arch/cris/arch-v32/kernel/signal.c708
-rw-r--r--arch/cris/arch-v32/kernel/smp.c348
-rw-r--r--arch/cris/arch-v32/kernel/time.c341
-rw-r--r--arch/cris/arch-v32/kernel/traps.c160
-rw-r--r--arch/cris/arch-v32/kernel/vcs_hook.c96
-rw-r--r--arch/cris/arch-v32/kernel/vcs_hook.h42
-rw-r--r--arch/cris/arch-v32/lib/Makefile6
-rw-r--r--arch/cris/arch-v32/lib/checksum.S111
-rw-r--r--arch/cris/arch-v32/lib/checksumcopy.S120
-rw-r--r--arch/cris/arch-v32/lib/csumcpfruser.S69
-rw-r--r--arch/cris/arch-v32/lib/dram_init.S120
-rw-r--r--arch/cris/arch-v32/lib/hw_settings.S73
-rw-r--r--arch/cris/arch-v32/lib/memset.c253
-rw-r--r--arch/cris/arch-v32/lib/nand_init.S179
-rw-r--r--arch/cris/arch-v32/lib/spinlock.S33
-rw-r--r--arch/cris/arch-v32/lib/string.c219
-rw-r--r--arch/cris/arch-v32/lib/usercopy.c470
-rw-r--r--arch/cris/arch-v32/mm/Makefile3
-rw-r--r--arch/cris/arch-v32/mm/init.c174
-rw-r--r--arch/cris/arch-v32/mm/intmem.c139
-rw-r--r--arch/cris/arch-v32/mm/mmu.S141
-rw-r--r--arch/cris/arch-v32/mm/tlb.c208
-rw-r--r--arch/cris/arch-v32/output_arch.ld2
-rw-r--r--arch/cris/arch-v32/vmlinux.lds.S134
-rw-r--r--arch/cris/defconfig376
-rw-r--r--arch/cris/kernel/Makefile3
-rw-r--r--arch/cris/kernel/crisksyms.c21
-rw-r--r--arch/cris/kernel/irq.c263
-rw-r--r--arch/cris/kernel/module.c39
-rw-r--r--arch/cris/kernel/process.c31
-rw-r--r--arch/cris/kernel/profile.c73
-rw-r--r--arch/cris/kernel/ptrace.c37
-rw-r--r--arch/cris/kernel/setup.c26
-rw-r--r--arch/cris/kernel/time.c18
-rw-r--r--arch/cris/kernel/traps.c64
-rw-r--r--arch/cris/mm/fault.c101
-rw-r--r--arch/cris/mm/ioremap.c58
-rw-r--r--arch/cris/mm/tlb.c25
-rw-r--r--arch/frv/mm/fault.c6
-rw-r--r--arch/i386/Kconfig3
-rw-r--r--arch/i386/Kconfig.debug3
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c43
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h32
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c20
-rw-r--r--arch/i386/kernel/cpu/transmeta.c6
-rw-r--r--arch/i386/kernel/machine_kexec.c22
-rw-r--r--arch/i386/kernel/mpparse.c10
-rw-r--r--arch/i386/kernel/numaq.c9
-rw-r--r--arch/i386/kernel/process.c2
-rw-r--r--arch/i386/kernel/syscall_table.S2
-rw-r--r--arch/i386/mach-visws/reboot.c11
-rw-r--r--arch/i386/mach-visws/setup.c2
-rw-r--r--arch/i386/mach-voyager/voyager_basic.c13
-rw-r--r--arch/i386/mm/discontig.c11
-rw-r--r--arch/i386/pci/acpi.c1
-rw-r--r--arch/i386/pci/common.c6
-rw-r--r--arch/i386/pci/irq.c8
-rw-r--r--arch/i386/pci/pci.h1
-rw-r--r--arch/i386/pci/visws.c2
-rw-r--r--arch/ia64/kernel/entry.S6
-rw-r--r--arch/ia64/kernel/unwind.c12
-rw-r--r--arch/m32r/Kconfig.debug3
-rw-r--r--arch/m32r/kernel/time.c13
-rw-r--r--arch/m68k/mm/fault.c6
-rw-r--r--arch/mips/Kconfig35
-rw-r--r--arch/mips/kernel/irixsig.c2
-rw-r--r--arch/mips/kernel/signal32.c2
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/mips/vr41xx/common/giu.c455
-rw-r--r--arch/parisc/kernel/pci.c18
-rw-r--r--arch/parisc/mm/fault.c12
-rw-r--r--arch/ppc/8xx_io/Kconfig4
-rw-r--r--arch/ppc/8xx_io/commproc.c20
-rw-r--r--arch/ppc/8xx_io/fec.c43
-rw-r--r--arch/ppc/Kconfig22
-rw-r--r--arch/ppc/boot/simple/Makefile6
-rw-r--r--arch/ppc/boot/simple/pibs.c4
-rw-r--r--arch/ppc/configs/bamboo_defconfig943
-rw-r--r--arch/ppc/configs/common_defconfig781
-rw-r--r--arch/ppc/configs/pmac_defconfig542
-rw-r--r--arch/ppc/configs/radstone_ppc7d_defconfig234
-rw-r--r--arch/ppc/configs/sandpoint_defconfig2
-rw-r--r--arch/ppc/kernel/cputable.c20
-rw-r--r--arch/ppc/kernel/entry.S1
-rw-r--r--arch/ppc/kernel/head_44x.S24
-rw-r--r--arch/ppc/kernel/head_8xx.S12
-rw-r--r--arch/ppc/kernel/misc.S4
-rw-r--r--arch/ppc/kernel/pci.c15
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c2
-rw-r--r--arch/ppc/mm/init.c3
-rw-r--r--arch/ppc/platforms/4xx/Kconfig20
-rw-r--r--arch/ppc/platforms/4xx/Makefile2
-rw-r--r--arch/ppc/platforms/4xx/bamboo.c427
-rw-r--r--arch/ppc/platforms/4xx/bamboo.h136
-rw-r--r--arch/ppc/platforms/4xx/ebony.c6
-rw-r--r--arch/ppc/platforms/4xx/ebony.h13
-rw-r--r--arch/ppc/platforms/4xx/ibm440ep.c220
-rw-r--r--arch/ppc/platforms/4xx/ibm440ep.h76
-rw-r--r--arch/ppc/platforms/4xx/ibm440sp.c4
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c4
-rw-r--r--arch/ppc/platforms/4xx/ocotea.h13
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c2
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c3
-rw-r--r--arch/ppc/platforms/pmac_setup.c16
-rw-r--r--arch/ppc/platforms/prpmc750.c1
-rw-r--r--arch/ppc/platforms/sandpoint.c17
-rw-r--r--arch/ppc/platforms/tqm8260_setup.c2
-rw-r--r--arch/ppc/syslib/Makefile2
-rw-r--r--arch/ppc/syslib/cpm2_common.c1
-rw-r--r--arch/ppc/syslib/ibm440gx_common.c15
-rw-r--r--arch/ppc/syslib/ibm44x_common.h4
-rw-r--r--arch/ppc/syslib/m8260_setup.c3
-rw-r--r--arch/ppc/syslib/m82xx_pci.c6
-rw-r--r--arch/ppc/syslib/m8xx_setup.c8
-rw-r--r--arch/ppc/syslib/mpc10x_common.c53
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c8
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c4
-rw-r--r--arch/ppc64/Kconfig1
-rw-r--r--arch/ppc64/boot/zlib.c3
-rw-r--r--arch/ppc64/configs/bpa_defconfig987
-rw-r--r--arch/ppc64/configs/g5_defconfig375
-rw-r--r--arch/ppc64/configs/iSeries_defconfig324
-rw-r--r--arch/ppc64/configs/maple_defconfig221
-rw-r--r--arch/ppc64/configs/pSeries_defconfig381
-rw-r--r--arch/ppc64/defconfig386
-rw-r--r--arch/ppc64/kernel/LparData.c88
-rw-r--r--arch/ppc64/kernel/head.S42
-rw-r--r--arch/ppc64/kernel/machine_kexec.c12
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/mpic.c4
-rw-r--r--arch/ppc64/kernel/mpic.h2
-rw-r--r--arch/ppc64/kernel/pci.c20
-rw-r--r--arch/ppc64/kernel/pmac_setup.c12
-rw-r--r--arch/ppc64/kernel/prom.c2
-rw-r--r--arch/ppc64/kernel/setup.c2
-rw-r--r--arch/ppc64/kernel/smp.c15
-rw-r--r--arch/ppc64/kernel/udbg.c2
-rw-r--r--arch/ppc64/kernel/xics.c31
-rw-r--r--arch/ppc64/mm/numa.c7
-rw-r--r--arch/ppc64/mm/stab.c35
-rw-r--r--arch/ppc64/xmon/xmon.c3
-rw-r--r--arch/s390/appldata/appldata_base.c6
-rw-r--r--arch/s390/defconfig253
-rw-r--r--arch/s390/kernel/compat_wrapper.S26
-rw-r--r--arch/s390/kernel/entry.S6
-rw-r--r--arch/s390/kernel/entry64.S6
-rw-r--r--arch/s390/kernel/head.S16
-rw-r--r--arch/s390/kernel/head64.S12
-rw-r--r--arch/s390/kernel/machine_kexec.c7
-rw-r--r--arch/s390/kernel/relocate_kernel.S41
-rw-r--r--arch/s390/kernel/relocate_kernel64.S45
-rw-r--r--arch/s390/kernel/s390_ext.c16
-rw-r--r--arch/s390/kernel/setup.c6
-rw-r--r--arch/s390/kernel/smp.c16
-rw-r--r--arch/s390/kernel/syscalls.S5
-rw-r--r--arch/s390/kernel/traps.c15
-rw-r--r--arch/s390/lib/Makefile4
-rw-r--r--arch/s390/lib/spinlock.c133
-rw-r--r--arch/sh/kernel/signal.c2
-rw-r--r--arch/sh64/kernel/signal.c2
-rw-r--r--arch/sh64/mm/fault.c6
-rw-r--r--arch/sparc/kernel/systbls.S4
-rw-r--r--arch/sparc64/kernel/systbls.S8
-rw-r--r--arch/sparc64/mm/init.c23
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/Makefile-i3861
-rw-r--r--arch/um/drivers/Makefile4
-rw-r--r--arch/um/drivers/cow.h4
-rw-r--r--arch/um/drivers/hostaudio_kern.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/kernel/exitcode.c2
-rw-r--r--arch/um/kernel/helper.c14
-rw-r--r--arch/um/kernel/process.c83
-rw-r--r--arch/um/kernel/process_kern.c2
-rw-r--r--arch/um/kernel/skas/process.c2
-rw-r--r--arch/um/kernel/skas/syscall_user.c4
-rw-r--r--arch/um/kernel/skas/trap_user.c1
-rw-r--r--arch/um/kernel/time_kern.c5
-rw-r--r--arch/um/kernel/um_arch.c19
-rw-r--r--arch/um/os-Linux/elf_aux.c5
-rw-r--r--arch/um/os-Linux/user_syms.c3
-rw-r--r--arch/um/sys-i386/stub_segv.c6
-rw-r--r--arch/v850/Makefile7
-rw-r--r--arch/v850/README64
-rw-r--r--arch/v850/configs/rte-ma1-cb_defconfig605
-rw-r--r--arch/v850/configs/rte-me2-cb_defconfig453
-rw-r--r--arch/v850/configs/sim_defconfig442
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c37
-rw-r--r--arch/v850/kernel/vmlinux.lds.S14
-rw-r--r--arch/x86_64/Kconfig5
-rw-r--r--arch/x86_64/Makefile12
-rw-r--r--arch/x86_64/crypto/aes.c1
-rw-r--r--arch/x86_64/defconfig224
-rw-r--r--arch/x86_64/ia32/Makefile4
-rw-r--r--arch/x86_64/ia32/ia32_aout.c6
-rw-r--r--arch/x86_64/ia32/ptrace32.c8
-rw-r--r--arch/x86_64/ia32/syscall32.c10
-rw-r--r--arch/x86_64/ia32/syscall32_syscall.S17
-rw-r--r--arch/x86_64/kernel/entry.S22
-rw-r--r--arch/x86_64/kernel/genapic.c33
-rw-r--r--arch/x86_64/kernel/genapic_flat.c142
-rw-r--r--arch/x86_64/kernel/head.S16
-rw-r--r--arch/x86_64/kernel/irq.c19
-rw-r--r--arch/x86_64/kernel/machine_kexec.c101
-rw-r--r--arch/x86_64/kernel/mce.c109
-rw-r--r--arch/x86_64/kernel/mpparse.c34
-rw-r--r--arch/x86_64/kernel/setup.c11
-rw-r--r--arch/x86_64/kernel/setup64.c18
-rw-r--r--arch/x86_64/kernel/smp.c66
-rw-r--r--arch/x86_64/kernel/smpboot.c94
-rw-r--r--arch/x86_64/kernel/traps.c3
-rw-r--r--arch/x86_64/lib/csum-copy.S2
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/mm/fault.c7
-rw-r--r--arch/x86_64/mm/numa.c50
-rw-r--r--arch/x86_64/mm/srat.c22
-rw-r--r--arch/x86_64/pci/k8-bus.c2
-rw-r--r--crypto/aes.c2
-rw-r--r--drivers/acorn/block/fd1772.c3
-rw-r--r--drivers/acpi/Kconfig5
-rw-r--r--drivers/acpi/button.c206
-rw-r--r--drivers/acpi/dispatcher/dswload.c6
-rw-r--r--drivers/acpi/ec.c907
-rw-r--r--drivers/acpi/hotkey.c690
-rw-r--r--drivers/acpi/motherboard.c2
-rw-r--r--drivers/acpi/osl.c6
-rw-r--r--drivers/acpi/pci_irq.c85
-rw-r--r--drivers/acpi/pci_link.c127
-rw-r--r--drivers/acpi/processor_idle.c32
-rw-r--r--drivers/block/as-iosched.c10
-rw-r--r--drivers/block/cciss.c49
-rw-r--r--drivers/block/cciss.h4
-rw-r--r--drivers/block/cfq-iosched.c1
-rw-r--r--drivers/block/ll_rw_blk.c18
-rw-r--r--drivers/block/sx8.c4
-rw-r--r--drivers/block/ub.c211
-rw-r--r--drivers/bluetooth/bpa10x.c7
-rw-r--r--drivers/bluetooth/hci_bcsp.c2
-rw-r--r--drivers/bluetooth/hci_h4.c5
-rw-r--r--drivers/bluetooth/hci_ldisc.c2
-rw-r--r--drivers/bluetooth/hci_usb.c11
-rw-r--r--drivers/cdrom/isp16.c2
-rw-r--r--drivers/cdrom/mcdx.c8
-rw-r--r--drivers/cdrom/optcd.c28
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/agp/agp.h1
-rw-r--r--drivers/char/agp/intel-agp.c12
-rw-r--r--drivers/char/drm/via_dma.c10
-rw-r--r--drivers/char/drm/via_drm.h2
-rw-r--r--drivers/char/drm/via_ds.c4
-rw-r--r--drivers/char/drm/via_ds.h4
-rw-r--r--drivers/char/drm/via_map.c3
-rw-r--r--drivers/char/drm/via_mm.c15
-rw-r--r--drivers/char/drm/via_video.c3
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c6
-rw-r--r--drivers/char/keyboard.c4
-rw-r--r--drivers/char/rio/rioboot.c12
-rw-r--r--drivers/char/rio/rioroute.c2
-rw-r--r--drivers/char/rio/riotable.c2
-rw-r--r--drivers/char/rtc.c7
-rw-r--r--drivers/char/sonypi.c146
-rw-r--r--drivers/char/tpm/Kconfig14
-rw-r--r--drivers/char/tpm/Makefile2
-rw-r--r--drivers/char/tpm/tpm_infineon.c533
-rw-r--r--drivers/char/watchdog/acquirewdt.c7
-rw-r--r--drivers/char/watchdog/advantechwdt.c7
-rw-r--r--drivers/char/watchdog/alim1535_wdt.c9
-rw-r--r--drivers/char/watchdog/alim7101_wdt.c7
-rw-r--r--drivers/char/watchdog/eurotechwdt.c7
-rw-r--r--drivers/char/watchdog/i8xx_tco.c7
-rw-r--r--drivers/char/watchdog/ib700wdt.c7
-rw-r--r--drivers/char/watchdog/indydog.c7
-rw-r--r--drivers/char/watchdog/ixp2000_wdt.c6
-rw-r--r--drivers/char/watchdog/ixp4xx_wdt.c6
-rw-r--r--drivers/char/watchdog/machzwd.c7
-rw-r--r--drivers/char/watchdog/mixcomwd.c7
-rw-r--r--drivers/char/watchdog/pcwd.c7
-rw-r--r--drivers/char/watchdog/pcwd_pci.c7
-rw-r--r--drivers/char/watchdog/pcwd_usb.c7
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c7
-rw-r--r--drivers/char/watchdog/sa1100_wdt.c53
-rw-r--r--drivers/char/watchdog/sbc60xxwdt.c7
-rw-r--r--drivers/char/watchdog/sc1200wdt.c7
-rw-r--r--drivers/char/watchdog/sc520_wdt.c7
-rw-r--r--drivers/char/watchdog/scx200_wdt.c6
-rw-r--r--drivers/char/watchdog/shwdt.c6
-rw-r--r--drivers/char/watchdog/softdog.c7
-rw-r--r--drivers/char/watchdog/w83627hf_wdt.c7
-rw-r--r--drivers/char/watchdog/w83877f_wdt.c7
-rw-r--r--drivers/char/watchdog/wafer5823wdt.c7
-rw-r--r--drivers/char/watchdog/wdt.c7
-rw-r--r--drivers/char/watchdog/wdt977.c7
-rw-r--r--drivers/char/watchdog/wdt_pci.c7
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/fc4/fc.c2
-rw-r--r--drivers/firmware/pcdp.c14
-rw-r--r--drivers/hwmon/adm1026.c2
-rw-r--r--drivers/hwmon/atxp1.c5
-rw-r--r--drivers/hwmon/fscpos.c4
-rw-r--r--drivers/hwmon/gl520sm.c4
-rw-r--r--drivers/hwmon/max1619.c2
-rw-r--r--drivers/hwmon/pc87360.c2
-rw-r--r--drivers/i2c/busses/i2c-i801.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c94
-rw-r--r--drivers/i2c/chips/ds1337.c6
-rw-r--r--drivers/i2c/chips/eeprom.c8
-rw-r--r--drivers/i2c/chips/max6875.c8
-rw-r--r--drivers/i2c/i2c-core.c8
-rw-r--r--drivers/ide/cris/Makefile2
-rw-r--r--drivers/ide/cris/ide-cris.c1107
-rw-r--r--drivers/ide/cris/ide-v10.c842
-rw-r--r--drivers/ide/ide-probe.c16
-rw-r--r--drivers/ide/legacy/ide-cs.c5
-rw-r--r--drivers/ide/pci/cmd640.c2
-rw-r--r--drivers/ide/pci/trm290.c2
-rw-r--r--drivers/ieee1394/sbp2.c1
-rw-r--r--drivers/infiniband/core/Makefile9
-rw-r--r--drivers/infiniband/core/agent.c22
-rw-r--r--drivers/infiniband/core/agent_priv.h3
-rw-r--r--drivers/infiniband/core/cm.c3324
-rw-r--r--drivers/infiniband/core/cm_msgs.h819
-rw-r--r--drivers/infiniband/core/fmr_pool.c7
-rw-r--r--drivers/infiniband/core/mad.c600
-rw-r--r--drivers/infiniband/core/mad_priv.h33
-rw-r--r--drivers/infiniband/core/mad_rmpp.c765
-rw-r--r--drivers/infiniband/core/mad_rmpp.h58
-rw-r--r--drivers/infiniband/core/sa_query.c206
-rw-r--r--drivers/infiniband/core/ucm.c1387
-rw-r--r--drivers/infiniband/core/ucm.h89
-rw-r--r--drivers/infiniband/core/user_mad.c299
-rw-r--r--drivers/infiniband/core/uverbs.h1
-rw-r--r--drivers/infiniband/core/uverbs_main.c14
-rw-r--r--drivers/infiniband/core/verbs.c35
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c6
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c6
-rw-r--r--drivers/infiniband/include/ib_cm.h569
-rw-r--r--drivers/infiniband/include/ib_fmr_pool.h5
-rw-r--r--drivers/infiniband/include/ib_mad.h213
-rw-r--r--drivers/infiniband/include/ib_sa.h87
-rw-r--r--drivers/infiniband/include/ib_user_cm.h328
-rw-r--r--drivers/infiniband/include/ib_user_mad.h28
-rw-r--r--drivers/infiniband/include/ib_verbs.h25
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c5
-rw-r--r--drivers/input/evdev.c1
-rw-r--r--drivers/input/input.c389
-rw-r--r--drivers/input/joydev.c6
-rw-r--r--drivers/input/misc/uinput.c181
-rw-r--r--drivers/input/mouse/alps.c29
-rw-r--r--drivers/input/mouse/logips2pp.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mouse/synaptics.c14
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h14
-rw-r--r--drivers/input/serio/i8042.c60
-rw-r--r--drivers/input/serio/serio.c42
-rw-r--r--drivers/input/serio/serio_raw.c1
-rw-r--r--drivers/input/touchscreen/Kconfig2
-rw-r--r--drivers/isdn/hisax/avm_a1.c2
-rw-r--r--drivers/isdn/hisax/config.c1
-rw-r--r--drivers/isdn/hisax/gazel.c9
-rw-r--r--drivers/isdn/hisax/isdnl2.c2
-rw-r--r--drivers/isdn/hisax/l3dss1.c8
-rw-r--r--drivers/isdn/hisax/teles3.c2
-rw-r--r--drivers/isdn/icn/icn.c5
-rw-r--r--drivers/macintosh/Kconfig2
-rw-r--r--drivers/md/bitmap.c83
-rw-r--r--drivers/md/dm-raid1.c2
-rw-r--r--drivers/md/dm-table.c6
-rw-r--r--drivers/md/dm.c196
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/raid1.c30
-rw-r--r--drivers/md/raid5.c2
-rw-r--r--drivers/md/raid6main.c2
-rw-r--r--drivers/media/dvb/frontends/Kconfig4
-rw-r--r--drivers/media/dvb/frontends/Makefile2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c27
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.h1
-rw-r--r--drivers/media/dvb/frontends/lgdt3302.c599
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c831
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.h (renamed from drivers/media/dvb/frontends/lgdt3302.h)32
-rw-r--r--drivers/media/dvb/frontends/lgdt330x_priv.h (renamed from drivers/media/dvb/frontends/lgdt3302_priv.h)16
-rw-r--r--drivers/media/radio/radio-maestro.c4
-rw-r--r--drivers/media/radio/radio-maxiradio.c2
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/bttv-cards.c12
-rw-r--r--drivers/media/video/bttv-driver.c33
-rw-r--r--drivers/media/video/bttv.h6
-rw-r--r--drivers/media/video/bttvp.h4
-rw-r--r--drivers/media/video/cx88/Makefile12
-rw-r--r--drivers/media/video/cx88/cx88-cards.c33
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c104
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c4
-rw-r--r--drivers/media/video/cx88/cx88.h3
-rw-r--r--drivers/media/video/msp3400.c4
-rw-r--r--drivers/media/video/mxb.c39
-rw-r--r--drivers/media/video/saa7134/Makefile6
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c20
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c4
-rw-r--r--drivers/media/video/saa7134/saa7134.h4
-rw-r--r--drivers/media/video/tea5767.c26
-rw-r--r--drivers/media/video/tuner-core.c29
-rw-r--r--drivers/media/video/tuner-simple.c8
-rw-r--r--drivers/media/video/tvaudio.c1
-rw-r--r--drivers/media/video/tveeprom.c8
-rw-r--r--drivers/mmc/wbsd.c2
-rw-r--r--drivers/mtd/devices/docecc.c1
-rw-r--r--drivers/net/3c505.c2
-rw-r--r--drivers/net/8139too.c6
-rw-r--r--drivers/net/Kconfig38
-rwxr-xr-xdrivers/net/amd8111e.c2
-rw-r--r--drivers/net/cs89x0.c13
-rw-r--r--drivers/net/cs89x0.h1
-rw-r--r--drivers/net/e1000/e1000_main.c29
-rw-r--r--drivers/net/hamradio/Kconfig2
-rw-r--r--drivers/net/ne.c4
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c7
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c8
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/plip.c29
-rw-r--r--drivers/net/sk98lin/skge.c80
-rw-r--r--drivers/net/sk98lin/skgeinit.c2
-rw-r--r--drivers/net/sk98lin/skxmac2.c8
-rw-r--r--drivers/net/skge.c233
-rw-r--r--drivers/net/skge.h41
-rw-r--r--drivers/net/smc91x.h2
-rw-r--r--drivers/net/tg3.c16
-rw-r--r--drivers/net/via-velocity.h4
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/orinoco_cs.c2
-rw-r--r--drivers/oprofile/cpu_buffer.c23
-rw-r--r--drivers/pci/bus.c4
-rw-r--r--drivers/pci/probe.c2
-rw-r--r--drivers/pci/quirks.c24
-rw-r--r--drivers/pci/rom.c4
-rw-r--r--drivers/pci/setup-bus.c12
-rw-r--r--drivers/pci/setup-res.c7
-rw-r--r--drivers/pcmcia/au1000_generic.c1
-rw-r--r--drivers/pcmcia/cistpl.c51
-rw-r--r--drivers/pcmcia/ds.c6
-rw-r--r--drivers/pcmcia/o2micro.h34
-rw-r--r--drivers/pcmcia/pcmcia_resource.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c18
-rw-r--r--drivers/pnp/pnpbios/rsparser.c2
-rw-r--r--drivers/s390/block/dasd.c6
-rw-r--r--drivers/s390/block/dasd_fba.c4
-rw-r--r--drivers/s390/char/tape.h7
-rw-r--r--drivers/s390/char/tape_core.c299
-rw-r--r--drivers/s390/char/vmcp.c6
-rw-r--r--drivers/s390/char/vmwatchdog.c6
-rw-r--r--drivers/s390/cio/chsc.c10
-rw-r--r--drivers/s390/cio/device_fsm.c3
-rw-r--r--drivers/s390/cio/device_status.c5
-rw-r--r--drivers/s390/cio/qdio.c20
-rw-r--r--drivers/s390/net/qeth.h26
-rw-r--r--drivers/s390/net/qeth_main.c24
-rw-r--r--drivers/s390/net/qeth_proc.c126
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c1
-rw-r--r--drivers/sbus/char/vfc_i2c.c19
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/NCR53c406a.c4
-rw-r--r--drivers/scsi/aacraid/aacraid.h6
-rw-r--r--drivers/scsi/aacraid/linit.c3
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c24
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm.c4
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h8
-rw-r--r--drivers/scsi/ata_piix.c19
-rw-r--r--drivers/scsi/dc395x.c2
-rw-r--r--drivers/scsi/dpt/dptsig.h4
-rw-r--r--drivers/scsi/dtc.c4
-rw-r--r--drivers/scsi/dtc.h4
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/scsi/ibmvscsi/srp.h2
-rw-r--r--drivers/scsi/initio.c2
-rw-r--r--drivers/scsi/ips.c8
-rw-r--r--drivers/scsi/ips.h39
-rw-r--r--drivers/scsi/lpfc/lpfc_compat.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.h4
-rw-r--r--drivers/scsi/pas16.c1
-rw-r--r--drivers/scsi/qla2xxx/Kconfig15
-rw-r--r--drivers/scsi/qla2xxx/Makefile2
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/st.c8
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.h16
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_nvram.c2
-rw-r--r--drivers/scsi/t128.h1
-rw-r--r--drivers/serial/8250_pci.c20
-rw-r--r--drivers/serial/8250_pnp.c22
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c2
-rw-r--r--drivers/serial/jsm/jsm.h2
-rw-r--r--drivers/serial/jsm/jsm_driver.c3
-rw-r--r--drivers/serial/jsm/jsm_neo.c30
-rw-r--r--drivers/serial/serial_cs.c10
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/core/devio.c18
-rw-r--r--drivers/usb/core/hcd.c4
-rw-r--r--drivers/usb/core/hcd.h8
-rw-r--r--drivers/usb/core/message.c6
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-q.c9
-rw-r--r--drivers/usb/host/ehci-sched.c13
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/isp116x-hcd.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c5
-rw-r--r--drivers/usb/host/ohci-s3c2410.c496
-rw-r--r--drivers/usb/image/microtek.c3
-rw-r--r--drivers/usb/input/acecad.c14
-rw-r--r--drivers/usb/input/aiptek.c6
-rw-r--r--drivers/usb/input/ati_remote.c8
-rw-r--r--drivers/usb/input/hid-core.c24
-rw-r--r--drivers/usb/input/hid-input.c11
-rw-r--r--drivers/usb/input/itmtouch.c6
-rw-r--r--drivers/usb/input/kbtab.c6
-rw-r--r--drivers/usb/input/mtouchusb.c6
-rw-r--r--drivers/usb/input/powermate.c6
-rw-r--r--drivers/usb/input/touchkitusb.c7
-rw-r--r--drivers/usb/input/usbkbd.c6
-rw-r--r--drivers/usb/input/usbmouse.c6
-rw-r--r--drivers/usb/input/wacom.c6
-rw-r--r--drivers/usb/input/xpad.c6
-rw-r--r--drivers/usb/media/konicawc.c6
-rw-r--r--drivers/usb/misc/ldusb.c7
-rw-r--r--drivers/usb/mon/Kconfig9
-rw-r--r--drivers/usb/mon/Makefile1
-rw-r--r--drivers/usb/net/pegasus.c1
-rw-r--r--drivers/usb/net/rtl8150.c2
-rw-r--r--drivers/usb/net/zd1201.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c146
-rw-r--r--drivers/usb/serial/ftdi_sio.h14
-rw-r--r--drivers/usb/usb-skeleton.c6
-rw-r--r--drivers/video/Kconfig4
-rw-r--r--drivers/video/aty/radeon_base.c5
-rw-r--r--drivers/video/console/fbcon.c3
-rw-r--r--drivers/video/fbcmap.c96
-rw-r--r--drivers/video/fbmem.c7
-rw-r--r--drivers/video/fbmon.c2
-rw-r--r--drivers/video/fbsysfs.c90
-rw-r--r--drivers/video/modedb.c5
-rw-r--r--drivers/video/nvidia/nvidia.c7
-rw-r--r--drivers/video/pm2fb.c16
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--drivers/video/sa1100fb.c2
-rw-r--r--drivers/video/tridentfb.c28
-rw-r--r--drivers/video/vesafb.c47
-rw-r--r--drivers/w1/Kconfig2
-rw-r--r--fs/Kconfig11
-rw-r--r--fs/autofs4/autofs_i.h1
-rw-r--r--fs/autofs4/inode.c73
-rw-r--r--fs/bio.c9
-rw-r--r--fs/dcache.c7
-rw-r--r--fs/ext2/ialloc.c1
-rw-r--r--fs/ext2/xattr.c2
-rw-r--r--fs/ext2/xip.c2
-rw-r--r--fs/ext3/ialloc.c2
-rw-r--r--fs/ext3/xattr.c2
-rw-r--r--fs/fcntl.c5
-rw-r--r--fs/hfs/bnode.c2
-rw-r--r--fs/hfs/extent.c3
-rw-r--r--fs/hfsplus/bnode.c2
-rw-r--r--fs/hfsplus/extents.c4
-rw-r--r--fs/hostfs/hostfs.h1
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hostfs/hostfs_user.c16
-rw-r--r--fs/inotify.c5
-rw-r--r--fs/isofs/compress.c6
-rw-r--r--fs/jffs/intrep.c3
-rw-r--r--fs/jfs/jfs_dmap.c46
-rw-r--r--fs/jfs/jfs_dtree.c13
-rw-r--r--fs/jfs/jfs_logmgr.c3
-rw-r--r--fs/jfs/jfs_metapage.c11
-rw-r--r--fs/locks.c81
-rw-r--r--fs/mbcache.c3
-rw-r--r--fs/namei.c4
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/ntfs/sysctl.h2
-rw-r--r--fs/reiserfs/inode.c12
-rw-r--r--fs/reiserfs/journal.c4
-rw-r--r--fs/reiserfs/xattr.c1
-rw-r--r--fs/sysfs/file.c18
-rw-r--r--fs/sysfs/inode.c2
-rw-r--r--include/acpi/acpi_drivers.h3
-rw-r--r--include/asm-alpha/pci.h3
-rw-r--r--include/asm-alpha/unistd.h7
-rw-r--r--include/asm-arm/bitops.h5
-rw-r--r--include/asm-arm/pci.h4
-rw-r--r--include/asm-cris/arch-v10/atomic.h7
-rw-r--r--include/asm-cris/arch-v10/bitops.h2
-rw-r--r--include/asm-cris/arch-v10/dma.h28
-rw-r--r--include/asm-cris/arch-v10/elf.h10
-rw-r--r--include/asm-cris/arch-v10/ide.h99
-rw-r--r--include/asm-cris/arch-v10/io.h1
-rw-r--r--include/asm-cris/arch-v10/io_interface_mux.h75
-rw-r--r--include/asm-cris/arch-v10/irq.h27
-rw-r--r--include/asm-cris/arch-v10/memmap.h22
-rw-r--r--include/asm-cris/arch-v10/mmu.h5
-rw-r--r--include/asm-cris/arch-v10/offset.h2
-rw-r--r--include/asm-cris/arch-v10/processor.h8
-rw-r--r--include/asm-cris/arch-v10/system.h2
-rw-r--r--include/asm-cris/arch-v32/arbiter.h30
-rw-r--r--include/asm-cris/arch-v32/atomic.h36
-rw-r--r--include/asm-cris/arch-v32/bitops.h64
-rw-r--r--include/asm-cris/arch-v32/byteorder.h20
-rw-r--r--include/asm-cris/arch-v32/cache.h9
-rw-r--r--include/asm-cris/arch-v32/checksum.h29
-rw-r--r--include/asm-cris/arch-v32/cryptocop.h272
-rw-r--r--include/asm-cris/arch-v32/delay.h18
-rw-r--r--include/asm-cris/arch-v32/dma.h79
-rw-r--r--include/asm-cris/arch-v32/elf.h73
-rw-r--r--include/asm-cris/arch-v32/hwregs/Makefile187
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/ata_defs_asm.h222
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/bif_core_defs_asm.h319
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/bif_dma_defs_asm.h495
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/bif_slave_defs_asm.h249
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/config_defs_asm.h131
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/cpu_vect.h41
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/cris_defs_asm.h114
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/cris_supp_reg.h10
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/dma_defs_asm.h368
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/eth_defs_asm.h498
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/gio_defs_asm.h276
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/intr_vect.h38
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/intr_vect_defs_asm.h355
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/irq_nmi_defs_asm.h69
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/marb_defs_asm.h579
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/mmu_defs_asm.h212
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/mmu_supp_reg.h7
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/pinmux_defs_asm.h632
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/reg_map_asm.h96
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/rt_trace_defs_asm.h142
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/ser_defs_asm.h359
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/sser_defs_asm.h462
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/strcop_defs_asm.h84
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/strmux_defs_asm.h100
-rw-r--r--include/asm-cris/arch-v32/hwregs/asm/timer_defs_asm.h229
-rw-r--r--include/asm-cris/arch-v32/hwregs/ata_defs.h222
-rw-r--r--include/asm-cris/arch-v32/hwregs/bif_core_defs.h284
-rw-r--r--include/asm-cris/arch-v32/hwregs/bif_dma_defs.h473
-rw-r--r--include/asm-cris/arch-v32/hwregs/bif_slave_defs.h249
-rw-r--r--include/asm-cris/arch-v32/hwregs/config_defs.h142
-rw-r--r--include/asm-cris/arch-v32/hwregs/cpu_vect.h41
-rw-r--r--include/asm-cris/arch-v32/hwregs/dma.h128
-rw-r--r--include/asm-cris/arch-v32/hwregs/dma_defs.h436
-rw-r--r--include/asm-cris/arch-v32/hwregs/eth_defs.h384
-rw-r--r--include/asm-cris/arch-v32/hwregs/extmem_defs.h369
-rw-r--r--include/asm-cris/arch-v32/hwregs/gio_defs.h295
-rw-r--r--include/asm-cris/arch-v32/hwregs/intr_vect.h39
-rw-r--r--include/asm-cris/arch-v32/hwregs/intr_vect_defs.h225
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/Makefile146
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_crc_par_defs_asm.h171
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_in_defs_asm.h321
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_out_defs_asm.h349
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_defs_asm.h234
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_extra_defs_asm.h155
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_defs_asm.h254
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_extra_defs_asm.h158
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_mpu_defs_asm.h177
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_reg_space_asm.h44
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_in_defs_asm.h182
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_out_defs_asm.h346
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_in_defs_asm.h111
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_out_defs_asm.h105
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_spu_defs_asm.h573
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cfg_defs_asm.h1052
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cpu_defs_asm.h1758
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_mpu_defs_asm.h1776
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_spu_defs_asm.h691
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_timer_grp_defs_asm.h237
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_trigger_grp_defs_asm.h157
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/asm/iop_version_defs_asm.h64
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_crc_par_defs.h232
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_dmc_in_defs.h325
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_dmc_out_defs.h326
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_defs.h255
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_extra_defs.h164
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_defs.h278
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_extra_defs.h164
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_mpu_defs.h190
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_mpu_macros.h764
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_reg_space.h44
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sap_in_defs.h179
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sap_out_defs.h306
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_scrc_in_defs.h160
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_scrc_out_defs.h146
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_spu_defs.h453
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sw_cfg_defs.h1042
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sw_cpu_defs.h853
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sw_mpu_defs.h893
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_sw_spu_defs.h552
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_timer_grp_defs.h249
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_trigger_grp_defs.h170
-rw-r--r--include/asm-cris/arch-v32/hwregs/iop/iop_version_defs.h99
-rw-r--r--include/asm-cris/arch-v32/hwregs/irq_nmi_defs.h104
-rw-r--r--include/asm-cris/arch-v32/hwregs/marb_bp_defs.h205
-rw-r--r--include/asm-cris/arch-v32/hwregs/marb_defs.h475
-rw-r--r--include/asm-cris/arch-v32/hwregs/pinmux_defs.h357
-rw-r--r--include/asm-cris/arch-v32/hwregs/reg_map.h103
-rw-r--r--include/asm-cris/arch-v32/hwregs/reg_rdwr.h15
-rw-r--r--include/asm-cris/arch-v32/hwregs/rt_trace_defs.h173
-rw-r--r--include/asm-cris/arch-v32/hwregs/ser_defs.h308
-rw-r--r--include/asm-cris/arch-v32/hwregs/sser_defs.h331
-rw-r--r--include/asm-cris/arch-v32/hwregs/strcop.h57
-rw-r--r--include/asm-cris/arch-v32/hwregs/strcop_defs.h109
-rw-r--r--include/asm-cris/arch-v32/hwregs/strmux_defs.h127
-rw-r--r--include/asm-cris/arch-v32/hwregs/supp_reg.h78
-rw-r--r--include/asm-cris/arch-v32/hwregs/timer_defs.h266
-rw-r--r--include/asm-cris/arch-v32/ide.h61
-rw-r--r--include/asm-cris/arch-v32/intmem.h9
-rw-r--r--include/asm-cris/arch-v32/io.h98
-rw-r--r--include/asm-cris/arch-v32/irq.h120
-rw-r--r--include/asm-cris/arch-v32/juliette.h326
-rw-r--r--include/asm-cris/arch-v32/memmap.h24
-rw-r--r--include/asm-cris/arch-v32/mmu.h111
-rw-r--r--include/asm-cris/arch-v32/offset.h35
-rw-r--r--include/asm-cris/arch-v32/page.h28
-rw-r--r--include/asm-cris/arch-v32/pgtable.h9
-rw-r--r--include/asm-cris/arch-v32/pinmux.h39
-rw-r--r--include/asm-cris/arch-v32/processor.h60
-rw-r--r--include/asm-cris/arch-v32/ptrace.h114
-rw-r--r--include/asm-cris/arch-v32/spinlock.h163
-rw-r--r--include/asm-cris/arch-v32/system.h79
-rw-r--r--include/asm-cris/arch-v32/thread_info.h13
-rw-r--r--include/asm-cris/arch-v32/timex.h31
-rw-r--r--include/asm-cris/arch-v32/tlb.h14
-rw-r--r--include/asm-cris/arch-v32/uaccess.h748
-rw-r--r--include/asm-cris/arch-v32/unistd.h148
-rw-r--r--include/asm-cris/arch-v32/user.h41
-rw-r--r--include/asm-cris/atomic.h66
-rw-r--r--include/asm-cris/axisflashmap.h3
-rw-r--r--include/asm-cris/bitops.h35
-rw-r--r--include/asm-cris/dma-mapping.h170
-rw-r--r--include/asm-cris/dma.h8
-rw-r--r--include/asm-cris/elf.h45
-rw-r--r--include/asm-cris/etraxgpio.h10
-rw-r--r--include/asm-cris/hardirq.h5
-rw-r--r--include/asm-cris/hw_irq.h7
-rw-r--r--include/asm-cris/ide.h1
-rw-r--r--include/asm-cris/io.h103
-rw-r--r--include/asm-cris/irq.h10
-rw-r--r--include/asm-cris/kmap_types.h4
-rw-r--r--include/asm-cris/mmu_context.h2
-rw-r--r--include/asm-cris/page.h7
-rw-r--r--include/asm-cris/pci.h102
-rw-r--r--include/asm-cris/pgalloc.h10
-rw-r--r--include/asm-cris/pgtable.h42
-rw-r--r--include/asm-cris/processor.h9
-rw-r--r--include/asm-cris/ptrace.h2
-rw-r--r--include/asm-cris/semaphore.h21
-rw-r--r--include/asm-cris/smp.h7
-rw-r--r--include/asm-cris/spinlock.h1
-rw-r--r--include/asm-cris/sync_serial.h106
-rw-r--r--include/asm-cris/termbits.h2
-rw-r--r--include/asm-cris/thread_info.h2
-rw-r--r--include/asm-cris/timex.h2
-rw-r--r--include/asm-cris/tlbflush.h19
-rw-r--r--include/asm-cris/types.h2
-rw-r--r--include/asm-cris/unistd.h11
-rw-r--r--include/asm-generic/pci.h8
-rw-r--r--include/asm-generic/sections.h1
-rw-r--r--include/asm-i386/bitops.h53
-rw-r--r--include/asm-i386/mach-visws/do_timer.h1
-rw-r--r--include/asm-i386/pci.h4
-rw-r--r--include/asm-i386/ptrace.h3
-rw-r--r--include/asm-i386/smp.h3
-rw-r--r--include/asm-ia64/unistd.h3
-rw-r--r--include/asm-parisc/pci.h4
-rw-r--r--include/asm-ppc/cpm2.h5
-rw-r--r--include/asm-ppc/dma-mapping.h2
-rw-r--r--include/asm-ppc/ibm44x.h34
-rw-r--r--include/asm-ppc/ibm4xx.h4
-rw-r--r--include/asm-ppc/ibm_ocp.h12
-rw-r--r--include/asm-ppc/mpc10x.h3
-rw-r--r--include/asm-ppc/pci.h4
-rw-r--r--include/asm-ppc/pgtable.h52
-rw-r--r--include/asm-ppc/ppc_asm.h6
-rw-r--r--include/asm-ppc/unistd.h5
-rw-r--r--include/asm-ppc64/iSeries/HvReleaseData.h11
-rw-r--r--include/asm-ppc64/iSeries/LparMap.h23
-rw-r--r--include/asm-ppc64/machdep.h2
-rw-r--r--include/asm-ppc64/mmu.h5
-rw-r--r--include/asm-ppc64/pci.h4
-rw-r--r--include/asm-ppc64/topology.h5
-rw-r--r--include/asm-ppc64/unistd.h5
-rw-r--r--include/asm-ppc64/xics.h2
-rw-r--r--include/asm-s390/atomic.h8
-rw-r--r--include/asm-s390/bitops.h440
-rw-r--r--include/asm-s390/lowcore.h4
-rw-r--r--include/asm-s390/processor.h5
-rw-r--r--include/asm-s390/spinlock.h252
-rw-r--r--include/asm-s390/unistd.h7
-rw-r--r--include/asm-sparc/unistd.h6
-rw-r--r--include/asm-sparc64/unistd.h6
-rw-r--r--include/asm-um/vm86.h6
-rw-r--r--include/asm-v850/bitops.h6
-rw-r--r--include/asm-v850/cache.h7
-rw-r--r--include/asm-v850/io.h37
-rw-r--r--include/asm-v850/page.h5
-rw-r--r--include/asm-v850/pci.h37
-rw-r--r--include/asm-v850/pgtable.h2
-rw-r--r--include/asm-v850/v850e2_cache.h5
-rw-r--r--include/asm-x86_64/bitops.h3
-rw-r--r--include/asm-x86_64/bug.h13
-rw-r--r--include/asm-x86_64/desc.h1
-rw-r--r--include/asm-x86_64/ipi.h45
-rw-r--r--include/asm-x86_64/irq.h2
-rw-r--r--include/asm-x86_64/msr.h2
-rw-r--r--include/asm-x86_64/pci.h4
-rw-r--r--include/asm-x86_64/pgtable.h2
-rw-r--r--include/asm-x86_64/smp.h6
-rw-r--r--include/asm-x86_64/system.h7
-rw-r--r--include/asm-x86_64/tlbflush.h9
-rw-r--r--include/linux/acpi.h4
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/dcookies.h4
-rw-r--r--include/linux/fs.h6
-rw-r--r--include/linux/fsnotify.h31
-rw-r--r--include/linux/ftape.h2
-rw-r--r--include/linux/input.h6
-rw-r--r--include/linux/mbcache.h2
-rw-r--r--include/linux/mm.h22
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/raid/bitmap.h1
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/uinput.h5
-rw-r--r--include/linux/usb_input.h25
-rw-r--r--include/linux/watchdog.h10
-rw-r--r--include/linux/zlib.h5
-rw-r--r--include/media/tuner.h4
-rw-r--r--include/media/tveeprom.h1
-rw-r--r--include/net/bluetooth/bluetooth.h8
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/sound/core.h37
-rw-r--r--include/sound/driver.h2
-rw-r--r--include/sound/emu10k1.h1
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h16
-rw-r--r--init/Kconfig2
-rw-r--r--init/main.c3
-rw-r--r--ipc/sem.c10
-rw-r--r--ipc/shm.c2
-rw-r--r--kernel/capability.c20
-rw-r--r--kernel/cpuset.c26
-rw-r--r--kernel/crash_dump.c11
-rw-r--r--kernel/exit.c4
-rw-r--r--kernel/itimer.c37
-rw-r--r--kernel/module.c15
-rw-r--r--kernel/posix-timers.c18
-rw-r--r--kernel/power/smp.c2
-rw-r--r--kernel/sys.c4
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--kernel/sysctl.c12
-rw-r--r--kernel/time.c2
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/Makefile4
-rw-r--r--lib/crc32.c2
-rw-r--r--lib/inflate.c16
-rw-r--r--lib/zlib_inflate/inftrees.c2
-rw-r--r--mm/hugetlb.c11
-rw-r--r--mm/madvise.c13
-rw-r--r--mm/memory.c73
-rw-r--r--mm/mempolicy.c4
-rw-r--r--mm/mmap.c6
-rw-r--r--mm/mremap.c2
-rw-r--r--mm/nommu.c6
-rw-r--r--mm/page_alloc.c25
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/lib.c25
-rw-r--r--net/bluetooth/rfcomm/core.c4
-rw-r--r--net/core/dev.c3
-rw-r--r--net/core/dst.c15
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/core/sock.c13
-rw-r--r--net/core/utils.c37
-rw-r--r--net/ipv4/Kconfig2
-rw-r--r--net/ipv4/Makefile2
-rw-r--r--net/ipv4/fib_semantics.c9
-rw-r--r--net/ipv4/icmp.c3
-rw-r--r--net/ipv4/ip_fragment.c8
-rw-r--r--net/ipv4/ip_gre.c21
-rw-r--r--net/ipv4/ip_sockglue.c3
-rw-r--r--net/ipv4/ipip.c20
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c7
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c4
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv4/tcp_output.c86
-rw-r--r--net/ipv4/udp.c34
-rw-r--r--net/ipv4/utils.c59
-rw-r--r--net/ipv6/ip6_output.c7
-rw-r--r--net/ipv6/ipv6_sockglue.c3
-rw-r--r--net/ipv6/sit.c21
-rw-r--r--scripts/kconfig/gconf.c144
-rw-r--r--scripts/kconfig/gconf.glade167
-rw-r--r--security/keys/keyctl.c11
-rw-r--r--security/keys/keyring.c6
-rw-r--r--security/keys/process_keys.c2
-rw-r--r--security/keys/request_key.c2
-rw-r--r--security/selinux/hooks.c7
-rw-r--r--security/selinux/include/security.h2
-rw-r--r--security/selinux/ss/mls.c71
-rw-r--r--security/selinux/ss/mls.h4
-rw-r--r--security/selinux/ss/services.c55
-rw-r--r--sound/arm/Kconfig14
-rw-r--r--sound/arm/Makefile8
-rw-r--r--sound/arm/pxa2xx-ac97.c410
-rw-r--r--sound/arm/pxa2xx-pcm.c367
-rw-r--r--sound/arm/pxa2xx-pcm.h29
-rw-r--r--sound/core/device.c15
-rw-r--r--sound/core/info.c5
-rw-r--r--sound/core/memalloc.c3
-rw-r--r--sound/core/memory.c8
-rw-r--r--sound/core/seq/Makefile2
-rw-r--r--sound/core/seq/instr/ainstr_gf1.c3
-rw-r--r--sound/core/seq/instr/ainstr_iw.c8
-rw-r--r--sound/core/seq/oss/seq_oss_device.h6
-rw-r--r--sound/core/seq/seq_memory.c4
-rw-r--r--sound/core/seq/seq_midi.c16
-rw-r--r--sound/core/seq/seq_midi_event.c2
-rw-r--r--sound/core/wrappers.c2
-rw-r--r--sound/drivers/serial-u16550.c10
-rw-r--r--sound/drivers/vx/vx_uer.c46
-rw-r--r--sound/i2c/other/ak4114.c1
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/sb/emu8000_patch.c2
-rw-r--r--sound/isa/sb/sb_mixer.c4
-rw-r--r--sound/isa/wavefront/wavefront_fx.c34
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c4
-rw-r--r--sound/oss/pss.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c25
-rw-r--r--sound/pci/ac97/ac97_patch.c3
-rw-r--r--sound/pci/ali5451/ali5451.c4
-rw-r--r--sound/pci/atiixp_modem.c1
-rw-r--r--sound/pci/cmipci.c23
-rw-r--r--sound/pci/cs4281.c2
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c15
-rw-r--r--sound/pci/emu10k1/emu10k1.c10
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c133
-rw-r--r--sound/pci/emu10k1/memory.c2
-rw-r--r--sound/pci/emu10k1/p16v.c20
-rw-r--r--sound/pci/ens1370.c22
-rw-r--r--sound/pci/es1968.c26
-rw-r--r--sound/pci/hda/hda_codec.h3
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/patch_cmedia.c5
-rw-r--r--sound/pci/hda/patch_realtek.c28
-rw-r--r--sound/pci/hda/patch_sigmatel.c812
-rw-r--r--sound/pci/intel8x0.c23
-rw-r--r--sound/pci/maestro3.c34
-rw-r--r--sound/pci/mixart/mixart.c4
-rw-r--r--sound/pci/nm256/nm256.c16
-rw-r--r--sound/pci/rme9652/hdsp.c68
-rw-r--r--sound/pci/rme9652/rme9652.c2
-rw-r--r--sound/pci/trident/trident_main.c6
-rw-r--r--sound/pci/trident/trident_memory.c2
-rw-r--r--sound/pci/via82xx.c16
-rw-r--r--sound/pci/via82xx_modem.c13
-rw-r--r--sound/pci/vx222/vx222_ops.c4
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c6
-rw-r--r--sound/pcmcia/Kconfig15
-rw-r--r--sound/pcmcia/vx/Makefile7
-rw-r--r--sound/pcmcia/vx/vx_entry.c375
-rw-r--r--sound/pcmcia/vx/vxp440.c14
-rw-r--r--sound/pcmcia/vx/vxp_ops.c2
-rw-r--r--sound/pcmcia/vx/vxpocket.c427
-rw-r--r--sound/pcmcia/vx/vxpocket.h27
-rw-r--r--sound/ppc/awacs.c6
-rw-r--r--sound/ppc/burgundy.c4
-rw-r--r--sound/ppc/pmac.c8
-rw-r--r--sound/ppc/pmac.h5
-rw-r--r--sound/ppc/tumbler.c16
-rw-r--r--sound/sparc/Kconfig22
-rw-r--r--sound/sparc/Makefile4
-rw-r--r--sound/sparc/dbri.c2729
-rw-r--r--sound/usb/usbaudio.c113
-rw-r--r--sound/usb/usbaudio.h38
-rw-r--r--sound/usb/usbmidi.c21
-rw-r--r--sound/usb/usbmixer.c4
-rw-r--r--sound/usb/usbquirks.h29
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c3
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c6
1115 files changed, 88971 insertions, 12248 deletions
diff --git a/CREDITS b/CREDITS
index 3b7a1548aaf9..50121d432b62 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1624,10 +1624,10 @@ E: ajoshi@shell.unixbox.com
1624D: fbdev hacking 1624D: fbdev hacking
1625 1625
1626N: Jesper Juhl 1626N: Jesper Juhl
1627E: juhl-lkml@dif.dk 1627E: jesper.juhl@gmail.com
1628D: Various small janitor fixes, cleanups etc. 1628D: Various fixes, cleanups and minor features.
1629S: Lemnosvej 1, 3.tv 1629S: Lemnosvej 1, 3.tv
1630S: 2300 Copenhagen S 1630S: 2300 Copenhagen S.
1631S: Denmark 1631S: Denmark
1632 1632
1633N: Jozsef Kadlecsik 1633N: Jozsef Kadlecsik
@@ -2380,8 +2380,8 @@ E: tmolina@cablespeed.com
2380D: bug fixes, documentation, minor hackery 2380D: bug fixes, documentation, minor hackery
2381 2381
2382N: James Morris 2382N: James Morris
2383E: jmorris@redhat.com 2383E: jmorris@namei.org
2384W: http://www.intercode.com.au/jmorris/ 2384W: http://namei.org/
2385D: Netfilter, Linux Security Modules (LSM), SELinux, IPSec, 2385D: Netfilter, Linux Security Modules (LSM), SELinux, IPSec,
2386D: Crypto API, general networking, miscellaneous. 2386D: Crypto API, general networking, miscellaneous.
2387S: PO Box 707 2387S: PO Box 707
diff --git a/Documentation/Changes b/Documentation/Changes
index dfec7569d450..5eaab0441d76 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -65,6 +65,7 @@ o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
65o nfs-utils 1.0.5 # showmount --version 65o nfs-utils 1.0.5 # showmount --version
66o procps 3.2.0 # ps --version 66o procps 3.2.0 # ps --version
67o oprofile 0.9 # oprofiled --version 67o oprofile 0.9 # oprofiled --version
68o udev 058 # udevinfo -V
68 69
69Kernel compilation 70Kernel compilation
70================== 71==================
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 6761a7b241a5..7f43b040311e 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -149,6 +149,11 @@ USB, framebuffer devices, the VFS, the SCSI subsystem, etc. See the
149MAINTAINERS file for a mailing list that relates specifically to 149MAINTAINERS file for a mailing list that relates specifically to
150your change. 150your change.
151 151
152If changes affect userland-kernel interfaces, please send
153the MAN-PAGES maintainer (as listed in the MAINTAINERS file)
154a man-pages patch, or at least a notification of the change,
155so that some information makes its way into the manual pages.
156
152Even if the maintainer did not respond in step #4, make sure to ALWAYS 157Even if the maintainer did not respond in step #4, make sure to ALWAYS
153copy the maintainer when you change their code. 158copy the maintainer when you change their code.
154 159
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index b974cf595d01..96bea278bbf6 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -104,6 +104,7 @@ logo_*.c
104logo_*_clut224.c 104logo_*_clut224.c
105logo_*_mono.c 105logo_*_mono.c
106lxdialog 106lxdialog
107mach-types
107mach-types.h 108mach-types.h
108make_times_h 109make_times_h
109map 110map
diff --git a/Documentation/fb/vesafb.txt b/Documentation/fb/vesafb.txt
index 814e2f56a6ad..62db6758d1c1 100644
--- a/Documentation/fb/vesafb.txt
+++ b/Documentation/fb/vesafb.txt
@@ -144,7 +144,21 @@ vgapal Use the standard vga registers for palette changes.
144 This is the default. 144 This is the default.
145pmipal Use the protected mode interface for palette changes. 145pmipal Use the protected mode interface for palette changes.
146 146
147mtrr setup memory type range registers for the vesafb framebuffer. 147mtrr:n setup memory type range registers for the vesafb framebuffer
148 where n:
149 0 - disabled (equivalent to nomtrr)
150 1 - uncachable
151 2 - write-back
152 3 - write-combining (default)
153 4 - write-through
154
155 If you see the following in dmesg, choose the type that matches the
156 old one. In this example, use "mtrr:2".
157...
158mtrr: type mismatch for e0000000,8000000 old: write-back new: write-combining
159...
160
161nomtrr disable mtrr
148 162
149vremap:n 163vremap:n
150 remap 'n' MiB of video RAM. If 0 or not specified, remap memory 164 remap 'n' MiB of video RAM. If 0 or not specified, remap memory
diff --git a/Documentation/infiniband/core_locking.txt b/Documentation/infiniband/core_locking.txt
new file mode 100644
index 000000000000..e1678542279a
--- /dev/null
+++ b/Documentation/infiniband/core_locking.txt
@@ -0,0 +1,114 @@
1INFINIBAND MIDLAYER LOCKING
2
3 This guide is an attempt to make explicit the locking assumptions
4 made by the InfiniBand midlayer. It describes the requirements on
5 both low-level drivers that sit below the midlayer and upper level
6 protocols that use the midlayer.
7
8Sleeping and interrupt context
9
10 With the following exceptions, a low-level driver implementation of
11 all of the methods in struct ib_device may sleep. The exceptions
12 are any methods from the list:
13
14 create_ah
15 modify_ah
16 query_ah
17 destroy_ah
18 bind_mw
19 post_send
20 post_recv
21 poll_cq
22 req_notify_cq
23 map_phys_fmr
24
25 which may not sleep and must be callable from any context.
26
27 The corresponding functions exported to upper level protocol
28 consumers:
29
30 ib_create_ah
31 ib_modify_ah
32 ib_query_ah
33 ib_destroy_ah
34 ib_bind_mw
35 ib_post_send
36 ib_post_recv
37 ib_req_notify_cq
38 ib_map_phys_fmr
39
40 are therefore safe to call from any context.
41
42 In addition, the function
43
44 ib_dispatch_event
45
46 used by low-level drivers to dispatch asynchronous events through
47 the midlayer is also safe to call from any context.
48
49Reentrancy
50
51 All of the methods in struct ib_device exported by a low-level
52 driver must be fully reentrant. The low-level driver is required to
53 perform all synchronization necessary to maintain consistency, even
54 if multiple function calls using the same object are run
55 simultaneously.
56
57 The IB midlayer does not perform any serialization of function calls.
58
59 Because low-level drivers are reentrant, upper level protocol
60 consumers are not required to perform any serialization. However,
61 some serialization may be required to get sensible results. For
62 example, a consumer may safely call ib_poll_cq() on multiple CPUs
63 simultaneously. However, the ordering of the work completion
64 information between different calls of ib_poll_cq() is not defined.
65
66Callbacks
67
68 A low-level driver must not perform a callback directly from the
69 same callchain as an ib_device method call. For example, it is not
70 allowed for a low-level driver to call a consumer's completion event
71 handler directly from its post_send method. Instead, the low-level
72 driver should defer this callback by, for example, scheduling a
73 tasklet to perform the callback.
74
75 The low-level driver is responsible for ensuring that multiple
76 completion event handlers for the same CQ are not called
77 simultaneously. The driver must guarantee that only one CQ event
78 handler for a given CQ is running at a time. In other words, the
79 following situation is not allowed:
80
81 CPU1 CPU2
82
83 low-level driver ->
84 consumer CQ event callback:
85 /* ... */
86 ib_req_notify_cq(cq, ...);
87 low-level driver ->
88 /* ... */ consumer CQ event callback:
89 /* ... */
90 return from CQ event handler
91
92 The context in which completion event and asynchronous event
93 callbacks run is not defined. Depending on the low-level driver, it
94 may be process context, softirq context, or interrupt context.
95 Upper level protocol consumers may not sleep in a callback.
96
97Hot-plug
98
99 A low-level driver announces that a device is ready for use by
100 consumers when it calls ib_register_device(), all initialization
101 must be complete before this call. The device must remain usable
102 until the driver's call to ib_unregister_device() has returned.
103
104 A low-level driver must call ib_register_device() and
105 ib_unregister_device() from process context. It must not hold any
106 semaphores that could cause deadlock if a consumer calls back into
107 the driver across these calls.
108
109 An upper level protocol consumer may begin using an IB device as
110 soon as the add method of its struct ib_client is called for that
111 device. A consumer must finish all cleanup and free all resources
112 relating to a device before returning from the remove method.
113
114 A consumer is permitted to sleep in its add and remove methods.
diff --git a/Documentation/infiniband/user_mad.txt b/Documentation/infiniband/user_mad.txt
index cae0c83f1ee9..750fe5e80ebc 100644
--- a/Documentation/infiniband/user_mad.txt
+++ b/Documentation/infiniband/user_mad.txt
@@ -28,13 +28,37 @@ Creating MAD agents
28 28
29Receiving MADs 29Receiving MADs
30 30
31 MADs are received using read(). The buffer passed to read() must be 31 MADs are received using read(). The receive side now supports
32 large enough to hold at least one struct ib_user_mad. For example: 32 RMPP. The buffer passed to read() must be at least one
33 33 struct ib_user_mad + 256 bytes. For example:
34 struct ib_user_mad mad; 34
35 ret = read(fd, &mad, sizeof mad); 35 If the buffer passed is not large enough to hold the received
36 if (ret != sizeof mad) 36 MAD (RMPP), the errno is set to ENOSPC and the length of the
37 buffer needed is set in mad.length.
38
39 Example for normal MAD (non RMPP) reads:
40 struct ib_user_mad *mad;
41 mad = malloc(sizeof *mad + 256);
42 ret = read(fd, mad, sizeof *mad + 256);
43 if (ret != sizeof mad + 256) {
44 perror("read");
45 free(mad);
46 }
47
48 Example for RMPP reads:
49 struct ib_user_mad *mad;
50 mad = malloc(sizeof *mad + 256);
51 ret = read(fd, mad, sizeof *mad + 256);
52 if (ret == -ENOSPC)) {
53 length = mad.length;
54 free(mad);
55 mad = malloc(sizeof *mad + length);
56 ret = read(fd, mad, sizeof *mad + length);
57 }
58 if (ret < 0) {
37 perror("read"); 59 perror("read");
60 free(mad);
61 }
38 62
39 In addition to the actual MAD contents, the other struct ib_user_mad 63 In addition to the actual MAD contents, the other struct ib_user_mad
40 fields will be filled in with information on the received MAD. For 64 fields will be filled in with information on the received MAD. For
@@ -50,18 +74,21 @@ Sending MADs
50 74
51 MADs are sent using write(). The agent ID for sending should be 75 MADs are sent using write(). The agent ID for sending should be
52 filled into the id field of the MAD, the destination LID should be 76 filled into the id field of the MAD, the destination LID should be
53 filled into the lid field, and so on. For example: 77 filled into the lid field, and so on. The send side does support
78 RMPP so arbitrary length MAD can be sent. For example:
79
80 struct ib_user_mad *mad;
54 81
55 struct ib_user_mad mad; 82 mad = malloc(sizeof *mad + mad_length);
56 83
57 /* fill in mad.data */ 84 /* fill in mad->data */
58 85
59 mad.id = my_agent; /* req.id from agent registration */ 86 mad->hdr.id = my_agent; /* req.id from agent registration */
60 mad.lid = my_dest; /* in network byte order... */ 87 mad->hdr.lid = my_dest; /* in network byte order... */
61 /* etc. */ 88 /* etc. */
62 89
63 ret = write(fd, &mad, sizeof mad); 90 ret = write(fd, &mad, sizeof *mad + mad_length);
64 if (ret != sizeof mad) 91 if (ret != sizeof *mad + mad_length)
65 perror("write"); 92 perror("write");
66 93
67Setting IsSM Capability Bit 94Setting IsSM Capability Bit
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
new file mode 100644
index 000000000000..0541fe1de704
--- /dev/null
+++ b/Documentation/kprobes.txt
@@ -0,0 +1,588 @@
1Title : Kernel Probes (Kprobes)
2Authors : Jim Keniston <jkenisto@us.ibm.com>
3 : Prasanna S Panchamukhi <prasanna@in.ibm.com>
4
5CONTENTS
6
71. Concepts: Kprobes, Jprobes, Return Probes
82. Architectures Supported
93. Configuring Kprobes
104. API Reference
115. Kprobes Features and Limitations
126. Probe Overhead
137. TODO
148. Kprobes Example
159. Jprobes Example
1610. Kretprobes Example
17
181. Concepts: Kprobes, Jprobes, Return Probes
19
20Kprobes enables you to dynamically break into any kernel routine and
21collect debugging and performance information non-disruptively. You
22can trap at almost any kernel code address, specifying a handler
23routine to be invoked when the breakpoint is hit.
24
25There are currently three types of probes: kprobes, jprobes, and
26kretprobes (also called return probes). A kprobe can be inserted
27on virtually any instruction in the kernel. A jprobe is inserted at
28the entry to a kernel function, and provides convenient access to the
29function's arguments. A return probe fires when a specified function
30returns.
31
32In the typical case, Kprobes-based instrumentation is packaged as
33a kernel module. The module's init function installs ("registers")
34one or more probes, and the exit function unregisters them. A
35registration function such as register_kprobe() specifies where
36the probe is to be inserted and what handler is to be called when
37the probe is hit.
38
39The next three subsections explain how the different types of
40probes work. They explain certain things that you'll need to
41know in order to make the best use of Kprobes -- e.g., the
42difference between a pre_handler and a post_handler, and how
43to use the maxactive and nmissed fields of a kretprobe. But
44if you're in a hurry to start using Kprobes, you can skip ahead
45to section 2.
46
471.1 How Does a Kprobe Work?
48
49When a kprobe is registered, Kprobes makes a copy of the probed
50instruction and replaces the first byte(s) of the probed instruction
51with a breakpoint instruction (e.g., int3 on i386 and x86_64).
52
53When a CPU hits the breakpoint instruction, a trap occurs, the CPU's
54registers are saved, and control passes to Kprobes via the
55notifier_call_chain mechanism. Kprobes executes the "pre_handler"
56associated with the kprobe, passing the handler the addresses of the
57kprobe struct and the saved registers.
58
59Next, Kprobes single-steps its copy of the probed instruction.
60(It would be simpler to single-step the actual instruction in place,
61but then Kprobes would have to temporarily remove the breakpoint
62instruction. This would open a small time window when another CPU
63could sail right past the probepoint.)
64
65After the instruction is single-stepped, Kprobes executes the
66"post_handler," if any, that is associated with the kprobe.
67Execution then continues with the instruction following the probepoint.
68
691.2 How Does a Jprobe Work?
70
71A jprobe is implemented using a kprobe that is placed on a function's
72entry point. It employs a simple mirroring principle to allow
73seamless access to the probed function's arguments. The jprobe
74handler routine should have the same signature (arg list and return
75type) as the function being probed, and must always end by calling
76the Kprobes function jprobe_return().
77
78Here's how it works. When the probe is hit, Kprobes makes a copy of
79the saved registers and a generous portion of the stack (see below).
80Kprobes then points the saved instruction pointer at the jprobe's
81handler routine, and returns from the trap. As a result, control
82passes to the handler, which is presented with the same register and
83stack contents as the probed function. When it is done, the handler
84calls jprobe_return(), which traps again to restore the original stack
85contents and processor state and switch to the probed function.
86
87By convention, the callee owns its arguments, so gcc may produce code
88that unexpectedly modifies that portion of the stack. This is why
89Kprobes saves a copy of the stack and restores it after the jprobe
90handler has run. Up to MAX_STACK_SIZE bytes are copied -- e.g.,
9164 bytes on i386.
92
93Note that the probed function's args may be passed on the stack
94or in registers (e.g., for x86_64 or for an i386 fastcall function).
95The jprobe will work in either case, so long as the handler's
96prototype matches that of the probed function.
97
981.3 How Does a Return Probe Work?
99
100When you call register_kretprobe(), Kprobes establishes a kprobe at
101the entry to the function. When the probed function is called and this
102probe is hit, Kprobes saves a copy of the return address, and replaces
103the return address with the address of a "trampoline." The trampoline
104is an arbitrary piece of code -- typically just a nop instruction.
105At boot time, Kprobes registers a kprobe at the trampoline.
106
107When the probed function executes its return instruction, control
108passes to the trampoline and that probe is hit. Kprobes' trampoline
109handler calls the user-specified handler associated with the kretprobe,
110then sets the saved instruction pointer to the saved return address,
111and that's where execution resumes upon return from the trap.
112
113While the probed function is executing, its return address is
114stored in an object of type kretprobe_instance. Before calling
115register_kretprobe(), the user sets the maxactive field of the
116kretprobe struct to specify how many instances of the specified
117function can be probed simultaneously. register_kretprobe()
118pre-allocates the indicated number of kretprobe_instance objects.
119
120For example, if the function is non-recursive and is called with a
121spinlock held, maxactive = 1 should be enough. If the function is
122non-recursive and can never relinquish the CPU (e.g., via a semaphore
123or preemption), NR_CPUS should be enough. If maxactive <= 0, it is
124set to a default value. If CONFIG_PREEMPT is enabled, the default
125is max(10, 2*NR_CPUS). Otherwise, the default is NR_CPUS.
126
127It's not a disaster if you set maxactive too low; you'll just miss
128some probes. In the kretprobe struct, the nmissed field is set to
129zero when the return probe is registered, and is incremented every
130time the probed function is entered but there is no kretprobe_instance
131object available for establishing the return probe.
132
1332. Architectures Supported
134
135Kprobes, jprobes, and return probes are implemented on the following
136architectures:
137
138- i386
139- x86_64 (AMD-64, E64MT)
140- ppc64
141- ia64 (Support for probes on certain instruction types is still in progress.)
142- sparc64 (Return probes not yet implemented.)
143
1443. Configuring Kprobes
145
146When configuring the kernel using make menuconfig/xconfig/oldconfig,
147ensure that CONFIG_KPROBES is set to "y". Under "Kernel hacking",
148look for "Kprobes". You may have to enable "Kernel debugging"
149(CONFIG_DEBUG_KERNEL) before you can enable Kprobes.
150
151You may also want to ensure that CONFIG_KALLSYMS and perhaps even
152CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name()
153is a handy, version-independent way to find a function's address.
154
155If you need to insert a probe in the middle of a function, you may find
156it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO),
157so you can use "objdump -d -l vmlinux" to see the source-to-object
158code mapping.
159
1604. API Reference
161
162The Kprobes API includes a "register" function and an "unregister"
163function for each type of probe. Here are terse, mini-man-page
164specifications for these functions and the associated probe handlers
165that you'll write. See the latter half of this document for examples.
166
1674.1 register_kprobe
168
169#include <linux/kprobes.h>
170int register_kprobe(struct kprobe *kp);
171
172Sets a breakpoint at the address kp->addr. When the breakpoint is
173hit, Kprobes calls kp->pre_handler. After the probed instruction
174is single-stepped, Kprobe calls kp->post_handler. If a fault
175occurs during execution of kp->pre_handler or kp->post_handler,
176or during single-stepping of the probed instruction, Kprobes calls
177kp->fault_handler. Any or all handlers can be NULL.
178
179register_kprobe() returns 0 on success, or a negative errno otherwise.
180
181User's pre-handler (kp->pre_handler):
182#include <linux/kprobes.h>
183#include <linux/ptrace.h>
184int pre_handler(struct kprobe *p, struct pt_regs *regs);
185
186Called with p pointing to the kprobe associated with the breakpoint,
187and regs pointing to the struct containing the registers saved when
188the breakpoint was hit. Return 0 here unless you're a Kprobes geek.
189
190User's post-handler (kp->post_handler):
191#include <linux/kprobes.h>
192#include <linux/ptrace.h>
193void post_handler(struct kprobe *p, struct pt_regs *regs,
194 unsigned long flags);
195
196p and regs are as described for the pre_handler. flags always seems
197to be zero.
198
199User's fault-handler (kp->fault_handler):
200#include <linux/kprobes.h>
201#include <linux/ptrace.h>
202int fault_handler(struct kprobe *p, struct pt_regs *regs, int trapnr);
203
204p and regs are as described for the pre_handler. trapnr is the
205architecture-specific trap number associated with the fault (e.g.,
206on i386, 13 for a general protection fault or 14 for a page fault).
207Returns 1 if it successfully handled the exception.
208
2094.2 register_jprobe
210
211#include <linux/kprobes.h>
212int register_jprobe(struct jprobe *jp)
213
214Sets a breakpoint at the address jp->kp.addr, which must be the address
215of the first instruction of a function. When the breakpoint is hit,
216Kprobes runs the handler whose address is jp->entry.
217
218The handler should have the same arg list and return type as the probed
219function; and just before it returns, it must call jprobe_return().
220(The handler never actually returns, since jprobe_return() returns
221control to Kprobes.) If the probed function is declared asmlinkage,
222fastcall, or anything else that affects how args are passed, the
223handler's declaration must match.
224
225register_jprobe() returns 0 on success, or a negative errno otherwise.
226
2274.3 register_kretprobe
228
229#include <linux/kprobes.h>
230int register_kretprobe(struct kretprobe *rp);
231
232Establishes a return probe for the function whose address is
233rp->kp.addr. When that function returns, Kprobes calls rp->handler.
234You must set rp->maxactive appropriately before you call
235register_kretprobe(); see "How Does a Return Probe Work?" for details.
236
237register_kretprobe() returns 0 on success, or a negative errno
238otherwise.
239
240User's return-probe handler (rp->handler):
241#include <linux/kprobes.h>
242#include <linux/ptrace.h>
243int kretprobe_handler(struct kretprobe_instance *ri, struct pt_regs *regs);
244
245regs is as described for kprobe.pre_handler. ri points to the
246kretprobe_instance object, of which the following fields may be
247of interest:
248- ret_addr: the return address
249- rp: points to the corresponding kretprobe object
250- task: points to the corresponding task struct
251The handler's return value is currently ignored.
252
2534.4 unregister_*probe
254
255#include <linux/kprobes.h>
256void unregister_kprobe(struct kprobe *kp);
257void unregister_jprobe(struct jprobe *jp);
258void unregister_kretprobe(struct kretprobe *rp);
259
260Removes the specified probe. The unregister function can be called
261at any time after the probe has been registered.
262
2635. Kprobes Features and Limitations
264
265As of Linux v2.6.12, Kprobes allows multiple probes at the same
266address. Currently, however, there cannot be multiple jprobes on
267the same function at the same time.
268
269In general, you can install a probe anywhere in the kernel.
270In particular, you can probe interrupt handlers. Known exceptions
271are discussed in this section.
272
273For obvious reasons, it's a bad idea to install a probe in
274the code that implements Kprobes (mostly kernel/kprobes.c and
275arch/*/kernel/kprobes.c). A patch in the v2.6.13 timeframe instructs
276Kprobes to reject such requests.
277
278If you install a probe in an inline-able function, Kprobes makes
279no attempt to chase down all inline instances of the function and
280install probes there. gcc may inline a function without being asked,
281so keep this in mind if you're not seeing the probe hits you expect.
282
283A probe handler can modify the environment of the probed function
284-- e.g., by modifying kernel data structures, or by modifying the
285contents of the pt_regs struct (which are restored to the registers
286upon return from the breakpoint). So Kprobes can be used, for example,
287to install a bug fix or to inject faults for testing. Kprobes, of
288course, has no way to distinguish the deliberately injected faults
289from the accidental ones. Don't drink and probe.
290
291Kprobes makes no attempt to prevent probe handlers from stepping on
292each other -- e.g., probing printk() and then calling printk() from a
293probe handler. As of Linux v2.6.12, if a probe handler hits a probe,
294that second probe's handlers won't be run in that instance.
295
296In Linux v2.6.12 and previous versions, Kprobes' data structures are
297protected by a single lock that is held during probe registration and
298unregistration and while handlers are run. Thus, no two handlers
299can run simultaneously. To improve scalability on SMP systems,
300this restriction will probably be removed soon, in which case
301multiple handlers (or multiple instances of the same handler) may
302run concurrently on different CPUs. Code your handlers accordingly.
303
304Kprobes does not use semaphores or allocate memory except during
305registration and unregistration.
306
307Probe handlers are run with preemption disabled. Depending on the
308architecture, handlers may also run with interrupts disabled. In any
309case, your handler should not yield the CPU (e.g., by attempting to
310acquire a semaphore).
311
312Since a return probe is implemented by replacing the return
313address with the trampoline's address, stack backtraces and calls
314to __builtin_return_address() will typically yield the trampoline's
315address instead of the real return address for kretprobed functions.
316(As far as we can tell, __builtin_return_address() is used only
317for instrumentation and error reporting.)
318
319If the number of times a function is called does not match the
320number of times it returns, registering a return probe on that
321function may produce undesirable results. We have the do_exit()
322and do_execve() cases covered. do_fork() is not an issue. We're
323unaware of other specific cases where this could be a problem.
324
3256. Probe Overhead
326
327On a typical CPU in use in 2005, a kprobe hit takes 0.5 to 1.0
328microseconds to process. Specifically, a benchmark that hits the same
329probepoint repeatedly, firing a simple handler each time, reports 1-2
330million hits per second, depending on the architecture. A jprobe or
331return-probe hit typically takes 50-75% longer than a kprobe hit.
332When you have a return probe set on a function, adding a kprobe at
333the entry to that function adds essentially no overhead.
334
335Here are sample overhead figures (in usec) for different architectures.
336k = kprobe; j = jprobe; r = return probe; kr = kprobe + return probe
337on same function; jr = jprobe + return probe on same function
338
339i386: Intel Pentium M, 1495 MHz, 2957.31 bogomips
340k = 0.57 usec; j = 1.00; r = 0.92; kr = 0.99; jr = 1.40
341
342x86_64: AMD Opteron 246, 1994 MHz, 3971.48 bogomips
343k = 0.49 usec; j = 0.76; r = 0.80; kr = 0.82; jr = 1.07
344
345ppc64: POWER5 (gr), 1656 MHz (SMT disabled, 1 virtual CPU per physical CPU)
346k = 0.77 usec; j = 1.31; r = 1.26; kr = 1.45; jr = 1.99
347
3487. TODO
349
350a. SystemTap (http://sourceware.org/systemtap): Work in progress
351to provide a simplified programming interface for probe-based
352instrumentation.
353b. Improved SMP scalability: Currently, work is in progress to handle
354multiple kprobes in parallel.
355c. Kernel return probes for sparc64.
356d. Support for other architectures.
357e. User-space probes.
358
3598. Kprobes Example
360
361Here's a sample kernel module showing the use of kprobes to dump a
362stack trace and selected i386 registers when do_fork() is called.
363----- cut here -----
364/*kprobe_example.c*/
365#include <linux/kernel.h>
366#include <linux/module.h>
367#include <linux/kprobes.h>
368#include <linux/kallsyms.h>
369#include <linux/sched.h>
370
371/*For each probe you need to allocate a kprobe structure*/
372static struct kprobe kp;
373
374/*kprobe pre_handler: called just before the probed instruction is executed*/
375int handler_pre(struct kprobe *p, struct pt_regs *regs)
376{
377 printk("pre_handler: p->addr=0x%p, eip=%lx, eflags=0x%lx\n",
378 p->addr, regs->eip, regs->eflags);
379 dump_stack();
380 return 0;
381}
382
383/*kprobe post_handler: called after the probed instruction is executed*/
384void handler_post(struct kprobe *p, struct pt_regs *regs, unsigned long flags)
385{
386 printk("post_handler: p->addr=0x%p, eflags=0x%lx\n",
387 p->addr, regs->eflags);
388}
389
390/* fault_handler: this is called if an exception is generated for any
391 * instruction within the pre- or post-handler, or when Kprobes
392 * single-steps the probed instruction.
393 */
394int handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr)
395{
396 printk("fault_handler: p->addr=0x%p, trap #%dn",
397 p->addr, trapnr);
398 /* Return 0 because we don't handle the fault. */
399 return 0;
400}
401
402int init_module(void)
403{
404 int ret;
405 kp.pre_handler = handler_pre;
406 kp.post_handler = handler_post;
407 kp.fault_handler = handler_fault;
408 kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name("do_fork");
409 /* register the kprobe now */
410 if (!kp.addr) {
411 printk("Couldn't find %s to plant kprobe\n", "do_fork");
412 return -1;
413 }
414 if ((ret = register_kprobe(&kp) < 0)) {
415 printk("register_kprobe failed, returned %d\n", ret);
416 return -1;
417 }
418 printk("kprobe registered\n");
419 return 0;
420}
421
422void cleanup_module(void)
423{
424 unregister_kprobe(&kp);
425 printk("kprobe unregistered\n");
426}
427
428MODULE_LICENSE("GPL");
429----- cut here -----
430
431You can build the kernel module, kprobe-example.ko, using the following
432Makefile:
433----- cut here -----
434obj-m := kprobe-example.o
435KDIR := /lib/modules/$(shell uname -r)/build
436PWD := $(shell pwd)
437default:
438 $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
439clean:
440 rm -f *.mod.c *.ko *.o
441----- cut here -----
442
443$ make
444$ su -
445...
446# insmod kprobe-example.ko
447
448You will see the trace data in /var/log/messages and on the console
449whenever do_fork() is invoked to create a new process.
450
4519. Jprobes Example
452
453Here's a sample kernel module showing the use of jprobes to dump
454the arguments of do_fork().
455----- cut here -----
456/*jprobe-example.c */
457#include <linux/kernel.h>
458#include <linux/module.h>
459#include <linux/fs.h>
460#include <linux/uio.h>
461#include <linux/kprobes.h>
462#include <linux/kallsyms.h>
463
464/*
465 * Jumper probe for do_fork.
466 * Mirror principle enables access to arguments of the probed routine
467 * from the probe handler.
468 */
469
470/* Proxy routine having the same arguments as actual do_fork() routine */
471long jdo_fork(unsigned long clone_flags, unsigned long stack_start,
472 struct pt_regs *regs, unsigned long stack_size,
473 int __user * parent_tidptr, int __user * child_tidptr)
474{
475 printk("jprobe: clone_flags=0x%lx, stack_size=0x%lx, regs=0x%p\n",
476 clone_flags, stack_size, regs);
477 /* Always end with a call to jprobe_return(). */
478 jprobe_return();
479 /*NOTREACHED*/
480 return 0;
481}
482
483static struct jprobe my_jprobe = {
484 .entry = (kprobe_opcode_t *) jdo_fork
485};
486
487int init_module(void)
488{
489 int ret;
490 my_jprobe.kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_fork");
491 if (!my_jprobe.kp.addr) {
492 printk("Couldn't find %s to plant jprobe\n", "do_fork");
493 return -1;
494 }
495
496 if ((ret = register_jprobe(&my_jprobe)) <0) {
497 printk("register_jprobe failed, returned %d\n", ret);
498 return -1;
499 }
500 printk("Planted jprobe at %p, handler addr %p\n",
501 my_jprobe.kp.addr, my_jprobe.entry);
502 return 0;
503}
504
505void cleanup_module(void)
506{
507 unregister_jprobe(&my_jprobe);
508 printk("jprobe unregistered\n");
509}
510
511MODULE_LICENSE("GPL");
512----- cut here -----
513
514Build and insert the kernel module as shown in the above kprobe
515example. You will see the trace data in /var/log/messages and on
516the console whenever do_fork() is invoked to create a new process.
517(Some messages may be suppressed if syslogd is configured to
518eliminate duplicate messages.)
519
52010. Kretprobes Example
521
522Here's a sample kernel module showing the use of return probes to
523report failed calls to sys_open().
524----- cut here -----
525/*kretprobe-example.c*/
526#include <linux/kernel.h>
527#include <linux/module.h>
528#include <linux/kprobes.h>
529#include <linux/kallsyms.h>
530
531static const char *probed_func = "sys_open";
532
533/* Return-probe handler: If the probed function fails, log the return value. */
534static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
535{
536 // Substitute the appropriate register name for your architecture --
537 // e.g., regs->rax for x86_64, regs->gpr[3] for ppc64.
538 int retval = (int) regs->eax;
539 if (retval < 0) {
540 printk("%s returns %d\n", probed_func, retval);
541 }
542 return 0;
543}
544
545static struct kretprobe my_kretprobe = {
546 .handler = ret_handler,
547 /* Probe up to 20 instances concurrently. */
548 .maxactive = 20
549};
550
551int init_module(void)
552{
553 int ret;
554 my_kretprobe.kp.addr =
555 (kprobe_opcode_t *) kallsyms_lookup_name(probed_func);
556 if (!my_kretprobe.kp.addr) {
557 printk("Couldn't find %s to plant return probe\n", probed_func);
558 return -1;
559 }
560 if ((ret = register_kretprobe(&my_kretprobe)) < 0) {
561 printk("register_kretprobe failed, returned %d\n", ret);
562 return -1;
563 }
564 printk("Planted return probe at %p\n", my_kretprobe.kp.addr);
565 return 0;
566}
567
568void cleanup_module(void)
569{
570 unregister_kretprobe(&my_kretprobe);
571 printk("kretprobe unregistered\n");
572 /* nmissed > 0 suggests that maxactive was set too low. */
573 printk("Missed probing %d instances of %s\n",
574 my_kretprobe.nmissed, probed_func);
575}
576
577MODULE_LICENSE("GPL");
578----- cut here -----
579
580Build and insert the kernel module as shown in the above kprobe
581example. You will see the trace data in /var/log/messages and on the
582console whenever sys_open() returns a negative value. (Some messages
583may be suppressed if syslogd is configured to eliminate duplicate
584messages.)
585
586For additional information on Kprobes, refer to the following URLs:
587http://www-106.ibm.com/developerworks/library/l-kprobes.html?ca=dgr-lnxw42Kprobe
588http://www.redhat.com/magazine/005mar05/features/kprobes/
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 0bc2ed136a38..24d029455baa 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -1,5 +1,7 @@
1 1
2 Linux Ethernet Bonding Driver HOWTO 2 Linux Ethernet Bonding Driver HOWTO
3
4 Latest update: 21 June 2005
3 5
4Initial release : Thomas Davis <tadavis at lbl.gov> 6Initial release : Thomas Davis <tadavis at lbl.gov>
5Corrections, HA extensions : 2000/10/03-15 : 7Corrections, HA extensions : 2000/10/03-15 :
@@ -11,15 +13,22 @@ Corrections, HA extensions : 2000/10/03-15 :
11 13
12Reorganized and updated Feb 2005 by Jay Vosburgh 14Reorganized and updated Feb 2005 by Jay Vosburgh
13 15
14Note : 16Introduction
15------ 17============
18
19 The Linux bonding driver provides a method for aggregating
20multiple network interfaces into a single logical "bonded" interface.
21The behavior of the bonded interfaces depends upon the mode; generally
22speaking, modes provide either hot standby or load balancing services.
23Additionally, link integrity monitoring may be performed.
16 24
17The bonding driver originally came from Donald Becker's beowulf patches for 25 The bonding driver originally came from Donald Becker's
18kernel 2.0. It has changed quite a bit since, and the original tools from 26beowulf patches for kernel 2.0. It has changed quite a bit since, and
19extreme-linux and beowulf sites will not work with this version of the driver. 27the original tools from extreme-linux and beowulf sites will not work
28with this version of the driver.
20 29
21For new versions of the driver, patches for older kernels and the updated 30 For new versions of the driver, updated userspace tools, and
22userspace tools, please follow the links at the end of this file. 31who to ask for help, please follow the links at the end of this file.
23 32
24Table of Contents 33Table of Contents
25================= 34=================
@@ -30,9 +39,13 @@ Table of Contents
30 39
313. Configuring Bonding Devices 403. Configuring Bonding Devices
323.1 Configuration with sysconfig support 413.1 Configuration with sysconfig support
423.1.1 Using DHCP with sysconfig
433.1.2 Configuring Multiple Bonds with sysconfig
333.2 Configuration with initscripts support 443.2 Configuration with initscripts support
453.2.1 Using DHCP with initscripts
463.2.2 Configuring Multiple Bonds with initscripts
343.3 Configuring Bonding Manually 473.3 Configuring Bonding Manually
353.4 Configuring Multiple Bonds 483.3.1 Configuring Multiple Bonds Manually
36 49
375. Querying Bonding Configuration 505. Querying Bonding Configuration
385.1 Bonding Configuration 515.1 Bonding Configuration
@@ -56,21 +69,30 @@ Table of Contents
56 69
5711. Promiscuous mode 7011. Promiscuous mode
58 71
5912. High Availability Information 7212. Configuring Bonding for High Availability
6012.1 High Availability in a Single Switch Topology 7312.1 High Availability in a Single Switch Topology
6112.1.1 Bonding Mode Selection for Single Switch Topology
6212.1.2 Link Monitoring for Single Switch Topology
6312.2 High Availability in a Multiple Switch Topology 7412.2 High Availability in a Multiple Switch Topology
6412.2.1 Bonding Mode Selection for Multiple Switch Topology 7512.2.1 HA Bonding Mode Selection for Multiple Switch Topology
6512.2.2 Link Monitoring for Multiple Switch Topology 7612.2.2 HA Link Monitoring for Multiple Switch Topology
6612.3 Switch Behavior Issues for High Availability 77
7813. Configuring Bonding for Maximum Throughput
7913.1 Maximum Throughput in a Single Switch Topology
8013.1.1 MT Bonding Mode Selection for Single Switch Topology
8113.1.2 MT Link Monitoring for Single Switch Topology
8213.2 Maximum Throughput in a Multiple Switch Topology
8313.2.1 MT Bonding Mode Selection for Multiple Switch Topology
8413.2.2 MT Link Monitoring for Multiple Switch Topology
67 85
6813. Hardware Specific Considerations 8614. Switch Behavior Issues
6913.1 IBM BladeCenter 8714.1 Link Establishment and Failover Delays
8814.2 Duplicated Incoming Packets
70 89
7114. Frequently Asked Questions 9015. Hardware Specific Considerations
9115.1 IBM BladeCenter
72 92
7315. Resources and Links 9316. Frequently Asked Questions
94
9517. Resources and Links
74 96
75 97
761. Bonding Driver Installation 981. Bonding Driver Installation
@@ -86,16 +108,10 @@ the following steps:
861.1 Configure and build the kernel with bonding 1081.1 Configure and build the kernel with bonding
87----------------------------------------------- 109-----------------------------------------------
88 110
89 The latest version of the bonding driver is available in the 111 The current version of the bonding driver is available in the
90drivers/net/bonding subdirectory of the most recent kernel source 112drivers/net/bonding subdirectory of the most recent kernel source
91(which is available on http://kernel.org). 113(which is available on http://kernel.org). Most users "rolling their
92 114own" will want to use the most recent kernel from kernel.org.
93 Prior to the 2.4.11 kernel, the bonding driver was maintained
94largely outside the kernel tree; patches for some earlier kernels are
95available on the bonding sourceforge site, although those patches are
96still several years out of date. Most users will want to use either
97the most recent kernel from kernel.org or whatever kernel came with
98their distro.
99 115
100 Configure kernel with "make menuconfig" (or "make xconfig" or 116 Configure kernel with "make menuconfig" (or "make xconfig" or
101"make config"), then select "Bonding driver support" in the "Network 117"make config"), then select "Bonding driver support" in the "Network
@@ -103,8 +119,8 @@ device support" section. It is recommended that you configure the
103driver as module since it is currently the only way to pass parameters 119driver as module since it is currently the only way to pass parameters
104to the driver or configure more than one bonding device. 120to the driver or configure more than one bonding device.
105 121
106 Build and install the new kernel and modules, then proceed to 122 Build and install the new kernel and modules, then continue
107step 2. 123below to install ifenslave.
108 124
1091.2 Install ifenslave Control Utility 1251.2 Install ifenslave Control Utility
110------------------------------------- 126-------------------------------------
@@ -147,9 +163,9 @@ default kernel source include directory.
147 Options for the bonding driver are supplied as parameters to 163 Options for the bonding driver are supplied as parameters to
148the bonding module at load time. They may be given as command line 164the bonding module at load time. They may be given as command line
149arguments to the insmod or modprobe command, but are usually specified 165arguments to the insmod or modprobe command, but are usually specified
150in either the /etc/modprobe.conf configuration file, or in a 166in either the /etc/modules.conf or /etc/modprobe.conf configuration
151distro-specific configuration file (some of which are detailed in the 167file, or in a distro-specific configuration file (some of which are
152next section). 168detailed in the next section).
153 169
154 The available bonding driver parameters are listed below. If a 170 The available bonding driver parameters are listed below. If a
155parameter is not specified the default value is used. When initially 171parameter is not specified the default value is used. When initially
@@ -162,34 +178,34 @@ degradation will occur during link failures. Very few devices do not
162support at least miimon, so there is really no reason not to use it. 178support at least miimon, so there is really no reason not to use it.
163 179
164 Options with textual values will accept either the text name 180 Options with textual values will accept either the text name
165 or, for backwards compatibility, the option value. E.g., 181or, for backwards compatibility, the option value. E.g.,
166 "mode=802.3ad" and "mode=4" set the same mode. 182"mode=802.3ad" and "mode=4" set the same mode.
167 183
168 The parameters are as follows: 184 The parameters are as follows:
169 185
170arp_interval 186arp_interval
171 187
172 Specifies the ARP monitoring frequency in milli-seconds. If 188 Specifies the ARP link monitoring frequency in milliseconds.
173 ARP monitoring is used in a load-balancing mode (mode 0 or 2), 189 If ARP monitoring is used in an etherchannel compatible mode
174 the switch should be configured in a mode that evenly 190 (modes 0 and 2), the switch should be configured in a mode
175 distributes packets across all links - such as round-robin. If 191 that evenly distributes packets across all links. If the
176 the switch is configured to distribute the packets in an XOR 192 switch is configured to distribute the packets in an XOR
177 fashion, all replies from the ARP targets will be received on 193 fashion, all replies from the ARP targets will be received on
178 the same link which could cause the other team members to 194 the same link which could cause the other team members to
179 fail. ARP monitoring should not be used in conjunction with 195 fail. ARP monitoring should not be used in conjunction with
180 miimon. A value of 0 disables ARP monitoring. The default 196 miimon. A value of 0 disables ARP monitoring. The default
181 value is 0. 197 value is 0.
182 198
183arp_ip_target 199arp_ip_target
184 200
185 Specifies the ip addresses to use when arp_interval is > 0. 201 Specifies the IP addresses to use as ARP monitoring peers when
186 These are the targets of the ARP request sent to determine the 202 arp_interval is > 0. These are the targets of the ARP request
187 health of the link to the targets. Specify these values in 203 sent to determine the health of the link to the targets.
188 ddd.ddd.ddd.ddd format. Multiple ip adresses must be 204 Specify these values in ddd.ddd.ddd.ddd format. Multiple IP
189 seperated by a comma. At least one IP address must be given 205 addresses must be separated by a comma. At least one IP
190 for ARP monitoring to function. The maximum number of targets 206 address must be given for ARP monitoring to function. The
191 that can be specified is 16. The default value is no IP 207 maximum number of targets that can be specified is 16. The
192 addresses. 208 default value is no IP addresses.
193 209
194downdelay 210downdelay
195 211
@@ -207,11 +223,13 @@ lacp_rate
207 are: 223 are:
208 224
209 slow or 0 225 slow or 0
210 Request partner to transmit LACPDUs every 30 seconds (default) 226 Request partner to transmit LACPDUs every 30 seconds
211 227
212 fast or 1 228 fast or 1
213 Request partner to transmit LACPDUs every 1 second 229 Request partner to transmit LACPDUs every 1 second
214 230
231 The default is slow.
232
215max_bonds 233max_bonds
216 234
217 Specifies the number of bonding devices to create for this 235 Specifies the number of bonding devices to create for this
@@ -221,10 +239,11 @@ max_bonds
221 239
222miimon 240miimon
223 241
224 Specifies the frequency in milli-seconds that MII link 242 Specifies the MII link monitoring frequency in milliseconds.
225 monitoring will occur. A value of zero disables MII link 243 This determines how often the link state of each slave is
226 monitoring. A value of 100 is a good starting point. The 244 inspected for link failures. A value of zero disables MII
227 use_carrier option, below, affects how the link state is 245 link monitoring. A value of 100 is a good starting point.
246 The use_carrier option, below, affects how the link state is
228 determined. See the High Availability section for additional 247 determined. See the High Availability section for additional
229 information. The default value is 0. 248 information. The default value is 0.
230 249
@@ -246,17 +265,31 @@ mode
246 active. A different slave becomes active if, and only 265 active. A different slave becomes active if, and only
247 if, the active slave fails. The bond's MAC address is 266 if, the active slave fails. The bond's MAC address is
248 externally visible on only one port (network adapter) 267 externally visible on only one port (network adapter)
249 to avoid confusing the switch. This mode provides 268 to avoid confusing the switch.
250 fault tolerance. The primary option affects the 269
251 behavior of this mode. 270 In bonding version 2.6.2 or later, when a failover
271 occurs in active-backup mode, bonding will issue one
272 or more gratuitous ARPs on the newly active slave.
273 One gratutious ARP is issued for the bonding master
274 interface and each VLAN interfaces configured above
275 it, provided that the interface has at least one IP
276 address configured. Gratuitous ARPs issued for VLAN
277 interfaces are tagged with the appropriate VLAN id.
278
279 This mode provides fault tolerance. The primary
280 option, documented below, affects the behavior of this
281 mode.
252 282
253 balance-xor or 2 283 balance-xor or 2
254 284
255 XOR policy: Transmit based on [(source MAC address 285 XOR policy: Transmit based on the selected transmit
256 XOR'd with destination MAC address) modulo slave 286 hash policy. The default policy is a simple [(source
257 count]. This selects the same slave for each 287 MAC address XOR'd with destination MAC address) modulo
258 destination MAC address. This mode provides load 288 slave count]. Alternate transmit policies may be
259 balancing and fault tolerance. 289 selected via the xmit_hash_policy option, described
290 below.
291
292 This mode provides load balancing and fault tolerance.
260 293
261 broadcast or 3 294 broadcast or 3
262 295
@@ -270,7 +303,17 @@ mode
270 duplex settings. Utilizes all slaves in the active 303 duplex settings. Utilizes all slaves in the active
271 aggregator according to the 802.3ad specification. 304 aggregator according to the 802.3ad specification.
272 305
273 Pre-requisites: 306 Slave selection for outgoing traffic is done according
307 to the transmit hash policy, which may be changed from
308 the default simple XOR policy via the xmit_hash_policy
309 option, documented below. Note that not all transmit
310 policies may be 802.3ad compliant, particularly in
311 regards to the packet mis-ordering requirements of
312 section 43.2.4 of the 802.3ad standard. Differing
313 peer implementations will have varying tolerances for
314 noncompliance.
315
316 Prerequisites:
274 317
275 1. Ethtool support in the base drivers for retrieving 318 1. Ethtool support in the base drivers for retrieving
276 the speed and duplex of each slave. 319 the speed and duplex of each slave.
@@ -333,7 +376,7 @@ mode
333 376
334 When a link is reconnected or a new slave joins the 377 When a link is reconnected or a new slave joins the
335 bond the receive traffic is redistributed among all 378 bond the receive traffic is redistributed among all
336 active slaves in the bond by intiating ARP Replies 379 active slaves in the bond by initiating ARP Replies
337 with the selected mac address to each of the 380 with the selected mac address to each of the
338 clients. The updelay parameter (detailed below) must 381 clients. The updelay parameter (detailed below) must
339 be set to a value equal or greater than the switch's 382 be set to a value equal or greater than the switch's
@@ -396,6 +439,60 @@ use_carrier
396 0 will use the deprecated MII / ETHTOOL ioctls. The default 439 0 will use the deprecated MII / ETHTOOL ioctls. The default
397 value is 1. 440 value is 1.
398 441
442xmit_hash_policy
443
444 Selects the transmit hash policy to use for slave selection in
445 balance-xor and 802.3ad modes. Possible values are:
446
447 layer2
448
449 Uses XOR of hardware MAC addresses to generate the
450 hash. The formula is
451
452 (source MAC XOR destination MAC) modulo slave count
453
454 This algorithm will place all traffic to a particular
455 network peer on the same slave.
456
457 This algorithm is 802.3ad compliant.
458
459 layer3+4
460
461 This policy uses upper layer protocol information,
462 when available, to generate the hash. This allows for
463 traffic to a particular network peer to span multiple
464 slaves, although a single connection will not span
465 multiple slaves.
466
467 The formula for unfragmented TCP and UDP packets is
468
469 ((source port XOR dest port) XOR
470 ((source IP XOR dest IP) AND 0xffff)
471 modulo slave count
472
473 For fragmented TCP or UDP packets and all other IP
474 protocol traffic, the source and destination port
475 information is omitted. For non-IP traffic, the
476 formula is the same as for the layer2 transmit hash
477 policy.
478
479 This policy is intended to mimic the behavior of
480 certain switches, notably Cisco switches with PFC2 as
481 well as some Foundry and IBM products.
482
483 This algorithm is not fully 802.3ad compliant. A
484 single TCP or UDP conversation containing both
485 fragmented and unfragmented packets will see packets
486 striped across two interfaces. This may result in out
487 of order delivery. Most traffic types will not meet
488 this criteria, as TCP rarely fragments traffic, and
489 most UDP traffic is not involved in extended
490 conversations. Other implementations of 802.3ad may
491 or may not tolerate this noncompliance.
492
493 The default value is layer2. This option was added in bonding
494version 2.6.3. In earlier versions of bonding, this parameter does
495not exist, and the layer2 policy is the only policy.
399 496
400 497
4013. Configuring Bonding Devices 4983. Configuring Bonding Devices
@@ -448,8 +545,9 @@ Bonding devices can be managed by hand, however, as follows.
448slave devices. On SLES 9, this is most easily done by running the 545slave devices. On SLES 9, this is most easily done by running the
449yast2 sysconfig configuration utility. The goal is for to create an 546yast2 sysconfig configuration utility. The goal is for to create an
450ifcfg-id file for each slave device. The simplest way to accomplish 547ifcfg-id file for each slave device. The simplest way to accomplish
451this is to configure the devices for DHCP. The name of the 548this is to configure the devices for DHCP (this is only to get the
452configuration file for each device will be of the form: 549file ifcfg-id file created; see below for some issues with DHCP). The
550name of the configuration file for each device will be of the form:
453 551
454ifcfg-id-xx:xx:xx:xx:xx:xx 552ifcfg-id-xx:xx:xx:xx:xx:xx
455 553
@@ -459,7 +557,7 @@ the device's permanent MAC address.
459 Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been 557 Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
460created, it is necessary to edit the configuration files for the slave 558created, it is necessary to edit the configuration files for the slave
461devices (the MAC addresses correspond to those of the slave devices). 559devices (the MAC addresses correspond to those of the slave devices).
462Before editing, the file will contain muliple lines, and will look 560Before editing, the file will contain multiple lines, and will look
463something like this: 561something like this:
464 562
465BOOTPROTO='dhcp' 563BOOTPROTO='dhcp'
@@ -496,16 +594,11 @@ STARTMODE="onboot"
496BONDING_MASTER="yes" 594BONDING_MASTER="yes"
497BONDING_MODULE_OPTS="mode=active-backup miimon=100" 595BONDING_MODULE_OPTS="mode=active-backup miimon=100"
498BONDING_SLAVE0="eth0" 596BONDING_SLAVE0="eth0"
499BONDING_SLAVE1="eth1" 597BONDING_SLAVE1="bus-pci-0000:06:08.1"
500 598
501 Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK 599 Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
502values with the appropriate values for your network. 600values with the appropriate values for your network.
503 601
504 Note that configuring the bonding device with BOOTPROTO='dhcp'
505does not work; the scripts attempt to obtain the device address from
506DHCP prior to adding any of the slave devices. Without active slaves,
507the DHCP requests are not sent to the network.
508
509 The STARTMODE specifies when the device is brought online. 602 The STARTMODE specifies when the device is brought online.
510The possible values are: 603The possible values are:
511 604
@@ -531,9 +624,17 @@ for the bonding mode, link monitoring, and so on here. Do not include
531the max_bonds bonding parameter; this will confuse the configuration 624the max_bonds bonding parameter; this will confuse the configuration
532system if you have multiple bonding devices. 625system if you have multiple bonding devices.
533 626
534 Finally, supply one BONDING_SLAVEn="ethX" for each slave, 627 Finally, supply one BONDING_SLAVEn="slave device" for each
535where "n" is an increasing value, one for each slave, and "ethX" is 628slave. where "n" is an increasing value, one for each slave. The
536the name of the slave device (eth0, eth1, etc). 629"slave device" is either an interface name, e.g., "eth0", or a device
630specifier for the network device. The interface name is easier to
631find, but the ethN names are subject to change at boot time if, e.g.,
632a device early in the sequence has failed. The device specifiers
633(bus-pci-0000:06:08.1 in the example above) specify the physical
634network device, and will not change unless the device's bus location
635changes (for example, it is moved from one PCI slot to another). The
636example above uses one of each type for demonstration purposes; most
637configurations will choose one or the other for all slave devices.
537 638
538 When all configuration files have been modified or created, 639 When all configuration files have been modified or created,
539networking must be restarted for the configuration changes to take 640networking must be restarted for the configuration changes to take
@@ -544,7 +645,7 @@ effect. This can be accomplished via the following:
544 Note that the network control script (/sbin/ifdown) will 645 Note that the network control script (/sbin/ifdown) will
545remove the bonding module as part of the network shutdown processing, 646remove the bonding module as part of the network shutdown processing,
546so it is not necessary to remove the module by hand if, e.g., the 647so it is not necessary to remove the module by hand if, e.g., the
547module paramters have changed. 648module parameters have changed.
548 649
549 Also, at this writing, YaST/YaST2 will not manage bonding 650 Also, at this writing, YaST/YaST2 will not manage bonding
550devices (they do not show bonding interfaces on its list of network 651devices (they do not show bonding interfaces on its list of network
@@ -559,12 +660,37 @@ format can be found in an example ifcfg template file:
559 Note that the template does not document the various BONDING_ 660 Note that the template does not document the various BONDING_
560settings described above, but does describe many of the other options. 661settings described above, but does describe many of the other options.
561 662
6633.1.1 Using DHCP with sysconfig
664-------------------------------
665
666 Under sysconfig, configuring a device with BOOTPROTO='dhcp'
667will cause it to query DHCP for its IP address information. At this
668writing, this does not function for bonding devices; the scripts
669attempt to obtain the device address from DHCP prior to adding any of
670the slave devices. Without active slaves, the DHCP requests are not
671sent to the network.
672
6733.1.2 Configuring Multiple Bonds with sysconfig
674-----------------------------------------------
675
676 The sysconfig network initialization system is capable of
677handling multiple bonding devices. All that is necessary is for each
678bonding instance to have an appropriately configured ifcfg-bondX file
679(as described above). Do not specify the "max_bonds" parameter to any
680instance of bonding, as this will confuse sysconfig. If you require
681multiple bonding devices with identical parameters, create multiple
682ifcfg-bondX files.
683
684 Because the sysconfig scripts supply the bonding module
685options in the ifcfg-bondX file, it is not necessary to add them to
686the system /etc/modules.conf or /etc/modprobe.conf configuration file.
687
5623.2 Configuration with initscripts support 6883.2 Configuration with initscripts support
563------------------------------------------ 689------------------------------------------
564 690
565 This section applies to distros using a version of initscripts 691 This section applies to distros using a version of initscripts
566with bonding support, for example, Red Hat Linux 9 or Red Hat 692with bonding support, for example, Red Hat Linux 9 or Red Hat
567Enterprise Linux version 3. On these systems, the network 693Enterprise Linux version 3 or 4. On these systems, the network
568initialization scripts have some knowledge of bonding, and can be 694initialization scripts have some knowledge of bonding, and can be
569configured to control bonding devices. 695configured to control bonding devices.
570 696
@@ -614,10 +740,11 @@ USERCTL=no
614 Be sure to change the networking specific lines (IPADDR, 740 Be sure to change the networking specific lines (IPADDR,
615NETMASK, NETWORK and BROADCAST) to match your network configuration. 741NETMASK, NETWORK and BROADCAST) to match your network configuration.
616 742
617 Finally, it is necessary to edit /etc/modules.conf to load the 743 Finally, it is necessary to edit /etc/modules.conf (or
618bonding module when the bond0 interface is brought up. The following 744/etc/modprobe.conf, depending upon your distro) to load the bonding
619sample lines in /etc/modules.conf will load the bonding module, and 745module with your desired options when the bond0 interface is brought
620select its options: 746up. The following lines in /etc/modules.conf (or modprobe.conf) will
747load the bonding module, and select its options:
621 748
622alias bond0 bonding 749alias bond0 bonding
623options bond0 mode=balance-alb miimon=100 750options bond0 mode=balance-alb miimon=100
@@ -629,6 +756,33 @@ options for your configuration.
629will restart the networking subsystem and your bond link should be now 756will restart the networking subsystem and your bond link should be now
630up and running. 757up and running.
631 758
7593.2.1 Using DHCP with initscripts
760---------------------------------
761
762 Recent versions of initscripts (the version supplied with
763Fedora Core 3 and Red Hat Enterprise Linux 4 is reported to work) do
764have support for assigning IP information to bonding devices via DHCP.
765
766 To configure bonding for DHCP, configure it as described
767above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp"
768and add a line consisting of "TYPE=Bonding". Note that the TYPE value
769is case sensitive.
770
7713.2.2 Configuring Multiple Bonds with initscripts
772-------------------------------------------------
773
774 At this writing, the initscripts package does not directly
775support loading the bonding driver multiple times, so the process for
776doing so is the same as described in the "Configuring Multiple Bonds
777Manually" section, below.
778
779 NOTE: It has been observed that some Red Hat supplied kernels
780are apparently unable to rename modules at load time (the "-obonding1"
781part). Attempts to pass that option to modprobe will produce an
782"Operation not permitted" error. This has been reported on some
783Fedora Core kernels, and has been seen on RHEL 4 as well. On kernels
784exhibiting this problem, it will be impossible to configure multiple
785bonds with differing parameters.
632 786
6333.3 Configuring Bonding Manually 7873.3 Configuring Bonding Manually
634-------------------------------- 788--------------------------------
@@ -638,10 +792,11 @@ scripts (the sysconfig or initscripts package) do not have specific
638knowledge of bonding. One such distro is SuSE Linux Enterprise Server 792knowledge of bonding. One such distro is SuSE Linux Enterprise Server
639version 8. 793version 8.
640 794
641 The general methodology for these systems is to place the 795 The general method for these systems is to place the bonding
642bonding module parameters into /etc/modprobe.conf, then add modprobe 796module parameters into /etc/modules.conf or /etc/modprobe.conf (as
643and/or ifenslave commands to the system's global init script. The 797appropriate for the installed distro), then add modprobe and/or
644name of the global init script differs; for sysconfig, it is 798ifenslave commands to the system's global init script. The name of
799the global init script differs; for sysconfig, it is
645/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local. 800/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
646 801
647 For example, if you wanted to make a simple bond of two e100 802 For example, if you wanted to make a simple bond of two e100
@@ -649,7 +804,7 @@ devices (presumed to be eth0 and eth1), and have it persist across
649reboots, edit the appropriate file (/etc/init.d/boot.local or 804reboots, edit the appropriate file (/etc/init.d/boot.local or
650/etc/rc.d/rc.local), and add the following: 805/etc/rc.d/rc.local), and add the following:
651 806
652modprobe bonding -obond0 mode=balance-alb miimon=100 807modprobe bonding mode=balance-alb miimon=100
653modprobe e100 808modprobe e100
654ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up 809ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
655ifenslave bond0 eth0 810ifenslave bond0 eth0
@@ -657,11 +812,7 @@ ifenslave bond0 eth1
657 812
658 Replace the example bonding module parameters and bond0 813 Replace the example bonding module parameters and bond0
659network configuration (IP address, netmask, etc) with the appropriate 814network configuration (IP address, netmask, etc) with the appropriate
660values for your configuration. The above example loads the bonding 815values for your configuration.
661module with the name "bond0," this simplifies the naming if multiple
662bonding modules are loaded (each successive instance of the module is
663given a different name, and the module instance names match the
664bonding interface names).
665 816
666 Unfortunately, this method will not provide support for the 817 Unfortunately, this method will not provide support for the
667ifup and ifdown scripts on the bond devices. To reload the bonding 818ifup and ifdown scripts on the bond devices. To reload the bonding
@@ -684,20 +835,23 @@ appropriate device driver modules. For our example above, you can do
684the following: 835the following:
685 836
686# ifconfig bond0 down 837# ifconfig bond0 down
687# rmmod bond0 838# rmmod bonding
688# rmmod e100 839# rmmod e100
689 840
690 Again, for convenience, it may be desirable to create a script 841 Again, for convenience, it may be desirable to create a script
691with these commands. 842with these commands.
692 843
693 844
6943.4 Configuring Multiple Bonds 8453.3.1 Configuring Multiple Bonds Manually
695------------------------------ 846-----------------------------------------
696 847
697 This section contains information on configuring multiple 848 This section contains information on configuring multiple
698bonding devices with differing options. If you require multiple 849bonding devices with differing options for those systems whose network
699bonding devices, but all with the same options, see the "max_bonds" 850initialization scripts lack support for configuring multiple bonds.
700module paramter, documented above. 851
852 If you require multiple bonding devices, but all with the same
853options, you may wish to use the "max_bonds" module parameter,
854documented above.
701 855
702 To create multiple bonding devices with differing options, it 856 To create multiple bonding devices with differing options, it
703is necessary to load the bonding driver multiple times. Note that 857is necessary to load the bonding driver multiple times. Note that
@@ -724,11 +878,16 @@ named "bond0" and creates the bond0 device in balance-rr mode with an
724miimon of 100. The second instance is named "bond1" and creates the 878miimon of 100. The second instance is named "bond1" and creates the
725bond1 device in balance-alb mode with an miimon of 50. 879bond1 device in balance-alb mode with an miimon of 50.
726 880
881 In some circumstances (typically with older distributions),
882the above does not work, and the second bonding instance never sees
883its options. In that case, the second options line can be substituted
884as follows:
885
886install bonding1 /sbin/modprobe bonding -obond1 mode=balance-alb miimon=50
887
727 This may be repeated any number of times, specifying a new and 888 This may be repeated any number of times, specifying a new and
728unique name in place of bond0 or bond1 for each instance. 889unique name in place of bond1 for each subsequent instance.
729 890
730 When the appropriate module paramters are in place, then
731configure bonding according to the instructions for your distro.
732 891
7335. Querying Bonding Configuration 8925. Querying Bonding Configuration
734================================= 893=================================
@@ -846,8 +1005,8 @@ tagged internally by bonding itself. As a result, bonding must
846self generated packets. 1005self generated packets.
847 1006
848 For reasons of simplicity, and to support the use of adapters 1007 For reasons of simplicity, and to support the use of adapters
849that can do VLAN hardware acceleration offloding, the bonding 1008that can do VLAN hardware acceleration offloading, the bonding
850interface declares itself as fully hardware offloaing capable, it gets 1009interface declares itself as fully hardware offloading capable, it gets
851the add_vid/kill_vid notifications to gather the necessary 1010the add_vid/kill_vid notifications to gather the necessary
852information, and it propagates those actions to the slaves. In case 1011information, and it propagates those actions to the slaves. In case
853of mixed adapter types, hardware accelerated tagged packets that 1012of mixed adapter types, hardware accelerated tagged packets that
@@ -880,7 +1039,7 @@ bond interface:
880matches the hardware address of the VLAN interfaces. 1039matches the hardware address of the VLAN interfaces.
881 1040
882 Note that changing a VLAN interface's HW address would set the 1041 Note that changing a VLAN interface's HW address would set the
883underlying device -- i.e. the bonding interface -- to promiscouos 1042underlying device -- i.e. the bonding interface -- to promiscuous
884mode, which might not be what you want. 1043mode, which might not be what you want.
885 1044
886 1045
@@ -923,7 +1082,7 @@ down or have a problem making it unresponsive to ARP requests. Having
923an additional target (or several) increases the reliability of the ARP 1082an additional target (or several) increases the reliability of the ARP
924monitoring. 1083monitoring.
925 1084
926 Multiple ARP targets must be seperated by commas as follows: 1085 Multiple ARP targets must be separated by commas as follows:
927 1086
928# example options for ARP monitoring with three targets 1087# example options for ARP monitoring with three targets
929alias bond0 bonding 1088alias bond0 bonding
@@ -1045,7 +1204,7 @@ install bonding /sbin/modprobe tg3; /sbin/modprobe e1000;
1045 This will, when loading the bonding module, rather than 1204 This will, when loading the bonding module, rather than
1046performing the normal action, instead execute the provided command. 1205performing the normal action, instead execute the provided command.
1047This command loads the device drivers in the order needed, then calls 1206This command loads the device drivers in the order needed, then calls
1048modprobe with --ingore-install to cause the normal action to then take 1207modprobe with --ignore-install to cause the normal action to then take
1049place. Full documentation on this can be found in the modprobe.conf 1208place. Full documentation on this can be found in the modprobe.conf
1050and modprobe manual pages. 1209and modprobe manual pages.
1051 1210
@@ -1130,14 +1289,14 @@ association.
1130common to enable promiscuous mode on the device, so that all traffic 1289common to enable promiscuous mode on the device, so that all traffic
1131is seen (instead of seeing only traffic destined for the local host). 1290is seen (instead of seeing only traffic destined for the local host).
1132The bonding driver handles promiscuous mode changes to the bonding 1291The bonding driver handles promiscuous mode changes to the bonding
1133master device (e.g., bond0), and propogates the setting to the slave 1292master device (e.g., bond0), and propagates the setting to the slave
1134devices. 1293devices.
1135 1294
1136 For the balance-rr, balance-xor, broadcast, and 802.3ad modes, 1295 For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
1137the promiscuous mode setting is propogated to all slaves. 1296the promiscuous mode setting is propagated to all slaves.
1138 1297
1139 For the active-backup, balance-tlb and balance-alb modes, the 1298 For the active-backup, balance-tlb and balance-alb modes, the
1140promiscuous mode setting is propogated only to the active slave. 1299promiscuous mode setting is propagated only to the active slave.
1141 1300
1142 For balance-tlb mode, the active slave is the slave currently 1301 For balance-tlb mode, the active slave is the slave currently
1143receiving inbound traffic. 1302receiving inbound traffic.
@@ -1148,46 +1307,182 @@ sending to peers that are unassigned or if the load is unbalanced.
1148 1307
1149 For the active-backup, balance-tlb and balance-alb modes, when 1308 For the active-backup, balance-tlb and balance-alb modes, when
1150the active slave changes (e.g., due to a link failure), the 1309the active slave changes (e.g., due to a link failure), the
1151promiscuous setting will be propogated to the new active slave. 1310promiscuous setting will be propagated to the new active slave.
1152 1311
115312. High Availability Information 131212. Configuring Bonding for High Availability
1154================================= 1313=============================================
1155 1314
1156 High Availability refers to configurations that provide 1315 High Availability refers to configurations that provide
1157maximum network availability by having redundant or backup devices, 1316maximum network availability by having redundant or backup devices,
1158links and switches between the host and the rest of the world. 1317links or switches between the host and the rest of the world. The
1159 1318goal is to provide the maximum availability of network connectivity
1160 There are currently two basic methods for configuring to 1319(i.e., the network always works), even though other configurations
1161maximize availability. They are dependent on the network topology and 1320could provide higher throughput.
1162the primary goal of the configuration, but in general, a configuration
1163can be optimized for maximum available bandwidth, or for maximum
1164network availability.
1165 1321
116612.1 High Availability in a Single Switch Topology 132212.1 High Availability in a Single Switch Topology
1167-------------------------------------------------- 1323--------------------------------------------------
1168 1324
1169 If two hosts (or a host and a switch) are directly connected 1325 If two hosts (or a host and a single switch) are directly
1170via multiple physical links, then there is no network availability 1326connected via multiple physical links, then there is no availability
1171penalty for optimizing for maximum bandwidth: there is only one switch 1327penalty to optimizing for maximum bandwidth. In this case, there is
1172(or peer), so if it fails, you have no alternative access to fail over 1328only one switch (or peer), so if it fails, there is no alternative
1173to. 1329access to fail over to. Additionally, the bonding load balance modes
1330support link monitoring of their members, so if individual links fail,
1331the load will be rebalanced across the remaining devices.
1332
1333 See Section 13, "Configuring Bonding for Maximum Throughput"
1334for information on configuring bonding with one peer device.
1335
133612.2 High Availability in a Multiple Switch Topology
1337----------------------------------------------------
1338
1339 With multiple switches, the configuration of bonding and the
1340network changes dramatically. In multiple switch topologies, there is
1341a trade off between network availability and usable bandwidth.
1342
1343 Below is a sample network, configured to maximize the
1344availability of the network:
1174 1345
1175Example 1 : host to switch (or other host) 1346 | |
1347 |port3 port3|
1348 +-----+----+ +-----+----+
1349 | |port2 ISL port2| |
1350 | switch A +--------------------------+ switch B |
1351 | | | |
1352 +-----+----+ +-----++---+
1353 |port1 port1|
1354 | +-------+ |
1355 +-------------+ host1 +---------------+
1356 eth0 +-------+ eth1
1176 1357
1177 +----------+ +----------+ 1358 In this configuration, there is a link between the two
1178 | |eth0 eth0| switch | 1359switches (ISL, or inter switch link), and multiple ports connecting to
1179 | Host A +--------------------------+ or | 1360the outside world ("port3" on each switch). There is no technical
1180 | +--------------------------+ other | 1361reason that this could not be extended to a third switch.
1181 | |eth1 eth1| host |
1182 +----------+ +----------+
1183 1362
136312.2.1 HA Bonding Mode Selection for Multiple Switch Topology
1364-------------------------------------------------------------
1184 1365
118512.1.1 Bonding Mode Selection for single switch topology 1366 In a topology such as the example above, the active-backup and
1186-------------------------------------------------------- 1367broadcast modes are the only useful bonding modes when optimizing for
1368availability; the other modes require all links to terminate on the
1369same peer for them to behave rationally.
1370
1371active-backup: This is generally the preferred mode, particularly if
1372 the switches have an ISL and play together well. If the
1373 network configuration is such that one switch is specifically
1374 a backup switch (e.g., has lower capacity, higher cost, etc),
1375 then the primary option can be used to insure that the
1376 preferred link is always used when it is available.
1377
1378broadcast: This mode is really a special purpose mode, and is suitable
1379 only for very specific needs. For example, if the two
1380 switches are not connected (no ISL), and the networks beyond
1381 them are totally independent. In this case, if it is
1382 necessary for some specific one-way traffic to reach both
1383 independent networks, then the broadcast mode may be suitable.
1384
138512.2.2 HA Link Monitoring Selection for Multiple Switch Topology
1386----------------------------------------------------------------
1387
1388 The choice of link monitoring ultimately depends upon your
1389switch. If the switch can reliably fail ports in response to other
1390failures, then either the MII or ARP monitors should work. For
1391example, in the above example, if the "port3" link fails at the remote
1392end, the MII monitor has no direct means to detect this. The ARP
1393monitor could be configured with a target at the remote end of port3,
1394thus detecting that failure without switch support.
1395
1396 In general, however, in a multiple switch topology, the ARP
1397monitor can provide a higher level of reliability in detecting end to
1398end connectivity failures (which may be caused by the failure of any
1399individual component to pass traffic for any reason). Additionally,
1400the ARP monitor should be configured with multiple targets (at least
1401one for each switch in the network). This will insure that,
1402regardless of which switch is active, the ARP monitor has a suitable
1403target to query.
1404
1405
140613. Configuring Bonding for Maximum Throughput
1407==============================================
1408
140913.1 Maximizing Throughput in a Single Switch Topology
1410------------------------------------------------------
1411
1412 In a single switch configuration, the best method to maximize
1413throughput depends upon the application and network environment. The
1414various load balancing modes each have strengths and weaknesses in
1415different environments, as detailed below.
1416
1417 For this discussion, we will break down the topologies into
1418two categories. Depending upon the destination of most traffic, we
1419categorize them into either "gatewayed" or "local" configurations.
1420
1421 In a gatewayed configuration, the "switch" is acting primarily
1422as a router, and the majority of traffic passes through this router to
1423other networks. An example would be the following:
1424
1425
1426 +----------+ +----------+
1427 | |eth0 port1| | to other networks
1428 | Host A +---------------------+ router +------------------->
1429 | +---------------------+ | Hosts B and C are out
1430 | |eth1 port2| | here somewhere
1431 +----------+ +----------+
1432
1433 The router may be a dedicated router device, or another host
1434acting as a gateway. For our discussion, the important point is that
1435the majority of traffic from Host A will pass through the router to
1436some other network before reaching its final destination.
1437
1438 In a gatewayed network configuration, although Host A may
1439communicate with many other systems, all of its traffic will be sent
1440and received via one other peer on the local network, the router.
1441
1442 Note that the case of two systems connected directly via
1443multiple physical links is, for purposes of configuring bonding, the
1444same as a gatewayed configuration. In that case, it happens that all
1445traffic is destined for the "gateway" itself, not some other network
1446beyond the gateway.
1447
1448 In a local configuration, the "switch" is acting primarily as
1449a switch, and the majority of traffic passes through this switch to
1450reach other stations on the same network. An example would be the
1451following:
1452
1453 +----------+ +----------+ +--------+
1454 | |eth0 port1| +-------+ Host B |
1455 | Host A +------------+ switch |port3 +--------+
1456 | +------------+ | +--------+
1457 | |eth1 port2| +------------------+ Host C |
1458 +----------+ +----------+port4 +--------+
1459
1460
1461 Again, the switch may be a dedicated switch device, or another
1462host acting as a gateway. For our discussion, the important point is
1463that the majority of traffic from Host A is destined for other hosts
1464on the same local network (Hosts B and C in the above example).
1465
1466 In summary, in a gatewayed configuration, traffic to and from
1467the bonded device will be to the same MAC level peer on the network
1468(the gateway itself, i.e., the router), regardless of its final
1469destination. In a local configuration, traffic flows directly to and
1470from the final destinations, thus, each destination (Host B, Host C)
1471will be addressed directly by their individual MAC addresses.
1472
1473 This distinction between a gatewayed and a local network
1474configuration is important because many of the load balancing modes
1475available use the MAC addresses of the local network source and
1476destination to make load balancing decisions. The behavior of each
1477mode is described below.
1478
1479
148013.1.1 MT Bonding Mode Selection for Single Switch Topology
1481-----------------------------------------------------------
1187 1482
1188 This configuration is the easiest to set up and to understand, 1483 This configuration is the easiest to set up and to understand,
1189although you will have to decide which bonding mode best suits your 1484although you will have to decide which bonding mode best suits your
1190needs. The tradeoffs for each mode are detailed below: 1485needs. The trade offs for each mode are detailed below:
1191 1486
1192balance-rr: This mode is the only mode that will permit a single 1487balance-rr: This mode is the only mode that will permit a single
1193 TCP/IP connection to stripe traffic across multiple 1488 TCP/IP connection to stripe traffic across multiple
@@ -1206,6 +1501,23 @@ balance-rr: This mode is the only mode that will permit a single
1206 interface's worth of throughput, even after adjusting 1501 interface's worth of throughput, even after adjusting
1207 tcp_reordering. 1502 tcp_reordering.
1208 1503
1504 Note that this out of order delivery occurs when both the
1505 sending and receiving systems are utilizing a multiple
1506 interface bond. Consider a configuration in which a
1507 balance-rr bond feeds into a single higher capacity network
1508 channel (e.g., multiple 100Mb/sec ethernets feeding a single
1509 gigabit ethernet via an etherchannel capable switch). In this
1510 configuration, traffic sent from the multiple 100Mb devices to
1511 a destination connected to the gigabit device will not see
1512 packets out of order. However, traffic sent from the gigabit
1513 device to the multiple 100Mb devices may or may not see
1514 traffic out of order, depending upon the balance policy of the
1515 switch. Many switches do not support any modes that stripe
1516 traffic (instead choosing a port based upon IP or MAC level
1517 addresses); for those devices, traffic flowing from the
1518 gigabit device to the many 100Mb devices will only utilize one
1519 interface.
1520
1209 If you are utilizing protocols other than TCP/IP, UDP for 1521 If you are utilizing protocols other than TCP/IP, UDP for
1210 example, and your application can tolerate out of order 1522 example, and your application can tolerate out of order
1211 delivery, then this mode can allow for single stream datagram 1523 delivery, then this mode can allow for single stream datagram
@@ -1220,16 +1532,21 @@ active-backup: There is not much advantage in this network topology to
1220 connected to the same peer as the primary. In this case, a 1532 connected to the same peer as the primary. In this case, a
1221 load balancing mode (with link monitoring) will provide the 1533 load balancing mode (with link monitoring) will provide the
1222 same level of network availability, but with increased 1534 same level of network availability, but with increased
1223 available bandwidth. On the plus side, it does not require 1535 available bandwidth. On the plus side, active-backup mode
1224 any configuration of the switch. 1536 does not require any configuration of the switch, so it may
1537 have value if the hardware available does not support any of
1538 the load balance modes.
1225 1539
1226balance-xor: This mode will limit traffic such that packets destined 1540balance-xor: This mode will limit traffic such that packets destined
1227 for specific peers will always be sent over the same 1541 for specific peers will always be sent over the same
1228 interface. Since the destination is determined by the MAC 1542 interface. Since the destination is determined by the MAC
1229 addresses involved, this may be desirable if you have a large 1543 addresses involved, this mode works best in a "local" network
1230 network with many hosts. It is likely to be suboptimal if all 1544 configuration (as described above), with destinations all on
1231 your traffic is passed through a single router, however. As 1545 the same local network. This mode is likely to be suboptimal
1232 with balance-rr, the switch ports need to be configured for 1546 if all your traffic is passed through a single router (i.e., a
1547 "gatewayed" network configuration, as described above).
1548
1549 As with balance-rr, the switch ports need to be configured for
1233 "etherchannel" or "trunking." 1550 "etherchannel" or "trunking."
1234 1551
1235broadcast: Like active-backup, there is not much advantage to this 1552broadcast: Like active-backup, there is not much advantage to this
@@ -1241,122 +1558,131 @@ broadcast: Like active-backup, there is not much advantage to this
1241 protocol includes automatic configuration of the aggregates, 1558 protocol includes automatic configuration of the aggregates,
1242 so minimal manual configuration of the switch is needed 1559 so minimal manual configuration of the switch is needed
1243 (typically only to designate that some set of devices is 1560 (typically only to designate that some set of devices is
1244 usable for 802.3ad). The 802.3ad standard also mandates that 1561 available for 802.3ad). The 802.3ad standard also mandates
1245 frames be delivered in order (within certain limits), so in 1562 that frames be delivered in order (within certain limits), so
1246 general single connections will not see misordering of 1563 in general single connections will not see misordering of
1247 packets. The 802.3ad mode does have some drawbacks: the 1564 packets. The 802.3ad mode does have some drawbacks: the
1248 standard mandates that all devices in the aggregate operate at 1565 standard mandates that all devices in the aggregate operate at
1249 the same speed and duplex. Also, as with all bonding load 1566 the same speed and duplex. Also, as with all bonding load
1250 balance modes other than balance-rr, no single connection will 1567 balance modes other than balance-rr, no single connection will
1251 be able to utilize more than a single interface's worth of 1568 be able to utilize more than a single interface's worth of
1252 bandwidth. Additionally, the linux bonding 802.3ad 1569 bandwidth.
1253 implementation distributes traffic by peer (using an XOR of 1570
1254 MAC addresses), so in general all traffic to a particular 1571 Additionally, the linux bonding 802.3ad implementation
1255 destination will use the same interface. Finally, the 802.3ad 1572 distributes traffic by peer (using an XOR of MAC addresses),
1256 mode mandates the use of the MII monitor, therefore, the ARP 1573 so in a "gatewayed" configuration, all outgoing traffic will
1257 monitor is not available in this mode. 1574 generally use the same device. Incoming traffic may also end
1258 1575 up on a single device, but that is dependent upon the
1259balance-tlb: This mode is also a good choice for this type of 1576 balancing policy of the peer's 8023.ad implementation. In a
1260 topology. It has no special switch configuration 1577 "local" configuration, traffic will be distributed across the
1261 requirements, and balances outgoing traffic by peer, in a 1578 devices in the bond.
1262 vaguely intelligent manner (not a simple XOR as in balance-xor 1579
1263 or 802.3ad mode), so that unlucky MAC addresses will not all 1580 Finally, the 802.3ad mode mandates the use of the MII monitor,
1264 "bunch up" on a single interface. Interfaces may be of 1581 therefore, the ARP monitor is not available in this mode.
1265 differing speeds. On the down side, in this mode all incoming 1582
1266 traffic arrives over a single interface, this mode requires 1583balance-tlb: The balance-tlb mode balances outgoing traffic by peer.
1267 certain ethtool support in the network device driver of the 1584 Since the balancing is done according to MAC address, in a
1268 slave interfaces, and the ARP monitor is not available. 1585 "gatewayed" configuration (as described above), this mode will
1269 1586 send all traffic across a single device. However, in a
1270balance-alb: This mode is everything that balance-tlb is, and more. It 1587 "local" network configuration, this mode balances multiple
1271 has all of the features (and restrictions) of balance-tlb, and 1588 local network peers across devices in a vaguely intelligent
1272 will also balance incoming traffic from peers (as described in 1589 manner (not a simple XOR as in balance-xor or 802.3ad mode),
1273 the Bonding Module Options section, above). The only extra 1590 so that mathematically unlucky MAC addresses (i.e., ones that
1274 down side to this mode is that the network device driver must 1591 XOR to the same value) will not all "bunch up" on a single
1275 support changing the hardware address while the device is 1592 interface.
1276 open. 1593
1277 1594 Unlike 802.3ad, interfaces may be of differing speeds, and no
127812.1.2 Link Monitoring for Single Switch Topology 1595 special switch configuration is required. On the down side,
1279------------------------------------------------- 1596 in this mode all incoming traffic arrives over a single
1597 interface, this mode requires certain ethtool support in the
1598 network device driver of the slave interfaces, and the ARP
1599 monitor is not available.
1600
1601balance-alb: This mode is everything that balance-tlb is, and more.
1602 It has all of the features (and restrictions) of balance-tlb,
1603 and will also balance incoming traffic from local network
1604 peers (as described in the Bonding Module Options section,
1605 above).
1606
1607 The only additional down side to this mode is that the network
1608 device driver must support changing the hardware address while
1609 the device is open.
1610
161113.1.2 MT Link Monitoring for Single Switch Topology
1612----------------------------------------------------
1280 1613
1281 The choice of link monitoring may largely depend upon which 1614 The choice of link monitoring may largely depend upon which
1282mode you choose to use. The more advanced load balancing modes do not 1615mode you choose to use. The more advanced load balancing modes do not
1283support the use of the ARP monitor, and are thus restricted to using 1616support the use of the ARP monitor, and are thus restricted to using
1284the MII monitor (which does not provide as high a level of assurance 1617the MII monitor (which does not provide as high a level of end to end
1285as the ARP monitor). 1618assurance as the ARP monitor).
1286 1619
1287 162013.2 Maximum Throughput in a Multiple Switch Topology
128812.2 High Availability in a Multiple Switch Topology 1621-----------------------------------------------------
1289---------------------------------------------------- 1622
1290 1623 Multiple switches may be utilized to optimize for throughput
1291 With multiple switches, the configuration of bonding and the 1624when they are configured in parallel as part of an isolated network
1292network changes dramatically. In multiple switch topologies, there is 1625between two or more systems, for example:
1293a tradeoff between network availability and usable bandwidth. 1626
1294 1627 +-----------+
1295 Below is a sample network, configured to maximize the 1628 | Host A |
1296availability of the network: 1629 +-+---+---+-+
1297 1630 | | |
1298 | | 1631 +--------+ | +---------+
1299 |port3 port3| 1632 | | |
1300 +-----+----+ +-----+----+ 1633 +------+---+ +-----+----+ +-----+----+
1301 | |port2 ISL port2| | 1634 | Switch A | | Switch B | | Switch C |
1302 | switch A +--------------------------+ switch B | 1635 +------+---+ +-----+----+ +-----+----+
1303 | | | | 1636 | | |
1304 +-----+----+ +-----++---+ 1637 +--------+ | +---------+
1305 |port1 port1| 1638 | | |
1306 | +-------+ | 1639 +-+---+---+-+
1307 +-------------+ host1 +---------------+ 1640 | Host B |
1308 eth0 +-------+ eth1 1641 +-----------+
1309 1642
1310 In this configuration, there is a link between the two 1643 In this configuration, the switches are isolated from one
1311switches (ISL, or inter switch link), and multiple ports connecting to 1644another. One reason to employ a topology such as this is for an
1312the outside world ("port3" on each switch). There is no technical 1645isolated network with many hosts (a cluster configured for high
1313reason that this could not be extended to a third switch. 1646performance, for example), using multiple smaller switches can be more
1314 1647cost effective than a single larger switch, e.g., on a network with 24
131512.2.1 Bonding Mode Selection for Multiple Switch Topology 1648hosts, three 24 port switches can be significantly less expensive than
1316---------------------------------------------------------- 1649a single 72 port switch.
1317 1650
1318 In a topology such as this, the active-backup and broadcast 1651 If access beyond the network is required, an individual host
1319modes are the only useful bonding modes; the other modes require all 1652can be equipped with an additional network device connected to an
1320links to terminate on the same peer for them to behave rationally. 1653external network; this host then additionally acts as a gateway.
1321 1654
1322active-backup: This is generally the preferred mode, particularly if 165513.2.1 MT Bonding Mode Selection for Multiple Switch Topology
1323 the switches have an ISL and play together well. If the
1324 network configuration is such that one switch is specifically
1325 a backup switch (e.g., has lower capacity, higher cost, etc),
1326 then the primary option can be used to insure that the
1327 preferred link is always used when it is available.
1328
1329broadcast: This mode is really a special purpose mode, and is suitable
1330 only for very specific needs. For example, if the two
1331 switches are not connected (no ISL), and the networks beyond
1332 them are totally independant. In this case, if it is
1333 necessary for some specific one-way traffic to reach both
1334 independent networks, then the broadcast mode may be suitable.
1335
133612.2.2 Link Monitoring Selection for Multiple Switch Topology
1337------------------------------------------------------------- 1656-------------------------------------------------------------
1338 1657
1339 The choice of link monitoring ultimately depends upon your 1658 In actual practice, the bonding mode typically employed in
1340switch. If the switch can reliably fail ports in response to other 1659configurations of this type is balance-rr. Historically, in this
1341failures, then either the MII or ARP monitors should work. For 1660network configuration, the usual caveats about out of order packet
1342example, in the above example, if the "port3" link fails at the remote 1661delivery are mitigated by the use of network adapters that do not do
1343end, the MII monitor has no direct means to detect this. The ARP 1662any kind of packet coalescing (via the use of NAPI, or because the
1344monitor could be configured with a target at the remote end of port3, 1663device itself does not generate interrupts until some number of
1345thus detecting that failure without switch support. 1664packets has arrived). When employed in this fashion, the balance-rr
1665mode allows individual connections between two hosts to effectively
1666utilize greater than one interface's bandwidth.
1346 1667
1347 In general, however, in a multiple switch topology, the ARP 166813.2.2 MT Link Monitoring for Multiple Switch Topology
1348monitor can provide a higher level of reliability in detecting link 1669------------------------------------------------------
1349failures. Additionally, it should be configured with multiple targets
1350(at least one for each switch in the network). This will insure that,
1351regardless of which switch is active, the ARP monitor has a suitable
1352target to query.
1353 1670
1671 Again, in actual practice, the MII monitor is most often used
1672in this configuration, as performance is given preference over
1673availability. The ARP monitor will function in this topology, but its
1674advantages over the MII monitor are mitigated by the volume of probes
1675needed as the number of systems involved grows (remember that each
1676host in the network is configured with bonding).
1354 1677
135512.3 Switch Behavior Issues for High Availability 167814. Switch Behavior Issues
1356------------------------------------------------- 1679==========================
1357 1680
1358 You may encounter issues with the timing of link up and down 168114.1 Link Establishment and Failover Delays
1359reporting by the switch. 1682-------------------------------------------
1683
1684 Some switches exhibit undesirable behavior with regard to the
1685timing of link up and down reporting by the switch.
1360 1686
1361 First, when a link comes up, some switches may indicate that 1687 First, when a link comes up, some switches may indicate that
1362the link is up (carrier available), but not pass traffic over the 1688the link is up (carrier available), but not pass traffic over the
@@ -1370,30 +1696,70 @@ relevant interface(s).
1370 Second, some switches may "bounce" the link state one or more 1696 Second, some switches may "bounce" the link state one or more
1371times while a link is changing state. This occurs most commonly while 1697times while a link is changing state. This occurs most commonly while
1372the switch is initializing. Again, an appropriate updelay value may 1698the switch is initializing. Again, an appropriate updelay value may
1373help, but note that if all links are down, then updelay is ignored 1699help.
1374when any link becomes active (the slave closest to completing its
1375updelay is chosen).
1376 1700
1377 Note that when a bonding interface has no active links, the 1701 Note that when a bonding interface has no active links, the
1378driver will immediately reuse the first link that goes up, even if 1702driver will immediately reuse the first link that goes up, even if the
1379updelay parameter was specified. If there are slave interfaces 1703updelay parameter has been specified (the updelay is ignored in this
1380waiting for the updelay timeout to expire, the interface that first 1704case). If there are slave interfaces waiting for the updelay timeout
1381went into that state will be immediately reused. This reduces down 1705to expire, the interface that first went into that state will be
1382time of the network if the value of updelay has been overestimated. 1706immediately reused. This reduces down time of the network if the
1707value of updelay has been overestimated, and since this occurs only in
1708cases with no connectivity, there is no additional penalty for
1709ignoring the updelay.
1383 1710
1384 In addition to the concerns about switch timings, if your 1711 In addition to the concerns about switch timings, if your
1385switches take a long time to go into backup mode, it may be desirable 1712switches take a long time to go into backup mode, it may be desirable
1386to not activate a backup interface immediately after a link goes down. 1713to not activate a backup interface immediately after a link goes down.
1387Failover may be delayed via the downdelay bonding module option. 1714Failover may be delayed via the downdelay bonding module option.
1388 1715
138913. Hardware Specific Considerations 171614.2 Duplicated Incoming Packets
1717--------------------------------
1718
1719 It is not uncommon to observe a short burst of duplicated
1720traffic when the bonding device is first used, or after it has been
1721idle for some period of time. This is most easily observed by issuing
1722a "ping" to some other host on the network, and noticing that the
1723output from ping flags duplicates (typically one per slave).
1724
1725 For example, on a bond in active-backup mode with five slaves
1726all connected to one switch, the output may appear as follows:
1727
1728# ping -n 10.0.4.2
1729PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data.
173064 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms
173164 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173264 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173364 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173464 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173564 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms
173664 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms
173764 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms
1738
1739 This is not due to an error in the bonding driver, rather, it
1740is a side effect of how many switches update their MAC forwarding
1741tables. Initially, the switch does not associate the MAC address in
1742the packet with a particular switch port, and so it may send the
1743traffic to all ports until its MAC forwarding table is updated. Since
1744the interfaces attached to the bond may occupy multiple ports on a
1745single switch, when the switch (temporarily) floods the traffic to all
1746ports, the bond device receives multiple copies of the same packet
1747(one per slave device).
1748
1749 The duplicated packet behavior is switch dependent, some
1750switches exhibit this, and some do not. On switches that display this
1751behavior, it can be induced by clearing the MAC forwarding table (on
1752most Cisco switches, the privileged command "clear mac address-table
1753dynamic" will accomplish this).
1754
175515. Hardware Specific Considerations
1390==================================== 1756====================================
1391 1757
1392 This section contains additional information for configuring 1758 This section contains additional information for configuring
1393bonding on specific hardware platforms, or for interfacing bonding 1759bonding on specific hardware platforms, or for interfacing bonding
1394with particular switches or other devices. 1760with particular switches or other devices.
1395 1761
139613.1 IBM BladeCenter 176215.1 IBM BladeCenter
1397-------------------- 1763--------------------
1398 1764
1399 This applies to the JS20 and similar systems. 1765 This applies to the JS20 and similar systems.
@@ -1407,12 +1773,12 @@ JS20 network adapter information
1407-------------------------------- 1773--------------------------------
1408 1774
1409 All JS20s come with two Broadcom Gigabit Ethernet ports 1775 All JS20s come with two Broadcom Gigabit Ethernet ports
1410integrated on the planar. In the BladeCenter chassis, the eth0 port 1776integrated on the planar (that's "motherboard" in IBM-speak). In the
1411of all JS20 blades is hard wired to I/O Module #1; similarly, all eth1 1777BladeCenter chassis, the eth0 port of all JS20 blades is hard wired to
1412ports are wired to I/O Module #2. An add-on Broadcom daughter card 1778I/O Module #1; similarly, all eth1 ports are wired to I/O Module #2.
1413can be installed on a JS20 to provide two more Gigabit Ethernet ports. 1779An add-on Broadcom daughter card can be installed on a JS20 to provide
1414These ports, eth2 and eth3, are wired to I/O Modules 3 and 4, 1780two more Gigabit Ethernet ports. These ports, eth2 and eth3, are
1415respectively. 1781wired to I/O Modules 3 and 4, respectively.
1416 1782
1417 Each I/O Module may contain either a switch or a passthrough 1783 Each I/O Module may contain either a switch or a passthrough
1418module (which allows ports to be directly connected to an external 1784module (which allows ports to be directly connected to an external
@@ -1432,29 +1798,30 @@ BladeCenter networking configuration
1432of ways, this discussion will be confined to describing basic 1798of ways, this discussion will be confined to describing basic
1433configurations. 1799configurations.
1434 1800
1435 Normally, Ethernet Switch Modules (ESM) are used in I/O 1801 Normally, Ethernet Switch Modules (ESMs) are used in I/O
1436modules 1 and 2. In this configuration, the eth0 and eth1 ports of a 1802modules 1 and 2. In this configuration, the eth0 and eth1 ports of a
1437JS20 will be connected to different internal switches (in the 1803JS20 will be connected to different internal switches (in the
1438respective I/O modules). 1804respective I/O modules).
1439 1805
1440 An optical passthru module (OPM) connects the I/O module 1806 A passthrough module (OPM or CPM, optical or copper,
1441directly to an external switch. By using OPMs in I/O module #1 and 1807passthrough module) connects the I/O module directly to an external
1442#2, the eth0 and eth1 interfaces of a JS20 can be redirected to the 1808switch. By using PMs in I/O module #1 and #2, the eth0 and eth1
1443outside world and connected to a common external switch. 1809interfaces of a JS20 can be redirected to the outside world and
1444 1810connected to a common external switch.
1445 Depending upon the mix of ESM and OPM modules, the network 1811
1446will appear to bonding as either a single switch topology (all OPM 1812 Depending upon the mix of ESMs and PMs, the network will
1447modules) or as a multiple switch topology (one or more ESM modules, 1813appear to bonding as either a single switch topology (all PMs) or as a
1448zero or more OPM modules). It is also possible to connect ESM modules 1814multiple switch topology (one or more ESMs, zero or more PMs). It is
1449together, resulting in a configuration much like the example in "High 1815also possible to connect ESMs together, resulting in a configuration
1450Availability in a multiple switch topology." 1816much like the example in "High Availability in a Multiple Switch
1451 1817Topology," above.
1452Requirements for specifc modes 1818
1453------------------------------ 1819Requirements for specific modes
1454 1820-------------------------------
1455 The balance-rr mode requires the use of OPM modules for 1821
1456devices in the bond, all connected to an common external switch. That 1822 The balance-rr mode requires the use of passthrough modules
1457switch must be configured for "etherchannel" or "trunking" on the 1823for devices in the bond, all connected to an common external switch.
1824That switch must be configured for "etherchannel" or "trunking" on the
1458appropriate ports, as is usual for balance-rr. 1825appropriate ports, as is usual for balance-rr.
1459 1826
1460 The balance-alb and balance-tlb modes will function with 1827 The balance-alb and balance-tlb modes will function with
@@ -1484,17 +1851,18 @@ connected to the JS20 system.
1484Other concerns 1851Other concerns
1485-------------- 1852--------------
1486 1853
1487 The Serial Over LAN link is established over the primary 1854 The Serial Over LAN (SoL) link is established over the primary
1488ethernet (eth0) only, therefore, any loss of link to eth0 will result 1855ethernet (eth0) only, therefore, any loss of link to eth0 will result
1489in losing your SoL connection. It will not fail over with other 1856in losing your SoL connection. It will not fail over with other
1490network traffic. 1857network traffic, as the SoL system is beyond the control of the
1858bonding driver.
1491 1859
1492 It may be desirable to disable spanning tree on the switch 1860 It may be desirable to disable spanning tree on the switch
1493(either the internal Ethernet Switch Module, or an external switch) to 1861(either the internal Ethernet Switch Module, or an external switch) to
1494avoid fail-over delays issues when using bonding. 1862avoid fail-over delay issues when using bonding.
1495 1863
1496 1864
149714. Frequently Asked Questions 186516. Frequently Asked Questions
1498============================== 1866==============================
1499 1867
15001. Is it SMP safe? 18681. Is it SMP safe?
@@ -1505,8 +1873,8 @@ The new driver was designed to be SMP safe from the start.
15052. What type of cards will work with it? 18732. What type of cards will work with it?
1506 1874
1507 Any Ethernet type cards (you can even mix cards - a Intel 1875 Any Ethernet type cards (you can even mix cards - a Intel
1508EtherExpress PRO/100 and a 3com 3c905b, for example). They need not 1876EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes,
1509be of the same speed. 1877devices need not be of the same speed.
1510 1878
15113. How many bonding devices can I have? 18793. How many bonding devices can I have?
1512 1880
@@ -1524,11 +1892,12 @@ system.
1524disabled. The active-backup mode will fail over to a backup link, and 1892disabled. The active-backup mode will fail over to a backup link, and
1525other modes will ignore the failed link. The link will continue to be 1893other modes will ignore the failed link. The link will continue to be
1526monitored, and should it recover, it will rejoin the bond (in whatever 1894monitored, and should it recover, it will rejoin the bond (in whatever
1527manner is appropriate for the mode). See the section on High 1895manner is appropriate for the mode). See the sections on High
1528Availability for additional information. 1896Availability and the documentation for each mode for additional
1897information.
1529 1898
1530 Link monitoring can be enabled via either the miimon or 1899 Link monitoring can be enabled via either the miimon or
1531arp_interval paramters (described in the module paramters section, 1900arp_interval parameters (described in the module parameters section,
1532above). In general, miimon monitors the carrier state as sensed by 1901above). In general, miimon monitors the carrier state as sensed by
1533the underlying network device, and the arp monitor (arp_interval) 1902the underlying network device, and the arp monitor (arp_interval)
1534monitors connectivity to another host on the local network. 1903monitors connectivity to another host on the local network.
@@ -1536,7 +1905,7 @@ monitors connectivity to another host on the local network.
1536 If no link monitoring is configured, the bonding driver will 1905 If no link monitoring is configured, the bonding driver will
1537be unable to detect link failures, and will assume that all links are 1906be unable to detect link failures, and will assume that all links are
1538always available. This will likely result in lost packets, and a 1907always available. This will likely result in lost packets, and a
1539resulting degredation of performance. The precise performance loss 1908resulting degradation of performance. The precise performance loss
1540depends upon the bonding mode and network configuration. 1909depends upon the bonding mode and network configuration.
1541 1910
15426. Can bonding be used for High Availability? 19116. Can bonding be used for High Availability?
@@ -1550,12 +1919,12 @@ depends upon the bonding mode and network configuration.
1550 In the basic balance modes (balance-rr and balance-xor), it 1919 In the basic balance modes (balance-rr and balance-xor), it
1551works with any system that supports etherchannel (also called 1920works with any system that supports etherchannel (also called
1552trunking). Most managed switches currently available have such 1921trunking). Most managed switches currently available have such
1553support, and many unmananged switches as well. 1922support, and many unmanaged switches as well.
1554 1923
1555 The advanced balance modes (balance-tlb and balance-alb) do 1924 The advanced balance modes (balance-tlb and balance-alb) do
1556not have special switch requirements, but do need device drivers that 1925not have special switch requirements, but do need device drivers that
1557support specific features (described in the appropriate section under 1926support specific features (described in the appropriate section under
1558module paramters, above). 1927module parameters, above).
1559 1928
1560 In 802.3ad mode, it works with with systems that support IEEE 1929 In 802.3ad mode, it works with with systems that support IEEE
1561802.3ad Dynamic Link Aggregation. Most managed and many unmanaged 1930802.3ad Dynamic Link Aggregation. Most managed and many unmanaged
@@ -1565,17 +1934,19 @@ switches currently available support 802.3ad.
1565 1934
15668. Where does a bonding device get its MAC address from? 19358. Where does a bonding device get its MAC address from?
1567 1936
1568 If not explicitly configured with ifconfig, the MAC address of 1937 If not explicitly configured (with ifconfig or ip link), the
1569the bonding device is taken from its first slave device. This MAC 1938MAC address of the bonding device is taken from its first slave
1570address is then passed to all following slaves and remains persistent 1939device. This MAC address is then passed to all following slaves and
1571(even if the the first slave is removed) until the bonding device is 1940remains persistent (even if the the first slave is removed) until the
1572brought down or reconfigured. 1941bonding device is brought down or reconfigured.
1573 1942
1574 If you wish to change the MAC address, you can set it with 1943 If you wish to change the MAC address, you can set it with
1575ifconfig: 1944ifconfig or ip link:
1576 1945
1577# ifconfig bond0 hw ether 00:11:22:33:44:55 1946# ifconfig bond0 hw ether 00:11:22:33:44:55
1578 1947
1948# ip link set bond0 address 66:77:88:99:aa:bb
1949
1579 The MAC address can be also changed by bringing down/up the 1950 The MAC address can be also changed by bringing down/up the
1580device and then changing its slaves (or their order): 1951device and then changing its slaves (or their order):
1581 1952
@@ -1591,23 +1962,28 @@ from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
1591then restore the MAC addresses that the slaves had before they were 1962then restore the MAC addresses that the slaves had before they were
1592enslaved. 1963enslaved.
1593 1964
159415. Resources and Links 196516. Resources and Links
1595======================= 1966=======================
1596 1967
1597The latest version of the bonding driver can be found in the latest 1968The latest version of the bonding driver can be found in the latest
1598version of the linux kernel, found on http://kernel.org 1969version of the linux kernel, found on http://kernel.org
1599 1970
1971The latest version of this document can be found in either the latest
1972kernel source (named Documentation/networking/bonding.txt), or on the
1973bonding sourceforge site:
1974
1975http://www.sourceforge.net/projects/bonding
1976
1600Discussions regarding the bonding driver take place primarily on the 1977Discussions regarding the bonding driver take place primarily on the
1601bonding-devel mailing list, hosted at sourceforge.net. If you have 1978bonding-devel mailing list, hosted at sourceforge.net. If you have
1602questions or problems, post them to the list. 1979questions or problems, post them to the list. The list address is:
1603 1980
1604bonding-devel@lists.sourceforge.net 1981bonding-devel@lists.sourceforge.net
1605 1982
1606https://lists.sourceforge.net/lists/listinfo/bonding-devel 1983 The administrative interface (to subscribe or unsubscribe) can
1607 1984be found at:
1608There is also a project site on sourceforge.
1609 1985
1610http://www.sourceforge.net/projects/bonding 1986https://lists.sourceforge.net/lists/listinfo/bonding-devel
1611 1987
1612Donald Becker's Ethernet Drivers and diag programs may be found at : 1988Donald Becker's Ethernet Drivers and diag programs may be found at :
1613 - http://www.scyld.com/network/ 1989 - http://www.scyld.com/network/
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt
index 59ccc63838c1..403e7b4dcdd4 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.txt
@@ -56,3 +56,12 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
56 memory regions in-use. The name argument should be a pointer to 56 memory regions in-use. The name argument should be a pointer to
57 your driver name. Eg, for pcnet_cs, name should point to the 57 your driver name. Eg, for pcnet_cs, name should point to the
58 string "pcnet_cs". 58 string "pcnet_cs".
59
60* CardServices is gone
61 CardServices() in 2.4 is just a big switch statement to call various
62 services. In 2.6, all of those entry points are exported and called
63 directly (except for pcmcia_report_error(), just use cs_error() instead).
64
65* struct pcmcia_driver
66 You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
67 instead of {un,}register_pccard_driver
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 104a994b8289..a18ecb92b356 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -636,11 +636,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
636 3stack-digout 3-jack in back, a HP out and a SPDIF out 636 3stack-digout 3-jack in back, a HP out and a SPDIF out
637 5stack 5-jack in back, 2-jack in front 637 5stack 5-jack in back, 2-jack in front
638 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out 638 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out
639 6stack 6-jack in back, 2-jack in front
640 6stack-digout 6-jack with a SPDIF out
639 w810 3-jack 641 w810 3-jack
640 z71v 3-jack (HP shared SPDIF) 642 z71v 3-jack (HP shared SPDIF)
641 asus 3-jack 643 asus 3-jack
642 uniwill 3-jack 644 uniwill 3-jack
643 F1734 2-jack 645 F1734 2-jack
646 test for testing/debugging purpose, almost all controls can be
647 adjusted. Appearing only when compiled with
648 $CONFIG_SND_DEBUG=y
644 649
645 CMI9880 650 CMI9880
646 minimal 3-jack in back 651 minimal 3-jack in back
@@ -1054,6 +1059,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1054 1059
1055 The power-management is supported. 1060 The power-management is supported.
1056 1061
1062 Module snd-pxa2xx-ac97 (on arm only)
1063 ------------------------------------
1064
1065 Module for AC97 driver for the Intel PXA2xx chip
1066
1067 For ARM architecture only.
1068
1057 Module snd-rme32 1069 Module snd-rme32
1058 ---------------- 1070 ----------------
1059 1071
@@ -1173,6 +1185,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1173 1185
1174 Module supports up to 8 cards. 1186 Module supports up to 8 cards.
1175 1187
1188 Module snd-sun-dbri (on sparc only)
1189 -----------------------------------
1190
1191 Module for DBRI sound chips found on Sparcs.
1192
1193 Module supports up to 8 cards.
1194
1176 Module snd-wavefront 1195 Module snd-wavefront
1177 -------------------- 1196 --------------------
1178 1197
@@ -1371,7 +1390,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1371 Module snd-vxpocket 1390 Module snd-vxpocket
1372 ------------------- 1391 -------------------
1373 1392
1374 Module for Digigram VX-Pocket VX2 PCMCIA card. 1393 Module for Digigram VX-Pocket VX2 and 440 PCMCIA cards.
1375 1394
1376 ibl - Capture IBL size. (default = 0, minimum size) 1395 ibl - Capture IBL size. (default = 0, minimum size)
1377 1396
@@ -1391,29 +1410,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1391 1410
1392 Note: the driver is build only when CONFIG_ISA is set. 1411 Note: the driver is build only when CONFIG_ISA is set.
1393 1412
1394 Module snd-vxp440
1395 -----------------
1396
1397 Module for Digigram VX-Pocket 440 PCMCIA card.
1398
1399 ibl - Capture IBL size. (default = 0, minimum size)
1400
1401 Module supports up to 8 cards. The module is compiled only when
1402 PCMCIA is supported on kernel.
1403
1404 To activate the driver via the card manager, you'll need to set
1405 up /etc/pcmcia/vxp440.conf. See the sound/pcmcia/vx/vxp440.c.
1406
1407 When the driver is compiled as a module and the hotplug firmware
1408 is supported, the firmware data is loaded via hotplug automatically.
1409 Install the necessary firmware files in alsa-firmware package.
1410 When no hotplug fw loader is available, you need to load the
1411 firmware via vxloader utility in alsa-tools package.
1412
1413 About capture IBL, see the description of snd-vx222 module.
1414
1415 Note: the driver is build only when CONFIG_ISA is set.
1416
1417 Module snd-ymfpci 1413 Module snd-ymfpci
1418 ----------------- 1414 -----------------
1419 1415
diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt
index 3cea13875277..f39c9d714db3 100644
--- a/Documentation/stable_api_nonsense.txt
+++ b/Documentation/stable_api_nonsense.txt
@@ -132,7 +132,7 @@ to extra work for the USB developers. Since all Linux USB developers do
132their work on their own time, asking programmers to do extra work for no 132their work on their own time, asking programmers to do extra work for no
133gain, for free, is not a possibility. 133gain, for free, is not a possibility.
134 134
135Security issues are also a very important for Linux. When a 135Security issues are also very important for Linux. When a
136security issue is found, it is fixed in a very short amount of time. A 136security issue is found, it is fixed in a very short amount of time. A
137number of times this has caused internal kernel interfaces to be 137number of times this has caused internal kernel interfaces to be
138reworked to prevent the security problem from occurring. When this 138reworked to prevent the security problem from occurring. When this
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
new file mode 100644
index 000000000000..2c81305090df
--- /dev/null
+++ b/Documentation/stable_kernel_rules.txt
@@ -0,0 +1,58 @@
1Everything you ever wanted to know about Linux 2.6 -stable releases.
2
3Rules on what kind of patches are accepted, and what ones are not, into
4the "-stable" tree:
5
6 - It must be obviously correct and tested.
7 - It can not bigger than 100 lines, with context.
8 - It must fix only one thing.
9 - It must fix a real bug that bothers people (not a, "This could be a
10 problem..." type thing.)
11 - It must fix a problem that causes a build error (but not for things
12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
13 security issue, or some "oh, that's not good" issue. In short,
14 something critical.
15 - No "theoretical race condition" issues, unless an explanation of how
16 the race can be exploited.
17 - It can not contain any "trivial" fixes in it (spelling changes,
18 whitespace cleanups, etc.)
19 - It must be accepted by the relevant subsystem maintainer.
20 - It must follow Documentation/SubmittingPatches rules.
21
22
23Procedure for submitting patches to the -stable tree:
24
25 - Send the patch, after verifying that it follows the above rules, to
26 stable@kernel.org.
27 - The sender will receive an ack when the patch has been accepted into
28 the queue, or a nak if the patch is rejected. This response might
29 take a few days, according to the developer's schedules.
30 - If accepted, the patch will be added to the -stable queue, for review
31 by other developers.
32 - Security patches should not be sent to this alias, but instead to the
33 documented security@kernel.org.
34
35
36Review cycle:
37
38 - When the -stable maintainers decide for a review cycle, the patches
39 will be sent to the review committee, and the maintainer of the
40 affected area of the patch (unless the submitter is the maintainer of
41 the area) and CC: to the linux-kernel mailing list.
42 - The review committee has 48 hours in which to ack or nak the patch.
43 - If the patch is rejected by a member of the committee, or linux-kernel
44 members object to the patch, bringing up issues that the maintainers
45 and members did not realize, the patch will be dropped from the
46 queue.
47 - At the end of the review cycle, the acked patches will be added to
48 the latest -stable release, and a new -stable release will happen.
49 - Security patches will be accepted into the -stable tree directly from
50 the security kernel team, and not go through the normal review cycle.
51 Contact the kernel security team for more details on this procedure.
52
53
54Review committe:
55
56 - This will be made up of a number of kernel developers who have
57 volunteered for this task, and a few that haven't.
58
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
index f1896ee3bb2a..63cb7edd177e 100644
--- a/Documentation/usb/usbmon.txt
+++ b/Documentation/usb/usbmon.txt
@@ -102,7 +102,7 @@ Here is the list of words, from left to right:
102- URB Status. This field makes no sense for submissions, but is present 102- URB Status. This field makes no sense for submissions, but is present
103 to help scripts with parsing. In error case, it contains the error code. 103 to help scripts with parsing. In error case, it contains the error code.
104 In case of a setup packet, it contains a Setup Tag. If scripts read a number 104 In case of a setup packet, it contains a Setup Tag. If scripts read a number
105 in this field, the proceed to read Data Length. Otherwise, they read 105 in this field, they proceed to read Data Length. Otherwise, they read
106 the setup packet before reading the Data Length. 106 the setup packet before reading the Data Length.
107- Setup packet, if present, consists of 5 words: one of each for bmRequestType, 107- Setup packet, if present, consists of 5 words: one of each for bmRequestType,
108 bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0. 108 bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0.
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 6d44958289de..03deb0726aa4 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -29,3 +29,4 @@ card=27 - PixelView PlayTV Ultra Pro (Stereo)
29card=28 - DViCO FusionHDTV 3 Gold-T 29card=28 - DViCO FusionHDTV 3 Gold-T
30card=29 - ADS Tech Instant TV DVB-T PCI 30card=29 - ADS Tech Instant TV DVB-T PCI
31card=30 - TerraTec Cinergy 1400 DVB-T 31card=30 - TerraTec Cinergy 1400 DVB-T
32card=31 - DViCO FusionHDTV 5 Gold
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
index d1b9d21ffd89..f3302e1b1b9c 100644
--- a/Documentation/video4linux/CARDLIST.tuner
+++ b/Documentation/video4linux/CARDLIST.tuner
@@ -62,3 +62,5 @@ tuner=60 - Thomson DDT 7611 (ATSC/NTSC)
62tuner=61 - Tena TNF9533-D/IF/TNF9533-B/DF 62tuner=61 - Tena TNF9533-D/IF/TNF9533-B/DF
63tuner=62 - Philips TEA5767HN FM Radio 63tuner=62 - Philips TEA5767HN FM Radio
64tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner 64tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner
65tuner=64 - LG TDVS-H062F/TUA6034
66tuner=65 - Ymec TVF66T5-B/DFF
diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options
index 7bb5a50b0779..fc94ff235ffa 100644
--- a/Documentation/video4linux/bttv/Insmod-options
+++ b/Documentation/video4linux/bttv/Insmod-options
@@ -44,6 +44,9 @@ bttv.o
44 push used by bttv. bttv will disable overlay 44 push used by bttv. bttv will disable overlay
45 by default on this hardware to avoid crashes. 45 by default on this hardware to avoid crashes.
46 With this insmod option you can override this. 46 With this insmod option you can override this.
47 no_overlay=1 Disable overlay. It should be used by broken
48 hardware that doesn't support PCI2PCI direct
49 transfers.
47 automute=0/1 Automatically mutes the sound if there is 50 automute=0/1 Automatically mutes the sound if there is
48 no TV signal, on by default. You might try 51 no TV signal, on by default. You might try
49 to disable this if you have bad input signal 52 to disable this if you have bad input signal
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index b9e6be00cadf..678e8f192db2 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -6,6 +6,11 @@ only the AMD64 specific ones are listed here.
6Machine check 6Machine check
7 7
8 mce=off disable machine check 8 mce=off disable machine check
9 mce=bootlog Enable logging of machine checks left over from booting.
10 Disabled by default because some BIOS leave bogus ones.
11 If your BIOS doesn't do that it's a good idea to enable though
12 to make sure you log even machine check events that result
13 in a reboot.
9 14
10 nomce (for compatibility with i386): same as mce=off 15 nomce (for compatibility with i386): same as mce=off
11 16
@@ -47,7 +52,7 @@ Timing
47 notsc 52 notsc
48 Don't use the CPU time stamp counter to read the wall time. 53 Don't use the CPU time stamp counter to read the wall time.
49 This can be used to work around timing problems on multiprocessor systems 54 This can be used to work around timing problems on multiprocessor systems
50 with not properly synchronized CPUs. Only useful with a SMP kernel 55 with not properly synchronized CPUs.
51 56
52 report_lost_ticks 57 report_lost_ticks
53 Report when timer interrupts are lost because some code turned off 58 Report when timer interrupts are lost because some code turned off
@@ -74,6 +79,9 @@ Idle loop
74 event. This will make the CPUs eat a lot more power, but may be useful 79 event. This will make the CPUs eat a lot more power, but may be useful
75 to get slightly better performance in multiprocessor benchmarks. It also 80 to get slightly better performance in multiprocessor benchmarks. It also
76 makes some profiling using performance counters more accurate. 81 makes some profiling using performance counters more accurate.
82 Please note that on systems with MONITOR/MWAIT support (like Intel EM64T
83 CPUs) this option has no performance advantage over the normal idle loop.
84 It may also interact badly with hyperthreading.
77 85
78Rebooting 86Rebooting
79 87
@@ -178,6 +186,5 @@ Debugging
178Misc 186Misc
179 187
180 noreplacement Don't replace instructions with more appropiate ones 188 noreplacement Don't replace instructions with more appropiate ones
181 for the CPU. This may be useful on asymmetric MP systems 189 for the CPU. This may be useful on asymmetric MP systems
182 where some CPU have less capabilities than the others. 190 where some CPU have less capabilities than the others.
183
diff --git a/MAINTAINERS b/MAINTAINERS
index 6d187fb934f3..ac594d26d698 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1524,6 +1524,12 @@ P: Zach Brown
1524M: zab@zabbo.net 1524M: zab@zabbo.net
1525S: Odd Fixes 1525S: Odd Fixes
1526 1526
1527MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
1528P: Michael Kerrisk
1529M: mtk-manpages@gmx.net
1530W: ftp://ftp.kernel.org/pub/linux/docs/manpages
1531S: Maintained
1532
1527MARVELL MV64340 ETHERNET DRIVER 1533MARVELL MV64340 ETHERNET DRIVER
1528P: Manish Lachwani 1534P: Manish Lachwani
1529M: Manish_Lachwani@pmc-sierra.com 1535M: Manish_Lachwani@pmc-sierra.com
@@ -1655,7 +1661,7 @@ M: kuznet@ms2.inr.ac.ru
1655P: Pekka Savola (ipv6) 1661P: Pekka Savola (ipv6)
1656M: pekkas@netcore.fi 1662M: pekkas@netcore.fi
1657P: James Morris 1663P: James Morris
1658M: jmorris@redhat.com 1664M: jmorris@namei.org
1659P: Hideaki YOSHIFUJI 1665P: Hideaki YOSHIFUJI
1660M: yoshfuji@linux-ipv6.org 1666M: yoshfuji@linux-ipv6.org
1661P: Patrick McHardy 1667P: Patrick McHardy
@@ -2044,7 +2050,7 @@ SELINUX SECURITY MODULE
2044P: Stephen Smalley 2050P: Stephen Smalley
2045M: sds@epoch.ncsc.mil 2051M: sds@epoch.ncsc.mil
2046P: James Morris 2052P: James Morris
2047M: jmorris@redhat.com 2053M: jmorris@namei.org
2048L: linux-kernel@vger.kernel.org (kernel issues) 2054L: linux-kernel@vger.kernel.org (kernel issues)
2049L: selinux@tycho.nsa.gov (general discussion) 2055L: selinux@tycho.nsa.gov (general discussion)
2050W: http://www.nsa.gov/selinux 2056W: http://www.nsa.gov/selinux
diff --git a/Makefile b/Makefile
index cf34a6b5c6eb..2c1486159d8d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 13 3SUBLEVEL = 13
4EXTRAVERSION =-rc3 4EXTRAVERSION =-rc6
5NAME=Woozy Numbat 5NAME=Woozy Numbat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/README b/README
index 0df20f07227b..76dd780d88ed 100644
--- a/README
+++ b/README
@@ -87,6 +87,16 @@ INSTALLING the kernel:
87 kernel source. Patches are applied from the current directory, but 87 kernel source. Patches are applied from the current directory, but
88 an alternative directory can be specified as the second argument. 88 an alternative directory can be specified as the second argument.
89 89
90 - If you are upgrading between releases using the stable series patches
91 (for example, patch-2.6.xx.y), note that these "dot-releases" are
92 not incremental and must be applied to the 2.6.xx base tree. For
93 example, if your base kernel is 2.6.12 and you want to apply the
94 2.6.12.3 patch, you do not and indeed must not first apply the
95 2.6.12.1 and 2.6.12.2 patches. Similarly, if you are running kernel
96 version 2.6.12.2 and want to jump to 2.6.12.3, you must first
97 reverse the 2.6.12.2 patch (that is, patch -R) _before_ applying
98 the 2.6.12.3 patch.
99
90 - Make sure you have no stale .o files and dependencies lying around: 100 - Make sure you have no stale .o files and dependencies lying around:
91 101
92 cd linux 102 cd linux
diff --git a/REPORTING-BUGS b/REPORTING-BUGS
index 2045eaea2d9e..224c34741d32 100644
--- a/REPORTING-BUGS
+++ b/REPORTING-BUGS
@@ -41,18 +41,19 @@ summary from [1.]>" for easy identification by the developers
41[2.] Full description of the problem/report: 41[2.] Full description of the problem/report:
42[3.] Keywords (i.e., modules, networking, kernel): 42[3.] Keywords (i.e., modules, networking, kernel):
43[4.] Kernel version (from /proc/version): 43[4.] Kernel version (from /proc/version):
44[5.] Output of Oops.. message (if applicable) with symbolic information 44[5.] Most recent kernel version which did not have the bug:
45[6.] Output of Oops.. message (if applicable) with symbolic information
45 resolved (see Documentation/oops-tracing.txt) 46 resolved (see Documentation/oops-tracing.txt)
46[6.] A small shell script or example program which triggers the 47[7.] A small shell script or example program which triggers the
47 problem (if possible) 48 problem (if possible)
48[7.] Environment 49[8.] Environment
49[7.1.] Software (add the output of the ver_linux script here) 50[8.1.] Software (add the output of the ver_linux script here)
50[7.2.] Processor information (from /proc/cpuinfo): 51[8.2.] Processor information (from /proc/cpuinfo):
51[7.3.] Module information (from /proc/modules): 52[8.3.] Module information (from /proc/modules):
52[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem) 53[8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
53[7.5.] PCI information ('lspci -vvv' as root) 54[8.5.] PCI information ('lspci -vvv' as root)
54[7.6.] SCSI information (from /proc/scsi/scsi) 55[8.6.] SCSI information (from /proc/scsi/scsi)
55[7.7.] Other information that might be relevant to the problem 56[8.7.] Other information that might be relevant to the problem
56 (please look in /proc and include all information that you 57 (please look in /proc and include all information that you
57 think to be relevant): 58 think to be relevant):
58[X.] Other notes, patches, fixes, workarounds: 59[X.] Other notes, patches, fixes, workarounds:
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 1f36bbd0ed5d..2a8b364c822e 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -350,8 +350,24 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
350 region->end = res->end - offset; 350 region->end = res->end - offset;
351} 351}
352 352
353void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
354 struct pci_bus_region *region)
355{
356 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
357 unsigned long offset = 0;
358
359 if (res->flags & IORESOURCE_IO)
360 offset = hose->io_space->start;
361 else if (res->flags & IORESOURCE_MEM)
362 offset = hose->mem_space->start;
363
364 res->start = region->start + offset;
365 res->end = region->end + offset;
366}
367
353#ifdef CONFIG_HOTPLUG 368#ifdef CONFIG_HOTPLUG
354EXPORT_SYMBOL(pcibios_resource_to_bus); 369EXPORT_SYMBOL(pcibios_resource_to_bus);
370EXPORT_SYMBOL(pcibios_bus_to_resource);
355#endif 371#endif
356 372
357int 373int
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 052120882876..4342cea1a926 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -461,6 +461,11 @@ sys_call_table:
461 .quad sys_add_key 461 .quad sys_add_key
462 .quad sys_request_key /* 440 */ 462 .quad sys_request_key /* 440 */
463 .quad sys_keyctl 463 .quad sys_keyctl
464 .quad sys_ioprio_set
465 .quad sys_ioprio_get
466 .quad sys_inotify_init
467 .quad sys_inotify_add_watch /* 445 */
468 .quad sys_inotify_rm_watch
464 469
465 .size sys_call_table, . - sys_call_table 470 .size sys_call_table, . - sys_call_table
466 .type sys_call_table, @object 471 .type sys_call_table, @object
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ad26e98f1e62..c4923fac8dff 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -447,9 +447,26 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
447 region->end = res->end - offset; 447 region->end = res->end - offset;
448} 448}
449 449
450void __devinit
451pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
452 struct pci_bus_region *region)
453{
454 struct pci_sys_data *root = dev->sysdata;
455 unsigned long offset = 0;
456
457 if (res->flags & IORESOURCE_IO)
458 offset = root->io_offset;
459 if (res->flags & IORESOURCE_MEM)
460 offset = root->mem_offset;
461
462 res->start = region->start + offset;
463 res->end = region->end + offset;
464}
465
450#ifdef CONFIG_HOTPLUG 466#ifdef CONFIG_HOTPLUG
451EXPORT_SYMBOL(pcibios_fixup_bus); 467EXPORT_SYMBOL(pcibios_fixup_bus);
452EXPORT_SYMBOL(pcibios_resource_to_bus); 468EXPORT_SYMBOL(pcibios_resource_to_bus);
469EXPORT_SYMBOL(pcibios_bus_to_resource);
453#endif 470#endif
454 471
455/* 472/*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 295e0a8379cf..b2085735a2ba 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -176,6 +176,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
176 cpu_set(cpu, mm->cpu_vm_mask); 176 cpu_set(cpu, mm->cpu_vm_mask);
177 cpu_switch_mm(mm->pgd, mm); 177 cpu_switch_mm(mm->pgd, mm);
178 enter_lazy_tlb(mm, current); 178 enter_lazy_tlb(mm, current);
179 local_flush_tlb_all();
179 180
180 cpu_init(); 181 cpu_init();
181 182
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index 6976e60e47cb..2036ff15bda9 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -7,7 +7,7 @@
71: ldrexb r2, [r1] 71: ldrexb r2, [r1]
8 \instr r2, r2, r3 8 \instr r2, r2, r3
9 strexb r0, r2, [r1] 9 strexb r0, r2, [r1]
10 cmpne r0, #0 10 cmp r0, #0
11 bne 1b 11 bne 1b
12 mov pc, lr 12 mov pc, lr
13 .endm 13 .endm
@@ -19,9 +19,9 @@
19 mov r3, r2, lsl r3 @ create mask 19 mov r3, r2, lsl r3 @ create mask
201: ldrexb r2, [r1] 201: ldrexb r2, [r1]
21 ands r0, r2, r3 @ save old value of bit 21 ands r0, r2, r3 @ save old value of bit
22 \instr ip, r2, r3 @ toggle bit 22 \instr r2, r2, r3 @ toggle bit
23 strexb r2, ip, [r1] 23 strexb ip, r2, [r1]
24 cmp r2, #0 24 cmp ip, #0
25 bne 1b 25 bne 1b
26 cmp r0, #0 26 cmp r0, #0
27 movne r0, #1 27 movne r0, #1
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c
index aecf47ba033a..ea10bd8c972c 100644
--- a/arch/arm/mach-integrator/platsmp.c
+++ b/arch/arm/mach-integrator/platsmp.c
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/atomic.h> 17#include <asm/atomic.h>
18#include <asm/cacheflush.h>
18#include <asm/delay.h> 19#include <asm/delay.h>
19#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
20#include <asm/procinfo.h> 21#include <asm/procinfo.h>
@@ -80,6 +81,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
80 * "cpu" is Linux's internal ID. 81 * "cpu" is Linux's internal ID.
81 */ 82 */
82 pen_release = cpu; 83 pen_release = cpu;
84 flush_cache_all();
83 85
84 /* 86 /*
85 * XXX 87 * XXX
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 4ff4393ef0ea..7f58afb27e71 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -61,7 +61,7 @@ static struct plat_serial8250_port coyote_uart_data[] = {
61 .mapbase = IXP4XX_UART2_BASE_PHYS, 61 .mapbase = IXP4XX_UART2_BASE_PHYS,
62 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 62 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
63 .irq = IRQ_IXP4XX_UART2, 63 .irq = IRQ_IXP4XX_UART2,
64 .flags = UPF_BOOT_AUTOCONF, 64 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
65 .iotype = UPIO_MEM, 65 .iotype = UPIO_MEM,
66 .regshift = 2, 66 .regshift = 2,
67 .uartclk = IXP4XX_UART_XTAL, 67 .uartclk = IXP4XX_UART_XTAL,
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 8ba1cd9406e7..65e356bd10d6 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -83,7 +83,7 @@ static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
83 .mapbase = IXP4XX_UART2_BASE_PHYS, 83 .mapbase = IXP4XX_UART2_BASE_PHYS,
84 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 84 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
85 .irq = IRQ_IXP4XX_UART2, 85 .irq = IRQ_IXP4XX_UART2,
86 .flags = UPF_BOOT_AUTOCONF, 86 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
87 .iotype = UPIO_MEM, 87 .iotype = UPIO_MEM,
88 .regshift = 2, 88 .regshift = 2,
89 .uartclk = IXP4XX_UART_XTAL, 89 .uartclk = IXP4XX_UART_XTAL,
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index c2ba759e9946..4633470a6a37 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -82,7 +82,7 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
82 .mapbase = IXP4XX_UART1_BASE_PHYS, 82 .mapbase = IXP4XX_UART1_BASE_PHYS,
83 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, 83 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
84 .irq = IRQ_IXP4XX_UART1, 84 .irq = IRQ_IXP4XX_UART1,
85 .flags = UPF_BOOT_AUTOCONF, 85 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
86 .iotype = UPIO_MEM, 86 .iotype = UPIO_MEM,
87 .regshift = 2, 87 .regshift = 2,
88 .uartclk = IXP4XX_UART_XTAL, 88 .uartclk = IXP4XX_UART_XTAL,
@@ -91,7 +91,7 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
91 .mapbase = IXP4XX_UART2_BASE_PHYS, 91 .mapbase = IXP4XX_UART2_BASE_PHYS,
92 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 92 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
93 .irq = IRQ_IXP4XX_UART1, 93 .irq = IRQ_IXP4XX_UART1,
94 .flags = UPF_BOOT_AUTOCONF, 94 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
95 .iotype = UPIO_MEM, 95 .iotype = UPIO_MEM,
96 .regshift = 2, 96 .regshift = 2,
97 .uartclk = IXP4XX_UART_XTAL, 97 .uartclk = IXP4XX_UART_XTAL,
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 1e7f343822d0..e9182242da95 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -30,6 +30,7 @@
30 * 28-Jun-2005 BJD Moved pm functionality out to common code 30 * 28-Jun-2005 BJD Moved pm functionality out to common code
31 * 17-Jul-2005 BJD Changed to platform device for SuperIO 16550s 31 * 17-Jul-2005 BJD Changed to platform device for SuperIO 16550s
32 * 25-Jul-2005 BJD Removed ASIX static mappings 32 * 25-Jul-2005 BJD Removed ASIX static mappings
33 * 27-Jul-2005 BJD Ensure maximum frequency of i2c bus
33*/ 34*/
34 35
35#include <linux/kernel.h> 36#include <linux/kernel.h>
@@ -60,6 +61,7 @@
60#include <asm/arch/regs-mem.h> 61#include <asm/arch/regs-mem.h>
61#include <asm/arch/regs-lcd.h> 62#include <asm/arch/regs-lcd.h>
62#include <asm/arch/nand.h> 63#include <asm/arch/nand.h>
64#include <asm/arch/iic.h>
63 65
64#include <linux/mtd/mtd.h> 66#include <linux/mtd/mtd.h>
65#include <linux/mtd/nand.h> 67#include <linux/mtd/nand.h>
@@ -304,7 +306,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
304} 306}
305 307
306static struct s3c2410_platform_nand bast_nand_info = { 308static struct s3c2410_platform_nand bast_nand_info = {
307 .tacls = 80, 309 .tacls = 40,
308 .twrph0 = 80, 310 .twrph0 = 80,
309 .twrph1 = 80, 311 .twrph1 = 80,
310 .nr_sets = ARRAY_SIZE(bast_nand_sets), 312 .nr_sets = ARRAY_SIZE(bast_nand_sets),
@@ -385,6 +387,17 @@ static struct platform_device bast_sio = {
385 }, 387 },
386}; 388};
387 389
390/* we have devices on the bus which cannot work much over the
391 * standard 100KHz i2c bus frequency
392*/
393
394static struct s3c2410_platform_i2c bast_i2c_info = {
395 .flags = 0,
396 .slave_addr = 0x10,
397 .bus_freq = 100*1000,
398 .max_freq = 130*1000,
399};
400
388/* Standard BAST devices */ 401/* Standard BAST devices */
389 402
390static struct platform_device *bast_devices[] __initdata = { 403static struct platform_device *bast_devices[] __initdata = {
@@ -431,6 +444,7 @@ void __init bast_map_io(void)
431 s3c24xx_uclk.parent = &s3c24xx_clkout1; 444 s3c24xx_uclk.parent = &s3c24xx_clkout1;
432 445
433 s3c_device_nand.dev.platform_data = &bast_nand_info; 446 s3c_device_nand.dev.platform_data = &bast_nand_info;
447 s3c_device_i2c.dev.platform_data = &bast_i2c_info;
434 448
435 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 449 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
436 s3c24xx_init_clocks(0); 450 s3c24xx_init_clocks(0);
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index eee3cbc5ec4f..2f497112c96a 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -97,6 +97,7 @@ static void __init jornada720_map_io(void)
97} 97}
98 98
99MACHINE_START(JORNADA720, "HP Jornada 720") 99MACHINE_START(JORNADA720, "HP Jornada 720")
100 /* Maintainer: Michael Gernoth <michael@gernoth.net> */
100 .phys_ram = 0xc0000000, 101 .phys_ram = 0xc0000000,
101 .phys_io = 0x80000000, 102 .phys_io = 0x80000000,
102 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 103 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 65bfe84b6d67..0b6c4db44e08 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -238,9 +238,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
238 up_read(&mm->mmap_sem); 238 up_read(&mm->mmap_sem);
239 239
240 /* 240 /*
241 * Handle the "normal" case first 241 * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
242 */ 242 */
243 if (fault > 0) 243 if (fault >= VM_FAULT_MINOR)
244 return 0; 244 return 0;
245 245
246 /* 246 /*
@@ -261,7 +261,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
261 do_exit(SIGKILL); 261 do_exit(SIGKILL);
262 return 0; 262 return 0;
263 263
264 case 0: 264 case VM_FAULT_SIGBUS:
265 /* 265 /*
266 * We had some memory, but were unable to 266 * We had some memory, but were unable to
267 * successfully fix up this page fault. 267 * successfully fix up this page fault.
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 2d977b4eeeab..b88de2700146 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -370,142 +370,6 @@ ENTRY(cpu_xscale_dcache_clean_area)
370 bhi 1b 370 bhi 1b
371 mov pc, lr 371 mov pc, lr
372 372
373/* ================================ CACHE LOCKING============================
374 *
375 * The XScale MicroArchitecture implements support for locking entries into
376 * the data and instruction cache. The following functions implement the core
377 * low level instructions needed to accomplish the locking. The developer's
378 * manual states that the code that performs the locking must be in non-cached
379 * memory. To accomplish this, the code in xscale-cache-lock.c copies the
380 * following functions from the cache into a non-cached memory region that
381 * is allocated through consistent_alloc().
382 *
383 */
384 .align 5
385/*
386 * xscale_icache_lock
387 *
388 * r0: starting address to lock
389 * r1: end address to lock
390 */
391ENTRY(xscale_icache_lock)
392
393iLockLoop:
394 bic r0, r0, #CACHELINESIZE - 1
395 mcr p15, 0, r0, c9, c1, 0 @ lock into cache
396 cmp r0, r1 @ are we done?
397 add r0, r0, #CACHELINESIZE @ advance to next cache line
398 bls iLockLoop
399 mov pc, lr
400
401/*
402 * xscale_icache_unlock
403 */
404ENTRY(xscale_icache_unlock)
405 mcr p15, 0, r0, c9, c1, 1 @ Unlock icache
406 mov pc, lr
407
408/*
409 * xscale_dcache_lock
410 *
411 * r0: starting address to lock
412 * r1: end address to lock
413 */
414ENTRY(xscale_dcache_lock)
415 mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
416 mov r2, #1
417 mcr p15, 0, r2, c9, c2, 0 @ Put dcache in lock mode
418 cpwait ip @ Wait for completion
419
420 mrs r2, cpsr
421 orr r3, r2, #PSR_F_BIT | PSR_I_BIT
422dLockLoop:
423 msr cpsr_c, r3
424 mcr p15, 0, r0, c7, c10, 1 @ Write back line if it is dirty
425 mcr p15, 0, r0, c7, c6, 1 @ Flush/invalidate line
426 msr cpsr_c, r2
427 ldr ip, [r0], #CACHELINESIZE @ Preload 32 bytes into cache from
428 @ location [r0]. Post-increment
429 @ r3 to next cache line
430 cmp r0, r1 @ Are we done?
431 bls dLockLoop
432
433 mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
434 mov r2, #0
435 mcr p15, 0, r2, c9, c2, 0 @ Get out of lock mode
436 cpwait_ret lr, ip
437
438/*
439 * xscale_dcache_unlock
440 */
441ENTRY(xscale_dcache_unlock)
442 mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
443 mcr p15, 0, ip, c9, c2, 1 @ Unlock cache
444 mov pc, lr
445
446/*
447 * Needed to determine the length of the code that needs to be copied.
448 */
449 .align 5
450ENTRY(xscale_cache_dummy)
451 mov pc, lr
452
453/* ================================ TLB LOCKING==============================
454 *
455 * The XScale MicroArchitecture implements support for locking entries into
456 * the Instruction and Data TLBs. The following functions provide the
457 * low level support for supporting these under Linux. xscale-lock.c
458 * implements some higher level management code. Most of the following
459 * is taken straight out of the Developer's Manual.
460 */
461
462/*
463 * Lock I-TLB entry
464 *
465 * r0: Virtual address to translate and lock
466 */
467 .align 5
468ENTRY(xscale_itlb_lock)
469 mrs r2, cpsr
470 orr r3, r2, #PSR_F_BIT | PSR_I_BIT
471 msr cpsr_c, r3 @ Disable interrupts
472 mcr p15, 0, r0, c8, c5, 1 @ Invalidate I-TLB entry
473 mcr p15, 0, r0, c10, c4, 0 @ Translate and lock
474 msr cpsr_c, r2 @ Restore interrupts
475 cpwait_ret lr, ip
476
477/*
478 * Lock D-TLB entry
479 *
480 * r0: Virtual address to translate and lock
481 */
482 .align 5
483ENTRY(xscale_dtlb_lock)
484 mrs r2, cpsr
485 orr r3, r2, #PSR_F_BIT | PSR_I_BIT
486 msr cpsr_c, r3 @ Disable interrupts
487 mcr p15, 0, r0, c8, c6, 1 @ Invalidate D-TLB entry
488 mcr p15, 0, r0, c10, c8, 0 @ Translate and lock
489 msr cpsr_c, r2 @ Restore interrupts
490 cpwait_ret lr, ip
491
492/*
493 * Unlock all I-TLB entries
494 */
495 .align 5
496ENTRY(xscale_itlb_unlock)
497 mcr p15, 0, ip, c10, c4, 1 @ Unlock I-TLB
498 mcr p15, 0, ip, c8, c5, 0 @ Invalidate I-TLB
499 cpwait_ret lr, ip
500
501/*
502 * Unlock all D-TLB entries
503 */
504ENTRY(xscale_dtlb_unlock)
505 mcr p15, 0, ip, c10, c8, 1 @ Unlock D-TBL
506 mcr p15, 0, ip, c8, c6, 0 @ Invalidate D-TLB
507 cpwait_ret lr, ip
508
509/* =============================== PageTable ============================== */ 373/* =============================== PageTable ============================== */
510 374
511#define PTE_CACHE_WRITE_ALLOCATE 0 375#define PTE_CACHE_WRITE_ALLOCATE 0
diff --git a/arch/arm/nwfpe/double_cpdo.c b/arch/arm/nwfpe/double_cpdo.c
index 7ffd8cb9bc96..c51d1386a97c 100644
--- a/arch/arm/nwfpe/double_cpdo.c
+++ b/arch/arm/nwfpe/double_cpdo.c
@@ -40,17 +40,17 @@ float64 float64_arccos(float64 rFm);
40float64 float64_pow(float64 rFn, float64 rFm); 40float64 float64_pow(float64 rFn, float64 rFm);
41float64 float64_pol(float64 rFn, float64 rFm); 41float64 float64_pol(float64 rFn, float64 rFm);
42 42
43static float64 float64_rsf(float64 rFn, float64 rFm) 43static float64 float64_rsf(struct roundingData *roundData, float64 rFn, float64 rFm)
44{ 44{
45 return float64_sub(rFm, rFn); 45 return float64_sub(roundData, rFm, rFn);
46} 46}
47 47
48static float64 float64_rdv(float64 rFn, float64 rFm) 48static float64 float64_rdv(struct roundingData *roundData, float64 rFn, float64 rFm)
49{ 49{
50 return float64_div(rFm, rFn); 50 return float64_div(roundData, rFm, rFn);
51} 51}
52 52
53static float64 (*const dyadic_double[16])(float64 rFn, float64 rFm) = { 53static float64 (*const dyadic_double[16])(struct roundingData*, float64 rFn, float64 rFm) = {
54 [ADF_CODE >> 20] = float64_add, 54 [ADF_CODE >> 20] = float64_add,
55 [MUF_CODE >> 20] = float64_mul, 55 [MUF_CODE >> 20] = float64_mul,
56 [SUF_CODE >> 20] = float64_sub, 56 [SUF_CODE >> 20] = float64_sub,
@@ -65,12 +65,12 @@ static float64 (*const dyadic_double[16])(float64 rFn, float64 rFm) = {
65 [FRD_CODE >> 20] = float64_rdv, 65 [FRD_CODE >> 20] = float64_rdv,
66}; 66};
67 67
68static float64 float64_mvf(float64 rFm) 68static float64 float64_mvf(struct roundingData *roundData,float64 rFm)
69{ 69{
70 return rFm; 70 return rFm;
71} 71}
72 72
73static float64 float64_mnf(float64 rFm) 73static float64 float64_mnf(struct roundingData *roundData,float64 rFm)
74{ 74{
75 union float64_components u; 75 union float64_components u;
76 76
@@ -84,7 +84,7 @@ static float64 float64_mnf(float64 rFm)
84 return u.f64; 84 return u.f64;
85} 85}
86 86
87static float64 float64_abs(float64 rFm) 87static float64 float64_abs(struct roundingData *roundData,float64 rFm)
88{ 88{
89 union float64_components u; 89 union float64_components u;
90 90
@@ -98,7 +98,7 @@ static float64 float64_abs(float64 rFm)
98 return u.f64; 98 return u.f64;
99} 99}
100 100
101static float64 (*const monadic_double[16])(float64 rFm) = { 101static float64 (*const monadic_double[16])(struct roundingData *, float64 rFm) = {
102 [MVF_CODE >> 20] = float64_mvf, 102 [MVF_CODE >> 20] = float64_mvf,
103 [MNF_CODE >> 20] = float64_mnf, 103 [MNF_CODE >> 20] = float64_mnf,
104 [ABS_CODE >> 20] = float64_abs, 104 [ABS_CODE >> 20] = float64_abs,
@@ -108,7 +108,7 @@ static float64 (*const monadic_double[16])(float64 rFm) = {
108 [NRM_CODE >> 20] = float64_mvf, 108 [NRM_CODE >> 20] = float64_mvf,
109}; 109};
110 110
111unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd) 111unsigned int DoubleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd)
112{ 112{
113 FPA11 *fpa11 = GET_FPA11(); 113 FPA11 *fpa11 = GET_FPA11();
114 float64 rFm; 114 float64 rFm;
@@ -151,13 +151,13 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd)
151 } 151 }
152 152
153 if (dyadic_double[opc_mask_shift]) { 153 if (dyadic_double[opc_mask_shift]) {
154 rFd->fDouble = dyadic_double[opc_mask_shift](rFn, rFm); 154 rFd->fDouble = dyadic_double[opc_mask_shift](roundData, rFn, rFm);
155 } else { 155 } else {
156 return 0; 156 return 0;
157 } 157 }
158 } else { 158 } else {
159 if (monadic_double[opc_mask_shift]) { 159 if (monadic_double[opc_mask_shift]) {
160 rFd->fDouble = monadic_double[opc_mask_shift](rFm); 160 rFd->fDouble = monadic_double[opc_mask_shift](roundData, rFm);
161 } else { 161 } else {
162 return 0; 162 return 0;
163 } 163 }
diff --git a/arch/arm/nwfpe/extended_cpdo.c b/arch/arm/nwfpe/extended_cpdo.c
index c39f68a3449e..65a279ba927f 100644
--- a/arch/arm/nwfpe/extended_cpdo.c
+++ b/arch/arm/nwfpe/extended_cpdo.c
@@ -35,17 +35,17 @@ floatx80 floatx80_arccos(floatx80 rFm);
35floatx80 floatx80_pow(floatx80 rFn, floatx80 rFm); 35floatx80 floatx80_pow(floatx80 rFn, floatx80 rFm);
36floatx80 floatx80_pol(floatx80 rFn, floatx80 rFm); 36floatx80 floatx80_pol(floatx80 rFn, floatx80 rFm);
37 37
38static floatx80 floatx80_rsf(floatx80 rFn, floatx80 rFm) 38static floatx80 floatx80_rsf(struct roundingData *roundData, floatx80 rFn, floatx80 rFm)
39{ 39{
40 return floatx80_sub(rFm, rFn); 40 return floatx80_sub(roundData, rFm, rFn);
41} 41}
42 42
43static floatx80 floatx80_rdv(floatx80 rFn, floatx80 rFm) 43static floatx80 floatx80_rdv(struct roundingData *roundData, floatx80 rFn, floatx80 rFm)
44{ 44{
45 return floatx80_div(rFm, rFn); 45 return floatx80_div(roundData, rFm, rFn);
46} 46}
47 47
48static floatx80 (*const dyadic_extended[16])(floatx80 rFn, floatx80 rFm) = { 48static floatx80 (*const dyadic_extended[16])(struct roundingData*, floatx80 rFn, floatx80 rFm) = {
49 [ADF_CODE >> 20] = floatx80_add, 49 [ADF_CODE >> 20] = floatx80_add,
50 [MUF_CODE >> 20] = floatx80_mul, 50 [MUF_CODE >> 20] = floatx80_mul,
51 [SUF_CODE >> 20] = floatx80_sub, 51 [SUF_CODE >> 20] = floatx80_sub,
@@ -60,24 +60,24 @@ static floatx80 (*const dyadic_extended[16])(floatx80 rFn, floatx80 rFm) = {
60 [FRD_CODE >> 20] = floatx80_rdv, 60 [FRD_CODE >> 20] = floatx80_rdv,
61}; 61};
62 62
63static floatx80 floatx80_mvf(floatx80 rFm) 63static floatx80 floatx80_mvf(struct roundingData *roundData, floatx80 rFm)
64{ 64{
65 return rFm; 65 return rFm;
66} 66}
67 67
68static floatx80 floatx80_mnf(floatx80 rFm) 68static floatx80 floatx80_mnf(struct roundingData *roundData, floatx80 rFm)
69{ 69{
70 rFm.high ^= 0x8000; 70 rFm.high ^= 0x8000;
71 return rFm; 71 return rFm;
72} 72}
73 73
74static floatx80 floatx80_abs(floatx80 rFm) 74static floatx80 floatx80_abs(struct roundingData *roundData, floatx80 rFm)
75{ 75{
76 rFm.high &= 0x7fff; 76 rFm.high &= 0x7fff;
77 return rFm; 77 return rFm;
78} 78}
79 79
80static floatx80 (*const monadic_extended[16])(floatx80 rFm) = { 80static floatx80 (*const monadic_extended[16])(struct roundingData*, floatx80 rFm) = {
81 [MVF_CODE >> 20] = floatx80_mvf, 81 [MVF_CODE >> 20] = floatx80_mvf,
82 [MNF_CODE >> 20] = floatx80_mnf, 82 [MNF_CODE >> 20] = floatx80_mnf,
83 [ABS_CODE >> 20] = floatx80_abs, 83 [ABS_CODE >> 20] = floatx80_abs,
@@ -87,7 +87,7 @@ static floatx80 (*const monadic_extended[16])(floatx80 rFm) = {
87 [NRM_CODE >> 20] = floatx80_mvf, 87 [NRM_CODE >> 20] = floatx80_mvf,
88}; 88};
89 89
90unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd) 90unsigned int ExtendedCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd)
91{ 91{
92 FPA11 *fpa11 = GET_FPA11(); 92 FPA11 *fpa11 = GET_FPA11();
93 floatx80 rFm; 93 floatx80 rFm;
@@ -138,13 +138,13 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd)
138 } 138 }
139 139
140 if (dyadic_extended[opc_mask_shift]) { 140 if (dyadic_extended[opc_mask_shift]) {
141 rFd->fExtended = dyadic_extended[opc_mask_shift](rFn, rFm); 141 rFd->fExtended = dyadic_extended[opc_mask_shift](roundData, rFn, rFm);
142 } else { 142 } else {
143 return 0; 143 return 0;
144 } 144 }
145 } else { 145 } else {
146 if (monadic_extended[opc_mask_shift]) { 146 if (monadic_extended[opc_mask_shift]) {
147 rFd->fExtended = monadic_extended[opc_mask_shift](rFm); 147 rFd->fExtended = monadic_extended[opc_mask_shift](roundData, rFm);
148 } else { 148 } else {
149 return 0; 149 return 0;
150 } 150 }
diff --git a/arch/arm/nwfpe/fpa11.c b/arch/arm/nwfpe/fpa11.c
index bf61696865ec..7690f731ee87 100644
--- a/arch/arm/nwfpe/fpa11.c
+++ b/arch/arm/nwfpe/fpa11.c
@@ -51,48 +51,42 @@ static void resetFPA11(void)
51 fpa11->fpsr = FP_EMULATOR | BIT_AC; 51 fpa11->fpsr = FP_EMULATOR | BIT_AC;
52} 52}
53 53
54void SetRoundingMode(const unsigned int opcode) 54int8 SetRoundingMode(const unsigned int opcode)
55{ 55{
56 switch (opcode & MASK_ROUNDING_MODE) { 56 switch (opcode & MASK_ROUNDING_MODE) {
57 default: 57 default:
58 case ROUND_TO_NEAREST: 58 case ROUND_TO_NEAREST:
59 float_rounding_mode = float_round_nearest_even; 59 return float_round_nearest_even;
60 break;
61 60
62 case ROUND_TO_PLUS_INFINITY: 61 case ROUND_TO_PLUS_INFINITY:
63 float_rounding_mode = float_round_up; 62 return float_round_up;
64 break;
65 63
66 case ROUND_TO_MINUS_INFINITY: 64 case ROUND_TO_MINUS_INFINITY:
67 float_rounding_mode = float_round_down; 65 return float_round_down;
68 break;
69 66
70 case ROUND_TO_ZERO: 67 case ROUND_TO_ZERO:
71 float_rounding_mode = float_round_to_zero; 68 return float_round_to_zero;
72 break;
73 } 69 }
74} 70}
75 71
76void SetRoundingPrecision(const unsigned int opcode) 72int8 SetRoundingPrecision(const unsigned int opcode)
77{ 73{
78#ifdef CONFIG_FPE_NWFPE_XP 74#ifdef CONFIG_FPE_NWFPE_XP
79 switch (opcode & MASK_ROUNDING_PRECISION) { 75 switch (opcode & MASK_ROUNDING_PRECISION) {
80 case ROUND_SINGLE: 76 case ROUND_SINGLE:
81 floatx80_rounding_precision = 32; 77 return 32;
82 break;
83 78
84 case ROUND_DOUBLE: 79 case ROUND_DOUBLE:
85 floatx80_rounding_precision = 64; 80 return 64;
86 break;
87 81
88 case ROUND_EXTENDED: 82 case ROUND_EXTENDED:
89 floatx80_rounding_precision = 80; 83 return 80;
90 break;
91 84
92 default: 85 default:
93 floatx80_rounding_precision = 80; 86 return 80;
94 } 87 }
95#endif 88#endif
89 return 80;
96} 90}
97 91
98void nwfpe_init_fpa(union fp_state *fp) 92void nwfpe_init_fpa(union fp_state *fp)
@@ -103,8 +97,6 @@ void nwfpe_init_fpa(union fp_state *fp)
103#endif 97#endif
104 memset(fpa11, 0, sizeof(FPA11)); 98 memset(fpa11, 0, sizeof(FPA11));
105 resetFPA11(); 99 resetFPA11();
106 SetRoundingMode(ROUND_TO_NEAREST);
107 SetRoundingPrecision(ROUND_EXTENDED);
108 fpa11->initflag = 1; 100 fpa11->initflag = 1;
109} 101}
110 102
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h
index e4a61aea534b..93523ae4b7a1 100644
--- a/arch/arm/nwfpe/fpa11.h
+++ b/arch/arm/nwfpe/fpa11.h
@@ -37,6 +37,13 @@
37/* includes */ 37/* includes */
38#include "fpsr.h" /* FP control and status register definitions */ 38#include "fpsr.h" /* FP control and status register definitions */
39#include "milieu.h" 39#include "milieu.h"
40
41struct roundingData {
42 int8 mode;
43 int8 precision;
44 signed char exception;
45};
46
40#include "softfloat.h" 47#include "softfloat.h"
41 48
42#define typeNone 0x00 49#define typeNone 0x00
@@ -84,8 +91,8 @@ typedef struct tagFPA11 {
84 initialised. */ 91 initialised. */
85} FPA11; 92} FPA11;
86 93
87extern void SetRoundingMode(const unsigned int); 94extern int8 SetRoundingMode(const unsigned int);
88extern void SetRoundingPrecision(const unsigned int); 95extern int8 SetRoundingPrecision(const unsigned int);
89extern void nwfpe_init_fpa(union fp_state *fp); 96extern void nwfpe_init_fpa(union fp_state *fp);
90 97
91#endif 98#endif
diff --git a/arch/arm/nwfpe/fpa11_cpdo.c b/arch/arm/nwfpe/fpa11_cpdo.c
index 1bea67437b6f..4a31dfd94068 100644
--- a/arch/arm/nwfpe/fpa11_cpdo.c
+++ b/arch/arm/nwfpe/fpa11_cpdo.c
@@ -24,15 +24,16 @@
24#include "fpa11.h" 24#include "fpa11.h"
25#include "fpopcode.h" 25#include "fpopcode.h"
26 26
27unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd); 27unsigned int SingleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd);
28unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd); 28unsigned int DoubleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd);
29unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd); 29unsigned int ExtendedCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd);
30 30
31unsigned int EmulateCPDO(const unsigned int opcode) 31unsigned int EmulateCPDO(const unsigned int opcode)
32{ 32{
33 FPA11 *fpa11 = GET_FPA11(); 33 FPA11 *fpa11 = GET_FPA11();
34 FPREG *rFd; 34 FPREG *rFd;
35 unsigned int nType, nDest, nRc; 35 unsigned int nType, nDest, nRc;
36 struct roundingData roundData;
36 37
37 /* Get the destination size. If not valid let Linux perform 38 /* Get the destination size. If not valid let Linux perform
38 an invalid instruction trap. */ 39 an invalid instruction trap. */
@@ -40,7 +41,9 @@ unsigned int EmulateCPDO(const unsigned int opcode)
40 if (typeNone == nDest) 41 if (typeNone == nDest)
41 return 0; 42 return 0;
42 43
43 SetRoundingMode(opcode); 44 roundData.mode = SetRoundingMode(opcode);
45 roundData.precision = SetRoundingPrecision(opcode);
46 roundData.exception = 0;
44 47
45 /* Compare the size of the operands in Fn and Fm. 48 /* Compare the size of the operands in Fn and Fm.
46 Choose the largest size and perform operations in that size, 49 Choose the largest size and perform operations in that size,
@@ -63,14 +66,14 @@ unsigned int EmulateCPDO(const unsigned int opcode)
63 66
64 switch (nType) { 67 switch (nType) {
65 case typeSingle: 68 case typeSingle:
66 nRc = SingleCPDO(opcode, rFd); 69 nRc = SingleCPDO(&roundData, opcode, rFd);
67 break; 70 break;
68 case typeDouble: 71 case typeDouble:
69 nRc = DoubleCPDO(opcode, rFd); 72 nRc = DoubleCPDO(&roundData, opcode, rFd);
70 break; 73 break;
71#ifdef CONFIG_FPE_NWFPE_XP 74#ifdef CONFIG_FPE_NWFPE_XP
72 case typeExtended: 75 case typeExtended:
73 nRc = ExtendedCPDO(opcode, rFd); 76 nRc = ExtendedCPDO(&roundData, opcode, rFd);
74 break; 77 break;
75#endif 78#endif
76 default: 79 default:
@@ -93,9 +96,9 @@ unsigned int EmulateCPDO(const unsigned int opcode)
93 case typeSingle: 96 case typeSingle:
94 { 97 {
95 if (typeDouble == nType) 98 if (typeDouble == nType)
96 rFd->fSingle = float64_to_float32(rFd->fDouble); 99 rFd->fSingle = float64_to_float32(&roundData, rFd->fDouble);
97 else 100 else
98 rFd->fSingle = floatx80_to_float32(rFd->fExtended); 101 rFd->fSingle = floatx80_to_float32(&roundData, rFd->fExtended);
99 } 102 }
100 break; 103 break;
101 104
@@ -104,7 +107,7 @@ unsigned int EmulateCPDO(const unsigned int opcode)
104 if (typeSingle == nType) 107 if (typeSingle == nType)
105 rFd->fDouble = float32_to_float64(rFd->fSingle); 108 rFd->fDouble = float32_to_float64(rFd->fSingle);
106 else 109 else
107 rFd->fDouble = floatx80_to_float64(rFd->fExtended); 110 rFd->fDouble = floatx80_to_float64(&roundData, rFd->fExtended);
108 } 111 }
109 break; 112 break;
110 113
@@ -121,12 +124,15 @@ unsigned int EmulateCPDO(const unsigned int opcode)
121#else 124#else
122 if (nDest != nType) { 125 if (nDest != nType) {
123 if (nDest == typeSingle) 126 if (nDest == typeSingle)
124 rFd->fSingle = float64_to_float32(rFd->fDouble); 127 rFd->fSingle = float64_to_float32(&roundData, rFd->fDouble);
125 else 128 else
126 rFd->fDouble = float32_to_float64(rFd->fSingle); 129 rFd->fDouble = float32_to_float64(rFd->fSingle);
127 } 130 }
128#endif 131#endif
129 } 132 }
130 133
134 if (roundData.exception)
135 float_raise(roundData.exception);
136
131 return nRc; 137 return nRc;
132} 138}
diff --git a/arch/arm/nwfpe/fpa11_cpdt.c b/arch/arm/nwfpe/fpa11_cpdt.c
index 95fb63fa9d18..b0db5cbcc3b1 100644
--- a/arch/arm/nwfpe/fpa11_cpdt.c
+++ b/arch/arm/nwfpe/fpa11_cpdt.c
@@ -96,7 +96,7 @@ static inline void loadMultiple(const unsigned int Fn, const unsigned int __user
96 } 96 }
97} 97}
98 98
99static inline void storeSingle(const unsigned int Fn, unsigned int __user *pMem) 99static inline void storeSingle(struct roundingData *roundData, const unsigned int Fn, unsigned int __user *pMem)
100{ 100{
101 FPA11 *fpa11 = GET_FPA11(); 101 FPA11 *fpa11 = GET_FPA11();
102 union { 102 union {
@@ -106,12 +106,12 @@ static inline void storeSingle(const unsigned int Fn, unsigned int __user *pMem)
106 106
107 switch (fpa11->fType[Fn]) { 107 switch (fpa11->fType[Fn]) {
108 case typeDouble: 108 case typeDouble:
109 val.f = float64_to_float32(fpa11->fpreg[Fn].fDouble); 109 val.f = float64_to_float32(roundData, fpa11->fpreg[Fn].fDouble);
110 break; 110 break;
111 111
112#ifdef CONFIG_FPE_NWFPE_XP 112#ifdef CONFIG_FPE_NWFPE_XP
113 case typeExtended: 113 case typeExtended:
114 val.f = floatx80_to_float32(fpa11->fpreg[Fn].fExtended); 114 val.f = floatx80_to_float32(roundData, fpa11->fpreg[Fn].fExtended);
115 break; 115 break;
116#endif 116#endif
117 117
@@ -122,7 +122,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int __user *pMem)
122 put_user(val.i[0], pMem); 122 put_user(val.i[0], pMem);
123} 123}
124 124
125static inline void storeDouble(const unsigned int Fn, unsigned int __user *pMem) 125static inline void storeDouble(struct roundingData *roundData, const unsigned int Fn, unsigned int __user *pMem)
126{ 126{
127 FPA11 *fpa11 = GET_FPA11(); 127 FPA11 *fpa11 = GET_FPA11();
128 union { 128 union {
@@ -137,7 +137,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int __user *pMem)
137 137
138#ifdef CONFIG_FPE_NWFPE_XP 138#ifdef CONFIG_FPE_NWFPE_XP
139 case typeExtended: 139 case typeExtended:
140 val.f = floatx80_to_float64(fpa11->fpreg[Fn].fExtended); 140 val.f = floatx80_to_float64(roundData, fpa11->fpreg[Fn].fExtended);
141 break; 141 break;
142#endif 142#endif
143 143
@@ -259,8 +259,11 @@ unsigned int PerformSTF(const unsigned int opcode)
259{ 259{
260 unsigned int __user *pBase, *pAddress, *pFinal; 260 unsigned int __user *pBase, *pAddress, *pFinal;
261 unsigned int nRc = 1, write_back = WRITE_BACK(opcode); 261 unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
262 struct roundingData roundData;
262 263
263 SetRoundingMode(ROUND_TO_NEAREST); 264 roundData.mode = SetRoundingMode(opcode);
265 roundData.precision = SetRoundingPrecision(opcode);
266 roundData.exception = 0;
264 267
265 pBase = (unsigned int __user *) readRegister(getRn(opcode)); 268 pBase = (unsigned int __user *) readRegister(getRn(opcode));
266 if (REG_PC == getRn(opcode)) { 269 if (REG_PC == getRn(opcode)) {
@@ -281,10 +284,10 @@ unsigned int PerformSTF(const unsigned int opcode)
281 284
282 switch (opcode & MASK_TRANSFER_LENGTH) { 285 switch (opcode & MASK_TRANSFER_LENGTH) {
283 case TRANSFER_SINGLE: 286 case TRANSFER_SINGLE:
284 storeSingle(getFd(opcode), pAddress); 287 storeSingle(&roundData, getFd(opcode), pAddress);
285 break; 288 break;
286 case TRANSFER_DOUBLE: 289 case TRANSFER_DOUBLE:
287 storeDouble(getFd(opcode), pAddress); 290 storeDouble(&roundData, getFd(opcode), pAddress);
288 break; 291 break;
289#ifdef CONFIG_FPE_NWFPE_XP 292#ifdef CONFIG_FPE_NWFPE_XP
290 case TRANSFER_EXTENDED: 293 case TRANSFER_EXTENDED:
@@ -295,6 +298,9 @@ unsigned int PerformSTF(const unsigned int opcode)
295 nRc = 0; 298 nRc = 0;
296 } 299 }
297 300
301 if (roundData.exception)
302 float_raise(roundData.exception);
303
298 if (write_back) 304 if (write_back)
299 writeRegister(getRn(opcode), (unsigned long) pFinal); 305 writeRegister(getRn(opcode), (unsigned long) pFinal);
300 return nRc; 306 return nRc;
diff --git a/arch/arm/nwfpe/fpa11_cprt.c b/arch/arm/nwfpe/fpa11_cprt.c
index db01fbc97216..adf8d3000540 100644
--- a/arch/arm/nwfpe/fpa11_cprt.c
+++ b/arch/arm/nwfpe/fpa11_cprt.c
@@ -33,8 +33,6 @@ extern flag floatx80_is_nan(floatx80);
33extern flag float64_is_nan(float64); 33extern flag float64_is_nan(float64);
34extern flag float32_is_nan(float32); 34extern flag float32_is_nan(float32);
35 35
36void SetRoundingMode(const unsigned int opcode);
37
38unsigned int PerformFLT(const unsigned int opcode); 36unsigned int PerformFLT(const unsigned int opcode);
39unsigned int PerformFIX(const unsigned int opcode); 37unsigned int PerformFIX(const unsigned int opcode);
40 38
@@ -77,14 +75,17 @@ unsigned int EmulateCPRT(const unsigned int opcode)
77unsigned int PerformFLT(const unsigned int opcode) 75unsigned int PerformFLT(const unsigned int opcode)
78{ 76{
79 FPA11 *fpa11 = GET_FPA11(); 77 FPA11 *fpa11 = GET_FPA11();
80 SetRoundingMode(opcode); 78 struct roundingData roundData;
81 SetRoundingPrecision(opcode); 79
80 roundData.mode = SetRoundingMode(opcode);
81 roundData.precision = SetRoundingPrecision(opcode);
82 roundData.exception = 0;
82 83
83 switch (opcode & MASK_ROUNDING_PRECISION) { 84 switch (opcode & MASK_ROUNDING_PRECISION) {
84 case ROUND_SINGLE: 85 case ROUND_SINGLE:
85 { 86 {
86 fpa11->fType[getFn(opcode)] = typeSingle; 87 fpa11->fType[getFn(opcode)] = typeSingle;
87 fpa11->fpreg[getFn(opcode)].fSingle = int32_to_float32(readRegister(getRd(opcode))); 88 fpa11->fpreg[getFn(opcode)].fSingle = int32_to_float32(&roundData, readRegister(getRd(opcode)));
88 } 89 }
89 break; 90 break;
90 91
@@ -108,6 +109,9 @@ unsigned int PerformFLT(const unsigned int opcode)
108 return 0; 109 return 0;
109 } 110 }
110 111
112 if (roundData.exception)
113 float_raise(roundData.exception);
114
111 return 1; 115 return 1;
112} 116}
113 117
@@ -115,26 +119,29 @@ unsigned int PerformFIX(const unsigned int opcode)
115{ 119{
116 FPA11 *fpa11 = GET_FPA11(); 120 FPA11 *fpa11 = GET_FPA11();
117 unsigned int Fn = getFm(opcode); 121 unsigned int Fn = getFm(opcode);
122 struct roundingData roundData;
118 123
119 SetRoundingMode(opcode); 124 roundData.mode = SetRoundingMode(opcode);
125 roundData.precision = SetRoundingPrecision(opcode);
126 roundData.exception = 0;
120 127
121 switch (fpa11->fType[Fn]) { 128 switch (fpa11->fType[Fn]) {
122 case typeSingle: 129 case typeSingle:
123 { 130 {
124 writeRegister(getRd(opcode), float32_to_int32(fpa11->fpreg[Fn].fSingle)); 131 writeRegister(getRd(opcode), float32_to_int32(&roundData, fpa11->fpreg[Fn].fSingle));
125 } 132 }
126 break; 133 break;
127 134
128 case typeDouble: 135 case typeDouble:
129 { 136 {
130 writeRegister(getRd(opcode), float64_to_int32(fpa11->fpreg[Fn].fDouble)); 137 writeRegister(getRd(opcode), float64_to_int32(&roundData, fpa11->fpreg[Fn].fDouble));
131 } 138 }
132 break; 139 break;
133 140
134#ifdef CONFIG_FPE_NWFPE_XP 141#ifdef CONFIG_FPE_NWFPE_XP
135 case typeExtended: 142 case typeExtended:
136 { 143 {
137 writeRegister(getRd(opcode), floatx80_to_int32(fpa11->fpreg[Fn].fExtended)); 144 writeRegister(getRd(opcode), floatx80_to_int32(&roundData, fpa11->fpreg[Fn].fExtended));
138 } 145 }
139 break; 146 break;
140#endif 147#endif
@@ -143,6 +150,9 @@ unsigned int PerformFIX(const unsigned int opcode)
143 return 0; 150 return 0;
144 } 151 }
145 152
153 if (roundData.exception)
154 float_raise(roundData.exception);
155
146 return 1; 156 return 1;
147} 157}
148 158
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index 12885f31d347..2dfe1ac42ee8 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -116,8 +116,6 @@ fpmodule.c to integrate with the NetBSD kernel (I hope!).
116code to access data in user space in some other source files at the 116code to access data in user space in some other source files at the
117moment (grep for get_user / put_user calls). --philb] 117moment (grep for get_user / put_user calls). --philb]
118 118
119float_exception_flags is a global variable in SoftFloat.
120
121This function is called by the SoftFloat routines to raise a floating 119This function is called by the SoftFloat routines to raise a floating
122point exception. We check the trap enable byte in the FPSR, and raise 120point exception. We check the trap enable byte in the FPSR, and raise
123a SIGFPE exception if necessary. If not the relevant bits in the 121a SIGFPE exception if necessary. If not the relevant bits in the
@@ -129,15 +127,14 @@ void float_raise(signed char flags)
129 register unsigned int fpsr, cumulativeTraps; 127 register unsigned int fpsr, cumulativeTraps;
130 128
131#ifdef CONFIG_DEBUG_USER 129#ifdef CONFIG_DEBUG_USER
132 printk(KERN_DEBUG 130 /* Ignore inexact errors as there are far too many of them to log */
133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n", 131 if (flags & ~BIT_IXC)
134 current->comm, current->pid, flags, 132 printk(KERN_DEBUG
135 __builtin_return_address(0), GET_USERREG()->ARM_pc); 133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
134 current->comm, current->pid, flags,
135 __builtin_return_address(0), GET_USERREG()->ARM_pc);
136#endif 136#endif
137 137
138 /* Keep SoftFloat exception flags up to date. */
139 float_exception_flags |= flags;
140
141 /* Read fpsr and initialize the cumulativeTraps. */ 138 /* Read fpsr and initialize the cumulativeTraps. */
142 fpsr = readFPSR(); 139 fpsr = readFPSR();
143 cumulativeTraps = 0; 140 cumulativeTraps = 0;
diff --git a/arch/arm/nwfpe/single_cpdo.c b/arch/arm/nwfpe/single_cpdo.c
index 705808e88d9d..c66981d682cf 100644
--- a/arch/arm/nwfpe/single_cpdo.c
+++ b/arch/arm/nwfpe/single_cpdo.c
@@ -36,17 +36,17 @@ float32 float32_arccos(float32 rFm);
36float32 float32_pow(float32 rFn, float32 rFm); 36float32 float32_pow(float32 rFn, float32 rFm);
37float32 float32_pol(float32 rFn, float32 rFm); 37float32 float32_pol(float32 rFn, float32 rFm);
38 38
39static float32 float32_rsf(float32 rFn, float32 rFm) 39static float32 float32_rsf(struct roundingData *roundData, float32 rFn, float32 rFm)
40{ 40{
41 return float32_sub(rFm, rFn); 41 return float32_sub(roundData, rFm, rFn);
42} 42}
43 43
44static float32 float32_rdv(float32 rFn, float32 rFm) 44static float32 float32_rdv(struct roundingData *roundData, float32 rFn, float32 rFm)
45{ 45{
46 return float32_div(rFm, rFn); 46 return float32_div(roundData, rFm, rFn);
47} 47}
48 48
49static float32 (*const dyadic_single[16])(float32 rFn, float32 rFm) = { 49static float32 (*const dyadic_single[16])(struct roundingData *, float32 rFn, float32 rFm) = {
50 [ADF_CODE >> 20] = float32_add, 50 [ADF_CODE >> 20] = float32_add,
51 [MUF_CODE >> 20] = float32_mul, 51 [MUF_CODE >> 20] = float32_mul,
52 [SUF_CODE >> 20] = float32_sub, 52 [SUF_CODE >> 20] = float32_sub,
@@ -60,22 +60,22 @@ static float32 (*const dyadic_single[16])(float32 rFn, float32 rFm) = {
60 [FRD_CODE >> 20] = float32_rdv, 60 [FRD_CODE >> 20] = float32_rdv,
61}; 61};
62 62
63static float32 float32_mvf(float32 rFm) 63static float32 float32_mvf(struct roundingData *roundData, float32 rFm)
64{ 64{
65 return rFm; 65 return rFm;
66} 66}
67 67
68static float32 float32_mnf(float32 rFm) 68static float32 float32_mnf(struct roundingData *roundData, float32 rFm)
69{ 69{
70 return rFm ^ 0x80000000; 70 return rFm ^ 0x80000000;
71} 71}
72 72
73static float32 float32_abs(float32 rFm) 73static float32 float32_abs(struct roundingData *roundData, float32 rFm)
74{ 74{
75 return rFm & 0x7fffffff; 75 return rFm & 0x7fffffff;
76} 76}
77 77
78static float32 (*const monadic_single[16])(float32 rFm) = { 78static float32 (*const monadic_single[16])(struct roundingData*, float32 rFm) = {
79 [MVF_CODE >> 20] = float32_mvf, 79 [MVF_CODE >> 20] = float32_mvf,
80 [MNF_CODE >> 20] = float32_mnf, 80 [MNF_CODE >> 20] = float32_mnf,
81 [ABS_CODE >> 20] = float32_abs, 81 [ABS_CODE >> 20] = float32_abs,
@@ -85,7 +85,7 @@ static float32 (*const monadic_single[16])(float32 rFm) = {
85 [NRM_CODE >> 20] = float32_mvf, 85 [NRM_CODE >> 20] = float32_mvf,
86}; 86};
87 87
88unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd) 88unsigned int SingleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd)
89{ 89{
90 FPA11 *fpa11 = GET_FPA11(); 90 FPA11 *fpa11 = GET_FPA11();
91 float32 rFm; 91 float32 rFm;
@@ -108,13 +108,13 @@ unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd)
108 if (fpa11->fType[Fn] == typeSingle && 108 if (fpa11->fType[Fn] == typeSingle &&
109 dyadic_single[opc_mask_shift]) { 109 dyadic_single[opc_mask_shift]) {
110 rFn = fpa11->fpreg[Fn].fSingle; 110 rFn = fpa11->fpreg[Fn].fSingle;
111 rFd->fSingle = dyadic_single[opc_mask_shift](rFn, rFm); 111 rFd->fSingle = dyadic_single[opc_mask_shift](roundData, rFn, rFm);
112 } else { 112 } else {
113 return 0; 113 return 0;
114 } 114 }
115 } else { 115 } else {
116 if (monadic_single[opc_mask_shift]) { 116 if (monadic_single[opc_mask_shift]) {
117 rFd->fSingle = monadic_single[opc_mask_shift](rFm); 117 rFd->fSingle = monadic_single[opc_mask_shift](roundData, rFm);
118 } else { 118 } else {
119 return 0; 119 return 0;
120 } 120 }
diff --git a/arch/arm/nwfpe/softfloat.c b/arch/arm/nwfpe/softfloat.c
index e038dd3be9b3..8b75a6e7cb3a 100644
--- a/arch/arm/nwfpe/softfloat.c
+++ b/arch/arm/nwfpe/softfloat.c
@@ -36,16 +36,6 @@ this code that are retained.
36 36
37/* 37/*
38------------------------------------------------------------------------------- 38-------------------------------------------------------------------------------
39Floating-point rounding mode, extended double-precision rounding precision,
40and exception flags.
41-------------------------------------------------------------------------------
42*/
43int8 float_rounding_mode = float_round_nearest_even;
44int8 floatx80_rounding_precision = 80;
45int8 float_exception_flags;
46
47/*
48-------------------------------------------------------------------------------
49Primitive arithmetic functions, including multi-word arithmetic, and 39Primitive arithmetic functions, including multi-word arithmetic, and
50division and square root approximations. (Can be specialized to target if 40division and square root approximations. (Can be specialized to target if
51desired.) 41desired.)
@@ -77,14 +67,14 @@ input is too large, however, the invalid exception is raised and the largest
77positive or negative integer is returned. 67positive or negative integer is returned.
78------------------------------------------------------------------------------- 68-------------------------------------------------------------------------------
79*/ 69*/
80static int32 roundAndPackInt32( flag zSign, bits64 absZ ) 70static int32 roundAndPackInt32( struct roundingData *roundData, flag zSign, bits64 absZ )
81{ 71{
82 int8 roundingMode; 72 int8 roundingMode;
83 flag roundNearestEven; 73 flag roundNearestEven;
84 int8 roundIncrement, roundBits; 74 int8 roundIncrement, roundBits;
85 int32 z; 75 int32 z;
86 76
87 roundingMode = float_rounding_mode; 77 roundingMode = roundData->mode;
88 roundNearestEven = ( roundingMode == float_round_nearest_even ); 78 roundNearestEven = ( roundingMode == float_round_nearest_even );
89 roundIncrement = 0x40; 79 roundIncrement = 0x40;
90 if ( ! roundNearestEven ) { 80 if ( ! roundNearestEven ) {
@@ -107,10 +97,10 @@ static int32 roundAndPackInt32( flag zSign, bits64 absZ )
107 z = absZ; 97 z = absZ;
108 if ( zSign ) z = - z; 98 if ( zSign ) z = - z;
109 if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) { 99 if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
110 float_exception_flags |= float_flag_invalid; 100 roundData->exception |= float_flag_invalid;
111 return zSign ? 0x80000000 : 0x7FFFFFFF; 101 return zSign ? 0x80000000 : 0x7FFFFFFF;
112 } 102 }
113 if ( roundBits ) float_exception_flags |= float_flag_inexact; 103 if ( roundBits ) roundData->exception |= float_flag_inexact;
114 return z; 104 return z;
115 105
116} 106}
@@ -224,14 +214,14 @@ The handling of underflow and overflow follows the IEC/IEEE Standard for
224Binary Floating-point Arithmetic. 214Binary Floating-point Arithmetic.
225------------------------------------------------------------------------------- 215-------------------------------------------------------------------------------
226*/ 216*/
227static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig ) 217static float32 roundAndPackFloat32( struct roundingData *roundData, flag zSign, int16 zExp, bits32 zSig )
228{ 218{
229 int8 roundingMode; 219 int8 roundingMode;
230 flag roundNearestEven; 220 flag roundNearestEven;
231 int8 roundIncrement, roundBits; 221 int8 roundIncrement, roundBits;
232 flag isTiny; 222 flag isTiny;
233 223
234 roundingMode = float_rounding_mode; 224 roundingMode = roundData->mode;
235 roundNearestEven = ( roundingMode == float_round_nearest_even ); 225 roundNearestEven = ( roundingMode == float_round_nearest_even );
236 roundIncrement = 0x40; 226 roundIncrement = 0x40;
237 if ( ! roundNearestEven ) { 227 if ( ! roundNearestEven ) {
@@ -254,7 +244,7 @@ static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
254 || ( ( zExp == 0xFD ) 244 || ( ( zExp == 0xFD )
255 && ( (sbits32) ( zSig + roundIncrement ) < 0 ) ) 245 && ( (sbits32) ( zSig + roundIncrement ) < 0 ) )
256 ) { 246 ) {
257 float_raise( float_flag_overflow | float_flag_inexact ); 247 roundData->exception |= float_flag_overflow | float_flag_inexact;
258 return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 ); 248 return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 );
259 } 249 }
260 if ( zExp < 0 ) { 250 if ( zExp < 0 ) {
@@ -265,10 +255,10 @@ static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
265 shift32RightJamming( zSig, - zExp, &zSig ); 255 shift32RightJamming( zSig, - zExp, &zSig );
266 zExp = 0; 256 zExp = 0;
267 roundBits = zSig & 0x7F; 257 roundBits = zSig & 0x7F;
268 if ( isTiny && roundBits ) float_raise( float_flag_underflow ); 258 if ( isTiny && roundBits ) roundData->exception |= float_flag_underflow;
269 } 259 }
270 } 260 }
271 if ( roundBits ) float_exception_flags |= float_flag_inexact; 261 if ( roundBits ) roundData->exception |= float_flag_inexact;
272 zSig = ( zSig + roundIncrement )>>7; 262 zSig = ( zSig + roundIncrement )>>7;
273 zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); 263 zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
274 if ( zSig == 0 ) zExp = 0; 264 if ( zSig == 0 ) zExp = 0;
@@ -287,12 +277,12 @@ point exponent.
287------------------------------------------------------------------------------- 277-------------------------------------------------------------------------------
288*/ 278*/
289static float32 279static float32
290 normalizeRoundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig ) 280 normalizeRoundAndPackFloat32( struct roundingData *roundData, flag zSign, int16 zExp, bits32 zSig )
291{ 281{
292 int8 shiftCount; 282 int8 shiftCount;
293 283
294 shiftCount = countLeadingZeros32( zSig ) - 1; 284 shiftCount = countLeadingZeros32( zSig ) - 1;
295 return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount ); 285 return roundAndPackFloat32( roundData, zSign, zExp - shiftCount, zSig<<shiftCount );
296 286
297} 287}
298 288
@@ -395,14 +385,14 @@ The handling of underflow and overflow follows the IEC/IEEE Standard for
395Binary Floating-point Arithmetic. 385Binary Floating-point Arithmetic.
396------------------------------------------------------------------------------- 386-------------------------------------------------------------------------------
397*/ 387*/
398static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig ) 388static float64 roundAndPackFloat64( struct roundingData *roundData, flag zSign, int16 zExp, bits64 zSig )
399{ 389{
400 int8 roundingMode; 390 int8 roundingMode;
401 flag roundNearestEven; 391 flag roundNearestEven;
402 int16 roundIncrement, roundBits; 392 int16 roundIncrement, roundBits;
403 flag isTiny; 393 flag isTiny;
404 394
405 roundingMode = float_rounding_mode; 395 roundingMode = roundData->mode;
406 roundNearestEven = ( roundingMode == float_round_nearest_even ); 396 roundNearestEven = ( roundingMode == float_round_nearest_even );
407 roundIncrement = 0x200; 397 roundIncrement = 0x200;
408 if ( ! roundNearestEven ) { 398 if ( ! roundNearestEven ) {
@@ -427,7 +417,7 @@ static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
427 ) { 417 ) {
428 //register int lr = __builtin_return_address(0); 418 //register int lr = __builtin_return_address(0);
429 //printk("roundAndPackFloat64 called from 0x%08x\n",lr); 419 //printk("roundAndPackFloat64 called from 0x%08x\n",lr);
430 float_raise( float_flag_overflow | float_flag_inexact ); 420 roundData->exception |= float_flag_overflow | float_flag_inexact;
431 return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 ); 421 return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
432 } 422 }
433 if ( zExp < 0 ) { 423 if ( zExp < 0 ) {
@@ -438,10 +428,10 @@ static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
438 shift64RightJamming( zSig, - zExp, &zSig ); 428 shift64RightJamming( zSig, - zExp, &zSig );
439 zExp = 0; 429 zExp = 0;
440 roundBits = zSig & 0x3FF; 430 roundBits = zSig & 0x3FF;
441 if ( isTiny && roundBits ) float_raise( float_flag_underflow ); 431 if ( isTiny && roundBits ) roundData->exception |= float_flag_underflow;
442 } 432 }
443 } 433 }
444 if ( roundBits ) float_exception_flags |= float_flag_inexact; 434 if ( roundBits ) roundData->exception |= float_flag_inexact;
445 zSig = ( zSig + roundIncrement )>>10; 435 zSig = ( zSig + roundIncrement )>>10;
446 zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven ); 436 zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
447 if ( zSig == 0 ) zExp = 0; 437 if ( zSig == 0 ) zExp = 0;
@@ -460,12 +450,12 @@ point exponent.
460------------------------------------------------------------------------------- 450-------------------------------------------------------------------------------
461*/ 451*/
462static float64 452static float64
463 normalizeRoundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig ) 453 normalizeRoundAndPackFloat64( struct roundingData *roundData, flag zSign, int16 zExp, bits64 zSig )
464{ 454{
465 int8 shiftCount; 455 int8 shiftCount;
466 456
467 shiftCount = countLeadingZeros64( zSig ) - 1; 457 shiftCount = countLeadingZeros64( zSig ) - 1;
468 return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount ); 458 return roundAndPackFloat64( roundData, zSign, zExp - shiftCount, zSig<<shiftCount );
469 459
470} 460}
471 461
@@ -572,14 +562,15 @@ Floating-point Arithmetic.
572*/ 562*/
573static floatx80 563static floatx80
574 roundAndPackFloatx80( 564 roundAndPackFloatx80(
575 int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1 565 struct roundingData *roundData, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
576 ) 566 )
577{ 567{
578 int8 roundingMode; 568 int8 roundingMode, roundingPrecision;
579 flag roundNearestEven, increment, isTiny; 569 flag roundNearestEven, increment, isTiny;
580 int64 roundIncrement, roundMask, roundBits; 570 int64 roundIncrement, roundMask, roundBits;
581 571
582 roundingMode = float_rounding_mode; 572 roundingMode = roundData->mode;
573 roundingPrecision = roundData->precision;
583 roundNearestEven = ( roundingMode == float_round_nearest_even ); 574 roundNearestEven = ( roundingMode == float_round_nearest_even );
584 if ( roundingPrecision == 80 ) goto precision80; 575 if ( roundingPrecision == 80 ) goto precision80;
585 if ( roundingPrecision == 64 ) { 576 if ( roundingPrecision == 64 ) {
@@ -623,8 +614,8 @@ static floatx80
623 shift64RightJamming( zSig0, 1 - zExp, &zSig0 ); 614 shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
624 zExp = 0; 615 zExp = 0;
625 roundBits = zSig0 & roundMask; 616 roundBits = zSig0 & roundMask;
626 if ( isTiny && roundBits ) float_raise( float_flag_underflow ); 617 if ( isTiny && roundBits ) roundData->exception |= float_flag_underflow;
627 if ( roundBits ) float_exception_flags |= float_flag_inexact; 618 if ( roundBits ) roundData->exception |= float_flag_inexact;
628 zSig0 += roundIncrement; 619 zSig0 += roundIncrement;
629 if ( (sbits64) zSig0 < 0 ) zExp = 1; 620 if ( (sbits64) zSig0 < 0 ) zExp = 1;
630 roundIncrement = roundMask + 1; 621 roundIncrement = roundMask + 1;
@@ -635,7 +626,7 @@ static floatx80
635 return packFloatx80( zSign, zExp, zSig0 ); 626 return packFloatx80( zSign, zExp, zSig0 );
636 } 627 }
637 } 628 }
638 if ( roundBits ) float_exception_flags |= float_flag_inexact; 629 if ( roundBits ) roundData->exception |= float_flag_inexact;
639 zSig0 += roundIncrement; 630 zSig0 += roundIncrement;
640 if ( zSig0 < roundIncrement ) { 631 if ( zSig0 < roundIncrement ) {
641 ++zExp; 632 ++zExp;
@@ -672,7 +663,7 @@ static floatx80
672 ) { 663 ) {
673 roundMask = 0; 664 roundMask = 0;
674 overflow: 665 overflow:
675 float_raise( float_flag_overflow | float_flag_inexact ); 666 roundData->exception |= float_flag_overflow | float_flag_inexact;
676 if ( ( roundingMode == float_round_to_zero ) 667 if ( ( roundingMode == float_round_to_zero )
677 || ( zSign && ( roundingMode == float_round_up ) ) 668 || ( zSign && ( roundingMode == float_round_up ) )
678 || ( ! zSign && ( roundingMode == float_round_down ) ) 669 || ( ! zSign && ( roundingMode == float_round_down ) )
@@ -689,8 +680,8 @@ static floatx80
689 || ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) ); 680 || ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) );
690 shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 ); 681 shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 );
691 zExp = 0; 682 zExp = 0;
692 if ( isTiny && zSig1 ) float_raise( float_flag_underflow ); 683 if ( isTiny && zSig1 ) roundData->exception |= float_flag_underflow;
693 if ( zSig1 ) float_exception_flags |= float_flag_inexact; 684 if ( zSig1 ) roundData->exception |= float_flag_inexact;
694 if ( roundNearestEven ) { 685 if ( roundNearestEven ) {
695 increment = ( (sbits64) zSig1 < 0 ); 686 increment = ( (sbits64) zSig1 < 0 );
696 } 687 }
@@ -710,7 +701,7 @@ static floatx80
710 return packFloatx80( zSign, zExp, zSig0 ); 701 return packFloatx80( zSign, zExp, zSig0 );
711 } 702 }
712 } 703 }
713 if ( zSig1 ) float_exception_flags |= float_flag_inexact; 704 if ( zSig1 ) roundData->exception |= float_flag_inexact;
714 if ( increment ) { 705 if ( increment ) {
715 ++zSig0; 706 ++zSig0;
716 if ( zSig0 == 0 ) { 707 if ( zSig0 == 0 ) {
@@ -740,7 +731,7 @@ normalized.
740*/ 731*/
741static floatx80 732static floatx80
742 normalizeRoundAndPackFloatx80( 733 normalizeRoundAndPackFloatx80(
743 int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1 734 struct roundingData *roundData, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
744 ) 735 )
745{ 736{
746 int8 shiftCount; 737 int8 shiftCount;
@@ -754,7 +745,7 @@ static floatx80
754 shortShift128Left( zSig0, zSig1, shiftCount, &zSig0, &zSig1 ); 745 shortShift128Left( zSig0, zSig1, shiftCount, &zSig0, &zSig1 );
755 zExp -= shiftCount; 746 zExp -= shiftCount;
756 return 747 return
757 roundAndPackFloatx80( roundingPrecision, zSign, zExp, zSig0, zSig1 ); 748 roundAndPackFloatx80( roundData, zSign, zExp, zSig0, zSig1 );
758 749
759} 750}
760 751
@@ -767,14 +758,14 @@ the single-precision floating-point format. The conversion is performed
767according to the IEC/IEEE Standard for Binary Floating-point Arithmetic. 758according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
768------------------------------------------------------------------------------- 759-------------------------------------------------------------------------------
769*/ 760*/
770float32 int32_to_float32( int32 a ) 761float32 int32_to_float32(struct roundingData *roundData, int32 a)
771{ 762{
772 flag zSign; 763 flag zSign;
773 764
774 if ( a == 0 ) return 0; 765 if ( a == 0 ) return 0;
775 if ( a == 0x80000000 ) return packFloat32( 1, 0x9E, 0 ); 766 if ( a == 0x80000000 ) return packFloat32( 1, 0x9E, 0 );
776 zSign = ( a < 0 ); 767 zSign = ( a < 0 );
777 return normalizeRoundAndPackFloat32( zSign, 0x9C, zSign ? - a : a ); 768 return normalizeRoundAndPackFloat32( roundData, zSign, 0x9C, zSign ? - a : a );
778 769
779} 770}
780 771
@@ -840,7 +831,7 @@ positive integer is returned. Otherwise, if the conversion overflows, the
840largest integer with the same sign as `a' is returned. 831largest integer with the same sign as `a' is returned.
841------------------------------------------------------------------------------- 832-------------------------------------------------------------------------------
842*/ 833*/
843int32 float32_to_int32( float32 a ) 834int32 float32_to_int32( struct roundingData *roundData, float32 a )
844{ 835{
845 flag aSign; 836 flag aSign;
846 int16 aExp, shiftCount; 837 int16 aExp, shiftCount;
@@ -856,7 +847,7 @@ int32 float32_to_int32( float32 a )
856 zSig = aSig; 847 zSig = aSig;
857 zSig <<= 32; 848 zSig <<= 32;
858 if ( 0 < shiftCount ) shift64RightJamming( zSig, shiftCount, &zSig ); 849 if ( 0 < shiftCount ) shift64RightJamming( zSig, shiftCount, &zSig );
859 return roundAndPackInt32( aSign, zSig ); 850 return roundAndPackInt32( roundData, aSign, zSig );
860 851
861} 852}
862 853
@@ -889,13 +880,13 @@ int32 float32_to_int32_round_to_zero( float32 a )
889 return 0x80000000; 880 return 0x80000000;
890 } 881 }
891 else if ( aExp <= 0x7E ) { 882 else if ( aExp <= 0x7E ) {
892 if ( aExp | aSig ) float_exception_flags |= float_flag_inexact; 883 if ( aExp | aSig ) float_raise( float_flag_inexact );
893 return 0; 884 return 0;
894 } 885 }
895 aSig = ( aSig | 0x00800000 )<<8; 886 aSig = ( aSig | 0x00800000 )<<8;
896 z = aSig>>( - shiftCount ); 887 z = aSig>>( - shiftCount );
897 if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) { 888 if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
898 float_exception_flags |= float_flag_inexact; 889 float_raise( float_flag_inexact );
899 } 890 }
900 return aSign ? - z : z; 891 return aSign ? - z : z;
901 892
@@ -973,7 +964,7 @@ operation is performed according to the IEC/IEEE Standard for Binary
973Floating-point Arithmetic. 964Floating-point Arithmetic.
974------------------------------------------------------------------------------- 965-------------------------------------------------------------------------------
975*/ 966*/
976float32 float32_round_to_int( float32 a ) 967float32 float32_round_to_int( struct roundingData *roundData, float32 a )
977{ 968{
978 flag aSign; 969 flag aSign;
979 int16 aExp; 970 int16 aExp;
@@ -988,11 +979,12 @@ float32 float32_round_to_int( float32 a )
988 } 979 }
989 return a; 980 return a;
990 } 981 }
982 roundingMode = roundData->mode;
991 if ( aExp <= 0x7E ) { 983 if ( aExp <= 0x7E ) {
992 if ( (bits32) ( a<<1 ) == 0 ) return a; 984 if ( (bits32) ( a<<1 ) == 0 ) return a;
993 float_exception_flags |= float_flag_inexact; 985 roundData->exception |= float_flag_inexact;
994 aSign = extractFloat32Sign( a ); 986 aSign = extractFloat32Sign( a );
995 switch ( float_rounding_mode ) { 987 switch ( roundingMode ) {
996 case float_round_nearest_even: 988 case float_round_nearest_even:
997 if ( ( aExp == 0x7E ) && extractFloat32Frac( a ) ) { 989 if ( ( aExp == 0x7E ) && extractFloat32Frac( a ) ) {
998 return packFloat32( aSign, 0x7F, 0 ); 990 return packFloat32( aSign, 0x7F, 0 );
@@ -1009,7 +1001,6 @@ float32 float32_round_to_int( float32 a )
1009 lastBitMask <<= 0x96 - aExp; 1001 lastBitMask <<= 0x96 - aExp;
1010 roundBitsMask = lastBitMask - 1; 1002 roundBitsMask = lastBitMask - 1;
1011 z = a; 1003 z = a;
1012 roundingMode = float_rounding_mode;
1013 if ( roundingMode == float_round_nearest_even ) { 1004 if ( roundingMode == float_round_nearest_even ) {
1014 z += lastBitMask>>1; 1005 z += lastBitMask>>1;
1015 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask; 1006 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
@@ -1020,7 +1011,7 @@ float32 float32_round_to_int( float32 a )
1020 } 1011 }
1021 } 1012 }
1022 z &= ~ roundBitsMask; 1013 z &= ~ roundBitsMask;
1023 if ( z != a ) float_exception_flags |= float_flag_inexact; 1014 if ( z != a ) roundData->exception |= float_flag_inexact;
1024 return z; 1015 return z;
1025 1016
1026} 1017}
@@ -1034,7 +1025,7 @@ addition is performed according to the IEC/IEEE Standard for Binary
1034Floating-point Arithmetic. 1025Floating-point Arithmetic.
1035------------------------------------------------------------------------------- 1026-------------------------------------------------------------------------------
1036*/ 1027*/
1037static float32 addFloat32Sigs( float32 a, float32 b, flag zSign ) 1028static float32 addFloat32Sigs( struct roundingData *roundData, float32 a, float32 b, flag zSign )
1038{ 1029{
1039 int16 aExp, bExp, zExp; 1030 int16 aExp, bExp, zExp;
1040 bits32 aSig, bSig, zSig; 1031 bits32 aSig, bSig, zSig;
@@ -1093,7 +1084,7 @@ static float32 addFloat32Sigs( float32 a, float32 b, flag zSign )
1093 ++zExp; 1084 ++zExp;
1094 } 1085 }
1095 roundAndPack: 1086 roundAndPack:
1096 return roundAndPackFloat32( zSign, zExp, zSig ); 1087 return roundAndPackFloat32( roundData, zSign, zExp, zSig );
1097 1088
1098} 1089}
1099 1090
@@ -1106,7 +1097,7 @@ result is a NaN. The subtraction is performed according to the IEC/IEEE
1106Standard for Binary Floating-point Arithmetic. 1097Standard for Binary Floating-point Arithmetic.
1107------------------------------------------------------------------------------- 1098-------------------------------------------------------------------------------
1108*/ 1099*/
1109static float32 subFloat32Sigs( float32 a, float32 b, flag zSign ) 1100static float32 subFloat32Sigs( struct roundingData *roundData, float32 a, float32 b, flag zSign )
1110{ 1101{
1111 int16 aExp, bExp, zExp; 1102 int16 aExp, bExp, zExp;
1112 bits32 aSig, bSig, zSig; 1103 bits32 aSig, bSig, zSig;
@@ -1123,7 +1114,7 @@ static float32 subFloat32Sigs( float32 a, float32 b, flag zSign )
1123 if ( expDiff < 0 ) goto bExpBigger; 1114 if ( expDiff < 0 ) goto bExpBigger;
1124 if ( aExp == 0xFF ) { 1115 if ( aExp == 0xFF ) {
1125 if ( aSig | bSig ) return propagateFloat32NaN( a, b ); 1116 if ( aSig | bSig ) return propagateFloat32NaN( a, b );
1126 float_raise( float_flag_invalid ); 1117 roundData->exception |= float_flag_invalid;
1127 return float32_default_nan; 1118 return float32_default_nan;
1128 } 1119 }
1129 if ( aExp == 0 ) { 1120 if ( aExp == 0 ) {
@@ -1132,7 +1123,7 @@ static float32 subFloat32Sigs( float32 a, float32 b, flag zSign )
1132 } 1123 }
1133 if ( bSig < aSig ) goto aBigger; 1124 if ( bSig < aSig ) goto aBigger;
1134 if ( aSig < bSig ) goto bBigger; 1125 if ( aSig < bSig ) goto bBigger;
1135 return packFloat32( float_rounding_mode == float_round_down, 0, 0 ); 1126 return packFloat32( roundData->mode == float_round_down, 0, 0 );
1136 bExpBigger: 1127 bExpBigger:
1137 if ( bExp == 0xFF ) { 1128 if ( bExp == 0xFF ) {
1138 if ( bSig ) return propagateFloat32NaN( a, b ); 1129 if ( bSig ) return propagateFloat32NaN( a, b );
@@ -1169,7 +1160,7 @@ static float32 subFloat32Sigs( float32 a, float32 b, flag zSign )
1169 zExp = aExp; 1160 zExp = aExp;
1170 normalizeRoundAndPack: 1161 normalizeRoundAndPack:
1171 --zExp; 1162 --zExp;
1172 return normalizeRoundAndPackFloat32( zSign, zExp, zSig ); 1163 return normalizeRoundAndPackFloat32( roundData, zSign, zExp, zSig );
1173 1164
1174} 1165}
1175 1166
@@ -1180,17 +1171,17 @@ and `b'. The operation is performed according to the IEC/IEEE Standard for
1180Binary Floating-point Arithmetic. 1171Binary Floating-point Arithmetic.
1181------------------------------------------------------------------------------- 1172-------------------------------------------------------------------------------
1182*/ 1173*/
1183float32 float32_add( float32 a, float32 b ) 1174float32 float32_add( struct roundingData *roundData, float32 a, float32 b )
1184{ 1175{
1185 flag aSign, bSign; 1176 flag aSign, bSign;
1186 1177
1187 aSign = extractFloat32Sign( a ); 1178 aSign = extractFloat32Sign( a );
1188 bSign = extractFloat32Sign( b ); 1179 bSign = extractFloat32Sign( b );
1189 if ( aSign == bSign ) { 1180 if ( aSign == bSign ) {
1190 return addFloat32Sigs( a, b, aSign ); 1181 return addFloat32Sigs( roundData, a, b, aSign );
1191 } 1182 }
1192 else { 1183 else {
1193 return subFloat32Sigs( a, b, aSign ); 1184 return subFloat32Sigs( roundData, a, b, aSign );
1194 } 1185 }
1195 1186
1196} 1187}
@@ -1202,17 +1193,17 @@ Returns the result of subtracting the single-precision floating-point values
1202for Binary Floating-point Arithmetic. 1193for Binary Floating-point Arithmetic.
1203------------------------------------------------------------------------------- 1194-------------------------------------------------------------------------------
1204*/ 1195*/
1205float32 float32_sub( float32 a, float32 b ) 1196float32 float32_sub( struct roundingData *roundData, float32 a, float32 b )
1206{ 1197{
1207 flag aSign, bSign; 1198 flag aSign, bSign;
1208 1199
1209 aSign = extractFloat32Sign( a ); 1200 aSign = extractFloat32Sign( a );
1210 bSign = extractFloat32Sign( b ); 1201 bSign = extractFloat32Sign( b );
1211 if ( aSign == bSign ) { 1202 if ( aSign == bSign ) {
1212 return subFloat32Sigs( a, b, aSign ); 1203 return subFloat32Sigs( roundData, a, b, aSign );
1213 } 1204 }
1214 else { 1205 else {
1215 return addFloat32Sigs( a, b, aSign ); 1206 return addFloat32Sigs( roundData, a, b, aSign );
1216 } 1207 }
1217 1208
1218} 1209}
@@ -1224,7 +1215,7 @@ Returns the result of multiplying the single-precision floating-point values
1224for Binary Floating-point Arithmetic. 1215for Binary Floating-point Arithmetic.
1225------------------------------------------------------------------------------- 1216-------------------------------------------------------------------------------
1226*/ 1217*/
1227float32 float32_mul( float32 a, float32 b ) 1218float32 float32_mul( struct roundingData *roundData, float32 a, float32 b )
1228{ 1219{
1229 flag aSign, bSign, zSign; 1220 flag aSign, bSign, zSign;
1230 int16 aExp, bExp, zExp; 1221 int16 aExp, bExp, zExp;
@@ -1244,7 +1235,7 @@ float32 float32_mul( float32 a, float32 b )
1244 return propagateFloat32NaN( a, b ); 1235 return propagateFloat32NaN( a, b );
1245 } 1236 }
1246 if ( ( bExp | bSig ) == 0 ) { 1237 if ( ( bExp | bSig ) == 0 ) {
1247 float_raise( float_flag_invalid ); 1238 roundData->exception |= float_flag_invalid;
1248 return float32_default_nan; 1239 return float32_default_nan;
1249 } 1240 }
1250 return packFloat32( zSign, 0xFF, 0 ); 1241 return packFloat32( zSign, 0xFF, 0 );
@@ -1252,7 +1243,7 @@ float32 float32_mul( float32 a, float32 b )
1252 if ( bExp == 0xFF ) { 1243 if ( bExp == 0xFF ) {
1253 if ( bSig ) return propagateFloat32NaN( a, b ); 1244 if ( bSig ) return propagateFloat32NaN( a, b );
1254 if ( ( aExp | aSig ) == 0 ) { 1245 if ( ( aExp | aSig ) == 0 ) {
1255 float_raise( float_flag_invalid ); 1246 roundData->exception |= float_flag_invalid;
1256 return float32_default_nan; 1247 return float32_default_nan;
1257 } 1248 }
1258 return packFloat32( zSign, 0xFF, 0 ); 1249 return packFloat32( zSign, 0xFF, 0 );
@@ -1274,7 +1265,7 @@ float32 float32_mul( float32 a, float32 b )
1274 zSig <<= 1; 1265 zSig <<= 1;
1275 --zExp; 1266 --zExp;
1276 } 1267 }
1277 return roundAndPackFloat32( zSign, zExp, zSig ); 1268 return roundAndPackFloat32( roundData, zSign, zExp, zSig );
1278 1269
1279} 1270}
1280 1271
@@ -1285,7 +1276,7 @@ by the corresponding value `b'. The operation is performed according to the
1285IEC/IEEE Standard for Binary Floating-point Arithmetic. 1276IEC/IEEE Standard for Binary Floating-point Arithmetic.
1286------------------------------------------------------------------------------- 1277-------------------------------------------------------------------------------
1287*/ 1278*/
1288float32 float32_div( float32 a, float32 b ) 1279float32 float32_div( struct roundingData *roundData, float32 a, float32 b )
1289{ 1280{
1290 flag aSign, bSign, zSign; 1281 flag aSign, bSign, zSign;
1291 int16 aExp, bExp, zExp; 1282 int16 aExp, bExp, zExp;
@@ -1302,7 +1293,7 @@ float32 float32_div( float32 a, float32 b )
1302 if ( aSig ) return propagateFloat32NaN( a, b ); 1293 if ( aSig ) return propagateFloat32NaN( a, b );
1303 if ( bExp == 0xFF ) { 1294 if ( bExp == 0xFF ) {
1304 if ( bSig ) return propagateFloat32NaN( a, b ); 1295 if ( bSig ) return propagateFloat32NaN( a, b );
1305 float_raise( float_flag_invalid ); 1296 roundData->exception |= float_flag_invalid;
1306 return float32_default_nan; 1297 return float32_default_nan;
1307 } 1298 }
1308 return packFloat32( zSign, 0xFF, 0 ); 1299 return packFloat32( zSign, 0xFF, 0 );
@@ -1314,10 +1305,10 @@ float32 float32_div( float32 a, float32 b )
1314 if ( bExp == 0 ) { 1305 if ( bExp == 0 ) {
1315 if ( bSig == 0 ) { 1306 if ( bSig == 0 ) {
1316 if ( ( aExp | aSig ) == 0 ) { 1307 if ( ( aExp | aSig ) == 0 ) {
1317 float_raise( float_flag_invalid ); 1308 roundData->exception |= float_flag_invalid;
1318 return float32_default_nan; 1309 return float32_default_nan;
1319 } 1310 }
1320 float_raise( float_flag_divbyzero ); 1311 roundData->exception |= float_flag_divbyzero;
1321 return packFloat32( zSign, 0xFF, 0 ); 1312 return packFloat32( zSign, 0xFF, 0 );
1322 } 1313 }
1323 normalizeFloat32Subnormal( bSig, &bExp, &bSig ); 1314 normalizeFloat32Subnormal( bSig, &bExp, &bSig );
@@ -1341,7 +1332,7 @@ float32 float32_div( float32 a, float32 b )
1341 if ( ( zSig & 0x3F ) == 0 ) { 1332 if ( ( zSig & 0x3F ) == 0 ) {
1342 zSig |= ( ( (bits64) bSig ) * zSig != ( (bits64) aSig )<<32 ); 1333 zSig |= ( ( (bits64) bSig ) * zSig != ( (bits64) aSig )<<32 );
1343 } 1334 }
1344 return roundAndPackFloat32( zSign, zExp, zSig ); 1335 return roundAndPackFloat32( roundData, zSign, zExp, zSig );
1345 1336
1346} 1337}
1347 1338
@@ -1352,7 +1343,7 @@ with respect to the corresponding value `b'. The operation is performed
1352according to the IEC/IEEE Standard for Binary Floating-point Arithmetic. 1343according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
1353------------------------------------------------------------------------------- 1344-------------------------------------------------------------------------------
1354*/ 1345*/
1355float32 float32_rem( float32 a, float32 b ) 1346float32 float32_rem( struct roundingData *roundData, float32 a, float32 b )
1356{ 1347{
1357 flag aSign, bSign, zSign; 1348 flag aSign, bSign, zSign;
1358 int16 aExp, bExp, expDiff; 1349 int16 aExp, bExp, expDiff;
@@ -1372,7 +1363,7 @@ float32 float32_rem( float32 a, float32 b )
1372 if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) { 1363 if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
1373 return propagateFloat32NaN( a, b ); 1364 return propagateFloat32NaN( a, b );
1374 } 1365 }
1375 float_raise( float_flag_invalid ); 1366 roundData->exception |= float_flag_invalid;
1376 return float32_default_nan; 1367 return float32_default_nan;
1377 } 1368 }
1378 if ( bExp == 0xFF ) { 1369 if ( bExp == 0xFF ) {
@@ -1381,7 +1372,7 @@ float32 float32_rem( float32 a, float32 b )
1381 } 1372 }
1382 if ( bExp == 0 ) { 1373 if ( bExp == 0 ) {
1383 if ( bSig == 0 ) { 1374 if ( bSig == 0 ) {
1384 float_raise( float_flag_invalid ); 1375 roundData->exception |= float_flag_invalid;
1385 return float32_default_nan; 1376 return float32_default_nan;
1386 } 1377 }
1387 normalizeFloat32Subnormal( bSig, &bExp, &bSig ); 1378 normalizeFloat32Subnormal( bSig, &bExp, &bSig );
@@ -1444,7 +1435,7 @@ float32 float32_rem( float32 a, float32 b )
1444 } 1435 }
1445 zSign = ( (sbits32) aSig < 0 ); 1436 zSign = ( (sbits32) aSig < 0 );
1446 if ( zSign ) aSig = - aSig; 1437 if ( zSign ) aSig = - aSig;
1447 return normalizeRoundAndPackFloat32( aSign ^ zSign, bExp, aSig ); 1438 return normalizeRoundAndPackFloat32( roundData, aSign ^ zSign, bExp, aSig );
1448 1439
1449} 1440}
1450 1441
@@ -1455,7 +1446,7 @@ The operation is performed according to the IEC/IEEE Standard for Binary
1455Floating-point Arithmetic. 1446Floating-point Arithmetic.
1456------------------------------------------------------------------------------- 1447-------------------------------------------------------------------------------
1457*/ 1448*/
1458float32 float32_sqrt( float32 a ) 1449float32 float32_sqrt( struct roundingData *roundData, float32 a )
1459{ 1450{
1460 flag aSign; 1451 flag aSign;
1461 int16 aExp, zExp; 1452 int16 aExp, zExp;
@@ -1468,12 +1459,12 @@ float32 float32_sqrt( float32 a )
1468 if ( aExp == 0xFF ) { 1459 if ( aExp == 0xFF ) {
1469 if ( aSig ) return propagateFloat32NaN( a, 0 ); 1460 if ( aSig ) return propagateFloat32NaN( a, 0 );
1470 if ( ! aSign ) return a; 1461 if ( ! aSign ) return a;
1471 float_raise( float_flag_invalid ); 1462 roundData->exception |= float_flag_invalid;
1472 return float32_default_nan; 1463 return float32_default_nan;
1473 } 1464 }
1474 if ( aSign ) { 1465 if ( aSign ) {
1475 if ( ( aExp | aSig ) == 0 ) return a; 1466 if ( ( aExp | aSig ) == 0 ) return a;
1476 float_raise( float_flag_invalid ); 1467 roundData->exception |= float_flag_invalid;
1477 return float32_default_nan; 1468 return float32_default_nan;
1478 } 1469 }
1479 if ( aExp == 0 ) { 1470 if ( aExp == 0 ) {
@@ -1499,7 +1490,7 @@ float32 float32_sqrt( float32 a )
1499 } 1490 }
1500 } 1491 }
1501 shift32RightJamming( zSig, 1, &zSig ); 1492 shift32RightJamming( zSig, 1, &zSig );
1502 return roundAndPackFloat32( 0, zExp, zSig ); 1493 return roundAndPackFloat32( roundData, 0, zExp, zSig );
1503 1494
1504} 1495}
1505 1496
@@ -1661,7 +1652,7 @@ positive integer is returned. Otherwise, if the conversion overflows, the
1661largest integer with the same sign as `a' is returned. 1652largest integer with the same sign as `a' is returned.
1662------------------------------------------------------------------------------- 1653-------------------------------------------------------------------------------
1663*/ 1654*/
1664int32 float64_to_int32( float64 a ) 1655int32 float64_to_int32( struct roundingData *roundData, float64 a )
1665{ 1656{
1666 flag aSign; 1657 flag aSign;
1667 int16 aExp, shiftCount; 1658 int16 aExp, shiftCount;
@@ -1674,7 +1665,7 @@ int32 float64_to_int32( float64 a )
1674 if ( aExp ) aSig |= LIT64( 0x0010000000000000 ); 1665 if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
1675 shiftCount = 0x42C - aExp; 1666 shiftCount = 0x42C - aExp;
1676 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig ); 1667 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
1677 return roundAndPackInt32( aSign, aSig ); 1668 return roundAndPackInt32( roundData, aSign, aSig );
1678 1669
1679} 1670}
1680 1671
@@ -1705,7 +1696,7 @@ int32 float64_to_int32_round_to_zero( float64 a )
1705 goto invalid; 1696 goto invalid;
1706 } 1697 }
1707 else if ( 52 < shiftCount ) { 1698 else if ( 52 < shiftCount ) {
1708 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact; 1699 if ( aExp || aSig ) float_raise( float_flag_inexact );
1709 return 0; 1700 return 0;
1710 } 1701 }
1711 aSig |= LIT64( 0x0010000000000000 ); 1702 aSig |= LIT64( 0x0010000000000000 );
@@ -1715,11 +1706,11 @@ int32 float64_to_int32_round_to_zero( float64 a )
1715 if ( aSign ) z = - z; 1706 if ( aSign ) z = - z;
1716 if ( ( z < 0 ) ^ aSign ) { 1707 if ( ( z < 0 ) ^ aSign ) {
1717 invalid: 1708 invalid:
1718 float_exception_flags |= float_flag_invalid; 1709 float_raise( float_flag_invalid );
1719 return aSign ? 0x80000000 : 0x7FFFFFFF; 1710 return aSign ? 0x80000000 : 0x7FFFFFFF;
1720 } 1711 }
1721 if ( ( aSig<<shiftCount ) != savedASig ) { 1712 if ( ( aSig<<shiftCount ) != savedASig ) {
1722 float_exception_flags |= float_flag_inexact; 1713 float_raise( float_flag_inexact );
1723 } 1714 }
1724 return z; 1715 return z;
1725 1716
@@ -1736,7 +1727,7 @@ positive integer is returned. Otherwise, if the conversion overflows, the
1736largest positive integer is returned. 1727largest positive integer is returned.
1737------------------------------------------------------------------------------- 1728-------------------------------------------------------------------------------
1738*/ 1729*/
1739int32 float64_to_uint32( float64 a ) 1730int32 float64_to_uint32( struct roundingData *roundData, float64 a )
1740{ 1731{
1741 flag aSign; 1732 flag aSign;
1742 int16 aExp, shiftCount; 1733 int16 aExp, shiftCount;
@@ -1749,7 +1740,7 @@ int32 float64_to_uint32( float64 a )
1749 if ( aExp ) aSig |= LIT64( 0x0010000000000000 ); 1740 if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
1750 shiftCount = 0x42C - aExp; 1741 shiftCount = 0x42C - aExp;
1751 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig ); 1742 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
1752 return roundAndPackInt32( aSign, aSig ); 1743 return roundAndPackInt32( roundData, aSign, aSig );
1753} 1744}
1754 1745
1755/* 1746/*
@@ -1778,7 +1769,7 @@ int32 float64_to_uint32_round_to_zero( float64 a )
1778 goto invalid; 1769 goto invalid;
1779 } 1770 }
1780 else if ( 52 < shiftCount ) { 1771 else if ( 52 < shiftCount ) {
1781 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact; 1772 if ( aExp || aSig ) float_raise( float_flag_inexact );
1782 return 0; 1773 return 0;
1783 } 1774 }
1784 aSig |= LIT64( 0x0010000000000000 ); 1775 aSig |= LIT64( 0x0010000000000000 );
@@ -1788,11 +1779,11 @@ int32 float64_to_uint32_round_to_zero( float64 a )
1788 if ( aSign ) z = - z; 1779 if ( aSign ) z = - z;
1789 if ( ( z < 0 ) ^ aSign ) { 1780 if ( ( z < 0 ) ^ aSign ) {
1790 invalid: 1781 invalid:
1791 float_exception_flags |= float_flag_invalid; 1782 float_raise( float_flag_invalid );
1792 return aSign ? 0x80000000 : 0x7FFFFFFF; 1783 return aSign ? 0x80000000 : 0x7FFFFFFF;
1793 } 1784 }
1794 if ( ( aSig<<shiftCount ) != savedASig ) { 1785 if ( ( aSig<<shiftCount ) != savedASig ) {
1795 float_exception_flags |= float_flag_inexact; 1786 float_raise( float_flag_inexact );
1796 } 1787 }
1797 return z; 1788 return z;
1798} 1789}
@@ -1805,7 +1796,7 @@ performed according to the IEC/IEEE Standard for Binary Floating-point
1805Arithmetic. 1796Arithmetic.
1806------------------------------------------------------------------------------- 1797-------------------------------------------------------------------------------
1807*/ 1798*/
1808float32 float64_to_float32( float64 a ) 1799float32 float64_to_float32( struct roundingData *roundData, float64 a )
1809{ 1800{
1810 flag aSign; 1801 flag aSign;
1811 int16 aExp; 1802 int16 aExp;
@@ -1825,7 +1816,7 @@ float32 float64_to_float32( float64 a )
1825 zSig |= 0x40000000; 1816 zSig |= 0x40000000;
1826 aExp -= 0x381; 1817 aExp -= 0x381;
1827 } 1818 }
1828 return roundAndPackFloat32( aSign, aExp, zSig ); 1819 return roundAndPackFloat32( roundData, aSign, aExp, zSig );
1829 1820
1830} 1821}
1831 1822
@@ -1872,7 +1863,7 @@ operation is performed according to the IEC/IEEE Standard for Binary
1872Floating-point Arithmetic. 1863Floating-point Arithmetic.
1873------------------------------------------------------------------------------- 1864-------------------------------------------------------------------------------
1874*/ 1865*/
1875float64 float64_round_to_int( float64 a ) 1866float64 float64_round_to_int( struct roundingData *roundData, float64 a )
1876{ 1867{
1877 flag aSign; 1868 flag aSign;
1878 int16 aExp; 1869 int16 aExp;
@@ -1889,9 +1880,9 @@ float64 float64_round_to_int( float64 a )
1889 } 1880 }
1890 if ( aExp <= 0x3FE ) { 1881 if ( aExp <= 0x3FE ) {
1891 if ( (bits64) ( a<<1 ) == 0 ) return a; 1882 if ( (bits64) ( a<<1 ) == 0 ) return a;
1892 float_exception_flags |= float_flag_inexact; 1883 roundData->exception |= float_flag_inexact;
1893 aSign = extractFloat64Sign( a ); 1884 aSign = extractFloat64Sign( a );
1894 switch ( float_rounding_mode ) { 1885 switch ( roundData->mode ) {
1895 case float_round_nearest_even: 1886 case float_round_nearest_even:
1896 if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) { 1887 if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) {
1897 return packFloat64( aSign, 0x3FF, 0 ); 1888 return packFloat64( aSign, 0x3FF, 0 );
@@ -1909,7 +1900,7 @@ float64 float64_round_to_int( float64 a )
1909 lastBitMask <<= 0x433 - aExp; 1900 lastBitMask <<= 0x433 - aExp;
1910 roundBitsMask = lastBitMask - 1; 1901 roundBitsMask = lastBitMask - 1;
1911 z = a; 1902 z = a;
1912 roundingMode = float_rounding_mode; 1903 roundingMode = roundData->mode;
1913 if ( roundingMode == float_round_nearest_even ) { 1904 if ( roundingMode == float_round_nearest_even ) {
1914 z += lastBitMask>>1; 1905 z += lastBitMask>>1;
1915 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask; 1906 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
@@ -1920,7 +1911,7 @@ float64 float64_round_to_int( float64 a )
1920 } 1911 }
1921 } 1912 }
1922 z &= ~ roundBitsMask; 1913 z &= ~ roundBitsMask;
1923 if ( z != a ) float_exception_flags |= float_flag_inexact; 1914 if ( z != a ) roundData->exception |= float_flag_inexact;
1924 return z; 1915 return z;
1925 1916
1926} 1917}
@@ -1934,7 +1925,7 @@ addition is performed according to the IEC/IEEE Standard for Binary
1934Floating-point Arithmetic. 1925Floating-point Arithmetic.
1935------------------------------------------------------------------------------- 1926-------------------------------------------------------------------------------
1936*/ 1927*/
1937static float64 addFloat64Sigs( float64 a, float64 b, flag zSign ) 1928static float64 addFloat64Sigs( struct roundingData *roundData, float64 a, float64 b, flag zSign )
1938{ 1929{
1939 int16 aExp, bExp, zExp; 1930 int16 aExp, bExp, zExp;
1940 bits64 aSig, bSig, zSig; 1931 bits64 aSig, bSig, zSig;
@@ -1993,7 +1984,7 @@ static float64 addFloat64Sigs( float64 a, float64 b, flag zSign )
1993 ++zExp; 1984 ++zExp;
1994 } 1985 }
1995 roundAndPack: 1986 roundAndPack:
1996 return roundAndPackFloat64( zSign, zExp, zSig ); 1987 return roundAndPackFloat64( roundData, zSign, zExp, zSig );
1997 1988
1998} 1989}
1999 1990
@@ -2006,7 +1997,7 @@ result is a NaN. The subtraction is performed according to the IEC/IEEE
2006Standard for Binary Floating-point Arithmetic. 1997Standard for Binary Floating-point Arithmetic.
2007------------------------------------------------------------------------------- 1998-------------------------------------------------------------------------------
2008*/ 1999*/
2009static float64 subFloat64Sigs( float64 a, float64 b, flag zSign ) 2000static float64 subFloat64Sigs( struct roundingData *roundData, float64 a, float64 b, flag zSign )
2010{ 2001{
2011 int16 aExp, bExp, zExp; 2002 int16 aExp, bExp, zExp;
2012 bits64 aSig, bSig, zSig; 2003 bits64 aSig, bSig, zSig;
@@ -2023,7 +2014,7 @@ static float64 subFloat64Sigs( float64 a, float64 b, flag zSign )
2023 if ( expDiff < 0 ) goto bExpBigger; 2014 if ( expDiff < 0 ) goto bExpBigger;
2024 if ( aExp == 0x7FF ) { 2015 if ( aExp == 0x7FF ) {
2025 if ( aSig | bSig ) return propagateFloat64NaN( a, b ); 2016 if ( aSig | bSig ) return propagateFloat64NaN( a, b );
2026 float_raise( float_flag_invalid ); 2017 roundData->exception |= float_flag_invalid;
2027 return float64_default_nan; 2018 return float64_default_nan;
2028 } 2019 }
2029 if ( aExp == 0 ) { 2020 if ( aExp == 0 ) {
@@ -2032,7 +2023,7 @@ static float64 subFloat64Sigs( float64 a, float64 b, flag zSign )
2032 } 2023 }
2033 if ( bSig < aSig ) goto aBigger; 2024 if ( bSig < aSig ) goto aBigger;
2034 if ( aSig < bSig ) goto bBigger; 2025 if ( aSig < bSig ) goto bBigger;
2035 return packFloat64( float_rounding_mode == float_round_down, 0, 0 ); 2026 return packFloat64( roundData->mode == float_round_down, 0, 0 );
2036 bExpBigger: 2027 bExpBigger:
2037 if ( bExp == 0x7FF ) { 2028 if ( bExp == 0x7FF ) {
2038 if ( bSig ) return propagateFloat64NaN( a, b ); 2029 if ( bSig ) return propagateFloat64NaN( a, b );
@@ -2069,7 +2060,7 @@ static float64 subFloat64Sigs( float64 a, float64 b, flag zSign )
2069 zExp = aExp; 2060 zExp = aExp;
2070 normalizeRoundAndPack: 2061 normalizeRoundAndPack:
2071 --zExp; 2062 --zExp;
2072 return normalizeRoundAndPackFloat64( zSign, zExp, zSig ); 2063 return normalizeRoundAndPackFloat64( roundData, zSign, zExp, zSig );
2073 2064
2074} 2065}
2075 2066
@@ -2080,17 +2071,17 @@ and `b'. The operation is performed according to the IEC/IEEE Standard for
2080Binary Floating-point Arithmetic. 2071Binary Floating-point Arithmetic.
2081------------------------------------------------------------------------------- 2072-------------------------------------------------------------------------------
2082*/ 2073*/
2083float64 float64_add( float64 a, float64 b ) 2074float64 float64_add( struct roundingData *roundData, float64 a, float64 b )
2084{ 2075{
2085 flag aSign, bSign; 2076 flag aSign, bSign;
2086 2077
2087 aSign = extractFloat64Sign( a ); 2078 aSign = extractFloat64Sign( a );
2088 bSign = extractFloat64Sign( b ); 2079 bSign = extractFloat64Sign( b );
2089 if ( aSign == bSign ) { 2080 if ( aSign == bSign ) {
2090 return addFloat64Sigs( a, b, aSign ); 2081 return addFloat64Sigs( roundData, a, b, aSign );
2091 } 2082 }
2092 else { 2083 else {
2093 return subFloat64Sigs( a, b, aSign ); 2084 return subFloat64Sigs( roundData, a, b, aSign );
2094 } 2085 }
2095 2086
2096} 2087}
@@ -2102,17 +2093,17 @@ Returns the result of subtracting the double-precision floating-point values
2102for Binary Floating-point Arithmetic. 2093for Binary Floating-point Arithmetic.
2103------------------------------------------------------------------------------- 2094-------------------------------------------------------------------------------
2104*/ 2095*/
2105float64 float64_sub( float64 a, float64 b ) 2096float64 float64_sub( struct roundingData *roundData, float64 a, float64 b )
2106{ 2097{
2107 flag aSign, bSign; 2098 flag aSign, bSign;
2108 2099
2109 aSign = extractFloat64Sign( a ); 2100 aSign = extractFloat64Sign( a );
2110 bSign = extractFloat64Sign( b ); 2101 bSign = extractFloat64Sign( b );
2111 if ( aSign == bSign ) { 2102 if ( aSign == bSign ) {
2112 return subFloat64Sigs( a, b, aSign ); 2103 return subFloat64Sigs( roundData, a, b, aSign );
2113 } 2104 }
2114 else { 2105 else {
2115 return addFloat64Sigs( a, b, aSign ); 2106 return addFloat64Sigs( roundData, a, b, aSign );
2116 } 2107 }
2117 2108
2118} 2109}
@@ -2124,7 +2115,7 @@ Returns the result of multiplying the double-precision floating-point values
2124for Binary Floating-point Arithmetic. 2115for Binary Floating-point Arithmetic.
2125------------------------------------------------------------------------------- 2116-------------------------------------------------------------------------------
2126*/ 2117*/
2127float64 float64_mul( float64 a, float64 b ) 2118float64 float64_mul( struct roundingData *roundData, float64 a, float64 b )
2128{ 2119{
2129 flag aSign, bSign, zSign; 2120 flag aSign, bSign, zSign;
2130 int16 aExp, bExp, zExp; 2121 int16 aExp, bExp, zExp;
@@ -2142,7 +2133,7 @@ float64 float64_mul( float64 a, float64 b )
2142 return propagateFloat64NaN( a, b ); 2133 return propagateFloat64NaN( a, b );
2143 } 2134 }
2144 if ( ( bExp | bSig ) == 0 ) { 2135 if ( ( bExp | bSig ) == 0 ) {
2145 float_raise( float_flag_invalid ); 2136 roundData->exception |= float_flag_invalid;
2146 return float64_default_nan; 2137 return float64_default_nan;
2147 } 2138 }
2148 return packFloat64( zSign, 0x7FF, 0 ); 2139 return packFloat64( zSign, 0x7FF, 0 );
@@ -2150,7 +2141,7 @@ float64 float64_mul( float64 a, float64 b )
2150 if ( bExp == 0x7FF ) { 2141 if ( bExp == 0x7FF ) {
2151 if ( bSig ) return propagateFloat64NaN( a, b ); 2142 if ( bSig ) return propagateFloat64NaN( a, b );
2152 if ( ( aExp | aSig ) == 0 ) { 2143 if ( ( aExp | aSig ) == 0 ) {
2153 float_raise( float_flag_invalid ); 2144 roundData->exception |= float_flag_invalid;
2154 return float64_default_nan; 2145 return float64_default_nan;
2155 } 2146 }
2156 return packFloat64( zSign, 0x7FF, 0 ); 2147 return packFloat64( zSign, 0x7FF, 0 );
@@ -2172,7 +2163,7 @@ float64 float64_mul( float64 a, float64 b )
2172 zSig0 <<= 1; 2163 zSig0 <<= 1;
2173 --zExp; 2164 --zExp;
2174 } 2165 }
2175 return roundAndPackFloat64( zSign, zExp, zSig0 ); 2166 return roundAndPackFloat64( roundData, zSign, zExp, zSig0 );
2176 2167
2177} 2168}
2178 2169
@@ -2183,7 +2174,7 @@ by the corresponding value `b'. The operation is performed according to
2183the IEC/IEEE Standard for Binary Floating-point Arithmetic. 2174the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2184------------------------------------------------------------------------------- 2175-------------------------------------------------------------------------------
2185*/ 2176*/
2186float64 float64_div( float64 a, float64 b ) 2177float64 float64_div( struct roundingData *roundData, float64 a, float64 b )
2187{ 2178{
2188 flag aSign, bSign, zSign; 2179 flag aSign, bSign, zSign;
2189 int16 aExp, bExp, zExp; 2180 int16 aExp, bExp, zExp;
@@ -2202,7 +2193,7 @@ float64 float64_div( float64 a, float64 b )
2202 if ( aSig ) return propagateFloat64NaN( a, b ); 2193 if ( aSig ) return propagateFloat64NaN( a, b );
2203 if ( bExp == 0x7FF ) { 2194 if ( bExp == 0x7FF ) {
2204 if ( bSig ) return propagateFloat64NaN( a, b ); 2195 if ( bSig ) return propagateFloat64NaN( a, b );
2205 float_raise( float_flag_invalid ); 2196 roundData->exception |= float_flag_invalid;
2206 return float64_default_nan; 2197 return float64_default_nan;
2207 } 2198 }
2208 return packFloat64( zSign, 0x7FF, 0 ); 2199 return packFloat64( zSign, 0x7FF, 0 );
@@ -2214,10 +2205,10 @@ float64 float64_div( float64 a, float64 b )
2214 if ( bExp == 0 ) { 2205 if ( bExp == 0 ) {
2215 if ( bSig == 0 ) { 2206 if ( bSig == 0 ) {
2216 if ( ( aExp | aSig ) == 0 ) { 2207 if ( ( aExp | aSig ) == 0 ) {
2217 float_raise( float_flag_invalid ); 2208 roundData->exception |= float_flag_invalid;
2218 return float64_default_nan; 2209 return float64_default_nan;
2219 } 2210 }
2220 float_raise( float_flag_divbyzero ); 2211 roundData->exception |= float_flag_divbyzero;
2221 return packFloat64( zSign, 0x7FF, 0 ); 2212 return packFloat64( zSign, 0x7FF, 0 );
2222 } 2213 }
2223 normalizeFloat64Subnormal( bSig, &bExp, &bSig ); 2214 normalizeFloat64Subnormal( bSig, &bExp, &bSig );
@@ -2243,7 +2234,7 @@ float64 float64_div( float64 a, float64 b )
2243 } 2234 }
2244 zSig |= ( rem1 != 0 ); 2235 zSig |= ( rem1 != 0 );
2245 } 2236 }
2246 return roundAndPackFloat64( zSign, zExp, zSig ); 2237 return roundAndPackFloat64( roundData, zSign, zExp, zSig );
2247 2238
2248} 2239}
2249 2240
@@ -2254,7 +2245,7 @@ with respect to the corresponding value `b'. The operation is performed
2254according to the IEC/IEEE Standard for Binary Floating-point Arithmetic. 2245according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2255------------------------------------------------------------------------------- 2246-------------------------------------------------------------------------------
2256*/ 2247*/
2257float64 float64_rem( float64 a, float64 b ) 2248float64 float64_rem( struct roundingData *roundData, float64 a, float64 b )
2258{ 2249{
2259 flag aSign, bSign, zSign; 2250 flag aSign, bSign, zSign;
2260 int16 aExp, bExp, expDiff; 2251 int16 aExp, bExp, expDiff;
@@ -2272,7 +2263,7 @@ float64 float64_rem( float64 a, float64 b )
2272 if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) { 2263 if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
2273 return propagateFloat64NaN( a, b ); 2264 return propagateFloat64NaN( a, b );
2274 } 2265 }
2275 float_raise( float_flag_invalid ); 2266 roundData->exception |= float_flag_invalid;
2276 return float64_default_nan; 2267 return float64_default_nan;
2277 } 2268 }
2278 if ( bExp == 0x7FF ) { 2269 if ( bExp == 0x7FF ) {
@@ -2281,7 +2272,7 @@ float64 float64_rem( float64 a, float64 b )
2281 } 2272 }
2282 if ( bExp == 0 ) { 2273 if ( bExp == 0 ) {
2283 if ( bSig == 0 ) { 2274 if ( bSig == 0 ) {
2284 float_raise( float_flag_invalid ); 2275 roundData->exception |= float_flag_invalid;
2285 return float64_default_nan; 2276 return float64_default_nan;
2286 } 2277 }
2287 normalizeFloat64Subnormal( bSig, &bExp, &bSig ); 2278 normalizeFloat64Subnormal( bSig, &bExp, &bSig );
@@ -2329,7 +2320,7 @@ float64 float64_rem( float64 a, float64 b )
2329 } 2320 }
2330 zSign = ( (sbits64) aSig < 0 ); 2321 zSign = ( (sbits64) aSig < 0 );
2331 if ( zSign ) aSig = - aSig; 2322 if ( zSign ) aSig = - aSig;
2332 return normalizeRoundAndPackFloat64( aSign ^ zSign, bExp, aSig ); 2323 return normalizeRoundAndPackFloat64( roundData, aSign ^ zSign, bExp, aSig );
2333 2324
2334} 2325}
2335 2326
@@ -2340,7 +2331,7 @@ The operation is performed according to the IEC/IEEE Standard for Binary
2340Floating-point Arithmetic. 2331Floating-point Arithmetic.
2341------------------------------------------------------------------------------- 2332-------------------------------------------------------------------------------
2342*/ 2333*/
2343float64 float64_sqrt( float64 a ) 2334float64 float64_sqrt( struct roundingData *roundData, float64 a )
2344{ 2335{
2345 flag aSign; 2336 flag aSign;
2346 int16 aExp, zExp; 2337 int16 aExp, zExp;
@@ -2354,12 +2345,12 @@ float64 float64_sqrt( float64 a )
2354 if ( aExp == 0x7FF ) { 2345 if ( aExp == 0x7FF ) {
2355 if ( aSig ) return propagateFloat64NaN( a, a ); 2346 if ( aSig ) return propagateFloat64NaN( a, a );
2356 if ( ! aSign ) return a; 2347 if ( ! aSign ) return a;
2357 float_raise( float_flag_invalid ); 2348 roundData->exception |= float_flag_invalid;
2358 return float64_default_nan; 2349 return float64_default_nan;
2359 } 2350 }
2360 if ( aSign ) { 2351 if ( aSign ) {
2361 if ( ( aExp | aSig ) == 0 ) return a; 2352 if ( ( aExp | aSig ) == 0 ) return a;
2362 float_raise( float_flag_invalid ); 2353 roundData->exception |= float_flag_invalid;
2363 return float64_default_nan; 2354 return float64_default_nan;
2364 } 2355 }
2365 if ( aExp == 0 ) { 2356 if ( aExp == 0 ) {
@@ -2390,7 +2381,7 @@ float64 float64_sqrt( float64 a )
2390 } 2381 }
2391 } 2382 }
2392 shift64RightJamming( zSig, 1, &zSig ); 2383 shift64RightJamming( zSig, 1, &zSig );
2393 return roundAndPackFloat64( 0, zExp, zSig ); 2384 return roundAndPackFloat64( roundData, 0, zExp, zSig );
2394 2385
2395} 2386}
2396 2387
@@ -2554,7 +2545,7 @@ largest positive integer is returned. Otherwise, if the conversion
2554overflows, the largest integer with the same sign as `a' is returned. 2545overflows, the largest integer with the same sign as `a' is returned.
2555------------------------------------------------------------------------------- 2546-------------------------------------------------------------------------------
2556*/ 2547*/
2557int32 floatx80_to_int32( floatx80 a ) 2548int32 floatx80_to_int32( struct roundingData *roundData, floatx80 a )
2558{ 2549{
2559 flag aSign; 2550 flag aSign;
2560 int32 aExp, shiftCount; 2551 int32 aExp, shiftCount;
@@ -2567,7 +2558,7 @@ int32 floatx80_to_int32( floatx80 a )
2567 shiftCount = 0x4037 - aExp; 2558 shiftCount = 0x4037 - aExp;
2568 if ( shiftCount <= 0 ) shiftCount = 1; 2559 if ( shiftCount <= 0 ) shiftCount = 1;
2569 shift64RightJamming( aSig, shiftCount, &aSig ); 2560 shift64RightJamming( aSig, shiftCount, &aSig );
2570 return roundAndPackInt32( aSign, aSig ); 2561 return roundAndPackInt32( roundData, aSign, aSig );
2571 2562
2572} 2563}
2573 2564
@@ -2598,7 +2589,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a )
2598 goto invalid; 2589 goto invalid;
2599 } 2590 }
2600 else if ( 63 < shiftCount ) { 2591 else if ( 63 < shiftCount ) {
2601 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact; 2592 if ( aExp || aSig ) float_raise( float_flag_inexact );
2602 return 0; 2593 return 0;
2603 } 2594 }
2604 savedASig = aSig; 2595 savedASig = aSig;
@@ -2607,11 +2598,11 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a )
2607 if ( aSign ) z = - z; 2598 if ( aSign ) z = - z;
2608 if ( ( z < 0 ) ^ aSign ) { 2599 if ( ( z < 0 ) ^ aSign ) {
2609 invalid: 2600 invalid:
2610 float_exception_flags |= float_flag_invalid; 2601 float_raise( float_flag_invalid );
2611 return aSign ? 0x80000000 : 0x7FFFFFFF; 2602 return aSign ? 0x80000000 : 0x7FFFFFFF;
2612 } 2603 }
2613 if ( ( aSig<<shiftCount ) != savedASig ) { 2604 if ( ( aSig<<shiftCount ) != savedASig ) {
2614 float_exception_flags |= float_flag_inexact; 2605 float_raise( float_flag_inexact );
2615 } 2606 }
2616 return z; 2607 return z;
2617 2608
@@ -2625,7 +2616,7 @@ conversion is performed according to the IEC/IEEE Standard for Binary
2625Floating-point Arithmetic. 2616Floating-point Arithmetic.
2626------------------------------------------------------------------------------- 2617-------------------------------------------------------------------------------
2627*/ 2618*/
2628float32 floatx80_to_float32( floatx80 a ) 2619float32 floatx80_to_float32( struct roundingData *roundData, floatx80 a )
2629{ 2620{
2630 flag aSign; 2621 flag aSign;
2631 int32 aExp; 2622 int32 aExp;
@@ -2642,7 +2633,7 @@ float32 floatx80_to_float32( floatx80 a )
2642 } 2633 }
2643 shift64RightJamming( aSig, 33, &aSig ); 2634 shift64RightJamming( aSig, 33, &aSig );
2644 if ( aExp || aSig ) aExp -= 0x3F81; 2635 if ( aExp || aSig ) aExp -= 0x3F81;
2645 return roundAndPackFloat32( aSign, aExp, aSig ); 2636 return roundAndPackFloat32( roundData, aSign, aExp, aSig );
2646 2637
2647} 2638}
2648 2639
@@ -2654,7 +2645,7 @@ conversion is performed according to the IEC/IEEE Standard for Binary
2654Floating-point Arithmetic. 2645Floating-point Arithmetic.
2655------------------------------------------------------------------------------- 2646-------------------------------------------------------------------------------
2656*/ 2647*/
2657float64 floatx80_to_float64( floatx80 a ) 2648float64 floatx80_to_float64( struct roundingData *roundData, floatx80 a )
2658{ 2649{
2659 flag aSign; 2650 flag aSign;
2660 int32 aExp; 2651 int32 aExp;
@@ -2671,7 +2662,7 @@ float64 floatx80_to_float64( floatx80 a )
2671 } 2662 }
2672 shift64RightJamming( aSig, 1, &zSig ); 2663 shift64RightJamming( aSig, 1, &zSig );
2673 if ( aExp || aSig ) aExp -= 0x3C01; 2664 if ( aExp || aSig ) aExp -= 0x3C01;
2674 return roundAndPackFloat64( aSign, aExp, zSig ); 2665 return roundAndPackFloat64( roundData, aSign, aExp, zSig );
2675 2666
2676} 2667}
2677 2668
@@ -2683,7 +2674,7 @@ value. The operation is performed according to the IEC/IEEE Standard for
2683Binary Floating-point Arithmetic. 2674Binary Floating-point Arithmetic.
2684------------------------------------------------------------------------------- 2675-------------------------------------------------------------------------------
2685*/ 2676*/
2686floatx80 floatx80_round_to_int( floatx80 a ) 2677floatx80 floatx80_round_to_int( struct roundingData *roundData, floatx80 a )
2687{ 2678{
2688 flag aSign; 2679 flag aSign;
2689 int32 aExp; 2680 int32 aExp;
@@ -2703,9 +2694,9 @@ floatx80 floatx80_round_to_int( floatx80 a )
2703 && ( (bits64) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) { 2694 && ( (bits64) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) {
2704 return a; 2695 return a;
2705 } 2696 }
2706 float_exception_flags |= float_flag_inexact; 2697 roundData->exception |= float_flag_inexact;
2707 aSign = extractFloatx80Sign( a ); 2698 aSign = extractFloatx80Sign( a );
2708 switch ( float_rounding_mode ) { 2699 switch ( roundData->mode ) {
2709 case float_round_nearest_even: 2700 case float_round_nearest_even:
2710 if ( ( aExp == 0x3FFE ) && (bits64) ( extractFloatx80Frac( a )<<1 ) 2701 if ( ( aExp == 0x3FFE ) && (bits64) ( extractFloatx80Frac( a )<<1 )
2711 ) { 2702 ) {
@@ -2729,7 +2720,7 @@ floatx80 floatx80_round_to_int( floatx80 a )
2729 lastBitMask <<= 0x403E - aExp; 2720 lastBitMask <<= 0x403E - aExp;
2730 roundBitsMask = lastBitMask - 1; 2721 roundBitsMask = lastBitMask - 1;
2731 z = a; 2722 z = a;
2732 roundingMode = float_rounding_mode; 2723 roundingMode = roundData->mode;
2733 if ( roundingMode == float_round_nearest_even ) { 2724 if ( roundingMode == float_round_nearest_even ) {
2734 z.low += lastBitMask>>1; 2725 z.low += lastBitMask>>1;
2735 if ( ( z.low & roundBitsMask ) == 0 ) z.low &= ~ lastBitMask; 2726 if ( ( z.low & roundBitsMask ) == 0 ) z.low &= ~ lastBitMask;
@@ -2744,7 +2735,7 @@ floatx80 floatx80_round_to_int( floatx80 a )
2744 ++z.high; 2735 ++z.high;
2745 z.low = LIT64( 0x8000000000000000 ); 2736 z.low = LIT64( 0x8000000000000000 );
2746 } 2737 }
2747 if ( z.low != a.low ) float_exception_flags |= float_flag_inexact; 2738 if ( z.low != a.low ) roundData->exception |= float_flag_inexact;
2748 return z; 2739 return z;
2749 2740
2750} 2741}
@@ -2758,7 +2749,7 @@ The addition is performed according to the IEC/IEEE Standard for Binary
2758Floating-point Arithmetic. 2749Floating-point Arithmetic.
2759------------------------------------------------------------------------------- 2750-------------------------------------------------------------------------------
2760*/ 2751*/
2761static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign ) 2752static floatx80 addFloatx80Sigs( struct roundingData *roundData, floatx80 a, floatx80 b, flag zSign )
2762{ 2753{
2763 int32 aExp, bExp, zExp; 2754 int32 aExp, bExp, zExp;
2764 bits64 aSig, bSig, zSig0, zSig1; 2755 bits64 aSig, bSig, zSig0, zSig1;
@@ -2814,7 +2805,7 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2814 roundAndPack: 2805 roundAndPack:
2815 return 2806 return
2816 roundAndPackFloatx80( 2807 roundAndPackFloatx80(
2817 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 ); 2808 roundData, zSign, zExp, zSig0, zSig1 );
2818 2809
2819} 2810}
2820 2811
@@ -2827,7 +2818,7 @@ result is a NaN. The subtraction is performed according to the IEC/IEEE
2827Standard for Binary Floating-point Arithmetic. 2818Standard for Binary Floating-point Arithmetic.
2828------------------------------------------------------------------------------- 2819-------------------------------------------------------------------------------
2829*/ 2820*/
2830static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign ) 2821static floatx80 subFloatx80Sigs( struct roundingData *roundData, floatx80 a, floatx80 b, flag zSign )
2831{ 2822{
2832 int32 aExp, bExp, zExp; 2823 int32 aExp, bExp, zExp;
2833 bits64 aSig, bSig, zSig0, zSig1; 2824 bits64 aSig, bSig, zSig0, zSig1;
@@ -2845,7 +2836,7 @@ static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2845 if ( (bits64) ( ( aSig | bSig )<<1 ) ) { 2836 if ( (bits64) ( ( aSig | bSig )<<1 ) ) {
2846 return propagateFloatx80NaN( a, b ); 2837 return propagateFloatx80NaN( a, b );
2847 } 2838 }
2848 float_raise( float_flag_invalid ); 2839 roundData->exception |= float_flag_invalid;
2849 z.low = floatx80_default_nan_low; 2840 z.low = floatx80_default_nan_low;
2850 z.high = floatx80_default_nan_high; 2841 z.high = floatx80_default_nan_high;
2851 return z; 2842 return z;
@@ -2857,7 +2848,7 @@ static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2857 zSig1 = 0; 2848 zSig1 = 0;
2858 if ( bSig < aSig ) goto aBigger; 2849 if ( bSig < aSig ) goto aBigger;
2859 if ( aSig < bSig ) goto bBigger; 2850 if ( aSig < bSig ) goto bBigger;
2860 return packFloatx80( float_rounding_mode == float_round_down, 0, 0 ); 2851 return packFloatx80( roundData->mode == float_round_down, 0, 0 );
2861 bExpBigger: 2852 bExpBigger:
2862 if ( bExp == 0x7FFF ) { 2853 if ( bExp == 0x7FFF ) {
2863 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b ); 2854 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
@@ -2883,7 +2874,7 @@ static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2883 normalizeRoundAndPack: 2874 normalizeRoundAndPack:
2884 return 2875 return
2885 normalizeRoundAndPackFloatx80( 2876 normalizeRoundAndPackFloatx80(
2886 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 ); 2877 roundData, zSign, zExp, zSig0, zSig1 );
2887 2878
2888} 2879}
2889 2880
@@ -2894,17 +2885,17 @@ values `a' and `b'. The operation is performed according to the IEC/IEEE
2894Standard for Binary Floating-point Arithmetic. 2885Standard for Binary Floating-point Arithmetic.
2895------------------------------------------------------------------------------- 2886-------------------------------------------------------------------------------
2896*/ 2887*/
2897floatx80 floatx80_add( floatx80 a, floatx80 b ) 2888floatx80 floatx80_add( struct roundingData *roundData, floatx80 a, floatx80 b )
2898{ 2889{
2899 flag aSign, bSign; 2890 flag aSign, bSign;
2900 2891
2901 aSign = extractFloatx80Sign( a ); 2892 aSign = extractFloatx80Sign( a );
2902 bSign = extractFloatx80Sign( b ); 2893 bSign = extractFloatx80Sign( b );
2903 if ( aSign == bSign ) { 2894 if ( aSign == bSign ) {
2904 return addFloatx80Sigs( a, b, aSign ); 2895 return addFloatx80Sigs( roundData, a, b, aSign );
2905 } 2896 }
2906 else { 2897 else {
2907 return subFloatx80Sigs( a, b, aSign ); 2898 return subFloatx80Sigs( roundData, a, b, aSign );
2908 } 2899 }
2909 2900
2910} 2901}
@@ -2916,17 +2907,17 @@ point values `a' and `b'. The operation is performed according to the
2916IEC/IEEE Standard for Binary Floating-point Arithmetic. 2907IEC/IEEE Standard for Binary Floating-point Arithmetic.
2917------------------------------------------------------------------------------- 2908-------------------------------------------------------------------------------
2918*/ 2909*/
2919floatx80 floatx80_sub( floatx80 a, floatx80 b ) 2910floatx80 floatx80_sub( struct roundingData *roundData, floatx80 a, floatx80 b )
2920{ 2911{
2921 flag aSign, bSign; 2912 flag aSign, bSign;
2922 2913
2923 aSign = extractFloatx80Sign( a ); 2914 aSign = extractFloatx80Sign( a );
2924 bSign = extractFloatx80Sign( b ); 2915 bSign = extractFloatx80Sign( b );
2925 if ( aSign == bSign ) { 2916 if ( aSign == bSign ) {
2926 return subFloatx80Sigs( a, b, aSign ); 2917 return subFloatx80Sigs( roundData, a, b, aSign );
2927 } 2918 }
2928 else { 2919 else {
2929 return addFloatx80Sigs( a, b, aSign ); 2920 return addFloatx80Sigs( roundData, a, b, aSign );
2930 } 2921 }
2931 2922
2932} 2923}
@@ -2938,7 +2929,7 @@ point values `a' and `b'. The operation is performed according to the
2938IEC/IEEE Standard for Binary Floating-point Arithmetic. 2929IEC/IEEE Standard for Binary Floating-point Arithmetic.
2939------------------------------------------------------------------------------- 2930-------------------------------------------------------------------------------
2940*/ 2931*/
2941floatx80 floatx80_mul( floatx80 a, floatx80 b ) 2932floatx80 floatx80_mul( struct roundingData *roundData, floatx80 a, floatx80 b )
2942{ 2933{
2943 flag aSign, bSign, zSign; 2934 flag aSign, bSign, zSign;
2944 int32 aExp, bExp, zExp; 2935 int32 aExp, bExp, zExp;
@@ -2964,7 +2955,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b )
2964 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b ); 2955 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
2965 if ( ( aExp | aSig ) == 0 ) { 2956 if ( ( aExp | aSig ) == 0 ) {
2966 invalid: 2957 invalid:
2967 float_raise( float_flag_invalid ); 2958 roundData->exception |= float_flag_invalid;
2968 z.low = floatx80_default_nan_low; 2959 z.low = floatx80_default_nan_low;
2969 z.high = floatx80_default_nan_high; 2960 z.high = floatx80_default_nan_high;
2970 return z; 2961 return z;
@@ -2987,7 +2978,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b )
2987 } 2978 }
2988 return 2979 return
2989 roundAndPackFloatx80( 2980 roundAndPackFloatx80(
2990 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 ); 2981 roundData, zSign, zExp, zSig0, zSig1 );
2991 2982
2992} 2983}
2993 2984
@@ -2998,7 +2989,7 @@ value `a' by the corresponding value `b'. The operation is performed
2998according to the IEC/IEEE Standard for Binary Floating-point Arithmetic. 2989according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2999------------------------------------------------------------------------------- 2990-------------------------------------------------------------------------------
3000*/ 2991*/
3001floatx80 floatx80_div( floatx80 a, floatx80 b ) 2992floatx80 floatx80_div( struct roundingData *roundData, floatx80 a, floatx80 b )
3002{ 2993{
3003 flag aSign, bSign, zSign; 2994 flag aSign, bSign, zSign;
3004 int32 aExp, bExp, zExp; 2995 int32 aExp, bExp, zExp;
@@ -3029,12 +3020,12 @@ floatx80 floatx80_div( floatx80 a, floatx80 b )
3029 if ( bSig == 0 ) { 3020 if ( bSig == 0 ) {
3030 if ( ( aExp | aSig ) == 0 ) { 3021 if ( ( aExp | aSig ) == 0 ) {
3031 invalid: 3022 invalid:
3032 float_raise( float_flag_invalid ); 3023 roundData->exception |= float_flag_invalid;
3033 z.low = floatx80_default_nan_low; 3024 z.low = floatx80_default_nan_low;
3034 z.high = floatx80_default_nan_high; 3025 z.high = floatx80_default_nan_high;
3035 return z; 3026 return z;
3036 } 3027 }
3037 float_raise( float_flag_divbyzero ); 3028 roundData->exception |= float_flag_divbyzero;
3038 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); 3029 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
3039 } 3030 }
3040 normalizeFloatx80Subnormal( bSig, &bExp, &bSig ); 3031 normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
@@ -3068,7 +3059,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b )
3068 } 3059 }
3069 return 3060 return
3070 roundAndPackFloatx80( 3061 roundAndPackFloatx80(
3071 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 ); 3062 roundData, zSign, zExp, zSig0, zSig1 );
3072 3063
3073} 3064}
3074 3065
@@ -3079,7 +3070,7 @@ Returns the remainder of the extended double-precision floating-point value
3079according to the IEC/IEEE Standard for Binary Floating-point Arithmetic. 3070according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
3080------------------------------------------------------------------------------- 3071-------------------------------------------------------------------------------
3081*/ 3072*/
3082floatx80 floatx80_rem( floatx80 a, floatx80 b ) 3073floatx80 floatx80_rem( struct roundingData *roundData, floatx80 a, floatx80 b )
3083{ 3074{
3084 flag aSign, bSign, zSign; 3075 flag aSign, bSign, zSign;
3085 int32 aExp, bExp, expDiff; 3076 int32 aExp, bExp, expDiff;
@@ -3107,7 +3098,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b )
3107 if ( bExp == 0 ) { 3098 if ( bExp == 0 ) {
3108 if ( bSig == 0 ) { 3099 if ( bSig == 0 ) {
3109 invalid: 3100 invalid:
3110 float_raise( float_flag_invalid ); 3101 roundData->exception |= float_flag_invalid;
3111 z.low = floatx80_default_nan_low; 3102 z.low = floatx80_default_nan_low;
3112 z.high = floatx80_default_nan_high; 3103 z.high = floatx80_default_nan_high;
3113 return z; 3104 return z;
@@ -3164,9 +3155,10 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b )
3164 aSig1 = alternateASig1; 3155 aSig1 = alternateASig1;
3165 zSign = ! zSign; 3156 zSign = ! zSign;
3166 } 3157 }
3158
3167 return 3159 return
3168 normalizeRoundAndPackFloatx80( 3160 normalizeRoundAndPackFloatx80(
3169 80, zSign, bExp + expDiff, aSig0, aSig1 ); 3161 roundData, zSign, bExp + expDiff, aSig0, aSig1 );
3170 3162
3171} 3163}
3172 3164
@@ -3177,7 +3169,7 @@ value `a'. The operation is performed according to the IEC/IEEE Standard
3177for Binary Floating-point Arithmetic. 3169for Binary Floating-point Arithmetic.
3178------------------------------------------------------------------------------- 3170-------------------------------------------------------------------------------
3179*/ 3171*/
3180floatx80 floatx80_sqrt( floatx80 a ) 3172floatx80 floatx80_sqrt( struct roundingData *roundData, floatx80 a )
3181{ 3173{
3182 flag aSign; 3174 flag aSign;
3183 int32 aExp, zExp; 3175 int32 aExp, zExp;
@@ -3197,7 +3189,7 @@ floatx80 floatx80_sqrt( floatx80 a )
3197 if ( aSign ) { 3189 if ( aSign ) {
3198 if ( ( aExp | aSig0 ) == 0 ) return a; 3190 if ( ( aExp | aSig0 ) == 0 ) return a;
3199 invalid: 3191 invalid:
3200 float_raise( float_flag_invalid ); 3192 roundData->exception |= float_flag_invalid;
3201 z.low = floatx80_default_nan_low; 3193 z.low = floatx80_default_nan_low;
3202 z.high = floatx80_default_nan_high; 3194 z.high = floatx80_default_nan_high;
3203 return z; 3195 return z;
@@ -3242,7 +3234,7 @@ floatx80 floatx80_sqrt( floatx80 a )
3242 } 3234 }
3243 return 3235 return
3244 roundAndPackFloatx80( 3236 roundAndPackFloatx80(
3245 floatx80_rounding_precision, 0, zExp, zSig0, zSig1 ); 3237 roundData, 0, zExp, zSig0, zSig1 );
3246 3238
3247} 3239}
3248 3240
@@ -3264,7 +3256,7 @@ flag floatx80_eq( floatx80 a, floatx80 b )
3264 ) { 3256 ) {
3265 if ( floatx80_is_signaling_nan( a ) 3257 if ( floatx80_is_signaling_nan( a )
3266 || floatx80_is_signaling_nan( b ) ) { 3258 || floatx80_is_signaling_nan( b ) ) {
3267 float_raise( float_flag_invalid ); 3259 roundData->exception |= float_flag_invalid;
3268 } 3260 }
3269 return 0; 3261 return 0;
3270 } 3262 }
@@ -3294,7 +3286,7 @@ flag floatx80_le( floatx80 a, floatx80 b )
3294 || ( ( extractFloatx80Exp( b ) == 0x7FFF ) 3286 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3295 && (bits64) ( extractFloatx80Frac( b )<<1 ) ) 3287 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3296 ) { 3288 ) {
3297 float_raise( float_flag_invalid ); 3289 roundData->exception |= float_flag_invalid;
3298 return 0; 3290 return 0;
3299 } 3291 }
3300 aSign = extractFloatx80Sign( a ); 3292 aSign = extractFloatx80Sign( a );
@@ -3328,7 +3320,7 @@ flag floatx80_lt( floatx80 a, floatx80 b )
3328 || ( ( extractFloatx80Exp( b ) == 0x7FFF ) 3320 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3329 && (bits64) ( extractFloatx80Frac( b )<<1 ) ) 3321 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3330 ) { 3322 ) {
3331 float_raise( float_flag_invalid ); 3323 roundData->exception |= float_flag_invalid;
3332 return 0; 3324 return 0;
3333 } 3325 }
3334 aSign = extractFloatx80Sign( a ); 3326 aSign = extractFloatx80Sign( a );
@@ -3361,7 +3353,7 @@ flag floatx80_eq_signaling( floatx80 a, floatx80 b )
3361 || ( ( extractFloatx80Exp( b ) == 0x7FFF ) 3353 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3362 && (bits64) ( extractFloatx80Frac( b )<<1 ) ) 3354 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3363 ) { 3355 ) {
3364 float_raise( float_flag_invalid ); 3356 roundData->exception |= float_flag_invalid;
3365 return 0; 3357 return 0;
3366 } 3358 }
3367 return 3359 return
@@ -3392,7 +3384,7 @@ flag floatx80_le_quiet( floatx80 a, floatx80 b )
3392 ) { 3384 ) {
3393 if ( floatx80_is_signaling_nan( a ) 3385 if ( floatx80_is_signaling_nan( a )
3394 || floatx80_is_signaling_nan( b ) ) { 3386 || floatx80_is_signaling_nan( b ) ) {
3395 float_raise( float_flag_invalid ); 3387 roundData->exception |= float_flag_invalid;
3396 } 3388 }
3397 return 0; 3389 return 0;
3398 } 3390 }
@@ -3429,7 +3421,7 @@ flag floatx80_lt_quiet( floatx80 a, floatx80 b )
3429 ) { 3421 ) {
3430 if ( floatx80_is_signaling_nan( a ) 3422 if ( floatx80_is_signaling_nan( a )
3431 || floatx80_is_signaling_nan( b ) ) { 3423 || floatx80_is_signaling_nan( b ) ) {
3432 float_raise( float_flag_invalid ); 3424 roundData->exception |= float_flag_invalid;
3433 } 3425 }
3434 return 0; 3426 return 0;
3435 } 3427 }
diff --git a/arch/arm/nwfpe/softfloat.h b/arch/arm/nwfpe/softfloat.h
index 1e1743173899..1c8799b9ee4d 100644
--- a/arch/arm/nwfpe/softfloat.h
+++ b/arch/arm/nwfpe/softfloat.h
@@ -74,7 +74,7 @@ enum {
74Software IEC/IEEE floating-point rounding mode. 74Software IEC/IEEE floating-point rounding mode.
75------------------------------------------------------------------------------- 75-------------------------------------------------------------------------------
76*/ 76*/
77extern signed char float_rounding_mode; 77//extern int8 float_rounding_mode;
78enum { 78enum {
79 float_round_nearest_even = 0, 79 float_round_nearest_even = 0,
80 float_round_to_zero = 1, 80 float_round_to_zero = 1,
@@ -86,7 +86,6 @@ enum {
86------------------------------------------------------------------------------- 86-------------------------------------------------------------------------------
87Software IEC/IEEE floating-point exception flags. 87Software IEC/IEEE floating-point exception flags.
88------------------------------------------------------------------------------- 88-------------------------------------------------------------------------------
89extern signed char float_exception_flags;
90enum { 89enum {
91 float_flag_inexact = 1, 90 float_flag_inexact = 1,
92 float_flag_underflow = 2, 91 float_flag_underflow = 2,
@@ -99,7 +98,6 @@ ScottB: November 4, 1998
99Changed the enumeration to match the bit order in the FPA11. 98Changed the enumeration to match the bit order in the FPA11.
100*/ 99*/
101 100
102extern signed char float_exception_flags;
103enum { 101enum {
104 float_flag_invalid = 1, 102 float_flag_invalid = 1,
105 float_flag_divbyzero = 2, 103 float_flag_divbyzero = 2,
@@ -121,7 +119,7 @@ void float_raise( signed char );
121Software IEC/IEEE integer-to-floating-point conversion routines. 119Software IEC/IEEE integer-to-floating-point conversion routines.
122------------------------------------------------------------------------------- 120-------------------------------------------------------------------------------
123*/ 121*/
124float32 int32_to_float32( signed int ); 122float32 int32_to_float32( struct roundingData *, signed int );
125float64 int32_to_float64( signed int ); 123float64 int32_to_float64( signed int );
126#ifdef FLOATX80 124#ifdef FLOATX80
127floatx80 int32_to_floatx80( signed int ); 125floatx80 int32_to_floatx80( signed int );
@@ -132,7 +130,7 @@ floatx80 int32_to_floatx80( signed int );
132Software IEC/IEEE single-precision conversion routines. 130Software IEC/IEEE single-precision conversion routines.
133------------------------------------------------------------------------------- 131-------------------------------------------------------------------------------
134*/ 132*/
135signed int float32_to_int32( float32 ); 133signed int float32_to_int32( struct roundingData *, float32 );
136signed int float32_to_int32_round_to_zero( float32 ); 134signed int float32_to_int32_round_to_zero( float32 );
137float64 float32_to_float64( float32 ); 135float64 float32_to_float64( float32 );
138#ifdef FLOATX80 136#ifdef FLOATX80
@@ -144,13 +142,13 @@ floatx80 float32_to_floatx80( float32 );
144Software IEC/IEEE single-precision operations. 142Software IEC/IEEE single-precision operations.
145------------------------------------------------------------------------------- 143-------------------------------------------------------------------------------
146*/ 144*/
147float32 float32_round_to_int( float32 ); 145float32 float32_round_to_int( struct roundingData*, float32 );
148float32 float32_add( float32, float32 ); 146float32 float32_add( struct roundingData *, float32, float32 );
149float32 float32_sub( float32, float32 ); 147float32 float32_sub( struct roundingData *, float32, float32 );
150float32 float32_mul( float32, float32 ); 148float32 float32_mul( struct roundingData *, float32, float32 );
151float32 float32_div( float32, float32 ); 149float32 float32_div( struct roundingData *, float32, float32 );
152float32 float32_rem( float32, float32 ); 150float32 float32_rem( struct roundingData *, float32, float32 );
153float32 float32_sqrt( float32 ); 151float32 float32_sqrt( struct roundingData*, float32 );
154char float32_eq( float32, float32 ); 152char float32_eq( float32, float32 );
155char float32_le( float32, float32 ); 153char float32_le( float32, float32 );
156char float32_lt( float32, float32 ); 154char float32_lt( float32, float32 );
@@ -164,9 +162,9 @@ char float32_is_signaling_nan( float32 );
164Software IEC/IEEE double-precision conversion routines. 162Software IEC/IEEE double-precision conversion routines.
165------------------------------------------------------------------------------- 163-------------------------------------------------------------------------------
166*/ 164*/
167signed int float64_to_int32( float64 ); 165signed int float64_to_int32( struct roundingData *, float64 );
168signed int float64_to_int32_round_to_zero( float64 ); 166signed int float64_to_int32_round_to_zero( float64 );
169float32 float64_to_float32( float64 ); 167float32 float64_to_float32( struct roundingData *, float64 );
170#ifdef FLOATX80 168#ifdef FLOATX80
171floatx80 float64_to_floatx80( float64 ); 169floatx80 float64_to_floatx80( float64 );
172#endif 170#endif
@@ -176,13 +174,13 @@ floatx80 float64_to_floatx80( float64 );
176Software IEC/IEEE double-precision operations. 174Software IEC/IEEE double-precision operations.
177------------------------------------------------------------------------------- 175-------------------------------------------------------------------------------
178*/ 176*/
179float64 float64_round_to_int( float64 ); 177float64 float64_round_to_int( struct roundingData *, float64 );
180float64 float64_add( float64, float64 ); 178float64 float64_add( struct roundingData *, float64, float64 );
181float64 float64_sub( float64, float64 ); 179float64 float64_sub( struct roundingData *, float64, float64 );
182float64 float64_mul( float64, float64 ); 180float64 float64_mul( struct roundingData *, float64, float64 );
183float64 float64_div( float64, float64 ); 181float64 float64_div( struct roundingData *, float64, float64 );
184float64 float64_rem( float64, float64 ); 182float64 float64_rem( struct roundingData *, float64, float64 );
185float64 float64_sqrt( float64 ); 183float64 float64_sqrt( struct roundingData *, float64 );
186char float64_eq( float64, float64 ); 184char float64_eq( float64, float64 );
187char float64_le( float64, float64 ); 185char float64_le( float64, float64 );
188char float64_lt( float64, float64 ); 186char float64_lt( float64, float64 );
@@ -198,31 +196,23 @@ char float64_is_signaling_nan( float64 );
198Software IEC/IEEE extended double-precision conversion routines. 196Software IEC/IEEE extended double-precision conversion routines.
199------------------------------------------------------------------------------- 197-------------------------------------------------------------------------------
200*/ 198*/
201signed int floatx80_to_int32( floatx80 ); 199signed int floatx80_to_int32( struct roundingData *, floatx80 );
202signed int floatx80_to_int32_round_to_zero( floatx80 ); 200signed int floatx80_to_int32_round_to_zero( floatx80 );
203float32 floatx80_to_float32( floatx80 ); 201float32 floatx80_to_float32( struct roundingData *, floatx80 );
204float64 floatx80_to_float64( floatx80 ); 202float64 floatx80_to_float64( struct roundingData *, floatx80 );
205
206/*
207-------------------------------------------------------------------------------
208Software IEC/IEEE extended double-precision rounding precision. Valid
209values are 32, 64, and 80.
210-------------------------------------------------------------------------------
211*/
212extern signed char floatx80_rounding_precision;
213 203
214/* 204/*
215------------------------------------------------------------------------------- 205-------------------------------------------------------------------------------
216Software IEC/IEEE extended double-precision operations. 206Software IEC/IEEE extended double-precision operations.
217------------------------------------------------------------------------------- 207-------------------------------------------------------------------------------
218*/ 208*/
219floatx80 floatx80_round_to_int( floatx80 ); 209floatx80 floatx80_round_to_int( struct roundingData *, floatx80 );
220floatx80 floatx80_add( floatx80, floatx80 ); 210floatx80 floatx80_add( struct roundingData *, floatx80, floatx80 );
221floatx80 floatx80_sub( floatx80, floatx80 ); 211floatx80 floatx80_sub( struct roundingData *, floatx80, floatx80 );
222floatx80 floatx80_mul( floatx80, floatx80 ); 212floatx80 floatx80_mul( struct roundingData *, floatx80, floatx80 );
223floatx80 floatx80_div( floatx80, floatx80 ); 213floatx80 floatx80_div( struct roundingData *, floatx80, floatx80 );
224floatx80 floatx80_rem( floatx80, floatx80 ); 214floatx80 floatx80_rem( struct roundingData *, floatx80, floatx80 );
225floatx80 floatx80_sqrt( floatx80 ); 215floatx80 floatx80_sqrt( struct roundingData *, floatx80 );
226char floatx80_eq( floatx80, floatx80 ); 216char floatx80_eq( floatx80, floatx80 );
227char floatx80_le( floatx80, floatx80 ); 217char floatx80_le( floatx80, floatx80 );
228char floatx80_lt( floatx80, floatx80 ); 218char floatx80_lt( floatx80, floatx80 );
diff --git a/arch/arm/oprofile/backtrace.c b/arch/arm/oprofile/backtrace.c
index ec58d3e2eb8b..df35c452a8bf 100644
--- a/arch/arm/oprofile/backtrace.c
+++ b/arch/arm/oprofile/backtrace.c
@@ -115,7 +115,7 @@ static int valid_kernel_stack(struct frame_tail *tail, struct pt_regs *regs)
115 return (tailaddr > stack) && (tailaddr < stack_base); 115 return (tailaddr > stack) && (tailaddr < stack_base);
116} 116}
117 117
118void arm_backtrace(struct pt_regs const *regs, unsigned int depth) 118void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
119{ 119{
120 struct frame_tail *tail; 120 struct frame_tail *tail;
121 unsigned long last_address = 0; 121 unsigned long last_address = 0;
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index b801cd66b6ea..9b367a65cb4d 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -770,6 +770,9 @@ vfp_double_add(struct vfp_double *vdd, struct vfp_double *vdn,
770 if ((s64)m_sig < 0) { 770 if ((s64)m_sig < 0) {
771 vdd->sign = vfp_sign_negate(vdd->sign); 771 vdd->sign = vfp_sign_negate(vdd->sign);
772 m_sig = -m_sig; 772 m_sig = -m_sig;
773 } else if (m_sig == 0) {
774 vdd->sign = (fpscr & FPSCR_RMODE_MASK) ==
775 FPSCR_ROUND_MINUSINF ? 0x8000 : 0;
773 } 776 }
774 } else { 777 } else {
775 m_sig += vdn->significand; 778 m_sig += vdn->significand;
diff --git a/arch/arm26/mm/fault.c b/arch/arm26/mm/fault.c
index dacca8bb7744..bd6f2db608b7 100644
--- a/arch/arm26/mm/fault.c
+++ b/arch/arm26/mm/fault.c
@@ -176,12 +176,12 @@ survive:
176 * Handle the "normal" cases first - successful and sigbus 176 * Handle the "normal" cases first - successful and sigbus
177 */ 177 */
178 switch (fault) { 178 switch (fault) {
179 case 2: 179 case VM_FAULT_MAJOR:
180 tsk->maj_flt++; 180 tsk->maj_flt++;
181 return fault; 181 return fault;
182 case 1: 182 case VM_FAULT_MINOR:
183 tsk->min_flt++; 183 tsk->min_flt++;
184 case 0: 184 case VM_FAULT_SIGBUS:
185 return fault; 185 return fault;
186 } 186 }
187 187
@@ -226,14 +226,11 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
226 /* 226 /*
227 * Handle the "normal" case first 227 * Handle the "normal" case first
228 */ 228 */
229 if (fault > 0) 229 switch (fault) {
230 case VM_FAULT_MINOR:
231 case VM_FAULT_MAJOR:
230 return 0; 232 return 0;
231 233 case VM_FAULT_SIGBUS:
232 /*
233 * We had some memory, but were unable to
234 * successfully fix up this page fault.
235 */
236 if (fault == 0){
237 goto do_sigbus; 234 goto do_sigbus;
238 } 235 }
239 236
diff --git a/arch/cris/Kconfig.debug b/arch/cris/Kconfig.debug
index f42918bf22a9..cd72324935c4 100644
--- a/arch/cris/Kconfig.debug
+++ b/arch/cris/Kconfig.debug
@@ -38,4 +38,9 @@ config FRAME_POINTER
38 If you don't debug the kernel, you can say N, but we may not be able 38 If you don't debug the kernel, you can say N, but we may not be able
39 to solve problems without frame pointers. 39 to solve problems without frame pointers.
40 40
41config DEBUG_NMI_OOPS
42 bool "NMI causes oops printout"
43 help
44 If the system locks up without any debug information you can say Y
45 here to make it possible to dump an OOPS with an external NMI.
41endmenu 46endmenu
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 9d28fa8563cc..90ca8730b120 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.23 2004/10/19 13:07:34 starvik Exp $ 1# $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $
2# cris/Makefile 2# cris/Makefile
3# 3#
4# This file is included by the global makefile so that you can add your own 4# This file is included by the global makefile so that you can add your own
@@ -15,6 +15,7 @@
15 15
16arch-y := v10 16arch-y := v10
17arch-$(CONFIG_ETRAX_ARCH_V10) := v10 17arch-$(CONFIG_ETRAX_ARCH_V10) := v10
18arch-$(CONFIG_ETRAX_ARCH_V32) := v32
18 19
19# No config avaiable for make clean etc 20# No config avaiable for make clean etc
20ifneq ($(arch-y),) 21ifneq ($(arch-y),)
@@ -46,6 +47,21 @@ core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
46drivers-y += arch/$(ARCH)/$(SARCH)/drivers/ 47drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
47libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC) 48libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
48 49
50# cris source path
51SRC_ARCH = $(srctree)/arch/$(ARCH)
52# cris object files path
53OBJ_ARCH = $(objtree)/arch/$(ARCH)
54
55target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot
56target_boot_dir = $(OBJ_ARCH)/boot
57src_boot_dir = $(SRC_ARCH)/boot
58target_compressed_dir = $(OBJ_ARCH)/boot/compressed
59src_compressed_dir = $(SRC_ARCH)/boot/compressed
60target_rescue_dir = $(OBJ_ARCH)/boot/rescue
61src_rescue_dir = $(SRC_ARCH)/boot/rescue
62
63export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir
64
49vmlinux.bin: vmlinux 65vmlinux.bin: vmlinux
50 $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin 66 $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
51 67
@@ -65,44 +81,52 @@ cramfs:
65 81
66clinux: vmlinux.bin decompress.bin rescue.bin 82clinux: vmlinux.bin decompress.bin rescue.bin
67 83
68decompress.bin: FORCE 84decompress.bin: $(target_boot_dir)
69 @make -C arch/$(ARCH)/boot/compressed decompress.bin 85 @$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin
70 86
71rescue.bin: FORCE 87$(target_rescue_dir)/rescue.bin: $(target_boot_dir)
72 @make -C arch/$(ARCH)/boot/rescue rescue.bin 88 @$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin
73 89
74zImage: vmlinux.bin rescue.bin 90zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin
75## zImage - Compressed kernel (gzip) 91## zImage - Compressed kernel (gzip)
76 @make -C arch/$(ARCH)/boot/ zImage 92 @$(MAKE) -f $(src_boot_dir)/Makefile zImage
93
94$(target_boot_dir): $(target_boot_arch_dir)
95 ln -sfn $< $@
96
97$(target_boot_arch_dir):
98 mkdir -p $@
77 99
78compressed: zImage 100compressed: zImage
79 101
80archmrproper: 102archmrproper:
81archclean: 103archclean:
82 $(Q)$(MAKE) $(clean)=arch/$(ARCH)/boot 104 @if [ -d arch/$(ARCH)/boot ]; then \
105 $(MAKE) $(clean)=arch/$(ARCH)/boot ; \
106 fi
83 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img 107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
84 rm -rf $(LD_SCRIPT).tmp 108 rm -rf $(LD_SCRIPT).tmp
85 109
86prepare: arch/$(ARCH)/.links include/asm-$(ARCH)/.arch \ 110prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch \
87 include/asm-$(ARCH)/$(SARCH)/offset.h 111 include/asm-$(ARCH)/$(SARCH)/offset.h
88 112
89# Create some links to make all tools happy 113# Create some links to make all tools happy
90arch/$(ARCH)/.links: 114$(SRC_ARCH)/.links:
91 @rm -rf arch/$(ARCH)/drivers 115 @rm -rf $(SRC_ARCH)/drivers
92 @ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers 116 @ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers
93 @rm -rf arch/$(ARCH)/boot 117 @rm -rf $(SRC_ARCH)/boot
94 @ln -sfn $(SARCH)/boot arch/$(ARCH)/boot 118 @ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot
95 @rm -rf arch/$(ARCH)/lib 119 @rm -rf $(SRC_ARCH)/lib
96 @ln -sfn $(SARCH)/lib arch/$(ARCH)/lib 120 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
97 @ln -sfn $(SARCH) arch/$(ARCH)/arch 121 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
98 @ln -sfn ../$(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S 122 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
99 @touch $@ 123 @touch $@
100 124
101# Create link to sub arch includes 125# Create link to sub arch includes
102include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h) 126$(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
103 @echo ' Making asm-$(ARCH)/arch -> asm-$(ARCH)/$(SARCH) symlink' 127 @echo ' Making $(srctree)/include/asm-$(ARCH)/arch -> $(srctree)/include/asm-$(ARCH)/$(SARCH) symlink'
104 @rm -f include/asm-$(ARCH)/arch 128 @rm -f include/asm-$(ARCH)/arch
105 @ln -sf $(SARCH) include/asm-$(ARCH)/arch 129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch
106 @touch $@ 130 @touch $@
107 131
108arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ 132arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
diff --git a/arch/cris/arch-v10/Kconfig b/arch/cris/arch-v10/Kconfig
index 2ca64cc40c63..44eb1b9accb3 100644
--- a/arch/cris/arch-v10/Kconfig
+++ b/arch/cris/arch-v10/Kconfig
@@ -260,6 +260,37 @@ config ETRAX_DEBUG_PORT_NULL
260endchoice 260endchoice
261 261
262choice 262choice
263 prompt "Kernel GDB port"
264 depends on ETRAX_KGDB
265 default ETRAX_KGDB_PORT0
266 help
267 Choose a serial port for kernel debugging. NOTE: This port should
268 not be enabled under Drivers for built-in interfaces (as it has its
269 own initialization code) and should not be the same as the debug port.
270
271config ETRAX_KGDB_PORT0
272 bool "Serial-0"
273 help
274 Use serial port 0 for kernel debugging.
275
276config ETRAX_KGDB_PORT1
277 bool "Serial-1"
278 help
279 Use serial port 1 for kernel debugging.
280
281config ETRAX_KGDB_PORT2
282 bool "Serial-2"
283 help
284 Use serial port 2 for kernel debugging.
285
286config ETRAX_KGDB_PORT3
287 bool "Serial-3"
288 help
289 Use serial port 3 for kernel debugging.
290
291endchoice
292
293choice
263 prompt "Product rescue-port" 294 prompt "Product rescue-port"
264 depends on ETRAX_ARCH_V10 295 depends on ETRAX_ARCH_V10
265 default ETRAX_RESCUE_SER0 296 default ETRAX_RESCUE_SER0
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
index fe6650368e6a..e5b105851108 100644
--- a/arch/cris/arch-v10/boot/Makefile
+++ b/arch/cris/arch-v10/boot/Makefile
@@ -1,12 +1,13 @@
1# 1#
2# arch/cris/boot/Makefile 2# arch/cris/boot/Makefile
3# 3#
4target = $(target_boot_dir)
5src = $(src_boot_dir)
4 6
5zImage: compressed/vmlinuz 7zImage: compressed/vmlinuz
6 8
7compressed/vmlinuz: $(TOPDIR)/vmlinux 9compressed/vmlinuz:
8 @$(MAKE) -C compressed vmlinuz 10 @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz
9 11
10clean: 12clean:
11 rm -f zImage tools/build compressed/vmlinux.out 13 @$(MAKE) -f $(src)/compressed/Makefile clean
12 @$(MAKE) -C compressed clean
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 5f71c2c819e6..6584a44820f4 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -1,40 +1,45 @@
1# 1#
2# linux/arch/etrax100/boot/compressed/Makefile 2# create a compressed vmlinuz image from the binary vmlinux.bin file
3#
4# create a compressed vmlinux image from the original vmlinux files and romfs
5# 3#
4target = $(target_compressed_dir)
5src = $(src_compressed_dir)
6 6
7CC = gcc-cris -melf -I $(TOPDIR)/include 7CC = gcc-cris -melf $(LINUXINCLUDE)
8CFLAGS = -O2 8CFLAGS = -O2
9LD = ld-cris 9LD = ld-cris
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12OBJECTS = head.o misc.o 12OBJECTS = $(target)/head.o $(target)/misc.o
13 13
14# files to compress 14# files to compress
15SYSTEM = $(TOPDIR)/vmlinux.bin 15SYSTEM = $(objtree)/vmlinux.bin
16 16
17all: vmlinuz 17all: $(target_compressed_dir)/vmlinuz
18 18
19decompress.bin: $(OBJECTS) 19$(target)/decompress.bin: $(OBJECTS)
20 $(LD) -T decompress.ld -o decompress.o $(OBJECTS) 20 $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
21 $(OBJCOPY) $(OBJCOPYFLAGS) decompress.o decompress.bin 21 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
22# save it for mkprod in the topdir.
23 cp decompress.bin $(TOPDIR)
24 22
23# Create vmlinuz image in top-level build directory
24$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
25 @echo " COMPR vmlinux.bin --> vmlinuz"
26 @cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
27 @rm -f piggy.img
25 28
26vmlinuz: piggy.img decompress.bin 29$(target)/head.o: $(src)/head.S
27 cat decompress.bin piggy.img > vmlinuz 30 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
28 rm -f piggy.img
29 31
30head.o: head.S 32$(target)/misc.o: $(src)/misc.c
31 $(CC) -D__ASSEMBLY__ -traditional -c head.S -o head.o 33 $(CC) -D__KERNEL__ -c $< -o $@
32 34
33# gzip the kernel image 35# gzip the kernel image
34 36
35piggy.img: $(SYSTEM) 37piggy.img: $(SYSTEM)
36 cat $(SYSTEM) | gzip -f -9 > piggy.img 38 @cat $(SYSTEM) | gzip -f -9 > piggy.img
39
40$(target):
41 mkdir -p $(target)
37 42
38clean: 43clean:
39 rm -f piggy.img vmlinuz vmlinuz.o 44 rm -f piggy.img $(objtree)/vmlinuz
40 45
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
index 4cbdd4b1d9d6..e73f44c998d9 100644
--- a/arch/cris/arch-v10/boot/compressed/head.S
+++ b/arch/cris/arch-v10/boot/compressed/head.S
@@ -13,7 +13,8 @@
13#include <asm/arch/sv_addr_ag.h> 13#include <asm/arch/sv_addr_ag.h>
14 14
15#define RAM_INIT_MAGIC 0x56902387 15#define RAM_INIT_MAGIC 0x56902387
16 16#define COMMAND_LINE_MAGIC 0x87109563
17
17 ;; Exported symbols 18 ;; Exported symbols
18 19
19 .globl _input_data 20 .globl _input_data
@@ -88,6 +89,12 @@ basse: move.d pc, r5
88 cmp.d r2, r1 89 cmp.d r2, r1
89 bcs 1b 90 bcs 1b
90 nop 91 nop
92
93 ;; Save command line magic and address.
94 move.d _cmd_line_magic, $r12
95 move.d $r10, [$r12]
96 move.d _cmd_line_addr, $r12
97 move.d $r11, [$r12]
91 98
92 ;; Do the decompression and save compressed size in _inptr 99 ;; Do the decompression and save compressed size in _inptr
93 100
@@ -98,7 +105,13 @@ basse: move.d pc, r5
98 105
99 move.d [_input_data], r9 ; flash address of compressed kernel 106 move.d [_input_data], r9 ; flash address of compressed kernel
100 add.d [_inptr], r9 ; size of compressed kernel 107 add.d [_inptr], r9 ; size of compressed kernel
101 108
109 ;; Restore command line magic and address.
110 move.d _cmd_line_magic, $r10
111 move.d [$r10], $r10
112 move.d _cmd_line_addr, $r11
113 move.d [$r11], $r11
114
102 ;; Enter the decompressed kernel 115 ;; Enter the decompressed kernel
103 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized 116 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
104 jump 0x40004000 ; kernel is linked to this address 117 jump 0x40004000 ; kernel is linked to this address
@@ -107,5 +120,8 @@ basse: move.d pc, r5
107 120
108_input_data: 121_input_data:
109 .dword 0 ; used by the decompressor 122 .dword 0 ; used by the decompressor
110 123_cmd_line_magic:
124 .dword 0
125_cmd_line_addr:
126 .dword 0
111#include "../../lib/hw_settings.S" 127#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index e9f2ba2ad02c..8be9b3130312 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -1,52 +1,53 @@
1# 1#
2# Makefile for rescue code 2# Makefile for rescue code
3# 3#
4ifndef TOPDIR 4target = $(target_rescue_dir)
5TOPDIR = ../../../.. 5src = $(src_rescue_dir)
6endif 6
7CC = gcc-cris -mlinux -I $(TOPDIR)/include 7CC = gcc-cris -mlinux $(LINUXINCLUDE)
8CFLAGS = -O2 8CFLAGS = -O2
9LD = gcc-cris -mlinux -nostdlib 9LD = gcc-cris -mlinux -nostdlib
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12 12
13all: rescue.bin testrescue.bin kimagerescue.bin 13all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
14
15rescue: rescue.bin
16 # do nothing
17 14
18rescue.bin: head.o 15$(target)/rescue.bin: $(target) $(target)/head.o
19 $(LD) -T rescue.ld -o rescue.o head.o 16 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
20 $(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin 17 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
21 cp rescue.bin $(TOPDIR) 18# Place a copy in top-level build directory
19 cp -p $(target)/rescue.bin $(objtree)
22 20
23testrescue.bin: testrescue.o 21$(target)/testrescue.bin: $(target) $(target)/testrescue.o
24 $(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin 22 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
25# Pad it to 784 bytes 23# Pad it to 784 bytes
26 dd if=/dev/zero of=tmp2423 bs=1 count=784 24 dd if=/dev/zero of=tmp2423 bs=1 count=784
27 cat tr.bin tmp2423 >testrescue_tmp.bin 25 cat tr.bin tmp2423 >testrescue_tmp.bin
28 dd if=testrescue_tmp.bin of=testrescue.bin bs=1 count=784 26 dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
29 rm tr.bin tmp2423 testrescue_tmp.bin 27 rm tr.bin tmp2423 testrescue_tmp.bin
30 28
31kimagerescue.bin: kimagerescue.o 29$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
32 $(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin 30 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
33# Pad it to 784 bytes, that's what the rescue loader expects 31# Pad it to 784 bytes, that's what the rescue loader expects
34 dd if=/dev/zero of=tmp2423 bs=1 count=784 32 dd if=/dev/zero of=tmp2423 bs=1 count=784
35 cat ktr.bin tmp2423 >kimagerescue_tmp.bin 33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
36 dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784 34 dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
37 rm ktr.bin tmp2423 kimagerescue_tmp.bin 35 rm ktr.bin tmp2423 kimagerescue_tmp.bin
38 36
39head.o: head.S 37$(target):
38 mkdir -p $(target)
39
40$(target)/head.o: $(src)/head.S
40 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 41 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
41 42
42testrescue.o: testrescue.S 43$(target)/testrescue.o: $(src)/testrescue.S
43 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 44 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
44 45
45kimagerescue.o: kimagerescue.S 46$(target)/kimagerescue.o: $(src)/kimagerescue.S
46 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 47 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
47 48
48clean: 49clean:
49 rm -f *.o *.bin 50 rm -f $(target)/*.o $(target)/*.bin
50 51
51fastdep: 52fastdep:
52 53
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S
index 8689ea972c46..addb2194de0f 100644
--- a/arch/cris/arch-v10/boot/rescue/head.S
+++ b/arch/cris/arch-v10/boot/rescue/head.S
@@ -1,4 +1,4 @@
1/* $Id: head.S,v 1.6 2003/04/09 08:12:43 pkj Exp $ 1/* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $
2 * 2 *
3 * Rescue code, made to reside at the beginning of the 3 * Rescue code, made to reside at the beginning of the
4 * flash-memory. when it starts, it checks a partition 4 * flash-memory. when it starts, it checks a partition
@@ -121,12 +121,13 @@
121 ;; 0x80000000 if loaded in flash (as it should be) 121 ;; 0x80000000 if loaded in flash (as it should be)
122 ;; since etrax actually starts at address 2 when booting from flash, we 122 ;; since etrax actually starts at address 2 when booting from flash, we
123 ;; put a nop (2 bytes) here first so we dont accidentally skip the di 123 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
124 124
125 nop 125 nop
126 di 126 di
127 127
128 jump in_cache ; enter cached area instead 128 jump in_cache ; enter cached area instead
129in_cache: 129in_cache:
130
130 131
131 ;; first put a jump test to give a possibility of upgrading the rescue code 132 ;; first put a jump test to give a possibility of upgrading the rescue code
132 ;; without erasing/reflashing the sector. we put a longword of -1 here and if 133 ;; without erasing/reflashing the sector. we put a longword of -1 here and if
@@ -325,9 +326,29 @@ flash_ok:
325 ;; result will be in r0 326 ;; result will be in r0
326checksum: 327checksum:
327 moveq 0, $r0 328 moveq 0, $r0
3281: addu.b [$r1+], $r0 329 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
329 subq 1, $r2 330
330 bne 1b 331 ;; If the first physical flash memory is exceeded wrap to the second one.
332 btstq 26, $r1 ; Are we addressing first flash?
333 bpl 1f
334 nop
335 clear.d $r6
336
3371: test.d $r6 ; 0 = no wrapping
338 beq 2f
339 nop
340 lslq 20, $r6 ; Convert MB to bytes
341 sub.d $r1, $r6
342
3432: addu.b [$r1+], $r0
344 subq 1, $r6 ; Flash memory left
345 beq 3f
346 subq 1, $r2 ; Length left
347 bne 2b
331 nop 348 nop
332 ret 349 ret
333 nop 350 nop
351
3523: move.d MEM_CSE1_START, $r1 ; wrap to second flash
353 ba 2b
354 nop
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 748374f25b87..8b50e8402954 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -1,17 +1,11 @@
1config ETRAX_ETHERNET 1config ETRAX_ETHERNET
2 bool "Ethernet support" 2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V10 3 depends on ETRAX_ARCH_V10
4 select NET_ETHERNET
4 help 5 help
5 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 6 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
6 controller. 7 controller.
7 8
8# this is just so that the user does not have to go into the
9# normal ethernet driver section just to enable ethernetworking
10config NET_ETHERNET
11 bool
12 depends on ETRAX_ETHERNET
13 default y
14
15choice 9choice
16 prompt "Network LED behavior" 10 prompt "Network LED behavior"
17 depends on ETRAX_ETHERNET 11 depends on ETRAX_ETHERNET
@@ -20,26 +14,26 @@ choice
20config ETRAX_NETWORK_LED_ON_WHEN_LINK 14config ETRAX_NETWORK_LED_ON_WHEN_LINK
21 bool "LED_on_when_link" 15 bool "LED_on_when_link"
22 help 16 help
23 Selecting LED_on_when_link will light the LED when there is a 17 Selecting LED_on_when_link will light the LED when there is a
24 connection and will flash off when there is activity. 18 connection and will flash off when there is activity.
25 19
26 Selecting LED_on_when_activity will light the LED only when 20 Selecting LED_on_when_activity will light the LED only when
27 there is activity. 21 there is activity.
28 22
29 This setting will also affect the behaviour of other activity LEDs 23 This setting will also affect the behaviour of other activity LEDs
30 e.g. Bluetooth. 24 e.g. Bluetooth.
31 25
32config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY 26config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
33 bool "LED_on_when_activity" 27 bool "LED_on_when_activity"
34 help 28 help
35 Selecting LED_on_when_link will light the LED when there is a 29 Selecting LED_on_when_link will light the LED when there is a
36 connection and will flash off when there is activity. 30 connection and will flash off when there is activity.
37 31
38 Selecting LED_on_when_activity will light the LED only when 32 Selecting LED_on_when_activity will light the LED only when
39 there is activity. 33 there is activity.
40 34
41 This setting will also affect the behaviour of other activity LEDs 35 This setting will also affect the behaviour of other activity LEDs
42 e.g. Bluetooth. 36 e.g. Bluetooth.
43 37
44endchoice 38endchoice
45 39
@@ -91,11 +85,11 @@ choice
91 depends on ETRAX_SERIAL_PORT0 85 depends on ETRAX_SERIAL_PORT0
92 default ETRAX_SERIAL_PORT0_DMA6_OUT 86 default ETRAX_SERIAL_PORT0_DMA6_OUT
93 87
94config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT 88config ETRAX_SERIAL_PORT0_NO_DMA_OUT
95 bool "No DMA out" 89 bool "No DMA out"
96 90
97config CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT 91config ETRAX_SERIAL_PORT0_DMA6_OUT
98 bool "DMA 6" 92 bool "DMA 6"
99 93
100endchoice 94endchoice
101 95
@@ -104,11 +98,11 @@ choice
104 depends on ETRAX_SERIAL_PORT0 98 depends on ETRAX_SERIAL_PORT0
105 default ETRAX_SERIAL_PORT0_DMA7_IN 99 default ETRAX_SERIAL_PORT0_DMA7_IN
106 100
107config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN 101config ETRAX_SERIAL_PORT0_NO_DMA_IN
108 bool "No DMA in" 102 bool "No DMA in"
109 103
110config CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN 104config ETRAX_SERIAL_PORT0_DMA7_IN
111 bool "DMA 7" 105 bool "DMA 7"
112 106
113endchoice 107endchoice
114 108
@@ -205,11 +199,11 @@ choice
205 depends on ETRAX_SERIAL_PORT1 199 depends on ETRAX_SERIAL_PORT1
206 default ETRAX_SERIAL_PORT1_DMA8_OUT 200 default ETRAX_SERIAL_PORT1_DMA8_OUT
207 201
208config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_OUT 202config ETRAX_SERIAL_PORT1_NO_DMA_OUT
209 bool "No DMA out" 203 bool "No DMA out"
210 204
211config CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT 205config ETRAX_SERIAL_PORT1_DMA8_OUT
212 bool "DMA 8" 206 bool "DMA 8"
213 207
214endchoice 208endchoice
215 209
@@ -218,11 +212,11 @@ choice
218 depends on ETRAX_SERIAL_PORT1 212 depends on ETRAX_SERIAL_PORT1
219 default ETRAX_SERIAL_PORT1_DMA9_IN 213 default ETRAX_SERIAL_PORT1_DMA9_IN
220 214
221config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_IN 215config ETRAX_SERIAL_PORT1_NO_DMA_IN
222 bool "No DMA in" 216 bool "No DMA in"
223 217
224config CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN 218config ETRAX_SERIAL_PORT1_DMA9_IN
225 bool "DMA 9" 219 bool "DMA 9"
226 220
227endchoice 221endchoice
228 222
@@ -308,7 +302,7 @@ config ETRAX_SER1_CD_ON_PB_BIT
308 Specify the pin of the PB port to carry the CD signal for serial 302 Specify the pin of the PB port to carry the CD signal for serial
309 port 1. 303 port 1.
310 304
311comment "Make sure you dont have the same PB bits more than once!" 305comment "Make sure you do not have the same PB bits more than once!"
312 depends on ETRAX_SERIAL && ETRAX_SER0_DTR_RI_DSR_CD_ON_PB && ETRAX_SER1_DTR_RI_DSR_CD_ON_PB 306 depends on ETRAX_SERIAL && ETRAX_SER0_DTR_RI_DSR_CD_ON_PB && ETRAX_SER1_DTR_RI_DSR_CD_ON_PB
313 307
314config ETRAX_SERIAL_PORT2 308config ETRAX_SERIAL_PORT2
@@ -322,11 +316,11 @@ choice
322 depends on ETRAX_SERIAL_PORT2 316 depends on ETRAX_SERIAL_PORT2
323 default ETRAX_SERIAL_PORT2_DMA2_OUT 317 default ETRAX_SERIAL_PORT2_DMA2_OUT
324 318
325config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT 319config ETRAX_SERIAL_PORT2_NO_DMA_OUT
326 bool "No DMA out" 320 bool "No DMA out"
327 321
328config CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT 322config ETRAX_SERIAL_PORT2_DMA2_OUT
329 bool "DMA 2" 323 bool "DMA 2"
330 324
331endchoice 325endchoice
332 326
@@ -335,11 +329,11 @@ choice
335 depends on ETRAX_SERIAL_PORT2 329 depends on ETRAX_SERIAL_PORT2
336 default ETRAX_SERIAL_PORT2_DMA3_IN 330 default ETRAX_SERIAL_PORT2_DMA3_IN
337 331
338config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN 332config ETRAX_SERIAL_PORT2_NO_DMA_IN
339 bool "No DMA in" 333 bool "No DMA in"
340 334
341config CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN 335config ETRAX_SERIAL_PORT2_DMA3_IN
342 bool "DMA 3" 336 bool "DMA 3"
343 337
344endchoice 338endchoice
345 339
@@ -436,11 +430,11 @@ choice
436 depends on ETRAX_SERIAL_PORT3 430 depends on ETRAX_SERIAL_PORT3
437 default ETRAX_SERIAL_PORT3_DMA4_OUT 431 default ETRAX_SERIAL_PORT3_DMA4_OUT
438 432
439config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT 433config ETRAX_SERIAL_PORT3_NO_DMA_OUT
440 bool "No DMA out" 434 bool "No DMA out"
441 435
442config CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT 436config ETRAX_SERIAL_PORT3_DMA4_OUT
443 bool "DMA 4" 437 bool "DMA 4"
444 438
445endchoice 439endchoice
446 440
@@ -449,11 +443,11 @@ choice
449 depends on ETRAX_SERIAL_PORT3 443 depends on ETRAX_SERIAL_PORT3
450 default ETRAX_SERIAL_PORT3_DMA5_IN 444 default ETRAX_SERIAL_PORT3_DMA5_IN
451 445
452config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN 446config ETRAX_SERIAL_PORT3_NO_DMA_IN
453 bool "No DMA in" 447 bool "No DMA in"
454 448
455config CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN 449config ETRAX_SERIAL_PORT3_DMA5_IN
456 bool "DMA 5" 450 bool "DMA 5"
457 451
458endchoice 452endchoice
459 453
@@ -554,7 +548,6 @@ config ETRAX_IDE
554 select BLK_DEV_IDEDISK 548 select BLK_DEV_IDEDISK
555 select BLK_DEV_IDECD 549 select BLK_DEV_IDECD
556 select BLK_DEV_IDEDMA 550 select BLK_DEV_IDEDMA
557 select DMA_NONPCI
558 help 551 help
559 Enable this to get support for ATA/IDE. 552 Enable this to get support for ATA/IDE.
560 You can't use paralell ports or SCSI ports 553 You can't use paralell ports or SCSI ports
@@ -579,7 +572,7 @@ config ETRAX_IDE_PB7_RESET
579 IDE reset on pin 7 on port B 572 IDE reset on pin 7 on port B
580 573
581config ETRAX_IDE_G27_RESET 574config ETRAX_IDE_G27_RESET
582 bool "Port_G_Bit_27" 575 bool "Port_G_Bit_27"
583 help 576 help
584 IDE reset on pin 27 on port G 577 IDE reset on pin 27 on port G
585 578
@@ -588,30 +581,36 @@ endchoice
588 581
589config ETRAX_USB_HOST 582config ETRAX_USB_HOST
590 bool "USB host" 583 bool "USB host"
584 select USB
591 help 585 help
592 This option enables the host functionality of the ETRAX 100LX 586 This option enables the host functionality of the ETRAX 100LX
593 built-in USB controller. In host mode the controller is designed 587 built-in USB controller. In host mode the controller is designed
594 for CTRL and BULK traffic only, INTR traffic may work as well 588 for CTRL and BULK traffic only, INTR traffic may work as well
595 however (depending on the requirements of timeliness). 589 however (depending on the requirements of timeliness).
596 590
597config USB
598 tristate
599 depends on ETRAX_USB_HOST
600 default y
601
602config ETRAX_USB_HOST_PORT1 591config ETRAX_USB_HOST_PORT1
603 bool " USB port 1 enabled" 592 bool "USB port 1 enabled"
604 depends on ETRAX_USB_HOST 593 depends on ETRAX_USB_HOST
605 default n 594 default n
606 595
607config ETRAX_USB_HOST_PORT2 596config ETRAX_USB_HOST_PORT2
608 bool " USB port 2 enabled" 597 bool "USB port 2 enabled"
609 depends on ETRAX_USB_HOST 598 depends on ETRAX_USB_HOST
610 default n 599 default n
611 600
612config ETRAX_AXISFLASHMAP 601config ETRAX_AXISFLASHMAP
613 bool "Axis flash-map support" 602 bool "Axis flash-map support"
614 depends on ETRAX_ARCH_V10 603 depends on ETRAX_ARCH_V10
604 select MTD
605 select MTD_CFI
606 select MTD_CFI_AMDSTD
607 select MTD_OBSOLETE_CHIPS
608 select MTD_AMDSTD
609 select MTD_CHAR
610 select MTD_BLOCK
611 select MTD_PARTITIONS
612 select MTD_CONCAT
613 select MTD_COMPLEX_MAPPINGS
615 help 614 help
616 This option enables MTD mapping of flash devices. Needed to use 615 This option enables MTD mapping of flash devices. Needed to use
617 flash memories. If unsure, say Y. 616 flash memories. If unsure, say Y.
@@ -627,119 +626,6 @@ config ETRAX_PTABLE_SECTOR
627 for changing this is when the flash block size is bigger 626 for changing this is when the flash block size is bigger
628 than 64kB (e.g. when using two parallel 16 bit flashes). 627 than 64kB (e.g. when using two parallel 16 bit flashes).
629 628
630# here we define the CONFIG_'s necessary to enable MTD support
631# for the flash
632config MTD
633 tristate
634 depends on ETRAX_AXISFLASHMAP
635 default y
636 help
637 Memory Technology Devices are flash, RAM and similar chips, often
638 used for solid state file systems on embedded devices. This option
639 will provide the generic support for MTD drivers to register
640 themselves with the kernel and for potential users of MTD devices
641 to enumerate the devices which are present and obtain a handle on
642 them. It will also allow you to select individual drivers for
643 particular hardware and users of MTD devices. If unsure, say N.
644
645config MTD_CFI
646 tristate
647 depends on ETRAX_AXISFLASHMAP
648 default y
649 help
650 The Common Flash Interface specification was developed by Intel,
651 AMD and other flash manufactures that provides a universal method
652 for probing the capabilities of flash devices. If you wish to
653 support any device that is CFI-compliant, you need to enable this
654 option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
655 for more information on CFI.
656
657config MTD_CFI_AMDSTD
658 tristate
659 depends on ETRAX_AXISFLASHMAP
660 default y
661 help
662 The Common Flash Interface defines a number of different command
663 sets which a CFI-compliant chip may claim to implement. This code
664 provides support for one of those command sets, used on chips
665 chips including the AMD Am29LV320.
666
667config MTD_OBSOLETE_CHIPS
668 bool
669 depends on ETRAX_AXISFLASHMAP
670 default y
671 help
672 This option does not enable any code directly, but will allow you to
673 select some other chip drivers which are now considered obsolete,
674 because the generic CONFIG_JEDEC_PROBE code above should now detect
675 the chips which are supported by these drivers, and allow the generic
676 CFI-compatible drivers to drive the chips. Say 'N' here unless you have
677 already tried the CONFIG_JEDEC_PROBE method and reported its failure
678 to the MTD mailing list at <linux-mtd@lists.infradead.org>
679
680config MTD_AMDSTD
681 tristate
682 depends on ETRAX_AXISFLASHMAP
683 default y
684 help
685 This option enables support for flash chips using AMD-compatible
686 commands, including some which are not CFI-compatible and hence
687 cannot be used with the CONFIG_MTD_CFI_AMDSTD option.
688
689 It also works on AMD compatible chips that do conform to CFI.
690
691config MTD_CHAR
692 tristate
693 depends on ETRAX_AXISFLASHMAP
694 default y
695 help
696 This provides a character device for each MTD device present in
697 the system, allowing the user to read and write directly to the
698 memory chips, and also use ioctl() to obtain information about
699 the device, or to erase parts of it.
700
701config MTD_BLOCK
702 tristate
703 depends on ETRAX_AXISFLASHMAP
704 default y
705 ---help---
706 Although most flash chips have an erase size too large to be useful
707 as block devices, it is possible to use MTD devices which are based
708 on RAM chips in this manner. This block device is a user of MTD
709 devices performing that function.
710
711 At the moment, it is also required for the Journalling Flash File
712 System(s) to obtain a handle on the MTD device when it's mounted
713 (although JFFS and JFFS2 don't actually use any of the functionality
714 of the mtdblock device).
715
716 Later, it may be extended to perform read/erase/modify/write cycles
717 on flash chips to emulate a smaller block size. Needless to say,
718 this is very unsafe, but could be useful for file systems which are
719 almost never written to.
720
721 You do not need this option for use with the DiskOnChip devices. For
722 those, enable NFTL support (CONFIG_NFTL) instead.
723
724config MTD_PARTITIONS
725 tristate
726 depends on ETRAX_AXISFLASHMAP
727 default y
728 help
729 If you have a device which needs to divide its flash chip(s) up
730 into multiple 'partitions', each of which appears to the user as
731 a separate MTD device, you require this option to be enabled. If
732 unsure, say 'Y'.
733
734 Note, however, that you don't need this option for the DiskOnChip
735 devices. Partitioning on NFTL 'devices' is a different - that's the
736 'normal' form of partitioning used on a block device.
737
738config MTD_CONCAT
739 tristate
740 depends on ETRAX_AXISFLASHMAP
741 default y
742
743config ETRAX_I2C 629config ETRAX_I2C
744 bool "I2C support" 630 bool "I2C support"
745 depends on ETRAX_ARCH_V10 631 depends on ETRAX_ARCH_V10
@@ -752,7 +638,7 @@ config ETRAX_I2C
752 val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg); 638 val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg);
753 639
754# this is true for most products since PB-I2C seems to be somewhat 640# this is true for most products since PB-I2C seems to be somewhat
755# flawed.. 641# flawed..
756config ETRAX_I2C_USES_PB_NOT_PB_I2C 642config ETRAX_I2C_USES_PB_NOT_PB_I2C
757 bool "I2C uses PB not PB-I2C" 643 bool "I2C uses PB not PB-I2C"
758 depends on ETRAX_I2C 644 depends on ETRAX_I2C
@@ -886,7 +772,7 @@ config ETRAX_RTC
886 bool "Real Time Clock support" 772 bool "Real Time Clock support"
887 depends on ETRAX_ARCH_V10 773 depends on ETRAX_ARCH_V10
888 help 774 help
889 Enables drivers for the Real-Time Clock battery-backed chips on 775 Enables drivers for the Real-Time Clock battery-backed chips on
890 some products. The kernel reads the time when booting, and 776 some products. The kernel reads the time when booting, and
891 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a 777 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
892 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc 778 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc
@@ -903,13 +789,13 @@ config ETRAX_DS1302
903 bool "DS1302" 789 bool "DS1302"
904 help 790 help
905 Enables the driver for the DS1302 Real-Time Clock battery-backed 791 Enables the driver for the DS1302 Real-Time Clock battery-backed
906 chip on some products. 792 chip on some products.
907 793
908config ETRAX_PCF8563 794config ETRAX_PCF8563
909 bool "PCF8563" 795 bool "PCF8563"
910 help 796 help
911 Enables the driver for the PCF8563 Real-Time Clock battery-backed 797 Enables the driver for the PCF8563 Real-Time Clock battery-backed
912 chip on some products. 798 chip on some products.
913 799
914endchoice 800endchoice
915 801
@@ -954,10 +840,8 @@ config ETRAX_DS1302_TRICKLE_CHARGE
954 help 840 help
955 This controls the initial value of the trickle charge register. 841 This controls the initial value of the trickle charge register.
956 0 = disabled (use this if you are unsure or have a non rechargable battery) 842 0 = disabled (use this if you are unsure or have a non rechargable battery)
957 Otherwise the following values can be OR:ed together to control the 843 Otherwise the following values can be OR:ed together to control the
958 charge current: 844 charge current:
959 1 = 2kohm, 2 = 4kohm, 3 = 4kohm 845 1 = 2kohm, 2 = 4kohm, 3 = 4kohm
960 4 = 1 diode, 8 = 2 diodes 846 4 = 1 diode, 8 = 2 diodes
961 Allowed values are (increasing current): 0, 11, 10, 9, 7, 6, 5 847 Allowed values are (increasing current): 0, 11, 10, 9, 7, 6, 5
962
963
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index fb7d4855ea62..11ab3836aac6 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -11,6 +11,9 @@
11 * partition split defined below. 11 * partition split defined below.
12 * 12 *
13 * $Log: axisflashmap.c,v $ 13 * $Log: axisflashmap.c,v $
14 * Revision 1.11 2004/11/15 10:27:14 starvik
15 * Corrected typo (Thanks to Milton Miller <miltonm@bga.com>).
16 *
14 * Revision 1.10 2004/08/16 12:37:22 starvik 17 * Revision 1.10 2004/08/16 12:37:22 starvik
15 * Merge of Linux 2.6.8 18 * Merge of Linux 2.6.8
16 * 19 *
@@ -161,7 +164,7 @@
161#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2 164#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2
162#define flash_data __u16 165#define flash_data __u16
163#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4 166#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4
164#define flash_data __u16 167#define flash_data __u32
165#endif 168#endif
166 169
167/* From head.S */ 170/* From head.S */
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index fba530fcfaeb..10795f67f687 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -7,6 +7,15 @@
7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init 7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
8*! 8*!
9*! $Log: ds1302.c,v $ 9*! $Log: ds1302.c,v $
10*! Revision 1.18 2005/01/24 09:11:26 mikaelam
11*! Minor changes to get DS1302 RTC chip driver to work
12*!
13*! Revision 1.17 2005/01/05 06:11:22 starvik
14*! No need to do local_irq_disable after local_irq_save.
15*!
16*! Revision 1.16 2004/12/13 12:21:52 starvik
17*! Added I/O and DMA allocators from Linux 2.4
18*!
10*! Revision 1.14 2004/08/24 06:48:43 starvik 19*! Revision 1.14 2004/08/24 06:48:43 starvik
11*! Whitespace cleanup 20*! Whitespace cleanup
12*! 21*!
@@ -124,9 +133,9 @@
124*! 133*!
125*! --------------------------------------------------------------------------- 134*! ---------------------------------------------------------------------------
126*! 135*!
127*! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN 136*! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004 Axis Communications AB, LUND, SWEDEN
128*! 137*!
129*! $Id: ds1302.c,v 1.14 2004/08/24 06:48:43 starvik Exp $ 138*! $Id: ds1302.c,v 1.18 2005/01/24 09:11:26 mikaelam Exp $
130*! 139*!
131*!***************************************************************************/ 140*!***************************************************************************/
132 141
@@ -145,6 +154,7 @@
145#include <asm/arch/svinto.h> 154#include <asm/arch/svinto.h>
146#include <asm/io.h> 155#include <asm/io.h>
147#include <asm/rtc.h> 156#include <asm/rtc.h>
157#include <asm/arch/io_interface_mux.h>
148 158
149#define RTC_MAJOR_NR 121 /* local major, change later */ 159#define RTC_MAJOR_NR 121 /* local major, change later */
150 160
@@ -320,7 +330,6 @@ get_rtc_time(struct rtc_time *rtc_tm)
320 unsigned long flags; 330 unsigned long flags;
321 331
322 local_irq_save(flags); 332 local_irq_save(flags);
323 local_irq_disable();
324 333
325 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); 334 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
326 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); 335 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES);
@@ -358,7 +367,7 @@ static int
358rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 367rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
359 unsigned long arg) 368 unsigned long arg)
360{ 369{
361 unsigned long flags; 370 unsigned long flags;
362 371
363 switch(cmd) { 372 switch(cmd) {
364 case RTC_RD_TIME: /* read the time/date from RTC */ 373 case RTC_RD_TIME: /* read the time/date from RTC */
@@ -382,7 +391,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
382 return -EPERM; 391 return -EPERM;
383 392
384 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) 393 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time)))
385 return -EFAULT; 394 return -EFAULT;
386 395
387 yrs = rtc_tm.tm_year + 1900; 396 yrs = rtc_tm.tm_year + 1900;
388 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */ 397 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */
@@ -419,7 +428,6 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
419 BIN_TO_BCD(yrs); 428 BIN_TO_BCD(yrs);
420 429
421 local_irq_save(flags); 430 local_irq_save(flags);
422 local_irq_disable();
423 CMOS_WRITE(yrs, RTC_YEAR); 431 CMOS_WRITE(yrs, RTC_YEAR);
424 CMOS_WRITE(mon, RTC_MONTH); 432 CMOS_WRITE(mon, RTC_MONTH);
425 CMOS_WRITE(day, RTC_DAY_OF_MONTH); 433 CMOS_WRITE(day, RTC_DAY_OF_MONTH);
@@ -438,7 +446,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
438 446
439 case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */ 447 case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */
440 { 448 {
441 int tcs_val; 449 int tcs_val;
442 450
443 if (!capable(CAP_SYS_TIME)) 451 if (!capable(CAP_SYS_TIME))
444 return -EPERM; 452 return -EPERM;
@@ -492,8 +500,8 @@ print_rtc_status(void)
492/* The various file operations we support. */ 500/* The various file operations we support. */
493 501
494static struct file_operations rtc_fops = { 502static struct file_operations rtc_fops = {
495 .owner = THIS_MODULE, 503 .owner = THIS_MODULE,
496 .ioctl = rtc_ioctl, 504 .ioctl = rtc_ioctl,
497}; 505};
498 506
499/* Probe for the chip by writing something to its RAM and try reading it back. */ 507/* Probe for the chip by writing something to its RAM and try reading it back. */
@@ -532,7 +540,7 @@ ds1302_probe(void)
532 "PB", 540 "PB",
533#endif 541#endif
534 CONFIG_ETRAX_DS1302_RSTBIT); 542 CONFIG_ETRAX_DS1302_RSTBIT);
535 print_rtc_status(); 543 print_rtc_status();
536 retval = 1; 544 retval = 1;
537 } else { 545 } else {
538 stop(); 546 stop();
@@ -548,7 +556,9 @@ ds1302_probe(void)
548int __init 556int __init
549ds1302_init(void) 557ds1302_init(void)
550{ 558{
559#ifdef CONFIG_ETRAX_I2C
551 i2c_init(); 560 i2c_init();
561#endif
552 562
553 if (!ds1302_probe()) { 563 if (!ds1302_probe()) {
554#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT 564#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
@@ -558,25 +568,42 @@ ds1302_init(void)
558 * 568 *
559 * Make sure that R_GEN_CONFIG is setup correct. 569 * Make sure that R_GEN_CONFIG is setup correct.
560 */ 570 */
561 genconfig_shadow = ((genconfig_shadow & 571 /* Allocating the ATA interface will grab almost all
562 ~IO_MASK(R_GEN_CONFIG, ata)) | 572 * pins in I/O groups a, b, c and d. A consequence of
563 (IO_STATE(R_GEN_CONFIG, ata, select))); 573 * allocating the ATA interface is that the fixed
564 *R_GEN_CONFIG = genconfig_shadow; 574 * interfaces shared RAM, parallel port 0, parallel
575 * port 1, parallel port W, SCSI-8 port 0, SCSI-8 port
576 * 1, SCSI-W, serial port 2, serial port 3,
577 * synchronous serial port 3 and USB port 2 and almost
578 * all GPIO pins on port g cannot be used.
579 */
580 if (cris_request_io_interface(if_ata, "ds1302/ATA")) {
581 printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
582 return -1;
583 }
584
565#elif CONFIG_ETRAX_DS1302_RSTBIT == 0 585#elif CONFIG_ETRAX_DS1302_RSTBIT == 0
566 586 if (cris_io_interface_allocate_pins(if_gpio_grp_a,
567 /* Set the direction of this bit to out. */ 587 'g',
568 genconfig_shadow = ((genconfig_shadow & 588 CONFIG_ETRAX_DS1302_RSTBIT,
569 ~IO_MASK(R_GEN_CONFIG, g0dir)) | 589 CONFIG_ETRAX_DS1302_RSTBIT)) {
570 (IO_STATE(R_GEN_CONFIG, g0dir, out))); 590 printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
571 *R_GEN_CONFIG = genconfig_shadow; 591 return -1;
592 }
593
594 /* Set the direction of this bit to out. */
595 genconfig_shadow = ((genconfig_shadow &
596 ~IO_MASK(R_GEN_CONFIG, g0dir)) |
597 (IO_STATE(R_GEN_CONFIG, g0dir, out)));
598 *R_GEN_CONFIG = genconfig_shadow;
572#endif 599#endif
573 if (!ds1302_probe()) { 600 if (!ds1302_probe()) {
574 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); 601 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
575 return -1; 602 return -1;
576 } 603 }
577#else 604#else
578 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); 605 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
579 return -1; 606 return -1;
580#endif 607#endif
581 } 608 }
582 /* Initialise trickle charger */ 609 /* Initialise trickle charger */
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
index 316ca15d6802..512f16dec060 100644
--- a/arch/cris/arch-v10/drivers/eeprom.c
+++ b/arch/cris/arch-v10/drivers/eeprom.c
@@ -20,6 +20,12 @@
20*! in the spin-lock. 20*! in the spin-lock.
21*! 21*!
22*! $Log: eeprom.c,v $ 22*! $Log: eeprom.c,v $
23*! Revision 1.12 2005/06/19 17:06:46 starvik
24*! Merge of Linux 2.6.12.
25*!
26*! Revision 1.11 2005/01/26 07:14:46 starvik
27*! Applied diff from kernel janitors (Nish Aravamudan).
28*!
23*! Revision 1.10 2003/09/11 07:29:48 starvik 29*! Revision 1.10 2003/09/11 07:29:48 starvik
24*! Merge of Linux 2.6.0-test5 30*! Merge of Linux 2.6.0-test5
25*! 31*!
@@ -94,6 +100,7 @@
94#include <linux/init.h> 100#include <linux/init.h>
95#include <linux/delay.h> 101#include <linux/delay.h>
96#include <linux/interrupt.h> 102#include <linux/interrupt.h>
103#include <linux/wait.h>
97#include <asm/uaccess.h> 104#include <asm/uaccess.h>
98#include "i2c.h" 105#include "i2c.h"
99 106
@@ -526,15 +533,10 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
526 return -EFAULT; 533 return -EFAULT;
527 } 534 }
528 535
529 while(eeprom.busy) 536 wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
530 { 537 if (signal_pending(current))
531 interruptible_sleep_on(&eeprom.wait_q); 538 return -EINTR;
532 539
533 /* bail out if we get interrupted */
534 if (signal_pending(current))
535 return -EINTR;
536
537 }
538 eeprom.busy++; 540 eeprom.busy++;
539 541
540 page = (unsigned char) (p >> 8); 542 page = (unsigned char) (p >> 8);
@@ -604,13 +606,10 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
604 return -EFAULT; 606 return -EFAULT;
605 } 607 }
606 608
607 while(eeprom.busy) 609 wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
608 { 610 /* bail out if we get interrupted */
609 interruptible_sleep_on(&eeprom.wait_q); 611 if (signal_pending(current))
610 /* bail out if we get interrupted */ 612 return -EINTR;
611 if (signal_pending(current))
612 return -EINTR;
613 }
614 eeprom.busy++; 613 eeprom.busy++;
615 for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++) 614 for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++)
616 { 615 {
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index c095de82a0da..09963fe299a7 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -1,4 +1,4 @@
1/* $Id: gpio.c,v 1.12 2004/08/24 07:19:59 starvik Exp $ 1/* $Id: gpio.c,v 1.17 2005/06/19 17:06:46 starvik Exp $
2 * 2 *
3 * Etrax general port I/O device 3 * Etrax general port I/O device
4 * 4 *
@@ -9,6 +9,18 @@
9 * Johan Adolfsson (read/set directions, write, port G) 9 * Johan Adolfsson (read/set directions, write, port G)
10 * 10 *
11 * $Log: gpio.c,v $ 11 * $Log: gpio.c,v $
12 * Revision 1.17 2005/06/19 17:06:46 starvik
13 * Merge of Linux 2.6.12.
14 *
15 * Revision 1.16 2005/03/07 13:02:29 starvik
16 * Protect driver global states with spinlock
17 *
18 * Revision 1.15 2005/01/05 06:08:55 starvik
19 * No need to do local_irq_disable after local_irq_save.
20 *
21 * Revision 1.14 2004/12/13 12:21:52 starvik
22 * Added I/O and DMA allocators from Linux 2.4
23 *
12 * Revision 1.12 2004/08/24 07:19:59 starvik 24 * Revision 1.12 2004/08/24 07:19:59 starvik
13 * Whitespace cleanup 25 * Whitespace cleanup
14 * 26 *
@@ -142,6 +154,7 @@
142#include <asm/io.h> 154#include <asm/io.h>
143#include <asm/system.h> 155#include <asm/system.h>
144#include <asm/irq.h> 156#include <asm/irq.h>
157#include <asm/arch/io_interface_mux.h>
145 158
146#define GPIO_MAJOR 120 /* experimental MAJOR number */ 159#define GPIO_MAJOR 120 /* experimental MAJOR number */
147 160
@@ -194,6 +207,8 @@ static struct gpio_private *alarmlist = 0;
194static int gpio_some_alarms = 0; /* Set if someone uses alarm */ 207static int gpio_some_alarms = 0; /* Set if someone uses alarm */
195static unsigned long gpio_pa_irq_enabled_mask = 0; 208static unsigned long gpio_pa_irq_enabled_mask = 0;
196 209
210static DEFINE_SPINLOCK(gpio_lock); /* Protect directions etc */
211
197/* Port A and B use 8 bit access, but Port G is 32 bit */ 212/* Port A and B use 8 bit access, but Port G is 32 bit */
198#define NUM_PORTS (GPIO_MINOR_B+1) 213#define NUM_PORTS (GPIO_MINOR_B+1)
199 214
@@ -241,6 +256,9 @@ static volatile unsigned char *dir_shadow[NUM_PORTS] = {
241 &port_pb_dir_shadow 256 &port_pb_dir_shadow
242}; 257};
243 258
259/* All bits in port g that can change dir. */
260static const unsigned long int changeable_dir_g_mask = 0x01FFFF01;
261
244/* Port G is 32 bit, handle it special, some bits are both inputs 262/* Port G is 32 bit, handle it special, some bits are both inputs
245 and outputs at the same time, only some of the bits can change direction 263 and outputs at the same time, only some of the bits can change direction
246 and some of them in groups of 8 bit. */ 264 and some of them in groups of 8 bit. */
@@ -260,6 +278,7 @@ gpio_poll(struct file *file,
260 unsigned int mask = 0; 278 unsigned int mask = 0;
261 struct gpio_private *priv = (struct gpio_private *)file->private_data; 279 struct gpio_private *priv = (struct gpio_private *)file->private_data;
262 unsigned long data; 280 unsigned long data;
281 spin_lock(&gpio_lock);
263 poll_wait(file, &priv->alarm_wq, wait); 282 poll_wait(file, &priv->alarm_wq, wait);
264 if (priv->minor == GPIO_MINOR_A) { 283 if (priv->minor == GPIO_MINOR_A) {
265 unsigned long flags; 284 unsigned long flags;
@@ -270,10 +289,10 @@ gpio_poll(struct file *file,
270 */ 289 */
271 tmp = ~data & priv->highalarm & 0xFF; 290 tmp = ~data & priv->highalarm & 0xFF;
272 tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR); 291 tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
273 save_flags(flags); cli(); 292 local_irq_save(flags);
274 gpio_pa_irq_enabled_mask |= tmp; 293 gpio_pa_irq_enabled_mask |= tmp;
275 *R_IRQ_MASK1_SET = tmp; 294 *R_IRQ_MASK1_SET = tmp;
276 restore_flags(flags); 295 local_irq_restore(flags);
277 296
278 } else if (priv->minor == GPIO_MINOR_B) 297 } else if (priv->minor == GPIO_MINOR_B)
279 data = *R_PORT_PB_DATA; 298 data = *R_PORT_PB_DATA;
@@ -286,8 +305,11 @@ gpio_poll(struct file *file,
286 (~data & priv->lowalarm)) { 305 (~data & priv->lowalarm)) {
287 mask = POLLIN|POLLRDNORM; 306 mask = POLLIN|POLLRDNORM;
288 } 307 }
308
309 spin_unlock(&gpio_lock);
289 310
290 DP(printk("gpio_poll ready: mask 0x%08X\n", mask)); 311 DP(printk("gpio_poll ready: mask 0x%08X\n", mask));
312
291 return mask; 313 return mask;
292} 314}
293 315
@@ -296,6 +318,7 @@ int etrax_gpio_wake_up_check(void)
296 struct gpio_private *priv = alarmlist; 318 struct gpio_private *priv = alarmlist;
297 unsigned long data = 0; 319 unsigned long data = 0;
298 int ret = 0; 320 int ret = 0;
321 spin_lock(&gpio_lock);
299 while (priv) { 322 while (priv) {
300 if (USE_PORTS(priv)) { 323 if (USE_PORTS(priv)) {
301 data = *priv->port; 324 data = *priv->port;
@@ -310,6 +333,7 @@ int etrax_gpio_wake_up_check(void)
310 } 333 }
311 priv = priv->next; 334 priv = priv->next;
312 } 335 }
336 spin_unlock(&gpio_lock);
313 return ret; 337 return ret;
314} 338}
315 339
@@ -327,6 +351,7 @@ static irqreturn_t
327gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs) 351gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
328{ 352{
329 unsigned long tmp; 353 unsigned long tmp;
354 spin_lock(&gpio_lock);
330 /* Find what PA interrupts are active */ 355 /* Find what PA interrupts are active */
331 tmp = (*R_IRQ_READ1); 356 tmp = (*R_IRQ_READ1);
332 357
@@ -337,6 +362,8 @@ gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
337 *R_IRQ_MASK1_CLR = tmp; 362 *R_IRQ_MASK1_CLR = tmp;
338 gpio_pa_irq_enabled_mask &= ~tmp; 363 gpio_pa_irq_enabled_mask &= ~tmp;
339 364
365 spin_unlock(&gpio_lock);
366
340 if (gpio_some_alarms) { 367 if (gpio_some_alarms) {
341 return IRQ_RETVAL(etrax_gpio_wake_up_check()); 368 return IRQ_RETVAL(etrax_gpio_wake_up_check());
342 } 369 }
@@ -350,6 +377,9 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
350 struct gpio_private *priv = (struct gpio_private *)file->private_data; 377 struct gpio_private *priv = (struct gpio_private *)file->private_data;
351 unsigned char data, clk_mask, data_mask, write_msb; 378 unsigned char data, clk_mask, data_mask, write_msb;
352 unsigned long flags; 379 unsigned long flags;
380
381 spin_lock(&gpio_lock);
382
353 ssize_t retval = count; 383 ssize_t retval = count;
354 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { 384 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) {
355 return -EFAULT; 385 return -EFAULT;
@@ -372,7 +402,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
372 data = *buf++; 402 data = *buf++;
373 if (priv->write_msb) { 403 if (priv->write_msb) {
374 for (i = 7; i >= 0;i--) { 404 for (i = 7; i >= 0;i--) {
375 local_irq_save(flags); local_irq_disable(); 405 local_irq_save(flags);
376 *priv->port = *priv->shadow &= ~clk_mask; 406 *priv->port = *priv->shadow &= ~clk_mask;
377 if (data & 1<<i) 407 if (data & 1<<i)
378 *priv->port = *priv->shadow |= data_mask; 408 *priv->port = *priv->shadow |= data_mask;
@@ -384,7 +414,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
384 } 414 }
385 } else { 415 } else {
386 for (i = 0; i <= 7;i++) { 416 for (i = 0; i <= 7;i++) {
387 local_irq_save(flags); local_irq_disable(); 417 local_irq_save(flags);
388 *priv->port = *priv->shadow &= ~clk_mask; 418 *priv->port = *priv->shadow &= ~clk_mask;
389 if (data & 1<<i) 419 if (data & 1<<i)
390 *priv->port = *priv->shadow |= data_mask; 420 *priv->port = *priv->shadow |= data_mask;
@@ -396,6 +426,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
396 } 426 }
397 } 427 }
398 } 428 }
429 spin_unlock(&gpio_lock);
399 return retval; 430 return retval;
400} 431}
401 432
@@ -452,9 +483,14 @@ gpio_open(struct inode *inode, struct file *filp)
452static int 483static int
453gpio_release(struct inode *inode, struct file *filp) 484gpio_release(struct inode *inode, struct file *filp)
454{ 485{
455 struct gpio_private *p = alarmlist; 486 struct gpio_private *p;
456 struct gpio_private *todel = (struct gpio_private *)filp->private_data; 487 struct gpio_private *todel;
457 488
489 spin_lock(&gpio_lock);
490
491 p = alarmlist;
492 todel = (struct gpio_private *)filp->private_data;
493
458 /* unlink from alarmlist and free the private structure */ 494 /* unlink from alarmlist and free the private structure */
459 495
460 if (p == todel) { 496 if (p == todel) {
@@ -476,7 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
476 p = p->next; 512 p = p->next;
477 } 513 }
478 gpio_some_alarms = 0; 514 gpio_some_alarms = 0;
479 515 spin_unlock(&gpio_lock);
480 return 0; 516 return 0;
481} 517}
482 518
@@ -491,14 +527,14 @@ unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
491 */ 527 */
492 unsigned long flags; 528 unsigned long flags;
493 if (USE_PORTS(priv)) { 529 if (USE_PORTS(priv)) {
494 local_irq_save(flags); local_irq_disable(); 530 local_irq_save(flags);
495 *priv->dir = *priv->dir_shadow &= 531 *priv->dir = *priv->dir_shadow &=
496 ~((unsigned char)arg & priv->changeable_dir); 532 ~((unsigned char)arg & priv->changeable_dir);
497 local_irq_restore(flags); 533 local_irq_restore(flags);
498 return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */ 534 return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */
499 } else if (priv->minor == GPIO_MINOR_G) { 535 } else if (priv->minor == GPIO_MINOR_G) {
500 /* We must fiddle with R_GEN_CONFIG to change dir */ 536 /* We must fiddle with R_GEN_CONFIG to change dir */
501 save_flags(flags); cli(); 537 local_irq_save(flags);
502 if (((arg & dir_g_in_bits) != arg) && 538 if (((arg & dir_g_in_bits) != arg) &&
503 (arg & changeable_dir_g)) { 539 (arg & changeable_dir_g)) {
504 arg &= changeable_dir_g; 540 arg &= changeable_dir_g;
@@ -533,7 +569,7 @@ unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
533 /* Must be a >120 ns delay before writing this again */ 569 /* Must be a >120 ns delay before writing this again */
534 570
535 } 571 }
536 restore_flags(flags); 572 local_irq_restore(flags);
537 return dir_g_in_bits; 573 return dir_g_in_bits;
538 } 574 }
539 return 0; 575 return 0;
@@ -543,14 +579,14 @@ unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
543{ 579{
544 unsigned long flags; 580 unsigned long flags;
545 if (USE_PORTS(priv)) { 581 if (USE_PORTS(priv)) {
546 local_irq_save(flags); local_irq_disable(); 582 local_irq_save(flags);
547 *priv->dir = *priv->dir_shadow |= 583 *priv->dir = *priv->dir_shadow |=
548 ((unsigned char)arg & priv->changeable_dir); 584 ((unsigned char)arg & priv->changeable_dir);
549 local_irq_restore(flags); 585 local_irq_restore(flags);
550 return *priv->dir_shadow; 586 return *priv->dir_shadow;
551 } else if (priv->minor == GPIO_MINOR_G) { 587 } else if (priv->minor == GPIO_MINOR_G) {
552 /* We must fiddle with R_GEN_CONFIG to change dir */ 588 /* We must fiddle with R_GEN_CONFIG to change dir */
553 save_flags(flags); cli(); 589 local_irq_save(flags);
554 if (((arg & dir_g_out_bits) != arg) && 590 if (((arg & dir_g_out_bits) != arg) &&
555 (arg & changeable_dir_g)) { 591 (arg & changeable_dir_g)) {
556 /* Set bits in genconfig to set to output */ 592 /* Set bits in genconfig to set to output */
@@ -583,7 +619,7 @@ unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
583 *R_GEN_CONFIG = genconfig_shadow; 619 *R_GEN_CONFIG = genconfig_shadow;
584 /* Must be a >120 ns delay before writing this again */ 620 /* Must be a >120 ns delay before writing this again */
585 } 621 }
586 restore_flags(flags); 622 local_irq_restore(flags);
587 return dir_g_out_bits & 0x7FFFFFFF; 623 return dir_g_out_bits & 0x7FFFFFFF;
588 } 624 }
589 return 0; 625 return 0;
@@ -598,22 +634,26 @@ gpio_ioctl(struct inode *inode, struct file *file,
598{ 634{
599 unsigned long flags; 635 unsigned long flags;
600 unsigned long val; 636 unsigned long val;
637 int ret = 0;
638
601 struct gpio_private *priv = (struct gpio_private *)file->private_data; 639 struct gpio_private *priv = (struct gpio_private *)file->private_data;
602 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) { 640 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {
603 return -EINVAL; 641 return -EINVAL;
604 } 642 }
605 643
644 spin_lock(&gpio_lock);
645
606 switch (_IOC_NR(cmd)) { 646 switch (_IOC_NR(cmd)) {
607 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */ 647 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */
608 // read the port 648 // read the port
609 if (USE_PORTS(priv)) { 649 if (USE_PORTS(priv)) {
610 return *priv->port; 650 ret = *priv->port;
611 } else if (priv->minor == GPIO_MINOR_G) { 651 } else if (priv->minor == GPIO_MINOR_G) {
612 return (*R_PORT_G_DATA) & 0x7FFFFFFF; 652 ret = (*R_PORT_G_DATA) & 0x7FFFFFFF;
613 } 653 }
614 break; 654 break;
615 case IO_SETBITS: 655 case IO_SETBITS:
616 local_irq_save(flags); local_irq_disable(); 656 local_irq_save(flags);
617 // set changeable bits with a 1 in arg 657 // set changeable bits with a 1 in arg
618 if (USE_PORTS(priv)) { 658 if (USE_PORTS(priv)) {
619 *priv->port = *priv->shadow |= 659 *priv->port = *priv->shadow |=
@@ -624,7 +664,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
624 local_irq_restore(flags); 664 local_irq_restore(flags);
625 break; 665 break;
626 case IO_CLRBITS: 666 case IO_CLRBITS:
627 local_irq_save(flags); local_irq_disable(); 667 local_irq_save(flags);
628 // clear changeable bits with a 1 in arg 668 // clear changeable bits with a 1 in arg
629 if (USE_PORTS(priv)) { 669 if (USE_PORTS(priv)) {
630 *priv->port = *priv->shadow &= 670 *priv->port = *priv->shadow &=
@@ -666,33 +706,34 @@ gpio_ioctl(struct inode *inode, struct file *file,
666 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ 706 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
667 /* Read direction 0=input 1=output */ 707 /* Read direction 0=input 1=output */
668 if (USE_PORTS(priv)) { 708 if (USE_PORTS(priv)) {
669 return *priv->dir_shadow; 709 ret = *priv->dir_shadow;
670 } else if (priv->minor == GPIO_MINOR_G) { 710 } else if (priv->minor == GPIO_MINOR_G) {
671 /* Note: Some bits are both in and out, 711 /* Note: Some bits are both in and out,
672 * Those that are dual is set here as well. 712 * Those that are dual is set here as well.
673 */ 713 */
674 return (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF; 714 ret = (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF;
675 } 715 }
716 break;
676 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */ 717 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */
677 /* Set direction 0=unchanged 1=input, 718 /* Set direction 0=unchanged 1=input,
678 * return mask with 1=input 719 * return mask with 1=input
679 */ 720 */
680 return setget_input(priv, arg) & 0x7FFFFFFF; 721 ret = setget_input(priv, arg) & 0x7FFFFFFF;
681 break; 722 break;
682 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */ 723 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */
683 /* Set direction 0=unchanged 1=output, 724 /* Set direction 0=unchanged 1=output,
684 * return mask with 1=output 725 * return mask with 1=output
685 */ 726 */
686 return setget_output(priv, arg) & 0x7FFFFFFF; 727 ret = setget_output(priv, arg) & 0x7FFFFFFF;
687 728 break;
688 case IO_SHUTDOWN: 729 case IO_SHUTDOWN:
689 SOFT_SHUTDOWN(); 730 SOFT_SHUTDOWN();
690 break; 731 break;
691 case IO_GET_PWR_BT: 732 case IO_GET_PWR_BT:
692#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN) 733#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN)
693 return (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT)); 734 ret = (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT));
694#else 735#else
695 return 0; 736 ret = 0;
696#endif 737#endif
697 break; 738 break;
698 case IO_CFG_WRITE_MODE: 739 case IO_CFG_WRITE_MODE:
@@ -709,7 +750,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
709 { 750 {
710 priv->clk_mask = 0; 751 priv->clk_mask = 0;
711 priv->data_mask = 0; 752 priv->data_mask = 0;
712 return -EPERM; 753 ret = -EPERM;
713 } 754 }
714 break; 755 break;
715 case IO_READ_INBITS: 756 case IO_READ_INBITS:
@@ -720,8 +761,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
720 val = *R_PORT_G_DATA; 761 val = *R_PORT_G_DATA;
721 } 762 }
722 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 763 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
723 return -EFAULT; 764 ret = -EFAULT;
724 return 0;
725 break; 765 break;
726 case IO_READ_OUTBITS: 766 case IO_READ_OUTBITS:
727 /* *arg is result of reading the output shadow */ 767 /* *arg is result of reading the output shadow */
@@ -731,36 +771,43 @@ gpio_ioctl(struct inode *inode, struct file *file,
731 val = port_g_data_shadow; 771 val = port_g_data_shadow;
732 } 772 }
733 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 773 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
734 return -EFAULT; 774 ret = -EFAULT;
735 break; 775 break;
736 case IO_SETGET_INPUT: 776 case IO_SETGET_INPUT:
737 /* bits set in *arg is set to input, 777 /* bits set in *arg is set to input,
738 * *arg updated with current input pins. 778 * *arg updated with current input pins.
739 */ 779 */
740 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val))) 780 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
741 return -EFAULT; 781 {
782 ret = -EFAULT;
783 break;
784 }
742 val = setget_input(priv, val); 785 val = setget_input(priv, val);
743 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 786 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
744 return -EFAULT; 787 ret = -EFAULT;
745 break; 788 break;
746 case IO_SETGET_OUTPUT: 789 case IO_SETGET_OUTPUT:
747 /* bits set in *arg is set to output, 790 /* bits set in *arg is set to output,
748 * *arg updated with current output pins. 791 * *arg updated with current output pins.
749 */ 792 */
750 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val))) 793 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
751 return -EFAULT; 794 {
795 ret = -EFAULT;
796 break;
797 }
752 val = setget_output(priv, val); 798 val = setget_output(priv, val);
753 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 799 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
754 return -EFAULT; 800 ret = -EFAULT;
755 break; 801 break;
756 default: 802 default:
757 if (priv->minor == GPIO_MINOR_LEDS) 803 if (priv->minor == GPIO_MINOR_LEDS)
758 return gpio_leds_ioctl(cmd, arg); 804 ret = gpio_leds_ioctl(cmd, arg);
759 else 805 else
760 return -EINVAL; 806 ret = -EINVAL;
761 } /* switch */ 807 } /* switch */
762 808
763 return 0; 809 spin_unlock(&gpio_lock);
810 return ret;
764} 811}
765 812
766static int 813static int
@@ -802,60 +849,20 @@ struct file_operations gpio_fops = {
802}; 849};
803 850
804 851
805static void __init gpio_init_port_g(void) 852void ioif_watcher(const unsigned int gpio_in_available,
853 const unsigned int gpio_out_available,
854 const unsigned char pa_available,
855 const unsigned char pb_available)
806{ 856{
807#define GROUPA (0x0000FF3F) 857 unsigned long int flags;
808#define GROUPB (1<<6 | 1<<7) 858 D(printk("gpio.c: ioif_watcher called\n"));
809#define GROUPC (1<<30 | 1<<31) 859 D(printk("gpio.c: G in: 0x%08x G out: 0x%08x PA: 0x%02x PB: 0x%02x\n",
810#define GROUPD (0x3FFF0000) 860 gpio_in_available, gpio_out_available, pa_available, pb_available));
811#define GROUPD_LOW (0x00FF0000)
812 unsigned long used_in_bits = 0;
813 unsigned long used_out_bits = 0;
814 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi0, select)){
815 used_in_bits |= GROUPA | GROUPB | 0 | 0;
816 used_out_bits |= GROUPA | GROUPB | 0 | 0;
817 }
818 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ata, select)) {
819 used_in_bits |= GROUPA | GROUPB | GROUPC | (GROUPD & ~(1<<25|1<<26));
820 used_out_bits |= GROUPA | GROUPB | GROUPC | GROUPD;
821 }
822 861
823 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, par0, select)) { 862 spin_lock_irqsave(&gpio_lock, flags);
824 used_in_bits |= (GROUPA & ~(1<<0)) | 0 | 0 | 0;
825 used_out_bits |= (GROUPA & ~(1<<0)) | 0 | 0 | 0;
826 }
827 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ser2, select)) {
828 used_in_bits |= 0 | GROUPB | 0 | 0;
829 used_out_bits |= 0 | GROUPB | 0 | 0;
830 }
831 /* mio same as shared RAM ? */
832 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, mio, select)) {
833 used_in_bits |= (GROUPA & ~(1<<0)) | 0 |0 |GROUPD_LOW;
834 used_out_bits |= (GROUPA & ~(1<<0|1<<1|1<<2)) | 0 |0 |GROUPD_LOW;
835 }
836 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi1, select)) {
837 used_in_bits |= 0 | 0 | GROUPC | GROUPD;
838 used_out_bits |= 0 | 0 | GROUPC | GROUPD;
839 }
840 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi0w, select)) {
841 used_in_bits |= GROUPA | GROUPB | 0 | (GROUPD_LOW | 1<<24);
842 used_out_bits |= GROUPA | GROUPB | 0 | (GROUPD_LOW | 1<<24 | 1<<25|1<<26);
843 }
844 863
845 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, par1, select)) { 864 dir_g_in_bits = gpio_in_available;
846 used_in_bits |= 0 | 0 | 0 | (GROUPD & ~(1<<24)); 865 dir_g_out_bits = gpio_out_available;
847 used_out_bits |= 0 | 0 | 0 | (GROUPD & ~(1<<24));
848 }
849 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ser3, select)) {
850 used_in_bits |= 0 | 0 | GROUPC | 0;
851 used_out_bits |= 0 | 0 | GROUPC | 0;
852 }
853 /* mio same as shared RAM-W? */
854 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, mio_w, select)) {
855 used_in_bits |= (GROUPA & ~(1<<0)) | 0 | 0 |GROUPD_LOW;
856 used_out_bits |= (GROUPA & ~(1<<0|1<<1|1<<2)) | 0 | 0 |GROUPD_LOW;
857 }
858 /* TODO: USB p2, parw, sync ser3? */
859 866
860 /* Initialise the dir_g_shadow etc. depending on genconfig */ 867 /* Initialise the dir_g_shadow etc. depending on genconfig */
861 /* 0=input 1=output */ 868 /* 0=input 1=output */
@@ -868,10 +875,7 @@ static void __init gpio_init_port_g(void)
868 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, g24dir, out)) 875 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, g24dir, out))
869 dir_g_shadow |= (1 << 24); 876 dir_g_shadow |= (1 << 24);
870 877
871 dir_g_in_bits = ~used_in_bits; 878 changeable_dir_g = changeable_dir_g_mask;
872 dir_g_out_bits = ~used_out_bits;
873
874 changeable_dir_g = 0x01FFFF01; /* all that can change dir */
875 changeable_dir_g &= dir_g_out_bits; 879 changeable_dir_g &= dir_g_out_bits;
876 changeable_dir_g &= dir_g_in_bits; 880 changeable_dir_g &= dir_g_in_bits;
877 /* Correct the bits that can change direction */ 881 /* Correct the bits that can change direction */
@@ -880,6 +884,7 @@ static void __init gpio_init_port_g(void)
880 dir_g_in_bits &= ~changeable_dir_g; 884 dir_g_in_bits &= ~changeable_dir_g;
881 dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g); 885 dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g);
882 886
887 spin_unlock_irqrestore(&gpio_lock, flags);
883 888
884 printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n", 889 printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
885 dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA); 890 dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA);
@@ -896,6 +901,7 @@ gpio_init(void)
896#if defined (CONFIG_ETRAX_CSP0_LEDS) 901#if defined (CONFIG_ETRAX_CSP0_LEDS)
897 int i; 902 int i;
898#endif 903#endif
904 printk("gpio init\n");
899 905
900 /* do the formalities */ 906 /* do the formalities */
901 907
@@ -919,8 +925,13 @@ gpio_init(void)
919#endif 925#endif
920 926
921#endif 927#endif
922 gpio_init_port_g(); 928 /* The I/O interface allocation watcher will be called when
923 printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n"); 929 * registering it. */
930 if (cris_io_interface_register_watcher(ioif_watcher)){
931 printk(KERN_WARNING "gpio_init: Failed to install IO if allocator watcher\n");
932 }
933
934 printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002, 2003, 2004 Axis Communications AB\n");
924 /* We call etrax_gpio_wake_up_check() from timer interrupt and 935 /* We call etrax_gpio_wake_up_check() from timer interrupt and
925 * from cpu_idle() in kernel/process.c 936 * from cpu_idle() in kernel/process.c
926 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms 937 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index 8bbe233ba7b1..b38267d60d30 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -12,6 +12,15 @@
12*! don't use PB_I2C if DS1302 uses same bits, 12*! don't use PB_I2C if DS1302 uses same bits,
13*! use PB. 13*! use PB.
14*! $Log: i2c.c,v $ 14*! $Log: i2c.c,v $
15*! Revision 1.13 2005/03/07 13:13:07 starvik
16*! Added spinlocks to protect states etc
17*!
18*! Revision 1.12 2005/01/05 06:11:22 starvik
19*! No need to do local_irq_disable after local_irq_save.
20*!
21*! Revision 1.11 2004/12/13 12:21:52 starvik
22*! Added I/O and DMA allocators from Linux 2.4
23*!
15*! Revision 1.9 2004/08/24 06:49:14 starvik 24*! Revision 1.9 2004/08/24 06:49:14 starvik
16*! Whitespace cleanup 25*! Whitespace cleanup
17*! 26*!
@@ -75,7 +84,7 @@
75*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN 84*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
76*! 85*!
77*!***************************************************************************/ 86*!***************************************************************************/
78/* $Id: i2c.c,v 1.9 2004/08/24 06:49:14 starvik Exp $ */ 87/* $Id: i2c.c,v 1.13 2005/03/07 13:13:07 starvik Exp $ */
79 88
80/****************** INCLUDE FILES SECTION ***********************************/ 89/****************** INCLUDE FILES SECTION ***********************************/
81 90
@@ -95,6 +104,7 @@
95#include <asm/arch/svinto.h> 104#include <asm/arch/svinto.h>
96#include <asm/io.h> 105#include <asm/io.h>
97#include <asm/delay.h> 106#include <asm/delay.h>
107#include <asm/arch/io_interface_mux.h>
98 108
99#include "i2c.h" 109#include "i2c.h"
100 110
@@ -184,6 +194,7 @@ static const char i2c_name[] = "i2c";
184 194
185#define i2c_delay(usecs) udelay(usecs) 195#define i2c_delay(usecs) udelay(usecs)
186 196
197static DEFINE_SPINLOCK(i2c_lock); /* Protect directions etc */
187 198
188/****************** FUNCTION DEFINITION SECTION *************************/ 199/****************** FUNCTION DEFINITION SECTION *************************/
189 200
@@ -488,13 +499,14 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg,
488 int error, cntr = 3; 499 int error, cntr = 3;
489 unsigned long flags; 500 unsigned long flags;
490 501
502 spin_lock(&i2c_lock);
503
491 do { 504 do {
492 error = 0; 505 error = 0;
493 /* 506 /*
494 * we don't like to be interrupted 507 * we don't like to be interrupted
495 */ 508 */
496 local_irq_save(flags); 509 local_irq_save(flags);
497 local_irq_disable();
498 510
499 i2c_start(); 511 i2c_start();
500 /* 512 /*
@@ -538,6 +550,8 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg,
538 550
539 i2c_delay(CLOCK_LOW_TIME); 551 i2c_delay(CLOCK_LOW_TIME);
540 552
553 spin_unlock(&i2c_lock);
554
541 return -error; 555 return -error;
542} 556}
543 557
@@ -555,13 +569,14 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
555 int error, cntr = 3; 569 int error, cntr = 3;
556 unsigned long flags; 570 unsigned long flags;
557 571
572 spin_lock(&i2c_lock);
573
558 do { 574 do {
559 error = 0; 575 error = 0;
560 /* 576 /*
561 * we don't like to be interrupted 577 * we don't like to be interrupted
562 */ 578 */
563 local_irq_save(flags); 579 local_irq_save(flags);
564 local_irq_disable();
565 /* 580 /*
566 * generate start condition 581 * generate start condition
567 */ 582 */
@@ -620,6 +635,8 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
620 635
621 } while(error && cntr--); 636 } while(error && cntr--);
622 637
638 spin_unlock(&i2c_lock);
639
623 return b; 640 return b;
624} 641}
625 642
@@ -686,15 +703,26 @@ static struct file_operations i2c_fops = {
686int __init 703int __init
687i2c_init(void) 704i2c_init(void)
688{ 705{
706 static int res = 0;
707 static int first = 1;
708
709 if (!first) {
710 return res;
711 }
712
689 /* Setup and enable the Port B I2C interface */ 713 /* Setup and enable the Port B I2C interface */
690 714
691#ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C 715#ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
716 if ((res = cris_request_io_interface(if_i2c, "I2C"))) {
717 printk(KERN_CRIT "i2c_init: Failed to get IO interface\n");
718 return res;
719 }
720
692 *R_PORT_PB_I2C = port_pb_i2c_shadow |= 721 *R_PORT_PB_I2C = port_pb_i2c_shadow |=
693 IO_STATE(R_PORT_PB_I2C, i2c_en, on) | 722 IO_STATE(R_PORT_PB_I2C, i2c_en, on) |
694 IO_FIELD(R_PORT_PB_I2C, i2c_d, 1) | 723 IO_FIELD(R_PORT_PB_I2C, i2c_d, 1) |
695 IO_FIELD(R_PORT_PB_I2C, i2c_clk, 1) | 724 IO_FIELD(R_PORT_PB_I2C, i2c_clk, 1) |
696 IO_STATE(R_PORT_PB_I2C, i2c_oe_, enable); 725 IO_STATE(R_PORT_PB_I2C, i2c_oe_, enable);
697#endif
698 726
699 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir0); 727 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir0);
700 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir1); 728 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir1);
@@ -702,8 +730,26 @@ i2c_init(void)
702 *R_PORT_PB_DIR = (port_pb_dir_shadow |= 730 *R_PORT_PB_DIR = (port_pb_dir_shadow |=
703 IO_STATE(R_PORT_PB_DIR, dir0, input) | 731 IO_STATE(R_PORT_PB_DIR, dir0, input) |
704 IO_STATE(R_PORT_PB_DIR, dir1, output)); 732 IO_STATE(R_PORT_PB_DIR, dir1, output));
733#else
734 if ((res = cris_io_interface_allocate_pins(if_i2c,
735 'b',
736 CONFIG_ETRAX_I2C_DATA_PORT,
737 CONFIG_ETRAX_I2C_DATA_PORT))) {
738 printk(KERN_WARNING "i2c_init: Failed to get IO pin for I2C data port\n");
739 return res;
740 } else if ((res = cris_io_interface_allocate_pins(if_i2c,
741 'b',
742 CONFIG_ETRAX_I2C_CLK_PORT,
743 CONFIG_ETRAX_I2C_CLK_PORT))) {
744 cris_io_interface_free_pins(if_i2c,
745 'b',
746 CONFIG_ETRAX_I2C_DATA_PORT,
747 CONFIG_ETRAX_I2C_DATA_PORT);
748 printk(KERN_WARNING "i2c_init: Failed to get IO pin for I2C clk port\n");
749 }
750#endif
705 751
706 return 0; 752 return res;
707} 753}
708 754
709static int __init 755static int __init
@@ -711,14 +757,16 @@ i2c_register(void)
711{ 757{
712 int res; 758 int res;
713 759
714 i2c_init(); 760 res = i2c_init();
761 if (res < 0)
762 return res;
715 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops); 763 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
716 if(res < 0) { 764 if(res < 0) {
717 printk(KERN_ERR "i2c: couldn't get a major number.\n"); 765 printk(KERN_ERR "i2c: couldn't get a major number.\n");
718 return res; 766 return res;
719 } 767 }
720 768
721 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n"); 769 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2004 Axis Communications AB\n");
722 770
723 return 0; 771 return 0;
724} 772}
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index b3dfdf7b8fc5..201f4c90d961 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * Author: Tobias Anderberg <tobiasa@axis.com>. 16 * Author: Tobias Anderberg <tobiasa@axis.com>.
17 * 17 *
18 * $Id: pcf8563.c,v 1.8 2004/08/24 06:42:51 starvik Exp $ 18 * $Id: pcf8563.c,v 1.11 2005/03/07 13:13:07 starvik Exp $
19 */ 19 */
20 20
21#include <linux/config.h> 21#include <linux/config.h>
@@ -40,7 +40,7 @@
40#define PCF8563_MAJOR 121 /* Local major number. */ 40#define PCF8563_MAJOR 121 /* Local major number. */
41#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */ 41#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
42#define PCF8563_NAME "PCF8563" 42#define PCF8563_NAME "PCF8563"
43#define DRIVER_VERSION "$Revision: 1.8 $" 43#define DRIVER_VERSION "$Revision: 1.11 $"
44 44
45/* I2C bus slave registers. */ 45/* I2C bus slave registers. */
46#define RTC_I2C_READ 0xa3 46#define RTC_I2C_READ 0xa3
@@ -49,6 +49,8 @@
49/* Two simple wrapper macros, saves a few keystrokes. */ 49/* Two simple wrapper macros, saves a few keystrokes. */
50#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 50#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
51#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 51#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
52
53static DEFINE_SPINLOCK(rtc_lock); /* Protect state etc */
52 54
53static const unsigned char days_in_month[] = 55static const unsigned char days_in_month[] =
54 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 56 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
@@ -125,9 +127,12 @@ get_rtc_time(struct rtc_time *tm)
125int __init 127int __init
126pcf8563_init(void) 128pcf8563_init(void)
127{ 129{
128 unsigned char ret; 130 int ret;
129 131
130 i2c_init(); 132 if ((ret = i2c_init())) {
133 printk(KERN_CRIT "pcf8563_init: failed to init i2c\n");
134 return ret;
135 }
131 136
132 /* 137 /*
133 * First of all we need to reset the chip. This is done by 138 * First of all we need to reset the chip. This is done by
@@ -200,12 +205,15 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
200 { 205 {
201 struct rtc_time tm; 206 struct rtc_time tm;
202 207
208 spin_lock(&rtc_lock);
203 get_rtc_time(&tm); 209 get_rtc_time(&tm);
204 210
205 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) { 211 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) {
212 spin_unlock(&rtc_lock);
206 return -EFAULT; 213 return -EFAULT;
207 } 214 }
208 215
216 spin_unlock(&rtc_lock);
209 return 0; 217 return 0;
210 } 218 }
211 break; 219 break;
@@ -250,6 +258,8 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
250 BIN_TO_BCD(tm.tm_min); 258 BIN_TO_BCD(tm.tm_min);
251 BIN_TO_BCD(tm.tm_sec); 259 BIN_TO_BCD(tm.tm_sec);
252 tm.tm_mon |= century; 260 tm.tm_mon |= century;
261
262 spin_lock(&rtc_lock);
253 263
254 rtc_write(RTC_YEAR, tm.tm_year); 264 rtc_write(RTC_YEAR, tm.tm_year);
255 rtc_write(RTC_MONTH, tm.tm_mon); 265 rtc_write(RTC_MONTH, tm.tm_mon);
@@ -258,6 +268,8 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
258 rtc_write(RTC_MINUTES, tm.tm_min); 268 rtc_write(RTC_MINUTES, tm.tm_min);
259 rtc_write(RTC_SECONDS, tm.tm_sec); 269 rtc_write(RTC_SECONDS, tm.tm_sec);
260 270
271 spin_unlock(&rtc_lock);
272
261 return 0; 273 return 0;
262#endif /* !CONFIG_ETRAX_RTC_READONLY */ 274#endif /* !CONFIG_ETRAX_RTC_READONLY */
263 } 275 }
diff --git a/arch/cris/arch-v10/kernel/Makefile b/arch/cris/arch-v10/kernel/Makefile
index 52761603b6a5..dcfec41d3533 100644
--- a/arch/cris/arch-v10/kernel/Makefile
+++ b/arch/cris/arch-v10/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.5 2004/06/02 08:24:38 starvik Exp $ 1# $Id: Makefile,v 1.6 2004/12/13 12:21:51 starvik Exp $
2# 2#
3# Makefile for the linux kernel. 3# Makefile for the linux kernel.
4# 4#
@@ -7,7 +7,8 @@ extra-y := head.o
7 7
8 8
9obj-y := entry.o traps.o shadows.o debugport.o irq.o \ 9obj-y := entry.o traps.o shadows.o debugport.o irq.o \
10 process.o setup.o signal.o traps.o time.o ptrace.o 10 process.o setup.o signal.o traps.o time.o ptrace.o \
11 dma.o io_interface_mux.o
11 12
12obj-$(CONFIG_ETRAX_KGDB) += kgdb.o 13obj-$(CONFIG_ETRAX_KGDB) += kgdb.o
13obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o 14obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 6cf069e5e7b6..f3a85b77c17e 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -12,6 +12,31 @@
12 * init_etrax_debug() 12 * init_etrax_debug()
13 * 13 *
14 * $Log: debugport.c,v $ 14 * $Log: debugport.c,v $
15 * Revision 1.27 2005/06/10 10:34:14 starvik
16 * Real console support
17 *
18 * Revision 1.26 2005/06/07 07:06:07 starvik
19 * Added LF->CR translation to make ETRAX customers happy.
20 *
21 * Revision 1.25 2005/03/08 08:56:47 mikaelam
22 * Do only set index as port->index if port is defined, otherwise use the index from the command line
23 *
24 * Revision 1.24 2005/01/19 10:26:33 mikaelam
25 * Return the cris serial driver in console device driver callback function
26 *
27 * Revision 1.23 2005/01/14 10:12:17 starvik
28 * KGDB on separate port.
29 * Console fixes from 2.4.
30 *
31 * Revision 1.22 2005/01/11 16:06:13 starvik
32 * typo
33 *
34 * Revision 1.21 2005/01/11 13:49:14 starvik
35 * Added raw_printk to be used where we don't trust the console.
36 *
37 * Revision 1.20 2004/12/27 11:18:32 starvik
38 * Merge of Linux 2.6.10 (not functional yet).
39 *
15 * Revision 1.19 2004/10/21 07:26:16 starvik 40 * Revision 1.19 2004/10/21 07:26:16 starvik
16 * Made it possible to specify console settings on kernel command line. 41 * Made it possible to specify console settings on kernel command line.
17 * 42 *
@@ -114,7 +139,11 @@ struct dbg_port ports[]=
114 R_SERIAL0_BAUD, 139 R_SERIAL0_BAUD,
115 R_SERIAL0_TR_CTRL, 140 R_SERIAL0_TR_CTRL,
116 R_SERIAL0_REC_CTRL, 141 R_SERIAL0_REC_CTRL,
117 IO_STATE(R_IRQ_MASK1_SET, ser0_data, set) 142 IO_STATE(R_IRQ_MASK1_SET, ser0_data, set),
143 0,
144 115200,
145 'N',
146 8
118 }, 147 },
119 { 148 {
120 1, 149 1,
@@ -124,7 +153,11 @@ struct dbg_port ports[]=
124 R_SERIAL1_BAUD, 153 R_SERIAL1_BAUD,
125 R_SERIAL1_TR_CTRL, 154 R_SERIAL1_TR_CTRL,
126 R_SERIAL1_REC_CTRL, 155 R_SERIAL1_REC_CTRL,
127 IO_STATE(R_IRQ_MASK1_SET, ser1_data, set) 156 IO_STATE(R_IRQ_MASK1_SET, ser1_data, set),
157 0,
158 115200,
159 'N',
160 8
128 }, 161 },
129 { 162 {
130 2, 163 2,
@@ -134,7 +167,11 @@ struct dbg_port ports[]=
134 R_SERIAL2_BAUD, 167 R_SERIAL2_BAUD,
135 R_SERIAL2_TR_CTRL, 168 R_SERIAL2_TR_CTRL,
136 R_SERIAL2_REC_CTRL, 169 R_SERIAL2_REC_CTRL,
137 IO_STATE(R_IRQ_MASK1_SET, ser2_data, set) 170 IO_STATE(R_IRQ_MASK1_SET, ser2_data, set),
171 0,
172 115200,
173 'N',
174 8
138 }, 175 },
139 { 176 {
140 3, 177 3,
@@ -144,11 +181,15 @@ struct dbg_port ports[]=
144 R_SERIAL3_BAUD, 181 R_SERIAL3_BAUD,
145 R_SERIAL3_TR_CTRL, 182 R_SERIAL3_TR_CTRL,
146 R_SERIAL3_REC_CTRL, 183 R_SERIAL3_REC_CTRL,
147 IO_STATE(R_IRQ_MASK1_SET, ser3_data, set) 184 IO_STATE(R_IRQ_MASK1_SET, ser3_data, set),
185 0,
186 115200,
187 'N',
188 8
148 } 189 }
149}; 190};
150 191
151static struct tty_driver *serial_driver; 192extern struct tty_driver *serial_driver;
152 193
153struct dbg_port* port = 194struct dbg_port* port =
154#if defined(CONFIG_ETRAX_DEBUG_PORT0) 195#if defined(CONFIG_ETRAX_DEBUG_PORT0)
@@ -162,37 +203,44 @@ struct dbg_port* port =
162#else 203#else
163 NULL; 204 NULL;
164#endif 205#endif
165/* Used by serial.c to register a debug_write_function so that the normal
166 * serial driver is used for kernel debug output
167 */
168typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
169 206
170debugport_write_function debug_write_function = NULL; 207static struct dbg_port* kgdb_port =
208#if defined(CONFIG_ETRAX_KGDB_PORT0)
209 &ports[0];
210#elif defined(CONFIG_ETRAX_KGDB_PORT1)
211 &ports[1];
212#elif defined(CONFIG_ETRAX_KGDB_PORT2)
213 &ports[2];
214#elif defined(CONFIG_ETRAX_KGDB_PORT3)
215 &ports[3];
216#else
217 NULL;
218#endif
171 219
172static void 220static void
173start_port(void) 221start_port(struct dbg_port* p)
174{ 222{
175 unsigned long rec_ctrl = 0; 223 unsigned long rec_ctrl = 0;
176 unsigned long tr_ctrl = 0; 224 unsigned long tr_ctrl = 0;
177 225
178 if (!port) 226 if (!p)
179 return; 227 return;
180 228
181 if (port->started) 229 if (p->started)
182 return; 230 return;
183 port->started = 1; 231 p->started = 1;
184 232
185 if (port->index == 0) 233 if (p->index == 0)
186 { 234 {
187 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); 235 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6);
188 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused); 236 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
189 } 237 }
190 else if (port->index == 1) 238 else if (p->index == 1)
191 { 239 {
192 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8); 240 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8);
193 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb); 241 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
194 } 242 }
195 else if (port->index == 2) 243 else if (p->index == 2)
196 { 244 {
197 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2); 245 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2);
198 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0); 246 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
@@ -211,69 +259,69 @@ start_port(void)
211 259
212 *R_GEN_CONFIG = genconfig_shadow; 260 *R_GEN_CONFIG = genconfig_shadow;
213 261
214 *port->xoff = 262 *p->xoff =
215 IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) | 263 IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) |
216 IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) | 264 IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) |
217 IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0); 265 IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0);
218 266
219 switch (port->baudrate) 267 switch (p->baudrate)
220 { 268 {
221 case 0: 269 case 0:
222 case 115200: 270 case 115200:
223 *port->baud = 271 *p->baud =
224 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) | 272 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
225 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz); 273 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
226 break; 274 break;
227 case 1200: 275 case 1200:
228 *port->baud = 276 *p->baud =
229 IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) | 277 IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) |
230 IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz); 278 IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz);
231 break; 279 break;
232 case 2400: 280 case 2400:
233 *port->baud = 281 *p->baud =
234 IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) | 282 IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) |
235 IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz); 283 IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz);
236 break; 284 break;
237 case 4800: 285 case 4800:
238 *port->baud = 286 *p->baud =
239 IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) | 287 IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) |
240 IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz); 288 IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz);
241 break; 289 break;
242 case 9600: 290 case 9600:
243 *port->baud = 291 *p->baud =
244 IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) | 292 IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) |
245 IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz); 293 IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz);
246 break; 294 break;
247 case 19200: 295 case 19200:
248 *port->baud = 296 *p->baud =
249 IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) | 297 IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) |
250 IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz); 298 IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz);
251 break; 299 break;
252 case 38400: 300 case 38400:
253 *port->baud = 301 *p->baud =
254 IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) | 302 IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) |
255 IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz); 303 IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz);
256 break; 304 break;
257 case 57600: 305 case 57600:
258 *port->baud = 306 *p->baud =
259 IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) | 307 IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) |
260 IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz); 308 IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz);
261 break; 309 break;
262 default: 310 default:
263 *port->baud = 311 *p->baud =
264 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) | 312 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
265 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz); 313 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
266 break; 314 break;
267 } 315 }
268 316
269 if (port->parity == 'E') { 317 if (p->parity == 'E') {
270 rec_ctrl = 318 rec_ctrl =
271 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) | 319 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
272 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable); 320 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
273 tr_ctrl = 321 tr_ctrl =
274 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) | 322 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
275 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable); 323 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
276 } else if (port->parity == 'O') { 324 } else if (p->parity == 'O') {
277 rec_ctrl = 325 rec_ctrl =
278 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) | 326 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) |
279 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable); 327 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
@@ -288,8 +336,7 @@ start_port(void)
288 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) | 336 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
289 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable); 337 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable);
290 } 338 }
291 339 if (p->bits == 7)
292 if (port->bits == 7)
293 { 340 {
294 rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit); 341 rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit);
295 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit); 342 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit);
@@ -300,7 +347,7 @@ start_port(void)
300 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit); 347 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit);
301 } 348 }
302 349
303 *port->rec_ctrl = 350 *p->rec_ctrl =
304 IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) | 351 IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) |
305 IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) | 352 IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) |
306 IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) | 353 IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) |
@@ -308,7 +355,7 @@ start_port(void)
308 IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) | 355 IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) |
309 rec_ctrl; 356 rec_ctrl;
310 357
311 *port->tr_ctrl = 358 *p->tr_ctrl =
312 IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) | 359 IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) |
313 IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) | 360 IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) |
314 IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) | 361 IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) |
@@ -323,8 +370,18 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
323 int i; 370 int i;
324 unsigned long flags; 371 unsigned long flags;
325 local_irq_save(flags); 372 local_irq_save(flags);
373
374 if (!port)
375 return;
376
326 /* Send data */ 377 /* Send data */
327 for (i = 0; i < len; i++) { 378 for (i = 0; i < len; i++) {
379 /* LF -> CRLF */
380 if (buf[i] == '\n') {
381 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
382 ;
383 *port->write = '\r';
384 }
328 /* Wait until transmitter is ready and send.*/ 385 /* Wait until transmitter is ready and send.*/
329 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready))) 386 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
330 ; 387 ;
@@ -333,6 +390,25 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
333 local_irq_restore(flags); 390 local_irq_restore(flags);
334} 391}
335 392
393int raw_printk(const char *fmt, ...)
394{
395 static char buf[1024];
396 int printed_len;
397 static int first = 1;
398 if (first) {
399 /* Force reinitialization of the port to get manual mode. */
400 port->started = 0;
401 start_port(port);
402 first = 0;
403 }
404 va_list args;
405 va_start(args, fmt);
406 printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
407 va_end(args);
408 console_write_direct(NULL, buf, strlen(buf));
409 return printed_len;
410}
411
336static void 412static void
337console_write(struct console *co, const char *buf, unsigned int len) 413console_write(struct console *co, const char *buf, unsigned int len)
338{ 414{
@@ -345,18 +421,7 @@ console_write(struct console *co, const char *buf, unsigned int len)
345 return; 421 return;
346#endif 422#endif
347 423
348 start_port(); 424 console_write_direct(co, buf, len);
349
350#ifdef CONFIG_ETRAX_KGDB
351 /* kgdb needs to output debug info using the gdb protocol */
352 putDebugString(buf, len);
353 return;
354#endif
355
356 if (debug_write_function)
357 debug_write_function(co->index, buf, len);
358 else
359 console_write_direct(co, buf, len);
360} 425}
361 426
362/* legacy function */ 427/* legacy function */
@@ -374,8 +439,11 @@ getDebugChar(void)
374{ 439{
375 unsigned long readval; 440 unsigned long readval;
376 441
442 if (!kgdb_port)
443 return 0;
444
377 do { 445 do {
378 readval = *port->read; 446 readval = *kgdb_port->read;
379 } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail))); 447 } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail)));
380 448
381 return (readval & IO_MASK(R_SERIAL0_READ, data_in)); 449 return (readval & IO_MASK(R_SERIAL0_READ, data_in));
@@ -386,9 +454,12 @@ getDebugChar(void)
386void 454void
387putDebugChar(int val) 455putDebugChar(int val)
388{ 456{
389 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready))) 457 if (!kgdb_port)
458 return;
459
460 while (!(*kgdb_port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
390 ; 461 ;
391 *port->write = val; 462 *kgdb_port->write = val;
392} 463}
393 464
394/* Enable irq for receiving chars on the debug port, used by kgdb */ 465/* Enable irq for receiving chars on the debug port, used by kgdb */
@@ -396,19 +467,16 @@ putDebugChar(int val)
396void 467void
397enableDebugIRQ(void) 468enableDebugIRQ(void)
398{ 469{
399 *R_IRQ_MASK1_SET = port->irq; 470 if (!kgdb_port)
471 return;
472
473 *R_IRQ_MASK1_SET = kgdb_port->irq;
400 /* use R_VECT_MASK directly, since we really bypass Linux normal 474 /* use R_VECT_MASK directly, since we really bypass Linux normal
401 * IRQ handling in kgdb anyway, we don't need to use enable_irq 475 * IRQ handling in kgdb anyway, we don't need to use enable_irq
402 */ 476 */
403 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); 477 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
404 478
405 *port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable); 479 *kgdb_port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
406}
407
408static struct tty_driver*
409etrax_console_device(struct console* co, int *index)
410{
411 return serial_driver;
412} 480}
413 481
414static int __init 482static int __init
@@ -428,11 +496,69 @@ console_setup(struct console *co, char *options)
428 if (*s) port->parity = *s++; 496 if (*s) port->parity = *s++;
429 if (*s) port->bits = *s++ - '0'; 497 if (*s) port->bits = *s++ - '0';
430 port->started = 0; 498 port->started = 0;
431 start_port(); 499 start_port(0);
432 } 500 }
433 return 0; 501 return 0;
434} 502}
435 503
504/* This is a dummy serial device that throws away anything written to it.
505 * This is used when no debug output is wanted.
506 */
507static struct tty_driver dummy_driver;
508
509static int dummy_open(struct tty_struct *tty, struct file * filp)
510{
511 return 0;
512}
513
514static void dummy_close(struct tty_struct *tty, struct file * filp)
515{
516}
517
518static int dummy_write(struct tty_struct * tty,
519 const unsigned char *buf, int count)
520{
521 return count;
522}
523
524static int
525dummy_write_room(struct tty_struct *tty)
526{
527 return 8192;
528}
529
530void __init
531init_dummy_console(void)
532{
533 memset(&dummy_driver, 0, sizeof(struct tty_driver));
534 dummy_driver.driver_name = "serial";
535 dummy_driver.name = "ttyS";
536 dummy_driver.major = TTY_MAJOR;
537 dummy_driver.minor_start = 68;
538 dummy_driver.num = 1; /* etrax100 has 4 serial ports */
539 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
540 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
541 dummy_driver.init_termios = tty_std_termios;
542 dummy_driver.init_termios.c_cflag =
543 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
544 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
545
546 dummy_driver.open = dummy_open;
547 dummy_driver.close = dummy_close;
548 dummy_driver.write = dummy_write;
549 dummy_driver.write_room = dummy_write_room;
550 if (tty_register_driver(&dummy_driver))
551 panic("Couldn't register dummy serial driver\n");
552}
553
554static struct tty_driver*
555etrax_console_device(struct console* co, int *index)
556{
557 if (port)
558 *index = port->index;
559 return port ? serial_driver : &dummy_driver;
560}
561
436static struct console sercons = { 562static struct console sercons = {
437 name : "ttyS", 563 name : "ttyS",
438 write: console_write, 564 write: console_write,
@@ -504,28 +630,21 @@ init_etrax_debug(void)
504 static int first = 1; 630 static int first = 1;
505 631
506 if (!first) { 632 if (!first) {
507 if (!port) { 633 unregister_console(&sercons);
508 register_console(&sercons0); 634 register_console(&sercons0);
509 register_console(&sercons1); 635 register_console(&sercons1);
510 register_console(&sercons2); 636 register_console(&sercons2);
511 register_console(&sercons3); 637 register_console(&sercons3);
512 unregister_console(&sercons); 638 init_dummy_console();
513 }
514 return 0; 639 return 0;
515 } 640 }
516 first = 0;
517 if (port)
518 register_console(&sercons);
519 return 0;
520}
521 641
522int __init 642 first = 0;
523init_console(void) 643 register_console(&sercons);
524{ 644 start_port(port);
525 serial_driver = alloc_tty_driver(1); 645#ifdef CONFIG_ETRAX_KGDB
526 if (!serial_driver) 646 start_port(kgdb_port);
527 return -ENOMEM; 647#endif
528 return 0; 648 return 0;
529} 649}
530
531__initcall(init_etrax_debug); 650__initcall(init_etrax_debug);
diff --git a/arch/cris/arch-v10/kernel/dma.c b/arch/cris/arch-v10/kernel/dma.c
new file mode 100644
index 000000000000..e9a0311b141d
--- /dev/null
+++ b/arch/cris/arch-v10/kernel/dma.c
@@ -0,0 +1,287 @@
1/* Wrapper for DMA channel allocator that updates DMA client muxing.
2 * Copyright 2004, Axis Communications AB
3 * $Id: dma.c,v 1.1 2004/12/13 12:21:51 starvik Exp $
4 */
5
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/errno.h>
9
10#include <asm/dma.h>
11#include <asm/arch/svinto.h>
12
13/* Macro to access ETRAX 100 registers */
14#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
15 IO_STATE_(reg##_, field##_, _##val)
16
17
18static char used_dma_channels[MAX_DMA_CHANNELS];
19static const char * used_dma_channels_users[MAX_DMA_CHANNELS];
20
21int cris_request_dma(unsigned int dmanr, const char * device_id,
22 unsigned options, enum dma_owner owner)
23{
24 unsigned long flags;
25 unsigned long int gens;
26 int fail = -EINVAL;
27
28 if ((dmanr < 0) || (dmanr >= MAX_DMA_CHANNELS)) {
29 printk(KERN_CRIT "cris_request_dma: invalid DMA channel %u\n", dmanr);
30 return -EINVAL;
31 }
32
33 local_irq_save(flags);
34 if (used_dma_channels[dmanr]) {
35 local_irq_restore(flags);
36 if (options & DMA_VERBOSE_ON_ERROR) {
37 printk(KERN_CRIT "Failed to request DMA %i for %s, already allocated by %s\n", dmanr, device_id, used_dma_channels_users[dmanr]);
38 }
39 if (options & DMA_PANIC_ON_ERROR) {
40 panic("request_dma error!");
41 }
42 return -EBUSY;
43 }
44
45 gens = genconfig_shadow;
46
47 switch(owner)
48 {
49 case dma_eth:
50 if ((dmanr != NETWORK_TX_DMA_NBR) &&
51 (dmanr != NETWORK_RX_DMA_NBR)) {
52 printk(KERN_CRIT "Invalid DMA channel for eth\n");
53 goto bail;
54 }
55 break;
56 case dma_ser0:
57 if (dmanr == SER0_TX_DMA_NBR) {
58 SETS(gens, R_GEN_CONFIG, dma6, serial0);
59 } else if (dmanr == SER0_RX_DMA_NBR) {
60 SETS(gens, R_GEN_CONFIG, dma7, serial0);
61 } else {
62 printk(KERN_CRIT "Invalid DMA channel for ser0\n");
63 goto bail;
64 }
65 break;
66 case dma_ser1:
67 if (dmanr == SER1_TX_DMA_NBR) {
68 SETS(gens, R_GEN_CONFIG, dma8, serial1);
69 } else if (dmanr == SER1_RX_DMA_NBR) {
70 SETS(gens, R_GEN_CONFIG, dma9, serial1);
71 } else {
72 printk(KERN_CRIT "Invalid DMA channel for ser1\n");
73 goto bail;
74 }
75 break;
76 case dma_ser2:
77 if (dmanr == SER2_TX_DMA_NBR) {
78 SETS(gens, R_GEN_CONFIG, dma2, serial2);
79 } else if (dmanr == SER2_RX_DMA_NBR) {
80 SETS(gens, R_GEN_CONFIG, dma3, serial2);
81 } else {
82 printk(KERN_CRIT "Invalid DMA channel for ser2\n");
83 goto bail;
84 }
85 break;
86 case dma_ser3:
87 if (dmanr == SER3_TX_DMA_NBR) {
88 SETS(gens, R_GEN_CONFIG, dma4, serial3);
89 } else if (dmanr == SER3_RX_DMA_NBR) {
90 SETS(gens, R_GEN_CONFIG, dma5, serial3);
91 } else {
92 printk(KERN_CRIT "Invalid DMA channel for ser3\n");
93 goto bail;
94 }
95 break;
96 case dma_ata:
97 if (dmanr == ATA_TX_DMA_NBR) {
98 SETS(gens, R_GEN_CONFIG, dma2, ata);
99 } else if (dmanr == ATA_RX_DMA_NBR) {
100 SETS(gens, R_GEN_CONFIG, dma3, ata);
101 } else {
102 printk(KERN_CRIT "Invalid DMA channel for ata\n");
103 goto bail;
104 }
105 break;
106 case dma_ext0:
107 if (dmanr == EXTDMA0_TX_DMA_NBR) {
108 SETS(gens, R_GEN_CONFIG, dma4, extdma0);
109 } else if (dmanr == EXTDMA0_RX_DMA_NBR) {
110 SETS(gens, R_GEN_CONFIG, dma5, extdma0);
111 } else {
112 printk(KERN_CRIT "Invalid DMA channel for ext0\n");
113 goto bail;
114 }
115 break;
116 case dma_ext1:
117 if (dmanr == EXTDMA1_TX_DMA_NBR) {
118 SETS(gens, R_GEN_CONFIG, dma6, extdma1);
119 } else if (dmanr == EXTDMA1_RX_DMA_NBR) {
120 SETS(gens, R_GEN_CONFIG, dma7, extdma1);
121 } else {
122 printk(KERN_CRIT "Invalid DMA channel for ext1\n");
123 goto bail;
124 }
125 break;
126 case dma_int6:
127 if (dmanr == MEM2MEM_RX_DMA_NBR) {
128 SETS(gens, R_GEN_CONFIG, dma7, intdma6);
129 } else {
130 printk(KERN_CRIT "Invalid DMA channel for int6\n");
131 goto bail;
132 }
133 break;
134 case dma_int7:
135 if (dmanr == MEM2MEM_TX_DMA_NBR) {
136 SETS(gens, R_GEN_CONFIG, dma6, intdma7);
137 } else {
138 printk(KERN_CRIT "Invalid DMA channel for int7\n");
139 goto bail;
140 }
141 break;
142 case dma_usb:
143 if (dmanr == USB_TX_DMA_NBR) {
144 SETS(gens, R_GEN_CONFIG, dma8, usb);
145 } else if (dmanr == USB_RX_DMA_NBR) {
146 SETS(gens, R_GEN_CONFIG, dma9, usb);
147 } else {
148 printk(KERN_CRIT "Invalid DMA channel for usb\n");
149 goto bail;
150 }
151 break;
152 case dma_scsi0:
153 if (dmanr == SCSI0_TX_DMA_NBR) {
154 SETS(gens, R_GEN_CONFIG, dma2, scsi0);
155 } else if (dmanr == SCSI0_RX_DMA_NBR) {
156 SETS(gens, R_GEN_CONFIG, dma3, scsi0);
157 } else {
158 printk(KERN_CRIT "Invalid DMA channel for scsi0\n");
159 goto bail;
160 }
161 break;
162 case dma_scsi1:
163 if (dmanr == SCSI1_TX_DMA_NBR) {
164 SETS(gens, R_GEN_CONFIG, dma4, scsi1);
165 } else if (dmanr == SCSI1_RX_DMA_NBR) {
166 SETS(gens, R_GEN_CONFIG, dma5, scsi1);
167 } else {
168 printk(KERN_CRIT "Invalid DMA channel for scsi1\n");
169 goto bail;
170 }
171 break;
172 case dma_par0:
173 if (dmanr == PAR0_TX_DMA_NBR) {
174 SETS(gens, R_GEN_CONFIG, dma2, par0);
175 } else if (dmanr == PAR0_RX_DMA_NBR) {
176 SETS(gens, R_GEN_CONFIG, dma3, par0);
177 } else {
178 printk(KERN_CRIT "Invalid DMA channel for par0\n");
179 goto bail;
180 }
181 break;
182 case dma_par1:
183 if (dmanr == PAR1_TX_DMA_NBR) {
184 SETS(gens, R_GEN_CONFIG, dma4, par1);
185 } else if (dmanr == PAR1_RX_DMA_NBR) {
186 SETS(gens, R_GEN_CONFIG, dma5, par1);
187 } else {
188 printk(KERN_CRIT "Invalid DMA channel for par1\n");
189 goto bail;
190 }
191 break;
192 default:
193 printk(KERN_CRIT "Invalid DMA owner.\n");
194 goto bail;
195 }
196
197 used_dma_channels[dmanr] = 1;
198 used_dma_channels_users[dmanr] = device_id;
199
200 {
201 volatile int i;
202 genconfig_shadow = gens;
203 *R_GEN_CONFIG = genconfig_shadow;
204 /* Wait 12 cycles before doing any DMA command */
205 for(i = 6; i > 0; i--)
206 nop();
207 }
208 fail = 0;
209 bail:
210 local_irq_restore(flags);
211 return fail;
212}
213
214void cris_free_dma(unsigned int dmanr, const char * device_id)
215{
216 unsigned long flags;
217 if ((dmanr < 0) || (dmanr >= MAX_DMA_CHANNELS)) {
218 printk(KERN_CRIT "cris_free_dma: invalid DMA channel %u\n", dmanr);
219 return;
220 }
221
222 local_irq_save(flags);
223 if (!used_dma_channels[dmanr]) {
224 printk(KERN_CRIT "cris_free_dma: DMA channel %u not allocated\n", dmanr);
225 } else if (device_id != used_dma_channels_users[dmanr]) {
226 printk(KERN_CRIT "cris_free_dma: DMA channel %u not allocated by device\n", dmanr);
227 } else {
228 switch(dmanr)
229 {
230 case 0:
231 *R_DMA_CH0_CMD = IO_STATE(R_DMA_CH0_CMD, cmd, reset);
232 while (IO_EXTRACT(R_DMA_CH0_CMD, cmd, *R_DMA_CH0_CMD) ==
233 IO_STATE_VALUE(R_DMA_CH0_CMD, cmd, reset));
234 break;
235 case 1:
236 *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, reset);
237 while (IO_EXTRACT(R_DMA_CH1_CMD, cmd, *R_DMA_CH1_CMD) ==
238 IO_STATE_VALUE(R_DMA_CH1_CMD, cmd, reset));
239 break;
240 case 2:
241 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, reset);
242 while (IO_EXTRACT(R_DMA_CH2_CMD, cmd, *R_DMA_CH2_CMD) ==
243 IO_STATE_VALUE(R_DMA_CH2_CMD, cmd, reset));
244 break;
245 case 3:
246 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, reset);
247 while (IO_EXTRACT(R_DMA_CH3_CMD, cmd, *R_DMA_CH3_CMD) ==
248 IO_STATE_VALUE(R_DMA_CH3_CMD, cmd, reset));
249 break;
250 case 4:
251 *R_DMA_CH4_CMD = IO_STATE(R_DMA_CH4_CMD, cmd, reset);
252 while (IO_EXTRACT(R_DMA_CH4_CMD, cmd, *R_DMA_CH4_CMD) ==
253 IO_STATE_VALUE(R_DMA_CH4_CMD, cmd, reset));
254 break;
255 case 5:
256 *R_DMA_CH5_CMD = IO_STATE(R_DMA_CH5_CMD, cmd, reset);
257 while (IO_EXTRACT(R_DMA_CH5_CMD, cmd, *R_DMA_CH5_CMD) ==
258 IO_STATE_VALUE(R_DMA_CH5_CMD, cmd, reset));
259 break;
260 case 6:
261 *R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
262 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *R_DMA_CH6_CMD) ==
263 IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
264 break;
265 case 7:
266 *R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, reset);
267 while (IO_EXTRACT(R_DMA_CH7_CMD, cmd, *R_DMA_CH7_CMD) ==
268 IO_STATE_VALUE(R_DMA_CH7_CMD, cmd, reset));
269 break;
270 case 8:
271 *R_DMA_CH8_CMD = IO_STATE(R_DMA_CH8_CMD, cmd, reset);
272 while (IO_EXTRACT(R_DMA_CH8_CMD, cmd, *R_DMA_CH8_CMD) ==
273 IO_STATE_VALUE(R_DMA_CH8_CMD, cmd, reset));
274 break;
275 case 9:
276 *R_DMA_CH9_CMD = IO_STATE(R_DMA_CH9_CMD, cmd, reset);
277 while (IO_EXTRACT(R_DMA_CH9_CMD, cmd, *R_DMA_CH9_CMD) ==
278 IO_STATE_VALUE(R_DMA_CH9_CMD, cmd, reset));
279 break;
280 }
281 used_dma_channels[dmanr] = 0;
282 }
283 local_irq_restore(flags);
284}
285
286EXPORT_SYMBOL(cris_request_dma);
287EXPORT_SYMBOL(cris_free_dma);
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 1bc44f481c34..c0163bf94a50 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -1,4 +1,4 @@
1/* $Id: entry.S,v 1.23 2004/10/19 13:07:37 starvik Exp $ 1/* $Id: entry.S,v 1.28 2005/06/20 05:06:30 starvik Exp $
2 * 2 *
3 * linux/arch/cris/entry.S 3 * linux/arch/cris/entry.S
4 * 4 *
@@ -7,6 +7,22 @@
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
9 * $Log: entry.S,v $ 9 * $Log: entry.S,v $
10 * Revision 1.28 2005/06/20 05:06:30 starvik
11 * Remove unnecessary diff to kernel.org tree
12 *
13 * Revision 1.27 2005/03/04 08:16:16 starvik
14 * Merge of Linux 2.6.11.
15 *
16 * Revision 1.26 2005/01/11 13:49:47 starvik
17 * Added NMI handler.
18 *
19 * Revision 1.25 2004/12/27 11:18:32 starvik
20 * Merge of Linux 2.6.10 (not functional yet).
21 *
22 * Revision 1.24 2004/12/22 10:41:23 starvik
23 * Updates to make v10 compile with the latest SMP aware generic code (even
24 * though v10 will never have SMP).
25 *
10 * Revision 1.23 2004/10/19 13:07:37 starvik 26 * Revision 1.23 2004/10/19 13:07:37 starvik
11 * Merge of Linux 2.6.9 27 * Merge of Linux 2.6.9
12 * 28 *
@@ -279,6 +295,7 @@
279#ifdef CONFIG_PREEMPT 295#ifdef CONFIG_PREEMPT
280 ; Check if preemptive kernel scheduling should be done 296 ; Check if preemptive kernel scheduling should be done
281_resume_kernel: 297_resume_kernel:
298 di
282 ; Load current task struct 299 ; Load current task struct
283 movs.w -8192, $r0 ; THREAD_SIZE = 8192 300 movs.w -8192, $r0 ; THREAD_SIZE = 8192
284 and.d $sp, $r0 301 and.d $sp, $r0
@@ -291,12 +308,7 @@ _need_resched:
291 bpl _Rexit 308 bpl _Rexit
292 nop 309 nop
293 ; Ok, lets's do some preemptive kernel scheduling 310 ; Ok, lets's do some preemptive kernel scheduling
294 move.d PREEMPT_ACTIVE, $r10 311 jsr preempt_schedule_irq
295 move.d $r10, [$r0+TI_preempt_count] ; Mark as active
296 ei
297 jsr schedule
298 clear.d [$r0+TI_preempt_count] ; Mark as inactive
299 di
300 ; Load new task struct 312 ; Load new task struct
301 movs.w -8192, $r0 ; THREAD_SIZE = 8192 313 movs.w -8192, $r0 ; THREAD_SIZE = 8192
302 and.d $sp, $r0 314 and.d $sp, $r0
@@ -590,15 +602,15 @@ mmu_bus_fault:
590 move.d $r0, [$sp+16] 602 move.d $r0, [$sp+16]
5911: btstq 12, $r1 ; Refill? 6031: btstq 12, $r1 ; Refill?
592 bpl 2f 604 bpl 2f
593 lsrq PMD_SHIFT, $r1 ; Get PMD index into PGD (bit 24-31) 605 lsrq 24, $r1 ; Get PGD index (bit 24-31)
594 move.d [current_pgd], $r0 ; PGD for the current process 606 move.d [per_cpu__current_pgd], $r0 ; PGD for the current process
595 move.d [$r0+$r1.d], $r0 ; Get PMD 607 move.d [$r0+$r1.d], $r0 ; Get PMD
596 beq 2f 608 beq 2f
597 nop 609 nop
598 and.w PAGE_MASK, $r0 ; Remove PMD flags 610 and.w PAGE_MASK, $r0 ; Remove PMD flags
599 move.d [R_MMU_CAUSE], $r1 611 move.d [R_MMU_CAUSE], $r1
600 lsrq PAGE_SHIFT, $r1 612 lsrq PAGE_SHIFT, $r1
601 and.d 0x7ff, $r1 ; Get PTE index into PMD (bit 13-24) 613 and.d 0x7ff, $r1 ; Get PTE index into PGD (bit 13-23)
602 move.d [$r0+$r1.d], $r1 ; Get PTE 614 move.d [$r0+$r1.d], $r1 ; Get PTE
603 beq 2f 615 beq 2f
604 nop 616 nop
@@ -656,11 +668,6 @@ hwbreakpoint:
656 nop 668 nop
657 669
658IRQ1_interrupt: 670IRQ1_interrupt:
659
660#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
661;; If we receive a watchdog interrupt while it is not expected, then set
662;; up a canonical frame and dump register contents before dying.
663
664 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 671 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
665 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame 672 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
666 push $srp 673 push $srp
@@ -672,9 +679,16 @@ IRQ1_interrupt:
672 push $r10 ; push orig_r10 679 push $r10 ; push orig_r10
673 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 680 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
674 681
675;; We don't check that we actually were bit by the watchdog as opposed to 682 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
676;; an external NMI, since there is currently no handler for external NMI. 683 and.d 0x80000000, $r1
677 684 beq wdog
685 move.d $sp, $r10
686 jsr handle_nmi
687 setf m ; Enable NMI again
688 retb ; Return from NMI
689 nop
690wdog:
691#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
678;; Check if we're waiting for reset to happen, as signalled by 692;; Check if we're waiting for reset to happen, as signalled by
679;; hard_reset_now setting cause_of_death to a magic value. If so, just 693;; hard_reset_now setting cause_of_death to a magic value. If so, just
680;; get stuck until reset happens. 694;; get stuck until reset happens.
@@ -1118,6 +1132,10 @@ sys_call_table:
1118 .long sys_mq_getsetattr 1132 .long sys_mq_getsetattr
1119 .long sys_ni_syscall /* reserved for kexec */ 1133 .long sys_ni_syscall /* reserved for kexec */
1120 .long sys_waitid 1134 .long sys_waitid
1135 .long sys_ni_syscall /* 285 */ /* available */
1136 .long sys_add_key
1137 .long sys_request_key
1138 .long sys_keyctl
1121 1139
1122 /* 1140 /*
1123 * NOTE!! This doesn't have to be exact - we just have 1141 * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 4717f7ae8e51..094ff45ae85b 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -1,10 +1,20 @@
1/* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $ 1/* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $
2 * linux/arch/cris/kernel/fasttimer.c 2 * linux/arch/cris/kernel/fasttimer.c
3 * 3 *
4 * Fast timers for ETRAX100/ETRAX100LX 4 * Fast timers for ETRAX100/ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation... 5 * This may be useful in other OS than Linux so use 2 space indentation...
6 * 6 *
7 * $Log: fasttimer.c,v $ 7 * $Log: fasttimer.c,v $
8 * Revision 1.9 2005/03/04 08:16:16 starvik
9 * Merge of Linux 2.6.11.
10 *
11 * Revision 1.8 2005/01/05 06:09:29 starvik
12 * cli()/sti() will be obsolete in 2.6.11.
13 *
14 * Revision 1.7 2005/01/03 13:35:46 starvik
15 * Removed obsolete stuff.
16 * Mark fast timer IRQ as not shared.
17 *
8 * Revision 1.6 2004/05/14 10:18:39 starvik 18 * Revision 1.6 2004/05/14 10:18:39 starvik
9 * Export fast_timer_list 19 * Export fast_timer_list
10 * 20 *
@@ -148,8 +158,7 @@ static int debug_log_cnt_wrapped = 0;
148#define DEBUG_LOG(string, value) \ 158#define DEBUG_LOG(string, value) \
149{ \ 159{ \
150 unsigned long log_flags; \ 160 unsigned long log_flags; \
151 save_flags(log_flags); \ 161 local_irq_save(log_flags); \
152 cli(); \
153 debug_log_string[debug_log_cnt] = (string); \ 162 debug_log_string[debug_log_cnt] = (string); \
154 debug_log_value[debug_log_cnt] = (unsigned long)(value); \ 163 debug_log_value[debug_log_cnt] = (unsigned long)(value); \
155 if (++debug_log_cnt >= DEBUG_LOG_MAX) \ 164 if (++debug_log_cnt >= DEBUG_LOG_MAX) \
@@ -157,7 +166,7 @@ static int debug_log_cnt_wrapped = 0;
157 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \ 166 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \
158 debug_log_cnt_wrapped = 1; \ 167 debug_log_cnt_wrapped = 1; \
159 } \ 168 } \
160 restore_flags(log_flags); \ 169 local_irq_restore(log_flags); \
161} 170}
162#else 171#else
163#define DEBUG_LOG(string, value) 172#define DEBUG_LOG(string, value)
@@ -320,8 +329,7 @@ void start_one_shot_timer(struct fast_timer *t,
320 329
321 D1(printk("sft %s %d us\n", name, delay_us)); 330 D1(printk("sft %s %d us\n", name, delay_us));
322 331
323 save_flags(flags); 332 local_irq_save(flags);
324 cli();
325 333
326 do_gettimeofday_fast(&t->tv_set); 334 do_gettimeofday_fast(&t->tv_set);
327 tmp = fast_timer_list; 335 tmp = fast_timer_list;
@@ -395,7 +403,7 @@ void start_one_shot_timer(struct fast_timer *t,
395 403
396 D2(printk("start_one_shot_timer: %d us done\n", delay_us)); 404 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
397 405
398 restore_flags(flags); 406 local_irq_restore(flags);
399} /* start_one_shot_timer */ 407} /* start_one_shot_timer */
400 408
401static inline int fast_timer_pending (const struct fast_timer * t) 409static inline int fast_timer_pending (const struct fast_timer * t)
@@ -425,11 +433,10 @@ int del_fast_timer(struct fast_timer * t)
425 unsigned long flags; 433 unsigned long flags;
426 int ret; 434 int ret;
427 435
428 save_flags(flags); 436 local_irq_save(flags);
429 cli();
430 ret = detach_fast_timer(t); 437 ret = detach_fast_timer(t);
431 t->next = t->prev = NULL; 438 t->next = t->prev = NULL;
432 restore_flags(flags); 439 local_irq_restore(flags);
433 return ret; 440 return ret;
434} /* del_fast_timer */ 441} /* del_fast_timer */
435 442
@@ -444,8 +451,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
444 struct fast_timer *t; 451 struct fast_timer *t;
445 unsigned long flags; 452 unsigned long flags;
446 453
447 save_flags(flags); 454 local_irq_save(flags);
448 cli();
449 455
450 /* Clear timer1 irq */ 456 /* Clear timer1 irq */
451 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); 457 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -462,7 +468,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
462 fast_timer_running = 0; 468 fast_timer_running = 0;
463 fast_timer_ints++; 469 fast_timer_ints++;
464 470
465 restore_flags(flags); 471 local_irq_restore(flags);
466 472
467 t = fast_timer_list; 473 t = fast_timer_list;
468 while (t) 474 while (t)
@@ -482,8 +488,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
482 fast_timers_expired++; 488 fast_timers_expired++;
483 489
484 /* Remove this timer before call, since it may reuse the timer */ 490 /* Remove this timer before call, since it may reuse the timer */
485 save_flags(flags); 491 local_irq_save(flags);
486 cli();
487 if (t->prev) 492 if (t->prev)
488 { 493 {
489 t->prev->next = t->next; 494 t->prev->next = t->next;
@@ -498,7 +503,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
498 } 503 }
499 t->prev = NULL; 504 t->prev = NULL;
500 t->next = NULL; 505 t->next = NULL;
501 restore_flags(flags); 506 local_irq_restore(flags);
502 507
503 if (t->function != NULL) 508 if (t->function != NULL)
504 { 509 {
@@ -515,8 +520,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
515 D1(printk(".\n")); 520 D1(printk(".\n"));
516 } 521 }
517 522
518 save_flags(flags); 523 local_irq_save(flags);
519 cli();
520 if ((t = fast_timer_list) != NULL) 524 if ((t = fast_timer_list) != NULL)
521 { 525 {
522 /* Start next timer.. */ 526 /* Start next timer.. */
@@ -535,7 +539,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
535#endif 539#endif
536 start_timer1(us); 540 start_timer1(us);
537 } 541 }
538 restore_flags(flags); 542 local_irq_restore(flags);
539 break; 543 break;
540 } 544 }
541 else 545 else
@@ -546,7 +550,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
546 D1(printk("e! %d\n", us)); 550 D1(printk("e! %d\n", us));
547 } 551 }
548 } 552 }
549 restore_flags(flags); 553 local_irq_restore(flags);
550 } 554 }
551 555
552 if (!t) 556 if (!t)
@@ -748,13 +752,12 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
748#endif 752#endif
749 753
750 used += sprintf(bigbuf + used, "Active timers:\n"); 754 used += sprintf(bigbuf + used, "Active timers:\n");
751 save_flags(flags); 755 local_irq_save(flags);
752 cli();
753 t = fast_timer_list; 756 t = fast_timer_list;
754 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 757 while (t != NULL && (used+100 < BIG_BUF_SIZE))
755 { 758 {
756 nextt = t->next; 759 nextt = t->next;
757 restore_flags(flags); 760 local_irq_restore(flags);
758 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 761 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
759 "d: %6li us data: 0x%08lX" 762 "d: %6li us data: 0x%08lX"
760/* " func: 0x%08lX" */ 763/* " func: 0x%08lX" */
@@ -768,14 +771,14 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
768 t->data 771 t->data
769/* , t->function */ 772/* , t->function */
770 ); 773 );
771 cli(); 774 local_irq_disable();
772 if (t->next != nextt) 775 if (t->next != nextt)
773 { 776 {
774 printk(KERN_WARNING "timer removed!\n"); 777 printk(KERN_WARNING "timer removed!\n");
775 } 778 }
776 t = nextt; 779 t = nextt;
777 } 780 }
778 restore_flags(flags); 781 local_irq_restore(flags);
779 } 782 }
780 783
781 if (used - offset < len) 784 if (used - offset < len)
@@ -963,7 +966,7 @@ void fast_timer_init(void)
963 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) 966 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
964 fasttimer_proc_entry->read_proc = proc_fasttimer_read; 967 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
965#endif /* PROC_FS */ 968#endif /* PROC_FS */
966 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, SA_SHIRQ, 969 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
967 "fast timer int", NULL)) 970 "fast timer int", NULL))
968 { 971 {
969 printk("err: timer1 irq\n"); 972 printk("err: timer1 irq\n");
diff --git a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S
index 2c1dd1184a8f..f00c145b43f1 100644
--- a/arch/cris/arch-v10/kernel/head.S
+++ b/arch/cris/arch-v10/kernel/head.S
@@ -1,4 +1,4 @@
1/* $Id: head.S,v 1.7 2004/05/14 07:58:01 starvik Exp $ 1/* $Id: head.S,v 1.10 2005/06/20 05:12:54 starvik Exp $
2 * 2 *
3 * Head of the kernel - alter with care 3 * Head of the kernel - alter with care
4 * 4 *
@@ -7,6 +7,16 @@
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
9 * $Log: head.S,v $ 9 * $Log: head.S,v $
10 * Revision 1.10 2005/06/20 05:12:54 starvik
11 * Remove unnecessary diff to kernel.org tree
12 *
13 * Revision 1.9 2004/12/13 12:21:51 starvik
14 * Added I/O and DMA allocators from Linux 2.4
15 *
16 * Revision 1.8 2004/11/22 11:41:14 starvik
17 * Kernel command line may be supplied to kernel. Not used by Axis but may
18 * be used by customers.
19 *
10 * Revision 1.7 2004/05/14 07:58:01 starvik 20 * Revision 1.7 2004/05/14 07:58:01 starvik
11 * Merge of changes from 2.4 21 * Merge of changes from 2.4
12 * 22 *
@@ -181,6 +191,7 @@
181 191
182#define CRAMFS_MAGIC 0x28cd3d45 192#define CRAMFS_MAGIC 0x28cd3d45
183#define RAM_INIT_MAGIC 0x56902387 193#define RAM_INIT_MAGIC 0x56902387
194#define COMMAND_LINE_MAGIC 0x87109563
184 195
185#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\ 196#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\
186 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) 197 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk)
@@ -490,6 +501,23 @@ _no_romfs_in_flash:
490 501
491_start_it: 502_start_it:
492 503
504 ;; Check if kernel command line is supplied
505 cmp.d COMMAND_LINE_MAGIC, $r10
506 bne no_command_line
507 nop
508
509 move.d 256, $r13
510 move.d cris_command_line, $r10
511 or.d 0x80000000, $r11 ; Make it virtual
5121:
513 move.b [$r11+], $r12
514 move.b $r12, [$r10+]
515 subq 1, $r13
516 bne 1b
517 nop
518
519no_command_line:
520
493 ;; the kernel stack is overlayed with the task structure for each 521 ;; the kernel stack is overlayed with the task structure for each
494 ;; task. thus the initial kernel stack is in the same page as the 522 ;; task. thus the initial kernel stack is in the same page as the
495 ;; init_task (but starts in the top of the page, size 8192) 523 ;; init_task (but starts in the top of the page, size 8192)
@@ -567,76 +595,32 @@ _start_it:
567 ;; Etrax product HW genconfig setup 595 ;; Etrax product HW genconfig setup
568 596
569 moveq 0,$r0 597 moveq 0,$r0
570#if (!defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT0)) \ 598
571 && !defined(CONFIG_DMA_MEMCPY) 599 ;; Init interfaces (disable them).
572 ; DMA channels 6 and 7 to ser0, kgdb doesnt want DMA 600 or.d IO_STATE (R_GEN_CONFIG, scsi0, disable) \
573 or.d IO_STATE (R_GEN_CONFIG, dma7, serial0) \ 601 | IO_STATE (R_GEN_CONFIG, ata, disable) \
574 | IO_STATE (R_GEN_CONFIG, dma6, serial0),$r0 602 | IO_STATE (R_GEN_CONFIG, par0, disable) \
575#endif 603 | IO_STATE (R_GEN_CONFIG, ser2, disable) \
576#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT1) 604 | IO_STATE (R_GEN_CONFIG, mio, disable) \
577 ; DMA channels 8 and 9 to ser1, kgdb doesnt want DMA 605 | IO_STATE (R_GEN_CONFIG, scsi1, disable) \
578 or.d IO_STATE (R_GEN_CONFIG, dma9, serial1) \ 606 | IO_STATE (R_GEN_CONFIG, scsi0w, disable) \
579 | IO_STATE (R_GEN_CONFIG, dma8, serial1),$r0 607 | IO_STATE (R_GEN_CONFIG, par1, disable) \
580#endif 608 | IO_STATE (R_GEN_CONFIG, ser3, disable) \
581#ifdef CONFIG_DMA_MEMCPY 609 | IO_STATE (R_GEN_CONFIG, mio_w, disable) \
582 ; 6/7 memory-memory DMA 610 | IO_STATE (R_GEN_CONFIG, usb1, disable) \
583 or.d IO_STATE (R_GEN_CONFIG, dma7, intdma6) \ 611 | IO_STATE (R_GEN_CONFIG, usb2, disable) \
584 | IO_STATE (R_GEN_CONFIG, dma6, intdma7),$r0 612 | IO_STATE (R_GEN_CONFIG, par_w, disable),$r0
585#endif 613
586#ifdef CONFIG_ETRAX_SERIAL_PORT2 614 ;; Init DMA channel muxing (set to unused clients).
587 ; Enable serial port 2 615 or.d IO_STATE (R_GEN_CONFIG, dma2, ata) \
588 or.w IO_STATE (R_GEN_CONFIG, ser2, select),$r0 616 | IO_STATE (R_GEN_CONFIG, dma3, ata) \
589#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT2) 617 | IO_STATE (R_GEN_CONFIG, dma4, scsi1) \
590 ; DMA channels 2 and 3 to ser2, kgdb doesnt want DMA 618 | IO_STATE (R_GEN_CONFIG, dma5, scsi1) \
591 or.d IO_STATE (R_GEN_CONFIG, dma3, serial2) \ 619 | IO_STATE (R_GEN_CONFIG, dma6, unused) \
592 | IO_STATE (R_GEN_CONFIG, dma2, serial2),$r0 620 | IO_STATE (R_GEN_CONFIG, dma7, unused) \
593#endif 621 | IO_STATE (R_GEN_CONFIG, dma8, usb) \
594#endif 622 | IO_STATE (R_GEN_CONFIG, dma9, usb),$r0
595#if defined(CONFIG_ETRAX_SERIAL_PORT3) || defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) 623
596 ; Enable serial port 3
597 or.w IO_STATE (R_GEN_CONFIG, ser3, select),$r0
598#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT3)
599 ; DMA channels 4 and 5 to ser3, kgdb doesnt want DMA
600 or.d IO_STATE (R_GEN_CONFIG, dma5, serial3) \
601 | IO_STATE (R_GEN_CONFIG, dma4, serial3),$r0
602#endif
603#endif
604#if defined(CONFIG_ETRAX_PARALLEL_PORT0) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
605 ; parport 0 enabled using DMA 2/3
606 or.w IO_STATE (R_GEN_CONFIG, par0, select),$r0
607#endif
608#if defined(CONFIG_ETRAX_PARALLEL_PORT1) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
609 ; parport 1 enabled using DMA 4/5
610 or.w IO_STATE (R_GEN_CONFIG, par1, select),$r0
611#endif
612#ifdef CONFIG_ETRAX_IDE
613 ; DMA channels 2 and 3 to ATA, ATA enabled
614 or.d IO_STATE (R_GEN_CONFIG, dma3, ata) \
615 | IO_STATE (R_GEN_CONFIG, dma2, ata) \
616 | IO_STATE (R_GEN_CONFIG, ata, select),$r0
617#endif
618
619#ifdef CONFIG_ETRAX_USB_HOST_PORT1
620 ; Set the USB port 1 enable bit
621 or.d IO_STATE (R_GEN_CONFIG, usb1, select),$r0
622#endif
623#ifdef CONFIG_ETRAX_USB_HOST_PORT2
624 ; Set the USB port 2 enable bit
625 or.d IO_STATE (R_GEN_CONFIG, usb2, select),$r0
626#endif
627#ifdef CONFIG_ETRAX_USB_HOST
628 ; Connect DMA channels 8 and 9 to USB
629 and.d (~(IO_MASK (R_GEN_CONFIG, dma9) \
630 | IO_MASK (R_GEN_CONFIG, dma8))) \
631 | IO_STATE (R_GEN_CONFIG, dma9, usb) \
632 | IO_STATE (R_GEN_CONFIG, dma8, usb),$r0
633#endif
634
635#ifdef CONFIG_JULIETTE
636 ; DMA channels 4 and 5 to EXTDMA0, for Juliette
637 or.d IO_STATE (R_GEN_CONFIG, dma5, extdma0) \
638 | IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0
639#endif
640 624
641#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT) 625#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT)
642 or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0 626 or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
new file mode 100644
index 000000000000..29d48ad00df9
--- /dev/null
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -0,0 +1,879 @@
1/* IO interface mux allocator for ETRAX100LX.
2 * Copyright 2004, Axis Communications AB
3 * $Id: io_interface_mux.c,v 1.2 2004/12/21 12:08:38 starvik Exp $
4 */
5
6
7/* C.f. ETRAX100LX Designer's Reference 20.9 */
8
9#include <linux/kernel.h>
10#include <linux/slab.h>
11#include <linux/errno.h>
12#include <linux/module.h>
13#include <linux/init.h>
14
15#include <asm/arch/svinto.h>
16#include <asm/io.h>
17#include <asm/arch/io_interface_mux.h>
18
19
20#define DBG(s)
21
22/* Macro to access ETRAX 100 registers */
23#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
24 IO_STATE_(reg##_, field##_, _##val)
25
26enum io_if_group {
27 group_a = (1<<0),
28 group_b = (1<<1),
29 group_c = (1<<2),
30 group_d = (1<<3),
31 group_e = (1<<4),
32 group_f = (1<<5)
33};
34
35struct watcher
36{
37 void (*notify)(const unsigned int gpio_in_available,
38 const unsigned int gpio_out_available,
39 const unsigned char pa_available,
40 const unsigned char pb_available);
41 struct watcher *next;
42};
43
44
45struct if_group
46{
47 enum io_if_group group;
48 unsigned char used;
49 enum cris_io_interface owner;
50};
51
52
53struct interface
54{
55 enum cris_io_interface ioif;
56 unsigned char groups;
57 unsigned char used;
58 char *owner;
59 unsigned int gpio_g_in;
60 unsigned int gpio_g_out;
61 unsigned char gpio_b;
62};
63
64static struct if_group if_groups[6] = {
65 {
66 .group = group_a,
67 .used = 0,
68 },
69 {
70 .group = group_b,
71 .used = 0,
72 },
73 {
74 .group = group_c,
75 .used = 0,
76 },
77 {
78 .group = group_d,
79 .used = 0,
80 },
81 {
82 .group = group_e,
83 .used = 0,
84 },
85 {
86 .group = group_f,
87 .used = 0,
88 }
89};
90
91/* The order in the array must match the order of enum
92 * cris_io_interface in io_interface_mux.h */
93static struct interface interfaces[] = {
94 /* Begin Non-multiplexed interfaces */
95 {
96 .ioif = if_eth,
97 .groups = 0,
98 .gpio_g_in = 0,
99 .gpio_g_out = 0,
100 .gpio_b = 0
101 },
102 {
103 .ioif = if_serial_0,
104 .groups = 0,
105 .gpio_g_in = 0,
106 .gpio_g_out = 0,
107 .gpio_b = 0
108 },
109 /* End Non-multiplexed interfaces */
110 {
111 .ioif = if_serial_1,
112 .groups = group_e,
113 .gpio_g_in = 0x00000000,
114 .gpio_g_out = 0x00000000,
115 .gpio_b = 0x00
116 },
117 {
118 .ioif = if_serial_2,
119 .groups = group_b,
120 .gpio_g_in = 0x000000c0,
121 .gpio_g_out = 0x000000c0,
122 .gpio_b = 0x00
123 },
124 {
125 .ioif = if_serial_3,
126 .groups = group_c,
127 .gpio_g_in = 0xc0000000,
128 .gpio_g_out = 0xc0000000,
129 .gpio_b = 0x00
130 },
131 {
132 .ioif = if_sync_serial_1,
133 .groups = group_e | group_f, /* if_sync_serial_1 and if_sync_serial_3
134 can be used simultaneously */
135 .gpio_g_in = 0x00000000,
136 .gpio_g_out = 0x00000000,
137 .gpio_b = 0x10
138 },
139 {
140 .ioif = if_sync_serial_3,
141 .groups = group_c | group_f,
142 .gpio_g_in = 0xc0000000,
143 .gpio_g_out = 0xc0000000,
144 .gpio_b = 0x80
145 },
146 {
147 .ioif = if_shared_ram,
148 .groups = group_a,
149 .gpio_g_in = 0x0000ff3e,
150 .gpio_g_out = 0x0000ff38,
151 .gpio_b = 0x00
152 },
153 {
154 .ioif = if_shared_ram_w,
155 .groups = group_a | group_d,
156 .gpio_g_in = 0x00ffff3e,
157 .gpio_g_out = 0x00ffff38,
158 .gpio_b = 0x00
159 },
160 {
161 .ioif = if_par_0,
162 .groups = group_a,
163 .gpio_g_in = 0x0000ff3e,
164 .gpio_g_out = 0x0000ff3e,
165 .gpio_b = 0x00
166 },
167 {
168 .ioif = if_par_1,
169 .groups = group_d,
170 .gpio_g_in = 0x3eff0000,
171 .gpio_g_out = 0x3eff0000,
172 .gpio_b = 0x00
173 },
174 {
175 .ioif = if_par_w,
176 .groups = group_a | group_d,
177 .gpio_g_in = 0x00ffff3e,
178 .gpio_g_out = 0x00ffff3e,
179 .gpio_b = 0x00
180 },
181 {
182 .ioif = if_scsi8_0,
183 .groups = group_a | group_b | group_f, /* if_scsi8_0 and if_scsi8_1
184 can be used simultaneously */
185 .gpio_g_in = 0x0000ffff,
186 .gpio_g_out = 0x0000ffff,
187 .gpio_b = 0x10
188 },
189 {
190 .ioif = if_scsi8_1,
191 .groups = group_c | group_d | group_f, /* if_scsi8_0 and if_scsi8_1
192 can be used simultaneously */
193 .gpio_g_in = 0xffff0000,
194 .gpio_g_out = 0xffff0000,
195 .gpio_b = 0x80
196 },
197 {
198 .ioif = if_scsi_w,
199 .groups = group_a | group_b | group_d | group_f,
200 .gpio_g_in = 0x01ffffff,
201 .gpio_g_out = 0x07ffffff,
202 .gpio_b = 0x80
203 },
204 {
205 .ioif = if_ata,
206 .groups = group_a | group_b | group_c | group_d,
207 .gpio_g_in = 0xf9ffffff,
208 .gpio_g_out = 0xffffffff,
209 .gpio_b = 0x80
210 },
211 {
212 .ioif = if_csp,
213 .groups = group_f, /* if_csp and if_i2c can be used simultaneously */
214 .gpio_g_in = 0x00000000,
215 .gpio_g_out = 0x00000000,
216 .gpio_b = 0xfc
217 },
218 {
219 .ioif = if_i2c,
220 .groups = group_f, /* if_csp and if_i2c can be used simultaneously */
221 .gpio_g_in = 0x00000000,
222 .gpio_g_out = 0x00000000,
223 .gpio_b = 0x03
224 },
225 {
226 .ioif = if_usb_1,
227 .groups = group_e | group_f,
228 .gpio_g_in = 0x00000000,
229 .gpio_g_out = 0x00000000,
230 .gpio_b = 0x2c
231 },
232 {
233 .ioif = if_usb_2,
234 .groups = group_d,
235 .gpio_g_in = 0x0e000000,
236 .gpio_g_out = 0x3c000000,
237 .gpio_b = 0x00
238 },
239 /* GPIO pins */
240 {
241 .ioif = if_gpio_grp_a,
242 .groups = group_a,
243 .gpio_g_in = 0x0000ff3f,
244 .gpio_g_out = 0x0000ff3f,
245 .gpio_b = 0x00
246 },
247 {
248 .ioif = if_gpio_grp_b,
249 .groups = group_b,
250 .gpio_g_in = 0x000000c0,
251 .gpio_g_out = 0x000000c0,
252 .gpio_b = 0x00
253 },
254 {
255 .ioif = if_gpio_grp_c,
256 .groups = group_c,
257 .gpio_g_in = 0xc0000000,
258 .gpio_g_out = 0xc0000000,
259 .gpio_b = 0x00
260 },
261 {
262 .ioif = if_gpio_grp_d,
263 .groups = group_d,
264 .gpio_g_in = 0x3fff0000,
265 .gpio_g_out = 0x3fff0000,
266 .gpio_b = 0x00
267 },
268 {
269 .ioif = if_gpio_grp_e,
270 .groups = group_e,
271 .gpio_g_in = 0x00000000,
272 .gpio_g_out = 0x00000000,
273 .gpio_b = 0x00
274 },
275 {
276 .ioif = if_gpio_grp_f,
277 .groups = group_f,
278 .gpio_g_in = 0x00000000,
279 .gpio_g_out = 0x00000000,
280 .gpio_b = 0xff
281 }
282 /* Array end */
283};
284
285static struct watcher *watchers = NULL;
286
287static unsigned int gpio_in_pins = 0xffffffff;
288static unsigned int gpio_out_pins = 0xffffffff;
289static unsigned char gpio_pb_pins = 0xff;
290static unsigned char gpio_pa_pins = 0xff;
291
292static enum cris_io_interface gpio_pa_owners[8];
293static enum cris_io_interface gpio_pb_owners[8];
294static enum cris_io_interface gpio_pg_owners[32];
295
296static int cris_io_interface_init(void);
297
298static unsigned char clear_group_from_set(const unsigned char groups, struct if_group *group)
299{
300 return (groups & ~group->group);
301}
302
303
304static struct if_group *get_group(const unsigned char groups)
305{
306 int i;
307 for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) {
308 if (groups & if_groups[i].group) {
309 return &if_groups[i];
310 }
311 }
312 return NULL;
313}
314
315
316static void notify_watchers(void)
317{
318 struct watcher *w = watchers;
319
320 DBG(printk("io_interface_mux: notifying watchers\n"));
321
322 while (NULL != w) {
323 w->notify((const unsigned int)gpio_in_pins,
324 (const unsigned int)gpio_out_pins,
325 (const unsigned char)gpio_pa_pins,
326 (const unsigned char)gpio_pb_pins);
327 w = w->next;
328 }
329}
330
331
332int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id)
333{
334 int set_gen_config = 0;
335 int set_gen_config_ii = 0;
336 unsigned long int gens;
337 unsigned long int gens_ii;
338 struct if_group *grp;
339 unsigned char group_set;
340 unsigned long flags;
341
342 (void)cris_io_interface_init();
343
344 DBG(printk("cris_request_io_interface(%d, \"%s\")\n", ioif, device_id));
345
346 if ((ioif >= if_max_interfaces) || (ioif < 0)) {
347 printk(KERN_CRIT "cris_request_io_interface: Bad interface %u submitted for %s\n",
348 ioif,
349 device_id);
350 return -EINVAL;
351 }
352
353 local_irq_save(flags);
354
355 if (interfaces[ioif].used) {
356 local_irq_restore(flags);
357 printk(KERN_CRIT "cris_io_interface: Cannot allocate interface for %s, in use by %s\n",
358 device_id,
359 interfaces[ioif].owner);
360 return -EBUSY;
361 }
362
363 /* Check that all required groups are free before allocating, */
364 group_set = interfaces[ioif].groups;
365 while (NULL != (grp = get_group(group_set))) {
366 if (grp->used) {
367 if (grp->group == group_f) {
368 if ((if_sync_serial_1 == ioif) ||
369 (if_sync_serial_3 == ioif)) {
370 if ((grp->owner != if_sync_serial_1) &&
371 (grp->owner != if_sync_serial_3)) {
372 local_irq_restore(flags);
373 return -EBUSY;
374 }
375 } else if ((if_scsi8_0 == ioif) ||
376 (if_scsi8_1 == ioif)) {
377 if ((grp->owner != if_scsi8_0) &&
378 (grp->owner != if_scsi8_1)) {
379 local_irq_restore(flags);
380 return -EBUSY;
381 }
382 }
383 } else {
384 local_irq_restore(flags);
385 return -EBUSY;
386 }
387 }
388 group_set = clear_group_from_set(group_set, grp);
389 }
390
391 /* Are the required GPIO pins available too? */
392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) ||
393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) ||
394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) {
395 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n",
396 ioif);
397 return -EBUSY;
398 }
399
400 /* All needed I/O pins and pin groups are free, allocate. */
401 group_set = interfaces[ioif].groups;
402 while (NULL != (grp = get_group(group_set))) {
403 grp->used = 1;
404 grp->owner = ioif;
405 group_set = clear_group_from_set(group_set, grp);
406 }
407
408 gens = genconfig_shadow;
409 gens_ii = gen_config_ii_shadow;
410
411 set_gen_config = 1;
412 switch (ioif)
413 {
414 /* Begin Non-multiplexed interfaces */
415 case if_eth:
416 /* fall through */
417 case if_serial_0:
418 set_gen_config = 0;
419 break;
420 /* End Non-multiplexed interfaces */
421 case if_serial_1:
422 set_gen_config_ii = 1;
423 SETS(gens_ii, R_GEN_CONFIG_II, sermode1, async);
424 break;
425 case if_serial_2:
426 SETS(gens, R_GEN_CONFIG, ser2, select);
427 break;
428 case if_serial_3:
429 SETS(gens, R_GEN_CONFIG, ser3, select);
430 set_gen_config_ii = 1;
431 SETS(gens_ii, R_GEN_CONFIG_II, sermode3, async);
432 break;
433 case if_sync_serial_1:
434 set_gen_config_ii = 1;
435 SETS(gens_ii, R_GEN_CONFIG_II, sermode1, sync);
436 break;
437 case if_sync_serial_3:
438 SETS(gens, R_GEN_CONFIG, ser3, select);
439 set_gen_config_ii = 1;
440 SETS(gens_ii, R_GEN_CONFIG_II, sermode3, sync);
441 break;
442 case if_shared_ram:
443 SETS(gens, R_GEN_CONFIG, mio, select);
444 break;
445 case if_shared_ram_w:
446 SETS(gens, R_GEN_CONFIG, mio_w, select);
447 break;
448 case if_par_0:
449 SETS(gens, R_GEN_CONFIG, par0, select);
450 break;
451 case if_par_1:
452 SETS(gens, R_GEN_CONFIG, par1, select);
453 break;
454 case if_par_w:
455 SETS(gens, R_GEN_CONFIG, par0, select);
456 SETS(gens, R_GEN_CONFIG, par_w, select);
457 break;
458 case if_scsi8_0:
459 SETS(gens, R_GEN_CONFIG, scsi0, select);
460 break;
461 case if_scsi8_1:
462 SETS(gens, R_GEN_CONFIG, scsi1, select);
463 break;
464 case if_scsi_w:
465 SETS(gens, R_GEN_CONFIG, scsi0, select);
466 SETS(gens, R_GEN_CONFIG, scsi0w, select);
467 break;
468 case if_ata:
469 SETS(gens, R_GEN_CONFIG, ata, select);
470 break;
471 case if_csp:
472 /* fall through */
473 case if_i2c:
474 set_gen_config = 0;
475 break;
476 case if_usb_1:
477 SETS(gens, R_GEN_CONFIG, usb1, select);
478 break;
479 case if_usb_2:
480 SETS(gens, R_GEN_CONFIG, usb2, select);
481 break;
482 case if_gpio_grp_a:
483 /* GPIO groups are only accounted, don't do configuration changes. */
484 /* fall through */
485 case if_gpio_grp_b:
486 /* fall through */
487 case if_gpio_grp_c:
488 /* fall through */
489 case if_gpio_grp_d:
490 /* fall through */
491 case if_gpio_grp_e:
492 /* fall through */
493 case if_gpio_grp_f:
494 set_gen_config = 0;
495 break;
496 default:
497 panic("cris_request_io_interface: Bad interface %u submitted for %s\n",
498 ioif,
499 device_id);
500 }
501
502 interfaces[ioif].used = 1;
503 interfaces[ioif].owner = (char*)device_id;
504
505 if (set_gen_config) {
506 volatile int i;
507 genconfig_shadow = gens;
508 *R_GEN_CONFIG = genconfig_shadow;
509 /* Wait 12 cycles before doing any DMA command */
510 for(i = 6; i > 0; i--)
511 nop();
512 }
513 if (set_gen_config_ii) {
514 gen_config_ii_shadow = gens_ii;
515 *R_GEN_CONFIG_II = gen_config_ii_shadow;
516 }
517
518 DBG(printk("GPIO pins: available before: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
519 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
520 DBG(printk("grabbing pins: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
521 interfaces[ioif].gpio_g_in,
522 interfaces[ioif].gpio_g_out,
523 interfaces[ioif].gpio_b));
524
525 gpio_in_pins &= ~interfaces[ioif].gpio_g_in;
526 gpio_out_pins &= ~interfaces[ioif].gpio_g_out;
527 gpio_pb_pins &= ~interfaces[ioif].gpio_b;
528
529 DBG(printk("GPIO pins: available after: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
530 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
531
532 local_irq_restore(flags);
533
534 notify_watchers();
535
536 return 0;
537}
538
539
540void cris_free_io_interface(enum cris_io_interface ioif)
541{
542 struct if_group *grp;
543 unsigned char group_set;
544 unsigned long flags;
545
546 (void)cris_io_interface_init();
547
548 if ((ioif >= if_max_interfaces) || (ioif < 0)) {
549 printk(KERN_CRIT "cris_free_io_interface: Bad interface %u\n",
550 ioif);
551 return;
552 }
553 local_irq_save(flags);
554 if (!interfaces[ioif].used) {
555 printk(KERN_CRIT "cris_free_io_interface: Freeing free interface %u\n",
556 ioif);
557 local_irq_restore(flags);
558 return;
559 }
560 group_set = interfaces[ioif].groups;
561 while (NULL != (grp = get_group(group_set))) {
562 if (grp->group == group_f) {
563 switch (ioif)
564 {
565 case if_sync_serial_1:
566 if ((grp->owner == if_sync_serial_1) &&
567 interfaces[if_sync_serial_3].used) {
568 grp->owner = if_sync_serial_3;
569 } else
570 grp->used = 0;
571 break;
572 case if_sync_serial_3:
573 if ((grp->owner == if_sync_serial_3) &&
574 interfaces[if_sync_serial_1].used) {
575 grp->owner = if_sync_serial_1;
576 } else
577 grp->used = 0;
578 break;
579 case if_scsi8_0:
580 if ((grp->owner == if_scsi8_0) &&
581 interfaces[if_scsi8_1].used) {
582 grp->owner = if_scsi8_1;
583 } else
584 grp->used = 0;
585 break;
586 case if_scsi8_1:
587 if ((grp->owner == if_scsi8_1) &&
588 interfaces[if_scsi8_0].used) {
589 grp->owner = if_scsi8_0;
590 } else
591 grp->used = 0;
592 break;
593 default:
594 grp->used = 0;
595 }
596 } else {
597 grp->used = 0;
598 }
599 group_set = clear_group_from_set(group_set, grp);
600 }
601 interfaces[ioif].used = 0;
602 interfaces[ioif].owner = NULL;
603
604 DBG(printk("GPIO pins: available before: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
605 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
606 DBG(printk("freeing pins: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
607 interfaces[ioif].gpio_g_in,
608 interfaces[ioif].gpio_g_out,
609 interfaces[ioif].gpio_b));
610
611 gpio_in_pins |= interfaces[ioif].gpio_g_in;
612 gpio_out_pins |= interfaces[ioif].gpio_g_out;
613 gpio_pb_pins |= interfaces[ioif].gpio_b;
614
615 DBG(printk("GPIO pins: available after: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
616 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
617
618 local_irq_restore(flags);
619
620 notify_watchers();
621}
622
623/* Create a bitmask from bit 0 (inclusive) to bit stop_bit
624 (non-inclusive). stop_bit == 0 returns 0x0 */
625static inline unsigned int create_mask(const unsigned stop_bit)
626{
627 /* Avoid overflow */
628 if (stop_bit >= 32) {
629 return 0xffffffff;
630 }
631 return (1<<stop_bit)-1;
632}
633
634
635/* port can be 'a', 'b' or 'g' */
636int cris_io_interface_allocate_pins(const enum cris_io_interface ioif,
637 const char port,
638 const unsigned start_bit,
639 const unsigned stop_bit)
640{
641 unsigned int i;
642 unsigned int mask = 0;
643 unsigned int tmp_mask;
644 unsigned long int flags;
645 enum cris_io_interface *owners;
646
647 (void)cris_io_interface_init();
648
649 DBG(printk("cris_io_interface_allocate_pins: if=%d port=%c start=%u stop=%u\n",
650 ioif, port, start_bit, stop_bit));
651
652 if (!((start_bit <= stop_bit) &&
653 ((((port == 'a') || (port == 'b')) && (stop_bit < 8)) ||
654 ((port == 'g') && (stop_bit < 32))))) {
655 return -EINVAL;
656 }
657
658 mask = create_mask(stop_bit + 1);
659 tmp_mask = create_mask(start_bit);
660 mask &= ~tmp_mask;
661
662 DBG(printk("cris_io_interface_allocate_pins: port=%c start=%u stop=%u mask=0x%08x\n",
663 port, start_bit, stop_bit, mask));
664
665 local_irq_save(flags);
666
667 switch (port) {
668 case 'a':
669 if ((gpio_pa_pins & mask) != mask) {
670 local_irq_restore(flags);
671 return -EBUSY;
672 }
673 owners = gpio_pa_owners;
674 gpio_pa_pins &= ~mask;
675 break;
676 case 'b':
677 if ((gpio_pb_pins & mask) != mask) {
678 local_irq_restore(flags);
679 return -EBUSY;
680 }
681 owners = gpio_pb_owners;
682 gpio_pb_pins &= ~mask;
683 break;
684 case 'g':
685 if (((gpio_in_pins & mask) != mask) ||
686 ((gpio_out_pins & mask) != mask)) {
687 local_irq_restore(flags);
688 return -EBUSY;
689 }
690 owners = gpio_pg_owners;
691 gpio_in_pins &= ~mask;
692 gpio_out_pins &= ~mask;
693 break;
694 default:
695 local_irq_restore(flags);
696 return -EINVAL;
697 }
698
699 for (i = start_bit; i <= stop_bit; i++) {
700 owners[i] = ioif;
701 }
702 local_irq_restore(flags);
703
704 notify_watchers();
705 return 0;
706}
707
708
709/* port can be 'a', 'b' or 'g' */
710int cris_io_interface_free_pins(const enum cris_io_interface ioif,
711 const char port,
712 const unsigned start_bit,
713 const unsigned stop_bit)
714{
715 unsigned int i;
716 unsigned int mask = 0;
717 unsigned int tmp_mask;
718 unsigned long int flags;
719 enum cris_io_interface *owners;
720
721 (void)cris_io_interface_init();
722
723 if (!((start_bit <= stop_bit) &&
724 ((((port == 'a') || (port == 'b')) && (stop_bit < 8)) ||
725 ((port == 'g') && (stop_bit < 32))))) {
726 return -EINVAL;
727 }
728
729 mask = create_mask(stop_bit + 1);
730 tmp_mask = create_mask(start_bit);
731 mask &= ~tmp_mask;
732
733 DBG(printk("cris_io_interface_free_pins: port=%c start=%u stop=%u mask=0x%08x\n",
734 port, start_bit, stop_bit, mask));
735
736 local_irq_save(flags);
737
738 switch (port) {
739 case 'a':
740 if ((~gpio_pa_pins & mask) != mask) {
741 local_irq_restore(flags);
742 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
743 }
744 owners = gpio_pa_owners;
745 break;
746 case 'b':
747 if ((~gpio_pb_pins & mask) != mask) {
748 local_irq_restore(flags);
749 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
750 }
751 owners = gpio_pb_owners;
752 break;
753 case 'g':
754 if (((~gpio_in_pins & mask) != mask) ||
755 ((~gpio_out_pins & mask) != mask)) {
756 local_irq_restore(flags);
757 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
758 }
759 owners = gpio_pg_owners;
760 break;
761 default:
762 owners = NULL; /* Cannot happen. Shut up, gcc! */
763 }
764
765 for (i = start_bit; i <= stop_bit; i++) {
766 if (owners[i] != ioif) {
767 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing unowned pins");
768 }
769 }
770
771 /* All was ok, change data. */
772 switch (port) {
773 case 'a':
774 gpio_pa_pins |= mask;
775 break;
776 case 'b':
777 gpio_pb_pins |= mask;
778 break;
779 case 'g':
780 gpio_in_pins |= mask;
781 gpio_out_pins |= mask;
782 break;
783 }
784
785 for (i = start_bit; i <= stop_bit; i++) {
786 owners[i] = if_unclaimed;
787 }
788 local_irq_restore(flags);
789 notify_watchers();
790
791 return 0;
792}
793
794
795int cris_io_interface_register_watcher(void (*notify)(const unsigned int gpio_in_available,
796 const unsigned int gpio_out_available,
797 const unsigned char pa_available,
798 const unsigned char pb_available))
799{
800 struct watcher *w;
801
802 (void)cris_io_interface_init();
803
804 if (NULL == notify) {
805 return -EINVAL;
806 }
807 w = kmalloc(sizeof(*w), GFP_KERNEL);
808 if (!w) {
809 return -ENOMEM;
810 }
811 w->notify = notify;
812 w->next = watchers;
813 watchers = w;
814
815 w->notify((const unsigned int)gpio_in_pins,
816 (const unsigned int)gpio_out_pins,
817 (const unsigned char)gpio_pa_pins,
818 (const unsigned char)gpio_pb_pins);
819
820 return 0;
821}
822
823void cris_io_interface_delete_watcher(void (*notify)(const unsigned int gpio_in_available,
824 const unsigned int gpio_out_available,
825 const unsigned char pa_available,
826 const unsigned char pb_available))
827{
828 struct watcher *w = watchers, *prev = NULL;
829
830 (void)cris_io_interface_init();
831
832 while ((NULL != w) && (w->notify != notify)){
833 prev = w;
834 w = w->next;
835 }
836 if (NULL != w) {
837 if (NULL != prev) {
838 prev->next = w->next;
839 } else {
840 watchers = w->next;
841 }
842 kfree(w);
843 return;
844 }
845 printk(KERN_WARNING "cris_io_interface_delete_watcher: Deleting unknown watcher 0x%p\n", notify);
846}
847
848
849static int cris_io_interface_init(void)
850{
851 static int first = 1;
852 int i;
853
854 if (!first) {
855 return 0;
856 }
857 first = 0;
858
859 for (i = 0; i<8; i++) {
860 gpio_pa_owners[i] = if_unclaimed;
861 gpio_pb_owners[i] = if_unclaimed;
862 gpio_pg_owners[i] = if_unclaimed;
863 }
864 for (; i<32; i++) {
865 gpio_pg_owners[i] = if_unclaimed;
866 }
867 return 0;
868}
869
870
871module_init(cris_io_interface_init);
872
873
874EXPORT_SYMBOL(cris_request_io_interface);
875EXPORT_SYMBOL(cris_free_io_interface);
876EXPORT_SYMBOL(cris_io_interface_allocate_pins);
877EXPORT_SYMBOL(cris_io_interface_free_pins);
878EXPORT_SYMBOL(cris_io_interface_register_watcher);
879EXPORT_SYMBOL(cris_io_interface_delete_watcher);
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index b2f16d6fc871..4b368a122015 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -1,4 +1,4 @@
1/* $Id: irq.c,v 1.2 2004/06/09 05:30:27 starvik Exp $ 1/* $Id: irq.c,v 1.4 2005/01/04 12:22:28 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/irq.c 3 * linux/arch/cris/kernel/irq.c
4 * 4 *
@@ -12,11 +12,13 @@
12 */ 12 */
13 13
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <linux/irq.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/config.h> 18#include <linux/config.h>
18 19
19irqvectptr irq_shortcuts[NR_IRQS]; /* vector of shortcut jumps after the irq prologue */ 20#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
21#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
20 22
21/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is 23/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is
22 * global just so that the kernel gdb can use it. 24 * global just so that the kernel gdb can use it.
@@ -102,41 +104,52 @@ static void (*interrupt[NR_IRQS])(void) = {
102 IRQ31_interrupt 104 IRQ31_interrupt
103}; 105};
104 106
105static void (*bad_interrupt[NR_IRQS])(void) = { 107static void enable_crisv10_irq(unsigned int irq);
106 NULL, NULL, 108
107 NULL, bad_IRQ3_interrupt, 109static unsigned int startup_crisv10_irq(unsigned int irq)
108 bad_IRQ4_interrupt, bad_IRQ5_interrupt, 110{
109 bad_IRQ6_interrupt, bad_IRQ7_interrupt, 111 enable_crisv10_irq(irq);
110 bad_IRQ8_interrupt, bad_IRQ9_interrupt, 112 return 0;
111 bad_IRQ10_interrupt, bad_IRQ11_interrupt, 113}
112 bad_IRQ12_interrupt, bad_IRQ13_interrupt, 114
113 NULL, NULL, 115#define shutdown_crisv10_irq disable_crisv10_irq
114 bad_IRQ16_interrupt, bad_IRQ17_interrupt,
115 bad_IRQ18_interrupt, bad_IRQ19_interrupt,
116 bad_IRQ20_interrupt, bad_IRQ21_interrupt,
117 bad_IRQ22_interrupt, bad_IRQ23_interrupt,
118 bad_IRQ24_interrupt, bad_IRQ25_interrupt,
119 NULL, NULL, NULL, NULL, NULL,
120 bad_IRQ31_interrupt
121};
122 116
123void arch_setup_irq(int irq) 117static void enable_crisv10_irq(unsigned int irq)
124{ 118{
125 set_int_vector(irq, interrupt[irq]); 119 unmask_irq(irq);
126} 120}
127 121
128void arch_free_irq(int irq) 122static void disable_crisv10_irq(unsigned int irq)
129{ 123{
130 set_int_vector(irq, bad_interrupt[irq]); 124 mask_irq(irq);
131} 125}
132 126
127static void ack_crisv10_irq(unsigned int irq)
128{
129}
130
131static void end_crisv10_irq(unsigned int irq)
132{
133}
134
135static struct hw_interrupt_type crisv10_irq_type = {
136 .typename = "CRISv10",
137 .startup = startup_crisv10_irq,
138 .shutdown = shutdown_crisv10_irq,
139 .enable = enable_crisv10_irq,
140 .disable = disable_crisv10_irq,
141 .ack = ack_crisv10_irq,
142 .end = end_crisv10_irq,
143 .set_affinity = NULL
144};
145
133void weird_irq(void); 146void weird_irq(void);
134void system_call(void); /* from entry.S */ 147void system_call(void); /* from entry.S */
135void do_sigtrap(void); /* from entry.S */ 148void do_sigtrap(void); /* from entry.S */
136void gdb_handle_breakpoint(void); /* from entry.S */ 149void gdb_handle_breakpoint(void); /* from entry.S */
137 150
138/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and 151/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
139 setting the irq vector table to point to bad_interrupt ptrs. 152 setting the irq vector table.
140*/ 153*/
141 154
142void __init 155void __init
@@ -154,14 +167,15 @@ init_IRQ(void)
154 167
155 *R_VECT_MASK_CLR = 0xffffffff; 168 *R_VECT_MASK_CLR = 0xffffffff;
156 169
157 /* clear the shortcut entry points */
158
159 for(i = 0; i < NR_IRQS; i++)
160 irq_shortcuts[i] = NULL;
161
162 for (i = 0; i < 256; i++) 170 for (i = 0; i < 256; i++)
163 etrax_irv->v[i] = weird_irq; 171 etrax_irv->v[i] = weird_irq;
164 172
173 /* Initialize IRQ handler descriptiors. */
174 for(i = 2; i < NR_IRQS; i++) {
175 irq_desc[i].handler = &crisv10_irq_type;
176 set_int_vector(i, interrupt[i]);
177 }
178
165 /* the entries in the break vector contain actual code to be 179 /* the entries in the break vector contain actual code to be
166 executed by the associated break handler, rather than just a jump 180 executed by the associated break handler, rather than just a jump
167 address. therefore we need to setup a default breakpoint handler 181 address. therefore we need to setup a default breakpoint handler
@@ -170,10 +184,6 @@ init_IRQ(void)
170 for (i = 0; i < 16; i++) 184 for (i = 0; i < 16; i++)
171 set_break_vector(i, do_sigtrap); 185 set_break_vector(i, do_sigtrap);
172 186
173 /* set all etrax irq's to the bad handlers */
174 for (i = 2; i < NR_IRQS; i++)
175 set_int_vector(i, bad_interrupt[i]);
176
177 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */ 187 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
178 188
179 set_int_vector(15, multiple_interrupt); 189 set_int_vector(15, multiple_interrupt);
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index 7d368c877ee9..b72e6a91a639 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -18,6 +18,10 @@
18*! Jul 21 1999 Bjorn Wesen eLinux port 18*! Jul 21 1999 Bjorn Wesen eLinux port
19*! 19*!
20*! $Log: kgdb.c,v $ 20*! $Log: kgdb.c,v $
21*! Revision 1.6 2005/01/14 10:12:17 starvik
22*! KGDB on separate port.
23*! Console fixes from 2.4.
24*!
21*! Revision 1.5 2004/10/07 13:59:08 starvik 25*! Revision 1.5 2004/10/07 13:59:08 starvik
22*! Corrected call to set_int_vector 26*! Corrected call to set_int_vector
23*! 27*!
@@ -71,7 +75,7 @@
71*! 75*!
72*!--------------------------------------------------------------------------- 76*!---------------------------------------------------------------------------
73*! 77*!
74*! $Id: kgdb.c,v 1.5 2004/10/07 13:59:08 starvik Exp $ 78*! $Id: kgdb.c,v 1.6 2005/01/14 10:12:17 starvik Exp $
75*! 79*!
76*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN 80*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
77*! 81*!
@@ -225,6 +229,7 @@
225#include <linux/kernel.h> 229#include <linux/kernel.h>
226#include <linux/delay.h> 230#include <linux/delay.h>
227#include <linux/linkage.h> 231#include <linux/linkage.h>
232#include <linux/reboot.h>
228 233
229#include <asm/setup.h> 234#include <asm/setup.h>
230#include <asm/ptrace.h> 235#include <asm/ptrace.h>
@@ -1344,12 +1349,11 @@ handle_exception (int sigval)
1344 } 1349 }
1345} 1350}
1346 1351
1347/* The jump is to the address 0x00000002. Performs a complete re-start 1352/* Performs a complete re-start from scratch. */
1348 from scratch. */
1349static void 1353static void
1350kill_restart () 1354kill_restart ()
1351{ 1355{
1352 __asm__ volatile ("jump 2"); 1356 machine_restart("");
1353} 1357}
1354 1358
1355/********************************** Breakpoint *******************************/ 1359/********************************** Breakpoint *******************************/
@@ -1506,6 +1510,11 @@ kgdb_handle_serial:
1506 bne goback 1510 bne goback
1507 nop 1511 nop
1508 1512
1513 move.d [reg+0x5E], $r10 ; Get DCCR
1514 btstq 8, $r10 ; Test the U-flag.
1515 bmi goback
1516 nop
1517
1509;; 1518;;
1510;; Handle the communication 1519;; Handle the communication
1511;; 1520;;
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 87ff37790827..69e28b4057e8 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -1,4 +1,4 @@
1/* $Id: process.c,v 1.9 2004/10/19 13:07:37 starvik Exp $ 1/* $Id: process.c,v 1.12 2004/12/27 11:18:32 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/process.c 3 * linux/arch/cris/kernel/process.c
4 * 4 *
@@ -101,6 +101,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
101 regs.r11 = (unsigned long)fn; 101 regs.r11 = (unsigned long)fn;
102 regs.r12 = (unsigned long)arg; 102 regs.r12 = (unsigned long)arg;
103 regs.irp = (unsigned long)kernel_thread_helper; 103 regs.irp = (unsigned long)kernel_thread_helper;
104 regs.dccr = 1 << I_DCCR_BITNR;
104 105
105 /* Ok, create the new process.. */ 106 /* Ok, create the new process.. */
106 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 107 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 581ecabaae53..130dd214e41d 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -11,6 +11,7 @@
11#include <linux/ptrace.h> 11#include <linux/ptrace.h>
12#include <linux/user.h> 12#include <linux/user.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <linux/security.h>
14 15
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/page.h> 17#include <asm/page.h>
@@ -86,9 +87,13 @@ sys_ptrace(long request, long pid, long addr, long data)
86 ret = -EPERM; 87 ret = -EPERM;
87 88
88 if (request == PTRACE_TRACEME) { 89 if (request == PTRACE_TRACEME) {
90 /* are we already being traced? */
89 if (current->ptrace & PT_PTRACED) 91 if (current->ptrace & PT_PTRACED)
90 goto out; 92 goto out;
91 93 ret = security_ptrace(current->parent, current);
94 if (ret)
95 goto out;
96 /* set the ptrace bit in the process flags. */
92 current->ptrace |= PT_PTRACED; 97 current->ptrace |= PT_PTRACED;
93 ret = 0; 98 ret = 0;
94 goto out; 99 goto out;
@@ -207,7 +212,7 @@ sys_ptrace(long request, long pid, long addr, long data)
207 case PTRACE_KILL: 212 case PTRACE_KILL:
208 ret = 0; 213 ret = 0;
209 214
210 if (child->state == TASK_ZOMBIE) 215 if (child->exit_state == EXIT_ZOMBIE)
211 break; 216 break;
212 217
213 child->exit_code = SIGKILL; 218 child->exit_code = SIGKILL;
diff --git a/arch/cris/arch-v10/kernel/shadows.c b/arch/cris/arch-v10/kernel/shadows.c
index 561a890a8e4c..38fd44dfbc5b 100644
--- a/arch/cris/arch-v10/kernel/shadows.c
+++ b/arch/cris/arch-v10/kernel/shadows.c
@@ -1,4 +1,4 @@
1/* $Id: shadows.c,v 1.1 2001/12/17 13:59:27 bjornw Exp $ 1/* $Id: shadows.c,v 1.2 2004/12/13 12:21:51 starvik Exp $
2 * 2 *
3 * Various shadow registers. Defines for these are in include/asm-etrax100/io.h 3 * Various shadow registers. Defines for these are in include/asm-etrax100/io.h
4 */ 4 */
@@ -6,6 +6,7 @@
6/* Shadows for internal Etrax-registers */ 6/* Shadows for internal Etrax-registers */
7 7
8unsigned long genconfig_shadow; 8unsigned long genconfig_shadow;
9unsigned long gen_config_ii_shadow;
9unsigned long port_g_data_shadow; 10unsigned long port_g_data_shadow;
10unsigned char port_pa_dir_shadow; 11unsigned char port_pa_dir_shadow;
11unsigned char port_pa_data_shadow; 12unsigned char port_pa_data_shadow;
diff --git a/arch/cris/arch-v10/kernel/traps.c b/arch/cris/arch-v10/kernel/traps.c
index da491f438a6e..34a27ea2052d 100644
--- a/arch/cris/arch-v10/kernel/traps.c
+++ b/arch/cris/arch-v10/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.2 2003/07/04 08:27:41 starvik Exp $ 1/* $Id: traps.c,v 1.4 2005/04/24 18:47:55 starvik Exp $
2 * 2 *
3 * linux/arch/cris/arch-v10/traps.c 3 * linux/arch/cris/arch-v10/traps.c
4 * 4 *
@@ -16,6 +16,8 @@
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/arch/sv_addr_ag.h> 17#include <asm/arch/sv_addr_ag.h>
18 18
19extern int raw_printk(const char *fmt, ...);
20
19void 21void
20show_registers(struct pt_regs * regs) 22show_registers(struct pt_regs * regs)
21{ 23{
@@ -26,18 +28,18 @@ show_registers(struct pt_regs * regs)
26 register. */ 28 register. */
27 unsigned long usp = rdusp(); 29 unsigned long usp = rdusp();
28 30
29 printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", 31 raw_printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
30 regs->irp, regs->srp, regs->dccr, usp, regs->mof ); 32 regs->irp, regs->srp, regs->dccr, usp, regs->mof );
31 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", 33 raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
32 regs->r0, regs->r1, regs->r2, regs->r3); 34 regs->r0, regs->r1, regs->r2, regs->r3);
33 printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n", 35 raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
34 regs->r4, regs->r5, regs->r6, regs->r7); 36 regs->r4, regs->r5, regs->r6, regs->r7);
35 printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", 37 raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
36 regs->r8, regs->r9, regs->r10, regs->r11); 38 regs->r8, regs->r9, regs->r10, regs->r11);
37 printk("r12: %08lx r13: %08lx oR10: %08lx\n", 39 raw_printk("r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n",
38 regs->r12, regs->r13, regs->orig_r10); 40 regs->r12, regs->r13, regs->orig_r10, regs);
39 printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE); 41 raw_printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
40 printk("Process %s (pid: %d, stackpage=%08lx)\n", 42 raw_printk("Process %s (pid: %d, stackpage=%08lx)\n",
41 current->comm, current->pid, (unsigned long)current); 43 current->comm, current->pid, (unsigned long)current);
42 44
43 /* 45 /*
@@ -53,7 +55,7 @@ show_registers(struct pt_regs * regs)
53 if (usp != 0) 55 if (usp != 0)
54 show_stack (NULL, NULL); 56 show_stack (NULL, NULL);
55 57
56 printk("\nCode: "); 58 raw_printk("\nCode: ");
57 if(regs->irp < PAGE_OFFSET) 59 if(regs->irp < PAGE_OFFSET)
58 goto bad; 60 goto bad;
59 61
@@ -70,16 +72,16 @@ show_registers(struct pt_regs * regs)
70 unsigned char c; 72 unsigned char c;
71 if(__get_user(c, &((unsigned char*)regs->irp)[i])) { 73 if(__get_user(c, &((unsigned char*)regs->irp)[i])) {
72bad: 74bad:
73 printk(" Bad IP value."); 75 raw_printk(" Bad IP value.");
74 break; 76 break;
75 } 77 }
76 78
77 if (i == 0) 79 if (i == 0)
78 printk("(%02x) ", c); 80 raw_printk("(%02x) ", c);
79 else 81 else
80 printk("%02x ", c); 82 raw_printk("%02x ", c);
81 } 83 }
82 printk("\n"); 84 raw_printk("\n");
83 } 85 }
84} 86}
85 87
@@ -121,7 +123,7 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
121 stop_watchdog(); 123 stop_watchdog();
122#endif 124#endif
123 125
124 printk("%s: %04lx\n", str, err & 0xffff); 126 raw_printk("%s: %04lx\n", str, err & 0xffff);
125 127
126 show_registers(regs); 128 show_registers(regs);
127 129
@@ -130,3 +132,8 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
130#endif 132#endif
131 do_exit(SIGSEGV); 133 do_exit(SIGSEGV);
132} 134}
135
136void arch_enable_nmi(void)
137{
138 asm volatile("setf m");
139}
diff --git a/arch/cris/arch-v10/mm/fault.c b/arch/cris/arch-v10/mm/fault.c
index 6805cdb25a53..fe2615022b97 100644
--- a/arch/cris/arch-v10/mm/fault.c
+++ b/arch/cris/arch-v10/mm/fault.c
@@ -14,6 +14,7 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/arch/svinto.h> 16#include <asm/arch/svinto.h>
17#include <asm/mmu_context.h>
17 18
18/* debug of low-level TLB reload */ 19/* debug of low-level TLB reload */
19#undef DEBUG 20#undef DEBUG
@@ -24,8 +25,6 @@
24#define D(x) 25#define D(x)
25#endif 26#endif
26 27
27extern volatile pgd_t *current_pgd;
28
29extern const struct exception_table_entry 28extern const struct exception_table_entry
30 *search_exception_tables(unsigned long addr); 29 *search_exception_tables(unsigned long addr);
31 30
@@ -46,7 +45,7 @@ handle_mmu_bus_fault(struct pt_regs *regs)
46 int page_id; 45 int page_id;
47 int acc, inv; 46 int acc, inv;
48#endif 47#endif
49 pgd_t* pgd = (pgd_t*)current_pgd; 48 pgd_t* pgd = (pgd_t*)per_cpu(current_pgd, smp_processor_id());
50 pmd_t *pmd; 49 pmd_t *pmd;
51 pte_t pte; 50 pte_t pte;
52 int miss, we, writeac; 51 int miss, we, writeac;
@@ -94,24 +93,3 @@ handle_mmu_bus_fault(struct pt_regs *regs)
94 *R_TLB_LO = pte_val(pte); 93 *R_TLB_LO = pte_val(pte);
95 local_irq_restore(flags); 94 local_irq_restore(flags);
96} 95}
97
98/* Called from arch/cris/mm/fault.c to find fixup code. */
99int
100find_fixup_code(struct pt_regs *regs)
101{
102 const struct exception_table_entry *fixup;
103
104 if ((fixup = search_exception_tables(regs->irp)) != 0) {
105 /* Adjust the instruction pointer in the stackframe. */
106 regs->irp = fixup->fixup;
107
108 /*
109 * Don't return by restoring the CPU state, so switch
110 * frame-type.
111 */
112 regs->frametype = CRIS_FRAME_NORMAL;
113 return 1;
114 }
115
116 return 0;
117}
diff --git a/arch/cris/arch-v10/mm/init.c b/arch/cris/arch-v10/mm/init.c
index a9f975a9cfb5..ff3481e76dd4 100644
--- a/arch/cris/arch-v10/mm/init.c
+++ b/arch/cris/arch-v10/mm/init.c
@@ -42,7 +42,7 @@ paging_init(void)
42 * switch_mm) 42 * switch_mm)
43 */ 43 */
44 44
45 current_pgd = init_mm.pgd; 45 per_cpu(current_pgd, smp_processor_id()) = init_mm.pgd;
46 46
47 /* initialise the TLB (tlb.c) */ 47 /* initialise the TLB (tlb.c) */
48 48
diff --git a/arch/cris/arch-v10/mm/tlb.c b/arch/cris/arch-v10/mm/tlb.c
index 9d06125ff5a2..70a5523eff78 100644
--- a/arch/cris/arch-v10/mm/tlb.c
+++ b/arch/cris/arch-v10/mm/tlb.c
@@ -139,53 +139,6 @@ flush_tlb_page(struct vm_area_struct *vma,
139 local_irq_restore(flags); 139 local_irq_restore(flags);
140} 140}
141 141
142/* invalidate a page range */
143
144void
145flush_tlb_range(struct vm_area_struct *vma,
146 unsigned long start,
147 unsigned long end)
148{
149 struct mm_struct *mm = vma->vm_mm;
150 int page_id = mm->context.page_id;
151 int i;
152 unsigned long flags;
153
154 D(printk("tlb: flush range %p<->%p in context %d (%p)\n",
155 start, end, page_id, mm));
156
157 if(page_id == NO_CONTEXT)
158 return;
159
160 start &= PAGE_MASK; /* probably not necessary */
161 end &= PAGE_MASK; /* dito */
162
163 /* invalidate those TLB entries that match both the mm context
164 * and the virtual address range
165 */
166
167 local_save_flags(flags);
168 local_irq_disable();
169 for(i = 0; i < NUM_TLB_ENTRIES; i++) {
170 unsigned long tlb_hi, vpn;
171 *R_TLB_SELECT = IO_FIELD(R_TLB_SELECT, index, i);
172 tlb_hi = *R_TLB_HI;
173 vpn = tlb_hi & PAGE_MASK;
174 if (IO_EXTRACT(R_TLB_HI, page_id, tlb_hi) == page_id &&
175 vpn >= start && vpn < end) {
176 *R_TLB_HI = ( IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
177 IO_FIELD(R_TLB_HI, vpn, i & 0xf ) );
178
179 *R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no ) |
180 IO_STATE(R_TLB_LO, valid, no ) |
181 IO_STATE(R_TLB_LO, kernel,no ) |
182 IO_STATE(R_TLB_LO, we, no ) |
183 IO_FIELD(R_TLB_LO, pfn, 0 ) );
184 }
185 }
186 local_irq_restore(flags);
187}
188
189/* dump the entire TLB for debug purposes */ 142/* dump the entire TLB for debug purposes */
190 143
191#if 0 144#if 0
@@ -237,7 +190,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
237 * the pgd. 190 * the pgd.
238 */ 191 */
239 192
240 current_pgd = next->pgd; 193 per_cpu(current_pgd, smp_processor_id()) = next->pgd;
241 194
242 /* switch context in the MMU */ 195 /* switch context in the MMU */
243 196
diff --git a/arch/cris/arch-v32/Kconfig b/arch/cris/arch-v32/Kconfig
new file mode 100644
index 000000000000..22f0ddc04c50
--- /dev/null
+++ b/arch/cris/arch-v32/Kconfig
@@ -0,0 +1,296 @@
1config ETRAX_DRAM_VIRTUAL_BASE
2 hex
3 depends on ETRAX_ARCH_V32
4 default "c0000000"
5
6config ETRAX_LED1G
7 string "First green LED bit"
8 depends on ETRAX_ARCH_V32
9 default "PA3"
10 help
11 Bit to use for the first green LED (network LED).
12 Most Axis products use bit A3 here.
13
14config ETRAX_LED1R
15 string "First red LED bit"
16 depends on ETRAX_ARCH_V32
17 default "PA4"
18 help
19 Bit to use for the first red LED (network LED).
20 Most Axis products use bit A4 here.
21
22config ETRAX_LED2G
23 string "Second green LED bit"
24 depends on ETRAX_ARCH_V32
25 default "PA5"
26 help
27 Bit to use for the first green LED (status LED).
28 Most Axis products use bit A5 here.
29
30config ETRAX_LED2R
31 string "Second red LED bit"
32 depends on ETRAX_ARCH_V32
33 default "PA6"
34 help
35 Bit to use for the first red LED (network LED).
36 Most Axis products use bit A6 here.
37
38config ETRAX_LED3G
39 string "Third green LED bit"
40 depends on ETRAX_ARCH_V32
41 default "PA7"
42 help
43 Bit to use for the first green LED (drive/power LED).
44 Most Axis products use bit A7 here.
45
46config ETRAX_LED3R
47 string "Third red LED bit"
48 depends on ETRAX_ARCH_V32
49 default "PA7"
50 help
51 Bit to use for the first red LED (drive/power LED).
52 Most Axis products use bit A7 here.
53
54choice
55 prompt "Product debug-port"
56 depends on ETRAX_ARCH_V32
57 default ETRAX_DEBUG_PORT0
58
59config ETRAX_DEBUG_PORT0
60 bool "Serial-0"
61 help
62 Choose a serial port for the ETRAX debug console. Default to
63 port 0.
64
65config ETRAX_DEBUG_PORT1
66 bool "Serial-1"
67 help
68 Use serial port 1 for the console.
69
70config ETRAX_DEBUG_PORT2
71 bool "Serial-2"
72 help
73 Use serial port 2 for the console.
74
75config ETRAX_DEBUG_PORT3
76 bool "Serial-3"
77 help
78 Use serial port 3 for the console.
79
80config ETRAX_DEBUG_PORT_NULL
81 bool "disabled"
82 help
83 Disable serial-port debugging.
84
85endchoice
86
87choice
88 prompt "Kernel GDB port"
89 depends on ETRAX_KGDB
90 default ETRAX_KGDB_PORT0
91 help
92 Choose a serial port for kernel debugging. NOTE: This port should
93 not be enabled under Drivers for built-in interfaces (as it has its
94 own initialization code) and should not be the same as the debug port.
95
96config ETRAX_KGDB_PORT0
97 bool "Serial-0"
98 help
99 Use serial port 0 for kernel debugging.
100
101config ETRAX_KGDB_PORT1
102 bool "Serial-1"
103 help
104 Use serial port 1 for kernel debugging.
105
106config ETRAX_KGDB_PORT2
107 bool "Serial-2"
108 help
109 Use serial port 2 for kernel debugging.
110
111config ETRAX_KGDB_PORT3
112 bool "Serial-3"
113 help
114 Use serial port 3 for kernel debugging.
115
116endchoice
117
118config ETRAX_MEM_GRP1_CONFIG
119 hex "MEM_GRP1_CONFIG"
120 depends on ETRAX_ARCH_V32
121 default "4044a"
122 help
123 Waitstates for flash. The default value is suitable for the
124 standard flashes used in axis products (120 ns).
125
126config ETRAX_MEM_GRP2_CONFIG
127 hex "MEM_GRP2_CONFIG"
128 depends on ETRAX_ARCH_V32
129 default "0"
130 help
131 Waitstates for SRAM. 0 is a good choice for most Axis products.
132
133config ETRAX_MEM_GRP3_CONFIG
134 hex "MEM_GRP3_CONFIG"
135 depends on ETRAX_ARCH_V32
136 default "0"
137 help
138 Waitstates for CSP0-3. 0 is a good choice for most Axis products.
139 It may need to be changed if external devices such as extra
140 register-mapped LEDs are used.
141
142config ETRAX_MEM_GRP4_CONFIG
143 hex "MEM_GRP4_CONFIG"
144 depends on ETRAX_ARCH_V32
145 default "0"
146 help
147 Waitstates for CSP4-6. 0 is a good choice for most Axis products.
148
149config ETRAX_SDRAM_GRP0_CONFIG
150 hex "SDRAM_GRP0_CONFIG"
151 depends on ETRAX_ARCH_V32
152 default "336"
153 help
154 SDRAM configuration for group 0. The value depends on the
155 hardware configuration. The default value is suitable
156 for 32 MB organized as two 16 bits chips (e.g. Axis
157 part number 18550) connected as one 32 bit device (i.e. in
158 the same group).
159
160config ETRAX_SDRAM_GRP1_CONFIG
161 hex "SDRAM_GRP1_CONFIG"
162 depends on ETRAX_ARCH_V32
163 default "0"
164 help
165 SDRAM configuration for group 1. The defult value is 0
166 because group 1 is not used in the default configuration,
167 described in the help for SDRAM_GRP0_CONFIG.
168
169config ETRAX_SDRAM_TIMING
170 hex "SDRAM_TIMING"
171 depends on ETRAX_ARCH_V32
172 default "104a"
173 help
174 SDRAM timing parameters. The default value is ok for
175 most hardwares but large SDRAMs may require a faster
176 refresh (a.k.a 8K refresh). The default value implies
177 100MHz clock and SDR mode.
178
179config ETRAX_SDRAM_COMMAND
180 hex "SDRAM_COMMAND"
181 depends on ETRAX_ARCH_V32
182 default "0"
183 help
184 SDRAM command. Should be 0 unless you really know what
185 you are doing (may be != 0 for unusual address line
186 mappings such as in a MCM)..
187
188config ETRAX_DEF_GIO_PA_OE
189 hex "GIO_PA_OE"
190 depends on ETRAX_ARCH_V32
191 default "1c"
192 help
193 Configures the direction of general port A bits. 1 is out, 0 is in.
194 This is often totally different depending on the product used.
195 There are some guidelines though - if you know that only LED's are
196 connected to port PA, then they are usually connected to bits 2-4
197 and you can therefore use 1c. On other boards which don't have the
198 LED's at the general ports, these bits are used for all kinds of
199 stuff. If you don't know what to use, it is always safe to put all
200 as inputs, although floating inputs isn't good.
201
202config ETRAX_DEF_GIO_PA_OUT
203 hex "GIO_PA_OUT"
204 depends on ETRAX_ARCH_V32
205 default "00"
206 help
207 Configures the initial data for the general port A bits. Most
208 products should use 00 here.
209
210config ETRAX_DEF_GIO_PB_OE
211 hex "GIO_PB_OE"
212 depends on ETRAX_ARCH_V32
213 default "00000"
214 help
215 Configures the direction of general port B bits. 1 is out, 0 is in.
216 This is often totally different depending on the product used.
217 There are some guidelines though - if you know that only LED's are
218 connected to port PA, then they are usually connected to bits 2-4
219 and you can therefore use 1c. On other boards which don't have the
220 LED's at the general ports, these bits are used for all kinds of
221 stuff. If you don't know what to use, it is always safe to put all
222 as inputs, although floating inputs isn't good.
223
224config ETRAX_DEF_GIO_PB_OUT
225 hex "GIO_PB_OUT"
226 depends on ETRAX_ARCH_V32
227 default "00000"
228 help
229 Configures the initial data for the general port B bits. Most
230 products should use 00000 here.
231
232config ETRAX_DEF_GIO_PC_OE
233 hex "GIO_PC_OE"
234 depends on ETRAX_ARCH_V32
235 default "00000"
236 help
237 Configures the direction of general port C bits. 1 is out, 0 is in.
238 This is often totally different depending on the product used.
239 There are some guidelines though - if you know that only LED's are
240 connected to port PA, then they are usually connected to bits 2-4
241 and you can therefore use 1c. On other boards which don't have the
242 LED's at the general ports, these bits are used for all kinds of
243 stuff. If you don't know what to use, it is always safe to put all
244 as inputs, although floating inputs isn't good.
245
246config ETRAX_DEF_GIO_PC_OUT
247 hex "GIO_PC_OUT"
248 depends on ETRAX_ARCH_V32
249 default "00000"
250 help
251 Configures the initial data for the general port C bits. Most
252 products should use 00000 here.
253
254config ETRAX_DEF_GIO_PD_OE
255 hex "GIO_PD_OE"
256 depends on ETRAX_ARCH_V32
257 default "00000"
258 help
259 Configures the direction of general port D bits. 1 is out, 0 is in.
260 This is often totally different depending on the product used.
261 There are some guidelines though - if you know that only LED's are
262 connected to port PA, then they are usually connected to bits 2-4
263 and you can therefore use 1c. On other boards which don't have the
264 LED's at the general ports, these bits are used for all kinds of
265 stuff. If you don't know what to use, it is always safe to put all
266 as inputs, although floating inputs isn't good.
267
268config ETRAX_DEF_GIO_PD_OUT
269 hex "GIO_PD_OUT"
270 depends on ETRAX_ARCH_V32
271 default "00000"
272 help
273 Configures the initial data for the general port D bits. Most
274 products should use 00000 here.
275
276config ETRAX_DEF_GIO_PE_OE
277 hex "GIO_PE_OE"
278 depends on ETRAX_ARCH_V32
279 default "00000"
280 help
281 Configures the direction of general port E bits. 1 is out, 0 is in.
282 This is often totally different depending on the product used.
283 There are some guidelines though - if you know that only LED's are
284 connected to port PA, then they are usually connected to bits 2-4
285 and you can therefore use 1c. On other boards which don't have the
286 LED's at the general ports, these bits are used for all kinds of
287 stuff. If you don't know what to use, it is always safe to put all
288 as inputs, although floating inputs isn't good.
289
290config ETRAX_DEF_GIO_PE_OUT
291 hex "GIO_PE_OUT"
292 depends on ETRAX_ARCH_V32
293 default "00000"
294 help
295 Configures the initial data for the general port E bits. Most
296 products should use 00000 here.
diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile
new file mode 100644
index 000000000000..26f293ab9617
--- /dev/null
+++ b/arch/cris/arch-v32/boot/Makefile
@@ -0,0 +1,14 @@
1#
2# arch/cris/arch-v32/boot/Makefile
3#
4target = $(target_boot_dir)
5src = $(src_boot_dir)
6
7zImage: compressed/vmlinuz
8
9compressed/vmlinuz: $(objtree)/vmlinux
10 @$(MAKE) -f $(src)/compressed/Makefile $(objtree)/vmlinuz
11
12clean:
13 rm -f zImage tools/build compressed/vmlinux.out
14 @$(MAKE) -f $(src)/compressed/Makefile clean
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
new file mode 100644
index 000000000000..9f77eda914ba
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -0,0 +1,41 @@
1#
2# lx25/arch/cris/arch-v32/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux files and romfs
5#
6
7target = $(target_compressed_dir)
8src = $(src_compressed_dir)
9
10CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
11CFLAGS = -O2
12LD = gcc-cris -mlinux -march=v32 -nostdlib
13OBJCOPY = objcopy-cris
14OBJCOPYFLAGS = -O binary --remove-section=.bss
15OBJECTS = $(target)/head.o $(target)/misc.o
16
17# files to compress
18SYSTEM = $(objtree)/vmlinux.bin
19
20all: vmlinuz
21
22$(target)/decompress.bin: $(OBJECTS)
23 $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
24 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
25
26$(objtree)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
27 cat $(target)/decompress.bin piggy.img > $(objtree)/vmlinuz
28 rm -f piggy.img
29 cp $(objtree)/vmlinuz $(src)
30
31$(target)/head.o: $(src)/head.S
32 $(CC) -D__ASSEMBLY__ -c $< -o $@
33
34# gzip the kernel image
35
36piggy.img: $(SYSTEM)
37 cat $(SYSTEM) | gzip -f -9 > piggy.img
38
39clean:
40 rm -f piggy.img $(objtree)/vmlinuz vmlinuz.o decompress.o decompress.bin $(OBJECTS)
41
diff --git a/arch/cris/arch-v32/boot/compressed/README b/arch/cris/arch-v32/boot/compressed/README
new file mode 100644
index 000000000000..e33691d15c57
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/README
@@ -0,0 +1,25 @@
1Creation of the self-extracting compressed kernel image (vmlinuz)
2-----------------------------------------------------------------
3$Id: README,v 1.1 2003/08/21 09:37:03 johana Exp $
4
5This can be slightly confusing because it's a process with many steps.
6
7The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
8by that makefile into text and data binary files, vmlinux.text and
9vmlinux.data.
10
11Those files together with a ROM filesystem can be catted together and
12burned into a flash or executed directly at the DRAM origin.
13
14They can also be catted together and compressed with gzip, which is what
15happens in this makefile. Together they make up piggy.img.
16
17The decompressor is built into the file decompress.o. It is turned into
18the binary file decompress.bin, which is catted together with piggy.img
19into the file vmlinuz. It can be executed in an arbitrary place in flash.
20
21Be careful - it assumes some things about free locations in DRAM. It
22assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
23so it puts its code at 0x40700000, and initial stack at 0x40800000.
24
25-Bjorn
diff --git a/arch/cris/arch-v32/boot/compressed/decompress.ld b/arch/cris/arch-v32/boot/compressed/decompress.ld
new file mode 100644
index 000000000000..3c837feca3ac
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/decompress.ld
@@ -0,0 +1,30 @@
1/*#OUTPUT_FORMAT(elf32-us-cris) */
2OUTPUT_ARCH (crisv32)
3
4MEMORY
5 {
6 dram : ORIGIN = 0x40700000,
7 LENGTH = 0x00100000
8 }
9
10SECTIONS
11{
12 .text :
13 {
14 _stext = . ;
15 *(.text)
16 *(.rodata)
17 *(.rodata.*)
18 _etext = . ;
19 } > dram
20 .data :
21 {
22 *(.data)
23 _edata = . ;
24 } > dram
25 .bss :
26 {
27 *(.bss)
28 _end = ALIGN( 0x10 ) ;
29 } > dram
30}
diff --git a/arch/cris/arch-v32/boot/compressed/head.S b/arch/cris/arch-v32/boot/compressed/head.S
new file mode 100644
index 000000000000..0c55b83b8287
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/head.S
@@ -0,0 +1,193 @@
1/*
2 * Code that sets up the DRAM registers, calls the
3 * decompressor to unpack the piggybacked kernel, and jumps.
4 *
5 * Copyright (C) 1999 - 2003, Axis Communications AB
6 */
7
8#include <linux/config.h>
9#define ASSEMBLER_MACROS_ONLY
10#include <asm/arch/hwregs/asm/reg_map_asm.h>
11#include <asm/arch/hwregs/asm/gio_defs_asm.h>
12#include <asm/arch/hwregs/asm/config_defs_asm.h>
13
14#define RAM_INIT_MAGIC 0x56902387
15#define COMMAND_LINE_MAGIC 0x87109563
16
17 ;; Exported symbols
18
19 .globl input_data
20
21 .text
22start:
23 di
24
25 ;; Start clocks for used blocks.
26 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
27 move.d [$r1], $r0
28 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
29 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
30 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
31 move.d $r0, [$r1]
32
33 ;; If booting from NAND flash we first have to copy some
34 ;; data from NAND flash to internal RAM to get the code
35 ;; that initializes the SDRAM. Lets copy 20 KB. This
36 ;; code executes at 0x38010000 if booting from NAND and
37 ;; we are guaranted that at least 0x200 bytes are good so
38 ;; lets start from there. The first 8192 bytes in the nand
39 ;; flash is spliced with zeroes and is thus 16384 bytes.
40 move.d 0x38010200, $r10
41 move.d 0x14200, $r11 ; Start offset in NAND flash 0x10200 + 16384
42 move.d 0x5000, $r12 ; Length of copy
43
44 ;; Before this code the tools add a partitiontable so the PC
45 ;; has an offset from the linked address.
46offset1:
47 lapcq ., $r13 ; get PC
48 add.d first_copy_complete-offset1, $r13
49
50#include "../../lib/nand_init.S"
51
52first_copy_complete:
53 ;; Initialze the DRAM registers.
54 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
55 beq dram_init_finished
56 nop
57
58#include "../../lib/dram_init.S"
59
60dram_init_finished:
61 lapcq ., $r13 ; get PC
62 add.d second_copy_complete-dram_init_finished, $r13
63
64 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
65 move.d [$r0], $r0
66 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
67 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
68 bne second_copy_complete ; No NAND boot
69 nop
70
71 ;; Copy 2MB from NAND flash to SDRAM (at 2-4MB into the SDRAM)
72 move.d 0x40204000, $r10
73 move.d 0x8000, $r11
74 move.d 0x200000, $r12
75 ba copy_nand_to_ram
76 nop
77second_copy_complete:
78
79 ;; Initiate the PA port.
80 move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0
81 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r1
82 move.d $r0, [$r1]
83
84 move.d CONFIG_ETRAX_DEF_GIO_PA_OE, $r0
85 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r1
86 move.d $r0, [$r1]
87
88 ;; Setup the stack to a suitably high address.
89 ;; We assume 8 MB is the minimum DRAM and put
90 ;; the SP at the top for now.
91
92 move.d 0x40800000, $sp
93
94 ;; Figure out where the compressed piggyback image is
95 ;; in the flash (since we wont try to copy it to DRAM
96 ;; before unpacking). It is at _edata, but in flash.
97 ;; Use (_edata - herami) as offset to the current PC.
98
99 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
100 move.d [$r0], $r0
101 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
102 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
103 beq hereami2
104 nop
105hereami:
106 lapcq ., $r5 ; get PC
107 and.d 0x7fffffff, $r5 ; strip any non-cache bit
108 move.d $r5, $r0 ; save for later - flash address of 'herami'
109 add.d _edata, $r5
110 sub.d hereami, $r5 ; r5 = flash address of '_edata'
111 move.d hereami, $r1 ; destination
112 ba 2f
113 nop
114hereami2:
115 lapcq ., $r5 ; get PC
116 and.d 0x00ffffff, $r5 ; strip any non-cache bit
117 move.d $r5, $r6
118 or.d 0x40200000, $r6
119 move.d $r6, $r0 ; save for later - flash address of 'herami'
120 add.d _edata, $r5
121 sub.d hereami2, $r5 ; r5 = flash address of '_edata'
122 add.d 0x40200000, $r5
123 move.d hereami2, $r1 ; destination
1242:
125 ;; Copy text+data to DRAM
126
127 move.d _edata, $r2 ; end destination
1281: move.w [$r0+], $r3
129 move.w $r3, [$r1+]
130 cmp.d $r2, $r1
131 bcs 1b
132 nop
133
134 move.d input_data, $r0 ; for the decompressor
135 move.d $r5, [$r0] ; for the decompressor
136
137 ;; Clear the decompressors BSS (between _edata and _end)
138
139 moveq 0, $r0
140 move.d _edata, $r1
141 move.d _end, $r2
1421: move.w $r0, [$r1+]
143 cmp.d $r2, $r1
144 bcs 1b
145 nop
146
147 ;; Save command line magic and address.
148 move.d _cmd_line_magic, $r12
149 move.d $r10, [$r12]
150 move.d _cmd_line_addr, $r12
151 move.d $r11, [$r12]
152
153 ;; Do the decompression and save compressed size in _inptr
154
155 jsr decompress_kernel
156 nop
157
158 ;; Restore command line magic and address.
159 move.d _cmd_line_magic, $r10
160 move.d [$r10], $r10
161 move.d _cmd_line_addr, $r11
162 move.d [$r11], $r11
163
164 ;; Put start address of root partition in r9 so the kernel can use it
165 ;; when mounting from flash
166 move.d input_data, $r0
167 move.d [$r0], $r9 ; flash address of compressed kernel
168 move.d inptr, $r0
169 add.d [$r0], $r9 ; size of compressed kernel
170 cmp.d 0x40200000, $r9
171 blo enter_kernel
172 nop
173 sub.d 0x40200000, $r9
174 add.d 0x4000, $r9
175
176enter_kernel:
177 ;; Enter the decompressed kernel
178 move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
179 jump 0x40004000 ; kernel is linked to this address
180 nop
181
182 .data
183
184input_data:
185 .dword 0 ; used by the decompressor
186_cmd_line_magic:
187 .dword 0
188_cmd_line_addr:
189 .dword 0
190is_nand_boot:
191 .dword 0
192
193#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c
new file mode 100644
index 000000000000..54644238ed59
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/misc.c
@@ -0,0 +1,318 @@
1/*
2 * misc.c
3 *
4 * $Id: misc.c,v 1.8 2005/04/24 18:34:29 starvik Exp $
5 *
6 * This is a collection of several routines from gzip-1.0.3
7 * adapted for Linux.
8 *
9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
11 * adoptation for Linux/CRIS Axis Communications AB, 1999
12 *
13 */
14
15/* where the piggybacked kernel image expects itself to live.
16 * it is the same address we use when we network load an uncompressed
17 * image into DRAM, and it is the address the kernel is linked to live
18 * at by vmlinux.lds.S
19 */
20
21#define KERNEL_LOAD_ADR 0x40004000
22
23#include <linux/config.h>
24
25#include <linux/types.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/reg_map.h>
28#include <asm/arch/hwregs/ser_defs.h>
29
30/*
31 * gzip declarations
32 */
33
34#define OF(args) args
35#define STATIC static
36
37void* memset(void* s, int c, size_t n);
38void* memcpy(void* __dest, __const void* __src,
39 size_t __n);
40
41#define memzero(s, n) memset ((s), 0, (n))
42
43
44typedef unsigned char uch;
45typedef unsigned short ush;
46typedef unsigned long ulg;
47
48#define WSIZE 0x8000 /* Window size must be at least 32k, */
49 /* and a power of two */
50
51static uch *inbuf; /* input buffer */
52static uch window[WSIZE]; /* Sliding window buffer */
53
54unsigned inptr = 0; /* index of next byte to be processed in inbuf
55 * After decompression it will contain the
56 * compressed size, and head.S will read it.
57 */
58
59static unsigned outcnt = 0; /* bytes in output buffer */
60
61/* gzip flag byte */
62#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
63#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
64#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
65#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
66#define COMMENT 0x10 /* bit 4 set: file comment present */
67#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
68#define RESERVED 0xC0 /* bit 6,7: reserved */
69
70#define get_byte() inbuf[inptr++]
71
72/* Diagnostic functions */
73#ifdef DEBUG
74# define Assert(cond,msg) {if(!(cond)) error(msg);}
75# define Trace(x) fprintf x
76# define Tracev(x) {if (verbose) fprintf x ;}
77# define Tracevv(x) {if (verbose>1) fprintf x ;}
78# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
79# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
80#else
81# define Assert(cond,msg)
82# define Trace(x)
83# define Tracev(x)
84# define Tracevv(x)
85# define Tracec(c,x)
86# define Tracecv(c,x)
87#endif
88
89static int fill_inbuf(void);
90static void flush_window(void);
91static void error(char *m);
92static void gzip_mark(void **);
93static void gzip_release(void **);
94
95extern char *input_data; /* lives in head.S */
96
97static long bytes_out = 0;
98static uch *output_data;
99static unsigned long output_ptr = 0;
100
101static void *malloc(int size);
102static void free(void *where);
103static void error(char *m);
104static void gzip_mark(void **);
105static void gzip_release(void **);
106
107static void puts(const char *);
108
109/* the "heap" is put directly after the BSS ends, at end */
110
111extern int _end;
112static long free_mem_ptr = (long)&_end;
113
114#include "../../../../../lib/inflate.c"
115
116static void *malloc(int size)
117{
118 void *p;
119
120 if (size <0) error("Malloc error");
121
122 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
123
124 p = (void *)free_mem_ptr;
125 free_mem_ptr += size;
126
127 return p;
128}
129
130static void free(void *where)
131{ /* Don't care */
132}
133
134static void gzip_mark(void **ptr)
135{
136 *ptr = (void *) free_mem_ptr;
137}
138
139static void gzip_release(void **ptr)
140{
141 free_mem_ptr = (long) *ptr;
142}
143
144/* decompressor info and error messages to serial console */
145
146static inline void
147serout(const char *s, reg_scope_instances regi_ser)
148{
149 reg_ser_rs_stat_din rs;
150 reg_ser_rw_dout dout = {.data = *s};
151
152 do {
153 rs = REG_RD(ser, regi_ser, rs_stat_din);
154 }
155 while (!rs.tr_rdy);/* Wait for tranceiver. */
156
157 REG_WR(ser, regi_ser, rw_dout, dout);
158}
159
160static void
161puts(const char *s)
162{
163#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
164 while (*s) {
165#ifdef CONFIG_ETRAX_DEBUG_PORT0
166 serout(s, regi_ser0);
167#endif
168#ifdef CONFIG_ETRAX_DEBUG_PORT1
169 serout(s, regi_ser1);
170#endif
171#ifdef CONFIG_ETRAX_DEBUG_PORT2
172 serout(s, regi_ser2);
173#endif
174#ifdef CONFIG_ETRAX_DEBUG_PORT3
175 serout(s, regi_ser3);
176#endif
177 *s++;
178 }
179/* CONFIG_ETRAX_DEBUG_PORT_NULL */
180#endif
181}
182
183void*
184memset(void* s, int c, size_t n)
185{
186 int i;
187 char *ss = (char*)s;
188
189 for (i=0;i<n;i++) ss[i] = c;
190}
191
192void*
193memcpy(void* __dest, __const void* __src,
194 size_t __n)
195{
196 int i;
197 char *d = (char *)__dest, *s = (char *)__src;
198
199 for (i=0;i<__n;i++) d[i] = s[i];
200}
201
202/* ===========================================================================
203 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
204 * (Used for the decompressed data only.)
205 */
206
207static void
208flush_window()
209{
210 ulg c = crc; /* temporary variable */
211 unsigned n;
212 uch *in, *out, ch;
213
214 in = window;
215 out = &output_data[output_ptr];
216 for (n = 0; n < outcnt; n++) {
217 ch = *out++ = *in++;
218 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
219 }
220 crc = c;
221 bytes_out += (ulg)outcnt;
222 output_ptr += (ulg)outcnt;
223 outcnt = 0;
224}
225
226static void
227error(char *x)
228{
229 puts("\n\n");
230 puts(x);
231 puts("\n\n -- System halted\n");
232
233 while(1); /* Halt */
234}
235
236void
237setup_normal_output_buffer()
238{
239 output_data = (char *)KERNEL_LOAD_ADR;
240}
241
242static inline void
243serial_setup(reg_scope_instances regi_ser)
244{
245 reg_ser_rw_xoff xoff;
246 reg_ser_rw_tr_ctrl tr_ctrl;
247 reg_ser_rw_rec_ctrl rec_ctrl;
248 reg_ser_rw_tr_baud_div tr_baud;
249 reg_ser_rw_rec_baud_div rec_baud;
250
251 /* Turn off XOFF. */
252 xoff = REG_RD(ser, regi_ser, rw_xoff);
253
254 xoff.chr = 0;
255 xoff.automatic = regk_ser_no;
256
257 REG_WR(ser, regi_ser, rw_xoff, xoff);
258
259 /* Set baudrate and stopbits. */
260 tr_ctrl = REG_RD(ser, regi_ser, rw_tr_ctrl);
261 rec_ctrl = REG_RD(ser, regi_ser, rw_rec_ctrl);
262 tr_baud = REG_RD(ser, regi_ser, rw_tr_baud_div);
263 rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div);
264
265 tr_ctrl.stop_bits = 1; /* 2 stop bits. */
266
267 /*
268 * The baudrate setup is a bit fishy, but in the end the tranceiver is
269 * set to 4800 and the receiver to 115200. The magic value is
270 * 29.493 MHz.
271 */
272 tr_ctrl.base_freq = regk_ser_f29_493;
273 rec_ctrl.base_freq = regk_ser_f29_493;
274 tr_baud.div = (29493000 / 8) / 4800;
275 rec_baud.div = (29493000 / 8) / 115200;
276
277 REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl);
278 REG_WR(ser, regi_ser, rw_tr_baud_div, tr_baud);
279 REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
280 REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
281}
282
283void
284decompress_kernel()
285{
286 char revision;
287
288 /* input_data is set in head.S */
289 inbuf = input_data;
290
291#ifdef CONFIG_ETRAX_DEBUG_PORT0
292 serial_setup(regi_ser0);
293#endif
294#ifdef CONFIG_ETRAX_DEBUG_PORT1
295 serial_setup(regi_ser1);
296#endif
297#ifdef CONFIG_ETRAX_DEBUG_PORT2
298 serial_setup(regi_ser2);
299#endif
300#ifdef CONFIG_ETRAX_DEBUG_PORT3
301 serial_setup(regi_ser3);
302#endif
303
304 setup_normal_output_buffer();
305
306 makecrc();
307
308 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
309 if (revision < 32)
310 {
311 puts("You need an ETRAX FS to run Linux 2.6/crisv32.\n");
312 while(1);
313 }
314
315 puts("Uncompressing Linux...\n");
316 gunzip();
317 puts("Done. Now booting the kernel.\n");
318}
diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile
new file mode 100644
index 000000000000..f668a8198724
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/Makefile
@@ -0,0 +1,36 @@
1#
2# Makefile for rescue code
3#
4target = $(target_rescue_dir)
5src = $(src_rescue_dir)
6
7CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
8CFLAGS = -O2
9LD = gcc-cris -mlinux -march=v32 -nostdlib
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss
12
13all: $(target)/rescue.bin
14
15rescue: rescue.bin
16 # do nothing
17
18$(target)/rescue.bin: $(target) $(target)/head.o
19 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
20 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
21 cp -p $(target)/rescue.bin $(objtree)
22
23$(target):
24 mkdir -p $(target)
25
26$(target)/head.o: $(src)/head.S
27 $(CC) -D__ASSEMBLY__ -c $< -o $*.o
28
29clean:
30 rm -f $(target)/*.o $(target)/*.bin
31
32fastdep:
33
34modules:
35
36modules-install:
diff --git a/arch/cris/arch-v32/boot/rescue/head.S b/arch/cris/arch-v32/boot/rescue/head.S
new file mode 100644
index 000000000000..61ede5f30f99
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/head.S
@@ -0,0 +1,39 @@
1/* $Id: head.S,v 1.4 2004/11/01 16:10:28 starvik Exp $
2 *
3 * This used to be the rescue code but now that is handled by the
4 * RedBoot based RFL instead. Nothing to see here, move along.
5 */
6
7#include <linux/config.h>
8#include <asm/arch/hwregs/reg_map_asm.h>
9#include <asm/arch/hwregs/config_defs_asm.h>
10
11 .text
12
13 ;; Start clocks for used blocks.
14 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
15 move.d [$r1], $r0
16 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
17 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
18 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
19 move.d $r0, [$r1]
20
21 ;; Copy 68KB NAND flash to Internal RAM (if NAND boot)
22 move.d 0x38004000, $r10
23 move.d 0x8000, $r11
24 move.d 0x11000, $r12
25 move.d copy_complete, $r13
26 and.d 0x000fffff, $r13
27 or.d 0x38000000, $r13
28
29#include "../../lib/nand_init.S"
30
31 ;; No NAND found
32 move.d CONFIG_ETRAX_PTABLE_SECTOR, $r10
33 jump $r10 ; Jump to decompresser
34 nop
35
36copy_complete:
37 move.d 0x38000000 + CONFIG_ETRAX_PTABLE_SECTOR, $r10
38 jump $r10 ; Jump to decompresser
39 nop
diff --git a/arch/cris/arch-v32/boot/rescue/rescue.ld b/arch/cris/arch-v32/boot/rescue/rescue.ld
new file mode 100644
index 000000000000..42b11aa122b2
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/rescue.ld
@@ -0,0 +1,20 @@
1MEMORY
2 {
3 flash : ORIGIN = 0x00000000,
4 LENGTH = 0x00100000
5 }
6
7SECTIONS
8{
9 .text :
10 {
11 stext = . ;
12 *(.text)
13 etext = . ;
14 } > flash
15 .data :
16 {
17 *(.data)
18 edata = . ;
19 } > flash
20}
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
new file mode 100644
index 000000000000..a33097f95362
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -0,0 +1,625 @@
1config ETRAX_ETHERNET
2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V32
4 select NET_ETHERNET
5 help
6 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
7 controller.
8
9config ETRAX_ETHERNET_HW_CSUM
10 bool "Hardware accelerated ethernet checksum and scatter/gather"
11 depends on ETRAX_ETHERNET
12 depends on ETRAX_STREAMCOPROC
13 default y
14 help
15 Hardware acceleration of checksumming and scatter/gather
16
17config ETRAX_ETHERNET_IFACE0
18 depends on ETRAX_ETHERNET
19 bool "Enable network interface 0"
20
21config ETRAX_ETHERNET_IFACE1
22 depends on ETRAX_ETHERNET
23 bool "Enable network interface 1 (uses DMA6 and DMA7)"
24
25choice
26 prompt "Network LED behavior"
27 depends on ETRAX_ETHERNET
28 default ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
29
30config ETRAX_NETWORK_LED_ON_WHEN_LINK
31 bool "LED_on_when_link"
32 help
33 Selecting LED_on_when_link will light the LED when there is a
34 connection and will flash off when there is activity.
35
36 Selecting LED_on_when_activity will light the LED only when
37 there is activity.
38
39 This setting will also affect the behaviour of other activity LEDs
40 e.g. Bluetooth.
41
42config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
43 bool "LED_on_when_activity"
44 help
45 Selecting LED_on_when_link will light the LED when there is a
46 connection and will flash off when there is activity.
47
48 Selecting LED_on_when_activity will light the LED only when
49 there is activity.
50
51 This setting will also affect the behaviour of other activity LEDs
52 e.g. Bluetooth.
53
54endchoice
55
56config ETRAXFS_SERIAL
57 bool "Serial-port support"
58 depends on ETRAX_ARCH_V32
59 help
60 Enables the ETRAX FS serial driver for ser0 (ttyS0)
61 You probably want this enabled.
62
63config ETRAX_SERIAL_PORT0
64 bool "Serial port 0 enabled"
65 depends on ETRAXFS_SERIAL
66 help
67 Enables the ETRAX FS serial driver for ser0 (ttyS0)
68 Normally you want this on. You can control what DMA channels to use
69 if you do not need DMA to something else.
70 ser0 can use dma4 or dma6 for output and dma5 or dma7 for input.
71
72choice
73 prompt "Ser0 DMA in channel "
74 depends on ETRAX_SERIAL_PORT0
75 default ETRAX_SERIAL_PORT0_NO_DMA_IN
76 help
77 What DMA channel to use for ser0.
78
79
80config ETRAX_SERIAL_PORT0_NO_DMA_IN
81 bool "Ser0 uses no DMA for input"
82 help
83 Do not use DMA for ser0 input.
84
85config ETRAX_SERIAL_PORT0_DMA7_IN
86 bool "Ser0 uses DMA7 for input"
87 depends on ETRAX_SERIAL_PORT0
88 help
89 Enables the DMA7 input channel for ser0 (ttyS0).
90 If you do not enable DMA, an interrupt for each character will be
91 used when receiveing data.
92 Normally you want to use DMA, unless you use the DMA channel for
93 something else.
94
95endchoice
96
97choice
98 prompt "Ser0 DMA out channel"
99 depends on ETRAX_SERIAL_PORT0
100 default ETRAX_SERIAL_PORT0_NO_DMA_OUT
101
102config ETRAX_SERIAL_PORT0_NO_DMA_OUT
103 bool "Ser0 uses no DMA for output"
104 help
105 Do not use DMA for ser0 output.
106
107config ETRAX_SERIAL_PORT0_DMA6_OUT
108 bool "Ser0 uses DMA6 for output"
109 depends on ETRAX_SERIAL_PORT0
110 help
111 Enables the DMA6 output channel for ser0 (ttyS0).
112 If you do not enable DMA, an interrupt for each character will be
113 used when transmitting data.
114 Normally you want to use DMA, unless you use the DMA channel for
115 something else.
116
117endchoice
118
119config ETRAX_SER0_DTR_BIT
120 string "Ser 0 DTR bit (empty = not used)"
121 depends on ETRAX_SERIAL_PORT0
122
123config ETRAX_SER0_RI_BIT
124 string "Ser 0 RI bit (empty = not used)"
125 depends on ETRAX_SERIAL_PORT0
126
127config ETRAX_SER0_DSR_BIT
128 string "Ser 0 DSR bit (empty = not used)"
129 depends on ETRAX_SERIAL_PORT0
130
131config ETRAX_SER0_CD_BIT
132 string "Ser 0 CD bit (empty = not used)"
133 depends on ETRAX_SERIAL_PORT0
134
135config ETRAX_SERIAL_PORT1
136 bool "Serial port 1 enabled"
137 depends on ETRAXFS_SERIAL
138 help
139 Enables the ETRAX FS serial driver for ser1 (ttyS1).
140
141choice
142 prompt "Ser1 DMA in channel "
143 depends on ETRAX_SERIAL_PORT1
144 default ETRAX_SERIAL_PORT1_NO_DMA_IN
145 help
146 What DMA channel to use for ser1.
147
148
149config ETRAX_SERIAL_PORT1_NO_DMA_IN
150 bool "Ser1 uses no DMA for input"
151 help
152 Do not use DMA for ser1 input.
153
154config ETRAX_SERIAL_PORT1_DMA5_IN
155 bool "Ser1 uses DMA5 for input"
156 depends on ETRAX_SERIAL_PORT1
157 help
158 Enables the DMA5 input channel for ser1 (ttyS1).
159 If you do not enable DMA, an interrupt for each character will be
160 used when receiveing data.
161 Normally you want this on, unless you use the DMA channel for
162 something else.
163
164endchoice
165
166choice
167 prompt "Ser1 DMA out channel "
168 depends on ETRAX_SERIAL_PORT1
169 default ETRAX_SERIAL_PORT1_NO_DMA_OUT
170 help
171 What DMA channel to use for ser1.
172
173config ETRAX_SERIAL_PORT1_NO_DMA_OUT
174 bool "Ser1 uses no DMA for output"
175 help
176 Do not use DMA for ser1 output.
177
178config ETRAX_SERIAL_PORT1_DMA4_OUT
179 bool "Ser1 uses DMA4 for output"
180 depends on ETRAX_SERIAL_PORT1
181 help
182 Enables the DMA4 output channel for ser1 (ttyS1).
183 If you do not enable DMA, an interrupt for each character will be
184 used when transmitting data.
185 Normally you want this on, unless you use the DMA channel for
186 something else.
187
188endchoice
189
190config ETRAX_SER1_DTR_BIT
191 string "Ser 1 DTR bit (empty = not used)"
192 depends on ETRAX_SERIAL_PORT1
193
194config ETRAX_SER1_RI_BIT
195 string "Ser 1 RI bit (empty = not used)"
196 depends on ETRAX_SERIAL_PORT1
197
198config ETRAX_SER1_DSR_BIT
199 string "Ser 1 DSR bit (empty = not used)"
200 depends on ETRAX_SERIAL_PORT1
201
202config ETRAX_SER1_CD_BIT
203 string "Ser 1 CD bit (empty = not used)"
204 depends on ETRAX_SERIAL_PORT1
205
206config ETRAX_SERIAL_PORT2
207 bool "Serial port 2 enabled"
208 depends on ETRAXFS_SERIAL
209 help
210 Enables the ETRAX FS serial driver for ser2 (ttyS2).
211
212choice
213 prompt "Ser2 DMA in channel "
214 depends on ETRAX_SERIAL_PORT2
215 default ETRAX_SERIAL_PORT2_NO_DMA_IN
216 help
217 What DMA channel to use for ser2.
218
219
220config ETRAX_SERIAL_PORT2_NO_DMA_IN
221 bool "Ser2 uses no DMA for input"
222 help
223 Do not use DMA for ser2 input.
224
225config ETRAX_SERIAL_PORT2_DMA3_IN
226 bool "Ser2 uses DMA3 for input"
227 depends on ETRAX_SERIAL_PORT2
228 help
229 Enables the DMA3 input channel for ser2 (ttyS2).
230 If you do not enable DMA, an interrupt for each character will be
231 used when receiveing data.
232 Normally you want to use DMA, unless you use the DMA channel for
233 something else.
234
235endchoice
236
237choice
238 prompt "Ser2 DMA out channel"
239 depends on ETRAX_SERIAL_PORT2
240 default ETRAX_SERIAL_PORT2_NO_DMA_OUT
241
242config ETRAX_SERIAL_PORT2_NO_DMA_OUT
243 bool "Ser2 uses no DMA for output"
244 help
245 Do not use DMA for ser2 output.
246
247config ETRAX_SERIAL_PORT2_DMA2_OUT
248 bool "Ser2 uses DMA2 for output"
249 depends on ETRAX_SERIAL_PORT2
250 help
251 Enables the DMA2 output channel for ser2 (ttyS2).
252 If you do not enable DMA, an interrupt for each character will be
253 used when transmitting data.
254 Normally you want to use DMA, unless you use the DMA channel for
255 something else.
256
257endchoice
258
259config ETRAX_SER2_DTR_BIT
260 string "Ser 2 DTR bit (empty = not used)"
261 depends on ETRAX_SERIAL_PORT2
262
263config ETRAX_SER2_RI_BIT
264 string "Ser 2 RI bit (empty = not used)"
265 depends on ETRAX_SERIAL_PORT2
266
267config ETRAX_SER2_DSR_BIT
268 string "Ser 2 DSR bit (empty = not used)"
269 depends on ETRAX_SERIAL_PORT2
270
271config ETRAX_SER2_CD_BIT
272 string "Ser 2 CD bit (empty = not used)"
273 depends on ETRAX_SERIAL_PORT2
274
275config ETRAX_SERIAL_PORT3
276 bool "Serial port 3 enabled"
277 depends on ETRAXFS_SERIAL
278 help
279 Enables the ETRAX FS serial driver for ser3 (ttyS3).
280
281choice
282 prompt "Ser3 DMA in channel "
283 depends on ETRAX_SERIAL_PORT3
284 default ETRAX_SERIAL_PORT3_NO_DMA_IN
285 help
286 What DMA channel to use for ser3.
287
288
289config ETRAX_SERIAL_PORT3_NO_DMA_IN
290 bool "Ser3 uses no DMA for input"
291 help
292 Do not use DMA for ser3 input.
293
294config ETRAX_SERIAL_PORT3_DMA9_IN
295 bool "Ser3 uses DMA9 for input"
296 depends on ETRAX_SERIAL_PORT3
297 help
298 Enables the DMA9 input channel for ser3 (ttyS3).
299 If you do not enable DMA, an interrupt for each character will be
300 used when receiveing data.
301 Normally you want to use DMA, unless you use the DMA channel for
302 something else.
303
304endchoice
305
306choice
307 prompt "Ser3 DMA out channel"
308 depends on ETRAX_SERIAL_PORT3
309 default ETRAX_SERIAL_PORT3_NO_DMA_OUT
310
311config ETRAX_SERIAL_PORT3_NO_DMA_OUT
312 bool "Ser3 uses no DMA for output"
313 help
314 Do not use DMA for ser3 output.
315
316config ETRAX_SERIAL_PORT3_DMA8_OUT
317 bool "Ser3 uses DMA8 for output"
318 depends on ETRAX_SERIAL_PORT3
319 help
320 Enables the DMA8 output channel for ser3 (ttyS3).
321 If you do not enable DMA, an interrupt for each character will be
322 used when transmitting data.
323 Normally you want to use DMA, unless you use the DMA channel for
324 something else.
325
326endchoice
327
328config ETRAX_SER3_DTR_BIT
329 string "Ser 3 DTR bit (empty = not used)"
330 depends on ETRAX_SERIAL_PORT3
331
332config ETRAX_SER3_RI_BIT
333 string "Ser 3 RI bit (empty = not used)"
334 depends on ETRAX_SERIAL_PORT3
335
336config ETRAX_SER3_DSR_BIT
337 string "Ser 3 DSR bit (empty = not used)"
338 depends on ETRAX_SERIAL_PORT3
339
340config ETRAX_SER3_CD_BIT
341 string "Ser 3 CD bit (empty = not used)"
342 depends on ETRAX_SERIAL_PORT3
343
344config ETRAX_RS485
345 bool "RS-485 support"
346 depends on ETRAX_SERIAL
347 help
348 Enables support for RS-485 serial communication. For a primer on
349 RS-485, see <http://www.hw.cz/english/docs/rs485/rs485.html>.
350
351config ETRAX_RS485_DISABLE_RECEIVER
352 bool "Disable serial receiver"
353 depends on ETRAX_RS485
354 help
355 It is necessary to disable the serial receiver to avoid serial
356 loopback. Not all products are able to do this in software only.
357 Axis 2400/2401 must disable receiver.
358
359config ETRAX_AXISFLASHMAP
360 bool "Axis flash-map support"
361 depends on ETRAX_ARCH_V32
362 select MTD
363 select MTD_CFI
364 select MTD_CFI_AMDSTD
365 select MTD_OBSOLETE_CHIPS
366 select MTD_AMDSTD
367 select MTD_CHAR
368 select MTD_BLOCK
369 select MTD_PARTITIONS
370 select MTD_CONCAT
371 select MTD_COMPLEX_MAPPINGS
372 help
373 This option enables MTD mapping of flash devices. Needed to use
374 flash memories. If unsure, say Y.
375
376config ETRAX_SYNCHRONOUS_SERIAL
377 bool "Synchronous serial-port support"
378 depends on ETRAX_ARCH_V32
379 help
380 Enables the ETRAX FS synchronous serial driver.
381
382config ETRAX_SYNCHRONOUS_SERIAL_PORT0
383 bool "Synchronous serial port 0 enabled"
384 depends on ETRAX_SYNCHRONOUS_SERIAL
385 help
386 Enabled synchronous serial port 0.
387
388config ETRAX_SYNCHRONOUS_SERIAL0_DMA
389 bool "Enable DMA on synchronous serial port 0."
390 depends on ETRAX_SYNCHRONOUS_SERIAL_PORT0
391 help
392 A synchronous serial port can run in manual or DMA mode.
393 Selecting this option will make it run in DMA mode.
394
395config ETRAX_SYNCHRONOUS_SERIAL_PORT1
396 bool "Synchronous serial port 1 enabled"
397 depends on ETRAX_SYNCHRONOUS_SERIAL
398 help
399 Enabled synchronous serial port 1.
400
401config ETRAX_SYNCHRONOUS_SERIAL1_DMA
402 bool "Enable DMA on synchronous serial port 1."
403 depends on ETRAX_SYNCHRONOUS_SERIAL_PORT1
404 help
405 A synchronous serial port can run in manual or DMA mode.
406 Selecting this option will make it run in DMA mode.
407
408config ETRAX_PTABLE_SECTOR
409 int "Byte-offset of partition table sector"
410 depends on ETRAX_AXISFLASHMAP
411 default "65536"
412 help
413 Byte-offset of the partition table in the first flash chip.
414 The default value is 64kB and should not be changed unless
415 you know exactly what you are doing. The only valid reason
416 for changing this is when the flash block size is bigger
417 than 64kB (e.g. when using two parallel 16 bit flashes).
418
419config ETRAX_NANDFLASH
420 bool "NAND flash support"
421 depends on ETRAX_ARCH_V32
422 select MTD_NAND
423 select MTD_NAND_IDS
424 help
425 This option enables MTD mapping of NAND flash devices. Needed to use
426 NAND flash memories. If unsure, say Y.
427
428config ETRAX_I2C
429 bool "I2C driver"
430 depends on ETRAX_ARCH_V32
431 help
432 This option enabled the I2C driver used by e.g. the RTC driver.
433
434config ETRAX_I2C_DATA_PORT
435 string "I2C data pin"
436 depends on ETRAX_I2C
437 help
438 The pin to use for I2C data.
439
440config ETRAX_I2C_CLK_PORT
441 string "I2C clock pin"
442 depends on ETRAX_I2C
443 help
444 The pin to use for I2C clock.
445
446config ETRAX_RTC
447 bool "Real Time Clock support"
448 depends on ETRAX_ARCH_V32
449 help
450 Enabled RTC support.
451
452choice
453 prompt "RTC chip"
454 depends on ETRAX_RTC
455 default ETRAX_PCF8563
456
457config ETRAX_PCF8563
458 bool "PCF8563"
459 help
460 Philips PCF8563 RTC
461
462endchoice
463
464config ETRAX_GPIO
465 bool "GPIO support"
466 depends on ETRAX_ARCH_V32
467 ---help---
468 Enables the ETRAX general port device (major 120, minors 0-4).
469 You can use this driver to access the general port bits. It supports
470 these ioctl's:
471 #include <linux/etraxgpio.h>
472 fd = open("/dev/gpioa", O_RDWR); // or /dev/gpiob
473 ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_SETBITS), bits_to_set);
474 ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS), bits_to_clear);
475 err = ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_READ_INBITS), &val);
476 Remember that you need to setup the port directions appropriately in
477 the General configuration.
478
479config ETRAX_PA_BUTTON_BITMASK
480 hex "PA-buttons bitmask"
481 depends on ETRAX_GPIO
482 default "0x02"
483 help
484 This is a bitmask (8 bits) with information about what bits on PA
485 that are used for buttons.
486 Most products has a so called TEST button on PA1, if that is true
487 use 0x02 here.
488 Use 00 if there are no buttons on PA.
489 If the bitmask is <> 00 a button driver will be included in the gpio
490 driver. ETRAX general I/O support must be enabled.
491
492config ETRAX_PA_CHANGEABLE_DIR
493 hex "PA user changeable dir mask"
494 depends on ETRAX_GPIO
495 default "0x00"
496 help
497 This is a bitmask (8 bits) with information of what bits in PA that a
498 user can change direction on using ioctl's.
499 Bit set = changeable.
500 You probably want 0x00 here, but it depends on your hardware.
501
502config ETRAX_PA_CHANGEABLE_BITS
503 hex "PA user changeable bits mask"
504 depends on ETRAX_GPIO
505 default "0x00"
506 help
507 This is a bitmask (8 bits) with information of what bits in PA
508 that a user can change the value on using ioctl's.
509 Bit set = changeable.
510
511config ETRAX_PB_CHANGEABLE_DIR
512 hex "PB user changeable dir mask"
513 depends on ETRAX_GPIO
514 default "0x00000"
515 help
516 This is a bitmask (18 bits) with information of what bits in PB
517 that a user can change direction on using ioctl's.
518 Bit set = changeable.
519 You probably want 0x00000 here, but it depends on your hardware.
520
521config ETRAX_PB_CHANGEABLE_BITS
522 hex "PB user changeable bits mask"
523 depends on ETRAX_GPIO
524 default "0x00000"
525 help
526 This is a bitmask (18 bits) with information of what bits in PB
527 that a user can change the value on using ioctl's.
528 Bit set = changeable.
529
530config ETRAX_PC_CHANGEABLE_DIR
531 hex "PC user changeable dir mask"
532 depends on ETRAX_GPIO
533 default "0x00000"
534 help
535 This is a bitmask (18 bits) with information of what bits in PC
536 that a user can change direction on using ioctl's.
537 Bit set = changeable.
538 You probably want 0x00000 here, but it depends on your hardware.
539
540config ETRAX_PC_CHANGEABLE_BITS
541 hex "PC user changeable bits mask"
542 depends on ETRAX_GPIO
543 default "0x00000"
544 help
545 This is a bitmask (18 bits) with information of what bits in PC
546 that a user can change the value on using ioctl's.
547 Bit set = changeable.
548
549config ETRAX_PD_CHANGEABLE_DIR
550 hex "PD user changeable dir mask"
551 depends on ETRAX_GPIO
552 default "0x00000"
553 help
554 This is a bitmask (18 bits) with information of what bits in PD
555 that a user can change direction on using ioctl's.
556 Bit set = changeable.
557 You probably want 0x00000 here, but it depends on your hardware.
558
559config ETRAX_PD_CHANGEABLE_BITS
560 hex "PD user changeable bits mask"
561 depends on ETRAX_GPIO
562 default "0x00000"
563 help
564 This is a bitmask (18 bits) with information of what bits in PD
565 that a user can change the value on using ioctl's.
566 Bit set = changeable.
567
568config ETRAX_PE_CHANGEABLE_DIR
569 hex "PE user changeable dir mask"
570 depends on ETRAX_GPIO
571 default "0x00000"
572 help
573 This is a bitmask (18 bits) with information of what bits in PE
574 that a user can change direction on using ioctl's.
575 Bit set = changeable.
576 You probably want 0x00000 here, but it depends on your hardware.
577
578config ETRAX_PE_CHANGEABLE_BITS
579 hex "PE user changeable bits mask"
580 depends on ETRAX_GPIO
581 default "0x00000"
582 help
583 This is a bitmask (18 bits) with information of what bits in PE
584 that a user can change the value on using ioctl's.
585 Bit set = changeable.
586
587config ETRAX_IDE
588 bool "ATA/IDE support"
589 depends on ETRAX_ARCH_V32
590 select IDE
591 select BLK_DEV_IDE
592 select BLK_DEV_IDEDISK
593 select BLK_DEV_IDECD
594 select BLK_DEV_IDEDMA
595 help
596 Enables the ETRAX IDE driver.
597
598config ETRAX_CARDBUS
599 bool "Cardbus support"
600 depends on ETRAX_ARCH_V32
601 select PCCARD
602 select CARDBUS
603 select HOTPLUG
604 select PCCARD_NONSTATIC
605 help
606 Enabled the ETRAX Carbus driver.
607
608config PCI
609 bool
610 depends on ETRAX_CARDBUS
611 default y
612
613config ETRAX_IOP_FW_LOAD
614 tristate "IO-processor hotplug firmware loading support"
615 depends on ETRAX_ARCH_V32
616 select FW_LOADER
617 help
618 Enables IO-processor hotplug firmware loading support.
619
620config ETRAX_STREAMCOPROC
621 tristate "Stream co-processor driver enabled"
622 depends on ETRAX_ARCH_V32
623 help
624 This option enables a driver for the stream co-processor
625 for cryptographic operations.
diff --git a/arch/cris/arch-v32/drivers/Makefile b/arch/cris/arch-v32/drivers/Makefile
new file mode 100644
index 000000000000..a359cd20ae75
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/Makefile
@@ -0,0 +1,13 @@
1#
2# Makefile for Etrax-specific drivers
3#
4
5obj-$(CONFIG_ETRAX_STREAMCOPROC) += cryptocop.o
6obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
7obj-$(CONFIG_ETRAX_NANDFLASH) += nandflash.o
8obj-$(CONFIG_ETRAX_GPIO) += gpio.o
9obj-$(CONFIG_ETRAX_IOP_FW_LOAD) += iop_fw_load.o
10obj-$(CONFIG_ETRAX_PCF8563) += pcf8563.o
11obj-$(CONFIG_ETRAX_I2C) += i2c.o
12obj-$(CONFIG_ETRAX_SYNCHRONOUS_SERIAL) += sync_serial.o
13obj-$(CONFIG_PCI) += pci/
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
new file mode 100644
index 000000000000..78ed52b1cdac
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -0,0 +1,455 @@
1/*
2 * Physical mapping layer for MTD using the Axis partitiontable format
3 *
4 * Copyright (c) 2001, 2002, 2003 Axis Communications AB
5 *
6 * This file is under the GPL.
7 *
8 * First partition is always sector 0 regardless of if we find a partitiontable
9 * or not. In the start of the next sector, there can be a partitiontable that
10 * tells us what other partitions to define. If there isn't, we use a default
11 * partition split defined below.
12 *
13 * Copy of os/lx25/arch/cris/arch-v10/drivers/axisflashmap.c 1.5
14 * with minor changes.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/types.h>
20#include <linux/kernel.h>
21#include <linux/config.h>
22#include <linux/init.h>
23
24#include <linux/mtd/concat.h>
25#include <linux/mtd/map.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/mtdram.h>
28#include <linux/mtd/partitions.h>
29
30#include <asm/arch/hwregs/config_defs.h>
31#include <asm/axisflashmap.h>
32#include <asm/mmu.h>
33
34#define MEM_CSE0_SIZE (0x04000000)
35#define MEM_CSE1_SIZE (0x04000000)
36
37#define FLASH_UNCACHED_ADDR KSEG_E
38#define FLASH_CACHED_ADDR KSEG_F
39
40#if CONFIG_ETRAX_FLASH_BUSWIDTH==1
41#define flash_data __u8
42#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2
43#define flash_data __u16
44#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4
45#define flash_data __u16
46#endif
47
48/* From head.S */
49extern unsigned long romfs_start, romfs_length, romfs_in_flash;
50
51/* The master mtd for the entire flash. */
52struct mtd_info* axisflash_mtd = NULL;
53
54/* Map driver functions. */
55
56static map_word flash_read(struct map_info *map, unsigned long ofs)
57{
58 map_word tmp;
59 tmp.x[0] = *(flash_data *)(map->map_priv_1 + ofs);
60 return tmp;
61}
62
63static void flash_copy_from(struct map_info *map, void *to,
64 unsigned long from, ssize_t len)
65{
66 memcpy(to, (void *)(map->map_priv_1 + from), len);
67}
68
69static void flash_write(struct map_info *map, map_word d, unsigned long adr)
70{
71 *(flash_data *)(map->map_priv_1 + adr) = (flash_data)d.x[0];
72}
73
74/*
75 * The map for chip select e0.
76 *
77 * We run into tricky coherence situations if we mix cached with uncached
78 * accesses to we only use the uncached version here.
79 *
80 * The size field is the total size where the flash chips may be mapped on the
81 * chip select. MTD probes should find all devices there and it does not matter
82 * if there are unmapped gaps or aliases (mirrors of flash devices). The MTD
83 * probes will ignore them.
84 *
85 * The start address in map_priv_1 is in virtual memory so we cannot use
86 * MEM_CSE0_START but must rely on that FLASH_UNCACHED_ADDR is the start
87 * address of cse0.
88 */
89static struct map_info map_cse0 = {
90 .name = "cse0",
91 .size = MEM_CSE0_SIZE,
92 .bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
93 .read = flash_read,
94 .copy_from = flash_copy_from,
95 .write = flash_write,
96 .map_priv_1 = FLASH_UNCACHED_ADDR
97};
98
99/*
100 * The map for chip select e1.
101 *
102 * If there was a gap between cse0 and cse1, map_priv_1 would get the wrong
103 * address, but there isn't.
104 */
105static struct map_info map_cse1 = {
106 .name = "cse1",
107 .size = MEM_CSE1_SIZE,
108 .bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
109 .read = flash_read,
110 .copy_from = flash_copy_from,
111 .write = flash_write,
112 .map_priv_1 = FLASH_UNCACHED_ADDR + MEM_CSE0_SIZE
113};
114
115/* If no partition-table was found, we use this default-set. */
116#define MAX_PARTITIONS 7
117#define NUM_DEFAULT_PARTITIONS 3
118
119/*
120 * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the
121 * size of one flash block and "filesystem"-partition needs 5 blocks to be able
122 * to use JFFS.
123 */
124static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = {
125 {
126 .name = "boot firmware",
127 .size = CONFIG_ETRAX_PTABLE_SECTOR,
128 .offset = 0
129 },
130 {
131 .name = "kernel",
132 .size = 0x200000 - (6 * CONFIG_ETRAX_PTABLE_SECTOR),
133 .offset = CONFIG_ETRAX_PTABLE_SECTOR
134 },
135 {
136 .name = "filesystem",
137 .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR,
138 .offset = 0x200000 - (5 * CONFIG_ETRAX_PTABLE_SECTOR)
139 }
140};
141
142/* Initialize the ones normally used. */
143static struct mtd_partition axis_partitions[MAX_PARTITIONS] = {
144 {
145 .name = "part0",
146 .size = CONFIG_ETRAX_PTABLE_SECTOR,
147 .offset = 0
148 },
149 {
150 .name = "part1",
151 .size = 0,
152 .offset = 0
153 },
154 {
155 .name = "part2",
156 .size = 0,
157 .offset = 0
158 },
159 {
160 .name = "part3",
161 .size = 0,
162 .offset = 0
163 },
164 {
165 .name = "part4",
166 .size = 0,
167 .offset = 0
168 },
169 {
170 .name = "part5",
171 .size = 0,
172 .offset = 0
173 },
174 {
175 .name = "part6",
176 .size = 0,
177 .offset = 0
178 },
179};
180
181/*
182 * Probe a chip select for AMD-compatible (JEDEC) or CFI-compatible flash
183 * chips in that order (because the amd_flash-driver is faster).
184 */
185static struct mtd_info *probe_cs(struct map_info *map_cs)
186{
187 struct mtd_info *mtd_cs = NULL;
188
189 printk(KERN_INFO
190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
191 map_cs->name, map_cs->size, map_cs->map_priv_1);
192
193#ifdef CONFIG_MTD_AMDSTD
194 mtd_cs = do_map_probe("amd_flash", map_cs);
195#endif
196#ifdef CONFIG_MTD_CFI
197 if (!mtd_cs) {
198 mtd_cs = do_map_probe("cfi_probe", map_cs);
199 }
200#endif
201
202 return mtd_cs;
203}
204
205/*
206 * Probe each chip select individually for flash chips. If there are chips on
207 * both cse0 and cse1, the mtd_info structs will be concatenated to one struct
208 * so that MTD partitions can cross chip boundries.
209 *
210 * The only known restriction to how you can mount your chips is that each
211 * chip select must hold similar flash chips. But you need external hardware
212 * to do that anyway and you can put totally different chips on cse0 and cse1
213 * so it isn't really much of a restriction.
214 */
215extern struct mtd_info* __init crisv32_nand_flash_probe (void);
216static struct mtd_info *flash_probe(void)
217{
218 struct mtd_info *mtd_cse0;
219 struct mtd_info *mtd_cse1;
220 struct mtd_info *mtd_nand = NULL;
221 struct mtd_info *mtd_total;
222 struct mtd_info *mtds[3];
223 int count = 0;
224
225 if ((mtd_cse0 = probe_cs(&map_cse0)) != NULL)
226 mtds[count++] = mtd_cse0;
227 if ((mtd_cse1 = probe_cs(&map_cse1)) != NULL)
228 mtds[count++] = mtd_cse1;
229
230#ifdef CONFIG_ETRAX_NANDFLASH
231 if ((mtd_nand = crisv32_nand_flash_probe()) != NULL)
232 mtds[count++] = mtd_nand;
233#endif
234
235 if (!mtd_cse0 && !mtd_cse1 && !mtd_nand) {
236 /* No chip found. */
237 return NULL;
238 }
239
240 if (count > 1) {
241#ifdef CONFIG_MTD_CONCAT
242 /* Since the concatenation layer adds a small overhead we
243 * could try to figure out if the chips in cse0 and cse1 are
244 * identical and reprobe the whole cse0+cse1 window. But since
245 * flash chips are slow, the overhead is relatively small.
246 * So we use the MTD concatenation layer instead of further
247 * complicating the probing procedure.
248 */
249 mtd_total = mtd_concat_create(mtds,
250 count,
251 "cse0+cse1+nand");
252#else
253 printk(KERN_ERR "%s and %s: Cannot concatenate due to kernel "
254 "(mis)configuration!\n", map_cse0.name, map_cse1.name);
255 mtd_toal = NULL;
256#endif
257 if (!mtd_total) {
258 printk(KERN_ERR "%s and %s: Concatenation failed!\n",
259 map_cse0.name, map_cse1.name);
260
261 /* The best we can do now is to only use what we found
262 * at cse0.
263 */
264 mtd_total = mtd_cse0;
265 map_destroy(mtd_cse1);
266 }
267 } else {
268 mtd_total = mtd_cse0? mtd_cse0 : mtd_cse1 ? mtd_cse1 : mtd_nand;
269
270 }
271
272 return mtd_total;
273}
274
275extern unsigned long crisv32_nand_boot;
276extern unsigned long crisv32_nand_cramfs_offset;
277
278/*
279 * Probe the flash chip(s) and, if it succeeds, read the partition-table
280 * and register the partitions with MTD.
281 */
282static int __init init_axis_flash(void)
283{
284 struct mtd_info *mymtd;
285 int err = 0;
286 int pidx = 0;
287 struct partitiontable_head *ptable_head = NULL;
288 struct partitiontable_entry *ptable;
289 int use_default_ptable = 1; /* Until proven otherwise. */
290 const char *pmsg = KERN_INFO " /dev/flash%d at 0x%08x, size 0x%08x\n";
291 static char page[512];
292 size_t len;
293
294#ifndef CONFIG_ETRAXFS_SIM
295 mymtd = flash_probe();
296 mymtd->read(mymtd, CONFIG_ETRAX_PTABLE_SECTOR, 512, &len, page);
297 ptable_head = (struct partitiontable_head *)(page + PARTITION_TABLE_OFFSET);
298
299 if (!mymtd) {
300 /* There's no reason to use this module if no flash chip can
301 * be identified. Make sure that's understood.
302 */
303 printk(KERN_INFO "axisflashmap: Found no flash chip.\n");
304 } else {
305 printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n",
306 mymtd->name, mymtd->size);
307 axisflash_mtd = mymtd;
308 }
309
310 if (mymtd) {
311 mymtd->owner = THIS_MODULE;
312 }
313 pidx++; /* First partition is always set to the default. */
314
315 if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC)
316 && (ptable_head->size <
317 (MAX_PARTITIONS * sizeof(struct partitiontable_entry) +
318 PARTITIONTABLE_END_MARKER_SIZE))
319 && (*(unsigned long*)((void*)ptable_head + sizeof(*ptable_head) +
320 ptable_head->size -
321 PARTITIONTABLE_END_MARKER_SIZE)
322 == PARTITIONTABLE_END_MARKER)) {
323 /* Looks like a start, sane length and end of a
324 * partition table, lets check csum etc.
325 */
326 int ptable_ok = 0;
327 struct partitiontable_entry *max_addr =
328 (struct partitiontable_entry *)
329 ((unsigned long)ptable_head + sizeof(*ptable_head) +
330 ptable_head->size);
331 unsigned long offset = CONFIG_ETRAX_PTABLE_SECTOR;
332 unsigned char *p;
333 unsigned long csum = 0;
334
335 ptable = (struct partitiontable_entry *)
336 ((unsigned long)ptable_head + sizeof(*ptable_head));
337
338 /* Lets be PARANOID, and check the checksum. */
339 p = (unsigned char*) ptable;
340
341 while (p <= (unsigned char*)max_addr) {
342 csum += *p++;
343 csum += *p++;
344 csum += *p++;
345 csum += *p++;
346 }
347 ptable_ok = (csum == ptable_head->checksum);
348
349 /* Read the entries and use/show the info. */
350 printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n",
351 (ptable_ok ? " valid" : "n invalid"), ptable_head,
352 max_addr);
353
354 /* We have found a working bootblock. Now read the
355 * partition table. Scan the table. It ends when
356 * there is 0xffffffff, that is, empty flash.
357 */
358 while (ptable_ok
359 && ptable->offset != 0xffffffff
360 && ptable < max_addr
361 && pidx < MAX_PARTITIONS) {
362
363 axis_partitions[pidx].offset = offset + ptable->offset + (crisv32_nand_boot ? 16384 : 0);
364 axis_partitions[pidx].size = ptable->size;
365
366 printk(pmsg, pidx, axis_partitions[pidx].offset,
367 axis_partitions[pidx].size);
368 pidx++;
369 ptable++;
370 }
371 use_default_ptable = !ptable_ok;
372 }
373
374 if (romfs_in_flash) {
375 /* Add an overlapping device for the root partition (romfs). */
376
377 axis_partitions[pidx].name = "romfs";
378 if (crisv32_nand_boot) {
379 char* data = kmalloc(1024, GFP_KERNEL);
380 int len;
381 int offset = crisv32_nand_cramfs_offset & ~(1024-1);
382 char* tmp;
383
384 mymtd->read(mymtd, offset, 1024, &len, data);
385 tmp = &data[crisv32_nand_cramfs_offset % 512];
386 axis_partitions[pidx].size = *(unsigned*)(tmp + 4);
387 axis_partitions[pidx].offset = crisv32_nand_cramfs_offset;
388 kfree(data);
389 } else {
390 axis_partitions[pidx].size = romfs_length;
391 axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR;
392 }
393
394 axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
395
396 printk(KERN_INFO
397 " Adding readonly flash partition for romfs image:\n");
398 printk(pmsg, pidx, axis_partitions[pidx].offset,
399 axis_partitions[pidx].size);
400 pidx++;
401 }
402
403 if (mymtd) {
404 if (use_default_ptable) {
405 printk(KERN_INFO " Using default partition table.\n");
406 err = add_mtd_partitions(mymtd, axis_default_partitions,
407 NUM_DEFAULT_PARTITIONS);
408 } else {
409 err = add_mtd_partitions(mymtd, axis_partitions, pidx);
410 }
411
412 if (err) {
413 panic("axisflashmap could not add MTD partitions!\n");
414 }
415 }
416/* CONFIG_EXTRAXFS_SIM */
417#endif
418
419 if (!romfs_in_flash) {
420 /* Create an RAM device for the root partition (romfs). */
421
422#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0) || (CONFIG_MTDRAM_ABS_POS != 0)
423 /* No use trying to boot this kernel from RAM. Panic! */
424 printk(KERN_EMERG "axisflashmap: Cannot create an MTD RAM "
425 "device due to kernel (mis)configuration!\n");
426 panic("This kernel cannot boot from RAM!\n");
427#else
428 struct mtd_info *mtd_ram;
429
430 mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info),
431 GFP_KERNEL);
432 if (!mtd_ram) {
433 panic("axisflashmap couldn't allocate memory for "
434 "mtd_info!\n");
435 }
436
437 printk(KERN_INFO " Adding RAM partition for romfs image:\n");
438 printk(pmsg, pidx, romfs_start, romfs_length);
439
440 err = mtdram_init_device(mtd_ram, (void*)romfs_start,
441 romfs_length, "romfs");
442 if (err) {
443 panic("axisflashmap could not initialize MTD RAM "
444 "device!\n");
445 }
446#endif
447 }
448
449 return err;
450}
451
452/* This adds the above to the kernels init-call chain. */
453module_init(init_axis_flash);
454
455EXPORT_SYMBOL(axisflash_mtd);
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
new file mode 100644
index 000000000000..ca72076c630a
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -0,0 +1,3522 @@
1/* $Id: cryptocop.c,v 1.13 2005/04/21 17:27:55 henriken Exp $
2 *
3 * Stream co-processor driver for the ETRAX FS
4 *
5 * Copyright (C) 2003-2005 Axis Communications AB
6 */
7
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/module.h>
11#include <linux/slab.h>
12#include <linux/string.h>
13#include <linux/fs.h>
14#include <linux/mm.h>
15#include <linux/spinlock.h>
16#include <linux/stddef.h>
17
18#include <asm/uaccess.h>
19#include <asm/io.h>
20#include <asm/atomic.h>
21
22#include <linux/list.h>
23#include <linux/interrupt.h>
24
25#include <asm/signal.h>
26#include <asm/irq.h>
27
28#include <asm/arch/dma.h>
29#include <asm/arch/hwregs/dma.h>
30#include <asm/arch/hwregs/reg_map.h>
31#include <asm/arch/hwregs/reg_rdwr.h>
32#include <asm/arch/hwregs/intr_vect_defs.h>
33
34#include <asm/arch/hwregs/strcop.h>
35#include <asm/arch/hwregs/strcop_defs.h>
36#include <asm/arch/cryptocop.h>
37
38
39
40#define DESCR_ALLOC_PAD (31)
41
42struct cryptocop_dma_desc {
43 char *free_buf; /* If non-null will be kfreed in free_cdesc() */
44 dma_descr_data *dma_descr;
45
46 unsigned char dma_descr_buf[sizeof(dma_descr_data) + DESCR_ALLOC_PAD];
47
48 unsigned int from_pool:1; /* If 1 'allocated' from the descriptor pool. */
49 struct cryptocop_dma_desc *next;
50};
51
52
53struct cryptocop_int_operation{
54 void *alloc_ptr;
55 cryptocop_session_id sid;
56
57 dma_descr_context ctx_out;
58 dma_descr_context ctx_in;
59
60 /* DMA descriptors allocated by driver. */
61 struct cryptocop_dma_desc *cdesc_out;
62 struct cryptocop_dma_desc *cdesc_in;
63
64 /* Strcop config to use. */
65 cryptocop_3des_mode tdes_mode;
66 cryptocop_csum_type csum_mode;
67
68 /* DMA descrs provided by consumer. */
69 dma_descr_data *ddesc_out;
70 dma_descr_data *ddesc_in;
71};
72
73
74struct cryptocop_tfrm_ctx {
75 cryptocop_tfrm_id tid;
76 unsigned int blocklength;
77
78 unsigned int start_ix;
79
80 struct cryptocop_tfrm_cfg *tcfg;
81 struct cryptocop_transform_ctx *tctx;
82
83 unsigned char previous_src;
84 unsigned char current_src;
85
86 /* Values to use in metadata out. */
87 unsigned char hash_conf;
88 unsigned char hash_mode;
89 unsigned char ciph_conf;
90 unsigned char cbcmode;
91 unsigned char decrypt;
92
93 unsigned int requires_padding:1;
94 unsigned int strict_block_length:1;
95 unsigned int active:1;
96 unsigned int done:1;
97 size_t consumed;
98 size_t produced;
99
100 /* Pad (input) descriptors to put in the DMA out list when the transform
101 * output is put on the DMA in list. */
102 struct cryptocop_dma_desc *pad_descs;
103
104 struct cryptocop_tfrm_ctx *prev_src;
105 struct cryptocop_tfrm_ctx *curr_src;
106
107 /* Mapping to HW. */
108 unsigned char unit_no;
109};
110
111
112struct cryptocop_private{
113 cryptocop_session_id sid;
114 struct cryptocop_private *next;
115};
116
117/* Session list. */
118
119struct cryptocop_transform_ctx{
120 struct cryptocop_transform_init init;
121 unsigned char dec_key[CRYPTOCOP_MAX_KEY_LENGTH];
122 unsigned int dec_key_set:1;
123
124 struct cryptocop_transform_ctx *next;
125};
126
127
128struct cryptocop_session{
129 cryptocop_session_id sid;
130
131 struct cryptocop_transform_ctx *tfrm_ctx;
132
133 struct cryptocop_session *next;
134};
135
136/* Priority levels for jobs sent to the cryptocop. Checksum operations from
137 kernel have highest priority since TCPIP stack processing must not
138 be a bottleneck. */
139typedef enum {
140 cryptocop_prio_kernel_csum = 0,
141 cryptocop_prio_kernel = 1,
142 cryptocop_prio_user = 2,
143 cryptocop_prio_no_prios = 3
144} cryptocop_queue_priority;
145
146struct cryptocop_prio_queue{
147 struct list_head jobs;
148 cryptocop_queue_priority prio;
149};
150
151struct cryptocop_prio_job{
152 struct list_head node;
153 cryptocop_queue_priority prio;
154
155 struct cryptocop_operation *oper;
156 struct cryptocop_int_operation *iop;
157};
158
159struct ioctl_job_cb_ctx {
160 unsigned int processed:1;
161};
162
163
164static struct cryptocop_session *cryptocop_sessions = NULL;
165spinlock_t cryptocop_sessions_lock;
166
167/* Next Session ID to assign. */
168static cryptocop_session_id next_sid = 1;
169
170/* Pad for checksum. */
171static const char csum_zero_pad[1] = {0x00};
172
173/* Trash buffer for mem2mem operations. */
174#define MEM2MEM_DISCARD_BUF_LENGTH (512)
175static unsigned char mem2mem_discard_buf[MEM2MEM_DISCARD_BUF_LENGTH];
176
177/* Descriptor pool. */
178/* FIXME Tweak this value. */
179#define CRYPTOCOP_DESCRIPTOR_POOL_SIZE (100)
180static struct cryptocop_dma_desc descr_pool[CRYPTOCOP_DESCRIPTOR_POOL_SIZE];
181static struct cryptocop_dma_desc *descr_pool_free_list;
182static int descr_pool_no_free;
183static spinlock_t descr_pool_lock;
184
185/* Lock to stop cryptocop to start processing of a new operation. The holder
186 of this lock MUST call cryptocop_start_job() after it is unlocked. */
187spinlock_t cryptocop_process_lock;
188
189static struct cryptocop_prio_queue cryptocop_job_queues[cryptocop_prio_no_prios];
190static spinlock_t cryptocop_job_queue_lock;
191static struct cryptocop_prio_job *cryptocop_running_job = NULL;
192static spinlock_t running_job_lock;
193
194/* The interrupt handler appends completed jobs to this list. The scehduled
195 * tasklet removes them upon sending the response to the crypto consumer. */
196static struct list_head cryptocop_completed_jobs;
197static spinlock_t cryptocop_completed_jobs_lock;
198
199DECLARE_WAIT_QUEUE_HEAD(cryptocop_ioc_process_wq);
200
201
202/** Local functions. **/
203
204static int cryptocop_open(struct inode *, struct file *);
205
206static int cryptocop_release(struct inode *, struct file *);
207
208static int cryptocop_ioctl(struct inode *inode, struct file *file,
209 unsigned int cmd, unsigned long arg);
210
211static void cryptocop_start_job(void);
212
213static int cryptocop_job_queue_insert(cryptocop_queue_priority prio, struct cryptocop_operation *operation);
214static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_operation *operation);
215
216static int cryptocop_job_queue_init(void);
217static void cryptocop_job_queue_close(void);
218
219static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length);
220
221static int create_sha1_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length);
222
223static int transform_ok(struct cryptocop_transform_init *tinit);
224
225static struct cryptocop_session *get_session(cryptocop_session_id sid);
226
227static struct cryptocop_transform_ctx *get_transform_ctx(struct cryptocop_session *sess, cryptocop_tfrm_id tid);
228
229static void delete_internal_operation(struct cryptocop_int_operation *iop);
230
231static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned char *key, unsigned int keylength);
232
233static int init_stream_coprocessor(void);
234
235static void __exit exit_stream_coprocessor(void);
236
237/*#define LDEBUG*/
238#ifdef LDEBUG
239#define DEBUG(s) s
240#define DEBUG_API(s) s
241static void print_cryptocop_operation(struct cryptocop_operation *cop);
242static void print_dma_descriptors(struct cryptocop_int_operation *iop);
243static void print_strcop_crypto_op(struct strcop_crypto_op *cop);
244static void print_lock_status(void);
245static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op);
246#define assert(s) do{if (!(s)) panic(#s);} while(0);
247#else
248#define DEBUG(s)
249#define DEBUG_API(s)
250#define assert(s)
251#endif
252
253
254/* Transform constants. */
255#define DES_BLOCK_LENGTH (8)
256#define AES_BLOCK_LENGTH (16)
257#define MD5_BLOCK_LENGTH (64)
258#define SHA1_BLOCK_LENGTH (64)
259#define CSUM_BLOCK_LENGTH (2)
260#define MD5_STATE_LENGTH (16)
261#define SHA1_STATE_LENGTH (20)
262
263/* The device number. */
264#define CRYPTOCOP_MAJOR (254)
265#define CRYPTOCOP_MINOR (0)
266
267
268
269struct file_operations cryptocop_fops = {
270 owner: THIS_MODULE,
271 open: cryptocop_open,
272 release: cryptocop_release,
273 ioctl: cryptocop_ioctl
274};
275
276
277static void free_cdesc(struct cryptocop_dma_desc *cdesc)
278{
279 DEBUG(printk("free_cdesc: cdesc 0x%p, from_pool=%d\n", cdesc, cdesc->from_pool));
280 if (cdesc->free_buf) kfree(cdesc->free_buf);
281
282 if (cdesc->from_pool) {
283 unsigned long int flags;
284 spin_lock_irqsave(&descr_pool_lock, flags);
285 cdesc->next = descr_pool_free_list;
286 descr_pool_free_list = cdesc;
287 ++descr_pool_no_free;
288 spin_unlock_irqrestore(&descr_pool_lock, flags);
289 } else {
290 kfree(cdesc);
291 }
292}
293
294
295static struct cryptocop_dma_desc *alloc_cdesc(int alloc_flag)
296{
297 int use_pool = (alloc_flag & GFP_ATOMIC) ? 1 : 0;
298 struct cryptocop_dma_desc *cdesc;
299
300 if (use_pool) {
301 unsigned long int flags;
302 spin_lock_irqsave(&descr_pool_lock, flags);
303 if (!descr_pool_free_list) {
304 spin_unlock_irqrestore(&descr_pool_lock, flags);
305 DEBUG_API(printk("alloc_cdesc: pool is empty\n"));
306 return NULL;
307 }
308 cdesc = descr_pool_free_list;
309 descr_pool_free_list = descr_pool_free_list->next;
310 --descr_pool_no_free;
311 spin_unlock_irqrestore(&descr_pool_lock, flags);
312 cdesc->from_pool = 1;
313 } else {
314 cdesc = kmalloc(sizeof(struct cryptocop_dma_desc), alloc_flag);
315 if (!cdesc) {
316 DEBUG_API(printk("alloc_cdesc: kmalloc\n"));
317 return NULL;
318 }
319 cdesc->from_pool = 0;
320 }
321 cdesc->dma_descr = (dma_descr_data*)(((unsigned long int)cdesc + offsetof(struct cryptocop_dma_desc, dma_descr_buf) + DESCR_ALLOC_PAD) & ~0x0000001F);
322
323 cdesc->next = NULL;
324
325 cdesc->free_buf = NULL;
326 cdesc->dma_descr->out_eop = 0;
327 cdesc->dma_descr->in_eop = 0;
328 cdesc->dma_descr->intr = 0;
329 cdesc->dma_descr->eol = 0;
330 cdesc->dma_descr->wait = 0;
331 cdesc->dma_descr->buf = NULL;
332 cdesc->dma_descr->after = NULL;
333
334 DEBUG_API(printk("alloc_cdesc: return 0x%p, cdesc->dma_descr=0x%p, from_pool=%d\n", cdesc, cdesc->dma_descr, cdesc->from_pool));
335 return cdesc;
336}
337
338
339static void setup_descr_chain(struct cryptocop_dma_desc *cd)
340{
341 DEBUG(printk("setup_descr_chain: entering\n"));
342 while (cd) {
343 if (cd->next) {
344 cd->dma_descr->next = (dma_descr_data*)virt_to_phys(cd->next->dma_descr);
345 } else {
346 cd->dma_descr->next = NULL;
347 }
348 cd = cd->next;
349 }
350 DEBUG(printk("setup_descr_chain: exit\n"));
351}
352
353
354/* Create a pad descriptor for the transform.
355 * Return -1 for error, 0 if pad created. */
356static int create_pad_descriptor(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **pad_desc, int alloc_flag)
357{
358 struct cryptocop_dma_desc *cdesc = NULL;
359 int error = 0;
360 struct strcop_meta_out mo = {
361 .ciphsel = src_none,
362 .hashsel = src_none,
363 .csumsel = src_none
364 };
365 char *pad;
366 size_t plen;
367
368 DEBUG(printk("create_pad_descriptor: start.\n"));
369 /* Setup pad descriptor. */
370
371 DEBUG(printk("create_pad_descriptor: setting up padding.\n"));
372 cdesc = alloc_cdesc(alloc_flag);
373 if (!cdesc){
374 DEBUG_API(printk("create_pad_descriptor: alloc pad desc\n"));
375 goto error_cleanup;
376 }
377 switch (tc->unit_no) {
378 case src_md5:
379 error = create_md5_pad(alloc_flag, tc->consumed, &pad, &plen);
380 if (error){
381 DEBUG_API(printk("create_pad_descriptor: create_md5_pad_failed\n"));
382 goto error_cleanup;
383 }
384 cdesc->free_buf = pad;
385 mo.hashsel = src_dma;
386 mo.hashconf = tc->hash_conf;
387 mo.hashmode = tc->hash_mode;
388 break;
389 case src_sha1:
390 error = create_sha1_pad(alloc_flag, tc->consumed, &pad, &plen);
391 if (error){
392 DEBUG_API(printk("create_pad_descriptor: create_sha1_pad_failed\n"));
393 goto error_cleanup;
394 }
395 cdesc->free_buf = pad;
396 mo.hashsel = src_dma;
397 mo.hashconf = tc->hash_conf;
398 mo.hashmode = tc->hash_mode;
399 break;
400 case src_csum:
401 if (tc->consumed % tc->blocklength){
402 pad = (char*)csum_zero_pad;
403 plen = 1;
404 } else {
405 pad = (char*)cdesc; /* Use any pointer. */
406 plen = 0;
407 }
408 mo.csumsel = src_dma;
409 break;
410 }
411 cdesc->dma_descr->wait = 1;
412 cdesc->dma_descr->out_eop = 1; /* Since this is a pad output is pushed. EOP is ok here since the padded unit is the only one active. */
413 cdesc->dma_descr->buf = (char*)virt_to_phys((char*)pad);
414 cdesc->dma_descr->after = cdesc->dma_descr->buf + plen;
415
416 cdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
417 *pad_desc = cdesc;
418
419 return 0;
420
421 error_cleanup:
422 if (cdesc) free_cdesc(cdesc);
423 return -1;
424}
425
426
427static int setup_key_dl_desc(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **kd, int alloc_flag)
428{
429 struct cryptocop_dma_desc *key_desc = alloc_cdesc(alloc_flag);
430 struct strcop_meta_out mo = {0};
431
432 DEBUG(printk("setup_key_dl_desc\n"));
433
434 if (!key_desc) {
435 DEBUG_API(printk("setup_key_dl_desc: failed descriptor allocation.\n"));
436 return -ENOMEM;
437 }
438
439 /* Download key. */
440 if ((tc->tctx->init.alg == cryptocop_alg_aes) && (tc->tcfg->flags & CRYPTOCOP_DECRYPT)) {
441 /* Precook the AES decrypt key. */
442 if (!tc->tctx->dec_key_set){
443 get_aes_decrypt_key(tc->tctx->dec_key, tc->tctx->init.key, tc->tctx->init.keylen);
444 tc->tctx->dec_key_set = 1;
445 }
446 key_desc->dma_descr->buf = (char*)virt_to_phys(tc->tctx->dec_key);
447 key_desc->dma_descr->after = key_desc->dma_descr->buf + tc->tctx->init.keylen/8;
448 } else {
449 key_desc->dma_descr->buf = (char*)virt_to_phys(tc->tctx->init.key);
450 key_desc->dma_descr->after = key_desc->dma_descr->buf + tc->tctx->init.keylen/8;
451 }
452 /* Setup metadata. */
453 mo.dlkey = 1;
454 switch (tc->tctx->init.keylen) {
455 case 64:
456 mo.decrypt = 0;
457 mo.hashmode = 0;
458 break;
459 case 128:
460 mo.decrypt = 0;
461 mo.hashmode = 1;
462 break;
463 case 192:
464 mo.decrypt = 1;
465 mo.hashmode = 0;
466 break;
467 case 256:
468 mo.decrypt = 1;
469 mo.hashmode = 1;
470 break;
471 default:
472 break;
473 }
474 mo.ciphsel = mo.hashsel = mo.csumsel = src_none;
475 key_desc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
476
477 key_desc->dma_descr->out_eop = 1;
478 key_desc->dma_descr->wait = 1;
479 key_desc->dma_descr->intr = 0;
480
481 *kd = key_desc;
482 return 0;
483}
484
485static int setup_cipher_iv_desc(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **id, int alloc_flag)
486{
487 struct cryptocop_dma_desc *iv_desc = alloc_cdesc(alloc_flag);
488 struct strcop_meta_out mo = {0};
489
490 DEBUG(printk("setup_cipher_iv_desc\n"));
491
492 if (!iv_desc) {
493 DEBUG_API(printk("setup_cipher_iv_desc: failed CBC IV descriptor allocation.\n"));
494 return -ENOMEM;
495 }
496 /* Download IV. */
497 iv_desc->dma_descr->buf = (char*)virt_to_phys(tc->tcfg->iv);
498 iv_desc->dma_descr->after = iv_desc->dma_descr->buf + tc->blocklength;
499
500 /* Setup metadata. */
501 mo.hashsel = mo.csumsel = src_none;
502 mo.ciphsel = src_dma;
503 mo.ciphconf = tc->ciph_conf;
504 mo.cbcmode = tc->cbcmode;
505
506 iv_desc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
507
508 iv_desc->dma_descr->out_eop = 0;
509 iv_desc->dma_descr->wait = 1;
510 iv_desc->dma_descr->intr = 0;
511
512 *id = iv_desc;
513 return 0;
514}
515
516/* Map the ouput length of the transform to operation output starting on the inject index. */
517static int create_input_descriptors(struct cryptocop_operation *operation, struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **id, int alloc_flag)
518{
519 int err = 0;
520 struct cryptocop_dma_desc head = {0};
521 struct cryptocop_dma_desc *outdesc = &head;
522 size_t iov_offset = 0;
523 size_t out_ix = 0;
524 int outiov_ix = 0;
525 struct strcop_meta_in mi = {0};
526
527 size_t out_length = tc->produced;
528 int rem_length;
529 int dlength;
530
531 assert(out_length != 0);
532 if (((tc->produced + tc->tcfg->inject_ix) > operation->tfrm_op.outlen) || (tc->produced && (operation->tfrm_op.outlen == 0))) {
533 DEBUG_API(printk("create_input_descriptors: operation outdata too small\n"));
534 return -EINVAL;
535 }
536 /* Traverse the out iovec until the result inject index is reached. */
537 while ((outiov_ix < operation->tfrm_op.outcount) && ((out_ix + operation->tfrm_op.outdata[outiov_ix].iov_len) <= tc->tcfg->inject_ix)){
538 out_ix += operation->tfrm_op.outdata[outiov_ix].iov_len;
539 outiov_ix++;
540 }
541 if (outiov_ix >= operation->tfrm_op.outcount){
542 DEBUG_API(printk("create_input_descriptors: operation outdata too small\n"));
543 return -EINVAL;
544 }
545 iov_offset = tc->tcfg->inject_ix - out_ix;
546 mi.dmasel = tc->unit_no;
547
548 /* Setup the output descriptors. */
549 while ((out_length > 0) && (outiov_ix < operation->tfrm_op.outcount)) {
550 outdesc->next = alloc_cdesc(alloc_flag);
551 if (!outdesc->next) {
552 DEBUG_API(printk("create_input_descriptors: alloc_cdesc\n"));
553 err = -ENOMEM;
554 goto error_cleanup;
555 }
556 outdesc = outdesc->next;
557 rem_length = operation->tfrm_op.outdata[outiov_ix].iov_len - iov_offset;
558 dlength = (out_length < rem_length) ? out_length : rem_length;
559
560 DEBUG(printk("create_input_descriptors:\n"
561 "outiov_ix=%d, rem_length=%d, dlength=%d\n"
562 "iov_offset=%d, outdata[outiov_ix].iov_len=%d\n"
563 "outcount=%d, outiov_ix=%d\n",
564 outiov_ix, rem_length, dlength, iov_offset, operation->tfrm_op.outdata[outiov_ix].iov_len, operation->tfrm_op.outcount, outiov_ix));
565
566 outdesc->dma_descr->buf = (char*)virt_to_phys(operation->tfrm_op.outdata[outiov_ix].iov_base + iov_offset);
567 outdesc->dma_descr->after = outdesc->dma_descr->buf + dlength;
568 outdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
569
570 out_length -= dlength;
571 iov_offset += dlength;
572 if (iov_offset >= operation->tfrm_op.outdata[outiov_ix].iov_len) {
573 iov_offset = 0;
574 ++outiov_ix;
575 }
576 }
577 if (out_length > 0){
578 DEBUG_API(printk("create_input_descriptors: not enough room for output, %d remained\n", out_length));
579 err = -EINVAL;
580 goto error_cleanup;
581 }
582 /* Set sync in last descriptor. */
583 mi.sync = 1;
584 outdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
585
586 *id = head.next;
587 return 0;
588
589 error_cleanup:
590 while (head.next) {
591 outdesc = head.next->next;
592 free_cdesc(head.next);
593 head.next = outdesc;
594 }
595 return err;
596}
597
598
599static int create_output_descriptors(struct cryptocop_operation *operation, int *iniov_ix, int *iniov_offset, size_t desc_len, struct cryptocop_dma_desc **current_out_cdesc, struct strcop_meta_out *meta_out, int alloc_flag)
600{
601 while (desc_len != 0) {
602 struct cryptocop_dma_desc *cdesc;
603 int rem_length = operation->tfrm_op.indata[*iniov_ix].iov_len - *iniov_offset;
604 int dlength = (desc_len < rem_length) ? desc_len : rem_length;
605
606 cdesc = alloc_cdesc(alloc_flag);
607 if (!cdesc) {
608 DEBUG_API(printk("create_output_descriptors: alloc_cdesc\n"));
609 return -ENOMEM;
610 }
611 (*current_out_cdesc)->next = cdesc;
612 (*current_out_cdesc) = cdesc;
613
614 cdesc->free_buf = NULL;
615
616 cdesc->dma_descr->buf = (char*)virt_to_phys(operation->tfrm_op.indata[*iniov_ix].iov_base + *iniov_offset);
617 cdesc->dma_descr->after = cdesc->dma_descr->buf + dlength;
618
619 desc_len -= dlength;
620 *iniov_offset += dlength;
621 assert(desc_len >= 0);
622 if (*iniov_offset >= operation->tfrm_op.indata[*iniov_ix].iov_len) {
623 *iniov_offset = 0;
624 ++(*iniov_ix);
625 if (*iniov_ix > operation->tfrm_op.incount) {
626 DEBUG_API(printk("create_output_descriptors: not enough indata in operation."));
627 return -EINVAL;
628 }
629 }
630 cdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, (*meta_out));
631 } /* while (desc_len != 0) */
632 /* Last DMA descriptor gets a 'wait' bit to signal expected change in metadata. */
633 (*current_out_cdesc)->dma_descr->wait = 1; /* This will set extraneous WAIT in some situations, e.g. when padding hashes and checksums. */
634
635 return 0;
636}
637
638
639static int append_input_descriptors(struct cryptocop_operation *operation, struct cryptocop_dma_desc **current_in_cdesc, struct cryptocop_dma_desc **current_out_cdesc, struct cryptocop_tfrm_ctx *tc, int alloc_flag)
640{
641 DEBUG(printk("append_input_descriptors, tc=0x%p, unit_no=%d\n", tc, tc->unit_no));
642 if (tc->tcfg) {
643 int failed = 0;
644 struct cryptocop_dma_desc *idescs = NULL;
645 DEBUG(printk("append_input_descriptors: pushing output, consumed %d produced %d bytes.\n", tc->consumed, tc->produced));
646 if (tc->pad_descs) {
647 DEBUG(printk("append_input_descriptors: append pad descriptors to DMA out list.\n"));
648 while (tc->pad_descs) {
649 DEBUG(printk("append descriptor 0x%p\n", tc->pad_descs));
650 (*current_out_cdesc)->next = tc->pad_descs;
651 tc->pad_descs = tc->pad_descs->next;
652 (*current_out_cdesc) = (*current_out_cdesc)->next;
653 }
654 }
655
656 /* Setup and append output descriptors to DMA in list. */
657 if (tc->unit_no == src_dma){
658 /* mem2mem. Setup DMA in descriptors to discard all input prior to the requested mem2mem data. */
659 struct strcop_meta_in mi = {.sync = 0, .dmasel = src_dma};
660 unsigned int start_ix = tc->start_ix;
661 while (start_ix){
662 unsigned int desclen = start_ix < MEM2MEM_DISCARD_BUF_LENGTH ? start_ix : MEM2MEM_DISCARD_BUF_LENGTH;
663 (*current_in_cdesc)->next = alloc_cdesc(alloc_flag);
664 if (!(*current_in_cdesc)->next){
665 DEBUG_API(printk("append_input_descriptors: alloc_cdesc mem2mem discard failed\n"));
666 return -ENOMEM;
667 }
668 (*current_in_cdesc) = (*current_in_cdesc)->next;
669 (*current_in_cdesc)->dma_descr->buf = (char*)virt_to_phys(mem2mem_discard_buf);
670 (*current_in_cdesc)->dma_descr->after = (*current_in_cdesc)->dma_descr->buf + desclen;
671 (*current_in_cdesc)->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
672 start_ix -= desclen;
673 }
674 mi.sync = 1;
675 (*current_in_cdesc)->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
676 }
677
678 failed = create_input_descriptors(operation, tc, &idescs, alloc_flag);
679 if (failed){
680 DEBUG_API(printk("append_input_descriptors: output descriptor setup failed\n"));
681 return failed;
682 }
683 DEBUG(printk("append_input_descriptors: append output descriptors to DMA in list.\n"));
684 while (idescs) {
685 DEBUG(printk("append descriptor 0x%p\n", idescs));
686 (*current_in_cdesc)->next = idescs;
687 idescs = idescs->next;
688 (*current_in_cdesc) = (*current_in_cdesc)->next;
689 }
690 }
691 return 0;
692}
693
694
695
696static int cryptocop_setup_dma_list(struct cryptocop_operation *operation, struct cryptocop_int_operation **int_op, int alloc_flag)
697{
698 struct cryptocop_session *sess;
699 struct cryptocop_transform_ctx *tctx;
700
701 struct cryptocop_tfrm_ctx digest_ctx = {
702 .previous_src = src_none,
703 .current_src = src_none,
704 .start_ix = 0,
705 .requires_padding = 1,
706 .strict_block_length = 0,
707 .hash_conf = 0,
708 .hash_mode = 0,
709 .ciph_conf = 0,
710 .cbcmode = 0,
711 .decrypt = 0,
712 .consumed = 0,
713 .produced = 0,
714 .pad_descs = NULL,
715 .active = 0,
716 .done = 0,
717 .prev_src = NULL,
718 .curr_src = NULL,
719 .tcfg = NULL};
720 struct cryptocop_tfrm_ctx cipher_ctx = {
721 .previous_src = src_none,
722 .current_src = src_none,
723 .start_ix = 0,
724 .requires_padding = 0,
725 .strict_block_length = 1,
726 .hash_conf = 0,
727 .hash_mode = 0,
728 .ciph_conf = 0,
729 .cbcmode = 0,
730 .decrypt = 0,
731 .consumed = 0,
732 .produced = 0,
733 .pad_descs = NULL,
734 .active = 0,
735 .done = 0,
736 .prev_src = NULL,
737 .curr_src = NULL,
738 .tcfg = NULL};
739 struct cryptocop_tfrm_ctx csum_ctx = {
740 .previous_src = src_none,
741 .current_src = src_none,
742 .start_ix = 0,
743 .blocklength = 2,
744 .requires_padding = 1,
745 .strict_block_length = 0,
746 .hash_conf = 0,
747 .hash_mode = 0,
748 .ciph_conf = 0,
749 .cbcmode = 0,
750 .decrypt = 0,
751 .consumed = 0,
752 .produced = 0,
753 .pad_descs = NULL,
754 .active = 0,
755 .done = 0,
756 .tcfg = NULL,
757 .prev_src = NULL,
758 .curr_src = NULL,
759 .unit_no = src_csum};
760 struct cryptocop_tfrm_cfg *tcfg = operation->tfrm_op.tfrm_cfg;
761
762 unsigned int indata_ix = 0;
763
764 /* iovec accounting. */
765 int iniov_ix = 0;
766 int iniov_offset = 0;
767
768 /* Operation descriptor cfg traversal pointer. */
769 struct cryptocop_desc *odsc;
770
771 int failed = 0;
772 /* List heads for allocated descriptors. */
773 struct cryptocop_dma_desc out_cdesc_head = {0};
774 struct cryptocop_dma_desc in_cdesc_head = {0};
775
776 struct cryptocop_dma_desc *current_out_cdesc = &out_cdesc_head;
777 struct cryptocop_dma_desc *current_in_cdesc = &in_cdesc_head;
778
779 struct cryptocop_tfrm_ctx *output_tc = NULL;
780 void *iop_alloc_ptr;
781
782 assert(operation != NULL);
783 assert(int_op != NULL);
784
785 DEBUG(printk("cryptocop_setup_dma_list: start\n"));
786 DEBUG(print_cryptocop_operation(operation));
787
788 sess = get_session(operation->sid);
789 if (!sess) {
790 DEBUG_API(printk("cryptocop_setup_dma_list: no session found for operation.\n"));
791 failed = -EINVAL;
792 goto error_cleanup;
793 }
794 iop_alloc_ptr = kmalloc(DESCR_ALLOC_PAD + sizeof(struct cryptocop_int_operation), alloc_flag);
795 if (!iop_alloc_ptr) {
796 DEBUG_API(printk("cryptocop_setup_dma_list: kmalloc cryptocop_int_operation\n"));
797 failed = -ENOMEM;
798 goto error_cleanup;
799 }
800 (*int_op) = (struct cryptocop_int_operation*)(((unsigned long int)(iop_alloc_ptr + DESCR_ALLOC_PAD + offsetof(struct cryptocop_int_operation, ctx_out)) & ~0x0000001F) - offsetof(struct cryptocop_int_operation, ctx_out));
801 DEBUG(memset((*int_op), 0xff, sizeof(struct cryptocop_int_operation)));
802 (*int_op)->alloc_ptr = iop_alloc_ptr;
803 DEBUG(printk("cryptocop_setup_dma_list: *int_op=0x%p, alloc_ptr=0x%p\n", *int_op, (*int_op)->alloc_ptr));
804
805 (*int_op)->sid = operation->sid;
806 (*int_op)->cdesc_out = NULL;
807 (*int_op)->cdesc_in = NULL;
808 (*int_op)->tdes_mode = cryptocop_3des_ede;
809 (*int_op)->csum_mode = cryptocop_csum_le;
810 (*int_op)->ddesc_out = NULL;
811 (*int_op)->ddesc_in = NULL;
812
813 /* Scan operation->tfrm_op.tfrm_cfg for bad configuration and set up the local contexts. */
814 if (!tcfg) {
815 DEBUG_API(printk("cryptocop_setup_dma_list: no configured transforms in operation.\n"));
816 failed = -EINVAL;
817 goto error_cleanup;
818 }
819 while (tcfg) {
820 tctx = get_transform_ctx(sess, tcfg->tid);
821 if (!tctx) {
822 DEBUG_API(printk("cryptocop_setup_dma_list: no transform id %d in session.\n", tcfg->tid));
823 failed = -EINVAL;
824 goto error_cleanup;
825 }
826 if (tcfg->inject_ix > operation->tfrm_op.outlen){
827 DEBUG_API(printk("cryptocop_setup_dma_list: transform id %d inject_ix (%d) > operation->tfrm_op.outlen(%d)", tcfg->tid, tcfg->inject_ix, operation->tfrm_op.outlen));
828 failed = -EINVAL;
829 goto error_cleanup;
830 }
831 switch (tctx->init.alg){
832 case cryptocop_alg_mem2mem:
833 if (cipher_ctx.tcfg != NULL){
834 DEBUG_API(printk("cryptocop_setup_dma_list: multiple ciphers in operation.\n"));
835 failed = -EINVAL;
836 goto error_cleanup;
837 }
838 /* mem2mem is handled as a NULL cipher. */
839 cipher_ctx.cbcmode = 0;
840 cipher_ctx.decrypt = 0;
841 cipher_ctx.blocklength = 1;
842 cipher_ctx.ciph_conf = 0;
843 cipher_ctx.unit_no = src_dma;
844 cipher_ctx.tcfg = tcfg;
845 cipher_ctx.tctx = tctx;
846 break;
847 case cryptocop_alg_des:
848 case cryptocop_alg_3des:
849 case cryptocop_alg_aes:
850 /* cipher */
851 if (cipher_ctx.tcfg != NULL){
852 DEBUG_API(printk("cryptocop_setup_dma_list: multiple ciphers in operation.\n"));
853 failed = -EINVAL;
854 goto error_cleanup;
855 }
856 cipher_ctx.tcfg = tcfg;
857 cipher_ctx.tctx = tctx;
858 if (cipher_ctx.tcfg->flags & CRYPTOCOP_DECRYPT){
859 cipher_ctx.decrypt = 1;
860 }
861 switch (tctx->init.cipher_mode) {
862 case cryptocop_cipher_mode_ecb:
863 cipher_ctx.cbcmode = 0;
864 break;
865 case cryptocop_cipher_mode_cbc:
866 cipher_ctx.cbcmode = 1;
867 break;
868 default:
869 DEBUG_API(printk("cryptocop_setup_dma_list: cipher_ctx, bad cipher mode==%d\n", tctx->init.cipher_mode));
870 failed = -EINVAL;
871 goto error_cleanup;
872 }
873 DEBUG(printk("cryptocop_setup_dma_list: cipher_ctx, set CBC mode==%d\n", cipher_ctx.cbcmode));
874 switch (tctx->init.alg){
875 case cryptocop_alg_des:
876 cipher_ctx.ciph_conf = 0;
877 cipher_ctx.unit_no = src_des;
878 cipher_ctx.blocklength = DES_BLOCK_LENGTH;
879 break;
880 case cryptocop_alg_3des:
881 cipher_ctx.ciph_conf = 1;
882 cipher_ctx.unit_no = src_des;
883 cipher_ctx.blocklength = DES_BLOCK_LENGTH;
884 break;
885 case cryptocop_alg_aes:
886 cipher_ctx.ciph_conf = 2;
887 cipher_ctx.unit_no = src_aes;
888 cipher_ctx.blocklength = AES_BLOCK_LENGTH;
889 break;
890 default:
891 panic("cryptocop_setup_dma_list: impossible algorithm %d\n", tctx->init.alg);
892 }
893 (*int_op)->tdes_mode = tctx->init.tdes_mode;
894 break;
895 case cryptocop_alg_md5:
896 case cryptocop_alg_sha1:
897 /* digest */
898 if (digest_ctx.tcfg != NULL){
899 DEBUG_API(printk("cryptocop_setup_dma_list: multiple digests in operation.\n"));
900 failed = -EINVAL;
901 goto error_cleanup;
902 }
903 digest_ctx.tcfg = tcfg;
904 digest_ctx.tctx = tctx;
905 digest_ctx.hash_mode = 0; /* Don't use explicit IV in this API. */
906 switch (tctx->init.alg){
907 case cryptocop_alg_md5:
908 digest_ctx.blocklength = MD5_BLOCK_LENGTH;
909 digest_ctx.unit_no = src_md5;
910 digest_ctx.hash_conf = 1; /* 1 => MD-5 */
911 break;
912 case cryptocop_alg_sha1:
913 digest_ctx.blocklength = SHA1_BLOCK_LENGTH;
914 digest_ctx.unit_no = src_sha1;
915 digest_ctx.hash_conf = 0; /* 0 => SHA-1 */
916 break;
917 default:
918 panic("cryptocop_setup_dma_list: impossible digest algorithm\n");
919 }
920 break;
921 case cryptocop_alg_csum:
922 /* digest */
923 if (csum_ctx.tcfg != NULL){
924 DEBUG_API(printk("cryptocop_setup_dma_list: multiple checksums in operation.\n"));
925 failed = -EINVAL;
926 goto error_cleanup;
927 }
928 (*int_op)->csum_mode = tctx->init.csum_mode;
929 csum_ctx.tcfg = tcfg;
930 csum_ctx.tctx = tctx;
931 break;
932 default:
933 /* no algorithm. */
934 DEBUG_API(printk("cryptocop_setup_dma_list: invalid algorithm %d specified in tfrm %d.\n", tctx->init.alg, tcfg->tid));
935 failed = -EINVAL;
936 goto error_cleanup;
937 }
938 tcfg = tcfg->next;
939 }
940 /* Download key if a cipher is used. */
941 if (cipher_ctx.tcfg && (cipher_ctx.tctx->init.alg != cryptocop_alg_mem2mem)){
942 struct cryptocop_dma_desc *key_desc = NULL;
943
944 failed = setup_key_dl_desc(&cipher_ctx, &key_desc, alloc_flag);
945 if (failed) {
946 DEBUG_API(printk("cryptocop_setup_dma_list: setup key dl\n"));
947 goto error_cleanup;
948 }
949 current_out_cdesc->next = key_desc;
950 current_out_cdesc = key_desc;
951 indata_ix += (unsigned int)(key_desc->dma_descr->after - key_desc->dma_descr->buf);
952
953 /* Download explicit IV if a cipher is used and CBC mode and explicit IV selected. */
954 if ((cipher_ctx.tctx->init.cipher_mode == cryptocop_cipher_mode_cbc) && (cipher_ctx.tcfg->flags & CRYPTOCOP_EXPLICIT_IV)) {
955 struct cryptocop_dma_desc *iv_desc = NULL;
956
957 DEBUG(printk("cryptocop_setup_dma_list: setup cipher CBC IV descriptor.\n"));
958
959 failed = setup_cipher_iv_desc(&cipher_ctx, &iv_desc, alloc_flag);
960 if (failed) {
961 DEBUG_API(printk("cryptocop_setup_dma_list: CBC IV descriptor.\n"));
962 goto error_cleanup;
963 }
964 current_out_cdesc->next = iv_desc;
965 current_out_cdesc = iv_desc;
966 indata_ix += (unsigned int)(iv_desc->dma_descr->after - iv_desc->dma_descr->buf);
967 }
968 }
969
970 /* Process descriptors. */
971 odsc = operation->tfrm_op.desc;
972 while (odsc) {
973 struct cryptocop_desc_cfg *dcfg = odsc->cfg;
974 struct strcop_meta_out meta_out = {0};
975 size_t desc_len = odsc->length;
976 int active_count, eop_needed_count;
977
978 output_tc = NULL;
979
980 DEBUG(printk("cryptocop_setup_dma_list: parsing an operation descriptor\n"));
981
982 while (dcfg) {
983 struct cryptocop_tfrm_ctx *tc = NULL;
984
985 DEBUG(printk("cryptocop_setup_dma_list: parsing an operation descriptor configuration.\n"));
986 /* Get the local context for the transform and mark it as the output unit if it produces output. */
987 if (digest_ctx.tcfg && (digest_ctx.tcfg->tid == dcfg->tid)){
988 tc = &digest_ctx;
989 } else if (cipher_ctx.tcfg && (cipher_ctx.tcfg->tid == dcfg->tid)){
990 tc = &cipher_ctx;
991 } else if (csum_ctx.tcfg && (csum_ctx.tcfg->tid == dcfg->tid)){
992 tc = &csum_ctx;
993 }
994 if (!tc) {
995 DEBUG_API(printk("cryptocop_setup_dma_list: invalid transform %d specified in descriptor.\n", dcfg->tid));
996 failed = -EINVAL;
997 goto error_cleanup;
998 }
999 if (tc->done) {
1000 DEBUG_API(printk("cryptocop_setup_dma_list: completed transform %d reused.\n", dcfg->tid));
1001 failed = -EINVAL;
1002 goto error_cleanup;
1003 }
1004 if (!tc->active) {
1005 tc->start_ix = indata_ix;
1006 tc->active = 1;
1007 }
1008
1009 tc->previous_src = tc->current_src;
1010 tc->prev_src = tc->curr_src;
1011 /* Map source unit id to DMA source config. */
1012 switch (dcfg->src){
1013 case cryptocop_source_dma:
1014 tc->current_src = src_dma;
1015 break;
1016 case cryptocop_source_des:
1017 tc->current_src = src_des;
1018 break;
1019 case cryptocop_source_3des:
1020 tc->current_src = src_des;
1021 break;
1022 case cryptocop_source_aes:
1023 tc->current_src = src_aes;
1024 break;
1025 case cryptocop_source_md5:
1026 case cryptocop_source_sha1:
1027 case cryptocop_source_csum:
1028 case cryptocop_source_none:
1029 default:
1030 /* We do not allow using accumulating style units (SHA-1, MD5, checksum) as sources to other units.
1031 */
1032 DEBUG_API(printk("cryptocop_setup_dma_list: bad unit source configured %d.\n", dcfg->src));
1033 failed = -EINVAL;
1034 goto error_cleanup;
1035 }
1036 if (tc->current_src != src_dma) {
1037 /* Find the unit we are sourcing from. */
1038 if (digest_ctx.unit_no == tc->current_src){
1039 tc->curr_src = &digest_ctx;
1040 } else if (cipher_ctx.unit_no == tc->current_src){
1041 tc->curr_src = &cipher_ctx;
1042 } else if (csum_ctx.unit_no == tc->current_src){
1043 tc->curr_src = &csum_ctx;
1044 }
1045 if ((tc->curr_src == tc) && (tc->unit_no != src_dma)){
1046 DEBUG_API(printk("cryptocop_setup_dma_list: unit %d configured to source from itself.\n", tc->unit_no));
1047 failed = -EINVAL;
1048 goto error_cleanup;
1049 }
1050 } else {
1051 tc->curr_src = NULL;
1052 }
1053
1054 /* Detect source switch. */
1055 DEBUG(printk("cryptocop_setup_dma_list: tc->active=%d tc->unit_no=%d tc->current_src=%d tc->previous_src=%d, tc->curr_src=0x%p, tc->prev_srv=0x%p\n", tc->active, tc->unit_no, tc->current_src, tc->previous_src, tc->curr_src, tc->prev_src));
1056 if (tc->active && (tc->current_src != tc->previous_src)) {
1057 /* Only allow source switch when both the old source unit and the new one have
1058 * no pending data to process (i.e. the consumed length must be a multiple of the
1059 * transform blocklength). */
1060 /* Note: if the src == NULL we are actually sourcing from DMA out. */
1061 if (((tc->prev_src != NULL) && (tc->prev_src->consumed % tc->prev_src->blocklength)) ||
1062 ((tc->curr_src != NULL) && (tc->curr_src->consumed % tc->curr_src->blocklength)))
1063 {
1064 DEBUG_API(printk("cryptocop_setup_dma_list: can only disconnect from or connect to a unit on a multiple of the blocklength, old: cons=%d, prod=%d, block=%d, new: cons=%d prod=%d, block=%d.\n", tc->prev_src ? tc->prev_src->consumed : INT_MIN, tc->prev_src ? tc->prev_src->produced : INT_MIN, tc->prev_src ? tc->prev_src->blocklength : INT_MIN, tc->curr_src ? tc->curr_src->consumed : INT_MIN, tc->curr_src ? tc->curr_src->produced : INT_MIN, tc->curr_src ? tc->curr_src->blocklength : INT_MIN));
1065 failed = -EINVAL;
1066 goto error_cleanup;
1067 }
1068 }
1069 /* Detect unit deactivation. */
1070 if (dcfg->last) {
1071 /* Length check of this is handled below. */
1072 tc->done = 1;
1073 }
1074 dcfg = dcfg->next;
1075 } /* while (dcfg) */
1076 DEBUG(printk("cryptocop_setup_dma_list: parsing operation descriptor configuration complete.\n"));
1077
1078 if (cipher_ctx.active && (cipher_ctx.curr_src != NULL) && !cipher_ctx.curr_src->active){
1079 DEBUG_API(printk("cryptocop_setup_dma_list: cipher source from inactive unit %d\n", cipher_ctx.curr_src->unit_no));
1080 failed = -EINVAL;
1081 goto error_cleanup;
1082 }
1083 if (digest_ctx.active && (digest_ctx.curr_src != NULL) && !digest_ctx.curr_src->active){
1084 DEBUG_API(printk("cryptocop_setup_dma_list: digest source from inactive unit %d\n", digest_ctx.curr_src->unit_no));
1085 failed = -EINVAL;
1086 goto error_cleanup;
1087 }
1088 if (csum_ctx.active && (csum_ctx.curr_src != NULL) && !csum_ctx.curr_src->active){
1089 DEBUG_API(printk("cryptocop_setup_dma_list: cipher source from inactive unit %d\n", csum_ctx.curr_src->unit_no));
1090 failed = -EINVAL;
1091 goto error_cleanup;
1092 }
1093
1094 /* Update consumed and produced lengths.
1095
1096 The consumed length accounting here is actually cheating. If a unit source from DMA (or any
1097 other unit that process data in blocks of one octet) it is correct, but if it source from a
1098 block processing unit, i.e. a cipher, it will be temporarily incorrect at some times. However
1099 since it is only allowed--by the HW--to change source to or from a block processing unit at times where that
1100 unit has processed an exact multiple of its block length the end result will be correct.
1101 Beware that if the source change restriction change this code will need to be (much) reworked.
1102 */
1103 DEBUG(printk("cryptocop_setup_dma_list: desc->length=%d, desc_len=%d.\n", odsc->length, desc_len));
1104
1105 if (csum_ctx.active) {
1106 csum_ctx.consumed += desc_len;
1107 if (csum_ctx.done) {
1108 csum_ctx.produced = 2;
1109 }
1110 DEBUG(printk("cryptocop_setup_dma_list: csum_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", csum_ctx.consumed, csum_ctx.produced, csum_ctx.blocklength));
1111 }
1112 if (digest_ctx.active) {
1113 digest_ctx.consumed += desc_len;
1114 if (digest_ctx.done) {
1115 if (digest_ctx.unit_no == src_md5) {
1116 digest_ctx.produced = MD5_STATE_LENGTH;
1117 } else {
1118 digest_ctx.produced = SHA1_STATE_LENGTH;
1119 }
1120 }
1121 DEBUG(printk("cryptocop_setup_dma_list: digest_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", digest_ctx.consumed, digest_ctx.produced, digest_ctx.blocklength));
1122 }
1123 if (cipher_ctx.active) {
1124 /* Ciphers are allowed only to source from DMA out. That is filtered above. */
1125 assert(cipher_ctx.current_src == src_dma);
1126 cipher_ctx.consumed += desc_len;
1127 cipher_ctx.produced = cipher_ctx.blocklength * (cipher_ctx.consumed / cipher_ctx.blocklength);
1128 if (cipher_ctx.cbcmode && !(cipher_ctx.tcfg->flags & CRYPTOCOP_EXPLICIT_IV) && cipher_ctx.produced){
1129 cipher_ctx.produced -= cipher_ctx.blocklength; /* Compensate for CBC iv. */
1130 }
1131 DEBUG(printk("cryptocop_setup_dma_list: cipher_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", cipher_ctx.consumed, cipher_ctx.produced, cipher_ctx.blocklength));
1132 }
1133
1134 /* Setup the DMA out descriptors. */
1135 /* Configure the metadata. */
1136 active_count = 0;
1137 eop_needed_count = 0;
1138 if (cipher_ctx.active) {
1139 ++active_count;
1140 if (cipher_ctx.unit_no == src_dma){
1141 /* mem2mem */
1142 meta_out.ciphsel = src_none;
1143 } else {
1144 meta_out.ciphsel = cipher_ctx.current_src;
1145 }
1146 meta_out.ciphconf = cipher_ctx.ciph_conf;
1147 meta_out.cbcmode = cipher_ctx.cbcmode;
1148 meta_out.decrypt = cipher_ctx.decrypt;
1149 DEBUG(printk("set ciphsel=%d ciphconf=%d cbcmode=%d decrypt=%d\n", meta_out.ciphsel, meta_out.ciphconf, meta_out.cbcmode, meta_out.decrypt));
1150 if (cipher_ctx.done) ++eop_needed_count;
1151 } else {
1152 meta_out.ciphsel = src_none;
1153 }
1154
1155 if (digest_ctx.active) {
1156 ++active_count;
1157 meta_out.hashsel = digest_ctx.current_src;
1158 meta_out.hashconf = digest_ctx.hash_conf;
1159 meta_out.hashmode = 0; /* Explicit mode is not used here. */
1160 DEBUG(printk("set hashsel=%d hashconf=%d hashmode=%d\n", meta_out.hashsel, meta_out.hashconf, meta_out.hashmode));
1161 if (digest_ctx.done) {
1162 assert(digest_ctx.pad_descs == NULL);
1163 failed = create_pad_descriptor(&digest_ctx, &digest_ctx.pad_descs, alloc_flag);
1164 if (failed) {
1165 DEBUG_API(printk("cryptocop_setup_dma_list: failed digest pad creation.\n"));
1166 goto error_cleanup;
1167 }
1168 }
1169 } else {
1170 meta_out.hashsel = src_none;
1171 }
1172
1173 if (csum_ctx.active) {
1174 ++active_count;
1175 meta_out.csumsel = csum_ctx.current_src;
1176 if (csum_ctx.done) {
1177 assert(csum_ctx.pad_descs == NULL);
1178 failed = create_pad_descriptor(&csum_ctx, &csum_ctx.pad_descs, alloc_flag);
1179 if (failed) {
1180 DEBUG_API(printk("cryptocop_setup_dma_list: failed csum pad creation.\n"));
1181 goto error_cleanup;
1182 }
1183 }
1184 } else {
1185 meta_out.csumsel = src_none;
1186 }
1187 DEBUG(printk("cryptocop_setup_dma_list: %d eop needed, %d active units\n", eop_needed_count, active_count));
1188 /* Setup DMA out descriptors for the indata. */
1189 failed = create_output_descriptors(operation, &iniov_ix, &iniov_offset, desc_len, &current_out_cdesc, &meta_out, alloc_flag);
1190 if (failed) {
1191 DEBUG_API(printk("cryptocop_setup_dma_list: create_output_descriptors %d\n", failed));
1192 goto error_cleanup;
1193 }
1194 /* Setup out EOP. If there are active units that are not done here they cannot get an EOP
1195 * so we ust setup a zero length descriptor to DMA to signal EOP only to done units.
1196 * If there is a pad descriptor EOP for the padded unit will be EOPed by it.
1197 */
1198 assert(active_count >= eop_needed_count);
1199 assert((eop_needed_count == 0) || (eop_needed_count == 1));
1200 if (eop_needed_count) {
1201 /* This means that the bulk operation (cipeher/m2m) is terminated. */
1202 if (active_count > 1) {
1203 /* Use zero length EOP descriptor. */
1204 struct cryptocop_dma_desc *ed = alloc_cdesc(alloc_flag);
1205 struct strcop_meta_out ed_mo = {0};
1206 if (!ed) {
1207 DEBUG_API(printk("cryptocop_setup_dma_list: alloc EOP descriptor for cipher\n"));
1208 failed = -ENOMEM;
1209 goto error_cleanup;
1210 }
1211
1212 assert(cipher_ctx.active && cipher_ctx.done);
1213
1214 if (cipher_ctx.unit_no == src_dma){
1215 /* mem2mem */
1216 ed_mo.ciphsel = src_none;
1217 } else {
1218 ed_mo.ciphsel = cipher_ctx.current_src;
1219 }
1220 ed_mo.ciphconf = cipher_ctx.ciph_conf;
1221 ed_mo.cbcmode = cipher_ctx.cbcmode;
1222 ed_mo.decrypt = cipher_ctx.decrypt;
1223
1224 ed->free_buf = NULL;
1225 ed->dma_descr->wait = 1;
1226 ed->dma_descr->out_eop = 1;
1227
1228 ed->dma_descr->buf = (char*)virt_to_phys(&ed); /* Use any valid physical address for zero length descriptor. */
1229 ed->dma_descr->after = ed->dma_descr->buf;
1230 ed->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, ed_mo);
1231 current_out_cdesc->next = ed;
1232 current_out_cdesc = ed;
1233 } else {
1234 /* Set EOP in the current out descriptor since the only active module is
1235 * the one needing the EOP. */
1236
1237 current_out_cdesc->dma_descr->out_eop = 1;
1238 }
1239 }
1240
1241 if (cipher_ctx.done && cipher_ctx.active) cipher_ctx.active = 0;
1242 if (digest_ctx.done && digest_ctx.active) digest_ctx.active = 0;
1243 if (csum_ctx.done && csum_ctx.active) csum_ctx.active = 0;
1244 indata_ix += odsc->length;
1245 odsc = odsc->next;
1246 } /* while (odsc) */ /* Process descriptors. */
1247 DEBUG(printk("cryptocop_setup_dma_list: done parsing operation descriptors\n"));
1248 if (cipher_ctx.tcfg && (cipher_ctx.active || !cipher_ctx.done)){
1249 DEBUG_API(printk("cryptocop_setup_dma_list: cipher operation not terminated.\n"));
1250 failed = -EINVAL;
1251 goto error_cleanup;
1252 }
1253 if (digest_ctx.tcfg && (digest_ctx.active || !digest_ctx.done)){
1254 DEBUG_API(printk("cryptocop_setup_dma_list: digest operation not terminated.\n"));
1255 failed = -EINVAL;
1256 goto error_cleanup;
1257 }
1258 if (csum_ctx.tcfg && (csum_ctx.active || !csum_ctx.done)){
1259 DEBUG_API(printk("cryptocop_setup_dma_list: csum operation not terminated.\n"));
1260 failed = -EINVAL;
1261 goto error_cleanup;
1262 }
1263
1264 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &cipher_ctx, alloc_flag);
1265 if (failed){
1266 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1267 goto error_cleanup;
1268 }
1269 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &digest_ctx, alloc_flag);
1270 if (failed){
1271 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1272 goto error_cleanup;
1273 }
1274 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &csum_ctx, alloc_flag);
1275 if (failed){
1276 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1277 goto error_cleanup;
1278 }
1279
1280 DEBUG(printk("cryptocop_setup_dma_list: int_op=0x%p, *int_op=0x%p\n", int_op, *int_op));
1281 (*int_op)->cdesc_out = out_cdesc_head.next;
1282 (*int_op)->cdesc_in = in_cdesc_head.next;
1283 DEBUG(printk("cryptocop_setup_dma_list: out_cdesc_head=0x%p in_cdesc_head=0x%p\n", (*int_op)->cdesc_out, (*int_op)->cdesc_in));
1284
1285 setup_descr_chain(out_cdesc_head.next);
1286 setup_descr_chain(in_cdesc_head.next);
1287
1288 /* Last but not least: mark the last DMA in descriptor for a INTR and EOL and the the
1289 * last DMA out descriptor for EOL.
1290 */
1291 current_in_cdesc->dma_descr->intr = 1;
1292 current_in_cdesc->dma_descr->eol = 1;
1293 current_out_cdesc->dma_descr->eol = 1;
1294
1295 /* Setup DMA contexts. */
1296 (*int_op)->ctx_out.next = NULL;
1297 (*int_op)->ctx_out.eol = 1;
1298 (*int_op)->ctx_out.intr = 0;
1299 (*int_op)->ctx_out.store_mode = 0;
1300 (*int_op)->ctx_out.en = 0;
1301 (*int_op)->ctx_out.dis = 0;
1302 (*int_op)->ctx_out.md0 = 0;
1303 (*int_op)->ctx_out.md1 = 0;
1304 (*int_op)->ctx_out.md2 = 0;
1305 (*int_op)->ctx_out.md3 = 0;
1306 (*int_op)->ctx_out.md4 = 0;
1307 (*int_op)->ctx_out.saved_data = (dma_descr_data*)virt_to_phys((*int_op)->cdesc_out->dma_descr);
1308 (*int_op)->ctx_out.saved_data_buf = (*int_op)->cdesc_out->dma_descr->buf; /* Already physical address. */
1309
1310 (*int_op)->ctx_in.next = NULL;
1311 (*int_op)->ctx_in.eol = 1;
1312 (*int_op)->ctx_in.intr = 0;
1313 (*int_op)->ctx_in.store_mode = 0;
1314 (*int_op)->ctx_in.en = 0;
1315 (*int_op)->ctx_in.dis = 0;
1316 (*int_op)->ctx_in.md0 = 0;
1317 (*int_op)->ctx_in.md1 = 0;
1318 (*int_op)->ctx_in.md2 = 0;
1319 (*int_op)->ctx_in.md3 = 0;
1320 (*int_op)->ctx_in.md4 = 0;
1321
1322 (*int_op)->ctx_in.saved_data = (dma_descr_data*)virt_to_phys((*int_op)->cdesc_in->dma_descr);
1323 (*int_op)->ctx_in.saved_data_buf = (*int_op)->cdesc_in->dma_descr->buf; /* Already physical address. */
1324
1325 DEBUG(printk("cryptocop_setup_dma_list: done\n"));
1326 return 0;
1327
1328error_cleanup:
1329 {
1330 /* Free all allocated resources. */
1331 struct cryptocop_dma_desc *tmp_cdesc;
1332 while (digest_ctx.pad_descs){
1333 tmp_cdesc = digest_ctx.pad_descs->next;
1334 free_cdesc(digest_ctx.pad_descs);
1335 digest_ctx.pad_descs = tmp_cdesc;
1336 }
1337 while (csum_ctx.pad_descs){
1338 tmp_cdesc = csum_ctx.pad_descs->next;
1339 free_cdesc(csum_ctx.pad_descs);
1340 csum_ctx.pad_descs = tmp_cdesc;
1341 }
1342 assert(cipher_ctx.pad_descs == NULL); /* The ciphers are never padded. */
1343
1344 if (*int_op != NULL) delete_internal_operation(*int_op);
1345 }
1346 DEBUG_API(printk("cryptocop_setup_dma_list: done with error %d\n", failed));
1347 return failed;
1348}
1349
1350
1351static void delete_internal_operation(struct cryptocop_int_operation *iop)
1352{
1353 void *ptr = iop->alloc_ptr;
1354 struct cryptocop_dma_desc *cd = iop->cdesc_out;
1355 struct cryptocop_dma_desc *next;
1356
1357 DEBUG(printk("delete_internal_operation: iop=0x%p, alloc_ptr=0x%p\n", iop, ptr));
1358
1359 while (cd) {
1360 next = cd->next;
1361 free_cdesc(cd);
1362 cd = next;
1363 }
1364 cd = iop->cdesc_in;
1365 while (cd) {
1366 next = cd->next;
1367 free_cdesc(cd);
1368 cd = next;
1369 }
1370 kfree(ptr);
1371}
1372
1373#define MD5_MIN_PAD_LENGTH (9)
1374#define MD5_PAD_LENGTH_FIELD_LENGTH (8)
1375
1376static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length)
1377{
1378 size_t padlen = MD5_BLOCK_LENGTH - (hashed_length % MD5_BLOCK_LENGTH);
1379 unsigned char *p;
1380 int i;
1381 unsigned long long int bit_length = hashed_length << 3;
1382
1383 if (padlen < MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH;
1384
1385 p = kmalloc(padlen, alloc_flag);
1386 if (!pad) return -ENOMEM;
1387
1388 *p = 0x80;
1389 memset(p+1, 0, padlen - 1);
1390
1391 DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length));
1392
1393 i = padlen - MD5_PAD_LENGTH_FIELD_LENGTH;
1394 while (bit_length != 0){
1395 p[i++] = bit_length % 0x100;
1396 bit_length >>= 8;
1397 }
1398
1399 *pad = (char*)p;
1400 *pad_length = padlen;
1401
1402 return 0;
1403}
1404
1405#define SHA1_MIN_PAD_LENGTH (9)
1406#define SHA1_PAD_LENGTH_FIELD_LENGTH (8)
1407
1408static int create_sha1_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length)
1409{
1410 size_t padlen = SHA1_BLOCK_LENGTH - (hashed_length % SHA1_BLOCK_LENGTH);
1411 unsigned char *p;
1412 int i;
1413 unsigned long long int bit_length = hashed_length << 3;
1414
1415 if (padlen < SHA1_MIN_PAD_LENGTH) padlen += SHA1_BLOCK_LENGTH;
1416
1417 p = kmalloc(padlen, alloc_flag);
1418 if (!pad) return -ENOMEM;
1419
1420 *p = 0x80;
1421 memset(p+1, 0, padlen - 1);
1422
1423 DEBUG(printk("create_sha1_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length));
1424
1425 i = padlen - 1;
1426 while (bit_length != 0){
1427 p[i--] = bit_length % 0x100;
1428 bit_length >>= 8;
1429 }
1430
1431 *pad = (char*)p;
1432 *pad_length = padlen;
1433
1434 return 0;
1435}
1436
1437
1438static int transform_ok(struct cryptocop_transform_init *tinit)
1439{
1440 switch (tinit->alg){
1441 case cryptocop_alg_csum:
1442 switch (tinit->csum_mode){
1443 case cryptocop_csum_le:
1444 case cryptocop_csum_be:
1445 break;
1446 default:
1447 DEBUG_API(printk("transform_ok: Bad mode set for csum transform\n"));
1448 return -EINVAL;
1449 }
1450 case cryptocop_alg_mem2mem:
1451 case cryptocop_alg_md5:
1452 case cryptocop_alg_sha1:
1453 if (tinit->keylen != 0) {
1454 DEBUG_API(printk("transform_ok: non-zero keylength, %d, for a digest/csum algorithm\n", tinit->keylen));
1455 return -EINVAL; /* This check is a bit strict. */
1456 }
1457 break;
1458 case cryptocop_alg_des:
1459 if (tinit->keylen != 64) {
1460 DEBUG_API(printk("transform_ok: keylen %d invalid for DES\n", tinit->keylen));
1461 return -EINVAL;
1462 }
1463 break;
1464 case cryptocop_alg_3des:
1465 if (tinit->keylen != 192) {
1466 DEBUG_API(printk("transform_ok: keylen %d invalid for 3DES\n", tinit->keylen));
1467 return -EINVAL;
1468 }
1469 break;
1470 case cryptocop_alg_aes:
1471 if (tinit->keylen != 128 && tinit->keylen != 192 && tinit->keylen != 256) {
1472 DEBUG_API(printk("transform_ok: keylen %d invalid for AES\n", tinit->keylen));
1473 return -EINVAL;
1474 }
1475 break;
1476 case cryptocop_no_alg:
1477 default:
1478 DEBUG_API(printk("transform_ok: no such algorithm %d\n", tinit->alg));
1479 return -EINVAL;
1480 }
1481
1482 switch (tinit->alg){
1483 case cryptocop_alg_des:
1484 case cryptocop_alg_3des:
1485 case cryptocop_alg_aes:
1486 if (tinit->cipher_mode != cryptocop_cipher_mode_ecb && tinit->cipher_mode != cryptocop_cipher_mode_cbc) return -EINVAL;
1487 default:
1488 break;
1489 }
1490 return 0;
1491}
1492
1493
1494int cryptocop_new_session(cryptocop_session_id *sid, struct cryptocop_transform_init *tinit, int alloc_flag)
1495{
1496 struct cryptocop_session *sess;
1497 struct cryptocop_transform_init *tfrm_in = tinit;
1498 struct cryptocop_transform_init *tmp_in;
1499 int no_tfrms = 0;
1500 int i;
1501 unsigned long int flags;
1502
1503 init_stream_coprocessor(); /* For safety if we are called early */
1504
1505 while (tfrm_in){
1506 int err;
1507 ++no_tfrms;
1508 if ((err = transform_ok(tfrm_in))) {
1509 DEBUG_API(printk("cryptocop_new_session, bad transform\n"));
1510 return err;
1511 }
1512 tfrm_in = tfrm_in->next;
1513 }
1514 if (0 == no_tfrms) {
1515 DEBUG_API(printk("cryptocop_new_session, no transforms specified\n"));
1516 return -EINVAL;
1517 }
1518
1519 sess = kmalloc(sizeof(struct cryptocop_session), alloc_flag);
1520 if (!sess){
1521 DEBUG_API(printk("cryptocop_new_session, kmalloc cryptocop_session\n"));
1522 return -ENOMEM;
1523 }
1524
1525 sess->tfrm_ctx = kmalloc(no_tfrms * sizeof(struct cryptocop_transform_ctx), alloc_flag);
1526 if (!sess->tfrm_ctx) {
1527 DEBUG_API(printk("cryptocop_new_session, kmalloc cryptocop_transform_ctx\n"));
1528 kfree(sess);
1529 return -ENOMEM;
1530 }
1531
1532 tfrm_in = tinit;
1533 for (i = 0; i < no_tfrms; i++){
1534 tmp_in = tfrm_in->next;
1535 while (tmp_in){
1536 if (tmp_in->tid == tfrm_in->tid) {
1537 DEBUG_API(printk("cryptocop_new_session, duplicate transform ids\n"));
1538 kfree(sess->tfrm_ctx);
1539 kfree(sess);
1540 return -EINVAL;
1541 }
1542 tmp_in = tmp_in->next;
1543 }
1544 memcpy(&sess->tfrm_ctx[i].init, tfrm_in, sizeof(struct cryptocop_transform_init));
1545 sess->tfrm_ctx[i].dec_key_set = 0;
1546 sess->tfrm_ctx[i].next = &sess->tfrm_ctx[i] + 1;
1547
1548 tfrm_in = tfrm_in->next;
1549 }
1550 sess->tfrm_ctx[i-1].next = NULL;
1551
1552 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1553 sess->sid = next_sid;
1554 next_sid++;
1555 /* TODO If we are really paranoid we should do duplicate check to handle sid wraparound.
1556 * OTOH 2^64 is a really large number of session. */
1557 if (next_sid == 0) next_sid = 1;
1558
1559 /* Prepend to session list. */
1560 sess->next = cryptocop_sessions;
1561 cryptocop_sessions = sess;
1562 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1563 *sid = sess->sid;
1564 return 0;
1565}
1566
1567
1568int cryptocop_free_session(cryptocop_session_id sid)
1569{
1570 struct cryptocop_transform_ctx *tc;
1571 struct cryptocop_session *sess = NULL;
1572 struct cryptocop_session *psess = NULL;
1573 unsigned long int flags;
1574 int i;
1575 LIST_HEAD(remove_list);
1576 struct list_head *node, *tmp;
1577 struct cryptocop_prio_job *pj;
1578
1579 DEBUG(printk("cryptocop_free_session: sid=%lld\n", sid));
1580
1581 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1582 sess = cryptocop_sessions;
1583 while (sess && sess->sid != sid){
1584 psess = sess;
1585 sess = sess->next;
1586 }
1587 if (sess){
1588 if (psess){
1589 psess->next = sess->next;
1590 } else {
1591 cryptocop_sessions = sess->next;
1592 }
1593 }
1594 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1595
1596 if (!sess) return -EINVAL;
1597
1598 /* Remove queued jobs. */
1599 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
1600
1601 for (i = 0; i < cryptocop_prio_no_prios; i++){
1602 if (!list_empty(&(cryptocop_job_queues[i].jobs))){
1603 list_for_each_safe(node, tmp, &(cryptocop_job_queues[i].jobs)) {
1604 pj = list_entry(node, struct cryptocop_prio_job, node);
1605 if (pj->oper->sid == sid) {
1606 list_move_tail(node, &remove_list);
1607 }
1608 }
1609 }
1610 }
1611 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
1612
1613 list_for_each_safe(node, tmp, &remove_list) {
1614 list_del(node);
1615 pj = list_entry(node, struct cryptocop_prio_job, node);
1616 pj->oper->operation_status = -EAGAIN; /* EAGAIN is not ideal for job/session terminated but it's the best choice I know of. */
1617 DEBUG(printk("cryptocop_free_session: pj=0x%p, pj->oper=0x%p, pj->iop=0x%p\n", pj, pj->oper, pj->iop));
1618 pj->oper->cb(pj->oper, pj->oper->cb_data);
1619 delete_internal_operation(pj->iop);
1620 kfree(pj);
1621 }
1622
1623 tc = sess->tfrm_ctx;
1624 /* Erase keying data. */
1625 while (tc){
1626 DEBUG(printk("cryptocop_free_session: memset keys, tfrm id=%d\n", tc->init.tid));
1627 memset(tc->init.key, 0xff, CRYPTOCOP_MAX_KEY_LENGTH);
1628 memset(tc->dec_key, 0xff, CRYPTOCOP_MAX_KEY_LENGTH);
1629 tc = tc->next;
1630 }
1631 kfree(sess->tfrm_ctx);
1632 kfree(sess);
1633
1634 return 0;
1635}
1636
1637static struct cryptocop_session *get_session(cryptocop_session_id sid)
1638{
1639 struct cryptocop_session *sess;
1640 unsigned long int flags;
1641
1642 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1643 sess = cryptocop_sessions;
1644 while (sess && (sess->sid != sid)){
1645 sess = sess->next;
1646 }
1647 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1648
1649 return sess;
1650}
1651
1652static struct cryptocop_transform_ctx *get_transform_ctx(struct cryptocop_session *sess, cryptocop_tfrm_id tid)
1653{
1654 struct cryptocop_transform_ctx *tc = sess->tfrm_ctx;
1655
1656 DEBUG(printk("get_transform_ctx, sess=0x%p, tid=%d\n", sess, tid));
1657 assert(sess != NULL);
1658 while (tc && tc->init.tid != tid){
1659 DEBUG(printk("tc=0x%p, tc->next=0x%p\n", tc, tc->next));
1660 tc = tc->next;
1661 }
1662 DEBUG(printk("get_transform_ctx, returning tc=0x%p\n", tc));
1663 return tc;
1664}
1665
1666
1667
1668/* The AES s-transform matrix (s-box). */
1669static const u8 aes_sbox[256] = {
1670 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
1671 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
1672 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21,
1673 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117,
1674 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132,
1675 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207,
1676 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168,
1677 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210,
1678 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115,
1679 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219,
1680 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121,
1681 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8,
1682 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138,
1683 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158,
1684 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
1685 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22
1686};
1687
1688/* AES has a 32 bit word round constants for each round in the
1689 * key schedule. round_constant[i] is really Rcon[i+1] in FIPS187.
1690 */
1691static u32 round_constant[11] = {
1692 0x01000000, 0x02000000, 0x04000000, 0x08000000,
1693 0x10000000, 0x20000000, 0x40000000, 0x80000000,
1694 0x1B000000, 0x36000000, 0x6C000000
1695};
1696
1697/* Apply the s-box to each of the four occtets in w. */
1698static u32 aes_ks_subword(const u32 w)
1699{
1700 u8 bytes[4];
1701
1702 *(u32*)(&bytes[0]) = w;
1703 bytes[0] = aes_sbox[bytes[0]];
1704 bytes[1] = aes_sbox[bytes[1]];
1705 bytes[2] = aes_sbox[bytes[2]];
1706 bytes[3] = aes_sbox[bytes[3]];
1707 return *(u32*)(&bytes[0]);
1708}
1709
1710/* The encrypt (forward) Rijndael key schedule algorithm pseudo code:
1711 * (Note that AES words are 32 bit long)
1712 *
1713 * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk){
1714 * word temp
1715 * i = 0
1716 * while (i < Nk) {
1717 * w[i] = word(key[4*i, 4*i + 1, 4*i + 2, 4*i + 3])
1718 * i = i + 1
1719 * }
1720 * i = Nk
1721 *
1722 * while (i < (Nb * (Nr + 1))) {
1723 * temp = w[i - 1]
1724 * if ((i mod Nk) == 0) {
1725 * temp = SubWord(RotWord(temp)) xor Rcon[i/Nk]
1726 * }
1727 * else if ((Nk > 6) && ((i mod Nk) == 4)) {
1728 * temp = SubWord(temp)
1729 * }
1730 * w[i] = w[i - Nk] xor temp
1731 * }
1732 * RotWord(t) does a 8 bit cyclic shift left on a 32 bit word.
1733 * SubWord(t) applies the AES s-box individually to each octet
1734 * in a 32 bit word.
1735 *
1736 * For AES Nk can have the values 4, 6, and 8 (corresponding to
1737 * values for Nr of 10, 12, and 14). Nb is always 4.
1738 *
1739 * To construct w[i], w[i - 1] and w[i - Nk] must be
1740 * available. Consequently we must keep a state of the last Nk words
1741 * to be able to create the last round keys.
1742 */
1743static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned char *key, unsigned int keylength)
1744{
1745 u32 temp;
1746 u32 w_ring[8]; /* nk is max 8, use elements 0..(nk - 1) as a ringbuffer */
1747 u8 w_last_ix;
1748 int i;
1749 u8 nr, nk;
1750
1751 switch (keylength){
1752 case 128:
1753 nk = 4;
1754 nr = 10;
1755 break;
1756 case 192:
1757 nk = 6;
1758 nr = 12;
1759 break;
1760 case 256:
1761 nk = 8;
1762 nr = 14;
1763 break;
1764 default:
1765 panic("stream co-processor: bad aes key length in get_aes_decrypt_key\n");
1766 };
1767
1768 /* Need to do host byte order correction here since key is byte oriented and the
1769 * kx algorithm is word (u32) oriented. */
1770 for (i = 0; i < nk; i+=1) {
1771 w_ring[i] = be32_to_cpu(*(u32*)&key[4*i]);
1772 }
1773
1774 i = (int)nk;
1775 w_last_ix = i - 1;
1776 while (i < (4 * (nr + 2))) {
1777 temp = w_ring[w_last_ix];
1778 if (!(i % nk)) {
1779 /* RotWord(temp) */
1780 temp = (temp << 8) | (temp >> 24);
1781 temp = aes_ks_subword(temp);
1782 temp ^= round_constant[i/nk - 1];
1783 } else if ((nk > 6) && ((i % nk) == 4)) {
1784 temp = aes_ks_subword(temp);
1785 }
1786 w_last_ix = (w_last_ix + 1) % nk; /* This is the same as (i-Nk) mod Nk */
1787 temp ^= w_ring[w_last_ix];
1788 w_ring[w_last_ix] = temp;
1789
1790 /* We need the round keys for round Nr+1 and Nr+2 (round key
1791 * Nr+2 is the round key beyond the last one used when
1792 * encrypting). Rounds are numbered starting from 0, Nr=10
1793 * implies 11 rounds are used in encryption/decryption.
1794 */
1795 if (i >= (4 * nr)) {
1796 /* Need to do host byte order correction here, the key
1797 * is byte oriented. */
1798 *(u32*)dec_key = cpu_to_be32(temp);
1799 dec_key += 4;
1800 }
1801 ++i;
1802 }
1803}
1804
1805
1806/**** Job/operation management. ****/
1807
1808int cryptocop_job_queue_insert_csum(struct cryptocop_operation *operation)
1809{
1810 return cryptocop_job_queue_insert(cryptocop_prio_kernel_csum, operation);
1811}
1812
1813int cryptocop_job_queue_insert_crypto(struct cryptocop_operation *operation)
1814{
1815 return cryptocop_job_queue_insert(cryptocop_prio_kernel, operation);
1816}
1817
1818int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation)
1819{
1820 return cryptocop_job_queue_insert(cryptocop_prio_user, operation);
1821}
1822
1823static int cryptocop_job_queue_insert(cryptocop_queue_priority prio, struct cryptocop_operation *operation)
1824{
1825 int ret;
1826 struct cryptocop_prio_job *pj = NULL;
1827 unsigned long int flags;
1828
1829 DEBUG(printk("cryptocop_job_queue_insert(%d, 0x%p)\n", prio, operation));
1830
1831 if (!operation || !operation->cb){
1832 DEBUG_API(printk("cryptocop_job_queue_insert oper=0x%p, NULL operation or callback\n", operation));
1833 return -EINVAL;
1834 }
1835
1836 if ((ret = cryptocop_job_setup(&pj, operation)) != 0){
1837 DEBUG_API(printk("cryptocop_job_queue_insert: job setup failed\n"));
1838 return ret;
1839 }
1840 assert(pj != NULL);
1841
1842 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
1843 list_add_tail(&pj->node, &cryptocop_job_queues[prio].jobs);
1844 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
1845
1846 /* Make sure a job is running */
1847 cryptocop_start_job();
1848 return 0;
1849}
1850
1851static void cryptocop_do_tasklet(unsigned long unused);
1852DECLARE_TASKLET (cryptocop_tasklet, cryptocop_do_tasklet, 0);
1853
1854static void cryptocop_do_tasklet(unsigned long unused)
1855{
1856 struct list_head *node;
1857 struct cryptocop_prio_job *pj = NULL;
1858 unsigned long flags;
1859
1860 DEBUG(printk("cryptocop_do_tasklet: entering\n"));
1861
1862 do {
1863 spin_lock_irqsave(&cryptocop_completed_jobs_lock, flags);
1864 if (!list_empty(&cryptocop_completed_jobs)){
1865 node = cryptocop_completed_jobs.next;
1866 list_del(node);
1867 pj = list_entry(node, struct cryptocop_prio_job, node);
1868 } else {
1869 pj = NULL;
1870 }
1871 spin_unlock_irqrestore(&cryptocop_completed_jobs_lock, flags);
1872 if (pj) {
1873 assert(pj->oper != NULL);
1874
1875 /* Notify consumer of operation completeness. */
1876 DEBUG(printk("cryptocop_do_tasklet: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
1877
1878 pj->oper->operation_status = 0; /* Job is completed. */
1879 pj->oper->cb(pj->oper, pj->oper->cb_data);
1880 delete_internal_operation(pj->iop);
1881 kfree(pj);
1882 }
1883 } while (pj != NULL);
1884
1885 DEBUG(printk("cryptocop_do_tasklet: exiting\n"));
1886}
1887
1888static irqreturn_t
1889dma_done_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1890{
1891 struct cryptocop_prio_job *done_job;
1892 reg_dma_rw_ack_intr ack_intr = {
1893 .data = 1,
1894 };
1895
1896 REG_WR (dma, regi_dma9, rw_ack_intr, ack_intr);
1897
1898 DEBUG(printk("cryptocop DMA done\n"));
1899
1900 spin_lock(&running_job_lock);
1901 if (cryptocop_running_job == NULL){
1902 printk("stream co-processor got interrupt when not busy\n");
1903 spin_unlock(&running_job_lock);
1904 return IRQ_HANDLED;
1905 }
1906 done_job = cryptocop_running_job;
1907 cryptocop_running_job = NULL;
1908 spin_unlock(&running_job_lock);
1909
1910 /* Start processing a job. */
1911 if (!spin_trylock(&cryptocop_process_lock)){
1912 DEBUG(printk("cryptocop irq handler, not starting a job\n"));
1913 } else {
1914 cryptocop_start_job();
1915 spin_unlock(&cryptocop_process_lock);
1916 }
1917
1918 done_job->oper->operation_status = 0; /* Job is completed. */
1919 if (done_job->oper->fast_callback){
1920 /* This operation wants callback from interrupt. */
1921 done_job->oper->cb(done_job->oper, done_job->oper->cb_data);
1922 delete_internal_operation(done_job->iop);
1923 kfree(done_job);
1924 } else {
1925 spin_lock(&cryptocop_completed_jobs_lock);
1926 list_add_tail(&(done_job->node), &cryptocop_completed_jobs);
1927 spin_unlock(&cryptocop_completed_jobs_lock);
1928 tasklet_schedule(&cryptocop_tasklet);
1929 }
1930
1931 DEBUG(printk("cryptocop leave irq handler\n"));
1932 return IRQ_HANDLED;
1933}
1934
1935
1936/* Setup interrupts and DMA channels. */
1937static int init_cryptocop(void)
1938{
1939 unsigned long flags;
1940 reg_intr_vect_rw_mask intr_mask;
1941 reg_dma_rw_cfg dma_cfg = {.en = 1};
1942 reg_dma_rw_intr_mask intr_mask_in = {.data = regk_dma_yes}; /* Only want descriptor interrupts from the DMA in channel. */
1943 reg_dma_rw_ack_intr ack_intr = {.data = 1,.in_eop = 1 };
1944 reg_strcop_rw_cfg strcop_cfg = {
1945 .ipend = regk_strcop_little,
1946 .td1 = regk_strcop_e,
1947 .td2 = regk_strcop_d,
1948 .td3 = regk_strcop_e,
1949 .ignore_sync = 0,
1950 .en = 1
1951 };
1952
1953 if (request_irq(DMA9_INTR_VECT, dma_done_interrupt, 0, "stream co-processor DMA", NULL)) panic("request_irq stream co-processor irq dma9");
1954
1955 (void)crisv32_request_dma(8, "strcop", DMA_PANIC_ON_ERROR, 0, dma_strp);
1956 (void)crisv32_request_dma(9, "strcop", DMA_PANIC_ON_ERROR, 0, dma_strp);
1957
1958 local_irq_save(flags);
1959
1960 /* Reset and enable the cryptocop. */
1961 strcop_cfg.en = 0;
1962 REG_WR(strcop, regi_strcop, rw_cfg, strcop_cfg);
1963 strcop_cfg.en = 1;
1964 REG_WR(strcop, regi_strcop, rw_cfg, strcop_cfg);
1965
1966 /* Enable DMA9 interrupt */
1967 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1968 intr_mask.dma9 = 1;
1969 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1970
1971 /* Enable DMAs. */
1972 REG_WR(dma, regi_dma9, rw_cfg, dma_cfg); /* input DMA */
1973 REG_WR(dma, regi_dma8, rw_cfg, dma_cfg); /* output DMA */
1974
1975 /* Set up wordsize = 4 for DMAs. */
1976 DMA_WR_CMD (regi_dma8, regk_dma_set_w_size4);
1977 DMA_WR_CMD (regi_dma9, regk_dma_set_w_size4);
1978
1979 /* Enable interrupts. */
1980 REG_WR(dma, regi_dma9, rw_intr_mask, intr_mask_in);
1981
1982 /* Clear intr ack. */
1983 REG_WR(dma, regi_dma9, rw_ack_intr, ack_intr);
1984
1985 local_irq_restore(flags);
1986
1987 return 0;
1988}
1989
1990/* Free used cryptocop hw resources (interrupt and DMA channels). */
1991static void release_cryptocop(void)
1992{
1993 unsigned long flags;
1994 reg_intr_vect_rw_mask intr_mask;
1995 reg_dma_rw_cfg dma_cfg = {.en = 0};
1996 reg_dma_rw_intr_mask intr_mask_in = {0};
1997 reg_dma_rw_ack_intr ack_intr = {.data = 1,.in_eop = 1 };
1998
1999 local_irq_save(flags);
2000
2001 /* Clear intr ack. */
2002 REG_WR(dma, regi_dma9, rw_ack_intr, ack_intr);
2003
2004 /* Disable DMA9 interrupt */
2005 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
2006 intr_mask.dma9 = 0;
2007 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
2008
2009 /* Disable DMAs. */
2010 REG_WR(dma, regi_dma9, rw_cfg, dma_cfg); /* input DMA */
2011 REG_WR(dma, regi_dma8, rw_cfg, dma_cfg); /* output DMA */
2012
2013 /* Disable interrupts. */
2014 REG_WR(dma, regi_dma9, rw_intr_mask, intr_mask_in);
2015
2016 local_irq_restore(flags);
2017
2018 free_irq(DMA9_INTR_VECT, NULL);
2019
2020 (void)crisv32_free_dma(8);
2021 (void)crisv32_free_dma(9);
2022}
2023
2024
2025/* Init job queue. */
2026static int cryptocop_job_queue_init(void)
2027{
2028 int i;
2029
2030 INIT_LIST_HEAD(&cryptocop_completed_jobs);
2031
2032 for (i = 0; i < cryptocop_prio_no_prios; i++){
2033 cryptocop_job_queues[i].prio = (cryptocop_queue_priority)i;
2034 INIT_LIST_HEAD(&cryptocop_job_queues[i].jobs);
2035 }
2036 return 0;
2037}
2038
2039
2040static void cryptocop_job_queue_close(void)
2041{
2042 struct list_head *node, *tmp;
2043 struct cryptocop_prio_job *pj = NULL;
2044 unsigned long int process_flags, flags;
2045 int i;
2046
2047 /* FIXME: This is as yet untested code. */
2048
2049 /* Stop strcop from getting an operation to process while we are closing the
2050 module. */
2051 spin_lock_irqsave(&cryptocop_process_lock, process_flags);
2052
2053 /* Empty the job queue. */
2054 spin_lock_irqsave(&cryptocop_process_lock, process_flags);
2055 for (i = 0; i < cryptocop_prio_no_prios; i++){
2056 if (!list_empty(&(cryptocop_job_queues[i].jobs))){
2057 list_for_each_safe(node, tmp, &(cryptocop_job_queues[i].jobs)) {
2058 pj = list_entry(node, struct cryptocop_prio_job, node);
2059 list_del(node);
2060
2061 /* Call callback to notify consumer of job removal. */
2062 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2063 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2064 pj->oper->cb(pj->oper, pj->oper->cb_data);
2065
2066 delete_internal_operation(pj->iop);
2067 kfree(pj);
2068 }
2069 }
2070 }
2071 spin_unlock_irqrestore(&cryptocop_process_lock, process_flags);
2072
2073 /* Remove the running job, if any. */
2074 spin_lock_irqsave(&running_job_lock, flags);
2075 if (cryptocop_running_job){
2076 reg_strcop_rw_cfg rw_cfg;
2077 reg_dma_rw_cfg dma_out_cfg, dma_in_cfg;
2078
2079 /* Stop DMA. */
2080 dma_out_cfg = REG_RD(dma, regi_dma8, rw_cfg);
2081 dma_out_cfg.en = regk_dma_no;
2082 REG_WR(dma, regi_dma8, rw_cfg, dma_out_cfg);
2083
2084 dma_in_cfg = REG_RD(dma, regi_dma9, rw_cfg);
2085 dma_in_cfg.en = regk_dma_no;
2086 REG_WR(dma, regi_dma9, rw_cfg, dma_in_cfg);
2087
2088 /* Disble the cryptocop. */
2089 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg);
2090 rw_cfg.en = 0;
2091 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
2092
2093 pj = cryptocop_running_job;
2094 cryptocop_running_job = NULL;
2095
2096 /* Call callback to notify consumer of job removal. */
2097 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2098 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2099 pj->oper->cb(pj->oper, pj->oper->cb_data);
2100
2101 delete_internal_operation(pj->iop);
2102 kfree(pj);
2103 }
2104 spin_unlock_irqrestore(&running_job_lock, flags);
2105
2106 /* Remove completed jobs, if any. */
2107 spin_lock_irqsave(&cryptocop_completed_jobs_lock, flags);
2108
2109 list_for_each_safe(node, tmp, &cryptocop_completed_jobs) {
2110 pj = list_entry(node, struct cryptocop_prio_job, node);
2111 list_del(node);
2112 /* Call callback to notify consumer of job removal. */
2113 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2114 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2115 pj->oper->cb(pj->oper, pj->oper->cb_data);
2116
2117 delete_internal_operation(pj->iop);
2118 kfree(pj);
2119 }
2120 spin_unlock_irqrestore(&cryptocop_completed_jobs_lock, flags);
2121}
2122
2123
2124static void cryptocop_start_job(void)
2125{
2126 int i;
2127 struct cryptocop_prio_job *pj;
2128 unsigned long int flags;
2129 unsigned long int running_job_flags;
2130 reg_strcop_rw_cfg rw_cfg = {.en = 1, .ignore_sync = 0};
2131
2132 DEBUG(printk("cryptocop_start_job: entering\n"));
2133
2134 spin_lock_irqsave(&running_job_lock, running_job_flags);
2135 if (cryptocop_running_job != NULL){
2136 /* Already running. */
2137 DEBUG(printk("cryptocop_start_job: already running, exit\n"));
2138 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2139 return;
2140 }
2141 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
2142
2143 /* Check the queues in priority order. */
2144 for (i = cryptocop_prio_kernel_csum; (i < cryptocop_prio_no_prios) && list_empty(&cryptocop_job_queues[i].jobs); i++);
2145 if (i == cryptocop_prio_no_prios) {
2146 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
2147 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2148 DEBUG(printk("cryptocop_start_job: no jobs to run\n"));
2149 return; /* No jobs to run */
2150 }
2151 DEBUG(printk("starting job for prio %d\n", i));
2152
2153 /* TODO: Do not starve lower priority jobs. Let in a lower
2154 * prio job for every N-th processed higher prio job or some
2155 * other scheduling policy. This could reasonably be
2156 * tweakable since the optimal balance would depend on the
2157 * type of load on the system. */
2158
2159 /* Pull the DMA lists from the job and start the DMA client. */
2160 pj = list_entry(cryptocop_job_queues[i].jobs.next, struct cryptocop_prio_job, node);
2161 list_del(&pj->node);
2162 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
2163 cryptocop_running_job = pj;
2164
2165 /* Set config register (3DES and CSUM modes). */
2166 switch (pj->iop->tdes_mode){
2167 case cryptocop_3des_eee:
2168 rw_cfg.td1 = regk_strcop_e;
2169 rw_cfg.td2 = regk_strcop_e;
2170 rw_cfg.td3 = regk_strcop_e;
2171 break;
2172 case cryptocop_3des_eed:
2173 rw_cfg.td1 = regk_strcop_e;
2174 rw_cfg.td2 = regk_strcop_e;
2175 rw_cfg.td3 = regk_strcop_d;
2176 break;
2177 case cryptocop_3des_ede:
2178 rw_cfg.td1 = regk_strcop_e;
2179 rw_cfg.td2 = regk_strcop_d;
2180 rw_cfg.td3 = regk_strcop_e;
2181 break;
2182 case cryptocop_3des_edd:
2183 rw_cfg.td1 = regk_strcop_e;
2184 rw_cfg.td2 = regk_strcop_d;
2185 rw_cfg.td3 = regk_strcop_d;
2186 break;
2187 case cryptocop_3des_dee:
2188 rw_cfg.td1 = regk_strcop_d;
2189 rw_cfg.td2 = regk_strcop_e;
2190 rw_cfg.td3 = regk_strcop_e;
2191 break;
2192 case cryptocop_3des_ded:
2193 rw_cfg.td1 = regk_strcop_d;
2194 rw_cfg.td2 = regk_strcop_e;
2195 rw_cfg.td3 = regk_strcop_d;
2196 break;
2197 case cryptocop_3des_dde:
2198 rw_cfg.td1 = regk_strcop_d;
2199 rw_cfg.td2 = regk_strcop_d;
2200 rw_cfg.td3 = regk_strcop_e;
2201 break;
2202 case cryptocop_3des_ddd:
2203 rw_cfg.td1 = regk_strcop_d;
2204 rw_cfg.td2 = regk_strcop_d;
2205 rw_cfg.td3 = regk_strcop_d;
2206 break;
2207 default:
2208 DEBUG(printk("cryptocop_setup_dma_list: bad 3DES mode\n"));
2209 }
2210 switch (pj->iop->csum_mode){
2211 case cryptocop_csum_le:
2212 rw_cfg.ipend = regk_strcop_little;
2213 break;
2214 case cryptocop_csum_be:
2215 rw_cfg.ipend = regk_strcop_big;
2216 break;
2217 default:
2218 DEBUG(printk("cryptocop_setup_dma_list: bad checksum mode\n"));
2219 }
2220 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
2221
2222 DEBUG(printk("cryptocop_start_job: starting DMA, new cryptocop_running_job=0x%p\n"
2223 "ctx_in: 0x%p, phys: 0x%p\n"
2224 "ctx_out: 0x%p, phys: 0x%p\n",
2225 pj,
2226 &pj->iop->ctx_in, (char*)virt_to_phys(&pj->iop->ctx_in),
2227 &pj->iop->ctx_out, (char*)virt_to_phys(&pj->iop->ctx_out)));
2228
2229 /* Start input DMA. */
2230 DMA_START_CONTEXT(regi_dma9, virt_to_phys(&pj->iop->ctx_in));
2231
2232 /* Start output DMA. */
2233 DMA_START_CONTEXT(regi_dma8, virt_to_phys(&pj->iop->ctx_out));
2234
2235 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2236 DEBUG(printk("cryptocop_start_job: exiting\n"));
2237}
2238
2239
2240static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_operation *operation)
2241{
2242 int err;
2243 int alloc_flag = operation->in_interrupt ? GFP_ATOMIC : GFP_KERNEL;
2244 void *iop_alloc_ptr = NULL;
2245
2246 *pj = kmalloc(sizeof (struct cryptocop_prio_job), alloc_flag);
2247 if (!*pj) return -ENOMEM;
2248
2249 DEBUG(printk("cryptocop_job_setup: operation=0x%p\n", operation));
2250
2251 (*pj)->oper = operation;
2252 DEBUG(printk("cryptocop_job_setup, cb=0x%p cb_data=0x%p\n", (*pj)->oper->cb, (*pj)->oper->cb_data));
2253
2254 if (operation->use_dmalists) {
2255 DEBUG(print_user_dma_lists(&operation->list_op));
2256 if (!operation->list_op.inlist || !operation->list_op.outlist || !operation->list_op.out_data_buf || !operation->list_op.in_data_buf){
2257 DEBUG_API(printk("cryptocop_job_setup: bad indata (use_dmalists)\n"));
2258 kfree(*pj);
2259 return -EINVAL;
2260 }
2261 iop_alloc_ptr = kmalloc(DESCR_ALLOC_PAD + sizeof(struct cryptocop_int_operation), alloc_flag);
2262 if (!iop_alloc_ptr) {
2263 DEBUG_API(printk("cryptocop_job_setup: kmalloc cryptocop_int_operation\n"));
2264 kfree(*pj);
2265 return -ENOMEM;
2266 }
2267 (*pj)->iop = (struct cryptocop_int_operation*)(((unsigned long int)(iop_alloc_ptr + DESCR_ALLOC_PAD + offsetof(struct cryptocop_int_operation, ctx_out)) & ~0x0000001F) - offsetof(struct cryptocop_int_operation, ctx_out));
2268 DEBUG(memset((*pj)->iop, 0xff, sizeof(struct cryptocop_int_operation)));
2269 (*pj)->iop->alloc_ptr = iop_alloc_ptr;
2270 (*pj)->iop->sid = operation->sid;
2271 (*pj)->iop->cdesc_out = NULL;
2272 (*pj)->iop->cdesc_in = NULL;
2273 (*pj)->iop->tdes_mode = operation->list_op.tdes_mode;
2274 (*pj)->iop->csum_mode = operation->list_op.csum_mode;
2275 (*pj)->iop->ddesc_out = operation->list_op.outlist;
2276 (*pj)->iop->ddesc_in = operation->list_op.inlist;
2277
2278 /* Setup DMA contexts. */
2279 (*pj)->iop->ctx_out.next = NULL;
2280 (*pj)->iop->ctx_out.eol = 1;
2281 (*pj)->iop->ctx_out.saved_data = operation->list_op.outlist;
2282 (*pj)->iop->ctx_out.saved_data_buf = operation->list_op.out_data_buf;
2283
2284 (*pj)->iop->ctx_in.next = NULL;
2285 (*pj)->iop->ctx_in.eol = 1;
2286 (*pj)->iop->ctx_in.saved_data = operation->list_op.inlist;
2287 (*pj)->iop->ctx_in.saved_data_buf = operation->list_op.in_data_buf;
2288 } else {
2289 if ((err = cryptocop_setup_dma_list(operation, &(*pj)->iop, alloc_flag))) {
2290 DEBUG_API(printk("cryptocop_job_setup: cryptocop_setup_dma_list failed %d\n", err));
2291 kfree(*pj);
2292 return err;
2293 }
2294 }
2295 DEBUG(print_dma_descriptors((*pj)->iop));
2296
2297 DEBUG(printk("cryptocop_job_setup, DMA list setup successful\n"));
2298
2299 return 0;
2300}
2301
2302
2303static int cryptocop_open(struct inode *inode, struct file *filp)
2304{
2305 int p = MINOR(inode->i_rdev);
2306
2307 if (p != CRYPTOCOP_MINOR) return -EINVAL;
2308
2309 filp->private_data = NULL;
2310 return 0;
2311}
2312
2313
2314static int cryptocop_release(struct inode *inode, struct file *filp)
2315{
2316 struct cryptocop_private *dev = filp->private_data;
2317 struct cryptocop_private *dev_next;
2318
2319 while (dev){
2320 dev_next = dev->next;
2321 if (dev->sid != CRYPTOCOP_SESSION_ID_NONE) {
2322 (void)cryptocop_free_session(dev->sid);
2323 }
2324 kfree(dev);
2325 dev = dev_next;
2326 }
2327
2328 return 0;
2329}
2330
2331
2332static int cryptocop_ioctl_close_session(struct inode *inode, struct file *filp,
2333 unsigned int cmd, unsigned long arg)
2334{
2335 struct cryptocop_private *dev = filp->private_data;
2336 struct cryptocop_private *prev_dev = NULL;
2337 struct strcop_session_op *sess_op = (struct strcop_session_op *)arg;
2338 struct strcop_session_op sop;
2339 int err;
2340
2341 DEBUG(printk("cryptocop_ioctl_close_session\n"));
2342
2343 if (!access_ok(VERIFY_READ, sess_op, sizeof(struct strcop_session_op)))
2344 return -EFAULT;
2345 err = copy_from_user(&sop, sess_op, sizeof(struct strcop_session_op));
2346 if (err) return -EFAULT;
2347
2348 while (dev && (dev->sid != sop.ses_id)) {
2349 prev_dev = dev;
2350 dev = dev->next;
2351 }
2352 if (dev){
2353 if (prev_dev){
2354 prev_dev->next = dev->next;
2355 } else {
2356 filp->private_data = dev->next;
2357 }
2358 err = cryptocop_free_session(dev->sid);
2359 if (err) return -EFAULT;
2360 } else {
2361 DEBUG_API(printk("cryptocop_ioctl_close_session: session %lld not found\n", sop.ses_id));
2362 return -EINVAL;
2363 }
2364 return 0;
2365}
2366
2367
2368static void ioctl_process_job_callback(struct cryptocop_operation *op, void*cb_data)
2369{
2370 struct ioctl_job_cb_ctx *jc = (struct ioctl_job_cb_ctx *)cb_data;
2371
2372 DEBUG(printk("ioctl_process_job_callback: op=0x%p, cb_data=0x%p\n", op, cb_data));
2373
2374 jc->processed = 1;
2375 wake_up(&cryptocop_ioc_process_wq);
2376}
2377
2378
2379#define CRYPTOCOP_IOCTL_CIPHER_TID (1)
2380#define CRYPTOCOP_IOCTL_DIGEST_TID (2)
2381#define CRYPTOCOP_IOCTL_CSUM_TID (3)
2382
2383static size_t first_cfg_change_ix(struct strcop_crypto_op *crp_op)
2384{
2385 size_t ch_ix = 0;
2386
2387 if (crp_op->do_cipher) ch_ix = crp_op->cipher_start;
2388 if (crp_op->do_digest && (crp_op->digest_start < ch_ix)) ch_ix = crp_op->digest_start;
2389 if (crp_op->do_csum && (crp_op->csum_start < ch_ix)) ch_ix = crp_op->csum_start;
2390
2391 DEBUG(printk("first_cfg_change_ix: ix=%d\n", ch_ix));
2392 return ch_ix;
2393}
2394
2395
2396static size_t next_cfg_change_ix(struct strcop_crypto_op *crp_op, size_t ix)
2397{
2398 size_t ch_ix = INT_MAX;
2399 size_t tmp_ix = 0;
2400
2401 if (crp_op->do_cipher && ((crp_op->cipher_start + crp_op->cipher_len) > ix)){
2402 if (crp_op->cipher_start > ix) {
2403 ch_ix = crp_op->cipher_start;
2404 } else {
2405 ch_ix = crp_op->cipher_start + crp_op->cipher_len;
2406 }
2407 }
2408 if (crp_op->do_digest && ((crp_op->digest_start + crp_op->digest_len) > ix)){
2409 if (crp_op->digest_start > ix) {
2410 tmp_ix = crp_op->digest_start;
2411 } else {
2412 tmp_ix = crp_op->digest_start + crp_op->digest_len;
2413 }
2414 if (tmp_ix < ch_ix) ch_ix = tmp_ix;
2415 }
2416 if (crp_op->do_csum && ((crp_op->csum_start + crp_op->csum_len) > ix)){
2417 if (crp_op->csum_start > ix) {
2418 tmp_ix = crp_op->csum_start;
2419 } else {
2420 tmp_ix = crp_op->csum_start + crp_op->csum_len;
2421 }
2422 if (tmp_ix < ch_ix) ch_ix = tmp_ix;
2423 }
2424 if (ch_ix == INT_MAX) ch_ix = ix;
2425 DEBUG(printk("next_cfg_change_ix prev ix=%d, next ix=%d\n", ix, ch_ix));
2426 return ch_ix;
2427}
2428
2429
2430/* Map map_length bytes from the pages starting on *pageix and *pageoffset to iovecs starting on *iovix.
2431 * Return -1 for ok, 0 for fail. */
2432static int map_pages_to_iovec(struct iovec *iov, int iovlen, int *iovix, struct page **pages, int nopages, int *pageix, int *pageoffset, int map_length )
2433{
2434 int tmplen;
2435
2436 assert(iov != NULL);
2437 assert(iovix != NULL);
2438 assert(pages != NULL);
2439 assert(pageix != NULL);
2440 assert(pageoffset != NULL);
2441
2442 DEBUG(printk("map_pages_to_iovec, map_length=%d, iovlen=%d, *iovix=%d, nopages=%d, *pageix=%d, *pageoffset=%d\n", map_length, iovlen, *iovix, nopages, *pageix, *pageoffset));
2443
2444 while (map_length > 0){
2445 DEBUG(printk("map_pages_to_iovec, map_length=%d, iovlen=%d, *iovix=%d, nopages=%d, *pageix=%d, *pageoffset=%d\n", map_length, iovlen, *iovix, nopages, *pageix, *pageoffset));
2446 if (*iovix >= iovlen){
2447 DEBUG_API(printk("map_page_to_iovec: *iovix=%d >= iovlen=%d\n", *iovix, iovlen));
2448 return 0;
2449 }
2450 if (*pageix >= nopages){
2451 DEBUG_API(printk("map_page_to_iovec: *pageix=%d >= nopages=%d\n", *pageix, nopages));
2452 return 0;
2453 }
2454 iov[*iovix].iov_base = (unsigned char*)page_address(pages[*pageix]) + *pageoffset;
2455 tmplen = PAGE_SIZE - *pageoffset;
2456 if (tmplen < map_length){
2457 (*pageoffset) = 0;
2458 (*pageix)++;
2459 } else {
2460 tmplen = map_length;
2461 (*pageoffset) += map_length;
2462 }
2463 DEBUG(printk("mapping %d bytes from page %d (or %d) to iovec %d\n", tmplen, *pageix, *pageix-1, *iovix));
2464 iov[*iovix].iov_len = tmplen;
2465 map_length -= tmplen;
2466 (*iovix)++;
2467 }
2468 DEBUG(printk("map_page_to_iovec, exit, *iovix=%d\n", *iovix));
2469 return -1;
2470}
2471
2472
2473
2474static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
2475{
2476 int i;
2477 struct cryptocop_private *dev = filp->private_data;
2478 struct strcop_crypto_op *crp_oper = (struct strcop_crypto_op *)arg;
2479 struct strcop_crypto_op oper = {0};
2480 int err = 0;
2481 struct cryptocop_operation *cop = NULL;
2482
2483 struct ioctl_job_cb_ctx *jc = NULL;
2484
2485 struct page **inpages = NULL;
2486 struct page **outpages = NULL;
2487 int noinpages = 0;
2488 int nooutpages = 0;
2489
2490 struct cryptocop_desc descs[5]; /* Max 5 descriptors are needed, there are three transforms that
2491 * can get connected/disconnected on different places in the indata. */
2492 struct cryptocop_desc_cfg dcfgs[5*3];
2493 int desc_ix = 0;
2494 int dcfg_ix = 0;
2495 struct cryptocop_tfrm_cfg ciph_tcfg = {0};
2496 struct cryptocop_tfrm_cfg digest_tcfg = {0};
2497 struct cryptocop_tfrm_cfg csum_tcfg = {0};
2498
2499 unsigned char *digest_result = NULL;
2500 int digest_length = 0;
2501 int cblocklen = 0;
2502 unsigned char csum_result[CSUM_BLOCK_LENGTH];
2503 struct cryptocop_session *sess;
2504
2505 int iovlen = 0;
2506 int iovix = 0;
2507 int pageix = 0;
2508 int pageoffset = 0;
2509
2510 size_t prev_ix = 0;
2511 size_t next_ix;
2512
2513 int cipher_active, digest_active, csum_active;
2514 int end_digest, end_csum;
2515 int digest_done = 0;
2516 int cipher_done = 0;
2517 int csum_done = 0;
2518
2519 DEBUG(printk("cryptocop_ioctl_process\n"));
2520
2521 if (!access_ok(VERIFY_WRITE, crp_oper, sizeof(struct strcop_crypto_op))){
2522 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok crp_oper!\n"));
2523 return -EFAULT;
2524 }
2525 if (copy_from_user(&oper, crp_oper, sizeof(struct strcop_crypto_op))) {
2526 DEBUG_API(printk("cryptocop_ioctl_process: copy_from_user\n"));
2527 return -EFAULT;
2528 }
2529 DEBUG(print_strcop_crypto_op(&oper));
2530
2531 while (dev && dev->sid != oper.ses_id) dev = dev->next;
2532 if (!dev){
2533 DEBUG_API(printk("cryptocop_ioctl_process: session %lld not found\n", oper.ses_id));
2534 return -EINVAL;
2535 }
2536
2537 /* Check buffers. */
2538 if (((oper.indata + oper.inlen) < oper.indata) || ((oper.cipher_outdata + oper.cipher_outlen) < oper.cipher_outdata)){
2539 DEBUG_API(printk("cryptocop_ioctl_process: user buffers wrapped around, bad user!\n"));
2540 return -EINVAL;
2541 }
2542
2543 if (!access_ok(VERIFY_WRITE, oper.cipher_outdata, oper.cipher_outlen)){
2544 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok out data!\n"));
2545 return -EFAULT;
2546 }
2547 if (!access_ok(VERIFY_READ, oper.indata, oper.inlen)){
2548 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok in data!\n"));
2549 return -EFAULT;
2550 }
2551
2552 cop = kmalloc(sizeof(struct cryptocop_operation), GFP_KERNEL);
2553 if (!cop) {
2554 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
2555 return -ENOMEM;
2556 }
2557 jc = kmalloc(sizeof(struct ioctl_job_cb_ctx), GFP_KERNEL);
2558 if (!jc) {
2559 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
2560 err = -ENOMEM;
2561 goto error_cleanup;
2562 }
2563 jc->processed = 0;
2564
2565 cop->cb_data = jc;
2566 cop->cb = ioctl_process_job_callback;
2567 cop->operation_status = 0;
2568 cop->use_dmalists = 0;
2569 cop->in_interrupt = 0;
2570 cop->fast_callback = 0;
2571 cop->tfrm_op.tfrm_cfg = NULL;
2572 cop->tfrm_op.desc = NULL;
2573 cop->tfrm_op.indata = NULL;
2574 cop->tfrm_op.incount = 0;
2575 cop->tfrm_op.inlen = 0;
2576 cop->tfrm_op.outdata = NULL;
2577 cop->tfrm_op.outcount = 0;
2578 cop->tfrm_op.outlen = 0;
2579
2580 sess = get_session(oper.ses_id);
2581 if (!sess){
2582 DEBUG_API(printk("cryptocop_ioctl_process: bad session id.\n"));
2583 kfree(cop);
2584 kfree(jc);
2585 return -EINVAL;
2586 }
2587
2588 if (oper.do_cipher) {
2589 unsigned int cipher_outlen = 0;
2590 struct cryptocop_transform_ctx *tc = get_transform_ctx(sess, CRYPTOCOP_IOCTL_CIPHER_TID);
2591 if (!tc) {
2592 DEBUG_API(printk("cryptocop_ioctl_process: no cipher transform in session.\n"));
2593 err = -EINVAL;
2594 goto error_cleanup;
2595 }
2596 ciph_tcfg.tid = CRYPTOCOP_IOCTL_CIPHER_TID;
2597 ciph_tcfg.inject_ix = 0;
2598 ciph_tcfg.flags = 0;
2599 if ((oper.cipher_start < 0) || (oper.cipher_len <= 0) || (oper.cipher_start > oper.inlen) || ((oper.cipher_start + oper.cipher_len) > oper.inlen)){
2600 DEBUG_API(printk("cryptocop_ioctl_process: bad cipher length\n"));
2601 kfree(cop);
2602 kfree(jc);
2603 return -EINVAL;
2604 }
2605 cblocklen = tc->init.alg == cryptocop_alg_aes ? AES_BLOCK_LENGTH : DES_BLOCK_LENGTH;
2606 if (oper.cipher_len % cblocklen) {
2607 kfree(cop);
2608 kfree(jc);
2609 DEBUG_API(printk("cryptocop_ioctl_process: cipher inlength not multiple of block length.\n"));
2610 return -EINVAL;
2611 }
2612 cipher_outlen = oper.cipher_len;
2613 if (tc->init.cipher_mode == cryptocop_cipher_mode_cbc){
2614 if (oper.cipher_explicit) {
2615 ciph_tcfg.flags |= CRYPTOCOP_EXPLICIT_IV;
2616 memcpy(ciph_tcfg.iv, oper.cipher_iv, cblocklen);
2617 } else {
2618 cipher_outlen = oper.cipher_len - cblocklen;
2619 }
2620 } else {
2621 if (oper.cipher_explicit){
2622 kfree(cop);
2623 kfree(jc);
2624 DEBUG_API(printk("cryptocop_ioctl_process: explicit_iv when not CBC mode\n"));
2625 return -EINVAL;
2626 }
2627 }
2628 if (oper.cipher_outlen != cipher_outlen) {
2629 kfree(cop);
2630 kfree(jc);
2631 DEBUG_API(printk("cryptocop_ioctl_process: cipher_outlen incorrect, should be %d not %d.\n", cipher_outlen, oper.cipher_outlen));
2632 return -EINVAL;
2633 }
2634
2635 if (oper.decrypt){
2636 ciph_tcfg.flags |= CRYPTOCOP_DECRYPT;
2637 } else {
2638 ciph_tcfg.flags |= CRYPTOCOP_ENCRYPT;
2639 }
2640 ciph_tcfg.next = cop->tfrm_op.tfrm_cfg;
2641 cop->tfrm_op.tfrm_cfg = &ciph_tcfg;
2642 }
2643 if (oper.do_digest){
2644 struct cryptocop_transform_ctx *tc = get_transform_ctx(sess, CRYPTOCOP_IOCTL_DIGEST_TID);
2645 if (!tc) {
2646 DEBUG_API(printk("cryptocop_ioctl_process: no digest transform in session.\n"));
2647 err = -EINVAL;
2648 goto error_cleanup;
2649 }
2650 digest_length = tc->init.alg == cryptocop_alg_md5 ? 16 : 20;
2651 digest_result = kmalloc(digest_length, GFP_KERNEL);
2652 if (!digest_result) {
2653 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc digest_result\n"));
2654 err = -EINVAL;
2655 goto error_cleanup;
2656 }
2657 DEBUG(memset(digest_result, 0xff, digest_length));
2658
2659 digest_tcfg.tid = CRYPTOCOP_IOCTL_DIGEST_TID;
2660 digest_tcfg.inject_ix = 0;
2661 ciph_tcfg.inject_ix += digest_length;
2662 if ((oper.digest_start < 0) || (oper.digest_len <= 0) || (oper.digest_start > oper.inlen) || ((oper.digest_start + oper.digest_len) > oper.inlen)){
2663 DEBUG_API(printk("cryptocop_ioctl_process: bad digest length\n"));
2664 err = -EINVAL;
2665 goto error_cleanup;
2666 }
2667
2668 digest_tcfg.next = cop->tfrm_op.tfrm_cfg;
2669 cop->tfrm_op.tfrm_cfg = &digest_tcfg;
2670 }
2671 if (oper.do_csum){
2672 csum_tcfg.tid = CRYPTOCOP_IOCTL_CSUM_TID;
2673 csum_tcfg.inject_ix = digest_length;
2674 ciph_tcfg.inject_ix += 2;
2675
2676 if ((oper.csum_start < 0) || (oper.csum_len <= 0) || (oper.csum_start > oper.inlen) || ((oper.csum_start + oper.csum_len) > oper.inlen)){
2677 DEBUG_API(printk("cryptocop_ioctl_process: bad csum length\n"));
2678 kfree(cop);
2679 kfree(jc);
2680 return -EINVAL;
2681 }
2682
2683 csum_tcfg.next = cop->tfrm_op.tfrm_cfg;
2684 cop->tfrm_op.tfrm_cfg = &csum_tcfg;
2685 }
2686
2687 prev_ix = first_cfg_change_ix(&oper);
2688 if (prev_ix > oper.inlen) {
2689 DEBUG_API(printk("cryptocop_ioctl_process: length mismatch\n"));
2690 nooutpages = noinpages = 0;
2691 err = -EINVAL;
2692 goto error_cleanup;
2693 }
2694 DEBUG(printk("cryptocop_ioctl_process: inlen=%d, cipher_outlen=%d\n", oper.inlen, oper.cipher_outlen));
2695
2696 /* Map user pages for in and out data of the operation. */
2697 noinpages = (((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK) + oper.inlen - 1 - prev_ix + ~PAGE_MASK) >> PAGE_SHIFT;
2698 DEBUG(printk("cryptocop_ioctl_process: noinpages=%d\n", noinpages));
2699 inpages = kmalloc(noinpages * sizeof(struct page*), GFP_KERNEL);
2700 if (!inpages){
2701 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc inpages\n"));
2702 nooutpages = noinpages = 0;
2703 err = -ENOMEM;
2704 goto error_cleanup;
2705 }
2706 if (oper.do_cipher){
2707 nooutpages = (((unsigned long int)oper.cipher_outdata & ~PAGE_MASK) + oper.cipher_outlen - 1 + ~PAGE_MASK) >> PAGE_SHIFT;
2708 DEBUG(printk("cryptocop_ioctl_process: nooutpages=%d\n", nooutpages));
2709 outpages = kmalloc(nooutpages * sizeof(struct page*), GFP_KERNEL);
2710 if (!outpages){
2711 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc outpages\n"));
2712 nooutpages = noinpages = 0;
2713 err = -ENOMEM;
2714 goto error_cleanup;
2715 }
2716 }
2717
2718 /* Acquire the mm page semaphore. */
2719 down_read(&current->mm->mmap_sem);
2720
2721 err = get_user_pages(current,
2722 current->mm,
2723 (unsigned long int)(oper.indata + prev_ix),
2724 noinpages,
2725 0, /* read access only for in data */
2726 0, /* no force */
2727 inpages,
2728 NULL);
2729
2730 if (err < 0) {
2731 up_read(&current->mm->mmap_sem);
2732 nooutpages = noinpages = 0;
2733 DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n"));
2734 goto error_cleanup;
2735 }
2736 noinpages = err;
2737 if (oper.do_cipher){
2738 err = get_user_pages(current,
2739 current->mm,
2740 (unsigned long int)oper.cipher_outdata,
2741 nooutpages,
2742 1, /* write access for out data */
2743 0, /* no force */
2744 outpages,
2745 NULL);
2746 up_read(&current->mm->mmap_sem);
2747 if (err < 0) {
2748 nooutpages = 0;
2749 DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n"));
2750 goto error_cleanup;
2751 }
2752 nooutpages = err;
2753 } else {
2754 up_read(&current->mm->mmap_sem);
2755 }
2756
2757 /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and
2758 * csum output and splits when units are (dis-)connected. */
2759 cop->tfrm_op.indata = kmalloc((noinpages) * sizeof(struct iovec), GFP_KERNEL);
2760 cop->tfrm_op.outdata = kmalloc((6 + nooutpages) * sizeof(struct iovec), GFP_KERNEL);
2761 if (!cop->tfrm_op.indata || !cop->tfrm_op.outdata) {
2762 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc iovecs\n"));
2763 err = -ENOMEM;
2764 goto error_cleanup;
2765 }
2766
2767 cop->tfrm_op.inlen = oper.inlen - prev_ix;
2768 cop->tfrm_op.outlen = 0;
2769 if (oper.do_cipher) cop->tfrm_op.outlen += oper.cipher_outlen;
2770 if (oper.do_digest) cop->tfrm_op.outlen += digest_length;
2771 if (oper.do_csum) cop->tfrm_op.outlen += 2;
2772
2773 /* Setup the in iovecs. */
2774 cop->tfrm_op.incount = noinpages;
2775 if (noinpages > 1){
2776 size_t tmplen = cop->tfrm_op.inlen;
2777
2778 cop->tfrm_op.indata[0].iov_len = PAGE_SIZE - ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2779 cop->tfrm_op.indata[0].iov_base = (unsigned char*)page_address(inpages[0]) + ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2780 tmplen -= cop->tfrm_op.indata[0].iov_len;
2781 for (i = 1; i<noinpages; i++){
2782 cop->tfrm_op.indata[i].iov_len = tmplen < PAGE_SIZE ? tmplen : PAGE_SIZE;
2783 cop->tfrm_op.indata[i].iov_base = (unsigned char*)page_address(inpages[i]);
2784 tmplen -= PAGE_SIZE;
2785 }
2786 } else {
2787 cop->tfrm_op.indata[0].iov_len = oper.inlen - prev_ix;
2788 cop->tfrm_op.indata[0].iov_base = (unsigned char*)page_address(inpages[0]) + ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2789 }
2790
2791 iovlen = nooutpages + 6;
2792 pageoffset = oper.do_cipher ? ((unsigned long int)oper.cipher_outdata & ~PAGE_MASK) : 0;
2793
2794 next_ix = next_cfg_change_ix(&oper, prev_ix);
2795 if (prev_ix == next_ix){
2796 DEBUG_API(printk("cryptocop_ioctl_process: length configuration broken.\n"));
2797 err = -EINVAL; /* This should be impossible barring bugs. */
2798 goto error_cleanup;
2799 }
2800 while (prev_ix != next_ix){
2801 end_digest = end_csum = cipher_active = digest_active = csum_active = 0;
2802 descs[desc_ix].cfg = NULL;
2803 descs[desc_ix].length = next_ix - prev_ix;
2804
2805 if (oper.do_cipher && (oper.cipher_start < next_ix) && (prev_ix < (oper.cipher_start + oper.cipher_len))) {
2806 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_CIPHER_TID;
2807 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2808 cipher_active = 1;
2809
2810 if (next_ix == (oper.cipher_start + oper.cipher_len)){
2811 cipher_done = 1;
2812 dcfgs[dcfg_ix].last = 1;
2813 } else {
2814 dcfgs[dcfg_ix].last = 0;
2815 }
2816 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2817 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2818 ++dcfg_ix;
2819 }
2820 if (oper.do_digest && (oper.digest_start < next_ix) && (prev_ix < (oper.digest_start + oper.digest_len))) {
2821 digest_active = 1;
2822 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_DIGEST_TID;
2823 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2824 if (next_ix == (oper.digest_start + oper.digest_len)){
2825 assert(!digest_done);
2826 digest_done = 1;
2827 dcfgs[dcfg_ix].last = 1;
2828 } else {
2829 dcfgs[dcfg_ix].last = 0;
2830 }
2831 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2832 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2833 ++dcfg_ix;
2834 }
2835 if (oper.do_csum && (oper.csum_start < next_ix) && (prev_ix < (oper.csum_start + oper.csum_len))){
2836 csum_active = 1;
2837 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_CSUM_TID;
2838 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2839 if (next_ix == (oper.csum_start + oper.csum_len)){
2840 csum_done = 1;
2841 dcfgs[dcfg_ix].last = 1;
2842 } else {
2843 dcfgs[dcfg_ix].last = 0;
2844 }
2845 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2846 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2847 ++dcfg_ix;
2848 }
2849 if (!descs[desc_ix].cfg){
2850 DEBUG_API(printk("cryptocop_ioctl_process: data segment %d (%d to %d) had no active transforms\n", desc_ix, prev_ix, next_ix));
2851 err = -EINVAL;
2852 goto error_cleanup;
2853 }
2854 descs[desc_ix].next = &(descs[desc_ix]) + 1;
2855 ++desc_ix;
2856 prev_ix = next_ix;
2857 next_ix = next_cfg_change_ix(&oper, prev_ix);
2858 }
2859 if (desc_ix > 0){
2860 descs[desc_ix-1].next = NULL;
2861 } else {
2862 descs[0].next = NULL;
2863 }
2864 if (oper.do_digest) {
2865 DEBUG(printk("cryptocop_ioctl_process: mapping %d byte digest output to iovec %d\n", digest_length, iovix));
2866 /* Add outdata iovec, length == <length of type of digest> */
2867 cop->tfrm_op.outdata[iovix].iov_base = digest_result;
2868 cop->tfrm_op.outdata[iovix].iov_len = digest_length;
2869 ++iovix;
2870 }
2871 if (oper.do_csum) {
2872 /* Add outdata iovec, length == 2, the length of csum. */
2873 DEBUG(printk("cryptocop_ioctl_process: mapping 2 byte csum output to iovec %d\n", iovix));
2874 /* Add outdata iovec, length == <length of type of digest> */
2875 cop->tfrm_op.outdata[iovix].iov_base = csum_result;
2876 cop->tfrm_op.outdata[iovix].iov_len = 2;
2877 ++iovix;
2878 }
2879 if (oper.do_cipher) {
2880 if (!map_pages_to_iovec(cop->tfrm_op.outdata, iovlen, &iovix, outpages, nooutpages, &pageix, &pageoffset, oper.cipher_outlen)){
2881 DEBUG_API(printk("cryptocop_ioctl_process: failed to map pages to iovec.\n"));
2882 err = -ENOSYS; /* This should be impossible barring bugs. */
2883 goto error_cleanup;
2884 }
2885 }
2886 DEBUG(printk("cryptocop_ioctl_process: setting cop->tfrm_op.outcount %d\n", iovix));
2887 cop->tfrm_op.outcount = iovix;
2888 assert(iovix <= (nooutpages + 6));
2889
2890 cop->sid = oper.ses_id;
2891 cop->tfrm_op.desc = &descs[0];
2892
2893 DEBUG(printk("cryptocop_ioctl_process: inserting job, cb_data=0x%p\n", cop->cb_data));
2894
2895 if ((err = cryptocop_job_queue_insert_user_job(cop)) != 0) {
2896 DEBUG_API(printk("cryptocop_ioctl_process: insert job %d\n", err));
2897 err = -EINVAL;
2898 goto error_cleanup;
2899 }
2900
2901 DEBUG(printk("cryptocop_ioctl_process: begin wait for result\n"));
2902
2903 wait_event(cryptocop_ioc_process_wq, (jc->processed != 0));
2904 DEBUG(printk("cryptocop_ioctl_process: end wait for result\n"));
2905 if (!jc->processed){
2906 printk(KERN_WARNING "cryptocop_ioctl_process: job not processed at completion\n");
2907 err = -EIO;
2908 goto error_cleanup;
2909 }
2910
2911 /* Job process done. Cipher output should already be correct in job so no post processing of outdata. */
2912 DEBUG(printk("cryptocop_ioctl_process: operation_status = %d\n", cop->operation_status));
2913 if (cop->operation_status == 0){
2914 if (oper.do_digest){
2915 DEBUG(printk("cryptocop_ioctl_process: copy %d bytes digest to user\n", digest_length));
2916 err = copy_to_user((unsigned char*)crp_oper + offsetof(struct strcop_crypto_op, digest), digest_result, digest_length);
2917 if (0 != err){
2918 DEBUG_API(printk("cryptocop_ioctl_process: copy_to_user, digest length %d, err %d\n", digest_length, err));
2919 err = -EFAULT;
2920 goto error_cleanup;
2921 }
2922 }
2923 if (oper.do_csum){
2924 DEBUG(printk("cryptocop_ioctl_process: copy 2 bytes checksum to user\n"));
2925 err = copy_to_user((unsigned char*)crp_oper + offsetof(struct strcop_crypto_op, csum), csum_result, 2);
2926 if (0 != err){
2927 DEBUG_API(printk("cryptocop_ioctl_process: copy_to_user, csum, err %d\n", err));
2928 err = -EFAULT;
2929 goto error_cleanup;
2930 }
2931 }
2932 err = 0;
2933 } else {
2934 DEBUG(printk("cryptocop_ioctl_process: returning err = operation_status = %d\n", cop->operation_status));
2935 err = cop->operation_status;
2936 }
2937
2938 error_cleanup:
2939 /* Release page caches. */
2940 for (i = 0; i < noinpages; i++){
2941 put_page(inpages[i]);
2942 }
2943 for (i = 0; i < nooutpages; i++){
2944 int spdl_err;
2945 /* Mark output pages dirty. */
2946 spdl_err = set_page_dirty_lock(outpages[i]);
2947 DEBUG(if (spdl_err)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err));
2948 }
2949 for (i = 0; i < nooutpages; i++){
2950 put_page(outpages[i]);
2951 }
2952
2953 if (digest_result) kfree(digest_result);
2954 if (inpages) kfree(inpages);
2955 if (outpages) kfree(outpages);
2956 if (cop){
2957 if (cop->tfrm_op.indata) kfree(cop->tfrm_op.indata);
2958 if (cop->tfrm_op.outdata) kfree(cop->tfrm_op.outdata);
2959 kfree(cop);
2960 }
2961 if (jc) kfree(jc);
2962
2963 DEBUG(print_lock_status());
2964
2965 return err;
2966}
2967
2968
2969static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
2970{
2971 cryptocop_session_id sid;
2972 int err;
2973 struct cryptocop_private *dev;
2974 struct strcop_session_op *sess_op = (struct strcop_session_op *)arg;
2975 struct strcop_session_op sop;
2976 struct cryptocop_transform_init *tis = NULL;
2977 struct cryptocop_transform_init ti_cipher = {0};
2978 struct cryptocop_transform_init ti_digest = {0};
2979 struct cryptocop_transform_init ti_csum = {0};
2980
2981 if (!access_ok(VERIFY_WRITE, sess_op, sizeof(struct strcop_session_op)))
2982 return -EFAULT;
2983 err = copy_from_user(&sop, sess_op, sizeof(struct strcop_session_op));
2984 if (err) return -EFAULT;
2985 if (sop.cipher != cryptocop_cipher_none) {
2986 if (!access_ok(VERIFY_READ, sop.key, sop.keylen)) return -EFAULT;
2987 }
2988 DEBUG(printk("cryptocop_ioctl_create_session, sess_op:\n"));
2989
2990 DEBUG(printk("\tcipher:%d\n"
2991 "\tcipher_mode:%d\n"
2992 "\tdigest:%d\n"
2993 "\tcsum:%d\n",
2994 (int)sop.cipher,
2995 (int)sop.cmode,
2996 (int)sop.digest,
2997 (int)sop.csum));
2998
2999 if (sop.cipher != cryptocop_cipher_none){
3000 /* Init the cipher. */
3001 switch (sop.cipher){
3002 case cryptocop_cipher_des:
3003 ti_cipher.alg = cryptocop_alg_des;
3004 break;
3005 case cryptocop_cipher_3des:
3006 ti_cipher.alg = cryptocop_alg_3des;
3007 break;
3008 case cryptocop_cipher_aes:
3009 ti_cipher.alg = cryptocop_alg_aes;
3010 break;
3011 default:
3012 DEBUG_API(printk("create session, bad cipher algorithm %d\n", sop.cipher));
3013 return -EINVAL;
3014 };
3015 DEBUG(printk("setting cipher transform %d\n", ti_cipher.alg));
3016 copy_from_user(ti_cipher.key, sop.key, sop.keylen/8);
3017 ti_cipher.keylen = sop.keylen;
3018 switch (sop.cmode){
3019 case cryptocop_cipher_mode_cbc:
3020 case cryptocop_cipher_mode_ecb:
3021 ti_cipher.cipher_mode = sop.cmode;
3022 break;
3023 default:
3024 DEBUG_API(printk("create session, bad cipher mode %d\n", sop.cmode));
3025 return -EINVAL;
3026 }
3027 DEBUG(printk("cryptocop_ioctl_create_session: setting CBC mode %d\n", ti_cipher.cipher_mode));
3028 switch (sop.des3_mode){
3029 case cryptocop_3des_eee:
3030 case cryptocop_3des_eed:
3031 case cryptocop_3des_ede:
3032 case cryptocop_3des_edd:
3033 case cryptocop_3des_dee:
3034 case cryptocop_3des_ded:
3035 case cryptocop_3des_dde:
3036 case cryptocop_3des_ddd:
3037 ti_cipher.tdes_mode = sop.des3_mode;
3038 break;
3039 default:
3040 DEBUG_API(printk("create session, bad 3DES mode %d\n", sop.des3_mode));
3041 return -EINVAL;
3042 }
3043 ti_cipher.tid = CRYPTOCOP_IOCTL_CIPHER_TID;
3044 ti_cipher.next = tis;
3045 tis = &ti_cipher;
3046 } /* if (sop.cipher != cryptocop_cipher_none) */
3047 if (sop.digest != cryptocop_digest_none){
3048 DEBUG(printk("setting digest transform\n"));
3049 switch (sop.digest){
3050 case cryptocop_digest_md5:
3051 ti_digest.alg = cryptocop_alg_md5;
3052 break;
3053 case cryptocop_digest_sha1:
3054 ti_digest.alg = cryptocop_alg_sha1;
3055 break;
3056 default:
3057 DEBUG_API(printk("create session, bad digest algorithm %d\n", sop.digest));
3058 return -EINVAL;
3059 }
3060 ti_digest.tid = CRYPTOCOP_IOCTL_DIGEST_TID;
3061 ti_digest.next = tis;
3062 tis = &ti_digest;
3063 } /* if (sop.digest != cryptocop_digest_none) */
3064 if (sop.csum != cryptocop_csum_none){
3065 DEBUG(printk("setting csum transform\n"));
3066 switch (sop.csum){
3067 case cryptocop_csum_le:
3068 case cryptocop_csum_be:
3069 ti_csum.csum_mode = sop.csum;
3070 break;
3071 default:
3072 DEBUG_API(printk("create session, bad checksum algorithm %d\n", sop.csum));
3073 return -EINVAL;
3074 }
3075 ti_csum.alg = cryptocop_alg_csum;
3076 ti_csum.tid = CRYPTOCOP_IOCTL_CSUM_TID;
3077 ti_csum.next = tis;
3078 tis = &ti_csum;
3079 } /* (sop.csum != cryptocop_csum_none) */
3080 dev = kmalloc(sizeof(struct cryptocop_private), GFP_KERNEL);
3081 if (!dev){
3082 DEBUG_API(printk("create session, alloc dev\n"));
3083 return -ENOMEM;
3084 }
3085
3086 err = cryptocop_new_session(&sid, tis, GFP_KERNEL);
3087 DEBUG({ if (err) printk("create session, cryptocop_new_session %d\n", err);});
3088
3089 if (err) {
3090 kfree(dev);
3091 return err;
3092 }
3093 sess_op->ses_id = sid;
3094 dev->sid = sid;
3095 dev->next = filp->private_data;
3096 filp->private_data = dev;
3097
3098 return 0;
3099}
3100
3101static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
3102{
3103 int err = 0;
3104 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
3105 DEBUG_API(printk("cryptocop_ioctl: wrong type\n"));
3106 return -ENOTTY;
3107 }
3108 if (_IOC_NR(cmd) > CRYPTOCOP_IO_MAXNR){
3109 return -ENOTTY;
3110 }
3111 /* Access check of the argument. Some commands, e.g. create session and process op,
3112 needs additional checks. Those are handled in the command handling functions. */
3113 if (_IOC_DIR(cmd) & _IOC_READ)
3114 err = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
3115 else if (_IOC_DIR(cmd) & _IOC_WRITE)
3116 err = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
3117 if (err) return -EFAULT;
3118
3119 switch (cmd) {
3120 case CRYPTOCOP_IO_CREATE_SESSION:
3121 return cryptocop_ioctl_create_session(inode, filp, cmd, arg);
3122 case CRYPTOCOP_IO_CLOSE_SESSION:
3123 return cryptocop_ioctl_close_session(inode, filp, cmd, arg);
3124 case CRYPTOCOP_IO_PROCESS_OP:
3125 return cryptocop_ioctl_process(inode, filp, cmd, arg);
3126 default:
3127 DEBUG_API(printk("cryptocop_ioctl: unknown command\n"));
3128 return -ENOTTY;
3129 }
3130 return 0;
3131}
3132
3133
3134#ifdef LDEBUG
3135static void print_dma_descriptors(struct cryptocop_int_operation *iop)
3136{
3137 struct cryptocop_dma_desc *cdesc_out = iop->cdesc_out;
3138 struct cryptocop_dma_desc *cdesc_in = iop->cdesc_in;
3139 int i;
3140
3141 printk("print_dma_descriptors start\n");
3142
3143 printk("iop:\n");
3144 printk("\tsid: 0x%lld\n", iop->sid);
3145
3146 printk("\tcdesc_out: 0x%p\n", iop->cdesc_out);
3147 printk("\tcdesc_in: 0x%p\n", iop->cdesc_in);
3148 printk("\tddesc_out: 0x%p\n", iop->ddesc_out);
3149 printk("\tddesc_in: 0x%p\n", iop->ddesc_in);
3150
3151 printk("\niop->ctx_out: 0x%p phys: 0x%p\n", &iop->ctx_out, (char*)virt_to_phys(&iop->ctx_out));
3152 printk("\tnext: 0x%p\n"
3153 "\tsaved_data: 0x%p\n"
3154 "\tsaved_data_buf: 0x%p\n",
3155 iop->ctx_out.next,
3156 iop->ctx_out.saved_data,
3157 iop->ctx_out.saved_data_buf);
3158
3159 printk("\niop->ctx_in: 0x%p phys: 0x%p\n", &iop->ctx_in, (char*)virt_to_phys(&iop->ctx_in));
3160 printk("\tnext: 0x%p\n"
3161 "\tsaved_data: 0x%p\n"
3162 "\tsaved_data_buf: 0x%p\n",
3163 iop->ctx_in.next,
3164 iop->ctx_in.saved_data,
3165 iop->ctx_in.saved_data_buf);
3166
3167 i = 0;
3168 while (cdesc_out) {
3169 dma_descr_data *td;
3170 printk("cdesc_out %d, desc=0x%p\n", i, cdesc_out->dma_descr);
3171 printk("\n\tvirt_to_phys(desc): 0x%p\n", (char*)virt_to_phys(cdesc_out->dma_descr));
3172 td = cdesc_out->dma_descr;
3173 printk("\n\tbuf: 0x%p\n"
3174 "\tafter: 0x%p\n"
3175 "\tmd: 0x%04x\n"
3176 "\tnext: 0x%p\n",
3177 td->buf,
3178 td->after,
3179 td->md,
3180 td->next);
3181 printk("flags:\n"
3182 "\twait:\t%d\n"
3183 "\teol:\t%d\n"
3184 "\touteop:\t%d\n"
3185 "\tineop:\t%d\n"
3186 "\tintr:\t%d\n",
3187 td->wait,
3188 td->eol,
3189 td->out_eop,
3190 td->in_eop,
3191 td->intr);
3192 cdesc_out = cdesc_out->next;
3193 i++;
3194 }
3195 i = 0;
3196 while (cdesc_in) {
3197 dma_descr_data *td;
3198 printk("cdesc_in %d, desc=0x%p\n", i, cdesc_in->dma_descr);
3199 printk("\n\tvirt_to_phys(desc): 0x%p\n", (char*)virt_to_phys(cdesc_in->dma_descr));
3200 td = cdesc_in->dma_descr;
3201 printk("\n\tbuf: 0x%p\n"
3202 "\tafter: 0x%p\n"
3203 "\tmd: 0x%04x\n"
3204 "\tnext: 0x%p\n",
3205 td->buf,
3206 td->after,
3207 td->md,
3208 td->next);
3209 printk("flags:\n"
3210 "\twait:\t%d\n"
3211 "\teol:\t%d\n"
3212 "\touteop:\t%d\n"
3213 "\tineop:\t%d\n"
3214 "\tintr:\t%d\n",
3215 td->wait,
3216 td->eol,
3217 td->out_eop,
3218 td->in_eop,
3219 td->intr);
3220 cdesc_in = cdesc_in->next;
3221 i++;
3222 }
3223
3224 printk("print_dma_descriptors end\n");
3225}
3226
3227
3228static void print_strcop_crypto_op(struct strcop_crypto_op *cop)
3229{
3230 printk("print_strcop_crypto_op, 0x%p\n", cop);
3231
3232 /* Indata. */
3233 printk("indata=0x%p\n"
3234 "inlen=%d\n"
3235 "do_cipher=%d\n"
3236 "decrypt=%d\n"
3237 "cipher_explicit=%d\n"
3238 "cipher_start=%d\n"
3239 "cipher_len=%d\n"
3240 "outdata=0x%p\n"
3241 "outlen=%d\n",
3242 cop->indata,
3243 cop->inlen,
3244 cop->do_cipher,
3245 cop->decrypt,
3246 cop->cipher_explicit,
3247 cop->cipher_start,
3248 cop->cipher_len,
3249 cop->cipher_outdata,
3250 cop->cipher_outlen);
3251
3252 printk("do_digest=%d\n"
3253 "digest_start=%d\n"
3254 "digest_len=%d\n",
3255 cop->do_digest,
3256 cop->digest_start,
3257 cop->digest_len);
3258
3259 printk("do_csum=%d\n"
3260 "csum_start=%d\n"
3261 "csum_len=%d\n",
3262 cop->do_csum,
3263 cop->csum_start,
3264 cop->csum_len);
3265}
3266
3267static void print_cryptocop_operation(struct cryptocop_operation *cop)
3268{
3269 struct cryptocop_desc *d;
3270 struct cryptocop_tfrm_cfg *tc;
3271 struct cryptocop_desc_cfg *dc;
3272 int i;
3273
3274 printk("print_cryptocop_operation, cop=0x%p\n\n", cop);
3275 printk("sid: %lld\n", cop->sid);
3276 printk("operation_status=%d\n"
3277 "use_dmalists=%d\n"
3278 "in_interrupt=%d\n"
3279 "fast_callback=%d\n",
3280 cop->operation_status,
3281 cop->use_dmalists,
3282 cop->in_interrupt,
3283 cop->fast_callback);
3284
3285 if (cop->use_dmalists){
3286 print_user_dma_lists(&cop->list_op);
3287 } else {
3288 printk("cop->tfrm_op\n"
3289 "tfrm_cfg=0x%p\n"
3290 "desc=0x%p\n"
3291 "indata=0x%p\n"
3292 "incount=%d\n"
3293 "inlen=%d\n"
3294 "outdata=0x%p\n"
3295 "outcount=%d\n"
3296 "outlen=%d\n\n",
3297 cop->tfrm_op.tfrm_cfg,
3298 cop->tfrm_op.desc,
3299 cop->tfrm_op.indata,
3300 cop->tfrm_op.incount,
3301 cop->tfrm_op.inlen,
3302 cop->tfrm_op.outdata,
3303 cop->tfrm_op.outcount,
3304 cop->tfrm_op.outlen);
3305
3306 tc = cop->tfrm_op.tfrm_cfg;
3307 while (tc){
3308 printk("tfrm_cfg, 0x%p\n"
3309 "tid=%d\n"
3310 "flags=%d\n"
3311 "inject_ix=%d\n"
3312 "next=0x%p\n",
3313 tc,
3314 tc->tid,
3315 tc->flags,
3316 tc->inject_ix,
3317 tc->next);
3318 tc = tc->next;
3319 }
3320 d = cop->tfrm_op.desc;
3321 while (d){
3322 printk("\n======================desc, 0x%p\n"
3323 "length=%d\n"
3324 "cfg=0x%p\n"
3325 "next=0x%p\n",
3326 d,
3327 d->length,
3328 d->cfg,
3329 d->next);
3330 dc = d->cfg;
3331 while (dc){
3332 printk("=========desc_cfg, 0x%p\n"
3333 "tid=%d\n"
3334 "src=%d\n"
3335 "last=%d\n"
3336 "next=0x%p\n",
3337 dc,
3338 dc->tid,
3339 dc->src,
3340 dc->last,
3341 dc->next);
3342 dc = dc->next;
3343 }
3344 d = d->next;
3345 }
3346 printk("\n====iniov\n");
3347 for (i = 0; i < cop->tfrm_op.incount; i++){
3348 printk("indata[%d]\n"
3349 "base=0x%p\n"
3350 "len=%d\n",
3351 i,
3352 cop->tfrm_op.indata[i].iov_base,
3353 cop->tfrm_op.indata[i].iov_len);
3354 }
3355 printk("\n====outiov\n");
3356 for (i = 0; i < cop->tfrm_op.outcount; i++){
3357 printk("outdata[%d]\n"
3358 "base=0x%p\n"
3359 "len=%d\n",
3360 i,
3361 cop->tfrm_op.outdata[i].iov_base,
3362 cop->tfrm_op.outdata[i].iov_len);
3363 }
3364 }
3365 printk("------------end print_cryptocop_operation\n");
3366}
3367
3368
3369static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op)
3370{
3371 dma_descr_data *dd;
3372 int i;
3373
3374 printk("print_user_dma_lists, dma_op=0x%p\n", dma_op);
3375
3376 printk("out_data_buf = 0x%p, phys_to_virt(out_data_buf) = 0x%p\n", dma_op->out_data_buf, phys_to_virt((unsigned long int)dma_op->out_data_buf));
3377 printk("in_data_buf = 0x%p, phys_to_virt(in_data_buf) = 0x%p\n", dma_op->in_data_buf, phys_to_virt((unsigned long int)dma_op->in_data_buf));
3378
3379 printk("##############outlist\n");
3380 dd = phys_to_virt((unsigned long int)dma_op->outlist);
3381 i = 0;
3382 while (dd != NULL) {
3383 printk("#%d phys_to_virt(desc) 0x%p\n", i, dd);
3384 printk("\n\tbuf: 0x%p\n"
3385 "\tafter: 0x%p\n"
3386 "\tmd: 0x%04x\n"
3387 "\tnext: 0x%p\n",
3388 dd->buf,
3389 dd->after,
3390 dd->md,
3391 dd->next);
3392 printk("flags:\n"
3393 "\twait:\t%d\n"
3394 "\teol:\t%d\n"
3395 "\touteop:\t%d\n"
3396 "\tineop:\t%d\n"
3397 "\tintr:\t%d\n",
3398 dd->wait,
3399 dd->eol,
3400 dd->out_eop,
3401 dd->in_eop,
3402 dd->intr);
3403 if (dd->eol)
3404 dd = NULL;
3405 else
3406 dd = phys_to_virt((unsigned long int)dd->next);
3407 ++i;
3408 }
3409
3410 printk("##############inlist\n");
3411 dd = phys_to_virt((unsigned long int)dma_op->inlist);
3412 i = 0;
3413 while (dd != NULL) {
3414 printk("#%d phys_to_virt(desc) 0x%p\n", i, dd);
3415 printk("\n\tbuf: 0x%p\n"
3416 "\tafter: 0x%p\n"
3417 "\tmd: 0x%04x\n"
3418 "\tnext: 0x%p\n",
3419 dd->buf,
3420 dd->after,
3421 dd->md,
3422 dd->next);
3423 printk("flags:\n"
3424 "\twait:\t%d\n"
3425 "\teol:\t%d\n"
3426 "\touteop:\t%d\n"
3427 "\tineop:\t%d\n"
3428 "\tintr:\t%d\n",
3429 dd->wait,
3430 dd->eol,
3431 dd->out_eop,
3432 dd->in_eop,
3433 dd->intr);
3434 if (dd->eol)
3435 dd = NULL;
3436 else
3437 dd = phys_to_virt((unsigned long int)dd->next);
3438 ++i;
3439 }
3440}
3441
3442
3443static void print_lock_status(void)
3444{
3445 printk("**********************print_lock_status\n");
3446 printk("cryptocop_completed_jobs_lock %d\n", spin_is_locked(&cryptocop_completed_jobs_lock));
3447 printk("cryptocop_job_queue_lock %d\n", spin_is_locked(&cryptocop_job_queue_lock));
3448 printk("descr_pool_lock %d\n", spin_is_locked(&descr_pool_lock));
3449 printk("cryptocop_sessions_lock %d\n", spin_is_locked(cryptocop_sessions_lock));
3450 printk("running_job_lock %d\n", spin_is_locked(running_job_lock));
3451 printk("cryptocop_process_lock %d\n", spin_is_locked(cryptocop_process_lock));
3452}
3453#endif /* LDEBUG */
3454
3455
3456static const char cryptocop_name[] = "ETRAX FS stream co-processor";
3457
3458static int init_stream_coprocessor(void)
3459{
3460 int err;
3461 int i;
3462 static int initialized = 0;
3463
3464 if (initialized)
3465 return 0;
3466
3467 initialized = 1;
3468
3469 printk("ETRAX FS stream co-processor driver v0.01, (c) 2003 Axis Communications AB\n");
3470
3471 err = register_chrdev(CRYPTOCOP_MAJOR, cryptocop_name, &cryptocop_fops);
3472 if (err < 0) {
3473 printk(KERN_ERR "stream co-processor: could not get major number.\n");
3474 return err;
3475 }
3476
3477 err = init_cryptocop();
3478 if (err) {
3479 (void)unregister_chrdev(CRYPTOCOP_MAJOR, cryptocop_name);
3480 return err;
3481 }
3482 err = cryptocop_job_queue_init();
3483 if (err) {
3484 release_cryptocop();
3485 (void)unregister_chrdev(CRYPTOCOP_MAJOR, cryptocop_name);
3486 return err;
3487 }
3488 /* Init the descriptor pool. */
3489 for (i = 0; i < CRYPTOCOP_DESCRIPTOR_POOL_SIZE - 1; i++) {
3490 descr_pool[i].from_pool = 1;
3491 descr_pool[i].next = &descr_pool[i + 1];
3492 }
3493 descr_pool[i].from_pool = 1;
3494 descr_pool[i].next = NULL;
3495 descr_pool_free_list = &descr_pool[0];
3496 descr_pool_no_free = CRYPTOCOP_DESCRIPTOR_POOL_SIZE;
3497
3498 spin_lock_init(&cryptocop_completed_jobs_lock);
3499 spin_lock_init(&cryptocop_job_queue_lock);
3500 spin_lock_init(&descr_pool_lock);
3501 spin_lock_init(&cryptocop_sessions_lock);
3502 spin_lock_init(&running_job_lock);
3503 spin_lock_init(&cryptocop_process_lock);
3504
3505 cryptocop_sessions = NULL;
3506 next_sid = 1;
3507
3508 cryptocop_running_job = NULL;
3509
3510 printk("stream co-processor: init done.\n");
3511 return 0;
3512}
3513
3514static void __exit exit_stream_coprocessor(void)
3515{
3516 release_cryptocop();
3517 cryptocop_job_queue_close();
3518}
3519
3520module_init(init_stream_coprocessor);
3521module_exit(exit_stream_coprocessor);
3522
diff --git a/arch/cris/arch-v32/drivers/gpio.c b/arch/cris/arch-v32/drivers/gpio.c
new file mode 100644
index 000000000000..a551237dcb5e
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/gpio.c
@@ -0,0 +1,766 @@
1/* $Id: gpio.c,v 1.16 2005/06/19 17:06:49 starvik Exp $
2 *
3 * ETRAX CRISv32 general port I/O device
4 *
5 * Copyright (c) 1999, 2000, 2001, 2002, 2003 Axis Communications AB
6 *
7 * Authors: Bjorn Wesen (initial version)
8 * Ola Knutsson (LED handling)
9 * Johan Adolfsson (read/set directions, write, port G,
10 * port to ETRAX FS.
11 *
12 * $Log: gpio.c,v $
13 * Revision 1.16 2005/06/19 17:06:49 starvik
14 * Merge of Linux 2.6.12.
15 *
16 * Revision 1.15 2005/05/25 08:22:20 starvik
17 * Changed GPIO port order to fit packages/devices/axis-2.4.
18 *
19 * Revision 1.14 2005/04/24 18:35:08 starvik
20 * Updated with final register headers.
21 *
22 * Revision 1.13 2005/03/15 15:43:00 starvik
23 * dev_id needs to be supplied for shared IRQs.
24 *
25 * Revision 1.12 2005/03/10 17:12:00 starvik
26 * Protect alarm list with spinlock.
27 *
28 * Revision 1.11 2005/01/05 06:08:59 starvik
29 * No need to do local_irq_disable after local_irq_save.
30 *
31 * Revision 1.10 2004/11/19 08:38:31 starvik
32 * Removed old crap.
33 *
34 * Revision 1.9 2004/05/14 07:58:02 starvik
35 * Merge of changes from 2.4
36 *
37 * Revision 1.8 2003/09/11 07:29:50 starvik
38 * Merge of Linux 2.6.0-test5
39 *
40 * Revision 1.7 2003/07/10 13:25:46 starvik
41 * Compiles for 2.5.74
42 * Lindented ethernet.c
43 *
44 * Revision 1.6 2003/07/04 08:27:46 starvik
45 * Merge of Linux 2.5.74
46 *
47 * Revision 1.5 2003/06/10 08:26:37 johana
48 * Etrax -> ETRAX CRISv32
49 *
50 * Revision 1.4 2003/06/05 14:22:48 johana
51 * Initialise some_alarms.
52 *
53 * Revision 1.3 2003/06/05 10:15:46 johana
54 * New INTR_VECT macros.
55 * Enable interrupts in global config.
56 *
57 * Revision 1.2 2003/06/03 15:52:50 johana
58 * Initial CRIS v32 version.
59 *
60 * Revision 1.1 2003/06/03 08:53:15 johana
61 * Copy of os/lx25/arch/cris/arch-v10/drivers/gpio.c version 1.7.
62 *
63 */
64
65#include <linux/config.h>
66
67#include <linux/module.h>
68#include <linux/sched.h>
69#include <linux/slab.h>
70#include <linux/ioport.h>
71#include <linux/errno.h>
72#include <linux/kernel.h>
73#include <linux/fs.h>
74#include <linux/string.h>
75#include <linux/poll.h>
76#include <linux/init.h>
77#include <linux/interrupt.h>
78#include <linux/spinlock.h>
79
80#include <asm/etraxgpio.h>
81#include <asm/arch/hwregs/reg_map.h>
82#include <asm/arch/hwregs/reg_rdwr.h>
83#include <asm/arch/hwregs/gio_defs.h>
84#include <asm/arch/hwregs/intr_vect_defs.h>
85#include <asm/io.h>
86#include <asm/system.h>
87#include <asm/irq.h>
88
89/* The following gio ports on ETRAX FS is available:
90 * pa 8 bits, supports interrupts off, hi, low, set, posedge, negedge anyedge
91 * pb 18 bits
92 * pc 18 bits
93 * pd 18 bits
94 * pe 18 bits
95 * each port has a rw_px_dout, r_px_din and rw_px_oe register.
96 */
97
98#define GPIO_MAJOR 120 /* experimental MAJOR number */
99
100#define D(x)
101
102#if 0
103static int dp_cnt;
104#define DP(x) do { dp_cnt++; if (dp_cnt % 1000 == 0) x; }while(0)
105#else
106#define DP(x)
107#endif
108
109static char gpio_name[] = "etrax gpio";
110
111#if 0
112static wait_queue_head_t *gpio_wq;
113#endif
114
115static int gpio_ioctl(struct inode *inode, struct file *file,
116 unsigned int cmd, unsigned long arg);
117static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
118 loff_t *off);
119static int gpio_open(struct inode *inode, struct file *filp);
120static int gpio_release(struct inode *inode, struct file *filp);
121static unsigned int gpio_poll(struct file *filp, struct poll_table_struct *wait);
122
123/* private data per open() of this driver */
124
125struct gpio_private {
126 struct gpio_private *next;
127 /* The IO_CFG_WRITE_MODE_VALUE only support 8 bits: */
128 unsigned char clk_mask;
129 unsigned char data_mask;
130 unsigned char write_msb;
131 unsigned char pad1;
132 /* These fields are generic */
133 unsigned long highalarm, lowalarm;
134 wait_queue_head_t alarm_wq;
135 int minor;
136};
137
138/* linked list of alarms to check for */
139
140static struct gpio_private *alarmlist = 0;
141
142static int gpio_some_alarms = 0; /* Set if someone uses alarm */
143static unsigned long gpio_pa_high_alarms = 0;
144static unsigned long gpio_pa_low_alarms = 0;
145
146static DEFINE_SPINLOCK(alarm_lock);
147
148#define NUM_PORTS (GPIO_MINOR_LAST+1)
149#define GIO_REG_RD_ADDR(reg) (volatile unsigned long*) (regi_gio + REG_RD_ADDR_gio_##reg )
150#define GIO_REG_WR_ADDR(reg) (volatile unsigned long*) (regi_gio + REG_RD_ADDR_gio_##reg )
151unsigned long led_dummy;
152
153static volatile unsigned long *data_out[NUM_PORTS] = {
154 GIO_REG_WR_ADDR(rw_pa_dout),
155 GIO_REG_WR_ADDR(rw_pb_dout),
156 &led_dummy,
157 GIO_REG_WR_ADDR(rw_pc_dout),
158 GIO_REG_WR_ADDR(rw_pd_dout),
159 GIO_REG_WR_ADDR(rw_pe_dout),
160};
161
162static volatile unsigned long *data_in[NUM_PORTS] = {
163 GIO_REG_RD_ADDR(r_pa_din),
164 GIO_REG_RD_ADDR(r_pb_din),
165 &led_dummy,
166 GIO_REG_RD_ADDR(r_pc_din),
167 GIO_REG_RD_ADDR(r_pd_din),
168 GIO_REG_RD_ADDR(r_pe_din),
169};
170
171static unsigned long changeable_dir[NUM_PORTS] = {
172 CONFIG_ETRAX_PA_CHANGEABLE_DIR,
173 CONFIG_ETRAX_PB_CHANGEABLE_DIR,
174 0,
175 CONFIG_ETRAX_PC_CHANGEABLE_DIR,
176 CONFIG_ETRAX_PD_CHANGEABLE_DIR,
177 CONFIG_ETRAX_PE_CHANGEABLE_DIR,
178};
179
180static unsigned long changeable_bits[NUM_PORTS] = {
181 CONFIG_ETRAX_PA_CHANGEABLE_BITS,
182 CONFIG_ETRAX_PB_CHANGEABLE_BITS,
183 0,
184 CONFIG_ETRAX_PC_CHANGEABLE_BITS,
185 CONFIG_ETRAX_PD_CHANGEABLE_BITS,
186 CONFIG_ETRAX_PE_CHANGEABLE_BITS,
187};
188
189static volatile unsigned long *dir_oe[NUM_PORTS] = {
190 GIO_REG_WR_ADDR(rw_pa_oe),
191 GIO_REG_WR_ADDR(rw_pb_oe),
192 &led_dummy,
193 GIO_REG_WR_ADDR(rw_pc_oe),
194 GIO_REG_WR_ADDR(rw_pd_oe),
195 GIO_REG_WR_ADDR(rw_pe_oe),
196};
197
198
199
200static unsigned int
201gpio_poll(struct file *file,
202 poll_table *wait)
203{
204 unsigned int mask = 0;
205 struct gpio_private *priv = (struct gpio_private *)file->private_data;
206 unsigned long data;
207 poll_wait(file, &priv->alarm_wq, wait);
208 if (priv->minor == GPIO_MINOR_A) {
209 reg_gio_rw_intr_cfg intr_cfg;
210 unsigned long tmp;
211 unsigned long flags;
212
213 local_irq_save(flags);
214 data = REG_TYPE_CONV(unsigned long, reg_gio_r_pa_din, REG_RD(gio, regi_gio, r_pa_din));
215 /* PA has support for interrupt
216 * lets activate high for those low and with highalarm set
217 */
218 intr_cfg = REG_RD(gio, regi_gio, rw_intr_cfg);
219
220 tmp = ~data & priv->highalarm & 0xFF;
221 if (tmp & (1 << 0)) {
222 intr_cfg.pa0 = regk_gio_hi;
223 }
224 if (tmp & (1 << 1)) {
225 intr_cfg.pa1 = regk_gio_hi;
226 }
227 if (tmp & (1 << 2)) {
228 intr_cfg.pa2 = regk_gio_hi;
229 }
230 if (tmp & (1 << 3)) {
231 intr_cfg.pa3 = regk_gio_hi;
232 }
233 if (tmp & (1 << 4)) {
234 intr_cfg.pa4 = regk_gio_hi;
235 }
236 if (tmp & (1 << 5)) {
237 intr_cfg.pa5 = regk_gio_hi;
238 }
239 if (tmp & (1 << 6)) {
240 intr_cfg.pa6 = regk_gio_hi;
241 }
242 if (tmp & (1 << 7)) {
243 intr_cfg.pa7 = regk_gio_hi;
244 }
245 /*
246 * lets activate low for those high and with lowalarm set
247 */
248 tmp = data & priv->lowalarm & 0xFF;
249 if (tmp & (1 << 0)) {
250 intr_cfg.pa0 = regk_gio_lo;
251 }
252 if (tmp & (1 << 1)) {
253 intr_cfg.pa1 = regk_gio_lo;
254 }
255 if (tmp & (1 << 2)) {
256 intr_cfg.pa2 = regk_gio_lo;
257 }
258 if (tmp & (1 << 3)) {
259 intr_cfg.pa3 = regk_gio_lo;
260 }
261 if (tmp & (1 << 4)) {
262 intr_cfg.pa4 = regk_gio_lo;
263 }
264 if (tmp & (1 << 5)) {
265 intr_cfg.pa5 = regk_gio_lo;
266 }
267 if (tmp & (1 << 6)) {
268 intr_cfg.pa6 = regk_gio_lo;
269 }
270 if (tmp & (1 << 7)) {
271 intr_cfg.pa7 = regk_gio_lo;
272 }
273
274 REG_WR(gio, regi_gio, rw_intr_cfg, intr_cfg);
275 local_irq_restore(flags);
276 } else if (priv->minor <= GPIO_MINOR_E)
277 data = *data_in[priv->minor];
278 else
279 return 0;
280
281 if ((data & priv->highalarm) ||
282 (~data & priv->lowalarm)) {
283 mask = POLLIN|POLLRDNORM;
284 }
285
286 DP(printk("gpio_poll ready: mask 0x%08X\n", mask));
287 return mask;
288}
289
290int etrax_gpio_wake_up_check(void)
291{
292 struct gpio_private *priv = alarmlist;
293 unsigned long data = 0;
294 int ret = 0;
295 while (priv) {
296 data = *data_in[priv->minor];
297 if ((data & priv->highalarm) ||
298 (~data & priv->lowalarm)) {
299 DP(printk("etrax_gpio_wake_up_check %i\n",priv->minor));
300 wake_up_interruptible(&priv->alarm_wq);
301 ret = 1;
302 }
303 priv = priv->next;
304 }
305 return ret;
306}
307
308static irqreturn_t
309gpio_poll_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
310{
311 if (gpio_some_alarms) {
312 return IRQ_RETVAL(etrax_gpio_wake_up_check());
313 }
314 return IRQ_NONE;
315}
316
317static irqreturn_t
318gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
319{
320 reg_gio_rw_intr_mask intr_mask;
321 reg_gio_r_masked_intr masked_intr;
322 reg_gio_rw_ack_intr ack_intr;
323 unsigned long tmp;
324 unsigned long tmp2;
325
326 /* Find what PA interrupts are active */
327 masked_intr = REG_RD(gio, regi_gio, r_masked_intr);
328 tmp = REG_TYPE_CONV(unsigned long, reg_gio_r_masked_intr, masked_intr);
329
330 /* Find those that we have enabled */
331 spin_lock(&alarm_lock);
332 tmp &= (gpio_pa_high_alarms | gpio_pa_low_alarms);
333 spin_unlock(&alarm_lock);
334
335 /* Ack them */
336 ack_intr = REG_TYPE_CONV(reg_gio_rw_ack_intr, unsigned long, tmp);
337 REG_WR(gio, regi_gio, rw_ack_intr, ack_intr);
338
339 /* Disable those interrupts.. */
340 intr_mask = REG_RD(gio, regi_gio, rw_intr_mask);
341 tmp2 = REG_TYPE_CONV(unsigned long, reg_gio_rw_intr_mask, intr_mask);
342 tmp2 &= ~tmp;
343 intr_mask = REG_TYPE_CONV(reg_gio_rw_intr_mask, unsigned long, tmp2);
344 REG_WR(gio, regi_gio, rw_intr_mask, intr_mask);
345
346 if (gpio_some_alarms) {
347 return IRQ_RETVAL(etrax_gpio_wake_up_check());
348 }
349 return IRQ_NONE;
350}
351
352
353static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
354 loff_t *off)
355{
356 struct gpio_private *priv = (struct gpio_private *)file->private_data;
357 unsigned char data, clk_mask, data_mask, write_msb;
358 unsigned long flags;
359 unsigned long shadow;
360 volatile unsigned long *port;
361 ssize_t retval = count;
362 /* Only bits 0-7 may be used for write operations but allow all
363 devices except leds... */
364 if (priv->minor == GPIO_MINOR_LEDS) {
365 return -EFAULT;
366 }
367
368 if (!access_ok(VERIFY_READ, buf, count)) {
369 return -EFAULT;
370 }
371 clk_mask = priv->clk_mask;
372 data_mask = priv->data_mask;
373 /* It must have been configured using the IO_CFG_WRITE_MODE */
374 /* Perhaps a better error code? */
375 if (clk_mask == 0 || data_mask == 0) {
376 return -EPERM;
377 }
378 write_msb = priv->write_msb;
379 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb));
380 port = data_out[priv->minor];
381
382 while (count--) {
383 int i;
384 data = *buf++;
385 if (priv->write_msb) {
386 for (i = 7; i >= 0;i--) {
387 local_irq_save(flags);
388 shadow = *port;
389 *port = shadow &= ~clk_mask;
390 if (data & 1<<i)
391 *port = shadow |= data_mask;
392 else
393 *port = shadow &= ~data_mask;
394 /* For FPGA: min 5.0ns (DCC) before CCLK high */
395 *port = shadow |= clk_mask;
396 local_irq_restore(flags);
397 }
398 } else {
399 for (i = 0; i <= 7;i++) {
400 local_irq_save(flags);
401 shadow = *port;
402 *port = shadow &= ~clk_mask;
403 if (data & 1<<i)
404 *port = shadow |= data_mask;
405 else
406 *port = shadow &= ~data_mask;
407 /* For FPGA: min 5.0ns (DCC) before CCLK high */
408 *port = shadow |= clk_mask;
409 local_irq_restore(flags);
410 }
411 }
412 }
413 return retval;
414}
415
416
417
418static int
419gpio_open(struct inode *inode, struct file *filp)
420{
421 struct gpio_private *priv;
422 int p = MINOR(inode->i_rdev);
423
424 if (p > GPIO_MINOR_LAST)
425 return -EINVAL;
426
427 priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private),
428 GFP_KERNEL);
429
430 if (!priv)
431 return -ENOMEM;
432
433 priv->minor = p;
434
435 /* initialize the io/alarm struct and link it into our alarmlist */
436
437 priv->next = alarmlist;
438 alarmlist = priv;
439 priv->clk_mask = 0;
440 priv->data_mask = 0;
441 priv->highalarm = 0;
442 priv->lowalarm = 0;
443 init_waitqueue_head(&priv->alarm_wq);
444
445 filp->private_data = (void *)priv;
446
447 return 0;
448}
449
450static int
451gpio_release(struct inode *inode, struct file *filp)
452{
453 struct gpio_private *p = alarmlist;
454 struct gpio_private *todel = (struct gpio_private *)filp->private_data;
455 /* local copies while updating them: */
456 unsigned long a_high, a_low;
457 unsigned long some_alarms;
458
459 /* unlink from alarmlist and free the private structure */
460
461 if (p == todel) {
462 alarmlist = todel->next;
463 } else {
464 while (p->next != todel)
465 p = p->next;
466 p->next = todel->next;
467 }
468
469 kfree(todel);
470 /* Check if there are still any alarms set */
471 p = alarmlist;
472 some_alarms = 0;
473 a_high = 0;
474 a_low = 0;
475 while (p) {
476 if (p->minor == GPIO_MINOR_A) {
477 a_high |= p->highalarm;
478 a_low |= p->lowalarm;
479 }
480
481 if (p->highalarm | p->lowalarm) {
482 some_alarms = 1;
483 }
484 p = p->next;
485 }
486
487 spin_lock(&alarm_lock);
488 gpio_some_alarms = some_alarms;
489 gpio_pa_high_alarms = a_high;
490 gpio_pa_low_alarms = a_low;
491 spin_unlock(&alarm_lock);
492
493 return 0;
494}
495
496/* Main device API. ioctl's to read/set/clear bits, as well as to
497 * set alarms to wait for using a subsequent select().
498 */
499
500unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
501{
502 /* Set direction 0=unchanged 1=input,
503 * return mask with 1=input
504 */
505 unsigned long flags;
506 unsigned long dir_shadow;
507
508 local_irq_save(flags);
509 dir_shadow = *dir_oe[priv->minor];
510 dir_shadow &= ~(arg & changeable_dir[priv->minor]);
511 *dir_oe[priv->minor] = dir_shadow;
512 local_irq_restore(flags);
513
514 if (priv->minor == GPIO_MINOR_A)
515 dir_shadow ^= 0xFF; /* Only 8 bits */
516 else
517 dir_shadow ^= 0x3FFFF; /* Only 18 bits */
518 return dir_shadow;
519
520} /* setget_input */
521
522unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
523{
524 unsigned long flags;
525 unsigned long dir_shadow;
526
527 local_irq_save(flags);
528 dir_shadow = *dir_oe[priv->minor];
529 dir_shadow |= (arg & changeable_dir[priv->minor]);
530 *dir_oe[priv->minor] = dir_shadow;
531 local_irq_restore(flags);
532 return dir_shadow;
533} /* setget_output */
534
535static int
536gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
537
538static int
539gpio_ioctl(struct inode *inode, struct file *file,
540 unsigned int cmd, unsigned long arg)
541{
542 unsigned long flags;
543 unsigned long val;
544 unsigned long shadow;
545 struct gpio_private *priv = (struct gpio_private *)file->private_data;
546 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {
547 return -EINVAL;
548 }
549
550 switch (_IOC_NR(cmd)) {
551 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */
552 // read the port
553 return *data_in[priv->minor];
554 break;
555 case IO_SETBITS:
556 local_irq_save(flags);
557 if (arg & 0x04)
558 printk("GPIO SET 2\n");
559 // set changeable bits with a 1 in arg
560 shadow = *data_out[priv->minor];
561 shadow |= (arg & changeable_bits[priv->minor]);
562 *data_out[priv->minor] = shadow;
563 local_irq_restore(flags);
564 break;
565 case IO_CLRBITS:
566 local_irq_save(flags);
567 if (arg & 0x04)
568 printk("GPIO CLR 2\n");
569 // clear changeable bits with a 1 in arg
570 shadow = *data_out[priv->minor];
571 shadow &= ~(arg & changeable_bits[priv->minor]);
572 *data_out[priv->minor] = shadow;
573 local_irq_restore(flags);
574 break;
575 case IO_HIGHALARM:
576 // set alarm when bits with 1 in arg go high
577 priv->highalarm |= arg;
578 spin_lock(&alarm_lock);
579 gpio_some_alarms = 1;
580 if (priv->minor == GPIO_MINOR_A) {
581 gpio_pa_high_alarms |= arg;
582 }
583 spin_unlock(&alarm_lock);
584 break;
585 case IO_LOWALARM:
586 // set alarm when bits with 1 in arg go low
587 priv->lowalarm |= arg;
588 spin_lock(&alarm_lock);
589 gpio_some_alarms = 1;
590 if (priv->minor == GPIO_MINOR_A) {
591 gpio_pa_low_alarms |= arg;
592 }
593 spin_unlock(&alarm_lock);
594 break;
595 case IO_CLRALARM:
596 // clear alarm for bits with 1 in arg
597 priv->highalarm &= ~arg;
598 priv->lowalarm &= ~arg;
599 spin_lock(&alarm_lock);
600 if (priv->minor == GPIO_MINOR_A) {
601 if (gpio_pa_high_alarms & arg ||
602 gpio_pa_low_alarms & arg) {
603 /* Must update the gpio_pa_*alarms masks */
604 }
605 }
606 spin_unlock(&alarm_lock);
607 break;
608 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
609 /* Read direction 0=input 1=output */
610 return *dir_oe[priv->minor];
611 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */
612 /* Set direction 0=unchanged 1=input,
613 * return mask with 1=input
614 */
615 return setget_input(priv, arg);
616 break;
617 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */
618 /* Set direction 0=unchanged 1=output,
619 * return mask with 1=output
620 */
621 return setget_output(priv, arg);
622
623 case IO_CFG_WRITE_MODE:
624 {
625 unsigned long dir_shadow;
626 dir_shadow = *dir_oe[priv->minor];
627
628 priv->clk_mask = arg & 0xFF;
629 priv->data_mask = (arg >> 8) & 0xFF;
630 priv->write_msb = (arg >> 16) & 0x01;
631 /* Check if we're allowed to change the bits and
632 * the direction is correct
633 */
634 if (!((priv->clk_mask & changeable_bits[priv->minor]) &&
635 (priv->data_mask & changeable_bits[priv->minor]) &&
636 (priv->clk_mask & dir_shadow) &&
637 (priv->data_mask & dir_shadow)))
638 {
639 priv->clk_mask = 0;
640 priv->data_mask = 0;
641 return -EPERM;
642 }
643 break;
644 }
645 case IO_READ_INBITS:
646 /* *arg is result of reading the input pins */
647 val = *data_in[priv->minor];
648 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
649 return -EFAULT;
650 return 0;
651 break;
652 case IO_READ_OUTBITS:
653 /* *arg is result of reading the output shadow */
654 val = *data_out[priv->minor];
655 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
656 return -EFAULT;
657 break;
658 case IO_SETGET_INPUT:
659 /* bits set in *arg is set to input,
660 * *arg updated with current input pins.
661 */
662 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
663 return -EFAULT;
664 val = setget_input(priv, val);
665 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
666 return -EFAULT;
667 break;
668 case IO_SETGET_OUTPUT:
669 /* bits set in *arg is set to output,
670 * *arg updated with current output pins.
671 */
672 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
673 return -EFAULT;
674 val = setget_output(priv, val);
675 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
676 return -EFAULT;
677 break;
678 default:
679 if (priv->minor == GPIO_MINOR_LEDS)
680 return gpio_leds_ioctl(cmd, arg);
681 else
682 return -EINVAL;
683 } /* switch */
684
685 return 0;
686}
687
688static int
689gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
690{
691 unsigned char green;
692 unsigned char red;
693
694 switch (_IOC_NR(cmd)) {
695 case IO_LEDACTIVE_SET:
696 green = ((unsigned char) arg) & 1;
697 red = (((unsigned char) arg) >> 1) & 1;
698 LED_ACTIVE_SET_G(green);
699 LED_ACTIVE_SET_R(red);
700 break;
701
702 default:
703 return -EINVAL;
704 } /* switch */
705
706 return 0;
707}
708
709struct file_operations gpio_fops = {
710 .owner = THIS_MODULE,
711 .poll = gpio_poll,
712 .ioctl = gpio_ioctl,
713 .write = gpio_write,
714 .open = gpio_open,
715 .release = gpio_release,
716};
717
718
719/* main driver initialization routine, called from mem.c */
720
721static __init int
722gpio_init(void)
723{
724 int res;
725 reg_intr_vect_rw_mask intr_mask;
726
727 /* do the formalities */
728
729 res = register_chrdev(GPIO_MAJOR, gpio_name, &gpio_fops);
730 if (res < 0) {
731 printk(KERN_ERR "gpio: couldn't get a major number.\n");
732 return res;
733 }
734
735 /* Clear all leds */
736 LED_NETWORK_SET(0);
737 LED_ACTIVE_SET(0);
738 LED_DISK_READ(0);
739 LED_DISK_WRITE(0);
740
741 printk("ETRAX FS GPIO driver v2.5, (c) 2003-2005 Axis Communications AB\n");
742 /* We call etrax_gpio_wake_up_check() from timer interrupt and
743 * from cpu_idle() in kernel/process.c
744 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
745 * in some tests.
746 */
747 if (request_irq(TIMER_INTR_VECT, gpio_poll_timer_interrupt,
748 SA_SHIRQ | SA_INTERRUPT,"gpio poll", &alarmlist)) {
749 printk("err: timer0 irq for gpio\n");
750 }
751 if (request_irq(GEN_IO_INTR_VECT, gpio_pa_interrupt,
752 SA_SHIRQ | SA_INTERRUPT,"gpio PA", &alarmlist)) {
753 printk("err: PA irq for gpio\n");
754 }
755 /* enable the gio and timer irq in global config */
756 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
757 intr_mask.timer = 1;
758 intr_mask.gen_io = 1;
759 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
760
761 return res;
762}
763
764/* this makes sure that gpio_init is called during kernel boot */
765
766module_init(gpio_init);
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
new file mode 100644
index 000000000000..440c20a94963
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -0,0 +1,611 @@
1/*!***************************************************************************
2*!
3*! FILE NAME : i2c.c
4*!
5*! DESCRIPTION: implements an interface for IIC/I2C, both directly from other
6*! kernel modules (i2c_writereg/readreg) and from userspace using
7*! ioctl()'s
8*!
9*! Nov 30 1998 Torbjorn Eliasson Initial version.
10*! Bjorn Wesen Elinux kernel version.
11*! Jan 14 2000 Johan Adolfsson Fixed PB shadow register stuff -
12*! don't use PB_I2C if DS1302 uses same bits,
13*! use PB.
14*| June 23 2003 Pieter Grimmerink Added 'i2c_sendnack'. i2c_readreg now
15*| generates nack on last received byte,
16*| instead of ack.
17*| i2c_getack changed data level while clock
18*| was high, causing DS75 to see a stop condition
19*!
20*! ---------------------------------------------------------------------------
21*!
22*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
23*!
24*!***************************************************************************/
25/* $Id: i2c.c,v 1.2 2005/05/09 15:29:49 starvik Exp $ */
26/****************** INCLUDE FILES SECTION ***********************************/
27
28#include <linux/module.h>
29#include <linux/sched.h>
30#include <linux/slab.h>
31#include <linux/errno.h>
32#include <linux/kernel.h>
33#include <linux/fs.h>
34#include <linux/string.h>
35#include <linux/init.h>
36#include <linux/config.h>
37
38#include <asm/etraxi2c.h>
39
40#include <asm/system.h>
41#include <asm/io.h>
42#include <asm/delay.h>
43
44#include "i2c.h"
45
46/****************** I2C DEFINITION SECTION *************************/
47
48#define D(x)
49
50#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */
51static const char i2c_name[] = "i2c";
52
53#define CLOCK_LOW_TIME 8
54#define CLOCK_HIGH_TIME 8
55#define START_CONDITION_HOLD_TIME 8
56#define STOP_CONDITION_HOLD_TIME 8
57#define ENABLE_OUTPUT 0x01
58#define ENABLE_INPUT 0x00
59#define I2C_CLOCK_HIGH 1
60#define I2C_CLOCK_LOW 0
61#define I2C_DATA_HIGH 1
62#define I2C_DATA_LOW 0
63
64#define i2c_enable()
65#define i2c_disable()
66
67/* enable or disable output-enable, to select output or input on the i2c bus */
68
69#define i2c_dir_out() crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_out)
70#define i2c_dir_in() crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_in)
71
72/* control the i2c clock and data signals */
73
74#define i2c_clk(x) crisv32_io_set(&cris_i2c_clk, x)
75#define i2c_data(x) crisv32_io_set(&cris_i2c_data, x)
76
77/* read a bit from the i2c interface */
78
79#define i2c_getbit() crisv32_io_rd(&cris_i2c_data)
80
81#define i2c_delay(usecs) udelay(usecs)
82
83/****************** VARIABLE SECTION ************************************/
84
85static struct crisv32_iopin cris_i2c_clk;
86static struct crisv32_iopin cris_i2c_data;
87
88/****************** FUNCTION DEFINITION SECTION *************************/
89
90
91/* generate i2c start condition */
92
93void
94i2c_start(void)
95{
96 /*
97 * SCL=1 SDA=1
98 */
99 i2c_dir_out();
100 i2c_delay(CLOCK_HIGH_TIME/6);
101 i2c_data(I2C_DATA_HIGH);
102 i2c_clk(I2C_CLOCK_HIGH);
103 i2c_delay(CLOCK_HIGH_TIME);
104 /*
105 * SCL=1 SDA=0
106 */
107 i2c_data(I2C_DATA_LOW);
108 i2c_delay(START_CONDITION_HOLD_TIME);
109 /*
110 * SCL=0 SDA=0
111 */
112 i2c_clk(I2C_CLOCK_LOW);
113 i2c_delay(CLOCK_LOW_TIME);
114}
115
116/* generate i2c stop condition */
117
118void
119i2c_stop(void)
120{
121 i2c_dir_out();
122
123 /*
124 * SCL=0 SDA=0
125 */
126 i2c_clk(I2C_CLOCK_LOW);
127 i2c_data(I2C_DATA_LOW);
128 i2c_delay(CLOCK_LOW_TIME*2);
129 /*
130 * SCL=1 SDA=0
131 */
132 i2c_clk(I2C_CLOCK_HIGH);
133 i2c_delay(CLOCK_HIGH_TIME*2);
134 /*
135 * SCL=1 SDA=1
136 */
137 i2c_data(I2C_DATA_HIGH);
138 i2c_delay(STOP_CONDITION_HOLD_TIME);
139
140 i2c_dir_in();
141}
142
143/* write a byte to the i2c interface */
144
145void
146i2c_outbyte(unsigned char x)
147{
148 int i;
149
150 i2c_dir_out();
151
152 for (i = 0; i < 8; i++) {
153 if (x & 0x80) {
154 i2c_data(I2C_DATA_HIGH);
155 } else {
156 i2c_data(I2C_DATA_LOW);
157 }
158
159 i2c_delay(CLOCK_LOW_TIME/2);
160 i2c_clk(I2C_CLOCK_HIGH);
161 i2c_delay(CLOCK_HIGH_TIME);
162 i2c_clk(I2C_CLOCK_LOW);
163 i2c_delay(CLOCK_LOW_TIME/2);
164 x <<= 1;
165 }
166 i2c_data(I2C_DATA_LOW);
167 i2c_delay(CLOCK_LOW_TIME/2);
168
169 /*
170 * enable input
171 */
172 i2c_dir_in();
173}
174
175/* read a byte from the i2c interface */
176
177unsigned char
178i2c_inbyte(void)
179{
180 unsigned char aBitByte = 0;
181 int i;
182
183 /* Switch off I2C to get bit */
184 i2c_disable();
185 i2c_dir_in();
186 i2c_delay(CLOCK_HIGH_TIME/2);
187
188 /* Get bit */
189 aBitByte |= i2c_getbit();
190
191 /* Enable I2C */
192 i2c_enable();
193 i2c_delay(CLOCK_LOW_TIME/2);
194
195 for (i = 1; i < 8; i++) {
196 aBitByte <<= 1;
197 /* Clock pulse */
198 i2c_clk(I2C_CLOCK_HIGH);
199 i2c_delay(CLOCK_HIGH_TIME);
200 i2c_clk(I2C_CLOCK_LOW);
201 i2c_delay(CLOCK_LOW_TIME);
202
203 /* Switch off I2C to get bit */
204 i2c_disable();
205 i2c_dir_in();
206 i2c_delay(CLOCK_HIGH_TIME/2);
207
208 /* Get bit */
209 aBitByte |= i2c_getbit();
210
211 /* Enable I2C */
212 i2c_enable();
213 i2c_delay(CLOCK_LOW_TIME/2);
214 }
215 i2c_clk(I2C_CLOCK_HIGH);
216 i2c_delay(CLOCK_HIGH_TIME);
217
218 /*
219 * we leave the clock low, getbyte is usually followed
220 * by sendack/nack, they assume the clock to be low
221 */
222 i2c_clk(I2C_CLOCK_LOW);
223 return aBitByte;
224}
225
226/*#---------------------------------------------------------------------------
227*#
228*# FUNCTION NAME: i2c_getack
229*#
230*# DESCRIPTION : checks if ack was received from ic2
231*#
232*#--------------------------------------------------------------------------*/
233
234int
235i2c_getack(void)
236{
237 int ack = 1;
238 /*
239 * enable output
240 */
241 i2c_dir_out();
242 /*
243 * Release data bus by setting
244 * data high
245 */
246 i2c_data(I2C_DATA_HIGH);
247 /*
248 * enable input
249 */
250 i2c_dir_in();
251 i2c_delay(CLOCK_HIGH_TIME/4);
252 /*
253 * generate ACK clock pulse
254 */
255 i2c_clk(I2C_CLOCK_HIGH);
256 /*
257 * Use PORT PB instead of I2C
258 * for input. (I2C not working)
259 */
260 i2c_clk(1);
261 i2c_data(1);
262 /*
263 * switch off I2C
264 */
265 i2c_data(1);
266 i2c_disable();
267 i2c_dir_in();
268 /*
269 * now wait for ack
270 */
271 i2c_delay(CLOCK_HIGH_TIME/2);
272 /*
273 * check for ack
274 */
275 if(i2c_getbit())
276 ack = 0;
277 i2c_delay(CLOCK_HIGH_TIME/2);
278 if(!ack){
279 if(!i2c_getbit()) /* receiver pulld SDA low */
280 ack = 1;
281 i2c_delay(CLOCK_HIGH_TIME/2);
282 }
283
284 /*
285 * our clock is high now, make sure data is low
286 * before we enable our output. If we keep data high
287 * and enable output, we would generate a stop condition.
288 */
289 i2c_data(I2C_DATA_LOW);
290
291 /*
292 * end clock pulse
293 */
294 i2c_enable();
295 i2c_dir_out();
296 i2c_clk(I2C_CLOCK_LOW);
297 i2c_delay(CLOCK_HIGH_TIME/4);
298 /*
299 * enable output
300 */
301 i2c_dir_out();
302 /*
303 * remove ACK clock pulse
304 */
305 i2c_data(I2C_DATA_HIGH);
306 i2c_delay(CLOCK_LOW_TIME/2);
307 return ack;
308}
309
310/*#---------------------------------------------------------------------------
311*#
312*# FUNCTION NAME: I2C::sendAck
313*#
314*# DESCRIPTION : Send ACK on received data
315*#
316*#--------------------------------------------------------------------------*/
317void
318i2c_sendack(void)
319{
320 /*
321 * enable output
322 */
323 i2c_delay(CLOCK_LOW_TIME);
324 i2c_dir_out();
325 /*
326 * set ack pulse high
327 */
328 i2c_data(I2C_DATA_LOW);
329 /*
330 * generate clock pulse
331 */
332 i2c_delay(CLOCK_HIGH_TIME/6);
333 i2c_clk(I2C_CLOCK_HIGH);
334 i2c_delay(CLOCK_HIGH_TIME);
335 i2c_clk(I2C_CLOCK_LOW);
336 i2c_delay(CLOCK_LOW_TIME/6);
337 /*
338 * reset data out
339 */
340 i2c_data(I2C_DATA_HIGH);
341 i2c_delay(CLOCK_LOW_TIME);
342
343 i2c_dir_in();
344}
345
346/*#---------------------------------------------------------------------------
347*#
348*# FUNCTION NAME: i2c_sendnack
349*#
350*# DESCRIPTION : Sends NACK on received data
351*#
352*#--------------------------------------------------------------------------*/
353void
354i2c_sendnack(void)
355{
356 /*
357 * enable output
358 */
359 i2c_delay(CLOCK_LOW_TIME);
360 i2c_dir_out();
361 /*
362 * set data high
363 */
364 i2c_data(I2C_DATA_HIGH);
365 /*
366 * generate clock pulse
367 */
368 i2c_delay(CLOCK_HIGH_TIME/6);
369 i2c_clk(I2C_CLOCK_HIGH);
370 i2c_delay(CLOCK_HIGH_TIME);
371 i2c_clk(I2C_CLOCK_LOW);
372 i2c_delay(CLOCK_LOW_TIME);
373
374 i2c_dir_in();
375}
376
377/*#---------------------------------------------------------------------------
378*#
379*# FUNCTION NAME: i2c_writereg
380*#
381*# DESCRIPTION : Writes a value to an I2C device
382*#
383*#--------------------------------------------------------------------------*/
384int
385i2c_writereg(unsigned char theSlave, unsigned char theReg,
386 unsigned char theValue)
387{
388 int error, cntr = 3;
389 unsigned long flags;
390
391 do {
392 error = 0;
393 /*
394 * we don't like to be interrupted
395 */
396 local_irq_save(flags);
397
398 i2c_start();
399 /*
400 * send slave address
401 */
402 i2c_outbyte((theSlave & 0xfe));
403 /*
404 * wait for ack
405 */
406 if(!i2c_getack())
407 error = 1;
408 /*
409 * now select register
410 */
411 i2c_dir_out();
412 i2c_outbyte(theReg);
413 /*
414 * now it's time to wait for ack
415 */
416 if(!i2c_getack())
417 error |= 2;
418 /*
419 * send register register data
420 */
421 i2c_outbyte(theValue);
422 /*
423 * now it's time to wait for ack
424 */
425 if(!i2c_getack())
426 error |= 4;
427 /*
428 * end byte stream
429 */
430 i2c_stop();
431 /*
432 * enable interrupt again
433 */
434 local_irq_restore(flags);
435
436 } while(error && cntr--);
437
438 i2c_delay(CLOCK_LOW_TIME);
439
440 return -error;
441}
442
443/*#---------------------------------------------------------------------------
444*#
445*# FUNCTION NAME: i2c_readreg
446*#
447*# DESCRIPTION : Reads a value from the decoder registers.
448*#
449*#--------------------------------------------------------------------------*/
450unsigned char
451i2c_readreg(unsigned char theSlave, unsigned char theReg)
452{
453 unsigned char b = 0;
454 int error, cntr = 3;
455 unsigned long flags;
456
457 do {
458 error = 0;
459 /*
460 * we don't like to be interrupted
461 */
462 local_irq_save(flags);
463 /*
464 * generate start condition
465 */
466 i2c_start();
467
468 /*
469 * send slave address
470 */
471 i2c_outbyte((theSlave & 0xfe));
472 /*
473 * wait for ack
474 */
475 if(!i2c_getack())
476 error = 1;
477 /*
478 * now select register
479 */
480 i2c_dir_out();
481 i2c_outbyte(theReg);
482 /*
483 * now it's time to wait for ack
484 */
485 if(!i2c_getack())
486 error = 1;
487 /*
488 * repeat start condition
489 */
490 i2c_delay(CLOCK_LOW_TIME);
491 i2c_start();
492 /*
493 * send slave address
494 */
495 i2c_outbyte(theSlave | 0x01);
496 /*
497 * wait for ack
498 */
499 if(!i2c_getack())
500 error = 1;
501 /*
502 * fetch register
503 */
504 b = i2c_inbyte();
505 /*
506 * last received byte needs to be nacked
507 * instead of acked
508 */
509 i2c_sendnack();
510 /*
511 * end sequence
512 */
513 i2c_stop();
514 /*
515 * enable interrupt again
516 */
517 local_irq_restore(flags);
518
519 } while(error && cntr--);
520
521 return b;
522}
523
524static int
525i2c_open(struct inode *inode, struct file *filp)
526{
527 return 0;
528}
529
530static int
531i2c_release(struct inode *inode, struct file *filp)
532{
533 return 0;
534}
535
536/* Main device API. ioctl's to write or read to/from i2c registers.
537 */
538
539static int
540i2c_ioctl(struct inode *inode, struct file *file,
541 unsigned int cmd, unsigned long arg)
542{
543 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
544 return -EINVAL;
545 }
546
547 switch (_IOC_NR(cmd)) {
548 case I2C_WRITEREG:
549 /* write to an i2c slave */
550 D(printk("i2cw %d %d %d\n",
551 I2C_ARGSLAVE(arg),
552 I2C_ARGREG(arg),
553 I2C_ARGVALUE(arg)));
554
555 return i2c_writereg(I2C_ARGSLAVE(arg),
556 I2C_ARGREG(arg),
557 I2C_ARGVALUE(arg));
558 case I2C_READREG:
559 {
560 unsigned char val;
561 /* read from an i2c slave */
562 D(printk("i2cr %d %d ",
563 I2C_ARGSLAVE(arg),
564 I2C_ARGREG(arg)));
565 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
566 D(printk("= %d\n", val));
567 return val;
568 }
569 default:
570 return -EINVAL;
571
572 }
573
574 return 0;
575}
576
577static struct file_operations i2c_fops = {
578 owner: THIS_MODULE,
579 ioctl: i2c_ioctl,
580 open: i2c_open,
581 release: i2c_release,
582};
583
584int __init
585i2c_init(void)
586{
587 int res;
588
589 /* Setup and enable the Port B I2C interface */
590
591 crisv32_io_get_name(&cris_i2c_data, CONFIG_ETRAX_I2C_DATA_PORT);
592 crisv32_io_get_name(&cris_i2c_clk, CONFIG_ETRAX_I2C_CLK_PORT);
593
594 /* register char device */
595
596 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
597 if(res < 0) {
598 printk(KERN_ERR "i2c: couldn't get a major number.\n");
599 return res;
600 }
601
602 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
603
604 return 0;
605}
606
607/* this makes sure that i2c_init is called during boot */
608
609module_init(i2c_init);
610
611/****************** END OF FILE i2c.c ********************************/
diff --git a/arch/cris/arch-v32/drivers/i2c.h b/arch/cris/arch-v32/drivers/i2c.h
new file mode 100644
index 000000000000..bfe1a13f9f35
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/i2c.h
@@ -0,0 +1,15 @@
1
2#include <linux/init.h>
3
4/* High level I2C actions */
5int __init i2c_init(void);
6int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
7unsigned char i2c_readreg(unsigned char theSlave, unsigned char theReg);
8
9/* Low level I2C */
10void i2c_start(void);
11void i2c_stop(void);
12void i2c_outbyte(unsigned char x);
13unsigned char i2c_inbyte(void);
14int i2c_getack(void);
15void i2c_sendack(void);
diff --git a/arch/cris/arch-v32/drivers/iop_fw_load.c b/arch/cris/arch-v32/drivers/iop_fw_load.c
new file mode 100644
index 000000000000..11f9895ded50
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/iop_fw_load.c
@@ -0,0 +1,219 @@
1/* $Id: iop_fw_load.c,v 1.4 2005/04/07 09:27:46 larsv Exp $
2 *
3 * Firmware loader for ETRAX FS IO-Processor
4 *
5 * Copyright (C) 2004 Axis Communications AB
6 */
7
8#include <linux/module.h>
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/device.h>
12#include <linux/firmware.h>
13
14#include <asm/arch/hwregs/reg_map.h>
15#include <asm/arch/hwregs/iop/iop_reg_space.h>
16#include <asm/arch/hwregs/iop/iop_mpu_macros.h>
17#include <asm/arch/hwregs/iop/iop_mpu_defs.h>
18#include <asm/arch/hwregs/iop/iop_spu_defs.h>
19#include <asm/arch/hwregs/iop/iop_sw_cpu_defs.h>
20
21#define IOP_TIMEOUT 100
22
23static struct device iop_spu_device[2] = {
24 { .bus_id = "iop-spu0", },
25 { .bus_id = "iop-spu1", },
26};
27
28static struct device iop_mpu_device = {
29 .bus_id = "iop-mpu",
30};
31
32static int wait_mpu_idle(void)
33{
34 reg_iop_mpu_r_stat mpu_stat;
35 unsigned int timeout = IOP_TIMEOUT;
36
37 do {
38 mpu_stat = REG_RD(iop_mpu, regi_iop_mpu, r_stat);
39 } while (mpu_stat.instr_reg_busy == regk_iop_mpu_yes && --timeout > 0);
40 if (timeout == 0) {
41 printk(KERN_ERR "Timeout waiting for MPU to be idle\n");
42 return -EBUSY;
43 }
44 return 0;
45}
46
47int iop_fw_load_spu(const unsigned char *fw_name, unsigned int spu_inst)
48{
49 reg_iop_sw_cpu_rw_mc_ctrl mc_ctrl = {
50 .wr_spu0_mem = regk_iop_sw_cpu_no,
51 .wr_spu1_mem = regk_iop_sw_cpu_no,
52 .size = 4,
53 .cmd = regk_iop_sw_cpu_reg_copy,
54 .keep_owner = regk_iop_sw_cpu_yes
55 };
56 reg_iop_spu_rw_ctrl spu_ctrl = {
57 .en = regk_iop_spu_no,
58 .fsm = regk_iop_spu_no,
59 };
60 reg_iop_sw_cpu_r_mc_stat mc_stat;
61 const struct firmware *fw_entry;
62 u32 *data;
63 unsigned int timeout;
64 int retval, i;
65
66 if (spu_inst > 1)
67 return -ENODEV;
68
69 /* get firmware */
70 retval = request_firmware(&fw_entry,
71 fw_name,
72 &iop_spu_device[spu_inst]);
73 if (retval != 0)
74 {
75 printk(KERN_ERR
76 "iop_load_spu: Failed to load firmware \"%s\"\n",
77 fw_name);
78 return retval;
79 }
80 data = (u32 *) fw_entry->data;
81
82 /* acquire ownership of memory controller */
83 switch (spu_inst) {
84 case 0:
85 mc_ctrl.wr_spu0_mem = regk_iop_sw_cpu_yes;
86 REG_WR(iop_spu, regi_iop_spu0, rw_ctrl, spu_ctrl);
87 break;
88 case 1:
89 mc_ctrl.wr_spu1_mem = regk_iop_sw_cpu_yes;
90 REG_WR(iop_spu, regi_iop_spu1, rw_ctrl, spu_ctrl);
91 break;
92 }
93 timeout = IOP_TIMEOUT;
94 do {
95 REG_WR(iop_sw_cpu, regi_iop_sw_cpu, rw_mc_ctrl, mc_ctrl);
96 mc_stat = REG_RD(iop_sw_cpu, regi_iop_sw_cpu, r_mc_stat);
97 } while (mc_stat.owned_by_cpu == regk_iop_sw_cpu_no && --timeout > 0);
98 if (timeout == 0) {
99 printk(KERN_ERR "Timeout waiting to acquire MC\n");
100 retval = -EBUSY;
101 goto out;
102 }
103
104 /* write to SPU memory */
105 for (i = 0; i < (fw_entry->size/4); i++) {
106 switch (spu_inst) {
107 case 0:
108 REG_WR_INT(iop_spu, regi_iop_spu0, rw_seq_pc, (i*4));
109 break;
110 case 1:
111 REG_WR_INT(iop_spu, regi_iop_spu1, rw_seq_pc, (i*4));
112 break;
113 }
114 REG_WR_INT(iop_sw_cpu, regi_iop_sw_cpu, rw_mc_data, *data);
115 data++;
116 }
117
118 /* release ownership of memory controller */
119 (void) REG_RD(iop_sw_cpu, regi_iop_sw_cpu, rs_mc_data);
120
121 out:
122 release_firmware(fw_entry);
123 return retval;
124}
125
126int iop_fw_load_mpu(unsigned char *fw_name)
127{
128 const unsigned int start_addr = 0;
129 reg_iop_mpu_rw_ctrl mpu_ctrl;
130 const struct firmware *fw_entry;
131 u32 *data;
132 int retval, i;
133
134 /* get firmware */
135 retval = request_firmware(&fw_entry, fw_name, &iop_mpu_device);
136 if (retval != 0)
137 {
138 printk(KERN_ERR
139 "iop_load_spu: Failed to load firmware \"%s\"\n",
140 fw_name);
141 return retval;
142 }
143 data = (u32 *) fw_entry->data;
144
145 /* disable MPU */
146 mpu_ctrl.en = regk_iop_mpu_no;
147 REG_WR(iop_mpu, regi_iop_mpu, rw_ctrl, mpu_ctrl);
148 /* put start address in R0 */
149 REG_WR_VECT(iop_mpu, regi_iop_mpu, rw_r, 0, start_addr);
150 /* write to memory by executing 'SWX i, 4, R0' for each word */
151 if ((retval = wait_mpu_idle()) != 0)
152 goto out;
153 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_SWX_IIR_INSTR(0, 4, 0));
154 for (i = 0; i < (fw_entry->size / 4); i++) {
155 REG_WR_INT(iop_mpu, regi_iop_mpu, rw_immediate, *data);
156 if ((retval = wait_mpu_idle()) != 0)
157 goto out;
158 data++;
159 }
160
161 out:
162 release_firmware(fw_entry);
163 return retval;
164}
165
166int iop_start_mpu(unsigned int start_addr)
167{
168 reg_iop_mpu_rw_ctrl mpu_ctrl = { .en = regk_iop_mpu_yes };
169 int retval;
170
171 /* disable MPU */
172 if ((retval = wait_mpu_idle()) != 0)
173 goto out;
174 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_HALT());
175 if ((retval = wait_mpu_idle()) != 0)
176 goto out;
177 /* set PC and wait for it to bite */
178 if ((retval = wait_mpu_idle()) != 0)
179 goto out;
180 REG_WR_INT(iop_mpu, regi_iop_mpu, rw_instr, MPU_BA_I(start_addr));
181 if ((retval = wait_mpu_idle()) != 0)
182 goto out;
183 /* make sure the MPU starts executing with interrupts disabled */
184 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_DI());
185 if ((retval = wait_mpu_idle()) != 0)
186 goto out;
187 /* enable MPU */
188 REG_WR(iop_mpu, regi_iop_mpu, rw_ctrl, mpu_ctrl);
189 out:
190 return retval;
191}
192
193static int __init iop_fw_load_init(void)
194{
195 device_initialize(&iop_spu_device[0]);
196 kobject_set_name(&iop_spu_device[0].kobj, "iop-spu0");
197 kobject_add(&iop_spu_device[0].kobj);
198 device_initialize(&iop_spu_device[1]);
199 kobject_set_name(&iop_spu_device[1].kobj, "iop-spu1");
200 kobject_add(&iop_spu_device[1].kobj);
201 device_initialize(&iop_mpu_device);
202 kobject_set_name(&iop_mpu_device.kobj, "iop-mpu");
203 kobject_add(&iop_mpu_device.kobj);
204 return 0;
205}
206
207static void __exit iop_fw_load_exit(void)
208{
209}
210
211module_init(iop_fw_load_init);
212module_exit(iop_fw_load_exit);
213
214MODULE_DESCRIPTION("ETRAX FS IO-Processor Firmware Loader");
215MODULE_LICENSE("GPL");
216
217EXPORT_SYMBOL(iop_fw_load_spu);
218EXPORT_SYMBOL(iop_fw_load_mpu);
219EXPORT_SYMBOL(iop_start_mpu);
diff --git a/arch/cris/arch-v32/drivers/nandflash.c b/arch/cris/arch-v32/drivers/nandflash.c
new file mode 100644
index 000000000000..fc2a619b035d
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/nandflash.c
@@ -0,0 +1,157 @@
1/*
2 * arch/cris/arch-v32/drivers/nandflash.c
3 *
4 * Copyright (c) 2004
5 *
6 * Derived from drivers/mtd/nand/spia.c
7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
8 *
9 * $Id: nandflash.c,v 1.3 2005/06/01 10:57:12 starvik Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#include <linux/version.h>
18#include <linux/slab.h>
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/mtd/mtd.h>
22#include <linux/mtd/nand.h>
23#include <linux/mtd/partitions.h>
24#include <asm/arch/memmap.h>
25#include <asm/arch/hwregs/reg_map.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/gio_defs.h>
28#include <asm/arch/hwregs/bif_core_defs.h>
29#include <asm/io.h>
30
31#define CE_BIT 4
32#define CLE_BIT 5
33#define ALE_BIT 6
34#define BY_BIT 7
35
36static struct mtd_info *crisv32_mtd = NULL;
37/*
38 * hardware specific access to control-lines
39*/
40static void crisv32_hwcontrol(struct mtd_info *mtd, int cmd)
41{
42 unsigned long flags;
43 reg_gio_rw_pa_dout dout = REG_RD(gio, regi_gio, rw_pa_dout);
44
45 local_irq_save(flags);
46 switch(cmd){
47 case NAND_CTL_SETCLE:
48 dout.data |= (1<<CLE_BIT);
49 break;
50 case NAND_CTL_CLRCLE:
51 dout.data &= ~(1<<CLE_BIT);
52 break;
53 case NAND_CTL_SETALE:
54 dout.data |= (1<<ALE_BIT);
55 break;
56 case NAND_CTL_CLRALE:
57 dout.data &= ~(1<<ALE_BIT);
58 break;
59 case NAND_CTL_SETNCE:
60 dout.data |= (1<<CE_BIT);
61 break;
62 case NAND_CTL_CLRNCE:
63 dout.data &= ~(1<<CE_BIT);
64 break;
65 }
66 REG_WR(gio, regi_gio, rw_pa_dout, dout);
67 local_irq_restore(flags);
68}
69
70/*
71* read device ready pin
72*/
73int crisv32_device_ready(struct mtd_info *mtd)
74{
75 reg_gio_r_pa_din din = REG_RD(gio, regi_gio, r_pa_din);
76 return ((din.data & (1 << BY_BIT)) >> BY_BIT);
77}
78
79/*
80 * Main initialization routine
81 */
82struct mtd_info* __init crisv32_nand_flash_probe (void)
83{
84 void __iomem *read_cs;
85 void __iomem *write_cs;
86
87 reg_bif_core_rw_grp3_cfg bif_cfg = REG_RD(bif_core, regi_bif_core, rw_grp3_cfg);
88 reg_gio_rw_pa_oe pa_oe = REG_RD(gio, regi_gio, rw_pa_oe);
89 struct nand_chip *this;
90 int err = 0;
91
92 /* Allocate memory for MTD device structure and private data */
93 crisv32_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip),
94 GFP_KERNEL);
95 if (!crisv32_mtd) {
96 printk ("Unable to allocate CRISv32 NAND MTD device structure.\n");
97 err = -ENOMEM;
98 return NULL;
99 }
100
101 read_cs = ioremap(MEM_CSP0_START | MEM_NON_CACHEABLE, 8192);
102 write_cs = ioremap(MEM_CSP1_START | MEM_NON_CACHEABLE, 8192);
103
104 if (!read_cs || !write_cs) {
105 printk("CRISv32 NAND ioremap failed\n");
106 err = -EIO;
107 goto out_mtd;
108 }
109
110 /* Get pointer to private data */
111 this = (struct nand_chip *) (&crisv32_mtd[1]);
112
113 pa_oe.oe |= 1 << CE_BIT;
114 pa_oe.oe |= 1 << ALE_BIT;
115 pa_oe.oe |= 1 << CLE_BIT;
116 pa_oe.oe &= ~ (1 << BY_BIT);
117 REG_WR(gio, regi_gio, rw_pa_oe, pa_oe);
118
119 bif_cfg.gated_csp0 = regk_bif_core_rd;
120 bif_cfg.gated_csp1 = regk_bif_core_wr;
121 REG_WR(bif_core, regi_bif_core, rw_grp3_cfg, bif_cfg);
122
123 /* Initialize structures */
124 memset((char *) crisv32_mtd, 0, sizeof(struct mtd_info));
125 memset((char *) this, 0, sizeof(struct nand_chip));
126
127 /* Link the private data with the MTD structure */
128 crisv32_mtd->priv = this;
129
130 /* Set address of NAND IO lines */
131 this->IO_ADDR_R = read_cs;
132 this->IO_ADDR_W = write_cs;
133 this->hwcontrol = crisv32_hwcontrol;
134 this->dev_ready = crisv32_device_ready;
135 /* 20 us command delay time */
136 this->chip_delay = 20;
137 this->eccmode = NAND_ECC_SOFT;
138
139 /* Enable the following for a flash based bad block table */
140 this->options = NAND_USE_FLASH_BBT;
141
142 /* Scan to find existance of the device */
143 if (nand_scan (crisv32_mtd, 1)) {
144 err = -ENXIO;
145 goto out_ior;
146 }
147
148 return crisv32_mtd;
149
150out_ior:
151 iounmap((void *)read_cs);
152 iounmap((void *)write_cs);
153out_mtd:
154 kfree (crisv32_mtd);
155 return NULL;
156}
157
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
new file mode 100644
index 000000000000..f894580b648b
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -0,0 +1,341 @@
1/*
2 * PCF8563 RTC
3 *
4 * From Phillips' datasheet:
5 *
6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power
7 * consumption. A programmable clock output, interupt output and voltage
8 * low detector are also provided. All address and data are transferred
9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is
10 * 400 kbits/s. The built-in word address register is incremented
11 * automatically after each written or read byte.
12 *
13 * Copyright (c) 2002-2003, Axis Communications AB
14 * All rights reserved.
15 *
16 * Author: Tobias Anderberg <tobiasa@axis.com>.
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/version.h>
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/types.h>
25#include <linux/sched.h>
26#include <linux/init.h>
27#include <linux/fs.h>
28#include <linux/ioctl.h>
29#include <linux/delay.h>
30#include <linux/bcd.h>
31
32#include <asm/uaccess.h>
33#include <asm/system.h>
34#include <asm/io.h>
35#include <asm/rtc.h>
36
37#include "i2c.h"
38
39#define PCF8563_MAJOR 121 /* Local major number. */
40#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
41#define PCF8563_NAME "PCF8563"
42#define DRIVER_VERSION "$Revision: 1.1 $"
43
44/* Two simple wrapper macros, saves a few keystrokes. */
45#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
46#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
47
48static const unsigned char days_in_month[] =
49 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
50
51int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
52int pcf8563_open(struct inode *, struct file *);
53int pcf8563_release(struct inode *, struct file *);
54
55static struct file_operations pcf8563_fops = {
56 owner: THIS_MODULE,
57 ioctl: pcf8563_ioctl,
58 open: pcf8563_open,
59 release: pcf8563_release,
60};
61
62unsigned char
63pcf8563_readreg(int reg)
64{
65 unsigned char res = rtc_read(reg);
66
67 /* The PCF8563 does not return 0 for unimplemented bits */
68 switch (reg) {
69 case RTC_SECONDS:
70 case RTC_MINUTES:
71 res &= 0x7F;
72 break;
73 case RTC_HOURS:
74 case RTC_DAY_OF_MONTH:
75 res &= 0x3F;
76 break;
77 case RTC_WEEKDAY:
78 res &= 0x07;
79 break;
80 case RTC_MONTH:
81 res &= 0x1F;
82 break;
83 case RTC_CONTROL1:
84 res &= 0xA8;
85 break;
86 case RTC_CONTROL2:
87 res &= 0x1F;
88 break;
89 case RTC_CLOCKOUT_FREQ:
90 case RTC_TIMER_CONTROL:
91 res &= 0x83;
92 break;
93 }
94 return res;
95}
96
97void
98pcf8563_writereg(int reg, unsigned char val)
99{
100#ifdef CONFIG_ETRAX_RTC_READONLY
101 if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR))
102 return;
103#endif
104
105 rtc_write(reg, val);
106}
107
108void
109get_rtc_time(struct rtc_time *tm)
110{
111 tm->tm_sec = rtc_read(RTC_SECONDS);
112 tm->tm_min = rtc_read(RTC_MINUTES);
113 tm->tm_hour = rtc_read(RTC_HOURS);
114 tm->tm_mday = rtc_read(RTC_DAY_OF_MONTH);
115 tm->tm_wday = rtc_read(RTC_WEEKDAY);
116 tm->tm_mon = rtc_read(RTC_MONTH);
117 tm->tm_year = rtc_read(RTC_YEAR);
118
119 if (tm->tm_sec & 0x80)
120 printk(KERN_WARNING "%s: RTC Voltage Low - reliable date/time "
121 "information is no longer guaranteed!\n", PCF8563_NAME);
122
123 tm->tm_year = BCD_TO_BIN(tm->tm_year) + ((tm->tm_mon & 0x80) ? 100 : 0);
124 tm->tm_sec &= 0x7F;
125 tm->tm_min &= 0x7F;
126 tm->tm_hour &= 0x3F;
127 tm->tm_mday &= 0x3F;
128 tm->tm_wday &= 0x07; /* Not coded in BCD. */
129 tm->tm_mon &= 0x1F;
130
131 BCD_TO_BIN(tm->tm_sec);
132 BCD_TO_BIN(tm->tm_min);
133 BCD_TO_BIN(tm->tm_hour);
134 BCD_TO_BIN(tm->tm_mday);
135 BCD_TO_BIN(tm->tm_mon);
136 tm->tm_mon--; /* Month is 1..12 in RTC but 0..11 in linux */
137}
138
139int __init
140pcf8563_init(void)
141{
142 /* Initiate the i2c protocol. */
143 i2c_init();
144
145 /*
146 * First of all we need to reset the chip. This is done by
147 * clearing control1, control2 and clk freq and resetting
148 * all alarms.
149 */
150 if (rtc_write(RTC_CONTROL1, 0x00) < 0)
151 goto err;
152
153 if (rtc_write(RTC_CONTROL2, 0x00) < 0)
154 goto err;
155
156 if (rtc_write(RTC_CLOCKOUT_FREQ, 0x00) < 0)
157 goto err;
158
159 if (rtc_write(RTC_TIMER_CONTROL, 0x03) < 0)
160 goto err;
161
162 /* Reset the alarms. */
163 if (rtc_write(RTC_MINUTE_ALARM, 0x80) < 0)
164 goto err;
165
166 if (rtc_write(RTC_HOUR_ALARM, 0x80) < 0)
167 goto err;
168
169 if (rtc_write(RTC_DAY_ALARM, 0x80) < 0)
170 goto err;
171
172 if (rtc_write(RTC_WEEKDAY_ALARM, 0x80) < 0)
173 goto err;
174
175 if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
176 printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n",
177 PCF8563_NAME, PCF8563_MAJOR);
178 return -1;
179 }
180
181 printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
182
183 /* Check for low voltage, and warn about it.. */
184 if (rtc_read(RTC_SECONDS) & 0x80)
185 printk(KERN_WARNING "%s: RTC Voltage Low - reliable date/time "
186 "information is no longer guaranteed!\n", PCF8563_NAME);
187
188 return 0;
189
190err:
191 printk(KERN_INFO "%s: Error initializing chip.\n", PCF8563_NAME);
192 return -1;
193}
194
195void __exit
196pcf8563_exit(void)
197{
198 if (unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME) < 0) {
199 printk(KERN_INFO "%s: Unable to unregister device.\n", PCF8563_NAME);
200 }
201}
202
203/*
204 * ioctl calls for this driver. Why return -ENOTTY upon error? Because
205 * POSIX says so!
206 */
207int
208pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
209{
210 /* Some sanity checks. */
211 if (_IOC_TYPE(cmd) != RTC_MAGIC)
212 return -ENOTTY;
213
214 if (_IOC_NR(cmd) > RTC_MAX_IOCTL)
215 return -ENOTTY;
216
217 switch (cmd) {
218 case RTC_RD_TIME:
219 {
220 struct rtc_time tm;
221
222 memset(&tm, 0, sizeof (struct rtc_time));
223 get_rtc_time(&tm);
224
225 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof tm)) {
226 return -EFAULT;
227 }
228
229 return 0;
230 }
231
232 case RTC_SET_TIME:
233 {
234#ifdef CONFIG_ETRAX_RTC_READONLY
235 return -EPERM;
236#else
237 int leap;
238 int year;
239 int century;
240 struct rtc_time tm;
241
242 if (!capable(CAP_SYS_TIME))
243 return -EPERM;
244
245 if (copy_from_user(&tm, (struct rtc_time *) arg, sizeof tm))
246 return -EFAULT;
247
248 /* Convert from struct tm to struct rtc_time. */
249 tm.tm_year += 1900;
250 tm.tm_mon += 1;
251
252 /*
253 * Check if tm.tm_year is a leap year. A year is a leap
254 * year if it is divisible by 4 but not 100, except
255 * that years divisible by 400 _are_ leap years.
256 */
257 year = tm.tm_year;
258 leap = (tm.tm_mon == 2) && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
259
260 /* Perform some sanity checks. */
261 if ((tm.tm_year < 1970) ||
262 (tm.tm_mon > 12) ||
263 (tm.tm_mday == 0) ||
264 (tm.tm_mday > days_in_month[tm.tm_mon] + leap) ||
265 (tm.tm_wday >= 7) ||
266 (tm.tm_hour >= 24) ||
267 (tm.tm_min >= 60) ||
268 (tm.tm_sec >= 60))
269 return -EINVAL;
270
271 century = (tm.tm_year >= 2000) ? 0x80 : 0;
272 tm.tm_year = tm.tm_year % 100;
273
274 BIN_TO_BCD(tm.tm_year);
275 BIN_TO_BCD(tm.tm_mday);
276 BIN_TO_BCD(tm.tm_hour);
277 BIN_TO_BCD(tm.tm_min);
278 BIN_TO_BCD(tm.tm_sec);
279 tm.tm_mon |= century;
280
281 rtc_write(RTC_YEAR, tm.tm_year);
282 rtc_write(RTC_MONTH, tm.tm_mon);
283 rtc_write(RTC_WEEKDAY, tm.tm_wday); /* Not coded in BCD. */
284 rtc_write(RTC_DAY_OF_MONTH, tm.tm_mday);
285 rtc_write(RTC_HOURS, tm.tm_hour);
286 rtc_write(RTC_MINUTES, tm.tm_min);
287 rtc_write(RTC_SECONDS, tm.tm_sec);
288
289 return 0;
290#endif /* !CONFIG_ETRAX_RTC_READONLY */
291 }
292
293 case RTC_VLOW_RD:
294 {
295 int vl_bit = 0;
296
297 if (rtc_read(RTC_SECONDS) & 0x80) {
298 vl_bit = 1;
299 printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
300 "date/time information is no longer guaranteed!\n",
301 PCF8563_NAME);
302 }
303 if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))
304 return -EFAULT;
305
306 return 0;
307 }
308
309 case RTC_VLOW_SET:
310 {
311 /* Clear the VL bit in the seconds register */
312 int ret = rtc_read(RTC_SECONDS);
313
314 rtc_write(RTC_SECONDS, (ret & 0x7F));
315
316 return 0;
317 }
318
319 default:
320 return -ENOTTY;
321 }
322
323 return 0;
324}
325
326int
327pcf8563_open(struct inode *inode, struct file *filp)
328{
329 MOD_INC_USE_COUNT;
330 return 0;
331}
332
333int
334pcf8563_release(struct inode *inode, struct file *filp)
335{
336 MOD_DEC_USE_COUNT;
337 return 0;
338}
339
340module_init(pcf8563_init);
341module_exit(pcf8563_exit);
diff --git a/arch/cris/arch-v32/drivers/pci/Makefile b/arch/cris/arch-v32/drivers/pci/Makefile
new file mode 100644
index 000000000000..bff7482f2444
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for Etrax cardbus driver
3#
4
5obj-$(CONFIG_ETRAX_CARDBUS) += bios.o dma.o
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
new file mode 100644
index 000000000000..24bc149889b6
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -0,0 +1,131 @@
1#include <linux/pci.h>
2#include <linux/kernel.h>
3#include <asm/arch/hwregs/intr_vect.h>
4
5void __devinit pcibios_fixup_bus(struct pci_bus *b)
6{
7}
8
9char * __devinit pcibios_setup(char *str)
10{
11 return NULL;
12}
13
14void pcibios_set_master(struct pci_dev *dev)
15{
16 u8 lat;
17 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
18 printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat);
19 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
20}
21
22int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
23 enum pci_mmap_state mmap_state, int write_combine)
24{
25 unsigned long prot;
26
27 /* Leave vm_pgoff as-is, the PCI space address is the physical
28 * address on this platform.
29 */
30 vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO);
31
32 prot = pgprot_val(vma->vm_page_prot);
33 vma->vm_page_prot = __pgprot(prot);
34
35 /* Write-combine setting is ignored, it is changed via the mtrr
36 * interfaces on this platform.
37 */
38 if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
39 vma->vm_end - vma->vm_start,
40 vma->vm_page_prot))
41 return -EAGAIN;
42
43 return 0;
44}
45
46void
47pcibios_align_resource(void *data, struct resource *res,
48 unsigned long size, unsigned long align)
49{
50 if (res->flags & IORESOURCE_IO) {
51 unsigned long start = res->start;
52
53 if (start & 0x300) {
54 start = (start + 0x3ff) & ~0x3ff;
55 res->start = start;
56 }
57 }
58}
59
60int pcibios_enable_resources(struct pci_dev *dev, int mask)
61{
62 u16 cmd, old_cmd;
63 int idx;
64 struct resource *r;
65
66 pci_read_config_word(dev, PCI_COMMAND, &cmd);
67 old_cmd = cmd;
68 for(idx=0; idx<6; idx++) {
69 /* Only set up the requested stuff */
70 if (!(mask & (1<<idx)))
71 continue;
72
73 r = &dev->resource[idx];
74 if (!r->start && r->end) {
75 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
76 return -EINVAL;
77 }
78 if (r->flags & IORESOURCE_IO)
79 cmd |= PCI_COMMAND_IO;
80 if (r->flags & IORESOURCE_MEM)
81 cmd |= PCI_COMMAND_MEMORY;
82 }
83 if (dev->resource[PCI_ROM_RESOURCE].start)
84 cmd |= PCI_COMMAND_MEMORY;
85 if (cmd != old_cmd) {
86 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
87 pci_write_config_word(dev, PCI_COMMAND, cmd);
88 }
89 return 0;
90}
91
92int pcibios_enable_irq(struct pci_dev *dev)
93{
94 dev->irq = EXT_INTR_VECT;
95 return 0;
96}
97
98int pcibios_enable_device(struct pci_dev *dev, int mask)
99{
100 int err;
101
102 if ((err = pcibios_enable_resources(dev, mask)) < 0)
103 return err;
104
105 return pcibios_enable_irq(dev);
106}
107
108int pcibios_assign_resources(void)
109{
110 struct pci_dev *dev = NULL;
111 int idx;
112 struct resource *r;
113
114 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
115 int class = dev->class >> 8;
116
117 /* Don't touch classless devices and host bridges */
118 if (!class || class == PCI_CLASS_BRIDGE_HOST)
119 continue;
120
121 for(idx=0; idx<6; idx++) {
122 r = &dev->resource[idx];
123
124 if (!r->start && r->end)
125 pci_assign_resource(dev, idx);
126 }
127 }
128 return 0;
129}
130
131EXPORT_SYMBOL(pcibios_assign_resources);
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c
new file mode 100644
index 000000000000..10329306d23c
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/dma.c
@@ -0,0 +1,149 @@
1/*
2 * Dynamic DMA mapping support.
3 *
4 * On cris there is no hardware dynamic DMA address translation,
5 * so consistent alloc/free are merely page allocation/freeing.
6 * The rest of the dynamic DMA mapping interface is implemented
7 * in asm/pci.h.
8 *
9 * Borrowed from i386.
10 */
11
12#include <linux/types.h>
13#include <linux/mm.h>
14#include <linux/string.h>
15#include <linux/pci.h>
16#include <asm/io.h>
17
18struct dma_coherent_mem {
19 void *virt_base;
20 u32 device_base;
21 int size;
22 int flags;
23 unsigned long *bitmap;
24};
25
26void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, unsigned int __nocast gfp)
28{
29 void *ret;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
31 int order = get_order(size);
32 /* ignore region specifiers */
33 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
34
35 if (mem) {
36 int page = bitmap_find_free_region(mem->bitmap, mem->size,
37 order);
38 if (page >= 0) {
39 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
40 ret = mem->virt_base + (page << PAGE_SHIFT);
41 memset(ret, 0, size);
42 return ret;
43 }
44 if (mem->flags & DMA_MEMORY_EXCLUSIVE)
45 return NULL;
46 }
47
48 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
49 gfp |= GFP_DMA;
50
51 ret = (void *)__get_free_pages(gfp, order);
52
53 if (ret != NULL) {
54 memset(ret, 0, size);
55 *dma_handle = virt_to_phys(ret);
56 }
57 return ret;
58}
59
60void dma_free_coherent(struct device *dev, size_t size,
61 void *vaddr, dma_addr_t dma_handle)
62{
63 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
64 int order = get_order(size);
65
66 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
67 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
68
69 bitmap_release_region(mem->bitmap, page, order);
70 } else
71 free_pages((unsigned long)vaddr, order);
72}
73
74int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
75 dma_addr_t device_addr, size_t size, int flags)
76{
77 void __iomem *mem_base;
78 int pages = size >> PAGE_SHIFT;
79 int bitmap_size = (pages + 31)/32;
80
81 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
82 goto out;
83 if (!size)
84 goto out;
85 if (dev->dma_mem)
86 goto out;
87
88 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
89
90 mem_base = ioremap(bus_addr, size);
91 if (!mem_base)
92 goto out;
93
94 dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
95 if (!dev->dma_mem)
96 goto out;
97 memset(dev->dma_mem, 0, sizeof(struct dma_coherent_mem));
98 dev->dma_mem->bitmap = kmalloc(bitmap_size, GFP_KERNEL);
99 if (!dev->dma_mem->bitmap)
100 goto free1_out;
101 memset(dev->dma_mem->bitmap, 0, bitmap_size);
102
103 dev->dma_mem->virt_base = mem_base;
104 dev->dma_mem->device_base = device_addr;
105 dev->dma_mem->size = pages;
106 dev->dma_mem->flags = flags;
107
108 if (flags & DMA_MEMORY_MAP)
109 return DMA_MEMORY_MAP;
110
111 return DMA_MEMORY_IO;
112
113 free1_out:
114 kfree(dev->dma_mem->bitmap);
115 out:
116 return 0;
117}
118EXPORT_SYMBOL(dma_declare_coherent_memory);
119
120void dma_release_declared_memory(struct device *dev)
121{
122 struct dma_coherent_mem *mem = dev->dma_mem;
123
124 if(!mem)
125 return;
126 dev->dma_mem = NULL;
127 iounmap(mem->virt_base);
128 kfree(mem->bitmap);
129 kfree(mem);
130}
131EXPORT_SYMBOL(dma_release_declared_memory);
132
133void *dma_mark_declared_memory_occupied(struct device *dev,
134 dma_addr_t device_addr, size_t size)
135{
136 struct dma_coherent_mem *mem = dev->dma_mem;
137 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
138 int pos, err;
139
140 if (!mem)
141 return ERR_PTR(-EINVAL);
142
143 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
144 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
145 if (err != 0)
146 return ERR_PTR(err);
147 return mem->virt_base + (pos << PAGE_SHIFT);
148}
149EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
new file mode 100644
index 000000000000..c85a6df8558f
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -0,0 +1,1283 @@
1/*
2 * Simple synchronous serial port driver for ETRAX FS.
3 *
4 * Copyright (c) 2005 Axis Communications AB
5 *
6 * Author: Mikael Starvik
7 *
8 */
9
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/config.h>
13#include <linux/types.h>
14#include <linux/errno.h>
15#include <linux/major.h>
16#include <linux/sched.h>
17#include <linux/slab.h>
18#include <linux/interrupt.h>
19#include <linux/poll.h>
20#include <linux/init.h>
21#include <linux/timer.h>
22#include <linux/spinlock.h>
23
24#include <asm/io.h>
25#include <asm/arch/dma.h>
26#include <asm/arch/pinmux.h>
27#include <asm/arch/hwregs/reg_rdwr.h>
28#include <asm/arch/hwregs/sser_defs.h>
29#include <asm/arch/hwregs/dma_defs.h>
30#include <asm/arch/hwregs/dma.h>
31#include <asm/arch/hwregs/intr_vect_defs.h>
32#include <asm/arch/hwregs/intr_vect.h>
33#include <asm/arch/hwregs/reg_map.h>
34#include <asm/sync_serial.h>
35
36/* The receiver is a bit tricky beacuse of the continuous stream of data.*/
37/* */
38/* Three DMA descriptors are linked together. Each DMA descriptor is */
39/* responsible for port->bufchunk of a common buffer. */
40/* */
41/* +---------------------------------------------+ */
42/* | +----------+ +----------+ +----------+ | */
43/* +-> | Descr[0] |-->| Descr[1] |-->| Descr[2] |-+ */
44/* +----------+ +----------+ +----------+ */
45/* | | | */
46/* v v v */
47/* +-------------------------------------+ */
48/* | BUFFER | */
49/* +-------------------------------------+ */
50/* |<- data_avail ->| */
51/* readp writep */
52/* */
53/* If the application keeps up the pace readp will be right after writep.*/
54/* If the application can't keep the pace we have to throw away data. */
55/* The idea is that readp should be ready with the data pointed out by */
56/* Descr[i] when the DMA has filled in Descr[i+1]. */
57/* Otherwise we will discard */
58/* the rest of the data pointed out by Descr1 and set readp to the start */
59/* of Descr2 */
60
61#define SYNC_SERIAL_MAJOR 125
62
63/* IN_BUFFER_SIZE should be a multiple of 6 to make sure that 24 bit */
64/* words can be handled */
65#define IN_BUFFER_SIZE 12288
66#define IN_DESCR_SIZE 256
67#define NUM_IN_DESCR (IN_BUFFER_SIZE/IN_DESCR_SIZE)
68#define OUT_BUFFER_SIZE 4096
69
70#define DEFAULT_FRAME_RATE 0
71#define DEFAULT_WORD_RATE 7
72
73/* NOTE: Enabling some debug will likely cause overrun or underrun,
74 * especially if manual mode is use.
75 */
76#define DEBUG(x)
77#define DEBUGREAD(x)
78#define DEBUGWRITE(x)
79#define DEBUGPOLL(x)
80#define DEBUGRXINT(x)
81#define DEBUGTXINT(x)
82
83typedef struct sync_port
84{
85 reg_scope_instances regi_sser;
86 reg_scope_instances regi_dmain;
87 reg_scope_instances regi_dmaout;
88
89 char started; /* 1 if port has been started */
90 char port_nbr; /* Port 0 or 1 */
91 char busy; /* 1 if port is busy */
92
93 char enabled; /* 1 if port is enabled */
94 char use_dma; /* 1 if port uses dma */
95 char tr_running;
96
97 char init_irqs;
98 int output;
99 int input;
100
101 volatile unsigned int out_count; /* Remaining bytes for current transfer */
102 unsigned char* outp; /* Current position in out_buffer */
103 volatile unsigned char* volatile readp; /* Next byte to be read by application */
104 volatile unsigned char* volatile writep; /* Next byte to be written by etrax */
105 unsigned int in_buffer_size;
106 unsigned int inbufchunk;
107 unsigned char out_buffer[OUT_BUFFER_SIZE] __attribute__ ((aligned(32)));
108 unsigned char in_buffer[IN_BUFFER_SIZE]__attribute__ ((aligned(32)));
109 unsigned char flip[IN_BUFFER_SIZE] __attribute__ ((aligned(32)));
110 struct dma_descr_data* next_rx_desc;
111 struct dma_descr_data* prev_rx_desc;
112 int full;
113
114 dma_descr_data in_descr[NUM_IN_DESCR] __attribute__ ((__aligned__(16)));
115 dma_descr_context in_context __attribute__ ((__aligned__(32)));
116 dma_descr_data out_descr __attribute__ ((__aligned__(16)));
117 dma_descr_context out_context __attribute__ ((__aligned__(32)));
118 wait_queue_head_t out_wait_q;
119 wait_queue_head_t in_wait_q;
120
121 spinlock_t lock;
122} sync_port;
123
124static int etrax_sync_serial_init(void);
125static void initialize_port(int portnbr);
126static inline int sync_data_avail(struct sync_port *port);
127
128static int sync_serial_open(struct inode *, struct file*);
129static int sync_serial_release(struct inode*, struct file*);
130static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
131
132static int sync_serial_ioctl(struct inode*, struct file*,
133 unsigned int cmd, unsigned long arg);
134static ssize_t sync_serial_write(struct file * file, const char * buf,
135 size_t count, loff_t *ppos);
136static ssize_t sync_serial_read(struct file *file, char *buf,
137 size_t count, loff_t *ppos);
138
139#if (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0) && \
140 defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)) || \
141 (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) && \
142 defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA))
143#define SYNC_SER_DMA
144#endif
145
146static void send_word(sync_port* port);
147static void start_dma(struct sync_port *port, const char* data, int count);
148static void start_dma_in(sync_port* port);
149#ifdef SYNC_SER_DMA
150static irqreturn_t tr_interrupt(int irq, void *dev_id, struct pt_regs * regs);
151static irqreturn_t rx_interrupt(int irq, void *dev_id, struct pt_regs * regs);
152#endif
153
154#if (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0) && \
155 !defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)) || \
156 (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) && \
157 !defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA))
158#define SYNC_SER_MANUAL
159#endif
160#ifdef SYNC_SER_MANUAL
161static irqreturn_t manual_interrupt(int irq, void *dev_id, struct pt_regs * regs);
162#endif
163
164/* The ports */
165static struct sync_port ports[]=
166{
167 {
168 .regi_sser = regi_sser0,
169 .regi_dmaout = regi_dma4,
170 .regi_dmain = regi_dma5,
171#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)
172 .use_dma = 1,
173#else
174 .use_dma = 0,
175#endif
176 },
177 {
178 .regi_sser = regi_sser1,
179 .regi_dmaout = regi_dma6,
180 .regi_dmain = regi_dma7,
181#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA)
182 .use_dma = 1,
183#else
184 .use_dma = 0,
185#endif
186 }
187};
188
189#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port))
190
191static struct file_operations sync_serial_fops = {
192 .owner = THIS_MODULE,
193 .write = sync_serial_write,
194 .read = sync_serial_read,
195 .poll = sync_serial_poll,
196 .ioctl = sync_serial_ioctl,
197 .open = sync_serial_open,
198 .release = sync_serial_release
199};
200
201static int __init etrax_sync_serial_init(void)
202{
203 ports[0].enabled = 0;
204 ports[1].enabled = 0;
205
206 if (register_chrdev(SYNC_SERIAL_MAJOR,"sync serial", &sync_serial_fops) <0 )
207 {
208 printk("unable to get major for synchronous serial port\n");
209 return -EBUSY;
210 }
211
212 /* Initialize Ports */
213#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0)
214 if (crisv32_pinmux_alloc_fixed(pinmux_sser0))
215 {
216 printk("Unable to allocate pins for syncrhronous serial port 0\n");
217 return -EIO;
218 }
219 ports[0].enabled = 1;
220 initialize_port(0);
221#endif
222
223#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1)
224 if (crisv32_pinmux_alloc_fixed(pinmux_sser1))
225 {
226 printk("Unable to allocate pins for syncrhronous serial port 0\n");
227 return -EIO;
228 }
229 ports[1].enabled = 1;
230 initialize_port(1);
231#endif
232
233 printk("ETRAX FS synchronous serial port driver\n");
234 return 0;
235}
236
237static void __init initialize_port(int portnbr)
238{
239 struct sync_port* port = &ports[portnbr];
240 reg_sser_rw_cfg cfg = {0};
241 reg_sser_rw_frm_cfg frm_cfg = {0};
242 reg_sser_rw_tr_cfg tr_cfg = {0};
243 reg_sser_rw_rec_cfg rec_cfg = {0};
244
245 DEBUG(printk("Init sync serial port %d\n", portnbr));
246
247 port->port_nbr = portnbr;
248 port->init_irqs = 1;
249
250 port->outp = port->out_buffer;
251 port->output = 1;
252 port->input = 0;
253
254 port->readp = port->flip;
255 port->writep = port->flip;
256 port->in_buffer_size = IN_BUFFER_SIZE;
257 port->inbufchunk = IN_DESCR_SIZE;
258 port->next_rx_desc = &port->in_descr[0];
259 port->prev_rx_desc = &port->in_descr[NUM_IN_DESCR-1];
260 port->prev_rx_desc->eol = 1;
261
262 init_waitqueue_head(&port->out_wait_q);
263 init_waitqueue_head(&port->in_wait_q);
264
265 spin_lock_init(&port->lock);
266
267 cfg.out_clk_src = regk_sser_intern_clk;
268 cfg.out_clk_pol = regk_sser_pos;
269 cfg.clk_od_mode = regk_sser_no;
270 cfg.clk_dir = regk_sser_out;
271 cfg.gate_clk = regk_sser_no;
272 cfg.base_freq = regk_sser_f29_493;
273 cfg.clk_div = 256;
274 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
275
276 frm_cfg.wordrate = DEFAULT_WORD_RATE;
277 frm_cfg.type = regk_sser_edge;
278 frm_cfg.frame_pin_dir = regk_sser_out;
279 frm_cfg.frame_pin_use = regk_sser_frm;
280 frm_cfg.status_pin_dir = regk_sser_in;
281 frm_cfg.status_pin_use = regk_sser_hold;
282 frm_cfg.out_on = regk_sser_tr;
283 frm_cfg.tr_delay = 1;
284 REG_WR(sser, port->regi_sser, rw_frm_cfg, frm_cfg);
285
286 tr_cfg.urun_stop = regk_sser_no;
287 tr_cfg.sample_size = 7;
288 tr_cfg.sh_dir = regk_sser_msbfirst;
289 tr_cfg.use_dma = port->use_dma ? regk_sser_yes : regk_sser_no;
290 tr_cfg.rate_ctrl = regk_sser_bulk;
291 tr_cfg.data_pin_use = regk_sser_dout;
292 tr_cfg.bulk_wspace = 1;
293 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
294
295 rec_cfg.sample_size = 7;
296 rec_cfg.sh_dir = regk_sser_msbfirst;
297 rec_cfg.use_dma = port->use_dma ? regk_sser_yes : regk_sser_no;
298 rec_cfg.fifo_thr = regk_sser_inf;
299 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
300}
301
302static inline int sync_data_avail(struct sync_port *port)
303{
304 int avail;
305 unsigned char *start;
306 unsigned char *end;
307
308 start = (unsigned char*)port->readp; /* cast away volatile */
309 end = (unsigned char*)port->writep; /* cast away volatile */
310 /* 0123456789 0123456789
311 * ----- - -----
312 * ^rp ^wp ^wp ^rp
313 */
314
315 if (end >= start)
316 avail = end - start;
317 else
318 avail = port->in_buffer_size - (start - end);
319 return avail;
320}
321
322static inline int sync_data_avail_to_end(struct sync_port *port)
323{
324 int avail;
325 unsigned char *start;
326 unsigned char *end;
327
328 start = (unsigned char*)port->readp; /* cast away volatile */
329 end = (unsigned char*)port->writep; /* cast away volatile */
330 /* 0123456789 0123456789
331 * ----- -----
332 * ^rp ^wp ^wp ^rp
333 */
334
335 if (end >= start)
336 avail = end - start;
337 else
338 avail = port->flip + port->in_buffer_size - start;
339 return avail;
340}
341
342static int sync_serial_open(struct inode *inode, struct file *file)
343{
344 int dev = MINOR(inode->i_rdev);
345 sync_port* port;
346 reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
347 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
348
349 DEBUG(printk("Open sync serial port %d\n", dev));
350
351 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
352 {
353 DEBUG(printk("Invalid minor %d\n", dev));
354 return -ENODEV;
355 }
356 port = &ports[dev];
357 /* Allow open this device twice (assuming one reader and one writer) */
358 if (port->busy == 2)
359 {
360 DEBUG(printk("Device is busy.. \n"));
361 return -EBUSY;
362 }
363 if (port->init_irqs) {
364 if (port->use_dma) {
365 if (port == &ports[0]){
366#ifdef SYNC_SER_DMA
367 if(request_irq(DMA4_INTR_VECT,
368 tr_interrupt,
369 0,
370 "synchronous serial 0 dma tr",
371 &ports[0])) {
372 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
373 return -EBUSY;
374 } else if(request_irq(DMA5_INTR_VECT,
375 rx_interrupt,
376 0,
377 "synchronous serial 1 dma rx",
378 &ports[0])) {
379 free_irq(DMA4_INTR_VECT, &port[0]);
380 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
381 return -EBUSY;
382 } else if (crisv32_request_dma(SYNC_SER0_TX_DMA_NBR,
383 "synchronous serial 0 dma tr",
384 DMA_VERBOSE_ON_ERROR,
385 0,
386 dma_sser0)) {
387 free_irq(DMA4_INTR_VECT, &port[0]);
388 free_irq(DMA5_INTR_VECT, &port[0]);
389 printk(KERN_CRIT "Can't allocate sync serial port 0 TX DMA channel");
390 return -EBUSY;
391 } else if (crisv32_request_dma(SYNC_SER0_RX_DMA_NBR,
392 "synchronous serial 0 dma rec",
393 DMA_VERBOSE_ON_ERROR,
394 0,
395 dma_sser0)) {
396 crisv32_free_dma(SYNC_SER0_TX_DMA_NBR);
397 free_irq(DMA4_INTR_VECT, &port[0]);
398 free_irq(DMA5_INTR_VECT, &port[0]);
399 printk(KERN_CRIT "Can't allocate sync serial port 1 RX DMA channel");
400 return -EBUSY;
401 }
402#endif
403 }
404 else if (port == &ports[1]){
405#ifdef SYNC_SER_DMA
406 if (request_irq(DMA6_INTR_VECT,
407 tr_interrupt,
408 0,
409 "synchronous serial 1 dma tr",
410 &ports[1])) {
411 printk(KERN_CRIT "Can't allocate sync serial port 1 IRQ");
412 return -EBUSY;
413 } else if (request_irq(DMA7_INTR_VECT,
414 rx_interrupt,
415 0,
416 "synchronous serial 1 dma rx",
417 &ports[1])) {
418 free_irq(DMA6_INTR_VECT, &ports[1]);
419 printk(KERN_CRIT "Can't allocate sync serial port 3 IRQ");
420 return -EBUSY;
421 } else if (crisv32_request_dma(SYNC_SER1_TX_DMA_NBR,
422 "synchronous serial 1 dma tr",
423 DMA_VERBOSE_ON_ERROR,
424 0,
425 dma_sser1)) {
426 free_irq(21, &ports[1]);
427 free_irq(20, &ports[1]);
428 printk(KERN_CRIT "Can't allocate sync serial port 3 TX DMA channel");
429 return -EBUSY;
430 } else if (crisv32_request_dma(SYNC_SER1_RX_DMA_NBR,
431 "synchronous serial 3 dma rec",
432 DMA_VERBOSE_ON_ERROR,
433 0,
434 dma_sser1)) {
435 crisv32_free_dma(SYNC_SER1_TX_DMA_NBR);
436 free_irq(DMA6_INTR_VECT, &ports[1]);
437 free_irq(DMA7_INTR_VECT, &ports[1]);
438 printk(KERN_CRIT "Can't allocate sync serial port 3 RX DMA channel");
439 return -EBUSY;
440 }
441#endif
442 }
443
444 /* Enable DMAs */
445 REG_WR(dma, port->regi_dmain, rw_cfg, cfg);
446 REG_WR(dma, port->regi_dmaout, rw_cfg, cfg);
447 /* Enable DMA IRQs */
448 REG_WR(dma, port->regi_dmain, rw_intr_mask, intr_mask);
449 REG_WR(dma, port->regi_dmaout, rw_intr_mask, intr_mask);
450 /* Set up wordsize = 2 for DMAs. */
451 DMA_WR_CMD (port->regi_dmain, regk_dma_set_w_size1);
452 DMA_WR_CMD (port->regi_dmaout, regk_dma_set_w_size1);
453
454 start_dma_in(port);
455 port->init_irqs = 0;
456 } else { /* !port->use_dma */
457#ifdef SYNC_SER_MANUAL
458 if (port == &ports[0]) {
459 if (request_irq(SSER0_INTR_VECT,
460 manual_interrupt,
461 0,
462 "synchronous serial manual irq",
463 &ports[0])) {
464 printk("Can't allocate sync serial manual irq");
465 return -EBUSY;
466 }
467 } else if (port == &ports[1]) {
468 if (request_irq(SSER1_INTR_VECT,
469 manual_interrupt,
470 0,
471 "synchronous serial manual irq",
472 &ports[1])) {
473 printk(KERN_CRIT "Can't allocate sync serial manual irq");
474 return -EBUSY;
475 }
476 }
477 port->init_irqs = 0;
478#else
479 panic("sync_serial: Manual mode not supported.\n");
480#endif /* SYNC_SER_MANUAL */
481 }
482 } /* port->init_irqs */
483
484 port->busy++;
485 return 0;
486}
487
488static int sync_serial_release(struct inode *inode, struct file *file)
489{
490 int dev = MINOR(inode->i_rdev);
491 sync_port* port;
492
493 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
494 {
495 DEBUG(printk("Invalid minor %d\n", dev));
496 return -ENODEV;
497 }
498 port = &ports[dev];
499 if (port->busy)
500 port->busy--;
501 if (!port->busy)
502 /* XXX */ ;
503 return 0;
504}
505
506static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
507{
508 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
509 unsigned int mask = 0;
510 sync_port* port;
511 DEBUGPOLL( static unsigned int prev_mask = 0; );
512
513 port = &ports[dev];
514 poll_wait(file, &port->out_wait_q, wait);
515 poll_wait(file, &port->in_wait_q, wait);
516 /* Some room to write */
517 if (port->out_count < OUT_BUFFER_SIZE)
518 mask |= POLLOUT | POLLWRNORM;
519 /* At least an inbufchunk of data */
520 if (sync_data_avail(port) >= port->inbufchunk)
521 mask |= POLLIN | POLLRDNORM;
522
523 DEBUGPOLL(if (mask != prev_mask)
524 printk("sync_serial_poll: mask 0x%08X %s %s\n", mask,
525 mask&POLLOUT?"POLLOUT":"", mask&POLLIN?"POLLIN":"");
526 prev_mask = mask;
527 );
528 return mask;
529}
530
531static int sync_serial_ioctl(struct inode *inode, struct file *file,
532 unsigned int cmd, unsigned long arg)
533{
534 int return_val = 0;
535 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
536 sync_port* port;
537 reg_sser_rw_tr_cfg tr_cfg;
538 reg_sser_rw_rec_cfg rec_cfg;
539 reg_sser_rw_frm_cfg frm_cfg;
540 reg_sser_rw_cfg gen_cfg;
541 reg_sser_rw_intr_mask intr_mask;
542
543 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
544 {
545 DEBUG(printk("Invalid minor %d\n", dev));
546 return -1;
547 }
548 port = &ports[dev];
549 spin_lock_irq(&port->lock);
550
551 tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
552 rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
553 frm_cfg = REG_RD(sser, port->regi_sser, rw_frm_cfg);
554 gen_cfg = REG_RD(sser, port->regi_sser, rw_cfg);
555 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
556
557 switch(cmd)
558 {
559 case SSP_SPEED:
560 if (GET_SPEED(arg) == CODEC)
561 {
562 gen_cfg.base_freq = regk_sser_f32;
563 /* FREQ = 0 => 4 MHz => clk_div = 7*/
564 gen_cfg.clk_div = 6 + (1 << GET_FREQ(arg));
565 }
566 else
567 {
568 gen_cfg.base_freq = regk_sser_f29_493;
569 switch (GET_SPEED(arg))
570 {
571 case SSP150:
572 gen_cfg.clk_div = 29493000 / (150 * 8) - 1;
573 break;
574 case SSP300:
575 gen_cfg.clk_div = 29493000 / (300 * 8) - 1;
576 break;
577 case SSP600:
578 gen_cfg.clk_div = 29493000 / (600 * 8) - 1;
579 break;
580 case SSP1200:
581 gen_cfg.clk_div = 29493000 / (1200 * 8) - 1;
582 break;
583 case SSP2400:
584 gen_cfg.clk_div = 29493000 / (2400 * 8) - 1;
585 break;
586 case SSP4800:
587 gen_cfg.clk_div = 29493000 / (4800 * 8) - 1;
588 break;
589 case SSP9600:
590 gen_cfg.clk_div = 29493000 / (9600 * 8) - 1;
591 break;
592 case SSP19200:
593 gen_cfg.clk_div = 29493000 / (19200 * 8) - 1;
594 break;
595 case SSP28800:
596 gen_cfg.clk_div = 29493000 / (28800 * 8) - 1;
597 break;
598 case SSP57600:
599 gen_cfg.clk_div = 29493000 / (57600 * 8) - 1;
600 break;
601 case SSP115200:
602 gen_cfg.clk_div = 29493000 / (115200 * 8) - 1;
603 break;
604 case SSP230400:
605 gen_cfg.clk_div = 29493000 / (230400 * 8) - 1;
606 break;
607 case SSP460800:
608 gen_cfg.clk_div = 29493000 / (460800 * 8) - 1;
609 break;
610 case SSP921600:
611 gen_cfg.clk_div = 29493000 / (921600 * 8) - 1;
612 break;
613 case SSP3125000:
614 gen_cfg.base_freq = regk_sser_f100;
615 gen_cfg.clk_div = 100000000 / (3125000 * 8) - 1;
616 break;
617
618 }
619 }
620 frm_cfg.wordrate = GET_WORD_RATE(arg);
621
622 break;
623 case SSP_MODE:
624 switch(arg)
625 {
626 case MASTER_OUTPUT:
627 port->output = 1;
628 port->input = 0;
629 gen_cfg.clk_dir = regk_sser_out;
630 break;
631 case SLAVE_OUTPUT:
632 port->output = 1;
633 port->input = 0;
634 gen_cfg.clk_dir = regk_sser_in;
635 break;
636 case MASTER_INPUT:
637 port->output = 0;
638 port->input = 1;
639 gen_cfg.clk_dir = regk_sser_out;
640 break;
641 case SLAVE_INPUT:
642 port->output = 0;
643 port->input = 1;
644 gen_cfg.clk_dir = regk_sser_in;
645 break;
646 case MASTER_BIDIR:
647 port->output = 1;
648 port->input = 1;
649 gen_cfg.clk_dir = regk_sser_out;
650 break;
651 case SLAVE_BIDIR:
652 port->output = 1;
653 port->input = 1;
654 gen_cfg.clk_dir = regk_sser_in;
655 break;
656 default:
657 spin_unlock_irq(&port->lock);
658 return -EINVAL;
659
660 }
661 if (!port->use_dma || (arg == MASTER_OUTPUT || arg == SLAVE_OUTPUT))
662 intr_mask.rdav = regk_sser_yes;
663 break;
664 case SSP_FRAME_SYNC:
665 if (arg & NORMAL_SYNC)
666 frm_cfg.tr_delay = 1;
667 else if (arg & EARLY_SYNC)
668 frm_cfg.tr_delay = 0;
669
670 tr_cfg.bulk_wspace = frm_cfg.tr_delay;
671 frm_cfg.early_wend = regk_sser_yes;
672 if (arg & BIT_SYNC)
673 frm_cfg.type = regk_sser_edge;
674 else if (arg & WORD_SYNC)
675 frm_cfg.type = regk_sser_level;
676 else if (arg & EXTENDED_SYNC)
677 frm_cfg.early_wend = regk_sser_no;
678
679 if (arg & SYNC_ON)
680 frm_cfg.frame_pin_use = regk_sser_frm;
681 else if (arg & SYNC_OFF)
682 frm_cfg.frame_pin_use = regk_sser_gio0;
683
684 if (arg & WORD_SIZE_8)
685 rec_cfg.sample_size = tr_cfg.sample_size = 7;
686 else if (arg & WORD_SIZE_12)
687 rec_cfg.sample_size = tr_cfg.sample_size = 11;
688 else if (arg & WORD_SIZE_16)
689 rec_cfg.sample_size = tr_cfg.sample_size = 15;
690 else if (arg & WORD_SIZE_24)
691 rec_cfg.sample_size = tr_cfg.sample_size = 23;
692 else if (arg & WORD_SIZE_32)
693 rec_cfg.sample_size = tr_cfg.sample_size = 31;
694
695 if (arg & BIT_ORDER_MSB)
696 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_msbfirst;
697 else if (arg & BIT_ORDER_LSB)
698 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_lsbfirst;
699
700 if (arg & FLOW_CONTROL_ENABLE)
701 rec_cfg.fifo_thr = regk_sser_thr16;
702 else if (arg & FLOW_CONTROL_DISABLE)
703 rec_cfg.fifo_thr = regk_sser_inf;
704
705 if (arg & CLOCK_NOT_GATED)
706 gen_cfg.gate_clk = regk_sser_no;
707 else if (arg & CLOCK_GATED)
708 gen_cfg.gate_clk = regk_sser_yes;
709
710 break;
711 case SSP_IPOLARITY:
712 /* NOTE!! negedge is considered NORMAL */
713 if (arg & CLOCK_NORMAL)
714 rec_cfg.clk_pol = regk_sser_neg;
715 else if (arg & CLOCK_INVERT)
716 rec_cfg.clk_pol = regk_sser_pos;
717
718 if (arg & FRAME_NORMAL)
719 frm_cfg.level = regk_sser_pos_hi;
720 else if (arg & FRAME_INVERT)
721 frm_cfg.level = regk_sser_neg_lo;
722
723 if (arg & STATUS_NORMAL)
724 gen_cfg.hold_pol = regk_sser_pos;
725 else if (arg & STATUS_INVERT)
726 gen_cfg.hold_pol = regk_sser_neg;
727 break;
728 case SSP_OPOLARITY:
729 if (arg & CLOCK_NORMAL)
730 gen_cfg.out_clk_pol = regk_sser_neg;
731 else if (arg & CLOCK_INVERT)
732 gen_cfg.out_clk_pol = regk_sser_pos;
733
734 if (arg & FRAME_NORMAL)
735 frm_cfg.level = regk_sser_pos_hi;
736 else if (arg & FRAME_INVERT)
737 frm_cfg.level = regk_sser_neg_lo;
738
739 if (arg & STATUS_NORMAL)
740 gen_cfg.hold_pol = regk_sser_pos;
741 else if (arg & STATUS_INVERT)
742 gen_cfg.hold_pol = regk_sser_neg;
743 break;
744 case SSP_SPI:
745 rec_cfg.fifo_thr = regk_sser_inf;
746 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_msbfirst;
747 rec_cfg.sample_size = tr_cfg.sample_size = 7;
748 frm_cfg.frame_pin_use = regk_sser_frm;
749 frm_cfg.type = regk_sser_level;
750 frm_cfg.tr_delay = 1;
751 frm_cfg.level = regk_sser_neg_lo;
752 if (arg & SPI_SLAVE)
753 {
754 rec_cfg.clk_pol = regk_sser_neg;
755 gen_cfg.clk_dir = regk_sser_in;
756 port->input = 1;
757 port->output = 0;
758 }
759 else
760 {
761 gen_cfg.out_clk_pol = regk_sser_pos;
762 port->input = 0;
763 port->output = 1;
764 gen_cfg.clk_dir = regk_sser_out;
765 }
766 break;
767 case SSP_INBUFCHUNK:
768 break;
769 default:
770 return_val = -1;
771 }
772
773
774 if (port->started)
775 {
776 tr_cfg.tr_en = port->output;
777 rec_cfg.rec_en = port->input;
778 }
779
780 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
781 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
782 REG_WR(sser, port->regi_sser, rw_frm_cfg, frm_cfg);
783 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
784 REG_WR(sser, port->regi_sser, rw_cfg, gen_cfg);
785
786 spin_unlock_irq(&port->lock);
787 return return_val;
788}
789
790static ssize_t sync_serial_write(struct file * file, const char * buf,
791 size_t count, loff_t *ppos)
792{
793 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
794 DECLARE_WAITQUEUE(wait, current);
795 sync_port *port;
796 unsigned long c, c1;
797 unsigned long free_outp;
798 unsigned long outp;
799 unsigned long out_buffer;
800 unsigned long flags;
801
802 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
803 {
804 DEBUG(printk("Invalid minor %d\n", dev));
805 return -ENODEV;
806 }
807 port = &ports[dev];
808
809 DEBUGWRITE(printk("W d%d c %lu (%d/%d)\n", port->port_nbr, count, port->out_count, OUT_BUFFER_SIZE));
810 /* Space to end of buffer */
811 /*
812 * out_buffer <c1>012345<- c ->OUT_BUFFER_SIZE
813 * outp^ +out_count
814 ^free_outp
815 * out_buffer 45<- c ->0123OUT_BUFFER_SIZE
816 * +out_count outp^
817 * free_outp
818 *
819 */
820
821 /* Read variables that may be updated by interrupts */
822 spin_lock_irqsave(&port->lock, flags);
823 count = count > OUT_BUFFER_SIZE - port->out_count ? OUT_BUFFER_SIZE - port->out_count : count;
824 outp = (unsigned long)port->outp;
825 free_outp = outp + port->out_count;
826 spin_unlock_irqrestore(&port->lock, flags);
827 out_buffer = (unsigned long)port->out_buffer;
828
829 /* Find out where and how much to write */
830 if (free_outp >= out_buffer + OUT_BUFFER_SIZE)
831 free_outp -= OUT_BUFFER_SIZE;
832 if (free_outp >= outp)
833 c = out_buffer + OUT_BUFFER_SIZE - free_outp;
834 else
835 c = outp - free_outp;
836 if (c > count)
837 c = count;
838
839// DEBUGWRITE(printk("w op %08lX fop %08lX c %lu\n", outp, free_outp, c));
840 if (copy_from_user((void*)free_outp, buf, c))
841 return -EFAULT;
842
843 if (c != count) {
844 buf += c;
845 c1 = count - c;
846 DEBUGWRITE(printk("w2 fi %lu c %lu c1 %lu\n", free_outp-out_buffer, c, c1));
847 if (copy_from_user((void*)out_buffer, buf, c1))
848 return -EFAULT;
849 }
850 spin_lock_irqsave(&port->lock, flags);
851 port->out_count += count;
852 spin_unlock_irqrestore(&port->lock, flags);
853
854 /* Make sure transmitter/receiver is running */
855 if (!port->started)
856 {
857 reg_sser_rw_cfg cfg = REG_RD(sser, port->regi_sser, rw_cfg);
858 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
859 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
860 cfg.en = regk_sser_yes;
861 tr_cfg.tr_en = port->output;
862 rec_cfg.rec_en = port->input;
863 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
864 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
865 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
866 port->started = 1;
867 }
868
869 if (file->f_flags & O_NONBLOCK) {
870 spin_lock_irqsave(&port->lock, flags);
871 if (!port->tr_running) {
872 if (!port->use_dma) {
873 reg_sser_rw_intr_mask intr_mask;
874 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
875 /* Start sender by writing data */
876 send_word(port);
877 /* and enable transmitter ready IRQ */
878 intr_mask.trdy = 1;
879 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
880 } else {
881 start_dma(port, (unsigned char* volatile )port->outp, c);
882 }
883 }
884 spin_unlock_irqrestore(&port->lock, flags);
885 DEBUGWRITE(printk("w d%d c %lu NB\n",
886 port->port_nbr, count));
887 return count;
888 }
889
890 /* Sleep until all sent */
891
892 add_wait_queue(&port->out_wait_q, &wait);
893 set_current_state(TASK_INTERRUPTIBLE);
894 spin_lock_irqsave(&port->lock, flags);
895 if (!port->tr_running) {
896 if (!port->use_dma) {
897 reg_sser_rw_intr_mask intr_mask;
898 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
899 /* Start sender by writing data */
900 send_word(port);
901 /* and enable transmitter ready IRQ */
902 intr_mask.trdy = 1;
903 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
904 } else {
905 start_dma(port, port->outp, c);
906 }
907 }
908 spin_unlock_irqrestore(&port->lock, flags);
909 schedule();
910 set_current_state(TASK_RUNNING);
911 remove_wait_queue(&port->out_wait_q, &wait);
912 if (signal_pending(current))
913 {
914 return -EINTR;
915 }
916 DEBUGWRITE(printk("w d%d c %lu\n", port->port_nbr, count));
917 return count;
918}
919
920static ssize_t sync_serial_read(struct file * file, char * buf,
921 size_t count, loff_t *ppos)
922{
923 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
924 int avail;
925 sync_port *port;
926 unsigned char* start;
927 unsigned char* end;
928 unsigned long flags;
929
930 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
931 {
932 DEBUG(printk("Invalid minor %d\n", dev));
933 return -ENODEV;
934 }
935 port = &ports[dev];
936
937 DEBUGREAD(printk("R%d c %d ri %lu wi %lu /%lu\n", dev, count, port->readp - port->flip, port->writep - port->flip, port->in_buffer_size));
938
939 if (!port->started)
940 {
941 reg_sser_rw_cfg cfg = REG_RD(sser, port->regi_sser, rw_cfg);
942 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
943 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
944 cfg.en = regk_sser_yes;
945 tr_cfg.tr_en = regk_sser_yes;
946 rec_cfg.rec_en = regk_sser_yes;
947 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
948 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
949 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
950 port->started = 1;
951 }
952
953
954 /* Calculate number of available bytes */
955 /* Save pointers to avoid that they are modified by interrupt */
956 spin_lock_irqsave(&port->lock, flags);
957 start = (unsigned char*)port->readp; /* cast away volatile */
958 end = (unsigned char*)port->writep; /* cast away volatile */
959 spin_unlock_irqrestore(&port->lock, flags);
960 while ((start == end) && !port->full) /* No data */
961 {
962 if (file->f_flags & O_NONBLOCK)
963 {
964 return -EAGAIN;
965 }
966
967 interruptible_sleep_on(&port->in_wait_q);
968 if (signal_pending(current))
969 {
970 return -EINTR;
971 }
972 spin_lock_irqsave(&port->lock, flags);
973 start = (unsigned char*)port->readp; /* cast away volatile */
974 end = (unsigned char*)port->writep; /* cast away volatile */
975 spin_unlock_irqrestore(&port->lock, flags);
976 }
977
978 /* Lazy read, never return wrapped data. */
979 if (port->full)
980 avail = port->in_buffer_size;
981 else if (end > start)
982 avail = end - start;
983 else
984 avail = port->flip + port->in_buffer_size - start;
985
986 count = count > avail ? avail : count;
987 if (copy_to_user(buf, start, count))
988 return -EFAULT;
989 /* Disable interrupts while updating readp */
990 spin_lock_irqsave(&port->lock, flags);
991 port->readp += count;
992 if (port->readp >= port->flip + port->in_buffer_size) /* Wrap? */
993 port->readp = port->flip;
994 port->full = 0;
995 spin_unlock_irqrestore(&port->lock, flags);
996 DEBUGREAD(printk("r %d\n", count));
997 return count;
998}
999
1000static void send_word(sync_port* port)
1001{
1002 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
1003 reg_sser_rw_tr_data tr_data = {0};
1004
1005 switch(tr_cfg.sample_size)
1006 {
1007 case 8:
1008 port->out_count--;
1009 tr_data.data = *port->outp++;
1010 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1011 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1012 port->outp = port->out_buffer;
1013 break;
1014 case 12:
1015 {
1016 int data = (*port->outp++) << 8;
1017 data |= *port->outp++;
1018 port->out_count-=2;
1019 tr_data.data = data;
1020 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1021 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1022 port->outp = port->out_buffer;
1023 }
1024 break;
1025 case 16:
1026 port->out_count-=2;
1027 tr_data.data = *(unsigned short *)port->outp;
1028 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1029 port->outp+=2;
1030 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1031 port->outp = port->out_buffer;
1032 break;
1033 case 24:
1034 port->out_count-=3;
1035 tr_data.data = *(unsigned short *)port->outp;
1036 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1037 port->outp+=2;
1038 tr_data.data = *port->outp++;
1039 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1040 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1041 port->outp = port->out_buffer;
1042 break;
1043 case 32:
1044 port->out_count-=4;
1045 tr_data.data = *(unsigned short *)port->outp;
1046 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1047 port->outp+=2;
1048 tr_data.data = *(unsigned short *)port->outp;
1049 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1050 port->outp+=2;
1051 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1052 port->outp = port->out_buffer;
1053 break;
1054 }
1055}
1056
1057
1058static void start_dma(struct sync_port* port, const char* data, int count)
1059{
1060 port->tr_running = 1;
1061 port->out_descr.buf = (char*)virt_to_phys((char*)data);
1062 port->out_descr.after = port->out_descr.buf + count;
1063 port->out_descr.eol = port->out_descr.intr = 1;
1064
1065 port->out_context.saved_data = (dma_descr_data*)virt_to_phys(&port->out_descr);
1066 port->out_context.saved_data_buf = port->out_descr.buf;
1067
1068 DMA_START_CONTEXT(port->regi_dmaout, virt_to_phys((char*)&port->out_context));
1069 DEBUGTXINT(printk("dma %08lX c %d\n", (unsigned long)data, count));
1070}
1071
1072static void start_dma_in(sync_port* port)
1073{
1074 int i;
1075 char* buf;
1076 port->writep = port->flip;
1077
1078 if (port->writep > port->flip + port->in_buffer_size)
1079 {
1080 panic("Offset too large in sync serial driver\n");
1081 return;
1082 }
1083 buf = (char*)virt_to_phys(port->in_buffer);
1084 for (i = 0; i < NUM_IN_DESCR; i++) {
1085 port->in_descr[i].buf = buf;
1086 port->in_descr[i].after = buf + port->inbufchunk;
1087 port->in_descr[i].intr = 1;
1088 port->in_descr[i].next = (dma_descr_data*)virt_to_phys(&port->in_descr[i+1]);
1089 port->in_descr[i].buf = buf;
1090 buf += port->inbufchunk;
1091 }
1092 /* Link the last descriptor to the first */
1093 port->in_descr[i-1].next = (dma_descr_data*)virt_to_phys(&port->in_descr[0]);
1094 port->in_descr[i-1].eol = regk_sser_yes;
1095 port->next_rx_desc = &port->in_descr[0];
1096 port->prev_rx_desc = &port->in_descr[NUM_IN_DESCR - 1];
1097 port->in_context.saved_data = (dma_descr_data*)virt_to_phys(&port->in_descr[0]);
1098 port->in_context.saved_data_buf = port->in_descr[0].buf;
1099 DMA_START_CONTEXT(port->regi_dmain, virt_to_phys(&port->in_context));
1100}
1101
1102#ifdef SYNC_SER_DMA
1103static irqreturn_t tr_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1104{
1105 reg_dma_r_masked_intr masked;
1106 reg_dma_rw_ack_intr ack_intr = {.data = regk_dma_yes};
1107 int i;
1108 struct dma_descr_data *descr;
1109 unsigned int sentl;
1110 int found = 0;
1111
1112 for (i = 0; i < NUMBER_OF_PORTS; i++)
1113 {
1114 sync_port *port = &ports[i];
1115 if (!port->enabled || !port->use_dma )
1116 continue;
1117
1118 masked = REG_RD(dma, port->regi_dmaout, r_masked_intr);
1119
1120 if (masked.data) /* IRQ active for the port? */
1121 {
1122 found = 1;
1123 /* Clear IRQ */
1124 REG_WR(dma, port->regi_dmaout, rw_ack_intr, ack_intr);
1125 descr = &port->out_descr;
1126 sentl = descr->after - descr->buf;
1127 port->out_count -= sentl;
1128 port->outp += sentl;
1129 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1130 port->outp = port->out_buffer;
1131 if (port->out_count) {
1132 int c;
1133 c = port->out_buffer + OUT_BUFFER_SIZE - port->outp;
1134 if (c > port->out_count)
1135 c = port->out_count;
1136 DEBUGTXINT(printk("tx_int DMAWRITE %i %i\n", sentl, c));
1137 start_dma(port, port->outp, c);
1138 } else {
1139 DEBUGTXINT(printk("tx_int DMA stop %i\n", sentl));
1140 port->tr_running = 0;
1141 }
1142 wake_up_interruptible(&port->out_wait_q); /* wake up the waiting process */
1143 }
1144 }
1145 return IRQ_RETVAL(found);
1146} /* tr_interrupt */
1147
1148static irqreturn_t rx_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1149{
1150 reg_dma_r_masked_intr masked;
1151 reg_dma_rw_ack_intr ack_intr = {.data = regk_dma_yes};
1152
1153 int i;
1154 int found = 0;
1155
1156 for (i = 0; i < NUMBER_OF_PORTS; i++)
1157 {
1158 sync_port *port = &ports[i];
1159
1160 if (!port->enabled || !port->use_dma )
1161 continue;
1162
1163 masked = REG_RD(dma, port->regi_dmain, r_masked_intr);
1164
1165 if (masked.data) /* Descriptor interrupt */
1166 {
1167 found = 1;
1168 while (REG_RD(dma, port->regi_dmain, rw_data) !=
1169 virt_to_phys(port->next_rx_desc)) {
1170
1171 if (port->writep + port->inbufchunk > port->flip + port->in_buffer_size) {
1172 int first_size = port->flip + port->in_buffer_size - port->writep;
1173 memcpy((char*)port->writep, phys_to_virt((unsigned)port->next_rx_desc->buf), first_size);
1174 memcpy(port->flip, phys_to_virt((unsigned)port->next_rx_desc->buf+first_size), port->inbufchunk - first_size);
1175 port->writep = port->flip + port->inbufchunk - first_size;
1176 } else {
1177 memcpy((char*)port->writep,
1178 phys_to_virt((unsigned)port->next_rx_desc->buf),
1179 port->inbufchunk);
1180 port->writep += port->inbufchunk;
1181 if (port->writep >= port->flip + port->in_buffer_size)
1182 port->writep = port->flip;
1183 }
1184 if (port->writep == port->readp)
1185 {
1186 port->full = 1;
1187 }
1188
1189 port->next_rx_desc->eol = 0;
1190 port->prev_rx_desc->eol = 1;
1191 port->prev_rx_desc = phys_to_virt((unsigned)port->next_rx_desc);
1192 port->next_rx_desc = phys_to_virt((unsigned)port->next_rx_desc->next);
1193 wake_up_interruptible(&port->in_wait_q); /* wake up the waiting process */
1194 DMA_CONTINUE(port->regi_dmain);
1195 REG_WR(dma, port->regi_dmain, rw_ack_intr, ack_intr);
1196
1197 }
1198 }
1199 }
1200 return IRQ_RETVAL(found);
1201} /* rx_interrupt */
1202#endif /* SYNC_SER_DMA */
1203
1204#ifdef SYNC_SER_MANUAL
1205static irqreturn_t manual_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1206{
1207 int i;
1208 int found = 0;
1209 reg_sser_r_masked_intr masked;
1210
1211 for (i = 0; i < NUMBER_OF_PORTS; i++)
1212 {
1213 sync_port* port = &ports[i];
1214
1215 if (!port->enabled || port->use_dma)
1216 {
1217 continue;
1218 }
1219
1220 masked = REG_RD(sser, port->regi_sser, r_masked_intr);
1221 if (masked.rdav) /* Data received? */
1222 {
1223 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
1224 reg_sser_r_rec_data data = REG_RD(sser, port->regi_sser, r_rec_data);
1225 found = 1;
1226 /* Read data */
1227 switch(rec_cfg.sample_size)
1228 {
1229 case 8:
1230 *port->writep++ = data.data & 0xff;
1231 break;
1232 case 12:
1233 *port->writep = (data.data & 0x0ff0) >> 4;
1234 *(port->writep + 1) = data.data & 0x0f;
1235 port->writep+=2;
1236 break;
1237 case 16:
1238 *(unsigned short*)port->writep = data.data;
1239 port->writep+=2;
1240 break;
1241 case 24:
1242 *(unsigned int*)port->writep = data.data;
1243 port->writep+=3;
1244 break;
1245 case 32:
1246 *(unsigned int*)port->writep = data.data;
1247 port->writep+=4;
1248 break;
1249 }
1250
1251 if (port->writep >= port->flip + port->in_buffer_size) /* Wrap? */
1252 port->writep = port->flip;
1253 if (port->writep == port->readp) {
1254 /* receive buffer overrun, discard oldest data
1255 */
1256 port->readp++;
1257 if (port->readp >= port->flip + port->in_buffer_size) /* Wrap? */
1258 port->readp = port->flip;
1259 }
1260 if (sync_data_avail(port) >= port->inbufchunk)
1261 wake_up_interruptible(&port->in_wait_q); /* Wake up application */
1262 }
1263
1264 if (masked.trdy) /* Transmitter ready? */
1265 {
1266 found = 1;
1267 if (port->out_count > 0) /* More data to send */
1268 send_word(port);
1269 else /* transmission finished */
1270 {
1271 reg_sser_rw_intr_mask intr_mask;
1272 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
1273 intr_mask.trdy = 0;
1274 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
1275 wake_up_interruptible(&port->out_wait_q); /* Wake up application */
1276 }
1277 }
1278 }
1279 return IRQ_RETVAL(found);
1280}
1281#endif
1282
1283module_init(etrax_sync_serial_init);
diff --git a/arch/cris/arch-v32/kernel/Makefile b/arch/cris/arch-v32/kernel/Makefile
new file mode 100644
index 000000000000..5d5b613cde8c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/Makefile
@@ -0,0 +1,21 @@
1# $Id: Makefile,v 1.11 2004/12/17 10:16:13 starvik Exp $
2#
3# Makefile for the linux kernel.
4#
5
6extra-y := head.o
7
8
9obj-y := entry.o traps.o irq.o debugport.o dma.o pinmux.o \
10 process.o ptrace.o setup.o signal.o traps.o time.o \
11 arbiter.o io.o
12
13obj-$(CONFIG_ETRAXFS_SIM) += vcs_hook.o
14
15obj-$(CONFIG_SMP) += smp.o
16obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o
17obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
18obj-$(CONFIG_MODULES) += crisksyms.o
19
20clean:
21
diff --git a/arch/cris/arch-v32/kernel/arbiter.c b/arch/cris/arch-v32/kernel/arbiter.c
new file mode 100644
index 000000000000..3870d2fd5160
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/arbiter.c
@@ -0,0 +1,297 @@
1/*
2 * Memory arbiter functions. Allocates bandwith through the
3 * arbiter and sets up arbiter breakpoints.
4 *
5 * The algorithm first assigns slots to the clients that has specified
6 * bandwith (e.g. ethernet) and then the remaining slots are divided
7 * on all the active clients.
8 *
9 * Copyright (c) 2004, 2005 Axis Communications AB.
10 */
11
12#include <linux/config.h>
13#include <asm/arch/hwregs/reg_map.h>
14#include <asm/arch/hwregs/reg_rdwr.h>
15#include <asm/arch/hwregs/marb_defs.h>
16#include <asm/arch/arbiter.h>
17#include <asm/arch/hwregs/intr_vect.h>
18#include <linux/interrupt.h>
19#include <linux/signal.h>
20#include <linux/errno.h>
21#include <linux/spinlock.h>
22#include <asm/io.h>
23
24struct crisv32_watch_entry
25{
26 unsigned long instance;
27 watch_callback* cb;
28 unsigned long start;
29 unsigned long end;
30 int used;
31};
32
33#define NUMBER_OF_BP 4
34#define NBR_OF_CLIENTS 14
35#define NBR_OF_SLOTS 64
36#define SDRAM_BANDWIDTH 100000000 /* Some kind of expected value */
37#define INTMEM_BANDWIDTH 400000000
38#define NBR_OF_REGIONS 2
39
40static struct crisv32_watch_entry watches[NUMBER_OF_BP] =
41{
42 {regi_marb_bp0},
43 {regi_marb_bp1},
44 {regi_marb_bp2},
45 {regi_marb_bp3}
46};
47
48static int requested_slots[NBR_OF_REGIONS][NBR_OF_CLIENTS];
49static int active_clients[NBR_OF_REGIONS][NBR_OF_CLIENTS];
50static int max_bandwidth[NBR_OF_REGIONS] = {SDRAM_BANDWIDTH, INTMEM_BANDWIDTH};
51
52DEFINE_SPINLOCK(arbiter_lock);
53
54static irqreturn_t
55crisv32_arbiter_irq(int irq, void* dev_id, struct pt_regs* regs);
56
57static void crisv32_arbiter_config(int region)
58{
59 int slot;
60 int client;
61 int interval = 0;
62 int val[NBR_OF_SLOTS];
63
64 for (slot = 0; slot < NBR_OF_SLOTS; slot++)
65 val[slot] = NBR_OF_CLIENTS + 1;
66
67 for (client = 0; client < NBR_OF_CLIENTS; client++)
68 {
69 int pos;
70 if (!requested_slots[region][client])
71 continue;
72 interval = NBR_OF_SLOTS / requested_slots[region][client];
73 pos = 0;
74 while (pos < NBR_OF_SLOTS)
75 {
76 if (val[pos] != NBR_OF_CLIENTS + 1)
77 pos++;
78 else
79 {
80 val[pos] = client;
81 pos += interval;
82 }
83 }
84 }
85
86 client = 0;
87 for (slot = 0; slot < NBR_OF_SLOTS; slot++)
88 {
89 if (val[slot] == NBR_OF_CLIENTS + 1)
90 {
91 int first = client;
92 while(!active_clients[region][client]) {
93 client = (client + 1) % NBR_OF_CLIENTS;
94 if (client == first)
95 break;
96 }
97 val[slot] = client;
98 client = (client + 1) % NBR_OF_CLIENTS;
99 }
100 if (region == EXT_REGION)
101 REG_WR_INT_VECT(marb, regi_marb, rw_ext_slots, slot, val[slot]);
102 else if (region == INT_REGION)
103 REG_WR_INT_VECT(marb, regi_marb, rw_int_slots, slot, val[slot]);
104 }
105}
106
107extern char _stext, _etext;
108
109static void crisv32_arbiter_init(void)
110{
111 static int initialized = 0;
112
113 if (initialized)
114 return;
115
116 initialized = 1;
117
118 /* CPU caches are active. */
119 active_clients[EXT_REGION][10] = active_clients[EXT_REGION][11] = 1;
120 crisv32_arbiter_config(EXT_REGION);
121 crisv32_arbiter_config(INT_REGION);
122
123 if (request_irq(MEMARB_INTR_VECT, crisv32_arbiter_irq, SA_INTERRUPT,
124 "arbiter", NULL))
125 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
126
127#ifndef CONFIG_ETRAX_KGDB
128 /* Global watch for writes to kernel text segment. */
129 crisv32_arbiter_watch(virt_to_phys(&_stext), &_etext - &_stext,
130 arbiter_all_clients, arbiter_all_write, NULL);
131#endif
132}
133
134
135
136int crisv32_arbiter_allocate_bandwith(int client, int region,
137 unsigned long bandwidth)
138{
139 int i;
140 int total_assigned = 0;
141 int total_clients = 0;
142 int req;
143
144 crisv32_arbiter_init();
145
146 for (i = 0; i < NBR_OF_CLIENTS; i++)
147 {
148 total_assigned += requested_slots[region][i];
149 total_clients += active_clients[region][i];
150 }
151 req = NBR_OF_SLOTS / (max_bandwidth[region] / bandwidth);
152
153 if (total_assigned + total_clients + req + 1 > NBR_OF_SLOTS)
154 return -ENOMEM;
155
156 active_clients[region][client] = 1;
157 requested_slots[region][client] = req;
158 crisv32_arbiter_config(region);
159
160 return 0;
161}
162
163int crisv32_arbiter_watch(unsigned long start, unsigned long size,
164 unsigned long clients, unsigned long accesses,
165 watch_callback* cb)
166{
167 int i;
168
169 crisv32_arbiter_init();
170
171 if (start > 0x80000000) {
172 printk("Arbiter: %lX doesn't look like a physical address", start);
173 return -EFAULT;
174 }
175
176 spin_lock(&arbiter_lock);
177
178 for (i = 0; i < NUMBER_OF_BP; i++) {
179 if (!watches[i].used) {
180 reg_marb_rw_intr_mask intr_mask = REG_RD(marb, regi_marb, rw_intr_mask);
181
182 watches[i].used = 1;
183 watches[i].start = start;
184 watches[i].end = start + size;
185 watches[i].cb = cb;
186
187 REG_WR_INT(marb_bp, watches[i].instance, rw_first_addr, watches[i].start);
188 REG_WR_INT(marb_bp, watches[i].instance, rw_last_addr, watches[i].end);
189 REG_WR_INT(marb_bp, watches[i].instance, rw_op, accesses);
190 REG_WR_INT(marb_bp, watches[i].instance, rw_clients, clients);
191
192 if (i == 0)
193 intr_mask.bp0 = regk_marb_yes;
194 else if (i == 1)
195 intr_mask.bp1 = regk_marb_yes;
196 else if (i == 2)
197 intr_mask.bp2 = regk_marb_yes;
198 else if (i == 3)
199 intr_mask.bp3 = regk_marb_yes;
200
201 REG_WR(marb, regi_marb, rw_intr_mask, intr_mask);
202 spin_unlock(&arbiter_lock);
203
204 return i;
205 }
206 }
207 spin_unlock(&arbiter_lock);
208 return -ENOMEM;
209}
210
211int crisv32_arbiter_unwatch(int id)
212{
213 reg_marb_rw_intr_mask intr_mask = REG_RD(marb, regi_marb, rw_intr_mask);
214
215 crisv32_arbiter_init();
216
217 spin_lock(&arbiter_lock);
218
219 if ((id < 0) || (id >= NUMBER_OF_BP) || (!watches[id].used)) {
220 spin_unlock(&arbiter_lock);
221 return -EINVAL;
222 }
223
224 memset(&watches[id], 0, sizeof(struct crisv32_watch_entry));
225
226 if (id == 0)
227 intr_mask.bp0 = regk_marb_no;
228 else if (id == 1)
229 intr_mask.bp2 = regk_marb_no;
230 else if (id == 2)
231 intr_mask.bp2 = regk_marb_no;
232 else if (id == 3)
233 intr_mask.bp3 = regk_marb_no;
234
235 REG_WR(marb, regi_marb, rw_intr_mask, intr_mask);
236
237 spin_unlock(&arbiter_lock);
238 return 0;
239}
240
241extern void show_registers(struct pt_regs *regs);
242
243static irqreturn_t
244crisv32_arbiter_irq(int irq, void* dev_id, struct pt_regs* regs)
245{
246 reg_marb_r_masked_intr masked_intr = REG_RD(marb, regi_marb, r_masked_intr);
247 reg_marb_bp_r_brk_clients r_clients;
248 reg_marb_bp_r_brk_addr r_addr;
249 reg_marb_bp_r_brk_op r_op;
250 reg_marb_bp_r_brk_first_client r_first;
251 reg_marb_bp_r_brk_size r_size;
252 reg_marb_bp_rw_ack ack = {0};
253 reg_marb_rw_ack_intr ack_intr = {.bp0=1,.bp1=1,.bp2=1,.bp3=1};
254 struct crisv32_watch_entry* watch;
255
256 if (masked_intr.bp0) {
257 watch = &watches[0];
258 ack_intr.bp0 = regk_marb_yes;
259 } else if (masked_intr.bp1) {
260 watch = &watches[1];
261 ack_intr.bp1 = regk_marb_yes;
262 } else if (masked_intr.bp2) {
263 watch = &watches[2];
264 ack_intr.bp2 = regk_marb_yes;
265 } else if (masked_intr.bp3) {
266 watch = &watches[3];
267 ack_intr.bp3 = regk_marb_yes;
268 } else {
269 return IRQ_NONE;
270 }
271
272 /* Retrieve all useful information and print it. */
273 r_clients = REG_RD(marb_bp, watch->instance, r_brk_clients);
274 r_addr = REG_RD(marb_bp, watch->instance, r_brk_addr);
275 r_op = REG_RD(marb_bp, watch->instance, r_brk_op);
276 r_first = REG_RD(marb_bp, watch->instance, r_brk_first_client);
277 r_size = REG_RD(marb_bp, watch->instance, r_brk_size);
278
279 printk("Arbiter IRQ\n");
280 printk("Clients %X addr %X op %X first %X size %X\n",
281 REG_TYPE_CONV(int, reg_marb_bp_r_brk_clients, r_clients),
282 REG_TYPE_CONV(int, reg_marb_bp_r_brk_addr, r_addr),
283 REG_TYPE_CONV(int, reg_marb_bp_r_brk_op, r_op),
284 REG_TYPE_CONV(int, reg_marb_bp_r_brk_first_client, r_first),
285 REG_TYPE_CONV(int, reg_marb_bp_r_brk_size, r_size));
286
287 REG_WR(marb_bp, watch->instance, rw_ack, ack);
288 REG_WR(marb, regi_marb, rw_ack_intr, ack_intr);
289
290 printk("IRQ occured at %lX\n", regs->erp);
291
292 if (watch->cb)
293 watch->cb();
294
295
296 return IRQ_HANDLED;
297}
diff --git a/arch/cris/arch-v32/kernel/asm-offsets.c b/arch/cris/arch-v32/kernel/asm-offsets.c
new file mode 100644
index 000000000000..15b3d93a0496
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/asm-offsets.c
@@ -0,0 +1,49 @@
1#include <linux/sched.h>
2#include <asm/thread_info.h>
3
4/*
5 * Generate definitions needed by assembly language modules.
6 * This code generates raw asm output which is post-processed to extract
7 * and format the required data.
8 */
9
10#define DEFINE(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
12
13#define BLANK() asm volatile("\n->" : : )
14
15int main(void)
16{
17#define ENTRY(entry) DEFINE(PT_ ## entry, offsetof(struct pt_regs, entry))
18 ENTRY(orig_r10);
19 ENTRY(r13);
20 ENTRY(r12);
21 ENTRY(r11);
22 ENTRY(r10);
23 ENTRY(r9);
24 ENTRY(acr);
25 ENTRY(srs);
26 ENTRY(mof);
27 ENTRY(ccs);
28 ENTRY(srp);
29 BLANK();
30#undef ENTRY
31#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
32 ENTRY(task);
33 ENTRY(flags);
34 ENTRY(preempt_count);
35 BLANK();
36#undef ENTRY
37#define ENTRY(entry) DEFINE(THREAD_ ## entry, offsetof(struct thread_struct, entry))
38 ENTRY(ksp);
39 ENTRY(usp);
40 ENTRY(ccs);
41 BLANK();
42#undef ENTRY
43#define ENTRY(entry) DEFINE(TASK_ ## entry, offsetof(struct task_struct, entry))
44 ENTRY(pid);
45 BLANK();
46 DEFINE(LCLONE_VM, CLONE_VM);
47 DEFINE(LCLONE_UNTRACED, CLONE_UNTRACED);
48 return 0;
49}
diff --git a/arch/cris/arch-v32/kernel/crisksyms.c b/arch/cris/arch-v32/kernel/crisksyms.c
new file mode 100644
index 000000000000..2c3bb9a0afe2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/crisksyms.c
@@ -0,0 +1,24 @@
1#include <linux/config.h>
2#include <linux/module.h>
3#include <linux/irq.h>
4#include <asm/arch/dma.h>
5#include <asm/arch/intmem.h>
6#include <asm/arch/pinmux.h>
7
8/* Functions for allocating DMA channels */
9EXPORT_SYMBOL(crisv32_request_dma);
10EXPORT_SYMBOL(crisv32_free_dma);
11
12/* Functions for handling internal RAM */
13EXPORT_SYMBOL(crisv32_intmem_alloc);
14EXPORT_SYMBOL(crisv32_intmem_free);
15EXPORT_SYMBOL(crisv32_intmem_phys_to_virt);
16EXPORT_SYMBOL(crisv32_intmem_virt_to_phys);
17
18/* Functions for handling pinmux */
19EXPORT_SYMBOL(crisv32_pinmux_alloc);
20EXPORT_SYMBOL(crisv32_pinmux_dealloc);
21
22/* Functions masking/unmasking interrupts */
23EXPORT_SYMBOL(mask_irq);
24EXPORT_SYMBOL(unmask_irq);
diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c
new file mode 100644
index 000000000000..ffc1ebf2dfee
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/debugport.c
@@ -0,0 +1,461 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/config.h>
6#include <linux/console.h>
7#include <linux/init.h>
8#include <linux/major.h>
9#include <linux/delay.h>
10#include <linux/tty.h>
11#include <asm/system.h>
12#include <asm/io.h>
13#include <asm/arch/hwregs/ser_defs.h>
14#include <asm/arch/hwregs/dma_defs.h>
15#include <asm/arch/pinmux.h>
16
17#include <asm/irq.h>
18#include <asm/arch/hwregs/intr_vect_defs.h>
19
20struct dbg_port
21{
22 unsigned char nbr;
23 unsigned long instance;
24 unsigned int started;
25 unsigned long baudrate;
26 unsigned char parity;
27 unsigned int bits;
28};
29
30struct dbg_port ports[] =
31{
32 {
33 0,
34 regi_ser0,
35 0,
36 115200,
37 'N',
38 8
39 },
40 {
41 1,
42 regi_ser1,
43 0,
44 115200,
45 'N',
46 8
47 },
48 {
49 2,
50 regi_ser2,
51 0,
52 115200,
53 'N',
54 8
55 },
56 {
57 3,
58 regi_ser3,
59 0,
60 115200,
61 'N',
62 8
63 }
64};
65static struct dbg_port *port =
66#if defined(CONFIG_ETRAX_DEBUG_PORT0)
67&ports[0];
68#elif defined(CONFIG_ETRAX_DEBUG_PORT1)
69&ports[1];
70#elif defined(CONFIG_ETRAX_DEBUG_PORT2)
71&ports[2];
72#elif defined(CONFIG_ETRAX_DEBUG_PORT3)
73&ports[3];
74#else
75NULL;
76#endif
77
78#ifdef CONFIG_ETRAX_KGDB
79static struct dbg_port *kgdb_port =
80#if defined(CONFIG_ETRAX_KGDB_PORT0)
81&ports[0];
82#elif defined(CONFIG_ETRAX_KGDB_PORT1)
83&ports[1];
84#elif defined(CONFIG_ETRAX_KGDB_PORT2)
85&ports[2];
86#elif defined(CONFIG_ETRAX_KGDB_PORT3)
87&ports[3];
88#else
89NULL;
90#endif
91#endif
92
93#ifdef CONFIG_ETRAXFS_SIM
94extern void print_str( const char *str );
95static char buffer[1024];
96static char msg[] = "Debug: ";
97static int buffer_pos = sizeof(msg) - 1;
98#endif
99
100extern struct tty_driver *serial_driver;
101
102static void
103start_port(struct dbg_port* p)
104{
105 if (!p)
106 return;
107
108 if (p->started)
109 return;
110 p->started = 1;
111
112 if (p->nbr == 1)
113 crisv32_pinmux_alloc_fixed(pinmux_ser1);
114 else if (p->nbr == 2)
115 crisv32_pinmux_alloc_fixed(pinmux_ser2);
116 else if (p->nbr == 3)
117 crisv32_pinmux_alloc_fixed(pinmux_ser3);
118
119 /* Set up serial port registers */
120 reg_ser_rw_tr_ctrl tr_ctrl = {0};
121 reg_ser_rw_tr_dma_en tr_dma_en = {0};
122
123 reg_ser_rw_rec_ctrl rec_ctrl = {0};
124 reg_ser_rw_tr_baud_div tr_baud_div = {0};
125 reg_ser_rw_rec_baud_div rec_baud_div = {0};
126
127 tr_ctrl.base_freq = rec_ctrl.base_freq = regk_ser_f29_493;
128 tr_dma_en.en = rec_ctrl.dma_mode = regk_ser_no;
129 tr_baud_div.div = rec_baud_div.div = 29493000 / p->baudrate / 8;
130 tr_ctrl.en = rec_ctrl.en = 1;
131
132 if (p->parity == 'O')
133 {
134 tr_ctrl.par_en = regk_ser_yes;
135 tr_ctrl.par = regk_ser_odd;
136 rec_ctrl.par_en = regk_ser_yes;
137 rec_ctrl.par = regk_ser_odd;
138 }
139 else if (p->parity == 'E')
140 {
141 tr_ctrl.par_en = regk_ser_yes;
142 tr_ctrl.par = regk_ser_even;
143 rec_ctrl.par_en = regk_ser_yes;
144 rec_ctrl.par = regk_ser_odd;
145 }
146
147 if (p->bits == 7)
148 {
149 tr_ctrl.data_bits = regk_ser_bits7;
150 rec_ctrl.data_bits = regk_ser_bits7;
151 }
152
153 REG_WR (ser, p->instance, rw_tr_baud_div, tr_baud_div);
154 REG_WR (ser, p->instance, rw_rec_baud_div, rec_baud_div);
155 REG_WR (ser, p->instance, rw_tr_dma_en, tr_dma_en);
156 REG_WR (ser, p->instance, rw_tr_ctrl, tr_ctrl);
157 REG_WR (ser, p->instance, rw_rec_ctrl, rec_ctrl);
158}
159
160/* No debug */
161#ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
162
163static void
164console_write(struct console *co, const char *buf, unsigned int len)
165{
166 return;
167}
168
169/* Target debug */
170#elif !defined(CONFIG_ETRAXFS_SIM)
171
172static void
173console_write_direct(struct console *co, const char *buf, unsigned int len)
174{
175 int i;
176 reg_ser_r_stat_din stat;
177 reg_ser_rw_tr_dma_en tr_dma_en, old;
178
179 /* Switch to manual mode */
180 tr_dma_en = old = REG_RD (ser, port->instance, rw_tr_dma_en);
181 if (tr_dma_en.en == regk_ser_yes) {
182 tr_dma_en.en = regk_ser_no;
183 REG_WR(ser, port->instance, rw_tr_dma_en, tr_dma_en);
184 }
185
186 /* Send data */
187 for (i = 0; i < len; i++) {
188 /* LF -> CRLF */
189 if (buf[i] == '\n') {
190 do {
191 stat = REG_RD (ser, port->instance, r_stat_din);
192 } while (!stat.tr_rdy);
193 REG_WR_INT (ser, port->instance, rw_dout, '\r');
194 }
195 /* Wait until transmitter is ready and send.*/
196 do {
197 stat = REG_RD (ser, port->instance, r_stat_din);
198 } while (!stat.tr_rdy);
199 REG_WR_INT (ser, port->instance, rw_dout, buf[i]);
200 }
201
202 /* Restore mode */
203 if (tr_dma_en.en != old.en)
204 REG_WR(ser, port->instance, rw_tr_dma_en, old);
205}
206
207static void
208console_write(struct console *co, const char *buf, unsigned int len)
209{
210 if (!port)
211 return;
212 console_write_direct(co, buf, len);
213}
214
215
216
217#else
218
219/* VCS debug */
220
221static void
222console_write(struct console *co, const char *buf, unsigned int len)
223{
224 char* pos;
225 pos = memchr(buf, '\n', len);
226 if (pos) {
227 int l = ++pos - buf;
228 memcpy(buffer + buffer_pos, buf, l);
229 memcpy(buffer, msg, sizeof(msg) - 1);
230 buffer[buffer_pos + l] = '\0';
231 print_str(buffer);
232 buffer_pos = sizeof(msg) - 1;
233 if (pos - buf != len) {
234 memcpy(buffer + buffer_pos, pos, len - l);
235 buffer_pos += len - l;
236 }
237 } else {
238 memcpy(buffer + buffer_pos, buf, len);
239 buffer_pos += len;
240 }
241}
242
243#endif
244
245int raw_printk(const char *fmt, ...)
246{
247 static char buf[1024];
248 int printed_len;
249 va_list args;
250 va_start(args, fmt);
251 printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
252 va_end(args);
253 console_write(NULL, buf, strlen(buf));
254 return printed_len;
255}
256
257void
258stupid_debug(char* buf)
259{
260 console_write(NULL, buf, strlen(buf));
261}
262
263#ifdef CONFIG_ETRAX_KGDB
264/* Use polling to get a single character from the kernel debug port */
265int
266getDebugChar(void)
267{
268 reg_ser_rs_status_data stat;
269 reg_ser_rw_ack_intr ack_intr = { 0 };
270
271 do {
272 stat = REG_RD(ser, kgdb_instance, rs_status_data);
273 } while (!stat.data_avail);
274
275 /* Ack the data_avail interrupt. */
276 ack_intr.data_avail = 1;
277 REG_WR(ser, kgdb_instance, rw_ack_intr, ack_intr);
278
279 return stat.data;
280}
281
282/* Use polling to put a single character to the kernel debug port */
283void
284putDebugChar(int val)
285{
286 reg_ser_r_status_data stat;
287 do {
288 stat = REG_RD (ser, kgdb_instance, r_status_data);
289 } while (!stat.tr_ready);
290 REG_WR (ser, kgdb_instance, rw_data_out, REG_TYPE_CONV(reg_ser_rw_data_out, int, val));
291}
292#endif /* CONFIG_ETRAX_KGDB */
293
294static int __init
295console_setup(struct console *co, char *options)
296{
297 char* s;
298
299 if (options) {
300 port = &ports[co->index];
301 port->baudrate = 115200;
302 port->parity = 'N';
303 port->bits = 8;
304 port->baudrate = simple_strtoul(options, NULL, 10);
305 s = options;
306 while(*s >= '0' && *s <= '9')
307 s++;
308 if (*s) port->parity = *s++;
309 if (*s) port->bits = *s++ - '0';
310 port->started = 0;
311 start_port(port);
312 }
313 return 0;
314}
315
316/* This is a dummy serial device that throws away anything written to it.
317 * This is used when no debug output is wanted.
318 */
319static struct tty_driver dummy_driver;
320
321static int dummy_open(struct tty_struct *tty, struct file * filp)
322{
323 return 0;
324}
325
326static void dummy_close(struct tty_struct *tty, struct file * filp)
327{
328}
329
330static int dummy_write(struct tty_struct * tty,
331 const unsigned char *buf, int count)
332{
333 return count;
334}
335
336static int
337dummy_write_room(struct tty_struct *tty)
338{
339 return 8192;
340}
341
342void __init
343init_dummy_console(void)
344{
345 memset(&dummy_driver, 0, sizeof(struct tty_driver));
346 dummy_driver.driver_name = "serial";
347 dummy_driver.name = "ttyS";
348 dummy_driver.major = TTY_MAJOR;
349 dummy_driver.minor_start = 68;
350 dummy_driver.num = 1; /* etrax100 has 4 serial ports */
351 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
352 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
353 dummy_driver.init_termios = tty_std_termios;
354 dummy_driver.init_termios.c_cflag =
355 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
356 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
357
358 dummy_driver.open = dummy_open;
359 dummy_driver.close = dummy_close;
360 dummy_driver.write = dummy_write;
361 dummy_driver.write_room = dummy_write_room;
362 if (tty_register_driver(&dummy_driver))
363 panic("Couldn't register dummy serial driver\n");
364}
365
366static struct tty_driver*
367crisv32_console_device(struct console* co, int *index)
368{
369 if (port)
370 *index = port->nbr;
371 return port ? serial_driver : &dummy_driver;
372}
373
374static struct console sercons = {
375 name : "ttyS",
376 write: console_write,
377 read : NULL,
378 device : crisv32_console_device,
379 unblank : NULL,
380 setup : console_setup,
381 flags : CON_PRINTBUFFER,
382 index : -1,
383 cflag : 0,
384 next : NULL
385};
386static struct console sercons0 = {
387 name : "ttyS",
388 write: console_write,
389 read : NULL,
390 device : crisv32_console_device,
391 unblank : NULL,
392 setup : console_setup,
393 flags : CON_PRINTBUFFER,
394 index : 0,
395 cflag : 0,
396 next : NULL
397};
398
399static struct console sercons1 = {
400 name : "ttyS",
401 write: console_write,
402 read : NULL,
403 device : crisv32_console_device,
404 unblank : NULL,
405 setup : console_setup,
406 flags : CON_PRINTBUFFER,
407 index : 1,
408 cflag : 0,
409 next : NULL
410};
411static struct console sercons2 = {
412 name : "ttyS",
413 write: console_write,
414 read : NULL,
415 device : crisv32_console_device,
416 unblank : NULL,
417 setup : console_setup,
418 flags : CON_PRINTBUFFER,
419 index : 2,
420 cflag : 0,
421 next : NULL
422};
423static struct console sercons3 = {
424 name : "ttyS",
425 write: console_write,
426 read : NULL,
427 device : crisv32_console_device,
428 unblank : NULL,
429 setup : console_setup,
430 flags : CON_PRINTBUFFER,
431 index : 3,
432 cflag : 0,
433 next : NULL
434};
435
436/* Register console for printk's, etc. */
437int __init
438init_etrax_debug(void)
439{
440 static int first = 1;
441
442 if (!first) {
443 unregister_console(&sercons);
444 register_console(&sercons0);
445 register_console(&sercons1);
446 register_console(&sercons2);
447 register_console(&sercons3);
448 init_dummy_console();
449 return 0;
450 }
451 first = 0;
452 register_console(&sercons);
453 start_port(port);
454
455#ifdef CONFIG_ETRAX_KGDB
456 start_port(kgdb_port);
457#endif /* CONFIG_ETRAX_KGDB */
458 return 0;
459}
460
461__initcall(init_etrax_debug);
diff --git a/arch/cris/arch-v32/kernel/dma.c b/arch/cris/arch-v32/kernel/dma.c
new file mode 100644
index 000000000000..b92e85799b44
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/dma.c
@@ -0,0 +1,224 @@
1/* Wrapper for DMA channel allocator that starts clocks etc */
2
3#include <linux/kernel.h>
4#include <linux/spinlock.h>
5#include <asm/dma.h>
6#include <asm/arch/hwregs/reg_map.h>
7#include <asm/arch/hwregs/reg_rdwr.h>
8#include <asm/arch/hwregs/marb_defs.h>
9#include <asm/arch/hwregs/config_defs.h>
10#include <asm/arch/hwregs/strmux_defs.h>
11#include <linux/errno.h>
12#include <asm/system.h>
13#include <asm/arch/arbiter.h>
14
15static char used_dma_channels[MAX_DMA_CHANNELS];
16static const char * used_dma_channels_users[MAX_DMA_CHANNELS];
17
18static DEFINE_SPINLOCK(dma_lock);
19
20int crisv32_request_dma(unsigned int dmanr, const char * device_id,
21 unsigned options, unsigned int bandwidth,
22 enum dma_owner owner)
23{
24 unsigned long flags;
25 reg_config_rw_clk_ctrl clk_ctrl;
26 reg_strmux_rw_cfg strmux_cfg;
27
28 if (crisv32_arbiter_allocate_bandwith(dmanr,
29 options & DMA_INT_MEM ? INT_REGION : EXT_REGION,
30 bandwidth))
31 return -ENOMEM;
32
33 spin_lock_irqsave(&dma_lock, flags);
34
35 if (used_dma_channels[dmanr]) {
36 spin_unlock_irqrestore(&dma_lock, flags);
37 if (options & DMA_VERBOSE_ON_ERROR) {
38 printk("Failed to request DMA %i for %s, already allocated by %s\n", dmanr, device_id, used_dma_channels_users[dmanr]);
39 }
40 if (options & DMA_PANIC_ON_ERROR)
41 panic("request_dma error!");
42 return -EBUSY;
43 }
44 clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl);
45 strmux_cfg = REG_RD(strmux, regi_strmux, rw_cfg);
46
47 switch(dmanr)
48 {
49 case 0:
50 case 1:
51 clk_ctrl.dma01_eth0 = 1;
52 break;
53 case 2:
54 case 3:
55 clk_ctrl.dma23 = 1;
56 break;
57 case 4:
58 case 5:
59 clk_ctrl.dma45 = 1;
60 break;
61 case 6:
62 case 7:
63 clk_ctrl.dma67 = 1;
64 break;
65 case 8:
66 case 9:
67 clk_ctrl.dma89_strcop = 1;
68 break;
69#if MAX_DMA_CHANNELS-1 != 9
70#error Check dma.c
71#endif
72 default:
73 spin_unlock_irqrestore(&dma_lock, flags);
74 if (options & DMA_VERBOSE_ON_ERROR) {
75 printk("Failed to request DMA %i for %s, only 0-%i valid)\n", dmanr, device_id, MAX_DMA_CHANNELS-1);
76 }
77
78 if (options & DMA_PANIC_ON_ERROR)
79 panic("request_dma error!");
80 return -EINVAL;
81 }
82
83 switch(owner)
84 {
85 case dma_eth0:
86 if (dmanr == 0)
87 strmux_cfg.dma0 = regk_strmux_eth0;
88 else if (dmanr == 1)
89 strmux_cfg.dma1 = regk_strmux_eth0;
90 else
91 panic("Invalid DMA channel for eth0\n");
92 break;
93 case dma_eth1:
94 if (dmanr == 6)
95 strmux_cfg.dma6 = regk_strmux_eth1;
96 else if (dmanr == 7)
97 strmux_cfg.dma7 = regk_strmux_eth1;
98 else
99 panic("Invalid DMA channel for eth1\n");
100 break;
101 case dma_iop0:
102 if (dmanr == 2)
103 strmux_cfg.dma2 = regk_strmux_iop0;
104 else if (dmanr == 3)
105 strmux_cfg.dma3 = regk_strmux_iop0;
106 else
107 panic("Invalid DMA channel for iop0\n");
108 break;
109 case dma_iop1:
110 if (dmanr == 4)
111 strmux_cfg.dma4 = regk_strmux_iop1;
112 else if (dmanr == 5)
113 strmux_cfg.dma5 = regk_strmux_iop1;
114 else
115 panic("Invalid DMA channel for iop1\n");
116 break;
117 case dma_ser0:
118 if (dmanr == 6)
119 strmux_cfg.dma6 = regk_strmux_ser0;
120 else if (dmanr == 7)
121 strmux_cfg.dma7 = regk_strmux_ser0;
122 else
123 panic("Invalid DMA channel for ser0\n");
124 break;
125 case dma_ser1:
126 if (dmanr == 4)
127 strmux_cfg.dma4 = regk_strmux_ser1;
128 else if (dmanr == 5)
129 strmux_cfg.dma5 = regk_strmux_ser1;
130 else
131 panic("Invalid DMA channel for ser1\n");
132 break;
133 case dma_ser2:
134 if (dmanr == 2)
135 strmux_cfg.dma2 = regk_strmux_ser2;
136 else if (dmanr == 3)
137 strmux_cfg.dma3 = regk_strmux_ser2;
138 else
139 panic("Invalid DMA channel for ser2\n");
140 break;
141 case dma_ser3:
142 if (dmanr == 8)
143 strmux_cfg.dma8 = regk_strmux_ser3;
144 else if (dmanr == 9)
145 strmux_cfg.dma9 = regk_strmux_ser3;
146 else
147 panic("Invalid DMA channel for ser3\n");
148 break;
149 case dma_sser0:
150 if (dmanr == 4)
151 strmux_cfg.dma4 = regk_strmux_sser0;
152 else if (dmanr == 5)
153 strmux_cfg.dma5 = regk_strmux_sser0;
154 else
155 panic("Invalid DMA channel for sser0\n");
156 break;
157 case dma_sser1:
158 if (dmanr == 6)
159 strmux_cfg.dma6 = regk_strmux_sser1;
160 else if (dmanr == 7)
161 strmux_cfg.dma7 = regk_strmux_sser1;
162 else
163 panic("Invalid DMA channel for sser1\n");
164 break;
165 case dma_ata:
166 if (dmanr == 2)
167 strmux_cfg.dma2 = regk_strmux_ata;
168 else if (dmanr == 3)
169 strmux_cfg.dma3 = regk_strmux_ata;
170 else
171 panic("Invalid DMA channel for ata\n");
172 break;
173 case dma_strp:
174 if (dmanr == 8)
175 strmux_cfg.dma8 = regk_strmux_strcop;
176 else if (dmanr == 9)
177 strmux_cfg.dma9 = regk_strmux_strcop;
178 else
179 panic("Invalid DMA channel for strp\n");
180 break;
181 case dma_ext0:
182 if (dmanr == 6)
183 strmux_cfg.dma6 = regk_strmux_ext0;
184 else
185 panic("Invalid DMA channel for ext0\n");
186 break;
187 case dma_ext1:
188 if (dmanr == 7)
189 strmux_cfg.dma7 = regk_strmux_ext1;
190 else
191 panic("Invalid DMA channel for ext1\n");
192 break;
193 case dma_ext2:
194 if (dmanr == 2)
195 strmux_cfg.dma2 = regk_strmux_ext2;
196 else if (dmanr == 8)
197 strmux_cfg.dma8 = regk_strmux_ext2;
198 else
199 panic("Invalid DMA channel for ext2\n");
200 break;
201 case dma_ext3:
202 if (dmanr == 3)
203 strmux_cfg.dma3 = regk_strmux_ext3;
204 else if (dmanr == 9)
205 strmux_cfg.dma9 = regk_strmux_ext2;
206 else
207 panic("Invalid DMA channel for ext2\n");
208 break;
209 }
210
211 used_dma_channels[dmanr] = 1;
212 used_dma_channels_users[dmanr] = device_id;
213 REG_WR(config, regi_config, rw_clk_ctrl, clk_ctrl);
214 REG_WR(strmux, regi_strmux, rw_cfg, strmux_cfg);
215 spin_unlock_irqrestore(&dma_lock,flags);
216 return 0;
217}
218
219void crisv32_free_dma(unsigned int dmanr)
220{
221 spin_lock(&dma_lock);
222 used_dma_channels[dmanr] = 0;
223 spin_unlock(&dma_lock);
224}
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
new file mode 100644
index 000000000000..a8ed55e5b403
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -0,0 +1,820 @@
1/*
2 * Copyright (C) 2000-2003 Axis Communications AB
3 *
4 * Authors: Bjorn Wesen (bjornw@axis.com)
5 * Tobias Anderberg (tobiasa@axis.com), CRISv32 port.
6 *
7 * Code for the system-call and fault low-level handling routines.
8 *
9 * NOTE: This code handles signal-recognition, which happens every time
10 * after a timer-interrupt and after each system call.
11 *
12 * Stack layout in 'ret_from_system_call':
13 * ptrace needs to have all regs on the stack.
14 * if the order here is changed, it needs to be
15 * updated in fork.c:copy_process, signal.c:do_signal,
16 * ptrace.c and ptrace.h
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/linkage.h>
22#include <linux/sys.h>
23#include <asm/unistd.h>
24#include <asm/errno.h>
25#include <asm/thread_info.h>
26#include <asm/arch/offset.h>
27
28#include <asm/arch/hwregs/asm/reg_map_asm.h>
29#include <asm/arch/hwregs/asm/intr_vect_defs_asm.h>
30
31 ;; Exported functions.
32 .globl system_call
33 .globl ret_from_intr
34 .globl ret_from_fork
35 .globl resume
36 .globl multiple_interrupt
37 .globl nmi_interrupt
38 .globl spurious_interrupt
39 .globl do_sigtrap
40 .globl gdb_handle_exception
41 .globl sys_call_table
42
43 ; Check if preemptive kernel scheduling should be done.
44#ifdef CONFIG_PREEMPT
45_resume_kernel:
46 di
47 ; Load current task struct.
48 movs.w -8192, $r0 ; THREAD_SIZE = 8192
49 and.d $sp, $r0
50
51 addoq +TI_preempt_count, $r0, $acr
52 move.d [$acr], $r10 ; Preemption disabled?
53 bne _Rexit
54 nop
55
56_need_resched:
57 addoq +TI_flags, $r0, $acr
58 move.d [$acr], $r10
59 btstq TIF_NEED_RESCHED, $r10 ; Check if need_resched is set.
60 bpl _Rexit
61 nop
62
63 ; Do preemptive kernel scheduling.
64 jsr preempt_schedule_irq
65 nop
66
67 ; Load new task struct.
68 movs.w -8192, $r0 ; THREAD_SIZE = 8192.
69 and.d $sp, $r0
70
71 ; One more time with new task.
72 ba _need_resched
73 nop
74#else
75#define _resume_kernel _Rexit
76#endif
77
78 ; Called at exit from fork. schedule_tail must be called to drop
79 ; spinlock if CONFIG_PREEMPT.
80ret_from_fork:
81 jsr schedule_tail
82 nop
83 ba ret_from_sys_call
84 nop
85
86ret_from_intr:
87 ;; Check for resched if preemptive kernel, or if we're going back to
88 ;; user-mode. This test matches the user_regs(regs) macro. Don't simply
89 ;; test CCS since that doesn't necessarily reflect what mode we'll
90 ;; return into.
91 addoq +PT_ccs, $sp, $acr
92 move.d [$acr], $r0
93 btstq 16, $r0 ; User-mode flag.
94 bpl _resume_kernel
95
96 ; Note that di below is in delay slot.
97
98_resume_userspace:
99 di ; So need_resched and sigpending don't change.
100
101 movs.w -8192, $r0 ; THREAD_SIZE == 8192
102 and.d $sp, $r0
103
104 addoq +TI_flags, $r0, $acr ; current->work
105 move.d [$acr], $r10
106 and.d _TIF_WORK_MASK, $r10 ; Work to be done on return?
107 bne _work_pending
108 nop
109 ba _Rexit
110 nop
111
112 ;; The system_call is called by a BREAK instruction, which looks pretty
113 ;; much like any other exception.
114 ;;
115 ;; System calls can't be made from interrupts but we still stack ERP
116 ;; to have a complete stack frame.
117 ;;
118 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,
119 ;; r13,mof,srp
120 ;;
121 ;; This function looks on the _surface_ like spaghetti programming, but it's
122 ;; really designed so that the fast-path does not force cache-loading of
123 ;; non-used instructions. Only the non-common cases cause the outlined code
124 ;; to run..
125
126system_call:
127 ;; Stack-frame similar to the irq heads, which is reversed in
128 ;; ret_from_sys_call.
129 subq 12, $sp ; Skip EXS, EDA.
130 move $erp, [$sp]
131 subq 4, $sp
132 move $srp, [$sp]
133 subq 4, $sp
134 move $ccs, [$sp]
135 subq 4, $sp
136 ei ; Allow IRQs while handling system call
137 move $spc, [$sp]
138 subq 4, $sp
139 move $mof, [$sp]
140 subq 4, $sp
141 move $srs, [$sp]
142 subq 4, $sp
143 move.d $acr, [$sp]
144 subq 14*4, $sp ; Make room for R0-R13.
145 movem $r13, [$sp] ; Push R0-R13
146 subq 4, $sp
147 move.d $r10, [$sp] ; Push orig_r10.
148
149; Set S-bit when kernel debugging to keep hardware breakpoints active.
150#ifdef CONFIG_ETRAX_KGDB
151 move $ccs, $r0
152 or.d (1<<9), $r0
153 move $r0, $ccs
154#endif
155
156 movs.w -ENOSYS, $r0
157 addoq +PT_r10, $sp, $acr
158 move.d $r0, [$acr]
159
160 ;; Check if this process is syscall-traced.
161 movs.w -8192, $r0 ; THREAD_SIZE == 8192
162 and.d $sp, $r0
163
164 addoq +TI_flags, $r0, $acr
165 move.d [$acr], $r0
166 btstq TIF_SYSCALL_TRACE, $r0
167 bmi _syscall_trace_entry
168 nop
169
170_syscall_traced:
171 ;; Check for sanity in the requested syscall number.
172 cmpu.w NR_syscalls, $r9
173 bhs ret_from_sys_call
174 lslq 2, $r9 ; Multiply by 4, in the delay slot.
175
176 ;; The location on the stack for the register structure is passed as a
177 ;; seventh argument. Some system calls need this.
178 move.d $sp, $r0
179 subq 4, $sp
180 move.d $r0, [$sp]
181
182 ;; The registers carrying parameters (R10-R13) are intact. The optional
183 ;; fifth and sixth parameters is in MOF and SRP respectivly. Put them
184 ;; back on the stack.
185 subq 4, $sp
186 move $srp, [$sp]
187 subq 4, $sp
188 move $mof, [$sp]
189
190 ;; Actually to the system call.
191 addo.d +sys_call_table, $r9, $acr
192 move.d [$acr], $acr
193 jsr $acr
194 nop
195
196 addq 3*4, $sp ; Pop the mof, srp and regs parameters.
197 addoq +PT_r10, $sp, $acr
198 move.d $r10, [$acr] ; Save the return value.
199
200 moveq 1, $r9 ; "Parameter" to ret_from_sys_call to
201 ; show it was a sys call.
202
203 ;; Fall through into ret_from_sys_call to return.
204
205ret_from_sys_call:
206 ;; R9 is a parameter:
207 ;; >= 1 from syscall
208 ;; 0 from irq
209
210 ;; Get the current task-struct pointer.
211 movs.w -8192, $r0 ; THREAD_SIZE == 8192
212 and.d $sp, $r0
213
214 di ; Make sure need_resched and sigpending don't change.
215
216 addoq +TI_flags, $r0, $acr
217 move.d [$acr], $r1
218 and.d _TIF_ALLWORK_MASK, $r1
219 bne _syscall_exit_work
220 nop
221
222_Rexit:
223 ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h
224 ;; and ptregs.h.
225 addq 4, $sp ; Skip orig_r10.
226 movem [$sp+], $r13 ; Registers R0-R13.
227 move.d [$sp+], $acr
228 move [$sp], $srs
229 addq 4, $sp
230 move [$sp+], $mof
231 move [$sp+], $spc
232 move [$sp+], $ccs
233 move [$sp+], $srp
234 move [$sp+], $erp
235 addq 8, $sp ; Skip EXS, EDA.
236 jump $erp
237 rfe ; Restore condition code stack in delay-slot.
238
239 ;; We get here after doing a syscall if extra work might need to be done
240 ;; perform syscall exit tracing if needed.
241
242_syscall_exit_work:
243 ;; R0 contains current at this point and irq's are disabled.
244
245 addoq +TI_flags, $r0, $acr
246 move.d [$acr], $r1
247 btstq TIF_SYSCALL_TRACE, $r1
248 bpl _work_pending
249 nop
250 ei
251 move.d $r9, $r1 ; Preserve R9.
252 jsr do_syscall_trace
253 nop
254 move.d $r1, $r9
255 ba _resume_userspace
256 nop
257
258_work_pending:
259 addoq +TI_flags, $r0, $acr
260 move.d [$acr], $r10
261 btstq TIF_NEED_RESCHED, $r10 ; Need resched?
262 bpl _work_notifysig ; No, must be signal/notify.
263 nop
264
265_work_resched:
266 move.d $r9, $r1 ; Preserve R9.
267 jsr schedule
268 nop
269 move.d $r1, $r9
270 di
271
272 addoq +TI_flags, $r0, $acr
273 move.d [$acr], $r1
274 and.d _TIF_WORK_MASK, $r1 ; Ignore sycall trace counter.
275 beq _Rexit
276 nop
277 btstq TIF_NEED_RESCHED, $r1
278 bmi _work_resched ; current->work.need_resched.
279 nop
280
281_work_notifysig:
282 ;; Deal with pending signals and notify-resume requests.
283
284 addoq +TI_flags, $r0, $acr
285 move.d [$acr], $r13 ; The thread_info_flags parameter.
286 move.d $r9, $r10 ; do_notify_resume syscall/irq param.
287 moveq 0, $r11 ; oldset param - 0 in this case.
288 move.d $sp, $r12 ; The regs param.
289 jsr do_notify_resume
290 nop
291
292 ba _Rexit
293 nop
294
295 ;; We get here as a sidetrack when we've entered a syscall with the
296 ;; trace-bit set. We need to call do_syscall_trace and then continue
297 ;; with the call.
298
299_syscall_trace_entry:
300 ;; PT_r10 in the frame contains -ENOSYS as required, at this point.
301
302 jsr do_syscall_trace
303 nop
304
305 ;; Now re-enter the syscall code to do the syscall itself. We need to
306 ;; restore R9 here to contain the wanted syscall, and the other
307 ;; parameter-bearing registers.
308 addoq +PT_r9, $sp, $acr
309 move.d [$acr], $r9
310 addoq +PT_orig_r10, $sp, $acr
311 move.d [$acr], $r10 ; PT_r10 is already -ENOSYS.
312 addoq +PT_r11, $sp, $acr
313 move.d [$acr], $r11
314 addoq +PT_r12, $sp, $acr
315 move.d [$acr], $r12
316 addoq +PT_r13, $sp, $acr
317 move.d [$acr], $r13
318 addoq +PT_mof, $sp, $acr
319 move [$acr], $mof
320 addoq +PT_srp, $sp, $acr
321 move [$acr], $srp
322
323 ba _syscall_traced
324 nop
325
326 ;; Resume performs the actual task-switching, by switching stack
327 ;; pointers. Input arguments are:
328 ;;
329 ;; R10 = prev
330 ;; R11 = next
331 ;; R12 = thread offset in task struct.
332 ;;
333 ;; Returns old current in R10.
334
335resume:
336 subq 4, $sp
337 move $srp, [$sp] ; Keep old/new PC on the stack.
338 add.d $r12, $r10 ; R10 = current tasks tss.
339 addoq +THREAD_ccs, $r10, $acr
340 move $ccs, [$acr] ; Save IRQ enable state.
341 di
342
343 addoq +THREAD_usp, $r10, $acr
344 move $usp, [$acr] ; Save user-mode stackpointer.
345
346 ;; See copy_thread for the reason why register R9 is saved.
347 subq 10*4, $sp
348 movem $r9, [$sp] ; Save non-scratch registers and R9.
349
350 addoq +THREAD_ksp, $r10, $acr
351 move.d $sp, [$acr] ; Save kernel SP for old task.
352
353 move.d $sp, $r10 ; Return last running task in R10.
354 and.d -8192, $r10 ; Get thread_info from stackpointer.
355 addoq +TI_task, $r10, $acr
356 move.d [$acr], $r10 ; Get task.
357 add.d $r12, $r11 ; Find the new tasks tss.
358 addoq +THREAD_ksp, $r11, $acr
359 move.d [$acr], $sp ; Switch to new stackframe.
360 movem [$sp+], $r9 ; Restore non-scratch registers and R9.
361
362 addoq +THREAD_usp, $r11, $acr
363 move [$acr], $usp ; Restore user-mode stackpointer.
364
365 addoq +THREAD_ccs, $r11, $acr
366 move [$acr], $ccs ; Restore IRQ enable status.
367 move.d [$sp+], $acr
368 jump $acr ; Restore PC.
369 nop
370
371nmi_interrupt:
372
373;; If we receive a watchdog interrupt while it is not expected, then set
374;; up a canonical frame and dump register contents before dying.
375
376 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
377 subq 12, $sp ; Skip EXS, EDA.
378 move $nrp, [$sp]
379 subq 4, $sp
380 move $srp, [$sp]
381 subq 4, $sp
382 move $ccs, [$sp]
383 subq 4, $sp
384 move $spc, [$sp]
385 subq 4, $sp
386 move $mof, [$sp]
387 subq 4, $sp
388 move $srs, [$sp]
389 subq 4, $sp
390 move.d $acr, [$sp]
391 subq 14*4, $sp ; Make room for R0-R13.
392 movem $r13, [$sp] ; Push R0-R13.
393 subq 4, $sp
394 move.d $r10, [$sp] ; Push orig_r10.
395 move.d REG_ADDR(intr_vect, regi_irq, r_nmi), $r0
396 move.d [$r0], $r0
397 btstq REG_BIT(intr_vect, r_nmi, watchdog), $r0
398 bpl 1f
399 nop
400 jsr handle_watchdog_bite ; In time.c.
401 move.d $sp, $r10 ; Pointer to registers
4021: btstq REG_BIT(intr_vect, r_nmi, ext), $r0
403 bpl 1f
404 nop
405 jsr handle_nmi
406 move.d $sp, $r10 ; Pointer to registers
4071: addq 4, $sp ; Skip orig_r10
408 movem [$sp+], $r13
409 move.d [$sp+], $acr
410 move [$sp], $srs
411 addq 4, $sp
412 move [$sp+], $mof
413 move [$sp+], $spc
414 move [$sp+], $ccs
415 move [$sp+], $srp
416 move [$sp+], $nrp
417 addq 8, $sp ; Skip EXS, EDA.
418 jump $nrp
419 rfn
420
421 .comm cause_of_death, 4 ;; Don't declare this anywhere.
422
423spurious_interrupt:
424 di
425 jump hard_reset_now
426 nop
427
428 ;; This handles the case when multiple interrupts arrive at the same
429 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The
430 ;; hardware will call the unserved interrupts after the handler
431 ;; finishes.
432multiple_interrupt:
433 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
434 subq 12, $sp ; Skip EXS, EDA.
435 move $erp, [$sp]
436 subq 4, $sp
437 move $srp, [$sp]
438 subq 4, $sp
439 move $ccs, [$sp]
440 subq 4, $sp
441 move $spc, [$sp]
442 subq 4, $sp
443 move $mof, [$sp]
444 subq 4, $sp
445 move $srs, [$sp]
446 subq 4, $sp
447 move.d $acr, [$sp]
448 subq 14*4, $sp ; Make room for R0-R13.
449 movem $r13, [$sp] ; Push R0-R13.
450 subq 4, $sp
451 move.d $r10, [$sp] ; Push orig_r10.
452
453; Set S-bit when kernel debugging to keep hardware breakpoints active.
454#ifdef CONFIG_ETRAX_KGDB
455 move $ccs, $r0
456 or.d (1<<9), $r0
457 move $r0, $ccs
458#endif
459
460 jsr crisv32_do_multiple
461 move.d $sp, $r10
462 jump ret_from_intr
463 nop
464
465do_sigtrap:
466 ;; Sigtraps the process that executed the BREAK instruction. Creates a
467 ;; frame that Rexit expects.
468 subq 4, $sp
469 move $eda, [$sp]
470 subq 4, $sp
471 move $exs, [$sp]
472 subq 4, $sp
473 move $erp, [$sp]
474 subq 4, $sp
475 move $srp, [$sp]
476 subq 4, $sp
477 move $ccs, [$sp]
478 subq 4, $sp
479 move $spc, [$sp]
480 subq 4, $sp
481 move $mof, [$sp]
482 subq 4, $sp
483 move $srs, [$sp]
484 subq 4, $sp
485 move.d $acr, [$sp]
486 di ; Need to disable irq's at this point.
487 subq 14*4, $sp ; Make room for r0-r13.
488 movem $r13, [$sp] ; Push the r0-r13 registers.
489 subq 4, $sp
490 move.d $r10, [$sp] ; Push orig_r10.
491
492 movs.w -8192, $r9 ; THREAD_SIZE == 8192
493 and.d $sp, $r9
494
495 ;; thread_info as first parameter
496 move.d $r9, $r10
497 moveq 5, $r11 ; SIGTRAP as second argument.
498 jsr ugdb_trap_user
499 nop
500 jump ret_from_intr ; Use the return routine for interrupts.
501 nop
502
503gdb_handle_exception:
504 subq 4, $sp
505 move.d $r0, [$sp]
506#ifdef CONFIG_ETRAX_KGDB
507 move $ccs, $r0 ; U-flag not affected by previous insns.
508 btstq 16, $r0 ; Test the U-flag.
509 bmi _ugdb_handle_exception ; Go to user mode debugging.
510 nop ; Empty delay-slot (cannot pop R0 here).
511 ba kgdb_handle_exception ; Go to kernel debugging.
512 move.d [$sp+], $r0 ; Restore R0 in delay slot.
513#endif
514
515_ugdb_handle_exception:
516 ba do_sigtrap ; SIGTRAP the offending process.
517 move.d [$sp+], $r0 ; Restore R0 in delay slot.
518
519 .data
520
521 .section .rodata,"a"
522sys_call_table:
523 .long sys_restart_syscall ; 0 - old "setup()" system call, used
524 ; for restarting.
525 .long sys_exit
526 .long sys_fork
527 .long sys_read
528 .long sys_write
529 .long sys_open /* 5 */
530 .long sys_close
531 .long sys_waitpid
532 .long sys_creat
533 .long sys_link
534 .long sys_unlink /* 10 */
535 .long sys_execve
536 .long sys_chdir
537 .long sys_time
538 .long sys_mknod
539 .long sys_chmod /* 15 */
540 .long sys_lchown16
541 .long sys_ni_syscall /* old break syscall holder */
542 .long sys_stat
543 .long sys_lseek
544 .long sys_getpid /* 20 */
545 .long sys_mount
546 .long sys_oldumount
547 .long sys_setuid16
548 .long sys_getuid16
549 .long sys_stime /* 25 */
550 .long sys_ptrace
551 .long sys_alarm
552 .long sys_fstat
553 .long sys_pause
554 .long sys_utime /* 30 */
555 .long sys_ni_syscall /* old stty syscall holder */
556 .long sys_ni_syscall /* old gtty syscall holder */
557 .long sys_access
558 .long sys_nice
559 .long sys_ni_syscall /* 35 old ftime syscall holder */
560 .long sys_sync
561 .long sys_kill
562 .long sys_rename
563 .long sys_mkdir
564 .long sys_rmdir /* 40 */
565 .long sys_dup
566 .long sys_pipe
567 .long sys_times
568 .long sys_ni_syscall /* old prof syscall holder */
569 .long sys_brk /* 45 */
570 .long sys_setgid16
571 .long sys_getgid16
572 .long sys_signal
573 .long sys_geteuid16
574 .long sys_getegid16 /* 50 */
575 .long sys_acct
576 .long sys_umount /* recycled never used phys( */
577 .long sys_ni_syscall /* old lock syscall holder */
578 .long sys_ioctl
579 .long sys_fcntl /* 55 */
580 .long sys_ni_syscall /* old mpx syscall holder */
581 .long sys_setpgid
582 .long sys_ni_syscall /* old ulimit syscall holder */
583 .long sys_ni_syscall /* old sys_olduname holder */
584 .long sys_umask /* 60 */
585 .long sys_chroot
586 .long sys_ustat
587 .long sys_dup2
588 .long sys_getppid
589 .long sys_getpgrp /* 65 */
590 .long sys_setsid
591 .long sys_sigaction
592 .long sys_sgetmask
593 .long sys_ssetmask
594 .long sys_setreuid16 /* 70 */
595 .long sys_setregid16
596 .long sys_sigsuspend
597 .long sys_sigpending
598 .long sys_sethostname
599 .long sys_setrlimit /* 75 */
600 .long sys_old_getrlimit
601 .long sys_getrusage
602 .long sys_gettimeofday
603 .long sys_settimeofday
604 .long sys_getgroups16 /* 80 */
605 .long sys_setgroups16
606 .long sys_select /* was old_select in Linux/E100 */
607 .long sys_symlink
608 .long sys_lstat
609 .long sys_readlink /* 85 */
610 .long sys_uselib
611 .long sys_swapon
612 .long sys_reboot
613 .long old_readdir
614 .long old_mmap /* 90 */
615 .long sys_munmap
616 .long sys_truncate
617 .long sys_ftruncate
618 .long sys_fchmod
619 .long sys_fchown16 /* 95 */
620 .long sys_getpriority
621 .long sys_setpriority
622 .long sys_ni_syscall /* old profil syscall holder */
623 .long sys_statfs
624 .long sys_fstatfs /* 100 */
625 .long sys_ni_syscall /* sys_ioperm in i386 */
626 .long sys_socketcall
627 .long sys_syslog
628 .long sys_setitimer
629 .long sys_getitimer /* 105 */
630 .long sys_newstat
631 .long sys_newlstat
632 .long sys_newfstat
633 .long sys_ni_syscall /* old sys_uname holder */
634 .long sys_ni_syscall /* sys_iopl in i386 */
635 .long sys_vhangup
636 .long sys_ni_syscall /* old "idle" system call */
637 .long sys_ni_syscall /* vm86old in i386 */
638 .long sys_wait4
639 .long sys_swapoff /* 115 */
640 .long sys_sysinfo
641 .long sys_ipc
642 .long sys_fsync
643 .long sys_sigreturn
644 .long sys_clone /* 120 */
645 .long sys_setdomainname
646 .long sys_newuname
647 .long sys_ni_syscall /* sys_modify_ldt */
648 .long sys_adjtimex
649 .long sys_mprotect /* 125 */
650 .long sys_sigprocmask
651 .long sys_ni_syscall /* old "create_module" */
652 .long sys_init_module
653 .long sys_delete_module
654 .long sys_ni_syscall /* 130: old "get_kernel_syms" */
655 .long sys_quotactl
656 .long sys_getpgid
657 .long sys_fchdir
658 .long sys_bdflush
659 .long sys_sysfs /* 135 */
660 .long sys_personality
661 .long sys_ni_syscall /* for afs_syscall */
662 .long sys_setfsuid16
663 .long sys_setfsgid16
664 .long sys_llseek /* 140 */
665 .long sys_getdents
666 .long sys_select
667 .long sys_flock
668 .long sys_msync
669 .long sys_readv /* 145 */
670 .long sys_writev
671 .long sys_getsid
672 .long sys_fdatasync
673 .long sys_sysctl
674 .long sys_mlock /* 150 */
675 .long sys_munlock
676 .long sys_mlockall
677 .long sys_munlockall
678 .long sys_sched_setparam
679 .long sys_sched_getparam /* 155 */
680 .long sys_sched_setscheduler
681 .long sys_sched_getscheduler
682 .long sys_sched_yield
683 .long sys_sched_get_priority_max
684 .long sys_sched_get_priority_min /* 160 */
685 .long sys_sched_rr_get_interval
686 .long sys_nanosleep
687 .long sys_mremap
688 .long sys_setresuid16
689 .long sys_getresuid16 /* 165 */
690 .long sys_ni_syscall /* sys_vm86 */
691 .long sys_ni_syscall /* Old sys_query_module */
692 .long sys_poll
693 .long sys_nfsservctl
694 .long sys_setresgid16 /* 170 */
695 .long sys_getresgid16
696 .long sys_prctl
697 .long sys_rt_sigreturn
698 .long sys_rt_sigaction
699 .long sys_rt_sigprocmask /* 175 */
700 .long sys_rt_sigpending
701 .long sys_rt_sigtimedwait
702 .long sys_rt_sigqueueinfo
703 .long sys_rt_sigsuspend
704 .long sys_pread64 /* 180 */
705 .long sys_pwrite64
706 .long sys_chown16
707 .long sys_getcwd
708 .long sys_capget
709 .long sys_capset /* 185 */
710 .long sys_sigaltstack
711 .long sys_sendfile
712 .long sys_ni_syscall /* streams1 */
713 .long sys_ni_syscall /* streams2 */
714 .long sys_vfork /* 190 */
715 .long sys_getrlimit
716 .long sys_mmap2
717 .long sys_truncate64
718 .long sys_ftruncate64
719 .long sys_stat64 /* 195 */
720 .long sys_lstat64
721 .long sys_fstat64
722 .long sys_lchown
723 .long sys_getuid
724 .long sys_getgid /* 200 */
725 .long sys_geteuid
726 .long sys_getegid
727 .long sys_setreuid
728 .long sys_setregid
729 .long sys_getgroups /* 205 */
730 .long sys_setgroups
731 .long sys_fchown
732 .long sys_setresuid
733 .long sys_getresuid
734 .long sys_setresgid /* 210 */
735 .long sys_getresgid
736 .long sys_chown
737 .long sys_setuid
738 .long sys_setgid
739 .long sys_setfsuid /* 215 */
740 .long sys_setfsgid
741 .long sys_pivot_root
742 .long sys_mincore
743 .long sys_madvise
744 .long sys_getdents64 /* 220 */
745 .long sys_fcntl64
746 .long sys_ni_syscall /* reserved for TUX */
747 .long sys_ni_syscall
748 .long sys_gettid
749 .long sys_readahead /* 225 */
750 .long sys_setxattr
751 .long sys_lsetxattr
752 .long sys_fsetxattr
753 .long sys_getxattr
754 .long sys_lgetxattr /* 230 */
755 .long sys_fgetxattr
756 .long sys_listxattr
757 .long sys_llistxattr
758 .long sys_flistxattr
759 .long sys_removexattr /* 235 */
760 .long sys_lremovexattr
761 .long sys_fremovexattr
762 .long sys_tkill
763 .long sys_sendfile64
764 .long sys_futex /* 240 */
765 .long sys_sched_setaffinity
766 .long sys_sched_getaffinity
767 .long sys_ni_syscall /* sys_set_thread_area */
768 .long sys_ni_syscall /* sys_get_thread_area */
769 .long sys_io_setup /* 245 */
770 .long sys_io_destroy
771 .long sys_io_getevents
772 .long sys_io_submit
773 .long sys_io_cancel
774 .long sys_fadvise64 /* 250 */
775 .long sys_ni_syscall
776 .long sys_exit_group
777 .long sys_lookup_dcookie
778 .long sys_epoll_create
779 .long sys_epoll_ctl /* 255 */
780 .long sys_epoll_wait
781 .long sys_remap_file_pages
782 .long sys_set_tid_address
783 .long sys_timer_create
784 .long sys_timer_settime /* 260 */
785 .long sys_timer_gettime
786 .long sys_timer_getoverrun
787 .long sys_timer_delete
788 .long sys_clock_settime
789 .long sys_clock_gettime /* 265 */
790 .long sys_clock_getres
791 .long sys_clock_nanosleep
792 .long sys_statfs64
793 .long sys_fstatfs64
794 .long sys_tgkill /* 270 */
795 .long sys_utimes
796 .long sys_fadvise64_64
797 .long sys_ni_syscall /* sys_vserver */
798 .long sys_ni_syscall /* sys_mbind */
799 .long sys_ni_syscall /* 275 sys_get_mempolicy */
800 .long sys_ni_syscall /* sys_set_mempolicy */
801 .long sys_mq_open
802 .long sys_mq_unlink
803 .long sys_mq_timedsend
804 .long sys_mq_timedreceive /* 280 */
805 .long sys_mq_notify
806 .long sys_mq_getsetattr
807 .long sys_ni_syscall /* reserved for kexec */
808 .long sys_waitid
809
810 /*
811 * NOTE!! This doesn't have to be exact - we just have
812 * to make sure we have _enough_ of the "sys_ni_syscall"
813 * entries. Don't panic if you notice that this hasn't
814 * been shrunk every time we add a new system call.
815 */
816
817 .rept NR_syscalls - (.-sys_call_table) / 4
818 .long sys_ni_syscall
819 .endr
820
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
new file mode 100644
index 000000000000..ea2b4a97c8c7
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -0,0 +1,996 @@
1/* $Id: fasttimer.c,v 1.11 2005/01/04 11:15:46 starvik Exp $
2 * linux/arch/cris/kernel/fasttimer.c
3 *
4 * Fast timers for ETRAX FS
5 * This may be useful in other OS than Linux so use 2 space indentation...
6 *
7 * $Log: fasttimer.c,v $
8 * Revision 1.11 2005/01/04 11:15:46 starvik
9 * Don't share timer IRQ.
10 *
11 * Revision 1.10 2004/12/07 09:19:38 starvik
12 * Corrected includes.
13 * Use correct interrupt macros.
14 *
15 * Revision 1.9 2004/05/14 10:18:58 starvik
16 * Export fast_timer_list
17 *
18 * Revision 1.8 2004/05/14 07:58:03 starvik
19 * Merge of changes from 2.4
20 *
21 * Revision 1.7 2003/07/10 12:06:14 starvik
22 * Return IRQ_NONE if irq wasn't handled
23 *
24 * Revision 1.6 2003/07/04 08:27:49 starvik
25 * Merge of Linux 2.5.74
26 *
27 * Revision 1.5 2003/06/05 10:16:22 johana
28 * New INTR_VECT macros.
29 *
30 * Revision 1.4 2003/06/03 08:49:45 johana
31 * Fixed typo.
32 *
33 * Revision 1.3 2003/06/02 12:51:27 johana
34 * Now compiles.
35 * Commented some include files that probably can be removed.
36 *
37 * Revision 1.2 2003/06/02 12:09:41 johana
38 * Ported to ETRAX FS using the trig interrupt instead of timer1.
39 *
40 * Revision 1.3 2002/12/12 08:26:32 starvik
41 * Don't use C-comments inside CVS comments
42 *
43 * Revision 1.2 2002/12/11 15:42:02 starvik
44 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
45 *
46 * Revision 1.1 2002/11/18 07:58:06 starvik
47 * Fast timers (from Linux 2.4)
48 *
49 * Revision 1.5 2002/10/15 06:21:39 starvik
50 * Added call to init_waitqueue_head
51 *
52 * Revision 1.4 2002/05/28 17:47:59 johana
53 * Added del_fast_timer()
54 *
55 * Revision 1.3 2002/05/28 16:16:07 johana
56 * Handle empty fast_timer_list
57 *
58 * Revision 1.2 2002/05/27 15:38:42 johana
59 * Made it compile without warnings on Linux 2.4.
60 * (includes, wait_queue, PROC_FS and snprintf)
61 *
62 * Revision 1.1 2002/05/27 15:32:25 johana
63 * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree.
64 *
65 * Revision 1.8 2001/11/27 13:50:40 pkj
66 * Disable interrupts while stopping the timer and while modifying the
67 * list of active timers in timer1_handler() as it may be interrupted
68 * by other interrupts (e.g., the serial interrupt) which may add fast
69 * timers.
70 *
71 * Revision 1.7 2001/11/22 11:50:32 pkj
72 * * Only store information about the last 16 timers.
73 * * proc_fasttimer_read() now uses an allocated buffer, since it
74 * requires more space than just a page even for only writing the
75 * last 16 timers. The buffer is only allocated on request, so
76 * unless /proc/fasttimer is read, it is never allocated.
77 * * Renamed fast_timer_started to fast_timers_started to match
78 * fast_timers_added and fast_timers_expired.
79 * * Some clean-up.
80 *
81 * Revision 1.6 2000/12/13 14:02:08 johana
82 * Removed volatile for fast_timer_list
83 *
84 * Revision 1.5 2000/12/13 13:55:35 johana
85 * Added DEBUG_LOG, added som cli() and cleanup
86 *
87 * Revision 1.4 2000/12/05 13:48:50 johana
88 * Added range check when writing proc file, modified timer int handling
89 *
90 * Revision 1.3 2000/11/23 10:10:20 johana
91 * More debug/logging possibilities.
92 * Moved GET_JIFFIES_USEC() to timex.h and time.c
93 *
94 * Revision 1.2 2000/11/01 13:41:04 johana
95 * Clean up and bugfixes.
96 * Created new do_gettimeofday_fast() that gets a timeval struct
97 * with time based on jiffies and *R_TIMER0_DATA, uses a table
98 * for fast conversion of timer value to microseconds.
99 * (Much faster the standard do_gettimeofday() and we don't really
100 * wan't to use the true time - we wan't the "uptime" so timers don't screw up
101 * when we change the time.
102 * TODO: Add efficient support for continuous timers as well.
103 *
104 * Revision 1.1 2000/10/26 15:49:16 johana
105 * Added fasttimer, highresolution timers.
106 *
107 * Copyright (C) 2000,2001 2002, 2003 Axis Communications AB, Lund, Sweden
108 */
109
110#include <linux/errno.h>
111#include <linux/sched.h>
112#include <linux/kernel.h>
113#include <linux/param.h>
114#include <linux/string.h>
115#include <linux/vmalloc.h>
116#include <linux/interrupt.h>
117#include <linux/time.h>
118#include <linux/delay.h>
119
120#include <asm/irq.h>
121#include <asm/system.h>
122
123#include <linux/config.h>
124#include <linux/version.h>
125
126#include <asm/arch/hwregs/reg_map.h>
127#include <asm/arch/hwregs/reg_rdwr.h>
128#include <asm/arch/hwregs/timer_defs.h>
129#include <asm/fasttimer.h>
130#include <linux/proc_fs.h>
131
132/*
133 * timer0 is running at 100MHz and generating jiffies timer ticks
134 * at 100 or 1000 HZ.
135 * fasttimer gives an API that gives timers that expire "between" the jiffies
136 * giving microsecond resolution (10 ns).
137 * fasttimer uses reg_timer_rw_trig register to get interrupt when
138 * r_time reaches a certain value.
139 */
140
141
142#define DEBUG_LOG_INCLUDED
143#define FAST_TIMER_LOG
144//#define FAST_TIMER_TEST
145
146#define FAST_TIMER_SANITY_CHECKS
147
148#ifdef FAST_TIMER_SANITY_CHECKS
149#define SANITYCHECK(x) x
150static int sanity_failed = 0;
151#else
152#define SANITYCHECK(x)
153#endif
154
155#define D1(x)
156#define D2(x)
157#define DP(x)
158
159#define __INLINE__ inline
160
161static int fast_timer_running = 0;
162static int fast_timers_added = 0;
163static int fast_timers_started = 0;
164static int fast_timers_expired = 0;
165static int fast_timers_deleted = 0;
166static int fast_timer_is_init = 0;
167static int fast_timer_ints = 0;
168
169struct fast_timer *fast_timer_list = NULL;
170
171#ifdef DEBUG_LOG_INCLUDED
172#define DEBUG_LOG_MAX 128
173static const char * debug_log_string[DEBUG_LOG_MAX];
174static unsigned long debug_log_value[DEBUG_LOG_MAX];
175static int debug_log_cnt = 0;
176static int debug_log_cnt_wrapped = 0;
177
178#define DEBUG_LOG(string, value) \
179{ \
180 unsigned long log_flags; \
181 local_irq_save(log_flags); \
182 debug_log_string[debug_log_cnt] = (string); \
183 debug_log_value[debug_log_cnt] = (unsigned long)(value); \
184 if (++debug_log_cnt >= DEBUG_LOG_MAX) \
185 { \
186 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \
187 debug_log_cnt_wrapped = 1; \
188 } \
189 local_irq_restore(log_flags); \
190}
191#else
192#define DEBUG_LOG(string, value)
193#endif
194
195
196#define NUM_TIMER_STATS 16
197#ifdef FAST_TIMER_LOG
198struct fast_timer timer_added_log[NUM_TIMER_STATS];
199struct fast_timer timer_started_log[NUM_TIMER_STATS];
200struct fast_timer timer_expired_log[NUM_TIMER_STATS];
201#endif
202
203int timer_div_settings[NUM_TIMER_STATS];
204int timer_delay_settings[NUM_TIMER_STATS];
205
206
207static void
208timer_trig_handler(void);
209
210
211
212/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */
213void __INLINE__ do_gettimeofday_fast(struct timeval *tv)
214{
215 unsigned long sec = jiffies;
216 unsigned long usec = GET_JIFFIES_USEC();
217
218 usec += (sec % HZ) * (1000000 / HZ);
219 sec = sec / HZ;
220
221 if (usec > 1000000)
222 {
223 usec -= 1000000;
224 sec++;
225 }
226 tv->tv_sec = sec;
227 tv->tv_usec = usec;
228}
229
230int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1)
231{
232 if (t0->tv_sec < t1->tv_sec)
233 {
234 return -1;
235 }
236 else if (t0->tv_sec > t1->tv_sec)
237 {
238 return 1;
239 }
240 if (t0->tv_usec < t1->tv_usec)
241 {
242 return -1;
243 }
244 else if (t0->tv_usec > t1->tv_usec)
245 {
246 return 1;
247 }
248 return 0;
249}
250
251/* Called with ints off */
252void __INLINE__ start_timer_trig(unsigned long delay_us)
253{
254 reg_timer_rw_ack_intr ack_intr = { 0 };
255 reg_timer_rw_intr_mask intr_mask;
256 reg_timer_rw_trig trig;
257 reg_timer_rw_trig_cfg trig_cfg = { 0 };
258 reg_timer_r_time r_time;
259
260 r_time = REG_RD(timer, regi_timer, r_time);
261
262 D1(printk("start_timer_trig : %d us freq: %i div: %i\n",
263 delay_us, freq_index, div));
264 /* Clear trig irq */
265 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
266 intr_mask.trig = 0;
267 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
268
269 /* Set timer values */
270 /* r_time is 100MHz (10 ns resolution) */
271 trig = r_time + delay_us*(1000/10);
272
273 timer_div_settings[fast_timers_started % NUM_TIMER_STATS] = trig;
274 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us;
275
276 /* Ack interrupt */
277 ack_intr.trig = 1;
278 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
279
280 /* Start timer */
281 REG_WR(timer, regi_timer, rw_trig, trig);
282 trig_cfg.tmr = regk_timer_time;
283 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
284
285 /* Check if we have already passed the trig time */
286 r_time = REG_RD(timer, regi_timer, r_time);
287 if (r_time < trig) {
288 /* No, Enable trig irq */
289 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
290 intr_mask.trig = 1;
291 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
292 fast_timers_started++;
293 fast_timer_running = 1;
294 }
295 else
296 {
297 /* We have passed the time, disable trig point, ack intr */
298 trig_cfg.tmr = regk_timer_off;
299 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
300 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
301 /* call the int routine directly */
302 timer_trig_handler();
303 }
304
305}
306
307/* In version 1.4 this function takes 27 - 50 us */
308void start_one_shot_timer(struct fast_timer *t,
309 fast_timer_function_type *function,
310 unsigned long data,
311 unsigned long delay_us,
312 const char *name)
313{
314 unsigned long flags;
315 struct fast_timer *tmp;
316
317 D1(printk("sft %s %d us\n", name, delay_us));
318
319 local_irq_save(flags);
320
321 do_gettimeofday_fast(&t->tv_set);
322 tmp = fast_timer_list;
323
324 SANITYCHECK({ /* Check so this is not in the list already... */
325 while (tmp != NULL)
326 {
327 if (tmp == t)
328 {
329 printk("timer name: %s data: 0x%08lX already in list!\n", name, data);
330 sanity_failed++;
331 return;
332 }
333 else
334 {
335 tmp = tmp->next;
336 }
337 }
338 tmp = fast_timer_list;
339 });
340
341 t->delay_us = delay_us;
342 t->function = function;
343 t->data = data;
344 t->name = name;
345
346 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000;
347 t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000;
348 if (t->tv_expires.tv_usec > 1000000)
349 {
350 t->tv_expires.tv_usec -= 1000000;
351 t->tv_expires.tv_sec++;
352 }
353#ifdef FAST_TIMER_LOG
354 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t;
355#endif
356 fast_timers_added++;
357
358 /* Check if this should timeout before anything else */
359 if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0)
360 {
361 /* Put first in list and modify the timer value */
362 t->prev = NULL;
363 t->next = fast_timer_list;
364 if (fast_timer_list)
365 {
366 fast_timer_list->prev = t;
367 }
368 fast_timer_list = t;
369#ifdef FAST_TIMER_LOG
370 timer_started_log[fast_timers_started % NUM_TIMER_STATS] = *t;
371#endif
372 start_timer_trig(delay_us);
373 } else {
374 /* Put in correct place in list */
375 while (tmp->next &&
376 timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0)
377 {
378 tmp = tmp->next;
379 }
380 /* Insert t after tmp */
381 t->prev = tmp;
382 t->next = tmp->next;
383 if (tmp->next)
384 {
385 tmp->next->prev = t;
386 }
387 tmp->next = t;
388 }
389
390 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
391
392 local_irq_restore(flags);
393} /* start_one_shot_timer */
394
395static inline int fast_timer_pending (const struct fast_timer * t)
396{
397 return (t->next != NULL) || (t->prev != NULL) || (t == fast_timer_list);
398}
399
400static inline int detach_fast_timer (struct fast_timer *t)
401{
402 struct fast_timer *next, *prev;
403 if (!fast_timer_pending(t))
404 return 0;
405 next = t->next;
406 prev = t->prev;
407 if (next)
408 next->prev = prev;
409 if (prev)
410 prev->next = next;
411 else
412 fast_timer_list = next;
413 fast_timers_deleted++;
414 return 1;
415}
416
417int del_fast_timer(struct fast_timer * t)
418{
419 unsigned long flags;
420 int ret;
421
422 local_irq_save(flags);
423 ret = detach_fast_timer(t);
424 t->next = t->prev = NULL;
425 local_irq_restore(flags);
426 return ret;
427} /* del_fast_timer */
428
429
430/* Interrupt routines or functions called in interrupt context */
431
432/* Timer interrupt handler for trig interrupts */
433
434static irqreturn_t
435timer_trig_interrupt(int irq, void *dev_id, struct pt_regs *regs)
436{
437 reg_timer_r_masked_intr masked_intr;
438
439 /* Check if the timer interrupt is for us (a trig int) */
440 masked_intr = REG_RD(timer, regi_timer, r_masked_intr);
441 if (!masked_intr.trig)
442 return IRQ_NONE;
443 timer_trig_handler();
444 return IRQ_HANDLED;
445}
446
447static void timer_trig_handler(void)
448{
449 reg_timer_rw_ack_intr ack_intr = { 0 };
450 reg_timer_rw_intr_mask intr_mask;
451 reg_timer_rw_trig_cfg trig_cfg = { 0 };
452 struct fast_timer *t;
453 unsigned long flags;
454
455 local_irq_save(flags);
456
457 /* Clear timer trig interrupt */
458 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
459 intr_mask.trig = 0;
460 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
461
462 /* First stop timer, then ack interrupt */
463 /* Stop timer */
464 trig_cfg.tmr = regk_timer_off;
465 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
466
467 /* Ack interrupt */
468 ack_intr.trig = 1;
469 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
470
471 fast_timer_running = 0;
472 fast_timer_ints++;
473
474 local_irq_restore(flags);
475
476 t = fast_timer_list;
477 while (t)
478 {
479 struct timeval tv;
480
481 /* Has it really expired? */
482 do_gettimeofday_fast(&tv);
483 D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec));
484
485 if (timeval_cmp(&t->tv_expires, &tv) <= 0)
486 {
487 /* Yes it has expired */
488#ifdef FAST_TIMER_LOG
489 timer_expired_log[fast_timers_expired % NUM_TIMER_STATS] = *t;
490#endif
491 fast_timers_expired++;
492
493 /* Remove this timer before call, since it may reuse the timer */
494 local_irq_save(flags);
495 if (t->prev)
496 {
497 t->prev->next = t->next;
498 }
499 else
500 {
501 fast_timer_list = t->next;
502 }
503 if (t->next)
504 {
505 t->next->prev = t->prev;
506 }
507 t->prev = NULL;
508 t->next = NULL;
509 local_irq_restore(flags);
510
511 if (t->function != NULL)
512 {
513 t->function(t->data);
514 }
515 else
516 {
517 DEBUG_LOG("!trimertrig %i function==NULL!\n", fast_timer_ints);
518 }
519 }
520 else
521 {
522 /* Timer is to early, let's set it again using the normal routines */
523 D1(printk(".\n"));
524 }
525
526 local_irq_save(flags);
527 if ((t = fast_timer_list) != NULL)
528 {
529 /* Start next timer.. */
530 long us;
531 struct timeval tv;
532
533 do_gettimeofday_fast(&tv);
534 us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 +
535 t->tv_expires.tv_usec - tv.tv_usec);
536 if (us > 0)
537 {
538 if (!fast_timer_running)
539 {
540#ifdef FAST_TIMER_LOG
541 timer_started_log[fast_timers_started % NUM_TIMER_STATS] = *t;
542#endif
543 start_timer_trig(us);
544 }
545 local_irq_restore(flags);
546 break;
547 }
548 else
549 {
550 /* Timer already expired, let's handle it better late than never.
551 * The normal loop handles it
552 */
553 D1(printk("e! %d\n", us));
554 }
555 }
556 local_irq_restore(flags);
557 }
558
559 if (!t)
560 {
561 D1(printk("ttrig stop!\n"));
562 }
563}
564
565static void wake_up_func(unsigned long data)
566{
567#ifdef DECLARE_WAITQUEUE
568 wait_queue_head_t *sleep_wait_p = (wait_queue_head_t*)data;
569#else
570 struct wait_queue **sleep_wait_p = (struct wait_queue **)data;
571#endif
572 wake_up(sleep_wait_p);
573}
574
575
576/* Useful API */
577
578void schedule_usleep(unsigned long us)
579{
580 struct fast_timer t;
581#ifdef DECLARE_WAITQUEUE
582 wait_queue_head_t sleep_wait;
583 init_waitqueue_head(&sleep_wait);
584 {
585 DECLARE_WAITQUEUE(wait, current);
586#else
587 struct wait_queue *sleep_wait = NULL;
588 struct wait_queue wait = { current, NULL };
589#endif
590
591 D1(printk("schedule_usleep(%d)\n", us));
592 add_wait_queue(&sleep_wait, &wait);
593 set_current_state(TASK_INTERRUPTIBLE);
594 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us,
595 "usleep");
596 schedule();
597 set_current_state(TASK_RUNNING);
598 remove_wait_queue(&sleep_wait, &wait);
599 D1(printk("done schedule_usleep(%d)\n", us));
600#ifdef DECLARE_WAITQUEUE
601 }
602#endif
603}
604
605#ifdef CONFIG_PROC_FS
606static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
607#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
608 ,int *eof, void *data_unused
609#else
610 ,int unused
611#endif
612 );
613#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
614static struct proc_dir_entry *fasttimer_proc_entry;
615#else
616static struct proc_dir_entry fasttimer_proc_entry =
617{
618 0, 9, "fasttimer",
619 S_IFREG | S_IRUGO, 1, 0, 0,
620 0, NULL /* ops -- default to array */,
621 &proc_fasttimer_read /* get_info */,
622};
623#endif
624#endif /* CONFIG_PROC_FS */
625
626#ifdef CONFIG_PROC_FS
627
628/* This value is very much based on testing */
629#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
630
631static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
632#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
633 ,int *eof, void *data_unused
634#else
635 ,int unused
636#endif
637 )
638{
639 unsigned long flags;
640 int i = 0;
641 int num_to_show;
642 struct timeval tv;
643 struct fast_timer *t, *nextt;
644 static char *bigbuf = NULL;
645 static unsigned long used;
646
647 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
648 {
649 used = 0;
650 bigbuf[0] = '\0';
651 return 0;
652 }
653
654 if (!offset || !used)
655 {
656 do_gettimeofday_fast(&tv);
657
658 used = 0;
659 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
660 fast_timers_added);
661 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
662 fast_timers_started);
663 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
664 fast_timer_ints);
665 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
666 fast_timers_expired);
667 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
668 fast_timers_deleted);
669 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
670 fast_timer_running ? "yes" : "no");
671 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
672 (unsigned long)tv.tv_sec,
673 (unsigned long)tv.tv_usec);
674#ifdef FAST_TIMER_SANITY_CHECKS
675 used += sprintf(bigbuf + used, "Sanity failed: %i\n",
676 sanity_failed);
677#endif
678 used += sprintf(bigbuf + used, "\n");
679
680#ifdef DEBUG_LOG_INCLUDED
681 {
682 int end_i = debug_log_cnt;
683 i = 0;
684
685 if (debug_log_cnt_wrapped)
686 {
687 i = debug_log_cnt;
688 }
689
690 while ((i != end_i || (debug_log_cnt_wrapped && !used)) &&
691 used+100 < BIG_BUF_SIZE)
692 {
693 used += sprintf(bigbuf + used, debug_log_string[i],
694 debug_log_value[i]);
695 i = (i+1) % DEBUG_LOG_MAX;
696 }
697 }
698 used += sprintf(bigbuf + used, "\n");
699#endif
700
701 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
702 NUM_TIMER_STATS);
703 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started);
704 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++)
705 {
706 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
707
708#if 1 //ndef FAST_TIMER_LOG
709 used += sprintf(bigbuf + used, "div: %i delay: %i"
710 "\n",
711 timer_div_settings[cur],
712 timer_delay_settings[cur]
713 );
714#endif
715#ifdef FAST_TIMER_LOG
716 t = &timer_started_log[cur];
717 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
718 "d: %6li us data: 0x%08lX"
719 "\n",
720 t->name,
721 (unsigned long)t->tv_set.tv_sec,
722 (unsigned long)t->tv_set.tv_usec,
723 (unsigned long)t->tv_expires.tv_sec,
724 (unsigned long)t->tv_expires.tv_usec,
725 t->delay_us,
726 t->data
727 );
728#endif
729 }
730 used += sprintf(bigbuf + used, "\n");
731
732#ifdef FAST_TIMER_LOG
733 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
734 NUM_TIMER_STATS);
735 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added);
736 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
737 {
738 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
739 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
740 "d: %6li us data: 0x%08lX"
741 "\n",
742 t->name,
743 (unsigned long)t->tv_set.tv_sec,
744 (unsigned long)t->tv_set.tv_usec,
745 (unsigned long)t->tv_expires.tv_sec,
746 (unsigned long)t->tv_expires.tv_usec,
747 t->delay_us,
748 t->data
749 );
750 }
751 used += sprintf(bigbuf + used, "\n");
752
753 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
754 NUM_TIMER_STATS);
755 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired);
756 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
757 {
758 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
759 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
760 "d: %6li us data: 0x%08lX"
761 "\n",
762 t->name,
763 (unsigned long)t->tv_set.tv_sec,
764 (unsigned long)t->tv_set.tv_usec,
765 (unsigned long)t->tv_expires.tv_sec,
766 (unsigned long)t->tv_expires.tv_usec,
767 t->delay_us,
768 t->data
769 );
770 }
771 used += sprintf(bigbuf + used, "\n");
772#endif
773
774 used += sprintf(bigbuf + used, "Active timers:\n");
775 local_irq_save(flags);
776 local_irq_save(flags);
777 t = fast_timer_list;
778 while (t != NULL && (used+100 < BIG_BUF_SIZE))
779 {
780 nextt = t->next;
781 local_irq_restore(flags);
782 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
783 "d: %6li us data: 0x%08lX"
784/* " func: 0x%08lX" */
785 "\n",
786 t->name,
787 (unsigned long)t->tv_set.tv_sec,
788 (unsigned long)t->tv_set.tv_usec,
789 (unsigned long)t->tv_expires.tv_sec,
790 (unsigned long)t->tv_expires.tv_usec,
791 t->delay_us,
792 t->data
793/* , t->function */
794 );
795 local_irq_disable();
796 if (t->next != nextt)
797 {
798 printk("timer removed!\n");
799 }
800 t = nextt;
801 }
802 local_irq_restore(flags);
803 }
804
805 if (used - offset < len)
806 {
807 len = used - offset;
808 }
809
810 memcpy(buf, bigbuf + offset, len);
811 *start = buf;
812#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
813 *eof = 1;
814#endif
815
816 return len;
817}
818#endif /* PROC_FS */
819
820#ifdef FAST_TIMER_TEST
821static volatile unsigned long i = 0;
822static volatile int num_test_timeout = 0;
823static struct fast_timer tr[10];
824static int exp_num[10];
825
826static struct timeval tv_exp[100];
827
828static void test_timeout(unsigned long data)
829{
830 do_gettimeofday_fast(&tv_exp[data]);
831 exp_num[data] = num_test_timeout;
832
833 num_test_timeout++;
834}
835
836static void test_timeout1(unsigned long data)
837{
838 do_gettimeofday_fast(&tv_exp[data]);
839 exp_num[data] = num_test_timeout;
840 if (data < 7)
841 {
842 start_one_shot_timer(&tr[i], test_timeout1, i, 1000, "timeout1");
843 i++;
844 }
845 num_test_timeout++;
846}
847
848DP(
849static char buf0[2000];
850static char buf1[2000];
851static char buf2[2000];
852static char buf3[2000];
853static char buf4[2000];
854);
855
856static char buf5[6000];
857static int j_u[1000];
858
859static void fast_timer_test(void)
860{
861 int prev_num;
862 int j;
863
864 struct timeval tv, tv0, tv1, tv2;
865
866 printk("fast_timer_test() start\n");
867 do_gettimeofday_fast(&tv);
868
869 for (j = 0; j < 1000; j++)
870 {
871 j_u[j] = GET_JIFFIES_USEC();
872 }
873 for (j = 0; j < 100; j++)
874 {
875 do_gettimeofday_fast(&tv_exp[j]);
876 }
877 printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec);
878
879 for (j = 0; j < 1000; j++)
880 {
881 printk("%i %i %i %i %i\n",j_u[j], j_u[j+1], j_u[j+2], j_u[j+3], j_u[j+4]);
882 j += 4;
883 }
884 for (j = 0; j < 100; j++)
885 {
886 printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n",
887 tv_exp[j].tv_sec,tv_exp[j].tv_usec,
888 tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec,
889 tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec,
890 tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec,
891 tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec);
892 j += 4;
893 }
894 do_gettimeofday_fast(&tv0);
895 start_one_shot_timer(&tr[i], test_timeout, i, 50000, "test0");
896 DP(proc_fasttimer_read(buf0, NULL, 0, 0, 0));
897 i++;
898 start_one_shot_timer(&tr[i], test_timeout, i, 70000, "test1");
899 DP(proc_fasttimer_read(buf1, NULL, 0, 0, 0));
900 i++;
901 start_one_shot_timer(&tr[i], test_timeout, i, 40000, "test2");
902 DP(proc_fasttimer_read(buf2, NULL, 0, 0, 0));
903 i++;
904 start_one_shot_timer(&tr[i], test_timeout, i, 60000, "test3");
905 DP(proc_fasttimer_read(buf3, NULL, 0, 0, 0));
906 i++;
907 start_one_shot_timer(&tr[i], test_timeout1, i, 55000, "test4xx");
908 DP(proc_fasttimer_read(buf4, NULL, 0, 0, 0));
909 i++;
910 do_gettimeofday_fast(&tv1);
911
912 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
913
914 prev_num = num_test_timeout;
915 while (num_test_timeout < i)
916 {
917 if (num_test_timeout != prev_num)
918 {
919 prev_num = num_test_timeout;
920 }
921 }
922 do_gettimeofday_fast(&tv2);
923 printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec);
924 printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec);
925 printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec);
926 DP(printk("buf0:\n");
927 printk(buf0);
928 printk("buf1:\n");
929 printk(buf1);
930 printk("buf2:\n");
931 printk(buf2);
932 printk("buf3:\n");
933 printk(buf3);
934 printk("buf4:\n");
935 printk(buf4);
936 );
937 printk("buf5:\n");
938 printk(buf5);
939
940 printk("timers set:\n");
941 for(j = 0; j<i; j++)
942 {
943 struct fast_timer *t = &tr[j];
944 printk("%-10s set: %6is %06ius exp: %6is %06ius "
945 "data: 0x%08X func: 0x%08X\n",
946 t->name,
947 t->tv_set.tv_sec,
948 t->tv_set.tv_usec,
949 t->tv_expires.tv_sec,
950 t->tv_expires.tv_usec,
951 t->data,
952 t->function
953 );
954
955 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n",
956 t->delay_us,
957 tv_exp[j].tv_sec,
958 tv_exp[j].tv_usec,
959 exp_num[j],
960 (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec);
961 }
962 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
963 printk("buf5 after all done:\n");
964 printk(buf5);
965 printk("fast_timer_test() done\n");
966}
967#endif
968
969
970void fast_timer_init(void)
971{
972 /* For some reason, request_irq() hangs when called froom time_init() */
973 if (!fast_timer_is_init)
974 {
975 printk("fast_timer_init()\n");
976
977#ifdef CONFIG_PROC_FS
978#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
979 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
980 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
981#else
982 proc_register_dynamic(&proc_root, &fasttimer_proc_entry);
983#endif
984#endif /* PROC_FS */
985 if(request_irq(TIMER_INTR_VECT, timer_trig_interrupt, SA_INTERRUPT,
986 "fast timer int", NULL))
987 {
988 printk("err: timer1 irq\n");
989 }
990 fast_timer_is_init = 1;
991#ifdef FAST_TIMER_TEST
992 printk("do test\n");
993 fast_timer_test();
994#endif
995 }
996}
diff --git a/arch/cris/arch-v32/kernel/head.S b/arch/cris/arch-v32/kernel/head.S
new file mode 100644
index 000000000000..3cfe57dc391d
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/head.S
@@ -0,0 +1,448 @@
1/*
2 * CRISv32 kernel startup code.
3 *
4 * Copyright (C) 2003, Axis Communications AB
5 */
6
7#include <linux/config.h>
8
9#define ASSEMBLER_MACROS_ONLY
10
11/*
12 * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so
13 * -traditional must not be used when assembling this file.
14 */
15#include <asm/arch/hwregs/reg_rdwr.h>
16#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
17#include <asm/arch/hwregs/asm/reg_map_asm.h>
18#include <asm/arch/hwregs/asm/config_defs_asm.h>
19#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
20
21#define CRAMFS_MAGIC 0x28cd3d45
22#define RAM_INIT_MAGIC 0x56902387
23#define COMMAND_LINE_MAGIC 0x87109563
24
25 ;; NOTE: R8 and R9 carry information from the decompressor (if the
26 ;; kernel was compressed). They must not be used in the code below
27 ;; until they are read!
28
29 ;; Exported symbols.
30 .global etrax_irv
31 .global romfs_start
32 .global romfs_length
33 .global romfs_in_flash
34 .global swapper_pg_dir
35 .global crisv32_nand_boot
36 .global crisv32_nand_cramfs_offset
37
38 ;; Dummy section to make it bootable with current VCS simulator
39#ifdef CONFIG_ETRAXFS_SIM
40 .section ".boot", "ax"
41 ba tstart
42 nop
43#endif
44
45 .text
46tstart:
47 ;; This is the entry point of the kernel. The CPU is currently in
48 ;; supervisor mode.
49 ;;
50 ;; 0x00000000 if flash.
51 ;; 0x40004000 if DRAM.
52 ;;
53 di
54
55 ;; Start clocks for used blocks.
56 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
57 move.d [$r1], $r0
58 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
59 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
60 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
61 move.d $r0, [$r1]
62
63 ;; Set up waitstates etc
64 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r0
65 move.d CONFIG_ETRAX_MEM_GRP1_CONFIG, $r1
66 move.d $r1, [$r0]
67 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp2_cfg), $r0
68 move.d CONFIG_ETRAX_MEM_GRP2_CONFIG, $r1
69 move.d $r1, [$r0]
70 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r0
71 move.d CONFIG_ETRAX_MEM_GRP3_CONFIG, $r1
72 move.d $r1, [$r0]
73 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg), $r0
74 move.d CONFIG_ETRAX_MEM_GRP4_CONFIG, $r1
75 move.d $r1, [$r0]
76
77#ifdef CONFIG_ETRAXFS_SIM
78 ;; Set up minimal flash waitstates
79 move.d 0, $r10
80 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r11
81 move.d $r10, [$r11]
82#endif
83
84 ;; Setup and enable the MMU. Use same configuration for both the data
85 ;; and the instruction MMU.
86 ;;
87 ;; Note; 3 cycles is needed for a bank-select to take effect. Further;
88 ;; bank 1 is the instruction MMU, bank 2 is the data MMU.
89#ifndef CONFIG_ETRAXFS_SIM
90 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
91 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \
92 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0
93#else
94 ;; Map the virtual DRAM to the RW eprom area at address 0.
95 ;; Also map 0xa for the hook calls,
96 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
97 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0) \
98 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) \
99 | REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa), $r0
100#endif
101
102 ;; Temporary map of 0x40 -> 0x40 and 0x00 -> 0x00.
103 move.d REG_FIELD(mmu, rw_mm_kbase_lo, base_4, 4) \
104 | REG_FIELD(mmu, rw_mm_kbase_lo, base_0, 0), $r1
105
106 ;; Enable certain page protections and setup linear mapping
107 ;; for f,e,c,b,4,0.
108#ifndef CONFIG_ETRAXFS_SIM
109 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
110 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
111 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
112 | REG_STATE(mmu, rw_mm_cfg, inv, on) \
113 | REG_STATE(mmu, rw_mm_cfg, seg_f, linear) \
114 | REG_STATE(mmu, rw_mm_cfg, seg_e, linear) \
115 | REG_STATE(mmu, rw_mm_cfg, seg_d, page) \
116 | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \
117 | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \
118 | REG_STATE(mmu, rw_mm_cfg, seg_a, page) \
119 | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \
120 | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \
121 | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \
122 | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \
123 | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \
124 | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \
125 | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \
126 | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \
127 | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \
128 | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2
129#else
130 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
131 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
132 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
133 | REG_STATE(mmu, rw_mm_cfg, inv, on) \
134 | REG_STATE(mmu, rw_mm_cfg, seg_f, linear) \
135 | REG_STATE(mmu, rw_mm_cfg, seg_e, linear) \
136 | REG_STATE(mmu, rw_mm_cfg, seg_d, page) \
137 | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \
138 | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \
139 | REG_STATE(mmu, rw_mm_cfg, seg_a, linear) \
140 | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \
141 | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \
142 | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \
143 | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \
144 | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \
145 | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \
146 | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \
147 | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \
148 | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \
149 | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2
150#endif
151
152 ;; Update instruction MMU.
153 move 1, $srs
154 nop
155 nop
156 nop
157 move $r0, $s2 ; kbase_hi.
158 move $r1, $s1 ; kbase_lo.
159 move $r2, $s0 ; mm_cfg, virtual memory configuration.
160
161 ;; Update data MMU.
162 move 2, $srs
163 nop
164 nop
165 nop
166 move $r0, $s2 ; kbase_hi.
167 move $r1, $s1 ; kbase_lo
168 move $r2, $s0 ; mm_cfg, virtual memory configuration.
169
170 ;; Enable data and instruction MMU.
171 move 0, $srs
172 moveq 0xf, $r0 ; IMMU, DMMU, DCache, Icache on
173 nop
174 nop
175 nop
176 move $r0, $s0
177 nop
178 nop
179 nop
180
181#ifdef CONFIG_SMP
182 ;; Read CPU ID
183 move 0, $srs
184 nop
185 nop
186 nop
187 move $s10, $r0
188 cmpq 0, $r0
189 beq master_cpu
190 nop
191slave_cpu:
192 ; A slave waits for cpu_now_booting to be equal to CPU ID.
193 move.d cpu_now_booting, $r1
194slave_wait:
195 cmp.d [$r1], $r0
196 bne slave_wait
197 nop
198 ; Time to boot-up. Get stack location provided by master CPU.
199 move.d smp_init_current_idle_thread, $r1
200 move.d [$r1], $sp
201 add.d 8192, $sp
202 move.d ebp_start, $r0 ; Defined in linker-script.
203 move $r0, $ebp
204 jsr smp_callin
205 nop
206master_cpu:
207#endif
208#ifndef CONFIG_ETRAXFS_SIM
209 ;; Check if starting from DRAM or flash.
210 lapcq ., $r0
211 and.d 0x7fffffff, $r0 ; Mask off the non-cache bit.
212 cmp.d 0x10000, $r0 ; Arbitrary, something above this code.
213 blo _inflash0
214 nop
215#endif
216
217 jump _inram ; Jump to cached RAM.
218 nop
219
220 ;; Jumpgate.
221_inflash0:
222 jump _inflash
223 nop
224
225 ;; Put the following in a section so that storage for it can be
226 ;; reclaimed after init is finished.
227 .section ".init.text", "ax"
228
229_inflash:
230
231 ;; Initialize DRAM.
232 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
233 beq _dram_initialized
234 nop
235
236#include "../lib/dram_init.S"
237
238_dram_initialized:
239 ;; Copy the text and data section to DRAM. This depends on that the
240 ;; variables used below are correctly set up by the linker script.
241 ;; The calculated value stored in R4 is used below.
242 moveq 0, $r0 ; Source.
243 move.d text_start, $r1 ; Destination.
244 move.d __vmlinux_end, $r2
245 move.d $r2, $r4
246 sub.d $r1, $r4
2471: move.w [$r0+], $r3
248 move.w $r3, [$r1+]
249 cmp.d $r2, $r1
250 blo 1b
251 nop
252
253 ;; Keep CRAMFS in flash.
254 moveq 0, $r0
255 move.d romfs_length, $r1
256 move.d $r0, [$r1]
257 move.d [$r4], $r0 ; cramfs_super.magic
258 cmp.d CRAMFS_MAGIC, $r0
259 bne 1f
260 nop
261
262 addoq +4, $r4, $acr
263 move.d [$acr], $r0
264 move.d romfs_length, $r1
265 move.d $r0, [$r1]
266 add.d 0xf0000000, $r4 ; Add cached flash start in virtual memory.
267 move.d romfs_start, $r1
268 move.d $r4, [$r1]
2691: moveq 1, $r0
270 move.d romfs_in_flash, $r1
271 move.d $r0, [$r1]
272
273 jump _start_it ; Jump to cached code.
274 nop
275
276_inram:
277 ;; Check if booting from NAND flash (in that case we just remember the offset
278 ;; into the flash where cramfs should be).
279 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
280 move.d [$r0], $r0
281 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
282 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
283 bne move_cramfs
284 moveq 1,$r0
285 move.d crisv32_nand_boot, $r1
286 move.d $r0, [$r1]
287 move.d crisv32_nand_cramfs_offset, $r1
288 move.d $r9, [$r1]
289 moveq 1, $r0
290 move.d romfs_in_flash, $r1
291 move.d $r0, [$r1]
292 jump _start_it
293 nop
294
295move_cramfs:
296 ;; Move the cramfs after BSS.
297 moveq 0, $r0
298 move.d romfs_length, $r1
299 move.d $r0, [$r1]
300
301#ifndef CONFIG_ETRAXFS_SIM
302 ;; The kernel could have been unpacked to DRAM by the loader, but
303 ;; the cramfs image could still be inte the flash immediately
304 ;; following the compressed kernel image. The loaded passes the address
305 ;; of the bute succeeding the last compressed byte in the flash in
306 ;; register R9 when starting the kernel.
307 cmp.d 0x0ffffff8, $r9
308 bhs _no_romfs_in_flash ; R9 points outside the flash area.
309 nop
310#else
311 ba _no_romfs_in_flash
312 nop
313#endif
314 move.d [$r9], $r0 ; cramfs_super.magic
315 cmp.d CRAMFS_MAGIC, $r0
316 bne _no_romfs_in_flash
317 nop
318
319 addoq +4, $r9, $acr
320 move.d [$acr], $r0
321 move.d romfs_length, $r1
322 move.d $r0, [$r1]
323 add.d 0xf0000000, $r9 ; Add cached flash start in virtual memory.
324 move.d romfs_start, $r1
325 move.d $r9, [$r1]
326 moveq 1, $r0
327 move.d romfs_in_flash, $r1
328 move.d $r0, [$r1]
329
330 jump _start_it ; Jump to cached code.
331 nop
332
333_no_romfs_in_flash:
334 ;; Look for cramfs.
335#ifndef CONFIG_ETRAXFS_SIM
336 move.d __vmlinux_end, $r0
337#else
338 move.d __end, $r0
339#endif
340 move.d [$r0], $r1
341 cmp.d CRAMFS_MAGIC, $r1
342 bne 2f
343 nop
344
345 addoq +4, $r0, $acr
346 move.d [$acr], $r2
347 move.d _end, $r1
348 move.d romfs_start, $r3
349 move.d $r1, [$r3]
350 move.d romfs_length, $r3
351 move.d $r2, [$r3]
352
353#ifndef CONFIG_ETRAXFS_SIM
354 add.d $r2, $r0
355 add.d $r2, $r1
356
357 lsrq 1, $r2 ; Size is in bytes, we copy words.
358 addq 1, $r2
3591:
360 move.w [$r0], $r3
361 move.w $r3, [$r1]
362 subq 2, $r0
363 subq 2, $r1
364 subq 1, $r2
365 bne 1b
366 nop
367#endif
368
3692:
370 moveq 0, $r0
371 move.d romfs_in_flash, $r1
372 move.d $r0, [$r1]
373
374 jump _start_it ; Jump to cached code.
375 nop
376
377_start_it:
378
379 ;; Check if kernel command line is supplied
380 cmp.d COMMAND_LINE_MAGIC, $r10
381 bne no_command_line
382 nop
383
384 move.d 256, $r13
385 move.d cris_command_line, $r10
386 or.d 0x80000000, $r11 ; Make it virtual
3871:
388 move.b [$r11+], $r12
389 move.b $r12, [$r10+]
390 subq 1, $r13
391 bne 1b
392 nop
393
394no_command_line:
395
396 ;; The kernel stack contains a task structure for each task. This
397 ;; the initial kernel stack is in the same page as the init_task,
398 ;; but starts at the top of the page, i.e. + 8192 bytes.
399 move.d init_thread_union + 8192, $sp
400 move.d ebp_start, $r0 ; Defined in linker-script.
401 move $r0, $ebp
402 move.d etrax_irv, $r1 ; Set the exception base register and pointer.
403 move.d $r0, [$r1]
404
405#ifndef CONFIG_ETRAXFS_SIM
406 ;; Clear the BSS region from _bss_start to _end.
407 move.d __bss_start, $r0
408 move.d _end, $r1
4091: clear.d [$r0+]
410 cmp.d $r1, $r0
411 blo 1b
412 nop
413#endif
414
415#ifdef CONFIG_ETRAXFS_SIM
416 /* Set the watchdog timeout to something big. Will be removed when */
417 /* watchdog can be disabled with command line option */
418 move.d 0x7fffffff, $r10
419 jsr CPU_WATCHDOG_TIMEOUT
420 nop
421#endif
422
423 ; Initialize registers to increase determinism
424 move.d __bss_start, $r0
425 movem [$r0], $r13
426
427 jump start_kernel ; Jump to start_kernel() in init/main.c.
428 nop
429
430 .data
431etrax_irv:
432 .dword 0
433romfs_start:
434 .dword 0
435romfs_length:
436 .dword 0
437romfs_in_flash:
438 .dword 0
439crisv32_nand_boot:
440 .dword 0
441crisv32_nand_cramfs_offset:
442 .dword 0
443
444swapper_pg_dir = 0xc0002000
445
446 .section ".init.data", "aw"
447
448#include "../lib/hw_settings.S"
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c
new file mode 100644
index 000000000000..6bc9f263c3d6
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/io.c
@@ -0,0 +1,154 @@
1/*
2 * Helper functions for I/O pins.
3 *
4 * Copyright (c) 2004 Axis Communications AB.
5 */
6
7#include <linux/config.h>
8#include <linux/types.h>
9#include <linux/errno.h>
10#include <linux/init.h>
11#include <linux/string.h>
12#include <linux/ctype.h>
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <asm/io.h>
16#include <asm/arch/pinmux.h>
17#include <asm/arch/hwregs/gio_defs.h>
18
19struct crisv32_ioport crisv32_ioports[] =
20{
21 {
22 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pa_oe),
23 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pa_dout),
24 (unsigned long*)REG_ADDR(gio, regi_gio, r_pa_din),
25 8
26 },
27 {
28 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pb_oe),
29 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pb_dout),
30 (unsigned long*)REG_ADDR(gio, regi_gio, r_pb_din),
31 18
32 },
33 {
34 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pc_oe),
35 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pc_dout),
36 (unsigned long*)REG_ADDR(gio, regi_gio, r_pc_din),
37 18
38 },
39 {
40 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pd_oe),
41 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pd_dout),
42 (unsigned long*)REG_ADDR(gio, regi_gio, r_pd_din),
43 18
44 },
45 {
46 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pe_oe),
47 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pe_dout),
48 (unsigned long*)REG_ADDR(gio, regi_gio, r_pe_din),
49 18
50 }
51};
52
53#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport)
54
55struct crisv32_iopin crisv32_led1_green;
56struct crisv32_iopin crisv32_led1_red;
57struct crisv32_iopin crisv32_led2_green;
58struct crisv32_iopin crisv32_led2_red;
59struct crisv32_iopin crisv32_led3_green;
60struct crisv32_iopin crisv32_led3_red;
61
62/* Dummy port used when green LED and red LED is on the same bit */
63static unsigned long io_dummy;
64static struct crisv32_ioport dummy_port =
65{
66 &io_dummy,
67 &io_dummy,
68 &io_dummy,
69 18
70};
71static struct crisv32_iopin dummy_led =
72{
73 &dummy_port,
74 0
75};
76
77static int __init crisv32_io_init(void)
78{
79 int ret = 0;
80 /* Initialize LEDs */
81 ret += crisv32_io_get_name(&crisv32_led1_green, CONFIG_ETRAX_LED1G);
82 ret += crisv32_io_get_name(&crisv32_led1_red, CONFIG_ETRAX_LED1R);
83 ret += crisv32_io_get_name(&crisv32_led2_green, CONFIG_ETRAX_LED2G);
84 ret += crisv32_io_get_name(&crisv32_led2_red, CONFIG_ETRAX_LED2R);
85 ret += crisv32_io_get_name(&crisv32_led3_green, CONFIG_ETRAX_LED3G);
86 ret += crisv32_io_get_name(&crisv32_led3_red, CONFIG_ETRAX_LED3R);
87 crisv32_io_set_dir(&crisv32_led1_green, crisv32_io_dir_out);
88 crisv32_io_set_dir(&crisv32_led1_red, crisv32_io_dir_out);
89 crisv32_io_set_dir(&crisv32_led2_green, crisv32_io_dir_out);
90 crisv32_io_set_dir(&crisv32_led2_red, crisv32_io_dir_out);
91 crisv32_io_set_dir(&crisv32_led3_green, crisv32_io_dir_out);
92 crisv32_io_set_dir(&crisv32_led3_red, crisv32_io_dir_out);
93
94 if (!strcmp(CONFIG_ETRAX_LED1G, CONFIG_ETRAX_LED1R))
95 crisv32_led1_red = dummy_led;
96 if (!strcmp(CONFIG_ETRAX_LED2G, CONFIG_ETRAX_LED2R))
97 crisv32_led2_red = dummy_led;
98
99 return ret;
100}
101
102__initcall(crisv32_io_init);
103
104int crisv32_io_get(struct crisv32_iopin* iopin,
105 unsigned int port, unsigned int pin)
106{
107 if (port > NBR_OF_PORTS)
108 return -EINVAL;
109 if (port > crisv32_ioports[port].pin_count)
110 return -EINVAL;
111
112 iopin->bit = 1 << pin;
113 iopin->port = &crisv32_ioports[port];
114
115 if (crisv32_pinmux_alloc(port, pin, pin, pinmux_gpio))
116 return -EIO;
117
118 return 0;
119}
120
121int crisv32_io_get_name(struct crisv32_iopin* iopin,
122 char* name)
123{
124 int port;
125 int pin;
126
127 if (toupper(*name) == 'P')
128 name++;
129
130 if (toupper(*name) < 'A' || toupper(*name) > 'E')
131 return -EINVAL;
132
133 port = toupper(*name) - 'A';
134 name++;
135 pin = simple_strtoul(name, NULL, 10);
136
137 if (pin < 0 || pin > crisv32_ioports[port].pin_count)
138 return -EINVAL;
139
140 iopin->bit = 1 << pin;
141 iopin->port = &crisv32_ioports[port];
142
143 if (crisv32_pinmux_alloc(port, pin, pin, pinmux_gpio))
144 return -EIO;
145
146 return 0;
147}
148
149#ifdef CONFIG_PCI
150/* PCI I/O access stuff */
151struct cris_io_operations* cris_iops = NULL;
152EXPORT_SYMBOL(cris_iops);
153#endif
154
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
new file mode 100644
index 000000000000..c78cc2685133
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -0,0 +1,413 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <asm/irq.h>
6#include <linux/irq.h>
7#include <linux/interrupt.h>
8#include <linux/smp.h>
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/errno.h>
12#include <linux/init.h>
13#include <linux/profile.h>
14#include <linux/proc_fs.h>
15#include <linux/seq_file.h>
16#include <linux/threads.h>
17#include <linux/spinlock.h>
18#include <linux/kernel_stat.h>
19#include <asm/arch/hwregs/reg_map.h>
20#include <asm/arch/hwregs/reg_rdwr.h>
21#include <asm/arch/hwregs/intr_vect.h>
22#include <asm/arch/hwregs/intr_vect_defs.h>
23
24#define CPU_FIXED -1
25
26/* IRQ masks (refer to comment for crisv32_do_multiple) */
27#define TIMER_MASK (1 << (TIMER_INTR_VECT - FIRST_IRQ))
28#ifdef CONFIG_ETRAX_KGDB
29#if defined(CONFIG_ETRAX_KGDB_PORT0)
30#define IGNOREMASK (1 << (SER0_INTR_VECT - FIRST_IRQ))
31#elif defined(CONFIG_ETRAX_KGDB_PORT1)
32#define IGNOREMASK (1 << (SER1_INTR_VECT - FIRST_IRQ))
33#elif defined(CONFIG_ETRAX_KGB_PORT2)
34#define IGNOREMASK (1 << (SER2_INTR_VECT - FIRST_IRQ))
35#elif defined(CONFIG_ETRAX_KGDB_PORT3)
36#define IGNOREMASK (1 << (SER3_INTR_VECT - FIRST_IRQ))
37#endif
38#endif
39
40DEFINE_SPINLOCK(irq_lock);
41
42struct cris_irq_allocation
43{
44 int cpu; /* The CPU to which the IRQ is currently allocated. */
45 cpumask_t mask; /* The CPUs to which the IRQ may be allocated. */
46};
47
48struct cris_irq_allocation irq_allocations[NR_IRQS] =
49 {[0 ... NR_IRQS - 1] = {0, CPU_MASK_ALL}};
50
51static unsigned long irq_regs[NR_CPUS] =
52{
53 regi_irq,
54#ifdef CONFIG_SMP
55 regi_irq2,
56#endif
57};
58
59unsigned long cpu_irq_counters[NR_CPUS];
60unsigned long irq_counters[NR_REAL_IRQS];
61
62/* From irq.c. */
63extern void weird_irq(void);
64
65/* From entry.S. */
66extern void system_call(void);
67extern void nmi_interrupt(void);
68extern void multiple_interrupt(void);
69extern void gdb_handle_exception(void);
70extern void i_mmu_refill(void);
71extern void i_mmu_invalid(void);
72extern void i_mmu_access(void);
73extern void i_mmu_execute(void);
74extern void d_mmu_refill(void);
75extern void d_mmu_invalid(void);
76extern void d_mmu_access(void);
77extern void d_mmu_write(void);
78
79/* From kgdb.c. */
80extern void kgdb_init(void);
81extern void breakpoint(void);
82
83/*
84 * Build the IRQ handler stubs using macros from irq.h. First argument is the
85 * IRQ number, the second argument is the corresponding bit in
86 * intr_rw_vect_mask found in asm/arch/hwregs/intr_vect_defs.h.
87 */
88BUILD_IRQ(0x31, (1 << 0)) /* memarb */
89BUILD_IRQ(0x32, (1 << 1)) /* gen_io */
90BUILD_IRQ(0x33, (1 << 2)) /* iop0 */
91BUILD_IRQ(0x34, (1 << 3)) /* iop1 */
92BUILD_IRQ(0x35, (1 << 4)) /* iop2 */
93BUILD_IRQ(0x36, (1 << 5)) /* iop3 */
94BUILD_IRQ(0x37, (1 << 6)) /* dma0 */
95BUILD_IRQ(0x38, (1 << 7)) /* dma1 */
96BUILD_IRQ(0x39, (1 << 8)) /* dma2 */
97BUILD_IRQ(0x3a, (1 << 9)) /* dma3 */
98BUILD_IRQ(0x3b, (1 << 10)) /* dma4 */
99BUILD_IRQ(0x3c, (1 << 11)) /* dma5 */
100BUILD_IRQ(0x3d, (1 << 12)) /* dma6 */
101BUILD_IRQ(0x3e, (1 << 13)) /* dma7 */
102BUILD_IRQ(0x3f, (1 << 14)) /* dma8 */
103BUILD_IRQ(0x40, (1 << 15)) /* dma9 */
104BUILD_IRQ(0x41, (1 << 16)) /* ata */
105BUILD_IRQ(0x42, (1 << 17)) /* sser0 */
106BUILD_IRQ(0x43, (1 << 18)) /* sser1 */
107BUILD_IRQ(0x44, (1 << 19)) /* ser0 */
108BUILD_IRQ(0x45, (1 << 20)) /* ser1 */
109BUILD_IRQ(0x46, (1 << 21)) /* ser2 */
110BUILD_IRQ(0x47, (1 << 22)) /* ser3 */
111BUILD_IRQ(0x48, (1 << 23))
112BUILD_IRQ(0x49, (1 << 24)) /* eth0 */
113BUILD_IRQ(0x4a, (1 << 25)) /* eth1 */
114BUILD_TIMER_IRQ(0x4b, (1 << 26))/* timer */
115BUILD_IRQ(0x4c, (1 << 27)) /* bif_arb */
116BUILD_IRQ(0x4d, (1 << 28)) /* bif_dma */
117BUILD_IRQ(0x4e, (1 << 29)) /* ext */
118BUILD_IRQ(0x4f, (1 << 29)) /* ipi */
119
120/* Pointers to the low-level handlers. */
121static void (*interrupt[NR_IRQS])(void) = {
122 IRQ0x31_interrupt, IRQ0x32_interrupt, IRQ0x33_interrupt,
123 IRQ0x34_interrupt, IRQ0x35_interrupt, IRQ0x36_interrupt,
124 IRQ0x37_interrupt, IRQ0x38_interrupt, IRQ0x39_interrupt,
125 IRQ0x3a_interrupt, IRQ0x3b_interrupt, IRQ0x3c_interrupt,
126 IRQ0x3d_interrupt, IRQ0x3e_interrupt, IRQ0x3f_interrupt,
127 IRQ0x40_interrupt, IRQ0x41_interrupt, IRQ0x42_interrupt,
128 IRQ0x43_interrupt, IRQ0x44_interrupt, IRQ0x45_interrupt,
129 IRQ0x46_interrupt, IRQ0x47_interrupt, IRQ0x48_interrupt,
130 IRQ0x49_interrupt, IRQ0x4a_interrupt, IRQ0x4b_interrupt,
131 IRQ0x4c_interrupt, IRQ0x4d_interrupt, IRQ0x4e_interrupt,
132 IRQ0x4f_interrupt
133};
134
135void
136block_irq(int irq, int cpu)
137{
138 int intr_mask;
139 unsigned long flags;
140
141 spin_lock_irqsave(&irq_lock, flags);
142 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
143
144 /* Remember; 1 let thru, 0 block. */
145 intr_mask &= ~(1 << (irq - FIRST_IRQ));
146
147 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
148 spin_unlock_irqrestore(&irq_lock, flags);
149}
150
151void
152unblock_irq(int irq, int cpu)
153{
154 int intr_mask;
155 unsigned long flags;
156
157 spin_lock_irqsave(&irq_lock, flags);
158 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
159
160 /* Remember; 1 let thru, 0 block. */
161 intr_mask |= (1 << (irq - FIRST_IRQ));
162
163 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
164 spin_unlock_irqrestore(&irq_lock, flags);
165}
166
167/* Find out which CPU the irq should be allocated to. */
168static int irq_cpu(int irq)
169{
170 int cpu;
171 unsigned long flags;
172
173 spin_lock_irqsave(&irq_lock, flags);
174 cpu = irq_allocations[irq - FIRST_IRQ].cpu;
175
176 /* Fixed interrupts stay on the local CPU. */
177 if (cpu == CPU_FIXED)
178 {
179 spin_unlock_irqrestore(&irq_lock, flags);
180 return smp_processor_id();
181 }
182
183
184 /* Let the interrupt stay if possible */
185 if (cpu_isset(cpu, irq_allocations[irq - FIRST_IRQ].mask))
186 goto out;
187
188 /* IRQ must be moved to another CPU. */
189 cpu = first_cpu(irq_allocations[irq - FIRST_IRQ].mask);
190 irq_allocations[irq - FIRST_IRQ].cpu = cpu;
191out:
192 spin_unlock_irqrestore(&irq_lock, flags);
193 return cpu;
194}
195
196void
197mask_irq(int irq)
198{
199 int cpu;
200
201 for (cpu = 0; cpu < NR_CPUS; cpu++)
202 block_irq(irq, cpu);
203}
204
205void
206unmask_irq(int irq)
207{
208 unblock_irq(irq, irq_cpu(irq));
209}
210
211
212static unsigned int startup_crisv32_irq(unsigned int irq)
213{
214 unmask_irq(irq);
215 return 0;
216}
217
218static void shutdown_crisv32_irq(unsigned int irq)
219{
220 mask_irq(irq);
221}
222
223static void enable_crisv32_irq(unsigned int irq)
224{
225 unmask_irq(irq);
226}
227
228static void disable_crisv32_irq(unsigned int irq)
229{
230 mask_irq(irq);
231}
232
233static void ack_crisv32_irq(unsigned int irq)
234{
235}
236
237static void end_crisv32_irq(unsigned int irq)
238{
239}
240
241void set_affinity_crisv32_irq(unsigned int irq, cpumask_t dest)
242{
243 unsigned long flags;
244 spin_lock_irqsave(&irq_lock, flags);
245 irq_allocations[irq - FIRST_IRQ].mask = dest;
246 spin_unlock_irqrestore(&irq_lock, flags);
247}
248
249static struct hw_interrupt_type crisv32_irq_type = {
250 .typename = "CRISv32",
251 .startup = startup_crisv32_irq,
252 .shutdown = shutdown_crisv32_irq,
253 .enable = enable_crisv32_irq,
254 .disable = disable_crisv32_irq,
255 .ack = ack_crisv32_irq,
256 .end = end_crisv32_irq,
257 .set_affinity = set_affinity_crisv32_irq
258};
259
260void
261set_exception_vector(int n, irqvectptr addr)
262{
263 etrax_irv->v[n] = (irqvectptr) addr;
264}
265
266extern void do_IRQ(int irq, struct pt_regs * regs);
267
268void
269crisv32_do_IRQ(int irq, int block, struct pt_regs* regs)
270{
271 /* Interrupts that may not be moved to another CPU and
272 * are SA_INTERRUPT may skip blocking. This is currently
273 * only valid for the timer IRQ and the IPI and is used
274 * for the timer interrupt to avoid watchdog starvation.
275 */
276 if (!block) {
277 do_IRQ(irq, regs);
278 return;
279 }
280
281 block_irq(irq, smp_processor_id());
282 do_IRQ(irq, regs);
283
284 unblock_irq(irq, irq_cpu(irq));
285}
286
287/* If multiple interrupts occur simultaneously we get a multiple
288 * interrupt from the CPU and software has to sort out which
289 * interrupts that happened. There are two special cases here:
290 *
291 * 1. Timer interrupts may never be blocked because of the
292 * watchdog (refer to comment in include/asr/arch/irq.h)
293 * 2. GDB serial port IRQs are unhandled here and will be handled
294 * as a single IRQ when it strikes again because the GDB
295 * stubb wants to save the registers in its own fashion.
296 */
297void
298crisv32_do_multiple(struct pt_regs* regs)
299{
300 int cpu;
301 int mask;
302 int masked;
303 int bit;
304
305 cpu = smp_processor_id();
306
307 /* An extra irq_enter here to prevent softIRQs to run after
308 * each do_IRQ. This will decrease the interrupt latency.
309 */
310 irq_enter();
311
312 /* Get which IRQs that happend. */
313 masked = REG_RD_INT(intr_vect, irq_regs[cpu], r_masked_vect);
314
315 /* Calculate new IRQ mask with these IRQs disabled. */
316 mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
317 mask &= ~masked;
318
319 /* Timer IRQ is never masked */
320 if (masked & TIMER_MASK)
321 mask |= TIMER_MASK;
322
323 /* Block all the IRQs */
324 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, mask);
325
326 /* Check for timer IRQ and handle it special. */
327 if (masked & TIMER_MASK) {
328 masked &= ~TIMER_MASK;
329 do_IRQ(TIMER_INTR_VECT, regs);
330 }
331
332#ifdef IGNORE_MASK
333 /* Remove IRQs that can't be handled as multiple. */
334 masked &= ~IGNORE_MASK;
335#endif
336
337 /* Handle the rest of the IRQs. */
338 for (bit = 0; bit < 32; bit++)
339 {
340 if (masked & (1 << bit))
341 do_IRQ(bit + FIRST_IRQ, regs);
342 }
343
344 /* Unblock all the IRQs. */
345 mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
346 mask |= masked;
347 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, mask);
348
349 /* This irq_exit() will trigger the soft IRQs. */
350 irq_exit();
351}
352
353/*
354 * This is called by start_kernel. It fixes the IRQ masks and setup the
355 * interrupt vector table to point to bad_interrupt pointers.
356 */
357void __init
358init_IRQ(void)
359{
360 int i;
361 int j;
362 reg_intr_vect_rw_mask vect_mask = {0};
363
364 /* Clear all interrupts masks. */
365 REG_WR(intr_vect, regi_irq, rw_mask, vect_mask);
366
367 for (i = 0; i < 256; i++)
368 etrax_irv->v[i] = weird_irq;
369
370 /* Point all IRQ's to bad handlers. */
371 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
372 irq_desc[j].handler = &crisv32_irq_type;
373 set_exception_vector(i, interrupt[j]);
374 }
375
376 /* Mark Timer and IPI IRQs as CPU local */
377 irq_allocations[TIMER_INTR_VECT - FIRST_IRQ].cpu = CPU_FIXED;
378 irq_desc[TIMER_INTR_VECT].status |= IRQ_PER_CPU;
379 irq_allocations[IPI_INTR_VECT - FIRST_IRQ].cpu = CPU_FIXED;
380 irq_desc[IPI_INTR_VECT].status |= IRQ_PER_CPU;
381
382 set_exception_vector(0x00, nmi_interrupt);
383 set_exception_vector(0x30, multiple_interrupt);
384
385 /* Set up handler for various MMU bus faults. */
386 set_exception_vector(0x04, i_mmu_refill);
387 set_exception_vector(0x05, i_mmu_invalid);
388 set_exception_vector(0x06, i_mmu_access);
389 set_exception_vector(0x07, i_mmu_execute);
390 set_exception_vector(0x08, d_mmu_refill);
391 set_exception_vector(0x09, d_mmu_invalid);
392 set_exception_vector(0x0a, d_mmu_access);
393 set_exception_vector(0x0b, d_mmu_write);
394
395 /* The system-call trap is reached by "break 13". */
396 set_exception_vector(0x1d, system_call);
397
398 /* Exception handlers for debugging, both user-mode and kernel-mode. */
399
400 /* Break 8. */
401 set_exception_vector(0x18, gdb_handle_exception);
402 /* Hardware single step. */
403 set_exception_vector(0x3, gdb_handle_exception);
404 /* Hardware breakpoint. */
405 set_exception_vector(0xc, gdb_handle_exception);
406
407#ifdef CONFIG_ETRAX_KGDB
408 kgdb_init();
409 /* Everything is set up; now trap the kernel. */
410 breakpoint();
411#endif
412}
413
diff --git a/arch/cris/arch-v32/kernel/kgdb.c b/arch/cris/arch-v32/kernel/kgdb.c
new file mode 100644
index 000000000000..480e56348be2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/kgdb.c
@@ -0,0 +1,1660 @@
1/*
2 * arch/cris/arch-v32/kernel/kgdb.c
3 *
4 * CRIS v32 version by Orjan Friberg, Axis Communications AB.
5 *
6 * S390 version
7 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
8 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
9 *
10 * Originally written by Glenn Engel, Lake Stevens Instrument Division
11 *
12 * Contributed by HP Systems
13 *
14 * Modified for SPARC by Stu Grossman, Cygnus Support.
15 *
16 * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
17 * Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
18 *
19 * Copyright (C) 1995 Andreas Busse
20 */
21
22/* FIXME: Check the documentation. */
23
24/*
25 * kgdb usage notes:
26 * -----------------
27 *
28 * If you select CONFIG_ETRAX_KGDB in the configuration, the kernel will be
29 * built with different gcc flags: "-g" is added to get debug infos, and
30 * "-fomit-frame-pointer" is omitted to make debugging easier. Since the
31 * resulting kernel will be quite big (approx. > 7 MB), it will be stripped
32 * before compresion. Such a kernel will behave just as usually, except if
33 * given a "debug=<device>" command line option. (Only serial devices are
34 * allowed for <device>, i.e. no printers or the like; possible values are
35 * machine depedend and are the same as for the usual debug device, the one
36 * for logging kernel messages.) If that option is given and the device can be
37 * initialized, the kernel will connect to the remote gdb in trap_init(). The
38 * serial parameters are fixed to 8N1 and 115200 bps, for easyness of
39 * implementation.
40 *
41 * To start a debugging session, start that gdb with the debugging kernel
42 * image (the one with the symbols, vmlinux.debug) named on the command line.
43 * This file will be used by gdb to get symbol and debugging infos about the
44 * kernel. Next, select remote debug mode by
45 * target remote <device>
46 * where <device> is the name of the serial device over which the debugged
47 * machine is connected. Maybe you have to adjust the baud rate by
48 * set remotebaud <rate>
49 * or also other parameters with stty:
50 * shell stty ... </dev/...
51 * If the kernel to debug has already booted, it waited for gdb and now
52 * connects, and you'll see a breakpoint being reported. If the kernel isn't
53 * running yet, start it now. The order of gdb and the kernel doesn't matter.
54 * Another thing worth knowing about in the getting-started phase is how to
55 * debug the remote protocol itself. This is activated with
56 * set remotedebug 1
57 * gdb will then print out each packet sent or received. You'll also get some
58 * messages about the gdb stub on the console of the debugged machine.
59 *
60 * If all that works, you can use lots of the usual debugging techniques on
61 * the kernel, e.g. inspecting and changing variables/memory, setting
62 * breakpoints, single stepping and so on. It's also possible to interrupt the
63 * debugged kernel by pressing C-c in gdb. Have fun! :-)
64 *
65 * The gdb stub is entered (and thus the remote gdb gets control) in the
66 * following situations:
67 *
68 * - If breakpoint() is called. This is just after kgdb initialization, or if
69 * a breakpoint() call has been put somewhere into the kernel source.
70 * (Breakpoints can of course also be set the usual way in gdb.)
71 * In eLinux, we call breakpoint() in init/main.c after IRQ initialization.
72 *
73 * - If there is a kernel exception, i.e. bad_super_trap() or die_if_kernel()
74 * are entered. All the CPU exceptions are mapped to (more or less..., see
75 * the hard_trap_info array below) appropriate signal, which are reported
76 * to gdb. die_if_kernel() is usually called after some kind of access
77 * error and thus is reported as SIGSEGV.
78 *
79 * - When panic() is called. This is reported as SIGABRT.
80 *
81 * - If C-c is received over the serial line, which is treated as
82 * SIGINT.
83 *
84 * Of course, all these signals are just faked for gdb, since there is no
85 * signal concept as such for the kernel. It also isn't possible --obviously--
86 * to set signal handlers from inside gdb, or restart the kernel with a
87 * signal.
88 *
89 * Current limitations:
90 *
91 * - While the kernel is stopped, interrupts are disabled for safety reasons
92 * (i.e., variables not changing magically or the like). But this also
93 * means that the clock isn't running anymore, and that interrupts from the
94 * hardware may get lost/not be served in time. This can cause some device
95 * errors...
96 *
97 * - When single-stepping, only one instruction of the current thread is
98 * executed, but interrupts are allowed for that time and will be serviced
99 * if pending. Be prepared for that.
100 *
101 * - All debugging happens in kernel virtual address space. There's no way to
102 * access physical memory not mapped in kernel space, or to access user
103 * space. A way to work around this is using get_user_long & Co. in gdb
104 * expressions, but only for the current process.
105 *
106 * - Interrupting the kernel only works if interrupts are currently allowed,
107 * and the interrupt of the serial line isn't blocked by some other means
108 * (IPL too high, disabled, ...)
109 *
110 * - The gdb stub is currently not reentrant, i.e. errors that happen therein
111 * (e.g. accessing invalid memory) may not be caught correctly. This could
112 * be removed in future by introducing a stack of struct registers.
113 *
114 */
115
116/*
117 * To enable debugger support, two things need to happen. One, a
118 * call to kgdb_init() is necessary in order to allow any breakpoints
119 * or error conditions to be properly intercepted and reported to gdb.
120 * Two, a breakpoint needs to be generated to begin communication. This
121 * is most easily accomplished by a call to breakpoint().
122 *
123 * The following gdb commands are supported:
124 *
125 * command function Return value
126 *
127 * g return the value of the CPU registers hex data or ENN
128 * G set the value of the CPU registers OK or ENN
129 *
130 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
131 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
132 *
133 * c Resume at current address SNN ( signal NN)
134 * cAA..AA Continue at address AA..AA SNN
135 *
136 * s Step one instruction SNN
137 * sAA..AA Step one instruction from AA..AA SNN
138 *
139 * k kill
140 *
141 * ? What was the last sigval ? SNN (signal NN)
142 *
143 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
144 * baud rate
145 *
146 * All commands and responses are sent with a packet which includes a
147 * checksum. A packet consists of
148 *
149 * $<packet info>#<checksum>.
150 *
151 * where
152 * <packet info> :: <characters representing the command or response>
153 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
154 *
155 * When a packet is received, it is first acknowledged with either '+' or '-'.
156 * '+' indicates a successful transfer. '-' indicates a failed transfer.
157 *
158 * Example:
159 *
160 * Host: Reply:
161 * $m0,10#2a +$00010203040506070809101112131415#42
162 *
163 */
164
165
166#include <linux/string.h>
167#include <linux/signal.h>
168#include <linux/kernel.h>
169#include <linux/delay.h>
170#include <linux/linkage.h>
171#include <linux/reboot.h>
172
173#include <asm/setup.h>
174#include <asm/ptrace.h>
175
176#include <asm/irq.h>
177#include <asm/arch/hwregs/reg_map.h>
178#include <asm/arch/hwregs/reg_rdwr.h>
179#include <asm/arch/hwregs/intr_vect_defs.h>
180#include <asm/arch/hwregs/ser_defs.h>
181
182/* From entry.S. */
183extern void gdb_handle_exception(void);
184/* From kgdb_asm.S. */
185extern void kgdb_handle_exception(void);
186
187static int kgdb_started = 0;
188
189/********************************* Register image ****************************/
190
191typedef
192struct register_image
193{
194 /* Offset */
195 unsigned int r0; /* 0x00 */
196 unsigned int r1; /* 0x04 */
197 unsigned int r2; /* 0x08 */
198 unsigned int r3; /* 0x0C */
199 unsigned int r4; /* 0x10 */
200 unsigned int r5; /* 0x14 */
201 unsigned int r6; /* 0x18 */
202 unsigned int r7; /* 0x1C */
203 unsigned int r8; /* 0x20; Frame pointer (if any) */
204 unsigned int r9; /* 0x24 */
205 unsigned int r10; /* 0x28 */
206 unsigned int r11; /* 0x2C */
207 unsigned int r12; /* 0x30 */
208 unsigned int r13; /* 0x34 */
209 unsigned int sp; /* 0x38; R14, Stack pointer */
210 unsigned int acr; /* 0x3C; R15, Address calculation register. */
211
212 unsigned char bz; /* 0x40; P0, 8-bit zero register */
213 unsigned char vr; /* 0x41; P1, Version register (8-bit) */
214 unsigned int pid; /* 0x42; P2, Process ID */
215 unsigned char srs; /* 0x46; P3, Support register select (8-bit) */
216 unsigned short wz; /* 0x47; P4, 16-bit zero register */
217 unsigned int exs; /* 0x49; P5, Exception status */
218 unsigned int eda; /* 0x4D; P6, Exception data address */
219 unsigned int mof; /* 0x51; P7, Multiply overflow register */
220 unsigned int dz; /* 0x55; P8, 32-bit zero register */
221 unsigned int ebp; /* 0x59; P9, Exception base pointer */
222 unsigned int erp; /* 0x5D; P10, Exception return pointer. Contains the PC we are interested in. */
223 unsigned int srp; /* 0x61; P11, Subroutine return pointer */
224 unsigned int nrp; /* 0x65; P12, NMI return pointer */
225 unsigned int ccs; /* 0x69; P13, Condition code stack */
226 unsigned int usp; /* 0x6D; P14, User mode stack pointer */
227 unsigned int spc; /* 0x71; P15, Single step PC */
228 unsigned int pc; /* 0x75; Pseudo register (for the most part set to ERP). */
229
230} registers;
231
232typedef
233struct bp_register_image
234{
235 /* Support register bank 0. */
236 unsigned int s0_0;
237 unsigned int s1_0;
238 unsigned int s2_0;
239 unsigned int s3_0;
240 unsigned int s4_0;
241 unsigned int s5_0;
242 unsigned int s6_0;
243 unsigned int s7_0;
244 unsigned int s8_0;
245 unsigned int s9_0;
246 unsigned int s10_0;
247 unsigned int s11_0;
248 unsigned int s12_0;
249 unsigned int s13_0;
250 unsigned int s14_0;
251 unsigned int s15_0;
252
253 /* Support register bank 1. */
254 unsigned int s0_1;
255 unsigned int s1_1;
256 unsigned int s2_1;
257 unsigned int s3_1;
258 unsigned int s4_1;
259 unsigned int s5_1;
260 unsigned int s6_1;
261 unsigned int s7_1;
262 unsigned int s8_1;
263 unsigned int s9_1;
264 unsigned int s10_1;
265 unsigned int s11_1;
266 unsigned int s12_1;
267 unsigned int s13_1;
268 unsigned int s14_1;
269 unsigned int s15_1;
270
271 /* Support register bank 2. */
272 unsigned int s0_2;
273 unsigned int s1_2;
274 unsigned int s2_2;
275 unsigned int s3_2;
276 unsigned int s4_2;
277 unsigned int s5_2;
278 unsigned int s6_2;
279 unsigned int s7_2;
280 unsigned int s8_2;
281 unsigned int s9_2;
282 unsigned int s10_2;
283 unsigned int s11_2;
284 unsigned int s12_2;
285 unsigned int s13_2;
286 unsigned int s14_2;
287 unsigned int s15_2;
288
289 /* Support register bank 3. */
290 unsigned int s0_3; /* BP_CTRL */
291 unsigned int s1_3; /* BP_I0_START */
292 unsigned int s2_3; /* BP_I0_END */
293 unsigned int s3_3; /* BP_D0_START */
294 unsigned int s4_3; /* BP_D0_END */
295 unsigned int s5_3; /* BP_D1_START */
296 unsigned int s6_3; /* BP_D1_END */
297 unsigned int s7_3; /* BP_D2_START */
298 unsigned int s8_3; /* BP_D2_END */
299 unsigned int s9_3; /* BP_D3_START */
300 unsigned int s10_3; /* BP_D3_END */
301 unsigned int s11_3; /* BP_D4_START */
302 unsigned int s12_3; /* BP_D4_END */
303 unsigned int s13_3; /* BP_D5_START */
304 unsigned int s14_3; /* BP_D5_END */
305 unsigned int s15_3; /* BP_RESERVED */
306
307} support_registers;
308
309enum register_name
310{
311 R0, R1, R2, R3,
312 R4, R5, R6, R7,
313 R8, R9, R10, R11,
314 R12, R13, SP, ACR,
315
316 BZ, VR, PID, SRS,
317 WZ, EXS, EDA, MOF,
318 DZ, EBP, ERP, SRP,
319 NRP, CCS, USP, SPC,
320 PC,
321
322 S0, S1, S2, S3,
323 S4, S5, S6, S7,
324 S8, S9, S10, S11,
325 S12, S13, S14, S15
326
327};
328
329/* The register sizes of the registers in register_name. An unimplemented register
330 is designated by size 0 in this array. */
331static int register_size[] =
332{
333 4, 4, 4, 4,
334 4, 4, 4, 4,
335 4, 4, 4, 4,
336 4, 4, 4, 4,
337
338 1, 1, 4, 1,
339 2, 4, 4, 4,
340 4, 4, 4, 4,
341 4, 4, 4, 4,
342
343 4,
344
345 4, 4, 4, 4,
346 4, 4, 4, 4,
347 4, 4, 4, 4,
348 4, 4, 4
349
350};
351
352/* Contains the register image of the kernel.
353 (Global so that they can be reached from assembler code.) */
354registers reg;
355support_registers sreg;
356
357/************** Prototypes for local library functions ***********************/
358
359/* Copy of strcpy from libc. */
360static char *gdb_cris_strcpy(char *s1, const char *s2);
361
362/* Copy of strlen from libc. */
363static int gdb_cris_strlen(const char *s);
364
365/* Copy of memchr from libc. */
366static void *gdb_cris_memchr(const void *s, int c, int n);
367
368/* Copy of strtol from libc. Does only support base 16. */
369static int gdb_cris_strtol(const char *s, char **endptr, int base);
370
371/********************** Prototypes for local functions. **********************/
372
373/* Write a value to a specified register regno in the register image
374 of the current thread. */
375static int write_register(int regno, char *val);
376
377/* Read a value from a specified register in the register image. Returns the
378 status of the read operation. The register value is returned in valptr. */
379static int read_register(char regno, unsigned int *valptr);
380
381/* Serial port, reads one character. ETRAX 100 specific. from debugport.c */
382int getDebugChar(void);
383
384#ifdef CONFIG_ETRAXFS_SIM
385int getDebugChar(void)
386{
387 return socketread();
388}
389#endif
390
391/* Serial port, writes one character. ETRAX 100 specific. from debugport.c */
392void putDebugChar(int val);
393
394#ifdef CONFIG_ETRAXFS_SIM
395void putDebugChar(int val)
396{
397 socketwrite((char *)&val, 1);
398}
399#endif
400
401/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
402 represented by int x. */
403static char highhex(int x);
404
405/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
406 represented by int x. */
407static char lowhex(int x);
408
409/* Returns the integer equivalent of a hexadecimal character. */
410static int hex(char ch);
411
412/* Convert the memory, pointed to by mem into hexadecimal representation.
413 Put the result in buf, and return a pointer to the last character
414 in buf (null). */
415static char *mem2hex(char *buf, unsigned char *mem, int count);
416
417/* Convert the array, in hexadecimal representation, pointed to by buf into
418 binary representation. Put the result in mem, and return a pointer to
419 the character after the last byte written. */
420static unsigned char *hex2mem(unsigned char *mem, char *buf, int count);
421
422/* Put the content of the array, in binary representation, pointed to by buf
423 into memory pointed to by mem, and return a pointer to
424 the character after the last byte written. */
425static unsigned char *bin2mem(unsigned char *mem, unsigned char *buf, int count);
426
427/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
428 returned. */
429static void getpacket(char *buffer);
430
431/* Send $<data>#<checksum> from the <data> in the array buffer. */
432static void putpacket(char *buffer);
433
434/* Build and send a response packet in order to inform the host the
435 stub is stopped. */
436static void stub_is_stopped(int sigval);
437
438/* All expected commands are sent from remote.c. Send a response according
439 to the description in remote.c. Not static since it needs to be reached
440 from assembler code. */
441void handle_exception(int sigval);
442
443/* Performs a complete re-start from scratch. ETRAX specific. */
444static void kill_restart(void);
445
446/******************** Prototypes for global functions. ***********************/
447
448/* The string str is prepended with the GDB printout token and sent. */
449void putDebugString(const unsigned char *str, int len);
450
451/* A static breakpoint to be used at startup. */
452void breakpoint(void);
453
454/* Avoid warning as the internal_stack is not used in the C-code. */
455#define USEDVAR(name) { if (name) { ; } }
456#define USEDFUN(name) { void (*pf)(void) = (void *)name; USEDVAR(pf) }
457
458/********************************** Packet I/O ******************************/
459/* BUFMAX defines the maximum number of characters in
460 inbound/outbound buffers */
461/* FIXME: How do we know it's enough? */
462#define BUFMAX 512
463
464/* Run-length encoding maximum length. Send 64 at most. */
465#define RUNLENMAX 64
466
467/* Definition of all valid hexadecimal characters */
468static const char hexchars[] = "0123456789abcdef";
469
470/* The inbound/outbound buffers used in packet I/O */
471static char input_buffer[BUFMAX];
472static char output_buffer[BUFMAX];
473
474/* Error and warning messages. */
475enum error_type
476{
477 SUCCESS, E01, E02, E03, E04, E05, E06,
478};
479
480static char *error_message[] =
481{
482 "",
483 "E01 Set current or general thread - H[c,g] - internal error.",
484 "E02 Change register content - P - cannot change read-only register.",
485 "E03 Thread is not alive.", /* T, not used. */
486 "E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
487 "E05 Change register content - P - the register is not implemented..",
488 "E06 Change memory content - M - internal error.",
489};
490
491/********************************** Breakpoint *******************************/
492/* Use an internal stack in the breakpoint and interrupt response routines.
493 FIXME: How do we know the size of this stack is enough?
494 Global so it can be reached from assembler code. */
495#define INTERNAL_STACK_SIZE 1024
496char internal_stack[INTERNAL_STACK_SIZE];
497
498/* Due to the breakpoint return pointer, a state variable is needed to keep
499 track of whether it is a static (compiled) or dynamic (gdb-invoked)
500 breakpoint to be handled. A static breakpoint uses the content of register
501 ERP as it is whereas a dynamic breakpoint requires subtraction with 2
502 in order to execute the instruction. The first breakpoint is static; all
503 following are assumed to be dynamic. */
504static int dynamic_bp = 0;
505
506/********************************* String library ****************************/
507/* Single-step over library functions creates trap loops. */
508
509/* Copy char s2[] to s1[]. */
510static char*
511gdb_cris_strcpy(char *s1, const char *s2)
512{
513 char *s = s1;
514
515 for (s = s1; (*s++ = *s2++) != '\0'; )
516 ;
517 return s1;
518}
519
520/* Find length of s[]. */
521static int
522gdb_cris_strlen(const char *s)
523{
524 const char *sc;
525
526 for (sc = s; *sc != '\0'; sc++)
527 ;
528 return (sc - s);
529}
530
531/* Find first occurrence of c in s[n]. */
532static void*
533gdb_cris_memchr(const void *s, int c, int n)
534{
535 const unsigned char uc = c;
536 const unsigned char *su;
537
538 for (su = s; 0 < n; ++su, --n)
539 if (*su == uc)
540 return (void *)su;
541 return NULL;
542}
543/******************************* Standard library ****************************/
544/* Single-step over library functions creates trap loops. */
545/* Convert string to long. */
546static int
547gdb_cris_strtol(const char *s, char **endptr, int base)
548{
549 char *s1;
550 char *sd;
551 int x = 0;
552
553 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1)
554 x = x * base + (sd - hexchars);
555
556 if (endptr) {
557 /* Unconverted suffix is stored in endptr unless endptr is NULL. */
558 *endptr = s1;
559 }
560
561 return x;
562}
563
564/********************************* Register image ****************************/
565
566/* Write a value to a specified register in the register image of the current
567 thread. Returns status code SUCCESS, E02 or E05. */
568static int
569write_register(int regno, char *val)
570{
571 int status = SUCCESS;
572
573 if (regno >= R0 && regno <= ACR) {
574 /* Consecutive 32-bit registers. */
575 hex2mem((unsigned char *)&reg.r0 + (regno - R0) * sizeof(unsigned int),
576 val, sizeof(unsigned int));
577
578 } else if (regno == BZ || regno == VR || regno == WZ || regno == DZ) {
579 /* Read-only registers. */
580 status = E02;
581
582 } else if (regno == PID) {
583 /* 32-bit register. (Even though we already checked SRS and WZ, we cannot
584 combine this with the EXS - SPC write since SRS and WZ have different size.) */
585 hex2mem((unsigned char *)&reg.pid, val, sizeof(unsigned int));
586
587 } else if (regno == SRS) {
588 /* 8-bit register. */
589 hex2mem((unsigned char *)&reg.srs, val, sizeof(unsigned char));
590
591 } else if (regno >= EXS && regno <= SPC) {
592 /* Consecutive 32-bit registers. */
593 hex2mem((unsigned char *)&reg.exs + (regno - EXS) * sizeof(unsigned int),
594 val, sizeof(unsigned int));
595
596 } else if (regno == PC) {
597 /* Pseudo-register. Treat as read-only. */
598 status = E02;
599
600 } else if (regno >= S0 && regno <= S15) {
601 /* 32-bit registers. */
602 hex2mem((unsigned char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int), val, sizeof(unsigned int));
603 } else {
604 /* Non-existing register. */
605 status = E05;
606 }
607 return status;
608}
609
610/* Read a value from a specified register in the register image. Returns the
611 value in the register or -1 for non-implemented registers. */
612static int
613read_register(char regno, unsigned int *valptr)
614{
615 int status = SUCCESS;
616
617 /* We read the zero registers from the register struct (instead of just returning 0)
618 to catch errors. */
619
620 if (regno >= R0 && regno <= ACR) {
621 /* Consecutive 32-bit registers. */
622 *valptr = *(unsigned int *)((char *)&reg.r0 + (regno - R0) * sizeof(unsigned int));
623
624 } else if (regno == BZ || regno == VR) {
625 /* Consecutive 8-bit registers. */
626 *valptr = (unsigned int)(*(unsigned char *)
627 ((char *)&reg.bz + (regno - BZ) * sizeof(char)));
628
629 } else if (regno == PID) {
630 /* 32-bit register. */
631 *valptr = *(unsigned int *)((char *)&reg.pid);
632
633 } else if (regno == SRS) {
634 /* 8-bit register. */
635 *valptr = (unsigned int)(*(unsigned char *)((char *)&reg.srs));
636
637 } else if (regno == WZ) {
638 /* 16-bit register. */
639 *valptr = (unsigned int)(*(unsigned short *)(char *)&reg.wz);
640
641 } else if (regno >= EXS && regno <= PC) {
642 /* Consecutive 32-bit registers. */
643 *valptr = *(unsigned int *)((char *)&reg.exs + (regno - EXS) * sizeof(unsigned int));
644
645 } else if (regno >= S0 && regno <= S15) {
646 /* Consecutive 32-bit registers, located elsewhere. */
647 *valptr = *(unsigned int *)((char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int));
648
649 } else {
650 /* Non-existing register. */
651 status = E05;
652 }
653 return status;
654
655}
656
657/********************************** Packet I/O ******************************/
658/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
659 represented by int x. */
660static inline char
661highhex(int x)
662{
663 return hexchars[(x >> 4) & 0xf];
664}
665
666/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
667 represented by int x. */
668static inline char
669lowhex(int x)
670{
671 return hexchars[x & 0xf];
672}
673
674/* Returns the integer equivalent of a hexadecimal character. */
675static int
676hex(char ch)
677{
678 if ((ch >= 'a') && (ch <= 'f'))
679 return (ch - 'a' + 10);
680 if ((ch >= '0') && (ch <= '9'))
681 return (ch - '0');
682 if ((ch >= 'A') && (ch <= 'F'))
683 return (ch - 'A' + 10);
684 return -1;
685}
686
687/* Convert the memory, pointed to by mem into hexadecimal representation.
688 Put the result in buf, and return a pointer to the last character
689 in buf (null). */
690
691static char *
692mem2hex(char *buf, unsigned char *mem, int count)
693{
694 int i;
695 int ch;
696
697 if (mem == NULL) {
698 /* Invalid address, caught by 'm' packet handler. */
699 for (i = 0; i < count; i++) {
700 *buf++ = '0';
701 *buf++ = '0';
702 }
703 } else {
704 /* Valid mem address. */
705 for (i = 0; i < count; i++) {
706 ch = *mem++;
707 *buf++ = highhex (ch);
708 *buf++ = lowhex (ch);
709 }
710 }
711 /* Terminate properly. */
712 *buf = '\0';
713 return buf;
714}
715
716/* Same as mem2hex, but puts it in network byte order. */
717static char *
718mem2hex_nbo(char *buf, unsigned char *mem, int count)
719{
720 int i;
721 int ch;
722
723 mem += count - 1;
724 for (i = 0; i < count; i++) {
725 ch = *mem--;
726 *buf++ = highhex (ch);
727 *buf++ = lowhex (ch);
728 }
729
730 /* Terminate properly. */
731 *buf = '\0';
732 return buf;
733}
734
735/* Convert the array, in hexadecimal representation, pointed to by buf into
736 binary representation. Put the result in mem, and return a pointer to
737 the character after the last byte written. */
738static unsigned char*
739hex2mem(unsigned char *mem, char *buf, int count)
740{
741 int i;
742 unsigned char ch;
743 for (i = 0; i < count; i++) {
744 ch = hex (*buf++) << 4;
745 ch = ch + hex (*buf++);
746 *mem++ = ch;
747 }
748 return mem;
749}
750
751/* Put the content of the array, in binary representation, pointed to by buf
752 into memory pointed to by mem, and return a pointer to the character after
753 the last byte written.
754 Gdb will escape $, #, and the escape char (0x7d). */
755static unsigned char*
756bin2mem(unsigned char *mem, unsigned char *buf, int count)
757{
758 int i;
759 unsigned char *next;
760 for (i = 0; i < count; i++) {
761 /* Check for any escaped characters. Be paranoid and
762 only unescape chars that should be escaped. */
763 if (*buf == 0x7d) {
764 next = buf + 1;
765 if (*next == 0x3 || *next == 0x4 || *next == 0x5D) {
766 /* #, $, ESC */
767 buf++;
768 *buf += 0x20;
769 }
770 }
771 *mem++ = *buf++;
772 }
773 return mem;
774}
775
776/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
777 returned. */
778static void
779getpacket(char *buffer)
780{
781 unsigned char checksum;
782 unsigned char xmitcsum;
783 int i;
784 int count;
785 char ch;
786
787 do {
788 while((ch = getDebugChar ()) != '$')
789 /* Wait for the start character $ and ignore all other characters */;
790 checksum = 0;
791 xmitcsum = -1;
792 count = 0;
793 /* Read until a # or the end of the buffer is reached */
794 while (count < BUFMAX) {
795 ch = getDebugChar();
796 if (ch == '#')
797 break;
798 checksum = checksum + ch;
799 buffer[count] = ch;
800 count = count + 1;
801 }
802
803 if (count >= BUFMAX)
804 continue;
805
806 buffer[count] = 0;
807
808 if (ch == '#') {
809 xmitcsum = hex(getDebugChar()) << 4;
810 xmitcsum += hex(getDebugChar());
811 if (checksum != xmitcsum) {
812 /* Wrong checksum */
813 putDebugChar('-');
814 } else {
815 /* Correct checksum */
816 putDebugChar('+');
817 /* If sequence characters are received, reply with them */
818 if (buffer[2] == ':') {
819 putDebugChar(buffer[0]);
820 putDebugChar(buffer[1]);
821 /* Remove the sequence characters from the buffer */
822 count = gdb_cris_strlen(buffer);
823 for (i = 3; i <= count; i++)
824 buffer[i - 3] = buffer[i];
825 }
826 }
827 }
828 } while (checksum != xmitcsum);
829}
830
831/* Send $<data>#<checksum> from the <data> in the array buffer. */
832
833static void
834putpacket(char *buffer)
835{
836 int checksum;
837 int runlen;
838 int encode;
839
840 do {
841 char *src = buffer;
842 putDebugChar('$');
843 checksum = 0;
844 while (*src) {
845 /* Do run length encoding */
846 putDebugChar(*src);
847 checksum += *src;
848 runlen = 0;
849 while (runlen < RUNLENMAX && *src == src[runlen]) {
850 runlen++;
851 }
852 if (runlen > 3) {
853 /* Got a useful amount */
854 putDebugChar ('*');
855 checksum += '*';
856 encode = runlen + ' ' - 4;
857 putDebugChar(encode);
858 checksum += encode;
859 src += runlen;
860 } else {
861 src++;
862 }
863 }
864 putDebugChar('#');
865 putDebugChar(highhex (checksum));
866 putDebugChar(lowhex (checksum));
867 } while(kgdb_started && (getDebugChar() != '+'));
868}
869
870/* The string str is prepended with the GDB printout token and sent. Required
871 in traditional implementations. */
872void
873putDebugString(const unsigned char *str, int len)
874{
875 /* Move SPC forward if we are single-stepping. */
876 asm("spchere:");
877 asm("move $spc, $r10");
878 asm("cmp.d spchere, $r10");
879 asm("bne nosstep");
880 asm("nop");
881 asm("move.d spccont, $r10");
882 asm("move $r10, $spc");
883 asm("nosstep:");
884
885 output_buffer[0] = 'O';
886 mem2hex(&output_buffer[1], (unsigned char *)str, len);
887 putpacket(output_buffer);
888
889 asm("spccont:");
890}
891
892/********************************** Handle exceptions ************************/
893/* Build and send a response packet in order to inform the host the
894 stub is stopped. TAAn...:r...;n...:r...;n...:r...;
895 AA = signal number
896 n... = register number (hex)
897 r... = register contents
898 n... = `thread'
899 r... = thread process ID. This is a hex integer.
900 n... = other string not starting with valid hex digit.
901 gdb should ignore this n,r pair and go on to the next.
902 This way we can extend the protocol. */
903static void
904stub_is_stopped(int sigval)
905{
906 char *ptr = output_buffer;
907 unsigned int reg_cont;
908
909 /* Send trap type (converted to signal) */
910
911 *ptr++ = 'T';
912 *ptr++ = highhex(sigval);
913 *ptr++ = lowhex(sigval);
914
915 if (((reg.exs & 0xff00) >> 8) == 0xc) {
916
917 /* Some kind of hardware watchpoint triggered. Find which one
918 and determine its type (read/write/access). */
919 int S, bp, trig_bits = 0, rw_bits = 0;
920 int trig_mask = 0;
921 unsigned int *bp_d_regs = &sreg.s3_3;
922 /* In a lot of cases, the stopped data address will simply be EDA.
923 In some cases, we adjust it to match the watched data range.
924 (We don't want to change the actual EDA though). */
925 unsigned int stopped_data_address;
926 /* The S field of EXS. */
927 S = (reg.exs & 0xffff0000) >> 16;
928
929 if (S & 1) {
930 /* Instruction watchpoint. */
931 /* FIXME: Check against, and possibly adjust reported EDA. */
932 } else {
933 /* Data watchpoint. Find the one that triggered. */
934 for (bp = 0; bp < 6; bp++) {
935
936 /* Dx_RD, Dx_WR in the S field of EXS for this BP. */
937 int bitpos_trig = 1 + bp * 2;
938 /* Dx_BPRD, Dx_BPWR in BP_CTRL for this BP. */
939 int bitpos_config = 2 + bp * 4;
940
941 /* Get read/write trig bits for this BP. */
942 trig_bits = (S & (3 << bitpos_trig)) >> bitpos_trig;
943
944 /* Read/write config bits for this BP. */
945 rw_bits = (sreg.s0_3 & (3 << bitpos_config)) >> bitpos_config;
946 if (trig_bits) {
947 /* Sanity check: the BP shouldn't trigger for accesses
948 that it isn't configured for. */
949 if ((rw_bits == 0x1 && trig_bits != 0x1) ||
950 (rw_bits == 0x2 && trig_bits != 0x2))
951 panic("Invalid r/w trigging for this BP");
952
953 /* Mark this BP as trigged for future reference. */
954 trig_mask |= (1 << bp);
955
956 if (reg.eda >= bp_d_regs[bp * 2] &&
957 reg.eda <= bp_d_regs[bp * 2 + 1]) {
958 /* EDA withing range for this BP; it must be the one
959 we're looking for. */
960 stopped_data_address = reg.eda;
961 break;
962 }
963 }
964 }
965 if (bp < 6) {
966 /* Found a trigged BP with EDA within its configured data range. */
967 } else if (trig_mask) {
968 /* Something triggered, but EDA doesn't match any BP's range. */
969 for (bp = 0; bp < 6; bp++) {
970 /* Dx_BPRD, Dx_BPWR in BP_CTRL for this BP. */
971 int bitpos_config = 2 + bp * 4;
972
973 /* Read/write config bits for this BP (needed later). */
974 rw_bits = (sreg.s0_3 & (3 << bitpos_config)) >> bitpos_config;
975
976 if (trig_mask & (1 << bp)) {
977 /* EDA within 31 bytes of the configured start address? */
978 if (reg.eda + 31 >= bp_d_regs[bp * 2]) {
979 /* Changing the reported address to match
980 the start address of the first applicable BP. */
981 stopped_data_address = bp_d_regs[bp * 2];
982 break;
983 } else {
984 /* We continue since we might find another useful BP. */
985 printk("EDA doesn't match trigged BP's range");
986 }
987 }
988 }
989 }
990
991 /* No match yet? */
992 BUG_ON(bp >= 6);
993 /* Note that we report the type according to what the BP is configured
994 for (otherwise we'd never report an 'awatch'), not according to how
995 it trigged. We did check that the trigged bits match what the BP is
996 configured for though. */
997 if (rw_bits == 0x1) {
998 /* read */
999 strncpy(ptr, "rwatch", 6);
1000 ptr += 6;
1001 } else if (rw_bits == 0x2) {
1002 /* write */
1003 strncpy(ptr, "watch", 5);
1004 ptr += 5;
1005 } else if (rw_bits == 0x3) {
1006 /* access */
1007 strncpy(ptr, "awatch", 6);
1008 ptr += 6;
1009 } else {
1010 panic("Invalid r/w bits for this BP.");
1011 }
1012
1013 *ptr++ = ':';
1014 /* Note that we don't read_register(EDA, ...) */
1015 ptr = mem2hex_nbo(ptr, (unsigned char *)&stopped_data_address, register_size[EDA]);
1016 *ptr++ = ';';
1017 }
1018 }
1019 /* Only send PC, frame and stack pointer. */
1020 read_register(PC, &reg_cont);
1021 *ptr++ = highhex(PC);
1022 *ptr++ = lowhex(PC);
1023 *ptr++ = ':';
1024 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
1025 *ptr++ = ';';
1026
1027 read_register(R8, &reg_cont);
1028 *ptr++ = highhex(R8);
1029 *ptr++ = lowhex(R8);
1030 *ptr++ = ':';
1031 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
1032 *ptr++ = ';';
1033
1034 read_register(SP, &reg_cont);
1035 *ptr++ = highhex(SP);
1036 *ptr++ = lowhex(SP);
1037 *ptr++ = ':';
1038 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
1039 *ptr++ = ';';
1040
1041 /* Send ERP as well; this will save us an entire register fetch in some cases. */
1042 read_register(ERP, &reg_cont);
1043 *ptr++ = highhex(ERP);
1044 *ptr++ = lowhex(ERP);
1045 *ptr++ = ':';
1046 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
1047 *ptr++ = ';';
1048
1049 /* null-terminate and send it off */
1050 *ptr = 0;
1051 putpacket(output_buffer);
1052}
1053
1054/* Returns the size of an instruction that has a delay slot. */
1055
1056int insn_size(unsigned long pc)
1057{
1058 unsigned short opcode = *(unsigned short *)pc;
1059 int size = 0;
1060
1061 switch ((opcode & 0x0f00) >> 8) {
1062 case 0x0:
1063 case 0x9:
1064 case 0xb:
1065 size = 2;
1066 break;
1067 case 0xe:
1068 case 0xf:
1069 size = 6;
1070 break;
1071 case 0xd:
1072 /* Could be 4 or 6; check more bits. */
1073 if ((opcode & 0xff) == 0xff)
1074 size = 4;
1075 else
1076 size = 6;
1077 break;
1078 default:
1079 panic("Couldn't find size of opcode 0x%x at 0x%lx\n", opcode, pc);
1080 }
1081
1082 return size;
1083}
1084
1085void register_fixup(int sigval)
1086{
1087 /* Compensate for ACR push at the beginning of exception handler. */
1088 reg.sp += 4;
1089
1090 /* Standard case. */
1091 reg.pc = reg.erp;
1092 if (reg.erp & 0x1) {
1093 /* Delay slot bit set. Report as stopped on proper instruction. */
1094 if (reg.spc) {
1095 /* Rely on SPC if set. */
1096 reg.pc = reg.spc;
1097 } else {
1098 /* Calculate the PC from the size of the instruction
1099 that the delay slot we're in belongs to. */
1100 reg.pc += insn_size(reg.erp & ~1) - 1 ;
1101 }
1102 }
1103
1104 if ((reg.exs & 0x3) == 0x0) {
1105 /* Bits 1 - 0 indicate the type of memory operation performed
1106 by the interrupted instruction. 0 means no memory operation,
1107 and EDA is undefined in that case. We zero it to avoid confusion. */
1108 reg.eda = 0;
1109 }
1110
1111 if (sigval == SIGTRAP) {
1112 /* Break 8, single step or hardware breakpoint exception. */
1113
1114 /* Check IDX field of EXS. */
1115 if (((reg.exs & 0xff00) >> 8) == 0x18) {
1116
1117 /* Break 8. */
1118
1119 /* Static (compiled) breakpoints must return to the next instruction
1120 in order to avoid infinite loops (default value of ERP). Dynamic
1121 (gdb-invoked) must subtract the size of the break instruction from
1122 the ERP so that the instruction that was originally in the break
1123 instruction's place will be run when we return from the exception. */
1124 if (!dynamic_bp) {
1125 /* Assuming that all breakpoints are dynamic from now on. */
1126 dynamic_bp = 1;
1127 } else {
1128
1129 /* Only if not in a delay slot. */
1130 if (!(reg.erp & 0x1)) {
1131 reg.erp -= 2;
1132 reg.pc -= 2;
1133 }
1134 }
1135
1136 } else if (((reg.exs & 0xff00) >> 8) == 0x3) {
1137 /* Single step. */
1138 /* Don't fiddle with S1. */
1139
1140 } else if (((reg.exs & 0xff00) >> 8) == 0xc) {
1141
1142 /* Hardware watchpoint exception. */
1143
1144 /* SPC has been updated so that we will get a single step exception
1145 when we return, but we don't want that. */
1146 reg.spc = 0;
1147
1148 /* Don't fiddle with S1. */
1149 }
1150
1151 } else if (sigval == SIGINT) {
1152 /* Nothing special. */
1153 }
1154}
1155
1156static void insert_watchpoint(char type, int addr, int len)
1157{
1158 /* Breakpoint/watchpoint types (GDB terminology):
1159 0 = memory breakpoint for instructions
1160 (not supported; done via memory write instead)
1161 1 = hardware breakpoint for instructions (supported)
1162 2 = write watchpoint (supported)
1163 3 = read watchpoint (supported)
1164 4 = access watchpoint (supported) */
1165
1166 if (type < '1' || type > '4') {
1167 output_buffer[0] = 0;
1168 return;
1169 }
1170
1171 /* Read watchpoints are set as access watchpoints, because of GDB's
1172 inability to deal with pure read watchpoints. */
1173 if (type == '3')
1174 type = '4';
1175
1176 if (type == '1') {
1177 /* Hardware (instruction) breakpoint. */
1178 /* Bit 0 in BP_CTRL holds the configuration for I0. */
1179 if (sreg.s0_3 & 0x1) {
1180 /* Already in use. */
1181 gdb_cris_strcpy(output_buffer, error_message[E04]);
1182 return;
1183 }
1184 /* Configure. */
1185 sreg.s1_3 = addr;
1186 sreg.s2_3 = (addr + len - 1);
1187 sreg.s0_3 |= 1;
1188 } else {
1189 int bp;
1190 unsigned int *bp_d_regs = &sreg.s3_3;
1191
1192 /* The watchpoint allocation scheme is the simplest possible.
1193 For example, if a region is watched for read and
1194 a write watch is requested, a new watchpoint will
1195 be used. Also, if a watch for a region that is already
1196 covered by one or more existing watchpoints, a new
1197 watchpoint will be used. */
1198
1199 /* First, find a free data watchpoint. */
1200 for (bp = 0; bp < 6; bp++) {
1201 /* Each data watchpoint's control registers occupy 2 bits
1202 (hence the 3), starting at bit 2 for D0 (hence the 2)
1203 with 4 bits between for each watchpoint (yes, the 4). */
1204 if (!(sreg.s0_3 & (0x3 << (2 + (bp * 4))))) {
1205 break;
1206 }
1207 }
1208
1209 if (bp > 5) {
1210 /* We're out of watchpoints. */
1211 gdb_cris_strcpy(output_buffer, error_message[E04]);
1212 return;
1213 }
1214
1215 /* Configure the control register first. */
1216 if (type == '3' || type == '4') {
1217 /* Trigger on read. */
1218 sreg.s0_3 |= (1 << (2 + bp * 4));
1219 }
1220 if (type == '2' || type == '4') {
1221 /* Trigger on write. */
1222 sreg.s0_3 |= (2 << (2 + bp * 4));
1223 }
1224
1225 /* Ugly pointer arithmetics to configure the watched range. */
1226 bp_d_regs[bp * 2] = addr;
1227 bp_d_regs[bp * 2 + 1] = (addr + len - 1);
1228 }
1229
1230 /* Set the S1 flag to enable watchpoints. */
1231 reg.ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
1232 gdb_cris_strcpy(output_buffer, "OK");
1233}
1234
1235static void remove_watchpoint(char type, int addr, int len)
1236{
1237 /* Breakpoint/watchpoint types:
1238 0 = memory breakpoint for instructions
1239 (not supported; done via memory write instead)
1240 1 = hardware breakpoint for instructions (supported)
1241 2 = write watchpoint (supported)
1242 3 = read watchpoint (supported)
1243 4 = access watchpoint (supported) */
1244 if (type < '1' || type > '4') {
1245 output_buffer[0] = 0;
1246 return;
1247 }
1248
1249 /* Read watchpoints are set as access watchpoints, because of GDB's
1250 inability to deal with pure read watchpoints. */
1251 if (type == '3')
1252 type = '4';
1253
1254 if (type == '1') {
1255 /* Hardware breakpoint. */
1256 /* Bit 0 in BP_CTRL holds the configuration for I0. */
1257 if (!(sreg.s0_3 & 0x1)) {
1258 /* Not in use. */
1259 gdb_cris_strcpy(output_buffer, error_message[E04]);
1260 return;
1261 }
1262 /* Deconfigure. */
1263 sreg.s1_3 = 0;
1264 sreg.s2_3 = 0;
1265 sreg.s0_3 &= ~1;
1266 } else {
1267 int bp;
1268 unsigned int *bp_d_regs = &sreg.s3_3;
1269 /* Try to find a watchpoint that is configured for the
1270 specified range, then check that read/write also matches. */
1271
1272 /* Ugly pointer arithmetic, since I cannot rely on a
1273 single switch (addr) as there may be several watchpoints with
1274 the same start address for example. */
1275
1276 for (bp = 0; bp < 6; bp++) {
1277 if (bp_d_regs[bp * 2] == addr &&
1278 bp_d_regs[bp * 2 + 1] == (addr + len - 1)) {
1279 /* Matching range. */
1280 int bitpos = 2 + bp * 4;
1281 int rw_bits;
1282
1283 /* Read/write bits for this BP. */
1284 rw_bits = (sreg.s0_3 & (0x3 << bitpos)) >> bitpos;
1285
1286 if ((type == '3' && rw_bits == 0x1) ||
1287 (type == '2' && rw_bits == 0x2) ||
1288 (type == '4' && rw_bits == 0x3)) {
1289 /* Read/write matched. */
1290 break;
1291 }
1292 }
1293 }
1294
1295 if (bp > 5) {
1296 /* No watchpoint matched. */
1297 gdb_cris_strcpy(output_buffer, error_message[E04]);
1298 return;
1299 }
1300
1301 /* Found a matching watchpoint. Now, deconfigure it by
1302 both disabling read/write in bp_ctrl and zeroing its
1303 start/end addresses. */
1304 sreg.s0_3 &= ~(3 << (2 + (bp * 4)));
1305 bp_d_regs[bp * 2] = 0;
1306 bp_d_regs[bp * 2 + 1] = 0;
1307 }
1308
1309 /* Note that we don't clear the S1 flag here. It's done when continuing. */
1310 gdb_cris_strcpy(output_buffer, "OK");
1311}
1312
1313
1314
1315/* All expected commands are sent from remote.c. Send a response according
1316 to the description in remote.c. */
1317void
1318handle_exception(int sigval)
1319{
1320 /* Avoid warning of not used. */
1321
1322 USEDFUN(handle_exception);
1323 USEDVAR(internal_stack[0]);
1324
1325 register_fixup(sigval);
1326
1327 /* Send response. */
1328 stub_is_stopped(sigval);
1329
1330 for (;;) {
1331 output_buffer[0] = '\0';
1332 getpacket(input_buffer);
1333 switch (input_buffer[0]) {
1334 case 'g':
1335 /* Read registers: g
1336 Success: Each byte of register data is described by two hex digits.
1337 Registers are in the internal order for GDB, and the bytes
1338 in a register are in the same order the machine uses.
1339 Failure: void. */
1340 {
1341 char *buf;
1342 /* General and special registers. */
1343 buf = mem2hex(output_buffer, (char *)&reg, sizeof(registers));
1344 /* Support registers. */
1345 /* -1 because of the null termination that mem2hex adds. */
1346 mem2hex(buf,
1347 (char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
1348 16 * sizeof(unsigned int));
1349 break;
1350 }
1351 case 'G':
1352 /* Write registers. GXX..XX
1353 Each byte of register data is described by two hex digits.
1354 Success: OK
1355 Failure: void. */
1356 /* General and special registers. */
1357 hex2mem((char *)&reg, &input_buffer[1], sizeof(registers));
1358 /* Support registers. */
1359 hex2mem((char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
1360 &input_buffer[1] + sizeof(registers),
1361 16 * sizeof(unsigned int));
1362 gdb_cris_strcpy(output_buffer, "OK");
1363 break;
1364
1365 case 'P':
1366 /* Write register. Pn...=r...
1367 Write register n..., hex value without 0x, with value r...,
1368 which contains a hex value without 0x and two hex digits
1369 for each byte in the register (target byte order). P1f=11223344 means
1370 set register 31 to 44332211.
1371 Success: OK
1372 Failure: E02, E05 */
1373 {
1374 char *suffix;
1375 int regno = gdb_cris_strtol(&input_buffer[1], &suffix, 16);
1376 int status;
1377
1378 status = write_register(regno, suffix+1);
1379
1380 switch (status) {
1381 case E02:
1382 /* Do not support read-only registers. */
1383 gdb_cris_strcpy(output_buffer, error_message[E02]);
1384 break;
1385 case E05:
1386 /* Do not support non-existing registers. */
1387 gdb_cris_strcpy(output_buffer, error_message[E05]);
1388 break;
1389 default:
1390 /* Valid register number. */
1391 gdb_cris_strcpy(output_buffer, "OK");
1392 break;
1393 }
1394 }
1395 break;
1396
1397 case 'm':
1398 /* Read from memory. mAA..AA,LLLL
1399 AA..AA is the address and LLLL is the length.
1400 Success: XX..XX is the memory content. Can be fewer bytes than
1401 requested if only part of the data may be read. m6000120a,6c means
1402 retrieve 108 byte from base address 6000120a.
1403 Failure: void. */
1404 {
1405 char *suffix;
1406 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&input_buffer[1],
1407 &suffix, 16);
1408 int len = gdb_cris_strtol(suffix+1, 0, 16);
1409
1410 /* Bogus read (i.e. outside the kernel's
1411 segment)? . */
1412 if (!((unsigned int)addr >= 0xc0000000 &&
1413 (unsigned int)addr < 0xd0000000))
1414 addr = NULL;
1415
1416 mem2hex(output_buffer, addr, len);
1417 }
1418 break;
1419
1420 case 'X':
1421 /* Write to memory. XAA..AA,LLLL:XX..XX
1422 AA..AA is the start address, LLLL is the number of bytes, and
1423 XX..XX is the binary data.
1424 Success: OK
1425 Failure: void. */
1426 case 'M':
1427 /* Write to memory. MAA..AA,LLLL:XX..XX
1428 AA..AA is the start address, LLLL is the number of bytes, and
1429 XX..XX is the hexadecimal data.
1430 Success: OK
1431 Failure: void. */
1432 {
1433 char *lenptr;
1434 char *dataptr;
1435 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&input_buffer[1],
1436 &lenptr, 16);
1437 int len = gdb_cris_strtol(lenptr+1, &dataptr, 16);
1438 if (*lenptr == ',' && *dataptr == ':') {
1439 if (input_buffer[0] == 'M') {
1440 hex2mem(addr, dataptr + 1, len);
1441 } else /* X */ {
1442 bin2mem(addr, dataptr + 1, len);
1443 }
1444 gdb_cris_strcpy(output_buffer, "OK");
1445 }
1446 else {
1447 gdb_cris_strcpy(output_buffer, error_message[E06]);
1448 }
1449 }
1450 break;
1451
1452 case 'c':
1453 /* Continue execution. cAA..AA
1454 AA..AA is the address where execution is resumed. If AA..AA is
1455 omitted, resume at the present address.
1456 Success: return to the executing thread.
1457 Failure: will never know. */
1458
1459 if (input_buffer[1] != '\0') {
1460 /* FIXME: Doesn't handle address argument. */
1461 gdb_cris_strcpy(output_buffer, error_message[E04]);
1462 break;
1463 }
1464
1465 /* Before continuing, make sure everything is set up correctly. */
1466
1467 /* Set the SPC to some unlikely value. */
1468 reg.spc = 0;
1469 /* Set the S1 flag to 0 unless some watchpoint is enabled (since setting
1470 S1 to 0 would also disable watchpoints). (Note that bits 26-31 in BP_CTRL
1471 are reserved, so don't check against those). */
1472 if ((sreg.s0_3 & 0x3fff) == 0) {
1473 reg.ccs &= ~(1 << (S_CCS_BITNR + CCS_SHIFT));
1474 }
1475
1476 return;
1477
1478 case 's':
1479 /* Step. sAA..AA
1480 AA..AA is the address where execution is resumed. If AA..AA is
1481 omitted, resume at the present address. Success: return to the
1482 executing thread. Failure: will never know. */
1483
1484 if (input_buffer[1] != '\0') {
1485 /* FIXME: Doesn't handle address argument. */
1486 gdb_cris_strcpy(output_buffer, error_message[E04]);
1487 break;
1488 }
1489
1490 /* Set the SPC to PC, which is where we'll return
1491 (deduced previously). */
1492 reg.spc = reg.pc;
1493
1494 /* Set the S1 (first stacked, not current) flag, which will
1495 kick into action when we rfe. */
1496 reg.ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
1497 return;
1498
1499 case 'Z':
1500
1501 /* Insert breakpoint or watchpoint, Ztype,addr,length.
1502 Remote protocol says: A remote target shall return an empty string
1503 for an unrecognized breakpoint or watchpoint packet type. */
1504 {
1505 char *lenptr;
1506 char *dataptr;
1507 int addr = gdb_cris_strtol(&input_buffer[3], &lenptr, 16);
1508 int len = gdb_cris_strtol(lenptr + 1, &dataptr, 16);
1509 char type = input_buffer[1];
1510
1511 insert_watchpoint(type, addr, len);
1512 break;
1513 }
1514
1515 case 'z':
1516 /* Remove breakpoint or watchpoint, Ztype,addr,length.
1517 Remote protocol says: A remote target shall return an empty string
1518 for an unrecognized breakpoint or watchpoint packet type. */
1519 {
1520 char *lenptr;
1521 char *dataptr;
1522 int addr = gdb_cris_strtol(&input_buffer[3], &lenptr, 16);
1523 int len = gdb_cris_strtol(lenptr + 1, &dataptr, 16);
1524 char type = input_buffer[1];
1525
1526 remove_watchpoint(type, addr, len);
1527 break;
1528 }
1529
1530
1531 case '?':
1532 /* The last signal which caused a stop. ?
1533 Success: SAA, where AA is the signal number.
1534 Failure: void. */
1535 output_buffer[0] = 'S';
1536 output_buffer[1] = highhex(sigval);
1537 output_buffer[2] = lowhex(sigval);
1538 output_buffer[3] = 0;
1539 break;
1540
1541 case 'D':
1542 /* Detach from host. D
1543 Success: OK, and return to the executing thread.
1544 Failure: will never know */
1545 putpacket("OK");
1546 return;
1547
1548 case 'k':
1549 case 'r':
1550 /* kill request or reset request.
1551 Success: restart of target.
1552 Failure: will never know. */
1553 kill_restart();
1554 break;
1555
1556 case 'C':
1557 case 'S':
1558 case '!':
1559 case 'R':
1560 case 'd':
1561 /* Continue with signal sig. Csig;AA..AA
1562 Step with signal sig. Ssig;AA..AA
1563 Use the extended remote protocol. !
1564 Restart the target system. R0
1565 Toggle debug flag. d
1566 Search backwards. tAA:PP,MM
1567 Not supported: E04 */
1568
1569 /* FIXME: What's the difference between not supported
1570 and ignored (below)? */
1571 gdb_cris_strcpy(output_buffer, error_message[E04]);
1572 break;
1573
1574 default:
1575 /* The stub should ignore other request and send an empty
1576 response ($#<checksum>). This way we can extend the protocol and GDB
1577 can tell whether the stub it is talking to uses the old or the new. */
1578 output_buffer[0] = 0;
1579 break;
1580 }
1581 putpacket(output_buffer);
1582 }
1583}
1584
1585void
1586kgdb_init(void)
1587{
1588 reg_intr_vect_rw_mask intr_mask;
1589 reg_ser_rw_intr_mask ser_intr_mask;
1590
1591 /* Configure the kgdb serial port. */
1592#if defined(CONFIG_ETRAX_KGDB_PORT0)
1593 /* Note: no shortcut registered (not handled by multiple_interrupt).
1594 See entry.S. */
1595 set_exception_vector(SER0_INTR_VECT, kgdb_handle_exception);
1596 /* Enable the ser irq in the global config. */
1597 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1598 intr_mask.ser0 = 1;
1599 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1600
1601 ser_intr_mask = REG_RD(ser, regi_ser0, rw_intr_mask);
1602 ser_intr_mask.data_avail = regk_ser_yes;
1603 REG_WR(ser, regi_ser0, rw_intr_mask, ser_intr_mask);
1604#elif defined(CONFIG_ETRAX_KGDB_PORT1)
1605 /* Note: no shortcut registered (not handled by multiple_interrupt).
1606 See entry.S. */
1607 set_exception_vector(SER1_INTR_VECT, kgdb_handle_exception);
1608 /* Enable the ser irq in the global config. */
1609 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1610 intr_mask.ser1 = 1;
1611 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1612
1613 ser_intr_mask = REG_RD(ser, regi_ser1, rw_intr_mask);
1614 ser_intr_mask.data_avail = regk_ser_yes;
1615 REG_WR(ser, regi_ser1, rw_intr_mask, ser_intr_mask);
1616#elif defined(CONFIG_ETRAX_KGDB_PORT2)
1617 /* Note: no shortcut registered (not handled by multiple_interrupt).
1618 See entry.S. */
1619 set_exception_vector(SER2_INTR_VECT, kgdb_handle_exception);
1620 /* Enable the ser irq in the global config. */
1621 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1622 intr_mask.ser2 = 1;
1623 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1624
1625 ser_intr_mask = REG_RD(ser, regi_ser2, rw_intr_mask);
1626 ser_intr_mask.data_avail = regk_ser_yes;
1627 REG_WR(ser, regi_ser2, rw_intr_mask, ser_intr_mask);
1628#elif defined(CONFIG_ETRAX_KGDB_PORT3)
1629 /* Note: no shortcut registered (not handled by multiple_interrupt).
1630 See entry.S. */
1631 set_exception_vector(SER3_INTR_VECT, kgdb_handle_exception);
1632 /* Enable the ser irq in the global config. */
1633 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1634 intr_mask.ser3 = 1;
1635 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1636
1637 ser_intr_mask = REG_RD(ser, regi_ser3, rw_intr_mask);
1638 ser_intr_mask.data_avail = regk_ser_yes;
1639 REG_WR(ser, regi_ser3, rw_intr_mask, ser_intr_mask);
1640#endif
1641
1642}
1643/* Performs a complete re-start from scratch. */
1644static void
1645kill_restart(void)
1646{
1647 machine_restart("");
1648}
1649
1650/* Use this static breakpoint in the start-up only. */
1651
1652void
1653breakpoint(void)
1654{
1655 kgdb_started = 1;
1656 dynamic_bp = 0; /* This is a static, not a dynamic breakpoint. */
1657 __asm__ volatile ("break 8"); /* Jump to kgdb_handle_breakpoint. */
1658}
1659
1660/****************************** End of file **********************************/
diff --git a/arch/cris/arch-v32/kernel/kgdb_asm.S b/arch/cris/arch-v32/kernel/kgdb_asm.S
new file mode 100644
index 000000000000..b350dd279ed2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/kgdb_asm.S
@@ -0,0 +1,552 @@
1/*
2 * Copyright (C) 2004 Axis Communications AB
3 *
4 * Code for handling break 8, hardware breakpoint, single step, and serial
5 * port exceptions for kernel debugging purposes.
6 */
7
8#include <linux/config.h>
9#include <asm/arch/hwregs/intr_vect.h>
10
11 ;; Exported functions.
12 .globl kgdb_handle_exception
13
14kgdb_handle_exception:
15
16;; Create a register image of the caller.
17;;
18;; First of all, save the ACR on the stack since we need it for address calculations.
19;; We put it into the register struct later.
20
21 subq 4, $sp
22 move.d $acr, [$sp]
23
24;; Now we are free to use ACR all we want.
25;; If we were running this handler with interrupts on, we would have to be careful
26;; to save and restore CCS manually, but since we aren't we treat it like every other
27;; register.
28
29 move.d reg, $acr
30 move.d $r0, [$acr] ; Save R0 (start of register struct)
31 addq 4, $acr
32 move.d $r1, [$acr] ; Save R1
33 addq 4, $acr
34 move.d $r2, [$acr] ; Save R2
35 addq 4, $acr
36 move.d $r3, [$acr] ; Save R3
37 addq 4, $acr
38 move.d $r4, [$acr] ; Save R4
39 addq 4, $acr
40 move.d $r5, [$acr] ; Save R5
41 addq 4, $acr
42 move.d $r6, [$acr] ; Save R6
43 addq 4, $acr
44 move.d $r7, [$acr] ; Save R7
45 addq 4, $acr
46 move.d $r8, [$acr] ; Save R8
47 addq 4, $acr
48 move.d $r9, [$acr] ; Save R9
49 addq 4, $acr
50 move.d $r10, [$acr] ; Save R10
51 addq 4, $acr
52 move.d $r11, [$acr] ; Save R11
53 addq 4, $acr
54 move.d $r12, [$acr] ; Save R12
55 addq 4, $acr
56 move.d $r13, [$acr] ; Save R13
57 addq 4, $acr
58 move.d $sp, [$acr] ; Save SP (R14)
59 addq 4, $acr
60
61 ;; The ACR register is already saved on the stack, so pop it from there.
62 move.d [$sp],$r0
63 move.d $r0, [$acr]
64 addq 4, $acr
65
66 move $bz, [$acr]
67 addq 1, $acr
68 move $vr, [$acr]
69 addq 1, $acr
70 move $pid, [$acr]
71 addq 4, $acr
72 move $srs, [$acr]
73 addq 1, $acr
74 move $wz, [$acr]
75 addq 2, $acr
76 move $exs, [$acr]
77 addq 4, $acr
78 move $eda, [$acr]
79 addq 4, $acr
80 move $mof, [$acr]
81 addq 4, $acr
82 move $dz, [$acr]
83 addq 4, $acr
84 move $ebp, [$acr]
85 addq 4, $acr
86 move $erp, [$acr]
87 addq 4, $acr
88 move $srp, [$acr]
89 addq 4, $acr
90 move $nrp, [$acr]
91 addq 4, $acr
92 move $ccs, [$acr]
93 addq 4, $acr
94 move $usp, [$acr]
95 addq 4, $acr
96 move $spc, [$acr]
97 addq 4, $acr
98
99;; Skip the pseudo-PC.
100 addq 4, $acr
101
102;; Save the support registers in bank 0 - 3.
103 clear.d $r1 ; Bank counter
104 move.d sreg, $acr
105
106;; Bank 0
107 move $r1, $srs
108 nop
109 nop
110 nop
111 move $s0, $r0
112 move.d $r0, [$acr]
113 addq 4, $acr
114 move $s1, $r0
115 move.d $r0, [$acr]
116 addq 4, $acr
117 move $s2, $r0
118 move.d $r0, [$acr]
119 addq 4, $acr
120 move $s3, $r0
121 move.d $r0, [$acr]
122 addq 4, $acr
123 move $s4, $r0
124 move.d $r0, [$acr]
125 addq 4, $acr
126 move $s5, $r0
127 move.d $r0, [$acr]
128 addq 4, $acr
129 move $s6, $r0
130 move.d $r0, [$acr]
131 addq 4, $acr
132 move $s7, $r0
133 move.d $r0, [$acr]
134 addq 4, $acr
135 move $s8, $r0
136 move.d $r0, [$acr]
137 addq 4, $acr
138 move $s9, $r0
139 move.d $r0, [$acr]
140 addq 4, $acr
141 move $s10, $r0
142 move.d $r0, [$acr]
143 addq 4, $acr
144 move $s11, $r0
145 move.d $r0, [$acr]
146 addq 4, $acr
147 move $s12, $r0
148 move.d $r0, [$acr]
149 addq 4, $acr
150
151 ;; Nothing in S13 - S15, bank 0
152 clear.d [$acr]
153 addq 4, $acr
154 clear.d [$acr]
155 addq 4, $acr
156 clear.d [$acr]
157 addq 4, $acr
158
159;; Bank 1 and bank 2 have the same layout, hence the loop.
160 addq 1, $r1
1611:
162 move $r1, $srs
163 nop
164 nop
165 nop
166 move $s0, $r0
167 move.d $r0, [$acr]
168 addq 4, $acr
169 move $s1, $r0
170 move.d $r0, [$acr]
171 addq 4, $acr
172 move $s2, $r0
173 move.d $r0, [$acr]
174 addq 4, $acr
175 move $s3, $r0
176 move.d $r0, [$acr]
177 addq 4, $acr
178 move $s4, $r0
179 move.d $r0, [$acr]
180 addq 4, $acr
181 move $s5, $r0
182 move.d $r0, [$acr]
183 addq 4, $acr
184 move $s6, $r0
185 move.d $r0, [$acr]
186 addq 4, $acr
187
188 ;; Nothing in S7 - S15, bank 1 and 2
189 clear.d [$acr]
190 addq 4, $acr
191 clear.d [$acr]
192 addq 4, $acr
193 clear.d [$acr]
194 addq 4, $acr
195 clear.d [$acr]
196 addq 4, $acr
197 clear.d [$acr]
198 addq 4, $acr
199 clear.d [$acr]
200 addq 4, $acr
201 clear.d [$acr]
202 addq 4, $acr
203 clear.d [$acr]
204 addq 4, $acr
205 clear.d [$acr]
206 addq 4, $acr
207
208 addq 1, $r1
209 cmpq 3, $r1
210 bne 1b
211 nop
212
213;; Bank 3
214 move $r1, $srs
215 nop
216 nop
217 nop
218 move $s0, $r0
219 move.d $r0, [$acr]
220 addq 4, $acr
221 move $s1, $r0
222 move.d $r0, [$acr]
223 addq 4, $acr
224 move $s2, $r0
225 move.d $r0, [$acr]
226 addq 4, $acr
227 move $s3, $r0
228 move.d $r0, [$acr]
229 addq 4, $acr
230 move $s4, $r0
231 move.d $r0, [$acr]
232 addq 4, $acr
233 move $s5, $r0
234 move.d $r0, [$acr]
235 addq 4, $acr
236 move $s6, $r0
237 move.d $r0, [$acr]
238 addq 4, $acr
239 move $s7, $r0
240 move.d $r0, [$acr]
241 addq 4, $acr
242 move $s8, $r0
243 move.d $r0, [$acr]
244 addq 4, $acr
245 move $s9, $r0
246 move.d $r0, [$acr]
247 addq 4, $acr
248 move $s10, $r0
249 move.d $r0, [$acr]
250 addq 4, $acr
251 move $s11, $r0
252 move.d $r0, [$acr]
253 addq 4, $acr
254 move $s12, $r0
255 move.d $r0, [$acr]
256 addq 4, $acr
257 move $s13, $r0
258 move.d $r0, [$acr]
259 addq 4, $acr
260 move $s14, $r0
261 move.d $r0, [$acr]
262 addq 4, $acr
263;; Nothing in S15, bank 3
264 clear.d [$acr]
265 addq 4, $acr
266
267;; Check what got us here: get IDX field of EXS.
268 move $exs, $r10
269 and.d 0xff00, $r10
270 lsrq 8, $r10
271#if defined(CONFIG_ETRAX_KGDB_PORT0)
272 cmp.d SER0_INTR_VECT, $r10 ; IRQ for serial port 0
273 beq sigint
274 nop
275#elif defined(CONFIG_ETRAX_KGDB_PORT1)
276 cmp.d SER1_INTR_VECT, $r10 ; IRQ for serial port 1
277 beq sigint
278 nop
279#elif defined(CONFIG_ETRAX_KGDB_PORT2)
280 cmp.d SER2_INTR_VECT, $r10 ; IRQ for serial port 2
281 beq sigint
282 nop
283#elif defined(CONFIG_ETRAX_KGDB_PORT3)
284 cmp.d SER3_INTR_VECT, $r10 ; IRQ for serial port 3
285 beq sigint
286 nop
287#endif
288;; Multiple interrupt must be due to serial break.
289 cmp.d 0x30, $r10 ; Multiple interrupt
290 beq sigint
291 nop
292;; Neither of those? Then it's a sigtrap.
293 ba handle_comm
294 moveq 5, $r10 ; Set SIGTRAP (delay slot)
295
296sigint:
297 ;; Serial interrupt; get character
298 jsr getDebugChar
299 nop ; Delay slot
300 cmp.b 3, $r10 ; \003 (Ctrl-C)?
301 bne return ; No, get out of here
302 nop
303 moveq 2, $r10 ; Set SIGINT
304
305;;
306;; Handle the communication
307;;
308handle_comm:
309 move.d internal_stack+1020, $sp ; Use the internal stack which grows upwards
310 jsr handle_exception ; Interactive routine
311 nop
312
313;;
314;; Return to the caller
315;;
316return:
317
318;; First of all, write the support registers.
319 clear.d $r1 ; Bank counter
320 move.d sreg, $acr
321
322;; Bank 0
323 move $r1, $srs
324 nop
325 nop
326 nop
327 move.d [$acr], $r0
328 move $r0, $s0
329 addq 4, $acr
330 move.d [$acr], $r0
331 move $r0, $s1
332 addq 4, $acr
333 move.d [$acr], $r0
334 move $r0, $s2
335 addq 4, $acr
336 move.d [$acr], $r0
337 move $r0, $s3
338 addq 4, $acr
339 move.d [$acr], $r0
340 move $r0, $s4
341 addq 4, $acr
342 move.d [$acr], $r0
343 move $r0, $s5
344 addq 4, $acr
345
346;; Nothing in S6 - S7, bank 0.
347 addq 4, $acr
348 addq 4, $acr
349
350 move.d [$acr], $r0
351 move $r0, $s8
352 addq 4, $acr
353 move.d [$acr], $r0
354 move $r0, $s9
355 addq 4, $acr
356 move.d [$acr], $r0
357 move $r0, $s10
358 addq 4, $acr
359 move.d [$acr], $r0
360 move $r0, $s11
361 addq 4, $acr
362 move.d [$acr], $r0
363 move $r0, $s12
364 addq 4, $acr
365
366;; Nothing in S13 - S15, bank 0
367 addq 4, $acr
368 addq 4, $acr
369 addq 4, $acr
370
371;; Bank 1 and bank 2 have the same layout, hence the loop.
372 addq 1, $r1
3732:
374 move $r1, $srs
375 nop
376 nop
377 nop
378 move.d [$acr], $r0
379 move $r0, $s0
380 addq 4, $acr
381 move.d [$acr], $r0
382 move $r0, $s1
383 addq 4, $acr
384 move.d [$acr], $r0
385 move $r0, $s2
386 addq 4, $acr
387
388;; S3 (MM_CAUSE) is read-only.
389 addq 4, $acr
390
391 move.d [$acr], $r0
392 move $r0, $s4
393 addq 4, $acr
394
395;; FIXME: Actually write S5/S6? (Affects MM_CAUSE.)
396 addq 4, $acr
397 addq 4, $acr
398
399;; Nothing in S7 - S15, bank 1 and 2
400 addq 4, $acr
401 addq 4, $acr
402 addq 4, $acr
403 addq 4, $acr
404 addq 4, $acr
405 addq 4, $acr
406 addq 4, $acr
407 addq 4, $acr
408 addq 4, $acr
409
410 addq 1, $r1
411 cmpq 3, $r1
412 bne 2b
413 nop
414
415;; Bank 3
416 move $r1, $srs
417 nop
418 nop
419 nop
420 move.d [$acr], $r0
421 move $r0, $s0
422 addq 4, $acr
423 move.d [$acr], $r0
424 move $r0, $s1
425 addq 4, $acr
426 move.d [$acr], $r0
427 move $r0, $s2
428 addq 4, $acr
429 move.d [$acr], $r0
430 move $r0, $s3
431 addq 4, $acr
432 move.d [$acr], $r0
433 move $r0, $s4
434 addq 4, $acr
435 move.d [$acr], $r0
436 move $r0, $s5
437 addq 4, $acr
438 move.d [$acr], $r0
439 move $r0, $s6
440 addq 4, $acr
441 move.d [$acr], $r0
442 move $r0, $s7
443 addq 4, $acr
444 move.d [$acr], $r0
445 move $r0, $s8
446 addq 4, $acr
447 move.d [$acr], $r0
448 move $r0, $s9
449 addq 4, $acr
450 move.d [$acr], $r0
451 move $r0, $s10
452 addq 4, $acr
453 move.d [$acr], $r0
454 move $r0, $s11
455 addq 4, $acr
456 move.d [$acr], $r0
457 move $r0, $s12
458 addq 4, $acr
459 move.d [$acr], $r0
460 move $r0, $s13
461 addq 4, $acr
462 move.d [$acr], $r0
463 move $r0, $s14
464 addq 4, $acr
465
466;; Nothing in S15, bank 3
467 addq 4, $acr
468
469;; Now, move on to the regular register restoration process.
470
471 move.d reg, $acr ; Reset ACR to point at the beginning of the register image
472 move.d [$acr], $r0 ; Restore R0
473 addq 4, $acr
474 move.d [$acr], $r1 ; Restore R1
475 addq 4, $acr
476 move.d [$acr], $r2 ; Restore R2
477 addq 4, $acr
478 move.d [$acr], $r3 ; Restore R3
479 addq 4, $acr
480 move.d [$acr], $r4 ; Restore R4
481 addq 4, $acr
482 move.d [$acr], $r5 ; Restore R5
483 addq 4, $acr
484 move.d [$acr], $r6 ; Restore R6
485 addq 4, $acr
486 move.d [$acr], $r7 ; Restore R7
487 addq 4, $acr
488 move.d [$acr], $r8 ; Restore R8
489 addq 4, $acr
490 move.d [$acr], $r9 ; Restore R9
491 addq 4, $acr
492 move.d [$acr], $r10 ; Restore R10
493 addq 4, $acr
494 move.d [$acr], $r11 ; Restore R11
495 addq 4, $acr
496 move.d [$acr], $r12 ; Restore R12
497 addq 4, $acr
498 move.d [$acr], $r13 ; Restore R13
499
500;;
501;; We restore all registers, even though some of them probably haven't changed.
502;;
503
504 addq 4, $acr
505 move.d [$acr], $sp ; Restore SP (R14)
506
507 ;; ACR cannot be restored just yet.
508 addq 8, $acr
509
510 ;; Skip BZ, VR.
511 addq 2, $acr
512
513 move [$acr], $pid ; Restore PID
514 addq 4, $acr
515 move [$acr], $srs ; Restore SRS
516 nop
517 nop
518 nop
519 addq 1, $acr
520
521 ;; Skip WZ.
522 addq 2, $acr
523
524 move [$acr], $exs ; Restore EXS.
525 addq 4, $acr
526 move [$acr], $eda ; Restore EDA.
527 addq 4, $acr
528 move [$acr], $mof ; Restore MOF.
529
530 ;; Skip DZ.
531 addq 8, $acr
532
533 move [$acr], $ebp ; Restore EBP.
534 addq 4, $acr
535 move [$acr], $erp ; Restore ERP.
536 addq 4, $acr
537 move [$acr], $srp ; Restore SRP.
538 addq 4, $acr
539 move [$acr], $nrp ; Restore NRP.
540 addq 4, $acr
541 move [$acr], $ccs ; Restore CCS like an ordinary register.
542 addq 4, $acr
543 move [$acr], $usp ; Restore USP
544 addq 4, $acr
545 move [$acr], $spc ; Restore SPC
546 ; No restoration of pseudo-PC of course.
547
548 move.d reg, $acr ; Reset ACR to point at the beginning of the register image
549 add.d 15*4, $acr
550 move.d [$acr], $acr ; Finally, restore ACR.
551 rete ; Same as jump ERP
552 rfe ; Shifts CCS
diff --git a/arch/cris/arch-v32/kernel/pinmux.c b/arch/cris/arch-v32/kernel/pinmux.c
new file mode 100644
index 000000000000..a2b8aa37c1bf
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/pinmux.c
@@ -0,0 +1,229 @@
1/*
2 * Allocator for I/O pins. All pins are allocated to GPIO at bootup.
3 * Unassigned pins and GPIO pins can be allocated to a fixed interface
4 * or the I/O processor instead.
5 *
6 * Copyright (c) 2004 Axis Communications AB.
7 */
8
9#include <linux/init.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <linux/spinlock.h>
14#include <asm/arch/hwregs/reg_map.h>
15#include <asm/arch/hwregs/reg_rdwr.h>
16#include <asm/arch/pinmux.h>
17#include <asm/arch/hwregs/pinmux_defs.h>
18
19#undef DEBUG
20
21#define PORT_PINS 18
22#define PORTS 4
23
24static char pins[PORTS][PORT_PINS];
25static DEFINE_SPINLOCK(pinmux_lock);
26
27static void crisv32_pinmux_set(int port);
28
29int
30crisv32_pinmux_init(void)
31{
32 static int initialized = 0;
33
34 if (!initialized) {
35 reg_pinmux_rw_pa pa = REG_RD(pinmux, regi_pinmux, rw_pa);
36 initialized = 1;
37 pa.pa0 = pa.pa1 = pa.pa2 = pa.pa3 =
38 pa.pa4 = pa.pa5 = pa.pa6 = pa.pa7 = regk_pinmux_yes;
39 REG_WR(pinmux, regi_pinmux, rw_pa, pa);
40 crisv32_pinmux_alloc(PORT_B, 0, PORT_PINS - 1, pinmux_gpio);
41 crisv32_pinmux_alloc(PORT_C, 0, PORT_PINS - 1, pinmux_gpio);
42 crisv32_pinmux_alloc(PORT_D, 0, PORT_PINS - 1, pinmux_gpio);
43 crisv32_pinmux_alloc(PORT_E, 0, PORT_PINS - 1, pinmux_gpio);
44 }
45
46 return 0;
47}
48
49int
50crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
51{
52 int i;
53 unsigned long flags;
54
55 crisv32_pinmux_init();
56
57 if (port > PORTS)
58 return -EINVAL;
59
60 spin_lock_irqsave(&pinmux_lock, flags);
61
62 for (i = first_pin; i <= last_pin; i++)
63 {
64 if ((pins[port][i] != pinmux_none) && (pins[port][i] != pinmux_gpio) &&
65 (pins[port][i] != mode))
66 {
67 spin_unlock_irqrestore(&pinmux_lock, flags);
68#ifdef DEBUG
69 panic("Pinmux alloc failed!\n");
70#endif
71 return -EPERM;
72 }
73 }
74
75 for (i = first_pin; i <= last_pin; i++)
76 pins[port][i] = mode;
77
78 crisv32_pinmux_set(port);
79
80 spin_unlock_irqrestore(&pinmux_lock, flags);
81
82 return 0;
83}
84
85int
86crisv32_pinmux_alloc_fixed(enum fixed_function function)
87{
88 int ret = -EINVAL;
89 char saved[sizeof pins];
90 unsigned long flags;
91
92 spin_lock_irqsave(&pinmux_lock, flags);
93
94 /* Save internal data for recovery */
95 memcpy(saved, pins, sizeof pins);
96
97 reg_pinmux_rw_hwprot hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
98
99 switch(function)
100 {
101 case pinmux_ser1:
102 ret = crisv32_pinmux_alloc(PORT_C, 4, 7, pinmux_fixed);
103 hwprot.ser1 = regk_pinmux_yes;
104 break;
105 case pinmux_ser2:
106 ret = crisv32_pinmux_alloc(PORT_C, 8, 11, pinmux_fixed);
107 hwprot.ser2 = regk_pinmux_yes;
108 break;
109 case pinmux_ser3:
110 ret = crisv32_pinmux_alloc(PORT_C, 12, 15, pinmux_fixed);
111 hwprot.ser3 = regk_pinmux_yes;
112 break;
113 case pinmux_sser0:
114 ret = crisv32_pinmux_alloc(PORT_C, 0, 3, pinmux_fixed);
115 ret |= crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
116 hwprot.sser0 = regk_pinmux_yes;
117 break;
118 case pinmux_sser1:
119 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
120 hwprot.sser1 = regk_pinmux_yes;
121 break;
122 case pinmux_ata0:
123 ret = crisv32_pinmux_alloc(PORT_D, 5, 7, pinmux_fixed);
124 ret |= crisv32_pinmux_alloc(PORT_D, 15, 17, pinmux_fixed);
125 hwprot.ata0 = regk_pinmux_yes;
126 break;
127 case pinmux_ata1:
128 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
129 ret |= crisv32_pinmux_alloc(PORT_E, 17, 17, pinmux_fixed);
130 hwprot.ata1 = regk_pinmux_yes;
131 break;
132 case pinmux_ata2:
133 ret = crisv32_pinmux_alloc(PORT_C, 11, 15, pinmux_fixed);
134 ret |= crisv32_pinmux_alloc(PORT_E, 3, 3, pinmux_fixed);
135 hwprot.ata2 = regk_pinmux_yes;
136 break;
137 case pinmux_ata3:
138 ret = crisv32_pinmux_alloc(PORT_C, 8, 10, pinmux_fixed);
139 ret |= crisv32_pinmux_alloc(PORT_C, 0, 2, pinmux_fixed);
140 hwprot.ata2 = regk_pinmux_yes;
141 break;
142 case pinmux_ata:
143 ret = crisv32_pinmux_alloc(PORT_B, 0, 15, pinmux_fixed);
144 ret |= crisv32_pinmux_alloc(PORT_D, 8, 15, pinmux_fixed);
145 hwprot.ata = regk_pinmux_yes;
146 break;
147 case pinmux_eth1:
148 ret = crisv32_pinmux_alloc(PORT_E, 0, 17, pinmux_fixed);
149 hwprot.eth1 = regk_pinmux_yes;
150 hwprot.eth1_mgm = regk_pinmux_yes;
151 break;
152 case pinmux_timer:
153 ret = crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
154 hwprot.timer = regk_pinmux_yes;
155 spin_unlock_irqrestore(&pinmux_lock, flags);
156 return ret;
157 }
158
159 if (!ret)
160 REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
161 else
162 memcpy(pins, saved, sizeof pins);
163
164 spin_unlock_irqrestore(&pinmux_lock, flags);
165
166 return ret;
167}
168
169void
170crisv32_pinmux_set(int port)
171{
172 int i;
173 int gpio_val = 0;
174 int iop_val = 0;
175
176 for (i = 0; i < PORT_PINS; i++)
177 {
178 if (pins[port][i] == pinmux_gpio)
179 gpio_val |= (1 << i);
180 else if (pins[port][i] == pinmux_iop)
181 iop_val |= (1 << i);
182 }
183
184 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_gio + 8*port, gpio_val);
185 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_iop + 8*port, iop_val);
186
187#ifdef DEBUG
188 crisv32_pinmux_dump();
189#endif
190}
191
192int
193crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
194{
195 int i;
196 unsigned long flags;
197
198 crisv32_pinmux_init();
199
200 if (port > PORTS)
201 return -EINVAL;
202
203 spin_lock_irqsave(&pinmux_lock, flags);
204
205 for (i = first_pin; i <= last_pin; i++)
206 pins[port][i] = pinmux_none;
207
208 crisv32_pinmux_set(port);
209 spin_unlock_irqrestore(&pinmux_lock, flags);
210
211 return 0;
212}
213
214void
215crisv32_pinmux_dump(void)
216{
217 int i, j;
218
219 crisv32_pinmux_init();
220
221 for (i = 0; i < PORTS; i++)
222 {
223 printk("Port %c\n", 'B'+i);
224 for (j = 0; j < PORT_PINS; j++)
225 printk(" Pin %d = %d\n", j, pins[i][j]);
226 }
227}
228
229__initcall(crisv32_pinmux_init);
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
new file mode 100644
index 000000000000..882be42114f7
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -0,0 +1,270 @@
1/*
2 * Copyright (C) 2000-2003 Axis Communications AB
3 *
4 * Authors: Bjorn Wesen (bjornw@axis.com)
5 * Mikael Starvik (starvik@axis.com)
6 * Tobias Anderberg (tobiasa@axis.com), CRISv32 port.
7 *
8 * This file handles the architecture-dependent parts of process handling..
9 */
10
11#include <linux/config.h>
12#include <linux/sched.h>
13#include <linux/err.h>
14#include <linux/fs.h>
15#include <linux/slab.h>
16#include <asm/arch/hwregs/reg_rdwr.h>
17#include <asm/arch/hwregs/reg_map.h>
18#include <asm/arch/hwregs/timer_defs.h>
19#include <asm/arch/hwregs/intr_vect_defs.h>
20
21extern void stop_watchdog(void);
22
23#ifdef CONFIG_ETRAX_GPIO
24extern void etrax_gpio_wake_up_check(void); /* Defined in drivers/gpio.c. */
25#endif
26
27extern int cris_hlt_counter;
28
29/* We use this if we don't have any better idle routine. */
30void default_idle(void)
31{
32 local_irq_disable();
33 if (!need_resched() && !cris_hlt_counter) {
34 /* Halt until exception. */
35 __asm__ volatile("ei \n\t"
36 "halt ");
37 }
38 local_irq_enable();
39}
40
41/*
42 * Free current thread data structures etc..
43 */
44
45extern void deconfigure_bp(long pid);
46void exit_thread(void)
47{
48 deconfigure_bp(current->pid);
49}
50
51/*
52 * If the watchdog is enabled, disable interrupts and enter an infinite loop.
53 * The watchdog will reset the CPU after 0.1s. If the watchdog isn't enabled
54 * then enable it and wait.
55 */
56extern void arch_enable_nmi(void);
57
58void
59hard_reset_now(void)
60{
61 /*
62 * Don't declare this variable elsewhere. We don't want any other
63 * code to know about it than the watchdog handler in entry.S and
64 * this code, implementing hard reset through the watchdog.
65 */
66#if defined(CONFIG_ETRAX_WATCHDOG)
67 extern int cause_of_death;
68#endif
69
70 printk("*** HARD RESET ***\n");
71 local_irq_disable();
72
73#if defined(CONFIG_ETRAX_WATCHDOG)
74 cause_of_death = 0xbedead;
75#else
76{
77 reg_timer_rw_wd_ctrl wd_ctrl = {0};
78
79 stop_watchdog();
80
81 wd_ctrl.key = 16; /* Arbitrary key. */
82 wd_ctrl.cnt = 1; /* Minimum time. */
83 wd_ctrl.cmd = regk_timer_start;
84
85 arch_enable_nmi();
86 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
87}
88#endif
89
90 while (1)
91 ; /* Wait for reset. */
92}
93
94/*
95 * Return saved PC of a blocked thread.
96 */
97unsigned long thread_saved_pc(struct task_struct *t)
98{
99 return (unsigned long)user_regs(t->thread_info)->erp;
100}
101
102static void
103kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
104{
105 fn(arg);
106 do_exit(-1); /* Should never be called, return bad exit value. */
107}
108
109/* Create a kernel thread. */
110int
111kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
112{
113 struct pt_regs regs;
114
115 memset(&regs, 0, sizeof(regs));
116
117 /* Don't use r10 since that is set to 0 in copy_thread. */
118 regs.r11 = (unsigned long) fn;
119 regs.r12 = (unsigned long) arg;
120 regs.erp = (unsigned long) kernel_thread_helper;
121 regs.ccs = 1 << (I_CCS_BITNR + CCS_SHIFT);
122
123 /* Create the new process. */
124 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
125}
126
127/*
128 * Setup the child's kernel stack with a pt_regs and call switch_stack() on it.
129 * It will be unnested during _resume and _ret_from_sys_call when the new thread
130 * is scheduled.
131 *
132 * Also setup the thread switching structure which is used to keep
133 * thread-specific data during _resumes.
134 */
135
136extern asmlinkage void ret_from_fork(void);
137
138int
139copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
140 unsigned long unused,
141 struct task_struct *p, struct pt_regs *regs)
142{
143 struct pt_regs *childregs;
144 struct switch_stack *swstack;
145
146 /*
147 * Put the pt_regs structure at the end of the new kernel stack page and
148 * fix it up. Note: the task_struct doubles as the kernel stack for the
149 * task.
150 */
151 childregs = user_regs(p->thread_info);
152 *childregs = *regs; /* Struct copy of pt_regs. */
153 p->set_child_tid = p->clear_child_tid = NULL;
154 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */
155
156 /* Set a new TLS ?
157 * The TLS is in $mof beacuse it is the 5th argument to sys_clone.
158 */
159 if (p->mm && (clone_flags & CLONE_SETTLS)) {
160 p->thread_info->tls = regs->mof;
161 }
162
163 /* Put the switch stack right below the pt_regs. */
164 swstack = ((struct switch_stack *) childregs) - 1;
165
166 /* Paramater to ret_from_sys_call. 0 is don't restart the syscall. */
167 swstack->r9 = 0;
168
169 /*
170 * We want to return into ret_from_sys_call after the _resume.
171 * ret_from_fork will call ret_from_sys_call.
172 */
173 swstack->return_ip = (unsigned long) ret_from_fork;
174
175 /* Fix the user-mode and kernel-mode stackpointer. */
176 p->thread.usp = usp;
177 p->thread.ksp = (unsigned long) swstack;
178
179 return 0;
180}
181
182/*
183 * Be aware of the "magic" 7th argument in the four system-calls below.
184 * They need the latest stackframe, which is put as the 7th argument by
185 * entry.S. The previous arguments are dummies or actually used, but need
186 * to be defined to reach the 7th argument.
187 *
188 * N.B.: Another method to get the stackframe is to use current_regs(). But
189 * it returns the latest stack-frame stacked when going from _user mode_ and
190 * some of these (at least sys_clone) are called from kernel-mode sometimes
191 * (for example during kernel_thread, above) and thus cannot use it. Thus,
192 * to be sure not to get any surprises, we use the method for the other calls
193 * as well.
194 */
195asmlinkage int
196sys_fork(long r10, long r11, long r12, long r13, long mof, long srp,
197 struct pt_regs *regs)
198{
199 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
200}
201
202/* FIXME: Is parent_tid/child_tid really third/fourth argument? Update lib? */
203asmlinkage int
204sys_clone(unsigned long newusp, unsigned long flags, int *parent_tid, int *child_tid,
205 unsigned long tls, long srp, struct pt_regs *regs)
206{
207 if (!newusp)
208 newusp = rdusp();
209
210 return do_fork(flags, newusp, regs, 0, parent_tid, child_tid);
211}
212
213/*
214 * vfork is a system call in i386 because of register-pressure - maybe
215 * we can remove it and handle it in libc but we put it here until then.
216 */
217asmlinkage int
218sys_vfork(long r10, long r11, long r12, long r13, long mof, long srp,
219 struct pt_regs *regs)
220{
221 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
222}
223
224/* sys_execve() executes a new program. */
225asmlinkage int
226sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp,
227 struct pt_regs *regs)
228{
229 int error;
230 char *filename;
231
232 filename = getname(fname);
233 error = PTR_ERR(filename);
234
235 if (IS_ERR(filename))
236 goto out;
237
238 error = do_execve(filename, argv, envp, regs);
239 putname(filename);
240 out:
241 return error;
242}
243
244unsigned long
245get_wchan(struct task_struct *p)
246{
247 /* TODO */
248 return 0;
249}
250#undef last_sched
251#undef first_sched
252
253void show_regs(struct pt_regs * regs)
254{
255 unsigned long usp = rdusp();
256 printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n",
257 regs->erp, regs->srp, regs->ccs, usp, regs->mof);
258
259 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
260 regs->r0, regs->r1, regs->r2, regs->r3);
261
262 printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
263 regs->r4, regs->r5, regs->r6, regs->r7);
264
265 printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
266 regs->r8, regs->r9, regs->r10, regs->r11);
267
268 printk("r12: %08lx r13: %08lx oR10: %08lx\n",
269 regs->r12, regs->r13, regs->orig_r10);
270}
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
new file mode 100644
index 000000000000..208489da2a87
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -0,0 +1,597 @@
1/*
2 * Copyright (C) 2000-2003, Axis Communications AB.
3 */
4
5#include <linux/kernel.h>
6#include <linux/sched.h>
7#include <linux/mm.h>
8#include <linux/smp.h>
9#include <linux/smp_lock.h>
10#include <linux/errno.h>
11#include <linux/ptrace.h>
12#include <linux/user.h>
13#include <linux/signal.h>
14#include <linux/security.h>
15
16#include <asm/uaccess.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/system.h>
20#include <asm/processor.h>
21#include <asm/arch/hwregs/supp_reg.h>
22
23/*
24 * Determines which bits in CCS the user has access to.
25 * 1 = access, 0 = no access.
26 */
27#define CCS_MASK 0x00087c00 /* SXNZVC */
28
29#define SBIT_USER (1 << (S_CCS_BITNR + CCS_SHIFT))
30
31static int put_debugreg(long pid, unsigned int regno, long data);
32static long get_debugreg(long pid, unsigned int regno);
33static unsigned long get_pseudo_pc(struct task_struct *child);
34void deconfigure_bp(long pid);
35
36extern unsigned long cris_signal_return_page;
37
38/*
39 * Get contents of register REGNO in task TASK.
40 */
41long get_reg(struct task_struct *task, unsigned int regno)
42{
43 /* USP is a special case, it's not in the pt_regs struct but
44 * in the tasks thread struct
45 */
46 unsigned long ret;
47
48 if (regno <= PT_EDA)
49 ret = ((unsigned long *)user_regs(task->thread_info))[regno];
50 else if (regno == PT_USP)
51 ret = task->thread.usp;
52 else if (regno == PT_PPC)
53 ret = get_pseudo_pc(task);
54 else if (regno <= PT_MAX)
55 ret = get_debugreg(task->pid, regno);
56 else
57 ret = 0;
58
59 return ret;
60}
61
62/*
63 * Write contents of register REGNO in task TASK.
64 */
65int put_reg(struct task_struct *task, unsigned int regno, unsigned long data)
66{
67 if (regno <= PT_EDA)
68 ((unsigned long *)user_regs(task->thread_info))[regno] = data;
69 else if (regno == PT_USP)
70 task->thread.usp = data;
71 else if (regno == PT_PPC) {
72 /* Write pseudo-PC to ERP only if changed. */
73 if (data != get_pseudo_pc(task))
74 ((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data;
75 } else if (regno <= PT_MAX)
76 return put_debugreg(task->pid, regno, data);
77 else
78 return -1;
79 return 0;
80}
81
82/*
83 * Called by kernel/ptrace.c when detaching.
84 *
85 * Make sure the single step bit is not set.
86 */
87void
88ptrace_disable(struct task_struct *child)
89{
90 unsigned long tmp;
91
92 /* Deconfigure SPC and S-bit. */
93 tmp = get_reg(child, PT_CCS) & ~SBIT_USER;
94 put_reg(child, PT_CCS, tmp);
95 put_reg(child, PT_SPC, 0);
96
97 /* Deconfigure any watchpoints associated with the child. */
98 deconfigure_bp(child->pid);
99}
100
101
102asmlinkage int
103sys_ptrace(long request, long pid, long addr, long data)
104{
105 struct task_struct *child;
106 int ret;
107 unsigned long __user *datap = (unsigned long __user *)data;
108
109 lock_kernel();
110 ret = -EPERM;
111
112 if (request == PTRACE_TRACEME) {
113 /* are we already being traced? */
114 if (current->ptrace & PT_PTRACED)
115 goto out;
116 ret = security_ptrace(current->parent, current);
117 if (ret)
118 goto out;
119 /* set the ptrace bit in the process flags. */
120 current->ptrace |= PT_PTRACED;
121 ret = 0;
122 goto out;
123 }
124
125 ret = -ESRCH;
126 read_lock(&tasklist_lock);
127 child = find_task_by_pid(pid);
128
129 if (child)
130 get_task_struct(child);
131
132 read_unlock(&tasklist_lock);
133
134 if (!child)
135 goto out;
136
137 ret = -EPERM;
138
139 if (pid == 1) /* Leave the init process alone! */
140 goto out_tsk;
141
142 if (request == PTRACE_ATTACH) {
143 ret = ptrace_attach(child);
144 goto out_tsk;
145 }
146
147 ret = ptrace_check_attach(child, request == PTRACE_KILL);
148 if (ret < 0)
149 goto out_tsk;
150
151 switch (request) {
152 /* Read word at location address. */
153 case PTRACE_PEEKTEXT:
154 case PTRACE_PEEKDATA: {
155 unsigned long tmp;
156 int copied;
157
158 ret = -EIO;
159
160 /* The signal trampoline page is outside the normal user-addressable
161 * space but still accessible. This is hack to make it possible to
162 * access the signal handler code in GDB.
163 */
164 if ((addr & PAGE_MASK) == cris_signal_return_page) {
165 /* The trampoline page is globally mapped, no page table to traverse.*/
166 tmp = *(unsigned long*)addr;
167 } else {
168 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
169
170 if (copied != sizeof(tmp))
171 break;
172 }
173
174 ret = put_user(tmp,datap);
175 break;
176 }
177
178 /* Read the word at location address in the USER area. */
179 case PTRACE_PEEKUSR: {
180 unsigned long tmp;
181
182 ret = -EIO;
183 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
184 break;
185
186 tmp = get_reg(child, addr >> 2);
187 ret = put_user(tmp, datap);
188 break;
189 }
190
191 /* Write the word at location address. */
192 case PTRACE_POKETEXT:
193 case PTRACE_POKEDATA:
194 ret = 0;
195
196 if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data))
197 break;
198
199 ret = -EIO;
200 break;
201
202 /* Write the word at location address in the USER area. */
203 case PTRACE_POKEUSR:
204 ret = -EIO;
205 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
206 break;
207
208 addr >>= 2;
209
210 if (addr == PT_CCS) {
211 /* don't allow the tracing process to change stuff like
212 * interrupt enable, kernel/user bit, dma enables etc.
213 */
214 data &= CCS_MASK;
215 data |= get_reg(child, PT_CCS) & ~CCS_MASK;
216 }
217 if (put_reg(child, addr, data))
218 break;
219 ret = 0;
220 break;
221
222 case PTRACE_SYSCALL:
223 case PTRACE_CONT:
224 ret = -EIO;
225
226 if (!valid_signal(data))
227 break;
228
229 /* Continue means no single-step. */
230 put_reg(child, PT_SPC, 0);
231
232 if (!get_debugreg(child->pid, PT_BP_CTRL)) {
233 unsigned long tmp;
234 /* If no h/w bp configured, disable S bit. */
235 tmp = get_reg(child, PT_CCS) & ~SBIT_USER;
236 put_reg(child, PT_CCS, tmp);
237 }
238
239 if (request == PTRACE_SYSCALL) {
240 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
241 }
242 else {
243 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
244 }
245
246 child->exit_code = data;
247
248 /* TODO: make sure any pending breakpoint is killed */
249 wake_up_process(child);
250 ret = 0;
251
252 break;
253
254 /* Make the child exit by sending it a sigkill. */
255 case PTRACE_KILL:
256 ret = 0;
257
258 if (child->exit_state == EXIT_ZOMBIE)
259 break;
260
261 child->exit_code = SIGKILL;
262
263 /* Deconfigure single-step and h/w bp. */
264 ptrace_disable(child);
265
266 /* TODO: make sure any pending breakpoint is killed */
267 wake_up_process(child);
268 break;
269
270 /* Set the trap flag. */
271 case PTRACE_SINGLESTEP: {
272 unsigned long tmp;
273 ret = -EIO;
274
275 /* Set up SPC if not set already (in which case we have
276 no other choice but to trust it). */
277 if (!get_reg(child, PT_SPC)) {
278 /* In case we're stopped in a delay slot. */
279 tmp = get_reg(child, PT_ERP) & ~1;
280 put_reg(child, PT_SPC, tmp);
281 }
282 tmp = get_reg(child, PT_CCS) | SBIT_USER;
283 put_reg(child, PT_CCS, tmp);
284
285 if (!valid_signal(data))
286 break;
287
288 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
289
290 /* TODO: set some clever breakpoint mechanism... */
291
292 child->exit_code = data;
293 wake_up_process(child);
294 ret = 0;
295 break;
296
297 }
298 case PTRACE_DETACH:
299 ret = ptrace_detach(child, data);
300 break;
301
302 /* Get all GP registers from the child. */
303 case PTRACE_GETREGS: {
304 int i;
305 unsigned long tmp;
306
307 for (i = 0; i <= PT_MAX; i++) {
308 tmp = get_reg(child, i);
309
310 if (put_user(tmp, datap)) {
311 ret = -EFAULT;
312 goto out_tsk;
313 }
314
315 datap++;
316 }
317
318 ret = 0;
319 break;
320 }
321
322 /* Set all GP registers in the child. */
323 case PTRACE_SETREGS: {
324 int i;
325 unsigned long tmp;
326
327 for (i = 0; i <= PT_MAX; i++) {
328 if (get_user(tmp, datap)) {
329 ret = -EFAULT;
330 goto out_tsk;
331 }
332
333 if (i == PT_CCS) {
334 tmp &= CCS_MASK;
335 tmp |= get_reg(child, PT_CCS) & ~CCS_MASK;
336 }
337
338 put_reg(child, i, tmp);
339 datap++;
340 }
341
342 ret = 0;
343 break;
344 }
345
346 default:
347 ret = ptrace_request(child, request, addr, data);
348 break;
349 }
350out_tsk:
351 put_task_struct(child);
352out:
353 unlock_kernel();
354 return ret;
355}
356
357void do_syscall_trace(void)
358{
359 if (!test_thread_flag(TIF_SYSCALL_TRACE))
360 return;
361
362 if (!(current->ptrace & PT_PTRACED))
363 return;
364
365 /* the 0x80 provides a way for the tracing parent to distinguish
366 between a syscall stop and SIGTRAP delivery */
367 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
368 ? 0x80 : 0));
369
370 /*
371 * This isn't the same as continuing with a signal, but it will do for
372 * normal use.
373 */
374 if (current->exit_code) {
375 send_sig(current->exit_code, current, 1);
376 current->exit_code = 0;
377 }
378}
379
380/* Returns the size of an instruction that has a delay slot. */
381
382static int insn_size(struct task_struct *child, unsigned long pc)
383{
384 unsigned long opcode;
385 int copied;
386 int opsize = 0;
387
388 /* Read the opcode at pc (do what PTRACE_PEEKTEXT would do). */
389 copied = access_process_vm(child, pc, &opcode, sizeof(opcode), 0);
390 if (copied != sizeof(opcode))
391 return 0;
392
393 switch ((opcode & 0x0f00) >> 8) {
394 case 0x0:
395 case 0x9:
396 case 0xb:
397 opsize = 2;
398 break;
399 case 0xe:
400 case 0xf:
401 opsize = 6;
402 break;
403 case 0xd:
404 /* Could be 4 or 6; check more bits. */
405 if ((opcode & 0xff) == 0xff)
406 opsize = 4;
407 else
408 opsize = 6;
409 break;
410 default:
411 panic("ERROR: Couldn't find size of opcode 0x%lx at 0x%lx\n",
412 opcode, pc);
413 }
414
415 return opsize;
416}
417
418static unsigned long get_pseudo_pc(struct task_struct *child)
419{
420 /* Default value for PC is ERP. */
421 unsigned long pc = get_reg(child, PT_ERP);
422
423 if (pc & 0x1) {
424 unsigned long spc = get_reg(child, PT_SPC);
425 /* Delay slot bit set. Report as stopped on proper
426 instruction. */
427 if (spc) {
428 /* Rely on SPC if set. FIXME: We might want to check
429 that EXS indicates we stopped due to a single-step
430 exception. */
431 pc = spc;
432 } else {
433 /* Calculate the PC from the size of the instruction
434 that the delay slot we're in belongs to. */
435 pc += insn_size(child, pc & ~1) - 1;
436 }
437 }
438 return pc;
439}
440
441static long bp_owner = 0;
442
443/* Reachable from exit_thread in signal.c, so not static. */
444void deconfigure_bp(long pid)
445{
446 int bp;
447
448 /* Only deconfigure if the pid is the owner. */
449 if (bp_owner != pid)
450 return;
451
452 for (bp = 0; bp < 6; bp++) {
453 unsigned long tmp;
454 /* Deconfigure start and end address (also gets rid of ownership). */
455 put_debugreg(pid, PT_BP + 3 + (bp * 2), 0);
456 put_debugreg(pid, PT_BP + 4 + (bp * 2), 0);
457
458 /* Deconfigure relevant bits in control register. */
459 tmp = get_debugreg(pid, PT_BP_CTRL) & ~(3 << (2 + (bp * 4)));
460 put_debugreg(pid, PT_BP_CTRL, tmp);
461 }
462 /* No owner now. */
463 bp_owner = 0;
464}
465
466static int put_debugreg(long pid, unsigned int regno, long data)
467{
468 int ret = 0;
469 register int old_srs;
470
471#ifdef CONFIG_ETRAX_KGDB
472 /* Ignore write, but pretend it was ok if value is 0
473 (we don't want POKEUSR/SETREGS failing unnessecarily). */
474 return (data == 0) ? ret : -1;
475#endif
476
477 /* Simple owner management. */
478 if (!bp_owner)
479 bp_owner = pid;
480 else if (bp_owner != pid) {
481 /* Ignore write, but pretend it was ok if value is 0
482 (we don't want POKEUSR/SETREGS failing unnessecarily). */
483 return (data == 0) ? ret : -1;
484 }
485
486 /* Remember old SRS. */
487 SPEC_REG_RD(SPEC_REG_SRS, old_srs);
488 /* Switch to BP bank. */
489 SUPP_BANK_SEL(BANK_BP);
490
491 switch (regno - PT_BP) {
492 case 0:
493 SUPP_REG_WR(0, data); break;
494 case 1:
495 case 2:
496 if (data)
497 ret = -1;
498 break;
499 case 3:
500 SUPP_REG_WR(3, data); break;
501 case 4:
502 SUPP_REG_WR(4, data); break;
503 case 5:
504 SUPP_REG_WR(5, data); break;
505 case 6:
506 SUPP_REG_WR(6, data); break;
507 case 7:
508 SUPP_REG_WR(7, data); break;
509 case 8:
510 SUPP_REG_WR(8, data); break;
511 case 9:
512 SUPP_REG_WR(9, data); break;
513 case 10:
514 SUPP_REG_WR(10, data); break;
515 case 11:
516 SUPP_REG_WR(11, data); break;
517 case 12:
518 SUPP_REG_WR(12, data); break;
519 case 13:
520 SUPP_REG_WR(13, data); break;
521 case 14:
522 SUPP_REG_WR(14, data); break;
523 default:
524 ret = -1;
525 break;
526 }
527
528 /* Restore SRS. */
529 SPEC_REG_WR(SPEC_REG_SRS, old_srs);
530 /* Just for show. */
531 NOP();
532 NOP();
533 NOP();
534
535 return ret;
536}
537
538static long get_debugreg(long pid, unsigned int regno)
539{
540 register int old_srs;
541 register long data;
542
543 if (pid != bp_owner) {
544 return 0;
545 }
546
547 /* Remember old SRS. */
548 SPEC_REG_RD(SPEC_REG_SRS, old_srs);
549 /* Switch to BP bank. */
550 SUPP_BANK_SEL(BANK_BP);
551
552 switch (regno - PT_BP) {
553 case 0:
554 SUPP_REG_RD(0, data); break;
555 case 1:
556 case 2:
557 /* error return value? */
558 data = 0;
559 break;
560 case 3:
561 SUPP_REG_RD(3, data); break;
562 case 4:
563 SUPP_REG_RD(4, data); break;
564 case 5:
565 SUPP_REG_RD(5, data); break;
566 case 6:
567 SUPP_REG_RD(6, data); break;
568 case 7:
569 SUPP_REG_RD(7, data); break;
570 case 8:
571 SUPP_REG_RD(8, data); break;
572 case 9:
573 SUPP_REG_RD(9, data); break;
574 case 10:
575 SUPP_REG_RD(10, data); break;
576 case 11:
577 SUPP_REG_RD(11, data); break;
578 case 12:
579 SUPP_REG_RD(12, data); break;
580 case 13:
581 SUPP_REG_RD(13, data); break;
582 case 14:
583 SUPP_REG_RD(14, data); break;
584 default:
585 /* error return value? */
586 data = 0;
587 }
588
589 /* Restore SRS. */
590 SPEC_REG_WR(SPEC_REG_SRS, old_srs);
591 /* Just for show. */
592 NOP();
593 NOP();
594 NOP();
595
596 return data;
597}
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
new file mode 100644
index 000000000000..b17a39a2e164
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -0,0 +1,118 @@
1/*
2 * Display CPU info in /proc/cpuinfo.
3 *
4 * Copyright (C) 2003, Axis Communications AB.
5 */
6
7#include <linux/config.h>
8#include <linux/seq_file.h>
9#include <linux/proc_fs.h>
10#include <linux/delay.h>
11#include <linux/param.h>
12
13#ifdef CONFIG_PROC_FS
14
15#define HAS_FPU 0x0001
16#define HAS_MMU 0x0002
17#define HAS_ETHERNET100 0x0004
18#define HAS_TOKENRING 0x0008
19#define HAS_SCSI 0x0010
20#define HAS_ATA 0x0020
21#define HAS_USB 0x0040
22#define HAS_IRQ_BUG 0x0080
23#define HAS_MMU_BUG 0x0100
24
25struct cpu_info {
26 char *cpu_model;
27 unsigned short rev;
28 unsigned short cache_size;
29 unsigned short flags;
30};
31
32/* Some of these model are here for historical reasons only. */
33static struct cpu_info cpinfo[] = {
34 {"ETRAX 1", 0, 0, 0},
35 {"ETRAX 2", 1, 0, 0},
36 {"ETRAX 3", 2, 0, 0},
37 {"ETRAX 4", 3, 0, 0},
38 {"Simulator", 7, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
39 {"ETRAX 100", 8, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_IRQ_BUG},
40 {"ETRAX 100", 9, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
41
42 {"ETRAX 100LX", 10, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
43 | HAS_MMU | HAS_MMU_BUG},
44
45 {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
46 | HAS_MMU},
47
48 {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU},
49
50 {"Unknown", 0, 0, 0}
51};
52
53int
54show_cpuinfo(struct seq_file *m, void *v)
55{
56 int i;
57 int cpu = (int)v - 1;
58 int entries;
59 unsigned long revision;
60 struct cpu_info *info;
61
62 entries = sizeof cpinfo / sizeof(struct cpu_info);
63 info = &cpinfo[entries - 1];
64
65#ifdef CONFIG_SMP
66 if (!cpu_online(cpu))
67 return 0;
68#endif
69
70 revision = rdvr();
71
72 for (i = 0; i < entries; i++) {
73 if (cpinfo[i].rev == revision) {
74 info = &cpinfo[i];
75 break;
76 }
77 }
78
79 return seq_printf(m,
80 "processor\t: %d\n"
81 "cpu\t\t: CRIS\n"
82 "cpu revision\t: %lu\n"
83 "cpu model\t: %s\n"
84 "cache size\t: %d KB\n"
85 "fpu\t\t: %s\n"
86 "mmu\t\t: %s\n"
87 "mmu DMA bug\t: %s\n"
88 "ethernet\t: %s Mbps\n"
89 "token ring\t: %s\n"
90 "scsi\t\t: %s\n"
91 "ata\t\t: %s\n"
92 "usb\t\t: %s\n"
93 "bogomips\t: %lu.%02lu\n\n",
94
95 cpu,
96 revision,
97 info->cpu_model,
98 info->cache_size,
99 info->flags & HAS_FPU ? "yes" : "no",
100 info->flags & HAS_MMU ? "yes" : "no",
101 info->flags & HAS_MMU_BUG ? "yes" : "no",
102 info->flags & HAS_ETHERNET100 ? "10/100" : "10",
103 info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
104 info->flags & HAS_SCSI ? "yes" : "no",
105 info->flags & HAS_ATA ? "yes" : "no",
106 info->flags & HAS_USB ? "yes" : "no",
107 (loops_per_jiffy * HZ + 500) / 500000,
108 ((loops_per_jiffy * HZ + 500) / 5000) % 100);
109}
110
111#endif /* CONFIG_PROC_FS */
112
113void
114show_etrax_copyright(void)
115{
116 printk(KERN_INFO
117 "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n");
118}
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
new file mode 100644
index 000000000000..fb4c79d5b76b
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -0,0 +1,708 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/sched.h>
6#include <linux/mm.h>
7#include <linux/kernel.h>
8#include <linux/signal.h>
9#include <linux/errno.h>
10#include <linux/wait.h>
11#include <linux/ptrace.h>
12#include <linux/unistd.h>
13#include <linux/stddef.h>
14#include <linux/syscalls.h>
15#include <linux/vmalloc.h>
16
17#include <asm/io.h>
18#include <asm/processor.h>
19#include <asm/ucontext.h>
20#include <asm/uaccess.h>
21#include <asm/arch/ptrace.h>
22#include <asm/arch/hwregs/cpu_vect.h>
23
24extern unsigned long cris_signal_return_page;
25
26/* Flag to check if a signal is blockable. */
27#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
28
29/*
30 * A syscall in CRIS is really a "break 13" instruction, which is 2
31 * bytes. The registers is manipulated so upon return the instruction
32 * will be executed again.
33 *
34 * This relies on that PC points to the instruction after the break call.
35 */
36#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->erp -= 2;
37
38/* Signal frames. */
39struct signal_frame {
40 struct sigcontext sc;
41 unsigned long extramask[_NSIG_WORDS - 1];
42 unsigned char retcode[8]; /* Trampoline code. */
43};
44
45struct rt_signal_frame {
46 struct siginfo *pinfo;
47 void *puc;
48 struct siginfo info;
49 struct ucontext uc;
50 unsigned char retcode[8]; /* Trampoline code. */
51};
52
53int do_signal(int restart, sigset_t *oldset, struct pt_regs *regs);
54void keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
55 struct pt_regs *regs);
56/*
57 * Swap in the new signal mask, and wait for a signal. Define some
58 * dummy arguments to be able to reach the regs argument.
59 */
60int
61sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
62 long srp, struct pt_regs *regs)
63{
64 sigset_t saveset;
65
66 mask &= _BLOCKABLE;
67
68 spin_lock_irq(&current->sighand->siglock);
69
70 saveset = current->blocked;
71
72 siginitset(&current->blocked, mask);
73
74 recalc_sigpending();
75 spin_unlock_irq(&current->sighand->siglock);
76
77 regs->r10 = -EINTR;
78
79 while (1) {
80 current->state = TASK_INTERRUPTIBLE;
81 schedule();
82
83 if (do_signal(0, &saveset, regs)) {
84 /*
85 * This point is reached twice: once to call
86 * the signal handler, then again to return
87 * from the sigsuspend system call. When
88 * calling the signal handler, R10 hold the
89 * signal number as set by do_signal(). The
90 * sigsuspend call will always return with
91 * the restored value above; -EINTR.
92 */
93 return regs->r10;
94 }
95 }
96}
97
98/* Define some dummy arguments to be able to reach the regs argument. */
99int
100sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, long r12, long r13,
101 long mof, long srp, struct pt_regs *regs)
102{
103 sigset_t saveset;
104 sigset_t newset;
105
106 if (sigsetsize != sizeof(sigset_t))
107 return -EINVAL;
108
109 if (copy_from_user(&newset, unewset, sizeof(newset)))
110 return -EFAULT;
111
112 sigdelsetmask(&newset, ~_BLOCKABLE);
113 spin_lock_irq(&current->sighand->siglock);
114
115 saveset = current->blocked;
116 current->blocked = newset;
117
118 recalc_sigpending();
119 spin_unlock_irq(&current->sighand->siglock);
120
121 regs->r10 = -EINTR;
122
123 while (1) {
124 current->state = TASK_INTERRUPTIBLE;
125 schedule();
126
127 if (do_signal(0, &saveset, regs)) {
128 /* See comment in function above. */
129 return regs->r10;
130 }
131 }
132}
133
134int
135sys_sigaction(int signal, const struct old_sigaction *act,
136 struct old_sigaction *oact)
137{
138 int retval;
139 struct k_sigaction newk;
140 struct k_sigaction oldk;
141
142 if (act) {
143 old_sigset_t mask;
144
145 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
146 __get_user(newk.sa.sa_handler, &act->sa_handler) ||
147 __get_user(newk.sa.sa_restorer, &act->sa_restorer))
148 return -EFAULT;
149
150 __get_user(newk.sa.sa_flags, &act->sa_flags);
151 __get_user(mask, &act->sa_mask);
152 siginitset(&newk.sa.sa_mask, mask);
153 }
154
155 retval = do_sigaction(signal, act ? &newk : NULL, oact ? &oldk : NULL);
156
157 if (!retval && oact) {
158 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
159 __put_user(oldk.sa.sa_handler, &oact->sa_handler) ||
160 __put_user(oldk.sa.sa_restorer, &oact->sa_restorer))
161 return -EFAULT;
162
163 __put_user(oldk.sa.sa_flags, &oact->sa_flags);
164 __put_user(oldk.sa.sa_mask.sig[0], &oact->sa_mask);
165 }
166
167 return retval;
168}
169
170int
171sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
172{
173 return do_sigaltstack(uss, uoss, rdusp());
174}
175
176static int
177restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
178{
179 unsigned int err = 0;
180 unsigned long old_usp;
181
182 /* Always make any pending restarted system calls return -EINTR */
183 current_thread_info()->restart_block.fn = do_no_restart_syscall;
184
185 /*
186 * Restore the registers from &sc->regs. sc is already checked
187 * for VERIFY_READ since the signal_frame was previously
188 * checked in sys_sigreturn().
189 */
190 if (__copy_from_user(regs, sc, sizeof(struct pt_regs)))
191 goto badframe;
192
193 /* Make that the user-mode flag is set. */
194 regs->ccs |= (1 << (U_CCS_BITNR + CCS_SHIFT));
195
196 /* Restore the old USP. */
197 err |= __get_user(old_usp, &sc->usp);
198 wrusp(old_usp);
199
200 return err;
201
202badframe:
203 return 1;
204}
205
206/* Define some dummy arguments to be able to reach the regs argument. */
207asmlinkage int
208sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
209 struct pt_regs *regs)
210{
211 sigset_t set;
212 struct signal_frame __user *frame;
213 unsigned long oldspc = regs->spc;
214 unsigned long oldccs = regs->ccs;
215
216 frame = (struct signal_frame *) rdusp();
217
218 /*
219 * Since the signal is stacked on a dword boundary, the frame
220 * should be dword aligned here as well. It it's not, then the
221 * user is trying some funny business.
222 */
223 if (((long)frame) & 3)
224 goto badframe;
225
226 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
227 goto badframe;
228
229 if (__get_user(set.sig[0], &frame->sc.oldmask) ||
230 (_NSIG_WORDS > 1 && __copy_from_user(&set.sig[1],
231 frame->extramask,
232 sizeof(frame->extramask))))
233 goto badframe;
234
235 sigdelsetmask(&set, ~_BLOCKABLE);
236 spin_lock_irq(&current->sighand->siglock);
237
238 current->blocked = set;
239
240 recalc_sigpending();
241 spin_unlock_irq(&current->sighand->siglock);
242
243 if (restore_sigcontext(regs, &frame->sc))
244 goto badframe;
245
246 keep_debug_flags(oldccs, oldspc, regs);
247
248 return regs->r10;
249
250badframe:
251 force_sig(SIGSEGV, current);
252 return 0;
253}
254
255/* Define some dummy variables to be able to reach the regs argument. */
256asmlinkage int
257sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
258 struct pt_regs *regs)
259{
260 sigset_t set;
261 struct rt_signal_frame __user *frame;
262 unsigned long oldspc = regs->spc;
263 unsigned long oldccs = regs->ccs;
264
265 frame = (struct rt_signal_frame *) rdusp();
266
267 /*
268 * Since the signal is stacked on a dword boundary, the frame
269 * should be dword aligned here as well. It it's not, then the
270 * user is trying some funny business.
271 */
272 if (((long)frame) & 3)
273 goto badframe;
274
275 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
276 goto badframe;
277
278 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
279 goto badframe;
280
281 sigdelsetmask(&set, ~_BLOCKABLE);
282 spin_lock_irq(&current->sighand->siglock);
283
284 current->blocked = set;
285
286 recalc_sigpending();
287 spin_unlock_irq(&current->sighand->siglock);
288
289 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
290 goto badframe;
291
292 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT)
293 goto badframe;
294
295 keep_debug_flags(oldccs, oldspc, regs);
296
297 return regs->r10;
298
299badframe:
300 force_sig(SIGSEGV, current);
301 return 0;
302}
303
304/* Setup a signal frame. */
305static int
306setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
307 unsigned long mask)
308{
309 int err;
310 unsigned long usp;
311
312 err = 0;
313 usp = rdusp();
314
315 /*
316 * Copy the registers. They are located first in sc, so it's
317 * possible to use sc directly.
318 */
319 err |= __copy_to_user(sc, regs, sizeof(struct pt_regs));
320
321 err |= __put_user(mask, &sc->oldmask);
322 err |= __put_user(usp, &sc->usp);
323
324 return err;
325}
326
327/* Figure out where to put the new signal frame - usually on the stack. */
328static inline void __user *
329get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
330{
331 unsigned long sp;
332
333 sp = rdusp();
334
335 /* This is the X/Open sanctioned signal stack switching. */
336 if (ka->sa.sa_flags & SA_ONSTACK) {
337 if (!on_sig_stack(sp))
338 sp = current->sas_ss_sp + current->sas_ss_size;
339 }
340
341 /* Make sure the frame is dword-aligned. */
342 sp &= ~3;
343
344 return (void __user *)(sp - frame_size);
345}
346
347/* Grab and setup a signal frame.
348 *
349 * Basically a lot of state-info is stacked, and arranged for the
350 * user-mode program to return to the kernel using either a trampiline
351 * which performs the syscall sigreturn(), or a provided user-mode
352 * trampoline.
353 */
354static void
355setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
356 struct pt_regs * regs)
357{
358 int err;
359 unsigned long return_ip;
360 struct signal_frame __user *frame;
361
362 err = 0;
363 frame = get_sigframe(ka, regs, sizeof(*frame));
364
365 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
366 goto give_sigsegv;
367
368 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
369
370 if (err)
371 goto give_sigsegv;
372
373 if (_NSIG_WORDS > 1) {
374 err |= __copy_to_user(frame->extramask, &set->sig[1],
375 sizeof(frame->extramask));
376 }
377
378 if (err)
379 goto give_sigsegv;
380
381 /*
382 * Set up to return from user-space. If provided, use a stub
383 * already located in user-space.
384 */
385 if (ka->sa.sa_flags & SA_RESTORER) {
386 return_ip = (unsigned long)ka->sa.sa_restorer;
387 } else {
388 /* Trampoline - the desired return ip is in the signal return page. */
389 return_ip = cris_signal_return_page;
390
391 /*
392 * This is movu.w __NR_sigreturn, r9; break 13;
393 *
394 * WE DO NOT USE IT ANY MORE! It's only left here for historical
395 * reasons and because gdb uses it as a signature to notice
396 * signal handler stack frames.
397 */
398 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
399 err |= __put_user(__NR_sigreturn, (short __user*)(frame->retcode+2));
400 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
401 }
402
403 if (err)
404 goto give_sigsegv;
405
406 /*
407 * Set up registers for signal handler.
408 *
409 * Where the code enters now.
410 * Where the code enter later.
411 * First argument, signo.
412 */
413 regs->erp = (unsigned long) ka->sa.sa_handler;
414 regs->srp = return_ip;
415 regs->r10 = sig;
416
417 /* Actually move the USP to reflect the stacked frame. */
418 wrusp((unsigned long)frame);
419
420 return;
421
422give_sigsegv:
423 if (sig == SIGSEGV)
424 ka->sa.sa_handler = SIG_DFL;
425
426 force_sig(SIGSEGV, current);
427}
428
429static void
430setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
431 sigset_t *set, struct pt_regs * regs)
432{
433 int err;
434 unsigned long return_ip;
435 struct rt_signal_frame __user *frame;
436
437 err = 0;
438 frame = get_sigframe(ka, regs, sizeof(*frame));
439
440 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
441 goto give_sigsegv;
442
443 /* TODO: what is the current->exec_domain stuff and invmap ? */
444
445 err |= __put_user(&frame->info, &frame->pinfo);
446 err |= __put_user(&frame->uc, &frame->puc);
447 err |= copy_siginfo_to_user(&frame->info, info);
448
449 if (err)
450 goto give_sigsegv;
451
452 /* Clear all the bits of the ucontext we don't use. */
453 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
454 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
455 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
456
457 if (err)
458 goto give_sigsegv;
459
460 /*
461 * Set up to return from user-space. If provided, use a stub
462 * already located in user-space.
463 */
464 if (ka->sa.sa_flags & SA_RESTORER) {
465 return_ip = (unsigned long) ka->sa.sa_restorer;
466 } else {
467 /* Trampoline - the desired return ip is in the signal return page. */
468 return_ip = cris_signal_return_page + 6;
469
470 /*
471 * This is movu.w __NR_rt_sigreturn, r9; break 13;
472 *
473 * WE DO NOT USE IT ANY MORE! It's only left here for historical
474 * reasons and because gdb uses it as a signature to notice
475 * signal handler stack frames.
476 */
477 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
478
479 err |= __put_user(__NR_rt_sigreturn,
480 (short __user*)(frame->retcode+2));
481
482 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
483 }
484
485 if (err)
486 goto give_sigsegv;
487
488 /*
489 * Set up registers for signal handler.
490 *
491 * Where the code enters now.
492 * Where the code enters later.
493 * First argument is signo.
494 * Second argument is (siginfo_t *).
495 * Third argument is unused.
496 */
497 regs->erp = (unsigned long) ka->sa.sa_handler;
498 regs->srp = return_ip;
499 regs->r10 = sig;
500 regs->r11 = (unsigned long) &frame->info;
501 regs->r12 = 0;
502
503 /* Actually move the usp to reflect the stacked frame. */
504 wrusp((unsigned long)frame);
505
506 return;
507
508give_sigsegv:
509 if (sig == SIGSEGV)
510 ka->sa.sa_handler = SIG_DFL;
511
512 force_sig(SIGSEGV, current);
513}
514
515/* Invoke a singal handler to, well, handle the signal. */
516extern inline void
517handle_signal(int canrestart, unsigned long sig,
518 siginfo_t *info, struct k_sigaction *ka,
519 sigset_t *oldset, struct pt_regs * regs)
520{
521 /* Check if this got called from a system call. */
522 if (canrestart) {
523 /* If so, check system call restarting. */
524 switch (regs->r10) {
525 case -ERESTART_RESTARTBLOCK:
526 case -ERESTARTNOHAND:
527 /*
528 * This means that the syscall should
529 * only be restarted if there was no
530 * handler for the signal, and since
531 * this point isn't reached unless
532 * there is a handler, there's no need
533 * to restart.
534 */
535 regs->r10 = -EINTR;
536 break;
537
538 case -ERESTARTSYS:
539 /*
540 * This means restart the syscall if
541 * there is no handler, or the handler
542 * was registered with SA_RESTART.
543 */
544 if (!(ka->sa.sa_flags & SA_RESTART)) {
545 regs->r10 = -EINTR;
546 break;
547 }
548
549 /* Fall through. */
550
551 case -ERESTARTNOINTR:
552 /*
553 * This means that the syscall should
554 * be called again after the signal
555 * handler returns.
556 */
557 RESTART_CRIS_SYS(regs);
558 break;
559 }
560 }
561
562 /* Set up the stack frame. */
563 if (ka->sa.sa_flags & SA_SIGINFO)
564 setup_rt_frame(sig, ka, info, oldset, regs);
565 else
566 setup_frame(sig, ka, oldset, regs);
567
568 if (ka->sa.sa_flags & SA_ONESHOT)
569 ka->sa.sa_handler = SIG_DFL;
570
571 if (!(ka->sa.sa_flags & SA_NODEFER)) {
572 spin_lock_irq(&current->sighand->siglock);
573 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
574 sigaddset(&current->blocked,sig);
575 recalc_sigpending();
576 spin_unlock_irq(&current->sighand->siglock);
577 }
578}
579
580/*
581 * Note that 'init' is a special process: it doesn't get signals it doesn't
582 * want to handle. Thus you cannot kill init even with a SIGKILL even by
583 * mistake.
584 *
585 * Also note that the regs structure given here as an argument, is the latest
586 * pushed pt_regs. It may or may not be the same as the first pushed registers
587 * when the initial usermode->kernelmode transition took place. Therefore
588 * we can use user_mode(regs) to see if we came directly from kernel or user
589 * mode below.
590 */
591int
592do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
593{
594 int signr;
595 siginfo_t info;
596 struct k_sigaction ka;
597
598 /*
599 * The common case should go fast, which is why this point is
600 * reached from kernel-mode. If that's the case, just return
601 * without doing anything.
602 */
603 if (!user_mode(regs))
604 return 1;
605
606 if (!oldset)
607 oldset = &current->blocked;
608
609 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
610
611 if (signr > 0) {
612 /* Deliver the signal. */
613 handle_signal(canrestart, signr, &info, &ka, oldset, regs);
614 return 1;
615 }
616
617 /* Got here from a system call? */
618 if (canrestart) {
619 /* Restart the system call - no handlers present. */
620 if (regs->r10 == -ERESTARTNOHAND ||
621 regs->r10 == -ERESTARTSYS ||
622 regs->r10 == -ERESTARTNOINTR) {
623 RESTART_CRIS_SYS(regs);
624 }
625
626 if (regs->r10 == -ERESTART_RESTARTBLOCK){
627 regs->r10 = __NR_restart_syscall;
628 regs->erp -= 2;
629 }
630 }
631
632 return 0;
633}
634
635asmlinkage void
636ugdb_trap_user(struct thread_info *ti, int sig)
637{
638 if (((user_regs(ti)->exs & 0xff00) >> 8) != SINGLE_STEP_INTR_VECT) {
639 /* Zero single-step PC if the reason we stopped wasn't a single
640 step exception. This is to avoid relying on it when it isn't
641 reliable. */
642 user_regs(ti)->spc = 0;
643 }
644 /* FIXME: Filter out false h/w breakpoint hits (i.e. EDA
645 not withing any configured h/w breakpoint range). Synchronize with
646 what already exists for kernel debugging. */
647 if (((user_regs(ti)->exs & 0xff00) >> 8) == BREAK_8_INTR_VECT) {
648 /* Break 8: subtract 2 from ERP unless in a delay slot. */
649 if (!(user_regs(ti)->erp & 0x1))
650 user_regs(ti)->erp -= 2;
651 }
652 sys_kill(ti->task->pid, sig);
653}
654
655void
656keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
657 struct pt_regs *regs)
658{
659 if (oldccs & (1 << Q_CCS_BITNR)) {
660 /* Pending single step due to single-stepping the break 13
661 in the signal trampoline: keep the Q flag. */
662 regs->ccs |= (1 << Q_CCS_BITNR);
663 /* S flag should be set - complain if it's not. */
664 if (!(oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT)))) {
665 printk("Q flag but no S flag?");
666 }
667 regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
668 /* Assume the SPC is valid and interesting. */
669 regs->spc = oldspc;
670
671 } else if (oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT))) {
672 /* If a h/w bp was set in the signal handler we need
673 to keep the S flag. */
674 regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
675 /* Don't keep the old SPC though; if we got here due to
676 a single-step, the Q flag should have been set. */
677 } else if (regs->spc) {
678 /* If we were single-stepping *before* the signal was taken,
679 we don't want to restore that state now, because GDB will
680 have forgotten all about it. */
681 regs->spc = 0;
682 regs->ccs &= ~(1 << (S_CCS_BITNR + CCS_SHIFT));
683 }
684}
685
686/* Set up the trampolines on the signal return page. */
687int __init
688cris_init_signal(void)
689{
690 u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL);
691
692 /* This is movu.w __NR_sigreturn, r9; break 13; */
693 data[0] = 0x9c5f;
694 data[1] = __NR_sigreturn;
695 data[2] = 0xe93d;
696 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
697 data[3] = 0x9c5f;
698 data[4] = __NR_rt_sigreturn;
699 data[5] = 0xe93d;
700
701 /* Map to userspace with appropriate permissions (no write access...) */
702 cris_signal_return_page = (unsigned long)
703 __ioremap_prot(virt_to_phys(data), PAGE_SIZE, PAGE_SIGNAL_TRAMPOLINE);
704
705 return 0;
706}
707
708__initcall(cris_init_signal);
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
new file mode 100644
index 000000000000..2c5cae04a95c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -0,0 +1,348 @@
1#include <asm/delay.h>
2#include <asm/arch/irq.h>
3#include <asm/arch/hwregs/intr_vect.h>
4#include <asm/arch/hwregs/intr_vect_defs.h>
5#include <asm/tlbflush.h>
6#include <asm/mmu_context.h>
7#include <asm/arch/hwregs/mmu_defs_asm.h>
8#include <asm/arch/hwregs/supp_reg.h>
9#include <asm/atomic.h>
10
11#include <linux/err.h>
12#include <linux/init.h>
13#include <linux/timex.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/cpumask.h>
17#include <linux/interrupt.h>
18
19#define IPI_SCHEDULE 1
20#define IPI_CALL 2
21#define IPI_FLUSH_TLB 4
22
23#define FLUSH_ALL (void*)0xffffffff
24
25/* Vector of locks used for various atomic operations */
26spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
27
28/* CPU masks */
29cpumask_t cpu_online_map = CPU_MASK_NONE;
30cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
31
32/* Variables used during SMP boot */
33volatile int cpu_now_booting = 0;
34volatile struct thread_info *smp_init_current_idle_thread;
35
36/* Variables used during IPI */
37static DEFINE_SPINLOCK(call_lock);
38static DEFINE_SPINLOCK(tlbstate_lock);
39
40struct call_data_struct {
41 void (*func) (void *info);
42 void *info;
43 int wait;
44};
45
46static struct call_data_struct * call_data;
47
48static struct mm_struct* flush_mm;
49static struct vm_area_struct* flush_vma;
50static unsigned long flush_addr;
51
52extern int setup_irq(int, struct irqaction *);
53
54/* Mode registers */
55static unsigned long irq_regs[NR_CPUS] =
56{
57 regi_irq,
58 regi_irq2
59};
60
61static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs);
62static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
63static struct irqaction irq_ipi = { crisv32_ipi_interrupt, SA_INTERRUPT,
64 CPU_MASK_NONE, "ipi", NULL, NULL};
65
66extern void cris_mmu_init(void);
67extern void cris_timer_init(void);
68
69/* SMP initialization */
70void __init smp_prepare_cpus(unsigned int max_cpus)
71{
72 int i;
73
74 /* From now on we can expect IPIs so set them up */
75 setup_irq(IPI_INTR_VECT, &irq_ipi);
76
77 /* Mark all possible CPUs as present */
78 for (i = 0; i < max_cpus; i++)
79 cpu_set(i, phys_cpu_present_map);
80}
81
82void __devinit smp_prepare_boot_cpu(void)
83{
84 /* PGD pointer has moved after per_cpu initialization so
85 * update the MMU.
86 */
87 pgd_t **pgd;
88 pgd = (pgd_t**)&per_cpu(current_pgd, smp_processor_id());
89
90 SUPP_BANK_SEL(1);
91 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
92 SUPP_BANK_SEL(2);
93 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
94
95 cpu_set(0, cpu_online_map);
96 cpu_set(0, phys_cpu_present_map);
97}
98
99void __init smp_cpus_done(unsigned int max_cpus)
100{
101}
102
103/* Bring one cpu online.*/
104static int __init
105smp_boot_one_cpu(int cpuid)
106{
107 unsigned timeout;
108 struct task_struct *idle;
109
110 idle = fork_idle(cpuid);
111 if (IS_ERR(idle))
112 panic("SMP: fork failed for CPU:%d", cpuid);
113
114 idle->thread_info->cpu = cpuid;
115
116 /* Information to the CPU that is about to boot */
117 smp_init_current_idle_thread = idle->thread_info;
118 cpu_now_booting = cpuid;
119
120 /* Wait for CPU to come online */
121 for (timeout = 0; timeout < 10000; timeout++) {
122 if(cpu_online(cpuid)) {
123 cpu_now_booting = 0;
124 smp_init_current_idle_thread = NULL;
125 return 0; /* CPU online */
126 }
127 udelay(100);
128 barrier();
129 }
130
131 put_task_struct(idle);
132 idle = NULL;
133
134 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
135 return -1;
136}
137
138/* Secondary CPUs starts uing C here. Here we need to setup CPU
139 * specific stuff such as the local timer and the MMU. */
140void __init smp_callin(void)
141{
142 extern void cpu_idle(void);
143
144 int cpu = cpu_now_booting;
145 reg_intr_vect_rw_mask vect_mask = {0};
146
147 /* Initialise the idle task for this CPU */
148 atomic_inc(&init_mm.mm_count);
149 current->active_mm = &init_mm;
150
151 /* Set up MMU */
152 cris_mmu_init();
153 __flush_tlb_all();
154
155 /* Setup local timer. */
156 cris_timer_init();
157
158 /* Enable IRQ and idle */
159 REG_WR(intr_vect, irq_regs[cpu], rw_mask, vect_mask);
160 unmask_irq(IPI_INTR_VECT);
161 unmask_irq(TIMER_INTR_VECT);
162 local_irq_enable();
163
164 cpu_set(cpu, cpu_online_map);
165 cpu_idle();
166}
167
168/* Stop execution on this CPU.*/
169void stop_this_cpu(void* dummy)
170{
171 local_irq_disable();
172 asm volatile("halt");
173}
174
175/* Other calls */
176void smp_send_stop(void)
177{
178 smp_call_function(stop_this_cpu, NULL, 1, 0);
179}
180
181int setup_profiling_timer(unsigned int multiplier)
182{
183 return -EINVAL;
184}
185
186
187/* cache_decay_ticks is used by the scheduler to decide if a process
188 * is "hot" on one CPU. A higher value means a higher penalty to move
189 * a process to another CPU. Our cache is rather small so we report
190 * 1 tick.
191 */
192unsigned long cache_decay_ticks = 1;
193
194int __devinit __cpu_up(unsigned int cpu)
195{
196 smp_boot_one_cpu(cpu);
197 return cpu_online(cpu) ? 0 : -ENOSYS;
198}
199
200void smp_send_reschedule(int cpu)
201{
202 cpumask_t cpu_mask = CPU_MASK_NONE;
203 cpu_set(cpu, cpu_mask);
204 send_ipi(IPI_SCHEDULE, 0, cpu_mask);
205}
206
207/* TLB flushing
208 *
209 * Flush needs to be done on the local CPU and on any other CPU that
210 * may have the same mapping. The mm->cpu_vm_mask is used to keep track
211 * of which CPUs that a specific process has been executed on.
212 */
213void flush_tlb_common(struct mm_struct* mm, struct vm_area_struct* vma, unsigned long addr)
214{
215 unsigned long flags;
216 cpumask_t cpu_mask;
217
218 spin_lock_irqsave(&tlbstate_lock, flags);
219 cpu_mask = (mm == FLUSH_ALL ? CPU_MASK_ALL : mm->cpu_vm_mask);
220 cpu_clear(smp_processor_id(), cpu_mask);
221 flush_mm = mm;
222 flush_vma = vma;
223 flush_addr = addr;
224 send_ipi(IPI_FLUSH_TLB, 1, cpu_mask);
225 spin_unlock_irqrestore(&tlbstate_lock, flags);
226}
227
228void flush_tlb_all(void)
229{
230 __flush_tlb_all();
231 flush_tlb_common(FLUSH_ALL, FLUSH_ALL, 0);
232}
233
234void flush_tlb_mm(struct mm_struct *mm)
235{
236 __flush_tlb_mm(mm);
237 flush_tlb_common(mm, FLUSH_ALL, 0);
238 /* No more mappings in other CPUs */
239 cpus_clear(mm->cpu_vm_mask);
240 cpu_set(smp_processor_id(), mm->cpu_vm_mask);
241}
242
243void flush_tlb_page(struct vm_area_struct *vma,
244 unsigned long addr)
245{
246 __flush_tlb_page(vma, addr);
247 flush_tlb_common(vma->vm_mm, vma, addr);
248}
249
250/* Inter processor interrupts
251 *
252 * The IPIs are used for:
253 * * Force a schedule on a CPU
254 * * FLush TLB on other CPUs
255 * * Call a function on other CPUs
256 */
257
258int send_ipi(int vector, int wait, cpumask_t cpu_mask)
259{
260 int i = 0;
261 reg_intr_vect_rw_ipi ipi = REG_RD(intr_vect, irq_regs[i], rw_ipi);
262 int ret = 0;
263
264 /* Calculate CPUs to send to. */
265 cpus_and(cpu_mask, cpu_mask, cpu_online_map);
266
267 /* Send the IPI. */
268 for_each_cpu_mask(i, cpu_mask)
269 {
270 ipi.vector |= vector;
271 REG_WR(intr_vect, irq_regs[i], rw_ipi, ipi);
272 }
273
274 /* Wait for IPI to finish on other CPUS */
275 if (wait) {
276 for_each_cpu_mask(i, cpu_mask) {
277 int j;
278 for (j = 0 ; j < 1000; j++) {
279 ipi = REG_RD(intr_vect, irq_regs[i], rw_ipi);
280 if (!ipi.vector)
281 break;
282 udelay(100);
283 }
284
285 /* Timeout? */
286 if (ipi.vector) {
287 printk("SMP call timeout from %d to %d\n", smp_processor_id(), i);
288 ret = -ETIMEDOUT;
289 dump_stack();
290 }
291 }
292 }
293 return ret;
294}
295
296/*
297 * You must not call this function with disabled interrupts or from a
298 * hardware interrupt handler or from a bottom half handler.
299 */
300int smp_call_function(void (*func)(void *info), void *info,
301 int nonatomic, int wait)
302{
303 cpumask_t cpu_mask = CPU_MASK_ALL;
304 struct call_data_struct data;
305 int ret;
306
307 cpu_clear(smp_processor_id(), cpu_mask);
308
309 WARN_ON(irqs_disabled());
310
311 data.func = func;
312 data.info = info;
313 data.wait = wait;
314
315 spin_lock(&call_lock);
316 call_data = &data;
317 ret = send_ipi(IPI_CALL, wait, cpu_mask);
318 spin_unlock(&call_lock);
319
320 return ret;
321}
322
323irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
324{
325 void (*func) (void *info) = call_data->func;
326 void *info = call_data->info;
327 reg_intr_vect_rw_ipi ipi;
328
329 ipi = REG_RD(intr_vect, irq_regs[smp_processor_id()], rw_ipi);
330
331 if (ipi.vector & IPI_CALL) {
332 func(info);
333 }
334 if (ipi.vector & IPI_FLUSH_TLB) {
335 if (flush_mm == FLUSH_ALL)
336 __flush_tlb_all();
337 else if (flush_vma == FLUSH_ALL)
338 __flush_tlb_mm(flush_mm);
339 else
340 __flush_tlb_page(flush_vma, flush_addr);
341 }
342
343 ipi.vector = 0;
344 REG_WR(intr_vect, irq_regs[smp_processor_id()], rw_ipi, ipi);
345
346 return IRQ_HANDLED;
347}
348
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
new file mode 100644
index 000000000000..d48e397f5fa4
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -0,0 +1,341 @@
1/* $Id: time.c,v 1.19 2005/04/29 05:40:09 starvik Exp $
2 *
3 * linux/arch/cris/arch-v32/kernel/time.c
4 *
5 * Copyright (C) 2003 Axis Communications AB
6 *
7 */
8
9#include <linux/config.h>
10#include <linux/timex.h>
11#include <linux/time.h>
12#include <linux/jiffies.h>
13#include <linux/interrupt.h>
14#include <linux/swap.h>
15#include <linux/sched.h>
16#include <linux/init.h>
17#include <linux/threads.h>
18#include <asm/types.h>
19#include <asm/signal.h>
20#include <asm/io.h>
21#include <asm/delay.h>
22#include <asm/rtc.h>
23#include <asm/irq.h>
24
25#include <asm/arch/hwregs/reg_map.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/timer_defs.h>
28#include <asm/arch/hwregs/intr_vect_defs.h>
29
30/* Watchdog defines */
31#define ETRAX_WD_KEY_MASK 0x7F /* key is 7 bit */
32#define ETRAX_WD_HZ 763 /* watchdog counts at 763 Hz */
33#define ETRAX_WD_CNT ((2*ETRAX_WD_HZ)/HZ + 1) /* Number of 763 counts before watchdog bites */
34
35unsigned long timer_regs[NR_CPUS] =
36{
37 regi_timer,
38#ifdef CONFIG_SMP
39 regi_timer2
40#endif
41};
42
43extern void update_xtime_from_cmos(void);
44extern int set_rtc_mmss(unsigned long nowtime);
45extern int setup_irq(int, struct irqaction *);
46extern int have_rtc;
47
48unsigned long get_ns_in_jiffie(void)
49{
50 reg_timer_r_tmr0_data data;
51 unsigned long ns;
52
53 data = REG_RD(timer, regi_timer, r_tmr0_data);
54 ns = (TIMER0_DIV - data) * 10;
55 return ns;
56}
57
58unsigned long do_slow_gettimeoffset(void)
59{
60 unsigned long count;
61 unsigned long usec_count = 0;
62
63 static unsigned long count_p = TIMER0_DIV;/* for the first call after boot */
64 static unsigned long jiffies_p = 0;
65
66 /*
67 * cache volatile jiffies temporarily; we have IRQs turned off.
68 */
69 unsigned long jiffies_t;
70
71 /* The timer interrupt comes from Etrax timer 0. In order to get
72 * better precision, we check the current value. It might have
73 * underflowed already though.
74 */
75
76 count = REG_RD(timer, regi_timer, r_tmr0_data);
77 jiffies_t = jiffies;
78
79 /*
80 * avoiding timer inconsistencies (they are rare, but they happen)...
81 * there are one problem that must be avoided here:
82 * 1. the timer counter underflows
83 */
84 if( jiffies_t == jiffies_p ) {
85 if( count > count_p ) {
86 /* Timer wrapped, use new count and prescale
87 * increase the time corresponding to one jiffie
88 */
89 usec_count = 1000000/HZ;
90 }
91 } else
92 jiffies_p = jiffies_t;
93 count_p = count;
94 /* Convert timer value to usec */
95 /* 100 MHz timer, divide by 100 to get usec */
96 usec_count += (TIMER0_DIV - count) / 100;
97 return usec_count;
98}
99
100/* From timer MDS describing the hardware watchdog:
101 * 4.3.1 Watchdog Operation
102 * The watchdog timer is an 8-bit timer with a configurable start value.
103 * Once started the whatchdog counts downwards with a frequency of 763 Hz
104 * (100/131072 MHz). When the watchdog counts down to 1, it generates an
105 * NMI (Non Maskable Interrupt), and when it counts down to 0, it resets the
106 * chip.
107 */
108/* This gives us 1.3 ms to do something useful when the NMI comes */
109
110/* right now, starting the watchdog is the same as resetting it */
111#define start_watchdog reset_watchdog
112
113#if defined(CONFIG_ETRAX_WATCHDOG)
114static short int watchdog_key = 42; /* arbitrary 7 bit number */
115#endif
116
117/* number of pages to consider "out of memory". it is normal that the memory
118 * is used though, so put this really low.
119 */
120
121#define WATCHDOG_MIN_FREE_PAGES 8
122
123void
124reset_watchdog(void)
125{
126#if defined(CONFIG_ETRAX_WATCHDOG)
127 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
128
129 /* only keep watchdog happy as long as we have memory left! */
130 if(nr_free_pages() > WATCHDOG_MIN_FREE_PAGES) {
131 /* reset the watchdog with the inverse of the old key */
132 watchdog_key ^= ETRAX_WD_KEY_MASK; /* invert key, which is 7 bits */
133 wd_ctrl.cnt = ETRAX_WD_CNT;
134 wd_ctrl.cmd = regk_timer_start;
135 wd_ctrl.key = watchdog_key;
136 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
137 }
138#endif
139}
140
141/* stop the watchdog - we still need the correct key */
142
143void
144stop_watchdog(void)
145{
146#if defined(CONFIG_ETRAX_WATCHDOG)
147 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
148 watchdog_key ^= ETRAX_WD_KEY_MASK; /* invert key, which is 7 bits */
149 wd_ctrl.cnt = ETRAX_WD_CNT;
150 wd_ctrl.cmd = regk_timer_stop;
151 wd_ctrl.key = watchdog_key;
152 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
153#endif
154}
155
156extern void show_registers(struct pt_regs *regs);
157
158void
159handle_watchdog_bite(struct pt_regs* regs)
160{
161#if defined(CONFIG_ETRAX_WATCHDOG)
162 extern int cause_of_death;
163
164 raw_printk("Watchdog bite\n");
165
166 /* Check if forced restart or unexpected watchdog */
167 if (cause_of_death == 0xbedead) {
168 while(1);
169 }
170
171 /* Unexpected watchdog, stop the watchdog and dump registers*/
172 stop_watchdog();
173 raw_printk("Oops: bitten by watchdog\n");
174 show_registers(regs);
175#ifndef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
176 reset_watchdog();
177#endif
178 while(1) /* nothing */;
179#endif
180}
181
182/* last time the cmos clock got updated */
183static long last_rtc_update = 0;
184
185/*
186 * timer_interrupt() needs to keep up the real-time clock,
187 * as well as call the "do_timer()" routine every clocktick
188 */
189
190//static unsigned short myjiff; /* used by our debug routine print_timestamp */
191
192extern void cris_do_profile(struct pt_regs *regs);
193
194static inline irqreturn_t
195timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
196{
197 int cpu = smp_processor_id();
198 reg_timer_r_masked_intr masked_intr;
199 reg_timer_rw_ack_intr ack_intr = { 0 };
200
201 /* Check if the timer interrupt is for us (a tmr0 int) */
202 masked_intr = REG_RD(timer, timer_regs[cpu], r_masked_intr);
203 if (!masked_intr.tmr0)
204 return IRQ_NONE;
205
206 /* acknowledge the timer irq */
207 ack_intr.tmr0 = 1;
208 REG_WR(timer, timer_regs[cpu], rw_ack_intr, ack_intr);
209
210 /* reset watchdog otherwise it resets us! */
211 reset_watchdog();
212
213 /* Update statistics. */
214 update_process_times(user_mode(regs));
215
216 cris_do_profile(regs); /* Save profiling information */
217
218 /* The master CPU is responsible for the time keeping. */
219 if (cpu != 0)
220 return IRQ_HANDLED;
221
222 /* call the real timer interrupt handler */
223 do_timer(regs);
224
225 /*
226 * If we have an externally synchronized Linux clock, then update
227 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
228 * called as close as possible to 500 ms before the new second starts.
229 *
230 * The division here is not time critical since it will run once in
231 * 11 minutes
232 */
233 if ((time_status & STA_UNSYNC) == 0 &&
234 xtime.tv_sec > last_rtc_update + 660 &&
235 (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 &&
236 (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) {
237 if (set_rtc_mmss(xtime.tv_sec) == 0)
238 last_rtc_update = xtime.tv_sec;
239 else
240 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
241 }
242 return IRQ_HANDLED;
243}
244
245/* timer is SA_SHIRQ so drivers can add stuff to the timer irq chain
246 * it needs to be SA_INTERRUPT to make the jiffies update work properly
247 */
248
249static struct irqaction irq_timer = { timer_interrupt, SA_SHIRQ | SA_INTERRUPT,
250 CPU_MASK_NONE, "timer", NULL, NULL};
251
252void __init
253cris_timer_init(void)
254{
255 int cpu = smp_processor_id();
256 reg_timer_rw_tmr0_ctrl tmr0_ctrl = { 0 };
257 reg_timer_rw_tmr0_div tmr0_div = TIMER0_DIV;
258 reg_timer_rw_intr_mask timer_intr_mask;
259
260 /* Setup the etrax timers
261 * Base frequency is 100MHz, divider 1000000 -> 100 HZ
262 * We use timer0, so timer1 is free.
263 * The trig timer is used by the fasttimer API if enabled.
264 */
265
266 tmr0_ctrl.op = regk_timer_ld;
267 tmr0_ctrl.freq = regk_timer_f100;
268 REG_WR(timer, timer_regs[cpu], rw_tmr0_div, tmr0_div);
269 REG_WR(timer, timer_regs[cpu], rw_tmr0_ctrl, tmr0_ctrl); /* Load */
270 tmr0_ctrl.op = regk_timer_run;
271 REG_WR(timer, timer_regs[cpu], rw_tmr0_ctrl, tmr0_ctrl); /* Start */
272
273 /* enable the timer irq */
274 timer_intr_mask = REG_RD(timer, timer_regs[cpu], rw_intr_mask);
275 timer_intr_mask.tmr0 = 1;
276 REG_WR(timer, timer_regs[cpu], rw_intr_mask, timer_intr_mask);
277}
278
279void __init
280time_init(void)
281{
282 reg_intr_vect_rw_mask intr_mask;
283
284 /* probe for the RTC and read it if it exists
285 * Before the RTC can be probed the loops_per_usec variable needs
286 * to be initialized to make usleep work. A better value for
287 * loops_per_usec is calculated by the kernel later once the
288 * clock has started.
289 */
290 loops_per_usec = 50;
291
292 if(RTC_INIT() < 0) {
293 /* no RTC, start at 1980 */
294 xtime.tv_sec = 0;
295 xtime.tv_nsec = 0;
296 have_rtc = 0;
297 } else {
298 /* get the current time */
299 have_rtc = 1;
300 update_xtime_from_cmos();
301 }
302
303 /*
304 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
305 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
306 */
307 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
308
309 /* Start CPU local timer */
310 cris_timer_init();
311
312 /* enable the timer irq in global config */
313 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
314 intr_mask.timer = 1;
315 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
316
317 /* now actually register the timer irq handler that calls timer_interrupt() */
318
319 setup_irq(TIMER_INTR_VECT, &irq_timer);
320
321 /* enable watchdog if we should use one */
322
323#if defined(CONFIG_ETRAX_WATCHDOG)
324 printk("Enabling watchdog...\n");
325 start_watchdog();
326
327 /* If we use the hardware watchdog, we want to trap it as an NMI
328 and dump registers before it resets us. For this to happen, we
329 must set the "m" NMI enable flag (which once set, is unset only
330 when an NMI is taken).
331
332 The same goes for the external NMI, but that doesn't have any
333 driver or infrastructure support yet. */
334 {
335 unsigned long flags;
336 local_save_flags(flags);
337 flags |= (1<<30); /* NMI M flag is at bit 30 */
338 local_irq_restore(flags);
339 }
340#endif
341}
diff --git a/arch/cris/arch-v32/kernel/traps.c b/arch/cris/arch-v32/kernel/traps.c
new file mode 100644
index 000000000000..6e3787045560
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/traps.c
@@ -0,0 +1,160 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/config.h>
6#include <linux/ptrace.h>
7#include <asm/uaccess.h>
8
9#include <asm/arch/hwregs/supp_reg.h>
10
11extern void reset_watchdog(void);
12extern void stop_watchdog(void);
13
14extern int raw_printk(const char *fmt, ...);
15
16void
17show_registers(struct pt_regs *regs)
18{
19 /*
20 * It's possible to use either the USP register or current->thread.usp.
21 * USP might not correspond to the current proccess for all cases this
22 * function is called, and current->thread.usp isn't up to date for the
23 * current proccess. Experience shows that using USP is the way to go.
24 */
25 unsigned long usp;
26 unsigned long d_mmu_cause;
27 unsigned long i_mmu_cause;
28
29 usp = rdusp();
30
31 raw_printk("CPU: %d\n", smp_processor_id());
32
33 raw_printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n",
34 regs->erp, regs->srp, regs->ccs, usp, regs->mof);
35
36 raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
37 regs->r0, regs->r1, regs->r2, regs->r3);
38
39 raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
40 regs->r4, regs->r5, regs->r6, regs->r7);
41
42 raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
43 regs->r8, regs->r9, regs->r10, regs->r11);
44
45 raw_printk("r12: %08lx r13: %08lx oR10: %08lx acr: %08lx\n",
46 regs->r12, regs->r13, regs->orig_r10, regs->acr);
47
48 raw_printk("sp: %08lx\n", regs);
49
50 SUPP_BANK_SEL(BANK_IM);
51 SUPP_REG_RD(RW_MM_CAUSE, i_mmu_cause);
52
53 SUPP_BANK_SEL(BANK_DM);
54 SUPP_REG_RD(RW_MM_CAUSE, d_mmu_cause);
55
56 raw_printk(" Data MMU Cause: %08lx\n", d_mmu_cause);
57 raw_printk("Instruction MMU Cause: %08lx\n", i_mmu_cause);
58
59 raw_printk("Process %s (pid: %d, stackpage: %08lx)\n",
60 current->comm, current->pid, (unsigned long) current);
61
62 /* Show additional info if in kernel-mode. */
63 if (!user_mode(regs)) {
64 int i;
65 unsigned char c;
66
67 show_stack(NULL, (unsigned long *) usp);
68
69 /*
70 * If the previous stack-dump wasn't a kernel one, dump the
71 * kernel stack now.
72 */
73 if (usp != 0)
74 show_stack(NULL, NULL);
75
76 raw_printk("\nCode: ");
77
78 if (regs->erp < PAGE_OFFSET)
79 goto bad_value;
80
81 /*
82 * Quite often the value at regs->erp doesn't point to the
83 * interesting instruction, which often is the previous
84 * instruction. So dump at an offset large enough that the
85 * instruction decoding should be in sync at the interesting
86 * point, but small enough to fit on a row. The regs->erp
87 * location is pointed out in a ksymoops-friendly way by
88 * wrapping the byte for that address in parenthesis.
89 */
90 for (i = -12; i < 12; i++) {
91 if (__get_user(c, &((unsigned char *) regs->erp)[i])) {
92bad_value:
93 raw_printk(" Bad IP value.");
94 break;
95 }
96
97 if (i == 0)
98 raw_printk("(%02x) ", c);
99 else
100 raw_printk("%02x ", c);
101 }
102
103 raw_printk("\n");
104 }
105}
106
107/*
108 * This gets called from entry.S when the watchdog has bitten. Show something
109 * similiar to an Oops dump, and if the kernel if configured to be a nice doggy;
110 * halt instead of reboot.
111 */
112void
113watchdog_bite_hook(struct pt_regs *regs)
114{
115#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
116 local_irq_disable();
117 stop_watchdog();
118 show_registers(regs);
119
120 while (1)
121 ; /* Do nothing. */
122#else
123 show_registers(regs);
124#endif
125}
126
127/* This is normally the Oops function. */
128void
129die_if_kernel(const char *str, struct pt_regs *regs, long err)
130{
131 if (user_mode(regs))
132 return;
133
134#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
135 /*
136 * This printout might take too long and could trigger
137 * the watchdog normally. If NICE_DOGGY is set, simply
138 * stop the watchdog during the printout.
139 */
140 stop_watchdog();
141#endif
142
143 raw_printk("%s: %04lx\n", str, err & 0xffff);
144
145 show_registers(regs);
146
147#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
148 reset_watchdog();
149#endif
150
151 do_exit(SIGSEGV);
152}
153
154void arch_enable_nmi(void)
155{
156 unsigned long flags;
157 local_save_flags(flags);
158 flags |= (1<<30); /* NMI M flag is at bit 30 */
159 local_irq_restore(flags);
160}
diff --git a/arch/cris/arch-v32/kernel/vcs_hook.c b/arch/cris/arch-v32/kernel/vcs_hook.c
new file mode 100644
index 000000000000..64d71c54c22c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/vcs_hook.c
@@ -0,0 +1,96 @@
1// $Id: vcs_hook.c,v 1.2 2003/08/12 12:01:06 starvik Exp $
2//
3// Call simulator hook. This is the part running in the
4// simulated program.
5//
6
7#include "vcs_hook.h"
8#include <stdarg.h>
9#include <asm/arch-v32/hwregs/reg_map.h>
10#include <asm/arch-v32/hwregs/intr_vect_defs.h>
11
12#define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */
13#define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */
14
15#define HOOK_DATA(offset) ((unsigned*) HOOK_MEM_BASE_ADDR)[offset]
16#define VHOOK_DATA(offset) ((volatile unsigned*) HOOK_MEM_BASE_ADDR)[offset]
17#define HOOK_TRIG(funcid) do { *((unsigned *) HOOK_TRIG_ADDR) = funcid; } while(0)
18#define HOOK_DATA_BYTE(offset) ((unsigned char*) HOOK_MEM_BASE_ADDR)[offset]
19
20
21// ------------------------------------------------------------------ hook_call
22int hook_call( unsigned id, unsigned pcnt, ...) {
23 va_list ap;
24 unsigned i;
25 unsigned ret;
26#ifdef USING_SOS
27 PREEMPT_OFF_SAVE();
28#endif
29
30 // pass parameters
31 HOOK_DATA(0) = id;
32
33 /* Have to make hook_print_str a special case since we call with a
34 parameter of byte type. Should perhaps be a separate
35 hook_call. */
36
37 if (id == hook_print_str) {
38 int i;
39 char *str;
40
41 HOOK_DATA(1) = pcnt;
42
43 va_start(ap, pcnt);
44 str = (char*)va_arg(ap,unsigned);
45
46 for (i=0; i!=pcnt; i++) {
47 HOOK_DATA_BYTE(8+i) = str[i];
48 }
49 HOOK_DATA_BYTE(8+i) = 0; /* null byte */
50 }
51 else {
52 va_start(ap, pcnt);
53 for( i = 1; i <= pcnt; i++ ) HOOK_DATA(i) = va_arg(ap,unsigned);
54 va_end(ap);
55 }
56
57 // read from mem to make sure data has propagated to memory before trigging
58 *((volatile unsigned*) HOOK_MEM_BASE_ADDR);
59
60 // trigger hook
61 HOOK_TRIG(id);
62
63 // wait for call to finish
64 while( VHOOK_DATA(0) > 0 ) {}
65
66 // extract return value
67
68 ret = VHOOK_DATA(1);
69
70#ifdef USING_SOS
71 PREEMPT_RESTORE();
72#endif
73 return ret;
74}
75
76unsigned
77hook_buf(unsigned i)
78{
79 return (HOOK_DATA(i));
80}
81
82void print_str( const char *str ) {
83 int i;
84 for (i=1; str[i]; i++); /* find null at end of string */
85 hook_call(hook_print_str, i, str);
86}
87
88// --------------------------------------------------------------- CPU_KICK_DOG
89void CPU_KICK_DOG(void) {
90 (void) hook_call( hook_kick_dog, 0 );
91}
92
93// ------------------------------------------------------- CPU_WATCHDOG_TIMEOUT
94void CPU_WATCHDOG_TIMEOUT( unsigned t ) {
95 (void) hook_call( hook_dog_timeout, 1, t );
96}
diff --git a/arch/cris/arch-v32/kernel/vcs_hook.h b/arch/cris/arch-v32/kernel/vcs_hook.h
new file mode 100644
index 000000000000..7d73709e3cc6
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/vcs_hook.h
@@ -0,0 +1,42 @@
1// $Id: vcs_hook.h,v 1.1 2003/08/12 12:01:06 starvik Exp $
2//
3// Call simulator hook functions
4
5#ifndef HOOK_H
6#define HOOK_H
7
8int hook_call( unsigned id, unsigned pcnt, ...);
9
10enum hook_ids {
11 hook_debug_on = 1,
12 hook_debug_off,
13 hook_stop_sim_ok,
14 hook_stop_sim_fail,
15 hook_alloc_shared,
16 hook_ptr_shared,
17 hook_free_shared,
18 hook_file2shared,
19 hook_cmp_shared,
20 hook_print_params,
21 hook_sim_time,
22 hook_stop_sim,
23 hook_kick_dog,
24 hook_dog_timeout,
25 hook_rand,
26 hook_srand,
27 hook_rand_range,
28 hook_print_str,
29 hook_print_hex,
30 hook_cmp_offset_shared,
31 hook_fill_random_shared,
32 hook_alloc_random_data,
33 hook_calloc_random_data,
34 hook_print_int,
35 hook_print_uint,
36 hook_fputc,
37 hook_init_fd,
38 hook_sbrk
39
40};
41
42#endif
diff --git a/arch/cris/arch-v32/lib/Makefile b/arch/cris/arch-v32/lib/Makefile
new file mode 100644
index 000000000000..05b3ec6978d6
--- /dev/null
+++ b/arch/cris/arch-v32/lib/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for Etrax-specific library files..
3#
4
5lib-y = checksum.o checksumcopy.o string.o usercopy.o memset.o csumcpfruser.o spinlock.o
6
diff --git a/arch/cris/arch-v32/lib/checksum.S b/arch/cris/arch-v32/lib/checksum.S
new file mode 100644
index 000000000000..32e66181b826
--- /dev/null
+++ b/arch/cris/arch-v32/lib/checksum.S
@@ -0,0 +1,111 @@
1/*
2 * A fast checksum routine using movem
3 * Copyright (c) 1998-2001, 2003 Axis Communications AB
4 *
5 * csum_partial(const unsigned char * buff, int len, unsigned int sum)
6 */
7
8 .globl csum_partial
9csum_partial:
10
11 ;; r10 - src
12 ;; r11 - length
13 ;; r12 - checksum
14
15 ;; check for breakeven length between movem and normal word looping versions
16 ;; we also do _NOT_ want to compute a checksum over more than the
17 ;; actual length when length < 40
18
19 cmpu.w 80,$r11
20 blo _word_loop
21 nop
22
23 ;; need to save the registers we use below in the movem loop
24 ;; this overhead is why we have a check above for breakeven length
25 ;; only r0 - r8 have to be saved, the other ones are clobber-able
26 ;; according to the ABI
27
28 subq 9*4,$sp
29 subq 10*4,$r11 ; update length for the first loop
30 movem $r8,[$sp]
31
32 ;; do a movem checksum
33
34_mloop: movem [$r10+],$r9 ; read 10 longwords
35
36 ;; perform dword checksumming on the 10 longwords
37
38 add.d $r0,$r12
39 addc $r1,$r12
40 addc $r2,$r12
41 addc $r3,$r12
42 addc $r4,$r12
43 addc $r5,$r12
44 addc $r6,$r12
45 addc $r7,$r12
46 addc $r8,$r12
47 addc $r9,$r12
48
49 ;; fold the carry into the checksum, to avoid having to loop the carry
50 ;; back into the top
51
52 addc 0,$r12
53 addc 0,$r12 ; do it again, since we might have generated a carry
54
55 subq 10*4,$r11
56 bge _mloop
57 nop
58
59 addq 10*4,$r11 ; compensate for last loop underflowing length
60
61 movem [$sp+],$r8 ; restore regs
62
63_word_loop:
64 ;; only fold if there is anything to fold.
65
66 cmpq 0,$r12
67 beq _no_fold
68
69 ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below.
70 ;; r9 and r13 can be used as temporaries.
71
72 moveq -1,$r9 ; put 0xffff in r9, faster than move.d 0xffff,r9
73 lsrq 16,$r9
74
75 move.d $r12,$r13
76 lsrq 16,$r13 ; r13 = checksum >> 16
77 and.d $r9,$r12 ; checksum = checksum & 0xffff
78 add.d $r13,$r12 ; checksum += r13
79 move.d $r12,$r13 ; do the same again, maybe we got a carry last add
80 lsrq 16,$r13
81 and.d $r9,$r12
82 add.d $r13,$r12
83
84_no_fold:
85 cmpq 2,$r11
86 blt _no_words
87 nop
88
89 ;; checksum the rest of the words
90
91 subq 2,$r11
92
93_wloop: subq 2,$r11
94 bge _wloop
95 addu.w [$r10+],$r12
96
97 addq 2,$r11
98
99_no_words:
100 ;; see if we have one odd byte more
101 cmpq 1,$r11
102 beq _do_byte
103 nop
104 ret
105 move.d $r12,$r10
106
107_do_byte:
108 ;; copy and checksum the last byte
109 addu.b [$r10],$r12
110 ret
111 move.d $r12,$r10
diff --git a/arch/cris/arch-v32/lib/checksumcopy.S b/arch/cris/arch-v32/lib/checksumcopy.S
new file mode 100644
index 000000000000..9303ccbadc6d
--- /dev/null
+++ b/arch/cris/arch-v32/lib/checksumcopy.S
@@ -0,0 +1,120 @@
1/*
2 * A fast checksum+copy routine using movem
3 * Copyright (c) 1998, 2001, 2003 Axis Communications AB
4 *
5 * Authors: Bjorn Wesen
6 *
7 * csum_partial_copy_nocheck(const char *src, char *dst,
8 * int len, unsigned int sum)
9 */
10
11 .globl csum_partial_copy_nocheck
12csum_partial_copy_nocheck:
13
14 ;; r10 - src
15 ;; r11 - dst
16 ;; r12 - length
17 ;; r13 - checksum
18
19 ;; check for breakeven length between movem and normal word looping versions
20 ;; we also do _NOT_ want to compute a checksum over more than the
21 ;; actual length when length < 40
22
23 cmpu.w 80,$r12
24 blo _word_loop
25 nop
26
27 ;; need to save the registers we use below in the movem loop
28 ;; this overhead is why we have a check above for breakeven length
29 ;; only r0 - r8 have to be saved, the other ones are clobber-able
30 ;; according to the ABI
31
32 subq 9*4,$sp
33 subq 10*4,$r12 ; update length for the first loop
34 movem $r8,[$sp]
35
36 ;; do a movem copy and checksum
37
381: ;; A failing userspace access (the read) will have this as PC.
39_mloop: movem [$r10+],$r9 ; read 10 longwords
40 movem $r9,[$r11+] ; write 10 longwords
41
42 ;; perform dword checksumming on the 10 longwords
43
44 add.d $r0,$r13
45 addc $r1,$r13
46 addc $r2,$r13
47 addc $r3,$r13
48 addc $r4,$r13
49 addc $r5,$r13
50 addc $r6,$r13
51 addc $r7,$r13
52 addc $r8,$r13
53 addc $r9,$r13
54
55 ;; fold the carry into the checksum, to avoid having to loop the carry
56 ;; back into the top
57
58 addc 0,$r13
59 addc 0,$r13 ; do it again, since we might have generated a carry
60
61 subq 10*4,$r12
62 bge _mloop
63 nop
64
65 addq 10*4,$r12 ; compensate for last loop underflowing length
66
67 movem [$sp+],$r8 ; restore regs
68
69_word_loop:
70 ;; only fold if there is anything to fold.
71
72 cmpq 0,$r13
73 beq _no_fold
74
75 ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below
76 ;; r9 can be used as temporary.
77
78 move.d $r13,$r9
79 lsrq 16,$r9 ; r0 = checksum >> 16
80 and.d 0xffff,$r13 ; checksum = checksum & 0xffff
81 add.d $r9,$r13 ; checksum += r0
82 move.d $r13,$r9 ; do the same again, maybe we got a carry last add
83 lsrq 16,$r9
84 and.d 0xffff,$r13
85 add.d $r9,$r13
86
87_no_fold:
88 cmpq 2,$r12
89 blt _no_words
90 nop
91
92 ;; copy and checksum the rest of the words
93
94 subq 2,$r12
95
962: ;; A failing userspace access for the read below will have this as PC.
97_wloop: move.w [$r10+],$r9
98 addu.w $r9,$r13
99 subq 2,$r12
100 bge _wloop
101 move.w $r9,[$r11+]
102
103 addq 2,$r12
104
105_no_words:
106 ;; see if we have one odd byte more
107 cmpq 1,$r12
108 beq _do_byte
109 nop
110 ret
111 move.d $r13,$r10
112
113_do_byte:
114 ;; copy and checksum the last byte
1153: ;; A failing userspace access for the read below will have this as PC.
116 move.b [$r10],$r9
117 addu.b $r9,$r13
118 move.b $r9,[$r11]
119 ret
120 move.d $r13,$r10
diff --git a/arch/cris/arch-v32/lib/csumcpfruser.S b/arch/cris/arch-v32/lib/csumcpfruser.S
new file mode 100644
index 000000000000..600ec16b9f28
--- /dev/null
+++ b/arch/cris/arch-v32/lib/csumcpfruser.S
@@ -0,0 +1,69 @@
1/*
2 * Add-on to transform csum_partial_copy_nocheck in checksumcopy.S into
3 * csum_partial_copy_from_user by adding exception records.
4 *
5 * Copyright (C) 2001, 2003 Axis Communications AB.
6 *
7 * Author: Hans-Peter Nilsson.
8 */
9
10#include <asm/errno.h>
11
12/* Same function body, but a different name. If we just added exception
13 records to _csum_partial_copy_nocheck and made it generic, we wouldn't
14 know a user fault from a kernel fault and we would have overhead in
15 each kernel caller for the error-pointer argument.
16
17 unsigned int csum_partial_copy_from_user
18 (const char *src, char *dst, int len, unsigned int sum, int *errptr);
19
20 Note that the errptr argument is only set if we encounter an error.
21 It is conveniently located on the stack, so the normal function body
22 does not have to handle it. */
23
24#define csum_partial_copy_nocheck csum_partial_copy_from_user
25
26/* There are local labels numbered 1, 2 and 3 present to mark the
27 different from-user accesses. */
28#include "checksumcopy.S"
29
30 .section .fixup,"ax"
31
32;; Here from the movem loop; restore stack.
334:
34 movem [$sp+],$r8
35;; r12 is already decremented. Add back chunk_size-2.
36 addq 40-2,$r12
37
38;; Here from the word loop; r12 is off by 2; add it back.
395:
40 addq 2,$r12
41
42;; Here from a failing single byte.
436:
44
45;; Signal in *errptr that we had a failing access.
46 move.d [$sp],$acr
47 moveq -EFAULT,$r9
48 subq 4,$sp
49 move.d $r9,[$acr]
50
51;; Clear the rest of the destination area using memset. Preserve the
52;; checksum for the readable bytes.
53 move.d $r13,[$sp]
54 subq 4,$sp
55 move.d $r11,$r10
56 move $srp,[$sp]
57 jsr memset
58 clear.d $r11
59
60 move [$sp+],$srp
61 ret
62 move.d [$sp+],$r10
63
64 .previous
65 .section __ex_table,"a"
66 .dword 1b,4b
67 .dword 2b,5b
68 .dword 3b,6b
69 .previous
diff --git a/arch/cris/arch-v32/lib/dram_init.S b/arch/cris/arch-v32/lib/dram_init.S
new file mode 100644
index 000000000000..47b6cf5f4afd
--- /dev/null
+++ b/arch/cris/arch-v32/lib/dram_init.S
@@ -0,0 +1,120 @@
1/* $Id: dram_init.S,v 1.4 2005/04/24 18:48:32 starvik Exp $
2 *
3 * DRAM/SDRAM initialization - alter with care
4 * This file is intended to be included from other assembler files
5 *
6 * Note: This file may not modify r8 or r9 because they are used to
7 * carry information from the decompresser to the kernel
8 *
9 * Copyright (C) 2000-2003 Axis Communications AB
10 *
11 * Authors: Mikael Starvik (starvik@axis.com)
12 */
13
14/* Just to be certain the config file is included, we include it here
15 * explicitely instead of depending on it being included in the file that
16 * uses this code.
17 */
18
19#include <linux/config.h>
20#include <asm/arch/hwregs/asm/reg_map_asm.h>
21#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
22
23 ;; WARNING! The registers r8 and r9 are used as parameters carrying
24 ;; information from the decompressor (if the kernel was compressed).
25 ;; They should not be used in the code below.
26
27 ; Refer to BIF MDS for a description of SDRAM initialization
28
29 ; Bank configuration
30 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp0), $r0
31 move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1
32 move.d $r1, [$r0]
33 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp1), $r0
34 move.d CONFIG_ETRAX_SDRAM_GRP1_CONFIG, $r1
35 move.d $r1, [$r0]
36
37 ; Calculate value of mrs_data
38 ; CAS latency = 2 && bus_width = 32 => 0x40
39 ; CAS latency = 3 && bus_width = 32 => 0x60
40 ; CAS latency = 2 && bus_width = 16 => 0x20
41 ; CAS latency = 3 && bus_width = 16 => 0x30
42
43 ; Check if value is already supplied in kernel config
44 move.d CONFIG_ETRAX_SDRAM_COMMAND, $r2
45 bne _set_timing
46 nop
47
48 move.d 0x40, $r4 ; Assume 32 bits and CAS latency = 2
49 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
50 and.d 0x07, $r1 ; Get CAS latency
51 cmpq 2, $r1 ; CL = 2 ?
52 beq _bw_check
53 nop
54 move.d 0x60, $r4
55
56_bw_check:
57 ; Assume that group 0 width is equal to group 1. This assumption
58 ; is wrong for a group 1 only hardware (such as the grand old
59 ; StorPoint+).
60 move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1
61 and.d 0x200, $r1 ; DRAM width is bit 9
62 beq _set_timing
63 lslq 2, $r4 ; mrs_data starts at bit 2
64 lsrq 1, $r4 ; 16 bits. Shift down value.
65
66 ; Set timing parameters (refresh off to avoid Guinness TR 83)
67_set_timing:
68 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
69 and.d ~(3 << reg_bif_core_rw_sdram_timing___ref___lsb), $r1
70 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0
71 move.d $r1, [$r0]
72
73 ; Issue NOP command
74 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cmd), $r5
75 moveq regk_bif_core_nop, $r1
76 move.d $r1, [$r5]
77
78 ; Wait 200us
79 move.d 10000, $r2
801: bne 1b
81 subq 1, $r2
82
83 ; Issue initialization command sequence
84 move.d _sdram_commands_start, $r2
85 and.d 0x000fffff, $r2 ; Make sure commands are read from flash
86 move.d _sdram_commands_end, $r3
87 and.d 0x000fffff, $r3
881: clear.d $r6
89 move.b [$r2+], $r6 ; Load command
90 or.d $r4, $r6 ; Add calculated mrs
91 move.d $r6, [$r5] ; Write rw_sdram_cmd
92 ; Wait 80 ns between each command
93 move.d 4000, $r7
942: bne 2b
95 subq 1, $r7
96 cmp.d $r2, $r3 ; Last command?
97 bne 1b
98 nop
99
100 ; Start refresh
101 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
102 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0
103 move.d $r1, [$r0]
104
105 ; Initialization finished
106 ba _sdram_commands_end
107 nop
108
109_sdram_commands_start:
110 .byte regk_bif_core_pre ; Precharge
111 .byte regk_bif_core_ref ; refresh
112 .byte regk_bif_core_ref ; refresh
113 .byte regk_bif_core_ref ; refresh
114 .byte regk_bif_core_ref ; refresh
115 .byte regk_bif_core_ref ; refresh
116 .byte regk_bif_core_ref ; refresh
117 .byte regk_bif_core_ref ; refresh
118 .byte regk_bif_core_ref ; refresh
119 .byte regk_bif_core_mrs ; mrs
120_sdram_commands_end:
diff --git a/arch/cris/arch-v32/lib/hw_settings.S b/arch/cris/arch-v32/lib/hw_settings.S
new file mode 100644
index 000000000000..5182e8c2cff2
--- /dev/null
+++ b/arch/cris/arch-v32/lib/hw_settings.S
@@ -0,0 +1,73 @@
1/*
2 * $Id: hw_settings.S,v 1.3 2005/04/24 18:36:57 starvik Exp $
3 *
4 * This table is used by some tools to extract hardware parameters.
5 * The table should be included in the kernel and the decompressor.
6 * Don't forget to update the tools if you change this table.
7 *
8 * Copyright (C) 2001 Axis Communications AB
9 *
10 * Authors: Mikael Starvik (starvik@axis.com)
11 */
12
13#include <linux/config.h>
14#include <asm/arch/hwregs/asm/reg_map_asm.h>
15#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
16#include <asm/arch/hwregs/asm/gio_defs_asm.h>
17
18 .ascii "HW_PARAM_MAGIC" ; Magic number
19 .dword 0xc0004000 ; Kernel start address
20
21 ; Debug port
22#ifdef CONFIG_ETRAX_DEBUG_PORT0
23 .dword 0
24#elif defined(CONFIG_ETRAX_DEBUG_PORT1)
25 .dword 1
26#elif defined(CONFIG_ETRAX_DEBUG_PORT2)
27 .dword 2
28#elif defined(CONFIG_ETRAX_DEBUG_PORT3)
29 .dword 3
30#else
31 .dword 4 ; No debug
32#endif
33
34 ; Register values
35 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg)
36 .dword CONFIG_ETRAX_MEM_GRP1_CONFIG
37 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp2_cfg)
38 .dword CONFIG_ETRAX_MEM_GRP2_CONFIG
39 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg)
40 .dword CONFIG_ETRAX_MEM_GRP3_CONFIG
41 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg)
42 .dword CONFIG_ETRAX_MEM_GRP4_CONFIG
43 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp0)
44 .dword CONFIG_ETRAX_SDRAM_GRP0_CONFIG
45 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp1)
46 .dword CONFIG_ETRAX_SDRAM_GRP1_CONFIG
47 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing)
48 .dword CONFIG_ETRAX_SDRAM_TIMING
49 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cmd)
50 .dword CONFIG_ETRAX_SDRAM_COMMAND
51
52 .dword REG_ADDR(gio, regi_gio, rw_pa_dout)
53 .dword CONFIG_ETRAX_DEF_GIO_PA_OUT
54 .dword REG_ADDR(gio, regi_gio, rw_pa_oe)
55 .dword CONFIG_ETRAX_DEF_GIO_PA_OE
56 .dword REG_ADDR(gio, regi_gio, rw_pb_dout)
57 .dword CONFIG_ETRAX_DEF_GIO_PB_OUT
58 .dword REG_ADDR(gio, regi_gio, rw_pb_oe)
59 .dword CONFIG_ETRAX_DEF_GIO_PB_OE
60 .dword REG_ADDR(gio, regi_gio, rw_pc_dout)
61 .dword CONFIG_ETRAX_DEF_GIO_PC_OUT
62 .dword REG_ADDR(gio, regi_gio, rw_pc_oe)
63 .dword CONFIG_ETRAX_DEF_GIO_PC_OE
64 .dword REG_ADDR(gio, regi_gio, rw_pd_dout)
65 .dword CONFIG_ETRAX_DEF_GIO_PD_OUT
66 .dword REG_ADDR(gio, regi_gio, rw_pd_oe)
67 .dword CONFIG_ETRAX_DEF_GIO_PD_OE
68 .dword REG_ADDR(gio, regi_gio, rw_pe_dout)
69 .dword CONFIG_ETRAX_DEF_GIO_PE_OUT
70 .dword REG_ADDR(gio, regi_gio, rw_pe_oe)
71 .dword CONFIG_ETRAX_DEF_GIO_PE_OE
72
73 .dword 0 ; No more register values
diff --git a/arch/cris/arch-v32/lib/memset.c b/arch/cris/arch-v32/lib/memset.c
new file mode 100644
index 000000000000..ffca1214674e
--- /dev/null
+++ b/arch/cris/arch-v32/lib/memset.c
@@ -0,0 +1,253 @@
1/*#************************************************************************#*/
2/*#-------------------------------------------------------------------------*/
3/*# */
4/*# FUNCTION NAME: memset() */
5/*# */
6/*# PARAMETERS: void* dst; Destination address. */
7/*# int c; Value of byte to write. */
8/*# int len; Number of bytes to write. */
9/*# */
10/*# RETURNS: dst. */
11/*# */
12/*# DESCRIPTION: Sets the memory dst of length len bytes to c, as standard. */
13/*# Framework taken from memcpy. This routine is */
14/*# very sensitive to compiler changes in register allocation. */
15/*# Should really be rewritten to avoid this problem. */
16/*# */
17/*#-------------------------------------------------------------------------*/
18/*# */
19/*# HISTORY */
20/*# */
21/*# DATE NAME CHANGES */
22/*# ---- ---- ------- */
23/*# 990713 HP Tired of watching this function (or */
24/*# really, the nonoptimized generic */
25/*# implementation) take up 90% of simulator */
26/*# output. Measurements needed. */
27/*# */
28/*#-------------------------------------------------------------------------*/
29
30#include <linux/types.h>
31
32/* No, there's no macro saying 12*4, since it is "hard" to get it into
33 the asm in a good way. Thus better to expose the problem everywhere.
34 */
35
36/* Assuming 1 cycle per dword written or read (ok, not really true), and
37 one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1)
38 so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */
39
40#define ZERO_BLOCK_SIZE (1*12*4)
41
42void *memset(void *pdst,
43 int c,
44 size_t plen)
45{
46 /* Ok. Now we want the parameters put in special registers.
47 Make sure the compiler is able to make something useful of this. */
48
49 register char *return_dst __asm__ ("r10") = pdst;
50 register int n __asm__ ("r12") = plen;
51 register int lc __asm__ ("r11") = c;
52
53 /* Most apps use memset sanely. Only those memsetting about 3..4
54 bytes or less get penalized compared to the generic implementation
55 - and that's not really sane use. */
56
57 /* Ugh. This is fragile at best. Check with newer GCC releases, if
58 they compile cascaded "x |= x << 8" sanely! */
59 __asm__("movu.b %0,$r13 \n\
60 lslq 8,$r13 \n\
61 move.b %0,$r13 \n\
62 move.d $r13,%0 \n\
63 lslq 16,$r13 \n\
64 or.d $r13,%0"
65 : "=r" (lc) : "0" (lc) : "r13");
66
67 {
68 register char *dst __asm__ ("r13") = pdst;
69
70 /* This is NONPORTABLE, but since this whole routine is */
71 /* grossly nonportable that doesn't matter. */
72
73 if (((unsigned long) pdst & 3) != 0
74 /* Oops! n=0 must be a legal call, regardless of alignment. */
75 && n >= 3)
76 {
77 if ((unsigned long)dst & 1)
78 {
79 *dst = (char) lc;
80 n--;
81 dst++;
82 }
83
84 if ((unsigned long)dst & 2)
85 {
86 *(short *)dst = lc;
87 n -= 2;
88 dst += 2;
89 }
90 }
91
92 /* Now the fun part. For the threshold value of this, check the equation
93 above. */
94 /* Decide which copying method to use. */
95 if (n >= ZERO_BLOCK_SIZE)
96 {
97 /* For large copies we use 'movem' */
98
99 /* It is not optimal to tell the compiler about clobbering any
100 registers; that will move the saving/restoring of those registers
101 to the function prologue/epilogue, and make non-movem sizes
102 suboptimal.
103
104 This method is not foolproof; it assumes that the "asm reg"
105 declarations at the beginning of the function really are used
106 here (beware: they may be moved to temporary registers).
107 This way, we do not have to save/move the registers around into
108 temporaries; we can safely use them straight away.
109
110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" \n\
114 ;; Check that the register asm declaration got right. \n\
115 ;; The GCC manual says it will work, but there *has* been bugs. \n\
116 .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
117 .err \n\
118 .endif \n\
119 \n\
120 ;; Save the registers we'll clobber in the movem process \n\
121 ;; on the stack. Don't mention them to gcc, it will only be \n\
122 ;; upset. \n\
123 subq 11*4,$sp \n\
124 movem $r10,[$sp] \n\
125 \n\
126 move.d $r11,$r0 \n\
127 move.d $r11,$r1 \n\
128 move.d $r11,$r2 \n\
129 move.d $r11,$r3 \n\
130 move.d $r11,$r4 \n\
131 move.d $r11,$r5 \n\
132 move.d $r11,$r6 \n\
133 move.d $r11,$r7 \n\
134 move.d $r11,$r8 \n\
135 move.d $r11,$r9 \n\
136 move.d $r11,$r10 \n\
137 \n\
138 ;; Now we've got this: \n\
139 ;; r13 - dst \n\
140 ;; r12 - n \n\
141 \n\
142 ;; Update n for the first loop \n\
143 subq 12*4,$r12 \n\
1440: \n\
145 subq 12*4,$r12 \n\
146 bge 0b \n\
147 movem $r11,[$r13+] \n\
148 \n\
149 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
150 \n\
151 ;; Restore registers from stack \n\
152 movem [$sp+],$r10"
153
154 /* Outputs */ : "=r" (dst), "=r" (n)
155 /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
156 }
157
158 /* Either we directly starts copying, using dword copying
159 in a loop, or we copy as much as possible with 'movem'
160 and then the last block (<44 bytes) is copied here.
161 This will work since 'movem' will have updated src,dst,n. */
162
163 while ( n >= 16 )
164 {
165 *((long*)dst)++ = lc;
166 *((long*)dst)++ = lc;
167 *((long*)dst)++ = lc;
168 *((long*)dst)++ = lc;
169 n -= 16;
170 }
171
172 /* A switch() is definitely the fastest although it takes a LOT of code.
173 * Particularly if you inline code this.
174 */
175 switch (n)
176 {
177 case 0:
178 break;
179 case 1:
180 *(char*)dst = (char) lc;
181 break;
182 case 2:
183 *(short*)dst = (short) lc;
184 break;
185 case 3:
186 *((short*)dst)++ = (short) lc;
187 *(char*)dst = (char) lc;
188 break;
189 case 4:
190 *((long*)dst)++ = lc;
191 break;
192 case 5:
193 *((long*)dst)++ = lc;
194 *(char*)dst = (char) lc;
195 break;
196 case 6:
197 *((long*)dst)++ = lc;
198 *(short*)dst = (short) lc;
199 break;
200 case 7:
201 *((long*)dst)++ = lc;
202 *((short*)dst)++ = (short) lc;
203 *(char*)dst = (char) lc;
204 break;
205 case 8:
206 *((long*)dst)++ = lc;
207 *((long*)dst)++ = lc;
208 break;
209 case 9:
210 *((long*)dst)++ = lc;
211 *((long*)dst)++ = lc;
212 *(char*)dst = (char) lc;
213 break;
214 case 10:
215 *((long*)dst)++ = lc;
216 *((long*)dst)++ = lc;
217 *(short*)dst = (short) lc;
218 break;
219 case 11:
220 *((long*)dst)++ = lc;
221 *((long*)dst)++ = lc;
222 *((short*)dst)++ = (short) lc;
223 *(char*)dst = (char) lc;
224 break;
225 case 12:
226 *((long*)dst)++ = lc;
227 *((long*)dst)++ = lc;
228 *((long*)dst)++ = lc;
229 break;
230 case 13:
231 *((long*)dst)++ = lc;
232 *((long*)dst)++ = lc;
233 *((long*)dst)++ = lc;
234 *(char*)dst = (char) lc;
235 break;
236 case 14:
237 *((long*)dst)++ = lc;
238 *((long*)dst)++ = lc;
239 *((long*)dst)++ = lc;
240 *(short*)dst = (short) lc;
241 break;
242 case 15:
243 *((long*)dst)++ = lc;
244 *((long*)dst)++ = lc;
245 *((long*)dst)++ = lc;
246 *((short*)dst)++ = (short) lc;
247 *(char*)dst = (char) lc;
248 break;
249 }
250 }
251
252 return return_dst; /* destination pointer. */
253} /* memset() */
diff --git a/arch/cris/arch-v32/lib/nand_init.S b/arch/cris/arch-v32/lib/nand_init.S
new file mode 100644
index 000000000000..aba5c751c282
--- /dev/null
+++ b/arch/cris/arch-v32/lib/nand_init.S
@@ -0,0 +1,179 @@
1##=============================================================================
2##
3## nand_init.S
4##
5## The bootrom copies data from the NAND flash to the internal RAM but
6## due to a bug/feature we can only trust the 256 first bytes. So this
7## code copies more data from NAND flash to internal RAM. Obvioulsy this
8## code must fit in the first 256 bytes so alter with care.
9##
10## Some notes about the bug/feature for future reference:
11## The bootrom copies the first 127 KB from NAND flash to internal
12## memory. The problem is that it does a bytewise copy. NAND flashes
13## does autoincrement on the address so for a 16-bite device each
14## read/write increases the address by two. So the copy loop in the
15## bootrom will discard every second byte. This is solved by inserting
16## zeroes in every second byte in the first erase block.
17##
18## The bootrom also incorrectly assumes that it can read the flash
19## linear with only one read command but the flash will actually
20## switch between normal area and spare area if you do that so we
21## can't trust more than the first 256 bytes.
22##
23##=============================================================================
24
25#include <asm/arch/hwregs/asm/reg_map_asm.h>
26#include <asm/arch/hwregs/asm/gio_defs_asm.h>
27#include <asm/arch/hwregs/asm/pinmux_defs_asm.h>
28#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
29#include <asm/arch/hwregs/asm/config_defs_asm.h>
30#include <linux/config.h>
31
32;; There are 8-bit NAND flashes and 16-bit NAND flashes.
33;; We need to treat them slightly different.
34#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
35#define PAGE_SIZE 256
36#else
37#error 2
38#define PAGE_SIZE 512
39#endif
40#define ERASE_BLOCK 16384
41
42;; GPIO pins connected to NAND flash
43#define CE 4
44#define CLE 5
45#define ALE 6
46#define BY 7
47
48;; Address space for NAND flash
49#define NAND_RD_ADDR 0x90000000
50#define NAND_WR_ADDR 0x94000000
51
52#define READ_CMD 0x00
53
54;; Readability macros
55#define CSP_MASK \
56 REG_MASK(bif_core, rw_grp3_cfg, gated_csp0) | \
57 REG_MASK(bif_core, rw_grp3_cfg, gated_csp1)
58#define CSP_VAL \
59 REG_STATE(bif_core, rw_grp3_cfg, gated_csp0, rd) | \
60 REG_STATE(bif_core, rw_grp3_cfg, gated_csp1, wr)
61
62;;----------------------------------------------------------------------------
63;; Macros to set/clear GPIO bits
64
65.macro SET x
66 or.b (1<<\x),$r9
67 move.d $r9, [$r2]
68.endm
69
70.macro CLR x
71 and.b ~(1<<\x),$r9
72 move.d $r9, [$r2]
73.endm
74
75;;----------------------------------------------------------------------------
76
77nand_boot:
78 ;; Check if nand boot was selected
79 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
80 move.d [$r0], $r0
81 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
82 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
83 bne normal_boot ; No NAND boot
84 nop
85
86copy_nand_to_ram:
87 ;; copy_nand_to_ram
88 ;; Arguments
89 ;; r10 - destination
90 ;; r11 - source offset
91 ;; r12 - size
92 ;; r13 - Address to jump to after completion
93 ;; Note : r10-r12 are clobbered on return
94 ;; Registers used:
95 ;; r0 - NAND_RD_ADDR
96 ;; r1 - NAND_WR_ADDR
97 ;; r2 - reg_gio_rw_pa_dout
98 ;; r3 - reg_gio_r_pa_din
99 ;; r4 - tmp
100 ;; r5 - byte counter within a page
101 ;; r6 - reg_pinmux_rw_pa
102 ;; r7 - reg_gio_rw_pa_oe
103 ;; r8 - reg_bif_core_rw_grp3_cfg
104 ;; r9 - reg_gio_rw_pa_dout shadow
105 move.d 0x90000000, $r0
106 move.d 0x94000000, $r1
107 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r2
108 move.d REG_ADDR(gio, regi_gio, r_pa_din), $r3
109 move.d REG_ADDR(pinmux, regi_pinmux, rw_pa), $r6
110 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r7
111 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r8
112
113#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
114 lsrq 1, $r11
115#endif
116 ;; Set up GPIO
117 move.d [$r2], $r9
118 move.d [$r7], $r4
119 or.b (1<<ALE) | (1 << CLE) | (1<<CE), $r4
120 move.d $r4, [$r7]
121
122 ;; Set up bif
123 move.d [$r8], $r4
124 and.d CSP_MASK, $r4
125 or.d CSP_VAL, $r4
126 move.d $r4, [$r8]
127
1281: ;; Copy one page
129 CLR CE
130 SET CLE
131 moveq READ_CMD, $r4
132 move.b $r4, [$r1]
133 moveq 20, $r4
1342: bne 2b
135 subq 1, $r4
136 CLR CLE
137 SET ALE
138 clear.w [$r1] ; Column address = 0
139 move.d $r11, $r4
140 lsrq 8, $r4
141 move.b $r4, [$r1] ; Row address
142 lsrq 8, $r4
143 move.b $r4, [$r1] ; Row adddress
144 moveq 20, $r4
1452: bne 2b
146 subq 1, $r4
147 CLR ALE
1482: move.d [$r3], $r4
149 and.d 1 << BY, $r4
150 beq 2b
151 movu.w PAGE_SIZE, $r5
1522: ; Copy one byte/word
153#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
154 move.w [$r0], $r4
155#else
156 move.b [$r0], $r4
157#endif
158 subq 1, $r5
159 bne 2b
160#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
161 move.w $r4, [$r10+]
162 subu.w PAGE_SIZE*2, $r12
163#else
164 move.b $r4, [$r10+]
165 subu.w PAGE_SIZE, $r12
166#endif
167 bpl 1b
168 addu.w PAGE_SIZE, $r11
169
170 ;; End of copy
171 jump $r13
172 nop
173
174 ;; This will warn if the code above is too large. If you consider
175 ;; to remove this you don't understand the bug/feature.
176 .org 256
177 .org ERASE_BLOCK
178
179normal_boot:
diff --git a/arch/cris/arch-v32/lib/spinlock.S b/arch/cris/arch-v32/lib/spinlock.S
new file mode 100644
index 000000000000..2437ae7f6ed2
--- /dev/null
+++ b/arch/cris/arch-v32/lib/spinlock.S
@@ -0,0 +1,33 @@
1;; Core of the spinlock implementation
2;;
3;; Copyright (C) 2004 Axis Communications AB.
4;;
5;; Author: Mikael Starvik
6
7
8 .global cris_spin_lock
9 .global cris_spin_trylock
10
11 .text
12
13cris_spin_lock:
14 clearf p
151: test.d [$r10]
16 beq 1b
17 clearf p
18 ax
19 clear.d [$r10]
20 bcs 1b
21 clearf p
22 ret
23 nop
24
25cris_spin_trylock:
26 clearf p
271: move.d [$r10], $r11
28 ax
29 clear.d [$r10]
30 bcs 1b
31 clearf p
32 ret
33 move.d $r11,$r10
diff --git a/arch/cris/arch-v32/lib/string.c b/arch/cris/arch-v32/lib/string.c
new file mode 100644
index 000000000000..98e282ac824a
--- /dev/null
+++ b/arch/cris/arch-v32/lib/string.c
@@ -0,0 +1,219 @@
1/*#************************************************************************#*/
2/*#-------------------------------------------------------------------------*/
3/*# */
4/*# FUNCTION NAME: memcpy() */
5/*# */
6/*# PARAMETERS: void* dst; Destination address. */
7/*# void* src; Source address. */
8/*# int len; Number of bytes to copy. */
9/*# */
10/*# RETURNS: dst. */
11/*# */
12/*# DESCRIPTION: Copies len bytes of memory from src to dst. No guarantees */
13/*# about copying of overlapping memory areas. This routine is */
14/*# very sensitive to compiler changes in register allocation. */
15/*# Should really be rewritten to avoid this problem. */
16/*# */
17/*#-------------------------------------------------------------------------*/
18/*# */
19/*# HISTORY */
20/*# */
21/*# DATE NAME CHANGES */
22/*# ---- ---- ------- */
23/*# 941007 Kenny R Creation */
24/*# 941011 Kenny R Lots of optimizations and inlining. */
25/*# 941129 Ulf A Adapted for use in libc. */
26/*# 950216 HP N==0 forgotten if non-aligned src/dst. */
27/*# Added some optimizations. */
28/*# 001025 HP Make src and dst char *. Align dst to */
29/*# dword, not just word-if-both-src-and-dst- */
30/*# are-misaligned. */
31/*# */
32/*#-------------------------------------------------------------------------*/
33
34#include <linux/types.h>
35
36void *memcpy(void *pdst,
37 const void *psrc,
38 size_t pn)
39{
40 /* Ok. Now we want the parameters put in special registers.
41 Make sure the compiler is able to make something useful of this.
42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
43
44 If gcc was allright, it really would need no temporaries, and no
45 stack space to save stuff on. */
46
47 register void *return_dst __asm__ ("r10") = pdst;
48 register char *dst __asm__ ("r13") = pdst;
49 register const char *src __asm__ ("r11") = psrc;
50 register int n __asm__ ("r12") = pn;
51
52
53 /* When src is aligned but not dst, this makes a few extra needless
54 cycles. I believe it would take as many to check that the
55 re-alignment was unnecessary. */
56 if (((unsigned long) dst & 3) != 0
57 /* Don't align if we wouldn't copy more than a few bytes; so we
58 don't have to check further for overflows. */
59 && n >= 3)
60 {
61 if ((unsigned long) dst & 1)
62 {
63 n--;
64 *(char*)dst = *(char*)src;
65 src++;
66 dst++;
67 }
68
69 if ((unsigned long) dst & 2)
70 {
71 n -= 2;
72 *(short*)dst = *(short*)src;
73 src += 2;
74 dst += 2;
75 }
76 }
77
78 /* Decide which copying method to use. Movem is dirt cheap, so the
79 overheap is low enough to always use the minimum block size as the
80 threshold. */
81 if (n >= 44)
82 {
83 /* For large copies we use 'movem' */
84
85 /* It is not optimal to tell the compiler about clobbering any
86 registers; that will move the saving/restoring of those registers
87 to the function prologue/epilogue, and make non-movem sizes
88 suboptimal. */
89 __asm__ volatile (" \n\
90 ;; Check that the register asm declaration got right. \n\
91 ;; The GCC manual explicitly says TRT will happen. \n\
92 .ifnc %0-%1-%2,$r13-$r11-$r12 \n\
93 .err \n\
94 .endif \n\
95 \n\
96 ;; Save the registers we'll use in the movem process \n\
97 \n\
98 ;; on the stack. \n\
99 subq 11*4,$sp \n\
100 movem $r10,[$sp] \n\
101 \n\
102 ;; Now we've got this: \n\
103 ;; r11 - src \n\
104 ;; r13 - dst \n\
105 ;; r12 - n \n\
106 \n\
107 ;; Update n for the first loop \n\
108 subq 44,$r12 \n\
1090: \n\
110 movem [$r11+],$r10 \n\
111 subq 44,$r12 \n\
112 bge 0b \n\
113 movem $r10,[$r13+] \n\
114 \n\
115 addq 44,$r12 ;; compensate for last loop underflowing n \n\
116 \n\
117 ;; Restore registers from stack \n\
118 movem [$sp+],$r10"
119
120 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n)
121 /* Inputs */ : "0" (dst), "1" (src), "2" (n));
122
123 }
124
125 /* Either we directly starts copying, using dword copying
126 in a loop, or we copy as much as possible with 'movem'
127 and then the last block (<44 bytes) is copied here.
128 This will work since 'movem' will have updated src,dst,n. */
129
130 while ( n >= 16 )
131 {
132 *((long*)dst)++ = *((long*)src)++;
133 *((long*)dst)++ = *((long*)src)++;
134 *((long*)dst)++ = *((long*)src)++;
135 *((long*)dst)++ = *((long*)src)++;
136 n -= 16;
137 }
138
139 /* A switch() is definitely the fastest although it takes a LOT of code.
140 * Particularly if you inline code this.
141 */
142 switch (n)
143 {
144 case 0:
145 break;
146 case 1:
147 *(char*)dst = *(char*)src;
148 break;
149 case 2:
150 *(short*)dst = *(short*)src;
151 break;
152 case 3:
153 *((short*)dst)++ = *((short*)src)++;
154 *(char*)dst = *(char*)src;
155 break;
156 case 4:
157 *((long*)dst)++ = *((long*)src)++;
158 break;
159 case 5:
160 *((long*)dst)++ = *((long*)src)++;
161 *(char*)dst = *(char*)src;
162 break;
163 case 6:
164 *((long*)dst)++ = *((long*)src)++;
165 *(short*)dst = *(short*)src;
166 break;
167 case 7:
168 *((long*)dst)++ = *((long*)src)++;
169 *((short*)dst)++ = *((short*)src)++;
170 *(char*)dst = *(char*)src;
171 break;
172 case 8:
173 *((long*)dst)++ = *((long*)src)++;
174 *((long*)dst)++ = *((long*)src)++;
175 break;
176 case 9:
177 *((long*)dst)++ = *((long*)src)++;
178 *((long*)dst)++ = *((long*)src)++;
179 *(char*)dst = *(char*)src;
180 break;
181 case 10:
182 *((long*)dst)++ = *((long*)src)++;
183 *((long*)dst)++ = *((long*)src)++;
184 *(short*)dst = *(short*)src;
185 break;
186 case 11:
187 *((long*)dst)++ = *((long*)src)++;
188 *((long*)dst)++ = *((long*)src)++;
189 *((short*)dst)++ = *((short*)src)++;
190 *(char*)dst = *(char*)src;
191 break;
192 case 12:
193 *((long*)dst)++ = *((long*)src)++;
194 *((long*)dst)++ = *((long*)src)++;
195 *((long*)dst)++ = *((long*)src)++;
196 break;
197 case 13:
198 *((long*)dst)++ = *((long*)src)++;
199 *((long*)dst)++ = *((long*)src)++;
200 *((long*)dst)++ = *((long*)src)++;
201 *(char*)dst = *(char*)src;
202 break;
203 case 14:
204 *((long*)dst)++ = *((long*)src)++;
205 *((long*)dst)++ = *((long*)src)++;
206 *((long*)dst)++ = *((long*)src)++;
207 *(short*)dst = *(short*)src;
208 break;
209 case 15:
210 *((long*)dst)++ = *((long*)src)++;
211 *((long*)dst)++ = *((long*)src)++;
212 *((long*)dst)++ = *((long*)src)++;
213 *((short*)dst)++ = *((short*)src)++;
214 *(char*)dst = *(char*)src;
215 break;
216 }
217
218 return return_dst; /* destination pointer. */
219} /* memcpy() */
diff --git a/arch/cris/arch-v32/lib/usercopy.c b/arch/cris/arch-v32/lib/usercopy.c
new file mode 100644
index 000000000000..f0b08460c1be
--- /dev/null
+++ b/arch/cris/arch-v32/lib/usercopy.c
@@ -0,0 +1,470 @@
1/*
2 * User address space access functions.
3 * The non-inlined parts of asm-cris/uaccess.h are here.
4 *
5 * Copyright (C) 2000, 2003 Axis Communications AB.
6 *
7 * Written by Hans-Peter Nilsson.
8 * Pieces used from memcpy, originally by Kenny Ranerup long time ago.
9 */
10
11#include <asm/uaccess.h>
12
13/* Asm:s have been tweaked (within the domain of correctness) to give
14 satisfactory results for "gcc version 3.2.1 Axis release R53/1.53-v32".
15
16 Check regularly...
17
18 Note that for CRISv32, the PC saved at a bus-fault is the address
19 *at* the faulting instruction, with a special case for instructions
20 in delay slots: then it's the address of the branch. Note also that
21 in contrast to v10, a postincrement in the instruction is *not*
22 performed at a bus-fault; the register is seen having the original
23 value in fault handlers. */
24
25
26/* Copy to userspace. This is based on the memcpy used for
27 kernel-to-kernel copying; see "string.c". */
28
29unsigned long
30__copy_user (void __user *pdst, const void *psrc, unsigned long pn)
31{
32 /* We want the parameters put in special registers.
33 Make sure the compiler is able to make something useful of this.
34 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
35
36 FIXME: Comment for old gcc version. Check.
37 If gcc was allright, it really would need no temporaries, and no
38 stack space to save stuff on. */
39
40 register char *dst __asm__ ("r13") = pdst;
41 register const char *src __asm__ ("r11") = psrc;
42 register int n __asm__ ("r12") = pn;
43 register int retn __asm__ ("r10") = 0;
44
45
46 /* When src is aligned but not dst, this makes a few extra needless
47 cycles. I believe it would take as many to check that the
48 re-alignment was unnecessary. */
49 if (((unsigned long) dst & 3) != 0
50 /* Don't align if we wouldn't copy more than a few bytes; so we
51 don't have to check further for overflows. */
52 && n >= 3)
53 {
54 if ((unsigned long) dst & 1)
55 {
56 __asm_copy_to_user_1 (dst, src, retn);
57 n--;
58 }
59
60 if ((unsigned long) dst & 2)
61 {
62 __asm_copy_to_user_2 (dst, src, retn);
63 n -= 2;
64 }
65 }
66
67 /* Movem is dirt cheap. The overheap is low enough to always use the
68 minimum possible block size as the threshold. */
69 if (n >= 44)
70 {
71 /* For large copies we use 'movem'. */
72
73 /* It is not optimal to tell the compiler about clobbering any
74 registers; that will move the saving/restoring of those registers
75 to the function prologue/epilogue, and make non-movem sizes
76 suboptimal. */
77 __asm__ volatile ("\
78 ;; Check that the register asm declaration got right. \n\
79 ;; The GCC manual explicitly says TRT will happen. \n\
80 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
81 .err \n\
82 .endif \n\
83 \n\
84 ;; Save the registers we'll use in the movem process \n\
85 ;; on the stack. \n\
86 subq 11*4,$sp \n\
87 movem $r10,[$sp] \n\
88 \n\
89 ;; Now we've got this: \n\
90 ;; r11 - src \n\
91 ;; r13 - dst \n\
92 ;; r12 - n \n\
93 \n\
94 ;; Update n for the first loop \n\
95 subq 44,$r12 \n\
960: \n\
97 movem [$r11+],$r10 \n\
98 subq 44,$r12 \n\
991: bge 0b \n\
100 movem $r10,[$r13+] \n\
1013: \n\
102 addq 44,$r12 ;; compensate for last loop underflowing n \n\
103 \n\
104 ;; Restore registers from stack \n\
105 movem [$sp+],$r10 \n\
1062: \n\
107 .section .fixup,\"ax\" \n\
1084: \n\
109; When failing on any of the 1..44 bytes in a chunk, we adjust back the \n\
110; source pointer and just drop through to the by-16 and by-4 loops to \n\
111; get the correct number of failing bytes. This necessarily means a \n\
112; few extra exceptions, but invalid user pointers shouldn't happen in \n\
113; time-critical code anyway. \n\
114 jump 3b \n\
115 subq 44,$r11 \n\
116 \n\
117 .previous \n\
118 .section __ex_table,\"a\" \n\
119 .dword 1b,4b \n\
120 .previous"
121
122 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
123 /* Inputs */ : "0" (dst), "1" (src), "2" (n), "3" (retn));
124
125 }
126
127 while (n >= 16)
128 {
129 __asm_copy_to_user_16 (dst, src, retn);
130 n -= 16;
131 }
132
133 /* Having a separate by-four loops cuts down on cache footprint.
134 FIXME: Test with and without; increasing switch to be 0..15. */
135 while (n >= 4)
136 {
137 __asm_copy_to_user_4 (dst, src, retn);
138 n -= 4;
139 }
140
141 switch (n)
142 {
143 case 0:
144 break;
145 case 1:
146 __asm_copy_to_user_1 (dst, src, retn);
147 break;
148 case 2:
149 __asm_copy_to_user_2 (dst, src, retn);
150 break;
151 case 3:
152 __asm_copy_to_user_3 (dst, src, retn);
153 break;
154 }
155
156 return retn;
157}
158
159/* Copy from user to kernel, zeroing the bytes that were inaccessible in
160 userland. The return-value is the number of bytes that were
161 inaccessible. */
162
163unsigned long
164__copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
165{
166 /* We want the parameters put in special registers.
167 Make sure the compiler is able to make something useful of this.
168 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
169
170 FIXME: Comment for old gcc version. Check.
171 If gcc was allright, it really would need no temporaries, and no
172 stack space to save stuff on. */
173
174 register char *dst __asm__ ("r13") = pdst;
175 register const char *src __asm__ ("r11") = psrc;
176 register int n __asm__ ("r12") = pn;
177 register int retn __asm__ ("r10") = 0;
178
179 /* The best reason to align src is that we then know that a read-fault
180 was for aligned bytes; there's no 1..3 remaining good bytes to
181 pickle. */
182 if (((unsigned long) src & 3) != 0)
183 {
184 if (((unsigned long) src & 1) && n != 0)
185 {
186 __asm_copy_from_user_1 (dst, src, retn);
187 n--;
188 }
189
190 if (((unsigned long) src & 2) && n >= 2)
191 {
192 __asm_copy_from_user_2 (dst, src, retn);
193 n -= 2;
194 }
195
196 /* We only need one check after the unalignment-adjustments, because
197 if both adjustments were done, either both or neither reference
198 had an exception. */
199 if (retn != 0)
200 goto copy_exception_bytes;
201 }
202
203 /* Movem is dirt cheap. The overheap is low enough to always use the
204 minimum possible block size as the threshold. */
205 if (n >= 44)
206 {
207 /* It is not optimal to tell the compiler about clobbering any
208 registers; that will move the saving/restoring of those registers
209 to the function prologue/epilogue, and make non-movem sizes
210 suboptimal. */
211 __asm__ volatile ("\
212 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
213 .err \n\
214 .endif \n\
215 \n\
216 ;; Save the registers we'll use in the movem process \n\
217 ;; on the stack. \n\
218 subq 11*4,$sp \n\
219 movem $r10,[$sp] \n\
220 \n\
221 ;; Now we've got this: \n\
222 ;; r11 - src \n\
223 ;; r13 - dst \n\
224 ;; r12 - n \n\
225 \n\
226 ;; Update n for the first loop \n\
227 subq 44,$r12 \n\
2280: \n\
229 movem [$r11+],$r10 \n\
230 \n\
231 subq 44,$r12 \n\
232 bge 0b \n\
233 movem $r10,[$r13+] \n\
234 \n\
2354: \n\
236 addq 44,$r12 ;; compensate for last loop underflowing n \n\
237 \n\
238 ;; Restore registers from stack \n\
239 movem [$sp+],$r10 \n\
240 .section .fixup,\"ax\" \n\
241 \n\
242;; Do not jump back into the loop if we fail. For some uses, we get a \n\
243;; page fault somewhere on the line. Without checking for page limits, \n\
244;; we don't know where, but we need to copy accurately and keep an \n\
245;; accurate count; not just clear the whole line. To do that, we fall \n\
246;; down in the code below, proceeding with smaller amounts. It should \n\
247;; be kept in mind that we have to cater to code like what at one time \n\
248;; was in fs/super.c: \n\
249;; i = size - copy_from_user((void *)page, data, size); \n\
250;; which would cause repeated faults while clearing the remainder of \n\
251;; the SIZE bytes at PAGE after the first fault. \n\
252;; A caveat here is that we must not fall through from a failing page \n\
253;; to a valid page. \n\
254 \n\
2553: \n\
256 jump 4b ;; Fall through, pretending the fault didn't happen. \n\
257 nop \n\
258 \n\
259 .previous \n\
260 .section __ex_table,\"a\" \n\
261 .dword 0b,3b \n\
262 .previous"
263
264 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
265 /* Inputs */ : "0" (dst), "1" (src), "2" (n), "3" (retn));
266 }
267
268 /* Either we directly start copying here, using dword copying in a loop,
269 or we copy as much as possible with 'movem' and then the last block
270 (<44 bytes) is copied here. This will work since 'movem' will have
271 updated src, dst and n. (Except with failing src.)
272
273 Since we want to keep src accurate, we can't use
274 __asm_copy_from_user_N with N != (1, 2, 4); it updates dst and
275 retn, but not src (by design; it's value is ignored elsewhere). */
276
277 while (n >= 4)
278 {
279 __asm_copy_from_user_4 (dst, src, retn);
280 n -= 4;
281
282 if (retn)
283 goto copy_exception_bytes;
284 }
285
286 /* If we get here, there were no memory read faults. */
287 switch (n)
288 {
289 /* These copies are at least "naturally aligned" (so we don't have
290 to check each byte), due to the src alignment code before the
291 movem loop. The *_3 case *will* get the correct count for retn. */
292 case 0:
293 /* This case deliberately left in (if you have doubts check the
294 generated assembly code). */
295 break;
296 case 1:
297 __asm_copy_from_user_1 (dst, src, retn);
298 break;
299 case 2:
300 __asm_copy_from_user_2 (dst, src, retn);
301 break;
302 case 3:
303 __asm_copy_from_user_3 (dst, src, retn);
304 break;
305 }
306
307 /* If we get here, retn correctly reflects the number of failing
308 bytes. */
309 return retn;
310
311copy_exception_bytes:
312 /* We already have "retn" bytes cleared, and need to clear the
313 remaining "n" bytes. A non-optimized simple byte-for-byte in-line
314 memset is preferred here, since this isn't speed-critical code and
315 we'd rather have this a leaf-function than calling memset. */
316 {
317 char *endp;
318 for (endp = dst + n; dst < endp; dst++)
319 *dst = 0;
320 }
321
322 return retn + n;
323}
324
325/* Zero userspace. */
326
327unsigned long
328__do_clear_user (void __user *pto, unsigned long pn)
329{
330 /* We want the parameters put in special registers.
331 Make sure the compiler is able to make something useful of this.
332 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
333
334 FIXME: Comment for old gcc version. Check.
335 If gcc was allright, it really would need no temporaries, and no
336 stack space to save stuff on. */
337
338 register char *dst __asm__ ("r13") = pto;
339 register int n __asm__ ("r12") = pn;
340 register int retn __asm__ ("r10") = 0;
341
342
343 if (((unsigned long) dst & 3) != 0
344 /* Don't align if we wouldn't copy more than a few bytes. */
345 && n >= 3)
346 {
347 if ((unsigned long) dst & 1)
348 {
349 __asm_clear_1 (dst, retn);
350 n--;
351 }
352
353 if ((unsigned long) dst & 2)
354 {
355 __asm_clear_2 (dst, retn);
356 n -= 2;
357 }
358 }
359
360 /* Decide which copying method to use.
361 FIXME: This number is from the "ordinary" kernel memset. */
362 if (n >= 48)
363 {
364 /* For large clears we use 'movem' */
365
366 /* It is not optimal to tell the compiler about clobbering any
367 call-saved registers; that will move the saving/restoring of
368 those registers to the function prologue/epilogue, and make
369 non-movem sizes suboptimal.
370
371 This method is not foolproof; it assumes that the "asm reg"
372 declarations at the beginning of the function really are used
373 here (beware: they may be moved to temporary registers).
374 This way, we do not have to save/move the registers around into
375 temporaries; we can safely use them straight away.
376
377 If you want to check that the allocation was right; then
378 check the equalities in the first comment. It should say
379 something like "r13=r13, r11=r11, r12=r12". */
380 __asm__ volatile ("\
381 .ifnc %0%1%2,$r13$r12$r10 \n\
382 .err \n\
383 .endif \n\
384 \n\
385 ;; Save the registers we'll clobber in the movem process \n\
386 ;; on the stack. Don't mention them to gcc, it will only be \n\
387 ;; upset. \n\
388 subq 11*4,$sp \n\
389 movem $r10,[$sp] \n\
390 \n\
391 clear.d $r0 \n\
392 clear.d $r1 \n\
393 clear.d $r2 \n\
394 clear.d $r3 \n\
395 clear.d $r4 \n\
396 clear.d $r5 \n\
397 clear.d $r6 \n\
398 clear.d $r7 \n\
399 clear.d $r8 \n\
400 clear.d $r9 \n\
401 clear.d $r10 \n\
402 clear.d $r11 \n\
403 \n\
404 ;; Now we've got this: \n\
405 ;; r13 - dst \n\
406 ;; r12 - n \n\
407 \n\
408 ;; Update n for the first loop \n\
409 subq 12*4,$r12 \n\
4100: \n\
411 subq 12*4,$r12 \n\
4121: \n\
413 bge 0b \n\
414 movem $r11,[$r13+] \n\
415 \n\
416 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
417 \n\
418 ;; Restore registers from stack \n\
419 movem [$sp+],$r10 \n\
4202: \n\
421 .section .fixup,\"ax\" \n\
4223: \n\
423 movem [$sp],$r10 \n\
424 addq 12*4,$r10 \n\
425 addq 12*4,$r13 \n\
426 movem $r10,[$sp] \n\
427 jump 0b \n\
428 clear.d $r10 \n\
429 \n\
430 .previous \n\
431 .section __ex_table,\"a\" \n\
432 .dword 1b,3b \n\
433 .previous"
434
435 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn)
436 /* Inputs */ : "0" (dst), "1" (n), "2" (retn)
437 /* Clobber */ : "r11");
438 }
439
440 while (n >= 16)
441 {
442 __asm_clear_16 (dst, retn);
443 n -= 16;
444 }
445
446 /* Having a separate by-four loops cuts down on cache footprint.
447 FIXME: Test with and without; increasing switch to be 0..15. */
448 while (n >= 4)
449 {
450 __asm_clear_4 (dst, retn);
451 n -= 4;
452 }
453
454 switch (n)
455 {
456 case 0:
457 break;
458 case 1:
459 __asm_clear_1 (dst, retn);
460 break;
461 case 2:
462 __asm_clear_2 (dst, retn);
463 break;
464 case 3:
465 __asm_clear_3 (dst, retn);
466 break;
467 }
468
469 return retn;
470}
diff --git a/arch/cris/arch-v32/mm/Makefile b/arch/cris/arch-v32/mm/Makefile
new file mode 100644
index 000000000000..9146f88484b1
--- /dev/null
+++ b/arch/cris/arch-v32/mm/Makefile
@@ -0,0 +1,3 @@
1# Makefile for the Linux/cris parts of the memory manager.
2
3obj-y := mmu.o init.o tlb.o intmem.o
diff --git a/arch/cris/arch-v32/mm/init.c b/arch/cris/arch-v32/mm/init.c
new file mode 100644
index 000000000000..f2fba27d822c
--- /dev/null
+++ b/arch/cris/arch-v32/mm/init.c
@@ -0,0 +1,174 @@
1/*
2 * Set up paging and the MMU.
3 *
4 * Copyright (C) 2000-2003, Axis Communications AB.
5 *
6 * Authors: Bjorn Wesen <bjornw@axis.com>
7 * Tobias Anderberg <tobiasa@axis.com>, CRISv32 port.
8 */
9#include <linux/config.h>
10#include <linux/mmzone.h>
11#include <linux/init.h>
12#include <linux/bootmem.h>
13#include <linux/mm.h>
14#include <linux/config.h>
15#include <asm/pgtable.h>
16#include <asm/page.h>
17#include <asm/types.h>
18#include <asm/mmu.h>
19#include <asm/io.h>
20#include <asm/mmu_context.h>
21#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
22#include <asm/arch/hwregs/supp_reg.h>
23
24extern void tlb_init(void);
25
26/*
27 * The kernel is already mapped with linear mapping at kseg_c so there's no
28 * need to map it with a page table. However, head.S also temporarily mapped it
29 * at kseg_4 thus the ksegs are set up again. Also clear the TLB and do various
30 * other paging stuff.
31 */
32void __init
33cris_mmu_init(void)
34{
35 unsigned long mmu_config;
36 unsigned long mmu_kbase_hi;
37 unsigned long mmu_kbase_lo;
38 unsigned short mmu_page_id;
39
40 /*
41 * Make sure the current pgd table points to something sane, even if it
42 * is most probably not used until the next switch_mm.
43 */
44 per_cpu(current_pgd, smp_processor_id()) = init_mm.pgd;
45
46#ifdef CONFIG_SMP
47 {
48 pgd_t **pgd;
49 pgd = (pgd_t**)&per_cpu(current_pgd, smp_processor_id());
50 SUPP_BANK_SEL(1);
51 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
52 SUPP_BANK_SEL(2);
53 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
54 }
55#endif
56
57 /* Initialise the TLB. Function found in tlb.c. */
58 tlb_init();
59
60 /* Enable exceptions and initialize the kernel segments. */
61 mmu_config = ( REG_STATE(mmu, rw_mm_cfg, we, on) |
62 REG_STATE(mmu, rw_mm_cfg, acc, on) |
63 REG_STATE(mmu, rw_mm_cfg, ex, on) |
64 REG_STATE(mmu, rw_mm_cfg, inv, on) |
65 REG_STATE(mmu, rw_mm_cfg, seg_f, linear) |
66 REG_STATE(mmu, rw_mm_cfg, seg_e, linear) |
67 REG_STATE(mmu, rw_mm_cfg, seg_d, page) |
68 REG_STATE(mmu, rw_mm_cfg, seg_c, linear) |
69 REG_STATE(mmu, rw_mm_cfg, seg_b, linear) |
70#ifndef CONFIG_ETRAXFS_SIM
71 REG_STATE(mmu, rw_mm_cfg, seg_a, page) |
72#else
73 REG_STATE(mmu, rw_mm_cfg, seg_a, linear) |
74#endif
75 REG_STATE(mmu, rw_mm_cfg, seg_9, page) |
76 REG_STATE(mmu, rw_mm_cfg, seg_8, page) |
77 REG_STATE(mmu, rw_mm_cfg, seg_7, page) |
78 REG_STATE(mmu, rw_mm_cfg, seg_6, page) |
79 REG_STATE(mmu, rw_mm_cfg, seg_5, page) |
80 REG_STATE(mmu, rw_mm_cfg, seg_4, page) |
81 REG_STATE(mmu, rw_mm_cfg, seg_3, page) |
82 REG_STATE(mmu, rw_mm_cfg, seg_2, page) |
83 REG_STATE(mmu, rw_mm_cfg, seg_1, page) |
84 REG_STATE(mmu, rw_mm_cfg, seg_0, page));
85
86 mmu_kbase_hi = ( REG_FIELD(mmu, rw_mm_kbase_hi, base_f, 0x0) |
87 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x8) |
88 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x0) |
89#ifndef CONFIG_ETRAXFS_SIM
90 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) |
91#else
92 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x0) |
93#endif
94 REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) |
95#ifndef CONFIG_ETRAXFS_SIM
96 REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0x0) |
97#else
98 REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa) |
99#endif
100 REG_FIELD(mmu, rw_mm_kbase_hi, base_9, 0x0) |
101 REG_FIELD(mmu, rw_mm_kbase_hi, base_8, 0x0));
102
103 mmu_kbase_lo = ( REG_FIELD(mmu, rw_mm_kbase_lo, base_7, 0x0) |
104 REG_FIELD(mmu, rw_mm_kbase_lo, base_6, 0x0) |
105 REG_FIELD(mmu, rw_mm_kbase_lo, base_5, 0x0) |
106 REG_FIELD(mmu, rw_mm_kbase_lo, base_4, 0x0) |
107 REG_FIELD(mmu, rw_mm_kbase_lo, base_3, 0x0) |
108 REG_FIELD(mmu, rw_mm_kbase_lo, base_2, 0x0) |
109 REG_FIELD(mmu, rw_mm_kbase_lo, base_1, 0x0) |
110 REG_FIELD(mmu, rw_mm_kbase_lo, base_0, 0x0));
111
112 mmu_page_id = REG_FIELD(mmu, rw_mm_tlb_hi, pid, 0);
113
114 /* Update the instruction MMU. */
115 SUPP_BANK_SEL(BANK_IM);
116 SUPP_REG_WR(RW_MM_CFG, mmu_config);
117 SUPP_REG_WR(RW_MM_KBASE_HI, mmu_kbase_hi);
118 SUPP_REG_WR(RW_MM_KBASE_LO, mmu_kbase_lo);
119 SUPP_REG_WR(RW_MM_TLB_HI, mmu_page_id);
120
121 /* Update the data MMU. */
122 SUPP_BANK_SEL(BANK_DM);
123 SUPP_REG_WR(RW_MM_CFG, mmu_config);
124 SUPP_REG_WR(RW_MM_KBASE_HI, mmu_kbase_hi);
125 SUPP_REG_WR(RW_MM_KBASE_LO, mmu_kbase_lo);
126 SUPP_REG_WR(RW_MM_TLB_HI, mmu_page_id);
127
128 SPEC_REG_WR(SPEC_REG_PID, 0);
129
130 /*
131 * The MMU has been enabled ever since head.S but just to make it
132 * totally obvious enable it here as well.
133 */
134 SUPP_BANK_SEL(BANK_GC);
135 SUPP_REG_WR(RW_GC_CFG, 0xf); /* IMMU, DMMU, ICache, DCache on */
136}
137
138void __init
139paging_init(void)
140{
141 int i;
142 unsigned long zones_size[MAX_NR_ZONES];
143
144 printk("Setting up paging and the MMU.\n");
145
146 /* Clear out the init_mm.pgd that will contain the kernel's mappings. */
147 for(i = 0; i < PTRS_PER_PGD; i++)
148 swapper_pg_dir[i] = __pgd(0);
149
150 cris_mmu_init();
151
152 /*
153 * Initialize the bad page table and bad page to point to a couple of
154 * allocated pages.
155 */
156 empty_zero_page = (unsigned long) alloc_bootmem_pages(PAGE_SIZE);
157 memset((void *) empty_zero_page, 0, PAGE_SIZE);
158
159 /* All pages are DMA'able in Etrax, so put all in the DMA'able zone. */
160 zones_size[0] = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
161
162 for (i = 1; i < MAX_NR_ZONES; i++)
163 zones_size[i] = 0;
164
165 /*
166 * Use free_area_init_node instead of free_area_init, because it is
167 * designed for systems where the DRAM starts at an address
168 * substantially higher than 0, like us (we start at PAGE_OFFSET). This
169 * saves space in the mem_map page array.
170 */
171 free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
172
173 mem_map = contig_page_data.node_mem_map;
174}
diff --git a/arch/cris/arch-v32/mm/intmem.c b/arch/cris/arch-v32/mm/intmem.c
new file mode 100644
index 000000000000..41ee7f7997fd
--- /dev/null
+++ b/arch/cris/arch-v32/mm/intmem.c
@@ -0,0 +1,139 @@
1/*
2 * Simple allocator for internal RAM in ETRAX FS
3 *
4 * Copyright (c) 2004 Axis Communications AB.
5 */
6
7#include <linux/list.h>
8#include <linux/slab.h>
9#include <asm/io.h>
10#include <asm/arch/memmap.h>
11
12#define STATUS_FREE 0
13#define STATUS_ALLOCATED 1
14
15struct intmem_allocation {
16 struct list_head entry;
17 unsigned int size;
18 unsigned offset;
19 char status;
20};
21
22
23static struct list_head intmem_allocations;
24static void* intmem_virtual;
25
26static void crisv32_intmem_init(void)
27{
28 static int initiated = 0;
29 if (!initiated) {
30 struct intmem_allocation* alloc =
31 (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL);
32 INIT_LIST_HEAD(&intmem_allocations);
33 intmem_virtual = ioremap(MEM_INTMEM_START, MEM_INTMEM_SIZE);
34 initiated = 1;
35 alloc->size = MEM_INTMEM_SIZE;
36 alloc->offset = 0;
37 alloc->status = STATUS_FREE;
38 list_add_tail(&alloc->entry, &intmem_allocations);
39 }
40}
41
42void* crisv32_intmem_alloc(unsigned size, unsigned align)
43{
44 struct intmem_allocation* allocation;
45 struct intmem_allocation* tmp;
46 void* ret = NULL;
47
48 preempt_disable();
49 crisv32_intmem_init();
50
51 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) {
52 int alignment = allocation->offset % align;
53 alignment = alignment ? align - alignment : alignment;
54
55 if (allocation->status == STATUS_FREE &&
56 allocation->size >= size + alignment) {
57 if (allocation->size > size + alignment) {
58 struct intmem_allocation* alloc =
59 (struct intmem_allocation*)
60 kmalloc(sizeof *alloc, GFP_ATOMIC);
61 alloc->status = STATUS_FREE;
62 alloc->size = allocation->size - size - alignment;
63 alloc->offset = allocation->offset + size;
64 list_add(&alloc->entry, &allocation->entry);
65
66 if (alignment) {
67 struct intmem_allocation* tmp;
68 tmp = (struct intmem_allocation*)
69 kmalloc(sizeof *tmp, GFP_ATOMIC);
70 tmp->offset = allocation->offset;
71 tmp->size = alignment;
72 tmp->status = STATUS_FREE;
73 allocation->offset += alignment;
74 list_add_tail(&tmp->entry, &allocation->entry);
75 }
76 }
77 allocation->status = STATUS_ALLOCATED;
78 allocation->size = size;
79 ret = (void*)((int)intmem_virtual + allocation->offset);
80 }
81 }
82 preempt_enable();
83 return ret;
84}
85
86void crisv32_intmem_free(void* addr)
87{
88 struct intmem_allocation* allocation;
89 struct intmem_allocation* tmp;
90
91 if (addr == NULL)
92 return;
93
94 preempt_disable();
95 crisv32_intmem_init();
96
97 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) {
98 if (allocation->offset == (int)(addr - intmem_virtual)) {
99 struct intmem_allocation* prev =
100 list_entry(allocation->entry.prev,
101 struct intmem_allocation, entry);
102 struct intmem_allocation* next =
103 list_entry(allocation->entry.next,
104 struct intmem_allocation, entry);
105
106 allocation->status = STATUS_FREE;
107 /* Join with prev and/or next if also free */
108 if (prev->status == STATUS_FREE) {
109 prev->size += allocation->size;
110 list_del(&allocation->entry);
111 kfree(allocation);
112 allocation = prev;
113 }
114 if (next->status == STATUS_FREE) {
115 allocation->size += next->size;
116 list_del(&next->entry);
117 kfree(next);
118 }
119 preempt_enable();
120 return;
121 }
122 }
123 preempt_enable();
124}
125
126void* crisv32_intmem_phys_to_virt(unsigned long addr)
127{
128 return (void*)(addr - MEM_INTMEM_START+
129 (unsigned long)intmem_virtual);
130}
131
132unsigned long crisv32_intmem_virt_to_phys(void* addr)
133{
134 return (unsigned long)((unsigned long )addr -
135 (unsigned long)intmem_virtual + MEM_INTMEM_START);
136}
137
138
139
diff --git a/arch/cris/arch-v32/mm/mmu.S b/arch/cris/arch-v32/mm/mmu.S
new file mode 100644
index 000000000000..27b70e5006af
--- /dev/null
+++ b/arch/cris/arch-v32/mm/mmu.S
@@ -0,0 +1,141 @@
1/*
2 * Copyright (C) 2003 Axis Communications AB
3 *
4 * Authors: Mikael Starvik (starvik@axis.com)
5 *
6 * Code for the fault low-level handling routines.
7 *
8 */
9
10#include <asm/page.h>
11#include <asm/pgtable.h>
12
13; Save all register. Must save in same order as struct pt_regs.
14.macro SAVE_ALL
15 subq 12, $sp
16 move $erp, [$sp]
17 subq 4, $sp
18 move $srp, [$sp]
19 subq 4, $sp
20 move $ccs, [$sp]
21 subq 4, $sp
22 move $spc, [$sp]
23 subq 4, $sp
24 move $mof, [$sp]
25 subq 4, $sp
26 move $srs, [$sp]
27 subq 4, $sp
28 move.d $acr, [$sp]
29 subq 14*4, $sp
30 movem $r13, [$sp]
31 subq 4, $sp
32 move.d $r10, [$sp]
33.endm
34
35; Bus fault handler. Extracts relevant information and calls mm subsystem
36; to handle the fault.
37.macro MMU_BUS_FAULT_HANDLER handler, mmu, we, ex
38 .globl \handler
39\handler:
40 SAVE_ALL
41 move \mmu, $srs ; Select MMU support register bank
42 move.d $sp, $r11 ; regs
43 moveq 1, $r12 ; protection fault
44 moveq \we, $r13 ; write exception?
45 orq \ex << 1, $r13 ; execute?
46 move $s3, $r10 ; rw_mm_cause
47 and.d ~8191, $r10 ; Get faulting page start address
48
49 jsr do_page_fault
50 nop
51 ba ret_from_intr
52 nop
53.endm
54
55; Refill handler. Three cases may occur:
56; 1. PMD and PTE exists in mm subsystem but not in TLB
57; 2. PMD exists but not PTE
58; 3. PMD doesn't exist
59; The code below handles case 1 and calls the mm subsystem for case 2 and 3.
60; Do not touch this code without very good reasons and extensive testing.
61; Note that the code is optimized to minimize stalls (makes the code harder
62; to read).
63;
64; Each page is 8 KB. Each PMD holds 8192/4 PTEs (each PTE is 4 bytes) so each
65; PMD holds 16 MB of virtual memory.
66; Bits 0-12 : Offset within a page
67; Bits 13-23 : PTE offset within a PMD
68; Bits 24-31 : PMD offset within the PGD
69
70.macro MMU_REFILL_HANDLER handler, mmu
71 .globl \handler
72\handler:
73 subq 4, $sp
74; (The pipeline stalls for one cycle; $sp used as address in the next cycle.)
75 move $srs, [$sp]
76 subq 4, $sp
77 move \mmu, $srs ; Select MMU support register bank
78 move.d $acr, [$sp]
79 subq 4, $sp
80 move.d $r0, [$sp]
81#ifdef CONFIG_SMP
82 move $s7, $acr ; PGD
83#else
84 move.d per_cpu__current_pgd, $acr ; PGD
85#endif
86 ; Look up PMD in PGD
87 move $s3, $r0 ; rw_mm_cause
88 lsrq 24, $r0 ; Get PMD index into PGD (bit 24-31)
89 move.d [$acr], $acr ; PGD for the current process
90 addi $r0.d, $acr, $acr
91 move $s3, $r0 ; rw_mm_cause
92 move.d [$acr], $acr ; Get PMD
93 beq 1f
94 ; Look up PTE in PMD
95 lsrq PAGE_SHIFT, $r0
96 and.w PAGE_MASK, $acr ; Remove PMD flags
97 and.d 0x7ff, $r0 ; Get PTE index into PMD (bit 13-23)
98 addi $r0.d, $acr, $acr
99 move.d [$acr], $acr ; Get PTE
100 beq 2f
101 move.d [$sp+], $r0 ; Pop r0 in delayslot
102 ; Store in TLB
103 move $acr, $s5
104 ; Return
105 move.d [$sp+], $acr
106 move [$sp], $srs
107 addq 4, $sp
108 rete
109 rfe
1101: ; PMD missing, let the mm subsystem fix it up.
111 move.d [$sp+], $r0 ; Pop r0
1122: ; PTE missing, let the mm subsystem fix it up.
113 move.d [$sp+], $acr
114 move [$sp], $srs
115 addq 4, $sp
116 SAVE_ALL
117 move \mmu, $srs
118 move.d $sp, $r11 ; regs
119 clear.d $r12 ; Not a protection fault
120 move.w PAGE_MASK, $acr
121 move $s3, $r10 ; rw_mm_cause
122 btstq 9, $r10 ; Check if write access
123 smi $r13
124 and.w PAGE_MASK, $r10 ; Get VPN (virtual address)
125 jsr do_page_fault
126 and.w $acr, $r10
127 ; Return
128 ba ret_from_intr
129 nop
130.endm
131
132 ; This is the MMU bus fault handlers.
133
134MMU_REFILL_HANDLER i_mmu_refill, 1
135MMU_BUS_FAULT_HANDLER i_mmu_invalid, 1, 0, 0
136MMU_BUS_FAULT_HANDLER i_mmu_access, 1, 0, 0
137MMU_BUS_FAULT_HANDLER i_mmu_execute, 1, 0, 1
138MMU_REFILL_HANDLER d_mmu_refill, 2
139MMU_BUS_FAULT_HANDLER d_mmu_invalid, 2, 0, 0
140MMU_BUS_FAULT_HANDLER d_mmu_access, 2, 0, 0
141MMU_BUS_FAULT_HANDLER d_mmu_write, 2, 1, 0
diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c
new file mode 100644
index 000000000000..8233406798d3
--- /dev/null
+++ b/arch/cris/arch-v32/mm/tlb.c
@@ -0,0 +1,208 @@
1/*
2 * Low level TLB handling.
3 *
4 * Copyright (C) 2000-2003, Axis Communications AB.
5 *
6 * Authors: Bjorn Wesen <bjornw@axis.com>
7 * Tobias Anderberg <tobiasa@axis.com>, CRISv32 port.
8 */
9
10#include <asm/tlb.h>
11#include <asm/mmu_context.h>
12#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
13#include <asm/arch/hwregs/supp_reg.h>
14
15#define UPDATE_TLB_SEL_IDX(val) \
16do { \
17 unsigned long tlb_sel; \
18 \
19 tlb_sel = REG_FIELD(mmu, rw_mm_tlb_sel, idx, val); \
20 SUPP_REG_WR(RW_MM_TLB_SEL, tlb_sel); \
21} while(0)
22
23#define UPDATE_TLB_HILO(tlb_hi, tlb_lo) \
24do { \
25 SUPP_REG_WR(RW_MM_TLB_HI, tlb_hi); \
26 SUPP_REG_WR(RW_MM_TLB_LO, tlb_lo); \
27} while(0)
28
29/*
30 * The TLB can host up to 256 different mm contexts at the same time. The running
31 * context is found in the PID register. Each TLB entry contains a page_id that
32 * has to match the PID register to give a hit. page_id_map keeps track of which
33 * mm's is assigned to which page_id's, making sure it's known when to
34 * invalidate TLB entries.
35 *
36 * The last page_id is never running, it is used as an invalid page_id so that
37 * it's possible to make TLB entries that will nerver match.
38 *
39 * Note; the flushes needs to be atomic otherwise an interrupt hander that uses
40 * vmalloc'ed memory might cause a TLB load in the middle of a flush.
41 */
42
43/* Flush all TLB entries. */
44void
45__flush_tlb_all(void)
46{
47 int i;
48 int mmu;
49 unsigned long flags;
50 unsigned long mmu_tlb_hi;
51 unsigned long mmu_tlb_sel;
52
53 /*
54 * Mask with 0xf so similar TLB entries aren't written in the same 4-way
55 * entry group.
56 */
57 local_save_flags(flags);
58 local_irq_disable();
59
60 for (mmu = 1; mmu <= 2; mmu++) {
61 SUPP_BANK_SEL(mmu); /* Select the MMU */
62 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
63 /* Store invalid entry */
64 mmu_tlb_sel = REG_FIELD(mmu, rw_mm_tlb_sel, idx, i);
65
66 mmu_tlb_hi = (REG_FIELD(mmu, rw_mm_tlb_hi, pid, INVALID_PAGEID)
67 | REG_FIELD(mmu, rw_mm_tlb_hi, vpn, i & 0xf));
68
69 SUPP_REG_WR(RW_MM_TLB_SEL, mmu_tlb_sel);
70 SUPP_REG_WR(RW_MM_TLB_HI, mmu_tlb_hi);
71 SUPP_REG_WR(RW_MM_TLB_LO, 0);
72 }
73 }
74
75 local_irq_restore(flags);
76}
77
78/* Flush an entire user address space. */
79void
80__flush_tlb_mm(struct mm_struct *mm)
81{
82 int i;
83 int mmu;
84 unsigned long flags;
85 unsigned long page_id;
86 unsigned long tlb_hi;
87 unsigned long mmu_tlb_hi;
88
89 page_id = mm->context.page_id;
90
91 if (page_id == NO_CONTEXT)
92 return;
93
94 /* Mark the TLB entries that match the page_id as invalid. */
95 local_save_flags(flags);
96 local_irq_disable();
97
98 for (mmu = 1; mmu <= 2; mmu++) {
99 SUPP_BANK_SEL(mmu);
100 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
101 UPDATE_TLB_SEL_IDX(i);
102
103 /* Get the page_id */
104 SUPP_REG_RD(RW_MM_TLB_HI, tlb_hi);
105
106 /* Check if the page_id match. */
107 if ((tlb_hi & 0xff) == page_id) {
108 mmu_tlb_hi = (REG_FIELD(mmu, rw_mm_tlb_hi, pid,
109 INVALID_PAGEID)
110 | REG_FIELD(mmu, rw_mm_tlb_hi, vpn,
111 i & 0xf));
112
113 UPDATE_TLB_HILO(mmu_tlb_hi, 0);
114 }
115 }
116 }
117
118 local_irq_restore(flags);
119}
120
121/* Invalidate a single page. */
122void
123__flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
124{
125 int i;
126 int mmu;
127 unsigned long page_id;
128 unsigned long flags;
129 unsigned long tlb_hi;
130 unsigned long mmu_tlb_hi;
131
132 page_id = vma->vm_mm->context.page_id;
133
134 if (page_id == NO_CONTEXT)
135 return;
136
137 addr &= PAGE_MASK;
138
139 /*
140 * Invalidate those TLB entries that match both the mm context and the
141 * requested virtual address.
142 */
143 local_save_flags(flags);
144 local_irq_disable();
145
146 for (mmu = 1; mmu <= 2; mmu++) {
147 SUPP_BANK_SEL(mmu);
148 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
149 UPDATE_TLB_SEL_IDX(i);
150 SUPP_REG_RD(RW_MM_TLB_HI, tlb_hi);
151
152 /* Check if page_id and address matches */
153 if (((tlb_hi & 0xff) == page_id) &&
154 ((tlb_hi & PAGE_MASK) == addr)) {
155 mmu_tlb_hi = REG_FIELD(mmu, rw_mm_tlb_hi, pid,
156 INVALID_PAGEID) | addr;
157
158 UPDATE_TLB_HILO(mmu_tlb_hi, 0);
159 }
160 }
161 }
162
163 local_irq_restore(flags);
164}
165
166/*
167 * Initialize the context related info for a new mm_struct
168 * instance.
169 */
170
171int
172init_new_context(struct task_struct *tsk, struct mm_struct *mm)
173{
174 mm->context.page_id = NO_CONTEXT;
175 return 0;
176}
177
178/* Called in schedule() just before actually doing the switch_to. */
179void
180switch_mm(struct mm_struct *prev, struct mm_struct *next,
181 struct task_struct *tsk)
182{
183 int cpu = smp_processor_id();
184
185 /* Make sure there is a MMU context. */
186 spin_lock(&next->page_table_lock);
187 get_mmu_context(next);
188 cpu_set(cpu, next->cpu_vm_mask);
189 spin_unlock(&next->page_table_lock);
190
191 /*
192 * Remember the pgd for the fault handlers. Keep a seperate copy of it
193 * because current and active_mm might be invalid at points where
194 * there's still a need to derefer the pgd.
195 */
196 per_cpu(current_pgd, cpu) = next->pgd;
197
198 /* Switch context in the MMU. */
199 if (tsk && tsk->thread_info)
200 {
201 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | tsk->thread_info->tls);
202 }
203 else
204 {
205 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id);
206 }
207}
208
diff --git a/arch/cris/arch-v32/output_arch.ld b/arch/cris/arch-v32/output_arch.ld
new file mode 100644
index 000000000000..d60a57db0ec2
--- /dev/null
+++ b/arch/cris/arch-v32/output_arch.ld
@@ -0,0 +1,2 @@
1/* At the time of this writing, there's no equivalent ld option. */
2OUTPUT_ARCH (crisv32)
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S
new file mode 100644
index 000000000000..adb94605d92a
--- /dev/null
+++ b/arch/cris/arch-v32/vmlinux.lds.S
@@ -0,0 +1,134 @@
1/* ld script to make the Linux/CRIS kernel
2 * Authors: Bjorn Wesen (bjornw@axis.com)
3 *
4 * It is VERY DANGEROUS to fiddle around with the symbols in this
5 * script. It is for example quite vital that all generated sections
6 * that are used are actually named here, otherwise the linker will
7 * put them at the end, where the init stuff is which is FREED after
8 * the kernel has booted.
9 */
10
11#include <linux/config.h>
12#include <asm-generic/vmlinux.lds.h>
13
14jiffies = jiffies_64;
15SECTIONS
16{
17 . = DRAM_VIRTUAL_BASE;
18 dram_start = .;
19 ebp_start = .;
20
21 /* The boot section is only necessary until the VCS top level testbench */
22 /* includes both flash and DRAM. */
23 .boot : { *(.boot) }
24
25 . = DRAM_VIRTUAL_BASE + 0x4000; /* See head.S and pages reserved at the start. */
26
27 _text = .; /* Text and read-only data. */
28 text_start = .; /* Lots of aliases. */
29 _stext = .;
30 __stext = .;
31 .text : {
32 *(.text)
33 SCHED_TEXT
34 LOCK_TEXT
35 *(.fixup)
36 *(.text.__*)
37 }
38
39 _etext = . ; /* End of text section. */
40 __etext = .;
41
42 . = ALIGN(4); /* Exception table. */
43 __start___ex_table = .;
44 __ex_table : { *(__ex_table) }
45 __stop___ex_table = .;
46
47 RODATA
48
49 . = ALIGN (4);
50 ___data_start = . ;
51 __Sdata = . ;
52 .data : { /* Data */
53 *(.data)
54 }
55 __edata = . ; /* End of data section. */
56 _edata = . ;
57
58 . = ALIGN(8192); /* init_task and stack, must be aligned. */
59 .data.init_task : { *(.data.init_task) }
60
61 . = ALIGN(8192); /* Init code and data. */
62 __init_begin = .;
63 .init.text : {
64 _sinittext = .;
65 *(.init.text)
66 _einittext = .;
67 }
68 .init.data : { *(.init.data) }
69 . = ALIGN(16);
70 __setup_start = .;
71 .init.setup : { *(.init.setup) }
72 __setup_end = .;
73 __start___param = .;
74 __param : { *(__param) }
75 __stop___param = .;
76 .initcall.init : {
77 __initcall_start = .;
78 *(.initcall1.init);
79 *(.initcall2.init);
80 *(.initcall3.init);
81 *(.initcall4.init);
82 *(.initcall5.init);
83 *(.initcall6.init);
84 *(.initcall7.init);
85 __initcall_end = .;
86 }
87
88 .con_initcall.init : {
89 __con_initcall_start = .;
90 *(.con_initcall.init)
91 __con_initcall_end = .;
92 }
93 SECURITY_INIT
94
95 __per_cpu_start = .;
96 .data.percpu : { *(.data.percpu) }
97 __per_cpu_end = .;
98
99 .init.ramfs : {
100 __initramfs_start = .;
101 *(.init.ramfs)
102 __initramfs_end = .;
103 /*
104 * We fill to the next page, so we can discard all init
105 * pages without needing to consider what payload might be
106 * appended to the kernel image.
107 */
108 FILL (0);
109 . = ALIGN (8192);
110 }
111
112 __vmlinux_end = .; /* Last address of the physical file. */
113 __init_end = .;
114
115 __data_end = . ; /* Move to _edata? */
116 __bss_start = .; /* BSS. */
117 .bss : {
118 *(COMMON)
119 *(.bss)
120 }
121
122 . = ALIGN (0x20);
123 _end = .;
124 __end = .;
125
126 /* Sections to be discarded */
127 /DISCARD/ : {
128 *(.text.exit)
129 *(.data.exit)
130 *(.exitcall.exit)
131 }
132
133 dram_end = dram_start + CONFIG_ETRAX_DRAM_SIZE*1024*1024;
134}
diff --git a/arch/cris/defconfig b/arch/cris/defconfig
index 32c9c987dbaa..142a10818af3 100644
--- a/arch/cris/defconfig
+++ b/arch/cris/defconfig
@@ -1,22 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Mon Jun 20 13:42:02 2005
3# 5#
4CONFIG_MMU=y 6CONFIG_MMU=y
5CONFIG_UID16=y 7CONFIG_UID16=y
6CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_IOMAP=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_CRIS=y
7 12
8# 13#
9# Code maturity level options 14# Code maturity level options
10# 15#
11CONFIG_EXPERIMENTAL=y 16CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y 17CONFIG_CLEAN_COMPILE=y
13CONFIG_STANDALONE=y
14CONFIG_BROKEN_ON_SMP=y 18CONFIG_BROKEN_ON_SMP=y
15 19
16# 20#
17# General setup 21# General setup
18# 22#
19CONFIG_SWAP=y 23CONFIG_LOCALVERSION=""
24# CONFIG_SWAP is not set
20# CONFIG_SYSVIPC is not set 25# CONFIG_SYSVIPC is not set
21# CONFIG_POSIX_MQUEUE is not set 26# CONFIG_POSIX_MQUEUE is not set
22# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
@@ -24,16 +29,19 @@ CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
25CONFIG_LOG_BUF_SHIFT=14 30CONFIG_LOG_BUF_SHIFT=14
26# CONFIG_HOTPLUG is not set 31# CONFIG_HOTPLUG is not set
32CONFIG_KOBJECT_UEVENT=y
27# CONFIG_IKCONFIG is not set 33# CONFIG_IKCONFIG is not set
28CONFIG_EMBEDDED=y 34CONFIG_EMBEDDED=y
29# CONFIG_KALLSYMS is not set 35# CONFIG_KALLSYMS is not set
30CONFIG_FUTEX=y 36CONFIG_FUTEX=y
31CONFIG_EPOLL=y 37CONFIG_EPOLL=y
32CONFIG_IOSCHED_NOOP=y
33CONFIG_IOSCHED_AS=y
34CONFIG_IOSCHED_DEADLINE=y
35CONFIG_IOSCHED_CFQ=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
37 45
38# 46#
39# Loadable module support 47# Loadable module support
@@ -45,23 +53,28 @@ CONFIG_IOSCHED_CFQ=y
45# 53#
46CONFIG_BINFMT_ELF=y 54CONFIG_BINFMT_ELF=y
47# CONFIG_BINFMT_MISC is not set 55# CONFIG_BINFMT_MISC is not set
56CONFIG_GENERIC_HARDIRQS=y
57# CONFIG_SMP is not set
48CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc" 58CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc"
49CONFIG_ETRAX_WATCHDOG=y 59# CONFIG_ETRAX_WATCHDOG is not set
50CONFIG_ETRAX_WATCHDOG_NICE_DOGGY=y
51CONFIG_ETRAX_FAST_TIMER=y 60CONFIG_ETRAX_FAST_TIMER=y
52# CONFIG_PREEMPT is not set 61# CONFIG_PREEMPT is not set
62# CONFIG_OOM_REBOOT is not set
53 63
54# 64#
55# Hardware setup 65# Hardware setup
56# 66#
57CONFIG_ETRAX100LX=y 67# CONFIG_ETRAX100LX is not set
58# CONFIG_ETRAX100LX_V2 is not set 68CONFIG_ETRAX100LX_V2=y
59# CONFIG_SVINTO_SIM is not set 69# CONFIG_SVINTO_SIM is not set
70# CONFIG_ETRAXFS is not set
71# CONFIG_ETRAXFS_SIM is not set
60CONFIG_ETRAX_ARCH_V10=y 72CONFIG_ETRAX_ARCH_V10=y
61CONFIG_ETRAX_DRAM_SIZE=16 73# CONFIG_ETRAX_ARCH_V32 is not set
74CONFIG_ETRAX_DRAM_SIZE=32
62CONFIG_ETRAX_FLASH_BUSWIDTH=2 75CONFIG_ETRAX_FLASH_BUSWIDTH=2
63CONFIG_CRIS_LOW_MAP=y 76CONFIG_ETRAX_FLASH1_SIZE=4
64CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000 77CONFIG_ETRAX_DRAM_VIRTUAL_BASE=c0000000
65CONFIG_ETRAX_PA_LEDS=y 78CONFIG_ETRAX_PA_LEDS=y
66# CONFIG_ETRAX_PB_LEDS is not set 79# CONFIG_ETRAX_PB_LEDS is not set
67# CONFIG_ETRAX_CSP0_LEDS is not set 80# CONFIG_ETRAX_CSP0_LEDS is not set
@@ -81,13 +94,13 @@ CONFIG_ETRAX_RESCUE_SER0=y
81# CONFIG_ETRAX_RESCUE_SER1 is not set 94# CONFIG_ETRAX_RESCUE_SER1 is not set
82# CONFIG_ETRAX_RESCUE_SER2 is not set 95# CONFIG_ETRAX_RESCUE_SER2 is not set
83# CONFIG_ETRAX_RESCUE_SER3 is not set 96# CONFIG_ETRAX_RESCUE_SER3 is not set
84CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8 97CONFIG_ETRAX_DEF_R_WAITSTATES=0x95a6
85CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x104 98CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x4
86CONFIG_ETRAX_SDRAM=y 99CONFIG_ETRAX_SDRAM=y
87CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x00e03636 100CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x09e05757
88CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002 101CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002
89CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d 102CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d
90CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0 103CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0x00
91CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00 104CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00
92CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e 105CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e
93CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3 106CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
@@ -97,16 +110,17 @@ CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
97# Drivers for built-in interfaces 110# Drivers for built-in interfaces
98# 111#
99CONFIG_ETRAX_ETHERNET=y 112CONFIG_ETRAX_ETHERNET=y
100CONFIG_NET_ETHERNET=y
101# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set 113# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set
102CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y 114CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y
103CONFIG_ETRAX_SERIAL=y 115CONFIG_ETRAX_SERIAL=y
104CONFIG_ETRAX_SERIAL_FAST_TIMER=y 116# CONFIG_ETRAX_SERIAL_FAST_TIMER is not set
117# CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is not set
118CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=5
105CONFIG_ETRAX_SERIAL_PORT0=y 119CONFIG_ETRAX_SERIAL_PORT0=y
106# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set 120# CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set
107CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y 121CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y
108# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set 122# CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set
109CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y 123CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y
110CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y 124CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y
111# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set 125# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set
112# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set 126# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
@@ -121,10 +135,10 @@ CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1
121CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1 135CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1
122# CONFIG_ETRAX_SERIAL_PORT1 is not set 136# CONFIG_ETRAX_SERIAL_PORT1 is not set
123CONFIG_ETRAX_SERIAL_PORT2=y 137CONFIG_ETRAX_SERIAL_PORT2=y
124# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set 138# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set
125CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y 139CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y
126# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set 140# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set
127CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y 141CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y
128CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y 142CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y
129# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set 143# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set
130# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set 144# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set
@@ -138,44 +152,51 @@ CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1
138CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1 152CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1
139CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1 153CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1
140# CONFIG_ETRAX_SERIAL_PORT3 is not set 154# CONFIG_ETRAX_SERIAL_PORT3 is not set
141# CONFIG_ETRAX_RS485 is not set 155CONFIG_ETRAX_RS485=y
142# CONFIG_ETRAX_IDE is not set 156# CONFIG_ETRAX_RS485_ON_PA is not set
143# CONFIG_IDE is not set 157# CONFIG_ETRAX_RS485_DISABLE_RECEIVER is not set
144# CONFIG_ETRAX_USB_HOST is not set 158CONFIG_ETRAX_IDE=y
159CONFIG_ETRAX_IDE_DELAY=15
160CONFIG_ETRAX_IDE_PB7_RESET=y
161# CONFIG_ETRAX_IDE_G27_RESET is not set
162CONFIG_ETRAX_USB_HOST=y
163CONFIG_ETRAX_USB_HOST_PORT1=y
164CONFIG_ETRAX_USB_HOST_PORT2=y
145CONFIG_ETRAX_AXISFLASHMAP=y 165CONFIG_ETRAX_AXISFLASHMAP=y
146CONFIG_ETRAX_PTABLE_SECTOR=65536 166CONFIG_ETRAX_PTABLE_SECTOR=65536
147CONFIG_MTD=y
148CONFIG_MTD_CFI=y
149CONFIG_MTD_CFI_AMDSTD=y
150CONFIG_MTD_OBSOLETE_CHIPS=y
151CONFIG_MTD_AMDSTD=y
152CONFIG_MTD_CHAR=y
153CONFIG_MTD_BLOCK=y
154CONFIG_MTD_PARTITIONS=y
155CONFIG_MTD_CONCAT=y
156# CONFIG_ETRAX_I2C is not set 167# CONFIG_ETRAX_I2C is not set
157CONFIG_ETRAX_GPIO=y 168# CONFIG_ETRAX_GPIO is not set
158CONFIG_ETRAX_PA_BUTTON_BITMASK=0x02 169CONFIG_ETRAX_RTC=y
159CONFIG_ETRAX_PA_CHANGEABLE_DIR=0x00 170CONFIG_ETRAX_DS1302=y
160CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF 171# CONFIG_ETRAX_PCF8563 is not set
161CONFIG_ETRAX_PB_CHANGEABLE_DIR=0x00 172CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT=y
162CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF 173CONFIG_ETRAX_DS1302_RSTBIT=0
163# CONFIG_ETRAX_RTC is not set 174CONFIG_ETRAX_DS1302_SCLBIT=1
175CONFIG_ETRAX_DS1302_SDABIT=0
176CONFIG_ETRAX_DS1302_TRICKLE_CHARGE=0
164 177
165# 178#
166# Generic Driver Options 179# Generic Driver Options
167# 180#
181CONFIG_STANDALONE=y
182CONFIG_PREVENT_FIRMWARE_BUILD=y
183# CONFIG_FW_LOADER is not set
168 184
169# 185#
170# Memory Technology Devices (MTD) 186# Memory Technology Devices (MTD)
171# 187#
188CONFIG_MTD=y
172# CONFIG_MTD_DEBUG is not set 189# CONFIG_MTD_DEBUG is not set
190CONFIG_MTD_PARTITIONS=y
191CONFIG_MTD_CONCAT=y
173# CONFIG_MTD_REDBOOT_PARTS is not set 192# CONFIG_MTD_REDBOOT_PARTS is not set
174# CONFIG_MTD_CMDLINE_PARTS is not set 193# CONFIG_MTD_CMDLINE_PARTS is not set
175 194
176# 195#
177# User Modules And Translation Layers 196# User Modules And Translation Layers
178# 197#
198CONFIG_MTD_CHAR=y
199CONFIG_MTD_BLOCK=y
179# CONFIG_FTL is not set 200# CONFIG_FTL is not set
180# CONFIG_NFTL is not set 201# CONFIG_NFTL is not set
181# CONFIG_INFTL is not set 202# CONFIG_INFTL is not set
@@ -183,14 +204,30 @@ CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF
183# 204#
184# RAM/ROM/Flash chip drivers 205# RAM/ROM/Flash chip drivers
185# 206#
207CONFIG_MTD_CFI=y
186# CONFIG_MTD_JEDECPROBE is not set 208# CONFIG_MTD_JEDECPROBE is not set
187CONFIG_MTD_GEN_PROBE=y 209CONFIG_MTD_GEN_PROBE=y
188# CONFIG_MTD_CFI_ADV_OPTIONS is not set 210# CONFIG_MTD_CFI_ADV_OPTIONS is not set
211CONFIG_MTD_MAP_BANK_WIDTH_1=y
212CONFIG_MTD_MAP_BANK_WIDTH_2=y
213CONFIG_MTD_MAP_BANK_WIDTH_4=y
214# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
215# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
216# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
217CONFIG_MTD_CFI_I1=y
218CONFIG_MTD_CFI_I2=y
219# CONFIG_MTD_CFI_I4 is not set
220# CONFIG_MTD_CFI_I8 is not set
189# CONFIG_MTD_CFI_INTELEXT is not set 221# CONFIG_MTD_CFI_INTELEXT is not set
222CONFIG_MTD_CFI_AMDSTD=y
223CONFIG_MTD_CFI_AMDSTD_RETRY=0
190# CONFIG_MTD_CFI_STAA is not set 224# CONFIG_MTD_CFI_STAA is not set
225CONFIG_MTD_CFI_UTIL=y
191CONFIG_MTD_RAM=y 226CONFIG_MTD_RAM=y
192# CONFIG_MTD_ROM is not set 227# CONFIG_MTD_ROM is not set
193# CONFIG_MTD_ABSENT is not set 228# CONFIG_MTD_ABSENT is not set
229CONFIG_MTD_OBSOLETE_CHIPS=y
230CONFIG_MTD_AMDSTD=y
194# CONFIG_MTD_SHARP is not set 231# CONFIG_MTD_SHARP is not set
195# CONFIG_MTD_JEDEC is not set 232# CONFIG_MTD_JEDEC is not set
196 233
@@ -204,11 +241,13 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
204# Self-contained MTD device drivers 241# Self-contained MTD device drivers
205# 242#
206# CONFIG_MTD_SLRAM is not set 243# CONFIG_MTD_SLRAM is not set
244# CONFIG_MTD_PHRAM is not set
207CONFIG_MTD_MTDRAM=y 245CONFIG_MTD_MTDRAM=y
208CONFIG_MTDRAM_TOTAL_SIZE=0 246CONFIG_MTDRAM_TOTAL_SIZE=0
209CONFIG_MTDRAM_ERASE_SIZE=64 247CONFIG_MTDRAM_ERASE_SIZE=64
210CONFIG_MTDRAM_ABS_POS=0x0 248CONFIG_MTDRAM_ABS_POS=0x0
211# CONFIG_MTD_BLKMTD is not set 249# CONFIG_MTD_BLKMTD is not set
250# CONFIG_MTD_BLOCK2MTD is not set
212 251
213# 252#
214# Disk-On-Chip Device Drivers 253# Disk-On-Chip Device Drivers
@@ -235,11 +274,25 @@ CONFIG_MTDRAM_ABS_POS=0x0
235# Block devices 274# Block devices
236# 275#
237# CONFIG_BLK_DEV_FD is not set 276# CONFIG_BLK_DEV_FD is not set
277# CONFIG_BLK_DEV_COW_COMMON is not set
238# CONFIG_BLK_DEV_LOOP is not set 278# CONFIG_BLK_DEV_LOOP is not set
239# CONFIG_BLK_DEV_NBD is not set 279# CONFIG_BLK_DEV_NBD is not set
280# CONFIG_BLK_DEV_UB is not set
240CONFIG_BLK_DEV_RAM=y 281CONFIG_BLK_DEV_RAM=y
282CONFIG_BLK_DEV_RAM_COUNT=16
241CONFIG_BLK_DEV_RAM_SIZE=4096 283CONFIG_BLK_DEV_RAM_SIZE=4096
242# CONFIG_BLK_DEV_INITRD is not set 284# CONFIG_BLK_DEV_INITRD is not set
285CONFIG_INITRAMFS_SOURCE=""
286# CONFIG_CDROM_PKTCDVD is not set
287
288#
289# IO Schedulers
290#
291CONFIG_IOSCHED_NOOP=y
292# CONFIG_IOSCHED_AS is not set
293# CONFIG_IOSCHED_DEADLINE is not set
294CONFIG_IOSCHED_CFQ=y
295# CONFIG_ATA_OVER_ETH is not set
243 296
244# 297#
245# Multi-device support (RAID and LVM) 298# Multi-device support (RAID and LVM)
@@ -249,6 +302,28 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
249# 302#
250# ATA/ATAPI/MFM/RLL support 303# ATA/ATAPI/MFM/RLL support
251# 304#
305CONFIG_IDE=y
306CONFIG_BLK_DEV_IDE=y
307
308#
309# Please see Documentation/ide.txt for help/info on IDE drives
310#
311# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set
314CONFIG_BLK_DEV_IDECD=y
315# CONFIG_BLK_DEV_IDETAPE is not set
316# CONFIG_BLK_DEV_IDEFLOPPY is not set
317# CONFIG_IDE_TASK_IOCTL is not set
318
319#
320# IDE chipset support/bugfixes
321#
322# CONFIG_IDE_GENERIC is not set
323# CONFIG_IDE_ARM is not set
324CONFIG_BLK_DEV_IDEDMA=y
325# CONFIG_IDEDMA_AUTO is not set
326# CONFIG_BLK_DEV_HD is not set
252 327
253# 328#
254# SCSI device support 329# SCSI device support
@@ -258,7 +333,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
258# 333#
259# IEEE 1394 (FireWire) support 334# IEEE 1394 (FireWire) support
260# 335#
261# CONFIG_IEEE1394 is not set
262 336
263# 337#
264# I2O device support 338# I2O device support
@@ -288,6 +362,9 @@ CONFIG_INET=y
288# CONFIG_INET_AH is not set 362# CONFIG_INET_AH is not set
289# CONFIG_INET_ESP is not set 363# CONFIG_INET_ESP is not set
290# CONFIG_INET_IPCOMP is not set 364# CONFIG_INET_IPCOMP is not set
365# CONFIG_INET_TUNNEL is not set
366CONFIG_IP_TCPDIAG=y
367# CONFIG_IP_TCPDIAG_IPV6 is not set
291 368
292# 369#
293# IP: Virtual Server Configuration 370# IP: Virtual Server Configuration
@@ -301,11 +378,10 @@ CONFIG_NETFILTER=y
301# IP: Netfilter Configuration 378# IP: Netfilter Configuration
302# 379#
303# CONFIG_IP_NF_CONNTRACK is not set 380# CONFIG_IP_NF_CONNTRACK is not set
381# CONFIG_IP_NF_CONNTRACK_MARK is not set
304# CONFIG_IP_NF_QUEUE is not set 382# CONFIG_IP_NF_QUEUE is not set
305# CONFIG_IP_NF_IPTABLES is not set 383# CONFIG_IP_NF_IPTABLES is not set
306# CONFIG_IP_NF_ARPTABLES is not set 384# CONFIG_IP_NF_ARPTABLES is not set
307# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
308# CONFIG_IP_NF_COMPAT_IPFWADM is not set
309 385
310# 386#
311# SCTP Configuration (EXPERIMENTAL) 387# SCTP Configuration (EXPERIMENTAL)
@@ -323,12 +399,12 @@ CONFIG_NETFILTER=y
323# CONFIG_NET_DIVERT is not set 399# CONFIG_NET_DIVERT is not set
324# CONFIG_ECONET is not set 400# CONFIG_ECONET is not set
325# CONFIG_WAN_ROUTER is not set 401# CONFIG_WAN_ROUTER is not set
326# CONFIG_NET_HW_FLOWCONTROL is not set
327 402
328# 403#
329# QoS and/or fair queueing 404# QoS and/or fair queueing
330# 405#
331# CONFIG_NET_SCHED is not set 406# CONFIG_NET_SCHED is not set
407# CONFIG_NET_CLS_ROUTE is not set
332 408
333# 409#
334# Network testing 410# Network testing
@@ -338,7 +414,26 @@ CONFIG_NETFILTER=y
338# CONFIG_NET_POLL_CONTROLLER is not set 414# CONFIG_NET_POLL_CONTROLLER is not set
339# CONFIG_HAMRADIO is not set 415# CONFIG_HAMRADIO is not set
340# CONFIG_IRDA is not set 416# CONFIG_IRDA is not set
341# CONFIG_BT is not set 417CONFIG_BT=y
418CONFIG_BT_L2CAP=y
419# CONFIG_BT_SCO is not set
420CONFIG_BT_RFCOMM=y
421# CONFIG_BT_RFCOMM_TTY is not set
422CONFIG_BT_BNEP=y
423# CONFIG_BT_BNEP_MC_FILTER is not set
424# CONFIG_BT_BNEP_PROTO_FILTER is not set
425# CONFIG_BT_HIDP is not set
426
427#
428# Bluetooth device drivers
429#
430CONFIG_BT_HCIUSB=y
431# CONFIG_BT_HCIUSB_SCO is not set
432# CONFIG_BT_HCIUART is not set
433# CONFIG_BT_HCIBCM203X is not set
434# CONFIG_BT_HCIBPA10X is not set
435# CONFIG_BT_HCIBFUSB is not set
436# CONFIG_BT_HCIVHCI is not set
342CONFIG_NETDEVICES=y 437CONFIG_NETDEVICES=y
343# CONFIG_DUMMY is not set 438# CONFIG_DUMMY is not set
344# CONFIG_BONDING is not set 439# CONFIG_BONDING is not set
@@ -348,6 +443,7 @@ CONFIG_NETDEVICES=y
348# 443#
349# Ethernet (10 or 100Mbit) 444# Ethernet (10 or 100Mbit)
350# 445#
446CONFIG_NET_ETHERNET=y
351# CONFIG_MII is not set 447# CONFIG_MII is not set
352 448
353# 449#
@@ -389,11 +485,19 @@ CONFIG_NETDEVICES=y
389# 485#
390# Input device support 486# Input device support
391# 487#
392# CONFIG_INPUT is not set 488CONFIG_INPUT=y
393 489
394# 490#
395# Userland interfaces 491# Userland interfaces
396# 492#
493CONFIG_INPUT_MOUSEDEV=y
494CONFIG_INPUT_MOUSEDEV_PSAUX=y
495CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
496CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
497# CONFIG_INPUT_JOYDEV is not set
498# CONFIG_INPUT_TSDEV is not set
499# CONFIG_INPUT_EVDEV is not set
500# CONFIG_INPUT_EVBUG is not set
397 501
398# 502#
399# Input I/O drivers 503# Input I/O drivers
@@ -404,10 +508,25 @@ CONFIG_SERIO=y
404# CONFIG_SERIO_I8042 is not set 508# CONFIG_SERIO_I8042 is not set
405# CONFIG_SERIO_SERPORT is not set 509# CONFIG_SERIO_SERPORT is not set
406# CONFIG_SERIO_CT82C710 is not set 510# CONFIG_SERIO_CT82C710 is not set
511CONFIG_SERIO_LIBPS2=y
512# CONFIG_SERIO_RAW is not set
407 513
408# 514#
409# Input Device Drivers 515# Input Device Drivers
410# 516#
517CONFIG_INPUT_KEYBOARD=y
518CONFIG_KEYBOARD_ATKBD=y
519# CONFIG_KEYBOARD_SUNKBD is not set
520# CONFIG_KEYBOARD_LKKBD is not set
521# CONFIG_KEYBOARD_XTKBD is not set
522# CONFIG_KEYBOARD_NEWTON is not set
523CONFIG_INPUT_MOUSE=y
524CONFIG_MOUSE_PS2=y
525# CONFIG_MOUSE_SERIAL is not set
526# CONFIG_MOUSE_VSXXXAA is not set
527# CONFIG_INPUT_JOYSTICK is not set
528# CONFIG_INPUT_TOUCHSCREEN is not set
529# CONFIG_INPUT_MISC is not set
411 530
412# 531#
413# Character devices 532# Character devices
@@ -426,7 +545,6 @@ CONFIG_SERIO=y
426CONFIG_UNIX98_PTYS=y 545CONFIG_UNIX98_PTYS=y
427CONFIG_LEGACY_PTYS=y 546CONFIG_LEGACY_PTYS=y
428CONFIG_LEGACY_PTY_COUNT=256 547CONFIG_LEGACY_PTY_COUNT=256
429# CONFIG_QIC02_TAPE is not set
430 548
431# 549#
432# IPMI 550# IPMI
@@ -441,13 +559,10 @@ CONFIG_LEGACY_PTY_COUNT=256
441# CONFIG_GEN_RTC is not set 559# CONFIG_GEN_RTC is not set
442# CONFIG_DTLK is not set 560# CONFIG_DTLK is not set
443# CONFIG_R3964 is not set 561# CONFIG_R3964 is not set
444# CONFIG_APPLICOM is not set
445 562
446# 563#
447# Ftape, the floppy tape device driver 564# Ftape, the floppy tape device driver
448# 565#
449# CONFIG_FTAPE is not set
450# CONFIG_AGP is not set
451# CONFIG_DRM is not set 566# CONFIG_DRM is not set
452# CONFIG_RAW_DRIVER is not set 567# CONFIG_RAW_DRIVER is not set
453 568
@@ -469,10 +584,15 @@ CONFIG_LEGACY_PTY_COUNT=256
469# CONFIG_JBD is not set 584# CONFIG_JBD is not set
470# CONFIG_REISERFS_FS is not set 585# CONFIG_REISERFS_FS is not set
471# CONFIG_JFS_FS is not set 586# CONFIG_JFS_FS is not set
587
588#
589# XFS support
590#
472# CONFIG_XFS_FS is not set 591# CONFIG_XFS_FS is not set
473# CONFIG_MINIX_FS is not set 592# CONFIG_MINIX_FS is not set
474# CONFIG_ROMFS_FS is not set 593# CONFIG_ROMFS_FS is not set
475# CONFIG_QUOTA is not set 594# CONFIG_QUOTA is not set
595CONFIG_DNOTIFY=y
476# CONFIG_AUTOFS_FS is not set 596# CONFIG_AUTOFS_FS is not set
477# CONFIG_AUTOFS4_FS is not set 597# CONFIG_AUTOFS4_FS is not set
478 598
@@ -485,7 +605,8 @@ CONFIG_LEGACY_PTY_COUNT=256
485# 605#
486# DOS/FAT/NT Filesystems 606# DOS/FAT/NT Filesystems
487# 607#
488# CONFIG_FAT_FS is not set 608# CONFIG_MSDOS_FS is not set
609# CONFIG_VFAT_FS is not set
489# CONFIG_NTFS_FS is not set 610# CONFIG_NTFS_FS is not set
490 611
491# 612#
@@ -497,6 +618,7 @@ CONFIG_SYSFS=y
497# CONFIG_DEVFS_FS is not set 618# CONFIG_DEVFS_FS is not set
498# CONFIG_DEVPTS_FS_XATTR is not set 619# CONFIG_DEVPTS_FS_XATTR is not set
499CONFIG_TMPFS=y 620CONFIG_TMPFS=y
621# CONFIG_TMPFS_XATTR is not set
500# CONFIG_HUGETLB_PAGE is not set 622# CONFIG_HUGETLB_PAGE is not set
501CONFIG_RAMFS=y 623CONFIG_RAMFS=y
502 624
@@ -512,7 +634,15 @@ CONFIG_RAMFS=y
512# CONFIG_EFS_FS is not set 634# CONFIG_EFS_FS is not set
513CONFIG_JFFS_FS=y 635CONFIG_JFFS_FS=y
514CONFIG_JFFS_FS_VERBOSE=0 636CONFIG_JFFS_FS_VERBOSE=0
515# CONFIG_JFFS2_FS is not set 637# CONFIG_JFFS_PROC_FS is not set
638CONFIG_JFFS2_FS=y
639CONFIG_JFFS2_FS_DEBUG=0
640# CONFIG_JFFS2_FS_NAND is not set
641# CONFIG_JFFS2_FS_NOR_ECC is not set
642# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
643CONFIG_JFFS2_ZLIB=y
644CONFIG_JFFS2_RTIME=y
645# CONFIG_JFFS2_RUBIN is not set
516CONFIG_CRAMFS=y 646CONFIG_CRAMFS=y
517# CONFIG_VXFS_FS is not set 647# CONFIG_VXFS_FS is not set
518# CONFIG_HPFS_FS is not set 648# CONFIG_HPFS_FS is not set
@@ -530,14 +660,13 @@ CONFIG_NFS_V3=y
530# CONFIG_NFSD is not set 660# CONFIG_NFSD is not set
531CONFIG_LOCKD=y 661CONFIG_LOCKD=y
532CONFIG_LOCKD_V4=y 662CONFIG_LOCKD_V4=y
533# CONFIG_EXPORTFS is not set
534CONFIG_SUNRPC=y 663CONFIG_SUNRPC=y
535# CONFIG_RPCSEC_GSS_KRB5 is not set 664# CONFIG_RPCSEC_GSS_KRB5 is not set
665# CONFIG_RPCSEC_GSS_SPKM3 is not set
536# CONFIG_SMB_FS is not set 666# CONFIG_SMB_FS is not set
537# CONFIG_CIFS is not set 667# CONFIG_CIFS is not set
538# CONFIG_NCP_FS is not set 668# CONFIG_NCP_FS is not set
539# CONFIG_CODA_FS is not set 669# CONFIG_CODA_FS is not set
540# CONFIG_INTERMEZZO_FS is not set
541# CONFIG_AFS_FS is not set 670# CONFIG_AFS_FS is not set
542 671
543# 672#
@@ -557,8 +686,120 @@ CONFIG_MSDOS_PARTITION=y
557# CONFIG_SOUND is not set 686# CONFIG_SOUND is not set
558 687
559# 688#
689# PCCARD (PCMCIA/CardBus) support
690#
691# CONFIG_PCCARD is not set
692
693#
694# PC-card bridges
695#
696
697#
560# USB support 698# USB support
561# 699#
700CONFIG_USB=y
701# CONFIG_USB_DEBUG is not set
702
703#
704# Miscellaneous USB options
705#
706CONFIG_USB_DEVICEFS=y
707# CONFIG_USB_BANDWIDTH is not set
708# CONFIG_USB_DYNAMIC_MINORS is not set
709# CONFIG_USB_OTG is not set
710# CONFIG_USB_ARCH_HAS_HCD is not set
711# CONFIG_USB_ARCH_HAS_OHCI is not set
712
713#
714# USB Host Controller Drivers
715#
716# CONFIG_USB_SL811_HCD is not set
717
718#
719# USB Device Class drivers
720#
721
722#
723# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
724#
725# CONFIG_USB_ACM is not set
726# CONFIG_USB_PRINTER is not set
727
728#
729# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
730#
731# CONFIG_USB_STORAGE is not set
732
733#
734# USB Input Devices
735#
736# CONFIG_USB_HID is not set
737
738#
739# USB HID Boot Protocol drivers
740#
741# CONFIG_USB_KBD is not set
742# CONFIG_USB_MOUSE is not set
743# CONFIG_USB_AIPTEK is not set
744# CONFIG_USB_WACOM is not set
745# CONFIG_USB_KBTAB is not set
746# CONFIG_USB_POWERMATE is not set
747# CONFIG_USB_MTOUCH is not set
748# CONFIG_USB_EGALAX is not set
749# CONFIG_USB_XPAD is not set
750# CONFIG_USB_ATI_REMOTE is not set
751
752#
753# USB Imaging devices
754#
755# CONFIG_USB_MDC800 is not set
756
757#
758# USB Multimedia devices
759#
760# CONFIG_USB_DABUSB is not set
761
762#
763# Video4Linux support is needed for USB Multimedia device support
764#
765
766#
767# USB Network Adapters
768#
769# CONFIG_USB_CATC is not set
770# CONFIG_USB_KAWETH is not set
771# CONFIG_USB_PEGASUS is not set
772CONFIG_USB_RTL8150=y
773# CONFIG_USB_USBNET is not set
774
775#
776# USB port drivers
777#
778
779#
780# USB Serial Converter support
781#
782# CONFIG_USB_SERIAL is not set
783
784#
785# USB Miscellaneous drivers
786#
787# CONFIG_USB_EMI62 is not set
788# CONFIG_USB_EMI26 is not set
789# CONFIG_USB_AUERSWALD is not set
790# CONFIG_USB_RIO500 is not set
791# CONFIG_USB_LEGOTOWER is not set
792# CONFIG_USB_LCD is not set
793# CONFIG_USB_LED is not set
794# CONFIG_USB_CYTHERM is not set
795# CONFIG_USB_PHIDGETKIT is not set
796# CONFIG_USB_PHIDGETSERVO is not set
797# CONFIG_USB_IDMOUSE is not set
798# CONFIG_USB_TEST is not set
799
800#
801# USB ATM/DSL drivers
802#
562 803
563# 804#
564# USB Gadget Support 805# USB Gadget Support
@@ -568,14 +809,17 @@ CONFIG_MSDOS_PARTITION=y
568# 809#
569# Kernel hacking 810# Kernel hacking
570# 811#
571# CONFIG_PROFILE is not set 812# CONFIG_PROFILING is not set
813# CONFIG_SYSTEM_PROFILER is not set
572# CONFIG_ETRAX_KGDB is not set 814# CONFIG_ETRAX_KGDB is not set
573# CONFIG_DEBUG_INFO is not set 815# CONFIG_DEBUG_INFO is not set
574# CONFIG_FRAME_POINTER is not set 816# CONFIG_FRAME_POINTER is not set
817# CONFIG_DEBUG_NMI_OOPS is not set
575 818
576# 819#
577# Security options 820# Security options
578# 821#
822# CONFIG_KEYS is not set
579# CONFIG_SECURITY is not set 823# CONFIG_SECURITY is not set
580 824
581# 825#
@@ -584,8 +828,14 @@ CONFIG_MSDOS_PARTITION=y
584# CONFIG_CRYPTO is not set 828# CONFIG_CRYPTO is not set
585 829
586# 830#
831# Hardware crypto devices
832#
833
834#
587# Library routines 835# Library routines
588# 836#
589# CONFIG_CRC32 is not set 837# CONFIG_CRC_CCITT is not set
838CONFIG_CRC32=y
590# CONFIG_LIBCRC32C is not set 839# CONFIG_LIBCRC32C is not set
591CONFIG_ZLIB_INFLATE=y 840CONFIG_ZLIB_INFLATE=y
841CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
index 1546a0e74047..c8e8ea570989 100644
--- a/arch/cris/kernel/Makefile
+++ b/arch/cris/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.10 2004/05/14 10:18:12 starvik Exp $ 1# $Id: Makefile,v 1.12 2004/10/19 13:07:43 starvik Exp $
2# 2#
3# Makefile for the linux kernel. 3# Makefile for the linux kernel.
4# 4#
@@ -10,6 +10,7 @@ obj-y := process.o traps.o irq.o ptrace.o setup.o \
10 10
11obj-$(CONFIG_MODULES) += crisksyms.o 11obj-$(CONFIG_MODULES) += crisksyms.o
12obj-$(CONFIG_MODULES) += module.o 12obj-$(CONFIG_MODULES) += module.o
13obj-$(CONFIG_SYSTEM_PROFILER) += profile.o
13 14
14clean: 15clean:
15 16
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 7141bbecd7e4..85833d704ebb 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -27,13 +27,13 @@ extern void __Udiv(void);
27extern void __Umod(void); 27extern void __Umod(void);
28extern void __Div(void); 28extern void __Div(void);
29extern void __Mod(void); 29extern void __Mod(void);
30extern void __ashldi3(void);
30extern void __ashrdi3(void); 31extern void __ashrdi3(void);
31extern void iounmap(void *addr); 32extern void __lshrdi3(void);
33extern void iounmap(volatile void * __iomem);
32 34
33/* Platform dependent support */ 35/* Platform dependent support */
34EXPORT_SYMBOL(dump_thread); 36EXPORT_SYMBOL(dump_thread);
35EXPORT_SYMBOL(enable_irq);
36EXPORT_SYMBOL(disable_irq);
37EXPORT_SYMBOL(kernel_thread); 37EXPORT_SYMBOL(kernel_thread);
38EXPORT_SYMBOL(get_cmos_time); 38EXPORT_SYMBOL(get_cmos_time);
39EXPORT_SYMBOL(loops_per_usec); 39EXPORT_SYMBOL(loops_per_usec);
@@ -57,7 +57,9 @@ EXPORT_SYMBOL(__Udiv);
57EXPORT_SYMBOL(__Umod); 57EXPORT_SYMBOL(__Umod);
58EXPORT_SYMBOL(__Div); 58EXPORT_SYMBOL(__Div);
59EXPORT_SYMBOL(__Mod); 59EXPORT_SYMBOL(__Mod);
60EXPORT_SYMBOL(__ashldi3);
60EXPORT_SYMBOL(__ashrdi3); 61EXPORT_SYMBOL(__ashrdi3);
62EXPORT_SYMBOL(__lshrdi3);
61 63
62/* Memory functions */ 64/* Memory functions */
63EXPORT_SYMBOL(__ioremap); 65EXPORT_SYMBOL(__ioremap);
@@ -69,23 +71,10 @@ EXPORT_SYMBOL(__down);
69EXPORT_SYMBOL(__down_interruptible); 71EXPORT_SYMBOL(__down_interruptible);
70EXPORT_SYMBOL(__down_trylock); 72EXPORT_SYMBOL(__down_trylock);
71 73
72/* Export shadow registers for the CPU I/O pins */
73EXPORT_SYMBOL(genconfig_shadow);
74EXPORT_SYMBOL(port_pa_data_shadow);
75EXPORT_SYMBOL(port_pa_dir_shadow);
76EXPORT_SYMBOL(port_pb_data_shadow);
77EXPORT_SYMBOL(port_pb_dir_shadow);
78EXPORT_SYMBOL(port_pb_config_shadow);
79EXPORT_SYMBOL(port_g_data_shadow);
80
81/* Userspace access functions */ 74/* Userspace access functions */
82EXPORT_SYMBOL(__copy_user_zeroing); 75EXPORT_SYMBOL(__copy_user_zeroing);
83EXPORT_SYMBOL(__copy_user); 76EXPORT_SYMBOL(__copy_user);
84 77
85/* Cache flush functions */
86EXPORT_SYMBOL(flush_etrax_cache);
87EXPORT_SYMBOL(prepare_rx_descriptor);
88
89#undef memcpy 78#undef memcpy
90#undef memset 79#undef memset
91extern void * memset(void *, int, __kernel_size_t); 80extern void * memset(void *, int, __kernel_size_t);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index d848b9407457..30deaf1b728a 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -12,8 +12,6 @@
12 * shouldn't result in any weird surprises, and installing new handlers 12 * shouldn't result in any weird surprises, and installing new handlers
13 * should be easier. 13 * should be easier.
14 * 14 *
15 * Notice Linux/CRIS: these routines do not care about SMP
16 *
17 */ 15 */
18 16
19/* 17/*
@@ -24,6 +22,7 @@
24#include <linux/config.h> 22#include <linux/config.h>
25#include <linux/module.h> 23#include <linux/module.h>
26#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/irq.h>
27 26
28#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
29#include <linux/signal.h> 28#include <linux/signal.h>
@@ -36,84 +35,56 @@
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/seq_file.h> 36#include <linux/seq_file.h>
38#include <linux/errno.h> 37#include <linux/errno.h>
39#include <linux/bitops.h> 38#include <linux/spinlock.h>
40 39
41#include <asm/io.h> 40#include <asm/io.h>
42 41
43/* Defined in arch specific irq.c */ 42void ack_bad_irq(unsigned int irq)
44extern void arch_setup_irq(int irq);
45extern void arch_free_irq(int irq);
46
47void
48disable_irq(unsigned int irq_nr)
49{
50 unsigned long flags;
51
52 local_save_flags(flags);
53 local_irq_disable();
54 mask_irq(irq_nr);
55 local_irq_restore(flags);
56}
57
58void
59enable_irq(unsigned int irq_nr)
60{ 43{
61 unsigned long flags; 44 printk("unexpected IRQ trap at vector %02x\n", irq);
62 local_save_flags(flags);
63 local_irq_disable();
64 unmask_irq(irq_nr);
65 local_irq_restore(flags);
66} 45}
67 46
68unsigned long
69probe_irq_on()
70{
71 return 0;
72}
73
74EXPORT_SYMBOL(probe_irq_on);
75
76int
77probe_irq_off(unsigned long x)
78{
79 return 0;
80}
81
82EXPORT_SYMBOL(probe_irq_off);
83
84/*
85 * Initial irq handlers.
86 */
87
88static struct irqaction *irq_action[NR_IRQS];
89
90int show_interrupts(struct seq_file *p, void *v) 47int show_interrupts(struct seq_file *p, void *v)
91{ 48{
92 int i = *(loff_t *) v; 49 int i = *(loff_t *) v, j;
93 struct irqaction * action; 50 struct irqaction * action;
94 unsigned long flags; 51 unsigned long flags;
95 52
53 if (i == 0) {
54 seq_printf(p, " ");
55 for (j=0; j<NR_CPUS; j++)
56 if (cpu_online(j))
57 seq_printf(p, "CPU%d ",j);
58 seq_putc(p, '\n');
59 }
60
96 if (i < NR_IRQS) { 61 if (i < NR_IRQS) {
97 local_irq_save(flags); 62 spin_lock_irqsave(&irq_desc[i].lock, flags);
98 action = irq_action[i]; 63 action = irq_desc[i].action;
99 if (!action) 64 if (!action)
100 goto skip; 65 goto skip;
101 seq_printf(p, "%2d: %10u %c %s", 66 seq_printf(p, "%3d: ",i);
102 i, kstat_this_cpu.irqs[i], 67#ifndef CONFIG_SMP
103 (action->flags & SA_INTERRUPT) ? '+' : ' ', 68 seq_printf(p, "%10u ", kstat_irqs(i));
104 action->name); 69#else
105 for (action = action->next; action; action = action->next) { 70 for (j = 0; j < NR_CPUS; j++)
106 seq_printf(p, ",%s %s", 71 if (cpu_online(j))
107 (action->flags & SA_INTERRUPT) ? " +" : "", 72 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
108 action->name); 73#endif
109 } 74 seq_printf(p, " %14s", irq_desc[i].handler->typename);
75 seq_printf(p, " %s", action->name);
76
77 for (action=action->next; action; action = action->next)
78 seq_printf(p, ", %s", action->name);
79
110 seq_putc(p, '\n'); 80 seq_putc(p, '\n');
111skip: 81skip:
112 local_irq_restore(flags); 82 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
113 } 83 }
114 return 0; 84 return 0;
115} 85}
116 86
87
117/* called by the assembler IRQ entry functions defined in irq.h 88/* called by the assembler IRQ entry functions defined in irq.h
118 * to dispatch the interrupts to registred handlers 89 * to dispatch the interrupts to registred handlers
119 * interrupts are disabled upon entry - depending on if the 90 * interrupts are disabled upon entry - depending on if the
@@ -123,164 +94,17 @@ skip:
123 94
124asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 95asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
125{ 96{
126 struct irqaction *action; 97 unsigned long sp;
127 int do_random, cpu; 98 irq_enter();
128 int ret, retval = 0; 99 sp = rdsp();
129 100 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
130 cpu = smp_processor_id(); 101 printk("do_IRQ: stack overflow: %lX\n", sp);
131 irq_enter(); 102 show_stack(NULL, (unsigned long *)sp);
132 kstat_cpu(cpu).irqs[irq - FIRST_IRQ]++;
133 action = irq_action[irq - FIRST_IRQ];
134
135 if (action) {
136 if (!(action->flags & SA_INTERRUPT))
137 local_irq_enable();
138 do_random = 0;
139 do {
140 ret = action->handler(irq, action->dev_id, regs);
141 if (ret == IRQ_HANDLED)
142 do_random |= action->flags;
143 retval |= ret;
144 action = action->next;
145 } while (action);
146
147 if (retval != 1) {
148 if (retval) {
149 printk("irq event %d: bogus retval mask %x\n",
150 irq, retval);
151 } else {
152 printk("irq %d: nobody cared\n", irq);
153 }
154 }
155
156 if (do_random & SA_SAMPLE_RANDOM)
157 add_interrupt_randomness(irq);
158 local_irq_disable();
159 }
160 irq_exit();
161}
162
163/* this function links in a handler into the chain of handlers for the
164 given irq, and if the irq has never been registred, the appropriate
165 handler is entered into the interrupt vector
166*/
167
168int setup_irq(int irq, struct irqaction * new)
169{
170 int shared = 0;
171 struct irqaction *old, **p;
172 unsigned long flags;
173
174 p = irq_action + irq - FIRST_IRQ;
175 if ((old = *p) != NULL) {
176 /* Can't share interrupts unless both agree to */
177 if (!(old->flags & new->flags & SA_SHIRQ))
178 return -EBUSY;
179
180 /* Can't share interrupts unless both are same type */
181 if ((old->flags ^ new->flags) & SA_INTERRUPT)
182 return -EBUSY;
183
184 /* add new interrupt at end of irq queue */
185 do {
186 p = &old->next;
187 old = *p;
188 } while (old);
189 shared = 1;
190 }
191
192 if (new->flags & SA_SAMPLE_RANDOM)
193 rand_initialize_irq(irq);
194
195 local_save_flags(flags);
196 local_irq_disable();
197 *p = new;
198
199 if (!shared) {
200 /* if the irq wasn't registred before, enter it into the vector table
201 and unmask it physically
202 */
203 arch_setup_irq(irq);
204 unmask_irq(irq);
205 }
206
207 local_irq_restore(flags);
208 return 0;
209}
210
211/* this function is called by a driver to register an irq handler
212 Valid flags:
213 SA_INTERRUPT -> it's a fast interrupt, handler called with irq disabled and
214 no signal checking etc is performed upon exit
215 SA_SHIRQ -> the interrupt can be shared between different handlers, the handler
216 is required to check if the irq was "aimed" at it explicitely
217 SA_RANDOM -> the interrupt will add to the random generators entropy
218*/
219
220int request_irq(unsigned int irq,
221 irqreturn_t (*handler)(int, void *, struct pt_regs *),
222 unsigned long irqflags,
223 const char * devname,
224 void *dev_id)
225{
226 int retval;
227 struct irqaction * action;
228
229 if(!handler)
230 return -EINVAL;
231
232 /* allocate and fill in a handler structure and setup the irq */
233
234 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
235 if (!action)
236 return -ENOMEM;
237
238 action->handler = handler;
239 action->flags = irqflags;
240 cpus_clear(action->mask);
241 action->name = devname;
242 action->next = NULL;
243 action->dev_id = dev_id;
244
245 retval = setup_irq(irq, action);
246
247 if (retval)
248 kfree(action);
249 return retval;
250}
251
252EXPORT_SYMBOL(request_irq);
253
254void free_irq(unsigned int irq, void *dev_id)
255{
256 struct irqaction * action, **p;
257 unsigned long flags;
258
259 if (irq >= NR_IRQS) {
260 printk("Trying to free IRQ%d\n",irq);
261 return;
262 } 103 }
263 for (p = irq - FIRST_IRQ + irq_action; (action = *p) != NULL; p = &action->next) { 104 __do_IRQ(irq, regs);
264 if (action->dev_id != dev_id) 105 irq_exit();
265 continue;
266
267 /* Found it - now free it */
268 local_save_flags(flags);
269 local_irq_disable();
270 *p = action->next;
271 if (!irq_action[irq - FIRST_IRQ]) {
272 mask_irq(irq);
273 arch_free_irq(irq);
274 }
275 local_irq_restore(flags);
276 kfree(action);
277 return;
278 }
279 printk("Trying to free free IRQ%d\n",irq);
280} 106}
281 107
282EXPORT_SYMBOL(free_irq);
283
284void weird_irq(void) 108void weird_irq(void)
285{ 109{
286 local_irq_disable(); 110 local_irq_disable();
@@ -288,10 +112,3 @@ void weird_irq(void)
288 while(1); 112 while(1);
289} 113}
290 114
291#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
292/* Used by other archs to show/control IRQ steering during SMP */
293void __init
294init_irq_proc(void)
295{
296}
297#endif
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index f1d3e784f30c..11b867df8617 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -32,7 +32,7 @@ void *module_alloc(unsigned long size)
32{ 32{
33 if (size == 0) 33 if (size == 0)
34 return NULL; 34 return NULL;
35 return vmalloc(size); 35 return vmalloc_exec(size);
36} 36}
37 37
38 38
@@ -59,26 +59,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
59 unsigned int relsec, 59 unsigned int relsec,
60 struct module *me) 60 struct module *me)
61{ 61{
62 unsigned int i; 62 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
63 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; 63 return -ENOEXEC;
64 Elf32_Sym *sym;
65 uint32_t *location;
66
67 DEBUGP("Applying relocate section %u to %u\n", relsec,
68 sechdrs[relsec].sh_info);
69 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
70 /* This is where to make the change */
71 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_offset
72 + rel[i].r_offset;
73 /* This is the symbol it is referring to. Note that all
74 undefined symbols have been resolved. */
75 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
76 + ELF32_R_SYM(rel[i].r_info);
77
78 /* We add the value into the location given */
79 *location += sym->st_value;
80 }
81 return 0;
82} 64}
83 65
84int apply_relocate_add(Elf32_Shdr *sechdrs, 66int apply_relocate_add(Elf32_Shdr *sechdrs,
@@ -90,7 +72,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
90 unsigned int i; 72 unsigned int i;
91 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; 73 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
92 74
93 DEBUGP ("Applying relocate section %u to %u\n", relsec, 75 DEBUGP ("Applying add relocate section %u to %u\n", relsec,
94 sechdrs[relsec].sh_info); 76 sechdrs[relsec].sh_info);
95 77
96 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) { 78 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
@@ -103,7 +85,18 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
103 Elf32_Sym *sym 85 Elf32_Sym *sym
104 = ((Elf32_Sym *)sechdrs[symindex].sh_addr 86 = ((Elf32_Sym *)sechdrs[symindex].sh_addr
105 + ELF32_R_SYM (rela[i].r_info)); 87 + ELF32_R_SYM (rela[i].r_info));
106 *loc = sym->st_value + rela[i].r_addend; 88 switch (ELF32_R_TYPE(rela[i].r_info)) {
89 case R_CRIS_32:
90 *loc = sym->st_value + rela[i].r_addend;
91 break;
92 case R_CRIS_32_PCREL:
93 *loc = sym->st_value - (unsigned)loc + rela[i].r_addend - 4;
94 break;
95 default:
96 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
97 me->name, ELF32_R_TYPE(rela[i].r_info));
98 return -ENOEXEC;
99 }
107 } 100 }
108 101
109 return 0; 102 return 0;
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index a5ad2b675853..949a0e40e03c 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -1,4 +1,4 @@
1/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $ 1/* $Id: process.c,v 1.21 2005/03/04 08:16:17 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/process.c 3 * linux/arch/cris/kernel/process.c
4 * 4 *
@@ -8,6 +8,18 @@
8 * Authors: Bjorn Wesen (bjornw@axis.com) 8 * Authors: Bjorn Wesen (bjornw@axis.com)
9 * 9 *
10 * $Log: process.c,v $ 10 * $Log: process.c,v $
11 * Revision 1.21 2005/03/04 08:16:17 starvik
12 * Merge of Linux 2.6.11.
13 *
14 * Revision 1.20 2005/01/18 05:57:22 starvik
15 * Renamed hlt_counter to cris_hlt_counter and made it global.
16 *
17 * Revision 1.19 2004/10/19 13:07:43 starvik
18 * Merge of Linux 2.6.9
19 *
20 * Revision 1.18 2004/08/16 12:37:23 starvik
21 * Merge of Linux 2.6.8
22 *
11 * Revision 1.17 2004/04/05 13:53:48 starvik 23 * Revision 1.17 2004/04/05 13:53:48 starvik
12 * Merge of Linux 2.6.5 24 * Merge of Linux 2.6.5
13 * 25 *
@@ -161,18 +173,18 @@ EXPORT_SYMBOL(init_task);
161 * region by enable_hlt/disable_hlt. 173 * region by enable_hlt/disable_hlt.
162 */ 174 */
163 175
164static int hlt_counter=0; 176int cris_hlt_counter=0;
165 177
166void disable_hlt(void) 178void disable_hlt(void)
167{ 179{
168 hlt_counter++; 180 cris_hlt_counter++;
169} 181}
170 182
171EXPORT_SYMBOL(disable_hlt); 183EXPORT_SYMBOL(disable_hlt);
172 184
173void enable_hlt(void) 185void enable_hlt(void)
174{ 186{
175 hlt_counter--; 187 cris_hlt_counter--;
176} 188}
177 189
178EXPORT_SYMBOL(enable_hlt); 190EXPORT_SYMBOL(enable_hlt);
@@ -195,16 +207,19 @@ void cpu_idle (void)
195 /* endless idle loop with no priority at all */ 207 /* endless idle loop with no priority at all */
196 while (1) { 208 while (1) {
197 while (!need_resched()) { 209 while (!need_resched()) {
198 void (*idle)(void) = pm_idle; 210 void (*idle)(void);
199 211 /*
212 * Mark this as an RCU critical section so that
213 * synchronize_kernel() in the unload path waits
214 * for our completion.
215 */
216 idle = pm_idle;
200 if (!idle) 217 if (!idle)
201 idle = default_idle; 218 idle = default_idle;
202
203 idle(); 219 idle();
204 } 220 }
205 schedule(); 221 schedule();
206 } 222 }
207
208} 223}
209 224
210void hard_reset_now (void); 225void hard_reset_now (void);
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
new file mode 100644
index 000000000000..69c52189f044
--- /dev/null
+++ b/arch/cris/kernel/profile.c
@@ -0,0 +1,73 @@
1#include <linux/init.h>
2#include <linux/errno.h>
3#include <linux/kernel.h>
4#include <linux/proc_fs.h>
5#include <linux/types.h>
6#include <asm/ptrace.h>
7#include <asm/uaccess.h>
8
9#define SAMPLE_BUFFER_SIZE 8192
10
11static char* sample_buffer;
12static char* sample_buffer_pos;
13static int prof_running = 0;
14
15void
16cris_profile_sample(struct pt_regs* regs)
17{
18 if (!prof_running)
19 return;
20 if (user_mode(regs))
21 *(unsigned int*)sample_buffer_pos = current->pid;
22 else
23 *(unsigned int*)sample_buffer_pos = 0;
24 *(unsigned int*)(sample_buffer_pos + 4) = instruction_pointer(regs);
25 sample_buffer_pos += 8;
26 if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE)
27 sample_buffer_pos = sample_buffer;
28}
29
30static ssize_t
31read_cris_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
32{
33 unsigned long p = *ppos;
34 if (p > SAMPLE_BUFFER_SIZE)
35 return 0;
36 if (p + count > SAMPLE_BUFFER_SIZE)
37 count = SAMPLE_BUFFER_SIZE - p;
38 if (copy_to_user(buf, sample_buffer + p,count))
39 return -EFAULT;
40 memset(sample_buffer + p, 0, count);
41 *ppos += count;
42 return count;
43}
44
45static ssize_t
46write_cris_profile(struct file *file, const char __user *buf,
47 size_t count, loff_t *ppos)
48{
49 sample_buffer_pos = sample_buffer;
50 memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE);
51}
52
53static struct file_operations cris_proc_profile_operations = {
54 .read = read_cris_profile,
55 .write = write_cris_profile,
56};
57
58static int
59__init init_cris_profile(void)
60{
61 struct proc_dir_entry *entry;
62 sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
63 sample_buffer_pos = sample_buffer;
64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL);
65 if (entry) {
66 entry->proc_fops = &cris_proc_profile_operations;
67 entry->size = SAMPLE_BUFFER_SIZE;
68 }
69 prof_running = 1;
70 return 0;
71}
72
73__initcall(init_cris_profile);
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index e85a2fdd9acf..2b6363cbe985 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -8,6 +8,12 @@
8 * Authors: Bjorn Wesen 8 * Authors: Bjorn Wesen
9 * 9 *
10 * $Log: ptrace.c,v $ 10 * $Log: ptrace.c,v $
11 * Revision 1.10 2004/09/22 11:50:01 orjanf
12 * * Moved get_reg/put_reg to arch-specific files.
13 * * Added functions to access debug registers (CRISv32).
14 * * Added support for PTRACE_SINGLESTEP (CRISv32).
15 * * Added S flag to CCS_MASK (CRISv32).
16 *
11 * Revision 1.9 2003/07/04 12:56:11 tobiasa 17 * Revision 1.9 2003/07/04 12:56:11 tobiasa
12 * Moved arch-specific code to arch-specific files. 18 * Moved arch-specific code to arch-specific files.
13 * 19 *
@@ -72,37 +78,6 @@
72#include <asm/system.h> 78#include <asm/system.h>
73#include <asm/processor.h> 79#include <asm/processor.h>
74 80
75/*
76 * Get contents of register REGNO in task TASK.
77 */
78inline long get_reg(struct task_struct *task, unsigned int regno)
79{
80 /* USP is a special case, it's not in the pt_regs struct but
81 * in the tasks thread struct
82 */
83
84 if (regno == PT_USP)
85 return task->thread.usp;
86 else if (regno < PT_MAX)
87 return ((unsigned long *)user_regs(task->thread_info))[regno];
88 else
89 return 0;
90}
91
92/*
93 * Write contents of register REGNO in task TASK.
94 */
95inline int put_reg(struct task_struct *task, unsigned int regno,
96 unsigned long data)
97{
98 if (regno == PT_USP)
99 task->thread.usp = data;
100 else if (regno < PT_MAX)
101 ((unsigned long *)user_regs(task->thread_info))[regno] = data;
102 else
103 return -1;
104 return 0;
105}
106 81
107/* notification of userspace execution resumption 82/* notification of userspace execution resumption
108 * - triggered by current->work.notify_resume 83 * - triggered by current->work.notify_resume
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 6ec2671078bf..d11206e467ab 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -17,6 +17,7 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/utsname.h>
20 21
21#include <asm/setup.h> 22#include <asm/setup.h>
22 23
@@ -29,7 +30,7 @@ struct screen_info screen_info;
29extern int root_mountflags; 30extern int root_mountflags;
30extern char _etext, _edata, _end; 31extern char _etext, _edata, _end;
31 32
32static char command_line[COMMAND_LINE_SIZE] = { 0, }; 33char cris_command_line[COMMAND_LINE_SIZE] = { 0, };
33 34
34extern const unsigned long text_start, edata; /* set by the linker script */ 35extern const unsigned long text_start, edata; /* set by the linker script */
35extern unsigned long dram_start, dram_end; 36extern unsigned long dram_start, dram_end;
@@ -147,34 +148,35 @@ setup_arch(char **cmdline_p)
147 148
148 paging_init(); 149 paging_init();
149 150
150 /* We don't use a command line yet, so just re-initialize it without 151 *cmdline_p = cris_command_line;
151 saving anything that might be there. */
152
153 *cmdline_p = command_line;
154 152
155#ifdef CONFIG_ETRAX_CMDLINE 153#ifdef CONFIG_ETRAX_CMDLINE
156 strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE); 154 if (!strcmp(cris_command_line, "")) {
157 command_line[COMMAND_LINE_SIZE - 1] = '\0'; 155 strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
156 cris_command_line[COMMAND_LINE_SIZE - 1] = '\0';
157 }
158#endif
158 159
159 /* Save command line for future references. */ 160 /* Save command line for future references. */
160 memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); 161 memcpy(saved_command_line, cris_command_line, COMMAND_LINE_SIZE);
161 saved_command_line[COMMAND_LINE_SIZE - 1] = '\0'; 162 saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
162#endif
163 163
164 /* give credit for the CRIS port */ 164 /* give credit for the CRIS port */
165 show_etrax_copyright(); 165 show_etrax_copyright();
166
167 /* Setup utsname */
168 strcpy(system_utsname.machine, cris_machine_name);
166} 169}
167 170
168static void *c_start(struct seq_file *m, loff_t *pos) 171static void *c_start(struct seq_file *m, loff_t *pos)
169{ 172{
170 /* We only got one CPU... */ 173 return *pos < NR_CPUS ? (void *)(int)(*pos + 1): NULL;
171 return *pos < 1 ? (void *)1 : NULL;
172} 174}
173 175
174static void *c_next(struct seq_file *m, void *v, loff_t *pos) 176static void *c_next(struct seq_file *m, void *v, loff_t *pos)
175{ 177{
176 ++*pos; 178 ++*pos;
177 return NULL; 179 return c_start(m, pos);
178} 180}
179 181
180static void c_stop(struct seq_file *m, void *v) 182static void c_stop(struct seq_file *m, void *v)
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 6c28b0e7f7b4..fa2d4323da25 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -1,4 +1,4 @@
1/* $Id: time.c,v 1.14 2004/06/01 05:38:11 starvik Exp $ 1/* $Id: time.c,v 1.18 2005/03/04 08:16:17 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/time.c 3 * linux/arch/cris/kernel/time.c
4 * 4 *
@@ -30,6 +30,7 @@
30#include <linux/bcd.h> 30#include <linux/bcd.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/profile.h>
33 34
34u64 jiffies_64 = INITIAL_JIFFIES; 35u64 jiffies_64 = INITIAL_JIFFIES;
35 36
@@ -214,6 +215,21 @@ update_xtime_from_cmos(void)
214 } 215 }
215} 216}
216 217
218extern void cris_profile_sample(struct pt_regs* regs);
219
220void
221cris_do_profile(struct pt_regs* regs)
222{
223
224#if CONFIG_SYSTEM_PROFILER
225 cris_profile_sample(regs);
226#endif
227
228#if CONFIG_PROFILING
229 profile_tick(CPU_PROFILING, regs);
230#endif
231}
232
217/* 233/*
218 * Scheduler clock - returns current time in nanosec units. 234 * Scheduler clock - returns current time in nanosec units.
219 */ 235 */
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index d4dfa050e3a5..520d92205fed 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $ 1/* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $
2 * 2 *
3 * linux/arch/cris/traps.c 3 * linux/arch/cris/traps.c
4 * 4 *
@@ -20,13 +20,15 @@
20 20
21static int kstack_depth_to_print = 24; 21static int kstack_depth_to_print = 24;
22 22
23extern int raw_printk(const char *fmt, ...);
24
23void show_trace(unsigned long * stack) 25void show_trace(unsigned long * stack)
24{ 26{
25 unsigned long addr, module_start, module_end; 27 unsigned long addr, module_start, module_end;
26 extern char _stext, _etext; 28 extern char _stext, _etext;
27 int i; 29 int i;
28 30
29 printk("\nCall Trace: "); 31 raw_printk("\nCall Trace: ");
30 32
31 i = 1; 33 i = 1;
32 module_start = VMALLOC_START; 34 module_start = VMALLOC_START;
@@ -37,7 +39,7 @@ void show_trace(unsigned long * stack)
37 /* This message matches "failing address" marked 39 /* This message matches "failing address" marked
38 s390 in ksymoops, so lines containing it will 40 s390 in ksymoops, so lines containing it will
39 not be filtered out by ksymoops. */ 41 not be filtered out by ksymoops. */
40 printk ("Failing address 0x%lx\n", (unsigned long)stack); 42 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
41 break; 43 break;
42 } 44 }
43 stack++; 45 stack++;
@@ -54,8 +56,8 @@ void show_trace(unsigned long * stack)
54 (addr <= (unsigned long) &_etext)) || 56 (addr <= (unsigned long) &_etext)) ||
55 ((addr >= module_start) && (addr <= module_end))) { 57 ((addr >= module_start) && (addr <= module_end))) {
56 if (i && ((i % 8) == 0)) 58 if (i && ((i % 8) == 0))
57 printk("\n "); 59 raw_printk("\n ");
58 printk("[<%08lx>] ", addr); 60 raw_printk("[<%08lx>] ", addr);
59 i++; 61 i++;
60 } 62 }
61 } 63 }
@@ -96,25 +98,59 @@ show_stack(struct task_struct *task, unsigned long *sp)
96 98
97 stack = sp; 99 stack = sp;
98 100
99 printk("\nStack from %08lx:\n ", (unsigned long)stack); 101 raw_printk("\nStack from %08lx:\n ", (unsigned long)stack);
100 for(i = 0; i < kstack_depth_to_print; i++) { 102 for(i = 0; i < kstack_depth_to_print; i++) {
101 if (((long) stack & (THREAD_SIZE-1)) == 0) 103 if (((long) stack & (THREAD_SIZE-1)) == 0)
102 break; 104 break;
103 if (i && ((i % 8) == 0)) 105 if (i && ((i % 8) == 0))
104 printk("\n "); 106 raw_printk("\n ");
105 if (__get_user (addr, stack)) { 107 if (__get_user (addr, stack)) {
106 /* This message matches "failing address" marked 108 /* This message matches "failing address" marked
107 s390 in ksymoops, so lines containing it will 109 s390 in ksymoops, so lines containing it will
108 not be filtered out by ksymoops. */ 110 not be filtered out by ksymoops. */
109 printk ("Failing address 0x%lx\n", (unsigned long)stack); 111 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
110 break; 112 break;
111 } 113 }
112 stack++; 114 stack++;
113 printk("%08lx ", addr); 115 raw_printk("%08lx ", addr);
114 } 116 }
115 show_trace(sp); 117 show_trace(sp);
116} 118}
117 119
120static void (*nmi_handler)(struct pt_regs*);
121extern void arch_enable_nmi(void);
122
123void set_nmi_handler(void (*handler)(struct pt_regs*))
124{
125 nmi_handler = handler;
126 arch_enable_nmi();
127}
128
129void handle_nmi(struct pt_regs* regs)
130{
131 if (nmi_handler)
132 nmi_handler(regs);
133}
134
135#ifdef CONFIG_DEBUG_NMI_OOPS
136void oops_nmi_handler(struct pt_regs* regs)
137{
138 stop_watchdog();
139 raw_printk("NMI!\n");
140 show_registers(regs);
141}
142
143static int
144__init oops_nmi_register(void)
145{
146 set_nmi_handler(oops_nmi_handler);
147 return 0;
148}
149
150__initcall(oops_nmi_register);
151
152#endif
153
118#if 0 154#if 0
119/* displays a short stack trace */ 155/* displays a short stack trace */
120 156
@@ -123,9 +159,9 @@ show_stack()
123{ 159{
124 unsigned long *sp = (unsigned long *)rdusp(); 160 unsigned long *sp = (unsigned long *)rdusp();
125 int i; 161 int i;
126 printk("Stack dump [0x%08lx]:\n", (unsigned long)sp); 162 raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
127 for(i = 0; i < 16; i++) 163 for(i = 0; i < 16; i++)
128 printk("sp + %d: 0x%08lx\n", i*4, sp[i]); 164 raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
129 return 0; 165 return 0;
130} 166}
131#endif 167#endif
@@ -142,3 +178,9 @@ trap_init(void)
142{ 178{
143 /* Nothing needs to be done */ 179 /* Nothing needs to be done */
144} 180}
181
182void spinning_cpu(void* addr)
183{
184 raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr);
185 dump_stack();
186}
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 03254b9eded1..934c51078cce 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -6,6 +6,38 @@
6 * Authors: Bjorn Wesen 6 * Authors: Bjorn Wesen
7 * 7 *
8 * $Log: fault.c,v $ 8 * $Log: fault.c,v $
9 * Revision 1.20 2005/03/04 08:16:18 starvik
10 * Merge of Linux 2.6.11.
11 *
12 * Revision 1.19 2005/01/14 10:07:59 starvik
13 * Fixed warning.
14 *
15 * Revision 1.18 2005/01/12 08:10:14 starvik
16 * Readded the change of frametype when handling kernel page fault fixup
17 * for v10. This is necessary to avoid that the CPU remakes the faulting
18 * access.
19 *
20 * Revision 1.17 2005/01/11 13:53:05 starvik
21 * Use raw_printk.
22 *
23 * Revision 1.16 2004/12/17 11:39:41 starvik
24 * SMP support.
25 *
26 * Revision 1.15 2004/11/23 18:36:18 starvik
27 * Stack is now non-executable.
28 * Signal handler trampolines are placed in a reserved page mapped into all
29 * processes.
30 *
31 * Revision 1.14 2004/11/23 07:10:21 starvik
32 * Moved find_fixup_code to generic code.
33 *
34 * Revision 1.13 2004/11/23 07:00:54 starvik
35 * Actually use the execute permission bit in the MMU. This makes it possible
36 * to prevent e.g. attacks where executable code is put on the stack.
37 *
38 * Revision 1.12 2004/09/29 06:16:04 starvik
39 * Use instruction_pointer
40 *
9 * Revision 1.11 2004/05/14 07:58:05 starvik 41 * Revision 1.11 2004/05/14 07:58:05 starvik
10 * Merge of changes from 2.4 42 * Merge of changes from 2.4
11 * 43 *
@@ -103,6 +135,7 @@
103 135
104extern int find_fixup_code(struct pt_regs *); 136extern int find_fixup_code(struct pt_regs *);
105extern void die_if_kernel(const char *, struct pt_regs *, long); 137extern void die_if_kernel(const char *, struct pt_regs *, long);
138extern int raw_printk(const char *fmt, ...);
106 139
107/* debug of low-level TLB reload */ 140/* debug of low-level TLB reload */
108#undef DEBUG 141#undef DEBUG
@@ -118,7 +151,8 @@ extern void die_if_kernel(const char *, struct pt_regs *, long);
118 151
119/* current active page directory */ 152/* current active page directory */
120 153
121volatile pgd_t *current_pgd; 154volatile DEFINE_PER_CPU(pgd_t *,current_pgd);
155unsigned long cris_signal_return_page;
122 156
123/* 157/*
124 * This routine handles page faults. It determines the address, 158 * This routine handles page faults. It determines the address,
@@ -146,8 +180,9 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
146 struct vm_area_struct * vma; 180 struct vm_area_struct * vma;
147 siginfo_t info; 181 siginfo_t info;
148 182
149 D(printk("Page fault for %X at %X, prot %d write %d\n", 183 D(printk("Page fault for %lX on %X at %lX, prot %d write %d\n",
150 address, regs->erp, protection, writeaccess)); 184 address, smp_processor_id(), instruction_pointer(regs),
185 protection, writeaccess));
151 186
152 tsk = current; 187 tsk = current;
153 188
@@ -175,8 +210,19 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
175 !user_mode(regs)) 210 !user_mode(regs))
176 goto vmalloc_fault; 211 goto vmalloc_fault;
177 212
213 /* When stack execution is not allowed we store the signal
214 * trampolines in the reserved cris_signal_return_page.
215 * Handle this in the exact same way as vmalloc (we know
216 * that the mapping is there and is valid so no need to
217 * call handle_mm_fault).
218 */
219 if (cris_signal_return_page &&
220 address == cris_signal_return_page &&
221 !protection && user_mode(regs))
222 goto vmalloc_fault;
223
178 /* we can and should enable interrupts at this point */ 224 /* we can and should enable interrupts at this point */
179 sti(); 225 local_irq_enable();
180 226
181 mm = tsk->mm; 227 mm = tsk->mm;
182 info.si_code = SEGV_MAPERR; 228 info.si_code = SEGV_MAPERR;
@@ -220,7 +266,10 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
220 266
221 /* first do some preliminary protection checks */ 267 /* first do some preliminary protection checks */
222 268
223 if (writeaccess) { 269 if (writeaccess == 2){
270 if (!(vma->vm_flags & VM_EXEC))
271 goto bad_area;
272 } else if (writeaccess == 1) {
224 if (!(vma->vm_flags & VM_WRITE)) 273 if (!(vma->vm_flags & VM_WRITE))
225 goto bad_area; 274 goto bad_area;
226 } else { 275 } else {
@@ -234,14 +283,14 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
234 * the fault. 283 * the fault.
235 */ 284 */
236 285
237 switch (handle_mm_fault(mm, vma, address, writeaccess)) { 286 switch (handle_mm_fault(mm, vma, address, writeaccess & 1)) {
238 case 1: 287 case VM_FAULT_MINOR:
239 tsk->min_flt++; 288 tsk->min_flt++;
240 break; 289 break;
241 case 2: 290 case VM_FAULT_MAJOR:
242 tsk->maj_flt++; 291 tsk->maj_flt++;
243 break; 292 break;
244 case 0: 293 case VM_FAULT_SIGBUS:
245 goto do_sigbus; 294 goto do_sigbus;
246 default: 295 default:
247 goto out_of_memory; 296 goto out_of_memory;
@@ -292,10 +341,10 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
292 */ 341 */
293 342
294 if ((unsigned long) (address) < PAGE_SIZE) 343 if ((unsigned long) (address) < PAGE_SIZE)
295 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); 344 raw_printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
296 else 345 else
297 printk(KERN_ALERT "Unable to handle kernel access"); 346 raw_printk(KERN_ALERT "Unable to handle kernel access");
298 printk(" at virtual address %08lx\n",address); 347 raw_printk(" at virtual address %08lx\n",address);
299 348
300 die_if_kernel("Oops", regs, (writeaccess << 1) | protection); 349 die_if_kernel("Oops", regs, (writeaccess << 1) | protection);
301 350
@@ -346,10 +395,11 @@ vmalloc_fault:
346 395
347 int offset = pgd_index(address); 396 int offset = pgd_index(address);
348 pgd_t *pgd, *pgd_k; 397 pgd_t *pgd, *pgd_k;
398 pud_t *pud, *pud_k;
349 pmd_t *pmd, *pmd_k; 399 pmd_t *pmd, *pmd_k;
350 pte_t *pte_k; 400 pte_t *pte_k;
351 401
352 pgd = (pgd_t *)current_pgd + offset; 402 pgd = (pgd_t *)per_cpu(current_pgd, smp_processor_id()) + offset;
353 pgd_k = init_mm.pgd + offset; 403 pgd_k = init_mm.pgd + offset;
354 404
355 /* Since we're two-level, we don't need to do both 405 /* Since we're two-level, we don't need to do both
@@ -364,8 +414,13 @@ vmalloc_fault:
364 * it exists. 414 * it exists.
365 */ 415 */
366 416
367 pmd = pmd_offset(pgd, address); 417 pud = pud_offset(pgd, address);
368 pmd_k = pmd_offset(pgd_k, address); 418 pud_k = pud_offset(pgd_k, address);
419 if (!pud_present(*pud_k))
420 goto no_context;
421
422 pmd = pmd_offset(pud, address);
423 pmd_k = pmd_offset(pud_k, address);
369 424
370 if (!pmd_present(*pmd_k)) 425 if (!pmd_present(*pmd_k))
371 goto bad_area_nosemaphore; 426 goto bad_area_nosemaphore;
@@ -385,3 +440,19 @@ vmalloc_fault:
385 return; 440 return;
386 } 441 }
387} 442}
443
444/* Find fixup code. */
445int
446find_fixup_code(struct pt_regs *regs)
447{
448 const struct exception_table_entry *fixup;
449
450 if ((fixup = search_exception_tables(instruction_pointer(regs))) != 0) {
451 /* Adjust the instruction pointer in the stackframe. */
452 instruction_pointer(regs) = fixup->fixup;
453 arch_fixup(regs);
454 return 1;
455 }
456
457 return 0;
458}
diff --git a/arch/cris/mm/ioremap.c b/arch/cris/mm/ioremap.c
index 6b9130bfb6c1..ebba11e270fa 100644
--- a/arch/cris/mm/ioremap.c
+++ b/arch/cris/mm/ioremap.c
@@ -14,9 +14,10 @@
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/arch/memmap.h>
17 18
18extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, 19extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
19 unsigned long phys_addr, unsigned long flags) 20 unsigned long phys_addr, pgprot_t prot)
20{ 21{
21 unsigned long end; 22 unsigned long end;
22 23
@@ -31,9 +32,7 @@ extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l
31 printk("remap_area_pte: page already exists\n"); 32 printk("remap_area_pte: page already exists\n");
32 BUG(); 33 BUG();
33 } 34 }
34 set_pte(pte, mk_pte_phys(phys_addr, __pgprot(_PAGE_PRESENT | __READABLE | 35 set_pte(pte, mk_pte_phys(phys_addr, prot));
35 __WRITEABLE | _PAGE_GLOBAL |
36 _PAGE_KERNEL | flags)));
37 address += PAGE_SIZE; 36 address += PAGE_SIZE;
38 phys_addr += PAGE_SIZE; 37 phys_addr += PAGE_SIZE;
39 pte++; 38 pte++;
@@ -41,7 +40,7 @@ extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l
41} 40}
42 41
43static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, 42static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
44 unsigned long phys_addr, unsigned long flags) 43 unsigned long phys_addr, pgprot_t prot)
45{ 44{
46 unsigned long end; 45 unsigned long end;
47 46
@@ -56,7 +55,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo
56 pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); 55 pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
57 if (!pte) 56 if (!pte)
58 return -ENOMEM; 57 return -ENOMEM;
59 remap_area_pte(pte, address, end - address, address + phys_addr, flags); 58 remap_area_pte(pte, address, end - address, address + phys_addr, prot);
60 address = (address + PMD_SIZE) & PMD_MASK; 59 address = (address + PMD_SIZE) & PMD_MASK;
61 pmd++; 60 pmd++;
62 } while (address && (address < end)); 61 } while (address && (address < end));
@@ -64,7 +63,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo
64} 63}
65 64
66static int remap_area_pages(unsigned long address, unsigned long phys_addr, 65static int remap_area_pages(unsigned long address, unsigned long phys_addr,
67 unsigned long size, unsigned long flags) 66 unsigned long size, pgprot_t prot)
68{ 67{
69 int error; 68 int error;
70 pgd_t * dir; 69 pgd_t * dir;
@@ -77,13 +76,19 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
77 BUG(); 76 BUG();
78 spin_lock(&init_mm.page_table_lock); 77 spin_lock(&init_mm.page_table_lock);
79 do { 78 do {
79 pud_t *pud;
80 pmd_t *pmd; 80 pmd_t *pmd;
81 pmd = pmd_alloc(&init_mm, dir, address); 81
82 error = -ENOMEM; 82 error = -ENOMEM;
83 pud = pud_alloc(&init_mm, dir, address);
84 if (!pud)
85 break;
86 pmd = pmd_alloc(&init_mm, pud, address);
87
83 if (!pmd) 88 if (!pmd)
84 break; 89 break;
85 if (remap_area_pmd(pmd, address, end - address, 90 if (remap_area_pmd(pmd, address, end - address,
86 phys_addr + address, flags)) 91 phys_addr + address, prot))
87 break; 92 break;
88 error = 0; 93 error = 0;
89 address = (address + PGDIR_SIZE) & PGDIR_MASK; 94 address = (address + PGDIR_SIZE) & PGDIR_MASK;
@@ -107,9 +112,9 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
107 * have to convert them into an offset in a page-aligned mapping, but the 112 * have to convert them into an offset in a page-aligned mapping, but the
108 * caller shouldn't need to know that small detail. 113 * caller shouldn't need to know that small detail.
109 */ 114 */
110void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 115void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot)
111{ 116{
112 void * addr; 117 void __iomem * addr;
113 struct vm_struct * area; 118 struct vm_struct * area;
114 unsigned long offset, last_addr; 119 unsigned long offset, last_addr;
115 120
@@ -131,15 +136,36 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
131 area = get_vm_area(size, VM_IOREMAP); 136 area = get_vm_area(size, VM_IOREMAP);
132 if (!area) 137 if (!area)
133 return NULL; 138 return NULL;
134 addr = area->addr; 139 addr = (void __iomem *)area->addr;
135 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 140 if (remap_area_pages((unsigned long) addr, phys_addr, size, prot)) {
136 vfree(addr); 141 vfree((void __force *)addr);
137 return NULL; 142 return NULL;
138 } 143 }
139 return (void *) (offset + (char *)addr); 144 return (void __iomem *) (offset + (char __iomem *)addr);
145}
146
147void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
148{
149 return __ioremap_prot(phys_addr, size,
150 __pgprot(_PAGE_PRESENT | __READABLE |
151 __WRITEABLE | _PAGE_GLOBAL |
152 _PAGE_KERNEL | flags));
153}
154
155/**
156 * ioremap_nocache - map bus memory into CPU space
157 * @offset: bus address of the memory
158 * @size: size of the resource to map
159 *
160 * Must be freed with iounmap.
161 */
162
163void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
164{
165 return __ioremap(phys_addr | MEM_NON_CACHEABLE, size, 0);
140} 166}
141 167
142void iounmap(void *addr) 168void iounmap(volatile void __iomem *addr)
143{ 169{
144 if (addr > high_memory) 170 if (addr > high_memory)
145 return vfree((void *) (PAGE_MASK & (unsigned long) addr)); 171 return vfree((void *) (PAGE_MASK & (unsigned long) addr));
diff --git a/arch/cris/mm/tlb.c b/arch/cris/mm/tlb.c
index 23eca5ad7389..0df390a656cd 100644
--- a/arch/cris/mm/tlb.c
+++ b/arch/cris/mm/tlb.c
@@ -29,18 +29,6 @@
29struct mm_struct *page_id_map[NUM_PAGEID]; 29struct mm_struct *page_id_map[NUM_PAGEID];
30static int map_replace_ptr = 1; /* which page_id_map entry to replace next */ 30static int map_replace_ptr = 1; /* which page_id_map entry to replace next */
31 31
32/*
33 * Initialize the context related info for a new mm_struct
34 * instance.
35 */
36
37int
38init_new_context(struct task_struct *tsk, struct mm_struct *mm)
39{
40 mm->context = NO_CONTEXT;
41 return 0;
42}
43
44/* the following functions are similar to those used in the PPC port */ 32/* the following functions are similar to those used in the PPC port */
45 33
46static inline void 34static inline void
@@ -60,12 +48,12 @@ alloc_context(struct mm_struct *mm)
60 */ 48 */
61 flush_tlb_mm(old_mm); 49 flush_tlb_mm(old_mm);
62 50
63 old_mm->context = NO_CONTEXT; 51 old_mm->context.page_id = NO_CONTEXT;
64 } 52 }
65 53
66 /* insert it into the page_id_map */ 54 /* insert it into the page_id_map */
67 55
68 mm->context = map_replace_ptr; 56 mm->context.page_id = map_replace_ptr;
69 page_id_map[map_replace_ptr] = mm; 57 page_id_map[map_replace_ptr] = mm;
70 58
71 map_replace_ptr++; 59 map_replace_ptr++;
@@ -81,7 +69,7 @@ alloc_context(struct mm_struct *mm)
81void 69void
82get_mmu_context(struct mm_struct *mm) 70get_mmu_context(struct mm_struct *mm)
83{ 71{
84 if(mm->context == NO_CONTEXT) 72 if(mm->context.page_id == NO_CONTEXT)
85 alloc_context(mm); 73 alloc_context(mm);
86} 74}
87 75
@@ -96,11 +84,10 @@ get_mmu_context(struct mm_struct *mm)
96void 84void
97destroy_context(struct mm_struct *mm) 85destroy_context(struct mm_struct *mm)
98{ 86{
99 if(mm->context != NO_CONTEXT) { 87 if(mm->context.page_id != NO_CONTEXT) {
100 D(printk("destroy_context %d (%p)\n", mm->context, mm)); 88 D(printk("destroy_context %d (%p)\n", mm->context.page_id, mm));
101 flush_tlb_mm(mm); /* TODO this might be redundant ? */ 89 flush_tlb_mm(mm); /* TODO this might be redundant ? */
102 page_id_map[mm->context] = NULL; 90 page_id_map[mm->context.page_id] = NULL;
103 /* mm->context = NO_CONTEXT; redundant.. mm will be freed */
104 } 91 }
105} 92}
106 93
diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c
index 41d02ac48233..8b3eb50c5105 100644
--- a/arch/frv/mm/fault.c
+++ b/arch/frv/mm/fault.c
@@ -163,13 +163,13 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
163 * the fault. 163 * the fault.
164 */ 164 */
165 switch (handle_mm_fault(mm, vma, ear0, write)) { 165 switch (handle_mm_fault(mm, vma, ear0, write)) {
166 case 1: 166 case VM_FAULT_MINOR:
167 current->min_flt++; 167 current->min_flt++;
168 break; 168 break;
169 case 2: 169 case VM_FAULT_MAJOR:
170 current->maj_flt++; 170 current->maj_flt++;
171 break; 171 break;
172 case 0: 172 case VM_FAULT_SIGBUS:
173 goto do_sigbus; 173 goto do_sigbus;
174 default: 174 default:
175 goto out_of_memory; 175 goto out_of_memory;
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index a801d9d48606..619d843ba231 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -454,8 +454,9 @@ config HPET_TIMER
454 Choose N to continue using the legacy 8254 timer. 454 Choose N to continue using the legacy 8254 timer.
455 455
456config HPET_EMULATE_RTC 456config HPET_EMULATE_RTC
457 bool "Provide RTC interrupt" 457 bool
458 depends on HPET_TIMER && RTC=y 458 depends on HPET_TIMER && RTC=y
459 default y
459 460
460config SMP 461config SMP
461 bool "Symmetric multi-processing support" 462 bool "Symmetric multi-processing support"
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index bfb2064f7104..5228c40a6fb2 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -18,6 +18,9 @@ config EARLY_PRINTK
18config DEBUG_STACKOVERFLOW 18config DEBUG_STACKOVERFLOW
19 bool "Check for stack overflows" 19 bool "Check for stack overflows"
20 depends on DEBUG_KERNEL 20 depends on DEBUG_KERNEL
21 help
22 This option will cause messages to be printed if free stack space
23 drops below a certain limit.
21 24
22config KPROBES 25config KPROBES
23 bool "Kprobes" 26 bool "Kprobes"
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 963e17aa205d..60a9e54dd20e 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -442,6 +442,13 @@ acpi_cpufreq_cpu_init (
442 (u32) data->acpi_data.states[i].transition_latency); 442 (u32) data->acpi_data.states[i].transition_latency);
443 443
444 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); 444 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);
445
446 /*
447 * the first call to ->target() should result in us actually
448 * writing something to the appropriate registers.
449 */
450 data->resume = 1;
451
445 return (result); 452 return (result);
446 453
447 err_freqfree: 454 err_freqfree:
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 10cc096c0ade..ab6e0611303d 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * (c) 2003, 2004 Advanced Micro Devices, Inc. 2 * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc.
3 * Your use of this code is subject to the terms and conditions of the 3 * Your use of this code is subject to the terms and conditions of the
4 * GNU general public license version 2. See "COPYING" or 4 * GNU general public license version 2. See "COPYING" or
5 * http://www.gnu.org/licenses/gpl.html 5 * http://www.gnu.org/licenses/gpl.html
@@ -44,7 +44,7 @@
44 44
45#define PFX "powernow-k8: " 45#define PFX "powernow-k8: "
46#define BFX PFX "BIOS error: " 46#define BFX PFX "BIOS error: "
47#define VERSION "version 1.40.2" 47#define VERSION "version 1.50.3"
48#include "powernow-k8.h" 48#include "powernow-k8.h"
49 49
50/* serialize freq changes */ 50/* serialize freq changes */
@@ -110,14 +110,13 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
110 u32 lo, hi; 110 u32 lo, hi;
111 u32 i = 0; 111 u32 i = 0;
112 112
113 lo = MSR_S_LO_CHANGE_PENDING; 113 do {
114 while (lo & MSR_S_LO_CHANGE_PENDING) {
115 if (i++ > 0x1000000) { 114 if (i++ > 0x1000000) {
116 printk(KERN_ERR PFX "detected change pending stuck\n"); 115 printk(KERN_ERR PFX "detected change pending stuck\n");
117 return 1; 116 return 1;
118 } 117 }
119 rdmsr(MSR_FIDVID_STATUS, lo, hi); 118 rdmsr(MSR_FIDVID_STATUS, lo, hi);
120 } 119 } while (lo & MSR_S_LO_CHANGE_PENDING);
121 120
122 data->currvid = hi & MSR_S_HI_CURRENT_VID; 121 data->currvid = hi & MSR_S_HI_CURRENT_VID;
123 data->currfid = lo & MSR_S_LO_CURRENT_FID; 122 data->currfid = lo & MSR_S_LO_CURRENT_FID;
@@ -232,7 +231,7 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid)
232/* 231/*
233 * Reduce the vid by the max of step or reqvid. 232 * Reduce the vid by the max of step or reqvid.
234 * Decreasing vid codes represent increasing voltages: 233 * Decreasing vid codes represent increasing voltages:
235 * vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of 0x1f is off. 234 * vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of VID_OFF is off.
236 */ 235 */
237static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step) 236static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step)
238{ 237{
@@ -467,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu)
467 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); 466 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
468 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || 467 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
469 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || 468 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
470 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_E)) { 469 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) {
471 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); 470 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
472 goto out; 471 goto out;
473 } 472 }
@@ -696,6 +695,7 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
696 695
697 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; 696 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK;
698 data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK; 697 data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK;
698 data->exttype = (data->acpi_data.states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK;
699 data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; 699 data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK;
700 data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK); 700 data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK);
701 data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK; 701 data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK;
@@ -735,8 +735,16 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
735 } 735 }
736 736
737 for (i = 0; i < data->acpi_data.state_count; i++) { 737 for (i = 0; i < data->acpi_data.state_count; i++) {
738 u32 fid = data->acpi_data.states[i].control & FID_MASK; 738 u32 fid;
739 u32 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK; 739 u32 vid;
740
741 if (data->exttype) {
742 fid = data->acpi_data.states[i].status & FID_MASK;
743 vid = (data->acpi_data.states[i].status >> VID_SHIFT) & VID_MASK;
744 } else {
745 fid = data->acpi_data.states[i].control & FID_MASK;
746 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK;
747 }
740 748
741 dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid); 749 dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
742 750
@@ -753,7 +761,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
753 } 761 }
754 762
755 /* verify voltage is OK - BIOSs are using "off" to indicate invalid */ 763 /* verify voltage is OK - BIOSs are using "off" to indicate invalid */
756 if (vid == 0x1f) { 764 if (vid == VID_OFF) {
757 dprintk("invalid vid %u, ignoring\n", vid); 765 dprintk("invalid vid %u, ignoring\n", vid);
758 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; 766 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
759 continue; 767 continue;
@@ -930,15 +938,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
930 938
931 down(&fidvid_sem); 939 down(&fidvid_sem);
932 940
933 for_each_cpu_mask(i, cpu_core_map[pol->cpu]) {
934 /* make sure the sibling is initialized */
935 if (!powernow_data[i]) {
936 ret = 0;
937 up(&fidvid_sem);
938 goto err_out;
939 }
940 }
941
942 powernow_k8_acpi_pst_values(data, newstate); 941 powernow_k8_acpi_pst_values(data, newstate);
943 942
944 if (transition_frequency(data, newstate)) { 943 if (transition_frequency(data, newstate)) {
@@ -978,7 +977,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
978{ 977{
979 struct powernow_k8_data *data; 978 struct powernow_k8_data *data;
980 cpumask_t oldmask = CPU_MASK_ALL; 979 cpumask_t oldmask = CPU_MASK_ALL;
981 int rc; 980 int rc, i;
982 981
983 if (!check_supported_cpu(pol->cpu)) 982 if (!check_supported_cpu(pol->cpu))
984 return -ENODEV; 983 return -ENODEV;
@@ -1064,7 +1063,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
1064 printk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1063 printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1065 data->currfid, data->currvid); 1064 data->currfid, data->currvid);
1066 1065
1067 powernow_data[pol->cpu] = data; 1066 for_each_cpu_mask(i, cpu_core_map[pol->cpu]) {
1067 powernow_data[i] = data;
1068 }
1068 1069
1069 return 0; 1070 return 0;
1070 1071
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 9ed5bf221cb7..b1e85bb36396 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * (c) 2003, 2004 Advanced Micro Devices, Inc. 2 * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc.
3 * Your use of this code is subject to the terms and conditions of the 3 * Your use of this code is subject to the terms and conditions of the
4 * GNU general public license version 2. See "COPYING" or 4 * GNU general public license version 2. See "COPYING" or
5 * http://www.gnu.org/licenses/gpl.html 5 * http://www.gnu.org/licenses/gpl.html
@@ -19,6 +19,7 @@ struct powernow_k8_data {
19 u32 vidmvs; /* usable value calculated from mvs */ 19 u32 vidmvs; /* usable value calculated from mvs */
20 u32 vstable; /* voltage stabilization time, units 20 us */ 20 u32 vstable; /* voltage stabilization time, units 20 us */
21 u32 plllock; /* pll lock time, units 1 us */ 21 u32 plllock; /* pll lock time, units 1 us */
22 u32 exttype; /* extended interface = 1 */
22 23
23 /* keep track of the current fid / vid */ 24 /* keep track of the current fid / vid */
24 u32 currvid, currfid; 25 u32 currvid, currfid;
@@ -41,7 +42,7 @@ struct powernow_k8_data {
41#define CPUID_XFAM 0x0ff00000 /* extended family */ 42#define CPUID_XFAM 0x0ff00000 /* extended family */
42#define CPUID_XFAM_K8 0 43#define CPUID_XFAM_K8 0
43#define CPUID_XMOD 0x000f0000 /* extended model */ 44#define CPUID_XMOD 0x000f0000 /* extended model */
44#define CPUID_XMOD_REV_E 0x00020000 45#define CPUID_XMOD_REV_F 0x00040000
45#define CPUID_USE_XFAM_XMOD 0x00000f00 46#define CPUID_USE_XFAM_XMOD 0x00000f00
46#define CPUID_GET_MAX_CAPABILITIES 0x80000000 47#define CPUID_GET_MAX_CAPABILITIES 0x80000000
47#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
@@ -57,25 +58,26 @@ struct powernow_k8_data {
57 58
58/* Field definitions within the FID VID Low Control MSR : */ 59/* Field definitions within the FID VID Low Control MSR : */
59#define MSR_C_LO_INIT_FID_VID 0x00010000 60#define MSR_C_LO_INIT_FID_VID 0x00010000
60#define MSR_C_LO_NEW_VID 0x00001f00 61#define MSR_C_LO_NEW_VID 0x00003f00
61#define MSR_C_LO_NEW_FID 0x0000002f 62#define MSR_C_LO_NEW_FID 0x0000003f
62#define MSR_C_LO_VID_SHIFT 8 63#define MSR_C_LO_VID_SHIFT 8
63 64
64/* Field definitions within the FID VID High Control MSR : */ 65/* Field definitions within the FID VID High Control MSR : */
65#define MSR_C_HI_STP_GNT_TO 0x000fffff 66#define MSR_C_HI_STP_GNT_TO 0x000fffff
66 67
67/* Field definitions within the FID VID Low Status MSR : */ 68/* Field definitions within the FID VID Low Status MSR : */
68#define MSR_S_LO_CHANGE_PENDING 0x80000000 /* cleared when completed */ 69#define MSR_S_LO_CHANGE_PENDING 0x80000000 /* cleared when completed */
69#define MSR_S_LO_MAX_RAMP_VID 0x1f000000 70#define MSR_S_LO_MAX_RAMP_VID 0x3f000000
70#define MSR_S_LO_MAX_FID 0x003f0000 71#define MSR_S_LO_MAX_FID 0x003f0000
71#define MSR_S_LO_START_FID 0x00003f00 72#define MSR_S_LO_START_FID 0x00003f00
72#define MSR_S_LO_CURRENT_FID 0x0000003f 73#define MSR_S_LO_CURRENT_FID 0x0000003f
73 74
74/* Field definitions within the FID VID High Status MSR : */ 75/* Field definitions within the FID VID High Status MSR : */
75#define MSR_S_HI_MAX_WORKING_VID 0x001f0000 76#define MSR_S_HI_MIN_WORKING_VID 0x3f000000
76#define MSR_S_HI_START_VID 0x00001f00 77#define MSR_S_HI_MAX_WORKING_VID 0x003f0000
77#define MSR_S_HI_CURRENT_VID 0x0000001f 78#define MSR_S_HI_START_VID 0x00003f00
78#define MSR_C_HI_STP_GNT_BENIGN 0x00000001 79#define MSR_S_HI_CURRENT_VID 0x0000003f
80#define MSR_C_HI_STP_GNT_BENIGN 0x00000001
79 81
80/* 82/*
81 * There are restrictions frequencies have to follow: 83 * There are restrictions frequencies have to follow:
@@ -99,13 +101,15 @@ struct powernow_k8_data {
99#define MIN_FREQ_RESOLUTION 200 /* fids jump by 2 matching freq jumps by 200 */ 101#define MIN_FREQ_RESOLUTION 200 /* fids jump by 2 matching freq jumps by 200 */
100 102
101#define MAX_FID 0x2a /* Spec only gives FID values as far as 5 GHz */ 103#define MAX_FID 0x2a /* Spec only gives FID values as far as 5 GHz */
102#define LEAST_VID 0x1e /* Lowest (numerically highest) useful vid value */ 104#define LEAST_VID 0x3e /* Lowest (numerically highest) useful vid value */
103 105
104#define MIN_FREQ 800 /* Min and max freqs, per spec */ 106#define MIN_FREQ 800 /* Min and max freqs, per spec */
105#define MAX_FREQ 5000 107#define MAX_FREQ 5000
106 108
107#define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ 109#define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */
108#define INVALID_VID_MASK 0xffffffe0 /* not a valid vid if these bits are set */ 110#define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */
111
112#define VID_OFF 0x3f
109 113
110#define STOP_GRANT_5NS 1 /* min poss memory access latency for voltage change */ 114#define STOP_GRANT_5NS 1 /* min poss memory access latency for voltage change */
111 115
@@ -121,12 +125,14 @@ struct powernow_k8_data {
121 125
122#define IRT_SHIFT 30 126#define IRT_SHIFT 30
123#define RVO_SHIFT 28 127#define RVO_SHIFT 28
128#define EXT_TYPE_SHIFT 27
124#define PLL_L_SHIFT 20 129#define PLL_L_SHIFT 20
125#define MVS_SHIFT 18 130#define MVS_SHIFT 18
126#define VST_SHIFT 11 131#define VST_SHIFT 11
127#define VID_SHIFT 6 132#define VID_SHIFT 6
128#define IRT_MASK 3 133#define IRT_MASK 3
129#define RVO_MASK 3 134#define RVO_MASK 3
135#define EXT_TYPE_MASK 1
130#define PLL_L_MASK 0x7f 136#define PLL_L_MASK 0x7f
131#define MVS_MASK 3 137#define MVS_MASK 3
132#define VST_MASK 0x7f 138#define VST_MASK 0x7f
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index 1d768b263269..6c55b50cf048 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -128,7 +128,7 @@ static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
128 cpuid_count(4, index, &eax, &ebx, &ecx, &edx); 128 cpuid_count(4, index, &eax, &ebx, &ecx, &edx);
129 cache_eax.full = eax; 129 cache_eax.full = eax;
130 if (cache_eax.split.type == CACHE_TYPE_NULL) 130 if (cache_eax.split.type == CACHE_TYPE_NULL)
131 return -1; 131 return -EIO; /* better error ? */
132 132
133 this_leaf->eax.full = eax; 133 this_leaf->eax.full = eax;
134 this_leaf->ebx.full = ebx; 134 this_leaf->ebx.full = ebx;
@@ -334,6 +334,7 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
334 struct _cpuid4_info *this_leaf; 334 struct _cpuid4_info *this_leaf;
335 unsigned long j; 335 unsigned long j;
336 int retval; 336 int retval;
337 cpumask_t oldmask;
337 338
338 if (num_cache_leaves == 0) 339 if (num_cache_leaves == 0)
339 return -ENOENT; 340 return -ENOENT;
@@ -345,19 +346,26 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
345 memset(cpuid4_info[cpu], 0, 346 memset(cpuid4_info[cpu], 0,
346 sizeof(struct _cpuid4_info) * num_cache_leaves); 347 sizeof(struct _cpuid4_info) * num_cache_leaves);
347 348
349 oldmask = current->cpus_allowed;
350 retval = set_cpus_allowed(current, cpumask_of_cpu(cpu));
351 if (retval)
352 goto out;
353
348 /* Do cpuid and store the results */ 354 /* Do cpuid and store the results */
355 retval = 0;
349 for (j = 0; j < num_cache_leaves; j++) { 356 for (j = 0; j < num_cache_leaves; j++) {
350 this_leaf = CPUID4_INFO_IDX(cpu, j); 357 this_leaf = CPUID4_INFO_IDX(cpu, j);
351 retval = cpuid4_cache_lookup(j, this_leaf); 358 retval = cpuid4_cache_lookup(j, this_leaf);
352 if (unlikely(retval < 0)) 359 if (unlikely(retval < 0))
353 goto err_out; 360 break;
354 cache_shared_cpu_map_setup(cpu, j); 361 cache_shared_cpu_map_setup(cpu, j);
355 } 362 }
356 return 0; 363 set_cpus_allowed(current, oldmask);
357 364
358err_out: 365out:
359 free_cache_attributes(cpu); 366 if (retval)
360 return -ENOMEM; 367 free_cache_attributes(cpu);
368 return retval;
361} 369}
362 370
363#ifdef CONFIG_SYSFS 371#ifdef CONFIG_SYSFS
diff --git a/arch/i386/kernel/cpu/transmeta.c b/arch/i386/kernel/cpu/transmeta.c
index f57e5ee94943..fc426380366b 100644
--- a/arch/i386/kernel/cpu/transmeta.c
+++ b/arch/i386/kernel/cpu/transmeta.c
@@ -76,6 +76,12 @@ static void __init init_transmeta(struct cpuinfo_x86 *c)
76#define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV) 76#define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV)
77 if ( c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686 ) 77 if ( c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686 )
78 c->x86 = 6; 78 c->x86 = 6;
79
80#ifdef CONFIG_SYSCTL
81 /* randomize_va_space slows us down enormously;
82 it probably triggers retranslation of x86->native bytecode */
83 randomize_va_space = 0;
84#endif
79} 85}
80 86
81static void transmeta_identify(struct cpuinfo_x86 * c) 87static void transmeta_identify(struct cpuinfo_x86 * c)
diff --git a/arch/i386/kernel/machine_kexec.c b/arch/i386/kernel/machine_kexec.c
index 52ed18d8b511..cb699a2aa1f8 100644
--- a/arch/i386/kernel/machine_kexec.c
+++ b/arch/i386/kernel/machine_kexec.c
@@ -16,6 +16,7 @@
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/apic.h> 17#include <asm/apic.h>
18#include <asm/cpufeature.h> 18#include <asm/cpufeature.h>
19#include <asm/desc.h>
19 20
20static inline unsigned long read_cr3(void) 21static inline unsigned long read_cr3(void)
21{ 22{
@@ -90,33 +91,32 @@ static void identity_map_page(unsigned long address)
90} 91}
91#endif 92#endif
92 93
93
94static void set_idt(void *newidt, __u16 limit) 94static void set_idt(void *newidt, __u16 limit)
95{ 95{
96 unsigned char curidt[6]; 96 struct Xgt_desc_struct curidt;
97 97
98 /* ia32 supports unaliged loads & stores */ 98 /* ia32 supports unaliged loads & stores */
99 (*(__u16 *)(curidt)) = limit; 99 curidt.size = limit;
100 (*(__u32 *)(curidt +2)) = (unsigned long)(newidt); 100 curidt.address = (unsigned long)newidt;
101 101
102 __asm__ __volatile__ ( 102 __asm__ __volatile__ (
103 "lidt %0\n" 103 "lidtl %0\n"
104 : "=m" (curidt) 104 : : "m" (curidt)
105 ); 105 );
106}; 106};
107 107
108 108
109static void set_gdt(void *newgdt, __u16 limit) 109static void set_gdt(void *newgdt, __u16 limit)
110{ 110{
111 unsigned char curgdt[6]; 111 struct Xgt_desc_struct curgdt;
112 112
113 /* ia32 supports unaligned loads & stores */ 113 /* ia32 supports unaligned loads & stores */
114 (*(__u16 *)(curgdt)) = limit; 114 curgdt.size = limit;
115 (*(__u32 *)(curgdt +2)) = (unsigned long)(newgdt); 115 curgdt.address = (unsigned long)newgdt;
116 116
117 __asm__ __volatile__ ( 117 __asm__ __volatile__ (
118 "lgdt %0\n" 118 "lgdtl %0\n"
119 : "=m" (curgdt) 119 : : "m" (curgdt)
120 ); 120 );
121}; 121};
122 122
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index af917f609c7d..ce838abb27d8 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -1116,7 +1116,15 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1116 */ 1116 */
1117 int irq = gsi; 1117 int irq = gsi;
1118 if (gsi < MAX_GSI_NUM) { 1118 if (gsi < MAX_GSI_NUM) {
1119 gsi = pci_irq++; 1119 if (gsi > 15)
1120 gsi = pci_irq++;
1121#ifdef CONFIG_ACPI_BUS
1122 /*
1123 * Don't assign IRQ used by ACPI SCI
1124 */
1125 if (gsi == acpi_fadt.sci_int)
1126 gsi = pci_irq++;
1127#endif
1120 gsi_to_irq[irq] = gsi; 1128 gsi_to_irq[irq] = gsi;
1121 } else { 1129 } else {
1122 printk(KERN_ERR "GSI %u is too high\n", gsi); 1130 printk(KERN_ERR "GSI %u is too high\n", gsi);
diff --git a/arch/i386/kernel/numaq.c b/arch/i386/kernel/numaq.c
index e51edf0a6564..5f5b075f860a 100644
--- a/arch/i386/kernel/numaq.c
+++ b/arch/i386/kernel/numaq.c
@@ -31,6 +31,7 @@
31#include <linux/nodemask.h> 31#include <linux/nodemask.h>
32#include <asm/numaq.h> 32#include <asm/numaq.h>
33#include <asm/topology.h> 33#include <asm/topology.h>
34#include <asm/processor.h>
34 35
35#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) 36#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
36 37
@@ -77,3 +78,11 @@ int __init get_memcfg_numaq(void)
77 smp_dump_qct(); 78 smp_dump_qct();
78 return 1; 79 return 1;
79} 80}
81
82static int __init numaq_dsc_disable(void)
83{
84 printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
85 tsc_disable = 1;
86 return 0;
87}
88core_initcall(numaq_dsc_disable);
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index d9492058aaf3..e3f362e8af5b 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -917,6 +917,8 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
917 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) 917 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
918 return -EINVAL; 918 return -EINVAL;
919 919
920 memset(&info, 0, sizeof(info));
921
920 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN; 922 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
921 923
922 info.entry_number = idx; 924 info.entry_number = idx;
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 468500a7e894..9b21a31d4f4e 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -251,7 +251,7 @@ ENTRY(sys_call_table)
251 .long sys_io_submit 251 .long sys_io_submit
252 .long sys_io_cancel 252 .long sys_io_cancel
253 .long sys_fadvise64 /* 250 */ 253 .long sys_fadvise64 /* 250 */
254 .long sys_set_zone_reclaim 254 .long sys_ni_syscall
255 .long sys_exit_group 255 .long sys_exit_group
256 .long sys_lookup_dcookie 256 .long sys_lookup_dcookie
257 .long sys_epoll_create 257 .long sys_epoll_create
diff --git a/arch/i386/mach-visws/reboot.c b/arch/i386/mach-visws/reboot.c
index 9e9296676f93..5d73e042ed0a 100644
--- a/arch/i386/mach-visws/reboot.c
+++ b/arch/i386/mach-visws/reboot.c
@@ -9,12 +9,15 @@
9void (*pm_power_off)(void); 9void (*pm_power_off)(void);
10EXPORT_SYMBOL(pm_power_off); 10EXPORT_SYMBOL(pm_power_off);
11 11
12void machine_restart(char * __unused) 12void machine_shutdown(void)
13{ 13{
14#ifdef CONFIG_SMP 14#ifdef CONFIG_SMP
15 smp_send_stop(); 15 smp_send_stop();
16#endif 16#endif
17}
17 18
19void machine_emergency_restart(void)
20{
18 /* 21 /*
19 * Visual Workstations restart after this 22 * Visual Workstations restart after this
20 * register is poked on the PIIX4 23 * register is poked on the PIIX4
@@ -22,6 +25,12 @@ void machine_restart(char * __unused)
22 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT); 25 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
23} 26}
24 27
28void machine_restart(char * __unused)
29{
30 machine_shutdown();
31 machine_emergency_restart();
32}
33
25void machine_power_off(void) 34void machine_power_off(void)
26{ 35{
27 unsigned short pm_status; 36 unsigned short pm_status;
diff --git a/arch/i386/mach-visws/setup.c b/arch/i386/mach-visws/setup.c
index 9f6d2d9b1be7..26ada6fc0d77 100644
--- a/arch/i386/mach-visws/setup.c
+++ b/arch/i386/mach-visws/setup.c
@@ -14,6 +14,8 @@
14#include "cobalt.h" 14#include "cobalt.h"
15#include "piix4.h" 15#include "piix4.h"
16 16
17int no_broadcast;
18
17char visws_board_type = -1; 19char visws_board_type = -1;
18char visws_board_rev = -1; 20char visws_board_rev = -1;
19 21
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c
index b3eda46e0fe9..c6384061328a 100644
--- a/arch/i386/mach-voyager/voyager_basic.c
+++ b/arch/i386/mach-voyager/voyager_basic.c
@@ -252,6 +252,12 @@ kb_wait(void)
252} 252}
253 253
254void 254void
255machine_shutdown(void)
256{
257 /* Architecture specific shutdown needed before a kexec */
258}
259
260void
255machine_restart(char *cmd) 261machine_restart(char *cmd)
256{ 262{
257 printk("Voyager Warm Restart\n"); 263 printk("Voyager Warm Restart\n");
@@ -279,6 +285,13 @@ machine_restart(char *cmd)
279} 285}
280 286
281void 287void
288machine_emergency_restart(void)
289{
290 /*for now, just hook this to a warm restart */
291 machine_restart(NULL);
292}
293
294void
282mca_nmi_hook(void) 295mca_nmi_hook(void)
283{ 296{
284 __u8 dumpval __attribute__((unused)) = inb(0xf823); 297 __u8 dumpval __attribute__((unused)) = inb(0xf823);
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index b358f0702a44..6711ce3f6916 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -262,6 +262,17 @@ static unsigned long calculate_numa_remap_pages(void)
262 reserve_pages += size; 262 reserve_pages += size;
263 printk("Shrinking node %d from %ld pages to %ld pages\n", 263 printk("Shrinking node %d from %ld pages to %ld pages\n",
264 nid, node_end_pfn[nid], node_end_pfn[nid] - size); 264 nid, node_end_pfn[nid], node_end_pfn[nid] - size);
265
266 if (node_end_pfn[nid] & (PTRS_PER_PTE-1)) {
267 /*
268 * Align node_end_pfn[] and node_remap_start_pfn[] to
269 * pmd boundary. remap_numa_kva will barf otherwise.
270 */
271 printk("Shrinking node %d further by %ld pages for proper alignment\n",
272 nid, node_end_pfn[nid] & (PTRS_PER_PTE-1));
273 size += node_end_pfn[nid] & (PTRS_PER_PTE-1);
274 }
275
265 node_end_pfn[nid] -= size; 276 node_end_pfn[nid] -= size;
266 node_remap_start_pfn[nid] = node_end_pfn[nid]; 277 node_remap_start_pfn[nid] = node_end_pfn[nid];
267 } 278 }
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index 2db65ec45dc3..42913f43feb0 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -30,6 +30,7 @@ static int __init pci_acpi_init(void)
30 acpi_irq_penalty_init(); 30 acpi_irq_penalty_init();
31 pcibios_scanned++; 31 pcibios_scanned++;
32 pcibios_enable_irq = acpi_pci_irq_enable; 32 pcibios_enable_irq = acpi_pci_irq_enable;
33 pcibios_disable_irq = acpi_pci_irq_disable;
33 34
34 if (pci_routeirq) { 35 if (pci_routeirq) {
35 /* 36 /*
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 70bcd53451f6..ade5bc57c34c 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -254,3 +254,9 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
254 254
255 return pcibios_enable_irq(dev); 255 return pcibios_enable_irq(dev);
256} 256}
257
258void pcibios_disable_device (struct pci_dev *dev)
259{
260 if (pcibios_disable_irq)
261 pcibios_disable_irq(dev);
262}
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 766b104ac1a1..86348b68fda1 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -56,6 +56,7 @@ struct irq_router_handler {
56}; 56};
57 57
58int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL; 58int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
59void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL;
59 60
60/* 61/*
61 * Check passed address for the PCI IRQ Routing Table signature 62 * Check passed address for the PCI IRQ Routing Table signature
@@ -550,6 +551,13 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
550static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 551static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
551{ 552{
552 /* FIXME: We should move some of the quirk fixup stuff here */ 553 /* FIXME: We should move some of the quirk fixup stuff here */
554
555 if (router->device == PCI_DEVICE_ID_VIA_82C686 &&
556 device == PCI_DEVICE_ID_VIA_82C586_0) {
557 /* Asus k7m bios wrongly reports 82C686A as 586-compatible */
558 device = PCI_DEVICE_ID_VIA_82C686;
559 }
560
553 switch(device) 561 switch(device)
554 { 562 {
555 case PCI_DEVICE_ID_VIA_82C586_0: 563 case PCI_DEVICE_ID_VIA_82C586_0:
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index a80f0f55ff51..127d53ad16be 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -73,3 +73,4 @@ extern int pcibios_scanned;
73extern spinlock_t pci_config_lock; 73extern spinlock_t pci_config_lock;
74 74
75extern int (*pcibios_enable_irq)(struct pci_dev *dev); 75extern int (*pcibios_enable_irq)(struct pci_dev *dev);
76extern void (*pcibios_disable_irq)(struct pci_dev *dev);
diff --git a/arch/i386/pci/visws.c b/arch/i386/pci/visws.c
index 314c933b6b8e..6c17433fdf7d 100644
--- a/arch/i386/pci/visws.c
+++ b/arch/i386/pci/visws.c
@@ -18,8 +18,10 @@
18extern struct pci_raw_ops pci_direct_conf1; 18extern struct pci_raw_ops pci_direct_conf1;
19 19
20static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } 20static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
21static void pci_visws_disable_irq(struct pci_dev *dev) { }
21 22
22int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq; 23int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq;
24void (*pcibios_disable_irq)(struct pci_dev *dev) = &pci_visws_disable_irq;
23 25
24void __init pcibios_penalize_isa_irq(int irq, int active) {} 26void __init pcibios_penalize_isa_irq(int irq, int active) {}
25 27
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index bb9a506deb78..9be53e1ea404 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1573,9 +1573,9 @@ sys_call_table:
1573 data8 sys_keyctl 1573 data8 sys_keyctl
1574 data8 sys_ioprio_set 1574 data8 sys_ioprio_set
1575 data8 sys_ioprio_get // 1275 1575 data8 sys_ioprio_get // 1275
1576 data8 sys_set_zone_reclaim
1577 data8 sys_ni_syscall
1578 data8 sys_ni_syscall
1579 data8 sys_ni_syscall 1576 data8 sys_ni_syscall
1577 data8 sys_inotify_init
1578 data8 sys_inotify_add_watch
1579 data8 sys_inotify_rm_watch
1580 1580
1581 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1581 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 2776a074c6f1..3288be47bc75 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -362,7 +362,7 @@ unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char
362 if (info->pri_unat_loc) 362 if (info->pri_unat_loc)
363 nat_addr = info->pri_unat_loc; 363 nat_addr = info->pri_unat_loc;
364 else 364 else
365 nat_addr = &info->sw->ar_unat; 365 nat_addr = &info->sw->caller_unat;
366 nat_mask = (1UL << ((long) addr & 0x1f8)/8); 366 nat_mask = (1UL << ((long) addr & 0x1f8)/8);
367 } 367 }
368 } else { 368 } else {
@@ -524,7 +524,7 @@ unw_access_ar (struct unw_frame_info *info, int regnum, unsigned long *val, int
524 case UNW_AR_UNAT: 524 case UNW_AR_UNAT:
525 addr = info->unat_loc; 525 addr = info->unat_loc;
526 if (!addr) 526 if (!addr)
527 addr = &info->sw->ar_unat; 527 addr = &info->sw->caller_unat;
528 break; 528 break;
529 529
530 case UNW_AR_LC: 530 case UNW_AR_LC:
@@ -1775,7 +1775,7 @@ run_script (struct unw_script *script, struct unw_frame_info *state)
1775 1775
1776 case UNW_INSN_SETNAT_MEMSTK: 1776 case UNW_INSN_SETNAT_MEMSTK:
1777 if (!state->pri_unat_loc) 1777 if (!state->pri_unat_loc)
1778 state->pri_unat_loc = &state->sw->ar_unat; 1778 state->pri_unat_loc = &state->sw->caller_unat;
1779 /* register off. is a multiple of 8, so the least 3 bits (type) are 0 */ 1779 /* register off. is a multiple of 8, so the least 3 bits (type) are 0 */
1780 s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK; 1780 s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK;
1781 break; 1781 break;
@@ -2243,11 +2243,11 @@ unw_init (void)
2243 if (8*sizeof(unw_hash_index_t) < UNW_LOG_HASH_SIZE) 2243 if (8*sizeof(unw_hash_index_t) < UNW_LOG_HASH_SIZE)
2244 unw_hash_index_t_is_too_narrow(); 2244 unw_hash_index_t_is_too_narrow();
2245 2245
2246 unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(AR_UNAT); 2246 unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(CALLER_UNAT);
2247 unw.sw_off[unw.preg_index[UNW_REG_BSPSTORE]] = SW(AR_BSPSTORE); 2247 unw.sw_off[unw.preg_index[UNW_REG_BSPSTORE]] = SW(AR_BSPSTORE);
2248 unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_UNAT); 2248 unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_PFS);
2249 unw.sw_off[unw.preg_index[UNW_REG_RP]] = SW(B0); 2249 unw.sw_off[unw.preg_index[UNW_REG_RP]] = SW(B0);
2250 unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(AR_UNAT); 2250 unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(CALLER_UNAT);
2251 unw.sw_off[unw.preg_index[UNW_REG_PR]] = SW(PR); 2251 unw.sw_off[unw.preg_index[UNW_REG_PR]] = SW(PR);
2252 unw.sw_off[unw.preg_index[UNW_REG_LC]] = SW(AR_LC); 2252 unw.sw_off[unw.preg_index[UNW_REG_LC]] = SW(AR_LC);
2253 unw.sw_off[unw.preg_index[UNW_REG_FPSR]] = SW(AR_FPSR); 2253 unw.sw_off[unw.preg_index[UNW_REG_FPSR]] = SW(AR_FPSR);
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug
index 36788c2c310d..31039723804f 100644
--- a/arch/m32r/Kconfig.debug
+++ b/arch/m32r/Kconfig.debug
@@ -5,6 +5,9 @@ source "lib/Kconfig.debug"
5config DEBUG_STACKOVERFLOW 5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows" 6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
8 help
9 This option will cause messages to be printed if free stack space
10 drops below a certain limit.
8 11
9config DEBUG_STACK_USAGE 12config DEBUG_STACK_USAGE
10 bool "Stack utilization instrumentation" 13 bool "Stack utilization instrumentation"
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 3c4707280a52..8a2b77bc5749 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -205,8 +205,7 @@ static long last_rtc_update = 0;
205 * timer_interrupt() needs to keep up the real-time clock, 205 * timer_interrupt() needs to keep up the real-time clock,
206 * as well as call the "do_timer()" routine every clocktick 206 * as well as call the "do_timer()" routine every clocktick
207 */ 207 */
208static inline void 208irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
209do_timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
210{ 209{
211#ifndef CONFIG_SMP 210#ifndef CONFIG_SMP
212 profile_tick(CPU_PROFILING, regs); 211 profile_tick(CPU_PROFILING, regs);
@@ -221,6 +220,7 @@ do_timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
221 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 220 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
222 * called as close as possible to 500 ms before the new second starts. 221 * called as close as possible to 500 ms before the new second starts.
223 */ 222 */
223 write_seqlock(&xtime_lock);
224 if ((time_status & STA_UNSYNC) == 0 224 if ((time_status & STA_UNSYNC) == 0
225 && xtime.tv_sec > last_rtc_update + 660 225 && xtime.tv_sec > last_rtc_update + 660
226 && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2 226 && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2
@@ -231,6 +231,7 @@ do_timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
231 else /* do it again in 60 s */ 231 else /* do it again in 60 s */
232 last_rtc_update = xtime.tv_sec - 600; 232 last_rtc_update = xtime.tv_sec - 600;
233 } 233 }
234 write_sequnlock(&xtime_lock);
234 /* As we return to user mode fire off the other CPU schedulers.. 235 /* As we return to user mode fire off the other CPU schedulers..
235 this is basically because we don't yet share IRQ's around. 236 this is basically because we don't yet share IRQ's around.
236 This message is rigged to be safe on the 386 - basically it's 237 This message is rigged to be safe on the 386 - basically it's
@@ -238,14 +239,8 @@ do_timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
238 239
239#ifdef CONFIG_SMP 240#ifdef CONFIG_SMP
240 smp_local_timer_interrupt(regs); 241 smp_local_timer_interrupt(regs);
242 smp_send_timer();
241#endif 243#endif
242}
243
244irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
245{
246 write_seqlock(&xtime_lock);
247 do_timer_interrupt(irq, NULL, regs);
248 write_sequnlock(&xtime_lock);
249 244
250 return IRQ_HANDLED; 245 return IRQ_HANDLED;
251} 246}
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index ac48b6d2aff6..aec15270d334 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -160,13 +160,13 @@ good_area:
160 printk("handle_mm_fault returns %d\n",fault); 160 printk("handle_mm_fault returns %d\n",fault);
161#endif 161#endif
162 switch (fault) { 162 switch (fault) {
163 case 1: 163 case VM_FAULT_MINOR:
164 current->min_flt++; 164 current->min_flt++;
165 break; 165 break;
166 case 2: 166 case VM_FAULT_MAJOR:
167 current->maj_flt++; 167 current->maj_flt++;
168 break; 168 break;
169 case 0: 169 case VM_FAULT_SIGBUS:
170 goto bus_err; 170 goto bus_err;
171 default: 171 default:
172 goto out_of_memory; 172 goto out_of_memory;
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b578239146b5..898de2df1fc7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1088,41 +1088,6 @@ config ARC32
1088 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32 1088 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1089 default y 1089 default y
1090 1090
1091config FB
1092 bool
1093 depends on MIPS_MAGNUM_4000 || OLIVETTI_M700
1094 default y
1095 ---help---
1096 The frame buffer device provides an abstraction for the graphics
1097 hardware. It represents the frame buffer of some video hardware and
1098 allows application software to access the graphics hardware through
1099 a well-defined interface, so the software doesn't need to know
1100 anything about the low-level (hardware register) stuff.
1101
1102 Frame buffer devices work identically across the different
1103 architectures supported by Linux and make the implementation of
1104 application programs easier and more portable; at this point, an X
1105 server exists which uses the frame buffer device exclusively.
1106 On several non-X86 architectures, the frame buffer device is the
1107 only way to use the graphics hardware.
1108
1109 The device is accessed through special device nodes, usually located
1110 in the /dev directory, i.e. /dev/fb*.
1111
1112 You need an utility program called fbset to make full use of frame
1113 buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
1114 and the Framebuffer-HOWTO at <http://www.tldp.org/docs.html#howto>
1115 for more information.
1116
1117 Say Y here and to the driver for your graphics board below if you
1118 are compiling a kernel for a non-x86 architecture.
1119
1120 If you are compiling for the x86 architecture, you can say Y if you
1121 want to play with it, but it is not essential. Please note that
1122 running graphical applications that directly touch the hardware
1123 (e.g. an accelerated X server) and that are not frame buffer
1124 device-aware may cause unexpected results. If unsure, say N.
1125
1126config HAVE_STD_PC_SERIAL_PORT 1091config HAVE_STD_PC_SERIAL_PORT
1127 bool 1092 bool
1128 1093
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 3f956f809fa4..40244782a8e5 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -178,7 +178,7 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
178 if (!user_mode(regs)) 178 if (!user_mode(regs))
179 return 1; 179 return 1;
180 180
181 if (try_to_freeze(0)) 181 if (try_to_freeze())
182 goto no_signal; 182 goto no_signal;
183 183
184 if (!oldset) 184 if (!oldset)
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 1f3b19124c01..c1a69cf232f9 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -774,7 +774,7 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
774 if (!user_mode(regs)) 774 if (!user_mode(regs))
775 return 1; 775 return 1;
776 776
777 if (try_to_freeze(0)) 777 if (try_to_freeze())
778 goto no_signal; 778 goto no_signal;
779 779
780 if (!oldset) 780 if (!oldset)
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index 92c11e9bbb3f..fa98ef3855bc 100644
--- a/arch/mips/vr41xx/common/Makefile
+++ b/arch/mips/vr41xx/common/Makefile
@@ -2,7 +2,7 @@
2# Makefile for common code of the NEC VR4100 series. 2# Makefile for common code of the NEC VR4100 series.
3# 3#
4 4
5obj-y += bcu.o cmu.o giu.o icu.o init.o int-handler.o pmu.o 5obj-y += bcu.o cmu.o icu.o init.o int-handler.o pmu.o
6obj-$(CONFIG_VRC4173) += vrc4173.o 6obj-$(CONFIG_VRC4173) += vrc4173.o
7 7
8EXTRA_AFLAGS := $(CFLAGS) 8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/vr41xx/common/giu.c b/arch/mips/vr41xx/common/giu.c
deleted file mode 100644
index 9c6b21a79e8f..000000000000
--- a/arch/mips/vr41xx/common/giu.c
+++ /dev/null
@@ -1,455 +0,0 @@
1/*
2 * giu.c, General-purpose I/O Unit Interrupt routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
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 * Changes:
25 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
26 * - New creation, NEC VR4111, VR4121, VR4122 and VR4131 are supported.
27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
29 * - Added support for NEC VR4133.
30 * - Removed board_irq_init.
31 */
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/irq.h>
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/smp.h>
38#include <linux/types.h>
39
40#include <asm/cpu.h>
41#include <asm/io.h>
42#include <asm/vr41xx/vr41xx.h>
43
44#define GIUIOSELL_TYPE1 KSEG1ADDR(0x0b000100)
45#define GIUIOSELL_TYPE2 KSEG1ADDR(0x0f000140)
46
47#define GIUIOSELL 0x00
48#define GIUIOSELH 0x02
49#define GIUINTSTATL 0x08
50#define GIUINTSTATH 0x0a
51#define GIUINTENL 0x0c
52#define GIUINTENH 0x0e
53#define GIUINTTYPL 0x10
54#define GIUINTTYPH 0x12
55#define GIUINTALSELL 0x14
56#define GIUINTALSELH 0x16
57#define GIUINTHTSELL 0x18
58#define GIUINTHTSELH 0x1a
59#define GIUFEDGEINHL 0x20
60#define GIUFEDGEINHH 0x22
61#define GIUREDGEINHL 0x24
62#define GIUREDGEINHH 0x26
63
64static uint32_t giu_base;
65
66static struct irqaction giu_cascade = {
67 .handler = no_action,
68 .mask = CPU_MASK_NONE,
69 .name = "cascade",
70};
71
72#define read_giuint(offset) readw(giu_base + (offset))
73#define write_giuint(val, offset) writew((val), giu_base + (offset))
74
75#define GIUINT_HIGH_OFFSET 16
76
77static inline uint16_t set_giuint(uint8_t offset, uint16_t set)
78{
79 uint16_t res;
80
81 res = read_giuint(offset);
82 res |= set;
83 write_giuint(res, offset);
84
85 return res;
86}
87
88static inline uint16_t clear_giuint(uint8_t offset, uint16_t clear)
89{
90 uint16_t res;
91
92 res = read_giuint(offset);
93 res &= ~clear;
94 write_giuint(res, offset);
95
96 return res;
97}
98
99static unsigned int startup_giuint_low_irq(unsigned int irq)
100{
101 unsigned int pin;
102
103 pin = GIU_IRQ_TO_PIN(irq);
104 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
105 set_giuint(GIUINTENL, (uint16_t)1 << pin);
106
107 return 0;
108}
109
110static void shutdown_giuint_low_irq(unsigned int irq)
111{
112 clear_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
113}
114
115static void enable_giuint_low_irq(unsigned int irq)
116{
117 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
118}
119
120#define disable_giuint_low_irq shutdown_giuint_low_irq
121
122static void ack_giuint_low_irq(unsigned int irq)
123{
124 unsigned int pin;
125
126 pin = GIU_IRQ_TO_PIN(irq);
127 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
128 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
129}
130
131static void end_giuint_low_irq(unsigned int irq)
132{
133 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
134 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
135}
136
137static struct hw_interrupt_type giuint_low_irq_type = {
138 .typename = "GIUINTL",
139 .startup = startup_giuint_low_irq,
140 .shutdown = shutdown_giuint_low_irq,
141 .enable = enable_giuint_low_irq,
142 .disable = disable_giuint_low_irq,
143 .ack = ack_giuint_low_irq,
144 .end = end_giuint_low_irq,
145};
146
147static unsigned int startup_giuint_high_irq(unsigned int irq)
148{
149 unsigned int pin;
150
151 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
152 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
153 set_giuint(GIUINTENH, (uint16_t)1 << pin);
154
155 return 0;
156}
157
158static void shutdown_giuint_high_irq(unsigned int irq)
159{
160 clear_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
161}
162
163static void enable_giuint_high_irq(unsigned int irq)
164{
165 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
166}
167
168#define disable_giuint_high_irq shutdown_giuint_high_irq
169
170static void ack_giuint_high_irq(unsigned int irq)
171{
172 unsigned int pin;
173
174 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
175 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
176 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
177}
178
179static void end_giuint_high_irq(unsigned int irq)
180{
181 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
182 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
183}
184
185static struct hw_interrupt_type giuint_high_irq_type = {
186 .typename = "GIUINTH",
187 .startup = startup_giuint_high_irq,
188 .shutdown = shutdown_giuint_high_irq,
189 .enable = enable_giuint_high_irq,
190 .disable = disable_giuint_high_irq,
191 .ack = ack_giuint_high_irq,
192 .end = end_giuint_high_irq,
193};
194
195void __init init_vr41xx_giuint_irq(void)
196{
197 int i;
198
199 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) {
200 if (i < (GIU_IRQ_BASE + GIUINT_HIGH_OFFSET))
201 irq_desc[i].handler = &giuint_low_irq_type;
202 else
203 irq_desc[i].handler = &giuint_high_irq_type;
204 }
205
206 setup_irq(GIUINT_CASCADE_IRQ, &giu_cascade);
207}
208
209void vr41xx_set_irq_trigger(int pin, int trigger, int hold)
210{
211 uint16_t mask;
212
213 if (pin < GIUINT_HIGH_OFFSET) {
214 mask = (uint16_t)1 << pin;
215 if (trigger != TRIGGER_LEVEL) {
216 set_giuint(GIUINTTYPL, mask);
217 if (hold == SIGNAL_HOLD)
218 set_giuint(GIUINTHTSELL, mask);
219 else
220 clear_giuint(GIUINTHTSELL, mask);
221 if (current_cpu_data.cputype == CPU_VR4133) {
222 switch (trigger) {
223 case TRIGGER_EDGE_FALLING:
224 set_giuint(GIUFEDGEINHL, mask);
225 clear_giuint(GIUREDGEINHL, mask);
226 break;
227 case TRIGGER_EDGE_RISING:
228 clear_giuint(GIUFEDGEINHL, mask);
229 set_giuint(GIUREDGEINHL, mask);
230 break;
231 default:
232 set_giuint(GIUFEDGEINHL, mask);
233 set_giuint(GIUREDGEINHL, mask);
234 break;
235 }
236 }
237 } else {
238 clear_giuint(GIUINTTYPL, mask);
239 clear_giuint(GIUINTHTSELL, mask);
240 }
241 write_giuint(mask, GIUINTSTATL);
242 } else {
243 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
244 if (trigger != TRIGGER_LEVEL) {
245 set_giuint(GIUINTTYPH, mask);
246 if (hold == SIGNAL_HOLD)
247 set_giuint(GIUINTHTSELH, mask);
248 else
249 clear_giuint(GIUINTHTSELH, mask);
250 if (current_cpu_data.cputype == CPU_VR4133) {
251 switch (trigger) {
252 case TRIGGER_EDGE_FALLING:
253 set_giuint(GIUFEDGEINHH, mask);
254 clear_giuint(GIUREDGEINHH, mask);
255 break;
256 case TRIGGER_EDGE_RISING:
257 clear_giuint(GIUFEDGEINHH, mask);
258 set_giuint(GIUREDGEINHH, mask);
259 break;
260 default:
261 set_giuint(GIUFEDGEINHH, mask);
262 set_giuint(GIUREDGEINHH, mask);
263 break;
264 }
265 }
266 } else {
267 clear_giuint(GIUINTTYPH, mask);
268 clear_giuint(GIUINTHTSELH, mask);
269 }
270 write_giuint(mask, GIUINTSTATH);
271 }
272}
273
274EXPORT_SYMBOL(vr41xx_set_irq_trigger);
275
276void vr41xx_set_irq_level(int pin, int level)
277{
278 uint16_t mask;
279
280 if (pin < GIUINT_HIGH_OFFSET) {
281 mask = (uint16_t)1 << pin;
282 if (level == LEVEL_HIGH)
283 set_giuint(GIUINTALSELL, mask);
284 else
285 clear_giuint(GIUINTALSELL, mask);
286 write_giuint(mask, GIUINTSTATL);
287 } else {
288 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
289 if (level == LEVEL_HIGH)
290 set_giuint(GIUINTALSELH, mask);
291 else
292 clear_giuint(GIUINTALSELH, mask);
293 write_giuint(mask, GIUINTSTATH);
294 }
295}
296
297EXPORT_SYMBOL(vr41xx_set_irq_level);
298
299#define GIUINT_NR_IRQS 32
300
301enum {
302 GIUINT_NO_CASCADE,
303 GIUINT_CASCADE
304};
305
306struct vr41xx_giuint_cascade {
307 unsigned int flag;
308 int (*get_irq_number)(int irq);
309};
310
311static struct vr41xx_giuint_cascade giuint_cascade[GIUINT_NR_IRQS];
312
313static int no_irq_number(int irq)
314{
315 return -EINVAL;
316}
317
318int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq))
319{
320 unsigned int pin;
321 int retval;
322
323 if (irq < GIU_IRQ(0) || irq > GIU_IRQ(31))
324 return -EINVAL;
325
326 if(!get_irq_number)
327 return -EINVAL;
328
329 pin = GIU_IRQ_TO_PIN(irq);
330 giuint_cascade[pin].flag = GIUINT_CASCADE;
331 giuint_cascade[pin].get_irq_number = get_irq_number;
332
333 retval = setup_irq(irq, &giu_cascade);
334 if (retval != 0) {
335 giuint_cascade[pin].flag = GIUINT_NO_CASCADE;
336 giuint_cascade[pin].get_irq_number = no_irq_number;
337 }
338
339 return retval;
340}
341
342EXPORT_SYMBOL(vr41xx_cascade_irq);
343
344static inline int get_irq_pin_number(void)
345{
346 uint16_t pendl, pendh, maskl, maskh;
347 int i;
348
349 pendl = read_giuint(GIUINTSTATL);
350 pendh = read_giuint(GIUINTSTATH);
351 maskl = read_giuint(GIUINTENL);
352 maskh = read_giuint(GIUINTENH);
353
354 maskl &= pendl;
355 maskh &= pendh;
356
357 if (maskl) {
358 for (i = 0; i < 16; i++) {
359 if (maskl & ((uint16_t)1 << i))
360 return i;
361 }
362 } else if (maskh) {
363 for (i = 0; i < 16; i++) {
364 if (maskh & ((uint16_t)1 << i))
365 return i + GIUINT_HIGH_OFFSET;
366 }
367 }
368
369 printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
370 maskl, pendl, maskh, pendh);
371
372 atomic_inc(&irq_err_count);
373
374 return -1;
375}
376
377static inline void ack_giuint_irq(int pin)
378{
379 if (pin < GIUINT_HIGH_OFFSET) {
380 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
381 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
382 } else {
383 pin -= GIUINT_HIGH_OFFSET;
384 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
385 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
386 }
387}
388
389static inline void end_giuint_irq(int pin)
390{
391 if (pin < GIUINT_HIGH_OFFSET)
392 set_giuint(GIUINTENL, (uint16_t)1 << pin);
393 else
394 set_giuint(GIUINTENH, (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET));
395}
396
397void giuint_irq_dispatch(struct pt_regs *regs)
398{
399 struct vr41xx_giuint_cascade *cascade;
400 unsigned int giuint_irq;
401 int pin;
402
403 pin = get_irq_pin_number();
404 if (pin < 0)
405 return;
406
407 disable_irq(GIUINT_CASCADE_IRQ);
408
409 cascade = &giuint_cascade[pin];
410 giuint_irq = GIU_IRQ(pin);
411 if (cascade->flag == GIUINT_CASCADE) {
412 int irq = cascade->get_irq_number(giuint_irq);
413 ack_giuint_irq(pin);
414 if (irq >= 0)
415 do_IRQ(irq, regs);
416 end_giuint_irq(pin);
417 } else {
418 do_IRQ(giuint_irq, regs);
419 }
420
421 enable_irq(GIUINT_CASCADE_IRQ);
422}
423
424static int __init vr41xx_giu_init(void)
425{
426 int i;
427
428 switch (current_cpu_data.cputype) {
429 case CPU_VR4111:
430 case CPU_VR4121:
431 giu_base = GIUIOSELL_TYPE1;
432 break;
433 case CPU_VR4122:
434 case CPU_VR4131:
435 case CPU_VR4133:
436 giu_base = GIUIOSELL_TYPE2;
437 break;
438 default:
439 printk(KERN_ERR "GIU: Unexpected CPU of NEC VR4100 series\n");
440 return -EINVAL;
441 }
442
443 for (i = 0; i < GIUINT_NR_IRQS; i++) {
444 if (i < GIUINT_HIGH_OFFSET)
445 clear_giuint(GIUINTENL, (uint16_t)1 << i);
446 else
447 clear_giuint(GIUINTENH, (uint16_t)1 << (i - GIUINT_HIGH_OFFSET));
448 giuint_cascade[i].flag = GIUINT_NO_CASCADE;
449 giuint_cascade[i].get_irq_number = no_irq_number;
450 }
451
452 return 0;
453}
454
455early_initcall(vr41xx_giu_init);
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 3cb08a4a513a..e6a891a0cad0 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -255,8 +255,26 @@ void __devinit pcibios_resource_to_bus(struct pci_dev *dev,
255 pcibios_link_hba_resources(&hba->lmmio_space, bus->resource[1]); 255 pcibios_link_hba_resources(&hba->lmmio_space, bus->resource[1]);
256} 256}
257 257
258void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
259 struct pci_bus_region *region)
260{
261 struct pci_bus *bus = dev->bus;
262 struct pci_hba_data *hba = HBA_DATA(bus->bridge->platform_data);
263
264 if (res->flags & IORESOURCE_MEM) {
265 res->start = PCI_HOST_ADDR(hba, region->start);
266 res->end = PCI_HOST_ADDR(hba, region->end);
267 }
268
269 if (res->flags & IORESOURCE_IO) {
270 res->start = region->start;
271 res->end = region->end;
272 }
273}
274
258#ifdef CONFIG_HOTPLUG 275#ifdef CONFIG_HOTPLUG
259EXPORT_SYMBOL(pcibios_resource_to_bus); 276EXPORT_SYMBOL(pcibios_resource_to_bus);
277EXPORT_SYMBOL(pcibios_bus_to_resource);
260#endif 278#endif
261 279
262/* 280/*
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index eaa701479f5f..0ad945d4c0a4 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -178,17 +178,17 @@ good_area:
178 */ 178 */
179 179
180 switch (handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0)) { 180 switch (handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0)) {
181 case 1: 181 case VM_FAULT_MINOR:
182 ++current->min_flt; 182 ++current->min_flt;
183 break; 183 break;
184 case 2: 184 case VM_FAULT_MAJOR:
185 ++current->maj_flt; 185 ++current->maj_flt;
186 break; 186 break;
187 case 0: 187 case VM_FAULT_SIGBUS:
188 /* 188 /*
189 * We ran out of memory, or some other thing happened 189 * We hit a hared mapping outside of the file, or some
190 * to us that made us unable to handle the page fault 190 * other thing happened to us that made us unable to
191 * gracefully. 191 * handle the page fault gracefully.
192 */ 192 */
193 goto bad_area; 193 goto bad_area;
194 default: 194 default:
diff --git a/arch/ppc/8xx_io/Kconfig b/arch/ppc/8xx_io/Kconfig
index 9e2227ec3b34..57dacf978532 100644
--- a/arch/ppc/8xx_io/Kconfig
+++ b/arch/ppc/8xx_io/Kconfig
@@ -69,9 +69,9 @@ config FEC_QS6612
69 69
70config ENET_BIG_BUFFERS 70config ENET_BIG_BUFFERS
71 bool "Use Big CPM Ethernet Buffers" 71 bool "Use Big CPM Ethernet Buffers"
72 depends on NET_ETHERNET 72 depends on SCC_ENET || FEC_ENET
73 help 73 help
74 Allocate large buffers for MPC8xx Etherenet. Increases throughput 74 Allocate large buffers for MPC8xx Ethernet. Increases throughput
75 and decreases the likelihood of dropped packets, but costs memory. 75 and decreases the likelihood of dropped packets, but costs memory.
76 76
77config HTDMSOUND 77config HTDMSOUND
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 0cc2e7a9cb11..11726e2a4ec8 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -39,8 +39,6 @@
39#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
40#include <asm/rheap.h> 40#include <asm/rheap.h>
41 41
42extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
43
44static void m8xx_cpm_dpinit(void); 42static void m8xx_cpm_dpinit(void);
45static uint host_buffer; /* One page of host buffer */ 43static uint host_buffer; /* One page of host buffer */
46static uint host_end; /* end + 1 */ 44static uint host_end; /* end + 1 */
@@ -108,14 +106,11 @@ struct hw_interrupt_type cpm_pic = {
108 .end = cpm_eoi, 106 .end = cpm_eoi,
109}; 107};
110 108
111extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
112
113void 109void
114m8xx_cpm_reset(uint bootpage) 110m8xx_cpm_reset(void)
115{ 111{
116 volatile immap_t *imp; 112 volatile immap_t *imp;
117 volatile cpm8xx_t *commproc; 113 volatile cpm8xx_t *commproc;
118 pte_t *pte;
119 114
120 imp = (immap_t *)IMAP_ADDR; 115 imp = (immap_t *)IMAP_ADDR;
121 commproc = (cpm8xx_t *)&imp->im_cpm; 116 commproc = (cpm8xx_t *)&imp->im_cpm;
@@ -143,17 +138,6 @@ m8xx_cpm_reset(uint bootpage)
143 /* Reclaim the DP memory for our use. */ 138 /* Reclaim the DP memory for our use. */
144 m8xx_cpm_dpinit(); 139 m8xx_cpm_dpinit();
145 140
146 /* get the PTE for the bootpage */
147 if (!get_pteptr(&init_mm, bootpage, &pte))
148 panic("get_pteptr failed\n");
149
150 /* and make it uncachable */
151 pte_val(*pte) |= _PAGE_NO_CACHE;
152 _tlbie(bootpage);
153
154 host_buffer = bootpage;
155 host_end = host_buffer + PAGE_SIZE;
156
157 /* Tell everyone where the comm processor resides. 141 /* Tell everyone where the comm processor resides.
158 */ 142 */
159 cpmp = (cpm8xx_t *)commproc; 143 cpmp = (cpm8xx_t *)commproc;
@@ -384,8 +368,6 @@ static rh_info_t cpm_dpmem_info;
384 368
385void m8xx_cpm_dpinit(void) 369void m8xx_cpm_dpinit(void)
386{ 370{
387 cpm8xx_t *cp = &((immap_t *)IMAP_ADDR)->im_cpm;
388
389 spin_lock_init(&cpm_dpmem_lock); 371 spin_lock_init(&cpm_dpmem_lock);
390 372
391 /* Initialize the info header */ 373 /* Initialize the info header */
diff --git a/arch/ppc/8xx_io/fec.c b/arch/ppc/8xx_io/fec.c
index 0730392dcc20..62f68d6181c6 100644
--- a/arch/ppc/8xx_io/fec.c
+++ b/arch/ppc/8xx_io/fec.c
@@ -173,7 +173,7 @@ struct fec_enet_private {
173 uint phy_status; 173 uint phy_status;
174 uint phy_speed; 174 uint phy_speed;
175 phy_info_t *phy; 175 phy_info_t *phy;
176 struct tq_struct phy_task; 176 struct work_struct phy_task;
177 177
178 uint sequence_done; 178 uint sequence_done;
179 179
@@ -199,7 +199,8 @@ static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
199#ifdef CONFIG_USE_MDIO 199#ifdef CONFIG_USE_MDIO
200static void fec_enet_mii(struct net_device *dev); 200static void fec_enet_mii(struct net_device *dev);
201#endif /* CONFIG_USE_MDIO */ 201#endif /* CONFIG_USE_MDIO */
202static void fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs); 202static irqreturn_t fec_enet_interrupt(int irq, void * dev_id,
203 struct pt_regs * regs);
203#ifdef CONFIG_FEC_PACKETHOOK 204#ifdef CONFIG_FEC_PACKETHOOK
204static void fec_enet_tx(struct net_device *dev, __u32 regval); 205static void fec_enet_tx(struct net_device *dev, __u32 regval);
205static void fec_enet_rx(struct net_device *dev, __u32 regval); 206static void fec_enet_rx(struct net_device *dev, __u32 regval);
@@ -471,7 +472,7 @@ fec_timeout(struct net_device *dev)
471/* The interrupt handler. 472/* The interrupt handler.
472 * This is called from the MPC core interrupt. 473 * This is called from the MPC core interrupt.
473 */ 474 */
474static void 475static irqreturn_t
475fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs) 476fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs)
476{ 477{
477 struct net_device *dev = dev_id; 478 struct net_device *dev = dev_id;
@@ -525,6 +526,7 @@ printk("%s[%d] %s: unexpected FEC_ENET_MII event\n", __FILE__,__LINE__,__FUNCTIO
525 } 526 }
526 527
527 } 528 }
529 return IRQ_RETVAL(IRQ_HANDLED);
528} 530}
529 531
530 532
@@ -1263,8 +1265,9 @@ static void mii_display_status(struct net_device *dev)
1263 printk(".\n"); 1265 printk(".\n");
1264} 1266}
1265 1267
1266static void mii_display_config(struct net_device *dev) 1268static void mii_display_config(void *priv)
1267{ 1269{
1270 struct net_device *dev = (struct net_device *)priv;
1268 struct fec_enet_private *fep = dev->priv; 1271 struct fec_enet_private *fep = dev->priv;
1269 volatile uint *s = &(fep->phy_status); 1272 volatile uint *s = &(fep->phy_status);
1270 1273
@@ -1294,8 +1297,9 @@ static void mii_display_config(struct net_device *dev)
1294 fep->sequence_done = 1; 1297 fep->sequence_done = 1;
1295} 1298}
1296 1299
1297static void mii_relink(struct net_device *dev) 1300static void mii_relink(void *priv)
1298{ 1301{
1302 struct net_device *dev = (struct net_device *)priv;
1299 struct fec_enet_private *fep = dev->priv; 1303 struct fec_enet_private *fep = dev->priv;
1300 int duplex; 1304 int duplex;
1301 1305
@@ -1323,18 +1327,16 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev)
1323{ 1327{
1324 struct fec_enet_private *fep = dev->priv; 1328 struct fec_enet_private *fep = dev->priv;
1325 1329
1326 fep->phy_task.routine = (void *)mii_relink; 1330 INIT_WORK(&fep->phy_task, mii_relink, (void *)dev);
1327 fep->phy_task.data = dev; 1331 schedule_work(&fep->phy_task);
1328 schedule_task(&fep->phy_task);
1329} 1332}
1330 1333
1331static void mii_queue_config(uint mii_reg, struct net_device *dev) 1334static void mii_queue_config(uint mii_reg, struct net_device *dev)
1332{ 1335{
1333 struct fec_enet_private *fep = dev->priv; 1336 struct fec_enet_private *fep = dev->priv;
1334 1337
1335 fep->phy_task.routine = (void *)mii_display_config; 1338 INIT_WORK(&fep->phy_task, mii_display_config, (void *)dev);
1336 fep->phy_task.data = dev; 1339 schedule_work(&fep->phy_task);
1337 schedule_task(&fep->phy_task);
1338} 1340}
1339 1341
1340 1342
@@ -1403,11 +1405,11 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
1403 1405
1404/* This interrupt occurs when the PHY detects a link change. 1406/* This interrupt occurs when the PHY detects a link change.
1405*/ 1407*/
1406static void 1408static
1407#ifdef CONFIG_RPXCLASSIC 1409#ifdef CONFIG_RPXCLASSIC
1408mii_link_interrupt(void *dev_id) 1410void mii_link_interrupt(void *dev_id)
1409#else 1411#else
1410mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs) 1412irqreturn_t mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1411#endif 1413#endif
1412{ 1414{
1413#ifdef CONFIG_USE_MDIO 1415#ifdef CONFIG_USE_MDIO
@@ -1440,6 +1442,9 @@ mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1440printk("%s[%d] %s: unexpected Link interrupt\n", __FILE__,__LINE__,__FUNCTION__); 1442printk("%s[%d] %s: unexpected Link interrupt\n", __FILE__,__LINE__,__FUNCTION__);
1441#endif /* CONFIG_USE_MDIO */ 1443#endif /* CONFIG_USE_MDIO */
1442 1444
1445#ifndef CONFIG_RPXCLASSIC
1446 return IRQ_RETVAL(IRQ_HANDLED);
1447#endif /* CONFIG_RPXCLASSIC */
1443} 1448}
1444 1449
1445static int 1450static int
@@ -1575,7 +1580,7 @@ static int __init fec_enet_init(void)
1575 struct fec_enet_private *fep; 1580 struct fec_enet_private *fep;
1576 int i, j, k, err; 1581 int i, j, k, err;
1577 unsigned char *eap, *iap, *ba; 1582 unsigned char *eap, *iap, *ba;
1578 unsigned long mem_addr; 1583 dma_addr_t mem_addr;
1579 volatile cbd_t *bdp; 1584 volatile cbd_t *bdp;
1580 cbd_t *cbd_base; 1585 cbd_t *cbd_base;
1581 volatile immap_t *immap; 1586 volatile immap_t *immap;
@@ -1640,7 +1645,8 @@ static int __init fec_enet_init(void)
1640 printk("FEC initialization failed.\n"); 1645 printk("FEC initialization failed.\n");
1641 return 1; 1646 return 1;
1642 } 1647 }
1643 cbd_base = (cbd_t *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); 1648 cbd_base = (cbd_t *)dma_alloc_coherent(dev->class_dev.dev, PAGE_SIZE,
1649 &mem_addr, GFP_KERNEL);
1644 1650
1645 /* Set receive and transmit descriptor base. 1651 /* Set receive and transmit descriptor base.
1646 */ 1652 */
@@ -1657,7 +1663,10 @@ static int __init fec_enet_init(void)
1657 1663
1658 /* Allocate a page. 1664 /* Allocate a page.
1659 */ 1665 */
1660 ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); 1666 ba = (unsigned char *)dma_alloc_coherent(dev->class_dev.dev,
1667 PAGE_SIZE,
1668 &mem_addr,
1669 GFP_KERNEL);
1661 /* BUG: no check for failure */ 1670 /* BUG: no check for failure */
1662 1671
1663 /* Initialize the BD for every fragment in the page. 1672 /* Initialize the BD for every fragment in the page.
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index b833cbcd77f0..f6db3b385fea 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -85,7 +85,6 @@ config POWER4
85 bool "POWER4 and 970 (G5)" 85 bool "POWER4 and 970 (G5)"
86 86
87config 8xx 87config 8xx
88 depends on BROKEN
89 bool "8xx" 88 bool "8xx"
90 89
91config E200 90config E200
@@ -559,6 +558,7 @@ config PPC_MULTIPLATFORM
559 558
560config APUS 559config APUS
561 bool "Amiga-APUS" 560 bool "Amiga-APUS"
561 depends on BROKEN
562 help 562 help
563 Select APUS if configuring for a PowerUP Amiga. 563 Select APUS if configuring for a PowerUP Amiga.
564 More information is available at: 564 More information is available at:
@@ -648,6 +648,7 @@ config PAL4
648 648
649config GEMINI 649config GEMINI
650 bool "Synergy-Gemini" 650 bool "Synergy-Gemini"
651 depends on BROKEN
651 help 652 help
652 Select Gemini if configuring for a Synergy Microsystems' Gemini 653 Select Gemini if configuring for a Synergy Microsystems' Gemini
653 series Single Board Computer. More information is available at: 654 series Single Board Computer. More information is available at:
@@ -878,6 +879,13 @@ config MPC10X_STORE_GATHERING
878 bool "Enable MPC10x store gathering" 879 bool "Enable MPC10x store gathering"
879 depends on MPC10X_BRIDGE 880 depends on MPC10X_BRIDGE
880 881
882config SANDPOINT_ENABLE_UART1
883 bool "Enable DUART mode on Sandpoint"
884 depends on SANDPOINT
885 help
886 If this option is enabled then the MPC824x processor will run
887 in DUART mode instead of UART mode.
888
881config CPC710_DATA_GATHERING 889config CPC710_DATA_GATHERING
882 bool "Enable CPC710 data gathering" 890 bool "Enable CPC710 data gathering"
883 depends on K2 891 depends on K2
@@ -935,19 +943,11 @@ config NR_CPUS
935 depends on SMP 943 depends on SMP
936 default "4" 944 default "4"
937 945
938config PREEMPT
939 bool "Preemptible Kernel"
940 help
941 This option reduces the latency of the kernel when reacting to
942 real-time or interactive events by allowing a low priority process to
943 be preempted even if it is in kernel mode executing a system call.
944
945 Say Y here if you are building a kernel for a desktop, embedded
946 or real-time system. Say N if you are unsure.
947
948config HIGHMEM 946config HIGHMEM
949 bool "High memory support" 947 bool "High memory support"
950 948
949source kernel/Kconfig.hz
950source kernel/Kconfig.preempt
951source "mm/Kconfig" 951source "mm/Kconfig"
952 952
953source "fs/Kconfig.binfmt" 953source "fs/Kconfig.binfmt"
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index 991b4cbb83c8..d4dc4fa79647 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -61,6 +61,12 @@ zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE
61 end-$(CONFIG_EMBEDDEDBOOT) := embedded 61 end-$(CONFIG_EMBEDDEDBOOT) := embedded
62 misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o 62 misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o
63 63
64 zimage-$(CONFIG_BAMBOO) := zImage-TREE
65zimageinitrd-$(CONFIG_BAMBOO) := zImage.initrd-TREE
66 end-$(CONFIG_BAMBOO) := bamboo
67 entrypoint-$(CONFIG_BAMBOO) := 0x01000000
68 extra.o-$(CONFIG_BAMBOO) := pibs.o
69
64 zimage-$(CONFIG_EBONY) := zImage-TREE 70 zimage-$(CONFIG_EBONY) := zImage-TREE
65zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE 71zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE
66 end-$(CONFIG_EBONY) := ebony 72 end-$(CONFIG_EBONY) := ebony
diff --git a/arch/ppc/boot/simple/pibs.c b/arch/ppc/boot/simple/pibs.c
index 1348740e503f..67222d57c345 100644
--- a/arch/ppc/boot/simple/pibs.c
+++ b/arch/ppc/boot/simple/pibs.c
@@ -91,9 +91,11 @@ load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
91 91
92 mac64 = simple_strtoull((char *)PIBS_MAC_BASE, 0, 16); 92 mac64 = simple_strtoull((char *)PIBS_MAC_BASE, 0, 16);
93 memcpy(hold_residual->bi_enetaddr, (char *)&mac64+2, 6); 93 memcpy(hold_residual->bi_enetaddr, (char *)&mac64+2, 6);
94#ifdef CONFIG_440GX 94#if defined(CONFIG_440GX) || defined(CONFIG_440EP)
95 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET), 0, 16); 95 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET), 0, 16);
96 memcpy(hold_residual->bi_enet1addr, (char *)&mac64+2, 6); 96 memcpy(hold_residual->bi_enet1addr, (char *)&mac64+2, 6);
97#endif
98#ifdef CONFIG_440GX
97 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*2), 0, 16); 99 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*2), 0, 16);
98 memcpy(hold_residual->bi_enet2addr, (char *)&mac64+2, 6); 100 memcpy(hold_residual->bi_enet2addr, (char *)&mac64+2, 6);
99 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*3), 0, 16); 101 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*3), 0, 16);
diff --git a/arch/ppc/configs/bamboo_defconfig b/arch/ppc/configs/bamboo_defconfig
new file mode 100644
index 000000000000..0ba4e70d50b6
--- /dev/null
+++ b/arch/ppc/configs/bamboo_defconfig
@@ -0,0 +1,943 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12
4# Tue Jun 28 15:24:25 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_SWAP=y
29CONFIG_SYSVIPC=y
30# CONFIG_POSIX_MQUEUE is not set
31# CONFIG_BSD_PROCESS_ACCT is not set
32CONFIG_SYSCTL=y
33# CONFIG_AUDIT is not set
34# CONFIG_HOTPLUG is not set
35CONFIG_KOBJECT_UEVENT=y
36# CONFIG_IKCONFIG is not set
37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45CONFIG_EPOLL=y
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60# CONFIG_MODULE_FORCE_UNLOAD is not set
61CONFIG_OBSOLETE_MODPARM=y
62# CONFIG_MODVERSIONS is not set
63# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y
65
66#
67# Processor
68#
69# CONFIG_6xx is not set
70# CONFIG_40x is not set
71CONFIG_44x=y
72# CONFIG_POWER3 is not set
73# CONFIG_POWER4 is not set
74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
78CONFIG_BOOKE=y
79CONFIG_PTE_64BIT=y
80CONFIG_PHYS_64BIT=y
81# CONFIG_MATH_EMULATION is not set
82# CONFIG_KEXEC is not set
83# CONFIG_CPU_FREQ is not set
84CONFIG_4xx=y
85
86#
87# IBM 4xx options
88#
89CONFIG_BAMBOO=y
90# CONFIG_EBONY is not set
91# CONFIG_LUAN is not set
92# CONFIG_OCOTEA is not set
93CONFIG_440EP=y
94CONFIG_440=y
95CONFIG_IBM440EP_ERR42=y
96CONFIG_IBM_OCP=y
97# CONFIG_PPC4xx_DMA is not set
98CONFIG_PPC_GEN550=y
99# CONFIG_PM is not set
100CONFIG_NOT_COHERENT_CACHE=y
101
102#
103# Platform options
104#
105# CONFIG_PC_KEYBOARD is not set
106# CONFIG_SMP is not set
107# CONFIG_PREEMPT is not set
108# CONFIG_HIGHMEM is not set
109CONFIG_SELECT_MEMORY_MODEL=y
110CONFIG_FLATMEM_MANUAL=y
111# CONFIG_DISCONTIGMEM_MANUAL is not set
112# CONFIG_SPARSEMEM_MANUAL is not set
113CONFIG_FLATMEM=y
114CONFIG_FLAT_NODE_MEM_MAP=y
115CONFIG_BINFMT_ELF=y
116# CONFIG_BINFMT_MISC is not set
117CONFIG_CMDLINE_BOOL=y
118CONFIG_CMDLINE="ip=on"
119CONFIG_SECCOMP=y
120CONFIG_ISA_DMA_API=y
121
122#
123# Bus options
124#
125CONFIG_PCI=y
126CONFIG_PCI_DOMAINS=y
127# CONFIG_PCI_LEGACY_PROC is not set
128# CONFIG_PCI_NAMES is not set
129# CONFIG_PCI_DEBUG is not set
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134# CONFIG_PCCARD is not set
135
136#
137# Advanced setup
138#
139# CONFIG_ADVANCED_OPTIONS is not set
140
141#
142# Default settings for advanced configuration options are used
143#
144CONFIG_HIGHMEM_START=0xfe000000
145CONFIG_LOWMEM_SIZE=0x30000000
146CONFIG_KERNEL_START=0xc0000000
147CONFIG_TASK_SIZE=0x80000000
148CONFIG_CONSISTENT_START=0xff100000
149CONFIG_CONSISTENT_SIZE=0x00200000
150CONFIG_BOOT_LOAD=0x01000000
151
152#
153# Device Drivers
154#
155
156#
157# Generic Driver Options
158#
159# CONFIG_STANDALONE is not set
160CONFIG_PREVENT_FIRMWARE_BUILD=y
161# CONFIG_FW_LOADER is not set
162# CONFIG_DEBUG_DRIVER is not set
163
164#
165# Memory Technology Devices (MTD)
166#
167# CONFIG_MTD is not set
168
169#
170# Parallel port support
171#
172# CONFIG_PARPORT is not set
173
174#
175# Plug and Play support
176#
177
178#
179# Block devices
180#
181# CONFIG_BLK_DEV_FD is not set
182# CONFIG_BLK_CPQ_DA is not set
183# CONFIG_BLK_CPQ_CISS_DA is not set
184# CONFIG_BLK_DEV_DAC960 is not set
185# CONFIG_BLK_DEV_UMEM is not set
186# CONFIG_BLK_DEV_COW_COMMON is not set
187# CONFIG_BLK_DEV_LOOP is not set
188# CONFIG_BLK_DEV_NBD is not set
189# CONFIG_BLK_DEV_SX8 is not set
190# CONFIG_BLK_DEV_UB is not set
191# CONFIG_BLK_DEV_RAM is not set
192CONFIG_BLK_DEV_RAM_COUNT=16
193CONFIG_INITRAMFS_SOURCE=""
194# CONFIG_LBD is not set
195# CONFIG_CDROM_PKTCDVD is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204# CONFIG_ATA_OVER_ETH is not set
205
206#
207# ATA/ATAPI/MFM/RLL support
208#
209CONFIG_IDE=y
210CONFIG_BLK_DEV_IDE=y
211
212#
213# Please see Documentation/ide.txt for help/info on IDE drives
214#
215# CONFIG_BLK_DEV_IDE_SATA is not set
216CONFIG_BLK_DEV_IDEDISK=y
217# CONFIG_IDEDISK_MULTI_MODE is not set
218# CONFIG_BLK_DEV_IDECD is not set
219# CONFIG_BLK_DEV_IDETAPE is not set
220# CONFIG_BLK_DEV_IDEFLOPPY is not set
221# CONFIG_BLK_DEV_IDESCSI is not set
222# CONFIG_IDE_TASK_IOCTL is not set
223
224#
225# IDE chipset support/bugfixes
226#
227CONFIG_IDE_GENERIC=y
228CONFIG_BLK_DEV_IDEPCI=y
229# CONFIG_IDEPCI_SHARE_IRQ is not set
230# CONFIG_BLK_DEV_OFFBOARD is not set
231# CONFIG_BLK_DEV_GENERIC is not set
232# CONFIG_BLK_DEV_OPTI621 is not set
233# CONFIG_BLK_DEV_SL82C105 is not set
234CONFIG_BLK_DEV_IDEDMA_PCI=y
235# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
236# CONFIG_IDEDMA_PCI_AUTO is not set
237# CONFIG_BLK_DEV_AEC62XX is not set
238# CONFIG_BLK_DEV_ALI15X3 is not set
239# CONFIG_BLK_DEV_AMD74XX is not set
240CONFIG_BLK_DEV_CMD64X=y
241# CONFIG_BLK_DEV_TRIFLEX is not set
242# CONFIG_BLK_DEV_CY82C693 is not set
243# CONFIG_BLK_DEV_CS5520 is not set
244# CONFIG_BLK_DEV_CS5530 is not set
245# CONFIG_BLK_DEV_HPT34X is not set
246# CONFIG_BLK_DEV_HPT366 is not set
247# CONFIG_BLK_DEV_SC1200 is not set
248# CONFIG_BLK_DEV_PIIX is not set
249# CONFIG_BLK_DEV_IT821X is not set
250# CONFIG_BLK_DEV_NS87415 is not set
251# CONFIG_BLK_DEV_PDC202XX_OLD is not set
252# CONFIG_BLK_DEV_PDC202XX_NEW is not set
253# CONFIG_BLK_DEV_SVWKS is not set
254# CONFIG_BLK_DEV_SIIMAGE is not set
255# CONFIG_BLK_DEV_SLC90E66 is not set
256# CONFIG_BLK_DEV_TRM290 is not set
257# CONFIG_BLK_DEV_VIA82CXXX is not set
258# CONFIG_IDE_ARM is not set
259CONFIG_BLK_DEV_IDEDMA=y
260# CONFIG_IDEDMA_IVB is not set
261# CONFIG_IDEDMA_AUTO is not set
262# CONFIG_BLK_DEV_HD is not set
263
264#
265# SCSI device support
266#
267CONFIG_SCSI=y
268CONFIG_SCSI_PROC_FS=y
269
270#
271# SCSI support type (disk, tape, CD-ROM)
272#
273# CONFIG_BLK_DEV_SD is not set
274CONFIG_CHR_DEV_ST=y
275# CONFIG_CHR_DEV_OSST is not set
276# CONFIG_BLK_DEV_SR is not set
277# CONFIG_CHR_DEV_SG is not set
278# CONFIG_CHR_DEV_SCH is not set
279
280#
281# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
282#
283# CONFIG_SCSI_MULTI_LUN is not set
284# CONFIG_SCSI_CONSTANTS is not set
285# CONFIG_SCSI_LOGGING is not set
286
287#
288# SCSI Transport Attributes
289#
290CONFIG_SCSI_SPI_ATTRS=y
291# CONFIG_SCSI_FC_ATTRS is not set
292# CONFIG_SCSI_ISCSI_ATTRS is not set
293
294#
295# SCSI low-level drivers
296#
297# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
298# CONFIG_SCSI_3W_9XXX is not set
299# CONFIG_SCSI_ACARD is not set
300# CONFIG_SCSI_AACRAID is not set
301# CONFIG_SCSI_AIC7XXX is not set
302# CONFIG_SCSI_AIC7XXX_OLD is not set
303# CONFIG_SCSI_AIC79XX is not set
304# CONFIG_SCSI_DPT_I2O is not set
305# CONFIG_MEGARAID_NEWGEN is not set
306# CONFIG_MEGARAID_LEGACY is not set
307# CONFIG_SCSI_SATA is not set
308# CONFIG_SCSI_BUSLOGIC is not set
309# CONFIG_SCSI_DMX3191D is not set
310# CONFIG_SCSI_EATA is not set
311# CONFIG_SCSI_FUTURE_DOMAIN is not set
312# CONFIG_SCSI_GDTH is not set
313# CONFIG_SCSI_IPS is not set
314# CONFIG_SCSI_INITIO is not set
315# CONFIG_SCSI_INIA100 is not set
316CONFIG_SCSI_SYM53C8XX_2=y
317CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
318CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
319CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
320# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
321# CONFIG_SCSI_IPR is not set
322# CONFIG_SCSI_QLOGIC_FC is not set
323# CONFIG_SCSI_QLOGIC_1280 is not set
324CONFIG_SCSI_QLA2XXX=y
325# CONFIG_SCSI_QLA21XX is not set
326# CONFIG_SCSI_QLA22XX is not set
327# CONFIG_SCSI_QLA2300 is not set
328# CONFIG_SCSI_QLA2322 is not set
329# CONFIG_SCSI_QLA6312 is not set
330# CONFIG_SCSI_LPFC is not set
331# CONFIG_SCSI_DC395x is not set
332# CONFIG_SCSI_DC390T is not set
333# CONFIG_SCSI_NSP32 is not set
334# CONFIG_SCSI_DEBUG is not set
335
336#
337# Multi-device support (RAID and LVM)
338#
339# CONFIG_MD is not set
340
341#
342# Fusion MPT device support
343#
344# CONFIG_FUSION is not set
345# CONFIG_FUSION_SPI is not set
346# CONFIG_FUSION_FC is not set
347
348#
349# IEEE 1394 (FireWire) support
350#
351# CONFIG_IEEE1394 is not set
352
353#
354# I2O device support
355#
356# CONFIG_I2O is not set
357
358#
359# Macintosh device drivers
360#
361
362#
363# Networking support
364#
365CONFIG_NET=y
366
367#
368# Networking options
369#
370CONFIG_PACKET=y
371# CONFIG_PACKET_MMAP is not set
372CONFIG_UNIX=y
373# CONFIG_NET_KEY is not set
374CONFIG_INET=y
375# CONFIG_IP_MULTICAST is not set
376# CONFIG_IP_ADVANCED_ROUTER is not set
377CONFIG_IP_FIB_HASH=y
378CONFIG_IP_PNP=y
379# CONFIG_IP_PNP_DHCP is not set
380CONFIG_IP_PNP_BOOTP=y
381# CONFIG_IP_PNP_RARP is not set
382# CONFIG_NET_IPIP is not set
383# CONFIG_NET_IPGRE is not set
384# CONFIG_ARPD is not set
385# CONFIG_SYN_COOKIES is not set
386# CONFIG_INET_AH is not set
387# CONFIG_INET_ESP is not set
388# CONFIG_INET_IPCOMP is not set
389# CONFIG_INET_TUNNEL is not set
390CONFIG_IP_TCPDIAG=y
391# CONFIG_IP_TCPDIAG_IPV6 is not set
392# CONFIG_TCP_CONG_ADVANCED is not set
393CONFIG_TCP_CONG_BIC=y
394
395#
396# IP: Virtual Server Configuration
397#
398# CONFIG_IP_VS is not set
399# CONFIG_IPV6 is not set
400CONFIG_NETFILTER=y
401# CONFIG_NETFILTER_DEBUG is not set
402
403#
404# IP: Netfilter Configuration
405#
406# CONFIG_IP_NF_CONNTRACK is not set
407# CONFIG_IP_NF_CONNTRACK_MARK is not set
408# CONFIG_IP_NF_QUEUE is not set
409# CONFIG_IP_NF_IPTABLES is not set
410# CONFIG_IP_NF_ARPTABLES is not set
411
412#
413# SCTP Configuration (EXPERIMENTAL)
414#
415# CONFIG_IP_SCTP is not set
416# CONFIG_ATM is not set
417# CONFIG_BRIDGE is not set
418# CONFIG_VLAN_8021Q is not set
419# CONFIG_DECNET is not set
420# CONFIG_LLC2 is not set
421# CONFIG_IPX is not set
422# CONFIG_ATALK is not set
423# CONFIG_X25 is not set
424# CONFIG_LAPB is not set
425# CONFIG_NET_DIVERT is not set
426# CONFIG_ECONET is not set
427# CONFIG_WAN_ROUTER is not set
428
429#
430# QoS and/or fair queueing
431#
432# CONFIG_NET_SCHED is not set
433# CONFIG_NET_CLS_ROUTE is not set
434
435#
436# Network testing
437#
438# CONFIG_NET_PKTGEN is not set
439# CONFIG_NETPOLL is not set
440# CONFIG_NET_POLL_CONTROLLER is not set
441# CONFIG_HAMRADIO is not set
442# CONFIG_IRDA is not set
443# CONFIG_BT is not set
444CONFIG_NETDEVICES=y
445# CONFIG_DUMMY is not set
446# CONFIG_BONDING is not set
447# CONFIG_EQUALIZER is not set
448# CONFIG_TUN is not set
449
450#
451# ARCnet devices
452#
453# CONFIG_ARCNET is not set
454
455#
456# Ethernet (10 or 100Mbit)
457#
458CONFIG_NET_ETHERNET=y
459CONFIG_MII=y
460# CONFIG_HAPPYMEAL is not set
461# CONFIG_SUNGEM is not set
462# CONFIG_NET_VENDOR_3COM is not set
463
464#
465# Tulip family network device support
466#
467# CONFIG_NET_TULIP is not set
468# CONFIG_HP100 is not set
469CONFIG_IBM_EMAC=y
470# CONFIG_IBM_EMAC_ERRMSG is not set
471CONFIG_IBM_EMAC_RXB=64
472CONFIG_IBM_EMAC_TXB=8
473CONFIG_IBM_EMAC_FGAP=8
474CONFIG_IBM_EMAC_SKBRES=0
475CONFIG_NET_PCI=y
476# CONFIG_PCNET32 is not set
477# CONFIG_AMD8111_ETH is not set
478# CONFIG_ADAPTEC_STARFIRE is not set
479# CONFIG_B44 is not set
480# CONFIG_FORCEDETH is not set
481# CONFIG_DGRS is not set
482CONFIG_EEPRO100=y
483# CONFIG_E100 is not set
484# CONFIG_FEALNX is not set
485CONFIG_NATSEMI=y
486# CONFIG_NE2K_PCI is not set
487# CONFIG_8139CP is not set
488# CONFIG_8139TOO is not set
489# CONFIG_SIS900 is not set
490# CONFIG_EPIC100 is not set
491# CONFIG_SUNDANCE is not set
492# CONFIG_TLAN is not set
493# CONFIG_VIA_RHINE is not set
494
495#
496# Ethernet (1000 Mbit)
497#
498# CONFIG_ACENIC is not set
499# CONFIG_DL2K is not set
500CONFIG_E1000=y
501# CONFIG_E1000_NAPI is not set
502# CONFIG_NS83820 is not set
503# CONFIG_HAMACHI is not set
504# CONFIG_YELLOWFIN is not set
505# CONFIG_R8169 is not set
506# CONFIG_SKGE is not set
507# CONFIG_SK98LIN is not set
508# CONFIG_VIA_VELOCITY is not set
509# CONFIG_TIGON3 is not set
510# CONFIG_BNX2 is not set
511
512#
513# Ethernet (10000 Mbit)
514#
515# CONFIG_IXGB is not set
516# CONFIG_S2IO is not set
517
518#
519# Token Ring devices
520#
521# CONFIG_TR is not set
522
523#
524# Wireless LAN (non-hamradio)
525#
526# CONFIG_NET_RADIO is not set
527
528#
529# Wan interfaces
530#
531# CONFIG_WAN is not set
532# CONFIG_FDDI is not set
533# CONFIG_HIPPI is not set
534# CONFIG_PPP is not set
535# CONFIG_SLIP is not set
536# CONFIG_NET_FC is not set
537# CONFIG_SHAPER is not set
538# CONFIG_NETCONSOLE is not set
539
540#
541# ISDN subsystem
542#
543# CONFIG_ISDN is not set
544
545#
546# Telephony Support
547#
548# CONFIG_PHONE is not set
549
550#
551# Input device support
552#
553CONFIG_INPUT=y
554
555#
556# Userland interfaces
557#
558CONFIG_INPUT_MOUSEDEV=y
559CONFIG_INPUT_MOUSEDEV_PSAUX=y
560CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
561CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
562# CONFIG_INPUT_JOYDEV is not set
563# CONFIG_INPUT_TSDEV is not set
564# CONFIG_INPUT_EVDEV is not set
565# CONFIG_INPUT_EVBUG is not set
566
567#
568# Input Device Drivers
569#
570# CONFIG_INPUT_KEYBOARD is not set
571# CONFIG_INPUT_MOUSE is not set
572# CONFIG_INPUT_JOYSTICK is not set
573# CONFIG_INPUT_TOUCHSCREEN is not set
574# CONFIG_INPUT_MISC is not set
575
576#
577# Hardware I/O ports
578#
579CONFIG_SERIO=y
580# CONFIG_SERIO_I8042 is not set
581# CONFIG_SERIO_SERPORT is not set
582# CONFIG_SERIO_PCIPS2 is not set
583# CONFIG_SERIO_LIBPS2 is not set
584# CONFIG_SERIO_RAW is not set
585# CONFIG_GAMEPORT is not set
586
587#
588# Character devices
589#
590# CONFIG_VT is not set
591# CONFIG_SERIAL_NONSTANDARD is not set
592
593#
594# Serial drivers
595#
596CONFIG_SERIAL_8250=y
597CONFIG_SERIAL_8250_CONSOLE=y
598CONFIG_SERIAL_8250_NR_UARTS=4
599CONFIG_SERIAL_8250_EXTENDED=y
600# CONFIG_SERIAL_8250_MANY_PORTS is not set
601CONFIG_SERIAL_8250_SHARE_IRQ=y
602# CONFIG_SERIAL_8250_DETECT_IRQ is not set
603# CONFIG_SERIAL_8250_RSA is not set
604
605#
606# Non-8250 serial port support
607#
608CONFIG_SERIAL_CORE=y
609CONFIG_SERIAL_CORE_CONSOLE=y
610# CONFIG_SERIAL_JSM is not set
611CONFIG_UNIX98_PTYS=y
612CONFIG_LEGACY_PTYS=y
613CONFIG_LEGACY_PTY_COUNT=256
614
615#
616# IPMI
617#
618# CONFIG_IPMI_HANDLER is not set
619
620#
621# Watchdog Cards
622#
623# CONFIG_WATCHDOG is not set
624# CONFIG_NVRAM is not set
625# CONFIG_GEN_RTC is not set
626# CONFIG_DTLK is not set
627# CONFIG_R3964 is not set
628# CONFIG_APPLICOM is not set
629
630#
631# Ftape, the floppy tape device driver
632#
633# CONFIG_AGP is not set
634# CONFIG_DRM is not set
635# CONFIG_RAW_DRIVER is not set
636
637#
638# TPM devices
639#
640# CONFIG_TCG_TPM is not set
641
642#
643# I2C support
644#
645# CONFIG_I2C is not set
646
647#
648# Dallas's 1-wire bus
649#
650# CONFIG_W1 is not set
651
652#
653# Misc devices
654#
655
656#
657# Multimedia devices
658#
659# CONFIG_VIDEO_DEV is not set
660
661#
662# Digital Video Broadcasting Devices
663#
664# CONFIG_DVB is not set
665
666#
667# Graphics support
668#
669# CONFIG_FB is not set
670
671#
672# Sound
673#
674# CONFIG_SOUND is not set
675
676#
677# USB support
678#
679CONFIG_USB_ARCH_HAS_HCD=y
680CONFIG_USB_ARCH_HAS_OHCI=y
681CONFIG_USB=y
682CONFIG_USB_DEBUG=y
683
684#
685# Miscellaneous USB options
686#
687# CONFIG_USB_DEVICEFS is not set
688# CONFIG_USB_BANDWIDTH is not set
689# CONFIG_USB_DYNAMIC_MINORS is not set
690# CONFIG_USB_OTG is not set
691
692#
693# USB Host Controller Drivers
694#
695# CONFIG_USB_EHCI_HCD is not set
696# CONFIG_USB_ISP116X_HCD is not set
697# CONFIG_USB_OHCI_HCD is not set
698# CONFIG_USB_UHCI_HCD is not set
699# CONFIG_USB_SL811_HCD is not set
700
701#
702# USB Device Class drivers
703#
704# CONFIG_USB_BLUETOOTH_TTY is not set
705# CONFIG_USB_ACM is not set
706# CONFIG_USB_PRINTER is not set
707
708#
709# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
710#
711# CONFIG_USB_STORAGE is not set
712
713#
714# USB Input Devices
715#
716# CONFIG_USB_HID is not set
717
718#
719# USB HID Boot Protocol drivers
720#
721# CONFIG_USB_KBD is not set
722# CONFIG_USB_MOUSE is not set
723# CONFIG_USB_AIPTEK is not set
724# CONFIG_USB_WACOM is not set
725# CONFIG_USB_ACECAD is not set
726# CONFIG_USB_KBTAB is not set
727# CONFIG_USB_POWERMATE is not set
728# CONFIG_USB_MTOUCH is not set
729# CONFIG_USB_ITMTOUCH is not set
730# CONFIG_USB_EGALAX is not set
731# CONFIG_USB_XPAD is not set
732# CONFIG_USB_ATI_REMOTE is not set
733
734#
735# USB Imaging devices
736#
737# CONFIG_USB_MDC800 is not set
738# CONFIG_USB_MICROTEK is not set
739
740#
741# USB Multimedia devices
742#
743# CONFIG_USB_DABUSB is not set
744
745#
746# Video4Linux support is needed for USB Multimedia device support
747#
748
749#
750# USB Network Adapters
751#
752# CONFIG_USB_CATC is not set
753# CONFIG_USB_KAWETH is not set
754CONFIG_USB_PEGASUS=y
755# CONFIG_USB_RTL8150 is not set
756# CONFIG_USB_USBNET is not set
757CONFIG_USB_MON=y
758
759#
760# USB port drivers
761#
762
763#
764# USB Serial Converter support
765#
766# CONFIG_USB_SERIAL is not set
767
768#
769# USB Miscellaneous drivers
770#
771# CONFIG_USB_EMI62 is not set
772# CONFIG_USB_EMI26 is not set
773# CONFIG_USB_AUERSWALD is not set
774# CONFIG_USB_RIO500 is not set
775# CONFIG_USB_LEGOTOWER is not set
776# CONFIG_USB_LCD is not set
777# CONFIG_USB_LED is not set
778# CONFIG_USB_CYTHERM is not set
779# CONFIG_USB_PHIDGETKIT is not set
780# CONFIG_USB_PHIDGETSERVO is not set
781# CONFIG_USB_IDMOUSE is not set
782
783#
784# USB DSL modem support
785#
786
787#
788# USB Gadget Support
789#
790# CONFIG_USB_GADGET is not set
791
792#
793# MMC/SD Card support
794#
795# CONFIG_MMC is not set
796
797#
798# InfiniBand support
799#
800# CONFIG_INFINIBAND is not set
801
802#
803# SN Devices
804#
805
806#
807# File systems
808#
809# CONFIG_EXT2_FS is not set
810# CONFIG_EXT3_FS is not set
811# CONFIG_JBD is not set
812# CONFIG_REISERFS_FS is not set
813# CONFIG_JFS_FS is not set
814
815#
816# XFS support
817#
818# CONFIG_XFS_FS is not set
819# CONFIG_MINIX_FS is not set
820# CONFIG_ROMFS_FS is not set
821# CONFIG_QUOTA is not set
822CONFIG_DNOTIFY=y
823# CONFIG_AUTOFS_FS is not set
824# CONFIG_AUTOFS4_FS is not set
825
826#
827# CD-ROM/DVD Filesystems
828#
829# CONFIG_ISO9660_FS is not set
830# CONFIG_UDF_FS is not set
831
832#
833# DOS/FAT/NT Filesystems
834#
835# CONFIG_MSDOS_FS is not set
836# CONFIG_VFAT_FS is not set
837# CONFIG_NTFS_FS is not set
838
839#
840# Pseudo filesystems
841#
842CONFIG_PROC_FS=y
843CONFIG_PROC_KCORE=y
844CONFIG_SYSFS=y
845# CONFIG_DEVPTS_FS_XATTR is not set
846# CONFIG_TMPFS is not set
847# CONFIG_HUGETLB_PAGE is not set
848CONFIG_RAMFS=y
849
850#
851# Miscellaneous filesystems
852#
853# CONFIG_ADFS_FS is not set
854# CONFIG_AFFS_FS is not set
855# CONFIG_HFS_FS is not set
856# CONFIG_HFSPLUS_FS is not set
857# CONFIG_BEFS_FS is not set
858# CONFIG_BFS_FS is not set
859# CONFIG_EFS_FS is not set
860# CONFIG_CRAMFS is not set
861# CONFIG_VXFS_FS is not set
862# CONFIG_HPFS_FS is not set
863# CONFIG_QNX4FS_FS is not set
864# CONFIG_SYSV_FS is not set
865# CONFIG_UFS_FS is not set
866
867#
868# Network File Systems
869#
870CONFIG_NFS_FS=y
871# CONFIG_NFS_V3 is not set
872# CONFIG_NFS_V4 is not set
873# CONFIG_NFS_DIRECTIO is not set
874# CONFIG_NFSD is not set
875CONFIG_ROOT_NFS=y
876CONFIG_LOCKD=y
877CONFIG_NFS_COMMON=y
878CONFIG_SUNRPC=y
879# CONFIG_RPCSEC_GSS_KRB5 is not set
880# CONFIG_RPCSEC_GSS_SPKM3 is not set
881# CONFIG_SMB_FS is not set
882# CONFIG_CIFS is not set
883# CONFIG_NCP_FS is not set
884# CONFIG_CODA_FS is not set
885# CONFIG_AFS_FS is not set
886
887#
888# Partition Types
889#
890# CONFIG_PARTITION_ADVANCED is not set
891CONFIG_MSDOS_PARTITION=y
892
893#
894# Native Language Support
895#
896# CONFIG_NLS is not set
897
898#
899# Library routines
900#
901# CONFIG_CRC_CCITT is not set
902CONFIG_CRC32=y
903# CONFIG_LIBCRC32C is not set
904
905#
906# Profiling support
907#
908# CONFIG_PROFILING is not set
909
910#
911# Kernel hacking
912#
913# CONFIG_PRINTK_TIME is not set
914CONFIG_DEBUG_KERNEL=y
915CONFIG_MAGIC_SYSRQ=y
916CONFIG_LOG_BUF_SHIFT=14
917# CONFIG_SCHEDSTATS is not set
918# CONFIG_DEBUG_SLAB is not set
919# CONFIG_DEBUG_SPINLOCK is not set
920# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
921# CONFIG_DEBUG_KOBJECT is not set
922CONFIG_DEBUG_INFO=y
923# CONFIG_DEBUG_FS is not set
924# CONFIG_KGDB is not set
925# CONFIG_XMON is not set
926CONFIG_BDI_SWITCH=y
927# CONFIG_SERIAL_TEXT_DEBUG is not set
928CONFIG_PPC_OCP=y
929
930#
931# Security options
932#
933# CONFIG_KEYS is not set
934# CONFIG_SECURITY is not set
935
936#
937# Cryptographic options
938#
939# CONFIG_CRYPTO is not set
940
941#
942# Hardware crypto devices
943#
diff --git a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
index 95ead3f1b1cf..4d33bee23a89 100644
--- a/arch/ppc/configs/common_defconfig
+++ b/arch/ppc/configs/common_defconfig
@@ -1,15 +1,17 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2 3# Linux kernel version: 2.6.13-rc3
4# Thu Nov 18 08:22:35 2004 4# Wed Jul 13 13:34:24 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y 8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
9CONFIG_HAVE_DEC_LOCK=y 10CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y 11CONFIG_PPC=y
11CONFIG_PPC32=y 12CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
13 15
14# 16#
15# Code maturity level options 17# Code maturity level options
@@ -17,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
17CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
20 23
21# 24#
22# General setup 25# General setup
@@ -28,30 +31,33 @@ CONFIG_POSIX_MQUEUE=y
28# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 32CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 34CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 35CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 36CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y 37CONFIG_IKCONFIG_PROC=y
36# CONFIG_EMBEDDED is not set 38# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y 39CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 45CONFIG_FUTEX=y
40CONFIG_EPOLL=y 46CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y 47CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0 48CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0 49CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0 50CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0 51CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
48 54
49# 55#
50# Loadable module support 56# Loadable module support
51# 57#
52CONFIG_MODULES=y 58CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y 59CONFIG_MODULE_UNLOAD=y
54CONFIG_MODULE_FORCE_UNLOAD=y 60# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y 61CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y 62CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set 63# CONFIG_MODULE_SRCVERSION_ALL is not set
@@ -66,22 +72,27 @@ CONFIG_6xx=y
66# CONFIG_POWER3 is not set 72# CONFIG_POWER3 is not set
67# CONFIG_POWER4 is not set 73# CONFIG_POWER4 is not set
68# CONFIG_8xx is not set 74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
69# CONFIG_E500 is not set 76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
70CONFIG_ALTIVEC=y 78CONFIG_ALTIVEC=y
71CONFIG_TAU=y 79CONFIG_TAU=y
72# CONFIG_TAU_INT is not set 80# CONFIG_TAU_INT is not set
73# CONFIG_TAU_AVERAGE is not set 81# CONFIG_TAU_AVERAGE is not set
82# CONFIG_KEXEC is not set
74CONFIG_CPU_FREQ=y 83CONFIG_CPU_FREQ=y
84CONFIG_CPU_FREQ_TABLE=y
75# CONFIG_CPU_FREQ_DEBUG is not set 85# CONFIG_CPU_FREQ_DEBUG is not set
76CONFIG_CPU_FREQ_PROC_INTF=y 86CONFIG_CPU_FREQ_STAT=m
87CONFIG_CPU_FREQ_STAT_DETAILS=y
77CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 88CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
78# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 89# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
79CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 90CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
80# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 91CONFIG_CPU_FREQ_GOV_POWERSAVE=m
81# CONFIG_CPU_FREQ_GOV_USERSPACE is not set 92CONFIG_CPU_FREQ_GOV_USERSPACE=m
82# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set 93CONFIG_CPU_FREQ_GOV_ONDEMAND=m
94CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
83CONFIG_CPU_FREQ_PMAC=y 95CONFIG_CPU_FREQ_PMAC=y
84CONFIG_CPU_FREQ_TABLE=y
85CONFIG_PPC601_SYNC_FIX=y 96CONFIG_PPC601_SYNC_FIX=y
86CONFIG_PM=y 97CONFIG_PM=y
87CONFIG_PPC_STD_MMU=y 98CONFIG_PPC_STD_MMU=y
@@ -91,11 +102,15 @@ CONFIG_PPC_STD_MMU=y
91# 102#
92CONFIG_PPC_MULTIPLATFORM=y 103CONFIG_PPC_MULTIPLATFORM=y
93# CONFIG_APUS is not set 104# CONFIG_APUS is not set
105# CONFIG_KATANA is not set
94# CONFIG_WILLOW is not set 106# CONFIG_WILLOW is not set
107# CONFIG_CPCI690 is not set
95# CONFIG_PCORE is not set 108# CONFIG_PCORE is not set
96# CONFIG_POWERPMC250 is not set 109# CONFIG_POWERPMC250 is not set
97# CONFIG_EV64260 is not set 110# CONFIG_CHESTNUT is not set
98# CONFIG_SPRUCE is not set 111# CONFIG_SPRUCE is not set
112# CONFIG_HDPU is not set
113# CONFIG_EV64260 is not set
99# CONFIG_LOPEC is not set 114# CONFIG_LOPEC is not set
100# CONFIG_MCPN765 is not set 115# CONFIG_MCPN765 is not set
101# CONFIG_MVME5100 is not set 116# CONFIG_MVME5100 is not set
@@ -103,6 +118,7 @@ CONFIG_PPC_MULTIPLATFORM=y
103# CONFIG_PRPMC750 is not set 118# CONFIG_PRPMC750 is not set
104# CONFIG_PRPMC800 is not set 119# CONFIG_PRPMC800 is not set
105# CONFIG_SANDPOINT is not set 120# CONFIG_SANDPOINT is not set
121# CONFIG_RADSTONE_PPC7D is not set
106# CONFIG_ADIR is not set 122# CONFIG_ADIR is not set
107# CONFIG_K2 is not set 123# CONFIG_K2 is not set
108# CONFIG_PAL4 is not set 124# CONFIG_PAL4 is not set
@@ -113,22 +129,40 @@ CONFIG_PPC_MULTIPLATFORM=y
113# CONFIG_RPX8260 is not set 129# CONFIG_RPX8260 is not set
114# CONFIG_TQM8260 is not set 130# CONFIG_TQM8260 is not set
115# CONFIG_ADS8272 is not set 131# CONFIG_ADS8272 is not set
132# CONFIG_PQ2FADS is not set
116# CONFIG_LITE5200 is not set 133# CONFIG_LITE5200 is not set
134# CONFIG_MPC834x_SYS is not set
117CONFIG_PPC_CHRP=y 135CONFIG_PPC_CHRP=y
118CONFIG_PPC_PMAC=y 136CONFIG_PPC_PMAC=y
119CONFIG_PPC_PREP=y 137CONFIG_PPC_PREP=y
120CONFIG_PPC_OF=y 138CONFIG_PPC_OF=y
121CONFIG_PPCBUG_NVRAM=y 139CONFIG_PPCBUG_NVRAM=y
122# CONFIG_SMP is not set 140# CONFIG_SMP is not set
123# CONFIG_PREEMPT is not set
124# CONFIG_HIGHMEM is not set 141# CONFIG_HIGHMEM is not set
142# CONFIG_HZ_100 is not set
143CONFIG_HZ_250=y
144# CONFIG_HZ_1000 is not set
145CONFIG_HZ=250
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
125CONFIG_BINFMT_ELF=y 155CONFIG_BINFMT_ELF=y
126CONFIG_BINFMT_MISC=m 156CONFIG_BINFMT_MISC=m
127CONFIG_PROC_DEVICETREE=y 157CONFIG_PROC_DEVICETREE=y
128CONFIG_PREP_RESIDUAL=y 158CONFIG_PREP_RESIDUAL=y
129CONFIG_PROC_PREPRESIDUAL=y 159CONFIG_PROC_PREPRESIDUAL=y
130CONFIG_CMDLINE_BOOL=y 160# CONFIG_CMDLINE_BOOL is not set
131CONFIG_CMDLINE="console=ttyS0,9600 console=tty0 root=/dev/sda2" 161# CONFIG_PM_DEBUG is not set
162CONFIG_SOFTWARE_SUSPEND=y
163CONFIG_PM_STD_PARTITION=""
164# CONFIG_SECCOMP is not set
165CONFIG_ISA_DMA_API=y
132 166
133# 167#
134# Bus options 168# Bus options
@@ -137,18 +171,24 @@ CONFIG_ISA=y
137CONFIG_GENERIC_ISA_DMA=y 171CONFIG_GENERIC_ISA_DMA=y
138CONFIG_PCI=y 172CONFIG_PCI=y
139CONFIG_PCI_DOMAINS=y 173CONFIG_PCI_DOMAINS=y
140CONFIG_PCI_LEGACY_PROC=y 174# CONFIG_PCI_LEGACY_PROC is not set
141CONFIG_PCI_NAMES=y 175# CONFIG_PCI_NAMES is not set
176# CONFIG_PCI_DEBUG is not set
142 177
143# 178#
144# PCCARD (PCMCIA/CardBus) support 179# PCCARD (PCMCIA/CardBus) support
145# 180#
146# CONFIG_PCCARD is not set 181CONFIG_PCCARD=m
182# CONFIG_PCMCIA_DEBUG is not set
183# CONFIG_PCMCIA is not set
184CONFIG_CARDBUS=y
147 185
148# 186#
149# PC-card bridges 187# PC-card bridges
150# 188#
189CONFIG_YENTA=m
151CONFIG_PCMCIA_PROBE=y 190CONFIG_PCMCIA_PROBE=y
191CONFIG_PCCARD_NONSTATIC=m
152 192
153# 193#
154# Advanced setup 194# Advanced setup
@@ -165,6 +205,143 @@ CONFIG_TASK_SIZE=0x80000000
165CONFIG_BOOT_LOAD=0x00800000 205CONFIG_BOOT_LOAD=0x00800000
166 206
167# 207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215CONFIG_PACKET=y
216# CONFIG_PACKET_MMAP is not set
217CONFIG_UNIX=y
218# CONFIG_NET_KEY is not set
219CONFIG_INET=y
220CONFIG_IP_MULTICAST=y
221# CONFIG_IP_ADVANCED_ROUTER is not set
222CONFIG_IP_FIB_HASH=y
223# CONFIG_IP_PNP is not set
224# CONFIG_NET_IPIP is not set
225# CONFIG_NET_IPGRE is not set
226# CONFIG_IP_MROUTE is not set
227# CONFIG_ARPD is not set
228CONFIG_SYN_COOKIES=y
229# CONFIG_INET_AH is not set
230# CONFIG_INET_ESP is not set
231# CONFIG_INET_IPCOMP is not set
232# CONFIG_INET_TUNNEL is not set
233CONFIG_IP_TCPDIAG=y
234# CONFIG_IP_TCPDIAG_IPV6 is not set
235# CONFIG_TCP_CONG_ADVANCED is not set
236CONFIG_TCP_CONG_BIC=y
237
238#
239# IP: Virtual Server Configuration
240#
241# CONFIG_IP_VS is not set
242# CONFIG_IPV6 is not set
243CONFIG_NETFILTER=y
244# CONFIG_NETFILTER_DEBUG is not set
245
246#
247# IP: Netfilter Configuration
248#
249CONFIG_IP_NF_CONNTRACK=m
250# CONFIG_IP_NF_CT_ACCT is not set
251CONFIG_IP_NF_CONNTRACK_MARK=y
252# CONFIG_IP_NF_CT_PROTO_SCTP is not set
253CONFIG_IP_NF_FTP=m
254CONFIG_IP_NF_IRC=m
255CONFIG_IP_NF_TFTP=m
256CONFIG_IP_NF_AMANDA=m
257CONFIG_IP_NF_QUEUE=m
258CONFIG_IP_NF_IPTABLES=m
259CONFIG_IP_NF_MATCH_LIMIT=m
260CONFIG_IP_NF_MATCH_IPRANGE=m
261CONFIG_IP_NF_MATCH_MAC=m
262CONFIG_IP_NF_MATCH_PKTTYPE=m
263CONFIG_IP_NF_MATCH_MARK=m
264CONFIG_IP_NF_MATCH_MULTIPORT=m
265CONFIG_IP_NF_MATCH_TOS=m
266CONFIG_IP_NF_MATCH_RECENT=m
267CONFIG_IP_NF_MATCH_ECN=m
268CONFIG_IP_NF_MATCH_DSCP=m
269CONFIG_IP_NF_MATCH_AH_ESP=m
270CONFIG_IP_NF_MATCH_LENGTH=m
271CONFIG_IP_NF_MATCH_TTL=m
272CONFIG_IP_NF_MATCH_TCPMSS=m
273CONFIG_IP_NF_MATCH_HELPER=m
274CONFIG_IP_NF_MATCH_STATE=m
275CONFIG_IP_NF_MATCH_CONNTRACK=m
276CONFIG_IP_NF_MATCH_OWNER=m
277CONFIG_IP_NF_MATCH_ADDRTYPE=m
278CONFIG_IP_NF_MATCH_REALM=m
279CONFIG_IP_NF_MATCH_SCTP=m
280CONFIG_IP_NF_MATCH_COMMENT=m
281CONFIG_IP_NF_MATCH_CONNMARK=m
282CONFIG_IP_NF_MATCH_HASHLIMIT=m
283CONFIG_IP_NF_FILTER=m
284CONFIG_IP_NF_TARGET_REJECT=m
285CONFIG_IP_NF_TARGET_LOG=m
286CONFIG_IP_NF_TARGET_ULOG=m
287CONFIG_IP_NF_TARGET_TCPMSS=m
288CONFIG_IP_NF_NAT=m
289CONFIG_IP_NF_NAT_NEEDED=y
290CONFIG_IP_NF_TARGET_MASQUERADE=m
291CONFIG_IP_NF_TARGET_REDIRECT=m
292CONFIG_IP_NF_TARGET_NETMAP=m
293CONFIG_IP_NF_TARGET_SAME=m
294CONFIG_IP_NF_NAT_SNMP_BASIC=m
295CONFIG_IP_NF_NAT_IRC=m
296CONFIG_IP_NF_NAT_FTP=m
297CONFIG_IP_NF_NAT_TFTP=m
298CONFIG_IP_NF_NAT_AMANDA=m
299CONFIG_IP_NF_MANGLE=m
300CONFIG_IP_NF_TARGET_TOS=m
301CONFIG_IP_NF_TARGET_ECN=m
302CONFIG_IP_NF_TARGET_DSCP=m
303CONFIG_IP_NF_TARGET_MARK=m
304CONFIG_IP_NF_TARGET_CLASSIFY=m
305CONFIG_IP_NF_TARGET_CONNMARK=m
306CONFIG_IP_NF_TARGET_CLUSTERIP=m
307CONFIG_IP_NF_RAW=m
308CONFIG_IP_NF_TARGET_NOTRACK=m
309CONFIG_IP_NF_ARPTABLES=m
310# CONFIG_IP_NF_ARPFILTER is not set
311# CONFIG_IP_NF_ARP_MANGLE is not set
312
313#
314# SCTP Configuration (EXPERIMENTAL)
315#
316# CONFIG_IP_SCTP is not set
317# CONFIG_ATM is not set
318# CONFIG_BRIDGE is not set
319# CONFIG_VLAN_8021Q is not set
320# CONFIG_DECNET is not set
321# CONFIG_LLC2 is not set
322# CONFIG_IPX is not set
323# CONFIG_ATALK is not set
324# CONFIG_X25 is not set
325# CONFIG_LAPB is not set
326# CONFIG_NET_DIVERT is not set
327# CONFIG_ECONET is not set
328# CONFIG_WAN_ROUTER is not set
329# CONFIG_NET_SCHED is not set
330CONFIG_NET_CLS_ROUTE=y
331
332#
333# Network testing
334#
335# CONFIG_NET_PKTGEN is not set
336CONFIG_NETPOLL=y
337# CONFIG_NETPOLL_RX is not set
338# CONFIG_NETPOLL_TRAP is not set
339CONFIG_NET_POLL_CONTROLLER=y
340# CONFIG_HAMRADIO is not set
341# CONFIG_IRDA is not set
342# CONFIG_BT is not set
343
344#
168# Device Drivers 345# Device Drivers
169# 346#
170 347
@@ -173,7 +350,8 @@ CONFIG_BOOT_LOAD=0x00800000
173# 350#
174# CONFIG_STANDALONE is not set 351# CONFIG_STANDALONE is not set
175CONFIG_PREVENT_FIRMWARE_BUILD=y 352CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set 353CONFIG_FW_LOADER=m
354# CONFIG_DEBUG_DRIVER is not set
177 355
178# 356#
179# Memory Technology Devices (MTD) 357# Memory Technology Devices (MTD)
@@ -183,7 +361,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
183# 361#
184# Parallel port support 362# Parallel port support
185# 363#
186# CONFIG_PARPORT is not set 364CONFIG_PARPORT=m
365CONFIG_PARPORT_PC=m
366CONFIG_PARPORT_SERIAL=m
367CONFIG_PARPORT_PC_FIFO=y
368CONFIG_PARPORT_PC_SUPERIO=y
369# CONFIG_PARPORT_GSC is not set
370CONFIG_PARPORT_1284=y
187 371
188# 372#
189# Plug and Play support 373# Plug and Play support
@@ -194,18 +378,21 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
194# Block devices 378# Block devices
195# 379#
196CONFIG_BLK_DEV_FD=m 380CONFIG_BLK_DEV_FD=m
197# CONFIG_MAC_FLOPPY is not set 381CONFIG_MAC_FLOPPY=m
198# CONFIG_BLK_DEV_XD is not set 382# CONFIG_BLK_DEV_XD is not set
383# CONFIG_PARIDE is not set
199# CONFIG_BLK_CPQ_DA is not set 384# CONFIG_BLK_CPQ_DA is not set
200# CONFIG_BLK_CPQ_CISS_DA is not set 385# CONFIG_BLK_CPQ_CISS_DA is not set
201# CONFIG_BLK_DEV_DAC960 is not set 386# CONFIG_BLK_DEV_DAC960 is not set
202# CONFIG_BLK_DEV_UMEM is not set 387# CONFIG_BLK_DEV_UMEM is not set
388# CONFIG_BLK_DEV_COW_COMMON is not set
203CONFIG_BLK_DEV_LOOP=y 389CONFIG_BLK_DEV_LOOP=y
204# CONFIG_BLK_DEV_CRYPTOLOOP is not set 390# CONFIG_BLK_DEV_CRYPTOLOOP is not set
205# CONFIG_BLK_DEV_NBD is not set 391# CONFIG_BLK_DEV_NBD is not set
206# CONFIG_BLK_DEV_SX8 is not set 392# CONFIG_BLK_DEV_SX8 is not set
207# CONFIG_BLK_DEV_UB is not set 393# CONFIG_BLK_DEV_UB is not set
208CONFIG_BLK_DEV_RAM=y 394CONFIG_BLK_DEV_RAM=y
395CONFIG_BLK_DEV_RAM_COUNT=16
209CONFIG_BLK_DEV_RAM_SIZE=4096 396CONFIG_BLK_DEV_RAM_SIZE=4096
210CONFIG_BLK_DEV_INITRD=y 397CONFIG_BLK_DEV_INITRD=y
211CONFIG_INITRAMFS_SOURCE="" 398CONFIG_INITRAMFS_SOURCE=""
@@ -219,6 +406,7 @@ CONFIG_IOSCHED_NOOP=y
219CONFIG_IOSCHED_AS=y 406CONFIG_IOSCHED_AS=y
220CONFIG_IOSCHED_DEADLINE=y 407CONFIG_IOSCHED_DEADLINE=y
221CONFIG_IOSCHED_CFQ=y 408CONFIG_IOSCHED_CFQ=y
409# CONFIG_ATA_OVER_ETH is not set
222 410
223# 411#
224# ATA/ATAPI/MFM/RLL support 412# ATA/ATAPI/MFM/RLL support
@@ -247,7 +435,7 @@ CONFIG_IDEPCI_SHARE_IRQ=y
247# CONFIG_BLK_DEV_OFFBOARD is not set 435# CONFIG_BLK_DEV_OFFBOARD is not set
248CONFIG_BLK_DEV_GENERIC=y 436CONFIG_BLK_DEV_GENERIC=y
249# CONFIG_BLK_DEV_OPTI621 is not set 437# CONFIG_BLK_DEV_OPTI621 is not set
250CONFIG_BLK_DEV_SL82C105=y 438# CONFIG_BLK_DEV_SL82C105 is not set
251CONFIG_BLK_DEV_IDEDMA_PCI=y 439CONFIG_BLK_DEV_IDEDMA_PCI=y
252# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 440# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
253CONFIG_IDEDMA_PCI_AUTO=y 441CONFIG_IDEDMA_PCI_AUTO=y
@@ -264,6 +452,7 @@ CONFIG_BLK_DEV_CMD64X=y
264# CONFIG_BLK_DEV_HPT366 is not set 452# CONFIG_BLK_DEV_HPT366 is not set
265# CONFIG_BLK_DEV_SC1200 is not set 453# CONFIG_BLK_DEV_SC1200 is not set
266# CONFIG_BLK_DEV_PIIX is not set 454# CONFIG_BLK_DEV_PIIX is not set
455# CONFIG_BLK_DEV_IT821X is not set
267# CONFIG_BLK_DEV_NS87415 is not set 456# CONFIG_BLK_DEV_NS87415 is not set
268# CONFIG_BLK_DEV_PDC202XX_OLD is not set 457# CONFIG_BLK_DEV_PDC202XX_OLD is not set
269CONFIG_BLK_DEV_PDC202XX_NEW=y 458CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -299,19 +488,21 @@ CONFIG_CHR_DEV_ST=y
299CONFIG_BLK_DEV_SR=y 488CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y 489CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y 490CONFIG_CHR_DEV_SG=y
491# CONFIG_CHR_DEV_SCH is not set
302 492
303# 493#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 494# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
305# 495#
306# CONFIG_SCSI_MULTI_LUN is not set 496# CONFIG_SCSI_MULTI_LUN is not set
307CONFIG_SCSI_CONSTANTS=y 497CONFIG_SCSI_CONSTANTS=y
308# CONFIG_SCSI_LOGGING is not set 498CONFIG_SCSI_LOGGING=y
309 499
310# 500#
311# SCSI Transport Attributes 501# SCSI Transport Attributes
312# 502#
313CONFIG_SCSI_SPI_ATTRS=y 503CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set 504# CONFIG_SCSI_FC_ATTRS is not set
505# CONFIG_SCSI_ISCSI_ATTRS is not set
315 506
316# 507#
317# SCSI low-level drivers 508# SCSI low-level drivers
@@ -340,7 +531,6 @@ CONFIG_SCSI_AIC7XXX_OLD=m
340# CONFIG_SCSI_DMX3191D is not set 531# CONFIG_SCSI_DMX3191D is not set
341# CONFIG_SCSI_DTC3280 is not set 532# CONFIG_SCSI_DTC3280 is not set
342# CONFIG_SCSI_EATA is not set 533# CONFIG_SCSI_EATA is not set
343# CONFIG_SCSI_EATA_PIO is not set
344# CONFIG_SCSI_FUTURE_DOMAIN is not set 534# CONFIG_SCSI_FUTURE_DOMAIN is not set
345# CONFIG_SCSI_GDTH is not set 535# CONFIG_SCSI_GDTH is not set
346# CONFIG_SCSI_GENERIC_NCR5380 is not set 536# CONFIG_SCSI_GENERIC_NCR5380 is not set
@@ -348,6 +538,8 @@ CONFIG_SCSI_AIC7XXX_OLD=m
348# CONFIG_SCSI_IPS is not set 538# CONFIG_SCSI_IPS is not set
349# CONFIG_SCSI_INITIO is not set 539# CONFIG_SCSI_INITIO is not set
350# CONFIG_SCSI_INIA100 is not set 540# CONFIG_SCSI_INIA100 is not set
541# CONFIG_SCSI_PPA is not set
542# CONFIG_SCSI_IMM is not set
351# CONFIG_SCSI_NCR53C406A is not set 543# CONFIG_SCSI_NCR53C406A is not set
352CONFIG_SCSI_SYM53C8XX_2=y 544CONFIG_SCSI_SYM53C8XX_2=y
353CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 545CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
@@ -358,17 +550,15 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
358# CONFIG_SCSI_PAS16 is not set 550# CONFIG_SCSI_PAS16 is not set
359# CONFIG_SCSI_PSI240I is not set 551# CONFIG_SCSI_PSI240I is not set
360# CONFIG_SCSI_QLOGIC_FAS is not set 552# CONFIG_SCSI_QLOGIC_FAS is not set
361# CONFIG_SCSI_QLOGIC_ISP is not set
362# CONFIG_SCSI_QLOGIC_FC is not set 553# CONFIG_SCSI_QLOGIC_FC is not set
363# CONFIG_SCSI_QLOGIC_1280 is not set 554# CONFIG_SCSI_QLOGIC_1280 is not set
364# CONFIG_SCSI_QLOGIC_1280_1040 is not set
365CONFIG_SCSI_QLA2XXX=y 555CONFIG_SCSI_QLA2XXX=y
366# CONFIG_SCSI_QLA21XX is not set 556# CONFIG_SCSI_QLA21XX is not set
367# CONFIG_SCSI_QLA22XX is not set 557# CONFIG_SCSI_QLA22XX is not set
368# CONFIG_SCSI_QLA2300 is not set 558# CONFIG_SCSI_QLA2300 is not set
369# CONFIG_SCSI_QLA2322 is not set 559# CONFIG_SCSI_QLA2322 is not set
370# CONFIG_SCSI_QLA6312 is not set 560# CONFIG_SCSI_QLA6312 is not set
371# CONFIG_SCSI_QLA6322 is not set 561# CONFIG_SCSI_LPFC is not set
372# CONFIG_SCSI_SYM53C416 is not set 562# CONFIG_SCSI_SYM53C416 is not set
373# CONFIG_SCSI_DC395x is not set 563# CONFIG_SCSI_DC395x is not set
374# CONFIG_SCSI_DC390T is not set 564# CONFIG_SCSI_DC390T is not set
@@ -395,11 +585,40 @@ CONFIG_SCSI_MAC53C94=y
395# Fusion MPT device support 585# Fusion MPT device support
396# 586#
397# CONFIG_FUSION is not set 587# CONFIG_FUSION is not set
588# CONFIG_FUSION_SPI is not set
589# CONFIG_FUSION_FC is not set
398 590
399# 591#
400# IEEE 1394 (FireWire) support 592# IEEE 1394 (FireWire) support
401# 593#
402# CONFIG_IEEE1394 is not set 594CONFIG_IEEE1394=m
595
596#
597# Subsystem Options
598#
599# CONFIG_IEEE1394_VERBOSEDEBUG is not set
600CONFIG_IEEE1394_OUI_DB=y
601CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
602CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
603# CONFIG_IEEE1394_EXPORT_FULL_API is not set
604
605#
606# Device Drivers
607#
608# CONFIG_IEEE1394_PCILYNX is not set
609CONFIG_IEEE1394_OHCI1394=m
610
611#
612# Protocol Drivers
613#
614CONFIG_IEEE1394_VIDEO1394=m
615CONFIG_IEEE1394_SBP2=m
616# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
617CONFIG_IEEE1394_ETH1394=m
618CONFIG_IEEE1394_DV1394=m
619CONFIG_IEEE1394_RAWIO=m
620CONFIG_IEEE1394_CMP=m
621CONFIG_IEEE1394_AMDTP=m
403 622
404# 623#
405# I2O device support 624# I2O device support
@@ -412,8 +631,8 @@ CONFIG_SCSI_MAC53C94=y
412CONFIG_ADB=y 631CONFIG_ADB=y
413CONFIG_ADB_CUDA=y 632CONFIG_ADB_CUDA=y
414CONFIG_ADB_PMU=y 633CONFIG_ADB_PMU=y
415CONFIG_PMAC_PBOOK=y
416CONFIG_PMAC_APM_EMU=y 634CONFIG_PMAC_APM_EMU=y
635CONFIG_PMAC_MEDIABAY=y
417CONFIG_PMAC_BACKLIGHT=y 636CONFIG_PMAC_BACKLIGHT=y
418CONFIG_ADB_MACIO=y 637CONFIG_ADB_MACIO=y
419CONFIG_INPUT_ADBHID=y 638CONFIG_INPUT_ADBHID=y
@@ -423,138 +642,13 @@ CONFIG_THERM_ADT746X=m
423# CONFIG_ANSLCD is not set 642# CONFIG_ANSLCD is not set
424 643
425# 644#
426# Networking support 645# Network device support
427#
428CONFIG_NET=y
429
430#
431# Networking options
432#
433CONFIG_PACKET=y
434# CONFIG_PACKET_MMAP is not set
435# CONFIG_NETLINK_DEV is not set
436CONFIG_UNIX=y
437# CONFIG_NET_KEY is not set
438CONFIG_INET=y
439CONFIG_IP_MULTICAST=y
440# CONFIG_IP_ADVANCED_ROUTER is not set
441# CONFIG_IP_PNP is not set
442# CONFIG_NET_IPIP is not set
443# CONFIG_NET_IPGRE is not set
444# CONFIG_IP_MROUTE is not set
445# CONFIG_ARPD is not set
446CONFIG_SYN_COOKIES=y
447# CONFIG_INET_AH is not set
448# CONFIG_INET_ESP is not set
449# CONFIG_INET_IPCOMP is not set
450# CONFIG_INET_TUNNEL is not set
451CONFIG_IP_TCPDIAG=y
452# CONFIG_IP_TCPDIAG_IPV6 is not set
453
454#
455# IP: Virtual Server Configuration
456#
457# CONFIG_IP_VS is not set
458# CONFIG_IPV6 is not set
459CONFIG_NETFILTER=y
460# CONFIG_NETFILTER_DEBUG is not set
461
462#
463# IP: Netfilter Configuration
464# 646#
465CONFIG_IP_NF_CONNTRACK=m
466# CONFIG_IP_NF_CT_ACCT is not set
467# CONFIG_IP_NF_CONNTRACK_MARK is not set
468# CONFIG_IP_NF_CT_PROTO_SCTP is not set
469CONFIG_IP_NF_FTP=m
470CONFIG_IP_NF_IRC=m
471CONFIG_IP_NF_TFTP=m
472CONFIG_IP_NF_AMANDA=m
473# CONFIG_IP_NF_QUEUE is not set
474CONFIG_IP_NF_IPTABLES=m
475CONFIG_IP_NF_MATCH_LIMIT=m
476CONFIG_IP_NF_MATCH_IPRANGE=m
477CONFIG_IP_NF_MATCH_MAC=m
478CONFIG_IP_NF_MATCH_PKTTYPE=m
479CONFIG_IP_NF_MATCH_MARK=m
480CONFIG_IP_NF_MATCH_MULTIPORT=m
481CONFIG_IP_NF_MATCH_TOS=m
482CONFIG_IP_NF_MATCH_RECENT=m
483CONFIG_IP_NF_MATCH_ECN=m
484CONFIG_IP_NF_MATCH_DSCP=m
485CONFIG_IP_NF_MATCH_AH_ESP=m
486CONFIG_IP_NF_MATCH_LENGTH=m
487CONFIG_IP_NF_MATCH_TTL=m
488CONFIG_IP_NF_MATCH_TCPMSS=m
489CONFIG_IP_NF_MATCH_HELPER=m
490CONFIG_IP_NF_MATCH_STATE=m
491CONFIG_IP_NF_MATCH_CONNTRACK=m
492CONFIG_IP_NF_MATCH_OWNER=m
493# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
494# CONFIG_IP_NF_MATCH_REALM is not set
495# CONFIG_IP_NF_MATCH_SCTP is not set
496# CONFIG_IP_NF_MATCH_COMMENT is not set
497# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
498CONFIG_IP_NF_FILTER=m
499CONFIG_IP_NF_TARGET_REJECT=m
500# CONFIG_IP_NF_TARGET_LOG is not set
501CONFIG_IP_NF_TARGET_ULOG=m
502CONFIG_IP_NF_TARGET_TCPMSS=m
503CONFIG_IP_NF_NAT=m
504CONFIG_IP_NF_NAT_NEEDED=y
505CONFIG_IP_NF_TARGET_MASQUERADE=m
506CONFIG_IP_NF_TARGET_REDIRECT=m
507CONFIG_IP_NF_TARGET_NETMAP=m
508CONFIG_IP_NF_TARGET_SAME=m
509CONFIG_IP_NF_NAT_SNMP_BASIC=m
510CONFIG_IP_NF_NAT_IRC=m
511CONFIG_IP_NF_NAT_FTP=m
512CONFIG_IP_NF_NAT_TFTP=m
513CONFIG_IP_NF_NAT_AMANDA=m
514# CONFIG_IP_NF_MANGLE is not set
515CONFIG_IP_NF_RAW=m
516CONFIG_IP_NF_TARGET_NOTRACK=m
517# CONFIG_IP_NF_ARPTABLES is not set
518CONFIG_IP_NF_COMPAT_IPCHAINS=m
519# CONFIG_IP_NF_COMPAT_IPFWADM is not set
520
521#
522# SCTP Configuration (EXPERIMENTAL)
523#
524# CONFIG_IP_SCTP is not set
525# CONFIG_ATM is not set
526# CONFIG_BRIDGE is not set
527# CONFIG_VLAN_8021Q is not set
528# CONFIG_DECNET is not set
529# CONFIG_LLC2 is not set
530# CONFIG_IPX is not set
531# CONFIG_ATALK is not set
532# CONFIG_X25 is not set
533# CONFIG_LAPB is not set
534# CONFIG_NET_DIVERT is not set
535# CONFIG_ECONET is not set
536# CONFIG_WAN_ROUTER is not set
537
538#
539# QoS and/or fair queueing
540#
541# CONFIG_NET_SCHED is not set
542# CONFIG_NET_CLS_ROUTE is not set
543
544#
545# Network testing
546#
547# CONFIG_NET_PKTGEN is not set
548# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set
550# CONFIG_HAMRADIO is not set
551# CONFIG_IRDA is not set
552# CONFIG_BT is not set
553CONFIG_NETDEVICES=y 647CONFIG_NETDEVICES=y
554# CONFIG_DUMMY is not set 648# CONFIG_DUMMY is not set
555# CONFIG_BONDING is not set 649# CONFIG_BONDING is not set
556# CONFIG_EQUALIZER is not set 650# CONFIG_EQUALIZER is not set
557# CONFIG_TUN is not set 651CONFIG_TUN=m
558 652
559# 653#
560# ARCnet devices 654# ARCnet devices
@@ -588,6 +682,8 @@ CONFIG_TULIP_MMIO=y
588CONFIG_DE4X5=m 682CONFIG_DE4X5=m
589# CONFIG_WINBOND_840 is not set 683# CONFIG_WINBOND_840 is not set
590# CONFIG_DM9102 is not set 684# CONFIG_DM9102 is not set
685# CONFIG_PCMCIA_XIRCOM is not set
686# CONFIG_PCMCIA_XIRTULIP is not set
591# CONFIG_AT1700 is not set 687# CONFIG_AT1700 is not set
592# CONFIG_DEPCA is not set 688# CONFIG_DEPCA is not set
593# CONFIG_HP100 is not set 689# CONFIG_HP100 is not set
@@ -626,9 +722,12 @@ CONFIG_PCNET32=y
626# CONFIG_HAMACHI is not set 722# CONFIG_HAMACHI is not set
627# CONFIG_YELLOWFIN is not set 723# CONFIG_YELLOWFIN is not set
628# CONFIG_R8169 is not set 724# CONFIG_R8169 is not set
725# CONFIG_SKGE is not set
629# CONFIG_SK98LIN is not set 726# CONFIG_SK98LIN is not set
630# CONFIG_VIA_VELOCITY is not set 727# CONFIG_VIA_VELOCITY is not set
631# CONFIG_TIGON3 is not set 728# CONFIG_TIGON3 is not set
729# CONFIG_BNX2 is not set
730# CONFIG_MV643XX_ETH is not set
632 731
633# 732#
634# Ethernet (10000 Mbit) 733# Ethernet (10000 Mbit)
@@ -676,18 +775,19 @@ CONFIG_NET_WIRELESS=y
676# CONFIG_WAN is not set 775# CONFIG_WAN is not set
677# CONFIG_FDDI is not set 776# CONFIG_FDDI is not set
678# CONFIG_HIPPI is not set 777# CONFIG_HIPPI is not set
778# CONFIG_PLIP is not set
679CONFIG_PPP=y 779CONFIG_PPP=y
680CONFIG_PPP_MULTILINK=y 780CONFIG_PPP_MULTILINK=y
681CONFIG_PPP_FILTER=y 781CONFIG_PPP_FILTER=y
682CONFIG_PPP_ASYNC=y 782CONFIG_PPP_ASYNC=y
683# CONFIG_PPP_SYNC_TTY is not set 783# CONFIG_PPP_SYNC_TTY is not set
684CONFIG_PPP_DEFLATE=y 784CONFIG_PPP_DEFLATE=y
685# CONFIG_PPP_BSDCOMP is not set 785CONFIG_PPP_BSDCOMP=m
686# CONFIG_PPPOE is not set 786CONFIG_PPPOE=m
687# CONFIG_SLIP is not set 787# CONFIG_SLIP is not set
688# CONFIG_NET_FC is not set 788# CONFIG_NET_FC is not set
689# CONFIG_SHAPER is not set 789# CONFIG_SHAPER is not set
690# CONFIG_NETCONSOLE is not set 790CONFIG_NETCONSOLE=m
691 791
692# 792#
693# ISDN subsystem 793# ISDN subsystem
@@ -708,7 +808,7 @@ CONFIG_INPUT=y
708# Userland interfaces 808# Userland interfaces
709# 809#
710CONFIG_INPUT_MOUSEDEV=y 810CONFIG_INPUT_MOUSEDEV=y
711CONFIG_INPUT_MOUSEDEV_PSAUX=y 811# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
712CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 812CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
713CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 813CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
714# CONFIG_INPUT_JOYDEV is not set 814# CONFIG_INPUT_JOYDEV is not set
@@ -717,18 +817,6 @@ CONFIG_INPUT_EVDEV=y
717CONFIG_INPUT_EVBUG=m 817CONFIG_INPUT_EVBUG=m
718 818
719# 819#
720# Input I/O drivers
721#
722# CONFIG_GAMEPORT is not set
723CONFIG_SOUND_GAMEPORT=y
724CONFIG_SERIO=y
725CONFIG_SERIO_I8042=y
726# CONFIG_SERIO_SERPORT is not set
727# CONFIG_SERIO_CT82C710 is not set
728# CONFIG_SERIO_PCIPS2 is not set
729# CONFIG_SERIO_RAW is not set
730
731#
732# Input Device Drivers 820# Input Device Drivers
733# 821#
734CONFIG_INPUT_KEYBOARD=y 822CONFIG_INPUT_KEYBOARD=y
@@ -751,6 +839,18 @@ CONFIG_INPUT_MISC=y
751CONFIG_INPUT_UINPUT=m 839CONFIG_INPUT_UINPUT=m
752 840
753# 841#
842# Hardware I/O ports
843#
844CONFIG_SERIO=y
845CONFIG_SERIO_I8042=y
846# CONFIG_SERIO_SERPORT is not set
847# CONFIG_SERIO_PARKBD is not set
848# CONFIG_SERIO_PCIPS2 is not set
849CONFIG_SERIO_LIBPS2=y
850# CONFIG_SERIO_RAW is not set
851# CONFIG_GAMEPORT is not set
852
853#
754# Character devices 854# Character devices
755# 855#
756CONFIG_VT=y 856CONFIG_VT=y
@@ -761,7 +861,8 @@ CONFIG_HW_CONSOLE=y
761# 861#
762# Serial drivers 862# Serial drivers
763# 863#
764CONFIG_SERIAL_8250=m 864CONFIG_SERIAL_8250=y
865CONFIG_SERIAL_8250_CONSOLE=y
765CONFIG_SERIAL_8250_NR_UARTS=4 866CONFIG_SERIAL_8250_NR_UARTS=4
766# CONFIG_SERIAL_8250_EXTENDED is not set 867# CONFIG_SERIAL_8250_EXTENDED is not set
767 868
@@ -769,11 +870,16 @@ CONFIG_SERIAL_8250_NR_UARTS=4
769# Non-8250 serial port support 870# Non-8250 serial port support
770# 871#
771CONFIG_SERIAL_CORE=y 872CONFIG_SERIAL_CORE=y
873CONFIG_SERIAL_CORE_CONSOLE=y
772CONFIG_SERIAL_PMACZILOG=y 874CONFIG_SERIAL_PMACZILOG=y
773# CONFIG_SERIAL_PMACZILOG_CONSOLE is not set 875CONFIG_SERIAL_PMACZILOG_CONSOLE=y
876# CONFIG_SERIAL_JSM is not set
774CONFIG_UNIX98_PTYS=y 877CONFIG_UNIX98_PTYS=y
775CONFIG_LEGACY_PTYS=y 878CONFIG_LEGACY_PTYS=y
776CONFIG_LEGACY_PTY_COUNT=256 879CONFIG_LEGACY_PTY_COUNT=256
880# CONFIG_PRINTER is not set
881# CONFIG_PPDEV is not set
882# CONFIG_TIPAR is not set
777 883
778# 884#
779# IPMI 885# IPMI
@@ -794,11 +900,23 @@ CONFIG_GEN_RTC=y
794# 900#
795# Ftape, the floppy tape device driver 901# Ftape, the floppy tape device driver
796# 902#
797# CONFIG_AGP is not set 903CONFIG_AGP=m
798# CONFIG_DRM is not set 904CONFIG_AGP_UNINORTH=m
905CONFIG_DRM=m
906# CONFIG_DRM_TDFX is not set
907CONFIG_DRM_R128=m
908CONFIG_DRM_RADEON=m
909# CONFIG_DRM_MGA is not set
910# CONFIG_DRM_SIS is not set
911# CONFIG_DRM_VIA is not set
799# CONFIG_RAW_DRIVER is not set 912# CONFIG_RAW_DRIVER is not set
800 913
801# 914#
915# TPM devices
916#
917# CONFIG_TCG_TPM is not set
918
919#
802# I2C support 920# I2C support
803# 921#
804CONFIG_I2C=y 922CONFIG_I2C=y
@@ -823,11 +941,13 @@ CONFIG_I2C_ALGOBIT=y
823CONFIG_I2C_HYDRA=y 941CONFIG_I2C_HYDRA=y
824# CONFIG_I2C_I801 is not set 942# CONFIG_I2C_I801 is not set
825# CONFIG_I2C_I810 is not set 943# CONFIG_I2C_I810 is not set
944# CONFIG_I2C_PIIX4 is not set
826# CONFIG_I2C_ISA is not set 945# CONFIG_I2C_ISA is not set
827CONFIG_I2C_KEYWEST=m 946CONFIG_I2C_KEYWEST=m
947# CONFIG_I2C_MPC is not set
828# CONFIG_I2C_NFORCE2 is not set 948# CONFIG_I2C_NFORCE2 is not set
949# CONFIG_I2C_PARPORT is not set
829# CONFIG_I2C_PARPORT_LIGHT is not set 950# CONFIG_I2C_PARPORT_LIGHT is not set
830# CONFIG_I2C_PIIX4 is not set
831# CONFIG_I2C_PROSAVAGE is not set 951# CONFIG_I2C_PROSAVAGE is not set
832# CONFIG_I2C_SAVAGE4 is not set 952# CONFIG_I2C_SAVAGE4 is not set
833# CONFIG_SCx200_ACB is not set 953# CONFIG_SCx200_ACB is not set
@@ -839,43 +959,20 @@ CONFIG_I2C_KEYWEST=m
839# CONFIG_I2C_VIAPRO is not set 959# CONFIG_I2C_VIAPRO is not set
840# CONFIG_I2C_VOODOO3 is not set 960# CONFIG_I2C_VOODOO3 is not set
841# CONFIG_I2C_PCA_ISA is not set 961# CONFIG_I2C_PCA_ISA is not set
962# CONFIG_I2C_SENSOR is not set
842 963
843# 964#
844# Hardware Sensors Chip support 965# Miscellaneous I2C Chip support
845#
846# CONFIG_I2C_SENSOR is not set
847# CONFIG_SENSORS_ADM1021 is not set
848# CONFIG_SENSORS_ADM1025 is not set
849# CONFIG_SENSORS_ADM1031 is not set
850# CONFIG_SENSORS_ASB100 is not set
851# CONFIG_SENSORS_DS1621 is not set
852# CONFIG_SENSORS_FSCHER is not set
853# CONFIG_SENSORS_GL518SM is not set
854# CONFIG_SENSORS_IT87 is not set
855# CONFIG_SENSORS_LM63 is not set
856# CONFIG_SENSORS_LM75 is not set
857# CONFIG_SENSORS_LM77 is not set
858# CONFIG_SENSORS_LM78 is not set
859# CONFIG_SENSORS_LM80 is not set
860# CONFIG_SENSORS_LM83 is not set
861# CONFIG_SENSORS_LM85 is not set
862# CONFIG_SENSORS_LM87 is not set
863# CONFIG_SENSORS_LM90 is not set
864# CONFIG_SENSORS_MAX1619 is not set
865# CONFIG_SENSORS_PC87360 is not set
866# CONFIG_SENSORS_SMSC47M1 is not set
867# CONFIG_SENSORS_VIA686A is not set
868# CONFIG_SENSORS_W83781D is not set
869# CONFIG_SENSORS_W83L785TS is not set
870# CONFIG_SENSORS_W83627HF is not set
871
872#
873# Other I2C Chip support
874# 966#
967# CONFIG_SENSORS_DS1337 is not set
968# CONFIG_SENSORS_DS1374 is not set
875# CONFIG_SENSORS_EEPROM is not set 969# CONFIG_SENSORS_EEPROM is not set
876# CONFIG_SENSORS_PCF8574 is not set 970# CONFIG_SENSORS_PCF8574 is not set
971# CONFIG_SENSORS_PCA9539 is not set
877# CONFIG_SENSORS_PCF8591 is not set 972# CONFIG_SENSORS_PCF8591 is not set
878# CONFIG_SENSORS_RTC8564 is not set 973# CONFIG_SENSORS_RTC8564 is not set
974# CONFIG_SENSORS_M41T00 is not set
975# CONFIG_SENSORS_MAX6875 is not set
879# CONFIG_I2C_DEBUG_CORE is not set 976# CONFIG_I2C_DEBUG_CORE is not set
880# CONFIG_I2C_DEBUG_ALGO is not set 977# CONFIG_I2C_DEBUG_ALGO is not set
881# CONFIG_I2C_DEBUG_BUS is not set 978# CONFIG_I2C_DEBUG_BUS is not set
@@ -887,6 +984,11 @@ CONFIG_I2C_KEYWEST=m
887# CONFIG_W1 is not set 984# CONFIG_W1 is not set
888 985
889# 986#
987# Hardware Monitoring support
988#
989# CONFIG_HWMON is not set
990
991#
890# Misc devices 992# Misc devices
891# 993#
892 994
@@ -904,8 +1006,13 @@ CONFIG_I2C_KEYWEST=m
904# Graphics support 1006# Graphics support
905# 1007#
906CONFIG_FB=y 1008CONFIG_FB=y
1009CONFIG_FB_CFB_FILLRECT=y
1010CONFIG_FB_CFB_COPYAREA=y
1011CONFIG_FB_CFB_IMAGEBLIT=y
1012CONFIG_FB_SOFT_CURSOR=y
1013CONFIG_FB_MACMODES=y
907CONFIG_FB_MODE_HELPERS=y 1014CONFIG_FB_MODE_HELPERS=y
908# CONFIG_FB_TILEBLITTING is not set 1015CONFIG_FB_TILEBLITTING=y
909# CONFIG_FB_CIRRUS is not set 1016# CONFIG_FB_CIRRUS is not set
910# CONFIG_FB_PM2 is not set 1017# CONFIG_FB_PM2 is not set
911# CONFIG_FB_CYBER2000 is not set 1018# CONFIG_FB_CYBER2000 is not set
@@ -917,13 +1024,16 @@ CONFIG_FB_CT65550=y
917# CONFIG_FB_ASILIANT is not set 1024# CONFIG_FB_ASILIANT is not set
918CONFIG_FB_IMSTT=y 1025CONFIG_FB_IMSTT=y
919# CONFIG_FB_VGA16 is not set 1026# CONFIG_FB_VGA16 is not set
920# CONFIG_FB_RIVA is not set 1027# CONFIG_FB_NVIDIA is not set
1028CONFIG_FB_RIVA=y
1029CONFIG_FB_RIVA_I2C=y
1030# CONFIG_FB_RIVA_DEBUG is not set
921CONFIG_FB_MATROX=y 1031CONFIG_FB_MATROX=y
922CONFIG_FB_MATROX_MILLENIUM=y 1032CONFIG_FB_MATROX_MILLENIUM=y
923CONFIG_FB_MATROX_MYSTIQUE=y 1033CONFIG_FB_MATROX_MYSTIQUE=y
924# CONFIG_FB_MATROX_G450 is not set 1034CONFIG_FB_MATROX_G=y
925# CONFIG_FB_MATROX_G100A is not set
926CONFIG_FB_MATROX_I2C=y 1035CONFIG_FB_MATROX_I2C=y
1036CONFIG_FB_MATROX_MAVEN=m
927# CONFIG_FB_MATROX_MULTIHEAD is not set 1037# CONFIG_FB_MATROX_MULTIHEAD is not set
928# CONFIG_FB_RADEON_OLD is not set 1038# CONFIG_FB_RADEON_OLD is not set
929CONFIG_FB_RADEON=y 1039CONFIG_FB_RADEON=y
@@ -932,8 +1042,8 @@ CONFIG_FB_RADEON_I2C=y
932CONFIG_FB_ATY128=y 1042CONFIG_FB_ATY128=y
933CONFIG_FB_ATY=y 1043CONFIG_FB_ATY=y
934CONFIG_FB_ATY_CT=y 1044CONFIG_FB_ATY_CT=y
935# CONFIG_FB_ATY_GENERIC_LCD is not set 1045CONFIG_FB_ATY_GENERIC_LCD=y
936# CONFIG_FB_ATY_XL_INIT is not set 1046CONFIG_FB_ATY_XL_INIT=y
937CONFIG_FB_ATY_GX=y 1047CONFIG_FB_ATY_GX=y
938# CONFIG_FB_SAVAGE is not set 1048# CONFIG_FB_SAVAGE is not set
939# CONFIG_FB_SIS is not set 1049# CONFIG_FB_SIS is not set
@@ -943,6 +1053,7 @@ CONFIG_FB_3DFX=y
943# CONFIG_FB_3DFX_ACCEL is not set 1053# CONFIG_FB_3DFX_ACCEL is not set
944# CONFIG_FB_VOODOO1 is not set 1054# CONFIG_FB_VOODOO1 is not set
945# CONFIG_FB_TRIDENT is not set 1055# CONFIG_FB_TRIDENT is not set
1056# CONFIG_FB_S1D13XXX is not set
946# CONFIG_FB_VIRTUAL is not set 1057# CONFIG_FB_VIRTUAL is not set
947 1058
948# 1059#
@@ -960,9 +1071,10 @@ CONFIG_FONT_8x16=y
960# Logo configuration 1071# Logo configuration
961# 1072#
962CONFIG_LOGO=y 1073CONFIG_LOGO=y
963CONFIG_LOGO_LINUX_MONO=y 1074# CONFIG_LOGO_LINUX_MONO is not set
964CONFIG_LOGO_LINUX_VGA16=y 1075# CONFIG_LOGO_LINUX_VGA16 is not set
965CONFIG_LOGO_LINUX_CLUT224=y 1076CONFIG_LOGO_LINUX_CLUT224=y
1077# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
966 1078
967# 1079#
968# Sound 1080# Sound
@@ -987,6 +1099,7 @@ CONFIG_SND_PCM_OSS=m
987CONFIG_SND_SEQUENCER_OSS=y 1099CONFIG_SND_SEQUENCER_OSS=y
988# CONFIG_SND_VERBOSE_PRINTK is not set 1100# CONFIG_SND_VERBOSE_PRINTK is not set
989# CONFIG_SND_DEBUG is not set 1101# CONFIG_SND_DEBUG is not set
1102CONFIG_SND_GENERIC_PM=y
990 1103
991# 1104#
992# Generic devices 1105# Generic devices
@@ -1002,6 +1115,7 @@ CONFIG_SND_OPL3_LIB=m
1002# 1115#
1003# ISA devices 1116# ISA devices
1004# 1117#
1118CONFIG_SND_CS4231_LIB=m
1005# CONFIG_SND_AD1848 is not set 1119# CONFIG_SND_AD1848 is not set
1006# CONFIG_SND_CS4231 is not set 1120# CONFIG_SND_CS4231 is not set
1007CONFIG_SND_CS4232=m 1121CONFIG_SND_CS4232=m
@@ -1039,6 +1153,8 @@ CONFIG_SND_CS4232=m
1039# CONFIG_SND_CS46XX is not set 1153# CONFIG_SND_CS46XX is not set
1040# CONFIG_SND_CS4281 is not set 1154# CONFIG_SND_CS4281 is not set
1041# CONFIG_SND_EMU10K1 is not set 1155# CONFIG_SND_EMU10K1 is not set
1156# CONFIG_SND_EMU10K1X is not set
1157# CONFIG_SND_CA0106 is not set
1042# CONFIG_SND_KORG1212 is not set 1158# CONFIG_SND_KORG1212 is not set
1043# CONFIG_SND_MIXART is not set 1159# CONFIG_SND_MIXART is not set
1044# CONFIG_SND_NM256 is not set 1160# CONFIG_SND_NM256 is not set
@@ -1046,6 +1162,7 @@ CONFIG_SND_CS4232=m
1046# CONFIG_SND_RME96 is not set 1162# CONFIG_SND_RME96 is not set
1047# CONFIG_SND_RME9652 is not set 1163# CONFIG_SND_RME9652 is not set
1048# CONFIG_SND_HDSP is not set 1164# CONFIG_SND_HDSP is not set
1165# CONFIG_SND_HDSPM is not set
1049# CONFIG_SND_TRIDENT is not set 1166# CONFIG_SND_TRIDENT is not set
1050# CONFIG_SND_YMFPCI is not set 1167# CONFIG_SND_YMFPCI is not set
1051# CONFIG_SND_ALS4000 is not set 1168# CONFIG_SND_ALS4000 is not set
@@ -1062,7 +1179,9 @@ CONFIG_SND_CS4232=m
1062# CONFIG_SND_INTEL8X0M is not set 1179# CONFIG_SND_INTEL8X0M is not set
1063# CONFIG_SND_SONICVIBES is not set 1180# CONFIG_SND_SONICVIBES is not set
1064# CONFIG_SND_VIA82XX is not set 1181# CONFIG_SND_VIA82XX is not set
1182# CONFIG_SND_VIA82XX_MODEM is not set
1065# CONFIG_SND_VX222 is not set 1183# CONFIG_SND_VX222 is not set
1184# CONFIG_SND_HDA_INTEL is not set
1066 1185
1067# 1186#
1068# ALSA PowerMac devices 1187# ALSA PowerMac devices
@@ -1083,6 +1202,8 @@ CONFIG_SND_USB_AUDIO=m
1083# 1202#
1084# USB support 1203# USB support
1085# 1204#
1205CONFIG_USB_ARCH_HAS_HCD=y
1206CONFIG_USB_ARCH_HAS_OHCI=y
1086CONFIG_USB=y 1207CONFIG_USB=y
1087# CONFIG_USB_DEBUG is not set 1208# CONFIG_USB_DEBUG is not set
1088 1209
@@ -1094,15 +1215,19 @@ CONFIG_USB_DEVICEFS=y
1094# CONFIG_USB_DYNAMIC_MINORS is not set 1215# CONFIG_USB_DYNAMIC_MINORS is not set
1095# CONFIG_USB_SUSPEND is not set 1216# CONFIG_USB_SUSPEND is not set
1096# CONFIG_USB_OTG is not set 1217# CONFIG_USB_OTG is not set
1097CONFIG_USB_ARCH_HAS_HCD=y
1098CONFIG_USB_ARCH_HAS_OHCI=y
1099 1218
1100# 1219#
1101# USB Host Controller Drivers 1220# USB Host Controller Drivers
1102# 1221#
1103# CONFIG_USB_EHCI_HCD is not set 1222CONFIG_USB_EHCI_HCD=m
1223CONFIG_USB_EHCI_SPLIT_ISO=y
1224CONFIG_USB_EHCI_ROOT_HUB_TT=y
1225# CONFIG_USB_ISP116X_HCD is not set
1104CONFIG_USB_OHCI_HCD=y 1226CONFIG_USB_OHCI_HCD=y
1105# CONFIG_USB_UHCI_HCD is not set 1227# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1228CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1229CONFIG_USB_UHCI_HCD=m
1230# CONFIG_USB_SL811_HCD is not set
1106 1231
1107# 1232#
1108# USB Device Class drivers 1233# USB Device Class drivers
@@ -1112,17 +1237,20 @@ CONFIG_USB_OHCI_HCD=y
1112# CONFIG_USB_MIDI is not set 1237# CONFIG_USB_MIDI is not set
1113CONFIG_USB_ACM=m 1238CONFIG_USB_ACM=m
1114CONFIG_USB_PRINTER=m 1239CONFIG_USB_PRINTER=m
1240
1241#
1242# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
1243#
1115CONFIG_USB_STORAGE=m 1244CONFIG_USB_STORAGE=m
1116# CONFIG_USB_STORAGE_DEBUG is not set 1245# CONFIG_USB_STORAGE_DEBUG is not set
1117# CONFIG_USB_STORAGE_RW_DETECT is not set 1246CONFIG_USB_STORAGE_DATAFAB=y
1118# CONFIG_USB_STORAGE_DATAFAB is not set
1119CONFIG_USB_STORAGE_FREECOM=y 1247CONFIG_USB_STORAGE_FREECOM=y
1120# CONFIG_USB_STORAGE_ISD200 is not set 1248CONFIG_USB_STORAGE_ISD200=y
1121CONFIG_USB_STORAGE_DPCM=y 1249CONFIG_USB_STORAGE_DPCM=y
1122# CONFIG_USB_STORAGE_HP8200e is not set 1250CONFIG_USB_STORAGE_USBAT=y
1123# CONFIG_USB_STORAGE_SDDR09 is not set 1251CONFIG_USB_STORAGE_SDDR09=y
1124# CONFIG_USB_STORAGE_SDDR55 is not set 1252CONFIG_USB_STORAGE_SDDR55=y
1125# CONFIG_USB_STORAGE_JUMPSHOT is not set 1253CONFIG_USB_STORAGE_JUMPSHOT=y
1126 1254
1127# 1255#
1128# USB Input Devices 1256# USB Input Devices
@@ -1130,22 +1258,24 @@ CONFIG_USB_STORAGE_DPCM=y
1130CONFIG_USB_HID=y 1258CONFIG_USB_HID=y
1131CONFIG_USB_HIDINPUT=y 1259CONFIG_USB_HIDINPUT=y
1132# CONFIG_HID_FF is not set 1260# CONFIG_HID_FF is not set
1133# CONFIG_USB_HIDDEV is not set 1261CONFIG_USB_HIDDEV=y
1134# CONFIG_USB_AIPTEK is not set 1262# CONFIG_USB_AIPTEK is not set
1135# CONFIG_USB_WACOM is not set 1263# CONFIG_USB_WACOM is not set
1264# CONFIG_USB_ACECAD is not set
1136# CONFIG_USB_KBTAB is not set 1265# CONFIG_USB_KBTAB is not set
1137# CONFIG_USB_POWERMATE is not set 1266# CONFIG_USB_POWERMATE is not set
1138# CONFIG_USB_MTOUCH is not set 1267# CONFIG_USB_MTOUCH is not set
1268# CONFIG_USB_ITMTOUCH is not set
1139# CONFIG_USB_EGALAX is not set 1269# CONFIG_USB_EGALAX is not set
1140# CONFIG_USB_XPAD is not set 1270# CONFIG_USB_XPAD is not set
1141# CONFIG_USB_ATI_REMOTE is not set 1271# CONFIG_USB_ATI_REMOTE is not set
1272# CONFIG_USB_KEYSPAN_REMOTE is not set
1142 1273
1143# 1274#
1144# USB Imaging devices 1275# USB Imaging devices
1145# 1276#
1146# CONFIG_USB_MDC800 is not set 1277# CONFIG_USB_MDC800 is not set
1147# CONFIG_USB_MICROTEK is not set 1278# CONFIG_USB_MICROTEK is not set
1148# CONFIG_USB_HPUSBSCSI is not set
1149 1279
1150# 1280#
1151# USB Multimedia devices 1281# USB Multimedia devices
@@ -1161,22 +1291,27 @@ CONFIG_USB_HIDINPUT=y
1161# 1291#
1162# CONFIG_USB_CATC is not set 1292# CONFIG_USB_CATC is not set
1163# CONFIG_USB_KAWETH is not set 1293# CONFIG_USB_KAWETH is not set
1164# CONFIG_USB_PEGASUS is not set 1294CONFIG_USB_PEGASUS=m
1165# CONFIG_USB_RTL8150 is not set 1295# CONFIG_USB_RTL8150 is not set
1166# CONFIG_USB_USBNET is not set 1296# CONFIG_USB_USBNET is not set
1297# CONFIG_USB_ZD1201 is not set
1298# CONFIG_USB_MON is not set
1167 1299
1168# 1300#
1169# USB port drivers 1301# USB port drivers
1170# 1302#
1303# CONFIG_USB_USS720 is not set
1171 1304
1172# 1305#
1173# USB Serial Converter support 1306# USB Serial Converter support
1174# 1307#
1175CONFIG_USB_SERIAL=m 1308CONFIG_USB_SERIAL=m
1176# CONFIG_USB_SERIAL_GENERIC is not set 1309# CONFIG_USB_SERIAL_GENERIC is not set
1310# CONFIG_USB_SERIAL_AIRPRIME is not set
1177# CONFIG_USB_SERIAL_BELKIN is not set 1311# CONFIG_USB_SERIAL_BELKIN is not set
1178# CONFIG_USB_SERIAL_WHITEHEAT is not set 1312# CONFIG_USB_SERIAL_WHITEHEAT is not set
1179# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1313# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1314# CONFIG_USB_SERIAL_CP2101 is not set
1180# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 1315# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1181# CONFIG_USB_SERIAL_EMPEG is not set 1316# CONFIG_USB_SERIAL_EMPEG is not set
1182# CONFIG_USB_SERIAL_FTDI_SIO is not set 1317# CONFIG_USB_SERIAL_FTDI_SIO is not set
@@ -1185,28 +1320,32 @@ CONFIG_USB_SERIAL_VISOR=m
1185# CONFIG_USB_SERIAL_IR is not set 1320# CONFIG_USB_SERIAL_IR is not set
1186# CONFIG_USB_SERIAL_EDGEPORT is not set 1321# CONFIG_USB_SERIAL_EDGEPORT is not set
1187# CONFIG_USB_SERIAL_EDGEPORT_TI is not set 1322# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1323# CONFIG_USB_SERIAL_GARMIN is not set
1188# CONFIG_USB_SERIAL_IPW is not set 1324# CONFIG_USB_SERIAL_IPW is not set
1189# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set 1325# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1190CONFIG_USB_SERIAL_KEYSPAN=m 1326CONFIG_USB_SERIAL_KEYSPAN=m
1191# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set 1327CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1192CONFIG_USB_SERIAL_KEYSPAN_USA28=y 1328CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1193CONFIG_USB_SERIAL_KEYSPAN_USA28X=y 1329CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1194# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set 1330CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1195# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set 1331CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1196CONFIG_USB_SERIAL_KEYSPAN_USA19=y 1332CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1197CONFIG_USB_SERIAL_KEYSPAN_USA18X=y 1333CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1198CONFIG_USB_SERIAL_KEYSPAN_USA19W=y 1334CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1199CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y 1335CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1200CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y 1336CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1201CONFIG_USB_SERIAL_KEYSPAN_USA49W=y 1337CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1202# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set 1338CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1203# CONFIG_USB_SERIAL_KLSI is not set 1339# CONFIG_USB_SERIAL_KLSI is not set
1204# CONFIG_USB_SERIAL_KOBIL_SCT is not set 1340# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1205# CONFIG_USB_SERIAL_MCT_U232 is not set 1341# CONFIG_USB_SERIAL_MCT_U232 is not set
1206# CONFIG_USB_SERIAL_PL2303 is not set 1342# CONFIG_USB_SERIAL_PL2303 is not set
1343# CONFIG_USB_SERIAL_HP4X is not set
1207# CONFIG_USB_SERIAL_SAFE is not set 1344# CONFIG_USB_SERIAL_SAFE is not set
1345# CONFIG_USB_SERIAL_TI is not set
1208# CONFIG_USB_SERIAL_CYBERJACK is not set 1346# CONFIG_USB_SERIAL_CYBERJACK is not set
1209# CONFIG_USB_SERIAL_XIRCOM is not set 1347# CONFIG_USB_SERIAL_XIRCOM is not set
1348# CONFIG_USB_SERIAL_OPTION is not set
1210# CONFIG_USB_SERIAL_OMNINET is not set 1349# CONFIG_USB_SERIAL_OMNINET is not set
1211CONFIG_USB_EZUSB=y 1350CONFIG_USB_EZUSB=y
1212 1351
@@ -1215,7 +1354,6 @@ CONFIG_USB_EZUSB=y
1215# 1354#
1216# CONFIG_USB_EMI62 is not set 1355# CONFIG_USB_EMI62 is not set
1217# CONFIG_USB_EMI26 is not set 1356# CONFIG_USB_EMI26 is not set
1218# CONFIG_USB_TIGL is not set
1219# CONFIG_USB_AUERSWALD is not set 1357# CONFIG_USB_AUERSWALD is not set
1220# CONFIG_USB_RIO500 is not set 1358# CONFIG_USB_RIO500 is not set
1221# CONFIG_USB_LEGOTOWER is not set 1359# CONFIG_USB_LEGOTOWER is not set
@@ -1224,10 +1362,13 @@ CONFIG_USB_EZUSB=y
1224# CONFIG_USB_CYTHERM is not set 1362# CONFIG_USB_CYTHERM is not set
1225# CONFIG_USB_PHIDGETKIT is not set 1363# CONFIG_USB_PHIDGETKIT is not set
1226# CONFIG_USB_PHIDGETSERVO is not set 1364# CONFIG_USB_PHIDGETSERVO is not set
1365# CONFIG_USB_IDMOUSE is not set
1366# CONFIG_USB_SISUSBVGA is not set
1367# CONFIG_USB_LD is not set
1227# CONFIG_USB_TEST is not set 1368# CONFIG_USB_TEST is not set
1228 1369
1229# 1370#
1230# USB ATM/DSL drivers 1371# USB DSL modem support
1231# 1372#
1232 1373
1233# 1374#
@@ -1236,21 +1377,63 @@ CONFIG_USB_EZUSB=y
1236# CONFIG_USB_GADGET is not set 1377# CONFIG_USB_GADGET is not set
1237 1378
1238# 1379#
1380# MMC/SD Card support
1381#
1382# CONFIG_MMC is not set
1383
1384#
1385# InfiniBand support
1386#
1387# CONFIG_INFINIBAND is not set
1388
1389#
1390# SN Devices
1391#
1392
1393#
1239# File systems 1394# File systems
1240# 1395#
1241CONFIG_EXT2_FS=y 1396CONFIG_EXT2_FS=y
1242# CONFIG_EXT2_FS_XATTR is not set 1397CONFIG_EXT2_FS_XATTR=y
1243# CONFIG_EXT3_FS is not set 1398CONFIG_EXT2_FS_POSIX_ACL=y
1244# CONFIG_JBD is not set 1399CONFIG_EXT2_FS_SECURITY=y
1245# CONFIG_REISERFS_FS is not set 1400# CONFIG_EXT2_FS_XIP is not set
1246# CONFIG_JFS_FS is not set 1401CONFIG_EXT3_FS=y
1247# CONFIG_XFS_FS is not set 1402CONFIG_EXT3_FS_XATTR=y
1403CONFIG_EXT3_FS_POSIX_ACL=y
1404CONFIG_EXT3_FS_SECURITY=y
1405CONFIG_JBD=y
1406# CONFIG_JBD_DEBUG is not set
1407CONFIG_FS_MBCACHE=y
1408CONFIG_REISERFS_FS=y
1409# CONFIG_REISERFS_CHECK is not set
1410# CONFIG_REISERFS_PROC_INFO is not set
1411CONFIG_REISERFS_FS_XATTR=y
1412CONFIG_REISERFS_FS_POSIX_ACL=y
1413CONFIG_REISERFS_FS_SECURITY=y
1414CONFIG_JFS_FS=m
1415CONFIG_JFS_POSIX_ACL=y
1416CONFIG_JFS_SECURITY=y
1417# CONFIG_JFS_DEBUG is not set
1418# CONFIG_JFS_STATISTICS is not set
1419CONFIG_FS_POSIX_ACL=y
1420
1421#
1422# XFS support
1423#
1424CONFIG_XFS_FS=m
1425CONFIG_XFS_EXPORT=y
1426# CONFIG_XFS_RT is not set
1427# CONFIG_XFS_QUOTA is not set
1428CONFIG_XFS_SECURITY=y
1429CONFIG_XFS_POSIX_ACL=y
1248# CONFIG_MINIX_FS is not set 1430# CONFIG_MINIX_FS is not set
1249# CONFIG_ROMFS_FS is not set 1431# CONFIG_ROMFS_FS is not set
1432CONFIG_INOTIFY=y
1250# CONFIG_QUOTA is not set 1433# CONFIG_QUOTA is not set
1251CONFIG_DNOTIFY=y 1434CONFIG_DNOTIFY=y
1252# CONFIG_AUTOFS_FS is not set 1435# CONFIG_AUTOFS_FS is not set
1253# CONFIG_AUTOFS4_FS is not set 1436CONFIG_AUTOFS4_FS=m
1254 1437
1255# 1438#
1256# CD-ROM/DVD Filesystems 1439# CD-ROM/DVD Filesystems
@@ -1258,7 +1441,8 @@ CONFIG_DNOTIFY=y
1258CONFIG_ISO9660_FS=y 1441CONFIG_ISO9660_FS=y
1259# CONFIG_JOLIET is not set 1442# CONFIG_JOLIET is not set
1260# CONFIG_ZISOFS is not set 1443# CONFIG_ZISOFS is not set
1261# CONFIG_UDF_FS is not set 1444CONFIG_UDF_FS=m
1445CONFIG_UDF_NLS=y
1262 1446
1263# 1447#
1264# DOS/FAT/NT Filesystems 1448# DOS/FAT/NT Filesystems
@@ -1276,12 +1460,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1276CONFIG_PROC_FS=y 1460CONFIG_PROC_FS=y
1277CONFIG_PROC_KCORE=y 1461CONFIG_PROC_KCORE=y
1278CONFIG_SYSFS=y 1462CONFIG_SYSFS=y
1279CONFIG_DEVFS_FS=y 1463CONFIG_DEVPTS_FS_XATTR=y
1280# CONFIG_DEVFS_MOUNT is not set 1464CONFIG_DEVPTS_FS_SECURITY=y
1281# CONFIG_DEVFS_DEBUG is not set
1282# CONFIG_DEVPTS_FS_XATTR is not set
1283CONFIG_TMPFS=y 1465CONFIG_TMPFS=y
1284# CONFIG_TMPFS_XATTR is not set 1466CONFIG_TMPFS_XATTR=y
1467CONFIG_TMPFS_SECURITY=y
1285# CONFIG_HUGETLB_PAGE is not set 1468# CONFIG_HUGETLB_PAGE is not set
1286CONFIG_RAMFS=y 1469CONFIG_RAMFS=y
1287 1470
@@ -1295,27 +1478,33 @@ CONFIG_HFSPLUS_FS=m
1295# CONFIG_BEFS_FS is not set 1478# CONFIG_BEFS_FS is not set
1296# CONFIG_BFS_FS is not set 1479# CONFIG_BFS_FS is not set
1297# CONFIG_EFS_FS is not set 1480# CONFIG_EFS_FS is not set
1298# CONFIG_CRAMFS is not set 1481CONFIG_CRAMFS=m
1299# CONFIG_VXFS_FS is not set 1482# CONFIG_VXFS_FS is not set
1300# CONFIG_HPFS_FS is not set 1483# CONFIG_HPFS_FS is not set
1301# CONFIG_QNX4FS_FS is not set 1484# CONFIG_QNX4FS_FS is not set
1302# CONFIG_SYSV_FS is not set 1485# CONFIG_SYSV_FS is not set
1303# CONFIG_UFS_FS is not set 1486CONFIG_UFS_FS=m
1487# CONFIG_UFS_FS_WRITE is not set
1304 1488
1305# 1489#
1306# Network File Systems 1490# Network File Systems
1307# 1491#
1308CONFIG_NFS_FS=y 1492CONFIG_NFS_FS=y
1309CONFIG_NFS_V3=y 1493CONFIG_NFS_V3=y
1494CONFIG_NFS_V3_ACL=y
1310# CONFIG_NFS_V4 is not set 1495# CONFIG_NFS_V4 is not set
1311# CONFIG_NFS_DIRECTIO is not set 1496# CONFIG_NFS_DIRECTIO is not set
1312CONFIG_NFSD=y 1497CONFIG_NFSD=y
1498CONFIG_NFSD_V2_ACL=y
1313CONFIG_NFSD_V3=y 1499CONFIG_NFSD_V3=y
1500CONFIG_NFSD_V3_ACL=y
1314# CONFIG_NFSD_V4 is not set 1501# CONFIG_NFSD_V4 is not set
1315CONFIG_NFSD_TCP=y 1502CONFIG_NFSD_TCP=y
1316CONFIG_LOCKD=y 1503CONFIG_LOCKD=y
1317CONFIG_LOCKD_V4=y 1504CONFIG_LOCKD_V4=y
1318CONFIG_EXPORTFS=y 1505CONFIG_EXPORTFS=y
1506CONFIG_NFS_ACL_SUPPORT=y
1507CONFIG_NFS_COMMON=y
1319CONFIG_SUNRPC=y 1508CONFIG_SUNRPC=y
1320# CONFIG_RPCSEC_GSS_KRB5 is not set 1509# CONFIG_RPCSEC_GSS_KRB5 is not set
1321# CONFIG_RPCSEC_GSS_SPKM3 is not set 1510# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -1348,46 +1537,46 @@ CONFIG_MSDOS_PARTITION=y
1348# 1537#
1349# Native Language Support 1538# Native Language Support
1350# 1539#
1351CONFIG_NLS=y 1540CONFIG_NLS=m
1352CONFIG_NLS_DEFAULT="iso8859-1" 1541CONFIG_NLS_DEFAULT="iso8859-1"
1353# CONFIG_NLS_CODEPAGE_437 is not set 1542CONFIG_NLS_CODEPAGE_437=m
1354# CONFIG_NLS_CODEPAGE_737 is not set 1543CONFIG_NLS_CODEPAGE_737=m
1355# CONFIG_NLS_CODEPAGE_775 is not set 1544CONFIG_NLS_CODEPAGE_775=m
1356# CONFIG_NLS_CODEPAGE_850 is not set 1545CONFIG_NLS_CODEPAGE_850=m
1357# CONFIG_NLS_CODEPAGE_852 is not set 1546CONFIG_NLS_CODEPAGE_852=m
1358# CONFIG_NLS_CODEPAGE_855 is not set 1547CONFIG_NLS_CODEPAGE_855=m
1359# CONFIG_NLS_CODEPAGE_857 is not set 1548CONFIG_NLS_CODEPAGE_857=m
1360# CONFIG_NLS_CODEPAGE_860 is not set 1549CONFIG_NLS_CODEPAGE_860=m
1361# CONFIG_NLS_CODEPAGE_861 is not set 1550CONFIG_NLS_CODEPAGE_861=m
1362# CONFIG_NLS_CODEPAGE_862 is not set 1551CONFIG_NLS_CODEPAGE_862=m
1363# CONFIG_NLS_CODEPAGE_863 is not set 1552CONFIG_NLS_CODEPAGE_863=m
1364# CONFIG_NLS_CODEPAGE_864 is not set 1553CONFIG_NLS_CODEPAGE_864=m
1365# CONFIG_NLS_CODEPAGE_865 is not set 1554CONFIG_NLS_CODEPAGE_865=m
1366# CONFIG_NLS_CODEPAGE_866 is not set 1555CONFIG_NLS_CODEPAGE_866=m
1367# CONFIG_NLS_CODEPAGE_869 is not set 1556CONFIG_NLS_CODEPAGE_869=m
1368# CONFIG_NLS_CODEPAGE_936 is not set 1557CONFIG_NLS_CODEPAGE_936=m
1369# CONFIG_NLS_CODEPAGE_950 is not set 1558CONFIG_NLS_CODEPAGE_950=m
1370# CONFIG_NLS_CODEPAGE_932 is not set 1559CONFIG_NLS_CODEPAGE_932=m
1371# CONFIG_NLS_CODEPAGE_949 is not set 1560CONFIG_NLS_CODEPAGE_949=m
1372# CONFIG_NLS_CODEPAGE_874 is not set 1561CONFIG_NLS_CODEPAGE_874=m
1373# CONFIG_NLS_ISO8859_8 is not set 1562CONFIG_NLS_ISO8859_8=m
1374# CONFIG_NLS_CODEPAGE_1250 is not set 1563CONFIG_NLS_CODEPAGE_1250=m
1375# CONFIG_NLS_CODEPAGE_1251 is not set 1564CONFIG_NLS_CODEPAGE_1251=m
1376# CONFIG_NLS_ASCII is not set 1565CONFIG_NLS_ASCII=m
1377CONFIG_NLS_ISO8859_1=m 1566CONFIG_NLS_ISO8859_1=m
1378# CONFIG_NLS_ISO8859_2 is not set 1567CONFIG_NLS_ISO8859_2=m
1379# CONFIG_NLS_ISO8859_3 is not set 1568CONFIG_NLS_ISO8859_3=m
1380# CONFIG_NLS_ISO8859_4 is not set 1569CONFIG_NLS_ISO8859_4=m
1381# CONFIG_NLS_ISO8859_5 is not set 1570CONFIG_NLS_ISO8859_5=m
1382# CONFIG_NLS_ISO8859_6 is not set 1571CONFIG_NLS_ISO8859_6=m
1383# CONFIG_NLS_ISO8859_7 is not set 1572CONFIG_NLS_ISO8859_7=m
1384# CONFIG_NLS_ISO8859_9 is not set 1573CONFIG_NLS_ISO8859_9=m
1385# CONFIG_NLS_ISO8859_13 is not set 1574CONFIG_NLS_ISO8859_13=m
1386# CONFIG_NLS_ISO8859_14 is not set 1575CONFIG_NLS_ISO8859_14=m
1387# CONFIG_NLS_ISO8859_15 is not set 1576CONFIG_NLS_ISO8859_15=m
1388# CONFIG_NLS_KOI8_R is not set 1577CONFIG_NLS_KOI8_R=m
1389# CONFIG_NLS_KOI8_U is not set 1578CONFIG_NLS_KOI8_U=m
1390# CONFIG_NLS_UTF8 is not set 1579CONFIG_NLS_UTF8=m
1391 1580
1392# 1581#
1393# Library routines 1582# Library routines
@@ -1406,7 +1595,19 @@ CONFIG_ZLIB_DEFLATE=y
1406# 1595#
1407# Kernel hacking 1596# Kernel hacking
1408# 1597#
1409# CONFIG_DEBUG_KERNEL is not set 1598# CONFIG_PRINTK_TIME is not set
1599CONFIG_DEBUG_KERNEL=y
1600CONFIG_MAGIC_SYSRQ=y
1601CONFIG_LOG_BUF_SHIFT=14
1602# CONFIG_SCHEDSTATS is not set
1603# CONFIG_DEBUG_SLAB is not set
1604# CONFIG_DEBUG_SPINLOCK is not set
1605# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1606# CONFIG_DEBUG_KOBJECT is not set
1607# CONFIG_DEBUG_INFO is not set
1608# CONFIG_DEBUG_FS is not set
1609# CONFIG_XMON is not set
1610# CONFIG_BDI_SWITCH is not set
1410CONFIG_BOOTX_TEXT=y 1611CONFIG_BOOTX_TEXT=y
1411 1612
1412# 1613#
@@ -1419,3 +1620,7 @@ CONFIG_BOOTX_TEXT=y
1419# Cryptographic options 1620# Cryptographic options
1420# 1621#
1421# CONFIG_CRYPTO is not set 1622# CONFIG_CRYPTO is not set
1623
1624#
1625# Hardware crypto devices
1626#
diff --git a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
index 8eebb0455766..a2db8b541c9b 100644
--- a/arch/ppc/configs/pmac_defconfig
+++ b/arch/ppc/configs/pmac_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.13-rc3
4# Sun Feb 13 14:56:58 2005 4# Wed Jul 13 14:13:13 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
@@ -11,6 +11,7 @@ CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y 11CONFIG_PPC=y
12CONFIG_PPC32=y 12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14 15
15# 16#
16# Code maturity level options 17# Code maturity level options
@@ -18,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
18CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
21 23
22# 24#
23# General setup 25# General setup
@@ -28,7 +30,7 @@ CONFIG_SYSVIPC=y
28CONFIG_POSIX_MQUEUE=y 30CONFIG_POSIX_MQUEUE=y
29# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y 32CONFIG_SYSCTL=y
31CONFIG_LOG_BUF_SHIFT=16 33# CONFIG_AUDIT is not set
32CONFIG_HOTPLUG=y 34CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 35CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 36CONFIG_IKCONFIG=y
@@ -37,15 +39,18 @@ CONFIG_IKCONFIG_PROC=y
37CONFIG_KALLSYMS=y 39CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set 40# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set 41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y 45CONFIG_FUTEX=y
41CONFIG_EPOLL=y 46CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y 47CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0 48CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0 49CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0 50CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0 51CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
49 54
50# 55#
51# Loadable module support 56# Loadable module support
@@ -67,12 +72,16 @@ CONFIG_6xx=y
67# CONFIG_POWER3 is not set 72# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set 73# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set 74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
70# CONFIG_E500 is not set 76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
71CONFIG_ALTIVEC=y 78CONFIG_ALTIVEC=y
72CONFIG_TAU=y 79CONFIG_TAU=y
73# CONFIG_TAU_INT is not set 80# CONFIG_TAU_INT is not set
74# CONFIG_TAU_AVERAGE is not set 81# CONFIG_TAU_AVERAGE is not set
82# CONFIG_KEXEC is not set
75CONFIG_CPU_FREQ=y 83CONFIG_CPU_FREQ=y
84CONFIG_CPU_FREQ_TABLE=y
76# CONFIG_CPU_FREQ_DEBUG is not set 85# CONFIG_CPU_FREQ_DEBUG is not set
77CONFIG_CPU_FREQ_STAT=m 86CONFIG_CPU_FREQ_STAT=m
78CONFIG_CPU_FREQ_STAT_DETAILS=y 87CONFIG_CPU_FREQ_STAT_DETAILS=y
@@ -82,8 +91,8 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
82CONFIG_CPU_FREQ_GOV_POWERSAVE=m 91CONFIG_CPU_FREQ_GOV_POWERSAVE=m
83CONFIG_CPU_FREQ_GOV_USERSPACE=m 92CONFIG_CPU_FREQ_GOV_USERSPACE=m
84CONFIG_CPU_FREQ_GOV_ONDEMAND=m 93CONFIG_CPU_FREQ_GOV_ONDEMAND=m
94CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
85CONFIG_CPU_FREQ_PMAC=y 95CONFIG_CPU_FREQ_PMAC=y
86CONFIG_CPU_FREQ_TABLE=y
87CONFIG_PPC601_SYNC_FIX=y 96CONFIG_PPC601_SYNC_FIX=y
88CONFIG_PM=y 97CONFIG_PM=y
89CONFIG_PPC_STD_MMU=y 98CONFIG_PPC_STD_MMU=y
@@ -100,6 +109,7 @@ CONFIG_PPC_MULTIPLATFORM=y
100# CONFIG_POWERPMC250 is not set 109# CONFIG_POWERPMC250 is not set
101# CONFIG_CHESTNUT is not set 110# CONFIG_CHESTNUT is not set
102# CONFIG_SPRUCE is not set 111# CONFIG_SPRUCE is not set
112# CONFIG_HDPU is not set
103# CONFIG_EV64260 is not set 113# CONFIG_EV64260 is not set
104# CONFIG_LOPEC is not set 114# CONFIG_LOPEC is not set
105# CONFIG_MCPN765 is not set 115# CONFIG_MCPN765 is not set
@@ -108,6 +118,7 @@ CONFIG_PPC_MULTIPLATFORM=y
108# CONFIG_PRPMC750 is not set 118# CONFIG_PRPMC750 is not set
109# CONFIG_PRPMC800 is not set 119# CONFIG_PRPMC800 is not set
110# CONFIG_SANDPOINT is not set 120# CONFIG_SANDPOINT is not set
121# CONFIG_RADSTONE_PPC7D is not set
111# CONFIG_ADIR is not set 122# CONFIG_ADIR is not set
112# CONFIG_K2 is not set 123# CONFIG_K2 is not set
113# CONFIG_PAL4 is not set 124# CONFIG_PAL4 is not set
@@ -120,19 +131,37 @@ CONFIG_PPC_MULTIPLATFORM=y
120# CONFIG_ADS8272 is not set 131# CONFIG_ADS8272 is not set
121# CONFIG_PQ2FADS is not set 132# CONFIG_PQ2FADS is not set
122# CONFIG_LITE5200 is not set 133# CONFIG_LITE5200 is not set
134# CONFIG_MPC834x_SYS is not set
123CONFIG_PPC_CHRP=y 135CONFIG_PPC_CHRP=y
124CONFIG_PPC_PMAC=y 136CONFIG_PPC_PMAC=y
125CONFIG_PPC_PREP=y 137CONFIG_PPC_PREP=y
126CONFIG_PPC_OF=y 138CONFIG_PPC_OF=y
127CONFIG_PPCBUG_NVRAM=y 139CONFIG_PPCBUG_NVRAM=y
128# CONFIG_SMP is not set 140# CONFIG_SMP is not set
129# CONFIG_PREEMPT is not set
130# CONFIG_HIGHMEM is not set 141# CONFIG_HIGHMEM is not set
142# CONFIG_HZ_100 is not set
143CONFIG_HZ_250=y
144# CONFIG_HZ_1000 is not set
145CONFIG_HZ=250
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
131CONFIG_BINFMT_ELF=y 155CONFIG_BINFMT_ELF=y
132CONFIG_BINFMT_MISC=m 156CONFIG_BINFMT_MISC=m
133CONFIG_PROC_DEVICETREE=y 157CONFIG_PROC_DEVICETREE=y
134# CONFIG_PREP_RESIDUAL is not set 158# CONFIG_PREP_RESIDUAL is not set
135# CONFIG_CMDLINE_BOOL is not set 159# CONFIG_CMDLINE_BOOL is not set
160# CONFIG_PM_DEBUG is not set
161CONFIG_SOFTWARE_SUSPEND=y
162CONFIG_PM_STD_PARTITION=""
163# CONFIG_SECCOMP is not set
164CONFIG_ISA_DMA_API=y
136 165
137# 166#
138# Bus options 167# Bus options
@@ -143,6 +172,7 @@ CONFIG_PCI=y
143CONFIG_PCI_DOMAINS=y 172CONFIG_PCI_DOMAINS=y
144CONFIG_PCI_LEGACY_PROC=y 173CONFIG_PCI_LEGACY_PROC=y
145CONFIG_PCI_NAMES=y 174CONFIG_PCI_NAMES=y
175# CONFIG_PCI_DEBUG is not set
146 176
147# 177#
148# PCCARD (PCMCIA/CardBus) support 178# PCCARD (PCMCIA/CardBus) support
@@ -150,6 +180,8 @@ CONFIG_PCI_NAMES=y
150CONFIG_PCCARD=m 180CONFIG_PCCARD=m
151# CONFIG_PCMCIA_DEBUG is not set 181# CONFIG_PCMCIA_DEBUG is not set
152CONFIG_PCMCIA=m 182CONFIG_PCMCIA=m
183# CONFIG_PCMCIA_LOAD_CIS is not set
184# CONFIG_PCMCIA_IOCTL is not set
153CONFIG_CARDBUS=y 185CONFIG_CARDBUS=y
154 186
155# 187#
@@ -175,6 +207,194 @@ CONFIG_TASK_SIZE=0xc0000000
175CONFIG_BOOT_LOAD=0x00800000 207CONFIG_BOOT_LOAD=0x00800000
176 208
177# 209#
210# Networking
211#
212CONFIG_NET=y
213
214#
215# Networking options
216#
217CONFIG_PACKET=y
218# CONFIG_PACKET_MMAP is not set
219CONFIG_UNIX=y
220# CONFIG_NET_KEY is not set
221CONFIG_INET=y
222CONFIG_IP_MULTICAST=y
223# CONFIG_IP_ADVANCED_ROUTER is not set
224CONFIG_IP_FIB_HASH=y
225# CONFIG_IP_PNP is not set
226# CONFIG_NET_IPIP is not set
227# CONFIG_NET_IPGRE is not set
228# CONFIG_IP_MROUTE is not set
229# CONFIG_ARPD is not set
230CONFIG_SYN_COOKIES=y
231# CONFIG_INET_AH is not set
232# CONFIG_INET_ESP is not set
233# CONFIG_INET_IPCOMP is not set
234# CONFIG_INET_TUNNEL is not set
235CONFIG_IP_TCPDIAG=y
236# CONFIG_IP_TCPDIAG_IPV6 is not set
237# CONFIG_TCP_CONG_ADVANCED is not set
238CONFIG_TCP_CONG_BIC=y
239
240#
241# IP: Virtual Server Configuration
242#
243# CONFIG_IP_VS is not set
244# CONFIG_IPV6 is not set
245CONFIG_NETFILTER=y
246# CONFIG_NETFILTER_DEBUG is not set
247
248#
249# IP: Netfilter Configuration
250#
251CONFIG_IP_NF_CONNTRACK=m
252CONFIG_IP_NF_CT_ACCT=y
253CONFIG_IP_NF_CONNTRACK_MARK=y
254CONFIG_IP_NF_CT_PROTO_SCTP=m
255CONFIG_IP_NF_FTP=m
256CONFIG_IP_NF_IRC=m
257CONFIG_IP_NF_TFTP=m
258CONFIG_IP_NF_AMANDA=m
259CONFIG_IP_NF_QUEUE=m
260CONFIG_IP_NF_IPTABLES=m
261CONFIG_IP_NF_MATCH_LIMIT=m
262CONFIG_IP_NF_MATCH_IPRANGE=m
263CONFIG_IP_NF_MATCH_MAC=m
264CONFIG_IP_NF_MATCH_PKTTYPE=m
265CONFIG_IP_NF_MATCH_MARK=m
266CONFIG_IP_NF_MATCH_MULTIPORT=m
267CONFIG_IP_NF_MATCH_TOS=m
268CONFIG_IP_NF_MATCH_RECENT=m
269CONFIG_IP_NF_MATCH_ECN=m
270CONFIG_IP_NF_MATCH_DSCP=m
271CONFIG_IP_NF_MATCH_AH_ESP=m
272CONFIG_IP_NF_MATCH_LENGTH=m
273CONFIG_IP_NF_MATCH_TTL=m
274CONFIG_IP_NF_MATCH_TCPMSS=m
275CONFIG_IP_NF_MATCH_HELPER=m
276CONFIG_IP_NF_MATCH_STATE=m
277CONFIG_IP_NF_MATCH_CONNTRACK=m
278CONFIG_IP_NF_MATCH_OWNER=m
279CONFIG_IP_NF_MATCH_ADDRTYPE=m
280CONFIG_IP_NF_MATCH_REALM=m
281CONFIG_IP_NF_MATCH_SCTP=m
282CONFIG_IP_NF_MATCH_COMMENT=m
283CONFIG_IP_NF_MATCH_CONNMARK=m
284CONFIG_IP_NF_MATCH_HASHLIMIT=m
285CONFIG_IP_NF_FILTER=m
286CONFIG_IP_NF_TARGET_REJECT=m
287CONFIG_IP_NF_TARGET_LOG=m
288CONFIG_IP_NF_TARGET_ULOG=m
289CONFIG_IP_NF_TARGET_TCPMSS=m
290CONFIG_IP_NF_NAT=m
291CONFIG_IP_NF_NAT_NEEDED=y
292CONFIG_IP_NF_TARGET_MASQUERADE=m
293CONFIG_IP_NF_TARGET_REDIRECT=m
294CONFIG_IP_NF_TARGET_NETMAP=m
295CONFIG_IP_NF_TARGET_SAME=m
296CONFIG_IP_NF_NAT_SNMP_BASIC=m
297CONFIG_IP_NF_NAT_IRC=m
298CONFIG_IP_NF_NAT_FTP=m
299CONFIG_IP_NF_NAT_TFTP=m
300CONFIG_IP_NF_NAT_AMANDA=m
301CONFIG_IP_NF_MANGLE=m
302CONFIG_IP_NF_TARGET_TOS=m
303CONFIG_IP_NF_TARGET_ECN=m
304CONFIG_IP_NF_TARGET_DSCP=m
305CONFIG_IP_NF_TARGET_MARK=m
306CONFIG_IP_NF_TARGET_CLASSIFY=m
307CONFIG_IP_NF_TARGET_CONNMARK=m
308CONFIG_IP_NF_TARGET_CLUSTERIP=m
309CONFIG_IP_NF_RAW=m
310CONFIG_IP_NF_TARGET_NOTRACK=m
311CONFIG_IP_NF_ARPTABLES=m
312CONFIG_IP_NF_ARPFILTER=m
313CONFIG_IP_NF_ARP_MANGLE=m
314
315#
316# SCTP Configuration (EXPERIMENTAL)
317#
318# CONFIG_IP_SCTP is not set
319# CONFIG_ATM is not set
320# CONFIG_BRIDGE is not set
321# CONFIG_VLAN_8021Q is not set
322# CONFIG_DECNET is not set
323# CONFIG_LLC2 is not set
324# CONFIG_IPX is not set
325# CONFIG_ATALK is not set
326# CONFIG_X25 is not set
327# CONFIG_LAPB is not set
328# CONFIG_NET_DIVERT is not set
329# CONFIG_ECONET is not set
330# CONFIG_WAN_ROUTER is not set
331# CONFIG_NET_SCHED is not set
332CONFIG_NET_CLS_ROUTE=y
333
334#
335# Network testing
336#
337# CONFIG_NET_PKTGEN is not set
338CONFIG_NETPOLL=y
339# CONFIG_NETPOLL_RX is not set
340# CONFIG_NETPOLL_TRAP is not set
341CONFIG_NET_POLL_CONTROLLER=y
342# CONFIG_HAMRADIO is not set
343CONFIG_IRDA=m
344
345#
346# IrDA protocols
347#
348CONFIG_IRLAN=m
349CONFIG_IRNET=m
350CONFIG_IRCOMM=m
351# CONFIG_IRDA_ULTRA is not set
352
353#
354# IrDA options
355#
356CONFIG_IRDA_CACHE_LAST_LSAP=y
357CONFIG_IRDA_FAST_RR=y
358# CONFIG_IRDA_DEBUG is not set
359
360#
361# Infrared-port device drivers
362#
363
364#
365# SIR device drivers
366#
367CONFIG_IRTTY_SIR=m
368
369#
370# Dongle support
371#
372# CONFIG_DONGLE is not set
373
374#
375# Old SIR device drivers
376#
377# CONFIG_IRPORT_SIR is not set
378
379#
380# Old Serial dongle support
381#
382
383#
384# FIR device drivers
385#
386# CONFIG_USB_IRDA is not set
387# CONFIG_SIGMATEL_FIR is not set
388# CONFIG_NSC_FIR is not set
389# CONFIG_WINBOND_FIR is not set
390# CONFIG_TOSHIBA_FIR is not set
391# CONFIG_SMC_IRCC_FIR is not set
392# CONFIG_ALI_FIR is not set
393# CONFIG_VLSI_FIR is not set
394# CONFIG_VIA_FIR is not set
395# CONFIG_BT is not set
396
397#
178# Device Drivers 398# Device Drivers
179# 399#
180 400
@@ -183,7 +403,7 @@ CONFIG_BOOT_LOAD=0x00800000
183# 403#
184# CONFIG_STANDALONE is not set 404# CONFIG_STANDALONE is not set
185CONFIG_PREVENT_FIRMWARE_BUILD=y 405CONFIG_PREVENT_FIRMWARE_BUILD=y
186# CONFIG_FW_LOADER is not set 406CONFIG_FW_LOADER=m
187# CONFIG_DEBUG_DRIVER is not set 407# CONFIG_DEBUG_DRIVER is not set
188 408
189# 409#
@@ -279,6 +499,7 @@ CONFIG_BLK_DEV_CMD64X=y
279# CONFIG_BLK_DEV_HPT366 is not set 499# CONFIG_BLK_DEV_HPT366 is not set
280# CONFIG_BLK_DEV_SC1200 is not set 500# CONFIG_BLK_DEV_SC1200 is not set
281# CONFIG_BLK_DEV_PIIX is not set 501# CONFIG_BLK_DEV_PIIX is not set
502# CONFIG_BLK_DEV_IT821X is not set
282# CONFIG_BLK_DEV_NS87415 is not set 503# CONFIG_BLK_DEV_NS87415 is not set
283# CONFIG_BLK_DEV_PDC202XX_OLD is not set 504# CONFIG_BLK_DEV_PDC202XX_OLD is not set
284CONFIG_BLK_DEV_PDC202XX_NEW=y 505CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -313,6 +534,7 @@ CONFIG_CHR_DEV_ST=y
313CONFIG_BLK_DEV_SR=y 534CONFIG_BLK_DEV_SR=y
314CONFIG_BLK_DEV_SR_VENDOR=y 535CONFIG_BLK_DEV_SR_VENDOR=y
315CONFIG_CHR_DEV_SG=y 536CONFIG_CHR_DEV_SG=y
537# CONFIG_CHR_DEV_SCH is not set
316 538
317# 539#
318# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 540# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -350,7 +572,6 @@ CONFIG_SCSI_AIC7XXX_OLD=m
350# CONFIG_SCSI_BUSLOGIC is not set 572# CONFIG_SCSI_BUSLOGIC is not set
351# CONFIG_SCSI_DMX3191D is not set 573# CONFIG_SCSI_DMX3191D is not set
352# CONFIG_SCSI_EATA is not set 574# CONFIG_SCSI_EATA is not set
353# CONFIG_SCSI_EATA_PIO is not set
354# CONFIG_SCSI_FUTURE_DOMAIN is not set 575# CONFIG_SCSI_FUTURE_DOMAIN is not set
355# CONFIG_SCSI_GDTH is not set 576# CONFIG_SCSI_GDTH is not set
356# CONFIG_SCSI_IPS is not set 577# CONFIG_SCSI_IPS is not set
@@ -362,7 +583,6 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
362CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 583CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
363# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 584# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
364# CONFIG_SCSI_IPR is not set 585# CONFIG_SCSI_IPR is not set
365# CONFIG_SCSI_QLOGIC_ISP is not set
366# CONFIG_SCSI_QLOGIC_FC is not set 586# CONFIG_SCSI_QLOGIC_FC is not set
367# CONFIG_SCSI_QLOGIC_1280 is not set 587# CONFIG_SCSI_QLOGIC_1280 is not set
368CONFIG_SCSI_QLA2XXX=y 588CONFIG_SCSI_QLA2XXX=y
@@ -371,6 +591,7 @@ CONFIG_SCSI_QLA2XXX=y
371# CONFIG_SCSI_QLA2300 is not set 591# CONFIG_SCSI_QLA2300 is not set
372# CONFIG_SCSI_QLA2322 is not set 592# CONFIG_SCSI_QLA2322 is not set
373# CONFIG_SCSI_QLA6312 is not set 593# CONFIG_SCSI_QLA6312 is not set
594# CONFIG_SCSI_LPFC is not set
374# CONFIG_SCSI_DC395x is not set 595# CONFIG_SCSI_DC395x is not set
375# CONFIG_SCSI_DC390T is not set 596# CONFIG_SCSI_DC390T is not set
376# CONFIG_SCSI_NSP32 is not set 597# CONFIG_SCSI_NSP32 is not set
@@ -398,6 +619,8 @@ CONFIG_SCSI_MAC53C94=y
398# Fusion MPT device support 619# Fusion MPT device support
399# 620#
400# CONFIG_FUSION is not set 621# CONFIG_FUSION is not set
622# CONFIG_FUSION_SPI is not set
623# CONFIG_FUSION_FC is not set
401 624
402# 625#
403# IEEE 1394 (FireWire) support 626# IEEE 1394 (FireWire) support
@@ -411,6 +634,7 @@ CONFIG_IEEE1394=m
411# CONFIG_IEEE1394_OUI_DB is not set 634# CONFIG_IEEE1394_OUI_DB is not set
412CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 635CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
413CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 636CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
637# CONFIG_IEEE1394_EXPORT_FULL_API is not set
414 638
415# 639#
416# Device Drivers 640# Device Drivers
@@ -441,8 +665,8 @@ CONFIG_IEEE1394_AMDTP=m
441CONFIG_ADB=y 665CONFIG_ADB=y
442CONFIG_ADB_CUDA=y 666CONFIG_ADB_CUDA=y
443CONFIG_ADB_PMU=y 667CONFIG_ADB_PMU=y
444CONFIG_PMAC_PBOOK=y
445CONFIG_PMAC_APM_EMU=y 668CONFIG_PMAC_APM_EMU=y
669CONFIG_PMAC_MEDIABAY=y
446CONFIG_PMAC_BACKLIGHT=y 670CONFIG_PMAC_BACKLIGHT=y
447CONFIG_ADB_MACIO=y 671CONFIG_ADB_MACIO=y
448CONFIG_INPUT_ADBHID=y 672CONFIG_INPUT_ADBHID=y
@@ -452,192 +676,13 @@ CONFIG_THERM_ADT746X=m
452# CONFIG_ANSLCD is not set 676# CONFIG_ANSLCD is not set
453 677
454# 678#
455# Networking support 679# Network device support
456#
457CONFIG_NET=y
458
459#
460# Networking options
461#
462CONFIG_PACKET=y
463# CONFIG_PACKET_MMAP is not set
464# CONFIG_NETLINK_DEV is not set
465CONFIG_UNIX=y
466# CONFIG_NET_KEY is not set
467CONFIG_INET=y
468CONFIG_IP_MULTICAST=y
469# CONFIG_IP_ADVANCED_ROUTER is not set
470# CONFIG_IP_PNP is not set
471# CONFIG_NET_IPIP is not set
472# CONFIG_NET_IPGRE is not set
473# CONFIG_IP_MROUTE is not set
474# CONFIG_ARPD is not set
475CONFIG_SYN_COOKIES=y
476# CONFIG_INET_AH is not set
477# CONFIG_INET_ESP is not set
478# CONFIG_INET_IPCOMP is not set
479# CONFIG_INET_TUNNEL is not set
480CONFIG_IP_TCPDIAG=y
481# CONFIG_IP_TCPDIAG_IPV6 is not set
482
483#
484# IP: Virtual Server Configuration
485#
486# CONFIG_IP_VS is not set
487# CONFIG_IPV6 is not set
488CONFIG_NETFILTER=y
489# CONFIG_NETFILTER_DEBUG is not set
490
491#
492# IP: Netfilter Configuration
493#
494CONFIG_IP_NF_CONNTRACK=m
495CONFIG_IP_NF_CT_ACCT=y
496CONFIG_IP_NF_CONNTRACK_MARK=y
497CONFIG_IP_NF_CT_PROTO_SCTP=m
498CONFIG_IP_NF_FTP=m
499CONFIG_IP_NF_IRC=m
500CONFIG_IP_NF_TFTP=m
501CONFIG_IP_NF_AMANDA=m
502CONFIG_IP_NF_QUEUE=m
503CONFIG_IP_NF_IPTABLES=m
504CONFIG_IP_NF_MATCH_LIMIT=m
505CONFIG_IP_NF_MATCH_IPRANGE=m
506CONFIG_IP_NF_MATCH_MAC=m
507CONFIG_IP_NF_MATCH_PKTTYPE=m
508CONFIG_IP_NF_MATCH_MARK=m
509CONFIG_IP_NF_MATCH_MULTIPORT=m
510CONFIG_IP_NF_MATCH_TOS=m
511CONFIG_IP_NF_MATCH_RECENT=m
512CONFIG_IP_NF_MATCH_ECN=m
513CONFIG_IP_NF_MATCH_DSCP=m
514CONFIG_IP_NF_MATCH_AH_ESP=m
515CONFIG_IP_NF_MATCH_LENGTH=m
516CONFIG_IP_NF_MATCH_TTL=m
517CONFIG_IP_NF_MATCH_TCPMSS=m
518CONFIG_IP_NF_MATCH_HELPER=m
519CONFIG_IP_NF_MATCH_STATE=m
520CONFIG_IP_NF_MATCH_CONNTRACK=m
521CONFIG_IP_NF_MATCH_OWNER=m
522CONFIG_IP_NF_MATCH_ADDRTYPE=m
523CONFIG_IP_NF_MATCH_REALM=m
524CONFIG_IP_NF_MATCH_SCTP=m
525CONFIG_IP_NF_MATCH_COMMENT=m
526CONFIG_IP_NF_MATCH_CONNMARK=m
527CONFIG_IP_NF_MATCH_HASHLIMIT=m
528CONFIG_IP_NF_FILTER=m
529CONFIG_IP_NF_TARGET_REJECT=m
530CONFIG_IP_NF_TARGET_LOG=m
531CONFIG_IP_NF_TARGET_ULOG=m
532CONFIG_IP_NF_TARGET_TCPMSS=m
533CONFIG_IP_NF_NAT=m
534CONFIG_IP_NF_NAT_NEEDED=y
535CONFIG_IP_NF_TARGET_MASQUERADE=m
536CONFIG_IP_NF_TARGET_REDIRECT=m
537CONFIG_IP_NF_TARGET_NETMAP=m
538CONFIG_IP_NF_TARGET_SAME=m
539CONFIG_IP_NF_NAT_SNMP_BASIC=m
540CONFIG_IP_NF_NAT_IRC=m
541CONFIG_IP_NF_NAT_FTP=m
542CONFIG_IP_NF_NAT_TFTP=m
543CONFIG_IP_NF_NAT_AMANDA=m
544CONFIG_IP_NF_MANGLE=m
545CONFIG_IP_NF_TARGET_TOS=m
546CONFIG_IP_NF_TARGET_ECN=m
547CONFIG_IP_NF_TARGET_DSCP=m
548CONFIG_IP_NF_TARGET_MARK=m
549CONFIG_IP_NF_TARGET_CLASSIFY=m
550CONFIG_IP_NF_TARGET_CONNMARK=m
551CONFIG_IP_NF_TARGET_CLUSTERIP=m
552CONFIG_IP_NF_RAW=m
553CONFIG_IP_NF_TARGET_NOTRACK=m
554CONFIG_IP_NF_ARPTABLES=m
555CONFIG_IP_NF_ARPFILTER=m
556CONFIG_IP_NF_ARP_MANGLE=m
557
558#
559# SCTP Configuration (EXPERIMENTAL)
560#
561# CONFIG_IP_SCTP is not set
562# CONFIG_ATM is not set
563# CONFIG_BRIDGE is not set
564# CONFIG_VLAN_8021Q is not set
565# CONFIG_DECNET is not set
566# CONFIG_LLC2 is not set
567# CONFIG_IPX is not set
568# CONFIG_ATALK is not set
569# CONFIG_X25 is not set
570# CONFIG_LAPB is not set
571# CONFIG_NET_DIVERT is not set
572# CONFIG_ECONET is not set
573# CONFIG_WAN_ROUTER is not set
574
575#
576# QoS and/or fair queueing
577#
578# CONFIG_NET_SCHED is not set
579CONFIG_NET_CLS_ROUTE=y
580
581#
582# Network testing
583#
584# CONFIG_NET_PKTGEN is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_HAMRADIO is not set
588CONFIG_IRDA=m
589
590#
591# IrDA protocols
592#
593CONFIG_IRLAN=m
594CONFIG_IRNET=m
595CONFIG_IRCOMM=m
596# CONFIG_IRDA_ULTRA is not set
597
598#
599# IrDA options
600#
601CONFIG_IRDA_CACHE_LAST_LSAP=y
602CONFIG_IRDA_FAST_RR=y
603# CONFIG_IRDA_DEBUG is not set
604
605#
606# Infrared-port device drivers
607#
608
609#
610# SIR device drivers
611#
612CONFIG_IRTTY_SIR=m
613
614#
615# Dongle support
616#
617# CONFIG_DONGLE is not set
618
619#
620# Old SIR device drivers
621#
622# CONFIG_IRPORT_SIR is not set
623
624#
625# Old Serial dongle support
626#
627
628#
629# FIR device drivers
630# 680#
631# CONFIG_USB_IRDA is not set
632# CONFIG_SIGMATEL_FIR is not set
633# CONFIG_TOSHIBA_FIR is not set
634# CONFIG_VLSI_FIR is not set
635# CONFIG_BT is not set
636CONFIG_NETDEVICES=y 681CONFIG_NETDEVICES=y
637# CONFIG_DUMMY is not set 682# CONFIG_DUMMY is not set
638# CONFIG_BONDING is not set 683# CONFIG_BONDING is not set
639# CONFIG_EQUALIZER is not set 684# CONFIG_EQUALIZER is not set
640# CONFIG_TUN is not set 685CONFIG_TUN=m
641 686
642# 687#
643# ARCnet devices 688# ARCnet devices
@@ -691,9 +736,12 @@ CONFIG_PCNET32=y
691# CONFIG_HAMACHI is not set 736# CONFIG_HAMACHI is not set
692# CONFIG_YELLOWFIN is not set 737# CONFIG_YELLOWFIN is not set
693# CONFIG_R8169 is not set 738# CONFIG_R8169 is not set
739# CONFIG_SKGE is not set
694# CONFIG_SK98LIN is not set 740# CONFIG_SK98LIN is not set
695# CONFIG_VIA_VELOCITY is not set 741# CONFIG_VIA_VELOCITY is not set
696# CONFIG_TIGON3 is not set 742# CONFIG_TIGON3 is not set
743# CONFIG_BNX2 is not set
744# CONFIG_MV643XX_ETH is not set
697 745
698# 746#
699# Ethernet (10000 Mbit) 747# Ethernet (10000 Mbit)
@@ -768,7 +816,7 @@ CONFIG_PPPOE=m
768# CONFIG_SLIP is not set 816# CONFIG_SLIP is not set
769# CONFIG_NET_FC is not set 817# CONFIG_NET_FC is not set
770# CONFIG_SHAPER is not set 818# CONFIG_SHAPER is not set
771# CONFIG_NETCONSOLE is not set 819CONFIG_NETCONSOLE=m
772 820
773# 821#
774# ISDN subsystem 822# ISDN subsystem
@@ -798,14 +846,6 @@ CONFIG_INPUT_EVDEV=y
798# CONFIG_INPUT_EVBUG is not set 846# CONFIG_INPUT_EVBUG is not set
799 847
800# 848#
801# Input I/O drivers
802#
803# CONFIG_GAMEPORT is not set
804CONFIG_SOUND_GAMEPORT=y
805# CONFIG_SERIO is not set
806# CONFIG_SERIO_I8042 is not set
807
808#
809# Input Device Drivers 849# Input Device Drivers
810# 850#
811CONFIG_INPUT_KEYBOARD=y 851CONFIG_INPUT_KEYBOARD=y
@@ -823,6 +863,12 @@ CONFIG_INPUT_MOUSE=y
823# CONFIG_INPUT_MISC is not set 863# CONFIG_INPUT_MISC is not set
824 864
825# 865#
866# Hardware I/O ports
867#
868# CONFIG_SERIO is not set
869# CONFIG_GAMEPORT is not set
870
871#
826# Character devices 872# Character devices
827# 873#
828CONFIG_VT=y 874CONFIG_VT=y
@@ -845,6 +891,7 @@ CONFIG_SERIAL_CORE=y
845CONFIG_SERIAL_CORE_CONSOLE=y 891CONFIG_SERIAL_CORE_CONSOLE=y
846CONFIG_SERIAL_PMACZILOG=y 892CONFIG_SERIAL_PMACZILOG=y
847CONFIG_SERIAL_PMACZILOG_CONSOLE=y 893CONFIG_SERIAL_PMACZILOG_CONSOLE=y
894# CONFIG_SERIAL_JSM is not set
848CONFIG_UNIX98_PTYS=y 895CONFIG_UNIX98_PTYS=y
849CONFIG_LEGACY_PTYS=y 896CONFIG_LEGACY_PTYS=y
850CONFIG_LEGACY_PTY_COUNT=256 897CONFIG_LEGACY_PTY_COUNT=256
@@ -876,6 +923,7 @@ CONFIG_DRM_R128=m
876CONFIG_DRM_RADEON=m 923CONFIG_DRM_RADEON=m
877# CONFIG_DRM_MGA is not set 924# CONFIG_DRM_MGA is not set
878# CONFIG_DRM_SIS is not set 925# CONFIG_DRM_SIS is not set
926# CONFIG_DRM_VIA is not set
879 927
880# 928#
881# PCMCIA character devices 929# PCMCIA character devices
@@ -884,6 +932,11 @@ CONFIG_DRM_RADEON=m
884# CONFIG_RAW_DRIVER is not set 932# CONFIG_RAW_DRIVER is not set
885 933
886# 934#
935# TPM devices
936#
937# CONFIG_TCG_TPM is not set
938
939#
887# I2C support 940# I2C support
888# 941#
889CONFIG_I2C=y 942CONFIG_I2C=y
@@ -907,12 +960,12 @@ CONFIG_I2C_ALGOBIT=y
907# CONFIG_I2C_HYDRA is not set 960# CONFIG_I2C_HYDRA is not set
908# CONFIG_I2C_I801 is not set 961# CONFIG_I2C_I801 is not set
909# CONFIG_I2C_I810 is not set 962# CONFIG_I2C_I810 is not set
963# CONFIG_I2C_PIIX4 is not set
910# CONFIG_I2C_ISA is not set 964# CONFIG_I2C_ISA is not set
911CONFIG_I2C_KEYWEST=m 965CONFIG_I2C_KEYWEST=m
912# CONFIG_I2C_MPC is not set 966# CONFIG_I2C_MPC is not set
913# CONFIG_I2C_NFORCE2 is not set 967# CONFIG_I2C_NFORCE2 is not set
914# CONFIG_I2C_PARPORT_LIGHT is not set 968# CONFIG_I2C_PARPORT_LIGHT is not set
915# CONFIG_I2C_PIIX4 is not set
916# CONFIG_I2C_PROSAVAGE is not set 969# CONFIG_I2C_PROSAVAGE is not set
917# CONFIG_I2C_SAVAGE4 is not set 970# CONFIG_I2C_SAVAGE4 is not set
918# CONFIG_SCx200_ACB is not set 971# CONFIG_SCx200_ACB is not set
@@ -924,45 +977,20 @@ CONFIG_I2C_KEYWEST=m
924# CONFIG_I2C_VIAPRO is not set 977# CONFIG_I2C_VIAPRO is not set
925# CONFIG_I2C_VOODOO3 is not set 978# CONFIG_I2C_VOODOO3 is not set
926# CONFIG_I2C_PCA_ISA is not set 979# CONFIG_I2C_PCA_ISA is not set
980# CONFIG_I2C_SENSOR is not set
927 981
928# 982#
929# Hardware Sensors Chip support 983# Miscellaneous I2C Chip support
930#
931# CONFIG_I2C_SENSOR is not set
932# CONFIG_SENSORS_ADM1021 is not set
933# CONFIG_SENSORS_ADM1025 is not set
934# CONFIG_SENSORS_ADM1026 is not set
935# CONFIG_SENSORS_ADM1031 is not set
936# CONFIG_SENSORS_ASB100 is not set
937# CONFIG_SENSORS_DS1621 is not set
938# CONFIG_SENSORS_FSCHER is not set
939# CONFIG_SENSORS_GL518SM is not set
940# CONFIG_SENSORS_IT87 is not set
941# CONFIG_SENSORS_LM63 is not set
942# CONFIG_SENSORS_LM75 is not set
943# CONFIG_SENSORS_LM77 is not set
944# CONFIG_SENSORS_LM78 is not set
945# CONFIG_SENSORS_LM80 is not set
946# CONFIG_SENSORS_LM83 is not set
947# CONFIG_SENSORS_LM85 is not set
948# CONFIG_SENSORS_LM87 is not set
949# CONFIG_SENSORS_LM90 is not set
950# CONFIG_SENSORS_MAX1619 is not set
951# CONFIG_SENSORS_PC87360 is not set
952# CONFIG_SENSORS_SMSC47B397 is not set
953# CONFIG_SENSORS_SMSC47M1 is not set
954# CONFIG_SENSORS_VIA686A is not set
955# CONFIG_SENSORS_W83781D is not set
956# CONFIG_SENSORS_W83L785TS is not set
957# CONFIG_SENSORS_W83627HF is not set
958
959#
960# Other I2C Chip support
961# 984#
985# CONFIG_SENSORS_DS1337 is not set
986# CONFIG_SENSORS_DS1374 is not set
962# CONFIG_SENSORS_EEPROM is not set 987# CONFIG_SENSORS_EEPROM is not set
963# CONFIG_SENSORS_PCF8574 is not set 988# CONFIG_SENSORS_PCF8574 is not set
989# CONFIG_SENSORS_PCA9539 is not set
964# CONFIG_SENSORS_PCF8591 is not set 990# CONFIG_SENSORS_PCF8591 is not set
965# CONFIG_SENSORS_RTC8564 is not set 991# CONFIG_SENSORS_RTC8564 is not set
992# CONFIG_SENSORS_M41T00 is not set
993# CONFIG_SENSORS_MAX6875 is not set
966# CONFIG_I2C_DEBUG_CORE is not set 994# CONFIG_I2C_DEBUG_CORE is not set
967# CONFIG_I2C_DEBUG_ALGO is not set 995# CONFIG_I2C_DEBUG_ALGO is not set
968# CONFIG_I2C_DEBUG_BUS is not set 996# CONFIG_I2C_DEBUG_BUS is not set
@@ -974,6 +1002,11 @@ CONFIG_I2C_KEYWEST=m
974# CONFIG_W1 is not set 1002# CONFIG_W1 is not set
975 1003
976# 1004#
1005# Hardware Monitoring support
1006#
1007# CONFIG_HWMON is not set
1008
1009#
977# Misc devices 1010# Misc devices
978# 1011#
979 1012
@@ -991,6 +1024,11 @@ CONFIG_I2C_KEYWEST=m
991# Graphics support 1024# Graphics support
992# 1025#
993CONFIG_FB=y 1026CONFIG_FB=y
1027CONFIG_FB_CFB_FILLRECT=y
1028CONFIG_FB_CFB_COPYAREA=y
1029CONFIG_FB_CFB_IMAGEBLIT=y
1030CONFIG_FB_SOFT_CURSOR=y
1031CONFIG_FB_MACMODES=y
994CONFIG_FB_MODE_HELPERS=y 1032CONFIG_FB_MODE_HELPERS=y
995CONFIG_FB_TILEBLITTING=y 1033CONFIG_FB_TILEBLITTING=y
996# CONFIG_FB_CIRRUS is not set 1034# CONFIG_FB_CIRRUS is not set
@@ -1004,6 +1042,7 @@ CONFIG_FB_CT65550=y
1004# CONFIG_FB_ASILIANT is not set 1042# CONFIG_FB_ASILIANT is not set
1005CONFIG_FB_IMSTT=y 1043CONFIG_FB_IMSTT=y
1006# CONFIG_FB_VGA16 is not set 1044# CONFIG_FB_VGA16 is not set
1045# CONFIG_FB_NVIDIA is not set
1007# CONFIG_FB_RIVA is not set 1046# CONFIG_FB_RIVA is not set
1008CONFIG_FB_MATROX=y 1047CONFIG_FB_MATROX=y
1009CONFIG_FB_MATROX_MILLENIUM=y 1048CONFIG_FB_MATROX_MILLENIUM=y
@@ -1029,6 +1068,7 @@ CONFIG_FB_3DFX=y
1029CONFIG_FB_3DFX_ACCEL=y 1068CONFIG_FB_3DFX_ACCEL=y
1030# CONFIG_FB_VOODOO1 is not set 1069# CONFIG_FB_VOODOO1 is not set
1031# CONFIG_FB_TRIDENT is not set 1070# CONFIG_FB_TRIDENT is not set
1071# CONFIG_FB_S1D13XXX is not set
1032# CONFIG_FB_VIRTUAL is not set 1072# CONFIG_FB_VIRTUAL is not set
1033 1073
1034# 1074#
@@ -1110,6 +1150,7 @@ CONFIG_SND_DUMMY=m
1110# CONFIG_SND_RME96 is not set 1150# CONFIG_SND_RME96 is not set
1111# CONFIG_SND_RME9652 is not set 1151# CONFIG_SND_RME9652 is not set
1112# CONFIG_SND_HDSP is not set 1152# CONFIG_SND_HDSP is not set
1153# CONFIG_SND_HDSPM is not set
1113# CONFIG_SND_TRIDENT is not set 1154# CONFIG_SND_TRIDENT is not set
1114# CONFIG_SND_YMFPCI is not set 1155# CONFIG_SND_YMFPCI is not set
1115# CONFIG_SND_ALS4000 is not set 1156# CONFIG_SND_ALS4000 is not set
@@ -1128,6 +1169,7 @@ CONFIG_SND_DUMMY=m
1128# CONFIG_SND_VIA82XX is not set 1169# CONFIG_SND_VIA82XX is not set
1129# CONFIG_SND_VIA82XX_MODEM is not set 1170# CONFIG_SND_VIA82XX_MODEM is not set
1130# CONFIG_SND_VX222 is not set 1171# CONFIG_SND_VX222 is not set
1172# CONFIG_SND_HDA_INTEL is not set
1131 1173
1132# 1174#
1133# ALSA PowerMac devices 1175# ALSA PowerMac devices
@@ -1152,6 +1194,8 @@ CONFIG_SND_USB_USX2Y=m
1152# 1194#
1153# USB support 1195# USB support
1154# 1196#
1197CONFIG_USB_ARCH_HAS_HCD=y
1198CONFIG_USB_ARCH_HAS_OHCI=y
1155CONFIG_USB=y 1199CONFIG_USB=y
1156# CONFIG_USB_DEBUG is not set 1200# CONFIG_USB_DEBUG is not set
1157 1201
@@ -1163,14 +1207,15 @@ CONFIG_USB_DEVICEFS=y
1163CONFIG_USB_DYNAMIC_MINORS=y 1207CONFIG_USB_DYNAMIC_MINORS=y
1164CONFIG_USB_SUSPEND=y 1208CONFIG_USB_SUSPEND=y
1165# CONFIG_USB_OTG is not set 1209# CONFIG_USB_OTG is not set
1166CONFIG_USB_ARCH_HAS_HCD=y
1167CONFIG_USB_ARCH_HAS_OHCI=y
1168 1210
1169# 1211#
1170# USB Host Controller Drivers 1212# USB Host Controller Drivers
1171# 1213#
1172# CONFIG_USB_EHCI_HCD is not set 1214# CONFIG_USB_EHCI_HCD is not set
1215# CONFIG_USB_ISP116X_HCD is not set
1173CONFIG_USB_OHCI_HCD=y 1216CONFIG_USB_OHCI_HCD=y
1217# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1218CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1174# CONFIG_USB_UHCI_HCD is not set 1219# CONFIG_USB_UHCI_HCD is not set
1175# CONFIG_USB_SL811_HCD is not set 1220# CONFIG_USB_SL811_HCD is not set
1176 1221
@@ -1197,12 +1242,15 @@ CONFIG_USB_HIDINPUT=y
1197CONFIG_USB_HIDDEV=y 1242CONFIG_USB_HIDDEV=y
1198# CONFIG_USB_AIPTEK is not set 1243# CONFIG_USB_AIPTEK is not set
1199# CONFIG_USB_WACOM is not set 1244# CONFIG_USB_WACOM is not set
1245# CONFIG_USB_ACECAD is not set
1200# CONFIG_USB_KBTAB is not set 1246# CONFIG_USB_KBTAB is not set
1201# CONFIG_USB_POWERMATE is not set 1247# CONFIG_USB_POWERMATE is not set
1202# CONFIG_USB_MTOUCH is not set 1248# CONFIG_USB_MTOUCH is not set
1249# CONFIG_USB_ITMTOUCH is not set
1203# CONFIG_USB_EGALAX is not set 1250# CONFIG_USB_EGALAX is not set
1204# CONFIG_USB_XPAD is not set 1251# CONFIG_USB_XPAD is not set
1205# CONFIG_USB_ATI_REMOTE is not set 1252# CONFIG_USB_ATI_REMOTE is not set
1253# CONFIG_USB_KEYSPAN_REMOTE is not set
1206 1254
1207# 1255#
1208# USB Imaging devices 1256# USB Imaging devices
@@ -1227,6 +1275,8 @@ CONFIG_USB_HIDDEV=y
1227CONFIG_USB_PEGASUS=m 1275CONFIG_USB_PEGASUS=m
1228# CONFIG_USB_RTL8150 is not set 1276# CONFIG_USB_RTL8150 is not set
1229# CONFIG_USB_USBNET is not set 1277# CONFIG_USB_USBNET is not set
1278# CONFIG_USB_ZD1201 is not set
1279# CONFIG_USB_MON is not set
1230 1280
1231# 1281#
1232# USB port drivers 1282# USB port drivers
@@ -1237,9 +1287,11 @@ CONFIG_USB_PEGASUS=m
1237# 1287#
1238CONFIG_USB_SERIAL=m 1288CONFIG_USB_SERIAL=m
1239# CONFIG_USB_SERIAL_GENERIC is not set 1289# CONFIG_USB_SERIAL_GENERIC is not set
1290# CONFIG_USB_SERIAL_AIRPRIME is not set
1240# CONFIG_USB_SERIAL_BELKIN is not set 1291# CONFIG_USB_SERIAL_BELKIN is not set
1241# CONFIG_USB_SERIAL_WHITEHEAT is not set 1292# CONFIG_USB_SERIAL_WHITEHEAT is not set
1242# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1293# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1294# CONFIG_USB_SERIAL_CP2101 is not set
1243# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 1295# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1244# CONFIG_USB_SERIAL_EMPEG is not set 1296# CONFIG_USB_SERIAL_EMPEG is not set
1245# CONFIG_USB_SERIAL_FTDI_SIO is not set 1297# CONFIG_USB_SERIAL_FTDI_SIO is not set
@@ -1268,10 +1320,12 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1268# CONFIG_USB_SERIAL_KOBIL_SCT is not set 1320# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1269# CONFIG_USB_SERIAL_MCT_U232 is not set 1321# CONFIG_USB_SERIAL_MCT_U232 is not set
1270# CONFIG_USB_SERIAL_PL2303 is not set 1322# CONFIG_USB_SERIAL_PL2303 is not set
1323# CONFIG_USB_SERIAL_HP4X is not set
1271# CONFIG_USB_SERIAL_SAFE is not set 1324# CONFIG_USB_SERIAL_SAFE is not set
1272# CONFIG_USB_SERIAL_TI is not set 1325# CONFIG_USB_SERIAL_TI is not set
1273# CONFIG_USB_SERIAL_CYBERJACK is not set 1326# CONFIG_USB_SERIAL_CYBERJACK is not set
1274# CONFIG_USB_SERIAL_XIRCOM is not set 1327# CONFIG_USB_SERIAL_XIRCOM is not set
1328# CONFIG_USB_SERIAL_OPTION is not set
1275# CONFIG_USB_SERIAL_OMNINET is not set 1329# CONFIG_USB_SERIAL_OMNINET is not set
1276CONFIG_USB_EZUSB=y 1330CONFIG_USB_EZUSB=y
1277 1331
@@ -1289,10 +1343,11 @@ CONFIG_USB_EZUSB=y
1289# CONFIG_USB_PHIDGETKIT is not set 1343# CONFIG_USB_PHIDGETKIT is not set
1290# CONFIG_USB_PHIDGETSERVO is not set 1344# CONFIG_USB_PHIDGETSERVO is not set
1291# CONFIG_USB_IDMOUSE is not set 1345# CONFIG_USB_IDMOUSE is not set
1346# CONFIG_USB_LD is not set
1292# CONFIG_USB_TEST is not set 1347# CONFIG_USB_TEST is not set
1293 1348
1294# 1349#
1295# USB ATM/DSL drivers 1350# USB DSL modem support
1296# 1351#
1297 1352
1298# 1353#
@@ -1311,12 +1366,17 @@ CONFIG_USB_EZUSB=y
1311# CONFIG_INFINIBAND is not set 1366# CONFIG_INFINIBAND is not set
1312 1367
1313# 1368#
1369# SN Devices
1370#
1371
1372#
1314# File systems 1373# File systems
1315# 1374#
1316CONFIG_EXT2_FS=y 1375CONFIG_EXT2_FS=y
1317CONFIG_EXT2_FS_XATTR=y 1376CONFIG_EXT2_FS_XATTR=y
1318# CONFIG_EXT2_FS_POSIX_ACL is not set 1377# CONFIG_EXT2_FS_POSIX_ACL is not set
1319# CONFIG_EXT2_FS_SECURITY is not set 1378# CONFIG_EXT2_FS_SECURITY is not set
1379# CONFIG_EXT2_FS_XIP is not set
1320CONFIG_EXT3_FS=y 1380CONFIG_EXT3_FS=y
1321CONFIG_EXT3_FS_XATTR=y 1381CONFIG_EXT3_FS_XATTR=y
1322# CONFIG_EXT3_FS_POSIX_ACL is not set 1382# CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -1326,6 +1386,7 @@ CONFIG_JBD=y
1326CONFIG_FS_MBCACHE=y 1386CONFIG_FS_MBCACHE=y
1327# CONFIG_REISERFS_FS is not set 1387# CONFIG_REISERFS_FS is not set
1328# CONFIG_JFS_FS is not set 1388# CONFIG_JFS_FS is not set
1389CONFIG_FS_POSIX_ACL=y
1329 1390
1330# 1391#
1331# XFS support 1392# XFS support
@@ -1333,6 +1394,7 @@ CONFIG_FS_MBCACHE=y
1333# CONFIG_XFS_FS is not set 1394# CONFIG_XFS_FS is not set
1334# CONFIG_MINIX_FS is not set 1395# CONFIG_MINIX_FS is not set
1335# CONFIG_ROMFS_FS is not set 1396# CONFIG_ROMFS_FS is not set
1397CONFIG_INOTIFY=y
1336# CONFIG_QUOTA is not set 1398# CONFIG_QUOTA is not set
1337CONFIG_DNOTIFY=y 1399CONFIG_DNOTIFY=y
1338# CONFIG_AUTOFS_FS is not set 1400# CONFIG_AUTOFS_FS is not set
@@ -1363,7 +1425,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1363CONFIG_PROC_FS=y 1425CONFIG_PROC_FS=y
1364CONFIG_PROC_KCORE=y 1426CONFIG_PROC_KCORE=y
1365CONFIG_SYSFS=y 1427CONFIG_SYSFS=y
1366# CONFIG_DEVFS_FS is not set
1367CONFIG_DEVPTS_FS_XATTR=y 1428CONFIG_DEVPTS_FS_XATTR=y
1368CONFIG_DEVPTS_FS_SECURITY=y 1429CONFIG_DEVPTS_FS_SECURITY=y
1369CONFIG_TMPFS=y 1430CONFIG_TMPFS=y
@@ -1394,15 +1455,20 @@ CONFIG_CRAMFS=m
1394# 1455#
1395CONFIG_NFS_FS=y 1456CONFIG_NFS_FS=y
1396CONFIG_NFS_V3=y 1457CONFIG_NFS_V3=y
1458CONFIG_NFS_V3_ACL=y
1397# CONFIG_NFS_V4 is not set 1459# CONFIG_NFS_V4 is not set
1398# CONFIG_NFS_DIRECTIO is not set 1460# CONFIG_NFS_DIRECTIO is not set
1399CONFIG_NFSD=y 1461CONFIG_NFSD=y
1462CONFIG_NFSD_V2_ACL=y
1400CONFIG_NFSD_V3=y 1463CONFIG_NFSD_V3=y
1464CONFIG_NFSD_V3_ACL=y
1401# CONFIG_NFSD_V4 is not set 1465# CONFIG_NFSD_V4 is not set
1402CONFIG_NFSD_TCP=y 1466CONFIG_NFSD_TCP=y
1403CONFIG_LOCKD=y 1467CONFIG_LOCKD=y
1404CONFIG_LOCKD_V4=y 1468CONFIG_LOCKD_V4=y
1405CONFIG_EXPORTFS=y 1469CONFIG_EXPORTFS=y
1470CONFIG_NFS_ACL_SUPPORT=y
1471CONFIG_NFS_COMMON=y
1406CONFIG_SUNRPC=y 1472CONFIG_SUNRPC=y
1407# CONFIG_RPCSEC_GSS_KRB5 is not set 1473# CONFIG_RPCSEC_GSS_KRB5 is not set
1408# CONFIG_RPCSEC_GSS_SPKM3 is not set 1474# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -1494,8 +1560,10 @@ CONFIG_ZLIB_DEFLATE=y
1494# 1560#
1495# Kernel hacking 1561# Kernel hacking
1496# 1562#
1563# CONFIG_PRINTK_TIME is not set
1497CONFIG_DEBUG_KERNEL=y 1564CONFIG_DEBUG_KERNEL=y
1498CONFIG_MAGIC_SYSRQ=y 1565CONFIG_MAGIC_SYSRQ=y
1566CONFIG_LOG_BUF_SHIFT=16
1499# CONFIG_SCHEDSTATS is not set 1567# CONFIG_SCHEDSTATS is not set
1500# CONFIG_DEBUG_SLAB is not set 1568# CONFIG_DEBUG_SLAB is not set
1501# CONFIG_DEBUG_SPINLOCK is not set 1569# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/ppc/configs/radstone_ppc7d_defconfig b/arch/ppc/configs/radstone_ppc7d_defconfig
index 7f6467e77949..ca4d1fd0ca05 100644
--- a/arch/ppc/configs/radstone_ppc7d_defconfig
+++ b/arch/ppc/configs/radstone_ppc7d_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11 3# Linux kernel version: 2.6.13-rc3
4# Tue Mar 15 14:31:19 2005 4# Tue Jul 26 00:02:09 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
@@ -11,6 +11,7 @@ CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y 11CONFIG_PPC=y
12CONFIG_PPC32=y 12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14 15
15# 16#
16# Code maturity level options 17# Code maturity level options
@@ -18,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
18CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
21 23
22# 24#
23# General setup 25# General setup
@@ -35,6 +37,8 @@ CONFIG_KOBJECT_UEVENT=y
35CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
36CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
37CONFIG_KALLSYMS_EXTRA_PASS=y 39CONFIG_KALLSYMS_EXTRA_PASS=y
40CONFIG_PRINTK=y
41CONFIG_BUG=y
38CONFIG_BASE_FULL=y 42CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 43CONFIG_FUTEX=y
40CONFIG_EPOLL=y 44CONFIG_EPOLL=y
@@ -67,9 +71,12 @@ CONFIG_6xx=y
67# CONFIG_POWER3 is not set 71# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set 72# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set 73# CONFIG_8xx is not set
74# CONFIG_E200 is not set
70# CONFIG_E500 is not set 75# CONFIG_E500 is not set
76CONFIG_PPC_FPU=y
71CONFIG_ALTIVEC=y 77CONFIG_ALTIVEC=y
72# CONFIG_TAU is not set 78# CONFIG_TAU is not set
79# CONFIG_KEXEC is not set
73# CONFIG_CPU_FREQ is not set 80# CONFIG_CPU_FREQ is not set
74CONFIG_PPC_GEN550=y 81CONFIG_PPC_GEN550=y
75# CONFIG_PM is not set 82# CONFIG_PM is not set
@@ -84,21 +91,18 @@ CONFIG_PPC_STD_MMU=y
84# CONFIG_KATANA is not set 91# CONFIG_KATANA is not set
85# CONFIG_WILLOW is not set 92# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set 93# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set 94# CONFIG_POWERPMC250 is not set
89# CONFIG_CHESTNUT is not set 95# CONFIG_CHESTNUT is not set
90# CONFIG_SPRUCE is not set 96# CONFIG_SPRUCE is not set
97# CONFIG_HDPU is not set
91# CONFIG_EV64260 is not set 98# CONFIG_EV64260 is not set
92# CONFIG_LOPEC is not set 99# CONFIG_LOPEC is not set
93# CONFIG_MCPN765 is not set
94# CONFIG_MVME5100 is not set 100# CONFIG_MVME5100 is not set
95# CONFIG_PPLUS is not set 101# CONFIG_PPLUS is not set
96# CONFIG_PRPMC750 is not set 102# CONFIG_PRPMC750 is not set
97# CONFIG_PRPMC800 is not set 103# CONFIG_PRPMC800 is not set
98# CONFIG_SANDPOINT is not set 104# CONFIG_SANDPOINT is not set
99CONFIG_RADSTONE_PPC7D=y 105CONFIG_RADSTONE_PPC7D=y
100# CONFIG_ADIR is not set
101# CONFIG_K2 is not set
102# CONFIG_PAL4 is not set 106# CONFIG_PAL4 is not set
103# CONFIG_GEMINI is not set 107# CONFIG_GEMINI is not set
104# CONFIG_EST8260 is not set 108# CONFIG_EST8260 is not set
@@ -121,10 +125,18 @@ CONFIG_MV64X60_NEW_BASE=0xfef00000
121# CONFIG_SMP is not set 125# CONFIG_SMP is not set
122# CONFIG_PREEMPT is not set 126# CONFIG_PREEMPT is not set
123# CONFIG_HIGHMEM is not set 127# CONFIG_HIGHMEM is not set
128CONFIG_SELECT_MEMORY_MODEL=y
129CONFIG_FLATMEM_MANUAL=y
130# CONFIG_DISCONTIGMEM_MANUAL is not set
131# CONFIG_SPARSEMEM_MANUAL is not set
132CONFIG_FLATMEM=y
133CONFIG_FLAT_NODE_MEM_MAP=y
124CONFIG_BINFMT_ELF=y 134CONFIG_BINFMT_ELF=y
125CONFIG_BINFMT_MISC=y 135CONFIG_BINFMT_MISC=y
126CONFIG_CMDLINE_BOOL=y 136CONFIG_CMDLINE_BOOL=y
127CONFIG_CMDLINE="console=ttyS0,9600" 137CONFIG_CMDLINE="console=ttyS0,9600"
138CONFIG_SECCOMP=y
139CONFIG_ISA_DMA_API=y
128 140
129# 141#
130# Bus options 142# Bus options
@@ -155,6 +167,69 @@ CONFIG_TASK_SIZE=0x80000000
155CONFIG_BOOT_LOAD=0x00800000 167CONFIG_BOOT_LOAD=0x00800000
156 168
157# 169#
170# Networking
171#
172CONFIG_NET=y
173
174#
175# Networking options
176#
177CONFIG_PACKET=y
178# CONFIG_PACKET_MMAP is not set
179CONFIG_UNIX=y
180# CONFIG_NET_KEY is not set
181CONFIG_INET=y
182CONFIG_IP_MULTICAST=y
183# CONFIG_IP_ADVANCED_ROUTER is not set
184CONFIG_IP_FIB_HASH=y
185CONFIG_IP_PNP=y
186CONFIG_IP_PNP_DHCP=y
187CONFIG_IP_PNP_BOOTP=y
188# CONFIG_IP_PNP_RARP is not set
189# CONFIG_NET_IPIP is not set
190# CONFIG_NET_IPGRE is not set
191# CONFIG_IP_MROUTE is not set
192# CONFIG_ARPD is not set
193CONFIG_SYN_COOKIES=y
194# CONFIG_INET_AH is not set
195# CONFIG_INET_ESP is not set
196# CONFIG_INET_IPCOMP is not set
197# CONFIG_INET_TUNNEL is not set
198CONFIG_IP_TCPDIAG=y
199# CONFIG_IP_TCPDIAG_IPV6 is not set
200# CONFIG_TCP_CONG_ADVANCED is not set
201CONFIG_TCP_CONG_BIC=y
202# CONFIG_IPV6 is not set
203# CONFIG_NETFILTER is not set
204
205#
206# SCTP Configuration (EXPERIMENTAL)
207#
208# CONFIG_IP_SCTP is not set
209# CONFIG_ATM is not set
210CONFIG_BRIDGE=y
211# CONFIG_VLAN_8021Q is not set
212# CONFIG_DECNET is not set
213# CONFIG_LLC2 is not set
214# CONFIG_IPX is not set
215# CONFIG_ATALK is not set
216# CONFIG_X25 is not set
217# CONFIG_LAPB is not set
218# CONFIG_NET_DIVERT is not set
219# CONFIG_ECONET is not set
220# CONFIG_WAN_ROUTER is not set
221# CONFIG_NET_SCHED is not set
222# CONFIG_NET_CLS_ROUTE is not set
223
224#
225# Network testing
226#
227# CONFIG_NET_PKTGEN is not set
228# CONFIG_HAMRADIO is not set
229# CONFIG_IRDA is not set
230# CONFIG_BT is not set
231
232#
158# Device Drivers 233# Device Drivers
159# 234#
160 235
@@ -203,6 +278,7 @@ CONFIG_MTD_CFI_I1=y
203CONFIG_MTD_CFI_I2=y 278CONFIG_MTD_CFI_I2=y
204# CONFIG_MTD_CFI_I4 is not set 279# CONFIG_MTD_CFI_I4 is not set
205# CONFIG_MTD_CFI_I8 is not set 280# CONFIG_MTD_CFI_I8 is not set
281# CONFIG_MTD_OTP is not set
206CONFIG_MTD_CFI_INTELEXT=y 282CONFIG_MTD_CFI_INTELEXT=y
207# CONFIG_MTD_CFI_AMDSTD is not set 283# CONFIG_MTD_CFI_AMDSTD is not set
208# CONFIG_MTD_CFI_STAA is not set 284# CONFIG_MTD_CFI_STAA is not set
@@ -210,13 +286,13 @@ CONFIG_MTD_CFI_UTIL=y
210# CONFIG_MTD_RAM is not set 286# CONFIG_MTD_RAM is not set
211# CONFIG_MTD_ROM is not set 287# CONFIG_MTD_ROM is not set
212# CONFIG_MTD_ABSENT is not set 288# CONFIG_MTD_ABSENT is not set
213# CONFIG_MTD_XIP is not set
214 289
215# 290#
216# Mapping drivers for chip access 291# Mapping drivers for chip access
217# 292#
218# CONFIG_MTD_COMPLEX_MAPPINGS is not set 293# CONFIG_MTD_COMPLEX_MAPPINGS is not set
219# CONFIG_MTD_PHYSMAP is not set 294# CONFIG_MTD_PHYSMAP is not set
295# CONFIG_MTD_PLATRAM is not set
220 296
221# 297#
222# Self-contained MTD device drivers 298# Self-contained MTD device drivers
@@ -299,6 +375,7 @@ CONFIG_BLK_DEV_SD=y
299CONFIG_BLK_DEV_SR=y 375CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y 376CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y 377CONFIG_CHR_DEV_SG=y
378# CONFIG_CHR_DEV_SCH is not set
302 379
303# 380#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 381# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -331,7 +408,6 @@ CONFIG_SCSI_SPI_ATTRS=y
331# CONFIG_SCSI_BUSLOGIC is not set 408# CONFIG_SCSI_BUSLOGIC is not set
332# CONFIG_SCSI_DMX3191D is not set 409# CONFIG_SCSI_DMX3191D is not set
333# CONFIG_SCSI_EATA is not set 410# CONFIG_SCSI_EATA is not set
334# CONFIG_SCSI_EATA_PIO is not set
335# CONFIG_SCSI_FUTURE_DOMAIN is not set 411# CONFIG_SCSI_FUTURE_DOMAIN is not set
336# CONFIG_SCSI_GDTH is not set 412# CONFIG_SCSI_GDTH is not set
337# CONFIG_SCSI_IPS is not set 413# CONFIG_SCSI_IPS is not set
@@ -343,7 +419,6 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
343CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 419CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
344# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 420# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
345# CONFIG_SCSI_IPR is not set 421# CONFIG_SCSI_IPR is not set
346# CONFIG_SCSI_QLOGIC_ISP is not set
347# CONFIG_SCSI_QLOGIC_FC is not set 422# CONFIG_SCSI_QLOGIC_FC is not set
348# CONFIG_SCSI_QLOGIC_1280 is not set 423# CONFIG_SCSI_QLOGIC_1280 is not set
349CONFIG_SCSI_QLA2XXX=y 424CONFIG_SCSI_QLA2XXX=y
@@ -352,6 +427,7 @@ CONFIG_SCSI_QLA2XXX=y
352# CONFIG_SCSI_QLA2300 is not set 427# CONFIG_SCSI_QLA2300 is not set
353# CONFIG_SCSI_QLA2322 is not set 428# CONFIG_SCSI_QLA2322 is not set
354# CONFIG_SCSI_QLA6312 is not set 429# CONFIG_SCSI_QLA6312 is not set
430# CONFIG_SCSI_LPFC is not set
355# CONFIG_SCSI_DC395x is not set 431# CONFIG_SCSI_DC395x is not set
356# CONFIG_SCSI_DC390T is not set 432# CONFIG_SCSI_DC390T is not set
357# CONFIG_SCSI_NSP32 is not set 433# CONFIG_SCSI_NSP32 is not set
@@ -366,6 +442,8 @@ CONFIG_SCSI_QLA2XXX=y
366# Fusion MPT device support 442# Fusion MPT device support
367# 443#
368# CONFIG_FUSION is not set 444# CONFIG_FUSION is not set
445# CONFIG_FUSION_SPI is not set
446# CONFIG_FUSION_FC is not set
369 447
370# 448#
371# IEEE 1394 (FireWire) support 449# IEEE 1394 (FireWire) support
@@ -382,71 +460,8 @@ CONFIG_SCSI_QLA2XXX=y
382# 460#
383 461
384# 462#
385# Networking support 463# Network device support
386# 464#
387CONFIG_NET=y
388
389#
390# Networking options
391#
392CONFIG_PACKET=y
393# CONFIG_PACKET_MMAP is not set
394# CONFIG_NETLINK_DEV is not set
395CONFIG_UNIX=y
396# CONFIG_NET_KEY is not set
397CONFIG_INET=y
398CONFIG_IP_MULTICAST=y
399# CONFIG_IP_ADVANCED_ROUTER is not set
400CONFIG_IP_PNP=y
401CONFIG_IP_PNP_DHCP=y
402CONFIG_IP_PNP_BOOTP=y
403# CONFIG_IP_PNP_RARP is not set
404# CONFIG_NET_IPIP is not set
405# CONFIG_NET_IPGRE is not set
406# CONFIG_IP_MROUTE is not set
407# CONFIG_ARPD is not set
408CONFIG_SYN_COOKIES=y
409# CONFIG_INET_AH is not set
410# CONFIG_INET_ESP is not set
411# CONFIG_INET_IPCOMP is not set
412# CONFIG_INET_TUNNEL is not set
413CONFIG_IP_TCPDIAG=y
414# CONFIG_IP_TCPDIAG_IPV6 is not set
415# CONFIG_IPV6 is not set
416# CONFIG_NETFILTER is not set
417
418#
419# SCTP Configuration (EXPERIMENTAL)
420#
421# CONFIG_IP_SCTP is not set
422# CONFIG_ATM is not set
423CONFIG_BRIDGE=y
424# CONFIG_VLAN_8021Q is not set
425# CONFIG_DECNET is not set
426# CONFIG_LLC2 is not set
427# CONFIG_IPX is not set
428# CONFIG_ATALK is not set
429# CONFIG_X25 is not set
430# CONFIG_LAPB is not set
431# CONFIG_NET_DIVERT is not set
432# CONFIG_ECONET is not set
433# CONFIG_WAN_ROUTER is not set
434
435#
436# QoS and/or fair queueing
437#
438# CONFIG_NET_SCHED is not set
439# CONFIG_NET_CLS_ROUTE is not set
440
441#
442# Network testing
443#
444# CONFIG_NET_PKTGEN is not set
445# CONFIG_NETPOLL is not set
446# CONFIG_NET_POLL_CONTROLLER is not set
447# CONFIG_HAMRADIO is not set
448# CONFIG_IRDA is not set
449# CONFIG_BT is not set
450CONFIG_NETDEVICES=y 465CONFIG_NETDEVICES=y
451# CONFIG_DUMMY is not set 466# CONFIG_DUMMY is not set
452# CONFIG_BONDING is not set 467# CONFIG_BONDING is not set
@@ -511,9 +526,11 @@ CONFIG_E100=y
511# CONFIG_YELLOWFIN is not set 526# CONFIG_YELLOWFIN is not set
512CONFIG_R8169=y 527CONFIG_R8169=y
513CONFIG_R8169_NAPI=y 528CONFIG_R8169_NAPI=y
529# CONFIG_SKGE is not set
514CONFIG_SK98LIN=y 530CONFIG_SK98LIN=y
515# CONFIG_VIA_VELOCITY is not set 531# CONFIG_VIA_VELOCITY is not set
516CONFIG_TIGON3=y 532CONFIG_TIGON3=y
533# CONFIG_BNX2 is not set
517CONFIG_MV643XX_ETH=y 534CONFIG_MV643XX_ETH=y
518CONFIG_MV643XX_ETH_0=y 535CONFIG_MV643XX_ETH_0=y
519CONFIG_MV643XX_ETH_1=y 536CONFIG_MV643XX_ETH_1=y
@@ -546,6 +563,8 @@ CONFIG_MV643XX_ETH_1=y
546# CONFIG_NET_FC is not set 563# CONFIG_NET_FC is not set
547# CONFIG_SHAPER is not set 564# CONFIG_SHAPER is not set
548# CONFIG_NETCONSOLE is not set 565# CONFIG_NETCONSOLE is not set
566# CONFIG_NETPOLL is not set
567# CONFIG_NET_POLL_CONTROLLER is not set
549 568
550# 569#
551# ISDN subsystem 570# ISDN subsystem
@@ -598,7 +617,6 @@ CONFIG_SERIO_SERPORT=y
598CONFIG_SERIO_LIBPS2=y 617CONFIG_SERIO_LIBPS2=y
599# CONFIG_SERIO_RAW is not set 618# CONFIG_SERIO_RAW is not set
600# CONFIG_GAMEPORT is not set 619# CONFIG_GAMEPORT is not set
601CONFIG_SOUND_GAMEPORT=y
602 620
603# 621#
604# Character devices 622# Character devices
@@ -623,6 +641,7 @@ CONFIG_SERIAL_MPSC=y
623# CONFIG_SERIAL_MPSC_CONSOLE is not set 641# CONFIG_SERIAL_MPSC_CONSOLE is not set
624CONFIG_SERIAL_CORE=y 642CONFIG_SERIAL_CORE=y
625CONFIG_SERIAL_CORE_CONSOLE=y 643CONFIG_SERIAL_CORE_CONSOLE=y
644# CONFIG_SERIAL_JSM is not set
626CONFIG_UNIX98_PTYS=y 645CONFIG_UNIX98_PTYS=y
627CONFIG_LEGACY_PTYS=y 646CONFIG_LEGACY_PTYS=y
628CONFIG_LEGACY_PTY_COUNT=256 647CONFIG_LEGACY_PTY_COUNT=256
@@ -690,11 +709,11 @@ CONFIG_I2C_CHARDEV=y
690# CONFIG_I2C_AMD8111 is not set 709# CONFIG_I2C_AMD8111 is not set
691# CONFIG_I2C_I801 is not set 710# CONFIG_I2C_I801 is not set
692# CONFIG_I2C_I810 is not set 711# CONFIG_I2C_I810 is not set
712# CONFIG_I2C_PIIX4 is not set
693# CONFIG_I2C_ISA is not set 713# CONFIG_I2C_ISA is not set
694# CONFIG_I2C_MPC is not set 714# CONFIG_I2C_MPC is not set
695# CONFIG_I2C_NFORCE2 is not set 715# CONFIG_I2C_NFORCE2 is not set
696# CONFIG_I2C_PARPORT_LIGHT is not set 716# CONFIG_I2C_PARPORT_LIGHT is not set
697# CONFIG_I2C_PIIX4 is not set
698# CONFIG_I2C_PROSAVAGE is not set 717# CONFIG_I2C_PROSAVAGE is not set
699# CONFIG_I2C_SAVAGE4 is not set 718# CONFIG_I2C_SAVAGE4 is not set
700# CONFIG_SCx200_ACB is not set 719# CONFIG_SCx200_ACB is not set
@@ -707,16 +726,41 @@ CONFIG_I2C_CHARDEV=y
707# CONFIG_I2C_VOODOO3 is not set 726# CONFIG_I2C_VOODOO3 is not set
708# CONFIG_I2C_PCA_ISA is not set 727# CONFIG_I2C_PCA_ISA is not set
709CONFIG_I2C_MV64XXX=y 728CONFIG_I2C_MV64XXX=y
729CONFIG_I2C_SENSOR=y
710 730
711# 731#
712# Hardware Sensors Chip support 732# Miscellaneous I2C Chip support
713# 733#
714CONFIG_I2C_SENSOR=y 734CONFIG_SENSORS_DS1337=y
735# CONFIG_SENSORS_DS1374 is not set
736# CONFIG_SENSORS_EEPROM is not set
737# CONFIG_SENSORS_PCF8574 is not set
738# CONFIG_SENSORS_PCA9539 is not set
739# CONFIG_SENSORS_PCF8591 is not set
740# CONFIG_SENSORS_RTC8564 is not set
741# CONFIG_SENSORS_M41T00 is not set
742# CONFIG_SENSORS_MAX6875 is not set
743# CONFIG_I2C_DEBUG_CORE is not set
744# CONFIG_I2C_DEBUG_ALGO is not set
745# CONFIG_I2C_DEBUG_BUS is not set
746# CONFIG_I2C_DEBUG_CHIP is not set
747
748#
749# Dallas's 1-wire bus
750#
751# CONFIG_W1 is not set
752
753#
754# Hardware Monitoring support
755#
756CONFIG_HWMON=y
715# CONFIG_SENSORS_ADM1021 is not set 757# CONFIG_SENSORS_ADM1021 is not set
716# CONFIG_SENSORS_ADM1025 is not set 758# CONFIG_SENSORS_ADM1025 is not set
717# CONFIG_SENSORS_ADM1026 is not set 759# CONFIG_SENSORS_ADM1026 is not set
718# CONFIG_SENSORS_ADM1031 is not set 760# CONFIG_SENSORS_ADM1031 is not set
761# CONFIG_SENSORS_ADM9240 is not set
719# CONFIG_SENSORS_ASB100 is not set 762# CONFIG_SENSORS_ASB100 is not set
763# CONFIG_SENSORS_ATXP1 is not set
720# CONFIG_SENSORS_DS1621 is not set 764# CONFIG_SENSORS_DS1621 is not set
721# CONFIG_SENSORS_FSCHER is not set 765# CONFIG_SENSORS_FSCHER is not set
722# CONFIG_SENSORS_FSCPOS is not set 766# CONFIG_SENSORS_FSCPOS is not set
@@ -732,33 +776,18 @@ CONFIG_I2C_SENSOR=y
732# CONFIG_SENSORS_LM85 is not set 776# CONFIG_SENSORS_LM85 is not set
733# CONFIG_SENSORS_LM87 is not set 777# CONFIG_SENSORS_LM87 is not set
734CONFIG_SENSORS_LM90=y 778CONFIG_SENSORS_LM90=y
779# CONFIG_SENSORS_LM92 is not set
735# CONFIG_SENSORS_MAX1619 is not set 780# CONFIG_SENSORS_MAX1619 is not set
736# CONFIG_SENSORS_PC87360 is not set 781# CONFIG_SENSORS_PC87360 is not set
737# CONFIG_SENSORS_SMSC47B397 is not set
738# CONFIG_SENSORS_SIS5595 is not set 782# CONFIG_SENSORS_SIS5595 is not set
739# CONFIG_SENSORS_SMSC47M1 is not set 783# CONFIG_SENSORS_SMSC47M1 is not set
784# CONFIG_SENSORS_SMSC47B397 is not set
740# CONFIG_SENSORS_VIA686A is not set 785# CONFIG_SENSORS_VIA686A is not set
741# CONFIG_SENSORS_W83781D is not set 786# CONFIG_SENSORS_W83781D is not set
742# CONFIG_SENSORS_W83L785TS is not set 787# CONFIG_SENSORS_W83L785TS is not set
743# CONFIG_SENSORS_W83627HF is not set 788# CONFIG_SENSORS_W83627HF is not set
744 789# CONFIG_SENSORS_W83627EHF is not set
745# 790# CONFIG_HWMON_DEBUG_CHIP is not set
746# Other I2C Chip support
747#
748# CONFIG_SENSORS_EEPROM is not set
749# CONFIG_SENSORS_PCF8574 is not set
750# CONFIG_SENSORS_PCF8591 is not set
751# CONFIG_SENSORS_RTC8564 is not set
752# CONFIG_SENSORS_M41T00 is not set
753# CONFIG_I2C_DEBUG_CORE is not set
754# CONFIG_I2C_DEBUG_ALGO is not set
755# CONFIG_I2C_DEBUG_BUS is not set
756# CONFIG_I2C_DEBUG_CHIP is not set
757
758#
759# Dallas's 1-wire bus
760#
761# CONFIG_W1 is not set
762 791
763# 792#
764# Misc devices 793# Misc devices
@@ -813,14 +842,20 @@ CONFIG_USB_ARCH_HAS_OHCI=y
813# CONFIG_INFINIBAND is not set 842# CONFIG_INFINIBAND is not set
814 843
815# 844#
845# SN Devices
846#
847
848#
816# File systems 849# File systems
817# 850#
818CONFIG_EXT2_FS=y 851CONFIG_EXT2_FS=y
819# CONFIG_EXT2_FS_XATTR is not set 852# CONFIG_EXT2_FS_XATTR is not set
853# CONFIG_EXT2_FS_XIP is not set
820# CONFIG_EXT3_FS is not set 854# CONFIG_EXT3_FS is not set
821# CONFIG_JBD is not set 855# CONFIG_JBD is not set
822# CONFIG_REISERFS_FS is not set 856# CONFIG_REISERFS_FS is not set
823# CONFIG_JFS_FS is not set 857# CONFIG_JFS_FS is not set
858# CONFIG_FS_POSIX_ACL is not set
824 859
825# 860#
826# XFS support 861# XFS support
@@ -828,6 +863,7 @@ CONFIG_EXT2_FS=y
828# CONFIG_XFS_FS is not set 863# CONFIG_XFS_FS is not set
829# CONFIG_MINIX_FS is not set 864# CONFIG_MINIX_FS is not set
830# CONFIG_ROMFS_FS is not set 865# CONFIG_ROMFS_FS is not set
866CONFIG_INOTIFY=y
831# CONFIG_QUOTA is not set 867# CONFIG_QUOTA is not set
832CONFIG_DNOTIFY=y 868CONFIG_DNOTIFY=y
833# CONFIG_AUTOFS_FS is not set 869# CONFIG_AUTOFS_FS is not set
@@ -854,7 +890,6 @@ CONFIG_ISO9660_FS=y
854CONFIG_PROC_FS=y 890CONFIG_PROC_FS=y
855CONFIG_PROC_KCORE=y 891CONFIG_PROC_KCORE=y
856CONFIG_SYSFS=y 892CONFIG_SYSFS=y
857# CONFIG_DEVFS_FS is not set
858# CONFIG_DEVPTS_FS_XATTR is not set 893# CONFIG_DEVPTS_FS_XATTR is not set
859CONFIG_TMPFS=y 894CONFIG_TMPFS=y
860# CONFIG_TMPFS_XATTR is not set 895# CONFIG_TMPFS_XATTR is not set
@@ -874,8 +909,7 @@ CONFIG_RAMFS=y
874# CONFIG_JFFS_FS is not set 909# CONFIG_JFFS_FS is not set
875CONFIG_JFFS2_FS=y 910CONFIG_JFFS2_FS=y
876CONFIG_JFFS2_FS_DEBUG=0 911CONFIG_JFFS2_FS_DEBUG=0
877# CONFIG_JFFS2_FS_NAND is not set 912CONFIG_JFFS2_FS_WRITEBUFFER=y
878# CONFIG_JFFS2_FS_NOR_ECC is not set
879# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 913# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
880CONFIG_JFFS2_ZLIB=y 914CONFIG_JFFS2_ZLIB=y
881CONFIG_JFFS2_RTIME=y 915CONFIG_JFFS2_RTIME=y
@@ -892,12 +926,14 @@ CONFIG_JFFS2_RTIME=y
892# 926#
893CONFIG_NFS_FS=y 927CONFIG_NFS_FS=y
894CONFIG_NFS_V3=y 928CONFIG_NFS_V3=y
929# CONFIG_NFS_V3_ACL is not set
895# CONFIG_NFS_V4 is not set 930# CONFIG_NFS_V4 is not set
896# CONFIG_NFS_DIRECTIO is not set 931# CONFIG_NFS_DIRECTIO is not set
897# CONFIG_NFSD is not set 932# CONFIG_NFSD is not set
898CONFIG_ROOT_NFS=y 933CONFIG_ROOT_NFS=y
899CONFIG_LOCKD=y 934CONFIG_LOCKD=y
900CONFIG_LOCKD_V4=y 935CONFIG_LOCKD_V4=y
936CONFIG_NFS_COMMON=y
901CONFIG_SUNRPC=y 937CONFIG_SUNRPC=y
902# CONFIG_RPCSEC_GSS_KRB5 is not set 938# CONFIG_RPCSEC_GSS_KRB5 is not set
903# CONFIG_RPCSEC_GSS_SPKM3 is not set 939# CONFIG_RPCSEC_GSS_SPKM3 is not set
diff --git a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig
index 0f4393a07f82..fb493a67c60d 100644
--- a/arch/ppc/configs/sandpoint_defconfig
+++ b/arch/ppc/configs/sandpoint_defconfig
@@ -437,7 +437,7 @@ CONFIG_SOUND_GAMEPORT=y
437# 437#
438CONFIG_SERIAL_8250=y 438CONFIG_SERIAL_8250=y
439CONFIG_SERIAL_8250_CONSOLE=y 439CONFIG_SERIAL_8250_CONSOLE=y
440CONFIG_SERIAL_8250_NR_UARTS=2 440CONFIG_SERIAL_8250_NR_UARTS=4
441# CONFIG_SERIAL_8250_EXTENDED is not set 441# CONFIG_SERIAL_8250_EXTENDED is not set
442 442
443# 443#
diff --git a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
index 50936cda0af9..8a3d74f2531e 100644
--- a/arch/ppc/kernel/cputable.c
+++ b/arch/ppc/kernel/cputable.c
@@ -852,6 +852,26 @@ struct cpu_spec cpu_specs[] = {
852 852
853#endif /* CONFIG_40x */ 853#endif /* CONFIG_40x */
854#ifdef CONFIG_44x 854#ifdef CONFIG_44x
855 {
856 .pvr_mask = 0xf0000fff,
857 .pvr_value = 0x40000850,
858 .cpu_name = "440EP Rev. A",
859 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
860 CPU_FTR_USE_TB,
861 .cpu_user_features = COMMON_PPC, /* 440EP has an FPU */
862 .icache_bsize = 32,
863 .dcache_bsize = 32,
864 },
865 {
866 .pvr_mask = 0xf0000fff,
867 .pvr_value = 0x400008d3,
868 .cpu_name = "440EP Rev. B",
869 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
870 CPU_FTR_USE_TB,
871 .cpu_user_features = COMMON_PPC, /* 440EP has an FPU */
872 .icache_bsize = 32,
873 .dcache_bsize = 32,
874 },
855 { /* 440GP Rev. B */ 875 { /* 440GP Rev. B */
856 .pvr_mask = 0xf0000fff, 876 .pvr_mask = 0xf0000fff,
857 .pvr_value = 0x40000440, 877 .pvr_value = 0x40000440,
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index d4df68629cc6..cb83045e2edf 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -215,6 +215,7 @@ syscall_dotrace_cont:
215 lwzx r10,r10,r0 /* Fetch system call handler [ptr] */ 215 lwzx r10,r10,r0 /* Fetch system call handler [ptr] */
216 mtlr r10 216 mtlr r10
217 addi r9,r1,STACK_FRAME_OVERHEAD 217 addi r9,r1,STACK_FRAME_OVERHEAD
218 PPC440EP_ERR42
218 blrl /* Call handler */ 219 blrl /* Call handler */
219 .globl ret_from_syscall 220 .globl ret_from_syscall
220ret_from_syscall: 221ret_from_syscall:
diff --git a/arch/ppc/kernel/head_44x.S b/arch/ppc/kernel/head_44x.S
index 6c7ae6052464..69ff3a9961e8 100644
--- a/arch/ppc/kernel/head_44x.S
+++ b/arch/ppc/kernel/head_44x.S
@@ -179,24 +179,26 @@ skpinv: addi r4,r4,1 /* Increment */
1794: 1794:
180#ifdef CONFIG_SERIAL_TEXT_DEBUG 180#ifdef CONFIG_SERIAL_TEXT_DEBUG
181 /* 181 /*
182 * Add temporary UART mapping for early debug. This 182 * Add temporary UART mapping for early debug.
183 * mapping must be identical to that used by the early 183 * We can map UART registers wherever we want as long as they don't
184 * bootloader code since the same asm/serial.h parameters 184 * interfere with other system mappings (e.g. with pinned entries).
185 * are used for polled operation. 185 * For an example of how we handle this - see ocotea.h. --ebs
186 */ 186 */
187 /* pageid fields */ 187 /* pageid fields */
188 lis r3,UART0_IO_BASE@h 188 lis r3,UART0_IO_BASE@h
189 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M 189 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_4K
190 190
191 /* xlat fields */ 191 /* xlat fields */
192 lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */ 192 lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */
193#ifndef CONFIG_440EP
193 ori r4,r4,0x0001 /* ERPN is 1 for second 4GB page */ 194 ori r4,r4,0x0001 /* ERPN is 1 for second 4GB page */
195#endif
194 196
195 /* attrib fields */ 197 /* attrib fields */
196 li r5,0 198 li r5,0
197 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) 199 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G)
198 200
199 li r0,1 /* TLB slot 1 */ 201 li r0,0 /* TLB slot 0 */
200 202
201 tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ 203 tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */
202 tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */ 204 tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */
@@ -228,6 +230,16 @@ skpinv: addi r4,r4,1 /* Increment */
228 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */ 230 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
229 mtspr SPRN_IVPR,r4 231 mtspr SPRN_IVPR,r4
230 232
233#ifdef CONFIG_440EP
234 /* Clear DAPUIB flag in CCR0 (enable APU between CPU and FPU) */
235 mfspr r2,SPRN_CCR0
236 lis r3,0xffef
237 ori r3,r3,0xffff
238 and r2,r2,r3
239 mtspr SPRN_CCR0,r2
240 isync
241#endif
242
231 /* 243 /*
232 * This is where the main kernel code starts. 244 * This is where the main kernel code starts.
233 */ 245 */
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index 5a7a64e91fc5..eb18cadb3755 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -288,13 +288,11 @@ SystemCall:
288 * For the MPC8xx, this is a software tablewalk to load the instruction 288 * For the MPC8xx, this is a software tablewalk to load the instruction
289 * TLB. It is modelled after the example in the Motorola manual. The task 289 * TLB. It is modelled after the example in the Motorola manual. The task
290 * switch loads the M_TWB register with the pointer to the first level table. 290 * switch loads the M_TWB register with the pointer to the first level table.
291 * If we discover there is no second level table (the value is zero), the 291 * If we discover there is no second level table (value is zero) or if there
292 * plan was to load that into the TLB, which causes another fault into the 292 * is an invalid pte, we load that into the TLB, which causes another fault
293 * TLB Error interrupt where we can handle such problems. However, that did 293 * into the TLB Error interrupt where we can handle such problems.
294 * not work, so if we discover there is no second level table, we restore 294 * We have to use the MD_xxx registers for the tablewalk because the
295 * registers and branch to the error exception. We have to use the MD_xxx 295 * equivalent MI_xxx registers only perform the attribute functions.
296 * registers for the tablewalk because the equivalent MI_xxx registers
297 * only perform the attribute functions.
298 */ 296 */
299InstructionTLBMiss: 297InstructionTLBMiss:
300#ifdef CONFIG_8xx_CPU6 298#ifdef CONFIG_8xx_CPU6
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 191a8def3bdb..ce71b4a01585 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -1145,6 +1145,7 @@ _GLOBAL(kernel_thread)
1145 stwu r0,-16(r1) 1145 stwu r0,-16(r1)
1146 mtlr r30 /* fn addr in lr */ 1146 mtlr r30 /* fn addr in lr */
1147 mr r3,r31 /* load arg and call fn */ 1147 mr r3,r31 /* load arg and call fn */
1148 PPC440EP_ERR42
1148 blrl 1149 blrl
1149 li r0,__NR_exit /* exit if function returns */ 1150 li r0,__NR_exit /* exit if function returns */
1150 li r3,0 1151 li r3,0
@@ -1451,3 +1452,6 @@ _GLOBAL(sys_call_table)
1451 .long sys_waitid 1452 .long sys_waitid
1452 .long sys_ioprio_set 1453 .long sys_ioprio_set
1453 .long sys_ioprio_get 1454 .long sys_ioprio_get
1455 .long sys_inotify_init /* 275 */
1456 .long sys_inotify_add_watch
1457 .long sys_inotify_rm_watch
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 70cfb6ffd877..7b3586a3bf30 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -160,6 +160,21 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
160} 160}
161EXPORT_SYMBOL(pcibios_resource_to_bus); 161EXPORT_SYMBOL(pcibios_resource_to_bus);
162 162
163void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
164 struct pci_bus_region *region)
165{
166 unsigned long offset = 0;
167 struct pci_controller *hose = dev->sysdata;
168
169 if (hose && res->flags & IORESOURCE_IO)
170 offset = (unsigned long)hose->io_base_virt - isa_io_base;
171 else if (hose && res->flags & IORESOURCE_MEM)
172 offset = hose->pci_mem_offset;
173 res->start = region->start + offset;
174 res->end = region->end + offset;
175}
176EXPORT_SYMBOL(pcibios_bus_to_resource);
177
163/* 178/*
164 * We need to avoid collisions with `mirrored' VGA ports 179 * We need to avoid collisions with `mirrored' VGA ports
165 * and other strange ISA hardware, so we always want the 180 * and other strange ISA hardware, so we always want the
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index d59ad07de8e7..e7d40cc6c1b6 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -324,7 +324,7 @@ EXPORT_SYMBOL(__res);
324 324
325EXPORT_SYMBOL(next_mmu_context); 325EXPORT_SYMBOL(next_mmu_context);
326EXPORT_SYMBOL(set_context); 326EXPORT_SYMBOL(set_context);
327EXPORT_SYMBOL(handle_mm_fault); /* For MOL */ 327EXPORT_SYMBOL_GPL(__handle_mm_fault); /* For MOL */
328EXPORT_SYMBOL(disarm_decr); 328EXPORT_SYMBOL(disarm_decr);
329#ifdef CONFIG_PPC_STD_MMU 329#ifdef CONFIG_PPC_STD_MMU
330extern long mol_trampoline; 330extern long mol_trampoline;
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 6164a2b34733..33ada72c7330 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -562,6 +562,9 @@ void flush_dcache_icache_page(struct page *page)
562#ifdef CONFIG_BOOKE 562#ifdef CONFIG_BOOKE
563 __flush_dcache_icache(kmap(page)); 563 __flush_dcache_icache(kmap(page));
564 kunmap(page); 564 kunmap(page);
565#elif CONFIG_8xx
566 /* On 8xx there is no need to kmap since highmem is not supported */
567 __flush_dcache_icache(page_address(page));
565#else 568#else
566 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT); 569 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
567#endif 570#endif
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
index a0612a86455a..f7c045764e04 100644
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -68,6 +68,11 @@ choice
68 depends on 44x 68 depends on 44x
69 default EBONY 69 default EBONY
70 70
71config BAMBOO
72 bool "Bamboo"
73 help
74 This option enables support for the IBM PPC440EP evaluation board.
75
71config EBONY 76config EBONY
72 bool "Ebony" 77 bool "Ebony"
73 help 78 help
@@ -98,6 +103,12 @@ config NP405H
98 depends on ASH 103 depends on ASH
99 default y 104 default y
100 105
106config 440EP
107 bool
108 depends on BAMBOO
109 select PPC_FPU
110 default y
111
101config 440GP 112config 440GP
102 bool 113 bool
103 depends on EBONY 114 depends on EBONY
@@ -115,7 +126,7 @@ config 440SP
115 126
116config 440 127config 440
117 bool 128 bool
118 depends on 440GP || 440SP 129 depends on 440GP || 440SP || 440EP
119 default y 130 default y
120 131
121config 440A 132config 440A
@@ -123,6 +134,11 @@ config 440A
123 depends on 440GX 134 depends on 440GX
124 default y 135 default y
125 136
137config IBM440EP_ERR42
138 bool
139 depends on 440EP
140 default y
141
126# All 405-based cores up until the 405GPR and 405EP have this errata. 142# All 405-based cores up until the 405GPR and 405EP have this errata.
127config IBM405_ERR77 143config IBM405_ERR77
128 bool 144 bool
@@ -142,7 +158,7 @@ config BOOKE
142 158
143config IBM_OCP 159config IBM_OCP
144 bool 160 bool
145 depends on ASH || BUBINGA || CPCI405 || EBONY || EP405 || LUAN || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT 161 depends on ASH || BAMBOO || BUBINGA || CPCI405 || EBONY || EP405 || LUAN || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
146 default y 162 default y
147 163
148config XILINX_OCP 164config XILINX_OCP
diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile
index ea470c6adbb6..844c3b5066e8 100644
--- a/arch/ppc/platforms/4xx/Makefile
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -2,6 +2,7 @@
2# Makefile for the PowerPC 4xx linux kernel. 2# Makefile for the PowerPC 4xx linux kernel.
3 3
4obj-$(CONFIG_ASH) += ash.o 4obj-$(CONFIG_ASH) += ash.o
5obj-$(CONFIG_BAMBOO) += bamboo.o
5obj-$(CONFIG_CPCI405) += cpci405.o 6obj-$(CONFIG_CPCI405) += cpci405.o
6obj-$(CONFIG_EBONY) += ebony.o 7obj-$(CONFIG_EBONY) += ebony.o
7obj-$(CONFIG_EP405) += ep405.o 8obj-$(CONFIG_EP405) += ep405.o
@@ -19,6 +20,7 @@ obj-$(CONFIG_405GP) += ibm405gp.o
19obj-$(CONFIG_REDWOOD_5) += ibmstb4.o 20obj-$(CONFIG_REDWOOD_5) += ibmstb4.o
20obj-$(CONFIG_NP405H) += ibmnp405h.o 21obj-$(CONFIG_NP405H) += ibmnp405h.o
21obj-$(CONFIG_REDWOOD_6) += ibmstbx25.o 22obj-$(CONFIG_REDWOOD_6) += ibmstbx25.o
23obj-$(CONFIG_440EP) += ibm440ep.o
22obj-$(CONFIG_440GP) += ibm440gp.o 24obj-$(CONFIG_440GP) += ibm440gp.o
23obj-$(CONFIG_440GX) += ibm440gx.o 25obj-$(CONFIG_440GX) += ibm440gx.o
24obj-$(CONFIG_440SP) += ibm440sp.o 26obj-$(CONFIG_440SP) += ibm440sp.o
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
new file mode 100644
index 000000000000..f116787b0b76
--- /dev/null
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -0,0 +1,427 @@
1/*
2 * arch/ppc/platforms/4xx/bamboo.c
3 *
4 * Bamboo board specific routines
5 *
6 * Wade Farnsworth <wfarnsworth@mvista.com>
7 * Copyright 2004 MontaVista Software Inc.
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
15#include <linux/config.h>
16#include <linux/stddef.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/reboot.h>
21#include <linux/pci.h>
22#include <linux/kdev_t.h>
23#include <linux/types.h>
24#include <linux/major.h>
25#include <linux/blkdev.h>
26#include <linux/console.h>
27#include <linux/delay.h>
28#include <linux/ide.h>
29#include <linux/initrd.h>
30#include <linux/irq.h>
31#include <linux/seq_file.h>
32#include <linux/root_dev.h>
33#include <linux/tty.h>
34#include <linux/serial.h>
35#include <linux/serial_core.h>
36#include <linux/ethtool.h>
37
38#include <asm/system.h>
39#include <asm/pgtable.h>
40#include <asm/page.h>
41#include <asm/dma.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/ocp.h>
45#include <asm/pci-bridge.h>
46#include <asm/time.h>
47#include <asm/todc.h>
48#include <asm/bootinfo.h>
49#include <asm/ppc4xx_pic.h>
50#include <asm/ppcboot.h>
51
52#include <syslib/gen550.h>
53#include <syslib/ibm440gx_common.h>
54
55/*
56 * This is a horrible kludge, we eventually need to abstract this
57 * generic PHY stuff, so the standard phy mode defines can be
58 * easily used from arch code.
59 */
60#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
61
62bd_t __res;
63
64static struct ibm44x_clocks clocks __initdata;
65
66/*
67 * Bamboo external IRQ triggering/polarity settings
68 */
69unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ0: Ethernet transceiver */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ1: Expansion connector */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ2: PCI slot 0 */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ3: PCI slot 1 */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ4: PCI slot 2 */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ5: PCI slot 3 */
76 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE), /* IRQ6: SMI pushbutton */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ7: EXT */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ8: EXT */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ9: EXT */
80};
81
82static void __init
83bamboo_calibrate_decr(void)
84{
85 unsigned int freq;
86
87 if (mfspr(SPRN_CCR1) & CCR1_TCS)
88 freq = BAMBOO_TMRCLK;
89 else
90 freq = clocks.cpu;
91
92 ibm44x_calibrate_decr(freq);
93
94}
95
96static int
97bamboo_show_cpuinfo(struct seq_file *m)
98{
99 seq_printf(m, "vendor\t\t: IBM\n");
100 seq_printf(m, "machine\t\t: PPC440EP EVB (Bamboo)\n");
101
102 return 0;
103}
104
105static inline int
106bamboo_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
107{
108 static char pci_irq_table[][4] =
109 /*
110 * PCI IDSEL/INTPIN->INTLINE
111 * A B C D
112 */
113 {
114 { 28, 28, 28, 28 }, /* IDSEL 1 - PCI Slot 0 */
115 { 27, 27, 27, 27 }, /* IDSEL 2 - PCI Slot 1 */
116 { 26, 26, 26, 26 }, /* IDSEL 3 - PCI Slot 2 */
117 { 25, 25, 25, 25 }, /* IDSEL 4 - PCI Slot 3 */
118 };
119
120 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
121 return PCI_IRQ_TABLE_LOOKUP;
122}
123
124static void __init bamboo_set_emacdata(void)
125{
126 unsigned char * selection1_base;
127 struct ocp_def *def;
128 struct ocp_func_emac_data *emacdata;
129 u8 selection1_val;
130 int mode;
131
132 selection1_base = ioremap64(BAMBOO_FPGA_SELECTION1_REG_ADDR, 16);
133 selection1_val = readb(selection1_base);
134 iounmap((void *) selection1_base);
135 if (BAMBOO_SEL_MII(selection1_val))
136 mode = PHY_MODE_MII;
137 else if (BAMBOO_SEL_RMII(selection1_val))
138 mode = PHY_MODE_RMII;
139 else
140 mode = PHY_MODE_SMII;
141
142 /* Set mac_addr and phy mode for each EMAC */
143
144 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
145 emacdata = def->additions;
146 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
147 emacdata->phy_mode = mode;
148
149 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
150 emacdata = def->additions;
151 memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
152 emacdata->phy_mode = mode;
153}
154
155static int
156bamboo_exclude_device(unsigned char bus, unsigned char devfn)
157{
158 return (bus == 0 && devfn == 0);
159}
160
161#define PCI_READW(offset) \
162 (readw((void *)((u32)pci_reg_base+offset)))
163
164#define PCI_WRITEW(value, offset) \
165 (writew(value, (void *)((u32)pci_reg_base+offset)))
166
167#define PCI_WRITEL(value, offset) \
168 (writel(value, (void *)((u32)pci_reg_base+offset)))
169
170static void __init
171bamboo_setup_pci(void)
172{
173 void *pci_reg_base;
174 unsigned long memory_size;
175 memory_size = ppc_md.find_end_of_memory();
176
177 pci_reg_base = ioremap64(BAMBOO_PCIL0_BASE, BAMBOO_PCIL0_SIZE);
178
179 /* Enable PCI I/O, Mem, and Busmaster cycles */
180 PCI_WRITEW(PCI_READW(PCI_COMMAND) |
181 PCI_COMMAND_MEMORY |
182 PCI_COMMAND_MASTER, PCI_COMMAND);
183
184 /* Disable region first */
185 PCI_WRITEL(0, BAMBOO_PCIL0_PMM0MA);
186
187 /* PLB starting addr: 0x00000000A0000000 */
188 PCI_WRITEL(BAMBOO_PCI_PHY_MEM_BASE, BAMBOO_PCIL0_PMM0LA);
189
190 /* PCI start addr, 0xA0000000 (PCI Address) */
191 PCI_WRITEL(BAMBOO_PCI_MEM_BASE, BAMBOO_PCIL0_PMM0PCILA);
192 PCI_WRITEL(0, BAMBOO_PCIL0_PMM0PCIHA);
193
194 /* Enable no pre-fetch, enable region */
195 PCI_WRITEL(((0xffffffff -
196 (BAMBOO_PCI_UPPER_MEM - BAMBOO_PCI_MEM_BASE)) | 0x01),
197 BAMBOO_PCIL0_PMM0MA);
198
199 /* Disable region one */
200 PCI_WRITEL(0, BAMBOO_PCIL0_PMM1MA);
201 PCI_WRITEL(0, BAMBOO_PCIL0_PMM1LA);
202 PCI_WRITEL(0, BAMBOO_PCIL0_PMM1PCILA);
203 PCI_WRITEL(0, BAMBOO_PCIL0_PMM1PCIHA);
204 PCI_WRITEL(0, BAMBOO_PCIL0_PMM1MA);
205
206 /* Disable region two */
207 PCI_WRITEL(0, BAMBOO_PCIL0_PMM2MA);
208 PCI_WRITEL(0, BAMBOO_PCIL0_PMM2LA);
209 PCI_WRITEL(0, BAMBOO_PCIL0_PMM2PCILA);
210 PCI_WRITEL(0, BAMBOO_PCIL0_PMM2PCIHA);
211 PCI_WRITEL(0, BAMBOO_PCIL0_PMM2MA);
212
213 /* Now configure the PCI->PLB windows, we only use PTM1
214 *
215 * For Inbound flow, set the window size to all available memory
216 * This is required because if size is smaller,
217 * then Eth/PCI DD would fail as PCI card not able to access
218 * the memory allocated by DD.
219 */
220
221 PCI_WRITEL(0, BAMBOO_PCIL0_PTM1MS); /* disabled region 1 */
222 PCI_WRITEL(0, BAMBOO_PCIL0_PTM1LA); /* begin of address map */
223
224 memory_size = 1 << fls(memory_size - 1);
225
226 /* Size low + Enabled */
227 PCI_WRITEL((0xffffffff - (memory_size - 1)) | 0x1, BAMBOO_PCIL0_PTM1MS);
228
229 eieio();
230 iounmap(pci_reg_base);
231}
232
233static void __init
234bamboo_setup_hose(void)
235{
236 unsigned int bar_response, bar;
237 struct pci_controller *hose;
238
239 bamboo_setup_pci();
240
241 hose = pcibios_alloc_controller();
242
243 if (!hose)
244 return;
245
246 hose->first_busno = 0;
247 hose->last_busno = 0xff;
248
249 hose->pci_mem_offset = BAMBOO_PCI_MEM_OFFSET;
250
251 pci_init_resource(&hose->io_resource,
252 BAMBOO_PCI_LOWER_IO,
253 BAMBOO_PCI_UPPER_IO,
254 IORESOURCE_IO,
255 "PCI host bridge");
256
257 pci_init_resource(&hose->mem_resources[0],
258 BAMBOO_PCI_LOWER_MEM,
259 BAMBOO_PCI_UPPER_MEM,
260 IORESOURCE_MEM,
261 "PCI host bridge");
262
263 ppc_md.pci_exclude_device = bamboo_exclude_device;
264
265 hose->io_space.start = BAMBOO_PCI_LOWER_IO;
266 hose->io_space.end = BAMBOO_PCI_UPPER_IO;
267 hose->mem_space.start = BAMBOO_PCI_LOWER_MEM;
268 hose->mem_space.end = BAMBOO_PCI_UPPER_MEM;
269 isa_io_base =
270 (unsigned long)ioremap64(BAMBOO_PCI_IO_BASE, BAMBOO_PCI_IO_SIZE);
271 hose->io_base_virt = (void *)isa_io_base;
272
273 setup_indirect_pci(hose,
274 BAMBOO_PCI_CFGA_PLB32,
275 BAMBOO_PCI_CFGD_PLB32);
276 hose->set_cfg_type = 1;
277
278 /* Zero config bars */
279 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
280 early_write_config_dword(hose, hose->first_busno,
281 PCI_FUNC(hose->first_busno), bar,
282 0x00000000);
283 early_read_config_dword(hose, hose->first_busno,
284 PCI_FUNC(hose->first_busno), bar,
285 &bar_response);
286 }
287
288 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
289
290 ppc_md.pci_swizzle = common_swizzle;
291 ppc_md.pci_map_irq = bamboo_map_irq;
292}
293
294TODC_ALLOC();
295
296static void __init
297bamboo_early_serial_map(void)
298{
299 struct uart_port port;
300
301 /* Setup ioremapped serial port access */
302 memset(&port, 0, sizeof(port));
303 port.membase = ioremap64(PPC440EP_UART0_ADDR, 8);
304 port.irq = 0;
305 port.uartclk = clocks.uart0;
306 port.regshift = 0;
307 port.iotype = SERIAL_IO_MEM;
308 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
309 port.line = 0;
310
311 if (early_serial_setup(&port) != 0) {
312 printk("Early serial init of port 0 failed\n");
313 }
314
315#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
316 /* Configure debug serial access */
317 gen550_init(0, &port);
318#endif
319
320 port.membase = ioremap64(PPC440EP_UART1_ADDR, 8);
321 port.irq = 1;
322 port.uartclk = clocks.uart1;
323 port.line = 1;
324
325 if (early_serial_setup(&port) != 0) {
326 printk("Early serial init of port 1 failed\n");
327 }
328
329#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
330 /* Configure debug serial access */
331 gen550_init(1, &port);
332#endif
333
334 port.membase = ioremap64(PPC440EP_UART2_ADDR, 8);
335 port.irq = 3;
336 port.uartclk = clocks.uart2;
337 port.line = 2;
338
339 if (early_serial_setup(&port) != 0) {
340 printk("Early serial init of port 2 failed\n");
341 }
342
343#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
344 /* Configure debug serial access */
345 gen550_init(2, &port);
346#endif
347
348 port.membase = ioremap64(PPC440EP_UART3_ADDR, 8);
349 port.irq = 4;
350 port.uartclk = clocks.uart3;
351 port.line = 3;
352
353 if (early_serial_setup(&port) != 0) {
354 printk("Early serial init of port 3 failed\n");
355 }
356}
357
358static void __init
359bamboo_setup_arch(void)
360{
361
362 bamboo_set_emacdata();
363
364 ibm440gx_get_clocks(&clocks, 33333333, 6 * 1843200);
365 ocp_sys_info.opb_bus_freq = clocks.opb;
366
367 /* Setup TODC access */
368 TODC_INIT(TODC_TYPE_DS1743,
369 0,
370 0,
371 ioremap64(BAMBOO_RTC_ADDR, BAMBOO_RTC_SIZE),
372 8);
373
374 /* init to some ~sane value until calibrate_delay() runs */
375 loops_per_jiffy = 50000000/HZ;
376
377 /* Setup PCI host bridge */
378 bamboo_setup_hose();
379
380#ifdef CONFIG_BLK_DEV_INITRD
381 if (initrd_start)
382 ROOT_DEV = Root_RAM0;
383 else
384#endif
385#ifdef CONFIG_ROOT_NFS
386 ROOT_DEV = Root_NFS;
387#else
388 ROOT_DEV = Root_HDA1;
389#endif
390
391 bamboo_early_serial_map();
392
393 /* Identify the system */
394 printk("IBM Bamboo port (MontaVista Software, Inc. (source@mvista.com))\n");
395}
396
397void __init platform_init(unsigned long r3, unsigned long r4,
398 unsigned long r5, unsigned long r6, unsigned long r7)
399{
400 parse_bootinfo(find_bootinfo());
401
402 /*
403 * If we were passed in a board information, copy it into the
404 * residual data area.
405 */
406 if (r3)
407 __res = *(bd_t *)(r3 + KERNELBASE);
408
409
410 ibm44x_platform_init();
411
412 ppc_md.setup_arch = bamboo_setup_arch;
413 ppc_md.show_cpuinfo = bamboo_show_cpuinfo;
414 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
415
416 ppc_md.calibrate_decr = bamboo_calibrate_decr;
417 ppc_md.time_init = todc_time_init;
418 ppc_md.set_rtc_time = todc_set_rtc_time;
419 ppc_md.get_rtc_time = todc_get_rtc_time;
420
421 ppc_md.nvram_read_val = todc_direct_read_val;
422 ppc_md.nvram_write_val = todc_direct_write_val;
423#ifdef CONFIG_KGDB
424 ppc_md.early_serial_map = bamboo_early_serial_map;
425#endif
426}
427
diff --git a/arch/ppc/platforms/4xx/bamboo.h b/arch/ppc/platforms/4xx/bamboo.h
new file mode 100644
index 000000000000..63d714504148
--- /dev/null
+++ b/arch/ppc/platforms/4xx/bamboo.h
@@ -0,0 +1,136 @@
1/*
2 * arch/ppc/platforms/bamboo.h
3 *
4 * Bamboo board definitions
5 *
6 * Wade Farnsworth <wfarnsworth@mvista.com>
7 *
8 * Copyright 2004 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifdef __KERNEL__
17#ifndef __ASM_BAMBOO_H__
18#define __ASM_BAMBOO_H__
19
20#include <linux/config.h>
21#include <platforms/4xx/ibm440ep.h>
22
23/* F/W TLB mapping used in bootloader glue to reset EMAC */
24#define PPC44x_EMAC0_MR0 0x0EF600E00
25
26/* Location of MAC addresses in PIBS image */
27#define PIBS_FLASH_BASE 0xfff00000
28#define PIBS_MAC_BASE (PIBS_FLASH_BASE+0xc0400)
29#define PIBS_MAC_SIZE 0x200
30#define PIBS_MAC_OFFSET 0x100
31
32/* Default clock rate */
33#define BAMBOO_TMRCLK 25000000
34
35/* RTC/NVRAM location */
36#define BAMBOO_RTC_ADDR 0x080000000ULL
37#define BAMBOO_RTC_SIZE 0x2000
38
39/* FPGA Registers */
40#define BAMBOO_FPGA_ADDR 0x080002000ULL
41
42#define BAMBOO_FPGA_CONFIG2_REG_ADDR (BAMBOO_FPGA_ADDR + 0x1)
43#define BAMBOO_FULL_DUPLEX_EN(x) (x & 0x08)
44#define BAMBOO_FORCE_100Mbps(x) (x & 0x04)
45#define BAMBOO_AUTONEGOTIATE(x) (x & 0x02)
46
47#define BAMBOO_FPGA_SETTING_REG_ADDR (BAMBOO_FPGA_ADDR + 0x3)
48#define BAMBOO_BOOT_SMALL_FLASH(x) (!(x & 0x80))
49#define BAMBOO_LARGE_FLASH_EN(x) (!(x & 0x40))
50#define BAMBOO_BOOT_NAND_FLASH(x) (!(x & 0x20))
51
52#define BAMBOO_FPGA_SELECTION1_REG_ADDR (BAMBOO_FPGA_ADDR + 0x4)
53#define BAMBOO_SEL_MII(x) (x & 0x80)
54#define BAMBOO_SEL_RMII(x) (x & 0x40)
55#define BAMBOO_SEL_SMII(x) (x & 0x20)
56
57/* Flash */
58#define BAMBOO_SMALL_FLASH_LOW 0x087f00000ULL
59#define BAMBOO_SMALL_FLASH_HIGH 0x0fff00000ULL
60#define BAMBOO_SMALL_FLASH_SIZE 0x100000
61#define BAMBOO_LARGE_FLASH_LOW 0x087800000ULL
62#define BAMBOO_LARGE_FLASH_HIGH1 0x0ff800000ULL
63#define BAMBOO_LARGE_FLASH_HIGH2 0x0ffc00000ULL
64#define BAMBOO_LARGE_FLASH_SIZE 0x400000
65#define BAMBOO_SRAM_LOW 0x087f00000ULL
66#define BAMBOO_SRAM_HIGH1 0x0fff00000ULL
67#define BAMBOO_SRAM_HIGH2 0x0ff800000ULL
68#define BAMBOO_SRAM_SIZE 0x100000
69#define BAMBOO_NAND_FLASH_REG_ADDR 0x090000000ULL
70#define BAMBOO_NAND_FLASH_REG_SIZE 0x2000
71
72/*
73 * Serial port defines
74 */
75#define RS_TABLE_SIZE 4
76
77#define UART0_IO_BASE 0xEF600300
78#define UART1_IO_BASE 0xEF600400
79#define UART2_IO_BASE 0xEF600500
80#define UART3_IO_BASE 0xEF600600
81
82#define BASE_BAUD 33177600/3/16
83#define UART0_INT 0
84#define UART1_INT 1
85#define UART2_INT 3
86#define UART3_INT 4
87
88#define STD_UART_OP(num) \
89 { 0, BASE_BAUD, 0, UART##num##_INT, \
90 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
91 iomem_base: UART##num##_IO_BASE, \
92 io_type: SERIAL_IO_MEM},
93
94#define SERIAL_PORT_DFNS \
95 STD_UART_OP(0) \
96 STD_UART_OP(1) \
97 STD_UART_OP(2) \
98 STD_UART_OP(3)
99
100/* PCI support */
101#define BAMBOO_PCI_CFGA_PLB32 0xeec00000
102#define BAMBOO_PCI_CFGD_PLB32 0xeec00004
103
104#define BAMBOO_PCI_IO_BASE 0x00000000e8000000ULL
105#define BAMBOO_PCI_IO_SIZE 0x00010000
106#define BAMBOO_PCI_MEM_OFFSET 0x00000000
107#define BAMBOO_PCI_PHY_MEM_BASE 0x00000000a0000000ULL
108
109#define BAMBOO_PCI_LOWER_IO 0x00000000
110#define BAMBOO_PCI_UPPER_IO 0x0000ffff
111#define BAMBOO_PCI_LOWER_MEM 0xa0000000
112#define BAMBOO_PCI_UPPER_MEM 0xafffffff
113#define BAMBOO_PCI_MEM_BASE 0xa0000000
114
115#define BAMBOO_PCIL0_BASE 0x00000000ef400000ULL
116#define BAMBOO_PCIL0_SIZE 0x40
117
118#define BAMBOO_PCIL0_PMM0LA 0x000
119#define BAMBOO_PCIL0_PMM0MA 0x004
120#define BAMBOO_PCIL0_PMM0PCILA 0x008
121#define BAMBOO_PCIL0_PMM0PCIHA 0x00C
122#define BAMBOO_PCIL0_PMM1LA 0x010
123#define BAMBOO_PCIL0_PMM1MA 0x014
124#define BAMBOO_PCIL0_PMM1PCILA 0x018
125#define BAMBOO_PCIL0_PMM1PCIHA 0x01C
126#define BAMBOO_PCIL0_PMM2LA 0x020
127#define BAMBOO_PCIL0_PMM2MA 0x024
128#define BAMBOO_PCIL0_PMM2PCILA 0x028
129#define BAMBOO_PCIL0_PMM2PCIHA 0x02C
130#define BAMBOO_PCIL0_PTM1MS 0x030
131#define BAMBOO_PCIL0_PTM1LA 0x034
132#define BAMBOO_PCIL0_PTM2MS 0x038
133#define BAMBOO_PCIL0_PTM2LA 0x03C
134
135#endif /* __ASM_BAMBOO_H__ */
136#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index cd11734ef7c5..509e69a095f0 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -7,7 +7,7 @@
7 * Copyright 2002-2005 MontaVista Software Inc. 7 * Copyright 2002-2005 MontaVista Software Inc.
8 * 8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies 10 * Copyright (c) 2003-2005 Zultys Technologies
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 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 13 * under the terms of the GNU General Public License as published by the
@@ -50,6 +50,7 @@
50#include <asm/bootinfo.h> 50#include <asm/bootinfo.h>
51#include <asm/ppc4xx_pic.h> 51#include <asm/ppc4xx_pic.h>
52#include <asm/ppcboot.h> 52#include <asm/ppcboot.h>
53#include <asm/tlbflush.h>
53 54
54#include <syslib/gen550.h> 55#include <syslib/gen550.h>
55#include <syslib/ibm440gp_common.h> 56#include <syslib/ibm440gp_common.h>
@@ -248,6 +249,9 @@ ebony_early_serial_map(void)
248#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 249#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
249 /* Configure debug serial access */ 250 /* Configure debug serial access */
250 gen550_init(0, &port); 251 gen550_init(0, &port);
252
253 /* Purge TLB entry added in head_44x.S for early serial access */
254 _tlbie(UART0_IO_BASE);
251#endif 255#endif
252 256
253 port.membase = ioremap64(PPC440GP_UART1_ADDR, 8); 257 port.membase = ioremap64(PPC440GP_UART1_ADDR, 8);
diff --git a/arch/ppc/platforms/4xx/ebony.h b/arch/ppc/platforms/4xx/ebony.h
index 47c391c9174d..d08faa46a0ae 100644
--- a/arch/ppc/platforms/4xx/ebony.h
+++ b/arch/ppc/platforms/4xx/ebony.h
@@ -56,9 +56,18 @@
56 * Serial port defines 56 * Serial port defines
57 */ 57 */
58 58
59/* OpenBIOS defined UART mappings, used before early_serial_setup */ 59#if defined(__BOOTER__)
60/* OpenBIOS defined UART mappings, used by bootloader shim */
60#define UART0_IO_BASE 0xE0000200 61#define UART0_IO_BASE 0xE0000200
61#define UART1_IO_BASE 0xE0000300 62#define UART1_IO_BASE 0xE0000300
63#else
64/* head_44x.S created UART mapping, used before early_serial_setup.
65 * We cannot use default OpenBIOS UART mappings because they
66 * don't work for configurations with more than 512M RAM. --ebs
67 */
68#define UART0_IO_BASE 0xF0000200
69#define UART1_IO_BASE 0xF0000300
70#endif
62 71
63/* external Epson SG-615P */ 72/* external Epson SG-615P */
64#define BASE_BAUD 691200 73#define BASE_BAUD 691200
@@ -66,7 +75,7 @@
66#define STD_UART_OP(num) \ 75#define STD_UART_OP(num) \
67 { 0, BASE_BAUD, 0, UART##num##_INT, \ 76 { 0, BASE_BAUD, 0, UART##num##_INT, \
68 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \ 77 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
69 iomem_base: UART##num##_IO_BASE, \ 78 iomem_base: (void*)UART##num##_IO_BASE, \
70 io_type: SERIAL_IO_MEM}, 79 io_type: SERIAL_IO_MEM},
71 80
72#define SERIAL_PORT_DFNS \ 81#define SERIAL_PORT_DFNS \
diff --git a/arch/ppc/platforms/4xx/ibm440ep.c b/arch/ppc/platforms/4xx/ibm440ep.c
new file mode 100644
index 000000000000..284da01f1ffd
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440ep.c
@@ -0,0 +1,220 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440ep.c
3 *
4 * PPC440EP I/O descriptions
5 *
6 * Wade Farnsworth <wfarnsworth@mvista.com>
7 * Copyright 2004 MontaVista Software Inc.
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 */
15#include <linux/init.h>
16#include <linux/module.h>
17#include <platforms/4xx/ibm440ep.h>
18#include <asm/ocp.h>
19#include <asm/ppc4xx_pic.h>
20
21static struct ocp_func_emac_data ibm440ep_emac0_def = {
22 .rgmii_idx = -1, /* No RGMII */
23 .rgmii_mux = -1, /* No RGMII */
24 .zmii_idx = 0, /* ZMII device index */
25 .zmii_mux = 0, /* ZMII input of this EMAC */
26 .mal_idx = 0, /* MAL device index */
27 .mal_rx_chan = 0, /* MAL rx channel number */
28 .mal_tx_chan = 0, /* MAL tx channel number */
29 .wol_irq = 61, /* WOL interrupt number */
30 .mdio_idx = -1, /* No shared MDIO */
31 .tah_idx = -1, /* No TAH */
32};
33
34static struct ocp_func_emac_data ibm440ep_emac1_def = {
35 .rgmii_idx = -1, /* No RGMII */
36 .rgmii_mux = -1, /* No RGMII */
37 .zmii_idx = 0, /* ZMII device index */
38 .zmii_mux = 1, /* ZMII input of this EMAC */
39 .mal_idx = 0, /* MAL device index */
40 .mal_rx_chan = 1, /* MAL rx channel number */
41 .mal_tx_chan = 2, /* MAL tx channel number */
42 .wol_irq = 63, /* WOL interrupt number */
43 .mdio_idx = -1, /* No shared MDIO */
44 .tah_idx = -1, /* No TAH */
45};
46OCP_SYSFS_EMAC_DATA()
47
48static struct ocp_func_mal_data ibm440ep_mal0_def = {
49 .num_tx_chans = 4, /* Number of TX channels */
50 .num_rx_chans = 2, /* Number of RX channels */
51 .txeob_irq = 10, /* TX End Of Buffer IRQ */
52 .rxeob_irq = 11, /* RX End Of Buffer IRQ */
53 .txde_irq = 33, /* TX Descriptor Error IRQ */
54 .rxde_irq = 34, /* RX Descriptor Error IRQ */
55 .serr_irq = 32, /* MAL System Error IRQ */
56};
57OCP_SYSFS_MAL_DATA()
58
59static struct ocp_func_iic_data ibm440ep_iic0_def = {
60 .fast_mode = 0, /* Use standad mode (100Khz) */
61};
62
63static struct ocp_func_iic_data ibm440ep_iic1_def = {
64 .fast_mode = 0, /* Use standad mode (100Khz) */
65};
66OCP_SYSFS_IIC_DATA()
67
68struct ocp_def core_ocp[] = {
69 { .vendor = OCP_VENDOR_IBM,
70 .function = OCP_FUNC_OPB,
71 .index = 0,
72 .paddr = 0x0EF600000ULL,
73 .irq = OCP_IRQ_NA,
74 .pm = OCP_CPM_NA,
75 },
76 { .vendor = OCP_VENDOR_IBM,
77 .function = OCP_FUNC_16550,
78 .index = 0,
79 .paddr = PPC440EP_UART0_ADDR,
80 .irq = UART0_INT,
81 .pm = IBM_CPM_UART0,
82 },
83 { .vendor = OCP_VENDOR_IBM,
84 .function = OCP_FUNC_16550,
85 .index = 1,
86 .paddr = PPC440EP_UART1_ADDR,
87 .irq = UART1_INT,
88 .pm = IBM_CPM_UART1,
89 },
90 { .vendor = OCP_VENDOR_IBM,
91 .function = OCP_FUNC_16550,
92 .index = 2,
93 .paddr = PPC440EP_UART2_ADDR,
94 .irq = UART2_INT,
95 .pm = IBM_CPM_UART2,
96 },
97 { .vendor = OCP_VENDOR_IBM,
98 .function = OCP_FUNC_16550,
99 .index = 3,
100 .paddr = PPC440EP_UART3_ADDR,
101 .irq = UART3_INT,
102 .pm = IBM_CPM_UART3,
103 },
104 { .vendor = OCP_VENDOR_IBM,
105 .function = OCP_FUNC_IIC,
106 .index = 0,
107 .paddr = 0x0EF600700ULL,
108 .irq = 2,
109 .pm = IBM_CPM_IIC0,
110 .additions = &ibm440ep_iic0_def,
111 .show = &ocp_show_iic_data
112 },
113 { .vendor = OCP_VENDOR_IBM,
114 .function = OCP_FUNC_IIC,
115 .index = 1,
116 .paddr = 0x0EF600800ULL,
117 .irq = 7,
118 .pm = IBM_CPM_IIC1,
119 .additions = &ibm440ep_iic1_def,
120 .show = &ocp_show_iic_data
121 },
122 { .vendor = OCP_VENDOR_IBM,
123 .function = OCP_FUNC_GPIO,
124 .index = 0,
125 .paddr = 0x0EF600B00ULL,
126 .irq = OCP_IRQ_NA,
127 .pm = IBM_CPM_GPIO0,
128 },
129 { .vendor = OCP_VENDOR_IBM,
130 .function = OCP_FUNC_GPIO,
131 .index = 1,
132 .paddr = 0x0EF600C00ULL,
133 .irq = OCP_IRQ_NA,
134 .pm = OCP_CPM_NA,
135 },
136 { .vendor = OCP_VENDOR_IBM,
137 .function = OCP_FUNC_MAL,
138 .paddr = OCP_PADDR_NA,
139 .irq = OCP_IRQ_NA,
140 .pm = OCP_CPM_NA,
141 .additions = &ibm440ep_mal0_def,
142 .show = &ocp_show_mal_data,
143 },
144 { .vendor = OCP_VENDOR_IBM,
145 .function = OCP_FUNC_EMAC,
146 .index = 0,
147 .paddr = 0x0EF600E00ULL,
148 .irq = 60,
149 .pm = OCP_CPM_NA,
150 .additions = &ibm440ep_emac0_def,
151 .show = &ocp_show_emac_data,
152 },
153 { .vendor = OCP_VENDOR_IBM,
154 .function = OCP_FUNC_EMAC,
155 .index = 1,
156 .paddr = 0x0EF600F00ULL,
157 .irq = 62,
158 .pm = OCP_CPM_NA,
159 .additions = &ibm440ep_emac1_def,
160 .show = &ocp_show_emac_data,
161 },
162 { .vendor = OCP_VENDOR_IBM,
163 .function = OCP_FUNC_ZMII,
164 .paddr = 0x0EF600D00ULL,
165 .irq = OCP_IRQ_NA,
166 .pm = OCP_CPM_NA,
167 },
168 { .vendor = OCP_VENDOR_INVALID
169 }
170};
171
172/* Polarity and triggering settings for internal interrupt sources */
173struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
174 { .polarity = 0xffbffe03,
175 .triggering = 0xfffffe00,
176 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
177 },
178 { .polarity = 0xffffc6ef,
179 .triggering = 0xffffc7ff,
180 .ext_irq_mask = 0x00003800, /* IRQ7 - IRQ9 */
181 },
182};
183
184static struct resource usb_gadget_resources[] = {
185 [0] = {
186 .start = 0x050000100ULL,
187 .end = 0x05000017FULL,
188 .flags = IORESOURCE_MEM,
189 },
190 [1] = {
191 .start = 55,
192 .end = 55,
193 .flags = IORESOURCE_IRQ,
194 },
195};
196
197static u64 dma_mask = 0xffffffffULL;
198
199static struct platform_device usb_gadget_device = {
200 .name = "musbhsfc",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(usb_gadget_resources),
203 .resource = usb_gadget_resources,
204 .dev = {
205 .dma_mask = &dma_mask,
206 .coherent_dma_mask = 0xffffffffULL,
207 }
208};
209
210static struct platform_device *ibm440ep_devs[] __initdata = {
211 &usb_gadget_device,
212};
213
214static int __init
215ibm440ep_platform_add_devices(void)
216{
217 return platform_add_devices(ibm440ep_devs, ARRAY_SIZE(ibm440ep_devs));
218}
219arch_initcall(ibm440ep_platform_add_devices);
220
diff --git a/arch/ppc/platforms/4xx/ibm440ep.h b/arch/ppc/platforms/4xx/ibm440ep.h
new file mode 100644
index 000000000000..97c80b8e3e10
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440ep.h
@@ -0,0 +1,76 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440ep.h
3 *
4 * PPC440EP definitions
5 *
6 * Wade Farnsworth <wfarnsworth@mvista.com>
7 *
8 * Copyright 2002 Roland Dreier
9 * Copyright 2004 MontaVista Software, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#ifdef __KERNEL__
19#ifndef __PPC_PLATFORMS_IBM440EP_H
20#define __PPC_PLATFORMS_IBM440EP_H
21
22#include <linux/config.h>
23#include <asm/ibm44x.h>
24
25/* UART */
26#define PPC440EP_UART0_ADDR 0x0EF600300
27#define PPC440EP_UART1_ADDR 0x0EF600400
28#define PPC440EP_UART2_ADDR 0x0EF600500
29#define PPC440EP_UART3_ADDR 0x0EF600600
30#define UART0_INT 0
31#define UART1_INT 1
32#define UART2_INT 3
33#define UART3_INT 4
34
35/* Clock and Power Management */
36#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
37#define IBM_CPM_IIC1 0x40000000 /* IIC interface */
38#define IBM_CPM_PCI 0x20000000 /* PCI bridge */
39#define IBM_CPM_USB1H 0x08000000 /* USB 1.1 Host */
40#define IBM_CPM_FPU 0x04000000 /* floating point unit */
41#define IBM_CPM_CPU 0x02000000 /* processor core */
42#define IBM_CPM_DMA 0x01000000 /* DMA controller */
43#define IBM_CPM_BGO 0x00800000 /* PLB to OPB bus arbiter */
44#define IBM_CPM_BGI 0x00400000 /* OPB to PLB bridge */
45#define IBM_CPM_EBC 0x00200000 /* External Bus Controller */
46#define IBM_CPM_EBM 0x00100000 /* Ext Bus Master Interface */
47#define IBM_CPM_DMC 0x00080000 /* SDRAM peripheral controller */
48#define IBM_CPM_PLB4 0x00040000 /* PLB4 bus arbiter */
49#define IBM_CPM_PLB4x3 0x00020000 /* PLB4 to PLB3 bridge controller */
50#define IBM_CPM_PLB3x4 0x00010000 /* PLB3 to PLB4 bridge controller */
51#define IBM_CPM_PLB3 0x00008000 /* PLB3 bus arbiter */
52#define IBM_CPM_PPM 0x00002000 /* PLB Performance Monitor */
53#define IBM_CPM_UIC1 0x00001000 /* Universal Interrupt Controller */
54#define IBM_CPM_GPIO0 0x00000800 /* General Purpose IO (??) */
55#define IBM_CPM_GPT 0x00000400 /* General Purpose Timers */
56#define IBM_CPM_UART0 0x00000200 /* serial port 0 */
57#define IBM_CPM_UART1 0x00000100 /* serial port 1 */
58#define IBM_CPM_UIC0 0x00000080 /* Universal Interrupt Controller */
59#define IBM_CPM_TMRCLK 0x00000040 /* CPU timers */
60#define IBM_CPM_EMAC0 0x00000020 /* ethernet port 0 */
61#define IBM_CPM_EMAC1 0x00000010 /* ethernet port 1 */
62#define IBM_CPM_UART2 0x00000008 /* serial port 2 */
63#define IBM_CPM_UART3 0x00000004 /* serial port 3 */
64#define IBM_CPM_USB2D 0x00000002 /* USB 2.0 Device */
65#define IBM_CPM_USB2H 0x00000001 /* USB 2.0 Host */
66
67#define DFLT_IBM4xx_PM ~(IBM_CPM_UIC0 | IBM_CPM_UIC1 | IBM_CPM_CPU \
68 | IBM_CPM_EBC | IBM_CPM_BGO | IBM_CPM_FPU \
69 | IBM_CPM_EBM | IBM_CPM_PLB4 | IBM_CPM_3x4 \
70 | IBM_CPM_PLB3 | IBM_CPM_PLB4x3 \
71 | IBM_CPM_EMAC0 | IBM_CPM_TMRCLK \
72 | IBM_CPM_DMA | IBM_CPM_PCI | IBM_CPM_EMAC1)
73
74
75#endif /* __PPC_PLATFORMS_IBM440EP_H */
76#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm440sp.c b/arch/ppc/platforms/4xx/ibm440sp.c
index a203efb47aba..fa3e003a0db9 100644
--- a/arch/ppc/platforms/4xx/ibm440sp.c
+++ b/arch/ppc/platforms/4xx/ibm440sp.c
@@ -36,8 +36,8 @@ static struct ocp_func_emac_data ibm440sp_emac0_def = {
36OCP_SYSFS_EMAC_DATA() 36OCP_SYSFS_EMAC_DATA()
37 37
38static struct ocp_func_mal_data ibm440sp_mal0_def = { 38static struct ocp_func_mal_data ibm440sp_mal0_def = {
39 .num_tx_chans = 4, /* Number of TX channels */ 39 .num_tx_chans = 1, /* Number of TX channels */
40 .num_rx_chans = 4, /* Number of RX channels */ 40 .num_rx_chans = 1, /* Number of RX channels */
41 .txeob_irq = 38, /* TX End Of Buffer IRQ */ 41 .txeob_irq = 38, /* TX End Of Buffer IRQ */
42 .rxeob_irq = 39, /* RX End Of Buffer IRQ */ 42 .rxeob_irq = 39, /* RX End Of Buffer IRQ */
43 .txde_irq = 34, /* TX Descriptor Error IRQ */ 43 .txde_irq = 34, /* TX Descriptor Error IRQ */
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index 5f82a6bc7046..8fc34a344769 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -48,6 +48,7 @@
48#include <asm/bootinfo.h> 48#include <asm/bootinfo.h>
49#include <asm/ppc4xx_pic.h> 49#include <asm/ppc4xx_pic.h>
50#include <asm/ppcboot.h> 50#include <asm/ppcboot.h>
51#include <asm/tlbflush.h>
51 52
52#include <syslib/gen550.h> 53#include <syslib/gen550.h>
53#include <syslib/ibm440gx_common.h> 54#include <syslib/ibm440gx_common.h>
@@ -266,6 +267,9 @@ ocotea_early_serial_map(void)
266#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 267#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
267 /* Configure debug serial access */ 268 /* Configure debug serial access */
268 gen550_init(0, &port); 269 gen550_init(0, &port);
270
271 /* Purge TLB entry added in head_44x.S for early serial access */
272 _tlbie(UART0_IO_BASE);
269#endif 273#endif
270 274
271 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8); 275 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
diff --git a/arch/ppc/platforms/4xx/ocotea.h b/arch/ppc/platforms/4xx/ocotea.h
index 202dc8251190..33251153ac5f 100644
--- a/arch/ppc/platforms/4xx/ocotea.h
+++ b/arch/ppc/platforms/4xx/ocotea.h
@@ -55,15 +55,24 @@
55 */ 55 */
56#define RS_TABLE_SIZE 2 56#define RS_TABLE_SIZE 2
57 57
58/* OpenBIOS defined UART mappings, used before early_serial_setup */ 58#if defined(__BOOTER__)
59/* OpenBIOS defined UART mappings, used by bootloader shim */
59#define UART0_IO_BASE 0xE0000200 60#define UART0_IO_BASE 0xE0000200
60#define UART1_IO_BASE 0xE0000300 61#define UART1_IO_BASE 0xE0000300
62#else
63/* head_44x.S created UART mapping, used before early_serial_setup.
64 * We cannot use default OpenBIOS UART mappings because they
65 * don't work for configurations with more than 512M RAM. --ebs
66 */
67#define UART0_IO_BASE 0xF0000200
68#define UART1_IO_BASE 0xF0000300
69#endif
61 70
62#define BASE_BAUD 11059200/16 71#define BASE_BAUD 11059200/16
63#define STD_UART_OP(num) \ 72#define STD_UART_OP(num) \
64 { 0, BASE_BAUD, 0, UART##num##_INT, \ 73 { 0, BASE_BAUD, 0, UART##num##_INT, \
65 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \ 74 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
66 iomem_base: UART##num##_IO_BASE, \ 75 iomem_base: (void*)UART##num##_IO_BASE, \
67 io_type: SERIAL_IO_MEM}, 76 io_type: SERIAL_IO_MEM},
68 77
69#define SERIAL_PORT_DFNS \ 78#define SERIAL_PORT_DFNS \
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index e18380258b68..f2748c88665a 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -56,7 +56,6 @@
56#include <syslib/ppc85xx_common.h> 56#include <syslib/ppc85xx_common.h>
57#include <syslib/ppc85xx_setup.h> 57#include <syslib/ppc85xx_setup.h>
58 58
59extern void cpm2_reset(void);
60 59
61/* ************************************************************************ 60/* ************************************************************************
62 * 61 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index b52c4317fefd..6267b294f704 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -49,7 +49,7 @@
49#include <asm/mpc85xx.h> 49#include <asm/mpc85xx.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/immap_85xx.h> 51#include <asm/immap_85xx.h>
52#include <asm/immap_cpm2.h> 52#include <asm/cpm2.h>
53#include <asm/ppc_sys.h> 53#include <asm/ppc_sys.h>
54#include <asm/kgdb.h> 54#include <asm/kgdb.h>
55 55
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index bb41265cfc85..c99b365d6110 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -52,14 +52,13 @@
52#include <asm/mpc85xx.h> 52#include <asm/mpc85xx.h>
53#include <asm/irq.h> 53#include <asm/irq.h>
54#include <asm/immap_85xx.h> 54#include <asm/immap_85xx.h>
55#include <asm/immap_cpm2.h> 55#include <asm/cpm2.h>
56#include <asm/mpc85xx.h> 56#include <asm/mpc85xx.h>
57#include <asm/ppc_sys.h> 57#include <asm/ppc_sys.h>
58 58
59#include <syslib/cpm2_pic.h> 59#include <syslib/cpm2_pic.h>
60#include <syslib/ppc85xx_common.h> 60#include <syslib/ppc85xx_common.h>
61 61
62extern void cpm2_reset(void);
63 62
64unsigned char __res[sizeof(bd_t)]; 63unsigned char __res[sizeof(bd_t)];
65 64
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
index 4d324b630f4f..b392b9a15987 100644
--- a/arch/ppc/platforms/pmac_setup.c
+++ b/arch/ppc/platforms/pmac_setup.c
@@ -113,7 +113,7 @@ extern int pmac_newworld;
113extern void zs_kgdb_hook(int tty_num); 113extern void zs_kgdb_hook(int tty_num);
114static void ohare_init(void); 114static void ohare_init(void);
115#ifdef CONFIG_BOOTX_TEXT 115#ifdef CONFIG_BOOTX_TEXT
116void pmac_progress(char *s, unsigned short hex); 116static void pmac_progress(char *s, unsigned short hex);
117#endif 117#endif
118 118
119sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN; 119sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
@@ -123,7 +123,7 @@ extern struct smp_ops_t psurge_smp_ops;
123extern struct smp_ops_t core99_smp_ops; 123extern struct smp_ops_t core99_smp_ops;
124#endif /* CONFIG_SMP */ 124#endif /* CONFIG_SMP */
125 125
126int __pmac 126static int __pmac
127pmac_show_cpuinfo(struct seq_file *m) 127pmac_show_cpuinfo(struct seq_file *m)
128{ 128{
129 struct device_node *np; 129 struct device_node *np;
@@ -227,7 +227,7 @@ pmac_show_cpuinfo(struct seq_file *m)
227 return 0; 227 return 0;
228} 228}
229 229
230int __openfirmware 230static int __openfirmware
231pmac_show_percpuinfo(struct seq_file *m, int i) 231pmac_show_percpuinfo(struct seq_file *m, int i)
232{ 232{
233#ifdef CONFIG_CPU_FREQ_PMAC 233#ifdef CONFIG_CPU_FREQ_PMAC
@@ -415,7 +415,7 @@ find_ide_boot(void)
415} 415}
416#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */ 416#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
417 417
418void __init 418static void __init
419find_boot_device(void) 419find_boot_device(void)
420{ 420{
421#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) 421#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
@@ -512,7 +512,7 @@ note_bootable_part(dev_t dev, int part, int goodness)
512 } 512 }
513} 513}
514 514
515void __pmac 515static void __pmac
516pmac_restart(char *cmd) 516pmac_restart(char *cmd)
517{ 517{
518#ifdef CONFIG_ADB_CUDA 518#ifdef CONFIG_ADB_CUDA
@@ -537,7 +537,7 @@ pmac_restart(char *cmd)
537 } 537 }
538} 538}
539 539
540void __pmac 540static void __pmac
541pmac_power_off(void) 541pmac_power_off(void)
542{ 542{
543#ifdef CONFIG_ADB_CUDA 543#ifdef CONFIG_ADB_CUDA
@@ -562,7 +562,7 @@ pmac_power_off(void)
562 } 562 }
563} 563}
564 564
565void __pmac 565static void __pmac
566pmac_halt(void) 566pmac_halt(void)
567{ 567{
568 pmac_power_off(); 568 pmac_power_off();
@@ -700,7 +700,7 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
700} 700}
701 701
702#ifdef CONFIG_BOOTX_TEXT 702#ifdef CONFIG_BOOTX_TEXT
703void __init 703static void __init
704pmac_progress(char *s, unsigned short hex) 704pmac_progress(char *s, unsigned short hex)
705{ 705{
706 if (boot_text_mapped) { 706 if (boot_text_mapped) {
diff --git a/arch/ppc/platforms/prpmc750.c b/arch/ppc/platforms/prpmc750.c
index c894e1ab5934..24ae1caafc61 100644
--- a/arch/ppc/platforms/prpmc750.c
+++ b/arch/ppc/platforms/prpmc750.c
@@ -29,6 +29,7 @@
29#include <linux/ide.h> 29#include <linux/ide.h>
30#include <linux/root_dev.h> 30#include <linux/root_dev.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/serial_reg.h>
32 33
33#include <asm/byteorder.h> 34#include <asm/byteorder.h>
34#include <asm/system.h> 35#include <asm/system.h>
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
index 8b149c2fc54f..21e31346b12b 100644
--- a/arch/ppc/platforms/sandpoint.c
+++ b/arch/ppc/platforms/sandpoint.c
@@ -311,19 +311,22 @@ sandpoint_setup_arch(void)
311 { 311 {
312 bd_t *bp = (bd_t *)__res; 312 bd_t *bp = (bd_t *)__res;
313 struct plat_serial8250_port *pdata; 313 struct plat_serial8250_port *pdata;
314 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_DUART);
315 314
315 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART0);
316 if (pdata) 316 if (pdata)
317 { 317 {
318 pdata[0].uartclk = bp->bi_busfreq; 318 pdata[0].uartclk = bp->bi_busfreq;
319 pdata[0].membase = ioremap(pdata[0].mapbase, 0x100); 319 }
320 320
321 /* this disables the 2nd serial port on the DUART 321#ifdef CONFIG_SANDPOINT_ENABLE_UART1
322 * since the sandpoint does not have it connected */ 322 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART1);
323 pdata[1].uartclk = 0; 323 if (pdata)
324 pdata[1].irq = 0; 324 {
325 pdata[1].mapbase = 0; 325 pdata[0].uartclk = bp->bi_busfreq;
326 } 326 }
327#else
328 ppc_sys_device_remove(MPC10X_UART1);
329#endif
327 } 330 }
328 331
329 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n"); 332 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n");
diff --git a/arch/ppc/platforms/tqm8260_setup.c b/arch/ppc/platforms/tqm8260_setup.c
index a8880bfc034b..3409139330b1 100644
--- a/arch/ppc/platforms/tqm8260_setup.c
+++ b/arch/ppc/platforms/tqm8260_setup.c
@@ -16,8 +16,8 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/immap_cpm2.h>
20#include <asm/mpc8260.h> 19#include <asm/mpc8260.h>
20#include <asm/cpm2.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22 22
23static int 23static int
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index dec5bf4f6879..220a65ab0a51 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o
11obj-$(CONFIG_PPC_OCP) += ocp.o 11obj-$(CONFIG_PPC_OCP) += ocp.o
12obj-$(CONFIG_IBM_OCP) += ibm_ocp.o 12obj-$(CONFIG_IBM_OCP) += ibm_ocp.o
13obj-$(CONFIG_44x) += ibm44x_common.o 13obj-$(CONFIG_44x) += ibm44x_common.o
14obj-$(CONFIG_440EP) += ibm440gx_common.o
14obj-$(CONFIG_440GP) += ibm440gp_common.o 15obj-$(CONFIG_440GP) += ibm440gp_common.o
15obj-$(CONFIG_440GX) += ibm440gx_common.o 16obj-$(CONFIG_440GX) += ibm440gx_common.o
16obj-$(CONFIG_440SP) += ibm440gx_common.o ibm440sp_common.o 17obj-$(CONFIG_440SP) += ibm440gx_common.o ibm440sp_common.o
@@ -44,6 +45,7 @@ obj-$(CONFIG_PPC_CHRP) += open_pic.o indirect_pci.o i8259.o
44obj-$(CONFIG_PPC_PREP) += open_pic.o indirect_pci.o i8259.o todc_time.o 45obj-$(CONFIG_PPC_PREP) += open_pic.o indirect_pci.o i8259.o todc_time.o
45obj-$(CONFIG_ADIR) += i8259.o indirect_pci.o pci_auto.o \ 46obj-$(CONFIG_ADIR) += i8259.o indirect_pci.o pci_auto.o \
46 todc_time.o 47 todc_time.o
48obj-$(CONFIG_BAMBOO) += indirect_pci.o pci_auto.o todc_time.o
47obj-$(CONFIG_CPCI690) += todc_time.o pci_auto.o 49obj-$(CONFIG_CPCI690) += todc_time.o pci_auto.o
48obj-$(CONFIG_EBONY) += indirect_pci.o pci_auto.o todc_time.o 50obj-$(CONFIG_EBONY) += indirect_pci.o pci_auto.o todc_time.o
49obj-$(CONFIG_EV64260) += todc_time.o pci_auto.o 51obj-$(CONFIG_EV64260) += todc_time.o pci_auto.o
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c
index 4c19a4ac7163..cbac44b1620c 100644
--- a/arch/ppc/syslib/cpm2_common.c
+++ b/arch/ppc/syslib/cpm2_common.c
@@ -27,7 +27,6 @@
27#include <asm/mpc8260.h> 27#include <asm/mpc8260.h>
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/immap_cpm2.h>
31#include <asm/cpm2.h> 30#include <asm/cpm2.h>
32#include <asm/rheap.h> 31#include <asm/rheap.h>
33 32
diff --git a/arch/ppc/syslib/ibm440gx_common.c b/arch/ppc/syslib/ibm440gx_common.c
index 4ad85e0e0234..d4776af6a3ca 100644
--- a/arch/ppc/syslib/ibm440gx_common.c
+++ b/arch/ppc/syslib/ibm440gx_common.c
@@ -34,6 +34,10 @@ void __init ibm440gx_get_clocks(struct ibm44x_clocks* p, unsigned int sys_clk,
34 u32 plld = CPR_READ(DCRN_CPR_PLLD); 34 u32 plld = CPR_READ(DCRN_CPR_PLLD);
35 u32 uart0 = SDR_READ(DCRN_SDR_UART0); 35 u32 uart0 = SDR_READ(DCRN_SDR_UART0);
36 u32 uart1 = SDR_READ(DCRN_SDR_UART1); 36 u32 uart1 = SDR_READ(DCRN_SDR_UART1);
37#ifdef CONFIG_440EP
38 u32 uart2 = SDR_READ(DCRN_SDR_UART2);
39 u32 uart3 = SDR_READ(DCRN_SDR_UART3);
40#endif
37 41
38 /* Dividers */ 42 /* Dividers */
39 u32 fbdv = __fix_zero((plld >> 24) & 0x1f, 32); 43 u32 fbdv = __fix_zero((plld >> 24) & 0x1f, 32);
@@ -96,6 +100,17 @@ bypass:
96 p->uart1 = ser_clk; 100 p->uart1 = ser_clk;
97 else 101 else
98 p->uart1 = p->plb / __fix_zero(uart1 & 0xff, 256); 102 p->uart1 = p->plb / __fix_zero(uart1 & 0xff, 256);
103#ifdef CONFIG_440EP
104 if (uart2 & 0x00800000)
105 p->uart2 = ser_clk;
106 else
107 p->uart2 = p->plb / __fix_zero(uart2 & 0xff, 256);
108
109 if (uart3 & 0x00800000)
110 p->uart3 = ser_clk;
111 else
112 p->uart3 = p->plb / __fix_zero(uart3 & 0xff, 256);
113#endif
99} 114}
100 115
101/* Issue L2C diagnostic command */ 116/* Issue L2C diagnostic command */
diff --git a/arch/ppc/syslib/ibm44x_common.h b/arch/ppc/syslib/ibm44x_common.h
index b14eb603ce01..c16b6a5ac6ab 100644
--- a/arch/ppc/syslib/ibm44x_common.h
+++ b/arch/ppc/syslib/ibm44x_common.h
@@ -29,6 +29,10 @@ struct ibm44x_clocks {
29 unsigned int ebc; /* PerClk */ 29 unsigned int ebc; /* PerClk */
30 unsigned int uart0; 30 unsigned int uart0;
31 unsigned int uart1; 31 unsigned int uart1;
32#ifdef CONFIG_440EP
33 unsigned int uart2;
34 unsigned int uart3;
35#endif
32}; 36};
33 37
34/* common 44x platform init */ 38/* common 44x platform init */
diff --git a/arch/ppc/syslib/m8260_setup.c b/arch/ppc/syslib/m8260_setup.c
index fda75d79050c..8f80a42dfdb7 100644
--- a/arch/ppc/syslib/m8260_setup.c
+++ b/arch/ppc/syslib/m8260_setup.c
@@ -24,7 +24,7 @@
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/mpc8260.h> 26#include <asm/mpc8260.h>
27#include <asm/immap_cpm2.h> 27#include <asm/cpm2.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
30#include <asm/time.h> 30#include <asm/time.h>
@@ -33,7 +33,6 @@
33 33
34unsigned char __res[sizeof(bd_t)]; 34unsigned char __res[sizeof(bd_t)];
35 35
36extern void cpm2_reset(void);
37extern void pq2_find_bridges(void); 36extern void pq2_find_bridges(void);
38extern void pq2pci_init_irq(void); 37extern void pq2pci_init_irq(void);
39extern void idma_pci9_init(void); 38extern void idma_pci9_init(void);
diff --git a/arch/ppc/syslib/m82xx_pci.c b/arch/ppc/syslib/m82xx_pci.c
index 5e7a7edcea74..9db58c587b46 100644
--- a/arch/ppc/syslib/m82xx_pci.c
+++ b/arch/ppc/syslib/m82xx_pci.c
@@ -238,9 +238,9 @@ pq2ads_setup_pci(struct pci_controller *hose)
238 * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]), 238 * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]),
239 * and local bus for PCI (SIUMCR [LBPC]). 239 * and local bus for PCI (SIUMCR [LBPC]).
240 */ 240 */
241 immap->im_siu_conf.siu_82xx.sc_siumcr = (immap->im_siu_conf.sc_siumcr & 241 immap->im_siu_conf.siu_82xx.sc_siumcr = (immap->im_siu_conf.siu_82xx.sc_siumcr &
242 ~(SIUMCR_L2PC11 | SIUMCR_LBPC11 | SIUMCR_CS10PC11 | SIUMCR_APPC11) | 242 ~(SIUMCR_L2CPC11 | SIUMCR_LBPC11 | SIUMCR_CS10PC11 | SIUMCR_APPC11) |
243 SIUMCR_BBD | SIUMCR_LBPC01 | SIUMCR_DPPC11 | SIUMCR_APPC10; 243 SIUMCR_BBD | SIUMCR_LBPC01 | SIUMCR_DPPC11 | SIUMCR_APPC10);
244#endif 244#endif
245 /* Enable PCI */ 245 /* Enable PCI */
246 immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN); 246 immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN);
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index c1db2ab1d154..55a381af4e37 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -57,7 +57,7 @@ unsigned char __res[sizeof(bd_t)];
57extern void m8xx_ide_init(void); 57extern void m8xx_ide_init(void);
58 58
59extern unsigned long find_available_memory(void); 59extern unsigned long find_available_memory(void);
60extern void m8xx_cpm_reset(uint cpm_page); 60extern void m8xx_cpm_reset();
61extern void m8xx_wdt_handler_install(bd_t *bp); 61extern void m8xx_wdt_handler_install(bd_t *bp);
62extern void rpxfb_alloc_pages(void); 62extern void rpxfb_alloc_pages(void);
63extern void cpm_interrupt_init(void); 63extern void cpm_interrupt_init(void);
@@ -70,13 +70,9 @@ board_init(void)
70void __init 70void __init
71m8xx_setup_arch(void) 71m8xx_setup_arch(void)
72{ 72{
73 int cpm_page;
74
75 cpm_page = (int) alloc_bootmem_pages(PAGE_SIZE);
76
77 /* Reset the Communication Processor Module. 73 /* Reset the Communication Processor Module.
78 */ 74 */
79 m8xx_cpm_reset(cpm_page); 75 m8xx_cpm_reset();
80 76
81#ifdef CONFIG_FB_RPX 77#ifdef CONFIG_FB_RPX
82 rpxfb_alloc_pages(); 78 rpxfb_alloc_pages();
diff --git a/arch/ppc/syslib/mpc10x_common.c b/arch/ppc/syslib/mpc10x_common.c
index 8fc5f4154521..87065e2e4c5f 100644
--- a/arch/ppc/syslib/mpc10x_common.c
+++ b/arch/ppc/syslib/mpc10x_common.c
@@ -45,24 +45,29 @@
45#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS) 45#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS)
46#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS) 46#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS)
47#define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS) 47#define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS)
48#define MPC10X_UART1_IRQ (EPIC_IRQ_BASE + 5 + NUM_8259_INTERRUPTS)
48#else 49#else
49#define MPC10X_I2C_IRQ -1 50#define MPC10X_I2C_IRQ -1
50#define MPC10X_DMA0_IRQ -1 51#define MPC10X_DMA0_IRQ -1
51#define MPC10X_DMA1_IRQ -1 52#define MPC10X_DMA1_IRQ -1
52#define MPC10X_UART0_IRQ -1 53#define MPC10X_UART0_IRQ -1
54#define MPC10X_UART1_IRQ -1
53#endif 55#endif
54 56
55static struct fsl_i2c_platform_data mpc10x_i2c_pdata = { 57static struct fsl_i2c_platform_data mpc10x_i2c_pdata = {
56 .device_flags = 0, 58 .device_flags = 0,
57}; 59};
58 60
59static struct plat_serial8250_port serial_platform_data[] = { 61static struct plat_serial8250_port serial_plat_uart0[] = {
60 [0] = { 62 [0] = {
61 .mapbase = 0x4500, 63 .mapbase = 0x4500,
62 .iotype = UPIO_MEM, 64 .iotype = UPIO_MEM,
63 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 65 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
64 }, 66 },
65 [1] = { 67 { },
68};
69static struct plat_serial8250_port serial_plat_uart1[] = {
70 [0] = {
66 .mapbase = 0x4600, 71 .mapbase = 0x4600,
67 .iotype = UPIO_MEM, 72 .iotype = UPIO_MEM,
68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 73 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
@@ -133,11 +138,17 @@ struct platform_device ppc_sys_platform_devices[] = {
133 }, 138 },
134 }, 139 },
135 }, 140 },
136 [MPC10X_DUART] = { 141 [MPC10X_UART0] = {
137 .name = "serial8250", 142 .name = "serial8250",
138 .id = 0, 143 .id = 0,
139 .dev.platform_data = serial_platform_data, 144 .dev.platform_data = serial_plat_uart0,
140 }, 145 },
146 [MPC10X_UART1] = {
147 .name = "serial8250",
148 .id = 1,
149 .dev.platform_data = serial_plat_uart1,
150 },
151
141}; 152};
142 153
143/* We use the PCI ID to match on */ 154/* We use the PCI ID to match on */
@@ -147,10 +158,10 @@ struct ppc_sys_spec ppc_sys_specs[] = {
147 .ppc_sys_name = "8245", 158 .ppc_sys_name = "8245",
148 .mask = 0xFFFFFFFF, 159 .mask = 0xFFFFFFFF,
149 .value = MPC10X_BRIDGE_8245, 160 .value = MPC10X_BRIDGE_8245,
150 .num_devices = 4, 161 .num_devices = 5,
151 .device_list = (enum ppc_sys_devices[]) 162 .device_list = (enum ppc_sys_devices[])
152 { 163 {
153 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_DUART, 164 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_UART0, MPC10X_UART1,
154 }, 165 },
155 }, 166 },
156 { 167 {
@@ -180,6 +191,25 @@ struct ppc_sys_spec ppc_sys_specs[] = {
180 }, 191 },
181}; 192};
182 193
194/*
195 * mach_mpc10x_fixup: This function enables DUART mode if it detects
196 * if it detects two UARTS in the platform device entries.
197 */
198static int __init mach_mpc10x_fixup(struct platform_device *pdev)
199{
200 if (strncmp (pdev->name, "serial8250", 10) == 0 && pdev->id == 1)
201 writeb(readb(serial_plat_uart1[0].membase + 0x11) | 0x1,
202 serial_plat_uart1[0].membase + 0x11);
203 return 0;
204}
205
206static int __init mach_mpc10x_init(void)
207{
208 ppc_sys_device_fixup = mach_mpc10x_fixup;
209 return 0;
210}
211postcore_initcall(mach_mpc10x_init);
212
183/* Set resources to match bridge memory map */ 213/* Set resources to match bridge memory map */
184void __init 214void __init
185mpc10x_bridge_set_resources(int map, struct pci_controller *hose) 215mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
@@ -219,6 +249,7 @@ mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
219 ppc_md.progress("mpc10x:exit1", 0x100); 249 ppc_md.progress("mpc10x:exit1", 0x100);
220 } 250 }
221} 251}
252
222/* 253/*
223 * Do some initialization and put the EUMB registers at the specified address 254 * Do some initialization and put the EUMB registers at the specified address
224 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set). 255 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set).
@@ -411,11 +442,13 @@ mpc10x_bridge_init(struct pci_controller *hose,
411 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ; 442 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ;
412 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ; 443 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ;
413 444
414 serial_platform_data[0].mapbase += phys_eumb_base; 445 serial_plat_uart0[0].mapbase += phys_eumb_base;
415 serial_platform_data[0].irq = MPC10X_UART0_IRQ; 446 serial_plat_uart0[0].irq = MPC10X_UART0_IRQ;
447 serial_plat_uart0[0].membase = ioremap(serial_plat_uart0[0].mapbase, 0x100);
416 448
417 serial_platform_data[1].mapbase += phys_eumb_base; 449 serial_plat_uart1[0].mapbase += phys_eumb_base;
418 serial_platform_data[1].irq = MPC10X_UART0_IRQ + 1; 450 serial_plat_uart1[0].irq = MPC10X_UART1_IRQ;
451 serial_plat_uart1[0].membase = ioremap(serial_plat_uart1[0].mapbase, 0x100);
419 452
420 /* 453 /*
421 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative 454 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 75c8e9834ae7..5aaf0e58e1f9 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -191,8 +191,8 @@ struct platform_device ppc_sys_platform_devices[] = {
191 .num_resources = 2, 191 .num_resources = 2,
192 .resource = (struct resource[]) { 192 .resource = (struct resource[]) {
193 { 193 {
194 .start = 0x22000, 194 .start = 0x23000,
195 .end = 0x22fff, 195 .end = 0x23fff,
196 .flags = IORESOURCE_MEM, 196 .flags = IORESOURCE_MEM,
197 }, 197 },
198 { 198 {
@@ -208,8 +208,8 @@ struct platform_device ppc_sys_platform_devices[] = {
208 .num_resources = 2, 208 .num_resources = 2,
209 .resource = (struct resource[]) { 209 .resource = (struct resource[]) {
210 { 210 {
211 .start = 0x23000, 211 .start = 0x22000,
212 .end = 0x23fff, 212 .end = 0x22fff,
213 .flags = IORESOURCE_MEM, 213 .flags = IORESOURCE_MEM,
214 }, 214 },
215 { 215 {
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index ca95d79a704e..b7242f1bd931 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -233,14 +233,14 @@ mpc85xx_setup_pci2(struct pci_controller *hose)
233 pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff; 233 pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff;
234 /* Enable, Mem R/W */ 234 /* Enable, Mem R/W */
235 pci->powar1 = 0x80044000 | 235 pci->powar1 = 0x80044000 |
236 (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1); 236 (__ilog2(MPC85XX_PCI2_UPPER_MEM - MPC85XX_PCI2_LOWER_MEM + 1) - 1);
237 237
238 /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */ 238 /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */
239 pci->potar2 = 0x00000000; 239 pci->potar2 = 0x00000000;
240 pci->potear2 = 0x00000000; 240 pci->potear2 = 0x00000000;
241 pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff; 241 pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff;
242 /* Enable, IO R/W */ 242 /* Enable, IO R/W */
243 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1); 243 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI2_IO_SIZE) - 1);
244 244
245 /* Setup 2G inbound Memory Window @ 0 */ 245 /* Setup 2G inbound Memory Window @ 0 */
246 pci->pitar1 = 0x00000000; 246 pci->pitar1 = 0x00000000;
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index fdd8afba7152..2ce87836c671 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -288,6 +288,7 @@ config SCHED_SMT
288 overhead in some places. If unsure say N here. 288 overhead in some places. If unsure say N here.
289 289
290source "kernel/Kconfig.preempt" 290source "kernel/Kconfig.preempt"
291source kernel/Kconfig.hz
291 292
292config EEH 293config EEH
293 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 294 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
diff --git a/arch/ppc64/boot/zlib.c b/arch/ppc64/boot/zlib.c
index 9d5e4e9832d2..78837e884b8b 100644
--- a/arch/ppc64/boot/zlib.c
+++ b/arch/ppc64/boot/zlib.c
@@ -1307,7 +1307,7 @@ local int huft_build(
1307 { 1307 {
1308 *t = (inflate_huft *)Z_NULL; 1308 *t = (inflate_huft *)Z_NULL;
1309 *m = 0; 1309 *m = 0;
1310 return Z_OK; 1310 return Z_DATA_ERROR;
1311 } 1311 }
1312 1312
1313 1313
@@ -1351,6 +1351,7 @@ local int huft_build(
1351 if ((j = *p++) != 0) 1351 if ((j = *p++) != 0)
1352 v[x[j]++] = i; 1352 v[x[j]++] = i;
1353 } while (++i < n); 1353 } while (++i < n);
1354 n = x[g]; /* set n to length of v */
1354 1355
1355 1356
1356 /* Generate the Huffman codes and for each, make the table entries */ 1357 /* Generate the Huffman codes and for each, make the table entries */
diff --git a/arch/ppc64/configs/bpa_defconfig b/arch/ppc64/configs/bpa_defconfig
new file mode 100644
index 000000000000..46c5da41c3ae
--- /dev/null
+++ b/arch/ppc64/configs/bpa_defconfig
@@ -0,0 +1,987 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc6
4# Mon Aug 8 14:12:19 2005
5#
6CONFIG_64BIT=y
7CONFIG_MMU=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_GENERIC_ISA_DMA=y
11CONFIG_HAVE_DEC_LOCK=y
12CONFIG_EARLY_PRINTK=y
13CONFIG_COMPAT=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
15CONFIG_FORCE_MAX_ZONEORDER=13
16
17#
18# Code maturity level options
19#
20CONFIG_EXPERIMENTAL=y
21CONFIG_CLEAN_COMPILE=y
22CONFIG_LOCK_KERNEL=y
23CONFIG_INIT_ENV_ARG_LIMIT=32
24
25#
26# General setup
27#
28CONFIG_LOCALVERSION=""
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35CONFIG_HOTPLUG=y
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38# CONFIG_CPUSETS is not set
39# CONFIG_EMBEDDED is not set
40CONFIG_KALLSYMS=y
41# CONFIG_KALLSYMS_ALL is not set
42# CONFIG_KALLSYMS_EXTRA_PASS is not set
43CONFIG_PRINTK=y
44CONFIG_BUG=y
45CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y
47CONFIG_EPOLL=y
48CONFIG_SHMEM=y
49CONFIG_CC_ALIGN_FUNCTIONS=0
50CONFIG_CC_ALIGN_LABELS=0
51CONFIG_CC_ALIGN_LOOPS=0
52CONFIG_CC_ALIGN_JUMPS=0
53# CONFIG_TINY_SHMEM is not set
54CONFIG_BASE_SMALL=0
55
56#
57# Loadable module support
58#
59CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y
61# CONFIG_MODULE_FORCE_UNLOAD is not set
62CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set
65# CONFIG_KMOD is not set
66CONFIG_STOP_MACHINE=y
67CONFIG_SYSVIPC_COMPAT=y
68
69#
70# Platform support
71#
72# CONFIG_PPC_ISERIES is not set
73CONFIG_PPC_MULTIPLATFORM=y
74# CONFIG_PPC_PSERIES is not set
75CONFIG_PPC_BPA=y
76# CONFIG_PPC_PMAC is not set
77# CONFIG_PPC_MAPLE is not set
78CONFIG_PPC=y
79CONFIG_PPC64=y
80CONFIG_PPC_OF=y
81CONFIG_BPA_IIC=y
82CONFIG_ALTIVEC=y
83CONFIG_KEXEC=y
84# CONFIG_U3_DART is not set
85# CONFIG_BOOTX_TEXT is not set
86# CONFIG_POWER4_ONLY is not set
87# CONFIG_IOMMU_VMERGE is not set
88CONFIG_SMP=y
89CONFIG_NR_CPUS=4
90CONFIG_ARCH_SELECT_MEMORY_MODEL=y
91CONFIG_ARCH_FLATMEM_ENABLE=y
92CONFIG_SELECT_MEMORY_MODEL=y
93CONFIG_FLATMEM_MANUAL=y
94# CONFIG_DISCONTIGMEM_MANUAL is not set
95# CONFIG_SPARSEMEM_MANUAL is not set
96CONFIG_FLATMEM=y
97CONFIG_FLAT_NODE_MEM_MAP=y
98# CONFIG_NUMA is not set
99CONFIG_SCHED_SMT=y
100CONFIG_PREEMPT_NONE=y
101# CONFIG_PREEMPT_VOLUNTARY is not set
102# CONFIG_PREEMPT is not set
103CONFIG_PREEMPT_BKL=y
104# CONFIG_HZ_100 is not set
105CONFIG_HZ_250=y
106# CONFIG_HZ_1000 is not set
107CONFIG_HZ=250
108CONFIG_GENERIC_HARDIRQS=y
109CONFIG_PPC_RTAS=y
110CONFIG_RTAS_PROC=y
111CONFIG_RTAS_FLASH=y
112CONFIG_SECCOMP=y
113CONFIG_ISA_DMA_API=y
114
115#
116# General setup
117#
118CONFIG_PCI=y
119CONFIG_PCI_DOMAINS=y
120CONFIG_BINFMT_ELF=y
121# CONFIG_BINFMT_MISC is not set
122CONFIG_PCI_LEGACY_PROC=y
123CONFIG_PCI_NAMES=y
124# CONFIG_PCI_DEBUG is not set
125
126#
127# PCCARD (PCMCIA/CardBus) support
128#
129# CONFIG_PCCARD is not set
130
131#
132# PCI Hotplug Support
133#
134# CONFIG_HOTPLUG_PCI is not set
135CONFIG_PROC_DEVICETREE=y
136# CONFIG_CMDLINE_BOOL is not set
137
138#
139# Networking
140#
141CONFIG_NET=y
142
143#
144# Networking options
145#
146CONFIG_PACKET=y
147# CONFIG_PACKET_MMAP is not set
148CONFIG_UNIX=y
149CONFIG_XFRM=y
150# CONFIG_XFRM_USER is not set
151# CONFIG_NET_KEY is not set
152CONFIG_INET=y
153CONFIG_IP_MULTICAST=y
154# CONFIG_IP_ADVANCED_ROUTER is not set
155CONFIG_IP_FIB_HASH=y
156# CONFIG_IP_PNP is not set
157CONFIG_NET_IPIP=y
158# CONFIG_NET_IPGRE is not set
159# CONFIG_IP_MROUTE is not set
160# CONFIG_ARPD is not set
161CONFIG_SYN_COOKIES=y
162# CONFIG_INET_AH is not set
163# CONFIG_INET_ESP is not set
164# CONFIG_INET_IPCOMP is not set
165CONFIG_INET_TUNNEL=y
166CONFIG_IP_TCPDIAG=y
167CONFIG_IP_TCPDIAG_IPV6=y
168# CONFIG_TCP_CONG_ADVANCED is not set
169CONFIG_TCP_CONG_BIC=y
170
171#
172# IP: Virtual Server Configuration
173#
174# CONFIG_IP_VS is not set
175CONFIG_IPV6=y
176# CONFIG_IPV6_PRIVACY is not set
177CONFIG_INET6_AH=m
178CONFIG_INET6_ESP=m
179CONFIG_INET6_IPCOMP=m
180CONFIG_INET6_TUNNEL=m
181CONFIG_IPV6_TUNNEL=m
182CONFIG_NETFILTER=y
183# CONFIG_NETFILTER_DEBUG is not set
184
185#
186# IP: Netfilter Configuration
187#
188CONFIG_IP_NF_CONNTRACK=y
189# CONFIG_IP_NF_CT_ACCT is not set
190# CONFIG_IP_NF_CONNTRACK_MARK is not set
191CONFIG_IP_NF_CT_PROTO_SCTP=y
192CONFIG_IP_NF_FTP=m
193CONFIG_IP_NF_IRC=m
194CONFIG_IP_NF_TFTP=m
195CONFIG_IP_NF_AMANDA=m
196CONFIG_IP_NF_QUEUE=m
197CONFIG_IP_NF_IPTABLES=m
198CONFIG_IP_NF_MATCH_LIMIT=m
199CONFIG_IP_NF_MATCH_IPRANGE=m
200CONFIG_IP_NF_MATCH_MAC=m
201CONFIG_IP_NF_MATCH_PKTTYPE=m
202CONFIG_IP_NF_MATCH_MARK=m
203CONFIG_IP_NF_MATCH_MULTIPORT=m
204CONFIG_IP_NF_MATCH_TOS=m
205CONFIG_IP_NF_MATCH_RECENT=m
206CONFIG_IP_NF_MATCH_ECN=m
207CONFIG_IP_NF_MATCH_DSCP=m
208CONFIG_IP_NF_MATCH_AH_ESP=m
209CONFIG_IP_NF_MATCH_LENGTH=m
210CONFIG_IP_NF_MATCH_TTL=m
211CONFIG_IP_NF_MATCH_TCPMSS=m
212CONFIG_IP_NF_MATCH_HELPER=m
213CONFIG_IP_NF_MATCH_STATE=m
214CONFIG_IP_NF_MATCH_CONNTRACK=m
215CONFIG_IP_NF_MATCH_OWNER=m
216CONFIG_IP_NF_MATCH_ADDRTYPE=m
217CONFIG_IP_NF_MATCH_REALM=m
218CONFIG_IP_NF_MATCH_SCTP=m
219CONFIG_IP_NF_MATCH_COMMENT=m
220CONFIG_IP_NF_MATCH_HASHLIMIT=m
221CONFIG_IP_NF_FILTER=m
222CONFIG_IP_NF_TARGET_REJECT=m
223CONFIG_IP_NF_TARGET_LOG=m
224CONFIG_IP_NF_TARGET_ULOG=m
225CONFIG_IP_NF_TARGET_TCPMSS=m
226CONFIG_IP_NF_NAT=m
227CONFIG_IP_NF_NAT_NEEDED=y
228CONFIG_IP_NF_TARGET_MASQUERADE=m
229CONFIG_IP_NF_TARGET_REDIRECT=m
230CONFIG_IP_NF_TARGET_NETMAP=m
231CONFIG_IP_NF_TARGET_SAME=m
232CONFIG_IP_NF_NAT_SNMP_BASIC=m
233CONFIG_IP_NF_NAT_IRC=m
234CONFIG_IP_NF_NAT_FTP=m
235CONFIG_IP_NF_NAT_TFTP=m
236CONFIG_IP_NF_NAT_AMANDA=m
237CONFIG_IP_NF_MANGLE=m
238CONFIG_IP_NF_TARGET_TOS=m
239CONFIG_IP_NF_TARGET_ECN=m
240CONFIG_IP_NF_TARGET_DSCP=m
241CONFIG_IP_NF_TARGET_MARK=m
242CONFIG_IP_NF_TARGET_CLASSIFY=m
243CONFIG_IP_NF_RAW=m
244CONFIG_IP_NF_TARGET_NOTRACK=m
245CONFIG_IP_NF_ARPTABLES=m
246CONFIG_IP_NF_ARPFILTER=m
247CONFIG_IP_NF_ARP_MANGLE=m
248
249#
250# IPv6: Netfilter Configuration (EXPERIMENTAL)
251#
252# CONFIG_IP6_NF_QUEUE is not set
253# CONFIG_IP6_NF_IPTABLES is not set
254
255#
256# SCTP Configuration (EXPERIMENTAL)
257#
258# CONFIG_IP_SCTP is not set
259# CONFIG_ATM is not set
260# CONFIG_BRIDGE is not set
261# CONFIG_VLAN_8021Q is not set
262# CONFIG_DECNET is not set
263# CONFIG_LLC2 is not set
264# CONFIG_IPX is not set
265# CONFIG_ATALK is not set
266# CONFIG_X25 is not set
267# CONFIG_LAPB is not set
268# CONFIG_NET_DIVERT is not set
269# CONFIG_ECONET is not set
270# CONFIG_WAN_ROUTER is not set
271# CONFIG_NET_SCHED is not set
272CONFIG_NET_CLS_ROUTE=y
273
274#
275# Network testing
276#
277# CONFIG_NET_PKTGEN is not set
278# CONFIG_HAMRADIO is not set
279# CONFIG_IRDA is not set
280# CONFIG_BT is not set
281
282#
283# Device Drivers
284#
285
286#
287# Generic Driver Options
288#
289CONFIG_STANDALONE=y
290CONFIG_PREVENT_FIRMWARE_BUILD=y
291CONFIG_FW_LOADER=y
292# CONFIG_DEBUG_DRIVER is not set
293
294#
295# Memory Technology Devices (MTD)
296#
297# CONFIG_MTD is not set
298
299#
300# Parallel port support
301#
302# CONFIG_PARPORT is not set
303
304#
305# Plug and Play support
306#
307
308#
309# Block devices
310#
311# CONFIG_BLK_DEV_FD is not set
312# CONFIG_BLK_CPQ_DA is not set
313# CONFIG_BLK_CPQ_CISS_DA is not set
314# CONFIG_BLK_DEV_DAC960 is not set
315# CONFIG_BLK_DEV_UMEM is not set
316# CONFIG_BLK_DEV_COW_COMMON is not set
317CONFIG_BLK_DEV_LOOP=y
318# CONFIG_BLK_DEV_CRYPTOLOOP is not set
319CONFIG_BLK_DEV_NBD=y
320# CONFIG_BLK_DEV_SX8 is not set
321CONFIG_BLK_DEV_RAM=y
322CONFIG_BLK_DEV_RAM_COUNT=16
323CONFIG_BLK_DEV_RAM_SIZE=131072
324CONFIG_BLK_DEV_INITRD=y
325CONFIG_INITRAMFS_SOURCE=""
326# CONFIG_CDROM_PKTCDVD is not set
327
328#
329# IO Schedulers
330#
331CONFIG_IOSCHED_NOOP=y
332CONFIG_IOSCHED_AS=y
333CONFIG_IOSCHED_DEADLINE=y
334CONFIG_IOSCHED_CFQ=y
335# CONFIG_ATA_OVER_ETH is not set
336
337#
338# ATA/ATAPI/MFM/RLL support
339#
340CONFIG_IDE=y
341CONFIG_BLK_DEV_IDE=y
342
343#
344# Please see Documentation/ide.txt for help/info on IDE drives
345#
346# CONFIG_BLK_DEV_IDE_SATA is not set
347CONFIG_BLK_DEV_IDEDISK=y
348CONFIG_IDEDISK_MULTI_MODE=y
349# CONFIG_BLK_DEV_IDECD is not set
350# CONFIG_BLK_DEV_IDETAPE is not set
351# CONFIG_BLK_DEV_IDEFLOPPY is not set
352# CONFIG_IDE_TASK_IOCTL is not set
353
354#
355# IDE chipset support/bugfixes
356#
357CONFIG_IDE_GENERIC=y
358CONFIG_BLK_DEV_IDEPCI=y
359CONFIG_IDEPCI_SHARE_IRQ=y
360# CONFIG_BLK_DEV_OFFBOARD is not set
361CONFIG_BLK_DEV_GENERIC=y
362# CONFIG_BLK_DEV_OPTI621 is not set
363# CONFIG_BLK_DEV_SL82C105 is not set
364CONFIG_BLK_DEV_IDEDMA_PCI=y
365# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
366CONFIG_IDEDMA_PCI_AUTO=y
367# CONFIG_IDEDMA_ONLYDISK is not set
368CONFIG_BLK_DEV_AEC62XX=y
369# CONFIG_BLK_DEV_ALI15X3 is not set
370# CONFIG_BLK_DEV_AMD74XX is not set
371# CONFIG_BLK_DEV_CMD64X is not set
372# CONFIG_BLK_DEV_TRIFLEX is not set
373# CONFIG_BLK_DEV_CY82C693 is not set
374# CONFIG_BLK_DEV_CS5520 is not set
375# CONFIG_BLK_DEV_CS5530 is not set
376# CONFIG_BLK_DEV_HPT34X is not set
377# CONFIG_BLK_DEV_HPT366 is not set
378# CONFIG_BLK_DEV_SC1200 is not set
379# CONFIG_BLK_DEV_PIIX is not set
380# CONFIG_BLK_DEV_IT821X is not set
381# CONFIG_BLK_DEV_NS87415 is not set
382# CONFIG_BLK_DEV_PDC202XX_OLD is not set
383# CONFIG_BLK_DEV_PDC202XX_NEW is not set
384# CONFIG_BLK_DEV_SVWKS is not set
385CONFIG_BLK_DEV_SIIMAGE=y
386# CONFIG_BLK_DEV_SLC90E66 is not set
387# CONFIG_BLK_DEV_TRM290 is not set
388# CONFIG_BLK_DEV_VIA82CXXX is not set
389# CONFIG_IDE_ARM is not set
390CONFIG_BLK_DEV_IDEDMA=y
391# CONFIG_IDEDMA_IVB is not set
392CONFIG_IDEDMA_AUTO=y
393# CONFIG_BLK_DEV_HD is not set
394
395#
396# SCSI device support
397#
398# CONFIG_SCSI is not set
399
400#
401# Multi-device support (RAID and LVM)
402#
403# CONFIG_MD is not set
404
405#
406# Fusion MPT device support
407#
408# CONFIG_FUSION is not set
409
410#
411# IEEE 1394 (FireWire) support
412#
413# CONFIG_IEEE1394 is not set
414
415#
416# I2O device support
417#
418# CONFIG_I2O is not set
419
420#
421# Macintosh device drivers
422#
423
424#
425# Network device support
426#
427CONFIG_NETDEVICES=y
428# CONFIG_DUMMY is not set
429# CONFIG_BONDING is not set
430# CONFIG_EQUALIZER is not set
431# CONFIG_TUN is not set
432
433#
434# ARCnet devices
435#
436# CONFIG_ARCNET is not set
437
438#
439# Ethernet (10 or 100Mbit)
440#
441CONFIG_NET_ETHERNET=y
442CONFIG_MII=y
443# CONFIG_HAPPYMEAL is not set
444# CONFIG_SUNGEM is not set
445# CONFIG_NET_VENDOR_3COM is not set
446
447#
448# Tulip family network device support
449#
450# CONFIG_NET_TULIP is not set
451# CONFIG_HP100 is not set
452# CONFIG_NET_PCI is not set
453
454#
455# Ethernet (1000 Mbit)
456#
457# CONFIG_ACENIC is not set
458# CONFIG_DL2K is not set
459CONFIG_E1000=m
460# CONFIG_E1000_NAPI is not set
461# CONFIG_NS83820 is not set
462# CONFIG_HAMACHI is not set
463# CONFIG_YELLOWFIN is not set
464# CONFIG_R8169 is not set
465CONFIG_SKGE=m
466# CONFIG_SK98LIN is not set
467# CONFIG_TIGON3 is not set
468# CONFIG_BNX2 is not set
469# CONFIG_MV643XX_ETH is not set
470
471#
472# Ethernet (10000 Mbit)
473#
474# CONFIG_IXGB is not set
475# CONFIG_S2IO is not set
476
477#
478# Token Ring devices
479#
480# CONFIG_TR is not set
481
482#
483# Wireless LAN (non-hamradio)
484#
485# CONFIG_NET_RADIO is not set
486
487#
488# Wan interfaces
489#
490# CONFIG_WAN is not set
491# CONFIG_FDDI is not set
492# CONFIG_HIPPI is not set
493# CONFIG_PPP is not set
494# CONFIG_SLIP is not set
495# CONFIG_SHAPER is not set
496# CONFIG_NETCONSOLE is not set
497# CONFIG_NETPOLL is not set
498# CONFIG_NET_POLL_CONTROLLER is not set
499
500#
501# ISDN subsystem
502#
503# CONFIG_ISDN is not set
504
505#
506# Telephony Support
507#
508# CONFIG_PHONE is not set
509
510#
511# Input device support
512#
513CONFIG_INPUT=y
514
515#
516# Userland interfaces
517#
518CONFIG_INPUT_MOUSEDEV=y
519# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
520CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
521CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
522# CONFIG_INPUT_JOYDEV is not set
523# CONFIG_INPUT_TSDEV is not set
524# CONFIG_INPUT_EVDEV is not set
525# CONFIG_INPUT_EVBUG is not set
526
527#
528# Input Device Drivers
529#
530# CONFIG_INPUT_KEYBOARD is not set
531# CONFIG_INPUT_MOUSE is not set
532# CONFIG_INPUT_JOYSTICK is not set
533# CONFIG_INPUT_TOUCHSCREEN is not set
534# CONFIG_INPUT_MISC is not set
535
536#
537# Hardware I/O ports
538#
539CONFIG_SERIO=y
540# CONFIG_SERIO_I8042 is not set
541CONFIG_SERIO_SERPORT=y
542# CONFIG_SERIO_PCIPS2 is not set
543# CONFIG_SERIO_RAW is not set
544# CONFIG_GAMEPORT is not set
545
546#
547# Character devices
548#
549CONFIG_VT=y
550CONFIG_VT_CONSOLE=y
551CONFIG_HW_CONSOLE=y
552CONFIG_SERIAL_NONSTANDARD=y
553# CONFIG_ROCKETPORT is not set
554# CONFIG_CYCLADES is not set
555# CONFIG_MOXA_SMARTIO is not set
556# CONFIG_ISI is not set
557# CONFIG_SYNCLINK is not set
558# CONFIG_SYNCLINKMP is not set
559# CONFIG_N_HDLC is not set
560# CONFIG_SPECIALIX is not set
561# CONFIG_SX is not set
562# CONFIG_STALDRV is not set
563
564#
565# Serial drivers
566#
567CONFIG_SERIAL_8250=y
568CONFIG_SERIAL_8250_CONSOLE=y
569CONFIG_SERIAL_8250_NR_UARTS=4
570# CONFIG_SERIAL_8250_EXTENDED is not set
571
572#
573# Non-8250 serial port support
574#
575CONFIG_SERIAL_CORE=y
576CONFIG_SERIAL_CORE_CONSOLE=y
577# CONFIG_SERIAL_JSM is not set
578CONFIG_UNIX98_PTYS=y
579# CONFIG_LEGACY_PTYS is not set
580
581#
582# IPMI
583#
584# CONFIG_IPMI_HANDLER is not set
585
586#
587# Watchdog Cards
588#
589CONFIG_WATCHDOG=y
590# CONFIG_WATCHDOG_NOWAYOUT is not set
591
592#
593# Watchdog Device Drivers
594#
595# CONFIG_SOFT_WATCHDOG is not set
596CONFIG_WATCHDOG_RTAS=y
597
598#
599# PCI-based Watchdog Cards
600#
601# CONFIG_PCIPCWATCHDOG is not set
602# CONFIG_WDTPCI is not set
603# CONFIG_RTC is not set
604# CONFIG_DTLK is not set
605# CONFIG_R3964 is not set
606# CONFIG_APPLICOM is not set
607
608#
609# Ftape, the floppy tape device driver
610#
611# CONFIG_AGP is not set
612# CONFIG_DRM is not set
613# CONFIG_RAW_DRIVER is not set
614# CONFIG_HANGCHECK_TIMER is not set
615
616#
617# TPM devices
618#
619# CONFIG_TCG_TPM is not set
620
621#
622# I2C support
623#
624CONFIG_I2C=y
625# CONFIG_I2C_CHARDEV is not set
626
627#
628# I2C Algorithms
629#
630CONFIG_I2C_ALGOBIT=y
631# CONFIG_I2C_ALGOPCF is not set
632# CONFIG_I2C_ALGOPCA is not set
633
634#
635# I2C Hardware Bus support
636#
637# CONFIG_I2C_ALI1535 is not set
638# CONFIG_I2C_ALI1563 is not set
639# CONFIG_I2C_ALI15X3 is not set
640# CONFIG_I2C_AMD756 is not set
641# CONFIG_I2C_AMD8111 is not set
642# CONFIG_I2C_I801 is not set
643# CONFIG_I2C_I810 is not set
644# CONFIG_I2C_PIIX4 is not set
645# CONFIG_I2C_ISA is not set
646# CONFIG_I2C_NFORCE2 is not set
647# CONFIG_I2C_PARPORT_LIGHT is not set
648# CONFIG_I2C_PROSAVAGE is not set
649# CONFIG_I2C_SAVAGE4 is not set
650# CONFIG_SCx200_ACB is not set
651# CONFIG_I2C_SIS5595 is not set
652# CONFIG_I2C_SIS630 is not set
653# CONFIG_I2C_SIS96X is not set
654# CONFIG_I2C_STUB is not set
655# CONFIG_I2C_VIA is not set
656# CONFIG_I2C_VIAPRO is not set
657# CONFIG_I2C_VOODOO3 is not set
658# CONFIG_I2C_PCA_ISA is not set
659# CONFIG_I2C_SENSOR is not set
660
661#
662# Miscellaneous I2C Chip support
663#
664# CONFIG_SENSORS_DS1337 is not set
665# CONFIG_SENSORS_DS1374 is not set
666# CONFIG_SENSORS_EEPROM is not set
667# CONFIG_SENSORS_PCF8574 is not set
668# CONFIG_SENSORS_PCA9539 is not set
669# CONFIG_SENSORS_PCF8591 is not set
670# CONFIG_SENSORS_RTC8564 is not set
671# CONFIG_SENSORS_MAX6875 is not set
672# CONFIG_I2C_DEBUG_CORE is not set
673# CONFIG_I2C_DEBUG_ALGO is not set
674# CONFIG_I2C_DEBUG_BUS is not set
675# CONFIG_I2C_DEBUG_CHIP is not set
676
677#
678# Dallas's 1-wire bus
679#
680# CONFIG_W1 is not set
681
682#
683# Hardware Monitoring support
684#
685# CONFIG_HWMON is not set
686
687#
688# Misc devices
689#
690
691#
692# Multimedia devices
693#
694# CONFIG_VIDEO_DEV is not set
695
696#
697# Digital Video Broadcasting Devices
698#
699# CONFIG_DVB is not set
700
701#
702# Graphics support
703#
704# CONFIG_FB is not set
705
706#
707# Console display driver support
708#
709# CONFIG_VGA_CONSOLE is not set
710CONFIG_DUMMY_CONSOLE=y
711
712#
713# Sound
714#
715# CONFIG_SOUND is not set
716
717#
718# USB support
719#
720CONFIG_USB_ARCH_HAS_HCD=y
721CONFIG_USB_ARCH_HAS_OHCI=y
722# CONFIG_USB is not set
723
724#
725# USB Gadget Support
726#
727# CONFIG_USB_GADGET is not set
728
729#
730# MMC/SD Card support
731#
732# CONFIG_MMC is not set
733
734#
735# InfiniBand support
736#
737# CONFIG_INFINIBAND is not set
738
739#
740# SN Devices
741#
742
743#
744# File systems
745#
746CONFIG_EXT2_FS=y
747# CONFIG_EXT2_FS_XATTR is not set
748# CONFIG_EXT2_FS_XIP is not set
749CONFIG_EXT3_FS=y
750CONFIG_EXT3_FS_XATTR=y
751# CONFIG_EXT3_FS_POSIX_ACL is not set
752# CONFIG_EXT3_FS_SECURITY is not set
753CONFIG_JBD=y
754# CONFIG_JBD_DEBUG is not set
755CONFIG_FS_MBCACHE=y
756# CONFIG_REISERFS_FS is not set
757# CONFIG_JFS_FS is not set
758CONFIG_FS_POSIX_ACL=y
759
760#
761# XFS support
762#
763# CONFIG_XFS_FS is not set
764# CONFIG_MINIX_FS is not set
765# CONFIG_ROMFS_FS is not set
766CONFIG_INOTIFY=y
767# CONFIG_QUOTA is not set
768CONFIG_DNOTIFY=y
769# CONFIG_AUTOFS_FS is not set
770# CONFIG_AUTOFS4_FS is not set
771
772#
773# CD-ROM/DVD Filesystems
774#
775CONFIG_ISO9660_FS=m
776CONFIG_JOLIET=y
777# CONFIG_ZISOFS is not set
778CONFIG_UDF_FS=m
779CONFIG_UDF_NLS=y
780
781#
782# DOS/FAT/NT Filesystems
783#
784CONFIG_FAT_FS=m
785CONFIG_MSDOS_FS=m
786CONFIG_VFAT_FS=m
787CONFIG_FAT_DEFAULT_CODEPAGE=437
788CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
789# CONFIG_NTFS_FS is not set
790
791#
792# Pseudo filesystems
793#
794CONFIG_PROC_FS=y
795CONFIG_PROC_KCORE=y
796CONFIG_SYSFS=y
797# CONFIG_DEVPTS_FS_XATTR is not set
798CONFIG_TMPFS=y
799CONFIG_TMPFS_XATTR=y
800# CONFIG_TMPFS_SECURITY is not set
801CONFIG_HUGETLBFS=y
802CONFIG_HUGETLB_PAGE=y
803CONFIG_RAMFS=y
804
805#
806# Miscellaneous filesystems
807#
808# CONFIG_ADFS_FS is not set
809# CONFIG_AFFS_FS is not set
810# CONFIG_HFS_FS is not set
811# CONFIG_HFSPLUS_FS is not set
812# CONFIG_BEFS_FS is not set
813# CONFIG_BFS_FS is not set
814# CONFIG_EFS_FS is not set
815# CONFIG_CRAMFS is not set
816# CONFIG_VXFS_FS is not set
817# CONFIG_HPFS_FS is not set
818# CONFIG_QNX4FS_FS is not set
819# CONFIG_SYSV_FS is not set
820# CONFIG_UFS_FS is not set
821
822#
823# Network File Systems
824#
825CONFIG_NFS_FS=m
826CONFIG_NFS_V3=y
827CONFIG_NFS_V3_ACL=y
828# CONFIG_NFS_V4 is not set
829# CONFIG_NFS_DIRECTIO is not set
830CONFIG_NFSD=m
831CONFIG_NFSD_V2_ACL=y
832CONFIG_NFSD_V3=y
833CONFIG_NFSD_V3_ACL=y
834# CONFIG_NFSD_V4 is not set
835CONFIG_NFSD_TCP=y
836CONFIG_LOCKD=m
837CONFIG_LOCKD_V4=y
838CONFIG_EXPORTFS=m
839CONFIG_NFS_ACL_SUPPORT=m
840CONFIG_NFS_COMMON=y
841CONFIG_SUNRPC=m
842# CONFIG_RPCSEC_GSS_KRB5 is not set
843# CONFIG_RPCSEC_GSS_SPKM3 is not set
844# CONFIG_SMB_FS is not set
845# CONFIG_CIFS is not set
846# CONFIG_NCP_FS is not set
847# CONFIG_CODA_FS is not set
848# CONFIG_AFS_FS is not set
849
850#
851# Partition Types
852#
853CONFIG_PARTITION_ADVANCED=y
854# CONFIG_ACORN_PARTITION is not set
855# CONFIG_OSF_PARTITION is not set
856# CONFIG_AMIGA_PARTITION is not set
857# CONFIG_ATARI_PARTITION is not set
858# CONFIG_MAC_PARTITION is not set
859CONFIG_MSDOS_PARTITION=y
860# CONFIG_BSD_DISKLABEL is not set
861# CONFIG_MINIX_SUBPARTITION is not set
862# CONFIG_SOLARIS_X86_PARTITION is not set
863# CONFIG_UNIXWARE_DISKLABEL is not set
864# CONFIG_LDM_PARTITION is not set
865# CONFIG_SGI_PARTITION is not set
866# CONFIG_ULTRIX_PARTITION is not set
867# CONFIG_SUN_PARTITION is not set
868CONFIG_EFI_PARTITION=y
869
870#
871# Native Language Support
872#
873CONFIG_NLS=m
874CONFIG_NLS_DEFAULT="iso8859-1"
875# CONFIG_NLS_CODEPAGE_437 is not set
876# CONFIG_NLS_CODEPAGE_737 is not set
877# CONFIG_NLS_CODEPAGE_775 is not set
878# CONFIG_NLS_CODEPAGE_850 is not set
879# CONFIG_NLS_CODEPAGE_852 is not set
880# CONFIG_NLS_CODEPAGE_855 is not set
881# CONFIG_NLS_CODEPAGE_857 is not set
882# CONFIG_NLS_CODEPAGE_860 is not set
883# CONFIG_NLS_CODEPAGE_861 is not set
884# CONFIG_NLS_CODEPAGE_862 is not set
885# CONFIG_NLS_CODEPAGE_863 is not set
886# CONFIG_NLS_CODEPAGE_864 is not set
887# CONFIG_NLS_CODEPAGE_865 is not set
888# CONFIG_NLS_CODEPAGE_866 is not set
889# CONFIG_NLS_CODEPAGE_869 is not set
890# CONFIG_NLS_CODEPAGE_936 is not set
891# CONFIG_NLS_CODEPAGE_950 is not set
892# CONFIG_NLS_CODEPAGE_932 is not set
893# CONFIG_NLS_CODEPAGE_949 is not set
894# CONFIG_NLS_CODEPAGE_874 is not set
895# CONFIG_NLS_ISO8859_8 is not set
896# CONFIG_NLS_CODEPAGE_1250 is not set
897# CONFIG_NLS_CODEPAGE_1251 is not set
898# CONFIG_NLS_ASCII is not set
899CONFIG_NLS_ISO8859_1=m
900CONFIG_NLS_ISO8859_2=m
901CONFIG_NLS_ISO8859_3=m
902CONFIG_NLS_ISO8859_4=m
903CONFIG_NLS_ISO8859_5=m
904CONFIG_NLS_ISO8859_6=m
905CONFIG_NLS_ISO8859_7=m
906CONFIG_NLS_ISO8859_9=m
907CONFIG_NLS_ISO8859_13=m
908CONFIG_NLS_ISO8859_14=m
909CONFIG_NLS_ISO8859_15=m
910# CONFIG_NLS_KOI8_R is not set
911# CONFIG_NLS_KOI8_U is not set
912# CONFIG_NLS_UTF8 is not set
913
914#
915# Profiling support
916#
917# CONFIG_PROFILING is not set
918
919#
920# Kernel hacking
921#
922# CONFIG_PRINTK_TIME is not set
923CONFIG_DEBUG_KERNEL=y
924CONFIG_MAGIC_SYSRQ=y
925CONFIG_LOG_BUF_SHIFT=15
926# CONFIG_SCHEDSTATS is not set
927# CONFIG_DEBUG_SLAB is not set
928# CONFIG_DEBUG_SPINLOCK is not set
929CONFIG_DEBUG_SPINLOCK_SLEEP=y
930# CONFIG_DEBUG_KOBJECT is not set
931# CONFIG_DEBUG_INFO is not set
932CONFIG_DEBUG_FS=y
933# CONFIG_DEBUG_STACKOVERFLOW is not set
934# CONFIG_KPROBES is not set
935# CONFIG_DEBUG_STACK_USAGE is not set
936CONFIG_DEBUGGER=y
937# CONFIG_XMON is not set
938# CONFIG_PPCDBG is not set
939CONFIG_IRQSTACKS=y
940
941#
942# Security options
943#
944# CONFIG_KEYS is not set
945# CONFIG_SECURITY is not set
946
947#
948# Cryptographic options
949#
950CONFIG_CRYPTO=y
951CONFIG_CRYPTO_HMAC=y
952# CONFIG_CRYPTO_NULL is not set
953# CONFIG_CRYPTO_MD4 is not set
954CONFIG_CRYPTO_MD5=m
955CONFIG_CRYPTO_SHA1=m
956# CONFIG_CRYPTO_SHA256 is not set
957# CONFIG_CRYPTO_SHA512 is not set
958# CONFIG_CRYPTO_WP512 is not set
959# CONFIG_CRYPTO_TGR192 is not set
960CONFIG_CRYPTO_DES=m
961# CONFIG_CRYPTO_BLOWFISH is not set
962# CONFIG_CRYPTO_TWOFISH is not set
963# CONFIG_CRYPTO_SERPENT is not set
964# CONFIG_CRYPTO_AES is not set
965# CONFIG_CRYPTO_CAST5 is not set
966# CONFIG_CRYPTO_CAST6 is not set
967# CONFIG_CRYPTO_TEA is not set
968# CONFIG_CRYPTO_ARC4 is not set
969# CONFIG_CRYPTO_KHAZAD is not set
970# CONFIG_CRYPTO_ANUBIS is not set
971CONFIG_CRYPTO_DEFLATE=m
972# CONFIG_CRYPTO_MICHAEL_MIC is not set
973# CONFIG_CRYPTO_CRC32C is not set
974# CONFIG_CRYPTO_TEST is not set
975
976#
977# Hardware crypto devices
978#
979
980#
981# Library routines
982#
983# CONFIG_CRC_CCITT is not set
984CONFIG_CRC32=y
985# CONFIG_LIBCRC32C is not set
986CONFIG_ZLIB_INFLATE=m
987CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/ppc64/configs/g5_defconfig b/arch/ppc64/configs/g5_defconfig
index 1eb33398648e..ab567741e80e 100644
--- a/arch/ppc64/configs/g5_defconfig
+++ b/arch/ppc64/configs/g5_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc6
4# Tue Jun 14 16:59:20 2005 4# Mon Aug 8 14:16:59 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,12 +73,15 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75# CONFIG_PPC_PSERIES is not set 75# CONFIG_PPC_PSERIES is not set
76# CONFIG_PPC_BPA is not set
76CONFIG_PPC_PMAC=y 77CONFIG_PPC_PMAC=y
77# CONFIG_PPC_MAPLE is not set 78# CONFIG_PPC_MAPLE is not set
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_MPIC=y
81CONFIG_ALTIVEC=y 83CONFIG_ALTIVEC=y
84CONFIG_KEXEC=y
82CONFIG_U3_DART=y 85CONFIG_U3_DART=y
83CONFIG_PPC_PMAC64=y 86CONFIG_PPC_PMAC64=y
84CONFIG_BOOTX_TEXT=y 87CONFIG_BOOTX_TEXT=y
@@ -86,8 +89,24 @@ CONFIG_POWER4_ONLY=y
86CONFIG_IOMMU_VMERGE=y 89CONFIG_IOMMU_VMERGE=y
87CONFIG_SMP=y 90CONFIG_SMP=y
88CONFIG_NR_CPUS=2 91CONFIG_NR_CPUS=2
92CONFIG_ARCH_SELECT_MEMORY_MODEL=y
93CONFIG_ARCH_FLATMEM_ENABLE=y
94CONFIG_SELECT_MEMORY_MODEL=y
95CONFIG_FLATMEM_MANUAL=y
96# CONFIG_DISCONTIGMEM_MANUAL is not set
97# CONFIG_SPARSEMEM_MANUAL is not set
98CONFIG_FLATMEM=y
99CONFIG_FLAT_NODE_MEM_MAP=y
100# CONFIG_NUMA is not set
89# CONFIG_SCHED_SMT is not set 101# CONFIG_SCHED_SMT is not set
102CONFIG_PREEMPT_NONE=y
103# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set 104# CONFIG_PREEMPT is not set
105# CONFIG_PREEMPT_BKL is not set
106CONFIG_HZ_100=y
107# CONFIG_HZ_250 is not set
108# CONFIG_HZ_1000 is not set
109CONFIG_HZ=100
91CONFIG_GENERIC_HARDIRQS=y 110CONFIG_GENERIC_HARDIRQS=y
92CONFIG_SECCOMP=y 111CONFIG_SECCOMP=y
93CONFIG_ISA_DMA_API=y 112CONFIG_ISA_DMA_API=y
@@ -117,6 +136,142 @@ CONFIG_PROC_DEVICETREE=y
117# CONFIG_CMDLINE_BOOL is not set 136# CONFIG_CMDLINE_BOOL is not set
118 137
119# 138#
139# Networking
140#
141CONFIG_NET=y
142
143#
144# Networking options
145#
146CONFIG_PACKET=y
147# CONFIG_PACKET_MMAP is not set
148CONFIG_UNIX=y
149CONFIG_XFRM=y
150CONFIG_XFRM_USER=m
151CONFIG_NET_KEY=m
152CONFIG_INET=y
153CONFIG_IP_MULTICAST=y
154# CONFIG_IP_ADVANCED_ROUTER is not set
155CONFIG_IP_FIB_HASH=y
156# CONFIG_IP_PNP is not set
157CONFIG_NET_IPIP=y
158# CONFIG_NET_IPGRE is not set
159# CONFIG_IP_MROUTE is not set
160# CONFIG_ARPD is not set
161CONFIG_SYN_COOKIES=y
162CONFIG_INET_AH=m
163CONFIG_INET_ESP=m
164CONFIG_INET_IPCOMP=m
165CONFIG_INET_TUNNEL=y
166CONFIG_IP_TCPDIAG=m
167# CONFIG_IP_TCPDIAG_IPV6 is not set
168# CONFIG_TCP_CONG_ADVANCED is not set
169CONFIG_TCP_CONG_BIC=y
170
171#
172# IP: Virtual Server Configuration
173#
174# CONFIG_IP_VS is not set
175# CONFIG_IPV6 is not set
176CONFIG_NETFILTER=y
177# CONFIG_NETFILTER_DEBUG is not set
178
179#
180# IP: Netfilter Configuration
181#
182CONFIG_IP_NF_CONNTRACK=m
183CONFIG_IP_NF_CT_ACCT=y
184CONFIG_IP_NF_CONNTRACK_MARK=y
185CONFIG_IP_NF_CT_PROTO_SCTP=m
186CONFIG_IP_NF_FTP=m
187CONFIG_IP_NF_IRC=m
188CONFIG_IP_NF_TFTP=m
189CONFIG_IP_NF_AMANDA=m
190CONFIG_IP_NF_QUEUE=m
191CONFIG_IP_NF_IPTABLES=m
192CONFIG_IP_NF_MATCH_LIMIT=m
193CONFIG_IP_NF_MATCH_IPRANGE=m
194CONFIG_IP_NF_MATCH_MAC=m
195CONFIG_IP_NF_MATCH_PKTTYPE=m
196CONFIG_IP_NF_MATCH_MARK=m
197CONFIG_IP_NF_MATCH_MULTIPORT=m
198CONFIG_IP_NF_MATCH_TOS=m
199CONFIG_IP_NF_MATCH_RECENT=m
200CONFIG_IP_NF_MATCH_ECN=m
201CONFIG_IP_NF_MATCH_DSCP=m
202CONFIG_IP_NF_MATCH_AH_ESP=m
203CONFIG_IP_NF_MATCH_LENGTH=m
204CONFIG_IP_NF_MATCH_TTL=m
205CONFIG_IP_NF_MATCH_TCPMSS=m
206CONFIG_IP_NF_MATCH_HELPER=m
207CONFIG_IP_NF_MATCH_STATE=m
208CONFIG_IP_NF_MATCH_CONNTRACK=m
209CONFIG_IP_NF_MATCH_OWNER=m
210CONFIG_IP_NF_MATCH_ADDRTYPE=m
211CONFIG_IP_NF_MATCH_REALM=m
212CONFIG_IP_NF_MATCH_SCTP=m
213CONFIG_IP_NF_MATCH_COMMENT=m
214CONFIG_IP_NF_MATCH_CONNMARK=m
215CONFIG_IP_NF_MATCH_HASHLIMIT=m
216CONFIG_IP_NF_FILTER=m
217CONFIG_IP_NF_TARGET_REJECT=m
218CONFIG_IP_NF_TARGET_LOG=m
219CONFIG_IP_NF_TARGET_ULOG=m
220CONFIG_IP_NF_TARGET_TCPMSS=m
221CONFIG_IP_NF_NAT=m
222CONFIG_IP_NF_NAT_NEEDED=y
223CONFIG_IP_NF_TARGET_MASQUERADE=m
224CONFIG_IP_NF_TARGET_REDIRECT=m
225CONFIG_IP_NF_TARGET_NETMAP=m
226CONFIG_IP_NF_TARGET_SAME=m
227CONFIG_IP_NF_NAT_SNMP_BASIC=m
228CONFIG_IP_NF_NAT_IRC=m
229CONFIG_IP_NF_NAT_FTP=m
230CONFIG_IP_NF_NAT_TFTP=m
231CONFIG_IP_NF_NAT_AMANDA=m
232CONFIG_IP_NF_MANGLE=m
233CONFIG_IP_NF_TARGET_TOS=m
234CONFIG_IP_NF_TARGET_ECN=m
235CONFIG_IP_NF_TARGET_DSCP=m
236CONFIG_IP_NF_TARGET_MARK=m
237CONFIG_IP_NF_TARGET_CLASSIFY=m
238CONFIG_IP_NF_TARGET_CONNMARK=m
239CONFIG_IP_NF_TARGET_CLUSTERIP=m
240CONFIG_IP_NF_RAW=m
241CONFIG_IP_NF_TARGET_NOTRACK=m
242CONFIG_IP_NF_ARPTABLES=m
243CONFIG_IP_NF_ARPFILTER=m
244CONFIG_IP_NF_ARP_MANGLE=m
245
246#
247# SCTP Configuration (EXPERIMENTAL)
248#
249# CONFIG_IP_SCTP is not set
250# CONFIG_ATM is not set
251# CONFIG_BRIDGE is not set
252# CONFIG_VLAN_8021Q is not set
253# CONFIG_DECNET is not set
254CONFIG_LLC=y
255# CONFIG_LLC2 is not set
256# CONFIG_IPX is not set
257# CONFIG_ATALK is not set
258# CONFIG_X25 is not set
259# CONFIG_LAPB is not set
260# CONFIG_NET_DIVERT is not set
261# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set
263# CONFIG_NET_SCHED is not set
264CONFIG_NET_CLS_ROUTE=y
265
266#
267# Network testing
268#
269# CONFIG_NET_PKTGEN is not set
270# CONFIG_HAMRADIO is not set
271# CONFIG_IRDA is not set
272# CONFIG_BT is not set
273
274#
120# Device Drivers 275# Device Drivers
121# 276#
122 277
@@ -218,6 +373,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
218# CONFIG_BLK_DEV_HPT366 is not set 373# CONFIG_BLK_DEV_HPT366 is not set
219# CONFIG_BLK_DEV_SC1200 is not set 374# CONFIG_BLK_DEV_SC1200 is not set
220# CONFIG_BLK_DEV_PIIX is not set 375# CONFIG_BLK_DEV_PIIX is not set
376# CONFIG_BLK_DEV_IT821X is not set
221# CONFIG_BLK_DEV_NS87415 is not set 377# CONFIG_BLK_DEV_NS87415 is not set
222# CONFIG_BLK_DEV_PDC202XX_OLD is not set 378# CONFIG_BLK_DEV_PDC202XX_OLD is not set
223# CONFIG_BLK_DEV_PDC202XX_NEW is not set 379# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -251,6 +407,7 @@ CONFIG_CHR_DEV_ST=y
251CONFIG_BLK_DEV_SR=y 407CONFIG_BLK_DEV_SR=y
252CONFIG_BLK_DEV_SR_VENDOR=y 408CONFIG_BLK_DEV_SR_VENDOR=y
253CONFIG_CHR_DEV_SG=y 409CONFIG_CHR_DEV_SG=y
410# CONFIG_CHR_DEV_SCH is not set
254 411
255# 412#
256# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 413# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -309,6 +466,7 @@ CONFIG_SCSI_QLA2XXX=y
309# CONFIG_SCSI_QLA2300 is not set 466# CONFIG_SCSI_QLA2300 is not set
310# CONFIG_SCSI_QLA2322 is not set 467# CONFIG_SCSI_QLA2322 is not set
311# CONFIG_SCSI_QLA6312 is not set 468# CONFIG_SCSI_QLA6312 is not set
469# CONFIG_SCSI_QLA24XX is not set
312# CONFIG_SCSI_LPFC is not set 470# CONFIG_SCSI_LPFC is not set
313# CONFIG_SCSI_DC395x is not set 471# CONFIG_SCSI_DC395x is not set
314# CONFIG_SCSI_DC390T is not set 472# CONFIG_SCSI_DC390T is not set
@@ -338,6 +496,8 @@ CONFIG_DM_ZERO=m
338# Fusion MPT device support 496# Fusion MPT device support
339# 497#
340# CONFIG_FUSION is not set 498# CONFIG_FUSION is not set
499# CONFIG_FUSION_SPI is not set
500# CONFIG_FUSION_FC is not set
341 501
342# 502#
343# IEEE 1394 (FireWire) support 503# IEEE 1394 (FireWire) support
@@ -351,6 +511,7 @@ CONFIG_IEEE1394=y
351CONFIG_IEEE1394_OUI_DB=y 511CONFIG_IEEE1394_OUI_DB=y
352CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 512CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
353CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 513CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
514# CONFIG_IEEE1394_EXPORT_FULL_API is not set
354 515
355# 516#
356# Device Drivers 517# Device Drivers
@@ -377,152 +538,14 @@ CONFIG_IEEE1394_RAWIO=y
377# 538#
378# Macintosh device drivers 539# Macintosh device drivers
379# 540#
380CONFIG_ADB=y
381CONFIG_ADB_PMU=y 541CONFIG_ADB_PMU=y
382CONFIG_PMAC_SMU=y 542CONFIG_PMAC_SMU=y
383# CONFIG_PMAC_PBOOK is not set
384# CONFIG_PMAC_BACKLIGHT is not set 543# CONFIG_PMAC_BACKLIGHT is not set
385# CONFIG_INPUT_ADBHID is not set
386CONFIG_THERM_PM72=y 544CONFIG_THERM_PM72=y
387 545
388# 546#
389# Networking support 547# Network device support
390#
391CONFIG_NET=y
392
393#
394# Networking options
395# 548#
396CONFIG_PACKET=y
397# CONFIG_PACKET_MMAP is not set
398CONFIG_UNIX=y
399CONFIG_NET_KEY=m
400CONFIG_INET=y
401CONFIG_IP_MULTICAST=y
402# CONFIG_IP_ADVANCED_ROUTER is not set
403# CONFIG_IP_PNP is not set
404CONFIG_NET_IPIP=y
405# CONFIG_NET_IPGRE is not set
406# CONFIG_IP_MROUTE is not set
407# CONFIG_ARPD is not set
408CONFIG_SYN_COOKIES=y
409CONFIG_INET_AH=m
410CONFIG_INET_ESP=m
411CONFIG_INET_IPCOMP=m
412CONFIG_INET_TUNNEL=y
413CONFIG_IP_TCPDIAG=m
414# CONFIG_IP_TCPDIAG_IPV6 is not set
415
416#
417# IP: Virtual Server Configuration
418#
419# CONFIG_IP_VS is not set
420# CONFIG_IPV6 is not set
421CONFIG_NETFILTER=y
422# CONFIG_NETFILTER_DEBUG is not set
423
424#
425# IP: Netfilter Configuration
426#
427CONFIG_IP_NF_CONNTRACK=m
428CONFIG_IP_NF_CT_ACCT=y
429CONFIG_IP_NF_CONNTRACK_MARK=y
430CONFIG_IP_NF_CT_PROTO_SCTP=m
431CONFIG_IP_NF_FTP=m
432CONFIG_IP_NF_IRC=m
433CONFIG_IP_NF_TFTP=m
434CONFIG_IP_NF_AMANDA=m
435CONFIG_IP_NF_QUEUE=m
436CONFIG_IP_NF_IPTABLES=m
437CONFIG_IP_NF_MATCH_LIMIT=m
438CONFIG_IP_NF_MATCH_IPRANGE=m
439CONFIG_IP_NF_MATCH_MAC=m
440CONFIG_IP_NF_MATCH_PKTTYPE=m
441CONFIG_IP_NF_MATCH_MARK=m
442CONFIG_IP_NF_MATCH_MULTIPORT=m
443CONFIG_IP_NF_MATCH_TOS=m
444CONFIG_IP_NF_MATCH_RECENT=m
445CONFIG_IP_NF_MATCH_ECN=m
446CONFIG_IP_NF_MATCH_DSCP=m
447CONFIG_IP_NF_MATCH_AH_ESP=m
448CONFIG_IP_NF_MATCH_LENGTH=m
449CONFIG_IP_NF_MATCH_TTL=m
450CONFIG_IP_NF_MATCH_TCPMSS=m
451CONFIG_IP_NF_MATCH_HELPER=m
452CONFIG_IP_NF_MATCH_STATE=m
453CONFIG_IP_NF_MATCH_CONNTRACK=m
454CONFIG_IP_NF_MATCH_OWNER=m
455CONFIG_IP_NF_MATCH_ADDRTYPE=m
456CONFIG_IP_NF_MATCH_REALM=m
457CONFIG_IP_NF_MATCH_SCTP=m
458CONFIG_IP_NF_MATCH_COMMENT=m
459CONFIG_IP_NF_MATCH_CONNMARK=m
460CONFIG_IP_NF_MATCH_HASHLIMIT=m
461CONFIG_IP_NF_FILTER=m
462CONFIG_IP_NF_TARGET_REJECT=m
463CONFIG_IP_NF_TARGET_LOG=m
464CONFIG_IP_NF_TARGET_ULOG=m
465CONFIG_IP_NF_TARGET_TCPMSS=m
466CONFIG_IP_NF_NAT=m
467CONFIG_IP_NF_NAT_NEEDED=y
468CONFIG_IP_NF_TARGET_MASQUERADE=m
469CONFIG_IP_NF_TARGET_REDIRECT=m
470CONFIG_IP_NF_TARGET_NETMAP=m
471CONFIG_IP_NF_TARGET_SAME=m
472CONFIG_IP_NF_NAT_SNMP_BASIC=m
473CONFIG_IP_NF_NAT_IRC=m
474CONFIG_IP_NF_NAT_FTP=m
475CONFIG_IP_NF_NAT_TFTP=m
476CONFIG_IP_NF_NAT_AMANDA=m
477CONFIG_IP_NF_MANGLE=m
478CONFIG_IP_NF_TARGET_TOS=m
479CONFIG_IP_NF_TARGET_ECN=m
480CONFIG_IP_NF_TARGET_DSCP=m
481CONFIG_IP_NF_TARGET_MARK=m
482CONFIG_IP_NF_TARGET_CLASSIFY=m
483CONFIG_IP_NF_TARGET_CONNMARK=m
484CONFIG_IP_NF_TARGET_CLUSTERIP=m
485CONFIG_IP_NF_RAW=m
486CONFIG_IP_NF_TARGET_NOTRACK=m
487CONFIG_IP_NF_ARPTABLES=m
488CONFIG_IP_NF_ARPFILTER=m
489CONFIG_IP_NF_ARP_MANGLE=m
490CONFIG_XFRM=y
491CONFIG_XFRM_USER=m
492
493#
494# SCTP Configuration (EXPERIMENTAL)
495#
496# CONFIG_IP_SCTP is not set
497# CONFIG_ATM is not set
498# CONFIG_BRIDGE is not set
499# CONFIG_VLAN_8021Q is not set
500# CONFIG_DECNET is not set
501CONFIG_LLC=y
502# CONFIG_LLC2 is not set
503# CONFIG_IPX is not set
504# CONFIG_ATALK is not set
505# CONFIG_X25 is not set
506# CONFIG_LAPB is not set
507# CONFIG_NET_DIVERT is not set
508# CONFIG_ECONET is not set
509# CONFIG_WAN_ROUTER is not set
510
511#
512# QoS and/or fair queueing
513#
514# CONFIG_NET_SCHED is not set
515CONFIG_NET_CLS_ROUTE=y
516
517#
518# Network testing
519#
520# CONFIG_NET_PKTGEN is not set
521# CONFIG_NETPOLL is not set
522# CONFIG_NET_POLL_CONTROLLER is not set
523# CONFIG_HAMRADIO is not set
524# CONFIG_IRDA is not set
525# CONFIG_BT is not set
526CONFIG_NETDEVICES=y 549CONFIG_NETDEVICES=y
527CONFIG_DUMMY=m 550CONFIG_DUMMY=m
528CONFIG_BONDING=m 551CONFIG_BONDING=m
@@ -562,6 +585,7 @@ CONFIG_E1000=y
562# CONFIG_HAMACHI is not set 585# CONFIG_HAMACHI is not set
563# CONFIG_YELLOWFIN is not set 586# CONFIG_YELLOWFIN is not set
564# CONFIG_R8169 is not set 587# CONFIG_R8169 is not set
588# CONFIG_SKGE is not set
565# CONFIG_SK98LIN is not set 589# CONFIG_SK98LIN is not set
566CONFIG_TIGON3=m 590CONFIG_TIGON3=m
567# CONFIG_BNX2 is not set 591# CONFIG_BNX2 is not set
@@ -604,6 +628,8 @@ CONFIG_PPPOE=m
604# CONFIG_NET_FC is not set 628# CONFIG_NET_FC is not set
605# CONFIG_SHAPER is not set 629# CONFIG_SHAPER is not set
606# CONFIG_NETCONSOLE is not set 630# CONFIG_NETCONSOLE is not set
631# CONFIG_NETPOLL is not set
632# CONFIG_NET_POLL_CONTROLLER is not set
607 633
608# 634#
609# ISDN subsystem 635# ISDN subsystem
@@ -691,7 +717,6 @@ CONFIG_LEGACY_PTY_COUNT=256
691# 717#
692# CONFIG_WATCHDOG is not set 718# CONFIG_WATCHDOG is not set
693# CONFIG_RTC is not set 719# CONFIG_RTC is not set
694# CONFIG_GEN_RTC is not set
695# CONFIG_DTLK is not set 720# CONFIG_DTLK is not set
696# CONFIG_R3964 is not set 721# CONFIG_R3964 is not set
697# CONFIG_APPLICOM is not set 722# CONFIG_APPLICOM is not set
@@ -750,50 +775,19 @@ CONFIG_I2C_KEYWEST=y
750# CONFIG_I2C_VIAPRO is not set 775# CONFIG_I2C_VIAPRO is not set
751# CONFIG_I2C_VOODOO3 is not set 776# CONFIG_I2C_VOODOO3 is not set
752# CONFIG_I2C_PCA_ISA is not set 777# CONFIG_I2C_PCA_ISA is not set
778# CONFIG_I2C_SENSOR is not set
753 779
754# 780#
755# Hardware Sensors Chip support 781# Miscellaneous I2C Chip support
756#
757# CONFIG_I2C_SENSOR is not set
758# CONFIG_SENSORS_ADM1021 is not set
759# CONFIG_SENSORS_ADM1025 is not set
760# CONFIG_SENSORS_ADM1026 is not set
761# CONFIG_SENSORS_ADM1031 is not set
762# CONFIG_SENSORS_ASB100 is not set
763# CONFIG_SENSORS_DS1621 is not set
764# CONFIG_SENSORS_FSCHER is not set
765# CONFIG_SENSORS_FSCPOS is not set
766# CONFIG_SENSORS_GL518SM is not set
767# CONFIG_SENSORS_GL520SM is not set
768# CONFIG_SENSORS_IT87 is not set
769# CONFIG_SENSORS_LM63 is not set
770# CONFIG_SENSORS_LM75 is not set
771# CONFIG_SENSORS_LM77 is not set
772# CONFIG_SENSORS_LM78 is not set
773# CONFIG_SENSORS_LM80 is not set
774# CONFIG_SENSORS_LM83 is not set
775# CONFIG_SENSORS_LM85 is not set
776# CONFIG_SENSORS_LM87 is not set
777# CONFIG_SENSORS_LM90 is not set
778# CONFIG_SENSORS_LM92 is not set
779# CONFIG_SENSORS_MAX1619 is not set
780# CONFIG_SENSORS_PC87360 is not set
781# CONFIG_SENSORS_SMSC47B397 is not set
782# CONFIG_SENSORS_SIS5595 is not set
783# CONFIG_SENSORS_SMSC47M1 is not set
784# CONFIG_SENSORS_VIA686A is not set
785# CONFIG_SENSORS_W83781D is not set
786# CONFIG_SENSORS_W83L785TS is not set
787# CONFIG_SENSORS_W83627HF is not set
788
789#
790# Other I2C Chip support
791# 782#
792# CONFIG_SENSORS_DS1337 is not set 783# CONFIG_SENSORS_DS1337 is not set
784# CONFIG_SENSORS_DS1374 is not set
793# CONFIG_SENSORS_EEPROM is not set 785# CONFIG_SENSORS_EEPROM is not set
794# CONFIG_SENSORS_PCF8574 is not set 786# CONFIG_SENSORS_PCF8574 is not set
787# CONFIG_SENSORS_PCA9539 is not set
795# CONFIG_SENSORS_PCF8591 is not set 788# CONFIG_SENSORS_PCF8591 is not set
796# CONFIG_SENSORS_RTC8564 is not set 789# CONFIG_SENSORS_RTC8564 is not set
790# CONFIG_SENSORS_MAX6875 is not set
797# CONFIG_I2C_DEBUG_CORE is not set 791# CONFIG_I2C_DEBUG_CORE is not set
798# CONFIG_I2C_DEBUG_ALGO is not set 792# CONFIG_I2C_DEBUG_ALGO is not set
799# CONFIG_I2C_DEBUG_BUS is not set 793# CONFIG_I2C_DEBUG_BUS is not set
@@ -805,6 +799,11 @@ CONFIG_I2C_KEYWEST=y
805# CONFIG_W1 is not set 799# CONFIG_W1 is not set
806 800
807# 801#
802# Hardware Monitoring support
803#
804# CONFIG_HWMON is not set
805
806#
808# Misc devices 807# Misc devices
809# 808#
810 809
@@ -911,6 +910,7 @@ CONFIG_USB_DEVICEFS=y
911CONFIG_USB_EHCI_HCD=y 910CONFIG_USB_EHCI_HCD=y
912# CONFIG_USB_EHCI_SPLIT_ISO is not set 911# CONFIG_USB_EHCI_SPLIT_ISO is not set
913# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 912# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
913# CONFIG_USB_ISP116X_HCD is not set
914CONFIG_USB_OHCI_HCD=y 914CONFIG_USB_OHCI_HCD=y
915# CONFIG_USB_OHCI_BIG_ENDIAN is not set 915# CONFIG_USB_OHCI_BIG_ENDIAN is not set
916CONFIG_USB_OHCI_LITTLE_ENDIAN=y 916CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -950,12 +950,15 @@ CONFIG_THRUSTMASTER_FF=y
950CONFIG_USB_HIDDEV=y 950CONFIG_USB_HIDDEV=y
951# CONFIG_USB_AIPTEK is not set 951# CONFIG_USB_AIPTEK is not set
952# CONFIG_USB_WACOM is not set 952# CONFIG_USB_WACOM is not set
953# CONFIG_USB_ACECAD is not set
953# CONFIG_USB_KBTAB is not set 954# CONFIG_USB_KBTAB is not set
954# CONFIG_USB_POWERMATE is not set 955# CONFIG_USB_POWERMATE is not set
955# CONFIG_USB_MTOUCH is not set 956# CONFIG_USB_MTOUCH is not set
957# CONFIG_USB_ITMTOUCH is not set
956# CONFIG_USB_EGALAX is not set 958# CONFIG_USB_EGALAX is not set
957# CONFIG_USB_XPAD is not set 959# CONFIG_USB_XPAD is not set
958# CONFIG_USB_ATI_REMOTE is not set 960# CONFIG_USB_ATI_REMOTE is not set
961# CONFIG_USB_KEYSPAN_REMOTE is not set
959 962
960# 963#
961# USB Imaging devices 964# USB Imaging devices
@@ -1071,10 +1074,11 @@ CONFIG_USB_EZUSB=y
1071# CONFIG_USB_PHIDGETSERVO is not set 1074# CONFIG_USB_PHIDGETSERVO is not set
1072# CONFIG_USB_IDMOUSE is not set 1075# CONFIG_USB_IDMOUSE is not set
1073# CONFIG_USB_SISUSBVGA is not set 1076# CONFIG_USB_SISUSBVGA is not set
1077# CONFIG_USB_LD is not set
1074# CONFIG_USB_TEST is not set 1078# CONFIG_USB_TEST is not set
1075 1079
1076# 1080#
1077# USB ATM/DSL drivers 1081# USB DSL modem support
1078# 1082#
1079 1083
1080# 1084#
@@ -1093,12 +1097,18 @@ CONFIG_USB_EZUSB=y
1093# CONFIG_INFINIBAND is not set 1097# CONFIG_INFINIBAND is not set
1094 1098
1095# 1099#
1100# SN Devices
1101#
1102
1103#
1096# File systems 1104# File systems
1097# 1105#
1098CONFIG_EXT2_FS=y 1106CONFIG_EXT2_FS=y
1099CONFIG_EXT2_FS_XATTR=y 1107CONFIG_EXT2_FS_XATTR=y
1100CONFIG_EXT2_FS_POSIX_ACL=y 1108CONFIG_EXT2_FS_POSIX_ACL=y
1101CONFIG_EXT2_FS_SECURITY=y 1109CONFIG_EXT2_FS_SECURITY=y
1110CONFIG_EXT2_FS_XIP=y
1111CONFIG_FS_XIP=y
1102CONFIG_EXT3_FS=y 1112CONFIG_EXT3_FS=y
1103CONFIG_EXT3_FS_XATTR=y 1113CONFIG_EXT3_FS_XATTR=y
1104CONFIG_EXT3_FS_POSIX_ACL=y 1114CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1126,6 +1136,7 @@ CONFIG_XFS_SECURITY=y
1126CONFIG_XFS_POSIX_ACL=y 1136CONFIG_XFS_POSIX_ACL=y
1127# CONFIG_MINIX_FS is not set 1137# CONFIG_MINIX_FS is not set
1128# CONFIG_ROMFS_FS is not set 1138# CONFIG_ROMFS_FS is not set
1139CONFIG_INOTIFY=y
1129# CONFIG_QUOTA is not set 1140# CONFIG_QUOTA is not set
1130CONFIG_DNOTIFY=y 1141CONFIG_DNOTIFY=y
1131CONFIG_AUTOFS_FS=m 1142CONFIG_AUTOFS_FS=m
@@ -1157,7 +1168,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1157CONFIG_PROC_FS=y 1168CONFIG_PROC_FS=y
1158CONFIG_PROC_KCORE=y 1169CONFIG_PROC_KCORE=y
1159CONFIG_SYSFS=y 1170CONFIG_SYSFS=y
1160# CONFIG_DEVFS_FS is not set
1161CONFIG_DEVPTS_FS_XATTR=y 1171CONFIG_DEVPTS_FS_XATTR=y
1162# CONFIG_DEVPTS_FS_SECURITY is not set 1172# CONFIG_DEVPTS_FS_SECURITY is not set
1163CONFIG_TMPFS=y 1173CONFIG_TMPFS=y
@@ -1189,15 +1199,20 @@ CONFIG_CRAMFS=y
1189# 1199#
1190CONFIG_NFS_FS=y 1200CONFIG_NFS_FS=y
1191CONFIG_NFS_V3=y 1201CONFIG_NFS_V3=y
1202CONFIG_NFS_V3_ACL=y
1192CONFIG_NFS_V4=y 1203CONFIG_NFS_V4=y
1193# CONFIG_NFS_DIRECTIO is not set 1204# CONFIG_NFS_DIRECTIO is not set
1194CONFIG_NFSD=y 1205CONFIG_NFSD=y
1206CONFIG_NFSD_V2_ACL=y
1195CONFIG_NFSD_V3=y 1207CONFIG_NFSD_V3=y
1208CONFIG_NFSD_V3_ACL=y
1196CONFIG_NFSD_V4=y 1209CONFIG_NFSD_V4=y
1197CONFIG_NFSD_TCP=y 1210CONFIG_NFSD_TCP=y
1198CONFIG_LOCKD=y 1211CONFIG_LOCKD=y
1199CONFIG_LOCKD_V4=y 1212CONFIG_LOCKD_V4=y
1200CONFIG_EXPORTFS=y 1213CONFIG_EXPORTFS=y
1214CONFIG_NFS_ACL_SUPPORT=y
1215CONFIG_NFS_COMMON=y
1201CONFIG_SUNRPC=y 1216CONFIG_SUNRPC=y
1202CONFIG_SUNRPC_GSS=y 1217CONFIG_SUNRPC_GSS=y
1203CONFIG_RPCSEC_GSS_KRB5=y 1218CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig
index f6a2b99afd63..394ba18b58c7 100644
--- a/arch/ppc64/configs/iSeries_defconfig
+++ b/arch/ppc64/configs/iSeries_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc6
4# Tue Jun 14 17:01:28 2005 4# Mon Aug 8 14:17:02 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -80,8 +80,24 @@ CONFIG_IBMVIO=y
80CONFIG_IOMMU_VMERGE=y 80CONFIG_IOMMU_VMERGE=y
81CONFIG_SMP=y 81CONFIG_SMP=y
82CONFIG_NR_CPUS=32 82CONFIG_NR_CPUS=32
83CONFIG_ARCH_SELECT_MEMORY_MODEL=y
84CONFIG_ARCH_FLATMEM_ENABLE=y
85CONFIG_SELECT_MEMORY_MODEL=y
86CONFIG_FLATMEM_MANUAL=y
87# CONFIG_DISCONTIGMEM_MANUAL is not set
88# CONFIG_SPARSEMEM_MANUAL is not set
89CONFIG_FLATMEM=y
90CONFIG_FLAT_NODE_MEM_MAP=y
91# CONFIG_NUMA is not set
83# CONFIG_SCHED_SMT is not set 92# CONFIG_SCHED_SMT is not set
93CONFIG_PREEMPT_NONE=y
94# CONFIG_PREEMPT_VOLUNTARY is not set
84# CONFIG_PREEMPT is not set 95# CONFIG_PREEMPT is not set
96# CONFIG_PREEMPT_BKL is not set
97CONFIG_HZ_100=y
98# CONFIG_HZ_250 is not set
99# CONFIG_HZ_1000 is not set
100CONFIG_HZ=100
85CONFIG_GENERIC_HARDIRQS=y 101CONFIG_GENERIC_HARDIRQS=y
86CONFIG_MSCHUNKS=y 102CONFIG_MSCHUNKS=y
87CONFIG_LPARCFG=y 103CONFIG_LPARCFG=y
@@ -110,6 +126,142 @@ CONFIG_PCI_NAMES=y
110# CONFIG_HOTPLUG_PCI is not set 126# CONFIG_HOTPLUG_PCI is not set
111 127
112# 128#
129# Networking
130#
131CONFIG_NET=y
132
133#
134# Networking options
135#
136CONFIG_PACKET=y
137# CONFIG_PACKET_MMAP is not set
138CONFIG_UNIX=y
139CONFIG_XFRM=y
140CONFIG_XFRM_USER=m
141CONFIG_NET_KEY=m
142CONFIG_INET=y
143CONFIG_IP_MULTICAST=y
144# CONFIG_IP_ADVANCED_ROUTER is not set
145CONFIG_IP_FIB_HASH=y
146# CONFIG_IP_PNP is not set
147CONFIG_NET_IPIP=y
148# CONFIG_NET_IPGRE is not set
149# CONFIG_IP_MROUTE is not set
150# CONFIG_ARPD is not set
151CONFIG_SYN_COOKIES=y
152CONFIG_INET_AH=m
153CONFIG_INET_ESP=m
154CONFIG_INET_IPCOMP=m
155CONFIG_INET_TUNNEL=y
156CONFIG_IP_TCPDIAG=m
157# CONFIG_IP_TCPDIAG_IPV6 is not set
158# CONFIG_TCP_CONG_ADVANCED is not set
159CONFIG_TCP_CONG_BIC=y
160
161#
162# IP: Virtual Server Configuration
163#
164# CONFIG_IP_VS is not set
165# CONFIG_IPV6 is not set
166CONFIG_NETFILTER=y
167# CONFIG_NETFILTER_DEBUG is not set
168
169#
170# IP: Netfilter Configuration
171#
172CONFIG_IP_NF_CONNTRACK=m
173CONFIG_IP_NF_CT_ACCT=y
174CONFIG_IP_NF_CONNTRACK_MARK=y
175CONFIG_IP_NF_CT_PROTO_SCTP=m
176CONFIG_IP_NF_FTP=m
177CONFIG_IP_NF_IRC=m
178CONFIG_IP_NF_TFTP=m
179CONFIG_IP_NF_AMANDA=m
180CONFIG_IP_NF_QUEUE=m
181CONFIG_IP_NF_IPTABLES=m
182CONFIG_IP_NF_MATCH_LIMIT=m
183CONFIG_IP_NF_MATCH_IPRANGE=m
184CONFIG_IP_NF_MATCH_MAC=m
185CONFIG_IP_NF_MATCH_PKTTYPE=m
186CONFIG_IP_NF_MATCH_MARK=m
187CONFIG_IP_NF_MATCH_MULTIPORT=m
188CONFIG_IP_NF_MATCH_TOS=m
189CONFIG_IP_NF_MATCH_RECENT=m
190CONFIG_IP_NF_MATCH_ECN=m
191CONFIG_IP_NF_MATCH_DSCP=m
192CONFIG_IP_NF_MATCH_AH_ESP=m
193CONFIG_IP_NF_MATCH_LENGTH=m
194CONFIG_IP_NF_MATCH_TTL=m
195CONFIG_IP_NF_MATCH_TCPMSS=m
196CONFIG_IP_NF_MATCH_HELPER=m
197CONFIG_IP_NF_MATCH_STATE=m
198CONFIG_IP_NF_MATCH_CONNTRACK=m
199CONFIG_IP_NF_MATCH_OWNER=m
200CONFIG_IP_NF_MATCH_ADDRTYPE=m
201CONFIG_IP_NF_MATCH_REALM=m
202CONFIG_IP_NF_MATCH_SCTP=m
203CONFIG_IP_NF_MATCH_COMMENT=m
204CONFIG_IP_NF_MATCH_CONNMARK=m
205CONFIG_IP_NF_MATCH_HASHLIMIT=m
206CONFIG_IP_NF_FILTER=m
207CONFIG_IP_NF_TARGET_REJECT=m
208CONFIG_IP_NF_TARGET_LOG=m
209CONFIG_IP_NF_TARGET_ULOG=m
210CONFIG_IP_NF_TARGET_TCPMSS=m
211CONFIG_IP_NF_NAT=m
212CONFIG_IP_NF_NAT_NEEDED=y
213CONFIG_IP_NF_TARGET_MASQUERADE=m
214CONFIG_IP_NF_TARGET_REDIRECT=m
215CONFIG_IP_NF_TARGET_NETMAP=m
216CONFIG_IP_NF_TARGET_SAME=m
217CONFIG_IP_NF_NAT_SNMP_BASIC=m
218CONFIG_IP_NF_NAT_IRC=m
219CONFIG_IP_NF_NAT_FTP=m
220CONFIG_IP_NF_NAT_TFTP=m
221CONFIG_IP_NF_NAT_AMANDA=m
222CONFIG_IP_NF_MANGLE=m
223CONFIG_IP_NF_TARGET_TOS=m
224CONFIG_IP_NF_TARGET_ECN=m
225CONFIG_IP_NF_TARGET_DSCP=m
226CONFIG_IP_NF_TARGET_MARK=m
227CONFIG_IP_NF_TARGET_CLASSIFY=m
228CONFIG_IP_NF_TARGET_CONNMARK=m
229CONFIG_IP_NF_TARGET_CLUSTERIP=m
230CONFIG_IP_NF_RAW=m
231CONFIG_IP_NF_TARGET_NOTRACK=m
232CONFIG_IP_NF_ARPTABLES=m
233CONFIG_IP_NF_ARPFILTER=m
234CONFIG_IP_NF_ARP_MANGLE=m
235
236#
237# SCTP Configuration (EXPERIMENTAL)
238#
239# CONFIG_IP_SCTP is not set
240# CONFIG_ATM is not set
241# CONFIG_BRIDGE is not set
242# CONFIG_VLAN_8021Q is not set
243# CONFIG_DECNET is not set
244CONFIG_LLC=y
245# CONFIG_LLC2 is not set
246# CONFIG_IPX is not set
247# CONFIG_ATALK is not set
248# CONFIG_X25 is not set
249# CONFIG_LAPB is not set
250# CONFIG_NET_DIVERT is not set
251# CONFIG_ECONET is not set
252# CONFIG_WAN_ROUTER is not set
253# CONFIG_NET_SCHED is not set
254CONFIG_NET_CLS_ROUTE=y
255
256#
257# Network testing
258#
259# CONFIG_NET_PKTGEN is not set
260# CONFIG_HAMRADIO is not set
261# CONFIG_IRDA is not set
262# CONFIG_BT is not set
263
264#
113# Device Drivers 265# Device Drivers
114# 266#
115 267
@@ -184,6 +336,7 @@ CONFIG_CHR_DEV_ST=y
184CONFIG_BLK_DEV_SR=y 336CONFIG_BLK_DEV_SR=y
185CONFIG_BLK_DEV_SR_VENDOR=y 337CONFIG_BLK_DEV_SR_VENDOR=y
186CONFIG_CHR_DEV_SG=y 338CONFIG_CHR_DEV_SG=y
339# CONFIG_CHR_DEV_SCH is not set
187 340
188# 341#
189# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 342# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -231,6 +384,7 @@ CONFIG_SCSI_QLA2XXX=y
231# CONFIG_SCSI_QLA2300 is not set 384# CONFIG_SCSI_QLA2300 is not set
232# CONFIG_SCSI_QLA2322 is not set 385# CONFIG_SCSI_QLA2322 is not set
233# CONFIG_SCSI_QLA6312 is not set 386# CONFIG_SCSI_QLA6312 is not set
387# CONFIG_SCSI_QLA24XX is not set
234# CONFIG_SCSI_LPFC is not set 388# CONFIG_SCSI_LPFC is not set
235# CONFIG_SCSI_DC395x is not set 389# CONFIG_SCSI_DC395x is not set
236# CONFIG_SCSI_DC390T is not set 390# CONFIG_SCSI_DC390T is not set
@@ -260,6 +414,8 @@ CONFIG_DM_ZERO=m
260# Fusion MPT device support 414# Fusion MPT device support
261# 415#
262# CONFIG_FUSION is not set 416# CONFIG_FUSION is not set
417# CONFIG_FUSION_SPI is not set
418# CONFIG_FUSION_FC is not set
263 419
264# 420#
265# IEEE 1394 (FireWire) support 421# IEEE 1394 (FireWire) support
@@ -276,145 +432,8 @@ CONFIG_DM_ZERO=m
276# 432#
277 433
278# 434#
279# Networking support 435# Network device support
280#
281CONFIG_NET=y
282
283#
284# Networking options
285#
286CONFIG_PACKET=y
287# CONFIG_PACKET_MMAP is not set
288CONFIG_UNIX=y
289CONFIG_NET_KEY=m
290CONFIG_INET=y
291CONFIG_IP_MULTICAST=y
292# CONFIG_IP_ADVANCED_ROUTER is not set
293# CONFIG_IP_PNP is not set
294CONFIG_NET_IPIP=y
295# CONFIG_NET_IPGRE is not set
296# CONFIG_IP_MROUTE is not set
297# CONFIG_ARPD is not set
298CONFIG_SYN_COOKIES=y
299CONFIG_INET_AH=m
300CONFIG_INET_ESP=m
301CONFIG_INET_IPCOMP=m
302CONFIG_INET_TUNNEL=y
303CONFIG_IP_TCPDIAG=m
304# CONFIG_IP_TCPDIAG_IPV6 is not set
305
306#
307# IP: Virtual Server Configuration
308#
309# CONFIG_IP_VS is not set
310# CONFIG_IPV6 is not set
311CONFIG_NETFILTER=y
312# CONFIG_NETFILTER_DEBUG is not set
313
314# 436#
315# IP: Netfilter Configuration
316#
317CONFIG_IP_NF_CONNTRACK=m
318CONFIG_IP_NF_CT_ACCT=y
319CONFIG_IP_NF_CONNTRACK_MARK=y
320CONFIG_IP_NF_CT_PROTO_SCTP=m
321CONFIG_IP_NF_FTP=m
322CONFIG_IP_NF_IRC=m
323CONFIG_IP_NF_TFTP=m
324CONFIG_IP_NF_AMANDA=m
325CONFIG_IP_NF_QUEUE=m
326CONFIG_IP_NF_IPTABLES=m
327CONFIG_IP_NF_MATCH_LIMIT=m
328CONFIG_IP_NF_MATCH_IPRANGE=m
329CONFIG_IP_NF_MATCH_MAC=m
330CONFIG_IP_NF_MATCH_PKTTYPE=m
331CONFIG_IP_NF_MATCH_MARK=m
332CONFIG_IP_NF_MATCH_MULTIPORT=m
333CONFIG_IP_NF_MATCH_TOS=m
334CONFIG_IP_NF_MATCH_RECENT=m
335CONFIG_IP_NF_MATCH_ECN=m
336CONFIG_IP_NF_MATCH_DSCP=m
337CONFIG_IP_NF_MATCH_AH_ESP=m
338CONFIG_IP_NF_MATCH_LENGTH=m
339CONFIG_IP_NF_MATCH_TTL=m
340CONFIG_IP_NF_MATCH_TCPMSS=m
341CONFIG_IP_NF_MATCH_HELPER=m
342CONFIG_IP_NF_MATCH_STATE=m
343CONFIG_IP_NF_MATCH_CONNTRACK=m
344CONFIG_IP_NF_MATCH_OWNER=m
345CONFIG_IP_NF_MATCH_ADDRTYPE=m
346CONFIG_IP_NF_MATCH_REALM=m
347CONFIG_IP_NF_MATCH_SCTP=m
348CONFIG_IP_NF_MATCH_COMMENT=m
349CONFIG_IP_NF_MATCH_CONNMARK=m
350CONFIG_IP_NF_MATCH_HASHLIMIT=m
351CONFIG_IP_NF_FILTER=m
352CONFIG_IP_NF_TARGET_REJECT=m
353CONFIG_IP_NF_TARGET_LOG=m
354CONFIG_IP_NF_TARGET_ULOG=m
355CONFIG_IP_NF_TARGET_TCPMSS=m
356CONFIG_IP_NF_NAT=m
357CONFIG_IP_NF_NAT_NEEDED=y
358CONFIG_IP_NF_TARGET_MASQUERADE=m
359CONFIG_IP_NF_TARGET_REDIRECT=m
360CONFIG_IP_NF_TARGET_NETMAP=m
361CONFIG_IP_NF_TARGET_SAME=m
362CONFIG_IP_NF_NAT_SNMP_BASIC=m
363CONFIG_IP_NF_NAT_IRC=m
364CONFIG_IP_NF_NAT_FTP=m
365CONFIG_IP_NF_NAT_TFTP=m
366CONFIG_IP_NF_NAT_AMANDA=m
367CONFIG_IP_NF_MANGLE=m
368CONFIG_IP_NF_TARGET_TOS=m
369CONFIG_IP_NF_TARGET_ECN=m
370CONFIG_IP_NF_TARGET_DSCP=m
371CONFIG_IP_NF_TARGET_MARK=m
372CONFIG_IP_NF_TARGET_CLASSIFY=m
373CONFIG_IP_NF_TARGET_CONNMARK=m
374CONFIG_IP_NF_TARGET_CLUSTERIP=m
375CONFIG_IP_NF_RAW=m
376CONFIG_IP_NF_TARGET_NOTRACK=m
377CONFIG_IP_NF_ARPTABLES=m
378CONFIG_IP_NF_ARPFILTER=m
379CONFIG_IP_NF_ARP_MANGLE=m
380CONFIG_XFRM=y
381CONFIG_XFRM_USER=m
382
383#
384# SCTP Configuration (EXPERIMENTAL)
385#
386# CONFIG_IP_SCTP is not set
387# CONFIG_ATM is not set
388# CONFIG_BRIDGE is not set
389# CONFIG_VLAN_8021Q is not set
390# CONFIG_DECNET is not set
391CONFIG_LLC=y
392# CONFIG_LLC2 is not set
393# CONFIG_IPX is not set
394# CONFIG_ATALK is not set
395# CONFIG_X25 is not set
396# CONFIG_LAPB is not set
397# CONFIG_NET_DIVERT is not set
398# CONFIG_ECONET is not set
399# CONFIG_WAN_ROUTER is not set
400
401#
402# QoS and/or fair queueing
403#
404# CONFIG_NET_SCHED is not set
405CONFIG_NET_CLS_ROUTE=y
406
407#
408# Network testing
409#
410# CONFIG_NET_PKTGEN is not set
411CONFIG_NETPOLL=y
412CONFIG_NETPOLL_RX=y
413CONFIG_NETPOLL_TRAP=y
414CONFIG_NET_POLL_CONTROLLER=y
415# CONFIG_HAMRADIO is not set
416# CONFIG_IRDA is not set
417# CONFIG_BT is not set
418CONFIG_NETDEVICES=y 437CONFIG_NETDEVICES=y
419CONFIG_DUMMY=m 438CONFIG_DUMMY=m
420CONFIG_BONDING=m 439CONFIG_BONDING=m
@@ -471,6 +490,7 @@ CONFIG_E1000=m
471# CONFIG_HAMACHI is not set 490# CONFIG_HAMACHI is not set
472# CONFIG_YELLOWFIN is not set 491# CONFIG_YELLOWFIN is not set
473# CONFIG_R8169 is not set 492# CONFIG_R8169 is not set
493# CONFIG_SKGE is not set
474# CONFIG_SK98LIN is not set 494# CONFIG_SK98LIN is not set
475# CONFIG_VIA_VELOCITY is not set 495# CONFIG_VIA_VELOCITY is not set
476# CONFIG_TIGON3 is not set 496# CONFIG_TIGON3 is not set
@@ -514,6 +534,10 @@ CONFIG_PPPOE=m
514# CONFIG_NET_FC is not set 534# CONFIG_NET_FC is not set
515# CONFIG_SHAPER is not set 535# CONFIG_SHAPER is not set
516CONFIG_NETCONSOLE=y 536CONFIG_NETCONSOLE=y
537CONFIG_NETPOLL=y
538CONFIG_NETPOLL_RX=y
539CONFIG_NETPOLL_TRAP=y
540CONFIG_NET_POLL_CONTROLLER=y
517 541
518# 542#
519# ISDN subsystem 543# ISDN subsystem
@@ -587,7 +611,6 @@ CONFIG_LEGACY_PTY_COUNT=256
587# 611#
588# CONFIG_WATCHDOG is not set 612# CONFIG_WATCHDOG is not set
589# CONFIG_RTC is not set 613# CONFIG_RTC is not set
590# CONFIG_GEN_RTC is not set
591# CONFIG_DTLK is not set 614# CONFIG_DTLK is not set
592# CONFIG_R3964 is not set 615# CONFIG_R3964 is not set
593# CONFIG_APPLICOM is not set 616# CONFIG_APPLICOM is not set
@@ -610,6 +633,7 @@ CONFIG_MAX_RAW_DEVS=256
610# I2C support 633# I2C support
611# 634#
612# CONFIG_I2C is not set 635# CONFIG_I2C is not set
636# CONFIG_I2C_SENSOR is not set
613 637
614# 638#
615# Dallas's 1-wire bus 639# Dallas's 1-wire bus
@@ -617,6 +641,11 @@ CONFIG_MAX_RAW_DEVS=256
617# CONFIG_W1 is not set 641# CONFIG_W1 is not set
618 642
619# 643#
644# Hardware Monitoring support
645#
646# CONFIG_HWMON is not set
647
648#
620# Misc devices 649# Misc devices
621# 650#
622 651
@@ -663,12 +692,18 @@ CONFIG_USB_ARCH_HAS_OHCI=y
663# CONFIG_INFINIBAND is not set 692# CONFIG_INFINIBAND is not set
664 693
665# 694#
695# SN Devices
696#
697
698#
666# File systems 699# File systems
667# 700#
668CONFIG_EXT2_FS=y 701CONFIG_EXT2_FS=y
669CONFIG_EXT2_FS_XATTR=y 702CONFIG_EXT2_FS_XATTR=y
670CONFIG_EXT2_FS_POSIX_ACL=y 703CONFIG_EXT2_FS_POSIX_ACL=y
671CONFIG_EXT2_FS_SECURITY=y 704CONFIG_EXT2_FS_SECURITY=y
705CONFIG_EXT2_FS_XIP=y
706CONFIG_FS_XIP=y
672CONFIG_EXT3_FS=y 707CONFIG_EXT3_FS=y
673CONFIG_EXT3_FS_XATTR=y 708CONFIG_EXT3_FS_XATTR=y
674CONFIG_EXT3_FS_POSIX_ACL=y 709CONFIG_EXT3_FS_POSIX_ACL=y
@@ -700,6 +735,7 @@ CONFIG_XFS_SECURITY=y
700CONFIG_XFS_POSIX_ACL=y 735CONFIG_XFS_POSIX_ACL=y
701# CONFIG_MINIX_FS is not set 736# CONFIG_MINIX_FS is not set
702# CONFIG_ROMFS_FS is not set 737# CONFIG_ROMFS_FS is not set
738CONFIG_INOTIFY=y
703# CONFIG_QUOTA is not set 739# CONFIG_QUOTA is not set
704CONFIG_DNOTIFY=y 740CONFIG_DNOTIFY=y
705CONFIG_AUTOFS_FS=m 741CONFIG_AUTOFS_FS=m
@@ -731,7 +767,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
731CONFIG_PROC_FS=y 767CONFIG_PROC_FS=y
732CONFIG_PROC_KCORE=y 768CONFIG_PROC_KCORE=y
733CONFIG_SYSFS=y 769CONFIG_SYSFS=y
734# CONFIG_DEVFS_FS is not set
735CONFIG_DEVPTS_FS_XATTR=y 770CONFIG_DEVPTS_FS_XATTR=y
736CONFIG_DEVPTS_FS_SECURITY=y 771CONFIG_DEVPTS_FS_SECURITY=y
737CONFIG_TMPFS=y 772CONFIG_TMPFS=y
@@ -763,15 +798,20 @@ CONFIG_CRAMFS=y
763# 798#
764CONFIG_NFS_FS=y 799CONFIG_NFS_FS=y
765CONFIG_NFS_V3=y 800CONFIG_NFS_V3=y
801CONFIG_NFS_V3_ACL=y
766CONFIG_NFS_V4=y 802CONFIG_NFS_V4=y
767# CONFIG_NFS_DIRECTIO is not set 803# CONFIG_NFS_DIRECTIO is not set
768CONFIG_NFSD=m 804CONFIG_NFSD=m
805CONFIG_NFSD_V2_ACL=y
769CONFIG_NFSD_V3=y 806CONFIG_NFSD_V3=y
807CONFIG_NFSD_V3_ACL=y
770CONFIG_NFSD_V4=y 808CONFIG_NFSD_V4=y
771CONFIG_NFSD_TCP=y 809CONFIG_NFSD_TCP=y
772CONFIG_LOCKD=y 810CONFIG_LOCKD=y
773CONFIG_LOCKD_V4=y 811CONFIG_LOCKD_V4=y
774CONFIG_EXPORTFS=m 812CONFIG_EXPORTFS=m
813CONFIG_NFS_ACL_SUPPORT=y
814CONFIG_NFS_COMMON=y
775CONFIG_SUNRPC=y 815CONFIG_SUNRPC=y
776CONFIG_SUNRPC_GSS=y 816CONFIG_SUNRPC_GSS=y
777CONFIG_RPCSEC_GSS_KRB5=y 817CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/maple_defconfig b/arch/ppc64/configs/maple_defconfig
index 8051b0f47b6f..2033fe663dbe 100644
--- a/arch/ppc64/configs/maple_defconfig
+++ b/arch/ppc64/configs/maple_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc6
4# Tue Jun 14 17:12:48 2005 4# Mon Aug 8 14:17:04 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,12 +73,15 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75# CONFIG_PPC_PSERIES is not set 75# CONFIG_PPC_PSERIES is not set
76# CONFIG_PPC_BPA is not set
76# CONFIG_PPC_PMAC is not set 77# CONFIG_PPC_PMAC is not set
77CONFIG_PPC_MAPLE=y 78CONFIG_PPC_MAPLE=y
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_MPIC=y
81# CONFIG_ALTIVEC is not set 83# CONFIG_ALTIVEC is not set
84CONFIG_KEXEC=y
82CONFIG_U3_DART=y 85CONFIG_U3_DART=y
83CONFIG_MPIC_BROKEN_U3=y 86CONFIG_MPIC_BROKEN_U3=y
84CONFIG_BOOTX_TEXT=y 87CONFIG_BOOTX_TEXT=y
@@ -86,8 +89,24 @@ CONFIG_POWER4_ONLY=y
86CONFIG_IOMMU_VMERGE=y 89CONFIG_IOMMU_VMERGE=y
87CONFIG_SMP=y 90CONFIG_SMP=y
88CONFIG_NR_CPUS=2 91CONFIG_NR_CPUS=2
92CONFIG_ARCH_SELECT_MEMORY_MODEL=y
93CONFIG_ARCH_FLATMEM_ENABLE=y
94CONFIG_SELECT_MEMORY_MODEL=y
95CONFIG_FLATMEM_MANUAL=y
96# CONFIG_DISCONTIGMEM_MANUAL is not set
97# CONFIG_SPARSEMEM_MANUAL is not set
98CONFIG_FLATMEM=y
99CONFIG_FLAT_NODE_MEM_MAP=y
100# CONFIG_NUMA is not set
89# CONFIG_SCHED_SMT is not set 101# CONFIG_SCHED_SMT is not set
102CONFIG_PREEMPT_NONE=y
103# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set 104# CONFIG_PREEMPT is not set
105# CONFIG_PREEMPT_BKL is not set
106CONFIG_HZ_100=y
107# CONFIG_HZ_250 is not set
108# CONFIG_HZ_1000 is not set
109CONFIG_HZ=100
91CONFIG_GENERIC_HARDIRQS=y 110CONFIG_GENERIC_HARDIRQS=y
92CONFIG_SECCOMP=y 111CONFIG_SECCOMP=y
93CONFIG_ISA_DMA_API=y 112CONFIG_ISA_DMA_API=y
@@ -116,6 +135,69 @@ CONFIG_PROC_DEVICETREE=y
116# CONFIG_CMDLINE_BOOL is not set 135# CONFIG_CMDLINE_BOOL is not set
117 136
118# 137#
138# Networking
139#
140CONFIG_NET=y
141
142#
143# Networking options
144#
145CONFIG_PACKET=y
146CONFIG_PACKET_MMAP=y
147CONFIG_UNIX=y
148# CONFIG_NET_KEY is not set
149CONFIG_INET=y
150CONFIG_IP_MULTICAST=y
151# CONFIG_IP_ADVANCED_ROUTER is not set
152CONFIG_IP_FIB_HASH=y
153CONFIG_IP_PNP=y
154CONFIG_IP_PNP_DHCP=y
155# CONFIG_IP_PNP_BOOTP is not set
156# CONFIG_IP_PNP_RARP is not set
157# CONFIG_NET_IPIP is not set
158# CONFIG_NET_IPGRE is not set
159# CONFIG_IP_MROUTE is not set
160# CONFIG_ARPD is not set
161# CONFIG_SYN_COOKIES is not set
162# CONFIG_INET_AH is not set
163# CONFIG_INET_ESP is not set
164# CONFIG_INET_IPCOMP is not set
165# CONFIG_INET_TUNNEL is not set
166CONFIG_IP_TCPDIAG=y
167# CONFIG_IP_TCPDIAG_IPV6 is not set
168# CONFIG_TCP_CONG_ADVANCED is not set
169CONFIG_TCP_CONG_BIC=y
170# CONFIG_IPV6 is not set
171# CONFIG_NETFILTER is not set
172
173#
174# SCTP Configuration (EXPERIMENTAL)
175#
176# CONFIG_IP_SCTP is not set
177# CONFIG_ATM is not set
178# CONFIG_BRIDGE is not set
179# CONFIG_VLAN_8021Q is not set
180# CONFIG_DECNET is not set
181# CONFIG_LLC2 is not set
182# CONFIG_IPX is not set
183# CONFIG_ATALK is not set
184# CONFIG_X25 is not set
185# CONFIG_LAPB is not set
186# CONFIG_NET_DIVERT is not set
187# CONFIG_ECONET is not set
188# CONFIG_WAN_ROUTER is not set
189# CONFIG_NET_SCHED is not set
190# CONFIG_NET_CLS_ROUTE is not set
191
192#
193# Network testing
194#
195# CONFIG_NET_PKTGEN is not set
196# CONFIG_HAMRADIO is not set
197# CONFIG_IRDA is not set
198# CONFIG_BT is not set
199
200#
119# Device Drivers 201# Device Drivers
120# 202#
121 203
@@ -213,6 +295,7 @@ CONFIG_BLK_DEV_AMD74XX=y
213# CONFIG_BLK_DEV_HPT366 is not set 295# CONFIG_BLK_DEV_HPT366 is not set
214# CONFIG_BLK_DEV_SC1200 is not set 296# CONFIG_BLK_DEV_SC1200 is not set
215# CONFIG_BLK_DEV_PIIX is not set 297# CONFIG_BLK_DEV_PIIX is not set
298# CONFIG_BLK_DEV_IT821X is not set
216# CONFIG_BLK_DEV_NS87415 is not set 299# CONFIG_BLK_DEV_NS87415 is not set
217# CONFIG_BLK_DEV_PDC202XX_OLD is not set 300# CONFIG_BLK_DEV_PDC202XX_OLD is not set
218# CONFIG_BLK_DEV_PDC202XX_NEW is not set 301# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -240,6 +323,7 @@ CONFIG_IDEDMA_AUTO=y
240# 323#
241# Fusion MPT device support 324# Fusion MPT device support
242# 325#
326# CONFIG_FUSION is not set
243 327
244# 328#
245# IEEE 1394 (FireWire) support 329# IEEE 1394 (FireWire) support
@@ -256,70 +340,8 @@ CONFIG_IDEDMA_AUTO=y
256# 340#
257 341
258# 342#
259# Networking support 343# Network device support
260#
261CONFIG_NET=y
262
263#
264# Networking options
265# 344#
266CONFIG_PACKET=y
267CONFIG_PACKET_MMAP=y
268CONFIG_UNIX=y
269# CONFIG_NET_KEY is not set
270CONFIG_INET=y
271CONFIG_IP_MULTICAST=y
272# CONFIG_IP_ADVANCED_ROUTER is not set
273CONFIG_IP_PNP=y
274CONFIG_IP_PNP_DHCP=y
275# CONFIG_IP_PNP_BOOTP is not set
276# CONFIG_IP_PNP_RARP is not set
277# CONFIG_NET_IPIP is not set
278# CONFIG_NET_IPGRE is not set
279# CONFIG_IP_MROUTE is not set
280# CONFIG_ARPD is not set
281# CONFIG_SYN_COOKIES is not set
282# CONFIG_INET_AH is not set
283# CONFIG_INET_ESP is not set
284# CONFIG_INET_IPCOMP is not set
285# CONFIG_INET_TUNNEL is not set
286CONFIG_IP_TCPDIAG=y
287# CONFIG_IP_TCPDIAG_IPV6 is not set
288# CONFIG_IPV6 is not set
289# CONFIG_NETFILTER is not set
290
291#
292# SCTP Configuration (EXPERIMENTAL)
293#
294# CONFIG_IP_SCTP is not set
295# CONFIG_ATM is not set
296# CONFIG_BRIDGE is not set
297# CONFIG_VLAN_8021Q is not set
298# CONFIG_DECNET is not set
299# CONFIG_LLC2 is not set
300# CONFIG_IPX is not set
301# CONFIG_ATALK is not set
302# CONFIG_X25 is not set
303# CONFIG_LAPB is not set
304# CONFIG_NET_DIVERT is not set
305# CONFIG_ECONET is not set
306# CONFIG_WAN_ROUTER is not set
307
308#
309# QoS and/or fair queueing
310#
311# CONFIG_NET_SCHED is not set
312# CONFIG_NET_CLS_ROUTE is not set
313
314#
315# Network testing
316#
317# CONFIG_NET_PKTGEN is not set
318# CONFIG_NETPOLL is not set
319# CONFIG_NET_POLL_CONTROLLER is not set
320# CONFIG_HAMRADIO is not set
321# CONFIG_IRDA is not set
322# CONFIG_BT is not set
323CONFIG_NETDEVICES=y 345CONFIG_NETDEVICES=y
324# CONFIG_DUMMY is not set 346# CONFIG_DUMMY is not set
325# CONFIG_BONDING is not set 347# CONFIG_BONDING is not set
@@ -376,6 +398,7 @@ CONFIG_E1000=y
376# CONFIG_HAMACHI is not set 398# CONFIG_HAMACHI is not set
377# CONFIG_YELLOWFIN is not set 399# CONFIG_YELLOWFIN is not set
378# CONFIG_R8169 is not set 400# CONFIG_R8169 is not set
401# CONFIG_SKGE is not set
379# CONFIG_SK98LIN is not set 402# CONFIG_SK98LIN is not set
380# CONFIG_VIA_VELOCITY is not set 403# CONFIG_VIA_VELOCITY is not set
381# CONFIG_TIGON3 is not set 404# CONFIG_TIGON3 is not set
@@ -408,6 +431,8 @@ CONFIG_E1000=y
408# CONFIG_SLIP is not set 431# CONFIG_SLIP is not set
409# CONFIG_SHAPER is not set 432# CONFIG_SHAPER is not set
410# CONFIG_NETCONSOLE is not set 433# CONFIG_NETCONSOLE is not set
434# CONFIG_NETPOLL is not set
435# CONFIG_NET_POLL_CONTROLLER is not set
411 436
412# 437#
413# ISDN subsystem 438# ISDN subsystem
@@ -487,7 +512,6 @@ CONFIG_LEGACY_PTY_COUNT=256
487# 512#
488# CONFIG_WATCHDOG is not set 513# CONFIG_WATCHDOG is not set
489# CONFIG_RTC is not set 514# CONFIG_RTC is not set
490# CONFIG_GEN_RTC is not set
491# CONFIG_DTLK is not set 515# CONFIG_DTLK is not set
492# CONFIG_R3964 is not set 516# CONFIG_R3964 is not set
493# CONFIG_APPLICOM is not set 517# CONFIG_APPLICOM is not set
@@ -543,50 +567,19 @@ CONFIG_I2C_AMD8111=y
543# CONFIG_I2C_VIAPRO is not set 567# CONFIG_I2C_VIAPRO is not set
544# CONFIG_I2C_VOODOO3 is not set 568# CONFIG_I2C_VOODOO3 is not set
545# CONFIG_I2C_PCA_ISA is not set 569# CONFIG_I2C_PCA_ISA is not set
570# CONFIG_I2C_SENSOR is not set
546 571
547# 572#
548# Hardware Sensors Chip support 573# Miscellaneous I2C Chip support
549#
550# CONFIG_I2C_SENSOR is not set
551# CONFIG_SENSORS_ADM1021 is not set
552# CONFIG_SENSORS_ADM1025 is not set
553# CONFIG_SENSORS_ADM1026 is not set
554# CONFIG_SENSORS_ADM1031 is not set
555# CONFIG_SENSORS_ASB100 is not set
556# CONFIG_SENSORS_DS1621 is not set
557# CONFIG_SENSORS_FSCHER is not set
558# CONFIG_SENSORS_FSCPOS is not set
559# CONFIG_SENSORS_GL518SM is not set
560# CONFIG_SENSORS_GL520SM is not set
561# CONFIG_SENSORS_IT87 is not set
562# CONFIG_SENSORS_LM63 is not set
563# CONFIG_SENSORS_LM75 is not set
564# CONFIG_SENSORS_LM77 is not set
565# CONFIG_SENSORS_LM78 is not set
566# CONFIG_SENSORS_LM80 is not set
567# CONFIG_SENSORS_LM83 is not set
568# CONFIG_SENSORS_LM85 is not set
569# CONFIG_SENSORS_LM87 is not set
570# CONFIG_SENSORS_LM90 is not set
571# CONFIG_SENSORS_LM92 is not set
572# CONFIG_SENSORS_MAX1619 is not set
573# CONFIG_SENSORS_PC87360 is not set
574# CONFIG_SENSORS_SMSC47B397 is not set
575# CONFIG_SENSORS_SIS5595 is not set
576# CONFIG_SENSORS_SMSC47M1 is not set
577# CONFIG_SENSORS_VIA686A is not set
578# CONFIG_SENSORS_W83781D is not set
579# CONFIG_SENSORS_W83L785TS is not set
580# CONFIG_SENSORS_W83627HF is not set
581
582#
583# Other I2C Chip support
584# 574#
585# CONFIG_SENSORS_DS1337 is not set 575# CONFIG_SENSORS_DS1337 is not set
576# CONFIG_SENSORS_DS1374 is not set
586# CONFIG_SENSORS_EEPROM is not set 577# CONFIG_SENSORS_EEPROM is not set
587# CONFIG_SENSORS_PCF8574 is not set 578# CONFIG_SENSORS_PCF8574 is not set
579# CONFIG_SENSORS_PCA9539 is not set
588# CONFIG_SENSORS_PCF8591 is not set 580# CONFIG_SENSORS_PCF8591 is not set
589# CONFIG_SENSORS_RTC8564 is not set 581# CONFIG_SENSORS_RTC8564 is not set
582# CONFIG_SENSORS_MAX6875 is not set
590# CONFIG_I2C_DEBUG_CORE is not set 583# CONFIG_I2C_DEBUG_CORE is not set
591# CONFIG_I2C_DEBUG_ALGO is not set 584# CONFIG_I2C_DEBUG_ALGO is not set
592# CONFIG_I2C_DEBUG_BUS is not set 585# CONFIG_I2C_DEBUG_BUS is not set
@@ -598,6 +591,11 @@ CONFIG_I2C_AMD8111=y
598# CONFIG_W1 is not set 591# CONFIG_W1 is not set
599 592
600# 593#
594# Hardware Monitoring support
595#
596# CONFIG_HWMON is not set
597
598#
601# Misc devices 599# Misc devices
602# 600#
603 601
@@ -649,6 +647,7 @@ CONFIG_USB_DEVICEFS=y
649CONFIG_USB_EHCI_HCD=y 647CONFIG_USB_EHCI_HCD=y
650CONFIG_USB_EHCI_SPLIT_ISO=y 648CONFIG_USB_EHCI_SPLIT_ISO=y
651CONFIG_USB_EHCI_ROOT_HUB_TT=y 649CONFIG_USB_EHCI_ROOT_HUB_TT=y
650# CONFIG_USB_ISP116X_HCD is not set
652CONFIG_USB_OHCI_HCD=y 651CONFIG_USB_OHCI_HCD=y
653# CONFIG_USB_OHCI_BIG_ENDIAN is not set 652# CONFIG_USB_OHCI_BIG_ENDIAN is not set
654CONFIG_USB_OHCI_LITTLE_ENDIAN=y 653CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -676,12 +675,15 @@ CONFIG_USB_HIDINPUT=y
676# CONFIG_USB_HIDDEV is not set 675# CONFIG_USB_HIDDEV is not set
677# CONFIG_USB_AIPTEK is not set 676# CONFIG_USB_AIPTEK is not set
678# CONFIG_USB_WACOM is not set 677# CONFIG_USB_WACOM is not set
678# CONFIG_USB_ACECAD is not set
679# CONFIG_USB_KBTAB is not set 679# CONFIG_USB_KBTAB is not set
680# CONFIG_USB_POWERMATE is not set 680# CONFIG_USB_POWERMATE is not set
681# CONFIG_USB_MTOUCH is not set 681# CONFIG_USB_MTOUCH is not set
682# CONFIG_USB_ITMTOUCH is not set
682# CONFIG_USB_EGALAX is not set 683# CONFIG_USB_EGALAX is not set
683# CONFIG_USB_XPAD is not set 684# CONFIG_USB_XPAD is not set
684# CONFIG_USB_ATI_REMOTE is not set 685# CONFIG_USB_ATI_REMOTE is not set
686# CONFIG_USB_KEYSPAN_REMOTE is not set
685 687
686# 688#
687# USB Imaging devices 689# USB Imaging devices
@@ -772,10 +774,11 @@ CONFIG_USB_EZUSB=y
772# CONFIG_USB_PHIDGETSERVO is not set 774# CONFIG_USB_PHIDGETSERVO is not set
773# CONFIG_USB_IDMOUSE is not set 775# CONFIG_USB_IDMOUSE is not set
774# CONFIG_USB_SISUSBVGA is not set 776# CONFIG_USB_SISUSBVGA is not set
777# CONFIG_USB_LD is not set
775# CONFIG_USB_TEST is not set 778# CONFIG_USB_TEST is not set
776 779
777# 780#
778# USB ATM/DSL drivers 781# USB DSL modem support
779# 782#
780 783
781# 784#
@@ -794,16 +797,23 @@ CONFIG_USB_EZUSB=y
794# CONFIG_INFINIBAND is not set 797# CONFIG_INFINIBAND is not set
795 798
796# 799#
800# SN Devices
801#
802
803#
797# File systems 804# File systems
798# 805#
799CONFIG_EXT2_FS=y 806CONFIG_EXT2_FS=y
800# CONFIG_EXT2_FS_XATTR is not set 807# CONFIG_EXT2_FS_XATTR is not set
808CONFIG_EXT2_FS_XIP=y
809CONFIG_FS_XIP=y
801CONFIG_EXT3_FS=y 810CONFIG_EXT3_FS=y
802# CONFIG_EXT3_FS_XATTR is not set 811# CONFIG_EXT3_FS_XATTR is not set
803CONFIG_JBD=y 812CONFIG_JBD=y
804# CONFIG_JBD_DEBUG is not set 813# CONFIG_JBD_DEBUG is not set
805# CONFIG_REISERFS_FS is not set 814# CONFIG_REISERFS_FS is not set
806# CONFIG_JFS_FS is not set 815# CONFIG_JFS_FS is not set
816CONFIG_FS_POSIX_ACL=y
807 817
808# 818#
809# XFS support 819# XFS support
@@ -811,6 +821,7 @@ CONFIG_JBD=y
811# CONFIG_XFS_FS is not set 821# CONFIG_XFS_FS is not set
812# CONFIG_MINIX_FS is not set 822# CONFIG_MINIX_FS is not set
813# CONFIG_ROMFS_FS is not set 823# CONFIG_ROMFS_FS is not set
824CONFIG_INOTIFY=y
814# CONFIG_QUOTA is not set 825# CONFIG_QUOTA is not set
815CONFIG_DNOTIFY=y 826CONFIG_DNOTIFY=y
816# CONFIG_AUTOFS_FS is not set 827# CONFIG_AUTOFS_FS is not set
@@ -838,7 +849,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
838CONFIG_PROC_FS=y 849CONFIG_PROC_FS=y
839CONFIG_PROC_KCORE=y 850CONFIG_PROC_KCORE=y
840CONFIG_SYSFS=y 851CONFIG_SYSFS=y
841# CONFIG_DEVFS_FS is not set
842CONFIG_DEVPTS_FS_XATTR=y 852CONFIG_DEVPTS_FS_XATTR=y
843# CONFIG_DEVPTS_FS_SECURITY is not set 853# CONFIG_DEVPTS_FS_SECURITY is not set
844CONFIG_TMPFS=y 854CONFIG_TMPFS=y
@@ -870,12 +880,15 @@ CONFIG_CRAMFS=y
870# 880#
871CONFIG_NFS_FS=y 881CONFIG_NFS_FS=y
872CONFIG_NFS_V3=y 882CONFIG_NFS_V3=y
883CONFIG_NFS_V3_ACL=y
873CONFIG_NFS_V4=y 884CONFIG_NFS_V4=y
874# CONFIG_NFS_DIRECTIO is not set 885# CONFIG_NFS_DIRECTIO is not set
875# CONFIG_NFSD is not set 886# CONFIG_NFSD is not set
876CONFIG_ROOT_NFS=y 887CONFIG_ROOT_NFS=y
877CONFIG_LOCKD=y 888CONFIG_LOCKD=y
878CONFIG_LOCKD_V4=y 889CONFIG_LOCKD_V4=y
890CONFIG_NFS_ACL_SUPPORT=y
891CONFIG_NFS_COMMON=y
879CONFIG_SUNRPC=y 892CONFIG_SUNRPC=y
880CONFIG_SUNRPC_GSS=y 893CONFIG_SUNRPC_GSS=y
881CONFIG_RPCSEC_GSS_KRB5=y 894CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/pSeries_defconfig b/arch/ppc64/configs/pSeries_defconfig
index d0db8b5966c0..297fd5229487 100644
--- a/arch/ppc64/configs/pSeries_defconfig
+++ b/arch/ppc64/configs/pSeries_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc6
4# Tue Jun 14 17:13:47 2005 4# Mon Aug 8 14:17:07 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -74,13 +74,17 @@ CONFIG_SYSVIPC_COMPAT=y
74# CONFIG_PPC_ISERIES is not set 74# CONFIG_PPC_ISERIES is not set
75CONFIG_PPC_MULTIPLATFORM=y 75CONFIG_PPC_MULTIPLATFORM=y
76CONFIG_PPC_PSERIES=y 76CONFIG_PPC_PSERIES=y
77# CONFIG_PPC_BPA is not set
77# CONFIG_PPC_PMAC is not set 78# CONFIG_PPC_PMAC is not set
78# CONFIG_PPC_MAPLE is not set 79# CONFIG_PPC_MAPLE is not set
79CONFIG_PPC=y 80CONFIG_PPC=y
80CONFIG_PPC64=y 81CONFIG_PPC64=y
81CONFIG_PPC_OF=y 82CONFIG_PPC_OF=y
83CONFIG_XICS=y
84CONFIG_MPIC=y
82CONFIG_ALTIVEC=y 85CONFIG_ALTIVEC=y
83CONFIG_PPC_SPLPAR=y 86CONFIG_PPC_SPLPAR=y
87CONFIG_KEXEC=y
84CONFIG_IBMVIO=y 88CONFIG_IBMVIO=y
85# CONFIG_U3_DART is not set 89# CONFIG_U3_DART is not set
86# CONFIG_BOOTX_TEXT is not set 90# CONFIG_BOOTX_TEXT is not set
@@ -88,10 +92,30 @@ CONFIG_IBMVIO=y
88CONFIG_IOMMU_VMERGE=y 92CONFIG_IOMMU_VMERGE=y
89CONFIG_SMP=y 93CONFIG_SMP=y
90CONFIG_NR_CPUS=128 94CONFIG_NR_CPUS=128
95CONFIG_ARCH_SELECT_MEMORY_MODEL=y
96CONFIG_ARCH_FLATMEM_ENABLE=y
91CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 97CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
98CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
99CONFIG_ARCH_SPARSEMEM_ENABLE=y
100CONFIG_SELECT_MEMORY_MODEL=y
101# CONFIG_FLATMEM_MANUAL is not set
102CONFIG_DISCONTIGMEM_MANUAL=y
103# CONFIG_SPARSEMEM_MANUAL is not set
104CONFIG_DISCONTIGMEM=y
105CONFIG_FLAT_NODE_MEM_MAP=y
106CONFIG_NEED_MULTIPLE_NODES=y
107CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
108CONFIG_NODES_SPAN_OTHER_NODES=y
92CONFIG_NUMA=y 109CONFIG_NUMA=y
93CONFIG_SCHED_SMT=y 110CONFIG_SCHED_SMT=y
111CONFIG_PREEMPT_NONE=y
112# CONFIG_PREEMPT_VOLUNTARY is not set
94# CONFIG_PREEMPT is not set 113# CONFIG_PREEMPT is not set
114# CONFIG_PREEMPT_BKL is not set
115CONFIG_HZ_100=y
116# CONFIG_HZ_250 is not set
117# CONFIG_HZ_1000 is not set
118CONFIG_HZ=100
95CONFIG_EEH=y 119CONFIG_EEH=y
96CONFIG_GENERIC_HARDIRQS=y 120CONFIG_GENERIC_HARDIRQS=y
97CONFIG_PPC_RTAS=y 121CONFIG_PPC_RTAS=y
@@ -132,6 +156,142 @@ CONFIG_PROC_DEVICETREE=y
132# CONFIG_CMDLINE_BOOL is not set 156# CONFIG_CMDLINE_BOOL is not set
133 157
134# 158#
159# Networking
160#
161CONFIG_NET=y
162
163#
164# Networking options
165#
166CONFIG_PACKET=y
167# CONFIG_PACKET_MMAP is not set
168CONFIG_UNIX=y
169CONFIG_XFRM=y
170CONFIG_XFRM_USER=m
171CONFIG_NET_KEY=m
172CONFIG_INET=y
173CONFIG_IP_MULTICAST=y
174# CONFIG_IP_ADVANCED_ROUTER is not set
175CONFIG_IP_FIB_HASH=y
176# CONFIG_IP_PNP is not set
177CONFIG_NET_IPIP=y
178# CONFIG_NET_IPGRE is not set
179# CONFIG_IP_MROUTE is not set
180# CONFIG_ARPD is not set
181CONFIG_SYN_COOKIES=y
182CONFIG_INET_AH=m
183CONFIG_INET_ESP=m
184CONFIG_INET_IPCOMP=m
185CONFIG_INET_TUNNEL=y
186CONFIG_IP_TCPDIAG=m
187# CONFIG_IP_TCPDIAG_IPV6 is not set
188# CONFIG_TCP_CONG_ADVANCED is not set
189CONFIG_TCP_CONG_BIC=y
190
191#
192# IP: Virtual Server Configuration
193#
194# CONFIG_IP_VS is not set
195# CONFIG_IPV6 is not set
196CONFIG_NETFILTER=y
197# CONFIG_NETFILTER_DEBUG is not set
198
199#
200# IP: Netfilter Configuration
201#
202CONFIG_IP_NF_CONNTRACK=m
203CONFIG_IP_NF_CT_ACCT=y
204CONFIG_IP_NF_CONNTRACK_MARK=y
205CONFIG_IP_NF_CT_PROTO_SCTP=m
206CONFIG_IP_NF_FTP=m
207CONFIG_IP_NF_IRC=m
208CONFIG_IP_NF_TFTP=m
209CONFIG_IP_NF_AMANDA=m
210CONFIG_IP_NF_QUEUE=m
211CONFIG_IP_NF_IPTABLES=m
212CONFIG_IP_NF_MATCH_LIMIT=m
213CONFIG_IP_NF_MATCH_IPRANGE=m
214CONFIG_IP_NF_MATCH_MAC=m
215CONFIG_IP_NF_MATCH_PKTTYPE=m
216CONFIG_IP_NF_MATCH_MARK=m
217CONFIG_IP_NF_MATCH_MULTIPORT=m
218CONFIG_IP_NF_MATCH_TOS=m
219CONFIG_IP_NF_MATCH_RECENT=m
220CONFIG_IP_NF_MATCH_ECN=m
221CONFIG_IP_NF_MATCH_DSCP=m
222CONFIG_IP_NF_MATCH_AH_ESP=m
223CONFIG_IP_NF_MATCH_LENGTH=m
224CONFIG_IP_NF_MATCH_TTL=m
225CONFIG_IP_NF_MATCH_TCPMSS=m
226CONFIG_IP_NF_MATCH_HELPER=m
227CONFIG_IP_NF_MATCH_STATE=m
228CONFIG_IP_NF_MATCH_CONNTRACK=m
229CONFIG_IP_NF_MATCH_OWNER=m
230CONFIG_IP_NF_MATCH_ADDRTYPE=m
231CONFIG_IP_NF_MATCH_REALM=m
232CONFIG_IP_NF_MATCH_SCTP=m
233CONFIG_IP_NF_MATCH_COMMENT=m
234CONFIG_IP_NF_MATCH_CONNMARK=m
235CONFIG_IP_NF_MATCH_HASHLIMIT=m
236CONFIG_IP_NF_FILTER=m
237CONFIG_IP_NF_TARGET_REJECT=m
238CONFIG_IP_NF_TARGET_LOG=m
239CONFIG_IP_NF_TARGET_ULOG=m
240CONFIG_IP_NF_TARGET_TCPMSS=m
241CONFIG_IP_NF_NAT=m
242CONFIG_IP_NF_NAT_NEEDED=y
243CONFIG_IP_NF_TARGET_MASQUERADE=m
244CONFIG_IP_NF_TARGET_REDIRECT=m
245CONFIG_IP_NF_TARGET_NETMAP=m
246CONFIG_IP_NF_TARGET_SAME=m
247CONFIG_IP_NF_NAT_SNMP_BASIC=m
248CONFIG_IP_NF_NAT_IRC=m
249CONFIG_IP_NF_NAT_FTP=m
250CONFIG_IP_NF_NAT_TFTP=m
251CONFIG_IP_NF_NAT_AMANDA=m
252CONFIG_IP_NF_MANGLE=m
253CONFIG_IP_NF_TARGET_TOS=m
254CONFIG_IP_NF_TARGET_ECN=m
255CONFIG_IP_NF_TARGET_DSCP=m
256CONFIG_IP_NF_TARGET_MARK=m
257CONFIG_IP_NF_TARGET_CLASSIFY=m
258CONFIG_IP_NF_TARGET_CONNMARK=m
259CONFIG_IP_NF_TARGET_CLUSTERIP=m
260CONFIG_IP_NF_RAW=m
261CONFIG_IP_NF_TARGET_NOTRACK=m
262CONFIG_IP_NF_ARPTABLES=m
263CONFIG_IP_NF_ARPFILTER=m
264CONFIG_IP_NF_ARP_MANGLE=m
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269# CONFIG_IP_SCTP is not set
270# CONFIG_ATM is not set
271# CONFIG_BRIDGE is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_DECNET is not set
274CONFIG_LLC=y
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278# CONFIG_X25 is not set
279# CONFIG_LAPB is not set
280# CONFIG_NET_DIVERT is not set
281# CONFIG_ECONET is not set
282# CONFIG_WAN_ROUTER is not set
283# CONFIG_NET_SCHED is not set
284CONFIG_NET_CLS_ROUTE=y
285
286#
287# Network testing
288#
289# CONFIG_NET_PKTGEN is not set
290# CONFIG_HAMRADIO is not set
291# CONFIG_IRDA is not set
292# CONFIG_BT is not set
293
294#
135# Device Drivers 295# Device Drivers
136# 296#
137 297
@@ -238,6 +398,7 @@ CONFIG_BLK_DEV_AMD74XX=y
238# CONFIG_BLK_DEV_HPT366 is not set 398# CONFIG_BLK_DEV_HPT366 is not set
239# CONFIG_BLK_DEV_SC1200 is not set 399# CONFIG_BLK_DEV_SC1200 is not set
240# CONFIG_BLK_DEV_PIIX is not set 400# CONFIG_BLK_DEV_PIIX is not set
401# CONFIG_BLK_DEV_IT821X is not set
241# CONFIG_BLK_DEV_NS87415 is not set 402# CONFIG_BLK_DEV_NS87415 is not set
242# CONFIG_BLK_DEV_PDC202XX_OLD is not set 403# CONFIG_BLK_DEV_PDC202XX_OLD is not set
243# CONFIG_BLK_DEV_PDC202XX_NEW is not set 404# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -267,6 +428,7 @@ CONFIG_CHR_DEV_ST=y
267CONFIG_BLK_DEV_SR=y 428CONFIG_BLK_DEV_SR=y
268CONFIG_BLK_DEV_SR_VENDOR=y 429CONFIG_BLK_DEV_SR_VENDOR=y
269CONFIG_CHR_DEV_SG=y 430CONFIG_CHR_DEV_SG=y
431# CONFIG_CHR_DEV_SCH is not set
270 432
271# 433#
272# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 434# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -322,6 +484,7 @@ CONFIG_SCSI_QLA22XX=m
322CONFIG_SCSI_QLA2300=m 484CONFIG_SCSI_QLA2300=m
323CONFIG_SCSI_QLA2322=m 485CONFIG_SCSI_QLA2322=m
324CONFIG_SCSI_QLA6312=m 486CONFIG_SCSI_QLA6312=m
487CONFIG_SCSI_QLA24XX=m
325CONFIG_SCSI_LPFC=m 488CONFIG_SCSI_LPFC=m
326# CONFIG_SCSI_DC395x is not set 489# CONFIG_SCSI_DC395x is not set
327# CONFIG_SCSI_DC390T is not set 490# CONFIG_SCSI_DC390T is not set
@@ -352,6 +515,8 @@ CONFIG_DM_MULTIPATH_EMC=m
352# Fusion MPT device support 515# Fusion MPT device support
353# 516#
354# CONFIG_FUSION is not set 517# CONFIG_FUSION is not set
518# CONFIG_FUSION_SPI is not set
519# CONFIG_FUSION_FC is not set
355 520
356# 521#
357# IEEE 1394 (FireWire) support 522# IEEE 1394 (FireWire) support
@@ -368,145 +533,8 @@ CONFIG_DM_MULTIPATH_EMC=m
368# 533#
369 534
370# 535#
371# Networking support 536# Network device support
372# 537#
373CONFIG_NET=y
374
375#
376# Networking options
377#
378CONFIG_PACKET=y
379# CONFIG_PACKET_MMAP is not set
380CONFIG_UNIX=y
381CONFIG_NET_KEY=m
382CONFIG_INET=y
383CONFIG_IP_MULTICAST=y
384# CONFIG_IP_ADVANCED_ROUTER is not set
385# CONFIG_IP_PNP is not set
386CONFIG_NET_IPIP=y
387# CONFIG_NET_IPGRE is not set
388# CONFIG_IP_MROUTE is not set
389# CONFIG_ARPD is not set
390CONFIG_SYN_COOKIES=y
391CONFIG_INET_AH=m
392CONFIG_INET_ESP=m
393CONFIG_INET_IPCOMP=m
394CONFIG_INET_TUNNEL=y
395CONFIG_IP_TCPDIAG=m
396# CONFIG_IP_TCPDIAG_IPV6 is not set
397
398#
399# IP: Virtual Server Configuration
400#
401# CONFIG_IP_VS is not set
402# CONFIG_IPV6 is not set
403CONFIG_NETFILTER=y
404# CONFIG_NETFILTER_DEBUG is not set
405
406#
407# IP: Netfilter Configuration
408#
409CONFIG_IP_NF_CONNTRACK=m
410CONFIG_IP_NF_CT_ACCT=y
411CONFIG_IP_NF_CONNTRACK_MARK=y
412CONFIG_IP_NF_CT_PROTO_SCTP=m
413CONFIG_IP_NF_FTP=m
414CONFIG_IP_NF_IRC=m
415CONFIG_IP_NF_TFTP=m
416CONFIG_IP_NF_AMANDA=m
417CONFIG_IP_NF_QUEUE=m
418CONFIG_IP_NF_IPTABLES=m
419CONFIG_IP_NF_MATCH_LIMIT=m
420CONFIG_IP_NF_MATCH_IPRANGE=m
421CONFIG_IP_NF_MATCH_MAC=m
422CONFIG_IP_NF_MATCH_PKTTYPE=m
423CONFIG_IP_NF_MATCH_MARK=m
424CONFIG_IP_NF_MATCH_MULTIPORT=m
425CONFIG_IP_NF_MATCH_TOS=m
426CONFIG_IP_NF_MATCH_RECENT=m
427CONFIG_IP_NF_MATCH_ECN=m
428CONFIG_IP_NF_MATCH_DSCP=m
429CONFIG_IP_NF_MATCH_AH_ESP=m
430CONFIG_IP_NF_MATCH_LENGTH=m
431CONFIG_IP_NF_MATCH_TTL=m
432CONFIG_IP_NF_MATCH_TCPMSS=m
433CONFIG_IP_NF_MATCH_HELPER=m
434CONFIG_IP_NF_MATCH_STATE=m
435CONFIG_IP_NF_MATCH_CONNTRACK=m
436CONFIG_IP_NF_MATCH_OWNER=m
437CONFIG_IP_NF_MATCH_ADDRTYPE=m
438CONFIG_IP_NF_MATCH_REALM=m
439CONFIG_IP_NF_MATCH_SCTP=m
440CONFIG_IP_NF_MATCH_COMMENT=m
441CONFIG_IP_NF_MATCH_CONNMARK=m
442CONFIG_IP_NF_MATCH_HASHLIMIT=m
443CONFIG_IP_NF_FILTER=m
444CONFIG_IP_NF_TARGET_REJECT=m
445CONFIG_IP_NF_TARGET_LOG=m
446CONFIG_IP_NF_TARGET_ULOG=m
447CONFIG_IP_NF_TARGET_TCPMSS=m
448CONFIG_IP_NF_NAT=m
449CONFIG_IP_NF_NAT_NEEDED=y
450CONFIG_IP_NF_TARGET_MASQUERADE=m
451CONFIG_IP_NF_TARGET_REDIRECT=m
452CONFIG_IP_NF_TARGET_NETMAP=m
453CONFIG_IP_NF_TARGET_SAME=m
454CONFIG_IP_NF_NAT_SNMP_BASIC=m
455CONFIG_IP_NF_NAT_IRC=m
456CONFIG_IP_NF_NAT_FTP=m
457CONFIG_IP_NF_NAT_TFTP=m
458CONFIG_IP_NF_NAT_AMANDA=m
459CONFIG_IP_NF_MANGLE=m
460CONFIG_IP_NF_TARGET_TOS=m
461CONFIG_IP_NF_TARGET_ECN=m
462CONFIG_IP_NF_TARGET_DSCP=m
463CONFIG_IP_NF_TARGET_MARK=m
464CONFIG_IP_NF_TARGET_CLASSIFY=m
465CONFIG_IP_NF_TARGET_CONNMARK=m
466CONFIG_IP_NF_TARGET_CLUSTERIP=m
467CONFIG_IP_NF_RAW=m
468CONFIG_IP_NF_TARGET_NOTRACK=m
469CONFIG_IP_NF_ARPTABLES=m
470CONFIG_IP_NF_ARPFILTER=m
471CONFIG_IP_NF_ARP_MANGLE=m
472CONFIG_XFRM=y
473CONFIG_XFRM_USER=m
474
475#
476# SCTP Configuration (EXPERIMENTAL)
477#
478# CONFIG_IP_SCTP is not set
479# CONFIG_ATM is not set
480# CONFIG_BRIDGE is not set
481# CONFIG_VLAN_8021Q is not set
482# CONFIG_DECNET is not set
483CONFIG_LLC=y
484# CONFIG_LLC2 is not set
485# CONFIG_IPX is not set
486# CONFIG_ATALK is not set
487# CONFIG_X25 is not set
488# CONFIG_LAPB is not set
489# CONFIG_NET_DIVERT is not set
490# CONFIG_ECONET is not set
491# CONFIG_WAN_ROUTER is not set
492
493#
494# QoS and/or fair queueing
495#
496# CONFIG_NET_SCHED is not set
497CONFIG_NET_CLS_ROUTE=y
498
499#
500# Network testing
501#
502# CONFIG_NET_PKTGEN is not set
503CONFIG_NETPOLL=y
504CONFIG_NETPOLL_RX=y
505CONFIG_NETPOLL_TRAP=y
506CONFIG_NET_POLL_CONTROLLER=y
507# CONFIG_HAMRADIO is not set
508# CONFIG_IRDA is not set
509# CONFIG_BT is not set
510CONFIG_NETDEVICES=y 538CONFIG_NETDEVICES=y
511CONFIG_DUMMY=m 539CONFIG_DUMMY=m
512CONFIG_BONDING=m 540CONFIG_BONDING=m
@@ -566,6 +594,7 @@ CONFIG_E1000=y
566# CONFIG_HAMACHI is not set 594# CONFIG_HAMACHI is not set
567# CONFIG_YELLOWFIN is not set 595# CONFIG_YELLOWFIN is not set
568# CONFIG_R8169 is not set 596# CONFIG_R8169 is not set
597# CONFIG_SKGE is not set
569# CONFIG_SK98LIN is not set 598# CONFIG_SK98LIN is not set
570# CONFIG_VIA_VELOCITY is not set 599# CONFIG_VIA_VELOCITY is not set
571CONFIG_TIGON3=y 600CONFIG_TIGON3=y
@@ -613,6 +642,10 @@ CONFIG_PPPOE=m
613# CONFIG_NET_FC is not set 642# CONFIG_NET_FC is not set
614# CONFIG_SHAPER is not set 643# CONFIG_SHAPER is not set
615CONFIG_NETCONSOLE=y 644CONFIG_NETCONSOLE=y
645CONFIG_NETPOLL=y
646CONFIG_NETPOLL_RX=y
647CONFIG_NETPOLL_TRAP=y
648CONFIG_NET_POLL_CONTROLLER=y
616 649
617# 650#
618# ISDN subsystem 651# ISDN subsystem
@@ -714,7 +747,6 @@ CONFIG_HVCS=m
714# 747#
715# CONFIG_WATCHDOG is not set 748# CONFIG_WATCHDOG is not set
716# CONFIG_RTC is not set 749# CONFIG_RTC is not set
717# CONFIG_GEN_RTC is not set
718# CONFIG_DTLK is not set 750# CONFIG_DTLK is not set
719# CONFIG_R3964 is not set 751# CONFIG_R3964 is not set
720# CONFIG_APPLICOM is not set 752# CONFIG_APPLICOM is not set
@@ -772,50 +804,19 @@ CONFIG_I2C_ALGOBIT=y
772# CONFIG_I2C_VIAPRO is not set 804# CONFIG_I2C_VIAPRO is not set
773# CONFIG_I2C_VOODOO3 is not set 805# CONFIG_I2C_VOODOO3 is not set
774# CONFIG_I2C_PCA_ISA is not set 806# CONFIG_I2C_PCA_ISA is not set
807# CONFIG_I2C_SENSOR is not set
775 808
776# 809#
777# Hardware Sensors Chip support 810# Miscellaneous I2C Chip support
778#
779# CONFIG_I2C_SENSOR is not set
780# CONFIG_SENSORS_ADM1021 is not set
781# CONFIG_SENSORS_ADM1025 is not set
782# CONFIG_SENSORS_ADM1026 is not set
783# CONFIG_SENSORS_ADM1031 is not set
784# CONFIG_SENSORS_ASB100 is not set
785# CONFIG_SENSORS_DS1621 is not set
786# CONFIG_SENSORS_FSCHER is not set
787# CONFIG_SENSORS_FSCPOS is not set
788# CONFIG_SENSORS_GL518SM is not set
789# CONFIG_SENSORS_GL520SM is not set
790# CONFIG_SENSORS_IT87 is not set
791# CONFIG_SENSORS_LM63 is not set
792# CONFIG_SENSORS_LM75 is not set
793# CONFIG_SENSORS_LM77 is not set
794# CONFIG_SENSORS_LM78 is not set
795# CONFIG_SENSORS_LM80 is not set
796# CONFIG_SENSORS_LM83 is not set
797# CONFIG_SENSORS_LM85 is not set
798# CONFIG_SENSORS_LM87 is not set
799# CONFIG_SENSORS_LM90 is not set
800# CONFIG_SENSORS_LM92 is not set
801# CONFIG_SENSORS_MAX1619 is not set
802# CONFIG_SENSORS_PC87360 is not set
803# CONFIG_SENSORS_SMSC47B397 is not set
804# CONFIG_SENSORS_SIS5595 is not set
805# CONFIG_SENSORS_SMSC47M1 is not set
806# CONFIG_SENSORS_VIA686A is not set
807# CONFIG_SENSORS_W83781D is not set
808# CONFIG_SENSORS_W83L785TS is not set
809# CONFIG_SENSORS_W83627HF is not set
810
811#
812# Other I2C Chip support
813# 811#
814# CONFIG_SENSORS_DS1337 is not set 812# CONFIG_SENSORS_DS1337 is not set
813# CONFIG_SENSORS_DS1374 is not set
815# CONFIG_SENSORS_EEPROM is not set 814# CONFIG_SENSORS_EEPROM is not set
816# CONFIG_SENSORS_PCF8574 is not set 815# CONFIG_SENSORS_PCF8574 is not set
816# CONFIG_SENSORS_PCA9539 is not set
817# CONFIG_SENSORS_PCF8591 is not set 817# CONFIG_SENSORS_PCF8591 is not set
818# CONFIG_SENSORS_RTC8564 is not set 818# CONFIG_SENSORS_RTC8564 is not set
819# CONFIG_SENSORS_MAX6875 is not set
819# CONFIG_I2C_DEBUG_CORE is not set 820# CONFIG_I2C_DEBUG_CORE is not set
820# CONFIG_I2C_DEBUG_ALGO is not set 821# CONFIG_I2C_DEBUG_ALGO is not set
821# CONFIG_I2C_DEBUG_BUS is not set 822# CONFIG_I2C_DEBUG_BUS is not set
@@ -827,6 +828,11 @@ CONFIG_I2C_ALGOBIT=y
827# CONFIG_W1 is not set 828# CONFIG_W1 is not set
828 829
829# 830#
831# Hardware Monitoring support
832#
833# CONFIG_HWMON is not set
834
835#
830# Misc devices 836# Misc devices
831# 837#
832 838
@@ -933,6 +939,7 @@ CONFIG_USB_DEVICEFS=y
933CONFIG_USB_EHCI_HCD=y 939CONFIG_USB_EHCI_HCD=y
934# CONFIG_USB_EHCI_SPLIT_ISO is not set 940# CONFIG_USB_EHCI_SPLIT_ISO is not set
935# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 941# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
942# CONFIG_USB_ISP116X_HCD is not set
936CONFIG_USB_OHCI_HCD=y 943CONFIG_USB_OHCI_HCD=y
937# CONFIG_USB_OHCI_BIG_ENDIAN is not set 944# CONFIG_USB_OHCI_BIG_ENDIAN is not set
938CONFIG_USB_OHCI_LITTLE_ENDIAN=y 945CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -969,12 +976,15 @@ CONFIG_USB_HIDINPUT=y
969CONFIG_USB_HIDDEV=y 976CONFIG_USB_HIDDEV=y
970# CONFIG_USB_AIPTEK is not set 977# CONFIG_USB_AIPTEK is not set
971# CONFIG_USB_WACOM is not set 978# CONFIG_USB_WACOM is not set
979# CONFIG_USB_ACECAD is not set
972# CONFIG_USB_KBTAB is not set 980# CONFIG_USB_KBTAB is not set
973# CONFIG_USB_POWERMATE is not set 981# CONFIG_USB_POWERMATE is not set
974# CONFIG_USB_MTOUCH is not set 982# CONFIG_USB_MTOUCH is not set
983# CONFIG_USB_ITMTOUCH is not set
975# CONFIG_USB_EGALAX is not set 984# CONFIG_USB_EGALAX is not set
976# CONFIG_USB_XPAD is not set 985# CONFIG_USB_XPAD is not set
977# CONFIG_USB_ATI_REMOTE is not set 986# CONFIG_USB_ATI_REMOTE is not set
987# CONFIG_USB_KEYSPAN_REMOTE is not set
978 988
979# 989#
980# USB Imaging devices 990# USB Imaging devices
@@ -1026,10 +1036,11 @@ CONFIG_USB_MON=y
1026# CONFIG_USB_PHIDGETSERVO is not set 1036# CONFIG_USB_PHIDGETSERVO is not set
1027# CONFIG_USB_IDMOUSE is not set 1037# CONFIG_USB_IDMOUSE is not set
1028# CONFIG_USB_SISUSBVGA is not set 1038# CONFIG_USB_SISUSBVGA is not set
1039# CONFIG_USB_LD is not set
1029# CONFIG_USB_TEST is not set 1040# CONFIG_USB_TEST is not set
1030 1041
1031# 1042#
1032# USB ATM/DSL drivers 1043# USB DSL modem support
1033# 1044#
1034 1045
1035# 1046#
@@ -1046,18 +1057,25 @@ CONFIG_USB_MON=y
1046# InfiniBand support 1057# InfiniBand support
1047# 1058#
1048CONFIG_INFINIBAND=m 1059CONFIG_INFINIBAND=m
1060CONFIG_INFINIBAND_USER_VERBS=m
1049CONFIG_INFINIBAND_MTHCA=m 1061CONFIG_INFINIBAND_MTHCA=m
1050# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1062# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1051CONFIG_INFINIBAND_IPOIB=m 1063CONFIG_INFINIBAND_IPOIB=m
1052# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1064# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1053 1065
1054# 1066#
1067# SN Devices
1068#
1069
1070#
1055# File systems 1071# File systems
1056# 1072#
1057CONFIG_EXT2_FS=y 1073CONFIG_EXT2_FS=y
1058CONFIG_EXT2_FS_XATTR=y 1074CONFIG_EXT2_FS_XATTR=y
1059CONFIG_EXT2_FS_POSIX_ACL=y 1075CONFIG_EXT2_FS_POSIX_ACL=y
1060CONFIG_EXT2_FS_SECURITY=y 1076CONFIG_EXT2_FS_SECURITY=y
1077CONFIG_EXT2_FS_XIP=y
1078CONFIG_FS_XIP=y
1061CONFIG_EXT3_FS=y 1079CONFIG_EXT3_FS=y
1062CONFIG_EXT3_FS_XATTR=y 1080CONFIG_EXT3_FS_XATTR=y
1063CONFIG_EXT3_FS_POSIX_ACL=y 1081CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1089,6 +1107,7 @@ CONFIG_XFS_SECURITY=y
1089CONFIG_XFS_POSIX_ACL=y 1107CONFIG_XFS_POSIX_ACL=y
1090# CONFIG_MINIX_FS is not set 1108# CONFIG_MINIX_FS is not set
1091# CONFIG_ROMFS_FS is not set 1109# CONFIG_ROMFS_FS is not set
1110CONFIG_INOTIFY=y
1092# CONFIG_QUOTA is not set 1111# CONFIG_QUOTA is not set
1093CONFIG_DNOTIFY=y 1112CONFIG_DNOTIFY=y
1094CONFIG_AUTOFS_FS=m 1113CONFIG_AUTOFS_FS=m
@@ -1120,7 +1139,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1120CONFIG_PROC_FS=y 1139CONFIG_PROC_FS=y
1121CONFIG_PROC_KCORE=y 1140CONFIG_PROC_KCORE=y
1122CONFIG_SYSFS=y 1141CONFIG_SYSFS=y
1123# CONFIG_DEVFS_FS is not set
1124CONFIG_DEVPTS_FS_XATTR=y 1142CONFIG_DEVPTS_FS_XATTR=y
1125CONFIG_DEVPTS_FS_SECURITY=y 1143CONFIG_DEVPTS_FS_SECURITY=y
1126CONFIG_TMPFS=y 1144CONFIG_TMPFS=y
@@ -1152,15 +1170,20 @@ CONFIG_CRAMFS=y
1152# 1170#
1153CONFIG_NFS_FS=y 1171CONFIG_NFS_FS=y
1154CONFIG_NFS_V3=y 1172CONFIG_NFS_V3=y
1173CONFIG_NFS_V3_ACL=y
1155CONFIG_NFS_V4=y 1174CONFIG_NFS_V4=y
1156# CONFIG_NFS_DIRECTIO is not set 1175# CONFIG_NFS_DIRECTIO is not set
1157CONFIG_NFSD=y 1176CONFIG_NFSD=y
1177CONFIG_NFSD_V2_ACL=y
1158CONFIG_NFSD_V3=y 1178CONFIG_NFSD_V3=y
1179CONFIG_NFSD_V3_ACL=y
1159CONFIG_NFSD_V4=y 1180CONFIG_NFSD_V4=y
1160CONFIG_NFSD_TCP=y 1181CONFIG_NFSD_TCP=y
1161CONFIG_LOCKD=y 1182CONFIG_LOCKD=y
1162CONFIG_LOCKD_V4=y 1183CONFIG_LOCKD_V4=y
1163CONFIG_EXPORTFS=y 1184CONFIG_EXPORTFS=y
1185CONFIG_NFS_ACL_SUPPORT=y
1186CONFIG_NFS_COMMON=y
1164CONFIG_SUNRPC=y 1187CONFIG_SUNRPC=y
1165CONFIG_SUNRPC_GSS=y 1188CONFIG_SUNRPC_GSS=y
1166CONFIG_RPCSEC_GSS_KRB5=y 1189CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/defconfig b/arch/ppc64/defconfig
index b8e2066dde77..c361e7727b7a 100644
--- a/arch/ppc64/defconfig
+++ b/arch/ppc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc5-git9 3# Linux kernel version: 2.6.13-rc6
4# Sun Jun 5 09:26:47 2005 4# Mon Aug 8 14:16:54 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,13 +73,18 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75CONFIG_PPC_PSERIES=y 75CONFIG_PPC_PSERIES=y
76CONFIG_PPC_BPA=y
76CONFIG_PPC_PMAC=y 77CONFIG_PPC_PMAC=y
77CONFIG_PPC_MAPLE=y 78CONFIG_PPC_MAPLE=y
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_XICS=y
83CONFIG_MPIC=y
84CONFIG_BPA_IIC=y
81CONFIG_ALTIVEC=y 85CONFIG_ALTIVEC=y
82CONFIG_PPC_SPLPAR=y 86CONFIG_PPC_SPLPAR=y
87CONFIG_KEXEC=y
83CONFIG_IBMVIO=y 88CONFIG_IBMVIO=y
84CONFIG_U3_DART=y 89CONFIG_U3_DART=y
85CONFIG_MPIC_BROKEN_U3=y 90CONFIG_MPIC_BROKEN_U3=y
@@ -89,10 +94,30 @@ CONFIG_BOOTX_TEXT=y
89CONFIG_IOMMU_VMERGE=y 94CONFIG_IOMMU_VMERGE=y
90CONFIG_SMP=y 95CONFIG_SMP=y
91CONFIG_NR_CPUS=32 96CONFIG_NR_CPUS=32
97CONFIG_ARCH_SELECT_MEMORY_MODEL=y
98CONFIG_ARCH_FLATMEM_ENABLE=y
92CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 99CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
100CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
101CONFIG_ARCH_SPARSEMEM_ENABLE=y
102CONFIG_SELECT_MEMORY_MODEL=y
103# CONFIG_FLATMEM_MANUAL is not set
104CONFIG_DISCONTIGMEM_MANUAL=y
105# CONFIG_SPARSEMEM_MANUAL is not set
106CONFIG_DISCONTIGMEM=y
107CONFIG_FLAT_NODE_MEM_MAP=y
108CONFIG_NEED_MULTIPLE_NODES=y
109CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
110CONFIG_NODES_SPAN_OTHER_NODES=y
93# CONFIG_NUMA is not set 111# CONFIG_NUMA is not set
94# CONFIG_SCHED_SMT is not set 112# CONFIG_SCHED_SMT is not set
113CONFIG_PREEMPT_NONE=y
114# CONFIG_PREEMPT_VOLUNTARY is not set
95# CONFIG_PREEMPT is not set 115# CONFIG_PREEMPT is not set
116# CONFIG_PREEMPT_BKL is not set
117CONFIG_HZ_100=y
118# CONFIG_HZ_250 is not set
119# CONFIG_HZ_1000 is not set
120CONFIG_HZ=100
96CONFIG_EEH=y 121CONFIG_EEH=y
97CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
98CONFIG_PPC_RTAS=y 123CONFIG_PPC_RTAS=y
@@ -133,6 +158,142 @@ CONFIG_PROC_DEVICETREE=y
133# CONFIG_CMDLINE_BOOL is not set 158# CONFIG_CMDLINE_BOOL is not set
134 159
135# 160#
161# Networking
162#
163CONFIG_NET=y
164
165#
166# Networking options
167#
168CONFIG_PACKET=y
169# CONFIG_PACKET_MMAP is not set
170CONFIG_UNIX=y
171CONFIG_XFRM=y
172CONFIG_XFRM_USER=m
173CONFIG_NET_KEY=m
174CONFIG_INET=y
175CONFIG_IP_MULTICAST=y
176# CONFIG_IP_ADVANCED_ROUTER is not set
177CONFIG_IP_FIB_HASH=y
178# CONFIG_IP_PNP is not set
179CONFIG_NET_IPIP=y
180# CONFIG_NET_IPGRE is not set
181# CONFIG_IP_MROUTE is not set
182# CONFIG_ARPD is not set
183CONFIG_SYN_COOKIES=y
184CONFIG_INET_AH=m
185CONFIG_INET_ESP=m
186CONFIG_INET_IPCOMP=m
187CONFIG_INET_TUNNEL=y
188# CONFIG_IP_TCPDIAG is not set
189# CONFIG_IP_TCPDIAG_IPV6 is not set
190# CONFIG_TCP_CONG_ADVANCED is not set
191CONFIG_TCP_CONG_BIC=y
192
193#
194# IP: Virtual Server Configuration
195#
196# CONFIG_IP_VS is not set
197# CONFIG_IPV6 is not set
198CONFIG_NETFILTER=y
199# CONFIG_NETFILTER_DEBUG is not set
200
201#
202# IP: Netfilter Configuration
203#
204CONFIG_IP_NF_CONNTRACK=m
205CONFIG_IP_NF_CT_ACCT=y
206CONFIG_IP_NF_CONNTRACK_MARK=y
207CONFIG_IP_NF_CT_PROTO_SCTP=m
208CONFIG_IP_NF_FTP=m
209CONFIG_IP_NF_IRC=m
210CONFIG_IP_NF_TFTP=m
211CONFIG_IP_NF_AMANDA=m
212CONFIG_IP_NF_QUEUE=m
213CONFIG_IP_NF_IPTABLES=m
214CONFIG_IP_NF_MATCH_LIMIT=m
215CONFIG_IP_NF_MATCH_IPRANGE=m
216CONFIG_IP_NF_MATCH_MAC=m
217CONFIG_IP_NF_MATCH_PKTTYPE=m
218CONFIG_IP_NF_MATCH_MARK=m
219CONFIG_IP_NF_MATCH_MULTIPORT=m
220CONFIG_IP_NF_MATCH_TOS=m
221CONFIG_IP_NF_MATCH_RECENT=m
222CONFIG_IP_NF_MATCH_ECN=m
223CONFIG_IP_NF_MATCH_DSCP=m
224CONFIG_IP_NF_MATCH_AH_ESP=m
225CONFIG_IP_NF_MATCH_LENGTH=m
226CONFIG_IP_NF_MATCH_TTL=m
227CONFIG_IP_NF_MATCH_TCPMSS=m
228CONFIG_IP_NF_MATCH_HELPER=m
229CONFIG_IP_NF_MATCH_STATE=m
230CONFIG_IP_NF_MATCH_CONNTRACK=m
231CONFIG_IP_NF_MATCH_OWNER=m
232CONFIG_IP_NF_MATCH_ADDRTYPE=m
233CONFIG_IP_NF_MATCH_REALM=m
234CONFIG_IP_NF_MATCH_SCTP=m
235CONFIG_IP_NF_MATCH_COMMENT=m
236CONFIG_IP_NF_MATCH_CONNMARK=m
237CONFIG_IP_NF_MATCH_HASHLIMIT=m
238CONFIG_IP_NF_FILTER=m
239CONFIG_IP_NF_TARGET_REJECT=m
240CONFIG_IP_NF_TARGET_LOG=m
241CONFIG_IP_NF_TARGET_ULOG=m
242CONFIG_IP_NF_TARGET_TCPMSS=m
243CONFIG_IP_NF_NAT=m
244CONFIG_IP_NF_NAT_NEEDED=y
245CONFIG_IP_NF_TARGET_MASQUERADE=m
246CONFIG_IP_NF_TARGET_REDIRECT=m
247CONFIG_IP_NF_TARGET_NETMAP=m
248CONFIG_IP_NF_TARGET_SAME=m
249CONFIG_IP_NF_NAT_SNMP_BASIC=m
250CONFIG_IP_NF_NAT_IRC=m
251CONFIG_IP_NF_NAT_FTP=m
252CONFIG_IP_NF_NAT_TFTP=m
253CONFIG_IP_NF_NAT_AMANDA=m
254CONFIG_IP_NF_MANGLE=m
255CONFIG_IP_NF_TARGET_TOS=m
256CONFIG_IP_NF_TARGET_ECN=m
257CONFIG_IP_NF_TARGET_DSCP=m
258CONFIG_IP_NF_TARGET_MARK=m
259CONFIG_IP_NF_TARGET_CLASSIFY=m
260CONFIG_IP_NF_TARGET_CONNMARK=m
261CONFIG_IP_NF_TARGET_CLUSTERIP=m
262CONFIG_IP_NF_RAW=m
263CONFIG_IP_NF_TARGET_NOTRACK=m
264CONFIG_IP_NF_ARPTABLES=m
265CONFIG_IP_NF_ARPFILTER=m
266CONFIG_IP_NF_ARP_MANGLE=m
267
268#
269# SCTP Configuration (EXPERIMENTAL)
270#
271# CONFIG_IP_SCTP is not set
272# CONFIG_ATM is not set
273# CONFIG_BRIDGE is not set
274# CONFIG_VLAN_8021Q is not set
275# CONFIG_DECNET is not set
276CONFIG_LLC=y
277# CONFIG_LLC2 is not set
278# CONFIG_IPX is not set
279# CONFIG_ATALK is not set
280# CONFIG_X25 is not set
281# CONFIG_LAPB is not set
282# CONFIG_NET_DIVERT is not set
283# CONFIG_ECONET is not set
284# CONFIG_WAN_ROUTER is not set
285# CONFIG_NET_SCHED is not set
286CONFIG_NET_CLS_ROUTE=y
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292# CONFIG_HAMRADIO is not set
293# CONFIG_IRDA is not set
294# CONFIG_BT is not set
295
296#
136# Device Drivers 297# Device Drivers
137# 298#
138 299
@@ -239,6 +400,7 @@ CONFIG_BLK_DEV_AMD74XX=y
239# CONFIG_BLK_DEV_HPT366 is not set 400# CONFIG_BLK_DEV_HPT366 is not set
240# CONFIG_BLK_DEV_SC1200 is not set 401# CONFIG_BLK_DEV_SC1200 is not set
241# CONFIG_BLK_DEV_PIIX is not set 402# CONFIG_BLK_DEV_PIIX is not set
403# CONFIG_BLK_DEV_IT821X is not set
242# CONFIG_BLK_DEV_NS87415 is not set 404# CONFIG_BLK_DEV_NS87415 is not set
243# CONFIG_BLK_DEV_PDC202XX_OLD is not set 405# CONFIG_BLK_DEV_PDC202XX_OLD is not set
244# CONFIG_BLK_DEV_PDC202XX_NEW is not set 406# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -272,6 +434,7 @@ CONFIG_CHR_DEV_ST=y
272CONFIG_BLK_DEV_SR=y 434CONFIG_BLK_DEV_SR=y
273CONFIG_BLK_DEV_SR_VENDOR=y 435CONFIG_BLK_DEV_SR_VENDOR=y
274CONFIG_CHR_DEV_SG=y 436CONFIG_CHR_DEV_SG=y
437# CONFIG_CHR_DEV_SCH is not set
275 438
276# 439#
277# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 440# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -339,6 +502,7 @@ CONFIG_SCSI_QLA22XX=m
339CONFIG_SCSI_QLA2300=m 502CONFIG_SCSI_QLA2300=m
340CONFIG_SCSI_QLA2322=m 503CONFIG_SCSI_QLA2322=m
341CONFIG_SCSI_QLA6312=m 504CONFIG_SCSI_QLA6312=m
505CONFIG_SCSI_QLA24XX=m
342CONFIG_SCSI_LPFC=m 506CONFIG_SCSI_LPFC=m
343# CONFIG_SCSI_DC395x is not set 507# CONFIG_SCSI_DC395x is not set
344# CONFIG_SCSI_DC390T is not set 508# CONFIG_SCSI_DC390T is not set
@@ -369,6 +533,8 @@ CONFIG_DM_MULTIPATH_EMC=m
369# Fusion MPT device support 533# Fusion MPT device support
370# 534#
371# CONFIG_FUSION is not set 535# CONFIG_FUSION is not set
536# CONFIG_FUSION_SPI is not set
537# CONFIG_FUSION_FC is not set
372 538
373# 539#
374# IEEE 1394 (FireWire) support 540# IEEE 1394 (FireWire) support
@@ -382,6 +548,7 @@ CONFIG_IEEE1394=y
382# CONFIG_IEEE1394_OUI_DB is not set 548# CONFIG_IEEE1394_OUI_DB is not set
383CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 549CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
384CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 550CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
551# CONFIG_IEEE1394_EXPORT_FULL_API is not set
385 552
386# 553#
387# Device Drivers 554# Device Drivers
@@ -409,154 +576,14 @@ CONFIG_IEEE1394_AMDTP=m
409# 576#
410# Macintosh device drivers 577# Macintosh device drivers
411# 578#
412CONFIG_ADB=y
413CONFIG_ADB_PMU=y 579CONFIG_ADB_PMU=y
414CONFIG_PMAC_SMU=y 580CONFIG_PMAC_SMU=y
415# CONFIG_PMAC_PBOOK is not set
416# CONFIG_PMAC_BACKLIGHT is not set 581# CONFIG_PMAC_BACKLIGHT is not set
417# CONFIG_INPUT_ADBHID is not set
418CONFIG_THERM_PM72=y 582CONFIG_THERM_PM72=y
419 583
420# 584#
421# Networking support 585# Network device support
422# 586#
423CONFIG_NET=y
424
425#
426# Networking options
427#
428CONFIG_PACKET=y
429# CONFIG_PACKET_MMAP is not set
430CONFIG_UNIX=y
431CONFIG_NET_KEY=m
432CONFIG_INET=y
433CONFIG_IP_MULTICAST=y
434# CONFIG_IP_ADVANCED_ROUTER is not set
435# CONFIG_IP_PNP is not set
436CONFIG_NET_IPIP=y
437# CONFIG_NET_IPGRE is not set
438# CONFIG_IP_MROUTE is not set
439# CONFIG_ARPD is not set
440CONFIG_SYN_COOKIES=y
441CONFIG_INET_AH=m
442CONFIG_INET_ESP=m
443CONFIG_INET_IPCOMP=m
444CONFIG_INET_TUNNEL=y
445# CONFIG_IP_TCPDIAG is not set
446# CONFIG_IP_TCPDIAG_IPV6 is not set
447
448#
449# IP: Virtual Server Configuration
450#
451# CONFIG_IP_VS is not set
452# CONFIG_IPV6 is not set
453CONFIG_NETFILTER=y
454# CONFIG_NETFILTER_DEBUG is not set
455
456#
457# IP: Netfilter Configuration
458#
459CONFIG_IP_NF_CONNTRACK=m
460CONFIG_IP_NF_CT_ACCT=y
461CONFIG_IP_NF_CONNTRACK_MARK=y
462CONFIG_IP_NF_CT_PROTO_SCTP=m
463CONFIG_IP_NF_FTP=m
464CONFIG_IP_NF_IRC=m
465CONFIG_IP_NF_TFTP=m
466CONFIG_IP_NF_AMANDA=m
467CONFIG_IP_NF_QUEUE=m
468CONFIG_IP_NF_IPTABLES=m
469CONFIG_IP_NF_MATCH_LIMIT=m
470CONFIG_IP_NF_MATCH_IPRANGE=m
471CONFIG_IP_NF_MATCH_MAC=m
472CONFIG_IP_NF_MATCH_PKTTYPE=m
473CONFIG_IP_NF_MATCH_MARK=m
474CONFIG_IP_NF_MATCH_MULTIPORT=m
475CONFIG_IP_NF_MATCH_TOS=m
476CONFIG_IP_NF_MATCH_RECENT=m
477CONFIG_IP_NF_MATCH_ECN=m
478CONFIG_IP_NF_MATCH_DSCP=m
479CONFIG_IP_NF_MATCH_AH_ESP=m
480CONFIG_IP_NF_MATCH_LENGTH=m
481CONFIG_IP_NF_MATCH_TTL=m
482CONFIG_IP_NF_MATCH_TCPMSS=m
483CONFIG_IP_NF_MATCH_HELPER=m
484CONFIG_IP_NF_MATCH_STATE=m
485CONFIG_IP_NF_MATCH_CONNTRACK=m
486CONFIG_IP_NF_MATCH_OWNER=m
487CONFIG_IP_NF_MATCH_ADDRTYPE=m
488CONFIG_IP_NF_MATCH_REALM=m
489CONFIG_IP_NF_MATCH_SCTP=m
490CONFIG_IP_NF_MATCH_COMMENT=m
491CONFIG_IP_NF_MATCH_CONNMARK=m
492CONFIG_IP_NF_MATCH_HASHLIMIT=m
493CONFIG_IP_NF_FILTER=m
494CONFIG_IP_NF_TARGET_REJECT=m
495CONFIG_IP_NF_TARGET_LOG=m
496CONFIG_IP_NF_TARGET_ULOG=m
497CONFIG_IP_NF_TARGET_TCPMSS=m
498CONFIG_IP_NF_NAT=m
499CONFIG_IP_NF_NAT_NEEDED=y
500CONFIG_IP_NF_TARGET_MASQUERADE=m
501CONFIG_IP_NF_TARGET_REDIRECT=m
502CONFIG_IP_NF_TARGET_NETMAP=m
503CONFIG_IP_NF_TARGET_SAME=m
504CONFIG_IP_NF_NAT_SNMP_BASIC=m
505CONFIG_IP_NF_NAT_IRC=m
506CONFIG_IP_NF_NAT_FTP=m
507CONFIG_IP_NF_NAT_TFTP=m
508CONFIG_IP_NF_NAT_AMANDA=m
509CONFIG_IP_NF_MANGLE=m
510CONFIG_IP_NF_TARGET_TOS=m
511CONFIG_IP_NF_TARGET_ECN=m
512CONFIG_IP_NF_TARGET_DSCP=m
513CONFIG_IP_NF_TARGET_MARK=m
514CONFIG_IP_NF_TARGET_CLASSIFY=m
515CONFIG_IP_NF_TARGET_CONNMARK=m
516CONFIG_IP_NF_TARGET_CLUSTERIP=m
517CONFIG_IP_NF_RAW=m
518CONFIG_IP_NF_TARGET_NOTRACK=m
519CONFIG_IP_NF_ARPTABLES=m
520CONFIG_IP_NF_ARPFILTER=m
521CONFIG_IP_NF_ARP_MANGLE=m
522CONFIG_XFRM=y
523CONFIG_XFRM_USER=m
524
525#
526# SCTP Configuration (EXPERIMENTAL)
527#
528# CONFIG_IP_SCTP is not set
529# CONFIG_ATM is not set
530# CONFIG_BRIDGE is not set
531# CONFIG_VLAN_8021Q is not set
532# CONFIG_DECNET is not set
533CONFIG_LLC=y
534# CONFIG_LLC2 is not set
535# CONFIG_IPX is not set
536# CONFIG_ATALK is not set
537# CONFIG_X25 is not set
538# CONFIG_LAPB is not set
539# CONFIG_NET_DIVERT is not set
540# CONFIG_ECONET is not set
541# CONFIG_WAN_ROUTER is not set
542
543#
544# QoS and/or fair queueing
545#
546# CONFIG_NET_SCHED is not set
547CONFIG_NET_CLS_ROUTE=y
548
549#
550# Network testing
551#
552# CONFIG_NET_PKTGEN is not set
553CONFIG_NETPOLL=y
554CONFIG_NETPOLL_RX=y
555CONFIG_NETPOLL_TRAP=y
556CONFIG_NET_POLL_CONTROLLER=y
557# CONFIG_HAMRADIO is not set
558# CONFIG_IRDA is not set
559# CONFIG_BT is not set
560CONFIG_NETDEVICES=y 587CONFIG_NETDEVICES=y
561CONFIG_DUMMY=m 588CONFIG_DUMMY=m
562CONFIG_BONDING=m 589CONFIG_BONDING=m
@@ -616,6 +643,7 @@ CONFIG_E1000=y
616# CONFIG_HAMACHI is not set 643# CONFIG_HAMACHI is not set
617# CONFIG_YELLOWFIN is not set 644# CONFIG_YELLOWFIN is not set
618# CONFIG_R8169 is not set 645# CONFIG_R8169 is not set
646# CONFIG_SKGE is not set
619# CONFIG_SK98LIN is not set 647# CONFIG_SK98LIN is not set
620# CONFIG_VIA_VELOCITY is not set 648# CONFIG_VIA_VELOCITY is not set
621CONFIG_TIGON3=y 649CONFIG_TIGON3=y
@@ -661,6 +689,10 @@ CONFIG_PPPOE=m
661# CONFIG_NET_FC is not set 689# CONFIG_NET_FC is not set
662# CONFIG_SHAPER is not set 690# CONFIG_SHAPER is not set
663CONFIG_NETCONSOLE=y 691CONFIG_NETCONSOLE=y
692CONFIG_NETPOLL=y
693CONFIG_NETPOLL_RX=y
694CONFIG_NETPOLL_TRAP=y
695CONFIG_NET_POLL_CONTROLLER=y
664 696
665# 697#
666# ISDN subsystem 698# ISDN subsystem
@@ -764,7 +796,6 @@ CONFIG_HVCS=m
764# 796#
765# CONFIG_WATCHDOG is not set 797# CONFIG_WATCHDOG is not set
766# CONFIG_RTC is not set 798# CONFIG_RTC is not set
767# CONFIG_GEN_RTC is not set
768# CONFIG_DTLK is not set 799# CONFIG_DTLK is not set
769# CONFIG_R3964 is not set 800# CONFIG_R3964 is not set
770# CONFIG_APPLICOM is not set 801# CONFIG_APPLICOM is not set
@@ -823,50 +854,19 @@ CONFIG_I2C_KEYWEST=y
823# CONFIG_I2C_VIAPRO is not set 854# CONFIG_I2C_VIAPRO is not set
824# CONFIG_I2C_VOODOO3 is not set 855# CONFIG_I2C_VOODOO3 is not set
825# CONFIG_I2C_PCA_ISA is not set 856# CONFIG_I2C_PCA_ISA is not set
857# CONFIG_I2C_SENSOR is not set
826 858
827# 859#
828# Hardware Sensors Chip support 860# Miscellaneous I2C Chip support
829#
830# CONFIG_I2C_SENSOR is not set
831# CONFIG_SENSORS_ADM1021 is not set
832# CONFIG_SENSORS_ADM1025 is not set
833# CONFIG_SENSORS_ADM1026 is not set
834# CONFIG_SENSORS_ADM1031 is not set
835# CONFIG_SENSORS_ASB100 is not set
836# CONFIG_SENSORS_DS1621 is not set
837# CONFIG_SENSORS_FSCHER is not set
838# CONFIG_SENSORS_FSCPOS is not set
839# CONFIG_SENSORS_GL518SM is not set
840# CONFIG_SENSORS_GL520SM is not set
841# CONFIG_SENSORS_IT87 is not set
842# CONFIG_SENSORS_LM63 is not set
843# CONFIG_SENSORS_LM75 is not set
844# CONFIG_SENSORS_LM77 is not set
845# CONFIG_SENSORS_LM78 is not set
846# CONFIG_SENSORS_LM80 is not set
847# CONFIG_SENSORS_LM83 is not set
848# CONFIG_SENSORS_LM85 is not set
849# CONFIG_SENSORS_LM87 is not set
850# CONFIG_SENSORS_LM90 is not set
851# CONFIG_SENSORS_LM92 is not set
852# CONFIG_SENSORS_MAX1619 is not set
853# CONFIG_SENSORS_PC87360 is not set
854# CONFIG_SENSORS_SMSC47B397 is not set
855# CONFIG_SENSORS_SIS5595 is not set
856# CONFIG_SENSORS_SMSC47M1 is not set
857# CONFIG_SENSORS_VIA686A is not set
858# CONFIG_SENSORS_W83781D is not set
859# CONFIG_SENSORS_W83L785TS is not set
860# CONFIG_SENSORS_W83627HF is not set
861
862#
863# Other I2C Chip support
864# 861#
865# CONFIG_SENSORS_DS1337 is not set 862# CONFIG_SENSORS_DS1337 is not set
863# CONFIG_SENSORS_DS1374 is not set
866# CONFIG_SENSORS_EEPROM is not set 864# CONFIG_SENSORS_EEPROM is not set
867# CONFIG_SENSORS_PCF8574 is not set 865# CONFIG_SENSORS_PCF8574 is not set
866# CONFIG_SENSORS_PCA9539 is not set
868# CONFIG_SENSORS_PCF8591 is not set 867# CONFIG_SENSORS_PCF8591 is not set
869# CONFIG_SENSORS_RTC8564 is not set 868# CONFIG_SENSORS_RTC8564 is not set
869# CONFIG_SENSORS_MAX6875 is not set
870# CONFIG_I2C_DEBUG_CORE is not set 870# CONFIG_I2C_DEBUG_CORE is not set
871# CONFIG_I2C_DEBUG_ALGO is not set 871# CONFIG_I2C_DEBUG_ALGO is not set
872# CONFIG_I2C_DEBUG_BUS is not set 872# CONFIG_I2C_DEBUG_BUS is not set
@@ -878,6 +878,11 @@ CONFIG_I2C_KEYWEST=y
878# CONFIG_W1 is not set 878# CONFIG_W1 is not set
879 879
880# 880#
881# Hardware Monitoring support
882#
883# CONFIG_HWMON is not set
884
885#
881# Misc devices 886# Misc devices
882# 887#
883 888
@@ -988,6 +993,7 @@ CONFIG_USB_DEVICEFS=y
988CONFIG_USB_EHCI_HCD=y 993CONFIG_USB_EHCI_HCD=y
989# CONFIG_USB_EHCI_SPLIT_ISO is not set 994# CONFIG_USB_EHCI_SPLIT_ISO is not set
990# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 995# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
996# CONFIG_USB_ISP116X_HCD is not set
991CONFIG_USB_OHCI_HCD=y 997CONFIG_USB_OHCI_HCD=y
992# CONFIG_USB_OHCI_BIG_ENDIAN is not set 998# CONFIG_USB_OHCI_BIG_ENDIAN is not set
993CONFIG_USB_OHCI_LITTLE_ENDIAN=y 999CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -1024,12 +1030,15 @@ CONFIG_USB_HIDINPUT=y
1024CONFIG_USB_HIDDEV=y 1030CONFIG_USB_HIDDEV=y
1025# CONFIG_USB_AIPTEK is not set 1031# CONFIG_USB_AIPTEK is not set
1026# CONFIG_USB_WACOM is not set 1032# CONFIG_USB_WACOM is not set
1033# CONFIG_USB_ACECAD is not set
1027# CONFIG_USB_KBTAB is not set 1034# CONFIG_USB_KBTAB is not set
1028# CONFIG_USB_POWERMATE is not set 1035# CONFIG_USB_POWERMATE is not set
1029# CONFIG_USB_MTOUCH is not set 1036# CONFIG_USB_MTOUCH is not set
1037# CONFIG_USB_ITMTOUCH is not set
1030# CONFIG_USB_EGALAX is not set 1038# CONFIG_USB_EGALAX is not set
1031# CONFIG_USB_XPAD is not set 1039# CONFIG_USB_XPAD is not set
1032# CONFIG_USB_ATI_REMOTE is not set 1040# CONFIG_USB_ATI_REMOTE is not set
1041# CONFIG_USB_KEYSPAN_REMOTE is not set
1033 1042
1034# 1043#
1035# USB Imaging devices 1044# USB Imaging devices
@@ -1081,10 +1090,11 @@ CONFIG_USB_PEGASUS=y
1081# CONFIG_USB_PHIDGETSERVO is not set 1090# CONFIG_USB_PHIDGETSERVO is not set
1082# CONFIG_USB_IDMOUSE is not set 1091# CONFIG_USB_IDMOUSE is not set
1083# CONFIG_USB_SISUSBVGA is not set 1092# CONFIG_USB_SISUSBVGA is not set
1093# CONFIG_USB_LD is not set
1084# CONFIG_USB_TEST is not set 1094# CONFIG_USB_TEST is not set
1085 1095
1086# 1096#
1087# USB ATM/DSL drivers 1097# USB DSL modem support
1088# 1098#
1089 1099
1090# 1100#
@@ -1101,18 +1111,25 @@ CONFIG_USB_PEGASUS=y
1101# InfiniBand support 1111# InfiniBand support
1102# 1112#
1103CONFIG_INFINIBAND=m 1113CONFIG_INFINIBAND=m
1114CONFIG_INFINIBAND_USER_VERBS=m
1104CONFIG_INFINIBAND_MTHCA=m 1115CONFIG_INFINIBAND_MTHCA=m
1105# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1116# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1106CONFIG_INFINIBAND_IPOIB=m 1117CONFIG_INFINIBAND_IPOIB=m
1107# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1118# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1108 1119
1109# 1120#
1121# SN Devices
1122#
1123
1124#
1110# File systems 1125# File systems
1111# 1126#
1112CONFIG_EXT2_FS=y 1127CONFIG_EXT2_FS=y
1113CONFIG_EXT2_FS_XATTR=y 1128CONFIG_EXT2_FS_XATTR=y
1114CONFIG_EXT2_FS_POSIX_ACL=y 1129CONFIG_EXT2_FS_POSIX_ACL=y
1115CONFIG_EXT2_FS_SECURITY=y 1130CONFIG_EXT2_FS_SECURITY=y
1131CONFIG_EXT2_FS_XIP=y
1132CONFIG_FS_XIP=y
1116CONFIG_EXT3_FS=y 1133CONFIG_EXT3_FS=y
1117CONFIG_EXT3_FS_XATTR=y 1134CONFIG_EXT3_FS_XATTR=y
1118CONFIG_EXT3_FS_POSIX_ACL=y 1135CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1144,6 +1161,7 @@ CONFIG_XFS_SECURITY=y
1144CONFIG_XFS_POSIX_ACL=y 1161CONFIG_XFS_POSIX_ACL=y
1145# CONFIG_MINIX_FS is not set 1162# CONFIG_MINIX_FS is not set
1146# CONFIG_ROMFS_FS is not set 1163# CONFIG_ROMFS_FS is not set
1164CONFIG_INOTIFY=y
1147# CONFIG_QUOTA is not set 1165# CONFIG_QUOTA is not set
1148CONFIG_DNOTIFY=y 1166CONFIG_DNOTIFY=y
1149CONFIG_AUTOFS_FS=y 1167CONFIG_AUTOFS_FS=y
@@ -1174,7 +1192,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1174CONFIG_PROC_FS=y 1192CONFIG_PROC_FS=y
1175CONFIG_PROC_KCORE=y 1193CONFIG_PROC_KCORE=y
1176CONFIG_SYSFS=y 1194CONFIG_SYSFS=y
1177# CONFIG_DEVFS_FS is not set
1178CONFIG_DEVPTS_FS_XATTR=y 1195CONFIG_DEVPTS_FS_XATTR=y
1179CONFIG_DEVPTS_FS_SECURITY=y 1196CONFIG_DEVPTS_FS_SECURITY=y
1180CONFIG_TMPFS=y 1197CONFIG_TMPFS=y
@@ -1206,15 +1223,20 @@ CONFIG_CRAMFS=y
1206# 1223#
1207CONFIG_NFS_FS=y 1224CONFIG_NFS_FS=y
1208CONFIG_NFS_V3=y 1225CONFIG_NFS_V3=y
1226CONFIG_NFS_V3_ACL=y
1209CONFIG_NFS_V4=y 1227CONFIG_NFS_V4=y
1210# CONFIG_NFS_DIRECTIO is not set 1228# CONFIG_NFS_DIRECTIO is not set
1211CONFIG_NFSD=m 1229CONFIG_NFSD=m
1230CONFIG_NFSD_V2_ACL=y
1212CONFIG_NFSD_V3=y 1231CONFIG_NFSD_V3=y
1232CONFIG_NFSD_V3_ACL=y
1213CONFIG_NFSD_V4=y 1233CONFIG_NFSD_V4=y
1214CONFIG_NFSD_TCP=y 1234CONFIG_NFSD_TCP=y
1215CONFIG_LOCKD=y 1235CONFIG_LOCKD=y
1216CONFIG_LOCKD_V4=y 1236CONFIG_LOCKD_V4=y
1217CONFIG_EXPORTFS=m 1237CONFIG_EXPORTFS=m
1238CONFIG_NFS_ACL_SUPPORT=y
1239CONFIG_NFS_COMMON=y
1218CONFIG_SUNRPC=y 1240CONFIG_SUNRPC=y
1219CONFIG_SUNRPC_GSS=y 1241CONFIG_SUNRPC_GSS=y
1220CONFIG_RPCSEC_GSS_KRB5=y 1242CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
index 6ffcf67dd507..76cfd1449d52 100644
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/ppc64/kernel/LparData.c
@@ -33,17 +33,36 @@
33 * the hypervisor and Linux. 33 * the hypervisor and Linux.
34 */ 34 */
35 35
36/*
37 * WARNING - magic here
38 *
39 * Ok, this is a horrid hack below, but marginally better than the
40 * alternatives. What we really want is just to initialize
41 * hvReleaseData in C as in the #if 0 section here. However, gcc
42 * refuses to believe that (u32)&x is a constant expression, so will
43 * not allow the xMsNucDataOffset field to be properly initialized.
44 * So, we declare hvReleaseData in inline asm instead. We use inline
45 * asm, rather than a .S file, because the assembler won't generate
46 * the necessary relocation for the LparMap either, unless that symbol
47 * is declared in the same source file. Finally, we put the asm in a
48 * dummy, attribute-used function, instead of at file scope, because
49 * file scope asms don't allow contraints. We want to use the "i"
50 * constraints to put sizeof() and offsetof() expressions in there,
51 * because including asm/offsets.h in C code then stringifying causes
52 * all manner of warnings.
53 */
54#if 0
36struct HvReleaseData hvReleaseData = { 55struct HvReleaseData hvReleaseData = {
37 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */ 56 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
38 .xSize = sizeof(struct HvReleaseData), 57 .xSize = sizeof(struct HvReleaseData),
39 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas), 58 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
40 .xSlicNacaAddr = &naca, /* 64-bit Naca address */ 59 .xSlicNacaAddr = &naca, /* 64-bit Naca address */
41 .xMsNucDataOffset = 0x4800, /* offset of LparMap within loadarea (see head.S) */ 60 .xMsNucDataOffset = (u32)((unsigned long)&xLparMap - KERNELBASE),
42 .xTagsMode = 1, /* tags inactive */ 61 .xFlags = HVREL_TAGSINACTIVE /* tags inactive */
43 .xAddressSize = 0, /* 64 bit */ 62 /* 64 bit */
44 .xNoSharedProcs = 0, /* shared processors */ 63 /* shared processors */
45 .xNoHMT = 0, /* HMT allowed */ 64 /* HMT allowed */
46 .xRsvd2 = 6, /* TEMP: This allows non-GA driver */ 65 | 6, /* TEMP: This allows non-GA driver */
47 .xVrmIndex = 4, /* We are v5r2m0 */ 66 .xVrmIndex = 4, /* We are v5r2m0 */
48 .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */ 67 .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */
49 .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */ 68 .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */
@@ -51,6 +70,63 @@ struct HvReleaseData hvReleaseData = {
51 0xa7, 0x40, 0xf2, 0x4b, 70 0xa7, 0x40, 0xf2, 0x4b,
52 0xf4, 0x4b, 0xf6, 0xf4 }, 71 0xf4, 0x4b, 0xf6, 0xf4 },
53}; 72};
73#endif
74
75
76extern struct HvReleaseData hvReleaseData;
77
78static void __attribute_used__ hvReleaseData_wrapper(void)
79{
80 /* This doesn't appear to need any alignment (even 4 byte) */
81 asm volatile (
82 " lparMapPhys = xLparMap - %3\n"
83 " .data\n"
84 " .globl hvReleaseData\n"
85 "hvReleaseData:\n"
86 " .long 0xc8a5d9c4\n" /* xDesc */
87 /* "HvRD" in ebcdic */
88 " .short %0\n" /* xSize */
89 " .short %1\n" /* xVpdAreasPtrOffset */
90 " .llong naca\n" /* xSlicNacaAddr */
91 " .long lparMapPhys\n" /* xMsNucDataOffset */
92 " .long 0\n" /* xRsvd1 */
93 " .short %2\n" /* xFlags */
94 " .short 4\n" /* xVrmIndex - v5r2m0 */
95 " .short 3\n" /* xMinSupportedPlicVrmIndex - v5r1m0 */
96 " .short 3\n" /* xMinCompatablePlicVrmIndex - v5r1m0 */
97 " .long 0xd38995a4\n" /* xVrmName */
98 " .long 0xa740f24b\n" /* "Linux 2.4.64" ebcdic */
99 " .long 0xf44bf6f4\n"
100 " . = hvReleaseData + %0\n"
101 " .previous\n"
102 : : "i"(sizeof(hvReleaseData)),
103 "i"(offsetof(struct naca_struct, xItVpdAreas)),
104 "i"(HVREL_TAGSINACTIVE /* tags inactive, 64 bit, */
105 /* shared processors, HMT allowed */
106 | 6), /* TEMP: This allows non-GA drivers */
107 "i"(KERNELBASE)
108 );
109}
110
111struct LparMap __attribute__((aligned (16))) xLparMap = {
112 .xNumberEsids = HvEsidsToMap,
113 .xNumberRanges = HvRangesToMap,
114 .xSegmentTableOffs = STAB0_PAGE,
115
116 .xEsids = {
117 { .xKernelEsid = GET_ESID(KERNELBASE),
118 .xKernelVsid = KERNEL_VSID(KERNELBASE), },
119 { .xKernelEsid = GET_ESID(VMALLOCBASE),
120 .xKernelVsid = KERNEL_VSID(VMALLOCBASE), },
121 },
122
123 .xRanges = {
124 { .xPages = HvPagesToMap,
125 .xOffset = 0,
126 .xVPN = KERNEL_VSID(KERNELBASE) << (SID_SHIFT - PAGE_SHIFT),
127 },
128 },
129};
54 130
55extern void system_reset_iSeries(void); 131extern void system_reset_iSeries(void);
56extern void machine_check_iSeries(void); 132extern void machine_check_iSeries(void);
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 93ebcac0d5a2..784f56d4684c 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -522,36 +522,9 @@ __end_interrupts:
522#ifdef CONFIG_PPC_ISERIES 522#ifdef CONFIG_PPC_ISERIES
523 .globl naca 523 .globl naca
524naca: 524naca:
525 .llong itVpdAreas 525 .llong itVpdAreas
526 526 .llong 0 /* xRamDisk */
527 /* 527 .llong 0 /* xRamDiskSize */
528 * The iSeries LPAR map is at this fixed address
529 * so that the HvReleaseData structure can address
530 * it with a 32-bit offset.
531 *
532 * The VSID values below are dependent on the
533 * VSID generation algorithm. See include/asm/mmu_context.h.
534 */
535
536 . = 0x4800
537
538 .llong 2 /* # ESIDs to be mapped by hypervisor */
539 .llong 1 /* # memory ranges to be mapped by hypervisor */
540 .llong STAB0_PAGE /* Page # of segment table within load area */
541 .llong 0 /* Reserved */
542 .llong 0 /* Reserved */
543 .llong 0 /* Reserved */
544 .llong 0 /* Reserved */
545 .llong 0 /* Reserved */
546 .llong (KERNELBASE>>SID_SHIFT)
547 .llong 0x408f92c94 /* KERNELBASE VSID */
548 /* We have to list the bolted VMALLOC segment here, too, so that it
549 * will be restored on shared processor switch */
550 .llong (VMALLOCBASE>>SID_SHIFT)
551 .llong 0xf09b89af5 /* VMALLOCBASE VSID */
552 .llong 8192 /* # pages to map (32 MB) */
553 .llong 0 /* Offset from start of loadarea to start of map */
554 .llong 0x408f92c940000 /* VPN of first page to map */
555 528
556 . = 0x6100 529 . = 0x6100
557 530
@@ -2098,7 +2071,7 @@ _GLOBAL(hmt_start_secondary)
2098 blr 2071 blr
2099#endif 2072#endif
2100 2073
2101#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) 2074#if defined(CONFIG_KEXEC) || (defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES))
2102_GLOBAL(smp_release_cpus) 2075_GLOBAL(smp_release_cpus)
2103 /* All secondary cpus are spinning on a common 2076 /* All secondary cpus are spinning on a common
2104 * spinloop, release them all now so they can start 2077 * spinloop, release them all now so they can start
@@ -2131,13 +2104,6 @@ empty_zero_page:
2131swapper_pg_dir: 2104swapper_pg_dir:
2132 .space 4096 2105 .space 4096
2133 2106
2134#ifdef CONFIG_SMP
2135/* 1 page segment table per cpu (max 48, cpu0 allocated at STAB0_PHYS_ADDR) */
2136 .globl stab_array
2137stab_array:
2138 .space 4096 * 48
2139#endif
2140
2141/* 2107/*
2142 * This space gets a copy of optional info passed to us by the bootstrap 2108 * This space gets a copy of optional info passed to us by the bootstrap
2143 * Used to pass parameters into the kernel like root=/dev/sda1, etc. 2109 * Used to pass parameters into the kernel like root=/dev/sda1, etc.
diff --git a/arch/ppc64/kernel/machine_kexec.c b/arch/ppc64/kernel/machine_kexec.c
index fdb2fc649d72..4775f12a013c 100644
--- a/arch/ppc64/kernel/machine_kexec.c
+++ b/arch/ppc64/kernel/machine_kexec.c
@@ -185,7 +185,7 @@ void kexec_copy_flush(struct kimage *image)
185void kexec_smp_down(void *arg) 185void kexec_smp_down(void *arg)
186{ 186{
187 if (ppc_md.cpu_irq_down) 187 if (ppc_md.cpu_irq_down)
188 ppc_md.cpu_irq_down(); 188 ppc_md.cpu_irq_down(1);
189 189
190 local_irq_disable(); 190 local_irq_disable();
191 kexec_smp_wait(); 191 kexec_smp_wait();
@@ -232,7 +232,7 @@ static void kexec_prepare_cpus(void)
232 232
233 /* after we tell the others to go down */ 233 /* after we tell the others to go down */
234 if (ppc_md.cpu_irq_down) 234 if (ppc_md.cpu_irq_down)
235 ppc_md.cpu_irq_down(); 235 ppc_md.cpu_irq_down(0);
236 236
237 put_cpu(); 237 put_cpu();
238 238
@@ -243,15 +243,19 @@ static void kexec_prepare_cpus(void)
243 243
244static void kexec_prepare_cpus(void) 244static void kexec_prepare_cpus(void)
245{ 245{
246 extern void smp_release_cpus(void);
246 /* 247 /*
247 * move the secondarys to us so that we can copy 248 * move the secondarys to us so that we can copy
248 * the new kernel 0-0x100 safely 249 * the new kernel 0-0x100 safely
249 * 250 *
250 * do this if kexec in setup.c ? 251 * do this if kexec in setup.c ?
252 *
253 * We need to release the cpus if we are ever going from an
254 * UP to an SMP kernel.
251 */ 255 */
252 smp_relase_cpus(); 256 smp_release_cpus();
253 if (ppc_md.cpu_irq_down) 257 if (ppc_md.cpu_irq_down)
254 ppc_md.cpu_irq_down(); 258 ppc_md.cpu_irq_down(0);
255 local_irq_disable(); 259 local_irq_disable();
256} 260}
257 261
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 59f4f9973818..a05b50b738e9 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -1129,6 +1129,9 @@ _GLOBAL(sys_call_table32)
1129 .llong .compat_sys_waitid 1129 .llong .compat_sys_waitid
1130 .llong .sys32_ioprio_set 1130 .llong .sys32_ioprio_set
1131 .llong .sys32_ioprio_get 1131 .llong .sys32_ioprio_get
1132 .llong .sys_inotify_init /* 275 */
1133 .llong .sys_inotify_add_watch
1134 .llong .sys_inotify_rm_watch
1132 1135
1133 .balign 8 1136 .balign 8
1134_GLOBAL(sys_call_table) 1137_GLOBAL(sys_call_table)
@@ -1407,3 +1410,6 @@ _GLOBAL(sys_call_table)
1407 .llong .sys_waitid 1410 .llong .sys_waitid
1408 .llong .sys_ioprio_set 1411 .llong .sys_ioprio_set
1409 .llong .sys_ioprio_get 1412 .llong .sys_ioprio_get
1413 .llong .sys_inotify_init /* 275 */
1414 .llong .sys_inotify_add_watch
1415 .llong .sys_inotify_rm_watch
diff --git a/arch/ppc64/kernel/mpic.c b/arch/ppc64/kernel/mpic.c
index e8fbab1df37f..cc262a05ddb4 100644
--- a/arch/ppc64/kernel/mpic.c
+++ b/arch/ppc64/kernel/mpic.c
@@ -794,10 +794,10 @@ void mpic_setup_this_cpu(void)
794 794
795/* 795/*
796 * XXX: someone who knows mpic should check this. 796 * XXX: someone who knows mpic should check this.
797 * do we need to eoi the ipi here (see xics comments)? 797 * do we need to eoi the ipi including for kexec cpu here (see xics comments)?
798 * or can we reset the mpic in the new kernel? 798 * or can we reset the mpic in the new kernel?
799 */ 799 */
800void mpic_teardown_this_cpu(void) 800void mpic_teardown_this_cpu(int secondary)
801{ 801{
802 struct mpic *mpic = mpic_primary; 802 struct mpic *mpic = mpic_primary;
803 unsigned long flags; 803 unsigned long flags;
diff --git a/arch/ppc64/kernel/mpic.h b/arch/ppc64/kernel/mpic.h
index 99fbbc9a084c..ca78a7f10528 100644
--- a/arch/ppc64/kernel/mpic.h
+++ b/arch/ppc64/kernel/mpic.h
@@ -256,7 +256,7 @@ extern unsigned int mpic_irq_get_priority(unsigned int irq);
256extern void mpic_setup_this_cpu(void); 256extern void mpic_setup_this_cpu(void);
257 257
258/* Clean up for kexec (or cpu offline or ...) */ 258/* Clean up for kexec (or cpu offline or ...) */
259extern void mpic_teardown_this_cpu(void); 259extern void mpic_teardown_this_cpu(int secondary);
260 260
261/* Request IPIs on primary mpic */ 261/* Request IPIs on primary mpic */
262extern void mpic_request_ipis(void); 262extern void mpic_request_ipis(void);
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index ae6f579d3fa0..d0d55c7908ef 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -108,8 +108,28 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region
108 region->end = res->end - offset; 108 region->end = res->end - offset;
109} 109}
110 110
111void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
112 struct pci_bus_region *region)
113{
114 unsigned long offset = 0;
115 struct pci_controller *hose = pci_bus_to_host(dev->bus);
116
117 if (!hose)
118 return;
119
120 if (res->flags & IORESOURCE_IO)
121 offset = (unsigned long)hose->io_base_virt - pci_io_base;
122
123 if (res->flags & IORESOURCE_MEM)
124 offset = hose->pci_mem_offset;
125
126 res->start = region->start + offset;
127 res->end = region->end + offset;
128}
129
111#ifdef CONFIG_HOTPLUG 130#ifdef CONFIG_HOTPLUG
112EXPORT_SYMBOL(pcibios_resource_to_bus); 131EXPORT_SYMBOL(pcibios_resource_to_bus);
132EXPORT_SYMBOL(pcibios_bus_to_resource);
113#endif 133#endif
114 134
115/* 135/*
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 3013cdb5f933..e40877fa67cd 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -97,7 +97,7 @@ EXPORT_SYMBOL(smu_cmdbuf_abs);
97 97
98extern void udbg_init_scc(struct device_node *np); 98extern void udbg_init_scc(struct device_node *np);
99 99
100void __pmac pmac_show_cpuinfo(struct seq_file *m) 100static void __pmac pmac_show_cpuinfo(struct seq_file *m)
101{ 101{
102 struct device_node *np; 102 struct device_node *np;
103 char *pp; 103 char *pp;
@@ -144,7 +144,7 @@ void __pmac pmac_show_cpuinfo(struct seq_file *m)
144} 144}
145 145
146 146
147void __init pmac_setup_arch(void) 147static void __init pmac_setup_arch(void)
148{ 148{
149 /* init to some ~sane value until calibrate_delay() runs */ 149 /* init to some ~sane value until calibrate_delay() runs */
150 loops_per_jiffy = 50000000; 150 loops_per_jiffy = 50000000;
@@ -230,7 +230,7 @@ void __pmac note_bootable_part(dev_t dev, int part, int goodness)
230 } 230 }
231} 231}
232 232
233void __pmac pmac_restart(char *cmd) 233static void __pmac pmac_restart(char *cmd)
234{ 234{
235 switch(sys_ctrler) { 235 switch(sys_ctrler) {
236#ifdef CONFIG_ADB_PMU 236#ifdef CONFIG_ADB_PMU
@@ -249,7 +249,7 @@ void __pmac pmac_restart(char *cmd)
249 } 249 }
250} 250}
251 251
252void __pmac pmac_power_off(void) 252static void __pmac pmac_power_off(void)
253{ 253{
254 switch(sys_ctrler) { 254 switch(sys_ctrler) {
255#ifdef CONFIG_ADB_PMU 255#ifdef CONFIG_ADB_PMU
@@ -267,7 +267,7 @@ void __pmac pmac_power_off(void)
267 } 267 }
268} 268}
269 269
270void __pmac pmac_halt(void) 270static void __pmac pmac_halt(void)
271{ 271{
272 pmac_power_off(); 272 pmac_power_off();
273} 273}
@@ -327,7 +327,7 @@ static void __init init_boot_display(void)
327/* 327/*
328 * Early initialization. 328 * Early initialization.
329 */ 329 */
330void __init pmac_init_early(void) 330static void __init pmac_init_early(void)
331{ 331{
332 DBG(" -> pmac_init_early\n"); 332 DBG(" -> pmac_init_early\n");
333 333
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index 47727a6f7346..5aca01ddd81f 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -916,6 +916,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
916 } 916 }
917 } 917 }
918 918
919#ifdef CONFIG_ALTIVEC
919 /* Check if we have a VMX and eventually update CPU features */ 920 /* Check if we have a VMX and eventually update CPU features */
920 prop = (u32 *)get_flat_dt_prop(node, "ibm,vmx", NULL); 921 prop = (u32 *)get_flat_dt_prop(node, "ibm,vmx", NULL);
921 if (prop && (*prop) > 0) { 922 if (prop && (*prop) > 0) {
@@ -929,6 +930,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
929 cur_cpu_spec->cpu_features |= CPU_FTR_ALTIVEC; 930 cur_cpu_spec->cpu_features |= CPU_FTR_ALTIVEC;
930 cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC; 931 cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC;
931 } 932 }
933#endif /* CONFIG_ALTIVEC */
932 934
933 /* 935 /*
934 * Check for an SMT capable CPU and set the CPU feature. We do 936 * Check for an SMT capable CPU and set the CPU feature. We do
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index e80f10c89824..687e85595208 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -1068,6 +1068,8 @@ void __init setup_arch(char **cmdline_p)
1068 irqstack_early_init(); 1068 irqstack_early_init();
1069 emergency_stack_init(); 1069 emergency_stack_init();
1070 1070
1071 stabs_alloc();
1072
1071 /* set up the bootmem stuff with available memory */ 1073 /* set up the bootmem stuff with available memory */
1072 do_init_bootmem(); 1074 do_init_bootmem();
1073 sparse_init(); 1075 sparse_init();
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
index 2fcddfcb594d..793b562da653 100644
--- a/arch/ppc64/kernel/smp.c
+++ b/arch/ppc64/kernel/smp.c
@@ -65,8 +65,6 @@ struct smp_ops_t *smp_ops;
65 65
66static volatile unsigned int cpu_callin_map[NR_CPUS]; 66static volatile unsigned int cpu_callin_map[NR_CPUS];
67 67
68extern unsigned char stab_array[];
69
70void smp_call_function_interrupt(void); 68void smp_call_function_interrupt(void);
71 69
72int smt_enabled_at_boot = 1; 70int smt_enabled_at_boot = 1;
@@ -492,19 +490,6 @@ int __devinit __cpu_up(unsigned int cpu)
492 490
493 paca[cpu].default_decr = tb_ticks_per_jiffy; 491 paca[cpu].default_decr = tb_ticks_per_jiffy;
494 492
495 if (!cpu_has_feature(CPU_FTR_SLB)) {
496 void *tmp;
497
498 /* maximum of 48 CPUs on machines with a segment table */
499 if (cpu >= 48)
500 BUG();
501
502 tmp = &stab_array[PAGE_SIZE * cpu];
503 memset(tmp, 0, PAGE_SIZE);
504 paca[cpu].stab_addr = (unsigned long)tmp;
505 paca[cpu].stab_real = virt_to_abs(tmp);
506 }
507
508 /* Make sure callin-map entry is 0 (can be leftover a CPU 493 /* Make sure callin-map entry is 0 (can be leftover a CPU
509 * hotplug 494 * hotplug
510 */ 495 */
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index d4ccd6f1ef47..c0da45540f0f 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -141,7 +141,7 @@ void udbg_init_scc(struct device_node *np)
141 141
142#endif /* CONFIG_PPC_PMAC */ 142#endif /* CONFIG_PPC_PMAC */
143 143
144#if CONFIG_PPC_PMAC 144#ifdef CONFIG_PPC_PMAC
145static void udbg_real_putc(unsigned char c) 145static void udbg_real_putc(unsigned char c)
146{ 146{
147 while ((real_readb(sccc) & SCC_TXRDY) == 0) 147 while ((real_readb(sccc) & SCC_TXRDY) == 0)
diff --git a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
index 677c4450984a..d9dc6f28d050 100644
--- a/arch/ppc64/kernel/xics.c
+++ b/arch/ppc64/kernel/xics.c
@@ -647,29 +647,30 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
647 } 647 }
648} 648}
649 649
650void xics_teardown_cpu(void) 650void xics_teardown_cpu(int secondary)
651{ 651{
652 int cpu = smp_processor_id(); 652 int cpu = smp_processor_id();
653 int status;
654 653
655 ops->cppr_info(cpu, 0x00); 654 ops->cppr_info(cpu, 0x00);
656 iosync(); 655 iosync();
657 656
658 /* 657 /*
659 * we need to EOI the IPI if we got here from kexec down IPI 658 * Some machines need to have at least one cpu in the GIQ,
660 * 659 * so leave the master cpu in the group.
661 * xics doesn't care if we duplicate an EOI as long as we
662 * don't EOI and raise priority.
663 *
664 * probably need to check all the other interrupts too
665 * should we be flagging idle loop instead?
666 * or creating some task to be scheduled?
667 */ 660 */
668 ops->xirr_info_set(cpu, XICS_IPI); 661 if (secondary) {
669 662 /*
670 status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, 663 * we need to EOI the IPI if we got here from kexec down IPI
671 (1UL << interrupt_server_size) - 1 - default_distrib_server, 0); 664 *
672 WARN_ON(status != 0); 665 * probably need to check all the other interrupts too
666 * should we be flagging idle loop instead?
667 * or creating some task to be scheduled?
668 */
669 ops->xirr_info_set(cpu, XICS_IPI);
670 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
671 (1UL << interrupt_server_size) - 1 -
672 default_distrib_server, 0);
673 }
673} 674}
674 675
675#ifdef CONFIG_HOTPLUG_CPU 676#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c
index cafd91aef289..0b191f2de016 100644
--- a/arch/ppc64/mm/numa.c
+++ b/arch/ppc64/mm/numa.c
@@ -647,7 +647,12 @@ void __init do_init_bootmem(void)
647new_range: 647new_range:
648 mem_start = read_n_cells(addr_cells, &memcell_buf); 648 mem_start = read_n_cells(addr_cells, &memcell_buf);
649 mem_size = read_n_cells(size_cells, &memcell_buf); 649 mem_size = read_n_cells(size_cells, &memcell_buf);
650 numa_domain = numa_enabled ? of_node_numa_domain(memory) : 0; 650 if (numa_enabled) {
651 numa_domain = of_node_numa_domain(memory);
652 if (numa_domain >= MAX_NUMNODES)
653 numa_domain = 0;
654 } else
655 numa_domain = 0;
651 656
652 if (numa_domain != nid) 657 if (numa_domain != nid)
653 continue; 658 continue;
diff --git a/arch/ppc64/mm/stab.c b/arch/ppc64/mm/stab.c
index df4bbe14153c..1b83f002bf27 100644
--- a/arch/ppc64/mm/stab.c
+++ b/arch/ppc64/mm/stab.c
@@ -18,6 +18,8 @@
18#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
19#include <asm/paca.h> 19#include <asm/paca.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/lmb.h>
22#include <asm/abs_addr.h>
21 23
22struct stab_entry { 24struct stab_entry {
23 unsigned long esid_data; 25 unsigned long esid_data;
@@ -224,6 +226,39 @@ void switch_stab(struct task_struct *tsk, struct mm_struct *mm)
224extern void slb_initialize(void); 226extern void slb_initialize(void);
225 227
226/* 228/*
229 * Allocate segment tables for secondary CPUs. These must all go in
230 * the first (bolted) segment, so that do_stab_bolted won't get a
231 * recursive segment miss on the segment table itself.
232 */
233void stabs_alloc(void)
234{
235 int cpu;
236
237 if (cpu_has_feature(CPU_FTR_SLB))
238 return;
239
240 for_each_cpu(cpu) {
241 unsigned long newstab;
242
243 if (cpu == 0)
244 continue; /* stab for CPU 0 is statically allocated */
245
246 newstab = lmb_alloc_base(PAGE_SIZE, PAGE_SIZE, 1<<SID_SHIFT);
247 if (! newstab)
248 panic("Unable to allocate segment table for CPU %d.\n",
249 cpu);
250
251 newstab += KERNELBASE;
252
253 memset((void *)newstab, 0, PAGE_SIZE);
254
255 paca[cpu].stab_addr = newstab;
256 paca[cpu].stab_real = virt_to_abs(newstab);
257 printk(KERN_DEBUG "Segment table for CPU %d at 0x%lx virtual, 0x%lx absolute\n", cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
258 }
259}
260
261/*
227 * Build an entry for the base kernel segment and put it into 262 * Build an entry for the base kernel segment and put it into
228 * the segment table or SLB. All other segment table or SLB 263 * the segment table or SLB. All other segment table or SLB
229 * entries are faulted in. 264 * entries are faulted in.
diff --git a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
index 7f6e13a4b71e..05539439e6bc 100644
--- a/arch/ppc64/xmon/xmon.c
+++ b/arch/ppc64/xmon/xmon.c
@@ -329,13 +329,16 @@ int xmon_core(struct pt_regs *regs, int fromipi)
329 printf("cpu 0x%x: Exception %lx %s in xmon, " 329 printf("cpu 0x%x: Exception %lx %s in xmon, "
330 "returning to main loop\n", 330 "returning to main loop\n",
331 cpu, regs->trap, getvecname(TRAP(regs))); 331 cpu, regs->trap, getvecname(TRAP(regs)));
332 release_output_lock();
332 longjmp(xmon_fault_jmp[cpu], 1); 333 longjmp(xmon_fault_jmp[cpu], 1);
333 } 334 }
334 335
335 if (setjmp(recurse_jmp) != 0) { 336 if (setjmp(recurse_jmp) != 0) {
336 if (!in_xmon || !xmon_gate) { 337 if (!in_xmon || !xmon_gate) {
338 get_output_lock();
337 printf("xmon: WARNING: bad recursive fault " 339 printf("xmon: WARNING: bad recursive fault "
338 "on cpu 0x%x\n", cpu); 340 "on cpu 0x%x\n", cpu);
341 release_output_lock();
339 goto waiting; 342 goto waiting;
340 } 343 }
341 secondary = !(xmon_taken && cpu == xmon_owner); 344 secondary = !(xmon_taken && cpu == xmon_owner);
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index c067435bae45..c9f2f60cfa58 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -232,7 +232,11 @@ static int appldata_diag(char record_nr, u16 function, unsigned long buffer,
232 ry = -1; 232 ry = -1;
233 asm volatile( 233 asm volatile(
234 "diag %1,%0,0xDC\n\t" 234 "diag %1,%0,0xDC\n\t"
235 : "=d" (ry) : "d" (&(appldata_parameter_list)) : "cc"); 235 : "=d" (ry)
236 : "d" (&appldata_parameter_list),
237 "m" (appldata_parameter_list),
238 "m" (appldata_product_id)
239 : "cc");
236 return (int) ry; 240 return (int) ry;
237} 241}
238/************************ timer, work, DIAG <END> ****************************/ 242/************************ timer, work, DIAG <END> ****************************/
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 89850b2c27ea..0865251a3f44 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc3 3# Linux kernel version: 2.6.13-rc4
4# Fri Apr 22 15:30:58 2005 4# Fri Jul 29 14:49:30 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y 7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -23,10 +23,11 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
23CONFIG_LOCALVERSION="" 23CONFIG_LOCALVERSION=""
24CONFIG_SWAP=y 24CONFIG_SWAP=y
25CONFIG_SYSVIPC=y 25CONFIG_SYSVIPC=y
26# CONFIG_POSIX_MQUEUE is not set 26CONFIG_POSIX_MQUEUE=y
27# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
28CONFIG_SYSCTL=y 28CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 29CONFIG_AUDIT=y
30# CONFIG_AUDITSYSCALL is not set
30CONFIG_HOTPLUG=y 31CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y 32CONFIG_KOBJECT_UEVENT=y
32CONFIG_IKCONFIG=y 33CONFIG_IKCONFIG=y
@@ -36,6 +37,8 @@ CONFIG_IKCONFIG_PROC=y
36CONFIG_KALLSYMS=y 37CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_ALL is not set 38# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
39CONFIG_BASE_FULL=y 42CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y 43CONFIG_FUTEX=y
41CONFIG_EPOLL=y 44CONFIG_EPOLL=y
@@ -51,9 +54,10 @@ CONFIG_BASE_SMALL=0
51# Loadable module support 54# Loadable module support
52# 55#
53CONFIG_MODULES=y 56CONFIG_MODULES=y
54# CONFIG_MODULE_UNLOAD is not set 57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y 59CONFIG_OBSOLETE_MODPARM=y
56# CONFIG_MODVERSIONS is not set 60CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set 61# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y 62CONFIG_KMOD=y
59CONFIG_STOP_MACHINE=y 63CONFIG_STOP_MACHINE=y
@@ -81,8 +85,15 @@ CONFIG_MARCH_G5=y
81# CONFIG_MARCH_Z990 is not set 85# CONFIG_MARCH_Z990 is not set
82CONFIG_PACK_STACK=y 86CONFIG_PACK_STACK=y
83# CONFIG_SMALL_STACK is not set 87# CONFIG_SMALL_STACK is not set
84# CONFIG_CHECK_STACK is not set 88CONFIG_CHECK_STACK=y
89CONFIG_STACK_GUARD=256
85# CONFIG_WARN_STACK is not set 90# CONFIG_WARN_STACK is not set
91CONFIG_SELECT_MEMORY_MODEL=y
92CONFIG_FLATMEM_MANUAL=y
93# CONFIG_DISCONTIGMEM_MANUAL is not set
94# CONFIG_SPARSEMEM_MANUAL is not set
95CONFIG_FLATMEM=y
96CONFIG_FLAT_NODE_MEM_MAP=y
86 97
87# 98#
88# I/O subsystem configuration 99# I/O subsystem configuration
@@ -95,7 +106,7 @@ CONFIG_QDIO=y
95# 106#
96# Misc 107# Misc
97# 108#
98# CONFIG_PREEMPT is not set 109CONFIG_PREEMPT=y
99CONFIG_IPL=y 110CONFIG_IPL=y
100# CONFIG_IPL_TAPE is not set 111# CONFIG_IPL_TAPE is not set
101CONFIG_IPL_VM=y 112CONFIG_IPL_VM=y
@@ -105,9 +116,110 @@ CONFIG_BINFMT_MISC=m
105CONFIG_PFAULT=y 116CONFIG_PFAULT=y
106# CONFIG_SHARED_KERNEL is not set 117# CONFIG_SHARED_KERNEL is not set
107# CONFIG_CMM is not set 118# CONFIG_CMM is not set
108# CONFIG_VIRT_TIMER is not set 119CONFIG_VIRT_TIMER=y
120CONFIG_VIRT_CPU_ACCOUNTING=y
121# CONFIG_APPLDATA_BASE is not set
109CONFIG_NO_IDLE_HZ=y 122CONFIG_NO_IDLE_HZ=y
110CONFIG_NO_IDLE_HZ_INIT=y 123CONFIG_NO_IDLE_HZ_INIT=y
124# CONFIG_KEXEC is not set
125
126#
127# Networking
128#
129CONFIG_NET=y
130
131#
132# Networking options
133#
134CONFIG_PACKET=y
135# CONFIG_PACKET_MMAP is not set
136CONFIG_UNIX=y
137CONFIG_XFRM=y
138# CONFIG_XFRM_USER is not set
139CONFIG_NET_KEY=y
140CONFIG_INET=y
141CONFIG_IP_MULTICAST=y
142# CONFIG_IP_ADVANCED_ROUTER is not set
143CONFIG_IP_FIB_HASH=y
144# CONFIG_IP_PNP is not set
145# CONFIG_NET_IPIP is not set
146# CONFIG_NET_IPGRE is not set
147# CONFIG_IP_MROUTE is not set
148# CONFIG_ARPD is not set
149# CONFIG_SYN_COOKIES is not set
150# CONFIG_INET_AH is not set
151# CONFIG_INET_ESP is not set
152# CONFIG_INET_IPCOMP is not set
153# CONFIG_INET_TUNNEL is not set
154CONFIG_IP_TCPDIAG=y
155CONFIG_IP_TCPDIAG_IPV6=y
156# CONFIG_TCP_CONG_ADVANCED is not set
157CONFIG_TCP_CONG_BIC=y
158CONFIG_IPV6=y
159# CONFIG_IPV6_PRIVACY is not set
160# CONFIG_INET6_AH is not set
161# CONFIG_INET6_ESP is not set
162# CONFIG_INET6_IPCOMP is not set
163# CONFIG_INET6_TUNNEL is not set
164# CONFIG_IPV6_TUNNEL is not set
165# CONFIG_NETFILTER is not set
166
167#
168# SCTP Configuration (EXPERIMENTAL)
169#
170# CONFIG_IP_SCTP is not set
171# CONFIG_ATM is not set
172# CONFIG_BRIDGE is not set
173# CONFIG_VLAN_8021Q is not set
174# CONFIG_DECNET is not set
175# CONFIG_LLC2 is not set
176# CONFIG_IPX is not set
177# CONFIG_ATALK is not set
178# CONFIG_X25 is not set
179# CONFIG_LAPB is not set
180# CONFIG_NET_DIVERT is not set
181# CONFIG_ECONET is not set
182# CONFIG_WAN_ROUTER is not set
183CONFIG_NET_SCHED=y
184CONFIG_NET_SCH_CLK_JIFFIES=y
185# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
186# CONFIG_NET_SCH_CLK_CPU is not set
187CONFIG_NET_SCH_CBQ=m
188# CONFIG_NET_SCH_HTB is not set
189# CONFIG_NET_SCH_HFSC is not set
190CONFIG_NET_SCH_PRIO=m
191CONFIG_NET_SCH_RED=m
192CONFIG_NET_SCH_SFQ=m
193CONFIG_NET_SCH_TEQL=m
194CONFIG_NET_SCH_TBF=m
195CONFIG_NET_SCH_GRED=m
196CONFIG_NET_SCH_DSMARK=m
197# CONFIG_NET_SCH_NETEM is not set
198# CONFIG_NET_SCH_INGRESS is not set
199CONFIG_NET_QOS=y
200CONFIG_NET_ESTIMATOR=y
201CONFIG_NET_CLS=y
202# CONFIG_NET_CLS_BASIC is not set
203CONFIG_NET_CLS_TCINDEX=m
204CONFIG_NET_CLS_ROUTE4=m
205CONFIG_NET_CLS_ROUTE=y
206CONFIG_NET_CLS_FW=m
207CONFIG_NET_CLS_U32=m
208# CONFIG_CLS_U32_PERF is not set
209# CONFIG_NET_CLS_IND is not set
210CONFIG_NET_CLS_RSVP=m
211CONFIG_NET_CLS_RSVP6=m
212# CONFIG_NET_EMATCH is not set
213# CONFIG_NET_CLS_ACT is not set
214CONFIG_NET_CLS_POLICE=y
215
216#
217# Network testing
218#
219# CONFIG_NET_PKTGEN is not set
220# CONFIG_HAMRADIO is not set
221# CONFIG_IRDA is not set
222# CONFIG_BT is not set
111# CONFIG_PCMCIA is not set 223# CONFIG_PCMCIA is not set
112 224
113# 225#
@@ -133,6 +245,7 @@ CONFIG_CHR_DEV_ST=y
133CONFIG_BLK_DEV_SR=y 245CONFIG_BLK_DEV_SR=y
134CONFIG_BLK_DEV_SR_VENDOR=y 246CONFIG_BLK_DEV_SR_VENDOR=y
135CONFIG_CHR_DEV_SG=y 247CONFIG_CHR_DEV_SG=y
248# CONFIG_CHR_DEV_SCH is not set
136 249
137# 250#
138# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 251# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -205,7 +318,13 @@ CONFIG_MD_RAID5=m
205# CONFIG_MD_RAID6 is not set 318# CONFIG_MD_RAID6 is not set
206CONFIG_MD_MULTIPATH=m 319CONFIG_MD_MULTIPATH=m
207# CONFIG_MD_FAULTY is not set 320# CONFIG_MD_FAULTY is not set
208# CONFIG_BLK_DEV_DM is not set 321CONFIG_BLK_DEV_DM=y
322CONFIG_DM_CRYPT=y
323CONFIG_DM_SNAPSHOT=y
324CONFIG_DM_MIRROR=y
325CONFIG_DM_ZERO=y
326CONFIG_DM_MULTIPATH=y
327# CONFIG_DM_MULTIPATH_EMC is not set
209 328
210# 329#
211# Character device drivers 330# Character device drivers
@@ -231,7 +350,8 @@ CONFIG_CCW_CONSOLE=y
231CONFIG_SCLP=y 350CONFIG_SCLP=y
232CONFIG_SCLP_TTY=y 351CONFIG_SCLP_TTY=y
233CONFIG_SCLP_CONSOLE=y 352CONFIG_SCLP_CONSOLE=y
234# CONFIG_SCLP_VT220_TTY is not set 353CONFIG_SCLP_VT220_TTY=y
354CONFIG_SCLP_VT220_CONSOLE=y
235CONFIG_SCLP_CPI=m 355CONFIG_SCLP_CPI=m
236CONFIG_S390_TAPE=m 356CONFIG_S390_TAPE=m
237 357
@@ -255,105 +375,8 @@ CONFIG_S390_TAPE_34XX=m
255CONFIG_Z90CRYPT=m 375CONFIG_Z90CRYPT=m
256 376
257# 377#
258# Networking support 378# Network device support
259#
260CONFIG_NET=y
261
262#
263# Networking options
264#
265CONFIG_PACKET=y
266# CONFIG_PACKET_MMAP is not set
267CONFIG_UNIX=y
268CONFIG_NET_KEY=y
269CONFIG_INET=y
270CONFIG_IP_MULTICAST=y
271# CONFIG_IP_ADVANCED_ROUTER is not set
272# CONFIG_IP_PNP is not set
273# CONFIG_NET_IPIP is not set
274# CONFIG_NET_IPGRE is not set
275# CONFIG_IP_MROUTE is not set
276# CONFIG_ARPD is not set
277# CONFIG_SYN_COOKIES is not set
278# CONFIG_INET_AH is not set
279# CONFIG_INET_ESP is not set
280# CONFIG_INET_IPCOMP is not set
281# CONFIG_INET_TUNNEL is not set
282CONFIG_IP_TCPDIAG=y
283CONFIG_IP_TCPDIAG_IPV6=y
284CONFIG_IPV6=y
285# CONFIG_IPV6_PRIVACY is not set
286# CONFIG_INET6_AH is not set
287# CONFIG_INET6_ESP is not set
288# CONFIG_INET6_IPCOMP is not set
289# CONFIG_INET6_TUNNEL is not set
290# CONFIG_IPV6_TUNNEL is not set
291# CONFIG_NETFILTER is not set
292CONFIG_XFRM=y
293# CONFIG_XFRM_USER is not set
294
295#
296# SCTP Configuration (EXPERIMENTAL)
297#
298# CONFIG_IP_SCTP is not set
299# CONFIG_ATM is not set
300# CONFIG_BRIDGE is not set
301# CONFIG_VLAN_8021Q is not set
302# CONFIG_DECNET is not set
303# CONFIG_LLC2 is not set
304# CONFIG_IPX is not set
305# CONFIG_ATALK is not set
306# CONFIG_X25 is not set
307# CONFIG_LAPB is not set
308# CONFIG_NET_DIVERT is not set
309# CONFIG_ECONET is not set
310# CONFIG_WAN_ROUTER is not set
311
312#
313# QoS and/or fair queueing
314#
315CONFIG_NET_SCHED=y
316CONFIG_NET_SCH_CLK_JIFFIES=y
317# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
318# CONFIG_NET_SCH_CLK_CPU is not set
319CONFIG_NET_SCH_CBQ=m
320# CONFIG_NET_SCH_HTB is not set
321# CONFIG_NET_SCH_HFSC is not set
322CONFIG_NET_SCH_PRIO=m
323CONFIG_NET_SCH_RED=m
324CONFIG_NET_SCH_SFQ=m
325CONFIG_NET_SCH_TEQL=m
326CONFIG_NET_SCH_TBF=m
327CONFIG_NET_SCH_GRED=m
328CONFIG_NET_SCH_DSMARK=m
329# CONFIG_NET_SCH_NETEM is not set
330# CONFIG_NET_SCH_INGRESS is not set
331CONFIG_NET_QOS=y
332CONFIG_NET_ESTIMATOR=y
333CONFIG_NET_CLS=y
334# CONFIG_NET_CLS_BASIC is not set
335CONFIG_NET_CLS_TCINDEX=m
336CONFIG_NET_CLS_ROUTE4=m
337CONFIG_NET_CLS_ROUTE=y
338CONFIG_NET_CLS_FW=m
339CONFIG_NET_CLS_U32=m
340# CONFIG_CLS_U32_PERF is not set
341# CONFIG_NET_CLS_IND is not set
342CONFIG_NET_CLS_RSVP=m
343CONFIG_NET_CLS_RSVP6=m
344# CONFIG_NET_EMATCH is not set
345# CONFIG_NET_CLS_ACT is not set
346CONFIG_NET_CLS_POLICE=y
347
348#
349# Network testing
350# 379#
351# CONFIG_NET_PKTGEN is not set
352# CONFIG_NETPOLL is not set
353# CONFIG_NET_POLL_CONTROLLER is not set
354# CONFIG_HAMRADIO is not set
355# CONFIG_IRDA is not set
356# CONFIG_BT is not set
357CONFIG_NETDEVICES=y 380CONFIG_NETDEVICES=y
358CONFIG_DUMMY=m 381CONFIG_DUMMY=m
359CONFIG_BONDING=m 382CONFIG_BONDING=m
@@ -411,12 +434,15 @@ CONFIG_CCWGROUP=y
411# CONFIG_SLIP is not set 434# CONFIG_SLIP is not set
412# CONFIG_SHAPER is not set 435# CONFIG_SHAPER is not set
413# CONFIG_NETCONSOLE is not set 436# CONFIG_NETCONSOLE is not set
437# CONFIG_NETPOLL is not set
438# CONFIG_NET_POLL_CONTROLLER is not set
414 439
415# 440#
416# File systems 441# File systems
417# 442#
418CONFIG_EXT2_FS=y 443CONFIG_EXT2_FS=y
419# CONFIG_EXT2_FS_XATTR is not set 444# CONFIG_EXT2_FS_XATTR is not set
445# CONFIG_EXT2_FS_XIP is not set
420CONFIG_EXT3_FS=y 446CONFIG_EXT3_FS=y
421CONFIG_EXT3_FS_XATTR=y 447CONFIG_EXT3_FS_XATTR=y
422# CONFIG_EXT3_FS_POSIX_ACL is not set 448# CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -426,6 +452,7 @@ CONFIG_JBD=y
426CONFIG_FS_MBCACHE=y 452CONFIG_FS_MBCACHE=y
427# CONFIG_REISERFS_FS is not set 453# CONFIG_REISERFS_FS is not set
428# CONFIG_JFS_FS is not set 454# CONFIG_JFS_FS is not set
455# CONFIG_FS_POSIX_ACL is not set
429 456
430# 457#
431# XFS support 458# XFS support
@@ -433,6 +460,7 @@ CONFIG_FS_MBCACHE=y
433# CONFIG_XFS_FS is not set 460# CONFIG_XFS_FS is not set
434# CONFIG_MINIX_FS is not set 461# CONFIG_MINIX_FS is not set
435# CONFIG_ROMFS_FS is not set 462# CONFIG_ROMFS_FS is not set
463CONFIG_INOTIFY=y
436# CONFIG_QUOTA is not set 464# CONFIG_QUOTA is not set
437CONFIG_DNOTIFY=y 465CONFIG_DNOTIFY=y
438# CONFIG_AUTOFS_FS is not set 466# CONFIG_AUTOFS_FS is not set
@@ -457,7 +485,6 @@ CONFIG_DNOTIFY=y
457CONFIG_PROC_FS=y 485CONFIG_PROC_FS=y
458CONFIG_PROC_KCORE=y 486CONFIG_PROC_KCORE=y
459CONFIG_SYSFS=y 487CONFIG_SYSFS=y
460# CONFIG_DEVFS_FS is not set
461# CONFIG_DEVPTS_FS_XATTR is not set 488# CONFIG_DEVPTS_FS_XATTR is not set
462CONFIG_TMPFS=y 489CONFIG_TMPFS=y
463# CONFIG_TMPFS_XATTR is not set 490# CONFIG_TMPFS_XATTR is not set
@@ -486,15 +513,18 @@ CONFIG_RAMFS=y
486# 513#
487CONFIG_NFS_FS=y 514CONFIG_NFS_FS=y
488CONFIG_NFS_V3=y 515CONFIG_NFS_V3=y
516# CONFIG_NFS_V3_ACL is not set
489# CONFIG_NFS_V4 is not set 517# CONFIG_NFS_V4 is not set
490# CONFIG_NFS_DIRECTIO is not set 518# CONFIG_NFS_DIRECTIO is not set
491CONFIG_NFSD=y 519CONFIG_NFSD=y
492CONFIG_NFSD_V3=y 520CONFIG_NFSD_V3=y
521# CONFIG_NFSD_V3_ACL is not set
493# CONFIG_NFSD_V4 is not set 522# CONFIG_NFSD_V4 is not set
494CONFIG_NFSD_TCP=y 523CONFIG_NFSD_TCP=y
495CONFIG_LOCKD=y 524CONFIG_LOCKD=y
496CONFIG_LOCKD_V4=y 525CONFIG_LOCKD_V4=y
497CONFIG_EXPORTFS=y 526CONFIG_EXPORTFS=y
527CONFIG_NFS_COMMON=y
498CONFIG_SUNRPC=y 528CONFIG_SUNRPC=y
499# CONFIG_RPCSEC_GSS_KRB5 is not set 529# CONFIG_RPCSEC_GSS_KRB5 is not set
500# CONFIG_RPCSEC_GSS_SPKM3 is not set 530# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -544,11 +574,12 @@ CONFIG_MAGIC_SYSRQ=y
544CONFIG_LOG_BUF_SHIFT=17 574CONFIG_LOG_BUF_SHIFT=17
545# CONFIG_SCHEDSTATS is not set 575# CONFIG_SCHEDSTATS is not set
546# CONFIG_DEBUG_SLAB is not set 576# CONFIG_DEBUG_SLAB is not set
577CONFIG_DEBUG_PREEMPT=y
547# CONFIG_DEBUG_SPINLOCK is not set 578# CONFIG_DEBUG_SPINLOCK is not set
548# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 579# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
549# CONFIG_DEBUG_KOBJECT is not set 580# CONFIG_DEBUG_KOBJECT is not set
550# CONFIG_DEBUG_INFO is not set 581# CONFIG_DEBUG_INFO is not set
551# CONFIG_DEBUG_FS is not set 582CONFIG_DEBUG_FS=y
552 583
553# 584#
554# Security options 585# Security options
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 799a98eac92d..23fe94e58688 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1449,3 +1449,29 @@ compat_sys_kexec_load_wrapper:
1449 llgtr %r4,%r4 # struct kexec_segment * 1449 llgtr %r4,%r4 # struct kexec_segment *
1450 llgfr %r5,%r5 # unsigned long 1450 llgfr %r5,%r5 # unsigned long
1451 jg compat_sys_kexec_load 1451 jg compat_sys_kexec_load
1452
1453 .globl sys_ioprio_set_wrapper
1454sys_ioprio_set_wrapper:
1455 lgfr %r2,%r2 # int
1456 lgfr %r3,%r3 # int
1457 lgfr %r4,%r4 # int
1458 jg sys_ioprio_set
1459
1460 .globl sys_ioprio_get_wrapper
1461sys_ioprio_get_wrapper:
1462 lgfr %r2,%r2 # int
1463 lgfr %r3,%r3 # int
1464 jg sys_ioprio_get
1465
1466 .globl sys_inotify_add_watch_wrapper
1467sys_inotify_add_watch_wrapper:
1468 lgfr %r2,%r2 # int
1469 llgtr %r3,%r3 # const char *
1470 llgfr %r4,%r4 # u32
1471 jg sys_inotify_add_watch
1472
1473 .globl sys_inotify_rm_watch_wrapper
1474sys_inotify_rm_watch_wrapper:
1475 lgfr %r2,%r2 # int
1476 llgfr %r3,%r3 # u32
1477 jg sys_inotify_rm_watch
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 5b262b5d869f..1a271b16cb5c 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -690,9 +690,9 @@ mcck_int_handler:
690 bo BASED(0f) 690 bo BASED(0f)
691 spt __LC_LAST_UPDATE_TIMER # revalidate cpu timer 691 spt __LC_LAST_UPDATE_TIMER # revalidate cpu timer
692#ifdef CONFIG_VIRT_CPU_ACCOUNTING 692#ifdef CONFIG_VIRT_CPU_ACCOUNTING
693 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 693 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
694 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 694 mvc __LC_SYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
695 mvc __LC_LAST_UPDATE_TIMER(8),__LC_EXIT_TIMER 695 mvc __LC_EXIT_TIMER(8),__LC_LAST_UPDATE_TIMER
6960: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 6960: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
697 bno BASED(mcck_no_vtime) # no -> skip cleanup critical 697 bno BASED(mcck_no_vtime) # no -> skip cleanup critical
698 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ? 698 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ?
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 57ca75d0ad7f..d9f22915008c 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -727,9 +727,9 @@ mcck_int_handler:
727 jo 0f 727 jo 0f
728 spt __LC_LAST_UPDATE_TIMER 728 spt __LC_LAST_UPDATE_TIMER
729#ifdef CONFIG_VIRT_CPU_ACCOUNTING 729#ifdef CONFIG_VIRT_CPU_ACCOUNTING
730 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 730 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
731 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 731 mvc __LC_SYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
732 mvc __LC_LAST_UPDATE_TIMER(8),__LC_EXIT_TIMER 732 mvc __LC_EXIT_TIMER(8),__LC_LAST_UPDATE_TIMER
7330: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 7330: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
734 jno mcck_no_vtime # no -> no timer update 734 jno mcck_no_vtime # no -> no timer update
735 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ? 735 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ?
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index fc8bf5e285f6..2710e66fefba 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -346,6 +346,13 @@ iplstart:
346 la %r2,.Lreset 346 la %r2,.Lreset
347 lhi %r3,26 347 lhi %r3,26
348 diag %r2,%r3,8 348 diag %r2,%r3,8
349 la %r5,.Lirb
350 stsch 0(%r5) # check if irq is pending
351 tm 30(%r5),0x0f # by verifying if any of the
352 bnz .Lwaitforirq # activity or status control
353 tm 31(%r5),0xff # bits is set in the schib
354 bz .Lnoreset
355.Lwaitforirq:
349 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw 356 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw
350.Lwaitrdrirq: 357.Lwaitrdrirq:
351 lpsw .Lrdrwaitpsw 358 lpsw .Lrdrwaitpsw
@@ -535,8 +542,13 @@ startup:basr %r13,0 # get base
535 lhi %r1,0 542 lhi %r1,0
536 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 543 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
537 jnz .Lscnd 544 jnz .Lscnd
538 l %r1,.Lscpincr2-PARMAREA+4(%r4) # otherwise use this one 545 lhi %r1,0x800 # otherwise report 2GB
539.Lscnd: 546.Lscnd:
547 lhi %r3,0x800 # limit reported memory size to 2GB
548 cr %r1,%r3
549 jl .Lno2gb
550 lr %r1,%r3
551.Lno2gb:
540 xr %r3,%r3 # same logic 552 xr %r3,%r3 # same logic
541 ic %r3,.Lscpa1-PARMAREA(%r4) 553 ic %r3,.Lscpa1-PARMAREA(%r4)
542 chi %r3,0x00 554 chi %r3,0x00
@@ -765,7 +777,7 @@ _stext: basr %r13,0 # get base
765 777
766# check control registers 778# check control registers
767 stctl %c0,%c15,0(%r15) 779 stctl %c0,%c15,0(%r15)
768 oi 2(%r15),0x20 # enable sigp external interrupts 780 oi 2(%r15),0x40 # enable sigp emergency signal
769 oi 0(%r15),0x10 # switch on low address protection 781 oi 0(%r15),0x10 # switch on low address protection
770 lctl %c0,%c15,0(%r15) 782 lctl %c0,%c15,0(%r15)
771 783
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index f525c0c21250..9a8263a153cb 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -345,6 +345,13 @@ iplstart:
345 la %r2,.Lreset 345 la %r2,.Lreset
346 lhi %r3,26 346 lhi %r3,26
347 diag %r2,%r3,8 347 diag %r2,%r3,8
348 la %r5,.Lirb
349 stsch 0(%r5) # check if irq is pending
350 tm 30(%r5),0x0f # by verifying if any of the
351 bnz .Lwaitforirq # activity or status control
352 tm 31(%r5),0xff # bits is set in the schib
353 bz .Lnoreset
354.Lwaitforirq:
348 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw 355 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw
349.Lwaitrdrirq: 356.Lwaitrdrirq:
350 lpsw .Lrdrwaitpsw 357 lpsw .Lrdrwaitpsw
@@ -658,10 +665,8 @@ startup:basr %r13,0 # get base
658# 665#
659 la %r1,0f-.LPG1(%r13) # set program check address 666 la %r1,0f-.LPG1(%r13) # set program check address
660 stg %r1,__LC_PGM_NEW_PSW+8 667 stg %r1,__LC_PGM_NEW_PSW+8
661 mvc __LC_DIAG44_OPCODE(8),.Lnop-.LPG1(%r13)
662 diag 0,0,0x44 # test diag 0x44 668 diag 0,0,0x44 # test diag 0x44
663 oi 7(%r12),32 # set diag44 flag 669 oi 7(%r12),32 # set diag44 flag
664 mvc __LC_DIAG44_OPCODE(8),.Ldiag44-.LPG1(%r13)
6650: 6700:
666 671
667# 672#
@@ -702,7 +707,6 @@ startup:basr %r13,0 # get base
702.L4malign:.quad 0xffffffffffc00000 707.L4malign:.quad 0xffffffffffc00000
703.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 708.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
704.Lnop: .long 0x07000700 709.Lnop: .long 0x07000700
705.Ldiag44:.long 0x83000044
706 710
707 .org PARMAREA-64 711 .org PARMAREA-64
708.Lduct: .long 0,0,0,0,0,0,0,0 712.Lduct: .long 0,0,0,0,0,0,0,0
@@ -765,7 +769,7 @@ _stext: basr %r13,0 # get base
765 769
766# check control registers 770# check control registers
767 stctg %c0,%c15,0(%r15) 771 stctg %c0,%c15,0(%r15)
768 oi 6(%r15),0x20 # enable sigp external interrupts 772 oi 6(%r15),0x40 # enable sigp emergency signal
769 oi 4(%r15),0x10 # switch on low address proctection 773 oi 4(%r15),0x10 # switch on low address proctection
770 lctlg %c0,%c15,0(%r15) 774 lctlg %c0,%c15,0(%r15)
771 775
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 2721c3a32b84..5aa71b05b8ae 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -70,6 +70,8 @@ machine_kexec(struct kimage *image)
70 for (;;); 70 for (;;);
71} 71}
72 72
73extern void pfault_fini(void);
74
73static void 75static void
74kexec_halt_all_cpus(void *kernel_image) 76kexec_halt_all_cpus(void *kernel_image)
75{ 77{
@@ -78,6 +80,11 @@ kexec_halt_all_cpus(void *kernel_image)
78 struct kimage *image; 80 struct kimage *image;
79 relocate_kernel_t data_mover; 81 relocate_kernel_t data_mover;
80 82
83#ifdef CONFIG_PFAULT
84 if (MACHINE_IS_VM)
85 pfault_fini();
86#endif
87
81 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) 88 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
82 signal_processor(smp_processor_id(), sigp_stop); 89 signal_processor(smp_processor_id(), sigp_stop);
83 90
diff --git a/arch/s390/kernel/relocate_kernel.S b/arch/s390/kernel/relocate_kernel.S
index d5e4a62fbb79..2a25ec7147ff 100644
--- a/arch/s390/kernel/relocate_kernel.S
+++ b/arch/s390/kernel/relocate_kernel.S
@@ -4,6 +4,7 @@
4 * (C) Copyright IBM Corp. 2005 4 * (C) Copyright IBM Corp. 2005
5 * 5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> 6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
7 * 8 *
8 */ 9 */
9 10
@@ -25,8 +26,31 @@
25 relocate_kernel: 26 relocate_kernel:
26 basr %r13,0 #base address 27 basr %r13,0 #base address
27 .base: 28 .base:
28 spx zero64-.base(%r13) #absolute addressing mode
29 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external) 29 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external)
30 spx zero64-.base(%r13) #absolute addressing mode
31 stctl %c0,%c15,ctlregs-.base(%r13)
32 stm %r0,%r15,gprregs-.base(%r13)
33 la %r1,load_psw-.base(%r13)
34 mvc 0(8,%r0),0(%r1)
35 la %r0,.back-.base(%r13)
36 st %r0,4(%r0)
37 oi 4(%r0),0x80
38 mvc 0x68(8,%r0),0(%r1)
39 la %r0,.back_pgm-.base(%r13)
40 st %r0,0x6c(%r0)
41 oi 0x6c(%r0),0x80
42 lhi %r0,0
43 diag %r0,%r0,0x308
44 .back:
45 basr %r13,0
46 .back_base:
47 oi have_diag308-.back_base(%r13),0x01
48 lctl %c0,%c15,ctlregs-.back_base(%r13)
49 lm %r0,%r15,gprregs-.back_base(%r13)
50 j .start_reloc
51 .back_pgm:
52 lm %r0,%r15,gprregs-.base(%r13)
53 .start_reloc:
30 lhi %r10,-1 #preparing the mask 54 lhi %r10,-1 #preparing the mask
31 sll %r10,12 #shift it such that it becomes 0xf000 55 sll %r10,12 #shift it such that it becomes 0xf000
32 .top: 56 .top:
@@ -63,6 +87,10 @@
63 o %r3,4(%r4) #or load address into psw 87 o %r3,4(%r4) #or load address into psw
64 st %r3,4(%r4) 88 st %r3,4(%r4)
65 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0 89 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0
90 tm have_diag308-.base(%r13),0x01
91 jno .no_diag308
92 diag %r0,%r0,0x308
93 .no_diag308:
66 sr %r1,%r1 #clear %r1 94 sr %r1,%r1 #clear %r1
67 sr %r2,%r2 #clear %r2 95 sr %r2,%r2 #clear %r2
68 sigp %r1,%r2,0x12 #set cpuid to zero 96 sigp %r1,%r2,0x12 #set cpuid to zero
@@ -75,6 +103,17 @@
75 .long 0x00080000,0x80000000 103 .long 0x00080000,0x80000000
76 sys_msk: 104 sys_msk:
77 .quad 0 105 .quad 0
106 ctlregs:
107 .rept 16
108 .long 0
109 .endr
110 gprregs:
111 .rept 16
112 .long 0
113 .endr
114 have_diag308:
115 .byte 0
116 .align 8
78 relocate_kernel_end: 117 relocate_kernel_end:
79 .globl relocate_kernel_len 118 .globl relocate_kernel_len
80 relocate_kernel_len: 119 relocate_kernel_len:
diff --git a/arch/s390/kernel/relocate_kernel64.S b/arch/s390/kernel/relocate_kernel64.S
index 96290cc4eb3c..8cdb86e8911f 100644
--- a/arch/s390/kernel/relocate_kernel64.S
+++ b/arch/s390/kernel/relocate_kernel64.S
@@ -4,6 +4,7 @@
4 * (C) Copyright IBM Corp. 2005 4 * (C) Copyright IBM Corp. 2005
5 * 5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> 6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
7 * 8 *
8 */ 9 */
9 10
@@ -26,8 +27,34 @@
26 relocate_kernel: 27 relocate_kernel:
27 basr %r13,0 #base address 28 basr %r13,0 #base address
28 .base: 29 .base:
30 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQs
29 spx zero64-.base(%r13) #absolute addressing mode 31 spx zero64-.base(%r13) #absolute addressing mode
30 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external) 32 stctg %c0,%c15,ctlregs-.base(%r13)
33 stmg %r0,%r15,gprregs-.base(%r13)
34 lghi %r0,3
35 sllg %r0,%r0,31
36 stg %r0,0x1d0(%r0)
37 la %r0,.back_pgm-.base(%r13)
38 stg %r0,0x1d8(%r0)
39 la %r1,load_psw-.base(%r13)
40 mvc 0(8,%r0),0(%r1)
41 la %r0,.back-.base(%r13)
42 st %r0,4(%r0)
43 oi 4(%r0),0x80
44 lghi %r0,0
45 diag %r0,%r0,0x308
46 .back:
47 lhi %r1,1 #mode 1 = esame
48 sigp %r1,%r0,0x12 #switch to esame mode
49 sam64 #switch to 64 bit addressing mode
50 basr %r13,0
51 .back_base:
52 oi have_diag308-.back_base(%r13),0x01
53 lctlg %c0,%c15,ctlregs-.back_base(%r13)
54 lmg %r0,%r15,gprregs-.back_base(%r13)
55 j .top
56 .back_pgm:
57 lmg %r0,%r15,gprregs-.base(%r13)
31 .top: 58 .top:
32 lghi %r7,4096 #load PAGE_SIZE in r7 59 lghi %r7,4096 #load PAGE_SIZE in r7
33 lghi %r9,4096 #load PAGE_SIZE in r9 60 lghi %r9,4096 #load PAGE_SIZE in r9
@@ -62,6 +89,10 @@
62 o %r3,4(%r4) #or load address into psw 89 o %r3,4(%r4) #or load address into psw
63 st %r3,4(%r4) 90 st %r3,4(%r4)
64 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0 91 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0
92 tm have_diag308-.base(%r13),0x01
93 jno .no_diag308
94 diag %r0,%r0,0x308
95 .no_diag308:
65 sam31 #31 bit mode 96 sam31 #31 bit mode
66 sr %r1,%r1 #erase register r1 97 sr %r1,%r1 #erase register r1
67 sr %r2,%r2 #erase register r2 98 sr %r2,%r2 #erase register r2
@@ -75,8 +106,18 @@
75 .long 0x00080000,0x80000000 106 .long 0x00080000,0x80000000
76 sys_msk: 107 sys_msk:
77 .quad 0 108 .quad 0
109 ctlregs:
110 .rept 16
111 .quad 0
112 .endr
113 gprregs:
114 .rept 16
115 .quad 0
116 .endr
117 have_diag308:
118 .byte 0
119 .align 8
78 relocate_kernel_end: 120 relocate_kernel_end:
79 .globl relocate_kernel_len 121 .globl relocate_kernel_len
80 relocate_kernel_len: 122 relocate_kernel_len:
81 .quad relocate_kernel_end - relocate_kernel 123 .quad relocate_kernel_end - relocate_kernel
82
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 3bdd38ec71da..207bc511a6e3 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -19,7 +19,6 @@
19#include <asm/irq.h> 19#include <asm/irq.h>
20 20
21/* 21/*
22 * Simple hash strategy: index = code & 0xff;
23 * ext_int_hash[index] is the start of the list for all external interrupts 22 * ext_int_hash[index] is the start of the list for all external interrupts
24 * that hash to this index. With the current set of external interrupts 23 * that hash to this index. With the current set of external interrupts
25 * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000 24 * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000
@@ -27,6 +26,11 @@
27 */ 26 */
28ext_int_info_t *ext_int_hash[256] = { 0, }; 27ext_int_info_t *ext_int_hash[256] = { 0, };
29 28
29static inline int ext_hash(__u16 code)
30{
31 return (code + (code >> 9)) & 0xff;
32}
33
30int register_external_interrupt(__u16 code, ext_int_handler_t handler) 34int register_external_interrupt(__u16 code, ext_int_handler_t handler)
31{ 35{
32 ext_int_info_t *p; 36 ext_int_info_t *p;
@@ -37,7 +41,7 @@ int register_external_interrupt(__u16 code, ext_int_handler_t handler)
37 return -ENOMEM; 41 return -ENOMEM;
38 p->code = code; 42 p->code = code;
39 p->handler = handler; 43 p->handler = handler;
40 index = code & 0xff; 44 index = ext_hash(code);
41 p->next = ext_int_hash[index]; 45 p->next = ext_int_hash[index];
42 ext_int_hash[index] = p; 46 ext_int_hash[index] = p;
43 return 0; 47 return 0;
@@ -52,7 +56,7 @@ int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
52 return -EINVAL; 56 return -EINVAL;
53 p->code = code; 57 p->code = code;
54 p->handler = handler; 58 p->handler = handler;
55 index = code & 0xff; 59 index = ext_hash(code);
56 p->next = ext_int_hash[index]; 60 p->next = ext_int_hash[index];
57 ext_int_hash[index] = p; 61 ext_int_hash[index] = p;
58 return 0; 62 return 0;
@@ -63,7 +67,7 @@ int unregister_external_interrupt(__u16 code, ext_int_handler_t handler)
63 ext_int_info_t *p, *q; 67 ext_int_info_t *p, *q;
64 int index; 68 int index;
65 69
66 index = code & 0xff; 70 index = ext_hash(code);
67 q = NULL; 71 q = NULL;
68 p = ext_int_hash[index]; 72 p = ext_int_hash[index];
69 while (p != NULL) { 73 while (p != NULL) {
@@ -90,7 +94,7 @@ int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
90 94
91 if (p == NULL || p->code != code || p->handler != handler) 95 if (p == NULL || p->code != code || p->handler != handler)
92 return -EINVAL; 96 return -EINVAL;
93 index = code & 0xff; 97 index = ext_hash(code);
94 q = ext_int_hash[index]; 98 q = ext_int_hash[index];
95 if (p != q) { 99 if (p != q) {
96 while (q != NULL) { 100 while (q != NULL) {
@@ -120,7 +124,7 @@ void do_extint(struct pt_regs *regs, unsigned short code)
120 */ 124 */
121 account_ticks(regs); 125 account_ticks(regs);
122 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 126 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
123 index = code & 0xff; 127 index = ext_hash(code);
124 for (p = ext_int_hash[index]; p; p = p->next) { 128 for (p = ext_int_hash[index]; p; p = p->next) {
125 if (likely(p->code == code)) { 129 if (likely(p->code == code)) {
126 if (likely(p->handler)) 130 if (likely(p->handler))
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index a12183989a79..5ba5a5485da9 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -431,12 +431,6 @@ setup_lowcore(void)
431 ctl_set_bit(14, 29); 431 ctl_set_bit(14, 29);
432 } 432 }
433#endif 433#endif
434#ifdef CONFIG_ARCH_S390X
435 if (MACHINE_HAS_DIAG44)
436 lc->diag44_opcode = 0x83000044;
437 else
438 lc->diag44_opcode = 0x07000700;
439#endif /* CONFIG_ARCH_S390X */
440 set_prefix((u32)(unsigned long) lc); 434 set_prefix((u32)(unsigned long) lc);
441} 435}
442 436
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 642572a8e334..85222fee4361 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -375,7 +375,7 @@ static void smp_ext_bitcall(int cpu, ec_bit_sig sig)
375 * Set signaling bit in lowcore of target cpu and kick it 375 * Set signaling bit in lowcore of target cpu and kick it
376 */ 376 */
377 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 377 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
378 while(signal_processor(cpu, sigp_external_call) == sigp_busy) 378 while(signal_processor(cpu, sigp_emergency_signal) == sigp_busy)
379 udelay(10); 379 udelay(10);
380} 380}
381 381
@@ -394,7 +394,7 @@ static void smp_ext_bitcall_others(ec_bit_sig sig)
394 * Set signaling bit in lowcore of target cpu and kick it 394 * Set signaling bit in lowcore of target cpu and kick it
395 */ 395 */
396 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 396 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
397 while (signal_processor(cpu, sigp_external_call) == sigp_busy) 397 while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy)
398 udelay(10); 398 udelay(10);
399 } 399 }
400} 400}
@@ -537,7 +537,8 @@ int __devinit start_secondary(void *cpuvoid)
537#endif 537#endif
538#ifdef CONFIG_PFAULT 538#ifdef CONFIG_PFAULT
539 /* Enable pfault pseudo page faults on this cpu. */ 539 /* Enable pfault pseudo page faults on this cpu. */
540 pfault_init(); 540 if (MACHINE_IS_VM)
541 pfault_init();
541#endif 542#endif
542 /* Mark this cpu as online */ 543 /* Mark this cpu as online */
543 cpu_set(smp_processor_id(), cpu_online_map); 544 cpu_set(smp_processor_id(), cpu_online_map);
@@ -690,7 +691,8 @@ __cpu_disable(void)
690 691
691#ifdef CONFIG_PFAULT 692#ifdef CONFIG_PFAULT
692 /* Disable pfault pseudo page faults on this cpu. */ 693 /* Disable pfault pseudo page faults on this cpu. */
693 pfault_fini(); 694 if (MACHINE_IS_VM)
695 pfault_fini();
694#endif 696#endif
695 697
696 /* disable all external interrupts */ 698 /* disable all external interrupts */
@@ -751,9 +753,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
751 unsigned int cpu; 753 unsigned int cpu;
752 int i; 754 int i;
753 755
754 /* request the 0x1202 external interrupt */ 756 /* request the 0x1201 emergency signal external interrupt */
755 if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) 757 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
756 panic("Couldn't request external interrupt 0x1202"); 758 panic("Couldn't request external interrupt 0x1201");
757 smp_check_cpus(max_cpus); 759 smp_check_cpus(max_cpus);
758 memset(lowcore_ptr,0,sizeof(lowcore_ptr)); 760 memset(lowcore_ptr,0,sizeof(lowcore_ptr));
759 /* 761 /*
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index a8668afb5f87..426d7cafdab3 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -290,3 +290,8 @@ SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key_wrapper)
290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper) 290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper)
291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl) /* 280 */ 291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl) /* 280 */
292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid_wrapper) 292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid_wrapper)
293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper)
294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper)
295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init)
296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper)
297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index bc7b7be7acbe..6b8703ec2ae6 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -29,6 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/kallsyms.h> 31#include <linux/kallsyms.h>
32#include <linux/reboot.h>
32 33
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -675,6 +676,19 @@ asmlinkage void kernel_stack_overflow(struct pt_regs * regs)
675 panic("Corrupt kernel stack, can't continue."); 676 panic("Corrupt kernel stack, can't continue.");
676} 677}
677 678
679#ifndef CONFIG_ARCH_S390X
680static int
681pagex_reboot_event(struct notifier_block *this, unsigned long event, void *ptr)
682{
683 if (MACHINE_IS_VM)
684 cpcmd("SET PAGEX OFF", NULL, 0, NULL);
685 return NOTIFY_DONE;
686}
687
688static struct notifier_block pagex_reboot_notifier = {
689 .notifier_call = &pagex_reboot_event,
690};
691#endif
678 692
679/* init is done in lowcore.S and head.S */ 693/* init is done in lowcore.S and head.S */
680 694
@@ -735,6 +749,7 @@ void __init trap_init(void)
735 &ext_int_pfault); 749 &ext_int_pfault);
736#endif 750#endif
737#ifndef CONFIG_ARCH_S390X 751#ifndef CONFIG_ARCH_S390X
752 register_reboot_notifier(&pagex_reboot_notifier);
738 cpcmd("SET PAGEX ON", NULL, 0, NULL); 753 cpcmd("SET PAGEX ON", NULL, 0, NULL);
739#endif 754#endif
740 } 755 }
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index a8758b1d20a9..b701efa1f00e 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -5,5 +5,5 @@
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7lib-y += delay.o string.o 7lib-y += delay.o string.o
8lib-$(CONFIG_ARCH_S390_31) += uaccess.o 8lib-$(CONFIG_ARCH_S390_31) += uaccess.o spinlock.o
9lib-$(CONFIG_ARCH_S390X) += uaccess64.o 9lib-$(CONFIG_ARCH_S390X) += uaccess64.o spinlock.o
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
new file mode 100644
index 000000000000..888b5596c195
--- /dev/null
+++ b/arch/s390/lib/spinlock.c
@@ -0,0 +1,133 @@
1/*
2 * arch/s390/lib/spinlock.c
3 * Out of line spinlock code.
4 *
5 * S390 version
6 * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */
9
10#include <linux/types.h>
11#include <linux/module.h>
12#include <linux/spinlock.h>
13#include <linux/init.h>
14#include <asm/io.h>
15
16atomic_t spin_retry_counter;
17int spin_retry = 1000;
18
19/**
20 * spin_retry= parameter
21 */
22static int __init spin_retry_setup(char *str)
23{
24 spin_retry = simple_strtoul(str, &str, 0);
25 return 1;
26}
27__setup("spin_retry=", spin_retry_setup);
28
29static inline void
30_diag44(void)
31{
32#ifdef __s390x__
33 if (MACHINE_HAS_DIAG44)
34#endif
35 asm volatile("diag 0,0,0x44");
36}
37
38void
39_raw_spin_lock_wait(spinlock_t *lp, unsigned int pc)
40{
41 int count = spin_retry;
42
43 while (1) {
44 if (count-- <= 0) {
45 _diag44();
46 count = spin_retry;
47 }
48 atomic_inc(&spin_retry_counter);
49 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
50 return;
51 }
52}
53EXPORT_SYMBOL(_raw_spin_lock_wait);
54
55int
56_raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc)
57{
58 int count = spin_retry;
59
60 while (count-- > 0) {
61 atomic_inc(&spin_retry_counter);
62 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
63 return 1;
64 }
65 return 0;
66}
67EXPORT_SYMBOL(_raw_spin_trylock_retry);
68
69void
70_raw_read_lock_wait(rwlock_t *rw)
71{
72 unsigned int old;
73 int count = spin_retry;
74
75 while (1) {
76 if (count-- <= 0) {
77 _diag44();
78 count = spin_retry;
79 }
80 atomic_inc(&spin_retry_counter);
81 old = rw->lock & 0x7fffffffU;
82 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
83 return;
84 }
85}
86EXPORT_SYMBOL(_raw_read_lock_wait);
87
88int
89_raw_read_trylock_retry(rwlock_t *rw)
90{
91 unsigned int old;
92 int count = spin_retry;
93
94 while (count-- > 0) {
95 atomic_inc(&spin_retry_counter);
96 old = rw->lock & 0x7fffffffU;
97 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
98 return 1;
99 }
100 return 0;
101}
102EXPORT_SYMBOL(_raw_read_trylock_retry);
103
104void
105_raw_write_lock_wait(rwlock_t *rw)
106{
107 int count = spin_retry;
108
109 while (1) {
110 if (count-- <= 0) {
111 _diag44();
112 count = spin_retry;
113 }
114 atomic_inc(&spin_retry_counter);
115 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
116 return;
117 }
118}
119EXPORT_SYMBOL(_raw_write_lock_wait);
120
121int
122_raw_write_trylock_retry(rwlock_t *rw)
123{
124 int count = spin_retry;
125
126 while (count-- > 0) {
127 atomic_inc(&spin_retry_counter);
128 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
129 return 1;
130 }
131 return 0;
132}
133EXPORT_SYMBOL(_raw_write_trylock_retry);
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 06f1b47eded9..8022243f0178 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -579,7 +579,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
579 if (!user_mode(regs)) 579 if (!user_mode(regs))
580 return 1; 580 return 1;
581 581
582 if (try_to_freeze(0)) 582 if (try_to_freeze())
583 goto no_signal; 583 goto no_signal;
584 584
585 if (!oldset) 585 if (!oldset)
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index 45ad1026dde7..c6a14a87c59b 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -697,7 +697,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
697 if (!user_mode(regs)) 697 if (!user_mode(regs))
698 return 1; 698 return 1;
699 699
700 if (try_to_freeze(0)) 700 if (try_to_freeze())
701 goto no_signal; 701 goto no_signal;
702 702
703 if (!oldset) 703 if (!oldset)
diff --git a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c
index a24932881dbb..f08d0eaf6497 100644
--- a/arch/sh64/mm/fault.c
+++ b/arch/sh64/mm/fault.c
@@ -223,13 +223,13 @@ good_area:
223 */ 223 */
224survive: 224survive:
225 switch (handle_mm_fault(mm, vma, address, writeaccess)) { 225 switch (handle_mm_fault(mm, vma, address, writeaccess)) {
226 case 1: 226 case VM_FAULT_MINOR:
227 tsk->min_flt++; 227 tsk->min_flt++;
228 break; 228 break;
229 case 2: 229 case VM_FAULT_MAJOR:
230 tsk->maj_flt++; 230 tsk->maj_flt++;
231 break; 231 break;
232 case 0: 232 case VM_FAULT_SIGBUS:
233 goto do_sigbus; 233 goto do_sigbus;
234 default: 234 default:
235 goto out_of_memory; 235 goto out_of_memory;
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 025f4516e651..e457a40838fc 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -48,8 +48,8 @@ sys_call_table:
48/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 48/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
49/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit 49/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit
50/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 50/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
51/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 51/*150*/ .long sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
52/*155*/ .long sys_fcntl64, sys_ni_syscall, sys_statfs, sys_fstatfs, sys_oldumount 52/*155*/ .long sys_fcntl64, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount
53/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall 53/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
54/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr 54/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr
55/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 55/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index bceb91a8a2bd..53eaf2345fe9 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -50,8 +50,8 @@ sys_call_table32:
50 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, compat_sys_stat64 50 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, compat_sys_stat64
51/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit 51/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
52 .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write 52 .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write
53/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 53/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
54 .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount 54 .word compat_sys_fcntl64, sys_inotify_rm_watch, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
55/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall 55/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
56 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr 56 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
57/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents 57/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
@@ -116,8 +116,8 @@ sys_call_table:
116 .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 116 .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
117/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit 117/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit
118 .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 118 .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
119/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 119/*150*/ .word sys_getsockname, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
120 .word sys_nis_syscall, sys_ni_syscall, sys_statfs, sys_fstatfs, sys_oldumount 120 .word sys_nis_syscall, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount
121/*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install 121/*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install
122 .word sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr 122 .word sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr
123/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 123/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 8fc413cb6acd..3fbaf342a452 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -121,15 +121,24 @@ __inline__ void flush_dcache_page_impl(struct page *page)
121} 121}
122 122
123#define PG_dcache_dirty PG_arch_1 123#define PG_dcache_dirty PG_arch_1
124#define PG_dcache_cpu_shift 24
125#define PG_dcache_cpu_mask (256 - 1)
126
127#if NR_CPUS > 256
128#error D-cache dirty tracking and thread_info->cpu need fixing for > 256 cpus
129#endif
124 130
125#define dcache_dirty_cpu(page) \ 131#define dcache_dirty_cpu(page) \
126 (((page)->flags >> 24) & (NR_CPUS - 1UL)) 132 (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask)
127 133
128static __inline__ void set_dcache_dirty(struct page *page, int this_cpu) 134static __inline__ void set_dcache_dirty(struct page *page, int this_cpu)
129{ 135{
130 unsigned long mask = this_cpu; 136 unsigned long mask = this_cpu;
131 unsigned long non_cpu_bits = ~((NR_CPUS - 1UL) << 24UL); 137 unsigned long non_cpu_bits;
132 mask = (mask << 24) | (1UL << PG_dcache_dirty); 138
139 non_cpu_bits = ~(PG_dcache_cpu_mask << PG_dcache_cpu_shift);
140 mask = (mask << PG_dcache_cpu_shift) | (1UL << PG_dcache_dirty);
141
133 __asm__ __volatile__("1:\n\t" 142 __asm__ __volatile__("1:\n\t"
134 "ldx [%2], %%g7\n\t" 143 "ldx [%2], %%g7\n\t"
135 "and %%g7, %1, %%g1\n\t" 144 "and %%g7, %1, %%g1\n\t"
@@ -151,7 +160,7 @@ static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long c
151 __asm__ __volatile__("! test_and_clear_dcache_dirty\n" 160 __asm__ __volatile__("! test_and_clear_dcache_dirty\n"
152 "1:\n\t" 161 "1:\n\t"
153 "ldx [%2], %%g7\n\t" 162 "ldx [%2], %%g7\n\t"
154 "srlx %%g7, 24, %%g1\n\t" 163 "srlx %%g7, %4, %%g1\n\t"
155 "and %%g1, %3, %%g1\n\t" 164 "and %%g1, %3, %%g1\n\t"
156 "cmp %%g1, %0\n\t" 165 "cmp %%g1, %0\n\t"
157 "bne,pn %%icc, 2f\n\t" 166 "bne,pn %%icc, 2f\n\t"
@@ -164,7 +173,8 @@ static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long c
164 "2:" 173 "2:"
165 : /* no outputs */ 174 : /* no outputs */
166 : "r" (cpu), "r" (mask), "r" (&page->flags), 175 : "r" (cpu), "r" (mask), "r" (&page->flags),
167 "i" (NR_CPUS - 1UL) 176 "i" (PG_dcache_cpu_mask),
177 "i" (PG_dcache_cpu_shift)
168 : "g1", "g7"); 178 : "g1", "g7");
169} 179}
170 180
@@ -180,7 +190,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t p
180 if (pfn_valid(pfn) && 190 if (pfn_valid(pfn) &&
181 (page = pfn_to_page(pfn), page_mapping(page)) && 191 (page = pfn_to_page(pfn), page_mapping(page)) &&
182 ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) { 192 ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) {
183 int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL)); 193 int cpu = ((pg_flags >> PG_dcache_cpu_shift) &
194 PG_dcache_cpu_mask);
184 int this_cpu = get_cpu(); 195 int this_cpu = get_cpu();
185 196
186 /* This is just to optimize away some function calls 197 /* This is just to optimize away some function calls
diff --git a/arch/um/Makefile b/arch/um/Makefile
index eb4ac403bd93..f5a83a72aa75 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -245,7 +245,7 @@ $(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FOR
245$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE 245$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
246 $(Q)$(MAKE) $(build)=$@ 246 $(Q)$(MAKE) $(build)=$@
247 247
248$(ARCH_DIR)/os-$(OS)/util: scripts_basic FORCE 248$(ARCH_DIR)/os-$(OS)/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
249 $(Q)$(MAKE) $(build)=$@ 249 $(Q)$(MAKE) $(build)=$@
250 250
251export SUBARCH USER_CFLAGS OS 251export SUBARCH USER_CFLAGS OS
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 93d0818fa816..a777e57dbf89 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -33,6 +33,7 @@ ifneq ($(CONFIG_GPROF),y)
33ARCH_CFLAGS += -DUM_FASTCALL 33ARCH_CFLAGS += -DUM_FASTCALL
34endif 34endif
35 35
36SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
36SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h 37SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
37 38
38prepare: $(SYS_HEADERS) 39prepare: $(SYS_HEADERS)
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index d6c31a95b887..de17d4c6e02d 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -19,6 +19,8 @@ harddog-objs := harddog_kern.o harddog_user.o
19 19
20LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) 20LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a)
21 21
22targets := pcap_kern.o pcap_user.o
23
22$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o 24$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
23 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) 25 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o)
24#XXX: The call below does not work because the flags are added before the 26#XXX: The call below does not work because the flags are added before the
@@ -26,7 +28,7 @@ $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
26#$(call if_changed,ld) 28#$(call if_changed,ld)
27 29
28# When the above is fixed, don't forget to add this too! 30# When the above is fixed, don't forget to add this too!
29#targets := $(obj)/pcap.o 31#targets += $(obj)/pcap.o
30 32
31obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o 33obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o
32obj-$(CONFIG_SSL) += ssl.o 34obj-$(CONFIG_SSL) += ssl.o
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index 4fcbe8b1b77e..4fcf3a8d13f4 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -3,10 +3,10 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#if __BYTE_ORDER == __BIG_ENDIAN 6#if defined(__BIG_ENDIAN)
7# define ntohll(x) (x) 7# define ntohll(x) (x)
8# define htonll(x) (x) 8# define htonll(x) (x)
9#elif __BYTE_ORDER == __LITTLE_ENDIAN 9#elif defined(__LITTLE_ENDIAN)
10# define ntohll(x) bswap_64(x) 10# define ntohll(x) bswap_64(x)
11# define htonll(x) bswap_64(x) 11# define htonll(x) bswap_64(x)
12#else 12#else
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index d5742783e19d..59602b81b240 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -57,10 +57,10 @@ __uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
57 57
58#else /*MODULE*/ 58#else /*MODULE*/
59 59
60MODULE_PARM(dsp, "s"); 60module_param(dsp, charp, 0644);
61MODULE_PARM_DESC(dsp, DSP_HELP); 61MODULE_PARM_DESC(dsp, DSP_HELP);
62 62
63MODULE_PARM(mixer, "s"); 63module_param(mixer, charp, 0644);
64MODULE_PARM_DESC(mixer, MIXER_HELP); 64MODULE_PARM_DESC(mixer, MIXER_HELP);
65 65
66#endif 66#endif
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 404de41a4f67..c190c2414197 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -557,7 +557,7 @@ static int create_proc_mconsole(void)
557 557
558 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); 558 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL);
559 if(ent == NULL){ 559 if(ent == NULL){
560 printk("create_proc_mconsole : create_proc_entry failed\n"); 560 printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n");
561 return(0); 561 return(0);
562 } 562 }
563 563
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index 0ea87f24b36f..d21ebad666b4 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -48,7 +48,7 @@ static int make_proc_exitcode(void)
48 48
49 ent = create_proc_entry("exitcode", 0600, &proc_root); 49 ent = create_proc_entry("exitcode", 0600, &proc_root);
50 if(ent == NULL){ 50 if(ent == NULL){
51 printk("make_proc_exitcode : Failed to register " 51 printk(KERN_WARNING "make_proc_exitcode : Failed to register "
52 "/proc/exitcode\n"); 52 "/proc/exitcode\n");
53 return(0); 53 return(0);
54 } 54 }
diff --git a/arch/um/kernel/helper.c b/arch/um/kernel/helper.c
index 13b1f5c2f7ee..f83e1e8e2392 100644
--- a/arch/um/kernel/helper.c
+++ b/arch/um/kernel/helper.c
@@ -13,6 +13,7 @@
13#include "user.h" 13#include "user.h"
14#include "kern_util.h" 14#include "kern_util.h"
15#include "user_util.h" 15#include "user_util.h"
16#include "helper.h"
16#include "os.h" 17#include "os.h"
17 18
18struct helper_data { 19struct helper_data {
@@ -149,7 +150,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
149 return(pid); 150 return(pid);
150} 151}
151 152
152int helper_wait(int pid, int block) 153int helper_wait(int pid)
153{ 154{
154 int ret; 155 int ret;
155 156
@@ -160,14 +161,3 @@ int helper_wait(int pid, int block)
160 } 161 }
161 return(ret); 162 return(ret);
162} 163}
163
164/*
165 * Overrides for Emacs so that we follow Linus's tabbing style.
166 * Emacs will notice this stuff at the end of the file and automatically
167 * adjust the settings for this buffer only. This must remain at the end
168 * of the file.
169 * ---------------------------------------------------------------------------
170 * Local variables:
171 * c-file-style: "linux"
172 * End:
173 */
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index c45a60e9c92d..67acd92c5322 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -131,7 +131,7 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
131 return(arg.pid); 131 return(arg.pid);
132} 132}
133 133
134static int ptrace_child(void) 134static int ptrace_child(void *arg)
135{ 135{
136 int ret; 136 int ret;
137 int pid = os_getpid(), ppid = getppid(); 137 int pid = os_getpid(), ppid = getppid();
@@ -160,16 +160,20 @@ static int ptrace_child(void)
160 _exit(ret); 160 _exit(ret);
161} 161}
162 162
163static int start_ptraced_child(void) 163static int start_ptraced_child(void **stack_out)
164{ 164{
165 void *stack;
166 unsigned long sp;
165 int pid, n, status; 167 int pid, n, status;
166 168
167 pid = fork(); 169 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
168 if(pid == 0) 170 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
169 ptrace_child(); 171 if(stack == MAP_FAILED)
170 172 panic("check_ptrace : mmap failed, errno = %d", errno);
173 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
174 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
171 if(pid < 0) 175 if(pid < 0)
172 panic("check_ptrace : fork failed, errno = %d", errno); 176 panic("check_ptrace : clone failed, errno = %d", errno);
173 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 177 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
174 if(n < 0) 178 if(n < 0)
175 panic("check_ptrace : wait failed, errno = %d", errno); 179 panic("check_ptrace : wait failed, errno = %d", errno);
@@ -177,6 +181,7 @@ static int start_ptraced_child(void)
177 panic("check_ptrace : expected SIGSTOP, got status = %d", 181 panic("check_ptrace : expected SIGSTOP, got status = %d",
178 status); 182 status);
179 183
184 *stack_out = stack;
180 return(pid); 185 return(pid);
181} 186}
182 187
@@ -184,12 +189,12 @@ static int start_ptraced_child(void)
184 * just avoid using sysemu, not panic, but only if SYSEMU features are broken. 189 * just avoid using sysemu, not panic, but only if SYSEMU features are broken.
185 * So only for SYSEMU features we test mustpanic, while normal host features 190 * So only for SYSEMU features we test mustpanic, while normal host features
186 * must work anyway!*/ 191 * must work anyway!*/
187static int stop_ptraced_child(int pid, int exitcode, int mustexit) 192static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic)
188{ 193{
189 int status, n, ret = 0; 194 int status, n, ret = 0;
190 195
191 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) 196 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0)
192 panic("stop_ptraced_child : ptrace failed, errno = %d", errno); 197 panic("check_ptrace : ptrace failed, errno = %d", errno);
193 CATCH_EINTR(n = waitpid(pid, &status, 0)); 198 CATCH_EINTR(n = waitpid(pid, &status, 0));
194 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 199 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
195 int exit_with = WEXITSTATUS(status); 200 int exit_with = WEXITSTATUS(status);
@@ -200,24 +205,40 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
200 printk("check_ptrace : child exited with exitcode %d, while " 205 printk("check_ptrace : child exited with exitcode %d, while "
201 "expecting %d; status 0x%x", exit_with, 206 "expecting %d; status 0x%x", exit_with,
202 exitcode, status); 207 exitcode, status);
203 if (mustexit) 208 if (mustpanic)
204 panic("\n"); 209 panic("\n");
205 else 210 else
206 printk("\n"); 211 printk("\n");
207 ret = -1; 212 ret = -1;
208 } 213 }
209 214
215 if(munmap(stack, PAGE_SIZE) < 0)
216 panic("check_ptrace : munmap failed, errno = %d", errno);
210 return ret; 217 return ret;
211} 218}
212 219
213static int force_sysemu_disabled = 0; 220static int force_sysemu_disabled = 0;
214 221
222int ptrace_faultinfo = 1;
223int proc_mm = 1;
224
225static int __init skas0_cmd_param(char *str, int* add)
226{
227 ptrace_faultinfo = proc_mm = 0;
228 return 0;
229}
230
215static int __init nosysemu_cmd_param(char *str, int* add) 231static int __init nosysemu_cmd_param(char *str, int* add)
216{ 232{
217 force_sysemu_disabled = 1; 233 force_sysemu_disabled = 1;
218 return 0; 234 return 0;
219} 235}
220 236
237__uml_setup("skas0", skas0_cmd_param,
238 "skas0\n"
239 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n"
240 " specify mode=tt.\n\n");
241
221__uml_setup("nosysemu", nosysemu_cmd_param, 242__uml_setup("nosysemu", nosysemu_cmd_param,
222 "nosysemu\n" 243 "nosysemu\n"
223 " Turns off syscall emulation patch for ptrace (SYSEMU) on.\n" 244 " Turns off syscall emulation patch for ptrace (SYSEMU) on.\n"
@@ -228,11 +249,12 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
228 249
229static void __init check_sysemu(void) 250static void __init check_sysemu(void)
230{ 251{
252 void *stack;
231 int pid, syscall, n, status, count=0; 253 int pid, syscall, n, status, count=0;
232 254
233 printk("Checking syscall emulation patch for ptrace..."); 255 printk("Checking syscall emulation patch for ptrace...");
234 sysemu_supported = 0; 256 sysemu_supported = 0;
235 pid = start_ptraced_child(); 257 pid = start_ptraced_child(&stack);
236 258
237 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) 259 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0)
238 goto fail; 260 goto fail;
@@ -250,7 +272,7 @@ static void __init check_sysemu(void)
250 panic("check_sysemu : failed to modify system " 272 panic("check_sysemu : failed to modify system "
251 "call return, errno = %d", errno); 273 "call return, errno = %d", errno);
252 274
253 if (stop_ptraced_child(pid, 0, 0) < 0) 275 if (stop_ptraced_child(pid, stack, 0, 0) < 0)
254 goto fail_stopped; 276 goto fail_stopped;
255 277
256 sysemu_supported = 1; 278 sysemu_supported = 1;
@@ -258,7 +280,7 @@ static void __init check_sysemu(void)
258 set_using_sysemu(!force_sysemu_disabled); 280 set_using_sysemu(!force_sysemu_disabled);
259 281
260 printk("Checking advanced syscall emulation patch for ptrace..."); 282 printk("Checking advanced syscall emulation patch for ptrace...");
261 pid = start_ptraced_child(); 283 pid = start_ptraced_child(&stack);
262 while(1){ 284 while(1){
263 count++; 285 count++;
264 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) 286 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0)
@@ -283,7 +305,7 @@ static void __init check_sysemu(void)
283 break; 305 break;
284 } 306 }
285 } 307 }
286 if (stop_ptraced_child(pid, 0, 0) < 0) 308 if (stop_ptraced_child(pid, stack, 0, 0) < 0)
287 goto fail_stopped; 309 goto fail_stopped;
288 310
289 sysemu_supported = 2; 311 sysemu_supported = 2;
@@ -294,17 +316,18 @@ static void __init check_sysemu(void)
294 return; 316 return;
295 317
296fail: 318fail:
297 stop_ptraced_child(pid, 1, 0); 319 stop_ptraced_child(pid, stack, 1, 0);
298fail_stopped: 320fail_stopped:
299 printk("missing\n"); 321 printk("missing\n");
300} 322}
301 323
302void __init check_ptrace(void) 324void __init check_ptrace(void)
303{ 325{
326 void *stack;
304 int pid, syscall, n, status; 327 int pid, syscall, n, status;
305 328
306 printk("Checking that ptrace can change system call numbers..."); 329 printk("Checking that ptrace can change system call numbers...");
307 pid = start_ptraced_child(); 330 pid = start_ptraced_child(&stack);
308 331
309 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) 332 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
310 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); 333 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno);
@@ -331,7 +354,7 @@ void __init check_ptrace(void)
331 break; 354 break;
332 } 355 }
333 } 356 }
334 stop_ptraced_child(pid, 0, 1); 357 stop_ptraced_child(pid, stack, 0, 1);
335 printk("OK\n"); 358 printk("OK\n");
336 check_sysemu(); 359 check_sysemu();
337} 360}
@@ -359,22 +382,22 @@ void forward_pending_sigio(int target)
359 kill(target, SIGIO); 382 kill(target, SIGIO);
360} 383}
361 384
362int ptrace_faultinfo = 0;
363int proc_mm = 1;
364
365extern void *__syscall_stub_start, __syscall_stub_end; 385extern void *__syscall_stub_start, __syscall_stub_end;
366 386
367#ifdef UML_CONFIG_MODE_SKAS 387#ifdef UML_CONFIG_MODE_SKAS
388
368static inline void check_skas3_ptrace_support(void) 389static inline void check_skas3_ptrace_support(void)
369{ 390{
370 struct ptrace_faultinfo fi; 391 struct ptrace_faultinfo fi;
392 void *stack;
371 int pid, n; 393 int pid, n;
372 394
373 printf("Checking for the skas3 patch in the host..."); 395 printf("Checking for the skas3 patch in the host...");
374 pid = start_ptraced_child(); 396 pid = start_ptraced_child(&stack);
375 397
376 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 398 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
377 if (n < 0) { 399 if (n < 0) {
400 ptrace_faultinfo = 0;
378 if(errno == EIO) 401 if(errno == EIO)
379 printf("not found\n"); 402 printf("not found\n");
380 else { 403 else {
@@ -382,12 +405,14 @@ static inline void check_skas3_ptrace_support(void)
382 } 405 }
383 } 406 }
384 else { 407 else {
385 ptrace_faultinfo = 1; 408 if (!ptrace_faultinfo)
386 printf("found\n"); 409 printf("found but disabled on command line\n");
410 else
411 printf("found\n");
387 } 412 }
388 413
389 init_registers(pid); 414 init_registers(pid);
390 stop_ptraced_child(pid, 1, 1); 415 stop_ptraced_child(pid, stack, 1, 1);
391} 416}
392 417
393int can_do_skas(void) 418int can_do_skas(void)
@@ -396,13 +421,13 @@ int can_do_skas(void)
396 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) { 421 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
397 proc_mm = 0; 422 proc_mm = 0;
398 printf("not found\n"); 423 printf("not found\n");
399 goto out; 424 } else {
400 } 425 if (!proc_mm)
401 else { 426 printf("found but disabled on command line\n");
402 printf("found\n"); 427 else
428 printf("found\n");
403 } 429 }
404 430
405out:
406 check_skas3_ptrace_support(); 431 check_skas3_ptrace_support();
407 return 1; 432 return 1;
408} 433}
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index d4036ed680bc..c23d8a08d0ff 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -412,7 +412,7 @@ int __init make_proc_sysemu(void)
412 412
413 if (ent == NULL) 413 if (ent == NULL)
414 { 414 {
415 printk("Failed to register /proc/sysemu\n"); 415 printk(KERN_WARNING "Failed to register /proc/sysemu\n");
416 return(0); 416 return(0);
417 } 417 }
418 418
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index ba671dab8878..6dd9e5bf18ed 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -64,7 +64,7 @@ void wait_stub_done(int pid, int sig, char * fname)
64 (WSTOPSIG(status) == SIGVTALRM)); 64 (WSTOPSIG(status) == SIGVTALRM));
65 65
66 if((n < 0) || !WIFSTOPPED(status) || 66 if((n < 0) || !WIFSTOPPED(status) ||
67 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status != SIGTRAP))){ 67 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
68 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 68 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
69 "pid = %d, n = %d, errno = %d, status = 0x%x\n", 69 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
70 fname, pid, n, errno, status); 70 fname, pid, n, errno, status);
diff --git a/arch/um/kernel/skas/syscall_user.c b/arch/um/kernel/skas/syscall_user.c
index 2828e6e37721..6b0664970147 100644
--- a/arch/um/kernel/skas/syscall_user.c
+++ b/arch/um/kernel/skas/syscall_user.c
@@ -15,7 +15,7 @@
15void handle_syscall(union uml_pt_regs *regs) 15void handle_syscall(union uml_pt_regs *regs)
16{ 16{
17 long result; 17 long result;
18#if UML_CONFIG_SYSCALL_DEBUG 18#ifdef UML_CONFIG_SYSCALL_DEBUG
19 int index; 19 int index;
20 20
21 index = record_syscall_start(UPT_SYSCALL_NR(regs)); 21 index = record_syscall_start(UPT_SYSCALL_NR(regs));
@@ -27,7 +27,7 @@ void handle_syscall(union uml_pt_regs *regs)
27 REGS_SET_SYSCALL_RETURN(regs->skas.regs, result); 27 REGS_SET_SYSCALL_RETURN(regs->skas.regs, result);
28 28
29 syscall_trace(regs, 1); 29 syscall_trace(regs, 1);
30#if UML_CONFIG_SYSCALL_DEBUG 30#ifdef UML_CONFIG_SYSCALL_DEBUG
31 record_syscall_end(index, result); 31 record_syscall_end(index, result);
32#endif 32#endif
33} 33}
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c
index 0dee1d95c806..9950a6716fe5 100644
--- a/arch/um/kernel/skas/trap_user.c
+++ b/arch/um/kernel/skas/trap_user.c
@@ -58,7 +58,6 @@ void user_signal(int sig, union uml_pt_regs *regs, int pid)
58 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || 58 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
59 (sig == SIGILL) || (sig == SIGTRAP)); 59 (sig == SIGILL) || (sig == SIGTRAP));
60 60
61 regs->skas.is_user = 1;
62 if (segv) 61 if (segv)
63 get_skas_faultinfo(pid, &regs->skas.faultinfo); 62 get_skas_faultinfo(pid, &regs->skas.faultinfo);
64 info = &sig_info[sig]; 63 info = &sig_info[sig];
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index a8b4ef601f59..4e08f7545d63 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -137,7 +137,10 @@ long um_stime(int __user *tptr)
137void timer_handler(int sig, union uml_pt_regs *regs) 137void timer_handler(int sig, union uml_pt_regs *regs)
138{ 138{
139 local_irq_disable(); 139 local_irq_disable();
140 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), (regs)->skas.is_user)); 140 irq_enter();
141 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)),
142 (regs)->skas.is_user));
143 irq_exit();
141 local_irq_enable(); 144 local_irq_enable();
142 if(current_thread->cpu == 0) 145 if(current_thread->cpu == 0)
143 timer_irq(regs); 146 timer_irq(regs);
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 8736d098f0ee..ca2bb6f09a7d 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -38,6 +38,9 @@
38#include "choose-mode.h" 38#include "choose-mode.h"
39#include "mode_kern.h" 39#include "mode_kern.h"
40#include "mode.h" 40#include "mode.h"
41#ifdef UML_CONFIG_MODE_SKAS
42#include "skas.h"
43#endif
41 44
42#define DEFAULT_COMMAND_LINE "root=98:0" 45#define DEFAULT_COMMAND_LINE "root=98:0"
43 46
@@ -318,6 +321,7 @@ int linux_main(int argc, char **argv)
318 unsigned long avail, diff; 321 unsigned long avail, diff;
319 unsigned long virtmem_size, max_physmem; 322 unsigned long virtmem_size, max_physmem;
320 unsigned int i, add; 323 unsigned int i, add;
324 char * mode;
321 325
322 for (i = 1; i < argc; i++){ 326 for (i = 1; i < argc; i++){
323 if((i == 1) && (argv[i][0] == ' ')) continue; 327 if((i == 1) && (argv[i][0] == ' ')) continue;
@@ -338,6 +342,21 @@ int linux_main(int argc, char **argv)
338 exit(1); 342 exit(1);
339 } 343 }
340#endif 344#endif
345
346#ifndef CONFIG_MODE_SKAS
347 mode = "TT";
348#else
349 /* Show to the user the result of selection */
350 if (mode_tt)
351 mode = "TT";
352 else if (proc_mm && ptrace_faultinfo)
353 mode = "SKAS3";
354 else
355 mode = "SKAS0";
356#endif
357
358 printf("UML running in %s mode\n", mode);
359
341 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, 360 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
342 &host_task_size, &task_size); 361 &host_task_size, &task_size);
343 362
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index f0d6060e3e57..9416e1c29926 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -9,8 +9,10 @@
9 */ 9 */
10#include <elf.h> 10#include <elf.h>
11#include <stddef.h> 11#include <stddef.h>
12#include <asm/elf.h>
12#include "init.h" 13#include "init.h"
13#include "elf_user.h" 14#include "elf_user.h"
15#include "mem_user.h"
14 16
15#if ELF_CLASS == ELFCLASS32 17#if ELF_CLASS == ELFCLASS32
16typedef Elf32_auxv_t elf_auxv_t; 18typedef Elf32_auxv_t elf_auxv_t;
@@ -40,6 +42,9 @@ __init void scan_elf_aux( char **envp)
40 break; 42 break;
41 case AT_SYSINFO_EHDR: 43 case AT_SYSINFO_EHDR:
42 vsyscall_ehdr = auxv->a_un.a_val; 44 vsyscall_ehdr = auxv->a_un.a_val;
45 /* See if the page is under TASK_SIZE */
46 if (vsyscall_ehdr < (unsigned long) envp)
47 vsyscall_ehdr = 0;
43 break; 48 break;
44 case AT_HWCAP: 49 case AT_HWCAP:
45 elf_aux_hwcap = auxv->a_un.a_val; 50 elf_aux_hwcap = auxv->a_un.a_val;
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 75d7af9ae1d2..56d3f870926b 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64);
83 83
84EXPORT_SYMBOL_PROTO(getuid); 84EXPORT_SYMBOL_PROTO(getuid);
85 85
86EXPORT_SYMBOL_PROTO(fsync);
87EXPORT_SYMBOL_PROTO(fdatasync);
88
86/* 89/*
87 * Overrides for Emacs so that we follow Linus's tabbing style. 90 * Overrides for Emacs so that we follow Linus's tabbing style.
88 * Emacs will notice this stuff at the end of the file and automatically 91 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
index b251442ad0b1..68aeabe3a654 100644
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -21,10 +21,10 @@ stub_segv_handler(int sig)
21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); 21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" 22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); 23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
24 /* Pop the frame pointer and return address since we need to leave 24 /* Load pointer to sigcontext into esp, since we need to leave
25 * the stack in its original form when we do the sigreturn here, by 25 * the stack in its original form when we do the sigreturn here, by
26 * hand. 26 * hand.
27 */ 27 */
28 __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; " 28 __asm__("mov %0,%%esp ; movl %1, %%eax ; "
29 "int $0x80" : : "g" (__NR_sigreturn)); 29 "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
30} 30}
diff --git a/arch/v850/Makefile b/arch/v850/Makefile
index 6edaed4a310e..bf38ca0ad781 100644
--- a/arch/v850/Makefile
+++ b/arch/v850/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# arch/v850/Makefile 2# arch/v850/Makefile
3# 3#
4# Copyright (C) 2001,02,03 NEC Corporation 4# Copyright (C) 2001,02,03,05 NEC Corporation
5# Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> 5# Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org>
6# 6#
7# This file is included by the global makefile so that you can add your own 7# This file is included by the global makefile so that you can add your own
8# architecture-specific flags and dependencies. Remember to do have actions 8# architecture-specific flags and dependencies. Remember to do have actions
@@ -22,6 +22,9 @@ CFLAGS += -ffixed-r16 -mno-prolog-function
22CFLAGS += -fno-builtin 22CFLAGS += -fno-builtin
23CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" 23CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
24 24
25# By default, build a kernel that runs on the gdb v850 simulator.
26KBUILD_DEFCONFIG := sim_defconfig
27
25# This prevents the linker from consolidating the .gnu.linkonce.this_module 28# This prevents the linker from consolidating the .gnu.linkonce.this_module
26# section into .text (which the v850 default linker script for -r does for 29# section into .text (which the v850 default linker script for -r does for
27# some reason) 30# some reason)
diff --git a/arch/v850/README b/arch/v850/README
index 01b98e290d4a..12f7f7a665e0 100644
--- a/arch/v850/README
+++ b/arch/v850/README
@@ -1,31 +1,43 @@
1This port to the NEC V850E processor supports the following platforms: 1This port to the NEC V850E processor supports the following platforms:
2 2
3 + The gdb v850e simulator (CONFIG_V850E_SIM). 3 "sim"
4 4 The gdb v850e simulator (CONFIG_V850E_SIM).
5 + The Midas labs RTE-V850E/MA1-CB and RTE-V850E/NB85E-CB evaluation boards 5
6 (CONFIG_RTE_CB_MA1 and CONFIG_RTE_CB_NB85E). This support has only been 6 "rte-ma1-cb"
7 tested when running with the Multi-debugger monitor ROM (for the Green 7 The Midas labs RTE-V850E/MA1-CB and RTE-V850E/NB85E-CB evaluation
8 Hills Multi debugger). The optional NEC Solution Gear RTE-MOTHER-A 8 boards (CONFIG_RTE_CB_MA1 and CONFIG_RTE_CB_NB85E). This support
9 motherboard is also supported, which allows PCI boards to be used 9 has only been tested when running with the Multi-debugger monitor
10 (CONFIG_RTE_MB_A_PCI). 10 ROM (for the Green Hills Multi debugger). The optional NEC
11 11 Solution Gear RTE-MOTHER-A motherboard is also supported, which
12 + The Midas labs RTE-V850E/ME2-CB evaluation board (CONFIG_RTE_CB_ME2). 12 allows PCI boards to be used (CONFIG_RTE_MB_A_PCI).
13 This has only been tested using a kernel downloaded via an ICE connection 13
14 using the Multi debugger. Support for the RTE-MOTHER-A is present, but 14 "rte-me2-cb"
15 hasn't been tested (unlike the other Midas labs cpu boards, the 15 The Midas labs RTE-V850E/ME2-CB evaluation board (CONFIG_RTE_CB_ME2).
16 RTE-V850E/ME2-CB includes an ethernet adaptor). 16 This has only been tested using a kernel downloaded via an ICE
17 17 connection using the Multi debugger. Support for the RTE-MOTHER-A is
18 + The NEC AS85EP1 V850E evaluation chip/board (CONFIG_V850E_AS85EP1). 18 present, but hasn't been tested (unlike the other Midas labs cpu
19 19 boards, the RTE-V850E/ME2-CB includes an ethernet adaptor).
20 + The NEC `Anna' (board/chip) implementation of the V850E2 processor 20
21 (CONFIG_V850E2_ANNA). 21 "as85ep1"
22 22 The NEC AS85EP1 V850E evaluation chip/board (CONFIG_V850E_AS85EP1).
23 + The sim85e2c and sim85e2s simulators, which are verilog simulations of 23
24 the V850E2 NA85E2C/NA85E2S cpu cores (CONFIG_V850E2_SIM85E2C and 24 "anna"
25 CONFIG_V850E2_SIM85E2S). 25 The NEC `Anna' (board/chip) implementation of the V850E2 processor
26 26 (CONFIG_V850E2_ANNA).
27 + A FPGA implementation of the V850E2 NA85E2C cpu core 27
28 (CONFIG_V850E2_FPGA85E2C). 28 "sim85e2c", "sim85e2s"
29 The sim85e2c and sim85e2s simulators, which are verilog simulations
30 of the V850E2 NA85E2C/NA85E2S cpu cores (CONFIG_V850E2_SIM85E2C and
31 CONFIG_V850E2_SIM85E2S).
32
33 "fpga85e2c"
34 A FPGA implementation of the V850E2 NA85E2C cpu core
35 (CONFIG_V850E2_FPGA85E2C).
36
37To get a default kernel configuration for a particular platform, you can
38use a <platform>_defconfig make target (e.g., "make rte-me2-cb_defconfig");
39to see which default configurations are possible, look in the directory
40"arch/v850/configs".
29 41
30Porting to anything with a V850E/MA1 or MA2 processor should be simple. 42Porting to anything with a V850E/MA1 or MA2 processor should be simple.
31See the file <asm-v850/machdep.h> and the files it includes for an example of 43See the file <asm-v850/machdep.h> and the files it includes for an example of
diff --git a/arch/v850/configs/rte-ma1-cb_defconfig b/arch/v850/configs/rte-ma1-cb_defconfig
new file mode 100644
index 000000000000..1b5ca3c3a658
--- /dev/null
+++ b/arch/v850/configs/rte-ma1-cb_defconfig
@@ -0,0 +1,605 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:08:27 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20# CONFIG_V850E_SIM is not set
21CONFIG_RTE_CB_MA1=y
22# CONFIG_RTE_CB_NB85E is not set
23# CONFIG_RTE_CB_ME2 is not set
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30CONFIG_V850E_MA1=y
31CONFIG_RTE_CB=y
32CONFIG_RTE_CB_MULTI=y
33CONFIG_RTE_CB_MULTI_DBTRAP=y
34# CONFIG_RTE_CB_MA1_KSRAM is not set
35CONFIG_RTE_MB_A_PCI=y
36CONFIG_RTE_GBUS_INT=y
37CONFIG_PCI=y
38CONFIG_V850E_INTC=y
39CONFIG_V850E_TIMER_D=y
40# CONFIG_V850E_CACHE is not set
41# CONFIG_V850E2_CACHE is not set
42CONFIG_NO_CACHE=y
43CONFIG_ZERO_BSS=y
44# CONFIG_V850E_HIGHRES_TIMER is not set
45# CONFIG_RESET_GUARD is not set
46CONFIG_LARGE_ALLOCS=y
47
48#
49# Code maturity level options
50#
51# CONFIG_EXPERIMENTAL is not set
52CONFIG_CLEAN_COMPILE=y
53CONFIG_BROKEN_ON_SMP=y
54CONFIG_INIT_ENV_ARG_LIMIT=32
55
56#
57# General setup
58#
59CONFIG_LOCALVERSION=""
60# CONFIG_BSD_PROCESS_ACCT is not set
61# CONFIG_SYSCTL is not set
62# CONFIG_AUDIT is not set
63# CONFIG_HOTPLUG is not set
64CONFIG_KOBJECT_UEVENT=y
65# CONFIG_IKCONFIG is not set
66CONFIG_EMBEDDED=y
67# CONFIG_KALLSYMS is not set
68CONFIG_PRINTK=y
69CONFIG_BUG=y
70# CONFIG_BASE_FULL is not set
71# CONFIG_FUTEX is not set
72# CONFIG_EPOLL is not set
73CONFIG_CC_OPTIMIZE_FOR_SIZE=y
74CONFIG_CC_ALIGN_FUNCTIONS=0
75CONFIG_CC_ALIGN_LABELS=0
76CONFIG_CC_ALIGN_LOOPS=0
77CONFIG_CC_ALIGN_JUMPS=0
78CONFIG_BASE_SMALL=1
79
80#
81# Loadable module support
82#
83CONFIG_MODULES=y
84CONFIG_MODULE_UNLOAD=y
85CONFIG_OBSOLETE_MODPARM=y
86# CONFIG_MODULE_SRCVERSION_ALL is not set
87CONFIG_KMOD=y
88
89#
90# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
91#
92# CONFIG_PCI_LEGACY_PROC is not set
93# CONFIG_PCI_NAMES is not set
94# CONFIG_PCI_DEBUG is not set
95
96#
97# PCCARD (PCMCIA/CardBus) support
98#
99# CONFIG_PCCARD is not set
100
101#
102# PCI Hotplug Support
103#
104
105#
106# Executable file formats
107#
108CONFIG_BINFMT_FLAT=y
109# CONFIG_BINFMT_ZFLAT is not set
110# CONFIG_BINFMT_SHARED_FLAT is not set
111# CONFIG_BINFMT_MISC is not set
112
113#
114# Generic Driver Options
115#
116CONFIG_STANDALONE=y
117CONFIG_PREVENT_FIRMWARE_BUILD=y
118# CONFIG_FW_LOADER is not set
119# CONFIG_DEBUG_DRIVER is not set
120
121#
122# Memory Technology Devices (MTD)
123#
124CONFIG_MTD=y
125# CONFIG_MTD_DEBUG is not set
126# CONFIG_MTD_CONCAT is not set
127# CONFIG_MTD_PARTITIONS is not set
128
129#
130# User Modules And Translation Layers
131#
132# CONFIG_MTD_CHAR is not set
133CONFIG_MTD_BLOCK=y
134# CONFIG_FTL is not set
135# CONFIG_NFTL is not set
136# CONFIG_INFTL is not set
137
138#
139# RAM/ROM/Flash chip drivers
140#
141# CONFIG_MTD_CFI is not set
142# CONFIG_MTD_JEDECPROBE is not set
143CONFIG_MTD_MAP_BANK_WIDTH_1=y
144CONFIG_MTD_MAP_BANK_WIDTH_2=y
145CONFIG_MTD_MAP_BANK_WIDTH_4=y
146# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
147# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
148# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
149CONFIG_MTD_CFI_I1=y
150CONFIG_MTD_CFI_I2=y
151# CONFIG_MTD_CFI_I4 is not set
152# CONFIG_MTD_CFI_I8 is not set
153# CONFIG_MTD_RAM is not set
154# CONFIG_MTD_ROM is not set
155# CONFIG_MTD_ABSENT is not set
156
157#
158# Mapping drivers for chip access
159#
160# CONFIG_MTD_COMPLEX_MAPPINGS is not set
161
162#
163# Self-contained MTD device drivers
164#
165# CONFIG_MTD_PMC551 is not set
166CONFIG_MTD_SLRAM=y
167# CONFIG_MTD_PHRAM is not set
168# CONFIG_MTD_MTDRAM is not set
169# CONFIG_MTD_BLKMTD is not set
170
171#
172# Disk-On-Chip Device Drivers
173#
174# CONFIG_MTD_DOC2000 is not set
175# CONFIG_MTD_DOC2001 is not set
176# CONFIG_MTD_DOC2001PLUS is not set
177
178#
179# NAND Flash Device Drivers
180#
181# CONFIG_MTD_NAND is not set
182
183#
184# Parallel port support
185#
186# CONFIG_PARPORT is not set
187
188#
189# Block devices
190#
191# CONFIG_BLK_DEV_FD is not set
192# CONFIG_BLK_CPQ_DA is not set
193# CONFIG_BLK_CPQ_CISS_DA is not set
194# CONFIG_BLK_DEV_DAC960 is not set
195# CONFIG_BLK_DEV_COW_COMMON is not set
196# CONFIG_BLK_DEV_LOOP is not set
197# CONFIG_BLK_DEV_NBD is not set
198# CONFIG_BLK_DEV_SX8 is not set
199# CONFIG_BLK_DEV_RAM is not set
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_INITRAMFS_SOURCE=""
202# CONFIG_CDROM_PKTCDVD is not set
203
204#
205# IO Schedulers
206#
207CONFIG_IOSCHED_NOOP=y
208# CONFIG_IOSCHED_AS is not set
209# CONFIG_IOSCHED_DEADLINE is not set
210# CONFIG_IOSCHED_CFQ is not set
211# CONFIG_ATA_OVER_ETH is not set
212
213#
214# Disk device support
215#
216
217#
218# ATA/ATAPI/MFM/RLL support
219#
220# CONFIG_IDE is not set
221
222#
223# SCSI device support
224#
225# CONFIG_SCSI is not set
226
227#
228# Multi-device support (RAID and LVM)
229#
230# CONFIG_MD is not set
231
232#
233# Fusion MPT device support
234#
235
236#
237# IEEE 1394 (FireWire) support
238#
239# CONFIG_IEEE1394 is not set
240
241#
242# I2O device support
243#
244# CONFIG_I2O is not set
245
246#
247# Networking support
248#
249CONFIG_NET=y
250
251#
252# Networking options
253#
254# CONFIG_PACKET is not set
255# CONFIG_UNIX is not set
256# CONFIG_NET_KEY is not set
257CONFIG_INET=y
258# CONFIG_IP_MULTICAST is not set
259# CONFIG_IP_ADVANCED_ROUTER is not set
260# CONFIG_IP_PNP is not set
261# CONFIG_NET_IPIP is not set
262# CONFIG_NET_IPGRE is not set
263# CONFIG_SYN_COOKIES is not set
264# CONFIG_INET_AH is not set
265# CONFIG_INET_ESP is not set
266# CONFIG_INET_IPCOMP is not set
267# CONFIG_INET_TUNNEL is not set
268# CONFIG_IP_TCPDIAG is not set
269# CONFIG_IP_TCPDIAG_IPV6 is not set
270# CONFIG_IPV6 is not set
271# CONFIG_NETFILTER is not set
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284
285#
286# Network testing
287#
288# CONFIG_NET_PKTGEN is not set
289# CONFIG_NETPOLL is not set
290# CONFIG_NET_POLL_CONTROLLER is not set
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294CONFIG_NETDEVICES=y
295# CONFIG_DUMMY is not set
296# CONFIG_BONDING is not set
297# CONFIG_EQUALIZER is not set
298# CONFIG_TUN is not set
299
300#
301# ARCnet devices
302#
303# CONFIG_ARCNET is not set
304
305#
306# Ethernet (10 or 100Mbit)
307#
308CONFIG_NET_ETHERNET=y
309CONFIG_MII=y
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313# CONFIG_NET_VENDOR_SMC is not set
314
315#
316# Tulip family network device support
317#
318# CONFIG_NET_TULIP is not set
319# CONFIG_HP100 is not set
320# CONFIG_NE2000 is not set
321CONFIG_NET_PCI=y
322# CONFIG_PCNET32 is not set
323# CONFIG_AMD8111_ETH is not set
324# CONFIG_ADAPTEC_STARFIRE is not set
325# CONFIG_DGRS is not set
326CONFIG_EEPRO100=y
327# CONFIG_E100 is not set
328# CONFIG_FEALNX is not set
329# CONFIG_NATSEMI is not set
330# CONFIG_NE2K_PCI is not set
331# CONFIG_8139TOO is not set
332# CONFIG_SIS900 is not set
333# CONFIG_EPIC100 is not set
334# CONFIG_SUNDANCE is not set
335# CONFIG_TLAN is not set
336# CONFIG_VIA_RHINE is not set
337
338#
339# Ethernet (1000 Mbit)
340#
341# CONFIG_ACENIC is not set
342# CONFIG_DL2K is not set
343# CONFIG_E1000 is not set
344# CONFIG_NS83820 is not set
345# CONFIG_HAMACHI is not set
346# CONFIG_R8169 is not set
347# CONFIG_SK98LIN is not set
348# CONFIG_VIA_VELOCITY is not set
349# CONFIG_TIGON3 is not set
350# CONFIG_BNX2 is not set
351
352#
353# Ethernet (10000 Mbit)
354#
355# CONFIG_IXGB is not set
356# CONFIG_S2IO is not set
357
358#
359# Token Ring devices
360#
361# CONFIG_TR is not set
362
363#
364# Wireless LAN (non-hamradio)
365#
366# CONFIG_NET_RADIO is not set
367
368#
369# Wan interfaces
370#
371# CONFIG_WAN is not set
372# CONFIG_FDDI is not set
373# CONFIG_PPP is not set
374# CONFIG_SLIP is not set
375
376#
377# ISDN subsystem
378#
379# CONFIG_ISDN is not set
380
381#
382# Input device support
383#
384CONFIG_INPUT=y
385
386#
387# Userland interfaces
388#
389# CONFIG_INPUT_MOUSEDEV is not set
390# CONFIG_INPUT_JOYDEV is not set
391# CONFIG_INPUT_TSDEV is not set
392# CONFIG_INPUT_EVDEV is not set
393# CONFIG_INPUT_EVBUG is not set
394
395#
396# Input Device Drivers
397#
398# CONFIG_INPUT_KEYBOARD is not set
399# CONFIG_INPUT_MOUSE is not set
400# CONFIG_INPUT_JOYSTICK is not set
401# CONFIG_INPUT_TOUCHSCREEN is not set
402# CONFIG_INPUT_MISC is not set
403
404#
405# Hardware I/O ports
406#
407# CONFIG_SERIO is not set
408# CONFIG_GAMEPORT is not set
409
410#
411# Character devices
412#
413# CONFIG_VT is not set
414# CONFIG_SERIAL_NONSTANDARD is not set
415
416#
417# Serial drivers
418#
419# CONFIG_SERIAL_8250 is not set
420
421#
422# Non-8250 serial port support
423#
424CONFIG_V850E_UART=y
425CONFIG_V850E_UART_CONSOLE=y
426CONFIG_SERIAL_CORE=y
427CONFIG_SERIAL_CORE_CONSOLE=y
428# CONFIG_SERIAL_JSM is not set
429# CONFIG_UNIX98_PTYS is not set
430# CONFIG_LEGACY_PTYS is not set
431
432#
433# IPMI
434#
435# CONFIG_IPMI_HANDLER is not set
436
437#
438# Watchdog Cards
439#
440# CONFIG_WATCHDOG is not set
441# CONFIG_RTC is not set
442# CONFIG_GEN_RTC is not set
443# CONFIG_DTLK is not set
444# CONFIG_R3964 is not set
445# CONFIG_APPLICOM is not set
446
447#
448# Ftape, the floppy tape device driver
449#
450# CONFIG_DRM is not set
451# CONFIG_RAW_DRIVER is not set
452
453#
454# TPM devices
455#
456
457#
458# Multimedia devices
459#
460# CONFIG_VIDEO_DEV is not set
461
462#
463# Digital Video Broadcasting Devices
464#
465# CONFIG_DVB is not set
466
467#
468# File systems
469#
470# CONFIG_EXT2_FS is not set
471# CONFIG_EXT3_FS is not set
472# CONFIG_JBD is not set
473# CONFIG_REISERFS_FS is not set
474# CONFIG_JFS_FS is not set
475
476#
477# XFS support
478#
479# CONFIG_XFS_FS is not set
480# CONFIG_MINIX_FS is not set
481CONFIG_ROMFS_FS=y
482# CONFIG_QUOTA is not set
483CONFIG_DNOTIFY=y
484# CONFIG_AUTOFS_FS is not set
485# CONFIG_AUTOFS4_FS is not set
486
487#
488# CD-ROM/DVD Filesystems
489#
490# CONFIG_ISO9660_FS is not set
491# CONFIG_UDF_FS is not set
492
493#
494# DOS/FAT/NT Filesystems
495#
496# CONFIG_MSDOS_FS is not set
497# CONFIG_VFAT_FS is not set
498# CONFIG_NTFS_FS is not set
499
500#
501# Pseudo filesystems
502#
503CONFIG_PROC_FS=y
504CONFIG_SYSFS=y
505# CONFIG_TMPFS is not set
506# CONFIG_HUGETLB_PAGE is not set
507CONFIG_RAMFS=y
508
509#
510# Miscellaneous filesystems
511#
512# CONFIG_HFSPLUS_FS is not set
513# CONFIG_JFFS_FS is not set
514# CONFIG_JFFS2_FS is not set
515# CONFIG_CRAMFS is not set
516# CONFIG_VXFS_FS is not set
517# CONFIG_HPFS_FS is not set
518# CONFIG_QNX4FS_FS is not set
519# CONFIG_SYSV_FS is not set
520# CONFIG_UFS_FS is not set
521
522#
523# Network File Systems
524#
525CONFIG_NFS_FS=y
526CONFIG_NFS_V3=y
527# CONFIG_NFSD is not set
528CONFIG_LOCKD=y
529CONFIG_LOCKD_V4=y
530CONFIG_SUNRPC=y
531# CONFIG_SMB_FS is not set
532# CONFIG_CIFS is not set
533# CONFIG_NCP_FS is not set
534# CONFIG_CODA_FS is not set
535
536#
537# Partition Types
538#
539# CONFIG_PARTITION_ADVANCED is not set
540CONFIG_MSDOS_PARTITION=y
541
542#
543# Native Language Support
544#
545# CONFIG_NLS is not set
546
547#
548# Graphics support
549#
550# CONFIG_FB is not set
551
552#
553# Sound
554#
555# CONFIG_SOUND is not set
556
557#
558# USB support
559#
560CONFIG_USB_ARCH_HAS_HCD=y
561CONFIG_USB_ARCH_HAS_OHCI=y
562# CONFIG_USB is not set
563
564#
565# USB Gadget Support
566#
567# CONFIG_USB_GADGET is not set
568
569#
570# Kernel hacking
571#
572# CONFIG_PRINTK_TIME is not set
573CONFIG_DEBUG_KERNEL=y
574# CONFIG_MAGIC_SYSRQ is not set
575CONFIG_LOG_BUF_SHIFT=14
576# CONFIG_SCHEDSTATS is not set
577# CONFIG_DEBUG_SLAB is not set
578# CONFIG_DEBUG_SPINLOCK is not set
579# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
580# CONFIG_DEBUG_KOBJECT is not set
581CONFIG_DEBUG_INFO=y
582# CONFIG_DEBUG_FS is not set
583# CONFIG_NO_KERNEL_MSG is not set
584
585#
586# Security options
587#
588# CONFIG_KEYS is not set
589# CONFIG_SECURITY is not set
590
591#
592# Cryptographic options
593#
594# CONFIG_CRYPTO is not set
595
596#
597# Hardware crypto devices
598#
599
600#
601# Library routines
602#
603# CONFIG_CRC_CCITT is not set
604# CONFIG_CRC32 is not set
605# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/configs/rte-me2-cb_defconfig b/arch/v850/configs/rte-me2-cb_defconfig
new file mode 100644
index 000000000000..44becc065404
--- /dev/null
+++ b/arch/v850/configs/rte-me2-cb_defconfig
@@ -0,0 +1,453 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:30:08 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20# CONFIG_V850E_SIM is not set
21# CONFIG_RTE_CB_MA1 is not set
22# CONFIG_RTE_CB_NB85E is not set
23CONFIG_RTE_CB_ME2=y
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30CONFIG_V850E_ME2=y
31CONFIG_RTE_CB=y
32# CONFIG_RTE_MB_A_PCI is not set
33# CONFIG_PCI is not set
34CONFIG_V850E_INTC=y
35CONFIG_V850E_TIMER_D=y
36CONFIG_V850E_CACHE=y
37# CONFIG_V850E2_CACHE is not set
38# CONFIG_NO_CACHE is not set
39# CONFIG_ROM_KERNEL is not set
40CONFIG_ZERO_BSS=y
41# CONFIG_V850E_HIGHRES_TIMER is not set
42# CONFIG_RESET_GUARD is not set
43CONFIG_LARGE_ALLOCS=y
44
45#
46# Code maturity level options
47#
48# CONFIG_EXPERIMENTAL is not set
49CONFIG_CLEAN_COMPILE=y
50CONFIG_BROKEN_ON_SMP=y
51CONFIG_INIT_ENV_ARG_LIMIT=32
52
53#
54# General setup
55#
56CONFIG_LOCALVERSION=""
57# CONFIG_BSD_PROCESS_ACCT is not set
58# CONFIG_SYSCTL is not set
59# CONFIG_AUDIT is not set
60# CONFIG_HOTPLUG is not set
61# CONFIG_IKCONFIG is not set
62CONFIG_EMBEDDED=y
63# CONFIG_KALLSYMS is not set
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66# CONFIG_BASE_FULL is not set
67# CONFIG_FUTEX is not set
68# CONFIG_EPOLL is not set
69CONFIG_CC_OPTIMIZE_FOR_SIZE=y
70CONFIG_CC_ALIGN_FUNCTIONS=0
71CONFIG_CC_ALIGN_LABELS=0
72CONFIG_CC_ALIGN_LOOPS=0
73CONFIG_CC_ALIGN_JUMPS=0
74CONFIG_BASE_SMALL=1
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y
81CONFIG_OBSOLETE_MODPARM=y
82# CONFIG_MODULE_SRCVERSION_ALL is not set
83CONFIG_KMOD=y
84
85#
86# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
87#
88
89#
90# PCCARD (PCMCIA/CardBus) support
91#
92# CONFIG_PCCARD is not set
93
94#
95# PCI Hotplug Support
96#
97
98#
99# Executable file formats
100#
101CONFIG_BINFMT_FLAT=y
102# CONFIG_BINFMT_ZFLAT is not set
103# CONFIG_BINFMT_SHARED_FLAT is not set
104# CONFIG_BINFMT_MISC is not set
105
106#
107# Generic Driver Options
108#
109CONFIG_STANDALONE=y
110CONFIG_PREVENT_FIRMWARE_BUILD=y
111# CONFIG_FW_LOADER is not set
112# CONFIG_DEBUG_DRIVER is not set
113
114#
115# Memory Technology Devices (MTD)
116#
117CONFIG_MTD=y
118# CONFIG_MTD_DEBUG is not set
119# CONFIG_MTD_CONCAT is not set
120# CONFIG_MTD_PARTITIONS is not set
121
122#
123# User Modules And Translation Layers
124#
125# CONFIG_MTD_CHAR is not set
126CONFIG_MTD_BLOCK=y
127# CONFIG_FTL is not set
128# CONFIG_NFTL is not set
129# CONFIG_INFTL is not set
130
131#
132# RAM/ROM/Flash chip drivers
133#
134# CONFIG_MTD_CFI is not set
135# CONFIG_MTD_JEDECPROBE is not set
136CONFIG_MTD_MAP_BANK_WIDTH_1=y
137CONFIG_MTD_MAP_BANK_WIDTH_2=y
138CONFIG_MTD_MAP_BANK_WIDTH_4=y
139# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
140# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
141# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
142CONFIG_MTD_CFI_I1=y
143CONFIG_MTD_CFI_I2=y
144# CONFIG_MTD_CFI_I4 is not set
145# CONFIG_MTD_CFI_I8 is not set
146# CONFIG_MTD_RAM is not set
147# CONFIG_MTD_ROM is not set
148# CONFIG_MTD_ABSENT is not set
149
150#
151# Mapping drivers for chip access
152#
153# CONFIG_MTD_COMPLEX_MAPPINGS is not set
154
155#
156# Self-contained MTD device drivers
157#
158CONFIG_MTD_SLRAM=y
159# CONFIG_MTD_PHRAM is not set
160# CONFIG_MTD_MTDRAM is not set
161# CONFIG_MTD_BLKMTD is not set
162
163#
164# Disk-On-Chip Device Drivers
165#
166# CONFIG_MTD_DOC2000 is not set
167# CONFIG_MTD_DOC2001 is not set
168# CONFIG_MTD_DOC2001PLUS is not set
169
170#
171# NAND Flash Device Drivers
172#
173# CONFIG_MTD_NAND is not set
174
175#
176# Parallel port support
177#
178# CONFIG_PARPORT is not set
179
180#
181# Block devices
182#
183# CONFIG_BLK_DEV_FD is not set
184# CONFIG_BLK_DEV_COW_COMMON is not set
185# CONFIG_BLK_DEV_LOOP is not set
186# CONFIG_BLK_DEV_RAM is not set
187CONFIG_BLK_DEV_RAM_COUNT=16
188CONFIG_INITRAMFS_SOURCE=""
189# CONFIG_CDROM_PKTCDVD is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195# CONFIG_IOSCHED_AS is not set
196# CONFIG_IOSCHED_DEADLINE is not set
197# CONFIG_IOSCHED_CFQ is not set
198
199#
200# Disk device support
201#
202
203#
204# ATA/ATAPI/MFM/RLL support
205#
206# CONFIG_IDE is not set
207
208#
209# SCSI device support
210#
211# CONFIG_SCSI is not set
212
213#
214# Multi-device support (RAID and LVM)
215#
216# CONFIG_MD is not set
217
218#
219# Fusion MPT device support
220#
221
222#
223# IEEE 1394 (FireWire) support
224#
225
226#
227# I2O device support
228#
229
230#
231# Networking support
232#
233# CONFIG_NET is not set
234# CONFIG_NETPOLL is not set
235# CONFIG_NET_POLL_CONTROLLER is not set
236
237#
238# ISDN subsystem
239#
240
241#
242# Input device support
243#
244CONFIG_INPUT=y
245
246#
247# Userland interfaces
248#
249# CONFIG_INPUT_MOUSEDEV is not set
250# CONFIG_INPUT_JOYDEV is not set
251# CONFIG_INPUT_TSDEV is not set
252# CONFIG_INPUT_EVDEV is not set
253# CONFIG_INPUT_EVBUG is not set
254
255#
256# Input Device Drivers
257#
258# CONFIG_INPUT_KEYBOARD is not set
259# CONFIG_INPUT_MOUSE is not set
260# CONFIG_INPUT_JOYSTICK is not set
261# CONFIG_INPUT_TOUCHSCREEN is not set
262# CONFIG_INPUT_MISC is not set
263
264#
265# Hardware I/O ports
266#
267CONFIG_SERIO=y
268# CONFIG_SERIO_I8042 is not set
269# CONFIG_SERIO_SERPORT is not set
270# CONFIG_SERIO_LIBPS2 is not set
271# CONFIG_SERIO_RAW is not set
272# CONFIG_GAMEPORT is not set
273
274#
275# Character devices
276#
277# CONFIG_VT is not set
278# CONFIG_SERIAL_NONSTANDARD is not set
279
280#
281# Serial drivers
282#
283CONFIG_SERIAL_8250=y
284CONFIG_SERIAL_8250_CONSOLE=y
285CONFIG_SERIAL_8250_NR_UARTS=1
286# CONFIG_SERIAL_8250_EXTENDED is not set
287
288#
289# Non-8250 serial port support
290#
291# CONFIG_V850E_UART is not set
292CONFIG_SERIAL_CORE=y
293CONFIG_SERIAL_CORE_CONSOLE=y
294# CONFIG_UNIX98_PTYS is not set
295# CONFIG_LEGACY_PTYS is not set
296
297#
298# IPMI
299#
300# CONFIG_IPMI_HANDLER is not set
301
302#
303# Watchdog Cards
304#
305# CONFIG_WATCHDOG is not set
306# CONFIG_RTC is not set
307# CONFIG_GEN_RTC is not set
308# CONFIG_DTLK is not set
309# CONFIG_R3964 is not set
310
311#
312# Ftape, the floppy tape device driver
313#
314# CONFIG_DRM is not set
315# CONFIG_RAW_DRIVER is not set
316
317#
318# TPM devices
319#
320
321#
322# Multimedia devices
323#
324# CONFIG_VIDEO_DEV is not set
325
326#
327# Digital Video Broadcasting Devices
328#
329
330#
331# File systems
332#
333# CONFIG_EXT2_FS is not set
334# CONFIG_EXT3_FS is not set
335# CONFIG_JBD is not set
336# CONFIG_REISERFS_FS is not set
337# CONFIG_JFS_FS is not set
338
339#
340# XFS support
341#
342# CONFIG_XFS_FS is not set
343# CONFIG_MINIX_FS is not set
344CONFIG_ROMFS_FS=y
345# CONFIG_QUOTA is not set
346CONFIG_DNOTIFY=y
347# CONFIG_AUTOFS_FS is not set
348# CONFIG_AUTOFS4_FS is not set
349
350#
351# CD-ROM/DVD Filesystems
352#
353# CONFIG_ISO9660_FS is not set
354# CONFIG_UDF_FS is not set
355
356#
357# DOS/FAT/NT Filesystems
358#
359# CONFIG_MSDOS_FS is not set
360# CONFIG_VFAT_FS is not set
361# CONFIG_NTFS_FS is not set
362
363#
364# Pseudo filesystems
365#
366CONFIG_PROC_FS=y
367CONFIG_SYSFS=y
368# CONFIG_TMPFS is not set
369# CONFIG_HUGETLB_PAGE is not set
370CONFIG_RAMFS=y
371
372#
373# Miscellaneous filesystems
374#
375# CONFIG_HFSPLUS_FS is not set
376# CONFIG_JFFS_FS is not set
377# CONFIG_JFFS2_FS is not set
378# CONFIG_CRAMFS is not set
379# CONFIG_VXFS_FS is not set
380# CONFIG_HPFS_FS is not set
381# CONFIG_QNX4FS_FS is not set
382# CONFIG_SYSV_FS is not set
383# CONFIG_UFS_FS is not set
384
385#
386# Partition Types
387#
388# CONFIG_PARTITION_ADVANCED is not set
389CONFIG_MSDOS_PARTITION=y
390
391#
392# Native Language Support
393#
394# CONFIG_NLS is not set
395
396#
397# Graphics support
398#
399# CONFIG_FB is not set
400
401#
402# Sound
403#
404# CONFIG_SOUND is not set
405
406#
407# USB support
408#
409# CONFIG_USB_ARCH_HAS_HCD is not set
410# CONFIG_USB_ARCH_HAS_OHCI is not set
411
412#
413# USB Gadget Support
414#
415# CONFIG_USB_GADGET is not set
416
417#
418# Kernel hacking
419#
420# CONFIG_PRINTK_TIME is not set
421CONFIG_DEBUG_KERNEL=y
422# CONFIG_MAGIC_SYSRQ is not set
423CONFIG_LOG_BUF_SHIFT=14
424# CONFIG_SCHEDSTATS is not set
425# CONFIG_DEBUG_SLAB is not set
426# CONFIG_DEBUG_SPINLOCK is not set
427# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
428# CONFIG_DEBUG_KOBJECT is not set
429CONFIG_DEBUG_INFO=y
430# CONFIG_DEBUG_FS is not set
431# CONFIG_NO_KERNEL_MSG is not set
432
433#
434# Security options
435#
436# CONFIG_KEYS is not set
437# CONFIG_SECURITY is not set
438
439#
440# Cryptographic options
441#
442# CONFIG_CRYPTO is not set
443
444#
445# Hardware crypto devices
446#
447
448#
449# Library routines
450#
451# CONFIG_CRC_CCITT is not set
452# CONFIG_CRC32 is not set
453# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/configs/sim_defconfig b/arch/v850/configs/sim_defconfig
new file mode 100644
index 000000000000..d73f5f9d8383
--- /dev/null
+++ b/arch/v850/configs/sim_defconfig
@@ -0,0 +1,442 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:29:27 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20CONFIG_V850E_SIM=y
21# CONFIG_RTE_CB_MA1 is not set
22# CONFIG_RTE_CB_NB85E is not set
23# CONFIG_RTE_CB_ME2 is not set
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30# CONFIG_PCI is not set
31# CONFIG_V850E_INTC is not set
32# CONFIG_V850E_TIMER_D is not set
33# CONFIG_V850E_CACHE is not set
34# CONFIG_V850E2_CACHE is not set
35CONFIG_NO_CACHE=y
36CONFIG_ZERO_BSS=y
37# CONFIG_RESET_GUARD is not set
38CONFIG_LARGE_ALLOCS=y
39
40#
41# Code maturity level options
42#
43# CONFIG_EXPERIMENTAL is not set
44CONFIG_CLEAN_COMPILE=y
45CONFIG_BROKEN_ON_SMP=y
46CONFIG_INIT_ENV_ARG_LIMIT=32
47
48#
49# General setup
50#
51CONFIG_LOCALVERSION=""
52# CONFIG_BSD_PROCESS_ACCT is not set
53# CONFIG_SYSCTL is not set
54# CONFIG_AUDIT is not set
55# CONFIG_HOTPLUG is not set
56# CONFIG_IKCONFIG is not set
57CONFIG_EMBEDDED=y
58# CONFIG_KALLSYMS is not set
59CONFIG_PRINTK=y
60CONFIG_BUG=y
61# CONFIG_BASE_FULL is not set
62# CONFIG_FUTEX is not set
63# CONFIG_EPOLL is not set
64CONFIG_CC_OPTIMIZE_FOR_SIZE=y
65CONFIG_CC_ALIGN_FUNCTIONS=0
66CONFIG_CC_ALIGN_LABELS=0
67CONFIG_CC_ALIGN_LOOPS=0
68CONFIG_CC_ALIGN_JUMPS=0
69CONFIG_BASE_SMALL=1
70
71#
72# Loadable module support
73#
74CONFIG_MODULES=y
75CONFIG_MODULE_UNLOAD=y
76CONFIG_OBSOLETE_MODPARM=y
77# CONFIG_MODULE_SRCVERSION_ALL is not set
78CONFIG_KMOD=y
79
80#
81# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
82#
83
84#
85# PCCARD (PCMCIA/CardBus) support
86#
87# CONFIG_PCCARD is not set
88
89#
90# PCI Hotplug Support
91#
92
93#
94# Executable file formats
95#
96CONFIG_BINFMT_FLAT=y
97# CONFIG_BINFMT_ZFLAT is not set
98# CONFIG_BINFMT_SHARED_FLAT is not set
99# CONFIG_BINFMT_MISC is not set
100
101#
102# Generic Driver Options
103#
104CONFIG_STANDALONE=y
105CONFIG_PREVENT_FIRMWARE_BUILD=y
106# CONFIG_FW_LOADER is not set
107# CONFIG_DEBUG_DRIVER is not set
108
109#
110# Memory Technology Devices (MTD)
111#
112CONFIG_MTD=y
113# CONFIG_MTD_DEBUG is not set
114# CONFIG_MTD_CONCAT is not set
115# CONFIG_MTD_PARTITIONS is not set
116
117#
118# User Modules And Translation Layers
119#
120# CONFIG_MTD_CHAR is not set
121CONFIG_MTD_BLOCK=y
122# CONFIG_FTL is not set
123# CONFIG_NFTL is not set
124# CONFIG_INFTL is not set
125
126#
127# RAM/ROM/Flash chip drivers
128#
129# CONFIG_MTD_CFI is not set
130# CONFIG_MTD_JEDECPROBE is not set
131CONFIG_MTD_MAP_BANK_WIDTH_1=y
132CONFIG_MTD_MAP_BANK_WIDTH_2=y
133CONFIG_MTD_MAP_BANK_WIDTH_4=y
134# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
135# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
136# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
137CONFIG_MTD_CFI_I1=y
138CONFIG_MTD_CFI_I2=y
139# CONFIG_MTD_CFI_I4 is not set
140# CONFIG_MTD_CFI_I8 is not set
141# CONFIG_MTD_RAM is not set
142# CONFIG_MTD_ROM is not set
143# CONFIG_MTD_ABSENT is not set
144
145#
146# Mapping drivers for chip access
147#
148# CONFIG_MTD_COMPLEX_MAPPINGS is not set
149
150#
151# Self-contained MTD device drivers
152#
153CONFIG_MTD_SLRAM=y
154# CONFIG_MTD_PHRAM is not set
155# CONFIG_MTD_MTDRAM is not set
156# CONFIG_MTD_BLKMTD is not set
157
158#
159# Disk-On-Chip Device Drivers
160#
161# CONFIG_MTD_DOC2000 is not set
162# CONFIG_MTD_DOC2001 is not set
163# CONFIG_MTD_DOC2001PLUS is not set
164
165#
166# NAND Flash Device Drivers
167#
168# CONFIG_MTD_NAND is not set
169
170#
171# Parallel port support
172#
173# CONFIG_PARPORT is not set
174
175#
176# Block devices
177#
178# CONFIG_BLK_DEV_FD is not set
179# CONFIG_BLK_DEV_COW_COMMON is not set
180# CONFIG_BLK_DEV_LOOP is not set
181# CONFIG_BLK_DEV_RAM is not set
182CONFIG_BLK_DEV_RAM_COUNT=16
183CONFIG_INITRAMFS_SOURCE=""
184# CONFIG_CDROM_PKTCDVD is not set
185
186#
187# IO Schedulers
188#
189CONFIG_IOSCHED_NOOP=y
190# CONFIG_IOSCHED_AS is not set
191# CONFIG_IOSCHED_DEADLINE is not set
192# CONFIG_IOSCHED_CFQ is not set
193
194#
195# Disk device support
196#
197
198#
199# ATA/ATAPI/MFM/RLL support
200#
201# CONFIG_IDE is not set
202
203#
204# SCSI device support
205#
206# CONFIG_SCSI is not set
207
208#
209# Multi-device support (RAID and LVM)
210#
211# CONFIG_MD is not set
212
213#
214# Fusion MPT device support
215#
216
217#
218# IEEE 1394 (FireWire) support
219#
220
221#
222# I2O device support
223#
224
225#
226# Networking support
227#
228# CONFIG_NET is not set
229# CONFIG_NETPOLL is not set
230# CONFIG_NET_POLL_CONTROLLER is not set
231
232#
233# ISDN subsystem
234#
235
236#
237# Input device support
238#
239CONFIG_INPUT=y
240
241#
242# Userland interfaces
243#
244# CONFIG_INPUT_MOUSEDEV is not set
245# CONFIG_INPUT_JOYDEV is not set
246# CONFIG_INPUT_TSDEV is not set
247# CONFIG_INPUT_EVDEV is not set
248# CONFIG_INPUT_EVBUG is not set
249
250#
251# Input Device Drivers
252#
253# CONFIG_INPUT_KEYBOARD is not set
254# CONFIG_INPUT_MOUSE is not set
255# CONFIG_INPUT_JOYSTICK is not set
256# CONFIG_INPUT_TOUCHSCREEN is not set
257# CONFIG_INPUT_MISC is not set
258
259#
260# Hardware I/O ports
261#
262CONFIG_SERIO=y
263# CONFIG_SERIO_I8042 is not set
264# CONFIG_SERIO_SERPORT is not set
265# CONFIG_SERIO_LIBPS2 is not set
266# CONFIG_SERIO_RAW is not set
267# CONFIG_GAMEPORT is not set
268
269#
270# Character devices
271#
272# CONFIG_VT is not set
273# CONFIG_SERIAL_NONSTANDARD is not set
274
275#
276# Serial drivers
277#
278# CONFIG_SERIAL_8250 is not set
279
280#
281# Non-8250 serial port support
282#
283# CONFIG_UNIX98_PTYS is not set
284# CONFIG_LEGACY_PTYS is not set
285
286#
287# IPMI
288#
289# CONFIG_IPMI_HANDLER is not set
290
291#
292# Watchdog Cards
293#
294# CONFIG_WATCHDOG is not set
295# CONFIG_RTC is not set
296# CONFIG_GEN_RTC is not set
297# CONFIG_DTLK is not set
298# CONFIG_R3964 is not set
299
300#
301# Ftape, the floppy tape device driver
302#
303# CONFIG_DRM is not set
304# CONFIG_RAW_DRIVER is not set
305
306#
307# TPM devices
308#
309
310#
311# Multimedia devices
312#
313# CONFIG_VIDEO_DEV is not set
314
315#
316# Digital Video Broadcasting Devices
317#
318
319#
320# File systems
321#
322# CONFIG_EXT2_FS is not set
323# CONFIG_EXT3_FS is not set
324# CONFIG_JBD is not set
325# CONFIG_REISERFS_FS is not set
326# CONFIG_JFS_FS is not set
327
328#
329# XFS support
330#
331# CONFIG_XFS_FS is not set
332# CONFIG_MINIX_FS is not set
333CONFIG_ROMFS_FS=y
334# CONFIG_QUOTA is not set
335CONFIG_DNOTIFY=y
336# CONFIG_AUTOFS_FS is not set
337# CONFIG_AUTOFS4_FS is not set
338
339#
340# CD-ROM/DVD Filesystems
341#
342# CONFIG_ISO9660_FS is not set
343# CONFIG_UDF_FS is not set
344
345#
346# DOS/FAT/NT Filesystems
347#
348# CONFIG_MSDOS_FS is not set
349# CONFIG_VFAT_FS is not set
350# CONFIG_NTFS_FS is not set
351
352#
353# Pseudo filesystems
354#
355CONFIG_PROC_FS=y
356CONFIG_SYSFS=y
357# CONFIG_TMPFS is not set
358# CONFIG_HUGETLB_PAGE is not set
359CONFIG_RAMFS=y
360
361#
362# Miscellaneous filesystems
363#
364# CONFIG_HFSPLUS_FS is not set
365# CONFIG_JFFS_FS is not set
366# CONFIG_JFFS2_FS is not set
367# CONFIG_CRAMFS is not set
368# CONFIG_VXFS_FS is not set
369# CONFIG_HPFS_FS is not set
370# CONFIG_QNX4FS_FS is not set
371# CONFIG_SYSV_FS is not set
372# CONFIG_UFS_FS is not set
373
374#
375# Partition Types
376#
377# CONFIG_PARTITION_ADVANCED is not set
378CONFIG_MSDOS_PARTITION=y
379
380#
381# Native Language Support
382#
383# CONFIG_NLS is not set
384
385#
386# Graphics support
387#
388# CONFIG_FB is not set
389
390#
391# Sound
392#
393# CONFIG_SOUND is not set
394
395#
396# USB support
397#
398# CONFIG_USB_ARCH_HAS_HCD is not set
399# CONFIG_USB_ARCH_HAS_OHCI is not set
400
401#
402# USB Gadget Support
403#
404# CONFIG_USB_GADGET is not set
405
406#
407# Kernel hacking
408#
409# CONFIG_PRINTK_TIME is not set
410CONFIG_DEBUG_KERNEL=y
411# CONFIG_MAGIC_SYSRQ is not set
412CONFIG_LOG_BUF_SHIFT=14
413# CONFIG_SCHEDSTATS is not set
414# CONFIG_DEBUG_SLAB is not set
415# CONFIG_DEBUG_SPINLOCK is not set
416# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
417# CONFIG_DEBUG_KOBJECT is not set
418CONFIG_DEBUG_INFO=y
419# CONFIG_DEBUG_FS is not set
420# CONFIG_NO_KERNEL_MSG is not set
421
422#
423# Security options
424#
425# CONFIG_KEYS is not set
426# CONFIG_SECURITY is not set
427
428#
429# Cryptographic options
430#
431# CONFIG_CRYPTO is not set
432
433#
434# Hardware crypto devices
435#
436
437#
438# Library routines
439#
440# CONFIG_CRC_CCITT is not set
441# CONFIG_CRC32 is not set
442# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
index 074b50abc89d..ffbb6d073bf2 100644
--- a/arch/v850/kernel/rte_mb_a_pci.c
+++ b/arch/v850/kernel/rte_mb_a_pci.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * arch/v850/kernel/mb_a_pci.c -- PCI support for Midas lab RTE-MOTHER-A board 2 * arch/v850/kernel/mb_a_pci.c -- PCI support for Midas lab RTE-MOTHER-A board
3 * 3 *
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -743,15 +743,17 @@ pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,int dir)
743 for a scatter-gather list, same rules and usage. */ 743 for a scatter-gather list, same rules and usage. */
744 744
745void 745void
746pci_dma_sync_sg_for_cpu (struct pci_dev *dev, struct scatterlist *sg, int sg_len, 746pci_dma_sync_sg_for_cpu (struct pci_dev *dev,
747 int dir) 747 struct scatterlist *sg, int sg_len,
748 int dir)
748{ 749{
749 BUG (); 750 BUG ();
750} 751}
751 752
752void 753void
753pci_dma_sync_sg_for_device (struct pci_dev *dev, struct scatterlist *sg, int sg_len, 754pci_dma_sync_sg_for_device (struct pci_dev *dev,
754 int dir) 755 struct scatterlist *sg, int sg_len,
756 int dir)
755{ 757{
756 BUG (); 758 BUG ();
757} 759}
@@ -786,6 +788,27 @@ pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
786} 788}
787 789
788 790
791/* iomap/iomap */
792
793void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max)
794{
795 unsigned long start = pci_resource_start (dev, bar);
796 unsigned long len = pci_resource_len (dev, bar);
797
798 if (!start || len == 0)
799 return 0;
800
801 /* None of the ioremap functions actually do anything, other than
802 re-casting their argument, so don't bother differentiating them. */
803 return ioremap (start, len);
804}
805
806void pci_iounmap (struct pci_dev *dev, void __iomem *addr)
807{
808 /* nothing */
809}
810
811
789/* symbol exports (for modules) */ 812/* symbol exports (for modules) */
790 813
791EXPORT_SYMBOL (pci_map_single); 814EXPORT_SYMBOL (pci_map_single);
@@ -794,3 +817,5 @@ EXPORT_SYMBOL (pci_alloc_consistent);
794EXPORT_SYMBOL (pci_free_consistent); 817EXPORT_SYMBOL (pci_free_consistent);
795EXPORT_SYMBOL (pci_dma_sync_single_for_cpu); 818EXPORT_SYMBOL (pci_dma_sync_single_for_cpu);
796EXPORT_SYMBOL (pci_dma_sync_single_for_device); 819EXPORT_SYMBOL (pci_dma_sync_single_for_device);
820EXPORT_SYMBOL (pci_iomap);
821EXPORT_SYMBOL (pci_iounmap);
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index c366a8b326ee..5be05f47109e 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15
15#define VMLINUX_SYMBOL(_sym_) _##_sym_ 16#define VMLINUX_SYMBOL(_sym_) _##_sym_
16#include <asm-generic/vmlinux.lds.h> 17#include <asm-generic/vmlinux.lds.h>
17 18
@@ -42,6 +43,19 @@
42 *(.rodata) *(.rodata.*) \ 43 *(.rodata) *(.rodata.*) \
43 *(__vermagic) /* Kernel version magic */ \ 44 *(__vermagic) /* Kernel version magic */ \
44 *(.rodata1) \ 45 *(.rodata1) \
46 /* PCI quirks */ \
47 ___start_pci_fixups_early = . ; \
48 *(.pci_fixup_early) \
49 ___end_pci_fixups_early = . ; \
50 ___start_pci_fixups_header = . ; \
51 *(.pci_fixup_header) \
52 ___end_pci_fixups_header = . ; \
53 ___start_pci_fixups_final = . ; \
54 *(.pci_fixup_final) \
55 ___end_pci_fixups_final = . ; \
56 ___start_pci_fixups_enable = . ; \
57 *(.pci_fixup_enable) \
58 ___end_pci_fixups_enable = . ; \
45 /* Kernel symbol table: Normal symbols */ \ 59 /* Kernel symbol table: Normal symbols */ \
46 ___start___ksymtab = .; \ 60 ___start___ksymtab = .; \
47 *(__ksymtab) \ 61 *(__ksymtab) \
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 4b8326177c52..660a03a89e66 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -329,12 +329,15 @@ config HPET_EMULATE_RTC
329 329
330config GART_IOMMU 330config GART_IOMMU
331 bool "IOMMU support" 331 bool "IOMMU support"
332 default y
332 depends on PCI 333 depends on PCI
333 help 334 help
334 Support the K8 IOMMU. Needed to run systems with more than 4GB of memory 335 Support the IOMMU. Needed to run systems with more than 3GB of memory
335 properly with 32-bit PCI devices that do not support DAC (Double Address 336 properly with 32-bit PCI devices that do not support DAC (Double Address
336 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. 337 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter.
337 Normally the kernel will take the right choice by itself. 338 Normally the kernel will take the right choice by itself.
339 This option includes a driver for the AMD Opteron/Athlon64 IOMMU
340 and a software emulation used on some other systems.
338 If unsure, say Y. 341 If unsure, say Y.
339 342
340# need this always enabled with GART_IOMMU for the VIA workaround 343# need this always enabled with GART_IOMMU for the VIA workaround
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 428915697675..4c6ed96d5f7c 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -21,18 +21,6 @@
21# 21#
22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ 22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
23 23
24#
25# early bootup linking needs 32bit. You can either use real 32bit tools
26# here or 64bit tools in 32bit mode.
27#
28IA32_CC := $(CC) $(CPPFLAGS) -m32 -O2 -fomit-frame-pointer
29IA32_LD := $(LD) -m elf_i386
30IA32_AS := $(CC) $(AFLAGS) -m32 -Wa,--32 -traditional -c
31IA32_OBJCOPY := $(CROSS_COMPILE)objcopy
32IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E
33export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
34
35
36LDFLAGS := -m elf_x86_64 24LDFLAGS := -m elf_x86_64
37OBJCOPYFLAGS := -O binary -R .note -R .comment -S 25OBJCOPYFLAGS := -O binary -R .note -R .comment -S
38LDFLAGS_vmlinux := 26LDFLAGS_vmlinux :=
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c
index 2b5c4010ce38..acfdaa28791e 100644
--- a/arch/x86_64/crypto/aes.c
+++ b/arch/x86_64/crypto/aes.c
@@ -322,3 +322,4 @@ module_exit(aes_fini);
322 322
323MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); 323MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
324MODULE_LICENSE("GPL"); 324MODULE_LICENSE("GPL");
325MODULE_ALIAS("aes");
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 569595b74c7c..776f3c866b70 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc4 3# Linux kernel version: 2.6.13-rc3
4# Fri May 13 06:39:11 2005 4# Fri Jul 22 16:47:31 2005
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -84,14 +84,27 @@ CONFIG_X86_IO_APIC=y
84CONFIG_X86_LOCAL_APIC=y 84CONFIG_X86_LOCAL_APIC=y
85CONFIG_MTRR=y 85CONFIG_MTRR=y
86CONFIG_SMP=y 86CONFIG_SMP=y
87# CONFIG_PREEMPT is not set
88CONFIG_SCHED_SMT=y 87CONFIG_SCHED_SMT=y
88CONFIG_PREEMPT_NONE=y
89# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set
91CONFIG_PREEMPT_BKL=y
89CONFIG_K8_NUMA=y 92CONFIG_K8_NUMA=y
90# CONFIG_NUMA_EMU is not set 93# CONFIG_NUMA_EMU is not set
91CONFIG_DISCONTIGMEM=y 94CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
92CONFIG_NUMA=y 95CONFIG_NUMA=y
96CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
97CONFIG_ARCH_SPARSEMEM_ENABLE=y
98CONFIG_SELECT_MEMORY_MODEL=y
99# CONFIG_FLATMEM_MANUAL is not set
100CONFIG_DISCONTIGMEM_MANUAL=y
101# CONFIG_SPARSEMEM_MANUAL is not set
102CONFIG_DISCONTIGMEM=y
103CONFIG_FLAT_NODE_MEM_MAP=y
104CONFIG_NEED_MULTIPLE_NODES=y
105CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
93CONFIG_HAVE_DEC_LOCK=y 106CONFIG_HAVE_DEC_LOCK=y
94CONFIG_NR_CPUS=8 107CONFIG_NR_CPUS=32
95CONFIG_HPET_TIMER=y 108CONFIG_HPET_TIMER=y
96CONFIG_X86_PM_TIMER=y 109CONFIG_X86_PM_TIMER=y
97CONFIG_HPET_EMULATE_RTC=y 110CONFIG_HPET_EMULATE_RTC=y
@@ -99,7 +112,13 @@ CONFIG_GART_IOMMU=y
99CONFIG_SWIOTLB=y 112CONFIG_SWIOTLB=y
100CONFIG_X86_MCE=y 113CONFIG_X86_MCE=y
101CONFIG_X86_MCE_INTEL=y 114CONFIG_X86_MCE_INTEL=y
115CONFIG_PHYSICAL_START=0x100000
116# CONFIG_KEXEC is not set
102CONFIG_SECCOMP=y 117CONFIG_SECCOMP=y
118# CONFIG_HZ_100 is not set
119CONFIG_HZ_250=y
120# CONFIG_HZ_1000 is not set
121CONFIG_HZ=250
103CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
104CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
105CONFIG_ISA_DMA_API=y 124CONFIG_ISA_DMA_API=y
@@ -118,12 +137,11 @@ CONFIG_PM_STD_PARTITION=""
118CONFIG_ACPI=y 137CONFIG_ACPI=y
119CONFIG_ACPI_BOOT=y 138CONFIG_ACPI_BOOT=y
120CONFIG_ACPI_INTERPRETER=y 139CONFIG_ACPI_INTERPRETER=y
121CONFIG_ACPI_SLEEP=y
122CONFIG_ACPI_SLEEP_PROC_FS=y
123CONFIG_ACPI_AC=y 140CONFIG_ACPI_AC=y
124CONFIG_ACPI_BATTERY=y 141CONFIG_ACPI_BATTERY=y
125CONFIG_ACPI_BUTTON=y 142CONFIG_ACPI_BUTTON=y
126# CONFIG_ACPI_VIDEO is not set 143# CONFIG_ACPI_VIDEO is not set
144CONFIG_ACPI_HOTKEY=m
127CONFIG_ACPI_FAN=y 145CONFIG_ACPI_FAN=y
128CONFIG_ACPI_PROCESSOR=y 146CONFIG_ACPI_PROCESSOR=y
129CONFIG_ACPI_THERMAL=y 147CONFIG_ACPI_THERMAL=y
@@ -154,6 +172,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
154# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 172# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
155CONFIG_CPU_FREQ_GOV_USERSPACE=y 173CONFIG_CPU_FREQ_GOV_USERSPACE=y
156CONFIG_CPU_FREQ_GOV_ONDEMAND=y 174CONFIG_CPU_FREQ_GOV_ONDEMAND=y
175# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
157 176
158# 177#
159# CPUFreq processor drivers 178# CPUFreq processor drivers
@@ -204,6 +223,76 @@ CONFIG_SYSVIPC_COMPAT=y
204CONFIG_UID16=y 223CONFIG_UID16=y
205 224
206# 225#
226# Networking
227#
228CONFIG_NET=y
229
230#
231# Networking options
232#
233CONFIG_PACKET=y
234# CONFIG_PACKET_MMAP is not set
235CONFIG_UNIX=y
236# CONFIG_NET_KEY is not set
237CONFIG_INET=y
238CONFIG_IP_MULTICAST=y
239# CONFIG_IP_ADVANCED_ROUTER is not set
240CONFIG_IP_FIB_HASH=y
241# CONFIG_IP_PNP is not set
242# CONFIG_NET_IPIP is not set
243# CONFIG_NET_IPGRE is not set
244# CONFIG_IP_MROUTE is not set
245# CONFIG_ARPD is not set
246# CONFIG_SYN_COOKIES is not set
247# CONFIG_INET_AH is not set
248# CONFIG_INET_ESP is not set
249# CONFIG_INET_IPCOMP is not set
250# CONFIG_INET_TUNNEL is not set
251CONFIG_IP_TCPDIAG=y
252CONFIG_IP_TCPDIAG_IPV6=y
253# CONFIG_TCP_CONG_ADVANCED is not set
254CONFIG_TCP_CONG_BIC=y
255CONFIG_IPV6=y
256# CONFIG_IPV6_PRIVACY is not set
257# CONFIG_INET6_AH is not set
258# CONFIG_INET6_ESP is not set
259# CONFIG_INET6_IPCOMP is not set
260# CONFIG_INET6_TUNNEL is not set
261# CONFIG_IPV6_TUNNEL is not set
262# CONFIG_NETFILTER is not set
263
264#
265# SCTP Configuration (EXPERIMENTAL)
266#
267# CONFIG_IP_SCTP is not set
268# CONFIG_ATM is not set
269# CONFIG_BRIDGE is not set
270# CONFIG_VLAN_8021Q is not set
271# CONFIG_DECNET is not set
272# CONFIG_LLC2 is not set
273# CONFIG_IPX is not set
274# CONFIG_ATALK is not set
275# CONFIG_X25 is not set
276# CONFIG_LAPB is not set
277# CONFIG_NET_DIVERT is not set
278# CONFIG_ECONET is not set
279# CONFIG_WAN_ROUTER is not set
280# CONFIG_NET_SCHED is not set
281# CONFIG_NET_CLS_ROUTE is not set
282
283#
284# Network testing
285#
286# CONFIG_NET_PKTGEN is not set
287CONFIG_NETPOLL=y
288# CONFIG_NETPOLL_RX is not set
289# CONFIG_NETPOLL_TRAP is not set
290CONFIG_NET_POLL_CONTROLLER=y
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294
295#
207# Device Drivers 296# Device Drivers
208# 297#
209 298
@@ -308,6 +397,7 @@ CONFIG_BLK_DEV_AMD74XX=y
308# CONFIG_BLK_DEV_HPT366 is not set 397# CONFIG_BLK_DEV_HPT366 is not set
309# CONFIG_BLK_DEV_SC1200 is not set 398# CONFIG_BLK_DEV_SC1200 is not set
310CONFIG_BLK_DEV_PIIX=y 399CONFIG_BLK_DEV_PIIX=y
400# CONFIG_BLK_DEV_IT821X is not set
311# CONFIG_BLK_DEV_NS87415 is not set 401# CONFIG_BLK_DEV_NS87415 is not set
312# CONFIG_BLK_DEV_PDC202XX_OLD is not set 402# CONFIG_BLK_DEV_PDC202XX_OLD is not set
313CONFIG_BLK_DEV_PDC202XX_NEW=y 403CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -338,6 +428,7 @@ CONFIG_BLK_DEV_SD=y
338# CONFIG_CHR_DEV_OSST is not set 428# CONFIG_CHR_DEV_OSST is not set
339# CONFIG_BLK_DEV_SR is not set 429# CONFIG_BLK_DEV_SR is not set
340# CONFIG_CHR_DEV_SG is not set 430# CONFIG_CHR_DEV_SG is not set
431# CONFIG_CHR_DEV_SCH is not set
341 432
342# 433#
343# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 434# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -372,7 +463,6 @@ CONFIG_AIC79XX_DEBUG_MASK=0
372# CONFIG_MEGARAID_NEWGEN is not set 463# CONFIG_MEGARAID_NEWGEN is not set
373# CONFIG_MEGARAID_LEGACY is not set 464# CONFIG_MEGARAID_LEGACY is not set
374CONFIG_SCSI_SATA=y 465CONFIG_SCSI_SATA=y
375# CONFIG_SCSI_SATA_AHCI is not set
376# CONFIG_SCSI_SATA_SVW is not set 466# CONFIG_SCSI_SATA_SVW is not set
377CONFIG_SCSI_ATA_PIIX=y 467CONFIG_SCSI_ATA_PIIX=y
378# CONFIG_SCSI_SATA_NV is not set 468# CONFIG_SCSI_SATA_NV is not set
@@ -410,14 +500,21 @@ CONFIG_SCSI_QLA2XXX=y
410# 500#
411# Multi-device support (RAID and LVM) 501# Multi-device support (RAID and LVM)
412# 502#
413# CONFIG_MD is not set 503CONFIG_MD=y
504# CONFIG_BLK_DEV_MD is not set
505CONFIG_BLK_DEV_DM=y
506# CONFIG_DM_CRYPT is not set
507# CONFIG_DM_SNAPSHOT is not set
508# CONFIG_DM_MIRROR is not set
509# CONFIG_DM_ZERO is not set
510# CONFIG_DM_MULTIPATH is not set
414 511
415# 512#
416# Fusion MPT device support 513# Fusion MPT device support
417# 514#
418CONFIG_FUSION=y 515# CONFIG_FUSION is not set
419CONFIG_FUSION_MAX_SGE=40 516# CONFIG_FUSION_SPI is not set
420# CONFIG_FUSION_CTL is not set 517# CONFIG_FUSION_FC is not set
421 518
422# 519#
423# IEEE 1394 (FireWire) support 520# IEEE 1394 (FireWire) support
@@ -430,75 +527,8 @@ CONFIG_FUSION_MAX_SGE=40
430# CONFIG_I2O is not set 527# CONFIG_I2O is not set
431 528
432# 529#
433# Networking support 530# Network device support
434#
435CONFIG_NET=y
436
437#
438# Networking options
439#
440CONFIG_PACKET=y
441# CONFIG_PACKET_MMAP is not set
442CONFIG_UNIX=y
443# CONFIG_NET_KEY is not set
444CONFIG_INET=y
445CONFIG_IP_MULTICAST=y
446# CONFIG_IP_ADVANCED_ROUTER is not set
447# CONFIG_IP_PNP is not set
448# CONFIG_NET_IPIP is not set
449# CONFIG_NET_IPGRE is not set
450# CONFIG_IP_MROUTE is not set
451# CONFIG_ARPD is not set
452# CONFIG_SYN_COOKIES is not set
453# CONFIG_INET_AH is not set
454# CONFIG_INET_ESP is not set
455# CONFIG_INET_IPCOMP is not set
456# CONFIG_INET_TUNNEL is not set
457CONFIG_IP_TCPDIAG=y
458CONFIG_IP_TCPDIAG_IPV6=y
459CONFIG_IPV6=y
460# CONFIG_IPV6_PRIVACY is not set
461# CONFIG_INET6_AH is not set
462# CONFIG_INET6_ESP is not set
463# CONFIG_INET6_IPCOMP is not set
464# CONFIG_INET6_TUNNEL is not set
465# CONFIG_IPV6_TUNNEL is not set
466# CONFIG_NETFILTER is not set
467
468#
469# SCTP Configuration (EXPERIMENTAL)
470# 531#
471# CONFIG_IP_SCTP is not set
472# CONFIG_ATM is not set
473# CONFIG_BRIDGE is not set
474# CONFIG_VLAN_8021Q is not set
475# CONFIG_DECNET is not set
476# CONFIG_LLC2 is not set
477# CONFIG_IPX is not set
478# CONFIG_ATALK is not set
479# CONFIG_X25 is not set
480# CONFIG_LAPB is not set
481# CONFIG_NET_DIVERT is not set
482# CONFIG_ECONET is not set
483# CONFIG_WAN_ROUTER is not set
484
485#
486# QoS and/or fair queueing
487#
488# CONFIG_NET_SCHED is not set
489# CONFIG_NET_CLS_ROUTE is not set
490
491#
492# Network testing
493#
494# CONFIG_NET_PKTGEN is not set
495CONFIG_NETPOLL=y
496# CONFIG_NETPOLL_RX is not set
497# CONFIG_NETPOLL_TRAP is not set
498CONFIG_NET_POLL_CONTROLLER=y
499# CONFIG_HAMRADIO is not set
500# CONFIG_IRDA is not set
501# CONFIG_BT is not set
502CONFIG_NETDEVICES=y 532CONFIG_NETDEVICES=y
503# CONFIG_DUMMY is not set 533# CONFIG_DUMMY is not set
504# CONFIG_BONDING is not set 534# CONFIG_BONDING is not set
@@ -517,7 +547,9 @@ CONFIG_NET_ETHERNET=y
517CONFIG_MII=y 547CONFIG_MII=y
518# CONFIG_HAPPYMEAL is not set 548# CONFIG_HAPPYMEAL is not set
519# CONFIG_SUNGEM is not set 549# CONFIG_SUNGEM is not set
520# CONFIG_NET_VENDOR_3COM is not set 550CONFIG_NET_VENDOR_3COM=y
551CONFIG_VORTEX=y
552# CONFIG_TYPHOON is not set
521 553
522# 554#
523# Tulip family network device support 555# Tulip family network device support
@@ -532,7 +564,7 @@ CONFIG_NET_PCI=y
532CONFIG_FORCEDETH=y 564CONFIG_FORCEDETH=y
533# CONFIG_DGRS is not set 565# CONFIG_DGRS is not set
534# CONFIG_EEPRO100 is not set 566# CONFIG_EEPRO100 is not set
535# CONFIG_E100 is not set 567CONFIG_E100=y
536# CONFIG_FEALNX is not set 568# CONFIG_FEALNX is not set
537# CONFIG_NATSEMI is not set 569# CONFIG_NATSEMI is not set
538# CONFIG_NE2K_PCI is not set 570# CONFIG_NE2K_PCI is not set
@@ -553,14 +585,15 @@ CONFIG_8139TOO=y
553# CONFIG_ACENIC is not set 585# CONFIG_ACENIC is not set
554# CONFIG_DL2K is not set 586# CONFIG_DL2K is not set
555CONFIG_E1000=y 587CONFIG_E1000=y
556# CONFIG_E1000_NAPI is not set
557# CONFIG_NS83820 is not set 588# CONFIG_NS83820 is not set
558# CONFIG_HAMACHI is not set 589# CONFIG_HAMACHI is not set
559# CONFIG_YELLOWFIN is not set 590# CONFIG_YELLOWFIN is not set
560# CONFIG_R8169 is not set 591# CONFIG_R8169 is not set
592# CONFIG_SKGE is not set
561# CONFIG_SK98LIN is not set 593# CONFIG_SK98LIN is not set
562# CONFIG_VIA_VELOCITY is not set 594# CONFIG_VIA_VELOCITY is not set
563CONFIG_TIGON3=y 595CONFIG_TIGON3=y
596# CONFIG_BNX2 is not set
564 597
565# 598#
566# Ethernet (10000 Mbit) 599# Ethernet (10000 Mbit)
@@ -647,7 +680,6 @@ CONFIG_SERIO_I8042=y
647CONFIG_SERIO_LIBPS2=y 680CONFIG_SERIO_LIBPS2=y
648# CONFIG_SERIO_RAW is not set 681# CONFIG_SERIO_RAW is not set
649# CONFIG_GAMEPORT is not set 682# CONFIG_GAMEPORT is not set
650CONFIG_SOUND_GAMEPORT=y
651 683
652# 684#
653# Character devices 685# Character devices
@@ -716,6 +748,7 @@ CONFIG_MAX_RAW_DEVS=256
716# I2C support 748# I2C support
717# 749#
718# CONFIG_I2C is not set 750# CONFIG_I2C is not set
751# CONFIG_I2C_SENSOR is not set
719 752
720# 753#
721# Dallas's 1-wire bus 754# Dallas's 1-wire bus
@@ -723,6 +756,12 @@ CONFIG_MAX_RAW_DEVS=256
723# CONFIG_W1 is not set 756# CONFIG_W1 is not set
724 757
725# 758#
759# Hardware Monitoring support
760#
761CONFIG_HWMON=y
762# CONFIG_HWMON_DEBUG_CHIP is not set
763
764#
726# Misc devices 765# Misc devices
727# 766#
728# CONFIG_IBM_ASM is not set 767# CONFIG_IBM_ASM is not set
@@ -808,6 +847,7 @@ CONFIG_USB_DEVICEFS=y
808CONFIG_USB_EHCI_HCD=y 847CONFIG_USB_EHCI_HCD=y
809# CONFIG_USB_EHCI_SPLIT_ISO is not set 848# CONFIG_USB_EHCI_SPLIT_ISO is not set
810# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 849# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
850# CONFIG_USB_ISP116X_HCD is not set
811CONFIG_USB_OHCI_HCD=y 851CONFIG_USB_OHCI_HCD=y
812# CONFIG_USB_OHCI_BIG_ENDIAN is not set 852# CONFIG_USB_OHCI_BIG_ENDIAN is not set
813CONFIG_USB_OHCI_LITTLE_ENDIAN=y 853CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -846,12 +886,15 @@ CONFIG_USB_HIDINPUT=y
846# CONFIG_USB_HIDDEV is not set 886# CONFIG_USB_HIDDEV is not set
847# CONFIG_USB_AIPTEK is not set 887# CONFIG_USB_AIPTEK is not set
848# CONFIG_USB_WACOM is not set 888# CONFIG_USB_WACOM is not set
889# CONFIG_USB_ACECAD is not set
849# CONFIG_USB_KBTAB is not set 890# CONFIG_USB_KBTAB is not set
850# CONFIG_USB_POWERMATE is not set 891# CONFIG_USB_POWERMATE is not set
851# CONFIG_USB_MTOUCH is not set 892# CONFIG_USB_MTOUCH is not set
893# CONFIG_USB_ITMTOUCH is not set
852# CONFIG_USB_EGALAX is not set 894# CONFIG_USB_EGALAX is not set
853# CONFIG_USB_XPAD is not set 895# CONFIG_USB_XPAD is not set
854# CONFIG_USB_ATI_REMOTE is not set 896# CONFIG_USB_ATI_REMOTE is not set
897# CONFIG_USB_KEYSPAN_REMOTE is not set
855 898
856# 899#
857# USB Imaging devices 900# USB Imaging devices
@@ -902,10 +945,11 @@ CONFIG_USB_MON=y
902# CONFIG_USB_PHIDGETSERVO is not set 945# CONFIG_USB_PHIDGETSERVO is not set
903# CONFIG_USB_IDMOUSE is not set 946# CONFIG_USB_IDMOUSE is not set
904# CONFIG_USB_SISUSBVGA is not set 947# CONFIG_USB_SISUSBVGA is not set
948# CONFIG_USB_LD is not set
905# CONFIG_USB_TEST is not set 949# CONFIG_USB_TEST is not set
906 950
907# 951#
908# USB ATM/DSL drivers 952# USB DSL modem support
909# 953#
910 954
911# 955#
@@ -924,6 +968,10 @@ CONFIG_USB_MON=y
924# CONFIG_INFINIBAND is not set 968# CONFIG_INFINIBAND is not set
925 969
926# 970#
971# SN Devices
972#
973
974#
927# Firmware Drivers 975# Firmware Drivers
928# 976#
929# CONFIG_EDD is not set 977# CONFIG_EDD is not set
@@ -935,6 +983,7 @@ CONFIG_EXT2_FS=y
935CONFIG_EXT2_FS_XATTR=y 983CONFIG_EXT2_FS_XATTR=y
936CONFIG_EXT2_FS_POSIX_ACL=y 984CONFIG_EXT2_FS_POSIX_ACL=y
937# CONFIG_EXT2_FS_SECURITY is not set 985# CONFIG_EXT2_FS_SECURITY is not set
986# CONFIG_EXT2_FS_XIP is not set
938CONFIG_EXT3_FS=y 987CONFIG_EXT3_FS=y
939CONFIG_EXT3_FS_XATTR=y 988CONFIG_EXT3_FS_XATTR=y
940CONFIG_EXT3_FS_POSIX_ACL=y 989CONFIG_EXT3_FS_POSIX_ACL=y
@@ -957,6 +1006,7 @@ CONFIG_FS_POSIX_ACL=y
957# CONFIG_XFS_FS is not set 1006# CONFIG_XFS_FS is not set
958# CONFIG_MINIX_FS is not set 1007# CONFIG_MINIX_FS is not set
959# CONFIG_ROMFS_FS is not set 1008# CONFIG_ROMFS_FS is not set
1009CONFIG_INOTIFY=y
960# CONFIG_QUOTA is not set 1010# CONFIG_QUOTA is not set
961CONFIG_DNOTIFY=y 1011CONFIG_DNOTIFY=y
962CONFIG_AUTOFS_FS=y 1012CONFIG_AUTOFS_FS=y
@@ -986,7 +1036,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
986CONFIG_PROC_FS=y 1036CONFIG_PROC_FS=y
987CONFIG_PROC_KCORE=y 1037CONFIG_PROC_KCORE=y
988CONFIG_SYSFS=y 1038CONFIG_SYSFS=y
989# CONFIG_DEVFS_FS is not set
990# CONFIG_DEVPTS_FS_XATTR is not set 1039# CONFIG_DEVPTS_FS_XATTR is not set
991CONFIG_TMPFS=y 1040CONFIG_TMPFS=y
992# CONFIG_TMPFS_XATTR is not set 1041# CONFIG_TMPFS_XATTR is not set
@@ -1016,15 +1065,18 @@ CONFIG_RAMFS=y
1016# 1065#
1017CONFIG_NFS_FS=y 1066CONFIG_NFS_FS=y
1018CONFIG_NFS_V3=y 1067CONFIG_NFS_V3=y
1068# CONFIG_NFS_V3_ACL is not set
1019# CONFIG_NFS_V4 is not set 1069# CONFIG_NFS_V4 is not set
1020# CONFIG_NFS_DIRECTIO is not set 1070# CONFIG_NFS_DIRECTIO is not set
1021CONFIG_NFSD=y 1071CONFIG_NFSD=y
1022CONFIG_NFSD_V3=y 1072CONFIG_NFSD_V3=y
1073# CONFIG_NFSD_V3_ACL is not set
1023# CONFIG_NFSD_V4 is not set 1074# CONFIG_NFSD_V4 is not set
1024CONFIG_NFSD_TCP=y 1075CONFIG_NFSD_TCP=y
1025CONFIG_LOCKD=y 1076CONFIG_LOCKD=y
1026CONFIG_LOCKD_V4=y 1077CONFIG_LOCKD_V4=y
1027CONFIG_EXPORTFS=y 1078CONFIG_EXPORTFS=y
1079CONFIG_NFS_COMMON=y
1028CONFIG_SUNRPC=y 1080CONFIG_SUNRPC=y
1029# CONFIG_RPCSEC_GSS_KRB5 is not set 1081# CONFIG_RPCSEC_GSS_KRB5 is not set
1030# CONFIG_RPCSEC_GSS_SPKM3 is not set 1082# CONFIG_RPCSEC_GSS_SPKM3 is not set
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
index a12b19da4b59..f76217d8f579 100644
--- a/arch/x86_64/ia32/Makefile
+++ b/arch/x86_64/ia32/Makefile
@@ -4,14 +4,14 @@
4 4
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \
6 ia32_signal.o tls32.o \ 6 ia32_signal.o tls32.o \
7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o 7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o
8 8
9sysv-$(CONFIG_SYSVIPC) := ipc32.o 9sysv-$(CONFIG_SYSVIPC) := ipc32.o
10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) 10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
11 11
12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
13 13
14$(obj)/syscall32.o: $(src)/syscall32.c \ 14$(obj)/syscall32_syscall.o: \
15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) 15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so)
16 16
17# Teach kbuild about targets 17# Teach kbuild about targets
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
index c12edf5d97f0..3e6780fa0186 100644
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -42,7 +42,7 @@ extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
43static int load_aout_library(struct file*); 43static int load_aout_library(struct file*);
44 44
45#if CORE_DUMP 45#ifdef CORE_DUMP
46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
47 47
48/* 48/*
@@ -103,7 +103,7 @@ static struct linux_binfmt aout_format = {
103 .module = THIS_MODULE, 103 .module = THIS_MODULE,
104 .load_binary = load_aout_binary, 104 .load_binary = load_aout_binary,
105 .load_shlib = load_aout_library, 105 .load_shlib = load_aout_library,
106#if CORE_DUMP 106#ifdef CORE_DUMP
107 .core_dump = aout_core_dump, 107 .core_dump = aout_core_dump,
108#endif 108#endif
109 .min_coredump = PAGE_SIZE 109 .min_coredump = PAGE_SIZE
@@ -120,7 +120,7 @@ static void set_brk(unsigned long start, unsigned long end)
120 up_write(&current->mm->mmap_sem); 120 up_write(&current->mm->mmap_sem);
121} 121}
122 122
123#if CORE_DUMP 123#ifdef CORE_DUMP
124/* 124/*
125 * These are the only things you should do on a core-file: use only these 125 * These are the only things you should do on a core-file: use only these
126 * macros to write out all the necessary info. 126 * macros to write out all the necessary info.
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index b98b6d2462f6..2a925e2af390 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -43,11 +43,11 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
43 switch (regno) { 43 switch (regno) {
44 case offsetof(struct user32, regs.fs): 44 case offsetof(struct user32, regs.fs):
45 if (val && (val & 3) != 3) return -EIO; 45 if (val && (val & 3) != 3) return -EIO;
46 child->thread.fs = val & 0xffff; 46 child->thread.fsindex = val & 0xffff;
47 break; 47 break;
48 case offsetof(struct user32, regs.gs): 48 case offsetof(struct user32, regs.gs):
49 if (val && (val & 3) != 3) return -EIO; 49 if (val && (val & 3) != 3) return -EIO;
50 child->thread.gs = val & 0xffff; 50 child->thread.gsindex = val & 0xffff;
51 break; 51 break;
52 case offsetof(struct user32, regs.ds): 52 case offsetof(struct user32, regs.ds):
53 if (val && (val & 3) != 3) return -EIO; 53 if (val && (val & 3) != 3) return -EIO;
@@ -138,10 +138,10 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
138 138
139 switch (regno) { 139 switch (regno) {
140 case offsetof(struct user32, regs.fs): 140 case offsetof(struct user32, regs.fs):
141 *val = child->thread.fs; 141 *val = child->thread.fsindex;
142 break; 142 break;
143 case offsetof(struct user32, regs.gs): 143 case offsetof(struct user32, regs.gs):
144 *val = child->thread.gs; 144 *val = child->thread.gsindex;
145 break; 145 break;
146 case offsetof(struct user32, regs.ds): 146 case offsetof(struct user32, regs.ds):
147 *val = child->thread.ds; 147 *val = child->thread.ds;
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index 816a3b89f13d..adbc5f8089e9 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -14,16 +14,6 @@
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/ia32_unistd.h> 15#include <asm/ia32_unistd.h>
16 16
17/* 32bit VDSOs mapped into user space. */
18asm(".section \".init.data\",\"aw\"\n"
19 "syscall32_syscall:\n"
20 ".incbin \"arch/x86_64/ia32/vsyscall-syscall.so\"\n"
21 "syscall32_syscall_end:\n"
22 "syscall32_sysenter:\n"
23 ".incbin \"arch/x86_64/ia32/vsyscall-sysenter.so\"\n"
24 "syscall32_sysenter_end:\n"
25 ".previous");
26
27extern unsigned char syscall32_syscall[], syscall32_syscall_end[]; 17extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
28extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; 18extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
29extern int sysctl_vsyscall32; 19extern int sysctl_vsyscall32;
diff --git a/arch/x86_64/ia32/syscall32_syscall.S b/arch/x86_64/ia32/syscall32_syscall.S
new file mode 100644
index 000000000000..8f8271bdf135
--- /dev/null
+++ b/arch/x86_64/ia32/syscall32_syscall.S
@@ -0,0 +1,17 @@
1/* 32bit VDSOs mapped into user space. */
2
3 .section ".init.data","aw"
4
5 .globl syscall32_syscall
6 .globl syscall32_syscall_end
7
8syscall32_syscall:
9 .incbin "arch/x86_64/ia32/vsyscall-syscall.so"
10syscall32_syscall_end:
11
12 .globl syscall32_sysenter
13 .globl syscall32_sysenter_end
14
15syscall32_sysenter:
16 .incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
17syscall32_sysenter_end:
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 28817490fdc6..096d470e280f 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -76,7 +76,7 @@
76 76
77 .macro FAKE_STACK_FRAME child_rip 77 .macro FAKE_STACK_FRAME child_rip
78 /* push in order ss, rsp, eflags, cs, rip */ 78 /* push in order ss, rsp, eflags, cs, rip */
79 xorq %rax, %rax 79 xorl %eax, %eax
80 pushq %rax /* ss */ 80 pushq %rax /* ss */
81 CFI_ADJUST_CFA_OFFSET 8 81 CFI_ADJUST_CFA_OFFSET 8
82 pushq %rax /* rsp */ 82 pushq %rax /* rsp */
@@ -423,7 +423,7 @@ ENTRY(stub_rt_sigreturn)
423 testl $3,CS(%rdi) 423 testl $3,CS(%rdi)
424 je 1f 424 je 1f
425 swapgs 425 swapgs
4261: addl $1,%gs:pda_irqcount # RED-PEN should check preempt count 4261: incl %gs:pda_irqcount # RED-PEN should check preempt count
427 movq %gs:pda_irqstackptr,%rax 427 movq %gs:pda_irqstackptr,%rax
428 cmoveq %rax,%rsp 428 cmoveq %rax,%rsp
429 pushq %rdi # save old stack 429 pushq %rdi # save old stack
@@ -436,7 +436,7 @@ ENTRY(common_interrupt)
436ret_from_intr: 436ret_from_intr:
437 popq %rdi 437 popq %rdi
438 cli 438 cli
439 subl $1,%gs:pda_irqcount 439 decl %gs:pda_irqcount
440#ifdef CONFIG_DEBUG_INFO 440#ifdef CONFIG_DEBUG_INFO
441 movq RBP(%rdi),%rbp 441 movq RBP(%rdi),%rbp
442#endif 442#endif
@@ -494,7 +494,7 @@ retint_signal:
494 sti 494 sti
495 SAVE_REST 495 SAVE_REST
496 movq $-1,ORIG_RAX(%rsp) 496 movq $-1,ORIG_RAX(%rsp)
497 xorq %rsi,%rsi # oldset 497 xorl %esi,%esi # oldset
498 movq %rsp,%rdi # &pt_regs 498 movq %rsp,%rdi # &pt_regs
499 call do_notify_resume 499 call do_notify_resume
500 RESTORE_REST 500 RESTORE_REST
@@ -752,7 +752,7 @@ child_rip:
752 movq %rsi, %rdi 752 movq %rsi, %rdi
753 call *%rax 753 call *%rax
754 # exit 754 # exit
755 xorq %rdi, %rdi 755 xorl %edi, %edi
756 call do_exit 756 call do_exit
757 757
758/* 758/*
@@ -918,3 +918,15 @@ ENTRY(machine_check)
918ENTRY(call_debug) 918ENTRY(call_debug)
919 zeroentry do_call_debug 919 zeroentry do_call_debug
920 920
921ENTRY(call_softirq)
922 movq %gs:pda_irqstackptr,%rax
923 pushq %r15
924 movq %rsp,%r15
925 incl %gs:pda_irqcount
926 cmove %rax,%rsp
927 call __do_softirq
928 movq %r15,%rsp
929 decl %gs:pda_irqcount
930 popq %r15
931 ret
932
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index 69b9c25a8fc4..30c843a5efdd 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -31,6 +31,7 @@ u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
31 31
32extern struct genapic apic_cluster; 32extern struct genapic apic_cluster;
33extern struct genapic apic_flat; 33extern struct genapic apic_flat;
34extern struct genapic apic_physflat;
34 35
35struct genapic *genapic = &apic_flat; 36struct genapic *genapic = &apic_flat;
36 37
@@ -44,12 +45,7 @@ void __init clustered_apic_check(void)
44 u8 clusters, max_cluster; 45 u8 clusters, max_cluster;
45 u8 id; 46 u8 id;
46 u8 cluster_cnt[NUM_APIC_CLUSTERS]; 47 u8 cluster_cnt[NUM_APIC_CLUSTERS];
47 48 int num_cpus = 0;
48 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
49 /* AMD always uses flat mode right now */
50 genapic = &apic_flat;
51 goto print;
52 }
53 49
54#if defined(CONFIG_ACPI_BUS) 50#if defined(CONFIG_ACPI_BUS)
55 /* 51 /*
@@ -64,15 +60,34 @@ void __init clustered_apic_check(void)
64#endif 60#endif
65 61
66 memset(cluster_cnt, 0, sizeof(cluster_cnt)); 62 memset(cluster_cnt, 0, sizeof(cluster_cnt));
67
68 for (i = 0; i < NR_CPUS; i++) { 63 for (i = 0; i < NR_CPUS; i++) {
69 id = bios_cpu_apicid[i]; 64 id = bios_cpu_apicid[i];
70 if (id != BAD_APICID) 65 if (id == BAD_APICID)
71 cluster_cnt[APIC_CLUSTERID(id)]++; 66 continue;
67 num_cpus++;
68 cluster_cnt[APIC_CLUSTERID(id)]++;
72 } 69 }
73 70
71 /* Don't use clustered mode on AMD platforms. */
72 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
73 genapic = &apic_physflat;
74#ifndef CONFIG_CPU_HOTPLUG
75 /* In the CPU hotplug case we cannot use broadcast mode
76 because that opens a race when a CPU is removed.
77 Stay at physflat mode in this case.
78 It is bad to do this unconditionally though. Once
79 we have ACPI platform support for CPU hotplug
80 we should detect hotplug capablity from ACPI tables and
81 only do this when really needed. -AK */
82 if (num_cpus <= 8)
83 genapic = &apic_flat;
84#endif
85 goto print;
86 }
87
74 clusters = 0; 88 clusters = 0;
75 max_cluster = 0; 89 max_cluster = 0;
90
76 for (i = 0; i < NUM_APIC_CLUSTERS; i++) { 91 for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
77 if (cluster_cnt[i] > 0) { 92 if (cluster_cnt[i] > 0) {
78 ++clusters; 93 ++clusters;
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c
index 282846965080..adc96282a9e2 100644
--- a/arch/x86_64/kernel/genapic_flat.c
+++ b/arch/x86_64/kernel/genapic_flat.c
@@ -2,13 +2,11 @@
2 * Copyright 2004 James Cleverdon, IBM. 2 * Copyright 2004 James Cleverdon, IBM.
3 * Subject to the GNU Public License, v.2 3 * Subject to the GNU Public License, v.2
4 * 4 *
5 * Flat APIC subarch code. Maximum 8 CPUs, logical delivery. 5 * Flat APIC subarch code.
6 * 6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by 7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and 8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon. 9 * James Cleverdon.
10 * Ashok Raj <ashok.raj@intel.com>
11 * Removed IPI broadcast shortcut to support CPU hotplug
12 */ 10 */
13#include <linux/config.h> 11#include <linux/config.h>
14#include <linux/threads.h> 12#include <linux/threads.h>
@@ -20,47 +18,6 @@
20#include <asm/smp.h> 18#include <asm/smp.h>
21#include <asm/ipi.h> 19#include <asm/ipi.h>
22 20
23/*
24 * The following permit choosing broadcast IPI shortcut v.s sending IPI only
25 * to online cpus via the send_IPI_mask varient.
26 * The mask version is my preferred option, since it eliminates a lot of
27 * other extra code that would need to be written to cleanup intrs sent
28 * to a CPU while offline.
29 *
30 * Sending broadcast introduces lots of trouble in CPU hotplug situations.
31 * These IPI's are delivered to cpu's irrespective of their offline status
32 * and could pickup stale intr data when these CPUS are turned online.
33 *
34 * Not using broadcast is a cleaner approach IMO, but Andi Kleen disagrees with
35 * the idea of not using broadcast IPI's anymore. Hence the run time check
36 * is introduced, on his request so we can choose an alternate mechanism.
37 *
38 * Initial wacky performance tests that collect cycle counts show
39 * no increase in using mask v.s broadcast version. In fact they seem
40 * identical in terms of cycle counts.
41 *
42 * if we need to use broadcast, we need to do the following.
43 *
44 * cli;
45 * hold call_lock;
46 * clear any pending IPI, just ack and clear all pending intr
47 * set cpu_online_map;
48 * release call_lock;
49 * sti;
50 *
51 * The complicated dummy irq processing shown above is not required if
52 * we didnt sent IPI's to wrong CPU's in the first place.
53 *
54 * - Ashok Raj <ashok.raj@intel.com>
55 */
56#ifdef CONFIG_HOTPLUG_CPU
57#define DEFAULT_SEND_IPI (1)
58#else
59#define DEFAULT_SEND_IPI (0)
60#endif
61
62static int no_broadcast=DEFAULT_SEND_IPI;
63
64static cpumask_t flat_target_cpus(void) 21static cpumask_t flat_target_cpus(void)
65{ 22{
66 return cpu_online_map; 23 return cpu_online_map;
@@ -119,37 +76,15 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
119 local_irq_restore(flags); 76 local_irq_restore(flags);
120} 77}
121 78
122static inline void __local_flat_send_IPI_allbutself(int vector)
123{
124 if (no_broadcast) {
125 cpumask_t mask = cpu_online_map;
126 int this_cpu = get_cpu();
127
128 cpu_clear(this_cpu, mask);
129 flat_send_IPI_mask(mask, vector);
130 put_cpu();
131 }
132 else
133 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
134}
135
136static inline void __local_flat_send_IPI_all(int vector)
137{
138 if (no_broadcast)
139 flat_send_IPI_mask(cpu_online_map, vector);
140 else
141 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
142}
143
144static void flat_send_IPI_allbutself(int vector) 79static void flat_send_IPI_allbutself(int vector)
145{ 80{
146 if (((num_online_cpus()) - 1) >= 1) 81 if (((num_online_cpus()) - 1) >= 1)
147 __local_flat_send_IPI_allbutself(vector); 82 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
148} 83}
149 84
150static void flat_send_IPI_all(int vector) 85static void flat_send_IPI_all(int vector)
151{ 86{
152 __local_flat_send_IPI_all(vector); 87 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
153} 88}
154 89
155static int flat_apic_id_registered(void) 90static int flat_apic_id_registered(void)
@@ -170,16 +105,6 @@ static unsigned int phys_pkg_id(int index_msb)
170 return ((ebx >> 24) & 0xFF) >> index_msb; 105 return ((ebx >> 24) & 0xFF) >> index_msb;
171} 106}
172 107
173static __init int no_ipi_broadcast(char *str)
174{
175 get_option(&str, &no_broadcast);
176 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
177 "IPI Broadcast");
178 return 1;
179}
180
181__setup("no_ipi_broadcast", no_ipi_broadcast);
182
183struct genapic apic_flat = { 108struct genapic apic_flat = {
184 .name = "flat", 109 .name = "flat",
185 .int_delivery_mode = dest_LowestPrio, 110 .int_delivery_mode = dest_LowestPrio,
@@ -195,11 +120,62 @@ struct genapic apic_flat = {
195 .phys_pkg_id = phys_pkg_id, 120 .phys_pkg_id = phys_pkg_id,
196}; 121};
197 122
198static int __init print_ipi_mode(void) 123/*
124 * Physflat mode is used when there are more than 8 CPUs on a AMD system.
125 * We cannot use logical delivery in this case because the mask
126 * overflows, so use physical mode.
127 */
128
129static cpumask_t physflat_target_cpus(void)
130{
131 return cpumask_of_cpu(0);
132}
133
134static void physflat_send_IPI_mask(cpumask_t cpumask, int vector)
135{
136 send_IPI_mask_sequence(cpumask, vector);
137}
138
139static void physflat_send_IPI_allbutself(int vector)
140{
141 cpumask_t allbutme = cpu_online_map;
142 int me = get_cpu();
143 cpu_clear(me, allbutme);
144 physflat_send_IPI_mask(allbutme, vector);
145 put_cpu();
146}
147
148static void physflat_send_IPI_all(int vector)
199{ 149{
200 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : 150 physflat_send_IPI_mask(cpu_online_map, vector);
201 "Shortcut");
202 return 0;
203} 151}
204 152
205late_initcall(print_ipi_mode); 153static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
154{
155 int cpu;
156
157 /*
158 * We're using fixed IRQ delivery, can only return one phys APIC ID.
159 * May as well be the first.
160 */
161 cpu = first_cpu(cpumask);
162 if ((unsigned)cpu < NR_CPUS)
163 return x86_cpu_to_apicid[cpu];
164 else
165 return BAD_APICID;
166}
167
168struct genapic apic_physflat = {
169 .name = "physical flat",
170 .int_delivery_mode = dest_LowestPrio,
171 .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
172 .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST,
173 .target_cpus = physflat_target_cpus,
174 .apic_id_registered = flat_apic_id_registered,
175 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
176 .send_IPI_all = physflat_send_IPI_all,
177 .send_IPI_allbutself = physflat_send_IPI_allbutself,
178 .send_IPI_mask = physflat_send_IPI_mask,
179 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
180 .phys_pkg_id = phys_pkg_id,
181};
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 8d765aa77a26..98ff5eb32b9a 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -137,14 +137,14 @@ startup_64:
137 wrmsr 137 wrmsr
138 138
139 /* Setup cr0 */ 139 /* Setup cr0 */
140 xorq %rax, %rax 140#define CR0_PM 1 /* protected mode */
141 btsq $31, %rax /* Enable paging */ 141#define CR0_MP (1<<1)
142 btsq $0, %rax /* Enable protected mode */ 142#define CR0_ET (1<<4)
143 btsq $1, %rax /* Enable MP */ 143#define CR0_NE (1<<5)
144 btsq $4, %rax /* Enable ET */ 144#define CR0_WP (1<<16)
145 btsq $5, %rax /* Enable NE */ 145#define CR0_AM (1<<18)
146 btsq $16, %rax /* Enable WP */ 146#define CR0_PAGING (1<<31)
147 btsq $18, %rax /* Enable AM */ 147 movl $CR0_PM|CR0_MP|CR0_ET|CR0_NE|CR0_WP|CR0_AM|CR0_PAGING,%eax
148 /* Make changes effective */ 148 /* Make changes effective */
149 movq %rax, %cr0 149 movq %rax, %cr0
150 150
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index cc3fb85f5145..849a20aec7ca 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -135,3 +135,22 @@ void fixup_irqs(cpumask_t map)
135 local_irq_disable(); 135 local_irq_disable();
136} 136}
137#endif 137#endif
138
139extern void call_softirq(void);
140
141asmlinkage void do_softirq(void)
142{
143 __u32 pending;
144 unsigned long flags;
145
146 if (in_interrupt())
147 return;
148
149 local_irq_save(flags);
150 pending = local_softirq_pending();
151 /* Switch to interrupt stack */
152 if (pending)
153 call_softirq();
154 local_irq_restore(flags);
155}
156EXPORT_SYMBOL(do_softirq);
diff --git a/arch/x86_64/kernel/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c
index 60d1eff41567..89fab51e20f4 100644
--- a/arch/x86_64/kernel/machine_kexec.c
+++ b/arch/x86_64/kernel/machine_kexec.c
@@ -8,43 +8,26 @@
8 8
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/delay.h>
12#include <linux/string.h> 11#include <linux/string.h>
13#include <linux/reboot.h> 12#include <linux/reboot.h>
14#include <asm/pda.h>
15#include <asm/pgtable.h> 13#include <asm/pgtable.h>
16#include <asm/pgalloc.h>
17#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
18#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
19#include <asm/io.h> 16#include <asm/io.h>
20#include <asm/apic.h> 17
21#include <asm/cpufeature.h> 18static void init_level2_page(pmd_t *level2p, unsigned long addr)
22#include <asm/hw_irq.h>
23
24#define LEVEL0_SIZE (1UL << 12UL)
25#define LEVEL1_SIZE (1UL << 21UL)
26#define LEVEL2_SIZE (1UL << 30UL)
27#define LEVEL3_SIZE (1UL << 39UL)
28#define LEVEL4_SIZE (1UL << 48UL)
29
30#define L0_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
31#define L1_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE)
32#define L2_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
33#define L3_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
34
35static void init_level2_page(u64 *level2p, unsigned long addr)
36{ 19{
37 unsigned long end_addr; 20 unsigned long end_addr;
38 21
39 addr &= PAGE_MASK; 22 addr &= PAGE_MASK;
40 end_addr = addr + LEVEL2_SIZE; 23 end_addr = addr + PUD_SIZE;
41 while (addr < end_addr) { 24 while (addr < end_addr) {
42 *(level2p++) = addr | L1_ATTR; 25 set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
43 addr += LEVEL1_SIZE; 26 addr += PMD_SIZE;
44 } 27 }
45} 28}
46 29
47static int init_level3_page(struct kimage *image, u64 *level3p, 30static int init_level3_page(struct kimage *image, pud_t *level3p,
48 unsigned long addr, unsigned long last_addr) 31 unsigned long addr, unsigned long last_addr)
49{ 32{
50 unsigned long end_addr; 33 unsigned long end_addr;
@@ -52,32 +35,32 @@ static int init_level3_page(struct kimage *image, u64 *level3p,
52 35
53 result = 0; 36 result = 0;
54 addr &= PAGE_MASK; 37 addr &= PAGE_MASK;
55 end_addr = addr + LEVEL3_SIZE; 38 end_addr = addr + PGDIR_SIZE;
56 while ((addr < last_addr) && (addr < end_addr)) { 39 while ((addr < last_addr) && (addr < end_addr)) {
57 struct page *page; 40 struct page *page;
58 u64 *level2p; 41 pmd_t *level2p;
59 42
60 page = kimage_alloc_control_pages(image, 0); 43 page = kimage_alloc_control_pages(image, 0);
61 if (!page) { 44 if (!page) {
62 result = -ENOMEM; 45 result = -ENOMEM;
63 goto out; 46 goto out;
64 } 47 }
65 level2p = (u64 *)page_address(page); 48 level2p = (pmd_t *)page_address(page);
66 init_level2_page(level2p, addr); 49 init_level2_page(level2p, addr);
67 *(level3p++) = __pa(level2p) | L2_ATTR; 50 set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE));
68 addr += LEVEL2_SIZE; 51 addr += PUD_SIZE;
69 } 52 }
70 /* clear the unused entries */ 53 /* clear the unused entries */
71 while (addr < end_addr) { 54 while (addr < end_addr) {
72 *(level3p++) = 0; 55 pud_clear(level3p++);
73 addr += LEVEL2_SIZE; 56 addr += PUD_SIZE;
74 } 57 }
75out: 58out:
76 return result; 59 return result;
77} 60}
78 61
79 62
80static int init_level4_page(struct kimage *image, u64 *level4p, 63static int init_level4_page(struct kimage *image, pgd_t *level4p,
81 unsigned long addr, unsigned long last_addr) 64 unsigned long addr, unsigned long last_addr)
82{ 65{
83 unsigned long end_addr; 66 unsigned long end_addr;
@@ -85,28 +68,28 @@ static int init_level4_page(struct kimage *image, u64 *level4p,
85 68
86 result = 0; 69 result = 0;
87 addr &= PAGE_MASK; 70 addr &= PAGE_MASK;
88 end_addr = addr + LEVEL4_SIZE; 71 end_addr = addr + (PTRS_PER_PGD * PGDIR_SIZE);
89 while ((addr < last_addr) && (addr < end_addr)) { 72 while ((addr < last_addr) && (addr < end_addr)) {
90 struct page *page; 73 struct page *page;
91 u64 *level3p; 74 pud_t *level3p;
92 75
93 page = kimage_alloc_control_pages(image, 0); 76 page = kimage_alloc_control_pages(image, 0);
94 if (!page) { 77 if (!page) {
95 result = -ENOMEM; 78 result = -ENOMEM;
96 goto out; 79 goto out;
97 } 80 }
98 level3p = (u64 *)page_address(page); 81 level3p = (pud_t *)page_address(page);
99 result = init_level3_page(image, level3p, addr, last_addr); 82 result = init_level3_page(image, level3p, addr, last_addr);
100 if (result) { 83 if (result) {
101 goto out; 84 goto out;
102 } 85 }
103 *(level4p++) = __pa(level3p) | L3_ATTR; 86 set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
104 addr += LEVEL3_SIZE; 87 addr += PGDIR_SIZE;
105 } 88 }
106 /* clear the unused entries */ 89 /* clear the unused entries */
107 while (addr < end_addr) { 90 while (addr < end_addr) {
108 *(level4p++) = 0; 91 pgd_clear(level4p++);
109 addr += LEVEL3_SIZE; 92 addr += PGDIR_SIZE;
110 } 93 }
111out: 94out:
112 return result; 95 return result;
@@ -115,52 +98,50 @@ out:
115 98
116static int init_pgtable(struct kimage *image, unsigned long start_pgtable) 99static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
117{ 100{
118 u64 *level4p; 101 pgd_t *level4p;
119 level4p = (u64 *)__va(start_pgtable); 102 level4p = (pgd_t *)__va(start_pgtable);
120 return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); 103 return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT);
121} 104}
122 105
123static void set_idt(void *newidt, u16 limit) 106static void set_idt(void *newidt, u16 limit)
124{ 107{
125 unsigned char curidt[10]; 108 struct desc_ptr curidt;
126 109
127 /* x86-64 supports unaliged loads & stores */ 110 /* x86-64 supports unaliged loads & stores */
128 (*(u16 *)(curidt)) = limit; 111 curidt.size = limit;
129 (*(u64 *)(curidt +2)) = (unsigned long)(newidt); 112 curidt.address = (unsigned long)newidt;
130 113
131 __asm__ __volatile__ ( 114 __asm__ __volatile__ (
132 "lidt %0\n" 115 "lidtq %0\n"
133 : "=m" (curidt) 116 : : "m" (curidt)
134 ); 117 );
135}; 118};
136 119
137 120
138static void set_gdt(void *newgdt, u16 limit) 121static void set_gdt(void *newgdt, u16 limit)
139{ 122{
140 unsigned char curgdt[10]; 123 struct desc_ptr curgdt;
141 124
142 /* x86-64 supports unaligned loads & stores */ 125 /* x86-64 supports unaligned loads & stores */
143 (*(u16 *)(curgdt)) = limit; 126 curgdt.size = limit;
144 (*(u64 *)(curgdt +2)) = (unsigned long)(newgdt); 127 curgdt.address = (unsigned long)newgdt;
145 128
146 __asm__ __volatile__ ( 129 __asm__ __volatile__ (
147 "lgdt %0\n" 130 "lgdtq %0\n"
148 : "=m" (curgdt) 131 : : "m" (curgdt)
149 ); 132 );
150}; 133};
151 134
152static void load_segments(void) 135static void load_segments(void)
153{ 136{
154 __asm__ __volatile__ ( 137 __asm__ __volatile__ (
155 "\tmovl $"STR(__KERNEL_DS)",%eax\n" 138 "\tmovl %0,%%ds\n"
156 "\tmovl %eax,%ds\n" 139 "\tmovl %0,%%es\n"
157 "\tmovl %eax,%es\n" 140 "\tmovl %0,%%ss\n"
158 "\tmovl %eax,%ss\n" 141 "\tmovl %0,%%fs\n"
159 "\tmovl %eax,%fs\n" 142 "\tmovl %0,%%gs\n"
160 "\tmovl %eax,%gs\n" 143 : : "a" (__KERNEL_DS)
161 ); 144 );
162#undef STR
163#undef __STR
164} 145}
165 146
166typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page, 147typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page,
@@ -178,7 +159,7 @@ int machine_kexec_prepare(struct kimage *image)
178 159
179 /* Calculate the offsets */ 160 /* Calculate the offsets */
180 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 161 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
181 control_code_buffer = start_pgtable + 4096UL; 162 control_code_buffer = start_pgtable + PAGE_SIZE;
182 163
183 /* Setup the identity mapped 64bit page table */ 164 /* Setup the identity mapped 64bit page table */
184 result = init_pgtable(image, start_pgtable); 165 result = init_pgtable(image, start_pgtable);
@@ -214,7 +195,7 @@ NORET_TYPE void machine_kexec(struct kimage *image)
214 /* Calculate the offsets */ 195 /* Calculate the offsets */
215 page_list = image->head; 196 page_list = image->head;
216 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 197 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
217 control_code_buffer = start_pgtable + 4096UL; 198 control_code_buffer = start_pgtable + PAGE_SIZE;
218 199
219 /* Set the low half of the page table to my identity mapped 200 /* Set the low half of the page table to my identity mapped
220 * page table for kexec. Leave the high half pointing at the 201 * page table for kexec. Leave the high half pointing at the
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 21e70625a495..8aa56736cde3 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -15,6 +15,8 @@
15#include <linux/sysdev.h> 15#include <linux/sysdev.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/cpu.h>
19#include <linux/percpu.h>
18#include <asm/processor.h> 20#include <asm/processor.h>
19#include <asm/msr.h> 21#include <asm/msr.h>
20#include <asm/mce.h> 22#include <asm/mce.h>
@@ -34,6 +36,7 @@ static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
34static unsigned long console_logged; 36static unsigned long console_logged;
35static int notify_user; 37static int notify_user;
36static int rip_msr; 38static int rip_msr;
39static int mce_bootlog;
37 40
38/* 41/*
39 * Lockless MCE logging infrastructure. 42 * Lockless MCE logging infrastructure.
@@ -195,10 +198,11 @@ void do_machine_check(struct pt_regs * regs, long error_code)
195 rdmsrl(MSR_IA32_MC0_ADDR + i*4, m.addr); 198 rdmsrl(MSR_IA32_MC0_ADDR + i*4, m.addr);
196 199
197 mce_get_rip(&m, regs); 200 mce_get_rip(&m, regs);
198 if (error_code != -1) 201 if (error_code >= 0)
199 rdtscll(m.tsc); 202 rdtscll(m.tsc);
200 wrmsrl(MSR_IA32_MC0_STATUS + i*4, 0); 203 wrmsrl(MSR_IA32_MC0_STATUS + i*4, 0);
201 mce_log(&m); 204 if (error_code != -2)
205 mce_log(&m);
202 206
203 /* Did this bank cause the exception? */ 207 /* Did this bank cause the exception? */
204 /* Assume that the bank with uncorrectable errors did it, 208 /* Assume that the bank with uncorrectable errors did it,
@@ -313,7 +317,7 @@ static void mce_init(void *dummy)
313 317
314 /* Log the machine checks left over from the previous reset. 318 /* Log the machine checks left over from the previous reset.
315 This also clears all registers */ 319 This also clears all registers */
316 do_machine_check(NULL, -1); 320 do_machine_check(NULL, mce_bootlog ? -1 : -2);
317 321
318 set_in_cr4(X86_CR4_MCE); 322 set_in_cr4(X86_CR4_MCE);
319 323
@@ -474,11 +478,17 @@ static int __init mcheck_disable(char *str)
474} 478}
475 479
476/* mce=off disables machine check. Note you can reenable it later 480/* mce=off disables machine check. Note you can reenable it later
477 using sysfs */ 481 using sysfs.
482 mce=bootlog Log MCEs from before booting. Disabled by default to work
483 around buggy BIOS that leave bogus MCEs. */
478static int __init mcheck_enable(char *str) 484static int __init mcheck_enable(char *str)
479{ 485{
486 if (*str == '=')
487 str++;
480 if (!strcmp(str, "off")) 488 if (!strcmp(str, "off"))
481 mce_dont_init = 1; 489 mce_dont_init = 1;
490 else if (!strcmp(str, "bootlog"))
491 mce_bootlog = 1;
482 else 492 else
483 printk("mce= argument %s ignored. Please use /sys", str); 493 printk("mce= argument %s ignored. Please use /sys", str);
484 return 0; 494 return 0;
@@ -514,10 +524,7 @@ static struct sysdev_class mce_sysclass = {
514 set_kset_name("machinecheck"), 524 set_kset_name("machinecheck"),
515}; 525};
516 526
517static struct sys_device device_mce = { 527static DEFINE_PER_CPU(struct sys_device, device_mce);
518 .id = 0,
519 .cls = &mce_sysclass,
520};
521 528
522/* Why are there no generic functions for this? */ 529/* Why are there no generic functions for this? */
523#define ACCESSOR(name, var, start) \ 530#define ACCESSOR(name, var, start) \
@@ -542,27 +549,83 @@ ACCESSOR(bank4ctl,bank[4],mce_restart())
542ACCESSOR(tolerant,tolerant,) 549ACCESSOR(tolerant,tolerant,)
543ACCESSOR(check_interval,check_interval,mce_restart()) 550ACCESSOR(check_interval,check_interval,mce_restart())
544 551
545static __cpuinit int mce_init_device(void) 552/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
553static __cpuinit int mce_create_device(unsigned int cpu)
546{ 554{
547 int err; 555 int err;
556 if (!mce_available(&cpu_data[cpu]))
557 return -EIO;
558
559 per_cpu(device_mce,cpu).id = cpu;
560 per_cpu(device_mce,cpu).cls = &mce_sysclass;
561
562 err = sysdev_register(&per_cpu(device_mce,cpu));
563
564 if (!err) {
565 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
566 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
567 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
568 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
569 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
570 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
571 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
572 }
573 return err;
574}
575
576#ifdef CONFIG_HOTPLUG_CPU
577static __cpuinit void mce_remove_device(unsigned int cpu)
578{
579 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
580 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
581 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
582 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
583 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
584 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
585 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
586 sysdev_unregister(&per_cpu(device_mce,cpu));
587}
588#endif
589
590/* Get notified when a cpu comes on/off. Be hotplug friendly. */
591static __cpuinit int
592mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
593{
594 unsigned int cpu = (unsigned long)hcpu;
595
596 switch (action) {
597 case CPU_ONLINE:
598 mce_create_device(cpu);
599 break;
600#ifdef CONFIG_HOTPLUG_CPU
601 case CPU_DEAD:
602 mce_remove_device(cpu);
603 break;
604#endif
605 }
606 return NOTIFY_OK;
607}
608
609static struct notifier_block mce_cpu_notifier = {
610 .notifier_call = mce_cpu_callback,
611};
612
613static __init int mce_init_device(void)
614{
615 int err;
616 int i = 0;
617
548 if (!mce_available(&boot_cpu_data)) 618 if (!mce_available(&boot_cpu_data))
549 return -EIO; 619 return -EIO;
550 err = sysdev_class_register(&mce_sysclass); 620 err = sysdev_class_register(&mce_sysclass);
551 if (!err) 621
552 err = sysdev_register(&device_mce); 622 for_each_online_cpu(i) {
553 if (!err) { 623 mce_create_device(i);
554 /* could create per CPU objects, but it is not worth it. */ 624 }
555 sysdev_create_file(&device_mce, &attr_bank0ctl); 625
556 sysdev_create_file(&device_mce, &attr_bank1ctl); 626 register_cpu_notifier(&mce_cpu_notifier);
557 sysdev_create_file(&device_mce, &attr_bank2ctl);
558 sysdev_create_file(&device_mce, &attr_bank3ctl);
559 sysdev_create_file(&device_mce, &attr_bank4ctl);
560 sysdev_create_file(&device_mce, &attr_tolerant);
561 sysdev_create_file(&device_mce, &attr_check_interval);
562 }
563
564 misc_register(&mce_log_device); 627 misc_register(&mce_log_device);
565 return err; 628 return err;
566
567} 629}
630
568device_initcall(mce_init_device); 631device_initcall(mce_init_device);
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 9c5aa2a790c7..79c362d03e2e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -109,7 +109,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
109 109
110static void __init MP_processor_info (struct mpc_config_processor *m) 110static void __init MP_processor_info (struct mpc_config_processor *m)
111{ 111{
112 int ver; 112 int ver, cpu;
113 static int found_bsp=0; 113 static int found_bsp=0;
114 114
115 if (!(m->mpc_cpuflag & CPU_ENABLED)) 115 if (!(m->mpc_cpuflag & CPU_ENABLED))
@@ -131,7 +131,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
131 return; 131 return;
132 } 132 }
133 133
134 num_processors++; 134 cpu = num_processors++;
135 135
136 if (m->mpc_apicid > MAX_APICS) { 136 if (m->mpc_apicid > MAX_APICS) {
137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", 137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
@@ -155,13 +155,18 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
155 * in same order as logical cpu numbers. Hence the first 155 * in same order as logical cpu numbers. Hence the first
156 * entry is BSP, and so on. 156 * entry is BSP, and so on.
157 */ 157 */
158 cpu = 0;
159
158 bios_cpu_apicid[0] = m->mpc_apicid; 160 bios_cpu_apicid[0] = m->mpc_apicid;
159 x86_cpu_to_apicid[0] = m->mpc_apicid; 161 x86_cpu_to_apicid[0] = m->mpc_apicid;
160 found_bsp = 1; 162 found_bsp = 1;
161 } else { 163 } else
162 bios_cpu_apicid[num_processors - found_bsp] = m->mpc_apicid; 164 cpu = num_processors - found_bsp;
163 x86_cpu_to_apicid[num_processors - found_bsp] = m->mpc_apicid; 165 bios_cpu_apicid[cpu] = m->mpc_apicid;
164 } 166 x86_cpu_to_apicid[cpu] = m->mpc_apicid;
167
168 cpu_set(cpu, cpu_possible_map);
169 cpu_set(cpu, cpu_present_map);
165} 170}
166 171
167static void __init MP_bus_info (struct mpc_config_bus *m) 172static void __init MP_bus_info (struct mpc_config_bus *m)
@@ -965,8 +970,21 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
965 * due to unused I/O APIC pins. 970 * due to unused I/O APIC pins.
966 */ 971 */
967 int irq = gsi; 972 int irq = gsi;
968 gsi = pci_irq++; 973 if (gsi < MAX_GSI_NUM) {
969 gsi_to_irq[irq] = gsi; 974 if (gsi > 15)
975 gsi = pci_irq++;
976#ifdef CONFIG_ACPI_BUS
977 /*
978 * Don't assign IRQ used by ACPI SCI
979 */
980 if (gsi == acpi_fadt.sci_int)
981 gsi = pci_irq++;
982#endif
983 gsi_to_irq[irq] = gsi;
984 } else {
985 printk(KERN_ERR "GSI %u is too high\n", gsi);
986 return gsi;
987 }
970 } 988 }
971 989
972 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, 990 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 5fd03225058a..116a491e2961 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -645,15 +645,15 @@ void __init setup_arch(char **cmdline_p)
645 } 645 }
646 } 646 }
647#endif 647#endif
648
649 sparse_init();
650
651#ifdef CONFIG_KEXEC 648#ifdef CONFIG_KEXEC
652 if (crashk_res.start != crashk_res.end) { 649 if (crashk_res.start != crashk_res.end) {
653 reserve_bootmem(crashk_res.start, 650 reserve_bootmem(crashk_res.start,
654 crashk_res.end - crashk_res.start + 1); 651 crashk_res.end - crashk_res.start + 1);
655 } 652 }
656#endif 653#endif
654
655 sparse_init();
656
657 paging_init(); 657 paging_init();
658 658
659 check_ioapic(); 659 check_ioapic();
@@ -765,8 +765,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
765 int cpu = smp_processor_id(); 765 int cpu = smp_processor_id();
766 int node = 0; 766 int node = 0;
767 unsigned bits; 767 unsigned bits;
768 if (c->x86_num_cores == 1)
769 return;
770 768
771 bits = 0; 769 bits = 0;
772 while ((1 << bits) < c->x86_num_cores) 770 while ((1 << bits) < c->x86_num_cores)
@@ -1081,8 +1079,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1081 else 1079 else
1082 mtrr_ap_init(); 1080 mtrr_ap_init();
1083#ifdef CONFIG_NUMA 1081#ifdef CONFIG_NUMA
1084 if (c != &boot_cpu_data) 1082 numa_add_cpu(smp_processor_id());
1085 numa_add_cpu(c - cpu_data);
1086#endif 1083#endif
1087} 1084}
1088 1085
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index f2b9c6bc999a..34082c1cc41e 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -12,6 +12,7 @@
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/module.h>
15#include <asm/bootsetup.h> 16#include <asm/bootsetup.h>
16#include <asm/pda.h> 17#include <asm/pda.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -22,10 +23,8 @@
22#include <asm/smp.h> 23#include <asm/smp.h>
23#include <asm/i387.h> 24#include <asm/i387.h>
24#include <asm/percpu.h> 25#include <asm/percpu.h>
25#include <asm/mtrr.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/mman.h> 27#include <asm/sections.h>
28#include <asm/numa.h>
29 28
30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 29char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
31 30
@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
33 32
34struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 33struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
35 34
36extern struct task_struct init_task;
37
38extern unsigned char __per_cpu_start[], __per_cpu_end[];
39
40extern struct desc_ptr cpu_gdt_descr[];
41struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
42 36
43char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void)
101#endif 95#endif
102 96
103 for (i = 0; i < NR_CPUS; i++) { 97 for (i = 0; i < NR_CPUS; i++) {
104 unsigned char *ptr; 98 char *ptr;
105 99
106 if (!NODE_DATA(cpu_to_node(i))) { 100 if (!NODE_DATA(cpu_to_node(i))) {
107 printk("cpu with no node %d, num_online_nodes %d\n", 101 printk("cpu with no node %d, num_online_nodes %d\n",
@@ -190,11 +184,7 @@ void __cpuinit check_efer(void)
190 */ 184 */
191void __cpuinit cpu_init (void) 185void __cpuinit cpu_init (void)
192{ 186{
193#ifdef CONFIG_SMP
194 int cpu = stack_smp_processor_id(); 187 int cpu = stack_smp_processor_id();
195#else
196 int cpu = smp_processor_id();
197#endif
198 struct tss_struct *t = &per_cpu(init_tss, cpu); 188 struct tss_struct *t = &per_cpu(init_tss, cpu);
199 unsigned long v; 189 unsigned long v;
200 char *estacks = NULL; 190 char *estacks = NULL;
@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void)
214 204
215 printk("Initializing CPU#%d\n", cpu); 205 printk("Initializing CPU#%d\n", cpu);
216 206
217 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 207 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
218 208
219 /* 209 /*
220 * Initialize the per-CPU GDT with the boot GDT, 210 * Initialize the per-CPU GDT with the boot GDT,
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index ccae392886af..e5958220d6b8 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -129,10 +129,9 @@ asmlinkage void smp_invalidate_interrupt (void)
129 } else 129 } else
130 leave_mm(cpu); 130 leave_mm(cpu);
131 } 131 }
132out:
132 ack_APIC_irq(); 133 ack_APIC_irq();
133 cpu_clear(cpu, flush_cpumask); 134 cpu_clear(cpu, flush_cpumask);
134
135out:
136 put_cpu_no_resched(); 135 put_cpu_no_resched();
137} 136}
138 137
@@ -294,6 +293,69 @@ void unlock_ipi_call_lock(void)
294} 293}
295 294
296/* 295/*
296 * this function sends a 'generic call function' IPI to one other CPU
297 * in the system.
298 */
299static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info,
300 int nonatomic, int wait)
301{
302 struct call_data_struct data;
303 int cpus = 1;
304
305 data.func = func;
306 data.info = info;
307 atomic_set(&data.started, 0);
308 data.wait = wait;
309 if (wait)
310 atomic_set(&data.finished, 0);
311
312 call_data = &data;
313 wmb();
314 /* Send a message to all other CPUs and wait for them to respond */
315 send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR);
316
317 /* Wait for response */
318 while (atomic_read(&data.started) != cpus)
319 cpu_relax();
320
321 if (!wait)
322 return;
323
324 while (atomic_read(&data.finished) != cpus)
325 cpu_relax();
326}
327
328/*
329 * smp_call_function_single - Run a function on another CPU
330 * @func: The function to run. This must be fast and non-blocking.
331 * @info: An arbitrary pointer to pass to the function.
332 * @nonatomic: Currently unused.
333 * @wait: If true, wait until function has completed on other CPUs.
334 *
335 * Retrurns 0 on success, else a negative status code.
336 *
337 * Does not return until the remote CPU is nearly ready to execute <func>
338 * or is or has executed.
339 */
340
341int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
342 int nonatomic, int wait)
343{
344 /* prevent preemption and reschedule on another processor */
345 int me = get_cpu();
346 if (cpu == me) {
347 WARN_ON(1);
348 put_cpu();
349 return -EBUSY;
350 }
351 spin_lock_bh(&call_lock);
352 __smp_call_function_single(cpu, func, info, nonatomic, wait);
353 spin_unlock_bh(&call_lock);
354 put_cpu();
355 return 0;
356}
357
358/*
297 * this function sends a 'generic call function' IPI to all other CPUs 359 * this function sends a 'generic call function' IPI to all other CPUs
298 * in the system. 360 * in the system.
299 */ 361 */
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index b969ee128728..6e4807d64d46 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -113,24 +113,6 @@ struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) 113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
114 114
115/* 115/*
116 * cpu_possible_map should be static, it cannot change as cpu's
117 * are onlined, or offlined. The reason is per-cpu data-structures
118 * are allocated by some modules at init time, and dont expect to
119 * do this dynamically on cpu arrival/departure.
120 * cpu_present_map on the other hand can change dynamically.
121 * In case when cpu_hotplug is not compiled, then we resort to current
122 * behaviour, which is cpu_possible == cpu_present.
123 * If cpu-hotplug is supported, then we need to preallocate for all
124 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
125 * - Ashok Raj
126 */
127#ifdef CONFIG_HOTPLUG_CPU
128#define fixup_cpu_possible_map(x) cpu_set((x), cpu_possible_map)
129#else
130#define fixup_cpu_possible_map(x)
131#endif
132
133/*
134 * Currently trivial. Write the real->protected mode 116 * Currently trivial. Write the real->protected mode
135 * bootstrap into the page concerned. The caller 117 * bootstrap into the page concerned. The caller
136 * has made sure it's suitably aligned. 118 * has made sure it's suitably aligned.
@@ -229,9 +211,6 @@ static __cpuinit void sync_master(void *arg)
229{ 211{
230 unsigned long flags, i; 212 unsigned long flags, i;
231 213
232 if (smp_processor_id() != boot_cpu_id)
233 return;
234
235 go[MASTER] = 0; 214 go[MASTER] = 0;
236 215
237 local_irq_save(flags); 216 local_irq_save(flags);
@@ -280,12 +259,12 @@ get_delta(long *rt, long *master)
280 return tcenter - best_tm; 259 return tcenter - best_tm;
281} 260}
282 261
283static __cpuinit void sync_tsc(void) 262static __cpuinit void sync_tsc(unsigned int master)
284{ 263{
285 int i, done = 0; 264 int i, done = 0;
286 long delta, adj, adjust_latency = 0; 265 long delta, adj, adjust_latency = 0;
287 unsigned long flags, rt, master_time_stamp, bound; 266 unsigned long flags, rt, master_time_stamp, bound;
288#if DEBUG_TSC_SYNC 267#ifdef DEBUG_TSC_SYNC
289 static struct syncdebug { 268 static struct syncdebug {
290 long rt; /* roundtrip time */ 269 long rt; /* roundtrip time */
291 long master; /* master's timestamp */ 270 long master; /* master's timestamp */
@@ -294,9 +273,17 @@ static __cpuinit void sync_tsc(void)
294 } t[NUM_ROUNDS] __cpuinitdata; 273 } t[NUM_ROUNDS] __cpuinitdata;
295#endif 274#endif
296 275
276 printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n",
277 smp_processor_id(), master);
278
297 go[MASTER] = 1; 279 go[MASTER] = 1;
298 280
299 smp_call_function(sync_master, NULL, 1, 0); 281 /* It is dangerous to broadcast IPI as cpus are coming up,
282 * as they may not be ready to accept them. So since
283 * we only need to send the ipi to the boot cpu direct
284 * the message, and avoid the race.
285 */
286 smp_call_function_single(master, sync_master, NULL, 1, 0);
300 287
301 while (go[MASTER]) /* wait for master to be ready */ 288 while (go[MASTER]) /* wait for master to be ready */
302 no_cpu_relax(); 289 no_cpu_relax();
@@ -321,7 +308,7 @@ static __cpuinit void sync_tsc(void)
321 rdtscll(t); 308 rdtscll(t);
322 wrmsrl(MSR_IA32_TSC, t + adj); 309 wrmsrl(MSR_IA32_TSC, t + adj);
323 } 310 }
324#if DEBUG_TSC_SYNC 311#ifdef DEBUG_TSC_SYNC
325 t[i].rt = rt; 312 t[i].rt = rt;
326 t[i].master = master_time_stamp; 313 t[i].master = master_time_stamp;
327 t[i].diff = delta; 314 t[i].diff = delta;
@@ -331,7 +318,7 @@ static __cpuinit void sync_tsc(void)
331 } 318 }
332 spin_unlock_irqrestore(&tsc_sync_lock, flags); 319 spin_unlock_irqrestore(&tsc_sync_lock, flags);
333 320
334#if DEBUG_TSC_SYNC 321#ifdef DEBUG_TSC_SYNC
335 for (i = 0; i < NUM_ROUNDS; ++i) 322 for (i = 0; i < NUM_ROUNDS; ++i)
336 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n", 323 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n",
337 t[i].rt, t[i].master, t[i].diff, t[i].lat); 324 t[i].rt, t[i].master, t[i].diff, t[i].lat);
@@ -340,16 +327,14 @@ static __cpuinit void sync_tsc(void)
340 printk(KERN_INFO 327 printk(KERN_INFO
341 "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, " 328 "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, "
342 "maxerr %lu cycles)\n", 329 "maxerr %lu cycles)\n",
343 smp_processor_id(), boot_cpu_id, delta, rt); 330 smp_processor_id(), master, delta, rt);
344} 331}
345 332
346static void __cpuinit tsc_sync_wait(void) 333static void __cpuinit tsc_sync_wait(void)
347{ 334{
348 if (notscsync || !cpu_has_tsc) 335 if (notscsync || !cpu_has_tsc)
349 return; 336 return;
350 printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", smp_processor_id(), 337 sync_tsc(boot_cpu_id);
351 boot_cpu_id);
352 sync_tsc();
353} 338}
354 339
355static __init int notscsync_setup(char *s) 340static __init int notscsync_setup(char *s)
@@ -537,7 +522,7 @@ void __cpuinit start_secondary(void)
537extern volatile unsigned long init_rsp; 522extern volatile unsigned long init_rsp;
538extern void (*initial_code)(void); 523extern void (*initial_code)(void);
539 524
540#if APIC_DEBUG 525#ifdef APIC_DEBUG
541static void inquire_remote_apic(int apicid) 526static void inquire_remote_apic(int apicid)
542{ 527{
543 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; 528 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 };
@@ -773,8 +758,9 @@ do_rest:
773 initial_code = start_secondary; 758 initial_code = start_secondary;
774 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); 759 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK);
775 760
776 printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx\n", cpu, apicid, 761 printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
777 start_rip, init_rsp); 762 cpus_weight(cpu_present_map),
763 apicid);
778 764
779 /* 765 /*
780 * This grunge runs the startup process for 766 * This grunge runs the startup process for
@@ -841,7 +827,7 @@ do_rest:
841 else 827 else
842 /* trampoline code not run */ 828 /* trampoline code not run */
843 printk("Not responding.\n"); 829 printk("Not responding.\n");
844#if APIC_DEBUG 830#ifdef APIC_DEBUG
845 inquire_remote_apic(apicid); 831 inquire_remote_apic(apicid);
846#endif 832#endif
847 } 833 }
@@ -924,6 +910,27 @@ static __init void enforce_max_cpus(unsigned max_cpus)
924 } 910 }
925} 911}
926 912
913#ifdef CONFIG_HOTPLUG_CPU
914/*
915 * cpu_possible_map should be static, it cannot change as cpu's
916 * are onlined, or offlined. The reason is per-cpu data-structures
917 * are allocated by some modules at init time, and dont expect to
918 * do this dynamically on cpu arrival/departure.
919 * cpu_present_map on the other hand can change dynamically.
920 * In case when cpu_hotplug is not compiled, then we resort to current
921 * behaviour, which is cpu_possible == cpu_present.
922 * If cpu-hotplug is supported, then we need to preallocate for all
923 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
924 * - Ashok Raj
925 */
926static void prefill_possible_map(void)
927{
928 int i;
929 for (i = 0; i < NR_CPUS; i++)
930 cpu_set(i, cpu_possible_map);
931}
932#endif
933
927/* 934/*
928 * Various sanity checks. 935 * Various sanity checks.
929 */ 936 */
@@ -987,25 +994,15 @@ static int __init smp_sanity_check(unsigned max_cpus)
987 */ 994 */
988void __init smp_prepare_cpus(unsigned int max_cpus) 995void __init smp_prepare_cpus(unsigned int max_cpus)
989{ 996{
990 int i;
991
992 nmi_watchdog_default(); 997 nmi_watchdog_default();
993 current_cpu_data = boot_cpu_data; 998 current_cpu_data = boot_cpu_data;
994 current_thread_info()->cpu = 0; /* needed? */ 999 current_thread_info()->cpu = 0; /* needed? */
995 1000
996 enforce_max_cpus(max_cpus); 1001 enforce_max_cpus(max_cpus);
997 1002
998 /* 1003#ifdef CONFIG_HOTPLUG_CPU
999 * Fill in cpu_present_mask 1004 prefill_possible_map();
1000 */ 1005#endif
1001 for (i = 0; i < NR_CPUS; i++) {
1002 int apicid = cpu_present_to_apicid(i);
1003 if (physid_isset(apicid, phys_cpu_present_map)) {
1004 cpu_set(i, cpu_present_map);
1005 cpu_set(i, cpu_possible_map);
1006 }
1007 fixup_cpu_possible_map(i);
1008 }
1009 1006
1010 if (smp_sanity_check(max_cpus) < 0) { 1007 if (smp_sanity_check(max_cpus) < 0) {
1011 printk(KERN_INFO "SMP disabled\n"); 1008 printk(KERN_INFO "SMP disabled\n");
@@ -1189,8 +1186,7 @@ void __cpu_die(unsigned int cpu)
1189 printk ("CPU %d is now offline\n", cpu); 1186 printk ("CPU %d is now offline\n", cpu);
1190 return; 1187 return;
1191 } 1188 }
1192 current->state = TASK_UNINTERRUPTIBLE; 1189 msleep(100);
1193 schedule_timeout(HZ/10);
1194 } 1190 }
1195 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1191 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1196} 1192}
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 102736630002..6ead433a3885 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -594,9 +594,6 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
594 if (!cpu) 594 if (!cpu)
595 reason = get_nmi_reason(); 595 reason = get_nmi_reason();
596 596
597 if (!cpu_online(cpu))
598 return;
599
600 if (!(reason & 0xc0)) { 597 if (!(reason & 0xc0)) {
601 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) 598 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
602 == NOTIFY_STOP) 599 == NOTIFY_STOP)
diff --git a/arch/x86_64/lib/csum-copy.S b/arch/x86_64/lib/csum-copy.S
index 01808ec37836..72fd55ee896e 100644
--- a/arch/x86_64/lib/csum-copy.S
+++ b/arch/x86_64/lib/csum-copy.S
@@ -188,8 +188,8 @@ csum_partial_copy_generic:
188 source 188 source
189 movw (%rdi),%bx 189 movw (%rdi),%bx
190 adcl %ebx,%eax 190 adcl %ebx,%eax
191 dest
192 decl %ecx 191 decl %ecx
192 dest
193 movw %bx,(%rsi) 193 movw %bx,(%rsi)
194 leaq 2(%rdi),%rdi 194 leaq 2(%rdi),%rdi
195 leaq 2(%rsi),%rsi 195 leaq 2(%rsi),%rsi
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 33a873a3c223..841bd738a189 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -18,8 +18,6 @@
18#include <asm/smp.h> 18#include <asm/smp.h>
19#endif 19#endif
20 20
21int x86_udelay_tsc = 0; /* Delay via TSC */
22
23int read_current_timer(unsigned long *timer_value) 21int read_current_timer(unsigned long *timer_value)
24{ 22{
25 rdtscll(*timer_value); 23 rdtscll(*timer_value);
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 2f187986f940..493819e543a5 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -23,7 +23,6 @@
23#include <linux/vt_kern.h> /* For unblank_screen() */ 23#include <linux/vt_kern.h> /* For unblank_screen() */
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kprobes.h>
27 26
28#include <asm/system.h> 27#include <asm/system.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
@@ -440,13 +439,13 @@ good_area:
440 * the fault. 439 * the fault.
441 */ 440 */
442 switch (handle_mm_fault(mm, vma, address, write)) { 441 switch (handle_mm_fault(mm, vma, address, write)) {
443 case 1: 442 case VM_FAULT_MINOR:
444 tsk->min_flt++; 443 tsk->min_flt++;
445 break; 444 break;
446 case 2: 445 case VM_FAULT_MAJOR:
447 tsk->maj_flt++; 446 tsk->maj_flt++;
448 break; 447 break;
449 case 0: 448 case VM_FAULT_SIGBUS:
450 goto do_sigbus; 449 goto do_sigbus;
451 default: 450 default:
452 goto out_of_memory; 451 goto out_of_memory;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index ac61c186eb02..70cb2904a90f 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -36,34 +36,36 @@ int numa_off __initdata;
36int __init compute_hash_shift(struct node *nodes, int numnodes) 36int __init compute_hash_shift(struct node *nodes, int numnodes)
37{ 37{
38 int i; 38 int i;
39 int shift = 24; 39 int shift = 20;
40 u64 addr; 40 unsigned long addr,maxend=0;
41 41
42 /* When in doubt use brute force. */ 42 for (i = 0; i < numnodes; i++)
43 while (shift < 48) { 43 if ((nodes[i].start != nodes[i].end) && (nodes[i].end > maxend))
44 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); 44 maxend = nodes[i].end;
45 for (i = 0; i < numnodes; i++) { 45
46 if (nodes[i].start == nodes[i].end) 46 while ((1UL << shift) < (maxend / NODEMAPSIZE))
47 continue; 47 shift++;
48 for (addr = nodes[i].start; 48
49 addr < nodes[i].end; 49 printk (KERN_DEBUG"Using %d for the hash shift. Max adder is %lx \n",
50 addr += (1UL << shift)) { 50 shift,maxend);
51 if (memnodemap[addr >> shift] != 0xff && 51 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE);
52 memnodemap[addr >> shift] != i) { 52 for (i = 0; i < numnodes; i++) {
53 printk(KERN_INFO 53 if (nodes[i].start == nodes[i].end)
54 "node %d shift %d addr %Lx conflict %d\n", 54 continue;
55 i, shift, addr, memnodemap[addr>>shift]); 55 for (addr = nodes[i].start;
56 goto next; 56 addr < nodes[i].end;
57 } 57 addr += (1UL << shift)) {
58 memnodemap[addr >> shift] = i; 58 if (memnodemap[addr >> shift] != 0xff) {
59 printk(KERN_INFO
60 "Your memory is not aligned you need to rebuild your kernel "
61 "with a bigger NODEMAPSIZE shift=%d adder=%lu\n",
62 shift,addr);
63 return -1;
59 } 64 }
65 memnodemap[addr >> shift] = i;
60 } 66 }
61 return shift;
62 next:
63 shift++;
64 } 67 }
65 memset(memnodemap,0,sizeof(*memnodemap) * NODEMAPSIZE); 68 return shift;
66 return -1;
67} 69}
68 70
69#ifdef CONFIG_SPARSEMEM 71#ifdef CONFIG_SPARSEMEM
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 5d01b31472e1..8e3d097a9ddd 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -20,6 +20,9 @@
20 20
21static struct acpi_table_slit *acpi_slit; 21static struct acpi_table_slit *acpi_slit;
22 22
23/* Internal processor count */
24static unsigned int __initdata num_processors = 0;
25
23static nodemask_t nodes_parsed __initdata; 26static nodemask_t nodes_parsed __initdata;
24static nodemask_t nodes_found __initdata; 27static nodemask_t nodes_found __initdata;
25static struct node nodes[MAX_NUMNODES] __initdata; 28static struct node nodes[MAX_NUMNODES] __initdata;
@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
101 bad_srat(); 104 bad_srat();
102 return; 105 return;
103 } 106 }
104 if (pa->apic_id >= NR_CPUS) { 107 if (num_processors >= NR_CPUS) {
105 printk(KERN_ERR "SRAT: lapic %u too large.\n", 108 printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n",
106 pa->apic_id); 109 num_processors, pa->apic_id, NR_CPUS);
107 bad_srat(); 110 bad_srat();
108 return; 111 return;
109 } 112 }
110 cpu_to_node[pa->apic_id] = node; 113 cpu_to_node[num_processors] = node;
111 acpi_numa = 1; 114 acpi_numa = 1;
112 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", 115 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n",
113 pxm, pa->apic_id, node); 116 pxm, pa->apic_id, num_processors, node);
117
118 num_processors++;
114} 119}
115 120
116/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 121/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
@@ -124,7 +129,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
124 129
125 if (srat_disabled() || ma->flags.enabled == 0) 130 if (srat_disabled() || ma->flags.enabled == 0)
126 return; 131 return;
127 /* hotplug bit is ignored for now */
128 pxm = ma->proximity_domain; 132 pxm = ma->proximity_domain;
129 node = setup_node(pxm); 133 node = setup_node(pxm);
130 if (node < 0) { 134 if (node < 0) {
@@ -134,6 +138,10 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
134 } 138 }
135 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 139 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
136 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 140 end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
141 /* It is fine to add this area to the nodes data it will be used later*/
142 if (ma->flags.hot_pluggable == 1)
143 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
144 start, end);
137 i = conflicting_nodes(start, end); 145 i = conflicting_nodes(start, end);
138 if (i >= 0) { 146 if (i >= 0) {
139 printk(KERN_ERR 147 printk(KERN_ERR
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index 7e7d0c2a0025..c2c38b579939 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -29,7 +29,7 @@ __init static int
29fill_mp_bus_to_cpumask(void) 29fill_mp_bus_to_cpumask(void)
30{ 30{
31 struct pci_dev *nb_dev = NULL; 31 struct pci_dev *nb_dev = NULL;
32 int i, j, printed; 32 int i, j;
33 u32 ldtbus, nid; 33 u32 ldtbus, nid;
34 static int lbnr[3] = { 34 static int lbnr[3] = {
35 LDT_BUS_NUMBER_REGISTER_0, 35 LDT_BUS_NUMBER_REGISTER_0,
diff --git a/crypto/aes.c b/crypto/aes.c
index d0dd7c3c5278..5df92888ef5a 100644
--- a/crypto/aes.c
+++ b/crypto/aes.c
@@ -67,7 +67,7 @@
67/* 67/*
68 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) 68 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
69 */ 69 */
70inline static u8 70static inline u8
71byte(const u32 x, const unsigned n) 71byte(const u32 x, const unsigned n)
72{ 72{
73 return x >> (n << 3); 73 return x >> (n << 3);
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
index 3cd2e968e96c..c0a37d98b4f3 100644
--- a/drivers/acorn/block/fd1772.c
+++ b/drivers/acorn/block/fd1772.c
@@ -1283,8 +1283,7 @@ static void do_fd_request(request_queue_t* q)
1283 if (fdc_busy) return; 1283 if (fdc_busy) return;
1284 save_flags(flags); 1284 save_flags(flags);
1285 cli(); 1285 cli();
1286 while (fdc_busy) 1286 wait_event(fdc_wait, !fdc_busy);
1287 sleep_on(&fdc_wait);
1288 fdc_busy = 1; 1287 fdc_busy = 1;
1289 ENABLE_IRQ(); 1288 ENABLE_IRQ();
1290 restore_flags(flags); 1289 restore_flags(flags);
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 986410e7b483..ba13896cae40 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -133,9 +133,10 @@ config ACPI_HOTKEY
133 depends on ACPI_INTERPRETER 133 depends on ACPI_INTERPRETER
134 depends on EXPERIMENTAL 134 depends on EXPERIMENTAL
135 depends on !IA64_SGI_SN 135 depends on !IA64_SGI_SN
136 default m 136 default n
137 help 137 help
138 ACPI generic hotkey 138 Experimental consolidated hotkey driver.
139 If you are unsure, say N.
139 140
140config ACPI_FAN 141config ACPI_FAN
141 tristate "Fan" 142 tristate "Fan"
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 0f45d45f05a0..8162fd0c21a7 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -26,6 +26,9 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h>
30#include <linux/proc_fs.h>
31#include <linux/seq_file.h>
29#include <acpi/acpi_bus.h> 32#include <acpi/acpi_bus.h>
30#include <acpi/acpi_drivers.h> 33#include <acpi/acpi_drivers.h>
31 34
@@ -33,6 +36,9 @@
33#define ACPI_BUTTON_COMPONENT 0x00080000 36#define ACPI_BUTTON_COMPONENT 0x00080000
34#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" 37#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
35#define ACPI_BUTTON_CLASS "button" 38#define ACPI_BUTTON_CLASS "button"
39#define ACPI_BUTTON_FILE_INFO "info"
40#define ACPI_BUTTON_FILE_STATE "state"
41#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
36#define ACPI_BUTTON_NOTIFY_STATUS 0x80 42#define ACPI_BUTTON_NOTIFY_STATUS 0x80
37 43
38#define ACPI_BUTTON_SUBCLASS_POWER "power" 44#define ACPI_BUTTON_SUBCLASS_POWER "power"
@@ -64,6 +70,8 @@ MODULE_LICENSE("GPL");
64 70
65static int acpi_button_add (struct acpi_device *device); 71static int acpi_button_add (struct acpi_device *device);
66static int acpi_button_remove (struct acpi_device *device, int type); 72static int acpi_button_remove (struct acpi_device *device, int type);
73static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
74static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
67 75
68static struct acpi_driver acpi_button_driver = { 76static struct acpi_driver acpi_button_driver = {
69 .name = ACPI_BUTTON_DRIVER_NAME, 77 .name = ACPI_BUTTON_DRIVER_NAME,
@@ -82,6 +90,179 @@ struct acpi_button {
82 unsigned long pushed; 90 unsigned long pushed;
83}; 91};
84 92
93static struct file_operations acpi_button_info_fops = {
94 .open = acpi_button_info_open_fs,
95 .read = seq_read,
96 .llseek = seq_lseek,
97 .release = single_release,
98};
99
100static struct file_operations acpi_button_state_fops = {
101 .open = acpi_button_state_open_fs,
102 .read = seq_read,
103 .llseek = seq_lseek,
104 .release = single_release,
105};
106/* --------------------------------------------------------------------------
107 FS Interface (/proc)
108 -------------------------------------------------------------------------- */
109
110static struct proc_dir_entry *acpi_button_dir;
111
112static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
113{
114 struct acpi_button *button = (struct acpi_button *) seq->private;
115
116 ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
117
118 if (!button || !button->device)
119 return_VALUE(0);
120
121 seq_printf(seq, "type: %s\n",
122 acpi_device_name(button->device));
123
124 return_VALUE(0);
125}
126
127static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
128{
129 return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
130}
131
132static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
133{
134 struct acpi_button *button = (struct acpi_button *) seq->private;
135 acpi_status status;
136 unsigned long state;
137
138 ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
139
140 if (!button || !button->device)
141 return_VALUE(0);
142
143 status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
144 if (ACPI_FAILURE(status)) {
145 seq_printf(seq, "state: unsupported\n");
146 }
147 else{
148 seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
149 }
150
151 return_VALUE(0);
152}
153
154static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
155{
156 return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
157}
158
159static struct proc_dir_entry *acpi_power_dir;
160static struct proc_dir_entry *acpi_sleep_dir;
161static struct proc_dir_entry *acpi_lid_dir;
162
163static int
164acpi_button_add_fs (
165 struct acpi_device *device)
166{
167 struct proc_dir_entry *entry = NULL;
168 struct acpi_button *button = NULL;
169
170 ACPI_FUNCTION_TRACE("acpi_button_add_fs");
171
172 if (!device || !acpi_driver_data(device))
173 return_VALUE(-EINVAL);
174
175 button = acpi_driver_data(device);
176
177 switch (button->type) {
178 case ACPI_BUTTON_TYPE_POWER:
179 case ACPI_BUTTON_TYPE_POWERF:
180 if (!acpi_power_dir)
181 acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
182 acpi_button_dir);
183 entry = acpi_power_dir;
184 break;
185 case ACPI_BUTTON_TYPE_SLEEP:
186 case ACPI_BUTTON_TYPE_SLEEPF:
187 if (!acpi_sleep_dir)
188 acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
189 acpi_button_dir);
190 entry = acpi_sleep_dir;
191 break;
192 case ACPI_BUTTON_TYPE_LID:
193 if (!acpi_lid_dir)
194 acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
195 acpi_button_dir);
196 entry = acpi_lid_dir;
197 break;
198 }
199
200 if (!entry)
201 return_VALUE(-ENODEV);
202 entry->owner = THIS_MODULE;
203
204 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
205 if (!acpi_device_dir(device))
206 return_VALUE(-ENODEV);
207 acpi_device_dir(device)->owner = THIS_MODULE;
208
209 /* 'info' [R] */
210 entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
211 S_IRUGO, acpi_device_dir(device));
212 if (!entry)
213 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
214 "Unable to create '%s' fs entry\n",
215 ACPI_BUTTON_FILE_INFO));
216 else {
217 entry->proc_fops = &acpi_button_info_fops;
218 entry->data = acpi_driver_data(device);
219 entry->owner = THIS_MODULE;
220 }
221
222 /* show lid state [R] */
223 if (button->type == ACPI_BUTTON_TYPE_LID) {
224 entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
225 S_IRUGO, acpi_device_dir(device));
226 if (!entry)
227 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
228 "Unable to create '%s' fs entry\n",
229 ACPI_BUTTON_FILE_INFO));
230 else {
231 entry->proc_fops = &acpi_button_state_fops;
232 entry->data = acpi_driver_data(device);
233 entry->owner = THIS_MODULE;
234 }
235 }
236
237 return_VALUE(0);
238}
239
240
241static int
242acpi_button_remove_fs (
243 struct acpi_device *device)
244{
245 struct acpi_button *button = NULL;
246
247 ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
248
249 button = acpi_driver_data(device);
250 if (acpi_device_dir(device)) {
251 if (button->type == ACPI_BUTTON_TYPE_LID)
252 remove_proc_entry(ACPI_BUTTON_FILE_STATE,
253 acpi_device_dir(device));
254 remove_proc_entry(ACPI_BUTTON_FILE_INFO,
255 acpi_device_dir(device));
256
257 remove_proc_entry(acpi_device_bid(device),
258 acpi_device_dir(device)->parent);
259 acpi_device_dir(device) = NULL;
260 }
261
262 return_VALUE(0);
263}
264
265
85/* -------------------------------------------------------------------------- 266/* --------------------------------------------------------------------------
86 Driver Interface 267 Driver Interface
87 -------------------------------------------------------------------------- */ 268 -------------------------------------------------------------------------- */
@@ -121,7 +302,8 @@ acpi_button_notify_fixed (
121 302
122 ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); 303 ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
123 304
124 BUG_ON(!button); 305 if (!button)
306 return_ACPI_STATUS(AE_BAD_PARAMETER);
125 307
126 acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); 308 acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
127 309
@@ -197,6 +379,10 @@ acpi_button_add (
197 goto end; 379 goto end;
198 } 380 }
199 381
382 result = acpi_button_add_fs(device);
383 if (result)
384 goto end;
385
200 switch (button->type) { 386 switch (button->type) {
201 case ACPI_BUTTON_TYPE_POWERF: 387 case ACPI_BUTTON_TYPE_POWERF:
202 status = acpi_install_fixed_event_handler ( 388 status = acpi_install_fixed_event_handler (
@@ -240,6 +426,7 @@ acpi_button_add (
240 426
241end: 427end:
242 if (result) { 428 if (result) {
429 acpi_button_remove_fs(device);
243 kfree(button); 430 kfree(button);
244 } 431 }
245 432
@@ -280,6 +467,8 @@ acpi_button_remove (struct acpi_device *device, int type)
280 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 467 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
281 "Error removing notify handler\n")); 468 "Error removing notify handler\n"));
282 469
470 acpi_button_remove_fs(device);
471
283 kfree(button); 472 kfree(button);
284 473
285 return_VALUE(0); 474 return_VALUE(0);
@@ -293,14 +482,20 @@ acpi_button_init (void)
293 482
294 ACPI_FUNCTION_TRACE("acpi_button_init"); 483 ACPI_FUNCTION_TRACE("acpi_button_init");
295 484
485 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
486 if (!acpi_button_dir)
487 return_VALUE(-ENODEV);
488 acpi_button_dir->owner = THIS_MODULE;
296 result = acpi_bus_register_driver(&acpi_button_driver); 489 result = acpi_bus_register_driver(&acpi_button_driver);
297 if (result < 0) { 490 if (result < 0) {
491 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
298 return_VALUE(-ENODEV); 492 return_VALUE(-ENODEV);
299 } 493 }
300 494
301 return_VALUE(0); 495 return_VALUE(0);
302} 496}
303 497
498
304static void __exit 499static void __exit
305acpi_button_exit (void) 500acpi_button_exit (void)
306{ 501{
@@ -308,8 +503,17 @@ acpi_button_exit (void)
308 503
309 acpi_bus_unregister_driver(&acpi_button_driver); 504 acpi_bus_unregister_driver(&acpi_button_driver);
310 505
506 if (acpi_power_dir)
507 remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
508 if (acpi_sleep_dir)
509 remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
510 if (acpi_lid_dir)
511 remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
512 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
513
311 return_VOID; 514 return_VOID;
312} 515}
313 516
517
314module_init(acpi_button_init); 518module_init(acpi_button_init);
315module_exit(acpi_button_exit); 519module_exit(acpi_button_exit);
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index 1ac197ccfc80..d11620018421 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -491,12 +491,6 @@ acpi_ds_load2_begin_op (
491 if ((!(walk_state->op_info->flags & AML_NSOPCODE) && 491 if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
492 (walk_state->opcode != AML_INT_NAMEPATH_OP)) || 492 (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
493 (!(walk_state->op_info->flags & AML_NAMED))) { 493 (!(walk_state->op_info->flags & AML_NAMED))) {
494 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
495 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
496 ACPI_REPORT_WARNING ((
497 "Encountered executable code at module level, [%s]\n",
498 acpi_ps_get_opcode_name (walk_state->opcode)));
499 }
500 return_ACPI_STATUS (AE_OK); 494 return_ACPI_STATUS (AE_OK);
501 } 495 }
502 496
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index fca4140a50a9..1ac5731d45e5 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -59,76 +59,186 @@ ACPI_MODULE_NAME ("acpi_ec")
59#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ 59#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */
60#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 60#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
61 61
62#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */
63#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */
64
62#define ACPI_EC_COMMAND_READ 0x80 65#define ACPI_EC_COMMAND_READ 0x80
63#define ACPI_EC_COMMAND_WRITE 0x81 66#define ACPI_EC_COMMAND_WRITE 0x81
64#define ACPI_EC_BURST_ENABLE 0x82 67#define ACPI_EC_BURST_ENABLE 0x82
65#define ACPI_EC_BURST_DISABLE 0x83 68#define ACPI_EC_BURST_DISABLE 0x83
66#define ACPI_EC_COMMAND_QUERY 0x84 69#define ACPI_EC_COMMAND_QUERY 0x84
67 70
68static int acpi_ec_add (struct acpi_device *device); 71#define EC_POLLING 0xFF
72#define EC_BURST 0x00
73
74
69static int acpi_ec_remove (struct acpi_device *device, int type); 75static int acpi_ec_remove (struct acpi_device *device, int type);
70static int acpi_ec_start (struct acpi_device *device); 76static int acpi_ec_start (struct acpi_device *device);
71static int acpi_ec_stop (struct acpi_device *device, int type); 77static int acpi_ec_stop (struct acpi_device *device, int type);
78static int acpi_ec_burst_add ( struct acpi_device *device);
79static int acpi_ec_polling_add ( struct acpi_device *device);
72 80
73static struct acpi_driver acpi_ec_driver = { 81static struct acpi_driver acpi_ec_driver = {
74 .name = ACPI_EC_DRIVER_NAME, 82 .name = ACPI_EC_DRIVER_NAME,
75 .class = ACPI_EC_CLASS, 83 .class = ACPI_EC_CLASS,
76 .ids = ACPI_EC_HID, 84 .ids = ACPI_EC_HID,
77 .ops = { 85 .ops = {
78 .add = acpi_ec_add, 86 .add = acpi_ec_polling_add,
79 .remove = acpi_ec_remove, 87 .remove = acpi_ec_remove,
80 .start = acpi_ec_start, 88 .start = acpi_ec_start,
81 .stop = acpi_ec_stop, 89 .stop = acpi_ec_stop,
82 }, 90 },
83}; 91};
84 92union acpi_ec {
85struct acpi_ec { 93 struct {
86 acpi_handle handle; 94 u32 mode;
87 unsigned long uid; 95 acpi_handle handle;
88 unsigned long gpe_bit; 96 unsigned long uid;
89 struct acpi_generic_address status_addr; 97 unsigned long gpe_bit;
90 struct acpi_generic_address command_addr; 98 struct acpi_generic_address status_addr;
91 struct acpi_generic_address data_addr; 99 struct acpi_generic_address command_addr;
92 unsigned long global_lock; 100 struct acpi_generic_address data_addr;
93 unsigned int expect_event; 101 unsigned long global_lock;
94 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ 102 } common;
95 atomic_t pending_gpe; 103
96 struct semaphore sem; 104 struct {
97 wait_queue_head_t wait; 105 u32 mode;
106 acpi_handle handle;
107 unsigned long uid;
108 unsigned long gpe_bit;
109 struct acpi_generic_address status_addr;
110 struct acpi_generic_address command_addr;
111 struct acpi_generic_address data_addr;
112 unsigned long global_lock;
113 unsigned int expect_event;
114 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/
115 atomic_t pending_gpe;
116 struct semaphore sem;
117 wait_queue_head_t wait;
118 }burst;
119
120 struct {
121 u32 mode;
122 acpi_handle handle;
123 unsigned long uid;
124 unsigned long gpe_bit;
125 struct acpi_generic_address status_addr;
126 struct acpi_generic_address command_addr;
127 struct acpi_generic_address data_addr;
128 unsigned long global_lock;
129 spinlock_t lock;
130 }polling;
98}; 131};
99 132
133static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event);
134static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event);
135static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data);
136static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data);
137static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data);
138static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data);
139static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data);
140static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data);
141static void acpi_ec_gpe_polling_query ( void *ec_cxt);
142static void acpi_ec_gpe_burst_query ( void *ec_cxt);
143static u32 acpi_ec_gpe_polling_handler ( void *data);
144static u32 acpi_ec_gpe_burst_handler ( void *data);
145static acpi_status __init
146acpi_fake_ecdt_polling_callback (
147 acpi_handle handle,
148 u32 Level,
149 void *context,
150 void **retval);
151
152static acpi_status __init
153acpi_fake_ecdt_burst_callback (
154 acpi_handle handle,
155 u32 Level,
156 void *context,
157 void **retval);
158
159static int __init
160acpi_ec_polling_get_real_ecdt(void);
161static int __init
162acpi_ec_burst_get_real_ecdt(void);
100/* If we find an EC via the ECDT, we need to keep a ptr to its context */ 163/* If we find an EC via the ECDT, we need to keep a ptr to its context */
101static struct acpi_ec *ec_ecdt; 164static union acpi_ec *ec_ecdt;
102 165
103/* External interfaces use first EC only, so remember */ 166/* External interfaces use first EC only, so remember */
104static struct acpi_device *first_ec; 167static struct acpi_device *first_ec;
168static int acpi_ec_polling_mode = EC_POLLING;
105 169
106/* -------------------------------------------------------------------------- 170/* --------------------------------------------------------------------------
107 Transaction Management 171 Transaction Management
108 -------------------------------------------------------------------------- */ 172 -------------------------------------------------------------------------- */
109 173
110static inline u32 acpi_ec_read_status(struct acpi_ec *ec) 174static inline u32 acpi_ec_read_status(union acpi_ec *ec)
111{ 175{
112 u32 status = 0; 176 u32 status = 0;
113 177
114 acpi_hw_low_level_read(8, &status, &ec->status_addr); 178 acpi_hw_low_level_read(8, &status, &ec->common.status_addr);
115 return status; 179 return status;
116} 180}
117 181
118static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event) 182static int
183acpi_ec_wait (
184 union acpi_ec *ec,
185 u8 event)
186{
187 if (acpi_ec_polling_mode)
188 return acpi_ec_polling_wait (ec, event);
189 else
190 return acpi_ec_burst_wait (ec, event);
191}
192
193static int
194acpi_ec_polling_wait (
195 union acpi_ec *ec,
196 u8 event)
197{
198 u32 acpi_ec_status = 0;
199 u32 i = ACPI_EC_UDELAY_COUNT;
200
201 if (!ec)
202 return -EINVAL;
203
204 /* Poll the EC status register waiting for the event to occur. */
205 switch (event) {
206 case ACPI_EC_EVENT_OBF:
207 do {
208 acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
209 if (acpi_ec_status & ACPI_EC_FLAG_OBF)
210 return 0;
211 udelay(ACPI_EC_UDELAY);
212 } while (--i>0);
213 break;
214 case ACPI_EC_EVENT_IBE:
215 do {
216 acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
217 if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
218 return 0;
219 udelay(ACPI_EC_UDELAY);
220 } while (--i>0);
221 break;
222 default:
223 return -EINVAL;
224 }
225
226 return -ETIME;
227}
228static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
119{ 229{
120 int result = 0; 230 int result = 0;
121 231
122 ACPI_FUNCTION_TRACE("acpi_ec_wait"); 232 ACPI_FUNCTION_TRACE("acpi_ec_wait");
123 233
124 ec->expect_event = event; 234 ec->burst.expect_event = event;
125 smp_mb(); 235 smp_mb();
126 236
127 result = wait_event_interruptible_timeout(ec->wait, 237 result = wait_event_interruptible_timeout(ec->burst.wait,
128 !ec->expect_event, 238 !ec->burst.expect_event,
129 msecs_to_jiffies(ACPI_EC_DELAY)); 239 msecs_to_jiffies(ACPI_EC_DELAY));
130 240
131 ec->expect_event = 0; 241 ec->burst.expect_event = 0;
132 smp_mb(); 242 smp_mb();
133 243
134 if (result < 0){ 244 if (result < 0){
@@ -160,7 +270,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event)
160 270
161static int 271static int
162acpi_ec_enter_burst_mode ( 272acpi_ec_enter_burst_mode (
163 struct acpi_ec *ec) 273 union acpi_ec *ec)
164{ 274{
165 u32 tmp = 0; 275 u32 tmp = 0;
166 int status = 0; 276 int status = 0;
@@ -170,43 +280,43 @@ acpi_ec_enter_burst_mode (
170 status = acpi_ec_read_status(ec); 280 status = acpi_ec_read_status(ec);
171 if (status != -EINVAL && 281 if (status != -EINVAL &&
172 !(status & ACPI_EC_FLAG_BURST)){ 282 !(status & ACPI_EC_FLAG_BURST)){
173 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); 283 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
174 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 284 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
175 if (status){ 285 if (status){
176 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 286 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
177 return_VALUE(-EINVAL); 287 return_VALUE(-EINVAL);
178 } 288 }
179 acpi_hw_low_level_read(8, &tmp, &ec->data_addr); 289 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
180 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 290 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
181 if(tmp != 0x90 ) {/* Burst ACK byte*/ 291 if(tmp != 0x90 ) {/* Burst ACK byte*/
182 return_VALUE(-EINVAL); 292 return_VALUE(-EINVAL);
183 } 293 }
184 } 294 }
185 295
186 atomic_set(&ec->leaving_burst , 0); 296 atomic_set(&ec->burst.leaving_burst , 0);
187 return_VALUE(0); 297 return_VALUE(0);
188} 298}
189 299
190static int 300static int
191acpi_ec_leave_burst_mode ( 301acpi_ec_leave_burst_mode (
192 struct acpi_ec *ec) 302 union acpi_ec *ec)
193{ 303{
194 int status =0; 304 int status =0;
195 305
196 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); 306 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
197 307
198 atomic_set(&ec->leaving_burst , 1); 308 atomic_set(&ec->burst.leaving_burst , 1);
199 status = acpi_ec_read_status(ec); 309 status = acpi_ec_read_status(ec);
200 if (status != -EINVAL && 310 if (status != -EINVAL &&
201 (status & ACPI_EC_FLAG_BURST)){ 311 (status & ACPI_EC_FLAG_BURST)){
202 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr); 312 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
203 status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); 313 status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
204 if (status){ 314 if (status){
205 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 315 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
206 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); 316 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n"));
207 return_VALUE(-EINVAL); 317 return_VALUE(-EINVAL);
208 } 318 }
209 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 319 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
210 status = acpi_ec_read_status(ec); 320 status = acpi_ec_read_status(ec);
211 } 321 }
212 322
@@ -215,7 +325,131 @@ acpi_ec_leave_burst_mode (
215 325
216static int 326static int
217acpi_ec_read ( 327acpi_ec_read (
218 struct acpi_ec *ec, 328 union acpi_ec *ec,
329 u8 address,
330 u32 *data)
331{
332 if (acpi_ec_polling_mode)
333 return acpi_ec_polling_read(ec, address, data);
334 else
335 return acpi_ec_burst_read(ec, address, data);
336}
337static int
338acpi_ec_write (
339 union acpi_ec *ec,
340 u8 address,
341 u8 data)
342{
343 if (acpi_ec_polling_mode)
344 return acpi_ec_polling_write(ec, address, data);
345 else
346 return acpi_ec_burst_write(ec, address, data);
347}
348static int
349acpi_ec_polling_read (
350 union acpi_ec *ec,
351 u8 address,
352 u32 *data)
353{
354 acpi_status status = AE_OK;
355 int result = 0;
356 unsigned long flags = 0;
357 u32 glk = 0;
358
359 ACPI_FUNCTION_TRACE("acpi_ec_read");
360
361 if (!ec || !data)
362 return_VALUE(-EINVAL);
363
364 *data = 0;
365
366 if (ec->common.global_lock) {
367 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
368 if (ACPI_FAILURE(status))
369 return_VALUE(-ENODEV);
370 }
371
372 spin_lock_irqsave(&ec->polling.lock, flags);
373
374 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
375 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
376 if (result)
377 goto end;
378
379 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
380 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
381 if (result)
382 goto end;
383
384 acpi_hw_low_level_read(8, data, &ec->common.data_addr);
385
386 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
387 *data, address));
388
389end:
390 spin_unlock_irqrestore(&ec->polling.lock, flags);
391
392 if (ec->common.global_lock)
393 acpi_release_global_lock(glk);
394
395 return_VALUE(result);
396}
397
398
399static int
400acpi_ec_polling_write (
401 union acpi_ec *ec,
402 u8 address,
403 u8 data)
404{
405 int result = 0;
406 acpi_status status = AE_OK;
407 unsigned long flags = 0;
408 u32 glk = 0;
409
410 ACPI_FUNCTION_TRACE("acpi_ec_write");
411
412 if (!ec)
413 return_VALUE(-EINVAL);
414
415 if (ec->common.global_lock) {
416 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
417 if (ACPI_FAILURE(status))
418 return_VALUE(-ENODEV);
419 }
420
421 spin_lock_irqsave(&ec->polling.lock, flags);
422
423 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
424 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
425 if (result)
426 goto end;
427
428 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
429 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
430 if (result)
431 goto end;
432
433 acpi_hw_low_level_write(8, data, &ec->common.data_addr);
434 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
435 if (result)
436 goto end;
437
438 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
439 data, address));
440
441end:
442 spin_unlock_irqrestore(&ec->polling.lock, flags);
443
444 if (ec->common.global_lock)
445 acpi_release_global_lock(glk);
446
447 return_VALUE(result);
448}
449
450static int
451acpi_ec_burst_read (
452 union acpi_ec *ec,
219 u8 address, 453 u8 address,
220 u32 *data) 454 u32 *data)
221{ 455{
@@ -230,51 +464,51 @@ acpi_ec_read (
230retry: 464retry:
231 *data = 0; 465 *data = 0;
232 466
233 if (ec->global_lock) { 467 if (ec->common.global_lock) {
234 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 468 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
235 if (ACPI_FAILURE(status)) 469 if (ACPI_FAILURE(status))
236 return_VALUE(-ENODEV); 470 return_VALUE(-ENODEV);
237 } 471 }
238 472
239 WARN_ON(in_interrupt()); 473 WARN_ON(in_interrupt());
240 down(&ec->sem); 474 down(&ec->burst.sem);
241 475
242 if(acpi_ec_enter_burst_mode(ec)) 476 if(acpi_ec_enter_burst_mode(ec))
243 goto end; 477 goto end;
244 478
245 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); 479 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
246 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 480 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
247 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 481 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
248 if (status) { 482 if (status) {
249 goto end; 483 goto end;
250 } 484 }
251 485
252 acpi_hw_low_level_write(8, address, &ec->data_addr); 486 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
253 status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 487 status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
254 if (status){ 488 if (status){
255 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 489 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
256 goto end; 490 goto end;
257 } 491 }
258 492
259 acpi_hw_low_level_read(8, data, &ec->data_addr); 493 acpi_hw_low_level_read(8, data, &ec->common.data_addr);
260 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 494 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
261 495
262 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", 496 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
263 *data, address)); 497 *data, address));
264 498
265end: 499end:
266 acpi_ec_leave_burst_mode(ec); 500 acpi_ec_leave_burst_mode(ec);
267 up(&ec->sem); 501 up(&ec->burst.sem);
268 502
269 if (ec->global_lock) 503 if (ec->common.global_lock)
270 acpi_release_global_lock(glk); 504 acpi_release_global_lock(glk);
271 505
272 if(atomic_read(&ec->leaving_burst) == 2){ 506 if(atomic_read(&ec->burst.leaving_burst) == 2){
273 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 507 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
274 while(atomic_read(&ec->pending_gpe)){ 508 while(atomic_read(&ec->burst.pending_gpe)){
275 msleep(1); 509 msleep(1);
276 } 510 }
277 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 511 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
278 goto retry; 512 goto retry;
279 } 513 }
280 514
@@ -283,8 +517,8 @@ end:
283 517
284 518
285static int 519static int
286acpi_ec_write ( 520acpi_ec_burst_write (
287 struct acpi_ec *ec, 521 union acpi_ec *ec,
288 u8 address, 522 u8 address,
289 u8 data) 523 u8 data)
290{ 524{
@@ -297,14 +531,14 @@ acpi_ec_write (
297 if (!ec) 531 if (!ec)
298 return_VALUE(-EINVAL); 532 return_VALUE(-EINVAL);
299retry: 533retry:
300 if (ec->global_lock) { 534 if (ec->common.global_lock) {
301 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 535 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
302 if (ACPI_FAILURE(status)) 536 if (ACPI_FAILURE(status))
303 return_VALUE(-ENODEV); 537 return_VALUE(-ENODEV);
304 } 538 }
305 539
306 WARN_ON(in_interrupt()); 540 WARN_ON(in_interrupt());
307 down(&ec->sem); 541 down(&ec->burst.sem);
308 542
309 if(acpi_ec_enter_burst_mode(ec)) 543 if(acpi_ec_enter_burst_mode(ec))
310 goto end; 544 goto end;
@@ -312,33 +546,33 @@ retry:
312 status = acpi_ec_read_status(ec); 546 status = acpi_ec_read_status(ec);
313 if (status != -EINVAL && 547 if (status != -EINVAL &&
314 !(status & ACPI_EC_FLAG_BURST)){ 548 !(status & ACPI_EC_FLAG_BURST)){
315 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); 549 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
316 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 550 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
317 if (status) 551 if (status)
318 goto end; 552 goto end;
319 acpi_hw_low_level_read(8, &tmp, &ec->data_addr); 553 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
320 if(tmp != 0x90 ) /* Burst ACK byte*/ 554 if(tmp != 0x90 ) /* Burst ACK byte*/
321 goto end; 555 goto end;
322 } 556 }
323 /*Now we are in burst mode*/ 557 /*Now we are in burst mode*/
324 558
325 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); 559 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
326 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 560 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
327 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 561 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
328 if (status){ 562 if (status){
329 goto end; 563 goto end;
330 } 564 }
331 565
332 acpi_hw_low_level_write(8, address, &ec->data_addr); 566 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
333 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 567 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
334 if (status){ 568 if (status){
335 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 569 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
336 goto end; 570 goto end;
337 } 571 }
338 572
339 acpi_hw_low_level_write(8, data, &ec->data_addr); 573 acpi_hw_low_level_write(8, data, &ec->common.data_addr);
340 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 574 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
341 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 575 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
342 if (status) 576 if (status)
343 goto end; 577 goto end;
344 578
@@ -347,17 +581,17 @@ retry:
347 581
348end: 582end:
349 acpi_ec_leave_burst_mode(ec); 583 acpi_ec_leave_burst_mode(ec);
350 up(&ec->sem); 584 up(&ec->burst.sem);
351 585
352 if (ec->global_lock) 586 if (ec->common.global_lock)
353 acpi_release_global_lock(glk); 587 acpi_release_global_lock(glk);
354 588
355 if(atomic_read(&ec->leaving_burst) == 2){ 589 if(atomic_read(&ec->burst.leaving_burst) == 2){
356 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 590 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
357 while(atomic_read(&ec->pending_gpe)){ 591 while(atomic_read(&ec->burst.pending_gpe)){
358 msleep(1); 592 msleep(1);
359 } 593 }
360 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 594 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
361 goto retry; 595 goto retry;
362 } 596 }
363 597
@@ -370,7 +604,7 @@ end:
370int 604int
371ec_read(u8 addr, u8 *val) 605ec_read(u8 addr, u8 *val)
372{ 606{
373 struct acpi_ec *ec; 607 union acpi_ec *ec;
374 int err; 608 int err;
375 u32 temp_data; 609 u32 temp_data;
376 610
@@ -393,7 +627,7 @@ EXPORT_SYMBOL(ec_read);
393int 627int
394ec_write(u8 addr, u8 val) 628ec_write(u8 addr, u8 val)
395{ 629{
396 struct acpi_ec *ec; 630 union acpi_ec *ec;
397 int err; 631 int err;
398 632
399 if (!first_ec) 633 if (!first_ec)
@@ -407,10 +641,66 @@ ec_write(u8 addr, u8 val)
407} 641}
408EXPORT_SYMBOL(ec_write); 642EXPORT_SYMBOL(ec_write);
409 643
410
411static int 644static int
412acpi_ec_query ( 645acpi_ec_query (
413 struct acpi_ec *ec, 646 union acpi_ec *ec,
647 u32 *data)
648{
649 if (acpi_ec_polling_mode)
650 return acpi_ec_polling_query(ec, data);
651 else
652 return acpi_ec_burst_query(ec, data);
653}
654static int
655acpi_ec_polling_query (
656 union acpi_ec *ec,
657 u32 *data)
658{
659 int result = 0;
660 acpi_status status = AE_OK;
661 unsigned long flags = 0;
662 u32 glk = 0;
663
664 ACPI_FUNCTION_TRACE("acpi_ec_query");
665
666 if (!ec || !data)
667 return_VALUE(-EINVAL);
668
669 *data = 0;
670
671 if (ec->common.global_lock) {
672 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
673 if (ACPI_FAILURE(status))
674 return_VALUE(-ENODEV);
675 }
676
677 /*
678 * Query the EC to find out which _Qxx method we need to evaluate.
679 * Note that successful completion of the query causes the ACPI_EC_SCI
680 * bit to be cleared (and thus clearing the interrupt source).
681 */
682 spin_lock_irqsave(&ec->polling.lock, flags);
683
684 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
685 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
686 if (result)
687 goto end;
688
689 acpi_hw_low_level_read(8, data, &ec->common.data_addr);
690 if (!*data)
691 result = -ENODATA;
692
693end:
694 spin_unlock_irqrestore(&ec->polling.lock, flags);
695
696 if (ec->common.global_lock)
697 acpi_release_global_lock(glk);
698
699 return_VALUE(result);
700}
701static int
702acpi_ec_burst_query (
703 union acpi_ec *ec,
414 u32 *data) 704 u32 *data)
415{ 705{
416 int status = 0; 706 int status = 0;
@@ -422,13 +712,13 @@ acpi_ec_query (
422 return_VALUE(-EINVAL); 712 return_VALUE(-EINVAL);
423 *data = 0; 713 *data = 0;
424 714
425 if (ec->global_lock) { 715 if (ec->common.global_lock) {
426 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 716 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
427 if (ACPI_FAILURE(status)) 717 if (ACPI_FAILURE(status))
428 return_VALUE(-ENODEV); 718 return_VALUE(-ENODEV);
429 } 719 }
430 720
431 down(&ec->sem); 721 down(&ec->burst.sem);
432 if(acpi_ec_enter_burst_mode(ec)) 722 if(acpi_ec_enter_burst_mode(ec))
433 goto end; 723 goto end;
434 /* 724 /*
@@ -436,28 +726,28 @@ acpi_ec_query (
436 * Note that successful completion of the query causes the ACPI_EC_SCI 726 * Note that successful completion of the query causes the ACPI_EC_SCI
437 * bit to be cleared (and thus clearing the interrupt source). 727 * bit to be cleared (and thus clearing the interrupt source).
438 */ 728 */
439 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); 729 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
440 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 730 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
441 if (status){ 731 if (status){
442 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 732 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
443 goto end; 733 goto end;
444 } 734 }
445 735
446 acpi_hw_low_level_read(8, data, &ec->data_addr); 736 acpi_hw_low_level_read(8, data, &ec->common.data_addr);
447 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 737 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
448 if (!*data) 738 if (!*data)
449 status = -ENODATA; 739 status = -ENODATA;
450 740
451end: 741end:
452 acpi_ec_leave_burst_mode(ec); 742 acpi_ec_leave_burst_mode(ec);
453 up(&ec->sem); 743 up(&ec->burst.sem);
454 744
455 if (ec->global_lock) 745 if (ec->common.global_lock)
456 acpi_release_global_lock(glk); 746 acpi_release_global_lock(glk);
457 747
458 if(atomic_read(&ec->leaving_burst) == 2){ 748 if(atomic_read(&ec->burst.leaving_burst) == 2){
459 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 749 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
460 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 750 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
461 status = -ENODATA; 751 status = -ENODATA;
462 } 752 }
463 return_VALUE(status); 753 return_VALUE(status);
@@ -468,7 +758,7 @@ end:
468 Event Management 758 Event Management
469 -------------------------------------------------------------------------- */ 759 -------------------------------------------------------------------------- */
470 760
471struct acpi_ec_query_data { 761union acpi_ec_query_data {
472 acpi_handle handle; 762 acpi_handle handle;
473 u8 data; 763 u8 data;
474}; 764};
@@ -477,7 +767,59 @@ static void
477acpi_ec_gpe_query ( 767acpi_ec_gpe_query (
478 void *ec_cxt) 768 void *ec_cxt)
479{ 769{
480 struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; 770 if (acpi_ec_polling_mode)
771 acpi_ec_gpe_polling_query(ec_cxt);
772 else
773 acpi_ec_gpe_burst_query(ec_cxt);
774}
775
776static void
777acpi_ec_gpe_polling_query (
778 void *ec_cxt)
779{
780 union acpi_ec *ec = (union acpi_ec *) ec_cxt;
781 u32 value = 0;
782 unsigned long flags = 0;
783 static char object_name[5] = {'_','Q','0','0','\0'};
784 const char hex[] = {'0','1','2','3','4','5','6','7',
785 '8','9','A','B','C','D','E','F'};
786
787 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
788
789 if (!ec_cxt)
790 goto end;
791
792 spin_lock_irqsave(&ec->polling.lock, flags);
793 acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
794 spin_unlock_irqrestore(&ec->polling.lock, flags);
795
796 /* TBD: Implement asynch events!
797 * NOTE: All we care about are EC-SCI's. Other EC events are
798 * handled via polling (yuck!). This is because some systems
799 * treat EC-SCIs as level (versus EDGE!) triggered, preventing
800 * a purely interrupt-driven approach (grumble, grumble).
801 */
802 if (!(value & ACPI_EC_FLAG_SCI))
803 goto end;
804
805 if (acpi_ec_query(ec, &value))
806 goto end;
807
808 object_name[2] = hex[((value >> 4) & 0x0F)];
809 object_name[3] = hex[(value & 0x0F)];
810
811 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
812
813 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
814
815end:
816 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
817}
818static void
819acpi_ec_gpe_burst_query (
820 void *ec_cxt)
821{
822 union acpi_ec *ec = (union acpi_ec *) ec_cxt;
481 u32 value; 823 u32 value;
482 int result = -ENODATA; 824 int result = -ENODATA;
483 static char object_name[5] = {'_','Q','0','0','\0'}; 825 static char object_name[5] = {'_','Q','0','0','\0'};
@@ -497,9 +839,9 @@ acpi_ec_gpe_query (
497 839
498 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); 840 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
499 841
500 acpi_evaluate_object(ec->handle, object_name, NULL, NULL); 842 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
501end: 843end:
502 atomic_dec(&ec->pending_gpe); 844 atomic_dec(&ec->burst.pending_gpe);
503 return; 845 return;
504} 846}
505 847
@@ -507,48 +849,77 @@ static u32
507acpi_ec_gpe_handler ( 849acpi_ec_gpe_handler (
508 void *data) 850 void *data)
509{ 851{
852 if (acpi_ec_polling_mode)
853 return acpi_ec_gpe_polling_handler(data);
854 else
855 return acpi_ec_gpe_burst_handler(data);
856}
857static u32
858acpi_ec_gpe_polling_handler (
859 void *data)
860{
861 acpi_status status = AE_OK;
862 union acpi_ec *ec = (union acpi_ec *) data;
863
864 if (!ec)
865 return ACPI_INTERRUPT_NOT_HANDLED;
866
867 acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
868
869 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
870 acpi_ec_gpe_query, ec);
871
872 if (status == AE_OK)
873 return ACPI_INTERRUPT_HANDLED;
874 else
875 return ACPI_INTERRUPT_NOT_HANDLED;
876}
877static u32
878acpi_ec_gpe_burst_handler (
879 void *data)
880{
510 acpi_status status = AE_OK; 881 acpi_status status = AE_OK;
511 u32 value; 882 u32 value;
512 struct acpi_ec *ec = (struct acpi_ec *) data; 883 union acpi_ec *ec = (union acpi_ec *) data;
513 884
514 if (!ec) 885 if (!ec)
515 return ACPI_INTERRUPT_NOT_HANDLED; 886 return ACPI_INTERRUPT_NOT_HANDLED;
516 887
517 acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); 888 acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
518 889
519 value = acpi_ec_read_status(ec); 890 value = acpi_ec_read_status(ec);
520 891
521 if((value & ACPI_EC_FLAG_IBF) && 892 if((value & ACPI_EC_FLAG_IBF) &&
522 !(value & ACPI_EC_FLAG_BURST) && 893 !(value & ACPI_EC_FLAG_BURST) &&
523 (atomic_read(&ec->leaving_burst) == 0)) { 894 (atomic_read(&ec->burst.leaving_burst) == 0)) {
524 /* 895 /*
525 * the embedded controller disables 896 * the embedded controller disables
526 * burst mode for any reason other 897 * burst mode for any reason other
527 * than the burst disable command 898 * than the burst disable command
528 * to process critical event. 899 * to process critical event.
529 */ 900 */
530 atomic_set(&ec->leaving_burst , 2); /* block current pending transaction 901 atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction
531 and retry */ 902 and retry */
532 wake_up(&ec->wait); 903 wake_up(&ec->burst.wait);
533 }else { 904 }else {
534 if ((ec->expect_event == ACPI_EC_EVENT_OBF && 905 if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF &&
535 (value & ACPI_EC_FLAG_OBF)) || 906 (value & ACPI_EC_FLAG_OBF)) ||
536 (ec->expect_event == ACPI_EC_EVENT_IBE && 907 (ec->burst.expect_event == ACPI_EC_EVENT_IBE &&
537 !(value & ACPI_EC_FLAG_IBF))) { 908 !(value & ACPI_EC_FLAG_IBF))) {
538 ec->expect_event = 0; 909 ec->burst.expect_event = 0;
539 wake_up(&ec->wait); 910 wake_up(&ec->burst.wait);
540 return ACPI_INTERRUPT_HANDLED; 911 return ACPI_INTERRUPT_HANDLED;
541 } 912 }
542 } 913 }
543 914
544 if (value & ACPI_EC_FLAG_SCI){ 915 if (value & ACPI_EC_FLAG_SCI){
545 atomic_add(1, &ec->pending_gpe) ; 916 atomic_add(1, &ec->burst.pending_gpe) ;
546 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, 917 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
547 acpi_ec_gpe_query, ec); 918 acpi_ec_gpe_query, ec);
548 return status == AE_OK ? 919 return status == AE_OK ?
549 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 920 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
550 } 921 }
551 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR); 922 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
552 return status == AE_OK ? 923 return status == AE_OK ?
553 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 924 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
554} 925}
@@ -585,7 +956,7 @@ acpi_ec_space_handler (
585 void *region_context) 956 void *region_context)
586{ 957{
587 int result = 0; 958 int result = 0;
588 struct acpi_ec *ec = NULL; 959 union acpi_ec *ec = NULL;
589 u64 temp = *value; 960 u64 temp = *value;
590 acpi_integer f_v = 0; 961 acpi_integer f_v = 0;
591 int i = 0; 962 int i = 0;
@@ -600,7 +971,7 @@ acpi_ec_space_handler (
600 return_VALUE(AE_BAD_PARAMETER); 971 return_VALUE(AE_BAD_PARAMETER);
601 } 972 }
602 973
603 ec = (struct acpi_ec *) handler_context; 974 ec = (union acpi_ec *) handler_context;
604 975
605next_byte: 976next_byte:
606 switch (function) { 977 switch (function) {
@@ -661,7 +1032,7 @@ static struct proc_dir_entry *acpi_ec_dir;
661static int 1032static int
662acpi_ec_read_info (struct seq_file *seq, void *offset) 1033acpi_ec_read_info (struct seq_file *seq, void *offset)
663{ 1034{
664 struct acpi_ec *ec = (struct acpi_ec *) seq->private; 1035 union acpi_ec *ec = (union acpi_ec *) seq->private;
665 1036
666 ACPI_FUNCTION_TRACE("acpi_ec_read_info"); 1037 ACPI_FUNCTION_TRACE("acpi_ec_read_info");
667 1038
@@ -669,12 +1040,12 @@ acpi_ec_read_info (struct seq_file *seq, void *offset)
669 goto end; 1040 goto end;
670 1041
671 seq_printf(seq, "gpe bit: 0x%02x\n", 1042 seq_printf(seq, "gpe bit: 0x%02x\n",
672 (u32) ec->gpe_bit); 1043 (u32) ec->common.gpe_bit);
673 seq_printf(seq, "ports: 0x%02x, 0x%02x\n", 1044 seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
674 (u32) ec->status_addr.address, (u32) ec->data_addr.address); 1045 (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address);
675 seq_printf(seq, "use global lock: %s\n", 1046 seq_printf(seq, "use global lock: %s\n",
676 ec->global_lock?"yes":"no"); 1047 ec->common.global_lock?"yes":"no");
677 acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); 1048 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
678 1049
679end: 1050end:
680 return_VALUE(0); 1051 return_VALUE(0);
@@ -697,7 +1068,7 @@ static int
697acpi_ec_add_fs ( 1068acpi_ec_add_fs (
698 struct acpi_device *device) 1069 struct acpi_device *device)
699{ 1070{
700 struct proc_dir_entry *entry; 1071 struct proc_dir_entry *entry = NULL;
701 1072
702 ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); 1073 ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
703 1074
@@ -744,13 +1115,14 @@ acpi_ec_remove_fs (
744 Driver Interface 1115 Driver Interface
745 -------------------------------------------------------------------------- */ 1116 -------------------------------------------------------------------------- */
746 1117
1118
747static int 1119static int
748acpi_ec_add ( 1120acpi_ec_polling_add (
749 struct acpi_device *device) 1121 struct acpi_device *device)
750{ 1122{
751 int result; 1123 int result = 0;
752 acpi_status status; 1124 acpi_status status = AE_OK;
753 struct acpi_ec *ec; 1125 union acpi_ec *ec = NULL;
754 unsigned long uid; 1126 unsigned long uid;
755 1127
756 ACPI_FUNCTION_TRACE("acpi_ec_add"); 1128 ACPI_FUNCTION_TRACE("acpi_ec_add");
@@ -758,39 +1130,107 @@ acpi_ec_add (
758 if (!device) 1130 if (!device)
759 return_VALUE(-EINVAL); 1131 return_VALUE(-EINVAL);
760 1132
761 ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 1133 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
762 if (!ec) 1134 if (!ec)
763 return_VALUE(-ENOMEM); 1135 return_VALUE(-ENOMEM);
764 memset(ec, 0, sizeof(struct acpi_ec)); 1136 memset(ec, 0, sizeof(union acpi_ec));
765 1137
766 ec->handle = device->handle; 1138 ec->common.handle = device->handle;
767 ec->uid = -1; 1139 ec->common.uid = -1;
768 atomic_set(&ec->pending_gpe, 0); 1140 spin_lock_init(&ec->polling.lock);
769 atomic_set(&ec->leaving_burst , 1);
770 init_MUTEX(&ec->sem);
771 init_waitqueue_head(&ec->wait);
772 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1141 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
773 strcpy(acpi_device_class(device), ACPI_EC_CLASS); 1142 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
774 acpi_driver_data(device) = ec; 1143 acpi_driver_data(device) = ec;
775 1144
776 /* Use the global lock for all EC transactions? */ 1145 /* Use the global lock for all EC transactions? */
777 acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); 1146 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
778 1147
779 /* If our UID matches the UID for the ECDT-enumerated EC, 1148 /* If our UID matches the UID for the ECDT-enumerated EC,
780 we now have the *real* EC info, so kill the makeshift one.*/ 1149 we now have the *real* EC info, so kill the makeshift one.*/
781 acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid); 1150 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
782 if (ec_ecdt && ec_ecdt->uid == uid) { 1151 if (ec_ecdt && ec_ecdt->common.uid == uid) {
783 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, 1152 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
784 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); 1153 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
1154
1155 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
1156
1157 kfree(ec_ecdt);
1158 }
1159
1160 /* Get GPE bit assignment (EC events). */
1161 /* TODO: Add support for _GPE returning a package */
1162 status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
1163 if (ACPI_FAILURE(status)) {
1164 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1165 "Error obtaining GPE bit assignment\n"));
1166 result = -ENODEV;
1167 goto end;
1168 }
785 1169
786 acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); 1170 result = acpi_ec_add_fs(device);
1171 if (result)
1172 goto end;
1173
1174 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
1175 acpi_device_name(device), acpi_device_bid(device),
1176 (u32) ec->common.gpe_bit);
1177
1178 if (!first_ec)
1179 first_ec = device;
1180
1181end:
1182 if (result)
1183 kfree(ec);
1184
1185 return_VALUE(result);
1186}
1187static int
1188acpi_ec_burst_add (
1189 struct acpi_device *device)
1190{
1191 int result = 0;
1192 acpi_status status = AE_OK;
1193 union acpi_ec *ec = NULL;
1194 unsigned long uid;
1195
1196 ACPI_FUNCTION_TRACE("acpi_ec_add");
1197
1198 if (!device)
1199 return_VALUE(-EINVAL);
1200
1201 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1202 if (!ec)
1203 return_VALUE(-ENOMEM);
1204 memset(ec, 0, sizeof(union acpi_ec));
1205
1206 ec->common.handle = device->handle;
1207 ec->common.uid = -1;
1208 atomic_set(&ec->burst.pending_gpe, 0);
1209 atomic_set(&ec->burst.leaving_burst , 1);
1210 init_MUTEX(&ec->burst.sem);
1211 init_waitqueue_head(&ec->burst.wait);
1212 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
1213 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
1214 acpi_driver_data(device) = ec;
1215
1216 /* Use the global lock for all EC transactions? */
1217 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
1218
1219 /* If our UID matches the UID for the ECDT-enumerated EC,
1220 we now have the *real* EC info, so kill the makeshift one.*/
1221 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
1222 if (ec_ecdt && ec_ecdt->common.uid == uid) {
1223 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
1224 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
1225
1226 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
787 1227
788 kfree(ec_ecdt); 1228 kfree(ec_ecdt);
789 } 1229 }
790 1230
791 /* Get GPE bit assignment (EC events). */ 1231 /* Get GPE bit assignment (EC events). */
792 /* TODO: Add support for _GPE returning a package */ 1232 /* TODO: Add support for _GPE returning a package */
793 status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit); 1233 status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
794 if (ACPI_FAILURE(status)) { 1234 if (ACPI_FAILURE(status)) {
795 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1235 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
796 "Error obtaining GPE bit assignment\n")); 1236 "Error obtaining GPE bit assignment\n"));
@@ -804,7 +1244,7 @@ acpi_ec_add (
804 1244
805 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", 1245 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
806 acpi_device_name(device), acpi_device_bid(device), 1246 acpi_device_name(device), acpi_device_bid(device),
807 (u32) ec->gpe_bit); 1247 (u32) ec->common.gpe_bit);
808 1248
809 if (!first_ec) 1249 if (!first_ec)
810 first_ec = device; 1250 first_ec = device;
@@ -822,7 +1262,7 @@ acpi_ec_remove (
822 struct acpi_device *device, 1262 struct acpi_device *device,
823 int type) 1263 int type)
824{ 1264{
825 struct acpi_ec *ec; 1265 union acpi_ec *ec = NULL;
826 1266
827 ACPI_FUNCTION_TRACE("acpi_ec_remove"); 1267 ACPI_FUNCTION_TRACE("acpi_ec_remove");
828 1268
@@ -844,7 +1284,7 @@ acpi_ec_io_ports (
844 struct acpi_resource *resource, 1284 struct acpi_resource *resource,
845 void *context) 1285 void *context)
846{ 1286{
847 struct acpi_ec *ec = (struct acpi_ec *) context; 1287 union acpi_ec *ec = (union acpi_ec *) context;
848 struct acpi_generic_address *addr; 1288 struct acpi_generic_address *addr;
849 1289
850 if (resource->id != ACPI_RSTYPE_IO) { 1290 if (resource->id != ACPI_RSTYPE_IO) {
@@ -856,10 +1296,10 @@ acpi_ec_io_ports (
856 * the second address region returned is the status/command 1296 * the second address region returned is the status/command
857 * port. 1297 * port.
858 */ 1298 */
859 if (ec->data_addr.register_bit_width == 0) { 1299 if (ec->common.data_addr.register_bit_width == 0) {
860 addr = &ec->data_addr; 1300 addr = &ec->common.data_addr;
861 } else if (ec->command_addr.register_bit_width == 0) { 1301 } else if (ec->common.command_addr.register_bit_width == 0) {
862 addr = &ec->command_addr; 1302 addr = &ec->common.command_addr;
863 } else { 1303 } else {
864 return AE_CTRL_TERMINATE; 1304 return AE_CTRL_TERMINATE;
865 } 1305 }
@@ -877,8 +1317,8 @@ static int
877acpi_ec_start ( 1317acpi_ec_start (
878 struct acpi_device *device) 1318 struct acpi_device *device)
879{ 1319{
880 acpi_status status; 1320 acpi_status status = AE_OK;
881 struct acpi_ec *ec; 1321 union acpi_ec *ec = NULL;
882 1322
883 ACPI_FUNCTION_TRACE("acpi_ec_start"); 1323 ACPI_FUNCTION_TRACE("acpi_ec_start");
884 1324
@@ -893,35 +1333,36 @@ acpi_ec_start (
893 /* 1333 /*
894 * Get I/O port addresses. Convert to GAS format. 1334 * Get I/O port addresses. Convert to GAS format.
895 */ 1335 */
896 status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS, 1336 status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS,
897 acpi_ec_io_ports, ec); 1337 acpi_ec_io_ports, ec);
898 if (ACPI_FAILURE(status) || ec->command_addr.register_bit_width == 0) { 1338 if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) {
899 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); 1339 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses"));
900 return_VALUE(-ENODEV); 1340 return_VALUE(-ENODEV);
901 } 1341 }
902 1342
903 ec->status_addr = ec->command_addr; 1343 ec->common.status_addr = ec->common.command_addr;
904 1344
905 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", 1345 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",
906 (u32) ec->gpe_bit, (u32) ec->command_addr.address, 1346 (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address,
907 (u32) ec->data_addr.address)); 1347 (u32) ec->common.data_addr.address));
1348
908 1349
909 /* 1350 /*
910 * Install GPE handler 1351 * Install GPE handler
911 */ 1352 */
912 status = acpi_install_gpe_handler(NULL, ec->gpe_bit, 1353 status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit,
913 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); 1354 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec);
914 if (ACPI_FAILURE(status)) { 1355 if (ACPI_FAILURE(status)) {
915 return_VALUE(-ENODEV); 1356 return_VALUE(-ENODEV);
916 } 1357 }
917 acpi_set_gpe_type (NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME); 1358 acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
918 acpi_enable_gpe (NULL, ec->gpe_bit, ACPI_NOT_ISR); 1359 acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
919 1360
920 status = acpi_install_address_space_handler (ec->handle, 1361 status = acpi_install_address_space_handler (ec->common.handle,
921 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, 1362 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
922 &acpi_ec_space_setup, ec); 1363 &acpi_ec_space_setup, ec);
923 if (ACPI_FAILURE(status)) { 1364 if (ACPI_FAILURE(status)) {
924 acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); 1365 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
925 return_VALUE(-ENODEV); 1366 return_VALUE(-ENODEV);
926 } 1367 }
927 1368
@@ -934,8 +1375,8 @@ acpi_ec_stop (
934 struct acpi_device *device, 1375 struct acpi_device *device,
935 int type) 1376 int type)
936{ 1377{
937 acpi_status status; 1378 acpi_status status = AE_OK;
938 struct acpi_ec *ec; 1379 union acpi_ec *ec = NULL;
939 1380
940 ACPI_FUNCTION_TRACE("acpi_ec_stop"); 1381 ACPI_FUNCTION_TRACE("acpi_ec_stop");
941 1382
@@ -944,12 +1385,12 @@ acpi_ec_stop (
944 1385
945 ec = acpi_driver_data(device); 1386 ec = acpi_driver_data(device);
946 1387
947 status = acpi_remove_address_space_handler(ec->handle, 1388 status = acpi_remove_address_space_handler(ec->common.handle,
948 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); 1389 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
949 if (ACPI_FAILURE(status)) 1390 if (ACPI_FAILURE(status))
950 return_VALUE(-ENODEV); 1391 return_VALUE(-ENODEV);
951 1392
952 status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); 1393 status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
953 if (ACPI_FAILURE(status)) 1394 if (ACPI_FAILURE(status))
954 return_VALUE(-ENODEV); 1395 return_VALUE(-ENODEV);
955 1396
@@ -963,26 +1404,76 @@ acpi_fake_ecdt_callback (
963 void *context, 1404 void *context,
964 void **retval) 1405 void **retval)
965{ 1406{
1407
1408 if (acpi_ec_polling_mode)
1409 return acpi_fake_ecdt_polling_callback(handle,
1410 Level, context, retval);
1411 else
1412 return acpi_fake_ecdt_burst_callback(handle,
1413 Level, context, retval);
1414}
1415
1416static acpi_status __init
1417acpi_fake_ecdt_polling_callback (
1418 acpi_handle handle,
1419 u32 Level,
1420 void *context,
1421 void **retval)
1422{
966 acpi_status status; 1423 acpi_status status;
967 1424
968 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 1425 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
969 acpi_ec_io_ports, ec_ecdt); 1426 acpi_ec_io_ports, ec_ecdt);
970 if (ACPI_FAILURE(status)) 1427 if (ACPI_FAILURE(status))
971 return status; 1428 return status;
972 ec_ecdt->status_addr = ec_ecdt->command_addr; 1429 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
973 1430
974 ec_ecdt->uid = -1; 1431 ec_ecdt->common.uid = -1;
975 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); 1432 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
976 1433
977 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); 1434 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
978 if (ACPI_FAILURE(status)) 1435 if (ACPI_FAILURE(status))
979 return status; 1436 return status;
980 ec_ecdt->global_lock = TRUE; 1437 spin_lock_init(&ec_ecdt->polling.lock);
981 ec_ecdt->handle = handle; 1438 ec_ecdt->common.global_lock = TRUE;
1439 ec_ecdt->common.handle = handle;
982 1440
983 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", 1441 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
984 (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address, 1442 (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
985 (u32) ec_ecdt->data_addr.address); 1443 (u32) ec_ecdt->common.data_addr.address);
1444
1445 return AE_CTRL_TERMINATE;
1446}
1447
1448static acpi_status __init
1449acpi_fake_ecdt_burst_callback (
1450 acpi_handle handle,
1451 u32 Level,
1452 void *context,
1453 void **retval)
1454{
1455 acpi_status status;
1456
1457 init_MUTEX(&ec_ecdt->burst.sem);
1458 init_waitqueue_head(&ec_ecdt->burst.wait);
1459 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
1460 acpi_ec_io_ports, ec_ecdt);
1461 if (ACPI_FAILURE(status))
1462 return status;
1463 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
1464
1465 ec_ecdt->common.uid = -1;
1466 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
1467
1468 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
1469 if (ACPI_FAILURE(status))
1470 return status;
1471 ec_ecdt->common.global_lock = TRUE;
1472 ec_ecdt->common.handle = handle;
1473
1474 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
1475 (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
1476 (u32) ec_ecdt->common.data_addr.address);
986 1477
987 return AE_CTRL_TERMINATE; 1478 return AE_CTRL_TERMINATE;
988} 1479}
@@ -1005,12 +1496,12 @@ acpi_ec_fake_ecdt(void)
1005 1496
1006 printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); 1497 printk(KERN_INFO PREFIX "Try to make an fake ECDT\n");
1007 1498
1008 ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 1499 ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1009 if (!ec_ecdt) { 1500 if (!ec_ecdt) {
1010 ret = -ENOMEM; 1501 ret = -ENOMEM;
1011 goto error; 1502 goto error;
1012 } 1503 }
1013 memset(ec_ecdt, 0, sizeof(struct acpi_ec)); 1504 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1014 1505
1015 status = acpi_get_devices (ACPI_EC_HID, 1506 status = acpi_get_devices (ACPI_EC_HID,
1016 acpi_fake_ecdt_callback, 1507 acpi_fake_ecdt_callback,
@@ -1031,6 +1522,60 @@ error:
1031static int __init 1522static int __init
1032acpi_ec_get_real_ecdt(void) 1523acpi_ec_get_real_ecdt(void)
1033{ 1524{
1525 if (acpi_ec_polling_mode)
1526 return acpi_ec_polling_get_real_ecdt();
1527 else
1528 return acpi_ec_burst_get_real_ecdt();
1529}
1530
1531static int __init
1532acpi_ec_polling_get_real_ecdt(void)
1533{
1534 acpi_status status;
1535 struct acpi_table_ecdt *ecdt_ptr;
1536
1537 status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
1538 (struct acpi_table_header **) &ecdt_ptr);
1539 if (ACPI_FAILURE(status))
1540 return -ENODEV;
1541
1542 printk(KERN_INFO PREFIX "Found ECDT\n");
1543
1544 /*
1545 * Generate a temporary ec context to use until the namespace is scanned
1546 */
1547 ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1548 if (!ec_ecdt)
1549 return -ENOMEM;
1550 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1551
1552 ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
1553 ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
1554 ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
1555 ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;
1556 spin_lock_init(&ec_ecdt->polling.lock);
1557 /* use the GL just to be safe */
1558 ec_ecdt->common.global_lock = TRUE;
1559 ec_ecdt->common.uid = ecdt_ptr->uid;
1560
1561 status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
1562 if (ACPI_FAILURE(status)) {
1563 goto error;
1564 }
1565
1566 return 0;
1567error:
1568 printk(KERN_ERR PREFIX "Could not use ECDT\n");
1569 kfree(ec_ecdt);
1570 ec_ecdt = NULL;
1571
1572 return -ENODEV;
1573}
1574
1575
1576static int __init
1577acpi_ec_burst_get_real_ecdt(void)
1578{
1034 acpi_status status; 1579 acpi_status status;
1035 struct acpi_table_ecdt *ecdt_ptr; 1580 struct acpi_table_ecdt *ecdt_ptr;
1036 1581
@@ -1044,22 +1589,22 @@ acpi_ec_get_real_ecdt(void)
1044 /* 1589 /*
1045 * Generate a temporary ec context to use until the namespace is scanned 1590 * Generate a temporary ec context to use until the namespace is scanned
1046 */ 1591 */
1047 ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 1592 ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1048 if (!ec_ecdt) 1593 if (!ec_ecdt)
1049 return -ENOMEM; 1594 return -ENOMEM;
1050 memset(ec_ecdt, 0, sizeof(struct acpi_ec)); 1595 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1051 1596
1052 init_MUTEX(&ec_ecdt->sem); 1597 init_MUTEX(&ec_ecdt->burst.sem);
1053 init_waitqueue_head(&ec_ecdt->wait); 1598 init_waitqueue_head(&ec_ecdt->burst.wait);
1054 ec_ecdt->command_addr = ecdt_ptr->ec_control; 1599 ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
1055 ec_ecdt->status_addr = ecdt_ptr->ec_control; 1600 ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
1056 ec_ecdt->data_addr = ecdt_ptr->ec_data; 1601 ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
1057 ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; 1602 ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;
1058 /* use the GL just to be safe */ 1603 /* use the GL just to be safe */
1059 ec_ecdt->global_lock = TRUE; 1604 ec_ecdt->common.global_lock = TRUE;
1060 ec_ecdt->uid = ecdt_ptr->uid; 1605 ec_ecdt->common.uid = ecdt_ptr->uid;
1061 1606
1062 status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); 1607 status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
1063 if (ACPI_FAILURE(status)) { 1608 if (ACPI_FAILURE(status)) {
1064 goto error; 1609 goto error;
1065 } 1610 }
@@ -1092,20 +1637,20 @@ acpi_ec_ecdt_probe (void)
1092 /* 1637 /*
1093 * Install GPE handler 1638 * Install GPE handler
1094 */ 1639 */
1095 status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, 1640 status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1096 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, 1641 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler,
1097 ec_ecdt); 1642 ec_ecdt);
1098 if (ACPI_FAILURE(status)) { 1643 if (ACPI_FAILURE(status)) {
1099 goto error; 1644 goto error;
1100 } 1645 }
1101 acpi_set_gpe_type (NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME); 1646 acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
1102 acpi_enable_gpe (NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR); 1647 acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);
1103 1648
1104 status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, 1649 status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT,
1105 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, 1650 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
1106 &acpi_ec_space_setup, ec_ecdt); 1651 &acpi_ec_space_setup, ec_ecdt);
1107 if (ACPI_FAILURE(status)) { 1652 if (ACPI_FAILURE(status)) {
1108 acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, 1653 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1109 &acpi_ec_gpe_handler); 1654 &acpi_ec_gpe_handler);
1110 goto error; 1655 goto error;
1111 } 1656 }
@@ -1123,7 +1668,7 @@ error:
1123 1668
1124static int __init acpi_ec_init (void) 1669static int __init acpi_ec_init (void)
1125{ 1670{
1126 int result; 1671 int result = 0;
1127 1672
1128 ACPI_FUNCTION_TRACE("acpi_ec_init"); 1673 ACPI_FUNCTION_TRACE("acpi_ec_init");
1129 1674
@@ -1166,4 +1711,24 @@ static int __init acpi_fake_ecdt_setup(char *str)
1166 acpi_fake_ecdt_enabled = 1; 1711 acpi_fake_ecdt_enabled = 1;
1167 return 0; 1712 return 0;
1168} 1713}
1714
1169__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); 1715__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);
1716static int __init acpi_ec_set_polling_mode(char *str)
1717{
1718 int burst;
1719
1720 if (!get_option(&str, &burst))
1721 return 0;
1722
1723 if (burst) {
1724 acpi_ec_polling_mode = EC_BURST;
1725 acpi_ec_driver.ops.add = acpi_ec_burst_add;
1726 } else {
1727 acpi_ec_polling_mode = EC_POLLING;
1728 acpi_ec_driver.ops.add = acpi_ec_polling_add;
1729 }
1730 printk(KERN_INFO PREFIX "EC %s mode.\n",
1731 burst ? "burst": "polling");
1732 return 0;
1733}
1734__setup("ec_burst=", acpi_ec_set_polling_mode);
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c
index babdf762eadb..1f76a40badec 100644
--- a/drivers/acpi/hotkey.c
+++ b/drivers/acpi/hotkey.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * hotkey.c - ACPI Hotkey Driver ($Revision:$) 2 * hotkey.c - ACPI Hotkey Driver ($Revision: 0.2 $)
3 * 3 *
4 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> 4 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com>
5 * 5 *
@@ -51,17 +51,18 @@
51#define ACPI_HOTKEY_POLLING 0x2 51#define ACPI_HOTKEY_POLLING 0x2
52#define ACPI_UNDEFINED_EVENT 0xf 52#define ACPI_UNDEFINED_EVENT 0xf
53 53
54#define MAX_CONFIG_RECORD_LEN 80 54#define RESULT_STR_LEN 80
55#define MAX_NAME_PATH_LEN 80
56#define MAX_CALL_PARM 80
57 55
58#define IS_EVENT(e) 0xff /* ((e) & 0x40000000) */ 56#define ACTION_METHOD 0
59#define IS_POLL(e) 0xff /* (~((e) & 0x40000000)) */ 57#define POLL_METHOD 1
60 58
59#define IS_EVENT(e) ((e) <= 10000 && (e) >0)
60#define IS_POLL(e) ((e) > 10000)
61#define IS_OTHERS(e) ((e)<=0 || (e)>=20000)
61#define _COMPONENT ACPI_HOTKEY_COMPONENT 62#define _COMPONENT ACPI_HOTKEY_COMPONENT
62ACPI_MODULE_NAME("acpi_hotkey") 63ACPI_MODULE_NAME("acpi_hotkey")
63 64
64 MODULE_AUTHOR("luming.yu@intel.com"); 65MODULE_AUTHOR("luming.yu@intel.com");
65MODULE_DESCRIPTION(ACPI_HOTK_NAME); 66MODULE_DESCRIPTION(ACPI_HOTK_NAME);
66MODULE_LICENSE("GPL"); 67MODULE_LICENSE("GPL");
67 68
@@ -114,7 +115,7 @@ struct acpi_event_hotkey {
114 char *action_method; /* action method */ 115 char *action_method; /* action method */
115}; 116};
116 117
117/* 118/*
118 * There are two ways to poll status 119 * There are two ways to poll status
119 * 1. directy call read_xxx method, without any arguments passed in 120 * 1. directy call read_xxx method, without any arguments passed in
120 * 2. call write_xxx method, with arguments passed in, you need 121 * 2. call write_xxx method, with arguments passed in, you need
@@ -131,7 +132,7 @@ struct acpi_polling_hotkey {
131 char *poll_method; /* poll method */ 132 char *poll_method; /* poll method */
132 acpi_handle action_handle; /* acpi handle attached action method */ 133 acpi_handle action_handle; /* acpi handle attached action method */
133 char *action_method; /* action method */ 134 char *action_method; /* action method */
134 void *poll_result; /* polling_result */ 135 union acpi_object *poll_result; /* polling_result */
135 struct proc_dir_entry *proc; 136 struct proc_dir_entry *proc;
136}; 137};
137 138
@@ -162,20 +163,25 @@ static struct acpi_driver hotkey_driver = {
162 }, 163 },
163}; 164};
164 165
166static void free_hotkey_device(union acpi_hotkey *key);
167static void free_hotkey_buffer(union acpi_hotkey *key);
168static void free_poll_hotkey_buffer(union acpi_hotkey *key);
165static int hotkey_open_config(struct inode *inode, struct file *file); 169static int hotkey_open_config(struct inode *inode, struct file *file);
170static int hotkey_poll_open_config(struct inode *inode, struct file *file);
166static ssize_t hotkey_write_config(struct file *file, 171static ssize_t hotkey_write_config(struct file *file,
167 const char __user * buffer, 172 const char __user * buffer,
168 size_t count, loff_t * data); 173 size_t count, loff_t * data);
169static ssize_t hotkey_write_poll_config(struct file *file,
170 const char __user * buffer,
171 size_t count, loff_t * data);
172static int hotkey_info_open_fs(struct inode *inode, struct file *file); 174static int hotkey_info_open_fs(struct inode *inode, struct file *file);
173static int hotkey_action_open_fs(struct inode *inode, struct file *file); 175static int hotkey_action_open_fs(struct inode *inode, struct file *file);
174static ssize_t hotkey_execute_aml_method(struct file *file, 176static ssize_t hotkey_execute_aml_method(struct file *file,
175 const char __user * buffer, 177 const char __user * buffer,
176 size_t count, loff_t * data); 178 size_t count, loff_t * data);
177static int hotkey_config_seq_show(struct seq_file *seq, void *offset); 179static int hotkey_config_seq_show(struct seq_file *seq, void *offset);
180static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
178static int hotkey_polling_open_fs(struct inode *inode, struct file *file); 181static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
182static union acpi_hotkey *get_hotkey_by_event(struct
183 acpi_hotkey_list
184 *hotkey_list, int event);
179 185
180/* event based config */ 186/* event based config */
181static struct file_operations hotkey_config_fops = { 187static struct file_operations hotkey_config_fops = {
@@ -188,9 +194,9 @@ static struct file_operations hotkey_config_fops = {
188 194
189/* polling based config */ 195/* polling based config */
190static struct file_operations hotkey_poll_config_fops = { 196static struct file_operations hotkey_poll_config_fops = {
191 .open = hotkey_open_config, 197 .open = hotkey_poll_open_config,
192 .read = seq_read, 198 .read = seq_read,
193 .write = hotkey_write_poll_config, 199 .write = hotkey_write_config,
194 .llseek = seq_lseek, 200 .llseek = seq_lseek,
195 .release = single_release, 201 .release = single_release,
196}; 202};
@@ -227,7 +233,7 @@ static int hotkey_info_seq_show(struct seq_file *seq, void *offset)
227{ 233{
228 ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); 234 ACPI_FUNCTION_TRACE("hotkey_info_seq_show");
229 235
230 seq_printf(seq, "Hotkey generic driver ver: %s", HOTKEY_ACPI_VERSION); 236 seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION);
231 237
232 return_VALUE(0); 238 return_VALUE(0);
233} 239}
@@ -239,27 +245,35 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file)
239 245
240static char *format_result(union acpi_object *object) 246static char *format_result(union acpi_object *object)
241{ 247{
242 char *buf = (char *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); 248 char *buf = NULL;
243 249
244 memset(buf, 0, sizeof(union acpi_object)); 250 buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL);
251 if (buf)
252 memset(buf, 0, RESULT_STR_LEN);
253 else
254 goto do_fail;
245 255
246 /* Now, just support integer type */ 256 /* Now, just support integer type */
247 if (object->type == ACPI_TYPE_INTEGER) 257 if (object->type == ACPI_TYPE_INTEGER)
248 sprintf(buf, "%d", (u32) object->integer.value); 258 sprintf(buf, "%d\n", (u32) object->integer.value);
249 259do_fail:
250 return buf; 260 return (buf);
251} 261}
252 262
253static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) 263static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
254{ 264{
255 struct acpi_polling_hotkey *poll_hotkey = 265 struct acpi_polling_hotkey *poll_hotkey =
256 (struct acpi_polling_hotkey *)seq->private; 266 (struct acpi_polling_hotkey *)seq->private;
267 char *buf;
257 268
258 ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); 269 ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
259 270
260 if (poll_hotkey->poll_result) 271 if (poll_hotkey->poll_result){
261 seq_printf(seq, "%s", format_result(poll_hotkey->poll_result)); 272 buf = format_result(poll_hotkey->poll_result);
262 273 if(buf)
274 seq_printf(seq, "%s", buf);
275 kfree(buf);
276 }
263 return_VALUE(0); 277 return_VALUE(0);
264} 278}
265 279
@@ -276,19 +290,19 @@ static int hotkey_action_open_fs(struct inode *inode, struct file *file)
276/* Mapping external hotkey number to standardized hotkey event num */ 290/* Mapping external hotkey number to standardized hotkey event num */
277static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) 291static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
278{ 292{
279 struct list_head *entries, *next; 293 struct list_head *entries;
280 int val = 0; 294 int val = -1;
281 295
282 ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); 296 ACPI_FUNCTION_TRACE("hotkey_get_internal_event");
283 297
284 list_for_each_safe(entries, next, list->entries) { 298 list_for_each(entries, list->entries) {
285 union acpi_hotkey *key = 299 union acpi_hotkey *key =
286 container_of(entries, union acpi_hotkey, entries); 300 container_of(entries, union acpi_hotkey, entries);
287 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT 301 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
288 && key->event_hotkey.external_hotkey_num == event) 302 && key->event_hotkey.external_hotkey_num == event){
289 val = key->link.hotkey_standard_num; 303 val = key->link.hotkey_standard_num;
290 else 304 break;
291 val = -1; 305 }
292 } 306 }
293 307
294 return_VALUE(val); 308 return_VALUE(val);
@@ -306,7 +320,7 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data)
306 return_VOID; 320 return_VOID;
307 321
308 internal_event = hotkey_get_internal_event(event, &global_hotkey_list); 322 internal_event = hotkey_get_internal_event(event, &global_hotkey_list);
309 acpi_bus_generate_event(device, event, 0); 323 acpi_bus_generate_event(device, internal_event, 0);
310 324
311 return_VOID; 325 return_VOID;
312} 326}
@@ -329,13 +343,17 @@ static int auto_hotkey_remove(struct acpi_device *device, int type)
329static int create_polling_proc(union acpi_hotkey *device) 343static int create_polling_proc(union acpi_hotkey *device)
330{ 344{
331 struct proc_dir_entry *proc; 345 struct proc_dir_entry *proc;
346 char proc_name[80];
332 mode_t mode; 347 mode_t mode;
333 348
334 ACPI_FUNCTION_TRACE("create_polling_proc"); 349 ACPI_FUNCTION_TRACE("create_polling_proc");
335 mode = S_IFREG | S_IRUGO | S_IWUGO; 350 mode = S_IFREG | S_IRUGO | S_IWUGO;
336 351
337 proc = create_proc_entry(device->poll_hotkey.action_method, 352 sprintf(proc_name, "%d", device->link.hotkey_standard_num);
338 mode, hotkey_proc_dir); 353 /*
354 strcat(proc_name, device->poll_hotkey.poll_method);
355 */
356 proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
339 357
340 if (!proc) { 358 if (!proc) {
341 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 359 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -353,23 +371,6 @@ static int create_polling_proc(union acpi_hotkey *device)
353 return_VALUE(0); 371 return_VALUE(0);
354} 372}
355 373
356static int is_valid_acpi_path(const char *pathname)
357{
358 acpi_handle handle;
359 acpi_status status;
360 ACPI_FUNCTION_TRACE("is_valid_acpi_path");
361
362 status = acpi_get_handle(NULL, (char *)pathname, &handle);
363 return_VALUE(!ACPI_FAILURE(status));
364}
365
366static int is_valid_hotkey(union acpi_hotkey *device)
367{
368 ACPI_FUNCTION_TRACE("is_valid_hotkey");
369 /* Implement valid check */
370 return_VALUE(1);
371}
372
373static int hotkey_add(union acpi_hotkey *device) 374static int hotkey_add(union acpi_hotkey *device)
374{ 375{
375 int status = 0; 376 int status = 0;
@@ -378,15 +379,11 @@ static int hotkey_add(union acpi_hotkey *device)
378 ACPI_FUNCTION_TRACE("hotkey_add"); 379 ACPI_FUNCTION_TRACE("hotkey_add");
379 380
380 if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { 381 if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) {
381 status = 382 acpi_bus_get_device(device->event_hotkey.bus_handle, &dev);
382 acpi_bus_get_device(device->event_hotkey.bus_handle, &dev);
383 if (status)
384 return_VALUE(status);
385
386 status = acpi_install_notify_handler(dev->handle, 383 status = acpi_install_notify_handler(dev->handle,
387 ACPI_SYSTEM_NOTIFY, 384 ACPI_DEVICE_NOTIFY,
388 acpi_hotkey_notify_handler, 385 acpi_hotkey_notify_handler,
389 device); 386 dev);
390 } else /* Add polling hotkey */ 387 } else /* Add polling hotkey */
391 create_polling_proc(device); 388 create_polling_proc(device);
392 389
@@ -409,84 +406,143 @@ static int hotkey_remove(union acpi_hotkey *device)
409 if (key->link.hotkey_standard_num == 406 if (key->link.hotkey_standard_num ==
410 device->link.hotkey_standard_num) { 407 device->link.hotkey_standard_num) {
411 list_del(&key->link.entries); 408 list_del(&key->link.entries);
412 remove_proc_entry(key->poll_hotkey.action_method, 409 free_hotkey_device(key);
413 hotkey_proc_dir);
414 global_hotkey_list.count--; 410 global_hotkey_list.count--;
415 break; 411 break;
416 } 412 }
417 } 413 }
414 kfree(device);
418 return_VALUE(0); 415 return_VALUE(0);
419} 416}
420 417
421static void hotkey_update(union acpi_hotkey *key) 418static int hotkey_update(union acpi_hotkey *key)
422{ 419{
423 struct list_head *entries, *next; 420 struct list_head *entries;
424 421
425 ACPI_FUNCTION_TRACE("hotkey_update"); 422 ACPI_FUNCTION_TRACE("hotkey_update");
426 423
427 list_for_each_safe(entries, next, global_hotkey_list.entries) { 424 list_for_each(entries, global_hotkey_list.entries) {
428 union acpi_hotkey *key = 425 union acpi_hotkey *tmp=
429 container_of(entries, union acpi_hotkey, entries); 426 container_of(entries, union acpi_hotkey, entries);
430 if (key->link.hotkey_standard_num == 427 if (tmp->link.hotkey_standard_num ==
431 key->link.hotkey_standard_num) { 428 key->link.hotkey_standard_num) {
432 key->event_hotkey.bus_handle = 429 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
433 key->event_hotkey.bus_handle; 430 free_hotkey_buffer(tmp);
434 key->event_hotkey.external_hotkey_num = 431 tmp->event_hotkey.bus_handle =
435 key->event_hotkey.external_hotkey_num; 432 key->event_hotkey.bus_handle;
436 key->event_hotkey.action_handle = 433 tmp->event_hotkey.external_hotkey_num =
437 key->event_hotkey.action_handle; 434 key->event_hotkey.external_hotkey_num;
438 key->event_hotkey.action_method = 435 tmp->event_hotkey.action_handle =
439 key->event_hotkey.action_method; 436 key->event_hotkey.action_handle;
437 tmp->event_hotkey.action_method =
438 key->event_hotkey.action_method;
439 kfree(key);
440 } else {
441 /*
442 char proc_name[80];
443
444 sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
445 strcat(proc_name, tmp->poll_hotkey.poll_method);
446 remove_proc_entry(proc_name,hotkey_proc_dir);
447 */
448 free_poll_hotkey_buffer(tmp);
449 tmp->poll_hotkey.poll_handle =
450 key->poll_hotkey.poll_handle;
451 tmp->poll_hotkey.poll_method =
452 key->poll_hotkey.poll_method;
453 tmp->poll_hotkey.action_handle =
454 key->poll_hotkey.action_handle;
455 tmp->poll_hotkey.action_method =
456 key->poll_hotkey.action_method;
457 tmp->poll_hotkey.poll_result =
458 key->poll_hotkey.poll_result;
459 /*
460 create_polling_proc(tmp);
461 */
462 kfree(key);
463 }
464 return_VALUE(0);
440 break; 465 break;
441 } 466 }
442 } 467 }
443 468
444 return_VOID; 469 return_VALUE(-ENODEV);
445} 470}
446 471
447static void free_hotkey_device(union acpi_hotkey *key) 472static void free_hotkey_device(union acpi_hotkey *key)
448{ 473{
449 struct acpi_device *dev; 474 struct acpi_device *dev;
450 int status;
451 475
452 ACPI_FUNCTION_TRACE("free_hotkey_device"); 476 ACPI_FUNCTION_TRACE("free_hotkey_device");
453 477
454 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { 478 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
455 status = 479 acpi_bus_get_device(key->event_hotkey.bus_handle, &dev);
456 acpi_bus_get_device(key->event_hotkey.bus_handle, &dev);
457 if (dev->handle) 480 if (dev->handle)
458 acpi_remove_notify_handler(dev->handle, 481 acpi_remove_notify_handler(dev->handle,
459 ACPI_SYSTEM_NOTIFY, 482 ACPI_DEVICE_NOTIFY,
460 acpi_hotkey_notify_handler); 483 acpi_hotkey_notify_handler);
461 } else 484 free_hotkey_buffer(key);
462 remove_proc_entry(key->poll_hotkey.action_method, 485 } else {
463 hotkey_proc_dir); 486 char proc_name[80];
487
488 sprintf(proc_name, "%d", key->link.hotkey_standard_num);
489 /*
490 strcat(proc_name, key->poll_hotkey.poll_method);
491 */
492 remove_proc_entry(proc_name,hotkey_proc_dir);
493 free_poll_hotkey_buffer(key);
494 }
464 kfree(key); 495 kfree(key);
465 return_VOID; 496 return_VOID;
466} 497}
467 498
499static void
500free_hotkey_buffer(union acpi_hotkey *key)
501{
502 kfree(key->event_hotkey.action_method);
503}
504
505static void
506free_poll_hotkey_buffer(union acpi_hotkey *key)
507{
508 kfree(key->poll_hotkey.action_method);
509 kfree(key->poll_hotkey.poll_method);
510 kfree(key->poll_hotkey.poll_result);
511}
468static int 512static int
469init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, 513init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
470 char *method, int std_num, int external_num) 514 char *method, int std_num, int external_num)
471{ 515{
516 acpi_handle tmp_handle;
517 acpi_status status = AE_OK;
518
472 ACPI_FUNCTION_TRACE("init_hotkey_device"); 519 ACPI_FUNCTION_TRACE("init_hotkey_device");
473 520
521 if(std_num < 0 || IS_POLL(std_num) || !key )
522 goto do_fail;
523
524 if(!bus_str || !action_str || !method)
525 goto do_fail;
526
474 key->link.hotkey_type = ACPI_HOTKEY_EVENT; 527 key->link.hotkey_type = ACPI_HOTKEY_EVENT;
475 key->link.hotkey_standard_num = std_num; 528 key->link.hotkey_standard_num = std_num;
476 key->event_hotkey.flag = 0; 529 key->event_hotkey.flag = 0;
477 if (is_valid_acpi_path(bus_str)) 530 key->event_hotkey.action_method = method;
478 acpi_get_handle((acpi_handle) 0,
479 bus_str, &(key->event_hotkey.bus_handle));
480 else
481 return_VALUE(-ENODEV);
482 key->event_hotkey.external_hotkey_num = external_num;
483 if (is_valid_acpi_path(action_str))
484 acpi_get_handle((acpi_handle) 0,
485 action_str, &(key->event_hotkey.action_handle));
486 key->event_hotkey.action_method = kmalloc(sizeof(method), GFP_KERNEL);
487 strcpy(key->event_hotkey.action_method, method);
488 531
489 return_VALUE(!is_valid_hotkey(key)); 532 status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle));
533 if(ACPI_FAILURE(status))
534 goto do_fail;
535 key->event_hotkey.external_hotkey_num = external_num;
536 status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle));
537 if(ACPI_FAILURE(status))
538 goto do_fail;
539 status = acpi_get_handle(key->event_hotkey.action_handle,
540 method, &tmp_handle);
541 if (ACPI_FAILURE(status))
542 goto do_fail;
543 return_VALUE(AE_OK);
544do_fail:
545 return_VALUE(-ENODEV);
490} 546}
491 547
492static int 548static int
@@ -495,34 +551,46 @@ init_poll_hotkey_device(union acpi_hotkey *key,
495 char *poll_method, 551 char *poll_method,
496 char *action_str, char *action_method, int std_num) 552 char *action_str, char *action_method, int std_num)
497{ 553{
554 acpi_status status = AE_OK;
555 acpi_handle tmp_handle;
556
498 ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); 557 ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
499 558
559 if(std_num < 0 || IS_EVENT(std_num) || !key)
560 goto do_fail;
561
562 if(!poll_str || !poll_method || !action_str || !action_method)
563 goto do_fail;
564
500 key->link.hotkey_type = ACPI_HOTKEY_POLLING; 565 key->link.hotkey_type = ACPI_HOTKEY_POLLING;
501 key->link.hotkey_standard_num = std_num; 566 key->link.hotkey_standard_num = std_num;
502 key->poll_hotkey.flag = 0; 567 key->poll_hotkey.flag = 0;
503 if (is_valid_acpi_path(poll_str))
504 acpi_get_handle((acpi_handle) 0,
505 poll_str, &(key->poll_hotkey.poll_handle));
506 else
507 return_VALUE(-ENODEV);
508 key->poll_hotkey.poll_method = poll_method; 568 key->poll_hotkey.poll_method = poll_method;
509 if (is_valid_acpi_path(action_str)) 569 key->poll_hotkey.action_method = action_method;
510 acpi_get_handle((acpi_handle) 0, 570
511 action_str, &(key->poll_hotkey.action_handle)); 571 status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle));
512 key->poll_hotkey.action_method = 572 if(ACPI_FAILURE(status))
513 kmalloc(sizeof(action_method), GFP_KERNEL); 573 goto do_fail;
514 strcpy(key->poll_hotkey.action_method, action_method); 574 status = acpi_get_handle(key->poll_hotkey.poll_handle,
575 poll_method, &tmp_handle);
576 if (ACPI_FAILURE(status))
577 goto do_fail;
578 status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle));
579 if (ACPI_FAILURE(status))
580 goto do_fail;
581 status = acpi_get_handle(key->poll_hotkey.action_handle,
582 action_method, &tmp_handle);
583 if (ACPI_FAILURE(status))
584 goto do_fail;
515 key->poll_hotkey.poll_result = 585 key->poll_hotkey.poll_result =
516 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); 586 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
517 return_VALUE(is_valid_hotkey(key)); 587 if(!key->poll_hotkey.poll_result)
588 goto do_fail;
589 return_VALUE(AE_OK);
590do_fail:
591 return_VALUE(-ENODEV);
518} 592}
519 593
520static int check_hotkey_valid(union acpi_hotkey *key,
521 struct acpi_hotkey_list *list)
522{
523 ACPI_FUNCTION_TRACE("check_hotkey_valid");
524 return_VALUE(0);
525}
526 594
527static int hotkey_open_config(struct inode *inode, struct file *file) 595static int hotkey_open_config(struct inode *inode, struct file *file)
528{ 596{
@@ -531,10 +599,17 @@ static int hotkey_open_config(struct inode *inode, struct file *file)
531 (file, hotkey_config_seq_show, PDE(inode)->data)); 599 (file, hotkey_config_seq_show, PDE(inode)->data));
532} 600}
533 601
602static int hotkey_poll_open_config(struct inode *inode, struct file *file)
603{
604 ACPI_FUNCTION_TRACE("hotkey_poll_open_config");
605 return_VALUE(single_open
606 (file, hotkey_poll_config_seq_show, PDE(inode)->data));
607}
608
534static int hotkey_config_seq_show(struct seq_file *seq, void *offset) 609static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
535{ 610{
536 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; 611 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
537 struct list_head *entries, *next; 612 struct list_head *entries;
538 char bus_name[ACPI_PATHNAME_MAX] = { 0 }; 613 char bus_name[ACPI_PATHNAME_MAX] = { 0 };
539 char action_name[ACPI_PATHNAME_MAX] = { 0 }; 614 char action_name[ACPI_PATHNAME_MAX] = { 0 };
540 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; 615 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
@@ -542,10 +617,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
542 617
543 ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); 618 ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
544 619
545 if (!hotkey_list) 620 list_for_each(entries, hotkey_list->entries) {
546 goto end;
547
548 list_for_each_safe(entries, next, hotkey_list->entries) {
549 union acpi_hotkey *key = 621 union acpi_hotkey *key =
550 container_of(entries, union acpi_hotkey, entries); 622 container_of(entries, union acpi_hotkey, entries);
551 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { 623 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
@@ -553,18 +625,37 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
553 ACPI_NAME_TYPE_MAX, &bus); 625 ACPI_NAME_TYPE_MAX, &bus);
554 acpi_get_name(key->event_hotkey.action_handle, 626 acpi_get_name(key->event_hotkey.action_handle,
555 ACPI_NAME_TYPE_MAX, &act); 627 ACPI_NAME_TYPE_MAX, &act);
556 seq_printf(seq, "%s:%s:%s:%d:%d", bus_name, 628 seq_printf(seq, "%s:%s:%s:%d:%d\n", bus_name,
557 action_name, 629 action_name,
558 key->event_hotkey.action_method, 630 key->event_hotkey.action_method,
559 key->link.hotkey_standard_num, 631 key->link.hotkey_standard_num,
560 key->event_hotkey.external_hotkey_num); 632 key->event_hotkey.external_hotkey_num);
561 } /* ACPI_HOTKEY_POLLING */ 633 }
562 else { 634 }
635 seq_puts(seq, "\n");
636 return_VALUE(0);
637}
638
639static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
640{
641 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
642 struct list_head *entries;
643 char bus_name[ACPI_PATHNAME_MAX] = { 0 };
644 char action_name[ACPI_PATHNAME_MAX] = { 0 };
645 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
646 struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name };
647
648 ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
649
650 list_for_each(entries, hotkey_list->entries) {
651 union acpi_hotkey *key =
652 container_of(entries, union acpi_hotkey, entries);
653 if (key->link.hotkey_type == ACPI_HOTKEY_POLLING) {
563 acpi_get_name(key->poll_hotkey.poll_handle, 654 acpi_get_name(key->poll_hotkey.poll_handle,
564 ACPI_NAME_TYPE_MAX, &bus); 655 ACPI_NAME_TYPE_MAX, &bus);
565 acpi_get_name(key->poll_hotkey.action_handle, 656 acpi_get_name(key->poll_hotkey.action_handle,
566 ACPI_NAME_TYPE_MAX, &act); 657 ACPI_NAME_TYPE_MAX, &act);
567 seq_printf(seq, "%s:%s:%s:%s:%d", bus_name, 658 seq_printf(seq, "%s:%s:%s:%s:%d\n", bus_name,
568 key->poll_hotkey.poll_method, 659 key->poll_hotkey.poll_method,
569 action_name, 660 action_name,
570 key->poll_hotkey.action_method, 661 key->poll_hotkey.action_method,
@@ -572,49 +663,83 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
572 } 663 }
573 } 664 }
574 seq_puts(seq, "\n"); 665 seq_puts(seq, "\n");
575 end:
576 return_VALUE(0); 666 return_VALUE(0);
577} 667}
578 668
579static int 669static int
580get_parms(char *config_record, 670get_parms(char *config_record,
581 int *cmd, 671 int *cmd,
582 char *bus_handle, 672 char **bus_handle,
583 char *bus_method, 673 char **bus_method,
584 char *action_handle, 674 char **action_handle,
585 char *method, int *internal_event_num, int *external_event_num) 675 char **method, int *internal_event_num, int *external_event_num)
586{ 676{
587 char *tmp, *tmp1; 677 char *tmp, *tmp1, count;
588 ACPI_FUNCTION_TRACE(("get_parms")); 678 ACPI_FUNCTION_TRACE(("get_parms"));
589 679
590 sscanf(config_record, "%d", cmd); 680 sscanf(config_record, "%d", cmd);
591 681
682 if(*cmd == 1){
683 if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2)
684 goto do_fail;
685 else
686 return (6);
687 }
592 tmp = strchr(config_record, ':'); 688 tmp = strchr(config_record, ':');
689 if (!tmp)
690 goto do_fail;
593 tmp++; 691 tmp++;
594 tmp1 = strchr(tmp, ':'); 692 tmp1 = strchr(tmp, ':');
595 strncpy(bus_handle, tmp, tmp1 - tmp); 693 if (!tmp1)
596 bus_handle[tmp1 - tmp] = 0; 694 goto do_fail;
695
696 count = tmp1 - tmp;
697 *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL);
698 if(!*bus_handle)
699 goto do_fail;
700 strncpy(*bus_handle, tmp, count);
701 *(*bus_handle + count) = 0;
597 702
598 tmp = tmp1; 703 tmp = tmp1;
599 tmp++; 704 tmp++;
600 tmp1 = strchr(tmp, ':'); 705 tmp1 = strchr(tmp, ':');
601 strncpy(bus_method, tmp, tmp1 - tmp); 706 if (!tmp1)
602 bus_method[tmp1 - tmp] = 0; 707 goto do_fail;
708 count = tmp1 - tmp;
709 *bus_method = (char *) kmalloc(count+1, GFP_KERNEL);
710 if(!*bus_method)
711 goto do_fail;
712 strncpy(*bus_method, tmp, count);
713 *(*bus_method + count) = 0;
603 714
604 tmp = tmp1; 715 tmp = tmp1;
605 tmp++; 716 tmp++;
606 tmp1 = strchr(tmp, ':'); 717 tmp1 = strchr(tmp, ':');
607 strncpy(action_handle, tmp, tmp1 - tmp); 718 if (!tmp1)
608 action_handle[tmp1 - tmp] = 0; 719 goto do_fail;
720 count = tmp1 - tmp;
721 *action_handle = (char *) kmalloc(count+1, GFP_KERNEL);
722 strncpy(*action_handle, tmp, count);
723 *(*action_handle + count) = 0;
609 724
610 tmp = tmp1; 725 tmp = tmp1;
611 tmp++; 726 tmp++;
612 tmp1 = strchr(tmp, ':'); 727 tmp1 = strchr(tmp, ':');
613 strncpy(method, tmp, tmp1 - tmp); 728 if (!tmp1)
614 method[tmp1 - tmp] = 0; 729 goto do_fail;
730 count = tmp1 - tmp;
731 *method = (char *) kmalloc(count+1, GFP_KERNEL);
732 if(!*method)
733 goto do_fail;
734 strncpy(*method, tmp, count);
735 *(*method + count) = 0;
736
737 if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0)
738 goto do_fail;
615 739
616 sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num);
617 return_VALUE(6); 740 return_VALUE(6);
741do_fail:
742 return_VALUE(-1);
618} 743}
619 744
620/* count is length for one input record */ 745/* count is length for one input record */
@@ -622,135 +747,117 @@ static ssize_t hotkey_write_config(struct file *file,
622 const char __user * buffer, 747 const char __user * buffer,
623 size_t count, loff_t * data) 748 size_t count, loff_t * data)
624{ 749{
625 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; 750 char *config_record = NULL;
626 char config_record[MAX_CONFIG_RECORD_LEN]; 751 char *bus_handle = NULL;
627 char bus_handle[MAX_NAME_PATH_LEN]; 752 char *bus_method = NULL;
628 char bus_method[MAX_NAME_PATH_LEN]; 753 char *action_handle = NULL;
629 char action_handle[MAX_NAME_PATH_LEN]; 754 char *method = NULL;
630 char method[20];
631 int cmd, internal_event_num, external_event_num; 755 int cmd, internal_event_num, external_event_num;
632 int ret = 0; 756 int ret = 0;
633 union acpi_hotkey *key = NULL; 757 union acpi_hotkey *key = NULL;
634 758
635 ACPI_FUNCTION_TRACE(("hotkey_write_config")); 759 ACPI_FUNCTION_TRACE(("hotkey_write_config"));
636 760
637 if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) { 761 config_record = (char *) kmalloc(count+1, GFP_KERNEL);
638 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n")); 762 if(!config_record)
639 return_VALUE(-EINVAL); 763 return_VALUE(-ENOMEM);
640 }
641 764
642 if (copy_from_user(config_record, buffer, count)) { 765 if (copy_from_user(config_record, buffer, count)) {
766 kfree(config_record);
643 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); 767 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n"));
644 return_VALUE(-EINVAL); 768 return_VALUE(-EINVAL);
645 } 769 }
646 config_record[count] = '\0'; 770 config_record[count] = 0;
647 771
648 ret = get_parms(config_record, 772 ret = get_parms(config_record,
649 &cmd, 773 &cmd,
650 bus_handle, 774 &bus_handle,
651 bus_method, 775 &bus_method,
652 action_handle, 776 &action_handle,
653 method, &internal_event_num, &external_event_num); 777 &method, &internal_event_num, &external_event_num);
778
779 kfree(config_record);
780 if(IS_OTHERS(internal_event_num))
781 goto do_fail;
654 if (ret != 6) { 782 if (ret != 6) {
783do_fail:
784 kfree(bus_handle);
785 kfree(bus_method);
786 kfree(action_handle);
787 kfree(method);
655 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 788 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
656 "Invalid data format ret=%d\n", ret)); 789 "Invalid data format ret=%d\n", ret));
657 return_VALUE(-EINVAL); 790 return_VALUE(-EINVAL);
658 } 791 }
659 792
660 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); 793 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
661 ret = init_hotkey_device(key, bus_handle, action_handle, method, 794 if(!key)
795 goto do_fail;
796 memset(key, 0, sizeof(union acpi_hotkey));
797 if(cmd == 1) {
798 union acpi_hotkey *tmp = NULL;
799 tmp = get_hotkey_by_event(&global_hotkey_list,
800 internal_event_num);
801 if(!tmp)
802 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
803 else
804 memcpy(key, tmp, sizeof(union acpi_hotkey));
805 goto cont_cmd;
806 }
807 if (IS_EVENT(internal_event_num)) {
808 kfree(bus_method);
809 ret = init_hotkey_device(key, bus_handle, action_handle, method,
662 internal_event_num, external_event_num); 810 internal_event_num, external_event_num);
663 811 } else
664 if (ret || check_hotkey_valid(key, hotkey_list)) { 812 ret = init_poll_hotkey_device(key, bus_handle, bus_method,
813 action_handle, method,
814 internal_event_num);
815 if (ret) {
816 kfree(bus_handle);
817 kfree(action_handle);
818 if(IS_EVENT(internal_event_num))
819 free_hotkey_buffer(key);
820 else
821 free_poll_hotkey_buffer(key);
665 kfree(key); 822 kfree(key);
666 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); 823 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n"));
667 return_VALUE(-EINVAL); 824 return_VALUE(-EINVAL);
668 } 825 }
669 switch (cmd) {
670 case 0:
671 hotkey_add(key);
672 break;
673 case 1:
674 hotkey_remove(key);
675 free_hotkey_device(key);
676 break;
677 case 2:
678 hotkey_update(key);
679 break;
680 default:
681 break;
682 }
683 return_VALUE(count);
684}
685
686/* count is length for one input record */
687static ssize_t hotkey_write_poll_config(struct file *file,
688 const char __user * buffer,
689 size_t count, loff_t * data)
690{
691 struct seq_file *m = (struct seq_file *)file->private_data;
692 struct acpi_hotkey_list *hotkey_list =
693 (struct acpi_hotkey_list *)m->private;
694
695 char config_record[MAX_CONFIG_RECORD_LEN];
696 char polling_handle[MAX_NAME_PATH_LEN];
697 char action_handle[MAX_NAME_PATH_LEN];
698 char poll_method[20], action_method[20];
699 int ret, internal_event_num, cmd, external_event_num;
700 union acpi_hotkey *key = NULL;
701
702 ACPI_FUNCTION_TRACE("hotkey_write_poll_config");
703
704 if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) {
705 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n"));
706 return_VALUE(-EINVAL);
707 }
708
709 if (copy_from_user(config_record, buffer, count)) {
710 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n"));
711 return_VALUE(-EINVAL);
712 }
713 config_record[count] = '\0';
714 826
715 ret = get_parms(config_record, 827cont_cmd:
716 &cmd, 828 kfree(bus_handle);
717 polling_handle, 829 kfree(action_handle);
718 poll_method,
719 action_handle,
720 action_method,
721 &internal_event_num, &external_event_num);
722
723 if (ret != 6) {
724 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n"));
725 return_VALUE(-EINVAL);
726 }
727 830
728 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
729 ret = init_poll_hotkey_device(key, polling_handle, poll_method,
730 action_handle, action_method,
731 internal_event_num);
732 if (ret || check_hotkey_valid(key, hotkey_list)) {
733 kfree(key);
734 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n"));
735 return_VALUE(-EINVAL);
736 }
737 switch (cmd) { 831 switch (cmd) {
738 case 0: 832 case 0:
739 hotkey_add(key); 833 if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num))
834 goto fail_out;
835 else
836 hotkey_add(key);
740 break; 837 break;
741 case 1: 838 case 1:
742 hotkey_remove(key); 839 hotkey_remove(key);
743 break; 840 break;
744 case 2: 841 case 2:
745 hotkey_update(key); 842 if(hotkey_update(key))
843 goto fail_out;
746 break; 844 break;
747 default: 845 default:
846 goto fail_out;
748 break; 847 break;
749 } 848 }
750 return_VALUE(count); 849 return_VALUE(count);
850fail_out:
851 if(IS_EVENT(internal_event_num))
852 free_hotkey_buffer(key);
853 else
854 free_poll_hotkey_buffer(key);
855 kfree(key);
856 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n"));
857 return_VALUE(-EINVAL);
751} 858}
752 859
753/* 860/*
754 * This function evaluates an ACPI method, given an int as parameter, the 861 * This function evaluates an ACPI method, given an int as parameter, the
755 * method is searched within the scope of the handle, can be NULL. The output 862 * method is searched within the scope of the handle, can be NULL. The output
756 * of the method is written is output, which can also be NULL 863 * of the method is written is output, which can also be NULL
@@ -775,7 +882,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
775 return_VALUE(status == AE_OK); 882 return_VALUE(status == AE_OK);
776} 883}
777 884
778static int read_acpi_int(acpi_handle handle, const char *method, int *val) 885static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val)
779{ 886{
780 struct acpi_buffer output; 887 struct acpi_buffer output;
781 union acpi_object out_obj; 888 union acpi_object out_obj;
@@ -786,62 +893,32 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
786 output.pointer = &out_obj; 893 output.pointer = &out_obj;
787 894
788 status = acpi_evaluate_object(handle, (char *)method, NULL, &output); 895 status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
789 *val = out_obj.integer.value; 896 if(val){
897 val->integer.value = out_obj.integer.value;
898 val->type = out_obj.type;
899 } else
900 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer"));
790 return_VALUE((status == AE_OK) 901 return_VALUE((status == AE_OK)
791 && (out_obj.type == ACPI_TYPE_INTEGER)); 902 && (out_obj.type == ACPI_TYPE_INTEGER));
792} 903}
793 904
794static acpi_handle 905static union acpi_hotkey *get_hotkey_by_event(struct
795get_handle_from_hotkeylist(struct acpi_hotkey_list *hotkey_list, int event_num) 906 acpi_hotkey_list
907 *hotkey_list, int event)
796{ 908{
797 struct list_head *entries, *next; 909 struct list_head *entries;
798
799 list_for_each_safe(entries, next, hotkey_list->entries) {
800 union acpi_hotkey *key =
801 container_of(entries, union acpi_hotkey, entries);
802 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
803 && key->link.hotkey_standard_num == event_num) {
804 return (key->event_hotkey.action_handle);
805 }
806 }
807 return (NULL);
808}
809
810static
811char *get_method_from_hotkeylist(struct acpi_hotkey_list *hotkey_list,
812 int event_num)
813{
814 struct list_head *entries, *next;
815
816 list_for_each_safe(entries, next, hotkey_list->entries) {
817 union acpi_hotkey *key =
818 container_of(entries, union acpi_hotkey, entries);
819
820 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT &&
821 key->link.hotkey_standard_num == event_num)
822 return (key->event_hotkey.action_method);
823 }
824 return (NULL);
825}
826
827static struct acpi_polling_hotkey *get_hotkey_by_event(struct
828 acpi_hotkey_list
829 *hotkey_list, int event)
830{
831 struct list_head *entries, *next;
832 910
833 list_for_each_safe(entries, next, hotkey_list->entries) { 911 list_for_each(entries, hotkey_list->entries) {
834 union acpi_hotkey *key = 912 union acpi_hotkey *key =
835 container_of(entries, union acpi_hotkey, entries); 913 container_of(entries, union acpi_hotkey, entries);
836 if (key->link.hotkey_type == ACPI_HOTKEY_POLLING 914 if (key->link.hotkey_standard_num == event) {
837 && key->link.hotkey_standard_num == event) { 915 return(key);
838 return (&key->poll_hotkey);
839 } 916 }
840 } 917 }
841 return (NULL); 918 return(NULL);
842} 919}
843 920
844/* 921/*
845 * user call AML method interface: 922 * user call AML method interface:
846 * Call convention: 923 * Call convention:
847 * echo "event_num: arg type : value" 924 * echo "event_num: arg type : value"
@@ -854,48 +931,56 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
854 size_t count, loff_t * data) 931 size_t count, loff_t * data)
855{ 932{
856 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; 933 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
857 char arg[MAX_CALL_PARM]; 934 char *arg;
858 int event, type, value; 935 int event,method_type,type, value;
859 936 union acpi_hotkey *key;
860 char *method;
861 acpi_handle handle;
862 937
863 ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); 938 ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
864 939
865 if (!hotkey_list || count > MAX_CALL_PARM) { 940 arg = (char *) kmalloc(count+1, GFP_KERNEL);
866 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 1")); 941 if(!arg)
867 return_VALUE(-EINVAL); 942 return_VALUE(-ENOMEM);
868 } 943 arg[count]=0;
869 944
870 if (copy_from_user(arg, buffer, count)) { 945 if (copy_from_user(arg, buffer, count)) {
946 kfree(arg);
871 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); 947 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2"));
872 return_VALUE(-EINVAL); 948 return_VALUE(-EINVAL);
873 } 949 }
874 950
875 arg[count] = '\0'; 951 if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) {
876 952 kfree(arg);
877 if (sscanf(arg, "%d:%d:%d", &event, &type, &value) != 3) {
878 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); 953 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
879 return_VALUE(-EINVAL); 954 return_VALUE(-EINVAL);
880 } 955 }
881 956 kfree(arg);
882 if (type == ACPI_TYPE_INTEGER) { 957 if (type == ACPI_TYPE_INTEGER) {
883 handle = get_handle_from_hotkeylist(hotkey_list, event); 958 key = get_hotkey_by_event(hotkey_list, event);
884 method = (char *)get_method_from_hotkeylist(hotkey_list, event); 959 if(!key)
960 goto do_fail;
885 if (IS_EVENT(event)) 961 if (IS_EVENT(event))
886 write_acpi_int(handle, method, value, NULL); 962 write_acpi_int(key->event_hotkey.action_handle,
963 key->event_hotkey.action_method, value, NULL);
887 else if (IS_POLL(event)) { 964 else if (IS_POLL(event)) {
888 struct acpi_polling_hotkey *key; 965 if ( method_type == POLL_METHOD )
889 key = (struct acpi_polling_hotkey *) 966 read_acpi_int(key->poll_hotkey.poll_handle,
890 get_hotkey_by_event(hotkey_list, event); 967 key->poll_hotkey.poll_method,
891 read_acpi_int(handle, method, key->poll_result); 968 key->poll_hotkey.poll_result);
969 else if ( method_type == ACTION_METHOD )
970 write_acpi_int(key->poll_hotkey.action_handle,
971 key->poll_hotkey.action_method, value, NULL);
972 else
973 goto do_fail;
974
892 } 975 }
893 } else { 976 } else {
894 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); 977 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported"));
895 return_VALUE(-EINVAL); 978 return_VALUE(-EINVAL);
896 } 979 }
897
898 return_VALUE(count); 980 return_VALUE(count);
981do_fail:
982 return_VALUE(-EINVAL);
983
899} 984}
900 985
901static int __init hotkey_init(void) 986static int __init hotkey_init(void)
@@ -928,7 +1013,7 @@ static int __init hotkey_init(void)
928 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1013 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
929 "Hotkey: Unable to create %s entry\n", 1014 "Hotkey: Unable to create %s entry\n",
930 HOTKEY_EV_CONFIG)); 1015 HOTKEY_EV_CONFIG));
931 return (-ENODEV); 1016 goto do_fail1;
932 } else { 1017 } else {
933 hotkey_config->proc_fops = &hotkey_config_fops; 1018 hotkey_config->proc_fops = &hotkey_config_fops;
934 hotkey_config->data = &global_hotkey_list; 1019 hotkey_config->data = &global_hotkey_list;
@@ -943,7 +1028,8 @@ static int __init hotkey_init(void)
943 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1028 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
944 "Hotkey: Unable to create %s entry\n", 1029 "Hotkey: Unable to create %s entry\n",
945 HOTKEY_EV_CONFIG)); 1030 HOTKEY_EV_CONFIG));
946 return (-ENODEV); 1031
1032 goto do_fail2;
947 } else { 1033 } else {
948 hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; 1034 hotkey_poll_config->proc_fops = &hotkey_poll_config_fops;
949 hotkey_poll_config->data = &global_hotkey_list; 1035 hotkey_poll_config->data = &global_hotkey_list;
@@ -957,7 +1043,7 @@ static int __init hotkey_init(void)
957 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1043 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
958 "Hotkey: Unable to create %s entry\n", 1044 "Hotkey: Unable to create %s entry\n",
959 HOTKEY_ACTION)); 1045 HOTKEY_ACTION));
960 return (-ENODEV); 1046 goto do_fail3;
961 } else { 1047 } else {
962 hotkey_action->proc_fops = &hotkey_action_fops; 1048 hotkey_action->proc_fops = &hotkey_action_fops;
963 hotkey_action->owner = THIS_MODULE; 1049 hotkey_action->owner = THIS_MODULE;
@@ -970,7 +1056,7 @@ static int __init hotkey_init(void)
970 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1056 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
971 "Hotkey: Unable to create %s entry\n", 1057 "Hotkey: Unable to create %s entry\n",
972 HOTKEY_INFO)); 1058 HOTKEY_INFO));
973 return (-ENODEV); 1059 goto do_fail4;
974 } else { 1060 } else {
975 hotkey_info->proc_fops = &hotkey_info_fops; 1061 hotkey_info->proc_fops = &hotkey_info_fops;
976 hotkey_info->owner = THIS_MODULE; 1062 hotkey_info->owner = THIS_MODULE;
@@ -979,23 +1065,33 @@ static int __init hotkey_init(void)
979 } 1065 }
980 1066
981 result = acpi_bus_register_driver(&hotkey_driver); 1067 result = acpi_bus_register_driver(&hotkey_driver);
982 if (result < 0) { 1068 if (result < 0)
983 remove_proc_entry(HOTKEY_PROC, acpi_root_dir); 1069 goto do_fail5;
984 return (-ENODEV);
985 }
986 global_hotkey_list.count = 0; 1070 global_hotkey_list.count = 0;
987 global_hotkey_list.entries = &hotkey_entries; 1071 global_hotkey_list.entries = &hotkey_entries;
988 1072
989 INIT_LIST_HEAD(&hotkey_entries); 1073 INIT_LIST_HEAD(&hotkey_entries);
990 1074
991 return (0); 1075 return (0);
1076
1077do_fail5:
1078 remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
1079do_fail4:
1080 remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
1081do_fail3:
1082 remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
1083do_fail2:
1084 remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
1085do_fail1:
1086 remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
1087 return (-ENODEV);
992} 1088}
993 1089
994static void __exit hotkey_exit(void) 1090static void __exit hotkey_exit(void)
995{ 1091{
996 struct list_head *entries, *next; 1092 struct list_head *entries, *next;
997 1093
998 ACPI_FUNCTION_TRACE("hotkey_remove"); 1094 ACPI_FUNCTION_TRACE("hotkey_exit");
999 1095
1000 list_for_each_safe(entries, next, global_hotkey_list.entries) { 1096 list_for_each_safe(entries, next, global_hotkey_list.entries) {
1001 union acpi_hotkey *key = 1097 union acpi_hotkey *key =
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index 61ea70742d49..2934475d67d6 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME ("acpi_motherboard")
43 */ 43 */
44#define IS_RESERVED_ADDR(base, len) \ 44#define IS_RESERVED_ADDR(base, len) \
45 (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ 45 (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
46 && ((base) + (len) > PCIBIOS_MIN_IO)) 46 && ((base) + (len) > 0x1000))
47 47
48/* 48/*
49 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use 49 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index bdd9f37f8101..7289da3c4db6 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -145,10 +145,14 @@ acpi_os_vprintf(const char *fmt, va_list args)
145#endif 145#endif
146} 146}
147 147
148extern int acpi_in_resume;
148void * 149void *
149acpi_os_allocate(acpi_size size) 150acpi_os_allocate(acpi_size size)
150{ 151{
151 return kmalloc(size, GFP_KERNEL); 152 if (acpi_in_resume)
153 return kmalloc(size, GFP_ATOMIC);
154 else
155 return kmalloc(size, GFP_KERNEL);
152} 156}
153 157
154void 158void
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index d1f42b972821..bb973d2109a1 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -269,7 +269,51 @@ acpi_pci_irq_del_prt (int segment, int bus)
269/* -------------------------------------------------------------------------- 269/* --------------------------------------------------------------------------
270 PCI Interrupt Routing Support 270 PCI Interrupt Routing Support
271 -------------------------------------------------------------------------- */ 271 -------------------------------------------------------------------------- */
272typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);
272 273
274static int
275acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
276 int *edge_level,
277 int *active_high_low,
278 char **link)
279{
280 int irq;
281
282 ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
283
284 if (entry->link.handle) {
285 irq = acpi_pci_link_allocate_irq(entry->link.handle,
286 entry->link.index, edge_level, active_high_low, link);
287 if (irq < 0) {
288 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
289 return_VALUE(-1);
290 }
291 } else {
292 irq = entry->link.index;
293 *edge_level = ACPI_LEVEL_SENSITIVE;
294 *active_high_low = ACPI_ACTIVE_LOW;
295 }
296
297 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
298 return_VALUE(irq);
299}
300
301static int
302acpi_pci_free_irq(struct acpi_prt_entry *entry,
303 int *edge_level,
304 int *active_high_low,
305 char **link)
306{
307 int irq;
308
309 ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
310 if (entry->link.handle) {
311 irq = acpi_pci_link_free_irq(entry->link.handle);
312 } else {
313 irq = entry->link.index;
314 }
315 return_VALUE(irq);
316}
273/* 317/*
274 * acpi_pci_irq_lookup 318 * acpi_pci_irq_lookup
275 * success: return IRQ >= 0 319 * success: return IRQ >= 0
@@ -282,12 +326,13 @@ acpi_pci_irq_lookup (
282 int pin, 326 int pin,
283 int *edge_level, 327 int *edge_level,
284 int *active_high_low, 328 int *active_high_low,
285 char **link) 329 char **link,
330 irq_lookup_func func)
286{ 331{
287 struct acpi_prt_entry *entry = NULL; 332 struct acpi_prt_entry *entry = NULL;
288 int segment = pci_domain_nr(bus); 333 int segment = pci_domain_nr(bus);
289 int bus_nr = bus->number; 334 int bus_nr = bus->number;
290 int irq; 335 int ret;
291 336
292 ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); 337 ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
293 338
@@ -301,22 +346,8 @@ acpi_pci_irq_lookup (
301 return_VALUE(-1); 346 return_VALUE(-1);
302 } 347 }
303 348
304 if (entry->link.handle) { 349 ret = func(entry, edge_level, active_high_low, link);
305 irq = acpi_pci_link_get_irq(entry->link.handle, 350 return_VALUE(ret);
306 entry->link.index, edge_level, active_high_low, link);
307 if (irq < 0) {
308 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
309 return_VALUE(-1);
310 }
311 } else {
312 irq = entry->link.index;
313 *edge_level = ACPI_LEVEL_SENSITIVE;
314 *active_high_low = ACPI_ACTIVE_LOW;
315 }
316
317 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
318
319 return_VALUE(irq);
320} 351}
321 352
322/* 353/*
@@ -330,7 +361,8 @@ acpi_pci_irq_derive (
330 int pin, 361 int pin,
331 int *edge_level, 362 int *edge_level,
332 int *active_high_low, 363 int *active_high_low,
333 char **link) 364 char **link,
365 irq_lookup_func func)
334{ 366{
335 struct pci_dev *bridge = dev; 367 struct pci_dev *bridge = dev;
336 int irq = -1; 368 int irq = -1;
@@ -363,7 +395,7 @@ acpi_pci_irq_derive (
363 } 395 }
364 396
365 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), 397 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
366 pin, edge_level, active_high_low, link); 398 pin, edge_level, active_high_low, link, func);
367 } 399 }
368 400
369 if (irq < 0) { 401 if (irq < 0) {
@@ -415,7 +447,7 @@ acpi_pci_irq_enable (
415 * values override any BIOS-assigned IRQs set during boot. 447 * values override any BIOS-assigned IRQs set during boot.
416 */ 448 */
417 irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 449 irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
418 &edge_level, &active_high_low, &link); 450 &edge_level, &active_high_low, &link, acpi_pci_allocate_irq);
419 451
420 /* 452 /*
421 * If no PRT entry was found, we'll try to derive an IRQ from the 453 * If no PRT entry was found, we'll try to derive an IRQ from the
@@ -423,7 +455,7 @@ acpi_pci_irq_enable (
423 */ 455 */
424 if (irq < 0) 456 if (irq < 0)
425 irq = acpi_pci_irq_derive(dev, pin, &edge_level, 457 irq = acpi_pci_irq_derive(dev, pin, &edge_level,
426 &active_high_low, &link); 458 &active_high_low, &link, acpi_pci_allocate_irq);
427 459
428 /* 460 /*
429 * No IRQ known to the ACPI subsystem - maybe the BIOS / 461 * No IRQ known to the ACPI subsystem - maybe the BIOS /
@@ -462,7 +494,9 @@ acpi_pci_irq_enable (
462EXPORT_SYMBOL(acpi_pci_irq_enable); 494EXPORT_SYMBOL(acpi_pci_irq_enable);
463 495
464 496
465#ifdef CONFIG_ACPI_DEALLOCATE_IRQ 497/* FIXME: implement x86/x86_64 version */
498void __attribute__((weak)) acpi_unregister_gsi(u32 i) {}
499
466void 500void
467acpi_pci_irq_disable ( 501acpi_pci_irq_disable (
468 struct pci_dev *dev) 502 struct pci_dev *dev)
@@ -489,14 +523,14 @@ acpi_pci_irq_disable (
489 * First we check the PCI IRQ routing table (PRT) for an IRQ. 523 * First we check the PCI IRQ routing table (PRT) for an IRQ.
490 */ 524 */
491 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 525 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
492 &edge_level, &active_high_low, NULL); 526 &edge_level, &active_high_low, NULL, acpi_pci_free_irq);
493 /* 527 /*
494 * If no PRT entry was found, we'll try to derive an IRQ from the 528 * If no PRT entry was found, we'll try to derive an IRQ from the
495 * device's parent bridge. 529 * device's parent bridge.
496 */ 530 */
497 if (gsi < 0) 531 if (gsi < 0)
498 gsi = acpi_pci_irq_derive(dev, pin, 532 gsi = acpi_pci_irq_derive(dev, pin,
499 &edge_level, &active_high_low, NULL); 533 &edge_level, &active_high_low, NULL, acpi_pci_free_irq);
500 if (gsi < 0) 534 if (gsi < 0)
501 return_VOID; 535 return_VOID;
502 536
@@ -512,4 +546,3 @@ acpi_pci_irq_disable (
512 546
513 return_VOID; 547 return_VOID;
514} 548}
515#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 6ad0e77df9b3..834c2ceff1aa 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -68,6 +68,10 @@ static struct acpi_driver acpi_pci_link_driver = {
68 }, 68 },
69}; 69};
70 70
71/*
72 * If a link is initialized, we never change its active and initialized
73 * later even the link is disable. Instead, we just repick the active irq
74 */
71struct acpi_pci_link_irq { 75struct acpi_pci_link_irq {
72 u8 active; /* Current IRQ */ 76 u8 active; /* Current IRQ */
73 u8 edge_level; /* All IRQs */ 77 u8 edge_level; /* All IRQs */
@@ -76,8 +80,7 @@ struct acpi_pci_link_irq {
76 u8 possible_count; 80 u8 possible_count;
77 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; 81 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
78 u8 initialized:1; 82 u8 initialized:1;
79 u8 suspend_resume:1; 83 u8 reserved:7;
80 u8 reserved:6;
81}; 84};
82 85
83struct acpi_pci_link { 86struct acpi_pci_link {
@@ -85,12 +88,14 @@ struct acpi_pci_link {
85 struct acpi_device *device; 88 struct acpi_device *device;
86 acpi_handle handle; 89 acpi_handle handle;
87 struct acpi_pci_link_irq irq; 90 struct acpi_pci_link_irq irq;
91 int refcnt;
88}; 92};
89 93
90static struct { 94static struct {
91 int count; 95 int count;
92 struct list_head entries; 96 struct list_head entries;
93} acpi_link; 97} acpi_link;
98DECLARE_MUTEX(acpi_link_lock);
94 99
95 100
96/* -------------------------------------------------------------------------- 101/* --------------------------------------------------------------------------
@@ -532,12 +537,12 @@ static int acpi_pci_link_allocate(
532 537
533 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); 538 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");
534 539
535 if (link->irq.suspend_resume) { 540 if (link->irq.initialized) {
536 acpi_pci_link_set(link, link->irq.active); 541 if (link->refcnt == 0)
537 link->irq.suspend_resume = 0; 542 /* This means the link is disabled but initialized */
538 } 543 acpi_pci_link_set(link, link->irq.active);
539 if (link->irq.initialized)
540 return_VALUE(0); 544 return_VALUE(0);
545 }
541 546
542 /* 547 /*
543 * search for active IRQ in list of possible IRQs. 548 * search for active IRQ in list of possible IRQs.
@@ -596,13 +601,13 @@ static int acpi_pci_link_allocate(
596} 601}
597 602
598/* 603/*
599 * acpi_pci_link_get_irq 604 * acpi_pci_link_allocate_irq
600 * success: return IRQ >= 0 605 * success: return IRQ >= 0
601 * failure: return -1 606 * failure: return -1
602 */ 607 */
603 608
604int 609int
605acpi_pci_link_get_irq ( 610acpi_pci_link_allocate_irq (
606 acpi_handle handle, 611 acpi_handle handle,
607 int index, 612 int index,
608 int *edge_level, 613 int *edge_level,
@@ -613,7 +618,7 @@ acpi_pci_link_get_irq (
613 struct acpi_device *device = NULL; 618 struct acpi_device *device = NULL;
614 struct acpi_pci_link *link = NULL; 619 struct acpi_pci_link *link = NULL;
615 620
616 ACPI_FUNCTION_TRACE("acpi_pci_link_get_irq"); 621 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq");
617 622
618 result = acpi_bus_get_device(handle, &device); 623 result = acpi_bus_get_device(handle, &device);
619 if (result) { 624 if (result) {
@@ -633,21 +638,81 @@ acpi_pci_link_get_irq (
633 return_VALUE(-1); 638 return_VALUE(-1);
634 } 639 }
635 640
636 if (acpi_pci_link_allocate(link)) 641 down(&acpi_link_lock);
642 if (acpi_pci_link_allocate(link)) {
643 up(&acpi_link_lock);
637 return_VALUE(-1); 644 return_VALUE(-1);
645 }
638 646
639 if (!link->irq.active) { 647 if (!link->irq.active) {
648 up(&acpi_link_lock);
640 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); 649 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n"));
641 return_VALUE(-1); 650 return_VALUE(-1);
642 } 651 }
652 link->refcnt ++;
653 up(&acpi_link_lock);
643 654
644 if (edge_level) *edge_level = link->irq.edge_level; 655 if (edge_level) *edge_level = link->irq.edge_level;
645 if (active_high_low) *active_high_low = link->irq.active_high_low; 656 if (active_high_low) *active_high_low = link->irq.active_high_low;
646 if (name) *name = acpi_device_bid(link->device); 657 if (name) *name = acpi_device_bid(link->device);
658 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
659 "Link %s is referenced\n", acpi_device_bid(link->device)));
647 return_VALUE(link->irq.active); 660 return_VALUE(link->irq.active);
648} 661}
649 662
663/*
664 * We don't change link's irq information here. After it is reenabled, we
665 * continue use the info
666 */
667int
668acpi_pci_link_free_irq(acpi_handle handle)
669{
670 struct acpi_device *device = NULL;
671 struct acpi_pci_link *link = NULL;
672 acpi_status result;
673
674 ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq");
675
676 result = acpi_bus_get_device(handle, &device);
677 if (result) {
678 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n"));
679 return_VALUE(-1);
680 }
681
682 link = (struct acpi_pci_link *) acpi_driver_data(device);
683 if (!link) {
684 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
685 return_VALUE(-1);
686 }
687
688 down(&acpi_link_lock);
689 if (!link->irq.initialized) {
690 up(&acpi_link_lock);
691 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n"));
692 return_VALUE(-1);
693 }
650 694
695#ifdef FUTURE_USE
696 /*
697 * The Link reference count allows us to _DISable an unused link
698 * and suspend time, and set it again on resume.
699 * However, 2.6.12 still has irq_router.resume
700 * which blindly restores the link state.
701 * So we disable the reference count method
702 * to prevent duplicate acpi_pci_link_set()
703 * which would harm some systems
704 */
705 link->refcnt --;
706#endif
707 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
708 "Link %s is dereferenced\n", acpi_device_bid(link->device)));
709
710 if (link->refcnt == 0) {
711 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
712 }
713 up(&acpi_link_lock);
714 return_VALUE(link->irq.active);
715}
651/* -------------------------------------------------------------------------- 716/* --------------------------------------------------------------------------
652 Driver Interface 717 Driver Interface
653 -------------------------------------------------------------------------- */ 718 -------------------------------------------------------------------------- */
@@ -677,6 +742,7 @@ acpi_pci_link_add (
677 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); 742 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
678 acpi_driver_data(device) = link; 743 acpi_driver_data(device) = link;
679 744
745 down(&acpi_link_lock);
680 result = acpi_pci_link_get_possible(link); 746 result = acpi_pci_link_get_possible(link);
681 if (result) 747 if (result)
682 goto end; 748 goto end;
@@ -712,6 +778,7 @@ acpi_pci_link_add (
712end: 778end:
713 /* disable all links -- to be activated on use */ 779 /* disable all links -- to be activated on use */
714 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 780 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
781 up(&acpi_link_lock);
715 782
716 if (result) 783 if (result)
717 kfree(link); 784 kfree(link);
@@ -720,24 +787,42 @@ end:
720} 787}
721 788
722static int 789static int
723irqrouter_suspend( 790acpi_pci_link_resume(
724 struct sys_device *dev, 791 struct acpi_pci_link *link)
725 u32 state) 792{
793 ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
794
795 if (link->refcnt && link->irq.active && link->irq.initialized)
796 return_VALUE(acpi_pci_link_set(link, link->irq.active));
797 else
798 return_VALUE(0);
799}
800
801/*
802 * FIXME: this is a workaround to avoid nasty warning. It will be removed
803 * after every device calls pci_disable_device in .resume.
804 */
805int acpi_in_resume;
806static int
807irqrouter_resume(
808 struct sys_device *dev)
726{ 809{
727 struct list_head *node = NULL; 810 struct list_head *node = NULL;
728 struct acpi_pci_link *link = NULL; 811 struct acpi_pci_link *link = NULL;
729 812
730 ACPI_FUNCTION_TRACE("irqrouter_suspend"); 813 ACPI_FUNCTION_TRACE("irqrouter_resume");
731 814
815 acpi_in_resume = 1;
732 list_for_each(node, &acpi_link.entries) { 816 list_for_each(node, &acpi_link.entries) {
733 link = list_entry(node, struct acpi_pci_link, node); 817 link = list_entry(node, struct acpi_pci_link, node);
734 if (!link) { 818 if (!link) {
735 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); 819 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
820 "Invalid link context\n"));
736 continue; 821 continue;
737 } 822 }
738 if (link->irq.active && link->irq.initialized) 823 acpi_pci_link_resume(link);
739 link->irq.suspend_resume = 1;
740 } 824 }
825 acpi_in_resume = 0;
741 return_VALUE(0); 826 return_VALUE(0);
742} 827}
743 828
@@ -756,8 +841,9 @@ acpi_pci_link_remove (
756 841
757 link = (struct acpi_pci_link *) acpi_driver_data(device); 842 link = (struct acpi_pci_link *) acpi_driver_data(device);
758 843
759 /* TBD: Acquire/release lock */ 844 down(&acpi_link_lock);
760 list_del(&link->node); 845 list_del(&link->node);
846 up(&acpi_link_lock);
761 847
762 kfree(link); 848 kfree(link);
763 849
@@ -849,9 +935,10 @@ int __init acpi_irq_balance_set(char *str)
849__setup("acpi_irq_balance", acpi_irq_balance_set); 935__setup("acpi_irq_balance", acpi_irq_balance_set);
850 936
851 937
938/* FIXME: we will remove this interface after all drivers call pci_disable_device */
852static struct sysdev_class irqrouter_sysdev_class = { 939static struct sysdev_class irqrouter_sysdev_class = {
853 set_kset_name("irqrouter"), 940 set_kset_name("irqrouter"),
854 .suspend = irqrouter_suspend, 941 .resume = irqrouter_resume,
855}; 942};
856 943
857 944
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 893b074e3d1a..2c04740c6543 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -81,30 +81,32 @@ module_param(bm_history, uint, 0644);
81 * 81 *
82 * To skip this limit, boot/load with a large max_cstate limit. 82 * To skip this limit, boot/load with a large max_cstate limit.
83 */ 83 */
84static int no_c2c3(struct dmi_system_id *id) 84static int set_max_cstate(struct dmi_system_id *id)
85{ 85{
86 if (max_cstate > ACPI_PROCESSOR_MAX_POWER) 86 if (max_cstate > ACPI_PROCESSOR_MAX_POWER)
87 return 0; 87 return 0;
88 88
89 printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." 89 printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate."
90 " Override with \"processor.max_cstate=%d\"\n", id->ident, 90 " Override with \"processor.max_cstate=%d\"\n", id->ident,
91 ACPI_PROCESSOR_MAX_POWER + 1); 91 (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1);
92 92
93 max_cstate = 1; 93 max_cstate = (long)id->driver_data;
94 94
95 return 0; 95 return 0;
96} 96}
97 97
98 98
99
100
101static struct dmi_system_id __initdata processor_power_dmi_table[] = { 99static struct dmi_system_id __initdata processor_power_dmi_table[] = {
102 { no_c2c3, "IBM ThinkPad R40e", { 100 { set_max_cstate, "IBM ThinkPad R40e", {
103 DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), 101 DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
104 DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, 102 DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1},
105 { no_c2c3, "Medion 41700", { 103 { set_max_cstate, "Medion 41700", {
104 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
105 DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1},
106 { set_max_cstate, "Clevo 5600D", {
106 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), 107 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
107 DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, 108 DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") },
109 (void*)2},
108 {}, 110 {},
109}; 111};
110 112
@@ -549,7 +551,8 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr)
549 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); 551 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
550 552
551 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) 553 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
552 memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); 554 memset(&(pr->power.states[i]), 0,
555 sizeof(struct acpi_processor_cx));
553 556
554 /* if info is obtained from pblk/fadt, type equals state */ 557 /* if info is obtained from pblk/fadt, type equals state */
555 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; 558 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
@@ -580,7 +583,8 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
580 583
581 pr->power.count = 0; 584 pr->power.count = 0;
582 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) 585 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
583 memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); 586 memset(&(pr->power.states[i]), 0,
587 sizeof(struct acpi_processor_cx));
584 588
585 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); 589 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
586 if (ACPI_FAILURE(status)) { 590 if (ACPI_FAILURE(status)) {
@@ -763,7 +767,6 @@ static void acpi_processor_power_verify_c3(
763 } 767 }
764 768
765 if (pr->flags.bm_check) { 769 if (pr->flags.bm_check) {
766 printk("Disabling BM access before entering C3\n");
767 /* bus mastering control is necessary */ 770 /* bus mastering control is necessary */
768 if (!pr->flags.bm_control) { 771 if (!pr->flags.bm_control) {
769 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 772 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -771,7 +774,6 @@ static void acpi_processor_power_verify_c3(
771 return_VOID; 774 return_VOID;
772 } 775 }
773 } else { 776 } else {
774 printk("Invalidating cache before entering C3\n");
775 /* 777 /*
776 * WBINVD should be set in fadt, for C3 state to be 778 * WBINVD should be set in fadt, for C3 state to be
777 * supported on when bm_check is not required. 779 * supported on when bm_check is not required.
@@ -842,7 +844,7 @@ static int acpi_processor_get_power_info (
842 result = acpi_processor_get_power_info_cst(pr); 844 result = acpi_processor_get_power_info_cst(pr);
843 if ((result) || (acpi_processor_power_verify(pr) < 2)) { 845 if ((result) || (acpi_processor_power_verify(pr) < 2)) {
844 result = acpi_processor_get_power_info_fadt(pr); 846 result = acpi_processor_get_power_info_fadt(pr);
845 if (result) 847 if ((result) || (acpi_processor_power_verify(pr) < 2))
846 result = acpi_processor_get_power_info_default_c1(pr); 848 result = acpi_processor_get_power_info_default_c1(pr);
847 } 849 }
848 850
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
index 91aeb678135d..95c0a3690b0f 100644
--- a/drivers/block/as-iosched.c
+++ b/drivers/block/as-iosched.c
@@ -1935,23 +1935,15 @@ struct as_fs_entry {
1935static ssize_t 1935static ssize_t
1936as_var_show(unsigned int var, char *page) 1936as_var_show(unsigned int var, char *page)
1937{ 1937{
1938 var = (var * 1000) / HZ;
1939 return sprintf(page, "%d\n", var); 1938 return sprintf(page, "%d\n", var);
1940} 1939}
1941 1940
1942static ssize_t 1941static ssize_t
1943as_var_store(unsigned long *var, const char *page, size_t count) 1942as_var_store(unsigned long *var, const char *page, size_t count)
1944{ 1943{
1945 unsigned long tmp;
1946 char *p = (char *) page; 1944 char *p = (char *) page;
1947 1945
1948 tmp = simple_strtoul(p, &p, 10); 1946 *var = simple_strtoul(p, &p, 10);
1949 if (tmp != 0) {
1950 tmp = (tmp * HZ) / 1000;
1951 if (tmp == 0)
1952 tmp = 1;
1953 }
1954 *var = tmp;
1955 return count; 1947 return count;
1956} 1948}
1957 1949
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 3e9fb6e4a52a..418b1469d75d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1135,7 +1135,7 @@ static int revalidate_allvol(ctlr_info_t *host)
1135 /* this is for the online array utilities */ 1135 /* this is for the online array utilities */
1136 if (!drv->heads && i) 1136 if (!drv->heads && i)
1137 continue; 1137 continue;
1138 blk_queue_hardsect_size(host->queue, drv->block_size); 1138 blk_queue_hardsect_size(drv->queue, drv->block_size);
1139 set_capacity(disk, drv->nr_blocks); 1139 set_capacity(disk, drv->nr_blocks);
1140 add_disk(disk); 1140 add_disk(disk);
1141 } 1141 }
@@ -1691,7 +1691,7 @@ static int cciss_revalidate(struct gendisk *disk)
1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); 1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size);
1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); 1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv);
1693 1693
1694 blk_queue_hardsect_size(h->queue, drv->block_size); 1694 blk_queue_hardsect_size(drv->queue, drv->block_size);
1695 set_capacity(disk, drv->nr_blocks); 1695 set_capacity(disk, drv->nr_blocks);
1696 1696
1697 kfree(size_buff); 1697 kfree(size_buff);
@@ -2248,12 +2248,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2248 * them up. We will also keep track of the next queue to run so 2248 * them up. We will also keep track of the next queue to run so
2249 * that every queue gets a chance to be started first. 2249 * that every queue gets a chance to be started first.
2250 */ 2250 */
2251 for (j=0; j < NWD; j++){ 2251 for (j=0; j < h->highest_lun + 1; j++){
2252 int curr_queue = (start_queue + j) % NWD; 2252 int curr_queue = (start_queue + j) % (h->highest_lun + 1);
2253 /* make sure the disk has been added and the drive is real 2253 /* make sure the disk has been added and the drive is real
2254 * because this can be called from the middle of init_one. 2254 * because this can be called from the middle of init_one.
2255 */ 2255 */
2256 if(!(h->gendisk[curr_queue]->queue) || 2256 if(!(h->drv[curr_queue].queue) ||
2257 !(h->drv[curr_queue].heads)) 2257 !(h->drv[curr_queue].heads))
2258 continue; 2258 continue;
2259 blk_start_queue(h->gendisk[curr_queue]->queue); 2259 blk_start_queue(h->gendisk[curr_queue]->queue);
@@ -2264,14 +2264,14 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) 2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
2265 { 2265 {
2266 if (curr_queue == start_queue){ 2266 if (curr_queue == start_queue){
2267 h->next_to_run = (start_queue + 1) % NWD; 2267 h->next_to_run = (start_queue + 1) % (h->highest_lun + 1);
2268 goto cleanup; 2268 goto cleanup;
2269 } else { 2269 } else {
2270 h->next_to_run = curr_queue; 2270 h->next_to_run = curr_queue;
2271 goto cleanup; 2271 goto cleanup;
2272 } 2272 }
2273 } else { 2273 } else {
2274 curr_queue = (curr_queue + 1) % NWD; 2274 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
2275 } 2275 }
2276 } 2276 }
2277 2277
@@ -2279,7 +2279,6 @@ cleanup:
2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
2280 return IRQ_HANDLED; 2280 return IRQ_HANDLED;
2281} 2281}
2282
2283/* 2282/*
2284 * We cannot read the structure directly, for portablity we must use 2283 * We cannot read the structure directly, for portablity we must use
2285 * the io functions. 2284 * the io functions.
@@ -2789,13 +2788,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2789 } 2788 }
2790 2789
2791 spin_lock_init(&hba[i]->lock); 2790 spin_lock_init(&hba[i]->lock);
2792 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2793 if (!q)
2794 goto clean4;
2795
2796 q->backing_dev_info.ra_pages = READ_AHEAD;
2797 hba[i]->queue = q;
2798 q->queuedata = hba[i];
2799 2791
2800 /* Initialize the pdev driver private data. 2792 /* Initialize the pdev driver private data.
2801 have it point to hba[i]. */ 2793 have it point to hba[i]. */
@@ -2817,6 +2809,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2817 2809
2818 cciss_procinit(i); 2810 cciss_procinit(i);
2819 2811
2812 for(j=0; j < NWD; j++) { /* mfm */
2813 drive_info_struct *drv = &(hba[i]->drv[j]);
2814 struct gendisk *disk = hba[i]->gendisk[j];
2815
2816 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2817 if (!q) {
2818 printk(KERN_ERR
2819 "cciss: unable to allocate queue for disk %d\n",
2820 j);
2821 break;
2822 }
2823 drv->queue = q;
2824
2825 q->backing_dev_info.ra_pages = READ_AHEAD;
2820 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); 2826 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
2821 2827
2822 /* This is a hardware imposed limit. */ 2828 /* This is a hardware imposed limit. */
@@ -2827,26 +2833,23 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2827 2833
2828 blk_queue_max_sectors(q, 512); 2834 blk_queue_max_sectors(q, 512);
2829 2835
2830 2836 q->queuedata = hba[i];
2831 for(j=0; j<NWD; j++) {
2832 drive_info_struct *drv = &(hba[i]->drv[j]);
2833 struct gendisk *disk = hba[i]->gendisk[j];
2834
2835 sprintf(disk->disk_name, "cciss/c%dd%d", i, j); 2837 sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
2836 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); 2838 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j);
2837 disk->major = hba[i]->major; 2839 disk->major = hba[i]->major;
2838 disk->first_minor = j << NWD_SHIFT; 2840 disk->first_minor = j << NWD_SHIFT;
2839 disk->fops = &cciss_fops; 2841 disk->fops = &cciss_fops;
2840 disk->queue = hba[i]->queue; 2842 disk->queue = q;
2841 disk->private_data = drv; 2843 disk->private_data = drv;
2842 /* we must register the controller even if no disks exist */ 2844 /* we must register the controller even if no disks exist */
2843 /* this is for the online array utilities */ 2845 /* this is for the online array utilities */
2844 if(!drv->heads && j) 2846 if(!drv->heads && j)
2845 continue; 2847 continue;
2846 blk_queue_hardsect_size(hba[i]->queue, drv->block_size); 2848 blk_queue_hardsect_size(q, drv->block_size);
2847 set_capacity(disk, drv->nr_blocks); 2849 set_capacity(disk, drv->nr_blocks);
2848 add_disk(disk); 2850 add_disk(disk);
2849 } 2851 }
2852
2850 return(1); 2853 return(1);
2851 2854
2852clean4: 2855clean4:
@@ -2912,10 +2915,10 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev)
2912 for (j = 0; j < NWD; j++) { 2915 for (j = 0; j < NWD; j++) {
2913 struct gendisk *disk = hba[i]->gendisk[j]; 2916 struct gendisk *disk = hba[i]->gendisk[j];
2914 if (disk->flags & GENHD_FL_UP) 2917 if (disk->flags & GENHD_FL_UP)
2918 blk_cleanup_queue(disk->queue);
2915 del_gendisk(disk); 2919 del_gendisk(disk);
2916 } 2920 }
2917 2921
2918 blk_cleanup_queue(hba[i]->queue);
2919 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), 2922 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct),
2920 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 2923 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
2921 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), 2924 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct),
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index 8fb19206eddb..566587d0a500 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -29,6 +29,7 @@ typedef struct _drive_info_struct
29{ 29{
30 __u32 LunID; 30 __u32 LunID;
31 int usage_count; 31 int usage_count;
32 struct request_queue *queue;
32 sector_t nr_blocks; 33 sector_t nr_blocks;
33 int block_size; 34 int block_size;
34 int heads; 35 int heads;
@@ -72,7 +73,6 @@ struct ctlr_info
72 unsigned int maxQsinceinit; 73 unsigned int maxQsinceinit;
73 unsigned int maxSG; 74 unsigned int maxSG;
74 spinlock_t lock; 75 spinlock_t lock;
75 struct request_queue *queue;
76 76
77 //* pointers to command and error info pool */ 77 //* pointers to command and error info pool */
78 CommandList_struct *cmd_pool; 78 CommandList_struct *cmd_pool;
@@ -260,7 +260,7 @@ struct board_type {
260 struct access_method *access; 260 struct access_method *access;
261}; 261};
262 262
263#define CCISS_LOCK(i) (hba[i]->queue->queue_lock) 263#define CCISS_LOCK(i) (&hba[i]->lock)
264 264
265#endif /* CCISS_H */ 265#endif /* CCISS_H */
266 266
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index de5746e38af9..2435a7c99b2b 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -1281,6 +1281,7 @@ dispatch:
1281 */ 1281 */
1282 if (!cfq_crq_in_driver(crq) && 1282 if (!cfq_crq_in_driver(crq) &&
1283 !cfq_cfqq_idle_window(cfqq) && 1283 !cfq_cfqq_idle_window(cfqq) &&
1284 !blk_barrier_rq(rq) &&
1284 cfqd->rq_in_driver >= cfqd->cfq_max_depth) 1285 cfqd->rq_in_driver >= cfqd->cfq_max_depth)
1285 return NULL; 1286 return NULL;
1286 1287
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 692a5fced76e..3c818544475e 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -719,7 +719,7 @@ struct request *blk_queue_find_tag(request_queue_t *q, int tag)
719{ 719{
720 struct blk_queue_tag *bqt = q->queue_tags; 720 struct blk_queue_tag *bqt = q->queue_tags;
721 721
722 if (unlikely(bqt == NULL || tag >= bqt->max_depth)) 722 if (unlikely(bqt == NULL || tag >= bqt->real_max_depth))
723 return NULL; 723 return NULL;
724 724
725 return bqt->tag_index[tag]; 725 return bqt->tag_index[tag];
@@ -798,6 +798,7 @@ init_tag_map(request_queue_t *q, struct blk_queue_tag *tags, int depth)
798 798
799 memset(tag_index, 0, depth * sizeof(struct request *)); 799 memset(tag_index, 0, depth * sizeof(struct request *));
800 memset(tag_map, 0, nr_ulongs * sizeof(unsigned long)); 800 memset(tag_map, 0, nr_ulongs * sizeof(unsigned long));
801 tags->real_max_depth = depth;
801 tags->max_depth = depth; 802 tags->max_depth = depth;
802 tags->tag_index = tag_index; 803 tags->tag_index = tag_index;
803 tags->tag_map = tag_map; 804 tags->tag_map = tag_map;
@@ -872,11 +873,22 @@ int blk_queue_resize_tags(request_queue_t *q, int new_depth)
872 return -ENXIO; 873 return -ENXIO;
873 874
874 /* 875 /*
876 * if we already have large enough real_max_depth. just
877 * adjust max_depth. *NOTE* as requests with tag value
878 * between new_depth and real_max_depth can be in-flight, tag
879 * map can not be shrunk blindly here.
880 */
881 if (new_depth <= bqt->real_max_depth) {
882 bqt->max_depth = new_depth;
883 return 0;
884 }
885
886 /*
875 * save the old state info, so we can copy it back 887 * save the old state info, so we can copy it back
876 */ 888 */
877 tag_index = bqt->tag_index; 889 tag_index = bqt->tag_index;
878 tag_map = bqt->tag_map; 890 tag_map = bqt->tag_map;
879 max_depth = bqt->max_depth; 891 max_depth = bqt->real_max_depth;
880 892
881 if (init_tag_map(q, bqt, new_depth)) 893 if (init_tag_map(q, bqt, new_depth))
882 return -ENOMEM; 894 return -ENOMEM;
@@ -913,7 +925,7 @@ void blk_queue_end_tag(request_queue_t *q, struct request *rq)
913 925
914 BUG_ON(tag == -1); 926 BUG_ON(tag == -1);
915 927
916 if (unlikely(tag >= bqt->max_depth)) 928 if (unlikely(tag >= bqt->real_max_depth))
917 /* 929 /*
918 * This can happen after tag depth has been reduced. 930 * This can happen after tag depth has been reduced.
919 * FIXME: how about a warning or info message here? 931 * FIXME: how about a warning or info message here?
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 9db0a9e3e59c..d57007b92f77 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -1582,7 +1582,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1582 if (rc) 1582 if (rc)
1583 goto err_out; 1583 goto err_out;
1584 1584
1585#if IF_64BIT_DMA_IS_POSSIBLE /* grrrr... */ 1585#ifdef IF_64BIT_DMA_IS_POSSIBLE /* grrrr... */
1586 rc = pci_set_dma_mask(pdev, DMA_64BIT_MASK); 1586 rc = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
1587 if (!rc) { 1587 if (!rc) {
1588 rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); 1588 rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
@@ -1601,7 +1601,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1601 goto err_out_regions; 1601 goto err_out_regions;
1602 } 1602 }
1603 pci_dac = 0; 1603 pci_dac = 0;
1604#if IF_64BIT_DMA_IS_POSSIBLE /* grrrr... */ 1604#ifdef IF_64BIT_DMA_IS_POSSIBLE /* grrrr... */
1605 } 1605 }
1606#endif 1606#endif
1607 1607
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 685f061e69b2..a026567f5d18 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -23,6 +23,7 @@
23 * -- Exterminate P3 printks 23 * -- Exterminate P3 printks
24 * -- Resove XXX's 24 * -- Resove XXX's
25 * -- Redo "benh's retries", perhaps have spin-up code to handle them. V:D=? 25 * -- Redo "benh's retries", perhaps have spin-up code to handle them. V:D=?
26 * -- CLEAR, CLR2STS, CLRRS seem to be ripe for refactoring.
26 */ 27 */
27#include <linux/kernel.h> 28#include <linux/kernel.h>
28#include <linux/module.h> 29#include <linux/module.h>
@@ -38,6 +39,73 @@
38#define UB_MAJOR 180 39#define UB_MAJOR 180
39 40
40/* 41/*
42 * The command state machine is the key model for understanding of this driver.
43 *
44 * The general rule is that all transitions are done towards the bottom
45 * of the diagram, thus preventing any loops.
46 *
47 * An exception to that is how the STAT state is handled. A counter allows it
48 * to be re-entered along the path marked with [C].
49 *
50 * +--------+
51 * ! INIT !
52 * +--------+
53 * !
54 * ub_scsi_cmd_start fails ->--------------------------------------\
55 * ! !
56 * V !
57 * +--------+ !
58 * ! CMD ! !
59 * +--------+ !
60 * ! +--------+ !
61 * was -EPIPE -->-------------------------------->! CLEAR ! !
62 * ! +--------+ !
63 * ! ! !
64 * was error -->------------------------------------- ! --------->\
65 * ! ! !
66 * /--<-- cmd->dir == NONE ? ! !
67 * ! ! ! !
68 * ! V ! !
69 * ! +--------+ ! !
70 * ! ! DATA ! ! !
71 * ! +--------+ ! !
72 * ! ! +---------+ ! !
73 * ! was -EPIPE -->--------------->! CLR2STS ! ! !
74 * ! ! +---------+ ! !
75 * ! ! ! ! !
76 * ! ! was error -->---- ! --------->\
77 * ! was error -->--------------------- ! ------------- ! --------->\
78 * ! ! ! ! !
79 * ! V ! ! !
80 * \--->+--------+ ! ! !
81 * ! STAT !<--------------------------/ ! !
82 * /--->+--------+ ! !
83 * ! ! ! !
84 * [C] was -EPIPE -->-----------\ ! !
85 * ! ! ! ! !
86 * +<---- len == 0 ! ! !
87 * ! ! ! ! !
88 * ! was error -->--------------------------------------!---------->\
89 * ! ! ! ! !
90 * +<---- bad CSW ! ! !
91 * +<---- bad tag ! ! !
92 * ! ! V ! !
93 * ! ! +--------+ ! !
94 * ! ! ! CLRRS ! ! !
95 * ! ! +--------+ ! !
96 * ! ! ! ! !
97 * \------- ! --------------------[C]--------\ ! !
98 * ! ! ! !
99 * cmd->error---\ +--------+ ! !
100 * ! +--------------->! SENSE !<----------/ !
101 * STAT_FAIL----/ +--------+ !
102 * ! ! V
103 * ! V +--------+
104 * \--------------------------------\--------------------->! DONE !
105 * +--------+
106 */
107
108/*
41 * Definitions which have to be scattered once we understand the layout better. 109 * Definitions which have to be scattered once we understand the layout better.
42 */ 110 */
43 111
@@ -91,8 +159,6 @@ struct bulk_cs_wrap {
91 159
92#define US_BULK_CS_WRAP_LEN 13 160#define US_BULK_CS_WRAP_LEN 13
93#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */ 161#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
94/* This is for Olympus Camedia digital cameras */
95#define US_BULK_CS_OLYMPUS_SIGN 0x55425355 /* spells out 'USBU' */
96#define US_BULK_STAT_OK 0 162#define US_BULK_STAT_OK 0
97#define US_BULK_STAT_FAIL 1 163#define US_BULK_STAT_FAIL 1
98#define US_BULK_STAT_PHASE 2 164#define US_BULK_STAT_PHASE 2
@@ -135,6 +201,7 @@ enum ub_scsi_cmd_state {
135 UB_CMDST_CLR2STS, /* Clearing before requesting status */ 201 UB_CMDST_CLR2STS, /* Clearing before requesting status */
136 UB_CMDST_STAT, /* Status phase */ 202 UB_CMDST_STAT, /* Status phase */
137 UB_CMDST_CLEAR, /* Clearing a stall (halt, actually) */ 203 UB_CMDST_CLEAR, /* Clearing a stall (halt, actually) */
204 UB_CMDST_CLRRS, /* Clearing before retrying status */
138 UB_CMDST_SENSE, /* Sending Request Sense */ 205 UB_CMDST_SENSE, /* Sending Request Sense */
139 UB_CMDST_DONE /* Final state */ 206 UB_CMDST_DONE /* Final state */
140}; 207};
@@ -146,6 +213,7 @@ static char *ub_scsi_cmd_stname[] = {
146 "c2s", 213 "c2s",
147 "sts", 214 "sts",
148 "clr", 215 "clr",
216 "crs",
149 "Sen", 217 "Sen",
150 "fin" 218 "fin"
151}; 219};
@@ -316,6 +384,7 @@ struct ub_dev {
316 struct urb work_urb; 384 struct urb work_urb;
317 struct timer_list work_timer; 385 struct timer_list work_timer;
318 int last_pipe; /* What might need clearing */ 386 int last_pipe; /* What might need clearing */
387 __le32 signature; /* Learned signature */
319 struct bulk_cb_wrap work_bcb; 388 struct bulk_cb_wrap work_bcb;
320 struct bulk_cs_wrap work_bcs; 389 struct bulk_cs_wrap work_bcs;
321 struct usb_ctrlrequest work_cr; 390 struct usb_ctrlrequest work_cr;
@@ -339,8 +408,9 @@ static void ub_scsi_action(unsigned long _dev);
339static void ub_scsi_dispatch(struct ub_dev *sc); 408static void ub_scsi_dispatch(struct ub_dev *sc);
340static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 409static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
341static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc); 410static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc);
342static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 411static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
343static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 412static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
413static void ub_state_stat_counted(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
344static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 414static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
345static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, 415static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd,
346 int stalled_pipe); 416 int stalled_pipe);
@@ -1085,6 +1155,28 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1085 1155
1086 ub_state_stat(sc, cmd); 1156 ub_state_stat(sc, cmd);
1087 1157
1158 } else if (cmd->state == UB_CMDST_CLRRS) {
1159 if (urb->status == -EPIPE) {
1160 /*
1161 * STALL while clearning STALL.
1162 * The control pipe clears itself - nothing to do.
1163 * XXX Might try to reset the device here and retry.
1164 */
1165 printk(KERN_NOTICE "%s: stall on control pipe\n",
1166 sc->name);
1167 goto Bad_End;
1168 }
1169
1170 /*
1171 * We ignore the result for the halt clear.
1172 */
1173
1174 /* reset the endpoint toggle */
1175 usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
1176 usb_pipeout(sc->last_pipe), 0);
1177
1178 ub_state_stat_counted(sc, cmd);
1179
1088 } else if (cmd->state == UB_CMDST_CMD) { 1180 } else if (cmd->state == UB_CMDST_CMD) {
1089 if (urb->status == -EPIPE) { 1181 if (urb->status == -EPIPE) {
1090 rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe); 1182 rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe);
@@ -1190,52 +1282,57 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1190 */ 1282 */
1191 goto Bad_End; 1283 goto Bad_End;
1192 } 1284 }
1193 cmd->state = UB_CMDST_CLEAR; 1285
1286 /*
1287 * Having a stall when getting CSW is an error, so
1288 * make sure uppper levels are not oblivious to it.
1289 */
1290 cmd->error = -EIO; /* A cheap trick... */
1291
1292 cmd->state = UB_CMDST_CLRRS;
1194 ub_cmdtr_state(sc, cmd); 1293 ub_cmdtr_state(sc, cmd);
1195 return; 1294 return;
1196 } 1295 }
1296 if (urb->status == -EOVERFLOW) {
1297 /*
1298 * XXX We are screwed here. Retrying is pointless,
1299 * because the pipelined data will not get in until
1300 * we read with a big enough buffer. We must reset XXX.
1301 */
1302 goto Bad_End;
1303 }
1197 if (urb->status != 0) 1304 if (urb->status != 0)
1198 goto Bad_End; 1305 goto Bad_End;
1199 1306
1200 if (urb->actual_length == 0) { 1307 if (urb->actual_length == 0) {
1201 /* 1308 ub_state_stat_counted(sc, cmd);
1202 * Some broken devices add unnecessary zero-length
1203 * packets to the end of their data transfers.
1204 * Such packets show up as 0-length CSWs. If we
1205 * encounter such a thing, try to read the CSW again.
1206 */
1207 if (++cmd->stat_count >= 4) {
1208 printk(KERN_NOTICE "%s: unable to get CSW\n",
1209 sc->name);
1210 goto Bad_End;
1211 }
1212 __ub_state_stat(sc, cmd);
1213 return; 1309 return;
1214 } 1310 }
1215 1311
1216 /* 1312 /*
1217 * Check the returned Bulk protocol status. 1313 * Check the returned Bulk protocol status.
1314 * The status block has to be validated first.
1218 */ 1315 */
1219 1316
1220 bcs = &sc->work_bcs; 1317 bcs = &sc->work_bcs;
1221 rc = le32_to_cpu(bcs->Residue); 1318
1222 if (rc != cmd->len - cmd->act_len) { 1319 if (sc->signature == cpu_to_le32(0)) {
1223 /* 1320 /*
1224 * It is all right to transfer less, the caller has 1321 * This is the first reply, so do not perform the check.
1225 * to check. But it's not all right if the device 1322 * Instead, remember the signature the device uses
1226 * counts disagree with our counts. 1323 * for future checks. But do not allow a nul.
1227 */ 1324 */
1228 /* P3 */ printk("%s: resid %d len %d act %d\n", 1325 sc->signature = bcs->Signature;
1229 sc->name, rc, cmd->len, cmd->act_len); 1326 if (sc->signature == cpu_to_le32(0)) {
1230 goto Bad_End; 1327 ub_state_stat_counted(sc, cmd);
1231 } 1328 return;
1232 1329 }
1233#if 0 1330 } else {
1234 if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN) && 1331 if (bcs->Signature != sc->signature) {
1235 bcs->Signature != cpu_to_le32(US_BULK_CS_OLYMPUS_SIGN)) { 1332 ub_state_stat_counted(sc, cmd);
1236 /* Windows ignores signatures, so do we. */ 1333 return;
1334 }
1237 } 1335 }
1238#endif
1239 1336
1240 if (bcs->Tag != cmd->tag) { 1337 if (bcs->Tag != cmd->tag) {
1241 /* 1338 /*
@@ -1245,16 +1342,22 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1245 * commands and reply at commands we timed out before. 1342 * commands and reply at commands we timed out before.
1246 * Without flushing these replies we loop forever. 1343 * Without flushing these replies we loop forever.
1247 */ 1344 */
1248 if (++cmd->stat_count >= 4) { 1345 ub_state_stat_counted(sc, cmd);
1249 printk(KERN_NOTICE "%s: "
1250 "tag mismatch orig 0x%x reply 0x%x\n",
1251 sc->name, cmd->tag, bcs->Tag);
1252 goto Bad_End;
1253 }
1254 __ub_state_stat(sc, cmd);
1255 return; 1346 return;
1256 } 1347 }
1257 1348
1349 rc = le32_to_cpu(bcs->Residue);
1350 if (rc != cmd->len - cmd->act_len) {
1351 /*
1352 * It is all right to transfer less, the caller has
1353 * to check. But it's not all right if the device
1354 * counts disagree with our counts.
1355 */
1356 /* P3 */ printk("%s: resid %d len %d act %d\n",
1357 sc->name, rc, cmd->len, cmd->act_len);
1358 goto Bad_End;
1359 }
1360
1258 switch (bcs->Status) { 1361 switch (bcs->Status) {
1259 case US_BULK_STAT_OK: 1362 case US_BULK_STAT_OK:
1260 break; 1363 break;
@@ -1272,6 +1375,10 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1272 } 1375 }
1273 1376
1274 /* Not zeroing error to preserve a babble indicator */ 1377 /* Not zeroing error to preserve a babble indicator */
1378 if (cmd->error != 0) {
1379 ub_state_sense(sc, cmd);
1380 return;
1381 }
1275 cmd->state = UB_CMDST_DONE; 1382 cmd->state = UB_CMDST_DONE;
1276 ub_cmdtr_state(sc, cmd); 1383 ub_cmdtr_state(sc, cmd);
1277 ub_cmdq_pop(sc); 1384 ub_cmdq_pop(sc);
@@ -1310,7 +1417,7 @@ static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc)
1310 * Factorization helper for the command state machine: 1417 * Factorization helper for the command state machine:
1311 * Submit a CSW read. 1418 * Submit a CSW read.
1312 */ 1419 */
1313static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) 1420static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1314{ 1421{
1315 int rc; 1422 int rc;
1316 1423
@@ -1328,11 +1435,12 @@ static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1328 /* XXX Clear stalls */ 1435 /* XXX Clear stalls */
1329 ub_complete(&sc->work_done); 1436 ub_complete(&sc->work_done);
1330 ub_state_done(sc, cmd, rc); 1437 ub_state_done(sc, cmd, rc);
1331 return; 1438 return -1;
1332 } 1439 }
1333 1440
1334 sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT; 1441 sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT;
1335 add_timer(&sc->work_timer); 1442 add_timer(&sc->work_timer);
1443 return 0;
1336} 1444}
1337 1445
1338/* 1446/*
@@ -1341,7 +1449,9 @@ static void __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1341 */ 1449 */
1342static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) 1450static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1343{ 1451{
1344 __ub_state_stat(sc, cmd); 1452
1453 if (__ub_state_stat(sc, cmd) != 0)
1454 return;
1345 1455
1346 cmd->stat_count = 0; 1456 cmd->stat_count = 0;
1347 cmd->state = UB_CMDST_STAT; 1457 cmd->state = UB_CMDST_STAT;
@@ -1350,6 +1460,25 @@ static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1350 1460
1351/* 1461/*
1352 * Factorization helper for the command state machine: 1462 * Factorization helper for the command state machine:
1463 * Submit a CSW read and go to STAT state with counter (along [C] path).
1464 */
1465static void ub_state_stat_counted(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1466{
1467
1468 if (++cmd->stat_count >= 4) {
1469 ub_state_sense(sc, cmd);
1470 return;
1471 }
1472
1473 if (__ub_state_stat(sc, cmd) != 0)
1474 return;
1475
1476 cmd->state = UB_CMDST_STAT;
1477 ub_cmdtr_state(sc, cmd);
1478}
1479
1480/*
1481 * Factorization helper for the command state machine:
1353 * Submit a REQUEST SENSE and go to SENSE state. 1482 * Submit a REQUEST SENSE and go to SENSE state.
1354 */ 1483 */
1355static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd) 1484static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 2771c861f185..f696da6f417b 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -367,11 +367,8 @@ static inline void bpa10x_free_urb(struct urb *urb)
367 if (!urb) 367 if (!urb)
368 return; 368 return;
369 369
370 if (urb->setup_packet) 370 kfree(urb->setup_packet);
371 kfree(urb->setup_packet); 371 kfree(urb->transfer_buffer);
372
373 if (urb->transfer_buffer)
374 kfree(urb->transfer_buffer);
375 372
376 usb_free_urb(urb); 373 usb_free_urb(urb);
377} 374}
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index c0ed213fc857..858fddb046de 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -58,8 +58,6 @@
58#ifndef CONFIG_BT_HCIUART_DEBUG 58#ifndef CONFIG_BT_HCIUART_DEBUG
59#undef BT_DBG 59#undef BT_DBG
60#define BT_DBG( A... ) 60#define BT_DBG( A... )
61#undef BT_DMP
62#define BT_DMP( A... )
63#endif 61#endif
64 62
65static int hciextn = 1; 63static int hciextn = 1;
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index ade94a57bb11..533323b60e63 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -57,8 +57,6 @@
57#ifndef CONFIG_BT_HCIUART_DEBUG 57#ifndef CONFIG_BT_HCIUART_DEBUG
58#undef BT_DBG 58#undef BT_DBG
59#define BT_DBG( A... ) 59#define BT_DBG( A... )
60#undef BT_DMP
61#define BT_DMP( A... )
62#endif 60#endif
63 61
64/* Initialize protocol */ 62/* Initialize protocol */
@@ -125,7 +123,6 @@ static inline int h4_check_data_len(struct h4_struct *h4, int len)
125 123
126 BT_DBG("len %d room %d", len, room); 124 BT_DBG("len %d room %d", len, room);
127 if (!len) { 125 if (!len) {
128 BT_DMP(h4->rx_skb->data, h4->rx_skb->len);
129 hci_recv_frame(h4->rx_skb); 126 hci_recv_frame(h4->rx_skb);
130 } else if (len > room) { 127 } else if (len > room) {
131 BT_ERR("Data length is too large"); 128 BT_ERR("Data length is too large");
@@ -169,8 +166,6 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
169 case H4_W4_DATA: 166 case H4_W4_DATA:
170 BT_DBG("Complete data"); 167 BT_DBG("Complete data");
171 168
172 BT_DMP(h4->rx_skb->data, h4->rx_skb->len);
173
174 hci_recv_frame(h4->rx_skb); 169 hci_recv_frame(h4->rx_skb);
175 170
176 h4->rx_state = H4_W4_PACKET_TYPE; 171 h4->rx_state = H4_W4_PACKET_TYPE;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index f766bc22c6bb..90be2eae52e0 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -57,8 +57,6 @@
57#ifndef CONFIG_BT_HCIUART_DEBUG 57#ifndef CONFIG_BT_HCIUART_DEBUG
58#undef BT_DBG 58#undef BT_DBG
59#define BT_DBG( A... ) 59#define BT_DBG( A... )
60#undef BT_DMP
61#define BT_DMP( A... )
62#endif 60#endif
63 61
64static int reset = 0; 62static int reset = 0;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index b120ecf7b8c9..657719b8254f 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -57,8 +57,6 @@
57#ifndef CONFIG_BT_HCIUSB_DEBUG 57#ifndef CONFIG_BT_HCIUSB_DEBUG
58#undef BT_DBG 58#undef BT_DBG
59#define BT_DBG(D...) 59#define BT_DBG(D...)
60#undef BT_DMP
61#define BT_DMP(D...)
62#endif 60#endif
63 61
64#ifndef CONFIG_BT_HCIUSB_ZERO_PACKET 62#ifndef CONFIG_BT_HCIUSB_ZERO_PACKET
@@ -110,6 +108,9 @@ static struct usb_device_id blacklist_ids[] = {
110 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ 108 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
111 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, 109 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
112 110
111 /* Kensington Bluetooth USB adapter */
112 { USB_DEVICE(0x047d, 0x105d), .driver_info = HCI_RESET },
113
113 /* ISSC Bluetooth Adapter v3.1 */ 114 /* ISSC Bluetooth Adapter v3.1 */
114 { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, 115 { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET },
115 116
@@ -387,10 +388,8 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
387 urb = &_urb->urb; 388 urb = &_urb->urb;
388 BT_DBG("%s freeing _urb %p type %d urb %p", 389 BT_DBG("%s freeing _urb %p type %d urb %p",
389 husb->hdev->name, _urb, _urb->type, urb); 390 husb->hdev->name, _urb, _urb->type, urb);
390 if (urb->setup_packet) 391 kfree(urb->setup_packet);
391 kfree(urb->setup_packet); 392 kfree(urb->transfer_buffer);
392 if (urb->transfer_buffer)
393 kfree(urb->transfer_buffer);
394 _urb_free(_urb); 393 _urb_free(_urb);
395 } 394 }
396 395
diff --git a/drivers/cdrom/isp16.c b/drivers/cdrom/isp16.c
index 8e68d858ce64..db0fd9a240e3 100644
--- a/drivers/cdrom/isp16.c
+++ b/drivers/cdrom/isp16.c
@@ -18,7 +18,7 @@
18 * 18 *
19 * 19 June 2004 -- check_region() converted to request_region() 19 * 19 June 2004 -- check_region() converted to request_region()
20 * and return statement cleanups. 20 * and return statement cleanups.
21 * Jesper Juhl <juhl-lkml@dif.dk> 21 * - Jesper Juhl
22 * 22 *
23 * Detect cdrom interface on ISP16 sound card. 23 * Detect cdrom interface on ISP16 sound card.
24 * Configure cdrom interface. 24 * Configure cdrom interface.
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index 07bbd24e3c18..b89420e6d704 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -51,7 +51,7 @@
51 */ 51 */
52 52
53 53
54#if RCS 54#ifdef RCS
55static const char *mcdx_c_version 55static const char *mcdx_c_version
56 = "$Id: mcdx.c,v 1.21 1997/01/26 07:12:59 davem Exp $"; 56 = "$Id: mcdx.c,v 1.21 1997/01/26 07:12:59 davem Exp $";
57#endif 57#endif
@@ -706,7 +706,7 @@ static int mcdx_open(struct cdrom_device_info *cdi, int purpose)
706 xtrace(OPENCLOSE, "open() init irq generation\n"); 706 xtrace(OPENCLOSE, "open() init irq generation\n");
707 if (-1 == mcdx_config(stuffp, 1)) 707 if (-1 == mcdx_config(stuffp, 1))
708 return -EIO; 708 return -EIO;
709#if FALLBACK 709#ifdef FALLBACK
710 /* Set the read speed */ 710 /* Set the read speed */
711 xwarn("AAA %x AAA\n", stuffp->readcmd); 711 xwarn("AAA %x AAA\n", stuffp->readcmd);
712 if (stuffp->readerrs) 712 if (stuffp->readerrs)
@@ -1216,7 +1216,7 @@ static int __init mcdx_init_drive(int drive)
1216 } 1216 }
1217 1217
1218 1218
1219#if WE_KNOW_WHY 1219#ifdef WE_KNOW_WHY
1220 /* irq 11 -> channel register */ 1220 /* irq 11 -> channel register */
1221 outb(0x50, stuffp->wreg_chn); 1221 outb(0x50, stuffp->wreg_chn);
1222#endif 1222#endif
@@ -1294,7 +1294,7 @@ static int mcdx_transfer(struct s_drive_stuff *stuffp,
1294 1294
1295 ans = mcdx_xfer(stuffp, p, sector, nr_sectors); 1295 ans = mcdx_xfer(stuffp, p, sector, nr_sectors);
1296 return ans; 1296 return ans;
1297#if FALLBACK 1297#ifdef FALLBACK
1298 if (-1 == ans) 1298 if (-1 == ans)
1299 stuffp->readerrs++; 1299 stuffp->readerrs++;
1300 else 1300 else
diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
index 7e69c54568bf..351a01dd503a 100644
--- a/drivers/cdrom/optcd.c
+++ b/drivers/cdrom/optcd.c
@@ -245,7 +245,7 @@ module_param(optcd_port, short, 0);
245 245
246 246
247/* Busy wait until FLAG goes low. Return 0 on timeout. */ 247/* Busy wait until FLAG goes low. Return 0 on timeout. */
248inline static int flag_low(int flag, unsigned long timeout) 248static inline int flag_low(int flag, unsigned long timeout)
249{ 249{
250 int flag_high; 250 int flag_high;
251 unsigned long count = 0; 251 unsigned long count = 0;
@@ -381,7 +381,7 @@ static int send_seek_params(struct cdrom_msf *params)
381 381
382/* Wait for command execution status. Choice between busy waiting 382/* Wait for command execution status. Choice between busy waiting
383 and sleeping. Return value <0 indicates timeout. */ 383 and sleeping. Return value <0 indicates timeout. */
384inline static int get_exec_status(int busy_waiting) 384static inline int get_exec_status(int busy_waiting)
385{ 385{
386 unsigned char exec_status; 386 unsigned char exec_status;
387 387
@@ -398,7 +398,7 @@ inline static int get_exec_status(int busy_waiting)
398 398
399/* Wait busy for extra byte of data that a command returns. 399/* Wait busy for extra byte of data that a command returns.
400 Return value <0 indicates timeout. */ 400 Return value <0 indicates timeout. */
401inline static int get_data(int short_timeout) 401static inline int get_data(int short_timeout)
402{ 402{
403 unsigned char data; 403 unsigned char data;
404 404
@@ -441,14 +441,14 @@ static int reset_drive(void)
441/* Facilities for asynchronous operation */ 441/* Facilities for asynchronous operation */
442 442
443/* Read status/data availability flags FL_STEN and FL_DTEN */ 443/* Read status/data availability flags FL_STEN and FL_DTEN */
444inline static int stdt_flags(void) 444static inline int stdt_flags(void)
445{ 445{
446 return inb(STATUS_PORT) & FL_STDT; 446 return inb(STATUS_PORT) & FL_STDT;
447} 447}
448 448
449 449
450/* Fetch status that has previously been waited for. <0 means not available */ 450/* Fetch status that has previously been waited for. <0 means not available */
451inline static int fetch_status(void) 451static inline int fetch_status(void)
452{ 452{
453 unsigned char status; 453 unsigned char status;
454 454
@@ -462,7 +462,7 @@ inline static int fetch_status(void)
462 462
463 463
464/* Fetch data that has previously been waited for. */ 464/* Fetch data that has previously been waited for. */
465inline static void fetch_data(char *buf, int n) 465static inline void fetch_data(char *buf, int n)
466{ 466{
467 insb(DATA_PORT, buf, n); 467 insb(DATA_PORT, buf, n);
468 DEBUG((DEBUG_DRIVE_IF, "fetched 0x%x bytes", n)); 468 DEBUG((DEBUG_DRIVE_IF, "fetched 0x%x bytes", n));
@@ -470,7 +470,7 @@ inline static void fetch_data(char *buf, int n)
470 470
471 471
472/* Flush status and data fifos */ 472/* Flush status and data fifos */
473inline static void flush_data(void) 473static inline void flush_data(void)
474{ 474{
475 while ((inb(STATUS_PORT) & FL_STDT) != FL_STDT) 475 while ((inb(STATUS_PORT) & FL_STDT) != FL_STDT)
476 inb(DATA_PORT); 476 inb(DATA_PORT);
@@ -482,7 +482,7 @@ inline static void flush_data(void)
482 482
483/* Send a simple command and wait for response. Command codes < COMFETCH 483/* Send a simple command and wait for response. Command codes < COMFETCH
484 are quick response commands */ 484 are quick response commands */
485inline static int exec_cmd(int cmd) 485static inline int exec_cmd(int cmd)
486{ 486{
487 int ack = send_cmd(cmd); 487 int ack = send_cmd(cmd);
488 if (ack < 0) 488 if (ack < 0)
@@ -493,7 +493,7 @@ inline static int exec_cmd(int cmd)
493 493
494/* Send a command with parameters. Don't wait for the response, 494/* Send a command with parameters. Don't wait for the response,
495 * which consists of data blocks read from the CD. */ 495 * which consists of data blocks read from the CD. */
496inline static int exec_read_cmd(int cmd, struct cdrom_msf *params) 496static inline int exec_read_cmd(int cmd, struct cdrom_msf *params)
497{ 497{
498 int ack = send_cmd(cmd); 498 int ack = send_cmd(cmd);
499 if (ack < 0) 499 if (ack < 0)
@@ -503,7 +503,7 @@ inline static int exec_read_cmd(int cmd, struct cdrom_msf *params)
503 503
504 504
505/* Send a seek command with parameters and wait for response */ 505/* Send a seek command with parameters and wait for response */
506inline static int exec_seek_cmd(int cmd, struct cdrom_msf *params) 506static inline int exec_seek_cmd(int cmd, struct cdrom_msf *params)
507{ 507{
508 int ack = send_cmd(cmd); 508 int ack = send_cmd(cmd);
509 if (ack < 0) 509 if (ack < 0)
@@ -516,7 +516,7 @@ inline static int exec_seek_cmd(int cmd, struct cdrom_msf *params)
516 516
517 517
518/* Send a command with parameters and wait for response */ 518/* Send a command with parameters and wait for response */
519inline static int exec_long_cmd(int cmd, struct cdrom_msf *params) 519static inline int exec_long_cmd(int cmd, struct cdrom_msf *params)
520{ 520{
521 int ack = exec_read_cmd(cmd, params); 521 int ack = exec_read_cmd(cmd, params);
522 if (ack < 0) 522 if (ack < 0)
@@ -528,7 +528,7 @@ inline static int exec_long_cmd(int cmd, struct cdrom_msf *params)
528 528
529 529
530/* Binary to BCD (2 digits) */ 530/* Binary to BCD (2 digits) */
531inline static void single_bin2bcd(u_char *p) 531static inline void single_bin2bcd(u_char *p)
532{ 532{
533 DEBUG((DEBUG_CONV, "bin2bcd %02d", *p)); 533 DEBUG((DEBUG_CONV, "bin2bcd %02d", *p));
534 *p = (*p % 10) | ((*p / 10) << 4); 534 *p = (*p % 10) | ((*p / 10) << 4);
@@ -565,7 +565,7 @@ static void lba2msf(int lba, struct cdrom_msf *msf)
565 565
566 566
567/* Two BCD digits to binary */ 567/* Two BCD digits to binary */
568inline static u_char bcd2bin(u_char bcd) 568static inline u_char bcd2bin(u_char bcd)
569{ 569{
570 DEBUG((DEBUG_CONV, "bcd2bin %x%02x", bcd)); 570 DEBUG((DEBUG_CONV, "bcd2bin %x%02x", bcd));
571 return (bcd >> 4) * 10 + (bcd & 0x0f); 571 return (bcd >> 4) * 10 + (bcd & 0x0f);
@@ -988,7 +988,7 @@ static char buf[CD_FRAMESIZE * N_BUFS];
988static volatile int buf_bn[N_BUFS], next_bn; 988static volatile int buf_bn[N_BUFS], next_bn;
989static volatile int buf_in = 0, buf_out = NOBUF; 989static volatile int buf_in = 0, buf_out = NOBUF;
990 990
991inline static void opt_invalidate_buffers(void) 991static inline void opt_invalidate_buffers(void)
992{ 992{
993 int i; 993 int i;
994 994
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 43d0cb19ef6a..4f27e5519296 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -735,7 +735,7 @@ config SGI_IP27_RTC
735 735
736config GEN_RTC 736config GEN_RTC
737 tristate "Generic /dev/rtc emulation" 737 tristate "Generic /dev/rtc emulation"
738 depends on RTC!=y && !IA64 && !ARM 738 depends on RTC!=y && !IA64 && !ARM && !PPC64
739 ---help--- 739 ---help---
740 If you say Y here and create a character special file /dev/rtc with 740 If you say Y here and create a character special file /dev/rtc with
741 major number 10 and minor number 135 using mknod ("man mknod"), you 741 major number 10 and minor number 135 using mknod ("man mknod"), you
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index c1fe013c64f3..b4af87c6f9c8 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -143,6 +143,7 @@ struct agp_bridge_data {
143 char major_version; 143 char major_version;
144 char minor_version; 144 char minor_version;
145 struct list_head list; 145 struct list_head list;
146 u32 apbase_config;
146}; 147};
147 148
148#define KB(x) ((x) * 1024) 149#define KB(x) ((x) * 1024)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 51266d6b4d78..1f7d415f432c 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1047,9 +1047,15 @@ static int intel_845_configure(void)
1047 /* aperture size */ 1047 /* aperture size */
1048 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 1048 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
1049 1049
1050 /* address to map to */ 1050 if (agp_bridge->apbase_config != 0) {
1051 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 1051 pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
1052 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 1052 agp_bridge->apbase_config);
1053 } else {
1054 /* address to map to */
1055 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
1056 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
1057 agp_bridge->apbase_config = temp;
1058 }
1053 1059
1054 /* attbase - aperture base */ 1060 /* attbase - aperture base */
1055 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 1061 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c
index 82f839451622..4f60f7f4193d 100644
--- a/drivers/char/drm/via_dma.c
+++ b/drivers/char/drm/via_dma.c
@@ -231,7 +231,7 @@ int via_dma_init(DRM_IOCTL_ARGS)
231 drm_via_dma_init_t init; 231 drm_via_dma_init_t init;
232 int retcode = 0; 232 int retcode = 0;
233 233
234 DRM_COPY_FROM_USER_IOCTL(init, (drm_via_dma_init_t *) data, 234 DRM_COPY_FROM_USER_IOCTL(init, (drm_via_dma_init_t __user *) data,
235 sizeof(init)); 235 sizeof(init));
236 236
237 switch (init.func) { 237 switch (init.func) {
@@ -343,7 +343,7 @@ int via_cmdbuffer(DRM_IOCTL_ARGS)
343 343
344 LOCK_TEST_WITH_RETURN( dev, filp ); 344 LOCK_TEST_WITH_RETURN( dev, filp );
345 345
346 DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t *) data, 346 DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t __user *) data,
347 sizeof(cmdbuf)); 347 sizeof(cmdbuf));
348 348
349 DRM_DEBUG("via cmdbuffer, buf %p size %lu\n", cmdbuf.buf, cmdbuf.size); 349 DRM_DEBUG("via cmdbuffer, buf %p size %lu\n", cmdbuf.buf, cmdbuf.size);
@@ -386,7 +386,7 @@ int via_pci_cmdbuffer(DRM_IOCTL_ARGS)
386 386
387 LOCK_TEST_WITH_RETURN( dev, filp ); 387 LOCK_TEST_WITH_RETURN( dev, filp );
388 388
389 DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t *) data, 389 DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t __user *) data,
390 sizeof(cmdbuf)); 390 sizeof(cmdbuf));
391 391
392 DRM_DEBUG("via_pci_cmdbuffer, buf %p size %lu\n", cmdbuf.buf, 392 DRM_DEBUG("via_pci_cmdbuffer, buf %p size %lu\n", cmdbuf.buf,
@@ -701,7 +701,7 @@ via_cmdbuf_size(DRM_IOCTL_ARGS)
701 return DRM_ERR(EFAULT); 701 return DRM_ERR(EFAULT);
702 } 702 }
703 703
704 DRM_COPY_FROM_USER_IOCTL(d_siz, (drm_via_cmdbuf_size_t *) data, 704 DRM_COPY_FROM_USER_IOCTL(d_siz, (drm_via_cmdbuf_size_t __user *) data,
705 sizeof(d_siz)); 705 sizeof(d_siz));
706 706
707 707
@@ -735,7 +735,7 @@ via_cmdbuf_size(DRM_IOCTL_ARGS)
735 } 735 }
736 d_siz.size = tmp_size; 736 d_siz.size = tmp_size;
737 737
738 DRM_COPY_TO_USER_IOCTL((drm_via_cmdbuf_size_t *) data, d_siz, 738 DRM_COPY_TO_USER_IOCTL((drm_via_cmdbuf_size_t __user *) data, d_siz,
739 sizeof(d_siz)); 739 sizeof(d_siz));
740 return ret; 740 return ret;
741} 741}
diff --git a/drivers/char/drm/via_drm.h b/drivers/char/drm/via_drm.h
index 4588c9bd1816..be346bb0a26a 100644
--- a/drivers/char/drm/via_drm.h
+++ b/drivers/char/drm/via_drm.h
@@ -158,7 +158,7 @@ typedef struct _drm_via_dma_init {
158} drm_via_dma_init_t; 158} drm_via_dma_init_t;
159 159
160typedef struct _drm_via_cmdbuffer { 160typedef struct _drm_via_cmdbuffer {
161 char *buf; 161 char __user *buf;
162 unsigned long size; 162 unsigned long size;
163} drm_via_cmdbuffer_t; 163} drm_via_cmdbuffer_t;
164 164
diff --git a/drivers/char/drm/via_ds.c b/drivers/char/drm/via_ds.c
index daf3df75a20e..5c71e089246c 100644
--- a/drivers/char/drm/via_ds.c
+++ b/drivers/char/drm/via_ds.c
@@ -133,7 +133,7 @@ memHeap_t *via_mmInit(int ofs, int size)
133 PMemBlock blocks; 133 PMemBlock blocks;
134 134
135 if (size <= 0) 135 if (size <= 0)
136 return 0; 136 return NULL;
137 137
138 blocks = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); 138 blocks = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER);
139 139
@@ -143,7 +143,7 @@ memHeap_t *via_mmInit(int ofs, int size)
143 blocks->free = 1; 143 blocks->free = 1;
144 return (memHeap_t *) blocks; 144 return (memHeap_t *) blocks;
145 } else 145 } else
146 return 0; 146 return NULL;
147} 147}
148 148
149static TMemBlock *SliceBlock(TMemBlock * p, 149static TMemBlock *SliceBlock(TMemBlock * p,
diff --git a/drivers/char/drm/via_ds.h b/drivers/char/drm/via_ds.h
index be9c7f9f1aee..d2bb9f37ca38 100644
--- a/drivers/char/drm/via_ds.h
+++ b/drivers/char/drm/via_ds.h
@@ -61,8 +61,8 @@ struct mem_block_t {
61 struct mem_block_t *heap; 61 struct mem_block_t *heap;
62 int ofs, size; 62 int ofs, size;
63 int align; 63 int align;
64 int free:1; 64 unsigned int free:1;
65 int reserved:1; 65 unsigned int reserved:1;
66}; 66};
67typedef struct mem_block_t TMemBlock; 67typedef struct mem_block_t TMemBlock;
68typedef struct mem_block_t *PMemBlock; 68typedef struct mem_block_t *PMemBlock;
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c
index 0be829b6ec65..bb171139e737 100644
--- a/drivers/char/drm/via_map.c
+++ b/drivers/char/drm/via_map.c
@@ -95,7 +95,8 @@ int via_map_init(DRM_IOCTL_ARGS)
95 95
96 DRM_DEBUG("%s\n", __FUNCTION__); 96 DRM_DEBUG("%s\n", __FUNCTION__);
97 97
98 DRM_COPY_FROM_USER_IOCTL(init, (drm_via_init_t *) data, sizeof(init)); 98 DRM_COPY_FROM_USER_IOCTL(init, (drm_via_init_t __user *) data,
99 sizeof(init));
99 100
100 switch (init.func) { 101 switch (init.func) {
101 case VIA_INIT_MAP: 102 case VIA_INIT_MAP:
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c
index c22712f44d42..13921f3c0ec2 100644
--- a/drivers/char/drm/via_mm.c
+++ b/drivers/char/drm/via_mm.c
@@ -76,7 +76,8 @@ int via_agp_init(DRM_IOCTL_ARGS)
76{ 76{
77 drm_via_agp_t agp; 77 drm_via_agp_t agp;
78 78
79 DRM_COPY_FROM_USER_IOCTL(agp, (drm_via_agp_t *) data, sizeof(agp)); 79 DRM_COPY_FROM_USER_IOCTL(agp, (drm_via_agp_t __user *) data,
80 sizeof(agp));
80 81
81 AgpHeap = via_mmInit(agp.offset, agp.size); 82 AgpHeap = via_mmInit(agp.offset, agp.size);
82 83
@@ -92,7 +93,7 @@ int via_fb_init(DRM_IOCTL_ARGS)
92{ 93{
93 drm_via_fb_t fb; 94 drm_via_fb_t fb;
94 95
95 DRM_COPY_FROM_USER_IOCTL(fb, (drm_via_fb_t *) data, sizeof(fb)); 96 DRM_COPY_FROM_USER_IOCTL(fb, (drm_via_fb_t __user *) data, sizeof(fb));
96 97
97 FBHeap = via_mmInit(fb.offset, fb.size); 98 FBHeap = via_mmInit(fb.offset, fb.size);
98 99
@@ -193,19 +194,20 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
193{ 194{
194 drm_via_mem_t mem; 195 drm_via_mem_t mem;
195 196
196 DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t *) data, sizeof(mem)); 197 DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t __user *) data,
198 sizeof(mem));
197 199
198 switch (mem.type) { 200 switch (mem.type) {
199 case VIDEO: 201 case VIDEO:
200 if (via_fb_alloc(&mem) < 0) 202 if (via_fb_alloc(&mem) < 0)
201 return -EFAULT; 203 return -EFAULT;
202 DRM_COPY_TO_USER_IOCTL((drm_via_mem_t *) data, mem, 204 DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem,
203 sizeof(mem)); 205 sizeof(mem));
204 return 0; 206 return 0;
205 case AGP: 207 case AGP:
206 if (via_agp_alloc(&mem) < 0) 208 if (via_agp_alloc(&mem) < 0)
207 return -EFAULT; 209 return -EFAULT;
208 DRM_COPY_TO_USER_IOCTL((drm_via_mem_t *) data, mem, 210 DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem,
209 sizeof(mem)); 211 sizeof(mem));
210 return 0; 212 return 0;
211 } 213 }
@@ -289,7 +291,8 @@ int via_mem_free(DRM_IOCTL_ARGS)
289{ 291{
290 drm_via_mem_t mem; 292 drm_via_mem_t mem;
291 293
292 DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t *) data, sizeof(mem)); 294 DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t __user *) data,
295 sizeof(mem));
293 296
294 switch (mem.type) { 297 switch (mem.type) {
295 298
diff --git a/drivers/char/drm/via_video.c b/drivers/char/drm/via_video.c
index 37a61c67b292..1e2d444587bf 100644
--- a/drivers/char/drm/via_video.c
+++ b/drivers/char/drm/via_video.c
@@ -76,7 +76,8 @@ via_decoder_futex(DRM_IOCTL_ARGS)
76 76
77 DRM_DEBUG("%s\n", __FUNCTION__); 77 DRM_DEBUG("%s\n", __FUNCTION__);
78 78
79 DRM_COPY_FROM_USER_IOCTL(fx, (drm_via_futex_t *) data, sizeof(fx)); 79 DRM_COPY_FROM_USER_IOCTL(fx, (drm_via_futex_t __user *) data,
80 sizeof(fx));
80 81
81 if (fx.lock > VIA_NR_XVMC_LOCKS) 82 if (fx.lock > VIA_NR_XVMC_LOCKS)
82 return -EFAULT; 83 return -EFAULT;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 298574e16061..a44b97304e95 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1726,7 +1726,7 @@ static int dmi_table(u32 base, int len, int num)
1726 return status; 1726 return status;
1727} 1727}
1728 1728
1729inline static int dmi_checksum(u8 *buf) 1729static inline int dmi_checksum(u8 *buf)
1730{ 1730{
1731 u8 sum=0; 1731 u8 sum=0;
1732 int a; 1732 int a;
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index fcd1c02a32cb..d35a953961cb 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -131,11 +131,7 @@
131#define WDIOC_GET_PRETIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 22, int) 131#define WDIOC_GET_PRETIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 22, int)
132#endif 132#endif
133 133
134#ifdef CONFIG_WATCHDOG_NOWAYOUT 134static int nowayout = WATCHDOG_NOWAYOUT;
135static int nowayout = 1;
136#else
137static int nowayout;
138#endif
139 135
140static ipmi_user_t watchdog_user = NULL; 136static ipmi_user_t watchdog_user = NULL;
141 137
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7b19e02f112f..523fd3c8bbaa 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -198,10 +198,10 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
198 198
199 if (scancode >= dev->keycodemax) 199 if (scancode >= dev->keycodemax)
200 return -EINVAL; 200 return -EINVAL;
201 if (keycode > KEY_MAX)
202 return -EINVAL;
203 if (keycode < 0 || keycode > KEY_MAX) 201 if (keycode < 0 || keycode > KEY_MAX)
204 return -EINVAL; 202 return -EINVAL;
203 if (keycode >> (dev->keycodesize * 8))
204 return -EINVAL;
205 205
206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); 206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
207 207
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index a8be11dfcba3..34cbb13aad4b 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -902,7 +902,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
902 (HostP->Mapping[entry].RtaUniqueNum==RtaUniq)) 902 (HostP->Mapping[entry].RtaUniqueNum==RtaUniq))
903 { 903 {
904 HostP->Mapping[entry].Flags |= RTA_BOOTED|RTA_NEWBOOT; 904 HostP->Mapping[entry].Flags |= RTA_BOOTED|RTA_NEWBOOT;
905#if NEED_TO_FIX 905#ifdef NEED_TO_FIX
906 RIO_SV_BROADCAST(HostP->svFlags[entry]); 906 RIO_SV_BROADCAST(HostP->svFlags[entry]);
907#endif 907#endif
908 if ( (sysport=HostP->Mapping[entry].SysPort) != NO_PORT ) 908 if ( (sysport=HostP->Mapping[entry].SysPort) != NO_PORT )
@@ -918,7 +918,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
918 { 918 {
919 entry2 = HostP->Mapping[entry].ID2 - 1; 919 entry2 = HostP->Mapping[entry].ID2 - 1;
920 HostP->Mapping[entry2].Flags |= RTA_BOOTED|RTA_NEWBOOT; 920 HostP->Mapping[entry2].Flags |= RTA_BOOTED|RTA_NEWBOOT;
921#if NEED_TO_FIX 921#ifdef NEED_TO_FIX
922 RIO_SV_BROADCAST(HostP->svFlags[entry2]); 922 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
923#endif 923#endif
924 sysport = HostP->Mapping[entry2].SysPort; 924 sysport = HostP->Mapping[entry2].SysPort;
@@ -1143,7 +1143,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
1143 CCOPY( MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN ); 1143 CCOPY( MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN );
1144 HostP->Mapping[entry].Flags = 1144 HostP->Mapping[entry].Flags =
1145 SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT; 1145 SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
1146#if NEED_TO_FIX 1146#ifdef NEED_TO_FIX
1147 RIO_SV_BROADCAST(HostP->svFlags[entry]); 1147 RIO_SV_BROADCAST(HostP->svFlags[entry]);
1148#endif 1148#endif
1149 RIOReMapPorts( p, HostP, &HostP->Mapping[entry] ); 1149 RIOReMapPorts( p, HostP, &HostP->Mapping[entry] );
@@ -1159,7 +1159,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
1159 "This RTA has a tentative entry on another host - delete that entry (1)\n"); 1159 "This RTA has a tentative entry on another host - delete that entry (1)\n");
1160 HostP->Mapping[entry].Flags = 1160 HostP->Mapping[entry].Flags =
1161 SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; 1161 SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT;
1162#if NEED_TO_FIX 1162#ifdef NEED_TO_FIX
1163 RIO_SV_BROADCAST(HostP->svFlags[entry]); 1163 RIO_SV_BROADCAST(HostP->svFlags[entry]);
1164#endif 1164#endif
1165 } 1165 }
@@ -1169,7 +1169,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
1169 { 1169 {
1170 HostP->Mapping[entry2].Flags = SLOT_IN_USE | 1170 HostP->Mapping[entry2].Flags = SLOT_IN_USE |
1171 RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; 1171 RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
1172#if NEED_TO_FIX 1172#ifdef NEED_TO_FIX
1173 RIO_SV_BROADCAST(HostP->svFlags[entry2]); 1173 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
1174#endif 1174#endif
1175 HostP->Mapping[entry2].SysPort = MapP2->SysPort; 1175 HostP->Mapping[entry2].SysPort = MapP2->SysPort;
@@ -1188,7 +1188,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
1188 else 1188 else
1189 HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | 1189 HostP->Mapping[entry2].Flags = SLOT_TENTATIVE |
1190 RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; 1190 RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
1191#if NEED_TO_FIX 1191#ifdef NEED_TO_FIX
1192 RIO_SV_BROADCAST(HostP->svFlags[entry2]); 1192 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
1193#endif 1193#endif
1194 bzero( (caddr_t)MapP2, sizeof(struct Map) ); 1194 bzero( (caddr_t)MapP2, sizeof(struct Map) );
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index 106b31f48a21..e9564c9fb37c 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -1023,7 +1023,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
1023 if (link < LINKS_PER_UNIT) 1023 if (link < LINKS_PER_UNIT)
1024 return 1; 1024 return 1;
1025 1025
1026#if NEED_TO_FIX_THIS 1026#ifdef NEED_TO_FIX_THIS
1027 /* Ok so all the links are disconnected. But we may have only just 1027 /* Ok so all the links are disconnected. But we may have only just
1028 ** made this slot tentative and not yet received a topology update. 1028 ** made this slot tentative and not yet received a topology update.
1029 ** Lets check how long ago we made it tentative. 1029 ** Lets check how long ago we made it tentative.
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 8fb26ad2aa12..e45bc275907a 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -771,7 +771,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
771 if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) 771 if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
772 CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); 772 CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN );
773 HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; 773 HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
774#if NEED_TO_FIX 774#ifdef NEED_TO_FIX
775 RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]); 775 RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]);
776#endif 776#endif
777 if (MapP->Flags & RTA16_SECOND_SLOT) 777 if (MapP->Flags & RTA16_SECOND_SLOT)
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index d8f9e94ae475..cd4fe8b1709f 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -1209,6 +1209,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1209 1209
1210void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1210void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1211{ 1211{
1212 unsigned long uip_watchdog = jiffies;
1212 unsigned char ctrl; 1213 unsigned char ctrl;
1213#ifdef CONFIG_MACH_DECSTATION 1214#ifdef CONFIG_MACH_DECSTATION
1214 unsigned int real_year; 1215 unsigned int real_year;
@@ -1224,8 +1225,10 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1224 * Once the read clears, read the RTC time (again via ioctl). Easy. 1225 * Once the read clears, read the RTC time (again via ioctl). Easy.
1225 */ 1226 */
1226 1227
1227 if (rtc_is_updating() != 0) 1228 while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) {
1228 msleep(20); 1229 barrier();
1230 cpu_relax();
1231 }
1229 1232
1230 /* 1233 /*
1231 * Only the values that we read from the RTC are set. We leave 1234 * Only the values that we read from the RTC are set. We leave
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index fd042060809a..cefbe985e55c 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -439,6 +439,11 @@ static struct {
439 { 0, 0 }, 439 { 0, 0 },
440}; 440};
441 441
442struct sonypi_keypress {
443 struct input_dev *dev;
444 int key;
445};
446
442static struct sonypi_device { 447static struct sonypi_device {
443 struct pci_dev *dev; 448 struct pci_dev *dev;
444 struct platform_device *pdev; 449 struct platform_device *pdev;
@@ -710,22 +715,61 @@ static void sonypi_setbluetoothpower(u8 state)
710 715
711static void input_keyrelease(void *data) 716static void input_keyrelease(void *data)
712{ 717{
713 struct input_dev *input_dev; 718 struct sonypi_keypress kp;
714 int key;
715
716 while (1) {
717 if (kfifo_get(sonypi_device.input_fifo,
718 (unsigned char *)&input_dev,
719 sizeof(input_dev)) != sizeof(input_dev))
720 return;
721 if (kfifo_get(sonypi_device.input_fifo,
722 (unsigned char *)&key,
723 sizeof(key)) != sizeof(key))
724 return;
725 719
720 while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)&kp,
721 sizeof(kp)) == sizeof(kp)) {
726 msleep(10); 722 msleep(10);
727 input_report_key(input_dev, key, 0); 723 input_report_key(kp.dev, kp.key, 0);
728 input_sync(input_dev); 724 input_sync(kp.dev);
725 }
726}
727
728static void sonypi_report_input_event(u8 event)
729{
730 struct input_dev *jog_dev = &sonypi_device.input_jog_dev;
731 struct input_dev *key_dev = &sonypi_device.input_key_dev;
732 struct sonypi_keypress kp = { NULL };
733 int i;
734
735 switch (event) {
736 case SONYPI_EVENT_JOGDIAL_UP:
737 case SONYPI_EVENT_JOGDIAL_UP_PRESSED:
738 input_report_rel(jog_dev, REL_WHEEL, 1);
739 input_sync(jog_dev);
740 break;
741
742 case SONYPI_EVENT_JOGDIAL_DOWN:
743 case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED:
744 input_report_rel(jog_dev, REL_WHEEL, -1);
745 input_sync(jog_dev);
746 break;
747
748 case SONYPI_EVENT_JOGDIAL_PRESSED:
749 kp.key = BTN_MIDDLE;
750 kp.dev = jog_dev;
751 break;
752
753 case SONYPI_EVENT_FNKEY_RELEASED:
754 /* Nothing, not all VAIOs generate this event */
755 break;
756
757 default:
758 for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
759 if (event == sonypi_inputkeys[i].sonypiev) {
760 kp.dev = key_dev;
761 kp.key = sonypi_inputkeys[i].inputev;
762 break;
763 }
764 break;
765 }
766
767 if (kp.dev) {
768 input_report_key(kp.dev, kp.key, 1);
769 input_sync(kp.dev);
770 kfifo_put(sonypi_device.input_fifo,
771 (unsigned char *)&kp, sizeof(kp));
772 schedule_work(&sonypi_device.input_work);
729 } 773 }
730} 774}
731 775
@@ -768,51 +812,8 @@ found:
768 printk(KERN_INFO 812 printk(KERN_INFO
769 "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); 813 "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2);
770 814
771 if (useinput) { 815 if (useinput)
772 struct input_dev *input_jog_dev = &sonypi_device.input_jog_dev; 816 sonypi_report_input_event(event);
773 struct input_dev *input_key_dev = &sonypi_device.input_key_dev;
774 switch (event) {
775 case SONYPI_EVENT_JOGDIAL_UP:
776 case SONYPI_EVENT_JOGDIAL_UP_PRESSED:
777 input_report_rel(input_jog_dev, REL_WHEEL, 1);
778 break;
779 case SONYPI_EVENT_JOGDIAL_DOWN:
780 case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED:
781 input_report_rel(input_jog_dev, REL_WHEEL, -1);
782 break;
783 case SONYPI_EVENT_JOGDIAL_PRESSED: {
784 int key = BTN_MIDDLE;
785 input_report_key(input_jog_dev, key, 1);
786 kfifo_put(sonypi_device.input_fifo,
787 (unsigned char *)&input_jog_dev,
788 sizeof(input_jog_dev));
789 kfifo_put(sonypi_device.input_fifo,
790 (unsigned char *)&key, sizeof(key));
791 break;
792 }
793 case SONYPI_EVENT_FNKEY_RELEASED:
794 /* Nothing, not all VAIOs generate this event */
795 break;
796 }
797 input_sync(input_jog_dev);
798
799 for (i = 0; sonypi_inputkeys[i].sonypiev; i++) {
800 int key;
801
802 if (event != sonypi_inputkeys[i].sonypiev)
803 continue;
804
805 key = sonypi_inputkeys[i].inputev;
806 input_report_key(input_key_dev, key, 1);
807 kfifo_put(sonypi_device.input_fifo,
808 (unsigned char *)&input_key_dev,
809 sizeof(input_key_dev));
810 kfifo_put(sonypi_device.input_fifo,
811 (unsigned char *)&key, sizeof(key));
812 }
813 input_sync(input_key_dev);
814 schedule_work(&sonypi_device.input_work);
815 }
816 817
817 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); 818 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
818 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); 819 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
@@ -1227,14 +1228,7 @@ static int __devinit sonypi_probe(void)
1227 sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = 1228 sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] =
1228 BIT(BTN_MIDDLE); 1229 BIT(BTN_MIDDLE);
1229 sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); 1230 sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL);
1230 sonypi_device.input_jog_dev.name = 1231 sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME;
1231 kmalloc(sizeof(SONYPI_JOG_INPUTNAME), GFP_KERNEL);
1232 if (!sonypi_device.input_jog_dev.name) {
1233 printk(KERN_ERR "sonypi: kmalloc failed\n");
1234 ret = -ENOMEM;
1235 goto out_inkmallocinput1;
1236 }
1237 sprintf(sonypi_device.input_jog_dev.name, SONYPI_JOG_INPUTNAME);
1238 sonypi_device.input_jog_dev.id.bustype = BUS_ISA; 1232 sonypi_device.input_jog_dev.id.bustype = BUS_ISA;
1239 sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; 1233 sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY;
1240 1234
@@ -1248,14 +1242,7 @@ static int __devinit sonypi_probe(void)
1248 if (sonypi_inputkeys[i].inputev) 1242 if (sonypi_inputkeys[i].inputev)
1249 set_bit(sonypi_inputkeys[i].inputev, 1243 set_bit(sonypi_inputkeys[i].inputev,
1250 sonypi_device.input_key_dev.keybit); 1244 sonypi_device.input_key_dev.keybit);
1251 sonypi_device.input_key_dev.name = 1245 sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME;
1252 kmalloc(sizeof(SONYPI_KEY_INPUTNAME), GFP_KERNEL);
1253 if (!sonypi_device.input_key_dev.name) {
1254 printk(KERN_ERR "sonypi: kmalloc failed\n");
1255 ret = -ENOMEM;
1256 goto out_inkmallocinput2;
1257 }
1258 sprintf(sonypi_device.input_key_dev.name, SONYPI_KEY_INPUTNAME);
1259 sonypi_device.input_key_dev.id.bustype = BUS_ISA; 1246 sonypi_device.input_key_dev.id.bustype = BUS_ISA;
1260 sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; 1247 sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY;
1261 1248
@@ -1313,11 +1300,7 @@ out_platformdev:
1313 kfifo_free(sonypi_device.input_fifo); 1300 kfifo_free(sonypi_device.input_fifo);
1314out_infifo: 1301out_infifo:
1315 input_unregister_device(&sonypi_device.input_key_dev); 1302 input_unregister_device(&sonypi_device.input_key_dev);
1316 kfree(sonypi_device.input_key_dev.name);
1317out_inkmallocinput2:
1318 input_unregister_device(&sonypi_device.input_jog_dev); 1303 input_unregister_device(&sonypi_device.input_jog_dev);
1319 kfree(sonypi_device.input_jog_dev.name);
1320out_inkmallocinput1:
1321 free_irq(sonypi_device.irq, sonypi_irq); 1304 free_irq(sonypi_device.irq, sonypi_irq);
1322out_reqirq: 1305out_reqirq:
1323 release_region(sonypi_device.ioport1, sonypi_device.region_size); 1306 release_region(sonypi_device.ioport1, sonypi_device.region_size);
@@ -1337,13 +1320,14 @@ static void __devexit sonypi_remove(void)
1337{ 1320{
1338 sonypi_disable(); 1321 sonypi_disable();
1339 1322
1323 synchronize_sched(); /* Allow sonypi interrupt to complete. */
1324 flush_scheduled_work();
1325
1340 platform_device_unregister(sonypi_device.pdev); 1326 platform_device_unregister(sonypi_device.pdev);
1341 1327
1342 if (useinput) { 1328 if (useinput) {
1343 input_unregister_device(&sonypi_device.input_key_dev); 1329 input_unregister_device(&sonypi_device.input_key_dev);
1344 kfree(sonypi_device.input_key_dev.name);
1345 input_unregister_device(&sonypi_device.input_jog_dev); 1330 input_unregister_device(&sonypi_device.input_jog_dev);
1346 kfree(sonypi_device.input_jog_dev.name);
1347 kfifo_free(sonypi_device.input_fifo); 1331 kfifo_free(sonypi_device.input_fifo);
1348 } 1332 }
1349 1333
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index 7a969778915a..79e9832ef1f3 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -17,6 +17,8 @@ config TCG_TPM
17 obtained at: <http://sourceforge.net/projects/trousers>. To 17 obtained at: <http://sourceforge.net/projects/trousers>. To
18 compile this driver as a module, choose M here; the module 18 compile this driver as a module, choose M here; the module
19 will be called tpm. If unsure, say N. 19 will be called tpm. If unsure, say N.
20 Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI_BUS
21 and CONFIG_PNPACPI.
20 22
21config TCG_NSC 23config TCG_NSC
22 tristate "National Semiconductor TPM Interface" 24 tristate "National Semiconductor TPM Interface"
@@ -35,5 +37,17 @@ config TCG_ATMEL
35 will be accessible from within Linux. To compile this driver 37 will be accessible from within Linux. To compile this driver
36 as a module, choose M here; the module will be called tpm_atmel. 38 as a module, choose M here; the module will be called tpm_atmel.
37 39
40config TCG_INFINEON
41 tristate "Infineon Technologies TPM Interface"
42 depends on TCG_TPM && PNPACPI
43 ---help---
44 If you have a TPM security chip from Infineon Technologies
45 (either SLD 9630 TT 1.1 or SLB 9635 TT 1.2) say Yes and it
46 will be accessible from within Linux.
47 To compile this driver as a module, choose M here; the module
48 will be called tpm_infineon.
49 Further information on this driver and the supported hardware
50 can be found at http://www.prosec.rub.de/tpm
51
38endmenu 52endmenu
39 53
diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index 736d3df266f5..2392e404e8d1 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -4,4 +4,4 @@
4obj-$(CONFIG_TCG_TPM) += tpm.o 4obj-$(CONFIG_TCG_TPM) += tpm.o
5obj-$(CONFIG_TCG_NSC) += tpm_nsc.o 5obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
6obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o 6obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
7 7obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
new file mode 100644
index 000000000000..dc8c540391fd
--- /dev/null
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -0,0 +1,533 @@
1/*
2 * Description:
3 * Device Driver for the Infineon Technologies
4 * SLD 9630 TT 1.1 and SLB 9635 TT 1.2 Trusted Platform Module
5 * Specifications at www.trustedcomputinggroup.org
6 *
7 * Copyright (C) 2005, Marcel Selhorst <selhorst@crypto.rub.de>
8 * Applied Data Security Group, Ruhr-University Bochum, Germany
9 * Project-Homepage: http://www.prosec.rub.de/tpm
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 as
13 * published by the Free Software Foundation, version 2 of the
14 * License.
15 */
16
17#include <acpi/acpi_bus.h>
18#include <linux/pnp.h>
19#include "tpm.h"
20
21/* Infineon specific definitions */
22/* maximum number of WTX-packages */
23#define TPM_MAX_WTX_PACKAGES 50
24/* msleep-Time for WTX-packages */
25#define TPM_WTX_MSLEEP_TIME 20
26/* msleep-Time --> Interval to check status register */
27#define TPM_MSLEEP_TIME 3
28/* gives number of max. msleep()-calls before throwing timeout */
29#define TPM_MAX_TRIES 5000
30#define TPM_INFINEON_DEV_VEN_VALUE 0x15D1
31
32/* These values will be filled after ACPI-call */
33static int TPM_INF_DATA = 0;
34static int TPM_INF_ADDR = 0;
35
36/* TPM header definitions */
37enum infineon_tpm_header {
38 TPM_VL_VER = 0x01,
39 TPM_VL_CHANNEL_CONTROL = 0x07,
40 TPM_VL_CHANNEL_PERSONALISATION = 0x0A,
41 TPM_VL_CHANNEL_TPM = 0x0B,
42 TPM_VL_CONTROL = 0x00,
43 TPM_INF_NAK = 0x15,
44 TPM_CTRL_WTX = 0x10,
45 TPM_CTRL_WTX_ABORT = 0x18,
46 TPM_CTRL_WTX_ABORT_ACK = 0x18,
47 TPM_CTRL_ERROR = 0x20,
48 TPM_CTRL_CHAININGACK = 0x40,
49 TPM_CTRL_CHAINING = 0x80,
50 TPM_CTRL_DATA = 0x04,
51 TPM_CTRL_DATA_CHA = 0x84,
52 TPM_CTRL_DATA_CHA_ACK = 0xC4
53};
54
55enum infineon_tpm_register {
56 WRFIFO = 0x00,
57 RDFIFO = 0x01,
58 STAT = 0x02,
59 CMD = 0x03
60};
61
62enum infineon_tpm_command_bits {
63 CMD_DIS = 0x00,
64 CMD_LP = 0x01,
65 CMD_RES = 0x02,
66 CMD_IRQC = 0x06
67};
68
69enum infineon_tpm_status_bits {
70 STAT_XFE = 0x00,
71 STAT_LPA = 0x01,
72 STAT_FOK = 0x02,
73 STAT_TOK = 0x03,
74 STAT_IRQA = 0x06,
75 STAT_RDA = 0x07
76};
77
78/* some outgoing values */
79enum infineon_tpm_values {
80 CHIP_ID1 = 0x20,
81 CHIP_ID2 = 0x21,
82 TPM_DAR = 0x30,
83 RESET_LP_IRQC_DISABLE = 0x41,
84 ENABLE_REGISTER_PAIR = 0x55,
85 IOLIMH = 0x60,
86 IOLIML = 0x61,
87 DISABLE_REGISTER_PAIR = 0xAA,
88 IDVENL = 0xF1,
89 IDVENH = 0xF2,
90 IDPDL = 0xF3,
91 IDPDH = 0xF4
92};
93
94static int number_of_wtx;
95
96static int empty_fifo(struct tpm_chip *chip, int clear_wrfifo)
97{
98 int status;
99 int check = 0;
100 int i;
101
102 if (clear_wrfifo) {
103 for (i = 0; i < 4096; i++) {
104 status = inb(chip->vendor->base + WRFIFO);
105 if (status == 0xff) {
106 if (check == 5)
107 break;
108 else
109 check++;
110 }
111 }
112 }
113 /* Note: The values which are currently in the FIFO of the TPM
114 are thrown away since there is no usage for them. Usually,
115 this has nothing to say, since the TPM will give its answer
116 immediately or will be aborted anyway, so the data here is
117 usually garbage and useless.
118 We have to clean this, because the next communication with
119 the TPM would be rubbish, if there is still some old data
120 in the Read FIFO.
121 */
122 i = 0;
123 do {
124 status = inb(chip->vendor->base + RDFIFO);
125 status = inb(chip->vendor->base + STAT);
126 i++;
127 if (i == TPM_MAX_TRIES)
128 return -EIO;
129 } while ((status & (1 << STAT_RDA)) != 0);
130 return 0;
131}
132
133static int wait(struct tpm_chip *chip, int wait_for_bit)
134{
135 int status;
136 int i;
137 for (i = 0; i < TPM_MAX_TRIES; i++) {
138 status = inb(chip->vendor->base + STAT);
139 /* check the status-register if wait_for_bit is set */
140 if (status & 1 << wait_for_bit)
141 break;
142 msleep(TPM_MSLEEP_TIME);
143 }
144 if (i == TPM_MAX_TRIES) { /* timeout occurs */
145 if (wait_for_bit == STAT_XFE)
146 dev_err(&chip->pci_dev->dev,
147 "Timeout in wait(STAT_XFE)\n");
148 if (wait_for_bit == STAT_RDA)
149 dev_err(&chip->pci_dev->dev,
150 "Timeout in wait(STAT_RDA)\n");
151 return -EIO;
152 }
153 return 0;
154};
155
156static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
157{
158 wait(chip, STAT_XFE);
159 outb(sendbyte, chip->vendor->base + WRFIFO);
160}
161
162 /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more
163 calculation time, it sends a WTX-package, which has to be acknowledged
164 or aborted. This usually occurs if you are hammering the TPM with key
165 creation. Set the maximum number of WTX-packages in the definitions
166 above, if the number is reached, the waiting-time will be denied
167 and the TPM command has to be resend.
168 */
169
170static void tpm_wtx(struct tpm_chip *chip)
171{
172 number_of_wtx++;
173 dev_info(&chip->pci_dev->dev, "Granting WTX (%02d / %02d)\n",
174 number_of_wtx, TPM_MAX_WTX_PACKAGES);
175 wait_and_send(chip, TPM_VL_VER);
176 wait_and_send(chip, TPM_CTRL_WTX);
177 wait_and_send(chip, 0x00);
178 wait_and_send(chip, 0x00);
179 msleep(TPM_WTX_MSLEEP_TIME);
180}
181
182static void tpm_wtx_abort(struct tpm_chip *chip)
183{
184 dev_info(&chip->pci_dev->dev, "Aborting WTX\n");
185 wait_and_send(chip, TPM_VL_VER);
186 wait_and_send(chip, TPM_CTRL_WTX_ABORT);
187 wait_and_send(chip, 0x00);
188 wait_and_send(chip, 0x00);
189 number_of_wtx = 0;
190 msleep(TPM_WTX_MSLEEP_TIME);
191}
192
193static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
194{
195 int i;
196 int ret;
197 u32 size = 0;
198
199recv_begin:
200 /* start receiving header */
201 for (i = 0; i < 4; i++) {
202 ret = wait(chip, STAT_RDA);
203 if (ret)
204 return -EIO;
205 buf[i] = inb(chip->vendor->base + RDFIFO);
206 }
207
208 if (buf[0] != TPM_VL_VER) {
209 dev_err(&chip->pci_dev->dev,
210 "Wrong transport protocol implementation!\n");
211 return -EIO;
212 }
213
214 if (buf[1] == TPM_CTRL_DATA) {
215 /* size of the data received */
216 size = ((buf[2] << 8) | buf[3]);
217
218 for (i = 0; i < size; i++) {
219 wait(chip, STAT_RDA);
220 buf[i] = inb(chip->vendor->base + RDFIFO);
221 }
222
223 if ((size == 0x6D00) && (buf[1] == 0x80)) {
224 dev_err(&chip->pci_dev->dev,
225 "Error handling on vendor layer!\n");
226 return -EIO;
227 }
228
229 for (i = 0; i < size; i++)
230 buf[i] = buf[i + 6];
231
232 size = size - 6;
233 return size;
234 }
235
236 if (buf[1] == TPM_CTRL_WTX) {
237 dev_info(&chip->pci_dev->dev, "WTX-package received\n");
238 if (number_of_wtx < TPM_MAX_WTX_PACKAGES) {
239 tpm_wtx(chip);
240 goto recv_begin;
241 } else {
242 tpm_wtx_abort(chip);
243 goto recv_begin;
244 }
245 }
246
247 if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) {
248 dev_info(&chip->pci_dev->dev, "WTX-abort acknowledged\n");
249 return size;
250 }
251
252 if (buf[1] == TPM_CTRL_ERROR) {
253 dev_err(&chip->pci_dev->dev, "ERROR-package received:\n");
254 if (buf[4] == TPM_INF_NAK)
255 dev_err(&chip->pci_dev->dev,
256 "-> Negative acknowledgement"
257 " - retransmit command!\n");
258 return -EIO;
259 }
260 return -EIO;
261}
262
263static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count)
264{
265 int i;
266 int ret;
267 u8 count_high, count_low, count_4, count_3, count_2, count_1;
268
269 /* Disabling Reset, LP and IRQC */
270 outb(RESET_LP_IRQC_DISABLE, chip->vendor->base + CMD);
271
272 ret = empty_fifo(chip, 1);
273 if (ret) {
274 dev_err(&chip->pci_dev->dev, "Timeout while clearing FIFO\n");
275 return -EIO;
276 }
277
278 ret = wait(chip, STAT_XFE);
279 if (ret)
280 return -EIO;
281
282 count_4 = (count & 0xff000000) >> 24;
283 count_3 = (count & 0x00ff0000) >> 16;
284 count_2 = (count & 0x0000ff00) >> 8;
285 count_1 = (count & 0x000000ff);
286 count_high = ((count + 6) & 0xffffff00) >> 8;
287 count_low = ((count + 6) & 0x000000ff);
288
289 /* Sending Header */
290 wait_and_send(chip, TPM_VL_VER);
291 wait_and_send(chip, TPM_CTRL_DATA);
292 wait_and_send(chip, count_high);
293 wait_and_send(chip, count_low);
294
295 /* Sending Data Header */
296 wait_and_send(chip, TPM_VL_VER);
297 wait_and_send(chip, TPM_VL_CHANNEL_TPM);
298 wait_and_send(chip, count_4);
299 wait_and_send(chip, count_3);
300 wait_and_send(chip, count_2);
301 wait_and_send(chip, count_1);
302
303 /* Sending Data */
304 for (i = 0; i < count; i++) {
305 wait_and_send(chip, buf[i]);
306 }
307 return count;
308}
309
310static void tpm_inf_cancel(struct tpm_chip *chip)
311{
312 /*
313 Since we are using the legacy mode to communicate
314 with the TPM, we have no cancel functions, but have
315 a workaround for interrupting the TPM through WTX.
316 */
317}
318
319static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
320static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
321static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
322static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
323
324static struct attribute *inf_attrs[] = {
325 &dev_attr_pubek.attr,
326 &dev_attr_pcrs.attr,
327 &dev_attr_caps.attr,
328 &dev_attr_cancel.attr,
329 NULL,
330};
331
332static struct attribute_group inf_attr_grp = {.attrs = inf_attrs };
333
334static struct file_operations inf_ops = {
335 .owner = THIS_MODULE,
336 .llseek = no_llseek,
337 .open = tpm_open,
338 .read = tpm_read,
339 .write = tpm_write,
340 .release = tpm_release,
341};
342
343static struct tpm_vendor_specific tpm_inf = {
344 .recv = tpm_inf_recv,
345 .send = tpm_inf_send,
346 .cancel = tpm_inf_cancel,
347 .req_complete_mask = 0,
348 .req_complete_val = 0,
349 .attr_group = &inf_attr_grp,
350 .miscdev = {.fops = &inf_ops,},
351};
352
353static const struct pnp_device_id tpm_pnp_tbl[] = {
354 /* Infineon TPMs */
355 {"IFX0101", 0},
356 {"IFX0102", 0},
357 {"", 0}
358};
359
360static int __devinit tpm_inf_acpi_probe(struct pnp_dev *dev,
361 const struct pnp_device_id *dev_id)
362{
363 TPM_INF_ADDR = (pnp_port_start(dev, 0) & 0xff);
364 TPM_INF_DATA = ((TPM_INF_ADDR + 1) & 0xff);
365 tpm_inf.base = pnp_port_start(dev, 1);
366 dev_info(&dev->dev, "Found %s with ID %s\n",
367 dev->name, dev_id->id);
368 if (!((tpm_inf.base >> 8) & 0xff))
369 tpm_inf.base = 0;
370 return 0;
371}
372
373static struct pnp_driver tpm_inf_pnp = {
374 .name = "tpm_inf_pnp",
375 .id_table = tpm_pnp_tbl,
376 .probe = tpm_inf_acpi_probe,
377};
378
379static int __devinit tpm_inf_probe(struct pci_dev *pci_dev,
380 const struct pci_device_id *pci_id)
381{
382 int rc = 0;
383 u8 iol, ioh;
384 int vendorid[2];
385 int version[2];
386 int productid[2];
387 char chipname[20];
388
389 if (pci_enable_device(pci_dev))
390 return -EIO;
391
392 dev_info(&pci_dev->dev, "LPC-bus found at 0x%x\n", pci_id->device);
393
394 /* read IO-ports from ACPI */
395 pnp_register_driver(&tpm_inf_pnp);
396 pnp_unregister_driver(&tpm_inf_pnp);
397
398 /* Make sure, we have received valid config ports */
399 if (!TPM_INF_ADDR) {
400 pci_disable_device(pci_dev);
401 return -EIO;
402 }
403
404 /* query chip for its vendor, its version number a.s.o. */
405 outb(ENABLE_REGISTER_PAIR, TPM_INF_ADDR);
406 outb(IDVENL, TPM_INF_ADDR);
407 vendorid[1] = inb(TPM_INF_DATA);
408 outb(IDVENH, TPM_INF_ADDR);
409 vendorid[0] = inb(TPM_INF_DATA);
410 outb(IDPDL, TPM_INF_ADDR);
411 productid[1] = inb(TPM_INF_DATA);
412 outb(IDPDH, TPM_INF_ADDR);
413 productid[0] = inb(TPM_INF_DATA);
414 outb(CHIP_ID1, TPM_INF_ADDR);
415 version[1] = inb(TPM_INF_DATA);
416 outb(CHIP_ID2, TPM_INF_ADDR);
417 version[0] = inb(TPM_INF_DATA);
418
419 switch ((productid[0] << 8) | productid[1]) {
420 case 6:
421 sprintf(chipname, " (SLD 9630 TT 1.1)");
422 break;
423 case 11:
424 sprintf(chipname, " (SLB 9635 TT 1.2)");
425 break;
426 default:
427 sprintf(chipname, " (unknown chip)");
428 break;
429 }
430 chipname[19] = 0;
431
432 if ((vendorid[0] << 8 | vendorid[1]) == (TPM_INFINEON_DEV_VEN_VALUE)) {
433
434 if (tpm_inf.base == 0) {
435 dev_err(&pci_dev->dev, "No IO-ports found!\n");
436 pci_disable_device(pci_dev);
437 return -EIO;
438 }
439 /* configure TPM with IO-ports */
440 outb(IOLIMH, TPM_INF_ADDR);
441 outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA);
442 outb(IOLIML, TPM_INF_ADDR);
443 outb((tpm_inf.base & 0xff), TPM_INF_DATA);
444
445 /* control if IO-ports are set correctly */
446 outb(IOLIMH, TPM_INF_ADDR);
447 ioh = inb(TPM_INF_DATA);
448 outb(IOLIML, TPM_INF_ADDR);
449 iol = inb(TPM_INF_DATA);
450
451 if ((ioh << 8 | iol) != tpm_inf.base) {
452 dev_err(&pci_dev->dev,
453 "Could not set IO-ports to %04x\n",
454 tpm_inf.base);
455 pci_disable_device(pci_dev);
456 return -EIO;
457 }
458
459 /* activate register */
460 outb(TPM_DAR, TPM_INF_ADDR);
461 outb(0x01, TPM_INF_DATA);
462 outb(DISABLE_REGISTER_PAIR, TPM_INF_ADDR);
463
464 /* disable RESET, LP and IRQC */
465 outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD);
466
467 /* Finally, we're done, print some infos */
468 dev_info(&pci_dev->dev, "TPM found: "
469 "config base 0x%x, "
470 "io base 0x%x, "
471 "chip version %02x%02x, "
472 "vendor id %x%x (Infineon), "
473 "product id %02x%02x"
474 "%s\n",
475 TPM_INF_ADDR,
476 tpm_inf.base,
477 version[0], version[1],
478 vendorid[0], vendorid[1],
479 productid[0], productid[1], chipname);
480
481 rc = tpm_register_hardware(pci_dev, &tpm_inf);
482 if (rc < 0) {
483 pci_disable_device(pci_dev);
484 return -ENODEV;
485 }
486 return 0;
487 } else {
488 dev_info(&pci_dev->dev, "No Infineon TPM found!\n");
489 pci_disable_device(pci_dev);
490 return -ENODEV;
491 }
492}
493
494static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
495 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
496 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
497 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
498 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
499 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
500 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)},
501 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)},
502 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2)},
503 {0,}
504};
505
506MODULE_DEVICE_TABLE(pci, tpm_pci_tbl);
507
508static struct pci_driver inf_pci_driver = {
509 .name = "tpm_inf",
510 .id_table = tpm_pci_tbl,
511 .probe = tpm_inf_probe,
512 .remove = __devexit_p(tpm_remove),
513 .suspend = tpm_pm_suspend,
514 .resume = tpm_pm_resume,
515};
516
517static int __init init_inf(void)
518{
519 return pci_register_driver(&inf_pci_driver);
520}
521
522static void __exit cleanup_inf(void)
523{
524 pci_unregister_driver(&inf_pci_driver);
525}
526
527module_init(init_inf);
528module_exit(cleanup_inf);
529
530MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>");
531MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
532MODULE_VERSION("1.5");
533MODULE_LICENSE("GPL");
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
index 8f302121741b..7289f4af93d0 100644
--- a/drivers/char/watchdog/acquirewdt.c
+++ b/drivers/char/watchdog/acquirewdt.c
@@ -82,12 +82,7 @@ static int wdt_start = 0x443;
82module_param(wdt_start, int, 0); 82module_param(wdt_start, int, 0);
83MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)"); 83MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");
84 84
85#ifdef CONFIG_WATCHDOG_NOWAYOUT 85static int nowayout = WATCHDOG_NOWAYOUT;
86static int nowayout = 1;
87#else
88static int nowayout = 0;
89#endif
90
91module_param(nowayout, int, 0); 86module_param(nowayout, int, 0);
92MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 87MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
93 88
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c
index ea73c8379bdd..194a3fd36b91 100644
--- a/drivers/char/watchdog/advantechwdt.c
+++ b/drivers/char/watchdog/advantechwdt.c
@@ -73,12 +73,7 @@ static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
73module_param(timeout, int, 0); 73module_param(timeout, int, 0);
74MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 74MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
75 75
76#ifdef CONFIG_WATCHDOG_NOWAYOUT 76static int nowayout = WATCHDOG_NOWAYOUT;
77static int nowayout = 1;
78#else
79static int nowayout = 0;
80#endif
81
82module_param(nowayout, int, 0); 77module_param(nowayout, int, 0);
83MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 78MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
84 79
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c
index 35dcbf8be7d1..8338ca300e2e 100644
--- a/drivers/char/watchdog/alim1535_wdt.c
+++ b/drivers/char/watchdog/alim1535_wdt.c
@@ -38,12 +38,7 @@ static int timeout = WATCHDOG_TIMEOUT;
38module_param(timeout, int, 0); 38module_param(timeout, int, 0);
39MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 39MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
40 40
41#ifdef CONFIG_WATCHDOG_NOWAYOUT 41static int nowayout = WATCHDOG_NOWAYOUT;
42static int nowayout = 1;
43#else
44static int nowayout = 0;
45#endif
46
47module_param(nowayout, int, 0); 42module_param(nowayout, int, 0);
48MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 43MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
49 44
@@ -317,7 +312,7 @@ static int ali_notify_sys(struct notifier_block *this, unsigned long code, void
317 */ 312 */
318 313
319static struct pci_device_id ali_pci_tbl[] = { 314static struct pci_device_id ali_pci_tbl[] = {
320 { PCI_VENDOR_ID_AL, 1535, PCI_ANY_ID, PCI_ANY_ID,}, 315 { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,},
321 { 0, }, 316 { 0, },
322}; 317};
323MODULE_DEVICE_TABLE(pci, ali_pci_tbl); 318MODULE_DEVICE_TABLE(pci, ali_pci_tbl);
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c
index 90c091d9e0f5..c05ac188a4d7 100644
--- a/drivers/char/watchdog/alim7101_wdt.c
+++ b/drivers/char/watchdog/alim7101_wdt.c
@@ -75,12 +75,7 @@ static unsigned long wdt_is_open;
75static char wdt_expect_close; 75static char wdt_expect_close;
76static struct pci_dev *alim7101_pmu; 76static struct pci_dev *alim7101_pmu;
77 77
78#ifdef CONFIG_WATCHDOG_NOWAYOUT 78static int nowayout = WATCHDOG_NOWAYOUT;
79static int nowayout = 1;
80#else
81static int nowayout = 0;
82#endif
83
84module_param(nowayout, int, 0); 79module_param(nowayout, int, 0);
85MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 80MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
86 81
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c
index 2a29a511df7f..25c2f2575611 100644
--- a/drivers/char/watchdog/eurotechwdt.c
+++ b/drivers/char/watchdog/eurotechwdt.c
@@ -72,12 +72,7 @@ static char *ev = "int";
72 72
73#define WDT_TIMEOUT 60 /* 1 minute */ 73#define WDT_TIMEOUT 60 /* 1 minute */
74 74
75#ifdef CONFIG_WATCHDOG_NOWAYOUT 75static int nowayout = WATCHDOG_NOWAYOUT;
76static int nowayout = 1;
77#else
78static int nowayout = 0;
79#endif
80
81module_param(nowayout, int, 0); 76module_param(nowayout, int, 0);
82MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 77MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
83 78
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c
index 5d07ee59679d..f975dab1ddf9 100644
--- a/drivers/char/watchdog/i8xx_tco.c
+++ b/drivers/char/watchdog/i8xx_tco.c
@@ -105,12 +105,7 @@ static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
105module_param(heartbeat, int, 0); 105module_param(heartbeat, int, 0);
106MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 106MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
107 107
108#ifdef CONFIG_WATCHDOG_NOWAYOUT 108static int nowayout = WATCHDOG_NOWAYOUT;
109static int nowayout = 1;
110#else
111static int nowayout = 0;
112#endif
113
114module_param(nowayout, int, 0); 109module_param(nowayout, int, 0);
115MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 110MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
116 111
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
index d974f16e84d2..cf60329eec85 100644
--- a/drivers/char/watchdog/ib700wdt.c
+++ b/drivers/char/watchdog/ib700wdt.c
@@ -117,12 +117,7 @@ static int wd_times[] = {
117 117
118static int wd_margin = WD_TIMO; 118static int wd_margin = WD_TIMO;
119 119
120#ifdef CONFIG_WATCHDOG_NOWAYOUT 120static int nowayout = WATCHDOG_NOWAYOUT;
121static int nowayout = 1;
122#else
123static int nowayout = 0;
124#endif
125
126module_param(nowayout, int, 0); 121module_param(nowayout, int, 0);
127MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 122MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
128 123
diff --git a/drivers/char/watchdog/indydog.c b/drivers/char/watchdog/indydog.c
index 6af2c799b57e..b4b94daba67e 100644
--- a/drivers/char/watchdog/indydog.c
+++ b/drivers/char/watchdog/indydog.c
@@ -29,14 +29,9 @@
29#define PFX "indydog: " 29#define PFX "indydog: "
30static int indydog_alive; 30static int indydog_alive;
31 31
32#ifdef CONFIG_WATCHDOG_NOWAYOUT
33static int nowayout = 1;
34#else
35static int nowayout = 0;
36#endif
37
38#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ 32#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
39 33
34static int nowayout = WATCHDOG_NOWAYOUT;
40module_param(nowayout, int, 0); 35module_param(nowayout, int, 0);
41MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 36MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
42 37
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c
index 4b039516cc86..e7640bc4904b 100644
--- a/drivers/char/watchdog/ixp2000_wdt.c
+++ b/drivers/char/watchdog/ixp2000_wdt.c
@@ -30,11 +30,7 @@
30#include <asm/hardware.h> 30#include <asm/hardware.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33#ifdef CONFIG_WATCHDOG_NOWAYOUT 33static int nowayout = WATCHDOG_NOWAYOUT;
34static int nowayout = 1;
35#else
36static int nowayout = 0;
37#endif
38static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ 34static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
39static unsigned long wdt_status; 35static unsigned long wdt_status;
40 36
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c
index 83df369113a4..8d916afbf4fa 100644
--- a/drivers/char/watchdog/ixp4xx_wdt.c
+++ b/drivers/char/watchdog/ixp4xx_wdt.c
@@ -27,11 +27,7 @@
27#include <asm/hardware.h> 27#include <asm/hardware.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29 29
30#ifdef CONFIG_WATCHDOG_NOWAYOUT 30static int nowayout = WATCHDOG_NOWAYOUT;
31static int nowayout = 1;
32#else
33static int nowayout = 0;
34#endif
35static int heartbeat = 60; /* (secs) Default is 1 minute */ 31static int heartbeat = 60; /* (secs) Default is 1 minute */
36static unsigned long wdt_status; 32static unsigned long wdt_status;
37static unsigned long boot_status; 33static unsigned long boot_status;
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
index 9da395fa7794..a9a20aad61e7 100644
--- a/drivers/char/watchdog/machzwd.c
+++ b/drivers/char/watchdog/machzwd.c
@@ -94,12 +94,7 @@ MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver");
94MODULE_LICENSE("GPL"); 94MODULE_LICENSE("GPL");
95MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 95MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
96 96
97#ifdef CONFIG_WATCHDOG_NOWAYOUT 97static int nowayout = WATCHDOG_NOWAYOUT;
98static int nowayout = 1;
99#else
100static int nowayout = 0;
101#endif
102
103module_param(nowayout, int, 0); 98module_param(nowayout, int, 0);
104MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 99MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
105 100
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c
index 3143e4a07535..c9b301dccec3 100644
--- a/drivers/char/watchdog/mixcomwd.c
+++ b/drivers/char/watchdog/mixcomwd.c
@@ -62,12 +62,7 @@ static int mixcomwd_timer_alive;
62static struct timer_list mixcomwd_timer = TIMER_INITIALIZER(NULL, 0, 0); 62static struct timer_list mixcomwd_timer = TIMER_INITIALIZER(NULL, 0, 0);
63static char expect_close; 63static char expect_close;
64 64
65#ifdef CONFIG_WATCHDOG_NOWAYOUT 65static int nowayout = WATCHDOG_NOWAYOUT;
66static int nowayout = 1;
67#else
68static int nowayout = 0;
69#endif
70
71module_param(nowayout, int, 0); 66module_param(nowayout, int, 0);
72MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 67MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
73 68
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index 6ebce3f2ef9c..427ad51b7a35 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -146,12 +146,7 @@ static int heartbeat = WATCHDOG_HEARTBEAT;
146module_param(heartbeat, int, 0); 146module_param(heartbeat, int, 0);
147MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 147MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
148 148
149#ifdef CONFIG_WATCHDOG_NOWAYOUT 149static int nowayout = WATCHDOG_NOWAYOUT;
150static int nowayout = 1;
151#else
152static int nowayout = 0;
153#endif
154
155module_param(nowayout, int, 0); 150module_param(nowayout, int, 0);
156MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 151MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
157 152
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c
index 8ce066627326..2b13afb09c5d 100644
--- a/drivers/char/watchdog/pcwd_pci.c
+++ b/drivers/char/watchdog/pcwd_pci.c
@@ -103,12 +103,7 @@ static int heartbeat = WATCHDOG_HEARTBEAT;
103module_param(heartbeat, int, 0); 103module_param(heartbeat, int, 0);
104MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 104MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
105 105
106#ifdef CONFIG_WATCHDOG_NOWAYOUT 106static int nowayout = WATCHDOG_NOWAYOUT;
107static int nowayout = 1;
108#else
109static int nowayout = 0;
110#endif
111
112module_param(nowayout, int, 0); 107module_param(nowayout, int, 0);
113MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 108MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
114 109
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
index 1127201d73b8..092e9b133750 100644
--- a/drivers/char/watchdog/pcwd_usb.c
+++ b/drivers/char/watchdog/pcwd_usb.c
@@ -79,12 +79,7 @@ static int heartbeat = WATCHDOG_HEARTBEAT;
79module_param(heartbeat, int, 0); 79module_param(heartbeat, int, 0);
80MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 80MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
81 81
82#ifdef CONFIG_WATCHDOG_NOWAYOUT 82static int nowayout = WATCHDOG_NOWAYOUT;
83static int nowayout = 1;
84#else
85static int nowayout = 0;
86#endif
87
88module_param(nowayout, int, 0); 83module_param(nowayout, int, 0);
89MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 84MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
90 85
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index 1699d2c28ce5..f85ac898a49a 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -62,12 +62,7 @@
62#define CONFIG_S3C2410_WATCHDOG_ATBOOT (0) 62#define CONFIG_S3C2410_WATCHDOG_ATBOOT (0)
63#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) 63#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15)
64 64
65#ifdef CONFIG_WATCHDOG_NOWAYOUT 65static int nowayout = WATCHDOG_NOWAYOUT;
66static int nowayout = 1;
67#else
68static int nowayout = 0;
69#endif
70
71static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME; 66static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME;
72static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; 67static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT;
73static int soft_noboot = 0; 68static int soft_noboot = 0;
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c
index 34e8f7b15e30..fb88b4041dca 100644
--- a/drivers/char/watchdog/sa1100_wdt.c
+++ b/drivers/char/watchdog/sa1100_wdt.c
@@ -36,17 +36,10 @@
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
38#define OSCR_FREQ CLOCK_TICK_RATE 38#define OSCR_FREQ CLOCK_TICK_RATE
39#define SA1100_CLOSE_MAGIC (0x5afc4453)
40 39
41static unsigned long sa1100wdt_users; 40static unsigned long sa1100wdt_users;
42static int expect_close;
43static int pre_margin; 41static int pre_margin;
44static int boot_status; 42static int boot_status;
45#ifdef CONFIG_WATCHDOG_NOWAYOUT
46static int nowayout = 1;
47#else
48static int nowayout = 0;
49#endif
50 43
51/* 44/*
52 * Allow only one person to hold it open 45 * Allow only one person to hold it open
@@ -66,55 +59,33 @@ static int sa1100dog_open(struct inode *inode, struct file *file)
66} 59}
67 60
68/* 61/*
69 * Shut off the timer. 62 * The watchdog cannot be disabled.
70 * Lock it in if it's a module and we defined ...NOWAYOUT 63 *
71 * Oddly, the watchdog can only be enabled, but we can turn off 64 * Previous comments suggested that turning off the interrupt by
72 * the interrupt, which appears to prevent the watchdog timing out. 65 * clearing OIER[E3] would prevent the watchdog timing out but this
66 * does not appear to be true (at least on the PXA255).
73 */ 67 */
74static int sa1100dog_release(struct inode *inode, struct file *file) 68static int sa1100dog_release(struct inode *inode, struct file *file)
75{ 69{
76 OSMR3 = OSCR + pre_margin; 70 printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n");
77
78 if (expect_close == SA1100_CLOSE_MAGIC) {
79 OIER &= ~OIER_E3;
80 } else {
81 printk(KERN_CRIT "WATCHDOG: WDT device closed unexpectedly. WDT will not stop!\n");
82 }
83 71
84 clear_bit(1, &sa1100wdt_users); 72 clear_bit(1, &sa1100wdt_users);
85 expect_close = 0;
86 73
87 return 0; 74 return 0;
88} 75}
89 76
90static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos) 77static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
91{ 78{
92 if (len) { 79 if (len)
93 if (!nowayout) {
94 size_t i;
95
96 expect_close = 0;
97
98 for (i = 0; i != len; i++) {
99 char c;
100
101 if (get_user(c, data + i))
102 return -EFAULT;
103 if (c == 'V')
104 expect_close = SA1100_CLOSE_MAGIC;
105 }
106 }
107 /* Refresh OSMR3 timer. */ 80 /* Refresh OSMR3 timer. */
108 OSMR3 = OSCR + pre_margin; 81 OSMR3 = OSCR + pre_margin;
109 }
110 82
111 return len; 83 return len;
112} 84}
113 85
114static struct watchdog_info ident = { 86static struct watchdog_info ident = {
115 .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | 87 .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
116 WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 88 .identity = "SA1100/PXA255 Watchdog",
117 .identity = "SA1100 Watchdog",
118}; 89};
119 90
120static int sa1100dog_ioctl(struct inode *inode, struct file *file, 91static int sa1100dog_ioctl(struct inode *inode, struct file *file,
@@ -176,7 +147,7 @@ static struct file_operations sa1100dog_fops =
176static struct miscdevice sa1100dog_miscdev = 147static struct miscdevice sa1100dog_miscdev =
177{ 148{
178 .minor = WATCHDOG_MINOR, 149 .minor = WATCHDOG_MINOR,
179 .name = "SA1100/PXA2xx watchdog", 150 .name = "watchdog",
180 .fops = &sa1100dog_fops, 151 .fops = &sa1100dog_fops,
181}; 152};
182 153
@@ -198,7 +169,6 @@ static int __init sa1100dog_init(void)
198 if (ret == 0) 169 if (ret == 0)
199 printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", 170 printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
200 margin); 171 margin);
201
202 return ret; 172 return ret;
203} 173}
204 174
@@ -216,8 +186,5 @@ MODULE_DESCRIPTION("SA1100/PXA2xx Watchdog");
216module_param(margin, int, 0); 186module_param(margin, int, 0);
217MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); 187MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)");
218 188
219module_param(nowayout, int, 0);
220MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
221
222MODULE_LICENSE("GPL"); 189MODULE_LICENSE("GPL");
223MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 190MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c
index d7de9880605a..ed0bd55fbfc1 100644
--- a/drivers/char/watchdog/sbc60xxwdt.c
+++ b/drivers/char/watchdog/sbc60xxwdt.c
@@ -98,12 +98,7 @@ static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ t
98module_param(timeout, int, 0); 98module_param(timeout, int, 0);
99MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 99MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
100 100
101#ifdef CONFIG_WATCHDOG_NOWAYOUT 101static int nowayout = WATCHDOG_NOWAYOUT;
102static int nowayout = 1;
103#else
104static int nowayout = 0;
105#endif
106
107module_param(nowayout, int, 0); 102module_param(nowayout, int, 0);
108MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 103MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
109 104
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
index 24401e84729e..515ce7572049 100644
--- a/drivers/char/watchdog/sc1200wdt.c
+++ b/drivers/char/watchdog/sc1200wdt.c
@@ -91,12 +91,7 @@ MODULE_PARM_DESC(io, "io port");
91module_param(timeout, int, 0); 91module_param(timeout, int, 0);
92MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1"); 92MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
93 93
94#ifdef CONFIG_WATCHDOG_NOWAYOUT 94static int nowayout = WATCHDOG_NOWAYOUT;
95static int nowayout = 1;
96#else
97static int nowayout = 0;
98#endif
99
100module_param(nowayout, int, 0); 95module_param(nowayout, int, 0);
101MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 96MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
102 97
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c
index f6d143e1900d..72501be79b0c 100644
--- a/drivers/char/watchdog/sc520_wdt.c
+++ b/drivers/char/watchdog/sc520_wdt.c
@@ -94,12 +94,7 @@ static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ t
94module_param(timeout, int, 0); 94module_param(timeout, int, 0);
95MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 95MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
96 96
97#ifdef CONFIG_WATCHDOG_NOWAYOUT 97static int nowayout = WATCHDOG_NOWAYOUT;
98static int nowayout = 1;
99#else
100static int nowayout = 0;
101#endif
102
103module_param(nowayout, int, 0); 98module_param(nowayout, int, 0);
104MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 99MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
105 100
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
index b569670e4ed5..c4568569f3a8 100644
--- a/drivers/char/watchdog/scx200_wdt.c
+++ b/drivers/char/watchdog/scx200_wdt.c
@@ -39,15 +39,11 @@ MODULE_DESCRIPTION("NatSemi SCx200 Watchdog Driver");
39MODULE_LICENSE("GPL"); 39MODULE_LICENSE("GPL");
40MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 40MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
41 41
42#ifndef CONFIG_WATCHDOG_NOWAYOUT
43#define CONFIG_WATCHDOG_NOWAYOUT 0
44#endif
45
46static int margin = 60; /* in seconds */ 42static int margin = 60; /* in seconds */
47module_param(margin, int, 0); 43module_param(margin, int, 0);
48MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); 44MODULE_PARM_DESC(margin, "Watchdog margin in seconds");
49 45
50static int nowayout = CONFIG_WATCHDOG_NOWAYOUT; 46static int nowayout = WATCHDOG_NOWAYOUT;
51module_param(nowayout, int, 0); 47module_param(nowayout, int, 0);
52MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); 48MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
53 49
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c
index 3bc9272a474c..1f4cab55b2ef 100644
--- a/drivers/char/watchdog/shwdt.c
+++ b/drivers/char/watchdog/shwdt.c
@@ -75,11 +75,7 @@ static unsigned long next_heartbeat;
75#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ 75#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */
76static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ 76static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
77 77
78#ifdef CONFIG_WATCHDOG_NOWAYOUT 78static int nowayout = WATCHDOG_NOWAYOUT;
79static int nowayout = 1;
80#else
81static int nowayout = 0;
82#endif
83 79
84/** 80/**
85 * sh_wdt_start - Start the Watchdog 81 * sh_wdt_start - Start the Watchdog
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c
index 98c7578740e2..4d7ed931f5c6 100644
--- a/drivers/char/watchdog/softdog.c
+++ b/drivers/char/watchdog/softdog.c
@@ -56,12 +56,7 @@ static int soft_margin = TIMER_MARGIN; /* in seconds */
56module_param(soft_margin, int, 0); 56module_param(soft_margin, int, 0);
57MODULE_PARM_DESC(soft_margin, "Watchdog soft_margin in seconds. (0<soft_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")"); 57MODULE_PARM_DESC(soft_margin, "Watchdog soft_margin in seconds. (0<soft_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")");
58 58
59#ifdef CONFIG_WATCHDOG_NOWAYOUT 59static int nowayout = WATCHDOG_NOWAYOUT;
60static int nowayout = 1;
61#else
62static int nowayout = 0;
63#endif
64
65module_param(nowayout, int, 0); 60module_param(nowayout, int, 0);
66MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 61MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
67 62
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c
index 813c97038f84..465e0fd0423d 100644
--- a/drivers/char/watchdog/w83627hf_wdt.c
+++ b/drivers/char/watchdog/w83627hf_wdt.c
@@ -54,12 +54,7 @@ static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
54module_param(timeout, int, 0); 54module_param(timeout, int, 0);
55MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 55MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
56 56
57#ifdef CONFIG_WATCHDOG_NOWAYOUT 57static int nowayout = WATCHDOG_NOWAYOUT;
58static int nowayout = 1;
59#else
60static int nowayout = 0;
61#endif
62
63module_param(nowayout, int, 0); 58module_param(nowayout, int, 0);
64MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 59MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
65 60
diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c
index bccbd4d6ac2d..52a8bd0a5988 100644
--- a/drivers/char/watchdog/w83877f_wdt.c
+++ b/drivers/char/watchdog/w83877f_wdt.c
@@ -85,12 +85,7 @@ module_param(timeout, int, 0);
85MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 85MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
86 86
87 87
88#ifdef CONFIG_WATCHDOG_NOWAYOUT 88static int nowayout = WATCHDOG_NOWAYOUT;
89static int nowayout = 1;
90#else
91static int nowayout = 0;
92#endif
93
94module_param(nowayout, int, 0); 89module_param(nowayout, int, 0);
95MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 90MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
96 91
diff --git a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c
index abb0bea45c02..7cf6c9bbf486 100644
--- a/drivers/char/watchdog/wafer5823wdt.c
+++ b/drivers/char/watchdog/wafer5823wdt.c
@@ -63,12 +63,7 @@ static int timeout = WD_TIMO; /* in seconds */
63module_param(timeout, int, 0); 63module_param(timeout, int, 0);
64MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) "."); 64MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) ".");
65 65
66#ifdef CONFIG_WATCHDOG_NOWAYOUT 66static int nowayout = WATCHDOG_NOWAYOUT;
67static int nowayout = 1;
68#else
69static int nowayout = 0;
70#endif
71
72module_param(nowayout, int, 0); 67module_param(nowayout, int, 0);
73MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 68MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
74 69
diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c
index 1210ca0c425b..ec7e401228ee 100644
--- a/drivers/char/watchdog/wdt.c
+++ b/drivers/char/watchdog/wdt.c
@@ -63,12 +63,7 @@ static int wd_heartbeat;
63module_param(heartbeat, int, 0); 63module_param(heartbeat, int, 0);
64MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")"); 64MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")");
65 65
66#ifdef CONFIG_WATCHDOG_NOWAYOUT 66static int nowayout = WATCHDOG_NOWAYOUT;
67static int nowayout = 1;
68#else
69static int nowayout = 0;
70#endif
71
72module_param(nowayout, int, 0); 67module_param(nowayout, int, 0);
73MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 68MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
74 69
diff --git a/drivers/char/watchdog/wdt977.c b/drivers/char/watchdog/wdt977.c
index 072e9b214759..44d49dfacbb3 100644
--- a/drivers/char/watchdog/wdt977.c
+++ b/drivers/char/watchdog/wdt977.c
@@ -53,12 +53,7 @@ MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __M
53module_param(testmode, int, 0); 53module_param(testmode, int, 0);
54MODULE_PARM_DESC(testmode,"Watchdog testmode (1 = no reboot), default=0"); 54MODULE_PARM_DESC(testmode,"Watchdog testmode (1 = no reboot), default=0");
55 55
56#ifdef CONFIG_WATCHDOG_NOWAYOUT 56static int nowayout = WATCHDOG_NOWAYOUT;
57static int nowayout = 1;
58#else
59static int nowayout = 0;
60#endif
61
62module_param(nowayout, int, 0); 57module_param(nowayout, int, 0);
63MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 58MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
64 59
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
index c80cb77b92fb..4b3311993d48 100644
--- a/drivers/char/watchdog/wdt_pci.c
+++ b/drivers/char/watchdog/wdt_pci.c
@@ -89,12 +89,7 @@ static int wd_heartbeat;
89module_param(heartbeat, int, 0); 89module_param(heartbeat, int, 0);
90MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")"); 90MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")");
91 91
92#ifdef CONFIG_WATCHDOG_NOWAYOUT 92static int nowayout = WATCHDOG_NOWAYOUT;
93static int nowayout = 1;
94#else
95static int nowayout = 0;
96#endif
97
98module_param(nowayout, int, 0); 93module_param(nowayout, int, 0);
99MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 94MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
100 95
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7a7859dd0d98..10b014982381 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1130,7 +1130,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
1130 unsigned int target_freq, 1130 unsigned int target_freq,
1131 unsigned int relation) 1131 unsigned int relation)
1132{ 1132{
1133 unsigned int ret; 1133 int ret;
1134 1134
1135 policy = cpufreq_cpu_get(policy->cpu); 1135 policy = cpufreq_cpu_get(policy->cpu);
1136 if (!policy) 1136 if (!policy)
@@ -1151,7 +1151,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target);
1151 1151
1152static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) 1152static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
1153{ 1153{
1154 int ret = -EINVAL; 1154 int ret;
1155 1155
1156 if (!try_module_get(policy->governor->owner)) 1156 if (!try_module_get(policy->governor->owner))
1157 return -EINVAL; 1157 return -EINVAL;
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index 5d961f5e0ca0..e4710d1d1f9d 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -1004,8 +1004,8 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
1004 return FAILED; 1004 return FAILED;
1005 } 1005 }
1006 fc->rst_pkt->eh_state = SCSI_STATE_UNUSED; 1006 fc->rst_pkt->eh_state = SCSI_STATE_UNUSED;
1007 return SUCCESS;
1008#endif 1007#endif
1008 return SUCCESS;
1009} 1009}
1010 1010
1011static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) 1011static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 53c95c0bbf46..ae1fb45dbb40 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -25,14 +25,22 @@ setup_serial_console(struct pcdp_uart *uart)
25#ifdef CONFIG_SERIAL_8250_CONSOLE 25#ifdef CONFIG_SERIAL_8250_CONSOLE
26 int mmio; 26 int mmio;
27 static char options[64], *p = options; 27 static char options[64], *p = options;
28 char parity;
28 29
29 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY); 30 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
30 p += sprintf(p, "console=uart,%s,0x%lx", 31 p += sprintf(p, "console=uart,%s,0x%lx",
31 mmio ? "mmio" : "io", uart->addr.address); 32 mmio ? "mmio" : "io", uart->addr.address);
32 if (uart->baud) 33 if (uart->baud) {
33 p += sprintf(p, ",%lu", uart->baud); 34 p += sprintf(p, ",%lu", uart->baud);
34 if (uart->bits) 35 if (uart->bits) {
35 p += sprintf(p, "n%d", uart->bits); 36 switch (uart->parity) {
37 case 0x2: parity = 'e'; break;
38 case 0x3: parity = 'o'; break;
39 default: parity = 'n';
40 }
41 p += sprintf(p, "%c%d", parity, uart->bits);
42 }
43 }
36 44
37 return early_serial_console_init(options); 45 return early_serial_console_init(options);
38#else 46#else
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 3c85fe150cd7..4fa17c76eea2 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -393,7 +393,7 @@ void adm1026_init_client(struct i2c_client *client)
393 393
394 value = data->config3; 394 value = data->config3;
395 if (data->config3 & CFG3_GPIO16_ENABLE) { 395 if (data->config3 & CFG3_GPIO16_ENABLE) {
396 dev_dbg(&client->dev, "GPIO16 enabled. THERM" 396 dev_dbg(&client->dev, "GPIO16 enabled. THERM "
397 "pin disabled.\n"); 397 "pin disabled.\n");
398 } else { 398 } else {
399 dev_dbg(&client->dev, "THERM pin enabled. " 399 dev_dbg(&client->dev, "THERM pin enabled. "
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index 0bcf82b4c07b..fca3fc1cef72 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/jiffies.h>
24#include <linux/i2c.h> 25#include <linux/i2c.h>
25#include <linux/i2c-sensor.h> 26#include <linux/i2c-sensor.h>
26#include <linux/i2c-vid.h> 27#include <linux/i2c-vid.h>
@@ -80,9 +81,7 @@ static struct atxp1_data * atxp1_update_device(struct device *dev)
80 81
81 down(&data->update_lock); 82 down(&data->update_lock);
82 83
83 if ((jiffies - data->last_updated > HZ) || 84 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
84 (jiffies < data->last_updated) ||
85 !data->valid) {
86 85
87 /* Update local register data */ 86 /* Update local register data */
88 data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); 87 data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID);
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index 3beaa6191ef4..270015b626ad 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -32,6 +32,7 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/jiffies.h>
35#include <linux/i2c.h> 36#include <linux/i2c.h>
36#include <linux/i2c-sensor.h> 37#include <linux/i2c-sensor.h>
37#include <linux/init.h> 38#include <linux/init.h>
@@ -572,8 +573,7 @@ static struct fscpos_data *fscpos_update_device(struct device *dev)
572 573
573 down(&data->update_lock); 574 down(&data->update_lock);
574 575
575 if ((jiffies - data->last_updated > 2 * HZ) || 576 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
576 (jiffies < data->last_updated) || !data->valid) {
577 int i; 577 int i;
578 578
579 dev_dbg(&client->dev, "Starting fscpos update\n"); 579 dev_dbg(&client->dev, "Starting fscpos update\n");
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index a13a504f5bfa..80ae8d30c2af 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/jiffies.h>
27#include <linux/i2c.h> 28#include <linux/i2c.h>
28#include <linux/i2c-sensor.h> 29#include <linux/i2c-sensor.h>
29#include <linux/i2c-vid.h> 30#include <linux/i2c-vid.h>
@@ -678,8 +679,7 @@ static struct gl520_data *gl520_update_device(struct device *dev)
678 679
679 down(&data->update_lock); 680 down(&data->update_lock);
680 681
681 if ((jiffies - data->last_updated > 2 * HZ) || 682 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
682 (jiffies < data->last_updated) || !data->valid) {
683 683
684 dev_dbg(&client->dev, "Starting gl520sm update\n"); 684 dev_dbg(&client->dev, "Starting gl520sm update\n");
685 685
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index bf553dcd97d6..3c159f1d49ee 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -363,7 +363,7 @@ static void __exit sensors_max1619_exit(void)
363 i2c_del_driver(&max1619_driver); 363 i2c_del_driver(&max1619_driver);
364} 364}
365 365
366MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and" 366MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and "
367 "Jean Delvare <khali@linux-fr.org>"); 367 "Jean Delvare <khali@linux-fr.org>");
368MODULE_DESCRIPTION("MAX1619 sensor driver"); 368MODULE_DESCRIPTION("MAX1619 sensor driver");
369MODULE_LICENSE("GPL"); 369MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 876c68f3af31..fa4032d53b79 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -1043,7 +1043,7 @@ static void pc87360_init_client(struct i2c_client *client, int use_thermistors)
1043 if (init >= 2 && data->innr) { 1043 if (init >= 2 && data->innr) {
1044 reg = pc87360_read_value(data, LD_IN, NO_BANK, 1044 reg = pc87360_read_value(data, LD_IN, NO_BANK,
1045 PC87365_REG_IN_CONVRATE); 1045 PC87365_REG_IN_CONVRATE);
1046 dev_info(&client->dev, "VLM conversion set to" 1046 dev_info(&client->dev, "VLM conversion set to "
1047 "1s period, 160us delay\n"); 1047 "1s period, 160us delay\n");
1048 pc87360_write_value(data, LD_IN, NO_BANK, 1048 pc87360_write_value(data, LD_IN, NO_BANK,
1049 PC87365_REG_IN_CONVRATE, 1049 PC87365_REG_IN_CONVRATE,
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 0ab7e37f5b00..1ab41313ce51 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -137,7 +137,7 @@ static int i801_setup(struct pci_dev *dev)
137 pci_read_config_word(I801_dev, SMBBA, &i801_smba); 137 pci_read_config_word(I801_dev, SMBBA, &i801_smba);
138 i801_smba &= 0xfff0; 138 i801_smba &= 0xfff0;
139 if(i801_smba == 0) { 139 if(i801_smba == 0) {
140 dev_err(&dev->dev, "SMB base address uninitialized" 140 dev_err(&dev->dev, "SMB base address uninitialized "
141 "- upgrade BIOS or use force_addr=0xaddr\n"); 141 "- upgrade BIOS or use force_addr=0xaddr\n");
142 return -ENODEV; 142 return -ENODEV;
143 } 143 }
@@ -186,7 +186,7 @@ static int i801_transaction(void)
186 int result = 0; 186 int result = 0;
187 int timeout = 0; 187 int timeout = 0;
188 188
189 dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x," 189 dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
190 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), 190 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
191 inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), 191 inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
192 inb_p(SMBHSTDAT1)); 192 inb_p(SMBHSTDAT1));
@@ -240,7 +240,7 @@ static int i801_transaction(void)
240 outb_p(inb(SMBHSTSTS), SMBHSTSTS); 240 outb_p(inb(SMBHSTSTS), SMBHSTSTS);
241 241
242 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { 242 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
243 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction" 243 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction "
244 "(%02x)\n", temp); 244 "(%02x)\n", temp);
245 } 245 }
246 dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " 246 dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, "
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 03c23ce98edb..9ad3e9262e8a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -288,6 +288,100 @@ static struct i2c_adapter mpc_ops = {
288 .retries = 1 288 .retries = 1
289}; 289};
290 290
291static int fsl_i2c_probe(struct device *device)
292{
293 int result = 0;
294 struct mpc_i2c *i2c;
295 struct platform_device *pdev = to_platform_device(device);
296 struct fsl_i2c_platform_data *pdata;
297 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
298
299 pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
300
301 if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
302 return -ENOMEM;
303 }
304 memset(i2c, 0, sizeof(*i2c));
305
306 i2c->irq = platform_get_irq(pdev, 0);
307 i2c->flags = pdata->device_flags;
308 init_waitqueue_head(&i2c->queue);
309
310 i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
311
312 if (!i2c->base) {
313 printk(KERN_ERR "i2c-mpc - failed to map controller\n");
314 result = -ENOMEM;
315 goto fail_map;
316 }
317
318 if (i2c->irq != 0)
319 if ((result = request_irq(i2c->irq, mpc_i2c_isr,
320 SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
321 printk(KERN_ERR
322 "i2c-mpc - failed to attach interrupt\n");
323 goto fail_irq;
324 }
325
326 mpc_i2c_setclock(i2c);
327 dev_set_drvdata(device, i2c);
328
329 i2c->adap = mpc_ops;
330 i2c_set_adapdata(&i2c->adap, i2c);
331 i2c->adap.dev.parent = &pdev->dev;
332 if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
333 printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
334 goto fail_add;
335 }
336
337 return result;
338
339 fail_add:
340 if (i2c->irq != 0)
341 free_irq(i2c->irq, NULL);
342 fail_irq:
343 iounmap(i2c->base);
344 fail_map:
345 kfree(i2c);
346 return result;
347};
348
349static int fsl_i2c_remove(struct device *device)
350{
351 struct mpc_i2c *i2c = dev_get_drvdata(device);
352
353 i2c_del_adapter(&i2c->adap);
354 dev_set_drvdata(device, NULL);
355
356 if (i2c->irq != 0)
357 free_irq(i2c->irq, i2c);
358
359 iounmap(i2c->base);
360 kfree(i2c);
361 return 0;
362};
363
364/* Structure for a device driver */
365static struct device_driver fsl_i2c_driver = {
366 .name = "fsl-i2c",
367 .bus = &platform_bus_type,
368 .probe = fsl_i2c_probe,
369 .remove = fsl_i2c_remove,
370};
371
372static int __init fsl_i2c_init(void)
373{
374 return driver_register(&fsl_i2c_driver);
375}
376
377static void __exit fsl_i2c_exit(void)
378{
379 driver_unregister(&fsl_i2c_driver);
380}
381
382module_init(fsl_i2c_init);
383module_exit(fsl_i2c_exit);
384
291MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); 385MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");
292MODULE_DESCRIPTION 386MODULE_DESCRIPTION
293 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); 387 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors");
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 74ece8ac1c23..82cf959989fd 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -165,7 +165,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
165 buf[0] = 0; /* reg offset */ 165 buf[0] = 0; /* reg offset */
166 buf[1] = BIN2BCD(dt->tm_sec); 166 buf[1] = BIN2BCD(dt->tm_sec);
167 buf[2] = BIN2BCD(dt->tm_min); 167 buf[2] = BIN2BCD(dt->tm_min);
168 buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6); 168 buf[3] = BIN2BCD(dt->tm_hour);
169 buf[4] = BIN2BCD(dt->tm_wday) + 1; 169 buf[4] = BIN2BCD(dt->tm_wday) + 1;
170 buf[5] = BIN2BCD(dt->tm_mday); 170 buf[5] = BIN2BCD(dt->tm_mday);
171 buf[6] = BIN2BCD(dt->tm_mon) + 1; 171 buf[6] = BIN2BCD(dt->tm_mon) + 1;
@@ -344,9 +344,9 @@ static void ds1337_init_client(struct i2c_client *client)
344 344
345 /* Ensure that device is set in 24-hour mode */ 345 /* Ensure that device is set in 24-hour mode */
346 val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); 346 val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR);
347 if ((val >= 0) && (val & (1 << 6)) == 0) 347 if ((val >= 0) && (val & (1 << 6)))
348 i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, 348 i2c_smbus_write_byte_data(client, DS1337_REG_HOUR,
349 val | (1 << 6)); 349 val & 0x3f);
350} 350}
351 351
352static int ds1337_detach_client(struct i2c_client *client) 352static int ds1337_detach_client(struct i2c_client *client)
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index 6ea413f6d5e5..a2da31b0dd7b 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -163,6 +163,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
163 struct eeprom_data *data; 163 struct eeprom_data *data;
164 int err = 0; 164 int err = 0;
165 165
166 /* prevent 24RF08 corruption */
167 if (kind < 0)
168 i2c_smbus_xfer(adapter, address, 0, 0, 0,
169 I2C_SMBUS_QUICK, NULL);
170
166 /* There are three ways we can read the EEPROM data: 171 /* There are three ways we can read the EEPROM data:
167 (1) I2C block reads (faster, but unsupported by most adapters) 172 (1) I2C block reads (faster, but unsupported by most adapters)
168 (2) Consecutive byte reads (100% overhead) 173 (2) Consecutive byte reads (100% overhead)
@@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
187 new_client->driver = &eeprom_driver; 192 new_client->driver = &eeprom_driver;
188 new_client->flags = 0; 193 new_client->flags = 0;
189 194
190 /* prevent 24RF08 corruption */
191 i2c_smbus_write_quick(new_client, 0);
192
193 /* Fill in the remaining client fields */ 195 /* Fill in the remaining client fields */
194 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); 196 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE);
195 data->valid = 0; 197 data->valid = 0;
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index c4f14d9623c4..0230375f72e5 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -343,6 +343,11 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
343 struct max6875_data *data; 343 struct max6875_data *data;
344 int err = 0; 344 int err = 0;
345 345
346 /* Prevent 24RF08 corruption (in case of user error) */
347 if (kind < 0)
348 i2c_smbus_xfer(adapter, address, 0, 0, 0,
349 I2C_SMBUS_QUICK, NULL);
350
346 /* There are three ways we can read the EEPROM data: 351 /* There are three ways we can read the EEPROM data:
347 (1) I2C block reads (faster, but unsupported by most adapters) 352 (1) I2C block reads (faster, but unsupported by most adapters)
348 (2) Consecutive byte reads (100% overhead) 353 (2) Consecutive byte reads (100% overhead)
@@ -370,9 +375,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
370 new_client->driver = &max6875_driver; 375 new_client->driver = &max6875_driver;
371 new_client->flags = 0; 376 new_client->flags = 0;
372 377
373 /* Prevent 24RF08 corruption */
374 i2c_smbus_write_quick(new_client, 0);
375
376 /* Setup the user section */ 378 /* Setup the user section */
377 data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; 379 data->blocks[max6875_eeprom_user].type = max6875_eeprom_user;
378 data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; 380 data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4fd4f52c8e9b..4a9ead277596 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -231,8 +231,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
231 if (driver->detach_adapter) 231 if (driver->detach_adapter)
232 if ((res = driver->detach_adapter(adap))) { 232 if ((res = driver->detach_adapter(adap))) {
233 dev_warn(&adap->dev, "can't detach adapter " 233 dev_warn(&adap->dev, "can't detach adapter "
234 "while detaching driver %s: driver not " 234 "while detaching driver %s: driver "
235 "detached!", driver->name); 235 "not detached!\n", driver->name);
236 goto out_unlock; 236 goto out_unlock;
237 } 237 }
238 } 238 }
@@ -456,8 +456,8 @@ int i2c_detach_client(struct i2c_client *client)
456 res = adapter->client_unregister(client); 456 res = adapter->client_unregister(client);
457 if (res) { 457 if (res) {
458 dev_err(&client->dev, 458 dev_err(&client->dev,
459 "client_unregister [%s] failed, " 459 "client_unregister [%s] failed, "
460 "client not detached", client->name); 460 "client not detached\n", client->name);
461 goto out; 461 goto out;
462 } 462 }
463 } 463 }
diff --git a/drivers/ide/cris/Makefile b/drivers/ide/cris/Makefile
index fdc294325d00..6176e8d6b2e6 100644
--- a/drivers/ide/cris/Makefile
+++ b/drivers/ide/cris/Makefile
@@ -1,3 +1,3 @@
1EXTRA_CFLAGS += -Idrivers/ide 1EXTRA_CFLAGS += -Idrivers/ide
2 2
3obj-$(CONFIG_ETRAX_ARCH_V10) += ide-v10.o 3obj-y += ide-cris.o
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
new file mode 100644
index 000000000000..cd15e6260510
--- /dev/null
+++ b/drivers/ide/cris/ide-cris.c
@@ -0,0 +1,1107 @@
1/* $Id: cris-ide-driver.patch,v 1.1 2005/06/29 21:39:07 akpm Exp $
2 *
3 * Etrax specific IDE functions, like init and PIO-mode setting etc.
4 * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
5 * Copyright (c) 2000-2005 Axis Communications AB
6 *
7 * Authors: Bjorn Wesen (initial version)
8 * Mikael Starvik (crisv32 port)
9 */
10
11/* Regarding DMA:
12 *
13 * There are two forms of DMA - "DMA handshaking" between the interface and the drive,
14 * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's
15 * something built-in in the Etrax. However only some drives support the DMA-mode handshaking
16 * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the
17 * device can't do DMA handshaking for some stupid reason. We don't need to do that.
18 */
19
20#undef REALLY_SLOW_IO /* most systems can safely undef this */
21
22#include <linux/config.h>
23#include <linux/types.h>
24#include <linux/kernel.h>
25#include <linux/timer.h>
26#include <linux/mm.h>
27#include <linux/interrupt.h>
28#include <linux/delay.h>
29#include <linux/blkdev.h>
30#include <linux/hdreg.h>
31#include <linux/ide.h>
32#include <linux/init.h>
33
34#include <asm/io.h>
35#include <asm/dma.h>
36
37/* number of DMA descriptors */
38#define MAX_DMA_DESCRS 64
39
40/* number of times to retry busy-flags when reading/writing IDE-registers
41 * this can't be too high because a hung harddisk might cause the watchdog
42 * to trigger (sometimes INB and OUTB are called with irq's disabled)
43 */
44
45#define IDE_REGISTER_TIMEOUT 300
46
47#define LOWDB(x)
48#define D(x)
49
50enum /* Transfer types */
51{
52 TYPE_PIO,
53 TYPE_DMA,
54 TYPE_UDMA
55};
56
57/* CRISv32 specifics */
58#ifdef CONFIG_ETRAX_ARCH_V32
59#include <asm/arch/hwregs/ata_defs.h>
60#include <asm/arch/hwregs/dma_defs.h>
61#include <asm/arch/hwregs/dma.h>
62#include <asm/arch/pinmux.h>
63
64#define ATA_UDMA2_CYC 2
65#define ATA_UDMA2_DVS 3
66#define ATA_UDMA1_CYC 2
67#define ATA_UDMA1_DVS 4
68#define ATA_UDMA0_CYC 4
69#define ATA_UDMA0_DVS 6
70#define ATA_DMA2_STROBE 7
71#define ATA_DMA2_HOLD 1
72#define ATA_DMA1_STROBE 8
73#define ATA_DMA1_HOLD 3
74#define ATA_DMA0_STROBE 25
75#define ATA_DMA0_HOLD 19
76#define ATA_PIO4_SETUP 3
77#define ATA_PIO4_STROBE 7
78#define ATA_PIO4_HOLD 1
79#define ATA_PIO3_SETUP 3
80#define ATA_PIO3_STROBE 9
81#define ATA_PIO3_HOLD 3
82#define ATA_PIO2_SETUP 3
83#define ATA_PIO2_STROBE 13
84#define ATA_PIO2_HOLD 5
85#define ATA_PIO1_SETUP 5
86#define ATA_PIO1_STROBE 23
87#define ATA_PIO1_HOLD 9
88#define ATA_PIO0_SETUP 9
89#define ATA_PIO0_STROBE 39
90#define ATA_PIO0_HOLD 9
91
92int
93cris_ide_ack_intr(ide_hwif_t* hwif)
94{
95 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2,
96 int, hwif->io_ports[0]);
97 REG_WR_INT(ata, regi_ata, rw_ack_intr, 1 << ctrl2.sel);
98 return 1;
99}
100
101static inline int
102cris_ide_busy(void)
103{
104 reg_ata_rs_stat_data stat_data;
105 stat_data = REG_RD(ata, regi_ata, rs_stat_data);
106 return stat_data.busy;
107}
108
109static inline int
110cris_ide_ready(void)
111{
112 return !cris_ide_busy();
113}
114
115static inline int
116cris_ide_data_available(unsigned short* data)
117{
118 reg_ata_rs_stat_data stat_data;
119 stat_data = REG_RD(ata, regi_ata, rs_stat_data);
120 *data = stat_data.data;
121 return stat_data.dav;
122}
123
124static void
125cris_ide_write_command(unsigned long command)
126{
127 REG_WR_INT(ata, regi_ata, rw_ctrl2, command); /* write data to the drive's register */
128}
129
130static void
131cris_ide_set_speed(int type, int setup, int strobe, int hold)
132{
133 reg_ata_rw_ctrl0 ctrl0 = REG_RD(ata, regi_ata, rw_ctrl0);
134 reg_ata_rw_ctrl1 ctrl1 = REG_RD(ata, regi_ata, rw_ctrl1);
135
136 if (type == TYPE_PIO) {
137 ctrl0.pio_setup = setup;
138 ctrl0.pio_strb = strobe;
139 ctrl0.pio_hold = hold;
140 } else if (type == TYPE_DMA) {
141 ctrl0.dma_strb = strobe;
142 ctrl0.dma_hold = hold;
143 } else if (type == TYPE_UDMA) {
144 ctrl1.udma_tcyc = setup;
145 ctrl1.udma_tdvs = strobe;
146 }
147 REG_WR(ata, regi_ata, rw_ctrl0, ctrl0);
148 REG_WR(ata, regi_ata, rw_ctrl1, ctrl1);
149}
150
151static unsigned long
152cris_ide_base_address(int bus)
153{
154 reg_ata_rw_ctrl2 ctrl2 = {0};
155 ctrl2.sel = bus;
156 return REG_TYPE_CONV(int, reg_ata_rw_ctrl2, ctrl2);
157}
158
159static unsigned long
160cris_ide_reg_addr(unsigned long addr, int cs0, int cs1)
161{
162 reg_ata_rw_ctrl2 ctrl2 = {0};
163 ctrl2.addr = addr;
164 ctrl2.cs1 = cs1;
165 ctrl2.cs0 = cs0;
166 return REG_TYPE_CONV(int, reg_ata_rw_ctrl2, ctrl2);
167}
168
169static __init void
170cris_ide_reset(unsigned val)
171{
172 reg_ata_rw_ctrl0 ctrl0 = {0};
173 ctrl0.rst = val ? regk_ata_active : regk_ata_inactive;
174 REG_WR(ata, regi_ata, rw_ctrl0, ctrl0);
175}
176
177static __init void
178cris_ide_init(void)
179{
180 reg_ata_rw_ctrl0 ctrl0 = {0};
181 reg_ata_rw_intr_mask intr_mask = {0};
182
183 ctrl0.en = regk_ata_yes;
184 REG_WR(ata, regi_ata, rw_ctrl0, ctrl0);
185
186 intr_mask.bus0 = regk_ata_yes;
187 intr_mask.bus1 = regk_ata_yes;
188 intr_mask.bus2 = regk_ata_yes;
189 intr_mask.bus3 = regk_ata_yes;
190
191 REG_WR(ata, regi_ata, rw_intr_mask, intr_mask);
192
193 crisv32_request_dma(2, "ETRAX FS built-in ATA", DMA_VERBOSE_ON_ERROR, 0, dma_ata);
194 crisv32_request_dma(3, "ETRAX FS built-in ATA", DMA_VERBOSE_ON_ERROR, 0, dma_ata);
195
196 crisv32_pinmux_alloc_fixed(pinmux_ata);
197 crisv32_pinmux_alloc_fixed(pinmux_ata0);
198 crisv32_pinmux_alloc_fixed(pinmux_ata1);
199 crisv32_pinmux_alloc_fixed(pinmux_ata2);
200 crisv32_pinmux_alloc_fixed(pinmux_ata3);
201
202 DMA_RESET(regi_dma2);
203 DMA_ENABLE(regi_dma2);
204 DMA_RESET(regi_dma3);
205 DMA_ENABLE(regi_dma3);
206
207 DMA_WR_CMD (regi_dma2, regk_dma_set_w_size2);
208 DMA_WR_CMD (regi_dma3, regk_dma_set_w_size2);
209}
210
211static dma_descr_context mycontext __attribute__ ((__aligned__(32)));
212
213#define cris_dma_descr_type dma_descr_data
214#define cris_pio_read regk_ata_rd
215#define cris_ultra_mask 0x7
216#define MAX_DESCR_SIZE 0xffffffffUL
217
218static unsigned long
219cris_ide_get_reg(unsigned long reg)
220{
221 return (reg & 0x0e000000) >> 25;
222}
223
224static void
225cris_ide_fill_descriptor(cris_dma_descr_type *d, void* buf, unsigned int len, int last)
226{
227 d->buf = (char*)virt_to_phys(buf);
228 d->after = d->buf + len;
229 d->eol = last;
230}
231
232static void
233cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir,int type,int len)
234{
235 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, IDE_DATA_REG);
236 reg_ata_rw_trf_cnt trf_cnt = {0};
237
238 mycontext.saved_data = (dma_descr_data*)virt_to_phys(d);
239 mycontext.saved_data_buf = d->buf;
240 /* start the dma channel */
241 DMA_START_CONTEXT(dir ? regi_dma3 : regi_dma2, virt_to_phys(&mycontext));
242
243 /* initiate a multi word dma read using PIO handshaking */
244 trf_cnt.cnt = len >> 1;
245 /* Due to a "feature" the transfer count has to be one extra word for UDMA. */
246 if (type == TYPE_UDMA)
247 trf_cnt.cnt++;
248 REG_WR(ata, regi_ata, rw_trf_cnt, trf_cnt);
249
250 ctrl2.rw = dir ? regk_ata_rd : regk_ata_wr;
251 ctrl2.trf_mode = regk_ata_dma;
252 ctrl2.hsh = type == TYPE_PIO ? regk_ata_pio :
253 type == TYPE_DMA ? regk_ata_dma : regk_ata_udma;
254 ctrl2.multi = regk_ata_yes;
255 ctrl2.dma_size = regk_ata_word;
256 REG_WR(ata, regi_ata, rw_ctrl2, ctrl2);
257}
258
259static void
260cris_ide_wait_dma(int dir)
261{
262 reg_dma_rw_stat status;
263 do
264 {
265 status = REG_RD(dma, dir ? regi_dma3 : regi_dma2, rw_stat);
266 } while(status.list_state != regk_dma_data_at_eol);
267}
268
269static int cris_dma_test_irq(ide_drive_t *drive)
270{
271 int intr = REG_RD_INT(ata, regi_ata, r_intr);
272 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, IDE_DATA_REG);
273 return intr & (1 << ctrl2.sel) ? 1 : 0;
274}
275
276static void cris_ide_initialize_dma(int dir)
277{
278}
279
280#else
281/* CRISv10 specifics */
282#include <asm/arch/svinto.h>
283#include <asm/arch/io_interface_mux.h>
284
285/* PIO timing (in R_ATA_CONFIG)
286 *
287 * _____________________________
288 * ADDRESS : ________/
289 *
290 * _______________
291 * DIOR : ____________/ \__________
292 *
293 * _______________
294 * DATA : XXXXXXXXXXXXXXXX_______________XXXXXXXX
295 *
296 *
297 * DIOR is unbuffered while address and data is buffered.
298 * This creates two problems:
299 * 1. The DIOR pulse is to early (because it is unbuffered)
300 * 2. The rise time of DIOR is long
301 *
302 * There are at least three different plausible solutions
303 * 1. Use a pad capable of larger currents in Etrax
304 * 2. Use an external buffer
305 * 3. Make the strobe pulse longer
306 *
307 * Some of the strobe timings below are modified to compensate
308 * for this. This implies a slight performance decrease.
309 *
310 * THIS SHOULD NEVER BE CHANGED!
311 *
312 * TODO: Is this true for the latest LX boards still ?
313 */
314
315#define ATA_UDMA2_CYC 0 /* No UDMA supported, just to make it compile. */
316#define ATA_UDMA2_DVS 0
317#define ATA_UDMA1_CYC 0
318#define ATA_UDMA1_DVS 0
319#define ATA_UDMA0_CYC 0
320#define ATA_UDMA0_DVS 0
321#define ATA_DMA2_STROBE 4
322#define ATA_DMA2_HOLD 0
323#define ATA_DMA1_STROBE 4
324#define ATA_DMA1_HOLD 1
325#define ATA_DMA0_STROBE 12
326#define ATA_DMA0_HOLD 9
327#define ATA_PIO4_SETUP 1
328#define ATA_PIO4_STROBE 5
329#define ATA_PIO4_HOLD 0
330#define ATA_PIO3_SETUP 1
331#define ATA_PIO3_STROBE 5
332#define ATA_PIO3_HOLD 1
333#define ATA_PIO2_SETUP 1
334#define ATA_PIO2_STROBE 6
335#define ATA_PIO2_HOLD 2
336#define ATA_PIO1_SETUP 2
337#define ATA_PIO1_STROBE 11
338#define ATA_PIO1_HOLD 4
339#define ATA_PIO0_SETUP 4
340#define ATA_PIO0_STROBE 19
341#define ATA_PIO0_HOLD 4
342
343int
344cris_ide_ack_intr(ide_hwif_t* hwif)
345{
346 return 1;
347}
348
349static inline int
350cris_ide_busy(void)
351{
352 return *R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy) ;
353}
354
355static inline int
356cris_ide_ready(void)
357{
358 return *R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy) ;
359}
360
361static inline int
362cris_ide_data_available(unsigned short* data)
363{
364 unsigned long status = *R_ATA_STATUS_DATA;
365 *data = (unsigned short)status;
366 return status & IO_MASK(R_ATA_STATUS_DATA, dav);
367}
368
369static void
370cris_ide_write_command(unsigned long command)
371{
372 *R_ATA_CTRL_DATA = command;
373}
374
375static void
376cris_ide_set_speed(int type, int setup, int strobe, int hold)
377{
378 static int pio_setup = ATA_PIO4_SETUP;
379 static int pio_strobe = ATA_PIO4_STROBE;
380 static int pio_hold = ATA_PIO4_HOLD;
381 static int dma_strobe = ATA_DMA2_STROBE;
382 static int dma_hold = ATA_DMA2_HOLD;
383
384 if (type == TYPE_PIO) {
385 pio_setup = setup;
386 pio_strobe = strobe;
387 pio_hold = hold;
388 } else if (type == TYPE_DMA) {
389 dma_strobe = strobe;
390 dma_hold = hold;
391 }
392 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
393 IO_FIELD( R_ATA_CONFIG, dma_strobe, dma_strobe ) |
394 IO_FIELD( R_ATA_CONFIG, dma_hold, dma_hold ) |
395 IO_FIELD( R_ATA_CONFIG, pio_setup, pio_setup ) |
396 IO_FIELD( R_ATA_CONFIG, pio_strobe, pio_strobe ) |
397 IO_FIELD( R_ATA_CONFIG, pio_hold, pio_hold ) );
398}
399
400static unsigned long
401cris_ide_base_address(int bus)
402{
403 return IO_FIELD(R_ATA_CTRL_DATA, sel, bus);
404}
405
406static unsigned long
407cris_ide_reg_addr(unsigned long addr, int cs0, int cs1)
408{
409 return IO_FIELD(R_ATA_CTRL_DATA, addr, addr) |
410 IO_FIELD(R_ATA_CTRL_DATA, cs0, cs0) |
411 IO_FIELD(R_ATA_CTRL_DATA, cs1, cs1);
412}
413
414static __init void
415cris_ide_reset(unsigned val)
416{
417#ifdef CONFIG_ETRAX_IDE_G27_RESET
418 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val);
419#endif
420#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
421 REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, val);
422#endif
423#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
424 REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, val);
425#endif
426#ifdef CONFIG_ETRAX_IDE_PB7_RESET
427 port_pb_dir_shadow = port_pb_dir_shadow |
428 IO_STATE(R_PORT_PB_DIR, dir7, output);
429 *R_PORT_PB_DIR = port_pb_dir_shadow;
430 REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, val);
431#endif
432}
433
434static __init void
435cris_ide_init(void)
436{
437 volatile unsigned int dummy;
438
439 *R_ATA_CTRL_DATA = 0;
440 *R_ATA_TRANSFER_CNT = 0;
441 *R_ATA_CONFIG = 0;
442
443 if (cris_request_io_interface(if_ata, "ETRAX100LX IDE")) {
444 printk(KERN_CRIT "ide: Failed to get IO interface\n");
445 return;
446 } else if (cris_request_dma(ATA_TX_DMA_NBR,
447 "ETRAX100LX IDE TX",
448 DMA_VERBOSE_ON_ERROR,
449 dma_ata)) {
450 cris_free_io_interface(if_ata);
451 printk(KERN_CRIT "ide: Failed to get Tx DMA channel\n");
452 return;
453 } else if (cris_request_dma(ATA_RX_DMA_NBR,
454 "ETRAX100LX IDE RX",
455 DMA_VERBOSE_ON_ERROR,
456 dma_ata)) {
457 cris_free_dma(ATA_TX_DMA_NBR, "ETRAX100LX IDE Tx");
458 cris_free_io_interface(if_ata);
459 printk(KERN_CRIT "ide: Failed to get Rx DMA channel\n");
460 return;
461 }
462
463 /* make a dummy read to set the ata controller in a proper state */
464 dummy = *R_ATA_STATUS_DATA;
465
466 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ));
467 *R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw, read) |
468 IO_FIELD( R_ATA_CTRL_DATA, addr, 1 ) );
469
470 while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/
471
472 *R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) |
473 IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) |
474 IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) |
475 IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) );
476
477 /* reset the dma channels we will use */
478
479 RESET_DMA(ATA_TX_DMA_NBR);
480 RESET_DMA(ATA_RX_DMA_NBR);
481 WAIT_DMA(ATA_TX_DMA_NBR);
482 WAIT_DMA(ATA_RX_DMA_NBR);
483}
484
485#define cris_dma_descr_type etrax_dma_descr
486#define cris_pio_read IO_STATE(R_ATA_CTRL_DATA, rw, read)
487#define cris_ultra_mask 0x0
488#define MAX_DESCR_SIZE 0x10000UL
489
490static unsigned long
491cris_ide_get_reg(unsigned long reg)
492{
493 return (reg & 0x0e000000) >> 25;
494}
495
496static void
497cris_ide_fill_descriptor(cris_dma_descr_type *d, void* buf, unsigned int len, int last)
498{
499 d->buf = virt_to_phys(buf);
500 d->sw_len = len == MAX_DESCR_SIZE ? 0 : len;
501 if (last)
502 d->ctrl |= d_eol;
503}
504
505static void cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir, int type, int len)
506{
507 unsigned long cmd;
508
509 if (dir) {
510 /* need to do this before RX DMA due to a chip bug
511 * it is enough to just flush the part of the cache that
512 * corresponds to the buffers we start, but since HD transfers
513 * usually are more than 8 kB, it is easier to optimize for the
514 * normal case and just flush the entire cache. its the only
515 * way to be sure! (OB movie quote)
516 */
517 flush_etrax_cache();
518 *R_DMA_CH3_FIRST = virt_to_phys(d);
519 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start);
520
521 } else {
522 *R_DMA_CH2_FIRST = virt_to_phys(d);
523 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start);
524 }
525
526 /* initiate a multi word dma read using DMA handshaking */
527
528 *R_ATA_TRANSFER_CNT =
529 IO_FIELD(R_ATA_TRANSFER_CNT, count, len >> 1);
530
531 cmd = dir ? IO_STATE(R_ATA_CTRL_DATA, rw, read) : IO_STATE(R_ATA_CTRL_DATA, rw, write);
532 cmd |= type == TYPE_PIO ? IO_STATE(R_ATA_CTRL_DATA, handsh, pio) :
533 IO_STATE(R_ATA_CTRL_DATA, handsh, dma);
534 *R_ATA_CTRL_DATA =
535 cmd |
536 IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) |
537 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
538 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
539 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
540}
541
542static void
543cris_ide_wait_dma(int dir)
544{
545 if (dir)
546 WAIT_DMA(ATA_RX_DMA_NBR);
547 else
548 WAIT_DMA(ATA_TX_DMA_NBR);
549}
550
551static int cris_dma_test_irq(ide_drive_t *drive)
552{
553 int intr = *R_IRQ_MASK0_RD;
554 int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel, IDE_DATA_REG);
555 return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0;
556}
557
558
559static void cris_ide_initialize_dma(int dir)
560{
561 if (dir)
562 {
563 RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
564 WAIT_DMA(ATA_RX_DMA_NBR);
565 }
566 else
567 {
568 RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
569 WAIT_DMA(ATA_TX_DMA_NBR);
570 }
571}
572
573#endif
574
575void
576cris_ide_outw(unsigned short data, unsigned long reg) {
577 int timeleft;
578
579 LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg));
580
581 /* note the lack of handling any timeouts. we stop waiting, but we don't
582 * really notify anybody.
583 */
584
585 timeleft = IDE_REGISTER_TIMEOUT;
586 /* wait for busy flag */
587 do {
588 timeleft--;
589 } while(timeleft && cris_ide_busy());
590
591 /*
592 * Fall through at a timeout, so the ongoing command will be
593 * aborted by the write below, which is expected to be a dummy
594 * command to the command register. This happens when a faulty
595 * drive times out on a command. See comment on timeout in
596 * INB.
597 */
598 if(!timeleft)
599 printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data);
600
601 cris_ide_write_command(reg|data); /* write data to the drive's register */
602
603 timeleft = IDE_REGISTER_TIMEOUT;
604 /* wait for transmitter ready */
605 do {
606 timeleft--;
607 } while(timeleft && !cris_ide_ready());
608}
609
610void
611cris_ide_outb(unsigned char data, unsigned long reg)
612{
613 cris_ide_outw(data, reg);
614}
615
616void
617cris_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port)
618{
619 cris_ide_outw(addr, port);
620}
621
622unsigned short
623cris_ide_inw(unsigned long reg) {
624 int timeleft;
625 unsigned short val;
626
627 timeleft = IDE_REGISTER_TIMEOUT;
628 /* wait for busy flag */
629 do {
630 timeleft--;
631 } while(timeleft && cris_ide_busy());
632
633 if(!timeleft) {
634 /*
635 * If we're asked to read the status register, like for
636 * example when a command does not complete for an
637 * extended time, but the ATA interface is stuck in a
638 * busy state at the *ETRAX* ATA interface level (as has
639 * happened repeatedly with at least one bad disk), then
640 * the best thing to do is to pretend that we read
641 * "busy" in the status register, so the IDE driver will
642 * time-out, abort the ongoing command and perform a
643 * reset sequence. Note that the subsequent OUT_BYTE
644 * call will also timeout on busy, but as long as the
645 * write is still performed, everything will be fine.
646 */
647 if (cris_ide_get_reg(reg) == IDE_STATUS_OFFSET)
648 return BUSY_STAT;
649 else
650 /* For other rare cases we assume 0 is good enough. */
651 return 0;
652 }
653
654 cris_ide_write_command(reg | cris_pio_read);
655
656 timeleft = IDE_REGISTER_TIMEOUT;
657 /* wait for available */
658 do {
659 timeleft--;
660 } while(timeleft && !cris_ide_data_available(&val));
661
662 if(!timeleft)
663 return 0;
664
665 LOWDB(printk("inb: 0x%x from reg 0x%x\n", val & 0xff, reg));
666
667 return val;
668}
669
670unsigned char
671cris_ide_inb(unsigned long reg)
672{
673 return (unsigned char)cris_ide_inw(reg);
674}
675
676static int cris_dma_check (ide_drive_t *drive);
677static int cris_dma_end (ide_drive_t *drive);
678static int cris_dma_setup (ide_drive_t *drive);
679static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command);
680static int cris_dma_test_irq(ide_drive_t *drive);
681static void cris_dma_start(ide_drive_t *drive);
682static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int);
683static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int);
684static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
685static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
686static int cris_dma_off (ide_drive_t *drive);
687static int cris_dma_on (ide_drive_t *drive);
688
689static void tune_cris_ide(ide_drive_t *drive, u8 pio)
690{
691 int setup, strobe, hold;
692
693 switch(pio)
694 {
695 case 0:
696 setup = ATA_PIO0_SETUP;
697 strobe = ATA_PIO0_STROBE;
698 hold = ATA_PIO0_HOLD;
699 break;
700 case 1:
701 setup = ATA_PIO1_SETUP;
702 strobe = ATA_PIO1_STROBE;
703 hold = ATA_PIO1_HOLD;
704 break;
705 case 2:
706 setup = ATA_PIO2_SETUP;
707 strobe = ATA_PIO2_STROBE;
708 hold = ATA_PIO2_HOLD;
709 break;
710 case 3:
711 setup = ATA_PIO3_SETUP;
712 strobe = ATA_PIO3_STROBE;
713 hold = ATA_PIO3_HOLD;
714 break;
715 case 4:
716 setup = ATA_PIO4_SETUP;
717 strobe = ATA_PIO4_STROBE;
718 hold = ATA_PIO4_HOLD;
719 break;
720 default:
721 return;
722 }
723
724 cris_ide_set_speed(TYPE_PIO, setup, strobe, hold);
725}
726
727static int speed_cris_ide(ide_drive_t *drive, u8 speed)
728{
729 int cyc = 0, dvs = 0, strobe = 0, hold = 0;
730
731 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
732 tune_cris_ide(drive, speed - XFER_PIO_0);
733 return 0;
734 }
735
736 switch(speed)
737 {
738 case XFER_UDMA_0:
739 cyc = ATA_UDMA0_CYC;
740 dvs = ATA_UDMA0_DVS;
741 break;
742 case XFER_UDMA_1:
743 cyc = ATA_UDMA1_CYC;
744 dvs = ATA_UDMA1_DVS;
745 break;
746 case XFER_UDMA_2:
747 cyc = ATA_UDMA2_CYC;
748 dvs = ATA_UDMA2_DVS;
749 break;
750 case XFER_MW_DMA_0:
751 strobe = ATA_DMA0_STROBE;
752 hold = ATA_DMA0_HOLD;
753 break;
754 case XFER_MW_DMA_1:
755 strobe = ATA_DMA1_STROBE;
756 hold = ATA_DMA1_HOLD;
757 break;
758 case XFER_MW_DMA_2:
759 strobe = ATA_DMA2_STROBE;
760 hold = ATA_DMA2_HOLD;
761 break;
762 default:
763 return 0;
764 }
765
766 if (speed >= XFER_UDMA_0)
767 cris_ide_set_speed(TYPE_UDMA, cyc, dvs, 0);
768 else
769 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
770
771 return 0;
772}
773
774void __init
775init_e100_ide (void)
776{
777 hw_regs_t hw;
778 int ide_offsets[IDE_NR_PORTS];
779 int h;
780 int i;
781
782 printk("ide: ETRAX FS built-in ATA DMA controller\n");
783
784 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
785 ide_offsets[i] = cris_ide_reg_addr(i, 0, 1);
786
787 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
788 ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0);
789
790 /* first fill in some stuff in the ide_hwifs fields */
791
792 for(h = 0; h < MAX_HWIFS; h++) {
793 ide_hwif_t *hwif = &ide_hwifs[h];
794 ide_setup_ports(&hw, cris_ide_base_address(h),
795 ide_offsets,
796 0, 0, cris_ide_ack_intr,
797 ide_default_irq(0));
798 ide_register_hw(&hw, &hwif);
799 hwif->mmio = 2;
800 hwif->chipset = ide_etrax100;
801 hwif->tuneproc = &tune_cris_ide;
802 hwif->speedproc = &speed_cris_ide;
803 hwif->ata_input_data = &cris_ide_input_data;
804 hwif->ata_output_data = &cris_ide_output_data;
805 hwif->atapi_input_bytes = &cris_atapi_input_bytes;
806 hwif->atapi_output_bytes = &cris_atapi_output_bytes;
807 hwif->ide_dma_check = &cris_dma_check;
808 hwif->ide_dma_end = &cris_dma_end;
809 hwif->dma_setup = &cris_dma_setup;
810 hwif->dma_exec_cmd = &cris_dma_exec_cmd;
811 hwif->ide_dma_test_irq = &cris_dma_test_irq;
812 hwif->dma_start = &cris_dma_start;
813 hwif->OUTB = &cris_ide_outb;
814 hwif->OUTW = &cris_ide_outw;
815 hwif->OUTBSYNC = &cris_ide_outbsync;
816 hwif->INB = &cris_ide_inb;
817 hwif->INW = &cris_ide_inw;
818 hwif->ide_dma_host_off = &cris_dma_off;
819 hwif->ide_dma_host_on = &cris_dma_on;
820 hwif->ide_dma_off_quietly = &cris_dma_off;
821 hwif->udma_four = 0;
822 hwif->ultra_mask = cris_ultra_mask;
823 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
824 hwif->swdma_mask = 0x07; /* Singleword DMA 0-2 */
825 }
826
827 /* Reset pulse */
828 cris_ide_reset(0);
829 udelay(25);
830 cris_ide_reset(1);
831
832 cris_ide_init();
833
834 cris_ide_set_speed(TYPE_PIO, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_PIO4_HOLD);
835 cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD);
836 cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
837}
838
839static int cris_dma_off (ide_drive_t *drive)
840{
841 return 0;
842}
843
844static int cris_dma_on (ide_drive_t *drive)
845{
846 return 0;
847}
848
849
850static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
851
852/*
853 * The following routines are mainly used by the ATAPI drivers.
854 *
855 * These routines will round up any request for an odd number of bytes,
856 * so if an odd bytecount is specified, be sure that there's at least one
857 * extra byte allocated for the buffer.
858 */
859static void
860cris_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
861{
862 D(printk("atapi_input_bytes, buffer 0x%x, count %d\n",
863 buffer, bytecount));
864
865 if(bytecount & 1) {
866 printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
867 bytecount++; /* to round off */
868 }
869
870 /* setup DMA and start transfer */
871
872 cris_ide_fill_descriptor(&mydescr, buffer, bytecount, 1);
873 cris_ide_start_dma(drive, &mydescr, 1, TYPE_PIO, bytecount);
874
875 /* wait for completion */
876 LED_DISK_READ(1);
877 cris_ide_wait_dma(1);
878 LED_DISK_READ(0);
879}
880
881static void
882cris_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
883{
884 D(printk("atapi_output_bytes, buffer 0x%x, count %d\n",
885 buffer, bytecount));
886
887 if(bytecount & 1) {
888 printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
889 bytecount++;
890 }
891
892 cris_ide_fill_descriptor(&mydescr, buffer, bytecount, 1);
893 cris_ide_start_dma(drive, &mydescr, 0, TYPE_PIO, bytecount);
894
895 /* wait for completion */
896
897 LED_DISK_WRITE(1);
898 LED_DISK_READ(1);
899 cris_ide_wait_dma(0);
900 LED_DISK_WRITE(0);
901}
902
903/*
904 * This is used for most PIO data transfers *from* the IDE interface
905 */
906static void
907cris_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
908{
909 cris_atapi_input_bytes(drive, buffer, wcount << 2);
910}
911
912/*
913 * This is used for most PIO data transfers *to* the IDE interface
914 */
915static void
916cris_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
917{
918 cris_atapi_output_bytes(drive, buffer, wcount << 2);
919}
920
921/* we only have one DMA channel on the chip for ATA, so we can keep these statically */
922static cris_dma_descr_type ata_descrs[MAX_DMA_DESCRS] __attribute__ ((__aligned__(16)));
923static unsigned int ata_tot_size;
924
925/*
926 * cris_ide_build_dmatable() prepares a dma request.
927 * Returns 0 if all went okay, returns 1 otherwise.
928 */
929static int cris_ide_build_dmatable (ide_drive_t *drive)
930{
931 ide_hwif_t *hwif = drive->hwif;
932 struct scatterlist* sg;
933 struct request *rq = drive->hwif->hwgroup->rq;
934 unsigned long size, addr;
935 unsigned int count = 0;
936 int i = 0;
937
938 sg = hwif->sg_table;
939
940 ata_tot_size = 0;
941
942 ide_map_sg(drive, rq);
943 i = hwif->sg_nents;
944
945 while(i) {
946 /*
947 * Determine addr and size of next buffer area. We assume that
948 * individual virtual buffers are always composed linearly in
949 * physical memory. For example, we assume that any 8kB buffer
950 * is always composed of two adjacent physical 4kB pages rather
951 * than two possibly non-adjacent physical 4kB pages.
952 */
953 /* group sequential buffers into one large buffer */
954 addr = page_to_phys(sg->page) + sg->offset;
955 size = sg_dma_len(sg);
956 while (sg++, --i) {
957 if ((addr + size) != page_to_phys(sg->page) + sg->offset)
958 break;
959 size += sg_dma_len(sg);
960 }
961
962 /* did we run out of descriptors? */
963
964 if(count >= MAX_DMA_DESCRS) {
965 printk("%s: too few DMA descriptors\n", drive->name);
966 return 1;
967 }
968
969 /* however, this case is more difficult - rw_trf_cnt cannot be more
970 than 65536 words per transfer, so in that case we need to either
971 1) use a DMA interrupt to re-trigger rw_trf_cnt and continue with
972 the descriptors, or
973 2) simply do the request here, and get dma_intr to only ide_end_request on
974 those blocks that were actually set-up for transfer.
975 */
976
977 if(ata_tot_size + size > 131072) {
978 printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size);
979 return 1;
980 }
981
982 /* If size > MAX_DESCR_SIZE it has to be splitted into new descriptors. Since we
983 don't handle size > 131072 only one split is necessary */
984
985 if(size > MAX_DESCR_SIZE) {
986 cris_ide_fill_descriptor(&ata_descrs[count], (void*)addr, MAX_DESCR_SIZE, 0);
987 count++;
988 ata_tot_size += MAX_DESCR_SIZE;
989 size -= MAX_DESCR_SIZE;
990 addr += MAX_DESCR_SIZE;
991 }
992
993 cris_ide_fill_descriptor(&ata_descrs[count], (void*)addr, size,i ? 0 : 1);
994 count++;
995 ata_tot_size += size;
996 }
997
998 if (count) {
999 /* return and say all is ok */
1000 return 0;
1001 }
1002
1003 printk("%s: empty DMA table?\n", drive->name);
1004 return 1; /* let the PIO routines handle this weirdness */
1005}
1006
1007static int cris_config_drive_for_dma (ide_drive_t *drive)
1008{
1009 u8 speed = ide_dma_speed(drive, 1);
1010
1011 if (!speed)
1012 return 0;
1013
1014 speed_cris_ide(drive, speed);
1015 ide_config_drive_speed(drive, speed);
1016
1017 return ide_dma_enable(drive);
1018}
1019
1020/*
1021 * cris_dma_intr() is the handler for disk read/write DMA interrupts
1022 */
1023static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
1024{
1025 LED_DISK_READ(0);
1026 LED_DISK_WRITE(0);
1027
1028 return ide_dma_intr(drive);
1029}
1030
1031/*
1032 * Functions below initiates/aborts DMA read/write operations on a drive.
1033 *
1034 * The caller is assumed to have selected the drive and programmed the drive's
1035 * sector address using CHS or LBA. All that remains is to prepare for DMA
1036 * and then issue the actual read/write DMA/PIO command to the drive.
1037 *
1038 * For ATAPI devices, we just prepare for DMA and return. The caller should
1039 * then issue the packet command to the drive and call us again with
1040 * cris_dma_start afterwards.
1041 *
1042 * Returns 0 if all went well.
1043 * Returns 1 if DMA read/write could not be started, in which case
1044 * the caller should revert to PIO for the current request.
1045 */
1046
1047static int cris_dma_check(ide_drive_t *drive)
1048{
1049 ide_hwif_t *hwif = drive->hwif;
1050 struct hd_driveid* id = drive->id;
1051
1052 if (id && (id->capability & 1)) {
1053 if (ide_use_dma(drive)) {
1054 if (cris_config_drive_for_dma(drive))
1055 return hwif->ide_dma_on(drive);
1056 }
1057 }
1058
1059 return hwif->ide_dma_off_quietly(drive);
1060}
1061
1062static int cris_dma_end(ide_drive_t *drive)
1063{
1064 drive->waiting_for_dma = 0;
1065 return 0;
1066}
1067
1068static int cris_dma_setup(ide_drive_t *drive)
1069{
1070 struct request *rq = drive->hwif->hwgroup->rq;
1071
1072 cris_ide_initialize_dma(!rq_data_dir(rq));
1073 if (cris_ide_build_dmatable (drive)) {
1074 ide_map_sg(drive, rq);
1075 return 1;
1076 }
1077
1078 drive->waiting_for_dma = 1;
1079 return 0;
1080}
1081
1082static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command)
1083{
1084 /* set the irq handler which will finish the request when DMA is done */
1085 ide_set_handler(drive, &cris_dma_intr, WAIT_CMD, NULL);
1086
1087 /* issue cmd to drive */
1088 cris_ide_outb(command, IDE_COMMAND_REG);
1089}
1090
1091static void cris_dma_start(ide_drive_t *drive)
1092{
1093 struct request *rq = drive->hwif->hwgroup->rq;
1094 int writing = rq_data_dir(rq);
1095 int type = TYPE_DMA;
1096
1097 if (drive->current_speed >= XFER_UDMA_0)
1098 type = TYPE_UDMA;
1099
1100 cris_ide_start_dma(drive, &ata_descrs[0], writing ? 0 : 1, type, ata_tot_size);
1101
1102 if (writing) {
1103 LED_DISK_WRITE(1);
1104 } else {
1105 LED_DISK_READ(1);
1106 }
1107}
diff --git a/drivers/ide/cris/ide-v10.c b/drivers/ide/cris/ide-v10.c
deleted file mode 100644
index 5b40220d3ddc..000000000000
--- a/drivers/ide/cris/ide-v10.c
+++ /dev/null
@@ -1,842 +0,0 @@
1/* $Id: ide.c,v 1.4 2004/10/12 07:55:48 starvik Exp $
2 *
3 * Etrax specific IDE functions, like init and PIO-mode setting etc.
4 * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
5 * Copyright (c) 2000-2004 Axis Communications AB
6 *
7 * Authors: Bjorn Wesen (initial version)
8 * Mikael Starvik (pio setup stuff, Linux 2.6 port)
9 */
10
11/* Regarding DMA:
12 *
13 * There are two forms of DMA - "DMA handshaking" between the interface and the drive,
14 * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's
15 * something built-in in the Etrax. However only some drives support the DMA-mode handshaking
16 * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the
17 * device can't do DMA handshaking for some stupid reason. We don't need to do that.
18 */
19
20#undef REALLY_SLOW_IO /* most systems can safely undef this */
21
22#include <linux/config.h>
23#include <linux/types.h>
24#include <linux/kernel.h>
25#include <linux/timer.h>
26#include <linux/mm.h>
27#include <linux/interrupt.h>
28#include <linux/delay.h>
29#include <linux/blkdev.h>
30#include <linux/hdreg.h>
31#include <linux/ide.h>
32#include <linux/init.h>
33#include <linux/scatterlist.h>
34
35#include <asm/io.h>
36#include <asm/arch/svinto.h>
37#include <asm/dma.h>
38
39/* number of Etrax DMA descriptors */
40#define MAX_DMA_DESCRS 64
41
42/* number of times to retry busy-flags when reading/writing IDE-registers
43 * this can't be too high because a hung harddisk might cause the watchdog
44 * to trigger (sometimes INB and OUTB are called with irq's disabled)
45 */
46
47#define IDE_REGISTER_TIMEOUT 300
48
49static int e100_read_command = 0;
50
51#define LOWDB(x)
52#define D(x)
53
54static int e100_ide_build_dmatable (ide_drive_t *drive);
55static ide_startstop_t etrax_dma_intr (ide_drive_t *drive);
56
57void
58etrax100_ide_outw(unsigned short data, unsigned long reg) {
59 int timeleft;
60 LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg));
61
62 /* note the lack of handling any timeouts. we stop waiting, but we don't
63 * really notify anybody.
64 */
65
66 timeleft = IDE_REGISTER_TIMEOUT;
67 /* wait for busy flag */
68 while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
69 timeleft--;
70
71 /*
72 * Fall through at a timeout, so the ongoing command will be
73 * aborted by the write below, which is expected to be a dummy
74 * command to the command register. This happens when a faulty
75 * drive times out on a command. See comment on timeout in
76 * INB.
77 */
78 if(!timeleft)
79 printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data);
80
81 *R_ATA_CTRL_DATA = reg | data; /* write data to the drive's register */
82
83 timeleft = IDE_REGISTER_TIMEOUT;
84 /* wait for transmitter ready */
85 while(timeleft && !(*R_ATA_STATUS_DATA &
86 IO_MASK(R_ATA_STATUS_DATA, tr_rdy)))
87 timeleft--;
88}
89
90void
91etrax100_ide_outb(unsigned char data, unsigned long reg)
92{
93 etrax100_ide_outw(data, reg);
94}
95
96void
97etrax100_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port)
98{
99 etrax100_ide_outw(addr, port);
100}
101
102unsigned short
103etrax100_ide_inw(unsigned long reg) {
104 int status;
105 int timeleft;
106
107 timeleft = IDE_REGISTER_TIMEOUT;
108 /* wait for busy flag */
109 while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
110 timeleft--;
111
112 if(!timeleft) {
113 /*
114 * If we're asked to read the status register, like for
115 * example when a command does not complete for an
116 * extended time, but the ATA interface is stuck in a
117 * busy state at the *ETRAX* ATA interface level (as has
118 * happened repeatedly with at least one bad disk), then
119 * the best thing to do is to pretend that we read
120 * "busy" in the status register, so the IDE driver will
121 * time-out, abort the ongoing command and perform a
122 * reset sequence. Note that the subsequent OUT_BYTE
123 * call will also timeout on busy, but as long as the
124 * write is still performed, everything will be fine.
125 */
126 if ((reg & IO_MASK (R_ATA_CTRL_DATA, addr))
127 == IO_FIELD (R_ATA_CTRL_DATA, addr, IDE_STATUS_OFFSET))
128 return BUSY_STAT;
129 else
130 /* For other rare cases we assume 0 is good enough. */
131 return 0;
132 }
133
134 *R_ATA_CTRL_DATA = reg | IO_STATE(R_ATA_CTRL_DATA, rw, read); /* read data */
135
136 timeleft = IDE_REGISTER_TIMEOUT;
137 /* wait for available */
138 while(timeleft && !((status = *R_ATA_STATUS_DATA) &
139 IO_MASK(R_ATA_STATUS_DATA, dav)))
140 timeleft--;
141
142 if(!timeleft)
143 return 0;
144
145 LOWDB(printk("inb: 0x%x from reg 0x%x\n", status & 0xff, reg));
146
147 return (unsigned short)status;
148}
149
150unsigned char
151etrax100_ide_inb(unsigned long reg)
152{
153 return (unsigned char)etrax100_ide_inw(reg);
154}
155
156/* PIO timing (in R_ATA_CONFIG)
157 *
158 * _____________________________
159 * ADDRESS : ________/
160 *
161 * _______________
162 * DIOR : ____________/ \__________
163 *
164 * _______________
165 * DATA : XXXXXXXXXXXXXXXX_______________XXXXXXXX
166 *
167 *
168 * DIOR is unbuffered while address and data is buffered.
169 * This creates two problems:
170 * 1. The DIOR pulse is to early (because it is unbuffered)
171 * 2. The rise time of DIOR is long
172 *
173 * There are at least three different plausible solutions
174 * 1. Use a pad capable of larger currents in Etrax
175 * 2. Use an external buffer
176 * 3. Make the strobe pulse longer
177 *
178 * Some of the strobe timings below are modified to compensate
179 * for this. This implies a slight performance decrease.
180 *
181 * THIS SHOULD NEVER BE CHANGED!
182 *
183 * TODO: Is this true for the latest LX boards still ?
184 */
185
186#define ATA_DMA2_STROBE 4
187#define ATA_DMA2_HOLD 0
188#define ATA_DMA1_STROBE 4
189#define ATA_DMA1_HOLD 1
190#define ATA_DMA0_STROBE 12
191#define ATA_DMA0_HOLD 9
192#define ATA_PIO4_SETUP 1
193#define ATA_PIO4_STROBE 5
194#define ATA_PIO4_HOLD 0
195#define ATA_PIO3_SETUP 1
196#define ATA_PIO3_STROBE 5
197#define ATA_PIO3_HOLD 1
198#define ATA_PIO2_SETUP 1
199#define ATA_PIO2_STROBE 6
200#define ATA_PIO2_HOLD 2
201#define ATA_PIO1_SETUP 2
202#define ATA_PIO1_STROBE 11
203#define ATA_PIO1_HOLD 4
204#define ATA_PIO0_SETUP 4
205#define ATA_PIO0_STROBE 19
206#define ATA_PIO0_HOLD 4
207
208static int e100_dma_check (ide_drive_t *drive);
209static void e100_dma_start(ide_drive_t *drive);
210static int e100_dma_end (ide_drive_t *drive);
211static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int);
212static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int);
213static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
214static void e100_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
215static int e100_dma_off (ide_drive_t *drive);
216
217
218/*
219 * good_dma_drives() lists the model names (from "hdparm -i")
220 * of drives which do not support mword2 DMA but which are
221 * known to work fine with this interface under Linux.
222 */
223
224const char *good_dma_drives[] = {"Micropolis 2112A",
225 "CONNER CTMA 4000",
226 "CONNER CTT8000-A",
227 NULL};
228
229static void tune_e100_ide(ide_drive_t *drive, byte pio)
230{
231 pio = 4;
232 /* pio = ide_get_best_pio_mode(drive, pio, 4, NULL); */
233
234 /* set pio mode! */
235
236 switch(pio) {
237 case 0:
238 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
239 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
240 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
241 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO0_SETUP ) |
242 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO0_STROBE ) |
243 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO0_HOLD ) );
244 break;
245 case 1:
246 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
247 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
248 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
249 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO1_SETUP ) |
250 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO1_STROBE ) |
251 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO1_HOLD ) );
252 break;
253 case 2:
254 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
255 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
256 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
257 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO2_SETUP ) |
258 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO2_STROBE ) |
259 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO2_HOLD ) );
260 break;
261 case 3:
262 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
263 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
264 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
265 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO3_SETUP ) |
266 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO3_STROBE ) |
267 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO3_HOLD ) );
268 break;
269 case 4:
270 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
271 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
272 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
273 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO4_SETUP ) |
274 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
275 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO4_HOLD ) );
276 break;
277 }
278}
279
280static int e100_dma_setup(ide_drive_t *drive)
281{
282 struct request *rq = drive->hwif->hwgroup->rq;
283
284 if (rq_data_dir(rq)) {
285 e100_read_command = 0;
286
287 RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
288 WAIT_DMA(ATA_TX_DMA_NBR);
289 } else {
290 e100_read_command = 1;
291
292 RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
293 WAIT_DMA(ATA_RX_DMA_NBR);
294 }
295
296 /* set up the Etrax DMA descriptors */
297 if (e100_ide_build_dmatable(drive)) {
298 ide_map_sg(drive, rq);
299 return 1;
300 }
301
302 return 0;
303}
304
305static void e100_dma_exec_cmd(ide_drive_t *drive, u8 command)
306{
307 /* set the irq handler which will finish the request when DMA is done */
308 ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
309
310 /* issue cmd to drive */
311 etrax100_ide_outb(command, IDE_COMMAND_REG);
312}
313
314void __init
315init_e100_ide (void)
316{
317 volatile unsigned int dummy;
318 int h;
319
320 printk("ide: ETRAX 100LX built-in ATA DMA controller\n");
321
322 /* first fill in some stuff in the ide_hwifs fields */
323
324 for(h = 0; h < MAX_HWIFS; h++) {
325 ide_hwif_t *hwif = &ide_hwifs[h];
326 hwif->mmio = 2;
327 hwif->chipset = ide_etrax100;
328 hwif->tuneproc = &tune_e100_ide;
329 hwif->ata_input_data = &e100_ide_input_data;
330 hwif->ata_output_data = &e100_ide_output_data;
331 hwif->atapi_input_bytes = &e100_atapi_input_bytes;
332 hwif->atapi_output_bytes = &e100_atapi_output_bytes;
333 hwif->ide_dma_check = &e100_dma_check;
334 hwif->ide_dma_end = &e100_dma_end;
335 hwif->dma_setup = &e100_dma_setup;
336 hwif->dma_exec_cmd = &e100_dma_exec_cmd;
337 hwif->dma_start = &e100_dma_start;
338 hwif->OUTB = &etrax100_ide_outb;
339 hwif->OUTW = &etrax100_ide_outw;
340 hwif->OUTBSYNC = &etrax100_ide_outbsync;
341 hwif->INB = &etrax100_ide_inb;
342 hwif->INW = &etrax100_ide_inw;
343 hwif->ide_dma_off_quietly = &e100_dma_off;
344 }
345
346 /* actually reset and configure the etrax100 ide/ata interface */
347
348 *R_ATA_CTRL_DATA = 0;
349 *R_ATA_TRANSFER_CNT = 0;
350 *R_ATA_CONFIG = 0;
351
352 genconfig_shadow = (genconfig_shadow &
353 ~IO_MASK(R_GEN_CONFIG, dma2) &
354 ~IO_MASK(R_GEN_CONFIG, dma3) &
355 ~IO_MASK(R_GEN_CONFIG, ata)) |
356 ( IO_STATE( R_GEN_CONFIG, dma3, ata ) |
357 IO_STATE( R_GEN_CONFIG, dma2, ata ) |
358 IO_STATE( R_GEN_CONFIG, ata, select ) );
359
360 *R_GEN_CONFIG = genconfig_shadow;
361
362 /* pull the chosen /reset-line low */
363
364#ifdef CONFIG_ETRAX_IDE_G27_RESET
365 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 0);
366#endif
367#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
368 REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 0);
369#endif
370#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
371 REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 0);
372#endif
373#ifdef CONFIG_ETRAX_IDE_PB7_RESET
374 port_pb_dir_shadow = port_pb_dir_shadow |
375 IO_STATE(R_PORT_PB_DIR, dir7, output);
376 *R_PORT_PB_DIR = port_pb_dir_shadow;
377 REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, 1);
378#endif
379
380 /* wait some */
381
382 udelay(25);
383
384 /* de-assert bus-reset */
385
386#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
387 REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 1);
388#endif
389#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
390 REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 1);
391#endif
392#ifdef CONFIG_ETRAX_IDE_G27_RESET
393 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 1);
394#endif
395
396 /* make a dummy read to set the ata controller in a proper state */
397 dummy = *R_ATA_STATUS_DATA;
398
399 *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) |
400 IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
401 IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) |
402 IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO4_SETUP ) |
403 IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
404 IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO4_HOLD ) );
405
406 *R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw, read) |
407 IO_FIELD( R_ATA_CTRL_DATA, addr, 1 ) );
408
409 while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/
410
411 *R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) |
412 IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) |
413 IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) |
414 IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) );
415
416 printk("ide: waiting %d seconds for drives to regain consciousness\n",
417 CONFIG_ETRAX_IDE_DELAY);
418
419 h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ);
420 while(time_before(jiffies, h)) /* nothing */ ;
421
422 /* reset the dma channels we will use */
423
424 RESET_DMA(ATA_TX_DMA_NBR);
425 RESET_DMA(ATA_RX_DMA_NBR);
426 WAIT_DMA(ATA_TX_DMA_NBR);
427 WAIT_DMA(ATA_RX_DMA_NBR);
428
429}
430
431static int e100_dma_off (ide_drive_t *drive)
432{
433 return 0;
434}
435
436static etrax_dma_descr mydescr;
437
438/*
439 * The following routines are mainly used by the ATAPI drivers.
440 *
441 * These routines will round up any request for an odd number of bytes,
442 * so if an odd bytecount is specified, be sure that there's at least one
443 * extra byte allocated for the buffer.
444 */
445static void
446e100_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
447{
448 unsigned long data_reg = IDE_DATA_REG;
449
450 D(printk("atapi_input_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
451 data_reg, buffer, bytecount));
452
453 if(bytecount & 1) {
454 printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
455 bytecount++; /* to round off */
456 }
457
458 /* make sure the DMA channel is available */
459 RESET_DMA(ATA_RX_DMA_NBR);
460 WAIT_DMA(ATA_RX_DMA_NBR);
461
462 /* setup DMA descriptor */
463
464 mydescr.sw_len = bytecount;
465 mydescr.ctrl = d_eol;
466 mydescr.buf = virt_to_phys(buffer);
467
468 /* start the dma channel */
469
470 *R_DMA_CH3_FIRST = virt_to_phys(&mydescr);
471 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start);
472
473 /* initiate a multi word dma read using PIO handshaking */
474
475 *R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
476
477 *R_ATA_CTRL_DATA = data_reg |
478 IO_STATE(R_ATA_CTRL_DATA, rw, read) |
479 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
480 IO_STATE(R_ATA_CTRL_DATA, handsh, pio) |
481 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
482 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
483
484 /* wait for completion */
485
486 LED_DISK_READ(1);
487 WAIT_DMA(ATA_RX_DMA_NBR);
488 LED_DISK_READ(0);
489
490#if 0
491 /* old polled transfer code
492 * this should be moved into a new function that can do polled
493 * transfers if DMA is not available
494 */
495
496 /* initiate a multi word read */
497
498 *R_ATA_TRANSFER_CNT = wcount << 1;
499
500 *R_ATA_CTRL_DATA = data_reg |
501 IO_STATE(R_ATA_CTRL_DATA, rw, read) |
502 IO_STATE(R_ATA_CTRL_DATA, src_dst, register) |
503 IO_STATE(R_ATA_CTRL_DATA, handsh, pio) |
504 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
505 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
506
507 /* svinto has a latency until the busy bit actually is set */
508
509 nop(); nop();
510 nop(); nop();
511 nop(); nop();
512 nop(); nop();
513 nop(); nop();
514
515 /* unit should be busy during multi transfer */
516 while((status = *R_ATA_STATUS_DATA) & IO_MASK(R_ATA_STATUS_DATA, busy)) {
517 while(!(status & IO_MASK(R_ATA_STATUS_DATA, dav)))
518 status = *R_ATA_STATUS_DATA;
519 *ptr++ = (unsigned short)(status & 0xffff);
520 }
521#endif
522}
523
524static void
525e100_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
526{
527 unsigned long data_reg = IDE_DATA_REG;
528
529 D(printk("atapi_output_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
530 data_reg, buffer, bytecount));
531
532 if(bytecount & 1) {
533 printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
534 bytecount++;
535 }
536
537 /* make sure the DMA channel is available */
538 RESET_DMA(ATA_TX_DMA_NBR);
539 WAIT_DMA(ATA_TX_DMA_NBR);
540
541 /* setup DMA descriptor */
542
543 mydescr.sw_len = bytecount;
544 mydescr.ctrl = d_eol;
545 mydescr.buf = virt_to_phys(buffer);
546
547 /* start the dma channel */
548
549 *R_DMA_CH2_FIRST = virt_to_phys(&mydescr);
550 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start);
551
552 /* initiate a multi word dma write using PIO handshaking */
553
554 *R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
555
556 *R_ATA_CTRL_DATA = data_reg |
557 IO_STATE(R_ATA_CTRL_DATA, rw, write) |
558 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
559 IO_STATE(R_ATA_CTRL_DATA, handsh, pio) |
560 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
561 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
562
563 /* wait for completion */
564
565 LED_DISK_WRITE(1);
566 WAIT_DMA(ATA_TX_DMA_NBR);
567 LED_DISK_WRITE(0);
568
569#if 0
570 /* old polled write code - see comment in input_bytes */
571
572 /* wait for busy flag */
573 while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
574
575 /* initiate a multi word write */
576
577 *R_ATA_TRANSFER_CNT = bytecount >> 1;
578
579 ctrl = data_reg |
580 IO_STATE(R_ATA_CTRL_DATA, rw, write) |
581 IO_STATE(R_ATA_CTRL_DATA, src_dst, register) |
582 IO_STATE(R_ATA_CTRL_DATA, handsh, pio) |
583 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
584 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
585
586 LED_DISK_WRITE(1);
587
588 /* Etrax will set busy = 1 until the multi pio transfer has finished
589 * and tr_rdy = 1 after each successful word transfer.
590 * When the last byte has been transferred Etrax will first set tr_tdy = 1
591 * and then busy = 0 (not in the same cycle). If we read busy before it
592 * has been set to 0 we will think that we should transfer more bytes
593 * and then tr_rdy would be 0 forever. This is solved by checking busy
594 * in the inner loop.
595 */
596
597 do {
598 *R_ATA_CTRL_DATA = ctrl | *ptr++;
599 while(!(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy)) &&
600 (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)));
601 } while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
602
603 LED_DISK_WRITE(0);
604#endif
605
606}
607
608/*
609 * This is used for most PIO data transfers *from* the IDE interface
610 */
611static void
612e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
613{
614 e100_atapi_input_bytes(drive, buffer, wcount << 2);
615}
616
617/*
618 * This is used for most PIO data transfers *to* the IDE interface
619 */
620static void
621e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
622{
623 e100_atapi_output_bytes(drive, buffer, wcount << 2);
624}
625
626/* we only have one DMA channel on the chip for ATA, so we can keep these statically */
627static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
628static unsigned int ata_tot_size;
629
630/*
631 * e100_ide_build_dmatable() prepares a dma request.
632 * Returns 0 if all went okay, returns 1 otherwise.
633 */
634static int e100_ide_build_dmatable (ide_drive_t *drive)
635{
636 ide_hwif_t *hwif = HWIF(drive);
637 struct scatterlist* sg;
638 struct request *rq = HWGROUP(drive)->rq;
639 unsigned long size, addr;
640 unsigned int count = 0;
641 int i = 0;
642
643 sg = hwif->sg_table;
644
645 ata_tot_size = 0;
646
647 ide_map_sg(drive, rq);
648
649 i = hwif->sg_nents;
650
651 while(i) {
652 /*
653 * Determine addr and size of next buffer area. We assume that
654 * individual virtual buffers are always composed linearly in
655 * physical memory. For example, we assume that any 8kB buffer
656 * is always composed of two adjacent physical 4kB pages rather
657 * than two possibly non-adjacent physical 4kB pages.
658 */
659 /* group sequential buffers into one large buffer */
660 addr = page_to_phys(sg->page) + sg->offset;
661 size = sg_dma_len(sg);
662 while (sg++, --i) {
663 if ((addr + size) != page_to_phys(sg->page) + sg->offset)
664 break;
665 size += sg_dma_len(sg);
666 }
667
668 /* did we run out of descriptors? */
669
670 if(count >= MAX_DMA_DESCRS) {
671 printk("%s: too few DMA descriptors\n", drive->name);
672 return 1;
673 }
674
675 /* however, this case is more difficult - R_ATA_TRANSFER_CNT cannot be more
676 than 65536 words per transfer, so in that case we need to either
677 1) use a DMA interrupt to re-trigger R_ATA_TRANSFER_CNT and continue with
678 the descriptors, or
679 2) simply do the request here, and get dma_intr to only ide_end_request on
680 those blocks that were actually set-up for transfer.
681 */
682
683 if(ata_tot_size + size > 131072) {
684 printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size);
685 return 1;
686 }
687
688 /* If size > 65536 it has to be splitted into new descriptors. Since we don't handle
689 size > 131072 only one split is necessary */
690
691 if(size > 65536) {
692 /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
693 ata_descrs[count].sw_len = 0; /* 0 means 65536, this is a 16-bit field */
694 ata_descrs[count].ctrl = 0;
695 ata_descrs[count].buf = addr;
696 ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
697 count++;
698 ata_tot_size += 65536;
699 /* size and addr should refere to not handled data */
700 size -= 65536;
701 addr += 65536;
702 }
703 /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
704 if(size == 65536) {
705 ata_descrs[count].sw_len = 0; /* 0 means 65536, this is a 16-bit field */
706 } else {
707 ata_descrs[count].sw_len = size;
708 }
709 ata_descrs[count].ctrl = 0;
710 ata_descrs[count].buf = addr;
711 ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
712 count++;
713 ata_tot_size += size;
714 }
715
716 if (count) {
717 /* set the end-of-list flag on the last descriptor */
718 ata_descrs[count - 1].ctrl |= d_eol;
719 /* return and say all is ok */
720 return 0;
721 }
722
723 printk("%s: empty DMA table?\n", drive->name);
724 return 1; /* let the PIO routines handle this weirdness */
725}
726
727static int config_drive_for_dma (ide_drive_t *drive)
728{
729 const char **list;
730 struct hd_driveid *id = drive->id;
731
732 if (id && (id->capability & 1)) {
733 /* Enable DMA on any drive that supports mword2 DMA */
734 if ((id->field_valid & 2) && (id->dma_mword & 0x404) == 0x404) {
735 drive->using_dma = 1;
736 return 0; /* DMA enabled */
737 }
738
739 /* Consult the list of known "good" drives */
740 list = good_dma_drives;
741 while (*list) {
742 if (!strcmp(*list++,id->model)) {
743 drive->using_dma = 1;
744 return 0; /* DMA enabled */
745 }
746 }
747 }
748 return 1; /* DMA not enabled */
749}
750
751/*
752 * etrax_dma_intr() is the handler for disk read/write DMA interrupts
753 */
754static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
755{
756 LED_DISK_READ(0);
757 LED_DISK_WRITE(0);
758
759 return ide_dma_intr(drive);
760}
761
762/*
763 * Functions below initiates/aborts DMA read/write operations on a drive.
764 *
765 * The caller is assumed to have selected the drive and programmed the drive's
766 * sector address using CHS or LBA. All that remains is to prepare for DMA
767 * and then issue the actual read/write DMA/PIO command to the drive.
768 *
769 * Returns 0 if all went well.
770 * Returns 1 if DMA read/write could not be started, in which case
771 * the caller should revert to PIO for the current request.
772 */
773
774static int e100_dma_check(ide_drive_t *drive)
775{
776 return config_drive_for_dma (drive);
777}
778
779static int e100_dma_end(ide_drive_t *drive)
780{
781 /* TODO: check if something went wrong with the DMA */
782 return 0;
783}
784
785static void e100_dma_start(ide_drive_t *drive)
786{
787 if (e100_read_command) {
788 /* begin DMA */
789
790 /* need to do this before RX DMA due to a chip bug
791 * it is enough to just flush the part of the cache that
792 * corresponds to the buffers we start, but since HD transfers
793 * usually are more than 8 kB, it is easier to optimize for the
794 * normal case and just flush the entire cache. its the only
795 * way to be sure! (OB movie quote)
796 */
797 flush_etrax_cache();
798 *R_DMA_CH3_FIRST = virt_to_phys(ata_descrs);
799 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start);
800
801 /* initiate a multi word dma read using DMA handshaking */
802
803 *R_ATA_TRANSFER_CNT =
804 IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
805
806 *R_ATA_CTRL_DATA =
807 IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) |
808 IO_STATE(R_ATA_CTRL_DATA, rw, read) |
809 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
810 IO_STATE(R_ATA_CTRL_DATA, handsh, dma) |
811 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
812 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
813
814 LED_DISK_READ(1);
815
816 D(printk("dma read of %d bytes.\n", ata_tot_size));
817
818 } else {
819 /* writing */
820 /* begin DMA */
821
822 *R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
823 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start);
824
825 /* initiate a multi word dma write using DMA handshaking */
826
827 *R_ATA_TRANSFER_CNT =
828 IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
829
830 *R_ATA_CTRL_DATA =
831 IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) |
832 IO_STATE(R_ATA_CTRL_DATA, rw, write) |
833 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
834 IO_STATE(R_ATA_CTRL_DATA, handsh, dma) |
835 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
836 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
837
838 LED_DISK_WRITE(1);
839
840 D(printk("dma write of %d bytes.\n", ata_tot_size));
841 }
842}
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 7df85af75371..94daf40ae323 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -960,6 +960,15 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
960} 960}
961#endif /* MAX_HWIFS > 1 */ 961#endif /* MAX_HWIFS > 1 */
962 962
963static inline int hwif_to_node(ide_hwif_t *hwif)
964{
965 if (hwif->pci_dev)
966 return pcibus_to_node(hwif->pci_dev->bus);
967 else
968 /* Add ways to determine the node of other busses here */
969 return -1;
970}
971
963/* 972/*
964 * init request queue 973 * init request queue
965 */ 974 */
@@ -978,8 +987,7 @@ static int ide_init_queue(ide_drive_t *drive)
978 * do not. 987 * do not.
979 */ 988 */
980 989
981 q = blk_init_queue_node(do_ide_request, &ide_lock, 990 q = blk_init_queue_node(do_ide_request, &ide_lock, hwif_to_node(hwif));
982 pcibus_to_node(drive->hwif->pci_dev->bus));
983 if (!q) 991 if (!q)
984 return 1; 992 return 1;
985 993
@@ -1048,6 +1056,8 @@ static int init_irq (ide_hwif_t *hwif)
1048 1056
1049 BUG_ON(in_interrupt()); 1057 BUG_ON(in_interrupt());
1050 BUG_ON(irqs_disabled()); 1058 BUG_ON(irqs_disabled());
1059 BUG_ON(hwif == NULL);
1060
1051 down(&ide_cfg_sem); 1061 down(&ide_cfg_sem);
1052 hwif->hwgroup = NULL; 1062 hwif->hwgroup = NULL;
1053#if MAX_HWIFS > 1 1063#if MAX_HWIFS > 1
@@ -1097,7 +1107,7 @@ static int init_irq (ide_hwif_t *hwif)
1097 spin_unlock_irq(&ide_lock); 1107 spin_unlock_irq(&ide_lock);
1098 } else { 1108 } else {
1099 hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL, 1109 hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,
1100 pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus)); 1110 hwif_to_node(hwif->drives[0].hwif));
1101 if (!hwgroup) 1111 if (!hwgroup)
1102 goto out_up; 1112 goto out_up;
1103 1113
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index aac59751e1b4..f1d1ec4e9677 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -465,7 +465,7 @@ static struct pcmcia_device_id ide_ids[] = {
465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), 465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591),
466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), 466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4),
467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), 467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde),
468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD", 0x6f58c983, 0xaae5994f), 468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD+GAME", 0x6f58c983, 0x63c13aaf),
469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), 469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591),
470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), 470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728),
471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), 471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
@@ -481,6 +481,7 @@ static struct pcmcia_device_id ide_ids[] = {
481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
484 PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
484 PCMCIA_DEVICE_NULL, 485 PCMCIA_DEVICE_NULL,
485}; 486};
486MODULE_DEVICE_TABLE(pcmcia, ide_ids); 487MODULE_DEVICE_TABLE(pcmcia, ide_ids);
@@ -507,5 +508,5 @@ static void __exit exit_ide_cs(void)
507 BUG_ON(dev_list != NULL); 508 BUG_ON(dev_list != NULL);
508} 509}
509 510
510module_init(init_ide_cs); 511late_initcall(init_ide_cs);
511module_exit(exit_ide_cs); 512module_exit(exit_ide_cs);
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 92a2b7caed58..11d035f1983d 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -487,7 +487,7 @@ static void display_clocks (unsigned int index)
487 * Pack active and recovery counts into single byte representation 487 * Pack active and recovery counts into single byte representation
488 * used by controller 488 * used by controller
489 */ 489 */
490inline static u8 pack_nibbles (u8 upper, u8 lower) 490static inline u8 pack_nibbles (u8 upper, u8 lower)
491{ 491{
492 return ((upper & 0x0f) << 4) | (lower & 0x0f); 492 return ((upper & 0x0f) << 4) | (lower & 0x0f);
493} 493}
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 8b5eea5405ef..c26c8ca90dd4 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -5,7 +5,7 @@
5 * May be copied or modified under the terms of the GNU General Public License 5 * May be copied or modified under the terms of the GNU General Public License
6 * 6 *
7 * June 22, 2004 - get rid of check_region 7 * June 22, 2004 - get rid of check_region
8 * Jesper Juhl <juhl-lkml@dif.dk> 8 * - Jesper Juhl
9 * 9 *
10 */ 10 */
11 11
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index fe3e1703fa61..627af507643a 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -169,6 +169,7 @@ MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
169 * Debug levels, configured via kernel config, or enable here. 169 * Debug levels, configured via kernel config, or enable here.
170 */ 170 */
171 171
172#define CONFIG_IEEE1394_SBP2_DEBUG 0
172/* #define CONFIG_IEEE1394_SBP2_DEBUG_ORBS */ 173/* #define CONFIG_IEEE1394_SBP2_DEBUG_ORBS */
173/* #define CONFIG_IEEE1394_SBP2_DEBUG_DMA */ 174/* #define CONFIG_IEEE1394_SBP2_DEBUG_DMA */
174/* #define CONFIG_IEEE1394_SBP2_DEBUG 1 */ 175/* #define CONFIG_IEEE1394_SBP2_DEBUG 1 */
diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index e1a7cf3e8636..10be36731ed7 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -1,15 +1,20 @@
1EXTRA_CFLAGS += -Idrivers/infiniband/include 1EXTRA_CFLAGS += -Idrivers/infiniband/include
2 2
3obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o ib_umad.o 3obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \
4 ib_cm.o ib_umad.o ib_ucm.o
4obj-$(CONFIG_INFINIBAND_USER_VERBS) += ib_uverbs.o 5obj-$(CONFIG_INFINIBAND_USER_VERBS) += ib_uverbs.o
5 6
6ib_core-y := packer.o ud_header.o verbs.o sysfs.o \ 7ib_core-y := packer.o ud_header.o verbs.o sysfs.o \
7 device.o fmr_pool.o cache.o 8 device.o fmr_pool.o cache.o
8 9
9ib_mad-y := mad.o smi.o agent.o 10ib_mad-y := mad.o smi.o agent.o mad_rmpp.o
10 11
11ib_sa-y := sa_query.o 12ib_sa-y := sa_query.o
12 13
14ib_cm-y := cm.o
15
13ib_umad-y := user_mad.o 16ib_umad-y := user_mad.o
14 17
18ib_ucm-y := ucm.o
19
15ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o 20ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
index 23d1957c4b29..729f0b0d983a 100644
--- a/drivers/infiniband/core/agent.c
+++ b/drivers/infiniband/core/agent.c
@@ -134,7 +134,7 @@ static int agent_mad_send(struct ib_mad_agent *mad_agent,
134 sizeof(mad_priv->mad), 134 sizeof(mad_priv->mad),
135 DMA_TO_DEVICE); 135 DMA_TO_DEVICE);
136 gather_list.length = sizeof(mad_priv->mad); 136 gather_list.length = sizeof(mad_priv->mad);
137 gather_list.lkey = (*port_priv->mr).lkey; 137 gather_list.lkey = mad_agent->mr->lkey;
138 138
139 send_wr.next = NULL; 139 send_wr.next = NULL;
140 send_wr.opcode = IB_WR_SEND; 140 send_wr.opcode = IB_WR_SEND;
@@ -156,10 +156,10 @@ static int agent_mad_send(struct ib_mad_agent *mad_agent,
156 /* Should sgid be looked up ? */ 156 /* Should sgid be looked up ? */
157 ah_attr.grh.sgid_index = 0; 157 ah_attr.grh.sgid_index = 0;
158 ah_attr.grh.hop_limit = grh->hop_limit; 158 ah_attr.grh.hop_limit = grh->hop_limit;
159 ah_attr.grh.flow_label = be32_to_cpup( 159 ah_attr.grh.flow_label = be32_to_cpu(
160 &grh->version_tclass_flow) & 0xfffff; 160 grh->version_tclass_flow) & 0xfffff;
161 ah_attr.grh.traffic_class = (be32_to_cpup( 161 ah_attr.grh.traffic_class = (be32_to_cpu(
162 &grh->version_tclass_flow) >> 20) & 0xff; 162 grh->version_tclass_flow) >> 20) & 0xff;
163 memcpy(ah_attr.grh.dgid.raw, 163 memcpy(ah_attr.grh.dgid.raw,
164 grh->sgid.raw, 164 grh->sgid.raw,
165 sizeof(ah_attr.grh.dgid)); 165 sizeof(ah_attr.grh.dgid));
@@ -322,22 +322,12 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
322 goto error3; 322 goto error3;
323 } 323 }
324 324
325 port_priv->mr = ib_get_dma_mr(port_priv->smp_agent->qp->pd,
326 IB_ACCESS_LOCAL_WRITE);
327 if (IS_ERR(port_priv->mr)) {
328 printk(KERN_ERR SPFX "Couldn't get DMA MR\n");
329 ret = PTR_ERR(port_priv->mr);
330 goto error4;
331 }
332
333 spin_lock_irqsave(&ib_agent_port_list_lock, flags); 325 spin_lock_irqsave(&ib_agent_port_list_lock, flags);
334 list_add_tail(&port_priv->port_list, &ib_agent_port_list); 326 list_add_tail(&port_priv->port_list, &ib_agent_port_list);
335 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); 327 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
336 328
337 return 0; 329 return 0;
338 330
339error4:
340 ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
341error3: 331error3:
342 ib_unregister_mad_agent(port_priv->smp_agent); 332 ib_unregister_mad_agent(port_priv->smp_agent);
343error2: 333error2:
@@ -361,8 +351,6 @@ int ib_agent_port_close(struct ib_device *device, int port_num)
361 list_del(&port_priv->port_list); 351 list_del(&port_priv->port_list);
362 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); 352 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
363 353
364 ib_dereg_mr(port_priv->mr);
365
366 ib_unregister_mad_agent(port_priv->perf_mgmt_agent); 354 ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
367 ib_unregister_mad_agent(port_priv->smp_agent); 355 ib_unregister_mad_agent(port_priv->smp_agent);
368 kfree(port_priv); 356 kfree(port_priv);
diff --git a/drivers/infiniband/core/agent_priv.h b/drivers/infiniband/core/agent_priv.h
index 17a0cce5813c..17435af1e914 100644
--- a/drivers/infiniband/core/agent_priv.h
+++ b/drivers/infiniband/core/agent_priv.h
@@ -33,7 +33,7 @@
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE. 34 * SOFTWARE.
35 * 35 *
36 * $Id: agent_priv.h 1389 2004-12-27 22:56:47Z roland $ 36 * $Id: agent_priv.h 1640 2005-01-24 22:39:02Z halr $
37 */ 37 */
38 38
39#ifndef __IB_AGENT_PRIV_H__ 39#ifndef __IB_AGENT_PRIV_H__
@@ -57,7 +57,6 @@ struct ib_agent_port_private {
57 int port_num; 57 int port_num;
58 struct ib_mad_agent *smp_agent; /* SM class */ 58 struct ib_mad_agent *smp_agent; /* SM class */
59 struct ib_mad_agent *perf_mgmt_agent; /* PerfMgmt class */ 59 struct ib_mad_agent *perf_mgmt_agent; /* PerfMgmt class */
60 struct ib_mr *mr;
61}; 60};
62 61
63#endif /* __IB_AGENT_PRIV_H__ */ 62#endif /* __IB_AGENT_PRIV_H__ */
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
new file mode 100644
index 000000000000..403ed125d8f4
--- /dev/null
+++ b/drivers/infiniband/core/cm.c
@@ -0,0 +1,3324 @@
1/*
2 * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved.
3 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
4 * Copyright (c) 2004, 2005 Voltaire Corporation. All rights reserved.
5 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
20 *
21 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
34 *
35 * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $
36 */
37#include <linux/dma-mapping.h>
38#include <linux/err.h>
39#include <linux/idr.h>
40#include <linux/interrupt.h>
41#include <linux/pci.h>
42#include <linux/rbtree.h>
43#include <linux/spinlock.h>
44#include <linux/workqueue.h>
45
46#include <ib_cache.h>
47#include <ib_cm.h>
48#include "cm_msgs.h"
49
50MODULE_AUTHOR("Sean Hefty");
51MODULE_DESCRIPTION("InfiniBand CM");
52MODULE_LICENSE("Dual BSD/GPL");
53
54static void cm_add_one(struct ib_device *device);
55static void cm_remove_one(struct ib_device *device);
56
57static struct ib_client cm_client = {
58 .name = "cm",
59 .add = cm_add_one,
60 .remove = cm_remove_one
61};
62
63static struct ib_cm {
64 spinlock_t lock;
65 struct list_head device_list;
66 rwlock_t device_lock;
67 struct rb_root listen_service_table;
68 u64 listen_service_id;
69 /* struct rb_root peer_service_table; todo: fix peer to peer */
70 struct rb_root remote_qp_table;
71 struct rb_root remote_id_table;
72 struct rb_root remote_sidr_table;
73 struct idr local_id_table;
74 struct workqueue_struct *wq;
75} cm;
76
77struct cm_port {
78 struct cm_device *cm_dev;
79 struct ib_mad_agent *mad_agent;
80 u8 port_num;
81};
82
83struct cm_device {
84 struct list_head list;
85 struct ib_device *device;
86 u64 ca_guid;
87 struct cm_port port[0];
88};
89
90struct cm_av {
91 struct cm_port *port;
92 union ib_gid dgid;
93 struct ib_ah_attr ah_attr;
94 u16 pkey_index;
95 u8 packet_life_time;
96};
97
98struct cm_work {
99 struct work_struct work;
100 struct list_head list;
101 struct cm_port *port;
102 struct ib_mad_recv_wc *mad_recv_wc; /* Received MADs */
103 u32 local_id; /* Established / timewait */
104 u32 remote_id;
105 struct ib_cm_event cm_event;
106 struct ib_sa_path_rec path[0];
107};
108
109struct cm_timewait_info {
110 struct cm_work work; /* Must be first. */
111 struct rb_node remote_qp_node;
112 struct rb_node remote_id_node;
113 u64 remote_ca_guid;
114 u32 remote_qpn;
115 u8 inserted_remote_qp;
116 u8 inserted_remote_id;
117};
118
119struct cm_id_private {
120 struct ib_cm_id id;
121
122 struct rb_node service_node;
123 struct rb_node sidr_id_node;
124 spinlock_t lock;
125 wait_queue_head_t wait;
126 atomic_t refcount;
127
128 struct ib_mad_send_buf *msg;
129 struct cm_timewait_info *timewait_info;
130 /* todo: use alternate port on send failure */
131 struct cm_av av;
132 struct cm_av alt_av;
133
134 void *private_data;
135 u64 tid;
136 u32 local_qpn;
137 u32 remote_qpn;
138 u32 sq_psn;
139 u32 rq_psn;
140 int timeout_ms;
141 enum ib_mtu path_mtu;
142 u8 private_data_len;
143 u8 max_cm_retries;
144 u8 peer_to_peer;
145 u8 responder_resources;
146 u8 initiator_depth;
147 u8 local_ack_timeout;
148 u8 retry_count;
149 u8 rnr_retry_count;
150 u8 service_timeout;
151
152 struct list_head work_list;
153 atomic_t work_count;
154};
155
156static void cm_work_handler(void *data);
157
158static inline void cm_deref_id(struct cm_id_private *cm_id_priv)
159{
160 if (atomic_dec_and_test(&cm_id_priv->refcount))
161 wake_up(&cm_id_priv->wait);
162}
163
164static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
165 struct ib_mad_send_buf **msg)
166{
167 struct ib_mad_agent *mad_agent;
168 struct ib_mad_send_buf *m;
169 struct ib_ah *ah;
170
171 mad_agent = cm_id_priv->av.port->mad_agent;
172 ah = ib_create_ah(mad_agent->qp->pd, &cm_id_priv->av.ah_attr);
173 if (IS_ERR(ah))
174 return PTR_ERR(ah);
175
176 m = ib_create_send_mad(mad_agent, 1, cm_id_priv->av.pkey_index,
177 ah, 0, sizeof(struct ib_mad_hdr),
178 sizeof(struct ib_mad)-sizeof(struct ib_mad_hdr),
179 GFP_ATOMIC);
180 if (IS_ERR(m)) {
181 ib_destroy_ah(ah);
182 return PTR_ERR(m);
183 }
184
185 /* Timeout set by caller if response is expected. */
186 m->send_wr.wr.ud.retries = cm_id_priv->max_cm_retries;
187
188 atomic_inc(&cm_id_priv->refcount);
189 m->context[0] = cm_id_priv;
190 *msg = m;
191 return 0;
192}
193
194static int cm_alloc_response_msg(struct cm_port *port,
195 struct ib_mad_recv_wc *mad_recv_wc,
196 struct ib_mad_send_buf **msg)
197{
198 struct ib_mad_send_buf *m;
199 struct ib_ah *ah;
200
201 ah = ib_create_ah_from_wc(port->mad_agent->qp->pd, mad_recv_wc->wc,
202 mad_recv_wc->recv_buf.grh, port->port_num);
203 if (IS_ERR(ah))
204 return PTR_ERR(ah);
205
206 m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index,
207 ah, 0, sizeof(struct ib_mad_hdr),
208 sizeof(struct ib_mad)-sizeof(struct ib_mad_hdr),
209 GFP_ATOMIC);
210 if (IS_ERR(m)) {
211 ib_destroy_ah(ah);
212 return PTR_ERR(m);
213 }
214 *msg = m;
215 return 0;
216}
217
218static void cm_free_msg(struct ib_mad_send_buf *msg)
219{
220 ib_destroy_ah(msg->send_wr.wr.ud.ah);
221 if (msg->context[0])
222 cm_deref_id(msg->context[0]);
223 ib_free_send_mad(msg);
224}
225
226static void * cm_copy_private_data(const void *private_data,
227 u8 private_data_len)
228{
229 void *data;
230
231 if (!private_data || !private_data_len)
232 return NULL;
233
234 data = kmalloc(private_data_len, GFP_KERNEL);
235 if (!data)
236 return ERR_PTR(-ENOMEM);
237
238 memcpy(data, private_data, private_data_len);
239 return data;
240}
241
242static void cm_set_private_data(struct cm_id_private *cm_id_priv,
243 void *private_data, u8 private_data_len)
244{
245 if (cm_id_priv->private_data && cm_id_priv->private_data_len)
246 kfree(cm_id_priv->private_data);
247
248 cm_id_priv->private_data = private_data;
249 cm_id_priv->private_data_len = private_data_len;
250}
251
252static void cm_set_ah_attr(struct ib_ah_attr *ah_attr, u8 port_num,
253 u16 dlid, u8 sl, u16 src_path_bits)
254{
255 memset(ah_attr, 0, sizeof ah_attr);
256 ah_attr->dlid = be16_to_cpu(dlid);
257 ah_attr->sl = sl;
258 ah_attr->src_path_bits = src_path_bits;
259 ah_attr->port_num = port_num;
260}
261
262static void cm_init_av_for_response(struct cm_port *port,
263 struct ib_wc *wc, struct cm_av *av)
264{
265 av->port = port;
266 av->pkey_index = wc->pkey_index;
267 cm_set_ah_attr(&av->ah_attr, port->port_num, cpu_to_be16(wc->slid),
268 wc->sl, wc->dlid_path_bits);
269}
270
271static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
272{
273 struct cm_device *cm_dev;
274 struct cm_port *port = NULL;
275 unsigned long flags;
276 int ret;
277 u8 p;
278
279 read_lock_irqsave(&cm.device_lock, flags);
280 list_for_each_entry(cm_dev, &cm.device_list, list) {
281 if (!ib_find_cached_gid(cm_dev->device, &path->sgid,
282 &p, NULL)) {
283 port = &cm_dev->port[p-1];
284 break;
285 }
286 }
287 read_unlock_irqrestore(&cm.device_lock, flags);
288
289 if (!port)
290 return -EINVAL;
291
292 ret = ib_find_cached_pkey(cm_dev->device, port->port_num,
293 be16_to_cpu(path->pkey), &av->pkey_index);
294 if (ret)
295 return ret;
296
297 av->port = port;
298 cm_set_ah_attr(&av->ah_attr, av->port->port_num, path->dlid,
299 path->sl, path->slid & 0x7F);
300 av->packet_life_time = path->packet_life_time;
301 return 0;
302}
303
304static int cm_alloc_id(struct cm_id_private *cm_id_priv)
305{
306 unsigned long flags;
307 int ret;
308
309 do {
310 spin_lock_irqsave(&cm.lock, flags);
311 ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, 1,
312 (int *) &cm_id_priv->id.local_id);
313 spin_unlock_irqrestore(&cm.lock, flags);
314 } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) );
315 return ret;
316}
317
318static void cm_free_id(u32 local_id)
319{
320 unsigned long flags;
321
322 spin_lock_irqsave(&cm.lock, flags);
323 idr_remove(&cm.local_id_table, (int) local_id);
324 spin_unlock_irqrestore(&cm.lock, flags);
325}
326
327static struct cm_id_private * cm_get_id(u32 local_id, u32 remote_id)
328{
329 struct cm_id_private *cm_id_priv;
330
331 cm_id_priv = idr_find(&cm.local_id_table, (int) local_id);
332 if (cm_id_priv) {
333 if (cm_id_priv->id.remote_id == remote_id)
334 atomic_inc(&cm_id_priv->refcount);
335 else
336 cm_id_priv = NULL;
337 }
338
339 return cm_id_priv;
340}
341
342static struct cm_id_private * cm_acquire_id(u32 local_id, u32 remote_id)
343{
344 struct cm_id_private *cm_id_priv;
345 unsigned long flags;
346
347 spin_lock_irqsave(&cm.lock, flags);
348 cm_id_priv = cm_get_id(local_id, remote_id);
349 spin_unlock_irqrestore(&cm.lock, flags);
350
351 return cm_id_priv;
352}
353
354static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
355{
356 struct rb_node **link = &cm.listen_service_table.rb_node;
357 struct rb_node *parent = NULL;
358 struct cm_id_private *cur_cm_id_priv;
359 u64 service_id = cm_id_priv->id.service_id;
360 u64 service_mask = cm_id_priv->id.service_mask;
361
362 while (*link) {
363 parent = *link;
364 cur_cm_id_priv = rb_entry(parent, struct cm_id_private,
365 service_node);
366 if ((cur_cm_id_priv->id.service_mask & service_id) ==
367 (service_mask & cur_cm_id_priv->id.service_id))
368 return cm_id_priv;
369 if (service_id < cur_cm_id_priv->id.service_id)
370 link = &(*link)->rb_left;
371 else
372 link = &(*link)->rb_right;
373 }
374 rb_link_node(&cm_id_priv->service_node, parent, link);
375 rb_insert_color(&cm_id_priv->service_node, &cm.listen_service_table);
376 return NULL;
377}
378
379static struct cm_id_private * cm_find_listen(u64 service_id)
380{
381 struct rb_node *node = cm.listen_service_table.rb_node;
382 struct cm_id_private *cm_id_priv;
383
384 while (node) {
385 cm_id_priv = rb_entry(node, struct cm_id_private, service_node);
386 if ((cm_id_priv->id.service_mask & service_id) ==
387 (cm_id_priv->id.service_mask & cm_id_priv->id.service_id))
388 return cm_id_priv;
389 if (service_id < cm_id_priv->id.service_id)
390 node = node->rb_left;
391 else
392 node = node->rb_right;
393 }
394 return NULL;
395}
396
397static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info
398 *timewait_info)
399{
400 struct rb_node **link = &cm.remote_id_table.rb_node;
401 struct rb_node *parent = NULL;
402 struct cm_timewait_info *cur_timewait_info;
403 u64 remote_ca_guid = timewait_info->remote_ca_guid;
404 u32 remote_id = timewait_info->work.remote_id;
405
406 while (*link) {
407 parent = *link;
408 cur_timewait_info = rb_entry(parent, struct cm_timewait_info,
409 remote_id_node);
410 if (remote_id < cur_timewait_info->work.remote_id)
411 link = &(*link)->rb_left;
412 else if (remote_id > cur_timewait_info->work.remote_id)
413 link = &(*link)->rb_right;
414 else if (remote_ca_guid < cur_timewait_info->remote_ca_guid)
415 link = &(*link)->rb_left;
416 else if (remote_ca_guid > cur_timewait_info->remote_ca_guid)
417 link = &(*link)->rb_right;
418 else
419 return cur_timewait_info;
420 }
421 timewait_info->inserted_remote_id = 1;
422 rb_link_node(&timewait_info->remote_id_node, parent, link);
423 rb_insert_color(&timewait_info->remote_id_node, &cm.remote_id_table);
424 return NULL;
425}
426
427static struct cm_timewait_info * cm_find_remote_id(u64 remote_ca_guid,
428 u32 remote_id)
429{
430 struct rb_node *node = cm.remote_id_table.rb_node;
431 struct cm_timewait_info *timewait_info;
432
433 while (node) {
434 timewait_info = rb_entry(node, struct cm_timewait_info,
435 remote_id_node);
436 if (remote_id < timewait_info->work.remote_id)
437 node = node->rb_left;
438 else if (remote_id > timewait_info->work.remote_id)
439 node = node->rb_right;
440 else if (remote_ca_guid < timewait_info->remote_ca_guid)
441 node = node->rb_left;
442 else if (remote_ca_guid > timewait_info->remote_ca_guid)
443 node = node->rb_right;
444 else
445 return timewait_info;
446 }
447 return NULL;
448}
449
450static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info
451 *timewait_info)
452{
453 struct rb_node **link = &cm.remote_qp_table.rb_node;
454 struct rb_node *parent = NULL;
455 struct cm_timewait_info *cur_timewait_info;
456 u64 remote_ca_guid = timewait_info->remote_ca_guid;
457 u32 remote_qpn = timewait_info->remote_qpn;
458
459 while (*link) {
460 parent = *link;
461 cur_timewait_info = rb_entry(parent, struct cm_timewait_info,
462 remote_qp_node);
463 if (remote_qpn < cur_timewait_info->remote_qpn)
464 link = &(*link)->rb_left;
465 else if (remote_qpn > cur_timewait_info->remote_qpn)
466 link = &(*link)->rb_right;
467 else if (remote_ca_guid < cur_timewait_info->remote_ca_guid)
468 link = &(*link)->rb_left;
469 else if (remote_ca_guid > cur_timewait_info->remote_ca_guid)
470 link = &(*link)->rb_right;
471 else
472 return cur_timewait_info;
473 }
474 timewait_info->inserted_remote_qp = 1;
475 rb_link_node(&timewait_info->remote_qp_node, parent, link);
476 rb_insert_color(&timewait_info->remote_qp_node, &cm.remote_qp_table);
477 return NULL;
478}
479
480static struct cm_id_private * cm_insert_remote_sidr(struct cm_id_private
481 *cm_id_priv)
482{
483 struct rb_node **link = &cm.remote_sidr_table.rb_node;
484 struct rb_node *parent = NULL;
485 struct cm_id_private *cur_cm_id_priv;
486 union ib_gid *port_gid = &cm_id_priv->av.dgid;
487 u32 remote_id = cm_id_priv->id.remote_id;
488
489 while (*link) {
490 parent = *link;
491 cur_cm_id_priv = rb_entry(parent, struct cm_id_private,
492 sidr_id_node);
493 if (remote_id < cur_cm_id_priv->id.remote_id)
494 link = &(*link)->rb_left;
495 else if (remote_id > cur_cm_id_priv->id.remote_id)
496 link = &(*link)->rb_right;
497 else {
498 int cmp;
499 cmp = memcmp(port_gid, &cur_cm_id_priv->av.dgid,
500 sizeof *port_gid);
501 if (cmp < 0)
502 link = &(*link)->rb_left;
503 else if (cmp > 0)
504 link = &(*link)->rb_right;
505 else
506 return cur_cm_id_priv;
507 }
508 }
509 rb_link_node(&cm_id_priv->sidr_id_node, parent, link);
510 rb_insert_color(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
511 return NULL;
512}
513
514static void cm_reject_sidr_req(struct cm_id_private *cm_id_priv,
515 enum ib_cm_sidr_status status)
516{
517 struct ib_cm_sidr_rep_param param;
518
519 memset(&param, 0, sizeof param);
520 param.status = status;
521 ib_send_cm_sidr_rep(&cm_id_priv->id, &param);
522}
523
524struct ib_cm_id *ib_create_cm_id(ib_cm_handler cm_handler,
525 void *context)
526{
527 struct cm_id_private *cm_id_priv;
528 int ret;
529
530 cm_id_priv = kmalloc(sizeof *cm_id_priv, GFP_KERNEL);
531 if (!cm_id_priv)
532 return ERR_PTR(-ENOMEM);
533
534 memset(cm_id_priv, 0, sizeof *cm_id_priv);
535 cm_id_priv->id.state = IB_CM_IDLE;
536 cm_id_priv->id.cm_handler = cm_handler;
537 cm_id_priv->id.context = context;
538 ret = cm_alloc_id(cm_id_priv);
539 if (ret)
540 goto error;
541
542 spin_lock_init(&cm_id_priv->lock);
543 init_waitqueue_head(&cm_id_priv->wait);
544 INIT_LIST_HEAD(&cm_id_priv->work_list);
545 atomic_set(&cm_id_priv->work_count, -1);
546 atomic_set(&cm_id_priv->refcount, 1);
547 return &cm_id_priv->id;
548
549error:
550 kfree(cm_id_priv);
551 return ERR_PTR(-ENOMEM);
552}
553EXPORT_SYMBOL(ib_create_cm_id);
554
555static struct cm_work * cm_dequeue_work(struct cm_id_private *cm_id_priv)
556{
557 struct cm_work *work;
558
559 if (list_empty(&cm_id_priv->work_list))
560 return NULL;
561
562 work = list_entry(cm_id_priv->work_list.next, struct cm_work, list);
563 list_del(&work->list);
564 return work;
565}
566
567static void cm_free_work(struct cm_work *work)
568{
569 if (work->mad_recv_wc)
570 ib_free_recv_mad(work->mad_recv_wc);
571 kfree(work);
572}
573
574static inline int cm_convert_to_ms(int iba_time)
575{
576 /* approximate conversion to ms from 4.096us x 2^iba_time */
577 return 1 << max(iba_time - 8, 0);
578}
579
580static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info)
581{
582 unsigned long flags;
583
584 if (!timewait_info->inserted_remote_id &&
585 !timewait_info->inserted_remote_qp)
586 return;
587
588 spin_lock_irqsave(&cm.lock, flags);
589 if (timewait_info->inserted_remote_id) {
590 rb_erase(&timewait_info->remote_id_node, &cm.remote_id_table);
591 timewait_info->inserted_remote_id = 0;
592 }
593
594 if (timewait_info->inserted_remote_qp) {
595 rb_erase(&timewait_info->remote_qp_node, &cm.remote_qp_table);
596 timewait_info->inserted_remote_qp = 0;
597 }
598 spin_unlock_irqrestore(&cm.lock, flags);
599}
600
601static struct cm_timewait_info * cm_create_timewait_info(u32 local_id)
602{
603 struct cm_timewait_info *timewait_info;
604
605 timewait_info = kmalloc(sizeof *timewait_info, GFP_KERNEL);
606 if (!timewait_info)
607 return ERR_PTR(-ENOMEM);
608 memset(timewait_info, 0, sizeof *timewait_info);
609
610 timewait_info->work.local_id = local_id;
611 INIT_WORK(&timewait_info->work.work, cm_work_handler,
612 &timewait_info->work);
613 timewait_info->work.cm_event.event = IB_CM_TIMEWAIT_EXIT;
614 return timewait_info;
615}
616
617static void cm_enter_timewait(struct cm_id_private *cm_id_priv)
618{
619 int wait_time;
620
621 /*
622 * The cm_id could be destroyed by the user before we exit timewait.
623 * To protect against this, we search for the cm_id after exiting
624 * timewait before notifying the user that we've exited timewait.
625 */
626 cm_id_priv->id.state = IB_CM_TIMEWAIT;
627 wait_time = cm_convert_to_ms(cm_id_priv->local_ack_timeout);
628 queue_delayed_work(cm.wq, &cm_id_priv->timewait_info->work.work,
629 msecs_to_jiffies(wait_time));
630 cm_id_priv->timewait_info = NULL;
631}
632
633static void cm_reset_to_idle(struct cm_id_private *cm_id_priv)
634{
635 cm_id_priv->id.state = IB_CM_IDLE;
636 if (cm_id_priv->timewait_info) {
637 cm_cleanup_timewait(cm_id_priv->timewait_info);
638 kfree(cm_id_priv->timewait_info);
639 cm_id_priv->timewait_info = NULL;
640 }
641}
642
643void ib_destroy_cm_id(struct ib_cm_id *cm_id)
644{
645 struct cm_id_private *cm_id_priv;
646 struct cm_work *work;
647 unsigned long flags;
648
649 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
650retest:
651 spin_lock_irqsave(&cm_id_priv->lock, flags);
652 switch (cm_id->state) {
653 case IB_CM_LISTEN:
654 cm_id->state = IB_CM_IDLE;
655 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
656 spin_lock_irqsave(&cm.lock, flags);
657 rb_erase(&cm_id_priv->service_node, &cm.listen_service_table);
658 spin_unlock_irqrestore(&cm.lock, flags);
659 break;
660 case IB_CM_SIDR_REQ_SENT:
661 cm_id->state = IB_CM_IDLE;
662 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
663 (unsigned long) cm_id_priv->msg);
664 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
665 break;
666 case IB_CM_SIDR_REQ_RCVD:
667 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
668 cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT);
669 break;
670 case IB_CM_REQ_SENT:
671 case IB_CM_MRA_REQ_RCVD:
672 case IB_CM_REP_SENT:
673 case IB_CM_MRA_REP_RCVD:
674 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
675 (unsigned long) cm_id_priv->msg);
676 /* Fall through */
677 case IB_CM_REQ_RCVD:
678 case IB_CM_MRA_REQ_SENT:
679 case IB_CM_REP_RCVD:
680 case IB_CM_MRA_REP_SENT:
681 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
682 ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT,
683 &cm_id_priv->av.port->cm_dev->ca_guid,
684 sizeof cm_id_priv->av.port->cm_dev->ca_guid,
685 NULL, 0);
686 break;
687 case IB_CM_ESTABLISHED:
688 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
689 ib_send_cm_dreq(cm_id, NULL, 0);
690 goto retest;
691 case IB_CM_DREQ_SENT:
692 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
693 (unsigned long) cm_id_priv->msg);
694 cm_enter_timewait(cm_id_priv);
695 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
696 break;
697 case IB_CM_DREQ_RCVD:
698 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
699 ib_send_cm_drep(cm_id, NULL, 0);
700 break;
701 default:
702 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
703 break;
704 }
705
706 cm_free_id(cm_id->local_id);
707 atomic_dec(&cm_id_priv->refcount);
708 wait_event(cm_id_priv->wait, !atomic_read(&cm_id_priv->refcount));
709 while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
710 cm_free_work(work);
711 if (cm_id_priv->private_data && cm_id_priv->private_data_len)
712 kfree(cm_id_priv->private_data);
713 kfree(cm_id_priv);
714}
715EXPORT_SYMBOL(ib_destroy_cm_id);
716
717int ib_cm_listen(struct ib_cm_id *cm_id,
718 u64 service_id,
719 u64 service_mask)
720{
721 struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
722 unsigned long flags;
723 int ret = 0;
724
725 service_mask = service_mask ? service_mask : ~0ULL;
726 service_id &= service_mask;
727 if ((service_id & IB_SERVICE_ID_AGN_MASK) == IB_CM_ASSIGN_SERVICE_ID &&
728 (service_id != IB_CM_ASSIGN_SERVICE_ID))
729 return -EINVAL;
730
731 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
732 BUG_ON(cm_id->state != IB_CM_IDLE);
733
734 cm_id->state = IB_CM_LISTEN;
735
736 spin_lock_irqsave(&cm.lock, flags);
737 if (service_id == IB_CM_ASSIGN_SERVICE_ID) {
738 cm_id->service_id = __cpu_to_be64(cm.listen_service_id++);
739 cm_id->service_mask = ~0ULL;
740 } else {
741 cm_id->service_id = service_id;
742 cm_id->service_mask = service_mask;
743 }
744 cur_cm_id_priv = cm_insert_listen(cm_id_priv);
745 spin_unlock_irqrestore(&cm.lock, flags);
746
747 if (cur_cm_id_priv) {
748 cm_id->state = IB_CM_IDLE;
749 ret = -EBUSY;
750 }
751 return ret;
752}
753EXPORT_SYMBOL(ib_cm_listen);
754
755static u64 cm_form_tid(struct cm_id_private *cm_id_priv,
756 enum cm_msg_sequence msg_seq)
757{
758 u64 hi_tid, low_tid;
759
760 hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32;
761 low_tid = (u64) (cm_id_priv->id.local_id | (msg_seq << 30));
762 return cpu_to_be64(hi_tid | low_tid);
763}
764
765static void cm_format_mad_hdr(struct ib_mad_hdr *hdr,
766 enum cm_msg_attr_id attr_id, u64 tid)
767{
768 hdr->base_version = IB_MGMT_BASE_VERSION;
769 hdr->mgmt_class = IB_MGMT_CLASS_CM;
770 hdr->class_version = IB_CM_CLASS_VERSION;
771 hdr->method = IB_MGMT_METHOD_SEND;
772 hdr->attr_id = attr_id;
773 hdr->tid = tid;
774}
775
776static void cm_format_req(struct cm_req_msg *req_msg,
777 struct cm_id_private *cm_id_priv,
778 struct ib_cm_req_param *param)
779{
780 cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID,
781 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ));
782
783 req_msg->local_comm_id = cm_id_priv->id.local_id;
784 req_msg->service_id = param->service_id;
785 req_msg->local_ca_guid = cm_id_priv->av.port->cm_dev->ca_guid;
786 cm_req_set_local_qpn(req_msg, cpu_to_be32(param->qp_num));
787 cm_req_set_resp_res(req_msg, param->responder_resources);
788 cm_req_set_init_depth(req_msg, param->initiator_depth);
789 cm_req_set_remote_resp_timeout(req_msg,
790 param->remote_cm_response_timeout);
791 cm_req_set_qp_type(req_msg, param->qp_type);
792 cm_req_set_flow_ctrl(req_msg, param->flow_control);
793 cm_req_set_starting_psn(req_msg, cpu_to_be32(param->starting_psn));
794 cm_req_set_local_resp_timeout(req_msg,
795 param->local_cm_response_timeout);
796 cm_req_set_retry_count(req_msg, param->retry_count);
797 req_msg->pkey = param->primary_path->pkey;
798 cm_req_set_path_mtu(req_msg, param->primary_path->mtu);
799 cm_req_set_rnr_retry_count(req_msg, param->rnr_retry_count);
800 cm_req_set_max_cm_retries(req_msg, param->max_cm_retries);
801 cm_req_set_srq(req_msg, param->srq);
802
803 req_msg->primary_local_lid = param->primary_path->slid;
804 req_msg->primary_remote_lid = param->primary_path->dlid;
805 req_msg->primary_local_gid = param->primary_path->sgid;
806 req_msg->primary_remote_gid = param->primary_path->dgid;
807 cm_req_set_primary_flow_label(req_msg, param->primary_path->flow_label);
808 cm_req_set_primary_packet_rate(req_msg, param->primary_path->rate);
809 req_msg->primary_traffic_class = param->primary_path->traffic_class;
810 req_msg->primary_hop_limit = param->primary_path->hop_limit;
811 cm_req_set_primary_sl(req_msg, param->primary_path->sl);
812 cm_req_set_primary_subnet_local(req_msg, 1); /* local only... */
813 cm_req_set_primary_local_ack_timeout(req_msg,
814 min(31, param->primary_path->packet_life_time + 1));
815
816 if (param->alternate_path) {
817 req_msg->alt_local_lid = param->alternate_path->slid;
818 req_msg->alt_remote_lid = param->alternate_path->dlid;
819 req_msg->alt_local_gid = param->alternate_path->sgid;
820 req_msg->alt_remote_gid = param->alternate_path->dgid;
821 cm_req_set_alt_flow_label(req_msg,
822 param->alternate_path->flow_label);
823 cm_req_set_alt_packet_rate(req_msg, param->alternate_path->rate);
824 req_msg->alt_traffic_class = param->alternate_path->traffic_class;
825 req_msg->alt_hop_limit = param->alternate_path->hop_limit;
826 cm_req_set_alt_sl(req_msg, param->alternate_path->sl);
827 cm_req_set_alt_subnet_local(req_msg, 1); /* local only... */
828 cm_req_set_alt_local_ack_timeout(req_msg,
829 min(31, param->alternate_path->packet_life_time + 1));
830 }
831
832 if (param->private_data && param->private_data_len)
833 memcpy(req_msg->private_data, param->private_data,
834 param->private_data_len);
835}
836
837static inline int cm_validate_req_param(struct ib_cm_req_param *param)
838{
839 /* peer-to-peer not supported */
840 if (param->peer_to_peer)
841 return -EINVAL;
842
843 if (!param->primary_path)
844 return -EINVAL;
845
846 if (param->qp_type != IB_QPT_RC && param->qp_type != IB_QPT_UC)
847 return -EINVAL;
848
849 if (param->private_data &&
850 param->private_data_len > IB_CM_REQ_PRIVATE_DATA_SIZE)
851 return -EINVAL;
852
853 if (param->alternate_path &&
854 (param->alternate_path->pkey != param->primary_path->pkey ||
855 param->alternate_path->mtu != param->primary_path->mtu))
856 return -EINVAL;
857
858 return 0;
859}
860
861int ib_send_cm_req(struct ib_cm_id *cm_id,
862 struct ib_cm_req_param *param)
863{
864 struct cm_id_private *cm_id_priv;
865 struct ib_send_wr *bad_send_wr;
866 struct cm_req_msg *req_msg;
867 unsigned long flags;
868 int ret;
869
870 ret = cm_validate_req_param(param);
871 if (ret)
872 return ret;
873
874 /* Verify that we're not in timewait. */
875 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
876 spin_lock_irqsave(&cm_id_priv->lock, flags);
877 if (cm_id->state != IB_CM_IDLE) {
878 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
879 ret = -EINVAL;
880 goto out;
881 }
882 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
883
884 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
885 id.local_id);
886 if (IS_ERR(cm_id_priv->timewait_info))
887 goto out;
888
889 ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av);
890 if (ret)
891 goto error1;
892 if (param->alternate_path) {
893 ret = cm_init_av_by_path(param->alternate_path,
894 &cm_id_priv->alt_av);
895 if (ret)
896 goto error1;
897 }
898 cm_id->service_id = param->service_id;
899 cm_id->service_mask = ~0ULL;
900 cm_id_priv->timeout_ms = cm_convert_to_ms(
901 param->primary_path->packet_life_time) * 2 +
902 cm_convert_to_ms(
903 param->remote_cm_response_timeout);
904 cm_id_priv->max_cm_retries = param->max_cm_retries;
905 cm_id_priv->initiator_depth = param->initiator_depth;
906 cm_id_priv->responder_resources = param->responder_resources;
907 cm_id_priv->retry_count = param->retry_count;
908 cm_id_priv->path_mtu = param->primary_path->mtu;
909
910 ret = cm_alloc_msg(cm_id_priv, &cm_id_priv->msg);
911 if (ret)
912 goto error1;
913
914 req_msg = (struct cm_req_msg *) cm_id_priv->msg->mad;
915 cm_format_req(req_msg, cm_id_priv, param);
916 cm_id_priv->tid = req_msg->hdr.tid;
917 cm_id_priv->msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
918 cm_id_priv->msg->context[1] = (void *) (unsigned long) IB_CM_REQ_SENT;
919
920 cm_id_priv->local_qpn = cm_req_get_local_qpn(req_msg);
921 cm_id_priv->rq_psn = cm_req_get_starting_psn(req_msg);
922 cm_id_priv->local_ack_timeout =
923 cm_req_get_primary_local_ack_timeout(req_msg);
924
925 spin_lock_irqsave(&cm_id_priv->lock, flags);
926 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
927 &cm_id_priv->msg->send_wr, &bad_send_wr);
928 if (ret) {
929 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
930 goto error2;
931 }
932 BUG_ON(cm_id->state != IB_CM_IDLE);
933 cm_id->state = IB_CM_REQ_SENT;
934 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
935 return 0;
936
937error2: cm_free_msg(cm_id_priv->msg);
938error1: kfree(cm_id_priv->timewait_info);
939out: return ret;
940}
941EXPORT_SYMBOL(ib_send_cm_req);
942
943static int cm_issue_rej(struct cm_port *port,
944 struct ib_mad_recv_wc *mad_recv_wc,
945 enum ib_cm_rej_reason reason,
946 enum cm_msg_response msg_rejected,
947 void *ari, u8 ari_length)
948{
949 struct ib_mad_send_buf *msg = NULL;
950 struct ib_send_wr *bad_send_wr;
951 struct cm_rej_msg *rej_msg, *rcv_msg;
952 int ret;
953
954 ret = cm_alloc_response_msg(port, mad_recv_wc, &msg);
955 if (ret)
956 return ret;
957
958 /* We just need common CM header information. Cast to any message. */
959 rcv_msg = (struct cm_rej_msg *) mad_recv_wc->recv_buf.mad;
960 rej_msg = (struct cm_rej_msg *) msg->mad;
961
962 cm_format_mad_hdr(&rej_msg->hdr, CM_REJ_ATTR_ID, rcv_msg->hdr.tid);
963 rej_msg->remote_comm_id = rcv_msg->local_comm_id;
964 rej_msg->local_comm_id = rcv_msg->remote_comm_id;
965 cm_rej_set_msg_rejected(rej_msg, msg_rejected);
966 rej_msg->reason = reason;
967
968 if (ari && ari_length) {
969 cm_rej_set_reject_info_len(rej_msg, ari_length);
970 memcpy(rej_msg->ari, ari, ari_length);
971 }
972
973 ret = ib_post_send_mad(port->mad_agent, &msg->send_wr, &bad_send_wr);
974 if (ret)
975 cm_free_msg(msg);
976
977 return ret;
978}
979
980static inline int cm_is_active_peer(u64 local_ca_guid, u64 remote_ca_guid,
981 u32 local_qpn, u32 remote_qpn)
982{
983 return (be64_to_cpu(local_ca_guid) > be64_to_cpu(remote_ca_guid) ||
984 ((local_ca_guid == remote_ca_guid) &&
985 (be32_to_cpu(local_qpn) > be32_to_cpu(remote_qpn))));
986}
987
988static inline void cm_format_paths_from_req(struct cm_req_msg *req_msg,
989 struct ib_sa_path_rec *primary_path,
990 struct ib_sa_path_rec *alt_path)
991{
992 memset(primary_path, 0, sizeof *primary_path);
993 primary_path->dgid = req_msg->primary_local_gid;
994 primary_path->sgid = req_msg->primary_remote_gid;
995 primary_path->dlid = req_msg->primary_local_lid;
996 primary_path->slid = req_msg->primary_remote_lid;
997 primary_path->flow_label = cm_req_get_primary_flow_label(req_msg);
998 primary_path->hop_limit = req_msg->primary_hop_limit;
999 primary_path->traffic_class = req_msg->primary_traffic_class;
1000 primary_path->reversible = 1;
1001 primary_path->pkey = req_msg->pkey;
1002 primary_path->sl = cm_req_get_primary_sl(req_msg);
1003 primary_path->mtu_selector = IB_SA_EQ;
1004 primary_path->mtu = cm_req_get_path_mtu(req_msg);
1005 primary_path->rate_selector = IB_SA_EQ;
1006 primary_path->rate = cm_req_get_primary_packet_rate(req_msg);
1007 primary_path->packet_life_time_selector = IB_SA_EQ;
1008 primary_path->packet_life_time =
1009 cm_req_get_primary_local_ack_timeout(req_msg);
1010 primary_path->packet_life_time -= (primary_path->packet_life_time > 0);
1011
1012 if (req_msg->alt_local_lid) {
1013 memset(alt_path, 0, sizeof *alt_path);
1014 alt_path->dgid = req_msg->alt_local_gid;
1015 alt_path->sgid = req_msg->alt_remote_gid;
1016 alt_path->dlid = req_msg->alt_local_lid;
1017 alt_path->slid = req_msg->alt_remote_lid;
1018 alt_path->flow_label = cm_req_get_alt_flow_label(req_msg);
1019 alt_path->hop_limit = req_msg->alt_hop_limit;
1020 alt_path->traffic_class = req_msg->alt_traffic_class;
1021 alt_path->reversible = 1;
1022 alt_path->pkey = req_msg->pkey;
1023 alt_path->sl = cm_req_get_alt_sl(req_msg);
1024 alt_path->mtu_selector = IB_SA_EQ;
1025 alt_path->mtu = cm_req_get_path_mtu(req_msg);
1026 alt_path->rate_selector = IB_SA_EQ;
1027 alt_path->rate = cm_req_get_alt_packet_rate(req_msg);
1028 alt_path->packet_life_time_selector = IB_SA_EQ;
1029 alt_path->packet_life_time =
1030 cm_req_get_alt_local_ack_timeout(req_msg);
1031 alt_path->packet_life_time -= (alt_path->packet_life_time > 0);
1032 }
1033}
1034
1035static void cm_format_req_event(struct cm_work *work,
1036 struct cm_id_private *cm_id_priv,
1037 struct ib_cm_id *listen_id)
1038{
1039 struct cm_req_msg *req_msg;
1040 struct ib_cm_req_event_param *param;
1041
1042 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
1043 param = &work->cm_event.param.req_rcvd;
1044 param->listen_id = listen_id;
1045 param->device = cm_id_priv->av.port->mad_agent->device;
1046 param->port = cm_id_priv->av.port->port_num;
1047 param->primary_path = &work->path[0];
1048 if (req_msg->alt_local_lid)
1049 param->alternate_path = &work->path[1];
1050 else
1051 param->alternate_path = NULL;
1052 param->remote_ca_guid = req_msg->local_ca_guid;
1053 param->remote_qkey = be32_to_cpu(req_msg->local_qkey);
1054 param->remote_qpn = be32_to_cpu(cm_req_get_local_qpn(req_msg));
1055 param->qp_type = cm_req_get_qp_type(req_msg);
1056 param->starting_psn = be32_to_cpu(cm_req_get_starting_psn(req_msg));
1057 param->responder_resources = cm_req_get_init_depth(req_msg);
1058 param->initiator_depth = cm_req_get_resp_res(req_msg);
1059 param->local_cm_response_timeout =
1060 cm_req_get_remote_resp_timeout(req_msg);
1061 param->flow_control = cm_req_get_flow_ctrl(req_msg);
1062 param->remote_cm_response_timeout =
1063 cm_req_get_local_resp_timeout(req_msg);
1064 param->retry_count = cm_req_get_retry_count(req_msg);
1065 param->rnr_retry_count = cm_req_get_rnr_retry_count(req_msg);
1066 param->srq = cm_req_get_srq(req_msg);
1067 work->cm_event.private_data = &req_msg->private_data;
1068}
1069
1070static void cm_process_work(struct cm_id_private *cm_id_priv,
1071 struct cm_work *work)
1072{
1073 unsigned long flags;
1074 int ret;
1075
1076 /* We will typically only have the current event to report. */
1077 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, &work->cm_event);
1078 cm_free_work(work);
1079
1080 while (!ret && !atomic_add_negative(-1, &cm_id_priv->work_count)) {
1081 spin_lock_irqsave(&cm_id_priv->lock, flags);
1082 work = cm_dequeue_work(cm_id_priv);
1083 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1084 BUG_ON(!work);
1085 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id,
1086 &work->cm_event);
1087 cm_free_work(work);
1088 }
1089 cm_deref_id(cm_id_priv);
1090 if (ret)
1091 ib_destroy_cm_id(&cm_id_priv->id);
1092}
1093
1094static void cm_format_mra(struct cm_mra_msg *mra_msg,
1095 struct cm_id_private *cm_id_priv,
1096 enum cm_msg_response msg_mraed, u8 service_timeout,
1097 const void *private_data, u8 private_data_len)
1098{
1099 cm_format_mad_hdr(&mra_msg->hdr, CM_MRA_ATTR_ID, cm_id_priv->tid);
1100 cm_mra_set_msg_mraed(mra_msg, msg_mraed);
1101 mra_msg->local_comm_id = cm_id_priv->id.local_id;
1102 mra_msg->remote_comm_id = cm_id_priv->id.remote_id;
1103 cm_mra_set_service_timeout(mra_msg, service_timeout);
1104
1105 if (private_data && private_data_len)
1106 memcpy(mra_msg->private_data, private_data, private_data_len);
1107}
1108
1109static void cm_format_rej(struct cm_rej_msg *rej_msg,
1110 struct cm_id_private *cm_id_priv,
1111 enum ib_cm_rej_reason reason,
1112 void *ari,
1113 u8 ari_length,
1114 const void *private_data,
1115 u8 private_data_len)
1116{
1117 cm_format_mad_hdr(&rej_msg->hdr, CM_REJ_ATTR_ID, cm_id_priv->tid);
1118 rej_msg->remote_comm_id = cm_id_priv->id.remote_id;
1119
1120 switch(cm_id_priv->id.state) {
1121 case IB_CM_REQ_RCVD:
1122 rej_msg->local_comm_id = 0;
1123 cm_rej_set_msg_rejected(rej_msg, CM_MSG_RESPONSE_REQ);
1124 break;
1125 case IB_CM_MRA_REQ_SENT:
1126 rej_msg->local_comm_id = cm_id_priv->id.local_id;
1127 cm_rej_set_msg_rejected(rej_msg, CM_MSG_RESPONSE_REQ);
1128 break;
1129 case IB_CM_REP_RCVD:
1130 case IB_CM_MRA_REP_SENT:
1131 rej_msg->local_comm_id = cm_id_priv->id.local_id;
1132 cm_rej_set_msg_rejected(rej_msg, CM_MSG_RESPONSE_REP);
1133 break;
1134 default:
1135 rej_msg->local_comm_id = cm_id_priv->id.local_id;
1136 cm_rej_set_msg_rejected(rej_msg, CM_MSG_RESPONSE_OTHER);
1137 break;
1138 }
1139
1140 rej_msg->reason = reason;
1141 if (ari && ari_length) {
1142 cm_rej_set_reject_info_len(rej_msg, ari_length);
1143 memcpy(rej_msg->ari, ari, ari_length);
1144 }
1145
1146 if (private_data && private_data_len)
1147 memcpy(rej_msg->private_data, private_data, private_data_len);
1148}
1149
1150static void cm_dup_req_handler(struct cm_work *work,
1151 struct cm_id_private *cm_id_priv)
1152{
1153 struct ib_mad_send_buf *msg = NULL;
1154 struct ib_send_wr *bad_send_wr;
1155 unsigned long flags;
1156 int ret;
1157
1158 /* Quick state check to discard duplicate REQs. */
1159 if (cm_id_priv->id.state == IB_CM_REQ_RCVD)
1160 return;
1161
1162 ret = cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg);
1163 if (ret)
1164 return;
1165
1166 spin_lock_irqsave(&cm_id_priv->lock, flags);
1167 switch (cm_id_priv->id.state) {
1168 case IB_CM_MRA_REQ_SENT:
1169 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
1170 CM_MSG_RESPONSE_REQ, cm_id_priv->service_timeout,
1171 cm_id_priv->private_data,
1172 cm_id_priv->private_data_len);
1173 break;
1174 case IB_CM_TIMEWAIT:
1175 cm_format_rej((struct cm_rej_msg *) msg->mad, cm_id_priv,
1176 IB_CM_REJ_STALE_CONN, NULL, 0, NULL, 0);
1177 break;
1178 default:
1179 goto unlock;
1180 }
1181 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1182
1183 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent, &msg->send_wr,
1184 &bad_send_wr);
1185 if (ret)
1186 goto free;
1187 return;
1188
1189unlock: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1190free: cm_free_msg(msg);
1191}
1192
1193static struct cm_id_private * cm_match_req(struct cm_work *work,
1194 struct cm_id_private *cm_id_priv)
1195{
1196 struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv;
1197 struct cm_timewait_info *timewait_info;
1198 struct cm_req_msg *req_msg;
1199 unsigned long flags;
1200
1201 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
1202
1203 /* Check for duplicate REQ and stale connections. */
1204 spin_lock_irqsave(&cm.lock, flags);
1205 timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info);
1206 if (!timewait_info)
1207 timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info);
1208
1209 if (timewait_info) {
1210 cur_cm_id_priv = cm_get_id(timewait_info->work.local_id,
1211 timewait_info->work.remote_id);
1212 spin_unlock_irqrestore(&cm.lock, flags);
1213 if (cur_cm_id_priv) {
1214 cm_dup_req_handler(work, cur_cm_id_priv);
1215 cm_deref_id(cur_cm_id_priv);
1216 } else
1217 cm_issue_rej(work->port, work->mad_recv_wc,
1218 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ,
1219 NULL, 0);
1220 goto error;
1221 }
1222
1223 /* Find matching listen request. */
1224 listen_cm_id_priv = cm_find_listen(req_msg->service_id);
1225 if (!listen_cm_id_priv) {
1226 spin_unlock_irqrestore(&cm.lock, flags);
1227 cm_issue_rej(work->port, work->mad_recv_wc,
1228 IB_CM_REJ_INVALID_SERVICE_ID, CM_MSG_RESPONSE_REQ,
1229 NULL, 0);
1230 goto error;
1231 }
1232 atomic_inc(&listen_cm_id_priv->refcount);
1233 atomic_inc(&cm_id_priv->refcount);
1234 cm_id_priv->id.state = IB_CM_REQ_RCVD;
1235 atomic_inc(&cm_id_priv->work_count);
1236 spin_unlock_irqrestore(&cm.lock, flags);
1237 return listen_cm_id_priv;
1238
1239error: cm_cleanup_timewait(cm_id_priv->timewait_info);
1240 return NULL;
1241}
1242
1243static int cm_req_handler(struct cm_work *work)
1244{
1245 struct ib_cm_id *cm_id;
1246 struct cm_id_private *cm_id_priv, *listen_cm_id_priv;
1247 struct cm_req_msg *req_msg;
1248 int ret;
1249
1250 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
1251
1252 cm_id = ib_create_cm_id(NULL, NULL);
1253 if (IS_ERR(cm_id))
1254 return PTR_ERR(cm_id);
1255
1256 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1257 cm_id_priv->id.remote_id = req_msg->local_comm_id;
1258 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
1259 &cm_id_priv->av);
1260 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
1261 id.local_id);
1262 if (IS_ERR(cm_id_priv->timewait_info)) {
1263 ret = PTR_ERR(cm_id_priv->timewait_info);
1264 goto error1;
1265 }
1266 cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id;
1267 cm_id_priv->timewait_info->remote_ca_guid = req_msg->local_ca_guid;
1268 cm_id_priv->timewait_info->remote_qpn = cm_req_get_local_qpn(req_msg);
1269
1270 listen_cm_id_priv = cm_match_req(work, cm_id_priv);
1271 if (!listen_cm_id_priv) {
1272 ret = -EINVAL;
1273 goto error2;
1274 }
1275
1276 cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
1277 cm_id_priv->id.context = listen_cm_id_priv->id.context;
1278 cm_id_priv->id.service_id = req_msg->service_id;
1279 cm_id_priv->id.service_mask = ~0ULL;
1280
1281 cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);
1282 ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
1283 if (ret)
1284 goto error3;
1285 if (req_msg->alt_local_lid) {
1286 ret = cm_init_av_by_path(&work->path[1], &cm_id_priv->alt_av);
1287 if (ret)
1288 goto error3;
1289 }
1290 cm_id_priv->tid = req_msg->hdr.tid;
1291 cm_id_priv->timeout_ms = cm_convert_to_ms(
1292 cm_req_get_local_resp_timeout(req_msg));
1293 cm_id_priv->max_cm_retries = cm_req_get_max_cm_retries(req_msg);
1294 cm_id_priv->remote_qpn = cm_req_get_local_qpn(req_msg);
1295 cm_id_priv->initiator_depth = cm_req_get_resp_res(req_msg);
1296 cm_id_priv->responder_resources = cm_req_get_init_depth(req_msg);
1297 cm_id_priv->path_mtu = cm_req_get_path_mtu(req_msg);
1298 cm_id_priv->sq_psn = cm_req_get_starting_psn(req_msg);
1299 cm_id_priv->local_ack_timeout =
1300 cm_req_get_primary_local_ack_timeout(req_msg);
1301 cm_id_priv->retry_count = cm_req_get_retry_count(req_msg);
1302 cm_id_priv->rnr_retry_count = cm_req_get_rnr_retry_count(req_msg);
1303
1304 cm_format_req_event(work, cm_id_priv, &listen_cm_id_priv->id);
1305 cm_process_work(cm_id_priv, work);
1306 cm_deref_id(listen_cm_id_priv);
1307 return 0;
1308
1309error3: atomic_dec(&cm_id_priv->refcount);
1310 cm_deref_id(listen_cm_id_priv);
1311 cm_cleanup_timewait(cm_id_priv->timewait_info);
1312error2: kfree(cm_id_priv->timewait_info);
1313error1: ib_destroy_cm_id(&cm_id_priv->id);
1314 return ret;
1315}
1316
1317static void cm_format_rep(struct cm_rep_msg *rep_msg,
1318 struct cm_id_private *cm_id_priv,
1319 struct ib_cm_rep_param *param)
1320{
1321 cm_format_mad_hdr(&rep_msg->hdr, CM_REP_ATTR_ID, cm_id_priv->tid);
1322 rep_msg->local_comm_id = cm_id_priv->id.local_id;
1323 rep_msg->remote_comm_id = cm_id_priv->id.remote_id;
1324 cm_rep_set_local_qpn(rep_msg, cpu_to_be32(param->qp_num));
1325 cm_rep_set_starting_psn(rep_msg, cpu_to_be32(param->starting_psn));
1326 rep_msg->resp_resources = param->responder_resources;
1327 rep_msg->initiator_depth = param->initiator_depth;
1328 cm_rep_set_target_ack_delay(rep_msg, param->target_ack_delay);
1329 cm_rep_set_failover(rep_msg, param->failover_accepted);
1330 cm_rep_set_flow_ctrl(rep_msg, param->flow_control);
1331 cm_rep_set_rnr_retry_count(rep_msg, param->rnr_retry_count);
1332 cm_rep_set_srq(rep_msg, param->srq);
1333 rep_msg->local_ca_guid = cm_id_priv->av.port->cm_dev->ca_guid;
1334
1335 if (param->private_data && param->private_data_len)
1336 memcpy(rep_msg->private_data, param->private_data,
1337 param->private_data_len);
1338}
1339
1340int ib_send_cm_rep(struct ib_cm_id *cm_id,
1341 struct ib_cm_rep_param *param)
1342{
1343 struct cm_id_private *cm_id_priv;
1344 struct ib_mad_send_buf *msg;
1345 struct cm_rep_msg *rep_msg;
1346 struct ib_send_wr *bad_send_wr;
1347 unsigned long flags;
1348 int ret;
1349
1350 if (param->private_data &&
1351 param->private_data_len > IB_CM_REP_PRIVATE_DATA_SIZE)
1352 return -EINVAL;
1353
1354 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1355 spin_lock_irqsave(&cm_id_priv->lock, flags);
1356 if (cm_id->state != IB_CM_REQ_RCVD &&
1357 cm_id->state != IB_CM_MRA_REQ_SENT) {
1358 ret = -EINVAL;
1359 goto out;
1360 }
1361
1362 ret = cm_alloc_msg(cm_id_priv, &msg);
1363 if (ret)
1364 goto out;
1365
1366 rep_msg = (struct cm_rep_msg *) msg->mad;
1367 cm_format_rep(rep_msg, cm_id_priv, param);
1368 msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
1369 msg->context[1] = (void *) (unsigned long) IB_CM_REP_SENT;
1370
1371 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
1372 &msg->send_wr, &bad_send_wr);
1373 if (ret) {
1374 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1375 cm_free_msg(msg);
1376 return ret;
1377 }
1378
1379 cm_id->state = IB_CM_REP_SENT;
1380 cm_id_priv->msg = msg;
1381 cm_id_priv->initiator_depth = param->initiator_depth;
1382 cm_id_priv->responder_resources = param->responder_resources;
1383 cm_id_priv->rq_psn = cm_rep_get_starting_psn(rep_msg);
1384 cm_id_priv->local_qpn = cm_rep_get_local_qpn(rep_msg);
1385
1386out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1387 return ret;
1388}
1389EXPORT_SYMBOL(ib_send_cm_rep);
1390
1391static void cm_format_rtu(struct cm_rtu_msg *rtu_msg,
1392 struct cm_id_private *cm_id_priv,
1393 const void *private_data,
1394 u8 private_data_len)
1395{
1396 cm_format_mad_hdr(&rtu_msg->hdr, CM_RTU_ATTR_ID, cm_id_priv->tid);
1397 rtu_msg->local_comm_id = cm_id_priv->id.local_id;
1398 rtu_msg->remote_comm_id = cm_id_priv->id.remote_id;
1399
1400 if (private_data && private_data_len)
1401 memcpy(rtu_msg->private_data, private_data, private_data_len);
1402}
1403
1404int ib_send_cm_rtu(struct ib_cm_id *cm_id,
1405 const void *private_data,
1406 u8 private_data_len)
1407{
1408 struct cm_id_private *cm_id_priv;
1409 struct ib_mad_send_buf *msg;
1410 struct ib_send_wr *bad_send_wr;
1411 unsigned long flags;
1412 void *data;
1413 int ret;
1414
1415 if (private_data && private_data_len > IB_CM_RTU_PRIVATE_DATA_SIZE)
1416 return -EINVAL;
1417
1418 data = cm_copy_private_data(private_data, private_data_len);
1419 if (IS_ERR(data))
1420 return PTR_ERR(data);
1421
1422 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1423 spin_lock_irqsave(&cm_id_priv->lock, flags);
1424 if (cm_id->state != IB_CM_REP_RCVD &&
1425 cm_id->state != IB_CM_MRA_REP_SENT) {
1426 ret = -EINVAL;
1427 goto error;
1428 }
1429
1430 ret = cm_alloc_msg(cm_id_priv, &msg);
1431 if (ret)
1432 goto error;
1433
1434 cm_format_rtu((struct cm_rtu_msg *) msg->mad, cm_id_priv,
1435 private_data, private_data_len);
1436
1437 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
1438 &msg->send_wr, &bad_send_wr);
1439 if (ret) {
1440 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1441 cm_free_msg(msg);
1442 kfree(data);
1443 return ret;
1444 }
1445
1446 cm_id->state = IB_CM_ESTABLISHED;
1447 cm_set_private_data(cm_id_priv, data, private_data_len);
1448 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1449 return 0;
1450
1451error: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1452 kfree(data);
1453 return ret;
1454}
1455EXPORT_SYMBOL(ib_send_cm_rtu);
1456
1457static void cm_format_rep_event(struct cm_work *work)
1458{
1459 struct cm_rep_msg *rep_msg;
1460 struct ib_cm_rep_event_param *param;
1461
1462 rep_msg = (struct cm_rep_msg *)work->mad_recv_wc->recv_buf.mad;
1463 param = &work->cm_event.param.rep_rcvd;
1464 param->remote_ca_guid = rep_msg->local_ca_guid;
1465 param->remote_qkey = be32_to_cpu(rep_msg->local_qkey);
1466 param->remote_qpn = be32_to_cpu(cm_rep_get_local_qpn(rep_msg));
1467 param->starting_psn = be32_to_cpu(cm_rep_get_starting_psn(rep_msg));
1468 param->responder_resources = rep_msg->initiator_depth;
1469 param->initiator_depth = rep_msg->resp_resources;
1470 param->target_ack_delay = cm_rep_get_target_ack_delay(rep_msg);
1471 param->failover_accepted = cm_rep_get_failover(rep_msg);
1472 param->flow_control = cm_rep_get_flow_ctrl(rep_msg);
1473 param->rnr_retry_count = cm_rep_get_rnr_retry_count(rep_msg);
1474 param->srq = cm_rep_get_srq(rep_msg);
1475 work->cm_event.private_data = &rep_msg->private_data;
1476}
1477
1478static void cm_dup_rep_handler(struct cm_work *work)
1479{
1480 struct cm_id_private *cm_id_priv;
1481 struct cm_rep_msg *rep_msg;
1482 struct ib_mad_send_buf *msg = NULL;
1483 struct ib_send_wr *bad_send_wr;
1484 unsigned long flags;
1485 int ret;
1486
1487 rep_msg = (struct cm_rep_msg *) work->mad_recv_wc->recv_buf.mad;
1488 cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id,
1489 rep_msg->local_comm_id);
1490 if (!cm_id_priv)
1491 return;
1492
1493 ret = cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg);
1494 if (ret)
1495 goto deref;
1496
1497 spin_lock_irqsave(&cm_id_priv->lock, flags);
1498 if (cm_id_priv->id.state == IB_CM_ESTABLISHED)
1499 cm_format_rtu((struct cm_rtu_msg *) msg->mad, cm_id_priv,
1500 cm_id_priv->private_data,
1501 cm_id_priv->private_data_len);
1502 else if (cm_id_priv->id.state == IB_CM_MRA_REP_SENT)
1503 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
1504 CM_MSG_RESPONSE_REP, cm_id_priv->service_timeout,
1505 cm_id_priv->private_data,
1506 cm_id_priv->private_data_len);
1507 else
1508 goto unlock;
1509 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1510
1511 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent, &msg->send_wr,
1512 &bad_send_wr);
1513 if (ret)
1514 goto free;
1515 goto deref;
1516
1517unlock: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1518free: cm_free_msg(msg);
1519deref: cm_deref_id(cm_id_priv);
1520}
1521
1522static int cm_rep_handler(struct cm_work *work)
1523{
1524 struct cm_id_private *cm_id_priv;
1525 struct cm_rep_msg *rep_msg;
1526 unsigned long flags;
1527 int ret;
1528
1529 rep_msg = (struct cm_rep_msg *)work->mad_recv_wc->recv_buf.mad;
1530 cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0);
1531 if (!cm_id_priv) {
1532 cm_dup_rep_handler(work);
1533 return -EINVAL;
1534 }
1535
1536 cm_id_priv->timewait_info->work.remote_id = rep_msg->local_comm_id;
1537 cm_id_priv->timewait_info->remote_ca_guid = rep_msg->local_ca_guid;
1538 cm_id_priv->timewait_info->remote_qpn = cm_rep_get_local_qpn(rep_msg);
1539
1540 spin_lock_irqsave(&cm.lock, flags);
1541 /* Check for duplicate REP. */
1542 if (cm_insert_remote_id(cm_id_priv->timewait_info)) {
1543 spin_unlock_irqrestore(&cm.lock, flags);
1544 ret = -EINVAL;
1545 goto error;
1546 }
1547 /* Check for a stale connection. */
1548 if (cm_insert_remote_qpn(cm_id_priv->timewait_info)) {
1549 spin_unlock_irqrestore(&cm.lock, flags);
1550 cm_issue_rej(work->port, work->mad_recv_wc,
1551 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP,
1552 NULL, 0);
1553 ret = -EINVAL;
1554 goto error;
1555 }
1556 spin_unlock_irqrestore(&cm.lock, flags);
1557
1558 cm_format_rep_event(work);
1559
1560 spin_lock_irqsave(&cm_id_priv->lock, flags);
1561 switch (cm_id_priv->id.state) {
1562 case IB_CM_REQ_SENT:
1563 case IB_CM_MRA_REQ_RCVD:
1564 break;
1565 default:
1566 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1567 ret = -EINVAL;
1568 goto error;
1569 }
1570 cm_id_priv->id.state = IB_CM_REP_RCVD;
1571 cm_id_priv->id.remote_id = rep_msg->local_comm_id;
1572 cm_id_priv->remote_qpn = cm_rep_get_local_qpn(rep_msg);
1573 cm_id_priv->initiator_depth = rep_msg->resp_resources;
1574 cm_id_priv->responder_resources = rep_msg->initiator_depth;
1575 cm_id_priv->sq_psn = cm_rep_get_starting_psn(rep_msg);
1576 cm_id_priv->rnr_retry_count = cm_rep_get_rnr_retry_count(rep_msg);
1577
1578 /* todo: handle peer_to_peer */
1579
1580 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
1581 (unsigned long) cm_id_priv->msg);
1582 ret = atomic_inc_and_test(&cm_id_priv->work_count);
1583 if (!ret)
1584 list_add_tail(&work->list, &cm_id_priv->work_list);
1585 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1586
1587 if (ret)
1588 cm_process_work(cm_id_priv, work);
1589 else
1590 cm_deref_id(cm_id_priv);
1591 return 0;
1592
1593error: cm_cleanup_timewait(cm_id_priv->timewait_info);
1594 cm_deref_id(cm_id_priv);
1595 return ret;
1596}
1597
1598static int cm_establish_handler(struct cm_work *work)
1599{
1600 struct cm_id_private *cm_id_priv;
1601 unsigned long flags;
1602 int ret;
1603
1604 /* See comment in ib_cm_establish about lookup. */
1605 cm_id_priv = cm_acquire_id(work->local_id, work->remote_id);
1606 if (!cm_id_priv)
1607 return -EINVAL;
1608
1609 spin_lock_irqsave(&cm_id_priv->lock, flags);
1610 if (cm_id_priv->id.state != IB_CM_ESTABLISHED) {
1611 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1612 goto out;
1613 }
1614
1615 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
1616 (unsigned long) cm_id_priv->msg);
1617 ret = atomic_inc_and_test(&cm_id_priv->work_count);
1618 if (!ret)
1619 list_add_tail(&work->list, &cm_id_priv->work_list);
1620 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1621
1622 if (ret)
1623 cm_process_work(cm_id_priv, work);
1624 else
1625 cm_deref_id(cm_id_priv);
1626 return 0;
1627out:
1628 cm_deref_id(cm_id_priv);
1629 return -EINVAL;
1630}
1631
1632static int cm_rtu_handler(struct cm_work *work)
1633{
1634 struct cm_id_private *cm_id_priv;
1635 struct cm_rtu_msg *rtu_msg;
1636 unsigned long flags;
1637 int ret;
1638
1639 rtu_msg = (struct cm_rtu_msg *)work->mad_recv_wc->recv_buf.mad;
1640 cm_id_priv = cm_acquire_id(rtu_msg->remote_comm_id,
1641 rtu_msg->local_comm_id);
1642 if (!cm_id_priv)
1643 return -EINVAL;
1644
1645 work->cm_event.private_data = &rtu_msg->private_data;
1646
1647 spin_lock_irqsave(&cm_id_priv->lock, flags);
1648 if (cm_id_priv->id.state != IB_CM_REP_SENT &&
1649 cm_id_priv->id.state != IB_CM_MRA_REP_RCVD) {
1650 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1651 goto out;
1652 }
1653 cm_id_priv->id.state = IB_CM_ESTABLISHED;
1654
1655 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
1656 (unsigned long) cm_id_priv->msg);
1657 ret = atomic_inc_and_test(&cm_id_priv->work_count);
1658 if (!ret)
1659 list_add_tail(&work->list, &cm_id_priv->work_list);
1660 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1661
1662 if (ret)
1663 cm_process_work(cm_id_priv, work);
1664 else
1665 cm_deref_id(cm_id_priv);
1666 return 0;
1667out:
1668 cm_deref_id(cm_id_priv);
1669 return -EINVAL;
1670}
1671
1672static void cm_format_dreq(struct cm_dreq_msg *dreq_msg,
1673 struct cm_id_private *cm_id_priv,
1674 const void *private_data,
1675 u8 private_data_len)
1676{
1677 cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID,
1678 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_DREQ));
1679 dreq_msg->local_comm_id = cm_id_priv->id.local_id;
1680 dreq_msg->remote_comm_id = cm_id_priv->id.remote_id;
1681 cm_dreq_set_remote_qpn(dreq_msg, cm_id_priv->remote_qpn);
1682
1683 if (private_data && private_data_len)
1684 memcpy(dreq_msg->private_data, private_data, private_data_len);
1685}
1686
1687int ib_send_cm_dreq(struct ib_cm_id *cm_id,
1688 const void *private_data,
1689 u8 private_data_len)
1690{
1691 struct cm_id_private *cm_id_priv;
1692 struct ib_mad_send_buf *msg;
1693 struct ib_send_wr *bad_send_wr;
1694 unsigned long flags;
1695 int ret;
1696
1697 if (private_data && private_data_len > IB_CM_DREQ_PRIVATE_DATA_SIZE)
1698 return -EINVAL;
1699
1700 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1701 spin_lock_irqsave(&cm_id_priv->lock, flags);
1702 if (cm_id->state != IB_CM_ESTABLISHED) {
1703 ret = -EINVAL;
1704 goto out;
1705 }
1706
1707 ret = cm_alloc_msg(cm_id_priv, &msg);
1708 if (ret) {
1709 cm_enter_timewait(cm_id_priv);
1710 goto out;
1711 }
1712
1713 cm_format_dreq((struct cm_dreq_msg *) msg->mad, cm_id_priv,
1714 private_data, private_data_len);
1715 msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
1716 msg->context[1] = (void *) (unsigned long) IB_CM_DREQ_SENT;
1717
1718 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
1719 &msg->send_wr, &bad_send_wr);
1720 if (ret) {
1721 cm_enter_timewait(cm_id_priv);
1722 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1723 cm_free_msg(msg);
1724 return ret;
1725 }
1726
1727 cm_id->state = IB_CM_DREQ_SENT;
1728 cm_id_priv->msg = msg;
1729out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1730 return ret;
1731}
1732EXPORT_SYMBOL(ib_send_cm_dreq);
1733
1734static void cm_format_drep(struct cm_drep_msg *drep_msg,
1735 struct cm_id_private *cm_id_priv,
1736 const void *private_data,
1737 u8 private_data_len)
1738{
1739 cm_format_mad_hdr(&drep_msg->hdr, CM_DREP_ATTR_ID, cm_id_priv->tid);
1740 drep_msg->local_comm_id = cm_id_priv->id.local_id;
1741 drep_msg->remote_comm_id = cm_id_priv->id.remote_id;
1742
1743 if (private_data && private_data_len)
1744 memcpy(drep_msg->private_data, private_data, private_data_len);
1745}
1746
1747int ib_send_cm_drep(struct ib_cm_id *cm_id,
1748 const void *private_data,
1749 u8 private_data_len)
1750{
1751 struct cm_id_private *cm_id_priv;
1752 struct ib_mad_send_buf *msg;
1753 struct ib_send_wr *bad_send_wr;
1754 unsigned long flags;
1755 void *data;
1756 int ret;
1757
1758 if (private_data && private_data_len > IB_CM_DREP_PRIVATE_DATA_SIZE)
1759 return -EINVAL;
1760
1761 data = cm_copy_private_data(private_data, private_data_len);
1762 if (IS_ERR(data))
1763 return PTR_ERR(data);
1764
1765 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1766 spin_lock_irqsave(&cm_id_priv->lock, flags);
1767 if (cm_id->state != IB_CM_DREQ_RCVD) {
1768 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1769 kfree(data);
1770 return -EINVAL;
1771 }
1772
1773 cm_set_private_data(cm_id_priv, data, private_data_len);
1774 cm_enter_timewait(cm_id_priv);
1775
1776 ret = cm_alloc_msg(cm_id_priv, &msg);
1777 if (ret)
1778 goto out;
1779
1780 cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv,
1781 private_data, private_data_len);
1782
1783 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent, &msg->send_wr,
1784 &bad_send_wr);
1785 if (ret) {
1786 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1787 cm_free_msg(msg);
1788 return ret;
1789 }
1790
1791out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1792 return ret;
1793}
1794EXPORT_SYMBOL(ib_send_cm_drep);
1795
1796static int cm_dreq_handler(struct cm_work *work)
1797{
1798 struct cm_id_private *cm_id_priv;
1799 struct cm_dreq_msg *dreq_msg;
1800 struct ib_mad_send_buf *msg = NULL;
1801 struct ib_send_wr *bad_send_wr;
1802 unsigned long flags;
1803 int ret;
1804
1805 dreq_msg = (struct cm_dreq_msg *)work->mad_recv_wc->recv_buf.mad;
1806 cm_id_priv = cm_acquire_id(dreq_msg->remote_comm_id,
1807 dreq_msg->local_comm_id);
1808 if (!cm_id_priv)
1809 return -EINVAL;
1810
1811 work->cm_event.private_data = &dreq_msg->private_data;
1812
1813 spin_lock_irqsave(&cm_id_priv->lock, flags);
1814 if (cm_id_priv->local_qpn != cm_dreq_get_remote_qpn(dreq_msg))
1815 goto unlock;
1816
1817 switch (cm_id_priv->id.state) {
1818 case IB_CM_REP_SENT:
1819 case IB_CM_DREQ_SENT:
1820 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
1821 (unsigned long) cm_id_priv->msg);
1822 break;
1823 case IB_CM_ESTABLISHED:
1824 case IB_CM_MRA_REP_RCVD:
1825 break;
1826 case IB_CM_TIMEWAIT:
1827 if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))
1828 goto unlock;
1829
1830 cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv,
1831 cm_id_priv->private_data,
1832 cm_id_priv->private_data_len);
1833 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1834
1835 if (ib_post_send_mad(cm_id_priv->av.port->mad_agent,
1836 &msg->send_wr, &bad_send_wr))
1837 cm_free_msg(msg);
1838 goto deref;
1839 default:
1840 goto unlock;
1841 }
1842 cm_id_priv->id.state = IB_CM_DREQ_RCVD;
1843 cm_id_priv->tid = dreq_msg->hdr.tid;
1844 ret = atomic_inc_and_test(&cm_id_priv->work_count);
1845 if (!ret)
1846 list_add_tail(&work->list, &cm_id_priv->work_list);
1847 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1848
1849 if (ret)
1850 cm_process_work(cm_id_priv, work);
1851 else
1852 cm_deref_id(cm_id_priv);
1853 return 0;
1854
1855unlock: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1856deref: cm_deref_id(cm_id_priv);
1857 return -EINVAL;
1858}
1859
1860static int cm_drep_handler(struct cm_work *work)
1861{
1862 struct cm_id_private *cm_id_priv;
1863 struct cm_drep_msg *drep_msg;
1864 unsigned long flags;
1865 int ret;
1866
1867 drep_msg = (struct cm_drep_msg *)work->mad_recv_wc->recv_buf.mad;
1868 cm_id_priv = cm_acquire_id(drep_msg->remote_comm_id,
1869 drep_msg->local_comm_id);
1870 if (!cm_id_priv)
1871 return -EINVAL;
1872
1873 work->cm_event.private_data = &drep_msg->private_data;
1874
1875 spin_lock_irqsave(&cm_id_priv->lock, flags);
1876 if (cm_id_priv->id.state != IB_CM_DREQ_SENT &&
1877 cm_id_priv->id.state != IB_CM_DREQ_RCVD) {
1878 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1879 goto out;
1880 }
1881 cm_enter_timewait(cm_id_priv);
1882
1883 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
1884 (unsigned long) cm_id_priv->msg);
1885 ret = atomic_inc_and_test(&cm_id_priv->work_count);
1886 if (!ret)
1887 list_add_tail(&work->list, &cm_id_priv->work_list);
1888 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1889
1890 if (ret)
1891 cm_process_work(cm_id_priv, work);
1892 else
1893 cm_deref_id(cm_id_priv);
1894 return 0;
1895out:
1896 cm_deref_id(cm_id_priv);
1897 return -EINVAL;
1898}
1899
1900int ib_send_cm_rej(struct ib_cm_id *cm_id,
1901 enum ib_cm_rej_reason reason,
1902 void *ari,
1903 u8 ari_length,
1904 const void *private_data,
1905 u8 private_data_len)
1906{
1907 struct cm_id_private *cm_id_priv;
1908 struct ib_mad_send_buf *msg;
1909 struct ib_send_wr *bad_send_wr;
1910 unsigned long flags;
1911 int ret;
1912
1913 if ((private_data && private_data_len > IB_CM_REJ_PRIVATE_DATA_SIZE) ||
1914 (ari && ari_length > IB_CM_REJ_ARI_LENGTH))
1915 return -EINVAL;
1916
1917 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1918
1919 spin_lock_irqsave(&cm_id_priv->lock, flags);
1920 switch (cm_id->state) {
1921 case IB_CM_REQ_SENT:
1922 case IB_CM_MRA_REQ_RCVD:
1923 case IB_CM_REQ_RCVD:
1924 case IB_CM_MRA_REQ_SENT:
1925 case IB_CM_REP_RCVD:
1926 case IB_CM_MRA_REP_SENT:
1927 ret = cm_alloc_msg(cm_id_priv, &msg);
1928 if (!ret)
1929 cm_format_rej((struct cm_rej_msg *) msg->mad,
1930 cm_id_priv, reason, ari, ari_length,
1931 private_data, private_data_len);
1932
1933 cm_reset_to_idle(cm_id_priv);
1934 break;
1935 case IB_CM_REP_SENT:
1936 case IB_CM_MRA_REP_RCVD:
1937 ret = cm_alloc_msg(cm_id_priv, &msg);
1938 if (!ret)
1939 cm_format_rej((struct cm_rej_msg *) msg->mad,
1940 cm_id_priv, reason, ari, ari_length,
1941 private_data, private_data_len);
1942
1943 cm_enter_timewait(cm_id_priv);
1944 break;
1945 default:
1946 ret = -EINVAL;
1947 goto out;
1948 }
1949
1950 if (ret)
1951 goto out;
1952
1953 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
1954 &msg->send_wr, &bad_send_wr);
1955 if (ret)
1956 cm_free_msg(msg);
1957
1958out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1959 return ret;
1960}
1961EXPORT_SYMBOL(ib_send_cm_rej);
1962
1963static void cm_format_rej_event(struct cm_work *work)
1964{
1965 struct cm_rej_msg *rej_msg;
1966 struct ib_cm_rej_event_param *param;
1967
1968 rej_msg = (struct cm_rej_msg *)work->mad_recv_wc->recv_buf.mad;
1969 param = &work->cm_event.param.rej_rcvd;
1970 param->ari = rej_msg->ari;
1971 param->ari_length = cm_rej_get_reject_info_len(rej_msg);
1972 param->reason = rej_msg->reason;
1973 work->cm_event.private_data = &rej_msg->private_data;
1974}
1975
1976static struct cm_id_private * cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)
1977{
1978 struct cm_timewait_info *timewait_info;
1979 struct cm_id_private *cm_id_priv;
1980 unsigned long flags;
1981 u32 remote_id;
1982
1983 remote_id = rej_msg->local_comm_id;
1984
1985 if (rej_msg->reason == IB_CM_REJ_TIMEOUT) {
1986 spin_lock_irqsave(&cm.lock, flags);
1987 timewait_info = cm_find_remote_id( *((u64 *) rej_msg->ari),
1988 remote_id);
1989 if (!timewait_info) {
1990 spin_unlock_irqrestore(&cm.lock, flags);
1991 return NULL;
1992 }
1993 cm_id_priv = idr_find(&cm.local_id_table,
1994 (int) timewait_info->work.local_id);
1995 if (cm_id_priv) {
1996 if (cm_id_priv->id.remote_id == remote_id)
1997 atomic_inc(&cm_id_priv->refcount);
1998 else
1999 cm_id_priv = NULL;
2000 }
2001 spin_unlock_irqrestore(&cm.lock, flags);
2002 } else if (cm_rej_get_msg_rejected(rej_msg) == CM_MSG_RESPONSE_REQ)
2003 cm_id_priv = cm_acquire_id(rej_msg->remote_comm_id, 0);
2004 else
2005 cm_id_priv = cm_acquire_id(rej_msg->remote_comm_id, remote_id);
2006
2007 return cm_id_priv;
2008}
2009
2010static int cm_rej_handler(struct cm_work *work)
2011{
2012 struct cm_id_private *cm_id_priv;
2013 struct cm_rej_msg *rej_msg;
2014 unsigned long flags;
2015 int ret;
2016
2017 rej_msg = (struct cm_rej_msg *)work->mad_recv_wc->recv_buf.mad;
2018 cm_id_priv = cm_acquire_rejected_id(rej_msg);
2019 if (!cm_id_priv)
2020 return -EINVAL;
2021
2022 cm_format_rej_event(work);
2023
2024 spin_lock_irqsave(&cm_id_priv->lock, flags);
2025 switch (cm_id_priv->id.state) {
2026 case IB_CM_REQ_SENT:
2027 case IB_CM_MRA_REQ_RCVD:
2028 case IB_CM_REP_SENT:
2029 case IB_CM_MRA_REP_RCVD:
2030 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
2031 (unsigned long) cm_id_priv->msg);
2032 /* fall through */
2033 case IB_CM_REQ_RCVD:
2034 case IB_CM_MRA_REQ_SENT:
2035 if (rej_msg->reason == IB_CM_REJ_STALE_CONN)
2036 cm_enter_timewait(cm_id_priv);
2037 else
2038 cm_reset_to_idle(cm_id_priv);
2039 break;
2040 case IB_CM_DREQ_SENT:
2041 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
2042 (unsigned long) cm_id_priv->msg);
2043 /* fall through */
2044 case IB_CM_REP_RCVD:
2045 case IB_CM_MRA_REP_SENT:
2046 case IB_CM_ESTABLISHED:
2047 cm_enter_timewait(cm_id_priv);
2048 break;
2049 default:
2050 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2051 ret = -EINVAL;
2052 goto out;
2053 }
2054
2055 ret = atomic_inc_and_test(&cm_id_priv->work_count);
2056 if (!ret)
2057 list_add_tail(&work->list, &cm_id_priv->work_list);
2058 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2059
2060 if (ret)
2061 cm_process_work(cm_id_priv, work);
2062 else
2063 cm_deref_id(cm_id_priv);
2064 return 0;
2065out:
2066 cm_deref_id(cm_id_priv);
2067 return -EINVAL;
2068}
2069
2070int ib_send_cm_mra(struct ib_cm_id *cm_id,
2071 u8 service_timeout,
2072 const void *private_data,
2073 u8 private_data_len)
2074{
2075 struct cm_id_private *cm_id_priv;
2076 struct ib_mad_send_buf *msg;
2077 struct ib_send_wr *bad_send_wr;
2078 void *data;
2079 unsigned long flags;
2080 int ret;
2081
2082 if (private_data && private_data_len > IB_CM_MRA_PRIVATE_DATA_SIZE)
2083 return -EINVAL;
2084
2085 data = cm_copy_private_data(private_data, private_data_len);
2086 if (IS_ERR(data))
2087 return PTR_ERR(data);
2088
2089 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2090
2091 spin_lock_irqsave(&cm_id_priv->lock, flags);
2092 switch(cm_id_priv->id.state) {
2093 case IB_CM_REQ_RCVD:
2094 ret = cm_alloc_msg(cm_id_priv, &msg);
2095 if (ret)
2096 goto error1;
2097
2098 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
2099 CM_MSG_RESPONSE_REQ, service_timeout,
2100 private_data, private_data_len);
2101 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2102 &msg->send_wr, &bad_send_wr);
2103 if (ret)
2104 goto error2;
2105 cm_id->state = IB_CM_MRA_REQ_SENT;
2106 break;
2107 case IB_CM_REP_RCVD:
2108 ret = cm_alloc_msg(cm_id_priv, &msg);
2109 if (ret)
2110 goto error1;
2111
2112 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
2113 CM_MSG_RESPONSE_REP, service_timeout,
2114 private_data, private_data_len);
2115 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2116 &msg->send_wr, &bad_send_wr);
2117 if (ret)
2118 goto error2;
2119 cm_id->state = IB_CM_MRA_REP_SENT;
2120 break;
2121 case IB_CM_ESTABLISHED:
2122 ret = cm_alloc_msg(cm_id_priv, &msg);
2123 if (ret)
2124 goto error1;
2125
2126 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
2127 CM_MSG_RESPONSE_OTHER, service_timeout,
2128 private_data, private_data_len);
2129 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2130 &msg->send_wr, &bad_send_wr);
2131 if (ret)
2132 goto error2;
2133 cm_id->lap_state = IB_CM_MRA_LAP_SENT;
2134 break;
2135 default:
2136 ret = -EINVAL;
2137 goto error1;
2138 }
2139 cm_id_priv->service_timeout = service_timeout;
2140 cm_set_private_data(cm_id_priv, data, private_data_len);
2141 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2142 return 0;
2143
2144error1: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2145 kfree(data);
2146 return ret;
2147
2148error2: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2149 kfree(data);
2150 cm_free_msg(msg);
2151 return ret;
2152}
2153EXPORT_SYMBOL(ib_send_cm_mra);
2154
2155static struct cm_id_private * cm_acquire_mraed_id(struct cm_mra_msg *mra_msg)
2156{
2157 switch (cm_mra_get_msg_mraed(mra_msg)) {
2158 case CM_MSG_RESPONSE_REQ:
2159 return cm_acquire_id(mra_msg->remote_comm_id, 0);
2160 case CM_MSG_RESPONSE_REP:
2161 case CM_MSG_RESPONSE_OTHER:
2162 return cm_acquire_id(mra_msg->remote_comm_id,
2163 mra_msg->local_comm_id);
2164 default:
2165 return NULL;
2166 }
2167}
2168
2169static int cm_mra_handler(struct cm_work *work)
2170{
2171 struct cm_id_private *cm_id_priv;
2172 struct cm_mra_msg *mra_msg;
2173 unsigned long flags;
2174 int timeout, ret;
2175
2176 mra_msg = (struct cm_mra_msg *)work->mad_recv_wc->recv_buf.mad;
2177 cm_id_priv = cm_acquire_mraed_id(mra_msg);
2178 if (!cm_id_priv)
2179 return -EINVAL;
2180
2181 work->cm_event.private_data = &mra_msg->private_data;
2182 work->cm_event.param.mra_rcvd.service_timeout =
2183 cm_mra_get_service_timeout(mra_msg);
2184 timeout = cm_convert_to_ms(cm_mra_get_service_timeout(mra_msg)) +
2185 cm_convert_to_ms(cm_id_priv->av.packet_life_time);
2186
2187 spin_lock_irqsave(&cm_id_priv->lock, flags);
2188 switch (cm_id_priv->id.state) {
2189 case IB_CM_REQ_SENT:
2190 if (cm_mra_get_msg_mraed(mra_msg) != CM_MSG_RESPONSE_REQ ||
2191 ib_modify_mad(cm_id_priv->av.port->mad_agent,
2192 (unsigned long) cm_id_priv->msg, timeout))
2193 goto out;
2194 cm_id_priv->id.state = IB_CM_MRA_REQ_RCVD;
2195 break;
2196 case IB_CM_REP_SENT:
2197 if (cm_mra_get_msg_mraed(mra_msg) != CM_MSG_RESPONSE_REP ||
2198 ib_modify_mad(cm_id_priv->av.port->mad_agent,
2199 (unsigned long) cm_id_priv->msg, timeout))
2200 goto out;
2201 cm_id_priv->id.state = IB_CM_MRA_REP_RCVD;
2202 break;
2203 case IB_CM_ESTABLISHED:
2204 if (cm_mra_get_msg_mraed(mra_msg) != CM_MSG_RESPONSE_OTHER ||
2205 cm_id_priv->id.lap_state != IB_CM_LAP_SENT ||
2206 ib_modify_mad(cm_id_priv->av.port->mad_agent,
2207 (unsigned long) cm_id_priv->msg, timeout))
2208 goto out;
2209 cm_id_priv->id.lap_state = IB_CM_MRA_LAP_RCVD;
2210 break;
2211 default:
2212 goto out;
2213 }
2214
2215 cm_id_priv->msg->context[1] = (void *) (unsigned long)
2216 cm_id_priv->id.state;
2217 ret = atomic_inc_and_test(&cm_id_priv->work_count);
2218 if (!ret)
2219 list_add_tail(&work->list, &cm_id_priv->work_list);
2220 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2221
2222 if (ret)
2223 cm_process_work(cm_id_priv, work);
2224 else
2225 cm_deref_id(cm_id_priv);
2226 return 0;
2227out:
2228 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2229 cm_deref_id(cm_id_priv);
2230 return -EINVAL;
2231}
2232
2233static void cm_format_lap(struct cm_lap_msg *lap_msg,
2234 struct cm_id_private *cm_id_priv,
2235 struct ib_sa_path_rec *alternate_path,
2236 const void *private_data,
2237 u8 private_data_len)
2238{
2239 cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID,
2240 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_LAP));
2241 lap_msg->local_comm_id = cm_id_priv->id.local_id;
2242 lap_msg->remote_comm_id = cm_id_priv->id.remote_id;
2243 cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn);
2244 /* todo: need remote CM response timeout */
2245 cm_lap_set_remote_resp_timeout(lap_msg, 0x1F);
2246 lap_msg->alt_local_lid = alternate_path->slid;
2247 lap_msg->alt_remote_lid = alternate_path->dlid;
2248 lap_msg->alt_local_gid = alternate_path->sgid;
2249 lap_msg->alt_remote_gid = alternate_path->dgid;
2250 cm_lap_set_flow_label(lap_msg, alternate_path->flow_label);
2251 cm_lap_set_traffic_class(lap_msg, alternate_path->traffic_class);
2252 lap_msg->alt_hop_limit = alternate_path->hop_limit;
2253 cm_lap_set_packet_rate(lap_msg, alternate_path->rate);
2254 cm_lap_set_sl(lap_msg, alternate_path->sl);
2255 cm_lap_set_subnet_local(lap_msg, 1); /* local only... */
2256 cm_lap_set_local_ack_timeout(lap_msg,
2257 min(31, alternate_path->packet_life_time + 1));
2258
2259 if (private_data && private_data_len)
2260 memcpy(lap_msg->private_data, private_data, private_data_len);
2261}
2262
2263int ib_send_cm_lap(struct ib_cm_id *cm_id,
2264 struct ib_sa_path_rec *alternate_path,
2265 const void *private_data,
2266 u8 private_data_len)
2267{
2268 struct cm_id_private *cm_id_priv;
2269 struct ib_mad_send_buf *msg;
2270 struct ib_send_wr *bad_send_wr;
2271 unsigned long flags;
2272 int ret;
2273
2274 if (private_data && private_data_len > IB_CM_LAP_PRIVATE_DATA_SIZE)
2275 return -EINVAL;
2276
2277 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2278 spin_lock_irqsave(&cm_id_priv->lock, flags);
2279 if (cm_id->state != IB_CM_ESTABLISHED ||
2280 cm_id->lap_state != IB_CM_LAP_IDLE) {
2281 ret = -EINVAL;
2282 goto out;
2283 }
2284
2285 ret = cm_alloc_msg(cm_id_priv, &msg);
2286 if (ret)
2287 goto out;
2288
2289 cm_format_lap((struct cm_lap_msg *) msg->mad, cm_id_priv,
2290 alternate_path, private_data, private_data_len);
2291 msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
2292 msg->context[1] = (void *) (unsigned long) IB_CM_ESTABLISHED;
2293
2294 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2295 &msg->send_wr, &bad_send_wr);
2296 if (ret) {
2297 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2298 cm_free_msg(msg);
2299 return ret;
2300 }
2301
2302 cm_id->lap_state = IB_CM_LAP_SENT;
2303 cm_id_priv->msg = msg;
2304
2305out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2306 return ret;
2307}
2308EXPORT_SYMBOL(ib_send_cm_lap);
2309
2310static void cm_format_path_from_lap(struct ib_sa_path_rec *path,
2311 struct cm_lap_msg *lap_msg)
2312{
2313 memset(path, 0, sizeof *path);
2314 path->dgid = lap_msg->alt_local_gid;
2315 path->sgid = lap_msg->alt_remote_gid;
2316 path->dlid = lap_msg->alt_local_lid;
2317 path->slid = lap_msg->alt_remote_lid;
2318 path->flow_label = cm_lap_get_flow_label(lap_msg);
2319 path->hop_limit = lap_msg->alt_hop_limit;
2320 path->traffic_class = cm_lap_get_traffic_class(lap_msg);
2321 path->reversible = 1;
2322 /* pkey is same as in REQ */
2323 path->sl = cm_lap_get_sl(lap_msg);
2324 path->mtu_selector = IB_SA_EQ;
2325 /* mtu is same as in REQ */
2326 path->rate_selector = IB_SA_EQ;
2327 path->rate = cm_lap_get_packet_rate(lap_msg);
2328 path->packet_life_time_selector = IB_SA_EQ;
2329 path->packet_life_time = cm_lap_get_local_ack_timeout(lap_msg);
2330 path->packet_life_time -= (path->packet_life_time > 0);
2331}
2332
2333static int cm_lap_handler(struct cm_work *work)
2334{
2335 struct cm_id_private *cm_id_priv;
2336 struct cm_lap_msg *lap_msg;
2337 struct ib_cm_lap_event_param *param;
2338 struct ib_mad_send_buf *msg = NULL;
2339 struct ib_send_wr *bad_send_wr;
2340 unsigned long flags;
2341 int ret;
2342
2343 /* todo: verify LAP request and send reject APR if invalid. */
2344 lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad;
2345 cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id,
2346 lap_msg->local_comm_id);
2347 if (!cm_id_priv)
2348 return -EINVAL;
2349
2350 param = &work->cm_event.param.lap_rcvd;
2351 param->alternate_path = &work->path[0];
2352 cm_format_path_from_lap(param->alternate_path, lap_msg);
2353 work->cm_event.private_data = &lap_msg->private_data;
2354
2355 spin_lock_irqsave(&cm_id_priv->lock, flags);
2356 if (cm_id_priv->id.state != IB_CM_ESTABLISHED)
2357 goto unlock;
2358
2359 switch (cm_id_priv->id.lap_state) {
2360 case IB_CM_LAP_IDLE:
2361 break;
2362 case IB_CM_MRA_LAP_SENT:
2363 if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))
2364 goto unlock;
2365
2366 cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv,
2367 CM_MSG_RESPONSE_OTHER,
2368 cm_id_priv->service_timeout,
2369 cm_id_priv->private_data,
2370 cm_id_priv->private_data_len);
2371 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2372
2373 if (ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2374 &msg->send_wr, &bad_send_wr))
2375 cm_free_msg(msg);
2376 goto deref;
2377 default:
2378 goto unlock;
2379 }
2380
2381 cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
2382 cm_id_priv->tid = lap_msg->hdr.tid;
2383 ret = atomic_inc_and_test(&cm_id_priv->work_count);
2384 if (!ret)
2385 list_add_tail(&work->list, &cm_id_priv->work_list);
2386 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2387
2388 if (ret)
2389 cm_process_work(cm_id_priv, work);
2390 else
2391 cm_deref_id(cm_id_priv);
2392 return 0;
2393
2394unlock: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2395deref: cm_deref_id(cm_id_priv);
2396 return -EINVAL;
2397}
2398
2399static void cm_format_apr(struct cm_apr_msg *apr_msg,
2400 struct cm_id_private *cm_id_priv,
2401 enum ib_cm_apr_status status,
2402 void *info,
2403 u8 info_length,
2404 const void *private_data,
2405 u8 private_data_len)
2406{
2407 cm_format_mad_hdr(&apr_msg->hdr, CM_APR_ATTR_ID, cm_id_priv->tid);
2408 apr_msg->local_comm_id = cm_id_priv->id.local_id;
2409 apr_msg->remote_comm_id = cm_id_priv->id.remote_id;
2410 apr_msg->ap_status = (u8) status;
2411
2412 if (info && info_length) {
2413 apr_msg->info_length = info_length;
2414 memcpy(apr_msg->info, info, info_length);
2415 }
2416
2417 if (private_data && private_data_len)
2418 memcpy(apr_msg->private_data, private_data, private_data_len);
2419}
2420
2421int ib_send_cm_apr(struct ib_cm_id *cm_id,
2422 enum ib_cm_apr_status status,
2423 void *info,
2424 u8 info_length,
2425 const void *private_data,
2426 u8 private_data_len)
2427{
2428 struct cm_id_private *cm_id_priv;
2429 struct ib_mad_send_buf *msg;
2430 struct ib_send_wr *bad_send_wr;
2431 unsigned long flags;
2432 int ret;
2433
2434 if ((private_data && private_data_len > IB_CM_APR_PRIVATE_DATA_SIZE) ||
2435 (info && info_length > IB_CM_APR_INFO_LENGTH))
2436 return -EINVAL;
2437
2438 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2439 spin_lock_irqsave(&cm_id_priv->lock, flags);
2440 if (cm_id->state != IB_CM_ESTABLISHED ||
2441 (cm_id->lap_state != IB_CM_LAP_RCVD &&
2442 cm_id->lap_state != IB_CM_MRA_LAP_SENT)) {
2443 ret = -EINVAL;
2444 goto out;
2445 }
2446
2447 ret = cm_alloc_msg(cm_id_priv, &msg);
2448 if (ret)
2449 goto out;
2450
2451 cm_format_apr((struct cm_apr_msg *) msg->mad, cm_id_priv, status,
2452 info, info_length, private_data, private_data_len);
2453 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2454 &msg->send_wr, &bad_send_wr);
2455 if (ret) {
2456 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2457 cm_free_msg(msg);
2458 return ret;
2459 }
2460
2461 cm_id->lap_state = IB_CM_LAP_IDLE;
2462out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2463 return ret;
2464}
2465EXPORT_SYMBOL(ib_send_cm_apr);
2466
2467static int cm_apr_handler(struct cm_work *work)
2468{
2469 struct cm_id_private *cm_id_priv;
2470 struct cm_apr_msg *apr_msg;
2471 unsigned long flags;
2472 int ret;
2473
2474 apr_msg = (struct cm_apr_msg *)work->mad_recv_wc->recv_buf.mad;
2475 cm_id_priv = cm_acquire_id(apr_msg->remote_comm_id,
2476 apr_msg->local_comm_id);
2477 if (!cm_id_priv)
2478 return -EINVAL; /* Unmatched reply. */
2479
2480 work->cm_event.param.apr_rcvd.ap_status = apr_msg->ap_status;
2481 work->cm_event.param.apr_rcvd.apr_info = &apr_msg->info;
2482 work->cm_event.param.apr_rcvd.info_len = apr_msg->info_length;
2483 work->cm_event.private_data = &apr_msg->private_data;
2484
2485 spin_lock_irqsave(&cm_id_priv->lock, flags);
2486 if (cm_id_priv->id.state != IB_CM_ESTABLISHED ||
2487 (cm_id_priv->id.lap_state != IB_CM_LAP_SENT &&
2488 cm_id_priv->id.lap_state != IB_CM_MRA_LAP_RCVD)) {
2489 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2490 goto out;
2491 }
2492 cm_id_priv->id.lap_state = IB_CM_LAP_IDLE;
2493 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
2494 (unsigned long) cm_id_priv->msg);
2495 cm_id_priv->msg = NULL;
2496
2497 ret = atomic_inc_and_test(&cm_id_priv->work_count);
2498 if (!ret)
2499 list_add_tail(&work->list, &cm_id_priv->work_list);
2500 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2501
2502 if (ret)
2503 cm_process_work(cm_id_priv, work);
2504 else
2505 cm_deref_id(cm_id_priv);
2506 return 0;
2507out:
2508 cm_deref_id(cm_id_priv);
2509 return -EINVAL;
2510}
2511
2512static int cm_timewait_handler(struct cm_work *work)
2513{
2514 struct cm_timewait_info *timewait_info;
2515 struct cm_id_private *cm_id_priv;
2516 unsigned long flags;
2517 int ret;
2518
2519 timewait_info = (struct cm_timewait_info *)work;
2520 cm_cleanup_timewait(timewait_info);
2521
2522 cm_id_priv = cm_acquire_id(timewait_info->work.local_id,
2523 timewait_info->work.remote_id);
2524 if (!cm_id_priv)
2525 return -EINVAL;
2526
2527 spin_lock_irqsave(&cm_id_priv->lock, flags);
2528 if (cm_id_priv->id.state != IB_CM_TIMEWAIT ||
2529 cm_id_priv->remote_qpn != timewait_info->remote_qpn) {
2530 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2531 goto out;
2532 }
2533 cm_id_priv->id.state = IB_CM_IDLE;
2534 ret = atomic_inc_and_test(&cm_id_priv->work_count);
2535 if (!ret)
2536 list_add_tail(&work->list, &cm_id_priv->work_list);
2537 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2538
2539 if (ret)
2540 cm_process_work(cm_id_priv, work);
2541 else
2542 cm_deref_id(cm_id_priv);
2543 return 0;
2544out:
2545 cm_deref_id(cm_id_priv);
2546 return -EINVAL;
2547}
2548
2549static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg,
2550 struct cm_id_private *cm_id_priv,
2551 struct ib_cm_sidr_req_param *param)
2552{
2553 cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID,
2554 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR));
2555 sidr_req_msg->request_id = cm_id_priv->id.local_id;
2556 sidr_req_msg->pkey = param->pkey;
2557 sidr_req_msg->service_id = param->service_id;
2558
2559 if (param->private_data && param->private_data_len)
2560 memcpy(sidr_req_msg->private_data, param->private_data,
2561 param->private_data_len);
2562}
2563
2564int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
2565 struct ib_cm_sidr_req_param *param)
2566{
2567 struct cm_id_private *cm_id_priv;
2568 struct ib_mad_send_buf *msg;
2569 struct ib_send_wr *bad_send_wr;
2570 unsigned long flags;
2571 int ret;
2572
2573 if (!param->path || (param->private_data &&
2574 param->private_data_len > IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE))
2575 return -EINVAL;
2576
2577 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2578 ret = cm_init_av_by_path(param->path, &cm_id_priv->av);
2579 if (ret)
2580 goto out;
2581
2582 cm_id->service_id = param->service_id;
2583 cm_id->service_mask = ~0ULL;
2584 cm_id_priv->timeout_ms = param->timeout_ms;
2585 cm_id_priv->max_cm_retries = param->max_cm_retries;
2586 ret = cm_alloc_msg(cm_id_priv, &msg);
2587 if (ret)
2588 goto out;
2589
2590 cm_format_sidr_req((struct cm_sidr_req_msg *) msg->mad, cm_id_priv,
2591 param);
2592 msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
2593 msg->context[1] = (void *) (unsigned long) IB_CM_SIDR_REQ_SENT;
2594
2595 spin_lock_irqsave(&cm_id_priv->lock, flags);
2596 if (cm_id->state == IB_CM_IDLE)
2597 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2598 &msg->send_wr, &bad_send_wr);
2599 else
2600 ret = -EINVAL;
2601
2602 if (ret) {
2603 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2604 cm_free_msg(msg);
2605 goto out;
2606 }
2607 cm_id->state = IB_CM_SIDR_REQ_SENT;
2608 cm_id_priv->msg = msg;
2609 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2610out:
2611 return ret;
2612}
2613EXPORT_SYMBOL(ib_send_cm_sidr_req);
2614
2615static void cm_format_sidr_req_event(struct cm_work *work,
2616 struct ib_cm_id *listen_id)
2617{
2618 struct cm_sidr_req_msg *sidr_req_msg;
2619 struct ib_cm_sidr_req_event_param *param;
2620
2621 sidr_req_msg = (struct cm_sidr_req_msg *)
2622 work->mad_recv_wc->recv_buf.mad;
2623 param = &work->cm_event.param.sidr_req_rcvd;
2624 param->pkey = sidr_req_msg->pkey;
2625 param->listen_id = listen_id;
2626 param->device = work->port->mad_agent->device;
2627 param->port = work->port->port_num;
2628 work->cm_event.private_data = &sidr_req_msg->private_data;
2629}
2630
2631static int cm_sidr_req_handler(struct cm_work *work)
2632{
2633 struct ib_cm_id *cm_id;
2634 struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
2635 struct cm_sidr_req_msg *sidr_req_msg;
2636 struct ib_wc *wc;
2637 unsigned long flags;
2638
2639 cm_id = ib_create_cm_id(NULL, NULL);
2640 if (IS_ERR(cm_id))
2641 return PTR_ERR(cm_id);
2642 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2643
2644 /* Record SGID/SLID and request ID for lookup. */
2645 sidr_req_msg = (struct cm_sidr_req_msg *)
2646 work->mad_recv_wc->recv_buf.mad;
2647 wc = work->mad_recv_wc->wc;
2648 cm_id_priv->av.dgid.global.subnet_prefix = wc->slid;
2649 cm_id_priv->av.dgid.global.interface_id = 0;
2650 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
2651 &cm_id_priv->av);
2652 cm_id_priv->id.remote_id = sidr_req_msg->request_id;
2653 cm_id_priv->id.state = IB_CM_SIDR_REQ_RCVD;
2654 cm_id_priv->tid = sidr_req_msg->hdr.tid;
2655 atomic_inc(&cm_id_priv->work_count);
2656
2657 spin_lock_irqsave(&cm.lock, flags);
2658 cur_cm_id_priv = cm_insert_remote_sidr(cm_id_priv);
2659 if (cur_cm_id_priv) {
2660 spin_unlock_irqrestore(&cm.lock, flags);
2661 goto out; /* Duplicate message. */
2662 }
2663 cur_cm_id_priv = cm_find_listen(sidr_req_msg->service_id);
2664 if (!cur_cm_id_priv) {
2665 rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
2666 spin_unlock_irqrestore(&cm.lock, flags);
2667 /* todo: reply with no match */
2668 goto out; /* No match. */
2669 }
2670 atomic_inc(&cur_cm_id_priv->refcount);
2671 spin_unlock_irqrestore(&cm.lock, flags);
2672
2673 cm_id_priv->id.cm_handler = cur_cm_id_priv->id.cm_handler;
2674 cm_id_priv->id.context = cur_cm_id_priv->id.context;
2675 cm_id_priv->id.service_id = sidr_req_msg->service_id;
2676 cm_id_priv->id.service_mask = ~0ULL;
2677
2678 cm_format_sidr_req_event(work, &cur_cm_id_priv->id);
2679 cm_process_work(cm_id_priv, work);
2680 cm_deref_id(cur_cm_id_priv);
2681 return 0;
2682out:
2683 ib_destroy_cm_id(&cm_id_priv->id);
2684 return -EINVAL;
2685}
2686
2687static void cm_format_sidr_rep(struct cm_sidr_rep_msg *sidr_rep_msg,
2688 struct cm_id_private *cm_id_priv,
2689 struct ib_cm_sidr_rep_param *param)
2690{
2691 cm_format_mad_hdr(&sidr_rep_msg->hdr, CM_SIDR_REP_ATTR_ID,
2692 cm_id_priv->tid);
2693 sidr_rep_msg->request_id = cm_id_priv->id.remote_id;
2694 sidr_rep_msg->status = param->status;
2695 cm_sidr_rep_set_qpn(sidr_rep_msg, cpu_to_be32(param->qp_num));
2696 sidr_rep_msg->service_id = cm_id_priv->id.service_id;
2697 sidr_rep_msg->qkey = cpu_to_be32(param->qkey);
2698
2699 if (param->info && param->info_length)
2700 memcpy(sidr_rep_msg->info, param->info, param->info_length);
2701
2702 if (param->private_data && param->private_data_len)
2703 memcpy(sidr_rep_msg->private_data, param->private_data,
2704 param->private_data_len);
2705}
2706
2707int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
2708 struct ib_cm_sidr_rep_param *param)
2709{
2710 struct cm_id_private *cm_id_priv;
2711 struct ib_mad_send_buf *msg;
2712 struct ib_send_wr *bad_send_wr;
2713 unsigned long flags;
2714 int ret;
2715
2716 if ((param->info && param->info_length > IB_CM_SIDR_REP_INFO_LENGTH) ||
2717 (param->private_data &&
2718 param->private_data_len > IB_CM_SIDR_REP_PRIVATE_DATA_SIZE))
2719 return -EINVAL;
2720
2721 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2722 spin_lock_irqsave(&cm_id_priv->lock, flags);
2723 if (cm_id->state != IB_CM_SIDR_REQ_RCVD) {
2724 ret = -EINVAL;
2725 goto error;
2726 }
2727
2728 ret = cm_alloc_msg(cm_id_priv, &msg);
2729 if (ret)
2730 goto error;
2731
2732 cm_format_sidr_rep((struct cm_sidr_rep_msg *) msg->mad, cm_id_priv,
2733 param);
2734 ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
2735 &msg->send_wr, &bad_send_wr);
2736 if (ret) {
2737 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2738 cm_free_msg(msg);
2739 return ret;
2740 }
2741 cm_id->state = IB_CM_IDLE;
2742 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2743
2744 spin_lock_irqsave(&cm.lock, flags);
2745 rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
2746 spin_unlock_irqrestore(&cm.lock, flags);
2747 return 0;
2748
2749error: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2750 return ret;
2751}
2752EXPORT_SYMBOL(ib_send_cm_sidr_rep);
2753
2754static void cm_format_sidr_rep_event(struct cm_work *work)
2755{
2756 struct cm_sidr_rep_msg *sidr_rep_msg;
2757 struct ib_cm_sidr_rep_event_param *param;
2758
2759 sidr_rep_msg = (struct cm_sidr_rep_msg *)
2760 work->mad_recv_wc->recv_buf.mad;
2761 param = &work->cm_event.param.sidr_rep_rcvd;
2762 param->status = sidr_rep_msg->status;
2763 param->qkey = be32_to_cpu(sidr_rep_msg->qkey);
2764 param->qpn = be32_to_cpu(cm_sidr_rep_get_qpn(sidr_rep_msg));
2765 param->info = &sidr_rep_msg->info;
2766 param->info_len = sidr_rep_msg->info_length;
2767 work->cm_event.private_data = &sidr_rep_msg->private_data;
2768}
2769
2770static int cm_sidr_rep_handler(struct cm_work *work)
2771{
2772 struct cm_sidr_rep_msg *sidr_rep_msg;
2773 struct cm_id_private *cm_id_priv;
2774 unsigned long flags;
2775
2776 sidr_rep_msg = (struct cm_sidr_rep_msg *)
2777 work->mad_recv_wc->recv_buf.mad;
2778 cm_id_priv = cm_acquire_id(sidr_rep_msg->request_id, 0);
2779 if (!cm_id_priv)
2780 return -EINVAL; /* Unmatched reply. */
2781
2782 spin_lock_irqsave(&cm_id_priv->lock, flags);
2783 if (cm_id_priv->id.state != IB_CM_SIDR_REQ_SENT) {
2784 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2785 goto out;
2786 }
2787 cm_id_priv->id.state = IB_CM_IDLE;
2788 ib_cancel_mad(cm_id_priv->av.port->mad_agent,
2789 (unsigned long) cm_id_priv->msg);
2790 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2791
2792 cm_format_sidr_rep_event(work);
2793 cm_process_work(cm_id_priv, work);
2794 return 0;
2795out:
2796 cm_deref_id(cm_id_priv);
2797 return -EINVAL;
2798}
2799
2800static void cm_process_send_error(struct ib_mad_send_buf *msg,
2801 enum ib_wc_status wc_status)
2802{
2803 struct cm_id_private *cm_id_priv;
2804 struct ib_cm_event cm_event;
2805 enum ib_cm_state state;
2806 unsigned long flags;
2807 int ret;
2808
2809 memset(&cm_event, 0, sizeof cm_event);
2810 cm_id_priv = msg->context[0];
2811
2812 /* Discard old sends or ones without a response. */
2813 spin_lock_irqsave(&cm_id_priv->lock, flags);
2814 state = (enum ib_cm_state) (unsigned long) msg->context[1];
2815 if (msg != cm_id_priv->msg || state != cm_id_priv->id.state)
2816 goto discard;
2817
2818 switch (state) {
2819 case IB_CM_REQ_SENT:
2820 case IB_CM_MRA_REQ_RCVD:
2821 cm_reset_to_idle(cm_id_priv);
2822 cm_event.event = IB_CM_REQ_ERROR;
2823 break;
2824 case IB_CM_REP_SENT:
2825 case IB_CM_MRA_REP_RCVD:
2826 cm_reset_to_idle(cm_id_priv);
2827 cm_event.event = IB_CM_REP_ERROR;
2828 break;
2829 case IB_CM_DREQ_SENT:
2830 cm_enter_timewait(cm_id_priv);
2831 cm_event.event = IB_CM_DREQ_ERROR;
2832 break;
2833 case IB_CM_SIDR_REQ_SENT:
2834 cm_id_priv->id.state = IB_CM_IDLE;
2835 cm_event.event = IB_CM_SIDR_REQ_ERROR;
2836 break;
2837 default:
2838 goto discard;
2839 }
2840 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2841 cm_event.param.send_status = wc_status;
2842
2843 /* No other events can occur on the cm_id at this point. */
2844 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, &cm_event);
2845 cm_free_msg(msg);
2846 if (ret)
2847 ib_destroy_cm_id(&cm_id_priv->id);
2848 return;
2849discard:
2850 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2851 cm_free_msg(msg);
2852}
2853
2854static void cm_send_handler(struct ib_mad_agent *mad_agent,
2855 struct ib_mad_send_wc *mad_send_wc)
2856{
2857 struct ib_mad_send_buf *msg;
2858
2859 msg = (struct ib_mad_send_buf *)(unsigned long)mad_send_wc->wr_id;
2860
2861 switch (mad_send_wc->status) {
2862 case IB_WC_SUCCESS:
2863 case IB_WC_WR_FLUSH_ERR:
2864 cm_free_msg(msg);
2865 break;
2866 default:
2867 if (msg->context[0] && msg->context[1])
2868 cm_process_send_error(msg, mad_send_wc->status);
2869 else
2870 cm_free_msg(msg);
2871 break;
2872 }
2873}
2874
2875static void cm_work_handler(void *data)
2876{
2877 struct cm_work *work = data;
2878 int ret;
2879
2880 switch (work->cm_event.event) {
2881 case IB_CM_REQ_RECEIVED:
2882 ret = cm_req_handler(work);
2883 break;
2884 case IB_CM_MRA_RECEIVED:
2885 ret = cm_mra_handler(work);
2886 break;
2887 case IB_CM_REJ_RECEIVED:
2888 ret = cm_rej_handler(work);
2889 break;
2890 case IB_CM_REP_RECEIVED:
2891 ret = cm_rep_handler(work);
2892 break;
2893 case IB_CM_RTU_RECEIVED:
2894 ret = cm_rtu_handler(work);
2895 break;
2896 case IB_CM_USER_ESTABLISHED:
2897 ret = cm_establish_handler(work);
2898 break;
2899 case IB_CM_DREQ_RECEIVED:
2900 ret = cm_dreq_handler(work);
2901 break;
2902 case IB_CM_DREP_RECEIVED:
2903 ret = cm_drep_handler(work);
2904 break;
2905 case IB_CM_SIDR_REQ_RECEIVED:
2906 ret = cm_sidr_req_handler(work);
2907 break;
2908 case IB_CM_SIDR_REP_RECEIVED:
2909 ret = cm_sidr_rep_handler(work);
2910 break;
2911 case IB_CM_LAP_RECEIVED:
2912 ret = cm_lap_handler(work);
2913 break;
2914 case IB_CM_APR_RECEIVED:
2915 ret = cm_apr_handler(work);
2916 break;
2917 case IB_CM_TIMEWAIT_EXIT:
2918 ret = cm_timewait_handler(work);
2919 break;
2920 default:
2921 ret = -EINVAL;
2922 break;
2923 }
2924 if (ret)
2925 cm_free_work(work);
2926}
2927
2928int ib_cm_establish(struct ib_cm_id *cm_id)
2929{
2930 struct cm_id_private *cm_id_priv;
2931 struct cm_work *work;
2932 unsigned long flags;
2933 int ret = 0;
2934
2935 work = kmalloc(sizeof *work, GFP_ATOMIC);
2936 if (!work)
2937 return -ENOMEM;
2938
2939 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
2940 spin_lock_irqsave(&cm_id_priv->lock, flags);
2941 switch (cm_id->state)
2942 {
2943 case IB_CM_REP_SENT:
2944 case IB_CM_MRA_REP_RCVD:
2945 cm_id->state = IB_CM_ESTABLISHED;
2946 break;
2947 case IB_CM_ESTABLISHED:
2948 ret = -EISCONN;
2949 break;
2950 default:
2951 ret = -EINVAL;
2952 break;
2953 }
2954 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
2955
2956 if (ret) {
2957 kfree(work);
2958 goto out;
2959 }
2960
2961 /*
2962 * The CM worker thread may try to destroy the cm_id before it
2963 * can execute this work item. To prevent potential deadlock,
2964 * we need to find the cm_id once we're in the context of the
2965 * worker thread, rather than holding a reference on it.
2966 */
2967 INIT_WORK(&work->work, cm_work_handler, work);
2968 work->local_id = cm_id->local_id;
2969 work->remote_id = cm_id->remote_id;
2970 work->mad_recv_wc = NULL;
2971 work->cm_event.event = IB_CM_USER_ESTABLISHED;
2972 queue_work(cm.wq, &work->work);
2973out:
2974 return ret;
2975}
2976EXPORT_SYMBOL(ib_cm_establish);
2977
2978static void cm_recv_handler(struct ib_mad_agent *mad_agent,
2979 struct ib_mad_recv_wc *mad_recv_wc)
2980{
2981 struct cm_work *work;
2982 enum ib_cm_event_type event;
2983 int paths = 0;
2984
2985 switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) {
2986 case CM_REQ_ATTR_ID:
2987 paths = 1 + (((struct cm_req_msg *) mad_recv_wc->recv_buf.mad)->
2988 alt_local_lid != 0);
2989 event = IB_CM_REQ_RECEIVED;
2990 break;
2991 case CM_MRA_ATTR_ID:
2992 event = IB_CM_MRA_RECEIVED;
2993 break;
2994 case CM_REJ_ATTR_ID:
2995 event = IB_CM_REJ_RECEIVED;
2996 break;
2997 case CM_REP_ATTR_ID:
2998 event = IB_CM_REP_RECEIVED;
2999 break;
3000 case CM_RTU_ATTR_ID:
3001 event = IB_CM_RTU_RECEIVED;
3002 break;
3003 case CM_DREQ_ATTR_ID:
3004 event = IB_CM_DREQ_RECEIVED;
3005 break;
3006 case CM_DREP_ATTR_ID:
3007 event = IB_CM_DREP_RECEIVED;
3008 break;
3009 case CM_SIDR_REQ_ATTR_ID:
3010 event = IB_CM_SIDR_REQ_RECEIVED;
3011 break;
3012 case CM_SIDR_REP_ATTR_ID:
3013 event = IB_CM_SIDR_REP_RECEIVED;
3014 break;
3015 case CM_LAP_ATTR_ID:
3016 paths = 1;
3017 event = IB_CM_LAP_RECEIVED;
3018 break;
3019 case CM_APR_ATTR_ID:
3020 event = IB_CM_APR_RECEIVED;
3021 break;
3022 default:
3023 ib_free_recv_mad(mad_recv_wc);
3024 return;
3025 }
3026
3027 work = kmalloc(sizeof *work + sizeof(struct ib_sa_path_rec) * paths,
3028 GFP_KERNEL);
3029 if (!work) {
3030 ib_free_recv_mad(mad_recv_wc);
3031 return;
3032 }
3033
3034 INIT_WORK(&work->work, cm_work_handler, work);
3035 work->cm_event.event = event;
3036 work->mad_recv_wc = mad_recv_wc;
3037 work->port = (struct cm_port *)mad_agent->context;
3038 queue_work(cm.wq, &work->work);
3039}
3040
3041static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
3042 struct ib_qp_attr *qp_attr,
3043 int *qp_attr_mask)
3044{
3045 unsigned long flags;
3046 int ret;
3047
3048 spin_lock_irqsave(&cm_id_priv->lock, flags);
3049 switch (cm_id_priv->id.state) {
3050 case IB_CM_REQ_SENT:
3051 case IB_CM_MRA_REQ_RCVD:
3052 case IB_CM_REQ_RCVD:
3053 case IB_CM_MRA_REQ_SENT:
3054 case IB_CM_REP_RCVD:
3055 case IB_CM_MRA_REP_SENT:
3056 case IB_CM_REP_SENT:
3057 case IB_CM_MRA_REP_RCVD:
3058 case IB_CM_ESTABLISHED:
3059 *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS |
3060 IB_QP_PKEY_INDEX | IB_QP_PORT;
3061 qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE;
3062 if (cm_id_priv->responder_resources)
3063 qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_WRITE |
3064 IB_ACCESS_REMOTE_READ;
3065 qp_attr->pkey_index = cm_id_priv->av.pkey_index;
3066 qp_attr->port_num = cm_id_priv->av.port->port_num;
3067 ret = 0;
3068 break;
3069 default:
3070 ret = -EINVAL;
3071 break;
3072 }
3073 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3074 return ret;
3075}
3076
3077static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
3078 struct ib_qp_attr *qp_attr,
3079 int *qp_attr_mask)
3080{
3081 unsigned long flags;
3082 int ret;
3083
3084 spin_lock_irqsave(&cm_id_priv->lock, flags);
3085 switch (cm_id_priv->id.state) {
3086 case IB_CM_REQ_RCVD:
3087 case IB_CM_MRA_REQ_SENT:
3088 case IB_CM_REP_RCVD:
3089 case IB_CM_MRA_REP_SENT:
3090 case IB_CM_REP_SENT:
3091 case IB_CM_MRA_REP_RCVD:
3092 case IB_CM_ESTABLISHED:
3093 *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU |
3094 IB_QP_DEST_QPN | IB_QP_RQ_PSN |
3095 IB_QP_MAX_DEST_RD_ATOMIC | IB_QP_MIN_RNR_TIMER;
3096 qp_attr->ah_attr = cm_id_priv->av.ah_attr;
3097 qp_attr->path_mtu = cm_id_priv->path_mtu;
3098 qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn);
3099 qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn);
3100 qp_attr->max_dest_rd_atomic = cm_id_priv->responder_resources;
3101 qp_attr->min_rnr_timer = 0;
3102 if (cm_id_priv->alt_av.ah_attr.dlid) {
3103 *qp_attr_mask |= IB_QP_ALT_PATH;
3104 qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr;
3105 }
3106 ret = 0;
3107 break;
3108 default:
3109 ret = -EINVAL;
3110 break;
3111 }
3112 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3113 return ret;
3114}
3115
3116static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
3117 struct ib_qp_attr *qp_attr,
3118 int *qp_attr_mask)
3119{
3120 unsigned long flags;
3121 int ret;
3122
3123 spin_lock_irqsave(&cm_id_priv->lock, flags);
3124 switch (cm_id_priv->id.state) {
3125 case IB_CM_REP_RCVD:
3126 case IB_CM_MRA_REP_SENT:
3127 case IB_CM_REP_SENT:
3128 case IB_CM_MRA_REP_RCVD:
3129 case IB_CM_ESTABLISHED:
3130 *qp_attr_mask = IB_QP_STATE | IB_QP_TIMEOUT | IB_QP_RETRY_CNT |
3131 IB_QP_RNR_RETRY | IB_QP_SQ_PSN |
3132 IB_QP_MAX_QP_RD_ATOMIC;
3133 qp_attr->timeout = cm_id_priv->local_ack_timeout;
3134 qp_attr->retry_cnt = cm_id_priv->retry_count;
3135 qp_attr->rnr_retry = cm_id_priv->rnr_retry_count;
3136 qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn);
3137 qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
3138 if (cm_id_priv->alt_av.ah_attr.dlid) {
3139 *qp_attr_mask |= IB_QP_PATH_MIG_STATE;
3140 qp_attr->path_mig_state = IB_MIG_REARM;
3141 }
3142 ret = 0;
3143 break;
3144 default:
3145 ret = -EINVAL;
3146 break;
3147 }
3148 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3149 return ret;
3150}
3151
3152int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
3153 struct ib_qp_attr *qp_attr,
3154 int *qp_attr_mask)
3155{
3156 struct cm_id_private *cm_id_priv;
3157 int ret;
3158
3159 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
3160 switch (qp_attr->qp_state) {
3161 case IB_QPS_INIT:
3162 ret = cm_init_qp_init_attr(cm_id_priv, qp_attr, qp_attr_mask);
3163 break;
3164 case IB_QPS_RTR:
3165 ret = cm_init_qp_rtr_attr(cm_id_priv, qp_attr, qp_attr_mask);
3166 break;
3167 case IB_QPS_RTS:
3168 ret = cm_init_qp_rts_attr(cm_id_priv, qp_attr, qp_attr_mask);
3169 break;
3170 default:
3171 ret = -EINVAL;
3172 break;
3173 }
3174 return ret;
3175}
3176EXPORT_SYMBOL(ib_cm_init_qp_attr);
3177
3178static u64 cm_get_ca_guid(struct ib_device *device)
3179{
3180 struct ib_device_attr *device_attr;
3181 u64 guid;
3182 int ret;
3183
3184 device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
3185 if (!device_attr)
3186 return 0;
3187
3188 ret = ib_query_device(device, device_attr);
3189 guid = ret ? 0 : device_attr->node_guid;
3190 kfree(device_attr);
3191 return guid;
3192}
3193
3194static void cm_add_one(struct ib_device *device)
3195{
3196 struct cm_device *cm_dev;
3197 struct cm_port *port;
3198 struct ib_mad_reg_req reg_req = {
3199 .mgmt_class = IB_MGMT_CLASS_CM,
3200 .mgmt_class_version = IB_CM_CLASS_VERSION
3201 };
3202 struct ib_port_modify port_modify = {
3203 .set_port_cap_mask = IB_PORT_CM_SUP
3204 };
3205 unsigned long flags;
3206 int ret;
3207 u8 i;
3208
3209 cm_dev = kmalloc(sizeof(*cm_dev) + sizeof(*port) *
3210 device->phys_port_cnt, GFP_KERNEL);
3211 if (!cm_dev)
3212 return;
3213
3214 cm_dev->device = device;
3215 cm_dev->ca_guid = cm_get_ca_guid(device);
3216 if (!cm_dev->ca_guid)
3217 goto error1;
3218
3219 set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask);
3220 for (i = 1; i <= device->phys_port_cnt; i++) {
3221 port = &cm_dev->port[i-1];
3222 port->cm_dev = cm_dev;
3223 port->port_num = i;
3224 port->mad_agent = ib_register_mad_agent(device, i,
3225 IB_QPT_GSI,
3226 &reg_req,
3227 0,
3228 cm_send_handler,
3229 cm_recv_handler,
3230 port);
3231 if (IS_ERR(port->mad_agent))
3232 goto error2;
3233
3234 ret = ib_modify_port(device, i, 0, &port_modify);
3235 if (ret)
3236 goto error3;
3237 }
3238 ib_set_client_data(device, &cm_client, cm_dev);
3239
3240 write_lock_irqsave(&cm.device_lock, flags);
3241 list_add_tail(&cm_dev->list, &cm.device_list);
3242 write_unlock_irqrestore(&cm.device_lock, flags);
3243 return;
3244
3245error3:
3246 ib_unregister_mad_agent(port->mad_agent);
3247error2:
3248 port_modify.set_port_cap_mask = 0;
3249 port_modify.clr_port_cap_mask = IB_PORT_CM_SUP;
3250 while (--i) {
3251 port = &cm_dev->port[i-1];
3252 ib_modify_port(device, port->port_num, 0, &port_modify);
3253 ib_unregister_mad_agent(port->mad_agent);
3254 }
3255error1:
3256 kfree(cm_dev);
3257}
3258
3259static void cm_remove_one(struct ib_device *device)
3260{
3261 struct cm_device *cm_dev;
3262 struct cm_port *port;
3263 struct ib_port_modify port_modify = {
3264 .clr_port_cap_mask = IB_PORT_CM_SUP
3265 };
3266 unsigned long flags;
3267 int i;
3268
3269 cm_dev = ib_get_client_data(device, &cm_client);
3270 if (!cm_dev)
3271 return;
3272
3273 write_lock_irqsave(&cm.device_lock, flags);
3274 list_del(&cm_dev->list);
3275 write_unlock_irqrestore(&cm.device_lock, flags);
3276
3277 for (i = 1; i <= device->phys_port_cnt; i++) {
3278 port = &cm_dev->port[i-1];
3279 ib_modify_port(device, port->port_num, 0, &port_modify);
3280 ib_unregister_mad_agent(port->mad_agent);
3281 }
3282 kfree(cm_dev);
3283}
3284
3285static int __init ib_cm_init(void)
3286{
3287 int ret;
3288
3289 memset(&cm, 0, sizeof cm);
3290 INIT_LIST_HEAD(&cm.device_list);
3291 rwlock_init(&cm.device_lock);
3292 spin_lock_init(&cm.lock);
3293 cm.listen_service_table = RB_ROOT;
3294 cm.listen_service_id = __constant_be64_to_cpu(IB_CM_ASSIGN_SERVICE_ID);
3295 cm.remote_id_table = RB_ROOT;
3296 cm.remote_qp_table = RB_ROOT;
3297 cm.remote_sidr_table = RB_ROOT;
3298 idr_init(&cm.local_id_table);
3299 idr_pre_get(&cm.local_id_table, GFP_KERNEL);
3300
3301 cm.wq = create_workqueue("ib_cm");
3302 if (!cm.wq)
3303 return -ENOMEM;
3304
3305 ret = ib_register_client(&cm_client);
3306 if (ret)
3307 goto error;
3308
3309 return 0;
3310error:
3311 destroy_workqueue(cm.wq);
3312 return ret;
3313}
3314
3315static void __exit ib_cm_cleanup(void)
3316{
3317 flush_workqueue(cm.wq);
3318 destroy_workqueue(cm.wq);
3319 ib_unregister_client(&cm_client);
3320}
3321
3322module_init(ib_cm_init);
3323module_exit(ib_cm_cleanup);
3324
diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h
new file mode 100644
index 000000000000..15a309a77b2b
--- /dev/null
+++ b/drivers/infiniband/core/cm_msgs.h
@@ -0,0 +1,819 @@
1/*
2 * Copyright (c) 2004 Intel Corporation. All rights reserved.
3 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
4 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING the madirectory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use source and binary forms, with or
13 * withmodification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retathe above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHWARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS THE
32 * SOFTWARE.
33 */
34#if !defined(CM_MSGS_H)
35#define CM_MSGS_H
36
37#include <ib_mad.h>
38
39/*
40 * Parameters to routines below should be in network-byte order, and values
41 * are returned in network-byte order.
42 */
43
44#define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */
45
46enum cm_msg_attr_id {
47 CM_REQ_ATTR_ID = __constant_htons(0x0010),
48 CM_MRA_ATTR_ID = __constant_htons(0x0011),
49 CM_REJ_ATTR_ID = __constant_htons(0x0012),
50 CM_REP_ATTR_ID = __constant_htons(0x0013),
51 CM_RTU_ATTR_ID = __constant_htons(0x0014),
52 CM_DREQ_ATTR_ID = __constant_htons(0x0015),
53 CM_DREP_ATTR_ID = __constant_htons(0x0016),
54 CM_SIDR_REQ_ATTR_ID = __constant_htons(0x0017),
55 CM_SIDR_REP_ATTR_ID = __constant_htons(0x0018),
56 CM_LAP_ATTR_ID = __constant_htons(0x0019),
57 CM_APR_ATTR_ID = __constant_htons(0x001A)
58};
59
60enum cm_msg_sequence {
61 CM_MSG_SEQUENCE_REQ,
62 CM_MSG_SEQUENCE_LAP,
63 CM_MSG_SEQUENCE_DREQ,
64 CM_MSG_SEQUENCE_SIDR
65};
66
67struct cm_req_msg {
68 struct ib_mad_hdr hdr;
69
70 u32 local_comm_id;
71 u32 rsvd4;
72 u64 service_id;
73 u64 local_ca_guid;
74 u32 rsvd24;
75 u32 local_qkey;
76 /* local QPN:24, responder resources:8 */
77 u32 offset32;
78 /* local EECN:24, initiator depth:8 */
79 u32 offset36;
80 /*
81 * remote EECN:24, remote CM response timeout:5,
82 * transport service type:2, end-to-end flow control:1
83 */
84 u32 offset40;
85 /* starting PSN:24, local CM response timeout:5, retry count:3 */
86 u32 offset44;
87 u16 pkey;
88 /* path MTU:4, RDC exists:1, RNR retry count:3. */
89 u8 offset50;
90 /* max CM Retries:4, SRQ:1, rsvd:3 */
91 u8 offset51;
92
93 u16 primary_local_lid;
94 u16 primary_remote_lid;
95 union ib_gid primary_local_gid;
96 union ib_gid primary_remote_gid;
97 /* flow label:20, rsvd:6, packet rate:6 */
98 u32 primary_offset88;
99 u8 primary_traffic_class;
100 u8 primary_hop_limit;
101 /* SL:4, subnet local:1, rsvd:3 */
102 u8 primary_offset94;
103 /* local ACK timeout:5, rsvd:3 */
104 u8 primary_offset95;
105
106 u16 alt_local_lid;
107 u16 alt_remote_lid;
108 union ib_gid alt_local_gid;
109 union ib_gid alt_remote_gid;
110 /* flow label:20, rsvd:6, packet rate:6 */
111 u32 alt_offset132;
112 u8 alt_traffic_class;
113 u8 alt_hop_limit;
114 /* SL:4, subnet local:1, rsvd:3 */
115 u8 alt_offset138;
116 /* local ACK timeout:5, rsvd:3 */
117 u8 alt_offset139;
118
119 u8 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE];
120
121} __attribute__ ((packed));
122
123static inline u32 cm_req_get_local_qpn(struct cm_req_msg *req_msg)
124{
125 return cpu_to_be32(be32_to_cpu(req_msg->offset32) >> 8);
126}
127
128static inline void cm_req_set_local_qpn(struct cm_req_msg *req_msg, u32 qpn)
129{
130 req_msg->offset32 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
131 (be32_to_cpu(req_msg->offset32) &
132 0x000000FF));
133}
134
135static inline u8 cm_req_get_resp_res(struct cm_req_msg *req_msg)
136{
137 return (u8) be32_to_cpu(req_msg->offset32);
138}
139
140static inline void cm_req_set_resp_res(struct cm_req_msg *req_msg, u8 resp_res)
141{
142 req_msg->offset32 = cpu_to_be32(resp_res |
143 (be32_to_cpu(req_msg->offset32) &
144 0xFFFFFF00));
145}
146
147static inline u8 cm_req_get_init_depth(struct cm_req_msg *req_msg)
148{
149 return (u8) be32_to_cpu(req_msg->offset36);
150}
151
152static inline void cm_req_set_init_depth(struct cm_req_msg *req_msg,
153 u8 init_depth)
154{
155 req_msg->offset36 = cpu_to_be32(init_depth |
156 (be32_to_cpu(req_msg->offset36) &
157 0xFFFFFF00));
158}
159
160static inline u8 cm_req_get_remote_resp_timeout(struct cm_req_msg *req_msg)
161{
162 return (u8) ((be32_to_cpu(req_msg->offset40) & 0xF8) >> 3);
163}
164
165static inline void cm_req_set_remote_resp_timeout(struct cm_req_msg *req_msg,
166 u8 resp_timeout)
167{
168 req_msg->offset40 = cpu_to_be32((resp_timeout << 3) |
169 (be32_to_cpu(req_msg->offset40) &
170 0xFFFFFF07));
171}
172
173static inline enum ib_qp_type cm_req_get_qp_type(struct cm_req_msg *req_msg)
174{
175 u8 transport_type = (u8) (be32_to_cpu(req_msg->offset40) & 0x06) >> 1;
176 switch(transport_type) {
177 case 0: return IB_QPT_RC;
178 case 1: return IB_QPT_UC;
179 default: return 0;
180 }
181}
182
183static inline void cm_req_set_qp_type(struct cm_req_msg *req_msg,
184 enum ib_qp_type qp_type)
185{
186 switch(qp_type) {
187 case IB_QPT_UC:
188 req_msg->offset40 = cpu_to_be32((be32_to_cpu(
189 req_msg->offset40) &
190 0xFFFFFFF9) | 0x2);
191 default:
192 req_msg->offset40 = cpu_to_be32(be32_to_cpu(
193 req_msg->offset40) &
194 0xFFFFFFF9);
195 }
196}
197
198static inline u8 cm_req_get_flow_ctrl(struct cm_req_msg *req_msg)
199{
200 return be32_to_cpu(req_msg->offset40) & 0x1;
201}
202
203static inline void cm_req_set_flow_ctrl(struct cm_req_msg *req_msg,
204 u8 flow_ctrl)
205{
206 req_msg->offset40 = cpu_to_be32((flow_ctrl & 0x1) |
207 (be32_to_cpu(req_msg->offset40) &
208 0xFFFFFFFE));
209}
210
211static inline u32 cm_req_get_starting_psn(struct cm_req_msg *req_msg)
212{
213 return cpu_to_be32(be32_to_cpu(req_msg->offset44) >> 8);
214}
215
216static inline void cm_req_set_starting_psn(struct cm_req_msg *req_msg,
217 u32 starting_psn)
218{
219 req_msg->offset44 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) |
220 (be32_to_cpu(req_msg->offset44) & 0x000000FF));
221}
222
223static inline u8 cm_req_get_local_resp_timeout(struct cm_req_msg *req_msg)
224{
225 return (u8) ((be32_to_cpu(req_msg->offset44) & 0xF8) >> 3);
226}
227
228static inline void cm_req_set_local_resp_timeout(struct cm_req_msg *req_msg,
229 u8 resp_timeout)
230{
231 req_msg->offset44 = cpu_to_be32((resp_timeout << 3) |
232 (be32_to_cpu(req_msg->offset44) & 0xFFFFFF07));
233}
234
235static inline u8 cm_req_get_retry_count(struct cm_req_msg *req_msg)
236{
237 return (u8) (be32_to_cpu(req_msg->offset44) & 0x7);
238}
239
240static inline void cm_req_set_retry_count(struct cm_req_msg *req_msg,
241 u8 retry_count)
242{
243 req_msg->offset44 = cpu_to_be32((retry_count & 0x7) |
244 (be32_to_cpu(req_msg->offset44) & 0xFFFFFFF8));
245}
246
247static inline u8 cm_req_get_path_mtu(struct cm_req_msg *req_msg)
248{
249 return req_msg->offset50 >> 4;
250}
251
252static inline void cm_req_set_path_mtu(struct cm_req_msg *req_msg, u8 path_mtu)
253{
254 req_msg->offset50 = (u8) ((req_msg->offset50 & 0xF) | (path_mtu << 4));
255}
256
257static inline u8 cm_req_get_rnr_retry_count(struct cm_req_msg *req_msg)
258{
259 return req_msg->offset50 & 0x7;
260}
261
262static inline void cm_req_set_rnr_retry_count(struct cm_req_msg *req_msg,
263 u8 rnr_retry_count)
264{
265 req_msg->offset50 = (u8) ((req_msg->offset50 & 0xF8) |
266 (rnr_retry_count & 0x7));
267}
268
269static inline u8 cm_req_get_max_cm_retries(struct cm_req_msg *req_msg)
270{
271 return req_msg->offset51 >> 4;
272}
273
274static inline void cm_req_set_max_cm_retries(struct cm_req_msg *req_msg,
275 u8 retries)
276{
277 req_msg->offset51 = (u8) ((req_msg->offset51 & 0xF) | (retries << 4));
278}
279
280static inline u8 cm_req_get_srq(struct cm_req_msg *req_msg)
281{
282 return (req_msg->offset51 & 0x8) >> 3;
283}
284
285static inline void cm_req_set_srq(struct cm_req_msg *req_msg, u8 srq)
286{
287 req_msg->offset51 = (u8) ((req_msg->offset51 & 0xF7) |
288 ((srq & 0x1) << 3));
289}
290
291static inline u32 cm_req_get_primary_flow_label(struct cm_req_msg *req_msg)
292{
293 return cpu_to_be32((be32_to_cpu(req_msg->primary_offset88) >> 12));
294}
295
296static inline void cm_req_set_primary_flow_label(struct cm_req_msg *req_msg,
297 u32 flow_label)
298{
299 req_msg->primary_offset88 = cpu_to_be32(
300 (be32_to_cpu(req_msg->primary_offset88) &
301 0x00000FFF) |
302 (be32_to_cpu(flow_label) << 12));
303}
304
305static inline u8 cm_req_get_primary_packet_rate(struct cm_req_msg *req_msg)
306{
307 return (u8) (be32_to_cpu(req_msg->primary_offset88) & 0x3F);
308}
309
310static inline void cm_req_set_primary_packet_rate(struct cm_req_msg *req_msg,
311 u8 rate)
312{
313 req_msg->primary_offset88 = cpu_to_be32(
314 (be32_to_cpu(req_msg->primary_offset88) &
315 0xFFFFFFC0) | (rate & 0x3F));
316}
317
318static inline u8 cm_req_get_primary_sl(struct cm_req_msg *req_msg)
319{
320 return (u8) (req_msg->primary_offset94 >> 4);
321}
322
323static inline void cm_req_set_primary_sl(struct cm_req_msg *req_msg, u8 sl)
324{
325 req_msg->primary_offset94 = (u8) ((req_msg->primary_offset94 & 0x0F) |
326 (sl << 4));
327}
328
329static inline u8 cm_req_get_primary_subnet_local(struct cm_req_msg *req_msg)
330{
331 return (u8) ((req_msg->primary_offset94 & 0x08) >> 3);
332}
333
334static inline void cm_req_set_primary_subnet_local(struct cm_req_msg *req_msg,
335 u8 subnet_local)
336{
337 req_msg->primary_offset94 = (u8) ((req_msg->primary_offset94 & 0xF7) |
338 ((subnet_local & 0x1) << 3));
339}
340
341static inline u8 cm_req_get_primary_local_ack_timeout(struct cm_req_msg *req_msg)
342{
343 return (u8) (req_msg->primary_offset95 >> 3);
344}
345
346static inline void cm_req_set_primary_local_ack_timeout(struct cm_req_msg *req_msg,
347 u8 local_ack_timeout)
348{
349 req_msg->primary_offset95 = (u8) ((req_msg->primary_offset95 & 0x07) |
350 (local_ack_timeout << 3));
351}
352
353static inline u32 cm_req_get_alt_flow_label(struct cm_req_msg *req_msg)
354{
355 return cpu_to_be32((be32_to_cpu(req_msg->alt_offset132) >> 12));
356}
357
358static inline void cm_req_set_alt_flow_label(struct cm_req_msg *req_msg,
359 u32 flow_label)
360{
361 req_msg->alt_offset132 = cpu_to_be32(
362 (be32_to_cpu(req_msg->alt_offset132) &
363 0x00000FFF) |
364 (be32_to_cpu(flow_label) << 12));
365}
366
367static inline u8 cm_req_get_alt_packet_rate(struct cm_req_msg *req_msg)
368{
369 return (u8) (be32_to_cpu(req_msg->alt_offset132) & 0x3F);
370}
371
372static inline void cm_req_set_alt_packet_rate(struct cm_req_msg *req_msg,
373 u8 rate)
374{
375 req_msg->alt_offset132 = cpu_to_be32(
376 (be32_to_cpu(req_msg->alt_offset132) &
377 0xFFFFFFC0) | (rate & 0x3F));
378}
379
380static inline u8 cm_req_get_alt_sl(struct cm_req_msg *req_msg)
381{
382 return (u8) (req_msg->alt_offset138 >> 4);
383}
384
385static inline void cm_req_set_alt_sl(struct cm_req_msg *req_msg, u8 sl)
386{
387 req_msg->alt_offset138 = (u8) ((req_msg->alt_offset138 & 0x0F) |
388 (sl << 4));
389}
390
391static inline u8 cm_req_get_alt_subnet_local(struct cm_req_msg *req_msg)
392{
393 return (u8) ((req_msg->alt_offset138 & 0x08) >> 3);
394}
395
396static inline void cm_req_set_alt_subnet_local(struct cm_req_msg *req_msg,
397 u8 subnet_local)
398{
399 req_msg->alt_offset138 = (u8) ((req_msg->alt_offset138 & 0xF7) |
400 ((subnet_local & 0x1) << 3));
401}
402
403static inline u8 cm_req_get_alt_local_ack_timeout(struct cm_req_msg *req_msg)
404{
405 return (u8) (req_msg->alt_offset139 >> 3);
406}
407
408static inline void cm_req_set_alt_local_ack_timeout(struct cm_req_msg *req_msg,
409 u8 local_ack_timeout)
410{
411 req_msg->alt_offset139 = (u8) ((req_msg->alt_offset139 & 0x07) |
412 (local_ack_timeout << 3));
413}
414
415/* Message REJected or MRAed */
416enum cm_msg_response {
417 CM_MSG_RESPONSE_REQ = 0x0,
418 CM_MSG_RESPONSE_REP = 0x1,
419 CM_MSG_RESPONSE_OTHER = 0x2
420};
421
422 struct cm_mra_msg {
423 struct ib_mad_hdr hdr;
424
425 u32 local_comm_id;
426 u32 remote_comm_id;
427 /* message MRAed:2, rsvd:6 */
428 u8 offset8;
429 /* service timeout:5, rsvd:3 */
430 u8 offset9;
431
432 u8 private_data[IB_CM_MRA_PRIVATE_DATA_SIZE];
433
434} __attribute__ ((packed));
435
436static inline u8 cm_mra_get_msg_mraed(struct cm_mra_msg *mra_msg)
437{
438 return (u8) (mra_msg->offset8 >> 6);
439}
440
441static inline void cm_mra_set_msg_mraed(struct cm_mra_msg *mra_msg, u8 msg)
442{
443 mra_msg->offset8 = (u8) ((mra_msg->offset8 & 0x3F) | (msg << 6));
444}
445
446static inline u8 cm_mra_get_service_timeout(struct cm_mra_msg *mra_msg)
447{
448 return (u8) (mra_msg->offset9 >> 3);
449}
450
451static inline void cm_mra_set_service_timeout(struct cm_mra_msg *mra_msg,
452 u8 service_timeout)
453{
454 mra_msg->offset9 = (u8) ((mra_msg->offset9 & 0x07) |
455 (service_timeout << 3));
456}
457
458struct cm_rej_msg {
459 struct ib_mad_hdr hdr;
460
461 u32 local_comm_id;
462 u32 remote_comm_id;
463 /* message REJected:2, rsvd:6 */
464 u8 offset8;
465 /* reject info length:7, rsvd:1. */
466 u8 offset9;
467 u16 reason;
468 u8 ari[IB_CM_REJ_ARI_LENGTH];
469
470 u8 private_data[IB_CM_REJ_PRIVATE_DATA_SIZE];
471
472} __attribute__ ((packed));
473
474static inline u8 cm_rej_get_msg_rejected(struct cm_rej_msg *rej_msg)
475{
476 return (u8) (rej_msg->offset8 >> 6);
477}
478
479static inline void cm_rej_set_msg_rejected(struct cm_rej_msg *rej_msg, u8 msg)
480{
481 rej_msg->offset8 = (u8) ((rej_msg->offset8 & 0x3F) | (msg << 6));
482}
483
484static inline u8 cm_rej_get_reject_info_len(struct cm_rej_msg *rej_msg)
485{
486 return (u8) (rej_msg->offset9 >> 1);
487}
488
489static inline void cm_rej_set_reject_info_len(struct cm_rej_msg *rej_msg,
490 u8 len)
491{
492 rej_msg->offset9 = (u8) ((rej_msg->offset9 & 0x1) | (len << 1));
493}
494
495struct cm_rep_msg {
496 struct ib_mad_hdr hdr;
497
498 u32 local_comm_id;
499 u32 remote_comm_id;
500 u32 local_qkey;
501 /* local QPN:24, rsvd:8 */
502 u32 offset12;
503 /* local EECN:24, rsvd:8 */
504 u32 offset16;
505 /* starting PSN:24 rsvd:8 */
506 u32 offset20;
507 u8 resp_resources;
508 u8 initiator_depth;
509 /* target ACK delay:5, failover accepted:2, end-to-end flow control:1 */
510 u8 offset26;
511 /* RNR retry count:3, SRQ:1, rsvd:5 */
512 u8 offset27;
513 u64 local_ca_guid;
514
515 u8 private_data[IB_CM_REP_PRIVATE_DATA_SIZE];
516
517} __attribute__ ((packed));
518
519static inline u32 cm_rep_get_local_qpn(struct cm_rep_msg *rep_msg)
520{
521 return cpu_to_be32(be32_to_cpu(rep_msg->offset12) >> 8);
522}
523
524static inline void cm_rep_set_local_qpn(struct cm_rep_msg *rep_msg, u32 qpn)
525{
526 rep_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
527 (be32_to_cpu(rep_msg->offset12) & 0x000000FF));
528}
529
530static inline u32 cm_rep_get_starting_psn(struct cm_rep_msg *rep_msg)
531{
532 return cpu_to_be32(be32_to_cpu(rep_msg->offset20) >> 8);
533}
534
535static inline void cm_rep_set_starting_psn(struct cm_rep_msg *rep_msg,
536 u32 starting_psn)
537{
538 rep_msg->offset20 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) |
539 (be32_to_cpu(rep_msg->offset20) & 0x000000FF));
540}
541
542static inline u8 cm_rep_get_target_ack_delay(struct cm_rep_msg *rep_msg)
543{
544 return (u8) (rep_msg->offset26 >> 3);
545}
546
547static inline void cm_rep_set_target_ack_delay(struct cm_rep_msg *rep_msg,
548 u8 target_ack_delay)
549{
550 rep_msg->offset26 = (u8) ((rep_msg->offset26 & 0x07) |
551 (target_ack_delay << 3));
552}
553
554static inline u8 cm_rep_get_failover(struct cm_rep_msg *rep_msg)
555{
556 return (u8) ((rep_msg->offset26 & 0x06) >> 1);
557}
558
559static inline void cm_rep_set_failover(struct cm_rep_msg *rep_msg, u8 failover)
560{
561 rep_msg->offset26 = (u8) ((rep_msg->offset26 & 0xF9) |
562 ((failover & 0x3) << 1));
563}
564
565static inline u8 cm_rep_get_flow_ctrl(struct cm_rep_msg *rep_msg)
566{
567 return (u8) (rep_msg->offset26 & 0x01);
568}
569
570static inline void cm_rep_set_flow_ctrl(struct cm_rep_msg *rep_msg,
571 u8 flow_ctrl)
572{
573 rep_msg->offset26 = (u8) ((rep_msg->offset26 & 0xFE) |
574 (flow_ctrl & 0x1));
575}
576
577static inline u8 cm_rep_get_rnr_retry_count(struct cm_rep_msg *rep_msg)
578{
579 return (u8) (rep_msg->offset27 >> 5);
580}
581
582static inline void cm_rep_set_rnr_retry_count(struct cm_rep_msg *rep_msg,
583 u8 rnr_retry_count)
584{
585 rep_msg->offset27 = (u8) ((rep_msg->offset27 & 0x1F) |
586 (rnr_retry_count << 5));
587}
588
589static inline u8 cm_rep_get_srq(struct cm_rep_msg *rep_msg)
590{
591 return (u8) ((rep_msg->offset27 >> 4) & 0x1);
592}
593
594static inline void cm_rep_set_srq(struct cm_rep_msg *rep_msg, u8 srq)
595{
596 rep_msg->offset27 = (u8) ((rep_msg->offset27 & 0xEF) |
597 ((srq & 0x1) << 4));
598}
599
600struct cm_rtu_msg {
601 struct ib_mad_hdr hdr;
602
603 u32 local_comm_id;
604 u32 remote_comm_id;
605
606 u8 private_data[IB_CM_RTU_PRIVATE_DATA_SIZE];
607
608} __attribute__ ((packed));
609
610struct cm_dreq_msg {
611 struct ib_mad_hdr hdr;
612
613 u32 local_comm_id;
614 u32 remote_comm_id;
615 /* remote QPN/EECN:24, rsvd:8 */
616 u32 offset8;
617
618 u8 private_data[IB_CM_DREQ_PRIVATE_DATA_SIZE];
619
620} __attribute__ ((packed));
621
622static inline u32 cm_dreq_get_remote_qpn(struct cm_dreq_msg *dreq_msg)
623{
624 return cpu_to_be32(be32_to_cpu(dreq_msg->offset8) >> 8);
625}
626
627static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, u32 qpn)
628{
629 dreq_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
630 (be32_to_cpu(dreq_msg->offset8) & 0x000000FF));
631}
632
633struct cm_drep_msg {
634 struct ib_mad_hdr hdr;
635
636 u32 local_comm_id;
637 u32 remote_comm_id;
638
639 u8 private_data[IB_CM_DREP_PRIVATE_DATA_SIZE];
640
641} __attribute__ ((packed));
642
643struct cm_lap_msg {
644 struct ib_mad_hdr hdr;
645
646 u32 local_comm_id;
647 u32 remote_comm_id;
648
649 u32 rsvd8;
650 /* remote QPN/EECN:24, remote CM response timeout:5, rsvd:3 */
651 u32 offset12;
652 u32 rsvd16;
653
654 u16 alt_local_lid;
655 u16 alt_remote_lid;
656 union ib_gid alt_local_gid;
657 union ib_gid alt_remote_gid;
658 /* flow label:20, rsvd:4, traffic class:8 */
659 u32 offset56;
660 u8 alt_hop_limit;
661 /* rsvd:2, packet rate:6 */
662 uint8_t offset61;
663 /* SL:4, subnet local:1, rsvd:3 */
664 uint8_t offset62;
665 /* local ACK timeout:5, rsvd:3 */
666 uint8_t offset63;
667
668 u8 private_data[IB_CM_LAP_PRIVATE_DATA_SIZE];
669} __attribute__ ((packed));
670
671static inline u32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg)
672{
673 return cpu_to_be32(be32_to_cpu(lap_msg->offset12) >> 8);
674}
675
676static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, u32 qpn)
677{
678 lap_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
679 (be32_to_cpu(lap_msg->offset12) &
680 0x000000FF));
681}
682
683static inline u8 cm_lap_get_remote_resp_timeout(struct cm_lap_msg *lap_msg)
684{
685 return (u8) ((be32_to_cpu(lap_msg->offset12) & 0xF8) >> 3);
686}
687
688static inline void cm_lap_set_remote_resp_timeout(struct cm_lap_msg *lap_msg,
689 u8 resp_timeout)
690{
691 lap_msg->offset12 = cpu_to_be32((resp_timeout << 3) |
692 (be32_to_cpu(lap_msg->offset12) &
693 0xFFFFFF07));
694}
695
696static inline u32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg)
697{
698 return be32_to_cpu(lap_msg->offset56) >> 12;
699}
700
701static inline void cm_lap_set_flow_label(struct cm_lap_msg *lap_msg,
702 u32 flow_label)
703{
704 lap_msg->offset56 = cpu_to_be32((flow_label << 12) |
705 (be32_to_cpu(lap_msg->offset56) &
706 0x00000FFF));
707}
708
709static inline u8 cm_lap_get_traffic_class(struct cm_lap_msg *lap_msg)
710{
711 return (u8) be32_to_cpu(lap_msg->offset56);
712}
713
714static inline void cm_lap_set_traffic_class(struct cm_lap_msg *lap_msg,
715 u8 traffic_class)
716{
717 lap_msg->offset56 = cpu_to_be32(traffic_class |
718 (be32_to_cpu(lap_msg->offset56) &
719 0xFFFFFF00));
720}
721
722static inline u8 cm_lap_get_packet_rate(struct cm_lap_msg *lap_msg)
723{
724 return lap_msg->offset61 & 0x3F;
725}
726
727static inline void cm_lap_set_packet_rate(struct cm_lap_msg *lap_msg,
728 u8 packet_rate)
729{
730 lap_msg->offset61 = (packet_rate & 0x3F) | (lap_msg->offset61 & 0xC0);
731}
732
733static inline u8 cm_lap_get_sl(struct cm_lap_msg *lap_msg)
734{
735 return lap_msg->offset62 >> 4;
736}
737
738static inline void cm_lap_set_sl(struct cm_lap_msg *lap_msg, u8 sl)
739{
740 lap_msg->offset62 = (sl << 4) | (lap_msg->offset62 & 0x0F);
741}
742
743static inline u8 cm_lap_get_subnet_local(struct cm_lap_msg *lap_msg)
744{
745 return (lap_msg->offset62 >> 3) & 0x1;
746}
747
748static inline void cm_lap_set_subnet_local(struct cm_lap_msg *lap_msg,
749 u8 subnet_local)
750{
751 lap_msg->offset62 = ((subnet_local & 0x1) << 3) |
752 (lap_msg->offset61 & 0xF7);
753}
754static inline u8 cm_lap_get_local_ack_timeout(struct cm_lap_msg *lap_msg)
755{
756 return lap_msg->offset63 >> 3;
757}
758
759static inline void cm_lap_set_local_ack_timeout(struct cm_lap_msg *lap_msg,
760 u8 local_ack_timeout)
761{
762 lap_msg->offset63 = (local_ack_timeout << 3) |
763 (lap_msg->offset63 & 0x07);
764}
765
766struct cm_apr_msg {
767 struct ib_mad_hdr hdr;
768
769 u32 local_comm_id;
770 u32 remote_comm_id;
771
772 u8 info_length;
773 u8 ap_status;
774 u8 info[IB_CM_APR_INFO_LENGTH];
775
776 u8 private_data[IB_CM_APR_PRIVATE_DATA_SIZE];
777} __attribute__ ((packed));
778
779struct cm_sidr_req_msg {
780 struct ib_mad_hdr hdr;
781
782 u32 request_id;
783 u16 pkey;
784 u16 rsvd;
785 u64 service_id;
786
787 u8 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE];
788} __attribute__ ((packed));
789
790struct cm_sidr_rep_msg {
791 struct ib_mad_hdr hdr;
792
793 u32 request_id;
794 u8 status;
795 u8 info_length;
796 u16 rsvd;
797 /* QPN:24, rsvd:8 */
798 u32 offset8;
799 u64 service_id;
800 u32 qkey;
801 u8 info[IB_CM_SIDR_REP_INFO_LENGTH];
802
803 u8 private_data[IB_CM_SIDR_REP_PRIVATE_DATA_SIZE];
804} __attribute__ ((packed));
805
806static inline u32 cm_sidr_rep_get_qpn(struct cm_sidr_rep_msg *sidr_rep_msg)
807{
808 return cpu_to_be32(be32_to_cpu(sidr_rep_msg->offset8) >> 8);
809}
810
811static inline void cm_sidr_rep_set_qpn(struct cm_sidr_rep_msg *sidr_rep_msg,
812 u32 qpn)
813{
814 sidr_rep_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
815 (be32_to_cpu(sidr_rep_msg->offset8) &
816 0x000000FF));
817}
818
819#endif /* CM_MSGS_H */
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 328feae2a5be..7763b31abba7 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: fmr_pool.c 1349 2004-12-16 21:09:43Z roland $ 33 * $Id: fmr_pool.c 2730 2005-06-28 16:43:03Z sean.hefty $
33 */ 34 */
34 35
35#include <linux/errno.h> 36#include <linux/errno.h>
@@ -329,7 +330,7 @@ EXPORT_SYMBOL(ib_create_fmr_pool);
329 * 330 *
330 * Destroy an FMR pool and free all associated resources. 331 * Destroy an FMR pool and free all associated resources.
331 */ 332 */
332int ib_destroy_fmr_pool(struct ib_fmr_pool *pool) 333void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
333{ 334{
334 struct ib_pool_fmr *fmr; 335 struct ib_pool_fmr *fmr;
335 struct ib_pool_fmr *tmp; 336 struct ib_pool_fmr *tmp;
@@ -352,8 +353,6 @@ int ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
352 353
353 kfree(pool->cache_bucket); 354 kfree(pool->cache_bucket);
354 kfree(pool); 355 kfree(pool);
355
356 return 0;
357} 356}
358EXPORT_SYMBOL(ib_destroy_fmr_pool); 357EXPORT_SYMBOL(ib_destroy_fmr_pool);
359 358
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 23628c622a50..b97e210ce9c8 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -1,5 +1,7 @@
1/* 1/*
2 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 2 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 * Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
3 * 5 *
4 * This software is available to you under a choice of one of two 6 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,12 +31,12 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 32 * SOFTWARE.
31 * 33 *
32 * $Id: mad.c 1389 2004-12-27 22:56:47Z roland $ 34 * $Id: mad.c 2817 2005-07-07 11:29:26Z halr $
33 */ 35 */
34
35#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
36 37
37#include "mad_priv.h" 38#include "mad_priv.h"
39#include "mad_rmpp.h"
38#include "smi.h" 40#include "smi.h"
39#include "agent.h" 41#include "agent.h"
40 42
@@ -45,6 +47,7 @@ MODULE_AUTHOR("Sean Hefty");
45 47
46 48
47kmem_cache_t *ib_mad_cache; 49kmem_cache_t *ib_mad_cache;
50
48static struct list_head ib_mad_port_list; 51static struct list_head ib_mad_port_list;
49static u32 ib_mad_client_id = 0; 52static u32 ib_mad_client_id = 0;
50 53
@@ -58,16 +61,12 @@ static int method_in_use(struct ib_mad_mgmt_method_table **method,
58static void remove_mad_reg_req(struct ib_mad_agent_private *priv); 61static void remove_mad_reg_req(struct ib_mad_agent_private *priv);
59static struct ib_mad_agent_private *find_mad_agent( 62static struct ib_mad_agent_private *find_mad_agent(
60 struct ib_mad_port_private *port_priv, 63 struct ib_mad_port_private *port_priv,
61 struct ib_mad *mad, int solicited); 64 struct ib_mad *mad);
62static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, 65static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
63 struct ib_mad_private *mad); 66 struct ib_mad_private *mad);
64static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv); 67static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv);
65static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
66 struct ib_mad_send_wc *mad_send_wc);
67static void timeout_sends(void *data); 68static void timeout_sends(void *data);
68static void cancel_sends(void *data);
69static void local_completions(void *data); 69static void local_completions(void *data);
70static int solicited_mad(struct ib_mad *mad);
71static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, 70static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
72 struct ib_mad_agent_private *agent_priv, 71 struct ib_mad_agent_private *agent_priv,
73 u8 mgmt_class); 72 u8 mgmt_class);
@@ -197,8 +196,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
197 if (qpn == -1) 196 if (qpn == -1)
198 goto error1; 197 goto error1;
199 198
200 if (rmpp_version) 199 if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION)
201 goto error1; /* XXX: until RMPP implemented */ 200 goto error1;
202 201
203 /* Validate MAD registration request if supplied */ 202 /* Validate MAD registration request if supplied */
204 if (mad_reg_req) { 203 if (mad_reg_req) {
@@ -261,22 +260,29 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
261 ret = ERR_PTR(-ENOMEM); 260 ret = ERR_PTR(-ENOMEM);
262 goto error1; 261 goto error1;
263 } 262 }
263 memset(mad_agent_priv, 0, sizeof *mad_agent_priv);
264
265 mad_agent_priv->agent.mr = ib_get_dma_mr(port_priv->qp_info[qpn].qp->pd,
266 IB_ACCESS_LOCAL_WRITE);
267 if (IS_ERR(mad_agent_priv->agent.mr)) {
268 ret = ERR_PTR(-ENOMEM);
269 goto error2;
270 }
264 271
265 if (mad_reg_req) { 272 if (mad_reg_req) {
266 reg_req = kmalloc(sizeof *reg_req, GFP_KERNEL); 273 reg_req = kmalloc(sizeof *reg_req, GFP_KERNEL);
267 if (!reg_req) { 274 if (!reg_req) {
268 ret = ERR_PTR(-ENOMEM); 275 ret = ERR_PTR(-ENOMEM);
269 goto error2; 276 goto error3;
270 } 277 }
271 /* Make a copy of the MAD registration request */ 278 /* Make a copy of the MAD registration request */
272 memcpy(reg_req, mad_reg_req, sizeof *reg_req); 279 memcpy(reg_req, mad_reg_req, sizeof *reg_req);
273 } 280 }
274 281
275 /* Now, fill in the various structures */ 282 /* Now, fill in the various structures */
276 memset(mad_agent_priv, 0, sizeof *mad_agent_priv);
277 mad_agent_priv->qp_info = &port_priv->qp_info[qpn]; 283 mad_agent_priv->qp_info = &port_priv->qp_info[qpn];
278 mad_agent_priv->reg_req = reg_req; 284 mad_agent_priv->reg_req = reg_req;
279 mad_agent_priv->rmpp_version = rmpp_version; 285 mad_agent_priv->agent.rmpp_version = rmpp_version;
280 mad_agent_priv->agent.device = device; 286 mad_agent_priv->agent.device = device;
281 mad_agent_priv->agent.recv_handler = recv_handler; 287 mad_agent_priv->agent.recv_handler = recv_handler;
282 mad_agent_priv->agent.send_handler = send_handler; 288 mad_agent_priv->agent.send_handler = send_handler;
@@ -301,7 +307,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
301 if (method) { 307 if (method) {
302 if (method_in_use(&method, 308 if (method_in_use(&method,
303 mad_reg_req)) 309 mad_reg_req))
304 goto error3; 310 goto error4;
305 } 311 }
306 } 312 }
307 ret2 = add_nonoui_reg_req(mad_reg_req, mad_agent_priv, 313 ret2 = add_nonoui_reg_req(mad_reg_req, mad_agent_priv,
@@ -317,14 +323,14 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
317 if (is_vendor_method_in_use( 323 if (is_vendor_method_in_use(
318 vendor_class, 324 vendor_class,
319 mad_reg_req)) 325 mad_reg_req))
320 goto error3; 326 goto error4;
321 } 327 }
322 } 328 }
323 ret2 = add_oui_reg_req(mad_reg_req, mad_agent_priv); 329 ret2 = add_oui_reg_req(mad_reg_req, mad_agent_priv);
324 } 330 }
325 if (ret2) { 331 if (ret2) {
326 ret = ERR_PTR(ret2); 332 ret = ERR_PTR(ret2);
327 goto error3; 333 goto error4;
328 } 334 }
329 } 335 }
330 336
@@ -335,22 +341,24 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
335 spin_lock_init(&mad_agent_priv->lock); 341 spin_lock_init(&mad_agent_priv->lock);
336 INIT_LIST_HEAD(&mad_agent_priv->send_list); 342 INIT_LIST_HEAD(&mad_agent_priv->send_list);
337 INIT_LIST_HEAD(&mad_agent_priv->wait_list); 343 INIT_LIST_HEAD(&mad_agent_priv->wait_list);
344 INIT_LIST_HEAD(&mad_agent_priv->done_list);
345 INIT_LIST_HEAD(&mad_agent_priv->rmpp_list);
338 INIT_WORK(&mad_agent_priv->timed_work, timeout_sends, mad_agent_priv); 346 INIT_WORK(&mad_agent_priv->timed_work, timeout_sends, mad_agent_priv);
339 INIT_LIST_HEAD(&mad_agent_priv->local_list); 347 INIT_LIST_HEAD(&mad_agent_priv->local_list);
340 INIT_WORK(&mad_agent_priv->local_work, local_completions, 348 INIT_WORK(&mad_agent_priv->local_work, local_completions,
341 mad_agent_priv); 349 mad_agent_priv);
342 INIT_LIST_HEAD(&mad_agent_priv->canceled_list);
343 INIT_WORK(&mad_agent_priv->canceled_work, cancel_sends, mad_agent_priv);
344 atomic_set(&mad_agent_priv->refcount, 1); 350 atomic_set(&mad_agent_priv->refcount, 1);
345 init_waitqueue_head(&mad_agent_priv->wait); 351 init_waitqueue_head(&mad_agent_priv->wait);
346 352
347 return &mad_agent_priv->agent; 353 return &mad_agent_priv->agent;
348 354
349error3: 355error4:
350 spin_unlock_irqrestore(&port_priv->reg_lock, flags); 356 spin_unlock_irqrestore(&port_priv->reg_lock, flags);
351 kfree(reg_req); 357 kfree(reg_req);
352error2: 358error3:
353 kfree(mad_agent_priv); 359 kfree(mad_agent_priv);
360error2:
361 ib_dereg_mr(mad_agent_priv->agent.mr);
354error1: 362error1:
355 return ret; 363 return ret;
356} 364}
@@ -487,18 +495,16 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
487 * MADs, preventing us from queuing additional work 495 * MADs, preventing us from queuing additional work
488 */ 496 */
489 cancel_mads(mad_agent_priv); 497 cancel_mads(mad_agent_priv);
490
491 port_priv = mad_agent_priv->qp_info->port_priv; 498 port_priv = mad_agent_priv->qp_info->port_priv;
492
493 cancel_delayed_work(&mad_agent_priv->timed_work); 499 cancel_delayed_work(&mad_agent_priv->timed_work);
494 flush_workqueue(port_priv->wq);
495 500
496 spin_lock_irqsave(&port_priv->reg_lock, flags); 501 spin_lock_irqsave(&port_priv->reg_lock, flags);
497 remove_mad_reg_req(mad_agent_priv); 502 remove_mad_reg_req(mad_agent_priv);
498 list_del(&mad_agent_priv->agent_list); 503 list_del(&mad_agent_priv->agent_list);
499 spin_unlock_irqrestore(&port_priv->reg_lock, flags); 504 spin_unlock_irqrestore(&port_priv->reg_lock, flags);
500 505
501 /* XXX: Cleanup pending RMPP receives for this agent */ 506 flush_workqueue(port_priv->wq);
507 ib_cancel_rmpp_recvs(mad_agent_priv);
502 508
503 atomic_dec(&mad_agent_priv->refcount); 509 atomic_dec(&mad_agent_priv->refcount);
504 wait_event(mad_agent_priv->wait, 510 wait_event(mad_agent_priv->wait,
@@ -506,6 +512,7 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
506 512
507 if (mad_agent_priv->reg_req) 513 if (mad_agent_priv->reg_req)
508 kfree(mad_agent_priv->reg_req); 514 kfree(mad_agent_priv->reg_req);
515 ib_dereg_mr(mad_agent_priv->agent.mr);
509 kfree(mad_agent_priv); 516 kfree(mad_agent_priv);
510} 517}
511 518
@@ -551,6 +558,13 @@ int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent)
551} 558}
552EXPORT_SYMBOL(ib_unregister_mad_agent); 559EXPORT_SYMBOL(ib_unregister_mad_agent);
553 560
561static inline int response_mad(struct ib_mad *mad)
562{
563 /* Trap represses are responses although response bit is reset */
564 return ((mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) ||
565 (mad->mad_hdr.method & IB_MGMT_METHOD_RESP));
566}
567
554static void dequeue_mad(struct ib_mad_list_head *mad_list) 568static void dequeue_mad(struct ib_mad_list_head *mad_list)
555{ 569{
556 struct ib_mad_queue *mad_queue; 570 struct ib_mad_queue *mad_queue;
@@ -643,7 +657,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
643 struct ib_smp *smp, 657 struct ib_smp *smp,
644 struct ib_send_wr *send_wr) 658 struct ib_send_wr *send_wr)
645{ 659{
646 int ret, solicited; 660 int ret;
647 unsigned long flags; 661 unsigned long flags;
648 struct ib_mad_local_private *local; 662 struct ib_mad_local_private *local;
649 struct ib_mad_private *mad_priv; 663 struct ib_mad_private *mad_priv;
@@ -689,11 +703,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
689 switch (ret) 703 switch (ret)
690 { 704 {
691 case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY: 705 case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY:
692 /* 706 if (response_mad(&mad_priv->mad.mad) &&
693 * See if response is solicited and
694 * there is a recv handler
695 */
696 if (solicited_mad(&mad_priv->mad.mad) &&
697 mad_agent_priv->agent.recv_handler) { 707 mad_agent_priv->agent.recv_handler) {
698 local->mad_priv = mad_priv; 708 local->mad_priv = mad_priv;
699 local->recv_mad_agent = mad_agent_priv; 709 local->recv_mad_agent = mad_agent_priv;
@@ -710,15 +720,13 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
710 break; 720 break;
711 case IB_MAD_RESULT_SUCCESS: 721 case IB_MAD_RESULT_SUCCESS:
712 /* Treat like an incoming receive MAD */ 722 /* Treat like an incoming receive MAD */
713 solicited = solicited_mad(&mad_priv->mad.mad);
714 port_priv = ib_get_mad_port(mad_agent_priv->agent.device, 723 port_priv = ib_get_mad_port(mad_agent_priv->agent.device,
715 mad_agent_priv->agent.port_num); 724 mad_agent_priv->agent.port_num);
716 if (port_priv) { 725 if (port_priv) {
717 mad_priv->mad.mad.mad_hdr.tid = 726 mad_priv->mad.mad.mad_hdr.tid =
718 ((struct ib_mad *)smp)->mad_hdr.tid; 727 ((struct ib_mad *)smp)->mad_hdr.tid;
719 recv_mad_agent = find_mad_agent(port_priv, 728 recv_mad_agent = find_mad_agent(port_priv,
720 &mad_priv->mad.mad, 729 &mad_priv->mad.mad);
721 solicited);
722 } 730 }
723 if (!port_priv || !recv_mad_agent) { 731 if (!port_priv || !recv_mad_agent) {
724 kmem_cache_free(ib_mad_cache, mad_priv); 732 kmem_cache_free(ib_mad_cache, mad_priv);
@@ -750,43 +758,133 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
750 list_add_tail(&local->completion_list, &mad_agent_priv->local_list); 758 list_add_tail(&local->completion_list, &mad_agent_priv->local_list);
751 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 759 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
752 queue_work(mad_agent_priv->qp_info->port_priv->wq, 760 queue_work(mad_agent_priv->qp_info->port_priv->wq,
753 &mad_agent_priv->local_work); 761 &mad_agent_priv->local_work);
754 ret = 1; 762 ret = 1;
755out: 763out:
756 return ret; 764 return ret;
757} 765}
758 766
759static int ib_send_mad(struct ib_mad_agent_private *mad_agent_priv, 767static int get_buf_length(int hdr_len, int data_len)
760 struct ib_mad_send_wr_private *mad_send_wr) 768{
769 int seg_size, pad;
770
771 seg_size = sizeof(struct ib_mad) - hdr_len;
772 if (data_len && seg_size) {
773 pad = seg_size - data_len % seg_size;
774 if (pad == seg_size)
775 pad = 0;
776 } else
777 pad = seg_size;
778 return hdr_len + data_len + pad;
779}
780
781struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
782 u32 remote_qpn, u16 pkey_index,
783 struct ib_ah *ah, int rmpp_active,
784 int hdr_len, int data_len,
785 unsigned int __nocast gfp_mask)
786{
787 struct ib_mad_agent_private *mad_agent_priv;
788 struct ib_mad_send_buf *send_buf;
789 int buf_size;
790 void *buf;
791
792 mad_agent_priv = container_of(mad_agent,
793 struct ib_mad_agent_private, agent);
794 buf_size = get_buf_length(hdr_len, data_len);
795
796 if ((!mad_agent->rmpp_version &&
797 (rmpp_active || buf_size > sizeof(struct ib_mad))) ||
798 (!rmpp_active && buf_size > sizeof(struct ib_mad)))
799 return ERR_PTR(-EINVAL);
800
801 buf = kmalloc(sizeof *send_buf + buf_size, gfp_mask);
802 if (!buf)
803 return ERR_PTR(-ENOMEM);
804 memset(buf, 0, sizeof *send_buf + buf_size);
805
806 send_buf = buf + buf_size;
807 send_buf->mad = buf;
808
809 send_buf->sge.addr = dma_map_single(mad_agent->device->dma_device,
810 buf, buf_size, DMA_TO_DEVICE);
811 pci_unmap_addr_set(send_buf, mapping, send_buf->sge.addr);
812 send_buf->sge.length = buf_size;
813 send_buf->sge.lkey = mad_agent->mr->lkey;
814
815 send_buf->send_wr.wr_id = (unsigned long) send_buf;
816 send_buf->send_wr.sg_list = &send_buf->sge;
817 send_buf->send_wr.num_sge = 1;
818 send_buf->send_wr.opcode = IB_WR_SEND;
819 send_buf->send_wr.send_flags = IB_SEND_SIGNALED;
820 send_buf->send_wr.wr.ud.ah = ah;
821 send_buf->send_wr.wr.ud.mad_hdr = &send_buf->mad->mad_hdr;
822 send_buf->send_wr.wr.ud.remote_qpn = remote_qpn;
823 send_buf->send_wr.wr.ud.remote_qkey = IB_QP_SET_QKEY;
824 send_buf->send_wr.wr.ud.pkey_index = pkey_index;
825
826 if (rmpp_active) {
827 struct ib_rmpp_mad *rmpp_mad;
828 rmpp_mad = (struct ib_rmpp_mad *)send_buf->mad;
829 rmpp_mad->rmpp_hdr.paylen_newwin = cpu_to_be32(hdr_len -
830 offsetof(struct ib_rmpp_mad, data) + data_len);
831 rmpp_mad->rmpp_hdr.rmpp_version = mad_agent->rmpp_version;
832 rmpp_mad->rmpp_hdr.rmpp_type = IB_MGMT_RMPP_TYPE_DATA;
833 ib_set_rmpp_flags(&rmpp_mad->rmpp_hdr,
834 IB_MGMT_RMPP_FLAG_ACTIVE);
835 }
836
837 send_buf->mad_agent = mad_agent;
838 atomic_inc(&mad_agent_priv->refcount);
839 return send_buf;
840}
841EXPORT_SYMBOL(ib_create_send_mad);
842
843void ib_free_send_mad(struct ib_mad_send_buf *send_buf)
844{
845 struct ib_mad_agent_private *mad_agent_priv;
846
847 mad_agent_priv = container_of(send_buf->mad_agent,
848 struct ib_mad_agent_private, agent);
849
850 dma_unmap_single(send_buf->mad_agent->device->dma_device,
851 pci_unmap_addr(send_buf, mapping),
852 send_buf->sge.length, DMA_TO_DEVICE);
853 kfree(send_buf->mad);
854
855 if (atomic_dec_and_test(&mad_agent_priv->refcount))
856 wake_up(&mad_agent_priv->wait);
857}
858EXPORT_SYMBOL(ib_free_send_mad);
859
860int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr)
761{ 861{
762 struct ib_mad_qp_info *qp_info; 862 struct ib_mad_qp_info *qp_info;
763 struct ib_send_wr *bad_send_wr; 863 struct ib_send_wr *bad_send_wr;
864 struct list_head *list;
764 unsigned long flags; 865 unsigned long flags;
765 int ret; 866 int ret;
766 867
767 /* Replace user's WR ID with our own to find WR upon completion */ 868 /* Set WR ID to find mad_send_wr upon completion */
768 qp_info = mad_agent_priv->qp_info; 869 qp_info = mad_send_wr->mad_agent_priv->qp_info;
769 mad_send_wr->wr_id = mad_send_wr->send_wr.wr_id;
770 mad_send_wr->send_wr.wr_id = (unsigned long)&mad_send_wr->mad_list; 870 mad_send_wr->send_wr.wr_id = (unsigned long)&mad_send_wr->mad_list;
771 mad_send_wr->mad_list.mad_queue = &qp_info->send_queue; 871 mad_send_wr->mad_list.mad_queue = &qp_info->send_queue;
772 872
773 spin_lock_irqsave(&qp_info->send_queue.lock, flags); 873 spin_lock_irqsave(&qp_info->send_queue.lock, flags);
774 if (qp_info->send_queue.count++ < qp_info->send_queue.max_active) { 874 if (qp_info->send_queue.count < qp_info->send_queue.max_active) {
775 list_add_tail(&mad_send_wr->mad_list.list, 875 ret = ib_post_send(mad_send_wr->mad_agent_priv->agent.qp,
776 &qp_info->send_queue.list);
777 spin_unlock_irqrestore(&qp_info->send_queue.lock, flags);
778 ret = ib_post_send(mad_agent_priv->agent.qp,
779 &mad_send_wr->send_wr, &bad_send_wr); 876 &mad_send_wr->send_wr, &bad_send_wr);
780 if (ret) { 877 list = &qp_info->send_queue.list;
781 printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret);
782 dequeue_mad(&mad_send_wr->mad_list);
783 }
784 } else { 878 } else {
785 list_add_tail(&mad_send_wr->mad_list.list,
786 &qp_info->overflow_list);
787 spin_unlock_irqrestore(&qp_info->send_queue.lock, flags);
788 ret = 0; 879 ret = 0;
880 list = &qp_info->overflow_list;
789 } 881 }
882
883 if (!ret) {
884 qp_info->send_queue.count++;
885 list_add_tail(&mad_send_wr->mad_list.list, list);
886 }
887 spin_unlock_irqrestore(&qp_info->send_queue.lock, flags);
790 return ret; 888 return ret;
791} 889}
792 890
@@ -860,18 +958,19 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent,
860 ret = -ENOMEM; 958 ret = -ENOMEM;
861 goto error2; 959 goto error2;
862 } 960 }
961 memset(mad_send_wr, 0, sizeof *mad_send_wr);
863 962
864 mad_send_wr->send_wr = *send_wr; 963 mad_send_wr->send_wr = *send_wr;
865 mad_send_wr->send_wr.sg_list = mad_send_wr->sg_list; 964 mad_send_wr->send_wr.sg_list = mad_send_wr->sg_list;
866 memcpy(mad_send_wr->sg_list, send_wr->sg_list, 965 memcpy(mad_send_wr->sg_list, send_wr->sg_list,
867 sizeof *send_wr->sg_list * send_wr->num_sge); 966 sizeof *send_wr->sg_list * send_wr->num_sge);
868 mad_send_wr->send_wr.next = NULL; 967 mad_send_wr->wr_id = send_wr->wr_id;
869 mad_send_wr->tid = send_wr->wr.ud.mad_hdr->tid; 968 mad_send_wr->tid = send_wr->wr.ud.mad_hdr->tid;
870 mad_send_wr->agent = mad_agent; 969 mad_send_wr->mad_agent_priv = mad_agent_priv;
871 /* Timeout will be updated after send completes */ 970 /* Timeout will be updated after send completes */
872 mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr. 971 mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr.
873 ud.timeout_ms); 972 ud.timeout_ms);
874 mad_send_wr->retry = 0; 973 mad_send_wr->retries = mad_send_wr->send_wr.wr.ud.retries;
875 /* One reference for each work request to QP + response */ 974 /* One reference for each work request to QP + response */
876 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0); 975 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0);
877 mad_send_wr->status = IB_WC_SUCCESS; 976 mad_send_wr->status = IB_WC_SUCCESS;
@@ -883,8 +982,13 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent,
883 &mad_agent_priv->send_list); 982 &mad_agent_priv->send_list);
884 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 983 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
885 984
886 ret = ib_send_mad(mad_agent_priv, mad_send_wr); 985 if (mad_agent_priv->agent.rmpp_version) {
887 if (ret) { 986 ret = ib_send_rmpp_mad(mad_send_wr);
987 if (ret >= 0 && ret != IB_RMPP_RESULT_CONSUMED)
988 ret = ib_send_mad(mad_send_wr);
989 } else
990 ret = ib_send_mad(mad_send_wr);
991 if (ret < 0) {
888 /* Fail send request */ 992 /* Fail send request */
889 spin_lock_irqsave(&mad_agent_priv->lock, flags); 993 spin_lock_irqsave(&mad_agent_priv->lock, flags);
890 list_del(&mad_send_wr->agent_list); 994 list_del(&mad_send_wr->agent_list);
@@ -910,41 +1014,28 @@ EXPORT_SYMBOL(ib_post_send_mad);
910 */ 1014 */
911void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc) 1015void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc)
912{ 1016{
913 struct ib_mad_recv_buf *entry; 1017 struct ib_mad_recv_buf *mad_recv_buf, *temp_recv_buf;
914 struct ib_mad_private_header *mad_priv_hdr; 1018 struct ib_mad_private_header *mad_priv_hdr;
915 struct ib_mad_private *priv; 1019 struct ib_mad_private *priv;
1020 struct list_head free_list;
916 1021
917 mad_priv_hdr = container_of(mad_recv_wc, 1022 INIT_LIST_HEAD(&free_list);
918 struct ib_mad_private_header, 1023 list_splice_init(&mad_recv_wc->rmpp_list, &free_list);
919 recv_wc);
920 priv = container_of(mad_priv_hdr, struct ib_mad_private, header);
921 1024
922 /* 1025 list_for_each_entry_safe(mad_recv_buf, temp_recv_buf,
923 * Walk receive buffer list associated with this WC 1026 &free_list, list) {
924 * No need to remove them from list of receive buffers 1027 mad_recv_wc = container_of(mad_recv_buf, struct ib_mad_recv_wc,
925 */ 1028 recv_buf);
926 list_for_each_entry(entry, &mad_recv_wc->recv_buf.list, list) {
927 /* Free previous receive buffer */
928 kmem_cache_free(ib_mad_cache, priv);
929 mad_priv_hdr = container_of(mad_recv_wc, 1029 mad_priv_hdr = container_of(mad_recv_wc,
930 struct ib_mad_private_header, 1030 struct ib_mad_private_header,
931 recv_wc); 1031 recv_wc);
932 priv = container_of(mad_priv_hdr, struct ib_mad_private, 1032 priv = container_of(mad_priv_hdr, struct ib_mad_private,
933 header); 1033 header);
1034 kmem_cache_free(ib_mad_cache, priv);
934 } 1035 }
935
936 /* Free last buffer */
937 kmem_cache_free(ib_mad_cache, priv);
938} 1036}
939EXPORT_SYMBOL(ib_free_recv_mad); 1037EXPORT_SYMBOL(ib_free_recv_mad);
940 1038
941void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc,
942 void *buf)
943{
944 printk(KERN_ERR PFX "ib_coalesce_recv_mad() not implemented yet\n");
945}
946EXPORT_SYMBOL(ib_coalesce_recv_mad);
947
948struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp, 1039struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp,
949 u8 rmpp_version, 1040 u8 rmpp_version,
950 ib_mad_send_handler send_handler, 1041 ib_mad_send_handler send_handler,
@@ -1338,42 +1429,15 @@ out:
1338 return; 1429 return;
1339} 1430}
1340 1431
1341static int response_mad(struct ib_mad *mad)
1342{
1343 /* Trap represses are responses although response bit is reset */
1344 return ((mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) ||
1345 (mad->mad_hdr.method & IB_MGMT_METHOD_RESP));
1346}
1347
1348static int solicited_mad(struct ib_mad *mad)
1349{
1350 /* CM MADs are never solicited */
1351 if (mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_CM) {
1352 return 0;
1353 }
1354
1355 /* XXX: Determine whether MAD is using RMPP */
1356
1357 /* Not using RMPP */
1358 /* Is this MAD a response to a previous MAD ? */
1359 return response_mad(mad);
1360}
1361
1362static struct ib_mad_agent_private * 1432static struct ib_mad_agent_private *
1363find_mad_agent(struct ib_mad_port_private *port_priv, 1433find_mad_agent(struct ib_mad_port_private *port_priv,
1364 struct ib_mad *mad, 1434 struct ib_mad *mad)
1365 int solicited)
1366{ 1435{
1367 struct ib_mad_agent_private *mad_agent = NULL; 1436 struct ib_mad_agent_private *mad_agent = NULL;
1368 unsigned long flags; 1437 unsigned long flags;
1369 1438
1370 spin_lock_irqsave(&port_priv->reg_lock, flags); 1439 spin_lock_irqsave(&port_priv->reg_lock, flags);
1371 1440 if (response_mad(mad)) {
1372 /*
1373 * Whether MAD was solicited determines type of routing to
1374 * MAD client.
1375 */
1376 if (solicited) {
1377 u32 hi_tid; 1441 u32 hi_tid;
1378 struct ib_mad_agent_private *entry; 1442 struct ib_mad_agent_private *entry;
1379 1443
@@ -1477,21 +1541,20 @@ out:
1477 return valid; 1541 return valid;
1478} 1542}
1479 1543
1480/* 1544static int is_data_mad(struct ib_mad_agent_private *mad_agent_priv,
1481 * Return start of fully reassembled MAD, or NULL, if MAD isn't assembled yet 1545 struct ib_mad_hdr *mad_hdr)
1482 */
1483static struct ib_mad_private *
1484reassemble_recv(struct ib_mad_agent_private *mad_agent_priv,
1485 struct ib_mad_private *recv)
1486{ 1546{
1487 /* Until we have RMPP, all receives are reassembled!... */ 1547 struct ib_rmpp_mad *rmpp_mad;
1488 INIT_LIST_HEAD(&recv->header.recv_wc.recv_buf.list); 1548
1489 return recv; 1549 rmpp_mad = (struct ib_rmpp_mad *)mad_hdr;
1550 return !mad_agent_priv->agent.rmpp_version ||
1551 !(ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
1552 IB_MGMT_RMPP_FLAG_ACTIVE) ||
1553 (rmpp_mad->rmpp_hdr.rmpp_type == IB_MGMT_RMPP_TYPE_DATA);
1490} 1554}
1491 1555
1492static struct ib_mad_send_wr_private* 1556struct ib_mad_send_wr_private*
1493find_send_req(struct ib_mad_agent_private *mad_agent_priv, 1557ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid)
1494 u64 tid)
1495{ 1558{
1496 struct ib_mad_send_wr_private *mad_send_wr; 1559 struct ib_mad_send_wr_private *mad_send_wr;
1497 1560
@@ -1507,7 +1570,9 @@ find_send_req(struct ib_mad_agent_private *mad_agent_priv,
1507 */ 1570 */
1508 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, 1571 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
1509 agent_list) { 1572 agent_list) {
1510 if (mad_send_wr->tid == tid && mad_send_wr->timeout) { 1573 if (is_data_mad(mad_agent_priv,
1574 mad_send_wr->send_wr.wr.ud.mad_hdr) &&
1575 mad_send_wr->tid == tid && mad_send_wr->timeout) {
1511 /* Verify request has not been canceled */ 1576 /* Verify request has not been canceled */
1512 return (mad_send_wr->status == IB_WC_SUCCESS) ? 1577 return (mad_send_wr->status == IB_WC_SUCCESS) ?
1513 mad_send_wr : NULL; 1578 mad_send_wr : NULL;
@@ -1516,43 +1581,55 @@ find_send_req(struct ib_mad_agent_private *mad_agent_priv,
1516 return NULL; 1581 return NULL;
1517} 1582}
1518 1583
1584void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr)
1585{
1586 mad_send_wr->timeout = 0;
1587 if (mad_send_wr->refcount == 1) {
1588 list_del(&mad_send_wr->agent_list);
1589 list_add_tail(&mad_send_wr->agent_list,
1590 &mad_send_wr->mad_agent_priv->done_list);
1591 }
1592}
1593
1519static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, 1594static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
1520 struct ib_mad_private *recv, 1595 struct ib_mad_recv_wc *mad_recv_wc)
1521 int solicited)
1522{ 1596{
1523 struct ib_mad_send_wr_private *mad_send_wr; 1597 struct ib_mad_send_wr_private *mad_send_wr;
1524 struct ib_mad_send_wc mad_send_wc; 1598 struct ib_mad_send_wc mad_send_wc;
1525 unsigned long flags; 1599 unsigned long flags;
1526 1600 u64 tid;
1527 /* Fully reassemble receive before processing */ 1601
1528 recv = reassemble_recv(mad_agent_priv, recv); 1602 INIT_LIST_HEAD(&mad_recv_wc->rmpp_list);
1529 if (!recv) { 1603 list_add(&mad_recv_wc->recv_buf.list, &mad_recv_wc->rmpp_list);
1530 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1604 if (mad_agent_priv->agent.rmpp_version) {
1531 wake_up(&mad_agent_priv->wait); 1605 mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv,
1532 return; 1606 mad_recv_wc);
1607 if (!mad_recv_wc) {
1608 if (atomic_dec_and_test(&mad_agent_priv->refcount))
1609 wake_up(&mad_agent_priv->wait);
1610 return;
1611 }
1533 } 1612 }
1534 1613
1535 /* Complete corresponding request */ 1614 /* Complete corresponding request */
1536 if (solicited) { 1615 if (response_mad(mad_recv_wc->recv_buf.mad)) {
1616 tid = mad_recv_wc->recv_buf.mad->mad_hdr.tid;
1537 spin_lock_irqsave(&mad_agent_priv->lock, flags); 1617 spin_lock_irqsave(&mad_agent_priv->lock, flags);
1538 mad_send_wr = find_send_req(mad_agent_priv, 1618 mad_send_wr = ib_find_send_mad(mad_agent_priv, tid);
1539 recv->mad.mad.mad_hdr.tid);
1540 if (!mad_send_wr) { 1619 if (!mad_send_wr) {
1541 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 1620 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
1542 ib_free_recv_mad(&recv->header.recv_wc); 1621 ib_free_recv_mad(mad_recv_wc);
1543 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1622 if (atomic_dec_and_test(&mad_agent_priv->refcount))
1544 wake_up(&mad_agent_priv->wait); 1623 wake_up(&mad_agent_priv->wait);
1545 return; 1624 return;
1546 } 1625 }
1547 /* Timeout = 0 means that we won't wait for a response */ 1626 ib_mark_mad_done(mad_send_wr);
1548 mad_send_wr->timeout = 0;
1549 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 1627 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
1550 1628
1551 /* Defined behavior is to complete response before request */ 1629 /* Defined behavior is to complete response before request */
1552 recv->header.recv_wc.wc->wr_id = mad_send_wr->wr_id; 1630 mad_recv_wc->wc->wr_id = mad_send_wr->wr_id;
1553 mad_agent_priv->agent.recv_handler( 1631 mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent,
1554 &mad_agent_priv->agent, 1632 mad_recv_wc);
1555 &recv->header.recv_wc);
1556 atomic_dec(&mad_agent_priv->refcount); 1633 atomic_dec(&mad_agent_priv->refcount);
1557 1634
1558 mad_send_wc.status = IB_WC_SUCCESS; 1635 mad_send_wc.status = IB_WC_SUCCESS;
@@ -1560,9 +1637,8 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
1560 mad_send_wc.wr_id = mad_send_wr->wr_id; 1637 mad_send_wc.wr_id = mad_send_wr->wr_id;
1561 ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); 1638 ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc);
1562 } else { 1639 } else {
1563 mad_agent_priv->agent.recv_handler( 1640 mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent,
1564 &mad_agent_priv->agent, 1641 mad_recv_wc);
1565 &recv->header.recv_wc);
1566 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1642 if (atomic_dec_and_test(&mad_agent_priv->refcount))
1567 wake_up(&mad_agent_priv->wait); 1643 wake_up(&mad_agent_priv->wait);
1568 } 1644 }
@@ -1576,7 +1652,6 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
1576 struct ib_mad_private *recv, *response; 1652 struct ib_mad_private *recv, *response;
1577 struct ib_mad_list_head *mad_list; 1653 struct ib_mad_list_head *mad_list;
1578 struct ib_mad_agent_private *mad_agent; 1654 struct ib_mad_agent_private *mad_agent;
1579 int solicited;
1580 1655
1581 response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); 1656 response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL);
1582 if (!response) 1657 if (!response)
@@ -1662,11 +1737,9 @@ local:
1662 } 1737 }
1663 } 1738 }
1664 1739
1665 /* Determine corresponding MAD agent for incoming receive MAD */ 1740 mad_agent = find_mad_agent(port_priv, &recv->mad.mad);
1666 solicited = solicited_mad(&recv->mad.mad);
1667 mad_agent = find_mad_agent(port_priv, &recv->mad.mad, solicited);
1668 if (mad_agent) { 1741 if (mad_agent) {
1669 ib_mad_complete_recv(mad_agent, recv, solicited); 1742 ib_mad_complete_recv(mad_agent, &recv->header.recv_wc);
1670 /* 1743 /*
1671 * recv is freed up in error cases in ib_mad_complete_recv 1744 * recv is freed up in error cases in ib_mad_complete_recv
1672 * or via recv_handler in ib_mad_complete_recv() 1745 * or via recv_handler in ib_mad_complete_recv()
@@ -1710,26 +1783,31 @@ static void adjust_timeout(struct ib_mad_agent_private *mad_agent_priv)
1710 } 1783 }
1711} 1784}
1712 1785
1713static void wait_for_response(struct ib_mad_agent_private *mad_agent_priv, 1786static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr)
1714 struct ib_mad_send_wr_private *mad_send_wr )
1715{ 1787{
1788 struct ib_mad_agent_private *mad_agent_priv;
1716 struct ib_mad_send_wr_private *temp_mad_send_wr; 1789 struct ib_mad_send_wr_private *temp_mad_send_wr;
1717 struct list_head *list_item; 1790 struct list_head *list_item;
1718 unsigned long delay; 1791 unsigned long delay;
1719 1792
1793 mad_agent_priv = mad_send_wr->mad_agent_priv;
1720 list_del(&mad_send_wr->agent_list); 1794 list_del(&mad_send_wr->agent_list);
1721 1795
1722 delay = mad_send_wr->timeout; 1796 delay = mad_send_wr->timeout;
1723 mad_send_wr->timeout += jiffies; 1797 mad_send_wr->timeout += jiffies;
1724 1798
1725 list_for_each_prev(list_item, &mad_agent_priv->wait_list) { 1799 if (delay) {
1726 temp_mad_send_wr = list_entry(list_item, 1800 list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
1727 struct ib_mad_send_wr_private, 1801 temp_mad_send_wr = list_entry(list_item,
1728 agent_list); 1802 struct ib_mad_send_wr_private,
1729 if (time_after(mad_send_wr->timeout, 1803 agent_list);
1730 temp_mad_send_wr->timeout)) 1804 if (time_after(mad_send_wr->timeout,
1731 break; 1805 temp_mad_send_wr->timeout))
1806 break;
1807 }
1732 } 1808 }
1809 else
1810 list_item = &mad_agent_priv->wait_list;
1733 list_add(&mad_send_wr->agent_list, list_item); 1811 list_add(&mad_send_wr->agent_list, list_item);
1734 1812
1735 /* Reschedule a work item if we have a shorter timeout */ 1813 /* Reschedule a work item if we have a shorter timeout */
@@ -1740,19 +1818,32 @@ static void wait_for_response(struct ib_mad_agent_private *mad_agent_priv,
1740 } 1818 }
1741} 1819}
1742 1820
1821void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr,
1822 int timeout_ms)
1823{
1824 mad_send_wr->timeout = msecs_to_jiffies(timeout_ms);
1825 wait_for_response(mad_send_wr);
1826}
1827
1743/* 1828/*
1744 * Process a send work completion 1829 * Process a send work completion
1745 */ 1830 */
1746static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, 1831void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
1747 struct ib_mad_send_wc *mad_send_wc) 1832 struct ib_mad_send_wc *mad_send_wc)
1748{ 1833{
1749 struct ib_mad_agent_private *mad_agent_priv; 1834 struct ib_mad_agent_private *mad_agent_priv;
1750 unsigned long flags; 1835 unsigned long flags;
1836 int ret;
1751 1837
1752 mad_agent_priv = container_of(mad_send_wr->agent, 1838 mad_agent_priv = mad_send_wr->mad_agent_priv;
1753 struct ib_mad_agent_private, agent);
1754
1755 spin_lock_irqsave(&mad_agent_priv->lock, flags); 1839 spin_lock_irqsave(&mad_agent_priv->lock, flags);
1840 if (mad_agent_priv->agent.rmpp_version) {
1841 ret = ib_process_rmpp_send_wc(mad_send_wr, mad_send_wc);
1842 if (ret == IB_RMPP_RESULT_CONSUMED)
1843 goto done;
1844 } else
1845 ret = IB_RMPP_RESULT_UNHANDLED;
1846
1756 if (mad_send_wc->status != IB_WC_SUCCESS && 1847 if (mad_send_wc->status != IB_WC_SUCCESS &&
1757 mad_send_wr->status == IB_WC_SUCCESS) { 1848 mad_send_wr->status == IB_WC_SUCCESS) {
1758 mad_send_wr->status = mad_send_wc->status; 1849 mad_send_wr->status = mad_send_wc->status;
@@ -1762,10 +1853,9 @@ static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
1762 if (--mad_send_wr->refcount > 0) { 1853 if (--mad_send_wr->refcount > 0) {
1763 if (mad_send_wr->refcount == 1 && mad_send_wr->timeout && 1854 if (mad_send_wr->refcount == 1 && mad_send_wr->timeout &&
1764 mad_send_wr->status == IB_WC_SUCCESS) { 1855 mad_send_wr->status == IB_WC_SUCCESS) {
1765 wait_for_response(mad_agent_priv, mad_send_wr); 1856 wait_for_response(mad_send_wr);
1766 } 1857 }
1767 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 1858 goto done;
1768 return;
1769 } 1859 }
1770 1860
1771 /* Remove send from MAD agent and notify client of completion */ 1861 /* Remove send from MAD agent and notify client of completion */
@@ -1775,14 +1865,18 @@ static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
1775 1865
1776 if (mad_send_wr->status != IB_WC_SUCCESS ) 1866 if (mad_send_wr->status != IB_WC_SUCCESS )
1777 mad_send_wc->status = mad_send_wr->status; 1867 mad_send_wc->status = mad_send_wr->status;
1778 mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, 1868 if (ret != IB_RMPP_RESULT_INTERNAL)
1779 mad_send_wc); 1869 mad_agent_priv->agent.send_handler(&mad_agent_priv->agent,
1870 mad_send_wc);
1780 1871
1781 /* Release reference on agent taken when sending */ 1872 /* Release reference on agent taken when sending */
1782 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1873 if (atomic_dec_and_test(&mad_agent_priv->refcount))
1783 wake_up(&mad_agent_priv->wait); 1874 wake_up(&mad_agent_priv->wait);
1784 1875
1785 kfree(mad_send_wr); 1876 kfree(mad_send_wr);
1877 return;
1878done:
1879 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
1786} 1880}
1787 1881
1788static void ib_mad_send_done_handler(struct ib_mad_port_private *port_priv, 1882static void ib_mad_send_done_handler(struct ib_mad_port_private *port_priv,
@@ -1961,6 +2055,8 @@ static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv)
1961 2055
1962 /* Empty wait list to prevent receives from finding a request */ 2056 /* Empty wait list to prevent receives from finding a request */
1963 list_splice_init(&mad_agent_priv->wait_list, &cancel_list); 2057 list_splice_init(&mad_agent_priv->wait_list, &cancel_list);
2058 /* Empty local completion list as well */
2059 list_splice_init(&mad_agent_priv->local_list, &cancel_list);
1964 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2060 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
1965 2061
1966 /* Report all cancelled requests */ 2062 /* Report all cancelled requests */
@@ -1980,8 +2076,7 @@ static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv)
1980} 2076}
1981 2077
1982static struct ib_mad_send_wr_private* 2078static struct ib_mad_send_wr_private*
1983find_send_by_wr_id(struct ib_mad_agent_private *mad_agent_priv, 2079find_send_by_wr_id(struct ib_mad_agent_private *mad_agent_priv, u64 wr_id)
1984 u64 wr_id)
1985{ 2080{
1986 struct ib_mad_send_wr_private *mad_send_wr; 2081 struct ib_mad_send_wr_private *mad_send_wr;
1987 2082
@@ -1993,79 +2088,50 @@ find_send_by_wr_id(struct ib_mad_agent_private *mad_agent_priv,
1993 2088
1994 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, 2089 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
1995 agent_list) { 2090 agent_list) {
1996 if (mad_send_wr->wr_id == wr_id) 2091 if (is_data_mad(mad_agent_priv,
2092 mad_send_wr->send_wr.wr.ud.mad_hdr) &&
2093 mad_send_wr->wr_id == wr_id)
1997 return mad_send_wr; 2094 return mad_send_wr;
1998 } 2095 }
1999 return NULL; 2096 return NULL;
2000} 2097}
2001 2098
2002void cancel_sends(void *data) 2099int ib_modify_mad(struct ib_mad_agent *mad_agent, u64 wr_id, u32 timeout_ms)
2003{
2004 struct ib_mad_agent_private *mad_agent_priv;
2005 struct ib_mad_send_wr_private *mad_send_wr;
2006 struct ib_mad_send_wc mad_send_wc;
2007 unsigned long flags;
2008
2009 mad_agent_priv = data;
2010
2011 mad_send_wc.status = IB_WC_WR_FLUSH_ERR;
2012 mad_send_wc.vendor_err = 0;
2013
2014 spin_lock_irqsave(&mad_agent_priv->lock, flags);
2015 while (!list_empty(&mad_agent_priv->canceled_list)) {
2016 mad_send_wr = list_entry(mad_agent_priv->canceled_list.next,
2017 struct ib_mad_send_wr_private,
2018 agent_list);
2019
2020 list_del(&mad_send_wr->agent_list);
2021 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2022
2023 mad_send_wc.wr_id = mad_send_wr->wr_id;
2024 mad_agent_priv->agent.send_handler(&mad_agent_priv->agent,
2025 &mad_send_wc);
2026
2027 kfree(mad_send_wr);
2028 if (atomic_dec_and_test(&mad_agent_priv->refcount))
2029 wake_up(&mad_agent_priv->wait);
2030 spin_lock_irqsave(&mad_agent_priv->lock, flags);
2031 }
2032 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2033}
2034
2035void ib_cancel_mad(struct ib_mad_agent *mad_agent,
2036 u64 wr_id)
2037{ 2100{
2038 struct ib_mad_agent_private *mad_agent_priv; 2101 struct ib_mad_agent_private *mad_agent_priv;
2039 struct ib_mad_send_wr_private *mad_send_wr; 2102 struct ib_mad_send_wr_private *mad_send_wr;
2040 unsigned long flags; 2103 unsigned long flags;
2104 int active;
2041 2105
2042 mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private, 2106 mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private,
2043 agent); 2107 agent);
2044 spin_lock_irqsave(&mad_agent_priv->lock, flags); 2108 spin_lock_irqsave(&mad_agent_priv->lock, flags);
2045 mad_send_wr = find_send_by_wr_id(mad_agent_priv, wr_id); 2109 mad_send_wr = find_send_by_wr_id(mad_agent_priv, wr_id);
2046 if (!mad_send_wr) { 2110 if (!mad_send_wr || mad_send_wr->status != IB_WC_SUCCESS) {
2047 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2111 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2048 goto out; 2112 return -EINVAL;
2049 } 2113 }
2050 2114
2051 if (mad_send_wr->status == IB_WC_SUCCESS) 2115 active = (!mad_send_wr->timeout || mad_send_wr->refcount > 1);
2052 mad_send_wr->refcount -= (mad_send_wr->timeout > 0); 2116 if (!timeout_ms) {
2053
2054 if (mad_send_wr->refcount != 0) {
2055 mad_send_wr->status = IB_WC_WR_FLUSH_ERR; 2117 mad_send_wr->status = IB_WC_WR_FLUSH_ERR;
2056 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2118 mad_send_wr->refcount -= (mad_send_wr->timeout > 0);
2057 goto out;
2058 } 2119 }
2059 2120
2060 list_del(&mad_send_wr->agent_list); 2121 mad_send_wr->send_wr.wr.ud.timeout_ms = timeout_ms;
2061 list_add_tail(&mad_send_wr->agent_list, &mad_agent_priv->canceled_list); 2122 if (active)
2062 adjust_timeout(mad_agent_priv); 2123 mad_send_wr->timeout = msecs_to_jiffies(timeout_ms);
2124 else
2125 ib_reset_mad_timeout(mad_send_wr, timeout_ms);
2126
2063 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2127 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2128 return 0;
2129}
2130EXPORT_SYMBOL(ib_modify_mad);
2064 2131
2065 queue_work(mad_agent_priv->qp_info->port_priv->wq, 2132void ib_cancel_mad(struct ib_mad_agent *mad_agent, u64 wr_id)
2066 &mad_agent_priv->canceled_work); 2133{
2067out: 2134 ib_modify_mad(mad_agent, wr_id, 0);
2068 return;
2069} 2135}
2070EXPORT_SYMBOL(ib_cancel_mad); 2136EXPORT_SYMBOL(ib_cancel_mad);
2071 2137
@@ -2075,6 +2141,7 @@ static void local_completions(void *data)
2075 struct ib_mad_local_private *local; 2141 struct ib_mad_local_private *local;
2076 struct ib_mad_agent_private *recv_mad_agent; 2142 struct ib_mad_agent_private *recv_mad_agent;
2077 unsigned long flags; 2143 unsigned long flags;
2144 int recv = 0;
2078 struct ib_wc wc; 2145 struct ib_wc wc;
2079 struct ib_mad_send_wc mad_send_wc; 2146 struct ib_mad_send_wc mad_send_wc;
2080 2147
@@ -2090,10 +2157,10 @@ static void local_completions(void *data)
2090 recv_mad_agent = local->recv_mad_agent; 2157 recv_mad_agent = local->recv_mad_agent;
2091 if (!recv_mad_agent) { 2158 if (!recv_mad_agent) {
2092 printk(KERN_ERR PFX "No receive MAD agent for local completion\n"); 2159 printk(KERN_ERR PFX "No receive MAD agent for local completion\n");
2093 kmem_cache_free(ib_mad_cache, local->mad_priv);
2094 goto local_send_completion; 2160 goto local_send_completion;
2095 } 2161 }
2096 2162
2163 recv = 1;
2097 /* 2164 /*
2098 * Defined behavior is to complete response 2165 * Defined behavior is to complete response
2099 * before request 2166 * before request
@@ -2105,7 +2172,9 @@ static void local_completions(void *data)
2105 local->mad_priv->header.recv_wc.wc = &wc; 2172 local->mad_priv->header.recv_wc.wc = &wc;
2106 local->mad_priv->header.recv_wc.mad_len = 2173 local->mad_priv->header.recv_wc.mad_len =
2107 sizeof(struct ib_mad); 2174 sizeof(struct ib_mad);
2108 INIT_LIST_HEAD(&local->mad_priv->header.recv_wc.recv_buf.list); 2175 INIT_LIST_HEAD(&local->mad_priv->header.recv_wc.rmpp_list);
2176 list_add(&local->mad_priv->header.recv_wc.recv_buf.list,
2177 &local->mad_priv->header.recv_wc.rmpp_list);
2109 local->mad_priv->header.recv_wc.recv_buf.grh = NULL; 2178 local->mad_priv->header.recv_wc.recv_buf.grh = NULL;
2110 local->mad_priv->header.recv_wc.recv_buf.mad = 2179 local->mad_priv->header.recv_wc.recv_buf.mad =
2111 &local->mad_priv->mad.mad; 2180 &local->mad_priv->mad.mad;
@@ -2136,11 +2205,47 @@ local_send_completion:
2136 spin_lock_irqsave(&mad_agent_priv->lock, flags); 2205 spin_lock_irqsave(&mad_agent_priv->lock, flags);
2137 list_del(&local->completion_list); 2206 list_del(&local->completion_list);
2138 atomic_dec(&mad_agent_priv->refcount); 2207 atomic_dec(&mad_agent_priv->refcount);
2208 if (!recv)
2209 kmem_cache_free(ib_mad_cache, local->mad_priv);
2139 kfree(local); 2210 kfree(local);
2140 } 2211 }
2141 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2212 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2142} 2213}
2143 2214
2215static int retry_send(struct ib_mad_send_wr_private *mad_send_wr)
2216{
2217 int ret;
2218
2219 if (!mad_send_wr->retries--)
2220 return -ETIMEDOUT;
2221
2222 mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_wr.
2223 wr.ud.timeout_ms);
2224
2225 if (mad_send_wr->mad_agent_priv->agent.rmpp_version) {
2226 ret = ib_retry_rmpp(mad_send_wr);
2227 switch (ret) {
2228 case IB_RMPP_RESULT_UNHANDLED:
2229 ret = ib_send_mad(mad_send_wr);
2230 break;
2231 case IB_RMPP_RESULT_CONSUMED:
2232 ret = 0;
2233 break;
2234 default:
2235 ret = -ECOMM;
2236 break;
2237 }
2238 } else
2239 ret = ib_send_mad(mad_send_wr);
2240
2241 if (!ret) {
2242 mad_send_wr->refcount++;
2243 list_add_tail(&mad_send_wr->agent_list,
2244 &mad_send_wr->mad_agent_priv->send_list);
2245 }
2246 return ret;
2247}
2248
2144static void timeout_sends(void *data) 2249static void timeout_sends(void *data)
2145{ 2250{
2146 struct ib_mad_agent_private *mad_agent_priv; 2251 struct ib_mad_agent_private *mad_agent_priv;
@@ -2149,8 +2254,6 @@ static void timeout_sends(void *data)
2149 unsigned long flags, delay; 2254 unsigned long flags, delay;
2150 2255
2151 mad_agent_priv = (struct ib_mad_agent_private *)data; 2256 mad_agent_priv = (struct ib_mad_agent_private *)data;
2152
2153 mad_send_wc.status = IB_WC_RESP_TIMEOUT_ERR;
2154 mad_send_wc.vendor_err = 0; 2257 mad_send_wc.vendor_err = 0;
2155 2258
2156 spin_lock_irqsave(&mad_agent_priv->lock, flags); 2259 spin_lock_irqsave(&mad_agent_priv->lock, flags);
@@ -2170,8 +2273,16 @@ static void timeout_sends(void *data)
2170 } 2273 }
2171 2274
2172 list_del(&mad_send_wr->agent_list); 2275 list_del(&mad_send_wr->agent_list);
2276 if (mad_send_wr->status == IB_WC_SUCCESS &&
2277 !retry_send(mad_send_wr))
2278 continue;
2279
2173 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2280 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2174 2281
2282 if (mad_send_wr->status == IB_WC_SUCCESS)
2283 mad_send_wc.status = IB_WC_RESP_TIMEOUT_ERR;
2284 else
2285 mad_send_wc.status = mad_send_wr->status;
2175 mad_send_wc.wr_id = mad_send_wr->wr_id; 2286 mad_send_wc.wr_id = mad_send_wr->wr_id;
2176 mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, 2287 mad_agent_priv->agent.send_handler(&mad_agent_priv->agent,
2177 &mad_send_wc); 2288 &mad_send_wc);
@@ -2447,14 +2558,6 @@ static int ib_mad_port_open(struct ib_device *device,
2447 unsigned long flags; 2558 unsigned long flags;
2448 char name[sizeof "ib_mad123"]; 2559 char name[sizeof "ib_mad123"];
2449 2560
2450 /* First, check if port already open at MAD layer */
2451 port_priv = ib_get_mad_port(device, port_num);
2452 if (port_priv) {
2453 printk(KERN_DEBUG PFX "%s port %d already open\n",
2454 device->name, port_num);
2455 return 0;
2456 }
2457
2458 /* Create new device info */ 2561 /* Create new device info */
2459 port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); 2562 port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL);
2460 if (!port_priv) { 2563 if (!port_priv) {
@@ -2579,7 +2682,7 @@ static int ib_mad_port_close(struct ib_device *device, int port_num)
2579 2682
2580static void ib_mad_init_device(struct ib_device *device) 2683static void ib_mad_init_device(struct ib_device *device)
2581{ 2684{
2582 int ret, num_ports, cur_port, i, ret2; 2685 int num_ports, cur_port, i;
2583 2686
2584 if (device->node_type == IB_NODE_SWITCH) { 2687 if (device->node_type == IB_NODE_SWITCH) {
2585 num_ports = 1; 2688 num_ports = 1;
@@ -2589,47 +2692,37 @@ static void ib_mad_init_device(struct ib_device *device)
2589 cur_port = 1; 2692 cur_port = 1;
2590 } 2693 }
2591 for (i = 0; i < num_ports; i++, cur_port++) { 2694 for (i = 0; i < num_ports; i++, cur_port++) {
2592 ret = ib_mad_port_open(device, cur_port); 2695 if (ib_mad_port_open(device, cur_port)) {
2593 if (ret) {
2594 printk(KERN_ERR PFX "Couldn't open %s port %d\n", 2696 printk(KERN_ERR PFX "Couldn't open %s port %d\n",
2595 device->name, cur_port); 2697 device->name, cur_port);
2596 goto error_device_open; 2698 goto error_device_open;
2597 } 2699 }
2598 ret = ib_agent_port_open(device, cur_port); 2700 if (ib_agent_port_open(device, cur_port)) {
2599 if (ret) {
2600 printk(KERN_ERR PFX "Couldn't open %s port %d " 2701 printk(KERN_ERR PFX "Couldn't open %s port %d "
2601 "for agents\n", 2702 "for agents\n",
2602 device->name, cur_port); 2703 device->name, cur_port);
2603 goto error_device_open; 2704 goto error_device_open;
2604 } 2705 }
2605 } 2706 }
2606 2707 return;
2607 goto error_device_query;
2608 2708
2609error_device_open: 2709error_device_open:
2610 while (i > 0) { 2710 while (i > 0) {
2611 cur_port--; 2711 cur_port--;
2612 ret2 = ib_agent_port_close(device, cur_port); 2712 if (ib_agent_port_close(device, cur_port))
2613 if (ret2) {
2614 printk(KERN_ERR PFX "Couldn't close %s port %d " 2713 printk(KERN_ERR PFX "Couldn't close %s port %d "
2615 "for agents\n", 2714 "for agents\n",
2616 device->name, cur_port); 2715 device->name, cur_port);
2617 } 2716 if (ib_mad_port_close(device, cur_port))
2618 ret2 = ib_mad_port_close(device, cur_port);
2619 if (ret2) {
2620 printk(KERN_ERR PFX "Couldn't close %s port %d\n", 2717 printk(KERN_ERR PFX "Couldn't close %s port %d\n",
2621 device->name, cur_port); 2718 device->name, cur_port);
2622 }
2623 i--; 2719 i--;
2624 } 2720 }
2625
2626error_device_query:
2627 return;
2628} 2721}
2629 2722
2630static void ib_mad_remove_device(struct ib_device *device) 2723static void ib_mad_remove_device(struct ib_device *device)
2631{ 2724{
2632 int ret = 0, i, num_ports, cur_port, ret2; 2725 int i, num_ports, cur_port;
2633 2726
2634 if (device->node_type == IB_NODE_SWITCH) { 2727 if (device->node_type == IB_NODE_SWITCH) {
2635 num_ports = 1; 2728 num_ports = 1;
@@ -2639,21 +2732,13 @@ static void ib_mad_remove_device(struct ib_device *device)
2639 cur_port = 1; 2732 cur_port = 1;
2640 } 2733 }
2641 for (i = 0; i < num_ports; i++, cur_port++) { 2734 for (i = 0; i < num_ports; i++, cur_port++) {
2642 ret2 = ib_agent_port_close(device, cur_port); 2735 if (ib_agent_port_close(device, cur_port))
2643 if (ret2) {
2644 printk(KERN_ERR PFX "Couldn't close %s port %d " 2736 printk(KERN_ERR PFX "Couldn't close %s port %d "
2645 "for agents\n", 2737 "for agents\n",
2646 device->name, cur_port); 2738 device->name, cur_port);
2647 if (!ret) 2739 if (ib_mad_port_close(device, cur_port))
2648 ret = ret2;
2649 }
2650 ret2 = ib_mad_port_close(device, cur_port);
2651 if (ret2) {
2652 printk(KERN_ERR PFX "Couldn't close %s port %d\n", 2740 printk(KERN_ERR PFX "Couldn't close %s port %d\n",
2653 device->name, cur_port); 2741 device->name, cur_port);
2654 if (!ret)
2655 ret = ret2;
2656 }
2657 } 2742 }
2658} 2743}
2659 2744
@@ -2709,3 +2794,4 @@ static void __exit ib_mad_cleanup_module(void)
2709 2794
2710module_init(ib_mad_init_module); 2795module_init(ib_mad_init_module);
2711module_exit(ib_mad_cleanup_module); 2796module_exit(ib_mad_cleanup_module);
2797
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
index 008cbcb94b15..568da10b05ab 100644
--- a/drivers/infiniband/core/mad_priv.h
+++ b/drivers/infiniband/core/mad_priv.h
@@ -1,5 +1,7 @@
1/* 1/*
2 * Copyright (c) 2004, 2005, Voltaire, Inc. All rights reserved. 2 * Copyright (c) 2004, 2005, Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
3 * 5 *
4 * This software is available to you under a choice of one of two 6 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +31,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 32 * SOFTWARE.
31 * 33 *
32 * $Id: mad_priv.h 1389 2004-12-27 22:56:47Z roland $ 34 * $Id: mad_priv.h 2730 2005-06-28 16:43:03Z sean.hefty $
33 */ 35 */
34 36
35#ifndef __IB_MAD_PRIV_H__ 37#ifndef __IB_MAD_PRIV_H__
@@ -92,16 +94,15 @@ struct ib_mad_agent_private {
92 spinlock_t lock; 94 spinlock_t lock;
93 struct list_head send_list; 95 struct list_head send_list;
94 struct list_head wait_list; 96 struct list_head wait_list;
97 struct list_head done_list;
95 struct work_struct timed_work; 98 struct work_struct timed_work;
96 unsigned long timeout; 99 unsigned long timeout;
97 struct list_head local_list; 100 struct list_head local_list;
98 struct work_struct local_work; 101 struct work_struct local_work;
99 struct list_head canceled_list; 102 struct list_head rmpp_list;
100 struct work_struct canceled_work;
101 103
102 atomic_t refcount; 104 atomic_t refcount;
103 wait_queue_head_t wait; 105 wait_queue_head_t wait;
104 u8 rmpp_version;
105}; 106};
106 107
107struct ib_mad_snoop_private { 108struct ib_mad_snoop_private {
@@ -116,15 +117,24 @@ struct ib_mad_snoop_private {
116struct ib_mad_send_wr_private { 117struct ib_mad_send_wr_private {
117 struct ib_mad_list_head mad_list; 118 struct ib_mad_list_head mad_list;
118 struct list_head agent_list; 119 struct list_head agent_list;
119 struct ib_mad_agent *agent; 120 struct ib_mad_agent_private *mad_agent_priv;
120 struct ib_send_wr send_wr; 121 struct ib_send_wr send_wr;
121 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; 122 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
122 u64 wr_id; /* client WR ID */ 123 u64 wr_id; /* client WR ID */
123 u64 tid; 124 u64 tid;
124 unsigned long timeout; 125 unsigned long timeout;
126 int retries;
125 int retry; 127 int retry;
126 int refcount; 128 int refcount;
127 enum ib_wc_status status; 129 enum ib_wc_status status;
130
131 /* RMPP control */
132 int last_ack;
133 int seg_num;
134 int newwin;
135 int total_seg;
136 int data_offset;
137 int pad;
128}; 138};
129 139
130struct ib_mad_local_private { 140struct ib_mad_local_private {
@@ -197,4 +207,17 @@ struct ib_mad_port_private {
197 207
198extern kmem_cache_t *ib_mad_cache; 208extern kmem_cache_t *ib_mad_cache;
199 209
210int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr);
211
212struct ib_mad_send_wr_private *
213ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid);
214
215void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
216 struct ib_mad_send_wc *mad_send_wc);
217
218void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr);
219
220void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr,
221 int timeout_ms);
222
200#endif /* __IB_MAD_PRIV_H__ */ 223#endif /* __IB_MAD_PRIV_H__ */
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
new file mode 100644
index 000000000000..8f1eb80e421f
--- /dev/null
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -0,0 +1,765 @@
1/*
2 * Copyright (c) 2005 Intel Inc. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 * $Id: mad_rmpp.c 1921 2005-03-02 22:58:44Z sean.hefty $
34 */
35
36#include <linux/dma-mapping.h>
37
38#include "mad_priv.h"
39#include "mad_rmpp.h"
40
41enum rmpp_state {
42 RMPP_STATE_ACTIVE,
43 RMPP_STATE_TIMEOUT,
44 RMPP_STATE_COMPLETE
45};
46
47struct mad_rmpp_recv {
48 struct ib_mad_agent_private *agent;
49 struct list_head list;
50 struct work_struct timeout_work;
51 struct work_struct cleanup_work;
52 wait_queue_head_t wait;
53 enum rmpp_state state;
54 spinlock_t lock;
55 atomic_t refcount;
56
57 struct ib_ah *ah;
58 struct ib_mad_recv_wc *rmpp_wc;
59 struct ib_mad_recv_buf *cur_seg_buf;
60 int last_ack;
61 int seg_num;
62 int newwin;
63
64 u64 tid;
65 u32 src_qp;
66 u16 slid;
67 u8 mgmt_class;
68 u8 class_version;
69 u8 method;
70};
71
72static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
73{
74 atomic_dec(&rmpp_recv->refcount);
75 wait_event(rmpp_recv->wait, !atomic_read(&rmpp_recv->refcount));
76 ib_destroy_ah(rmpp_recv->ah);
77 kfree(rmpp_recv);
78}
79
80void ib_cancel_rmpp_recvs(struct ib_mad_agent_private *agent)
81{
82 struct mad_rmpp_recv *rmpp_recv, *temp_rmpp_recv;
83 unsigned long flags;
84
85 spin_lock_irqsave(&agent->lock, flags);
86 list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) {
87 cancel_delayed_work(&rmpp_recv->timeout_work);
88 cancel_delayed_work(&rmpp_recv->cleanup_work);
89 }
90 spin_unlock_irqrestore(&agent->lock, flags);
91
92 flush_workqueue(agent->qp_info->port_priv->wq);
93
94 list_for_each_entry_safe(rmpp_recv, temp_rmpp_recv,
95 &agent->rmpp_list, list) {
96 list_del(&rmpp_recv->list);
97 if (rmpp_recv->state != RMPP_STATE_COMPLETE)
98 ib_free_recv_mad(rmpp_recv->rmpp_wc);
99 destroy_rmpp_recv(rmpp_recv);
100 }
101}
102
103static void recv_timeout_handler(void *data)
104{
105 struct mad_rmpp_recv *rmpp_recv = data;
106 struct ib_mad_recv_wc *rmpp_wc;
107 unsigned long flags;
108
109 spin_lock_irqsave(&rmpp_recv->agent->lock, flags);
110 if (rmpp_recv->state != RMPP_STATE_ACTIVE) {
111 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags);
112 return;
113 }
114 rmpp_recv->state = RMPP_STATE_TIMEOUT;
115 list_del(&rmpp_recv->list);
116 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags);
117
118 /* TODO: send abort. */
119 rmpp_wc = rmpp_recv->rmpp_wc;
120 destroy_rmpp_recv(rmpp_recv);
121 ib_free_recv_mad(rmpp_wc);
122}
123
124static void recv_cleanup_handler(void *data)
125{
126 struct mad_rmpp_recv *rmpp_recv = data;
127 unsigned long flags;
128
129 spin_lock_irqsave(&rmpp_recv->agent->lock, flags);
130 list_del(&rmpp_recv->list);
131 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags);
132 destroy_rmpp_recv(rmpp_recv);
133}
134
135static struct mad_rmpp_recv *
136create_rmpp_recv(struct ib_mad_agent_private *agent,
137 struct ib_mad_recv_wc *mad_recv_wc)
138{
139 struct mad_rmpp_recv *rmpp_recv;
140 struct ib_mad_hdr *mad_hdr;
141
142 rmpp_recv = kmalloc(sizeof *rmpp_recv, GFP_KERNEL);
143 if (!rmpp_recv)
144 return NULL;
145
146 rmpp_recv->ah = ib_create_ah_from_wc(agent->agent.qp->pd,
147 mad_recv_wc->wc,
148 mad_recv_wc->recv_buf.grh,
149 agent->agent.port_num);
150 if (IS_ERR(rmpp_recv->ah))
151 goto error;
152
153 rmpp_recv->agent = agent;
154 init_waitqueue_head(&rmpp_recv->wait);
155 INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv);
156 INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv);
157 spin_lock_init(&rmpp_recv->lock);
158 rmpp_recv->state = RMPP_STATE_ACTIVE;
159 atomic_set(&rmpp_recv->refcount, 1);
160
161 rmpp_recv->rmpp_wc = mad_recv_wc;
162 rmpp_recv->cur_seg_buf = &mad_recv_wc->recv_buf;
163 rmpp_recv->newwin = 1;
164 rmpp_recv->seg_num = 1;
165 rmpp_recv->last_ack = 0;
166
167 mad_hdr = &mad_recv_wc->recv_buf.mad->mad_hdr;
168 rmpp_recv->tid = mad_hdr->tid;
169 rmpp_recv->src_qp = mad_recv_wc->wc->src_qp;
170 rmpp_recv->slid = mad_recv_wc->wc->slid;
171 rmpp_recv->mgmt_class = mad_hdr->mgmt_class;
172 rmpp_recv->class_version = mad_hdr->class_version;
173 rmpp_recv->method = mad_hdr->method;
174 return rmpp_recv;
175
176error: kfree(rmpp_recv);
177 return NULL;
178}
179
180static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
181{
182 if (atomic_dec_and_test(&rmpp_recv->refcount))
183 wake_up(&rmpp_recv->wait);
184}
185
186static struct mad_rmpp_recv *
187find_rmpp_recv(struct ib_mad_agent_private *agent,
188 struct ib_mad_recv_wc *mad_recv_wc)
189{
190 struct mad_rmpp_recv *rmpp_recv;
191 struct ib_mad_hdr *mad_hdr = &mad_recv_wc->recv_buf.mad->mad_hdr;
192
193 list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) {
194 if (rmpp_recv->tid == mad_hdr->tid &&
195 rmpp_recv->src_qp == mad_recv_wc->wc->src_qp &&
196 rmpp_recv->slid == mad_recv_wc->wc->slid &&
197 rmpp_recv->mgmt_class == mad_hdr->mgmt_class &&
198 rmpp_recv->class_version == mad_hdr->class_version &&
199 rmpp_recv->method == mad_hdr->method)
200 return rmpp_recv;
201 }
202 return NULL;
203}
204
205static struct mad_rmpp_recv *
206acquire_rmpp_recv(struct ib_mad_agent_private *agent,
207 struct ib_mad_recv_wc *mad_recv_wc)
208{
209 struct mad_rmpp_recv *rmpp_recv;
210 unsigned long flags;
211
212 spin_lock_irqsave(&agent->lock, flags);
213 rmpp_recv = find_rmpp_recv(agent, mad_recv_wc);
214 if (rmpp_recv)
215 atomic_inc(&rmpp_recv->refcount);
216 spin_unlock_irqrestore(&agent->lock, flags);
217 return rmpp_recv;
218}
219
220static struct mad_rmpp_recv *
221insert_rmpp_recv(struct ib_mad_agent_private *agent,
222 struct mad_rmpp_recv *rmpp_recv)
223{
224 struct mad_rmpp_recv *cur_rmpp_recv;
225
226 cur_rmpp_recv = find_rmpp_recv(agent, rmpp_recv->rmpp_wc);
227 if (!cur_rmpp_recv)
228 list_add_tail(&rmpp_recv->list, &agent->rmpp_list);
229
230 return cur_rmpp_recv;
231}
232
233static int data_offset(u8 mgmt_class)
234{
235 if (mgmt_class == IB_MGMT_CLASS_SUBN_ADM)
236 return offsetof(struct ib_sa_mad, data);
237 else if ((mgmt_class >= IB_MGMT_CLASS_VENDOR_RANGE2_START) &&
238 (mgmt_class <= IB_MGMT_CLASS_VENDOR_RANGE2_END))
239 return offsetof(struct ib_vendor_mad, data);
240 else
241 return offsetof(struct ib_rmpp_mad, data);
242}
243
244static void format_ack(struct ib_rmpp_mad *ack,
245 struct ib_rmpp_mad *data,
246 struct mad_rmpp_recv *rmpp_recv)
247{
248 unsigned long flags;
249
250 memcpy(&ack->mad_hdr, &data->mad_hdr,
251 data_offset(data->mad_hdr.mgmt_class));
252
253 ack->mad_hdr.method ^= IB_MGMT_METHOD_RESP;
254 ack->rmpp_hdr.rmpp_type = IB_MGMT_RMPP_TYPE_ACK;
255 ib_set_rmpp_flags(&ack->rmpp_hdr, IB_MGMT_RMPP_FLAG_ACTIVE);
256
257 spin_lock_irqsave(&rmpp_recv->lock, flags);
258 rmpp_recv->last_ack = rmpp_recv->seg_num;
259 ack->rmpp_hdr.seg_num = cpu_to_be32(rmpp_recv->seg_num);
260 ack->rmpp_hdr.paylen_newwin = cpu_to_be32(rmpp_recv->newwin);
261 spin_unlock_irqrestore(&rmpp_recv->lock, flags);
262}
263
264static void ack_recv(struct mad_rmpp_recv *rmpp_recv,
265 struct ib_mad_recv_wc *recv_wc)
266{
267 struct ib_mad_send_buf *msg;
268 struct ib_send_wr *bad_send_wr;
269 int hdr_len, ret;
270
271 hdr_len = sizeof(struct ib_mad_hdr) + sizeof(struct ib_rmpp_hdr);
272 msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp,
273 recv_wc->wc->pkey_index, rmpp_recv->ah, 1,
274 hdr_len, sizeof(struct ib_rmpp_mad) - hdr_len,
275 GFP_KERNEL);
276 if (!msg)
277 return;
278
279 format_ack((struct ib_rmpp_mad *) msg->mad,
280 (struct ib_rmpp_mad *) recv_wc->recv_buf.mad, rmpp_recv);
281 ret = ib_post_send_mad(&rmpp_recv->agent->agent, &msg->send_wr,
282 &bad_send_wr);
283 if (ret)
284 ib_free_send_mad(msg);
285}
286
287static inline int get_last_flag(struct ib_mad_recv_buf *seg)
288{
289 struct ib_rmpp_mad *rmpp_mad;
290
291 rmpp_mad = (struct ib_rmpp_mad *) seg->mad;
292 return ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_LAST;
293}
294
295static inline int get_seg_num(struct ib_mad_recv_buf *seg)
296{
297 struct ib_rmpp_mad *rmpp_mad;
298
299 rmpp_mad = (struct ib_rmpp_mad *) seg->mad;
300 return be32_to_cpu(rmpp_mad->rmpp_hdr.seg_num);
301}
302
303static inline struct ib_mad_recv_buf * get_next_seg(struct list_head *rmpp_list,
304 struct ib_mad_recv_buf *seg)
305{
306 if (seg->list.next == rmpp_list)
307 return NULL;
308
309 return container_of(seg->list.next, struct ib_mad_recv_buf, list);
310}
311
312static inline int window_size(struct ib_mad_agent_private *agent)
313{
314 return max(agent->qp_info->recv_queue.max_active >> 3, 1);
315}
316
317static struct ib_mad_recv_buf * find_seg_location(struct list_head *rmpp_list,
318 int seg_num)
319{
320 struct ib_mad_recv_buf *seg_buf;
321 int cur_seg_num;
322
323 list_for_each_entry_reverse(seg_buf, rmpp_list, list) {
324 cur_seg_num = get_seg_num(seg_buf);
325 if (seg_num > cur_seg_num)
326 return seg_buf;
327 if (seg_num == cur_seg_num)
328 break;
329 }
330 return NULL;
331}
332
333static void update_seg_num(struct mad_rmpp_recv *rmpp_recv,
334 struct ib_mad_recv_buf *new_buf)
335{
336 struct list_head *rmpp_list = &rmpp_recv->rmpp_wc->rmpp_list;
337
338 while (new_buf && (get_seg_num(new_buf) == rmpp_recv->seg_num + 1)) {
339 rmpp_recv->cur_seg_buf = new_buf;
340 rmpp_recv->seg_num++;
341 new_buf = get_next_seg(rmpp_list, new_buf);
342 }
343}
344
345static inline int get_mad_len(struct mad_rmpp_recv *rmpp_recv)
346{
347 struct ib_rmpp_mad *rmpp_mad;
348 int hdr_size, data_size, pad;
349
350 rmpp_mad = (struct ib_rmpp_mad *)rmpp_recv->cur_seg_buf->mad;
351
352 hdr_size = data_offset(rmpp_mad->mad_hdr.mgmt_class);
353 data_size = sizeof(struct ib_rmpp_mad) - hdr_size;
354 pad = data_size - be32_to_cpu(rmpp_mad->rmpp_hdr.paylen_newwin);
355 if (pad > data_size || pad < 0)
356 pad = 0;
357
358 return hdr_size + rmpp_recv->seg_num * data_size - pad;
359}
360
361static struct ib_mad_recv_wc * complete_rmpp(struct mad_rmpp_recv *rmpp_recv)
362{
363 struct ib_mad_recv_wc *rmpp_wc;
364
365 ack_recv(rmpp_recv, rmpp_recv->rmpp_wc);
366 if (rmpp_recv->seg_num > 1)
367 cancel_delayed_work(&rmpp_recv->timeout_work);
368
369 rmpp_wc = rmpp_recv->rmpp_wc;
370 rmpp_wc->mad_len = get_mad_len(rmpp_recv);
371 /* 10 seconds until we can find the packet lifetime */
372 queue_delayed_work(rmpp_recv->agent->qp_info->port_priv->wq,
373 &rmpp_recv->cleanup_work, msecs_to_jiffies(10000));
374 return rmpp_wc;
375}
376
377void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf)
378{
379 struct ib_mad_recv_buf *seg_buf;
380 struct ib_rmpp_mad *rmpp_mad;
381 void *data;
382 int size, len, offset;
383 u8 flags;
384
385 len = mad_recv_wc->mad_len;
386 if (len <= sizeof(struct ib_mad)) {
387 memcpy(buf, mad_recv_wc->recv_buf.mad, len);
388 return;
389 }
390
391 offset = data_offset(mad_recv_wc->recv_buf.mad->mad_hdr.mgmt_class);
392
393 list_for_each_entry(seg_buf, &mad_recv_wc->rmpp_list, list) {
394 rmpp_mad = (struct ib_rmpp_mad *)seg_buf->mad;
395 flags = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr);
396
397 if (flags & IB_MGMT_RMPP_FLAG_FIRST) {
398 data = rmpp_mad;
399 size = sizeof(*rmpp_mad);
400 } else {
401 data = (void *) rmpp_mad + offset;
402 if (flags & IB_MGMT_RMPP_FLAG_LAST)
403 size = len;
404 else
405 size = sizeof(*rmpp_mad) - offset;
406 }
407
408 memcpy(buf, data, size);
409 len -= size;
410 buf += size;
411 }
412}
413EXPORT_SYMBOL(ib_coalesce_recv_mad);
414
415static struct ib_mad_recv_wc *
416continue_rmpp(struct ib_mad_agent_private *agent,
417 struct ib_mad_recv_wc *mad_recv_wc)
418{
419 struct mad_rmpp_recv *rmpp_recv;
420 struct ib_mad_recv_buf *prev_buf;
421 struct ib_mad_recv_wc *done_wc;
422 int seg_num;
423 unsigned long flags;
424
425 rmpp_recv = acquire_rmpp_recv(agent, mad_recv_wc);
426 if (!rmpp_recv)
427 goto drop1;
428
429 seg_num = get_seg_num(&mad_recv_wc->recv_buf);
430
431 spin_lock_irqsave(&rmpp_recv->lock, flags);
432 if ((rmpp_recv->state == RMPP_STATE_TIMEOUT) ||
433 (seg_num > rmpp_recv->newwin))
434 goto drop3;
435
436 if ((seg_num <= rmpp_recv->last_ack) ||
437 (rmpp_recv->state == RMPP_STATE_COMPLETE)) {
438 spin_unlock_irqrestore(&rmpp_recv->lock, flags);
439 ack_recv(rmpp_recv, mad_recv_wc);
440 goto drop2;
441 }
442
443 prev_buf = find_seg_location(&rmpp_recv->rmpp_wc->rmpp_list, seg_num);
444 if (!prev_buf)
445 goto drop3;
446
447 done_wc = NULL;
448 list_add(&mad_recv_wc->recv_buf.list, &prev_buf->list);
449 if (rmpp_recv->cur_seg_buf == prev_buf) {
450 update_seg_num(rmpp_recv, &mad_recv_wc->recv_buf);
451 if (get_last_flag(rmpp_recv->cur_seg_buf)) {
452 rmpp_recv->state = RMPP_STATE_COMPLETE;
453 spin_unlock_irqrestore(&rmpp_recv->lock, flags);
454 done_wc = complete_rmpp(rmpp_recv);
455 goto out;
456 } else if (rmpp_recv->seg_num == rmpp_recv->newwin) {
457 rmpp_recv->newwin += window_size(agent);
458 spin_unlock_irqrestore(&rmpp_recv->lock, flags);
459 ack_recv(rmpp_recv, mad_recv_wc);
460 goto out;
461 }
462 }
463 spin_unlock_irqrestore(&rmpp_recv->lock, flags);
464out:
465 deref_rmpp_recv(rmpp_recv);
466 return done_wc;
467
468drop3: spin_unlock_irqrestore(&rmpp_recv->lock, flags);
469drop2: deref_rmpp_recv(rmpp_recv);
470drop1: ib_free_recv_mad(mad_recv_wc);
471 return NULL;
472}
473
474static struct ib_mad_recv_wc *
475start_rmpp(struct ib_mad_agent_private *agent,
476 struct ib_mad_recv_wc *mad_recv_wc)
477{
478 struct mad_rmpp_recv *rmpp_recv;
479 unsigned long flags;
480
481 rmpp_recv = create_rmpp_recv(agent, mad_recv_wc);
482 if (!rmpp_recv) {
483 ib_free_recv_mad(mad_recv_wc);
484 return NULL;
485 }
486
487 spin_lock_irqsave(&agent->lock, flags);
488 if (insert_rmpp_recv(agent, rmpp_recv)) {
489 spin_unlock_irqrestore(&agent->lock, flags);
490 /* duplicate first MAD */
491 destroy_rmpp_recv(rmpp_recv);
492 return continue_rmpp(agent, mad_recv_wc);
493 }
494 atomic_inc(&rmpp_recv->refcount);
495
496 if (get_last_flag(&mad_recv_wc->recv_buf)) {
497 rmpp_recv->state = RMPP_STATE_COMPLETE;
498 spin_unlock_irqrestore(&agent->lock, flags);
499 complete_rmpp(rmpp_recv);
500 } else {
501 spin_unlock_irqrestore(&agent->lock, flags);
502 /* 40 seconds until we can find the packet lifetimes */
503 queue_delayed_work(agent->qp_info->port_priv->wq,
504 &rmpp_recv->timeout_work,
505 msecs_to_jiffies(40000));
506 rmpp_recv->newwin += window_size(agent);
507 ack_recv(rmpp_recv, mad_recv_wc);
508 mad_recv_wc = NULL;
509 }
510 deref_rmpp_recv(rmpp_recv);
511 return mad_recv_wc;
512}
513
514static inline u64 get_seg_addr(struct ib_mad_send_wr_private *mad_send_wr)
515{
516 return mad_send_wr->sg_list[0].addr + mad_send_wr->data_offset +
517 (sizeof(struct ib_rmpp_mad) - mad_send_wr->data_offset) *
518 (mad_send_wr->seg_num - 1);
519}
520
521static int send_next_seg(struct ib_mad_send_wr_private *mad_send_wr)
522{
523 struct ib_rmpp_mad *rmpp_mad;
524 int timeout;
525
526 rmpp_mad = (struct ib_rmpp_mad *)mad_send_wr->send_wr.wr.ud.mad_hdr;
527 ib_set_rmpp_flags(&rmpp_mad->rmpp_hdr, IB_MGMT_RMPP_FLAG_ACTIVE);
528 rmpp_mad->rmpp_hdr.seg_num = cpu_to_be32(mad_send_wr->seg_num);
529
530 if (mad_send_wr->seg_num == 1) {
531 rmpp_mad->rmpp_hdr.rmpp_rtime_flags |= IB_MGMT_RMPP_FLAG_FIRST;
532 rmpp_mad->rmpp_hdr.paylen_newwin =
533 cpu_to_be32(mad_send_wr->total_seg *
534 (sizeof(struct ib_rmpp_mad) -
535 offsetof(struct ib_rmpp_mad, data)));
536 mad_send_wr->sg_list[0].length = sizeof(struct ib_rmpp_mad);
537 } else {
538 mad_send_wr->send_wr.num_sge = 2;
539 mad_send_wr->sg_list[0].length = mad_send_wr->data_offset;
540 mad_send_wr->sg_list[1].addr = get_seg_addr(mad_send_wr);
541 mad_send_wr->sg_list[1].length = sizeof(struct ib_rmpp_mad) -
542 mad_send_wr->data_offset;
543 mad_send_wr->sg_list[1].lkey = mad_send_wr->sg_list[0].lkey;
544 }
545
546 if (mad_send_wr->seg_num == mad_send_wr->total_seg) {
547 rmpp_mad->rmpp_hdr.rmpp_rtime_flags |= IB_MGMT_RMPP_FLAG_LAST;
548 rmpp_mad->rmpp_hdr.paylen_newwin =
549 cpu_to_be32(sizeof(struct ib_rmpp_mad) -
550 offsetof(struct ib_rmpp_mad, data) -
551 mad_send_wr->pad);
552 }
553
554 /* 2 seconds for an ACK until we can find the packet lifetime */
555 timeout = mad_send_wr->send_wr.wr.ud.timeout_ms;
556 if (!timeout || timeout > 2000)
557 mad_send_wr->timeout = msecs_to_jiffies(2000);
558 mad_send_wr->seg_num++;
559 return ib_send_mad(mad_send_wr);
560}
561
562static void process_rmpp_ack(struct ib_mad_agent_private *agent,
563 struct ib_mad_recv_wc *mad_recv_wc)
564{
565 struct ib_mad_send_wr_private *mad_send_wr;
566 struct ib_rmpp_mad *rmpp_mad;
567 unsigned long flags;
568 int seg_num, newwin, ret;
569
570 rmpp_mad = (struct ib_rmpp_mad *)mad_recv_wc->recv_buf.mad;
571 if (rmpp_mad->rmpp_hdr.rmpp_status)
572 return;
573
574 seg_num = be32_to_cpu(rmpp_mad->rmpp_hdr.seg_num);
575 newwin = be32_to_cpu(rmpp_mad->rmpp_hdr.paylen_newwin);
576
577 spin_lock_irqsave(&agent->lock, flags);
578 mad_send_wr = ib_find_send_mad(agent, rmpp_mad->mad_hdr.tid);
579 if (!mad_send_wr)
580 goto out; /* Unmatched ACK */
581
582 if ((mad_send_wr->last_ack == mad_send_wr->total_seg) ||
583 (!mad_send_wr->timeout) || (mad_send_wr->status != IB_WC_SUCCESS))
584 goto out; /* Send is already done */
585
586 if (seg_num > mad_send_wr->total_seg)
587 goto out; /* Bad ACK */
588
589 if (newwin < mad_send_wr->newwin || seg_num < mad_send_wr->last_ack)
590 goto out; /* Old ACK */
591
592 if (seg_num > mad_send_wr->last_ack) {
593 mad_send_wr->last_ack = seg_num;
594 mad_send_wr->retries = mad_send_wr->send_wr.wr.ud.retries;
595 }
596 mad_send_wr->newwin = newwin;
597 if (mad_send_wr->last_ack == mad_send_wr->total_seg) {
598 /* If no response is expected, the ACK completes the send */
599 if (!mad_send_wr->send_wr.wr.ud.timeout_ms) {
600 struct ib_mad_send_wc wc;
601
602 ib_mark_mad_done(mad_send_wr);
603 spin_unlock_irqrestore(&agent->lock, flags);
604
605 wc.status = IB_WC_SUCCESS;
606 wc.vendor_err = 0;
607 wc.wr_id = mad_send_wr->wr_id;
608 ib_mad_complete_send_wr(mad_send_wr, &wc);
609 return;
610 }
611 if (mad_send_wr->refcount == 1)
612 ib_reset_mad_timeout(mad_send_wr, mad_send_wr->
613 send_wr.wr.ud.timeout_ms);
614 } else if (mad_send_wr->refcount == 1 &&
615 mad_send_wr->seg_num < mad_send_wr->newwin &&
616 mad_send_wr->seg_num <= mad_send_wr->total_seg) {
617 /* Send failure will just result in a timeout/retry */
618 ret = send_next_seg(mad_send_wr);
619 if (ret)
620 goto out;
621
622 mad_send_wr->refcount++;
623 list_del(&mad_send_wr->agent_list);
624 list_add_tail(&mad_send_wr->agent_list,
625 &mad_send_wr->mad_agent_priv->send_list);
626 }
627out:
628 spin_unlock_irqrestore(&agent->lock, flags);
629}
630
631struct ib_mad_recv_wc *
632ib_process_rmpp_recv_wc(struct ib_mad_agent_private *agent,
633 struct ib_mad_recv_wc *mad_recv_wc)
634{
635 struct ib_rmpp_mad *rmpp_mad;
636
637 rmpp_mad = (struct ib_rmpp_mad *)mad_recv_wc->recv_buf.mad;
638 if (!(rmpp_mad->rmpp_hdr.rmpp_rtime_flags & IB_MGMT_RMPP_FLAG_ACTIVE))
639 return mad_recv_wc;
640
641 if (rmpp_mad->rmpp_hdr.rmpp_version != IB_MGMT_RMPP_VERSION)
642 goto out;
643
644 switch (rmpp_mad->rmpp_hdr.rmpp_type) {
645 case IB_MGMT_RMPP_TYPE_DATA:
646 if (rmpp_mad->rmpp_hdr.seg_num == __constant_htonl(1))
647 return start_rmpp(agent, mad_recv_wc);
648 else
649 return continue_rmpp(agent, mad_recv_wc);
650 case IB_MGMT_RMPP_TYPE_ACK:
651 process_rmpp_ack(agent, mad_recv_wc);
652 break;
653 case IB_MGMT_RMPP_TYPE_STOP:
654 case IB_MGMT_RMPP_TYPE_ABORT:
655 /* TODO: process_rmpp_nack(agent, mad_recv_wc); */
656 break;
657 default:
658 break;
659 }
660out:
661 ib_free_recv_mad(mad_recv_wc);
662 return NULL;
663}
664
665int ib_send_rmpp_mad(struct ib_mad_send_wr_private *mad_send_wr)
666{
667 struct ib_rmpp_mad *rmpp_mad;
668 int i, total_len, ret;
669
670 rmpp_mad = (struct ib_rmpp_mad *)mad_send_wr->send_wr.wr.ud.mad_hdr;
671 if (!(ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
672 IB_MGMT_RMPP_FLAG_ACTIVE))
673 return IB_RMPP_RESULT_UNHANDLED;
674
675 if (rmpp_mad->rmpp_hdr.rmpp_type != IB_MGMT_RMPP_TYPE_DATA)
676 return IB_RMPP_RESULT_INTERNAL;
677
678 if (mad_send_wr->send_wr.num_sge > 1)
679 return -EINVAL; /* TODO: support num_sge > 1 */
680
681 mad_send_wr->seg_num = 1;
682 mad_send_wr->newwin = 1;
683 mad_send_wr->data_offset = data_offset(rmpp_mad->mad_hdr.mgmt_class);
684
685 total_len = 0;
686 for (i = 0; i < mad_send_wr->send_wr.num_sge; i++)
687 total_len += mad_send_wr->send_wr.sg_list[i].length;
688
689 mad_send_wr->total_seg = (total_len - mad_send_wr->data_offset) /
690 (sizeof(struct ib_rmpp_mad) - mad_send_wr->data_offset);
691 mad_send_wr->pad = total_len - offsetof(struct ib_rmpp_mad, data) -
692 be32_to_cpu(rmpp_mad->rmpp_hdr.paylen_newwin);
693
694 /* We need to wait for the final ACK even if there isn't a response */
695 mad_send_wr->refcount += (mad_send_wr->timeout == 0);
696 ret = send_next_seg(mad_send_wr);
697 if (!ret)
698 return IB_RMPP_RESULT_CONSUMED;
699 return ret;
700}
701
702int ib_process_rmpp_send_wc(struct ib_mad_send_wr_private *mad_send_wr,
703 struct ib_mad_send_wc *mad_send_wc)
704{
705 struct ib_rmpp_mad *rmpp_mad;
706 struct ib_mad_send_buf *msg;
707 int ret;
708
709 rmpp_mad = (struct ib_rmpp_mad *)mad_send_wr->send_wr.wr.ud.mad_hdr;
710 if (!(ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
711 IB_MGMT_RMPP_FLAG_ACTIVE))
712 return IB_RMPP_RESULT_UNHANDLED; /* RMPP not active */
713
714 if (rmpp_mad->rmpp_hdr.rmpp_type != IB_MGMT_RMPP_TYPE_DATA) {
715 msg = (struct ib_mad_send_buf *) (unsigned long)
716 mad_send_wc->wr_id;
717 ib_free_send_mad(msg);
718 return IB_RMPP_RESULT_INTERNAL; /* ACK, STOP, or ABORT */
719 }
720
721 if (mad_send_wc->status != IB_WC_SUCCESS ||
722 mad_send_wr->status != IB_WC_SUCCESS)
723 return IB_RMPP_RESULT_PROCESSED; /* Canceled or send error */
724
725 if (!mad_send_wr->timeout)
726 return IB_RMPP_RESULT_PROCESSED; /* Response received */
727
728 if (mad_send_wr->last_ack == mad_send_wr->total_seg) {
729 mad_send_wr->timeout =
730 msecs_to_jiffies(mad_send_wr->send_wr.wr.ud.timeout_ms);
731 return IB_RMPP_RESULT_PROCESSED; /* Send done */
732 }
733
734 if (mad_send_wr->seg_num > mad_send_wr->newwin ||
735 mad_send_wr->seg_num > mad_send_wr->total_seg)
736 return IB_RMPP_RESULT_PROCESSED; /* Wait for ACK */
737
738 ret = send_next_seg(mad_send_wr);
739 if (ret) {
740 mad_send_wc->status = IB_WC_GENERAL_ERR;
741 return IB_RMPP_RESULT_PROCESSED;
742 }
743 return IB_RMPP_RESULT_CONSUMED;
744}
745
746int ib_retry_rmpp(struct ib_mad_send_wr_private *mad_send_wr)
747{
748 struct ib_rmpp_mad *rmpp_mad;
749 int ret;
750
751 rmpp_mad = (struct ib_rmpp_mad *)mad_send_wr->send_wr.wr.ud.mad_hdr;
752 if (!(ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
753 IB_MGMT_RMPP_FLAG_ACTIVE))
754 return IB_RMPP_RESULT_UNHANDLED; /* RMPP not active */
755
756 if (mad_send_wr->last_ack == mad_send_wr->total_seg)
757 return IB_RMPP_RESULT_PROCESSED;
758
759 mad_send_wr->seg_num = mad_send_wr->last_ack + 1;
760 ret = send_next_seg(mad_send_wr);
761 if (ret)
762 return IB_RMPP_RESULT_PROCESSED;
763
764 return IB_RMPP_RESULT_CONSUMED;
765}
diff --git a/drivers/infiniband/core/mad_rmpp.h b/drivers/infiniband/core/mad_rmpp.h
new file mode 100644
index 000000000000..c4924dfb8e75
--- /dev/null
+++ b/drivers/infiniband/core/mad_rmpp.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2005 Intel Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: mad_rmpp.h 1921 2005-02-25 22:58:44Z sean.hefty $
33 */
34
35#ifndef __MAD_RMPP_H__
36#define __MAD_RMPP_H__
37
38enum {
39 IB_RMPP_RESULT_PROCESSED,
40 IB_RMPP_RESULT_CONSUMED,
41 IB_RMPP_RESULT_INTERNAL,
42 IB_RMPP_RESULT_UNHANDLED
43};
44
45int ib_send_rmpp_mad(struct ib_mad_send_wr_private *mad_send_wr);
46
47struct ib_mad_recv_wc *
48ib_process_rmpp_recv_wc(struct ib_mad_agent_private *agent,
49 struct ib_mad_recv_wc *mad_recv_wc);
50
51int ib_process_rmpp_send_wc(struct ib_mad_send_wr_private *mad_send_wr,
52 struct ib_mad_send_wc *mad_send_wc);
53
54void ib_cancel_rmpp_recvs(struct ib_mad_agent_private *agent);
55
56int ib_retry_rmpp(struct ib_mad_send_wr_private *mad_send_wr);
57
58#endif /* __MAD_RMPP_H__ */
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 5a08e81fa827..795184931c83 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: sa_query.c 1389 2004-12-27 22:56:47Z roland $ 33 * $Id: sa_query.c 2811 2005-07-06 18:11:43Z halr $
33 */ 34 */
34 35
35#include <linux/module.h> 36#include <linux/module.h>
@@ -50,26 +51,6 @@ MODULE_AUTHOR("Roland Dreier");
50MODULE_DESCRIPTION("InfiniBand subnet administration query support"); 51MODULE_DESCRIPTION("InfiniBand subnet administration query support");
51MODULE_LICENSE("Dual BSD/GPL"); 52MODULE_LICENSE("Dual BSD/GPL");
52 53
53/*
54 * These two structures must be packed because they have 64-bit fields
55 * that are only 32-bit aligned. 64-bit architectures will lay them
56 * out wrong otherwise. (And unfortunately they are sent on the wire
57 * so we can't change the layout)
58 */
59struct ib_sa_hdr {
60 u64 sm_key;
61 u16 attr_offset;
62 u16 reserved;
63 ib_sa_comp_mask comp_mask;
64} __attribute__ ((packed));
65
66struct ib_sa_mad {
67 struct ib_mad_hdr mad_hdr;
68 struct ib_rmpp_hdr rmpp_hdr;
69 struct ib_sa_hdr sa_hdr;
70 u8 data[200];
71} __attribute__ ((packed));
72
73struct ib_sa_sm_ah { 54struct ib_sa_sm_ah {
74 struct ib_ah *ah; 55 struct ib_ah *ah;
75 struct kref ref; 56 struct kref ref;
@@ -77,7 +58,6 @@ struct ib_sa_sm_ah {
77 58
78struct ib_sa_port { 59struct ib_sa_port {
79 struct ib_mad_agent *agent; 60 struct ib_mad_agent *agent;
80 struct ib_mr *mr;
81 struct ib_sa_sm_ah *sm_ah; 61 struct ib_sa_sm_ah *sm_ah;
82 struct work_struct update_task; 62 struct work_struct update_task;
83 spinlock_t ah_lock; 63 spinlock_t ah_lock;
@@ -100,6 +80,12 @@ struct ib_sa_query {
100 int id; 80 int id;
101}; 81};
102 82
83struct ib_sa_service_query {
84 void (*callback)(int, struct ib_sa_service_rec *, void *);
85 void *context;
86 struct ib_sa_query sa_query;
87};
88
103struct ib_sa_path_query { 89struct ib_sa_path_query {
104 void (*callback)(int, struct ib_sa_path_rec *, void *); 90 void (*callback)(int, struct ib_sa_path_rec *, void *);
105 void *context; 91 void *context;
@@ -341,6 +327,54 @@ static const struct ib_field mcmember_rec_table[] = {
341 .size_bits = 23 }, 327 .size_bits = 23 },
342}; 328};
343 329
330#define SERVICE_REC_FIELD(field) \
331 .struct_offset_bytes = offsetof(struct ib_sa_service_rec, field), \
332 .struct_size_bytes = sizeof ((struct ib_sa_service_rec *) 0)->field, \
333 .field_name = "sa_service_rec:" #field
334
335static const struct ib_field service_rec_table[] = {
336 { SERVICE_REC_FIELD(id),
337 .offset_words = 0,
338 .offset_bits = 0,
339 .size_bits = 64 },
340 { SERVICE_REC_FIELD(gid),
341 .offset_words = 2,
342 .offset_bits = 0,
343 .size_bits = 128 },
344 { SERVICE_REC_FIELD(pkey),
345 .offset_words = 6,
346 .offset_bits = 0,
347 .size_bits = 16 },
348 { SERVICE_REC_FIELD(lease),
349 .offset_words = 7,
350 .offset_bits = 0,
351 .size_bits = 32 },
352 { SERVICE_REC_FIELD(key),
353 .offset_words = 8,
354 .offset_bits = 0,
355 .size_bits = 128 },
356 { SERVICE_REC_FIELD(name),
357 .offset_words = 12,
358 .offset_bits = 0,
359 .size_bits = 64*8 },
360 { SERVICE_REC_FIELD(data8),
361 .offset_words = 28,
362 .offset_bits = 0,
363 .size_bits = 16*8 },
364 { SERVICE_REC_FIELD(data16),
365 .offset_words = 32,
366 .offset_bits = 0,
367 .size_bits = 8*16 },
368 { SERVICE_REC_FIELD(data32),
369 .offset_words = 36,
370 .offset_bits = 0,
371 .size_bits = 4*32 },
372 { SERVICE_REC_FIELD(data64),
373 .offset_words = 40,
374 .offset_bits = 0,
375 .size_bits = 2*64 },
376};
377
344static void free_sm_ah(struct kref *kref) 378static void free_sm_ah(struct kref *kref)
345{ 379{
346 struct ib_sa_sm_ah *sm_ah = container_of(kref, struct ib_sa_sm_ah, ref); 380 struct ib_sa_sm_ah *sm_ah = container_of(kref, struct ib_sa_sm_ah, ref);
@@ -463,7 +497,7 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms)
463 .mad_hdr = &query->mad->mad_hdr, 497 .mad_hdr = &query->mad->mad_hdr,
464 .remote_qpn = 1, 498 .remote_qpn = 1,
465 .remote_qkey = IB_QP1_QKEY, 499 .remote_qkey = IB_QP1_QKEY,
466 .timeout_ms = timeout_ms 500 .timeout_ms = timeout_ms,
467 } 501 }
468 } 502 }
469 }; 503 };
@@ -492,7 +526,7 @@ retry:
492 sizeof (struct ib_sa_mad), 526 sizeof (struct ib_sa_mad),
493 DMA_TO_DEVICE); 527 DMA_TO_DEVICE);
494 gather_list.length = sizeof (struct ib_sa_mad); 528 gather_list.length = sizeof (struct ib_sa_mad);
495 gather_list.lkey = port->mr->lkey; 529 gather_list.lkey = port->agent->mr->lkey;
496 pci_unmap_addr_set(query, mapping, gather_list.addr); 530 pci_unmap_addr_set(query, mapping, gather_list.addr);
497 531
498 ret = ib_post_send_mad(port->agent, &wr, &bad_wr); 532 ret = ib_post_send_mad(port->agent, &wr, &bad_wr);
@@ -566,7 +600,7 @@ static void ib_sa_path_rec_release(struct ib_sa_query *sa_query)
566int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 600int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
567 struct ib_sa_path_rec *rec, 601 struct ib_sa_path_rec *rec,
568 ib_sa_comp_mask comp_mask, 602 ib_sa_comp_mask comp_mask,
569 int timeout_ms, int gfp_mask, 603 int timeout_ms, unsigned int __nocast gfp_mask,
570 void (*callback)(int status, 604 void (*callback)(int status,
571 struct ib_sa_path_rec *resp, 605 struct ib_sa_path_rec *resp,
572 void *context), 606 void *context),
@@ -616,6 +650,114 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
616} 650}
617EXPORT_SYMBOL(ib_sa_path_rec_get); 651EXPORT_SYMBOL(ib_sa_path_rec_get);
618 652
653static void ib_sa_service_rec_callback(struct ib_sa_query *sa_query,
654 int status,
655 struct ib_sa_mad *mad)
656{
657 struct ib_sa_service_query *query =
658 container_of(sa_query, struct ib_sa_service_query, sa_query);
659
660 if (mad) {
661 struct ib_sa_service_rec rec;
662
663 ib_unpack(service_rec_table, ARRAY_SIZE(service_rec_table),
664 mad->data, &rec);
665 query->callback(status, &rec, query->context);
666 } else
667 query->callback(status, NULL, query->context);
668}
669
670static void ib_sa_service_rec_release(struct ib_sa_query *sa_query)
671{
672 kfree(sa_query->mad);
673 kfree(container_of(sa_query, struct ib_sa_service_query, sa_query));
674}
675
676/**
677 * ib_sa_service_rec_query - Start Service Record operation
678 * @device:device to send request on
679 * @port_num: port number to send request on
680 * @method:SA method - should be get, set, or delete
681 * @rec:Service Record to send in request
682 * @comp_mask:component mask to send in request
683 * @timeout_ms:time to wait for response
684 * @gfp_mask:GFP mask to use for internal allocations
685 * @callback:function called when request completes, times out or is
686 * canceled
687 * @context:opaque user context passed to callback
688 * @sa_query:request context, used to cancel request
689 *
690 * Send a Service Record set/get/delete to the SA to register,
691 * unregister or query a service record.
692 * The callback function will be called when the request completes (or
693 * fails); status is 0 for a successful response, -EINTR if the query
694 * is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error
695 * occurred sending the query. The resp parameter of the callback is
696 * only valid if status is 0.
697 *
698 * If the return value of ib_sa_service_rec_query() is negative, it is an
699 * error code. Otherwise it is a request ID that can be used to cancel
700 * the query.
701 */
702int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method,
703 struct ib_sa_service_rec *rec,
704 ib_sa_comp_mask comp_mask,
705 int timeout_ms, unsigned int __nocast gfp_mask,
706 void (*callback)(int status,
707 struct ib_sa_service_rec *resp,
708 void *context),
709 void *context,
710 struct ib_sa_query **sa_query)
711{
712 struct ib_sa_service_query *query;
713 struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
714 struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port];
715 struct ib_mad_agent *agent = port->agent;
716 int ret;
717
718 if (method != IB_MGMT_METHOD_GET &&
719 method != IB_MGMT_METHOD_SET &&
720 method != IB_SA_METHOD_DELETE)
721 return -EINVAL;
722
723 query = kmalloc(sizeof *query, gfp_mask);
724 if (!query)
725 return -ENOMEM;
726 query->sa_query.mad = kmalloc(sizeof *query->sa_query.mad, gfp_mask);
727 if (!query->sa_query.mad) {
728 kfree(query);
729 return -ENOMEM;
730 }
731
732 query->callback = callback;
733 query->context = context;
734
735 init_mad(query->sa_query.mad, agent);
736
737 query->sa_query.callback = callback ? ib_sa_service_rec_callback : NULL;
738 query->sa_query.release = ib_sa_service_rec_release;
739 query->sa_query.port = port;
740 query->sa_query.mad->mad_hdr.method = method;
741 query->sa_query.mad->mad_hdr.attr_id =
742 cpu_to_be16(IB_SA_ATTR_SERVICE_REC);
743 query->sa_query.mad->sa_hdr.comp_mask = comp_mask;
744
745 ib_pack(service_rec_table, ARRAY_SIZE(service_rec_table),
746 rec, query->sa_query.mad->data);
747
748 *sa_query = &query->sa_query;
749
750 ret = send_mad(&query->sa_query, timeout_ms);
751 if (ret < 0) {
752 *sa_query = NULL;
753 kfree(query->sa_query.mad);
754 kfree(query);
755 }
756
757 return ret;
758}
759EXPORT_SYMBOL(ib_sa_service_rec_query);
760
619static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query, 761static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query,
620 int status, 762 int status,
621 struct ib_sa_mad *mad) 763 struct ib_sa_mad *mad)
@@ -643,7 +785,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
643 u8 method, 785 u8 method,
644 struct ib_sa_mcmember_rec *rec, 786 struct ib_sa_mcmember_rec *rec,
645 ib_sa_comp_mask comp_mask, 787 ib_sa_comp_mask comp_mask,
646 int timeout_ms, int gfp_mask, 788 int timeout_ms, unsigned int __nocast gfp_mask,
647 void (*callback)(int status, 789 void (*callback)(int status,
648 struct ib_sa_mcmember_rec *resp, 790 struct ib_sa_mcmember_rec *resp,
649 void *context), 791 void *context),
@@ -780,7 +922,6 @@ static void ib_sa_add_one(struct ib_device *device)
780 sa_dev->end_port = e; 922 sa_dev->end_port = e;
781 923
782 for (i = 0; i <= e - s; ++i) { 924 for (i = 0; i <= e - s; ++i) {
783 sa_dev->port[i].mr = NULL;
784 sa_dev->port[i].sm_ah = NULL; 925 sa_dev->port[i].sm_ah = NULL;
785 sa_dev->port[i].port_num = i + s; 926 sa_dev->port[i].port_num = i + s;
786 spin_lock_init(&sa_dev->port[i].ah_lock); 927 spin_lock_init(&sa_dev->port[i].ah_lock);
@@ -792,13 +933,6 @@ static void ib_sa_add_one(struct ib_device *device)
792 if (IS_ERR(sa_dev->port[i].agent)) 933 if (IS_ERR(sa_dev->port[i].agent))
793 goto err; 934 goto err;
794 935
795 sa_dev->port[i].mr = ib_get_dma_mr(sa_dev->port[i].agent->qp->pd,
796 IB_ACCESS_LOCAL_WRITE);
797 if (IS_ERR(sa_dev->port[i].mr)) {
798 ib_unregister_mad_agent(sa_dev->port[i].agent);
799 goto err;
800 }
801
802 INIT_WORK(&sa_dev->port[i].update_task, 936 INIT_WORK(&sa_dev->port[i].update_task,
803 update_sm_ah, &sa_dev->port[i]); 937 update_sm_ah, &sa_dev->port[i]);
804 } 938 }
@@ -822,10 +956,8 @@ static void ib_sa_add_one(struct ib_device *device)
822 return; 956 return;
823 957
824err: 958err:
825 while (--i >= 0) { 959 while (--i >= 0)
826 ib_dereg_mr(sa_dev->port[i].mr);
827 ib_unregister_mad_agent(sa_dev->port[i].agent); 960 ib_unregister_mad_agent(sa_dev->port[i].agent);
828 }
829 961
830 kfree(sa_dev); 962 kfree(sa_dev);
831 963
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
new file mode 100644
index 000000000000..61d07c732f49
--- /dev/null
+++ b/drivers/infiniband/core/ucm.c
@@ -0,0 +1,1387 @@
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $
33 */
34#include <linux/init.h>
35#include <linux/fs.h>
36#include <linux/module.h>
37#include <linux/device.h>
38#include <linux/err.h>
39#include <linux/poll.h>
40#include <linux/file.h>
41#include <linux/mount.h>
42#include <linux/cdev.h>
43
44#include <asm/uaccess.h>
45
46#include "ucm.h"
47
48MODULE_AUTHOR("Libor Michalek");
49MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access");
50MODULE_LICENSE("Dual BSD/GPL");
51
52static int ucm_debug_level;
53
54module_param_named(debug_level, ucm_debug_level, int, 0644);
55MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
56
57enum {
58 IB_UCM_MAJOR = 231,
59 IB_UCM_MINOR = 255
60};
61
62#define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR)
63
64#define PFX "UCM: "
65
66#define ucm_dbg(format, arg...) \
67 do { \
68 if (ucm_debug_level > 0) \
69 printk(KERN_DEBUG PFX format, ## arg); \
70 } while (0)
71
72static struct semaphore ctx_id_mutex;
73static struct idr ctx_id_table;
74static int ctx_id_rover = 0;
75
76static struct ib_ucm_context *ib_ucm_ctx_get(int id)
77{
78 struct ib_ucm_context *ctx;
79
80 down(&ctx_id_mutex);
81 ctx = idr_find(&ctx_id_table, id);
82 if (ctx)
83 ctx->ref++;
84 up(&ctx_id_mutex);
85
86 return ctx;
87}
88
89static void ib_ucm_ctx_put(struct ib_ucm_context *ctx)
90{
91 struct ib_ucm_event *uevent;
92
93 down(&ctx_id_mutex);
94
95 ctx->ref--;
96 if (!ctx->ref)
97 idr_remove(&ctx_id_table, ctx->id);
98
99 up(&ctx_id_mutex);
100
101 if (ctx->ref)
102 return;
103
104 down(&ctx->file->mutex);
105
106 list_del(&ctx->file_list);
107 while (!list_empty(&ctx->events)) {
108
109 uevent = list_entry(ctx->events.next,
110 struct ib_ucm_event, ctx_list);
111 list_del(&uevent->file_list);
112 list_del(&uevent->ctx_list);
113
114 /* clear incoming connections. */
115 if (uevent->cm_id)
116 ib_destroy_cm_id(uevent->cm_id);
117
118 kfree(uevent);
119 }
120
121 up(&ctx->file->mutex);
122
123 ucm_dbg("Destroyed CM ID <%d>\n", ctx->id);
124
125 ib_destroy_cm_id(ctx->cm_id);
126 kfree(ctx);
127}
128
129static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
130{
131 struct ib_ucm_context *ctx;
132 int result;
133
134 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
135 if (!ctx)
136 return NULL;
137
138 ctx->ref = 1; /* user reference */
139 ctx->file = file;
140
141 INIT_LIST_HEAD(&ctx->events);
142 init_MUTEX(&ctx->mutex);
143
144 list_add_tail(&ctx->file_list, &file->ctxs);
145
146 ctx_id_rover = (ctx_id_rover + 1) & INT_MAX;
147retry:
148 result = idr_pre_get(&ctx_id_table, GFP_KERNEL);
149 if (!result)
150 goto error;
151
152 down(&ctx_id_mutex);
153 result = idr_get_new_above(&ctx_id_table, ctx, ctx_id_rover, &ctx->id);
154 up(&ctx_id_mutex);
155
156 if (result == -EAGAIN)
157 goto retry;
158 if (result)
159 goto error;
160
161 ucm_dbg("Allocated CM ID <%d>\n", ctx->id);
162
163 return ctx;
164error:
165 list_del(&ctx->file_list);
166 kfree(ctx);
167
168 return NULL;
169}
170/*
171 * Event portion of the API, handle CM events
172 * and allow event polling.
173 */
174static void ib_ucm_event_path_get(struct ib_ucm_path_rec *upath,
175 struct ib_sa_path_rec *kpath)
176{
177 if (!kpath || !upath)
178 return;
179
180 memcpy(upath->dgid, kpath->dgid.raw, sizeof(union ib_gid));
181 memcpy(upath->sgid, kpath->sgid.raw, sizeof(union ib_gid));
182
183 upath->dlid = kpath->dlid;
184 upath->slid = kpath->slid;
185 upath->raw_traffic = kpath->raw_traffic;
186 upath->flow_label = kpath->flow_label;
187 upath->hop_limit = kpath->hop_limit;
188 upath->traffic_class = kpath->traffic_class;
189 upath->reversible = kpath->reversible;
190 upath->numb_path = kpath->numb_path;
191 upath->pkey = kpath->pkey;
192 upath->sl = kpath->sl;
193 upath->mtu_selector = kpath->mtu_selector;
194 upath->mtu = kpath->mtu;
195 upath->rate_selector = kpath->rate_selector;
196 upath->rate = kpath->rate;
197 upath->packet_life_time = kpath->packet_life_time;
198 upath->preference = kpath->preference;
199
200 upath->packet_life_time_selector =
201 kpath->packet_life_time_selector;
202}
203
204static void ib_ucm_event_req_get(struct ib_ucm_req_event_resp *ureq,
205 struct ib_cm_req_event_param *kreq)
206{
207 ureq->listen_id = (long)kreq->listen_id->context;
208
209 ureq->remote_ca_guid = kreq->remote_ca_guid;
210 ureq->remote_qkey = kreq->remote_qkey;
211 ureq->remote_qpn = kreq->remote_qpn;
212 ureq->qp_type = kreq->qp_type;
213 ureq->starting_psn = kreq->starting_psn;
214 ureq->responder_resources = kreq->responder_resources;
215 ureq->initiator_depth = kreq->initiator_depth;
216 ureq->local_cm_response_timeout = kreq->local_cm_response_timeout;
217 ureq->flow_control = kreq->flow_control;
218 ureq->remote_cm_response_timeout = kreq->remote_cm_response_timeout;
219 ureq->retry_count = kreq->retry_count;
220 ureq->rnr_retry_count = kreq->rnr_retry_count;
221 ureq->srq = kreq->srq;
222
223 ib_ucm_event_path_get(&ureq->primary_path, kreq->primary_path);
224 ib_ucm_event_path_get(&ureq->alternate_path, kreq->alternate_path);
225}
226
227static void ib_ucm_event_rep_get(struct ib_ucm_rep_event_resp *urep,
228 struct ib_cm_rep_event_param *krep)
229{
230 urep->remote_ca_guid = krep->remote_ca_guid;
231 urep->remote_qkey = krep->remote_qkey;
232 urep->remote_qpn = krep->remote_qpn;
233 urep->starting_psn = krep->starting_psn;
234 urep->responder_resources = krep->responder_resources;
235 urep->initiator_depth = krep->initiator_depth;
236 urep->target_ack_delay = krep->target_ack_delay;
237 urep->failover_accepted = krep->failover_accepted;
238 urep->flow_control = krep->flow_control;
239 urep->rnr_retry_count = krep->rnr_retry_count;
240 urep->srq = krep->srq;
241}
242
243static void ib_ucm_event_rej_get(struct ib_ucm_rej_event_resp *urej,
244 struct ib_cm_rej_event_param *krej)
245{
246 urej->reason = krej->reason;
247}
248
249static void ib_ucm_event_mra_get(struct ib_ucm_mra_event_resp *umra,
250 struct ib_cm_mra_event_param *kmra)
251{
252 umra->timeout = kmra->service_timeout;
253}
254
255static void ib_ucm_event_lap_get(struct ib_ucm_lap_event_resp *ulap,
256 struct ib_cm_lap_event_param *klap)
257{
258 ib_ucm_event_path_get(&ulap->path, klap->alternate_path);
259}
260
261static void ib_ucm_event_apr_get(struct ib_ucm_apr_event_resp *uapr,
262 struct ib_cm_apr_event_param *kapr)
263{
264 uapr->status = kapr->ap_status;
265}
266
267static void ib_ucm_event_sidr_req_get(struct ib_ucm_sidr_req_event_resp *ureq,
268 struct ib_cm_sidr_req_event_param *kreq)
269{
270 ureq->listen_id = (long)kreq->listen_id->context;
271 ureq->pkey = kreq->pkey;
272}
273
274static void ib_ucm_event_sidr_rep_get(struct ib_ucm_sidr_rep_event_resp *urep,
275 struct ib_cm_sidr_rep_event_param *krep)
276{
277 urep->status = krep->status;
278 urep->qkey = krep->qkey;
279 urep->qpn = krep->qpn;
280};
281
282static int ib_ucm_event_process(struct ib_cm_event *evt,
283 struct ib_ucm_event *uvt)
284{
285 void *info = NULL;
286 int result;
287
288 switch (evt->event) {
289 case IB_CM_REQ_RECEIVED:
290 ib_ucm_event_req_get(&uvt->resp.u.req_resp,
291 &evt->param.req_rcvd);
292 uvt->data_len = IB_CM_REQ_PRIVATE_DATA_SIZE;
293 uvt->resp.present |= (evt->param.req_rcvd.primary_path ?
294 IB_UCM_PRES_PRIMARY : 0);
295 uvt->resp.present |= (evt->param.req_rcvd.alternate_path ?
296 IB_UCM_PRES_ALTERNATE : 0);
297 break;
298 case IB_CM_REP_RECEIVED:
299 ib_ucm_event_rep_get(&uvt->resp.u.rep_resp,
300 &evt->param.rep_rcvd);
301 uvt->data_len = IB_CM_REP_PRIVATE_DATA_SIZE;
302
303 break;
304 case IB_CM_RTU_RECEIVED:
305 uvt->data_len = IB_CM_RTU_PRIVATE_DATA_SIZE;
306 uvt->resp.u.send_status = evt->param.send_status;
307
308 break;
309 case IB_CM_DREQ_RECEIVED:
310 uvt->data_len = IB_CM_DREQ_PRIVATE_DATA_SIZE;
311 uvt->resp.u.send_status = evt->param.send_status;
312
313 break;
314 case IB_CM_DREP_RECEIVED:
315 uvt->data_len = IB_CM_DREP_PRIVATE_DATA_SIZE;
316 uvt->resp.u.send_status = evt->param.send_status;
317
318 break;
319 case IB_CM_MRA_RECEIVED:
320 ib_ucm_event_mra_get(&uvt->resp.u.mra_resp,
321 &evt->param.mra_rcvd);
322 uvt->data_len = IB_CM_MRA_PRIVATE_DATA_SIZE;
323
324 break;
325 case IB_CM_REJ_RECEIVED:
326 ib_ucm_event_rej_get(&uvt->resp.u.rej_resp,
327 &evt->param.rej_rcvd);
328 uvt->data_len = IB_CM_REJ_PRIVATE_DATA_SIZE;
329 uvt->info_len = evt->param.rej_rcvd.ari_length;
330 info = evt->param.rej_rcvd.ari;
331
332 break;
333 case IB_CM_LAP_RECEIVED:
334 ib_ucm_event_lap_get(&uvt->resp.u.lap_resp,
335 &evt->param.lap_rcvd);
336 uvt->data_len = IB_CM_LAP_PRIVATE_DATA_SIZE;
337 uvt->resp.present |= (evt->param.lap_rcvd.alternate_path ?
338 IB_UCM_PRES_ALTERNATE : 0);
339 break;
340 case IB_CM_APR_RECEIVED:
341 ib_ucm_event_apr_get(&uvt->resp.u.apr_resp,
342 &evt->param.apr_rcvd);
343 uvt->data_len = IB_CM_APR_PRIVATE_DATA_SIZE;
344 uvt->info_len = evt->param.apr_rcvd.info_len;
345 info = evt->param.apr_rcvd.apr_info;
346
347 break;
348 case IB_CM_SIDR_REQ_RECEIVED:
349 ib_ucm_event_sidr_req_get(&uvt->resp.u.sidr_req_resp,
350 &evt->param.sidr_req_rcvd);
351 uvt->data_len = IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE;
352
353 break;
354 case IB_CM_SIDR_REP_RECEIVED:
355 ib_ucm_event_sidr_rep_get(&uvt->resp.u.sidr_rep_resp,
356 &evt->param.sidr_rep_rcvd);
357 uvt->data_len = IB_CM_SIDR_REP_PRIVATE_DATA_SIZE;
358 uvt->info_len = evt->param.sidr_rep_rcvd.info_len;
359 info = evt->param.sidr_rep_rcvd.info;
360
361 break;
362 default:
363 uvt->resp.u.send_status = evt->param.send_status;
364
365 break;
366 }
367
368 if (uvt->data_len && evt->private_data) {
369
370 uvt->data = kmalloc(uvt->data_len, GFP_KERNEL);
371 if (!uvt->data) {
372 result = -ENOMEM;
373 goto error;
374 }
375
376 memcpy(uvt->data, evt->private_data, uvt->data_len);
377 uvt->resp.present |= IB_UCM_PRES_DATA;
378 }
379
380 if (uvt->info_len && info) {
381
382 uvt->info = kmalloc(uvt->info_len, GFP_KERNEL);
383 if (!uvt->info) {
384 result = -ENOMEM;
385 goto error;
386 }
387
388 memcpy(uvt->info, info, uvt->info_len);
389 uvt->resp.present |= IB_UCM_PRES_INFO;
390 }
391
392 return 0;
393error:
394 kfree(uvt->info);
395 kfree(uvt->data);
396 return result;
397}
398
399static int ib_ucm_event_handler(struct ib_cm_id *cm_id,
400 struct ib_cm_event *event)
401{
402 struct ib_ucm_event *uevent;
403 struct ib_ucm_context *ctx;
404 int result = 0;
405 int id;
406 /*
407 * lookup correct context based on event type.
408 */
409 switch (event->event) {
410 case IB_CM_REQ_RECEIVED:
411 id = (long)event->param.req_rcvd.listen_id->context;
412 break;
413 case IB_CM_SIDR_REQ_RECEIVED:
414 id = (long)event->param.sidr_req_rcvd.listen_id->context;
415 break;
416 default:
417 id = (long)cm_id->context;
418 break;
419 }
420
421 ucm_dbg("Event. CM ID <%d> event <%d>\n", id, event->event);
422
423 ctx = ib_ucm_ctx_get(id);
424 if (!ctx)
425 return -ENOENT;
426
427 if (event->event == IB_CM_REQ_RECEIVED ||
428 event->event == IB_CM_SIDR_REQ_RECEIVED)
429 id = IB_UCM_CM_ID_INVALID;
430
431 uevent = kmalloc(sizeof(*uevent), GFP_KERNEL);
432 if (!uevent) {
433 result = -ENOMEM;
434 goto done;
435 }
436
437 memset(uevent, 0, sizeof(*uevent));
438
439 uevent->resp.id = id;
440 uevent->resp.event = event->event;
441
442 result = ib_ucm_event_process(event, uevent);
443 if (result)
444 goto done;
445
446 uevent->ctx = ctx;
447 uevent->cm_id = ((event->event == IB_CM_REQ_RECEIVED ||
448 event->event == IB_CM_SIDR_REQ_RECEIVED ) ?
449 cm_id : NULL);
450
451 down(&ctx->file->mutex);
452
453 list_add_tail(&uevent->file_list, &ctx->file->events);
454 list_add_tail(&uevent->ctx_list, &ctx->events);
455
456 wake_up_interruptible(&ctx->file->poll_wait);
457
458 up(&ctx->file->mutex);
459done:
460 ctx->error = result;
461 ib_ucm_ctx_put(ctx); /* func reference */
462 return result;
463}
464
465static ssize_t ib_ucm_event(struct ib_ucm_file *file,
466 const char __user *inbuf,
467 int in_len, int out_len)
468{
469 struct ib_ucm_context *ctx;
470 struct ib_ucm_event_get cmd;
471 struct ib_ucm_event *uevent = NULL;
472 int result = 0;
473 DEFINE_WAIT(wait);
474
475 if (out_len < sizeof(struct ib_ucm_event_resp))
476 return -ENOSPC;
477
478 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
479 return -EFAULT;
480 /*
481 * wait
482 */
483 down(&file->mutex);
484
485 while (list_empty(&file->events)) {
486
487 if (file->filp->f_flags & O_NONBLOCK) {
488 result = -EAGAIN;
489 break;
490 }
491
492 if (signal_pending(current)) {
493 result = -ERESTARTSYS;
494 break;
495 }
496
497 prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
498
499 up(&file->mutex);
500 schedule();
501 down(&file->mutex);
502
503 finish_wait(&file->poll_wait, &wait);
504 }
505
506 if (result)
507 goto done;
508
509 uevent = list_entry(file->events.next, struct ib_ucm_event, file_list);
510
511 if (!uevent->cm_id)
512 goto user;
513
514 ctx = ib_ucm_ctx_alloc(file);
515 if (!ctx) {
516 result = -ENOMEM;
517 goto done;
518 }
519
520 ctx->cm_id = uevent->cm_id;
521 ctx->cm_id->cm_handler = ib_ucm_event_handler;
522 ctx->cm_id->context = (void *)(unsigned long)ctx->id;
523
524 uevent->resp.id = ctx->id;
525
526user:
527 if (copy_to_user((void __user *)(unsigned long)cmd.response,
528 &uevent->resp, sizeof(uevent->resp))) {
529 result = -EFAULT;
530 goto done;
531 }
532
533 if (uevent->data) {
534
535 if (cmd.data_len < uevent->data_len) {
536 result = -ENOMEM;
537 goto done;
538 }
539
540 if (copy_to_user((void __user *)(unsigned long)cmd.data,
541 uevent->data, uevent->data_len)) {
542 result = -EFAULT;
543 goto done;
544 }
545 }
546
547 if (uevent->info) {
548
549 if (cmd.info_len < uevent->info_len) {
550 result = -ENOMEM;
551 goto done;
552 }
553
554 if (copy_to_user((void __user *)(unsigned long)cmd.info,
555 uevent->info, uevent->info_len)) {
556 result = -EFAULT;
557 goto done;
558 }
559 }
560
561 list_del(&uevent->file_list);
562 list_del(&uevent->ctx_list);
563
564 kfree(uevent->data);
565 kfree(uevent->info);
566 kfree(uevent);
567done:
568 up(&file->mutex);
569 return result;
570}
571
572
573static ssize_t ib_ucm_create_id(struct ib_ucm_file *file,
574 const char __user *inbuf,
575 int in_len, int out_len)
576{
577 struct ib_ucm_create_id cmd;
578 struct ib_ucm_create_id_resp resp;
579 struct ib_ucm_context *ctx;
580 int result;
581
582 if (out_len < sizeof(resp))
583 return -ENOSPC;
584
585 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
586 return -EFAULT;
587
588 ctx = ib_ucm_ctx_alloc(file);
589 if (!ctx)
590 return -ENOMEM;
591
592 ctx->cm_id = ib_create_cm_id(ib_ucm_event_handler,
593 (void *)(unsigned long)ctx->id);
594 if (!ctx->cm_id) {
595 result = -ENOMEM;
596 goto err_cm;
597 }
598
599 resp.id = ctx->id;
600 if (copy_to_user((void __user *)(unsigned long)cmd.response,
601 &resp, sizeof(resp))) {
602 result = -EFAULT;
603 goto err_ret;
604 }
605
606 return 0;
607err_ret:
608 ib_destroy_cm_id(ctx->cm_id);
609err_cm:
610 ib_ucm_ctx_put(ctx); /* user reference */
611
612 return result;
613}
614
615static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file,
616 const char __user *inbuf,
617 int in_len, int out_len)
618{
619 struct ib_ucm_destroy_id cmd;
620 struct ib_ucm_context *ctx;
621
622 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
623 return -EFAULT;
624
625 ctx = ib_ucm_ctx_get(cmd.id);
626 if (!ctx)
627 return -ENOENT;
628
629 ib_ucm_ctx_put(ctx); /* user reference */
630 ib_ucm_ctx_put(ctx); /* func reference */
631
632 return 0;
633}
634
635static ssize_t ib_ucm_attr_id(struct ib_ucm_file *file,
636 const char __user *inbuf,
637 int in_len, int out_len)
638{
639 struct ib_ucm_attr_id_resp resp;
640 struct ib_ucm_attr_id cmd;
641 struct ib_ucm_context *ctx;
642 int result = 0;
643
644 if (out_len < sizeof(resp))
645 return -ENOSPC;
646
647 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
648 return -EFAULT;
649
650 ctx = ib_ucm_ctx_get(cmd.id);
651 if (!ctx)
652 return -ENOENT;
653
654 down(&ctx->file->mutex);
655 if (ctx->file != file) {
656 result = -EINVAL;
657 goto done;
658 }
659
660 resp.service_id = ctx->cm_id->service_id;
661 resp.service_mask = ctx->cm_id->service_mask;
662 resp.local_id = ctx->cm_id->local_id;
663 resp.remote_id = ctx->cm_id->remote_id;
664
665 if (copy_to_user((void __user *)(unsigned long)cmd.response,
666 &resp, sizeof(resp)))
667 result = -EFAULT;
668
669done:
670 up(&ctx->file->mutex);
671 ib_ucm_ctx_put(ctx); /* func reference */
672 return result;
673}
674
675static ssize_t ib_ucm_listen(struct ib_ucm_file *file,
676 const char __user *inbuf,
677 int in_len, int out_len)
678{
679 struct ib_ucm_listen cmd;
680 struct ib_ucm_context *ctx;
681 int result;
682
683 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
684 return -EFAULT;
685
686 ctx = ib_ucm_ctx_get(cmd.id);
687 if (!ctx)
688 return -ENOENT;
689
690 down(&ctx->file->mutex);
691 if (ctx->file != file)
692 result = -EINVAL;
693 else
694 result = ib_cm_listen(ctx->cm_id, cmd.service_id,
695 cmd.service_mask);
696
697 up(&ctx->file->mutex);
698 ib_ucm_ctx_put(ctx); /* func reference */
699 return result;
700}
701
702static ssize_t ib_ucm_establish(struct ib_ucm_file *file,
703 const char __user *inbuf,
704 int in_len, int out_len)
705{
706 struct ib_ucm_establish cmd;
707 struct ib_ucm_context *ctx;
708 int result;
709
710 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
711 return -EFAULT;
712
713 ctx = ib_ucm_ctx_get(cmd.id);
714 if (!ctx)
715 return -ENOENT;
716
717 down(&ctx->file->mutex);
718 if (ctx->file != file)
719 result = -EINVAL;
720 else
721 result = ib_cm_establish(ctx->cm_id);
722
723 up(&ctx->file->mutex);
724 ib_ucm_ctx_put(ctx); /* func reference */
725 return result;
726}
727
728static int ib_ucm_alloc_data(const void **dest, u64 src, u32 len)
729{
730 void *data;
731
732 *dest = NULL;
733
734 if (!len)
735 return 0;
736
737 data = kmalloc(len, GFP_KERNEL);
738 if (!data)
739 return -ENOMEM;
740
741 if (copy_from_user(data, (void __user *)(unsigned long)src, len)) {
742 kfree(data);
743 return -EFAULT;
744 }
745
746 *dest = data;
747 return 0;
748}
749
750static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src)
751{
752 struct ib_ucm_path_rec ucm_path;
753 struct ib_sa_path_rec *sa_path;
754
755 *path = NULL;
756
757 if (!src)
758 return 0;
759
760 sa_path = kmalloc(sizeof(*sa_path), GFP_KERNEL);
761 if (!sa_path)
762 return -ENOMEM;
763
764 if (copy_from_user(&ucm_path, (void __user *)(unsigned long)src,
765 sizeof(ucm_path))) {
766
767 kfree(sa_path);
768 return -EFAULT;
769 }
770
771 memcpy(sa_path->dgid.raw, ucm_path.dgid, sizeof(union ib_gid));
772 memcpy(sa_path->sgid.raw, ucm_path.sgid, sizeof(union ib_gid));
773
774 sa_path->dlid = ucm_path.dlid;
775 sa_path->slid = ucm_path.slid;
776 sa_path->raw_traffic = ucm_path.raw_traffic;
777 sa_path->flow_label = ucm_path.flow_label;
778 sa_path->hop_limit = ucm_path.hop_limit;
779 sa_path->traffic_class = ucm_path.traffic_class;
780 sa_path->reversible = ucm_path.reversible;
781 sa_path->numb_path = ucm_path.numb_path;
782 sa_path->pkey = ucm_path.pkey;
783 sa_path->sl = ucm_path.sl;
784 sa_path->mtu_selector = ucm_path.mtu_selector;
785 sa_path->mtu = ucm_path.mtu;
786 sa_path->rate_selector = ucm_path.rate_selector;
787 sa_path->rate = ucm_path.rate;
788 sa_path->packet_life_time = ucm_path.packet_life_time;
789 sa_path->preference = ucm_path.preference;
790
791 sa_path->packet_life_time_selector =
792 ucm_path.packet_life_time_selector;
793
794 *path = sa_path;
795 return 0;
796}
797
798static ssize_t ib_ucm_send_req(struct ib_ucm_file *file,
799 const char __user *inbuf,
800 int in_len, int out_len)
801{
802 struct ib_cm_req_param param;
803 struct ib_ucm_context *ctx;
804 struct ib_ucm_req cmd;
805 int result;
806
807 param.private_data = NULL;
808 param.primary_path = NULL;
809 param.alternate_path = NULL;
810
811 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
812 return -EFAULT;
813
814 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len);
815 if (result)
816 goto done;
817
818 result = ib_ucm_path_get(&param.primary_path, cmd.primary_path);
819 if (result)
820 goto done;
821
822 result = ib_ucm_path_get(&param.alternate_path, cmd.alternate_path);
823 if (result)
824 goto done;
825
826 param.private_data_len = cmd.len;
827 param.service_id = cmd.sid;
828 param.qp_num = cmd.qpn;
829 param.qp_type = cmd.qp_type;
830 param.starting_psn = cmd.psn;
831 param.peer_to_peer = cmd.peer_to_peer;
832 param.responder_resources = cmd.responder_resources;
833 param.initiator_depth = cmd.initiator_depth;
834 param.remote_cm_response_timeout = cmd.remote_cm_response_timeout;
835 param.flow_control = cmd.flow_control;
836 param.local_cm_response_timeout = cmd.local_cm_response_timeout;
837 param.retry_count = cmd.retry_count;
838 param.rnr_retry_count = cmd.rnr_retry_count;
839 param.max_cm_retries = cmd.max_cm_retries;
840 param.srq = cmd.srq;
841
842 ctx = ib_ucm_ctx_get(cmd.id);
843 if (!ctx) {
844 result = -ENOENT;
845 goto done;
846 }
847
848 down(&ctx->file->mutex);
849 if (ctx->file != file)
850 result = -EINVAL;
851 else
852 result = ib_send_cm_req(ctx->cm_id, &param);
853
854 up(&ctx->file->mutex);
855 ib_ucm_ctx_put(ctx); /* func reference */
856done:
857 kfree(param.private_data);
858 kfree(param.primary_path);
859 kfree(param.alternate_path);
860
861 return result;
862}
863
864static ssize_t ib_ucm_send_rep(struct ib_ucm_file *file,
865 const char __user *inbuf,
866 int in_len, int out_len)
867{
868 struct ib_cm_rep_param param;
869 struct ib_ucm_context *ctx;
870 struct ib_ucm_rep cmd;
871 int result;
872
873 param.private_data = NULL;
874
875 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
876 return -EFAULT;
877
878 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len);
879 if (result)
880 return result;
881
882 param.qp_num = cmd.qpn;
883 param.starting_psn = cmd.psn;
884 param.private_data_len = cmd.len;
885 param.responder_resources = cmd.responder_resources;
886 param.initiator_depth = cmd.initiator_depth;
887 param.target_ack_delay = cmd.target_ack_delay;
888 param.failover_accepted = cmd.failover_accepted;
889 param.flow_control = cmd.flow_control;
890 param.rnr_retry_count = cmd.rnr_retry_count;
891 param.srq = cmd.srq;
892
893 ctx = ib_ucm_ctx_get(cmd.id);
894 if (!ctx) {
895 result = -ENOENT;
896 goto done;
897 }
898
899 down(&ctx->file->mutex);
900 if (ctx->file != file)
901 result = -EINVAL;
902 else
903 result = ib_send_cm_rep(ctx->cm_id, &param);
904
905 up(&ctx->file->mutex);
906 ib_ucm_ctx_put(ctx); /* func reference */
907done:
908 kfree(param.private_data);
909
910 return result;
911}
912
913static ssize_t ib_ucm_send_private_data(struct ib_ucm_file *file,
914 const char __user *inbuf, int in_len,
915 int (*func)(struct ib_cm_id *cm_id,
916 const void *private_data,
917 u8 private_data_len))
918{
919 struct ib_ucm_private_data cmd;
920 struct ib_ucm_context *ctx;
921 const void *private_data = NULL;
922 int result;
923
924 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
925 return -EFAULT;
926
927 result = ib_ucm_alloc_data(&private_data, cmd.data, cmd.len);
928 if (result)
929 return result;
930
931 ctx = ib_ucm_ctx_get(cmd.id);
932 if (!ctx) {
933 result = -ENOENT;
934 goto done;
935 }
936
937 down(&ctx->file->mutex);
938 if (ctx->file != file)
939 result = -EINVAL;
940 else
941 result = func(ctx->cm_id, private_data, cmd.len);
942
943 up(&ctx->file->mutex);
944 ib_ucm_ctx_put(ctx); /* func reference */
945done:
946 kfree(private_data);
947
948 return result;
949}
950
951static ssize_t ib_ucm_send_rtu(struct ib_ucm_file *file,
952 const char __user *inbuf,
953 int in_len, int out_len)
954{
955 return ib_ucm_send_private_data(file, inbuf, in_len, ib_send_cm_rtu);
956}
957
958static ssize_t ib_ucm_send_dreq(struct ib_ucm_file *file,
959 const char __user *inbuf,
960 int in_len, int out_len)
961{
962 return ib_ucm_send_private_data(file, inbuf, in_len, ib_send_cm_dreq);
963}
964
965static ssize_t ib_ucm_send_drep(struct ib_ucm_file *file,
966 const char __user *inbuf,
967 int in_len, int out_len)
968{
969 return ib_ucm_send_private_data(file, inbuf, in_len, ib_send_cm_drep);
970}
971
972static ssize_t ib_ucm_send_info(struct ib_ucm_file *file,
973 const char __user *inbuf, int in_len,
974 int (*func)(struct ib_cm_id *cm_id,
975 int status,
976 const void *info,
977 u8 info_len,
978 const void *data,
979 u8 data_len))
980{
981 struct ib_ucm_context *ctx;
982 struct ib_ucm_info cmd;
983 const void *data = NULL;
984 const void *info = NULL;
985 int result;
986
987 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
988 return -EFAULT;
989
990 result = ib_ucm_alloc_data(&data, cmd.data, cmd.data_len);
991 if (result)
992 goto done;
993
994 result = ib_ucm_alloc_data(&info, cmd.info, cmd.info_len);
995 if (result)
996 goto done;
997
998 ctx = ib_ucm_ctx_get(cmd.id);
999 if (!ctx) {
1000 result = -ENOENT;
1001 goto done;
1002 }
1003
1004 down(&ctx->file->mutex);
1005 if (ctx->file != file)
1006 result = -EINVAL;
1007 else
1008 result = func(ctx->cm_id, cmd.status,
1009 info, cmd.info_len,
1010 data, cmd.data_len);
1011
1012 up(&ctx->file->mutex);
1013 ib_ucm_ctx_put(ctx); /* func reference */
1014done:
1015 kfree(data);
1016 kfree(info);
1017
1018 return result;
1019}
1020
1021static ssize_t ib_ucm_send_rej(struct ib_ucm_file *file,
1022 const char __user *inbuf,
1023 int in_len, int out_len)
1024{
1025 return ib_ucm_send_info(file, inbuf, in_len, (void *)ib_send_cm_rej);
1026}
1027
1028static ssize_t ib_ucm_send_apr(struct ib_ucm_file *file,
1029 const char __user *inbuf,
1030 int in_len, int out_len)
1031{
1032 return ib_ucm_send_info(file, inbuf, in_len, (void *)ib_send_cm_apr);
1033}
1034
1035static ssize_t ib_ucm_send_mra(struct ib_ucm_file *file,
1036 const char __user *inbuf,
1037 int in_len, int out_len)
1038{
1039 struct ib_ucm_context *ctx;
1040 struct ib_ucm_mra cmd;
1041 const void *data = NULL;
1042 int result;
1043
1044 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1045 return -EFAULT;
1046
1047 result = ib_ucm_alloc_data(&data, cmd.data, cmd.len);
1048 if (result)
1049 return result;
1050
1051 ctx = ib_ucm_ctx_get(cmd.id);
1052 if (!ctx) {
1053 result = -ENOENT;
1054 goto done;
1055 }
1056
1057 down(&ctx->file->mutex);
1058 if (ctx->file != file)
1059 result = -EINVAL;
1060 else
1061 result = ib_send_cm_mra(ctx->cm_id, cmd.timeout,
1062 data, cmd.len);
1063
1064 up(&ctx->file->mutex);
1065 ib_ucm_ctx_put(ctx); /* func reference */
1066done:
1067 kfree(data);
1068
1069 return result;
1070}
1071
1072static ssize_t ib_ucm_send_lap(struct ib_ucm_file *file,
1073 const char __user *inbuf,
1074 int in_len, int out_len)
1075{
1076 struct ib_ucm_context *ctx;
1077 struct ib_sa_path_rec *path = NULL;
1078 struct ib_ucm_lap cmd;
1079 const void *data = NULL;
1080 int result;
1081
1082 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1083 return -EFAULT;
1084
1085 result = ib_ucm_alloc_data(&data, cmd.data, cmd.len);
1086 if (result)
1087 goto done;
1088
1089 result = ib_ucm_path_get(&path, cmd.path);
1090 if (result)
1091 goto done;
1092
1093 ctx = ib_ucm_ctx_get(cmd.id);
1094 if (!ctx) {
1095 result = -ENOENT;
1096 goto done;
1097 }
1098
1099 down(&ctx->file->mutex);
1100 if (ctx->file != file)
1101 result = -EINVAL;
1102 else
1103 result = ib_send_cm_lap(ctx->cm_id, path, data, cmd.len);
1104
1105 up(&ctx->file->mutex);
1106 ib_ucm_ctx_put(ctx); /* func reference */
1107done:
1108 kfree(data);
1109 kfree(path);
1110
1111 return result;
1112}
1113
1114static ssize_t ib_ucm_send_sidr_req(struct ib_ucm_file *file,
1115 const char __user *inbuf,
1116 int in_len, int out_len)
1117{
1118 struct ib_cm_sidr_req_param param;
1119 struct ib_ucm_context *ctx;
1120 struct ib_ucm_sidr_req cmd;
1121 int result;
1122
1123 param.private_data = NULL;
1124 param.path = NULL;
1125
1126 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1127 return -EFAULT;
1128
1129 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len);
1130 if (result)
1131 goto done;
1132
1133 result = ib_ucm_path_get(&param.path, cmd.path);
1134 if (result)
1135 goto done;
1136
1137 param.private_data_len = cmd.len;
1138 param.service_id = cmd.sid;
1139 param.timeout_ms = cmd.timeout;
1140 param.max_cm_retries = cmd.max_cm_retries;
1141 param.pkey = cmd.pkey;
1142
1143 ctx = ib_ucm_ctx_get(cmd.id);
1144 if (!ctx) {
1145 result = -ENOENT;
1146 goto done;
1147 }
1148
1149 down(&ctx->file->mutex);
1150 if (ctx->file != file)
1151 result = -EINVAL;
1152 else
1153 result = ib_send_cm_sidr_req(ctx->cm_id, &param);
1154
1155 up(&ctx->file->mutex);
1156 ib_ucm_ctx_put(ctx); /* func reference */
1157done:
1158 kfree(param.private_data);
1159 kfree(param.path);
1160
1161 return result;
1162}
1163
1164static ssize_t ib_ucm_send_sidr_rep(struct ib_ucm_file *file,
1165 const char __user *inbuf,
1166 int in_len, int out_len)
1167{
1168 struct ib_cm_sidr_rep_param param;
1169 struct ib_ucm_sidr_rep cmd;
1170 struct ib_ucm_context *ctx;
1171 int result;
1172
1173 param.info = NULL;
1174
1175 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1176 return -EFAULT;
1177
1178 result = ib_ucm_alloc_data(&param.private_data,
1179 cmd.data, cmd.data_len);
1180 if (result)
1181 goto done;
1182
1183 result = ib_ucm_alloc_data(&param.info, cmd.info, cmd.info_len);
1184 if (result)
1185 goto done;
1186
1187 param.qp_num = cmd.qpn;
1188 param.qkey = cmd.qkey;
1189 param.status = cmd.status;
1190 param.info_length = cmd.info_len;
1191 param.private_data_len = cmd.data_len;
1192
1193 ctx = ib_ucm_ctx_get(cmd.id);
1194 if (!ctx) {
1195 result = -ENOENT;
1196 goto done;
1197 }
1198
1199 down(&ctx->file->mutex);
1200 if (ctx->file != file)
1201 result = -EINVAL;
1202 else
1203 result = ib_send_cm_sidr_rep(ctx->cm_id, &param);
1204
1205 up(&ctx->file->mutex);
1206 ib_ucm_ctx_put(ctx); /* func reference */
1207done:
1208 kfree(param.private_data);
1209 kfree(param.info);
1210
1211 return result;
1212}
1213
1214static ssize_t (*ucm_cmd_table[])(struct ib_ucm_file *file,
1215 const char __user *inbuf,
1216 int in_len, int out_len) = {
1217 [IB_USER_CM_CMD_CREATE_ID] = ib_ucm_create_id,
1218 [IB_USER_CM_CMD_DESTROY_ID] = ib_ucm_destroy_id,
1219 [IB_USER_CM_CMD_ATTR_ID] = ib_ucm_attr_id,
1220 [IB_USER_CM_CMD_LISTEN] = ib_ucm_listen,
1221 [IB_USER_CM_CMD_ESTABLISH] = ib_ucm_establish,
1222 [IB_USER_CM_CMD_SEND_REQ] = ib_ucm_send_req,
1223 [IB_USER_CM_CMD_SEND_REP] = ib_ucm_send_rep,
1224 [IB_USER_CM_CMD_SEND_RTU] = ib_ucm_send_rtu,
1225 [IB_USER_CM_CMD_SEND_DREQ] = ib_ucm_send_dreq,
1226 [IB_USER_CM_CMD_SEND_DREP] = ib_ucm_send_drep,
1227 [IB_USER_CM_CMD_SEND_REJ] = ib_ucm_send_rej,
1228 [IB_USER_CM_CMD_SEND_MRA] = ib_ucm_send_mra,
1229 [IB_USER_CM_CMD_SEND_LAP] = ib_ucm_send_lap,
1230 [IB_USER_CM_CMD_SEND_APR] = ib_ucm_send_apr,
1231 [IB_USER_CM_CMD_SEND_SIDR_REQ] = ib_ucm_send_sidr_req,
1232 [IB_USER_CM_CMD_SEND_SIDR_REP] = ib_ucm_send_sidr_rep,
1233 [IB_USER_CM_CMD_EVENT] = ib_ucm_event,
1234};
1235
1236static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,
1237 size_t len, loff_t *pos)
1238{
1239 struct ib_ucm_file *file = filp->private_data;
1240 struct ib_ucm_cmd_hdr hdr;
1241 ssize_t result;
1242
1243 if (len < sizeof(hdr))
1244 return -EINVAL;
1245
1246 if (copy_from_user(&hdr, buf, sizeof(hdr)))
1247 return -EFAULT;
1248
1249 ucm_dbg("Write. cmd <%d> in <%d> out <%d> len <%Zu>\n",
1250 hdr.cmd, hdr.in, hdr.out, len);
1251
1252 if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
1253 return -EINVAL;
1254
1255 if (hdr.in + sizeof(hdr) > len)
1256 return -EINVAL;
1257
1258 result = ucm_cmd_table[hdr.cmd](file, buf + sizeof(hdr),
1259 hdr.in, hdr.out);
1260 if (!result)
1261 result = len;
1262
1263 return result;
1264}
1265
1266static unsigned int ib_ucm_poll(struct file *filp,
1267 struct poll_table_struct *wait)
1268{
1269 struct ib_ucm_file *file = filp->private_data;
1270 unsigned int mask = 0;
1271
1272 poll_wait(filp, &file->poll_wait, wait);
1273
1274 if (!list_empty(&file->events))
1275 mask = POLLIN | POLLRDNORM;
1276
1277 return mask;
1278}
1279
1280static int ib_ucm_open(struct inode *inode, struct file *filp)
1281{
1282 struct ib_ucm_file *file;
1283
1284 file = kmalloc(sizeof(*file), GFP_KERNEL);
1285 if (!file)
1286 return -ENOMEM;
1287
1288 INIT_LIST_HEAD(&file->events);
1289 INIT_LIST_HEAD(&file->ctxs);
1290 init_waitqueue_head(&file->poll_wait);
1291
1292 init_MUTEX(&file->mutex);
1293
1294 filp->private_data = file;
1295 file->filp = filp;
1296
1297 ucm_dbg("Created struct\n");
1298
1299 return 0;
1300}
1301
1302static int ib_ucm_close(struct inode *inode, struct file *filp)
1303{
1304 struct ib_ucm_file *file = filp->private_data;
1305 struct ib_ucm_context *ctx;
1306
1307 down(&file->mutex);
1308
1309 while (!list_empty(&file->ctxs)) {
1310
1311 ctx = list_entry(file->ctxs.next,
1312 struct ib_ucm_context, file_list);
1313
1314 up(&ctx->file->mutex);
1315 ib_ucm_ctx_put(ctx); /* user reference */
1316 down(&file->mutex);
1317 }
1318
1319 up(&file->mutex);
1320
1321 kfree(file);
1322
1323 ucm_dbg("Deleted struct\n");
1324 return 0;
1325}
1326
1327static struct file_operations ib_ucm_fops = {
1328 .owner = THIS_MODULE,
1329 .open = ib_ucm_open,
1330 .release = ib_ucm_close,
1331 .write = ib_ucm_write,
1332 .poll = ib_ucm_poll,
1333};
1334
1335
1336static struct class *ib_ucm_class;
1337static struct cdev ib_ucm_cdev;
1338
1339static int __init ib_ucm_init(void)
1340{
1341 int result;
1342
1343 result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm");
1344 if (result) {
1345 ucm_dbg("Error <%d> registering dev\n", result);
1346 goto err_chr;
1347 }
1348
1349 cdev_init(&ib_ucm_cdev, &ib_ucm_fops);
1350
1351 result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1);
1352 if (result) {
1353 ucm_dbg("Error <%d> adding cdev\n", result);
1354 goto err_cdev;
1355 }
1356
1357 ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm");
1358 if (IS_ERR(ib_ucm_class)) {
1359 result = PTR_ERR(ib_ucm_class);
1360 ucm_dbg("Error <%d> creating class\n", result);
1361 goto err_class;
1362 }
1363
1364 class_device_create(ib_ucm_class, IB_UCM_DEV, NULL, "ucm");
1365
1366 idr_init(&ctx_id_table);
1367 init_MUTEX(&ctx_id_mutex);
1368
1369 return 0;
1370err_class:
1371 cdev_del(&ib_ucm_cdev);
1372err_cdev:
1373 unregister_chrdev_region(IB_UCM_DEV, 1);
1374err_chr:
1375 return result;
1376}
1377
1378static void __exit ib_ucm_cleanup(void)
1379{
1380 class_device_destroy(ib_ucm_class, IB_UCM_DEV);
1381 class_destroy(ib_ucm_class);
1382 cdev_del(&ib_ucm_cdev);
1383 unregister_chrdev_region(IB_UCM_DEV, 1);
1384}
1385
1386module_init(ib_ucm_init);
1387module_exit(ib_ucm_cleanup);
diff --git a/drivers/infiniband/core/ucm.h b/drivers/infiniband/core/ucm.h
new file mode 100644
index 000000000000..6d36606151b2
--- /dev/null
+++ b/drivers/infiniband/core/ucm.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: ucm.h 2208 2005-04-22 23:24:31Z libor $
33 */
34
35#ifndef UCM_H
36#define UCM_H
37
38#include <linux/fs.h>
39#include <linux/device.h>
40#include <linux/cdev.h>
41#include <linux/idr.h>
42
43#include <ib_cm.h>
44#include <ib_user_cm.h>
45
46#define IB_UCM_CM_ID_INVALID 0xffffffff
47
48struct ib_ucm_file {
49 struct semaphore mutex;
50 struct file *filp;
51 /*
52 * list of pending events
53 */
54 struct list_head ctxs; /* list of active connections */
55 struct list_head events; /* list of pending events */
56 wait_queue_head_t poll_wait;
57};
58
59struct ib_ucm_context {
60 int id;
61 int ref;
62 int error;
63
64 struct ib_ucm_file *file;
65 struct ib_cm_id *cm_id;
66 struct semaphore mutex;
67
68 struct list_head events; /* list of pending events. */
69 struct list_head file_list; /* member in file ctx list */
70};
71
72struct ib_ucm_event {
73 struct ib_ucm_context *ctx;
74 struct list_head file_list; /* member in file event list */
75 struct list_head ctx_list; /* member in ctx event list */
76
77 struct ib_ucm_event_resp resp;
78 void *data;
79 void *info;
80 int data_len;
81 int info_len;
82 /*
83 * new connection identifiers needs to be saved until
84 * userspace can get a handle on them.
85 */
86 struct ib_cm_id *cm_id;
87};
88
89#endif /* UCM_H */
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 9d912d6877ff..2e38792df533 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1,5 +1,7 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
3 * 5 *
4 * This software is available to you under a choice of one of two 6 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +31,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 32 * SOFTWARE.
31 * 33 *
32 * $Id: user_mad.c 1389 2004-12-27 22:56:47Z roland $ 34 * $Id: user_mad.c 2814 2005-07-06 19:14:09Z halr $
33 */ 35 */
34 36
35#include <linux/module.h> 37#include <linux/module.h>
@@ -94,10 +96,12 @@ struct ib_umad_file {
94}; 96};
95 97
96struct ib_umad_packet { 98struct ib_umad_packet {
97 struct ib_user_mad mad;
98 struct ib_ah *ah; 99 struct ib_ah *ah;
100 struct ib_mad_send_buf *msg;
99 struct list_head list; 101 struct list_head list;
102 int length;
100 DECLARE_PCI_UNMAP_ADDR(mapping) 103 DECLARE_PCI_UNMAP_ADDR(mapping)
104 struct ib_user_mad mad;
101}; 105};
102 106
103static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); 107static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
@@ -114,10 +118,10 @@ static int queue_packet(struct ib_umad_file *file,
114 int ret = 1; 118 int ret = 1;
115 119
116 down_read(&file->agent_mutex); 120 down_read(&file->agent_mutex);
117 for (packet->mad.id = 0; 121 for (packet->mad.hdr.id = 0;
118 packet->mad.id < IB_UMAD_MAX_AGENTS; 122 packet->mad.hdr.id < IB_UMAD_MAX_AGENTS;
119 packet->mad.id++) 123 packet->mad.hdr.id++)
120 if (agent == file->agent[packet->mad.id]) { 124 if (agent == file->agent[packet->mad.hdr.id]) {
121 spin_lock_irq(&file->recv_lock); 125 spin_lock_irq(&file->recv_lock);
122 list_add_tail(&packet->list, &file->recv_list); 126 list_add_tail(&packet->list, &file->recv_list);
123 spin_unlock_irq(&file->recv_lock); 127 spin_unlock_irq(&file->recv_lock);
@@ -135,22 +139,30 @@ static void send_handler(struct ib_mad_agent *agent,
135 struct ib_mad_send_wc *send_wc) 139 struct ib_mad_send_wc *send_wc)
136{ 140{
137 struct ib_umad_file *file = agent->context; 141 struct ib_umad_file *file = agent->context;
138 struct ib_umad_packet *packet = 142 struct ib_umad_packet *timeout, *packet =
139 (void *) (unsigned long) send_wc->wr_id; 143 (void *) (unsigned long) send_wc->wr_id;
140 144
141 dma_unmap_single(agent->device->dma_device, 145 ib_destroy_ah(packet->msg->send_wr.wr.ud.ah);
142 pci_unmap_addr(packet, mapping), 146 ib_free_send_mad(packet->msg);
143 sizeof packet->mad.data,
144 DMA_TO_DEVICE);
145 ib_destroy_ah(packet->ah);
146 147
147 if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) { 148 if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) {
148 packet->mad.status = ETIMEDOUT; 149 timeout = kmalloc(sizeof *timeout + sizeof (struct ib_mad_hdr),
150 GFP_KERNEL);
151 if (!timeout)
152 goto out;
149 153
150 if (!queue_packet(file, agent, packet)) 154 memset(timeout, 0, sizeof *timeout + sizeof (struct ib_mad_hdr));
151 return;
152 }
153 155
156 timeout->length = sizeof (struct ib_mad_hdr);
157 timeout->mad.hdr.id = packet->mad.hdr.id;
158 timeout->mad.hdr.status = ETIMEDOUT;
159 memcpy(timeout->mad.data, packet->mad.data,
160 sizeof (struct ib_mad_hdr));
161
162 if (!queue_packet(file, agent, timeout))
163 return;
164 }
165out:
154 kfree(packet); 166 kfree(packet);
155} 167}
156 168
@@ -159,30 +171,35 @@ static void recv_handler(struct ib_mad_agent *agent,
159{ 171{
160 struct ib_umad_file *file = agent->context; 172 struct ib_umad_file *file = agent->context;
161 struct ib_umad_packet *packet; 173 struct ib_umad_packet *packet;
174 int length;
162 175
163 if (mad_recv_wc->wc->status != IB_WC_SUCCESS) 176 if (mad_recv_wc->wc->status != IB_WC_SUCCESS)
164 goto out; 177 goto out;
165 178
166 packet = kmalloc(sizeof *packet, GFP_KERNEL); 179 length = mad_recv_wc->mad_len;
180 packet = kmalloc(sizeof *packet + length, GFP_KERNEL);
167 if (!packet) 181 if (!packet)
168 goto out; 182 goto out;
169 183
170 memset(packet, 0, sizeof *packet); 184 memset(packet, 0, sizeof *packet + length);
185 packet->length = length;
186
187 ib_coalesce_recv_mad(mad_recv_wc, packet->mad.data);
171 188
172 memcpy(packet->mad.data, mad_recv_wc->recv_buf.mad, sizeof packet->mad.data); 189 packet->mad.hdr.status = 0;
173 packet->mad.status = 0; 190 packet->mad.hdr.length = length + sizeof (struct ib_user_mad);
174 packet->mad.qpn = cpu_to_be32(mad_recv_wc->wc->src_qp); 191 packet->mad.hdr.qpn = cpu_to_be32(mad_recv_wc->wc->src_qp);
175 packet->mad.lid = cpu_to_be16(mad_recv_wc->wc->slid); 192 packet->mad.hdr.lid = cpu_to_be16(mad_recv_wc->wc->slid);
176 packet->mad.sl = mad_recv_wc->wc->sl; 193 packet->mad.hdr.sl = mad_recv_wc->wc->sl;
177 packet->mad.path_bits = mad_recv_wc->wc->dlid_path_bits; 194 packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits;
178 packet->mad.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); 195 packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH);
179 if (packet->mad.grh_present) { 196 if (packet->mad.hdr.grh_present) {
180 /* XXX parse GRH */ 197 /* XXX parse GRH */
181 packet->mad.gid_index = 0; 198 packet->mad.hdr.gid_index = 0;
182 packet->mad.hop_limit = 0; 199 packet->mad.hdr.hop_limit = 0;
183 packet->mad.traffic_class = 0; 200 packet->mad.hdr.traffic_class = 0;
184 memset(packet->mad.gid, 0, 16); 201 memset(packet->mad.hdr.gid, 0, 16);
185 packet->mad.flow_label = 0; 202 packet->mad.hdr.flow_label = 0;
186 } 203 }
187 204
188 if (queue_packet(file, agent, packet)) 205 if (queue_packet(file, agent, packet))
@@ -199,7 +216,7 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
199 struct ib_umad_packet *packet; 216 struct ib_umad_packet *packet;
200 ssize_t ret; 217 ssize_t ret;
201 218
202 if (count < sizeof (struct ib_user_mad)) 219 if (count < sizeof (struct ib_user_mad) + sizeof (struct ib_mad))
203 return -EINVAL; 220 return -EINVAL;
204 221
205 spin_lock_irq(&file->recv_lock); 222 spin_lock_irq(&file->recv_lock);
@@ -222,12 +239,25 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
222 239
223 spin_unlock_irq(&file->recv_lock); 240 spin_unlock_irq(&file->recv_lock);
224 241
225 if (copy_to_user(buf, &packet->mad, sizeof packet->mad)) 242 if (count < packet->length + sizeof (struct ib_user_mad)) {
243 /* Return length needed (and first RMPP segment) if too small */
244 if (copy_to_user(buf, &packet->mad,
245 sizeof (struct ib_user_mad) + sizeof (struct ib_mad)))
246 ret = -EFAULT;
247 else
248 ret = -ENOSPC;
249 } else if (copy_to_user(buf, &packet->mad,
250 packet->length + sizeof (struct ib_user_mad)))
226 ret = -EFAULT; 251 ret = -EFAULT;
227 else 252 else
228 ret = sizeof packet->mad; 253 ret = packet->length + sizeof (struct ib_user_mad);
229 254 if (ret < 0) {
230 kfree(packet); 255 /* Requeue packet */
256 spin_lock_irq(&file->recv_lock);
257 list_add(&packet->list, &file->recv_list);
258 spin_unlock_irq(&file->recv_lock);
259 } else
260 kfree(packet);
231 return ret; 261 return ret;
232} 262}
233 263
@@ -238,69 +268,57 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
238 struct ib_umad_packet *packet; 268 struct ib_umad_packet *packet;
239 struct ib_mad_agent *agent; 269 struct ib_mad_agent *agent;
240 struct ib_ah_attr ah_attr; 270 struct ib_ah_attr ah_attr;
241 struct ib_sge gather_list; 271 struct ib_send_wr *bad_wr;
242 struct ib_send_wr *bad_wr, wr = { 272 struct ib_rmpp_mad *rmpp_mad;
243 .opcode = IB_WR_SEND,
244 .sg_list = &gather_list,
245 .num_sge = 1,
246 .send_flags = IB_SEND_SIGNALED,
247 };
248 u8 method; 273 u8 method;
249 u64 *tid; 274 u64 *tid;
250 int ret; 275 int ret, length, hdr_len, data_len, rmpp_hdr_size;
276 int rmpp_active = 0;
251 277
252 if (count < sizeof (struct ib_user_mad)) 278 if (count < sizeof (struct ib_user_mad))
253 return -EINVAL; 279 return -EINVAL;
254 280
255 packet = kmalloc(sizeof *packet, GFP_KERNEL); 281 length = count - sizeof (struct ib_user_mad);
282 packet = kmalloc(sizeof *packet + sizeof(struct ib_mad_hdr) +
283 sizeof(struct ib_rmpp_hdr), GFP_KERNEL);
256 if (!packet) 284 if (!packet)
257 return -ENOMEM; 285 return -ENOMEM;
258 286
259 if (copy_from_user(&packet->mad, buf, sizeof packet->mad)) { 287 if (copy_from_user(&packet->mad, buf,
260 kfree(packet); 288 sizeof (struct ib_user_mad) +
261 return -EFAULT; 289 sizeof(struct ib_mad_hdr) +
290 sizeof(struct ib_rmpp_hdr))) {
291 ret = -EFAULT;
292 goto err;
262 } 293 }
263 294
264 if (packet->mad.id < 0 || packet->mad.id >= IB_UMAD_MAX_AGENTS) { 295 if (packet->mad.hdr.id < 0 ||
296 packet->mad.hdr.id >= IB_UMAD_MAX_AGENTS) {
265 ret = -EINVAL; 297 ret = -EINVAL;
266 goto err; 298 goto err;
267 } 299 }
268 300
301 packet->length = length;
302
269 down_read(&file->agent_mutex); 303 down_read(&file->agent_mutex);
270 304
271 agent = file->agent[packet->mad.id]; 305 agent = file->agent[packet->mad.hdr.id];
272 if (!agent) { 306 if (!agent) {
273 ret = -EINVAL; 307 ret = -EINVAL;
274 goto err_up; 308 goto err_up;
275 } 309 }
276 310
277 /*
278 * If userspace is generating a request that will generate a
279 * response, we need to make sure the high-order part of the
280 * transaction ID matches the agent being used to send the
281 * MAD.
282 */
283 method = ((struct ib_mad_hdr *) packet->mad.data)->method;
284
285 if (!(method & IB_MGMT_METHOD_RESP) &&
286 method != IB_MGMT_METHOD_TRAP_REPRESS &&
287 method != IB_MGMT_METHOD_SEND) {
288 tid = &((struct ib_mad_hdr *) packet->mad.data)->tid;
289 *tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
290 (be64_to_cpup(tid) & 0xffffffff));
291 }
292
293 memset(&ah_attr, 0, sizeof ah_attr); 311 memset(&ah_attr, 0, sizeof ah_attr);
294 ah_attr.dlid = be16_to_cpu(packet->mad.lid); 312 ah_attr.dlid = be16_to_cpu(packet->mad.hdr.lid);
295 ah_attr.sl = packet->mad.sl; 313 ah_attr.sl = packet->mad.hdr.sl;
296 ah_attr.src_path_bits = packet->mad.path_bits; 314 ah_attr.src_path_bits = packet->mad.hdr.path_bits;
297 ah_attr.port_num = file->port->port_num; 315 ah_attr.port_num = file->port->port_num;
298 if (packet->mad.grh_present) { 316 if (packet->mad.hdr.grh_present) {
299 ah_attr.ah_flags = IB_AH_GRH; 317 ah_attr.ah_flags = IB_AH_GRH;
300 memcpy(ah_attr.grh.dgid.raw, packet->mad.gid, 16); 318 memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16);
301 ah_attr.grh.flow_label = packet->mad.flow_label; 319 ah_attr.grh.flow_label = packet->mad.hdr.flow_label;
302 ah_attr.grh.hop_limit = packet->mad.hop_limit; 320 ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit;
303 ah_attr.grh.traffic_class = packet->mad.traffic_class; 321 ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class;
304 } 322 }
305 323
306 packet->ah = ib_create_ah(agent->qp->pd, &ah_attr); 324 packet->ah = ib_create_ah(agent->qp->pd, &ah_attr);
@@ -309,34 +327,104 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
309 goto err_up; 327 goto err_up;
310 } 328 }
311 329
312 gather_list.addr = dma_map_single(agent->device->dma_device, 330 rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
313 packet->mad.data, 331 if (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE) {
314 sizeof packet->mad.data, 332 /* RMPP active */
315 DMA_TO_DEVICE); 333 if (!agent->rmpp_version) {
316 gather_list.length = sizeof packet->mad.data; 334 ret = -EINVAL;
317 gather_list.lkey = file->mr[packet->mad.id]->lkey; 335 goto err_ah;
318 pci_unmap_addr_set(packet, mapping, gather_list.addr); 336 }
337 /* Validate that management class can support RMPP */
338 if (rmpp_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_ADM) {
339 hdr_len = offsetof(struct ib_sa_mad, data);
340 data_len = length;
341 } else if ((rmpp_mad->mad_hdr.mgmt_class >= IB_MGMT_CLASS_VENDOR_RANGE2_START) &&
342 (rmpp_mad->mad_hdr.mgmt_class <= IB_MGMT_CLASS_VENDOR_RANGE2_END)) {
343 hdr_len = offsetof(struct ib_vendor_mad, data);
344 data_len = length - hdr_len;
345 } else {
346 ret = -EINVAL;
347 goto err_ah;
348 }
349 rmpp_active = 1;
350 } else {
351 if (length > sizeof(struct ib_mad)) {
352 ret = -EINVAL;
353 goto err_ah;
354 }
355 hdr_len = offsetof(struct ib_mad, data);
356 data_len = length - hdr_len;
357 }
358
359 packet->msg = ib_create_send_mad(agent,
360 be32_to_cpu(packet->mad.hdr.qpn),
361 0, packet->ah, rmpp_active,
362 hdr_len, data_len,
363 GFP_KERNEL);
364 if (IS_ERR(packet->msg)) {
365 ret = PTR_ERR(packet->msg);
366 goto err_ah;
367 }
319 368
320 wr.wr.ud.mad_hdr = (struct ib_mad_hdr *) packet->mad.data; 369 packet->msg->send_wr.wr.ud.timeout_ms = packet->mad.hdr.timeout_ms;
321 wr.wr.ud.ah = packet->ah; 370 packet->msg->send_wr.wr.ud.retries = packet->mad.hdr.retries;
322 wr.wr.ud.remote_qpn = be32_to_cpu(packet->mad.qpn);
323 wr.wr.ud.remote_qkey = be32_to_cpu(packet->mad.qkey);
324 wr.wr.ud.timeout_ms = packet->mad.timeout_ms;
325 371
326 wr.wr_id = (unsigned long) packet; 372 /* Override send WR WRID initialized in ib_create_send_mad */
373 packet->msg->send_wr.wr_id = (unsigned long) packet;
327 374
328 ret = ib_post_send_mad(agent, &wr, &bad_wr); 375 if (!rmpp_active) {
329 if (ret) { 376 /* Copy message from user into send buffer */
330 dma_unmap_single(agent->device->dma_device, 377 if (copy_from_user(packet->msg->mad,
331 pci_unmap_addr(packet, mapping), 378 buf + sizeof(struct ib_user_mad), length)) {
332 sizeof packet->mad.data, 379 ret = -EFAULT;
333 DMA_TO_DEVICE); 380 goto err_msg;
334 goto err_up; 381 }
382 } else {
383 rmpp_hdr_size = sizeof(struct ib_mad_hdr) +
384 sizeof(struct ib_rmpp_hdr);
385
386 /* Only copy MAD headers (RMPP header in place) */
387 memcpy(packet->msg->mad, packet->mad.data,
388 sizeof(struct ib_mad_hdr));
389
390 /* Now, copy rest of message from user into send buffer */
391 if (copy_from_user(((struct ib_rmpp_mad *) packet->msg->mad)->data,
392 buf + sizeof (struct ib_user_mad) + rmpp_hdr_size,
393 length - rmpp_hdr_size)) {
394 ret = -EFAULT;
395 goto err_msg;
396 }
397 }
398
399 /*
400 * If userspace is generating a request that will generate a
401 * response, we need to make sure the high-order part of the
402 * transaction ID matches the agent being used to send the
403 * MAD.
404 */
405 method = packet->msg->mad->mad_hdr.method;
406
407 if (!(method & IB_MGMT_METHOD_RESP) &&
408 method != IB_MGMT_METHOD_TRAP_REPRESS &&
409 method != IB_MGMT_METHOD_SEND) {
410 tid = &packet->msg->mad->mad_hdr.tid;
411 *tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
412 (be64_to_cpup(tid) & 0xffffffff));
335 } 413 }
336 414
415 ret = ib_post_send_mad(agent, &packet->msg->send_wr, &bad_wr);
416 if (ret)
417 goto err_msg;
418
337 up_read(&file->agent_mutex); 419 up_read(&file->agent_mutex);
338 420
339 return sizeof packet->mad; 421 return sizeof (struct ib_user_mad_hdr) + packet->length;
422
423err_msg:
424 ib_free_send_mad(packet->msg);
425
426err_ah:
427 ib_destroy_ah(packet->ah);
340 428
341err_up: 429err_up:
342 up_read(&file->agent_mutex); 430 up_read(&file->agent_mutex);
@@ -399,7 +487,8 @@ found:
399 agent = ib_register_mad_agent(file->port->ib_dev, file->port->port_num, 487 agent = ib_register_mad_agent(file->port->ib_dev, file->port->port_num,
400 ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI, 488 ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI,
401 ureq.mgmt_class ? &req : NULL, 489 ureq.mgmt_class ? &req : NULL,
402 0, send_handler, recv_handler, file); 490 ureq.rmpp_version,
491 send_handler, recv_handler, file);
403 if (IS_ERR(agent)) { 492 if (IS_ERR(agent)) {
404 ret = PTR_ERR(agent); 493 ret = PTR_ERR(agent);
405 goto out; 494 goto out;
@@ -460,8 +549,8 @@ out:
460 return ret; 549 return ret;
461} 550}
462 551
463static long ib_umad_ioctl(struct file *filp, 552static long ib_umad_ioctl(struct file *filp, unsigned int cmd,
464 unsigned int cmd, unsigned long arg) 553 unsigned long arg)
465{ 554{
466 switch (cmd) { 555 switch (cmd) {
467 case IB_USER_MAD_REGISTER_AGENT: 556 case IB_USER_MAD_REGISTER_AGENT:
@@ -517,14 +606,14 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
517} 606}
518 607
519static struct file_operations umad_fops = { 608static struct file_operations umad_fops = {
520 .owner = THIS_MODULE, 609 .owner = THIS_MODULE,
521 .read = ib_umad_read, 610 .read = ib_umad_read,
522 .write = ib_umad_write, 611 .write = ib_umad_write,
523 .poll = ib_umad_poll, 612 .poll = ib_umad_poll,
524 .unlocked_ioctl = ib_umad_ioctl, 613 .unlocked_ioctl = ib_umad_ioctl,
525 .compat_ioctl = ib_umad_ioctl, 614 .compat_ioctl = ib_umad_ioctl,
526 .open = ib_umad_open, 615 .open = ib_umad_open,
527 .release = ib_umad_close 616 .release = ib_umad_close
528}; 617};
529 618
530static int ib_umad_sm_open(struct inode *inode, struct file *filp) 619static int ib_umad_sm_open(struct inode *inode, struct file *filp)
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 57347f1e82c1..7696022f9a4e 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -61,6 +61,7 @@ struct ib_uverbs_event_file {
61 int fd; 61 int fd;
62 int is_async; 62 int is_async;
63 wait_queue_head_t poll_wait; 63 wait_queue_head_t poll_wait;
64 struct fasync_struct *async_queue;
64 struct list_head event_list; 65 struct list_head event_list;
65}; 66};
66 67
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index fbbe03d8c901..eb99e693dec2 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -257,11 +257,19 @@ static void ib_uverbs_event_release(struct ib_uverbs_event_file *file)
257 spin_unlock_irq(&file->lock); 257 spin_unlock_irq(&file->lock);
258} 258}
259 259
260static int ib_uverbs_event_fasync(int fd, struct file *filp, int on)
261{
262 struct ib_uverbs_event_file *file = filp->private_data;
263
264 return fasync_helper(fd, filp, on, &file->async_queue);
265}
266
260static int ib_uverbs_event_close(struct inode *inode, struct file *filp) 267static int ib_uverbs_event_close(struct inode *inode, struct file *filp)
261{ 268{
262 struct ib_uverbs_event_file *file = filp->private_data; 269 struct ib_uverbs_event_file *file = filp->private_data;
263 270
264 ib_uverbs_event_release(file); 271 ib_uverbs_event_release(file);
272 ib_uverbs_event_fasync(-1, filp, 0);
265 kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); 273 kref_put(&file->uverbs_file->ref, ib_uverbs_release_file);
266 274
267 return 0; 275 return 0;
@@ -276,7 +284,8 @@ static struct file_operations uverbs_event_fops = {
276 */ 284 */
277 .read = ib_uverbs_event_read, 285 .read = ib_uverbs_event_read,
278 .poll = ib_uverbs_event_poll, 286 .poll = ib_uverbs_event_poll,
279 .release = ib_uverbs_event_close 287 .release = ib_uverbs_event_close,
288 .fasync = ib_uverbs_event_fasync
280}; 289};
281 290
282void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) 291void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
@@ -296,6 +305,7 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
296 spin_unlock_irqrestore(&file->comp_file[0].lock, flags); 305 spin_unlock_irqrestore(&file->comp_file[0].lock, flags);
297 306
298 wake_up_interruptible(&file->comp_file[0].poll_wait); 307 wake_up_interruptible(&file->comp_file[0].poll_wait);
308 kill_fasync(&file->comp_file[0].async_queue, SIGIO, POLL_IN);
299} 309}
300 310
301static void ib_uverbs_async_handler(struct ib_uverbs_file *file, 311static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
@@ -316,6 +326,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
316 spin_unlock_irqrestore(&file->async_file.lock, flags); 326 spin_unlock_irqrestore(&file->async_file.lock, flags);
317 327
318 wake_up_interruptible(&file->async_file.poll_wait); 328 wake_up_interruptible(&file->async_file.poll_wait);
329 kill_fasync(&file->async_file.async_queue, SIGIO, POLL_IN);
319} 330}
320 331
321void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr) 332void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr)
@@ -350,6 +361,7 @@ static int ib_uverbs_event_init(struct ib_uverbs_event_file *file,
350 INIT_LIST_HEAD(&file->event_list); 361 INIT_LIST_HEAD(&file->event_list);
351 init_waitqueue_head(&file->poll_wait); 362 init_waitqueue_head(&file->poll_wait);
352 file->uverbs_file = uverbs_file; 363 file->uverbs_file = uverbs_file;
364 file->async_queue = NULL;
353 365
354 file->fd = get_unused_fd(); 366 file->fd = get_unused_fd();
355 if (file->fd < 0) 367 if (file->fd < 0)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 2516f9646515..506fdf1f2a26 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -41,6 +41,7 @@
41#include <linux/err.h> 41#include <linux/err.h>
42 42
43#include <ib_verbs.h> 43#include <ib_verbs.h>
44#include <ib_cache.h>
44 45
45/* Protection domains */ 46/* Protection domains */
46 47
@@ -88,6 +89,40 @@ struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
88} 89}
89EXPORT_SYMBOL(ib_create_ah); 90EXPORT_SYMBOL(ib_create_ah);
90 91
92struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc,
93 struct ib_grh *grh, u8 port_num)
94{
95 struct ib_ah_attr ah_attr;
96 u32 flow_class;
97 u16 gid_index;
98 int ret;
99
100 memset(&ah_attr, 0, sizeof ah_attr);
101 ah_attr.dlid = wc->slid;
102 ah_attr.sl = wc->sl;
103 ah_attr.src_path_bits = wc->dlid_path_bits;
104 ah_attr.port_num = port_num;
105
106 if (wc->wc_flags & IB_WC_GRH) {
107 ah_attr.ah_flags = IB_AH_GRH;
108 ah_attr.grh.dgid = grh->dgid;
109
110 ret = ib_find_cached_gid(pd->device, &grh->sgid, &port_num,
111 &gid_index);
112 if (ret)
113 return ERR_PTR(ret);
114
115 ah_attr.grh.sgid_index = (u8) gid_index;
116 flow_class = be32_to_cpu(grh->version_tclass_flow);
117 ah_attr.grh.flow_label = flow_class & 0xFFFFF;
118 ah_attr.grh.traffic_class = (flow_class >> 20) & 0xFF;
119 ah_attr.grh.hop_limit = grh->hop_limit;
120 }
121
122 return ib_create_ah(pd, &ah_attr);
123}
124EXPORT_SYMBOL(ib_create_ah_from_wc);
125
91int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) 126int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
92{ 127{
93 return ah->device->modify_ah ? 128 return ah->device->modify_ah ?
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index b5aea7b869f6..5687c3014522 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -373,8 +373,12 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
373 * If we're at the end of the WQE chain, or we've used up our 373 * If we're at the end of the WQE chain, or we've used up our
374 * doorbell count, free the CQE. Otherwise just update it for 374 * doorbell count, free the CQE. Otherwise just update it for
375 * the next poll operation. 375 * the next poll operation.
376 *
377 * This does not apply to mem-free HCAs: they don't use the
378 * doorbell count field, and so we should always free the CQE.
376 */ 379 */
377 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 380 if (mthca_is_memfree(dev) ||
381 !(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
378 return 0; 382 return 0;
379 383
380 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); 384 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd);
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 7a58ce90e179..81919a7b4935 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -349,9 +349,9 @@ static int mthca_mmap_uar(struct ib_ucontext *context,
349 349
350 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 350 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
351 351
352 if (remap_pfn_range(vma, vma->vm_start, 352 if (io_remap_pfn_range(vma, vma->vm_start,
353 to_mucontext(context)->uar.pfn, 353 to_mucontext(context)->uar.pfn,
354 PAGE_SIZE, vma->vm_page_prot)) 354 PAGE_SIZE, vma->vm_page_prot))
355 return -EAGAIN; 355 return -EAGAIN;
356 356
357 return 0; 357 return 0;
diff --git a/drivers/infiniband/include/ib_cm.h b/drivers/infiniband/include/ib_cm.h
new file mode 100644
index 000000000000..da650115e79a
--- /dev/null
+++ b/drivers/infiniband/include/ib_cm.h
@@ -0,0 +1,569 @@
1/*
2 * Copyright (c) 2004 Intel Corporation. All rights reserved.
3 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
4 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
5 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
20 *
21 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
34 *
35 * $Id: ib_cm.h 2730 2005-06-28 16:43:03Z sean.hefty $
36 */
37#if !defined(IB_CM_H)
38#define IB_CM_H
39
40#include <ib_mad.h>
41#include <ib_sa.h>
42
43enum ib_cm_state {
44 IB_CM_IDLE,
45 IB_CM_LISTEN,
46 IB_CM_REQ_SENT,
47 IB_CM_REQ_RCVD,
48 IB_CM_MRA_REQ_SENT,
49 IB_CM_MRA_REQ_RCVD,
50 IB_CM_REP_SENT,
51 IB_CM_REP_RCVD,
52 IB_CM_MRA_REP_SENT,
53 IB_CM_MRA_REP_RCVD,
54 IB_CM_ESTABLISHED,
55 IB_CM_DREQ_SENT,
56 IB_CM_DREQ_RCVD,
57 IB_CM_TIMEWAIT,
58 IB_CM_SIDR_REQ_SENT,
59 IB_CM_SIDR_REQ_RCVD
60};
61
62enum ib_cm_lap_state {
63 IB_CM_LAP_IDLE,
64 IB_CM_LAP_SENT,
65 IB_CM_LAP_RCVD,
66 IB_CM_MRA_LAP_SENT,
67 IB_CM_MRA_LAP_RCVD,
68};
69
70enum ib_cm_event_type {
71 IB_CM_REQ_ERROR,
72 IB_CM_REQ_RECEIVED,
73 IB_CM_REP_ERROR,
74 IB_CM_REP_RECEIVED,
75 IB_CM_RTU_RECEIVED,
76 IB_CM_USER_ESTABLISHED,
77 IB_CM_DREQ_ERROR,
78 IB_CM_DREQ_RECEIVED,
79 IB_CM_DREP_RECEIVED,
80 IB_CM_TIMEWAIT_EXIT,
81 IB_CM_MRA_RECEIVED,
82 IB_CM_REJ_RECEIVED,
83 IB_CM_LAP_ERROR,
84 IB_CM_LAP_RECEIVED,
85 IB_CM_APR_RECEIVED,
86 IB_CM_SIDR_REQ_ERROR,
87 IB_CM_SIDR_REQ_RECEIVED,
88 IB_CM_SIDR_REP_RECEIVED
89};
90
91enum ib_cm_data_size {
92 IB_CM_REQ_PRIVATE_DATA_SIZE = 92,
93 IB_CM_MRA_PRIVATE_DATA_SIZE = 222,
94 IB_CM_REJ_PRIVATE_DATA_SIZE = 148,
95 IB_CM_REP_PRIVATE_DATA_SIZE = 196,
96 IB_CM_RTU_PRIVATE_DATA_SIZE = 224,
97 IB_CM_DREQ_PRIVATE_DATA_SIZE = 220,
98 IB_CM_DREP_PRIVATE_DATA_SIZE = 224,
99 IB_CM_REJ_ARI_LENGTH = 72,
100 IB_CM_LAP_PRIVATE_DATA_SIZE = 168,
101 IB_CM_APR_PRIVATE_DATA_SIZE = 148,
102 IB_CM_APR_INFO_LENGTH = 72,
103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
105 IB_CM_SIDR_REP_INFO_LENGTH = 72
106};
107
108struct ib_cm_id;
109
110struct ib_cm_req_event_param {
111 struct ib_cm_id *listen_id;
112 struct ib_device *device;
113 u8 port;
114
115 struct ib_sa_path_rec *primary_path;
116 struct ib_sa_path_rec *alternate_path;
117
118 u64 remote_ca_guid;
119 u32 remote_qkey;
120 u32 remote_qpn;
121 enum ib_qp_type qp_type;
122
123 u32 starting_psn;
124 u8 responder_resources;
125 u8 initiator_depth;
126 unsigned int local_cm_response_timeout:5;
127 unsigned int flow_control:1;
128 unsigned int remote_cm_response_timeout:5;
129 unsigned int retry_count:3;
130 unsigned int rnr_retry_count:3;
131 unsigned int srq:1;
132};
133
134struct ib_cm_rep_event_param {
135 u64 remote_ca_guid;
136 u32 remote_qkey;
137 u32 remote_qpn;
138 u32 starting_psn;
139 u8 responder_resources;
140 u8 initiator_depth;
141 unsigned int target_ack_delay:5;
142 unsigned int failover_accepted:2;
143 unsigned int flow_control:1;
144 unsigned int rnr_retry_count:3;
145 unsigned int srq:1;
146};
147
148enum ib_cm_rej_reason {
149 IB_CM_REJ_NO_QP = __constant_htons(1),
150 IB_CM_REJ_NO_EEC = __constant_htons(2),
151 IB_CM_REJ_NO_RESOURCES = __constant_htons(3),
152 IB_CM_REJ_TIMEOUT = __constant_htons(4),
153 IB_CM_REJ_UNSUPPORTED = __constant_htons(5),
154 IB_CM_REJ_INVALID_COMM_ID = __constant_htons(6),
155 IB_CM_REJ_INVALID_COMM_INSTANCE = __constant_htons(7),
156 IB_CM_REJ_INVALID_SERVICE_ID = __constant_htons(8),
157 IB_CM_REJ_INVALID_TRANSPORT_TYPE = __constant_htons(9),
158 IB_CM_REJ_STALE_CONN = __constant_htons(10),
159 IB_CM_REJ_RDC_NOT_EXIST = __constant_htons(11),
160 IB_CM_REJ_INVALID_GID = __constant_htons(12),
161 IB_CM_REJ_INVALID_LID = __constant_htons(13),
162 IB_CM_REJ_INVALID_SL = __constant_htons(14),
163 IB_CM_REJ_INVALID_TRAFFIC_CLASS = __constant_htons(15),
164 IB_CM_REJ_INVALID_HOP_LIMIT = __constant_htons(16),
165 IB_CM_REJ_INVALID_PACKET_RATE = __constant_htons(17),
166 IB_CM_REJ_INVALID_ALT_GID = __constant_htons(18),
167 IB_CM_REJ_INVALID_ALT_LID = __constant_htons(19),
168 IB_CM_REJ_INVALID_ALT_SL = __constant_htons(20),
169 IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = __constant_htons(21),
170 IB_CM_REJ_INVALID_ALT_HOP_LIMIT = __constant_htons(22),
171 IB_CM_REJ_INVALID_ALT_PACKET_RATE = __constant_htons(23),
172 IB_CM_REJ_PORT_CM_REDIRECT = __constant_htons(24),
173 IB_CM_REJ_PORT_REDIRECT = __constant_htons(25),
174 IB_CM_REJ_INVALID_MTU = __constant_htons(26),
175 IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = __constant_htons(27),
176 IB_CM_REJ_CONSUMER_DEFINED = __constant_htons(28),
177 IB_CM_REJ_INVALID_RNR_RETRY = __constant_htons(29),
178 IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = __constant_htons(30),
179 IB_CM_REJ_INVALID_CLASS_VERSION = __constant_htons(31),
180 IB_CM_REJ_INVALID_FLOW_LABEL = __constant_htons(32),
181 IB_CM_REJ_INVALID_ALT_FLOW_LABEL = __constant_htons(33)
182};
183
184struct ib_cm_rej_event_param {
185 enum ib_cm_rej_reason reason;
186 void *ari;
187 u8 ari_length;
188};
189
190struct ib_cm_mra_event_param {
191 u8 service_timeout;
192};
193
194struct ib_cm_lap_event_param {
195 struct ib_sa_path_rec *alternate_path;
196};
197
198enum ib_cm_apr_status {
199 IB_CM_APR_SUCCESS,
200 IB_CM_APR_INVALID_COMM_ID,
201 IB_CM_APR_UNSUPPORTED,
202 IB_CM_APR_REJECT,
203 IB_CM_APR_REDIRECT,
204 IB_CM_APR_IS_CURRENT,
205 IB_CM_APR_INVALID_QPN_EECN,
206 IB_CM_APR_INVALID_LID,
207 IB_CM_APR_INVALID_GID,
208 IB_CM_APR_INVALID_FLOW_LABEL,
209 IB_CM_APR_INVALID_TCLASS,
210 IB_CM_APR_INVALID_HOP_LIMIT,
211 IB_CM_APR_INVALID_PACKET_RATE,
212 IB_CM_APR_INVALID_SL
213};
214
215struct ib_cm_apr_event_param {
216 enum ib_cm_apr_status ap_status;
217 void *apr_info;
218 u8 info_len;
219};
220
221struct ib_cm_sidr_req_event_param {
222 struct ib_cm_id *listen_id;
223 struct ib_device *device;
224 u8 port;
225
226 u16 pkey;
227};
228
229enum ib_cm_sidr_status {
230 IB_SIDR_SUCCESS,
231 IB_SIDR_UNSUPPORTED,
232 IB_SIDR_REJECT,
233 IB_SIDR_NO_QP,
234 IB_SIDR_REDIRECT,
235 IB_SIDR_UNSUPPORTED_VERSION
236};
237
238struct ib_cm_sidr_rep_event_param {
239 enum ib_cm_sidr_status status;
240 u32 qkey;
241 u32 qpn;
242 void *info;
243 u8 info_len;
244
245};
246
247struct ib_cm_event {
248 enum ib_cm_event_type event;
249 union {
250 struct ib_cm_req_event_param req_rcvd;
251 struct ib_cm_rep_event_param rep_rcvd;
252 /* No data for RTU received events. */
253 struct ib_cm_rej_event_param rej_rcvd;
254 struct ib_cm_mra_event_param mra_rcvd;
255 struct ib_cm_lap_event_param lap_rcvd;
256 struct ib_cm_apr_event_param apr_rcvd;
257 /* No data for DREQ/DREP received events. */
258 struct ib_cm_sidr_req_event_param sidr_req_rcvd;
259 struct ib_cm_sidr_rep_event_param sidr_rep_rcvd;
260 enum ib_wc_status send_status;
261 } param;
262
263 void *private_data;
264};
265
266/**
267 * ib_cm_handler - User-defined callback to process communication events.
268 * @cm_id: Communication identifier associated with the reported event.
269 * @event: Information about the communication event.
270 *
271 * IB_CM_REQ_RECEIVED and IB_CM_SIDR_REQ_RECEIVED communication events
272 * generated as a result of listen requests result in the allocation of a
273 * new @cm_id. The new @cm_id is returned to the user through this callback.
274 * Clients are responsible for destroying the new @cm_id. For peer-to-peer
275 * IB_CM_REQ_RECEIVED and all other events, the returned @cm_id corresponds
276 * to a user's existing communication identifier.
277 *
278 * Users may not call ib_destroy_cm_id while in the context of this callback;
279 * however, returning a non-zero value instructs the communication manager to
280 * destroy the @cm_id after the callback completes.
281 */
282typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
283 struct ib_cm_event *event);
284
285struct ib_cm_id {
286 ib_cm_handler cm_handler;
287 void *context;
288 u64 service_id;
289 u64 service_mask;
290 enum ib_cm_state state; /* internal CM/debug use */
291 enum ib_cm_lap_state lap_state; /* internal CM/debug use */
292 u32 local_id;
293 u32 remote_id;
294};
295
296/**
297 * ib_create_cm_id - Allocate a communication identifier.
298 * @cm_handler: Callback invoked to notify the user of CM events.
299 * @context: User specified context associated with the communication
300 * identifier.
301 *
302 * Communication identifiers are used to track connection states, service
303 * ID resolution requests, and listen requests.
304 */
305struct ib_cm_id *ib_create_cm_id(ib_cm_handler cm_handler,
306 void *context);
307
308/**
309 * ib_destroy_cm_id - Destroy a connection identifier.
310 * @cm_id: Connection identifier to destroy.
311 *
312 * This call blocks until the connection identifier is destroyed.
313 */
314void ib_destroy_cm_id(struct ib_cm_id *cm_id);
315
316#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL)
317#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL)
318
319/**
320 * ib_cm_listen - Initiates listening on the specified service ID for
321 * connection and service ID resolution requests.
322 * @cm_id: Connection identifier associated with the listen request.
323 * @service_id: Service identifier matched against incoming connection
324 * and service ID resolution requests. The service ID should be specified
325 * network-byte order. If set to IB_CM_ASSIGN_SERVICE_ID, the CM will
326 * assign a service ID to the caller.
327 * @service_mask: Mask applied to service ID used to listen across a
328 * range of service IDs. If set to 0, the service ID is matched
329 * exactly. This parameter is ignored if %service_id is set to
330 * IB_CM_ASSIGN_SERVICE_ID.
331 */
332int ib_cm_listen(struct ib_cm_id *cm_id,
333 u64 service_id,
334 u64 service_mask);
335
336struct ib_cm_req_param {
337 struct ib_sa_path_rec *primary_path;
338 struct ib_sa_path_rec *alternate_path;
339 u64 service_id;
340 u32 qp_num;
341 enum ib_qp_type qp_type;
342 u32 starting_psn;
343 const void *private_data;
344 u8 private_data_len;
345 u8 peer_to_peer;
346 u8 responder_resources;
347 u8 initiator_depth;
348 u8 remote_cm_response_timeout;
349 u8 flow_control;
350 u8 local_cm_response_timeout;
351 u8 retry_count;
352 u8 rnr_retry_count;
353 u8 max_cm_retries;
354 u8 srq;
355};
356
357/**
358 * ib_send_cm_req - Sends a connection request to the remote node.
359 * @cm_id: Connection identifier that will be associated with the
360 * connection request.
361 * @param: Connection request information needed to establish the
362 * connection.
363 */
364int ib_send_cm_req(struct ib_cm_id *cm_id,
365 struct ib_cm_req_param *param);
366
367struct ib_cm_rep_param {
368 u32 qp_num;
369 u32 starting_psn;
370 const void *private_data;
371 u8 private_data_len;
372 u8 responder_resources;
373 u8 initiator_depth;
374 u8 target_ack_delay;
375 u8 failover_accepted;
376 u8 flow_control;
377 u8 rnr_retry_count;
378 u8 srq;
379};
380
381/**
382 * ib_send_cm_rep - Sends a connection reply in response to a connection
383 * request.
384 * @cm_id: Connection identifier that will be associated with the
385 * connection request.
386 * @param: Connection reply information needed to establish the
387 * connection.
388 */
389int ib_send_cm_rep(struct ib_cm_id *cm_id,
390 struct ib_cm_rep_param *param);
391
392/**
393 * ib_send_cm_rtu - Sends a connection ready to use message in response
394 * to a connection reply message.
395 * @cm_id: Connection identifier associated with the connection request.
396 * @private_data: Optional user-defined private data sent with the
397 * ready to use message.
398 * @private_data_len: Size of the private data buffer, in bytes.
399 */
400int ib_send_cm_rtu(struct ib_cm_id *cm_id,
401 const void *private_data,
402 u8 private_data_len);
403
404/**
405 * ib_send_cm_dreq - Sends a disconnection request for an existing
406 * connection.
407 * @cm_id: Connection identifier associated with the connection being
408 * released.
409 * @private_data: Optional user-defined private data sent with the
410 * disconnection request message.
411 * @private_data_len: Size of the private data buffer, in bytes.
412 */
413int ib_send_cm_dreq(struct ib_cm_id *cm_id,
414 const void *private_data,
415 u8 private_data_len);
416
417/**
418 * ib_send_cm_drep - Sends a disconnection reply to a disconnection request.
419 * @cm_id: Connection identifier associated with the connection being
420 * released.
421 * @private_data: Optional user-defined private data sent with the
422 * disconnection reply message.
423 * @private_data_len: Size of the private data buffer, in bytes.
424 *
425 * If the cm_id is in the correct state, the CM will transition the connection
426 * to the timewait state, even if an error occurs sending the DREP message.
427 */
428int ib_send_cm_drep(struct ib_cm_id *cm_id,
429 const void *private_data,
430 u8 private_data_len);
431
432/**
433 * ib_cm_establish - Forces a connection state to established.
434 * @cm_id: Connection identifier to transition to established.
435 *
436 * This routine should be invoked by users who receive messages on a
437 * connected QP before an RTU has been received.
438 */
439int ib_cm_establish(struct ib_cm_id *cm_id);
440
441/**
442 * ib_send_cm_rej - Sends a connection rejection message to the
443 * remote node.
444 * @cm_id: Connection identifier associated with the connection being
445 * rejected.
446 * @reason: Reason for the connection request rejection.
447 * @ari: Optional additional rejection information.
448 * @ari_length: Size of the additional rejection information, in bytes.
449 * @private_data: Optional user-defined private data sent with the
450 * rejection message.
451 * @private_data_len: Size of the private data buffer, in bytes.
452 */
453int ib_send_cm_rej(struct ib_cm_id *cm_id,
454 enum ib_cm_rej_reason reason,
455 void *ari,
456 u8 ari_length,
457 const void *private_data,
458 u8 private_data_len);
459
460/**
461 * ib_send_cm_mra - Sends a message receipt acknowledgement to a connection
462 * message.
463 * @cm_id: Connection identifier associated with the connection message.
464 * @service_timeout: The maximum time required for the sender to reply to
465 * to the connection message.
466 * @private_data: Optional user-defined private data sent with the
467 * message receipt acknowledgement.
468 * @private_data_len: Size of the private data buffer, in bytes.
469 */
470int ib_send_cm_mra(struct ib_cm_id *cm_id,
471 u8 service_timeout,
472 const void *private_data,
473 u8 private_data_len);
474
475/**
476 * ib_send_cm_lap - Sends a load alternate path request.
477 * @cm_id: Connection identifier associated with the load alternate path
478 * message.
479 * @alternate_path: A path record that identifies the alternate path to
480 * load.
481 * @private_data: Optional user-defined private data sent with the
482 * load alternate path message.
483 * @private_data_len: Size of the private data buffer, in bytes.
484 */
485int ib_send_cm_lap(struct ib_cm_id *cm_id,
486 struct ib_sa_path_rec *alternate_path,
487 const void *private_data,
488 u8 private_data_len);
489
490/**
491 * ib_cm_init_qp_attr - Initializes the QP attributes for use in transitioning
492 * to a specified QP state.
493 * @cm_id: Communication identifier associated with the QP attributes to
494 * initialize.
495 * @qp_attr: On input, specifies the desired QP state. On output, the
496 * mandatory and desired optional attributes will be set in order to
497 * modify the QP to the specified state.
498 * @qp_attr_mask: The QP attribute mask that may be used to transition the
499 * QP to the specified state.
500 *
501 * Users must set the @qp_attr->qp_state to the desired QP state. This call
502 * will set all required attributes for the given transition, along with
503 * known optional attributes. Users may override the attributes returned from
504 * this call before calling ib_modify_qp.
505 */
506int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
507 struct ib_qp_attr *qp_attr,
508 int *qp_attr_mask);
509
510/**
511 * ib_send_cm_apr - Sends an alternate path response message in response to
512 * a load alternate path request.
513 * @cm_id: Connection identifier associated with the alternate path response.
514 * @status: Reply status sent with the alternate path response.
515 * @info: Optional additional information sent with the alternate path
516 * response.
517 * @info_length: Size of the additional information, in bytes.
518 * @private_data: Optional user-defined private data sent with the
519 * alternate path response message.
520 * @private_data_len: Size of the private data buffer, in bytes.
521 */
522int ib_send_cm_apr(struct ib_cm_id *cm_id,
523 enum ib_cm_apr_status status,
524 void *info,
525 u8 info_length,
526 const void *private_data,
527 u8 private_data_len);
528
529struct ib_cm_sidr_req_param {
530 struct ib_sa_path_rec *path;
531 u64 service_id;
532 int timeout_ms;
533 const void *private_data;
534 u8 private_data_len;
535 u8 max_cm_retries;
536 u16 pkey;
537};
538
539/**
540 * ib_send_cm_sidr_req - Sends a service ID resolution request to the
541 * remote node.
542 * @cm_id: Communication identifier that will be associated with the
543 * service ID resolution request.
544 * @param: Service ID resolution request information.
545 */
546int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
547 struct ib_cm_sidr_req_param *param);
548
549struct ib_cm_sidr_rep_param {
550 u32 qp_num;
551 u32 qkey;
552 enum ib_cm_sidr_status status;
553 const void *info;
554 u8 info_length;
555 const void *private_data;
556 u8 private_data_len;
557};
558
559/**
560 * ib_send_cm_sidr_rep - Sends a service ID resolution request to the
561 * remote node.
562 * @cm_id: Communication identifier associated with the received service ID
563 * resolution request.
564 * @param: Service ID resolution reply information.
565 */
566int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
567 struct ib_cm_sidr_rep_param *param);
568
569#endif /* IB_CM_H */
diff --git a/drivers/infiniband/include/ib_fmr_pool.h b/drivers/infiniband/include/ib_fmr_pool.h
index e8769657cbbb..6c9e24d6e144 100644
--- a/drivers/infiniband/include/ib_fmr_pool.h
+++ b/drivers/infiniband/include/ib_fmr_pool.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Corporation. All rights reserved. 2 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: ib_fmr_pool.h 1349 2004-12-16 21:09:43Z roland $ 33 * $Id: ib_fmr_pool.h 2730 2005-06-28 16:43:03Z sean.hefty $
33 */ 34 */
34 35
35#if !defined(IB_FMR_POOL_H) 36#if !defined(IB_FMR_POOL_H)
@@ -78,7 +79,7 @@ struct ib_pool_fmr {
78struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd, 79struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
79 struct ib_fmr_pool_param *params); 80 struct ib_fmr_pool_param *params);
80 81
81int ib_destroy_fmr_pool(struct ib_fmr_pool *pool); 82void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);
82 83
83int ib_flush_fmr_pool(struct ib_fmr_pool *pool); 84int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
84 85
diff --git a/drivers/infiniband/include/ib_mad.h b/drivers/infiniband/include/ib_mad.h
index 4a6bf6763a97..491b6f25b3b8 100644
--- a/drivers/infiniband/include/ib_mad.h
+++ b/drivers/infiniband/include/ib_mad.h
@@ -33,12 +33,14 @@
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE. 34 * SOFTWARE.
35 * 35 *
36 * $Id: ib_mad.h 1389 2004-12-27 22:56:47Z roland $ 36 * $Id: ib_mad.h 2775 2005-07-02 13:42:12Z halr $
37 */ 37 */
38 38
39#if !defined( IB_MAD_H ) 39#if !defined( IB_MAD_H )
40#define IB_MAD_H 40#define IB_MAD_H
41 41
42#include <linux/pci.h>
43
42#include <ib_verbs.h> 44#include <ib_verbs.h>
43 45
44/* Management base version */ 46/* Management base version */
@@ -56,6 +58,8 @@
56#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30 58#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
57#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F 59#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
58 60
61#define IB_OPENIB_OUI (0x001405)
62
59/* Management methods */ 63/* Management methods */
60#define IB_MGMT_METHOD_GET 0x01 64#define IB_MGMT_METHOD_GET 0x01
61#define IB_MGMT_METHOD_SET 0x02 65#define IB_MGMT_METHOD_SET 0x02
@@ -70,18 +74,37 @@
70 74
71#define IB_MGMT_MAX_METHODS 128 75#define IB_MGMT_MAX_METHODS 128
72 76
77/* RMPP information */
78#define IB_MGMT_RMPP_VERSION 1
79
80#define IB_MGMT_RMPP_TYPE_DATA 1
81#define IB_MGMT_RMPP_TYPE_ACK 2
82#define IB_MGMT_RMPP_TYPE_STOP 3
83#define IB_MGMT_RMPP_TYPE_ABORT 4
84
85#define IB_MGMT_RMPP_FLAG_ACTIVE 1
86#define IB_MGMT_RMPP_FLAG_FIRST (1<<1)
87#define IB_MGMT_RMPP_FLAG_LAST (1<<2)
88
89#define IB_MGMT_RMPP_NO_RESPTIME 0x1F
90
91#define IB_MGMT_RMPP_STATUS_SUCCESS 0
92#define IB_MGMT_RMPP_STATUS_RESX 1
93#define IB_MGMT_RMPP_STATUS_T2L 118
94#define IB_MGMT_RMPP_STATUS_BAD_LEN 119
95#define IB_MGMT_RMPP_STATUS_BAD_SEG 120
96#define IB_MGMT_RMPP_STATUS_BADT 121
97#define IB_MGMT_RMPP_STATUS_W2S 122
98#define IB_MGMT_RMPP_STATUS_S2B 123
99#define IB_MGMT_RMPP_STATUS_BAD_STATUS 124
100#define IB_MGMT_RMPP_STATUS_UNV 125
101#define IB_MGMT_RMPP_STATUS_TMR 126
102#define IB_MGMT_RMPP_STATUS_UNSPEC 127
103
73#define IB_QP0 0 104#define IB_QP0 0
74#define IB_QP1 __constant_htonl(1) 105#define IB_QP1 __constant_htonl(1)
75#define IB_QP1_QKEY 0x80010000 106#define IB_QP1_QKEY 0x80010000
76 107#define IB_QP_SET_QKEY 0x80000000
77struct ib_grh {
78 u32 version_tclass_flow;
79 u16 paylen;
80 u8 next_hdr;
81 u8 hop_limit;
82 union ib_gid sgid;
83 union ib_gid dgid;
84} __attribute__ ((packed));
85 108
86struct ib_mad_hdr { 109struct ib_mad_hdr {
87 u8 base_version; 110 u8 base_version;
@@ -94,7 +117,7 @@ struct ib_mad_hdr {
94 u16 attr_id; 117 u16 attr_id;
95 u16 resv; 118 u16 resv;
96 u32 attr_mod; 119 u32 attr_mod;
97} __attribute__ ((packed)); 120};
98 121
99struct ib_rmpp_hdr { 122struct ib_rmpp_hdr {
100 u8 rmpp_version; 123 u8 rmpp_version;
@@ -103,17 +126,41 @@ struct ib_rmpp_hdr {
103 u8 rmpp_status; 126 u8 rmpp_status;
104 u32 seg_num; 127 u32 seg_num;
105 u32 paylen_newwin; 128 u32 paylen_newwin;
129};
130
131typedef u64 __bitwise ib_sa_comp_mask;
132
133#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n))
134
135/*
136 * ib_sa_hdr and ib_sa_mad structures must be packed because they have
137 * 64-bit fields that are only 32-bit aligned. 64-bit architectures will
138 * lay them out wrong otherwise. (And unfortunately they are sent on
139 * the wire so we can't change the layout)
140 */
141struct ib_sa_hdr {
142 u64 sm_key;
143 u16 attr_offset;
144 u16 reserved;
145 ib_sa_comp_mask comp_mask;
106} __attribute__ ((packed)); 146} __attribute__ ((packed));
107 147
108struct ib_mad { 148struct ib_mad {
109 struct ib_mad_hdr mad_hdr; 149 struct ib_mad_hdr mad_hdr;
110 u8 data[232]; 150 u8 data[232];
111} __attribute__ ((packed)); 151};
112 152
113struct ib_rmpp_mad { 153struct ib_rmpp_mad {
114 struct ib_mad_hdr mad_hdr; 154 struct ib_mad_hdr mad_hdr;
115 struct ib_rmpp_hdr rmpp_hdr; 155 struct ib_rmpp_hdr rmpp_hdr;
116 u8 data[220]; 156 u8 data[220];
157};
158
159struct ib_sa_mad {
160 struct ib_mad_hdr mad_hdr;
161 struct ib_rmpp_hdr rmpp_hdr;
162 struct ib_sa_hdr sa_hdr;
163 u8 data[200];
117} __attribute__ ((packed)); 164} __attribute__ ((packed));
118 165
119struct ib_vendor_mad { 166struct ib_vendor_mad {
@@ -122,7 +169,70 @@ struct ib_vendor_mad {
122 u8 reserved; 169 u8 reserved;
123 u8 oui[3]; 170 u8 oui[3];
124 u8 data[216]; 171 u8 data[216];
125} __attribute__ ((packed)); 172};
173
174/**
175 * ib_mad_send_buf - MAD data buffer and work request for sends.
176 * @mad: References an allocated MAD data buffer. The size of the data
177 * buffer is specified in the @send_wr.length field.
178 * @mapping: DMA mapping information.
179 * @mad_agent: MAD agent that allocated the buffer.
180 * @context: User-controlled context fields.
181 * @send_wr: An initialized work request structure used when sending the MAD.
182 * The wr_id field of the work request is initialized to reference this
183 * data structure.
184 * @sge: A scatter-gather list referenced by the work request.
185 *
186 * Users are responsible for initializing the MAD buffer itself, with the
187 * exception of specifying the payload length field in any RMPP MAD.
188 */
189struct ib_mad_send_buf {
190 struct ib_mad *mad;
191 DECLARE_PCI_UNMAP_ADDR(mapping)
192 struct ib_mad_agent *mad_agent;
193 void *context[2];
194 struct ib_send_wr send_wr;
195 struct ib_sge sge;
196};
197
198/**
199 * ib_get_rmpp_resptime - Returns the RMPP response time.
200 * @rmpp_hdr: An RMPP header.
201 */
202static inline u8 ib_get_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr)
203{
204 return rmpp_hdr->rmpp_rtime_flags >> 3;
205}
206
207/**
208 * ib_get_rmpp_flags - Returns the RMPP flags.
209 * @rmpp_hdr: An RMPP header.
210 */
211static inline u8 ib_get_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr)
212{
213 return rmpp_hdr->rmpp_rtime_flags & 0x7;
214}
215
216/**
217 * ib_set_rmpp_resptime - Sets the response time in an RMPP header.
218 * @rmpp_hdr: An RMPP header.
219 * @rtime: The response time to set.
220 */
221static inline void ib_set_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr, u8 rtime)
222{
223 rmpp_hdr->rmpp_rtime_flags = ib_get_rmpp_flags(rmpp_hdr) | (rtime << 3);
224}
225
226/**
227 * ib_set_rmpp_flags - Sets the flags in an RMPP header.
228 * @rmpp_hdr: An RMPP header.
229 * @flags: The flags to set.
230 */
231static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags)
232{
233 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF1) |
234 (flags & 0x7);
235}
126 236
127struct ib_mad_agent; 237struct ib_mad_agent;
128struct ib_mad_send_wc; 238struct ib_mad_send_wc;
@@ -168,6 +278,7 @@ typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
168 * ib_mad_agent - Used to track MAD registration with the access layer. 278 * ib_mad_agent - Used to track MAD registration with the access layer.
169 * @device: Reference to device registration is on. 279 * @device: Reference to device registration is on.
170 * @qp: Reference to QP used for sending and receiving MADs. 280 * @qp: Reference to QP used for sending and receiving MADs.
281 * @mr: Memory region for system memory usable for DMA.
171 * @recv_handler: Callback handler for a received MAD. 282 * @recv_handler: Callback handler for a received MAD.
172 * @send_handler: Callback handler for a sent MAD. 283 * @send_handler: Callback handler for a sent MAD.
173 * @snoop_handler: Callback handler for snooped sent MADs. 284 * @snoop_handler: Callback handler for snooped sent MADs.
@@ -176,16 +287,19 @@ typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
176 * Unsolicited MADs sent by this client will have the upper 32-bits 287 * Unsolicited MADs sent by this client will have the upper 32-bits
177 * of their TID set to this value. 288 * of their TID set to this value.
178 * @port_num: Port number on which QP is registered 289 * @port_num: Port number on which QP is registered
290 * @rmpp_version: If set, indicates the RMPP version used by this agent.
179 */ 291 */
180struct ib_mad_agent { 292struct ib_mad_agent {
181 struct ib_device *device; 293 struct ib_device *device;
182 struct ib_qp *qp; 294 struct ib_qp *qp;
295 struct ib_mr *mr;
183 ib_mad_recv_handler recv_handler; 296 ib_mad_recv_handler recv_handler;
184 ib_mad_send_handler send_handler; 297 ib_mad_send_handler send_handler;
185 ib_mad_snoop_handler snoop_handler; 298 ib_mad_snoop_handler snoop_handler;
186 void *context; 299 void *context;
187 u32 hi_tid; 300 u32 hi_tid;
188 u8 port_num; 301 u8 port_num;
302 u8 rmpp_version;
189}; 303};
190 304
191/** 305/**
@@ -219,6 +333,7 @@ struct ib_mad_recv_buf {
219 * ib_mad_recv_wc - received MAD information. 333 * ib_mad_recv_wc - received MAD information.
220 * @wc: Completion information for the received data. 334 * @wc: Completion information for the received data.
221 * @recv_buf: Specifies the location of the received data buffer(s). 335 * @recv_buf: Specifies the location of the received data buffer(s).
336 * @rmpp_list: Specifies a list of RMPP reassembled received MAD buffers.
222 * @mad_len: The length of the received MAD, without duplicated headers. 337 * @mad_len: The length of the received MAD, without duplicated headers.
223 * 338 *
224 * For received response, the wr_id field of the wc is set to the wr_id 339 * For received response, the wr_id field of the wc is set to the wr_id
@@ -227,6 +342,7 @@ struct ib_mad_recv_buf {
227struct ib_mad_recv_wc { 342struct ib_mad_recv_wc {
228 struct ib_wc *wc; 343 struct ib_wc *wc;
229 struct ib_mad_recv_buf recv_buf; 344 struct ib_mad_recv_buf recv_buf;
345 struct list_head rmpp_list;
230 int mad_len; 346 int mad_len;
231}; 347};
232 348
@@ -322,6 +438,16 @@ int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent);
322 * @bad_send_wr: Specifies the MAD on which an error was encountered. 438 * @bad_send_wr: Specifies the MAD on which an error was encountered.
323 * 439 *
324 * Sent MADs are not guaranteed to complete in the order that they were posted. 440 * Sent MADs are not guaranteed to complete in the order that they were posted.
441 *
442 * If the MAD requires RMPP, the data buffer should contain a single copy
443 * of the common MAD, RMPP, and class specific headers, followed by the class
444 * defined data. If the class defined data would not divide evenly into
445 * RMPP segments, then space must be allocated at the end of the referenced
446 * buffer for any required padding. To indicate the amount of class defined
447 * data being transferred, the paylen_newwin field in the RMPP header should
448 * be set to the size of the class specific header plus the amount of class
449 * defined data being transferred. The paylen_newwin field should be
450 * specified in network-byte order.
325 */ 451 */
326int ib_post_send_mad(struct ib_mad_agent *mad_agent, 452int ib_post_send_mad(struct ib_mad_agent *mad_agent,
327 struct ib_send_wr *send_wr, 453 struct ib_send_wr *send_wr,
@@ -334,15 +460,13 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent,
334 * referenced buffer should be at least the size of the mad_len specified 460 * referenced buffer should be at least the size of the mad_len specified
335 * by @mad_recv_wc. 461 * by @mad_recv_wc.
336 * 462 *
337 * This call copies a chain of received RMPP MADs into a single data buffer, 463 * This call copies a chain of received MAD segments into a single data buffer,
338 * removing duplicated headers. 464 * removing duplicated headers.
339 */ 465 */
340void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, 466void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf);
341 void *buf);
342 467
343/** 468/**
344 * ib_free_recv_mad - Returns data buffers used to receive a MAD to the 469 * ib_free_recv_mad - Returns data buffers used to receive a MAD.
345 * access layer.
346 * @mad_recv_wc: Work completion information for a received MAD. 470 * @mad_recv_wc: Work completion information for a received MAD.
347 * 471 *
348 * Clients receiving MADs through their ib_mad_recv_handler must call this 472 * Clients receiving MADs through their ib_mad_recv_handler must call this
@@ -358,8 +482,18 @@ void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc);
358 * MADs will be returned to the user through the corresponding 482 * MADs will be returned to the user through the corresponding
359 * ib_mad_send_handler. 483 * ib_mad_send_handler.
360 */ 484 */
361void ib_cancel_mad(struct ib_mad_agent *mad_agent, 485void ib_cancel_mad(struct ib_mad_agent *mad_agent, u64 wr_id);
362 u64 wr_id); 486
487/**
488 * ib_modify_mad - Modifies an outstanding send MAD operation.
489 * @mad_agent: Specifies the registration associated with sent MAD.
490 * @wr_id: Indicates the work request identifier of the MAD to modify.
491 * @timeout_ms: New timeout value for sent MAD.
492 *
493 * This call will reset the timeout value for a sent MAD to the specified
494 * value.
495 */
496int ib_modify_mad(struct ib_mad_agent *mad_agent, u64 wr_id, u32 timeout_ms);
363 497
364/** 498/**
365 * ib_redirect_mad_qp - Registers a QP for MAD services. 499 * ib_redirect_mad_qp - Registers a QP for MAD services.
@@ -401,4 +535,43 @@ struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp,
401int ib_process_mad_wc(struct ib_mad_agent *mad_agent, 535int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
402 struct ib_wc *wc); 536 struct ib_wc *wc);
403 537
538/**
539 * ib_create_send_mad - Allocate and initialize a data buffer and work request
540 * for sending a MAD.
541 * @mad_agent: Specifies the registered MAD service to associate with the MAD.
542 * @remote_qpn: Specifies the QPN of the receiving node.
543 * @pkey_index: Specifies which PKey the MAD will be sent using. This field
544 * is valid only if the remote_qpn is QP 1.
545 * @ah: References the address handle used to transfer to the remote node.
546 * @rmpp_active: Indicates if the send will enable RMPP.
547 * @hdr_len: Indicates the size of the data header of the MAD. This length
548 * should include the common MAD header, RMPP header, plus any class
549 * specific header.
550 * @data_len: Indicates the size of any user-transferred data. The call will
551 * automatically adjust the allocated buffer size to account for any
552 * additional padding that may be necessary.
553 * @gfp_mask: GFP mask used for the memory allocation.
554 *
555 * This is a helper routine that may be used to allocate a MAD. Users are
556 * not required to allocate outbound MADs using this call. The returned
557 * MAD send buffer will reference a data buffer usable for sending a MAD, along
558 * with an initialized work request structure. Users may modify the returned
559 * MAD data buffer or work request before posting the send.
560 *
561 * The returned data buffer will be cleared. Users are responsible for
562 * initializing the common MAD and any class specific headers. If @rmpp_active
563 * is set, the RMPP header will be initialized for sending.
564 */
565struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
566 u32 remote_qpn, u16 pkey_index,
567 struct ib_ah *ah, int rmpp_active,
568 int hdr_len, int data_len,
569 unsigned int __nocast gfp_mask);
570
571/**
572 * ib_free_send_mad - Returns data buffers used to send a MAD.
573 * @send_buf: Previously allocated send data buffer.
574 */
575void ib_free_send_mad(struct ib_mad_send_buf *send_buf);
576
404#endif /* IB_MAD_H */ 577#endif /* IB_MAD_H */
diff --git a/drivers/infiniband/include/ib_sa.h b/drivers/infiniband/include/ib_sa.h
index 00222285eb9a..6d999f7b5d93 100644
--- a/drivers/infiniband/include/ib_sa.h
+++ b/drivers/infiniband/include/ib_sa.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: ib_sa.h 1389 2004-12-27 22:56:47Z roland $ 33 * $Id: ib_sa.h 2811 2005-07-06 18:11:43Z halr $
33 */ 34 */
34 35
35#ifndef IB_SA_H 36#ifndef IB_SA_H
@@ -41,9 +42,11 @@
41#include <ib_mad.h> 42#include <ib_mad.h>
42 43
43enum { 44enum {
44 IB_SA_CLASS_VERSION = 2, /* IB spec version 1.1/1.2 */ 45 IB_SA_CLASS_VERSION = 2, /* IB spec version 1.1/1.2 */
45 46
46 IB_SA_METHOD_DELETE = 0x15 47 IB_SA_METHOD_GET_TABLE = 0x12,
48 IB_SA_METHOD_GET_TABLE_RESP = 0x92,
49 IB_SA_METHOD_DELETE = 0x15
47}; 50};
48 51
49enum ib_sa_selector { 52enum ib_sa_selector {
@@ -87,10 +90,6 @@ static inline int ib_sa_rate_enum_to_int(enum ib_sa_rate rate)
87 } 90 }
88} 91}
89 92
90typedef u64 __bitwise ib_sa_comp_mask;
91
92#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n))
93
94/* 93/*
95 * Structures for SA records are named "struct ib_sa_xxx_rec." No 94 * Structures for SA records are named "struct ib_sa_xxx_rec." No
96 * attempt is made to pack structures to match the physical layout of 95 * attempt is made to pack structures to match the physical layout of
@@ -195,6 +194,61 @@ struct ib_sa_mcmember_rec {
195 int proxy_join; 194 int proxy_join;
196}; 195};
197 196
197/* Service Record Component Mask Sec 15.2.5.14 Ver 1.1 */
198#define IB_SA_SERVICE_REC_SERVICE_ID IB_SA_COMP_MASK( 0)
199#define IB_SA_SERVICE_REC_SERVICE_GID IB_SA_COMP_MASK( 1)
200#define IB_SA_SERVICE_REC_SERVICE_PKEY IB_SA_COMP_MASK( 2)
201/* reserved: 3 */
202#define IB_SA_SERVICE_REC_SERVICE_LEASE IB_SA_COMP_MASK( 4)
203#define IB_SA_SERVICE_REC_SERVICE_KEY IB_SA_COMP_MASK( 5)
204#define IB_SA_SERVICE_REC_SERVICE_NAME IB_SA_COMP_MASK( 6)
205#define IB_SA_SERVICE_REC_SERVICE_DATA8_0 IB_SA_COMP_MASK( 7)
206#define IB_SA_SERVICE_REC_SERVICE_DATA8_1 IB_SA_COMP_MASK( 8)
207#define IB_SA_SERVICE_REC_SERVICE_DATA8_2 IB_SA_COMP_MASK( 9)
208#define IB_SA_SERVICE_REC_SERVICE_DATA8_3 IB_SA_COMP_MASK(10)
209#define IB_SA_SERVICE_REC_SERVICE_DATA8_4 IB_SA_COMP_MASK(11)
210#define IB_SA_SERVICE_REC_SERVICE_DATA8_5 IB_SA_COMP_MASK(12)
211#define IB_SA_SERVICE_REC_SERVICE_DATA8_6 IB_SA_COMP_MASK(13)
212#define IB_SA_SERVICE_REC_SERVICE_DATA8_7 IB_SA_COMP_MASK(14)
213#define IB_SA_SERVICE_REC_SERVICE_DATA8_8 IB_SA_COMP_MASK(15)
214#define IB_SA_SERVICE_REC_SERVICE_DATA8_9 IB_SA_COMP_MASK(16)
215#define IB_SA_SERVICE_REC_SERVICE_DATA8_10 IB_SA_COMP_MASK(17)
216#define IB_SA_SERVICE_REC_SERVICE_DATA8_11 IB_SA_COMP_MASK(18)
217#define IB_SA_SERVICE_REC_SERVICE_DATA8_12 IB_SA_COMP_MASK(19)
218#define IB_SA_SERVICE_REC_SERVICE_DATA8_13 IB_SA_COMP_MASK(20)
219#define IB_SA_SERVICE_REC_SERVICE_DATA8_14 IB_SA_COMP_MASK(21)
220#define IB_SA_SERVICE_REC_SERVICE_DATA8_15 IB_SA_COMP_MASK(22)
221#define IB_SA_SERVICE_REC_SERVICE_DATA16_0 IB_SA_COMP_MASK(23)
222#define IB_SA_SERVICE_REC_SERVICE_DATA16_1 IB_SA_COMP_MASK(24)
223#define IB_SA_SERVICE_REC_SERVICE_DATA16_2 IB_SA_COMP_MASK(25)
224#define IB_SA_SERVICE_REC_SERVICE_DATA16_3 IB_SA_COMP_MASK(26)
225#define IB_SA_SERVICE_REC_SERVICE_DATA16_4 IB_SA_COMP_MASK(27)
226#define IB_SA_SERVICE_REC_SERVICE_DATA16_5 IB_SA_COMP_MASK(28)
227#define IB_SA_SERVICE_REC_SERVICE_DATA16_6 IB_SA_COMP_MASK(29)
228#define IB_SA_SERVICE_REC_SERVICE_DATA16_7 IB_SA_COMP_MASK(30)
229#define IB_SA_SERVICE_REC_SERVICE_DATA32_0 IB_SA_COMP_MASK(31)
230#define IB_SA_SERVICE_REC_SERVICE_DATA32_1 IB_SA_COMP_MASK(32)
231#define IB_SA_SERVICE_REC_SERVICE_DATA32_2 IB_SA_COMP_MASK(33)
232#define IB_SA_SERVICE_REC_SERVICE_DATA32_3 IB_SA_COMP_MASK(34)
233#define IB_SA_SERVICE_REC_SERVICE_DATA64_0 IB_SA_COMP_MASK(35)
234#define IB_SA_SERVICE_REC_SERVICE_DATA64_1 IB_SA_COMP_MASK(36)
235
236#define IB_DEFAULT_SERVICE_LEASE 0xFFFFFFFF
237
238struct ib_sa_service_rec {
239 u64 id;
240 union ib_gid gid;
241 u16 pkey;
242 /* reserved */
243 u32 lease;
244 u8 key[16];
245 u8 name[64];
246 u8 data8[16];
247 u16 data16[8];
248 u32 data32[4];
249 u64 data64[2];
250};
251
198struct ib_sa_query; 252struct ib_sa_query;
199 253
200void ib_sa_cancel_query(int id, struct ib_sa_query *query); 254void ib_sa_cancel_query(int id, struct ib_sa_query *query);
@@ -202,7 +256,7 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query);
202int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 256int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
203 struct ib_sa_path_rec *rec, 257 struct ib_sa_path_rec *rec,
204 ib_sa_comp_mask comp_mask, 258 ib_sa_comp_mask comp_mask,
205 int timeout_ms, int gfp_mask, 259 int timeout_ms, unsigned int __nocast gfp_mask,
206 void (*callback)(int status, 260 void (*callback)(int status,
207 struct ib_sa_path_rec *resp, 261 struct ib_sa_path_rec *resp,
208 void *context), 262 void *context),
@@ -213,13 +267,24 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
213 u8 method, 267 u8 method,
214 struct ib_sa_mcmember_rec *rec, 268 struct ib_sa_mcmember_rec *rec,
215 ib_sa_comp_mask comp_mask, 269 ib_sa_comp_mask comp_mask,
216 int timeout_ms, int gfp_mask, 270 int timeout_ms, unsigned int __nocast gfp_mask,
217 void (*callback)(int status, 271 void (*callback)(int status,
218 struct ib_sa_mcmember_rec *resp, 272 struct ib_sa_mcmember_rec *resp,
219 void *context), 273 void *context),
220 void *context, 274 void *context,
221 struct ib_sa_query **query); 275 struct ib_sa_query **query);
222 276
277int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
278 u8 method,
279 struct ib_sa_service_rec *rec,
280 ib_sa_comp_mask comp_mask,
281 int timeout_ms, unsigned int __nocast gfp_mask,
282 void (*callback)(int status,
283 struct ib_sa_service_rec *resp,
284 void *context),
285 void *context,
286 struct ib_sa_query **sa_query);
287
223/** 288/**
224 * ib_sa_mcmember_rec_set - Start an MCMember set query 289 * ib_sa_mcmember_rec_set - Start an MCMember set query
225 * @device:device to send query on 290 * @device:device to send query on
@@ -248,7 +313,7 @@ static inline int
248ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, 313ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
249 struct ib_sa_mcmember_rec *rec, 314 struct ib_sa_mcmember_rec *rec,
250 ib_sa_comp_mask comp_mask, 315 ib_sa_comp_mask comp_mask,
251 int timeout_ms, int gfp_mask, 316 int timeout_ms, unsigned int __nocast gfp_mask,
252 void (*callback)(int status, 317 void (*callback)(int status,
253 struct ib_sa_mcmember_rec *resp, 318 struct ib_sa_mcmember_rec *resp,
254 void *context), 319 void *context),
@@ -290,7 +355,7 @@ static inline int
290ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, 355ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
291 struct ib_sa_mcmember_rec *rec, 356 struct ib_sa_mcmember_rec *rec,
292 ib_sa_comp_mask comp_mask, 357 ib_sa_comp_mask comp_mask,
293 int timeout_ms, int gfp_mask, 358 int timeout_ms, unsigned int __nocast gfp_mask,
294 void (*callback)(int status, 359 void (*callback)(int status,
295 struct ib_sa_mcmember_rec *resp, 360 struct ib_sa_mcmember_rec *resp,
296 void *context), 361 void *context),
diff --git a/drivers/infiniband/include/ib_user_cm.h b/drivers/infiniband/include/ib_user_cm.h
new file mode 100644
index 000000000000..500b1af6ff77
--- /dev/null
+++ b/drivers/infiniband/include/ib_user_cm.h
@@ -0,0 +1,328 @@
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: ib_user_cm.h 2576 2005-06-09 17:00:30Z libor $
33 */
34
35#ifndef IB_USER_CM_H
36#define IB_USER_CM_H
37
38#include <linux/types.h>
39
40#define IB_USER_CM_ABI_VERSION 1
41
42enum {
43 IB_USER_CM_CMD_CREATE_ID,
44 IB_USER_CM_CMD_DESTROY_ID,
45 IB_USER_CM_CMD_ATTR_ID,
46
47 IB_USER_CM_CMD_LISTEN,
48 IB_USER_CM_CMD_ESTABLISH,
49
50 IB_USER_CM_CMD_SEND_REQ,
51 IB_USER_CM_CMD_SEND_REP,
52 IB_USER_CM_CMD_SEND_RTU,
53 IB_USER_CM_CMD_SEND_DREQ,
54 IB_USER_CM_CMD_SEND_DREP,
55 IB_USER_CM_CMD_SEND_REJ,
56 IB_USER_CM_CMD_SEND_MRA,
57 IB_USER_CM_CMD_SEND_LAP,
58 IB_USER_CM_CMD_SEND_APR,
59 IB_USER_CM_CMD_SEND_SIDR_REQ,
60 IB_USER_CM_CMD_SEND_SIDR_REP,
61
62 IB_USER_CM_CMD_EVENT,
63};
64/*
65 * command ABI structures.
66 */
67struct ib_ucm_cmd_hdr {
68 __u32 cmd;
69 __u16 in;
70 __u16 out;
71};
72
73struct ib_ucm_create_id {
74 __u64 response;
75};
76
77struct ib_ucm_create_id_resp {
78 __u32 id;
79};
80
81struct ib_ucm_destroy_id {
82 __u32 id;
83};
84
85struct ib_ucm_attr_id {
86 __u64 response;
87 __u32 id;
88};
89
90struct ib_ucm_attr_id_resp {
91 __u64 service_id;
92 __u64 service_mask;
93 __u32 local_id;
94 __u32 remote_id;
95};
96
97struct ib_ucm_listen {
98 __u64 service_id;
99 __u64 service_mask;
100 __u32 id;
101};
102
103struct ib_ucm_establish {
104 __u32 id;
105};
106
107struct ib_ucm_private_data {
108 __u64 data;
109 __u32 id;
110 __u8 len;
111 __u8 reserved[3];
112};
113
114struct ib_ucm_path_rec {
115 __u8 dgid[16];
116 __u8 sgid[16];
117 __u16 dlid;
118 __u16 slid;
119 __u32 raw_traffic;
120 __u32 flow_label;
121 __u32 reversible;
122 __u32 mtu;
123 __u16 pkey;
124 __u8 hop_limit;
125 __u8 traffic_class;
126 __u8 numb_path;
127 __u8 sl;
128 __u8 mtu_selector;
129 __u8 rate_selector;
130 __u8 rate;
131 __u8 packet_life_time_selector;
132 __u8 packet_life_time;
133 __u8 preference;
134};
135
136struct ib_ucm_req {
137 __u32 id;
138 __u32 qpn;
139 __u32 qp_type;
140 __u32 psn;
141 __u64 sid;
142 __u64 data;
143 __u64 primary_path;
144 __u64 alternate_path;
145 __u8 len;
146 __u8 peer_to_peer;
147 __u8 responder_resources;
148 __u8 initiator_depth;
149 __u8 remote_cm_response_timeout;
150 __u8 flow_control;
151 __u8 local_cm_response_timeout;
152 __u8 retry_count;
153 __u8 rnr_retry_count;
154 __u8 max_cm_retries;
155 __u8 srq;
156 __u8 reserved[1];
157};
158
159struct ib_ucm_rep {
160 __u64 data;
161 __u32 id;
162 __u32 qpn;
163 __u32 psn;
164 __u8 len;
165 __u8 responder_resources;
166 __u8 initiator_depth;
167 __u8 target_ack_delay;
168 __u8 failover_accepted;
169 __u8 flow_control;
170 __u8 rnr_retry_count;
171 __u8 srq;
172};
173
174struct ib_ucm_info {
175 __u32 id;
176 __u32 status;
177 __u64 info;
178 __u64 data;
179 __u8 info_len;
180 __u8 data_len;
181 __u8 reserved[2];
182};
183
184struct ib_ucm_mra {
185 __u64 data;
186 __u32 id;
187 __u8 len;
188 __u8 timeout;
189 __u8 reserved[2];
190};
191
192struct ib_ucm_lap {
193 __u64 path;
194 __u64 data;
195 __u32 id;
196 __u8 len;
197 __u8 reserved[3];
198};
199
200struct ib_ucm_sidr_req {
201 __u32 id;
202 __u32 timeout;
203 __u64 sid;
204 __u64 data;
205 __u64 path;
206 __u16 pkey;
207 __u8 len;
208 __u8 max_cm_retries;
209};
210
211struct ib_ucm_sidr_rep {
212 __u32 id;
213 __u32 qpn;
214 __u32 qkey;
215 __u32 status;
216 __u64 info;
217 __u64 data;
218 __u8 info_len;
219 __u8 data_len;
220 __u8 reserved[2];
221};
222/*
223 * event notification ABI structures.
224 */
225struct ib_ucm_event_get {
226 __u64 response;
227 __u64 data;
228 __u64 info;
229 __u8 data_len;
230 __u8 info_len;
231 __u8 reserved[2];
232};
233
234struct ib_ucm_req_event_resp {
235 __u32 listen_id;
236 /* device */
237 /* port */
238 struct ib_ucm_path_rec primary_path;
239 struct ib_ucm_path_rec alternate_path;
240 __u64 remote_ca_guid;
241 __u32 remote_qkey;
242 __u32 remote_qpn;
243 __u32 qp_type;
244 __u32 starting_psn;
245 __u8 responder_resources;
246 __u8 initiator_depth;
247 __u8 local_cm_response_timeout;
248 __u8 flow_control;
249 __u8 remote_cm_response_timeout;
250 __u8 retry_count;
251 __u8 rnr_retry_count;
252 __u8 srq;
253};
254
255struct ib_ucm_rep_event_resp {
256 __u64 remote_ca_guid;
257 __u32 remote_qkey;
258 __u32 remote_qpn;
259 __u32 starting_psn;
260 __u8 responder_resources;
261 __u8 initiator_depth;
262 __u8 target_ack_delay;
263 __u8 failover_accepted;
264 __u8 flow_control;
265 __u8 rnr_retry_count;
266 __u8 srq;
267 __u8 reserved[1];
268};
269
270struct ib_ucm_rej_event_resp {
271 __u32 reason;
272 /* ari in ib_ucm_event_get info field. */
273};
274
275struct ib_ucm_mra_event_resp {
276 __u8 timeout;
277 __u8 reserved[3];
278};
279
280struct ib_ucm_lap_event_resp {
281 struct ib_ucm_path_rec path;
282};
283
284struct ib_ucm_apr_event_resp {
285 __u32 status;
286 /* apr info in ib_ucm_event_get info field. */
287};
288
289struct ib_ucm_sidr_req_event_resp {
290 __u32 listen_id;
291 /* device */
292 /* port */
293 __u16 pkey;
294 __u8 reserved[2];
295};
296
297struct ib_ucm_sidr_rep_event_resp {
298 __u32 status;
299 __u32 qkey;
300 __u32 qpn;
301 /* info in ib_ucm_event_get info field. */
302};
303
304#define IB_UCM_PRES_DATA 0x01
305#define IB_UCM_PRES_INFO 0x02
306#define IB_UCM_PRES_PRIMARY 0x04
307#define IB_UCM_PRES_ALTERNATE 0x08
308
309struct ib_ucm_event_resp {
310 __u32 id;
311 __u32 event;
312 __u32 present;
313 union {
314 struct ib_ucm_req_event_resp req_resp;
315 struct ib_ucm_rep_event_resp rep_resp;
316 struct ib_ucm_rej_event_resp rej_resp;
317 struct ib_ucm_mra_event_resp mra_resp;
318 struct ib_ucm_lap_event_resp lap_resp;
319 struct ib_ucm_apr_event_resp apr_resp;
320
321 struct ib_ucm_sidr_req_event_resp sidr_req_resp;
322 struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
323
324 __u32 send_status;
325 } u;
326};
327
328#endif /* IB_USER_CM_H */
diff --git a/drivers/infiniband/include/ib_user_mad.h b/drivers/infiniband/include/ib_user_mad.h
index 06ad4a6075fa..a9a56b50aacc 100644
--- a/drivers/infiniband/include/ib_user_mad.h
+++ b/drivers/infiniband/include/ib_user_mad.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: ib_user_mad.h 1389 2004-12-27 22:56:47Z roland $ 33 * $Id: ib_user_mad.h 2814 2005-07-06 19:14:09Z halr $
33 */ 34 */
34 35
35#ifndef IB_USER_MAD_H 36#ifndef IB_USER_MAD_H
@@ -42,7 +43,7 @@
42 * Increment this value if any changes that break userspace ABI 43 * Increment this value if any changes that break userspace ABI
43 * compatibility are made. 44 * compatibility are made.
44 */ 45 */
45#define IB_USER_MAD_ABI_VERSION 2 46#define IB_USER_MAD_ABI_VERSION 5
46 47
47/* 48/*
48 * Make sure that all structs defined in this file remain laid out so 49 * Make sure that all structs defined in this file remain laid out so
@@ -51,13 +52,13 @@
51 */ 52 */
52 53
53/** 54/**
54 * ib_user_mad - MAD packet 55 * ib_user_mad_hdr - MAD packet header
55 * @data - Contents of MAD
56 * @id - ID of agent MAD received with/to be sent with 56 * @id - ID of agent MAD received with/to be sent with
57 * @status - 0 on successful receive, ETIMEDOUT if no response 57 * @status - 0 on successful receive, ETIMEDOUT if no response
58 * received (transaction ID in data[] will be set to TID of original 58 * received (transaction ID in data[] will be set to TID of original
59 * request) (ignored on send) 59 * request) (ignored on send)
60 * @timeout_ms - Milliseconds to wait for response (unset on receive) 60 * @timeout_ms - Milliseconds to wait for response (unset on receive)
61 * @retries - Number of automatic retries to attempt
61 * @qpn - Remote QP number received from/to be sent to 62 * @qpn - Remote QP number received from/to be sent to
62 * @qkey - Remote Q_Key to be sent with (unset on receive) 63 * @qkey - Remote Q_Key to be sent with (unset on receive)
63 * @lid - Remote lid received from/to be sent to 64 * @lid - Remote lid received from/to be sent to
@@ -72,11 +73,12 @@
72 * 73 *
73 * All multi-byte quantities are stored in network (big endian) byte order. 74 * All multi-byte quantities are stored in network (big endian) byte order.
74 */ 75 */
75struct ib_user_mad { 76struct ib_user_mad_hdr {
76 __u8 data[256];
77 __u32 id; 77 __u32 id;
78 __u32 status; 78 __u32 status;
79 __u32 timeout_ms; 79 __u32 timeout_ms;
80 __u32 retries;
81 __u32 length;
80 __u32 qpn; 82 __u32 qpn;
81 __u32 qkey; 83 __u32 qkey;
82 __u16 lid; 84 __u16 lid;
@@ -91,6 +93,17 @@ struct ib_user_mad {
91}; 93};
92 94
93/** 95/**
96 * ib_user_mad - MAD packet
97 * @hdr - MAD packet header
98 * @data - Contents of MAD
99 *
100 */
101struct ib_user_mad {
102 struct ib_user_mad_hdr hdr;
103 __u8 data[0];
104};
105
106/**
94 * ib_user_mad_reg_req - MAD registration request 107 * ib_user_mad_reg_req - MAD registration request
95 * @id - Set by the kernel; used to identify agent in future requests. 108 * @id - Set by the kernel; used to identify agent in future requests.
96 * @qpn - Queue pair number; must be 0 or 1. 109 * @qpn - Queue pair number; must be 0 or 1.
@@ -103,6 +116,8 @@ struct ib_user_mad {
103 * management class to receive. 116 * management class to receive.
104 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class 117 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
105 * in the range from 0x30 to 0x4f. Otherwise not used. 118 * in the range from 0x30 to 0x4f. Otherwise not used.
119 * @rmpp_version: If set, indicates the RMPP version used.
120 *
106 */ 121 */
107struct ib_user_mad_reg_req { 122struct ib_user_mad_reg_req {
108 __u32 id; 123 __u32 id;
@@ -111,6 +126,7 @@ struct ib_user_mad_reg_req {
111 __u8 mgmt_class; 126 __u8 mgmt_class;
112 __u8 mgmt_class_version; 127 __u8 mgmt_class_version;
113 __u8 oui[3]; 128 __u8 oui[3];
129 __u8 rmpp_version;
114}; 130};
115 131
116#define IB_IOCTL_MAGIC 0x1b 132#define IB_IOCTL_MAGIC 0x1b
diff --git a/drivers/infiniband/include/ib_verbs.h b/drivers/infiniband/include/ib_verbs.h
index e5bd9a10c201..5d24edaa66e6 100644
--- a/drivers/infiniband/include/ib_verbs.h
+++ b/drivers/infiniband/include/ib_verbs.h
@@ -289,6 +289,15 @@ struct ib_global_route {
289 u8 traffic_class; 289 u8 traffic_class;
290}; 290};
291 291
292struct ib_grh {
293 u32 version_tclass_flow;
294 u16 paylen;
295 u8 next_hdr;
296 u8 hop_limit;
297 union ib_gid sgid;
298 union ib_gid dgid;
299};
300
292enum { 301enum {
293 IB_MULTICAST_QPN = 0xffffff 302 IB_MULTICAST_QPN = 0xffffff
294}; 303};
@@ -566,6 +575,7 @@ struct ib_send_wr {
566 u32 remote_qpn; 575 u32 remote_qpn;
567 u32 remote_qkey; 576 u32 remote_qkey;
568 int timeout_ms; /* valid for MADs only */ 577 int timeout_ms; /* valid for MADs only */
578 int retries; /* valid for MADs only */
569 u16 pkey_index; /* valid for GSI only */ 579 u16 pkey_index; /* valid for GSI only */
570 u8 port_num; /* valid for DR SMPs on switch only */ 580 u8 port_num; /* valid for DR SMPs on switch only */
571 } ud; 581 } ud;
@@ -990,6 +1000,21 @@ int ib_dealloc_pd(struct ib_pd *pd);
990struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); 1000struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
991 1001
992/** 1002/**
1003 * ib_create_ah_from_wc - Creates an address handle associated with the
1004 * sender of the specified work completion.
1005 * @pd: The protection domain associated with the address handle.
1006 * @wc: Work completion information associated with a received message.
1007 * @grh: References the received global route header. This parameter is
1008 * ignored unless the work completion indicates that the GRH is valid.
1009 * @port_num: The outbound port number to associate with the address.
1010 *
1011 * The address handle is used to reference a local or global destination
1012 * in all UD QP post sends.
1013 */
1014struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc,
1015 struct ib_grh *grh, u8 port_num);
1016
1017/**
993 * ib_modify_ah - Modifies the address vector associated with an address 1018 * ib_modify_ah - Modifies the address vector associated with an address
994 * handle. 1019 * handle.
995 * @ah: The address handle to modify. 1020 * @ah: The address handle to modify.
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8238766746b2..eee82363167d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -81,7 +81,7 @@ void ipoib_free_ah(struct kref *kref)
81 81
82 unsigned long flags; 82 unsigned long flags;
83 83
84 if (ah->last_send <= priv->tx_tail) { 84 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); 85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah);
86 ib_destroy_ah(ah->ah); 86 ib_destroy_ah(ah->ah);
87 kfree(ah); 87 kfree(ah);
@@ -355,7 +355,7 @@ static void __ipoib_reap_ah(struct net_device *dev)
355 355
356 spin_lock_irq(&priv->lock); 356 spin_lock_irq(&priv->lock);
357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) 357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list)
358 if (ah->last_send <= priv->tx_tail) { 358 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
359 list_del(&ah->list); 359 list_del(&ah->list);
360 list_add_tail(&ah->list, &remove_list); 360 list_add_tail(&ah->list, &remove_list);
361 } 361 }
@@ -486,7 +486,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
486 * assume the HW is wedged and just free up 486 * assume the HW is wedged and just free up
487 * all our pending work requests. 487 * all our pending work requests.
488 */ 488 */
489 while (priv->tx_tail < priv->tx_head) { 489 while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
490 tx_req = &priv->tx_ring[priv->tx_tail & 490 tx_req = &priv->tx_ring[priv->tx_tail &
491 (IPOIB_TX_RING_SIZE - 1)]; 491 (IPOIB_TX_RING_SIZE - 1)];
492 dma_unmap_single(priv->ca->dma_device, 492 dma_unmap_single(priv->ca->dma_device,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 6f60abbaebd5..fa00816a3cf7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -600,9 +600,10 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
600 600
601 ipoib_mcast_send(dev, (union ib_gid *) (phdr->hwaddr + 4), skb); 601 ipoib_mcast_send(dev, (union ib_gid *) (phdr->hwaddr + 4), skb);
602 } else { 602 } else {
603 /* unicast GID -- should be ARP reply */ 603 /* unicast GID -- should be ARP or RARP reply */
604 604
605 if (be16_to_cpup((u16 *) skb->data) != ETH_P_ARP) { 605 if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) &&
606 (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) {
606 ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x " 607 ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x "
607 IPOIB_GID_FMT "\n", 608 IPOIB_GID_FMT "\n",
608 skb->dst ? "neigh" : "dst", 609 skb->dst ? "neigh" : "dst",
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 374f404e81da..20e3a165989f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -320,6 +320,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
320 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; 320 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL;
321 if (get_user(v, ip + 1)) return -EFAULT; 321 if (get_user(v, ip + 1)) return -EFAULT;
322 if (v < 0 || v > KEY_MAX) return -EINVAL; 322 if (v < 0 || v > KEY_MAX) return -EINVAL;
323 if (v >> (dev->keycodesize * 8)) return -EINVAL;
323 u = SET_INPUT_KEYCODE(dev, t, v); 324 u = SET_INPUT_KEYCODE(dev, t, v);
324 clear_bit(u, dev->keybit); 325 clear_bit(u, dev->keybit);
325 set_bit(v, dev->keybit); 326 set_bit(v, dev->keybit);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 7c4b4d37b3e6..a275211c8e1e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -48,12 +48,6 @@ static LIST_HEAD(input_handler_list);
48 48
49static struct input_handler *input_table[8]; 49static struct input_handler *input_table[8];
50 50
51#ifdef CONFIG_PROC_FS
52static struct proc_dir_entry *proc_bus_input_dir;
53static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
54static int input_devices_state;
55#endif
56
57void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 51void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
58{ 52{
59 struct input_handle *handle; 53 struct input_handle *handle;
@@ -312,6 +306,7 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st
312 return NULL; 306 return NULL;
313} 307}
314 308
309
315/* 310/*
316 * Input hotplugging interface - loading event handlers based on 311 * Input hotplugging interface - loading event handlers based on
317 * device bitfields. 312 * device bitfields.
@@ -428,6 +423,177 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
428 423
429#endif 424#endif
430 425
426#ifdef CONFIG_PROC_FS
427
428static struct proc_dir_entry *proc_bus_input_dir;
429static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
430static int input_devices_state;
431
432static inline void input_wakeup_procfs_readers(void)
433{
434 input_devices_state++;
435 wake_up(&input_devices_poll_wait);
436}
437
438static unsigned int input_devices_poll(struct file *file, poll_table *wait)
439{
440 int state = input_devices_state;
441 poll_wait(file, &input_devices_poll_wait, wait);
442 if (state != input_devices_state)
443 return POLLIN | POLLRDNORM;
444 return 0;
445}
446
447#define SPRINTF_BIT_B(bit, name, max) \
448 do { \
449 len += sprintf(buf + len, "B: %s", name); \
450 for (i = NBITS(max) - 1; i >= 0; i--) \
451 if (dev->bit[i]) break; \
452 for (; i >= 0; i--) \
453 len += sprintf(buf + len, "%lx ", dev->bit[i]); \
454 len += sprintf(buf + len, "\n"); \
455 } while (0)
456
457#define SPRINTF_BIT_B2(bit, name, max, ev) \
458 do { \
459 if (test_bit(ev, dev->evbit)) \
460 SPRINTF_BIT_B(bit, name, max); \
461 } while (0)
462
463static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
464{
465 struct input_dev *dev;
466 struct input_handle *handle;
467
468 off_t at = 0;
469 int i, len, cnt = 0;
470
471 list_for_each_entry(dev, &input_dev_list, node) {
472
473 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
474 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
475
476 len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
477 len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : "");
478 len += sprintf(buf + len, "H: Handlers=");
479
480 list_for_each_entry(handle, &dev->h_list, d_node)
481 len += sprintf(buf + len, "%s ", handle->name);
482
483 len += sprintf(buf + len, "\n");
484
485 SPRINTF_BIT_B(evbit, "EV=", EV_MAX);
486 SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY);
487 SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL);
488 SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS);
489 SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC);
490 SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED);
491 SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND);
492 SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF);
493
494 len += sprintf(buf + len, "\n");
495
496 at += len;
497
498 if (at >= pos) {
499 if (!*start) {
500 *start = buf + (pos - (at - len));
501 cnt = at - pos;
502 } else cnt += len;
503 buf += len;
504 if (cnt >= count)
505 break;
506 }
507 }
508
509 if (&dev->node == &input_dev_list)
510 *eof = 1;
511
512 return (count > cnt) ? cnt : count;
513}
514
515static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
516{
517 struct input_handler *handler;
518
519 off_t at = 0;
520 int len = 0, cnt = 0;
521 int i = 0;
522
523 list_for_each_entry(handler, &input_handler_list, node) {
524
525 if (handler->fops)
526 len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n",
527 i++, handler->name, handler->minor);
528 else
529 len = sprintf(buf, "N: Number=%d Name=%s\n",
530 i++, handler->name);
531
532 at += len;
533
534 if (at >= pos) {
535 if (!*start) {
536 *start = buf + (pos - (at - len));
537 cnt = at - pos;
538 } else cnt += len;
539 buf += len;
540 if (cnt >= count)
541 break;
542 }
543 }
544 if (&handler->node == &input_handler_list)
545 *eof = 1;
546
547 return (count > cnt) ? cnt : count;
548}
549
550static struct file_operations input_fileops;
551
552static int __init input_proc_init(void)
553{
554 struct proc_dir_entry *entry;
555
556 proc_bus_input_dir = proc_mkdir("input", proc_bus);
557 if (!proc_bus_input_dir)
558 return -ENOMEM;
559
560 proc_bus_input_dir->owner = THIS_MODULE;
561
562 entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL);
563 if (!entry)
564 goto fail1;
565
566 entry->owner = THIS_MODULE;
567 input_fileops = *entry->proc_fops;
568 entry->proc_fops = &input_fileops;
569 entry->proc_fops->poll = input_devices_poll;
570
571 entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);
572 if (!entry)
573 goto fail2;
574
575 entry->owner = THIS_MODULE;
576
577 return 0;
578
579 fail2: remove_proc_entry("devices", proc_bus_input_dir);
580 fail1: remove_proc_entry("input", proc_bus);
581 return -ENOMEM;
582}
583
584static void input_proc_exit(void)
585{
586 remove_proc_entry("devices", proc_bus_input_dir);
587 remove_proc_entry("handlers", proc_bus_input_dir);
588 remove_proc_entry("input", proc_bus);
589}
590
591#else /* !CONFIG_PROC_FS */
592static inline void input_wakeup_procfs_readers(void) { }
593static inline int input_proc_init(void) { return 0; }
594static inline void input_proc_exit(void) { }
595#endif
596
431void input_register_device(struct input_dev *dev) 597void input_register_device(struct input_dev *dev)
432{ 598{
433 struct input_handle *handle; 599 struct input_handle *handle;
@@ -464,10 +630,7 @@ void input_register_device(struct input_dev *dev)
464 input_call_hotplug("add", dev); 630 input_call_hotplug("add", dev);
465#endif 631#endif
466 632
467#ifdef CONFIG_PROC_FS 633 input_wakeup_procfs_readers();
468 input_devices_state++;
469 wake_up(&input_devices_poll_wait);
470#endif
471} 634}
472 635
473void input_unregister_device(struct input_dev *dev) 636void input_unregister_device(struct input_dev *dev)
@@ -491,10 +654,7 @@ void input_unregister_device(struct input_dev *dev)
491 654
492 list_del_init(&dev->node); 655 list_del_init(&dev->node);
493 656
494#ifdef CONFIG_PROC_FS 657 input_wakeup_procfs_readers();
495 input_devices_state++;
496 wake_up(&input_devices_poll_wait);
497#endif
498} 658}
499 659
500void input_register_handler(struct input_handler *handler) 660void input_register_handler(struct input_handler *handler)
@@ -518,10 +678,7 @@ void input_register_handler(struct input_handler *handler)
518 if ((handle = handler->connect(handler, dev, id))) 678 if ((handle = handler->connect(handler, dev, id)))
519 input_link_handle(handle); 679 input_link_handle(handle);
520 680
521#ifdef CONFIG_PROC_FS 681 input_wakeup_procfs_readers();
522 input_devices_state++;
523 wake_up(&input_devices_poll_wait);
524#endif
525} 682}
526 683
527void input_unregister_handler(struct input_handler *handler) 684void input_unregister_handler(struct input_handler *handler)
@@ -540,10 +697,7 @@ void input_unregister_handler(struct input_handler *handler)
540 if (handler->fops != NULL) 697 if (handler->fops != NULL)
541 input_table[handler->minor >> 5] = NULL; 698 input_table[handler->minor >> 5] = NULL;
542 699
543#ifdef CONFIG_PROC_FS 700 input_wakeup_procfs_readers();
544 input_devices_state++;
545 wake_up(&input_devices_poll_wait);
546#endif
547} 701}
548 702
549static int input_open_file(struct inode *inode, struct file *file) 703static int input_open_file(struct inode *inode, struct file *file)
@@ -582,190 +736,43 @@ static struct file_operations input_fops = {
582 .open = input_open_file, 736 .open = input_open_file,
583}; 737};
584 738
585#ifdef CONFIG_PROC_FS 739struct class *input_class;
586
587#define SPRINTF_BIT_B(bit, name, max) \
588 do { \
589 len += sprintf(buf + len, "B: %s", name); \
590 for (i = NBITS(max) - 1; i >= 0; i--) \
591 if (dev->bit[i]) break; \
592 for (; i >= 0; i--) \
593 len += sprintf(buf + len, "%lx ", dev->bit[i]); \
594 len += sprintf(buf + len, "\n"); \
595 } while (0)
596
597#define SPRINTF_BIT_B2(bit, name, max, ev) \
598 do { \
599 if (test_bit(ev, dev->evbit)) \
600 SPRINTF_BIT_B(bit, name, max); \
601 } while (0)
602
603
604static unsigned int input_devices_poll(struct file *file, poll_table *wait)
605{
606 int state = input_devices_state;
607 poll_wait(file, &input_devices_poll_wait, wait);
608 if (state != input_devices_state)
609 return POLLIN | POLLRDNORM;
610 return 0;
611}
612 740
613static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) 741static int __init input_init(void)
614{ 742{
615 struct input_dev *dev; 743 int err;
616 struct input_handle *handle;
617
618 off_t at = 0;
619 int i, len, cnt = 0;
620
621 list_for_each_entry(dev, &input_dev_list, node) {
622
623 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
624 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
625
626 len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
627 len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : "");
628 len += sprintf(buf + len, "H: Handlers=");
629
630 list_for_each_entry(handle, &dev->h_list, d_node)
631 len += sprintf(buf + len, "%s ", handle->name);
632
633 len += sprintf(buf + len, "\n");
634
635 SPRINTF_BIT_B(evbit, "EV=", EV_MAX);
636 SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY);
637 SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL);
638 SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS);
639 SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC);
640 SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED);
641 SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND);
642 SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF);
643
644 len += sprintf(buf + len, "\n");
645
646 at += len;
647 744
648 if (at >= pos) { 745 input_class = class_create(THIS_MODULE, "input");
649 if (!*start) { 746 if (IS_ERR(input_class)) {
650 *start = buf + (pos - (at - len)); 747 printk(KERN_ERR "input: unable to register input class\n");
651 cnt = at - pos; 748 return PTR_ERR(input_class);
652 } else cnt += len;
653 buf += len;
654 if (cnt >= count)
655 break;
656 }
657 } 749 }
658 750
659 if (&dev->node == &input_dev_list) 751 err = input_proc_init();
660 *eof = 1; 752 if (err)
661 753 goto fail1;
662 return (count > cnt) ? cnt : count;
663}
664
665static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
666{
667 struct input_handler *handler;
668
669 off_t at = 0;
670 int len = 0, cnt = 0;
671 int i = 0;
672
673 list_for_each_entry(handler, &input_handler_list, node) {
674
675 if (handler->fops)
676 len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n",
677 i++, handler->name, handler->minor);
678 else
679 len = sprintf(buf, "N: Number=%d Name=%s\n",
680 i++, handler->name);
681
682 at += len;
683 754
684 if (at >= pos) { 755 err = register_chrdev(INPUT_MAJOR, "input", &input_fops);
685 if (!*start) { 756 if (err) {
686 *start = buf + (pos - (at - len)); 757 printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR);
687 cnt = at - pos; 758 goto fail2;
688 } else cnt += len;
689 buf += len;
690 if (cnt >= count)
691 break;
692 }
693 } 759 }
694 if (&handler->node == &input_handler_list)
695 *eof = 1;
696
697 return (count > cnt) ? cnt : count;
698}
699
700static struct file_operations input_fileops;
701 760
702static int __init input_proc_init(void) 761 err = devfs_mk_dir("input");
703{ 762 if (err)
704 struct proc_dir_entry *entry; 763 goto fail3;
705 764
706 proc_bus_input_dir = proc_mkdir("input", proc_bus);
707 if (proc_bus_input_dir == NULL)
708 return -ENOMEM;
709 proc_bus_input_dir->owner = THIS_MODULE;
710 entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL);
711 if (entry == NULL) {
712 remove_proc_entry("input", proc_bus);
713 return -ENOMEM;
714 }
715 entry->owner = THIS_MODULE;
716 input_fileops = *entry->proc_fops;
717 entry->proc_fops = &input_fileops;
718 entry->proc_fops->poll = input_devices_poll;
719 entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);
720 if (entry == NULL) {
721 remove_proc_entry("devices", proc_bus_input_dir);
722 remove_proc_entry("input", proc_bus);
723 return -ENOMEM;
724 }
725 entry->owner = THIS_MODULE;
726 return 0; 765 return 0;
727}
728#else /* !CONFIG_PROC_FS */
729static inline int input_proc_init(void) { return 0; }
730#endif
731 766
732struct class *input_class; 767 fail3: unregister_chrdev(INPUT_MAJOR, "input");
733 768 fail2: input_proc_exit();
734static int __init input_init(void) 769 fail1: class_destroy(input_class);
735{ 770 return err;
736 int retval = -ENOMEM;
737
738 input_class = class_create(THIS_MODULE, "input");
739 if (IS_ERR(input_class))
740 return PTR_ERR(input_class);
741 input_proc_init();
742 retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
743 if (retval) {
744 printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR);
745 remove_proc_entry("devices", proc_bus_input_dir);
746 remove_proc_entry("handlers", proc_bus_input_dir);
747 remove_proc_entry("input", proc_bus);
748 class_destroy(input_class);
749 return retval;
750 }
751
752 retval = devfs_mk_dir("input");
753 if (retval) {
754 remove_proc_entry("devices", proc_bus_input_dir);
755 remove_proc_entry("handlers", proc_bus_input_dir);
756 remove_proc_entry("input", proc_bus);
757 unregister_chrdev(INPUT_MAJOR, "input");
758 class_destroy(input_class);
759 }
760 return retval;
761} 771}
762 772
763static void __exit input_exit(void) 773static void __exit input_exit(void)
764{ 774{
765 remove_proc_entry("devices", proc_bus_input_dir); 775 input_proc_exit();
766 remove_proc_entry("handlers", proc_bus_input_dir);
767 remove_proc_entry("input", proc_bus);
768
769 devfs_remove("input"); 776 devfs_remove("input");
770 unregister_chrdev(INPUT_MAJOR, "input"); 777 unregister_chrdev(INPUT_MAJOR, "input");
771 class_destroy(input_class); 778 class_destroy(input_class);
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index ff8e1bbd0e13..e0938d1d3ad7 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -37,8 +37,6 @@ MODULE_LICENSE("GPL");
37#define JOYDEV_MINORS 16 37#define JOYDEV_MINORS 16
38#define JOYDEV_BUFFER_SIZE 64 38#define JOYDEV_BUFFER_SIZE 64
39 39
40#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
41
42struct joydev { 40struct joydev {
43 int exist; 41 int exist;
44 int open; 42 int open;
@@ -117,7 +115,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
117 return; 115 return;
118 } 116 }
119 117
120 event.time = MSECS(jiffies); 118 event.time = jiffies_to_msecs(jiffies);
121 119
122 list_for_each_entry(list, &joydev->list, node) { 120 list_for_each_entry(list, &joydev->list, node) {
123 121
@@ -245,7 +243,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo
245 243
246 struct js_event event; 244 struct js_event event;
247 245
248 event.time = MSECS(jiffies); 246 event.time = jiffies_to_msecs(jiffies);
249 247
250 if (list->startup < joydev->nkey) { 248 if (list->startup < joydev->nkey) {
251 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; 249 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT;
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 98710997aaaa..d5c5b32045af 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -36,16 +36,6 @@
36#include <linux/miscdevice.h> 36#include <linux/miscdevice.h>
37#include <linux/uinput.h> 37#include <linux/uinput.h>
38 38
39static int uinput_dev_open(struct input_dev *dev)
40{
41 return 0;
42}
43
44static void uinput_dev_close(struct input_dev *dev)
45{
46
47}
48
49static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 39static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
50{ 40{
51 struct uinput_device *udev; 41 struct uinput_device *udev;
@@ -63,22 +53,24 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i
63 return 0; 53 return 0;
64} 54}
65 55
66static int uinput_request_alloc_id(struct input_dev *dev, struct uinput_request *request) 56static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request)
67{ 57{
68 /* Atomically allocate an ID for the given request. Returns 0 on success. */ 58 /* Atomically allocate an ID for the given request. Returns 0 on success. */
69 struct uinput_device *udev = dev->private;
70 int id; 59 int id;
60 int err = -1;
61
62 spin_lock(&udev->requests_lock);
71 63
72 down(&udev->requests_sem); 64 for (id = 0; id < UINPUT_NUM_REQUESTS; id++)
73 for (id=0; id<UINPUT_NUM_REQUESTS; id++)
74 if (!udev->requests[id]) { 65 if (!udev->requests[id]) {
75 udev->requests[id] = request;
76 request->id = id; 66 request->id = id;
77 up(&udev->requests_sem); 67 udev->requests[id] = request;
78 return 0; 68 err = 0;
69 break;
79 } 70 }
80 up(&udev->requests_sem); 71
81 return -1; 72 spin_unlock(&udev->requests_lock);
73 return err;
82} 74}
83 75
84static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) 76static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id)
@@ -86,70 +78,78 @@ static struct uinput_request* uinput_request_find(struct uinput_device *udev, in
86 /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ 78 /* Find an input request, by ID. Returns NULL if the ID isn't valid. */
87 if (id >= UINPUT_NUM_REQUESTS || id < 0) 79 if (id >= UINPUT_NUM_REQUESTS || id < 0)
88 return NULL; 80 return NULL;
89 if (udev->requests[id]->completed)
90 return NULL;
91 return udev->requests[id]; 81 return udev->requests[id];
92} 82}
93 83
94static void uinput_request_init(struct input_dev *dev, struct uinput_request *request, int code) 84static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request)
95{ 85{
96 struct uinput_device *udev = dev->private; 86 /* Allocate slot. If none are available right away, wait. */
87 return wait_event_interruptible(udev->requests_waitq,
88 !uinput_request_alloc_id(udev, request));
89}
97 90
98 memset(request, 0, sizeof(struct uinput_request)); 91static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request)
99 request->code = code; 92{
100 init_waitqueue_head(&request->waitq); 93 complete(&request->done);
101 94
102 /* Allocate an ID. If none are available right away, wait. */ 95 /* Mark slot as available */
103 request->retval = wait_event_interruptible(udev->requests_waitq, 96 udev->requests[request->id] = NULL;
104 !uinput_request_alloc_id(dev, request)); 97 wake_up_interruptible(&udev->requests_waitq);
105} 98}
106 99
107static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) 100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)
108{ 101{
109 struct uinput_device *udev = dev->private;
110 int retval; 102 int retval;
111 103
112 /* Tell our userspace app about this new request by queueing an input event */ 104 /* Tell our userspace app about this new request by queueing an input event */
113 uinput_dev_event(dev, EV_UINPUT, request->code, request->id); 105 uinput_dev_event(dev, EV_UINPUT, request->code, request->id);
114 106
115 /* Wait for the request to complete */ 107 /* Wait for the request to complete */
116 retval = wait_event_interruptible(request->waitq, request->completed); 108 retval = wait_for_completion_interruptible(&request->done);
117 if (retval) 109 if (!retval)
118 request->retval = retval; 110 retval = request->retval;
119 111
120 /* Release this request's ID, let others know it's available */ 112 return retval;
121 udev->requests[request->id] = NULL;
122 wake_up_interruptible(&udev->requests_waitq);
123} 113}
124 114
125static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) 115static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)
126{ 116{
127 struct uinput_request request; 117 struct uinput_request request;
118 int retval;
128 119
129 if (!test_bit(EV_FF, dev->evbit)) 120 if (!test_bit(EV_FF, dev->evbit))
130 return -ENOSYS; 121 return -ENOSYS;
131 122
132 uinput_request_init(dev, &request, UI_FF_UPLOAD); 123 request.id = -1;
133 if (request.retval) 124 init_completion(&request.done);
134 return request.retval; 125 request.code = UI_FF_UPLOAD;
135 request.u.effect = effect; 126 request.u.effect = effect;
136 uinput_request_submit(dev, &request); 127
137 return request.retval; 128 retval = uinput_request_reserve_slot(dev->private, &request);
129 if (!retval)
130 retval = uinput_request_submit(dev, &request);
131
132 return retval;
138} 133}
139 134
140static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) 135static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
141{ 136{
142 struct uinput_request request; 137 struct uinput_request request;
138 int retval;
143 139
144 if (!test_bit(EV_FF, dev->evbit)) 140 if (!test_bit(EV_FF, dev->evbit))
145 return -ENOSYS; 141 return -ENOSYS;
146 142
147 uinput_request_init(dev, &request, UI_FF_ERASE); 143 request.id = -1;
148 if (request.retval) 144 init_completion(&request.done);
149 return request.retval; 145 request.code = UI_FF_ERASE;
150 request.u.effect_id = effect_id; 146 request.u.effect_id = effect_id;
151 uinput_request_submit(dev, &request); 147
152 return request.retval; 148 retval = uinput_request_reserve_slot(dev->private, &request);
149 if (!retval)
150 retval = uinput_request_submit(dev, &request);
151
152 return retval;
153} 153}
154 154
155static int uinput_create_device(struct uinput_device *udev) 155static int uinput_create_device(struct uinput_device *udev)
@@ -159,32 +159,30 @@ static int uinput_create_device(struct uinput_device *udev)
159 return -EINVAL; 159 return -EINVAL;
160 } 160 }
161 161
162 udev->dev->open = uinput_dev_open;
163 udev->dev->close = uinput_dev_close;
164 udev->dev->event = uinput_dev_event; 162 udev->dev->event = uinput_dev_event;
165 udev->dev->upload_effect = uinput_dev_upload_effect; 163 udev->dev->upload_effect = uinput_dev_upload_effect;
166 udev->dev->erase_effect = uinput_dev_erase_effect; 164 udev->dev->erase_effect = uinput_dev_erase_effect;
167 udev->dev->private = udev; 165 udev->dev->private = udev;
168 166
169 init_waitqueue_head(&(udev->waitq)); 167 init_waitqueue_head(&udev->waitq);
170 168
171 input_register_device(udev->dev); 169 input_register_device(udev->dev);
172 170
173 set_bit(UIST_CREATED, &(udev->state)); 171 set_bit(UIST_CREATED, &udev->state);
174 172
175 return 0; 173 return 0;
176} 174}
177 175
178static int uinput_destroy_device(struct uinput_device *udev) 176static int uinput_destroy_device(struct uinput_device *udev)
179{ 177{
180 if (!test_bit(UIST_CREATED, &(udev->state))) { 178 if (!test_bit(UIST_CREATED, &udev->state)) {
181 printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); 179 printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME);
182 return -EINVAL; 180 return -EINVAL;
183 } 181 }
184 182
185 input_unregister_device(udev->dev); 183 input_unregister_device(udev->dev);
186 184
187 clear_bit(UIST_CREATED, &(udev->state)); 185 clear_bit(UIST_CREATED, &udev->state);
188 186
189 return 0; 187 return 0;
190} 188}
@@ -198,7 +196,7 @@ static int uinput_open(struct inode *inode, struct file *file)
198 if (!newdev) 196 if (!newdev)
199 goto error; 197 goto error;
200 memset(newdev, 0, sizeof(struct uinput_device)); 198 memset(newdev, 0, sizeof(struct uinput_device));
201 init_MUTEX(&newdev->requests_sem); 199 spin_lock_init(&newdev->requests_lock);
202 init_waitqueue_head(&newdev->requests_waitq); 200 init_waitqueue_head(&newdev->requests_waitq);
203 201
204 newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); 202 newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
@@ -253,15 +251,16 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
253 struct uinput_user_dev *user_dev; 251 struct uinput_user_dev *user_dev;
254 struct input_dev *dev; 252 struct input_dev *dev;
255 struct uinput_device *udev; 253 struct uinput_device *udev;
256 int size, 254 char *name;
257 retval; 255 int size;
256 int retval;
258 257
259 retval = count; 258 retval = count;
260 259
261 udev = file->private_data; 260 udev = file->private_data;
262 dev = udev->dev; 261 dev = udev->dev;
263 262
264 user_dev = kmalloc(sizeof(*user_dev), GFP_KERNEL); 263 user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL);
265 if (!user_dev) { 264 if (!user_dev) {
266 retval = -ENOMEM; 265 retval = -ENOMEM;
267 goto exit; 266 goto exit;
@@ -272,17 +271,17 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
272 goto exit; 271 goto exit;
273 } 272 }
274 273
275 if (NULL != dev->name) 274 if (dev->name)
276 kfree(dev->name); 275 kfree(dev->name);
277 276
278 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; 277 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
279 dev->name = kmalloc(size, GFP_KERNEL); 278 dev->name = name = kmalloc(size, GFP_KERNEL);
280 if (!dev->name) { 279 if (!name) {
281 retval = -ENOMEM; 280 retval = -ENOMEM;
282 goto exit; 281 goto exit;
283 } 282 }
283 strlcpy(name, user_dev->name, size);
284 284
285 strlcpy(dev->name, user_dev->name, size);
286 dev->id.bustype = user_dev->id.bustype; 285 dev->id.bustype = user_dev->id.bustype;
287 dev->id.vendor = user_dev->id.vendor; 286 dev->id.vendor = user_dev->id.vendor;
288 dev->id.product = user_dev->id.product; 287 dev->id.product = user_dev->id.product;
@@ -314,14 +313,13 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t
314{ 313{
315 struct uinput_device *udev = file->private_data; 314 struct uinput_device *udev = file->private_data;
316 315
317 if (test_bit(UIST_CREATED, &(udev->state))) { 316 if (test_bit(UIST_CREATED, &udev->state)) {
318 struct input_event ev; 317 struct input_event ev;
319 318
320 if (copy_from_user(&ev, buffer, sizeof(struct input_event))) 319 if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
321 return -EFAULT; 320 return -EFAULT;
322 input_event(udev->dev, ev.type, ev.code, ev.value); 321 input_event(udev->dev, ev.type, ev.code, ev.value);
323 } 322 } else
324 else
325 count = uinput_alloc_device(file, buffer, count); 323 count = uinput_alloc_device(file, buffer, count);
326 324
327 return count; 325 return count;
@@ -332,26 +330,24 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count,
332 struct uinput_device *udev = file->private_data; 330 struct uinput_device *udev = file->private_data;
333 int retval = 0; 331 int retval = 0;
334 332
335 if (!test_bit(UIST_CREATED, &(udev->state))) 333 if (!test_bit(UIST_CREATED, &udev->state))
336 return -ENODEV; 334 return -ENODEV;
337 335
338 if ((udev->head == udev->tail) && (file->f_flags & O_NONBLOCK)) 336 if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK))
339 return -EAGAIN; 337 return -EAGAIN;
340 338
341 retval = wait_event_interruptible(udev->waitq, 339 retval = wait_event_interruptible(udev->waitq,
342 (udev->head != udev->tail) || 340 udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state));
343 !test_bit(UIST_CREATED, &(udev->state)));
344
345 if (retval) 341 if (retval)
346 return retval; 342 return retval;
347 343
348 if (!test_bit(UIST_CREATED, &(udev->state))) 344 if (!test_bit(UIST_CREATED, &udev->state))
349 return -ENODEV; 345 return -ENODEV;
350 346
351 while ((udev->head != udev->tail) && 347 while ((udev->head != udev->tail) &&
352 (retval + sizeof(struct input_event) <= count)) { 348 (retval + sizeof(struct input_event) <= count)) {
353 if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), 349 if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event)))
354 sizeof(struct input_event))) return -EFAULT; 350 return -EFAULT;
355 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; 351 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE;
356 retval += sizeof(struct input_event); 352 retval += sizeof(struct input_event);
357 } 353 }
@@ -373,12 +369,12 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait)
373 369
374static int uinput_burn_device(struct uinput_device *udev) 370static int uinput_burn_device(struct uinput_device *udev)
375{ 371{
376 if (test_bit(UIST_CREATED, &(udev->state))) 372 if (test_bit(UIST_CREATED, &udev->state))
377 uinput_destroy_device(udev); 373 uinput_destroy_device(udev);
378 374
379 if (NULL != udev->dev->name) 375 if (udev->dev->name)
380 kfree(udev->dev->name); 376 kfree(udev->dev->name);
381 if (NULL != udev->dev->phys) 377 if (udev->dev->phys)
382 kfree(udev->dev->phys); 378 kfree(udev->dev->phys);
383 379
384 kfree(udev->dev); 380 kfree(udev->dev);
@@ -389,7 +385,8 @@ static int uinput_burn_device(struct uinput_device *udev)
389 385
390static int uinput_close(struct inode *inode, struct file *file) 386static int uinput_close(struct inode *inode, struct file *file)
391{ 387{
392 return uinput_burn_device(file->private_data); 388 uinput_burn_device(file->private_data);
389 return 0;
393} 390}
394 391
395static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 392static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -401,6 +398,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
401 struct uinput_ff_erase ff_erase; 398 struct uinput_ff_erase ff_erase;
402 struct uinput_request *req; 399 struct uinput_request *req;
403 int length; 400 int length;
401 char *phys;
404 402
405 udev = file->private_data; 403 udev = file->private_data;
406 404
@@ -415,7 +413,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
415 case UI_SET_SNDBIT: 413 case UI_SET_SNDBIT:
416 case UI_SET_FFBIT: 414 case UI_SET_FFBIT:
417 case UI_SET_PHYS: 415 case UI_SET_PHYS:
418 if (test_bit(UIST_CREATED, &(udev->state))) 416 if (test_bit(UIST_CREATED, &udev->state))
419 return -EINVAL; 417 return -EINVAL;
420 } 418 }
421 419
@@ -498,20 +496,19 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
498 retval = -EFAULT; 496 retval = -EFAULT;
499 break; 497 break;
500 } 498 }
501 if (NULL != udev->dev->phys) 499 kfree(udev->dev->phys);
502 kfree(udev->dev->phys); 500 udev->dev->phys = phys = kmalloc(length, GFP_KERNEL);
503 udev->dev->phys = kmalloc(length, GFP_KERNEL); 501 if (!phys) {
504 if (!udev->dev->phys) {
505 retval = -ENOMEM; 502 retval = -ENOMEM;
506 break; 503 break;
507 } 504 }
508 if (copy_from_user(udev->dev->phys, p, length)) { 505 if (copy_from_user(phys, p, length)) {
509 retval = -EFAULT;
510 kfree(udev->dev->phys);
511 udev->dev->phys = NULL; 506 udev->dev->phys = NULL;
507 kfree(phys);
508 retval = -EFAULT;
512 break; 509 break;
513 } 510 }
514 udev->dev->phys[length-1] = '\0'; 511 phys[length - 1] = '\0';
515 break; 512 break;
516 513
517 case UI_BEGIN_FF_UPLOAD: 514 case UI_BEGIN_FF_UPLOAD:
@@ -520,7 +517,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
520 break; 517 break;
521 } 518 }
522 req = uinput_request_find(udev, ff_up.request_id); 519 req = uinput_request_find(udev, ff_up.request_id);
523 if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { 520 if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) {
524 retval = -EINVAL; 521 retval = -EINVAL;
525 break; 522 break;
526 } 523 }
@@ -538,7 +535,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
538 break; 535 break;
539 } 536 }
540 req = uinput_request_find(udev, ff_erase.request_id); 537 req = uinput_request_find(udev, ff_erase.request_id);
541 if (!(req && req->code==UI_FF_ERASE)) { 538 if (!(req && req->code == UI_FF_ERASE)) {
542 retval = -EINVAL; 539 retval = -EINVAL;
543 break; 540 break;
544 } 541 }
@@ -556,14 +553,13 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
556 break; 553 break;
557 } 554 }
558 req = uinput_request_find(udev, ff_up.request_id); 555 req = uinput_request_find(udev, ff_up.request_id);
559 if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { 556 if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) {
560 retval = -EINVAL; 557 retval = -EINVAL;
561 break; 558 break;
562 } 559 }
563 req->retval = ff_up.retval; 560 req->retval = ff_up.retval;
564 memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); 561 memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect));
565 req->completed = 1; 562 uinput_request_done(udev, req);
566 wake_up_interruptible(&req->waitq);
567 break; 563 break;
568 564
569 case UI_END_FF_ERASE: 565 case UI_END_FF_ERASE:
@@ -572,13 +568,12 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
572 break; 568 break;
573 } 569 }
574 req = uinput_request_find(udev, ff_erase.request_id); 570 req = uinput_request_find(udev, ff_erase.request_id);
575 if (!(req && req->code==UI_FF_ERASE)) { 571 if (!(req && req->code == UI_FF_ERASE)) {
576 retval = -EINVAL; 572 retval = -EINVAL;
577 break; 573 break;
578 } 574 }
579 req->retval = ff_erase.retval; 575 req->retval = ff_erase.retval;
580 req->completed = 1; 576 uinput_request_done(udev, req);
581 wake_up_interruptible(&req->waitq);
582 break; 577 break;
583 578
584 default: 579 default:
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index a12e98158a75..0d68e5e0182a 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2,7 +2,7 @@
2 * ALPS touchpad PS/2 mouse driver 2 * ALPS touchpad PS/2 mouse driver
3 * 3 *
4 * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> 4 * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au>
5 * Copyright (c) 2003 Peter Osterlund <petero2@telia.com> 5 * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com>
6 * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> 6 * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru>
7 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> 7 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>
8 * 8 *
@@ -350,7 +350,6 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable)
350static int alps_reconnect(struct psmouse *psmouse) 350static int alps_reconnect(struct psmouse *psmouse)
351{ 351{
352 struct alps_data *priv = psmouse->private; 352 struct alps_data *priv = psmouse->private;
353 unsigned char param[4];
354 int version; 353 int version;
355 354
356 psmouse_reset(psmouse); 355 psmouse_reset(psmouse);
@@ -358,21 +357,20 @@ static int alps_reconnect(struct psmouse *psmouse)
358 if (!(priv->i = alps_get_model(psmouse, &version))) 357 if (!(priv->i = alps_get_model(psmouse, &version)))
359 return -1; 358 return -1;
360 359
361 if (priv->i->flags & ALPS_PASS && alps_passthrough_mode(psmouse, 1)) 360 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
362 return -1; 361 return -1;
363 362
364 if (alps_get_status(psmouse, param)) 363 if (alps_tap_mode(psmouse, 1)) {
364 printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n");
365 return -1; 365 return -1;
366 366 }
367 if (!(param[0] & 0x04))
368 alps_tap_mode(psmouse, 1);
369 367
370 if (alps_absolute_mode(psmouse)) { 368 if (alps_absolute_mode(psmouse)) {
371 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); 369 printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n");
372 return -1; 370 return -1;
373 } 371 }
374 372
375 if (priv->i->flags == ALPS_PASS && alps_passthrough_mode(psmouse, 0)) 373 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
376 return -1; 374 return -1;
377 375
378 return 0; 376 return 0;
@@ -389,7 +387,6 @@ static void alps_disconnect(struct psmouse *psmouse)
389int alps_init(struct psmouse *psmouse) 387int alps_init(struct psmouse *psmouse)
390{ 388{
391 struct alps_data *priv; 389 struct alps_data *priv;
392 unsigned char param[4];
393 int version; 390 int version;
394 391
395 psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); 392 psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL);
@@ -403,16 +400,8 @@ int alps_init(struct psmouse *psmouse)
403 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 400 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
404 goto init_fail; 401 goto init_fail;
405 402
406 if (alps_get_status(psmouse, param)) { 403 if (alps_tap_mode(psmouse, 1))
407 printk(KERN_ERR "alps.c: touchpad status report request failed\n"); 404 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
408 goto init_fail;
409 }
410
411 if (param[0] & 0x04) {
412 printk(KERN_INFO "alps.c: Enabling hardware tapping\n");
413 if (alps_tap_mode(psmouse, 1))
414 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
415 }
416 405
417 if (alps_absolute_mode(psmouse)) { 406 if (alps_absolute_mode(psmouse)) {
418 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); 407 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 5ab1bd7d529d..48d2b20d2642 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -385,8 +385,6 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
385 385
386 if (buttons < 3) 386 if (buttons < 3)
387 clear_bit(BTN_MIDDLE, psmouse->dev.keybit); 387 clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
388 if (buttons < 2)
389 clear_bit(BTN_RIGHT, psmouse->dev.keybit);
390 388
391 if (model_info) 389 if (model_info)
392 ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); 390 ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 19785a6c5abd..2bb2fe78bdca 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -344,6 +344,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties)
344 return -1; 344 return -1;
345 345
346 if (set_properties) { 346 if (set_properties) {
347 set_bit(BTN_MIDDLE, psmouse->dev.keybit);
347 set_bit(REL_WHEEL, psmouse->dev.relbit); 348 set_bit(REL_WHEEL, psmouse->dev.relbit);
348 349
349 if (!psmouse->vendor) psmouse->vendor = "Generic"; 350 if (!psmouse->vendor) psmouse->vendor = "Generic";
@@ -376,6 +377,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties)
376 return -1; 377 return -1;
377 378
378 if (set_properties) { 379 if (set_properties) {
380 set_bit(BTN_MIDDLE, psmouse->dev.keybit);
379 set_bit(REL_WHEEL, psmouse->dev.relbit); 381 set_bit(REL_WHEEL, psmouse->dev.relbit);
380 set_bit(BTN_SIDE, psmouse->dev.keybit); 382 set_bit(BTN_SIDE, psmouse->dev.keybit);
381 set_bit(BTN_EXTRA, psmouse->dev.keybit); 383 set_bit(BTN_EXTRA, psmouse->dev.keybit);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 36c721227b68..029309422409 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -219,7 +219,7 @@ static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet
219 serio_interrupt(ptport, packet[1], 0, NULL); 219 serio_interrupt(ptport, packet[1], 0, NULL);
220 serio_interrupt(ptport, packet[4], 0, NULL); 220 serio_interrupt(ptport, packet[4], 0, NULL);
221 serio_interrupt(ptport, packet[5], 0, NULL); 221 serio_interrupt(ptport, packet[5], 0, NULL);
222 if (child->type >= PSMOUSE_GENPS) 222 if (child->pktsize == 4)
223 serio_interrupt(ptport, packet[2], 0, NULL); 223 serio_interrupt(ptport, packet[2], 0, NULL);
224 } else 224 } else
225 serio_interrupt(ptport, packet[1], 0, NULL); 225 serio_interrupt(ptport, packet[1], 0, NULL);
@@ -233,7 +233,7 @@ static void synaptics_pt_activate(struct psmouse *psmouse)
233 233
234 /* adjust the touchpad to child's choice of protocol */ 234 /* adjust the touchpad to child's choice of protocol */
235 if (child) { 235 if (child) {
236 if (child->type >= PSMOUSE_GENPS) 236 if (child->pktsize == 4)
237 priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; 237 priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT;
238 else 238 else
239 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; 239 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT;
@@ -608,6 +608,13 @@ static struct dmi_system_id toshiba_dmi_table[] = {
608 DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), 608 DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"),
609 }, 609 },
610 }, 610 },
611 {
612 .ident = "Toshiba Dynabook",
613 .matches = {
614 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
615 DMI_MATCH(DMI_PRODUCT_NAME , "dynabook"),
616 },
617 },
611 { } 618 { }
612}; 619};
613#endif 620#endif
@@ -656,7 +663,8 @@ int synaptics_init(struct psmouse *psmouse)
656 * thye same as rate of standard PS/2 mouse. 663 * thye same as rate of standard PS/2 mouse.
657 */ 664 */
658 if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { 665 if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) {
659 printk(KERN_INFO "synaptics: Toshiba Satellite detected, limiting rate to 40pps.\n"); 666 printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n",
667 dmi_get_system_info(DMI_PRODUCT_NAME));
660 psmouse->rate = 40; 668 psmouse->rate = 40;
661 } 669 }
662#endif 670#endif
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index b3710733b36b..98acf170252c 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -175,7 +175,7 @@ config SERIO_RAW
175 allocating minor 1 (that historically corresponds to /dev/psaux) 175 allocating minor 1 (that historically corresponds to /dev/psaux)
176 first. To bind this driver to a serio port use sysfs interface: 176 first. To bind this driver to a serio port use sysfs interface:
177 177
178 echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver 178 echo -n "serio_raw" > /sys/bus/serio/devices/serioX/drvctl
179 179
180 To compile this driver as a module, choose M here: the 180 To compile this driver as a module, choose M here: the
181 module will be called serio_raw. 181 module will be called serio_raw.
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 0487ecbb8a49..03877c84e6ff 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -131,12 +131,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
131 }, 131 },
132 }, 132 },
133 { 133 {
134 .ident = "Fujitsu-Siemens Lifebook T3010",
135 .matches = {
136 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
138 },
139 },
140 {
134 .ident = "Toshiba P10", 141 .ident = "Toshiba P10",
135 .matches = { 142 .matches = {
136 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 143 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), 144 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
138 }, 145 },
139 }, 146 },
147 {
148 .ident = "Alienware Sentia",
149 .matches = {
150 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
151 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
152 },
153 },
140 { } 154 { }
141}; 155};
142 156
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index a9bf549c8dc5..708a1d3beab9 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -100,7 +100,7 @@ struct i8042_port {
100static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { 100static struct i8042_port i8042_ports[I8042_NUM_PORTS] = {
101 { 101 {
102 .disable = I8042_CTR_KBDDIS, 102 .disable = I8042_CTR_KBDDIS,
103 .irqen = I8042_CTR_KBDINT, 103 .irqen = I8042_CTR_KBDINT,
104 .mux = -1, 104 .mux = -1,
105 .name = "KBD", 105 .name = "KBD",
106 }, 106 },
@@ -191,41 +191,45 @@ static int i8042_flush(void)
191static int i8042_command(unsigned char *param, int command) 191static int i8042_command(unsigned char *param, int command)
192{ 192{
193 unsigned long flags; 193 unsigned long flags;
194 int retval = 0, i = 0; 194 int i, retval, auxerr = 0;
195 195
196 if (i8042_noloop && command == I8042_CMD_AUX_LOOP) 196 if (i8042_noloop && command == I8042_CMD_AUX_LOOP)
197 return -1; 197 return -1;
198 198
199 spin_lock_irqsave(&i8042_lock, flags); 199 spin_lock_irqsave(&i8042_lock, flags);
200 200
201 retval = i8042_wait_write(); 201 if ((retval = i8042_wait_write()))
202 if (!retval) { 202 goto out;
203 dbg("%02x -> i8042 (command)", command & 0xff); 203
204 i8042_write_command(command & 0xff); 204 dbg("%02x -> i8042 (command)", command & 0xff);
205 i8042_write_command(command & 0xff);
206
207 for (i = 0; i < ((command >> 12) & 0xf); i++) {
208 if ((retval = i8042_wait_write()))
209 goto out;
210 dbg("%02x -> i8042 (parameter)", param[i]);
211 i8042_write_data(param[i]);
205 } 212 }
206 213
207 if (!retval) 214 for (i = 0; i < ((command >> 8) & 0xf); i++) {
208 for (i = 0; i < ((command >> 12) & 0xf); i++) { 215 if ((retval = i8042_wait_read()))
209 if ((retval = i8042_wait_write())) break; 216 goto out;
210 dbg("%02x -> i8042 (parameter)", param[i]);
211 i8042_write_data(param[i]);
212 }
213 217
214 if (!retval) 218 if (command == I8042_CMD_AUX_LOOP &&
215 for (i = 0; i < ((command >> 8) & 0xf); i++) { 219 !(i8042_read_status() & I8042_STR_AUXDATA)) {
216 if ((retval = i8042_wait_read())) break; 220 retval = auxerr = -1;
217 if (i8042_read_status() & I8042_STR_AUXDATA) 221 goto out;
218 param[i] = ~i8042_read_data();
219 else
220 param[i] = i8042_read_data();
221 dbg("%02x <- i8042 (return)", param[i]);
222 } 222 }
223 223
224 spin_unlock_irqrestore(&i8042_lock, flags); 224 param[i] = i8042_read_data();
225 dbg("%02x <- i8042 (return)", param[i]);
226 }
225 227
226 if (retval) 228 if (retval)
227 dbg(" -- i8042 (timeout)"); 229 dbg(" -- i8042 (%s)", auxerr ? "auxerr" : "timeout");
228 230
231 out:
232 spin_unlock_irqrestore(&i8042_lock, flags);
229 return retval; 233 return retval;
230} 234}
231 235
@@ -507,17 +511,17 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version)
507 */ 511 */
508 512
509 param = 0xf0; 513 param = 0xf0;
510 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x0f) 514 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xf0)
511 return -1; 515 return -1;
512 param = mode ? 0x56 : 0xf6; 516 param = mode ? 0x56 : 0xf6;
513 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != (mode ? 0xa9 : 0x09)) 517 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6))
514 return -1; 518 return -1;
515 param = mode ? 0xa4 : 0xa5; 519 param = mode ? 0xa4 : 0xa5;
516 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == (mode ? 0x5b : 0x5a)) 520 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5))
517 return -1; 521 return -1;
518 522
519 if (mux_version) 523 if (mux_version)
520 *mux_version = ~param; 524 *mux_version = param;
521 525
522 return 0; 526 return 0;
523} 527}
@@ -619,7 +623,7 @@ static int __init i8042_check_aux(void)
619 */ 623 */
620 624
621 param = 0x5a; 625 param = 0x5a;
622 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xa5) { 626 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x5a) {
623 627
624/* 628/*
625 * External connection test - filters out AT-soldered PS/2 i8042's 629 * External connection test - filters out AT-soldered PS/2 i8042's
@@ -630,7 +634,7 @@ static int __init i8042_check_aux(void)
630 */ 634 */
631 635
632 if (i8042_command(&param, I8042_CMD_AUX_TEST) 636 if (i8042_command(&param, I8042_CMD_AUX_TEST)
633 || (param && param != 0xfa && param != 0xff)) 637 || (param && param != 0xfa && param != 0xff))
634 return -1; 638 return -1;
635 } 639 }
636 640
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index f367695e69b5..edd15db17715 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -389,6 +389,14 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
389 return sprintf(buf, "%s\n", serio->name); 389 return sprintf(buf, "%s\n", serio->name);
390} 390}
391 391
392static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
393{
394 struct serio *serio = to_serio_port(dev);
395
396 return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n",
397 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
398}
399
392static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) 400static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf)
393{ 401{
394 struct serio *serio = to_serio_port(dev); 402 struct serio *serio = to_serio_port(dev);
@@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
487 495
488static struct device_attribute serio_device_attrs[] = { 496static struct device_attribute serio_device_attrs[] = {
489 __ATTR(description, S_IRUGO, serio_show_description, NULL), 497 __ATTR(description, S_IRUGO, serio_show_description, NULL),
498 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
490 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 499 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
491 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 500 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
492 __ATTR_NULL 501 __ATTR_NULL
@@ -785,36 +794,37 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
785 794
786#ifdef CONFIG_HOTPLUG 795#ifdef CONFIG_HOTPLUG
787 796
788#define PUT_ENVP(fmt, val) \ 797#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \
789do { \ 798 do { \
790 envp[i++] = buffer; \ 799 int err = add_hotplug_env_var(envp, num_envp, &i, \
791 length += snprintf(buffer, buffer_size - length, fmt, val); \ 800 buffer, buffer_size, &len, \
792 if (buffer_size - length <= 0 || i >= num_envp) \ 801 fmt, val); \
793 return -ENOMEM; \ 802 if (err) \
794 length++; \ 803 return err; \
795 buffer += length; \ 804 } while (0)
796} while (0) 805
797static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 806static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
798{ 807{
799 struct serio *serio; 808 struct serio *serio;
800 int i = 0; 809 int i = 0;
801 int length = 0; 810 int len = 0;
802 811
803 if (!dev) 812 if (!dev)
804 return -ENODEV; 813 return -ENODEV;
805 814
806 serio = to_serio_port(dev); 815 serio = to_serio_port(dev);
807 816
808 PUT_ENVP("SERIO_TYPE=%02x", serio->id.type); 817 SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type);
809 PUT_ENVP("SERIO_PROTO=%02x", serio->id.proto); 818 SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto);
810 PUT_ENVP("SERIO_ID=%02x", serio->id.id); 819 SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id);
811 PUT_ENVP("SERIO_EXTRA=%02x", serio->id.extra); 820 SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra);
812 821 SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
822 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
813 envp[i] = NULL; 823 envp[i] = NULL;
814 824
815 return 0; 825 return 0;
816} 826}
817#undef PUT_ENVP 827#undef SERIO_ADD_HOTPLUG_VAR
818 828
819#else 829#else
820 830
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index d914e7e93db4..47e08de18d07 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -299,6 +299,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
299 299
300 serio_raw->dev.minor = PSMOUSE_MINOR; 300 serio_raw->dev.minor = PSMOUSE_MINOR;
301 serio_raw->dev.name = serio_raw->name; 301 serio_raw->dev.name = serio_raw->name;
302 serio_raw->dev.dev = &serio->dev;
302 serio_raw->dev.fops = &serio_raw_fops; 303 serio_raw->dev.fops = &serio_raw_fops;
303 304
304 err = misc_register(&serio_raw->dev); 305 err = misc_register(&serio_raw->dev);
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 7e991274ea40..0489af5a80c9 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -58,7 +58,7 @@ config TOUCHSCREEN_ELO
58 If unsure, say N. 58 If unsure, say N.
59 59
60 To compile this driver as a module, choose M here: the 60 To compile this driver as a module, choose M here: the
61 module will be called gunze. 61 module will be called elo.
62 62
63config TOUCHSCREEN_MTOUCH 63config TOUCHSCREEN_MTOUCH
64 tristate "MicroTouch serial touchscreens" 64 tristate "MicroTouch serial touchscreens"
diff --git a/drivers/isdn/hisax/avm_a1.c b/drivers/isdn/hisax/avm_a1.c
index 8f028d42fd2f..9a8b02557ff9 100644
--- a/drivers/isdn/hisax/avm_a1.c
+++ b/drivers/isdn/hisax/avm_a1.c
@@ -135,7 +135,7 @@ avm_a1_interrupt(int intno, void *dev_id, struct pt_regs *regs)
135 return IRQ_HANDLED; 135 return IRQ_HANDLED;
136} 136}
137 137
138inline static void 138static inline void
139release_ioregs(struct IsdnCardState *cs, int mask) 139release_ioregs(struct IsdnCardState *cs, int mask)
140{ 140{
141 release_region(cs->hw.avm.cfg_reg, 8); 141 release_region(cs->hw.avm.cfg_reg, 8);
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index c542e6fb2bde..fbaab4352902 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1900,6 +1900,7 @@ static struct pci_device_id hisax_pci_tbl[] __initdata = {
1900 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID}, 1900 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID},
1901 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID}, 1901 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID},
1902 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID}, 1902 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID},
1903 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_OLITEC, PCI_ANY_ID, PCI_ANY_ID},
1903#endif 1904#endif
1904#ifdef CONFIG_HISAX_QUADRO 1905#ifdef CONFIG_HISAX_QUADRO
1905 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID}, 1906 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID},
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 352b45ac5347..60b04c6d9e7d 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -546,8 +546,9 @@ setup_gazelpci(struct IsdnCardState *cs)
546 546
547 found = 0; 547 found = 0;
548 seekcard = PCI_DEVICE_ID_PLX_R685; 548 seekcard = PCI_DEVICE_ID_PLX_R685;
549 for (nbseek = 0; nbseek < 3; nbseek++) { 549 for (nbseek = 0; nbseek < 4; nbseek++) {
550 if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX, seekcard, dev_tel))) { 550 if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX,
551 seekcard, dev_tel))) {
551 if (pci_enable_device(dev_tel)) 552 if (pci_enable_device(dev_tel))
552 return 1; 553 return 1;
553 pci_irq = dev_tel->irq; 554 pci_irq = dev_tel->irq;
@@ -565,6 +566,9 @@ setup_gazelpci(struct IsdnCardState *cs)
565 case PCI_DEVICE_ID_PLX_R753: 566 case PCI_DEVICE_ID_PLX_R753:
566 seekcard = PCI_DEVICE_ID_PLX_DJINN_ITOO; 567 seekcard = PCI_DEVICE_ID_PLX_DJINN_ITOO;
567 break; 568 break;
569 case PCI_DEVICE_ID_PLX_DJINN_ITOO:
570 seekcard = PCI_DEVICE_ID_PLX_OLITEC;
571 break;
568 } 572 }
569 } 573 }
570 } 574 }
@@ -605,6 +609,7 @@ setup_gazelpci(struct IsdnCardState *cs)
605 break; 609 break;
606 case PCI_DEVICE_ID_PLX_R753: 610 case PCI_DEVICE_ID_PLX_R753:
607 case PCI_DEVICE_ID_PLX_DJINN_ITOO: 611 case PCI_DEVICE_ID_PLX_DJINN_ITOO:
612 case PCI_DEVICE_ID_PLX_OLITEC:
608 printk(KERN_INFO "Gazel: Card PCI R753 found\n"); 613 printk(KERN_INFO "Gazel: Card PCI R753 found\n");
609 cs->subtyp = R753; 614 cs->subtyp = R753;
610 test_and_set_bit(HW_IPAC, &cs->HW_Flags); 615 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index 1615c1a76ab8..6d0431725555 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -213,7 +213,7 @@ sethdraddr(struct Layer2 *l2, u_char * header, int rsp)
213 } 213 }
214} 214}
215 215
216inline static void 216static inline void
217enqueue_super(struct PStack *st, 217enqueue_super(struct PStack *st,
218 struct sk_buff *skb) 218 struct sk_buff *skb)
219{ 219{
diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c
index a6d2abdb478a..e96845cdd4f6 100644
--- a/drivers/isdn/hisax/l3dss1.c
+++ b/drivers/isdn/hisax/l3dss1.c
@@ -353,7 +353,7 @@ l3dss1_parse_facility(struct PStack *st, struct l3_process *pc,
353 { l3dss1_dummy_invoke(st, cr, id, ident, p, nlen); 353 { l3dss1_dummy_invoke(st, cr, id, ident, p, nlen);
354 return; 354 return;
355 } 355 }
356#if HISAX_DE_AOC 356#ifdef HISAX_DE_AOC
357 { 357 {
358 358
359#define FOO1(s,a,b) \ 359#define FOO1(s,a,b) \
@@ -977,7 +977,7 @@ l3dss1_release_cmpl(struct l3_process *pc, u_char pr, void *arg)
977 dss1_release_l3_process(pc); 977 dss1_release_l3_process(pc);
978} 978}
979 979
980#if EXT_BEARER_CAPS 980#ifdef EXT_BEARER_CAPS
981 981
982static u_char * 982static u_char *
983EncodeASyncParams(u_char * p, u_char si2) 983EncodeASyncParams(u_char * p, u_char si2)
@@ -1369,7 +1369,7 @@ l3dss1_setup_req(struct l3_process *pc, u_char pr,
1369 *p++ = *sub++ & 0x7f; 1369 *p++ = *sub++ & 0x7f;
1370 } 1370 }
1371 } 1371 }
1372#if EXT_BEARER_CAPS 1372#ifdef EXT_BEARER_CAPS
1373 if ((pc->para.setup.si2 >= 160) && (pc->para.setup.si2 <= 175)) { // sync. Bitratenadaption, V.110/X.30 1373 if ((pc->para.setup.si2 >= 160) && (pc->para.setup.si2 <= 175)) { // sync. Bitratenadaption, V.110/X.30
1374 1374
1375 *p++ = IE_LLC; 1375 *p++ = IE_LLC;
@@ -1609,7 +1609,7 @@ l3dss1_setup(struct l3_process *pc, u_char pr, void *arg)
1609 case 0x08: /* Unrestricted digital information */ 1609 case 0x08: /* Unrestricted digital information */
1610 pc->para.setup.si1 = 7; 1610 pc->para.setup.si1 = 7;
1611/* JIM, 05.11.97 I wanna set service indicator 2 */ 1611/* JIM, 05.11.97 I wanna set service indicator 2 */
1612#if EXT_BEARER_CAPS 1612#ifdef EXT_BEARER_CAPS
1613 pc->para.setup.si2 = DecodeSI2(skb); 1613 pc->para.setup.si2 = DecodeSI2(skb);
1614#endif 1614#endif
1615 break; 1615 break;
diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c
index adeaad62d35c..a3eaf4d65707 100644
--- a/drivers/isdn/hisax/teles3.c
+++ b/drivers/isdn/hisax/teles3.c
@@ -143,7 +143,7 @@ teles3_interrupt(int intno, void *dev_id, struct pt_regs *regs)
143 return IRQ_HANDLED; 143 return IRQ_HANDLED;
144} 144}
145 145
146inline static void 146static inline void
147release_ioregs(struct IsdnCardState *cs, int mask) 147release_ioregs(struct IsdnCardState *cs, int mask)
148{ 148{
149 if (mask & 1) 149 if (mask & 1)
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index e0d1b01cc74c..386df71eee74 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1650,7 +1650,7 @@ static void __exit icn_exit(void)
1650{ 1650{
1651 isdn_ctrl cmd; 1651 isdn_ctrl cmd;
1652 icn_card *card = cards; 1652 icn_card *card = cards;
1653 icn_card *last; 1653 icn_card *last, *tmpcard;
1654 int i; 1654 int i;
1655 unsigned long flags; 1655 unsigned long flags;
1656 1656
@@ -1670,8 +1670,9 @@ static void __exit icn_exit(void)
1670 for (i = 0; i < ICN_BCH; i++) 1670 for (i = 0; i < ICN_BCH; i++)
1671 icn_free_queue(card, i); 1671 icn_free_queue(card, i);
1672 } 1672 }
1673 card = card->next; 1673 tmpcard = card->next;
1674 spin_unlock_irqrestore(&card->lock, flags); 1674 spin_unlock_irqrestore(&card->lock, flags);
1675 card = tmpcard;
1675 } 1676 }
1676 card = cards; 1677 card = cards;
1677 cards = NULL; 1678 cards = NULL;
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 91691a6c004e..65ab64c43b3e 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -4,7 +4,7 @@ menu "Macintosh device drivers"
4 4
5config ADB 5config ADB
6 bool "Apple Desktop Bus (ADB) support" 6 bool "Apple Desktop Bus (ADB) support"
7 depends on MAC || PPC_PMAC 7 depends on MAC || (PPC_PMAC && PPC32)
8 help 8 help
9 Apple Desktop Bus (ADB) support is for support of devices which 9 Apple Desktop Bus (ADB) support is for support of devices which
10 are connected to an ADB port. ADB devices tend to have 4 pins. 10 are connected to an ADB port. ADB devices tend to have 4 pins.
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 0c2ed99a3832..41df4cda66e2 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -108,7 +108,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
108{ 108{
109 unsigned char *page; 109 unsigned char *page;
110 110
111#if INJECT_FAULTS_1 111#ifdef INJECT_FAULTS_1
112 page = NULL; 112 page = NULL;
113#else 113#else
114 page = kmalloc(PAGE_SIZE, GFP_NOIO); 114 page = kmalloc(PAGE_SIZE, GFP_NOIO);
@@ -818,8 +818,7 @@ int bitmap_unplug(struct bitmap *bitmap)
818 return 0; 818 return 0;
819} 819}
820 820
821static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, 821static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset);
822 unsigned long sectors, int in_sync);
823/* * bitmap_init_from_disk -- called at bitmap_create time to initialize 822/* * bitmap_init_from_disk -- called at bitmap_create time to initialize
824 * the in-memory bitmap from the on-disk bitmap -- also, sets up the 823 * the in-memory bitmap from the on-disk bitmap -- also, sets up the
825 * memory mapping of the bitmap file 824 * memory mapping of the bitmap file
@@ -828,7 +827,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
828 * previously kicked from the array, we mark all the bits as 827 * previously kicked from the array, we mark all the bits as
829 * 1's in order to cause a full resync. 828 * 1's in order to cause a full resync.
830 */ 829 */
831static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync) 830static int bitmap_init_from_disk(struct bitmap *bitmap)
832{ 831{
833 unsigned long i, chunks, index, oldindex, bit; 832 unsigned long i, chunks, index, oldindex, bit;
834 struct page *page = NULL, *oldpage = NULL; 833 struct page *page = NULL, *oldpage = NULL;
@@ -843,7 +842,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync)
843 842
844 BUG_ON(!file && !bitmap->offset); 843 BUG_ON(!file && !bitmap->offset);
845 844
846#if INJECT_FAULTS_3 845#ifdef INJECT_FAULTS_3
847 outofdate = 1; 846 outofdate = 1;
848#else 847#else
849 outofdate = bitmap->flags & BITMAP_STALE; 848 outofdate = bitmap->flags & BITMAP_STALE;
@@ -929,8 +928,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync)
929 } 928 }
930 if (test_bit(bit, page_address(page))) { 929 if (test_bit(bit, page_address(page))) {
931 /* if the disk bit is set, set the memory bit */ 930 /* if the disk bit is set, set the memory bit */
932 bitmap_set_memory_bits(bitmap, 931 bitmap_set_memory_bits(bitmap, i << CHUNK_BLOCK_SHIFT(bitmap));
933 i << CHUNK_BLOCK_SHIFT(bitmap), 1, in_sync);
934 bit_cnt++; 932 bit_cnt++;
935 } 933 }
936 } 934 }
@@ -1187,7 +1185,7 @@ static int bitmap_start_daemon(struct bitmap *bitmap, mdk_thread_t **ptr,
1187 1185
1188 spin_unlock_irqrestore(&bitmap->lock, flags); 1186 spin_unlock_irqrestore(&bitmap->lock, flags);
1189 1187
1190#if INJECT_FATAL_FAULT_2 1188#ifdef INJECT_FATAL_FAULT_2
1191 daemon = NULL; 1189 daemon = NULL;
1192#else 1190#else
1193 sprintf(namebuf, "%%s_%s", name); 1191 sprintf(namebuf, "%%s_%s", name);
@@ -1426,35 +1424,53 @@ void bitmap_close_sync(struct bitmap *bitmap)
1426 } 1424 }
1427} 1425}
1428 1426
1429static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, 1427static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset)
1430 unsigned long sectors, int in_sync)
1431{ 1428{
1432 /* For each chunk covered by any of these sectors, set the 1429 /* For each chunk covered by any of these sectors, set the
1433 * counter to 1 and set resync_needed unless in_sync. They should all 1430 * counter to 1 and set resync_needed. They should all
1434 * be 0 at this point 1431 * be 0 at this point
1435 */ 1432 */
1436 while (sectors) { 1433
1437 int secs; 1434 int secs;
1438 bitmap_counter_t *bmc; 1435 bitmap_counter_t *bmc;
1439 spin_lock_irq(&bitmap->lock); 1436 spin_lock_irq(&bitmap->lock);
1440 bmc = bitmap_get_counter(bitmap, offset, &secs, 1); 1437 bmc = bitmap_get_counter(bitmap, offset, &secs, 1);
1441 if (!bmc) { 1438 if (!bmc) {
1442 spin_unlock_irq(&bitmap->lock);
1443 return;
1444 }
1445 if (! *bmc) {
1446 struct page *page;
1447 *bmc = 1 | (in_sync? 0 : NEEDED_MASK);
1448 bitmap_count_page(bitmap, offset, 1);
1449 page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap));
1450 set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
1451 }
1452 spin_unlock_irq(&bitmap->lock); 1439 spin_unlock_irq(&bitmap->lock);
1453 if (sectors > secs) 1440 return;
1454 sectors -= secs; 1441 }
1455 else 1442 if (! *bmc) {
1456 sectors = 0; 1443 struct page *page;
1444 *bmc = 1 | NEEDED_MASK;
1445 bitmap_count_page(bitmap, offset, 1);
1446 page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap));
1447 set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
1457 } 1448 }
1449 spin_unlock_irq(&bitmap->lock);
1450
1451}
1452
1453/*
1454 * flush out any pending updates
1455 */
1456void bitmap_flush(mddev_t *mddev)
1457{
1458 struct bitmap *bitmap = mddev->bitmap;
1459 int sleep;
1460
1461 if (!bitmap) /* there was no bitmap */
1462 return;
1463
1464 /* run the daemon_work three time to ensure everything is flushed
1465 * that can be
1466 */
1467 sleep = bitmap->daemon_sleep;
1468 bitmap->daemon_sleep = 0;
1469 bitmap_daemon_work(bitmap);
1470 bitmap_daemon_work(bitmap);
1471 bitmap_daemon_work(bitmap);
1472 bitmap->daemon_sleep = sleep;
1473 bitmap_update_sb(bitmap);
1458} 1474}
1459 1475
1460/* 1476/*
@@ -1552,7 +1568,7 @@ int bitmap_create(mddev_t *mddev)
1552 1568
1553 bitmap->syncchunk = ~0UL; 1569 bitmap->syncchunk = ~0UL;
1554 1570
1555#if INJECT_FATAL_FAULT_1 1571#ifdef INJECT_FATAL_FAULT_1
1556 bitmap->bp = NULL; 1572 bitmap->bp = NULL;
1557#else 1573#else
1558 bitmap->bp = kmalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL); 1574 bitmap->bp = kmalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL);
@@ -1565,7 +1581,8 @@ int bitmap_create(mddev_t *mddev)
1565 1581
1566 /* now that we have some pages available, initialize the in-memory 1582 /* now that we have some pages available, initialize the in-memory
1567 * bitmap from the on-disk bitmap */ 1583 * bitmap from the on-disk bitmap */
1568 err = bitmap_init_from_disk(bitmap, mddev->recovery_cp == MaxSector); 1584 err = bitmap_init_from_disk(bitmap);
1585
1569 if (err) 1586 if (err)
1570 return err; 1587 return err;
1571 1588
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 12031c9d3f1e..b08df8b9b2ca 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1230,7 +1230,7 @@ static int __init dm_mirror_init(void)
1230 if (r) 1230 if (r)
1231 return r; 1231 return r;
1232 1232
1233 _kmirrord_wq = create_workqueue("kmirrord"); 1233 _kmirrord_wq = create_singlethread_workqueue("kmirrord");
1234 if (!_kmirrord_wq) { 1234 if (!_kmirrord_wq) {
1235 DMERR("couldn't start kmirrord"); 1235 DMERR("couldn't start kmirrord");
1236 dm_dirty_log_exit(); 1236 dm_dirty_log_exit();
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index a5a4c0ed8a14..a6d3baa46f61 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -869,11 +869,17 @@ static void suspend_targets(struct dm_table *t, unsigned postsuspend)
869 869
870void dm_table_presuspend_targets(struct dm_table *t) 870void dm_table_presuspend_targets(struct dm_table *t)
871{ 871{
872 if (!t)
873 return;
874
872 return suspend_targets(t, 0); 875 return suspend_targets(t, 0);
873} 876}
874 877
875void dm_table_postsuspend_targets(struct dm_table *t) 878void dm_table_postsuspend_targets(struct dm_table *t)
876{ 879{
880 if (!t)
881 return;
882
877 return suspend_targets(t, 1); 883 return suspend_targets(t, 1);
878} 884}
879 885
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 54fabbf06678..d487d9deb98e 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -55,10 +55,10 @@ union map_info *dm_get_mapinfo(struct bio *bio)
55 */ 55 */
56#define DMF_BLOCK_IO 0 56#define DMF_BLOCK_IO 0
57#define DMF_SUSPENDED 1 57#define DMF_SUSPENDED 1
58#define DMF_FS_LOCKED 2
59 58
60struct mapped_device { 59struct mapped_device {
61 struct rw_semaphore lock; 60 struct rw_semaphore io_lock;
61 struct semaphore suspend_lock;
62 rwlock_t map_lock; 62 rwlock_t map_lock;
63 atomic_t holders; 63 atomic_t holders;
64 64
@@ -248,16 +248,16 @@ static inline void free_tio(struct mapped_device *md, struct target_io *tio)
248 */ 248 */
249static int queue_io(struct mapped_device *md, struct bio *bio) 249static int queue_io(struct mapped_device *md, struct bio *bio)
250{ 250{
251 down_write(&md->lock); 251 down_write(&md->io_lock);
252 252
253 if (!test_bit(DMF_BLOCK_IO, &md->flags)) { 253 if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
254 up_write(&md->lock); 254 up_write(&md->io_lock);
255 return 1; 255 return 1;
256 } 256 }
257 257
258 bio_list_add(&md->deferred, bio); 258 bio_list_add(&md->deferred, bio);
259 259
260 up_write(&md->lock); 260 up_write(&md->io_lock);
261 return 0; /* deferred successfully */ 261 return 0; /* deferred successfully */
262} 262}
263 263
@@ -568,14 +568,14 @@ static int dm_request(request_queue_t *q, struct bio *bio)
568 int r; 568 int r;
569 struct mapped_device *md = q->queuedata; 569 struct mapped_device *md = q->queuedata;
570 570
571 down_read(&md->lock); 571 down_read(&md->io_lock);
572 572
573 /* 573 /*
574 * If we're suspended we have to queue 574 * If we're suspended we have to queue
575 * this io for later. 575 * this io for later.
576 */ 576 */
577 while (test_bit(DMF_BLOCK_IO, &md->flags)) { 577 while (test_bit(DMF_BLOCK_IO, &md->flags)) {
578 up_read(&md->lock); 578 up_read(&md->io_lock);
579 579
580 if (bio_rw(bio) == READA) { 580 if (bio_rw(bio) == READA) {
581 bio_io_error(bio, bio->bi_size); 581 bio_io_error(bio, bio->bi_size);
@@ -594,11 +594,11 @@ static int dm_request(request_queue_t *q, struct bio *bio)
594 * We're in a while loop, because someone could suspend 594 * We're in a while loop, because someone could suspend
595 * before we get to the following read lock. 595 * before we get to the following read lock.
596 */ 596 */
597 down_read(&md->lock); 597 down_read(&md->io_lock);
598 } 598 }
599 599
600 __split_bio(md, bio); 600 __split_bio(md, bio);
601 up_read(&md->lock); 601 up_read(&md->io_lock);
602 return 0; 602 return 0;
603} 603}
604 604
@@ -610,7 +610,7 @@ static int dm_flush_all(request_queue_t *q, struct gendisk *disk,
610 int ret = -ENXIO; 610 int ret = -ENXIO;
611 611
612 if (map) { 612 if (map) {
613 ret = dm_table_flush_all(md->map); 613 ret = dm_table_flush_all(map);
614 dm_table_put(map); 614 dm_table_put(map);
615 } 615 }
616 616
@@ -747,7 +747,8 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
747 goto bad1; 747 goto bad1;
748 748
749 memset(md, 0, sizeof(*md)); 749 memset(md, 0, sizeof(*md));
750 init_rwsem(&md->lock); 750 init_rwsem(&md->io_lock);
751 init_MUTEX(&md->suspend_lock);
751 rwlock_init(&md->map_lock); 752 rwlock_init(&md->map_lock);
752 atomic_set(&md->holders, 1); 753 atomic_set(&md->holders, 1);
753 atomic_set(&md->event_nr, 0); 754 atomic_set(&md->event_nr, 0);
@@ -825,18 +826,13 @@ static void event_callback(void *context)
825 wake_up(&md->eventq); 826 wake_up(&md->eventq);
826} 827}
827 828
828static void __set_size(struct gendisk *disk, sector_t size) 829static void __set_size(struct mapped_device *md, sector_t size)
829{ 830{
830 struct block_device *bdev; 831 set_capacity(md->disk, size);
831 832
832 set_capacity(disk, size); 833 down(&md->frozen_bdev->bd_inode->i_sem);
833 bdev = bdget_disk(disk, 0); 834 i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
834 if (bdev) { 835 up(&md->frozen_bdev->bd_inode->i_sem);
835 down(&bdev->bd_inode->i_sem);
836 i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
837 up(&bdev->bd_inode->i_sem);
838 bdput(bdev);
839 }
840} 836}
841 837
842static int __bind(struct mapped_device *md, struct dm_table *t) 838static int __bind(struct mapped_device *md, struct dm_table *t)
@@ -845,17 +841,18 @@ static int __bind(struct mapped_device *md, struct dm_table *t)
845 sector_t size; 841 sector_t size;
846 842
847 size = dm_table_get_size(t); 843 size = dm_table_get_size(t);
848 __set_size(md->disk, size); 844 __set_size(md, size);
849 if (size == 0) 845 if (size == 0)
850 return 0; 846 return 0;
851 847
848 dm_table_get(t);
849 dm_table_event_callback(t, event_callback, md);
850
852 write_lock(&md->map_lock); 851 write_lock(&md->map_lock);
853 md->map = t; 852 md->map = t;
853 dm_table_set_restrictions(t, q);
854 write_unlock(&md->map_lock); 854 write_unlock(&md->map_lock);
855 855
856 dm_table_get(t);
857 dm_table_event_callback(md->map, event_callback, md);
858 dm_table_set_restrictions(t, q);
859 return 0; 856 return 0;
860} 857}
861 858
@@ -935,7 +932,7 @@ void dm_put(struct mapped_device *md)
935 struct dm_table *map = dm_get_table(md); 932 struct dm_table *map = dm_get_table(md);
936 933
937 if (atomic_dec_and_test(&md->holders)) { 934 if (atomic_dec_and_test(&md->holders)) {
938 if (!test_bit(DMF_SUSPENDED, &md->flags) && map) { 935 if (!dm_suspended(md)) {
939 dm_table_presuspend_targets(map); 936 dm_table_presuspend_targets(map);
940 dm_table_postsuspend_targets(map); 937 dm_table_postsuspend_targets(map);
941 } 938 }
@@ -968,17 +965,17 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
968{ 965{
969 int r = -EINVAL; 966 int r = -EINVAL;
970 967
971 down_write(&md->lock); 968 down(&md->suspend_lock);
972 969
973 /* device must be suspended */ 970 /* device must be suspended */
974 if (!test_bit(DMF_SUSPENDED, &md->flags)) 971 if (!dm_suspended(md))
975 goto out; 972 goto out;
976 973
977 __unbind(md); 974 __unbind(md);
978 r = __bind(md, table); 975 r = __bind(md, table);
979 976
980out: 977out:
981 up_write(&md->lock); 978 up(&md->suspend_lock);
982 return r; 979 return r;
983} 980}
984 981
@@ -986,16 +983,13 @@ out:
986 * Functions to lock and unlock any filesystem running on the 983 * Functions to lock and unlock any filesystem running on the
987 * device. 984 * device.
988 */ 985 */
989static int __lock_fs(struct mapped_device *md) 986static int lock_fs(struct mapped_device *md)
990{ 987{
991 int error = -ENOMEM; 988 int r = -ENOMEM;
992
993 if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
994 return 0;
995 989
996 md->frozen_bdev = bdget_disk(md->disk, 0); 990 md->frozen_bdev = bdget_disk(md->disk, 0);
997 if (!md->frozen_bdev) { 991 if (!md->frozen_bdev) {
998 DMWARN("bdget failed in __lock_fs"); 992 DMWARN("bdget failed in lock_fs");
999 goto out; 993 goto out;
1000 } 994 }
1001 995
@@ -1003,13 +997,13 @@ static int __lock_fs(struct mapped_device *md)
1003 997
1004 md->frozen_sb = freeze_bdev(md->frozen_bdev); 998 md->frozen_sb = freeze_bdev(md->frozen_bdev);
1005 if (IS_ERR(md->frozen_sb)) { 999 if (IS_ERR(md->frozen_sb)) {
1006 error = PTR_ERR(md->frozen_sb); 1000 r = PTR_ERR(md->frozen_sb);
1007 goto out_bdput; 1001 goto out_bdput;
1008 } 1002 }
1009 1003
1010 /* don't bdput right now, we don't want the bdev 1004 /* don't bdput right now, we don't want the bdev
1011 * to go away while it is locked. We'll bdput 1005 * to go away while it is locked. We'll bdput
1012 * in __unlock_fs 1006 * in unlock_fs
1013 */ 1007 */
1014 return 0; 1008 return 0;
1015 1009
@@ -1018,15 +1012,11 @@ out_bdput:
1018 md->frozen_sb = NULL; 1012 md->frozen_sb = NULL;
1019 md->frozen_bdev = NULL; 1013 md->frozen_bdev = NULL;
1020out: 1014out:
1021 clear_bit(DMF_FS_LOCKED, &md->flags); 1015 return r;
1022 return error;
1023} 1016}
1024 1017
1025static void __unlock_fs(struct mapped_device *md) 1018static void unlock_fs(struct mapped_device *md)
1026{ 1019{
1027 if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags))
1028 return;
1029
1030 thaw_bdev(md->frozen_bdev, md->frozen_sb); 1020 thaw_bdev(md->frozen_bdev, md->frozen_sb);
1031 bdput(md->frozen_bdev); 1021 bdput(md->frozen_bdev);
1032 1022
@@ -1043,50 +1033,37 @@ static void __unlock_fs(struct mapped_device *md)
1043 */ 1033 */
1044int dm_suspend(struct mapped_device *md) 1034int dm_suspend(struct mapped_device *md)
1045{ 1035{
1046 struct dm_table *map; 1036 struct dm_table *map = NULL;
1047 DECLARE_WAITQUEUE(wait, current); 1037 DECLARE_WAITQUEUE(wait, current);
1048 int error = -EINVAL; 1038 int r = -EINVAL;
1049 1039
1050 /* Flush I/O to the device. */ 1040 down(&md->suspend_lock);
1051 down_read(&md->lock); 1041
1052 if (test_bit(DMF_BLOCK_IO, &md->flags)) 1042 if (dm_suspended(md))
1053 goto out_read_unlock; 1043 goto out;
1054 1044
1055 map = dm_get_table(md); 1045 map = dm_get_table(md);
1056 if (map)
1057 /* This does not get reverted if there's an error later. */
1058 dm_table_presuspend_targets(map);
1059 1046
1060 error = __lock_fs(md); 1047 /* This does not get reverted if there's an error later. */
1061 if (error) { 1048 dm_table_presuspend_targets(map);
1062 dm_table_put(map);
1063 goto out_read_unlock;
1064 }
1065 1049
1066 up_read(&md->lock); 1050 /* Flush I/O to the device. */
1051 r = lock_fs(md);
1052 if (r)
1053 goto out;
1067 1054
1068 /* 1055 /*
1069 * First we set the BLOCK_IO flag so no more ios will be mapped. 1056 * First we set the BLOCK_IO flag so no more ios will be mapped.
1070 *
1071 * If the flag is already set we know another thread is trying to
1072 * suspend as well, so we leave the fs locked for this thread.
1073 */ 1057 */
1074 error = -EINVAL; 1058 down_write(&md->io_lock);
1075 down_write(&md->lock); 1059 set_bit(DMF_BLOCK_IO, &md->flags);
1076 if (test_and_set_bit(DMF_BLOCK_IO, &md->flags)) {
1077 if (map)
1078 dm_table_put(map);
1079 goto out_write_unlock;
1080 }
1081 1060
1082 add_wait_queue(&md->wait, &wait); 1061 add_wait_queue(&md->wait, &wait);
1083 up_write(&md->lock); 1062 up_write(&md->io_lock);
1084 1063
1085 /* unplug */ 1064 /* unplug */
1086 if (map) { 1065 if (map)
1087 dm_table_unplug_all(map); 1066 dm_table_unplug_all(map);
1088 dm_table_put(map);
1089 }
1090 1067
1091 /* 1068 /*
1092 * Then we wait for the already mapped ios to 1069 * Then we wait for the already mapped ios to
@@ -1102,62 +1079,67 @@ int dm_suspend(struct mapped_device *md)
1102 } 1079 }
1103 set_current_state(TASK_RUNNING); 1080 set_current_state(TASK_RUNNING);
1104 1081
1105 down_write(&md->lock); 1082 down_write(&md->io_lock);
1106 remove_wait_queue(&md->wait, &wait); 1083 remove_wait_queue(&md->wait, &wait);
1107 1084
1108 /* were we interrupted ? */ 1085 /* were we interrupted ? */
1109 error = -EINTR; 1086 r = -EINTR;
1110 if (atomic_read(&md->pending)) 1087 if (atomic_read(&md->pending)) {
1111 goto out_unfreeze; 1088 up_write(&md->io_lock);
1112 1089 unlock_fs(md);
1113 set_bit(DMF_SUSPENDED, &md->flags); 1090 clear_bit(DMF_BLOCK_IO, &md->flags);
1091 goto out;
1092 }
1093 up_write(&md->io_lock);
1114 1094
1115 map = dm_get_table(md); 1095 dm_table_postsuspend_targets(map);
1116 if (map)
1117 dm_table_postsuspend_targets(map);
1118 dm_table_put(map);
1119 up_write(&md->lock);
1120 1096
1121 return 0; 1097 set_bit(DMF_SUSPENDED, &md->flags);
1122 1098
1123out_unfreeze: 1099 r = 0;
1124 __unlock_fs(md);
1125 clear_bit(DMF_BLOCK_IO, &md->flags);
1126out_write_unlock:
1127 up_write(&md->lock);
1128 return error;
1129 1100
1130out_read_unlock: 1101out:
1131 up_read(&md->lock); 1102 dm_table_put(map);
1132 return error; 1103 up(&md->suspend_lock);
1104 return r;
1133} 1105}
1134 1106
1135int dm_resume(struct mapped_device *md) 1107int dm_resume(struct mapped_device *md)
1136{ 1108{
1109 int r = -EINVAL;
1137 struct bio *def; 1110 struct bio *def;
1138 struct dm_table *map = dm_get_table(md); 1111 struct dm_table *map = NULL;
1139 1112
1140 down_write(&md->lock); 1113 down(&md->suspend_lock);
1141 if (!map || 1114 if (!dm_suspended(md))
1142 !test_bit(DMF_SUSPENDED, &md->flags) || 1115 goto out;
1143 !dm_table_get_size(map)) { 1116
1144 up_write(&md->lock); 1117 map = dm_get_table(md);
1145 dm_table_put(map); 1118 if (!map || !dm_table_get_size(map))
1146 return -EINVAL; 1119 goto out;
1147 }
1148 1120
1149 dm_table_resume_targets(map); 1121 dm_table_resume_targets(map);
1150 clear_bit(DMF_SUSPENDED, &md->flags); 1122
1123 down_write(&md->io_lock);
1151 clear_bit(DMF_BLOCK_IO, &md->flags); 1124 clear_bit(DMF_BLOCK_IO, &md->flags);
1152 1125
1153 def = bio_list_get(&md->deferred); 1126 def = bio_list_get(&md->deferred);
1154 __flush_deferred_io(md, def); 1127 __flush_deferred_io(md, def);
1155 up_write(&md->lock); 1128 up_write(&md->io_lock);
1156 __unlock_fs(md); 1129
1130 unlock_fs(md);
1131
1132 clear_bit(DMF_SUSPENDED, &md->flags);
1133
1157 dm_table_unplug_all(map); 1134 dm_table_unplug_all(map);
1135
1136 r = 0;
1137
1138out:
1158 dm_table_put(map); 1139 dm_table_put(map);
1140 up(&md->suspend_lock);
1159 1141
1160 return 0; 1142 return r;
1161} 1143}
1162 1144
1163/*----------------------------------------------------------------- 1145/*-----------------------------------------------------------------
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4a0c57db2b67..480f658db6f2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -284,7 +284,7 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev)
284 return NULL; 284 return NULL;
285} 285}
286 286
287inline static sector_t calc_dev_sboffset(struct block_device *bdev) 287static inline sector_t calc_dev_sboffset(struct block_device *bdev)
288{ 288{
289 sector_t size = bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; 289 sector_t size = bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;
290 return MD_NEW_SIZE_BLOCKS(size); 290 return MD_NEW_SIZE_BLOCKS(size);
@@ -1798,6 +1798,8 @@ static int do_md_stop(mddev_t * mddev, int ro)
1798 goto out; 1798 goto out;
1799 mddev->ro = 1; 1799 mddev->ro = 1;
1800 } else { 1800 } else {
1801 bitmap_flush(mddev);
1802 wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0);
1801 if (mddev->ro) 1803 if (mddev->ro)
1802 set_disk_ro(disk, 0); 1804 set_disk_ro(disk, 0);
1803 blk_queue_make_request(mddev->queue, md_fail_request); 1805 blk_queue_make_request(mddev->queue, md_fail_request);
@@ -3484,7 +3486,6 @@ static void md_do_sync(mddev_t *mddev)
3484 goto skip; 3486 goto skip;
3485 } 3487 }
3486 ITERATE_MDDEV(mddev2,tmp) { 3488 ITERATE_MDDEV(mddev2,tmp) {
3487 printk(".");
3488 if (mddev2 == mddev) 3489 if (mddev2 == mddev)
3489 continue; 3490 continue;
3490 if (mddev2->curr_resync && 3491 if (mddev2->curr_resync &&
@@ -4007,3 +4008,4 @@ EXPORT_SYMBOL(md_wakeup_thread);
4007EXPORT_SYMBOL(md_print_devices); 4008EXPORT_SYMBOL(md_print_devices);
4008EXPORT_SYMBOL(md_check_recovery); 4009EXPORT_SYMBOL(md_check_recovery);
4009MODULE_LICENSE("GPL"); 4010MODULE_LICENSE("GPL");
4011MODULE_ALIAS("md");
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5f253ee536bb..51d9645ed09c 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -893,7 +893,6 @@ static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error)
893 if (!uptodate) { 893 if (!uptodate) {
894 md_error(r1_bio->mddev, 894 md_error(r1_bio->mddev,
895 conf->mirrors[r1_bio->read_disk].rdev); 895 conf->mirrors[r1_bio->read_disk].rdev);
896 set_bit(R1BIO_Degraded, &r1_bio->state);
897 } else 896 } else
898 set_bit(R1BIO_Uptodate, &r1_bio->state); 897 set_bit(R1BIO_Uptodate, &r1_bio->state);
899 rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); 898 rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev);
@@ -918,10 +917,9 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error)
918 mirror = i; 917 mirror = i;
919 break; 918 break;
920 } 919 }
921 if (!uptodate) { 920 if (!uptodate)
922 md_error(mddev, conf->mirrors[mirror].rdev); 921 md_error(mddev, conf->mirrors[mirror].rdev);
923 set_bit(R1BIO_Degraded, &r1_bio->state); 922
924 }
925 update_head_pos(mirror, r1_bio); 923 update_head_pos(mirror, r1_bio);
926 924
927 if (atomic_dec_and_test(&r1_bio->remaining)) { 925 if (atomic_dec_and_test(&r1_bio->remaining)) {
@@ -1109,6 +1107,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1109 int i; 1107 int i;
1110 int write_targets = 0; 1108 int write_targets = 0;
1111 int sync_blocks; 1109 int sync_blocks;
1110 int still_degraded = 0;
1112 1111
1113 if (!conf->r1buf_pool) 1112 if (!conf->r1buf_pool)
1114 { 1113 {
@@ -1137,7 +1136,10 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1137 return 0; 1136 return 0;
1138 } 1137 }
1139 1138
1140 if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, mddev->degraded) && 1139 /* before building a request, check if we can skip these blocks..
1140 * This call the bitmap_start_sync doesn't actually record anything
1141 */
1142 if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) &&
1141 !conf->fullsync) { 1143 !conf->fullsync) {
1142 /* We can skip this block, and probably several more */ 1144 /* We can skip this block, and probably several more */
1143 *skipped = 1; 1145 *skipped = 1;
@@ -1203,24 +1205,23 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1203 if (i == disk) { 1205 if (i == disk) {
1204 bio->bi_rw = READ; 1206 bio->bi_rw = READ;
1205 bio->bi_end_io = end_sync_read; 1207 bio->bi_end_io = end_sync_read;
1206 } else if (conf->mirrors[i].rdev && 1208 } else if (conf->mirrors[i].rdev == NULL ||
1207 !conf->mirrors[i].rdev->faulty && 1209 conf->mirrors[i].rdev->faulty) {
1208 (!conf->mirrors[i].rdev->in_sync || 1210 still_degraded = 1;
1209 sector_nr + RESYNC_SECTORS > mddev->recovery_cp)) { 1211 continue;
1212 } else if (!conf->mirrors[i].rdev->in_sync ||
1213 sector_nr + RESYNC_SECTORS > mddev->recovery_cp) {
1210 bio->bi_rw = WRITE; 1214 bio->bi_rw = WRITE;
1211 bio->bi_end_io = end_sync_write; 1215 bio->bi_end_io = end_sync_write;
1212 write_targets ++; 1216 write_targets ++;
1213 } else 1217 } else
1218 /* no need to read or write here */
1214 continue; 1219 continue;
1215 bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset; 1220 bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset;
1216 bio->bi_bdev = conf->mirrors[i].rdev->bdev; 1221 bio->bi_bdev = conf->mirrors[i].rdev->bdev;
1217 bio->bi_private = r1_bio; 1222 bio->bi_private = r1_bio;
1218 } 1223 }
1219 1224
1220 if (write_targets + 1 < conf->raid_disks)
1221 /* array degraded, can't clear bitmap */
1222 set_bit(R1BIO_Degraded, &r1_bio->state);
1223
1224 if (write_targets == 0) { 1225 if (write_targets == 0) {
1225 /* There is nowhere to write, so all non-sync 1226 /* There is nowhere to write, so all non-sync
1226 * drives must be failed - so we are finished 1227 * drives must be failed - so we are finished
@@ -1243,7 +1244,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1243 break; 1244 break;
1244 if (sync_blocks == 0) { 1245 if (sync_blocks == 0) {
1245 if (!bitmap_start_sync(mddev->bitmap, sector_nr, 1246 if (!bitmap_start_sync(mddev->bitmap, sector_nr,
1246 &sync_blocks, mddev->degraded) && 1247 &sync_blocks, still_degraded) &&
1247 !conf->fullsync) 1248 !conf->fullsync)
1248 break; 1249 break;
1249 if (sync_blocks < (PAGE_SIZE>>9)) 1250 if (sync_blocks < (PAGE_SIZE>>9))
@@ -1468,6 +1469,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
1468 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 1469 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1469 } 1470 }
1470 mddev->size = mddev->array_size; 1471 mddev->size = mddev->array_size;
1472 mddev->resync_max_sectors = sectors;
1471 return 0; 1473 return 0;
1472} 1474}
1473 1475
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 93a9726cc2d6..43f231a467d5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1653,6 +1653,7 @@ static int run (mddev_t *mddev)
1653 1653
1654 /* device size must be a multiple of chunk size */ 1654 /* device size must be a multiple of chunk size */
1655 mddev->size &= ~(mddev->chunk_size/1024 -1); 1655 mddev->size &= ~(mddev->chunk_size/1024 -1);
1656 mddev->resync_max_sectors = mddev->size << 1;
1656 1657
1657 if (!conf->chunk_size || conf->chunk_size % 4) { 1658 if (!conf->chunk_size || conf->chunk_size % 4) {
1658 printk(KERN_ERR "raid5: invalid chunk size %d for %s\n", 1659 printk(KERN_ERR "raid5: invalid chunk size %d for %s\n",
@@ -1931,6 +1932,7 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
1931 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 1932 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1932 } 1933 }
1933 mddev->size = sectors /2; 1934 mddev->size = sectors /2;
1935 mddev->resync_max_sectors = sectors;
1934 return 0; 1936 return 0;
1935} 1937}
1936 1938
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index f62ea1a73d0d..495dee1d1e83 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -1813,6 +1813,7 @@ static int run (mddev_t *mddev)
1813 1813
1814 /* device size must be a multiple of chunk size */ 1814 /* device size must be a multiple of chunk size */
1815 mddev->size &= ~(mddev->chunk_size/1024 -1); 1815 mddev->size &= ~(mddev->chunk_size/1024 -1);
1816 mddev->resync_max_sectors = mddev->size << 1;
1816 1817
1817 if (conf->raid_disks < 4) { 1818 if (conf->raid_disks < 4) {
1818 printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n", 1819 printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n",
@@ -2095,6 +2096,7 @@ static int raid6_resize(mddev_t *mddev, sector_t sectors)
2095 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 2096 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
2096 } 2097 }
2097 mddev->size = sectors /2; 2098 mddev->size = sectors /2;
2099 mddev->resync_max_sectors = sectors;
2098 return 0; 2100 return 0;
2099} 2101}
2100 2102
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index d847c62bd837..e83256d0fd14 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -187,8 +187,8 @@ config DVB_BCM3510
187 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to 187 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
188 support this frontend. 188 support this frontend.
189 189
190config DVB_LGDT3302 190config DVB_LGDT330X
191 tristate "LGDT3302 based (DViCO FusionHDTV3 Gold)" 191 tristate "LGDT3302 or LGDT3303 based (DViCO FusionHDTV Gold)"
192 depends on DVB_CORE 192 depends on DVB_CORE
193 help 193 help
194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index de5e240cba7f..ad8658ffd60a 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -30,4 +30,4 @@ obj-$(CONFIG_DVB_OR51211) += or51211.o
30obj-$(CONFIG_DVB_OR51132) += or51132.o 30obj-$(CONFIG_DVB_OR51132) += or51132.o
31obj-$(CONFIG_DVB_BCM3510) += bcm3510.o 31obj-$(CONFIG_DVB_BCM3510) += bcm3510.o
32obj-$(CONFIG_DVB_S5H1420) += s5h1420.o 32obj-$(CONFIG_DVB_S5H1420) += s5h1420.o
33obj-$(CONFIG_DVB_LGDT3302) += lgdt3302.o 33obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 5afeaa9b43b4..536c35d969b7 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -82,13 +82,14 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
82 .name = "LG z201", 82 .name = "LG z201",
83 .min = 174000000, 83 .min = 174000000,
84 .max = 862000000, 84 .max = 862000000,
85 .count = 5, 85 .count = 6,
86 .entries = { 86 .entries = {
87 { 0, 36166667, 166666, 0xbc, 0x03 }, 87 { 0, 36166667, 166666, 0xbc, 0x03 },
88 { 443250000, 36166667, 166666, 0xbc, 0x01 }, 88 { 157500000, 36166667, 166666, 0xbc, 0x01 },
89 { 542000000, 36166667, 166666, 0xbc, 0x02 }, 89 { 443250000, 36166667, 166666, 0xbc, 0x02 },
90 { 830000000, 36166667, 166666, 0xf4, 0x02 }, 90 { 542000000, 36166667, 166666, 0xbc, 0x04 },
91 { 999999999, 36166667, 166666, 0xfc, 0x02 }, 91 { 830000000, 36166667, 166666, 0xf4, 0x04 },
92 { 999999999, 36166667, 166666, 0xfc, 0x04 },
92 }, 93 },
93}; 94};
94EXPORT_SYMBOL(dvb_pll_lg_z201); 95EXPORT_SYMBOL(dvb_pll_lg_z201);
@@ -224,6 +225,22 @@ struct dvb_pll_desc dvb_pll_tua6034 = {
224}; 225};
225EXPORT_SYMBOL(dvb_pll_tua6034); 226EXPORT_SYMBOL(dvb_pll_tua6034);
226 227
228/* Infineon TUA6034
229 * used in LG Innotek TDVS-H062F
230 */
231struct dvb_pll_desc dvb_pll_tdvs_tua6034 = {
232 .name = "LG/Infineon TUA6034",
233 .min = 54000000,
234 .max = 863000000,
235 .count = 3,
236 .entries = {
237 { 160000000, 44000000, 62500, 0xce, 0x01 },
238 { 455000000, 44000000, 62500, 0xce, 0x02 },
239 { 999999999, 44000000, 62500, 0xce, 0x04 },
240 },
241};
242EXPORT_SYMBOL(dvb_pll_tdvs_tua6034);
243
227/* Philips FMD1216ME 244/* Philips FMD1216ME
228 * used in Medion Hybrid PCMCIA card and USB Box 245 * used in Medion Hybrid PCMCIA card and USB Box
229 */ 246 */
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index cb794759d89e..205b2d1a8852 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -31,6 +31,7 @@ extern struct dvb_pll_desc dvb_pll_unknown_1;
31extern struct dvb_pll_desc dvb_pll_tua6010xs; 31extern struct dvb_pll_desc dvb_pll_tua6010xs;
32extern struct dvb_pll_desc dvb_pll_env57h1xd5; 32extern struct dvb_pll_desc dvb_pll_env57h1xd5;
33extern struct dvb_pll_desc dvb_pll_tua6034; 33extern struct dvb_pll_desc dvb_pll_tua6034;
34extern struct dvb_pll_desc dvb_pll_tdvs_tua6034;
34extern struct dvb_pll_desc dvb_pll_tda665x; 35extern struct dvb_pll_desc dvb_pll_tda665x;
35extern struct dvb_pll_desc dvb_pll_fmd1216me; 36extern struct dvb_pll_desc dvb_pll_fmd1216me;
36extern struct dvb_pll_desc dvb_pll_tded4; 37extern struct dvb_pll_desc dvb_pll_tded4;
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c
deleted file mode 100644
index c85a2a99df42..000000000000
--- a/drivers/media/dvb/frontends/lgdt3302.c
+++ /dev/null
@@ -1,599 +0,0 @@
1/*
2 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
5 *
6 * Based on code from Kirk Lapray <kirk_lapray@bigfoot.com>
7 * Copyright (C) 2005
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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25/*
26 * NOTES ABOUT THIS DRIVER
27 *
28 * This driver supports DViCO FusionHDTV 3 Gold under Linux.
29 *
30 * TODO:
31 * BER and signal strength always return 0.
32 *
33 */
34
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/moduleparam.h>
38#include <linux/init.h>
39#include <linux/delay.h>
40#include <asm/byteorder.h>
41
42#include "dvb_frontend.h"
43#include "dvb-pll.h"
44#include "lgdt3302_priv.h"
45#include "lgdt3302.h"
46
47static int debug = 0;
48module_param(debug, int, 0644);
49MODULE_PARM_DESC(debug,"Turn on/off lgdt3302 frontend debugging (default:off).");
50#define dprintk(args...) \
51do { \
52if (debug) printk(KERN_DEBUG "lgdt3302: " args); \
53} while (0)
54
55struct lgdt3302_state
56{
57 struct i2c_adapter* i2c;
58 struct dvb_frontend_ops ops;
59
60 /* Configuration settings */
61 const struct lgdt3302_config* config;
62
63 struct dvb_frontend frontend;
64
65 /* Demodulator private data */
66 fe_modulation_t current_modulation;
67
68 /* Tuner private data */
69 u32 current_frequency;
70};
71
72static int i2c_writebytes (struct lgdt3302_state* state,
73 u8 addr, /* demod_address or pll_address */
74 u8 *buf, /* data bytes to send */
75 int len /* number of bytes to send */ )
76{
77 if (addr == state->config->pll_address) {
78 struct i2c_msg msg =
79 { .addr = addr, .flags = 0, .buf = buf, .len = len };
80 int err;
81
82 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
83 printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
84 if (err < 0)
85 return err;
86 else
87 return -EREMOTEIO;
88 }
89 } else {
90 u8 tmp[] = { buf[0], buf[1] };
91 struct i2c_msg msg =
92 { .addr = addr, .flags = 0, .buf = tmp, .len = 2 };
93 int err;
94 int i;
95
96 for (i=1; i<len; i++) {
97 tmp[1] = buf[i];
98 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
99 printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
100 if (err < 0)
101 return err;
102 else
103 return -EREMOTEIO;
104 }
105 tmp[0]++;
106 }
107 }
108 return 0;
109}
110static int i2c_readbytes (struct lgdt3302_state* state,
111 u8 addr, /* demod_address or pll_address */
112 u8 *buf, /* holds data bytes read */
113 int len /* number of bytes to read */ )
114{
115 struct i2c_msg msg =
116 { .addr = addr, .flags = I2C_M_RD, .buf = buf, .len = len };
117 int err;
118
119 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
120 printk(KERN_WARNING "lgdt3302: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err);
121 return -EREMOTEIO;
122 }
123 return 0;
124}
125
126/*
127 * This routine writes the register (reg) to the demod bus
128 * then reads the data returned for (len) bytes.
129 */
130
131static u8 i2c_selectreadbytes (struct lgdt3302_state* state,
132 enum I2C_REG reg, u8* buf, int len)
133{
134 u8 wr [] = { reg };
135 struct i2c_msg msg [] = {
136 { .addr = state->config->demod_address,
137 .flags = 0, .buf = wr, .len = 1 },
138 { .addr = state->config->demod_address,
139 .flags = I2C_M_RD, .buf = buf, .len = len },
140 };
141 int ret;
142 ret = i2c_transfer(state->i2c, msg, 2);
143 if (ret != 2) {
144 printk(KERN_WARNING "lgdt3302: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret);
145 } else {
146 ret = 0;
147 }
148 return ret;
149}
150
151/* Software reset */
152int lgdt3302_SwReset(struct lgdt3302_state* state)
153{
154 u8 ret;
155 u8 reset[] = {
156 IRQ_MASK,
157 0x00 /* bit 6 is active low software reset
158 * bits 5-0 are 1 to mask interrupts */
159 };
160
161 ret = i2c_writebytes(state,
162 state->config->demod_address,
163 reset, sizeof(reset));
164 if (ret == 0) {
165 /* spec says reset takes 100 ns why wait */
166 /* mdelay(100); */ /* keep low for 100mS */
167 reset[1] = 0x7f; /* force reset high (inactive)
168 * and unmask interrupts */
169 ret = i2c_writebytes(state,
170 state->config->demod_address,
171 reset, sizeof(reset));
172 }
173 /* Spec does not indicate a need for this either */
174 /*mdelay(5); */ /* wait 5 msec before doing more */
175 return ret;
176}
177
178static int lgdt3302_init(struct dvb_frontend* fe)
179{
180 /* Hardware reset is done using gpio[0] of cx23880x chip.
181 * I'd like to do it here, but don't know how to find chip address.
182 * cx88-cards.c arranges for the reset bit to be inactive (high).
183 * Maybe there needs to be a callable function in cx88-core or
184 * the caller of this function needs to do it. */
185
186 dprintk("%s entered\n", __FUNCTION__);
187 return lgdt3302_SwReset((struct lgdt3302_state*) fe->demodulator_priv);
188}
189
190static int lgdt3302_read_ber(struct dvb_frontend* fe, u32* ber)
191{
192 *ber = 0; /* Dummy out for now */
193 return 0;
194}
195
196static int lgdt3302_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
197{
198 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
199 u8 buf[2];
200
201 i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf));
202
203 *ucblocks = (buf[0] << 8) | buf[1];
204 return 0;
205}
206
207static int lgdt3302_set_parameters(struct dvb_frontend* fe,
208 struct dvb_frontend_parameters *param)
209{
210 u8 buf[4];
211 struct lgdt3302_state* state =
212 (struct lgdt3302_state*) fe->demodulator_priv;
213
214 /* Use 50MHz parameter values from spec sheet since xtal is 50 */
215 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
216 static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 };
217 static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb };
218 static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 };
219 static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 };
220 static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x07, 0x00, 0xfe };
221 static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a };
222
223 /* Change only if we are actually changing the modulation */
224 if (state->current_modulation != param->u.vsb.modulation) {
225 switch(param->u.vsb.modulation) {
226 case VSB_8:
227 dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
228
229 /* Select VSB mode and serial MPEG interface */
230 top_ctrl_cfg[1] = 0x07;
231 break;
232
233 case QAM_64:
234 dprintk("%s: QAM_64 MODE\n", __FUNCTION__);
235
236 /* Select QAM_64 mode and serial MPEG interface */
237 top_ctrl_cfg[1] = 0x04;
238 break;
239
240 case QAM_256:
241 dprintk("%s: QAM_256 MODE\n", __FUNCTION__);
242
243 /* Select QAM_256 mode and serial MPEG interface */
244 top_ctrl_cfg[1] = 0x05;
245 break;
246 default:
247 printk(KERN_WARNING "lgdt3302: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);
248 return -1;
249 }
250 /* Initializations common to all modes */
251
252 /* Select the requested mode */
253 i2c_writebytes(state, state->config->demod_address,
254 top_ctrl_cfg, sizeof(top_ctrl_cfg));
255
256 /* Change the value of IFBW[11:0]
257 of AGC IF/RF loop filter bandwidth register */
258 i2c_writebytes(state, state->config->demod_address,
259 agc_rf_cfg, sizeof(agc_rf_cfg));
260
261 /* Change the value of bit 6, 'nINAGCBY' and
262 'NSSEL[1:0] of ACG function control register 2 */
263 /* Change the value of bit 6 'RFFIX'
264 of AGC function control register 3 */
265 i2c_writebytes(state, state->config->demod_address,
266 agc_ctrl_cfg, sizeof(agc_ctrl_cfg));
267
268 /* Change the TPCLK pin polarity
269 data is valid on falling clock */
270 i2c_writebytes(state, state->config->demod_address,
271 demux_ctrl_cfg, sizeof(demux_ctrl_cfg));
272
273 /* Change the value of NCOCTFV[25:0] of carrier
274 recovery center frequency register */
275 i2c_writebytes(state, state->config->demod_address,
276 vsb_freq_cfg, sizeof(vsb_freq_cfg));
277
278 /* Set the value of 'INLVTHD' register 0x2a/0x2c to 0x7fe */
279 i2c_writebytes(state, state->config->demod_address,
280 agc_delay_cfg, sizeof(agc_delay_cfg));
281
282 /* Change the value of IAGCBW[15:8]
283 of inner AGC loop filter bandwith */
284 i2c_writebytes(state, state->config->demod_address,
285 agc_loop_cfg, sizeof(agc_loop_cfg));
286
287 state->config->set_ts_params(fe, 0);
288 state->current_modulation = param->u.vsb.modulation;
289 }
290
291 /* Change only if we are actually changing the channel */
292 if (state->current_frequency != param->frequency) {
293 dvb_pll_configure(state->config->pll_desc, buf,
294 param->frequency, 0);
295 dprintk("%s: tuner bytes: 0x%02x 0x%02x "
296 "0x%02x 0x%02x\n", __FUNCTION__, buf[0],buf[1],buf[2],buf[3]);
297 i2c_writebytes(state, state->config->pll_address ,buf, 4);
298
299 /* Check the status of the tuner pll */
300 i2c_readbytes(state, state->config->pll_address, buf, 1);
301 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
302
303 /* Update current frequency */
304 state->current_frequency = param->frequency;
305 }
306 lgdt3302_SwReset(state);
307 return 0;
308}
309
310static int lgdt3302_get_frontend(struct dvb_frontend* fe,
311 struct dvb_frontend_parameters* param)
312{
313 struct lgdt3302_state *state = fe->demodulator_priv;
314 param->frequency = state->current_frequency;
315 return 0;
316}
317
318static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
319{
320 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
321 u8 buf[3];
322
323 *status = 0; /* Reset status result */
324
325 /* Check the status of the tuner pll */
326 i2c_readbytes(state, state->config->pll_address, buf, 1);
327 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
328 if ((buf[0] & 0xc0) != 0x40)
329 return 0; /* Tuner PLL not locked or not powered on */
330
331 /*
332 * You must set the Mask bits to 1 in the IRQ_MASK in order
333 * to see that status bit in the IRQ_STATUS register.
334 * This is done in SwReset();
335 */
336
337 /* AGC status register */
338 i2c_selectreadbytes(state, AGC_STATUS, buf, 1);
339 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
340 if ((buf[0] & 0x0c) == 0x8){
341 /* Test signal does not exist flag */
342 /* as well as the AGC lock flag. */
343 *status |= FE_HAS_SIGNAL;
344 } else {
345 /* Without a signal all other status bits are meaningless */
346 return 0;
347 }
348
349 /* signal status */
350 i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf));
351 dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]);
352
353#if 0
354 /* Alternative method to check for a signal */
355 /* using the SNR good/bad interrupts. */
356 if ((buf[2] & 0x30) == 0x10)
357 *status |= FE_HAS_SIGNAL;
358#endif
359
360 /* sync status */
361 if ((buf[2] & 0x03) == 0x01) {
362 *status |= FE_HAS_SYNC;
363 }
364
365 /* FEC error status */
366 if ((buf[2] & 0x0c) == 0x08) {
367 *status |= FE_HAS_LOCK;
368 *status |= FE_HAS_VITERBI;
369 }
370
371 /* Carrier Recovery Lock Status Register */
372 i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1);
373 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
374 switch (state->current_modulation) {
375 case QAM_256:
376 case QAM_64:
377 /* Need to undestand why there are 3 lock levels here */
378 if ((buf[0] & 0x07) == 0x07)
379 *status |= FE_HAS_CARRIER;
380 break;
381 case VSB_8:
382 if ((buf[0] & 0x80) == 0x80)
383 *status |= FE_HAS_CARRIER;
384 break;
385 default:
386 printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__);
387 }
388
389 return 0;
390}
391
392static int lgdt3302_read_signal_strength(struct dvb_frontend* fe, u16* strength)
393{
394 /* not directly available. */
395 return 0;
396}
397
398static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
399{
400#ifdef SNR_IN_DB
401 /*
402 * Spec sheet shows formula for SNR_EQ = 10 log10(25 * 24**2 / noise)
403 * and SNR_PH = 10 log10(25 * 32**2 / noise) for equalizer and phase tracker
404 * respectively. The following tables are built on these formulas.
405 * The usual definition is SNR = 20 log10(signal/noise)
406 * If the specification is wrong the value retuned is 1/2 the actual SNR in db.
407 *
408 * This table is a an ordered list of noise values computed by the
409 * formula from the spec sheet such that the index into the table
410 * starting at 43 or 45 is the SNR value in db. There are duplicate noise
411 * value entries at the beginning because the SNR varies more than
412 * 1 db for a change of 1 digit in noise at very small values of noise.
413 *
414 * Examples from SNR_EQ table:
415 * noise SNR
416 * 0 43
417 * 1 42
418 * 2 39
419 * 3 37
420 * 4 36
421 * 5 35
422 * 6 34
423 * 7 33
424 * 8 33
425 * 9 32
426 * 10 32
427 * 11 31
428 * 12 31
429 * 13 30
430 */
431
432 static const u32 SNR_EQ[] =
433 { 1, 2, 2, 2, 3, 3, 4, 4, 5, 7,
434 9, 11, 13, 17, 21, 26, 33, 41, 52, 65,
435 81, 102, 129, 162, 204, 257, 323, 406, 511, 644,
436 810, 1020, 1284, 1616, 2035, 2561, 3224, 4059, 5110, 6433,
437 8098, 10195, 12835, 16158, 20341, 25608, 32238, 40585, 51094, 64323,
438 80978, 101945, 128341, 161571, 203406, 256073, 0x40000
439 };
440
441 static const u32 SNR_PH[] =
442 { 1, 2, 2, 2, 3, 3, 4, 5, 6, 8,
443 10, 12, 15, 19, 23, 29, 37, 46, 58, 73,
444 91, 115, 144, 182, 229, 288, 362, 456, 574, 722,
445 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216,
446 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151,
447 90833, 114351, 143960, 181235, 228161, 0x040000
448 };
449
450 static u8 buf[5];/* read data buffer */
451 static u32 noise; /* noise value */
452 static u32 snr_db; /* index into SNR_EQ[] */
453 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
454
455 /* read both equalizer and pase tracker noise data */
456 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
457
458 if (state->current_modulation == VSB_8) {
459 /* Equalizer Mean-Square Error Register for VSB */
460 noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
461
462 /*
463 * Look up noise value in table.
464 * A better search algorithm could be used...
465 * watch out there are duplicate entries.
466 */
467 for (snr_db = 0; snr_db < sizeof(SNR_EQ); snr_db++) {
468 if (noise < SNR_EQ[snr_db]) {
469 *snr = 43 - snr_db;
470 break;
471 }
472 }
473 } else {
474 /* Phase Tracker Mean-Square Error Register for QAM */
475 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
476
477 /* Look up noise value in table. */
478 for (snr_db = 0; snr_db < sizeof(SNR_PH); snr_db++) {
479 if (noise < SNR_PH[snr_db]) {
480 *snr = 45 - snr_db;
481 break;
482 }
483 }
484 }
485#else
486 /* Return the raw noise value */
487 static u8 buf[5];/* read data buffer */
488 static u32 noise; /* noise value */
489 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
490
491 /* read both equalizer and pase tracker noise data */
492 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
493
494 if (state->current_modulation == VSB_8) {
495 /* Equalizer Mean-Square Error Register for VSB */
496 noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
497 } else {
498 /* Phase Tracker Mean-Square Error Register for QAM */
499 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
500 }
501
502 /* Small values for noise mean signal is better so invert noise */
503 /* Noise is 19 bit value so discard 3 LSB*/
504 *snr = ~noise>>3;
505#endif
506
507 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
508
509 return 0;
510}
511
512static int lgdt3302_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
513{
514 /* I have no idea about this - it may not be needed */
515 fe_tune_settings->min_delay_ms = 500;
516 fe_tune_settings->step_size = 0;
517 fe_tune_settings->max_drift = 0;
518 return 0;
519}
520
521static void lgdt3302_release(struct dvb_frontend* fe)
522{
523 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
524 kfree(state);
525}
526
527static struct dvb_frontend_ops lgdt3302_ops;
528
529struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config,
530 struct i2c_adapter* i2c)
531{
532 struct lgdt3302_state* state = NULL;
533 u8 buf[1];
534
535 /* Allocate memory for the internal state */
536 state = (struct lgdt3302_state*) kmalloc(sizeof(struct lgdt3302_state), GFP_KERNEL);
537 if (state == NULL)
538 goto error;
539 memset(state,0,sizeof(*state));
540
541 /* Setup the state */
542 state->config = config;
543 state->i2c = i2c;
544 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
545 /* Verify communication with demod chip */
546 if (i2c_selectreadbytes(state, 2, buf, 1))
547 goto error;
548
549 state->current_frequency = -1;
550 state->current_modulation = -1;
551
552 /* Create dvb_frontend */
553 state->frontend.ops = &state->ops;
554 state->frontend.demodulator_priv = state;
555 return &state->frontend;
556
557error:
558 if (state)
559 kfree(state);
560 dprintk("%s: ERROR\n",__FUNCTION__);
561 return NULL;
562}
563
564static struct dvb_frontend_ops lgdt3302_ops = {
565 .info = {
566 .name= "LG Electronics LGDT3302 VSB/QAM Frontend",
567 .type = FE_ATSC,
568 .frequency_min= 54000000,
569 .frequency_max= 858000000,
570 .frequency_stepsize= 62500,
571 /* Symbol rate is for all VSB modes need to check QAM */
572 .symbol_rate_min = 10762000,
573 .symbol_rate_max = 10762000,
574 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
575 },
576 .init = lgdt3302_init,
577 .set_frontend = lgdt3302_set_parameters,
578 .get_frontend = lgdt3302_get_frontend,
579 .get_tune_settings = lgdt3302_get_tune_settings,
580 .read_status = lgdt3302_read_status,
581 .read_ber = lgdt3302_read_ber,
582 .read_signal_strength = lgdt3302_read_signal_strength,
583 .read_snr = lgdt3302_read_snr,
584 .read_ucblocks = lgdt3302_read_ucblocks,
585 .release = lgdt3302_release,
586};
587
588MODULE_DESCRIPTION("LGDT3302 [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
589MODULE_AUTHOR("Wilson Michaels");
590MODULE_LICENSE("GPL");
591
592EXPORT_SYMBOL(lgdt3302_attach);
593
594/*
595 * Local variables:
596 * c-basic-offset: 8
597 * compile-command: "make DVB=1"
598 * End:
599 */
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
new file mode 100644
index 000000000000..c48e7c11d708
--- /dev/null
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -0,0 +1,831 @@
1/*
2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
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
22/*
23 * NOTES ABOUT THIS DRIVER
24 *
25 * This Linux driver supports:
26 * DViCO FusionHDTV 3 Gold-Q
27 * DViCO FusionHDTV 3 Gold-T
28 * DViCO FusionHDTV 5 Gold
29 *
30 * TODO:
31 * signal strength always returns 0.
32 *
33 */
34
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/moduleparam.h>
38#include <linux/init.h>
39#include <linux/delay.h>
40#include <asm/byteorder.h>
41
42#include "dvb_frontend.h"
43#include "lgdt330x_priv.h"
44#include "lgdt330x.h"
45
46static int debug = 0;
47module_param(debug, int, 0644);
48MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off).");
49#define dprintk(args...) \
50do { \
51if (debug) printk(KERN_DEBUG "lgdt330x: " args); \
52} while (0)
53
54struct lgdt330x_state
55{
56 struct i2c_adapter* i2c;
57 struct dvb_frontend_ops ops;
58
59 /* Configuration settings */
60 const struct lgdt330x_config* config;
61
62 struct dvb_frontend frontend;
63
64 /* Demodulator private data */
65 fe_modulation_t current_modulation;
66
67 /* Tuner private data */
68 u32 current_frequency;
69};
70
71static int i2c_write_demod_bytes (struct lgdt330x_state* state,
72 u8 *buf, /* data bytes to send */
73 int len /* number of bytes to send */ )
74{
75 struct i2c_msg msg =
76 { .addr = state->config->demod_address,
77 .flags = 0,
78 .buf = buf,
79 .len = 2 };
80 int i;
81 int err;
82
83 for (i=0; i<len-1; i+=2){
84 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
85 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err);
86 if (err < 0)
87 return err;
88 else
89 return -EREMOTEIO;
90 }
91 msg.buf += 2;
92 }
93 return 0;
94}
95
96/*
97 * This routine writes the register (reg) to the demod bus
98 * then reads the data returned for (len) bytes.
99 */
100
101static u8 i2c_read_demod_bytes (struct lgdt330x_state* state,
102 enum I2C_REG reg, u8* buf, int len)
103{
104 u8 wr [] = { reg };
105 struct i2c_msg msg [] = {
106 { .addr = state->config->demod_address,
107 .flags = 0, .buf = wr, .len = 1 },
108 { .addr = state->config->demod_address,
109 .flags = I2C_M_RD, .buf = buf, .len = len },
110 };
111 int ret;
112 ret = i2c_transfer(state->i2c, msg, 2);
113 if (ret != 2) {
114 printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret);
115 } else {
116 ret = 0;
117 }
118 return ret;
119}
120
121/* Software reset */
122static int lgdt3302_SwReset(struct lgdt330x_state* state)
123{
124 u8 ret;
125 u8 reset[] = {
126 IRQ_MASK,
127 0x00 /* bit 6 is active low software reset
128 * bits 5-0 are 1 to mask interrupts */
129 };
130
131 ret = i2c_write_demod_bytes(state,
132 reset, sizeof(reset));
133 if (ret == 0) {
134
135 /* force reset high (inactive) and unmask interrupts */
136 reset[1] = 0x7f;
137 ret = i2c_write_demod_bytes(state,
138 reset, sizeof(reset));
139 }
140 return ret;
141}
142
143static int lgdt3303_SwReset(struct lgdt330x_state* state)
144{
145 u8 ret;
146 u8 reset[] = {
147 0x02,
148 0x00 /* bit 0 is active low software reset */
149 };
150
151 ret = i2c_write_demod_bytes(state,
152 reset, sizeof(reset));
153 if (ret == 0) {
154
155 /* force reset high (inactive) */
156 reset[1] = 0x01;
157 ret = i2c_write_demod_bytes(state,
158 reset, sizeof(reset));
159 }
160 return ret;
161}
162
163static int lgdt330x_SwReset(struct lgdt330x_state* state)
164{
165 switch (state->config->demod_chip) {
166 case LGDT3302:
167 return lgdt3302_SwReset(state);
168 case LGDT3303:
169 return lgdt3303_SwReset(state);
170 default:
171 return -ENODEV;
172 }
173}
174
175#ifdef MUTE_TDA9887
176static int i2c_write_ntsc_demod (struct lgdt330x_state* state, u8 buf[2])
177{
178 struct i2c_msg msg =
179 { .addr = 0x43,
180 .flags = 0,
181 .buf = buf,
182 .len = 2 };
183 int err;
184
185 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
186 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err);
187 if (err < 0)
188 return err;
189 else
190 return -EREMOTEIO;
191 }
192 return 0;
193}
194
195static void fiddle_with_ntsc_if_demod(struct lgdt330x_state* state)
196{
197 // Experimental code
198 u8 buf0[] = {0x00, 0x20};
199 u8 buf1[] = {0x01, 0x00};
200 u8 buf2[] = {0x02, 0x00};
201
202 i2c_write_ntsc_demod(state, buf0);
203 i2c_write_ntsc_demod(state, buf1);
204 i2c_write_ntsc_demod(state, buf2);
205}
206#endif
207
208static int lgdt330x_init(struct dvb_frontend* fe)
209{
210 /* Hardware reset is done using gpio[0] of cx23880x chip.
211 * I'd like to do it here, but don't know how to find chip address.
212 * cx88-cards.c arranges for the reset bit to be inactive (high).
213 * Maybe there needs to be a callable function in cx88-core or
214 * the caller of this function needs to do it. */
215
216 /*
217 * Array of byte pairs <address, value>
218 * to initialize each different chip
219 */
220 static u8 lgdt3302_init_data[] = {
221 /* Use 50MHz parameter values from spec sheet since xtal is 50 */
222 /* Change the value of NCOCTFV[25:0] of carrier
223 recovery center frequency register */
224 VSB_CARRIER_FREQ0, 0x00,
225 VSB_CARRIER_FREQ1, 0x87,
226 VSB_CARRIER_FREQ2, 0x8e,
227 VSB_CARRIER_FREQ3, 0x01,
228 /* Change the TPCLK pin polarity
229 data is valid on falling clock */
230 DEMUX_CONTROL, 0xfb,
231 /* Change the value of IFBW[11:0] of
232 AGC IF/RF loop filter bandwidth register */
233 AGC_RF_BANDWIDTH0, 0x40,
234 AGC_RF_BANDWIDTH1, 0x93,
235 AGC_RF_BANDWIDTH2, 0x00,
236 /* Change the value of bit 6, 'nINAGCBY' and
237 'NSSEL[1:0] of ACG function control register 2 */
238 AGC_FUNC_CTRL2, 0xc6,
239 /* Change the value of bit 6 'RFFIX'
240 of AGC function control register 3 */
241 AGC_FUNC_CTRL3, 0x40,
242 /* Set the value of 'INLVTHD' register 0x2a/0x2c
243 to 0x7fe */
244 AGC_DELAY0, 0x07,
245 AGC_DELAY2, 0xfe,
246 /* Change the value of IAGCBW[15:8]
247 of inner AGC loop filter bandwith */
248 AGC_LOOP_BANDWIDTH0, 0x08,
249 AGC_LOOP_BANDWIDTH1, 0x9a
250 };
251
252 static u8 lgdt3303_init_data[] = {
253 0x4c, 0x14
254 };
255
256 struct lgdt330x_state* state = fe->demodulator_priv;
257 char *chip_name;
258 int err;
259
260 switch (state->config->demod_chip) {
261 case LGDT3302:
262 chip_name = "LGDT3302";
263 err = i2c_write_demod_bytes(state, lgdt3302_init_data,
264 sizeof(lgdt3302_init_data));
265 break;
266 case LGDT3303:
267 chip_name = "LGDT3303";
268 err = i2c_write_demod_bytes(state, lgdt3303_init_data,
269 sizeof(lgdt3303_init_data));
270#ifdef MUTE_TDA9887
271 fiddle_with_ntsc_if_demod(state);
272#endif
273 break;
274 default:
275 chip_name = "undefined";
276 printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n");
277 err = -ENODEV;
278 }
279 dprintk("%s entered as %s\n", __FUNCTION__, chip_name);
280 if (err < 0)
281 return err;
282 return lgdt330x_SwReset(state);
283}
284
285static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber)
286{
287 *ber = 0; /* Not supplied by the demod chips */
288 return 0;
289}
290
291static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
292{
293 struct lgdt330x_state* state = fe->demodulator_priv;
294 int err;
295 u8 buf[2];
296
297 switch (state->config->demod_chip) {
298 case LGDT3302:
299 err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
300 buf, sizeof(buf));
301 break;
302 case LGDT3303:
303 err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
304 buf, sizeof(buf));
305 break;
306 default:
307 printk(KERN_WARNING
308 "Only LGDT3302 and LGDT3303 are supported chips.\n");
309 err = -ENODEV;
310 }
311
312 *ucblocks = (buf[0] << 8) | buf[1];
313 return 0;
314}
315
316static int lgdt330x_set_parameters(struct dvb_frontend* fe,
317 struct dvb_frontend_parameters *param)
318{
319 /*
320 * Array of byte pairs <address, value>
321 * to initialize 8VSB for lgdt3303 chip 50 MHz IF
322 */
323 static u8 lgdt3303_8vsb_44_data[] = {
324 0x04, 0x00,
325 0x0d, 0x40,
326 0x0e, 0x87,
327 0x0f, 0x8e,
328 0x10, 0x01,
329 0x47, 0x8b };
330
331 /*
332 * Array of byte pairs <address, value>
333 * to initialize QAM for lgdt3303 chip
334 */
335 static u8 lgdt3303_qam_data[] = {
336 0x04, 0x00,
337 0x0d, 0x00,
338 0x0e, 0x00,
339 0x0f, 0x00,
340 0x10, 0x00,
341 0x51, 0x63,
342 0x47, 0x66,
343 0x48, 0x66,
344 0x4d, 0x1a,
345 0x49, 0x08,
346 0x4a, 0x9b };
347
348 struct lgdt330x_state* state = fe->demodulator_priv;
349
350 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
351
352 int err;
353 /* Change only if we are actually changing the modulation */
354 if (state->current_modulation != param->u.vsb.modulation) {
355 switch(param->u.vsb.modulation) {
356 case VSB_8:
357 dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
358
359 /* Select VSB mode */
360 top_ctrl_cfg[1] = 0x03;
361
362 /* Select ANT connector if supported by card */
363 if (state->config->pll_rf_set)
364 state->config->pll_rf_set(fe, 1);
365
366 if (state->config->demod_chip == LGDT3303) {
367 err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
368 sizeof(lgdt3303_8vsb_44_data));
369 }
370 break;
371
372 case QAM_64:
373 dprintk("%s: QAM_64 MODE\n", __FUNCTION__);
374
375 /* Select QAM_64 mode */
376 top_ctrl_cfg[1] = 0x00;
377
378 /* Select CABLE connector if supported by card */
379 if (state->config->pll_rf_set)
380 state->config->pll_rf_set(fe, 0);
381
382 if (state->config->demod_chip == LGDT3303) {
383 err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
384 sizeof(lgdt3303_qam_data));
385 }
386 break;
387
388 case QAM_256:
389 dprintk("%s: QAM_256 MODE\n", __FUNCTION__);
390
391 /* Select QAM_256 mode */
392 top_ctrl_cfg[1] = 0x01;
393
394 /* Select CABLE connector if supported by card */
395 if (state->config->pll_rf_set)
396 state->config->pll_rf_set(fe, 0);
397
398 if (state->config->demod_chip == LGDT3303) {
399 err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
400 sizeof(lgdt3303_qam_data));
401 }
402 break;
403 default:
404 printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);
405 return -1;
406 }
407 /*
408 * select serial or parallel MPEG harware interface
409 * Serial: 0x04 for LGDT3302 or 0x40 for LGDT3303
410 * Parallel: 0x00
411 */
412 top_ctrl_cfg[1] |= state->config->serial_mpeg;
413
414 /* Select the requested mode */
415 i2c_write_demod_bytes(state, top_ctrl_cfg,
416 sizeof(top_ctrl_cfg));
417 state->config->set_ts_params(fe, 0);
418 state->current_modulation = param->u.vsb.modulation;
419 }
420
421 /* Change only if we are actually changing the channel */
422 if (state->current_frequency != param->frequency) {
423 /* Tune to the new frequency */
424 state->config->pll_set(fe, param);
425 /* Keep track of the new frequency */
426 state->current_frequency = param->frequency;
427 }
428 lgdt330x_SwReset(state);
429 return 0;
430}
431
432static int lgdt330x_get_frontend(struct dvb_frontend* fe,
433 struct dvb_frontend_parameters* param)
434{
435 struct lgdt330x_state *state = fe->demodulator_priv;
436 param->frequency = state->current_frequency;
437 return 0;
438}
439
440static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
441{
442 struct lgdt330x_state* state = fe->demodulator_priv;
443 u8 buf[3];
444
445 *status = 0; /* Reset status result */
446
447 /* AGC status register */
448 i2c_read_demod_bytes(state, AGC_STATUS, buf, 1);
449 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
450 if ((buf[0] & 0x0c) == 0x8){
451 /* Test signal does not exist flag */
452 /* as well as the AGC lock flag. */
453 *status |= FE_HAS_SIGNAL;
454 } else {
455 /* Without a signal all other status bits are meaningless */
456 return 0;
457 }
458
459 /*
460 * You must set the Mask bits to 1 in the IRQ_MASK in order
461 * to see that status bit in the IRQ_STATUS register.
462 * This is done in SwReset();
463 */
464 /* signal status */
465 i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf));
466 dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]);
467
468
469 /* sync status */
470 if ((buf[2] & 0x03) == 0x01) {
471 *status |= FE_HAS_SYNC;
472 }
473
474 /* FEC error status */
475 if ((buf[2] & 0x0c) == 0x08) {
476 *status |= FE_HAS_LOCK;
477 *status |= FE_HAS_VITERBI;
478 }
479
480 /* Carrier Recovery Lock Status Register */
481 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
482 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
483 switch (state->current_modulation) {
484 case QAM_256:
485 case QAM_64:
486 /* Need to undestand why there are 3 lock levels here */
487 if ((buf[0] & 0x07) == 0x07)
488 *status |= FE_HAS_CARRIER;
489 break;
490 case VSB_8:
491 if ((buf[0] & 0x80) == 0x80)
492 *status |= FE_HAS_CARRIER;
493 break;
494 default:
495 printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__);
496 }
497
498 return 0;
499}
500
501static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status)
502{
503 struct lgdt330x_state* state = fe->demodulator_priv;
504 int err;
505 u8 buf[3];
506
507 *status = 0; /* Reset status result */
508
509 /* lgdt3303 AGC status register */
510 err = i2c_read_demod_bytes(state, 0x58, buf, 1);
511 if (err < 0)
512 return err;
513
514 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
515 if ((buf[0] & 0x21) == 0x01){
516 /* Test input signal does not exist flag */
517 /* as well as the AGC lock flag. */
518 *status |= FE_HAS_SIGNAL;
519 } else {
520 /* Without a signal all other status bits are meaningless */
521 return 0;
522 }
523
524 /* Carrier Recovery Lock Status Register */
525 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
526 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
527 switch (state->current_modulation) {
528 case QAM_256:
529 case QAM_64:
530 /* Need to undestand why there are 3 lock levels here */
531 if ((buf[0] & 0x07) == 0x07)
532 *status |= FE_HAS_CARRIER;
533 else
534 break;
535 i2c_read_demod_bytes(state, 0x8a, buf, 1);
536 if ((buf[0] & 0x04) == 0x04)
537 *status |= FE_HAS_SYNC;
538 if ((buf[0] & 0x01) == 0x01)
539 *status |= FE_HAS_LOCK;
540 if ((buf[0] & 0x08) == 0x08)
541 *status |= FE_HAS_VITERBI;
542 break;
543 case VSB_8:
544 if ((buf[0] & 0x80) == 0x80)
545 *status |= FE_HAS_CARRIER;
546 else
547 break;
548 i2c_read_demod_bytes(state, 0x38, buf, 1);
549 if ((buf[0] & 0x02) == 0x00)
550 *status |= FE_HAS_SYNC;
551 if ((buf[0] & 0x01) == 0x01) {
552 *status |= FE_HAS_LOCK;
553 *status |= FE_HAS_VITERBI;
554 }
555 break;
556 default:
557 printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__);
558 }
559 return 0;
560}
561
562static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength)
563{
564 /* not directly available. */
565 *strength = 0;
566 return 0;
567}
568
569static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
570{
571#ifdef SNR_IN_DB
572 /*
573 * Spec sheet shows formula for SNR_EQ = 10 log10(25 * 24**2 / noise)
574 * and SNR_PH = 10 log10(25 * 32**2 / noise) for equalizer and phase tracker
575 * respectively. The following tables are built on these formulas.
576 * The usual definition is SNR = 20 log10(signal/noise)
577 * If the specification is wrong the value retuned is 1/2 the actual SNR in db.
578 *
579 * This table is a an ordered list of noise values computed by the
580 * formula from the spec sheet such that the index into the table
581 * starting at 43 or 45 is the SNR value in db. There are duplicate noise
582 * value entries at the beginning because the SNR varies more than
583 * 1 db for a change of 1 digit in noise at very small values of noise.
584 *
585 * Examples from SNR_EQ table:
586 * noise SNR
587 * 0 43
588 * 1 42
589 * 2 39
590 * 3 37
591 * 4 36
592 * 5 35
593 * 6 34
594 * 7 33
595 * 8 33
596 * 9 32
597 * 10 32
598 * 11 31
599 * 12 31
600 * 13 30
601 */
602
603 static const u32 SNR_EQ[] =
604 { 1, 2, 2, 2, 3, 3, 4, 4, 5, 7,
605 9, 11, 13, 17, 21, 26, 33, 41, 52, 65,
606 81, 102, 129, 162, 204, 257, 323, 406, 511, 644,
607 810, 1020, 1284, 1616, 2035, 2561, 3224, 4059, 5110, 6433,
608 8098, 10195, 12835, 16158, 20341, 25608, 32238, 40585, 51094, 64323,
609 80978, 101945, 128341, 161571, 203406, 256073, 0x40000
610 };
611
612 static const u32 SNR_PH[] =
613 { 1, 2, 2, 2, 3, 3, 4, 5, 6, 8,
614 10, 12, 15, 19, 23, 29, 37, 46, 58, 73,
615 91, 115, 144, 182, 229, 288, 362, 456, 574, 722,
616 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216,
617 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151,
618 90833, 114351, 143960, 181235, 228161, 0x080000
619 };
620
621 static u8 buf[5];/* read data buffer */
622 static u32 noise; /* noise value */
623 static u32 snr_db; /* index into SNR_EQ[] */
624 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
625
626 /* read both equalizer and phase tracker noise data */
627 i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf));
628
629 if (state->current_modulation == VSB_8) {
630 /* Equalizer Mean-Square Error Register for VSB */
631 noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
632
633 /*
634 * Look up noise value in table.
635 * A better search algorithm could be used...
636 * watch out there are duplicate entries.
637 */
638 for (snr_db = 0; snr_db < sizeof(SNR_EQ); snr_db++) {
639 if (noise < SNR_EQ[snr_db]) {
640 *snr = 43 - snr_db;
641 break;
642 }
643 }
644 } else {
645 /* Phase Tracker Mean-Square Error Register for QAM */
646 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
647
648 /* Look up noise value in table. */
649 for (snr_db = 0; snr_db < sizeof(SNR_PH); snr_db++) {
650 if (noise < SNR_PH[snr_db]) {
651 *snr = 45 - snr_db;
652 break;
653 }
654 }
655 }
656#else
657 /* Return the raw noise value */
658 static u8 buf[5];/* read data buffer */
659 static u32 noise; /* noise value */
660 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
661
662 /* read both equalizer and pase tracker noise data */
663 i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf));
664
665 if (state->current_modulation == VSB_8) {
666 /* Phase Tracker Mean-Square Error Register for VSB */
667 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
668 } else {
669
670 /* Carrier Recovery Mean-Square Error for QAM */
671 i2c_read_demod_bytes(state, 0x1a, buf, 2);
672 noise = ((buf[0] & 3) << 8) | buf[1];
673 }
674
675 /* Small values for noise mean signal is better so invert noise */
676 *snr = ~noise;
677#endif
678
679 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
680
681 return 0;
682}
683
684static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr)
685{
686 /* Return the raw noise value */
687 static u8 buf[5];/* read data buffer */
688 static u32 noise; /* noise value */
689 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
690
691 if (state->current_modulation == VSB_8) {
692
693 /* Phase Tracker Mean-Square Error Register for VSB */
694 noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4];
695 } else {
696
697 /* Carrier Recovery Mean-Square Error for QAM */
698 i2c_read_demod_bytes(state, 0x1a, buf, 2);
699 noise = (buf[0] << 8) | buf[1];
700 }
701
702 /* Small values for noise mean signal is better so invert noise */
703 *snr = ~noise;
704
705 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
706
707 return 0;
708}
709
710static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
711{
712 /* I have no idea about this - it may not be needed */
713 fe_tune_settings->min_delay_ms = 500;
714 fe_tune_settings->step_size = 0;
715 fe_tune_settings->max_drift = 0;
716 return 0;
717}
718
719static void lgdt330x_release(struct dvb_frontend* fe)
720{
721 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
722 kfree(state);
723}
724
725static struct dvb_frontend_ops lgdt3302_ops;
726static struct dvb_frontend_ops lgdt3303_ops;
727
728struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
729 struct i2c_adapter* i2c)
730{
731 struct lgdt330x_state* state = NULL;
732 u8 buf[1];
733
734 /* Allocate memory for the internal state */
735 state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
736 if (state == NULL)
737 goto error;
738 memset(state,0,sizeof(*state));
739
740 /* Setup the state */
741 state->config = config;
742 state->i2c = i2c;
743 switch (config->demod_chip) {
744 case LGDT3302:
745 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
746 break;
747 case LGDT3303:
748 memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops));
749 break;
750 default:
751 goto error;
752 }
753
754 /* Verify communication with demod chip */
755 if (i2c_read_demod_bytes(state, 2, buf, 1))
756 goto error;
757
758 state->current_frequency = -1;
759 state->current_modulation = -1;
760
761 /* Create dvb_frontend */
762 state->frontend.ops = &state->ops;
763 state->frontend.demodulator_priv = state;
764 return &state->frontend;
765
766error:
767 if (state)
768 kfree(state);
769 dprintk("%s: ERROR\n",__FUNCTION__);
770 return NULL;
771}
772
773static struct dvb_frontend_ops lgdt3302_ops = {
774 .info = {
775 .name= "LG Electronics LGDT3302/LGDT3303 VSB/QAM Frontend",
776 .type = FE_ATSC,
777 .frequency_min= 54000000,
778 .frequency_max= 858000000,
779 .frequency_stepsize= 62500,
780 /* Symbol rate is for all VSB modes need to check QAM */
781 .symbol_rate_min = 10762000,
782 .symbol_rate_max = 10762000,
783 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
784 },
785 .init = lgdt330x_init,
786 .set_frontend = lgdt330x_set_parameters,
787 .get_frontend = lgdt330x_get_frontend,
788 .get_tune_settings = lgdt330x_get_tune_settings,
789 .read_status = lgdt3302_read_status,
790 .read_ber = lgdt330x_read_ber,
791 .read_signal_strength = lgdt330x_read_signal_strength,
792 .read_snr = lgdt3302_read_snr,
793 .read_ucblocks = lgdt330x_read_ucblocks,
794 .release = lgdt330x_release,
795};
796
797static struct dvb_frontend_ops lgdt3303_ops = {
798 .info = {
799 .name= "LG Electronics LGDT3303 VSB/QAM Frontend",
800 .type = FE_ATSC,
801 .frequency_min= 54000000,
802 .frequency_max= 858000000,
803 .frequency_stepsize= 62500,
804 /* Symbol rate is for all VSB modes need to check QAM */
805 .symbol_rate_min = 10762000,
806 .symbol_rate_max = 10762000,
807 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
808 },
809 .init = lgdt330x_init,
810 .set_frontend = lgdt330x_set_parameters,
811 .get_frontend = lgdt330x_get_frontend,
812 .get_tune_settings = lgdt330x_get_tune_settings,
813 .read_status = lgdt3303_read_status,
814 .read_ber = lgdt330x_read_ber,
815 .read_signal_strength = lgdt330x_read_signal_strength,
816 .read_snr = lgdt3303_read_snr,
817 .read_ucblocks = lgdt330x_read_ucblocks,
818 .release = lgdt330x_release,
819};
820
821MODULE_DESCRIPTION("LGDT330X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
822MODULE_AUTHOR("Wilson Michaels");
823MODULE_LICENSE("GPL");
824
825EXPORT_SYMBOL(lgdt330x_attach);
826
827/*
828 * Local variables:
829 * c-basic-offset: 8
830 * End:
831 */
diff --git a/drivers/media/dvb/frontends/lgdt3302.h b/drivers/media/dvb/frontends/lgdt330x.h
index 81587a40032b..e209ba1e47c5 100644
--- a/drivers/media/dvb/frontends/lgdt3302.h
+++ b/drivers/media/dvb/frontends/lgdt330x.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * $Id: lgdt3302.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ 2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 *
4 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
5 * 3 *
6 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
7 * 5 *
@@ -21,26 +19,40 @@
21 * 19 *
22 */ 20 */
23 21
24#ifndef LGDT3302_H 22#ifndef LGDT330X_H
25#define LGDT3302_H 23#define LGDT330X_H
26 24
27#include <linux/dvb/frontend.h> 25#include <linux/dvb/frontend.h>
28 26
29struct lgdt3302_config 27typedef enum lg_chip_t {
28 UNDEFINED,
29 LGDT3302,
30 LGDT3303
31}lg_chip_type;
32
33struct lgdt330x_config
30{ 34{
31 /* The demodulator's i2c address */ 35 /* The demodulator's i2c address */
32 u8 demod_address; 36 u8 demod_address;
33 u8 pll_address; 37
34 struct dvb_pll_desc *pll_desc; 38 /* LG demodulator chip LGDT3302 or LGDT3303 */
39 lg_chip_type demod_chip;
40
41 /* MPEG hardware interface - 0:parallel 1:serial */
42 int serial_mpeg;
43
44 /* PLL interface */
45 int (*pll_rf_set) (struct dvb_frontend* fe, int index);
46 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
35 47
36 /* Need to set device param for start_dma */ 48 /* Need to set device param for start_dma */
37 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); 49 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
38}; 50};
39 51
40extern struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config, 52extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
41 struct i2c_adapter* i2c); 53 struct i2c_adapter* i2c);
42 54
43#endif /* LGDT3302_H */ 55#endif /* LGDT330X_H */
44 56
45/* 57/*
46 * Local variables: 58 * Local variables:
diff --git a/drivers/media/dvb/frontends/lgdt3302_priv.h b/drivers/media/dvb/frontends/lgdt330x_priv.h
index 6193fa7a569d..59b7c5b9012d 100644
--- a/drivers/media/dvb/frontends/lgdt3302_priv.h
+++ b/drivers/media/dvb/frontends/lgdt330x_priv.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * $Id: lgdt3302_priv.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ 2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 *
4 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
5 * 3 *
6 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
7 * 5 *
@@ -21,8 +19,8 @@
21 * 19 *
22 */ 20 */
23 21
24#ifndef _LGDT3302_PRIV_ 22#ifndef _LGDT330X_PRIV_
25#define _LGDT3302_PRIV_ 23#define _LGDT330X_PRIV_
26 24
27/* i2c control register addresses */ 25/* i2c control register addresses */
28enum I2C_REG { 26enum I2C_REG {
@@ -59,11 +57,13 @@ enum I2C_REG {
59 PH_ERR1= 0x4a, 57 PH_ERR1= 0x4a,
60 PH_ERR2= 0x4b, 58 PH_ERR2= 0x4b,
61 DEMUX_CONTROL= 0x66, 59 DEMUX_CONTROL= 0x66,
62 PACKET_ERR_COUNTER1= 0x6a, 60 LGDT3302_PACKET_ERR_COUNTER1= 0x6a,
63 PACKET_ERR_COUNTER2= 0x6b, 61 LGDT3302_PACKET_ERR_COUNTER2= 0x6b,
62 LGDT3303_PACKET_ERR_COUNTER1= 0x8b,
63 LGDT3303_PACKET_ERR_COUNTER2= 0x8c,
64}; 64};
65 65
66#endif /* _LGDT3302_PRIV_ */ 66#endif /* _LGDT330X_PRIV_ */
67 67
68/* 68/*
69 * Local variables: 69 * Local variables:
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index e62147e4ed1b..e5e2021a7312 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -154,7 +154,7 @@ static void radio_bits_set(struct radio_device *dev, __u32 data)
154 msleep(125); 154 msleep(125);
155} 155}
156 156
157inline static int radio_function(struct inode *inode, struct file *file, 157static inline int radio_function(struct inode *inode, struct file *file,
158 unsigned int cmd, void *arg) 158 unsigned int cmd, void *arg)
159{ 159{
160 struct video_device *dev = video_devdata(file); 160 struct video_device *dev = video_devdata(file);
@@ -283,7 +283,7 @@ static int __init maestro_radio_init(void)
283module_init(maestro_radio_init); 283module_init(maestro_radio_init);
284module_exit(maestro_radio_exit); 284module_exit(maestro_radio_exit);
285 285
286inline static __u16 radio_power_on(struct radio_device *dev) 286static inline __u16 radio_power_on(struct radio_device *dev)
287{ 287{
288 register __u16 io=dev->io; 288 register __u16 io=dev->io;
289 register __u32 ofreq; 289 register __u32 ofreq;
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 5b748a48ce72..02d39a50d5ed 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -166,7 +166,7 @@ static int get_tune(__u16 io)
166} 166}
167 167
168 168
169inline static int radio_function(struct inode *inode, struct file *file, 169static inline int radio_function(struct inode *inode, struct file *file,
170 unsigned int cmd, void *arg) 170 unsigned int cmd, void *arg)
171{ 171{
172 struct video_device *dev = video_devdata(file); 172 struct video_device *dev = video_devdata(file);
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f461750c7646..ac81e5e01a9a 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -236,7 +236,7 @@ config VIDEO_MEYE
236 236
237config VIDEO_SAA7134 237config VIDEO_SAA7134
238 tristate "Philips SAA7134 support" 238 tristate "Philips SAA7134 support"
239 depends on VIDEO_DEV && PCI && I2C 239 depends on VIDEO_DEV && PCI && I2C && SOUND
240 select VIDEO_BUF 240 select VIDEO_BUF
241 select VIDEO_IR 241 select VIDEO_IR
242 select VIDEO_TUNER 242 select VIDEO_TUNER
@@ -331,7 +331,7 @@ config VIDEO_CX88_DVB
331 select DVB_MT352 331 select DVB_MT352
332 select DVB_OR51132 332 select DVB_OR51132
333 select DVB_CX22702 333 select DVB_CX22702
334 select DVB_LGDT3302 334 select DVB_LGDT330X
335 ---help--- 335 ---help---
336 This adds support for DVB/ATSC cards based on the 336 This adds support for DVB/ATSC cards based on the
337 Connexant 2388x chip. 337 Connexant 2388x chip.
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 2dbf5ec43abd..a97b9b958ed6 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $ 2 $Id: bttv-cards.c,v 1.54 2005/07/19 18:26:46 mkrufky Exp $
3 3
4 bttv-cards.c 4 bttv-cards.c
5 5
@@ -95,7 +95,7 @@ static int __devinit pvr_boot(struct bttv *btv);
95static unsigned int triton1=0; 95static unsigned int triton1=0;
96static unsigned int vsfx=0; 96static unsigned int vsfx=0;
97static unsigned int latency = UNSET; 97static unsigned int latency = UNSET;
98static unsigned int no_overlay=-1; 98int no_overlay=-1;
99 99
100static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; 100static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
101static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; 101static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
@@ -2772,8 +2772,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
2772 } 2772 }
2773 btv->pll.pll_current = -1; 2773 btv->pll.pll_current = -1;
2774 2774
2775 bttv_reset_audio(btv);
2776
2777 /* tuner configuration (from card list / autodetect / insmod option) */ 2775 /* tuner configuration (from card list / autodetect / insmod option) */
2778 if (UNSET != bttv_tvcards[btv->c.type].tuner_type) 2776 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2779 if(UNSET == btv->tuner_type) 2777 if(UNSET == btv->tuner_type)
@@ -4298,9 +4296,11 @@ void __devinit bttv_check_chipset(void)
4298 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n"); 4296 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4299 if (pcipci_fail) { 4297 if (pcipci_fail) {
4300 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n"); 4298 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4301 if (UNSET == no_overlay) { 4299 if (!no_overlay) {
4302 printk(KERN_WARNING "bttv: going to disable overlay.\n"); 4300 printk(KERN_WARNING "bttv: overlay will be disabled.\n");
4303 no_overlay = 1; 4301 no_overlay = 1;
4302 } else {
4303 printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n");
4304 } 4304 }
4305 } 4305 }
4306 if (UNSET != latency) 4306 if (UNSET != latency)
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 51a0f6d68e73..eee9322ce21b 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $ 2 $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -80,6 +80,7 @@ static unsigned int irq_iswitch = 0;
80static unsigned int uv_ratio = 50; 80static unsigned int uv_ratio = 50;
81static unsigned int full_luma_range = 0; 81static unsigned int full_luma_range = 0;
82static unsigned int coring = 0; 82static unsigned int coring = 0;
83extern int no_overlay;
83 84
84/* API features (turn on/off stuff for testing) */ 85/* API features (turn on/off stuff for testing) */
85static unsigned int v4l2 = 1; 86static unsigned int v4l2 = 1;
@@ -2151,6 +2152,10 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
2151 return 0; 2152 return 0;
2152 } 2153 }
2153 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 2154 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
2155 if (no_overlay > 0) {
2156 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
2157 return -EINVAL;
2158 }
2154 return setup_window(fh, btv, &f->fmt.win, 1); 2159 return setup_window(fh, btv, &f->fmt.win, 1);
2155 case V4L2_BUF_TYPE_VBI_CAPTURE: 2160 case V4L2_BUF_TYPE_VBI_CAPTURE:
2156 retval = bttv_switch_type(fh,f->type); 2161 retval = bttv_switch_type(fh,f->type);
@@ -2224,9 +2229,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2224 /* others */ 2229 /* others */
2225 cap->type = VID_TYPE_CAPTURE| 2230 cap->type = VID_TYPE_CAPTURE|
2226 VID_TYPE_TUNER| 2231 VID_TYPE_TUNER|
2227 VID_TYPE_OVERLAY|
2228 VID_TYPE_CLIPPING| 2232 VID_TYPE_CLIPPING|
2229 VID_TYPE_SCALES; 2233 VID_TYPE_SCALES;
2234 if (no_overlay <= 0)
2235 cap->type |= VID_TYPE_OVERLAY;
2236
2230 cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; 2237 cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth;
2231 cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; 2238 cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight;
2232 cap->minwidth = 48; 2239 cap->minwidth = 48;
@@ -2302,6 +2309,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2302 struct video_window *win = arg; 2309 struct video_window *win = arg;
2303 struct v4l2_window w2; 2310 struct v4l2_window w2;
2304 2311
2312 if (no_overlay > 0) {
2313 printk ("VIDIOCSWIN: no_overlay\n");
2314 return -EINVAL;
2315 }
2316
2305 w2.field = V4L2_FIELD_ANY; 2317 w2.field = V4L2_FIELD_ANY;
2306 w2.w.left = win->x; 2318 w2.w.left = win->x;
2307 w2.w.top = win->y; 2319 w2.w.top = win->y;
@@ -2577,10 +2589,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2577 cap->version = BTTV_VERSION_CODE; 2589 cap->version = BTTV_VERSION_CODE;
2578 cap->capabilities = 2590 cap->capabilities =
2579 V4L2_CAP_VIDEO_CAPTURE | 2591 V4L2_CAP_VIDEO_CAPTURE |
2580 V4L2_CAP_VIDEO_OVERLAY |
2581 V4L2_CAP_VBI_CAPTURE | 2592 V4L2_CAP_VBI_CAPTURE |
2582 V4L2_CAP_READWRITE | 2593 V4L2_CAP_READWRITE |
2583 V4L2_CAP_STREAMING; 2594 V4L2_CAP_STREAMING;
2595 if (no_overlay <= 0)
2596 cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
2597
2584 if (bttv_tvcards[btv->c.type].tuner != UNSET && 2598 if (bttv_tvcards[btv->c.type].tuner != UNSET &&
2585 bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) 2599 bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT)
2586 cap->capabilities |= V4L2_CAP_TUNER; 2600 cap->capabilities |= V4L2_CAP_TUNER;
@@ -3076,7 +3090,7 @@ static struct file_operations bttv_fops =
3076static struct video_device bttv_video_template = 3090static struct video_device bttv_video_template =
3077{ 3091{
3078 .name = "UNSET", 3092 .name = "UNSET",
3079 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| 3093 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
3080 VID_TYPE_CLIPPING|VID_TYPE_SCALES, 3094 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
3081 .hardware = VID_HARDWARE_BT848, 3095 .hardware = VID_HARDWARE_BT848,
3082 .fops = &bttv_fops, 3096 .fops = &bttv_fops,
@@ -3756,6 +3770,12 @@ static void bttv_unregister_video(struct bttv *btv)
3756/* register video4linux devices */ 3770/* register video4linux devices */
3757static int __devinit bttv_register_video(struct bttv *btv) 3771static int __devinit bttv_register_video(struct bttv *btv)
3758{ 3772{
3773 if (no_overlay <= 0) {
3774 bttv_video_template.type |= VID_TYPE_OVERLAY;
3775 } else {
3776 printk("bttv: Overlay support disabled.\n");
3777 }
3778
3759 /* video */ 3779 /* video */
3760 btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); 3780 btv->video_dev = vdev_init(btv, &bttv_video_template, "video");
3761 if (NULL == btv->video_dev) 3781 if (NULL == btv->video_dev)
@@ -3869,11 +3889,6 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3869 pci_set_master(dev); 3889 pci_set_master(dev);
3870 pci_set_command(dev); 3890 pci_set_command(dev);
3871 pci_set_drvdata(dev,btv); 3891 pci_set_drvdata(dev,btv);
3872 if (!pci_dma_supported(dev,0xffffffff)) {
3873 printk("bttv%d: Oops: no 32bit PCI DMA ???\n", btv->c.nr);
3874 result = -EIO;
3875 goto fail1;
3876 }
3877 3892
3878 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); 3893 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision);
3879 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 3894 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
index 191eaf1714ba..f2af9e1454f0 100644
--- a/drivers/media/video/bttv.h
+++ b/drivers/media/video/bttv.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ 2 * $Id: bttv.h,v 1.22 2005/07/28 18:41:21 mchehab Exp $
3 * 3 *
4 * bttv - Bt848 frame grabber driver 4 * bttv - Bt848 frame grabber driver
5 * 5 *
@@ -135,7 +135,9 @@
135#define BTTV_DVICO_DVBT_LITE 0x80 135#define BTTV_DVICO_DVBT_LITE 0x80
136#define BTTV_TIBET_CS16 0x83 136#define BTTV_TIBET_CS16 0x83
137#define BTTV_KODICOM_4400R 0x84 137#define BTTV_KODICOM_4400R 0x84
138#define BTTV_ADLINK_RTV24 0x85 138#define BTTV_ADLINK_RTV24 0x86
139#define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87
140#define BTTV_ACORP_Y878F 0x88
139 141
140/* i2c address list */ 142/* i2c address list */
141#define I2C_TSA5522 0xc2 143#define I2C_TSA5522 0xc2
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index f3293e4a15ad..aab094bc243d 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $ 2 $Id: bttvp.h,v 1.21 2005/07/15 21:44:14 mchehab Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -27,7 +27,7 @@
27#define _BTTVP_H_ 27#define _BTTVP_H_
28 28
29#include <linux/version.h> 29#include <linux/version.h>
30#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,15) 30#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16)
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/wait.h> 33#include <linux/wait.h>
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 606d0348da2c..107e48645e3a 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -9,3 +9,15 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
9EXTRA_CFLAGS += -I$(src)/.. 9EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
12ifneq ($(CONFIG_DVB_CX22702),n)
13 EXTRA_CFLAGS += -DHAVE_CX22702=1
14endif
15ifneq ($(CONFIG_DVB_OR51132),n)
16 EXTRA_CFLAGS += -DHAVE_OR51132=1
17endif
18ifneq ($(CONFIG_DVB_LGDT330X),n)
19 EXTRA_CFLAGS += -DHAVE_LGDT330X=1
20endif
21ifneq ($(CONFIG_DVB_MT352),n)
22 EXTRA_CFLAGS += -DHAVE_MT352=1
23endif
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 3d0c784b376f..ebf02a7f81e8 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-cards.c,v 1.86 2005/07/14 03:06:43 mchehab Exp $ 2 * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * card-specific stuff. 5 * card-specific stuff.
@@ -90,6 +90,9 @@ struct cx88_board cx88_boards[] = {
90 .input = {{ 90 .input = {{
91 .type = CX88_VMUX_TELEVISION, 91 .type = CX88_VMUX_TELEVISION,
92 .vmux = 0, 92 .vmux = 0,
93 },{
94 .type = CX88_VMUX_SVIDEO,
95 .vmux = 2,
93 }}, 96 }},
94 }, 97 },
95 [CX88_BOARD_PIXELVIEW] = { 98 [CX88_BOARD_PIXELVIEW] = {
@@ -496,6 +499,9 @@ struct cx88_board cx88_boards[] = {
496 .input = {{ 499 .input = {{
497 .type = CX88_VMUX_DVB, 500 .type = CX88_VMUX_DVB,
498 .vmux = 0, 501 .vmux = 0,
502 },{
503 .type = CX88_VMUX_SVIDEO,
504 .vmux = 2,
499 }}, 505 }},
500 .dvb = 1, 506 .dvb = 1,
501 }, 507 },
@@ -753,6 +759,27 @@ struct cx88_board cx88_boards[] = {
753 }}, 759 }},
754 .dvb = 1, 760 .dvb = 1,
755 }, 761 },
762 [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
763 .name = "DViCO FusionHDTV 5 Gold",
764 .tuner_type = TUNER_LG_TDVS_H062F,
765 .radio_type = UNSET,
766 .tuner_addr = ADDR_UNSET,
767 .radio_addr = ADDR_UNSET,
768 /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */
769 .input = {{
770 .type = CX88_VMUX_TELEVISION,
771 .vmux = 0,
772 .gpio0 = 0x0f0d,
773 },{
774 .type = CX88_VMUX_COMPOSITE1,
775 .vmux = 1,
776 .gpio0 = 0x0f00,
777 },{
778 .type = CX88_VMUX_SVIDEO,
779 .vmux = 2,
780 .gpio0 = 0x0f00,
781 }},
782 },
756}; 783};
757const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); 784const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
758 785
@@ -880,6 +907,10 @@ struct cx88_subid cx88_subids[] = {
880 .subvendor = 0x153b, 907 .subvendor = 0x153b,
881 .subdevice = 0x1166, 908 .subdevice = 0x1166,
882 .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, 909 .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
910 },{
911 .subvendor = 0x18ac,
912 .subdevice = 0xd500,
913 .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
883 }, 914 },
884}; 915};
885const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); 916const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 6ad1458ab652..78d223257a68 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-dvb.c,v 1.42 2005/07/12 15:44:55 mkrufky Exp $ 2 * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * MPEG Transport Stream (DVB) routines 5 * MPEG Transport Stream (DVB) routines
@@ -29,27 +29,23 @@
29#include <linux/kthread.h> 29#include <linux/kthread.h>
30#include <linux/file.h> 30#include <linux/file.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32 32#include <linux/config.h>
33#define CONFIG_DVB_MT352 1
34#define CONFIG_DVB_CX22702 1
35#define CONFIG_DVB_OR51132 1
36#define CONFIG_DVB_LGDT3302 1
37 33
38#include "cx88.h" 34#include "cx88.h"
39#include "dvb-pll.h" 35#include "dvb-pll.h"
40 36
41#if CONFIG_DVB_MT352 37#ifdef HAVE_MT352
42# include "mt352.h" 38# include "mt352.h"
43# include "mt352_priv.h" 39# include "mt352_priv.h"
44#endif 40#endif
45#if CONFIG_DVB_CX22702 41#ifdef HAVE_CX22702
46# include "cx22702.h" 42# include "cx22702.h"
47#endif 43#endif
48#if CONFIG_DVB_OR51132 44#ifdef HAVE_OR51132
49# include "or51132.h" 45# include "or51132.h"
50#endif 46#endif
51#if CONFIG_DVB_LGDT3302 47#ifdef HAVE_LGDT330X
52# include "lgdt3302.h" 48# include "lgdt330x.h"
53#endif 49#endif
54 50
55MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); 51MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
@@ -107,7 +103,7 @@ static struct videobuf_queue_ops dvb_qops = {
107 103
108/* ------------------------------------------------------------------ */ 104/* ------------------------------------------------------------------ */
109 105
110#if CONFIG_DVB_MT352 106#ifdef HAVE_MT352
111static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 107static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
112{ 108{
113 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 109 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
@@ -177,7 +173,7 @@ static struct mt352_config dntv_live_dvbt_config = {
177}; 173};
178#endif 174#endif
179 175
180#if CONFIG_DVB_CX22702 176#ifdef HAVE_CX22702
181static struct cx22702_config connexant_refboard_config = { 177static struct cx22702_config connexant_refboard_config = {
182 .demod_address = 0x43, 178 .demod_address = 0x43,
183 .output_mode = CX22702_SERIAL_OUTPUT, 179 .output_mode = CX22702_SERIAL_OUTPUT,
@@ -193,7 +189,7 @@ static struct cx22702_config hauppauge_novat_config = {
193}; 189};
194#endif 190#endif
195 191
196#if CONFIG_DVB_OR51132 192#ifdef HAVE_OR51132
197static int or51132_set_ts_param(struct dvb_frontend* fe, 193static int or51132_set_ts_param(struct dvb_frontend* fe,
198 int is_punctured) 194 int is_punctured)
199{ 195{
@@ -210,8 +206,45 @@ static struct or51132_config pchdtv_hd3000 = {
210}; 206};
211#endif 207#endif
212 208
213#if CONFIG_DVB_LGDT3302 209#ifdef HAVE_LGDT330X
214static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) 210static int lgdt330x_pll_set(struct dvb_frontend* fe,
211 struct dvb_frontend_parameters* params)
212{
213 struct cx8802_dev *dev= fe->dvb->priv;
214 u8 buf[4];
215 struct i2c_msg msg =
216 { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 };
217 int err;
218
219 dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0);
220 dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
221 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
222 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
223 printk(KERN_WARNING "cx88-dvb: %s error "
224 "(addr %02x <- %02x, err = %i)\n",
225 __FUNCTION__, buf[0], buf[1], err);
226 if (err < 0)
227 return err;
228 else
229 return -EREMOTEIO;
230 }
231 return 0;
232}
233
234static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
235{
236 struct cx8802_dev *dev= fe->dvb->priv;
237 struct cx88_core *core = dev->core;
238
239 dprintk(1, "%s: index = %d\n", __FUNCTION__, index);
240 if (index == 0)
241 cx_clear(MO_GP0_IO, 8);
242 else
243 cx_set(MO_GP0_IO, 8);
244 return 0;
245}
246
247static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
215{ 248{
216 struct cx8802_dev *dev= fe->dvb->priv; 249 struct cx8802_dev *dev= fe->dvb->priv;
217 if (is_punctured) 250 if (is_punctured)
@@ -221,18 +254,12 @@ static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
221 return 0; 254 return 0;
222} 255}
223 256
224static struct lgdt3302_config fusionhdtv_3_gold_q = { 257static struct lgdt330x_config fusionhdtv_3_gold = {
225 .demod_address = 0x0e,
226 .pll_address = 0x61,
227 .pll_desc = &dvb_pll_microtune_4042,
228 .set_ts_params = lgdt3302_set_ts_param,
229};
230
231static struct lgdt3302_config fusionhdtv_3_gold_t = {
232 .demod_address = 0x0e, 258 .demod_address = 0x0e,
233 .pll_address = 0x61, 259 .demod_chip = LGDT3302,
234 .pll_desc = &dvb_pll_thomson_dtt7611, 260 .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
235 .set_ts_params = lgdt3302_set_ts_param, 261 .pll_set = lgdt330x_pll_set,
262 .set_ts_params = lgdt330x_set_ts_param,
236}; 263};
237#endif 264#endif
238 265
@@ -244,7 +271,7 @@ static int dvb_register(struct cx8802_dev *dev)
244 271
245 /* init frontend */ 272 /* init frontend */
246 switch (dev->core->board) { 273 switch (dev->core->board) {
247#if CONFIG_DVB_CX22702 274#ifdef HAVE_CX22702
248 case CX88_BOARD_HAUPPAUGE_DVB_T1: 275 case CX88_BOARD_HAUPPAUGE_DVB_T1:
249 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, 276 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
250 &dev->core->i2c_adap); 277 &dev->core->i2c_adap);
@@ -255,7 +282,7 @@ static int dvb_register(struct cx8802_dev *dev)
255 &dev->core->i2c_adap); 282 &dev->core->i2c_adap);
256 break; 283 break;
257#endif 284#endif
258#if CONFIG_DVB_MT352 285#ifdef HAVE_MT352
259 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 286 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
260 dev->core->pll_addr = 0x61; 287 dev->core->pll_addr = 0x61;
261 dev->core->pll_desc = &dvb_pll_lg_z201; 288 dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -277,13 +304,13 @@ static int dvb_register(struct cx8802_dev *dev)
277 &dev->core->i2c_adap); 304 &dev->core->i2c_adap);
278 break; 305 break;
279#endif 306#endif
280#if CONFIG_DVB_OR51132 307#ifdef HAVE_OR51132
281 case CX88_BOARD_PCHDTV_HD3000: 308 case CX88_BOARD_PCHDTV_HD3000:
282 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, 309 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
283 &dev->core->i2c_adap); 310 &dev->core->i2c_adap);
284 break; 311 break;
285#endif 312#endif
286#if CONFIG_DVB_LGDT3302 313#ifdef HAVE_LGDT330X
287 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 314 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
288 dev->ts_gen_cntrl = 0x08; 315 dev->ts_gen_cntrl = 0x08;
289 { 316 {
@@ -292,9 +319,14 @@ static int dvb_register(struct cx8802_dev *dev)
292 319
293 cx_clear(MO_GP0_IO, 1); 320 cx_clear(MO_GP0_IO, 1);
294 mdelay(100); 321 mdelay(100);
295 cx_set(MO_GP0_IO, 9); // ANT connector too FIXME 322 cx_set(MO_GP0_IO, 1);
296 mdelay(200); 323 mdelay(200);
297 dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_q, 324
325 /* Select RF connector callback */
326 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
327 dev->core->pll_addr = 0x61;
328 dev->core->pll_desc = &dvb_pll_microtune_4042;
329 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
298 &dev->core->i2c_adap); 330 &dev->core->i2c_adap);
299 } 331 }
300 break; 332 break;
@@ -306,9 +338,11 @@ static int dvb_register(struct cx8802_dev *dev)
306 338
307 cx_clear(MO_GP0_IO, 1); 339 cx_clear(MO_GP0_IO, 1);
308 mdelay(100); 340 mdelay(100);
309 cx_set(MO_GP0_IO, 9); /* ANT connector too FIXME */ 341 cx_set(MO_GP0_IO, 9);
310 mdelay(200); 342 mdelay(200);
311 dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_t, 343 dev->core->pll_addr = 0x61;
344 dev->core->pll_desc = &dvb_pll_thomson_dtt7611;
345 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
312 &dev->core->i2c_adap); 346 &dev->core->i2c_adap);
313 } 347 }
314 break; 348 break;
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 8403c4e95050..a628a55299c6 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $ 2 $Id: cx88-i2c.c,v 1.30 2005/07/25 05:10:13 mkrufky Exp $
3 3
4 cx88-i2c.c -- all the i2c code is here 4 cx88-i2c.c -- all the i2c code is here
5 5
@@ -164,7 +164,7 @@ static struct i2c_client cx8800_i2c_client_template = {
164}; 164};
165 165
166static char *i2c_devs[128] = { 166static char *i2c_devs[128] = {
167 [ 0x1c >> 1 ] = "lgdt3302", 167 [ 0x1c >> 1 ] = "lgdt330x",
168 [ 0x86 >> 1 ] = "tda9887/cx22702", 168 [ 0x86 >> 1 ] = "tda9887/cx22702",
169 [ 0xa0 >> 1 ] = "eeprom", 169 [ 0xa0 >> 1 ] = "eeprom",
170 [ 0xc0 >> 1 ] = "tuner (analog)", 170 [ 0xc0 >> 1 ] = "tuner (analog)",
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 5588a3aeecb4..5f58c103198a 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-video.c,v 1.80 2005/07/13 08:49:08 mchehab Exp $ 2 * $Id: cx88-video.c,v 1.82 2005/07/22 05:13:34 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * video4linux video interface 5 * video4linux video interface
@@ -758,10 +758,10 @@ static int video_open(struct inode *inode, struct file *file)
758 struct cx88_core *core = dev->core; 758 struct cx88_core *core = dev->core;
759 int board = core->board; 759 int board = core->board;
760 dprintk(1,"video_open: setting radio device\n"); 760 dprintk(1,"video_open: setting radio device\n");
761 cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3);
761 cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); 762 cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0);
762 cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); 763 cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1);
763 cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); 764 cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2);
764 cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3);
765 dev->core->tvaudio = WW_FM; 765 dev->core->tvaudio = WW_FM;
766 cx88_set_tvaudio(core); 766 cx88_set_tvaudio(core);
767 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); 767 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index b008f7db6dfd..da65dc92787c 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88.h,v 1.69 2005/07/13 17:25:25 mchehab Exp $ 2 * $Id: cx88.h,v 1.70 2005/07/24 17:44:09 mkrufky Exp $
3 * 3 *
4 * v4l2 device driver for cx2388x based TV cards 4 * v4l2 device driver for cx2388x based TV cards
5 * 5 *
@@ -171,6 +171,7 @@ extern struct sram_channel cx88_sram_channels[];
171#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 171#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28
172#define CX88_BOARD_ADSTECH_DVB_T_PCI 29 172#define CX88_BOARD_ADSTECH_DVB_T_PCI 29
173#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 173#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30
174#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31
174 175
175enum cx88_itype { 176enum cx88_itype {
176 CX88_VMUX_COMPOSITE1 = 1, 177 CX88_VMUX_COMPOSITE1 = 1,
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index 6239254db27e..62f1b8ddb98b 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -741,11 +741,9 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout)
741 schedule_timeout(msecs_to_jiffies(timeout)); 741 schedule_timeout(msecs_to_jiffies(timeout));
742 } 742 }
743 } 743 }
744 if (current->flags & PF_FREEZE) {
745 refrigerator ();
746 }
747 744
748 remove_wait_queue(&msp->wq, &wait); 745 remove_wait_queue(&msp->wq, &wait);
746 try_to_freeze();
749 return msp->restart; 747 return msp->restart;
750} 748}
751 749
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 486234d41b56..d04793fb80fc 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -142,8 +142,8 @@ struct mxb
142 142
143 int cur_mode; /* current audio mode (mono, stereo, ...) */ 143 int cur_mode; /* current audio mode (mono, stereo, ...) */
144 int cur_input; /* current input */ 144 int cur_input; /* current input */
145 int cur_freq; /* current frequency the tuner is tuned to */
146 int cur_mute; /* current mute status */ 145 int cur_mute; /* current mute status */
146 struct v4l2_frequency cur_freq; /* current frequency the tuner is tuned to */
147}; 147};
148 148
149static struct saa7146_extension extension; 149static struct saa7146_extension extension;
@@ -352,9 +352,15 @@ static int mxb_init_done(struct saa7146_dev* dev)
352 /* select a tuner type */ 352 /* select a tuner type */
353 tun_setup.mode_mask = T_ANALOG_TV; 353 tun_setup.mode_mask = T_ANALOG_TV;
354 tun_setup.addr = ADDR_UNSET; 354 tun_setup.addr = ADDR_UNSET;
355 tun_setup.type = 5; 355 tun_setup.type = TUNER_PHILIPS_PAL;
356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); 356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
357 357 /* tune in some frequency on tuner */
358 mxb->cur_freq.tuner = 0;
359 mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
360 mxb->cur_freq.frequency = freq;
361 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY,
362 &mxb->cur_freq);
363
358 /* mute audio on tea6420s */ 364 /* mute audio on tea6420s */
359 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 365 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
360 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 366 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
@@ -371,12 +377,8 @@ static int mxb_init_done(struct saa7146_dev* dev)
371 vm.out = 13; 377 vm.out = 13;
372 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 378 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
373 379
374 /* tune in some frequency on tuner */
375 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &freq);
376
377 /* the rest for mxb */ 380 /* the rest for mxb */
378 mxb->cur_input = 0; 381 mxb->cur_input = 0;
379 mxb->cur_freq = freq;
380 mxb->cur_mute = 1; 382 mxb->cur_mute = 1;
381 383
382 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 384 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
@@ -819,18 +821,14 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
819 return -EINVAL; 821 return -EINVAL;
820 } 822 }
821 823
822 memset(f,0,sizeof(*f)); 824 *f = mxb->cur_freq;
823 f->type = V4L2_TUNER_ANALOG_TV;
824 f->frequency = mxb->cur_freq;
825 825
826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq)); 826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency));
827 return 0; 827 return 0;
828 } 828 }
829 case VIDIOC_S_FREQUENCY: 829 case VIDIOC_S_FREQUENCY:
830 { 830 {
831 struct v4l2_frequency *f = arg; 831 struct v4l2_frequency *f = arg;
832 int t_locked = 0;
833 int v_byte = 0;
834 832
835 if (0 != f->tuner) 833 if (0 != f->tuner)
836 return -EINVAL; 834 return -EINVAL;
@@ -843,20 +841,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
843 return -EINVAL; 841 return -EINVAL;
844 } 842 }
845 843
846 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n",f->frequency)); 844 mxb->cur_freq = *f;
847 845 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency));
848 mxb->cur_freq = f->frequency;
849 846
850 /* tune in desired frequency */ 847 /* tune in desired frequency */
851 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &mxb->cur_freq); 848 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq);
852
853 /* check if pll of tuner & saa7111a is locked */
854// mxb->tuner->driver->command(mxb->tuner,TUNER_IS_LOCKED, &t_locked);
855 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_GET_STATUS, &v_byte);
856
857 /* not locked -- anything to do here ? */
858 if( 0 == t_locked || 0 == (v_byte & DECODER_STATUS_GOOD)) {
859 }
860 849
861 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ 850 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */
862 spin_lock(&dev->slock); 851 spin_lock(&dev->slock);
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index e577a06b136b..b778ffd94e65 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -9,3 +9,9 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
9EXTRA_CFLAGS += -I$(src)/.. 9EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
12ifneq ($(CONFIG_DVB_MT352),n)
13 EXTRA_CFLAGS += -DHAVE_MT352=1
14endif
15ifneq ($(CONFIG_DVB_TDA1004X),n)
16 EXTRA_CFLAGS += -DHAVE_TDA1004X=1
17endif
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 334bc1850092..8be6a90358c8 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $ 2 * $Id: saa7134-dvb.c,v 1.23 2005/07/24 22:12:47 mkrufky Exp $
3 * 3 *
4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
5 * 5 *
@@ -29,18 +29,17 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/kthread.h> 30#include <linux/kthread.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32#include <linux/config.h>
32 33
33#define CONFIG_DVB_MT352 1
34#define CONFIG_DVB_TDA1004X 1
35 34
36#include "saa7134-reg.h" 35#include "saa7134-reg.h"
37#include "saa7134.h" 36#include "saa7134.h"
38 37
39#if CONFIG_DVB_MT352 38#ifdef HAVE_MT352
40# include "mt352.h" 39# include "mt352.h"
41# include "mt352_priv.h" /* FIXME */ 40# include "mt352_priv.h" /* FIXME */
42#endif 41#endif
43#if CONFIG_DVB_TDA1004X 42#ifdef HAVE_TDA1004X
44# include "tda1004x.h" 43# include "tda1004x.h"
45#endif 44#endif
46 45
@@ -54,7 +53,7 @@ MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
54 53
55/* ------------------------------------------------------------------ */ 54/* ------------------------------------------------------------------ */
56 55
57#if CONFIG_DVB_MT352 56#ifdef HAVE_MT352
58static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) 57static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
59{ 58{
60 u32 ok; 59 u32 ok;
@@ -153,7 +152,7 @@ static struct mt352_config pinnacle_300i = {
153 152
154/* ------------------------------------------------------------------ */ 153/* ------------------------------------------------------------------ */
155 154
156#if CONFIG_DVB_TDA1004X 155#ifdef HAVE_TDA1004X
157static int philips_tu1216_pll_init(struct dvb_frontend *fe) 156static int philips_tu1216_pll_init(struct dvb_frontend *fe)
158{ 157{
159 struct saa7134_dev *dev = fe->dvb->priv; 158 struct saa7134_dev *dev = fe->dvb->priv;
@@ -385,7 +384,7 @@ static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
385 return 0; 384 return 0;
386} 385}
387 386
388 387#ifdef HAVE_TDA1004X
389static struct tda1004x_config medion_cardbus = { 388static struct tda1004x_config medion_cardbus = {
390 .demod_address = 0x08, 389 .demod_address = 0x08,
391 .invert = 1, 390 .invert = 1,
@@ -398,6 +397,7 @@ static struct tda1004x_config medion_cardbus = {
398 .pll_sleep = philips_fmd1216_analog, 397 .pll_sleep = philips_fmd1216_analog,
399 .request_firmware = NULL, 398 .request_firmware = NULL,
400}; 399};
400#endif
401 401
402/* ------------------------------------------------------------------ */ 402/* ------------------------------------------------------------------ */
403 403
@@ -547,14 +547,14 @@ static int dvb_init(struct saa7134_dev *dev)
547 dev); 547 dev);
548 548
549 switch (dev->board) { 549 switch (dev->board) {
550#if CONFIG_DVB_MT352 550#ifdef HAVE_MT352
551 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 551 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
552 printk("%s: pinnacle 300i dvb setup\n",dev->name); 552 printk("%s: pinnacle 300i dvb setup\n",dev->name);
553 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 553 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
554 &dev->i2c_adap); 554 &dev->i2c_adap);
555 break; 555 break;
556#endif 556#endif
557#if CONFIG_DVB_TDA1004X 557#ifdef HAVE_TDA1004X
558 case SAA7134_BOARD_MD7134: 558 case SAA7134_BOARD_MD7134:
559 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 559 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
560 &dev->i2c_adap); 560 &dev->i2c_adap);
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index 93dd61978541..1203b93a572c 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $ 2 * $Id: saa7134-i2c.c,v 1.22 2005/07/22 04:09:41 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * i2c interface support 5 * i2c interface support
@@ -300,6 +300,8 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
300 status = i2c_get_status(dev); 300 status = i2c_get_status(dev);
301 if (i2c_is_error(status)) 301 if (i2c_is_error(status))
302 goto err; 302 goto err;
303 /* ensure that the bus is idle for at least one bit slot */
304 msleep(1);
303 305
304 d1printk("\n"); 306 d1printk("\n");
305 return num; 307 return num;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 6836c07794fc..2af0cb2a731b 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $ 2 * $Id: saa7134.h,v 1.49 2005/07/13 17:25:25 mchehab Exp $
3 * 3 *
4 * v4l2 device driver for philips saa7134 based TV cards 4 * v4l2 device driver for philips saa7134 based TV cards
5 * 5 *
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#include <linux/version.h> 23#include <linux/version.h>
24#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) 24#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,14)
25 25
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index 4d27ac1b7fb8..cebcc1fa68d1 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview 2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3 * I2C address is allways 0xC0. 3 * I2C address is allways 0xC0.
4 * 4 *
5 * $Id: tea5767.c,v 1.21 2005/07/14 03:06:43 mchehab Exp $ 5 * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $
6 * 6 *
7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) 7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
8 * This code is placed under the terms of the GNU General Public License 8 * This code is placed under the terms of the GNU General Public License
@@ -15,7 +15,6 @@
15#include <linux/videodev.h> 15#include <linux/videodev.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <media/tuner.h> 17#include <media/tuner.h>
18#include <media/tuner.h>
19 18
20#define PREFIX "TEA5767 " 19#define PREFIX "TEA5767 "
21 20
@@ -293,16 +292,16 @@ static int tea5767_stereo(struct i2c_client *c)
293 292
294int tea5767_autodetection(struct i2c_client *c) 293int tea5767_autodetection(struct i2c_client *c)
295{ 294{
296 unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; 295 unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
297 int rc; 296 int rc;
298 struct tuner *t = i2c_get_clientdata(c); 297 struct tuner *t = i2c_get_clientdata(c);
299 298
300 if (5 != (rc = i2c_master_recv(c, buffer, 5))) { 299 if (7 != (rc = i2c_master_recv(c, buffer, 7))) {
301 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); 300 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
302 return EINVAL; 301 return EINVAL;
303 } 302 }
304 303
305 /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ 304 /* If all bytes are the same then it's a TV tuner and not a tea5767 */
306 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && 305 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
307 buffer[0] == buffer[3] && buffer[0] == buffer[4]) { 306 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
308 tuner_warn("All bytes are equal. It is not a TEA5767\n"); 307 tuner_warn("All bytes are equal. It is not a TEA5767\n");
@@ -318,6 +317,17 @@ int tea5767_autodetection(struct i2c_client *c)
318 tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); 317 tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
319 return EINVAL; 318 return EINVAL;
320 } 319 }
320 /* It seems that tea5767 returns 0xff after the 5th byte */
321 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
322 tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
323 return EINVAL;
324 }
325
326 /* It seems that tea5767 returns 0xff after the 5th byte */
327 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
328 tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
329 return EINVAL;
330 }
321 331
322 tuner_warn("TEA5767 detected.\n"); 332 tuner_warn("TEA5767 detected.\n");
323 return 0; 333 return 0;
@@ -327,10 +337,8 @@ int tea5767_tuner_init(struct i2c_client *c)
327{ 337{
328 struct tuner *t = i2c_get_clientdata(c); 338 struct tuner *t = i2c_get_clientdata(c);
329 339
330 if (tea5767_autodetection(c) == EINVAL) 340 tuner_info("type set to %d (%s)\n", t->type,
331 return EINVAL; 341 "Philips TEA5767HN FM Radio");
332
333 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
334 strlcpy(c->name, "tea5767", sizeof(c->name)); 342 strlcpy(c->name, "tea5767", sizeof(c->name));
335 343
336 t->tv_freq = set_tv_freq; 344 t->tv_freq = set_tv_freq;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index b25a9c08ac02..f0a579827a24 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-core.c,v 1.58 2005/07/14 03:06:43 mchehab Exp $ 2 * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * core core, i.e. kernel interfaces, registering and so on 5 * core core, i.e. kernel interfaces, registering and so on
@@ -23,6 +23,8 @@
23#include <media/tuner.h> 23#include <media/tuner.h>
24#include <media/audiochip.h> 24#include <media/audiochip.h>
25 25
26#include "msp3400.h"
27
26#define UNSET (-1U) 28#define UNSET (-1U)
27 29
28/* standard i2c insmod options */ 30/* standard i2c insmod options */
@@ -42,6 +44,9 @@ module_param(addr, int, 0444);
42static unsigned int no_autodetect = 0; 44static unsigned int no_autodetect = 0;
43module_param(no_autodetect, int, 0444); 45module_param(no_autodetect, int, 0444);
44 46
47static unsigned int show_i2c = 0;
48module_param(show_i2c, int, 0444);
49
45/* insmod options used at runtime => read/write */ 50/* insmod options used at runtime => read/write */
46unsigned int tuner_debug = 0; 51unsigned int tuner_debug = 0;
47module_param(tuner_debug, int, 0644); 52module_param(tuner_debug, int, 0644);
@@ -320,6 +325,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
320 325
321 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); 326 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
322 327
328 if (show_i2c) {
329 unsigned char buffer[16];
330 int i,rc;
331
332 memset(buffer, 0, sizeof(buffer));
333 rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
334 printk("tuner-%04x I2C RECV = ",addr);
335 for (i=0;i<rc;i++)
336 printk("%02x ",buffer[i]);
337 printk("\n");
338 }
323 /* TEA5767 autodetection code - only for addr = 0xc0 */ 339 /* TEA5767 autodetection code - only for addr = 0xc0 */
324 if (!no_autodetect) { 340 if (!no_autodetect) {
325 if (addr == 0x60) { 341 if (addr == 0x60) {
@@ -451,6 +467,17 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
451 break; 467 break;
452 } 468 }
453 break; 469 break;
470 case VIDIOCSAUDIO:
471 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
472 return 0;
473 if (check_v4l2(t) == EINVAL)
474 return 0;
475
476 /* Should be implemented, since bttv calls it */
477 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
478
479 break;
480 case MSP_SET_MATRIX:
454 case TDA9887_SET_CONFIG: 481 case TDA9887_SET_CONFIG:
455 break; 482 break;
456 /* --- v4l ioctls --- */ 483 /* --- v4l ioctls --- */
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index a3f8e83f5314..de0c93aeb75d 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $ 2 * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls all those simple 4-control-bytes style tuners. 5 * controls all those simple 4-control-bytes style tuners.
@@ -245,6 +245,12 @@ static struct tunertype tuners[] = {
245 /* see tea5767.c for details */}, 245 /* see tea5767.c for details */},
246 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, 246 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL,
247 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, 247 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 },
248
249 { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC,
250 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732},
251
252 { "Ymec TVF66T5-B/DFF", Philips, PAL,
253 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623},
248}; 254};
249 255
250unsigned const int tuner_count = ARRAY_SIZE(tuners); 256unsigned const int tuner_count = ARRAY_SIZE(tuners);
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index d8b78f1d686b..f42a1efa8fcf 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -285,6 +285,7 @@ static int chip_thread(void *data)
285 schedule(); 285 schedule();
286 } 286 }
287 remove_wait_queue(&chip->wq, &wait); 287 remove_wait_queue(&chip->wq, &wait);
288 try_to_freeze();
288 if (chip->done || signal_pending(current)) 289 if (chip->done || signal_pending(current))
289 break; 290 break;
290 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); 291 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index e8d9440977cb..127ec38ebd60 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -189,7 +189,7 @@ hauppauge_tuner[] =
189 { TUNER_ABSENT, "Philips FQ1236 MK3"}, 189 { TUNER_ABSENT, "Philips FQ1236 MK3"},
190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"},
191 { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, 191 { TUNER_ABSENT, "Samsung TCPE 4121P30A"},
192 { TUNER_ABSENT, "TCL MFPE05 2"}, 192 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"},
193 /* 90-99 */ 193 /* 90-99 */
194 { TUNER_ABSENT, "LG TALN H202T"}, 194 { TUNER_ABSENT, "LG TALN H202T"},
195 { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, 195 { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"},
@@ -445,6 +445,7 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
445} 445}
446EXPORT_SYMBOL(tveeprom_read); 446EXPORT_SYMBOL(tveeprom_read);
447 447
448#if 0
448int tveeprom_dump(unsigned char *eedata, int len) 449int tveeprom_dump(unsigned char *eedata, int len)
449{ 450{
450 int i; 451 int i;
@@ -460,6 +461,7 @@ int tveeprom_dump(unsigned char *eedata, int len)
460 return 0; 461 return 0;
461} 462}
462EXPORT_SYMBOL(tveeprom_dump); 463EXPORT_SYMBOL(tveeprom_dump);
464#endif /* 0 */
463 465
464/* ----------------------------------------------------------------------- */ 466/* ----------------------------------------------------------------------- */
465/* needed for ivtv.sf.net at the moment. Should go away in the long */ 467/* needed for ivtv.sf.net at the moment. Should go away in the long */
@@ -477,7 +479,7 @@ static unsigned short normal_i2c[] = {
477 479
478I2C_CLIENT_INSMOD; 480I2C_CLIENT_INSMOD;
479 481
480struct i2c_driver i2c_driver_tveeprom; 482static struct i2c_driver i2c_driver_tveeprom;
481 483
482static int 484static int
483tveeprom_command(struct i2c_client *client, 485tveeprom_command(struct i2c_client *client,
@@ -549,7 +551,7 @@ tveeprom_detach_client (struct i2c_client *client)
549 return 0; 551 return 0;
550} 552}
551 553
552struct i2c_driver i2c_driver_tveeprom = { 554static struct i2c_driver i2c_driver_tveeprom = {
553 .owner = THIS_MODULE, 555 .owner = THIS_MODULE,
554 .name = "tveeprom", 556 .name = "tveeprom",
555 .id = I2C_DRIVERID_TVEEPROM, 557 .id = I2C_DRIVERID_TVEEPROM,
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 0c41d4b41a65..8b487ed1069c 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -1053,7 +1053,7 @@ static void wbsd_detect_card(unsigned long data)
1053 * Tasklets 1053 * Tasklets
1054 */ 1054 */
1055 1055
1056inline static struct mmc_data* wbsd_get_data(struct wbsd_host* host) 1056static inline struct mmc_data* wbsd_get_data(struct wbsd_host* host)
1057{ 1057{
1058 WARN_ON(!host->mrq); 1058 WARN_ON(!host->mrq);
1059 if (!host->mrq) 1059 if (!host->mrq)
diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c
index 933877ff4d88..9a087c1fb0b7 100644
--- a/drivers/mtd/devices/docecc.c
+++ b/drivers/mtd/devices/docecc.c
@@ -40,6 +40,7 @@
40#include <linux/mtd/mtd.h> 40#include <linux/mtd/mtd.h>
41#include <linux/mtd/doc2000.h> 41#include <linux/mtd/doc2000.h>
42 42
43#define DEBUG 0
43/* need to undef it (from asm/termbits.h) */ 44/* need to undef it (from asm/termbits.h) */
44#undef B0 45#undef B0
45 46
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index ad17f17e8e7a..111601ca4ca3 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -272,7 +272,7 @@ static inline void set_hsf(struct net_device *dev, int hsf)
272 272
273static int start_receive(struct net_device *, pcb_struct *); 273static int start_receive(struct net_device *, pcb_struct *);
274 274
275inline static void adapter_reset(struct net_device *dev) 275static inline void adapter_reset(struct net_device *dev)
276{ 276{
277 unsigned long timeout; 277 unsigned long timeout;
278 elp_device *adapter = dev->priv; 278 elp_device *adapter = dev->priv;
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 5a4a08a7c951..4c2cf7bbd252 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -126,14 +126,14 @@
126#define USE_IO_OPS 1 126#define USE_IO_OPS 1
127#endif 127#endif
128 128
129/* define to 1 to enable copious debugging info */ 129/* define to 1, 2 or 3 to enable copious debugging info */
130#undef RTL8139_DEBUG 130#define RTL8139_DEBUG 0
131 131
132/* define to 1 to disable lightweight runtime debugging checks */ 132/* define to 1 to disable lightweight runtime debugging checks */
133#undef RTL8139_NDEBUG 133#undef RTL8139_NDEBUG
134 134
135 135
136#ifdef RTL8139_DEBUG 136#if RTL8139_DEBUG
137/* note: prints function name for you */ 137/* note: prints function name for you */
138# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) 138# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
139#else 139#else
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 534b598866b3..8a835eb58808 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -23,9 +23,12 @@ config NETDEVICES
23 23
24 If unsure, say Y. 24 If unsure, say Y.
25 25
26# All the following symbols are dependent on NETDEVICES - do not repeat
27# that for each of the symbols.
28if NETDEVICES
29
26config DUMMY 30config DUMMY
27 tristate "Dummy net driver support" 31 tristate "Dummy net driver support"
28 depends on NETDEVICES
29 ---help--- 32 ---help---
30 This is essentially a bit-bucket device (i.e. traffic you send to 33 This is essentially a bit-bucket device (i.e. traffic you send to
31 this device is consigned into oblivion) with a configurable IP 34 this device is consigned into oblivion) with a configurable IP
@@ -45,7 +48,6 @@ config DUMMY
45 48
46config BONDING 49config BONDING
47 tristate "Bonding driver support" 50 tristate "Bonding driver support"
48 depends on NETDEVICES
49 depends on INET 51 depends on INET
50 ---help--- 52 ---help---
51 Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet 53 Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
@@ -63,7 +65,6 @@ config BONDING
63 65
64config EQUALIZER 66config EQUALIZER
65 tristate "EQL (serial line load balancing) support" 67 tristate "EQL (serial line load balancing) support"
66 depends on NETDEVICES
67 ---help--- 68 ---help---
68 If you have two serial connections to some other computer (this 69 If you have two serial connections to some other computer (this
69 usually requires two modems and two telephone lines) and you use 70 usually requires two modems and two telephone lines) and you use
@@ -83,7 +84,6 @@ config EQUALIZER
83 84
84config TUN 85config TUN
85 tristate "Universal TUN/TAP device driver support" 86 tristate "Universal TUN/TAP device driver support"
86 depends on NETDEVICES
87 select CRC32 87 select CRC32
88 ---help--- 88 ---help---
89 TUN/TAP provides packet reception and transmission for user space 89 TUN/TAP provides packet reception and transmission for user space
@@ -107,7 +107,7 @@ config TUN
107 107
108config NET_SB1000 108config NET_SB1000
109 tristate "General Instruments Surfboard 1000" 109 tristate "General Instruments Surfboard 1000"
110 depends on NETDEVICES && PNP 110 depends on PNP
111 ---help--- 111 ---help---
112 This is a driver for the General Instrument (also known as 112 This is a driver for the General Instrument (also known as
113 NextLevel) SURFboard 1000 internal 113 NextLevel) SURFboard 1000 internal
@@ -129,16 +129,14 @@ config NET_SB1000
129 129
130 If you don't have this card, of course say N. 130 If you don't have this card, of course say N.
131 131
132if NETDEVICES
133 source "drivers/net/arcnet/Kconfig" 132 source "drivers/net/arcnet/Kconfig"
134endif
135 133
136# 134#
137# Ethernet 135# Ethernet
138# 136#
139 137
140menu "Ethernet (10 or 100Mbit)" 138menu "Ethernet (10 or 100Mbit)"
141 depends on NETDEVICES && !UML 139 depends on !UML
142 140
143config NET_ETHERNET 141config NET_ETHERNET
144 bool "Ethernet (10 or 100Mbit)" 142 bool "Ethernet (10 or 100Mbit)"
@@ -1137,7 +1135,7 @@ config IBMLANA
1137 1135
1138config IBMVETH 1136config IBMVETH
1139 tristate "IBM LAN Virtual Ethernet support" 1137 tristate "IBM LAN Virtual Ethernet support"
1140 depends on NETDEVICES && NET_ETHERNET && PPC_PSERIES 1138 depends on NET_ETHERNET && PPC_PSERIES
1141 ---help--- 1139 ---help---
1142 This driver supports virtual ethernet adapters on newer IBM iSeries 1140 This driver supports virtual ethernet adapters on newer IBM iSeries
1143 and pSeries systems. 1141 and pSeries systems.
@@ -1760,7 +1758,7 @@ endmenu
1760# 1758#
1761 1759
1762menu "Ethernet (1000 Mbit)" 1760menu "Ethernet (1000 Mbit)"
1763 depends on NETDEVICES && !UML 1761 depends on !UML
1764 1762
1765config ACENIC 1763config ACENIC
1766 tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support" 1764 tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support"
@@ -2091,7 +2089,7 @@ endmenu
2091# 2089#
2092 2090
2093menu "Ethernet (10000 Mbit)" 2091menu "Ethernet (10000 Mbit)"
2094 depends on NETDEVICES && !UML 2092 depends on !UML
2095 2093
2096config IXGB 2094config IXGB
2097 tristate "Intel(R) PRO/10GbE support" 2095 tristate "Intel(R) PRO/10GbE support"
@@ -2186,11 +2184,11 @@ source "drivers/s390/net/Kconfig"
2186 2184
2187config ISERIES_VETH 2185config ISERIES_VETH
2188 tristate "iSeries Virtual Ethernet driver support" 2186 tristate "iSeries Virtual Ethernet driver support"
2189 depends on NETDEVICES && PPC_ISERIES 2187 depends on PPC_ISERIES
2190 2188
2191config FDDI 2189config FDDI
2192 bool "FDDI driver support" 2190 bool "FDDI driver support"
2193 depends on NETDEVICES && (PCI || EISA) 2191 depends on (PCI || EISA)
2194 help 2192 help
2195 Fiber Distributed Data Interface is a high speed local area network 2193 Fiber Distributed Data Interface is a high speed local area network
2196 design; essentially a replacement for high speed Ethernet. FDDI can 2194 design; essentially a replacement for high speed Ethernet. FDDI can
@@ -2239,7 +2237,7 @@ config SKFP
2239 2237
2240config HIPPI 2238config HIPPI
2241 bool "HIPPI driver support (EXPERIMENTAL)" 2239 bool "HIPPI driver support (EXPERIMENTAL)"
2242 depends on NETDEVICES && EXPERIMENTAL && INET && PCI 2240 depends on EXPERIMENTAL && INET && PCI
2243 help 2241 help
2244 HIgh Performance Parallel Interface (HIPPI) is a 800Mbit/sec and 2242 HIgh Performance Parallel Interface (HIPPI) is a 800Mbit/sec and
2245 1600Mbit/sec dual-simplex switched or point-to-point network. HIPPI 2243 1600Mbit/sec dual-simplex switched or point-to-point network. HIPPI
@@ -2271,7 +2269,7 @@ config ROADRUNNER_LARGE_RINGS
2271 2269
2272config PLIP 2270config PLIP
2273 tristate "PLIP (parallel port) support" 2271 tristate "PLIP (parallel port) support"
2274 depends on NETDEVICES && PARPORT 2272 depends on PARPORT
2275 ---help--- 2273 ---help---
2276 PLIP (Parallel Line Internet Protocol) is used to create a 2274 PLIP (Parallel Line Internet Protocol) is used to create a
2277 reasonably fast mini network consisting of two (or, rarely, more) 2275 reasonably fast mini network consisting of two (or, rarely, more)
@@ -2307,7 +2305,6 @@ config PLIP
2307 2305
2308config PPP 2306config PPP
2309 tristate "PPP (point-to-point protocol) support" 2307 tristate "PPP (point-to-point protocol) support"
2310 depends on NETDEVICES
2311 ---help--- 2308 ---help---
2312 PPP (Point to Point Protocol) is a newer and better SLIP. It serves 2309 PPP (Point to Point Protocol) is a newer and better SLIP. It serves
2313 the same purpose: sending Internet traffic over telephone (and other 2310 the same purpose: sending Internet traffic over telephone (and other
@@ -2443,7 +2440,6 @@ config PPPOATM
2443 2440
2444config SLIP 2441config SLIP
2445 tristate "SLIP (serial line) support" 2442 tristate "SLIP (serial line) support"
2446 depends on NETDEVICES
2447 ---help--- 2443 ---help---
2448 Say Y if you intend to use SLIP or CSLIP (compressed SLIP) to 2444 Say Y if you intend to use SLIP or CSLIP (compressed SLIP) to
2449 connect to your Internet service provider or to connect to some 2445 connect to your Internet service provider or to connect to some
@@ -2510,7 +2506,7 @@ config SLIP_MODE_SLIP6
2510 2506
2511config NET_FC 2507config NET_FC
2512 bool "Fibre Channel driver support" 2508 bool "Fibre Channel driver support"
2513 depends on NETDEVICES && SCSI && PCI 2509 depends on SCSI && PCI
2514 help 2510 help
2515 Fibre Channel is a high speed serial protocol mainly used to connect 2511 Fibre Channel is a high speed serial protocol mainly used to connect
2516 large storage devices to the computer; it is compatible with and 2512 large storage devices to the computer; it is compatible with and
@@ -2523,7 +2519,7 @@ config NET_FC
2523 2519
2524config SHAPER 2520config SHAPER
2525 tristate "Traffic Shaper (EXPERIMENTAL)" 2521 tristate "Traffic Shaper (EXPERIMENTAL)"
2526 depends on NETDEVICES && EXPERIMENTAL 2522 depends on EXPERIMENTAL
2527 ---help--- 2523 ---help---
2528 The traffic shaper is a virtual network device that allows you to 2524 The traffic shaper is a virtual network device that allows you to
2529 limit the rate of outgoing data flow over some other network device. 2525 limit the rate of outgoing data flow over some other network device.
@@ -2544,11 +2540,13 @@ config SHAPER
2544 2540
2545config NETCONSOLE 2541config NETCONSOLE
2546 tristate "Network console logging support (EXPERIMENTAL)" 2542 tristate "Network console logging support (EXPERIMENTAL)"
2547 depends on NETDEVICES && INET && EXPERIMENTAL 2543 depends on EXPERIMENTAL
2548 ---help--- 2544 ---help---
2549 If you want to log kernel messages over the network, enable this. 2545 If you want to log kernel messages over the network, enable this.
2550 See <file:Documentation/networking/netconsole.txt> for details. 2546 See <file:Documentation/networking/netconsole.txt> for details.
2551 2547
2548endif #NETDEVICES
2549
2552config NETPOLL 2550config NETPOLL
2553 def_bool NETCONSOLE 2551 def_bool NETCONSOLE
2554 2552
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 8618012df06a..d9ba8be72af8 100755
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1290,7 +1290,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *reg
1290 writel(intr0, mmio + INT0); 1290 writel(intr0, mmio + INT0);
1291 1291
1292 /* Check if Receive Interrupt has occurred. */ 1292 /* Check if Receive Interrupt has occurred. */
1293#if CONFIG_AMD8111E_NAPI 1293#ifdef CONFIG_AMD8111E_NAPI
1294 if(intr0 & RINT0){ 1294 if(intr0 & RINT0){
1295 if(netif_rx_schedule_prep(dev)){ 1295 if(netif_rx_schedule_prep(dev)){
1296 /* Disable receive interupts */ 1296 /* Disable receive interupts */
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index b96d6fb1929e..b780307093eb 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -417,6 +417,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
417 struct net_local *lp = netdev_priv(dev); 417 struct net_local *lp = netdev_priv(dev);
418 static unsigned version_printed; 418 static unsigned version_printed;
419 int i; 419 int i;
420 int tmp;
420 unsigned rev_type = 0; 421 unsigned rev_type = 0;
421 int eeprom_buff[CHKSUM_LEN]; 422 int eeprom_buff[CHKSUM_LEN];
422 int retval; 423 int retval;
@@ -492,14 +493,17 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
492 goto out2; 493 goto out2;
493 } 494 }
494 } 495 }
495printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT)); 496 printk(KERN_DEBUG "PP_addr at %x: 0x%x\n",
497 ioaddr + ADD_PORT, inw(ioaddr + ADD_PORT));
496 498
497 ioaddr &= ~3; 499 ioaddr &= ~3;
498 outw(PP_ChipID, ioaddr + ADD_PORT); 500 outw(PP_ChipID, ioaddr + ADD_PORT);
499 501
500 if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) { 502 tmp = inw(ioaddr + DATA_PORT);
501 printk(KERN_ERR "%s: incorrect signature 0x%x\n", 503 if (tmp != CHIP_EISA_ID_SIG) {
502 dev->name, inw(ioaddr + DATA_PORT)); 504 printk(KERN_DEBUG "%s: incorrect signature at %x: 0x%x!="
505 CHIP_EISA_ID_SIG_STR "\n",
506 dev->name, ioaddr + DATA_PORT, tmp);
503 retval = -ENODEV; 507 retval = -ENODEV;
504 goto out2; 508 goto out2;
505 } 509 }
@@ -1450,6 +1454,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1450 /* Write the contents of the packet */ 1454 /* Write the contents of the packet */
1451 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1455 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1452 spin_unlock_irq(&lp->lock); 1456 spin_unlock_irq(&lp->lock);
1457 lp->stats.tx_bytes += skb->len;
1453 dev->trans_start = jiffies; 1458 dev->trans_start = jiffies;
1454 dev_kfree_skb (skb); 1459 dev_kfree_skb (skb);
1455 1460
diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h
index bd3ad8e6cce9..decea264f121 100644
--- a/drivers/net/cs89x0.h
+++ b/drivers/net/cs89x0.h
@@ -93,6 +93,7 @@
93#endif 93#endif
94 94
95#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */ 95#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */
96#define CHIP_EISA_ID_SIG_STR "0x630E"
96 97
97#ifdef IBMEIPKT 98#ifdef IBMEIPKT
98#define EISA_ID_SIG 0x4D24 /* IBM */ 99#define EISA_ID_SIG 0x4D24 /* IBM */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cb7f051a60ad..5e5d2c3c7ce4 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -162,7 +162,6 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
163static void e1000_restore_vlan(struct e1000_adapter *adapter); 163static void e1000_restore_vlan(struct e1000_adapter *adapter);
164 164
165static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
166static int e1000_suspend(struct pci_dev *pdev, uint32_t state); 165static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168static int e1000_resume(struct pci_dev *pdev); 167static int e1000_resume(struct pci_dev *pdev);
@@ -173,12 +172,6 @@ static int e1000_resume(struct pci_dev *pdev);
173static void e1000_netpoll (struct net_device *netdev); 172static void e1000_netpoll (struct net_device *netdev);
174#endif 173#endif
175 174
176struct notifier_block e1000_notifier_reboot = {
177 .notifier_call = e1000_notify_reboot,
178 .next = NULL,
179 .priority = 0
180};
181
182/* Exported from other modules */ 175/* Exported from other modules */
183 176
184extern void e1000_check_options(struct e1000_adapter *adapter); 177extern void e1000_check_options(struct e1000_adapter *adapter);
@@ -221,9 +214,7 @@ e1000_init_module(void)
221 printk(KERN_INFO "%s\n", e1000_copyright); 214 printk(KERN_INFO "%s\n", e1000_copyright);
222 215
223 ret = pci_module_init(&e1000_driver); 216 ret = pci_module_init(&e1000_driver);
224 if(ret >= 0) { 217
225 register_reboot_notifier(&e1000_notifier_reboot);
226 }
227 return ret; 218 return ret;
228} 219}
229 220
@@ -239,7 +230,6 @@ module_init(e1000_init_module);
239static void __exit 230static void __exit
240e1000_exit_module(void) 231e1000_exit_module(void)
241{ 232{
242 unregister_reboot_notifier(&e1000_notifier_reboot);
243 pci_unregister_driver(&e1000_driver); 233 pci_unregister_driver(&e1000_driver);
244} 234}
245 235
@@ -3652,23 +3642,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
3652} 3642}
3653 3643
3654static int 3644static int
3655e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
3656{
3657 struct pci_dev *pdev = NULL;
3658
3659 switch(event) {
3660 case SYS_DOWN:
3661 case SYS_HALT:
3662 case SYS_POWER_OFF:
3663 while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
3664 if(pci_dev_driver(pdev) == &e1000_driver)
3665 e1000_suspend(pdev, 3);
3666 }
3667 }
3668 return NOTIFY_DONE;
3669}
3670
3671static int
3672e1000_suspend(struct pci_dev *pdev, uint32_t state) 3645e1000_suspend(struct pci_dev *pdev, uint32_t state)
3673{ 3646{
3674 struct net_device *netdev = pci_get_drvdata(pdev); 3647 struct net_device *netdev = pci_get_drvdata(pdev);
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index 7cdebe1a0b61..0cd54306e636 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -17,7 +17,7 @@ config MKISS
17 17
18config 6PACK 18config 6PACK
19 tristate "Serial port 6PACK driver" 19 tristate "Serial port 6PACK driver"
20 depends on AX25 && BROKEN_ON_SMP 20 depends on AX25
21 ---help--- 21 ---help---
22 6pack is a transmission protocol for the data exchange between your 22 6pack is a transmission protocol for the data exchange between your
23 PC and your TNC (the Terminal Node Controller acts as a kind of 23 PC and your TNC (the Terminal Node Controller acts as a kind of
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 6c57096aa2e1..d209a1556b2e 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -129,9 +129,9 @@ bad_clone_list[] __initdata = {
129#define NESM_START_PG 0x40 /* First page of TX buffer */ 129#define NESM_START_PG 0x40 /* First page of TX buffer */
130#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ 130#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */
131 131
132#ifdef CONFIG_PLAT_MAPPI 132#if defined(CONFIG_PLAT_MAPPI)
133# define DCR_VAL 0x4b 133# define DCR_VAL 0x4b
134#elif CONFIG_PLAT_OAKS32R 134#elif defined(CONFIG_PLAT_OAKS32R)
135# define DCR_VAL 0x48 135# define DCR_VAL 0x48
136#else 136#else
137# define DCR_VAL 0x49 137# define DCR_VAL 0x49
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index dbb941004ae9..980d7e5d66cb 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -1671,7 +1671,7 @@ static void set_multicast_list(struct net_device *dev)
1671 1671
1672static struct pcmcia_device_id nmclan_ids[] = { 1672static struct pcmcia_device_id nmclan_ids[] = {
1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), 1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941),
1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet", 0x0ebf1d60, 0x00b2e941), 1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),
1675 PCMCIA_DEVICE_NULL, 1675 PCMCIA_DEVICE_NULL,
1676}; 1676};
1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); 1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index e1664aef3dfd..9f22d138e3ad 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1639,7 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), 1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab),
1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), 1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101),
1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), 1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab),
1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
@@ -1683,7 +1683,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), 1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11),
1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), 1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff),
1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), 1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68),
1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM", 0xbb7fbdd7, 0x5ba10d49),
1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), 1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997),
1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), 1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8),
1689 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), 1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96),
@@ -1719,6 +1718,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1719 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), 1718 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e),
1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), 1719 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), 1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660+", 0x1a424a1c, 0x50dcd0ec),
1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), 1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9),
1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), 1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84),
1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), 1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9),
@@ -1737,6 +1737,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), 1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947),
1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), 1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941),
1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), 1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6),
1740 PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494),
1740 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), 1741 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b),
1741 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), 1742 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0),
1742 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), 1743 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956),
@@ -1753,7 +1754,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1753 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), 1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d),
1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), 1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389),
1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), 1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9),
1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline ", 0x0733cc81, 0x5e07cfa0), 1757 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a),
1757 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), 1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737),
1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), 1759 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922),
1759 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), 1760 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0),
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 0d8bb4cccbb7..d652e1eddb45 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -2332,8 +2332,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), 2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), 2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020),
2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), 2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023),
2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), 2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb),
@@ -2343,8 +2343,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), 2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9),
2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), 2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953),
2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), 2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),
2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314),
2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a),
2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), 2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc),
2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), 2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9),
2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), 2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d),
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 9f33bad174e9..ce143f08638a 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1985,7 +1985,7 @@ static struct pcmcia_device_id xirc2ps_ids[] = {
1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), 1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a),
1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), 1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2),
1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), 1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37),
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 21537ee3a6a7..1bd22cd40c75 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -160,7 +160,7 @@ static struct net_device_stats *plip_get_stats(struct net_device *dev);
160static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 160static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
161static int plip_preempt(void *handle); 161static int plip_preempt(void *handle);
162static void plip_wakeup(void *handle); 162static void plip_wakeup(void *handle);
163 163
164enum plip_connection_state { 164enum plip_connection_state {
165 PLIP_CN_NONE=0, 165 PLIP_CN_NONE=0,
166 PLIP_CN_RECEIVE, 166 PLIP_CN_RECEIVE,
@@ -231,8 +231,8 @@ struct net_local {
231 atomic_t kill_timer; 231 atomic_t kill_timer;
232 struct semaphore killed_timer_sem; 232 struct semaphore killed_timer_sem;
233}; 233};
234 234
235inline static void enable_parport_interrupts (struct net_device *dev) 235static inline void enable_parport_interrupts (struct net_device *dev)
236{ 236{
237 if (dev->irq != -1) 237 if (dev->irq != -1)
238 { 238 {
@@ -242,7 +242,7 @@ inline static void enable_parport_interrupts (struct net_device *dev)
242 } 242 }
243} 243}
244 244
245inline static void disable_parport_interrupts (struct net_device *dev) 245static inline void disable_parport_interrupts (struct net_device *dev)
246{ 246{
247 if (dev->irq != -1) 247 if (dev->irq != -1)
248 { 248 {
@@ -252,7 +252,7 @@ inline static void disable_parport_interrupts (struct net_device *dev)
252 } 252 }
253} 253}
254 254
255inline static void write_data (struct net_device *dev, unsigned char data) 255static inline void write_data (struct net_device *dev, unsigned char data)
256{ 256{
257 struct parport *port = 257 struct parport *port =
258 ((struct net_local *)dev->priv)->pardev->port; 258 ((struct net_local *)dev->priv)->pardev->port;
@@ -260,14 +260,14 @@ inline static void write_data (struct net_device *dev, unsigned char data)
260 port->ops->write_data (port, data); 260 port->ops->write_data (port, data);
261} 261}
262 262
263inline static unsigned char read_status (struct net_device *dev) 263static inline unsigned char read_status (struct net_device *dev)
264{ 264{
265 struct parport *port = 265 struct parport *port =
266 ((struct net_local *)dev->priv)->pardev->port; 266 ((struct net_local *)dev->priv)->pardev->port;
267 267
268 return port->ops->read_status (port); 268 return port->ops->read_status (port);
269} 269}
270 270
271/* Entry point of PLIP driver. 271/* Entry point of PLIP driver.
272 Probe the hardware, and register/initialize the driver. 272 Probe the hardware, and register/initialize the driver.
273 273
@@ -316,7 +316,7 @@ plip_init_netdev(struct net_device *dev)
316 316
317 spin_lock_init(&nl->lock); 317 spin_lock_init(&nl->lock);
318} 318}
319 319
320/* Bottom half handler for the delayed request. 320/* Bottom half handler for the delayed request.
321 This routine is kicked by do_timer(). 321 This routine is kicked by do_timer().
322 Request `plip_bh' to be invoked. */ 322 Request `plip_bh' to be invoked. */
@@ -471,7 +471,7 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
471 471
472 return TIMEOUT; 472 return TIMEOUT;
473} 473}
474 474
475static int 475static int
476plip_none(struct net_device *dev, struct net_local *nl, 476plip_none(struct net_device *dev, struct net_local *nl,
477 struct plip_local *snd, struct plip_local *rcv) 477 struct plip_local *snd, struct plip_local *rcv)
@@ -481,7 +481,7 @@ plip_none(struct net_device *dev, struct net_local *nl,
481 481
482/* PLIP_RECEIVE --- receive a byte(two nibbles) 482/* PLIP_RECEIVE --- receive a byte(two nibbles)
483 Returns OK on success, TIMEOUT on timeout */ 483 Returns OK on success, TIMEOUT on timeout */
484inline static int 484static inline int
485plip_receive(unsigned short nibble_timeout, struct net_device *dev, 485plip_receive(unsigned short nibble_timeout, struct net_device *dev,
486 enum plip_nibble_state *ns_p, unsigned char *data_p) 486 enum plip_nibble_state *ns_p, unsigned char *data_p)
487{ 487{
@@ -582,7 +582,6 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)
582 return htons(ETH_P_802_2); 582 return htons(ETH_P_802_2);
583} 583}
584 584
585
586/* PLIP_RECEIVE_PACKET --- receive a packet */ 585/* PLIP_RECEIVE_PACKET --- receive a packet */
587static int 586static int
588plip_receive_packet(struct net_device *dev, struct net_local *nl, 587plip_receive_packet(struct net_device *dev, struct net_local *nl,
@@ -702,7 +701,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
702 701
703/* PLIP_SEND --- send a byte (two nibbles) 702/* PLIP_SEND --- send a byte (two nibbles)
704 Returns OK on success, TIMEOUT when timeout */ 703 Returns OK on success, TIMEOUT when timeout */
705inline static int 704static inline int
706plip_send(unsigned short nibble_timeout, struct net_device *dev, 705plip_send(unsigned short nibble_timeout, struct net_device *dev,
707 enum plip_nibble_state *ns_p, unsigned char data) 706 enum plip_nibble_state *ns_p, unsigned char data)
708{ 707{
@@ -902,7 +901,7 @@ plip_error(struct net_device *dev, struct net_local *nl,
902 901
903 return OK; 902 return OK;
904} 903}
905 904
906/* Handle the parallel port interrupts. */ 905/* Handle the parallel port interrupts. */
907static void 906static void
908plip_interrupt(int irq, void *dev_id, struct pt_regs * regs) 907plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -957,7 +956,7 @@ plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
957 956
958 spin_unlock_irq(&nl->lock); 957 spin_unlock_irq(&nl->lock);
959} 958}
960 959
961static int 960static int
962plip_tx_packet(struct sk_buff *skb, struct net_device *dev) 961plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
963{ 962{
@@ -1238,7 +1237,7 @@ plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1238 } 1237 }
1239 return 0; 1238 return 0;
1240} 1239}
1241 1240
1242static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 }; 1241static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 };
1243static int timid; 1242static int timid;
1244 1243
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 82570ec44d8e..6ee4771addf1 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5133,6 +5133,84 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
5133 kfree(pAC); 5133 kfree(pAC);
5134} 5134}
5135 5135
5136#ifdef CONFIG_PM
5137static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
5138{
5139 struct net_device *dev = pci_get_drvdata(pdev);
5140 DEV_NET *pNet = netdev_priv(dev);
5141 SK_AC *pAC = pNet->pAC;
5142 struct net_device *otherdev = pAC->dev[1];
5143
5144 if (netif_running(dev)) {
5145 netif_carrier_off(dev);
5146 DoPrintInterfaceChange = SK_FALSE;
5147 SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */
5148 netif_device_detach(dev);
5149 }
5150 if (otherdev != dev) {
5151 if (netif_running(otherdev)) {
5152 netif_carrier_off(otherdev);
5153 DoPrintInterfaceChange = SK_FALSE;
5154 SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */
5155 netif_device_detach(otherdev);
5156 }
5157 }
5158
5159 pci_save_state(pdev);
5160 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
5161 if (pAC->AllocFlag & SK_ALLOC_IRQ) {
5162 free_irq(dev->irq, dev);
5163 }
5164 pci_disable_device(pdev);
5165 pci_set_power_state(pdev, pci_choose_state(pdev, state));
5166
5167 return 0;
5168}
5169
5170static int skge_resume(struct pci_dev *pdev)
5171{
5172 struct net_device *dev = pci_get_drvdata(pdev);
5173 DEV_NET *pNet = netdev_priv(dev);
5174 SK_AC *pAC = pNet->pAC;
5175 struct net_device *otherdev = pAC->dev[1];
5176 int ret;
5177
5178 pci_set_power_state(pdev, PCI_D0);
5179 pci_restore_state(pdev);
5180 pci_enable_device(pdev);
5181 pci_set_master(pdev);
5182 if (pAC->GIni.GIMacsFound == 2)
5183 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
5184 else
5185 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev);
5186 if (ret) {
5187 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5188 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
5189 dev->irq = 0;
5190 pci_disable_device(pdev);
5191 return -EBUSY;
5192 }
5193
5194 netif_device_attach(dev);
5195 if (netif_running(dev)) {
5196 DoPrintInterfaceChange = SK_FALSE;
5197 SkDrvInitAdapter(pAC, 0); /* first device */
5198 }
5199 if (otherdev != dev) {
5200 netif_device_attach(otherdev);
5201 if (netif_running(otherdev)) {
5202 DoPrintInterfaceChange = SK_FALSE;
5203 SkDrvInitAdapter(pAC, 1); /* second device */
5204 }
5205 }
5206
5207 return 0;
5208}
5209#else
5210#define skge_suspend NULL
5211#define skge_resume NULL
5212#endif
5213
5136static struct pci_device_id skge_pci_tbl[] = { 5214static struct pci_device_id skge_pci_tbl[] = {
5137 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5215 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5138 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5216 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -5158,6 +5236,8 @@ static struct pci_driver skge_driver = {
5158 .id_table = skge_pci_tbl, 5236 .id_table = skge_pci_tbl,
5159 .probe = skge_probe_one, 5237 .probe = skge_probe_one,
5160 .remove = __devexit_p(skge_remove_one), 5238 .remove = __devexit_p(skge_remove_one),
5239 .suspend = skge_suspend,
5240 .resume = skge_resume,
5161}; 5241};
5162 5242
5163static int __init skge_init(void) 5243static int __init skge_init(void)
diff --git a/drivers/net/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c
index df4483429a77..6cb49dd02251 100644
--- a/drivers/net/sk98lin/skgeinit.c
+++ b/drivers/net/sk98lin/skgeinit.c
@@ -2016,7 +2016,7 @@ SK_IOC IoC) /* IO context */
2016 * we set the PHY to coma mode and switch to D3 power state. 2016 * we set the PHY to coma mode and switch to D3 power state.
2017 */ 2017 */
2018 if (pAC->GIni.GIYukonLite && 2018 if (pAC->GIni.GIYukonLite &&
2019 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2019 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2020 2020
2021 /* for all ports switch PHY to coma mode */ 2021 /* for all ports switch PHY to coma mode */
2022 for (i = 0; i < pAC->GIni.GIMacsFound; i++) { 2022 for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index 94a09deecb32..42d2d963150a 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -1065,7 +1065,7 @@ int Port) /* Port Index (MAC_1 + n) */
1065 1065
1066 /* WA code for COMA mode */ 1066 /* WA code for COMA mode */
1067 if (pAC->GIni.GIYukonLite && 1067 if (pAC->GIni.GIYukonLite &&
1068 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 1068 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
1069 1069
1070 SK_IN32(IoC, B2_GP_IO, &DWord); 1070 SK_IN32(IoC, B2_GP_IO, &DWord);
1071 1071
@@ -1110,7 +1110,7 @@ int Port) /* Port Index (MAC_1 + n) */
1110 1110
1111 /* WA code for COMA mode */ 1111 /* WA code for COMA mode */
1112 if (pAC->GIni.GIYukonLite && 1112 if (pAC->GIni.GIYukonLite &&
1113 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 1113 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
1114 1114
1115 SK_IN32(IoC, B2_GP_IO, &DWord); 1115 SK_IN32(IoC, B2_GP_IO, &DWord);
1116 1116
@@ -2126,7 +2126,7 @@ SK_U8 Mode) /* low power mode */
2126 int Ret = 0; 2126 int Ret = 0;
2127 2127
2128 if (pAC->GIni.GIYukonLite && 2128 if (pAC->GIni.GIYukonLite &&
2129 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2129 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2130 2130
2131 /* save current power mode */ 2131 /* save current power mode */
2132 LastMode = pAC->GIni.GP[Port].PPhyPowerState; 2132 LastMode = pAC->GIni.GP[Port].PPhyPowerState;
@@ -2253,7 +2253,7 @@ int Port) /* Port Index (e.g. MAC_1) */
2253 int Ret = 0; 2253 int Ret = 0;
2254 2254
2255 if (pAC->GIni.GIYukonLite && 2255 if (pAC->GIni.GIYukonLite &&
2256 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2256 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2257 2257
2258 /* save current power mode */ 2258 /* save current power mode */
2259 LastMode = pAC->GIni.GP[Port].PPhyPowerState; 2259 LastMode = pAC->GIni.GP[Port].PPhyPowerState;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 5cacc7ad9e79..f15739481d62 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -42,7 +42,7 @@
42#include "skge.h" 42#include "skge.h"
43 43
44#define DRV_NAME "skge" 44#define DRV_NAME "skge"
45#define DRV_VERSION "0.7" 45#define DRV_VERSION "0.8"
46#define PFX DRV_NAME " " 46#define PFX DRV_NAME " "
47 47
48#define DEFAULT_TX_RING_SIZE 128 48#define DEFAULT_TX_RING_SIZE 128
@@ -55,7 +55,7 @@
55#define ETH_JUMBO_MTU 9000 55#define ETH_JUMBO_MTU 9000
56#define TX_WATCHDOG (5 * HZ) 56#define TX_WATCHDOG (5 * HZ)
57#define NAPI_WEIGHT 64 57#define NAPI_WEIGHT 64
58#define BLINK_HZ (HZ/4) 58#define BLINK_MS 250
59 59
60MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); 60MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
61MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 61MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>");
@@ -75,7 +75,6 @@ static const struct pci_device_id skge_id_table[] = {
75 { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) }, 75 { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) },
76 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, 76 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) },
77 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, 77 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) },
78 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
79 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, 78 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), },
80 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, 79 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) },
81 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ 80 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */
@@ -249,7 +248,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
249 } else { 248 } else {
250 u32 setting; 249 u32 setting;
251 250
252 switch(ecmd->speed) { 251 switch (ecmd->speed) {
253 case SPEED_1000: 252 case SPEED_1000:
254 if (ecmd->duplex == DUPLEX_FULL) 253 if (ecmd->duplex == DUPLEX_FULL)
255 setting = SUPPORTED_1000baseT_Full; 254 setting = SUPPORTED_1000baseT_Full;
@@ -620,84 +619,98 @@ static int skge_set_coalesce(struct net_device *dev,
620 return 0; 619 return 0;
621} 620}
622 621
623static void skge_led_on(struct skge_hw *hw, int port) 622enum led_mode { LED_MODE_OFF, LED_MODE_ON, LED_MODE_TST };
623static void skge_led(struct skge_port *skge, enum led_mode mode)
624{ 624{
625 struct skge_hw *hw = skge->hw;
626 int port = skge->port;
627
628 spin_lock_bh(&hw->phy_lock);
625 if (hw->chip_id == CHIP_ID_GENESIS) { 629 if (hw->chip_id == CHIP_ID_GENESIS) {
626 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); 630 switch (mode) {
627 skge_write8(hw, B0_LED, LED_STAT_ON); 631 case LED_MODE_OFF:
632 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF);
633 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
634 skge_write32(hw, SK_REG(port, RX_LED_VAL), 0);
635 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF);
636 break;
628 637
629 skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON); 638 case LED_MODE_ON:
630 skge_write32(hw, SK_REG(port, RX_LED_VAL), 100); 639 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON);
631 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); 640 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON);
632 641
633 /* For Broadcom Phy only */ 642 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
634 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON); 643 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START);
635 } else {
636 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
637 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
638 PHY_M_LED_MO_DUP(MO_LED_ON) |
639 PHY_M_LED_MO_10(MO_LED_ON) |
640 PHY_M_LED_MO_100(MO_LED_ON) |
641 PHY_M_LED_MO_1000(MO_LED_ON) |
642 PHY_M_LED_MO_RX(MO_LED_ON));
643 }
644}
645 644
646static void skge_led_off(struct skge_hw *hw, int port) 645 break;
647{
648 if (hw->chip_id == CHIP_ID_GENESIS) {
649 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
650 skge_write8(hw, B0_LED, LED_STAT_OFF);
651 646
652 skge_write32(hw, SK_REG(port, RX_LED_VAL), 0); 647 case LED_MODE_TST:
653 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF); 648 skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON);
649 skge_write32(hw, SK_REG(port, RX_LED_VAL), 100);
650 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
654 651
655 /* Broadcom only */ 652 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON);
656 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF); 653 break;
654 }
657 } else { 655 } else {
658 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); 656 switch (mode) {
659 gm_phy_write(hw, port, PHY_MARV_LED_OVER, 657 case LED_MODE_OFF:
660 PHY_M_LED_MO_DUP(MO_LED_OFF) | 658 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
661 PHY_M_LED_MO_10(MO_LED_OFF) | 659 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
662 PHY_M_LED_MO_100(MO_LED_OFF) | 660 PHY_M_LED_MO_DUP(MO_LED_OFF) |
663 PHY_M_LED_MO_1000(MO_LED_OFF) | 661 PHY_M_LED_MO_10(MO_LED_OFF) |
664 PHY_M_LED_MO_RX(MO_LED_OFF)); 662 PHY_M_LED_MO_100(MO_LED_OFF) |
663 PHY_M_LED_MO_1000(MO_LED_OFF) |
664 PHY_M_LED_MO_RX(MO_LED_OFF));
665 break;
666 case LED_MODE_ON:
667 gm_phy_write(hw, port, PHY_MARV_LED_CTRL,
668 PHY_M_LED_PULS_DUR(PULS_170MS) |
669 PHY_M_LED_BLINK_RT(BLINK_84MS) |
670 PHY_M_LEDC_TX_CTRL |
671 PHY_M_LEDC_DP_CTRL);
672
673 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
674 PHY_M_LED_MO_RX(MO_LED_OFF) |
675 (skge->speed == SPEED_100 ?
676 PHY_M_LED_MO_100(MO_LED_ON) : 0));
677 break;
678 case LED_MODE_TST:
679 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
680 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
681 PHY_M_LED_MO_DUP(MO_LED_ON) |
682 PHY_M_LED_MO_10(MO_LED_ON) |
683 PHY_M_LED_MO_100(MO_LED_ON) |
684 PHY_M_LED_MO_1000(MO_LED_ON) |
685 PHY_M_LED_MO_RX(MO_LED_ON));
686 }
665 } 687 }
666} 688 spin_unlock_bh(&hw->phy_lock);
667
668static void skge_blink_timer(unsigned long data)
669{
670 struct skge_port *skge = (struct skge_port *) data;
671 struct skge_hw *hw = skge->hw;
672 unsigned long flags;
673
674 spin_lock_irqsave(&hw->phy_lock, flags);
675 if (skge->blink_on)
676 skge_led_on(hw, skge->port);
677 else
678 skge_led_off(hw, skge->port);
679 spin_unlock_irqrestore(&hw->phy_lock, flags);
680
681 skge->blink_on = !skge->blink_on;
682 mod_timer(&skge->led_blink, jiffies + BLINK_HZ);
683} 689}
684 690
685/* blink LED's for finding board */ 691/* blink LED's for finding board */
686static int skge_phys_id(struct net_device *dev, u32 data) 692static int skge_phys_id(struct net_device *dev, u32 data)
687{ 693{
688 struct skge_port *skge = netdev_priv(dev); 694 struct skge_port *skge = netdev_priv(dev);
695 unsigned long ms;
696 enum led_mode mode = LED_MODE_TST;
689 697
690 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) 698 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
691 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 699 ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000;
700 else
701 ms = data * 1000;
692 702
693 /* start blinking */ 703 while (ms > 0) {
694 skge->blink_on = 1; 704 skge_led(skge, mode);
695 mod_timer(&skge->led_blink, jiffies+1); 705 mode ^= LED_MODE_TST;
696 706
697 msleep_interruptible(data * 1000); 707 if (msleep_interruptible(BLINK_MS))
698 del_timer_sync(&skge->led_blink); 708 break;
709 ms -= BLINK_MS;
710 }
699 711
700 skge_led_off(skge->hw, skge->port); 712 /* back to regular LED state */
713 skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF);
701 714
702 return 0; 715 return 0;
703} 716}
@@ -1028,7 +1041,7 @@ static void bcom_check_link(struct skge_hw *hw, int port)
1028 } 1041 }
1029 1042
1030 /* Check Duplex mismatch */ 1043 /* Check Duplex mismatch */
1031 switch(aux & PHY_B_AS_AN_RES_MSK) { 1044 switch (aux & PHY_B_AS_AN_RES_MSK) {
1032 case PHY_B_RES_1000FD: 1045 case PHY_B_RES_1000FD:
1033 skge->duplex = DUPLEX_FULL; 1046 skge->duplex = DUPLEX_FULL;
1034 break; 1047 break;
@@ -1099,7 +1112,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo)
1099 r |= XM_MMU_NO_PRE; 1112 r |= XM_MMU_NO_PRE;
1100 xm_write16(hw, port, XM_MMU_CMD,r); 1113 xm_write16(hw, port, XM_MMU_CMD,r);
1101 1114
1102 switch(id1) { 1115 switch (id1) {
1103 case PHY_BCOM_ID1_C0: 1116 case PHY_BCOM_ID1_C0:
1104 /* 1117 /*
1105 * Workaround BCOM Errata for the C0 type. 1118 * Workaround BCOM Errata for the C0 type.
@@ -1194,13 +1207,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1194 xm_write16(hw, port, XM_STAT_CMD, 1207 xm_write16(hw, port, XM_STAT_CMD,
1195 XM_SC_CLR_RXC | XM_SC_CLR_TXC); 1208 XM_SC_CLR_RXC | XM_SC_CLR_TXC);
1196 1209
1197 /* initialize Rx, Tx and Link LED */
1198 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON);
1199 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON);
1200
1201 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
1202 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START);
1203
1204 /* Unreset the XMAC. */ 1210 /* Unreset the XMAC. */
1205 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); 1211 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
1206 1212
@@ -1209,7 +1215,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1209 * namely for the 1000baseTX cards that use the XMAC's 1215 * namely for the 1000baseTX cards that use the XMAC's
1210 * GMII mode. 1216 * GMII mode.
1211 */ 1217 */
1212 spin_lock_bh(&hw->phy_lock);
1213 /* Take external Phy out of reset */ 1218 /* Take external Phy out of reset */
1214 r = skge_read32(hw, B2_GP_IO); 1219 r = skge_read32(hw, B2_GP_IO);
1215 if (port == 0) 1220 if (port == 0)
@@ -1219,7 +1224,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1219 1224
1220 skge_write32(hw, B2_GP_IO, r); 1225 skge_write32(hw, B2_GP_IO, r);
1221 skge_read32(hw, B2_GP_IO); 1226 skge_read32(hw, B2_GP_IO);
1222 spin_unlock_bh(&hw->phy_lock);
1223 1227
1224 /* Enable GMII interfac */ 1228 /* Enable GMII interfac */
1225 xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); 1229 xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD);
@@ -1569,7 +1573,6 @@ static void yukon_init(struct skge_hw *hw, int port)
1569{ 1573{
1570 struct skge_port *skge = netdev_priv(hw->dev[port]); 1574 struct skge_port *skge = netdev_priv(hw->dev[port]);
1571 u16 ctrl, ct1000, adv; 1575 u16 ctrl, ct1000, adv;
1572 u16 ledctrl, ledover;
1573 1576
1574 pr_debug("yukon_init\n"); 1577 pr_debug("yukon_init\n");
1575 if (skge->autoneg == AUTONEG_ENABLE) { 1578 if (skge->autoneg == AUTONEG_ENABLE) {
@@ -1641,32 +1644,11 @@ static void yukon_init(struct skge_hw *hw, int port)
1641 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); 1644 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
1642 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); 1645 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
1643 1646
1644 /* Setup Phy LED's */
1645 ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS);
1646 ledover = 0;
1647
1648 ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL;
1649
1650 /* turn off the Rx LED (LED_RX) */
1651 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);
1652
1653 /* disable blink mode (LED_DUPLEX) on collisions */
1654 ctrl |= PHY_M_LEDC_DP_CTRL;
1655 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
1656
1657 if (skge->autoneg == AUTONEG_DISABLE || skge->speed == SPEED_100) {
1658 /* turn on 100 Mbps LED (LED_LINK100) */
1659 ledover |= PHY_M_LED_MO_100(MO_LED_ON);
1660 }
1661
1662 if (ledover)
1663 gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover);
1664
1665 /* Enable phy interrupt on autonegotiation complete (or link up) */ 1647 /* Enable phy interrupt on autonegotiation complete (or link up) */
1666 if (skge->autoneg == AUTONEG_ENABLE) 1648 if (skge->autoneg == AUTONEG_ENABLE)
1667 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); 1649 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_MSK);
1668 else 1650 else
1669 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 1651 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK);
1670} 1652}
1671 1653
1672static void yukon_reset(struct skge_hw *hw, int port) 1654static void yukon_reset(struct skge_hw *hw, int port)
@@ -1691,7 +1673,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1691 1673
1692 /* WA code for COMA mode -- set PHY reset */ 1674 /* WA code for COMA mode -- set PHY reset */
1693 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1675 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1694 hw->chip_rev == CHIP_REV_YU_LITE_A3) 1676 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1695 skge_write32(hw, B2_GP_IO, 1677 skge_write32(hw, B2_GP_IO,
1696 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); 1678 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9));
1697 1679
@@ -1701,7 +1683,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1701 1683
1702 /* WA code for COMA mode -- clear PHY reset */ 1684 /* WA code for COMA mode -- clear PHY reset */
1703 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1685 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1704 hw->chip_rev == CHIP_REV_YU_LITE_A3) 1686 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1705 skge_write32(hw, B2_GP_IO, 1687 skge_write32(hw, B2_GP_IO,
1706 (skge_read32(hw, B2_GP_IO) | GP_DIR_9) 1688 (skge_read32(hw, B2_GP_IO) | GP_DIR_9)
1707 & ~GP_IO_9); 1689 & ~GP_IO_9);
@@ -1745,9 +1727,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1745 gma_write16(hw, port, GM_GP_CTRL, reg); 1727 gma_write16(hw, port, GM_GP_CTRL, reg);
1746 skge_read16(hw, GMAC_IRQ_SRC); 1728 skge_read16(hw, GMAC_IRQ_SRC);
1747 1729
1748 spin_lock_bh(&hw->phy_lock);
1749 yukon_init(hw, port); 1730 yukon_init(hw, port);
1750 spin_unlock_bh(&hw->phy_lock);
1751 1731
1752 /* MIB clear */ 1732 /* MIB clear */
1753 reg = gma_read16(hw, port, GM_PHY_ADDR); 1733 reg = gma_read16(hw, port, GM_PHY_ADDR);
@@ -1796,7 +1776,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1796 skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); 1776 skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK);
1797 reg = GMF_OPER_ON | GMF_RX_F_FL_ON; 1777 reg = GMF_OPER_ON | GMF_RX_F_FL_ON;
1798 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1778 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1799 hw->chip_rev == CHIP_REV_YU_LITE_A3) 1779 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1800 reg &= ~GMF_RX_F_FL_ON; 1780 reg &= ~GMF_RX_F_FL_ON;
1801 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); 1781 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
1802 skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); 1782 skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg);
@@ -1813,19 +1793,19 @@ static void yukon_stop(struct skge_port *skge)
1813 int port = skge->port; 1793 int port = skge->port;
1814 1794
1815 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1795 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1816 hw->chip_rev == CHIP_REV_YU_LITE_A3) { 1796 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1817 skge_write32(hw, B2_GP_IO, 1797 skge_write32(hw, B2_GP_IO,
1818 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); 1798 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9);
1819 } 1799 }
1820 1800
1821 gma_write16(hw, port, GM_GP_CTRL, 1801 gma_write16(hw, port, GM_GP_CTRL,
1822 gma_read16(hw, port, GM_GP_CTRL) 1802 gma_read16(hw, port, GM_GP_CTRL)
1823 & ~(GM_GPCR_RX_ENA|GM_GPCR_RX_ENA)); 1803 & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA));
1824 gma_read16(hw, port, GM_GP_CTRL); 1804 gma_read16(hw, port, GM_GP_CTRL);
1825 1805
1826 /* set GPHY Control reset */ 1806 /* set GPHY Control reset */
1827 gma_write32(hw, port, GPHY_CTRL, GPC_RST_SET); 1807 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1828 gma_write32(hw, port, GMAC_CTRL, GMC_RST_SET); 1808 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET);
1829} 1809}
1830 1810
1831static void yukon_get_stats(struct skge_port *skge, u64 *data) 1811static void yukon_get_stats(struct skge_port *skge, u64 *data)
@@ -1856,11 +1836,12 @@ static void yukon_mac_intr(struct skge_hw *hw, int port)
1856 1836
1857 if (status & GM_IS_RX_FF_OR) { 1837 if (status & GM_IS_RX_FF_OR) {
1858 ++skge->net_stats.rx_fifo_errors; 1838 ++skge->net_stats.rx_fifo_errors;
1859 gma_write8(hw, port, RX_GMF_CTRL_T, GMF_CLI_RX_FO); 1839 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO);
1860 } 1840 }
1841
1861 if (status & GM_IS_TX_FF_UR) { 1842 if (status & GM_IS_TX_FF_UR) {
1862 ++skge->net_stats.tx_fifo_errors; 1843 ++skge->net_stats.tx_fifo_errors;
1863 gma_write8(hw, port, TX_GMF_CTRL_T, GMF_CLI_TX_FU); 1844 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU);
1864 } 1845 }
1865 1846
1866} 1847}
@@ -1896,7 +1877,7 @@ static void yukon_link_up(struct skge_port *skge)
1896 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; 1877 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
1897 gma_write16(hw, port, GM_GP_CTRL, reg); 1878 gma_write16(hw, port, GM_GP_CTRL, reg);
1898 1879
1899 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 1880 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK);
1900 skge_link_up(skge); 1881 skge_link_up(skge);
1901} 1882}
1902 1883
@@ -1904,12 +1885,14 @@ static void yukon_link_down(struct skge_port *skge)
1904{ 1885{
1905 struct skge_hw *hw = skge->hw; 1886 struct skge_hw *hw = skge->hw;
1906 int port = skge->port; 1887 int port = skge->port;
1888 u16 ctrl;
1907 1889
1908 pr_debug("yukon_link_down\n"); 1890 pr_debug("yukon_link_down\n");
1909 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); 1891 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);
1910 gm_phy_write(hw, port, GM_GP_CTRL, 1892
1911 gm_phy_read(hw, port, GM_GP_CTRL) 1893 ctrl = gma_read16(hw, port, GM_GP_CTRL);
1912 & ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)); 1894 ctrl &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
1895 gma_write16(hw, port, GM_GP_CTRL, ctrl);
1913 1896
1914 if (skge->flow_control == FLOW_MODE_REM_SEND) { 1897 if (skge->flow_control == FLOW_MODE_REM_SEND) {
1915 /* restore Asymmetric Pause bit */ 1898 /* restore Asymmetric Pause bit */
@@ -2097,10 +2080,12 @@ static int skge_up(struct net_device *dev)
2097 skge_write32(hw, B0_IMSK, hw->intr_mask); 2080 skge_write32(hw, B0_IMSK, hw->intr_mask);
2098 2081
2099 /* Initialze MAC */ 2082 /* Initialze MAC */
2083 spin_lock_bh(&hw->phy_lock);
2100 if (hw->chip_id == CHIP_ID_GENESIS) 2084 if (hw->chip_id == CHIP_ID_GENESIS)
2101 genesis_mac_init(hw, port); 2085 genesis_mac_init(hw, port);
2102 else 2086 else
2103 yukon_mac_init(hw, port); 2087 yukon_mac_init(hw, port);
2088 spin_unlock_bh(&hw->phy_lock);
2104 2089
2105 /* Configure RAMbuffers */ 2090 /* Configure RAMbuffers */
2106 chunk = hw->ram_size / ((hw->ports + 1)*2); 2091 chunk = hw->ram_size / ((hw->ports + 1)*2);
@@ -2116,6 +2101,7 @@ static int skge_up(struct net_device *dev)
2116 /* Start receiver BMU */ 2101 /* Start receiver BMU */
2117 wmb(); 2102 wmb();
2118 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2103 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2104 skge_led(skge, LED_MODE_ON);
2119 2105
2120 pr_debug("skge_up completed\n"); 2106 pr_debug("skge_up completed\n");
2121 return 0; 2107 return 0;
@@ -2140,8 +2126,6 @@ static int skge_down(struct net_device *dev)
2140 2126
2141 netif_stop_queue(dev); 2127 netif_stop_queue(dev);
2142 2128
2143 del_timer_sync(&skge->led_blink);
2144
2145 /* Stop transmitter */ 2129 /* Stop transmitter */
2146 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); 2130 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP);
2147 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), 2131 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL),
@@ -2175,15 +2159,12 @@ static int skge_down(struct net_device *dev)
2175 if (hw->chip_id == CHIP_ID_GENESIS) { 2159 if (hw->chip_id == CHIP_ID_GENESIS) {
2176 skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET); 2160 skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET);
2177 skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET); 2161 skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET);
2178 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_STOP);
2179 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_STOP);
2180 } else { 2162 } else {
2181 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 2163 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
2182 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 2164 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
2183 } 2165 }
2184 2166
2185 /* turn off led's */ 2167 skge_led(skge, LED_MODE_OFF);
2186 skge_write16(hw, B0_LED, LED_STAT_OFF);
2187 2168
2188 skge_tx_clean(skge); 2169 skge_tx_clean(skge);
2189 skge_rx_clean(skge); 2170 skge_rx_clean(skge);
@@ -2633,11 +2614,17 @@ static inline void skge_tx_intr(struct net_device *dev)
2633 spin_unlock(&skge->tx_lock); 2614 spin_unlock(&skge->tx_lock);
2634} 2615}
2635 2616
2617/* Parity errors seem to happen when Genesis is connected to a switch
2618 * with no other ports present. Heartbeat error??
2619 */
2636static void skge_mac_parity(struct skge_hw *hw, int port) 2620static void skge_mac_parity(struct skge_hw *hw, int port)
2637{ 2621{
2638 printk(KERN_ERR PFX "%s: mac data parity error\n", 2622 struct net_device *dev = hw->dev[port];
2639 hw->dev[port] ? hw->dev[port]->name 2623
2640 : (port == 0 ? "(port A)": "(port B")); 2624 if (dev) {
2625 struct skge_port *skge = netdev_priv(dev);
2626 ++skge->net_stats.tx_heartbeat_errors;
2627 }
2641 2628
2642 if (hw->chip_id == CHIP_ID_GENESIS) 2629 if (hw->chip_id == CHIP_ID_GENESIS)
2643 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), 2630 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1),
@@ -3083,10 +3070,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3083 3070
3084 spin_lock_init(&skge->tx_lock); 3071 spin_lock_init(&skge->tx_lock);
3085 3072
3086 init_timer(&skge->led_blink);
3087 skge->led_blink.function = skge_blink_timer;
3088 skge->led_blink.data = (unsigned long) skge;
3089
3090 if (hw->chip_id != CHIP_ID_GENESIS) { 3073 if (hw->chip_id != CHIP_ID_GENESIS) {
3091 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3074 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
3092 skge->rx_csum = 1; 3075 skge->rx_csum = 1;
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index fced3d2bc072..b432f1bb8168 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -1449,10 +1449,12 @@ enum {
1449 PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */ 1449 PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */
1450 PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */ 1450 PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */
1451 PHY_M_IS_JABBER = 1<<0, /* Jabber */ 1451 PHY_M_IS_JABBER = 1<<0, /* Jabber */
1452};
1453 1452
1454#define PHY_M_DEF_MSK ( PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE | \ 1453 PHY_M_IS_DEF_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE |
1455 PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR) 1454 PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR,
1455
1456 PHY_M_IS_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL,
1457};
1456 1458
1457/***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/ 1459/***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/
1458enum { 1460enum {
@@ -1509,7 +1511,7 @@ enum {
1509 PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ 1511 PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */
1510}; 1512};
1511 1513
1512#define PHY_M_LED_PULS_DUR(x) ( ((x)<<12) & PHY_M_LEDC_PULS_MSK) 1514#define PHY_M_LED_PULS_DUR(x) (((x)<<12) & PHY_M_LEDC_PULS_MSK)
1513 1515
1514enum { 1516enum {
1515 PULS_NO_STR = 0,/* no pulse stretching */ 1517 PULS_NO_STR = 0,/* no pulse stretching */
@@ -1522,7 +1524,7 @@ enum {
1522 PULS_1300MS = 7,/* 1.3 s to 2.7 s */ 1524 PULS_1300MS = 7,/* 1.3 s to 2.7 s */
1523}; 1525};
1524 1526
1525#define PHY_M_LED_BLINK_RT(x) ( ((x)<<8) & PHY_M_LEDC_BL_R_MSK) 1527#define PHY_M_LED_BLINK_RT(x) (((x)<<8) & PHY_M_LEDC_BL_R_MSK)
1526 1528
1527enum { 1529enum {
1528 BLINK_42MS = 0,/* 42 ms */ 1530 BLINK_42MS = 0,/* 42 ms */
@@ -1602,9 +1604,9 @@ enum {
1602 PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ 1604 PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */
1603}; 1605};
1604 1606
1605#define PHY_M_FELP_LED2_CTRL(x) ( ((x)<<8) & PHY_M_FELP_LED2_MSK) 1607#define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK)
1606#define PHY_M_FELP_LED1_CTRL(x) ( ((x)<<4) & PHY_M_FELP_LED1_MSK) 1608#define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK)
1607#define PHY_M_FELP_LED0_CTRL(x) ( ((x)<<0) & PHY_M_FELP_LED0_MSK) 1609#define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK)
1608 1610
1609enum { 1611enum {
1610 LED_PAR_CTRL_COLX = 0x00, 1612 LED_PAR_CTRL_COLX = 0x00,
@@ -1640,7 +1642,7 @@ enum {
1640 PHY_M_MAC_MD_COPPER = 5,/* Copper only */ 1642 PHY_M_MAC_MD_COPPER = 5,/* Copper only */
1641 PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */ 1643 PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */
1642}; 1644};
1643#define PHY_M_MAC_MODE_SEL(x) ( ((x)<<7) & PHY_M_MAC_MD_MSK) 1645#define PHY_M_MAC_MODE_SEL(x) (((x)<<7) & PHY_M_MAC_MD_MSK)
1644 1646
1645/***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ 1647/***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/
1646enum { 1648enum {
@@ -1650,10 +1652,10 @@ enum {
1650 PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ 1652 PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */
1651}; 1653};
1652 1654
1653#define PHY_M_LEDC_LOS_CTRL(x) ( ((x)<<12) & PHY_M_LEDC_LOS_MSK) 1655#define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK)
1654#define PHY_M_LEDC_INIT_CTRL(x) ( ((x)<<8) & PHY_M_LEDC_INIT_MSK) 1656#define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK)
1655#define PHY_M_LEDC_STA1_CTRL(x) ( ((x)<<4) & PHY_M_LEDC_STA1_MSK) 1657#define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK)
1656#define PHY_M_LEDC_STA0_CTRL(x) ( ((x)<<0) & PHY_M_LEDC_STA0_MSK) 1658#define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK)
1657 1659
1658/* GMAC registers */ 1660/* GMAC registers */
1659/* Port Registers */ 1661/* Port Registers */
@@ -2505,8 +2507,6 @@ struct skge_port {
2505 dma_addr_t dma; 2507 dma_addr_t dma;
2506 unsigned long mem_size; 2508 unsigned long mem_size;
2507 unsigned int rx_buf_size; 2509 unsigned int rx_buf_size;
2508
2509 struct timer_list led_blink;
2510}; 2510};
2511 2511
2512 2512
@@ -2606,17 +2606,6 @@ static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
2606 skge_write16(hw, SK_GMAC_REG(port,r), v); 2606 skge_write16(hw, SK_GMAC_REG(port,r), v);
2607} 2607}
2608 2608
2609static inline void gma_write32(const struct skge_hw *hw, int port, int r, u32 v)
2610{
2611 skge_write16(hw, SK_GMAC_REG(port, r), (u16) v);
2612 skge_write32(hw, SK_GMAC_REG(port, r+4), (u16)(v >> 16));
2613}
2614
2615static inline void gma_write8(const struct skge_hw *hw, int port, int r, u8 v)
2616{
2617 skge_write8(hw, SK_GMAC_REG(port,r), v);
2618}
2619
2620static inline void gma_set_addr(struct skge_hw *hw, int port, int reg, 2609static inline void gma_set_addr(struct skge_hw *hw, int port, int reg,
2621 const u8 *addr) 2610 const u8 *addr)
2622{ 2611{
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 7089d86e857a..a9b06b8d8e3f 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -188,7 +188,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
188#define SMC_IRQ_TRIGGER_TYPE (( \ 188#define SMC_IRQ_TRIGGER_TYPE (( \
189 machine_is_omap_h2() \ 189 machine_is_omap_h2() \
190 || machine_is_omap_h3() \ 190 || machine_is_omap_h3() \
191 || (machine_is_omap_innovator() && !cpu_is_omap150()) \ 191 || (machine_is_omap_innovator() && !cpu_is_omap1510()) \
192 ) ? IRQT_FALLING : IRQT_RISING) 192 ) ? IRQT_FALLING : IRQT_RISING)
193 193
194 194
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 201a550f0bcc..368b8fb14023 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -66,8 +66,8 @@
66 66
67#define DRV_MODULE_NAME "tg3" 67#define DRV_MODULE_NAME "tg3"
68#define PFX DRV_MODULE_NAME ": " 68#define PFX DRV_MODULE_NAME ": "
69#define DRV_MODULE_VERSION "3.34" 69#define DRV_MODULE_VERSION "3.35"
70#define DRV_MODULE_RELDATE "July 25, 2005" 70#define DRV_MODULE_RELDATE "August 6, 2005"
71 71
72#define TG3_DEF_MAC_MODE 0 72#define TG3_DEF_MAC_MODE 0
73#define TG3_DEF_RX_MODE 0 73#define TG3_DEF_RX_MODE 0
@@ -10421,6 +10421,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10421 10421
10422 tg3_init_coal(tp); 10422 tg3_init_coal(tp);
10423 10423
10424 /* Now that we have fully setup the chip, save away a snapshot
10425 * of the PCI config space. We need to restore this after
10426 * GRC_MISC_CFG core clock resets and some resume events.
10427 */
10428 pci_save_state(tp->pdev);
10429
10424 err = register_netdev(dev); 10430 err = register_netdev(dev);
10425 if (err) { 10431 if (err) {
10426 printk(KERN_ERR PFX "Cannot register net device, " 10432 printk(KERN_ERR PFX "Cannot register net device, "
@@ -10430,12 +10436,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10430 10436
10431 pci_set_drvdata(pdev, dev); 10437 pci_set_drvdata(pdev, dev);
10432 10438
10433 /* Now that we have fully setup the chip, save away a snapshot
10434 * of the PCI config space. We need to restore this after
10435 * GRC_MISC_CFG core clock resets and some resume events.
10436 */
10437 pci_save_state(tp->pdev);
10438
10439 printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", 10439 printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ",
10440 dev->name, 10440 dev->name,
10441 tp->board_part_number, 10441 tp->board_part_number,
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index 1b70b7c97580..d9a774b91ddc 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1414,7 +1414,7 @@ static inline void mac_get_cam(struct mac_regs __iomem * regs, int idx, u8 *addr
1414 * the rest of the logic from the result of sleep/wakeup 1414 * the rest of the logic from the result of sleep/wakeup
1415 */ 1415 */
1416 1416
1417inline static void mac_wol_reset(struct mac_regs __iomem * regs) 1417static inline void mac_wol_reset(struct mac_regs __iomem * regs)
1418{ 1418{
1419 1419
1420 /* Turn off SWPTAG right after leaving power mode */ 1420 /* Turn off SWPTAG right after leaving power mode */
@@ -1811,7 +1811,7 @@ struct velocity_info {
1811 * CHECK ME: locking 1811 * CHECK ME: locking
1812 */ 1812 */
1813 1813
1814inline static int velocity_get_ip(struct velocity_info *vptr) 1814static inline int velocity_get_ip(struct velocity_info *vptr)
1815{ 1815{
1816 struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr; 1816 struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr;
1817 struct in_ifaddr *ifa; 1817 struct in_ifaddr *ifa;
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 47f3c5d0203d..df20adcd0730 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5013,7 +5013,7 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
5013 enable_MAC(ai, &rsp, 1); 5013 enable_MAC(ai, &rsp, 1);
5014} 5014}
5015 5015
5016inline static u8 hexVal(char c) { 5016static inline u8 hexVal(char c) {
5017 if (c>='0' && c<='9') return c -= '0'; 5017 if (c>='0' && c<='9') return c -= '0';
5018 if (c>='a' && c<='f') return c -= 'a'-10; 5018 if (c>='a' && c<='f') return c -= 'a'-10;
5019 if (c>='A' && c<='F') return c -= 'A'-10; 5019 if (c>='A' && c<='F') return c -= 'A'-10;
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 368d2f962f67..1cc1492083c9 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -621,8 +621,6 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), 621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021),
622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), 622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
625 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
626 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
627 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 625 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
628 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), 626 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index e9b1772a3a28..026f671ea558 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -42,8 +42,7 @@ void free_cpu_buffers(void)
42 vfree(cpu_buffer[i].buffer); 42 vfree(cpu_buffer[i].buffer);
43 } 43 }
44} 44}
45 45
46
47int alloc_cpu_buffers(void) 46int alloc_cpu_buffers(void)
48{ 47{
49 int i; 48 int i;
@@ -74,7 +73,6 @@ fail:
74 free_cpu_buffers(); 73 free_cpu_buffers();
75 return -ENOMEM; 74 return -ENOMEM;
76} 75}
77
78 76
79void start_cpu_work(void) 77void start_cpu_work(void)
80{ 78{
@@ -93,7 +91,6 @@ void start_cpu_work(void)
93 } 91 }
94} 92}
95 93
96
97void end_cpu_work(void) 94void end_cpu_work(void)
98{ 95{
99 int i; 96 int i;
@@ -109,7 +106,6 @@ void end_cpu_work(void)
109 flush_scheduled_work(); 106 flush_scheduled_work();
110} 107}
111 108
112
113/* Resets the cpu buffer to a sane state. */ 109/* Resets the cpu buffer to a sane state. */
114void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf) 110void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf)
115{ 111{
@@ -121,7 +117,6 @@ void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf)
121 cpu_buf->last_task = NULL; 117 cpu_buf->last_task = NULL;
122} 118}
123 119
124
125/* compute number of available slots in cpu_buffer queue */ 120/* compute number of available slots in cpu_buffer queue */
126static unsigned long nr_available_slots(struct oprofile_cpu_buffer const * b) 121static unsigned long nr_available_slots(struct oprofile_cpu_buffer const * b)
127{ 122{
@@ -134,7 +129,6 @@ static unsigned long nr_available_slots(struct oprofile_cpu_buffer const * b)
134 return tail + (b->buffer_size - head) - 1; 129 return tail + (b->buffer_size - head) - 1;
135} 130}
136 131
137
138static void increment_head(struct oprofile_cpu_buffer * b) 132static void increment_head(struct oprofile_cpu_buffer * b)
139{ 133{
140 unsigned long new_head = b->head_pos + 1; 134 unsigned long new_head = b->head_pos + 1;
@@ -149,10 +143,7 @@ static void increment_head(struct oprofile_cpu_buffer * b)
149 b->head_pos = 0; 143 b->head_pos = 0;
150} 144}
151 145
152 146static inline void
153
154
155inline static void
156add_sample(struct oprofile_cpu_buffer * cpu_buf, 147add_sample(struct oprofile_cpu_buffer * cpu_buf,
157 unsigned long pc, unsigned long event) 148 unsigned long pc, unsigned long event)
158{ 149{
@@ -162,14 +153,12 @@ add_sample(struct oprofile_cpu_buffer * cpu_buf,
162 increment_head(cpu_buf); 153 increment_head(cpu_buf);
163} 154}
164 155
165 156static inline void
166inline static void
167add_code(struct oprofile_cpu_buffer * buffer, unsigned long value) 157add_code(struct oprofile_cpu_buffer * buffer, unsigned long value)
168{ 158{
169 add_sample(buffer, ESCAPE_CODE, value); 159 add_sample(buffer, ESCAPE_CODE, value);
170} 160}
171 161
172
173/* This must be safe from any context. It's safe writing here 162/* This must be safe from any context. It's safe writing here
174 * because of the head/tail separation of the writer and reader 163 * because of the head/tail separation of the writer and reader
175 * of the CPU buffer. 164 * of the CPU buffer.
@@ -223,13 +212,11 @@ static int oprofile_begin_trace(struct oprofile_cpu_buffer * cpu_buf)
223 return 1; 212 return 1;
224} 213}
225 214
226
227static void oprofile_end_trace(struct oprofile_cpu_buffer * cpu_buf) 215static void oprofile_end_trace(struct oprofile_cpu_buffer * cpu_buf)
228{ 216{
229 cpu_buf->tracing = 0; 217 cpu_buf->tracing = 0;
230} 218}
231 219
232
233void oprofile_add_sample(struct pt_regs * const regs, unsigned long event) 220void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
234{ 221{
235 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; 222 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -251,14 +238,12 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
251 oprofile_end_trace(cpu_buf); 238 oprofile_end_trace(cpu_buf);
252} 239}
253 240
254
255void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) 241void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event)
256{ 242{
257 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; 243 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
258 log_sample(cpu_buf, pc, is_kernel, event); 244 log_sample(cpu_buf, pc, is_kernel, event);
259} 245}
260 246
261
262void oprofile_add_trace(unsigned long pc) 247void oprofile_add_trace(unsigned long pc)
263{ 248{
264 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; 249 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -283,8 +268,6 @@ void oprofile_add_trace(unsigned long pc)
283 add_sample(cpu_buf, pc, 0); 268 add_sample(cpu_buf, pc, 0);
284} 269}
285 270
286
287
288/* 271/*
289 * This serves to avoid cpu buffer overflow, and makes sure 272 * This serves to avoid cpu buffer overflow, and makes sure
290 * the task mortuary progresses 273 * the task mortuary progresses
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index fedae89d8f7d..fb9a11243d2a 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -60,7 +60,9 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
60 continue; 60 continue;
61 61
62 /* Ok, try it out.. */ 62 /* Ok, try it out.. */
63 ret = allocate_resource(r, res, size, min, -1, align, 63 ret = allocate_resource(r, res, size,
64 r->start ? : min,
65 -1, align,
64 alignf, alignf_data); 66 alignf, alignf_data);
65 if (ret == 0) 67 if (ret == 0)
66 break; 68 break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index df3bdae2040f..93e8a878ea95 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -507,7 +507,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
507 pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); 507 pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses);
508 508
509 if (!is_cardbus) { 509 if (!is_cardbus) {
510 child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; 510 child->bridge_ctl = bctl | PCI_BRIDGE_CTL_NO_ISA;
511 /* 511 /*
512 * Adjust subordinate busnr in parent buses. 512 * Adjust subordinate busnr in parent buses.
513 * We do this before scanning for children because 513 * We do this before scanning for children because
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1521fd5d95cc..a9160ad16581 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -373,6 +373,25 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev)
373} 373}
374DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); 374DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi );
375 375
376/*
377 * VIA VT8235 ISA Bridge: Two IO regions pointed to by words at
378 * 0x88 (128 bytes of power management registers)
379 * 0xd0 (16 bytes of SMB registers)
380 */
381static void __devinit quirk_vt8235_acpi(struct pci_dev *dev)
382{
383 u16 pm, smb;
384
385 pci_read_config_word(dev, 0x88, &pm);
386 pm &= PCI_BASE_ADDRESS_IO_MASK;
387 quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES);
388
389 pci_read_config_word(dev, 0xd0, &smb);
390 smb &= PCI_BASE_ADDRESS_IO_MASK;
391 quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1);
392}
393DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi);
394
376 395
377#ifdef CONFIG_X86_IO_APIC 396#ifdef CONFIG_X86_IO_APIC
378 397
@@ -820,6 +839,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
820 case 0x0001: /* Toshiba Satellite A40 */ 839 case 0x0001: /* Toshiba Satellite A40 */
821 asus_hides_smbus = 1; 840 asus_hides_smbus = 1;
822 } 841 }
842 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
843 switch(dev->subsystem_device) {
844 case 0x0001: /* Toshiba Tecra M2 */
845 asus_hides_smbus = 1;
846 }
823 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 847 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
824 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 848 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
825 switch(dev->subsystem_device) { 849 switch(dev->subsystem_device) {
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 838575e3fac6..713c78f3a65d 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
125 image += readw(pds + 16) * 512; 125 image += readw(pds + 16) * 512;
126 } while (!last_image); 126 } while (!last_image);
127 127
128 *size = image - rom; 128 /* never return a size larger than the PCI resource window */
129 /* there are known ROMs that get the size wrong */
130 *size = min((size_t)(image - rom), *size);
129 131
130 return rom; 132 return rom;
131} 133}
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 9fe48f712be9..a2eebc6eaacc 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -51,8 +51,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
51 struct resource_list head, *list, *tmp; 51 struct resource_list head, *list, *tmp;
52 int idx; 52 int idx;
53 53
54 bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA;
55
56 head.next = NULL; 54 head.next = NULL;
57 list_for_each_entry(dev, &bus->devices, bus_list) { 55 list_for_each_entry(dev, &bus->devices, bus_list) {
58 u16 class = dev->class >> 8; 56 u16 class = dev->class >> 8;
@@ -62,10 +60,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
62 class == PCI_CLASS_BRIDGE_HOST) 60 class == PCI_CLASS_BRIDGE_HOST)
63 continue; 61 continue;
64 62
65 if (class == PCI_CLASS_DISPLAY_VGA ||
66 class == PCI_CLASS_NOT_DEFINED_VGA)
67 bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
68
69 pdev_sort_resources(dev, &head); 63 pdev_sort_resources(dev, &head);
70 } 64 }
71 65
@@ -509,12 +503,6 @@ pci_bus_assign_resources(struct pci_bus *bus)
509 503
510 pbus_assign_resources_sorted(bus); 504 pbus_assign_resources_sorted(bus);
511 505
512 if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) {
513 /* Propagate presence of the VGA to upstream bridges */
514 for (b = bus; b->parent; b = b->parent) {
515 b->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
516 }
517 }
518 list_for_each_entry(dev, &bus->devices, bus_list) { 506 list_for_each_entry(dev, &bus->devices, bus_list) {
519 b = dev->subordinate; 507 b = dev->subordinate;
520 if (!b) 508 if (!b)
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 1ca21d2ba11c..84eedc965688 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -33,6 +33,11 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
33 u32 new, check, mask; 33 u32 new, check, mask;
34 int reg; 34 int reg;
35 35
36 /* Ignore resources for unimplemented BARs and unused resource slots
37 for 64 bit BARs. */
38 if (!res->flags)
39 return;
40
36 pcibios_resource_to_bus(dev, &region, res); 41 pcibios_resource_to_bus(dev, &region, res);
37 42
38 pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for " 43 pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
@@ -67,7 +72,7 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
67 72
68 if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == 73 if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
69 (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) { 74 (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) {
70 new = 0; /* currently everyone zeros the high address */ 75 new = region.start >> 16 >> 16;
71 pci_write_config_dword(dev, reg + 4, new); 76 pci_write_config_dword(dev, reg + 4, new);
72 pci_read_config_dword(dev, reg + 4, &check); 77 pci_read_config_dword(dev, reg + 4, &check);
73 if (check != new) { 78 if (check != new) {
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 0a5c95807cf2..470ef756252e 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -388,6 +388,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
389 memset(skt, 0, sizeof(*skt)); 389 memset(skt, 0, sizeof(*skt));
390 390
391 skt->socket.resource_ops = &pccard_static_ops;
391 skt->socket.ops = &au1x00_pcmcia_operations; 392 skt->socket.ops = &au1x00_pcmcia_operations;
392 skt->socket.owner = ops->owner; 393 skt->socket.owner = ops->owner;
393 skt->socket.dev.dev = dev; 394 skt->socket.dev.dev = dev;
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index dd7651ff5b43..3afb682255a0 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -88,31 +88,38 @@ EXPORT_SYMBOL(release_cis_mem);
88static void __iomem * 88static void __iomem *
89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
90{ 90{
91 pccard_mem_map *mem = &s->cis_mem; 91 pccard_mem_map *mem = &s->cis_mem;
92 int ret; 92 int ret;
93
94 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
96 if (mem->res == NULL) {
97 printk(KERN_NOTICE "cs: unable to map card memory!\n");
98 return NULL;
99 }
100 s->cis_virt = NULL;
101 }
93 102
94 if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 103 if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 104 s->cis_virt = ioremap(mem->res->start, s->map_size);
96 if (mem->res == NULL) { 105
97 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 106 mem->card_start = card_offset;
98 return NULL; 107 mem->flags = flags;
108
109 ret = s->ops->set_mem_map(s, mem);
110 if (ret) {
111 iounmap(s->cis_virt);
112 s->cis_virt = NULL;
113 return NULL;
99 } 114 }
100 s->cis_virt = ioremap(mem->res->start, s->map_size);
101 }
102 mem->card_start = card_offset;
103 mem->flags = flags;
104 ret = s->ops->set_mem_map(s, mem);
105 if (ret) {
106 iounmap(s->cis_virt);
107 return NULL;
108 }
109 115
110 if (s->features & SS_CAP_STATIC_MAP) { 116 if (s->features & SS_CAP_STATIC_MAP) {
111 if (s->cis_virt) 117 if (s->cis_virt)
112 iounmap(s->cis_virt); 118 iounmap(s->cis_virt);
113 s->cis_virt = ioremap(mem->static_start, s->map_size); 119 s->cis_virt = ioremap(mem->static_start, s->map_size);
114 } 120 }
115 return s->cis_virt; 121
122 return s->cis_virt;
116} 123}
117 124
118/*====================================================================== 125/*======================================================================
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 3e3c6f12bbe6..43da2e92d50f 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -206,8 +206,8 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
206 u32 hash; 206 u32 hash;
207 207
208 if (!p_drv->attach || !p_drv->event || !p_drv->detach) 208 if (!p_drv->attach || !p_drv->event || !p_drv->detach)
209 printk(KERN_DEBUG "pcmcia: %s does misses a callback function", 209 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback "
210 p_drv->drv.name); 210 "function\n", p_drv->drv.name);
211 211
212 while (did && did->match_flags) { 212 while (did && did->match_flags) {
213 for (i=0; i<4; i++) { 213 for (i=0; i<4; i++) {
@@ -589,8 +589,8 @@ static void pcmcia_delayed_add_pseudo_device(void *data)
589static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s) 589static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
590{ 590{
591 if (!s->pcmcia_state.device_add_pending) { 591 if (!s->pcmcia_state.device_add_pending) {
592 schedule_work(&s->device_add);
593 s->pcmcia_state.device_add_pending = 1; 592 s->pcmcia_state.device_add_pending = 1;
593 schedule_work(&s->device_add);
594 } 594 }
595 return; 595 return;
596} 596}
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h
index b1f6e3d9ee06..a234ce1967a3 100644
--- a/drivers/pcmcia/o2micro.h
+++ b/drivers/pcmcia/o2micro.h
@@ -120,11 +120,16 @@
120#define O2_MODE_E_LED_OUT 0x08 120#define O2_MODE_E_LED_OUT 0x08
121#define O2_MODE_E_SKTA_ACTV 0x10 121#define O2_MODE_E_SKTA_ACTV 0x10
122 122
123#define O2_RESERVED1 0x94
124#define O2_RESERVED2 0xD4
125#define O2_RES_READ_PREFETCH 0x02
126#define O2_RES_WRITE_BURST 0x08
127
123static int o2micro_override(struct yenta_socket *socket) 128static int o2micro_override(struct yenta_socket *socket)
124{ 129{
125 /* 130 /*
126 * 'reserved' register at 0x94/D4. chaning it to 0xCA (8 bit) enables 131 * 'reserved' register at 0x94/D4. allows setting read prefetch and write
127 * read prefetching which for example makes the RME Hammerfall DSP 132 * bursting. read prefetching for example makes the RME Hammerfall DSP
128 * working. for some bridges it is at 0x94, for others at 0xD4. it's 133 * working. for some bridges it is at 0x94, for others at 0xD4. it's
129 * ok to write to both registers on all O2 bridges. 134 * ok to write to both registers on all O2 bridges.
130 * from Eric Still, 02Micro. 135 * from Eric Still, 02Micro.
@@ -132,20 +137,35 @@ static int o2micro_override(struct yenta_socket *socket)
132 u8 a, b; 137 u8 a, b;
133 138
134 if (PCI_FUNC(socket->dev->devfn) == 0) { 139 if (PCI_FUNC(socket->dev->devfn) == 0) {
135 a = config_readb(socket, 0x94); 140 a = config_readb(socket, O2_RESERVED1);
136 b = config_readb(socket, 0xD4); 141 b = config_readb(socket, O2_RESERVED2);
137 142
138 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); 143 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
139 144
140 switch (socket->dev->device) { 145 switch (socket->dev->device) {
146 /*
147 * older bridges have problems with both read prefetch and write
148 * bursting depending on the combination of the chipset, bridge
149 * and the cardbus card. so disable them to be on the safe side.
150 */
151 case PCI_DEVICE_ID_O2_6729:
152 case PCI_DEVICE_ID_O2_6730:
153 case PCI_DEVICE_ID_O2_6812:
141 case PCI_DEVICE_ID_O2_6832: 154 case PCI_DEVICE_ID_O2_6832:
142 printk(KERN_INFO "Yenta O2: old bridge, not enabling read prefetch / write burst\n"); 155 case PCI_DEVICE_ID_O2_6836:
156 printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n");
157 config_writeb(socket, O2_RESERVED1,
158 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
159 config_writeb(socket, O2_RESERVED2,
160 b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
143 break; 161 break;
144 162
145 default: 163 default:
146 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); 164 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n");
147 config_writeb(socket, 0x94, a | 0x0a); 165 config_writeb(socket, O2_RESERVED1,
148 config_writeb(socket, 0xD4, b | 0x0a); 166 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
167 config_writeb(socket, O2_RESERVED2,
168 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
149 } 169 }
150 } 170 }
151 171
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 184f4f88b2a0..6f9fdb276402 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -800,7 +800,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
800 } else { 800 } else {
801 int try; 801 int try;
802 u32 mask = s->irq_mask; 802 u32 mask = s->irq_mask;
803 void *data = NULL; 803 void *data = &p_dev->dev.driver; /* something unique to this device */
804 804
805 for (try = 0; try < 64; try++) { 805 for (try = 0; try < 64; try++) {
806 irq = try % 32; 806 irq = try % 32;
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 6837491f021c..62fd705203fb 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -605,9 +605,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
605 605
606static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) 606static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
607{ 607{
608 struct pci_bus *bus;
609 struct resource *root, *res; 608 struct resource *root, *res;
610 u32 start, end; 609 struct pci_bus_region region;
611 unsigned mask; 610 unsigned mask;
612 611
613 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; 612 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
@@ -620,15 +619,13 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
620 if (type & IORESOURCE_IO) 619 if (type & IORESOURCE_IO)
621 mask = ~3; 620 mask = ~3;
622 621
623 bus = socket->dev->subordinate; 622 res->name = socket->dev->subordinate->name;
624 res->name = bus->name;
625 res->flags = type; 623 res->flags = type;
626 624
627 start = config_readl(socket, addr_start) & mask; 625 region.start = config_readl(socket, addr_start) & mask;
628 end = config_readl(socket, addr_end) | ~mask; 626 region.end = config_readl(socket, addr_end) | ~mask;
629 if (start && end > start && !override_bios) { 627 if (region.start && region.end > region.start && !override_bios) {
630 res->start = start; 628 pcibios_bus_to_resource(socket->dev, res, &region);
631 res->end = end;
632 root = pci_find_parent_resource(socket->dev, res); 629 root = pci_find_parent_resource(socket->dev, res);
633 if (root && (request_resource(root, res) == 0)) 630 if (root && (request_resource(root, res) == 0))
634 return; 631 return;
@@ -642,6 +639,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
642 (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { 639 (yenta_search_res(socket, res, BRIDGE_IO_MIN))) {
643 config_writel(socket, addr_start, res->start); 640 config_writel(socket, addr_start, res->start);
644 config_writel(socket, addr_end, res->end); 641 config_writel(socket, addr_end, res->end);
642 return;
645 } 643 }
646 } else { 644 } else {
647 if (type & IORESOURCE_PREFETCH) { 645 if (type & IORESOURCE_PREFETCH) {
@@ -650,6 +648,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
650 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { 648 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
651 config_writel(socket, addr_start, res->start); 649 config_writel(socket, addr_start, res->start);
652 config_writel(socket, addr_end, res->end); 650 config_writel(socket, addr_end, res->end);
651 return;
653 } 652 }
654 /* Approximating prefetchable by non-prefetchable */ 653 /* Approximating prefetchable by non-prefetchable */
655 res->flags = IORESOURCE_MEM; 654 res->flags = IORESOURCE_MEM;
@@ -659,6 +658,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
659 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { 658 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
660 config_writel(socket, addr_start, res->start); 659 config_writel(socket, addr_start, res->start);
661 config_writel(socket, addr_end, res->end); 660 config_writel(socket, addr_end, res->end);
661 return;
662 } 662 }
663 } 663 }
664 664
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 9001b6f0204d..e305bb132c24 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -11,7 +11,7 @@
11#ifdef CONFIG_PCI 11#ifdef CONFIG_PCI
12#include <linux/pci.h> 12#include <linux/pci.h>
13#else 13#else
14inline void pcibios_penalize_isa_irq(int irq) {} 14inline void pcibios_penalize_isa_irq(int irq, int active) {}
15#endif /* CONFIG_PCI */ 15#endif /* CONFIG_PCI */
16 16
17#include "pnpbios.h" 17#include "pnpbios.h"
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 6527ff6f4706..d5f53980749b 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -7,7 +7,7 @@
7 * Bugreports.to..: <Linux390@de.ibm.com> 7 * Bugreports.to..: <Linux390@de.ibm.com>
8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001 8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
9 * 9 *
10 * $Revision: 1.164 $ 10 * $Revision: 1.165 $
11 */ 11 */
12 12
13#include <linux/config.h> 13#include <linux/config.h>
@@ -1740,6 +1740,10 @@ dasd_exit(void)
1740 dasd_proc_exit(); 1740 dasd_proc_exit();
1741#endif 1741#endif
1742 dasd_ioctl_exit(); 1742 dasd_ioctl_exit();
1743 if (dasd_page_cache != NULL) {
1744 kmem_cache_destroy(dasd_page_cache);
1745 dasd_page_cache = NULL;
1746 }
1743 dasd_gendisk_exit(); 1747 dasd_gendisk_exit();
1744 dasd_devmap_exit(); 1748 dasd_devmap_exit();
1745 devfs_remove("dasd"); 1749 devfs_remove("dasd");
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 7963ae343eef..28cb4613b7f5 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -4,7 +4,7 @@
4 * Bugreports.to..: <Linux390@de.ibm.com> 4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 * 6 *
7 * $Revision: 1.39 $ 7 * $Revision: 1.40 $
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
@@ -354,6 +354,8 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req)
354 } 354 }
355 cqr->device = device; 355 cqr->device = device;
356 cqr->expires = 5 * 60 * HZ; /* 5 minutes */ 356 cqr->expires = 5 * 60 * HZ; /* 5 minutes */
357 cqr->retries = 32;
358 cqr->buildclk = get_clock();
357 cqr->status = DASD_CQR_FILLED; 359 cqr->status = DASD_CQR_FILLED;
358 return cqr; 360 return cqr;
359} 361}
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index d04e6c2c3cc1..01d865d93791 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -3,10 +3,11 @@
3 * tape device driver for 3480/3490E/3590 tapes. 3 * tape device driver for 3480/3490E/3590 tapes.
4 * 4 *
5 * S390 and zSeries version 5 * S390 and zSeries version
6 * Copyright (C) 2001,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright (C) 2001,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Tuan Ngo-Anh <ngoanh@de.ibm.com> 8 * Tuan Ngo-Anh <ngoanh@de.ibm.com>
9 * Martin Schwidefsky <schwidefsky@de.ibm.com> 9 * Martin Schwidefsky <schwidefsky@de.ibm.com>
10 * Stefan Bader <shbader@de.ibm.com>
10 */ 11 */
11 12
12#ifndef _TAPE_H 13#ifndef _TAPE_H
@@ -111,6 +112,7 @@ enum tape_request_status {
111 TAPE_REQUEST_QUEUED, /* request is queued to be processed */ 112 TAPE_REQUEST_QUEUED, /* request is queued to be processed */
112 TAPE_REQUEST_IN_IO, /* request is currently in IO */ 113 TAPE_REQUEST_IN_IO, /* request is currently in IO */
113 TAPE_REQUEST_DONE, /* request is completed. */ 114 TAPE_REQUEST_DONE, /* request is completed. */
115 TAPE_REQUEST_CANCEL, /* request should be canceled. */
114}; 116};
115 117
116/* Tape CCW request */ 118/* Tape CCW request */
@@ -237,6 +239,9 @@ struct tape_device {
237 /* Block dev frontend data */ 239 /* Block dev frontend data */
238 struct tape_blk_data blk_data; 240 struct tape_blk_data blk_data;
239#endif 241#endif
242
243 /* Function to start or stop the next request later. */
244 struct work_struct tape_dnr;
240}; 245};
241 246
242/* Externals from tape_core.c */ 247/* Externals from tape_core.c */
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 0597aa0e27ee..6c52e8307dc5 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -3,11 +3,12 @@
3 * basic function of the tape device driver 3 * basic function of the tape device driver
4 * 4 *
5 * S390 and zSeries version 5 * S390 and zSeries version
6 * Copyright (C) 2001,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright (C) 2001,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Michael Holzheu <holzheu@de.ibm.com> 8 * Michael Holzheu <holzheu@de.ibm.com>
9 * Tuan Ngo-Anh <ngoanh@de.ibm.com> 9 * Tuan Ngo-Anh <ngoanh@de.ibm.com>
10 * Martin Schwidefsky <schwidefsky@de.ibm.com> 10 * Martin Schwidefsky <schwidefsky@de.ibm.com>
11 * Stefan Bader <shbader@de.ibm.com>
11 */ 12 */
12 13
13#include <linux/config.h> 14#include <linux/config.h>
@@ -28,7 +29,7 @@
28#define PRINTK_HEADER "TAPE_CORE: " 29#define PRINTK_HEADER "TAPE_CORE: "
29 30
30static void __tape_do_irq (struct ccw_device *, unsigned long, struct irb *); 31static void __tape_do_irq (struct ccw_device *, unsigned long, struct irb *);
31static void __tape_remove_request(struct tape_device *, struct tape_request *); 32static void tape_delayed_next_request(void * data);
32 33
33/* 34/*
34 * One list to contain all tape devices of all disciplines, so 35 * One list to contain all tape devices of all disciplines, so
@@ -257,7 +258,7 @@ tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate)
257 * Stop running ccw. Has to be called with the device lock held. 258 * Stop running ccw. Has to be called with the device lock held.
258 */ 259 */
259static inline int 260static inline int
260__tape_halt_io(struct tape_device *device, struct tape_request *request) 261__tape_cancel_io(struct tape_device *device, struct tape_request *request)
261{ 262{
262 int retries; 263 int retries;
263 int rc; 264 int rc;
@@ -270,20 +271,23 @@ __tape_halt_io(struct tape_device *device, struct tape_request *request)
270 for (retries = 0; retries < 5; retries++) { 271 for (retries = 0; retries < 5; retries++) {
271 rc = ccw_device_clear(device->cdev, (long) request); 272 rc = ccw_device_clear(device->cdev, (long) request);
272 273
273 if (rc == 0) { /* Termination successful */ 274 switch (rc) {
274 request->rc = -EIO; 275 case 0:
275 request->status = TAPE_REQUEST_DONE; 276 request->status = TAPE_REQUEST_DONE;
276 return 0; 277 return 0;
278 case -EBUSY:
279 request->status = TAPE_REQUEST_CANCEL;
280 schedule_work(&device->tape_dnr);
281 return 0;
282 case -ENODEV:
283 DBF_EXCEPTION(2, "device gone, retry\n");
284 break;
285 case -EIO:
286 DBF_EXCEPTION(2, "I/O error, retry\n");
287 break;
288 default:
289 BUG();
277 } 290 }
278
279 if (rc == -ENODEV)
280 DBF_EXCEPTION(2, "device gone, retry\n");
281 else if (rc == -EIO)
282 DBF_EXCEPTION(2, "I/O error, retry\n");
283 else if (rc == -EBUSY)
284 DBF_EXCEPTION(2, "device busy, retry late\n");
285 else
286 BUG();
287 } 291 }
288 292
289 return rc; 293 return rc;
@@ -473,6 +477,7 @@ tape_alloc_device(void)
473 *device->modeset_byte = 0; 477 *device->modeset_byte = 0;
474 device->first_minor = -1; 478 device->first_minor = -1;
475 atomic_set(&device->ref_count, 1); 479 atomic_set(&device->ref_count, 1);
480 INIT_WORK(&device->tape_dnr, tape_delayed_next_request, device);
476 481
477 return device; 482 return device;
478} 483}
@@ -708,54 +713,119 @@ tape_free_request (struct tape_request * request)
708 kfree(request); 713 kfree(request);
709} 714}
710 715
716static inline int
717__tape_start_io(struct tape_device *device, struct tape_request *request)
718{
719 int rc;
720
721#ifdef CONFIG_S390_TAPE_BLOCK
722 if (request->op == TO_BLOCK)
723 device->discipline->check_locate(device, request);
724#endif
725 rc = ccw_device_start(
726 device->cdev,
727 request->cpaddr,
728 (unsigned long) request,
729 0x00,
730 request->options
731 );
732 if (rc == 0) {
733 request->status = TAPE_REQUEST_IN_IO;
734 } else if (rc == -EBUSY) {
735 /* The common I/O subsystem is currently busy. Retry later. */
736 request->status = TAPE_REQUEST_QUEUED;
737 schedule_work(&device->tape_dnr);
738 rc = 0;
739 } else {
740 /* Start failed. Remove request and indicate failure. */
741 DBF_EVENT(1, "tape: start request failed with RC = %i\n", rc);
742 }
743 return rc;
744}
745
711static inline void 746static inline void
712__tape_do_io_list(struct tape_device *device) 747__tape_start_next_request(struct tape_device *device)
713{ 748{
714 struct list_head *l, *n; 749 struct list_head *l, *n;
715 struct tape_request *request; 750 struct tape_request *request;
716 int rc; 751 int rc;
717 752
718 DBF_LH(6, "__tape_do_io_list(%p)\n", device); 753 DBF_LH(6, "__tape_start_next_request(%p)\n", device);
719 /* 754 /*
720 * Try to start each request on request queue until one is 755 * Try to start each request on request queue until one is
721 * started successful. 756 * started successful.
722 */ 757 */
723 list_for_each_safe(l, n, &device->req_queue) { 758 list_for_each_safe(l, n, &device->req_queue) {
724 request = list_entry(l, struct tape_request, list); 759 request = list_entry(l, struct tape_request, list);
725#ifdef CONFIG_S390_TAPE_BLOCK 760
726 if (request->op == TO_BLOCK) 761 /*
727 device->discipline->check_locate(device, request); 762 * Avoid race condition if bottom-half was triggered more than
728#endif 763 * once.
729 rc = ccw_device_start(device->cdev, request->cpaddr, 764 */
730 (unsigned long) request, 0x00, 765 if (request->status == TAPE_REQUEST_IN_IO)
731 request->options); 766 return;
732 if (rc == 0) { 767
733 request->status = TAPE_REQUEST_IN_IO; 768 /*
734 break; 769 * We wanted to cancel the request but the common I/O layer
770 * was busy at that time. This can only happen if this
771 * function is called by delayed_next_request.
772 * Otherwise we start the next request on the queue.
773 */
774 if (request->status == TAPE_REQUEST_CANCEL) {
775 rc = __tape_cancel_io(device, request);
776 } else {
777 rc = __tape_start_io(device, request);
735 } 778 }
736 /* Start failed. Remove request and indicate failure. */ 779 if (rc == 0)
737 DBF_EVENT(1, "tape: DOIO failed with er = %i\n", rc); 780 return;
738 781
739 /* Set ending status and do callback. */ 782 /* Set ending status. */
740 request->rc = rc; 783 request->rc = rc;
741 request->status = TAPE_REQUEST_DONE; 784 request->status = TAPE_REQUEST_DONE;
742 __tape_remove_request(device, request); 785
786 /* Remove from request queue. */
787 list_del(&request->list);
788
789 /* Do callback. */
790 if (request->callback != NULL)
791 request->callback(request, request->callback_data);
743 } 792 }
744} 793}
745 794
746static void 795static void
747__tape_remove_request(struct tape_device *device, struct tape_request *request) 796tape_delayed_next_request(void *data)
748{ 797{
749 /* Remove from request queue. */ 798 struct tape_device * device;
750 list_del(&request->list);
751 799
752 /* Do callback. */ 800 device = (struct tape_device *) data;
753 if (request->callback != NULL) 801 DBF_LH(6, "tape_delayed_next_request(%p)\n", device);
754 request->callback(request, request->callback_data); 802 spin_lock_irq(get_ccwdev_lock(device->cdev));
803 __tape_start_next_request(device);
804 spin_unlock_irq(get_ccwdev_lock(device->cdev));
805}
806
807static inline void
808__tape_end_request(
809 struct tape_device * device,
810 struct tape_request * request,
811 int rc)
812{
813 DBF_LH(6, "__tape_end_request(%p, %p, %i)\n", device, request, rc);
814 if (request) {
815 request->rc = rc;
816 request->status = TAPE_REQUEST_DONE;
817
818 /* Remove from request queue. */
819 list_del(&request->list);
820
821 /* Do callback. */
822 if (request->callback != NULL)
823 request->callback(request, request->callback_data);
824 }
755 825
756 /* Start next request. */ 826 /* Start next request. */
757 if (!list_empty(&device->req_queue)) 827 if (!list_empty(&device->req_queue))
758 __tape_do_io_list(device); 828 __tape_start_next_request(device);
759} 829}
760 830
761/* 831/*
@@ -812,7 +882,7 @@ tape_dump_sense_dbf(struct tape_device *device, struct tape_request *request,
812 * the device lock held. 882 * the device lock held.
813 */ 883 */
814static inline int 884static inline int
815__tape_do_io(struct tape_device *device, struct tape_request *request) 885__tape_start_request(struct tape_device *device, struct tape_request *request)
816{ 886{
817 int rc; 887 int rc;
818 888
@@ -837,24 +907,16 @@ __tape_do_io(struct tape_device *device, struct tape_request *request)
837 907
838 if (list_empty(&device->req_queue)) { 908 if (list_empty(&device->req_queue)) {
839 /* No other requests are on the queue. Start this one. */ 909 /* No other requests are on the queue. Start this one. */
840#ifdef CONFIG_S390_TAPE_BLOCK 910 rc = __tape_start_io(device, request);
841 if (request->op == TO_BLOCK) 911 if (rc)
842 device->discipline->check_locate(device, request);
843#endif
844 rc = ccw_device_start(device->cdev, request->cpaddr,
845 (unsigned long) request, 0x00,
846 request->options);
847 if (rc) {
848 DBF_EVENT(1, "tape: DOIO failed with rc = %i\n", rc);
849 return rc; 912 return rc;
850 } 913
851 DBF_LH(5, "Request %p added for execution.\n", request); 914 DBF_LH(5, "Request %p added for execution.\n", request);
852 list_add(&request->list, &device->req_queue); 915 list_add(&request->list, &device->req_queue);
853 request->status = TAPE_REQUEST_IN_IO;
854 } else { 916 } else {
855 DBF_LH(5, "Request %p add to queue.\n", request); 917 DBF_LH(5, "Request %p add to queue.\n", request);
856 list_add_tail(&request->list, &device->req_queue);
857 request->status = TAPE_REQUEST_QUEUED; 918 request->status = TAPE_REQUEST_QUEUED;
919 list_add_tail(&request->list, &device->req_queue);
858 } 920 }
859 return 0; 921 return 0;
860} 922}
@@ -872,7 +934,7 @@ tape_do_io_async(struct tape_device *device, struct tape_request *request)
872 934
873 spin_lock_irq(get_ccwdev_lock(device->cdev)); 935 spin_lock_irq(get_ccwdev_lock(device->cdev));
874 /* Add request to request queue and try to start it. */ 936 /* Add request to request queue and try to start it. */
875 rc = __tape_do_io(device, request); 937 rc = __tape_start_request(device, request);
876 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 938 spin_unlock_irq(get_ccwdev_lock(device->cdev));
877 return rc; 939 return rc;
878} 940}
@@ -901,7 +963,7 @@ tape_do_io(struct tape_device *device, struct tape_request *request)
901 request->callback = __tape_wake_up; 963 request->callback = __tape_wake_up;
902 request->callback_data = &wq; 964 request->callback_data = &wq;
903 /* Add request to request queue and try to start it. */ 965 /* Add request to request queue and try to start it. */
904 rc = __tape_do_io(device, request); 966 rc = __tape_start_request(device, request);
905 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 967 spin_unlock_irq(get_ccwdev_lock(device->cdev));
906 if (rc) 968 if (rc)
907 return rc; 969 return rc;
@@ -935,7 +997,7 @@ tape_do_io_interruptible(struct tape_device *device,
935 /* Setup callback */ 997 /* Setup callback */
936 request->callback = __tape_wake_up_interruptible; 998 request->callback = __tape_wake_up_interruptible;
937 request->callback_data = &wq; 999 request->callback_data = &wq;
938 rc = __tape_do_io(device, request); 1000 rc = __tape_start_request(device, request);
939 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 1001 spin_unlock_irq(get_ccwdev_lock(device->cdev));
940 if (rc) 1002 if (rc)
941 return rc; 1003 return rc;
@@ -944,36 +1006,27 @@ tape_do_io_interruptible(struct tape_device *device,
944 if (rc != -ERESTARTSYS) 1006 if (rc != -ERESTARTSYS)
945 /* Request finished normally. */ 1007 /* Request finished normally. */
946 return request->rc; 1008 return request->rc;
1009
947 /* Interrupted by a signal. We have to stop the current request. */ 1010 /* Interrupted by a signal. We have to stop the current request. */
948 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1011 spin_lock_irq(get_ccwdev_lock(device->cdev));
949 rc = __tape_halt_io(device, request); 1012 rc = __tape_cancel_io(device, request);
1013 spin_unlock_irq(get_ccwdev_lock(device->cdev));
950 if (rc == 0) { 1014 if (rc == 0) {
1015 /* Wait for the interrupt that acknowledges the halt. */
1016 do {
1017 rc = wait_event_interruptible(
1018 wq,
1019 (request->callback == NULL)
1020 );
1021 } while (rc != -ERESTARTSYS);
1022
951 DBF_EVENT(3, "IO stopped on %08x\n", device->cdev_id); 1023 DBF_EVENT(3, "IO stopped on %08x\n", device->cdev_id);
952 rc = -ERESTARTSYS; 1024 rc = -ERESTARTSYS;
953 } 1025 }
954 spin_unlock_irq(get_ccwdev_lock(device->cdev));
955 return rc; 1026 return rc;
956} 1027}
957 1028
958/* 1029/*
959 * Handle requests that return an i/o error in the irb.
960 */
961static inline void
962tape_handle_killed_request(
963 struct tape_device *device,
964 struct tape_request *request)
965{
966 if(request != NULL) {
967 /* Set ending status. FIXME: Should the request be retried? */
968 request->rc = -EIO;
969 request->status = TAPE_REQUEST_DONE;
970 __tape_remove_request(device, request);
971 } else {
972 __tape_do_io_list(device);
973 }
974}
975
976/*
977 * Tape interrupt routine, called from the ccw_device layer 1030 * Tape interrupt routine, called from the ccw_device layer
978 */ 1031 */
979static void 1032static void
@@ -981,7 +1034,6 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
981{ 1034{
982 struct tape_device *device; 1035 struct tape_device *device;
983 struct tape_request *request; 1036 struct tape_request *request;
984 int final;
985 int rc; 1037 int rc;
986 1038
987 device = (struct tape_device *) cdev->dev.driver_data; 1039 device = (struct tape_device *) cdev->dev.driver_data;
@@ -996,12 +1048,13 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
996 1048
997 /* On special conditions irb is an error pointer */ 1049 /* On special conditions irb is an error pointer */
998 if (IS_ERR(irb)) { 1050 if (IS_ERR(irb)) {
1051 /* FIXME: What to do with the request? */
999 switch (PTR_ERR(irb)) { 1052 switch (PTR_ERR(irb)) {
1000 case -ETIMEDOUT: 1053 case -ETIMEDOUT:
1001 PRINT_WARN("(%s): Request timed out\n", 1054 PRINT_WARN("(%s): Request timed out\n",
1002 cdev->dev.bus_id); 1055 cdev->dev.bus_id);
1003 case -EIO: 1056 case -EIO:
1004 tape_handle_killed_request(device, request); 1057 __tape_end_request(device, request, -EIO);
1005 break; 1058 break;
1006 default: 1059 default:
1007 PRINT_ERR("(%s): Unexpected i/o error %li\n", 1060 PRINT_ERR("(%s): Unexpected i/o error %li\n",
@@ -1011,6 +1064,21 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1011 return; 1064 return;
1012 } 1065 }
1013 1066
1067 /*
1068 * If the condition code is not zero and the start function bit is
1069 * still set, this is an deferred error and the last start I/O did
1070 * not succeed. Restart the request now.
1071 */
1072 if (irb->scsw.cc != 0 && (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) {
1073 PRINT_WARN("(%s): deferred cc=%i. restaring\n",
1074 cdev->dev.bus_id,
1075 irb->scsw.cc);
1076 rc = __tape_start_io(device, request);
1077 if (rc)
1078 __tape_end_request(device, request, rc);
1079 return;
1080 }
1081
1014 /* May be an unsolicited irq */ 1082 /* May be an unsolicited irq */
1015 if(request != NULL) 1083 if(request != NULL)
1016 request->rescnt = irb->scsw.count; 1084 request->rescnt = irb->scsw.count;
@@ -1042,7 +1110,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1042 * To detect these request the state will be set to TAPE_REQUEST_DONE. 1110 * To detect these request the state will be set to TAPE_REQUEST_DONE.
1043 */ 1111 */
1044 if(request != NULL && request->status == TAPE_REQUEST_DONE) { 1112 if(request != NULL && request->status == TAPE_REQUEST_DONE) {
1045 __tape_remove_request(device, request); 1113 __tape_end_request(device, request, -EIO);
1046 return; 1114 return;
1047 } 1115 }
1048 1116
@@ -1054,51 +1122,34 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1054 * rc == TAPE_IO_RETRY: request finished but needs another go. 1122 * rc == TAPE_IO_RETRY: request finished but needs another go.
1055 * rc == TAPE_IO_STOP: request needs to get terminated. 1123 * rc == TAPE_IO_STOP: request needs to get terminated.
1056 */ 1124 */
1057 final = 0;
1058 switch (rc) { 1125 switch (rc) {
1059 case TAPE_IO_SUCCESS: 1126 case TAPE_IO_SUCCESS:
1060 /* Upon normal completion the device _is_ online */ 1127 /* Upon normal completion the device _is_ online */
1061 device->tape_generic_status |= GMT_ONLINE(~0); 1128 device->tape_generic_status |= GMT_ONLINE(~0);
1062 final = 1; 1129 __tape_end_request(device, request, rc);
1063 break; 1130 break;
1064 case TAPE_IO_PENDING: 1131 case TAPE_IO_PENDING:
1065 break; 1132 break;
1066 case TAPE_IO_RETRY: 1133 case TAPE_IO_RETRY:
1067#ifdef CONFIG_S390_TAPE_BLOCK 1134 rc = __tape_start_io(device, request);
1068 if (request->op == TO_BLOCK) 1135 if (rc)
1069 device->discipline->check_locate(device, request); 1136 __tape_end_request(device, request, rc);
1070#endif 1137 break;
1071 rc = ccw_device_start(cdev, request->cpaddr, 1138 case TAPE_IO_STOP:
1072 (unsigned long) request, 0x00, 1139 rc = __tape_cancel_io(device, request);
1073 request->options); 1140 if (rc)
1074 if (rc) { 1141 __tape_end_request(device, request, rc);
1075 DBF_EVENT(1, "tape: DOIO failed with er = %i\n", rc); 1142 break;
1076 final = 1; 1143 default:
1077 } 1144 if (rc > 0) {
1078 break; 1145 DBF_EVENT(6, "xunknownrc\n");
1079 case TAPE_IO_STOP: 1146 PRINT_ERR("Invalid return code from discipline "
1080 __tape_halt_io(device, request); 1147 "interrupt function.\n");
1081 break; 1148 __tape_end_request(device, request, -EIO);
1082 default: 1149 } else {
1083 if (rc > 0) { 1150 __tape_end_request(device, request, rc);
1084 DBF_EVENT(6, "xunknownrc\n"); 1151 }
1085 PRINT_ERR("Invalid return code from discipline " 1152 break;
1086 "interrupt function.\n");
1087 rc = -EIO;
1088 }
1089 final = 1;
1090 break;
1091 }
1092 if (final) {
1093 /* May be an unsolicited irq */
1094 if(request != NULL) {
1095 /* Set ending status. */
1096 request->rc = rc;
1097 request->status = TAPE_REQUEST_DONE;
1098 __tape_remove_request(device, request);
1099 } else {
1100 __tape_do_io_list(device);
1101 }
1102 } 1153 }
1103} 1154}
1104 1155
@@ -1191,7 +1242,7 @@ tape_init (void)
1191#ifdef DBF_LIKE_HELL 1242#ifdef DBF_LIKE_HELL
1192 debug_set_level(TAPE_DBF_AREA, 6); 1243 debug_set_level(TAPE_DBF_AREA, 6);
1193#endif 1244#endif
1194 DBF_EVENT(3, "tape init: ($Revision: 1.51 $)\n"); 1245 DBF_EVENT(3, "tape init: ($Revision: 1.54 $)\n");
1195 tape_proc_init(); 1246 tape_proc_init();
1196 tapechar_init (); 1247 tapechar_init ();
1197 tapeblock_init (); 1248 tapeblock_init ();
@@ -1216,7 +1267,7 @@ tape_exit(void)
1216MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and " 1267MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and "
1217 "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)"); 1268 "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)");
1218MODULE_DESCRIPTION("Linux on zSeries channel attached " 1269MODULE_DESCRIPTION("Linux on zSeries channel attached "
1219 "tape device driver ($Revision: 1.51 $)"); 1270 "tape device driver ($Revision: 1.54 $)");
1220MODULE_LICENSE("GPL"); 1271MODULE_LICENSE("GPL");
1221 1272
1222module_init(tape_init); 1273module_init(tape_init);
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 7f11a608a633..8990d8076e7d 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -115,9 +115,9 @@ vmcp_write(struct file *file, const char __user * buff, size_t count,
115 return -ENOMEM; 115 return -ENOMEM;
116 } 116 }
117 debug_text_event(vmcp_debug, 1, cmd); 117 debug_text_event(vmcp_debug, 1, cmd);
118 session->resp_size = cpcmd(cmd, session->response, 118 session->resp_size = __cpcmd(cmd, session->response,
119 session->bufsize, 119 session->bufsize,
120 &session->resp_code); 120 &session->resp_code);
121 up(&session->mutex); 121 up(&session->mutex);
122 kfree(cmd); 122 kfree(cmd);
123 *ppos = 0; /* reset the file pointer after a command */ 123 *ppos = 0; /* reset the file pointer after a command */
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c
index 22cf4fec8da9..5473c23fcb52 100644
--- a/drivers/s390/char/vmwatchdog.c
+++ b/drivers/s390/char/vmwatchdog.c
@@ -23,11 +23,7 @@
23static char vmwdt_cmd[MAX_CMDLEN] = "IPL"; 23static char vmwdt_cmd[MAX_CMDLEN] = "IPL";
24static int vmwdt_conceal; 24static int vmwdt_conceal;
25 25
26#ifdef CONFIG_WATCHDOG_NOWAYOUT 26static int vmwdt_nowayout = WATCHDOG_NOWAYOUT;
27static int vmwdt_nowayout = 1;
28#else
29static int vmwdt_nowayout = 0;
30#endif
31 27
32MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
33MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>"); 29MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index b86f94ecd874..fa3c23b80e3a 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/s390/cio/chsc.c 2 * drivers/s390/cio/chsc.c
3 * S/390 common I/O routines -- channel subsystem call 3 * S/390 common I/O routines -- channel subsystem call
4 * $Revision: 1.119 $ 4 * $Revision: 1.120 $
5 * 5 *
6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, 6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
7 * IBM Corporation 7 * IBM Corporation
@@ -412,11 +412,7 @@ s390_process_res_acc (u8 chpid, __u16 fla, u32 fla_mask)
412 if (chp_mask == 0) { 412 if (chp_mask == 0) {
413 413
414 spin_unlock_irq(&sch->lock); 414 spin_unlock_irq(&sch->lock);
415 415 continue;
416 if (fla_mask != 0)
417 break;
418 else
419 continue;
420 } 416 }
421 old_lpm = sch->lpm; 417 old_lpm = sch->lpm;
422 sch->lpm = ((sch->schib.pmcw.pim & 418 sch->lpm = ((sch->schib.pmcw.pim &
@@ -430,7 +426,7 @@ s390_process_res_acc (u8 chpid, __u16 fla, u32 fla_mask)
430 426
431 spin_unlock_irq(&sch->lock); 427 spin_unlock_irq(&sch->lock);
432 put_device(&sch->dev); 428 put_device(&sch->dev);
433 if (fla_mask != 0) 429 if (fla_mask == 0xffff)
434 break; 430 break;
435 } 431 }
436 return rc; 432 return rc;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 9b7f6f548b1d..ee7a05e0c3ba 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -235,6 +235,9 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
235 sch->schib.pmcw.pam & 235 sch->schib.pmcw.pam &
236 sch->schib.pmcw.pom & 236 sch->schib.pmcw.pom &
237 sch->opm; 237 sch->opm;
238 /* Check since device may again have become not operational. */
239 if (!sch->schib.pmcw.dnv)
240 state = DEV_STATE_NOT_OPER;
238 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) 241 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID)
239 /* Force reprobe on all chpids. */ 242 /* Force reprobe on all chpids. */
240 old_lpm = 0; 243 old_lpm = 0;
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c
index 4ab2e0d95009..12a24d4331a2 100644
--- a/drivers/s390/cio/device_status.c
+++ b/drivers/s390/cio/device_status.c
@@ -39,15 +39,14 @@ ccw_device_msg_control_check(struct ccw_device *cdev, struct irb *irb)
39 " ... device %04X on subchannel %04X, dev_stat " 39 " ... device %04X on subchannel %04X, dev_stat "
40 ": %02X sch_stat : %02X\n", 40 ": %02X sch_stat : %02X\n",
41 cdev->private->devno, cdev->private->irq, 41 cdev->private->devno, cdev->private->irq,
42 cdev->private->irb.scsw.dstat, 42 irb->scsw.dstat, irb->scsw.cstat);
43 cdev->private->irb.scsw.cstat);
44 43
45 if (irb->scsw.cc != 3) { 44 if (irb->scsw.cc != 3) {
46 char dbf_text[15]; 45 char dbf_text[15];
47 46
48 sprintf(dbf_text, "chk%x", cdev->private->irq); 47 sprintf(dbf_text, "chk%x", cdev->private->irq);
49 CIO_TRACE_EVENT(0, dbf_text); 48 CIO_TRACE_EVENT(0, dbf_text);
50 CIO_HEX_EVENT(0, &cdev->private->irb, sizeof (struct irb)); 49 CIO_HEX_EVENT(0, irb, sizeof (struct irb));
51 } 50 }
52} 51}
53 52
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 82194c4eadfb..d36258d6665f 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -432,7 +432,7 @@ tiqdio_clear_global_summary(void)
432 432
433/************************* OUTBOUND ROUTINES *******************************/ 433/************************* OUTBOUND ROUTINES *******************************/
434 434
435inline static int 435static inline int
436qdio_get_outbound_buffer_frontier(struct qdio_q *q) 436qdio_get_outbound_buffer_frontier(struct qdio_q *q)
437{ 437{
438 int f,f_mod_no; 438 int f,f_mod_no;
@@ -510,7 +510,7 @@ out:
510} 510}
511 511
512/* all buffers are processed */ 512/* all buffers are processed */
513inline static int 513static inline int
514qdio_is_outbound_q_done(struct qdio_q *q) 514qdio_is_outbound_q_done(struct qdio_q *q)
515{ 515{
516 int no_used; 516 int no_used;
@@ -532,7 +532,7 @@ qdio_is_outbound_q_done(struct qdio_q *q)
532 return (no_used==0); 532 return (no_used==0);
533} 533}
534 534
535inline static int 535static inline int
536qdio_has_outbound_q_moved(struct qdio_q *q) 536qdio_has_outbound_q_moved(struct qdio_q *q)
537{ 537{
538 int i; 538 int i;
@@ -552,7 +552,7 @@ qdio_has_outbound_q_moved(struct qdio_q *q)
552 } 552 }
553} 553}
554 554
555inline static void 555static inline void
556qdio_kick_outbound_q(struct qdio_q *q) 556qdio_kick_outbound_q(struct qdio_q *q)
557{ 557{
558 int result; 558 int result;
@@ -641,7 +641,7 @@ qdio_kick_outbound_q(struct qdio_q *q)
641 } 641 }
642} 642}
643 643
644inline static void 644static inline void
645qdio_kick_outbound_handler(struct qdio_q *q) 645qdio_kick_outbound_handler(struct qdio_q *q)
646{ 646{
647 int start, end, real_end, count; 647 int start, end, real_end, count;
@@ -740,7 +740,7 @@ qdio_outbound_processing(struct qdio_q *q)
740/************************* INBOUND ROUTINES *******************************/ 740/************************* INBOUND ROUTINES *******************************/
741 741
742 742
743inline static int 743static inline int
744qdio_get_inbound_buffer_frontier(struct qdio_q *q) 744qdio_get_inbound_buffer_frontier(struct qdio_q *q)
745{ 745{
746 int f,f_mod_no; 746 int f,f_mod_no;
@@ -865,7 +865,7 @@ out:
865 return q->first_to_check; 865 return q->first_to_check;
866} 866}
867 867
868inline static int 868static inline int
869qdio_has_inbound_q_moved(struct qdio_q *q) 869qdio_has_inbound_q_moved(struct qdio_q *q)
870{ 870{
871 int i; 871 int i;
@@ -898,7 +898,7 @@ qdio_has_inbound_q_moved(struct qdio_q *q)
898} 898}
899 899
900/* means, no more buffers to be filled */ 900/* means, no more buffers to be filled */
901inline static int 901static inline int
902tiqdio_is_inbound_q_done(struct qdio_q *q) 902tiqdio_is_inbound_q_done(struct qdio_q *q)
903{ 903{
904 int no_used; 904 int no_used;
@@ -951,7 +951,7 @@ tiqdio_is_inbound_q_done(struct qdio_q *q)
951 return 0; 951 return 0;
952} 952}
953 953
954inline static int 954static inline int
955qdio_is_inbound_q_done(struct qdio_q *q) 955qdio_is_inbound_q_done(struct qdio_q *q)
956{ 956{
957 int no_used; 957 int no_used;
@@ -1010,7 +1010,7 @@ qdio_is_inbound_q_done(struct qdio_q *q)
1010 } 1010 }
1011} 1011}
1012 1012
1013inline static void 1013static inline void
1014qdio_kick_inbound_handler(struct qdio_q *q) 1014qdio_kick_inbound_handler(struct qdio_q *q)
1015{ 1015{
1016 int count, start, end, real_end, i; 1016 int count, start, end, real_end, i;
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 008e0a5d2eb3..3a0285669adf 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -824,7 +824,7 @@ extern struct list_head qeth_notify_list;
824 824
825#define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "") 825#define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "")
826 826
827inline static __u8 827static inline __u8
828qeth_get_ipa_adp_type(enum qeth_link_types link_type) 828qeth_get_ipa_adp_type(enum qeth_link_types link_type)
829{ 829{
830 switch (link_type) { 830 switch (link_type) {
@@ -835,7 +835,7 @@ qeth_get_ipa_adp_type(enum qeth_link_types link_type)
835 } 835 }
836} 836}
837 837
838inline static int 838static inline int
839qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size) 839qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size)
840{ 840{
841 struct sk_buff *new_skb = NULL; 841 struct sk_buff *new_skb = NULL;
@@ -852,6 +852,7 @@ qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size)
852 } 852 }
853 return 0; 853 return 0;
854} 854}
855
855static inline struct sk_buff * 856static inline struct sk_buff *
856qeth_pskb_unshare(struct sk_buff *skb, int pri) 857qeth_pskb_unshare(struct sk_buff *skb, int pri)
857{ 858{
@@ -863,8 +864,7 @@ qeth_pskb_unshare(struct sk_buff *skb, int pri)
863 return nskb; 864 return nskb;
864} 865}
865 866
866 867static inline void *
867inline static void *
868qeth_push_skb(struct qeth_card *card, struct sk_buff **skb, int size) 868qeth_push_skb(struct qeth_card *card, struct sk_buff **skb, int size)
869{ 869{
870 void *hdr; 870 void *hdr;
@@ -887,7 +887,7 @@ qeth_push_skb(struct qeth_card *card, struct sk_buff **skb, int size)
887} 887}
888 888
889 889
890inline static int 890static inline int
891qeth_get_hlen(__u8 link_type) 891qeth_get_hlen(__u8 link_type)
892{ 892{
893#ifdef CONFIG_QETH_IPV6 893#ifdef CONFIG_QETH_IPV6
@@ -911,7 +911,7 @@ qeth_get_hlen(__u8 link_type)
911#endif /* CONFIG_QETH_IPV6 */ 911#endif /* CONFIG_QETH_IPV6 */
912} 912}
913 913
914inline static unsigned short 914static inline unsigned short
915qeth_get_netdev_flags(struct qeth_card *card) 915qeth_get_netdev_flags(struct qeth_card *card)
916{ 916{
917 if (card->options.layer2) 917 if (card->options.layer2)
@@ -929,7 +929,7 @@ qeth_get_netdev_flags(struct qeth_card *card)
929 } 929 }
930} 930}
931 931
932inline static int 932static inline int
933qeth_get_initial_mtu_for_card(struct qeth_card * card) 933qeth_get_initial_mtu_for_card(struct qeth_card * card)
934{ 934{
935 switch (card->info.type) { 935 switch (card->info.type) {
@@ -950,7 +950,7 @@ qeth_get_initial_mtu_for_card(struct qeth_card * card)
950 } 950 }
951} 951}
952 952
953inline static int 953static inline int
954qeth_get_max_mtu_for_card(int cardtype) 954qeth_get_max_mtu_for_card(int cardtype)
955{ 955{
956 switch (cardtype) { 956 switch (cardtype) {
@@ -965,7 +965,7 @@ qeth_get_max_mtu_for_card(int cardtype)
965 } 965 }
966} 966}
967 967
968inline static int 968static inline int
969qeth_get_mtu_out_of_mpc(int cardtype) 969qeth_get_mtu_out_of_mpc(int cardtype)
970{ 970{
971 switch (cardtype) { 971 switch (cardtype) {
@@ -976,7 +976,7 @@ qeth_get_mtu_out_of_mpc(int cardtype)
976 } 976 }
977} 977}
978 978
979inline static int 979static inline int
980qeth_get_mtu_outof_framesize(int framesize) 980qeth_get_mtu_outof_framesize(int framesize)
981{ 981{
982 switch (framesize) { 982 switch (framesize) {
@@ -993,7 +993,7 @@ qeth_get_mtu_outof_framesize(int framesize)
993 } 993 }
994} 994}
995 995
996inline static int 996static inline int
997qeth_mtu_is_valid(struct qeth_card * card, int mtu) 997qeth_mtu_is_valid(struct qeth_card * card, int mtu)
998{ 998{
999 switch (card->info.type) { 999 switch (card->info.type) {
@@ -1008,7 +1008,7 @@ qeth_mtu_is_valid(struct qeth_card * card, int mtu)
1008 } 1008 }
1009} 1009}
1010 1010
1011inline static int 1011static inline int
1012qeth_get_arphdr_type(int cardtype, int linktype) 1012qeth_get_arphdr_type(int cardtype, int linktype)
1013{ 1013{
1014 switch (cardtype) { 1014 switch (cardtype) {
@@ -1027,7 +1027,7 @@ qeth_get_arphdr_type(int cardtype, int linktype)
1027} 1027}
1028 1028
1029#ifdef CONFIG_QETH_PERF_STATS 1029#ifdef CONFIG_QETH_PERF_STATS
1030inline static int 1030static inline int
1031qeth_get_micros(void) 1031qeth_get_micros(void)
1032{ 1032{
1033 return (int) (get_clock() >> 12); 1033 return (int) (get_clock() >> 12);
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 8f4d2999af8e..79c74f3a11f5 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -8120,20 +8120,22 @@ static struct notifier_block qeth_ip6_notifier = {
8120#endif 8120#endif
8121 8121
8122static int 8122static int
8123qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) 8123__qeth_reboot_event_card(struct device *dev, void *data)
8124{ 8124{
8125
8126 struct device *entry;
8127 struct qeth_card *card; 8125 struct qeth_card *card;
8128 8126
8129 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 8127 card = (struct qeth_card *) dev->driver_data;
8130 list_for_each_entry(entry, &qeth_ccwgroup_driver.driver.devices, 8128 qeth_clear_ip_list(card, 0, 0);
8131 driver_list) { 8129 qeth_qdio_clear_card(card, 0);
8132 card = (struct qeth_card *) entry->driver_data; 8130 return 0;
8133 qeth_clear_ip_list(card, 0, 0); 8131}
8134 qeth_qdio_clear_card(card, 0); 8132
8135 } 8133static int
8136 up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 8134qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr)
8135{
8136
8137 driver_for_each_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
8138 __qeth_reboot_event_card);
8137 return NOTIFY_DONE; 8139 return NOTIFY_DONE;
8138} 8140}
8139 8141
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c
index 04719196fd20..f2ccfea8fdb8 100644
--- a/drivers/s390/net/qeth_proc.c
+++ b/drivers/s390/net/qeth_proc.c
@@ -27,23 +27,33 @@ const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $";
27#define QETH_PROCFILE_NAME "qeth" 27#define QETH_PROCFILE_NAME "qeth"
28static struct proc_dir_entry *qeth_procfile; 28static struct proc_dir_entry *qeth_procfile;
29 29
30static int
31qeth_procfile_seq_match(struct device *dev, void *data)
32{
33 return 1;
34}
35
30static void * 36static void *
31qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) 37qeth_procfile_seq_start(struct seq_file *s, loff_t *offset)
32{ 38{
33 struct list_head *next_card = NULL; 39 struct device *dev;
34 int i = 0; 40 loff_t nr;
35 41
36 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 42 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
37 43
38 if (*offset == 0) 44 nr = *offset;
45 if (nr == 0)
39 return SEQ_START_TOKEN; 46 return SEQ_START_TOKEN;
40 47
41 /* get card at pos *offset */ 48 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL,
42 list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices) 49 NULL, qeth_procfile_seq_match);
43 if (++i == *offset)
44 return next_card;
45 50
46 return NULL; 51 /* get card at pos *offset */
52 nr = *offset;
53 while (nr-- > 1 && dev)
54 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
55 NULL, qeth_procfile_seq_match);
56 return (void *) dev;
47} 57}
48 58
49static void 59static void
@@ -55,23 +65,21 @@ qeth_procfile_seq_stop(struct seq_file *s, void* it)
55static void * 65static void *
56qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 66qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
57{ 67{
58 struct list_head *next_card = NULL; 68 struct device *prev, *next;
59 struct list_head *current_card;
60 69
61 if (it == SEQ_START_TOKEN) { 70 if (it == SEQ_START_TOKEN) {
62 next_card = qeth_ccwgroup_driver.driver.devices.next; 71 next = driver_find_device(&qeth_ccwgroup_driver.driver,
63 if (next_card->next == next_card) /* list empty */ 72 NULL, NULL, qeth_procfile_seq_match);
64 return NULL; 73 if (next)
65 (*offset)++; 74 (*offset)++;
66 } else { 75 return (void *) next;
67 current_card = (struct list_head *)it;
68 if (current_card->next == &qeth_ccwgroup_driver.driver.devices)
69 return NULL; /* end of list reached */
70 next_card = current_card->next;
71 (*offset)++;
72 } 76 }
73 77 prev = (struct device *) it;
74 return next_card; 78 next = driver_find_device(&qeth_ccwgroup_driver.driver,
79 prev, NULL, qeth_procfile_seq_match);
80 if (next)
81 (*offset)++;
82 return (void *) next;
75} 83}
76 84
77static inline const char * 85static inline const char *
@@ -126,7 +134,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it)
126 "-------------- ---- ------ ---------- ---- " 134 "-------------- ---- ------ ---------- ---- "
127 "---- ----- -----\n"); 135 "---- ----- -----\n");
128 } else { 136 } else {
129 device = list_entry(it, struct device, driver_list); 137 device = (struct device *) it;
130 card = device->driver_data; 138 card = device->driver_data;
131 seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", 139 seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ",
132 CARD_RDEV_ID(card), 140 CARD_RDEV_ID(card),
@@ -180,17 +188,20 @@ static struct proc_dir_entry *qeth_perf_procfile;
180static void * 188static void *
181qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) 189qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset)
182{ 190{
183 struct list_head *next_card = NULL; 191 struct device *dev = NULL;
184 int i = 0; 192 int nr;
185 193
186 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 194 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
187 /* get card at pos *offset */ 195 /* get card at pos *offset */
188 list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ 196 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
189 if (i == *offset) 197 qeth_procfile_seq_match);
190 return next_card; 198
191 i++; 199 /* get card at pos *offset */
192 } 200 nr = *offset;
193 return NULL; 201 while (nr-- > 1 && dev)
202 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
203 NULL, qeth_procfile_seq_match);
204 return (void *) dev;
194} 205}
195 206
196static void 207static void
@@ -202,12 +213,14 @@ qeth_perf_procfile_seq_stop(struct seq_file *s, void* it)
202static void * 213static void *
203qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 214qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
204{ 215{
205 struct list_head *current_card = (struct list_head *)it; 216 struct device *prev, *next;
206 217
207 if (current_card->next == &qeth_ccwgroup_driver.driver.devices) 218 prev = (struct device *) it;
208 return NULL; /* end of list reached */ 219 next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
209 (*offset)++; 220 NULL, qeth_procfile_seq_match);
210 return current_card->next; 221 if (next)
222 (*offset)++;
223 return (void *) next;
211} 224}
212 225
213static int 226static int
@@ -216,7 +229,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it)
216 struct device *device; 229 struct device *device;
217 struct qeth_card *card; 230 struct qeth_card *card;
218 231
219 device = list_entry(it, struct device, driver_list); 232 device = (struct device *) it;
220 card = device->driver_data; 233 card = device->driver_data;
221 seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", 234 seq_printf(s, "For card with devnos %s/%s/%s (%s):\n",
222 CARD_RDEV_ID(card), 235 CARD_RDEV_ID(card),
@@ -318,8 +331,8 @@ static struct proc_dir_entry *qeth_ipato_procfile;
318static void * 331static void *
319qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) 332qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset)
320{ 333{
321 struct list_head *next_card = NULL; 334 struct device *dev;
322 int i = 0; 335 loff_t nr;
323 336
324 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 337 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
325 /* TODO: finish this */ 338 /* TODO: finish this */
@@ -328,13 +341,16 @@ qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset)
328 * output driver settings then; 341 * output driver settings then;
329 * else output setting for respective card 342 * else output setting for respective card
330 */ 343 */
344
345 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
346 qeth_procfile_seq_match);
347
331 /* get card at pos *offset */ 348 /* get card at pos *offset */
332 list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ 349 nr = *offset;
333 if (i == *offset) 350 while (nr-- > 1 && dev)
334 return next_card; 351 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
335 i++; 352 NULL, qeth_procfile_seq_match);
336 } 353 return (void *) dev;
337 return NULL;
338} 354}
339 355
340static void 356static void
@@ -346,18 +362,14 @@ qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it)
346static void * 362static void *
347qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 363qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
348{ 364{
349 struct list_head *current_card = (struct list_head *)it; 365 struct device *prev, *next;
350 366
351 /* TODO: finish this */ 367 prev = (struct device *) it;
352 /* 368 next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
353 * maybe SEQ_SATRT_TOKEN can be returned for offset 0 369 NULL, qeth_procfile_seq_match);
354 * output driver settings then; 370 if (next)
355 * else output setting for respective card 371 (*offset)++;
356 */ 372 return (void *) next;
357 if (current_card->next == &qeth_ccwgroup_driver.driver.devices)
358 return NULL; /* end of list reached */
359 (*offset)++;
360 return current_card->next;
361} 373}
362 374
363static int 375static int
@@ -372,7 +384,7 @@ qeth_ipato_procfile_seq_show(struct seq_file *s, void *it)
372 * output driver settings then; 384 * output driver settings then;
373 * else output setting for respective card 385 * else output setting for respective card
374 */ 386 */
375 device = list_entry(it, struct device, driver_list); 387 device = (struct device *) it;
376 card = device->driver_data; 388 card = device->driver_data;
377 389
378 return 0; 390 return 0;
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index e56a43af0f62..a7782e7da42e 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -129,8 +129,6 @@ struct vfc_dev {
129 struct vfc_regs *phys_regs; 129 struct vfc_regs *phys_regs;
130 unsigned int control_reg; 130 unsigned int control_reg;
131 struct semaphore device_lock_sem; 131 struct semaphore device_lock_sem;
132 struct timer_list poll_timer;
133 wait_queue_head_t poll_wait;
134 int instance; 132 int instance;
135 int busy; 133 int busy;
136 unsigned long which_io; 134 unsigned long which_io;
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 86ce54130954..7a103698fa3c 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -137,7 +137,6 @@ int init_vfc_devstruct(struct vfc_dev *dev, int instance)
137 dev->instance=instance; 137 dev->instance=instance;
138 init_MUTEX(&dev->device_lock_sem); 138 init_MUTEX(&dev->device_lock_sem);
139 dev->control_reg=0; 139 dev->control_reg=0;
140 init_waitqueue_head(&dev->poll_wait);
141 dev->busy=0; 140 dev->busy=0;
142 return 0; 141 return 0;
143} 142}
diff --git a/drivers/sbus/char/vfc_i2c.c b/drivers/sbus/char/vfc_i2c.c
index 1faf1e75f71f..739cad9b19a1 100644
--- a/drivers/sbus/char/vfc_i2c.c
+++ b/drivers/sbus/char/vfc_i2c.c
@@ -79,25 +79,10 @@ int vfc_pcf8584_init(struct vfc_dev *dev)
79 return 0; 79 return 0;
80} 80}
81 81
82void vfc_i2c_delay_wakeup(struct vfc_dev *dev)
83{
84 /* Used to profile code and eliminate too many delays */
85 VFC_I2C_DEBUG_PRINTK(("vfc%d: Delaying\n", dev->instance));
86 wake_up(&dev->poll_wait);
87}
88
89void vfc_i2c_delay_no_busy(struct vfc_dev *dev, unsigned long usecs) 82void vfc_i2c_delay_no_busy(struct vfc_dev *dev, unsigned long usecs)
90{ 83{
91 DEFINE_WAIT(wait); 84 set_current_state(TASK_UNINTERRUPTIBLE);
92 init_timer(&dev->poll_timer); 85 schedule_timeout(usecs_to_jiffies(usecs));
93 dev->poll_timer.expires = jiffies + usecs_to_jiffies(usecs);
94 dev->poll_timer.data=(unsigned long)dev;
95 dev->poll_timer.function=(void *)(unsigned long)vfc_i2c_delay_wakeup;
96 add_timer(&dev->poll_timer);
97 prepare_to_wait(&dev->poll_wait, &wait, TASK_UNINTERRUPTIBLE);
98 schedule();
99 del_timer(&dev->poll_timer);
100 finish_wait(&dev->poll_wait, &wait);
101} 86}
102 87
103void inline vfc_i2c_delay(struct vfc_dev *dev) 88void inline vfc_i2c_delay(struct vfc_dev *dev)
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 96df148ed969..f1e8c4223ed1 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -424,7 +424,7 @@ config SCSI_IN2000
424source "drivers/scsi/megaraid/Kconfig.megaraid" 424source "drivers/scsi/megaraid/Kconfig.megaraid"
425 425
426config SCSI_SATA 426config SCSI_SATA
427 bool "Serial ATA (SATA) support" 427 tristate "Serial ATA (SATA) support"
428 depends on SCSI 428 depends on SCSI
429 help 429 help
430 This driver family supports Serial ATA host controllers 430 This driver family supports Serial ATA host controllers
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index b2002ba6e2aa..79ae73b23680 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -182,13 +182,13 @@ static int irq_probe(void);
182static void *bios_base; 182static void *bios_base;
183#endif 183#endif
184 184
185#if PORT_BASE 185#ifdef PORT_BASE
186static int port_base = PORT_BASE; 186static int port_base = PORT_BASE;
187#else 187#else
188static int port_base; 188static int port_base;
189#endif 189#endif
190 190
191#if IRQ_LEV 191#ifdef IRQ_LEV
192static int irq_level = IRQ_LEV; 192static int irq_level = IRQ_LEV;
193#else 193#else
194static int irq_level = -1; /* 0 is 'no irq', so use -1 for 'uninitialized' */ 194static int irq_level = -1; /* 0 is 'no irq', so use -1 for 'uninitialized' */
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 3a11a536c0da..4ab07861b457 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -15,11 +15,7 @@
15#define AAC_MAX_LUN (8) 15#define AAC_MAX_LUN (8)
16 16
17#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) 17#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
18/* 18#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512)
19 * max_sectors is an unsigned short, otherwise limit is 0x100000000 / 512
20 * Linux has starvation problems if we permit larger than 4MB I/O ...
21 */
22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192)
23 19
24/* 20/*
25 * These macros convert from physical channels to virtual channels 21 * These macros convert from physical channels to virtual channels
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c1a4f978fcba..562da90480a1 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -374,7 +374,8 @@ static int aac_slave_configure(struct scsi_device *sdev)
374 else 374 else
375 scsi_adjust_queue_depth(sdev, 0, 1); 375 scsi_adjust_queue_depth(sdev, 0, 1);
376 376
377 if (host->max_sectors < AAC_MAX_32BIT_SGBCOUNT) 377 if (!(((struct aac_dev *)host->hostdata)->adapter_info.options
378 & AAC_OPT_NEW_COMM))
378 blk_queue_max_segment_size(sdev->request_queue, 65536); 379 blk_queue_max_segment_size(sdev->request_queue, 65536);
379 380
380 return 0; 381 return 0;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 6466a184a141..329cb2331339 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1505,7 +1505,7 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
1505 memset(recovery_cmd, 0, sizeof(struct scsi_cmnd)); 1505 memset(recovery_cmd, 0, sizeof(struct scsi_cmnd));
1506 recovery_cmd->device = cmd->device; 1506 recovery_cmd->device = cmd->device;
1507 recovery_cmd->scsi_done = ahd_linux_dev_reset_complete; 1507 recovery_cmd->scsi_done = ahd_linux_dev_reset_complete;
1508#if AHD_DEBUG 1508#ifdef AHD_DEBUG
1509 if ((ahd_debug & AHD_SHOW_RECOVERY) != 0) 1509 if ((ahd_debug & AHD_SHOW_RECOVERY) != 0)
1510 printf("%s:%d:%d:%d: Device reset called for cmd %p\n", 1510 printf("%s:%d:%d:%d: Device reset called for cmd %p\n",
1511 ahd_name(ahd), cmd->device->channel, cmd->device->id, 1511 ahd_name(ahd), cmd->device->channel, cmd->device->id,
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
index 4c3bb7bb8420..703f6e44889d 100644
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -582,7 +582,7 @@ ahd_check_extport(struct ahd_softc *ahd)
582 } 582 }
583 } 583 }
584 584
585#if AHD_DEBUG 585#ifdef AHD_DEBUG
586 if (have_seeprom != 0 586 if (have_seeprom != 0
587 && (ahd_debug & AHD_DUMP_SEEPROM) != 0) { 587 && (ahd_debug & AHD_DUMP_SEEPROM) != 0) {
588 uint16_t *sc_data; 588 uint16_t *sc_data;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 116d0f51ca2c..687f19e9cf03 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1264,14 +1264,12 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1264 } 1264 }
1265 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { 1265 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
1266 case AHC_DEV_Q_BASIC: 1266 case AHC_DEV_Q_BASIC:
1267 scsi_adjust_queue_depth(sdev, 1267 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
1268 MSG_SIMPLE_TASK, 1268 scsi_activate_tcq(sdev, dev->openings + dev->active);
1269 dev->openings + dev->active);
1270 break; 1269 break;
1271 case AHC_DEV_Q_TAGGED: 1270 case AHC_DEV_Q_TAGGED:
1272 scsi_adjust_queue_depth(sdev, 1271 scsi_set_tag_type(sdev, MSG_ORDERED_TAG);
1273 MSG_ORDERED_TASK, 1272 scsi_activate_tcq(sdev, dev->openings + dev->active);
1274 dev->openings + dev->active);
1275 break; 1273 break;
1276 default: 1274 default:
1277 /* 1275 /*
@@ -1280,9 +1278,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1280 * serially on the controller/device. This should 1278 * serially on the controller/device. This should
1281 * remove some latency. 1279 * remove some latency.
1282 */ 1280 */
1283 scsi_adjust_queue_depth(sdev, 1281 scsi_deactivate_tcq(sdev, 2);
1284 /*NON-TAGGED*/0,
1285 /*queue depth*/2);
1286 break; 1282 break;
1287 } 1283 }
1288} 1284}
@@ -1635,9 +1631,9 @@ ahc_send_async(struct ahc_softc *ahc, char channel,
1635 spi_period(starget) = tinfo->curr.period; 1631 spi_period(starget) = tinfo->curr.period;
1636 spi_width(starget) = tinfo->curr.width; 1632 spi_width(starget) = tinfo->curr.width;
1637 spi_offset(starget) = tinfo->curr.offset; 1633 spi_offset(starget) = tinfo->curr.offset;
1638 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ; 1634 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0;
1639 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ; 1635 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0;
1640 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ; 1636 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0;
1641 spi_display_xfer_agreement(starget); 1637 spi_display_xfer_agreement(starget);
1642 break; 1638 break;
1643 } 1639 }
@@ -2429,12 +2425,14 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
2429 unsigned int ppr_options = tinfo->goal.ppr_options 2425 unsigned int ppr_options = tinfo->goal.ppr_options
2430 & ~MSG_EXT_PPR_DT_REQ; 2426 & ~MSG_EXT_PPR_DT_REQ;
2431 unsigned int period = tinfo->goal.period; 2427 unsigned int period = tinfo->goal.period;
2428 unsigned int width = tinfo->goal.width;
2432 unsigned long flags; 2429 unsigned long flags;
2433 struct ahc_syncrate *syncrate; 2430 struct ahc_syncrate *syncrate;
2434 2431
2435 if (dt) { 2432 if (dt) {
2436 period = 9; /* 12.5ns is the only period valid for DT */
2437 ppr_options |= MSG_EXT_PPR_DT_REQ; 2433 ppr_options |= MSG_EXT_PPR_DT_REQ;
2434 if (!width)
2435 ahc_linux_set_width(starget, 1);
2438 } else if (period == 9) 2436 } else if (period == 9)
2439 period = 10; /* if resetting DT, period must be >= 25ns */ 2437 period = 10; /* if resetting DT, period must be >= 25ns */
2440 2438
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c
index c34639481904..f936b691232f 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c
@@ -369,7 +369,7 @@ output_code()
369 369
370 fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x", 370 fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x",
371 cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n", 371 cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n",
372#if BYTE_ORDER == LITTLE_ENDIAN 372#ifdef __LITTLE_ENDIAN
373 cur_instr->format.bytes[0], 373 cur_instr->format.bytes[0],
374 cur_instr->format.bytes[1], 374 cur_instr->format.bytes[1],
375 cur_instr->format.bytes[2], 375 cur_instr->format.bytes[2],
@@ -613,7 +613,7 @@ output_listing(char *ifilename)
613 line++; 613 line++;
614 } 614 }
615 fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, 615 fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr,
616#if BYTE_ORDER == LITTLE_ENDIAN 616#ifdef __LITTLE_ENDIAN
617 cur_instr->format.bytes[0], 617 cur_instr->format.bytes[0],
618 cur_instr->format.bytes[1], 618 cur_instr->format.bytes[1],
619 cur_instr->format.bytes[2], 619 cur_instr->format.bytes[2],
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
index 3e80f07df49c..e64f802bbaaa 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
@@ -42,8 +42,10 @@
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
44 44
45#include <asm/byteorder.h>
46
45struct ins_format1 { 47struct ins_format1 {
46#if BYTE_ORDER == LITTLE_ENDIAN 48#ifdef __LITTLE_ENDIAN
47 uint32_t immediate : 8, 49 uint32_t immediate : 8,
48 source : 9, 50 source : 9,
49 destination : 9, 51 destination : 9,
@@ -61,7 +63,7 @@ struct ins_format1 {
61}; 63};
62 64
63struct ins_format2 { 65struct ins_format2 {
64#if BYTE_ORDER == LITTLE_ENDIAN 66#ifdef __LITTLE_ENDIAN
65 uint32_t shift_control : 8, 67 uint32_t shift_control : 8,
66 source : 9, 68 source : 9,
67 destination : 9, 69 destination : 9,
@@ -79,7 +81,7 @@ struct ins_format2 {
79}; 81};
80 82
81struct ins_format3 { 83struct ins_format3 {
82#if BYTE_ORDER == LITTLE_ENDIAN 84#ifdef __LITTLE_ENDIAN
83 uint32_t immediate : 8, 85 uint32_t immediate : 8,
84 source : 9, 86 source : 9,
85 address : 10, 87 address : 10,
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 3be546439252..a2cfade2c1c6 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -38,6 +38,7 @@ enum {
38 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 38 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
39 ICH5_PMR = 0x90, /* port mapping register */ 39 ICH5_PMR = 0x90, /* port mapping register */
40 ICH5_PCS = 0x92, /* port control and status */ 40 ICH5_PCS = 0x92, /* port control and status */
41 PIIX_SCC = 0x0A, /* sub-class code register */
41 42
42 PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ 43 PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */
43 PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ 44 PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */
@@ -62,6 +63,8 @@ enum {
62 ich6_sata_rm = 4, 63 ich6_sata_rm = 4,
63 ich7_sata = 5, 64 ich7_sata = 5,
64 esb2_sata = 6, 65 esb2_sata = 6,
66
67 PIIX_AHCI_DEVICE = 6,
65}; 68};
66 69
67static int piix_init_one (struct pci_dev *pdev, 70static int piix_init_one (struct pci_dev *pdev,
@@ -574,11 +577,11 @@ static int piix_disable_ahci(struct pci_dev *pdev)
574 addr = pci_resource_start(pdev, AHCI_PCI_BAR); 577 addr = pci_resource_start(pdev, AHCI_PCI_BAR);
575 if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) 578 if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR))
576 return 0; 579 return 0;
577 580
578 mmio = ioremap(addr, 64); 581 mmio = ioremap(addr, 64);
579 if (!mmio) 582 if (!mmio)
580 return -ENOMEM; 583 return -ENOMEM;
581 584
582 tmp = readl(mmio + AHCI_GLOBAL_CTL); 585 tmp = readl(mmio + AHCI_GLOBAL_CTL);
583 if (tmp & AHCI_ENABLE) { 586 if (tmp & AHCI_ENABLE) {
584 tmp &= ~AHCI_ENABLE; 587 tmp &= ~AHCI_ENABLE;
@@ -588,7 +591,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
588 if (tmp & AHCI_ENABLE) 591 if (tmp & AHCI_ENABLE)
589 rc = -EIO; 592 rc = -EIO;
590 } 593 }
591 594
592 iounmap(mmio); 595 iounmap(mmio);
593 return rc; 596 return rc;
594} 597}
@@ -626,9 +629,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
626 port_info[1] = NULL; 629 port_info[1] = NULL;
627 630
628 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { 631 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) {
629 int rc = piix_disable_ahci(pdev); 632 u8 tmp;
630 if (rc) 633 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
631 return rc; 634 if (tmp == PIIX_AHCI_DEVICE) {
635 int rc = piix_disable_ahci(pdev);
636 if (rc)
637 return rc;
638 }
632 } 639 }
633 640
634 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { 641 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) {
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index ae13c002f60d..929170dcd3cb 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -744,7 +744,7 @@ static void free_tag(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb)
744 744
745 745
746/* Find cmd in SRB list */ 746/* Find cmd in SRB list */
747inline static struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd, 747static inline struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd,
748 struct list_head *head) 748 struct list_head *head)
749{ 749{
750 struct ScsiReqBlk *i; 750 struct ScsiReqBlk *i;
diff --git a/drivers/scsi/dpt/dptsig.h b/drivers/scsi/dpt/dptsig.h
index 95a4cce6c892..4bf447792129 100644
--- a/drivers/scsi/dpt/dptsig.h
+++ b/drivers/scsi/dpt/dptsig.h
@@ -76,7 +76,7 @@ typedef unsigned long sigLONG;
76#endif /* aix */ 76#endif /* aix */
77#endif 77#endif
78/* For the Macintosh */ 78/* For the Macintosh */
79#if STRUCTALIGNMENTSUPPORTED 79#ifdef STRUCTALIGNMENTSUPPORTED
80#pragma options align=mac68k 80#pragma options align=mac68k
81#endif 81#endif
82 82
@@ -332,7 +332,7 @@ typedef struct dpt_sig {
332#endif /* aix */ 332#endif /* aix */
333#endif 333#endif
334/* For the Macintosh */ 334/* For the Macintosh */
335#if STRUCTALIGNMENTSUPPORTED 335#ifdef STRUCTALIGNMENTSUPPORTED
336#pragma options align=reset 336#pragma options align=reset
337#endif 337#endif
338 338
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index ab9de39bb50b..897743b23342 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -92,10 +92,6 @@
92 92
93#define DTC_PUBLIC_RELEASE 2 93#define DTC_PUBLIC_RELEASE 2
94 94
95/*#define DTCDEBUG 0x1*/
96#define DTCDEBUG_INIT 0x1
97#define DTCDEBUG_TRANSFER 0x2
98
99/* 95/*
100 * The DTC3180 & 3280 boards are memory mapped. 96 * The DTC3180 & 3280 boards are memory mapped.
101 * 97 *
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h
index ed73629eb2f9..277cd015ee4e 100644
--- a/drivers/scsi/dtc.h
+++ b/drivers/scsi/dtc.h
@@ -28,6 +28,10 @@
28#ifndef DTC3280_H 28#ifndef DTC3280_H
29#define DTC3280_H 29#define DTC3280_H
30 30
31#define DTCDEBUG 0
32#define DTCDEBUG_INIT 0x1
33#define DTCDEBUG_TRANSFER 0x2
34
31static int dtc_abort(Scsi_Cmnd *); 35static int dtc_abort(Scsi_Cmnd *);
32static int dtc_biosparam(struct scsi_device *, struct block_device *, 36static int dtc_biosparam(struct scsi_device *, struct block_device *,
33 sector_t, int*); 37 sector_t, int*);
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index aecf32dd0bde..3b2a5bf5c43e 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -570,7 +570,7 @@ static void do_pause(unsigned amount) /* Pause for amount*10 milliseconds */
570 mdelay(10*amount); 570 mdelay(10*amount);
571} 571}
572 572
573inline static void fdomain_make_bus_idle( void ) 573static inline void fdomain_make_bus_idle( void )
574{ 574{
575 outb(0, port_base + SCSI_Cntl); 575 outb(0, port_base + SCSI_Cntl);
576 outb(0, port_base + SCSI_Mode_Cntl); 576 outb(0, port_base + SCSI_Mode_Cntl);
diff --git a/drivers/scsi/ibmvscsi/srp.h b/drivers/scsi/ibmvscsi/srp.h
index 2ae5154fd89c..7d8e4c4accb9 100644
--- a/drivers/scsi/ibmvscsi/srp.h
+++ b/drivers/scsi/ibmvscsi/srp.h
@@ -35,7 +35,7 @@
35enum srp_types { 35enum srp_types {
36 SRP_LOGIN_REQ_TYPE = 0x00, 36 SRP_LOGIN_REQ_TYPE = 0x00,
37 SRP_LOGIN_RSP_TYPE = 0xC0, 37 SRP_LOGIN_RSP_TYPE = 0xC0,
38 SRP_LOGIN_REJ_TYPE = 0x80, 38 SRP_LOGIN_REJ_TYPE = 0xC2,
39 SRP_I_LOGOUT_TYPE = 0x03, 39 SRP_I_LOGOUT_TYPE = 0x03,
40 SRP_T_LOGOUT_TYPE = 0x80, 40 SRP_T_LOGOUT_TYPE = 0x80,
41 SRP_TSK_MGMT_TYPE = 0x01, 41 SRP_TSK_MGMT_TYPE = 0x01,
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 2094d4811d61..ea6f3c0e05d9 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -716,7 +716,7 @@ static int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb,
716 pCurHcb->HCS_SCSI_ID = i91unvramp->NVM_SCSIInfo[0].NVM_ChSCSIID; 716 pCurHcb->HCS_SCSI_ID = i91unvramp->NVM_SCSIInfo[0].NVM_ChSCSIID;
717 pCurHcb->HCS_IdMask = ~(1 << pCurHcb->HCS_SCSI_ID); 717 pCurHcb->HCS_IdMask = ~(1 << pCurHcb->HCS_SCSI_ID);
718 718
719#if CHK_PARITY 719#ifdef CHK_PARITY
720 /* Enable parity error response */ 720 /* Enable parity error response */
721 TUL_WR(pCurHcb->HCS_Base + TUL_PCMD, TUL_RD(pCurHcb->HCS_Base, TUL_PCMD) | 0x40); 721 TUL_WR(pCurHcb->HCS_Base + TUL_PCMD, TUL_RD(pCurHcb->HCS_Base, TUL_PCMD) | 0x40);
722#endif 722#endif
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 6dfcb4fbccdd..4cdd891781b1 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -133,10 +133,12 @@
133/* 6.10.00 - Remove 1G Addressing Limitations */ 133/* 6.10.00 - Remove 1G Addressing Limitations */
134/* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */ 134/* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */
135/* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */ 135/* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */
136/* 7.10.xx - Add highmem_io flag in SCSI Templete for 2.4 kernels */ 136/* 7.10.18 - Add highmem_io flag in SCSI Templete for 2.4 kernels */
137/* - Fix path/name for scsi_hosts.h include for 2.6 kernels */ 137/* - Fix path/name for scsi_hosts.h include for 2.6 kernels */
138/* - Fix sort order of 7k */ 138/* - Fix sort order of 7k */
139/* - Remove 3 unused "inline" functions */ 139/* - Remove 3 unused "inline" functions */
140/* 7.12.xx - Use STATIC functions whereever possible */
141/* - Clean up deprecated MODULE_PARM calls */
140/*****************************************************************************/ 142/*****************************************************************************/
141 143
142/* 144/*
@@ -207,8 +209,8 @@ module_param(ips, charp, 0);
207/* 209/*
208 * DRIVER_VER 210 * DRIVER_VER
209 */ 211 */
210#define IPS_VERSION_HIGH "7.10" 212#define IPS_VERSION_HIGH "7.12"
211#define IPS_VERSION_LOW ".18 " 213#define IPS_VERSION_LOW ".02 "
212 214
213#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) 215#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__)
214#warning "This driver has only been tested on the x86/ia64/x86_64 platforms" 216#warning "This driver has only been tested on the x86/ia64/x86_64 platforms"
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index 480e06f4d6ae..505e967013de 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -87,15 +87,14 @@
87 #define scsi_set_pci_device(sh,dev) (0) 87 #define scsi_set_pci_device(sh,dev) (0)
88 #endif 88 #endif
89 89
90 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 90 #ifndef IRQ_NONE
91 91 typedef void irqreturn_t;
92 #ifndef irqreturn_t
93 typedef void irqreturn_t;
94 #endif
95
96 #define IRQ_NONE 92 #define IRQ_NONE
97 #define IRQ_HANDLED 93 #define IRQ_HANDLED
98 #define IRQ_RETVAL(x) 94 #define IRQ_RETVAL(x)
95 #endif
96
97 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
99 #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT) 98 #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT)
100 #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT) 99 #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT)
101 #define IPS_ADD_HOST(shost,device) 100 #define IPS_ADD_HOST(shost,device)
@@ -123,6 +122,10 @@
123 #ifndef min 122 #ifndef min
124 #define min(x,y) ((x) < (y) ? x : y) 123 #define min(x,y) ((x) < (y) ? x : y)
125 #endif 124 #endif
125
126 #ifndef __iomem /* For clean compiles in earlier kernels without __iomem annotations */
127 #define __iomem
128 #endif
126 129
127 #define pci_dma_hi32(a) ((a >> 16) >> 16) 130 #define pci_dma_hi32(a) ((a >> 16) >> 16)
128 #define pci_dma_lo32(a) (a & 0xffffffff) 131 #define pci_dma_lo32(a) (a & 0xffffffff)
@@ -1206,13 +1209,13 @@ typedef struct {
1206 1209
1207#define IPS_VER_MAJOR 7 1210#define IPS_VER_MAJOR 7
1208#define IPS_VER_MAJOR_STRING "7" 1211#define IPS_VER_MAJOR_STRING "7"
1209#define IPS_VER_MINOR 10 1212#define IPS_VER_MINOR 12
1210#define IPS_VER_MINOR_STRING "10" 1213#define IPS_VER_MINOR_STRING "12"
1211#define IPS_VER_BUILD 18 1214#define IPS_VER_BUILD 02
1212#define IPS_VER_BUILD_STRING "18" 1215#define IPS_VER_BUILD_STRING "02"
1213#define IPS_VER_STRING "7.10.18" 1216#define IPS_VER_STRING "7.12.02"
1214#define IPS_RELEASE_ID 0x00020000 1217#define IPS_RELEASE_ID 0x00020000
1215#define IPS_BUILD_IDENT 731 1218#define IPS_BUILD_IDENT 761
1216#define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved." 1219#define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved."
1217#define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved." 1220#define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved."
1218#define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved." 1221#define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved."
@@ -1223,12 +1226,12 @@ typedef struct {
1223#define IPS_VER_SERVERAID2 "2.88.13" 1226#define IPS_VER_SERVERAID2 "2.88.13"
1224#define IPS_VER_NAVAJO "2.88.13" 1227#define IPS_VER_NAVAJO "2.88.13"
1225#define IPS_VER_SERVERAID3 "6.10.24" 1228#define IPS_VER_SERVERAID3 "6.10.24"
1226#define IPS_VER_SERVERAID4H "7.10.11" 1229#define IPS_VER_SERVERAID4H "7.12.02"
1227#define IPS_VER_SERVERAID4MLx "7.10.18" 1230#define IPS_VER_SERVERAID4MLx "7.12.02"
1228#define IPS_VER_SARASOTA "7.10.18" 1231#define IPS_VER_SARASOTA "7.12.02"
1229#define IPS_VER_MARCO "7.10.18" 1232#define IPS_VER_MARCO "7.12.02"
1230#define IPS_VER_SEBRING "7.10.18" 1233#define IPS_VER_SEBRING "7.12.02"
1231#define IPS_VER_KEYWEST "7.10.18" 1234#define IPS_VER_KEYWEST "7.12.02"
1232 1235
1233/* Compatability IDs for various adapters */ 1236/* Compatability IDs for various adapters */
1234#define IPS_COMPAT_UNKNOWN "" 1237#define IPS_COMPAT_UNKNOWN ""
diff --git a/drivers/scsi/lpfc/lpfc_compat.h b/drivers/scsi/lpfc/lpfc_compat.h
index 275ba34b3c9d..a11f1ae7b98e 100644
--- a/drivers/scsi/lpfc/lpfc_compat.h
+++ b/drivers/scsi/lpfc/lpfc_compat.h
@@ -30,8 +30,9 @@ memcpy_toio() and memcpy_fromio() can be used.
30However on a big-endian host, copy 4 bytes at a time, 30However on a big-endian host, copy 4 bytes at a time,
31using writel() and readl(). 31using writel() and readl().
32 *******************************************************************/ 32 *******************************************************************/
33#include <asm/byteorder.h>
33 34
34#if __BIG_ENDIAN 35#ifdef __BIG_ENDIAN
35 36
36static inline void 37static inline void
37lpfc_memcpy_to_slim(void __iomem *dest, void *src, unsigned int bytes) 38lpfc_memcpy_to_slim(void __iomem *dest, void *src, unsigned int bytes)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h
index d8fd2010ef41..0fd9ba14e1b5 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.h
+++ b/drivers/scsi/lpfc/lpfc_scsi.h
@@ -18,6 +18,8 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#include <asm/byteorder.h>
22
21struct lpfc_hba; 23struct lpfc_hba;
22 24
23#define list_remove_head(list, entry, type, member) \ 25#define list_remove_head(list, entry, type, member) \
@@ -81,7 +83,7 @@ struct fcp_cmnd {
81 /* # of bits to shift lun id to end up in right 83 /* # of bits to shift lun id to end up in right
82 * payload word, little endian = 8, big = 16. 84 * payload word, little endian = 8, big = 16.
83 */ 85 */
84#if __BIG_ENDIAN 86#ifdef __BIG_ENDIAN
85#define FC_LUN_SHIFT 16 87#define FC_LUN_SHIFT 16
86#define FC_ADDR_MODE_SHIFT 24 88#define FC_ADDR_MODE_SHIFT 24
87#else /* __LITTLE_ENDIAN */ 89#else /* __LITTLE_ENDIAN */
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index 363e0ebd4a39..72bc947e45b6 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -2,6 +2,7 @@
2#define PSEUDO_DMA 2#define PSEUDO_DMA
3#define FOO 3#define FOO
4#define UNSAFE /* Not unsafe for PAS16 -- use it */ 4#define UNSAFE /* Not unsafe for PAS16 -- use it */
5#define PDEBUG 0
5 6
6/* 7/*
7 * This driver adapted from Drew Eckhardt's Trantor T128 driver 8 * This driver adapted from Drew Eckhardt's Trantor T128 driver
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
index fccecf67423e..c1c1c687bcbd 100644
--- a/drivers/scsi/qla2xxx/Kconfig
+++ b/drivers/scsi/qla2xxx/Kconfig
@@ -2,12 +2,12 @@ config SCSI_QLA2XXX
2 tristate 2 tristate
3 default (SCSI && PCI) 3 default (SCSI && PCI)
4 depends on SCSI && PCI 4 depends on SCSI && PCI
5 select SCSI_FC_ATTRS
6 5
7config SCSI_QLA21XX 6config SCSI_QLA21XX
8 tristate "QLogic ISP2100 host adapter family support" 7 tristate "QLogic ISP2100 host adapter family support"
9 depends on SCSI_QLA2XXX 8 depends on SCSI_QLA2XXX
10 select SCSI_FC_ATTRS 9 select SCSI_FC_ATTRS
10 select FW_LOADER
11 ---help--- 11 ---help---
12 This driver supports the QLogic 21xx (ISP2100) host adapter family. 12 This driver supports the QLogic 21xx (ISP2100) host adapter family.
13 13
@@ -15,6 +15,7 @@ config SCSI_QLA22XX
15 tristate "QLogic ISP2200 host adapter family support" 15 tristate "QLogic ISP2200 host adapter family support"
16 depends on SCSI_QLA2XXX 16 depends on SCSI_QLA2XXX
17 select SCSI_FC_ATTRS 17 select SCSI_FC_ATTRS
18 select FW_LOADER
18 ---help--- 19 ---help---
19 This driver supports the QLogic 22xx (ISP2200) host adapter family. 20 This driver supports the QLogic 22xx (ISP2200) host adapter family.
20 21
@@ -22,6 +23,7 @@ config SCSI_QLA2300
22 tristate "QLogic ISP2300 host adapter family support" 23 tristate "QLogic ISP2300 host adapter family support"
23 depends on SCSI_QLA2XXX 24 depends on SCSI_QLA2XXX
24 select SCSI_FC_ATTRS 25 select SCSI_FC_ATTRS
26 select FW_LOADER
25 ---help--- 27 ---help---
26 This driver supports the QLogic 2300 (ISP2300 and ISP2312) host 28 This driver supports the QLogic 2300 (ISP2300 and ISP2312) host
27 adapter family. 29 adapter family.
@@ -30,6 +32,7 @@ config SCSI_QLA2322
30 tristate "QLogic ISP2322 host adapter family support" 32 tristate "QLogic ISP2322 host adapter family support"
31 depends on SCSI_QLA2XXX 33 depends on SCSI_QLA2XXX
32 select SCSI_FC_ATTRS 34 select SCSI_FC_ATTRS
35 select FW_LOADER
33 ---help--- 36 ---help---
34 This driver supports the QLogic 2322 (ISP2322) host adapter family. 37 This driver supports the QLogic 2322 (ISP2322) host adapter family.
35 38
@@ -37,6 +40,16 @@ config SCSI_QLA6312
37 tristate "QLogic ISP63xx host adapter family support" 40 tristate "QLogic ISP63xx host adapter family support"
38 depends on SCSI_QLA2XXX 41 depends on SCSI_QLA2XXX
39 select SCSI_FC_ATTRS 42 select SCSI_FC_ATTRS
43 select FW_LOADER
40 ---help--- 44 ---help---
41 This driver supports the QLogic 63xx (ISP6312 and ISP6322) host 45 This driver supports the QLogic 63xx (ISP6312 and ISP6322) host
42 adapter family. 46 adapter family.
47
48config SCSI_QLA24XX
49 tristate "QLogic ISP24xx host adapter family support"
50 depends on SCSI_QLA2XXX
51 select SCSI_FC_ATTRS
52 select FW_LOADER
53 ---help---
54 This driver supports the QLogic 24xx (ISP2422 and ISP2432) host
55 adapter family.
diff --git a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile
index 982b83604b41..b169687d08ff 100644
--- a/drivers/scsi/qla2xxx/Makefile
+++ b/drivers/scsi/qla2xxx/Makefile
@@ -1,6 +1,4 @@
1EXTRA_CFLAGS += -DUNIQUE_FW_NAME 1EXTRA_CFLAGS += -DUNIQUE_FW_NAME
2CONFIG_SCSI_QLA24XX=m
3EXTRA_CFLAGS += -DCONFIG_SCSI_QLA24XX -DCONFIG_SCSI_QLA24XX_MODULE
4 2
5qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ 3qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
6 qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o 4 qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index ad3a5b142468..2d3c4ac475f2 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -756,7 +756,8 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
756 * register it and tell the rest of the kernel 756 * register it and tell the rest of the kernel
757 * about it. 757 * about it.
758 */ 758 */
759 scsi_sysfs_add_sdev(sdev); 759 if (scsi_sysfs_add_sdev(sdev) != 0)
760 return SCSI_SCAN_NO_RESPONSE;
760 761
761 return SCSI_SCAN_LUN_PRESENT; 762 return SCSI_SCAN_LUN_PRESENT;
762} 763}
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 0291a8fb654d..0a7839db5752 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4149,12 +4149,10 @@ static int __init init_st(void)
4149 do_create_driverfs_files(); 4149 do_create_driverfs_files();
4150 return 0; 4150 return 0;
4151 } 4151 }
4152 if (st_sysfs_class)
4153 class_destroy(st_sysfs_class);
4154 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), 4152 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
4155
4156 ST_MAX_TAPE_ENTRIES); 4153 ST_MAX_TAPE_ENTRIES);
4157 } 4154 }
4155 class_destroy(st_sysfs_class);
4158 4156
4159 printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR); 4157 printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR);
4160 return 1; 4158 return 1;
@@ -4162,13 +4160,11 @@ static int __init init_st(void)
4162 4160
4163static void __exit exit_st(void) 4161static void __exit exit_st(void)
4164{ 4162{
4165 if (st_sysfs_class)
4166 class_destroy(st_sysfs_class);
4167 st_sysfs_class = NULL;
4168 do_remove_driverfs_files(); 4163 do_remove_driverfs_files();
4169 scsi_unregister_driver(&st_template.gendrv); 4164 scsi_unregister_driver(&st_template.gendrv);
4170 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), 4165 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
4171 ST_MAX_TAPE_ENTRIES); 4166 ST_MAX_TAPE_ENTRIES);
4167 class_destroy(st_sysfs_class);
4172 kfree(scsi_tapes); 4168 kfree(scsi_tapes);
4173 printk(KERN_INFO "st: Unloaded.\n"); 4169 printk(KERN_INFO "st: Unloaded.\n");
4174} 4170}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index c55c7a57afa0..3131a6bf7ab7 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -151,6 +151,16 @@
151 */ 151 */
152#define SYM_CONF_MIN_ASYNC (40) 152#define SYM_CONF_MIN_ASYNC (40)
153 153
154
155/*
156 * MEMORY ALLOCATOR.
157 */
158
159#define SYM_MEM_WARN 1 /* Warn on failed operations */
160
161#define SYM_MEM_PAGE_ORDER 0 /* 1 PAGE maximum */
162#define SYM_MEM_CLUSTER_SHIFT (PAGE_SHIFT+SYM_MEM_PAGE_ORDER)
163#define SYM_MEM_FREE_UNUSED /* Free unused pages immediately */
154/* 164/*
155 * Shortest memory chunk is (1<<SYM_MEM_SHIFT), currently 16. 165 * Shortest memory chunk is (1<<SYM_MEM_SHIFT), currently 16.
156 * Actual allocations happen as SYM_MEM_CLUSTER_SIZE sized. 166 * Actual allocations happen as SYM_MEM_CLUSTER_SIZE sized.
@@ -1192,12 +1202,6 @@ static inline void sym_setup_data_pointers(struct sym_hcb *np,
1192 * MEMORY ALLOCATOR. 1202 * MEMORY ALLOCATOR.
1193 */ 1203 */
1194 1204
1195#define SYM_MEM_PAGE_ORDER 0 /* 1 PAGE maximum */
1196#define SYM_MEM_CLUSTER_SHIFT (PAGE_SHIFT+SYM_MEM_PAGE_ORDER)
1197#define SYM_MEM_FREE_UNUSED /* Free unused pages immediately */
1198
1199#define SYM_MEM_WARN 1 /* Warn on failed operations */
1200
1201#define sym_get_mem_cluster() \ 1205#define sym_get_mem_cluster() \
1202 (void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER) 1206 (void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER)
1203#define sym_free_mem_cluster(p) \ 1207#define sym_free_mem_cluster(p) \
diff --git a/drivers/scsi/sym53c8xx_2/sym_nvram.c b/drivers/scsi/sym53c8xx_2/sym_nvram.c
index cd9140e158cf..994b7566bcac 100644
--- a/drivers/scsi/sym53c8xx_2/sym_nvram.c
+++ b/drivers/scsi/sym53c8xx_2/sym_nvram.c
@@ -367,7 +367,7 @@ static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ac
367 S24C16_write_ack(np, ack_data, gpreg, gpcntl); 367 S24C16_write_ack(np, ack_data, gpreg, gpcntl);
368} 368}
369 369
370#if SYM_CONF_NVRAM_WRITE_SUPPORT 370#ifdef SYM_CONF_NVRAM_WRITE_SUPPORT
371/* 371/*
372 * Write 'len' bytes starting at 'offset'. 372 * Write 'len' bytes starting at 'offset'.
373 */ 373 */
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h
index 9ad1d68827a7..596f3a32a1c6 100644
--- a/drivers/scsi/t128.h
+++ b/drivers/scsi/t128.h
@@ -43,6 +43,7 @@
43 43
44#define T128_PUBLIC_RELEASE 3 44#define T128_PUBLIC_RELEASE 3
45 45
46#define TDEBUG 0
46#define TDEBUG_INIT 0x1 47#define TDEBUG_INIT 0x1
47#define TDEBUG_TRANSFER 0x2 48#define TDEBUG_TRANSFER 0x2
48 49
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 356f5556759a..07f05e9d0955 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1029,6 +1029,8 @@ enum pci_board_num_t {
1029 pbn_b0_2_921600, 1029 pbn_b0_2_921600,
1030 pbn_b0_4_921600, 1030 pbn_b0_4_921600,
1031 1031
1032 pbn_b0_2_1130000,
1033
1032 pbn_b0_4_1152000, 1034 pbn_b0_4_1152000,
1033 1035
1034 pbn_b0_bt_1_115200, 1036 pbn_b0_bt_1_115200,
@@ -1163,6 +1165,14 @@ static struct pci_board pci_boards[] __devinitdata = {
1163 .base_baud = 921600, 1165 .base_baud = 921600,
1164 .uart_offset = 8, 1166 .uart_offset = 8,
1165 }, 1167 },
1168
1169 [pbn_b0_2_1130000] = {
1170 .flags = FL_BASE0,
1171 .num_ports = 2,
1172 .base_baud = 1130000,
1173 .uart_offset = 8,
1174 },
1175
1166 [pbn_b0_4_1152000] = { 1176 [pbn_b0_4_1152000] = {
1167 .flags = FL_BASE0, 1177 .flags = FL_BASE0,
1168 .num_ports = 4, 1178 .num_ports = 4,
@@ -1988,6 +1998,16 @@ static struct pci_device_id serial_pci_tbl[] = {
1988 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954, 1998 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1989 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL, 0, 0, 1999 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL, 0, 0,
1990 pbn_b0_4_1152000 }, 2000 pbn_b0_4_1152000 },
2001
2002 /*
2003 * The below card is a little controversial since it is the
2004 * subject of a PCI vendor/device ID clash. (See
2005 * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
2006 * For now just used the hex ID 0x950a.
2007 */
2008 { PCI_VENDOR_ID_OXSEMI, 0x950a,
2009 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2010 pbn_b0_2_1130000 },
1991 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954, 2011 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1992 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2012 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
1993 pbn_b0_4_115200 }, 2013 pbn_b0_4_115200 },
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 18c58fb73899..6b321e82cafb 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -394,7 +394,7 @@ static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
394} 394}
395 395
396static int __devinit 396static int __devinit
397serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) 397serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
398{ 398{
399 struct uart_port port; 399 struct uart_port port;
400 int ret, line, flags = dev_id->driver_data; 400 int ret, line, flags = dev_id->driver_data;
@@ -406,15 +406,23 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
406 } 406 }
407 407
408 memset(&port, 0, sizeof(struct uart_port)); 408 memset(&port, 0, sizeof(struct uart_port));
409 port.irq = pnp_irq(dev,0); 409 port.irq = pnp_irq(dev, 0);
410 port.iobase = pnp_port_start(dev, 0); 410 if (pnp_port_valid(dev, 0)) {
411 port.iobase = pnp_port_start(dev, 0);
412 port.iotype = UPIO_PORT;
413 } else if (pnp_mem_valid(dev, 0)) {
414 port.mapbase = pnp_mem_start(dev, 0);
415 port.iotype = UPIO_MEM;
416 port.flags = UPF_IOREMAP;
417 } else
418 return -ENODEV;
411 419
412#ifdef SERIAL_DEBUG_PNP 420#ifdef SERIAL_DEBUG_PNP
413 printk("Setup PNP port: port %x, irq %d, type %d\n", 421 printk("Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
414 port.iobase, port.irq, port.iotype); 422 port.iobase, port.mapbase, port.irq, port.iotype);
415#endif 423#endif
416 424
417 port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; 425 port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
418 port.uartclk = 1843200; 426 port.uartclk = 1843200;
419 port.dev = &dev->dev; 427 port.dev = &dev->dev;
420 428
@@ -426,7 +434,7 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
426 434
427} 435}
428 436
429static void __devexit serial_pnp_remove(struct pnp_dev * dev) 437static void __devexit serial_pnp_remove(struct pnp_dev *dev)
430{ 438{
431 long line = (long)pnp_get_drvdata(dev); 439 long line = (long)pnp_get_drvdata(dev);
432 if (line) 440 if (line)
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 7911912f50c7..8efbd6d1d6a4 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -185,7 +185,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
185 memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + 185 memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
186 L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); 186 L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
187 if (is_con) { 187 if (is_con) {
188 mem_addr = (u8 *) m8xx_cpm_hostalloc(memsz); 188 mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8));
189 dma_addr = 0; 189 dma_addr = 0;
190 } else 190 } else
191 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, 191 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr,
diff --git a/drivers/serial/jsm/jsm.h b/drivers/serial/jsm/jsm.h
index 5bf3c45521f4..18753193f59b 100644
--- a/drivers/serial/jsm/jsm.h
+++ b/drivers/serial/jsm/jsm.h
@@ -89,7 +89,7 @@ enum {
89#define WRITEBUFLEN ((4096) + 4) 89#define WRITEBUFLEN ((4096) + 4)
90#define MYFLIPLEN N_TTY_BUF_SIZE 90#define MYFLIPLEN N_TTY_BUF_SIZE
91 91
92#define JSM_VERSION "jsm: 1.1-1-INKERNEL" 92#define JSM_VERSION "jsm: 1.2-1-INKERNEL"
93#define JSM_PARTNUM "40002438_A-INKERNEL" 93#define JSM_PARTNUM "40002438_A-INKERNEL"
94 94
95struct jsm_board; 95struct jsm_board;
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index cc5d21300ed3..7e56c7824194 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -22,6 +22,7 @@
22 * Scott H Kilau <Scott_Kilau@digi.com> 22 * Scott H Kilau <Scott_Kilau@digi.com>
23 * Wendy Xiong <wendyx@us.ltcfwd.linux.ibm.com> 23 * Wendy Xiong <wendyx@us.ltcfwd.linux.ibm.com>
24 * 24 *
25 *
25 ***********************************************************************/ 26 ***********************************************************************/
26#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
27#include <linux/pci.h> 28#include <linux/pci.h>
@@ -42,7 +43,7 @@ struct uart_driver jsm_uart_driver = {
42 .owner = THIS_MODULE, 43 .owner = THIS_MODULE,
43 .driver_name = JSM_DRIVER_NAME, 44 .driver_name = JSM_DRIVER_NAME,
44 .dev_name = "ttyn", 45 .dev_name = "ttyn",
45 .major = 253, 46 .major = 0,
46 .minor = JSM_MINOR_START, 47 .minor = JSM_MINOR_START,
47 .nr = NR_PORTS, 48 .nr = NR_PORTS,
48}; 49};
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index 3a11a69feb44..6f22b42d9337 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -48,8 +48,9 @@ static inline void neo_pci_posting_flush(struct jsm_board *bd)
48 48
49static void neo_set_cts_flow_control(struct jsm_channel *ch) 49static void neo_set_cts_flow_control(struct jsm_channel *ch)
50{ 50{
51 u8 ier = readb(&ch->ch_neo_uart->ier); 51 u8 ier, efr;
52 u8 efr = readb(&ch->ch_neo_uart->efr); 52 ier = readb(&ch->ch_neo_uart->ier);
53 efr = readb(&ch->ch_neo_uart->efr);
53 54
54 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting CTSFLOW\n"); 55 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting CTSFLOW\n");
55 56
@@ -78,8 +79,9 @@ static void neo_set_cts_flow_control(struct jsm_channel *ch)
78 79
79static void neo_set_rts_flow_control(struct jsm_channel *ch) 80static void neo_set_rts_flow_control(struct jsm_channel *ch)
80{ 81{
81 u8 ier = readb(&ch->ch_neo_uart->ier); 82 u8 ier, efr;
82 u8 efr = readb(&ch->ch_neo_uart->efr); 83 ier = readb(&ch->ch_neo_uart->ier);
84 efr = readb(&ch->ch_neo_uart->efr);
83 85
84 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting RTSFLOW\n"); 86 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting RTSFLOW\n");
85 87
@@ -117,8 +119,9 @@ static void neo_set_rts_flow_control(struct jsm_channel *ch)
117 119
118static void neo_set_ixon_flow_control(struct jsm_channel *ch) 120static void neo_set_ixon_flow_control(struct jsm_channel *ch)
119{ 121{
120 u8 ier = readb(&ch->ch_neo_uart->ier); 122 u8 ier, efr;
121 u8 efr = readb(&ch->ch_neo_uart->efr); 123 ier = readb(&ch->ch_neo_uart->ier);
124 efr = readb(&ch->ch_neo_uart->efr);
122 125
123 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXON FLOW\n"); 126 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXON FLOW\n");
124 127
@@ -153,8 +156,9 @@ static void neo_set_ixon_flow_control(struct jsm_channel *ch)
153 156
154static void neo_set_ixoff_flow_control(struct jsm_channel *ch) 157static void neo_set_ixoff_flow_control(struct jsm_channel *ch)
155{ 158{
156 u8 ier = readb(&ch->ch_neo_uart->ier); 159 u8 ier, efr;
157 u8 efr = readb(&ch->ch_neo_uart->efr); 160 ier = readb(&ch->ch_neo_uart->ier);
161 efr = readb(&ch->ch_neo_uart->efr);
158 162
159 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXOFF FLOW\n"); 163 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXOFF FLOW\n");
160 164
@@ -190,8 +194,9 @@ static void neo_set_ixoff_flow_control(struct jsm_channel *ch)
190 194
191static void neo_set_no_input_flow_control(struct jsm_channel *ch) 195static void neo_set_no_input_flow_control(struct jsm_channel *ch)
192{ 196{
193 u8 ier = readb(&ch->ch_neo_uart->ier); 197 u8 ier, efr;
194 u8 efr = readb(&ch->ch_neo_uart->efr); 198 ier = readb(&ch->ch_neo_uart->ier);
199 efr = readb(&ch->ch_neo_uart->efr);
195 200
196 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Input FLOW\n"); 201 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Input FLOW\n");
197 202
@@ -228,8 +233,9 @@ static void neo_set_no_input_flow_control(struct jsm_channel *ch)
228 233
229static void neo_set_no_output_flow_control(struct jsm_channel *ch) 234static void neo_set_no_output_flow_control(struct jsm_channel *ch)
230{ 235{
231 u8 ier = readb(&ch->ch_neo_uart->ier); 236 u8 ier, efr;
232 u8 efr = readb(&ch->ch_neo_uart->efr); 237 ier = readb(&ch->ch_neo_uart->ier);
238 efr = readb(&ch->ch_neo_uart->efr);
233 239
234 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Output FLOW\n"); 240 jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Output FLOW\n");
235 241
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index de0136cc5938..1ae0b381c162 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -790,19 +790,19 @@ static struct pcmcia_device_id serial_ids[] = {
790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), 798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58),
799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), 803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), 804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), 806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), 807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562),
808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), 808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070),
@@ -840,7 +840,7 @@ static struct pcmcia_device_id serial_ids[] = {
840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), 840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed),
841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), 841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65),
842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), 842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6),
843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400", 0x816cc815, 0x23539b80), 843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb),
844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), 844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f),
845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), 845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f),
846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), 846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383),
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index cd329dd7fb86..85dacc92545a 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -20,6 +20,7 @@ config USB_ARCH_HAS_OHCI
20 default y if SA1111 20 default y if SA1111
21 default y if ARCH_OMAP 21 default y if ARCH_OMAP
22 default y if ARCH_LH7A404 22 default y if ARCH_LH7A404
23 default y if ARCH_S3C2410
23 default y if PXA27x 24 default y if PXA27x
24 # PPC: 25 # PPC:
25 default y if STB03xxx 26 default y if STB03xxx
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index adff5a77e31f..16ecad30e29c 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -980,6 +980,9 @@ static struct usb_device_id acm_ids[] = {
980 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ 980 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
981 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 981 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
982 }, 982 },
983 { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */
984 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
985 },
983 /* control interfaces with various AT-command sets */ 986 /* control interfaces with various AT-command sets */
984 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 987 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
985 USB_CDC_ACM_PROTO_AT_V25TER) }, 988 USB_CDC_ACM_PROTO_AT_V25TER) },
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 787c27a63c51..f86bf1454e21 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -569,8 +569,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
569 free_page((unsigned long)tbuf); 569 free_page((unsigned long)tbuf);
570 return -EINVAL; 570 return -EINVAL;
571 } 571 }
572 snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 572 snoop(&dev->dev, "control read: bRequest=%02x "
573 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); 573 "bRrequestType=%02x wValue=%04x "
574 "wIndex=%04x wLength=%04x\n",
575 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue,
576 ctrl.wIndex, ctrl.wLength);
574 577
575 usb_unlock_device(dev); 578 usb_unlock_device(dev);
576 i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, 579 i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
@@ -579,11 +582,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
579 if ((i > 0) && ctrl.wLength) { 582 if ((i > 0) && ctrl.wLength) {
580 if (usbfs_snoop) { 583 if (usbfs_snoop) {
581 dev_info(&dev->dev, "control read: data "); 584 dev_info(&dev->dev, "control read: data ");
582 for (j = 0; j < ctrl.wLength; ++j) 585 for (j = 0; j < i; ++j)
583 printk ("%02x ", (unsigned char)(tbuf)[j]); 586 printk ("%02x ", (unsigned char)(tbuf)[j]);
584 printk("\n"); 587 printk("\n");
585 } 588 }
586 if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { 589 if (copy_to_user(ctrl.data, tbuf, i)) {
587 free_page((unsigned long)tbuf); 590 free_page((unsigned long)tbuf);
588 return -EFAULT; 591 return -EFAULT;
589 } 592 }
@@ -595,8 +598,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
595 return -EFAULT; 598 return -EFAULT;
596 } 599 }
597 } 600 }
598 snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 601 snoop(&dev->dev, "control write: bRequest=%02x "
599 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); 602 "bRrequestType=%02x wValue=%04x "
603 "wIndex=%04x wLength=%04x\n",
604 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue,
605 ctrl.wIndex, ctrl.wLength);
600 if (usbfs_snoop) { 606 if (usbfs_snoop) {
601 dev_info(&dev->dev, "control write: data: "); 607 dev_info(&dev->dev, "control write: data: ");
602 for (j = 0; j < ctrl.wLength; ++j) 608 for (j = 0; j < ctrl.wLength; ++j)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8616356f55e8..79422a3b07bc 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount)
939 case USB_SPEED_HIGH: /* ISOC or INTR */ 939 case USB_SPEED_HIGH: /* ISOC or INTR */
940 // FIXME adjust for input vs output 940 // FIXME adjust for input vs output
941 if (isoc) 941 if (isoc)
942 tmp = HS_USECS (bytecount); 942 tmp = HS_NSECS_ISO (bytecount);
943 else 943 else
944 tmp = HS_USECS_ISO (bytecount); 944 tmp = HS_NSECS (bytecount);
945 return tmp; 945 return tmp;
946 default: 946 default:
947 pr_debug ("%s: bogus device speed!\n", usbcore_name); 947 pr_debug ("%s: bogus device speed!\n", usbcore_name);
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 67db4a999b93..28055f95645b 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb,
334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); 334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
335 335
336/* 336/*
337 * Ceiling microseconds (typical) for that many bytes at high speed 337 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed 338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
339 * to preallocate bandwidth) 339 * to preallocate bandwidth)
340 */ 340 */
341#define USB2_HOST_DELAY 5 /* nsec, guess */ 341#define USB2_HOST_DELAY 5 /* nsec, guess */
342#define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ 342#define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \
343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
344 + USB2_HOST_DELAY) 344 + USB2_HOST_DELAY)
345#define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ 345#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \
346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
347 + USB2_HOST_DELAY) 347 + USB2_HOST_DELAY)
348#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))
349#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))
348 350
349extern long usb_calc_bus_time (int speed, int is_input, 351extern long usb_calc_bus_time (int speed, int is_input,
350 int isoc, int bytecount); 352 int isoc, int bytecount);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index a428ef479bd7..88d1b376f67c 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
985 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { 985 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
986 struct usb_interface *interface; 986 struct usb_interface *interface;
987 987
988 /* remove this interface */ 988 /* remove this interface if it has been registered */
989 interface = dev->actconfig->interface[i]; 989 interface = dev->actconfig->interface[i];
990 if (!klist_node_attached(&interface->dev.knode_bus))
991 continue;
990 dev_dbg (&dev->dev, "unregistering interface %s\n", 992 dev_dbg (&dev->dev, "unregistering interface %s\n",
991 interface->dev.bus_id); 993 interface->dev.bus_id);
992 usb_remove_sysfs_intf_files(interface); 994 usb_remove_sysfs_intf_files(interface);
@@ -1439,7 +1441,7 @@ free_interfaces:
1439 } 1441 }
1440 } 1442 }
1441 1443
1442 return ret; 1444 return 0;
1443} 1445}
1444 1446
1445// synchronous request completion model 1447// synchronous request completion model
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 50cb01831075..b01efb6b36f6 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -527,7 +527,7 @@ show_periodic (struct class_device *class_dev, char *buf)
527 p.qh->period, 527 p.qh->period,
528 le32_to_cpup (&p.qh->hw_info2) 528 le32_to_cpup (&p.qh->hw_info2)
529 /* uframe masks */ 529 /* uframe masks */
530 & 0xffff, 530 & (QH_CMASK | QH_SMASK),
531 p.qh); 531 p.qh);
532 size -= temp; 532 size -= temp;
533 next += temp; 533 next += temp;
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index d74b2d68a50e..20df01a79b2e 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -222,7 +222,7 @@ __acquires(ehci->lock)
222 struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; 222 struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
223 223
224 /* S-mask in a QH means it's an interrupt urb */ 224 /* S-mask in a QH means it's an interrupt urb */
225 if ((qh->hw_info2 & __constant_cpu_to_le32 (0x00ff)) != 0) { 225 if ((qh->hw_info2 & __constant_cpu_to_le32 (QH_SMASK)) != 0) {
226 226
227 /* ... update hc-wide periodic stats (for usbfs) */ 227 /* ... update hc-wide periodic stats (for usbfs) */
228 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--; 228 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--;
@@ -428,7 +428,8 @@ halt:
428 /* should be rare for periodic transfers, 428 /* should be rare for periodic transfers,
429 * except maybe high bandwidth ... 429 * except maybe high bandwidth ...
430 */ 430 */
431 if (qh->period) { 431 if ((__constant_cpu_to_le32 (QH_SMASK)
432 & qh->hw_info2) != 0) {
432 intr_deschedule (ehci, qh); 433 intr_deschedule (ehci, qh);
433 (void) qh_schedule (ehci, qh); 434 (void) qh_schedule (ehci, qh);
434 } else 435 } else
@@ -657,8 +658,8 @@ qh_make (
657 * For control/bulk requests, the HC or TT handles these. 658 * For control/bulk requests, the HC or TT handles these.
658 */ 659 */
659 if (type == PIPE_INTERRUPT) { 660 if (type == PIPE_INTERRUPT) {
660 qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, 661 qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0,
661 hb_mult (maxp) * max_packet (maxp)); 662 hb_mult (maxp) * max_packet (maxp)));
662 qh->start = NO_FRAME; 663 qh->start = NO_FRAME;
663 664
664 if (urb->dev->speed == USB_SPEED_HIGH) { 665 if (urb->dev->speed == USB_SPEED_HIGH) {
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 9af4f64532a9..b56f25864ed6 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -301,7 +301,7 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
301 301
302 dev_dbg (&qh->dev->dev, 302 dev_dbg (&qh->dev->dev,
303 "link qh%d-%04x/%p start %d [%d/%d us]\n", 303 "link qh%d-%04x/%p start %d [%d/%d us]\n",
304 period, le32_to_cpup (&qh->hw_info2) & 0xffff, 304 period, le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
305 qh, qh->start, qh->usecs, qh->c_usecs); 305 qh, qh->start, qh->usecs, qh->c_usecs);
306 306
307 /* high bandwidth, or otherwise every microframe */ 307 /* high bandwidth, or otherwise every microframe */
@@ -385,7 +385,8 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
385 385
386 dev_dbg (&qh->dev->dev, 386 dev_dbg (&qh->dev->dev,
387 "unlink qh%d-%04x/%p start %d [%d/%d us]\n", 387 "unlink qh%d-%04x/%p start %d [%d/%d us]\n",
388 qh->period, le32_to_cpup (&qh->hw_info2) & 0xffff, 388 qh->period,
389 le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
389 qh, qh->start, qh->usecs, qh->c_usecs); 390 qh, qh->start, qh->usecs, qh->c_usecs);
390 391
391 /* qh->qh_next still "live" to HC */ 392 /* qh->qh_next still "live" to HC */
@@ -411,7 +412,7 @@ static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
411 * active high speed queues may need bigger delays... 412 * active high speed queues may need bigger delays...
412 */ 413 */
413 if (list_empty (&qh->qtd_list) 414 if (list_empty (&qh->qtd_list)
414 || (__constant_cpu_to_le32 (0x0ff << 8) 415 || (__constant_cpu_to_le32 (QH_CMASK)
415 & qh->hw_info2) != 0) 416 & qh->hw_info2) != 0)
416 wait = 2; 417 wait = 2;
417 else 418 else
@@ -533,7 +534,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
533 534
534 /* reuse the previous schedule slots, if we can */ 535 /* reuse the previous schedule slots, if we can */
535 if (frame < qh->period) { 536 if (frame < qh->period) {
536 uframe = ffs (le32_to_cpup (&qh->hw_info2) & 0x00ff); 537 uframe = ffs (le32_to_cpup (&qh->hw_info2) & QH_SMASK);
537 status = check_intr_schedule (ehci, frame, --uframe, 538 status = check_intr_schedule (ehci, frame, --uframe,
538 qh, &c_mask); 539 qh, &c_mask);
539 } else { 540 } else {
@@ -569,10 +570,10 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
569 qh->start = frame; 570 qh->start = frame;
570 571
571 /* reset S-frame and (maybe) C-frame masks */ 572 /* reset S-frame and (maybe) C-frame masks */
572 qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff); 573 qh->hw_info2 &= __constant_cpu_to_le32(~(QH_CMASK | QH_SMASK));
573 qh->hw_info2 |= qh->period 574 qh->hw_info2 |= qh->period
574 ? cpu_to_le32 (1 << uframe) 575 ? cpu_to_le32 (1 << uframe)
575 : __constant_cpu_to_le32 (0xff); 576 : __constant_cpu_to_le32 (QH_SMASK);
576 qh->hw_info2 |= c_mask; 577 qh->hw_info2 |= c_mask;
577 } else 578 } else
578 ehci_dbg (ehci, "reused qh %p schedule\n", qh); 579 ehci_dbg (ehci, "reused qh %p schedule\n", qh);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 4df498231752..a7542157534c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -385,6 +385,11 @@ struct ehci_qh {
385 __le32 hw_info1; /* see EHCI 3.6.2 */ 385 __le32 hw_info1; /* see EHCI 3.6.2 */
386#define QH_HEAD 0x00008000 386#define QH_HEAD 0x00008000
387 __le32 hw_info2; /* see EHCI 3.6.2 */ 387 __le32 hw_info2; /* see EHCI 3.6.2 */
388#define QH_SMASK 0x000000ff
389#define QH_CMASK 0x0000ff00
390#define QH_HUBADDR 0x007f0000
391#define QH_HUBPORT 0x3f800000
392#define QH_MULT 0xc0000000
388 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */ 393 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */
389 394
390 /* qtd overlay (hardware parts of a struct ehci_qtd) */ 395 /* qtd overlay (hardware parts of a struct ehci_qtd) */
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 50b1970fe6b6..76cb496c5836 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -229,9 +229,11 @@ static void preproc_atl_queue(struct isp116x *isp116x)
229 struct isp116x_ep *ep; 229 struct isp116x_ep *ep;
230 struct urb *urb; 230 struct urb *urb;
231 struct ptd *ptd; 231 struct ptd *ptd;
232 u16 toggle = 0, dir = PTD_DIR_SETUP, len; 232 u16 len;
233 233
234 for (ep = isp116x->atl_active; ep; ep = ep->active) { 234 for (ep = isp116x->atl_active; ep; ep = ep->active) {
235 u16 toggle = 0, dir = PTD_DIR_SETUP;
236
235 BUG_ON(list_empty(&ep->hep->urb_list)); 237 BUG_ON(list_empty(&ep->hep->urb_list));
236 urb = container_of(ep->hep->urb_list.next, 238 urb = container_of(ep->hep->urb_list.next,
237 struct urb, urb_list); 239 struct urb, urb_list);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 68decab280dd..56b43f2a0e52 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -887,6 +887,10 @@ MODULE_LICENSE ("GPL");
887#include "ohci-sa1111.c" 887#include "ohci-sa1111.c"
888#endif 888#endif
889 889
890#ifdef CONFIG_ARCH_S3C2410
891#include "ohci-s3c2410.c"
892#endif
893
890#ifdef CONFIG_ARCH_OMAP 894#ifdef CONFIG_ARCH_OMAP
891#include "ohci-omap.c" 895#include "ohci-omap.c"
892#endif 896#endif
@@ -909,6 +913,7 @@ MODULE_LICENSE ("GPL");
909 913
910#if !(defined(CONFIG_PCI) \ 914#if !(defined(CONFIG_PCI) \
911 || defined(CONFIG_SA1111) \ 915 || defined(CONFIG_SA1111) \
916 || defined(CONFIG_ARCH_S3C2410) \
912 || defined(CONFIG_ARCH_OMAP) \ 917 || defined(CONFIG_ARCH_OMAP) \
913 || defined (CONFIG_ARCH_LH7A404) \ 918 || defined (CONFIG_ARCH_LH7A404) \
914 || defined (CONFIG_PXA27x) \ 919 || defined (CONFIG_PXA27x) \
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
new file mode 100644
index 000000000000..e9401662503c
--- /dev/null
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -0,0 +1,496 @@
1/*
2 * OHCI HCD (Host Controller Driver) for USB.
3 *
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
6 * (C) Copyright 2002 Hewlett-Packard Company
7 *
8 * USB Bus Glue for Samsung S3C2410
9 *
10 * Written by Christopher Hoover <ch@hpl.hp.com>
11 * Based on fragments of previous driver by Rusell King et al.
12 *
13 * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
14 * by Ben Dooks, <ben@simtec.co.uk>
15 * Copyright (C) 2004 Simtec Electronics
16 *
17 * Thanks to basprog@mail.ru for updates to newer kernels
18 *
19 * This file is licenced under the GPL.
20*/
21
22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/hardware/clock.h>
25#include <asm/arch/usb-control.h>
26
27#define valid_port(idx) ((idx) == 1 || (idx) == 2)
28
29/* clock device associated with the hcd */
30
31static struct clk *clk;
32
33/* forward definitions */
34
35static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);
36
37/* conversion functions */
38
39struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
40{
41 return hcd->self.controller->platform_data;
42}
43
44static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
45{
46 struct s3c2410_hcd_info *info = dev->dev.platform_data;
47
48 dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
49 clk_enable(clk);
50
51 if (info != NULL) {
52 info->hcd = hcd;
53 info->report_oc = s3c2410_hcd_oc;
54
55 if (info->enable_oc != NULL) {
56 (info->enable_oc)(info, 1);
57 }
58 }
59}
60
61static void s3c2410_stop_hc(struct platform_device *dev)
62{
63 struct s3c2410_hcd_info *info = dev->dev.platform_data;
64
65 dev_dbg(&dev->dev, "s3c2410_stop_hc:\n");
66
67 if (info != NULL) {
68 info->report_oc = NULL;
69 info->hcd = NULL;
70
71 if (info->enable_oc != NULL) {
72 (info->enable_oc)(info, 0);
73 }
74 }
75
76 clk_disable(clk);
77}
78
79/* ohci_s3c2410_hub_status_data
80 *
81 * update the status data from the hub with anything that
82 * has been detected by our system
83*/
84
85static int
86ohci_s3c2410_hub_status_data (struct usb_hcd *hcd, char *buf)
87{
88 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
89 struct s3c2410_hcd_port *port;
90 int orig;
91 int portno;
92
93 orig = ohci_hub_status_data (hcd, buf);
94
95 if (info == NULL)
96 return orig;
97
98 port = &info->port[0];
99
100 /* mark any changed port as changed */
101
102 for (portno = 0; portno < 2; port++, portno++) {
103 if (port->oc_changed == 1 &&
104 port->flags & S3C_HCDFLG_USED) {
105 dev_dbg(hcd->self.controller,
106 "oc change on port %d\n", portno);
107
108 if (orig < 1)
109 orig = 1;
110
111 buf[0] |= 1<<(portno+1);
112 }
113 }
114
115 return orig;
116}
117
118/* s3c2410_usb_set_power
119 *
120 * configure the power on a port, by calling the platform device
121 * routine registered with the platform device
122*/
123
124static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info,
125 int port, int to)
126{
127 if (info == NULL)
128 return;
129
130 if (info->power_control != NULL) {
131 info->port[port-1].power = to;
132 (info->power_control)(port, to);
133 }
134}
135
136/* ohci_s3c2410_hub_control
137 *
138 * look at control requests to the hub, and see if we need
139 * to take any action or over-ride the results from the
140 * request.
141*/
142
143static int ohci_s3c2410_hub_control (
144 struct usb_hcd *hcd,
145 u16 typeReq,
146 u16 wValue,
147 u16 wIndex,
148 char *buf,
149 u16 wLength)
150{
151 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
152 struct usb_hub_descriptor *desc;
153 int ret = -EINVAL;
154 u32 *data = (u32 *)buf;
155
156 dev_dbg(hcd->self.controller,
157 "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
158 hcd, typeReq, wValue, wIndex, buf, wLength);
159
160 /* if we are only an humble host without any special capabilites
161 * process the request straight away and exit */
162
163 if (info == NULL) {
164 ret = ohci_hub_control(hcd, typeReq, wValue,
165 wIndex, buf, wLength);
166 goto out;
167 }
168
169 /* check the request to see if it needs handling */
170
171 switch (typeReq) {
172 case SetPortFeature:
173 if (wValue == USB_PORT_FEAT_POWER) {
174 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
175 s3c2410_usb_set_power(info, wIndex, 1);
176 goto out;
177 }
178 break;
179
180 case ClearPortFeature:
181 switch (wValue) {
182 case USB_PORT_FEAT_C_OVER_CURRENT:
183 dev_dbg(hcd->self.controller,
184 "ClearPortFeature: C_OVER_CURRENT\n");
185
186 if (valid_port(wIndex)) {
187 info->port[wIndex-1].oc_changed = 0;
188 info->port[wIndex-1].oc_status = 0;
189 }
190
191 goto out;
192
193 case USB_PORT_FEAT_OVER_CURRENT:
194 dev_dbg(hcd->self.controller,
195 "ClearPortFeature: OVER_CURRENT\n");
196
197 if (valid_port(wIndex)) {
198 info->port[wIndex-1].oc_status = 0;
199 }
200
201 goto out;
202
203 case USB_PORT_FEAT_POWER:
204 dev_dbg(hcd->self.controller,
205 "ClearPortFeature: POWER\n");
206
207 if (valid_port(wIndex)) {
208 s3c2410_usb_set_power(info, wIndex, 0);
209 return 0;
210 }
211 }
212 break;
213 }
214
215 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
216 if (ret)
217 goto out;
218
219 switch (typeReq) {
220 case GetHubDescriptor:
221
222 /* update the hub's descriptor */
223
224 desc = (struct usb_hub_descriptor *)buf;
225
226 if (info->power_control == NULL)
227 return ret;
228
229 dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
230 desc->wHubCharacteristics);
231
232 /* remove the old configurations for power-switching, and
233 * over-current protection, and insert our new configuration
234 */
235
236 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
237 desc->wHubCharacteristics |= cpu_to_le16(0x0001);
238
239 if (info->enable_oc) {
240 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
241 desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001);
242 }
243
244 dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
245 desc->wHubCharacteristics);
246
247 return ret;
248
249 case GetPortStatus:
250 /* check port status */
251
252 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
253
254 if (valid_port(wIndex)) {
255 if (info->port[wIndex-1].oc_changed) {
256 *data |= cpu_to_le32(RH_PS_OCIC);
257 }
258
259 if (info->port[wIndex-1].oc_status) {
260 *data |= cpu_to_le32(RH_PS_POCI);
261 }
262 }
263 }
264
265 out:
266 return ret;
267}
268
269/* s3c2410_hcd_oc
270 *
271 * handle an over-current report
272*/
273
274static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
275{
276 struct s3c2410_hcd_port *port;
277 struct usb_hcd *hcd;
278 unsigned long flags;
279 int portno;
280
281 if (info == NULL)
282 return;
283
284 port = &info->port[0];
285 hcd = info->hcd;
286
287 local_irq_save(flags);
288
289 for (portno = 0; portno < 2; port++, portno++) {
290 if (port_oc & (1<<portno) &&
291 port->flags & S3C_HCDFLG_USED) {
292 port->oc_status = 1;
293 port->oc_changed = 1;
294
295 /* ok, once over-current is detected,
296 the port needs to be powered down */
297 s3c2410_usb_set_power(info, portno+1, 0);
298 }
299 }
300
301 local_irq_restore(flags);
302}
303
304/* may be called without controller electrically present */
305/* may be called with controller, bus, and devices active */
306
307/*
308 * usb_hcd_s3c2410_remove - shutdown processing for HCD
309 * @dev: USB Host Controller being removed
310 * Context: !in_interrupt()
311 *
312 * Reverses the effect of usb_hcd_3c2410_probe(), first invoking
313 * the HCD's stop() method. It is always called from a thread
314 * context, normally "rmmod", "apmd", or something similar.
315 *
316*/
317
318void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
319{
320 usb_remove_hcd(hcd);
321 s3c2410_stop_hc(dev);
322 iounmap(hcd->regs);
323 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
324 usb_put_hcd(hcd);
325}
326
327/**
328 * usb_hcd_s3c2410_probe - initialize S3C2410-based HCDs
329 * Context: !in_interrupt()
330 *
331 * Allocates basic resources for this USB host controller, and
332 * then invokes the start() method for the HCD associated with it
333 * through the hotplug entry's driver_data.
334 *
335 */
336int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
337 struct platform_device *dev)
338{
339 struct usb_hcd *hcd = NULL;
340 int retval;
341
342 s3c2410_usb_set_power(dev->dev.platform_data, 0, 1);
343 s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
344
345 hcd = usb_create_hcd(driver, &dev->dev, "s3c24xx");
346 if (hcd == NULL)
347 return -ENOMEM;
348
349 hcd->rsrc_start = dev->resource[0].start;
350 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
351
352 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
353 dev_err(&dev->dev, "request_mem_region failed");
354 retval = -EBUSY;
355 goto err0;
356 }
357
358 clk = clk_get(NULL, "usb-host");
359 if (IS_ERR(clk)) {
360 dev_err(&dev->dev, "cannot get usb-host clock\n");
361 retval = -ENOENT;
362 goto err1;
363 }
364
365 clk_use(clk);
366 s3c2410_start_hc(dev, hcd);
367
368 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
369 if (!hcd->regs) {
370 dev_err(&dev->dev, "ioremap failed\n");
371 retval = -ENOMEM;
372 goto err2;
373 }
374
375 ohci_hcd_init(hcd_to_ohci(hcd));
376
377 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
378 if (retval != 0)
379 goto err2;
380
381 return 0;
382
383 err2:
384 s3c2410_stop_hc(dev);
385 iounmap(hcd->regs);
386 clk_unuse(clk);
387 clk_put(clk);
388
389 err1:
390 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
391
392 err0:
393 usb_put_hcd(hcd);
394 return retval;
395}
396
397/*-------------------------------------------------------------------------*/
398
399static int
400ohci_s3c2410_start (struct usb_hcd *hcd)
401{
402 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
403 int ret;
404
405 if ((ret = ohci_init(ohci)) < 0)
406 return ret;
407
408 if ((ret = ohci_run (ohci)) < 0) {
409 err ("can't start %s", hcd->self.bus_name);
410 ohci_stop (hcd);
411 return ret;
412 }
413
414 return 0;
415}
416
417
418static const struct hc_driver ohci_s3c2410_hc_driver = {
419 .description = hcd_name,
420 .product_desc = "S3C24XX OHCI",
421 .hcd_priv_size = sizeof(struct ohci_hcd),
422
423 /*
424 * generic hardware linkage
425 */
426 .irq = ohci_irq,
427 .flags = HCD_USB11 | HCD_MEMORY,
428
429 /*
430 * basic lifecycle operations
431 */
432 .start = ohci_s3c2410_start,
433 .stop = ohci_stop,
434
435 /*
436 * managing i/o requests and associated device resources
437 */
438 .urb_enqueue = ohci_urb_enqueue,
439 .urb_dequeue = ohci_urb_dequeue,
440 .endpoint_disable = ohci_endpoint_disable,
441
442 /*
443 * scheduling support
444 */
445 .get_frame_number = ohci_get_frame,
446
447 /*
448 * root hub support
449 */
450 .hub_status_data = ohci_s3c2410_hub_status_data,
451 .hub_control = ohci_s3c2410_hub_control,
452
453#if defined(CONFIG_USB_SUSPEND) && 0
454 .hub_suspend = ohci_hub_suspend,
455 .hub_resume = ohci_hub_resume,
456#endif
457};
458
459/* device driver */
460
461static int ohci_hcd_s3c2410_drv_probe(struct device *dev)
462{
463 struct platform_device *pdev = to_platform_device(dev);
464 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev);
465}
466
467static int ohci_hcd_s3c2410_drv_remove(struct device *dev)
468{
469 struct platform_device *pdev = to_platform_device(dev);
470 struct usb_hcd *hcd = dev_get_drvdata(dev);
471
472 usb_hcd_s3c2410_remove(hcd, pdev);
473 return 0;
474}
475
476static struct device_driver ohci_hcd_s3c2410_driver = {
477 .name = "s3c2410-ohci",
478 .bus = &platform_bus_type,
479 .probe = ohci_hcd_s3c2410_drv_probe,
480 .remove = ohci_hcd_s3c2410_drv_remove,
481 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */
482 /*.resume = ohci_hcd_s3c2410_drv_resume, */
483};
484
485static int __init ohci_hcd_s3c2410_init (void)
486{
487 return driver_register(&ohci_hcd_s3c2410_driver);
488}
489
490static void __exit ohci_hcd_s3c2410_cleanup (void)
491{
492 driver_unregister(&ohci_hcd_s3c2410_driver);
493}
494
495module_init (ohci_hcd_s3c2410_init);
496module_exit (ohci_hcd_s3c2410_cleanup);
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 7d21a4f5c425..c84e1486054f 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -361,8 +361,7 @@ int mts_scsi_queuecommand (Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback );
361static void mts_transfer_cleanup( struct urb *transfer ); 361static void mts_transfer_cleanup( struct urb *transfer );
362static void mts_do_sg(struct urb * transfer, struct pt_regs *regs); 362static void mts_do_sg(struct urb * transfer, struct pt_regs *regs);
363 363
364 364static inline
365inline static
366void mts_int_submit_urb (struct urb* transfer, 365void mts_int_submit_urb (struct urb* transfer,
367 int pipe, 366 int pipe,
368 void* data, 367 void* data,
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index ebcf7c955800..13532f3e3efc 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34#include <linux/usb_input.h>
34 35
35/* 36/*
36 * Version Information 37 * Version Information
@@ -87,8 +88,8 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)
87 if (prox) { 88 if (prox) {
88 int x = data[1] | (data[2] << 8); 89 int x = data[1] | (data[2] << 8);
89 int y = data[3] | (data[4] << 8); 90 int y = data[3] | (data[4] << 8);
90 /*Pressure should compute the same way for flair and 302*/ 91 /* Pressure should compute the same way for flair and 302 */
91 int pressure = data[5] | ((int)data[6] << 8); 92 int pressure = data[5] | (data[6] << 8);
92 int touch = data[0] & 0x01; 93 int touch = data[0] & 0x01;
93 int stylus = (data[0] & 0x10) >> 4; 94 int stylus = (data[0] & 0x10) >> 4;
94 int stylus2 = (data[0] & 0x20) >> 5; 95 int stylus2 = (data[0] & 0x20) >> 5;
@@ -104,9 +105,9 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)
104 input_sync(dev); 105 input_sync(dev);
105 106
106resubmit: 107resubmit:
107 status = usb_submit_urb (urb, GFP_ATOMIC); 108 status = usb_submit_urb(urb, GFP_ATOMIC);
108 if (status) 109 if (status)
109 err ("can't resubmit intr, %s-%s/input0, status %d", 110 err("can't resubmit intr, %s-%s/input0, status %d",
110 acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); 111 acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status);
111} 112}
112 113
@@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
212 213
213 acecad->dev.name = acecad->name; 214 acecad->dev.name = acecad->name;
214 acecad->dev.phys = acecad->phys; 215 acecad->dev.phys = acecad->phys;
215 acecad->dev.id.bustype = BUS_USB; 216 usb_to_input_id(dev, &acecad->dev.id);
216 acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
217 acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
218 acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
219 acecad->dev.dev = &intf->dev; 217 acecad->dev.dev = &intf->dev;
220 218
221 usb_fill_int_urb(acecad->irq, dev, pipe, 219 usb_fill_int_urb(acecad->irq, dev, pipe,
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 6bb0f25e8e93..cd0cbfe20723 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -77,6 +77,7 @@
77#include <linux/module.h> 77#include <linux/module.h>
78#include <linux/init.h> 78#include <linux/init.h>
79#include <linux/usb.h> 79#include <linux/usb.h>
80#include <linux/usb_input.h>
80#include <linux/sched.h> 81#include <linux/sched.h>
81#include <asm/uaccess.h> 82#include <asm/uaccess.h>
82#include <asm/unaligned.h> 83#include <asm/unaligned.h>
@@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2125 aiptek->inputdev.absflat[ABS_WHEEL] = 0; 2126 aiptek->inputdev.absflat[ABS_WHEEL] = 0;
2126 aiptek->inputdev.name = "Aiptek"; 2127 aiptek->inputdev.name = "Aiptek";
2127 aiptek->inputdev.phys = aiptek->features.usbPath; 2128 aiptek->inputdev.phys = aiptek->features.usbPath;
2128 aiptek->inputdev.id.bustype = BUS_USB; 2129 usb_to_input_id(usbdev, &aiptek->inputdev.id);
2129 aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
2130 aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
2131 aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
2132 aiptek->inputdev.dev = &intf->dev; 2130 aiptek->inputdev.dev = &intf->dev;
2133 2131
2134 aiptek->usbdev = usbdev; 2132 aiptek->usbdev = usbdev;
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 654ac454744d..fd99681ee483 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -94,6 +94,7 @@
94#include <linux/moduleparam.h> 94#include <linux/moduleparam.h>
95#include <linux/input.h> 95#include <linux/input.h>
96#include <linux/usb.h> 96#include <linux/usb.h>
97#include <linux/usb_input.h>
97#include <linux/wait.h> 98#include <linux/wait.h>
98 99
99/* 100/*
@@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
635 idev->name = ati_remote->name; 636 idev->name = ati_remote->name;
636 idev->phys = ati_remote->phys; 637 idev->phys = ati_remote->phys;
637 638
638 idev->id.bustype = BUS_USB; 639 usb_to_input_id(ati_remote->udev, &idev->id);
639 idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); 640 idev->dev = &ati_remote->udev->dev;
640 idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct);
641 idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice);
642 idev->dev = &(ati_remote->udev->dev);
643} 641}
644 642
645static int ati_remote_initialize(struct ati_remote *ati_remote) 643static int ati_remote_initialize(struct ati_remote *ati_remote)
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 2350e7a5ad70..b2cb2b35892e 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -789,12 +789,12 @@ static __inline__ int search(__s32 *array, __s32 value, unsigned n)
789 return -1; 789 return -1;
790} 790}
791 791
792static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) 792static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs)
793{ 793{
794 hid_dump_input(usage, value); 794 hid_dump_input(usage, value);
795 if (hid->claimed & HID_CLAIMED_INPUT) 795 if (hid->claimed & HID_CLAIMED_INPUT)
796 hidinput_hid_event(hid, field, usage, value, regs); 796 hidinput_hid_event(hid, field, usage, value, regs);
797 if (hid->claimed & HID_CLAIMED_HIDDEV) 797 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt)
798 hiddev_hid_event(hid, field, usage, value, regs); 798 hiddev_hid_event(hid, field, usage, value, regs);
799} 799}
800 800
@@ -804,7 +804,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s
804 * reporting to the layer). 804 * reporting to the layer).
805 */ 805 */
806 806
807static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, struct pt_regs *regs) 807static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt, struct pt_regs *regs)
808{ 808{
809 unsigned n; 809 unsigned n;
810 unsigned count = field->report_count; 810 unsigned count = field->report_count;
@@ -831,19 +831,19 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u
831 for (n = 0; n < count; n++) { 831 for (n = 0; n < count; n++) {
832 832
833 if (HID_MAIN_ITEM_VARIABLE & field->flags) { 833 if (HID_MAIN_ITEM_VARIABLE & field->flags) {
834 hid_process_event(hid, field, &field->usage[n], value[n], regs); 834 hid_process_event(hid, field, &field->usage[n], value[n], interrupt, regs);
835 continue; 835 continue;
836 } 836 }
837 837
838 if (field->value[n] >= min && field->value[n] <= max 838 if (field->value[n] >= min && field->value[n] <= max
839 && field->usage[field->value[n] - min].hid 839 && field->usage[field->value[n] - min].hid
840 && search(value, field->value[n], count)) 840 && search(value, field->value[n], count))
841 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, regs); 841 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt, regs);
842 842
843 if (value[n] >= min && value[n] <= max 843 if (value[n] >= min && value[n] <= max
844 && field->usage[value[n] - min].hid 844 && field->usage[value[n] - min].hid
845 && search(field->value, value[n], count)) 845 && search(field->value, value[n], count))
846 hid_process_event(hid, field, &field->usage[value[n] - min], 1, regs); 846 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt, regs);
847 } 847 }
848 848
849 memcpy(field->value, value, count * sizeof(__s32)); 849 memcpy(field->value, value, count * sizeof(__s32));
@@ -851,7 +851,7 @@ exit:
851 kfree(value); 851 kfree(value);
852} 852}
853 853
854static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) 854static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_regs *regs)
855{ 855{
856 struct hid_device *hid = urb->context; 856 struct hid_device *hid = urb->context;
857 struct hid_report_enum *report_enum = hid->report_enum + type; 857 struct hid_report_enum *report_enum = hid->report_enum + type;
@@ -899,7 +899,7 @@ static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs)
899 hiddev_report_event(hid, report); 899 hiddev_report_event(hid, report);
900 900
901 for (n = 0; n < report->maxfield; n++) 901 for (n = 0; n < report->maxfield; n++)
902 hid_input_field(hid, report->field[n], data, regs); 902 hid_input_field(hid, report->field[n], data, interrupt, regs);
903 903
904 if (hid->claimed & HID_CLAIMED_INPUT) 904 if (hid->claimed & HID_CLAIMED_INPUT)
905 hidinput_report_event(hid, report); 905 hidinput_report_event(hid, report);
@@ -918,7 +918,7 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs)
918 918
919 switch (urb->status) { 919 switch (urb->status) {
920 case 0: /* success */ 920 case 0: /* success */
921 hid_input_report(HID_INPUT_REPORT, urb, regs); 921 hid_input_report(HID_INPUT_REPORT, urb, 1, regs);
922 break; 922 break;
923 case -ECONNRESET: /* unlink */ 923 case -ECONNRESET: /* unlink */
924 case -ENOENT: 924 case -ENOENT:
@@ -1142,7 +1142,7 @@ static void hid_ctrl(struct urb *urb, struct pt_regs *regs)
1142 switch (urb->status) { 1142 switch (urb->status) {
1143 case 0: /* success */ 1143 case 0: /* success */
1144 if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) 1144 if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN)
1145 hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); 1145 hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs);
1146 case -ESHUTDOWN: /* unplug */ 1146 case -ESHUTDOWN: /* unplug */
1147 case -EILSEQ: /* unplug timectrl on uhci */ 1147 case -EILSEQ: /* unplug timectrl on uhci */
1148 unplug = 1; 1148 unplug = 1;
@@ -1372,6 +1372,9 @@ void hid_init_reports(struct hid_device *hid)
1372#define USB_VENDOR_ID_A4TECH 0x09da 1372#define USB_VENDOR_ID_A4TECH 0x09da
1373#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 1373#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
1374 1374
1375#define USB_VENDOR_ID_AASHIMA 0x06D6
1376#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
1377
1375#define USB_VENDOR_ID_CYPRESS 0x04b4 1378#define USB_VENDOR_ID_CYPRESS 0x04b4
1376#define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 1379#define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001
1377#define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 1380#define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500
@@ -1548,6 +1551,7 @@ static struct hid_blacklist {
1548 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, 1551 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 },
1549 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, 1552 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 },
1550 1553
1554 { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD },
1551 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, 1555 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
1552 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 1556 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
1553 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 1557 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 9ac1e9095334..63a4db721f7e 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -31,6 +31,7 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34#include <linux/usb_input.h>
34 35
35#undef DEBUG 36#undef DEBUG
36 37
@@ -397,11 +398,12 @@ ignore:
397 398
398void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) 399void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs)
399{ 400{
400 struct input_dev *input = &field->hidinput->input; 401 struct input_dev *input;
401 int *quirks = &hid->quirks; 402 int *quirks = &hid->quirks;
402 403
403 if (!input) 404 if (!field->hidinput)
404 return; 405 return;
406 input = &field->hidinput->input;
405 407
406 input_regs(input, regs); 408 input_regs(input, regs);
407 409
@@ -581,10 +583,7 @@ int hidinput_connect(struct hid_device *hid)
581 hidinput->input.name = hid->name; 583 hidinput->input.name = hid->name;
582 hidinput->input.phys = hid->phys; 584 hidinput->input.phys = hid->phys;
583 hidinput->input.uniq = hid->uniq; 585 hidinput->input.uniq = hid->uniq;
584 hidinput->input.id.bustype = BUS_USB; 586 usb_to_input_id(dev, &hidinput->input.id);
585 hidinput->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
586 hidinput->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
587 hidinput->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
588 hidinput->input.dev = &hid->intf->dev; 587 hidinput->input.dev = &hid->intf->dev;
589 } 588 }
590 589
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c
index 47dec6a1b344..0dc439f10823 100644
--- a/drivers/usb/input/itmtouch.c
+++ b/drivers/usb/input/itmtouch.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/usb.h> 55#include <linux/usb.h>
56#include <linux/usb_input.h>
56 57
57/* only an 8 byte buffer necessary for a single packet */ 58/* only an 8 byte buffer necessary for a single packet */
58#define ITM_BUFSIZE 8 59#define ITM_BUFSIZE 8
@@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
184 185
185 itmtouch->inputdev.name = itmtouch->name; 186 itmtouch->inputdev.name = itmtouch->name;
186 itmtouch->inputdev.phys = itmtouch->phys; 187 itmtouch->inputdev.phys = itmtouch->phys;
187 itmtouch->inputdev.id.bustype = BUS_USB; 188 usb_to_input_id(udev, &itmtouch->inputdev.id);
188 itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;
189 itmtouch->inputdev.id.product = udev->descriptor.idProduct;
190 itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;
191 itmtouch->inputdev.dev = &intf->dev; 189 itmtouch->inputdev.dev = &intf->dev;
192 190
193 if (!strlen(itmtouch->name)) 191 if (!strlen(itmtouch->name))
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index d2f0f90a9bcd..b6f6ac8d9c2f 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -4,6 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/usb.h> 6#include <linux/usb.h>
7#include <linux/usb_input.h>
7#include <asm/unaligned.h> 8#include <asm/unaligned.h>
8#include <asm/byteorder.h> 9#include <asm/byteorder.h>
9 10
@@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
167 168
168 kbtab->dev.name = "KB Gear Tablet"; 169 kbtab->dev.name = "KB Gear Tablet";
169 kbtab->dev.phys = kbtab->phys; 170 kbtab->dev.phys = kbtab->phys;
170 kbtab->dev.id.bustype = BUS_USB; 171 usb_to_input_id(dev, &kbtab->dev.id);
171 kbtab->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
172 kbtab->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
173 kbtab->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
174 kbtab->dev.dev = &intf->dev; 172 kbtab->dev.dev = &intf->dev;
175 kbtab->usbdev = dev; 173 kbtab->usbdev = dev;
176 174
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
index 09b5cc7c66de..ff9275057a18 100644
--- a/drivers/usb/input/mtouchusb.c
+++ b/drivers/usb/input/mtouchusb.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/usb.h> 55#include <linux/usb.h>
56#include <linux/usb_input.h>
56 57
57#define MTOUCHUSB_MIN_XC 0x0 58#define MTOUCHUSB_MIN_XC 0x0
58#define MTOUCHUSB_MAX_RAW_XC 0x4000 59#define MTOUCHUSB_MAX_RAW_XC 0x4000
@@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
232 233
233 mtouch->input.name = mtouch->name; 234 mtouch->input.name = mtouch->name;
234 mtouch->input.phys = mtouch->phys; 235 mtouch->input.phys = mtouch->phys;
235 mtouch->input.id.bustype = BUS_USB; 236 usb_to_input_id(udev, &mtouch->input.id);
236 mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
237 mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
238 mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
239 mtouch->input.dev = &intf->dev; 237 mtouch->input.dev = &intf->dev;
240 238
241 mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 239 mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index 3975b309d55f..ad4afe7e5897 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <linux/usb.h> 37#include <linux/usb.h>
38#include <linux/usb_input.h>
38 39
39#define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ 40#define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */
40#define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ 41#define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */
@@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
389 pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); 390 pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
390 pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); 391 pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL);
391 pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); 392 pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED);
392 pm->input.id.bustype = BUS_USB; 393 usb_to_input_id(udev, &pm->input.id);
393 pm->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
394 pm->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
395 pm->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
396 pm->input.event = powermate_input_event; 394 pm->input.event = powermate_input_event;
397 pm->input.dev = &intf->dev; 395 pm->input.dev = &intf->dev;
398 pm->input.phys = pm->phys; 396 pm->input.phys = pm->phys;
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
index 386595ee21c0..4276c24a5080 100644
--- a/drivers/usb/input/touchkitusb.c
+++ b/drivers/usb/input/touchkitusb.c
@@ -35,7 +35,7 @@
35#define DEBUG 35#define DEBUG
36#endif 36#endif
37#include <linux/usb.h> 37#include <linux/usb.h>
38 38#include <linux/usb_input.h>
39 39
40#define TOUCHKIT_MIN_XC 0x0 40#define TOUCHKIT_MIN_XC 0x0
41#define TOUCHKIT_MAX_XC 0x07ff 41#define TOUCHKIT_MAX_XC 0x07ff
@@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf,
202 202
203 touchkit->input.name = touchkit->name; 203 touchkit->input.name = touchkit->name;
204 touchkit->input.phys = touchkit->phys; 204 touchkit->input.phys = touchkit->phys;
205 touchkit->input.id.bustype = BUS_USB; 205 usb_to_input_id(udev, &touchkit->input.id);
206 touchkit->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
207 touchkit->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
208 touchkit->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
209 touchkit->input.dev = &intf->dev; 206 touchkit->input.dev = &intf->dev;
210 207
211 touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 208 touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index f35db1974c42..28987f15eeee 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -32,6 +32,7 @@
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/usb_input.h>
35 36
36/* 37/*
37 * Version Information 38 * Version Information
@@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
288 289
289 kbd->dev.name = kbd->name; 290 kbd->dev.name = kbd->name;
290 kbd->dev.phys = kbd->phys; 291 kbd->dev.phys = kbd->phys;
291 kbd->dev.id.bustype = BUS_USB; 292 usb_to_input_id(dev, &kbd->dev.id);
292 kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
293 kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
294 kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
295 kbd->dev.dev = &iface->dev; 293 kbd->dev.dev = &iface->dev;
296 294
297 if (dev->manufacturer) 295 if (dev->manufacturer)
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
index 1ec41b5effe6..4104dec847fb 100644
--- a/drivers/usb/input/usbmouse.c
+++ b/drivers/usb/input/usbmouse.c
@@ -32,6 +32,7 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/usb_input.h>
35 36
36/* 37/*
37 * Version Information 38 * Version Information
@@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
171 172
172 mouse->dev.name = mouse->name; 173 mouse->dev.name = mouse->name;
173 mouse->dev.phys = mouse->phys; 174 mouse->dev.phys = mouse->phys;
174 mouse->dev.id.bustype = BUS_USB; 175 usb_to_input_id(dev, &mouse->dev.id);
175 mouse->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
176 mouse->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
177 mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
178 mouse->dev.dev = &intf->dev; 176 mouse->dev.dev = &intf->dev;
179 177
180 if (dev->manufacturer) 178 if (dev->manufacturer)
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index f6b34af66b3d..02412e31a46b 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -69,6 +69,7 @@
69#include <linux/module.h> 69#include <linux/module.h>
70#include <linux/init.h> 70#include <linux/init.h>
71#include <linux/usb.h> 71#include <linux/usb.h>
72#include <linux/usb_input.h>
72#include <asm/unaligned.h> 73#include <asm/unaligned.h>
73#include <asm/byteorder.h> 74#include <asm/byteorder.h>
74 75
@@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
823 824
824 wacom->dev.name = wacom->features->name; 825 wacom->dev.name = wacom->features->name;
825 wacom->dev.phys = wacom->phys; 826 wacom->dev.phys = wacom->phys;
826 wacom->dev.id.bustype = BUS_USB; 827 usb_to_input_id(dev, &wacom->dev.id);
827 wacom->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
828 wacom->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
829 wacom->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
830 wacom->dev.dev = &intf->dev; 828 wacom->dev.dev = &intf->dev;
831 wacom->usbdev = dev; 829 wacom->usbdev = dev;
832 830
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index a7fa1b17dcfe..18125e0bffa2 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -62,6 +62,7 @@
62#include <linux/module.h> 62#include <linux/module.h>
63#include <linux/smp_lock.h> 63#include <linux/smp_lock.h>
64#include <linux/usb.h> 64#include <linux/usb.h>
65#include <linux/usb_input.h>
65 66
66#define DRIVER_VERSION "v0.0.5" 67#define DRIVER_VERSION "v0.0.5"
67#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" 68#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
@@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
256 257
257 xpad->udev = udev; 258 xpad->udev = udev;
258 259
259 xpad->dev.id.bustype = BUS_USB; 260 usb_to_input_id(udev, &xpad->dev.id);
260 xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
261 xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
262 xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
263 xpad->dev.dev = &intf->dev; 261 xpad->dev.dev = &intf->dev;
264 xpad->dev.private = xpad; 262 xpad->dev.private = xpad;
265 xpad->dev.name = xpad_device[i].name; 263 xpad->dev.name = xpad_device[i].name;
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
index 08521a2b4f3d..20ac9e1069d4 100644
--- a/drivers/usb/media/konicawc.c
+++ b/drivers/usb/media/konicawc.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/usb_input.h>
19 20
20#include "usbvideo.h" 21#include "usbvideo.h"
21 22
@@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
845 cam->input.private = cam; 846 cam->input.private = cam;
846 cam->input.evbit[0] = BIT(EV_KEY); 847 cam->input.evbit[0] = BIT(EV_KEY);
847 cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); 848 cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
848 cam->input.id.bustype = BUS_USB; 849 usb_to_input_id(dev, &cam->input.id);
849 cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
850 cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
851 cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
852 input_register_device(&cam->input); 850 input_register_device(&cam->input);
853 851
854 usb_make_path(dev, cam->input_physname, 56); 852 usb_make_path(dev, cam->input_physname, 56);
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 66ec88354b93..ad17892aac9e 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -23,6 +23,7 @@
23 * 23 *
24 * V0.1 (mh) Initial version 24 * V0.1 (mh) Initial version
25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) 25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint)
26 * V0.12 (mh) Added kmalloc check for string buffer
26 */ 27 */
27 28
28#include <linux/config.h> 29#include <linux/config.h>
@@ -84,7 +85,7 @@ static struct usb_device_id ld_usb_table [] = {
84 { } /* Terminating entry */ 85 { } /* Terminating entry */
85}; 86};
86MODULE_DEVICE_TABLE(usb, ld_usb_table); 87MODULE_DEVICE_TABLE(usb, ld_usb_table);
87MODULE_VERSION("V0.11"); 88MODULE_VERSION("V0.12");
88MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); 89MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>");
89MODULE_DESCRIPTION("LD USB Driver"); 90MODULE_DESCRIPTION("LD USB Driver");
90MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
@@ -635,6 +636,10 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
635 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && 636 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) &&
636 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { 637 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
637 buffer = kmalloc(256, GFP_KERNEL); 638 buffer = kmalloc(256, GFP_KERNEL);
639 if (buffer == NULL) {
640 dev_err(&intf->dev, "Couldn't allocate string buffer\n");
641 goto error;
642 }
638 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ 643 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */
639 usb_string(udev, 255, buffer, 256); 644 usb_string(udev, 255, buffer, 256);
640 kfree(buffer); 645 kfree(buffer);
diff --git a/drivers/usb/mon/Kconfig b/drivers/usb/mon/Kconfig
index 777642e26b9a..deb9ddffa402 100644
--- a/drivers/usb/mon/Kconfig
+++ b/drivers/usb/mon/Kconfig
@@ -9,9 +9,8 @@ config USB_MON
9 help 9 help
10 If you say Y here, a component which captures the USB traffic 10 If you say Y here, a component which captures the USB traffic
11 between peripheral-specific drivers and HC drivers will be built. 11 between peripheral-specific drivers and HC drivers will be built.
12 The USB_MON is similar in spirit and may be compatible with Dave 12 For more information, see <file:Documentation/usb/usbmon.txt>.
13 Harding's USBMon.
14 13
15 This is somewhat experimental at this time, but it should be safe, 14 This is somewhat experimental at this time, but it should be safe.
16 as long as you aren't using modular USB and try to remove this 15
17 module. 16 If unsure, say Y.
diff --git a/drivers/usb/mon/Makefile b/drivers/usb/mon/Makefile
index f18d10ce91f9..b0015b8a1d1f 100644
--- a/drivers/usb/mon/Makefile
+++ b/drivers/usb/mon/Makefile
@@ -4,4 +4,5 @@
4 4
5usbmon-objs := mon_main.o mon_stat.o mon_text.o 5usbmon-objs := mon_main.o mon_stat.o mon_text.o
6 6
7# This does not use CONFIG_USB_MON because we want this to use a tristate.
7obj-$(CONFIG_USB) += usbmon.o 8obj-$(CONFIG_USB) += usbmon.o
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 5f4496d8dbac..fcd6d3ccef44 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -59,7 +59,6 @@ static const char driver_name[] = "pegasus";
59 59
60static int loopback = 0; 60static int loopback = 0;
61static int mii_mode = 0; 61static int mii_mode = 0;
62static int multicast_filter_limit = 32;
63 62
64static struct usb_eth_dev usb_dev_id[] = { 63static struct usb_eth_dev usb_dev_id[] = {
65#define PEGASUS_DEV(pn, vid, pid, flags) \ 64#define PEGASUS_DEV(pn, vid, pid, flags) \
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index 626b016addff..59ab40ebb394 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -167,8 +167,6 @@ struct rtl8150 {
167 167
168typedef struct rtl8150 rtl8150_t; 168typedef struct rtl8150 rtl8150_t;
169 169
170static unsigned long multicast_filter_limit = 32;
171
172static void fill_skb_pool(rtl8150_t *); 170static void fill_skb_pool(rtl8150_t *);
173static void free_skb_pool(rtl8150_t *); 171static void free_skb_pool(rtl8150_t *);
174static inline struct sk_buff *pull_skb(rtl8150_t *); 172static inline struct sk_buff *pull_skb(rtl8150_t *);
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
index 3b387b005739..29cd801eb958 100644
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -29,6 +29,7 @@ static struct usb_device_id zd1201_table[] = {
29 {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ 29 {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */
30 {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ 30 {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */
31 {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ 31 {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */
32 {USB_DEVICE(0x1044, 0x8005)}, /* GIGABYTE GN-WLBZ201 usb adapter */
32 {} 33 {}
33}; 34};
34 35
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0b03ddab53d9..d1964a0c4168 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -429,6 +429,9 @@ static struct usb_device_id id_table_combined [] = {
429 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 429 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
430 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, 430 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
431 { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, 431 { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
432 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) },
433 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) },
434 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
432 { } /* Terminating entry */ 435 { } /* Terminating entry */
433}; 436};
434 437
@@ -545,6 +548,7 @@ static struct usb_serial_device_type ftdi_sio_device = {
545 548
546 549
547#define WDR_TIMEOUT 5000 /* default urb timeout */ 550#define WDR_TIMEOUT 5000 /* default urb timeout */
551#define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */
548 552
549/* High and low are for DTR, RTS etc etc */ 553/* High and low are for DTR, RTS etc etc */
550#define HIGH 1 554#define HIGH 1
@@ -593,62 +597,59 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud)
593 return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); 597 return(ftdi_232bm_baud_base_to_divisor(baud, 48000000));
594} 598}
595 599
596static int set_rts(struct usb_serial_port *port, int high_or_low) 600#define set_mctrl(port, set) update_mctrl((port), (set), 0)
601#define clear_mctrl(port, clear) update_mctrl((port), 0, (clear))
602
603static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int clear)
597{ 604{
598 struct ftdi_private *priv = usb_get_serial_port_data(port); 605 struct ftdi_private *priv = usb_get_serial_port_data(port);
599 char *buf; 606 char *buf;
600 unsigned ftdi_high_or_low; 607 unsigned urb_value;
601 int rv; 608 int rv;
602
603 buf = kmalloc(1, GFP_NOIO);
604 if (!buf)
605 return -ENOMEM;
606
607 if (high_or_low) {
608 ftdi_high_or_low = FTDI_SIO_SET_RTS_HIGH;
609 priv->last_dtr_rts |= TIOCM_RTS;
610 } else {
611 ftdi_high_or_low = FTDI_SIO_SET_RTS_LOW;
612 priv->last_dtr_rts &= ~TIOCM_RTS;
613 }
614 rv = usb_control_msg(port->serial->dev,
615 usb_sndctrlpipe(port->serial->dev, 0),
616 FTDI_SIO_SET_MODEM_CTRL_REQUEST,
617 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
618 ftdi_high_or_low, priv->interface,
619 buf, 0, WDR_TIMEOUT);
620
621 kfree(buf);
622 return rv;
623}
624 609
610 if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
611 dbg("%s - DTR|RTS not being set|cleared", __FUNCTION__);
612 return 0; /* no change */
613 }
625 614
626static int set_dtr(struct usb_serial_port *port, int high_or_low)
627{
628 struct ftdi_private *priv = usb_get_serial_port_data(port);
629 char *buf;
630 unsigned ftdi_high_or_low;
631 int rv;
632
633 buf = kmalloc(1, GFP_NOIO); 615 buf = kmalloc(1, GFP_NOIO);
634 if (!buf) 616 if (!buf) {
635 return -ENOMEM; 617 return -ENOMEM;
636
637 if (high_or_low) {
638 ftdi_high_or_low = FTDI_SIO_SET_DTR_HIGH;
639 priv->last_dtr_rts |= TIOCM_DTR;
640 } else {
641 ftdi_high_or_low = FTDI_SIO_SET_DTR_LOW;
642 priv->last_dtr_rts &= ~TIOCM_DTR;
643 } 618 }
619
620 clear &= ~set; /* 'set' takes precedence over 'clear' */
621 urb_value = 0;
622 if (clear & TIOCM_DTR)
623 urb_value |= FTDI_SIO_SET_DTR_LOW;
624 if (clear & TIOCM_RTS)
625 urb_value |= FTDI_SIO_SET_RTS_LOW;
626 if (set & TIOCM_DTR)
627 urb_value |= FTDI_SIO_SET_DTR_HIGH;
628 if (set & TIOCM_RTS)
629 urb_value |= FTDI_SIO_SET_RTS_HIGH;
644 rv = usb_control_msg(port->serial->dev, 630 rv = usb_control_msg(port->serial->dev,
645 usb_sndctrlpipe(port->serial->dev, 0), 631 usb_sndctrlpipe(port->serial->dev, 0),
646 FTDI_SIO_SET_MODEM_CTRL_REQUEST, 632 FTDI_SIO_SET_MODEM_CTRL_REQUEST,
647 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, 633 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
648 ftdi_high_or_low, priv->interface, 634 urb_value, priv->interface,
649 buf, 0, WDR_TIMEOUT); 635 buf, 0, WDR_TIMEOUT);
650 636
651 kfree(buf); 637 kfree(buf);
638 if (rv < 0) {
639 err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
640 __FUNCTION__,
641 (set & TIOCM_DTR) ? "HIGH" :
642 (clear & TIOCM_DTR) ? "LOW" : "unchanged",
643 (set & TIOCM_RTS) ? "HIGH" :
644 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
645 } else {
646 dbg("%s - DTR %s, RTS %s", __FUNCTION__,
647 (set & TIOCM_DTR) ? "HIGH" :
648 (clear & TIOCM_DTR) ? "LOW" : "unchanged",
649 (set & TIOCM_RTS) ? "HIGH" :
650 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
651 priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
652 }
652 return rv; 653 return rv;
653} 654}
654 655
@@ -681,7 +682,7 @@ static int change_speed(struct usb_serial_port *port)
681 FTDI_SIO_SET_BAUDRATE_REQUEST, 682 FTDI_SIO_SET_BAUDRATE_REQUEST,
682 FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, 683 FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE,
683 urb_value, urb_index, 684 urb_value, urb_index,
684 buf, 0, 100); 685 buf, 0, WDR_SHORT_TIMEOUT);
685 686
686 kfree(buf); 687 kfree(buf);
687 return rv; 688 return rv;
@@ -1219,12 +1220,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1219 /* FIXME: Flow control might be enabled, so it should be checked - 1220 /* FIXME: Flow control might be enabled, so it should be checked -
1220 we have no control of defaults! */ 1221 we have no control of defaults! */
1221 /* Turn on RTS and DTR since we are not flow controlling by default */ 1222 /* Turn on RTS and DTR since we are not flow controlling by default */
1222 if (set_dtr(port, HIGH) < 0) { 1223 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1223 err("%s Error from DTR HIGH urb", __FUNCTION__);
1224 }
1225 if (set_rts(port, HIGH) < 0){
1226 err("%s Error from RTS HIGH urb", __FUNCTION__);
1227 }
1228 1224
1229 /* Not throttled */ 1225 /* Not throttled */
1230 spin_lock_irqsave(&priv->rx_lock, flags); 1226 spin_lock_irqsave(&priv->rx_lock, flags);
@@ -1274,14 +1270,8 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp)
1274 err("error from flowcontrol urb"); 1270 err("error from flowcontrol urb");
1275 } 1271 }
1276 1272
1277 /* drop DTR */ 1273 /* drop RTS and DTR */
1278 if (set_dtr(port, LOW) < 0){ 1274 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1279 err("Error from DTR LOW urb");
1280 }
1281 /* drop RTS */
1282 if (set_rts(port, LOW) < 0) {
1283 err("Error from RTS LOW urb");
1284 }
1285 } /* Note change no line if hupcl is off */ 1275 } /* Note change no line if hupcl is off */
1286 1276
1287 /* cancel any scheduled reading */ 1277 /* cancel any scheduled reading */
@@ -1797,7 +1787,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1797 FTDI_SIO_SET_DATA_REQUEST, 1787 FTDI_SIO_SET_DATA_REQUEST,
1798 FTDI_SIO_SET_DATA_REQUEST_TYPE, 1788 FTDI_SIO_SET_DATA_REQUEST_TYPE,
1799 urb_value , priv->interface, 1789 urb_value , priv->interface,
1800 buf, 0, 100) < 0) { 1790 buf, 0, WDR_SHORT_TIMEOUT) < 0) {
1801 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); 1791 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__);
1802 } 1792 }
1803 1793
@@ -1812,25 +1802,14 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1812 err("%s error from disable flowcontrol urb", __FUNCTION__); 1802 err("%s error from disable flowcontrol urb", __FUNCTION__);
1813 } 1803 }
1814 /* Drop RTS and DTR */ 1804 /* Drop RTS and DTR */
1815 if (set_dtr(port, LOW) < 0){ 1805 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1816 err("%s Error from DTR LOW urb", __FUNCTION__);
1817 }
1818 if (set_rts(port, LOW) < 0){
1819 err("%s Error from RTS LOW urb", __FUNCTION__);
1820 }
1821
1822 } else { 1806 } else {
1823 /* set the baudrate determined before */ 1807 /* set the baudrate determined before */
1824 if (change_speed(port)) { 1808 if (change_speed(port)) {
1825 err("%s urb failed to set baurdrate", __FUNCTION__); 1809 err("%s urb failed to set baurdrate", __FUNCTION__);
1826 } 1810 }
1827 /* Ensure RTS and DTR are raised */ 1811 /* Ensure RTS and DTR are raised */
1828 else if (set_dtr(port, HIGH) < 0){ 1812 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1829 err("%s Error from DTR HIGH urb", __FUNCTION__);
1830 }
1831 else if (set_rts(port, HIGH) < 0){
1832 err("%s Error from RTS HIGH urb", __FUNCTION__);
1833 }
1834 } 1813 }
1835 1814
1836 /* Set flow control */ 1815 /* Set flow control */
@@ -1942,35 +1921,8 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
1942 1921
1943static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) 1922static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear)
1944{ 1923{
1945 int ret;
1946
1947 dbg("%s TIOCMSET", __FUNCTION__); 1924 dbg("%s TIOCMSET", __FUNCTION__);
1948 if (set & TIOCM_DTR){ 1925 return update_mctrl(port, set, clear);
1949 if ((ret = set_dtr(port, HIGH)) < 0) {
1950 err("Urb to set DTR failed");
1951 return(ret);
1952 }
1953 }
1954 if (set & TIOCM_RTS) {
1955 if ((ret = set_rts(port, HIGH)) < 0){
1956 err("Urb to set RTS failed");
1957 return(ret);
1958 }
1959 }
1960
1961 if (clear & TIOCM_DTR){
1962 if ((ret = set_dtr(port, LOW)) < 0){
1963 err("Urb to unset DTR failed");
1964 return(ret);
1965 }
1966 }
1967 if (clear & TIOCM_RTS) {
1968 if ((ret = set_rts(port, LOW)) < 0){
1969 err("Urb to unset RTS failed");
1970 return(ret);
1971 }
1972 }
1973 return(0);
1974} 1926}
1975 1927
1976 1928
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 8866376823a5..9f4342093e8b 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -265,10 +265,24 @@
265#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ 265#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */
266 266
267/* 267/*
268 * microHAM product IDs (http://www.microham.com).
269 * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>.
270 */
271#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */
272#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */
273
274/*
268 * Active Robots product ids. 275 * Active Robots product ids.
269 */ 276 */
270#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ 277#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */
271 278
279/*
280 * Evolution Robotics products (http://www.evolution.com/).
281 * Submitted by Shawn M. Lavelle.
282 */
283#define EVOLUTION_VID 0xDEEE /* Vendor ID */
284#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
285
272/* Commands */ 286/* Commands */
273#define FTDI_SIO_RESET 0 /* Reset the port */ 287#define FTDI_SIO_RESET 0 /* Reset the port */
274#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 288#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 6051a646fe69..353f24d45bc1 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -257,7 +257,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
257 endpoint = &iface_desc->endpoint[i].desc; 257 endpoint = &iface_desc->endpoint[i].desc;
258 258
259 if (!dev->bulk_in_endpointAddr && 259 if (!dev->bulk_in_endpointAddr &&
260 (endpoint->bEndpointAddress & USB_DIR_IN) && 260 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
261 == USB_DIR_IN) &&
261 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 262 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
262 == USB_ENDPOINT_XFER_BULK)) { 263 == USB_ENDPOINT_XFER_BULK)) {
263 /* we found a bulk in endpoint */ 264 /* we found a bulk in endpoint */
@@ -272,7 +273,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
272 } 273 }
273 274
274 if (!dev->bulk_out_endpointAddr && 275 if (!dev->bulk_out_endpointAddr &&
275 !(endpoint->bEndpointAddress & USB_DIR_OUT) && 276 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
277 == USB_DIR_OUT) &&
276 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 278 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
277 == USB_ENDPOINT_XFER_BULK)) { 279 == USB_ENDPOINT_XFER_BULK)) {
278 /* we found a bulk out endpoint */ 280 /* we found a bulk out endpoint */
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 04d3120f7236..cde0ed097af6 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1399,8 +1399,8 @@ config FB_TX3912
1399 Say Y here to enable kernel support for the on-board framebuffer. 1399 Say Y here to enable kernel support for the on-board framebuffer.
1400 1400
1401config FB_G364 1401config FB_G364
1402 bool 1402 bool "G364 frame buffer support"
1403 depends on MIPS_MAGNUM_4000 || OLIVETTI_M700 1403 depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700)
1404 select FB_CFB_FILLRECT 1404 select FB_CFB_FILLRECT
1405 select FB_CFB_COPYAREA 1405 select FB_CFB_COPYAREA
1406 select FB_CFB_IMAGEBLIT 1406 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 47a6b12bc968..e7e8b52014c3 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2521,6 +2521,11 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev)
2521 2521
2522 radeonfb_pm_exit(rinfo); 2522 radeonfb_pm_exit(rinfo);
2523 2523
2524 if (rinfo->mon1_EDID)
2525 sysfs_remove_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr);
2526 if (rinfo->mon2_EDID)
2527 sysfs_remove_bin_file(&rinfo->pdev->dev.kobj, &edid2_attr);
2528
2524#if 0 2529#if 0
2525 /* restore original state 2530 /* restore original state
2526 * 2531 *
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 9dd0fbccf994..35c88bd7ba5e 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -275,7 +275,8 @@ static void fb_flashcursor(void *private)
275 275
276 if (!vc || !CON_IS_VISIBLE(vc) || 276 if (!vc || !CON_IS_VISIBLE(vc) ||
277 fbcon_is_inactive(vc, info) || 277 fbcon_is_inactive(vc, info) ||
278 registered_fb[con2fb_map[vc->vc_num]] != info) 278 registered_fb[con2fb_map[vc->vc_num]] != info ||
279 vc_cons[ops->currcon].d->vc_deccm != 1)
279 return; 280 return;
280 acquire_console_sem(); 281 acquire_console_sem();
281 p = &fb_display[vc->vc_num]; 282 p = &fb_display[vc->vc_num];
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
index 4e5ce8f7d65e..c32a2a50bfa2 100644
--- a/drivers/video/fbcmap.c
+++ b/drivers/video/fbcmap.c
@@ -212,7 +212,7 @@ int fb_cmap_to_user(struct fb_cmap *from, struct fb_cmap_user *to)
212 212
213int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) 213int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)
214{ 214{
215 int i, start; 215 int i, start, rc = 0;
216 u16 *red, *green, *blue, *transp; 216 u16 *red, *green, *blue, *transp;
217 u_int hred, hgreen, hblue, htransp = 0xffff; 217 u_int hred, hgreen, hblue, htransp = 0xffff;
218 218
@@ -225,75 +225,51 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)
225 if (start < 0 || (!info->fbops->fb_setcolreg && 225 if (start < 0 || (!info->fbops->fb_setcolreg &&
226 !info->fbops->fb_setcmap)) 226 !info->fbops->fb_setcmap))
227 return -EINVAL; 227 return -EINVAL;
228 if (info->fbops->fb_setcmap) 228 if (info->fbops->fb_setcmap) {
229 return info->fbops->fb_setcmap(cmap, info); 229 rc = info->fbops->fb_setcmap(cmap, info);
230 for (i = 0; i < cmap->len; i++) { 230 } else {
231 hred = *red++; 231 for (i = 0; i < cmap->len; i++) {
232 hgreen = *green++; 232 hred = *red++;
233 hblue = *blue++; 233 hgreen = *green++;
234 if (transp) 234 hblue = *blue++;
235 htransp = *transp++; 235 if (transp)
236 if (info->fbops->fb_setcolreg(start++, 236 htransp = *transp++;
237 hred, hgreen, hblue, htransp, 237 if (info->fbops->fb_setcolreg(start++,
238 info)) 238 hred, hgreen, hblue,
239 break; 239 htransp, info))
240 break;
241 }
240 } 242 }
241 return 0; 243 if (rc == 0)
244 fb_copy_cmap(cmap, &info->cmap);
245
246 return rc;
242} 247}
243 248
244int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) 249int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
245{ 250{
246 int i, start; 251 int rc, size = cmap->len * sizeof(u16);
247 u16 __user *red, *green, *blue, *transp; 252 struct fb_cmap umap;
248 u_int hred, hgreen, hblue, htransp = 0xffff;
249
250 red = cmap->red;
251 green = cmap->green;
252 blue = cmap->blue;
253 transp = cmap->transp;
254 start = cmap->start;
255 253
256 if (start < 0 || (!info->fbops->fb_setcolreg && 254 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
257 !info->fbops->fb_setcmap)) 255 !info->fbops->fb_setcmap))
258 return -EINVAL; 256 return -EINVAL;
259 257
260 /* If we can batch, do it */ 258 memset(&umap, 0, sizeof(struct fb_cmap));
261 if (info->fbops->fb_setcmap && cmap->len > 1) { 259 rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL);
262 struct fb_cmap umap; 260 if (rc)
263 int size = cmap->len * sizeof(u16);
264 int rc;
265
266 memset(&umap, 0, sizeof(struct fb_cmap));
267 rc = fb_alloc_cmap(&umap, cmap->len, transp != NULL);
268 if (rc)
269 return rc;
270 if (copy_from_user(umap.red, red, size) ||
271 copy_from_user(umap.green, green, size) ||
272 copy_from_user(umap.blue, blue, size) ||
273 (transp && copy_from_user(umap.transp, transp, size))) {
274 rc = -EFAULT;
275 }
276 umap.start = start;
277 if (rc == 0)
278 rc = info->fbops->fb_setcmap(&umap, info);
279 fb_dealloc_cmap(&umap);
280 return rc; 261 return rc;
262 if (copy_from_user(umap.red, cmap->red, size) ||
263 copy_from_user(umap.green, cmap->green, size) ||
264 copy_from_user(umap.blue, cmap->blue, size) ||
265 (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) {
266 fb_dealloc_cmap(&umap);
267 return -EFAULT;
281 } 268 }
282 269 umap.start = cmap->start;
283 for (i = 0; i < cmap->len; i++, red++, blue++, green++) { 270 rc = fb_set_cmap(&umap, info);
284 if (get_user(hred, red) || 271 fb_dealloc_cmap(&umap);
285 get_user(hgreen, green) || 272 return rc;
286 get_user(hblue, blue) ||
287 (transp && get_user(htransp, transp)))
288 return -EFAULT;
289 if (info->fbops->fb_setcolreg(start++,
290 hred, hgreen, hblue, htransp,
291 info))
292 return 0;
293 if (transp)
294 transp++;
295 }
296 return 0;
297} 273}
298 274
299/** 275/**
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 2222de6ad844..d2e19f6dd72c 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth);
80 */ 80 */
81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) 81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
82{ 82{
83 int i; 83 int i, j;
84 84
85 for (i = height; i--; ) { 85 for (i = height; i--; ) {
86 memcpy(dst, src, s_pitch); 86 /* s_pitch is a few bytes at the most, memcpy is suboptimal */
87 for (j = 0; j < s_pitch; j++)
88 dst[j] = src[j];
87 src += s_pitch; 89 src += s_pitch;
88 dst += d_pitch; 90 dst += d_pitch;
89 } 91 }
@@ -1164,6 +1166,7 @@ static void __exit
1164fbmem_exit(void) 1166fbmem_exit(void)
1165{ 1167{
1166 class_destroy(fb_class); 1168 class_destroy(fb_class);
1169 unregister_chrdev(FB_MAJOR, "fb");
1167} 1170}
1168 1171
1169module_exit(fbmem_exit); 1172module_exit(fbmem_exit);
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 6cd1976548d4..c2718bb94949 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1241,6 +1241,8 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
1241 vtotal *= 2; 1241 vtotal *= 2;
1242 1242
1243 hfreq = pixclock/htotal; 1243 hfreq = pixclock/htotal;
1244 hfreq = (hfreq + 500) / 1000 * 1000;
1245
1244 vfreq = hfreq/vtotal; 1246 vfreq = hfreq/vtotal;
1245 1247
1246 return (vfreq < vfmin || vfreq > vfmax || 1248 return (vfreq < vfmin || vfreq > vfmax ||
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index ddc9443254d9..1147b899f007 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -242,10 +242,68 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf)
242 fb_info->var.yres_virtual); 242 fb_info->var.yres_virtual);
243} 243}
244 244
245static ssize_t store_cmap(struct class_device *class_device, const char * buf, 245/* Format for cmap is "%02x%c%4x%4x%4x\n" */
246/* %02x entry %c transp %4x red %4x blue %4x green \n */
247/* 256 rows at 16 chars equals 4096, the normal page size */
248/* the code will automatically adjust for different page sizes */
249static ssize_t store_cmap(struct class_device *class_device, const char *buf,
246 size_t count) 250 size_t count)
247{ 251{
248// struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); 252 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device);
253 int rc, i, start, length, transp = 0;
254
255 if ((count > PAGE_SIZE) || ((count % 16) != 0))
256 return -EINVAL;
257
258 if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap)
259 return -EINVAL;
260
261 sscanf(buf, "%02x", &start);
262 length = count / 16;
263
264 for (i = 0; i < length; i++)
265 if (buf[i * 16 + 2] != ' ')
266 transp = 1;
267
268 /* If we can batch, do it */
269 if (fb_info->fbops->fb_setcmap && length > 1) {
270 struct fb_cmap umap;
271
272 memset(&umap, 0, sizeof(umap));
273 if ((rc = fb_alloc_cmap(&umap, length, transp)))
274 return rc;
275
276 umap.start = start;
277 for (i = 0; i < length; i++) {
278 sscanf(&buf[i * 16 + 3], "%4hx", &umap.red[i]);
279 sscanf(&buf[i * 16 + 7], "%4hx", &umap.blue[i]);
280 sscanf(&buf[i * 16 + 11], "%4hx", &umap.green[i]);
281 if (transp)
282 umap.transp[i] = (buf[i * 16 + 2] != ' ');
283 }
284 rc = fb_info->fbops->fb_setcmap(&umap, fb_info);
285 fb_copy_cmap(&umap, &fb_info->cmap);
286 fb_dealloc_cmap(&umap);
287
288 return rc;
289 }
290 for (i = 0; i < length; i++) {
291 u16 red, blue, green, tsp;
292
293 sscanf(&buf[i * 16 + 3], "%4hx", &red);
294 sscanf(&buf[i * 16 + 7], "%4hx", &blue);
295 sscanf(&buf[i * 16 + 11], "%4hx", &green);
296 tsp = (buf[i * 16 + 2] != ' ');
297 if ((rc = fb_info->fbops->fb_setcolreg(start++,
298 red, green, blue, tsp, fb_info)))
299 return rc;
300
301 fb_info->cmap.red[i] = red;
302 fb_info->cmap.blue[i] = blue;
303 fb_info->cmap.green[i] = green;
304 if (transp)
305 fb_info->cmap.transp[i] = tsp;
306 }
249 return 0; 307 return 0;
250} 308}
251 309
@@ -253,20 +311,24 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf)
253{ 311{
254 struct fb_info *fb_info = 312 struct fb_info *fb_info =
255 (struct fb_info *)class_get_devdata(class_device); 313 (struct fb_info *)class_get_devdata(class_device);
256 unsigned int offset = 0, i; 314 unsigned int i;
257 315
258 if (!fb_info->cmap.red || !fb_info->cmap.blue || 316 if (!fb_info->cmap.red || !fb_info->cmap.blue ||
259 !fb_info->cmap.green || !fb_info->cmap.transp) 317 !fb_info->cmap.green)
318 return -EINVAL;
319
320 if (fb_info->cmap.len > PAGE_SIZE / 16)
260 return -EINVAL; 321 return -EINVAL;
261 322
323 /* don't mess with the format, the buffer is PAGE_SIZE */
324 /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */
262 for (i = 0; i < fb_info->cmap.len; i++) { 325 for (i = 0; i < fb_info->cmap.len; i++) {
263 offset += snprintf(buf, PAGE_SIZE - offset, 326 snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start,
264 "%d,%d,%d,%d,%d\n", i + fb_info->cmap.start, 327 ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '),
265 fb_info->cmap.red[i], fb_info->cmap.blue[i], 328 fb_info->cmap.red[i], fb_info->cmap.blue[i],
266 fb_info->cmap.green[i], 329 fb_info->cmap.green[i]);
267 fb_info->cmap.transp[i]);
268 } 330 }
269 return offset; 331 return 16 * fb_info->cmap.len;
270} 332}
271 333
272static ssize_t store_blank(struct class_device *class_device, const char * buf, 334static ssize_t store_blank(struct class_device *class_device, const char * buf,
@@ -352,6 +414,13 @@ static ssize_t show_pan(struct class_device *class_device, char *buf)
352 fb_info->var.xoffset); 414 fb_info->var.xoffset);
353} 415}
354 416
417static ssize_t show_name(struct class_device *class_device, char *buf)
418{
419 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device);
420
421 return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id);
422}
423
355static struct class_device_attribute class_device_attrs[] = { 424static struct class_device_attribute class_device_attrs[] = {
356 __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), 425 __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp),
357 __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), 426 __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank),
@@ -362,6 +431,7 @@ static struct class_device_attribute class_device_attrs[] = {
362 __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), 431 __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes),
363 __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), 432 __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan),
364 __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), 433 __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual),
434 __ATTR(name, S_IRUGO, show_name, NULL),
365}; 435};
366 436
367int fb_init_class_device(struct fb_info *fb_info) 437int fb_init_class_device(struct fb_info *fb_info)
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index fbf659b6dab0..3edc9f49344b 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -246,6 +246,11 @@ static const struct fb_videomode modedb[] = {
246 /* 480x300 @ 72 Hz, 48.0 kHz hsync */ 246 /* 480x300 @ 72 Hz, 48.0 kHz hsync */
247 NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, 247 NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3,
248 0, FB_VMODE_DOUBLE 248 0, FB_VMODE_DOUBLE
249 }, {
250 /* 1920x1200 @ 60 Hz, 74.5 Khz hsync */
251 NULL, 60, 1920, 1200, 5177, 128, 336, 1, 38, 208, 3,
252 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
253 FB_VMODE_NONINTERLACED
249 }, 254 },
250}; 255};
251 256
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index b2e6b2407869..52b16850a54e 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -1324,6 +1324,13 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1324 1324
1325 fb_videomode_to_var(&nvidiafb_default_var, &modedb); 1325 fb_videomode_to_var(&nvidiafb_default_var, &modedb);
1326 nvidiafb_default_var.bits_per_pixel = 8; 1326 nvidiafb_default_var.bits_per_pixel = 8;
1327 } else if (par->fpWidth && par->fpHeight) {
1328 char buf[16];
1329
1330 memset(buf, 0, 16);
1331 snprintf(buf, 15, "%dx%d", par->fpWidth, par->fpHeight);
1332 fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb,
1333 specs->modedb_len, &modedb, 8);
1327 } 1334 }
1328 1335
1329 if (mode_option) 1336 if (mode_option)
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 5dceddedf507..42c17efa9fb0 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -138,27 +138,27 @@ static struct fb_var_screeninfo pm2fb_var __devinitdata = {
138 * Utility functions 138 * Utility functions
139 */ 139 */
140 140
141inline static u32 RD32(unsigned char __iomem *base, s32 off) 141static inline u32 RD32(unsigned char __iomem *base, s32 off)
142{ 142{
143 return fb_readl(base + off); 143 return fb_readl(base + off);
144} 144}
145 145
146inline static void WR32(unsigned char __iomem *base, s32 off, u32 v) 146static inline void WR32(unsigned char __iomem *base, s32 off, u32 v)
147{ 147{
148 fb_writel(v, base + off); 148 fb_writel(v, base + off);
149} 149}
150 150
151inline static u32 pm2_RD(struct pm2fb_par* p, s32 off) 151static inline u32 pm2_RD(struct pm2fb_par* p, s32 off)
152{ 152{
153 return RD32(p->v_regs, off); 153 return RD32(p->v_regs, off);
154} 154}
155 155
156inline static void pm2_WR(struct pm2fb_par* p, s32 off, u32 v) 156static inline void pm2_WR(struct pm2fb_par* p, s32 off, u32 v)
157{ 157{
158 WR32(p->v_regs, off, v); 158 WR32(p->v_regs, off, v);
159} 159}
160 160
161inline static u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx) 161static inline u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx)
162{ 162{
163 int index = PM2R_RD_INDEXED_DATA; 163 int index = PM2R_RD_INDEXED_DATA;
164 switch (p->type) { 164 switch (p->type) {
@@ -174,7 +174,7 @@ inline static u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx)
174 return pm2_RD(p, index); 174 return pm2_RD(p, index);
175} 175}
176 176
177inline static void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 177static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
178{ 178{
179 int index = PM2R_RD_INDEXED_DATA; 179 int index = PM2R_RD_INDEXED_DATA;
180 switch (p->type) { 180 switch (p->type) {
@@ -190,7 +190,7 @@ inline static void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
190 pm2_WR(p, index, v); 190 pm2_WR(p, index, v);
191} 191}
192 192
193inline static void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 193static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
194{ 194{
195 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 195 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
196 mb(); 196 mb();
@@ -200,7 +200,7 @@ inline static void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
200#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT 200#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
201#define WAIT_FIFO(p,a) 201#define WAIT_FIFO(p,a)
202#else 202#else
203inline static void WAIT_FIFO(struct pm2fb_par* p, u32 a) 203static inline void WAIT_FIFO(struct pm2fb_par* p, u32 a)
204{ 204{
205 while( pm2_RD(p, PM2R_IN_FIFO_SPACE) < a ); 205 while( pm2_RD(p, PM2R_IN_FIFO_SPACE) < a );
206 mb(); 206 mb();
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 6a9e183be41b..ae297e222681 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1826,7 +1826,7 @@ static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1826#ifdef CONFIG_PPC_OF 1826#ifdef CONFIG_PPC_OF
1827 if (!riva_get_EDID_OF(info, pdev)) 1827 if (!riva_get_EDID_OF(info, pdev))
1828 printk(PFX "could not retrieve EDID from OF\n"); 1828 printk(PFX "could not retrieve EDID from OF\n");
1829#elif CONFIG_FB_RIVA_I2C 1829#elif defined(CONFIG_FB_RIVA_I2C)
1830 if (!riva_get_EDID_i2c(info)) 1830 if (!riva_get_EDID_i2c(info))
1831 printk(PFX "could not retrieve EDID from DDC/I2C\n"); 1831 printk(PFX "could not retrieve EDID from DDC/I2C\n");
1832#endif 1832#endif
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index 2d29db7ef800..beeec7b51425 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -598,7 +598,7 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
598 * requests for the LCD controller. If we hit this, it means we're 598 * requests for the LCD controller. If we hit this, it means we're
599 * doing nothing but LCD DMA. 599 * doing nothing but LCD DMA.
600 */ 600 */
601static unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var) 601static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var)
602{ 602{
603 /* 603 /*
604 * Period = pixclock * bits_per_byte * bytes_per_transfer 604 * Period = pixclock * bits_per_byte * bytes_per_transfer
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index da8004e5d03d..698ca9232e73 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -454,13 +454,16 @@ static struct accel_switch accel_image = {
454static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) 454static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr)
455{ 455{
456 int bpp = info->var.bits_per_pixel; 456 int bpp = info->var.bits_per_pixel;
457 int col; 457 int col = 0;
458 458
459 switch (bpp) { 459 switch (bpp) {
460 default: 460 default:
461 case 8: col = fr->color; 461 case 8: col |= fr->color;
462 col |= col << 8;
463 col |= col << 16;
462 break; 464 break;
463 case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; 465 case 16: col = ((u32 *)(info->pseudo_palette))[fr->color];
466
464 break; 467 break;
465 case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; 468 case 32: col = ((u32 *)(info->pseudo_palette))[fr->color];
466 break; 469 break;
@@ -882,8 +885,9 @@ static int tridentfb_set_par(struct fb_info *info)
882 885
883 write3X4(GraphEngReg, 0x80); //enable GE for text acceleration 886 write3X4(GraphEngReg, 0x80); //enable GE for text acceleration
884 887
885// if (info->var.accel_flags & FB_ACCELF_TEXT) 888#ifdef CONFIG_FB_TRIDENT_ACCEL
886//FIXME acc->init_accel(info->var.xres,bpp); 889 acc->init_accel(info->var.xres,bpp);
890#endif
887 891
888 switch (bpp) { 892 switch (bpp) {
889 case 8: tmp = 0x00; break; 893 case 8: tmp = 0x00; break;
@@ -900,7 +904,7 @@ static int tridentfb_set_par(struct fb_info *info)
900 write3X4(DRAMControl, tmp); //both IO,linear enable 904 write3X4(DRAMControl, tmp); //both IO,linear enable
901 905
902 write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); 906 write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40);
903 write3X4(Performance,0x20); 907 write3X4(Performance,0x92);
904 write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable 908 write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable
905 909
906 /* convert from picoseconds to MHz */ 910 /* convert from picoseconds to MHz */
@@ -981,12 +985,14 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
981 t_outb(green>>10,0x3C9); 985 t_outb(green>>10,0x3C9);
982 t_outb(blue>>10,0x3C9); 986 t_outb(blue>>10,0x3C9);
983 987
984 } else 988 } else if (bpp == 16) { /* RGB 565 */
985 if (bpp == 16) /* RGB 565 */ 989 u32 col;
986 ((u32*)info->pseudo_palette)[regno] = (red & 0xF800) | 990
987 ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11); 991 col = (red & 0xF800) | ((green & 0xFC00) >> 5) |
988 else 992 ((blue & 0xF800) >> 11);
989 if (bpp == 32) /* ARGB 8888 */ 993 col |= col << 16;
994 ((u32 *)(info->pseudo_palette))[regno] = col;
995 } else if (bpp == 32) /* ARGB 8888 */
990 ((u32*)info->pseudo_palette)[regno] = 996 ((u32*)info->pseudo_palette)[regno] =
991 ((transp & 0xFF00) <<16) | 997 ((transp & 0xFF00) <<16) |
992 ((red & 0xFF00) << 8) | 998 ((red & 0xFF00) << 8) |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 9ed1a931dd31..a272592b0373 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
45}; 45};
46 46
47static int inverse = 0; 47static int inverse = 0;
48static int mtrr = 1; 48static int mtrr = 3; /* default to write-combining */
49static int vram_remap __initdata = 0; /* Set amount of memory to be used */ 49static int vram_remap __initdata = 0; /* Set amount of memory to be used */
50static int vram_total __initdata = 0; /* Set total amount of memory */ 50static int vram_total __initdata = 0; /* Set total amount of memory */
51static int pmi_setpal = 0; /* pmi for palette changes ??? */ 51static int pmi_setpal = 0; /* pmi for palette changes ??? */
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options)
204 pmi_setpal=0; 204 pmi_setpal=0;
205 else if (! strcmp(this_opt, "pmipal")) 205 else if (! strcmp(this_opt, "pmipal"))
206 pmi_setpal=1; 206 pmi_setpal=1;
207 else if (! strcmp(this_opt, "mtrr")) 207 else if (! strncmp(this_opt, "mtrr:", 5))
208 mtrr=1; 208 mtrr = simple_strtoul(this_opt+5, NULL, 0);
209 else if (! strcmp(this_opt, "nomtrr")) 209 else if (! strcmp(this_opt, "nomtrr"))
210 mtrr=0; 210 mtrr=0;
211 else if (! strncmp(this_opt, "vtotal:", 7)) 211 else if (! strncmp(this_opt, "vtotal:", 7))
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device)
387 387
388 if (mtrr) { 388 if (mtrr) {
389 unsigned int temp_size = size_total; 389 unsigned int temp_size = size_total;
390 /* Find the largest power-of-two */ 390 unsigned int type = 0;
391 while (temp_size & (temp_size - 1)) 391
392 temp_size &= (temp_size - 1); 392 switch (mtrr) {
393 393 case 1:
394 /* Try and find a power of two to add */ 394 type = MTRR_TYPE_UNCACHABLE;
395 while (temp_size > PAGE_SIZE && 395 break;
396 mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { 396 case 2:
397 temp_size >>= 1; 397 type = MTRR_TYPE_WRBACK;
398 break;
399 case 3:
400 type = MTRR_TYPE_WRCOMB;
401 break;
402 case 4:
403 type = MTRR_TYPE_WRTHROUGH;
404 break;
405 default:
406 type = 0;
407 break;
408 }
409
410 if (type) {
411 int rc;
412
413 /* Find the largest power-of-two */
414 while (temp_size & (temp_size - 1))
415 temp_size &= (temp_size - 1);
416
417 /* Try and find a power of two to add */
418 do {
419 rc = mtrr_add(vesafb_fix.smem_start, temp_size,
420 type, 1);
421 temp_size >>= 1;
422 } while (temp_size >= PAGE_SIZE && rc == -EINVAL);
398 } 423 }
399 } 424 }
400 425
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 4f120796273e..711b90903e7b 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -30,7 +30,7 @@ config W1_DS9490
30 This support is also available as a module. If so, the module 30 This support is also available as a module. If so, the module
31 will be called ds9490r.ko. 31 will be called ds9490r.ko.
32 32
33config W1_DS9490R_BRIDGE 33config W1_DS9490_BRIDGE
34 tristate "DS9490R USB <-> W1 transport layer for 1-wire" 34 tristate "DS9490R USB <-> W1 transport layer for 1-wire"
35 depends on W1_DS9490 35 depends on W1_DS9490
36 help 36 help
diff --git a/fs/Kconfig b/fs/Kconfig
index 5d0c4be43dba..e54be7058359 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -363,12 +363,15 @@ config INOTIFY
363 bool "Inotify file change notification support" 363 bool "Inotify file change notification support"
364 default y 364 default y
365 ---help--- 365 ---help---
366 Say Y here to enable inotify support and the /dev/inotify character 366 Say Y here to enable inotify support and the associated system
367 device. Inotify is a file change notification system and a 367 calls. Inotify is a file change notification system and a
368 replacement for dnotify. Inotify fixes numerous shortcomings in 368 replacement for dnotify. Inotify fixes numerous shortcomings in
369 dnotify and introduces several new features. It allows monitoring 369 dnotify and introduces several new features. It allows monitoring
370 of both files and directories via a single open fd. Multiple file 370 of both files and directories via a single open fd. Other features
371 events are supported. 371 include multiple file events, one-shot support, and unmount
372 notification.
373
374 For more information, see Documentation/filesystems/inotify.txt
372 375
373 If unsure, say Y. 376 If unsure, say Y.
374 377
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 9c09641ce907..fca83e28edcf 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -92,6 +92,7 @@ struct autofs_wait_queue {
92 92
93struct autofs_sb_info { 93struct autofs_sb_info {
94 u32 magic; 94 u32 magic;
95 struct dentry *root;
95 struct file *pipe; 96 struct file *pipe;
96 pid_t oz_pgrp; 97 pid_t oz_pgrp;
97 int catatonic; 98 int catatonic;
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 4bb14cc68040..0a3c05d10167 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -16,6 +16,7 @@
16#include <linux/pagemap.h> 16#include <linux/pagemap.h>
17#include <linux/parser.h> 17#include <linux/parser.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/smp_lock.h>
19#include "autofs_i.h" 20#include "autofs_i.h"
20#include <linux/module.h> 21#include <linux/module.h>
21 22
@@ -76,6 +77,66 @@ void autofs4_free_ino(struct autofs_info *ino)
76 kfree(ino); 77 kfree(ino);
77} 78}
78 79
80/*
81 * Deal with the infamous "Busy inodes after umount ..." message.
82 *
83 * Clean up the dentry tree. This happens with autofs if the user
84 * space program goes away due to a SIGKILL, SIGSEGV etc.
85 */
86static void autofs4_force_release(struct autofs_sb_info *sbi)
87{
88 struct dentry *this_parent = sbi->root;
89 struct list_head *next;
90
91 spin_lock(&dcache_lock);
92repeat:
93 next = this_parent->d_subdirs.next;
94resume:
95 while (next != &this_parent->d_subdirs) {
96 struct dentry *dentry = list_entry(next, struct dentry, d_child);
97
98 /* Negative dentry - don`t care */
99 if (!simple_positive(dentry)) {
100 next = next->next;
101 continue;
102 }
103
104 if (!list_empty(&dentry->d_subdirs)) {
105 this_parent = dentry;
106 goto repeat;
107 }
108
109 next = next->next;
110 spin_unlock(&dcache_lock);
111
112 DPRINTK("dentry %p %.*s",
113 dentry, (int)dentry->d_name.len, dentry->d_name.name);
114
115 dput(dentry);
116 spin_lock(&dcache_lock);
117 }
118
119 if (this_parent != sbi->root) {
120 struct dentry *dentry = this_parent;
121
122 next = this_parent->d_child.next;
123 this_parent = this_parent->d_parent;
124 spin_unlock(&dcache_lock);
125 DPRINTK("parent dentry %p %.*s",
126 dentry, (int)dentry->d_name.len, dentry->d_name.name);
127 dput(dentry);
128 spin_lock(&dcache_lock);
129 goto resume;
130 }
131 spin_unlock(&dcache_lock);
132
133 dput(sbi->root);
134 sbi->root = NULL;
135 shrink_dcache_sb(sbi->sb);
136
137 return;
138}
139
79static void autofs4_put_super(struct super_block *sb) 140static void autofs4_put_super(struct super_block *sb)
80{ 141{
81 struct autofs_sb_info *sbi = autofs4_sbi(sb); 142 struct autofs_sb_info *sbi = autofs4_sbi(sb);
@@ -85,6 +146,10 @@ static void autofs4_put_super(struct super_block *sb)
85 if ( !sbi->catatonic ) 146 if ( !sbi->catatonic )
86 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */ 147 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */
87 148
149 /* Clean up and release dangling references */
150 if (sbi)
151 autofs4_force_release(sbi);
152
88 kfree(sbi); 153 kfree(sbi);
89 154
90 DPRINTK("shutting down"); 155 DPRINTK("shutting down");
@@ -199,6 +264,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
199 264
200 s->s_fs_info = sbi; 265 s->s_fs_info = sbi;
201 sbi->magic = AUTOFS_SBI_MAGIC; 266 sbi->magic = AUTOFS_SBI_MAGIC;
267 sbi->root = NULL;
202 sbi->catatonic = 0; 268 sbi->catatonic = 0;
203 sbi->exp_timeout = 0; 269 sbi->exp_timeout = 0;
204 sbi->oz_pgrp = process_group(current); 270 sbi->oz_pgrp = process_group(current);
@@ -267,6 +333,13 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
267 sbi->pipe = pipe; 333 sbi->pipe = pipe;
268 334
269 /* 335 /*
336 * Take a reference to the root dentry so we get a chance to
337 * clean up the dentry tree on umount.
338 * See autofs4_force_release.
339 */
340 sbi->root = dget(root);
341
342 /*
270 * Success! Install the root dentry now to indicate completion. 343 * Success! Install the root dentry now to indicate completion.
271 */ 344 */
272 s->s_root = root; 345 s->s_root = root;
diff --git a/fs/bio.c b/fs/bio.c
index ca8f7a850fe3..1f2d4649b188 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -248,19 +248,16 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src)
248{ 248{
249 request_queue_t *q = bdev_get_queue(bio_src->bi_bdev); 249 request_queue_t *q = bdev_get_queue(bio_src->bi_bdev);
250 250
251 memcpy(bio->bi_io_vec, bio_src->bi_io_vec, bio_src->bi_max_vecs * sizeof(struct bio_vec)); 251 memcpy(bio->bi_io_vec, bio_src->bi_io_vec,
252 bio_src->bi_max_vecs * sizeof(struct bio_vec));
252 253
253 bio->bi_sector = bio_src->bi_sector; 254 bio->bi_sector = bio_src->bi_sector;
254 bio->bi_bdev = bio_src->bi_bdev; 255 bio->bi_bdev = bio_src->bi_bdev;
255 bio->bi_flags |= 1 << BIO_CLONED; 256 bio->bi_flags |= 1 << BIO_CLONED;
256 bio->bi_rw = bio_src->bi_rw; 257 bio->bi_rw = bio_src->bi_rw;
257
258 /*
259 * notes -- maybe just leave bi_idx alone. assume identical mapping
260 * for the clone
261 */
262 bio->bi_vcnt = bio_src->bi_vcnt; 258 bio->bi_vcnt = bio_src->bi_vcnt;
263 bio->bi_size = bio_src->bi_size; 259 bio->bi_size = bio_src->bi_size;
260 bio->bi_idx = bio_src->bi_idx;
264 bio_phys_segments(q, bio); 261 bio_phys_segments(q, bio);
265 bio_hw_segments(q, bio); 262 bio_hw_segments(q, bio);
266} 263}
diff --git a/fs/dcache.c b/fs/dcache.c
index 3aa8a7e980d8..a15a2e1f5520 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -19,6 +19,7 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/fsnotify.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/smp_lock.h> 25#include <linux/smp_lock.h>
@@ -101,6 +102,7 @@ static inline void dentry_iput(struct dentry * dentry)
101 list_del_init(&dentry->d_alias); 102 list_del_init(&dentry->d_alias);
102 spin_unlock(&dentry->d_lock); 103 spin_unlock(&dentry->d_lock);
103 spin_unlock(&dcache_lock); 104 spin_unlock(&dcache_lock);
105 fsnotify_inoderemove(inode);
104 if (dentry->d_op && dentry->d_op->d_iput) 106 if (dentry->d_op && dentry->d_op->d_iput)
105 dentry->d_op->d_iput(dentry, inode); 107 dentry->d_op->d_iput(dentry, inode);
106 else 108 else
@@ -1165,13 +1167,16 @@ out:
1165 1167
1166void d_delete(struct dentry * dentry) 1168void d_delete(struct dentry * dentry)
1167{ 1169{
1170 int isdir = 0;
1168 /* 1171 /*
1169 * Are we the only user? 1172 * Are we the only user?
1170 */ 1173 */
1171 spin_lock(&dcache_lock); 1174 spin_lock(&dcache_lock);
1172 spin_lock(&dentry->d_lock); 1175 spin_lock(&dentry->d_lock);
1176 isdir = S_ISDIR(dentry->d_inode->i_mode);
1173 if (atomic_read(&dentry->d_count) == 1) { 1177 if (atomic_read(&dentry->d_count) == 1) {
1174 dentry_iput(dentry); 1178 dentry_iput(dentry);
1179 fsnotify_nameremove(dentry, isdir);
1175 return; 1180 return;
1176 } 1181 }
1177 1182
@@ -1180,6 +1185,8 @@ void d_delete(struct dentry * dentry)
1180 1185
1181 spin_unlock(&dentry->d_lock); 1186 spin_unlock(&dentry->d_lock);
1182 spin_unlock(&dcache_lock); 1187 spin_unlock(&dcache_lock);
1188
1189 fsnotify_nameremove(dentry, isdir);
1183} 1190}
1184 1191
1185static void __d_rehash(struct dentry * entry, struct hlist_head *list) 1192static void __d_rehash(struct dentry * entry, struct hlist_head *list)
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 77e059149212..161f156d98c8 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -612,6 +612,7 @@ got:
612 err = ext2_init_acl(inode, dir); 612 err = ext2_init_acl(inode, dir);
613 if (err) { 613 if (err) {
614 DQUOT_FREE_INODE(inode); 614 DQUOT_FREE_INODE(inode);
615 DQUOT_DROP(inode);
615 goto fail2; 616 goto fail2;
616 } 617 }
617 mark_inode_dirty(inode); 618 mark_inode_dirty(inode);
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 27982b500e84..0099462d4271 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -823,7 +823,7 @@ cleanup:
823void 823void
824ext2_xattr_put_super(struct super_block *sb) 824ext2_xattr_put_super(struct super_block *sb)
825{ 825{
826 mb_cache_shrink(ext2_xattr_cache, sb->s_bdev); 826 mb_cache_shrink(sb->s_bdev);
827} 827}
828 828
829 829
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c
index 0aa5ac159c09..ca7f00312388 100644
--- a/fs/ext2/xip.c
+++ b/fs/ext2/xip.c
@@ -36,7 +36,7 @@ __ext2_get_sector(struct inode *inode, sector_t offset, int create,
36 *result = tmp.b_blocknr; 36 *result = tmp.b_blocknr;
37 37
38 /* did we get a sparse block (hole in the file)? */ 38 /* did we get a sparse block (hole in the file)? */
39 if (!(*result)) { 39 if (!tmp.b_blocknr && !rc) {
40 BUG_ON(create); 40 BUG_ON(create);
41 rc = -ENODATA; 41 rc = -ENODATA;
42 } 42 }
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 1e6f3ea28713..6981bd014ede 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -604,12 +604,14 @@ got:
604 err = ext3_init_acl(handle, inode, dir); 604 err = ext3_init_acl(handle, inode, dir);
605 if (err) { 605 if (err) {
606 DQUOT_FREE_INODE(inode); 606 DQUOT_FREE_INODE(inode);
607 DQUOT_DROP(inode);
607 goto fail2; 608 goto fail2;
608 } 609 }
609 err = ext3_mark_inode_dirty(handle, inode); 610 err = ext3_mark_inode_dirty(handle, inode);
610 if (err) { 611 if (err) {
611 ext3_std_error(sb, err); 612 ext3_std_error(sb, err);
612 DQUOT_FREE_INODE(inode); 613 DQUOT_FREE_INODE(inode);
614 DQUOT_DROP(inode);
613 goto fail2; 615 goto fail2;
614 } 616 }
615 617
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 3f9dfa643b19..269c7b92db9a 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1106,7 +1106,7 @@ cleanup:
1106void 1106void
1107ext3_xattr_put_super(struct super_block *sb) 1107ext3_xattr_put_super(struct super_block *sb)
1108{ 1108{
1109 mb_cache_shrink(ext3_xattr_cache, sb->s_bdev); 1109 mb_cache_shrink(sb->s_bdev);
1110} 1110}
1111 1111
1112/* 1112/*
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 286a9f8f3d49..6fbc9d8fcc36 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -288,7 +288,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
288 break; 288 break;
289 case F_SETLK: 289 case F_SETLK:
290 case F_SETLKW: 290 case F_SETLKW:
291 err = fcntl_setlk(filp, cmd, (struct flock __user *) arg); 291 err = fcntl_setlk(fd, filp, cmd, (struct flock __user *) arg);
292 break; 292 break;
293 case F_GETOWN: 293 case F_GETOWN:
294 /* 294 /*
@@ -376,7 +376,8 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
376 break; 376 break;
377 case F_SETLK64: 377 case F_SETLK64:
378 case F_SETLKW64: 378 case F_SETLKW64:
379 err = fcntl_setlk64(filp, cmd, (struct flock64 __user *) arg); 379 err = fcntl_setlk64(fd, filp, cmd,
380 (struct flock64 __user *) arg);
380 break; 381 break;
381 default: 382 default:
382 err = do_fcntl(fd, cmd, arg, filp); 383 err = do_fcntl(fd, cmd, arg, filp);
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c
index 6ad1211f84ed..a096c5a56664 100644
--- a/fs/hfs/bnode.c
+++ b/fs/hfs/bnode.c
@@ -480,6 +480,8 @@ void hfs_bnode_put(struct hfs_bnode *node)
480 return; 480 return;
481 } 481 }
482 for (i = 0; i < tree->pages_per_bnode; i++) { 482 for (i = 0; i < tree->pages_per_bnode; i++) {
483 if (!node->page[i])
484 continue;
483 mark_page_accessed(node->page[i]); 485 mark_page_accessed(node->page[i]);
484#if REF_PAGES 486#if REF_PAGES
485 put_page(node->page[i]); 487 put_page(node->page[i]);
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index cbc8510ad222..5ea6b3d45eaa 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -482,7 +482,8 @@ void hfs_file_truncate(struct inode *inode)
482 page_cache_release(page); 482 page_cache_release(page);
483 mark_inode_dirty(inode); 483 mark_inode_dirty(inode);
484 return; 484 return;
485 } 485 } else if (inode->i_size == HFS_I(inode)->phys_size)
486 return;
486 size = inode->i_size + HFS_SB(sb)->alloc_blksz - 1; 487 size = inode->i_size + HFS_SB(sb)->alloc_blksz - 1;
487 blk_cnt = size / HFS_SB(sb)->alloc_blksz; 488 blk_cnt = size / HFS_SB(sb)->alloc_blksz;
488 alloc_cnt = HFS_I(inode)->alloc_blocks; 489 alloc_cnt = HFS_I(inode)->alloc_blocks;
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index 267872e84d71..8868d3b766fd 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -643,6 +643,8 @@ void hfs_bnode_put(struct hfs_bnode *node)
643 return; 643 return;
644 } 644 }
645 for (i = 0; i < tree->pages_per_bnode; i++) { 645 for (i = 0; i < tree->pages_per_bnode; i++) {
646 if (!node->page[i])
647 continue;
646 mark_page_accessed(node->page[i]); 648 mark_page_accessed(node->page[i]);
647#if REF_PAGES 649#if REF_PAGES
648 put_page(node->page[i]); 650 put_page(node->page[i]);
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 376498cc64fd..e7235ca79a95 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -461,7 +461,9 @@ void hfsplus_file_truncate(struct inode *inode)
461 page_cache_release(page); 461 page_cache_release(page);
462 mark_inode_dirty(inode); 462 mark_inode_dirty(inode);
463 return; 463 return;
464 } 464 } else if (inode->i_size == HFSPLUS_I(inode).phys_size)
465 return;
466
465 blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift; 467 blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift;
466 alloc_cnt = HFSPLUS_I(inode).alloc_blocks; 468 alloc_cnt = HFSPLUS_I(inode).alloc_blocks;
467 if (blk_cnt == alloc_cnt) 469 if (blk_cnt == alloc_cnt)
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index c1516d013bf6..67bca0d4a33b 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -69,6 +69,7 @@ extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
69extern int write_file(int fd, unsigned long long *offset, const char *buf, 69extern int write_file(int fd, unsigned long long *offset, const char *buf,
70 int len); 70 int len);
71extern int lseek_file(int fd, long long offset, int whence); 71extern int lseek_file(int fd, long long offset, int whence);
72extern int fsync_file(int fd, int datasync);
72extern int file_create(char *name, int ur, int uw, int ux, int gr, 73extern int file_create(char *name, int ur, int uw, int ux, int gr,
73 int gw, int gx, int or, int ow, int ox); 74 int gw, int gx, int or, int ow, int ox);
74extern int set_attr(const char *file, struct hostfs_iattr *attrs); 75extern int set_attr(const char *file, struct hostfs_iattr *attrs);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 88e68caa3784..b2d18200a003 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -382,7 +382,7 @@ int hostfs_file_open(struct inode *ino, struct file *file)
382 382
383int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) 383int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync)
384{ 384{
385 return(0); 385 return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync);
386} 386}
387 387
388static struct file_operations hostfs_file_fops = { 388static struct file_operations hostfs_file_fops = {
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 4796e8490f7d..b97809deba66 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence)
153 int ret; 153 int ret;
154 154
155 ret = lseek64(fd, offset, whence); 155 ret = lseek64(fd, offset, whence);
156 if(ret < 0) return(-errno); 156 if(ret < 0)
157 return(-errno);
157 return(0); 158 return(0);
158} 159}
159 160
161int fsync_file(int fd, int datasync)
162{
163 int ret;
164 if (datasync)
165 ret = fdatasync(fd);
166 else
167 ret = fsync(fd);
168
169 if (ret < 0)
170 return -errno;
171 return 0;
172}
173
160void close_file(void *stream) 174void close_file(void *stream)
161{ 175{
162 close(*((int *) stream)); 176 close(*((int *) stream));
diff --git a/fs/inotify.c b/fs/inotify.c
index a8a714e48140..27ebcac5e07f 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -90,6 +90,7 @@ struct inotify_device {
90 unsigned int queue_size; /* size of the queue (bytes) */ 90 unsigned int queue_size; /* size of the queue (bytes) */
91 unsigned int event_count; /* number of pending events */ 91 unsigned int event_count; /* number of pending events */
92 unsigned int max_events; /* maximum number of events */ 92 unsigned int max_events; /* maximum number of events */
93 u32 last_wd; /* the last wd allocated */
93}; 94};
94 95
95/* 96/*
@@ -352,7 +353,7 @@ static int inotify_dev_get_wd(struct inotify_device *dev,
352 do { 353 do {
353 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL))) 354 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL)))
354 return -ENOSPC; 355 return -ENOSPC;
355 ret = idr_get_new(&dev->idr, watch, &watch->wd); 356 ret = idr_get_new_above(&dev->idr, watch, dev->last_wd, &watch->wd);
356 } while (ret == -EAGAIN); 357 } while (ret == -EAGAIN);
357 358
358 return ret; 359 return ret;
@@ -401,6 +402,7 @@ static struct inotify_watch *create_watch(struct inotify_device *dev,
401 return ERR_PTR(ret); 402 return ERR_PTR(ret);
402 } 403 }
403 404
405 dev->last_wd = ret;
404 watch->mask = mask; 406 watch->mask = mask;
405 atomic_set(&watch->count, 0); 407 atomic_set(&watch->count, 0);
406 INIT_LIST_HEAD(&watch->d_list); 408 INIT_LIST_HEAD(&watch->d_list);
@@ -899,6 +901,7 @@ asmlinkage long sys_inotify_init(void)
899 dev->queue_size = 0; 901 dev->queue_size = 0;
900 dev->max_events = inotify_max_queued_events; 902 dev->max_events = inotify_max_queued_events;
901 dev->user = user; 903 dev->user = user;
904 dev->last_wd = 0;
902 atomic_set(&dev->count, 0); 905 atomic_set(&dev->count, 0);
903 906
904 get_inotify_dev(dev); 907 get_inotify_dev(dev);
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 34a44e451689..4917315db732 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -129,8 +129,14 @@ static int zisofs_readpage(struct file *file, struct page *page)
129 cend = le32_to_cpu(*(__le32 *)(bh->b_data + (blockendptr & bufmask))); 129 cend = le32_to_cpu(*(__le32 *)(bh->b_data + (blockendptr & bufmask)));
130 brelse(bh); 130 brelse(bh);
131 131
132 if (cstart > cend)
133 goto eio;
134
132 csize = cend-cstart; 135 csize = cend-cstart;
133 136
137 if (csize > deflateBound(1UL << zisofs_block_shift))
138 goto eio;
139
134 /* Now page[] contains an array of pages, any of which can be NULL, 140 /* Now page[] contains an array of pages, any of which can be NULL,
135 and the locks on which we hold. We should now read the data and 141 and the locks on which we hold. We should now read the data and
136 release the pages. If the pages are NULL the decompressed data 142 release the pages. If the pages are NULL the decompressed data
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index fc589ddd0762..456d7e6e29c2 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -3397,6 +3397,9 @@ jffs_garbage_collect_thread(void *ptr)
3397 siginfo_t info; 3397 siginfo_t info;
3398 unsigned long signr = 0; 3398 unsigned long signr = 0;
3399 3399
3400 if (try_to_freeze())
3401 continue;
3402
3400 spin_lock_irq(&current->sighand->siglock); 3403 spin_lock_irq(&current->sighand->siglock);
3401 signr = dequeue_signal(current, &current->blocked, &info); 3404 signr = dequeue_signal(current, &current->blocked, &info);
3402 spin_unlock_irq(&current->sighand->siglock); 3405 spin_unlock_irq(&current->sighand->siglock);
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 0732f206ca60..c739626f5bf1 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -75,7 +75,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
75 int nblocks); 75 int nblocks);
76static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); 76static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
77static void dbBackSplit(dmtree_t * tp, int leafno); 77static void dbBackSplit(dmtree_t * tp, int leafno);
78static void dbJoin(dmtree_t * tp, int leafno, int newval); 78static int dbJoin(dmtree_t * tp, int leafno, int newval);
79static void dbAdjTree(dmtree_t * tp, int leafno, int newval); 79static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
80static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, 80static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
81 int level); 81 int level);
@@ -98,8 +98,8 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
98static int dbFindBits(u32 word, int l2nb); 98static int dbFindBits(u32 word, int l2nb);
99static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno); 99static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
100static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx); 100static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx);
101static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, 101static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
102 int nblocks); 102 int nblocks);
103static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, 103static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
104 int nblocks); 104 int nblocks);
105static int dbMaxBud(u8 * cp); 105static int dbMaxBud(u8 * cp);
@@ -378,6 +378,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
378 378
379 /* free the blocks. */ 379 /* free the blocks. */
380 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) { 380 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
381 jfs_error(ip->i_sb, "dbFree: error in block map\n");
381 release_metapage(mp); 382 release_metapage(mp);
382 IREAD_UNLOCK(ipbmap); 383 IREAD_UNLOCK(ipbmap);
383 return (rc); 384 return (rc);
@@ -2020,7 +2021,7 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2020 int nblocks) 2021 int nblocks)
2021{ 2022{
2022 s8 oldroot; 2023 s8 oldroot;
2023 int rc, word; 2024 int rc = 0, word;
2024 2025
2025 /* save the current value of the root (i.e. maximum free string) 2026 /* save the current value of the root (i.e. maximum free string)
2026 * of the dmap tree. 2027 * of the dmap tree.
@@ -2028,11 +2029,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2028 oldroot = dp->tree.stree[ROOT]; 2029 oldroot = dp->tree.stree[ROOT];
2029 2030
2030 /* free the specified (blocks) bits */ 2031 /* free the specified (blocks) bits */
2031 dbFreeBits(bmp, dp, blkno, nblocks); 2032 rc = dbFreeBits(bmp, dp, blkno, nblocks);
2032 2033
2033 /* if the root has not changed, done. */ 2034 /* if error or the root has not changed, done. */
2034 if (dp->tree.stree[ROOT] == oldroot) 2035 if (rc || (dp->tree.stree[ROOT] == oldroot))
2035 return (0); 2036 return (rc);
2036 2037
2037 /* root changed. bubble the change up to the dmap control pages. 2038 /* root changed. bubble the change up to the dmap control pages.
2038 * if the adjustment of the upper level control pages fails, 2039 * if the adjustment of the upper level control pages fails,
@@ -2221,15 +2222,16 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2221 * blkno - starting block number of the bits to be freed. 2222 * blkno - starting block number of the bits to be freed.
2222 * nblocks - number of bits to be freed. 2223 * nblocks - number of bits to be freed.
2223 * 2224 *
2224 * RETURN VALUES: none 2225 * RETURN VALUES: 0 for success
2225 * 2226 *
2226 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; 2227 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2227 */ 2228 */
2228static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, 2229static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2229 int nblocks) 2230 int nblocks)
2230{ 2231{
2231 int dbitno, word, rembits, nb, nwords, wbitno, nw, agno; 2232 int dbitno, word, rembits, nb, nwords, wbitno, nw, agno;
2232 dmtree_t *tp = (dmtree_t *) & dp->tree; 2233 dmtree_t *tp = (dmtree_t *) & dp->tree;
2234 int rc = 0;
2233 int size; 2235 int size;
2234 2236
2235 /* determine the bit number and word within the dmap of the 2237 /* determine the bit number and word within the dmap of the
@@ -2278,8 +2280,10 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2278 2280
2279 /* update the leaf for this dmap word. 2281 /* update the leaf for this dmap word.
2280 */ 2282 */
2281 dbJoin(tp, word, 2283 rc = dbJoin(tp, word,
2282 dbMaxBud((u8 *) & dp->wmap[word])); 2284 dbMaxBud((u8 *) & dp->wmap[word]));
2285 if (rc)
2286 return rc;
2283 2287
2284 word += 1; 2288 word += 1;
2285 } else { 2289 } else {
@@ -2310,7 +2314,9 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2310 2314
2311 /* update the leaf. 2315 /* update the leaf.
2312 */ 2316 */
2313 dbJoin(tp, word, size); 2317 rc = dbJoin(tp, word, size);
2318 if (rc)
2319 return rc;
2314 2320
2315 /* get the number of dmap words handled. 2321 /* get the number of dmap words handled.
2316 */ 2322 */
@@ -2357,6 +2363,8 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2357 } 2363 }
2358 2364
2359 BMAP_UNLOCK(bmp); 2365 BMAP_UNLOCK(bmp);
2366
2367 return 0;
2360} 2368}
2361 2369
2362 2370
@@ -2464,7 +2472,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
2464 } 2472 }
2465 dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); 2473 dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
2466 } else { 2474 } else {
2467 dbJoin((dmtree_t *) dcp, leafno, newval); 2475 rc = dbJoin((dmtree_t *) dcp, leafno, newval);
2476 if (rc)
2477 return rc;
2468 } 2478 }
2469 2479
2470 /* check if the root of the current dmap control page changed due 2480 /* check if the root of the current dmap control page changed due
@@ -2689,7 +2699,7 @@ static void dbBackSplit(dmtree_t * tp, int leafno)
2689 * 2699 *
2690 * RETURN VALUES: none 2700 * RETURN VALUES: none
2691 */ 2701 */
2692static void dbJoin(dmtree_t * tp, int leafno, int newval) 2702static int dbJoin(dmtree_t * tp, int leafno, int newval)
2693{ 2703{
2694 int budsz, buddy; 2704 int budsz, buddy;
2695 s8 *leaf; 2705 s8 *leaf;
@@ -2729,7 +2739,9 @@ static void dbJoin(dmtree_t * tp, int leafno, int newval)
2729 if (newval > leaf[buddy]) 2739 if (newval > leaf[buddy])
2730 break; 2740 break;
2731 2741
2732 assert(newval == leaf[buddy]); 2742 /* It shouldn't be less */
2743 if (newval < leaf[buddy])
2744 return -EIO;
2733 2745
2734 /* check which (leafno or buddy) is the left buddy. 2746 /* check which (leafno or buddy) is the left buddy.
2735 * the left buddy gets to claim the blocks resulting 2747 * the left buddy gets to claim the blocks resulting
@@ -2761,6 +2773,8 @@ static void dbJoin(dmtree_t * tp, int leafno, int newval)
2761 /* update the leaf value. 2773 /* update the leaf value.
2762 */ 2774 */
2763 dbAdjTree(tp, leafno, newval); 2775 dbAdjTree(tp, leafno, newval);
2776
2777 return 0;
2764} 2778}
2765 2779
2766 2780
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 73b5fc7eda80..404f33eae507 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -381,9 +381,12 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
381 * It's time to move the inline table to an external 381 * It's time to move the inline table to an external
382 * page and begin to build the xtree 382 * page and begin to build the xtree
383 */ 383 */
384 if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage) || 384 if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage))
385 dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) 385 goto clean_up;
386 goto clean_up; /* No space */ 386 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
387 DQUOT_FREE_BLOCK(ip, sbi->nbperpage);
388 goto clean_up;
389 }
387 390
388 /* 391 /*
389 * Save the table, we're going to overwrite it with the 392 * Save the table, we're going to overwrite it with the
@@ -397,13 +400,15 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
397 xtInitRoot(tid, ip); 400 xtInitRoot(tid, ip);
398 401
399 /* 402 /*
400 * Allocate the first block & add it to the xtree 403 * Add the first block to the xtree
401 */ 404 */
402 if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { 405 if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) {
403 /* This really shouldn't fail */ 406 /* This really shouldn't fail */
404 jfs_warn("add_index: xtInsert failed!"); 407 jfs_warn("add_index: xtInsert failed!");
405 memcpy(&jfs_ip->i_dirtable, temp_table, 408 memcpy(&jfs_ip->i_dirtable, temp_table,
406 sizeof (temp_table)); 409 sizeof (temp_table));
410 dbFree(ip, xaddr, sbi->nbperpage);
411 DQUOT_FREE_BLOCK(ip, sbi->nbperpage);
407 goto clean_up; 412 goto clean_up;
408 } 413 }
409 ip->i_size = PSIZE; 414 ip->i_size = PSIZE;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 79d07624bfe1..22815e88e7cc 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1030,7 +1030,8 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait)
1030 * starting until all current transactions are completed 1030 * starting until all current transactions are completed
1031 * by setting syncbarrier flag. 1031 * by setting syncbarrier flag.
1032 */ 1032 */
1033 if (written > LOGSYNC_BARRIER(logsize) && logsize > 32 * LOGPSIZE) { 1033 if (!test_bit(log_SYNCBARRIER, &log->flag) &&
1034 (written > LOGSYNC_BARRIER(logsize)) && log->active) {
1034 set_bit(log_SYNCBARRIER, &log->flag); 1035 set_bit(log_SYNCBARRIER, &log->flag);
1035 jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn, 1036 jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn,
1036 log->syncpt); 1037 log->syncpt);
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 6c5485d16c39..13d7e3f1feb4 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -561,7 +561,6 @@ static int metapage_releasepage(struct page *page, int gfp_mask)
561 dump_mem("page", page, sizeof(struct page)); 561 dump_mem("page", page, sizeof(struct page));
562 dump_stack(); 562 dump_stack();
563 } 563 }
564 WARN_ON(mp->lsn);
565 if (mp->lsn) 564 if (mp->lsn)
566 remove_from_logsync(mp); 565 remove_from_logsync(mp);
567 remove_metapage(page, mp); 566 remove_metapage(page, mp);
@@ -641,7 +640,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
641 } else { 640 } else {
642 page = read_cache_page(mapping, page_index, 641 page = read_cache_page(mapping, page_index,
643 (filler_t *)mapping->a_ops->readpage, NULL); 642 (filler_t *)mapping->a_ops->readpage, NULL);
644 if (IS_ERR(page)) { 643 if (IS_ERR(page) || !PageUptodate(page)) {
645 jfs_err("read_cache_page failed!"); 644 jfs_err("read_cache_page failed!");
646 return NULL; 645 return NULL;
647 } 646 }
@@ -783,14 +782,6 @@ void release_metapage(struct metapage * mp)
783 if (test_bit(META_discard, &mp->flag) && !mp->count) { 782 if (test_bit(META_discard, &mp->flag) && !mp->count) {
784 clear_page_dirty(page); 783 clear_page_dirty(page);
785 ClearPageUptodate(page); 784 ClearPageUptodate(page);
786#ifdef _NOT_YET
787 if (page->mapping) {
788 /* Remove from page cache and page cache reference */
789 remove_from_page_cache(page);
790 page_cache_release(page);
791 metapage_releasepage(page, 0);
792 }
793#endif
794 } 785 }
795#else 786#else
796 /* Try to keep metapages from using up too much memory */ 787 /* Try to keep metapages from using up too much memory */
diff --git a/fs/locks.c b/fs/locks.c
index 29fa5da6c117..11956b6179ff 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1591,7 +1591,8 @@ out:
1591/* Apply the lock described by l to an open file descriptor. 1591/* Apply the lock described by l to an open file descriptor.
1592 * This implements both the F_SETLK and F_SETLKW commands of fcntl(). 1592 * This implements both the F_SETLK and F_SETLKW commands of fcntl().
1593 */ 1593 */
1594int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l) 1594int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
1595 struct flock __user *l)
1595{ 1596{
1596 struct file_lock *file_lock = locks_alloc_lock(); 1597 struct file_lock *file_lock = locks_alloc_lock();
1597 struct flock flock; 1598 struct flock flock;
@@ -1620,6 +1621,7 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l)
1620 goto out; 1621 goto out;
1621 } 1622 }
1622 1623
1624again:
1623 error = flock_to_posix_lock(filp, file_lock, &flock); 1625 error = flock_to_posix_lock(filp, file_lock, &flock);
1624 if (error) 1626 if (error)
1625 goto out; 1627 goto out;
@@ -1648,25 +1650,33 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l)
1648 if (error) 1650 if (error)
1649 goto out; 1651 goto out;
1650 1652
1651 if (filp->f_op && filp->f_op->lock != NULL) { 1653 if (filp->f_op && filp->f_op->lock != NULL)
1652 error = filp->f_op->lock(filp, cmd, file_lock); 1654 error = filp->f_op->lock(filp, cmd, file_lock);
1653 goto out; 1655 else {
1654 } 1656 for (;;) {
1657 error = __posix_lock_file(inode, file_lock);
1658 if ((error != -EAGAIN) || (cmd == F_SETLK))
1659 break;
1660 error = wait_event_interruptible(file_lock->fl_wait,
1661 !file_lock->fl_next);
1662 if (!error)
1663 continue;
1655 1664
1656 for (;;) { 1665 locks_delete_block(file_lock);
1657 error = __posix_lock_file(inode, file_lock);
1658 if ((error != -EAGAIN) || (cmd == F_SETLK))
1659 break; 1666 break;
1660 error = wait_event_interruptible(file_lock->fl_wait, 1667 }
1661 !file_lock->fl_next); 1668 }
1662 if (!error)
1663 continue;
1664 1669
1665 locks_delete_block(file_lock); 1670 /*
1666 break; 1671 * Attempt to detect a close/fcntl race and recover by
1672 * releasing the lock that was just acquired.
1673 */
1674 if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
1675 flock.l_type = F_UNLCK;
1676 goto again;
1667 } 1677 }
1668 1678
1669 out: 1679out:
1670 locks_free_lock(file_lock); 1680 locks_free_lock(file_lock);
1671 return error; 1681 return error;
1672} 1682}
@@ -1724,7 +1734,8 @@ out:
1724/* Apply the lock described by l to an open file descriptor. 1734/* Apply the lock described by l to an open file descriptor.
1725 * This implements both the F_SETLK and F_SETLKW commands of fcntl(). 1735 * This implements both the F_SETLK and F_SETLKW commands of fcntl().
1726 */ 1736 */
1727int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l) 1737int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
1738 struct flock64 __user *l)
1728{ 1739{
1729 struct file_lock *file_lock = locks_alloc_lock(); 1740 struct file_lock *file_lock = locks_alloc_lock();
1730 struct flock64 flock; 1741 struct flock64 flock;
@@ -1753,6 +1764,7 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
1753 goto out; 1764 goto out;
1754 } 1765 }
1755 1766
1767again:
1756 error = flock64_to_posix_lock(filp, file_lock, &flock); 1768 error = flock64_to_posix_lock(filp, file_lock, &flock);
1757 if (error) 1769 if (error)
1758 goto out; 1770 goto out;
@@ -1781,22 +1793,30 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
1781 if (error) 1793 if (error)
1782 goto out; 1794 goto out;
1783 1795
1784 if (filp->f_op && filp->f_op->lock != NULL) { 1796 if (filp->f_op && filp->f_op->lock != NULL)
1785 error = filp->f_op->lock(filp, cmd, file_lock); 1797 error = filp->f_op->lock(filp, cmd, file_lock);
1786 goto out; 1798 else {
1787 } 1799 for (;;) {
1800 error = __posix_lock_file(inode, file_lock);
1801 if ((error != -EAGAIN) || (cmd == F_SETLK64))
1802 break;
1803 error = wait_event_interruptible(file_lock->fl_wait,
1804 !file_lock->fl_next);
1805 if (!error)
1806 continue;
1788 1807
1789 for (;;) { 1808 locks_delete_block(file_lock);
1790 error = __posix_lock_file(inode, file_lock);
1791 if ((error != -EAGAIN) || (cmd == F_SETLK64))
1792 break; 1809 break;
1793 error = wait_event_interruptible(file_lock->fl_wait, 1810 }
1794 !file_lock->fl_next); 1811 }
1795 if (!error)
1796 continue;
1797 1812
1798 locks_delete_block(file_lock); 1813 /*
1799 break; 1814 * Attempt to detect a close/fcntl race and recover by
1815 * releasing the lock that was just acquired.
1816 */
1817 if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
1818 flock.l_type = F_UNLCK;
1819 goto again;
1800 } 1820 }
1801 1821
1802out: 1822out:
@@ -1888,12 +1908,7 @@ void locks_remove_flock(struct file *filp)
1888 1908
1889 while ((fl = *before) != NULL) { 1909 while ((fl = *before) != NULL) {
1890 if (fl->fl_file == filp) { 1910 if (fl->fl_file == filp) {
1891 /* 1911 if (IS_FLOCK(fl)) {
1892 * We might have a POSIX lock that was created at the same time
1893 * the filp was closed for the last time. Just remove that too,
1894 * regardless of ownership, since nobody can own it.
1895 */
1896 if (IS_FLOCK(fl) || IS_POSIX(fl)) {
1897 locks_delete_lock(before); 1912 locks_delete_lock(before);
1898 continue; 1913 continue;
1899 } 1914 }
diff --git a/fs/mbcache.c b/fs/mbcache.c
index c7170b9221a3..b002a088857d 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -316,11 +316,10 @@ fail:
316 * currently in use cannot be freed, and thus remain in the cache. All others 316 * currently in use cannot be freed, and thus remain in the cache. All others
317 * are freed. 317 * are freed.
318 * 318 *
319 * @cache: which cache to shrink
320 * @bdev: which device's cache entries to shrink 319 * @bdev: which device's cache entries to shrink
321 */ 320 */
322void 321void
323mb_cache_shrink(struct mb_cache *cache, struct block_device *bdev) 322mb_cache_shrink(struct block_device *bdev)
324{ 323{
325 LIST_HEAD(free_list); 324 LIST_HEAD(free_list);
326 struct list_head *l, *ltmp; 325 struct list_head *l, *ltmp;
diff --git a/fs/namei.c b/fs/namei.c
index e252b12d39be..264e232addda 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1801,7 +1801,6 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
1801 } 1801 }
1802 up(&dentry->d_inode->i_sem); 1802 up(&dentry->d_inode->i_sem);
1803 if (!error) { 1803 if (!error) {
1804 fsnotify_rmdir(dentry, dentry->d_inode, dir);
1805 d_delete(dentry); 1804 d_delete(dentry);
1806 } 1805 }
1807 dput(dentry); 1806 dput(dentry);
@@ -1874,7 +1873,6 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
1874 1873
1875 /* We don't d_delete() NFS sillyrenamed files--they still exist. */ 1874 /* We don't d_delete() NFS sillyrenamed files--they still exist. */
1876 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { 1875 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
1877 fsnotify_unlink(dentry, dir);
1878 d_delete(dentry); 1876 d_delete(dentry);
1879 } 1877 }
1880 1878
@@ -2218,7 +2216,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2218 error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry); 2216 error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
2219 if (!error) { 2217 if (!error) {
2220 const char *new_name = old_dentry->d_name.name; 2218 const char *new_name = old_dentry->d_name.name;
2221 fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir); 2219 fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir, new_dentry->d_inode);
2222 } 2220 }
2223 fsnotify_oldname_free(old_name); 2221 fsnotify_oldname_free(old_name);
2224 2222
diff --git a/fs/namespace.c b/fs/namespace.c
index 587eb0d707ee..79bd8a46e1e7 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -160,7 +160,7 @@ clone_mnt(struct vfsmount *old, struct dentry *root)
160 mnt->mnt_root = dget(root); 160 mnt->mnt_root = dget(root);
161 mnt->mnt_mountpoint = mnt->mnt_root; 161 mnt->mnt_mountpoint = mnt->mnt_root;
162 mnt->mnt_parent = mnt; 162 mnt->mnt_parent = mnt;
163 mnt->mnt_namespace = old->mnt_namespace; 163 mnt->mnt_namespace = current->namespace;
164 164
165 /* stick the duplicate mount on the same expiry list 165 /* stick the duplicate mount on the same expiry list
166 * as the original if that was on one */ 166 * as the original if that was on one */
diff --git a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
index df749cc0aac8..c8064cae8f17 100644
--- a/fs/ntfs/sysctl.h
+++ b/fs/ntfs/sysctl.h
@@ -26,7 +26,7 @@
26 26
27#include <linux/config.h> 27#include <linux/config.h>
28 28
29#if (DEBUG && CONFIG_SYSCTL) 29#if defined(DEBUG) && defined(CONFIG_SYSCTL)
30 30
31extern int ntfs_sysctl(int add); 31extern int ntfs_sysctl(int add);
32 32
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 1aaf2c7d44e6..d9f614a57731 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1980,7 +1980,17 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1980 out_inserted_sd: 1980 out_inserted_sd:
1981 inode->i_nlink = 0; 1981 inode->i_nlink = 0;
1982 th->t_trans_id = 0; /* so the caller can't use this handle later */ 1982 th->t_trans_id = 0; /* so the caller can't use this handle later */
1983 iput(inode); 1983
1984 /* If we were inheriting an ACL, we need to release the lock so that
1985 * iput doesn't deadlock in reiserfs_delete_xattrs. The locking
1986 * code really needs to be reworked, but this will take care of it
1987 * for now. -jeffm */
1988 if (REISERFS_I(dir)->i_acl_default) {
1989 reiserfs_write_unlock_xattrs(dir->i_sb);
1990 iput(inode);
1991 reiserfs_write_lock_xattrs(dir->i_sb);
1992 } else
1993 iput(inode);
1984 return err; 1994 return err;
1985} 1995}
1986 1996
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index c66c27ec4100..ca7989b04be3 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -556,14 +556,14 @@ static inline void insert_journal_hash(struct reiserfs_journal_cnode **table,
556} 556}
557 557
558/* lock the current transaction */ 558/* lock the current transaction */
559inline static void lock_journal(struct super_block *p_s_sb) 559static inline void lock_journal(struct super_block *p_s_sb)
560{ 560{
561 PROC_INFO_INC(p_s_sb, journal.lock_journal); 561 PROC_INFO_INC(p_s_sb, journal.lock_journal);
562 down(&SB_JOURNAL(p_s_sb)->j_lock); 562 down(&SB_JOURNAL(p_s_sb)->j_lock);
563} 563}
564 564
565/* unlock the current transaction */ 565/* unlock the current transaction */
566inline static void unlock_journal(struct super_block *p_s_sb) 566static inline void unlock_journal(struct super_block *p_s_sb)
567{ 567{
568 up(&SB_JOURNAL(p_s_sb)->j_lock); 568 up(&SB_JOURNAL(p_s_sb)->j_lock);
569} 569}
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index e386d3db3051..87ac9dc8b381 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -39,7 +39,6 @@
39#include <linux/xattr.h> 39#include <linux/xattr.h>
40#include <linux/reiserfs_xattr.h> 40#include <linux/reiserfs_xattr.h>
41#include <linux/reiserfs_acl.h> 41#include <linux/reiserfs_acl.h>
42#include <linux/mbcache.h>
43#include <asm/uaccess.h> 42#include <asm/uaccess.h>
44#include <asm/checksum.h> 43#include <asm/checksum.h>
45#include <linux/smp_lock.h> 44#include <linux/smp_lock.h>
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 335288b9be0f..4013d7905e84 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -437,8 +437,8 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
437{ 437{
438 struct dentry *dir = kobj->dentry; 438 struct dentry *dir = kobj->dentry;
439 struct dentry *victim; 439 struct dentry *victim;
440 struct sysfs_dirent *sd; 440 struct inode * inode;
441 umode_t umode = (mode & S_IALLUGO) | S_IFREG; 441 struct iattr newattrs;
442 int res = -ENOENT; 442 int res = -ENOENT;
443 443
444 down(&dir->d_inode->i_sem); 444 down(&dir->d_inode->i_sem);
@@ -446,13 +446,15 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
446 if (!IS_ERR(victim)) { 446 if (!IS_ERR(victim)) {
447 if (victim->d_inode && 447 if (victim->d_inode &&
448 (victim->d_parent->d_inode == dir->d_inode)) { 448 (victim->d_parent->d_inode == dir->d_inode)) {
449 sd = victim->d_fsdata; 449 inode = victim->d_inode;
450 attr->mode = mode; 450 down(&inode->i_sem);
451 sd->s_mode = umode; 451 newattrs.ia_mode = (mode & S_IALLUGO) |
452 victim->d_inode->i_mode = umode; 452 (inode->i_mode & ~S_IALLUGO);
453 dput(victim); 453 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
454 res = 0; 454 res = notify_change(victim, &newattrs);
455 up(&inode->i_sem);
455 } 456 }
457 dput(victim);
456 } 458 }
457 up(&dir->d_inode->i_sem); 459 up(&dir->d_inode->i_sem);
458 460
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 8de13bafaa76..d727dc960634 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -85,7 +85,7 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
85 85
86 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) 86 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
87 mode &= ~S_ISGID; 87 mode &= ~S_ISGID;
88 sd_iattr->ia_mode = mode; 88 sd_iattr->ia_mode = sd->s_mode = mode;
89 } 89 }
90 90
91 return error; 91 return error;
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index caeaa71a5663..579fe191b7e7 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -56,8 +56,9 @@
56/* ACPI PCI Interrupt Link (pci_link.c) */ 56/* ACPI PCI Interrupt Link (pci_link.c) */
57 57
58int acpi_irq_penalty_init (void); 58int acpi_irq_penalty_init (void);
59int acpi_pci_link_get_irq (acpi_handle handle, int index, int *edge_level, 59int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level,
60 int *active_high_low, char **name); 60 int *active_high_low, char **name);
61int acpi_pci_link_free_irq(acpi_handle handle);
61 62
62/* ACPI PCI Interrupt Routing (pci_irq.c) */ 63/* ACPI PCI Interrupt Routing (pci_irq.c) */
63 64
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 28957697e59c..f681e675b823 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -251,6 +251,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
251extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *, 251extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
252 struct resource *); 252 struct resource *);
253 253
254extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
255 struct pci_bus_region *region);
256
254#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 257#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
255 258
256static inline int pci_proc_domain(struct pci_bus *bus) 259static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 535bc425f243..ef25b6585119 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -377,8 +377,13 @@
377#define __NR_add_key 439 377#define __NR_add_key 439
378#define __NR_request_key 440 378#define __NR_request_key 440
379#define __NR_keyctl 441 379#define __NR_keyctl 441
380#define __NR_ioprio_set 442
381#define __NR_ioprio_get 443
382#define __NR_inotify_init 444
383#define __NR_inotify_add_watch 445
384#define __NR_inotify_rm_watch 446
380 385
381#define NR_SYSCALLS 442 386#define NR_SYSCALLS 447
382 387
383#if defined(__GNUC__) 388#if defined(__GNUC__)
384 389
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index c1adc6b3e86d..aad7aad026b3 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -229,6 +229,7 @@ extern int _find_next_zero_bit_be(const void * p, int size, int offset);
229extern int _find_first_bit_be(const unsigned long *p, unsigned size); 229extern int _find_first_bit_be(const unsigned long *p, unsigned size);
230extern int _find_next_bit_be(const unsigned long *p, int size, int offset); 230extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
231 231
232#ifndef CONFIG_SMP
232/* 233/*
233 * The __* form of bitops are non-atomic and may be reordered. 234 * The __* form of bitops are non-atomic and may be reordered.
234 */ 235 */
@@ -241,6 +242,10 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
241 (__builtin_constant_p(nr) ? \ 242 (__builtin_constant_p(nr) ? \
242 ____atomic_##name(nr, p) : \ 243 ____atomic_##name(nr, p) : \
243 _##name##_be(nr,p)) 244 _##name##_be(nr,p))
245#else
246#define ATOMIC_BITOP_LE(name,nr,p) _##name##_le(nr,p)
247#define ATOMIC_BITOP_BE(name,nr,p) _##name##_be(nr,p)
248#endif
244 249
245#define NONATOMIC_BITOP(name,nr,p) \ 250#define NONATOMIC_BITOP(name,nr,p) \
246 (____nonatomic_##name(nr, p)) 251 (____nonatomic_##name(nr, p))
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index b28f1c95dd62..38ea5899a580 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -60,6 +60,10 @@ extern void
60pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 60pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
61 struct resource *res); 61 struct resource *res);
62 62
63extern void
64pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
65 struct pci_bus_region *region);
66
63static inline void pcibios_add_platform_entries(struct pci_dev *dev) 67static inline void pcibios_add_platform_entries(struct pci_dev *dev)
64{ 68{
65} 69}
diff --git a/include/asm-cris/arch-v10/atomic.h b/include/asm-cris/arch-v10/atomic.h
new file mode 100644
index 000000000000..6ef5e7d09024
--- /dev/null
+++ b/include/asm-cris/arch-v10/atomic.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_CRIS_ARCH_ATOMIC__
2#define __ASM_CRIS_ARCH_ATOMIC__
3
4#define cris_atomic_save(addr, flags) local_irq_save(flags);
5#define cris_atomic_restore(addr, flags) local_irq_restore(flags);
6
7#endif
diff --git a/include/asm-cris/arch-v10/bitops.h b/include/asm-cris/arch-v10/bitops.h
index 21b7ae8c9bb3..b73f5396e5a6 100644
--- a/include/asm-cris/arch-v10/bitops.h
+++ b/include/asm-cris/arch-v10/bitops.h
@@ -51,7 +51,7 @@ extern inline unsigned long ffz(unsigned long w)
51 * 51 *
52 * Undefined if no bit exists, so code should check against 0 first. 52 * Undefined if no bit exists, so code should check against 0 first.
53 */ 53 */
54extern __inline__ unsigned long __ffs(unsigned long word) 54extern inline unsigned long __ffs(unsigned long word)
55{ 55{
56 return cris_swapnwbrlz(~word); 56 return cris_swapnwbrlz(~word);
57} 57}
diff --git a/include/asm-cris/arch-v10/dma.h b/include/asm-cris/arch-v10/dma.h
index 9e078b9bc934..ecb9dba6fa4f 100644
--- a/include/asm-cris/arch-v10/dma.h
+++ b/include/asm-cris/arch-v10/dma.h
@@ -44,3 +44,31 @@
44#define USB_RX_DMA_NBR 9 44#define USB_RX_DMA_NBR 9
45 45
46#endif 46#endif
47
48enum dma_owner
49{
50 dma_eth,
51 dma_ser0,
52 dma_ser1, /* Async and sync */
53 dma_ser2,
54 dma_ser3, /* Async and sync */
55 dma_ata,
56 dma_par0,
57 dma_par1,
58 dma_ext0,
59 dma_ext1,
60 dma_int6,
61 dma_int7,
62 dma_usb,
63 dma_scsi0,
64 dma_scsi1
65};
66
67/* Masks used by cris_request_dma options: */
68#define DMA_VERBOSE_ON_ERROR (1<<0)
69#define DMA_PANIC_ON_ERROR ((1<<1)|DMA_VERBOSE_ON_ERROR)
70
71int cris_request_dma(unsigned int dmanr, const char * device_id,
72 unsigned options, enum dma_owner owner);
73
74void cris_free_dma(unsigned int dmanr, const char * device_id);
diff --git a/include/asm-cris/arch-v10/elf.h b/include/asm-cris/arch-v10/elf.h
index 2a2201ca538e..1c38ee728b17 100644
--- a/include/asm-cris/arch-v10/elf.h
+++ b/include/asm-cris/arch-v10/elf.h
@@ -1,6 +1,16 @@
1#ifndef __ASMCRIS_ARCH_ELF_H 1#ifndef __ASMCRIS_ARCH_ELF_H
2#define __ASMCRIS_ARCH_ELF_H 2#define __ASMCRIS_ARCH_ELF_H
3 3
4#define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10
5
6/*
7 * This is used to ensure we don't load something for the wrong architecture.
8 */
9#define elf_check_arch(x) \
10 ((x)->e_machine == EM_CRIS \
11 && ((((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_ANY_V0_V10 \
12 || (((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_COMMON_V10_V32))))
13
4/* 14/*
5 * ELF register definitions.. 15 * ELF register definitions..
6 */ 16 */
diff --git a/include/asm-cris/arch-v10/ide.h b/include/asm-cris/arch-v10/ide.h
new file mode 100644
index 000000000000..8cf2d7cb22ac
--- /dev/null
+++ b/include/asm-cris/arch-v10/ide.h
@@ -0,0 +1,99 @@
1/*
2 * linux/include/asm-cris/ide.h
3 *
4 * Copyright (C) 2000, 2001, 2002 Axis Communications AB
5 *
6 * Authors: Bjorn Wesen
7 *
8 */
9
10/*
11 * This file contains the ETRAX 100LX specific IDE code.
12 */
13
14#ifndef __ASMCRIS_IDE_H
15#define __ASMCRIS_IDE_H
16
17#ifdef __KERNEL__
18
19#include <asm/arch/svinto.h>
20#include <asm/io.h>
21#include <asm-generic/ide_iops.h>
22
23
24/* ETRAX 100 can support 4 IDE busses on the same pins (serialized) */
25
26#define MAX_HWIFS 4
27
28extern __inline__ int ide_default_irq(unsigned long base)
29{
30 /* all IDE busses share the same IRQ, number 4.
31 * this has the side-effect that ide-probe.c will cluster our 4 interfaces
32 * together in a hwgroup, and will serialize accesses. this is good, because
33 * we can't access more than one interface at the same time on ETRAX100.
34 */
35 return 4;
36}
37
38extern __inline__ unsigned long ide_default_io_base(int index)
39{
40 /* we have no real I/O base address per interface, since all go through the
41 * same register. but in a bitfield in that register, we have the i/f number.
42 * so we can use the io_base to remember that bitfield.
43 */
44 static const unsigned long io_bases[MAX_HWIFS] = {
45 IO_FIELD(R_ATA_CTRL_DATA, sel, 0),
46 IO_FIELD(R_ATA_CTRL_DATA, sel, 1),
47 IO_FIELD(R_ATA_CTRL_DATA, sel, 2),
48 IO_FIELD(R_ATA_CTRL_DATA, sel, 3)
49 };
50 return io_bases[index];
51}
52
53/* this is called once for each interface, to setup the port addresses. data_port is the result
54 * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us.
55 */
56
57extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq)
58{
59 int i;
60
61 /* fill in ports for ATA addresses 0 to 7 */
62
63 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
64 hw->io_ports[i] = data_port |
65 IO_FIELD(R_ATA_CTRL_DATA, addr, i) |
66 IO_STATE(R_ATA_CTRL_DATA, cs0, active);
67 }
68
69 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
70
71 hw->io_ports[IDE_CONTROL_OFFSET] = data_port |
72 IO_FIELD(R_ATA_CTRL_DATA, addr, 6) |
73 IO_STATE(R_ATA_CTRL_DATA, cs1, active);
74
75 /* whats this for ? */
76
77 hw->io_ports[IDE_IRQ_OFFSET] = 0;
78}
79
80extern __inline__ void ide_init_default_hwifs(void)
81{
82 hw_regs_t hw;
83 int index;
84
85 for(index = 0; index < MAX_HWIFS; index++) {
86 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
87 hw.irq = ide_default_irq(ide_default_io_base(index));
88 ide_register_hw(&hw, NULL);
89 }
90}
91
92/* some configuration options we don't need */
93
94#undef SUPPORT_VLB_SYNC
95#define SUPPORT_VLB_SYNC 0
96
97#endif /* __KERNEL__ */
98
99#endif /* __ASMCRIS_IDE_H */
diff --git a/include/asm-cris/arch-v10/io.h b/include/asm-cris/arch-v10/io.h
index 0bc38a0313c1..dd39198ec67d 100644
--- a/include/asm-cris/arch-v10/io.h
+++ b/include/asm-cris/arch-v10/io.h
@@ -6,6 +6,7 @@
6 6
7/* Etrax shadow registers - which live in arch/cris/kernel/shadows.c */ 7/* Etrax shadow registers - which live in arch/cris/kernel/shadows.c */
8 8
9extern unsigned long gen_config_ii_shadow;
9extern unsigned long port_g_data_shadow; 10extern unsigned long port_g_data_shadow;
10extern unsigned char port_pa_dir_shadow; 11extern unsigned char port_pa_dir_shadow;
11extern unsigned char port_pa_data_shadow; 12extern unsigned char port_pa_data_shadow;
diff --git a/include/asm-cris/arch-v10/io_interface_mux.h b/include/asm-cris/arch-v10/io_interface_mux.h
new file mode 100644
index 000000000000..d92500080883
--- /dev/null
+++ b/include/asm-cris/arch-v10/io_interface_mux.h
@@ -0,0 +1,75 @@
1/* IO interface mux allocator for ETRAX100LX.
2 * Copyright 2004, Axis Communications AB
3 * $Id: io_interface_mux.h,v 1.1 2004/12/13 12:21:53 starvik Exp $
4 */
5
6
7#ifndef _IO_INTERFACE_MUX_H
8#define _IO_INTERFACE_MUX_H
9
10
11/* C.f. ETRAX100LX Designer's Reference 20.9 */
12
13/* The order in enum must match the order of interfaces[] in
14 * io_interface_mux.c */
15enum cris_io_interface {
16 /* Begin Non-multiplexed interfaces */
17 if_eth = 0,
18 if_serial_0,
19 /* End Non-multiplexed interfaces */
20 if_serial_1,
21 if_serial_2,
22 if_serial_3,
23 if_sync_serial_1,
24 if_sync_serial_3,
25 if_shared_ram,
26 if_shared_ram_w,
27 if_par_0,
28 if_par_1,
29 if_par_w,
30 if_scsi8_0,
31 if_scsi8_1,
32 if_scsi_w,
33 if_ata,
34 if_csp,
35 if_i2c,
36 if_usb_1,
37 if_usb_2,
38 /* GPIO pins */
39 if_gpio_grp_a,
40 if_gpio_grp_b,
41 if_gpio_grp_c,
42 if_gpio_grp_d,
43 if_gpio_grp_e,
44 if_gpio_grp_f,
45 if_max_interfaces,
46 if_unclaimed
47};
48
49int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id);
50
51void cris_free_io_interface(enum cris_io_interface ioif);
52
53/* port can be 'a', 'b' or 'g' */
54int cris_io_interface_allocate_pins(const enum cris_io_interface ioif,
55 const char port,
56 const unsigned start_bit,
57 const unsigned stop_bit);
58
59/* port can be 'a', 'b' or 'g' */
60int cris_io_interface_free_pins(const enum cris_io_interface ioif,
61 const char port,
62 const unsigned start_bit,
63 const unsigned stop_bit);
64
65int cris_io_interface_register_watcher(void (*notify)(const unsigned int gpio_in_available,
66 const unsigned int gpio_out_available,
67 const unsigned char pa_available,
68 const unsigned char pb_available));
69
70void cris_io_interface_delete_watcher(void (*notify)(const unsigned int gpio_in_available,
71 const unsigned int gpio_out_available,
72 const unsigned char pa_available,
73 const unsigned char pb_available));
74
75#endif /* _IO_INTERFACE_MUX_H */
diff --git a/include/asm-cris/arch-v10/irq.h b/include/asm-cris/arch-v10/irq.h
index a2a6e1533ea0..4fa8945b0263 100644
--- a/include/asm-cris/arch-v10/irq.h
+++ b/include/asm-cris/arch-v10/irq.h
@@ -74,12 +74,9 @@ struct etrax_interrupt_vector {
74}; 74};
75 75
76extern struct etrax_interrupt_vector *etrax_irv; 76extern struct etrax_interrupt_vector *etrax_irv;
77void set_int_vector(int n, irqvectptr addr, irqvectptr saddr); 77void set_int_vector(int n, irqvectptr addr);
78void set_break_vector(int n, irqvectptr addr); 78void set_break_vector(int n, irqvectptr addr);
79 79
80#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
81#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
82
83#define __STR(x) #x 80#define __STR(x) #x
84#define STR(x) __STR(x) 81#define STR(x) __STR(x)
85 82
@@ -121,26 +118,17 @@ void set_break_vector(int n, irqvectptr addr);
121 118
122#define BUILD_IRQ(nr,mask) \ 119#define BUILD_IRQ(nr,mask) \
123void IRQ_NAME(nr); \ 120void IRQ_NAME(nr); \
124void sIRQ_NAME(nr); \
125void BAD_IRQ_NAME(nr); \
126__asm__ ( \ 121__asm__ ( \
127 ".text\n\t" \ 122 ".text\n\t" \
128 "IRQ" #nr "_interrupt:\n\t" \ 123 "IRQ" #nr "_interrupt:\n\t" \
129 SAVE_ALL \ 124 SAVE_ALL \
130 "sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \
131 BLOCK_IRQ(mask,nr) /* this must be done to prevent irq loops when we ei later */ \ 125 BLOCK_IRQ(mask,nr) /* this must be done to prevent irq loops when we ei later */ \
132 "moveq "#nr",$r10\n\t" \ 126 "moveq "#nr",$r10\n\t" \
133 "move.d $sp,$r11\n\t" \ 127 "move.d $sp,$r11\n\t" \
134 "jsr do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \ 128 "jsr do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \
135 UNBLOCK_IRQ(mask) \ 129 UNBLOCK_IRQ(mask) \
136 "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \ 130 "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \
137 "jump ret_from_intr\n\t" \ 131 "jump ret_from_intr\n\t");
138 "bad_IRQ" #nr "_interrupt:\n\t" \
139 "push $r0\n\t" \
140 BLOCK_IRQ(mask,nr) \
141 "pop $r0\n\t" \
142 "reti\n\t" \
143 "nop\n");
144 132
145/* This is subtle. The timer interrupt is crucial and it should not be disabled for 133/* This is subtle. The timer interrupt is crucial and it should not be disabled for
146 * too long. However, if it had been a normal interrupt as per BUILD_IRQ, it would 134 * too long. However, if it had been a normal interrupt as per BUILD_IRQ, it would
@@ -159,23 +147,14 @@ __asm__ ( \
159 147
160#define BUILD_TIMER_IRQ(nr,mask) \ 148#define BUILD_TIMER_IRQ(nr,mask) \
161void IRQ_NAME(nr); \ 149void IRQ_NAME(nr); \
162void sIRQ_NAME(nr); \
163void BAD_IRQ_NAME(nr); \
164__asm__ ( \ 150__asm__ ( \
165 ".text\n\t" \ 151 ".text\n\t" \
166 "IRQ" #nr "_interrupt:\n\t" \ 152 "IRQ" #nr "_interrupt:\n\t" \
167 SAVE_ALL \ 153 SAVE_ALL \
168 "sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \
169 "moveq "#nr",$r10\n\t" \ 154 "moveq "#nr",$r10\n\t" \
170 "move.d $sp,$r11\n\t" \ 155 "move.d $sp,$r11\n\t" \
171 "jsr do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \ 156 "jsr do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \
172 "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \ 157 "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \
173 "jump ret_from_intr\n\t" \ 158 "jump ret_from_intr\n\t");
174 "bad_IRQ" #nr "_interrupt:\n\t" \
175 "push $r0\n\t" \
176 BLOCK_IRQ(mask,nr) \
177 "pop $r0\n\t" \
178 "reti\n\t" \
179 "nop\n");
180 159
181#endif 160#endif
diff --git a/include/asm-cris/arch-v10/memmap.h b/include/asm-cris/arch-v10/memmap.h
new file mode 100644
index 000000000000..13f3b971407f
--- /dev/null
+++ b/include/asm-cris/arch-v10/memmap.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_ARCH_MEMMAP_H
2#define _ASM_ARCH_MEMMAP_H
3
4#define MEM_CSE0_START (0x00000000)
5#define MEM_CSE0_SIZE (0x04000000)
6#define MEM_CSE1_START (0x04000000)
7#define MEM_CSE1_SIZE (0x04000000)
8#define MEM_CSR0_START (0x08000000)
9#define MEM_CSR1_START (0x0c000000)
10#define MEM_CSP0_START (0x10000000)
11#define MEM_CSP1_START (0x14000000)
12#define MEM_CSP2_START (0x18000000)
13#define MEM_CSP3_START (0x1c000000)
14#define MEM_CSP4_START (0x20000000)
15#define MEM_CSP5_START (0x24000000)
16#define MEM_CSP6_START (0x28000000)
17#define MEM_CSP7_START (0x2c000000)
18#define MEM_DRAM_START (0x40000000)
19
20#define MEM_NON_CACHEABLE (0x80000000)
21
22#endif
diff --git a/include/asm-cris/arch-v10/mmu.h b/include/asm-cris/arch-v10/mmu.h
index d18aa00e50bc..df84f1716e6b 100644
--- a/include/asm-cris/arch-v10/mmu.h
+++ b/include/asm-cris/arch-v10/mmu.h
@@ -7,7 +7,10 @@
7 7
8/* type used in struct mm to couple an MMU context to an active mm */ 8/* type used in struct mm to couple an MMU context to an active mm */
9 9
10typedef unsigned int mm_context_t; 10typedef struct
11{
12 unsigned int page_id;
13} mm_context_t;
11 14
12/* kernel memory segments */ 15/* kernel memory segments */
13 16
diff --git a/include/asm-cris/arch-v10/offset.h b/include/asm-cris/arch-v10/offset.h
index fcbd77eab281..675b51d85639 100644
--- a/include/asm-cris/arch-v10/offset.h
+++ b/include/asm-cris/arch-v10/offset.h
@@ -25,7 +25,7 @@
25#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */ 25#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
26#define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */ 26#define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */
27 27
28#define TASK_pid 133 /* offsetof(struct task_struct, pid) */ 28#define TASK_pid 141 /* offsetof(struct task_struct, pid) */
29 29
30#define LCLONE_VM 256 /* CLONE_VM */ 30#define LCLONE_VM 256 /* CLONE_VM */
31#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */ 31#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */
diff --git a/include/asm-cris/arch-v10/processor.h b/include/asm-cris/arch-v10/processor.h
index 9355d8675a58..e23df8dc96e8 100644
--- a/include/asm-cris/arch-v10/processor.h
+++ b/include/asm-cris/arch-v10/processor.h
@@ -59,4 +59,12 @@ struct thread_struct {
59 wrusp(usp); \ 59 wrusp(usp); \
60} while(0) 60} while(0)
61 61
62/* Called when handling a kernel bus fault fixup.
63 *
64 * After a fixup we do not want to return by restoring the CPU-state
65 * anymore, so switch frame-types (see ptrace.h)
66 */
67#define arch_fixup(regs) \
68 regs->frametype = CRIS_FRAME_NORMAL;
69
62#endif 70#endif
diff --git a/include/asm-cris/arch-v10/system.h b/include/asm-cris/arch-v10/system.h
index 781ca30229a8..6cc35642b8ab 100644
--- a/include/asm-cris/arch-v10/system.h
+++ b/include/asm-cris/arch-v10/system.h
@@ -11,6 +11,8 @@ extern inline unsigned long rdvr(void) {
11 return vr; 11 return vr;
12} 12}
13 13
14#define cris_machine_name "cris"
15
14/* read/write the user-mode stackpointer */ 16/* read/write the user-mode stackpointer */
15 17
16extern inline unsigned long rdusp(void) { 18extern inline unsigned long rdusp(void) {
diff --git a/include/asm-cris/arch-v32/arbiter.h b/include/asm-cris/arch-v32/arbiter.h
new file mode 100644
index 000000000000..dba3c285cacd
--- /dev/null
+++ b/include/asm-cris/arch-v32/arbiter.h
@@ -0,0 +1,30 @@
1#ifndef _ASM_CRIS_ARCH_ARBITER_H
2#define _ASM_CRIS_ARCH_ARBITER_H
3
4#define EXT_REGION 0
5#define INT_REGION 1
6
7typedef void (watch_callback)(void);
8
9enum
10{
11 arbiter_all_dmas = 0x3ff,
12 arbiter_cpu = 0xc00,
13 arbiter_all_clients = 0x3fff
14};
15
16enum
17{
18 arbiter_all_read = 0x55,
19 arbiter_all_write = 0xaa,
20 arbiter_all_accesses = 0xff
21};
22
23int crisv32_arbiter_allocate_bandwith(int client, int region,
24 unsigned long bandwidth);
25int crisv32_arbiter_watch(unsigned long start, unsigned long size,
26 unsigned long clients, unsigned long accesses,
27 watch_callback* cb);
28int crisv32_arbiter_unwatch(int id);
29
30#endif
diff --git a/include/asm-cris/arch-v32/atomic.h b/include/asm-cris/arch-v32/atomic.h
new file mode 100644
index 000000000000..bbfb7a5ae315
--- /dev/null
+++ b/include/asm-cris/arch-v32/atomic.h
@@ -0,0 +1,36 @@
1#ifndef __ASM_CRIS_ARCH_ATOMIC__
2#define __ASM_CRIS_ARCH_ATOMIC__
3
4#include <asm/system.h>
5
6extern void cris_spin_unlock(void *l, int val);
7extern void cris_spin_lock(void *l);
8extern int cris_spin_trylock(void* l);
9
10#ifndef CONFIG_SMP
11#define cris_atomic_save(addr, flags) local_irq_save(flags);
12#define cris_atomic_restore(addr, flags) local_irq_restore(flags);
13#else
14
15extern spinlock_t cris_atomic_locks[];
16#define LOCK_COUNT 128
17#define HASH_ADDR(a) (((int)a) & 127)
18
19#define cris_atomic_save(addr, flags) \
20 local_irq_save(flags); \
21 cris_spin_lock((void*)&cris_atomic_locks[HASH_ADDR(addr)].lock);
22
23#define cris_atomic_restore(addr, flags) \
24 { \
25 spinlock_t *lock = (void*)&cris_atomic_locks[HASH_ADDR(addr)]; \
26 __asm__ volatile ("move.d %1,%0" \
27 : "=m" (lock->lock) \
28 : "r" (1) \
29 : "memory"); \
30 local_irq_restore(flags); \
31 }
32
33#endif
34
35#endif
36
diff --git a/include/asm-cris/arch-v32/bitops.h b/include/asm-cris/arch-v32/bitops.h
new file mode 100644
index 000000000000..e40a58d3b862
--- /dev/null
+++ b/include/asm-cris/arch-v32/bitops.h
@@ -0,0 +1,64 @@
1#ifndef _ASM_CRIS_ARCH_BITOPS_H
2#define _ASM_CRIS_ARCH_BITOPS_H
3
4/*
5 * Helper functions for the core of the ff[sz] functions. They compute the
6 * number of leading zeroes of a bits-in-byte, byte-in-word and
7 * word-in-dword-swapped number. They differ in that the first function also
8 * inverts all bits in the input.
9 */
10
11extern inline unsigned long
12cris_swapnwbrlz(unsigned long w)
13{
14 unsigned long res;
15
16 __asm__ __volatile__ ("swapnwbr %0\n\t"
17 "lz %0,%0"
18 : "=r" (res) : "0" (w));
19
20 return res;
21}
22
23extern inline unsigned long
24cris_swapwbrlz(unsigned long w)
25{
26 unsigned long res;
27
28 __asm__ __volatile__ ("swapwbr %0\n\t"
29 "lz %0,%0"
30 : "=r" (res) : "0" (w));
31
32 return res;
33}
34
35/*
36 * Find First Zero in word. Undefined if no zero exist, so the caller should
37 * check against ~0 first.
38 */
39extern inline unsigned long
40ffz(unsigned long w)
41{
42 return cris_swapnwbrlz(w);
43}
44
45/*
46 * Find First Set bit in word. Undefined if no 1 exist, so the caller
47 * should check against 0 first.
48 */
49extern inline unsigned long
50__ffs(unsigned long w)
51{
52 return cris_swapnwbrlz(~w);
53}
54
55/*
56 * Find First Bit that is set.
57 */
58extern inline unsigned long
59kernel_ffs(unsigned long w)
60{
61 return w ? cris_swapwbrlz (w) + 1 : 0;
62}
63
64#endif /* _ASM_CRIS_ARCH_BITOPS_H */
diff --git a/include/asm-cris/arch-v32/byteorder.h b/include/asm-cris/arch-v32/byteorder.h
new file mode 100644
index 000000000000..74846ee6cf99
--- /dev/null
+++ b/include/asm-cris/arch-v32/byteorder.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
2#define _ASM_CRIS_ARCH_BYTEORDER_H
3
4#include <asm/types.h>
5
6extern __inline__ __const__ __u32
7___arch__swab32(__u32 x)
8{
9 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
10 return (x);
11}
12
13extern __inline__ __const__ __u16
14___arch__swab16(__u16 x)
15{
16 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
17 return (x);
18}
19
20#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
diff --git a/include/asm-cris/arch-v32/cache.h b/include/asm-cris/arch-v32/cache.h
new file mode 100644
index 000000000000..4fed8d62ccc8
--- /dev/null
+++ b/include/asm-cris/arch-v32/cache.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_CRIS_ARCH_CACHE_H
2#define _ASM_CRIS_ARCH_CACHE_H
3
4/* A cache-line is 32 bytes. */
5#define L1_CACHE_BYTES 32
6#define L1_CACHE_SHIFT 5
7#define L1_CACHE_SHIFT_MAX 5
8
9#endif /* _ASM_CRIS_ARCH_CACHE_H */
diff --git a/include/asm-cris/arch-v32/checksum.h b/include/asm-cris/arch-v32/checksum.h
new file mode 100644
index 000000000000..a1d6b2a6cc44
--- /dev/null
+++ b/include/asm-cris/arch-v32/checksum.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_CRIS_ARCH_CHECKSUM_H
2#define _ASM_CRIS_ARCH_CHECKSUM_H
3
4/*
5 * Check values used in TCP/UDP headers.
6 *
7 * The gain of doing this in assembler instead of C, is that C doesn't
8 * generate carry-additions for the 32-bit components of the
9 * checksum. Which means it would be necessary to split all those into
10 * 16-bit components and then add.
11 */
12extern inline unsigned int
13csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
14 unsigned short len, unsigned short proto, unsigned int sum)
15{
16 int res;
17
18 __asm__ __volatile__ ("add.d %2, %0\n\t"
19 "addc %3, %0\n\t"
20 "addc %4, %0\n\t"
21 "addc 0, %0\n\t"
22 : "=r" (res)
23 : "0" (sum), "r" (daddr), "r" (saddr), \
24 "r" ((ntohs(len) << 16) + (proto << 8)));
25
26 return res;
27}
28
29#endif /* _ASM_CRIS_ARCH_CHECKSUM_H */
diff --git a/include/asm-cris/arch-v32/cryptocop.h b/include/asm-cris/arch-v32/cryptocop.h
new file mode 100644
index 000000000000..dfa1f66fb987
--- /dev/null
+++ b/include/asm-cris/arch-v32/cryptocop.h
@@ -0,0 +1,272 @@
1/*
2 * The device /dev/cryptocop is accessible using this driver using
3 * CRYPTOCOP_MAJOR (254) and minor number 0.
4 */
5
6#ifndef CRYPTOCOP_H
7#define CRYPTOCOP_H
8
9#include <linux/uio.h>
10
11
12#define CRYPTOCOP_SESSION_ID_NONE (0)
13
14typedef unsigned long long int cryptocop_session_id;
15
16/* cryptocop ioctls */
17#define ETRAXCRYPTOCOP_IOCTYPE (250)
18
19#define CRYPTOCOP_IO_CREATE_SESSION _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op)
20#define CRYPTOCOP_IO_CLOSE_SESSION _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op)
21#define CRYPTOCOP_IO_PROCESS_OP _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op)
22#define CRYPTOCOP_IO_MAXNR (3)
23
24typedef enum {
25 cryptocop_cipher_des = 0,
26 cryptocop_cipher_3des = 1,
27 cryptocop_cipher_aes = 2,
28 cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */
29 cryptocop_cipher_none
30} cryptocop_cipher_type;
31
32typedef enum {
33 cryptocop_digest_sha1 = 0,
34 cryptocop_digest_md5 = 1,
35 cryptocop_digest_none
36} cryptocop_digest_type;
37
38typedef enum {
39 cryptocop_csum_le = 0,
40 cryptocop_csum_be = 1,
41 cryptocop_csum_none
42} cryptocop_csum_type;
43
44typedef enum {
45 cryptocop_cipher_mode_ecb = 0,
46 cryptocop_cipher_mode_cbc,
47 cryptocop_cipher_mode_none
48} cryptocop_cipher_mode;
49
50typedef enum {
51 cryptocop_3des_eee = 0,
52 cryptocop_3des_eed = 1,
53 cryptocop_3des_ede = 2,
54 cryptocop_3des_edd = 3,
55 cryptocop_3des_dee = 4,
56 cryptocop_3des_ded = 5,
57 cryptocop_3des_dde = 6,
58 cryptocop_3des_ddd = 7
59} cryptocop_3des_mode;
60
61/* Usermode accessible (ioctl) operations. */
62struct strcop_session_op{
63 cryptocop_session_id ses_id;
64
65 cryptocop_cipher_type cipher; /* AES, DES, 3DES, m2m, none */
66
67 cryptocop_cipher_mode cmode; /* ECB, CBC, none */
68 cryptocop_3des_mode des3_mode;
69
70 cryptocop_digest_type digest; /* MD5, SHA1, none */
71
72 cryptocop_csum_type csum; /* BE, LE, none */
73
74 unsigned char *key;
75 size_t keylen;
76};
77
78#define CRYPTOCOP_CSUM_LENGTH (2)
79#define CRYPTOCOP_MAX_DIGEST_LENGTH (20) /* SHA-1 20, MD5 16 */
80#define CRYPTOCOP_MAX_IV_LENGTH (16) /* (3)DES==8, AES == 16 */
81#define CRYPTOCOP_MAX_KEY_LENGTH (32)
82
83struct strcop_crypto_op{
84 cryptocop_session_id ses_id;
85
86 /* Indata. */
87 unsigned char *indata;
88 size_t inlen; /* Total indata length. */
89
90 /* Cipher configuration. */
91 unsigned char do_cipher:1;
92 unsigned char decrypt:1; /* 1 == decrypt, 0 == encrypt */
93 unsigned char cipher_explicit:1;
94 size_t cipher_start;
95 size_t cipher_len;
96 /* cipher_iv is used if do_cipher and cipher_explicit and the cipher
97 mode is CBC. The length is controlled by the type of cipher,
98 e.g. DES/3DES 8 octets and AES 16 octets. */
99 unsigned char cipher_iv[CRYPTOCOP_MAX_IV_LENGTH];
100 /* Outdata. */
101 unsigned char *cipher_outdata;
102 size_t cipher_outlen;
103
104 /* digest configuration. */
105 unsigned char do_digest:1;
106 size_t digest_start;
107 size_t digest_len;
108 /* Outdata. The actual length is determined by the type of the digest. */
109 unsigned char digest[CRYPTOCOP_MAX_DIGEST_LENGTH];
110
111 /* Checksum configuration. */
112 unsigned char do_csum:1;
113 size_t csum_start;
114 size_t csum_len;
115 /* Outdata. */
116 unsigned char csum[CRYPTOCOP_CSUM_LENGTH];
117};
118
119
120
121#ifdef __KERNEL__
122
123/********** The API to use from inside the kernel. ************/
124
125#include <asm/arch/hwregs/dma.h>
126
127typedef enum {
128 cryptocop_alg_csum = 0,
129 cryptocop_alg_mem2mem,
130 cryptocop_alg_md5,
131 cryptocop_alg_sha1,
132 cryptocop_alg_des,
133 cryptocop_alg_3des,
134 cryptocop_alg_aes,
135 cryptocop_no_alg,
136} cryptocop_algorithm;
137
138typedef u8 cryptocop_tfrm_id;
139
140
141struct cryptocop_operation;
142
143typedef void (cryptocop_callback)(struct cryptocop_operation*, void*);
144
145struct cryptocop_transform_init {
146 cryptocop_algorithm alg;
147 /* Keydata for ciphers. */
148 unsigned char key[CRYPTOCOP_MAX_KEY_LENGTH];
149 unsigned int keylen;
150 cryptocop_cipher_mode cipher_mode;
151 cryptocop_3des_mode tdes_mode;
152 cryptocop_csum_type csum_mode; /* cryptocop_csum_none is not allowed when alg==cryptocop_alg_csum */
153
154 cryptocop_tfrm_id tid; /* Locally unique in session; assigned by user, checked by driver. */
155 struct cryptocop_transform_init *next;
156};
157
158
159typedef enum {
160 cryptocop_source_dma = 0,
161 cryptocop_source_des,
162 cryptocop_source_3des,
163 cryptocop_source_aes,
164 cryptocop_source_md5,
165 cryptocop_source_sha1,
166 cryptocop_source_csum,
167 cryptocop_source_none,
168} cryptocop_source;
169
170
171struct cryptocop_desc_cfg {
172 cryptocop_tfrm_id tid;
173 cryptocop_source src;
174 unsigned int last:1; /* Last use of this transform in the operation. Will push outdata when encountered. */
175 struct cryptocop_desc_cfg *next;
176};
177
178struct cryptocop_desc {
179 size_t length;
180 struct cryptocop_desc_cfg *cfg;
181 struct cryptocop_desc *next;
182};
183
184
185/* Flags for cryptocop_tfrm_cfg */
186#define CRYPTOCOP_NO_FLAG (0x00)
187#define CRYPTOCOP_ENCRYPT (0x01)
188#define CRYPTOCOP_DECRYPT (0x02)
189#define CRYPTOCOP_EXPLICIT_IV (0x04)
190
191struct cryptocop_tfrm_cfg {
192 cryptocop_tfrm_id tid;
193
194 unsigned int flags; /* DECRYPT, ENCRYPT, EXPLICIT_IV */
195
196 /* CBC initialisation vector for cihers. */
197 u8 iv[CRYPTOCOP_MAX_IV_LENGTH];
198
199 /* The position in output where to write the transform output. The order
200 in which the driver writes the output is unspecified, hence if several
201 transforms write on the same positions in the output the result is
202 unspecified. */
203 size_t inject_ix;
204
205 struct cryptocop_tfrm_cfg *next;
206};
207
208
209
210struct cryptocop_dma_list_operation{
211 /* The consumer can provide DMA lists to send to the co-processor. 'use_dmalists' in
212 struct cryptocop_operation must be set for the driver to use them. outlist,
213 out_data_buf, inlist and in_data_buf must all be physical addresses since they will
214 be loaded to DMA . */
215 dma_descr_data *outlist; /* Out from memory to the co-processor. */
216 char *out_data_buf;
217 dma_descr_data *inlist; /* In from the co-processor to memory. */
218 char *in_data_buf;
219
220 cryptocop_3des_mode tdes_mode;
221 cryptocop_csum_type csum_mode;
222};
223
224
225struct cryptocop_tfrm_operation{
226 /* Operation configuration, if not 'use_dmalists' is set. */
227 struct cryptocop_tfrm_cfg *tfrm_cfg;
228 struct cryptocop_desc *desc;
229
230 struct iovec *indata;
231 size_t incount;
232 size_t inlen; /* Total inlength. */
233
234 struct iovec *outdata;
235 size_t outcount;
236 size_t outlen; /* Total outlength. */
237};
238
239
240struct cryptocop_operation {
241 cryptocop_callback *cb;
242 void *cb_data;
243
244 cryptocop_session_id sid;
245
246 /* The status of the operation when returned to consumer. */
247 int operation_status; /* 0, -EAGAIN */
248
249 /* Flags */
250 unsigned int use_dmalists:1; /* Use outlist and inlist instead of the desc/tfrm_cfg configuration. */
251 unsigned int in_interrupt:1; /* Set if inserting job from interrupt context. */
252 unsigned int fast_callback:1; /* Set if fast callback wanted, i.e. from interrupt context. */
253
254 union{
255 struct cryptocop_dma_list_operation list_op;
256 struct cryptocop_tfrm_operation tfrm_op;
257 };
258};
259
260
261int cryptocop_new_session(cryptocop_session_id *sid, struct cryptocop_transform_init *tinit, int alloc_flag);
262int cryptocop_free_session(cryptocop_session_id sid);
263
264int cryptocop_job_queue_insert_csum(struct cryptocop_operation *operation);
265
266int cryptocop_job_queue_insert_crypto(struct cryptocop_operation *operation);
267
268int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation);
269
270#endif /* __KERNEL__ */
271
272#endif /* CRYPTOCOP_H */
diff --git a/include/asm-cris/arch-v32/delay.h b/include/asm-cris/arch-v32/delay.h
new file mode 100644
index 000000000000..f36f7f760e89
--- /dev/null
+++ b/include/asm-cris/arch-v32/delay.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_CRIS_ARCH_DELAY_H
2#define _ASM_CRIS_ARCH_DELAY_H
3
4extern __inline__ void
5__delay(int loops)
6{
7 __asm__ __volatile__ (
8 "move.d %0, $r9\n\t"
9 "beq 2f\n\t"
10 "subq 1, $r9\n\t"
11 "1:\n\t"
12 "bne 1b\n\t"
13 "subq 1, $r9\n"
14 "2:"
15 : : "g" (loops) : "r9");
16}
17
18#endif /* _ASM_CRIS_ARCH_DELAY_H */
diff --git a/include/asm-cris/arch-v32/dma.h b/include/asm-cris/arch-v32/dma.h
new file mode 100644
index 000000000000..3674081389fd
--- /dev/null
+++ b/include/asm-cris/arch-v32/dma.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_ARCH_CRIS_DMA_H
2#define _ASM_ARCH_CRIS_DMA_H
3
4/* Defines for using and allocating dma channels. */
5
6#define MAX_DMA_CHANNELS 10
7
8#define NETWORK_ETH0_TX_DMA_NBR 0 /* Ethernet 0 out. */
9#define NETWORK_ETH0 RX_DMA_NBR 1 /* Ethernet 0 in. */
10
11#define IO_PROC_DMA0_TX_DMA_NBR 2 /* IO processor DMA0 out. */
12#define IO_PROC_DMA0_RX_DMA_NBR 3 /* IO processor DMA0 in. */
13
14#define ATA_TX_DMA_NBR 2 /* ATA interface out. */
15#define ATA_RX_DMA_NBR 3 /* ATA interface in. */
16
17#define ASYNC_SER2_TX_DMA_NBR 2 /* Asynchronous serial port 2 out. */
18#define ASYNC_SER2_RX_DMA_NBR 3 /* Asynchronous serial port 2 in. */
19
20#define IO_PROC_DMA1_TX_DMA_NBR 4 /* IO processor DMA1 out. */
21#define IO_PROC_DMA1_RX_DMA_NBR 5 /* IO processor DMA1 in. */
22
23#define ASYNC_SER1_TX_DMA_NBR 4 /* Asynchronous serial port 1 out. */
24#define ASYNC_SER1_RX_DMA_NBR 5 /* Asynchronous serial port 1 in. */
25
26#define SYNC_SER0_TX_DMA_NBR 4 /* Synchronous serial port 0 out. */
27#define SYNC_SER0_RX_DMA_NBR 5 /* Synchronous serial port 0 in. */
28
29#define EXTDMA0_TX_DMA_NBR 6 /* External DMA 0 out. */
30#define EXTDMA1_RX_DMA_NBR 7 /* External DMA 1 in. */
31
32#define ASYNC_SER0_TX_DMA_NBR 6 /* Asynchronous serial port 0 out. */
33#define ASYNC_SER0_RX_DMA_NBR 7 /* Asynchronous serial port 0 in. */
34
35#define SYNC_SER1_TX_DMA_NBR 6 /* Synchronous serial port 1 out. */
36#define SYNC_SER1_RX_DMA_NBR 7 /* Synchronous serial port 1 in. */
37
38#define NETWORK_ETH1_TX_DMA_NBR 6 /* Ethernet 1 out. */
39#define NETWORK_ETH1_RX_DMA_NBR 7 /* Ethernet 1 in. */
40
41#define EXTDMA2_TX_DMA_NBR 8 /* External DMA 2 out. */
42#define EXTDMA3_RX_DMA_NBR 9 /* External DMA 3 in. */
43
44#define STRCOP_TX_DMA_NBR 8 /* Stream co-processor out. */
45#define STRCOP_RX_DMA_NBR 9 /* Stream co-processor in. */
46
47#define ASYNC_SER3_TX_DMA_NBR 8 /* Asynchronous serial port 3 out. */
48#define ASYNC_SER3_RX_DMA_NBR 9 /* Asynchronous serial port 3 in. */
49
50enum dma_owner
51{
52 dma_eth0,
53 dma_eth1,
54 dma_iop0,
55 dma_iop1,
56 dma_ser0,
57 dma_ser1,
58 dma_ser2,
59 dma_ser3,
60 dma_sser0,
61 dma_sser1,
62 dma_ata,
63 dma_strp,
64 dma_ext0,
65 dma_ext1,
66 dma_ext2,
67 dma_ext3
68};
69
70int crisv32_request_dma(unsigned int dmanr, const char * device_id,
71 unsigned options, unsigned bandwidth, enum dma_owner owner);
72void crisv32_free_dma(unsigned int dmanr);
73
74/* Masks used by crisv32_request_dma options: */
75#define DMA_VERBOSE_ON_ERROR 1
76#define DMA_PANIC_ON_ERROR (2|DMA_VERBOSE_ON_ERROR)
77#define DMA_INT_MEM 4
78
79#endif /* _ASM_ARCH_CRIS_DMA_H */
diff --git a/include/asm-cris/arch-v32/elf.h b/include/asm-cris/arch-v32/elf.h
new file mode 100644
index 000000000000..1324e505a4d8
--- /dev/null
+++ b/include/asm-cris/arch-v32/elf.h
@@ -0,0 +1,73 @@
1#ifndef _ASM_CRIS_ELF_H
2#define _ASM_CRIS_ELF_H
3
4#define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32
5
6/*
7 * This is used to ensure we don't load something for the wrong architecture.
8 */
9#define elf_check_arch(x) \
10 ((x)->e_machine == EM_CRIS \
11 && ((((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_V32 \
12 || (((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_COMMON_V10_V32))))
13
14/* CRISv32 ELF register definitions. */
15
16#include <asm/ptrace.h>
17
18/* Explicitly zero out registers to increase determinism. */
19#define ELF_PLAT_INIT(_r, load_addr) do { \
20 (_r)->r13 = 0; (_r)->r12 = 0; (_r)->r11 = 0; (_r)->r10 = 0; \
21 (_r)->r9 = 0; (_r)->r8 = 0; (_r)->r7 = 0; (_r)->r6 = 0; \
22 (_r)->r5 = 0; (_r)->r4 = 0; (_r)->r3 = 0; (_r)->r2 = 0; \
23 (_r)->r1 = 0; (_r)->r0 = 0; (_r)->mof = 0; (_r)->srp = 0; \
24 (_r)->acr = 0; \
25} while (0)
26
27/*
28 * An executable for which elf_read_implies_exec() returns TRUE will
29 * have the READ_IMPLIES_EXEC personality flag set automatically.
30 */
31#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack))
32
33/*
34 * This is basically a pt_regs with the additional definition
35 * of the stack pointer since it's needed in a core dump.
36 * pr_regs is a elf_gregset_t and should be filled according
37 * to the layout of user_regs_struct.
38 */
39#define ELF_CORE_COPY_REGS(pr_reg, regs) \
40 pr_reg[0] = regs->r0; \
41 pr_reg[1] = regs->r1; \
42 pr_reg[2] = regs->r2; \
43 pr_reg[3] = regs->r3; \
44 pr_reg[4] = regs->r4; \
45 pr_reg[5] = regs->r5; \
46 pr_reg[6] = regs->r6; \
47 pr_reg[7] = regs->r7; \
48 pr_reg[8] = regs->r8; \
49 pr_reg[9] = regs->r9; \
50 pr_reg[10] = regs->r10; \
51 pr_reg[11] = regs->r11; \
52 pr_reg[12] = regs->r12; \
53 pr_reg[13] = regs->r13; \
54 pr_reg[14] = rdusp(); /* SP */ \
55 pr_reg[15] = regs->acr; /* ACR */ \
56 pr_reg[16] = 0; /* BZ */ \
57 pr_reg[17] = rdvr(); /* VR */ \
58 pr_reg[18] = 0; /* PID */ \
59 pr_reg[19] = regs->srs; /* SRS */ \
60 pr_reg[20] = 0; /* WZ */ \
61 pr_reg[21] = regs->exs; /* EXS */ \
62 pr_reg[22] = regs->eda; /* EDA */ \
63 pr_reg[23] = regs->mof; /* MOF */ \
64 pr_reg[24] = 0; /* DZ */ \
65 pr_reg[25] = 0; /* EBP */ \
66 pr_reg[26] = regs->erp; /* ERP */ \
67 pr_reg[27] = regs->srp; /* SRP */ \
68 pr_reg[28] = 0; /* NRP */ \
69 pr_reg[29] = regs->ccs; /* CCS */ \
70 pr_reg[30] = rdusp(); /* USP */ \
71 pr_reg[31] = regs->spc; /* SPC */ \
72
73#endif /* _ASM_CRIS_ELF_H */
diff --git a/include/asm-cris/arch-v32/hwregs/Makefile b/include/asm-cris/arch-v32/hwregs/Makefile
new file mode 100644
index 000000000000..c9160f9949a9
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/Makefile
@@ -0,0 +1,187 @@
1# $Id: Makefile,v 1.8 2004/01/07 21:16:18 johana Exp $
2# Makefile to generate or copy the latest register definitions
3# and related datastructures and helpermacros.
4# The offical place for these files is at:
5RELEASE ?= r1_alfa5
6OFFICIAL_INCDIR = /n/asic/projects/guinness/releases/$(RELEASE)/design/top/sw/include/
7
8# which is updated on each new release.
9INCL_ASMFILES =
10INCL_FILES = ata_defs.h
11INCL_FILES += bif_core_defs.h
12INCL_ASMFILES += bif_core_defs_asm.h
13INCL_FILES += bif_slave_defs.h
14#INCL_FILES += bif_slave_ext_defs.h
15INCL_FILES += config_defs.h
16INCL_ASMFILES += config_defs_asm.h
17INCL_FILES += cpu_vect.h
18#INCL_FILES += cris_defs.h
19#INCL_FILES += cris_supp_reg.h # In handcrafted supp_reg.h
20INCL_FILES += dma.h
21INCL_FILES += dma_defs.h
22INCL_FILES += eth_defs.h
23INCL_FILES += extmem_defs.h
24INCL_FILES += gio_defs.h
25INCL_ASMFILES += gio_defs_asm.h
26INCL_FILES += intr_vect.h
27INCL_FILES += intr_vect_defs.h
28INCL_ASMFILES += intr_vect_defs_asm.h
29INCL_FILES += marb_bp_defs.h
30INCL_FILES += marb_defs.h
31INCL_ASMFILES += mmu_defs_asm.h
32#INCL_FILES += mmu_supp_reg.h # In handcrafted supp_reg.h
33#INCL_FILES += par_defs.h # No useful content
34INCL_FILES += pinmux_defs.h
35INCL_FILES += reg_map.h
36INCL_ASMFILES += reg_map_asm.h
37INCL_FILES += reg_rdwr.h
38INCL_FILES += ser_defs.h
39#INCL_FILES += spec_reg.h # In handcrafted supp_reg.h
40INCL_FILES += sser_defs.h
41INCL_FILES += strcop_defs.h
42#INCL_FILES += strcop.h # Where is this?
43INCL_FILES += strmux_defs.h
44#INCL_FILES += supp_reg.h # Handcrafted instead
45INCL_FILES += timer_defs.h
46
47REGDESC =
48REGDESC += $(BASEDIR)/io/ata/rtl/ata_regs.r
49REGDESC += $(BASEDIR)/io/bif/rtl/bif_core_regs.r
50REGDESC += $(BASEDIR)/io/bif/rtl/bif_slave_regs.r
51#REGDESC += $(BASEDIR)/io/bif/sw/bif_slave_ext_regs.r
52REGDESC += $(DESIGNDIR)/top/rtl/config_regs.r
53REGDESC += $(BASEDIR)/mod/dma_common/rtl/dma_regdes.r
54REGDESC += $(BASEDIR)/io/eth/rtl/eth_regs.r
55REGDESC += $(BASEDIR)/io/bif/mod/extmem/extmem_regs.r
56REGDESC += $(DESIGNDIR)/gio/rtl/gio_regs.r
57REGDESC += $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r
58REGDESC += $(BASEDIR)/core/memarb/rtl/guinness/marb_top.r
59REGDESC += $(BASEDIR)/core/cpu/mmu/doc/mmu_regs.r
60#REGDESC += $(BASEDIR)/io/par_port/rtl/par_regs.r
61REGDESC += $(BASEDIR)/io/pinmux/rtl/guinness/pinmux_regs.r
62REGDESC += $(BASEDIR)/io/ser/rtl/ser_regs.r
63REGDESC += $(BASEDIR)/core/strcop/rtl/strcop_regs.r
64REGDESC += $(BASEDIR)/io/strmux/rtl/guinness/strmux_regs.r
65REGDESC += $(BASEDIR)/io/timer/rtl/timer_regs.r
66#REGDESC += $(BASEDIR)/io/usb/usb1_1/rtl/usb_regs.r
67
68
69BASEDIR = /n/asic/design
70DESIGNDIR = /n/asic/projects/guinness/design
71RDES2C = /n/asic/bin/rdes2c
72RDES2C = /n/asic/design/tools/rdesc/rdes2c
73RDES2INTR = /n/asic/design/tools/rdesc/rdes2intr
74RDES2TXT = /n/asic/design/tools/rdesc/rdes2txt
75
76## all - Just print help - you probably want to do 'make gen'
77all: help
78
79# Disable implicit rule that may generate deleted files from RCS/ directory.
80%.r:
81
82%.h:
83
84## help - This help
85help:
86 @grep '^## ' Makefile
87
88## gen - Generate include files
89gen: $(INCL_FILES) $(INCL_ASMFILES)
90
91ata_defs.h: $(BASEDIR)/io/ata/rtl/ata_regs.r
92 $(RDES2C) $<
93config_defs.h: $(DESIGNDIR)/top/rtl/config_regs.r
94 $(RDES2C) $<
95config_defs_asm.h: $(DESIGNDIR)/top/rtl/config_regs.r
96 $(RDES2C) -asm $<
97# Can't generate cpu_vect.h yet
98#cpu_vect.h: $(DESIGNDIR)/top/rtl/cpu_vect.r # ????
99# $(RDES2INTR) $<
100cpu_vect.h: $(OFFICIAL_INCDIR)cpu_vect.h
101 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
102dma_defs.h: $(BASEDIR)/core/dma/rtl/common/dma_regdes.r
103 $(RDES2C) $<
104$(BASEDIR)/core/dma/sw/dma.h:
105dma.h: $(BASEDIR)/core/dma/sw/dma.h
106 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
107eth_defs.h: $(BASEDIR)/io/eth/rtl/eth_regs.r
108 $(RDES2C) $<
109extmem_defs.h: $(BASEDIR)/io/bif/mod/extmem/extmem_regs.r
110 $(RDES2C) $<
111gio_defs.h: $(DESIGNDIR)/gio/rtl/gio_regs.r
112 $(RDES2C) $<
113intr_vect_defs.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r
114 $(RDES2C) $<
115intr_vect_defs_asm.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r
116 $(RDES2C) -asm $<
117# Can't generate intr_vect.h yet
118#intr_vect.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r
119# $(RDES2INTR) $<
120intr_vect.h: $(OFFICIAL_INCDIR)intr_vect.h
121 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
122mmu_defs_asm.h: $(BASEDIR)/core/cpu/mmu/doc/mmu_regs.r
123 $(RDES2C) -asm $<
124par_defs.h: $(BASEDIR)/io/par_port/rtl/par_regs.r
125 $(RDES2C) $<
126
127# From /n/asic/projects/guinness/design/
128reg_map.h: $(DESIGNDIR)/top/rtl/global.rmap $(DESIGNDIR)/top/mod/modreg.rmap
129 $(RDES2C) -base 0xb0000000 $^
130reg_map_asm.h: $(DESIGNDIR)/top/rtl/global.rmap $(DESIGNDIR)/top/mod/modreg.rmap
131 $(RDES2C) -base 0xb0000000 -asm -outfile $@ $^
132
133reg_rdwr.h: $(DESIGNDIR)/top/sw/include/reg_rdwr.h
134 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
135
136ser_defs.h: $(BASEDIR)/io/ser/rtl/ser_regs.r
137 $(RDES2C) $<
138strcop_defs.h: $(BASEDIR)/core/strcop/rtl/strcop_regs.r
139 $(RDES2C) $<
140strcop.h: $(BASEDIR)/core/strcop/rtl/strcop.h
141 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
142strmux_defs.h: $(BASEDIR)/io/strmux/rtl/guinness/strmux_regs.r
143 $(RDES2C) $<
144timer_defs.h: $(BASEDIR)/io/timer/rtl/timer_regs.r
145 $(RDES2C) $<
146usb_defs.h: $(BASEDIR)/io/usb/usb1_1/rtl/usb_regs.r
147 $(RDES2C) $<
148
149## copy - Copy files from official location
150copy:
151 @for HFILE in $(INCL_FILES); do \
152 echo " $$HFILE"; \
153 cat $(OFFICIAL_INCDIR)$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \
154 done
155 @for HFILE in $(INCL_ASMFILES); do \
156 echo " $$HFILE"; \
157 cat $(OFFICIAL_INCDIR)asm/$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \
158 done
159## ls_official - List official location
160ls_official:
161 (cd $(OFFICIAL_INCDIR); ls -l *.h )
162
163## diff_official - Diff current directory with official location
164diff_official:
165 diff . $(OFFICIAL_INCDIR)
166
167## doc - Generate .axw files from register description.
168doc: $(REGDESC)
169 for RDES in $^; do \
170 $(RDES2TXT) $$RDES; \
171 done
172
173.PHONY: axw
174## %.axw - Generate the specified .axw file (doesn't work for all files
175## due to inconsistent naming ir .r files.
176%.axw: axw
177 @for RDES in $(REGDESC); do \
178 if echo "$$RDES" | grep $* ; then \
179 $(RDES2TXT) $$RDES; \
180 fi \
181 done
182
183.PHONY: clean
184## clean - Remove .h files and .axw files.
185clean:
186 rm -rf $(INCL_FILES) *.axw
187
diff --git a/include/asm-cris/arch-v32/hwregs/asm/ata_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/ata_defs_asm.h
new file mode 100644
index 000000000000..866191418f9c
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/ata_defs_asm.h
@@ -0,0 +1,222 @@
1#ifndef __ata_defs_asm_h
2#define __ata_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/ata/rtl/ata_regs.r
7 * id: ata_regs.r,v 1.11 2005/02/09 08:27:36 kriskn Exp
8 * last modfied: Mon Apr 11 16:06:25 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/ata_defs_asm.h ../../inst/ata/rtl/ata_regs.r
11 * id: $Id: ata_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_ctrl0, scope ata, type rw */
57#define reg_ata_rw_ctrl0___pio_hold___lsb 0
58#define reg_ata_rw_ctrl0___pio_hold___width 6
59#define reg_ata_rw_ctrl0___pio_strb___lsb 6
60#define reg_ata_rw_ctrl0___pio_strb___width 6
61#define reg_ata_rw_ctrl0___pio_setup___lsb 12
62#define reg_ata_rw_ctrl0___pio_setup___width 6
63#define reg_ata_rw_ctrl0___dma_hold___lsb 18
64#define reg_ata_rw_ctrl0___dma_hold___width 6
65#define reg_ata_rw_ctrl0___dma_strb___lsb 24
66#define reg_ata_rw_ctrl0___dma_strb___width 6
67#define reg_ata_rw_ctrl0___rst___lsb 30
68#define reg_ata_rw_ctrl0___rst___width 1
69#define reg_ata_rw_ctrl0___rst___bit 30
70#define reg_ata_rw_ctrl0___en___lsb 31
71#define reg_ata_rw_ctrl0___en___width 1
72#define reg_ata_rw_ctrl0___en___bit 31
73#define reg_ata_rw_ctrl0_offset 12
74
75/* Register rw_ctrl1, scope ata, type rw */
76#define reg_ata_rw_ctrl1___udma_tcyc___lsb 0
77#define reg_ata_rw_ctrl1___udma_tcyc___width 4
78#define reg_ata_rw_ctrl1___udma_tdvs___lsb 4
79#define reg_ata_rw_ctrl1___udma_tdvs___width 4
80#define reg_ata_rw_ctrl1_offset 16
81
82/* Register rw_ctrl2, scope ata, type rw */
83#define reg_ata_rw_ctrl2___data___lsb 0
84#define reg_ata_rw_ctrl2___data___width 16
85#define reg_ata_rw_ctrl2___dma_size___lsb 19
86#define reg_ata_rw_ctrl2___dma_size___width 1
87#define reg_ata_rw_ctrl2___dma_size___bit 19
88#define reg_ata_rw_ctrl2___multi___lsb 20
89#define reg_ata_rw_ctrl2___multi___width 1
90#define reg_ata_rw_ctrl2___multi___bit 20
91#define reg_ata_rw_ctrl2___hsh___lsb 21
92#define reg_ata_rw_ctrl2___hsh___width 2
93#define reg_ata_rw_ctrl2___trf_mode___lsb 23
94#define reg_ata_rw_ctrl2___trf_mode___width 1
95#define reg_ata_rw_ctrl2___trf_mode___bit 23
96#define reg_ata_rw_ctrl2___rw___lsb 24
97#define reg_ata_rw_ctrl2___rw___width 1
98#define reg_ata_rw_ctrl2___rw___bit 24
99#define reg_ata_rw_ctrl2___addr___lsb 25
100#define reg_ata_rw_ctrl2___addr___width 3
101#define reg_ata_rw_ctrl2___cs0___lsb 28
102#define reg_ata_rw_ctrl2___cs0___width 1
103#define reg_ata_rw_ctrl2___cs0___bit 28
104#define reg_ata_rw_ctrl2___cs1___lsb 29
105#define reg_ata_rw_ctrl2___cs1___width 1
106#define reg_ata_rw_ctrl2___cs1___bit 29
107#define reg_ata_rw_ctrl2___sel___lsb 30
108#define reg_ata_rw_ctrl2___sel___width 2
109#define reg_ata_rw_ctrl2_offset 0
110
111/* Register rs_stat_data, scope ata, type rs */
112#define reg_ata_rs_stat_data___data___lsb 0
113#define reg_ata_rs_stat_data___data___width 16
114#define reg_ata_rs_stat_data___dav___lsb 16
115#define reg_ata_rs_stat_data___dav___width 1
116#define reg_ata_rs_stat_data___dav___bit 16
117#define reg_ata_rs_stat_data___busy___lsb 17
118#define reg_ata_rs_stat_data___busy___width 1
119#define reg_ata_rs_stat_data___busy___bit 17
120#define reg_ata_rs_stat_data_offset 4
121
122/* Register r_stat_data, scope ata, type r */
123#define reg_ata_r_stat_data___data___lsb 0
124#define reg_ata_r_stat_data___data___width 16
125#define reg_ata_r_stat_data___dav___lsb 16
126#define reg_ata_r_stat_data___dav___width 1
127#define reg_ata_r_stat_data___dav___bit 16
128#define reg_ata_r_stat_data___busy___lsb 17
129#define reg_ata_r_stat_data___busy___width 1
130#define reg_ata_r_stat_data___busy___bit 17
131#define reg_ata_r_stat_data_offset 8
132
133/* Register rw_trf_cnt, scope ata, type rw */
134#define reg_ata_rw_trf_cnt___cnt___lsb 0
135#define reg_ata_rw_trf_cnt___cnt___width 17
136#define reg_ata_rw_trf_cnt_offset 20
137
138/* Register r_stat_misc, scope ata, type r */
139#define reg_ata_r_stat_misc___crc___lsb 0
140#define reg_ata_r_stat_misc___crc___width 16
141#define reg_ata_r_stat_misc_offset 24
142
143/* Register rw_intr_mask, scope ata, type rw */
144#define reg_ata_rw_intr_mask___bus0___lsb 0
145#define reg_ata_rw_intr_mask___bus0___width 1
146#define reg_ata_rw_intr_mask___bus0___bit 0
147#define reg_ata_rw_intr_mask___bus1___lsb 1
148#define reg_ata_rw_intr_mask___bus1___width 1
149#define reg_ata_rw_intr_mask___bus1___bit 1
150#define reg_ata_rw_intr_mask___bus2___lsb 2
151#define reg_ata_rw_intr_mask___bus2___width 1
152#define reg_ata_rw_intr_mask___bus2___bit 2
153#define reg_ata_rw_intr_mask___bus3___lsb 3
154#define reg_ata_rw_intr_mask___bus3___width 1
155#define reg_ata_rw_intr_mask___bus3___bit 3
156#define reg_ata_rw_intr_mask_offset 28
157
158/* Register rw_ack_intr, scope ata, type rw */
159#define reg_ata_rw_ack_intr___bus0___lsb 0
160#define reg_ata_rw_ack_intr___bus0___width 1
161#define reg_ata_rw_ack_intr___bus0___bit 0
162#define reg_ata_rw_ack_intr___bus1___lsb 1
163#define reg_ata_rw_ack_intr___bus1___width 1
164#define reg_ata_rw_ack_intr___bus1___bit 1
165#define reg_ata_rw_ack_intr___bus2___lsb 2
166#define reg_ata_rw_ack_intr___bus2___width 1
167#define reg_ata_rw_ack_intr___bus2___bit 2
168#define reg_ata_rw_ack_intr___bus3___lsb 3
169#define reg_ata_rw_ack_intr___bus3___width 1
170#define reg_ata_rw_ack_intr___bus3___bit 3
171#define reg_ata_rw_ack_intr_offset 32
172
173/* Register r_intr, scope ata, type r */
174#define reg_ata_r_intr___bus0___lsb 0
175#define reg_ata_r_intr___bus0___width 1
176#define reg_ata_r_intr___bus0___bit 0
177#define reg_ata_r_intr___bus1___lsb 1
178#define reg_ata_r_intr___bus1___width 1
179#define reg_ata_r_intr___bus1___bit 1
180#define reg_ata_r_intr___bus2___lsb 2
181#define reg_ata_r_intr___bus2___width 1
182#define reg_ata_r_intr___bus2___bit 2
183#define reg_ata_r_intr___bus3___lsb 3
184#define reg_ata_r_intr___bus3___width 1
185#define reg_ata_r_intr___bus3___bit 3
186#define reg_ata_r_intr_offset 36
187
188/* Register r_masked_intr, scope ata, type r */
189#define reg_ata_r_masked_intr___bus0___lsb 0
190#define reg_ata_r_masked_intr___bus0___width 1
191#define reg_ata_r_masked_intr___bus0___bit 0
192#define reg_ata_r_masked_intr___bus1___lsb 1
193#define reg_ata_r_masked_intr___bus1___width 1
194#define reg_ata_r_masked_intr___bus1___bit 1
195#define reg_ata_r_masked_intr___bus2___lsb 2
196#define reg_ata_r_masked_intr___bus2___width 1
197#define reg_ata_r_masked_intr___bus2___bit 2
198#define reg_ata_r_masked_intr___bus3___lsb 3
199#define reg_ata_r_masked_intr___bus3___width 1
200#define reg_ata_r_masked_intr___bus3___bit 3
201#define reg_ata_r_masked_intr_offset 40
202
203
204/* Constants */
205#define regk_ata_active 0x00000001
206#define regk_ata_byte 0x00000001
207#define regk_ata_data 0x00000001
208#define regk_ata_dma 0x00000001
209#define regk_ata_inactive 0x00000000
210#define regk_ata_no 0x00000000
211#define regk_ata_nodata 0x00000000
212#define regk_ata_pio 0x00000000
213#define regk_ata_rd 0x00000001
214#define regk_ata_reg 0x00000000
215#define regk_ata_rw_ctrl0_default 0x00000000
216#define regk_ata_rw_ctrl2_default 0x00000000
217#define regk_ata_rw_intr_mask_default 0x00000000
218#define regk_ata_udma 0x00000002
219#define regk_ata_word 0x00000000
220#define regk_ata_wr 0x00000000
221#define regk_ata_yes 0x00000001
222#endif /* __ata_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/bif_core_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/bif_core_defs_asm.h
new file mode 100644
index 000000000000..c686cb335621
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/bif_core_defs_asm.h
@@ -0,0 +1,319 @@
1#ifndef __bif_core_defs_asm_h
2#define __bif_core_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_core_regs.r
7 * id: bif_core_regs.r,v 1.17 2005/02/04 13:28:22 np Exp
8 * last modfied: Mon Apr 11 16:06:33 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/bif_core_defs_asm.h ../../inst/bif/rtl/bif_core_regs.r
11 * id: $Id: bif_core_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_grp1_cfg, scope bif_core, type rw */
57#define reg_bif_core_rw_grp1_cfg___lw___lsb 0
58#define reg_bif_core_rw_grp1_cfg___lw___width 6
59#define reg_bif_core_rw_grp1_cfg___ew___lsb 6
60#define reg_bif_core_rw_grp1_cfg___ew___width 3
61#define reg_bif_core_rw_grp1_cfg___zw___lsb 9
62#define reg_bif_core_rw_grp1_cfg___zw___width 3
63#define reg_bif_core_rw_grp1_cfg___aw___lsb 12
64#define reg_bif_core_rw_grp1_cfg___aw___width 2
65#define reg_bif_core_rw_grp1_cfg___dw___lsb 14
66#define reg_bif_core_rw_grp1_cfg___dw___width 2
67#define reg_bif_core_rw_grp1_cfg___ewb___lsb 16
68#define reg_bif_core_rw_grp1_cfg___ewb___width 2
69#define reg_bif_core_rw_grp1_cfg___bw___lsb 18
70#define reg_bif_core_rw_grp1_cfg___bw___width 1
71#define reg_bif_core_rw_grp1_cfg___bw___bit 18
72#define reg_bif_core_rw_grp1_cfg___wr_extend___lsb 19
73#define reg_bif_core_rw_grp1_cfg___wr_extend___width 1
74#define reg_bif_core_rw_grp1_cfg___wr_extend___bit 19
75#define reg_bif_core_rw_grp1_cfg___erc_en___lsb 20
76#define reg_bif_core_rw_grp1_cfg___erc_en___width 1
77#define reg_bif_core_rw_grp1_cfg___erc_en___bit 20
78#define reg_bif_core_rw_grp1_cfg___mode___lsb 21
79#define reg_bif_core_rw_grp1_cfg___mode___width 1
80#define reg_bif_core_rw_grp1_cfg___mode___bit 21
81#define reg_bif_core_rw_grp1_cfg_offset 0
82
83/* Register rw_grp2_cfg, scope bif_core, type rw */
84#define reg_bif_core_rw_grp2_cfg___lw___lsb 0
85#define reg_bif_core_rw_grp2_cfg___lw___width 6
86#define reg_bif_core_rw_grp2_cfg___ew___lsb 6
87#define reg_bif_core_rw_grp2_cfg___ew___width 3
88#define reg_bif_core_rw_grp2_cfg___zw___lsb 9
89#define reg_bif_core_rw_grp2_cfg___zw___width 3
90#define reg_bif_core_rw_grp2_cfg___aw___lsb 12
91#define reg_bif_core_rw_grp2_cfg___aw___width 2
92#define reg_bif_core_rw_grp2_cfg___dw___lsb 14
93#define reg_bif_core_rw_grp2_cfg___dw___width 2
94#define reg_bif_core_rw_grp2_cfg___ewb___lsb 16
95#define reg_bif_core_rw_grp2_cfg___ewb___width 2
96#define reg_bif_core_rw_grp2_cfg___bw___lsb 18
97#define reg_bif_core_rw_grp2_cfg___bw___width 1
98#define reg_bif_core_rw_grp2_cfg___bw___bit 18
99#define reg_bif_core_rw_grp2_cfg___wr_extend___lsb 19
100#define reg_bif_core_rw_grp2_cfg___wr_extend___width 1
101#define reg_bif_core_rw_grp2_cfg___wr_extend___bit 19
102#define reg_bif_core_rw_grp2_cfg___erc_en___lsb 20
103#define reg_bif_core_rw_grp2_cfg___erc_en___width 1
104#define reg_bif_core_rw_grp2_cfg___erc_en___bit 20
105#define reg_bif_core_rw_grp2_cfg___mode___lsb 21
106#define reg_bif_core_rw_grp2_cfg___mode___width 1
107#define reg_bif_core_rw_grp2_cfg___mode___bit 21
108#define reg_bif_core_rw_grp2_cfg_offset 4
109
110/* Register rw_grp3_cfg, scope bif_core, type rw */
111#define reg_bif_core_rw_grp3_cfg___lw___lsb 0
112#define reg_bif_core_rw_grp3_cfg___lw___width 6
113#define reg_bif_core_rw_grp3_cfg___ew___lsb 6
114#define reg_bif_core_rw_grp3_cfg___ew___width 3
115#define reg_bif_core_rw_grp3_cfg___zw___lsb 9
116#define reg_bif_core_rw_grp3_cfg___zw___width 3
117#define reg_bif_core_rw_grp3_cfg___aw___lsb 12
118#define reg_bif_core_rw_grp3_cfg___aw___width 2
119#define reg_bif_core_rw_grp3_cfg___dw___lsb 14
120#define reg_bif_core_rw_grp3_cfg___dw___width 2
121#define reg_bif_core_rw_grp3_cfg___ewb___lsb 16
122#define reg_bif_core_rw_grp3_cfg___ewb___width 2
123#define reg_bif_core_rw_grp3_cfg___bw___lsb 18
124#define reg_bif_core_rw_grp3_cfg___bw___width 1
125#define reg_bif_core_rw_grp3_cfg___bw___bit 18
126#define reg_bif_core_rw_grp3_cfg___wr_extend___lsb 19
127#define reg_bif_core_rw_grp3_cfg___wr_extend___width 1
128#define reg_bif_core_rw_grp3_cfg___wr_extend___bit 19
129#define reg_bif_core_rw_grp3_cfg___erc_en___lsb 20
130#define reg_bif_core_rw_grp3_cfg___erc_en___width 1
131#define reg_bif_core_rw_grp3_cfg___erc_en___bit 20
132#define reg_bif_core_rw_grp3_cfg___mode___lsb 21
133#define reg_bif_core_rw_grp3_cfg___mode___width 1
134#define reg_bif_core_rw_grp3_cfg___mode___bit 21
135#define reg_bif_core_rw_grp3_cfg___gated_csp0___lsb 24
136#define reg_bif_core_rw_grp3_cfg___gated_csp0___width 2
137#define reg_bif_core_rw_grp3_cfg___gated_csp1___lsb 26
138#define reg_bif_core_rw_grp3_cfg___gated_csp1___width 2
139#define reg_bif_core_rw_grp3_cfg___gated_csp2___lsb 28
140#define reg_bif_core_rw_grp3_cfg___gated_csp2___width 2
141#define reg_bif_core_rw_grp3_cfg___gated_csp3___lsb 30
142#define reg_bif_core_rw_grp3_cfg___gated_csp3___width 2
143#define reg_bif_core_rw_grp3_cfg_offset 8
144
145/* Register rw_grp4_cfg, scope bif_core, type rw */
146#define reg_bif_core_rw_grp4_cfg___lw___lsb 0
147#define reg_bif_core_rw_grp4_cfg___lw___width 6
148#define reg_bif_core_rw_grp4_cfg___ew___lsb 6
149#define reg_bif_core_rw_grp4_cfg___ew___width 3
150#define reg_bif_core_rw_grp4_cfg___zw___lsb 9
151#define reg_bif_core_rw_grp4_cfg___zw___width 3
152#define reg_bif_core_rw_grp4_cfg___aw___lsb 12
153#define reg_bif_core_rw_grp4_cfg___aw___width 2
154#define reg_bif_core_rw_grp4_cfg___dw___lsb 14
155#define reg_bif_core_rw_grp4_cfg___dw___width 2
156#define reg_bif_core_rw_grp4_cfg___ewb___lsb 16
157#define reg_bif_core_rw_grp4_cfg___ewb___width 2
158#define reg_bif_core_rw_grp4_cfg___bw___lsb 18
159#define reg_bif_core_rw_grp4_cfg___bw___width 1
160#define reg_bif_core_rw_grp4_cfg___bw___bit 18
161#define reg_bif_core_rw_grp4_cfg___wr_extend___lsb 19
162#define reg_bif_core_rw_grp4_cfg___wr_extend___width 1
163#define reg_bif_core_rw_grp4_cfg___wr_extend___bit 19
164#define reg_bif_core_rw_grp4_cfg___erc_en___lsb 20
165#define reg_bif_core_rw_grp4_cfg___erc_en___width 1
166#define reg_bif_core_rw_grp4_cfg___erc_en___bit 20
167#define reg_bif_core_rw_grp4_cfg___mode___lsb 21
168#define reg_bif_core_rw_grp4_cfg___mode___width 1
169#define reg_bif_core_rw_grp4_cfg___mode___bit 21
170#define reg_bif_core_rw_grp4_cfg___gated_csp4___lsb 26
171#define reg_bif_core_rw_grp4_cfg___gated_csp4___width 2
172#define reg_bif_core_rw_grp4_cfg___gated_csp5___lsb 28
173#define reg_bif_core_rw_grp4_cfg___gated_csp5___width 2
174#define reg_bif_core_rw_grp4_cfg___gated_csp6___lsb 30
175#define reg_bif_core_rw_grp4_cfg___gated_csp6___width 2
176#define reg_bif_core_rw_grp4_cfg_offset 12
177
178/* Register rw_sdram_cfg_grp0, scope bif_core, type rw */
179#define reg_bif_core_rw_sdram_cfg_grp0___bank_sel___lsb 0
180#define reg_bif_core_rw_sdram_cfg_grp0___bank_sel___width 5
181#define reg_bif_core_rw_sdram_cfg_grp0___ca___lsb 5
182#define reg_bif_core_rw_sdram_cfg_grp0___ca___width 3
183#define reg_bif_core_rw_sdram_cfg_grp0___type___lsb 8
184#define reg_bif_core_rw_sdram_cfg_grp0___type___width 1
185#define reg_bif_core_rw_sdram_cfg_grp0___type___bit 8
186#define reg_bif_core_rw_sdram_cfg_grp0___bw___lsb 9
187#define reg_bif_core_rw_sdram_cfg_grp0___bw___width 1
188#define reg_bif_core_rw_sdram_cfg_grp0___bw___bit 9
189#define reg_bif_core_rw_sdram_cfg_grp0___sh___lsb 10
190#define reg_bif_core_rw_sdram_cfg_grp0___sh___width 3
191#define reg_bif_core_rw_sdram_cfg_grp0___wmm___lsb 13
192#define reg_bif_core_rw_sdram_cfg_grp0___wmm___width 1
193#define reg_bif_core_rw_sdram_cfg_grp0___wmm___bit 13
194#define reg_bif_core_rw_sdram_cfg_grp0___sh16___lsb 14
195#define reg_bif_core_rw_sdram_cfg_grp0___sh16___width 1
196#define reg_bif_core_rw_sdram_cfg_grp0___sh16___bit 14
197#define reg_bif_core_rw_sdram_cfg_grp0___grp_sel___lsb 15
198#define reg_bif_core_rw_sdram_cfg_grp0___grp_sel___width 5
199#define reg_bif_core_rw_sdram_cfg_grp0_offset 16
200
201/* Register rw_sdram_cfg_grp1, scope bif_core, type rw */
202#define reg_bif_core_rw_sdram_cfg_grp1___bank_sel___lsb 0
203#define reg_bif_core_rw_sdram_cfg_grp1___bank_sel___width 5
204#define reg_bif_core_rw_sdram_cfg_grp1___ca___lsb 5
205#define reg_bif_core_rw_sdram_cfg_grp1___ca___width 3
206#define reg_bif_core_rw_sdram_cfg_grp1___type___lsb 8
207#define reg_bif_core_rw_sdram_cfg_grp1___type___width 1
208#define reg_bif_core_rw_sdram_cfg_grp1___type___bit 8
209#define reg_bif_core_rw_sdram_cfg_grp1___bw___lsb 9
210#define reg_bif_core_rw_sdram_cfg_grp1___bw___width 1
211#define reg_bif_core_rw_sdram_cfg_grp1___bw___bit 9
212#define reg_bif_core_rw_sdram_cfg_grp1___sh___lsb 10
213#define reg_bif_core_rw_sdram_cfg_grp1___sh___width 3
214#define reg_bif_core_rw_sdram_cfg_grp1___wmm___lsb 13
215#define reg_bif_core_rw_sdram_cfg_grp1___wmm___width 1
216#define reg_bif_core_rw_sdram_cfg_grp1___wmm___bit 13
217#define reg_bif_core_rw_sdram_cfg_grp1___sh16___lsb 14
218#define reg_bif_core_rw_sdram_cfg_grp1___sh16___width 1
219#define reg_bif_core_rw_sdram_cfg_grp1___sh16___bit 14
220#define reg_bif_core_rw_sdram_cfg_grp1_offset 20
221
222/* Register rw_sdram_timing, scope bif_core, type rw */
223#define reg_bif_core_rw_sdram_timing___cl___lsb 0
224#define reg_bif_core_rw_sdram_timing___cl___width 3
225#define reg_bif_core_rw_sdram_timing___rcd___lsb 3
226#define reg_bif_core_rw_sdram_timing___rcd___width 3
227#define reg_bif_core_rw_sdram_timing___rp___lsb 6
228#define reg_bif_core_rw_sdram_timing___rp___width 3
229#define reg_bif_core_rw_sdram_timing___rc___lsb 9
230#define reg_bif_core_rw_sdram_timing___rc___width 2
231#define reg_bif_core_rw_sdram_timing___dpl___lsb 11
232#define reg_bif_core_rw_sdram_timing___dpl___width 2
233#define reg_bif_core_rw_sdram_timing___pde___lsb 13
234#define reg_bif_core_rw_sdram_timing___pde___width 1
235#define reg_bif_core_rw_sdram_timing___pde___bit 13
236#define reg_bif_core_rw_sdram_timing___ref___lsb 14
237#define reg_bif_core_rw_sdram_timing___ref___width 2
238#define reg_bif_core_rw_sdram_timing___cpd___lsb 16
239#define reg_bif_core_rw_sdram_timing___cpd___width 1
240#define reg_bif_core_rw_sdram_timing___cpd___bit 16
241#define reg_bif_core_rw_sdram_timing___sdcke___lsb 17
242#define reg_bif_core_rw_sdram_timing___sdcke___width 1
243#define reg_bif_core_rw_sdram_timing___sdcke___bit 17
244#define reg_bif_core_rw_sdram_timing___sdclk___lsb 18
245#define reg_bif_core_rw_sdram_timing___sdclk___width 1
246#define reg_bif_core_rw_sdram_timing___sdclk___bit 18
247#define reg_bif_core_rw_sdram_timing_offset 24
248
249/* Register rw_sdram_cmd, scope bif_core, type rw */
250#define reg_bif_core_rw_sdram_cmd___cmd___lsb 0
251#define reg_bif_core_rw_sdram_cmd___cmd___width 3
252#define reg_bif_core_rw_sdram_cmd___mrs_data___lsb 3
253#define reg_bif_core_rw_sdram_cmd___mrs_data___width 15
254#define reg_bif_core_rw_sdram_cmd_offset 28
255
256/* Register rs_sdram_ref_stat, scope bif_core, type rs */
257#define reg_bif_core_rs_sdram_ref_stat___ok___lsb 0
258#define reg_bif_core_rs_sdram_ref_stat___ok___width 1
259#define reg_bif_core_rs_sdram_ref_stat___ok___bit 0
260#define reg_bif_core_rs_sdram_ref_stat_offset 32
261
262/* Register r_sdram_ref_stat, scope bif_core, type r */
263#define reg_bif_core_r_sdram_ref_stat___ok___lsb 0
264#define reg_bif_core_r_sdram_ref_stat___ok___width 1
265#define reg_bif_core_r_sdram_ref_stat___ok___bit 0
266#define reg_bif_core_r_sdram_ref_stat_offset 36
267
268
269/* Constants */
270#define regk_bif_core_bank2 0x00000000
271#define regk_bif_core_bank4 0x00000001
272#define regk_bif_core_bit10 0x0000000a
273#define regk_bif_core_bit11 0x0000000b
274#define regk_bif_core_bit12 0x0000000c
275#define regk_bif_core_bit13 0x0000000d
276#define regk_bif_core_bit14 0x0000000e
277#define regk_bif_core_bit15 0x0000000f
278#define regk_bif_core_bit16 0x00000010
279#define regk_bif_core_bit17 0x00000011
280#define regk_bif_core_bit18 0x00000012
281#define regk_bif_core_bit19 0x00000013
282#define regk_bif_core_bit20 0x00000014
283#define regk_bif_core_bit21 0x00000015
284#define regk_bif_core_bit22 0x00000016
285#define regk_bif_core_bit23 0x00000017
286#define regk_bif_core_bit24 0x00000018
287#define regk_bif_core_bit25 0x00000019
288#define regk_bif_core_bit26 0x0000001a
289#define regk_bif_core_bit27 0x0000001b
290#define regk_bif_core_bit28 0x0000001c
291#define regk_bif_core_bit29 0x0000001d
292#define regk_bif_core_bit9 0x00000009
293#define regk_bif_core_bw16 0x00000001
294#define regk_bif_core_bw32 0x00000000
295#define regk_bif_core_bwe 0x00000000
296#define regk_bif_core_cwe 0x00000001
297#define regk_bif_core_e15us 0x00000001
298#define regk_bif_core_e7800ns 0x00000002
299#define regk_bif_core_grp0 0x00000000
300#define regk_bif_core_grp1 0x00000001
301#define regk_bif_core_mrs 0x00000003
302#define regk_bif_core_no 0x00000000
303#define regk_bif_core_none 0x00000000
304#define regk_bif_core_nop 0x00000000
305#define regk_bif_core_off 0x00000000
306#define regk_bif_core_pre 0x00000002
307#define regk_bif_core_r_sdram_ref_stat_default 0x00000001
308#define regk_bif_core_rd 0x00000002
309#define regk_bif_core_ref 0x00000001
310#define regk_bif_core_rs_sdram_ref_stat_default 0x00000001
311#define regk_bif_core_rw_grp1_cfg_default 0x000006cf
312#define regk_bif_core_rw_grp2_cfg_default 0x000006cf
313#define regk_bif_core_rw_grp3_cfg_default 0x000006cf
314#define regk_bif_core_rw_grp4_cfg_default 0x000006cf
315#define regk_bif_core_rw_sdram_cfg_grp1_default 0x00000000
316#define regk_bif_core_slf 0x00000004
317#define regk_bif_core_wr 0x00000001
318#define regk_bif_core_yes 0x00000001
319#endif /* __bif_core_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/bif_dma_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/bif_dma_defs_asm.h
new file mode 100644
index 000000000000..71532aa18168
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/bif_dma_defs_asm.h
@@ -0,0 +1,495 @@
1#ifndef __bif_dma_defs_asm_h
2#define __bif_dma_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_dma_regs.r
7 * id: bif_dma_regs.r,v 1.6 2005/02/04 13:28:31 perz Exp
8 * last modfied: Mon Apr 11 16:06:33 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/bif_dma_defs_asm.h ../../inst/bif/rtl/bif_dma_regs.r
11 * id: $Id: bif_dma_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_ch0_ctrl, scope bif_dma, type rw */
57#define reg_bif_dma_rw_ch0_ctrl___bw___lsb 0
58#define reg_bif_dma_rw_ch0_ctrl___bw___width 2
59#define reg_bif_dma_rw_ch0_ctrl___burst_len___lsb 2
60#define reg_bif_dma_rw_ch0_ctrl___burst_len___width 1
61#define reg_bif_dma_rw_ch0_ctrl___burst_len___bit 2
62#define reg_bif_dma_rw_ch0_ctrl___cont___lsb 3
63#define reg_bif_dma_rw_ch0_ctrl___cont___width 1
64#define reg_bif_dma_rw_ch0_ctrl___cont___bit 3
65#define reg_bif_dma_rw_ch0_ctrl___end_pad___lsb 4
66#define reg_bif_dma_rw_ch0_ctrl___end_pad___width 1
67#define reg_bif_dma_rw_ch0_ctrl___end_pad___bit 4
68#define reg_bif_dma_rw_ch0_ctrl___cnt___lsb 5
69#define reg_bif_dma_rw_ch0_ctrl___cnt___width 1
70#define reg_bif_dma_rw_ch0_ctrl___cnt___bit 5
71#define reg_bif_dma_rw_ch0_ctrl___dreq_pin___lsb 6
72#define reg_bif_dma_rw_ch0_ctrl___dreq_pin___width 3
73#define reg_bif_dma_rw_ch0_ctrl___dreq_mode___lsb 9
74#define reg_bif_dma_rw_ch0_ctrl___dreq_mode___width 2
75#define reg_bif_dma_rw_ch0_ctrl___tc_in_pin___lsb 11
76#define reg_bif_dma_rw_ch0_ctrl___tc_in_pin___width 3
77#define reg_bif_dma_rw_ch0_ctrl___tc_in_mode___lsb 14
78#define reg_bif_dma_rw_ch0_ctrl___tc_in_mode___width 2
79#define reg_bif_dma_rw_ch0_ctrl___bus_mode___lsb 16
80#define reg_bif_dma_rw_ch0_ctrl___bus_mode___width 2
81#define reg_bif_dma_rw_ch0_ctrl___rate_en___lsb 18
82#define reg_bif_dma_rw_ch0_ctrl___rate_en___width 1
83#define reg_bif_dma_rw_ch0_ctrl___rate_en___bit 18
84#define reg_bif_dma_rw_ch0_ctrl___wr_all___lsb 19
85#define reg_bif_dma_rw_ch0_ctrl___wr_all___width 1
86#define reg_bif_dma_rw_ch0_ctrl___wr_all___bit 19
87#define reg_bif_dma_rw_ch0_ctrl_offset 0
88
89/* Register rw_ch0_addr, scope bif_dma, type rw */
90#define reg_bif_dma_rw_ch0_addr___addr___lsb 0
91#define reg_bif_dma_rw_ch0_addr___addr___width 32
92#define reg_bif_dma_rw_ch0_addr_offset 4
93
94/* Register rw_ch0_start, scope bif_dma, type rw */
95#define reg_bif_dma_rw_ch0_start___run___lsb 0
96#define reg_bif_dma_rw_ch0_start___run___width 1
97#define reg_bif_dma_rw_ch0_start___run___bit 0
98#define reg_bif_dma_rw_ch0_start_offset 8
99
100/* Register rw_ch0_cnt, scope bif_dma, type rw */
101#define reg_bif_dma_rw_ch0_cnt___start_cnt___lsb 0
102#define reg_bif_dma_rw_ch0_cnt___start_cnt___width 16
103#define reg_bif_dma_rw_ch0_cnt_offset 12
104
105/* Register r_ch0_stat, scope bif_dma, type r */
106#define reg_bif_dma_r_ch0_stat___cnt___lsb 0
107#define reg_bif_dma_r_ch0_stat___cnt___width 16
108#define reg_bif_dma_r_ch0_stat___run___lsb 31
109#define reg_bif_dma_r_ch0_stat___run___width 1
110#define reg_bif_dma_r_ch0_stat___run___bit 31
111#define reg_bif_dma_r_ch0_stat_offset 16
112
113/* Register rw_ch1_ctrl, scope bif_dma, type rw */
114#define reg_bif_dma_rw_ch1_ctrl___bw___lsb 0
115#define reg_bif_dma_rw_ch1_ctrl___bw___width 2
116#define reg_bif_dma_rw_ch1_ctrl___burst_len___lsb 2
117#define reg_bif_dma_rw_ch1_ctrl___burst_len___width 1
118#define reg_bif_dma_rw_ch1_ctrl___burst_len___bit 2
119#define reg_bif_dma_rw_ch1_ctrl___cont___lsb 3
120#define reg_bif_dma_rw_ch1_ctrl___cont___width 1
121#define reg_bif_dma_rw_ch1_ctrl___cont___bit 3
122#define reg_bif_dma_rw_ch1_ctrl___end_discard___lsb 4
123#define reg_bif_dma_rw_ch1_ctrl___end_discard___width 1
124#define reg_bif_dma_rw_ch1_ctrl___end_discard___bit 4
125#define reg_bif_dma_rw_ch1_ctrl___cnt___lsb 5
126#define reg_bif_dma_rw_ch1_ctrl___cnt___width 1
127#define reg_bif_dma_rw_ch1_ctrl___cnt___bit 5
128#define reg_bif_dma_rw_ch1_ctrl___dreq_pin___lsb 6
129#define reg_bif_dma_rw_ch1_ctrl___dreq_pin___width 3
130#define reg_bif_dma_rw_ch1_ctrl___dreq_mode___lsb 9
131#define reg_bif_dma_rw_ch1_ctrl___dreq_mode___width 2
132#define reg_bif_dma_rw_ch1_ctrl___tc_in_pin___lsb 11
133#define reg_bif_dma_rw_ch1_ctrl___tc_in_pin___width 3
134#define reg_bif_dma_rw_ch1_ctrl___tc_in_mode___lsb 14
135#define reg_bif_dma_rw_ch1_ctrl___tc_in_mode___width 2
136#define reg_bif_dma_rw_ch1_ctrl___bus_mode___lsb 16
137#define reg_bif_dma_rw_ch1_ctrl___bus_mode___width 2
138#define reg_bif_dma_rw_ch1_ctrl___rate_en___lsb 18
139#define reg_bif_dma_rw_ch1_ctrl___rate_en___width 1
140#define reg_bif_dma_rw_ch1_ctrl___rate_en___bit 18
141#define reg_bif_dma_rw_ch1_ctrl_offset 32
142
143/* Register rw_ch1_addr, scope bif_dma, type rw */
144#define reg_bif_dma_rw_ch1_addr___addr___lsb 0
145#define reg_bif_dma_rw_ch1_addr___addr___width 32
146#define reg_bif_dma_rw_ch1_addr_offset 36
147
148/* Register rw_ch1_start, scope bif_dma, type rw */
149#define reg_bif_dma_rw_ch1_start___run___lsb 0
150#define reg_bif_dma_rw_ch1_start___run___width 1
151#define reg_bif_dma_rw_ch1_start___run___bit 0
152#define reg_bif_dma_rw_ch1_start_offset 40
153
154/* Register rw_ch1_cnt, scope bif_dma, type rw */
155#define reg_bif_dma_rw_ch1_cnt___start_cnt___lsb 0
156#define reg_bif_dma_rw_ch1_cnt___start_cnt___width 16
157#define reg_bif_dma_rw_ch1_cnt_offset 44
158
159/* Register r_ch1_stat, scope bif_dma, type r */
160#define reg_bif_dma_r_ch1_stat___cnt___lsb 0
161#define reg_bif_dma_r_ch1_stat___cnt___width 16
162#define reg_bif_dma_r_ch1_stat___run___lsb 31
163#define reg_bif_dma_r_ch1_stat___run___width 1
164#define reg_bif_dma_r_ch1_stat___run___bit 31
165#define reg_bif_dma_r_ch1_stat_offset 48
166
167/* Register rw_ch2_ctrl, scope bif_dma, type rw */
168#define reg_bif_dma_rw_ch2_ctrl___bw___lsb 0
169#define reg_bif_dma_rw_ch2_ctrl___bw___width 2
170#define reg_bif_dma_rw_ch2_ctrl___burst_len___lsb 2
171#define reg_bif_dma_rw_ch2_ctrl___burst_len___width 1
172#define reg_bif_dma_rw_ch2_ctrl___burst_len___bit 2
173#define reg_bif_dma_rw_ch2_ctrl___cont___lsb 3
174#define reg_bif_dma_rw_ch2_ctrl___cont___width 1
175#define reg_bif_dma_rw_ch2_ctrl___cont___bit 3
176#define reg_bif_dma_rw_ch2_ctrl___end_pad___lsb 4
177#define reg_bif_dma_rw_ch2_ctrl___end_pad___width 1
178#define reg_bif_dma_rw_ch2_ctrl___end_pad___bit 4
179#define reg_bif_dma_rw_ch2_ctrl___cnt___lsb 5
180#define reg_bif_dma_rw_ch2_ctrl___cnt___width 1
181#define reg_bif_dma_rw_ch2_ctrl___cnt___bit 5
182#define reg_bif_dma_rw_ch2_ctrl___dreq_pin___lsb 6
183#define reg_bif_dma_rw_ch2_ctrl___dreq_pin___width 3
184#define reg_bif_dma_rw_ch2_ctrl___dreq_mode___lsb 9
185#define reg_bif_dma_rw_ch2_ctrl___dreq_mode___width 2
186#define reg_bif_dma_rw_ch2_ctrl___tc_in_pin___lsb 11
187#define reg_bif_dma_rw_ch2_ctrl___tc_in_pin___width 3
188#define reg_bif_dma_rw_ch2_ctrl___tc_in_mode___lsb 14
189#define reg_bif_dma_rw_ch2_ctrl___tc_in_mode___width 2
190#define reg_bif_dma_rw_ch2_ctrl___bus_mode___lsb 16
191#define reg_bif_dma_rw_ch2_ctrl___bus_mode___width 2
192#define reg_bif_dma_rw_ch2_ctrl___rate_en___lsb 18
193#define reg_bif_dma_rw_ch2_ctrl___rate_en___width 1
194#define reg_bif_dma_rw_ch2_ctrl___rate_en___bit 18
195#define reg_bif_dma_rw_ch2_ctrl___wr_all___lsb 19
196#define reg_bif_dma_rw_ch2_ctrl___wr_all___width 1
197#define reg_bif_dma_rw_ch2_ctrl___wr_all___bit 19
198#define reg_bif_dma_rw_ch2_ctrl_offset 64
199
200/* Register rw_ch2_addr, scope bif_dma, type rw */
201#define reg_bif_dma_rw_ch2_addr___addr___lsb 0
202#define reg_bif_dma_rw_ch2_addr___addr___width 32
203#define reg_bif_dma_rw_ch2_addr_offset 68
204
205/* Register rw_ch2_start, scope bif_dma, type rw */
206#define reg_bif_dma_rw_ch2_start___run___lsb 0
207#define reg_bif_dma_rw_ch2_start___run___width 1
208#define reg_bif_dma_rw_ch2_start___run___bit 0
209#define reg_bif_dma_rw_ch2_start_offset 72
210
211/* Register rw_ch2_cnt, scope bif_dma, type rw */
212#define reg_bif_dma_rw_ch2_cnt___start_cnt___lsb 0
213#define reg_bif_dma_rw_ch2_cnt___start_cnt___width 16
214#define reg_bif_dma_rw_ch2_cnt_offset 76
215
216/* Register r_ch2_stat, scope bif_dma, type r */
217#define reg_bif_dma_r_ch2_stat___cnt___lsb 0
218#define reg_bif_dma_r_ch2_stat___cnt___width 16
219#define reg_bif_dma_r_ch2_stat___run___lsb 31
220#define reg_bif_dma_r_ch2_stat___run___width 1
221#define reg_bif_dma_r_ch2_stat___run___bit 31
222#define reg_bif_dma_r_ch2_stat_offset 80
223
224/* Register rw_ch3_ctrl, scope bif_dma, type rw */
225#define reg_bif_dma_rw_ch3_ctrl___bw___lsb 0
226#define reg_bif_dma_rw_ch3_ctrl___bw___width 2
227#define reg_bif_dma_rw_ch3_ctrl___burst_len___lsb 2
228#define reg_bif_dma_rw_ch3_ctrl___burst_len___width 1
229#define reg_bif_dma_rw_ch3_ctrl___burst_len___bit 2
230#define reg_bif_dma_rw_ch3_ctrl___cont___lsb 3
231#define reg_bif_dma_rw_ch3_ctrl___cont___width 1
232#define reg_bif_dma_rw_ch3_ctrl___cont___bit 3
233#define reg_bif_dma_rw_ch3_ctrl___end_discard___lsb 4
234#define reg_bif_dma_rw_ch3_ctrl___end_discard___width 1
235#define reg_bif_dma_rw_ch3_ctrl___end_discard___bit 4
236#define reg_bif_dma_rw_ch3_ctrl___cnt___lsb 5
237#define reg_bif_dma_rw_ch3_ctrl___cnt___width 1
238#define reg_bif_dma_rw_ch3_ctrl___cnt___bit 5
239#define reg_bif_dma_rw_ch3_ctrl___dreq_pin___lsb 6
240#define reg_bif_dma_rw_ch3_ctrl___dreq_pin___width 3
241#define reg_bif_dma_rw_ch3_ctrl___dreq_mode___lsb 9
242#define reg_bif_dma_rw_ch3_ctrl___dreq_mode___width 2
243#define reg_bif_dma_rw_ch3_ctrl___tc_in_pin___lsb 11
244#define reg_bif_dma_rw_ch3_ctrl___tc_in_pin___width 3
245#define reg_bif_dma_rw_ch3_ctrl___tc_in_mode___lsb 14
246#define reg_bif_dma_rw_ch3_ctrl___tc_in_mode___width 2
247#define reg_bif_dma_rw_ch3_ctrl___bus_mode___lsb 16
248#define reg_bif_dma_rw_ch3_ctrl___bus_mode___width 2
249#define reg_bif_dma_rw_ch3_ctrl___rate_en___lsb 18
250#define reg_bif_dma_rw_ch3_ctrl___rate_en___width 1
251#define reg_bif_dma_rw_ch3_ctrl___rate_en___bit 18
252#define reg_bif_dma_rw_ch3_ctrl_offset 96
253
254/* Register rw_ch3_addr, scope bif_dma, type rw */
255#define reg_bif_dma_rw_ch3_addr___addr___lsb 0
256#define reg_bif_dma_rw_ch3_addr___addr___width 32
257#define reg_bif_dma_rw_ch3_addr_offset 100
258
259/* Register rw_ch3_start, scope bif_dma, type rw */
260#define reg_bif_dma_rw_ch3_start___run___lsb 0
261#define reg_bif_dma_rw_ch3_start___run___width 1
262#define reg_bif_dma_rw_ch3_start___run___bit 0
263#define reg_bif_dma_rw_ch3_start_offset 104
264
265/* Register rw_ch3_cnt, scope bif_dma, type rw */
266#define reg_bif_dma_rw_ch3_cnt___start_cnt___lsb 0
267#define reg_bif_dma_rw_ch3_cnt___start_cnt___width 16
268#define reg_bif_dma_rw_ch3_cnt_offset 108
269
270/* Register r_ch3_stat, scope bif_dma, type r */
271#define reg_bif_dma_r_ch3_stat___cnt___lsb 0
272#define reg_bif_dma_r_ch3_stat___cnt___width 16
273#define reg_bif_dma_r_ch3_stat___run___lsb 31
274#define reg_bif_dma_r_ch3_stat___run___width 1
275#define reg_bif_dma_r_ch3_stat___run___bit 31
276#define reg_bif_dma_r_ch3_stat_offset 112
277
278/* Register rw_intr_mask, scope bif_dma, type rw */
279#define reg_bif_dma_rw_intr_mask___ext_dma0___lsb 0
280#define reg_bif_dma_rw_intr_mask___ext_dma0___width 1
281#define reg_bif_dma_rw_intr_mask___ext_dma0___bit 0
282#define reg_bif_dma_rw_intr_mask___ext_dma1___lsb 1
283#define reg_bif_dma_rw_intr_mask___ext_dma1___width 1
284#define reg_bif_dma_rw_intr_mask___ext_dma1___bit 1
285#define reg_bif_dma_rw_intr_mask___ext_dma2___lsb 2
286#define reg_bif_dma_rw_intr_mask___ext_dma2___width 1
287#define reg_bif_dma_rw_intr_mask___ext_dma2___bit 2
288#define reg_bif_dma_rw_intr_mask___ext_dma3___lsb 3
289#define reg_bif_dma_rw_intr_mask___ext_dma3___width 1
290#define reg_bif_dma_rw_intr_mask___ext_dma3___bit 3
291#define reg_bif_dma_rw_intr_mask_offset 128
292
293/* Register rw_ack_intr, scope bif_dma, type rw */
294#define reg_bif_dma_rw_ack_intr___ext_dma0___lsb 0
295#define reg_bif_dma_rw_ack_intr___ext_dma0___width 1
296#define reg_bif_dma_rw_ack_intr___ext_dma0___bit 0
297#define reg_bif_dma_rw_ack_intr___ext_dma1___lsb 1
298#define reg_bif_dma_rw_ack_intr___ext_dma1___width 1
299#define reg_bif_dma_rw_ack_intr___ext_dma1___bit 1
300#define reg_bif_dma_rw_ack_intr___ext_dma2___lsb 2
301#define reg_bif_dma_rw_ack_intr___ext_dma2___width 1
302#define reg_bif_dma_rw_ack_intr___ext_dma2___bit 2
303#define reg_bif_dma_rw_ack_intr___ext_dma3___lsb 3
304#define reg_bif_dma_rw_ack_intr___ext_dma3___width 1
305#define reg_bif_dma_rw_ack_intr___ext_dma3___bit 3
306#define reg_bif_dma_rw_ack_intr_offset 132
307
308/* Register r_intr, scope bif_dma, type r */
309#define reg_bif_dma_r_intr___ext_dma0___lsb 0
310#define reg_bif_dma_r_intr___ext_dma0___width 1
311#define reg_bif_dma_r_intr___ext_dma0___bit 0
312#define reg_bif_dma_r_intr___ext_dma1___lsb 1
313#define reg_bif_dma_r_intr___ext_dma1___width 1
314#define reg_bif_dma_r_intr___ext_dma1___bit 1
315#define reg_bif_dma_r_intr___ext_dma2___lsb 2
316#define reg_bif_dma_r_intr___ext_dma2___width 1
317#define reg_bif_dma_r_intr___ext_dma2___bit 2
318#define reg_bif_dma_r_intr___ext_dma3___lsb 3
319#define reg_bif_dma_r_intr___ext_dma3___width 1
320#define reg_bif_dma_r_intr___ext_dma3___bit 3
321#define reg_bif_dma_r_intr_offset 136
322
323/* Register r_masked_intr, scope bif_dma, type r */
324#define reg_bif_dma_r_masked_intr___ext_dma0___lsb 0
325#define reg_bif_dma_r_masked_intr___ext_dma0___width 1
326#define reg_bif_dma_r_masked_intr___ext_dma0___bit 0
327#define reg_bif_dma_r_masked_intr___ext_dma1___lsb 1
328#define reg_bif_dma_r_masked_intr___ext_dma1___width 1
329#define reg_bif_dma_r_masked_intr___ext_dma1___bit 1
330#define reg_bif_dma_r_masked_intr___ext_dma2___lsb 2
331#define reg_bif_dma_r_masked_intr___ext_dma2___width 1
332#define reg_bif_dma_r_masked_intr___ext_dma2___bit 2
333#define reg_bif_dma_r_masked_intr___ext_dma3___lsb 3
334#define reg_bif_dma_r_masked_intr___ext_dma3___width 1
335#define reg_bif_dma_r_masked_intr___ext_dma3___bit 3
336#define reg_bif_dma_r_masked_intr_offset 140
337
338/* Register rw_pin0_cfg, scope bif_dma, type rw */
339#define reg_bif_dma_rw_pin0_cfg___master_ch___lsb 0
340#define reg_bif_dma_rw_pin0_cfg___master_ch___width 2
341#define reg_bif_dma_rw_pin0_cfg___master_mode___lsb 2
342#define reg_bif_dma_rw_pin0_cfg___master_mode___width 3
343#define reg_bif_dma_rw_pin0_cfg___slave_ch___lsb 5
344#define reg_bif_dma_rw_pin0_cfg___slave_ch___width 2
345#define reg_bif_dma_rw_pin0_cfg___slave_mode___lsb 7
346#define reg_bif_dma_rw_pin0_cfg___slave_mode___width 3
347#define reg_bif_dma_rw_pin0_cfg_offset 160
348
349/* Register rw_pin1_cfg, scope bif_dma, type rw */
350#define reg_bif_dma_rw_pin1_cfg___master_ch___lsb 0
351#define reg_bif_dma_rw_pin1_cfg___master_ch___width 2
352#define reg_bif_dma_rw_pin1_cfg___master_mode___lsb 2
353#define reg_bif_dma_rw_pin1_cfg___master_mode___width 3
354#define reg_bif_dma_rw_pin1_cfg___slave_ch___lsb 5
355#define reg_bif_dma_rw_pin1_cfg___slave_ch___width 2
356#define reg_bif_dma_rw_pin1_cfg___slave_mode___lsb 7
357#define reg_bif_dma_rw_pin1_cfg___slave_mode___width 3
358#define reg_bif_dma_rw_pin1_cfg_offset 164
359
360/* Register rw_pin2_cfg, scope bif_dma, type rw */
361#define reg_bif_dma_rw_pin2_cfg___master_ch___lsb 0
362#define reg_bif_dma_rw_pin2_cfg___master_ch___width 2
363#define reg_bif_dma_rw_pin2_cfg___master_mode___lsb 2
364#define reg_bif_dma_rw_pin2_cfg___master_mode___width 3
365#define reg_bif_dma_rw_pin2_cfg___slave_ch___lsb 5
366#define reg_bif_dma_rw_pin2_cfg___slave_ch___width 2
367#define reg_bif_dma_rw_pin2_cfg___slave_mode___lsb 7
368#define reg_bif_dma_rw_pin2_cfg___slave_mode___width 3
369#define reg_bif_dma_rw_pin2_cfg_offset 168
370
371/* Register rw_pin3_cfg, scope bif_dma, type rw */
372#define reg_bif_dma_rw_pin3_cfg___master_ch___lsb 0
373#define reg_bif_dma_rw_pin3_cfg___master_ch___width 2
374#define reg_bif_dma_rw_pin3_cfg___master_mode___lsb 2
375#define reg_bif_dma_rw_pin3_cfg___master_mode___width 3
376#define reg_bif_dma_rw_pin3_cfg___slave_ch___lsb 5
377#define reg_bif_dma_rw_pin3_cfg___slave_ch___width 2
378#define reg_bif_dma_rw_pin3_cfg___slave_mode___lsb 7
379#define reg_bif_dma_rw_pin3_cfg___slave_mode___width 3
380#define reg_bif_dma_rw_pin3_cfg_offset 172
381
382/* Register rw_pin4_cfg, scope bif_dma, type rw */
383#define reg_bif_dma_rw_pin4_cfg___master_ch___lsb 0
384#define reg_bif_dma_rw_pin4_cfg___master_ch___width 2
385#define reg_bif_dma_rw_pin4_cfg___master_mode___lsb 2
386#define reg_bif_dma_rw_pin4_cfg___master_mode___width 3
387#define reg_bif_dma_rw_pin4_cfg___slave_ch___lsb 5
388#define reg_bif_dma_rw_pin4_cfg___slave_ch___width 2
389#define reg_bif_dma_rw_pin4_cfg___slave_mode___lsb 7
390#define reg_bif_dma_rw_pin4_cfg___slave_mode___width 3
391#define reg_bif_dma_rw_pin4_cfg_offset 176
392
393/* Register rw_pin5_cfg, scope bif_dma, type rw */
394#define reg_bif_dma_rw_pin5_cfg___master_ch___lsb 0
395#define reg_bif_dma_rw_pin5_cfg___master_ch___width 2
396#define reg_bif_dma_rw_pin5_cfg___master_mode___lsb 2
397#define reg_bif_dma_rw_pin5_cfg___master_mode___width 3
398#define reg_bif_dma_rw_pin5_cfg___slave_ch___lsb 5
399#define reg_bif_dma_rw_pin5_cfg___slave_ch___width 2
400#define reg_bif_dma_rw_pin5_cfg___slave_mode___lsb 7
401#define reg_bif_dma_rw_pin5_cfg___slave_mode___width 3
402#define reg_bif_dma_rw_pin5_cfg_offset 180
403
404/* Register rw_pin6_cfg, scope bif_dma, type rw */
405#define reg_bif_dma_rw_pin6_cfg___master_ch___lsb 0
406#define reg_bif_dma_rw_pin6_cfg___master_ch___width 2
407#define reg_bif_dma_rw_pin6_cfg___master_mode___lsb 2
408#define reg_bif_dma_rw_pin6_cfg___master_mode___width 3
409#define reg_bif_dma_rw_pin6_cfg___slave_ch___lsb 5
410#define reg_bif_dma_rw_pin6_cfg___slave_ch___width 2
411#define reg_bif_dma_rw_pin6_cfg___slave_mode___lsb 7
412#define reg_bif_dma_rw_pin6_cfg___slave_mode___width 3
413#define reg_bif_dma_rw_pin6_cfg_offset 184
414
415/* Register rw_pin7_cfg, scope bif_dma, type rw */
416#define reg_bif_dma_rw_pin7_cfg___master_ch___lsb 0
417#define reg_bif_dma_rw_pin7_cfg___master_ch___width 2
418#define reg_bif_dma_rw_pin7_cfg___master_mode___lsb 2
419#define reg_bif_dma_rw_pin7_cfg___master_mode___width 3
420#define reg_bif_dma_rw_pin7_cfg___slave_ch___lsb 5
421#define reg_bif_dma_rw_pin7_cfg___slave_ch___width 2
422#define reg_bif_dma_rw_pin7_cfg___slave_mode___lsb 7
423#define reg_bif_dma_rw_pin7_cfg___slave_mode___width 3
424#define reg_bif_dma_rw_pin7_cfg_offset 188
425
426/* Register r_pin_stat, scope bif_dma, type r */
427#define reg_bif_dma_r_pin_stat___pin0___lsb 0
428#define reg_bif_dma_r_pin_stat___pin0___width 1
429#define reg_bif_dma_r_pin_stat___pin0___bit 0
430#define reg_bif_dma_r_pin_stat___pin1___lsb 1
431#define reg_bif_dma_r_pin_stat___pin1___width 1
432#define reg_bif_dma_r_pin_stat___pin1___bit 1
433#define reg_bif_dma_r_pin_stat___pin2___lsb 2
434#define reg_bif_dma_r_pin_stat___pin2___width 1
435#define reg_bif_dma_r_pin_stat___pin2___bit 2
436#define reg_bif_dma_r_pin_stat___pin3___lsb 3
437#define reg_bif_dma_r_pin_stat___pin3___width 1
438#define reg_bif_dma_r_pin_stat___pin3___bit 3
439#define reg_bif_dma_r_pin_stat___pin4___lsb 4
440#define reg_bif_dma_r_pin_stat___pin4___width 1
441#define reg_bif_dma_r_pin_stat___pin4___bit 4
442#define reg_bif_dma_r_pin_stat___pin5___lsb 5
443#define reg_bif_dma_r_pin_stat___pin5___width 1
444#define reg_bif_dma_r_pin_stat___pin5___bit 5
445#define reg_bif_dma_r_pin_stat___pin6___lsb 6
446#define reg_bif_dma_r_pin_stat___pin6___width 1
447#define reg_bif_dma_r_pin_stat___pin6___bit 6
448#define reg_bif_dma_r_pin_stat___pin7___lsb 7
449#define reg_bif_dma_r_pin_stat___pin7___width 1
450#define reg_bif_dma_r_pin_stat___pin7___bit 7
451#define reg_bif_dma_r_pin_stat_offset 192
452
453
454/* Constants */
455#define regk_bif_dma_as_master 0x00000001
456#define regk_bif_dma_as_slave 0x00000001
457#define regk_bif_dma_burst1 0x00000000
458#define regk_bif_dma_burst8 0x00000001
459#define regk_bif_dma_bw16 0x00000001
460#define regk_bif_dma_bw32 0x00000002
461#define regk_bif_dma_bw8 0x00000000
462#define regk_bif_dma_dack 0x00000006
463#define regk_bif_dma_dack_inv 0x00000007
464#define regk_bif_dma_force 0x00000001
465#define regk_bif_dma_hi 0x00000003
466#define regk_bif_dma_inv 0x00000003
467#define regk_bif_dma_lo 0x00000002
468#define regk_bif_dma_master 0x00000001
469#define regk_bif_dma_no 0x00000000
470#define regk_bif_dma_norm 0x00000002
471#define regk_bif_dma_off 0x00000000
472#define regk_bif_dma_rw_ch0_ctrl_default 0x00000000
473#define regk_bif_dma_rw_ch0_start_default 0x00000000
474#define regk_bif_dma_rw_ch1_ctrl_default 0x00000000
475#define regk_bif_dma_rw_ch1_start_default 0x00000000
476#define regk_bif_dma_rw_ch2_ctrl_default 0x00000000
477#define regk_bif_dma_rw_ch2_start_default 0x00000000
478#define regk_bif_dma_rw_ch3_ctrl_default 0x00000000
479#define regk_bif_dma_rw_ch3_start_default 0x00000000
480#define regk_bif_dma_rw_intr_mask_default 0x00000000
481#define regk_bif_dma_rw_pin0_cfg_default 0x00000000
482#define regk_bif_dma_rw_pin1_cfg_default 0x00000000
483#define regk_bif_dma_rw_pin2_cfg_default 0x00000000
484#define regk_bif_dma_rw_pin3_cfg_default 0x00000000
485#define regk_bif_dma_rw_pin4_cfg_default 0x00000000
486#define regk_bif_dma_rw_pin5_cfg_default 0x00000000
487#define regk_bif_dma_rw_pin6_cfg_default 0x00000000
488#define regk_bif_dma_rw_pin7_cfg_default 0x00000000
489#define regk_bif_dma_slave 0x00000002
490#define regk_bif_dma_sreq 0x00000006
491#define regk_bif_dma_sreq_inv 0x00000007
492#define regk_bif_dma_tc 0x00000004
493#define regk_bif_dma_tc_inv 0x00000005
494#define regk_bif_dma_yes 0x00000001
495#endif /* __bif_dma_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/bif_slave_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/bif_slave_defs_asm.h
new file mode 100644
index 000000000000..031f33a365bb
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/bif_slave_defs_asm.h
@@ -0,0 +1,249 @@
1#ifndef __bif_slave_defs_asm_h
2#define __bif_slave_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_slave_regs.r
7 * id: bif_slave_regs.r,v 1.5 2005/02/04 13:55:28 perz Exp
8 * last modfied: Mon Apr 11 16:06:34 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/bif_slave_defs_asm.h ../../inst/bif/rtl/bif_slave_regs.r
11 * id: $Id: bif_slave_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_slave_cfg, scope bif_slave, type rw */
57#define reg_bif_slave_rw_slave_cfg___slave_id___lsb 0
58#define reg_bif_slave_rw_slave_cfg___slave_id___width 3
59#define reg_bif_slave_rw_slave_cfg___use_slave_id___lsb 3
60#define reg_bif_slave_rw_slave_cfg___use_slave_id___width 1
61#define reg_bif_slave_rw_slave_cfg___use_slave_id___bit 3
62#define reg_bif_slave_rw_slave_cfg___boot_rdy___lsb 4
63#define reg_bif_slave_rw_slave_cfg___boot_rdy___width 1
64#define reg_bif_slave_rw_slave_cfg___boot_rdy___bit 4
65#define reg_bif_slave_rw_slave_cfg___loopback___lsb 5
66#define reg_bif_slave_rw_slave_cfg___loopback___width 1
67#define reg_bif_slave_rw_slave_cfg___loopback___bit 5
68#define reg_bif_slave_rw_slave_cfg___dis___lsb 6
69#define reg_bif_slave_rw_slave_cfg___dis___width 1
70#define reg_bif_slave_rw_slave_cfg___dis___bit 6
71#define reg_bif_slave_rw_slave_cfg_offset 0
72
73/* Register r_slave_mode, scope bif_slave, type r */
74#define reg_bif_slave_r_slave_mode___ch0_mode___lsb 0
75#define reg_bif_slave_r_slave_mode___ch0_mode___width 1
76#define reg_bif_slave_r_slave_mode___ch0_mode___bit 0
77#define reg_bif_slave_r_slave_mode___ch1_mode___lsb 1
78#define reg_bif_slave_r_slave_mode___ch1_mode___width 1
79#define reg_bif_slave_r_slave_mode___ch1_mode___bit 1
80#define reg_bif_slave_r_slave_mode___ch2_mode___lsb 2
81#define reg_bif_slave_r_slave_mode___ch2_mode___width 1
82#define reg_bif_slave_r_slave_mode___ch2_mode___bit 2
83#define reg_bif_slave_r_slave_mode___ch3_mode___lsb 3
84#define reg_bif_slave_r_slave_mode___ch3_mode___width 1
85#define reg_bif_slave_r_slave_mode___ch3_mode___bit 3
86#define reg_bif_slave_r_slave_mode_offset 4
87
88/* Register rw_ch0_cfg, scope bif_slave, type rw */
89#define reg_bif_slave_rw_ch0_cfg___rd_hold___lsb 0
90#define reg_bif_slave_rw_ch0_cfg___rd_hold___width 2
91#define reg_bif_slave_rw_ch0_cfg___access_mode___lsb 2
92#define reg_bif_slave_rw_ch0_cfg___access_mode___width 1
93#define reg_bif_slave_rw_ch0_cfg___access_mode___bit 2
94#define reg_bif_slave_rw_ch0_cfg___access_ctrl___lsb 3
95#define reg_bif_slave_rw_ch0_cfg___access_ctrl___width 1
96#define reg_bif_slave_rw_ch0_cfg___access_ctrl___bit 3
97#define reg_bif_slave_rw_ch0_cfg___data_cs___lsb 4
98#define reg_bif_slave_rw_ch0_cfg___data_cs___width 2
99#define reg_bif_slave_rw_ch0_cfg_offset 16
100
101/* Register rw_ch1_cfg, scope bif_slave, type rw */
102#define reg_bif_slave_rw_ch1_cfg___rd_hold___lsb 0
103#define reg_bif_slave_rw_ch1_cfg___rd_hold___width 2
104#define reg_bif_slave_rw_ch1_cfg___access_mode___lsb 2
105#define reg_bif_slave_rw_ch1_cfg___access_mode___width 1
106#define reg_bif_slave_rw_ch1_cfg___access_mode___bit 2
107#define reg_bif_slave_rw_ch1_cfg___access_ctrl___lsb 3
108#define reg_bif_slave_rw_ch1_cfg___access_ctrl___width 1
109#define reg_bif_slave_rw_ch1_cfg___access_ctrl___bit 3
110#define reg_bif_slave_rw_ch1_cfg___data_cs___lsb 4
111#define reg_bif_slave_rw_ch1_cfg___data_cs___width 2
112#define reg_bif_slave_rw_ch1_cfg_offset 20
113
114/* Register rw_ch2_cfg, scope bif_slave, type rw */
115#define reg_bif_slave_rw_ch2_cfg___rd_hold___lsb 0
116#define reg_bif_slave_rw_ch2_cfg___rd_hold___width 2
117#define reg_bif_slave_rw_ch2_cfg___access_mode___lsb 2
118#define reg_bif_slave_rw_ch2_cfg___access_mode___width 1
119#define reg_bif_slave_rw_ch2_cfg___access_mode___bit 2
120#define reg_bif_slave_rw_ch2_cfg___access_ctrl___lsb 3
121#define reg_bif_slave_rw_ch2_cfg___access_ctrl___width 1
122#define reg_bif_slave_rw_ch2_cfg___access_ctrl___bit 3
123#define reg_bif_slave_rw_ch2_cfg___data_cs___lsb 4
124#define reg_bif_slave_rw_ch2_cfg___data_cs___width 2
125#define reg_bif_slave_rw_ch2_cfg_offset 24
126
127/* Register rw_ch3_cfg, scope bif_slave, type rw */
128#define reg_bif_slave_rw_ch3_cfg___rd_hold___lsb 0
129#define reg_bif_slave_rw_ch3_cfg___rd_hold___width 2
130#define reg_bif_slave_rw_ch3_cfg___access_mode___lsb 2
131#define reg_bif_slave_rw_ch3_cfg___access_mode___width 1
132#define reg_bif_slave_rw_ch3_cfg___access_mode___bit 2
133#define reg_bif_slave_rw_ch3_cfg___access_ctrl___lsb 3
134#define reg_bif_slave_rw_ch3_cfg___access_ctrl___width 1
135#define reg_bif_slave_rw_ch3_cfg___access_ctrl___bit 3
136#define reg_bif_slave_rw_ch3_cfg___data_cs___lsb 4
137#define reg_bif_slave_rw_ch3_cfg___data_cs___width 2
138#define reg_bif_slave_rw_ch3_cfg_offset 28
139
140/* Register rw_arb_cfg, scope bif_slave, type rw */
141#define reg_bif_slave_rw_arb_cfg___brin_mode___lsb 0
142#define reg_bif_slave_rw_arb_cfg___brin_mode___width 1
143#define reg_bif_slave_rw_arb_cfg___brin_mode___bit 0
144#define reg_bif_slave_rw_arb_cfg___brout_mode___lsb 1
145#define reg_bif_slave_rw_arb_cfg___brout_mode___width 3
146#define reg_bif_slave_rw_arb_cfg___bg_mode___lsb 4
147#define reg_bif_slave_rw_arb_cfg___bg_mode___width 3
148#define reg_bif_slave_rw_arb_cfg___release___lsb 7
149#define reg_bif_slave_rw_arb_cfg___release___width 2
150#define reg_bif_slave_rw_arb_cfg___acquire___lsb 9
151#define reg_bif_slave_rw_arb_cfg___acquire___width 1
152#define reg_bif_slave_rw_arb_cfg___acquire___bit 9
153#define reg_bif_slave_rw_arb_cfg___settle_time___lsb 10
154#define reg_bif_slave_rw_arb_cfg___settle_time___width 2
155#define reg_bif_slave_rw_arb_cfg___dram_ctrl___lsb 12
156#define reg_bif_slave_rw_arb_cfg___dram_ctrl___width 1
157#define reg_bif_slave_rw_arb_cfg___dram_ctrl___bit 12
158#define reg_bif_slave_rw_arb_cfg_offset 32
159
160/* Register r_arb_stat, scope bif_slave, type r */
161#define reg_bif_slave_r_arb_stat___init_mode___lsb 0
162#define reg_bif_slave_r_arb_stat___init_mode___width 1
163#define reg_bif_slave_r_arb_stat___init_mode___bit 0
164#define reg_bif_slave_r_arb_stat___mode___lsb 1
165#define reg_bif_slave_r_arb_stat___mode___width 1
166#define reg_bif_slave_r_arb_stat___mode___bit 1
167#define reg_bif_slave_r_arb_stat___brin___lsb 2
168#define reg_bif_slave_r_arb_stat___brin___width 1
169#define reg_bif_slave_r_arb_stat___brin___bit 2
170#define reg_bif_slave_r_arb_stat___brout___lsb 3
171#define reg_bif_slave_r_arb_stat___brout___width 1
172#define reg_bif_slave_r_arb_stat___brout___bit 3
173#define reg_bif_slave_r_arb_stat___bg___lsb 4
174#define reg_bif_slave_r_arb_stat___bg___width 1
175#define reg_bif_slave_r_arb_stat___bg___bit 4
176#define reg_bif_slave_r_arb_stat_offset 36
177
178/* Register rw_intr_mask, scope bif_slave, type rw */
179#define reg_bif_slave_rw_intr_mask___bus_release___lsb 0
180#define reg_bif_slave_rw_intr_mask___bus_release___width 1
181#define reg_bif_slave_rw_intr_mask___bus_release___bit 0
182#define reg_bif_slave_rw_intr_mask___bus_acquire___lsb 1
183#define reg_bif_slave_rw_intr_mask___bus_acquire___width 1
184#define reg_bif_slave_rw_intr_mask___bus_acquire___bit 1
185#define reg_bif_slave_rw_intr_mask_offset 64
186
187/* Register rw_ack_intr, scope bif_slave, type rw */
188#define reg_bif_slave_rw_ack_intr___bus_release___lsb 0
189#define reg_bif_slave_rw_ack_intr___bus_release___width 1
190#define reg_bif_slave_rw_ack_intr___bus_release___bit 0
191#define reg_bif_slave_rw_ack_intr___bus_acquire___lsb 1
192#define reg_bif_slave_rw_ack_intr___bus_acquire___width 1
193#define reg_bif_slave_rw_ack_intr___bus_acquire___bit 1
194#define reg_bif_slave_rw_ack_intr_offset 68
195
196/* Register r_intr, scope bif_slave, type r */
197#define reg_bif_slave_r_intr___bus_release___lsb 0
198#define reg_bif_slave_r_intr___bus_release___width 1
199#define reg_bif_slave_r_intr___bus_release___bit 0
200#define reg_bif_slave_r_intr___bus_acquire___lsb 1
201#define reg_bif_slave_r_intr___bus_acquire___width 1
202#define reg_bif_slave_r_intr___bus_acquire___bit 1
203#define reg_bif_slave_r_intr_offset 72
204
205/* Register r_masked_intr, scope bif_slave, type r */
206#define reg_bif_slave_r_masked_intr___bus_release___lsb 0
207#define reg_bif_slave_r_masked_intr___bus_release___width 1
208#define reg_bif_slave_r_masked_intr___bus_release___bit 0
209#define reg_bif_slave_r_masked_intr___bus_acquire___lsb 1
210#define reg_bif_slave_r_masked_intr___bus_acquire___width 1
211#define reg_bif_slave_r_masked_intr___bus_acquire___bit 1
212#define reg_bif_slave_r_masked_intr_offset 76
213
214
215/* Constants */
216#define regk_bif_slave_active_hi 0x00000003
217#define regk_bif_slave_active_lo 0x00000002
218#define regk_bif_slave_addr 0x00000000
219#define regk_bif_slave_always 0x00000001
220#define regk_bif_slave_at_idle 0x00000002
221#define regk_bif_slave_burst_end 0x00000003
222#define regk_bif_slave_dma 0x00000001
223#define regk_bif_slave_hi 0x00000003
224#define regk_bif_slave_inv 0x00000001
225#define regk_bif_slave_lo 0x00000002
226#define regk_bif_slave_local 0x00000001
227#define regk_bif_slave_master 0x00000000
228#define regk_bif_slave_mode_reg 0x00000001
229#define regk_bif_slave_no 0x00000000
230#define regk_bif_slave_norm 0x00000000
231#define regk_bif_slave_on_access 0x00000000
232#define regk_bif_slave_rw_arb_cfg_default 0x00000000
233#define regk_bif_slave_rw_ch0_cfg_default 0x00000000
234#define regk_bif_slave_rw_ch1_cfg_default 0x00000000
235#define regk_bif_slave_rw_ch2_cfg_default 0x00000000
236#define regk_bif_slave_rw_ch3_cfg_default 0x00000000
237#define regk_bif_slave_rw_intr_mask_default 0x00000000
238#define regk_bif_slave_rw_slave_cfg_default 0x00000000
239#define regk_bif_slave_shared 0x00000000
240#define regk_bif_slave_slave 0x00000001
241#define regk_bif_slave_t0ns 0x00000003
242#define regk_bif_slave_t10ns 0x00000002
243#define regk_bif_slave_t20ns 0x00000003
244#define regk_bif_slave_t30ns 0x00000002
245#define regk_bif_slave_t40ns 0x00000001
246#define regk_bif_slave_t50ns 0x00000000
247#define regk_bif_slave_yes 0x00000001
248#define regk_bif_slave_z 0x00000004
249#endif /* __bif_slave_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/config_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/config_defs_asm.h
new file mode 100644
index 000000000000..e98476332e1f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/config_defs_asm.h
@@ -0,0 +1,131 @@
1#ifndef __config_defs_asm_h
2#define __config_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../rtl/config_regs.r
7 * id: config_regs.r,v 1.23 2004/03/04 11:34:42 mikaeln Exp
8 * last modfied: Thu Mar 4 12:34:39 2004
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/config_defs_asm.h ../../rtl/config_regs.r
11 * id: $Id: config_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register r_bootsel, scope config, type r */
57#define reg_config_r_bootsel___boot_mode___lsb 0
58#define reg_config_r_bootsel___boot_mode___width 3
59#define reg_config_r_bootsel___full_duplex___lsb 3
60#define reg_config_r_bootsel___full_duplex___width 1
61#define reg_config_r_bootsel___full_duplex___bit 3
62#define reg_config_r_bootsel___user___lsb 4
63#define reg_config_r_bootsel___user___width 1
64#define reg_config_r_bootsel___user___bit 4
65#define reg_config_r_bootsel___pll___lsb 5
66#define reg_config_r_bootsel___pll___width 1
67#define reg_config_r_bootsel___pll___bit 5
68#define reg_config_r_bootsel___flash_bw___lsb 6
69#define reg_config_r_bootsel___flash_bw___width 1
70#define reg_config_r_bootsel___flash_bw___bit 6
71#define reg_config_r_bootsel_offset 0
72
73/* Register rw_clk_ctrl, scope config, type rw */
74#define reg_config_rw_clk_ctrl___pll___lsb 0
75#define reg_config_rw_clk_ctrl___pll___width 1
76#define reg_config_rw_clk_ctrl___pll___bit 0
77#define reg_config_rw_clk_ctrl___cpu___lsb 1
78#define reg_config_rw_clk_ctrl___cpu___width 1
79#define reg_config_rw_clk_ctrl___cpu___bit 1
80#define reg_config_rw_clk_ctrl___iop___lsb 2
81#define reg_config_rw_clk_ctrl___iop___width 1
82#define reg_config_rw_clk_ctrl___iop___bit 2
83#define reg_config_rw_clk_ctrl___dma01_eth0___lsb 3
84#define reg_config_rw_clk_ctrl___dma01_eth0___width 1
85#define reg_config_rw_clk_ctrl___dma01_eth0___bit 3
86#define reg_config_rw_clk_ctrl___dma23___lsb 4
87#define reg_config_rw_clk_ctrl___dma23___width 1
88#define reg_config_rw_clk_ctrl___dma23___bit 4
89#define reg_config_rw_clk_ctrl___dma45___lsb 5
90#define reg_config_rw_clk_ctrl___dma45___width 1
91#define reg_config_rw_clk_ctrl___dma45___bit 5
92#define reg_config_rw_clk_ctrl___dma67___lsb 6
93#define reg_config_rw_clk_ctrl___dma67___width 1
94#define reg_config_rw_clk_ctrl___dma67___bit 6
95#define reg_config_rw_clk_ctrl___dma89_strcop___lsb 7
96#define reg_config_rw_clk_ctrl___dma89_strcop___width 1
97#define reg_config_rw_clk_ctrl___dma89_strcop___bit 7
98#define reg_config_rw_clk_ctrl___bif___lsb 8
99#define reg_config_rw_clk_ctrl___bif___width 1
100#define reg_config_rw_clk_ctrl___bif___bit 8
101#define reg_config_rw_clk_ctrl___fix_io___lsb 9
102#define reg_config_rw_clk_ctrl___fix_io___width 1
103#define reg_config_rw_clk_ctrl___fix_io___bit 9
104#define reg_config_rw_clk_ctrl_offset 4
105
106/* Register rw_pad_ctrl, scope config, type rw */
107#define reg_config_rw_pad_ctrl___usb_susp___lsb 0
108#define reg_config_rw_pad_ctrl___usb_susp___width 1
109#define reg_config_rw_pad_ctrl___usb_susp___bit 0
110#define reg_config_rw_pad_ctrl___phyrst_n___lsb 1
111#define reg_config_rw_pad_ctrl___phyrst_n___width 1
112#define reg_config_rw_pad_ctrl___phyrst_n___bit 1
113#define reg_config_rw_pad_ctrl_offset 8
114
115
116/* Constants */
117#define regk_config_bw16 0x00000000
118#define regk_config_bw32 0x00000001
119#define regk_config_master 0x00000005
120#define regk_config_nand 0x00000003
121#define regk_config_net_rx 0x00000001
122#define regk_config_net_tx_rx 0x00000002
123#define regk_config_no 0x00000000
124#define regk_config_none 0x00000007
125#define regk_config_nor 0x00000000
126#define regk_config_rw_clk_ctrl_default 0x00000002
127#define regk_config_rw_pad_ctrl_default 0x00000000
128#define regk_config_ser 0x00000004
129#define regk_config_slave 0x00000006
130#define regk_config_yes 0x00000001
131#endif /* __config_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/cpu_vect.h b/include/asm-cris/arch-v32/hwregs/asm/cpu_vect.h
new file mode 100644
index 000000000000..8370aee8a14a
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/cpu_vect.h
@@ -0,0 +1,41 @@
1/* Interrupt vector numbers autogenerated by /n/asic/design/tools/rdesc/src/rdes2intr version
2 from ../../inst/crisp/doc/cpu_vect.r
3version . */
4
5#ifndef _______INST_CRISP_DOC_CPU_VECT_R
6#define _______INST_CRISP_DOC_CPU_VECT_R
7#define NMI_INTR_VECT 0x00
8#define RESERVED_1_INTR_VECT 0x01
9#define RESERVED_2_INTR_VECT 0x02
10#define SINGLE_STEP_INTR_VECT 0x03
11#define INSTR_TLB_REFILL_INTR_VECT 0x04
12#define INSTR_TLB_INV_INTR_VECT 0x05
13#define INSTR_TLB_ACC_INTR_VECT 0x06
14#define TLB_EX_INTR_VECT 0x07
15#define DATA_TLB_REFILL_INTR_VECT 0x08
16#define DATA_TLB_INV_INTR_VECT 0x09
17#define DATA_TLB_ACC_INTR_VECT 0x0a
18#define DATA_TLB_WE_INTR_VECT 0x0b
19#define HW_BP_INTR_VECT 0x0c
20#define RESERVED_D_INTR_VECT 0x0d
21#define RESERVED_E_INTR_VECT 0x0e
22#define RESERVED_F_INTR_VECT 0x0f
23#define BREAK_0_INTR_VECT 0x10
24#define BREAK_1_INTR_VECT 0x11
25#define BREAK_2_INTR_VECT 0x12
26#define BREAK_3_INTR_VECT 0x13
27#define BREAK_4_INTR_VECT 0x14
28#define BREAK_5_INTR_VECT 0x15
29#define BREAK_6_INTR_VECT 0x16
30#define BREAK_7_INTR_VECT 0x17
31#define BREAK_8_INTR_VECT 0x18
32#define BREAK_9_INTR_VECT 0x19
33#define BREAK_10_INTR_VECT 0x1a
34#define BREAK_11_INTR_VECT 0x1b
35#define BREAK_12_INTR_VECT 0x1c
36#define BREAK_13_INTR_VECT 0x1d
37#define BREAK_14_INTR_VECT 0x1e
38#define BREAK_15_INTR_VECT 0x1f
39#define MULTIPLE_INTR_VECT 0x30
40
41#endif
diff --git a/include/asm-cris/arch-v32/hwregs/asm/cris_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/cris_defs_asm.h
new file mode 100644
index 000000000000..7f768db272e2
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/cris_defs_asm.h
@@ -0,0 +1,114 @@
1#ifndef __cris_defs_asm_h
2#define __cris_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/crisp/doc/cris.r
7 * id: cris.r,v 1.6 2004/05/05 07:41:12 perz Exp
8 * last modfied: Mon Apr 11 16:06:39 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/cris_defs_asm.h ../../inst/crisp/doc/cris.r
11 * id: $Id: cris_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_gc_cfg, scope cris, type rw */
57#define reg_cris_rw_gc_cfg___ic___lsb 0
58#define reg_cris_rw_gc_cfg___ic___width 1
59#define reg_cris_rw_gc_cfg___ic___bit 0
60#define reg_cris_rw_gc_cfg___dc___lsb 1
61#define reg_cris_rw_gc_cfg___dc___width 1
62#define reg_cris_rw_gc_cfg___dc___bit 1
63#define reg_cris_rw_gc_cfg___im___lsb 2
64#define reg_cris_rw_gc_cfg___im___width 1
65#define reg_cris_rw_gc_cfg___im___bit 2
66#define reg_cris_rw_gc_cfg___dm___lsb 3
67#define reg_cris_rw_gc_cfg___dm___width 1
68#define reg_cris_rw_gc_cfg___dm___bit 3
69#define reg_cris_rw_gc_cfg___gb___lsb 4
70#define reg_cris_rw_gc_cfg___gb___width 1
71#define reg_cris_rw_gc_cfg___gb___bit 4
72#define reg_cris_rw_gc_cfg___gk___lsb 5
73#define reg_cris_rw_gc_cfg___gk___width 1
74#define reg_cris_rw_gc_cfg___gk___bit 5
75#define reg_cris_rw_gc_cfg___gp___lsb 6
76#define reg_cris_rw_gc_cfg___gp___width 1
77#define reg_cris_rw_gc_cfg___gp___bit 6
78#define reg_cris_rw_gc_cfg_offset 0
79
80/* Register rw_gc_ccs, scope cris, type rw */
81#define reg_cris_rw_gc_ccs_offset 4
82
83/* Register rw_gc_srs, scope cris, type rw */
84#define reg_cris_rw_gc_srs___srs___lsb 0
85#define reg_cris_rw_gc_srs___srs___width 8
86#define reg_cris_rw_gc_srs_offset 8
87
88/* Register rw_gc_nrp, scope cris, type rw */
89#define reg_cris_rw_gc_nrp_offset 12
90
91/* Register rw_gc_exs, scope cris, type rw */
92#define reg_cris_rw_gc_exs_offset 16
93
94/* Register rw_gc_eda, scope cris, type rw */
95#define reg_cris_rw_gc_eda_offset 20
96
97/* Register rw_gc_r0, scope cris, type rw */
98#define reg_cris_rw_gc_r0_offset 32
99
100/* Register rw_gc_r1, scope cris, type rw */
101#define reg_cris_rw_gc_r1_offset 36
102
103/* Register rw_gc_r2, scope cris, type rw */
104#define reg_cris_rw_gc_r2_offset 40
105
106/* Register rw_gc_r3, scope cris, type rw */
107#define reg_cris_rw_gc_r3_offset 44
108
109
110/* Constants */
111#define regk_cris_no 0x00000000
112#define regk_cris_rw_gc_cfg_default 0x00000000
113#define regk_cris_yes 0x00000001
114#endif /* __cris_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/cris_supp_reg.h b/include/asm-cris/arch-v32/hwregs/asm/cris_supp_reg.h
new file mode 100644
index 000000000000..7d3689a6f80d
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/cris_supp_reg.h
@@ -0,0 +1,10 @@
1#define RW_GC_CFG 0
2#define RW_GC_CCS 1
3#define RW_GC_SRS 2
4#define RW_GC_NRP 3
5#define RW_GC_EXS 4
6#define RW_GC_EDA 5
7#define RW_GC_R0 8
8#define RW_GC_R1 9
9#define RW_GC_R2 10
10#define RW_GC_R3 11
diff --git a/include/asm-cris/arch-v32/hwregs/asm/dma_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/dma_defs_asm.h
new file mode 100644
index 000000000000..0cb71bc127ae
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/dma_defs_asm.h
@@ -0,0 +1,368 @@
1#ifndef __dma_defs_asm_h
2#define __dma_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/dma/inst/dma_common/rtl/dma_regdes.r
7 * id: dma_regdes.r,v 1.39 2005/02/10 14:07:23 janb Exp
8 * last modfied: Mon Apr 11 16:06:51 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/dma_defs_asm.h ../../inst/dma/inst/dma_common/rtl/dma_regdes.r
11 * id: $Id: dma_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_data, scope dma, type rw */
57#define reg_dma_rw_data_offset 0
58
59/* Register rw_data_next, scope dma, type rw */
60#define reg_dma_rw_data_next_offset 4
61
62/* Register rw_data_buf, scope dma, type rw */
63#define reg_dma_rw_data_buf_offset 8
64
65/* Register rw_data_ctrl, scope dma, type rw */
66#define reg_dma_rw_data_ctrl___eol___lsb 0
67#define reg_dma_rw_data_ctrl___eol___width 1
68#define reg_dma_rw_data_ctrl___eol___bit 0
69#define reg_dma_rw_data_ctrl___out_eop___lsb 3
70#define reg_dma_rw_data_ctrl___out_eop___width 1
71#define reg_dma_rw_data_ctrl___out_eop___bit 3
72#define reg_dma_rw_data_ctrl___intr___lsb 4
73#define reg_dma_rw_data_ctrl___intr___width 1
74#define reg_dma_rw_data_ctrl___intr___bit 4
75#define reg_dma_rw_data_ctrl___wait___lsb 5
76#define reg_dma_rw_data_ctrl___wait___width 1
77#define reg_dma_rw_data_ctrl___wait___bit 5
78#define reg_dma_rw_data_ctrl_offset 12
79
80/* Register rw_data_stat, scope dma, type rw */
81#define reg_dma_rw_data_stat___in_eop___lsb 3
82#define reg_dma_rw_data_stat___in_eop___width 1
83#define reg_dma_rw_data_stat___in_eop___bit 3
84#define reg_dma_rw_data_stat_offset 16
85
86/* Register rw_data_md, scope dma, type rw */
87#define reg_dma_rw_data_md___md___lsb 0
88#define reg_dma_rw_data_md___md___width 16
89#define reg_dma_rw_data_md_offset 20
90
91/* Register rw_data_md_s, scope dma, type rw */
92#define reg_dma_rw_data_md_s___md_s___lsb 0
93#define reg_dma_rw_data_md_s___md_s___width 16
94#define reg_dma_rw_data_md_s_offset 24
95
96/* Register rw_data_after, scope dma, type rw */
97#define reg_dma_rw_data_after_offset 28
98
99/* Register rw_ctxt, scope dma, type rw */
100#define reg_dma_rw_ctxt_offset 32
101
102/* Register rw_ctxt_next, scope dma, type rw */
103#define reg_dma_rw_ctxt_next_offset 36
104
105/* Register rw_ctxt_ctrl, scope dma, type rw */
106#define reg_dma_rw_ctxt_ctrl___eol___lsb 0
107#define reg_dma_rw_ctxt_ctrl___eol___width 1
108#define reg_dma_rw_ctxt_ctrl___eol___bit 0
109#define reg_dma_rw_ctxt_ctrl___intr___lsb 4
110#define reg_dma_rw_ctxt_ctrl___intr___width 1
111#define reg_dma_rw_ctxt_ctrl___intr___bit 4
112#define reg_dma_rw_ctxt_ctrl___store_mode___lsb 6
113#define reg_dma_rw_ctxt_ctrl___store_mode___width 1
114#define reg_dma_rw_ctxt_ctrl___store_mode___bit 6
115#define reg_dma_rw_ctxt_ctrl___en___lsb 7
116#define reg_dma_rw_ctxt_ctrl___en___width 1
117#define reg_dma_rw_ctxt_ctrl___en___bit 7
118#define reg_dma_rw_ctxt_ctrl_offset 40
119
120/* Register rw_ctxt_stat, scope dma, type rw */
121#define reg_dma_rw_ctxt_stat___dis___lsb 7
122#define reg_dma_rw_ctxt_stat___dis___width 1
123#define reg_dma_rw_ctxt_stat___dis___bit 7
124#define reg_dma_rw_ctxt_stat_offset 44
125
126/* Register rw_ctxt_md0, scope dma, type rw */
127#define reg_dma_rw_ctxt_md0___md0___lsb 0
128#define reg_dma_rw_ctxt_md0___md0___width 16
129#define reg_dma_rw_ctxt_md0_offset 48
130
131/* Register rw_ctxt_md0_s, scope dma, type rw */
132#define reg_dma_rw_ctxt_md0_s___md0_s___lsb 0
133#define reg_dma_rw_ctxt_md0_s___md0_s___width 16
134#define reg_dma_rw_ctxt_md0_s_offset 52
135
136/* Register rw_ctxt_md1, scope dma, type rw */
137#define reg_dma_rw_ctxt_md1_offset 56
138
139/* Register rw_ctxt_md1_s, scope dma, type rw */
140#define reg_dma_rw_ctxt_md1_s_offset 60
141
142/* Register rw_ctxt_md2, scope dma, type rw */
143#define reg_dma_rw_ctxt_md2_offset 64
144
145/* Register rw_ctxt_md2_s, scope dma, type rw */
146#define reg_dma_rw_ctxt_md2_s_offset 68
147
148/* Register rw_ctxt_md3, scope dma, type rw */
149#define reg_dma_rw_ctxt_md3_offset 72
150
151/* Register rw_ctxt_md3_s, scope dma, type rw */
152#define reg_dma_rw_ctxt_md3_s_offset 76
153
154/* Register rw_ctxt_md4, scope dma, type rw */
155#define reg_dma_rw_ctxt_md4_offset 80
156
157/* Register rw_ctxt_md4_s, scope dma, type rw */
158#define reg_dma_rw_ctxt_md4_s_offset 84
159
160/* Register rw_saved_data, scope dma, type rw */
161#define reg_dma_rw_saved_data_offset 88
162
163/* Register rw_saved_data_buf, scope dma, type rw */
164#define reg_dma_rw_saved_data_buf_offset 92
165
166/* Register rw_group, scope dma, type rw */
167#define reg_dma_rw_group_offset 96
168
169/* Register rw_group_next, scope dma, type rw */
170#define reg_dma_rw_group_next_offset 100
171
172/* Register rw_group_ctrl, scope dma, type rw */
173#define reg_dma_rw_group_ctrl___eol___lsb 0
174#define reg_dma_rw_group_ctrl___eol___width 1
175#define reg_dma_rw_group_ctrl___eol___bit 0
176#define reg_dma_rw_group_ctrl___tol___lsb 1
177#define reg_dma_rw_group_ctrl___tol___width 1
178#define reg_dma_rw_group_ctrl___tol___bit 1
179#define reg_dma_rw_group_ctrl___bol___lsb 2
180#define reg_dma_rw_group_ctrl___bol___width 1
181#define reg_dma_rw_group_ctrl___bol___bit 2
182#define reg_dma_rw_group_ctrl___intr___lsb 4
183#define reg_dma_rw_group_ctrl___intr___width 1
184#define reg_dma_rw_group_ctrl___intr___bit 4
185#define reg_dma_rw_group_ctrl___en___lsb 7
186#define reg_dma_rw_group_ctrl___en___width 1
187#define reg_dma_rw_group_ctrl___en___bit 7
188#define reg_dma_rw_group_ctrl_offset 104
189
190/* Register rw_group_stat, scope dma, type rw */
191#define reg_dma_rw_group_stat___dis___lsb 7
192#define reg_dma_rw_group_stat___dis___width 1
193#define reg_dma_rw_group_stat___dis___bit 7
194#define reg_dma_rw_group_stat_offset 108
195
196/* Register rw_group_md, scope dma, type rw */
197#define reg_dma_rw_group_md___md___lsb 0
198#define reg_dma_rw_group_md___md___width 16
199#define reg_dma_rw_group_md_offset 112
200
201/* Register rw_group_md_s, scope dma, type rw */
202#define reg_dma_rw_group_md_s___md_s___lsb 0
203#define reg_dma_rw_group_md_s___md_s___width 16
204#define reg_dma_rw_group_md_s_offset 116
205
206/* Register rw_group_up, scope dma, type rw */
207#define reg_dma_rw_group_up_offset 120
208
209/* Register rw_group_down, scope dma, type rw */
210#define reg_dma_rw_group_down_offset 124
211
212/* Register rw_cmd, scope dma, type rw */
213#define reg_dma_rw_cmd___cont_data___lsb 0
214#define reg_dma_rw_cmd___cont_data___width 1
215#define reg_dma_rw_cmd___cont_data___bit 0
216#define reg_dma_rw_cmd_offset 128
217
218/* Register rw_cfg, scope dma, type rw */
219#define reg_dma_rw_cfg___en___lsb 0
220#define reg_dma_rw_cfg___en___width 1
221#define reg_dma_rw_cfg___en___bit 0
222#define reg_dma_rw_cfg___stop___lsb 1
223#define reg_dma_rw_cfg___stop___width 1
224#define reg_dma_rw_cfg___stop___bit 1
225#define reg_dma_rw_cfg_offset 132
226
227/* Register rw_stat, scope dma, type rw */
228#define reg_dma_rw_stat___mode___lsb 0
229#define reg_dma_rw_stat___mode___width 5
230#define reg_dma_rw_stat___list_state___lsb 5
231#define reg_dma_rw_stat___list_state___width 3
232#define reg_dma_rw_stat___stream_cmd_src___lsb 8
233#define reg_dma_rw_stat___stream_cmd_src___width 8
234#define reg_dma_rw_stat___buf___lsb 24
235#define reg_dma_rw_stat___buf___width 8
236#define reg_dma_rw_stat_offset 136
237
238/* Register rw_intr_mask, scope dma, type rw */
239#define reg_dma_rw_intr_mask___group___lsb 0
240#define reg_dma_rw_intr_mask___group___width 1
241#define reg_dma_rw_intr_mask___group___bit 0
242#define reg_dma_rw_intr_mask___ctxt___lsb 1
243#define reg_dma_rw_intr_mask___ctxt___width 1
244#define reg_dma_rw_intr_mask___ctxt___bit 1
245#define reg_dma_rw_intr_mask___data___lsb 2
246#define reg_dma_rw_intr_mask___data___width 1
247#define reg_dma_rw_intr_mask___data___bit 2
248#define reg_dma_rw_intr_mask___in_eop___lsb 3
249#define reg_dma_rw_intr_mask___in_eop___width 1
250#define reg_dma_rw_intr_mask___in_eop___bit 3
251#define reg_dma_rw_intr_mask___stream_cmd___lsb 4
252#define reg_dma_rw_intr_mask___stream_cmd___width 1
253#define reg_dma_rw_intr_mask___stream_cmd___bit 4
254#define reg_dma_rw_intr_mask_offset 140
255
256/* Register rw_ack_intr, scope dma, type rw */
257#define reg_dma_rw_ack_intr___group___lsb 0
258#define reg_dma_rw_ack_intr___group___width 1
259#define reg_dma_rw_ack_intr___group___bit 0
260#define reg_dma_rw_ack_intr___ctxt___lsb 1
261#define reg_dma_rw_ack_intr___ctxt___width 1
262#define reg_dma_rw_ack_intr___ctxt___bit 1
263#define reg_dma_rw_ack_intr___data___lsb 2
264#define reg_dma_rw_ack_intr___data___width 1
265#define reg_dma_rw_ack_intr___data___bit 2
266#define reg_dma_rw_ack_intr___in_eop___lsb 3
267#define reg_dma_rw_ack_intr___in_eop___width 1
268#define reg_dma_rw_ack_intr___in_eop___bit 3
269#define reg_dma_rw_ack_intr___stream_cmd___lsb 4
270#define reg_dma_rw_ack_intr___stream_cmd___width 1
271#define reg_dma_rw_ack_intr___stream_cmd___bit 4
272#define reg_dma_rw_ack_intr_offset 144
273
274/* Register r_intr, scope dma, type r */
275#define reg_dma_r_intr___group___lsb 0
276#define reg_dma_r_intr___group___width 1
277#define reg_dma_r_intr___group___bit 0
278#define reg_dma_r_intr___ctxt___lsb 1
279#define reg_dma_r_intr___ctxt___width 1
280#define reg_dma_r_intr___ctxt___bit 1
281#define reg_dma_r_intr___data___lsb 2
282#define reg_dma_r_intr___data___width 1
283#define reg_dma_r_intr___data___bit 2
284#define reg_dma_r_intr___in_eop___lsb 3
285#define reg_dma_r_intr___in_eop___width 1
286#define reg_dma_r_intr___in_eop___bit 3
287#define reg_dma_r_intr___stream_cmd___lsb 4
288#define reg_dma_r_intr___stream_cmd___width 1
289#define reg_dma_r_intr___stream_cmd___bit 4
290#define reg_dma_r_intr_offset 148
291
292/* Register r_masked_intr, scope dma, type r */
293#define reg_dma_r_masked_intr___group___lsb 0
294#define reg_dma_r_masked_intr___group___width 1
295#define reg_dma_r_masked_intr___group___bit 0
296#define reg_dma_r_masked_intr___ctxt___lsb 1
297#define reg_dma_r_masked_intr___ctxt___width 1
298#define reg_dma_r_masked_intr___ctxt___bit 1
299#define reg_dma_r_masked_intr___data___lsb 2
300#define reg_dma_r_masked_intr___data___width 1
301#define reg_dma_r_masked_intr___data___bit 2
302#define reg_dma_r_masked_intr___in_eop___lsb 3
303#define reg_dma_r_masked_intr___in_eop___width 1
304#define reg_dma_r_masked_intr___in_eop___bit 3
305#define reg_dma_r_masked_intr___stream_cmd___lsb 4
306#define reg_dma_r_masked_intr___stream_cmd___width 1
307#define reg_dma_r_masked_intr___stream_cmd___bit 4
308#define reg_dma_r_masked_intr_offset 152
309
310/* Register rw_stream_cmd, scope dma, type rw */
311#define reg_dma_rw_stream_cmd___cmd___lsb 0
312#define reg_dma_rw_stream_cmd___cmd___width 10
313#define reg_dma_rw_stream_cmd___n___lsb 16
314#define reg_dma_rw_stream_cmd___n___width 8
315#define reg_dma_rw_stream_cmd___busy___lsb 31
316#define reg_dma_rw_stream_cmd___busy___width 1
317#define reg_dma_rw_stream_cmd___busy___bit 31
318#define reg_dma_rw_stream_cmd_offset 156
319
320
321/* Constants */
322#define regk_dma_ack_pkt 0x00000100
323#define regk_dma_anytime 0x00000001
324#define regk_dma_array 0x00000008
325#define regk_dma_burst 0x00000020
326#define regk_dma_client 0x00000002
327#define regk_dma_copy_next 0x00000010
328#define regk_dma_copy_up 0x00000020
329#define regk_dma_data_at_eol 0x00000001
330#define regk_dma_dis_c 0x00000010
331#define regk_dma_dis_g 0x00000020
332#define regk_dma_idle 0x00000001
333#define regk_dma_intern 0x00000004
334#define regk_dma_load_c 0x00000200
335#define regk_dma_load_c_n 0x00000280
336#define regk_dma_load_c_next 0x00000240
337#define regk_dma_load_d 0x00000140
338#define regk_dma_load_g 0x00000300
339#define regk_dma_load_g_down 0x000003c0
340#define regk_dma_load_g_next 0x00000340
341#define regk_dma_load_g_up 0x00000380
342#define regk_dma_next_en 0x00000010
343#define regk_dma_next_pkt 0x00000010
344#define regk_dma_no 0x00000000
345#define regk_dma_only_at_wait 0x00000000
346#define regk_dma_restore 0x00000020
347#define regk_dma_rst 0x00000001
348#define regk_dma_running 0x00000004
349#define regk_dma_rw_cfg_default 0x00000000
350#define regk_dma_rw_cmd_default 0x00000000
351#define regk_dma_rw_intr_mask_default 0x00000000
352#define regk_dma_rw_stat_default 0x00000101
353#define regk_dma_rw_stream_cmd_default 0x00000000
354#define regk_dma_save_down 0x00000020
355#define regk_dma_save_up 0x00000020
356#define regk_dma_set_reg 0x00000050
357#define regk_dma_set_w_size1 0x00000190
358#define regk_dma_set_w_size2 0x000001a0
359#define regk_dma_set_w_size4 0x000001c0
360#define regk_dma_stopped 0x00000002
361#define regk_dma_store_c 0x00000002
362#define regk_dma_store_descr 0x00000000
363#define regk_dma_store_g 0x00000004
364#define regk_dma_store_md 0x00000001
365#define regk_dma_sw 0x00000008
366#define regk_dma_update_down 0x00000020
367#define regk_dma_yes 0x00000001
368#endif /* __dma_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/eth_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/eth_defs_asm.h
new file mode 100644
index 000000000000..c9f49864831b
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/eth_defs_asm.h
@@ -0,0 +1,498 @@
1#ifndef __eth_defs_asm_h
2#define __eth_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/eth/rtl/eth_regs.r
7 * id: eth_regs.r,v 1.11 2005/02/09 10:48:38 kriskn Exp
8 * last modfied: Mon Apr 11 16:07:03 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/eth_defs_asm.h ../../inst/eth/rtl/eth_regs.r
11 * id: $Id: eth_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_ma0_lo, scope eth, type rw */
57#define reg_eth_rw_ma0_lo___addr___lsb 0
58#define reg_eth_rw_ma0_lo___addr___width 32
59#define reg_eth_rw_ma0_lo_offset 0
60
61/* Register rw_ma0_hi, scope eth, type rw */
62#define reg_eth_rw_ma0_hi___addr___lsb 0
63#define reg_eth_rw_ma0_hi___addr___width 16
64#define reg_eth_rw_ma0_hi_offset 4
65
66/* Register rw_ma1_lo, scope eth, type rw */
67#define reg_eth_rw_ma1_lo___addr___lsb 0
68#define reg_eth_rw_ma1_lo___addr___width 32
69#define reg_eth_rw_ma1_lo_offset 8
70
71/* Register rw_ma1_hi, scope eth, type rw */
72#define reg_eth_rw_ma1_hi___addr___lsb 0
73#define reg_eth_rw_ma1_hi___addr___width 16
74#define reg_eth_rw_ma1_hi_offset 12
75
76/* Register rw_ga_lo, scope eth, type rw */
77#define reg_eth_rw_ga_lo___table___lsb 0
78#define reg_eth_rw_ga_lo___table___width 32
79#define reg_eth_rw_ga_lo_offset 16
80
81/* Register rw_ga_hi, scope eth, type rw */
82#define reg_eth_rw_ga_hi___table___lsb 0
83#define reg_eth_rw_ga_hi___table___width 32
84#define reg_eth_rw_ga_hi_offset 20
85
86/* Register rw_gen_ctrl, scope eth, type rw */
87#define reg_eth_rw_gen_ctrl___en___lsb 0
88#define reg_eth_rw_gen_ctrl___en___width 1
89#define reg_eth_rw_gen_ctrl___en___bit 0
90#define reg_eth_rw_gen_ctrl___phy___lsb 1
91#define reg_eth_rw_gen_ctrl___phy___width 2
92#define reg_eth_rw_gen_ctrl___protocol___lsb 3
93#define reg_eth_rw_gen_ctrl___protocol___width 1
94#define reg_eth_rw_gen_ctrl___protocol___bit 3
95#define reg_eth_rw_gen_ctrl___loopback___lsb 4
96#define reg_eth_rw_gen_ctrl___loopback___width 1
97#define reg_eth_rw_gen_ctrl___loopback___bit 4
98#define reg_eth_rw_gen_ctrl___flow_ctrl_dis___lsb 5
99#define reg_eth_rw_gen_ctrl___flow_ctrl_dis___width 1
100#define reg_eth_rw_gen_ctrl___flow_ctrl_dis___bit 5
101#define reg_eth_rw_gen_ctrl_offset 24
102
103/* Register rw_rec_ctrl, scope eth, type rw */
104#define reg_eth_rw_rec_ctrl___ma0___lsb 0
105#define reg_eth_rw_rec_ctrl___ma0___width 1
106#define reg_eth_rw_rec_ctrl___ma0___bit 0
107#define reg_eth_rw_rec_ctrl___ma1___lsb 1
108#define reg_eth_rw_rec_ctrl___ma1___width 1
109#define reg_eth_rw_rec_ctrl___ma1___bit 1
110#define reg_eth_rw_rec_ctrl___individual___lsb 2
111#define reg_eth_rw_rec_ctrl___individual___width 1
112#define reg_eth_rw_rec_ctrl___individual___bit 2
113#define reg_eth_rw_rec_ctrl___broadcast___lsb 3
114#define reg_eth_rw_rec_ctrl___broadcast___width 1
115#define reg_eth_rw_rec_ctrl___broadcast___bit 3
116#define reg_eth_rw_rec_ctrl___undersize___lsb 4
117#define reg_eth_rw_rec_ctrl___undersize___width 1
118#define reg_eth_rw_rec_ctrl___undersize___bit 4
119#define reg_eth_rw_rec_ctrl___oversize___lsb 5
120#define reg_eth_rw_rec_ctrl___oversize___width 1
121#define reg_eth_rw_rec_ctrl___oversize___bit 5
122#define reg_eth_rw_rec_ctrl___bad_crc___lsb 6
123#define reg_eth_rw_rec_ctrl___bad_crc___width 1
124#define reg_eth_rw_rec_ctrl___bad_crc___bit 6
125#define reg_eth_rw_rec_ctrl___duplex___lsb 7
126#define reg_eth_rw_rec_ctrl___duplex___width 1
127#define reg_eth_rw_rec_ctrl___duplex___bit 7
128#define reg_eth_rw_rec_ctrl___max_size___lsb 8
129#define reg_eth_rw_rec_ctrl___max_size___width 1
130#define reg_eth_rw_rec_ctrl___max_size___bit 8
131#define reg_eth_rw_rec_ctrl_offset 28
132
133/* Register rw_tr_ctrl, scope eth, type rw */
134#define reg_eth_rw_tr_ctrl___crc___lsb 0
135#define reg_eth_rw_tr_ctrl___crc___width 1
136#define reg_eth_rw_tr_ctrl___crc___bit 0
137#define reg_eth_rw_tr_ctrl___pad___lsb 1
138#define reg_eth_rw_tr_ctrl___pad___width 1
139#define reg_eth_rw_tr_ctrl___pad___bit 1
140#define reg_eth_rw_tr_ctrl___retry___lsb 2
141#define reg_eth_rw_tr_ctrl___retry___width 1
142#define reg_eth_rw_tr_ctrl___retry___bit 2
143#define reg_eth_rw_tr_ctrl___ignore_col___lsb 3
144#define reg_eth_rw_tr_ctrl___ignore_col___width 1
145#define reg_eth_rw_tr_ctrl___ignore_col___bit 3
146#define reg_eth_rw_tr_ctrl___cancel___lsb 4
147#define reg_eth_rw_tr_ctrl___cancel___width 1
148#define reg_eth_rw_tr_ctrl___cancel___bit 4
149#define reg_eth_rw_tr_ctrl___hsh_delay___lsb 5
150#define reg_eth_rw_tr_ctrl___hsh_delay___width 1
151#define reg_eth_rw_tr_ctrl___hsh_delay___bit 5
152#define reg_eth_rw_tr_ctrl___ignore_crs___lsb 6
153#define reg_eth_rw_tr_ctrl___ignore_crs___width 1
154#define reg_eth_rw_tr_ctrl___ignore_crs___bit 6
155#define reg_eth_rw_tr_ctrl_offset 32
156
157/* Register rw_clr_err, scope eth, type rw */
158#define reg_eth_rw_clr_err___clr___lsb 0
159#define reg_eth_rw_clr_err___clr___width 1
160#define reg_eth_rw_clr_err___clr___bit 0
161#define reg_eth_rw_clr_err_offset 36
162
163/* Register rw_mgm_ctrl, scope eth, type rw */
164#define reg_eth_rw_mgm_ctrl___mdio___lsb 0
165#define reg_eth_rw_mgm_ctrl___mdio___width 1
166#define reg_eth_rw_mgm_ctrl___mdio___bit 0
167#define reg_eth_rw_mgm_ctrl___mdoe___lsb 1
168#define reg_eth_rw_mgm_ctrl___mdoe___width 1
169#define reg_eth_rw_mgm_ctrl___mdoe___bit 1
170#define reg_eth_rw_mgm_ctrl___mdc___lsb 2
171#define reg_eth_rw_mgm_ctrl___mdc___width 1
172#define reg_eth_rw_mgm_ctrl___mdc___bit 2
173#define reg_eth_rw_mgm_ctrl___phyclk___lsb 3
174#define reg_eth_rw_mgm_ctrl___phyclk___width 1
175#define reg_eth_rw_mgm_ctrl___phyclk___bit 3
176#define reg_eth_rw_mgm_ctrl___txdata___lsb 4
177#define reg_eth_rw_mgm_ctrl___txdata___width 4
178#define reg_eth_rw_mgm_ctrl___txen___lsb 8
179#define reg_eth_rw_mgm_ctrl___txen___width 1
180#define reg_eth_rw_mgm_ctrl___txen___bit 8
181#define reg_eth_rw_mgm_ctrl_offset 40
182
183/* Register r_stat, scope eth, type r */
184#define reg_eth_r_stat___mdio___lsb 0
185#define reg_eth_r_stat___mdio___width 1
186#define reg_eth_r_stat___mdio___bit 0
187#define reg_eth_r_stat___exc_col___lsb 1
188#define reg_eth_r_stat___exc_col___width 1
189#define reg_eth_r_stat___exc_col___bit 1
190#define reg_eth_r_stat___urun___lsb 2
191#define reg_eth_r_stat___urun___width 1
192#define reg_eth_r_stat___urun___bit 2
193#define reg_eth_r_stat___phyclk___lsb 3
194#define reg_eth_r_stat___phyclk___width 1
195#define reg_eth_r_stat___phyclk___bit 3
196#define reg_eth_r_stat___txdata___lsb 4
197#define reg_eth_r_stat___txdata___width 4
198#define reg_eth_r_stat___txen___lsb 8
199#define reg_eth_r_stat___txen___width 1
200#define reg_eth_r_stat___txen___bit 8
201#define reg_eth_r_stat___col___lsb 9
202#define reg_eth_r_stat___col___width 1
203#define reg_eth_r_stat___col___bit 9
204#define reg_eth_r_stat___crs___lsb 10
205#define reg_eth_r_stat___crs___width 1
206#define reg_eth_r_stat___crs___bit 10
207#define reg_eth_r_stat___txclk___lsb 11
208#define reg_eth_r_stat___txclk___width 1
209#define reg_eth_r_stat___txclk___bit 11
210#define reg_eth_r_stat___rxdata___lsb 12
211#define reg_eth_r_stat___rxdata___width 4
212#define reg_eth_r_stat___rxer___lsb 16
213#define reg_eth_r_stat___rxer___width 1
214#define reg_eth_r_stat___rxer___bit 16
215#define reg_eth_r_stat___rxdv___lsb 17
216#define reg_eth_r_stat___rxdv___width 1
217#define reg_eth_r_stat___rxdv___bit 17
218#define reg_eth_r_stat___rxclk___lsb 18
219#define reg_eth_r_stat___rxclk___width 1
220#define reg_eth_r_stat___rxclk___bit 18
221#define reg_eth_r_stat_offset 44
222
223/* Register rs_rec_cnt, scope eth, type rs */
224#define reg_eth_rs_rec_cnt___crc_err___lsb 0
225#define reg_eth_rs_rec_cnt___crc_err___width 8
226#define reg_eth_rs_rec_cnt___align_err___lsb 8
227#define reg_eth_rs_rec_cnt___align_err___width 8
228#define reg_eth_rs_rec_cnt___oversize___lsb 16
229#define reg_eth_rs_rec_cnt___oversize___width 8
230#define reg_eth_rs_rec_cnt___congestion___lsb 24
231#define reg_eth_rs_rec_cnt___congestion___width 8
232#define reg_eth_rs_rec_cnt_offset 48
233
234/* Register r_rec_cnt, scope eth, type r */
235#define reg_eth_r_rec_cnt___crc_err___lsb 0
236#define reg_eth_r_rec_cnt___crc_err___width 8
237#define reg_eth_r_rec_cnt___align_err___lsb 8
238#define reg_eth_r_rec_cnt___align_err___width 8
239#define reg_eth_r_rec_cnt___oversize___lsb 16
240#define reg_eth_r_rec_cnt___oversize___width 8
241#define reg_eth_r_rec_cnt___congestion___lsb 24
242#define reg_eth_r_rec_cnt___congestion___width 8
243#define reg_eth_r_rec_cnt_offset 52
244
245/* Register rs_tr_cnt, scope eth, type rs */
246#define reg_eth_rs_tr_cnt___single_col___lsb 0
247#define reg_eth_rs_tr_cnt___single_col___width 8
248#define reg_eth_rs_tr_cnt___mult_col___lsb 8
249#define reg_eth_rs_tr_cnt___mult_col___width 8
250#define reg_eth_rs_tr_cnt___late_col___lsb 16
251#define reg_eth_rs_tr_cnt___late_col___width 8
252#define reg_eth_rs_tr_cnt___deferred___lsb 24
253#define reg_eth_rs_tr_cnt___deferred___width 8
254#define reg_eth_rs_tr_cnt_offset 56
255
256/* Register r_tr_cnt, scope eth, type r */
257#define reg_eth_r_tr_cnt___single_col___lsb 0
258#define reg_eth_r_tr_cnt___single_col___width 8
259#define reg_eth_r_tr_cnt___mult_col___lsb 8
260#define reg_eth_r_tr_cnt___mult_col___width 8
261#define reg_eth_r_tr_cnt___late_col___lsb 16
262#define reg_eth_r_tr_cnt___late_col___width 8
263#define reg_eth_r_tr_cnt___deferred___lsb 24
264#define reg_eth_r_tr_cnt___deferred___width 8
265#define reg_eth_r_tr_cnt_offset 60
266
267/* Register rs_phy_cnt, scope eth, type rs */
268#define reg_eth_rs_phy_cnt___carrier_loss___lsb 0
269#define reg_eth_rs_phy_cnt___carrier_loss___width 8
270#define reg_eth_rs_phy_cnt___sqe_err___lsb 8
271#define reg_eth_rs_phy_cnt___sqe_err___width 8
272#define reg_eth_rs_phy_cnt_offset 64
273
274/* Register r_phy_cnt, scope eth, type r */
275#define reg_eth_r_phy_cnt___carrier_loss___lsb 0
276#define reg_eth_r_phy_cnt___carrier_loss___width 8
277#define reg_eth_r_phy_cnt___sqe_err___lsb 8
278#define reg_eth_r_phy_cnt___sqe_err___width 8
279#define reg_eth_r_phy_cnt_offset 68
280
281/* Register rw_test_ctrl, scope eth, type rw */
282#define reg_eth_rw_test_ctrl___snmp_inc___lsb 0
283#define reg_eth_rw_test_ctrl___snmp_inc___width 1
284#define reg_eth_rw_test_ctrl___snmp_inc___bit 0
285#define reg_eth_rw_test_ctrl___snmp___lsb 1
286#define reg_eth_rw_test_ctrl___snmp___width 1
287#define reg_eth_rw_test_ctrl___snmp___bit 1
288#define reg_eth_rw_test_ctrl___backoff___lsb 2
289#define reg_eth_rw_test_ctrl___backoff___width 1
290#define reg_eth_rw_test_ctrl___backoff___bit 2
291#define reg_eth_rw_test_ctrl_offset 72
292
293/* Register rw_intr_mask, scope eth, type rw */
294#define reg_eth_rw_intr_mask___crc___lsb 0
295#define reg_eth_rw_intr_mask___crc___width 1
296#define reg_eth_rw_intr_mask___crc___bit 0
297#define reg_eth_rw_intr_mask___align___lsb 1
298#define reg_eth_rw_intr_mask___align___width 1
299#define reg_eth_rw_intr_mask___align___bit 1
300#define reg_eth_rw_intr_mask___oversize___lsb 2
301#define reg_eth_rw_intr_mask___oversize___width 1
302#define reg_eth_rw_intr_mask___oversize___bit 2
303#define reg_eth_rw_intr_mask___congestion___lsb 3
304#define reg_eth_rw_intr_mask___congestion___width 1
305#define reg_eth_rw_intr_mask___congestion___bit 3
306#define reg_eth_rw_intr_mask___single_col___lsb 4
307#define reg_eth_rw_intr_mask___single_col___width 1
308#define reg_eth_rw_intr_mask___single_col___bit 4
309#define reg_eth_rw_intr_mask___mult_col___lsb 5
310#define reg_eth_rw_intr_mask___mult_col___width 1
311#define reg_eth_rw_intr_mask___mult_col___bit 5
312#define reg_eth_rw_intr_mask___late_col___lsb 6
313#define reg_eth_rw_intr_mask___late_col___width 1
314#define reg_eth_rw_intr_mask___late_col___bit 6
315#define reg_eth_rw_intr_mask___deferred___lsb 7
316#define reg_eth_rw_intr_mask___deferred___width 1
317#define reg_eth_rw_intr_mask___deferred___bit 7
318#define reg_eth_rw_intr_mask___carrier_loss___lsb 8
319#define reg_eth_rw_intr_mask___carrier_loss___width 1
320#define reg_eth_rw_intr_mask___carrier_loss___bit 8
321#define reg_eth_rw_intr_mask___sqe_test_err___lsb 9
322#define reg_eth_rw_intr_mask___sqe_test_err___width 1
323#define reg_eth_rw_intr_mask___sqe_test_err___bit 9
324#define reg_eth_rw_intr_mask___orun___lsb 10
325#define reg_eth_rw_intr_mask___orun___width 1
326#define reg_eth_rw_intr_mask___orun___bit 10
327#define reg_eth_rw_intr_mask___urun___lsb 11
328#define reg_eth_rw_intr_mask___urun___width 1
329#define reg_eth_rw_intr_mask___urun___bit 11
330#define reg_eth_rw_intr_mask___excessive_col___lsb 12
331#define reg_eth_rw_intr_mask___excessive_col___width 1
332#define reg_eth_rw_intr_mask___excessive_col___bit 12
333#define reg_eth_rw_intr_mask___mdio___lsb 13
334#define reg_eth_rw_intr_mask___mdio___width 1
335#define reg_eth_rw_intr_mask___mdio___bit 13
336#define reg_eth_rw_intr_mask_offset 76
337
338/* Register rw_ack_intr, scope eth, type rw */
339#define reg_eth_rw_ack_intr___crc___lsb 0
340#define reg_eth_rw_ack_intr___crc___width 1
341#define reg_eth_rw_ack_intr___crc___bit 0
342#define reg_eth_rw_ack_intr___align___lsb 1
343#define reg_eth_rw_ack_intr___align___width 1
344#define reg_eth_rw_ack_intr___align___bit 1
345#define reg_eth_rw_ack_intr___oversize___lsb 2
346#define reg_eth_rw_ack_intr___oversize___width 1
347#define reg_eth_rw_ack_intr___oversize___bit 2
348#define reg_eth_rw_ack_intr___congestion___lsb 3
349#define reg_eth_rw_ack_intr___congestion___width 1
350#define reg_eth_rw_ack_intr___congestion___bit 3
351#define reg_eth_rw_ack_intr___single_col___lsb 4
352#define reg_eth_rw_ack_intr___single_col___width 1
353#define reg_eth_rw_ack_intr___single_col___bit 4
354#define reg_eth_rw_ack_intr___mult_col___lsb 5
355#define reg_eth_rw_ack_intr___mult_col___width 1
356#define reg_eth_rw_ack_intr___mult_col___bit 5
357#define reg_eth_rw_ack_intr___late_col___lsb 6
358#define reg_eth_rw_ack_intr___late_col___width 1
359#define reg_eth_rw_ack_intr___late_col___bit 6
360#define reg_eth_rw_ack_intr___deferred___lsb 7
361#define reg_eth_rw_ack_intr___deferred___width 1
362#define reg_eth_rw_ack_intr___deferred___bit 7
363#define reg_eth_rw_ack_intr___carrier_loss___lsb 8
364#define reg_eth_rw_ack_intr___carrier_loss___width 1
365#define reg_eth_rw_ack_intr___carrier_loss___bit 8
366#define reg_eth_rw_ack_intr___sqe_test_err___lsb 9
367#define reg_eth_rw_ack_intr___sqe_test_err___width 1
368#define reg_eth_rw_ack_intr___sqe_test_err___bit 9
369#define reg_eth_rw_ack_intr___orun___lsb 10
370#define reg_eth_rw_ack_intr___orun___width 1
371#define reg_eth_rw_ack_intr___orun___bit 10
372#define reg_eth_rw_ack_intr___urun___lsb 11
373#define reg_eth_rw_ack_intr___urun___width 1
374#define reg_eth_rw_ack_intr___urun___bit 11
375#define reg_eth_rw_ack_intr___excessive_col___lsb 12
376#define reg_eth_rw_ack_intr___excessive_col___width 1
377#define reg_eth_rw_ack_intr___excessive_col___bit 12
378#define reg_eth_rw_ack_intr___mdio___lsb 13
379#define reg_eth_rw_ack_intr___mdio___width 1
380#define reg_eth_rw_ack_intr___mdio___bit 13
381#define reg_eth_rw_ack_intr_offset 80
382
383/* Register r_intr, scope eth, type r */
384#define reg_eth_r_intr___crc___lsb 0
385#define reg_eth_r_intr___crc___width 1
386#define reg_eth_r_intr___crc___bit 0
387#define reg_eth_r_intr___align___lsb 1
388#define reg_eth_r_intr___align___width 1
389#define reg_eth_r_intr___align___bit 1
390#define reg_eth_r_intr___oversize___lsb 2
391#define reg_eth_r_intr___oversize___width 1
392#define reg_eth_r_intr___oversize___bit 2
393#define reg_eth_r_intr___congestion___lsb 3
394#define reg_eth_r_intr___congestion___width 1
395#define reg_eth_r_intr___congestion___bit 3
396#define reg_eth_r_intr___single_col___lsb 4
397#define reg_eth_r_intr___single_col___width 1
398#define reg_eth_r_intr___single_col___bit 4
399#define reg_eth_r_intr___mult_col___lsb 5
400#define reg_eth_r_intr___mult_col___width 1
401#define reg_eth_r_intr___mult_col___bit 5
402#define reg_eth_r_intr___late_col___lsb 6
403#define reg_eth_r_intr___late_col___width 1
404#define reg_eth_r_intr___late_col___bit 6
405#define reg_eth_r_intr___deferred___lsb 7
406#define reg_eth_r_intr___deferred___width 1
407#define reg_eth_r_intr___deferred___bit 7
408#define reg_eth_r_intr___carrier_loss___lsb 8
409#define reg_eth_r_intr___carrier_loss___width 1
410#define reg_eth_r_intr___carrier_loss___bit 8
411#define reg_eth_r_intr___sqe_test_err___lsb 9
412#define reg_eth_r_intr___sqe_test_err___width 1
413#define reg_eth_r_intr___sqe_test_err___bit 9
414#define reg_eth_r_intr___orun___lsb 10
415#define reg_eth_r_intr___orun___width 1
416#define reg_eth_r_intr___orun___bit 10
417#define reg_eth_r_intr___urun___lsb 11
418#define reg_eth_r_intr___urun___width 1
419#define reg_eth_r_intr___urun___bit 11
420#define reg_eth_r_intr___excessive_col___lsb 12
421#define reg_eth_r_intr___excessive_col___width 1
422#define reg_eth_r_intr___excessive_col___bit 12
423#define reg_eth_r_intr___mdio___lsb 13
424#define reg_eth_r_intr___mdio___width 1
425#define reg_eth_r_intr___mdio___bit 13
426#define reg_eth_r_intr_offset 84
427
428/* Register r_masked_intr, scope eth, type r */
429#define reg_eth_r_masked_intr___crc___lsb 0
430#define reg_eth_r_masked_intr___crc___width 1
431#define reg_eth_r_masked_intr___crc___bit 0
432#define reg_eth_r_masked_intr___align___lsb 1
433#define reg_eth_r_masked_intr___align___width 1
434#define reg_eth_r_masked_intr___align___bit 1
435#define reg_eth_r_masked_intr___oversize___lsb 2
436#define reg_eth_r_masked_intr___oversize___width 1
437#define reg_eth_r_masked_intr___oversize___bit 2
438#define reg_eth_r_masked_intr___congestion___lsb 3
439#define reg_eth_r_masked_intr___congestion___width 1
440#define reg_eth_r_masked_intr___congestion___bit 3
441#define reg_eth_r_masked_intr___single_col___lsb 4
442#define reg_eth_r_masked_intr___single_col___width 1
443#define reg_eth_r_masked_intr___single_col___bit 4
444#define reg_eth_r_masked_intr___mult_col___lsb 5
445#define reg_eth_r_masked_intr___mult_col___width 1
446#define reg_eth_r_masked_intr___mult_col___bit 5
447#define reg_eth_r_masked_intr___late_col___lsb 6
448#define reg_eth_r_masked_intr___late_col___width 1
449#define reg_eth_r_masked_intr___late_col___bit 6
450#define reg_eth_r_masked_intr___deferred___lsb 7
451#define reg_eth_r_masked_intr___deferred___width 1
452#define reg_eth_r_masked_intr___deferred___bit 7
453#define reg_eth_r_masked_intr___carrier_loss___lsb 8
454#define reg_eth_r_masked_intr___carrier_loss___width 1
455#define reg_eth_r_masked_intr___carrier_loss___bit 8
456#define reg_eth_r_masked_intr___sqe_test_err___lsb 9
457#define reg_eth_r_masked_intr___sqe_test_err___width 1
458#define reg_eth_r_masked_intr___sqe_test_err___bit 9
459#define reg_eth_r_masked_intr___orun___lsb 10
460#define reg_eth_r_masked_intr___orun___width 1
461#define reg_eth_r_masked_intr___orun___bit 10
462#define reg_eth_r_masked_intr___urun___lsb 11
463#define reg_eth_r_masked_intr___urun___width 1
464#define reg_eth_r_masked_intr___urun___bit 11
465#define reg_eth_r_masked_intr___excessive_col___lsb 12
466#define reg_eth_r_masked_intr___excessive_col___width 1
467#define reg_eth_r_masked_intr___excessive_col___bit 12
468#define reg_eth_r_masked_intr___mdio___lsb 13
469#define reg_eth_r_masked_intr___mdio___width 1
470#define reg_eth_r_masked_intr___mdio___bit 13
471#define reg_eth_r_masked_intr_offset 88
472
473
474/* Constants */
475#define regk_eth_discard 0x00000000
476#define regk_eth_ether 0x00000000
477#define regk_eth_full 0x00000001
478#define regk_eth_half 0x00000000
479#define regk_eth_hsh 0x00000001
480#define regk_eth_mii 0x00000001
481#define regk_eth_mii_clk 0x00000000
482#define regk_eth_mii_rec 0x00000002
483#define regk_eth_no 0x00000000
484#define regk_eth_rec 0x00000001
485#define regk_eth_rw_ga_hi_default 0x00000000
486#define regk_eth_rw_ga_lo_default 0x00000000
487#define regk_eth_rw_gen_ctrl_default 0x00000000
488#define regk_eth_rw_intr_mask_default 0x00000000
489#define regk_eth_rw_ma0_hi_default 0x00000000
490#define regk_eth_rw_ma0_lo_default 0x00000000
491#define regk_eth_rw_ma1_hi_default 0x00000000
492#define regk_eth_rw_ma1_lo_default 0x00000000
493#define regk_eth_rw_mgm_ctrl_default 0x00000000
494#define regk_eth_rw_test_ctrl_default 0x00000000
495#define regk_eth_size1518 0x00000000
496#define regk_eth_size1522 0x00000001
497#define regk_eth_yes 0x00000001
498#endif /* __eth_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/gio_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/gio_defs_asm.h
new file mode 100644
index 000000000000..35356bc08629
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/gio_defs_asm.h
@@ -0,0 +1,276 @@
1#ifndef __gio_defs_asm_h
2#define __gio_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/gio/rtl/gio_regs.r
7 * id: gio_regs.r,v 1.5 2005/02/04 09:43:21 perz Exp
8 * last modfied: Mon Apr 11 16:07:47 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/gio_defs_asm.h ../../inst/gio/rtl/gio_regs.r
11 * id: $Id: gio_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_pa_dout, scope gio, type rw */
57#define reg_gio_rw_pa_dout___data___lsb 0
58#define reg_gio_rw_pa_dout___data___width 8
59#define reg_gio_rw_pa_dout_offset 0
60
61/* Register r_pa_din, scope gio, type r */
62#define reg_gio_r_pa_din___data___lsb 0
63#define reg_gio_r_pa_din___data___width 8
64#define reg_gio_r_pa_din_offset 4
65
66/* Register rw_pa_oe, scope gio, type rw */
67#define reg_gio_rw_pa_oe___oe___lsb 0
68#define reg_gio_rw_pa_oe___oe___width 8
69#define reg_gio_rw_pa_oe_offset 8
70
71/* Register rw_intr_cfg, scope gio, type rw */
72#define reg_gio_rw_intr_cfg___pa0___lsb 0
73#define reg_gio_rw_intr_cfg___pa0___width 3
74#define reg_gio_rw_intr_cfg___pa1___lsb 3
75#define reg_gio_rw_intr_cfg___pa1___width 3
76#define reg_gio_rw_intr_cfg___pa2___lsb 6
77#define reg_gio_rw_intr_cfg___pa2___width 3
78#define reg_gio_rw_intr_cfg___pa3___lsb 9
79#define reg_gio_rw_intr_cfg___pa3___width 3
80#define reg_gio_rw_intr_cfg___pa4___lsb 12
81#define reg_gio_rw_intr_cfg___pa4___width 3
82#define reg_gio_rw_intr_cfg___pa5___lsb 15
83#define reg_gio_rw_intr_cfg___pa5___width 3
84#define reg_gio_rw_intr_cfg___pa6___lsb 18
85#define reg_gio_rw_intr_cfg___pa6___width 3
86#define reg_gio_rw_intr_cfg___pa7___lsb 21
87#define reg_gio_rw_intr_cfg___pa7___width 3
88#define reg_gio_rw_intr_cfg_offset 12
89
90/* Register rw_intr_mask, scope gio, type rw */
91#define reg_gio_rw_intr_mask___pa0___lsb 0
92#define reg_gio_rw_intr_mask___pa0___width 1
93#define reg_gio_rw_intr_mask___pa0___bit 0
94#define reg_gio_rw_intr_mask___pa1___lsb 1
95#define reg_gio_rw_intr_mask___pa1___width 1
96#define reg_gio_rw_intr_mask___pa1___bit 1
97#define reg_gio_rw_intr_mask___pa2___lsb 2
98#define reg_gio_rw_intr_mask___pa2___width 1
99#define reg_gio_rw_intr_mask___pa2___bit 2
100#define reg_gio_rw_intr_mask___pa3___lsb 3
101#define reg_gio_rw_intr_mask___pa3___width 1
102#define reg_gio_rw_intr_mask___pa3___bit 3
103#define reg_gio_rw_intr_mask___pa4___lsb 4
104#define reg_gio_rw_intr_mask___pa4___width 1
105#define reg_gio_rw_intr_mask___pa4___bit 4
106#define reg_gio_rw_intr_mask___pa5___lsb 5
107#define reg_gio_rw_intr_mask___pa5___width 1
108#define reg_gio_rw_intr_mask___pa5___bit 5
109#define reg_gio_rw_intr_mask___pa6___lsb 6
110#define reg_gio_rw_intr_mask___pa6___width 1
111#define reg_gio_rw_intr_mask___pa6___bit 6
112#define reg_gio_rw_intr_mask___pa7___lsb 7
113#define reg_gio_rw_intr_mask___pa7___width 1
114#define reg_gio_rw_intr_mask___pa7___bit 7
115#define reg_gio_rw_intr_mask_offset 16
116
117/* Register rw_ack_intr, scope gio, type rw */
118#define reg_gio_rw_ack_intr___pa0___lsb 0
119#define reg_gio_rw_ack_intr___pa0___width 1
120#define reg_gio_rw_ack_intr___pa0___bit 0
121#define reg_gio_rw_ack_intr___pa1___lsb 1
122#define reg_gio_rw_ack_intr___pa1___width 1
123#define reg_gio_rw_ack_intr___pa1___bit 1
124#define reg_gio_rw_ack_intr___pa2___lsb 2
125#define reg_gio_rw_ack_intr___pa2___width 1
126#define reg_gio_rw_ack_intr___pa2___bit 2
127#define reg_gio_rw_ack_intr___pa3___lsb 3
128#define reg_gio_rw_ack_intr___pa3___width 1
129#define reg_gio_rw_ack_intr___pa3___bit 3
130#define reg_gio_rw_ack_intr___pa4___lsb 4
131#define reg_gio_rw_ack_intr___pa4___width 1
132#define reg_gio_rw_ack_intr___pa4___bit 4
133#define reg_gio_rw_ack_intr___pa5___lsb 5
134#define reg_gio_rw_ack_intr___pa5___width 1
135#define reg_gio_rw_ack_intr___pa5___bit 5
136#define reg_gio_rw_ack_intr___pa6___lsb 6
137#define reg_gio_rw_ack_intr___pa6___width 1
138#define reg_gio_rw_ack_intr___pa6___bit 6
139#define reg_gio_rw_ack_intr___pa7___lsb 7
140#define reg_gio_rw_ack_intr___pa7___width 1
141#define reg_gio_rw_ack_intr___pa7___bit 7
142#define reg_gio_rw_ack_intr_offset 20
143
144/* Register r_intr, scope gio, type r */
145#define reg_gio_r_intr___pa0___lsb 0
146#define reg_gio_r_intr___pa0___width 1
147#define reg_gio_r_intr___pa0___bit 0
148#define reg_gio_r_intr___pa1___lsb 1
149#define reg_gio_r_intr___pa1___width 1
150#define reg_gio_r_intr___pa1___bit 1
151#define reg_gio_r_intr___pa2___lsb 2
152#define reg_gio_r_intr___pa2___width 1
153#define reg_gio_r_intr___pa2___bit 2
154#define reg_gio_r_intr___pa3___lsb 3
155#define reg_gio_r_intr___pa3___width 1
156#define reg_gio_r_intr___pa3___bit 3
157#define reg_gio_r_intr___pa4___lsb 4
158#define reg_gio_r_intr___pa4___width 1
159#define reg_gio_r_intr___pa4___bit 4
160#define reg_gio_r_intr___pa5___lsb 5
161#define reg_gio_r_intr___pa5___width 1
162#define reg_gio_r_intr___pa5___bit 5
163#define reg_gio_r_intr___pa6___lsb 6
164#define reg_gio_r_intr___pa6___width 1
165#define reg_gio_r_intr___pa6___bit 6
166#define reg_gio_r_intr___pa7___lsb 7
167#define reg_gio_r_intr___pa7___width 1
168#define reg_gio_r_intr___pa7___bit 7
169#define reg_gio_r_intr_offset 24
170
171/* Register r_masked_intr, scope gio, type r */
172#define reg_gio_r_masked_intr___pa0___lsb 0
173#define reg_gio_r_masked_intr___pa0___width 1
174#define reg_gio_r_masked_intr___pa0___bit 0
175#define reg_gio_r_masked_intr___pa1___lsb 1
176#define reg_gio_r_masked_intr___pa1___width 1
177#define reg_gio_r_masked_intr___pa1___bit 1
178#define reg_gio_r_masked_intr___pa2___lsb 2
179#define reg_gio_r_masked_intr___pa2___width 1
180#define reg_gio_r_masked_intr___pa2___bit 2
181#define reg_gio_r_masked_intr___pa3___lsb 3
182#define reg_gio_r_masked_intr___pa3___width 1
183#define reg_gio_r_masked_intr___pa3___bit 3
184#define reg_gio_r_masked_intr___pa4___lsb 4
185#define reg_gio_r_masked_intr___pa4___width 1
186#define reg_gio_r_masked_intr___pa4___bit 4
187#define reg_gio_r_masked_intr___pa5___lsb 5
188#define reg_gio_r_masked_intr___pa5___width 1
189#define reg_gio_r_masked_intr___pa5___bit 5
190#define reg_gio_r_masked_intr___pa6___lsb 6
191#define reg_gio_r_masked_intr___pa6___width 1
192#define reg_gio_r_masked_intr___pa6___bit 6
193#define reg_gio_r_masked_intr___pa7___lsb 7
194#define reg_gio_r_masked_intr___pa7___width 1
195#define reg_gio_r_masked_intr___pa7___bit 7
196#define reg_gio_r_masked_intr_offset 28
197
198/* Register rw_pb_dout, scope gio, type rw */
199#define reg_gio_rw_pb_dout___data___lsb 0
200#define reg_gio_rw_pb_dout___data___width 18
201#define reg_gio_rw_pb_dout_offset 32
202
203/* Register r_pb_din, scope gio, type r */
204#define reg_gio_r_pb_din___data___lsb 0
205#define reg_gio_r_pb_din___data___width 18
206#define reg_gio_r_pb_din_offset 36
207
208/* Register rw_pb_oe, scope gio, type rw */
209#define reg_gio_rw_pb_oe___oe___lsb 0
210#define reg_gio_rw_pb_oe___oe___width 18
211#define reg_gio_rw_pb_oe_offset 40
212
213/* Register rw_pc_dout, scope gio, type rw */
214#define reg_gio_rw_pc_dout___data___lsb 0
215#define reg_gio_rw_pc_dout___data___width 18
216#define reg_gio_rw_pc_dout_offset 48
217
218/* Register r_pc_din, scope gio, type r */
219#define reg_gio_r_pc_din___data___lsb 0
220#define reg_gio_r_pc_din___data___width 18
221#define reg_gio_r_pc_din_offset 52
222
223/* Register rw_pc_oe, scope gio, type rw */
224#define reg_gio_rw_pc_oe___oe___lsb 0
225#define reg_gio_rw_pc_oe___oe___width 18
226#define reg_gio_rw_pc_oe_offset 56
227
228/* Register rw_pd_dout, scope gio, type rw */
229#define reg_gio_rw_pd_dout___data___lsb 0
230#define reg_gio_rw_pd_dout___data___width 18
231#define reg_gio_rw_pd_dout_offset 64
232
233/* Register r_pd_din, scope gio, type r */
234#define reg_gio_r_pd_din___data___lsb 0
235#define reg_gio_r_pd_din___data___width 18
236#define reg_gio_r_pd_din_offset 68
237
238/* Register rw_pd_oe, scope gio, type rw */
239#define reg_gio_rw_pd_oe___oe___lsb 0
240#define reg_gio_rw_pd_oe___oe___width 18
241#define reg_gio_rw_pd_oe_offset 72
242
243/* Register rw_pe_dout, scope gio, type rw */
244#define reg_gio_rw_pe_dout___data___lsb 0
245#define reg_gio_rw_pe_dout___data___width 18
246#define reg_gio_rw_pe_dout_offset 80
247
248/* Register r_pe_din, scope gio, type r */
249#define reg_gio_r_pe_din___data___lsb 0
250#define reg_gio_r_pe_din___data___width 18
251#define reg_gio_r_pe_din_offset 84
252
253/* Register rw_pe_oe, scope gio, type rw */
254#define reg_gio_rw_pe_oe___oe___lsb 0
255#define reg_gio_rw_pe_oe___oe___width 18
256#define reg_gio_rw_pe_oe_offset 88
257
258
259/* Constants */
260#define regk_gio_anyedge 0x00000007
261#define regk_gio_hi 0x00000001
262#define regk_gio_lo 0x00000002
263#define regk_gio_negedge 0x00000006
264#define regk_gio_no 0x00000000
265#define regk_gio_off 0x00000000
266#define regk_gio_posedge 0x00000005
267#define regk_gio_rw_intr_cfg_default 0x00000000
268#define regk_gio_rw_intr_mask_default 0x00000000
269#define regk_gio_rw_pa_oe_default 0x00000000
270#define regk_gio_rw_pb_oe_default 0x00000000
271#define regk_gio_rw_pc_oe_default 0x00000000
272#define regk_gio_rw_pd_oe_default 0x00000000
273#define regk_gio_rw_pe_oe_default 0x00000000
274#define regk_gio_set 0x00000003
275#define regk_gio_yes 0x00000001
276#endif /* __gio_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/intr_vect.h b/include/asm-cris/arch-v32/hwregs/asm/intr_vect.h
new file mode 100644
index 000000000000..c8315905c571
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/intr_vect.h
@@ -0,0 +1,38 @@
1/* Interrupt vector numbers autogenerated by /n/asic/design/tools/rdesc/src/rdes2intr version
2 from ../../inst/intr_vect/rtl/guinness/ivmask.config.r
3version . */
4
5#ifndef _______INST_INTR_VECT_RTL_GUINNESS_IVMASK_CONFIG_R
6#define _______INST_INTR_VECT_RTL_GUINNESS_IVMASK_CONFIG_R
7#define MEMARB_INTR_VECT 0x31
8#define GEN_IO_INTR_VECT 0x32
9#define IOP0_INTR_VECT 0x33
10#define IOP1_INTR_VECT 0x34
11#define IOP2_INTR_VECT 0x35
12#define IOP3_INTR_VECT 0x36
13#define DMA0_INTR_VECT 0x37
14#define DMA1_INTR_VECT 0x38
15#define DMA2_INTR_VECT 0x39
16#define DMA3_INTR_VECT 0x3a
17#define DMA4_INTR_VECT 0x3b
18#define DMA5_INTR_VECT 0x3c
19#define DMA6_INTR_VECT 0x3d
20#define DMA7_INTR_VECT 0x3e
21#define DMA8_INTR_VECT 0x3f
22#define DMA9_INTR_VECT 0x40
23#define ATA_INTR_VECT 0x41
24#define SSER0_INTR_VECT 0x42
25#define SSER1_INTR_VECT 0x43
26#define SER0_INTR_VECT 0x44
27#define SER1_INTR_VECT 0x45
28#define SER2_INTR_VECT 0x46
29#define SER3_INTR_VECT 0x47
30#define P21_INTR_VECT 0x48
31#define ETH0_INTR_VECT 0x49
32#define ETH1_INTR_VECT 0x4a
33#define TIMER_INTR_VECT 0x4b
34#define BIF_ARB_INTR_VECT 0x4c
35#define BIF_DMA_INTR_VECT 0x4d
36#define EXT_INTR_VECT 0x4e
37
38#endif
diff --git a/include/asm-cris/arch-v32/hwregs/asm/intr_vect_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/intr_vect_defs_asm.h
new file mode 100644
index 000000000000..6df2a433b02d
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/intr_vect_defs_asm.h
@@ -0,0 +1,355 @@
1#ifndef __intr_vect_defs_asm_h
2#define __intr_vect_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/intr_vect/rtl/guinness/ivmask.config.r
7 * id: ivmask.config.r,v 1.4 2005/02/15 16:05:38 stefans Exp
8 * last modfied: Mon Apr 11 16:08:03 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/intr_vect_defs_asm.h ../../inst/intr_vect/rtl/guinness/ivmask.config.r
11 * id: $Id: intr_vect_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_mask, scope intr_vect, type rw */
57#define reg_intr_vect_rw_mask___memarb___lsb 0
58#define reg_intr_vect_rw_mask___memarb___width 1
59#define reg_intr_vect_rw_mask___memarb___bit 0
60#define reg_intr_vect_rw_mask___gen_io___lsb 1
61#define reg_intr_vect_rw_mask___gen_io___width 1
62#define reg_intr_vect_rw_mask___gen_io___bit 1
63#define reg_intr_vect_rw_mask___iop0___lsb 2
64#define reg_intr_vect_rw_mask___iop0___width 1
65#define reg_intr_vect_rw_mask___iop0___bit 2
66#define reg_intr_vect_rw_mask___iop1___lsb 3
67#define reg_intr_vect_rw_mask___iop1___width 1
68#define reg_intr_vect_rw_mask___iop1___bit 3
69#define reg_intr_vect_rw_mask___iop2___lsb 4
70#define reg_intr_vect_rw_mask___iop2___width 1
71#define reg_intr_vect_rw_mask___iop2___bit 4
72#define reg_intr_vect_rw_mask___iop3___lsb 5
73#define reg_intr_vect_rw_mask___iop3___width 1
74#define reg_intr_vect_rw_mask___iop3___bit 5
75#define reg_intr_vect_rw_mask___dma0___lsb 6
76#define reg_intr_vect_rw_mask___dma0___width 1
77#define reg_intr_vect_rw_mask___dma0___bit 6
78#define reg_intr_vect_rw_mask___dma1___lsb 7
79#define reg_intr_vect_rw_mask___dma1___width 1
80#define reg_intr_vect_rw_mask___dma1___bit 7
81#define reg_intr_vect_rw_mask___dma2___lsb 8
82#define reg_intr_vect_rw_mask___dma2___width 1
83#define reg_intr_vect_rw_mask___dma2___bit 8
84#define reg_intr_vect_rw_mask___dma3___lsb 9
85#define reg_intr_vect_rw_mask___dma3___width 1
86#define reg_intr_vect_rw_mask___dma3___bit 9
87#define reg_intr_vect_rw_mask___dma4___lsb 10
88#define reg_intr_vect_rw_mask___dma4___width 1
89#define reg_intr_vect_rw_mask___dma4___bit 10
90#define reg_intr_vect_rw_mask___dma5___lsb 11
91#define reg_intr_vect_rw_mask___dma5___width 1
92#define reg_intr_vect_rw_mask___dma5___bit 11
93#define reg_intr_vect_rw_mask___dma6___lsb 12
94#define reg_intr_vect_rw_mask___dma6___width 1
95#define reg_intr_vect_rw_mask___dma6___bit 12
96#define reg_intr_vect_rw_mask___dma7___lsb 13
97#define reg_intr_vect_rw_mask___dma7___width 1
98#define reg_intr_vect_rw_mask___dma7___bit 13
99#define reg_intr_vect_rw_mask___dma8___lsb 14
100#define reg_intr_vect_rw_mask___dma8___width 1
101#define reg_intr_vect_rw_mask___dma8___bit 14
102#define reg_intr_vect_rw_mask___dma9___lsb 15
103#define reg_intr_vect_rw_mask___dma9___width 1
104#define reg_intr_vect_rw_mask___dma9___bit 15
105#define reg_intr_vect_rw_mask___ata___lsb 16
106#define reg_intr_vect_rw_mask___ata___width 1
107#define reg_intr_vect_rw_mask___ata___bit 16
108#define reg_intr_vect_rw_mask___sser0___lsb 17
109#define reg_intr_vect_rw_mask___sser0___width 1
110#define reg_intr_vect_rw_mask___sser0___bit 17
111#define reg_intr_vect_rw_mask___sser1___lsb 18
112#define reg_intr_vect_rw_mask___sser1___width 1
113#define reg_intr_vect_rw_mask___sser1___bit 18
114#define reg_intr_vect_rw_mask___ser0___lsb 19
115#define reg_intr_vect_rw_mask___ser0___width 1
116#define reg_intr_vect_rw_mask___ser0___bit 19
117#define reg_intr_vect_rw_mask___ser1___lsb 20
118#define reg_intr_vect_rw_mask___ser1___width 1
119#define reg_intr_vect_rw_mask___ser1___bit 20
120#define reg_intr_vect_rw_mask___ser2___lsb 21
121#define reg_intr_vect_rw_mask___ser2___width 1
122#define reg_intr_vect_rw_mask___ser2___bit 21
123#define reg_intr_vect_rw_mask___ser3___lsb 22
124#define reg_intr_vect_rw_mask___ser3___width 1
125#define reg_intr_vect_rw_mask___ser3___bit 22
126#define reg_intr_vect_rw_mask___p21___lsb 23
127#define reg_intr_vect_rw_mask___p21___width 1
128#define reg_intr_vect_rw_mask___p21___bit 23
129#define reg_intr_vect_rw_mask___eth0___lsb 24
130#define reg_intr_vect_rw_mask___eth0___width 1
131#define reg_intr_vect_rw_mask___eth0___bit 24
132#define reg_intr_vect_rw_mask___eth1___lsb 25
133#define reg_intr_vect_rw_mask___eth1___width 1
134#define reg_intr_vect_rw_mask___eth1___bit 25
135#define reg_intr_vect_rw_mask___timer___lsb 26
136#define reg_intr_vect_rw_mask___timer___width 1
137#define reg_intr_vect_rw_mask___timer___bit 26
138#define reg_intr_vect_rw_mask___bif_arb___lsb 27
139#define reg_intr_vect_rw_mask___bif_arb___width 1
140#define reg_intr_vect_rw_mask___bif_arb___bit 27
141#define reg_intr_vect_rw_mask___bif_dma___lsb 28
142#define reg_intr_vect_rw_mask___bif_dma___width 1
143#define reg_intr_vect_rw_mask___bif_dma___bit 28
144#define reg_intr_vect_rw_mask___ext___lsb 29
145#define reg_intr_vect_rw_mask___ext___width 1
146#define reg_intr_vect_rw_mask___ext___bit 29
147#define reg_intr_vect_rw_mask_offset 0
148
149/* Register r_vect, scope intr_vect, type r */
150#define reg_intr_vect_r_vect___memarb___lsb 0
151#define reg_intr_vect_r_vect___memarb___width 1
152#define reg_intr_vect_r_vect___memarb___bit 0
153#define reg_intr_vect_r_vect___gen_io___lsb 1
154#define reg_intr_vect_r_vect___gen_io___width 1
155#define reg_intr_vect_r_vect___gen_io___bit 1
156#define reg_intr_vect_r_vect___iop0___lsb 2
157#define reg_intr_vect_r_vect___iop0___width 1
158#define reg_intr_vect_r_vect___iop0___bit 2
159#define reg_intr_vect_r_vect___iop1___lsb 3
160#define reg_intr_vect_r_vect___iop1___width 1
161#define reg_intr_vect_r_vect___iop1___bit 3
162#define reg_intr_vect_r_vect___iop2___lsb 4
163#define reg_intr_vect_r_vect___iop2___width 1
164#define reg_intr_vect_r_vect___iop2___bit 4
165#define reg_intr_vect_r_vect___iop3___lsb 5
166#define reg_intr_vect_r_vect___iop3___width 1
167#define reg_intr_vect_r_vect___iop3___bit 5
168#define reg_intr_vect_r_vect___dma0___lsb 6
169#define reg_intr_vect_r_vect___dma0___width 1
170#define reg_intr_vect_r_vect___dma0___bit 6
171#define reg_intr_vect_r_vect___dma1___lsb 7
172#define reg_intr_vect_r_vect___dma1___width 1
173#define reg_intr_vect_r_vect___dma1___bit 7
174#define reg_intr_vect_r_vect___dma2___lsb 8
175#define reg_intr_vect_r_vect___dma2___width 1
176#define reg_intr_vect_r_vect___dma2___bit 8
177#define reg_intr_vect_r_vect___dma3___lsb 9
178#define reg_intr_vect_r_vect___dma3___width 1
179#define reg_intr_vect_r_vect___dma3___bit 9
180#define reg_intr_vect_r_vect___dma4___lsb 10
181#define reg_intr_vect_r_vect___dma4___width 1
182#define reg_intr_vect_r_vect___dma4___bit 10
183#define reg_intr_vect_r_vect___dma5___lsb 11
184#define reg_intr_vect_r_vect___dma5___width 1
185#define reg_intr_vect_r_vect___dma5___bit 11
186#define reg_intr_vect_r_vect___dma6___lsb 12
187#define reg_intr_vect_r_vect___dma6___width 1
188#define reg_intr_vect_r_vect___dma6___bit 12
189#define reg_intr_vect_r_vect___dma7___lsb 13
190#define reg_intr_vect_r_vect___dma7___width 1
191#define reg_intr_vect_r_vect___dma7___bit 13
192#define reg_intr_vect_r_vect___dma8___lsb 14
193#define reg_intr_vect_r_vect___dma8___width 1
194#define reg_intr_vect_r_vect___dma8___bit 14
195#define reg_intr_vect_r_vect___dma9___lsb 15
196#define reg_intr_vect_r_vect___dma9___width 1
197#define reg_intr_vect_r_vect___dma9___bit 15
198#define reg_intr_vect_r_vect___ata___lsb 16
199#define reg_intr_vect_r_vect___ata___width 1
200#define reg_intr_vect_r_vect___ata___bit 16
201#define reg_intr_vect_r_vect___sser0___lsb 17
202#define reg_intr_vect_r_vect___sser0___width 1
203#define reg_intr_vect_r_vect___sser0___bit 17
204#define reg_intr_vect_r_vect___sser1___lsb 18
205#define reg_intr_vect_r_vect___sser1___width 1
206#define reg_intr_vect_r_vect___sser1___bit 18
207#define reg_intr_vect_r_vect___ser0___lsb 19
208#define reg_intr_vect_r_vect___ser0___width 1
209#define reg_intr_vect_r_vect___ser0___bit 19
210#define reg_intr_vect_r_vect___ser1___lsb 20
211#define reg_intr_vect_r_vect___ser1___width 1
212#define reg_intr_vect_r_vect___ser1___bit 20
213#define reg_intr_vect_r_vect___ser2___lsb 21
214#define reg_intr_vect_r_vect___ser2___width 1
215#define reg_intr_vect_r_vect___ser2___bit 21
216#define reg_intr_vect_r_vect___ser3___lsb 22
217#define reg_intr_vect_r_vect___ser3___width 1
218#define reg_intr_vect_r_vect___ser3___bit 22
219#define reg_intr_vect_r_vect___p21___lsb 23
220#define reg_intr_vect_r_vect___p21___width 1
221#define reg_intr_vect_r_vect___p21___bit 23
222#define reg_intr_vect_r_vect___eth0___lsb 24
223#define reg_intr_vect_r_vect___eth0___width 1
224#define reg_intr_vect_r_vect___eth0___bit 24
225#define reg_intr_vect_r_vect___eth1___lsb 25
226#define reg_intr_vect_r_vect___eth1___width 1
227#define reg_intr_vect_r_vect___eth1___bit 25
228#define reg_intr_vect_r_vect___timer___lsb 26
229#define reg_intr_vect_r_vect___timer___width 1
230#define reg_intr_vect_r_vect___timer___bit 26
231#define reg_intr_vect_r_vect___bif_arb___lsb 27
232#define reg_intr_vect_r_vect___bif_arb___width 1
233#define reg_intr_vect_r_vect___bif_arb___bit 27
234#define reg_intr_vect_r_vect___bif_dma___lsb 28
235#define reg_intr_vect_r_vect___bif_dma___width 1
236#define reg_intr_vect_r_vect___bif_dma___bit 28
237#define reg_intr_vect_r_vect___ext___lsb 29
238#define reg_intr_vect_r_vect___ext___width 1
239#define reg_intr_vect_r_vect___ext___bit 29
240#define reg_intr_vect_r_vect_offset 4
241
242/* Register r_masked_vect, scope intr_vect, type r */
243#define reg_intr_vect_r_masked_vect___memarb___lsb 0
244#define reg_intr_vect_r_masked_vect___memarb___width 1
245#define reg_intr_vect_r_masked_vect___memarb___bit 0
246#define reg_intr_vect_r_masked_vect___gen_io___lsb 1
247#define reg_intr_vect_r_masked_vect___gen_io___width 1
248#define reg_intr_vect_r_masked_vect___gen_io___bit 1
249#define reg_intr_vect_r_masked_vect___iop0___lsb 2
250#define reg_intr_vect_r_masked_vect___iop0___width 1
251#define reg_intr_vect_r_masked_vect___iop0___bit 2
252#define reg_intr_vect_r_masked_vect___iop1___lsb 3
253#define reg_intr_vect_r_masked_vect___iop1___width 1
254#define reg_intr_vect_r_masked_vect___iop1___bit 3
255#define reg_intr_vect_r_masked_vect___iop2___lsb 4
256#define reg_intr_vect_r_masked_vect___iop2___width 1
257#define reg_intr_vect_r_masked_vect___iop2___bit 4
258#define reg_intr_vect_r_masked_vect___iop3___lsb 5
259#define reg_intr_vect_r_masked_vect___iop3___width 1
260#define reg_intr_vect_r_masked_vect___iop3___bit 5
261#define reg_intr_vect_r_masked_vect___dma0___lsb 6
262#define reg_intr_vect_r_masked_vect___dma0___width 1
263#define reg_intr_vect_r_masked_vect___dma0___bit 6
264#define reg_intr_vect_r_masked_vect___dma1___lsb 7
265#define reg_intr_vect_r_masked_vect___dma1___width 1
266#define reg_intr_vect_r_masked_vect___dma1___bit 7
267#define reg_intr_vect_r_masked_vect___dma2___lsb 8
268#define reg_intr_vect_r_masked_vect___dma2___width 1
269#define reg_intr_vect_r_masked_vect___dma2___bit 8
270#define reg_intr_vect_r_masked_vect___dma3___lsb 9
271#define reg_intr_vect_r_masked_vect___dma3___width 1
272#define reg_intr_vect_r_masked_vect___dma3___bit 9
273#define reg_intr_vect_r_masked_vect___dma4___lsb 10
274#define reg_intr_vect_r_masked_vect___dma4___width 1
275#define reg_intr_vect_r_masked_vect___dma4___bit 10
276#define reg_intr_vect_r_masked_vect___dma5___lsb 11
277#define reg_intr_vect_r_masked_vect___dma5___width 1
278#define reg_intr_vect_r_masked_vect___dma5___bit 11
279#define reg_intr_vect_r_masked_vect___dma6___lsb 12
280#define reg_intr_vect_r_masked_vect___dma6___width 1
281#define reg_intr_vect_r_masked_vect___dma6___bit 12
282#define reg_intr_vect_r_masked_vect___dma7___lsb 13
283#define reg_intr_vect_r_masked_vect___dma7___width 1
284#define reg_intr_vect_r_masked_vect___dma7___bit 13
285#define reg_intr_vect_r_masked_vect___dma8___lsb 14
286#define reg_intr_vect_r_masked_vect___dma8___width 1
287#define reg_intr_vect_r_masked_vect___dma8___bit 14
288#define reg_intr_vect_r_masked_vect___dma9___lsb 15
289#define reg_intr_vect_r_masked_vect___dma9___width 1
290#define reg_intr_vect_r_masked_vect___dma9___bit 15
291#define reg_intr_vect_r_masked_vect___ata___lsb 16
292#define reg_intr_vect_r_masked_vect___ata___width 1
293#define reg_intr_vect_r_masked_vect___ata___bit 16
294#define reg_intr_vect_r_masked_vect___sser0___lsb 17
295#define reg_intr_vect_r_masked_vect___sser0___width 1
296#define reg_intr_vect_r_masked_vect___sser0___bit 17
297#define reg_intr_vect_r_masked_vect___sser1___lsb 18
298#define reg_intr_vect_r_masked_vect___sser1___width 1
299#define reg_intr_vect_r_masked_vect___sser1___bit 18
300#define reg_intr_vect_r_masked_vect___ser0___lsb 19
301#define reg_intr_vect_r_masked_vect___ser0___width 1
302#define reg_intr_vect_r_masked_vect___ser0___bit 19
303#define reg_intr_vect_r_masked_vect___ser1___lsb 20
304#define reg_intr_vect_r_masked_vect___ser1___width 1
305#define reg_intr_vect_r_masked_vect___ser1___bit 20
306#define reg_intr_vect_r_masked_vect___ser2___lsb 21
307#define reg_intr_vect_r_masked_vect___ser2___width 1
308#define reg_intr_vect_r_masked_vect___ser2___bit 21
309#define reg_intr_vect_r_masked_vect___ser3___lsb 22
310#define reg_intr_vect_r_masked_vect___ser3___width 1
311#define reg_intr_vect_r_masked_vect___ser3___bit 22
312#define reg_intr_vect_r_masked_vect___p21___lsb 23
313#define reg_intr_vect_r_masked_vect___p21___width 1
314#define reg_intr_vect_r_masked_vect___p21___bit 23
315#define reg_intr_vect_r_masked_vect___eth0___lsb 24
316#define reg_intr_vect_r_masked_vect___eth0___width 1
317#define reg_intr_vect_r_masked_vect___eth0___bit 24
318#define reg_intr_vect_r_masked_vect___eth1___lsb 25
319#define reg_intr_vect_r_masked_vect___eth1___width 1
320#define reg_intr_vect_r_masked_vect___eth1___bit 25
321#define reg_intr_vect_r_masked_vect___timer___lsb 26
322#define reg_intr_vect_r_masked_vect___timer___width 1
323#define reg_intr_vect_r_masked_vect___timer___bit 26
324#define reg_intr_vect_r_masked_vect___bif_arb___lsb 27
325#define reg_intr_vect_r_masked_vect___bif_arb___width 1
326#define reg_intr_vect_r_masked_vect___bif_arb___bit 27
327#define reg_intr_vect_r_masked_vect___bif_dma___lsb 28
328#define reg_intr_vect_r_masked_vect___bif_dma___width 1
329#define reg_intr_vect_r_masked_vect___bif_dma___bit 28
330#define reg_intr_vect_r_masked_vect___ext___lsb 29
331#define reg_intr_vect_r_masked_vect___ext___width 1
332#define reg_intr_vect_r_masked_vect___ext___bit 29
333#define reg_intr_vect_r_masked_vect_offset 8
334
335/* Register r_nmi, scope intr_vect, type r */
336#define reg_intr_vect_r_nmi___ext___lsb 0
337#define reg_intr_vect_r_nmi___ext___width 1
338#define reg_intr_vect_r_nmi___ext___bit 0
339#define reg_intr_vect_r_nmi___watchdog___lsb 1
340#define reg_intr_vect_r_nmi___watchdog___width 1
341#define reg_intr_vect_r_nmi___watchdog___bit 1
342#define reg_intr_vect_r_nmi_offset 12
343
344/* Register r_guru, scope intr_vect, type r */
345#define reg_intr_vect_r_guru___jtag___lsb 0
346#define reg_intr_vect_r_guru___jtag___width 1
347#define reg_intr_vect_r_guru___jtag___bit 0
348#define reg_intr_vect_r_guru_offset 16
349
350
351/* Constants */
352#define regk_intr_vect_off 0x00000000
353#define regk_intr_vect_on 0x00000001
354#define regk_intr_vect_rw_mask_default 0x00000000
355#endif /* __intr_vect_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/irq_nmi_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/irq_nmi_defs_asm.h
new file mode 100644
index 000000000000..0c8084054840
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/irq_nmi_defs_asm.h
@@ -0,0 +1,69 @@
1#ifndef __irq_nmi_defs_asm_h
2#define __irq_nmi_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../mod/irq_nmi.r
7 * id: <not found>
8 * last modfied: Thu Jan 22 09:22:43 2004
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/irq_nmi_defs_asm.h ../../mod/irq_nmi.r
11 * id: $Id: irq_nmi_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cmd, scope irq_nmi, type rw */
57#define reg_irq_nmi_rw_cmd___delay___lsb 0
58#define reg_irq_nmi_rw_cmd___delay___width 16
59#define reg_irq_nmi_rw_cmd___op___lsb 16
60#define reg_irq_nmi_rw_cmd___op___width 2
61#define reg_irq_nmi_rw_cmd_offset 0
62
63
64/* Constants */
65#define regk_irq_nmi_ack_irq 0x00000002
66#define regk_irq_nmi_ack_nmi 0x00000003
67#define regk_irq_nmi_irq 0x00000000
68#define regk_irq_nmi_nmi 0x00000001
69#endif /* __irq_nmi_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/marb_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/marb_defs_asm.h
new file mode 100644
index 000000000000..45400eb8d389
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/marb_defs_asm.h
@@ -0,0 +1,579 @@
1#ifndef __marb_defs_asm_h
2#define __marb_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/memarb/rtl/guinness/marb_top.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:12:16 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/marb_defs_asm.h ../../inst/memarb/rtl/guinness/marb_top.r
11 * id: $Id: marb_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56#define STRIDE_marb_rw_int_slots 4
57/* Register rw_int_slots, scope marb, type rw */
58#define reg_marb_rw_int_slots___owner___lsb 0
59#define reg_marb_rw_int_slots___owner___width 4
60#define reg_marb_rw_int_slots_offset 0
61
62#define STRIDE_marb_rw_ext_slots 4
63/* Register rw_ext_slots, scope marb, type rw */
64#define reg_marb_rw_ext_slots___owner___lsb 0
65#define reg_marb_rw_ext_slots___owner___width 4
66#define reg_marb_rw_ext_slots_offset 256
67
68#define STRIDE_marb_rw_regs_slots 4
69/* Register rw_regs_slots, scope marb, type rw */
70#define reg_marb_rw_regs_slots___owner___lsb 0
71#define reg_marb_rw_regs_slots___owner___width 4
72#define reg_marb_rw_regs_slots_offset 512
73
74/* Register rw_intr_mask, scope marb, type rw */
75#define reg_marb_rw_intr_mask___bp0___lsb 0
76#define reg_marb_rw_intr_mask___bp0___width 1
77#define reg_marb_rw_intr_mask___bp0___bit 0
78#define reg_marb_rw_intr_mask___bp1___lsb 1
79#define reg_marb_rw_intr_mask___bp1___width 1
80#define reg_marb_rw_intr_mask___bp1___bit 1
81#define reg_marb_rw_intr_mask___bp2___lsb 2
82#define reg_marb_rw_intr_mask___bp2___width 1
83#define reg_marb_rw_intr_mask___bp2___bit 2
84#define reg_marb_rw_intr_mask___bp3___lsb 3
85#define reg_marb_rw_intr_mask___bp3___width 1
86#define reg_marb_rw_intr_mask___bp3___bit 3
87#define reg_marb_rw_intr_mask_offset 528
88
89/* Register rw_ack_intr, scope marb, type rw */
90#define reg_marb_rw_ack_intr___bp0___lsb 0
91#define reg_marb_rw_ack_intr___bp0___width 1
92#define reg_marb_rw_ack_intr___bp0___bit 0
93#define reg_marb_rw_ack_intr___bp1___lsb 1
94#define reg_marb_rw_ack_intr___bp1___width 1
95#define reg_marb_rw_ack_intr___bp1___bit 1
96#define reg_marb_rw_ack_intr___bp2___lsb 2
97#define reg_marb_rw_ack_intr___bp2___width 1
98#define reg_marb_rw_ack_intr___bp2___bit 2
99#define reg_marb_rw_ack_intr___bp3___lsb 3
100#define reg_marb_rw_ack_intr___bp3___width 1
101#define reg_marb_rw_ack_intr___bp3___bit 3
102#define reg_marb_rw_ack_intr_offset 532
103
104/* Register r_intr, scope marb, type r */
105#define reg_marb_r_intr___bp0___lsb 0
106#define reg_marb_r_intr___bp0___width 1
107#define reg_marb_r_intr___bp0___bit 0
108#define reg_marb_r_intr___bp1___lsb 1
109#define reg_marb_r_intr___bp1___width 1
110#define reg_marb_r_intr___bp1___bit 1
111#define reg_marb_r_intr___bp2___lsb 2
112#define reg_marb_r_intr___bp2___width 1
113#define reg_marb_r_intr___bp2___bit 2
114#define reg_marb_r_intr___bp3___lsb 3
115#define reg_marb_r_intr___bp3___width 1
116#define reg_marb_r_intr___bp3___bit 3
117#define reg_marb_r_intr_offset 536
118
119/* Register r_masked_intr, scope marb, type r */
120#define reg_marb_r_masked_intr___bp0___lsb 0
121#define reg_marb_r_masked_intr___bp0___width 1
122#define reg_marb_r_masked_intr___bp0___bit 0
123#define reg_marb_r_masked_intr___bp1___lsb 1
124#define reg_marb_r_masked_intr___bp1___width 1
125#define reg_marb_r_masked_intr___bp1___bit 1
126#define reg_marb_r_masked_intr___bp2___lsb 2
127#define reg_marb_r_masked_intr___bp2___width 1
128#define reg_marb_r_masked_intr___bp2___bit 2
129#define reg_marb_r_masked_intr___bp3___lsb 3
130#define reg_marb_r_masked_intr___bp3___width 1
131#define reg_marb_r_masked_intr___bp3___bit 3
132#define reg_marb_r_masked_intr_offset 540
133
134/* Register rw_stop_mask, scope marb, type rw */
135#define reg_marb_rw_stop_mask___dma0___lsb 0
136#define reg_marb_rw_stop_mask___dma0___width 1
137#define reg_marb_rw_stop_mask___dma0___bit 0
138#define reg_marb_rw_stop_mask___dma1___lsb 1
139#define reg_marb_rw_stop_mask___dma1___width 1
140#define reg_marb_rw_stop_mask___dma1___bit 1
141#define reg_marb_rw_stop_mask___dma2___lsb 2
142#define reg_marb_rw_stop_mask___dma2___width 1
143#define reg_marb_rw_stop_mask___dma2___bit 2
144#define reg_marb_rw_stop_mask___dma3___lsb 3
145#define reg_marb_rw_stop_mask___dma3___width 1
146#define reg_marb_rw_stop_mask___dma3___bit 3
147#define reg_marb_rw_stop_mask___dma4___lsb 4
148#define reg_marb_rw_stop_mask___dma4___width 1
149#define reg_marb_rw_stop_mask___dma4___bit 4
150#define reg_marb_rw_stop_mask___dma5___lsb 5
151#define reg_marb_rw_stop_mask___dma5___width 1
152#define reg_marb_rw_stop_mask___dma5___bit 5
153#define reg_marb_rw_stop_mask___dma6___lsb 6
154#define reg_marb_rw_stop_mask___dma6___width 1
155#define reg_marb_rw_stop_mask___dma6___bit 6
156#define reg_marb_rw_stop_mask___dma7___lsb 7
157#define reg_marb_rw_stop_mask___dma7___width 1
158#define reg_marb_rw_stop_mask___dma7___bit 7
159#define reg_marb_rw_stop_mask___dma8___lsb 8
160#define reg_marb_rw_stop_mask___dma8___width 1
161#define reg_marb_rw_stop_mask___dma8___bit 8
162#define reg_marb_rw_stop_mask___dma9___lsb 9
163#define reg_marb_rw_stop_mask___dma9___width 1
164#define reg_marb_rw_stop_mask___dma9___bit 9
165#define reg_marb_rw_stop_mask___cpui___lsb 10
166#define reg_marb_rw_stop_mask___cpui___width 1
167#define reg_marb_rw_stop_mask___cpui___bit 10
168#define reg_marb_rw_stop_mask___cpud___lsb 11
169#define reg_marb_rw_stop_mask___cpud___width 1
170#define reg_marb_rw_stop_mask___cpud___bit 11
171#define reg_marb_rw_stop_mask___iop___lsb 12
172#define reg_marb_rw_stop_mask___iop___width 1
173#define reg_marb_rw_stop_mask___iop___bit 12
174#define reg_marb_rw_stop_mask___slave___lsb 13
175#define reg_marb_rw_stop_mask___slave___width 1
176#define reg_marb_rw_stop_mask___slave___bit 13
177#define reg_marb_rw_stop_mask_offset 544
178
179/* Register r_stopped, scope marb, type r */
180#define reg_marb_r_stopped___dma0___lsb 0
181#define reg_marb_r_stopped___dma0___width 1
182#define reg_marb_r_stopped___dma0___bit 0
183#define reg_marb_r_stopped___dma1___lsb 1
184#define reg_marb_r_stopped___dma1___width 1
185#define reg_marb_r_stopped___dma1___bit 1
186#define reg_marb_r_stopped___dma2___lsb 2
187#define reg_marb_r_stopped___dma2___width 1
188#define reg_marb_r_stopped___dma2___bit 2
189#define reg_marb_r_stopped___dma3___lsb 3
190#define reg_marb_r_stopped___dma3___width 1
191#define reg_marb_r_stopped___dma3___bit 3
192#define reg_marb_r_stopped___dma4___lsb 4
193#define reg_marb_r_stopped___dma4___width 1
194#define reg_marb_r_stopped___dma4___bit 4
195#define reg_marb_r_stopped___dma5___lsb 5
196#define reg_marb_r_stopped___dma5___width 1
197#define reg_marb_r_stopped___dma5___bit 5
198#define reg_marb_r_stopped___dma6___lsb 6
199#define reg_marb_r_stopped___dma6___width 1
200#define reg_marb_r_stopped___dma6___bit 6
201#define reg_marb_r_stopped___dma7___lsb 7
202#define reg_marb_r_stopped___dma7___width 1
203#define reg_marb_r_stopped___dma7___bit 7
204#define reg_marb_r_stopped___dma8___lsb 8
205#define reg_marb_r_stopped___dma8___width 1
206#define reg_marb_r_stopped___dma8___bit 8
207#define reg_marb_r_stopped___dma9___lsb 9
208#define reg_marb_r_stopped___dma9___width 1
209#define reg_marb_r_stopped___dma9___bit 9
210#define reg_marb_r_stopped___cpui___lsb 10
211#define reg_marb_r_stopped___cpui___width 1
212#define reg_marb_r_stopped___cpui___bit 10
213#define reg_marb_r_stopped___cpud___lsb 11
214#define reg_marb_r_stopped___cpud___width 1
215#define reg_marb_r_stopped___cpud___bit 11
216#define reg_marb_r_stopped___iop___lsb 12
217#define reg_marb_r_stopped___iop___width 1
218#define reg_marb_r_stopped___iop___bit 12
219#define reg_marb_r_stopped___slave___lsb 13
220#define reg_marb_r_stopped___slave___width 1
221#define reg_marb_r_stopped___slave___bit 13
222#define reg_marb_r_stopped_offset 548
223
224/* Register rw_no_snoop, scope marb, type rw */
225#define reg_marb_rw_no_snoop___dma0___lsb 0
226#define reg_marb_rw_no_snoop___dma0___width 1
227#define reg_marb_rw_no_snoop___dma0___bit 0
228#define reg_marb_rw_no_snoop___dma1___lsb 1
229#define reg_marb_rw_no_snoop___dma1___width 1
230#define reg_marb_rw_no_snoop___dma1___bit 1
231#define reg_marb_rw_no_snoop___dma2___lsb 2
232#define reg_marb_rw_no_snoop___dma2___width 1
233#define reg_marb_rw_no_snoop___dma2___bit 2
234#define reg_marb_rw_no_snoop___dma3___lsb 3
235#define reg_marb_rw_no_snoop___dma3___width 1
236#define reg_marb_rw_no_snoop___dma3___bit 3
237#define reg_marb_rw_no_snoop___dma4___lsb 4
238#define reg_marb_rw_no_snoop___dma4___width 1
239#define reg_marb_rw_no_snoop___dma4___bit 4
240#define reg_marb_rw_no_snoop___dma5___lsb 5
241#define reg_marb_rw_no_snoop___dma5___width 1
242#define reg_marb_rw_no_snoop___dma5___bit 5
243#define reg_marb_rw_no_snoop___dma6___lsb 6
244#define reg_marb_rw_no_snoop___dma6___width 1
245#define reg_marb_rw_no_snoop___dma6___bit 6
246#define reg_marb_rw_no_snoop___dma7___lsb 7
247#define reg_marb_rw_no_snoop___dma7___width 1
248#define reg_marb_rw_no_snoop___dma7___bit 7
249#define reg_marb_rw_no_snoop___dma8___lsb 8
250#define reg_marb_rw_no_snoop___dma8___width 1
251#define reg_marb_rw_no_snoop___dma8___bit 8
252#define reg_marb_rw_no_snoop___dma9___lsb 9
253#define reg_marb_rw_no_snoop___dma9___width 1
254#define reg_marb_rw_no_snoop___dma9___bit 9
255#define reg_marb_rw_no_snoop___cpui___lsb 10
256#define reg_marb_rw_no_snoop___cpui___width 1
257#define reg_marb_rw_no_snoop___cpui___bit 10
258#define reg_marb_rw_no_snoop___cpud___lsb 11
259#define reg_marb_rw_no_snoop___cpud___width 1
260#define reg_marb_rw_no_snoop___cpud___bit 11
261#define reg_marb_rw_no_snoop___iop___lsb 12
262#define reg_marb_rw_no_snoop___iop___width 1
263#define reg_marb_rw_no_snoop___iop___bit 12
264#define reg_marb_rw_no_snoop___slave___lsb 13
265#define reg_marb_rw_no_snoop___slave___width 1
266#define reg_marb_rw_no_snoop___slave___bit 13
267#define reg_marb_rw_no_snoop_offset 832
268
269/* Register rw_no_snoop_rq, scope marb, type rw */
270#define reg_marb_rw_no_snoop_rq___cpui___lsb 10
271#define reg_marb_rw_no_snoop_rq___cpui___width 1
272#define reg_marb_rw_no_snoop_rq___cpui___bit 10
273#define reg_marb_rw_no_snoop_rq___cpud___lsb 11
274#define reg_marb_rw_no_snoop_rq___cpud___width 1
275#define reg_marb_rw_no_snoop_rq___cpud___bit 11
276#define reg_marb_rw_no_snoop_rq_offset 836
277
278
279/* Constants */
280#define regk_marb_cpud 0x0000000b
281#define regk_marb_cpui 0x0000000a
282#define regk_marb_dma0 0x00000000
283#define regk_marb_dma1 0x00000001
284#define regk_marb_dma2 0x00000002
285#define regk_marb_dma3 0x00000003
286#define regk_marb_dma4 0x00000004
287#define regk_marb_dma5 0x00000005
288#define regk_marb_dma6 0x00000006
289#define regk_marb_dma7 0x00000007
290#define regk_marb_dma8 0x00000008
291#define regk_marb_dma9 0x00000009
292#define regk_marb_iop 0x0000000c
293#define regk_marb_no 0x00000000
294#define regk_marb_r_stopped_default 0x00000000
295#define regk_marb_rw_ext_slots_default 0x00000000
296#define regk_marb_rw_ext_slots_size 0x00000040
297#define regk_marb_rw_int_slots_default 0x00000000
298#define regk_marb_rw_int_slots_size 0x00000040
299#define regk_marb_rw_intr_mask_default 0x00000000
300#define regk_marb_rw_no_snoop_default 0x00000000
301#define regk_marb_rw_no_snoop_rq_default 0x00000000
302#define regk_marb_rw_regs_slots_default 0x00000000
303#define regk_marb_rw_regs_slots_size 0x00000004
304#define regk_marb_rw_stop_mask_default 0x00000000
305#define regk_marb_slave 0x0000000d
306#define regk_marb_yes 0x00000001
307#endif /* __marb_defs_asm_h */
308#ifndef __marb_bp_defs_asm_h
309#define __marb_bp_defs_asm_h
310
311/*
312 * This file is autogenerated from
313 * file: ../../inst/memarb/rtl/guinness/marb_top.r
314 * id: <not found>
315 * last modfied: Mon Apr 11 16:12:16 2005
316 *
317 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/marb_defs_asm.h ../../inst/memarb/rtl/guinness/marb_top.r
318 * id: $Id: marb_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
319 * Any changes here will be lost.
320 *
321 * -*- buffer-read-only: t -*-
322 */
323
324#ifndef REG_FIELD
325#define REG_FIELD( scope, reg, field, value ) \
326 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
327#define REG_FIELD_X_( value, shift ) ((value) << shift)
328#endif
329
330#ifndef REG_STATE
331#define REG_STATE( scope, reg, field, symbolic_value ) \
332 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
333#define REG_STATE_X_( k, shift ) (k << shift)
334#endif
335
336#ifndef REG_MASK
337#define REG_MASK( scope, reg, field ) \
338 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
339#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
340#endif
341
342#ifndef REG_LSB
343#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
344#endif
345
346#ifndef REG_BIT
347#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
348#endif
349
350#ifndef REG_ADDR
351#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
352#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
353#endif
354
355#ifndef REG_ADDR_VECT
356#define REG_ADDR_VECT( scope, inst, reg, index ) \
357 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
358 STRIDE_##scope##_##reg )
359#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
360 ((inst) + offs + (index) * stride)
361#endif
362
363/* Register rw_first_addr, scope marb_bp, type rw */
364#define reg_marb_bp_rw_first_addr_offset 0
365
366/* Register rw_last_addr, scope marb_bp, type rw */
367#define reg_marb_bp_rw_last_addr_offset 4
368
369/* Register rw_op, scope marb_bp, type rw */
370#define reg_marb_bp_rw_op___rd___lsb 0
371#define reg_marb_bp_rw_op___rd___width 1
372#define reg_marb_bp_rw_op___rd___bit 0
373#define reg_marb_bp_rw_op___wr___lsb 1
374#define reg_marb_bp_rw_op___wr___width 1
375#define reg_marb_bp_rw_op___wr___bit 1
376#define reg_marb_bp_rw_op___rd_excl___lsb 2
377#define reg_marb_bp_rw_op___rd_excl___width 1
378#define reg_marb_bp_rw_op___rd_excl___bit 2
379#define reg_marb_bp_rw_op___pri_wr___lsb 3
380#define reg_marb_bp_rw_op___pri_wr___width 1
381#define reg_marb_bp_rw_op___pri_wr___bit 3
382#define reg_marb_bp_rw_op___us_rd___lsb 4
383#define reg_marb_bp_rw_op___us_rd___width 1
384#define reg_marb_bp_rw_op___us_rd___bit 4
385#define reg_marb_bp_rw_op___us_wr___lsb 5
386#define reg_marb_bp_rw_op___us_wr___width 1
387#define reg_marb_bp_rw_op___us_wr___bit 5
388#define reg_marb_bp_rw_op___us_rd_excl___lsb 6
389#define reg_marb_bp_rw_op___us_rd_excl___width 1
390#define reg_marb_bp_rw_op___us_rd_excl___bit 6
391#define reg_marb_bp_rw_op___us_pri_wr___lsb 7
392#define reg_marb_bp_rw_op___us_pri_wr___width 1
393#define reg_marb_bp_rw_op___us_pri_wr___bit 7
394#define reg_marb_bp_rw_op_offset 8
395
396/* Register rw_clients, scope marb_bp, type rw */
397#define reg_marb_bp_rw_clients___dma0___lsb 0
398#define reg_marb_bp_rw_clients___dma0___width 1
399#define reg_marb_bp_rw_clients___dma0___bit 0
400#define reg_marb_bp_rw_clients___dma1___lsb 1
401#define reg_marb_bp_rw_clients___dma1___width 1
402#define reg_marb_bp_rw_clients___dma1___bit 1
403#define reg_marb_bp_rw_clients___dma2___lsb 2
404#define reg_marb_bp_rw_clients___dma2___width 1
405#define reg_marb_bp_rw_clients___dma2___bit 2
406#define reg_marb_bp_rw_clients___dma3___lsb 3
407#define reg_marb_bp_rw_clients___dma3___width 1
408#define reg_marb_bp_rw_clients___dma3___bit 3
409#define reg_marb_bp_rw_clients___dma4___lsb 4
410#define reg_marb_bp_rw_clients___dma4___width 1
411#define reg_marb_bp_rw_clients___dma4___bit 4
412#define reg_marb_bp_rw_clients___dma5___lsb 5
413#define reg_marb_bp_rw_clients___dma5___width 1
414#define reg_marb_bp_rw_clients___dma5___bit 5
415#define reg_marb_bp_rw_clients___dma6___lsb 6
416#define reg_marb_bp_rw_clients___dma6___width 1
417#define reg_marb_bp_rw_clients___dma6___bit 6
418#define reg_marb_bp_rw_clients___dma7___lsb 7
419#define reg_marb_bp_rw_clients___dma7___width 1
420#define reg_marb_bp_rw_clients___dma7___bit 7
421#define reg_marb_bp_rw_clients___dma8___lsb 8
422#define reg_marb_bp_rw_clients___dma8___width 1
423#define reg_marb_bp_rw_clients___dma8___bit 8
424#define reg_marb_bp_rw_clients___dma9___lsb 9
425#define reg_marb_bp_rw_clients___dma9___width 1
426#define reg_marb_bp_rw_clients___dma9___bit 9
427#define reg_marb_bp_rw_clients___cpui___lsb 10
428#define reg_marb_bp_rw_clients___cpui___width 1
429#define reg_marb_bp_rw_clients___cpui___bit 10
430#define reg_marb_bp_rw_clients___cpud___lsb 11
431#define reg_marb_bp_rw_clients___cpud___width 1
432#define reg_marb_bp_rw_clients___cpud___bit 11
433#define reg_marb_bp_rw_clients___iop___lsb 12
434#define reg_marb_bp_rw_clients___iop___width 1
435#define reg_marb_bp_rw_clients___iop___bit 12
436#define reg_marb_bp_rw_clients___slave___lsb 13
437#define reg_marb_bp_rw_clients___slave___width 1
438#define reg_marb_bp_rw_clients___slave___bit 13
439#define reg_marb_bp_rw_clients_offset 12
440
441/* Register rw_options, scope marb_bp, type rw */
442#define reg_marb_bp_rw_options___wrap___lsb 0
443#define reg_marb_bp_rw_options___wrap___width 1
444#define reg_marb_bp_rw_options___wrap___bit 0
445#define reg_marb_bp_rw_options_offset 16
446
447/* Register r_brk_addr, scope marb_bp, type r */
448#define reg_marb_bp_r_brk_addr_offset 20
449
450/* Register r_brk_op, scope marb_bp, type r */
451#define reg_marb_bp_r_brk_op___rd___lsb 0
452#define reg_marb_bp_r_brk_op___rd___width 1
453#define reg_marb_bp_r_brk_op___rd___bit 0
454#define reg_marb_bp_r_brk_op___wr___lsb 1
455#define reg_marb_bp_r_brk_op___wr___width 1
456#define reg_marb_bp_r_brk_op___wr___bit 1
457#define reg_marb_bp_r_brk_op___rd_excl___lsb 2
458#define reg_marb_bp_r_brk_op___rd_excl___width 1
459#define reg_marb_bp_r_brk_op___rd_excl___bit 2
460#define reg_marb_bp_r_brk_op___pri_wr___lsb 3
461#define reg_marb_bp_r_brk_op___pri_wr___width 1
462#define reg_marb_bp_r_brk_op___pri_wr___bit 3
463#define reg_marb_bp_r_brk_op___us_rd___lsb 4
464#define reg_marb_bp_r_brk_op___us_rd___width 1
465#define reg_marb_bp_r_brk_op___us_rd___bit 4
466#define reg_marb_bp_r_brk_op___us_wr___lsb 5
467#define reg_marb_bp_r_brk_op___us_wr___width 1
468#define reg_marb_bp_r_brk_op___us_wr___bit 5
469#define reg_marb_bp_r_brk_op___us_rd_excl___lsb 6
470#define reg_marb_bp_r_brk_op___us_rd_excl___width 1
471#define reg_marb_bp_r_brk_op___us_rd_excl___bit 6
472#define reg_marb_bp_r_brk_op___us_pri_wr___lsb 7
473#define reg_marb_bp_r_brk_op___us_pri_wr___width 1
474#define reg_marb_bp_r_brk_op___us_pri_wr___bit 7
475#define reg_marb_bp_r_brk_op_offset 24
476
477/* Register r_brk_clients, scope marb_bp, type r */
478#define reg_marb_bp_r_brk_clients___dma0___lsb 0
479#define reg_marb_bp_r_brk_clients___dma0___width 1
480#define reg_marb_bp_r_brk_clients___dma0___bit 0
481#define reg_marb_bp_r_brk_clients___dma1___lsb 1
482#define reg_marb_bp_r_brk_clients___dma1___width 1
483#define reg_marb_bp_r_brk_clients___dma1___bit 1
484#define reg_marb_bp_r_brk_clients___dma2___lsb 2
485#define reg_marb_bp_r_brk_clients___dma2___width 1
486#define reg_marb_bp_r_brk_clients___dma2___bit 2
487#define reg_marb_bp_r_brk_clients___dma3___lsb 3
488#define reg_marb_bp_r_brk_clients___dma3___width 1
489#define reg_marb_bp_r_brk_clients___dma3___bit 3
490#define reg_marb_bp_r_brk_clients___dma4___lsb 4
491#define reg_marb_bp_r_brk_clients___dma4___width 1
492#define reg_marb_bp_r_brk_clients___dma4___bit 4
493#define reg_marb_bp_r_brk_clients___dma5___lsb 5
494#define reg_marb_bp_r_brk_clients___dma5___width 1
495#define reg_marb_bp_r_brk_clients___dma5___bit 5
496#define reg_marb_bp_r_brk_clients___dma6___lsb 6
497#define reg_marb_bp_r_brk_clients___dma6___width 1
498#define reg_marb_bp_r_brk_clients___dma6___bit 6
499#define reg_marb_bp_r_brk_clients___dma7___lsb 7
500#define reg_marb_bp_r_brk_clients___dma7___width 1
501#define reg_marb_bp_r_brk_clients___dma7___bit 7
502#define reg_marb_bp_r_brk_clients___dma8___lsb 8
503#define reg_marb_bp_r_brk_clients___dma8___width 1
504#define reg_marb_bp_r_brk_clients___dma8___bit 8
505#define reg_marb_bp_r_brk_clients___dma9___lsb 9
506#define reg_marb_bp_r_brk_clients___dma9___width 1
507#define reg_marb_bp_r_brk_clients___dma9___bit 9
508#define reg_marb_bp_r_brk_clients___cpui___lsb 10
509#define reg_marb_bp_r_brk_clients___cpui___width 1
510#define reg_marb_bp_r_brk_clients___cpui___bit 10
511#define reg_marb_bp_r_brk_clients___cpud___lsb 11
512#define reg_marb_bp_r_brk_clients___cpud___width 1
513#define reg_marb_bp_r_brk_clients___cpud___bit 11
514#define reg_marb_bp_r_brk_clients___iop___lsb 12
515#define reg_marb_bp_r_brk_clients___iop___width 1
516#define reg_marb_bp_r_brk_clients___iop___bit 12
517#define reg_marb_bp_r_brk_clients___slave___lsb 13
518#define reg_marb_bp_r_brk_clients___slave___width 1
519#define reg_marb_bp_r_brk_clients___slave___bit 13
520#define reg_marb_bp_r_brk_clients_offset 28
521
522/* Register r_brk_first_client, scope marb_bp, type r */
523#define reg_marb_bp_r_brk_first_client___dma0___lsb 0
524#define reg_marb_bp_r_brk_first_client___dma0___width 1
525#define reg_marb_bp_r_brk_first_client___dma0___bit 0
526#define reg_marb_bp_r_brk_first_client___dma1___lsb 1
527#define reg_marb_bp_r_brk_first_client___dma1___width 1
528#define reg_marb_bp_r_brk_first_client___dma1___bit 1
529#define reg_marb_bp_r_brk_first_client___dma2___lsb 2
530#define reg_marb_bp_r_brk_first_client___dma2___width 1
531#define reg_marb_bp_r_brk_first_client___dma2___bit 2
532#define reg_marb_bp_r_brk_first_client___dma3___lsb 3
533#define reg_marb_bp_r_brk_first_client___dma3___width 1
534#define reg_marb_bp_r_brk_first_client___dma3___bit 3
535#define reg_marb_bp_r_brk_first_client___dma4___lsb 4
536#define reg_marb_bp_r_brk_first_client___dma4___width 1
537#define reg_marb_bp_r_brk_first_client___dma4___bit 4
538#define reg_marb_bp_r_brk_first_client___dma5___lsb 5
539#define reg_marb_bp_r_brk_first_client___dma5___width 1
540#define reg_marb_bp_r_brk_first_client___dma5___bit 5
541#define reg_marb_bp_r_brk_first_client___dma6___lsb 6
542#define reg_marb_bp_r_brk_first_client___dma6___width 1
543#define reg_marb_bp_r_brk_first_client___dma6___bit 6
544#define reg_marb_bp_r_brk_first_client___dma7___lsb 7
545#define reg_marb_bp_r_brk_first_client___dma7___width 1
546#define reg_marb_bp_r_brk_first_client___dma7___bit 7
547#define reg_marb_bp_r_brk_first_client___dma8___lsb 8
548#define reg_marb_bp_r_brk_first_client___dma8___width 1
549#define reg_marb_bp_r_brk_first_client___dma8___bit 8
550#define reg_marb_bp_r_brk_first_client___dma9___lsb 9
551#define reg_marb_bp_r_brk_first_client___dma9___width 1
552#define reg_marb_bp_r_brk_first_client___dma9___bit 9
553#define reg_marb_bp_r_brk_first_client___cpui___lsb 10
554#define reg_marb_bp_r_brk_first_client___cpui___width 1
555#define reg_marb_bp_r_brk_first_client___cpui___bit 10
556#define reg_marb_bp_r_brk_first_client___cpud___lsb 11
557#define reg_marb_bp_r_brk_first_client___cpud___width 1
558#define reg_marb_bp_r_brk_first_client___cpud___bit 11
559#define reg_marb_bp_r_brk_first_client___iop___lsb 12
560#define reg_marb_bp_r_brk_first_client___iop___width 1
561#define reg_marb_bp_r_brk_first_client___iop___bit 12
562#define reg_marb_bp_r_brk_first_client___slave___lsb 13
563#define reg_marb_bp_r_brk_first_client___slave___width 1
564#define reg_marb_bp_r_brk_first_client___slave___bit 13
565#define reg_marb_bp_r_brk_first_client_offset 32
566
567/* Register r_brk_size, scope marb_bp, type r */
568#define reg_marb_bp_r_brk_size_offset 36
569
570/* Register rw_ack, scope marb_bp, type rw */
571#define reg_marb_bp_rw_ack_offset 40
572
573
574/* Constants */
575#define regk_marb_bp_no 0x00000000
576#define regk_marb_bp_rw_op_default 0x00000000
577#define regk_marb_bp_rw_options_default 0x00000000
578#define regk_marb_bp_yes 0x00000001
579#endif /* __marb_bp_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/mmu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/mmu_defs_asm.h
new file mode 100644
index 000000000000..505b7a16d878
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/mmu_defs_asm.h
@@ -0,0 +1,212 @@
1#ifndef __mmu_defs_asm_h
2#define __mmu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/mmu/doc/mmu_regs.r
7 * id: mmu_regs.r,v 1.12 2004/05/06 13:48:45 mikaeln Exp
8 * last modfied: Mon Apr 11 17:03:20 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/mmu_defs_asm.h ../../inst/mmu/doc/mmu_regs.r
11 * id: $Id: mmu_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_mm_cfg, scope mmu, type rw */
57#define reg_mmu_rw_mm_cfg___seg_0___lsb 0
58#define reg_mmu_rw_mm_cfg___seg_0___width 1
59#define reg_mmu_rw_mm_cfg___seg_0___bit 0
60#define reg_mmu_rw_mm_cfg___seg_1___lsb 1
61#define reg_mmu_rw_mm_cfg___seg_1___width 1
62#define reg_mmu_rw_mm_cfg___seg_1___bit 1
63#define reg_mmu_rw_mm_cfg___seg_2___lsb 2
64#define reg_mmu_rw_mm_cfg___seg_2___width 1
65#define reg_mmu_rw_mm_cfg___seg_2___bit 2
66#define reg_mmu_rw_mm_cfg___seg_3___lsb 3
67#define reg_mmu_rw_mm_cfg___seg_3___width 1
68#define reg_mmu_rw_mm_cfg___seg_3___bit 3
69#define reg_mmu_rw_mm_cfg___seg_4___lsb 4
70#define reg_mmu_rw_mm_cfg___seg_4___width 1
71#define reg_mmu_rw_mm_cfg___seg_4___bit 4
72#define reg_mmu_rw_mm_cfg___seg_5___lsb 5
73#define reg_mmu_rw_mm_cfg___seg_5___width 1
74#define reg_mmu_rw_mm_cfg___seg_5___bit 5
75#define reg_mmu_rw_mm_cfg___seg_6___lsb 6
76#define reg_mmu_rw_mm_cfg___seg_6___width 1
77#define reg_mmu_rw_mm_cfg___seg_6___bit 6
78#define reg_mmu_rw_mm_cfg___seg_7___lsb 7
79#define reg_mmu_rw_mm_cfg___seg_7___width 1
80#define reg_mmu_rw_mm_cfg___seg_7___bit 7
81#define reg_mmu_rw_mm_cfg___seg_8___lsb 8
82#define reg_mmu_rw_mm_cfg___seg_8___width 1
83#define reg_mmu_rw_mm_cfg___seg_8___bit 8
84#define reg_mmu_rw_mm_cfg___seg_9___lsb 9
85#define reg_mmu_rw_mm_cfg___seg_9___width 1
86#define reg_mmu_rw_mm_cfg___seg_9___bit 9
87#define reg_mmu_rw_mm_cfg___seg_a___lsb 10
88#define reg_mmu_rw_mm_cfg___seg_a___width 1
89#define reg_mmu_rw_mm_cfg___seg_a___bit 10
90#define reg_mmu_rw_mm_cfg___seg_b___lsb 11
91#define reg_mmu_rw_mm_cfg___seg_b___width 1
92#define reg_mmu_rw_mm_cfg___seg_b___bit 11
93#define reg_mmu_rw_mm_cfg___seg_c___lsb 12
94#define reg_mmu_rw_mm_cfg___seg_c___width 1
95#define reg_mmu_rw_mm_cfg___seg_c___bit 12
96#define reg_mmu_rw_mm_cfg___seg_d___lsb 13
97#define reg_mmu_rw_mm_cfg___seg_d___width 1
98#define reg_mmu_rw_mm_cfg___seg_d___bit 13
99#define reg_mmu_rw_mm_cfg___seg_e___lsb 14
100#define reg_mmu_rw_mm_cfg___seg_e___width 1
101#define reg_mmu_rw_mm_cfg___seg_e___bit 14
102#define reg_mmu_rw_mm_cfg___seg_f___lsb 15
103#define reg_mmu_rw_mm_cfg___seg_f___width 1
104#define reg_mmu_rw_mm_cfg___seg_f___bit 15
105#define reg_mmu_rw_mm_cfg___inv___lsb 16
106#define reg_mmu_rw_mm_cfg___inv___width 1
107#define reg_mmu_rw_mm_cfg___inv___bit 16
108#define reg_mmu_rw_mm_cfg___ex___lsb 17
109#define reg_mmu_rw_mm_cfg___ex___width 1
110#define reg_mmu_rw_mm_cfg___ex___bit 17
111#define reg_mmu_rw_mm_cfg___acc___lsb 18
112#define reg_mmu_rw_mm_cfg___acc___width 1
113#define reg_mmu_rw_mm_cfg___acc___bit 18
114#define reg_mmu_rw_mm_cfg___we___lsb 19
115#define reg_mmu_rw_mm_cfg___we___width 1
116#define reg_mmu_rw_mm_cfg___we___bit 19
117#define reg_mmu_rw_mm_cfg_offset 0
118
119/* Register rw_mm_kbase_lo, scope mmu, type rw */
120#define reg_mmu_rw_mm_kbase_lo___base_0___lsb 0
121#define reg_mmu_rw_mm_kbase_lo___base_0___width 4
122#define reg_mmu_rw_mm_kbase_lo___base_1___lsb 4
123#define reg_mmu_rw_mm_kbase_lo___base_1___width 4
124#define reg_mmu_rw_mm_kbase_lo___base_2___lsb 8
125#define reg_mmu_rw_mm_kbase_lo___base_2___width 4
126#define reg_mmu_rw_mm_kbase_lo___base_3___lsb 12
127#define reg_mmu_rw_mm_kbase_lo___base_3___width 4
128#define reg_mmu_rw_mm_kbase_lo___base_4___lsb 16
129#define reg_mmu_rw_mm_kbase_lo___base_4___width 4
130#define reg_mmu_rw_mm_kbase_lo___base_5___lsb 20
131#define reg_mmu_rw_mm_kbase_lo___base_5___width 4
132#define reg_mmu_rw_mm_kbase_lo___base_6___lsb 24
133#define reg_mmu_rw_mm_kbase_lo___base_6___width 4
134#define reg_mmu_rw_mm_kbase_lo___base_7___lsb 28
135#define reg_mmu_rw_mm_kbase_lo___base_7___width 4
136#define reg_mmu_rw_mm_kbase_lo_offset 4
137
138/* Register rw_mm_kbase_hi, scope mmu, type rw */
139#define reg_mmu_rw_mm_kbase_hi___base_8___lsb 0
140#define reg_mmu_rw_mm_kbase_hi___base_8___width 4
141#define reg_mmu_rw_mm_kbase_hi___base_9___lsb 4
142#define reg_mmu_rw_mm_kbase_hi___base_9___width 4
143#define reg_mmu_rw_mm_kbase_hi___base_a___lsb 8
144#define reg_mmu_rw_mm_kbase_hi___base_a___width 4
145#define reg_mmu_rw_mm_kbase_hi___base_b___lsb 12
146#define reg_mmu_rw_mm_kbase_hi___base_b___width 4
147#define reg_mmu_rw_mm_kbase_hi___base_c___lsb 16
148#define reg_mmu_rw_mm_kbase_hi___base_c___width 4
149#define reg_mmu_rw_mm_kbase_hi___base_d___lsb 20
150#define reg_mmu_rw_mm_kbase_hi___base_d___width 4
151#define reg_mmu_rw_mm_kbase_hi___base_e___lsb 24
152#define reg_mmu_rw_mm_kbase_hi___base_e___width 4
153#define reg_mmu_rw_mm_kbase_hi___base_f___lsb 28
154#define reg_mmu_rw_mm_kbase_hi___base_f___width 4
155#define reg_mmu_rw_mm_kbase_hi_offset 8
156
157/* Register r_mm_cause, scope mmu, type r */
158#define reg_mmu_r_mm_cause___pid___lsb 0
159#define reg_mmu_r_mm_cause___pid___width 8
160#define reg_mmu_r_mm_cause___op___lsb 8
161#define reg_mmu_r_mm_cause___op___width 2
162#define reg_mmu_r_mm_cause___vpn___lsb 13
163#define reg_mmu_r_mm_cause___vpn___width 19
164#define reg_mmu_r_mm_cause_offset 12
165
166/* Register rw_mm_tlb_sel, scope mmu, type rw */
167#define reg_mmu_rw_mm_tlb_sel___idx___lsb 0
168#define reg_mmu_rw_mm_tlb_sel___idx___width 4
169#define reg_mmu_rw_mm_tlb_sel___set___lsb 4
170#define reg_mmu_rw_mm_tlb_sel___set___width 2
171#define reg_mmu_rw_mm_tlb_sel_offset 16
172
173/* Register rw_mm_tlb_lo, scope mmu, type rw */
174#define reg_mmu_rw_mm_tlb_lo___x___lsb 0
175#define reg_mmu_rw_mm_tlb_lo___x___width 1
176#define reg_mmu_rw_mm_tlb_lo___x___bit 0
177#define reg_mmu_rw_mm_tlb_lo___w___lsb 1
178#define reg_mmu_rw_mm_tlb_lo___w___width 1
179#define reg_mmu_rw_mm_tlb_lo___w___bit 1
180#define reg_mmu_rw_mm_tlb_lo___k___lsb 2
181#define reg_mmu_rw_mm_tlb_lo___k___width 1
182#define reg_mmu_rw_mm_tlb_lo___k___bit 2
183#define reg_mmu_rw_mm_tlb_lo___v___lsb 3
184#define reg_mmu_rw_mm_tlb_lo___v___width 1
185#define reg_mmu_rw_mm_tlb_lo___v___bit 3
186#define reg_mmu_rw_mm_tlb_lo___g___lsb 4
187#define reg_mmu_rw_mm_tlb_lo___g___width 1
188#define reg_mmu_rw_mm_tlb_lo___g___bit 4
189#define reg_mmu_rw_mm_tlb_lo___pfn___lsb 13
190#define reg_mmu_rw_mm_tlb_lo___pfn___width 19
191#define reg_mmu_rw_mm_tlb_lo_offset 20
192
193/* Register rw_mm_tlb_hi, scope mmu, type rw */
194#define reg_mmu_rw_mm_tlb_hi___pid___lsb 0
195#define reg_mmu_rw_mm_tlb_hi___pid___width 8
196#define reg_mmu_rw_mm_tlb_hi___vpn___lsb 13
197#define reg_mmu_rw_mm_tlb_hi___vpn___width 19
198#define reg_mmu_rw_mm_tlb_hi_offset 24
199
200
201/* Constants */
202#define regk_mmu_execute 0x00000000
203#define regk_mmu_flush 0x00000003
204#define regk_mmu_linear 0x00000001
205#define regk_mmu_no 0x00000000
206#define regk_mmu_off 0x00000000
207#define regk_mmu_on 0x00000001
208#define regk_mmu_page 0x00000000
209#define regk_mmu_read 0x00000001
210#define regk_mmu_write 0x00000002
211#define regk_mmu_yes 0x00000001
212#endif /* __mmu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/mmu_supp_reg.h b/include/asm-cris/arch-v32/hwregs/asm/mmu_supp_reg.h
new file mode 100644
index 000000000000..339500bf3bc0
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/mmu_supp_reg.h
@@ -0,0 +1,7 @@
1#define RW_MM_CFG 0
2#define RW_MM_KBASE_LO 1
3#define RW_MM_KBASE_HI 2
4#define R_MM_CAUSE 3
5#define RW_MM_TLB_SEL 4
6#define RW_MM_TLB_LO 5
7#define RW_MM_TLB_HI 6
diff --git a/include/asm-cris/arch-v32/hwregs/asm/pinmux_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/pinmux_defs_asm.h
new file mode 100644
index 000000000000..13c725e4c774
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/pinmux_defs_asm.h
@@ -0,0 +1,632 @@
1#ifndef __pinmux_defs_asm_h
2#define __pinmux_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/pinmux/rtl/guinness/pinmux_regs.r
7 * id: pinmux_regs.r,v 1.40 2005/02/09 16:22:59 perz Exp
8 * last modfied: Mon Apr 11 16:09:11 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/pinmux_defs_asm.h ../../inst/pinmux/rtl/guinness/pinmux_regs.r
11 * id: $Id: pinmux_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_pa, scope pinmux, type rw */
57#define reg_pinmux_rw_pa___pa0___lsb 0
58#define reg_pinmux_rw_pa___pa0___width 1
59#define reg_pinmux_rw_pa___pa0___bit 0
60#define reg_pinmux_rw_pa___pa1___lsb 1
61#define reg_pinmux_rw_pa___pa1___width 1
62#define reg_pinmux_rw_pa___pa1___bit 1
63#define reg_pinmux_rw_pa___pa2___lsb 2
64#define reg_pinmux_rw_pa___pa2___width 1
65#define reg_pinmux_rw_pa___pa2___bit 2
66#define reg_pinmux_rw_pa___pa3___lsb 3
67#define reg_pinmux_rw_pa___pa3___width 1
68#define reg_pinmux_rw_pa___pa3___bit 3
69#define reg_pinmux_rw_pa___pa4___lsb 4
70#define reg_pinmux_rw_pa___pa4___width 1
71#define reg_pinmux_rw_pa___pa4___bit 4
72#define reg_pinmux_rw_pa___pa5___lsb 5
73#define reg_pinmux_rw_pa___pa5___width 1
74#define reg_pinmux_rw_pa___pa5___bit 5
75#define reg_pinmux_rw_pa___pa6___lsb 6
76#define reg_pinmux_rw_pa___pa6___width 1
77#define reg_pinmux_rw_pa___pa6___bit 6
78#define reg_pinmux_rw_pa___pa7___lsb 7
79#define reg_pinmux_rw_pa___pa7___width 1
80#define reg_pinmux_rw_pa___pa7___bit 7
81#define reg_pinmux_rw_pa___csp2_n___lsb 8
82#define reg_pinmux_rw_pa___csp2_n___width 1
83#define reg_pinmux_rw_pa___csp2_n___bit 8
84#define reg_pinmux_rw_pa___csp3_n___lsb 9
85#define reg_pinmux_rw_pa___csp3_n___width 1
86#define reg_pinmux_rw_pa___csp3_n___bit 9
87#define reg_pinmux_rw_pa___csp5_n___lsb 10
88#define reg_pinmux_rw_pa___csp5_n___width 1
89#define reg_pinmux_rw_pa___csp5_n___bit 10
90#define reg_pinmux_rw_pa___csp6_n___lsb 11
91#define reg_pinmux_rw_pa___csp6_n___width 1
92#define reg_pinmux_rw_pa___csp6_n___bit 11
93#define reg_pinmux_rw_pa___hsh4___lsb 12
94#define reg_pinmux_rw_pa___hsh4___width 1
95#define reg_pinmux_rw_pa___hsh4___bit 12
96#define reg_pinmux_rw_pa___hsh5___lsb 13
97#define reg_pinmux_rw_pa___hsh5___width 1
98#define reg_pinmux_rw_pa___hsh5___bit 13
99#define reg_pinmux_rw_pa___hsh6___lsb 14
100#define reg_pinmux_rw_pa___hsh6___width 1
101#define reg_pinmux_rw_pa___hsh6___bit 14
102#define reg_pinmux_rw_pa___hsh7___lsb 15
103#define reg_pinmux_rw_pa___hsh7___width 1
104#define reg_pinmux_rw_pa___hsh7___bit 15
105#define reg_pinmux_rw_pa_offset 0
106
107/* Register rw_hwprot, scope pinmux, type rw */
108#define reg_pinmux_rw_hwprot___ser1___lsb 0
109#define reg_pinmux_rw_hwprot___ser1___width 1
110#define reg_pinmux_rw_hwprot___ser1___bit 0
111#define reg_pinmux_rw_hwprot___ser2___lsb 1
112#define reg_pinmux_rw_hwprot___ser2___width 1
113#define reg_pinmux_rw_hwprot___ser2___bit 1
114#define reg_pinmux_rw_hwprot___ser3___lsb 2
115#define reg_pinmux_rw_hwprot___ser3___width 1
116#define reg_pinmux_rw_hwprot___ser3___bit 2
117#define reg_pinmux_rw_hwprot___sser0___lsb 3
118#define reg_pinmux_rw_hwprot___sser0___width 1
119#define reg_pinmux_rw_hwprot___sser0___bit 3
120#define reg_pinmux_rw_hwprot___sser1___lsb 4
121#define reg_pinmux_rw_hwprot___sser1___width 1
122#define reg_pinmux_rw_hwprot___sser1___bit 4
123#define reg_pinmux_rw_hwprot___ata0___lsb 5
124#define reg_pinmux_rw_hwprot___ata0___width 1
125#define reg_pinmux_rw_hwprot___ata0___bit 5
126#define reg_pinmux_rw_hwprot___ata1___lsb 6
127#define reg_pinmux_rw_hwprot___ata1___width 1
128#define reg_pinmux_rw_hwprot___ata1___bit 6
129#define reg_pinmux_rw_hwprot___ata2___lsb 7
130#define reg_pinmux_rw_hwprot___ata2___width 1
131#define reg_pinmux_rw_hwprot___ata2___bit 7
132#define reg_pinmux_rw_hwprot___ata3___lsb 8
133#define reg_pinmux_rw_hwprot___ata3___width 1
134#define reg_pinmux_rw_hwprot___ata3___bit 8
135#define reg_pinmux_rw_hwprot___ata___lsb 9
136#define reg_pinmux_rw_hwprot___ata___width 1
137#define reg_pinmux_rw_hwprot___ata___bit 9
138#define reg_pinmux_rw_hwprot___eth1___lsb 10
139#define reg_pinmux_rw_hwprot___eth1___width 1
140#define reg_pinmux_rw_hwprot___eth1___bit 10
141#define reg_pinmux_rw_hwprot___eth1_mgm___lsb 11
142#define reg_pinmux_rw_hwprot___eth1_mgm___width 1
143#define reg_pinmux_rw_hwprot___eth1_mgm___bit 11
144#define reg_pinmux_rw_hwprot___timer___lsb 12
145#define reg_pinmux_rw_hwprot___timer___width 1
146#define reg_pinmux_rw_hwprot___timer___bit 12
147#define reg_pinmux_rw_hwprot___p21___lsb 13
148#define reg_pinmux_rw_hwprot___p21___width 1
149#define reg_pinmux_rw_hwprot___p21___bit 13
150#define reg_pinmux_rw_hwprot_offset 4
151
152/* Register rw_pb_gio, scope pinmux, type rw */
153#define reg_pinmux_rw_pb_gio___pb0___lsb 0
154#define reg_pinmux_rw_pb_gio___pb0___width 1
155#define reg_pinmux_rw_pb_gio___pb0___bit 0
156#define reg_pinmux_rw_pb_gio___pb1___lsb 1
157#define reg_pinmux_rw_pb_gio___pb1___width 1
158#define reg_pinmux_rw_pb_gio___pb1___bit 1
159#define reg_pinmux_rw_pb_gio___pb2___lsb 2
160#define reg_pinmux_rw_pb_gio___pb2___width 1
161#define reg_pinmux_rw_pb_gio___pb2___bit 2
162#define reg_pinmux_rw_pb_gio___pb3___lsb 3
163#define reg_pinmux_rw_pb_gio___pb3___width 1
164#define reg_pinmux_rw_pb_gio___pb3___bit 3
165#define reg_pinmux_rw_pb_gio___pb4___lsb 4
166#define reg_pinmux_rw_pb_gio___pb4___width 1
167#define reg_pinmux_rw_pb_gio___pb4___bit 4
168#define reg_pinmux_rw_pb_gio___pb5___lsb 5
169#define reg_pinmux_rw_pb_gio___pb5___width 1
170#define reg_pinmux_rw_pb_gio___pb5___bit 5
171#define reg_pinmux_rw_pb_gio___pb6___lsb 6
172#define reg_pinmux_rw_pb_gio___pb6___width 1
173#define reg_pinmux_rw_pb_gio___pb6___bit 6
174#define reg_pinmux_rw_pb_gio___pb7___lsb 7
175#define reg_pinmux_rw_pb_gio___pb7___width 1
176#define reg_pinmux_rw_pb_gio___pb7___bit 7
177#define reg_pinmux_rw_pb_gio___pb8___lsb 8
178#define reg_pinmux_rw_pb_gio___pb8___width 1
179#define reg_pinmux_rw_pb_gio___pb8___bit 8
180#define reg_pinmux_rw_pb_gio___pb9___lsb 9
181#define reg_pinmux_rw_pb_gio___pb9___width 1
182#define reg_pinmux_rw_pb_gio___pb9___bit 9
183#define reg_pinmux_rw_pb_gio___pb10___lsb 10
184#define reg_pinmux_rw_pb_gio___pb10___width 1
185#define reg_pinmux_rw_pb_gio___pb10___bit 10
186#define reg_pinmux_rw_pb_gio___pb11___lsb 11
187#define reg_pinmux_rw_pb_gio___pb11___width 1
188#define reg_pinmux_rw_pb_gio___pb11___bit 11
189#define reg_pinmux_rw_pb_gio___pb12___lsb 12
190#define reg_pinmux_rw_pb_gio___pb12___width 1
191#define reg_pinmux_rw_pb_gio___pb12___bit 12
192#define reg_pinmux_rw_pb_gio___pb13___lsb 13
193#define reg_pinmux_rw_pb_gio___pb13___width 1
194#define reg_pinmux_rw_pb_gio___pb13___bit 13
195#define reg_pinmux_rw_pb_gio___pb14___lsb 14
196#define reg_pinmux_rw_pb_gio___pb14___width 1
197#define reg_pinmux_rw_pb_gio___pb14___bit 14
198#define reg_pinmux_rw_pb_gio___pb15___lsb 15
199#define reg_pinmux_rw_pb_gio___pb15___width 1
200#define reg_pinmux_rw_pb_gio___pb15___bit 15
201#define reg_pinmux_rw_pb_gio___pb16___lsb 16
202#define reg_pinmux_rw_pb_gio___pb16___width 1
203#define reg_pinmux_rw_pb_gio___pb16___bit 16
204#define reg_pinmux_rw_pb_gio___pb17___lsb 17
205#define reg_pinmux_rw_pb_gio___pb17___width 1
206#define reg_pinmux_rw_pb_gio___pb17___bit 17
207#define reg_pinmux_rw_pb_gio_offset 8
208
209/* Register rw_pb_iop, scope pinmux, type rw */
210#define reg_pinmux_rw_pb_iop___pb0___lsb 0
211#define reg_pinmux_rw_pb_iop___pb0___width 1
212#define reg_pinmux_rw_pb_iop___pb0___bit 0
213#define reg_pinmux_rw_pb_iop___pb1___lsb 1
214#define reg_pinmux_rw_pb_iop___pb1___width 1
215#define reg_pinmux_rw_pb_iop___pb1___bit 1
216#define reg_pinmux_rw_pb_iop___pb2___lsb 2
217#define reg_pinmux_rw_pb_iop___pb2___width 1
218#define reg_pinmux_rw_pb_iop___pb2___bit 2
219#define reg_pinmux_rw_pb_iop___pb3___lsb 3
220#define reg_pinmux_rw_pb_iop___pb3___width 1
221#define reg_pinmux_rw_pb_iop___pb3___bit 3
222#define reg_pinmux_rw_pb_iop___pb4___lsb 4
223#define reg_pinmux_rw_pb_iop___pb4___width 1
224#define reg_pinmux_rw_pb_iop___pb4___bit 4
225#define reg_pinmux_rw_pb_iop___pb5___lsb 5
226#define reg_pinmux_rw_pb_iop___pb5___width 1
227#define reg_pinmux_rw_pb_iop___pb5___bit 5
228#define reg_pinmux_rw_pb_iop___pb6___lsb 6
229#define reg_pinmux_rw_pb_iop___pb6___width 1
230#define reg_pinmux_rw_pb_iop___pb6___bit 6
231#define reg_pinmux_rw_pb_iop___pb7___lsb 7
232#define reg_pinmux_rw_pb_iop___pb7___width 1
233#define reg_pinmux_rw_pb_iop___pb7___bit 7
234#define reg_pinmux_rw_pb_iop___pb8___lsb 8
235#define reg_pinmux_rw_pb_iop___pb8___width 1
236#define reg_pinmux_rw_pb_iop___pb8___bit 8
237#define reg_pinmux_rw_pb_iop___pb9___lsb 9
238#define reg_pinmux_rw_pb_iop___pb9___width 1
239#define reg_pinmux_rw_pb_iop___pb9___bit 9
240#define reg_pinmux_rw_pb_iop___pb10___lsb 10
241#define reg_pinmux_rw_pb_iop___pb10___width 1
242#define reg_pinmux_rw_pb_iop___pb10___bit 10
243#define reg_pinmux_rw_pb_iop___pb11___lsb 11
244#define reg_pinmux_rw_pb_iop___pb11___width 1
245#define reg_pinmux_rw_pb_iop___pb11___bit 11
246#define reg_pinmux_rw_pb_iop___pb12___lsb 12
247#define reg_pinmux_rw_pb_iop___pb12___width 1
248#define reg_pinmux_rw_pb_iop___pb12___bit 12
249#define reg_pinmux_rw_pb_iop___pb13___lsb 13
250#define reg_pinmux_rw_pb_iop___pb13___width 1
251#define reg_pinmux_rw_pb_iop___pb13___bit 13
252#define reg_pinmux_rw_pb_iop___pb14___lsb 14
253#define reg_pinmux_rw_pb_iop___pb14___width 1
254#define reg_pinmux_rw_pb_iop___pb14___bit 14
255#define reg_pinmux_rw_pb_iop___pb15___lsb 15
256#define reg_pinmux_rw_pb_iop___pb15___width 1
257#define reg_pinmux_rw_pb_iop___pb15___bit 15
258#define reg_pinmux_rw_pb_iop___pb16___lsb 16
259#define reg_pinmux_rw_pb_iop___pb16___width 1
260#define reg_pinmux_rw_pb_iop___pb16___bit 16
261#define reg_pinmux_rw_pb_iop___pb17___lsb 17
262#define reg_pinmux_rw_pb_iop___pb17___width 1
263#define reg_pinmux_rw_pb_iop___pb17___bit 17
264#define reg_pinmux_rw_pb_iop_offset 12
265
266/* Register rw_pc_gio, scope pinmux, type rw */
267#define reg_pinmux_rw_pc_gio___pc0___lsb 0
268#define reg_pinmux_rw_pc_gio___pc0___width 1
269#define reg_pinmux_rw_pc_gio___pc0___bit 0
270#define reg_pinmux_rw_pc_gio___pc1___lsb 1
271#define reg_pinmux_rw_pc_gio___pc1___width 1
272#define reg_pinmux_rw_pc_gio___pc1___bit 1
273#define reg_pinmux_rw_pc_gio___pc2___lsb 2
274#define reg_pinmux_rw_pc_gio___pc2___width 1
275#define reg_pinmux_rw_pc_gio___pc2___bit 2
276#define reg_pinmux_rw_pc_gio___pc3___lsb 3
277#define reg_pinmux_rw_pc_gio___pc3___width 1
278#define reg_pinmux_rw_pc_gio___pc3___bit 3
279#define reg_pinmux_rw_pc_gio___pc4___lsb 4
280#define reg_pinmux_rw_pc_gio___pc4___width 1
281#define reg_pinmux_rw_pc_gio___pc4___bit 4
282#define reg_pinmux_rw_pc_gio___pc5___lsb 5
283#define reg_pinmux_rw_pc_gio___pc5___width 1
284#define reg_pinmux_rw_pc_gio___pc5___bit 5
285#define reg_pinmux_rw_pc_gio___pc6___lsb 6
286#define reg_pinmux_rw_pc_gio___pc6___width 1
287#define reg_pinmux_rw_pc_gio___pc6___bit 6
288#define reg_pinmux_rw_pc_gio___pc7___lsb 7
289#define reg_pinmux_rw_pc_gio___pc7___width 1
290#define reg_pinmux_rw_pc_gio___pc7___bit 7
291#define reg_pinmux_rw_pc_gio___pc8___lsb 8
292#define reg_pinmux_rw_pc_gio___pc8___width 1
293#define reg_pinmux_rw_pc_gio___pc8___bit 8
294#define reg_pinmux_rw_pc_gio___pc9___lsb 9
295#define reg_pinmux_rw_pc_gio___pc9___width 1
296#define reg_pinmux_rw_pc_gio___pc9___bit 9
297#define reg_pinmux_rw_pc_gio___pc10___lsb 10
298#define reg_pinmux_rw_pc_gio___pc10___width 1
299#define reg_pinmux_rw_pc_gio___pc10___bit 10
300#define reg_pinmux_rw_pc_gio___pc11___lsb 11
301#define reg_pinmux_rw_pc_gio___pc11___width 1
302#define reg_pinmux_rw_pc_gio___pc11___bit 11
303#define reg_pinmux_rw_pc_gio___pc12___lsb 12
304#define reg_pinmux_rw_pc_gio___pc12___width 1
305#define reg_pinmux_rw_pc_gio___pc12___bit 12
306#define reg_pinmux_rw_pc_gio___pc13___lsb 13
307#define reg_pinmux_rw_pc_gio___pc13___width 1
308#define reg_pinmux_rw_pc_gio___pc13___bit 13
309#define reg_pinmux_rw_pc_gio___pc14___lsb 14
310#define reg_pinmux_rw_pc_gio___pc14___width 1
311#define reg_pinmux_rw_pc_gio___pc14___bit 14
312#define reg_pinmux_rw_pc_gio___pc15___lsb 15
313#define reg_pinmux_rw_pc_gio___pc15___width 1
314#define reg_pinmux_rw_pc_gio___pc15___bit 15
315#define reg_pinmux_rw_pc_gio___pc16___lsb 16
316#define reg_pinmux_rw_pc_gio___pc16___width 1
317#define reg_pinmux_rw_pc_gio___pc16___bit 16
318#define reg_pinmux_rw_pc_gio___pc17___lsb 17
319#define reg_pinmux_rw_pc_gio___pc17___width 1
320#define reg_pinmux_rw_pc_gio___pc17___bit 17
321#define reg_pinmux_rw_pc_gio_offset 16
322
323/* Register rw_pc_iop, scope pinmux, type rw */
324#define reg_pinmux_rw_pc_iop___pc0___lsb 0
325#define reg_pinmux_rw_pc_iop___pc0___width 1
326#define reg_pinmux_rw_pc_iop___pc0___bit 0
327#define reg_pinmux_rw_pc_iop___pc1___lsb 1
328#define reg_pinmux_rw_pc_iop___pc1___width 1
329#define reg_pinmux_rw_pc_iop___pc1___bit 1
330#define reg_pinmux_rw_pc_iop___pc2___lsb 2
331#define reg_pinmux_rw_pc_iop___pc2___width 1
332#define reg_pinmux_rw_pc_iop___pc2___bit 2
333#define reg_pinmux_rw_pc_iop___pc3___lsb 3
334#define reg_pinmux_rw_pc_iop___pc3___width 1
335#define reg_pinmux_rw_pc_iop___pc3___bit 3
336#define reg_pinmux_rw_pc_iop___pc4___lsb 4
337#define reg_pinmux_rw_pc_iop___pc4___width 1
338#define reg_pinmux_rw_pc_iop___pc4___bit 4
339#define reg_pinmux_rw_pc_iop___pc5___lsb 5
340#define reg_pinmux_rw_pc_iop___pc5___width 1
341#define reg_pinmux_rw_pc_iop___pc5___bit 5
342#define reg_pinmux_rw_pc_iop___pc6___lsb 6
343#define reg_pinmux_rw_pc_iop___pc6___width 1
344#define reg_pinmux_rw_pc_iop___pc6___bit 6
345#define reg_pinmux_rw_pc_iop___pc7___lsb 7
346#define reg_pinmux_rw_pc_iop___pc7___width 1
347#define reg_pinmux_rw_pc_iop___pc7___bit 7
348#define reg_pinmux_rw_pc_iop___pc8___lsb 8
349#define reg_pinmux_rw_pc_iop___pc8___width 1
350#define reg_pinmux_rw_pc_iop___pc8___bit 8
351#define reg_pinmux_rw_pc_iop___pc9___lsb 9
352#define reg_pinmux_rw_pc_iop___pc9___width 1
353#define reg_pinmux_rw_pc_iop___pc9___bit 9
354#define reg_pinmux_rw_pc_iop___pc10___lsb 10
355#define reg_pinmux_rw_pc_iop___pc10___width 1
356#define reg_pinmux_rw_pc_iop___pc10___bit 10
357#define reg_pinmux_rw_pc_iop___pc11___lsb 11
358#define reg_pinmux_rw_pc_iop___pc11___width 1
359#define reg_pinmux_rw_pc_iop___pc11___bit 11
360#define reg_pinmux_rw_pc_iop___pc12___lsb 12
361#define reg_pinmux_rw_pc_iop___pc12___width 1
362#define reg_pinmux_rw_pc_iop___pc12___bit 12
363#define reg_pinmux_rw_pc_iop___pc13___lsb 13
364#define reg_pinmux_rw_pc_iop___pc13___width 1
365#define reg_pinmux_rw_pc_iop___pc13___bit 13
366#define reg_pinmux_rw_pc_iop___pc14___lsb 14
367#define reg_pinmux_rw_pc_iop___pc14___width 1
368#define reg_pinmux_rw_pc_iop___pc14___bit 14
369#define reg_pinmux_rw_pc_iop___pc15___lsb 15
370#define reg_pinmux_rw_pc_iop___pc15___width 1
371#define reg_pinmux_rw_pc_iop___pc15___bit 15
372#define reg_pinmux_rw_pc_iop___pc16___lsb 16
373#define reg_pinmux_rw_pc_iop___pc16___width 1
374#define reg_pinmux_rw_pc_iop___pc16___bit 16
375#define reg_pinmux_rw_pc_iop___pc17___lsb 17
376#define reg_pinmux_rw_pc_iop___pc17___width 1
377#define reg_pinmux_rw_pc_iop___pc17___bit 17
378#define reg_pinmux_rw_pc_iop_offset 20
379
380/* Register rw_pd_gio, scope pinmux, type rw */
381#define reg_pinmux_rw_pd_gio___pd0___lsb 0
382#define reg_pinmux_rw_pd_gio___pd0___width 1
383#define reg_pinmux_rw_pd_gio___pd0___bit 0
384#define reg_pinmux_rw_pd_gio___pd1___lsb 1
385#define reg_pinmux_rw_pd_gio___pd1___width 1
386#define reg_pinmux_rw_pd_gio___pd1___bit 1
387#define reg_pinmux_rw_pd_gio___pd2___lsb 2
388#define reg_pinmux_rw_pd_gio___pd2___width 1
389#define reg_pinmux_rw_pd_gio___pd2___bit 2
390#define reg_pinmux_rw_pd_gio___pd3___lsb 3
391#define reg_pinmux_rw_pd_gio___pd3___width 1
392#define reg_pinmux_rw_pd_gio___pd3___bit 3
393#define reg_pinmux_rw_pd_gio___pd4___lsb 4
394#define reg_pinmux_rw_pd_gio___pd4___width 1
395#define reg_pinmux_rw_pd_gio___pd4___bit 4
396#define reg_pinmux_rw_pd_gio___pd5___lsb 5
397#define reg_pinmux_rw_pd_gio___pd5___width 1
398#define reg_pinmux_rw_pd_gio___pd5___bit 5
399#define reg_pinmux_rw_pd_gio___pd6___lsb 6
400#define reg_pinmux_rw_pd_gio___pd6___width 1
401#define reg_pinmux_rw_pd_gio___pd6___bit 6
402#define reg_pinmux_rw_pd_gio___pd7___lsb 7
403#define reg_pinmux_rw_pd_gio___pd7___width 1
404#define reg_pinmux_rw_pd_gio___pd7___bit 7
405#define reg_pinmux_rw_pd_gio___pd8___lsb 8
406#define reg_pinmux_rw_pd_gio___pd8___width 1
407#define reg_pinmux_rw_pd_gio___pd8___bit 8
408#define reg_pinmux_rw_pd_gio___pd9___lsb 9
409#define reg_pinmux_rw_pd_gio___pd9___width 1
410#define reg_pinmux_rw_pd_gio___pd9___bit 9
411#define reg_pinmux_rw_pd_gio___pd10___lsb 10
412#define reg_pinmux_rw_pd_gio___pd10___width 1
413#define reg_pinmux_rw_pd_gio___pd10___bit 10
414#define reg_pinmux_rw_pd_gio___pd11___lsb 11
415#define reg_pinmux_rw_pd_gio___pd11___width 1
416#define reg_pinmux_rw_pd_gio___pd11___bit 11
417#define reg_pinmux_rw_pd_gio___pd12___lsb 12
418#define reg_pinmux_rw_pd_gio___pd12___width 1
419#define reg_pinmux_rw_pd_gio___pd12___bit 12
420#define reg_pinmux_rw_pd_gio___pd13___lsb 13
421#define reg_pinmux_rw_pd_gio___pd13___width 1
422#define reg_pinmux_rw_pd_gio___pd13___bit 13
423#define reg_pinmux_rw_pd_gio___pd14___lsb 14
424#define reg_pinmux_rw_pd_gio___pd14___width 1
425#define reg_pinmux_rw_pd_gio___pd14___bit 14
426#define reg_pinmux_rw_pd_gio___pd15___lsb 15
427#define reg_pinmux_rw_pd_gio___pd15___width 1
428#define reg_pinmux_rw_pd_gio___pd15___bit 15
429#define reg_pinmux_rw_pd_gio___pd16___lsb 16
430#define reg_pinmux_rw_pd_gio___pd16___width 1
431#define reg_pinmux_rw_pd_gio___pd16___bit 16
432#define reg_pinmux_rw_pd_gio___pd17___lsb 17
433#define reg_pinmux_rw_pd_gio___pd17___width 1
434#define reg_pinmux_rw_pd_gio___pd17___bit 17
435#define reg_pinmux_rw_pd_gio_offset 24
436
437/* Register rw_pd_iop, scope pinmux, type rw */
438#define reg_pinmux_rw_pd_iop___pd0___lsb 0
439#define reg_pinmux_rw_pd_iop___pd0___width 1
440#define reg_pinmux_rw_pd_iop___pd0___bit 0
441#define reg_pinmux_rw_pd_iop___pd1___lsb 1
442#define reg_pinmux_rw_pd_iop___pd1___width 1
443#define reg_pinmux_rw_pd_iop___pd1___bit 1
444#define reg_pinmux_rw_pd_iop___pd2___lsb 2
445#define reg_pinmux_rw_pd_iop___pd2___width 1
446#define reg_pinmux_rw_pd_iop___pd2___bit 2
447#define reg_pinmux_rw_pd_iop___pd3___lsb 3
448#define reg_pinmux_rw_pd_iop___pd3___width 1
449#define reg_pinmux_rw_pd_iop___pd3___bit 3
450#define reg_pinmux_rw_pd_iop___pd4___lsb 4
451#define reg_pinmux_rw_pd_iop___pd4___width 1
452#define reg_pinmux_rw_pd_iop___pd4___bit 4
453#define reg_pinmux_rw_pd_iop___pd5___lsb 5
454#define reg_pinmux_rw_pd_iop___pd5___width 1
455#define reg_pinmux_rw_pd_iop___pd5___bit 5
456#define reg_pinmux_rw_pd_iop___pd6___lsb 6
457#define reg_pinmux_rw_pd_iop___pd6___width 1
458#define reg_pinmux_rw_pd_iop___pd6___bit 6
459#define reg_pinmux_rw_pd_iop___pd7___lsb 7
460#define reg_pinmux_rw_pd_iop___pd7___width 1
461#define reg_pinmux_rw_pd_iop___pd7___bit 7
462#define reg_pinmux_rw_pd_iop___pd8___lsb 8
463#define reg_pinmux_rw_pd_iop___pd8___width 1
464#define reg_pinmux_rw_pd_iop___pd8___bit 8
465#define reg_pinmux_rw_pd_iop___pd9___lsb 9
466#define reg_pinmux_rw_pd_iop___pd9___width 1
467#define reg_pinmux_rw_pd_iop___pd9___bit 9
468#define reg_pinmux_rw_pd_iop___pd10___lsb 10
469#define reg_pinmux_rw_pd_iop___pd10___width 1
470#define reg_pinmux_rw_pd_iop___pd10___bit 10
471#define reg_pinmux_rw_pd_iop___pd11___lsb 11
472#define reg_pinmux_rw_pd_iop___pd11___width 1
473#define reg_pinmux_rw_pd_iop___pd11___bit 11
474#define reg_pinmux_rw_pd_iop___pd12___lsb 12
475#define reg_pinmux_rw_pd_iop___pd12___width 1
476#define reg_pinmux_rw_pd_iop___pd12___bit 12
477#define reg_pinmux_rw_pd_iop___pd13___lsb 13
478#define reg_pinmux_rw_pd_iop___pd13___width 1
479#define reg_pinmux_rw_pd_iop___pd13___bit 13
480#define reg_pinmux_rw_pd_iop___pd14___lsb 14
481#define reg_pinmux_rw_pd_iop___pd14___width 1
482#define reg_pinmux_rw_pd_iop___pd14___bit 14
483#define reg_pinmux_rw_pd_iop___pd15___lsb 15
484#define reg_pinmux_rw_pd_iop___pd15___width 1
485#define reg_pinmux_rw_pd_iop___pd15___bit 15
486#define reg_pinmux_rw_pd_iop___pd16___lsb 16
487#define reg_pinmux_rw_pd_iop___pd16___width 1
488#define reg_pinmux_rw_pd_iop___pd16___bit 16
489#define reg_pinmux_rw_pd_iop___pd17___lsb 17
490#define reg_pinmux_rw_pd_iop___pd17___width 1
491#define reg_pinmux_rw_pd_iop___pd17___bit 17
492#define reg_pinmux_rw_pd_iop_offset 28
493
494/* Register rw_pe_gio, scope pinmux, type rw */
495#define reg_pinmux_rw_pe_gio___pe0___lsb 0
496#define reg_pinmux_rw_pe_gio___pe0___width 1
497#define reg_pinmux_rw_pe_gio___pe0___bit 0
498#define reg_pinmux_rw_pe_gio___pe1___lsb 1
499#define reg_pinmux_rw_pe_gio___pe1___width 1
500#define reg_pinmux_rw_pe_gio___pe1___bit 1
501#define reg_pinmux_rw_pe_gio___pe2___lsb 2
502#define reg_pinmux_rw_pe_gio___pe2___width 1
503#define reg_pinmux_rw_pe_gio___pe2___bit 2
504#define reg_pinmux_rw_pe_gio___pe3___lsb 3
505#define reg_pinmux_rw_pe_gio___pe3___width 1
506#define reg_pinmux_rw_pe_gio___pe3___bit 3
507#define reg_pinmux_rw_pe_gio___pe4___lsb 4
508#define reg_pinmux_rw_pe_gio___pe4___width 1
509#define reg_pinmux_rw_pe_gio___pe4___bit 4
510#define reg_pinmux_rw_pe_gio___pe5___lsb 5
511#define reg_pinmux_rw_pe_gio___pe5___width 1
512#define reg_pinmux_rw_pe_gio___pe5___bit 5
513#define reg_pinmux_rw_pe_gio___pe6___lsb 6
514#define reg_pinmux_rw_pe_gio___pe6___width 1
515#define reg_pinmux_rw_pe_gio___pe6___bit 6
516#define reg_pinmux_rw_pe_gio___pe7___lsb 7
517#define reg_pinmux_rw_pe_gio___pe7___width 1
518#define reg_pinmux_rw_pe_gio___pe7___bit 7
519#define reg_pinmux_rw_pe_gio___pe8___lsb 8
520#define reg_pinmux_rw_pe_gio___pe8___width 1
521#define reg_pinmux_rw_pe_gio___pe8___bit 8
522#define reg_pinmux_rw_pe_gio___pe9___lsb 9
523#define reg_pinmux_rw_pe_gio___pe9___width 1
524#define reg_pinmux_rw_pe_gio___pe9___bit 9
525#define reg_pinmux_rw_pe_gio___pe10___lsb 10
526#define reg_pinmux_rw_pe_gio___pe10___width 1
527#define reg_pinmux_rw_pe_gio___pe10___bit 10
528#define reg_pinmux_rw_pe_gio___pe11___lsb 11
529#define reg_pinmux_rw_pe_gio___pe11___width 1
530#define reg_pinmux_rw_pe_gio___pe11___bit 11
531#define reg_pinmux_rw_pe_gio___pe12___lsb 12
532#define reg_pinmux_rw_pe_gio___pe12___width 1
533#define reg_pinmux_rw_pe_gio___pe12___bit 12
534#define reg_pinmux_rw_pe_gio___pe13___lsb 13
535#define reg_pinmux_rw_pe_gio___pe13___width 1
536#define reg_pinmux_rw_pe_gio___pe13___bit 13
537#define reg_pinmux_rw_pe_gio___pe14___lsb 14
538#define reg_pinmux_rw_pe_gio___pe14___width 1
539#define reg_pinmux_rw_pe_gio___pe14___bit 14
540#define reg_pinmux_rw_pe_gio___pe15___lsb 15
541#define reg_pinmux_rw_pe_gio___pe15___width 1
542#define reg_pinmux_rw_pe_gio___pe15___bit 15
543#define reg_pinmux_rw_pe_gio___pe16___lsb 16
544#define reg_pinmux_rw_pe_gio___pe16___width 1
545#define reg_pinmux_rw_pe_gio___pe16___bit 16
546#define reg_pinmux_rw_pe_gio___pe17___lsb 17
547#define reg_pinmux_rw_pe_gio___pe17___width 1
548#define reg_pinmux_rw_pe_gio___pe17___bit 17
549#define reg_pinmux_rw_pe_gio_offset 32
550
551/* Register rw_pe_iop, scope pinmux, type rw */
552#define reg_pinmux_rw_pe_iop___pe0___lsb 0
553#define reg_pinmux_rw_pe_iop___pe0___width 1
554#define reg_pinmux_rw_pe_iop___pe0___bit 0
555#define reg_pinmux_rw_pe_iop___pe1___lsb 1
556#define reg_pinmux_rw_pe_iop___pe1___width 1
557#define reg_pinmux_rw_pe_iop___pe1___bit 1
558#define reg_pinmux_rw_pe_iop___pe2___lsb 2
559#define reg_pinmux_rw_pe_iop___pe2___width 1
560#define reg_pinmux_rw_pe_iop___pe2___bit 2
561#define reg_pinmux_rw_pe_iop___pe3___lsb 3
562#define reg_pinmux_rw_pe_iop___pe3___width 1
563#define reg_pinmux_rw_pe_iop___pe3___bit 3
564#define reg_pinmux_rw_pe_iop___pe4___lsb 4
565#define reg_pinmux_rw_pe_iop___pe4___width 1
566#define reg_pinmux_rw_pe_iop___pe4___bit 4
567#define reg_pinmux_rw_pe_iop___pe5___lsb 5
568#define reg_pinmux_rw_pe_iop___pe5___width 1
569#define reg_pinmux_rw_pe_iop___pe5___bit 5
570#define reg_pinmux_rw_pe_iop___pe6___lsb 6
571#define reg_pinmux_rw_pe_iop___pe6___width 1
572#define reg_pinmux_rw_pe_iop___pe6___bit 6
573#define reg_pinmux_rw_pe_iop___pe7___lsb 7
574#define reg_pinmux_rw_pe_iop___pe7___width 1
575#define reg_pinmux_rw_pe_iop___pe7___bit 7
576#define reg_pinmux_rw_pe_iop___pe8___lsb 8
577#define reg_pinmux_rw_pe_iop___pe8___width 1
578#define reg_pinmux_rw_pe_iop___pe8___bit 8
579#define reg_pinmux_rw_pe_iop___pe9___lsb 9
580#define reg_pinmux_rw_pe_iop___pe9___width 1
581#define reg_pinmux_rw_pe_iop___pe9___bit 9
582#define reg_pinmux_rw_pe_iop___pe10___lsb 10
583#define reg_pinmux_rw_pe_iop___pe10___width 1
584#define reg_pinmux_rw_pe_iop___pe10___bit 10
585#define reg_pinmux_rw_pe_iop___pe11___lsb 11
586#define reg_pinmux_rw_pe_iop___pe11___width 1
587#define reg_pinmux_rw_pe_iop___pe11___bit 11
588#define reg_pinmux_rw_pe_iop___pe12___lsb 12
589#define reg_pinmux_rw_pe_iop___pe12___width 1
590#define reg_pinmux_rw_pe_iop___pe12___bit 12
591#define reg_pinmux_rw_pe_iop___pe13___lsb 13
592#define reg_pinmux_rw_pe_iop___pe13___width 1
593#define reg_pinmux_rw_pe_iop___pe13___bit 13
594#define reg_pinmux_rw_pe_iop___pe14___lsb 14
595#define reg_pinmux_rw_pe_iop___pe14___width 1
596#define reg_pinmux_rw_pe_iop___pe14___bit 14
597#define reg_pinmux_rw_pe_iop___pe15___lsb 15
598#define reg_pinmux_rw_pe_iop___pe15___width 1
599#define reg_pinmux_rw_pe_iop___pe15___bit 15
600#define reg_pinmux_rw_pe_iop___pe16___lsb 16
601#define reg_pinmux_rw_pe_iop___pe16___width 1
602#define reg_pinmux_rw_pe_iop___pe16___bit 16
603#define reg_pinmux_rw_pe_iop___pe17___lsb 17
604#define reg_pinmux_rw_pe_iop___pe17___width 1
605#define reg_pinmux_rw_pe_iop___pe17___bit 17
606#define reg_pinmux_rw_pe_iop_offset 36
607
608/* Register rw_usb_phy, scope pinmux, type rw */
609#define reg_pinmux_rw_usb_phy___en_usb0___lsb 0
610#define reg_pinmux_rw_usb_phy___en_usb0___width 1
611#define reg_pinmux_rw_usb_phy___en_usb0___bit 0
612#define reg_pinmux_rw_usb_phy___en_usb1___lsb 1
613#define reg_pinmux_rw_usb_phy___en_usb1___width 1
614#define reg_pinmux_rw_usb_phy___en_usb1___bit 1
615#define reg_pinmux_rw_usb_phy_offset 40
616
617
618/* Constants */
619#define regk_pinmux_no 0x00000000
620#define regk_pinmux_rw_hwprot_default 0x00000000
621#define regk_pinmux_rw_pa_default 0x00000000
622#define regk_pinmux_rw_pb_gio_default 0x00000000
623#define regk_pinmux_rw_pb_iop_default 0x00000000
624#define regk_pinmux_rw_pc_gio_default 0x00000000
625#define regk_pinmux_rw_pc_iop_default 0x00000000
626#define regk_pinmux_rw_pd_gio_default 0x00000000
627#define regk_pinmux_rw_pd_iop_default 0x00000000
628#define regk_pinmux_rw_pe_gio_default 0x00000000
629#define regk_pinmux_rw_pe_iop_default 0x00000000
630#define regk_pinmux_rw_usb_phy_default 0x00000000
631#define regk_pinmux_yes 0x00000001
632#endif /* __pinmux_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/reg_map_asm.h b/include/asm-cris/arch-v32/hwregs/asm/reg_map_asm.h
new file mode 100644
index 000000000000..76959b70cd2c
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/reg_map_asm.h
@@ -0,0 +1,96 @@
1#ifndef __reg_map_h
2#define __reg_map_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../mod/fakereg.rmap
7 * id: fakereg.rmap,v 1.3 2004/02/11 19:53:22 ronny Exp
8 * last modified: Wed Feb 11 20:53:25 2004
9 * file: ../../rtl/global.rmap
10 * id: global.rmap,v 1.3 2003/08/18 15:08:23 mikaeln Exp
11 * last modified: Mon Aug 18 17:08:23 2003
12 * file: ../../mod/modreg.rmap
13 * id: modreg.rmap,v 1.31 2004/02/20 15:40:04 stefans Exp
14 * last modified: Fri Feb 20 16:40:04 2004
15 *
16 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/reg_map_asm.h -base 0xb0000000 ../../rtl/global.rmap ../../mod/modreg.rmap ../../inst/memarb/rtl/guinness/marb_top.r ../../mod/fakereg.rmap
17 * id: $Id: reg_map_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
18 * Any changes here will be lost.
19 *
20 * -*- buffer-read-only: t -*-
21 */
22#define regi_artpec_mod 0xb7044000
23#define regi_ata 0xb0032000
24#define regi_ata_mod 0xb7006000
25#define regi_barber 0xb701a000
26#define regi_bif_core 0xb0014000
27#define regi_bif_dma 0xb0016000
28#define regi_bif_slave 0xb0018000
29#define regi_bif_slave_ext 0xac000000
30#define regi_bus_master 0xb703c000
31#define regi_config 0xb003c000
32#define regi_dma0 0xb0000000
33#define regi_dma1 0xb0002000
34#define regi_dma2 0xb0004000
35#define regi_dma3 0xb0006000
36#define regi_dma4 0xb0008000
37#define regi_dma5 0xb000a000
38#define regi_dma6 0xb000c000
39#define regi_dma7 0xb000e000
40#define regi_dma8 0xb0010000
41#define regi_dma9 0xb0012000
42#define regi_eth0 0xb0034000
43#define regi_eth1 0xb0036000
44#define regi_eth_mod 0xb7004000
45#define regi_eth_mod1 0xb701c000
46#define regi_eth_strmod 0xb7008000
47#define regi_eth_strmod1 0xb7032000
48#define regi_ext_dma 0xb703a000
49#define regi_ext_mem 0xb7046000
50#define regi_gen_io 0xb7016000
51#define regi_gio 0xb001a000
52#define regi_hook 0xb7000000
53#define regi_iop 0xb0020000
54#define regi_irq 0xb001c000
55#define regi_irq_nmi 0xb701e000
56#define regi_marb 0xb003e000
57#define regi_marb_bp0 0xb003e240
58#define regi_marb_bp1 0xb003e280
59#define regi_marb_bp2 0xb003e2c0
60#define regi_marb_bp3 0xb003e300
61#define regi_nand_mod 0xb7014000
62#define regi_p21 0xb002e000
63#define regi_p21_mod 0xb7042000
64#define regi_pci_mod 0xb7010000
65#define regi_pin_test 0xb7018000
66#define regi_pinmux 0xb0038000
67#define regi_sdram_chk 0xb703e000
68#define regi_sdram_mod 0xb7012000
69#define regi_ser0 0xb0026000
70#define regi_ser1 0xb0028000
71#define regi_ser2 0xb002a000
72#define regi_ser3 0xb002c000
73#define regi_ser_mod0 0xb7020000
74#define regi_ser_mod1 0xb7022000
75#define regi_ser_mod2 0xb7024000
76#define regi_ser_mod3 0xb7026000
77#define regi_smif_stat 0xb700e000
78#define regi_sser0 0xb0022000
79#define regi_sser1 0xb0024000
80#define regi_sser_mod0 0xb700a000
81#define regi_sser_mod1 0xb700c000
82#define regi_strcop 0xb0030000
83#define regi_strmux 0xb003a000
84#define regi_strmux_tst 0xb7040000
85#define regi_tap 0xb7002000
86#define regi_timer 0xb001e000
87#define regi_timer_mod 0xb7034000
88#define regi_trace 0xb0040000
89#define regi_usb0 0xb7028000
90#define regi_usb1 0xb702a000
91#define regi_usb2 0xb702c000
92#define regi_usb3 0xb702e000
93#define regi_usb_dev 0xb7030000
94#define regi_utmi_mod0 0xb7036000
95#define regi_utmi_mod1 0xb7038000
96#endif /* __reg_map_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/rt_trace_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/rt_trace_defs_asm.h
new file mode 100644
index 000000000000..10246f49fb28
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/rt_trace_defs_asm.h
@@ -0,0 +1,142 @@
1#ifndef __rt_trace_defs_asm_h
2#define __rt_trace_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/rt_trace/rtl/rt_regs.r
7 * id: rt_regs.r,v 1.18 2005/02/08 15:45:00 stefans Exp
8 * last modfied: Mon Apr 11 16:09:14 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/rt_trace_defs_asm.h ../../inst/rt_trace/rtl/rt_regs.r
11 * id: $Id: rt_trace_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope rt_trace, type rw */
57#define reg_rt_trace_rw_cfg___en___lsb 0
58#define reg_rt_trace_rw_cfg___en___width 1
59#define reg_rt_trace_rw_cfg___en___bit 0
60#define reg_rt_trace_rw_cfg___mode___lsb 1
61#define reg_rt_trace_rw_cfg___mode___width 1
62#define reg_rt_trace_rw_cfg___mode___bit 1
63#define reg_rt_trace_rw_cfg___owner___lsb 2
64#define reg_rt_trace_rw_cfg___owner___width 1
65#define reg_rt_trace_rw_cfg___owner___bit 2
66#define reg_rt_trace_rw_cfg___wp___lsb 3
67#define reg_rt_trace_rw_cfg___wp___width 1
68#define reg_rt_trace_rw_cfg___wp___bit 3
69#define reg_rt_trace_rw_cfg___stall___lsb 4
70#define reg_rt_trace_rw_cfg___stall___width 1
71#define reg_rt_trace_rw_cfg___stall___bit 4
72#define reg_rt_trace_rw_cfg___wp_start___lsb 8
73#define reg_rt_trace_rw_cfg___wp_start___width 7
74#define reg_rt_trace_rw_cfg___wp_stop___lsb 16
75#define reg_rt_trace_rw_cfg___wp_stop___width 7
76#define reg_rt_trace_rw_cfg_offset 0
77
78/* Register rw_tap_ctrl, scope rt_trace, type rw */
79#define reg_rt_trace_rw_tap_ctrl___ack_data___lsb 0
80#define reg_rt_trace_rw_tap_ctrl___ack_data___width 1
81#define reg_rt_trace_rw_tap_ctrl___ack_data___bit 0
82#define reg_rt_trace_rw_tap_ctrl___ack_guru___lsb 1
83#define reg_rt_trace_rw_tap_ctrl___ack_guru___width 1
84#define reg_rt_trace_rw_tap_ctrl___ack_guru___bit 1
85#define reg_rt_trace_rw_tap_ctrl_offset 4
86
87/* Register r_tap_stat, scope rt_trace, type r */
88#define reg_rt_trace_r_tap_stat___dav___lsb 0
89#define reg_rt_trace_r_tap_stat___dav___width 1
90#define reg_rt_trace_r_tap_stat___dav___bit 0
91#define reg_rt_trace_r_tap_stat___empty___lsb 1
92#define reg_rt_trace_r_tap_stat___empty___width 1
93#define reg_rt_trace_r_tap_stat___empty___bit 1
94#define reg_rt_trace_r_tap_stat_offset 8
95
96/* Register rw_tap_data, scope rt_trace, type rw */
97#define reg_rt_trace_rw_tap_data_offset 12
98
99/* Register rw_tap_hdata, scope rt_trace, type rw */
100#define reg_rt_trace_rw_tap_hdata___op___lsb 0
101#define reg_rt_trace_rw_tap_hdata___op___width 4
102#define reg_rt_trace_rw_tap_hdata___sub_op___lsb 4
103#define reg_rt_trace_rw_tap_hdata___sub_op___width 4
104#define reg_rt_trace_rw_tap_hdata_offset 16
105
106/* Register r_redir, scope rt_trace, type r */
107#define reg_rt_trace_r_redir_offset 20
108
109
110/* Constants */
111#define regk_rt_trace_brk 0x0000000c
112#define regk_rt_trace_dbg 0x00000003
113#define regk_rt_trace_dbgdi 0x00000004
114#define regk_rt_trace_dbgdo 0x00000005
115#define regk_rt_trace_gmode 0x00000000
116#define regk_rt_trace_no 0x00000000
117#define regk_rt_trace_nop 0x00000000
118#define regk_rt_trace_normal 0x00000000
119#define regk_rt_trace_rdmem 0x00000007
120#define regk_rt_trace_rdmemb 0x00000009
121#define regk_rt_trace_rdpreg 0x00000002
122#define regk_rt_trace_rdreg 0x00000001
123#define regk_rt_trace_rdsreg 0x00000003
124#define regk_rt_trace_redir 0x00000006
125#define regk_rt_trace_ret 0x0000000b
126#define regk_rt_trace_rw_cfg_default 0x00000000
127#define regk_rt_trace_trcfg 0x00000001
128#define regk_rt_trace_wp 0x00000001
129#define regk_rt_trace_wp0 0x00000001
130#define regk_rt_trace_wp1 0x00000002
131#define regk_rt_trace_wp2 0x00000004
132#define regk_rt_trace_wp3 0x00000008
133#define regk_rt_trace_wp4 0x00000010
134#define regk_rt_trace_wp5 0x00000020
135#define regk_rt_trace_wp6 0x00000040
136#define regk_rt_trace_wrmem 0x00000008
137#define regk_rt_trace_wrmemb 0x0000000a
138#define regk_rt_trace_wrpreg 0x00000005
139#define regk_rt_trace_wrreg 0x00000004
140#define regk_rt_trace_wrsreg 0x00000006
141#define regk_rt_trace_yes 0x00000001
142#endif /* __rt_trace_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/ser_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/ser_defs_asm.h
new file mode 100644
index 000000000000..4a2808bdf390
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/ser_defs_asm.h
@@ -0,0 +1,359 @@
1#ifndef __ser_defs_asm_h
2#define __ser_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/ser/rtl/ser_regs.r
7 * id: ser_regs.r,v 1.23 2005/02/08 13:58:35 perz Exp
8 * last modfied: Mon Apr 11 16:09:21 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/ser_defs_asm.h ../../inst/ser/rtl/ser_regs.r
11 * id: $Id: ser_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_tr_ctrl, scope ser, type rw */
57#define reg_ser_rw_tr_ctrl___base_freq___lsb 0
58#define reg_ser_rw_tr_ctrl___base_freq___width 3
59#define reg_ser_rw_tr_ctrl___en___lsb 3
60#define reg_ser_rw_tr_ctrl___en___width 1
61#define reg_ser_rw_tr_ctrl___en___bit 3
62#define reg_ser_rw_tr_ctrl___par___lsb 4
63#define reg_ser_rw_tr_ctrl___par___width 2
64#define reg_ser_rw_tr_ctrl___par_en___lsb 6
65#define reg_ser_rw_tr_ctrl___par_en___width 1
66#define reg_ser_rw_tr_ctrl___par_en___bit 6
67#define reg_ser_rw_tr_ctrl___data_bits___lsb 7
68#define reg_ser_rw_tr_ctrl___data_bits___width 1
69#define reg_ser_rw_tr_ctrl___data_bits___bit 7
70#define reg_ser_rw_tr_ctrl___stop_bits___lsb 8
71#define reg_ser_rw_tr_ctrl___stop_bits___width 1
72#define reg_ser_rw_tr_ctrl___stop_bits___bit 8
73#define reg_ser_rw_tr_ctrl___stop___lsb 9
74#define reg_ser_rw_tr_ctrl___stop___width 1
75#define reg_ser_rw_tr_ctrl___stop___bit 9
76#define reg_ser_rw_tr_ctrl___rts_delay___lsb 10
77#define reg_ser_rw_tr_ctrl___rts_delay___width 3
78#define reg_ser_rw_tr_ctrl___rts_setup___lsb 13
79#define reg_ser_rw_tr_ctrl___rts_setup___width 1
80#define reg_ser_rw_tr_ctrl___rts_setup___bit 13
81#define reg_ser_rw_tr_ctrl___auto_rts___lsb 14
82#define reg_ser_rw_tr_ctrl___auto_rts___width 1
83#define reg_ser_rw_tr_ctrl___auto_rts___bit 14
84#define reg_ser_rw_tr_ctrl___txd___lsb 15
85#define reg_ser_rw_tr_ctrl___txd___width 1
86#define reg_ser_rw_tr_ctrl___txd___bit 15
87#define reg_ser_rw_tr_ctrl___auto_cts___lsb 16
88#define reg_ser_rw_tr_ctrl___auto_cts___width 1
89#define reg_ser_rw_tr_ctrl___auto_cts___bit 16
90#define reg_ser_rw_tr_ctrl_offset 0
91
92/* Register rw_tr_dma_en, scope ser, type rw */
93#define reg_ser_rw_tr_dma_en___en___lsb 0
94#define reg_ser_rw_tr_dma_en___en___width 1
95#define reg_ser_rw_tr_dma_en___en___bit 0
96#define reg_ser_rw_tr_dma_en_offset 4
97
98/* Register rw_rec_ctrl, scope ser, type rw */
99#define reg_ser_rw_rec_ctrl___base_freq___lsb 0
100#define reg_ser_rw_rec_ctrl___base_freq___width 3
101#define reg_ser_rw_rec_ctrl___en___lsb 3
102#define reg_ser_rw_rec_ctrl___en___width 1
103#define reg_ser_rw_rec_ctrl___en___bit 3
104#define reg_ser_rw_rec_ctrl___par___lsb 4
105#define reg_ser_rw_rec_ctrl___par___width 2
106#define reg_ser_rw_rec_ctrl___par_en___lsb 6
107#define reg_ser_rw_rec_ctrl___par_en___width 1
108#define reg_ser_rw_rec_ctrl___par_en___bit 6
109#define reg_ser_rw_rec_ctrl___data_bits___lsb 7
110#define reg_ser_rw_rec_ctrl___data_bits___width 1
111#define reg_ser_rw_rec_ctrl___data_bits___bit 7
112#define reg_ser_rw_rec_ctrl___dma_mode___lsb 8
113#define reg_ser_rw_rec_ctrl___dma_mode___width 1
114#define reg_ser_rw_rec_ctrl___dma_mode___bit 8
115#define reg_ser_rw_rec_ctrl___dma_err___lsb 9
116#define reg_ser_rw_rec_ctrl___dma_err___width 1
117#define reg_ser_rw_rec_ctrl___dma_err___bit 9
118#define reg_ser_rw_rec_ctrl___sampling___lsb 10
119#define reg_ser_rw_rec_ctrl___sampling___width 1
120#define reg_ser_rw_rec_ctrl___sampling___bit 10
121#define reg_ser_rw_rec_ctrl___timeout___lsb 11
122#define reg_ser_rw_rec_ctrl___timeout___width 3
123#define reg_ser_rw_rec_ctrl___auto_eop___lsb 14
124#define reg_ser_rw_rec_ctrl___auto_eop___width 1
125#define reg_ser_rw_rec_ctrl___auto_eop___bit 14
126#define reg_ser_rw_rec_ctrl___half_duplex___lsb 15
127#define reg_ser_rw_rec_ctrl___half_duplex___width 1
128#define reg_ser_rw_rec_ctrl___half_duplex___bit 15
129#define reg_ser_rw_rec_ctrl___rts_n___lsb 16
130#define reg_ser_rw_rec_ctrl___rts_n___width 1
131#define reg_ser_rw_rec_ctrl___rts_n___bit 16
132#define reg_ser_rw_rec_ctrl___loopback___lsb 17
133#define reg_ser_rw_rec_ctrl___loopback___width 1
134#define reg_ser_rw_rec_ctrl___loopback___bit 17
135#define reg_ser_rw_rec_ctrl_offset 8
136
137/* Register rw_tr_baud_div, scope ser, type rw */
138#define reg_ser_rw_tr_baud_div___div___lsb 0
139#define reg_ser_rw_tr_baud_div___div___width 16
140#define reg_ser_rw_tr_baud_div_offset 12
141
142/* Register rw_rec_baud_div, scope ser, type rw */
143#define reg_ser_rw_rec_baud_div___div___lsb 0
144#define reg_ser_rw_rec_baud_div___div___width 16
145#define reg_ser_rw_rec_baud_div_offset 16
146
147/* Register rw_xoff, scope ser, type rw */
148#define reg_ser_rw_xoff___chr___lsb 0
149#define reg_ser_rw_xoff___chr___width 8
150#define reg_ser_rw_xoff___automatic___lsb 8
151#define reg_ser_rw_xoff___automatic___width 1
152#define reg_ser_rw_xoff___automatic___bit 8
153#define reg_ser_rw_xoff_offset 20
154
155/* Register rw_xoff_clr, scope ser, type rw */
156#define reg_ser_rw_xoff_clr___clr___lsb 0
157#define reg_ser_rw_xoff_clr___clr___width 1
158#define reg_ser_rw_xoff_clr___clr___bit 0
159#define reg_ser_rw_xoff_clr_offset 24
160
161/* Register rw_dout, scope ser, type rw */
162#define reg_ser_rw_dout___data___lsb 0
163#define reg_ser_rw_dout___data___width 8
164#define reg_ser_rw_dout_offset 28
165
166/* Register rs_stat_din, scope ser, type rs */
167#define reg_ser_rs_stat_din___data___lsb 0
168#define reg_ser_rs_stat_din___data___width 8
169#define reg_ser_rs_stat_din___dav___lsb 16
170#define reg_ser_rs_stat_din___dav___width 1
171#define reg_ser_rs_stat_din___dav___bit 16
172#define reg_ser_rs_stat_din___framing_err___lsb 17
173#define reg_ser_rs_stat_din___framing_err___width 1
174#define reg_ser_rs_stat_din___framing_err___bit 17
175#define reg_ser_rs_stat_din___par_err___lsb 18
176#define reg_ser_rs_stat_din___par_err___width 1
177#define reg_ser_rs_stat_din___par_err___bit 18
178#define reg_ser_rs_stat_din___orun___lsb 19
179#define reg_ser_rs_stat_din___orun___width 1
180#define reg_ser_rs_stat_din___orun___bit 19
181#define reg_ser_rs_stat_din___rec_err___lsb 20
182#define reg_ser_rs_stat_din___rec_err___width 1
183#define reg_ser_rs_stat_din___rec_err___bit 20
184#define reg_ser_rs_stat_din___rxd___lsb 21
185#define reg_ser_rs_stat_din___rxd___width 1
186#define reg_ser_rs_stat_din___rxd___bit 21
187#define reg_ser_rs_stat_din___tr_idle___lsb 22
188#define reg_ser_rs_stat_din___tr_idle___width 1
189#define reg_ser_rs_stat_din___tr_idle___bit 22
190#define reg_ser_rs_stat_din___tr_empty___lsb 23
191#define reg_ser_rs_stat_din___tr_empty___width 1
192#define reg_ser_rs_stat_din___tr_empty___bit 23
193#define reg_ser_rs_stat_din___tr_rdy___lsb 24
194#define reg_ser_rs_stat_din___tr_rdy___width 1
195#define reg_ser_rs_stat_din___tr_rdy___bit 24
196#define reg_ser_rs_stat_din___cts_n___lsb 25
197#define reg_ser_rs_stat_din___cts_n___width 1
198#define reg_ser_rs_stat_din___cts_n___bit 25
199#define reg_ser_rs_stat_din___xoff_detect___lsb 26
200#define reg_ser_rs_stat_din___xoff_detect___width 1
201#define reg_ser_rs_stat_din___xoff_detect___bit 26
202#define reg_ser_rs_stat_din___rts_n___lsb 27
203#define reg_ser_rs_stat_din___rts_n___width 1
204#define reg_ser_rs_stat_din___rts_n___bit 27
205#define reg_ser_rs_stat_din___txd___lsb 28
206#define reg_ser_rs_stat_din___txd___width 1
207#define reg_ser_rs_stat_din___txd___bit 28
208#define reg_ser_rs_stat_din_offset 32
209
210/* Register r_stat_din, scope ser, type r */
211#define reg_ser_r_stat_din___data___lsb 0
212#define reg_ser_r_stat_din___data___width 8
213#define reg_ser_r_stat_din___dav___lsb 16
214#define reg_ser_r_stat_din___dav___width 1
215#define reg_ser_r_stat_din___dav___bit 16
216#define reg_ser_r_stat_din___framing_err___lsb 17
217#define reg_ser_r_stat_din___framing_err___width 1
218#define reg_ser_r_stat_din___framing_err___bit 17
219#define reg_ser_r_stat_din___par_err___lsb 18
220#define reg_ser_r_stat_din___par_err___width 1
221#define reg_ser_r_stat_din___par_err___bit 18
222#define reg_ser_r_stat_din___orun___lsb 19
223#define reg_ser_r_stat_din___orun___width 1
224#define reg_ser_r_stat_din___orun___bit 19
225#define reg_ser_r_stat_din___rec_err___lsb 20
226#define reg_ser_r_stat_din___rec_err___width 1
227#define reg_ser_r_stat_din___rec_err___bit 20
228#define reg_ser_r_stat_din___rxd___lsb 21
229#define reg_ser_r_stat_din___rxd___width 1
230#define reg_ser_r_stat_din___rxd___bit 21
231#define reg_ser_r_stat_din___tr_idle___lsb 22
232#define reg_ser_r_stat_din___tr_idle___width 1
233#define reg_ser_r_stat_din___tr_idle___bit 22
234#define reg_ser_r_stat_din___tr_empty___lsb 23
235#define reg_ser_r_stat_din___tr_empty___width 1
236#define reg_ser_r_stat_din___tr_empty___bit 23
237#define reg_ser_r_stat_din___tr_rdy___lsb 24
238#define reg_ser_r_stat_din___tr_rdy___width 1
239#define reg_ser_r_stat_din___tr_rdy___bit 24
240#define reg_ser_r_stat_din___cts_n___lsb 25
241#define reg_ser_r_stat_din___cts_n___width 1
242#define reg_ser_r_stat_din___cts_n___bit 25
243#define reg_ser_r_stat_din___xoff_detect___lsb 26
244#define reg_ser_r_stat_din___xoff_detect___width 1
245#define reg_ser_r_stat_din___xoff_detect___bit 26
246#define reg_ser_r_stat_din___rts_n___lsb 27
247#define reg_ser_r_stat_din___rts_n___width 1
248#define reg_ser_r_stat_din___rts_n___bit 27
249#define reg_ser_r_stat_din___txd___lsb 28
250#define reg_ser_r_stat_din___txd___width 1
251#define reg_ser_r_stat_din___txd___bit 28
252#define reg_ser_r_stat_din_offset 36
253
254/* Register rw_rec_eop, scope ser, type rw */
255#define reg_ser_rw_rec_eop___set___lsb 0
256#define reg_ser_rw_rec_eop___set___width 1
257#define reg_ser_rw_rec_eop___set___bit 0
258#define reg_ser_rw_rec_eop_offset 40
259
260/* Register rw_intr_mask, scope ser, type rw */
261#define reg_ser_rw_intr_mask___tr_rdy___lsb 0
262#define reg_ser_rw_intr_mask___tr_rdy___width 1
263#define reg_ser_rw_intr_mask___tr_rdy___bit 0
264#define reg_ser_rw_intr_mask___tr_empty___lsb 1
265#define reg_ser_rw_intr_mask___tr_empty___width 1
266#define reg_ser_rw_intr_mask___tr_empty___bit 1
267#define reg_ser_rw_intr_mask___tr_idle___lsb 2
268#define reg_ser_rw_intr_mask___tr_idle___width 1
269#define reg_ser_rw_intr_mask___tr_idle___bit 2
270#define reg_ser_rw_intr_mask___dav___lsb 3
271#define reg_ser_rw_intr_mask___dav___width 1
272#define reg_ser_rw_intr_mask___dav___bit 3
273#define reg_ser_rw_intr_mask_offset 44
274
275/* Register rw_ack_intr, scope ser, type rw */
276#define reg_ser_rw_ack_intr___tr_rdy___lsb 0
277#define reg_ser_rw_ack_intr___tr_rdy___width 1
278#define reg_ser_rw_ack_intr___tr_rdy___bit 0
279#define reg_ser_rw_ack_intr___tr_empty___lsb 1
280#define reg_ser_rw_ack_intr___tr_empty___width 1
281#define reg_ser_rw_ack_intr___tr_empty___bit 1
282#define reg_ser_rw_ack_intr___tr_idle___lsb 2
283#define reg_ser_rw_ack_intr___tr_idle___width 1
284#define reg_ser_rw_ack_intr___tr_idle___bit 2
285#define reg_ser_rw_ack_intr___dav___lsb 3
286#define reg_ser_rw_ack_intr___dav___width 1
287#define reg_ser_rw_ack_intr___dav___bit 3
288#define reg_ser_rw_ack_intr_offset 48
289
290/* Register r_intr, scope ser, type r */
291#define reg_ser_r_intr___tr_rdy___lsb 0
292#define reg_ser_r_intr___tr_rdy___width 1
293#define reg_ser_r_intr___tr_rdy___bit 0
294#define reg_ser_r_intr___tr_empty___lsb 1
295#define reg_ser_r_intr___tr_empty___width 1
296#define reg_ser_r_intr___tr_empty___bit 1
297#define reg_ser_r_intr___tr_idle___lsb 2
298#define reg_ser_r_intr___tr_idle___width 1
299#define reg_ser_r_intr___tr_idle___bit 2
300#define reg_ser_r_intr___dav___lsb 3
301#define reg_ser_r_intr___dav___width 1
302#define reg_ser_r_intr___dav___bit 3
303#define reg_ser_r_intr_offset 52
304
305/* Register r_masked_intr, scope ser, type r */
306#define reg_ser_r_masked_intr___tr_rdy___lsb 0
307#define reg_ser_r_masked_intr___tr_rdy___width 1
308#define reg_ser_r_masked_intr___tr_rdy___bit 0
309#define reg_ser_r_masked_intr___tr_empty___lsb 1
310#define reg_ser_r_masked_intr___tr_empty___width 1
311#define reg_ser_r_masked_intr___tr_empty___bit 1
312#define reg_ser_r_masked_intr___tr_idle___lsb 2
313#define reg_ser_r_masked_intr___tr_idle___width 1
314#define reg_ser_r_masked_intr___tr_idle___bit 2
315#define reg_ser_r_masked_intr___dav___lsb 3
316#define reg_ser_r_masked_intr___dav___width 1
317#define reg_ser_r_masked_intr___dav___bit 3
318#define reg_ser_r_masked_intr_offset 56
319
320
321/* Constants */
322#define regk_ser_active 0x00000000
323#define regk_ser_bits1 0x00000000
324#define regk_ser_bits2 0x00000001
325#define regk_ser_bits7 0x00000001
326#define regk_ser_bits8 0x00000000
327#define regk_ser_del0_5 0x00000000
328#define regk_ser_del1 0x00000001
329#define regk_ser_del1_5 0x00000002
330#define regk_ser_del2 0x00000003
331#define regk_ser_del2_5 0x00000004
332#define regk_ser_del3 0x00000005
333#define regk_ser_del3_5 0x00000006
334#define regk_ser_del4 0x00000007
335#define regk_ser_even 0x00000000
336#define regk_ser_ext 0x00000001
337#define regk_ser_f100 0x00000007
338#define regk_ser_f29_493 0x00000004
339#define regk_ser_f32 0x00000005
340#define regk_ser_f32_768 0x00000006
341#define regk_ser_ignore 0x00000001
342#define regk_ser_inactive 0x00000001
343#define regk_ser_majority 0x00000001
344#define regk_ser_mark 0x00000002
345#define regk_ser_middle 0x00000000
346#define regk_ser_no 0x00000000
347#define regk_ser_odd 0x00000001
348#define regk_ser_off 0x00000000
349#define regk_ser_rw_intr_mask_default 0x00000000
350#define regk_ser_rw_rec_baud_div_default 0x00000000
351#define regk_ser_rw_rec_ctrl_default 0x00010000
352#define regk_ser_rw_tr_baud_div_default 0x00000000
353#define regk_ser_rw_tr_ctrl_default 0x00008000
354#define regk_ser_rw_tr_dma_en_default 0x00000000
355#define regk_ser_rw_xoff_default 0x00000000
356#define regk_ser_space 0x00000003
357#define regk_ser_stop 0x00000000
358#define regk_ser_yes 0x00000001
359#endif /* __ser_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/sser_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/sser_defs_asm.h
new file mode 100644
index 000000000000..27d4d91b3abd
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/sser_defs_asm.h
@@ -0,0 +1,462 @@
1#ifndef __sser_defs_asm_h
2#define __sser_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/syncser/rtl/sser_regs.r
7 * id: sser_regs.r,v 1.24 2005/02/11 14:27:36 gunnard Exp
8 * last modfied: Mon Apr 11 16:09:48 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/sser_defs_asm.h ../../inst/syncser/rtl/sser_regs.r
11 * id: $Id: sser_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope sser, type rw */
57#define reg_sser_rw_cfg___clk_div___lsb 0
58#define reg_sser_rw_cfg___clk_div___width 16
59#define reg_sser_rw_cfg___base_freq___lsb 16
60#define reg_sser_rw_cfg___base_freq___width 3
61#define reg_sser_rw_cfg___gate_clk___lsb 19
62#define reg_sser_rw_cfg___gate_clk___width 1
63#define reg_sser_rw_cfg___gate_clk___bit 19
64#define reg_sser_rw_cfg___clkgate_ctrl___lsb 20
65#define reg_sser_rw_cfg___clkgate_ctrl___width 1
66#define reg_sser_rw_cfg___clkgate_ctrl___bit 20
67#define reg_sser_rw_cfg___clkgate_in___lsb 21
68#define reg_sser_rw_cfg___clkgate_in___width 1
69#define reg_sser_rw_cfg___clkgate_in___bit 21
70#define reg_sser_rw_cfg___clk_dir___lsb 22
71#define reg_sser_rw_cfg___clk_dir___width 1
72#define reg_sser_rw_cfg___clk_dir___bit 22
73#define reg_sser_rw_cfg___clk_od_mode___lsb 23
74#define reg_sser_rw_cfg___clk_od_mode___width 1
75#define reg_sser_rw_cfg___clk_od_mode___bit 23
76#define reg_sser_rw_cfg___out_clk_pol___lsb 24
77#define reg_sser_rw_cfg___out_clk_pol___width 1
78#define reg_sser_rw_cfg___out_clk_pol___bit 24
79#define reg_sser_rw_cfg___out_clk_src___lsb 25
80#define reg_sser_rw_cfg___out_clk_src___width 2
81#define reg_sser_rw_cfg___clk_in_sel___lsb 27
82#define reg_sser_rw_cfg___clk_in_sel___width 1
83#define reg_sser_rw_cfg___clk_in_sel___bit 27
84#define reg_sser_rw_cfg___hold_pol___lsb 28
85#define reg_sser_rw_cfg___hold_pol___width 1
86#define reg_sser_rw_cfg___hold_pol___bit 28
87#define reg_sser_rw_cfg___prepare___lsb 29
88#define reg_sser_rw_cfg___prepare___width 1
89#define reg_sser_rw_cfg___prepare___bit 29
90#define reg_sser_rw_cfg___en___lsb 30
91#define reg_sser_rw_cfg___en___width 1
92#define reg_sser_rw_cfg___en___bit 30
93#define reg_sser_rw_cfg_offset 0
94
95/* Register rw_frm_cfg, scope sser, type rw */
96#define reg_sser_rw_frm_cfg___wordrate___lsb 0
97#define reg_sser_rw_frm_cfg___wordrate___width 10
98#define reg_sser_rw_frm_cfg___rec_delay___lsb 10
99#define reg_sser_rw_frm_cfg___rec_delay___width 3
100#define reg_sser_rw_frm_cfg___tr_delay___lsb 13
101#define reg_sser_rw_frm_cfg___tr_delay___width 3
102#define reg_sser_rw_frm_cfg___early_wend___lsb 16
103#define reg_sser_rw_frm_cfg___early_wend___width 1
104#define reg_sser_rw_frm_cfg___early_wend___bit 16
105#define reg_sser_rw_frm_cfg___level___lsb 17
106#define reg_sser_rw_frm_cfg___level___width 2
107#define reg_sser_rw_frm_cfg___type___lsb 19
108#define reg_sser_rw_frm_cfg___type___width 1
109#define reg_sser_rw_frm_cfg___type___bit 19
110#define reg_sser_rw_frm_cfg___clk_pol___lsb 20
111#define reg_sser_rw_frm_cfg___clk_pol___width 1
112#define reg_sser_rw_frm_cfg___clk_pol___bit 20
113#define reg_sser_rw_frm_cfg___fr_in_rxclk___lsb 21
114#define reg_sser_rw_frm_cfg___fr_in_rxclk___width 1
115#define reg_sser_rw_frm_cfg___fr_in_rxclk___bit 21
116#define reg_sser_rw_frm_cfg___clk_src___lsb 22
117#define reg_sser_rw_frm_cfg___clk_src___width 1
118#define reg_sser_rw_frm_cfg___clk_src___bit 22
119#define reg_sser_rw_frm_cfg___out_off___lsb 23
120#define reg_sser_rw_frm_cfg___out_off___width 1
121#define reg_sser_rw_frm_cfg___out_off___bit 23
122#define reg_sser_rw_frm_cfg___out_on___lsb 24
123#define reg_sser_rw_frm_cfg___out_on___width 1
124#define reg_sser_rw_frm_cfg___out_on___bit 24
125#define reg_sser_rw_frm_cfg___frame_pin_dir___lsb 25
126#define reg_sser_rw_frm_cfg___frame_pin_dir___width 1
127#define reg_sser_rw_frm_cfg___frame_pin_dir___bit 25
128#define reg_sser_rw_frm_cfg___frame_pin_use___lsb 26
129#define reg_sser_rw_frm_cfg___frame_pin_use___width 2
130#define reg_sser_rw_frm_cfg___status_pin_dir___lsb 28
131#define reg_sser_rw_frm_cfg___status_pin_dir___width 1
132#define reg_sser_rw_frm_cfg___status_pin_dir___bit 28
133#define reg_sser_rw_frm_cfg___status_pin_use___lsb 29
134#define reg_sser_rw_frm_cfg___status_pin_use___width 2
135#define reg_sser_rw_frm_cfg_offset 4
136
137/* Register rw_tr_cfg, scope sser, type rw */
138#define reg_sser_rw_tr_cfg___tr_en___lsb 0
139#define reg_sser_rw_tr_cfg___tr_en___width 1
140#define reg_sser_rw_tr_cfg___tr_en___bit 0
141#define reg_sser_rw_tr_cfg___stop___lsb 1
142#define reg_sser_rw_tr_cfg___stop___width 1
143#define reg_sser_rw_tr_cfg___stop___bit 1
144#define reg_sser_rw_tr_cfg___urun_stop___lsb 2
145#define reg_sser_rw_tr_cfg___urun_stop___width 1
146#define reg_sser_rw_tr_cfg___urun_stop___bit 2
147#define reg_sser_rw_tr_cfg___eop_stop___lsb 3
148#define reg_sser_rw_tr_cfg___eop_stop___width 1
149#define reg_sser_rw_tr_cfg___eop_stop___bit 3
150#define reg_sser_rw_tr_cfg___sample_size___lsb 4
151#define reg_sser_rw_tr_cfg___sample_size___width 6
152#define reg_sser_rw_tr_cfg___sh_dir___lsb 10
153#define reg_sser_rw_tr_cfg___sh_dir___width 1
154#define reg_sser_rw_tr_cfg___sh_dir___bit 10
155#define reg_sser_rw_tr_cfg___clk_pol___lsb 11
156#define reg_sser_rw_tr_cfg___clk_pol___width 1
157#define reg_sser_rw_tr_cfg___clk_pol___bit 11
158#define reg_sser_rw_tr_cfg___clk_src___lsb 12
159#define reg_sser_rw_tr_cfg___clk_src___width 1
160#define reg_sser_rw_tr_cfg___clk_src___bit 12
161#define reg_sser_rw_tr_cfg___use_dma___lsb 13
162#define reg_sser_rw_tr_cfg___use_dma___width 1
163#define reg_sser_rw_tr_cfg___use_dma___bit 13
164#define reg_sser_rw_tr_cfg___mode___lsb 14
165#define reg_sser_rw_tr_cfg___mode___width 2
166#define reg_sser_rw_tr_cfg___frm_src___lsb 16
167#define reg_sser_rw_tr_cfg___frm_src___width 1
168#define reg_sser_rw_tr_cfg___frm_src___bit 16
169#define reg_sser_rw_tr_cfg___use60958___lsb 17
170#define reg_sser_rw_tr_cfg___use60958___width 1
171#define reg_sser_rw_tr_cfg___use60958___bit 17
172#define reg_sser_rw_tr_cfg___iec60958_ckdiv___lsb 18
173#define reg_sser_rw_tr_cfg___iec60958_ckdiv___width 2
174#define reg_sser_rw_tr_cfg___rate_ctrl___lsb 20
175#define reg_sser_rw_tr_cfg___rate_ctrl___width 1
176#define reg_sser_rw_tr_cfg___rate_ctrl___bit 20
177#define reg_sser_rw_tr_cfg___use_md___lsb 21
178#define reg_sser_rw_tr_cfg___use_md___width 1
179#define reg_sser_rw_tr_cfg___use_md___bit 21
180#define reg_sser_rw_tr_cfg___dual_i2s___lsb 22
181#define reg_sser_rw_tr_cfg___dual_i2s___width 1
182#define reg_sser_rw_tr_cfg___dual_i2s___bit 22
183#define reg_sser_rw_tr_cfg___data_pin_use___lsb 23
184#define reg_sser_rw_tr_cfg___data_pin_use___width 2
185#define reg_sser_rw_tr_cfg___od_mode___lsb 25
186#define reg_sser_rw_tr_cfg___od_mode___width 1
187#define reg_sser_rw_tr_cfg___od_mode___bit 25
188#define reg_sser_rw_tr_cfg___bulk_wspace___lsb 26
189#define reg_sser_rw_tr_cfg___bulk_wspace___width 2
190#define reg_sser_rw_tr_cfg_offset 8
191
192/* Register rw_rec_cfg, scope sser, type rw */
193#define reg_sser_rw_rec_cfg___rec_en___lsb 0
194#define reg_sser_rw_rec_cfg___rec_en___width 1
195#define reg_sser_rw_rec_cfg___rec_en___bit 0
196#define reg_sser_rw_rec_cfg___force_eop___lsb 1
197#define reg_sser_rw_rec_cfg___force_eop___width 1
198#define reg_sser_rw_rec_cfg___force_eop___bit 1
199#define reg_sser_rw_rec_cfg___stop___lsb 2
200#define reg_sser_rw_rec_cfg___stop___width 1
201#define reg_sser_rw_rec_cfg___stop___bit 2
202#define reg_sser_rw_rec_cfg___orun_stop___lsb 3
203#define reg_sser_rw_rec_cfg___orun_stop___width 1
204#define reg_sser_rw_rec_cfg___orun_stop___bit 3
205#define reg_sser_rw_rec_cfg___eop_stop___lsb 4
206#define reg_sser_rw_rec_cfg___eop_stop___width 1
207#define reg_sser_rw_rec_cfg___eop_stop___bit 4
208#define reg_sser_rw_rec_cfg___sample_size___lsb 5
209#define reg_sser_rw_rec_cfg___sample_size___width 6
210#define reg_sser_rw_rec_cfg___sh_dir___lsb 11
211#define reg_sser_rw_rec_cfg___sh_dir___width 1
212#define reg_sser_rw_rec_cfg___sh_dir___bit 11
213#define reg_sser_rw_rec_cfg___clk_pol___lsb 12
214#define reg_sser_rw_rec_cfg___clk_pol___width 1
215#define reg_sser_rw_rec_cfg___clk_pol___bit 12
216#define reg_sser_rw_rec_cfg___clk_src___lsb 13
217#define reg_sser_rw_rec_cfg___clk_src___width 1
218#define reg_sser_rw_rec_cfg___clk_src___bit 13
219#define reg_sser_rw_rec_cfg___use_dma___lsb 14
220#define reg_sser_rw_rec_cfg___use_dma___width 1
221#define reg_sser_rw_rec_cfg___use_dma___bit 14
222#define reg_sser_rw_rec_cfg___mode___lsb 15
223#define reg_sser_rw_rec_cfg___mode___width 2
224#define reg_sser_rw_rec_cfg___frm_src___lsb 17
225#define reg_sser_rw_rec_cfg___frm_src___width 2
226#define reg_sser_rw_rec_cfg___use60958___lsb 19
227#define reg_sser_rw_rec_cfg___use60958___width 1
228#define reg_sser_rw_rec_cfg___use60958___bit 19
229#define reg_sser_rw_rec_cfg___iec60958_ui_len___lsb 20
230#define reg_sser_rw_rec_cfg___iec60958_ui_len___width 5
231#define reg_sser_rw_rec_cfg___slave2_en___lsb 25
232#define reg_sser_rw_rec_cfg___slave2_en___width 1
233#define reg_sser_rw_rec_cfg___slave2_en___bit 25
234#define reg_sser_rw_rec_cfg___slave3_en___lsb 26
235#define reg_sser_rw_rec_cfg___slave3_en___width 1
236#define reg_sser_rw_rec_cfg___slave3_en___bit 26
237#define reg_sser_rw_rec_cfg___fifo_thr___lsb 27
238#define reg_sser_rw_rec_cfg___fifo_thr___width 2
239#define reg_sser_rw_rec_cfg_offset 12
240
241/* Register rw_tr_data, scope sser, type rw */
242#define reg_sser_rw_tr_data___data___lsb 0
243#define reg_sser_rw_tr_data___data___width 16
244#define reg_sser_rw_tr_data___md___lsb 16
245#define reg_sser_rw_tr_data___md___width 1
246#define reg_sser_rw_tr_data___md___bit 16
247#define reg_sser_rw_tr_data_offset 16
248
249/* Register r_rec_data, scope sser, type r */
250#define reg_sser_r_rec_data___data___lsb 0
251#define reg_sser_r_rec_data___data___width 16
252#define reg_sser_r_rec_data___md___lsb 16
253#define reg_sser_r_rec_data___md___width 1
254#define reg_sser_r_rec_data___md___bit 16
255#define reg_sser_r_rec_data___ext_clk___lsb 17
256#define reg_sser_r_rec_data___ext_clk___width 1
257#define reg_sser_r_rec_data___ext_clk___bit 17
258#define reg_sser_r_rec_data___status_in___lsb 18
259#define reg_sser_r_rec_data___status_in___width 1
260#define reg_sser_r_rec_data___status_in___bit 18
261#define reg_sser_r_rec_data___frame_in___lsb 19
262#define reg_sser_r_rec_data___frame_in___width 1
263#define reg_sser_r_rec_data___frame_in___bit 19
264#define reg_sser_r_rec_data___din___lsb 20
265#define reg_sser_r_rec_data___din___width 1
266#define reg_sser_r_rec_data___din___bit 20
267#define reg_sser_r_rec_data___data_in___lsb 21
268#define reg_sser_r_rec_data___data_in___width 1
269#define reg_sser_r_rec_data___data_in___bit 21
270#define reg_sser_r_rec_data___clk_in___lsb 22
271#define reg_sser_r_rec_data___clk_in___width 1
272#define reg_sser_r_rec_data___clk_in___bit 22
273#define reg_sser_r_rec_data_offset 20
274
275/* Register rw_extra, scope sser, type rw */
276#define reg_sser_rw_extra___clkoff_cycles___lsb 0
277#define reg_sser_rw_extra___clkoff_cycles___width 20
278#define reg_sser_rw_extra___clkoff_en___lsb 20
279#define reg_sser_rw_extra___clkoff_en___width 1
280#define reg_sser_rw_extra___clkoff_en___bit 20
281#define reg_sser_rw_extra___clkon_en___lsb 21
282#define reg_sser_rw_extra___clkon_en___width 1
283#define reg_sser_rw_extra___clkon_en___bit 21
284#define reg_sser_rw_extra___dout_delay___lsb 22
285#define reg_sser_rw_extra___dout_delay___width 5
286#define reg_sser_rw_extra_offset 24
287
288/* Register rw_intr_mask, scope sser, type rw */
289#define reg_sser_rw_intr_mask___trdy___lsb 0
290#define reg_sser_rw_intr_mask___trdy___width 1
291#define reg_sser_rw_intr_mask___trdy___bit 0
292#define reg_sser_rw_intr_mask___rdav___lsb 1
293#define reg_sser_rw_intr_mask___rdav___width 1
294#define reg_sser_rw_intr_mask___rdav___bit 1
295#define reg_sser_rw_intr_mask___tidle___lsb 2
296#define reg_sser_rw_intr_mask___tidle___width 1
297#define reg_sser_rw_intr_mask___tidle___bit 2
298#define reg_sser_rw_intr_mask___rstop___lsb 3
299#define reg_sser_rw_intr_mask___rstop___width 1
300#define reg_sser_rw_intr_mask___rstop___bit 3
301#define reg_sser_rw_intr_mask___urun___lsb 4
302#define reg_sser_rw_intr_mask___urun___width 1
303#define reg_sser_rw_intr_mask___urun___bit 4
304#define reg_sser_rw_intr_mask___orun___lsb 5
305#define reg_sser_rw_intr_mask___orun___width 1
306#define reg_sser_rw_intr_mask___orun___bit 5
307#define reg_sser_rw_intr_mask___md_rec___lsb 6
308#define reg_sser_rw_intr_mask___md_rec___width 1
309#define reg_sser_rw_intr_mask___md_rec___bit 6
310#define reg_sser_rw_intr_mask___md_sent___lsb 7
311#define reg_sser_rw_intr_mask___md_sent___width 1
312#define reg_sser_rw_intr_mask___md_sent___bit 7
313#define reg_sser_rw_intr_mask___r958err___lsb 8
314#define reg_sser_rw_intr_mask___r958err___width 1
315#define reg_sser_rw_intr_mask___r958err___bit 8
316#define reg_sser_rw_intr_mask_offset 28
317
318/* Register rw_ack_intr, scope sser, type rw */
319#define reg_sser_rw_ack_intr___trdy___lsb 0
320#define reg_sser_rw_ack_intr___trdy___width 1
321#define reg_sser_rw_ack_intr___trdy___bit 0
322#define reg_sser_rw_ack_intr___rdav___lsb 1
323#define reg_sser_rw_ack_intr___rdav___width 1
324#define reg_sser_rw_ack_intr___rdav___bit 1
325#define reg_sser_rw_ack_intr___tidle___lsb 2
326#define reg_sser_rw_ack_intr___tidle___width 1
327#define reg_sser_rw_ack_intr___tidle___bit 2
328#define reg_sser_rw_ack_intr___rstop___lsb 3
329#define reg_sser_rw_ack_intr___rstop___width 1
330#define reg_sser_rw_ack_intr___rstop___bit 3
331#define reg_sser_rw_ack_intr___urun___lsb 4
332#define reg_sser_rw_ack_intr___urun___width 1
333#define reg_sser_rw_ack_intr___urun___bit 4
334#define reg_sser_rw_ack_intr___orun___lsb 5
335#define reg_sser_rw_ack_intr___orun___width 1
336#define reg_sser_rw_ack_intr___orun___bit 5
337#define reg_sser_rw_ack_intr___md_rec___lsb 6
338#define reg_sser_rw_ack_intr___md_rec___width 1
339#define reg_sser_rw_ack_intr___md_rec___bit 6
340#define reg_sser_rw_ack_intr___md_sent___lsb 7
341#define reg_sser_rw_ack_intr___md_sent___width 1
342#define reg_sser_rw_ack_intr___md_sent___bit 7
343#define reg_sser_rw_ack_intr___r958err___lsb 8
344#define reg_sser_rw_ack_intr___r958err___width 1
345#define reg_sser_rw_ack_intr___r958err___bit 8
346#define reg_sser_rw_ack_intr_offset 32
347
348/* Register r_intr, scope sser, type r */
349#define reg_sser_r_intr___trdy___lsb 0
350#define reg_sser_r_intr___trdy___width 1
351#define reg_sser_r_intr___trdy___bit 0
352#define reg_sser_r_intr___rdav___lsb 1
353#define reg_sser_r_intr___rdav___width 1
354#define reg_sser_r_intr___rdav___bit 1
355#define reg_sser_r_intr___tidle___lsb 2
356#define reg_sser_r_intr___tidle___width 1
357#define reg_sser_r_intr___tidle___bit 2
358#define reg_sser_r_intr___rstop___lsb 3
359#define reg_sser_r_intr___rstop___width 1
360#define reg_sser_r_intr___rstop___bit 3
361#define reg_sser_r_intr___urun___lsb 4
362#define reg_sser_r_intr___urun___width 1
363#define reg_sser_r_intr___urun___bit 4
364#define reg_sser_r_intr___orun___lsb 5
365#define reg_sser_r_intr___orun___width 1
366#define reg_sser_r_intr___orun___bit 5
367#define reg_sser_r_intr___md_rec___lsb 6
368#define reg_sser_r_intr___md_rec___width 1
369#define reg_sser_r_intr___md_rec___bit 6
370#define reg_sser_r_intr___md_sent___lsb 7
371#define reg_sser_r_intr___md_sent___width 1
372#define reg_sser_r_intr___md_sent___bit 7
373#define reg_sser_r_intr___r958err___lsb 8
374#define reg_sser_r_intr___r958err___width 1
375#define reg_sser_r_intr___r958err___bit 8
376#define reg_sser_r_intr_offset 36
377
378/* Register r_masked_intr, scope sser, type r */
379#define reg_sser_r_masked_intr___trdy___lsb 0
380#define reg_sser_r_masked_intr___trdy___width 1
381#define reg_sser_r_masked_intr___trdy___bit 0
382#define reg_sser_r_masked_intr___rdav___lsb 1
383#define reg_sser_r_masked_intr___rdav___width 1
384#define reg_sser_r_masked_intr___rdav___bit 1
385#define reg_sser_r_masked_intr___tidle___lsb 2
386#define reg_sser_r_masked_intr___tidle___width 1
387#define reg_sser_r_masked_intr___tidle___bit 2
388#define reg_sser_r_masked_intr___rstop___lsb 3
389#define reg_sser_r_masked_intr___rstop___width 1
390#define reg_sser_r_masked_intr___rstop___bit 3
391#define reg_sser_r_masked_intr___urun___lsb 4
392#define reg_sser_r_masked_intr___urun___width 1
393#define reg_sser_r_masked_intr___urun___bit 4
394#define reg_sser_r_masked_intr___orun___lsb 5
395#define reg_sser_r_masked_intr___orun___width 1
396#define reg_sser_r_masked_intr___orun___bit 5
397#define reg_sser_r_masked_intr___md_rec___lsb 6
398#define reg_sser_r_masked_intr___md_rec___width 1
399#define reg_sser_r_masked_intr___md_rec___bit 6
400#define reg_sser_r_masked_intr___md_sent___lsb 7
401#define reg_sser_r_masked_intr___md_sent___width 1
402#define reg_sser_r_masked_intr___md_sent___bit 7
403#define reg_sser_r_masked_intr___r958err___lsb 8
404#define reg_sser_r_masked_intr___r958err___width 1
405#define reg_sser_r_masked_intr___r958err___bit 8
406#define reg_sser_r_masked_intr_offset 40
407
408
409/* Constants */
410#define regk_sser_both 0x00000002
411#define regk_sser_bulk 0x00000001
412#define regk_sser_clk100 0x00000000
413#define regk_sser_clk_in 0x00000000
414#define regk_sser_const0 0x00000003
415#define regk_sser_dout 0x00000002
416#define regk_sser_edge 0x00000000
417#define regk_sser_ext 0x00000001
418#define regk_sser_ext_clk 0x00000001
419#define regk_sser_f100 0x00000000
420#define regk_sser_f29_493 0x00000004
421#define regk_sser_f32 0x00000005
422#define regk_sser_f32_768 0x00000006
423#define regk_sser_frm 0x00000003
424#define regk_sser_gio0 0x00000000
425#define regk_sser_gio1 0x00000001
426#define regk_sser_hispeed 0x00000001
427#define regk_sser_hold 0x00000002
428#define regk_sser_in 0x00000000
429#define regk_sser_inf 0x00000003
430#define regk_sser_intern 0x00000000
431#define regk_sser_intern_clk 0x00000001
432#define regk_sser_intern_tb 0x00000000
433#define regk_sser_iso 0x00000000
434#define regk_sser_level 0x00000001
435#define regk_sser_lospeed 0x00000000
436#define regk_sser_lsbfirst 0x00000000
437#define regk_sser_msbfirst 0x00000001
438#define regk_sser_neg 0x00000001
439#define regk_sser_neg_lo 0x00000000
440#define regk_sser_no 0x00000000
441#define regk_sser_no_clk 0x00000007
442#define regk_sser_nojitter 0x00000002
443#define regk_sser_out 0x00000001
444#define regk_sser_pos 0x00000000
445#define regk_sser_pos_hi 0x00000001
446#define regk_sser_rec 0x00000000
447#define regk_sser_rw_cfg_default 0x00000000
448#define regk_sser_rw_extra_default 0x00000000
449#define regk_sser_rw_frm_cfg_default 0x00000000
450#define regk_sser_rw_intr_mask_default 0x00000000
451#define regk_sser_rw_rec_cfg_default 0x00000000
452#define regk_sser_rw_tr_cfg_default 0x01800000
453#define regk_sser_rw_tr_data_default 0x00000000
454#define regk_sser_thr16 0x00000001
455#define regk_sser_thr32 0x00000002
456#define regk_sser_thr8 0x00000000
457#define regk_sser_tr 0x00000001
458#define regk_sser_ts_out 0x00000003
459#define regk_sser_tx_bulk 0x00000002
460#define regk_sser_wiresave 0x00000002
461#define regk_sser_yes 0x00000001
462#endif /* __sser_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/strcop_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/strcop_defs_asm.h
new file mode 100644
index 000000000000..55083e6aec93
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/strcop_defs_asm.h
@@ -0,0 +1,84 @@
1#ifndef __strcop_defs_asm_h
2#define __strcop_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/strcop/rtl/strcop_regs.r
7 * id: strcop_regs.r,v 1.5 2003/10/15 12:09:45 kriskn Exp
8 * last modfied: Mon Apr 11 16:09:38 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/strcop_defs_asm.h ../../inst/strcop/rtl/strcop_regs.r
11 * id: $Id: strcop_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope strcop, type rw */
57#define reg_strcop_rw_cfg___td3___lsb 0
58#define reg_strcop_rw_cfg___td3___width 1
59#define reg_strcop_rw_cfg___td3___bit 0
60#define reg_strcop_rw_cfg___td2___lsb 1
61#define reg_strcop_rw_cfg___td2___width 1
62#define reg_strcop_rw_cfg___td2___bit 1
63#define reg_strcop_rw_cfg___td1___lsb 2
64#define reg_strcop_rw_cfg___td1___width 1
65#define reg_strcop_rw_cfg___td1___bit 2
66#define reg_strcop_rw_cfg___ipend___lsb 3
67#define reg_strcop_rw_cfg___ipend___width 1
68#define reg_strcop_rw_cfg___ipend___bit 3
69#define reg_strcop_rw_cfg___ignore_sync___lsb 4
70#define reg_strcop_rw_cfg___ignore_sync___width 1
71#define reg_strcop_rw_cfg___ignore_sync___bit 4
72#define reg_strcop_rw_cfg___en___lsb 5
73#define reg_strcop_rw_cfg___en___width 1
74#define reg_strcop_rw_cfg___en___bit 5
75#define reg_strcop_rw_cfg_offset 0
76
77
78/* Constants */
79#define regk_strcop_big 0x00000001
80#define regk_strcop_d 0x00000001
81#define regk_strcop_e 0x00000000
82#define regk_strcop_little 0x00000000
83#define regk_strcop_rw_cfg_default 0x00000002
84#endif /* __strcop_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/strmux_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/strmux_defs_asm.h
new file mode 100644
index 000000000000..69b299920f71
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/strmux_defs_asm.h
@@ -0,0 +1,100 @@
1#ifndef __strmux_defs_asm_h
2#define __strmux_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/strmux/rtl/guinness/strmux_regs.r
7 * id: strmux_regs.r,v 1.10 2005/02/10 10:10:46 perz Exp
8 * last modfied: Mon Apr 11 16:09:43 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/strmux_defs_asm.h ../../inst/strmux/rtl/guinness/strmux_regs.r
11 * id: $Id: strmux_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope strmux, type rw */
57#define reg_strmux_rw_cfg___dma0___lsb 0
58#define reg_strmux_rw_cfg___dma0___width 3
59#define reg_strmux_rw_cfg___dma1___lsb 3
60#define reg_strmux_rw_cfg___dma1___width 3
61#define reg_strmux_rw_cfg___dma2___lsb 6
62#define reg_strmux_rw_cfg___dma2___width 3
63#define reg_strmux_rw_cfg___dma3___lsb 9
64#define reg_strmux_rw_cfg___dma3___width 3
65#define reg_strmux_rw_cfg___dma4___lsb 12
66#define reg_strmux_rw_cfg___dma4___width 3
67#define reg_strmux_rw_cfg___dma5___lsb 15
68#define reg_strmux_rw_cfg___dma5___width 3
69#define reg_strmux_rw_cfg___dma6___lsb 18
70#define reg_strmux_rw_cfg___dma6___width 3
71#define reg_strmux_rw_cfg___dma7___lsb 21
72#define reg_strmux_rw_cfg___dma7___width 3
73#define reg_strmux_rw_cfg___dma8___lsb 24
74#define reg_strmux_rw_cfg___dma8___width 3
75#define reg_strmux_rw_cfg___dma9___lsb 27
76#define reg_strmux_rw_cfg___dma9___width 3
77#define reg_strmux_rw_cfg_offset 0
78
79
80/* Constants */
81#define regk_strmux_ata 0x00000003
82#define regk_strmux_eth0 0x00000001
83#define regk_strmux_eth1 0x00000004
84#define regk_strmux_ext0 0x00000001
85#define regk_strmux_ext1 0x00000001
86#define regk_strmux_ext2 0x00000001
87#define regk_strmux_ext3 0x00000001
88#define regk_strmux_iop0 0x00000002
89#define regk_strmux_iop1 0x00000001
90#define regk_strmux_off 0x00000000
91#define regk_strmux_p21 0x00000004
92#define regk_strmux_rw_cfg_default 0x00000000
93#define regk_strmux_ser0 0x00000002
94#define regk_strmux_ser1 0x00000002
95#define regk_strmux_ser2 0x00000004
96#define regk_strmux_ser3 0x00000003
97#define regk_strmux_sser0 0x00000003
98#define regk_strmux_sser1 0x00000003
99#define regk_strmux_strcop 0x00000002
100#endif /* __strmux_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/asm/timer_defs_asm.h b/include/asm-cris/arch-v32/hwregs/asm/timer_defs_asm.h
new file mode 100644
index 000000000000..43146021fc16
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/asm/timer_defs_asm.h
@@ -0,0 +1,229 @@
1#ifndef __timer_defs_asm_h
2#define __timer_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/timer/rtl/timer_regs.r
7 * id: timer_regs.r,v 1.7 2003/03/11 11:16:59 perz Exp
8 * last modfied: Mon Apr 11 16:09:53 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/timer_defs_asm.h ../../inst/timer/rtl/timer_regs.r
11 * id: $Id: timer_defs_asm.h,v 1.1 2005/04/24 18:31:04 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_tmr0_div, scope timer, type rw */
57#define reg_timer_rw_tmr0_div_offset 0
58
59/* Register r_tmr0_data, scope timer, type r */
60#define reg_timer_r_tmr0_data_offset 4
61
62/* Register rw_tmr0_ctrl, scope timer, type rw */
63#define reg_timer_rw_tmr0_ctrl___op___lsb 0
64#define reg_timer_rw_tmr0_ctrl___op___width 2
65#define reg_timer_rw_tmr0_ctrl___freq___lsb 2
66#define reg_timer_rw_tmr0_ctrl___freq___width 3
67#define reg_timer_rw_tmr0_ctrl_offset 8
68
69/* Register rw_tmr1_div, scope timer, type rw */
70#define reg_timer_rw_tmr1_div_offset 16
71
72/* Register r_tmr1_data, scope timer, type r */
73#define reg_timer_r_tmr1_data_offset 20
74
75/* Register rw_tmr1_ctrl, scope timer, type rw */
76#define reg_timer_rw_tmr1_ctrl___op___lsb 0
77#define reg_timer_rw_tmr1_ctrl___op___width 2
78#define reg_timer_rw_tmr1_ctrl___freq___lsb 2
79#define reg_timer_rw_tmr1_ctrl___freq___width 3
80#define reg_timer_rw_tmr1_ctrl_offset 24
81
82/* Register rs_cnt_data, scope timer, type rs */
83#define reg_timer_rs_cnt_data___tmr___lsb 0
84#define reg_timer_rs_cnt_data___tmr___width 24
85#define reg_timer_rs_cnt_data___cnt___lsb 24
86#define reg_timer_rs_cnt_data___cnt___width 8
87#define reg_timer_rs_cnt_data_offset 32
88
89/* Register r_cnt_data, scope timer, type r */
90#define reg_timer_r_cnt_data___tmr___lsb 0
91#define reg_timer_r_cnt_data___tmr___width 24
92#define reg_timer_r_cnt_data___cnt___lsb 24
93#define reg_timer_r_cnt_data___cnt___width 8
94#define reg_timer_r_cnt_data_offset 36
95
96/* Register rw_cnt_cfg, scope timer, type rw */
97#define reg_timer_rw_cnt_cfg___clk___lsb 0
98#define reg_timer_rw_cnt_cfg___clk___width 2
99#define reg_timer_rw_cnt_cfg_offset 40
100
101/* Register rw_trig, scope timer, type rw */
102#define reg_timer_rw_trig_offset 48
103
104/* Register rw_trig_cfg, scope timer, type rw */
105#define reg_timer_rw_trig_cfg___tmr___lsb 0
106#define reg_timer_rw_trig_cfg___tmr___width 2
107#define reg_timer_rw_trig_cfg_offset 52
108
109/* Register r_time, scope timer, type r */
110#define reg_timer_r_time_offset 56
111
112/* Register rw_out, scope timer, type rw */
113#define reg_timer_rw_out___tmr___lsb 0
114#define reg_timer_rw_out___tmr___width 2
115#define reg_timer_rw_out_offset 60
116
117/* Register rw_wd_ctrl, scope timer, type rw */
118#define reg_timer_rw_wd_ctrl___cnt___lsb 0
119#define reg_timer_rw_wd_ctrl___cnt___width 8
120#define reg_timer_rw_wd_ctrl___cmd___lsb 8
121#define reg_timer_rw_wd_ctrl___cmd___width 1
122#define reg_timer_rw_wd_ctrl___cmd___bit 8
123#define reg_timer_rw_wd_ctrl___key___lsb 9
124#define reg_timer_rw_wd_ctrl___key___width 7
125#define reg_timer_rw_wd_ctrl_offset 64
126
127/* Register r_wd_stat, scope timer, type r */
128#define reg_timer_r_wd_stat___cnt___lsb 0
129#define reg_timer_r_wd_stat___cnt___width 8
130#define reg_timer_r_wd_stat___cmd___lsb 8
131#define reg_timer_r_wd_stat___cmd___width 1
132#define reg_timer_r_wd_stat___cmd___bit 8
133#define reg_timer_r_wd_stat_offset 68
134
135/* Register rw_intr_mask, scope timer, type rw */
136#define reg_timer_rw_intr_mask___tmr0___lsb 0
137#define reg_timer_rw_intr_mask___tmr0___width 1
138#define reg_timer_rw_intr_mask___tmr0___bit 0
139#define reg_timer_rw_intr_mask___tmr1___lsb 1
140#define reg_timer_rw_intr_mask___tmr1___width 1
141#define reg_timer_rw_intr_mask___tmr1___bit 1
142#define reg_timer_rw_intr_mask___cnt___lsb 2
143#define reg_timer_rw_intr_mask___cnt___width 1
144#define reg_timer_rw_intr_mask___cnt___bit 2
145#define reg_timer_rw_intr_mask___trig___lsb 3
146#define reg_timer_rw_intr_mask___trig___width 1
147#define reg_timer_rw_intr_mask___trig___bit 3
148#define reg_timer_rw_intr_mask_offset 72
149
150/* Register rw_ack_intr, scope timer, type rw */
151#define reg_timer_rw_ack_intr___tmr0___lsb 0
152#define reg_timer_rw_ack_intr___tmr0___width 1
153#define reg_timer_rw_ack_intr___tmr0___bit 0
154#define reg_timer_rw_ack_intr___tmr1___lsb 1
155#define reg_timer_rw_ack_intr___tmr1___width 1
156#define reg_timer_rw_ack_intr___tmr1___bit 1
157#define reg_timer_rw_ack_intr___cnt___lsb 2
158#define reg_timer_rw_ack_intr___cnt___width 1
159#define reg_timer_rw_ack_intr___cnt___bit 2
160#define reg_timer_rw_ack_intr___trig___lsb 3
161#define reg_timer_rw_ack_intr___trig___width 1
162#define reg_timer_rw_ack_intr___trig___bit 3
163#define reg_timer_rw_ack_intr_offset 76
164
165/* Register r_intr, scope timer, type r */
166#define reg_timer_r_intr___tmr0___lsb 0
167#define reg_timer_r_intr___tmr0___width 1
168#define reg_timer_r_intr___tmr0___bit 0
169#define reg_timer_r_intr___tmr1___lsb 1
170#define reg_timer_r_intr___tmr1___width 1
171#define reg_timer_r_intr___tmr1___bit 1
172#define reg_timer_r_intr___cnt___lsb 2
173#define reg_timer_r_intr___cnt___width 1
174#define reg_timer_r_intr___cnt___bit 2
175#define reg_timer_r_intr___trig___lsb 3
176#define reg_timer_r_intr___trig___width 1
177#define reg_timer_r_intr___trig___bit 3
178#define reg_timer_r_intr_offset 80
179
180/* Register r_masked_intr, scope timer, type r */
181#define reg_timer_r_masked_intr___tmr0___lsb 0
182#define reg_timer_r_masked_intr___tmr0___width 1
183#define reg_timer_r_masked_intr___tmr0___bit 0
184#define reg_timer_r_masked_intr___tmr1___lsb 1
185#define reg_timer_r_masked_intr___tmr1___width 1
186#define reg_timer_r_masked_intr___tmr1___bit 1
187#define reg_timer_r_masked_intr___cnt___lsb 2
188#define reg_timer_r_masked_intr___cnt___width 1
189#define reg_timer_r_masked_intr___cnt___bit 2
190#define reg_timer_r_masked_intr___trig___lsb 3
191#define reg_timer_r_masked_intr___trig___width 1
192#define reg_timer_r_masked_intr___trig___bit 3
193#define reg_timer_r_masked_intr_offset 84
194
195/* Register rw_test, scope timer, type rw */
196#define reg_timer_rw_test___dis___lsb 0
197#define reg_timer_rw_test___dis___width 1
198#define reg_timer_rw_test___dis___bit 0
199#define reg_timer_rw_test___en___lsb 1
200#define reg_timer_rw_test___en___width 1
201#define reg_timer_rw_test___en___bit 1
202#define reg_timer_rw_test_offset 88
203
204
205/* Constants */
206#define regk_timer_ext 0x00000001
207#define regk_timer_f100 0x00000007
208#define regk_timer_f29_493 0x00000004
209#define regk_timer_f32 0x00000005
210#define regk_timer_f32_768 0x00000006
211#define regk_timer_hold 0x00000001
212#define regk_timer_ld 0x00000000
213#define regk_timer_no 0x00000000
214#define regk_timer_off 0x00000000
215#define regk_timer_run 0x00000002
216#define regk_timer_rw_cnt_cfg_default 0x00000000
217#define regk_timer_rw_intr_mask_default 0x00000000
218#define regk_timer_rw_out_default 0x00000000
219#define regk_timer_rw_test_default 0x00000000
220#define regk_timer_rw_tmr0_ctrl_default 0x00000000
221#define regk_timer_rw_tmr1_ctrl_default 0x00000000
222#define regk_timer_rw_trig_cfg_default 0x00000000
223#define regk_timer_start 0x00000001
224#define regk_timer_stop 0x00000000
225#define regk_timer_time 0x00000001
226#define regk_timer_tmr0 0x00000002
227#define regk_timer_tmr1 0x00000003
228#define regk_timer_yes 0x00000001
229#endif /* __timer_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/ata_defs.h b/include/asm-cris/arch-v32/hwregs/ata_defs.h
new file mode 100644
index 000000000000..43b6643ff0d3
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/ata_defs.h
@@ -0,0 +1,222 @@
1#ifndef __ata_defs_h
2#define __ata_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/ata/rtl/ata_regs.r
7 * id: ata_regs.r,v 1.11 2005/02/09 08:27:36 kriskn Exp
8 * last modfied: Mon Apr 11 16:06:25 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile ata_defs.h ../../inst/ata/rtl/ata_regs.r
11 * id: $Id: ata_defs.h,v 1.7 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope ata */
86
87/* Register rw_ctrl0, scope ata, type rw */
88typedef struct {
89 unsigned int pio_hold : 6;
90 unsigned int pio_strb : 6;
91 unsigned int pio_setup : 6;
92 unsigned int dma_hold : 6;
93 unsigned int dma_strb : 6;
94 unsigned int rst : 1;
95 unsigned int en : 1;
96} reg_ata_rw_ctrl0;
97#define REG_RD_ADDR_ata_rw_ctrl0 12
98#define REG_WR_ADDR_ata_rw_ctrl0 12
99
100/* Register rw_ctrl1, scope ata, type rw */
101typedef struct {
102 unsigned int udma_tcyc : 4;
103 unsigned int udma_tdvs : 4;
104 unsigned int dummy1 : 24;
105} reg_ata_rw_ctrl1;
106#define REG_RD_ADDR_ata_rw_ctrl1 16
107#define REG_WR_ADDR_ata_rw_ctrl1 16
108
109/* Register rw_ctrl2, scope ata, type rw */
110typedef struct {
111 unsigned int data : 16;
112 unsigned int dummy1 : 3;
113 unsigned int dma_size : 1;
114 unsigned int multi : 1;
115 unsigned int hsh : 2;
116 unsigned int trf_mode : 1;
117 unsigned int rw : 1;
118 unsigned int addr : 3;
119 unsigned int cs0 : 1;
120 unsigned int cs1 : 1;
121 unsigned int sel : 2;
122} reg_ata_rw_ctrl2;
123#define REG_RD_ADDR_ata_rw_ctrl2 0
124#define REG_WR_ADDR_ata_rw_ctrl2 0
125
126/* Register rs_stat_data, scope ata, type rs */
127typedef struct {
128 unsigned int data : 16;
129 unsigned int dav : 1;
130 unsigned int busy : 1;
131 unsigned int dummy1 : 14;
132} reg_ata_rs_stat_data;
133#define REG_RD_ADDR_ata_rs_stat_data 4
134
135/* Register r_stat_data, scope ata, type r */
136typedef struct {
137 unsigned int data : 16;
138 unsigned int dav : 1;
139 unsigned int busy : 1;
140 unsigned int dummy1 : 14;
141} reg_ata_r_stat_data;
142#define REG_RD_ADDR_ata_r_stat_data 8
143
144/* Register rw_trf_cnt, scope ata, type rw */
145typedef struct {
146 unsigned int cnt : 17;
147 unsigned int dummy1 : 15;
148} reg_ata_rw_trf_cnt;
149#define REG_RD_ADDR_ata_rw_trf_cnt 20
150#define REG_WR_ADDR_ata_rw_trf_cnt 20
151
152/* Register r_stat_misc, scope ata, type r */
153typedef struct {
154 unsigned int crc : 16;
155 unsigned int dummy1 : 16;
156} reg_ata_r_stat_misc;
157#define REG_RD_ADDR_ata_r_stat_misc 24
158
159/* Register rw_intr_mask, scope ata, type rw */
160typedef struct {
161 unsigned int bus0 : 1;
162 unsigned int bus1 : 1;
163 unsigned int bus2 : 1;
164 unsigned int bus3 : 1;
165 unsigned int dummy1 : 28;
166} reg_ata_rw_intr_mask;
167#define REG_RD_ADDR_ata_rw_intr_mask 28
168#define REG_WR_ADDR_ata_rw_intr_mask 28
169
170/* Register rw_ack_intr, scope ata, type rw */
171typedef struct {
172 unsigned int bus0 : 1;
173 unsigned int bus1 : 1;
174 unsigned int bus2 : 1;
175 unsigned int bus3 : 1;
176 unsigned int dummy1 : 28;
177} reg_ata_rw_ack_intr;
178#define REG_RD_ADDR_ata_rw_ack_intr 32
179#define REG_WR_ADDR_ata_rw_ack_intr 32
180
181/* Register r_intr, scope ata, type r */
182typedef struct {
183 unsigned int bus0 : 1;
184 unsigned int bus1 : 1;
185 unsigned int bus2 : 1;
186 unsigned int bus3 : 1;
187 unsigned int dummy1 : 28;
188} reg_ata_r_intr;
189#define REG_RD_ADDR_ata_r_intr 36
190
191/* Register r_masked_intr, scope ata, type r */
192typedef struct {
193 unsigned int bus0 : 1;
194 unsigned int bus1 : 1;
195 unsigned int bus2 : 1;
196 unsigned int bus3 : 1;
197 unsigned int dummy1 : 28;
198} reg_ata_r_masked_intr;
199#define REG_RD_ADDR_ata_r_masked_intr 40
200
201
202/* Constants */
203enum {
204 regk_ata_active = 0x00000001,
205 regk_ata_byte = 0x00000001,
206 regk_ata_data = 0x00000001,
207 regk_ata_dma = 0x00000001,
208 regk_ata_inactive = 0x00000000,
209 regk_ata_no = 0x00000000,
210 regk_ata_nodata = 0x00000000,
211 regk_ata_pio = 0x00000000,
212 regk_ata_rd = 0x00000001,
213 regk_ata_reg = 0x00000000,
214 regk_ata_rw_ctrl0_default = 0x00000000,
215 regk_ata_rw_ctrl2_default = 0x00000000,
216 regk_ata_rw_intr_mask_default = 0x00000000,
217 regk_ata_udma = 0x00000002,
218 regk_ata_word = 0x00000000,
219 regk_ata_wr = 0x00000000,
220 regk_ata_yes = 0x00000001
221};
222#endif /* __ata_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/bif_core_defs.h b/include/asm-cris/arch-v32/hwregs/bif_core_defs.h
new file mode 100644
index 000000000000..a56608b50359
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/bif_core_defs.h
@@ -0,0 +1,284 @@
1#ifndef __bif_core_defs_h
2#define __bif_core_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_core_regs.r
7 * id: bif_core_regs.r,v 1.17 2005/02/04 13:28:22 np Exp
8 * last modfied: Mon Apr 11 16:06:33 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile bif_core_defs.h ../../inst/bif/rtl/bif_core_regs.r
11 * id: $Id: bif_core_defs.h,v 1.3 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope bif_core */
86
87/* Register rw_grp1_cfg, scope bif_core, type rw */
88typedef struct {
89 unsigned int lw : 6;
90 unsigned int ew : 3;
91 unsigned int zw : 3;
92 unsigned int aw : 2;
93 unsigned int dw : 2;
94 unsigned int ewb : 2;
95 unsigned int bw : 1;
96 unsigned int wr_extend : 1;
97 unsigned int erc_en : 1;
98 unsigned int mode : 1;
99 unsigned int dummy1 : 10;
100} reg_bif_core_rw_grp1_cfg;
101#define REG_RD_ADDR_bif_core_rw_grp1_cfg 0
102#define REG_WR_ADDR_bif_core_rw_grp1_cfg 0
103
104/* Register rw_grp2_cfg, scope bif_core, type rw */
105typedef struct {
106 unsigned int lw : 6;
107 unsigned int ew : 3;
108 unsigned int zw : 3;
109 unsigned int aw : 2;
110 unsigned int dw : 2;
111 unsigned int ewb : 2;
112 unsigned int bw : 1;
113 unsigned int wr_extend : 1;
114 unsigned int erc_en : 1;
115 unsigned int mode : 1;
116 unsigned int dummy1 : 10;
117} reg_bif_core_rw_grp2_cfg;
118#define REG_RD_ADDR_bif_core_rw_grp2_cfg 4
119#define REG_WR_ADDR_bif_core_rw_grp2_cfg 4
120
121/* Register rw_grp3_cfg, scope bif_core, type rw */
122typedef struct {
123 unsigned int lw : 6;
124 unsigned int ew : 3;
125 unsigned int zw : 3;
126 unsigned int aw : 2;
127 unsigned int dw : 2;
128 unsigned int ewb : 2;
129 unsigned int bw : 1;
130 unsigned int wr_extend : 1;
131 unsigned int erc_en : 1;
132 unsigned int mode : 1;
133 unsigned int dummy1 : 2;
134 unsigned int gated_csp0 : 2;
135 unsigned int gated_csp1 : 2;
136 unsigned int gated_csp2 : 2;
137 unsigned int gated_csp3 : 2;
138} reg_bif_core_rw_grp3_cfg;
139#define REG_RD_ADDR_bif_core_rw_grp3_cfg 8
140#define REG_WR_ADDR_bif_core_rw_grp3_cfg 8
141
142/* Register rw_grp4_cfg, scope bif_core, type rw */
143typedef struct {
144 unsigned int lw : 6;
145 unsigned int ew : 3;
146 unsigned int zw : 3;
147 unsigned int aw : 2;
148 unsigned int dw : 2;
149 unsigned int ewb : 2;
150 unsigned int bw : 1;
151 unsigned int wr_extend : 1;
152 unsigned int erc_en : 1;
153 unsigned int mode : 1;
154 unsigned int dummy1 : 4;
155 unsigned int gated_csp4 : 2;
156 unsigned int gated_csp5 : 2;
157 unsigned int gated_csp6 : 2;
158} reg_bif_core_rw_grp4_cfg;
159#define REG_RD_ADDR_bif_core_rw_grp4_cfg 12
160#define REG_WR_ADDR_bif_core_rw_grp4_cfg 12
161
162/* Register rw_sdram_cfg_grp0, scope bif_core, type rw */
163typedef struct {
164 unsigned int bank_sel : 5;
165 unsigned int ca : 3;
166 unsigned int type : 1;
167 unsigned int bw : 1;
168 unsigned int sh : 3;
169 unsigned int wmm : 1;
170 unsigned int sh16 : 1;
171 unsigned int grp_sel : 5;
172 unsigned int dummy1 : 12;
173} reg_bif_core_rw_sdram_cfg_grp0;
174#define REG_RD_ADDR_bif_core_rw_sdram_cfg_grp0 16
175#define REG_WR_ADDR_bif_core_rw_sdram_cfg_grp0 16
176
177/* Register rw_sdram_cfg_grp1, scope bif_core, type rw */
178typedef struct {
179 unsigned int bank_sel : 5;
180 unsigned int ca : 3;
181 unsigned int type : 1;
182 unsigned int bw : 1;
183 unsigned int sh : 3;
184 unsigned int wmm : 1;
185 unsigned int sh16 : 1;
186 unsigned int dummy1 : 17;
187} reg_bif_core_rw_sdram_cfg_grp1;
188#define REG_RD_ADDR_bif_core_rw_sdram_cfg_grp1 20
189#define REG_WR_ADDR_bif_core_rw_sdram_cfg_grp1 20
190
191/* Register rw_sdram_timing, scope bif_core, type rw */
192typedef struct {
193 unsigned int cl : 3;
194 unsigned int rcd : 3;
195 unsigned int rp : 3;
196 unsigned int rc : 2;
197 unsigned int dpl : 2;
198 unsigned int pde : 1;
199 unsigned int ref : 2;
200 unsigned int cpd : 1;
201 unsigned int sdcke : 1;
202 unsigned int sdclk : 1;
203 unsigned int dummy1 : 13;
204} reg_bif_core_rw_sdram_timing;
205#define REG_RD_ADDR_bif_core_rw_sdram_timing 24
206#define REG_WR_ADDR_bif_core_rw_sdram_timing 24
207
208/* Register rw_sdram_cmd, scope bif_core, type rw */
209typedef struct {
210 unsigned int cmd : 3;
211 unsigned int mrs_data : 15;
212 unsigned int dummy1 : 14;
213} reg_bif_core_rw_sdram_cmd;
214#define REG_RD_ADDR_bif_core_rw_sdram_cmd 28
215#define REG_WR_ADDR_bif_core_rw_sdram_cmd 28
216
217/* Register rs_sdram_ref_stat, scope bif_core, type rs */
218typedef struct {
219 unsigned int ok : 1;
220 unsigned int dummy1 : 31;
221} reg_bif_core_rs_sdram_ref_stat;
222#define REG_RD_ADDR_bif_core_rs_sdram_ref_stat 32
223
224/* Register r_sdram_ref_stat, scope bif_core, type r */
225typedef struct {
226 unsigned int ok : 1;
227 unsigned int dummy1 : 31;
228} reg_bif_core_r_sdram_ref_stat;
229#define REG_RD_ADDR_bif_core_r_sdram_ref_stat 36
230
231
232/* Constants */
233enum {
234 regk_bif_core_bank2 = 0x00000000,
235 regk_bif_core_bank4 = 0x00000001,
236 regk_bif_core_bit10 = 0x0000000a,
237 regk_bif_core_bit11 = 0x0000000b,
238 regk_bif_core_bit12 = 0x0000000c,
239 regk_bif_core_bit13 = 0x0000000d,
240 regk_bif_core_bit14 = 0x0000000e,
241 regk_bif_core_bit15 = 0x0000000f,
242 regk_bif_core_bit16 = 0x00000010,
243 regk_bif_core_bit17 = 0x00000011,
244 regk_bif_core_bit18 = 0x00000012,
245 regk_bif_core_bit19 = 0x00000013,
246 regk_bif_core_bit20 = 0x00000014,
247 regk_bif_core_bit21 = 0x00000015,
248 regk_bif_core_bit22 = 0x00000016,
249 regk_bif_core_bit23 = 0x00000017,
250 regk_bif_core_bit24 = 0x00000018,
251 regk_bif_core_bit25 = 0x00000019,
252 regk_bif_core_bit26 = 0x0000001a,
253 regk_bif_core_bit27 = 0x0000001b,
254 regk_bif_core_bit28 = 0x0000001c,
255 regk_bif_core_bit29 = 0x0000001d,
256 regk_bif_core_bit9 = 0x00000009,
257 regk_bif_core_bw16 = 0x00000001,
258 regk_bif_core_bw32 = 0x00000000,
259 regk_bif_core_bwe = 0x00000000,
260 regk_bif_core_cwe = 0x00000001,
261 regk_bif_core_e15us = 0x00000001,
262 regk_bif_core_e7800ns = 0x00000002,
263 regk_bif_core_grp0 = 0x00000000,
264 regk_bif_core_grp1 = 0x00000001,
265 regk_bif_core_mrs = 0x00000003,
266 regk_bif_core_no = 0x00000000,
267 regk_bif_core_none = 0x00000000,
268 regk_bif_core_nop = 0x00000000,
269 regk_bif_core_off = 0x00000000,
270 regk_bif_core_pre = 0x00000002,
271 regk_bif_core_r_sdram_ref_stat_default = 0x00000001,
272 regk_bif_core_rd = 0x00000002,
273 regk_bif_core_ref = 0x00000001,
274 regk_bif_core_rs_sdram_ref_stat_default = 0x00000001,
275 regk_bif_core_rw_grp1_cfg_default = 0x000006cf,
276 regk_bif_core_rw_grp2_cfg_default = 0x000006cf,
277 regk_bif_core_rw_grp3_cfg_default = 0x000006cf,
278 regk_bif_core_rw_grp4_cfg_default = 0x000006cf,
279 regk_bif_core_rw_sdram_cfg_grp1_default = 0x00000000,
280 regk_bif_core_slf = 0x00000004,
281 regk_bif_core_wr = 0x00000001,
282 regk_bif_core_yes = 0x00000001
283};
284#endif /* __bif_core_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/bif_dma_defs.h b/include/asm-cris/arch-v32/hwregs/bif_dma_defs.h
new file mode 100644
index 000000000000..b931c1aab679
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/bif_dma_defs.h
@@ -0,0 +1,473 @@
1#ifndef __bif_dma_defs_h
2#define __bif_dma_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_dma_regs.r
7 * id: bif_dma_regs.r,v 1.6 2005/02/04 13:28:31 perz Exp
8 * last modfied: Mon Apr 11 16:06:33 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile bif_dma_defs.h ../../inst/bif/rtl/bif_dma_regs.r
11 * id: $Id: bif_dma_defs.h,v 1.2 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope bif_dma */
86
87/* Register rw_ch0_ctrl, scope bif_dma, type rw */
88typedef struct {
89 unsigned int bw : 2;
90 unsigned int burst_len : 1;
91 unsigned int cont : 1;
92 unsigned int end_pad : 1;
93 unsigned int cnt : 1;
94 unsigned int dreq_pin : 3;
95 unsigned int dreq_mode : 2;
96 unsigned int tc_in_pin : 3;
97 unsigned int tc_in_mode : 2;
98 unsigned int bus_mode : 2;
99 unsigned int rate_en : 1;
100 unsigned int wr_all : 1;
101 unsigned int dummy1 : 12;
102} reg_bif_dma_rw_ch0_ctrl;
103#define REG_RD_ADDR_bif_dma_rw_ch0_ctrl 0
104#define REG_WR_ADDR_bif_dma_rw_ch0_ctrl 0
105
106/* Register rw_ch0_addr, scope bif_dma, type rw */
107typedef struct {
108 unsigned int addr : 32;
109} reg_bif_dma_rw_ch0_addr;
110#define REG_RD_ADDR_bif_dma_rw_ch0_addr 4
111#define REG_WR_ADDR_bif_dma_rw_ch0_addr 4
112
113/* Register rw_ch0_start, scope bif_dma, type rw */
114typedef struct {
115 unsigned int run : 1;
116 unsigned int dummy1 : 31;
117} reg_bif_dma_rw_ch0_start;
118#define REG_RD_ADDR_bif_dma_rw_ch0_start 8
119#define REG_WR_ADDR_bif_dma_rw_ch0_start 8
120
121/* Register rw_ch0_cnt, scope bif_dma, type rw */
122typedef struct {
123 unsigned int start_cnt : 16;
124 unsigned int dummy1 : 16;
125} reg_bif_dma_rw_ch0_cnt;
126#define REG_RD_ADDR_bif_dma_rw_ch0_cnt 12
127#define REG_WR_ADDR_bif_dma_rw_ch0_cnt 12
128
129/* Register r_ch0_stat, scope bif_dma, type r */
130typedef struct {
131 unsigned int cnt : 16;
132 unsigned int dummy1 : 15;
133 unsigned int run : 1;
134} reg_bif_dma_r_ch0_stat;
135#define REG_RD_ADDR_bif_dma_r_ch0_stat 16
136
137/* Register rw_ch1_ctrl, scope bif_dma, type rw */
138typedef struct {
139 unsigned int bw : 2;
140 unsigned int burst_len : 1;
141 unsigned int cont : 1;
142 unsigned int end_discard : 1;
143 unsigned int cnt : 1;
144 unsigned int dreq_pin : 3;
145 unsigned int dreq_mode : 2;
146 unsigned int tc_in_pin : 3;
147 unsigned int tc_in_mode : 2;
148 unsigned int bus_mode : 2;
149 unsigned int rate_en : 1;
150 unsigned int dummy1 : 13;
151} reg_bif_dma_rw_ch1_ctrl;
152#define REG_RD_ADDR_bif_dma_rw_ch1_ctrl 32
153#define REG_WR_ADDR_bif_dma_rw_ch1_ctrl 32
154
155/* Register rw_ch1_addr, scope bif_dma, type rw */
156typedef struct {
157 unsigned int addr : 32;
158} reg_bif_dma_rw_ch1_addr;
159#define REG_RD_ADDR_bif_dma_rw_ch1_addr 36
160#define REG_WR_ADDR_bif_dma_rw_ch1_addr 36
161
162/* Register rw_ch1_start, scope bif_dma, type rw */
163typedef struct {
164 unsigned int run : 1;
165 unsigned int dummy1 : 31;
166} reg_bif_dma_rw_ch1_start;
167#define REG_RD_ADDR_bif_dma_rw_ch1_start 40
168#define REG_WR_ADDR_bif_dma_rw_ch1_start 40
169
170/* Register rw_ch1_cnt, scope bif_dma, type rw */
171typedef struct {
172 unsigned int start_cnt : 16;
173 unsigned int dummy1 : 16;
174} reg_bif_dma_rw_ch1_cnt;
175#define REG_RD_ADDR_bif_dma_rw_ch1_cnt 44
176#define REG_WR_ADDR_bif_dma_rw_ch1_cnt 44
177
178/* Register r_ch1_stat, scope bif_dma, type r */
179typedef struct {
180 unsigned int cnt : 16;
181 unsigned int dummy1 : 15;
182 unsigned int run : 1;
183} reg_bif_dma_r_ch1_stat;
184#define REG_RD_ADDR_bif_dma_r_ch1_stat 48
185
186/* Register rw_ch2_ctrl, scope bif_dma, type rw */
187typedef struct {
188 unsigned int bw : 2;
189 unsigned int burst_len : 1;
190 unsigned int cont : 1;
191 unsigned int end_pad : 1;
192 unsigned int cnt : 1;
193 unsigned int dreq_pin : 3;
194 unsigned int dreq_mode : 2;
195 unsigned int tc_in_pin : 3;
196 unsigned int tc_in_mode : 2;
197 unsigned int bus_mode : 2;
198 unsigned int rate_en : 1;
199 unsigned int wr_all : 1;
200 unsigned int dummy1 : 12;
201} reg_bif_dma_rw_ch2_ctrl;
202#define REG_RD_ADDR_bif_dma_rw_ch2_ctrl 64
203#define REG_WR_ADDR_bif_dma_rw_ch2_ctrl 64
204
205/* Register rw_ch2_addr, scope bif_dma, type rw */
206typedef struct {
207 unsigned int addr : 32;
208} reg_bif_dma_rw_ch2_addr;
209#define REG_RD_ADDR_bif_dma_rw_ch2_addr 68
210#define REG_WR_ADDR_bif_dma_rw_ch2_addr 68
211
212/* Register rw_ch2_start, scope bif_dma, type rw */
213typedef struct {
214 unsigned int run : 1;
215 unsigned int dummy1 : 31;
216} reg_bif_dma_rw_ch2_start;
217#define REG_RD_ADDR_bif_dma_rw_ch2_start 72
218#define REG_WR_ADDR_bif_dma_rw_ch2_start 72
219
220/* Register rw_ch2_cnt, scope bif_dma, type rw */
221typedef struct {
222 unsigned int start_cnt : 16;
223 unsigned int dummy1 : 16;
224} reg_bif_dma_rw_ch2_cnt;
225#define REG_RD_ADDR_bif_dma_rw_ch2_cnt 76
226#define REG_WR_ADDR_bif_dma_rw_ch2_cnt 76
227
228/* Register r_ch2_stat, scope bif_dma, type r */
229typedef struct {
230 unsigned int cnt : 16;
231 unsigned int dummy1 : 15;
232 unsigned int run : 1;
233} reg_bif_dma_r_ch2_stat;
234#define REG_RD_ADDR_bif_dma_r_ch2_stat 80
235
236/* Register rw_ch3_ctrl, scope bif_dma, type rw */
237typedef struct {
238 unsigned int bw : 2;
239 unsigned int burst_len : 1;
240 unsigned int cont : 1;
241 unsigned int end_discard : 1;
242 unsigned int cnt : 1;
243 unsigned int dreq_pin : 3;
244 unsigned int dreq_mode : 2;
245 unsigned int tc_in_pin : 3;
246 unsigned int tc_in_mode : 2;
247 unsigned int bus_mode : 2;
248 unsigned int rate_en : 1;
249 unsigned int dummy1 : 13;
250} reg_bif_dma_rw_ch3_ctrl;
251#define REG_RD_ADDR_bif_dma_rw_ch3_ctrl 96
252#define REG_WR_ADDR_bif_dma_rw_ch3_ctrl 96
253
254/* Register rw_ch3_addr, scope bif_dma, type rw */
255typedef struct {
256 unsigned int addr : 32;
257} reg_bif_dma_rw_ch3_addr;
258#define REG_RD_ADDR_bif_dma_rw_ch3_addr 100
259#define REG_WR_ADDR_bif_dma_rw_ch3_addr 100
260
261/* Register rw_ch3_start, scope bif_dma, type rw */
262typedef struct {
263 unsigned int run : 1;
264 unsigned int dummy1 : 31;
265} reg_bif_dma_rw_ch3_start;
266#define REG_RD_ADDR_bif_dma_rw_ch3_start 104
267#define REG_WR_ADDR_bif_dma_rw_ch3_start 104
268
269/* Register rw_ch3_cnt, scope bif_dma, type rw */
270typedef struct {
271 unsigned int start_cnt : 16;
272 unsigned int dummy1 : 16;
273} reg_bif_dma_rw_ch3_cnt;
274#define REG_RD_ADDR_bif_dma_rw_ch3_cnt 108
275#define REG_WR_ADDR_bif_dma_rw_ch3_cnt 108
276
277/* Register r_ch3_stat, scope bif_dma, type r */
278typedef struct {
279 unsigned int cnt : 16;
280 unsigned int dummy1 : 15;
281 unsigned int run : 1;
282} reg_bif_dma_r_ch3_stat;
283#define REG_RD_ADDR_bif_dma_r_ch3_stat 112
284
285/* Register rw_intr_mask, scope bif_dma, type rw */
286typedef struct {
287 unsigned int ext_dma0 : 1;
288 unsigned int ext_dma1 : 1;
289 unsigned int ext_dma2 : 1;
290 unsigned int ext_dma3 : 1;
291 unsigned int dummy1 : 28;
292} reg_bif_dma_rw_intr_mask;
293#define REG_RD_ADDR_bif_dma_rw_intr_mask 128
294#define REG_WR_ADDR_bif_dma_rw_intr_mask 128
295
296/* Register rw_ack_intr, scope bif_dma, type rw */
297typedef struct {
298 unsigned int ext_dma0 : 1;
299 unsigned int ext_dma1 : 1;
300 unsigned int ext_dma2 : 1;
301 unsigned int ext_dma3 : 1;
302 unsigned int dummy1 : 28;
303} reg_bif_dma_rw_ack_intr;
304#define REG_RD_ADDR_bif_dma_rw_ack_intr 132
305#define REG_WR_ADDR_bif_dma_rw_ack_intr 132
306
307/* Register r_intr, scope bif_dma, type r */
308typedef struct {
309 unsigned int ext_dma0 : 1;
310 unsigned int ext_dma1 : 1;
311 unsigned int ext_dma2 : 1;
312 unsigned int ext_dma3 : 1;
313 unsigned int dummy1 : 28;
314} reg_bif_dma_r_intr;
315#define REG_RD_ADDR_bif_dma_r_intr 136
316
317/* Register r_masked_intr, scope bif_dma, type r */
318typedef struct {
319 unsigned int ext_dma0 : 1;
320 unsigned int ext_dma1 : 1;
321 unsigned int ext_dma2 : 1;
322 unsigned int ext_dma3 : 1;
323 unsigned int dummy1 : 28;
324} reg_bif_dma_r_masked_intr;
325#define REG_RD_ADDR_bif_dma_r_masked_intr 140
326
327/* Register rw_pin0_cfg, scope bif_dma, type rw */
328typedef struct {
329 unsigned int master_ch : 2;
330 unsigned int master_mode : 3;
331 unsigned int slave_ch : 2;
332 unsigned int slave_mode : 3;
333 unsigned int dummy1 : 22;
334} reg_bif_dma_rw_pin0_cfg;
335#define REG_RD_ADDR_bif_dma_rw_pin0_cfg 160
336#define REG_WR_ADDR_bif_dma_rw_pin0_cfg 160
337
338/* Register rw_pin1_cfg, scope bif_dma, type rw */
339typedef struct {
340 unsigned int master_ch : 2;
341 unsigned int master_mode : 3;
342 unsigned int slave_ch : 2;
343 unsigned int slave_mode : 3;
344 unsigned int dummy1 : 22;
345} reg_bif_dma_rw_pin1_cfg;
346#define REG_RD_ADDR_bif_dma_rw_pin1_cfg 164
347#define REG_WR_ADDR_bif_dma_rw_pin1_cfg 164
348
349/* Register rw_pin2_cfg, scope bif_dma, type rw */
350typedef struct {
351 unsigned int master_ch : 2;
352 unsigned int master_mode : 3;
353 unsigned int slave_ch : 2;
354 unsigned int slave_mode : 3;
355 unsigned int dummy1 : 22;
356} reg_bif_dma_rw_pin2_cfg;
357#define REG_RD_ADDR_bif_dma_rw_pin2_cfg 168
358#define REG_WR_ADDR_bif_dma_rw_pin2_cfg 168
359
360/* Register rw_pin3_cfg, scope bif_dma, type rw */
361typedef struct {
362 unsigned int master_ch : 2;
363 unsigned int master_mode : 3;
364 unsigned int slave_ch : 2;
365 unsigned int slave_mode : 3;
366 unsigned int dummy1 : 22;
367} reg_bif_dma_rw_pin3_cfg;
368#define REG_RD_ADDR_bif_dma_rw_pin3_cfg 172
369#define REG_WR_ADDR_bif_dma_rw_pin3_cfg 172
370
371/* Register rw_pin4_cfg, scope bif_dma, type rw */
372typedef struct {
373 unsigned int master_ch : 2;
374 unsigned int master_mode : 3;
375 unsigned int slave_ch : 2;
376 unsigned int slave_mode : 3;
377 unsigned int dummy1 : 22;
378} reg_bif_dma_rw_pin4_cfg;
379#define REG_RD_ADDR_bif_dma_rw_pin4_cfg 176
380#define REG_WR_ADDR_bif_dma_rw_pin4_cfg 176
381
382/* Register rw_pin5_cfg, scope bif_dma, type rw */
383typedef struct {
384 unsigned int master_ch : 2;
385 unsigned int master_mode : 3;
386 unsigned int slave_ch : 2;
387 unsigned int slave_mode : 3;
388 unsigned int dummy1 : 22;
389} reg_bif_dma_rw_pin5_cfg;
390#define REG_RD_ADDR_bif_dma_rw_pin5_cfg 180
391#define REG_WR_ADDR_bif_dma_rw_pin5_cfg 180
392
393/* Register rw_pin6_cfg, scope bif_dma, type rw */
394typedef struct {
395 unsigned int master_ch : 2;
396 unsigned int master_mode : 3;
397 unsigned int slave_ch : 2;
398 unsigned int slave_mode : 3;
399 unsigned int dummy1 : 22;
400} reg_bif_dma_rw_pin6_cfg;
401#define REG_RD_ADDR_bif_dma_rw_pin6_cfg 184
402#define REG_WR_ADDR_bif_dma_rw_pin6_cfg 184
403
404/* Register rw_pin7_cfg, scope bif_dma, type rw */
405typedef struct {
406 unsigned int master_ch : 2;
407 unsigned int master_mode : 3;
408 unsigned int slave_ch : 2;
409 unsigned int slave_mode : 3;
410 unsigned int dummy1 : 22;
411} reg_bif_dma_rw_pin7_cfg;
412#define REG_RD_ADDR_bif_dma_rw_pin7_cfg 188
413#define REG_WR_ADDR_bif_dma_rw_pin7_cfg 188
414
415/* Register r_pin_stat, scope bif_dma, type r */
416typedef struct {
417 unsigned int pin0 : 1;
418 unsigned int pin1 : 1;
419 unsigned int pin2 : 1;
420 unsigned int pin3 : 1;
421 unsigned int pin4 : 1;
422 unsigned int pin5 : 1;
423 unsigned int pin6 : 1;
424 unsigned int pin7 : 1;
425 unsigned int dummy1 : 24;
426} reg_bif_dma_r_pin_stat;
427#define REG_RD_ADDR_bif_dma_r_pin_stat 192
428
429
430/* Constants */
431enum {
432 regk_bif_dma_as_master = 0x00000001,
433 regk_bif_dma_as_slave = 0x00000001,
434 regk_bif_dma_burst1 = 0x00000000,
435 regk_bif_dma_burst8 = 0x00000001,
436 regk_bif_dma_bw16 = 0x00000001,
437 regk_bif_dma_bw32 = 0x00000002,
438 regk_bif_dma_bw8 = 0x00000000,
439 regk_bif_dma_dack = 0x00000006,
440 regk_bif_dma_dack_inv = 0x00000007,
441 regk_bif_dma_force = 0x00000001,
442 regk_bif_dma_hi = 0x00000003,
443 regk_bif_dma_inv = 0x00000003,
444 regk_bif_dma_lo = 0x00000002,
445 regk_bif_dma_master = 0x00000001,
446 regk_bif_dma_no = 0x00000000,
447 regk_bif_dma_norm = 0x00000002,
448 regk_bif_dma_off = 0x00000000,
449 regk_bif_dma_rw_ch0_ctrl_default = 0x00000000,
450 regk_bif_dma_rw_ch0_start_default = 0x00000000,
451 regk_bif_dma_rw_ch1_ctrl_default = 0x00000000,
452 regk_bif_dma_rw_ch1_start_default = 0x00000000,
453 regk_bif_dma_rw_ch2_ctrl_default = 0x00000000,
454 regk_bif_dma_rw_ch2_start_default = 0x00000000,
455 regk_bif_dma_rw_ch3_ctrl_default = 0x00000000,
456 regk_bif_dma_rw_ch3_start_default = 0x00000000,
457 regk_bif_dma_rw_intr_mask_default = 0x00000000,
458 regk_bif_dma_rw_pin0_cfg_default = 0x00000000,
459 regk_bif_dma_rw_pin1_cfg_default = 0x00000000,
460 regk_bif_dma_rw_pin2_cfg_default = 0x00000000,
461 regk_bif_dma_rw_pin3_cfg_default = 0x00000000,
462 regk_bif_dma_rw_pin4_cfg_default = 0x00000000,
463 regk_bif_dma_rw_pin5_cfg_default = 0x00000000,
464 regk_bif_dma_rw_pin6_cfg_default = 0x00000000,
465 regk_bif_dma_rw_pin7_cfg_default = 0x00000000,
466 regk_bif_dma_slave = 0x00000002,
467 regk_bif_dma_sreq = 0x00000006,
468 regk_bif_dma_sreq_inv = 0x00000007,
469 regk_bif_dma_tc = 0x00000004,
470 regk_bif_dma_tc_inv = 0x00000005,
471 regk_bif_dma_yes = 0x00000001
472};
473#endif /* __bif_dma_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/bif_slave_defs.h b/include/asm-cris/arch-v32/hwregs/bif_slave_defs.h
new file mode 100644
index 000000000000..d18fc3c9f569
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/bif_slave_defs.h
@@ -0,0 +1,249 @@
1#ifndef __bif_slave_defs_h
2#define __bif_slave_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/bif/rtl/bif_slave_regs.r
7 * id: bif_slave_regs.r,v 1.5 2005/02/04 13:55:28 perz Exp
8 * last modfied: Mon Apr 11 16:06:34 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile bif_slave_defs.h ../../inst/bif/rtl/bif_slave_regs.r
11 * id: $Id: bif_slave_defs.h,v 1.2 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope bif_slave */
86
87/* Register rw_slave_cfg, scope bif_slave, type rw */
88typedef struct {
89 unsigned int slave_id : 3;
90 unsigned int use_slave_id : 1;
91 unsigned int boot_rdy : 1;
92 unsigned int loopback : 1;
93 unsigned int dis : 1;
94 unsigned int dummy1 : 25;
95} reg_bif_slave_rw_slave_cfg;
96#define REG_RD_ADDR_bif_slave_rw_slave_cfg 0
97#define REG_WR_ADDR_bif_slave_rw_slave_cfg 0
98
99/* Register r_slave_mode, scope bif_slave, type r */
100typedef struct {
101 unsigned int ch0_mode : 1;
102 unsigned int ch1_mode : 1;
103 unsigned int ch2_mode : 1;
104 unsigned int ch3_mode : 1;
105 unsigned int dummy1 : 28;
106} reg_bif_slave_r_slave_mode;
107#define REG_RD_ADDR_bif_slave_r_slave_mode 4
108
109/* Register rw_ch0_cfg, scope bif_slave, type rw */
110typedef struct {
111 unsigned int rd_hold : 2;
112 unsigned int access_mode : 1;
113 unsigned int access_ctrl : 1;
114 unsigned int data_cs : 2;
115 unsigned int dummy1 : 26;
116} reg_bif_slave_rw_ch0_cfg;
117#define REG_RD_ADDR_bif_slave_rw_ch0_cfg 16
118#define REG_WR_ADDR_bif_slave_rw_ch0_cfg 16
119
120/* Register rw_ch1_cfg, scope bif_slave, type rw */
121typedef struct {
122 unsigned int rd_hold : 2;
123 unsigned int access_mode : 1;
124 unsigned int access_ctrl : 1;
125 unsigned int data_cs : 2;
126 unsigned int dummy1 : 26;
127} reg_bif_slave_rw_ch1_cfg;
128#define REG_RD_ADDR_bif_slave_rw_ch1_cfg 20
129#define REG_WR_ADDR_bif_slave_rw_ch1_cfg 20
130
131/* Register rw_ch2_cfg, scope bif_slave, type rw */
132typedef struct {
133 unsigned int rd_hold : 2;
134 unsigned int access_mode : 1;
135 unsigned int access_ctrl : 1;
136 unsigned int data_cs : 2;
137 unsigned int dummy1 : 26;
138} reg_bif_slave_rw_ch2_cfg;
139#define REG_RD_ADDR_bif_slave_rw_ch2_cfg 24
140#define REG_WR_ADDR_bif_slave_rw_ch2_cfg 24
141
142/* Register rw_ch3_cfg, scope bif_slave, type rw */
143typedef struct {
144 unsigned int rd_hold : 2;
145 unsigned int access_mode : 1;
146 unsigned int access_ctrl : 1;
147 unsigned int data_cs : 2;
148 unsigned int dummy1 : 26;
149} reg_bif_slave_rw_ch3_cfg;
150#define REG_RD_ADDR_bif_slave_rw_ch3_cfg 28
151#define REG_WR_ADDR_bif_slave_rw_ch3_cfg 28
152
153/* Register rw_arb_cfg, scope bif_slave, type rw */
154typedef struct {
155 unsigned int brin_mode : 1;
156 unsigned int brout_mode : 3;
157 unsigned int bg_mode : 3;
158 unsigned int release : 2;
159 unsigned int acquire : 1;
160 unsigned int settle_time : 2;
161 unsigned int dram_ctrl : 1;
162 unsigned int dummy1 : 19;
163} reg_bif_slave_rw_arb_cfg;
164#define REG_RD_ADDR_bif_slave_rw_arb_cfg 32
165#define REG_WR_ADDR_bif_slave_rw_arb_cfg 32
166
167/* Register r_arb_stat, scope bif_slave, type r */
168typedef struct {
169 unsigned int init_mode : 1;
170 unsigned int mode : 1;
171 unsigned int brin : 1;
172 unsigned int brout : 1;
173 unsigned int bg : 1;
174 unsigned int dummy1 : 27;
175} reg_bif_slave_r_arb_stat;
176#define REG_RD_ADDR_bif_slave_r_arb_stat 36
177
178/* Register rw_intr_mask, scope bif_slave, type rw */
179typedef struct {
180 unsigned int bus_release : 1;
181 unsigned int bus_acquire : 1;
182 unsigned int dummy1 : 30;
183} reg_bif_slave_rw_intr_mask;
184#define REG_RD_ADDR_bif_slave_rw_intr_mask 64
185#define REG_WR_ADDR_bif_slave_rw_intr_mask 64
186
187/* Register rw_ack_intr, scope bif_slave, type rw */
188typedef struct {
189 unsigned int bus_release : 1;
190 unsigned int bus_acquire : 1;
191 unsigned int dummy1 : 30;
192} reg_bif_slave_rw_ack_intr;
193#define REG_RD_ADDR_bif_slave_rw_ack_intr 68
194#define REG_WR_ADDR_bif_slave_rw_ack_intr 68
195
196/* Register r_intr, scope bif_slave, type r */
197typedef struct {
198 unsigned int bus_release : 1;
199 unsigned int bus_acquire : 1;
200 unsigned int dummy1 : 30;
201} reg_bif_slave_r_intr;
202#define REG_RD_ADDR_bif_slave_r_intr 72
203
204/* Register r_masked_intr, scope bif_slave, type r */
205typedef struct {
206 unsigned int bus_release : 1;
207 unsigned int bus_acquire : 1;
208 unsigned int dummy1 : 30;
209} reg_bif_slave_r_masked_intr;
210#define REG_RD_ADDR_bif_slave_r_masked_intr 76
211
212
213/* Constants */
214enum {
215 regk_bif_slave_active_hi = 0x00000003,
216 regk_bif_slave_active_lo = 0x00000002,
217 regk_bif_slave_addr = 0x00000000,
218 regk_bif_slave_always = 0x00000001,
219 regk_bif_slave_at_idle = 0x00000002,
220 regk_bif_slave_burst_end = 0x00000003,
221 regk_bif_slave_dma = 0x00000001,
222 regk_bif_slave_hi = 0x00000003,
223 regk_bif_slave_inv = 0x00000001,
224 regk_bif_slave_lo = 0x00000002,
225 regk_bif_slave_local = 0x00000001,
226 regk_bif_slave_master = 0x00000000,
227 regk_bif_slave_mode_reg = 0x00000001,
228 regk_bif_slave_no = 0x00000000,
229 regk_bif_slave_norm = 0x00000000,
230 regk_bif_slave_on_access = 0x00000000,
231 regk_bif_slave_rw_arb_cfg_default = 0x00000000,
232 regk_bif_slave_rw_ch0_cfg_default = 0x00000000,
233 regk_bif_slave_rw_ch1_cfg_default = 0x00000000,
234 regk_bif_slave_rw_ch2_cfg_default = 0x00000000,
235 regk_bif_slave_rw_ch3_cfg_default = 0x00000000,
236 regk_bif_slave_rw_intr_mask_default = 0x00000000,
237 regk_bif_slave_rw_slave_cfg_default = 0x00000000,
238 regk_bif_slave_shared = 0x00000000,
239 regk_bif_slave_slave = 0x00000001,
240 regk_bif_slave_t0ns = 0x00000003,
241 regk_bif_slave_t10ns = 0x00000002,
242 regk_bif_slave_t20ns = 0x00000003,
243 regk_bif_slave_t30ns = 0x00000002,
244 regk_bif_slave_t40ns = 0x00000001,
245 regk_bif_slave_t50ns = 0x00000000,
246 regk_bif_slave_yes = 0x00000001,
247 regk_bif_slave_z = 0x00000004
248};
249#endif /* __bif_slave_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/config_defs.h b/include/asm-cris/arch-v32/hwregs/config_defs.h
new file mode 100644
index 000000000000..45457a4e3817
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/config_defs.h
@@ -0,0 +1,142 @@
1#ifndef __config_defs_h
2#define __config_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../rtl/config_regs.r
7 * id: config_regs.r,v 1.23 2004/03/04 11:34:42 mikaeln Exp
8 * last modfied: Thu Mar 4 12:34:39 2004
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile config_defs.h ../../rtl/config_regs.r
11 * id: $Id: config_defs.h,v 1.6 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope config */
86
87/* Register r_bootsel, scope config, type r */
88typedef struct {
89 unsigned int boot_mode : 3;
90 unsigned int full_duplex : 1;
91 unsigned int user : 1;
92 unsigned int pll : 1;
93 unsigned int flash_bw : 1;
94 unsigned int dummy1 : 25;
95} reg_config_r_bootsel;
96#define REG_RD_ADDR_config_r_bootsel 0
97
98/* Register rw_clk_ctrl, scope config, type rw */
99typedef struct {
100 unsigned int pll : 1;
101 unsigned int cpu : 1;
102 unsigned int iop : 1;
103 unsigned int dma01_eth0 : 1;
104 unsigned int dma23 : 1;
105 unsigned int dma45 : 1;
106 unsigned int dma67 : 1;
107 unsigned int dma89_strcop : 1;
108 unsigned int bif : 1;
109 unsigned int fix_io : 1;
110 unsigned int dummy1 : 22;
111} reg_config_rw_clk_ctrl;
112#define REG_RD_ADDR_config_rw_clk_ctrl 4
113#define REG_WR_ADDR_config_rw_clk_ctrl 4
114
115/* Register rw_pad_ctrl, scope config, type rw */
116typedef struct {
117 unsigned int usb_susp : 1;
118 unsigned int phyrst_n : 1;
119 unsigned int dummy1 : 30;
120} reg_config_rw_pad_ctrl;
121#define REG_RD_ADDR_config_rw_pad_ctrl 8
122#define REG_WR_ADDR_config_rw_pad_ctrl 8
123
124
125/* Constants */
126enum {
127 regk_config_bw16 = 0x00000000,
128 regk_config_bw32 = 0x00000001,
129 regk_config_master = 0x00000005,
130 regk_config_nand = 0x00000003,
131 regk_config_net_rx = 0x00000001,
132 regk_config_net_tx_rx = 0x00000002,
133 regk_config_no = 0x00000000,
134 regk_config_none = 0x00000007,
135 regk_config_nor = 0x00000000,
136 regk_config_rw_clk_ctrl_default = 0x00000002,
137 regk_config_rw_pad_ctrl_default = 0x00000000,
138 regk_config_ser = 0x00000004,
139 regk_config_slave = 0x00000006,
140 regk_config_yes = 0x00000001
141};
142#endif /* __config_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/cpu_vect.h b/include/asm-cris/arch-v32/hwregs/cpu_vect.h
new file mode 100644
index 000000000000..8370aee8a14a
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/cpu_vect.h
@@ -0,0 +1,41 @@
1/* Interrupt vector numbers autogenerated by /n/asic/design/tools/rdesc/src/rdes2intr version
2 from ../../inst/crisp/doc/cpu_vect.r
3version . */
4
5#ifndef _______INST_CRISP_DOC_CPU_VECT_R
6#define _______INST_CRISP_DOC_CPU_VECT_R
7#define NMI_INTR_VECT 0x00
8#define RESERVED_1_INTR_VECT 0x01
9#define RESERVED_2_INTR_VECT 0x02
10#define SINGLE_STEP_INTR_VECT 0x03
11#define INSTR_TLB_REFILL_INTR_VECT 0x04
12#define INSTR_TLB_INV_INTR_VECT 0x05
13#define INSTR_TLB_ACC_INTR_VECT 0x06
14#define TLB_EX_INTR_VECT 0x07
15#define DATA_TLB_REFILL_INTR_VECT 0x08
16#define DATA_TLB_INV_INTR_VECT 0x09
17#define DATA_TLB_ACC_INTR_VECT 0x0a
18#define DATA_TLB_WE_INTR_VECT 0x0b
19#define HW_BP_INTR_VECT 0x0c
20#define RESERVED_D_INTR_VECT 0x0d
21#define RESERVED_E_INTR_VECT 0x0e
22#define RESERVED_F_INTR_VECT 0x0f
23#define BREAK_0_INTR_VECT 0x10
24#define BREAK_1_INTR_VECT 0x11
25#define BREAK_2_INTR_VECT 0x12
26#define BREAK_3_INTR_VECT 0x13
27#define BREAK_4_INTR_VECT 0x14
28#define BREAK_5_INTR_VECT 0x15
29#define BREAK_6_INTR_VECT 0x16
30#define BREAK_7_INTR_VECT 0x17
31#define BREAK_8_INTR_VECT 0x18
32#define BREAK_9_INTR_VECT 0x19
33#define BREAK_10_INTR_VECT 0x1a
34#define BREAK_11_INTR_VECT 0x1b
35#define BREAK_12_INTR_VECT 0x1c
36#define BREAK_13_INTR_VECT 0x1d
37#define BREAK_14_INTR_VECT 0x1e
38#define BREAK_15_INTR_VECT 0x1f
39#define MULTIPLE_INTR_VECT 0x30
40
41#endif
diff --git a/include/asm-cris/arch-v32/hwregs/dma.h b/include/asm-cris/arch-v32/hwregs/dma.h
new file mode 100644
index 000000000000..c31832d3d6be
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/dma.h
@@ -0,0 +1,128 @@
1/* $Id: dma.h,v 1.7 2005/04/24 18:30:58 starvik Exp $
2 *
3 * DMA C definitions and help macros
4 *
5 */
6
7#ifndef dma_h
8#define dma_h
9
10/* registers */ /* Really needed, since both are listed in sw.list? */
11#include "dma_defs.h"
12
13
14/* descriptors */
15
16// ------------------------------------------------------------ dma_descr_group
17typedef struct dma_descr_group {
18 struct dma_descr_group *next;
19 unsigned eol : 1;
20 unsigned tol : 1;
21 unsigned bol : 1;
22 unsigned : 1;
23 unsigned intr : 1;
24 unsigned : 2;
25 unsigned en : 1;
26 unsigned : 7;
27 unsigned dis : 1;
28 unsigned md : 16;
29 struct dma_descr_group *up;
30 union {
31 struct dma_descr_context *context;
32 struct dma_descr_group *group;
33 } down;
34} dma_descr_group;
35
36// ---------------------------------------------------------- dma_descr_context
37typedef struct dma_descr_context {
38 struct dma_descr_context *next;
39 unsigned eol : 1;
40 unsigned : 3;
41 unsigned intr : 1;
42 unsigned : 1;
43 unsigned store_mode : 1;
44 unsigned en : 1;
45 unsigned : 7;
46 unsigned dis : 1;
47 unsigned md0 : 16;
48 unsigned md1;
49 unsigned md2;
50 unsigned md3;
51 unsigned md4;
52 struct dma_descr_data *saved_data;
53 char *saved_data_buf;
54} dma_descr_context;
55
56// ------------------------------------------------------------- dma_descr_data
57typedef struct dma_descr_data {
58 struct dma_descr_data *next;
59 char *buf;
60 unsigned eol : 1;
61 unsigned : 2;
62 unsigned out_eop : 1;
63 unsigned intr : 1;
64 unsigned wait : 1;
65 unsigned : 2;
66 unsigned : 3;
67 unsigned in_eop : 1;
68 unsigned : 4;
69 unsigned md : 16;
70 char *after;
71} dma_descr_data;
72
73// --------------------------------------------------------------------- macros
74
75// enable DMA channel
76#define DMA_ENABLE( inst ) \
77 do { reg_dma_rw_cfg e = REG_RD( dma, inst, rw_cfg );\
78 e.en = regk_dma_yes; \
79 REG_WR( dma, inst, rw_cfg, e); } while( 0 )
80
81// reset DMA channel
82#define DMA_RESET( inst ) \
83 do { reg_dma_rw_cfg r = REG_RD( dma, inst, rw_cfg );\
84 r.en = regk_dma_no; \
85 REG_WR( dma, inst, rw_cfg, r); } while( 0 )
86
87// stop DMA channel
88#define DMA_STOP( inst ) \
89 do { reg_dma_rw_cfg s = REG_RD( dma, inst, rw_cfg );\
90 s.stop = regk_dma_yes; \
91 REG_WR( dma, inst, rw_cfg, s); } while( 0 )
92
93// continue DMA channel operation
94#define DMA_CONTINUE( inst ) \
95 do { reg_dma_rw_cfg c = REG_RD( dma, inst, rw_cfg );\
96 c.stop = regk_dma_no; \
97 REG_WR( dma, inst, rw_cfg, c); } while( 0 )
98
99// give stream command
100#define DMA_WR_CMD( inst, cmd_par ) \
101 do { reg_dma_rw_stream_cmd r = {0}; \
102 do { r = REG_RD( dma, inst, rw_stream_cmd ); } while( r.busy ); \
103 r.cmd = (cmd_par); \
104 REG_WR( dma, inst, rw_stream_cmd, r ); \
105 } while( 0 )
106
107// load: g,c,d:burst
108#define DMA_START_GROUP( inst, group_descr ) \
109 do { REG_WR_INT( dma, inst, rw_group, (int) group_descr ); \
110 DMA_WR_CMD( inst, regk_dma_load_g ); \
111 DMA_WR_CMD( inst, regk_dma_load_c ); \
112 DMA_WR_CMD( inst, regk_dma_load_d | regk_dma_burst ); \
113 } while( 0 )
114
115// load: c,d:burst
116#define DMA_START_CONTEXT( inst, ctx_descr ) \
117 do { REG_WR_INT( dma, inst, rw_group_down, (int) ctx_descr ); \
118 DMA_WR_CMD( inst, regk_dma_load_c ); \
119 DMA_WR_CMD( inst, regk_dma_load_d | regk_dma_burst ); \
120 } while( 0 )
121
122// if the DMA is at the end of the data list, the last data descr is reloaded
123#define DMA_CONTINUE_DATA( inst ) \
124do { reg_dma_rw_cmd c = {0}; \
125 c.cont_data = regk_dma_yes;\
126 REG_WR( dma, inst, rw_cmd, c ); } while( 0 )
127
128#endif
diff --git a/include/asm-cris/arch-v32/hwregs/dma_defs.h b/include/asm-cris/arch-v32/hwregs/dma_defs.h
new file mode 100644
index 000000000000..48ac8cef7ebe
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/dma_defs.h
@@ -0,0 +1,436 @@
1#ifndef __dma_defs_h
2#define __dma_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/dma/inst/dma_common/rtl/dma_regdes.r
7 * id: dma_regdes.r,v 1.39 2005/02/10 14:07:23 janb Exp
8 * last modfied: Mon Apr 11 16:06:51 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile dma_defs.h ../../inst/dma/inst/dma_common/rtl/dma_regdes.r
11 * id: $Id: dma_defs.h,v 1.7 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope dma */
86
87/* Register rw_data, scope dma, type rw */
88typedef unsigned int reg_dma_rw_data;
89#define REG_RD_ADDR_dma_rw_data 0
90#define REG_WR_ADDR_dma_rw_data 0
91
92/* Register rw_data_next, scope dma, type rw */
93typedef unsigned int reg_dma_rw_data_next;
94#define REG_RD_ADDR_dma_rw_data_next 4
95#define REG_WR_ADDR_dma_rw_data_next 4
96
97/* Register rw_data_buf, scope dma, type rw */
98typedef unsigned int reg_dma_rw_data_buf;
99#define REG_RD_ADDR_dma_rw_data_buf 8
100#define REG_WR_ADDR_dma_rw_data_buf 8
101
102/* Register rw_data_ctrl, scope dma, type rw */
103typedef struct {
104 unsigned int eol : 1;
105 unsigned int dummy1 : 2;
106 unsigned int out_eop : 1;
107 unsigned int intr : 1;
108 unsigned int wait : 1;
109 unsigned int dummy2 : 26;
110} reg_dma_rw_data_ctrl;
111#define REG_RD_ADDR_dma_rw_data_ctrl 12
112#define REG_WR_ADDR_dma_rw_data_ctrl 12
113
114/* Register rw_data_stat, scope dma, type rw */
115typedef struct {
116 unsigned int dummy1 : 3;
117 unsigned int in_eop : 1;
118 unsigned int dummy2 : 28;
119} reg_dma_rw_data_stat;
120#define REG_RD_ADDR_dma_rw_data_stat 16
121#define REG_WR_ADDR_dma_rw_data_stat 16
122
123/* Register rw_data_md, scope dma, type rw */
124typedef struct {
125 unsigned int md : 16;
126 unsigned int dummy1 : 16;
127} reg_dma_rw_data_md;
128#define REG_RD_ADDR_dma_rw_data_md 20
129#define REG_WR_ADDR_dma_rw_data_md 20
130
131/* Register rw_data_md_s, scope dma, type rw */
132typedef struct {
133 unsigned int md_s : 16;
134 unsigned int dummy1 : 16;
135} reg_dma_rw_data_md_s;
136#define REG_RD_ADDR_dma_rw_data_md_s 24
137#define REG_WR_ADDR_dma_rw_data_md_s 24
138
139/* Register rw_data_after, scope dma, type rw */
140typedef unsigned int reg_dma_rw_data_after;
141#define REG_RD_ADDR_dma_rw_data_after 28
142#define REG_WR_ADDR_dma_rw_data_after 28
143
144/* Register rw_ctxt, scope dma, type rw */
145typedef unsigned int reg_dma_rw_ctxt;
146#define REG_RD_ADDR_dma_rw_ctxt 32
147#define REG_WR_ADDR_dma_rw_ctxt 32
148
149/* Register rw_ctxt_next, scope dma, type rw */
150typedef unsigned int reg_dma_rw_ctxt_next;
151#define REG_RD_ADDR_dma_rw_ctxt_next 36
152#define REG_WR_ADDR_dma_rw_ctxt_next 36
153
154/* Register rw_ctxt_ctrl, scope dma, type rw */
155typedef struct {
156 unsigned int eol : 1;
157 unsigned int dummy1 : 3;
158 unsigned int intr : 1;
159 unsigned int dummy2 : 1;
160 unsigned int store_mode : 1;
161 unsigned int en : 1;
162 unsigned int dummy3 : 24;
163} reg_dma_rw_ctxt_ctrl;
164#define REG_RD_ADDR_dma_rw_ctxt_ctrl 40
165#define REG_WR_ADDR_dma_rw_ctxt_ctrl 40
166
167/* Register rw_ctxt_stat, scope dma, type rw */
168typedef struct {
169 unsigned int dummy1 : 7;
170 unsigned int dis : 1;
171 unsigned int dummy2 : 24;
172} reg_dma_rw_ctxt_stat;
173#define REG_RD_ADDR_dma_rw_ctxt_stat 44
174#define REG_WR_ADDR_dma_rw_ctxt_stat 44
175
176/* Register rw_ctxt_md0, scope dma, type rw */
177typedef struct {
178 unsigned int md0 : 16;
179 unsigned int dummy1 : 16;
180} reg_dma_rw_ctxt_md0;
181#define REG_RD_ADDR_dma_rw_ctxt_md0 48
182#define REG_WR_ADDR_dma_rw_ctxt_md0 48
183
184/* Register rw_ctxt_md0_s, scope dma, type rw */
185typedef struct {
186 unsigned int md0_s : 16;
187 unsigned int dummy1 : 16;
188} reg_dma_rw_ctxt_md0_s;
189#define REG_RD_ADDR_dma_rw_ctxt_md0_s 52
190#define REG_WR_ADDR_dma_rw_ctxt_md0_s 52
191
192/* Register rw_ctxt_md1, scope dma, type rw */
193typedef unsigned int reg_dma_rw_ctxt_md1;
194#define REG_RD_ADDR_dma_rw_ctxt_md1 56
195#define REG_WR_ADDR_dma_rw_ctxt_md1 56
196
197/* Register rw_ctxt_md1_s, scope dma, type rw */
198typedef unsigned int reg_dma_rw_ctxt_md1_s;
199#define REG_RD_ADDR_dma_rw_ctxt_md1_s 60
200#define REG_WR_ADDR_dma_rw_ctxt_md1_s 60
201
202/* Register rw_ctxt_md2, scope dma, type rw */
203typedef unsigned int reg_dma_rw_ctxt_md2;
204#define REG_RD_ADDR_dma_rw_ctxt_md2 64
205#define REG_WR_ADDR_dma_rw_ctxt_md2 64
206
207/* Register rw_ctxt_md2_s, scope dma, type rw */
208typedef unsigned int reg_dma_rw_ctxt_md2_s;
209#define REG_RD_ADDR_dma_rw_ctxt_md2_s 68
210#define REG_WR_ADDR_dma_rw_ctxt_md2_s 68
211
212/* Register rw_ctxt_md3, scope dma, type rw */
213typedef unsigned int reg_dma_rw_ctxt_md3;
214#define REG_RD_ADDR_dma_rw_ctxt_md3 72
215#define REG_WR_ADDR_dma_rw_ctxt_md3 72
216
217/* Register rw_ctxt_md3_s, scope dma, type rw */
218typedef unsigned int reg_dma_rw_ctxt_md3_s;
219#define REG_RD_ADDR_dma_rw_ctxt_md3_s 76
220#define REG_WR_ADDR_dma_rw_ctxt_md3_s 76
221
222/* Register rw_ctxt_md4, scope dma, type rw */
223typedef unsigned int reg_dma_rw_ctxt_md4;
224#define REG_RD_ADDR_dma_rw_ctxt_md4 80
225#define REG_WR_ADDR_dma_rw_ctxt_md4 80
226
227/* Register rw_ctxt_md4_s, scope dma, type rw */
228typedef unsigned int reg_dma_rw_ctxt_md4_s;
229#define REG_RD_ADDR_dma_rw_ctxt_md4_s 84
230#define REG_WR_ADDR_dma_rw_ctxt_md4_s 84
231
232/* Register rw_saved_data, scope dma, type rw */
233typedef unsigned int reg_dma_rw_saved_data;
234#define REG_RD_ADDR_dma_rw_saved_data 88
235#define REG_WR_ADDR_dma_rw_saved_data 88
236
237/* Register rw_saved_data_buf, scope dma, type rw */
238typedef unsigned int reg_dma_rw_saved_data_buf;
239#define REG_RD_ADDR_dma_rw_saved_data_buf 92
240#define REG_WR_ADDR_dma_rw_saved_data_buf 92
241
242/* Register rw_group, scope dma, type rw */
243typedef unsigned int reg_dma_rw_group;
244#define REG_RD_ADDR_dma_rw_group 96
245#define REG_WR_ADDR_dma_rw_group 96
246
247/* Register rw_group_next, scope dma, type rw */
248typedef unsigned int reg_dma_rw_group_next;
249#define REG_RD_ADDR_dma_rw_group_next 100
250#define REG_WR_ADDR_dma_rw_group_next 100
251
252/* Register rw_group_ctrl, scope dma, type rw */
253typedef struct {
254 unsigned int eol : 1;
255 unsigned int tol : 1;
256 unsigned int bol : 1;
257 unsigned int dummy1 : 1;
258 unsigned int intr : 1;
259 unsigned int dummy2 : 2;
260 unsigned int en : 1;
261 unsigned int dummy3 : 24;
262} reg_dma_rw_group_ctrl;
263#define REG_RD_ADDR_dma_rw_group_ctrl 104
264#define REG_WR_ADDR_dma_rw_group_ctrl 104
265
266/* Register rw_group_stat, scope dma, type rw */
267typedef struct {
268 unsigned int dummy1 : 7;
269 unsigned int dis : 1;
270 unsigned int dummy2 : 24;
271} reg_dma_rw_group_stat;
272#define REG_RD_ADDR_dma_rw_group_stat 108
273#define REG_WR_ADDR_dma_rw_group_stat 108
274
275/* Register rw_group_md, scope dma, type rw */
276typedef struct {
277 unsigned int md : 16;
278 unsigned int dummy1 : 16;
279} reg_dma_rw_group_md;
280#define REG_RD_ADDR_dma_rw_group_md 112
281#define REG_WR_ADDR_dma_rw_group_md 112
282
283/* Register rw_group_md_s, scope dma, type rw */
284typedef struct {
285 unsigned int md_s : 16;
286 unsigned int dummy1 : 16;
287} reg_dma_rw_group_md_s;
288#define REG_RD_ADDR_dma_rw_group_md_s 116
289#define REG_WR_ADDR_dma_rw_group_md_s 116
290
291/* Register rw_group_up, scope dma, type rw */
292typedef unsigned int reg_dma_rw_group_up;
293#define REG_RD_ADDR_dma_rw_group_up 120
294#define REG_WR_ADDR_dma_rw_group_up 120
295
296/* Register rw_group_down, scope dma, type rw */
297typedef unsigned int reg_dma_rw_group_down;
298#define REG_RD_ADDR_dma_rw_group_down 124
299#define REG_WR_ADDR_dma_rw_group_down 124
300
301/* Register rw_cmd, scope dma, type rw */
302typedef struct {
303 unsigned int cont_data : 1;
304 unsigned int dummy1 : 31;
305} reg_dma_rw_cmd;
306#define REG_RD_ADDR_dma_rw_cmd 128
307#define REG_WR_ADDR_dma_rw_cmd 128
308
309/* Register rw_cfg, scope dma, type rw */
310typedef struct {
311 unsigned int en : 1;
312 unsigned int stop : 1;
313 unsigned int dummy1 : 30;
314} reg_dma_rw_cfg;
315#define REG_RD_ADDR_dma_rw_cfg 132
316#define REG_WR_ADDR_dma_rw_cfg 132
317
318/* Register rw_stat, scope dma, type rw */
319typedef struct {
320 unsigned int mode : 5;
321 unsigned int list_state : 3;
322 unsigned int stream_cmd_src : 8;
323 unsigned int dummy1 : 8;
324 unsigned int buf : 8;
325} reg_dma_rw_stat;
326#define REG_RD_ADDR_dma_rw_stat 136
327#define REG_WR_ADDR_dma_rw_stat 136
328
329/* Register rw_intr_mask, scope dma, type rw */
330typedef struct {
331 unsigned int group : 1;
332 unsigned int ctxt : 1;
333 unsigned int data : 1;
334 unsigned int in_eop : 1;
335 unsigned int stream_cmd : 1;
336 unsigned int dummy1 : 27;
337} reg_dma_rw_intr_mask;
338#define REG_RD_ADDR_dma_rw_intr_mask 140
339#define REG_WR_ADDR_dma_rw_intr_mask 140
340
341/* Register rw_ack_intr, scope dma, type rw */
342typedef struct {
343 unsigned int group : 1;
344 unsigned int ctxt : 1;
345 unsigned int data : 1;
346 unsigned int in_eop : 1;
347 unsigned int stream_cmd : 1;
348 unsigned int dummy1 : 27;
349} reg_dma_rw_ack_intr;
350#define REG_RD_ADDR_dma_rw_ack_intr 144
351#define REG_WR_ADDR_dma_rw_ack_intr 144
352
353/* Register r_intr, scope dma, type r */
354typedef struct {
355 unsigned int group : 1;
356 unsigned int ctxt : 1;
357 unsigned int data : 1;
358 unsigned int in_eop : 1;
359 unsigned int stream_cmd : 1;
360 unsigned int dummy1 : 27;
361} reg_dma_r_intr;
362#define REG_RD_ADDR_dma_r_intr 148
363
364/* Register r_masked_intr, scope dma, type r */
365typedef struct {
366 unsigned int group : 1;
367 unsigned int ctxt : 1;
368 unsigned int data : 1;
369 unsigned int in_eop : 1;
370 unsigned int stream_cmd : 1;
371 unsigned int dummy1 : 27;
372} reg_dma_r_masked_intr;
373#define REG_RD_ADDR_dma_r_masked_intr 152
374
375/* Register rw_stream_cmd, scope dma, type rw */
376typedef struct {
377 unsigned int cmd : 10;
378 unsigned int dummy1 : 6;
379 unsigned int n : 8;
380 unsigned int dummy2 : 7;
381 unsigned int busy : 1;
382} reg_dma_rw_stream_cmd;
383#define REG_RD_ADDR_dma_rw_stream_cmd 156
384#define REG_WR_ADDR_dma_rw_stream_cmd 156
385
386
387/* Constants */
388enum {
389 regk_dma_ack_pkt = 0x00000100,
390 regk_dma_anytime = 0x00000001,
391 regk_dma_array = 0x00000008,
392 regk_dma_burst = 0x00000020,
393 regk_dma_client = 0x00000002,
394 regk_dma_copy_next = 0x00000010,
395 regk_dma_copy_up = 0x00000020,
396 regk_dma_data_at_eol = 0x00000001,
397 regk_dma_dis_c = 0x00000010,
398 regk_dma_dis_g = 0x00000020,
399 regk_dma_idle = 0x00000001,
400 regk_dma_intern = 0x00000004,
401 regk_dma_load_c = 0x00000200,
402 regk_dma_load_c_n = 0x00000280,
403 regk_dma_load_c_next = 0x00000240,
404 regk_dma_load_d = 0x00000140,
405 regk_dma_load_g = 0x00000300,
406 regk_dma_load_g_down = 0x000003c0,
407 regk_dma_load_g_next = 0x00000340,
408 regk_dma_load_g_up = 0x00000380,
409 regk_dma_next_en = 0x00000010,
410 regk_dma_next_pkt = 0x00000010,
411 regk_dma_no = 0x00000000,
412 regk_dma_only_at_wait = 0x00000000,
413 regk_dma_restore = 0x00000020,
414 regk_dma_rst = 0x00000001,
415 regk_dma_running = 0x00000004,
416 regk_dma_rw_cfg_default = 0x00000000,
417 regk_dma_rw_cmd_default = 0x00000000,
418 regk_dma_rw_intr_mask_default = 0x00000000,
419 regk_dma_rw_stat_default = 0x00000101,
420 regk_dma_rw_stream_cmd_default = 0x00000000,
421 regk_dma_save_down = 0x00000020,
422 regk_dma_save_up = 0x00000020,
423 regk_dma_set_reg = 0x00000050,
424 regk_dma_set_w_size1 = 0x00000190,
425 regk_dma_set_w_size2 = 0x000001a0,
426 regk_dma_set_w_size4 = 0x000001c0,
427 regk_dma_stopped = 0x00000002,
428 regk_dma_store_c = 0x00000002,
429 regk_dma_store_descr = 0x00000000,
430 regk_dma_store_g = 0x00000004,
431 regk_dma_store_md = 0x00000001,
432 regk_dma_sw = 0x00000008,
433 regk_dma_update_down = 0x00000020,
434 regk_dma_yes = 0x00000001
435};
436#endif /* __dma_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/eth_defs.h b/include/asm-cris/arch-v32/hwregs/eth_defs.h
new file mode 100644
index 000000000000..1196d7cc783f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/eth_defs.h
@@ -0,0 +1,384 @@
1#ifndef __eth_defs_h
2#define __eth_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/eth/rtl/eth_regs.r
7 * id: eth_regs.r,v 1.11 2005/02/09 10:48:38 kriskn Exp
8 * last modfied: Mon Apr 11 16:07:03 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile eth_defs.h ../../inst/eth/rtl/eth_regs.r
11 * id: $Id: eth_defs.h,v 1.6 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope eth */
86
87/* Register rw_ma0_lo, scope eth, type rw */
88typedef struct {
89 unsigned int addr : 32;
90} reg_eth_rw_ma0_lo;
91#define REG_RD_ADDR_eth_rw_ma0_lo 0
92#define REG_WR_ADDR_eth_rw_ma0_lo 0
93
94/* Register rw_ma0_hi, scope eth, type rw */
95typedef struct {
96 unsigned int addr : 16;
97 unsigned int dummy1 : 16;
98} reg_eth_rw_ma0_hi;
99#define REG_RD_ADDR_eth_rw_ma0_hi 4
100#define REG_WR_ADDR_eth_rw_ma0_hi 4
101
102/* Register rw_ma1_lo, scope eth, type rw */
103typedef struct {
104 unsigned int addr : 32;
105} reg_eth_rw_ma1_lo;
106#define REG_RD_ADDR_eth_rw_ma1_lo 8
107#define REG_WR_ADDR_eth_rw_ma1_lo 8
108
109/* Register rw_ma1_hi, scope eth, type rw */
110typedef struct {
111 unsigned int addr : 16;
112 unsigned int dummy1 : 16;
113} reg_eth_rw_ma1_hi;
114#define REG_RD_ADDR_eth_rw_ma1_hi 12
115#define REG_WR_ADDR_eth_rw_ma1_hi 12
116
117/* Register rw_ga_lo, scope eth, type rw */
118typedef struct {
119 unsigned int table : 32;
120} reg_eth_rw_ga_lo;
121#define REG_RD_ADDR_eth_rw_ga_lo 16
122#define REG_WR_ADDR_eth_rw_ga_lo 16
123
124/* Register rw_ga_hi, scope eth, type rw */
125typedef struct {
126 unsigned int table : 32;
127} reg_eth_rw_ga_hi;
128#define REG_RD_ADDR_eth_rw_ga_hi 20
129#define REG_WR_ADDR_eth_rw_ga_hi 20
130
131/* Register rw_gen_ctrl, scope eth, type rw */
132typedef struct {
133 unsigned int en : 1;
134 unsigned int phy : 2;
135 unsigned int protocol : 1;
136 unsigned int loopback : 1;
137 unsigned int flow_ctrl_dis : 1;
138 unsigned int dummy1 : 26;
139} reg_eth_rw_gen_ctrl;
140#define REG_RD_ADDR_eth_rw_gen_ctrl 24
141#define REG_WR_ADDR_eth_rw_gen_ctrl 24
142
143/* Register rw_rec_ctrl, scope eth, type rw */
144typedef struct {
145 unsigned int ma0 : 1;
146 unsigned int ma1 : 1;
147 unsigned int individual : 1;
148 unsigned int broadcast : 1;
149 unsigned int undersize : 1;
150 unsigned int oversize : 1;
151 unsigned int bad_crc : 1;
152 unsigned int duplex : 1;
153 unsigned int max_size : 1;
154 unsigned int dummy1 : 23;
155} reg_eth_rw_rec_ctrl;
156#define REG_RD_ADDR_eth_rw_rec_ctrl 28
157#define REG_WR_ADDR_eth_rw_rec_ctrl 28
158
159/* Register rw_tr_ctrl, scope eth, type rw */
160typedef struct {
161 unsigned int crc : 1;
162 unsigned int pad : 1;
163 unsigned int retry : 1;
164 unsigned int ignore_col : 1;
165 unsigned int cancel : 1;
166 unsigned int hsh_delay : 1;
167 unsigned int ignore_crs : 1;
168 unsigned int dummy1 : 25;
169} reg_eth_rw_tr_ctrl;
170#define REG_RD_ADDR_eth_rw_tr_ctrl 32
171#define REG_WR_ADDR_eth_rw_tr_ctrl 32
172
173/* Register rw_clr_err, scope eth, type rw */
174typedef struct {
175 unsigned int clr : 1;
176 unsigned int dummy1 : 31;
177} reg_eth_rw_clr_err;
178#define REG_RD_ADDR_eth_rw_clr_err 36
179#define REG_WR_ADDR_eth_rw_clr_err 36
180
181/* Register rw_mgm_ctrl, scope eth, type rw */
182typedef struct {
183 unsigned int mdio : 1;
184 unsigned int mdoe : 1;
185 unsigned int mdc : 1;
186 unsigned int phyclk : 1;
187 unsigned int txdata : 4;
188 unsigned int txen : 1;
189 unsigned int dummy1 : 23;
190} reg_eth_rw_mgm_ctrl;
191#define REG_RD_ADDR_eth_rw_mgm_ctrl 40
192#define REG_WR_ADDR_eth_rw_mgm_ctrl 40
193
194/* Register r_stat, scope eth, type r */
195typedef struct {
196 unsigned int mdio : 1;
197 unsigned int exc_col : 1;
198 unsigned int urun : 1;
199 unsigned int phyclk : 1;
200 unsigned int txdata : 4;
201 unsigned int txen : 1;
202 unsigned int col : 1;
203 unsigned int crs : 1;
204 unsigned int txclk : 1;
205 unsigned int rxdata : 4;
206 unsigned int rxer : 1;
207 unsigned int rxdv : 1;
208 unsigned int rxclk : 1;
209 unsigned int dummy1 : 13;
210} reg_eth_r_stat;
211#define REG_RD_ADDR_eth_r_stat 44
212
213/* Register rs_rec_cnt, scope eth, type rs */
214typedef struct {
215 unsigned int crc_err : 8;
216 unsigned int align_err : 8;
217 unsigned int oversize : 8;
218 unsigned int congestion : 8;
219} reg_eth_rs_rec_cnt;
220#define REG_RD_ADDR_eth_rs_rec_cnt 48
221
222/* Register r_rec_cnt, scope eth, type r */
223typedef struct {
224 unsigned int crc_err : 8;
225 unsigned int align_err : 8;
226 unsigned int oversize : 8;
227 unsigned int congestion : 8;
228} reg_eth_r_rec_cnt;
229#define REG_RD_ADDR_eth_r_rec_cnt 52
230
231/* Register rs_tr_cnt, scope eth, type rs */
232typedef struct {
233 unsigned int single_col : 8;
234 unsigned int mult_col : 8;
235 unsigned int late_col : 8;
236 unsigned int deferred : 8;
237} reg_eth_rs_tr_cnt;
238#define REG_RD_ADDR_eth_rs_tr_cnt 56
239
240/* Register r_tr_cnt, scope eth, type r */
241typedef struct {
242 unsigned int single_col : 8;
243 unsigned int mult_col : 8;
244 unsigned int late_col : 8;
245 unsigned int deferred : 8;
246} reg_eth_r_tr_cnt;
247#define REG_RD_ADDR_eth_r_tr_cnt 60
248
249/* Register rs_phy_cnt, scope eth, type rs */
250typedef struct {
251 unsigned int carrier_loss : 8;
252 unsigned int sqe_err : 8;
253 unsigned int dummy1 : 16;
254} reg_eth_rs_phy_cnt;
255#define REG_RD_ADDR_eth_rs_phy_cnt 64
256
257/* Register r_phy_cnt, scope eth, type r */
258typedef struct {
259 unsigned int carrier_loss : 8;
260 unsigned int sqe_err : 8;
261 unsigned int dummy1 : 16;
262} reg_eth_r_phy_cnt;
263#define REG_RD_ADDR_eth_r_phy_cnt 68
264
265/* Register rw_test_ctrl, scope eth, type rw */
266typedef struct {
267 unsigned int snmp_inc : 1;
268 unsigned int snmp : 1;
269 unsigned int backoff : 1;
270 unsigned int dummy1 : 29;
271} reg_eth_rw_test_ctrl;
272#define REG_RD_ADDR_eth_rw_test_ctrl 72
273#define REG_WR_ADDR_eth_rw_test_ctrl 72
274
275/* Register rw_intr_mask, scope eth, type rw */
276typedef struct {
277 unsigned int crc : 1;
278 unsigned int align : 1;
279 unsigned int oversize : 1;
280 unsigned int congestion : 1;
281 unsigned int single_col : 1;
282 unsigned int mult_col : 1;
283 unsigned int late_col : 1;
284 unsigned int deferred : 1;
285 unsigned int carrier_loss : 1;
286 unsigned int sqe_test_err : 1;
287 unsigned int orun : 1;
288 unsigned int urun : 1;
289 unsigned int excessive_col : 1;
290 unsigned int mdio : 1;
291 unsigned int dummy1 : 18;
292} reg_eth_rw_intr_mask;
293#define REG_RD_ADDR_eth_rw_intr_mask 76
294#define REG_WR_ADDR_eth_rw_intr_mask 76
295
296/* Register rw_ack_intr, scope eth, type rw */
297typedef struct {
298 unsigned int crc : 1;
299 unsigned int align : 1;
300 unsigned int oversize : 1;
301 unsigned int congestion : 1;
302 unsigned int single_col : 1;
303 unsigned int mult_col : 1;
304 unsigned int late_col : 1;
305 unsigned int deferred : 1;
306 unsigned int carrier_loss : 1;
307 unsigned int sqe_test_err : 1;
308 unsigned int orun : 1;
309 unsigned int urun : 1;
310 unsigned int excessive_col : 1;
311 unsigned int mdio : 1;
312 unsigned int dummy1 : 18;
313} reg_eth_rw_ack_intr;
314#define REG_RD_ADDR_eth_rw_ack_intr 80
315#define REG_WR_ADDR_eth_rw_ack_intr 80
316
317/* Register r_intr, scope eth, type r */
318typedef struct {
319 unsigned int crc : 1;
320 unsigned int align : 1;
321 unsigned int oversize : 1;
322 unsigned int congestion : 1;
323 unsigned int single_col : 1;
324 unsigned int mult_col : 1;
325 unsigned int late_col : 1;
326 unsigned int deferred : 1;
327 unsigned int carrier_loss : 1;
328 unsigned int sqe_test_err : 1;
329 unsigned int orun : 1;
330 unsigned int urun : 1;
331 unsigned int excessive_col : 1;
332 unsigned int mdio : 1;
333 unsigned int dummy1 : 18;
334} reg_eth_r_intr;
335#define REG_RD_ADDR_eth_r_intr 84
336
337/* Register r_masked_intr, scope eth, type r */
338typedef struct {
339 unsigned int crc : 1;
340 unsigned int align : 1;
341 unsigned int oversize : 1;
342 unsigned int congestion : 1;
343 unsigned int single_col : 1;
344 unsigned int mult_col : 1;
345 unsigned int late_col : 1;
346 unsigned int deferred : 1;
347 unsigned int carrier_loss : 1;
348 unsigned int sqe_test_err : 1;
349 unsigned int orun : 1;
350 unsigned int urun : 1;
351 unsigned int excessive_col : 1;
352 unsigned int mdio : 1;
353 unsigned int dummy1 : 18;
354} reg_eth_r_masked_intr;
355#define REG_RD_ADDR_eth_r_masked_intr 88
356
357
358/* Constants */
359enum {
360 regk_eth_discard = 0x00000000,
361 regk_eth_ether = 0x00000000,
362 regk_eth_full = 0x00000001,
363 regk_eth_half = 0x00000000,
364 regk_eth_hsh = 0x00000001,
365 regk_eth_mii = 0x00000001,
366 regk_eth_mii_clk = 0x00000000,
367 regk_eth_mii_rec = 0x00000002,
368 regk_eth_no = 0x00000000,
369 regk_eth_rec = 0x00000001,
370 regk_eth_rw_ga_hi_default = 0x00000000,
371 regk_eth_rw_ga_lo_default = 0x00000000,
372 regk_eth_rw_gen_ctrl_default = 0x00000000,
373 regk_eth_rw_intr_mask_default = 0x00000000,
374 regk_eth_rw_ma0_hi_default = 0x00000000,
375 regk_eth_rw_ma0_lo_default = 0x00000000,
376 regk_eth_rw_ma1_hi_default = 0x00000000,
377 regk_eth_rw_ma1_lo_default = 0x00000000,
378 regk_eth_rw_mgm_ctrl_default = 0x00000000,
379 regk_eth_rw_test_ctrl_default = 0x00000000,
380 regk_eth_size1518 = 0x00000000,
381 regk_eth_size1522 = 0x00000001,
382 regk_eth_yes = 0x00000001
383};
384#endif /* __eth_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/extmem_defs.h b/include/asm-cris/arch-v32/hwregs/extmem_defs.h
new file mode 100644
index 000000000000..c47b5ca48ece
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/extmem_defs.h
@@ -0,0 +1,369 @@
1#ifndef __extmem_defs_h
2#define __extmem_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/ext_mem/mod/extmem_regs.r
7 * id: extmem_regs.r,v 1.1 2004/02/16 13:29:30 np Exp
8 * last modfied: Tue Mar 30 22:26:21 2004
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile extmem_defs.h ../../inst/ext_mem/mod/extmem_regs.r
11 * id: $Id: extmem_defs.h,v 1.5 2004/06/04 07:15:33 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope extmem */
86
87/* Register rw_cse0_cfg, scope extmem, type rw */
88typedef struct {
89 unsigned int lw : 6;
90 unsigned int ew : 3;
91 unsigned int zw : 3;
92 unsigned int aw : 2;
93 unsigned int dw : 2;
94 unsigned int ewb : 2;
95 unsigned int bw : 1;
96 unsigned int mode : 1;
97 unsigned int erc_en : 1;
98 unsigned int dummy1 : 6;
99 unsigned int size : 3;
100 unsigned int log : 1;
101 unsigned int en : 1;
102} reg_extmem_rw_cse0_cfg;
103#define REG_RD_ADDR_extmem_rw_cse0_cfg 0
104#define REG_WR_ADDR_extmem_rw_cse0_cfg 0
105
106/* Register rw_cse1_cfg, scope extmem, type rw */
107typedef struct {
108 unsigned int lw : 6;
109 unsigned int ew : 3;
110 unsigned int zw : 3;
111 unsigned int aw : 2;
112 unsigned int dw : 2;
113 unsigned int ewb : 2;
114 unsigned int bw : 1;
115 unsigned int mode : 1;
116 unsigned int erc_en : 1;
117 unsigned int dummy1 : 6;
118 unsigned int size : 3;
119 unsigned int log : 1;
120 unsigned int en : 1;
121} reg_extmem_rw_cse1_cfg;
122#define REG_RD_ADDR_extmem_rw_cse1_cfg 4
123#define REG_WR_ADDR_extmem_rw_cse1_cfg 4
124
125/* Register rw_csr0_cfg, scope extmem, type rw */
126typedef struct {
127 unsigned int lw : 6;
128 unsigned int ew : 3;
129 unsigned int zw : 3;
130 unsigned int aw : 2;
131 unsigned int dw : 2;
132 unsigned int ewb : 2;
133 unsigned int bw : 1;
134 unsigned int mode : 1;
135 unsigned int erc_en : 1;
136 unsigned int dummy1 : 6;
137 unsigned int size : 3;
138 unsigned int log : 1;
139 unsigned int en : 1;
140} reg_extmem_rw_csr0_cfg;
141#define REG_RD_ADDR_extmem_rw_csr0_cfg 8
142#define REG_WR_ADDR_extmem_rw_csr0_cfg 8
143
144/* Register rw_csr1_cfg, scope extmem, type rw */
145typedef struct {
146 unsigned int lw : 6;
147 unsigned int ew : 3;
148 unsigned int zw : 3;
149 unsigned int aw : 2;
150 unsigned int dw : 2;
151 unsigned int ewb : 2;
152 unsigned int bw : 1;
153 unsigned int mode : 1;
154 unsigned int erc_en : 1;
155 unsigned int dummy1 : 6;
156 unsigned int size : 3;
157 unsigned int log : 1;
158 unsigned int en : 1;
159} reg_extmem_rw_csr1_cfg;
160#define REG_RD_ADDR_extmem_rw_csr1_cfg 12
161#define REG_WR_ADDR_extmem_rw_csr1_cfg 12
162
163/* Register rw_csp0_cfg, scope extmem, type rw */
164typedef struct {
165 unsigned int lw : 6;
166 unsigned int ew : 3;
167 unsigned int zw : 3;
168 unsigned int aw : 2;
169 unsigned int dw : 2;
170 unsigned int ewb : 2;
171 unsigned int bw : 1;
172 unsigned int mode : 1;
173 unsigned int erc_en : 1;
174 unsigned int dummy1 : 6;
175 unsigned int size : 3;
176 unsigned int log : 1;
177 unsigned int en : 1;
178} reg_extmem_rw_csp0_cfg;
179#define REG_RD_ADDR_extmem_rw_csp0_cfg 16
180#define REG_WR_ADDR_extmem_rw_csp0_cfg 16
181
182/* Register rw_csp1_cfg, scope extmem, type rw */
183typedef struct {
184 unsigned int lw : 6;
185 unsigned int ew : 3;
186 unsigned int zw : 3;
187 unsigned int aw : 2;
188 unsigned int dw : 2;
189 unsigned int ewb : 2;
190 unsigned int bw : 1;
191 unsigned int mode : 1;
192 unsigned int erc_en : 1;
193 unsigned int dummy1 : 6;
194 unsigned int size : 3;
195 unsigned int log : 1;
196 unsigned int en : 1;
197} reg_extmem_rw_csp1_cfg;
198#define REG_RD_ADDR_extmem_rw_csp1_cfg 20
199#define REG_WR_ADDR_extmem_rw_csp1_cfg 20
200
201/* Register rw_csp2_cfg, scope extmem, type rw */
202typedef struct {
203 unsigned int lw : 6;
204 unsigned int ew : 3;
205 unsigned int zw : 3;
206 unsigned int aw : 2;
207 unsigned int dw : 2;
208 unsigned int ewb : 2;
209 unsigned int bw : 1;
210 unsigned int mode : 1;
211 unsigned int erc_en : 1;
212 unsigned int dummy1 : 6;
213 unsigned int size : 3;
214 unsigned int log : 1;
215 unsigned int en : 1;
216} reg_extmem_rw_csp2_cfg;
217#define REG_RD_ADDR_extmem_rw_csp2_cfg 24
218#define REG_WR_ADDR_extmem_rw_csp2_cfg 24
219
220/* Register rw_csp3_cfg, scope extmem, type rw */
221typedef struct {
222 unsigned int lw : 6;
223 unsigned int ew : 3;
224 unsigned int zw : 3;
225 unsigned int aw : 2;
226 unsigned int dw : 2;
227 unsigned int ewb : 2;
228 unsigned int bw : 1;
229 unsigned int mode : 1;
230 unsigned int erc_en : 1;
231 unsigned int dummy1 : 6;
232 unsigned int size : 3;
233 unsigned int log : 1;
234 unsigned int en : 1;
235} reg_extmem_rw_csp3_cfg;
236#define REG_RD_ADDR_extmem_rw_csp3_cfg 28
237#define REG_WR_ADDR_extmem_rw_csp3_cfg 28
238
239/* Register rw_csp4_cfg, scope extmem, type rw */
240typedef struct {
241 unsigned int lw : 6;
242 unsigned int ew : 3;
243 unsigned int zw : 3;
244 unsigned int aw : 2;
245 unsigned int dw : 2;
246 unsigned int ewb : 2;
247 unsigned int bw : 1;
248 unsigned int mode : 1;
249 unsigned int erc_en : 1;
250 unsigned int dummy1 : 6;
251 unsigned int size : 3;
252 unsigned int log : 1;
253 unsigned int en : 1;
254} reg_extmem_rw_csp4_cfg;
255#define REG_RD_ADDR_extmem_rw_csp4_cfg 32
256#define REG_WR_ADDR_extmem_rw_csp4_cfg 32
257
258/* Register rw_csp5_cfg, scope extmem, type rw */
259typedef struct {
260 unsigned int lw : 6;
261 unsigned int ew : 3;
262 unsigned int zw : 3;
263 unsigned int aw : 2;
264 unsigned int dw : 2;
265 unsigned int ewb : 2;
266 unsigned int bw : 1;
267 unsigned int mode : 1;
268 unsigned int erc_en : 1;
269 unsigned int dummy1 : 6;
270 unsigned int size : 3;
271 unsigned int log : 1;
272 unsigned int en : 1;
273} reg_extmem_rw_csp5_cfg;
274#define REG_RD_ADDR_extmem_rw_csp5_cfg 36
275#define REG_WR_ADDR_extmem_rw_csp5_cfg 36
276
277/* Register rw_csp6_cfg, scope extmem, type rw */
278typedef struct {
279 unsigned int lw : 6;
280 unsigned int ew : 3;
281 unsigned int zw : 3;
282 unsigned int aw : 2;
283 unsigned int dw : 2;
284 unsigned int ewb : 2;
285 unsigned int bw : 1;
286 unsigned int mode : 1;
287 unsigned int erc_en : 1;
288 unsigned int dummy1 : 6;
289 unsigned int size : 3;
290 unsigned int log : 1;
291 unsigned int en : 1;
292} reg_extmem_rw_csp6_cfg;
293#define REG_RD_ADDR_extmem_rw_csp6_cfg 40
294#define REG_WR_ADDR_extmem_rw_csp6_cfg 40
295
296/* Register rw_css_cfg, scope extmem, type rw */
297typedef struct {
298 unsigned int lw : 6;
299 unsigned int ew : 3;
300 unsigned int zw : 3;
301 unsigned int aw : 2;
302 unsigned int dw : 2;
303 unsigned int ewb : 2;
304 unsigned int bw : 1;
305 unsigned int mode : 1;
306 unsigned int erc_en : 1;
307 unsigned int dummy1 : 6;
308 unsigned int size : 3;
309 unsigned int log : 1;
310 unsigned int en : 1;
311} reg_extmem_rw_css_cfg;
312#define REG_RD_ADDR_extmem_rw_css_cfg 44
313#define REG_WR_ADDR_extmem_rw_css_cfg 44
314
315/* Register rw_status_handle, scope extmem, type rw */
316typedef struct {
317 unsigned int h : 32;
318} reg_extmem_rw_status_handle;
319#define REG_RD_ADDR_extmem_rw_status_handle 48
320#define REG_WR_ADDR_extmem_rw_status_handle 48
321
322/* Register rw_wait_pin, scope extmem, type rw */
323typedef struct {
324 unsigned int val : 16;
325 unsigned int dummy1 : 15;
326 unsigned int start : 1;
327} reg_extmem_rw_wait_pin;
328#define REG_RD_ADDR_extmem_rw_wait_pin 52
329#define REG_WR_ADDR_extmem_rw_wait_pin 52
330
331/* Register rw_gated_csp, scope extmem, type rw */
332typedef struct {
333 unsigned int dummy1 : 31;
334 unsigned int en : 1;
335} reg_extmem_rw_gated_csp;
336#define REG_RD_ADDR_extmem_rw_gated_csp 56
337#define REG_WR_ADDR_extmem_rw_gated_csp 56
338
339
340/* Constants */
341enum {
342 regk_extmem_b16 = 0x00000001,
343 regk_extmem_b32 = 0x00000000,
344 regk_extmem_bwe = 0x00000000,
345 regk_extmem_cwe = 0x00000001,
346 regk_extmem_no = 0x00000000,
347 regk_extmem_rw_cse0_cfg_default = 0x000006cf,
348 regk_extmem_rw_cse1_cfg_default = 0x000006cf,
349 regk_extmem_rw_csp0_cfg_default = 0x000006cf,
350 regk_extmem_rw_csp1_cfg_default = 0x000006cf,
351 regk_extmem_rw_csp2_cfg_default = 0x000006cf,
352 regk_extmem_rw_csp3_cfg_default = 0x000006cf,
353 regk_extmem_rw_csp4_cfg_default = 0x000006cf,
354 regk_extmem_rw_csp5_cfg_default = 0x000006cf,
355 regk_extmem_rw_csp6_cfg_default = 0x000006cf,
356 regk_extmem_rw_csr0_cfg_default = 0x000006cf,
357 regk_extmem_rw_csr1_cfg_default = 0x000006cf,
358 regk_extmem_rw_css_cfg_default = 0x000006cf,
359 regk_extmem_s128KB = 0x00000000,
360 regk_extmem_s16MB = 0x00000005,
361 regk_extmem_s1MB = 0x00000001,
362 regk_extmem_s2MB = 0x00000002,
363 regk_extmem_s32MB = 0x00000006,
364 regk_extmem_s4MB = 0x00000003,
365 regk_extmem_s64MB = 0x00000007,
366 regk_extmem_s8MB = 0x00000004,
367 regk_extmem_yes = 0x00000001
368};
369#endif /* __extmem_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/gio_defs.h b/include/asm-cris/arch-v32/hwregs/gio_defs.h
new file mode 100644
index 000000000000..3e9a0b25366f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/gio_defs.h
@@ -0,0 +1,295 @@
1#ifndef __gio_defs_h
2#define __gio_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/gio/rtl/gio_regs.r
7 * id: gio_regs.r,v 1.5 2005/02/04 09:43:21 perz Exp
8 * last modfied: Mon Apr 11 16:07:47 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile gio_defs.h ../../inst/gio/rtl/gio_regs.r
11 * id: $Id: gio_defs.h,v 1.6 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope gio */
86
87/* Register rw_pa_dout, scope gio, type rw */
88typedef struct {
89 unsigned int data : 8;
90 unsigned int dummy1 : 24;
91} reg_gio_rw_pa_dout;
92#define REG_RD_ADDR_gio_rw_pa_dout 0
93#define REG_WR_ADDR_gio_rw_pa_dout 0
94
95/* Register r_pa_din, scope gio, type r */
96typedef struct {
97 unsigned int data : 8;
98 unsigned int dummy1 : 24;
99} reg_gio_r_pa_din;
100#define REG_RD_ADDR_gio_r_pa_din 4
101
102/* Register rw_pa_oe, scope gio, type rw */
103typedef struct {
104 unsigned int oe : 8;
105 unsigned int dummy1 : 24;
106} reg_gio_rw_pa_oe;
107#define REG_RD_ADDR_gio_rw_pa_oe 8
108#define REG_WR_ADDR_gio_rw_pa_oe 8
109
110/* Register rw_intr_cfg, scope gio, type rw */
111typedef struct {
112 unsigned int pa0 : 3;
113 unsigned int pa1 : 3;
114 unsigned int pa2 : 3;
115 unsigned int pa3 : 3;
116 unsigned int pa4 : 3;
117 unsigned int pa5 : 3;
118 unsigned int pa6 : 3;
119 unsigned int pa7 : 3;
120 unsigned int dummy1 : 8;
121} reg_gio_rw_intr_cfg;
122#define REG_RD_ADDR_gio_rw_intr_cfg 12
123#define REG_WR_ADDR_gio_rw_intr_cfg 12
124
125/* Register rw_intr_mask, scope gio, type rw */
126typedef struct {
127 unsigned int pa0 : 1;
128 unsigned int pa1 : 1;
129 unsigned int pa2 : 1;
130 unsigned int pa3 : 1;
131 unsigned int pa4 : 1;
132 unsigned int pa5 : 1;
133 unsigned int pa6 : 1;
134 unsigned int pa7 : 1;
135 unsigned int dummy1 : 24;
136} reg_gio_rw_intr_mask;
137#define REG_RD_ADDR_gio_rw_intr_mask 16
138#define REG_WR_ADDR_gio_rw_intr_mask 16
139
140/* Register rw_ack_intr, scope gio, type rw */
141typedef struct {
142 unsigned int pa0 : 1;
143 unsigned int pa1 : 1;
144 unsigned int pa2 : 1;
145 unsigned int pa3 : 1;
146 unsigned int pa4 : 1;
147 unsigned int pa5 : 1;
148 unsigned int pa6 : 1;
149 unsigned int pa7 : 1;
150 unsigned int dummy1 : 24;
151} reg_gio_rw_ack_intr;
152#define REG_RD_ADDR_gio_rw_ack_intr 20
153#define REG_WR_ADDR_gio_rw_ack_intr 20
154
155/* Register r_intr, scope gio, type r */
156typedef struct {
157 unsigned int pa0 : 1;
158 unsigned int pa1 : 1;
159 unsigned int pa2 : 1;
160 unsigned int pa3 : 1;
161 unsigned int pa4 : 1;
162 unsigned int pa5 : 1;
163 unsigned int pa6 : 1;
164 unsigned int pa7 : 1;
165 unsigned int dummy1 : 24;
166} reg_gio_r_intr;
167#define REG_RD_ADDR_gio_r_intr 24
168
169/* Register r_masked_intr, scope gio, type r */
170typedef struct {
171 unsigned int pa0 : 1;
172 unsigned int pa1 : 1;
173 unsigned int pa2 : 1;
174 unsigned int pa3 : 1;
175 unsigned int pa4 : 1;
176 unsigned int pa5 : 1;
177 unsigned int pa6 : 1;
178 unsigned int pa7 : 1;
179 unsigned int dummy1 : 24;
180} reg_gio_r_masked_intr;
181#define REG_RD_ADDR_gio_r_masked_intr 28
182
183/* Register rw_pb_dout, scope gio, type rw */
184typedef struct {
185 unsigned int data : 18;
186 unsigned int dummy1 : 14;
187} reg_gio_rw_pb_dout;
188#define REG_RD_ADDR_gio_rw_pb_dout 32
189#define REG_WR_ADDR_gio_rw_pb_dout 32
190
191/* Register r_pb_din, scope gio, type r */
192typedef struct {
193 unsigned int data : 18;
194 unsigned int dummy1 : 14;
195} reg_gio_r_pb_din;
196#define REG_RD_ADDR_gio_r_pb_din 36
197
198/* Register rw_pb_oe, scope gio, type rw */
199typedef struct {
200 unsigned int oe : 18;
201 unsigned int dummy1 : 14;
202} reg_gio_rw_pb_oe;
203#define REG_RD_ADDR_gio_rw_pb_oe 40
204#define REG_WR_ADDR_gio_rw_pb_oe 40
205
206/* Register rw_pc_dout, scope gio, type rw */
207typedef struct {
208 unsigned int data : 18;
209 unsigned int dummy1 : 14;
210} reg_gio_rw_pc_dout;
211#define REG_RD_ADDR_gio_rw_pc_dout 48
212#define REG_WR_ADDR_gio_rw_pc_dout 48
213
214/* Register r_pc_din, scope gio, type r */
215typedef struct {
216 unsigned int data : 18;
217 unsigned int dummy1 : 14;
218} reg_gio_r_pc_din;
219#define REG_RD_ADDR_gio_r_pc_din 52
220
221/* Register rw_pc_oe, scope gio, type rw */
222typedef struct {
223 unsigned int oe : 18;
224 unsigned int dummy1 : 14;
225} reg_gio_rw_pc_oe;
226#define REG_RD_ADDR_gio_rw_pc_oe 56
227#define REG_WR_ADDR_gio_rw_pc_oe 56
228
229/* Register rw_pd_dout, scope gio, type rw */
230typedef struct {
231 unsigned int data : 18;
232 unsigned int dummy1 : 14;
233} reg_gio_rw_pd_dout;
234#define REG_RD_ADDR_gio_rw_pd_dout 64
235#define REG_WR_ADDR_gio_rw_pd_dout 64
236
237/* Register r_pd_din, scope gio, type r */
238typedef struct {
239 unsigned int data : 18;
240 unsigned int dummy1 : 14;
241} reg_gio_r_pd_din;
242#define REG_RD_ADDR_gio_r_pd_din 68
243
244/* Register rw_pd_oe, scope gio, type rw */
245typedef struct {
246 unsigned int oe : 18;
247 unsigned int dummy1 : 14;
248} reg_gio_rw_pd_oe;
249#define REG_RD_ADDR_gio_rw_pd_oe 72
250#define REG_WR_ADDR_gio_rw_pd_oe 72
251
252/* Register rw_pe_dout, scope gio, type rw */
253typedef struct {
254 unsigned int data : 18;
255 unsigned int dummy1 : 14;
256} reg_gio_rw_pe_dout;
257#define REG_RD_ADDR_gio_rw_pe_dout 80
258#define REG_WR_ADDR_gio_rw_pe_dout 80
259
260/* Register r_pe_din, scope gio, type r */
261typedef struct {
262 unsigned int data : 18;
263 unsigned int dummy1 : 14;
264} reg_gio_r_pe_din;
265#define REG_RD_ADDR_gio_r_pe_din 84
266
267/* Register rw_pe_oe, scope gio, type rw */
268typedef struct {
269 unsigned int oe : 18;
270 unsigned int dummy1 : 14;
271} reg_gio_rw_pe_oe;
272#define REG_RD_ADDR_gio_rw_pe_oe 88
273#define REG_WR_ADDR_gio_rw_pe_oe 88
274
275
276/* Constants */
277enum {
278 regk_gio_anyedge = 0x00000007,
279 regk_gio_hi = 0x00000001,
280 regk_gio_lo = 0x00000002,
281 regk_gio_negedge = 0x00000006,
282 regk_gio_no = 0x00000000,
283 regk_gio_off = 0x00000000,
284 regk_gio_posedge = 0x00000005,
285 regk_gio_rw_intr_cfg_default = 0x00000000,
286 regk_gio_rw_intr_mask_default = 0x00000000,
287 regk_gio_rw_pa_oe_default = 0x00000000,
288 regk_gio_rw_pb_oe_default = 0x00000000,
289 regk_gio_rw_pc_oe_default = 0x00000000,
290 regk_gio_rw_pd_oe_default = 0x00000000,
291 regk_gio_rw_pe_oe_default = 0x00000000,
292 regk_gio_set = 0x00000003,
293 regk_gio_yes = 0x00000001
294};
295#endif /* __gio_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/intr_vect.h b/include/asm-cris/arch-v32/hwregs/intr_vect.h
new file mode 100644
index 000000000000..5c1b28fb205d
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/intr_vect.h
@@ -0,0 +1,39 @@
1/* Interrupt vector numbers autogenerated by /n/asic/design/tools/rdesc/src/rdes2intr version
2 from ../../inst/intr_vect/rtl/guinness/ivmask.config.r
3version . */
4
5#ifndef _______INST_INTR_VECT_RTL_GUINNESS_IVMASK_CONFIG_R
6#define _______INST_INTR_VECT_RTL_GUINNESS_IVMASK_CONFIG_R
7#define MEMARB_INTR_VECT 0x31
8#define GEN_IO_INTR_VECT 0x32
9#define IOP0_INTR_VECT 0x33
10#define IOP1_INTR_VECT 0x34
11#define IOP2_INTR_VECT 0x35
12#define IOP3_INTR_VECT 0x36
13#define DMA0_INTR_VECT 0x37
14#define DMA1_INTR_VECT 0x38
15#define DMA2_INTR_VECT 0x39
16#define DMA3_INTR_VECT 0x3a
17#define DMA4_INTR_VECT 0x3b
18#define DMA5_INTR_VECT 0x3c
19#define DMA6_INTR_VECT 0x3d
20#define DMA7_INTR_VECT 0x3e
21#define DMA8_INTR_VECT 0x3f
22#define DMA9_INTR_VECT 0x40
23#define ATA_INTR_VECT 0x41
24#define SSER0_INTR_VECT 0x42
25#define SSER1_INTR_VECT 0x43
26#define SER0_INTR_VECT 0x44
27#define SER1_INTR_VECT 0x45
28#define SER2_INTR_VECT 0x46
29#define SER3_INTR_VECT 0x47
30#define P21_INTR_VECT 0x48
31#define ETH0_INTR_VECT 0x49
32#define ETH1_INTR_VECT 0x4a
33#define TIMER_INTR_VECT 0x4b
34#define BIF_ARB_INTR_VECT 0x4c
35#define BIF_DMA_INTR_VECT 0x4d
36#define EXT_INTR_VECT 0x4e
37#define IPI_INTR_VECT 0x4f
38
39#endif
diff --git a/include/asm-cris/arch-v32/hwregs/intr_vect_defs.h b/include/asm-cris/arch-v32/hwregs/intr_vect_defs.h
new file mode 100644
index 000000000000..535aaf1b4b52
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/intr_vect_defs.h
@@ -0,0 +1,225 @@
1#ifndef __intr_vect_defs_h
2#define __intr_vect_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/intr_vect/rtl/guinness/ivmask.config.r
7 * id: ivmask.config.r,v 1.4 2005/02/15 16:05:38 stefans Exp
8 * last modfied: Mon Apr 11 16:08:03 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile intr_vect_defs.h ../../inst/intr_vect/rtl/guinness/ivmask.config.r
11 * id: $Id: intr_vect_defs.h,v 1.8 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope intr_vect */
86
87/* Register rw_mask, scope intr_vect, type rw */
88typedef struct {
89 unsigned int memarb : 1;
90 unsigned int gen_io : 1;
91 unsigned int iop0 : 1;
92 unsigned int iop1 : 1;
93 unsigned int iop2 : 1;
94 unsigned int iop3 : 1;
95 unsigned int dma0 : 1;
96 unsigned int dma1 : 1;
97 unsigned int dma2 : 1;
98 unsigned int dma3 : 1;
99 unsigned int dma4 : 1;
100 unsigned int dma5 : 1;
101 unsigned int dma6 : 1;
102 unsigned int dma7 : 1;
103 unsigned int dma8 : 1;
104 unsigned int dma9 : 1;
105 unsigned int ata : 1;
106 unsigned int sser0 : 1;
107 unsigned int sser1 : 1;
108 unsigned int ser0 : 1;
109 unsigned int ser1 : 1;
110 unsigned int ser2 : 1;
111 unsigned int ser3 : 1;
112 unsigned int p21 : 1;
113 unsigned int eth0 : 1;
114 unsigned int eth1 : 1;
115 unsigned int timer : 1;
116 unsigned int bif_arb : 1;
117 unsigned int bif_dma : 1;
118 unsigned int ext : 1;
119 unsigned int dummy1 : 2;
120} reg_intr_vect_rw_mask;
121#define REG_RD_ADDR_intr_vect_rw_mask 0
122#define REG_WR_ADDR_intr_vect_rw_mask 0
123
124/* Register r_vect, scope intr_vect, type r */
125typedef struct {
126 unsigned int memarb : 1;
127 unsigned int gen_io : 1;
128 unsigned int iop0 : 1;
129 unsigned int iop1 : 1;
130 unsigned int iop2 : 1;
131 unsigned int iop3 : 1;
132 unsigned int dma0 : 1;
133 unsigned int dma1 : 1;
134 unsigned int dma2 : 1;
135 unsigned int dma3 : 1;
136 unsigned int dma4 : 1;
137 unsigned int dma5 : 1;
138 unsigned int dma6 : 1;
139 unsigned int dma7 : 1;
140 unsigned int dma8 : 1;
141 unsigned int dma9 : 1;
142 unsigned int ata : 1;
143 unsigned int sser0 : 1;
144 unsigned int sser1 : 1;
145 unsigned int ser0 : 1;
146 unsigned int ser1 : 1;
147 unsigned int ser2 : 1;
148 unsigned int ser3 : 1;
149 unsigned int p21 : 1;
150 unsigned int eth0 : 1;
151 unsigned int eth1 : 1;
152 unsigned int timer : 1;
153 unsigned int bif_arb : 1;
154 unsigned int bif_dma : 1;
155 unsigned int ext : 1;
156 unsigned int dummy1 : 2;
157} reg_intr_vect_r_vect;
158#define REG_RD_ADDR_intr_vect_r_vect 4
159
160/* Register r_masked_vect, scope intr_vect, type r */
161typedef struct {
162 unsigned int memarb : 1;
163 unsigned int gen_io : 1;
164 unsigned int iop0 : 1;
165 unsigned int iop1 : 1;
166 unsigned int iop2 : 1;
167 unsigned int iop3 : 1;
168 unsigned int dma0 : 1;
169 unsigned int dma1 : 1;
170 unsigned int dma2 : 1;
171 unsigned int dma3 : 1;
172 unsigned int dma4 : 1;
173 unsigned int dma5 : 1;
174 unsigned int dma6 : 1;
175 unsigned int dma7 : 1;
176 unsigned int dma8 : 1;
177 unsigned int dma9 : 1;
178 unsigned int ata : 1;
179 unsigned int sser0 : 1;
180 unsigned int sser1 : 1;
181 unsigned int ser0 : 1;
182 unsigned int ser1 : 1;
183 unsigned int ser2 : 1;
184 unsigned int ser3 : 1;
185 unsigned int p21 : 1;
186 unsigned int eth0 : 1;
187 unsigned int eth1 : 1;
188 unsigned int timer : 1;
189 unsigned int bif_arb : 1;
190 unsigned int bif_dma : 1;
191 unsigned int ext : 1;
192 unsigned int dummy1 : 2;
193} reg_intr_vect_r_masked_vect;
194#define REG_RD_ADDR_intr_vect_r_masked_vect 8
195
196/* Register r_nmi, scope intr_vect, type r */
197typedef struct {
198 unsigned int ext : 1;
199 unsigned int watchdog : 1;
200 unsigned int dummy1 : 30;
201} reg_intr_vect_r_nmi;
202#define REG_RD_ADDR_intr_vect_r_nmi 12
203
204/* Register r_guru, scope intr_vect, type r */
205typedef struct {
206 unsigned int jtag : 1;
207 unsigned int dummy1 : 31;
208} reg_intr_vect_r_guru;
209#define REG_RD_ADDR_intr_vect_r_guru 16
210
211/* Register rw_ipi, scope intr_vect, type rw */
212typedef struct
213{
214 unsigned int vector;
215} reg_intr_vect_rw_ipi;
216#define REG_RD_ADDR_intr_vect_rw_ipi 20
217#define REG_WR_ADDR_intr_vect_rw_ipi 20
218
219/* Constants */
220enum {
221 regk_intr_vect_off = 0x00000000,
222 regk_intr_vect_on = 0x00000001,
223 regk_intr_vect_rw_mask_default = 0x00000000
224};
225#endif /* __intr_vect_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/Makefile b/include/asm-cris/arch-v32/hwregs/iop/Makefile
new file mode 100644
index 000000000000..a90056a095e3
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/Makefile
@@ -0,0 +1,146 @@
1# $Id: Makefile,v 1.3 2004/01/07 20:34:55 johana Exp $
2# Makefile to generate or copy the latest register definitions
3# and related datastructures and helpermacros.
4# The offical place for these files is probably at:
5RELEASE ?= r1_alfa5
6IOPOFFICIAL_INCDIR = /n/asic/projects/guinness/releases/$(RELEASE)/design/top/sw/include/
7
8IOPROCDIR = /n/asic/design/io/io_proc/rtl
9
10IOPROCINCL_FILES =
11IOPROCINCL_FILES2=
12IOPROCINCL_FILES += iop_crc_par_defs.h
13IOPROCINCL_FILES += iop_dmc_in_defs.h
14IOPROCINCL_FILES += iop_dmc_out_defs.h
15IOPROCINCL_FILES += iop_fifo_in_defs.h
16IOPROCINCL_FILES += iop_fifo_in_xtra_defs.h
17IOPROCINCL_FILES += iop_fifo_out_defs.h
18IOPROCINCL_FILES += iop_fifo_out_xtra_defs.h
19IOPROCINCL_FILES += iop_mpu_defs.h
20IOPROCINCL_FILES2+= iop_mpu_macros.h
21IOPROCINCL_FILES2+= iop_reg_space.h
22IOPROCINCL_FILES += iop_sap_in_defs.h
23IOPROCINCL_FILES += iop_sap_out_defs.h
24IOPROCINCL_FILES += iop_scrc_in_defs.h
25IOPROCINCL_FILES += iop_scrc_out_defs.h
26IOPROCINCL_FILES += iop_spu_defs.h
27# in guiness/
28IOPROCINCL_FILES += iop_sw_cfg_defs.h
29IOPROCINCL_FILES += iop_sw_cpu_defs.h
30IOPROCINCL_FILES += iop_sw_mpu_defs.h
31IOPROCINCL_FILES += iop_sw_spu_defs.h
32#
33IOPROCINCL_FILES += iop_timer_grp_defs.h
34IOPROCINCL_FILES += iop_trigger_grp_defs.h
35# in guiness/
36IOPROCINCL_FILES += iop_version_defs.h
37
38IOPROCASMINCL_FILES = $(patsubst %_defs.h,%_defs_asm.h,$(IOPROCINCL_FILES))
39IOPROCASMINCL_FILES+= iop_reg_space_asm.h
40
41
42IOPROCREGDESC =
43IOPROCREGDESC += $(IOPROCDIR)/iop_crc_par.r
44#IOPROCREGDESC += $(IOPROCDIR)/iop_crc_ser.r
45IOPROCREGDESC += $(IOPROCDIR)/iop_dmc_in.r
46IOPROCREGDESC += $(IOPROCDIR)/iop_dmc_out.r
47IOPROCREGDESC += $(IOPROCDIR)/iop_fifo_in.r
48IOPROCREGDESC += $(IOPROCDIR)/iop_fifo_in_xtra.r
49IOPROCREGDESC += $(IOPROCDIR)/iop_fifo_out.r
50IOPROCREGDESC += $(IOPROCDIR)/iop_fifo_out_xtra.r
51IOPROCREGDESC += $(IOPROCDIR)/iop_mpu.r
52IOPROCREGDESC += $(IOPROCDIR)/iop_sap_in.r
53IOPROCREGDESC += $(IOPROCDIR)/iop_sap_out.r
54IOPROCREGDESC += $(IOPROCDIR)/iop_scrc_in.r
55IOPROCREGDESC += $(IOPROCDIR)/iop_scrc_out.r
56IOPROCREGDESC += $(IOPROCDIR)/iop_spu.r
57IOPROCREGDESC += $(IOPROCDIR)/guinness/iop_sw_cfg.r
58IOPROCREGDESC += $(IOPROCDIR)/guinness/iop_sw_cpu.r
59IOPROCREGDESC += $(IOPROCDIR)/guinness/iop_sw_mpu.r
60IOPROCREGDESC += $(IOPROCDIR)/guinness/iop_sw_spu.r
61IOPROCREGDESC += $(IOPROCDIR)/iop_timer_grp.r
62IOPROCREGDESC += $(IOPROCDIR)/iop_trigger_grp.r
63IOPROCREGDESC += $(IOPROCDIR)/guinness/iop_version.r
64
65
66RDES2C = /n/asic/bin/rdes2c
67RDES2C = /n/asic/design/tools/rdesc/rdes2c
68RDES2INTR = /n/asic/design/tools/rdesc/rdes2intr
69RDES2TXT = /n/asic/design/tools/rdesc/rdes2txt
70
71## all - Just print help - you probably want to do 'make gen'
72all: help
73
74## help - This help
75help:
76 @grep '^## ' Makefile
77
78## gen - Generate include files
79gen: $(IOPROCINCL_FILES) $(IOPROCINCL_FILES2) $(IOPROCASMINCL_FILES)
80 echo "INCL: $(IOPROCINCL_FILES)"
81 echo "INCL2: $(IOPROCINCL_FILES2)"
82 echo "ASMINCL: $(IOPROCASMINCL_FILES)"
83
84# From the official location...
85iop_reg_space.h: $(IOPOFFICIAL_INCDIR)/iop_reg_space.h
86 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
87iop_mpu_macros.h: $(IOPOFFICIAL_INCDIR)/iop_mpu_macros.h
88 cat $< | sed -e 's/\$$Id\:/id\:/g' >$@
89
90## copy - Copy files from official location
91copy:
92 @echo "## Copying and fixing iop files ##"
93 @for HFILE in $(IOPROCINCL_FILES); do \
94 echo " $$HFILE"; \
95 cat $(IOPOFFICIAL_INCDIR)$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \
96 done
97 @for HFILE in $(IOPROCINCL_FILES2); do \
98 echo " $$HFILE"; \
99 cat $(IOPOFFICIAL_INCDIR)$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \
100 done
101 @echo "## Copying and fixing iop asm files ##"
102 @for HFILE in $(IOPROCASMINCL_FILES); do \
103 echo " $$HFILE"; \
104 cat $(IOPOFFICIAL_INCDIR)asm/$$HFILE | sed -e 's/\$$Id\:/id\:/g' > asm/$$HFILE; \
105 done
106
107# I/O processor files:
108## iop - Generate I/O processor include files
109iop: $(IOPROCINCL_FILES) $(IOPROCINCL_FILES2) $(IOPROCASMINCL_FILES)
110iop_sw_%_defs.h: $(IOPROCDIR)/guinness/iop_sw_%.r
111 $(RDES2C) $<
112iop_version_defs.h: $(IOPROCDIR)/guinness/iop_version.r
113 $(RDES2C) $<
114%_defs.h: $(IOPROCDIR)/%.r
115 $(RDES2C) $<
116%_defs_asm.h: $(IOPROCDIR)/%.r
117 $(RDES2C) -asm $<
118iop_version_defs_asm.h: $(IOPROCDIR)/guinness/iop_version.r
119 $(RDES2C) -asm $<
120
121## doc - Generate .axw files from register description.
122doc: $(IOPROCREGDESC)
123 for RDES in $^; do \
124 $(RDES2TXT) $$RDES; \
125 done
126
127.PHONY: axw
128## %.axw - Generate the specified .axw file (doesn't work for all files
129## due to inconsistent naming of .r files.
130%.axw: axw
131 @for RDES in $(IOPROCREGDESC); do \
132 if echo "$$RDES" | grep $* ; then \
133 $(RDES2TXT) $$RDES; \
134 fi \
135 done
136
137.PHONY: clean
138## clean - Remove .h files and .axw files.
139clean:
140 rm -rf $(IOPROCINCL_FILES) *.axw
141
142.PHONY: cleandoc
143## cleandoc - Remove .axw files.
144cleandoc:
145 rm -rf *.axw
146
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_crc_par_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_crc_par_defs_asm.h
new file mode 100644
index 000000000000..a4b58000c164
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_crc_par_defs_asm.h
@@ -0,0 +1,171 @@
1#ifndef __iop_crc_par_defs_asm_h
2#define __iop_crc_par_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_crc_par.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_crc_par_defs_asm.h ../../inst/io_proc/rtl/iop_crc_par.r
11 * id: $Id: iop_crc_par_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_crc_par, type rw */
57#define reg_iop_crc_par_rw_cfg___mode___lsb 0
58#define reg_iop_crc_par_rw_cfg___mode___width 1
59#define reg_iop_crc_par_rw_cfg___mode___bit 0
60#define reg_iop_crc_par_rw_cfg___crc_out___lsb 1
61#define reg_iop_crc_par_rw_cfg___crc_out___width 1
62#define reg_iop_crc_par_rw_cfg___crc_out___bit 1
63#define reg_iop_crc_par_rw_cfg___rev_out___lsb 2
64#define reg_iop_crc_par_rw_cfg___rev_out___width 1
65#define reg_iop_crc_par_rw_cfg___rev_out___bit 2
66#define reg_iop_crc_par_rw_cfg___inv_out___lsb 3
67#define reg_iop_crc_par_rw_cfg___inv_out___width 1
68#define reg_iop_crc_par_rw_cfg___inv_out___bit 3
69#define reg_iop_crc_par_rw_cfg___trig___lsb 4
70#define reg_iop_crc_par_rw_cfg___trig___width 2
71#define reg_iop_crc_par_rw_cfg___poly___lsb 6
72#define reg_iop_crc_par_rw_cfg___poly___width 3
73#define reg_iop_crc_par_rw_cfg_offset 0
74
75/* Register rw_init_crc, scope iop_crc_par, type rw */
76#define reg_iop_crc_par_rw_init_crc_offset 4
77
78/* Register rw_correct_crc, scope iop_crc_par, type rw */
79#define reg_iop_crc_par_rw_correct_crc_offset 8
80
81/* Register rw_ctrl, scope iop_crc_par, type rw */
82#define reg_iop_crc_par_rw_ctrl___en___lsb 0
83#define reg_iop_crc_par_rw_ctrl___en___width 1
84#define reg_iop_crc_par_rw_ctrl___en___bit 0
85#define reg_iop_crc_par_rw_ctrl_offset 12
86
87/* Register rw_set_last, scope iop_crc_par, type rw */
88#define reg_iop_crc_par_rw_set_last___tr_dif___lsb 0
89#define reg_iop_crc_par_rw_set_last___tr_dif___width 1
90#define reg_iop_crc_par_rw_set_last___tr_dif___bit 0
91#define reg_iop_crc_par_rw_set_last_offset 16
92
93/* Register rw_wr1byte, scope iop_crc_par, type rw */
94#define reg_iop_crc_par_rw_wr1byte___data___lsb 0
95#define reg_iop_crc_par_rw_wr1byte___data___width 8
96#define reg_iop_crc_par_rw_wr1byte_offset 20
97
98/* Register rw_wr2byte, scope iop_crc_par, type rw */
99#define reg_iop_crc_par_rw_wr2byte___data___lsb 0
100#define reg_iop_crc_par_rw_wr2byte___data___width 16
101#define reg_iop_crc_par_rw_wr2byte_offset 24
102
103/* Register rw_wr3byte, scope iop_crc_par, type rw */
104#define reg_iop_crc_par_rw_wr3byte___data___lsb 0
105#define reg_iop_crc_par_rw_wr3byte___data___width 24
106#define reg_iop_crc_par_rw_wr3byte_offset 28
107
108/* Register rw_wr4byte, scope iop_crc_par, type rw */
109#define reg_iop_crc_par_rw_wr4byte___data___lsb 0
110#define reg_iop_crc_par_rw_wr4byte___data___width 32
111#define reg_iop_crc_par_rw_wr4byte_offset 32
112
113/* Register rw_wr1byte_last, scope iop_crc_par, type rw */
114#define reg_iop_crc_par_rw_wr1byte_last___data___lsb 0
115#define reg_iop_crc_par_rw_wr1byte_last___data___width 8
116#define reg_iop_crc_par_rw_wr1byte_last_offset 36
117
118/* Register rw_wr2byte_last, scope iop_crc_par, type rw */
119#define reg_iop_crc_par_rw_wr2byte_last___data___lsb 0
120#define reg_iop_crc_par_rw_wr2byte_last___data___width 16
121#define reg_iop_crc_par_rw_wr2byte_last_offset 40
122
123/* Register rw_wr3byte_last, scope iop_crc_par, type rw */
124#define reg_iop_crc_par_rw_wr3byte_last___data___lsb 0
125#define reg_iop_crc_par_rw_wr3byte_last___data___width 24
126#define reg_iop_crc_par_rw_wr3byte_last_offset 44
127
128/* Register rw_wr4byte_last, scope iop_crc_par, type rw */
129#define reg_iop_crc_par_rw_wr4byte_last___data___lsb 0
130#define reg_iop_crc_par_rw_wr4byte_last___data___width 32
131#define reg_iop_crc_par_rw_wr4byte_last_offset 48
132
133/* Register r_stat, scope iop_crc_par, type r */
134#define reg_iop_crc_par_r_stat___err___lsb 0
135#define reg_iop_crc_par_r_stat___err___width 1
136#define reg_iop_crc_par_r_stat___err___bit 0
137#define reg_iop_crc_par_r_stat___busy___lsb 1
138#define reg_iop_crc_par_r_stat___busy___width 1
139#define reg_iop_crc_par_r_stat___busy___bit 1
140#define reg_iop_crc_par_r_stat_offset 52
141
142/* Register r_sh_reg, scope iop_crc_par, type r */
143#define reg_iop_crc_par_r_sh_reg_offset 56
144
145/* Register r_crc, scope iop_crc_par, type r */
146#define reg_iop_crc_par_r_crc_offset 60
147
148/* Register rw_strb_rec_dif_in, scope iop_crc_par, type rw */
149#define reg_iop_crc_par_rw_strb_rec_dif_in___last___lsb 0
150#define reg_iop_crc_par_rw_strb_rec_dif_in___last___width 2
151#define reg_iop_crc_par_rw_strb_rec_dif_in_offset 64
152
153
154/* Constants */
155#define regk_iop_crc_par_calc 0x00000001
156#define regk_iop_crc_par_ccitt 0x00000002
157#define regk_iop_crc_par_check 0x00000000
158#define regk_iop_crc_par_crc16 0x00000001
159#define regk_iop_crc_par_crc32 0x00000000
160#define regk_iop_crc_par_crc5 0x00000003
161#define regk_iop_crc_par_crc5_11 0x00000004
162#define regk_iop_crc_par_dif_in 0x00000002
163#define regk_iop_crc_par_hi 0x00000000
164#define regk_iop_crc_par_neg 0x00000002
165#define regk_iop_crc_par_no 0x00000000
166#define regk_iop_crc_par_pos 0x00000001
167#define regk_iop_crc_par_pos_neg 0x00000003
168#define regk_iop_crc_par_rw_cfg_default 0x00000000
169#define regk_iop_crc_par_rw_ctrl_default 0x00000000
170#define regk_iop_crc_par_yes 0x00000001
171#endif /* __iop_crc_par_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_in_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_in_defs_asm.h
new file mode 100644
index 000000000000..e7d539feccb1
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_in_defs_asm.h
@@ -0,0 +1,321 @@
1#ifndef __iop_dmc_in_defs_asm_h
2#define __iop_dmc_in_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_dmc_in.r
7 * id: iop_dmc_in.r,v 1.26 2005/02/16 09:14:17 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_dmc_in_defs_asm.h ../../inst/io_proc/rtl/iop_dmc_in.r
11 * id: $Id: iop_dmc_in_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_dmc_in, type rw */
57#define reg_iop_dmc_in_rw_cfg___sth_intr___lsb 0
58#define reg_iop_dmc_in_rw_cfg___sth_intr___width 3
59#define reg_iop_dmc_in_rw_cfg___last_dis_dif___lsb 3
60#define reg_iop_dmc_in_rw_cfg___last_dis_dif___width 1
61#define reg_iop_dmc_in_rw_cfg___last_dis_dif___bit 3
62#define reg_iop_dmc_in_rw_cfg_offset 0
63
64/* Register rw_ctrl, scope iop_dmc_in, type rw */
65#define reg_iop_dmc_in_rw_ctrl___dif_en___lsb 0
66#define reg_iop_dmc_in_rw_ctrl___dif_en___width 1
67#define reg_iop_dmc_in_rw_ctrl___dif_en___bit 0
68#define reg_iop_dmc_in_rw_ctrl___dif_dis___lsb 1
69#define reg_iop_dmc_in_rw_ctrl___dif_dis___width 1
70#define reg_iop_dmc_in_rw_ctrl___dif_dis___bit 1
71#define reg_iop_dmc_in_rw_ctrl___stream_clr___lsb 2
72#define reg_iop_dmc_in_rw_ctrl___stream_clr___width 1
73#define reg_iop_dmc_in_rw_ctrl___stream_clr___bit 2
74#define reg_iop_dmc_in_rw_ctrl_offset 4
75
76/* Register r_stat, scope iop_dmc_in, type r */
77#define reg_iop_dmc_in_r_stat___dif_en___lsb 0
78#define reg_iop_dmc_in_r_stat___dif_en___width 1
79#define reg_iop_dmc_in_r_stat___dif_en___bit 0
80#define reg_iop_dmc_in_r_stat_offset 8
81
82/* Register rw_stream_cmd, scope iop_dmc_in, type rw */
83#define reg_iop_dmc_in_rw_stream_cmd___cmd___lsb 0
84#define reg_iop_dmc_in_rw_stream_cmd___cmd___width 10
85#define reg_iop_dmc_in_rw_stream_cmd___n___lsb 16
86#define reg_iop_dmc_in_rw_stream_cmd___n___width 8
87#define reg_iop_dmc_in_rw_stream_cmd_offset 12
88
89/* Register rw_stream_wr_data, scope iop_dmc_in, type rw */
90#define reg_iop_dmc_in_rw_stream_wr_data_offset 16
91
92/* Register rw_stream_wr_data_last, scope iop_dmc_in, type rw */
93#define reg_iop_dmc_in_rw_stream_wr_data_last_offset 20
94
95/* Register rw_stream_ctrl, scope iop_dmc_in, type rw */
96#define reg_iop_dmc_in_rw_stream_ctrl___eop___lsb 0
97#define reg_iop_dmc_in_rw_stream_ctrl___eop___width 1
98#define reg_iop_dmc_in_rw_stream_ctrl___eop___bit 0
99#define reg_iop_dmc_in_rw_stream_ctrl___wait___lsb 1
100#define reg_iop_dmc_in_rw_stream_ctrl___wait___width 1
101#define reg_iop_dmc_in_rw_stream_ctrl___wait___bit 1
102#define reg_iop_dmc_in_rw_stream_ctrl___keep_md___lsb 2
103#define reg_iop_dmc_in_rw_stream_ctrl___keep_md___width 1
104#define reg_iop_dmc_in_rw_stream_ctrl___keep_md___bit 2
105#define reg_iop_dmc_in_rw_stream_ctrl___size___lsb 3
106#define reg_iop_dmc_in_rw_stream_ctrl___size___width 3
107#define reg_iop_dmc_in_rw_stream_ctrl_offset 24
108
109/* Register r_stream_stat, scope iop_dmc_in, type r */
110#define reg_iop_dmc_in_r_stream_stat___sth___lsb 0
111#define reg_iop_dmc_in_r_stream_stat___sth___width 7
112#define reg_iop_dmc_in_r_stream_stat___full___lsb 16
113#define reg_iop_dmc_in_r_stream_stat___full___width 1
114#define reg_iop_dmc_in_r_stream_stat___full___bit 16
115#define reg_iop_dmc_in_r_stream_stat___last_pkt___lsb 17
116#define reg_iop_dmc_in_r_stream_stat___last_pkt___width 1
117#define reg_iop_dmc_in_r_stream_stat___last_pkt___bit 17
118#define reg_iop_dmc_in_r_stream_stat___data_md_valid___lsb 18
119#define reg_iop_dmc_in_r_stream_stat___data_md_valid___width 1
120#define reg_iop_dmc_in_r_stream_stat___data_md_valid___bit 18
121#define reg_iop_dmc_in_r_stream_stat___ctxt_md_valid___lsb 19
122#define reg_iop_dmc_in_r_stream_stat___ctxt_md_valid___width 1
123#define reg_iop_dmc_in_r_stream_stat___ctxt_md_valid___bit 19
124#define reg_iop_dmc_in_r_stream_stat___group_md_valid___lsb 20
125#define reg_iop_dmc_in_r_stream_stat___group_md_valid___width 1
126#define reg_iop_dmc_in_r_stream_stat___group_md_valid___bit 20
127#define reg_iop_dmc_in_r_stream_stat___stream_busy___lsb 21
128#define reg_iop_dmc_in_r_stream_stat___stream_busy___width 1
129#define reg_iop_dmc_in_r_stream_stat___stream_busy___bit 21
130#define reg_iop_dmc_in_r_stream_stat___cmd_rdy___lsb 22
131#define reg_iop_dmc_in_r_stream_stat___cmd_rdy___width 1
132#define reg_iop_dmc_in_r_stream_stat___cmd_rdy___bit 22
133#define reg_iop_dmc_in_r_stream_stat_offset 28
134
135/* Register r_data_descr, scope iop_dmc_in, type r */
136#define reg_iop_dmc_in_r_data_descr___ctrl___lsb 0
137#define reg_iop_dmc_in_r_data_descr___ctrl___width 8
138#define reg_iop_dmc_in_r_data_descr___stat___lsb 8
139#define reg_iop_dmc_in_r_data_descr___stat___width 8
140#define reg_iop_dmc_in_r_data_descr___md___lsb 16
141#define reg_iop_dmc_in_r_data_descr___md___width 16
142#define reg_iop_dmc_in_r_data_descr_offset 32
143
144/* Register r_ctxt_descr, scope iop_dmc_in, type r */
145#define reg_iop_dmc_in_r_ctxt_descr___ctrl___lsb 0
146#define reg_iop_dmc_in_r_ctxt_descr___ctrl___width 8
147#define reg_iop_dmc_in_r_ctxt_descr___stat___lsb 8
148#define reg_iop_dmc_in_r_ctxt_descr___stat___width 8
149#define reg_iop_dmc_in_r_ctxt_descr___md0___lsb 16
150#define reg_iop_dmc_in_r_ctxt_descr___md0___width 16
151#define reg_iop_dmc_in_r_ctxt_descr_offset 36
152
153/* Register r_ctxt_descr_md1, scope iop_dmc_in, type r */
154#define reg_iop_dmc_in_r_ctxt_descr_md1_offset 40
155
156/* Register r_ctxt_descr_md2, scope iop_dmc_in, type r */
157#define reg_iop_dmc_in_r_ctxt_descr_md2_offset 44
158
159/* Register r_group_descr, scope iop_dmc_in, type r */
160#define reg_iop_dmc_in_r_group_descr___ctrl___lsb 0
161#define reg_iop_dmc_in_r_group_descr___ctrl___width 8
162#define reg_iop_dmc_in_r_group_descr___stat___lsb 8
163#define reg_iop_dmc_in_r_group_descr___stat___width 8
164#define reg_iop_dmc_in_r_group_descr___md___lsb 16
165#define reg_iop_dmc_in_r_group_descr___md___width 16
166#define reg_iop_dmc_in_r_group_descr_offset 56
167
168/* Register rw_data_descr, scope iop_dmc_in, type rw */
169#define reg_iop_dmc_in_rw_data_descr___md___lsb 16
170#define reg_iop_dmc_in_rw_data_descr___md___width 16
171#define reg_iop_dmc_in_rw_data_descr_offset 60
172
173/* Register rw_ctxt_descr, scope iop_dmc_in, type rw */
174#define reg_iop_dmc_in_rw_ctxt_descr___md0___lsb 16
175#define reg_iop_dmc_in_rw_ctxt_descr___md0___width 16
176#define reg_iop_dmc_in_rw_ctxt_descr_offset 64
177
178/* Register rw_ctxt_descr_md1, scope iop_dmc_in, type rw */
179#define reg_iop_dmc_in_rw_ctxt_descr_md1_offset 68
180
181/* Register rw_ctxt_descr_md2, scope iop_dmc_in, type rw */
182#define reg_iop_dmc_in_rw_ctxt_descr_md2_offset 72
183
184/* Register rw_group_descr, scope iop_dmc_in, type rw */
185#define reg_iop_dmc_in_rw_group_descr___md___lsb 16
186#define reg_iop_dmc_in_rw_group_descr___md___width 16
187#define reg_iop_dmc_in_rw_group_descr_offset 84
188
189/* Register rw_intr_mask, scope iop_dmc_in, type rw */
190#define reg_iop_dmc_in_rw_intr_mask___data_md___lsb 0
191#define reg_iop_dmc_in_rw_intr_mask___data_md___width 1
192#define reg_iop_dmc_in_rw_intr_mask___data_md___bit 0
193#define reg_iop_dmc_in_rw_intr_mask___ctxt_md___lsb 1
194#define reg_iop_dmc_in_rw_intr_mask___ctxt_md___width 1
195#define reg_iop_dmc_in_rw_intr_mask___ctxt_md___bit 1
196#define reg_iop_dmc_in_rw_intr_mask___group_md___lsb 2
197#define reg_iop_dmc_in_rw_intr_mask___group_md___width 1
198#define reg_iop_dmc_in_rw_intr_mask___group_md___bit 2
199#define reg_iop_dmc_in_rw_intr_mask___cmd_rdy___lsb 3
200#define reg_iop_dmc_in_rw_intr_mask___cmd_rdy___width 1
201#define reg_iop_dmc_in_rw_intr_mask___cmd_rdy___bit 3
202#define reg_iop_dmc_in_rw_intr_mask___sth___lsb 4
203#define reg_iop_dmc_in_rw_intr_mask___sth___width 1
204#define reg_iop_dmc_in_rw_intr_mask___sth___bit 4
205#define reg_iop_dmc_in_rw_intr_mask___full___lsb 5
206#define reg_iop_dmc_in_rw_intr_mask___full___width 1
207#define reg_iop_dmc_in_rw_intr_mask___full___bit 5
208#define reg_iop_dmc_in_rw_intr_mask_offset 88
209
210/* Register rw_ack_intr, scope iop_dmc_in, type rw */
211#define reg_iop_dmc_in_rw_ack_intr___data_md___lsb 0
212#define reg_iop_dmc_in_rw_ack_intr___data_md___width 1
213#define reg_iop_dmc_in_rw_ack_intr___data_md___bit 0
214#define reg_iop_dmc_in_rw_ack_intr___ctxt_md___lsb 1
215#define reg_iop_dmc_in_rw_ack_intr___ctxt_md___width 1
216#define reg_iop_dmc_in_rw_ack_intr___ctxt_md___bit 1
217#define reg_iop_dmc_in_rw_ack_intr___group_md___lsb 2
218#define reg_iop_dmc_in_rw_ack_intr___group_md___width 1
219#define reg_iop_dmc_in_rw_ack_intr___group_md___bit 2
220#define reg_iop_dmc_in_rw_ack_intr___cmd_rdy___lsb 3
221#define reg_iop_dmc_in_rw_ack_intr___cmd_rdy___width 1
222#define reg_iop_dmc_in_rw_ack_intr___cmd_rdy___bit 3
223#define reg_iop_dmc_in_rw_ack_intr___sth___lsb 4
224#define reg_iop_dmc_in_rw_ack_intr___sth___width 1
225#define reg_iop_dmc_in_rw_ack_intr___sth___bit 4
226#define reg_iop_dmc_in_rw_ack_intr___full___lsb 5
227#define reg_iop_dmc_in_rw_ack_intr___full___width 1
228#define reg_iop_dmc_in_rw_ack_intr___full___bit 5
229#define reg_iop_dmc_in_rw_ack_intr_offset 92
230
231/* Register r_intr, scope iop_dmc_in, type r */
232#define reg_iop_dmc_in_r_intr___data_md___lsb 0
233#define reg_iop_dmc_in_r_intr___data_md___width 1
234#define reg_iop_dmc_in_r_intr___data_md___bit 0
235#define reg_iop_dmc_in_r_intr___ctxt_md___lsb 1
236#define reg_iop_dmc_in_r_intr___ctxt_md___width 1
237#define reg_iop_dmc_in_r_intr___ctxt_md___bit 1
238#define reg_iop_dmc_in_r_intr___group_md___lsb 2
239#define reg_iop_dmc_in_r_intr___group_md___width 1
240#define reg_iop_dmc_in_r_intr___group_md___bit 2
241#define reg_iop_dmc_in_r_intr___cmd_rdy___lsb 3
242#define reg_iop_dmc_in_r_intr___cmd_rdy___width 1
243#define reg_iop_dmc_in_r_intr___cmd_rdy___bit 3
244#define reg_iop_dmc_in_r_intr___sth___lsb 4
245#define reg_iop_dmc_in_r_intr___sth___width 1
246#define reg_iop_dmc_in_r_intr___sth___bit 4
247#define reg_iop_dmc_in_r_intr___full___lsb 5
248#define reg_iop_dmc_in_r_intr___full___width 1
249#define reg_iop_dmc_in_r_intr___full___bit 5
250#define reg_iop_dmc_in_r_intr_offset 96
251
252/* Register r_masked_intr, scope iop_dmc_in, type r */
253#define reg_iop_dmc_in_r_masked_intr___data_md___lsb 0
254#define reg_iop_dmc_in_r_masked_intr___data_md___width 1
255#define reg_iop_dmc_in_r_masked_intr___data_md___bit 0
256#define reg_iop_dmc_in_r_masked_intr___ctxt_md___lsb 1
257#define reg_iop_dmc_in_r_masked_intr___ctxt_md___width 1
258#define reg_iop_dmc_in_r_masked_intr___ctxt_md___bit 1
259#define reg_iop_dmc_in_r_masked_intr___group_md___lsb 2
260#define reg_iop_dmc_in_r_masked_intr___group_md___width 1
261#define reg_iop_dmc_in_r_masked_intr___group_md___bit 2
262#define reg_iop_dmc_in_r_masked_intr___cmd_rdy___lsb 3
263#define reg_iop_dmc_in_r_masked_intr___cmd_rdy___width 1
264#define reg_iop_dmc_in_r_masked_intr___cmd_rdy___bit 3
265#define reg_iop_dmc_in_r_masked_intr___sth___lsb 4
266#define reg_iop_dmc_in_r_masked_intr___sth___width 1
267#define reg_iop_dmc_in_r_masked_intr___sth___bit 4
268#define reg_iop_dmc_in_r_masked_intr___full___lsb 5
269#define reg_iop_dmc_in_r_masked_intr___full___width 1
270#define reg_iop_dmc_in_r_masked_intr___full___bit 5
271#define reg_iop_dmc_in_r_masked_intr_offset 100
272
273
274/* Constants */
275#define regk_iop_dmc_in_ack_pkt 0x00000100
276#define regk_iop_dmc_in_array 0x00000008
277#define regk_iop_dmc_in_burst 0x00000020
278#define regk_iop_dmc_in_copy_next 0x00000010
279#define regk_iop_dmc_in_copy_up 0x00000020
280#define regk_iop_dmc_in_dis_c 0x00000010
281#define regk_iop_dmc_in_dis_g 0x00000020
282#define regk_iop_dmc_in_lim1 0x00000000
283#define regk_iop_dmc_in_lim16 0x00000004
284#define regk_iop_dmc_in_lim2 0x00000001
285#define regk_iop_dmc_in_lim32 0x00000005
286#define regk_iop_dmc_in_lim4 0x00000002
287#define regk_iop_dmc_in_lim64 0x00000006
288#define regk_iop_dmc_in_lim8 0x00000003
289#define regk_iop_dmc_in_load_c 0x00000200
290#define regk_iop_dmc_in_load_c_n 0x00000280
291#define regk_iop_dmc_in_load_c_next 0x00000240
292#define regk_iop_dmc_in_load_d 0x00000140
293#define regk_iop_dmc_in_load_g 0x00000300
294#define regk_iop_dmc_in_load_g_down 0x000003c0
295#define regk_iop_dmc_in_load_g_next 0x00000340
296#define regk_iop_dmc_in_load_g_up 0x00000380
297#define regk_iop_dmc_in_next_en 0x00000010
298#define regk_iop_dmc_in_next_pkt 0x00000010
299#define regk_iop_dmc_in_no 0x00000000
300#define regk_iop_dmc_in_restore 0x00000020
301#define regk_iop_dmc_in_rw_cfg_default 0x00000000
302#define regk_iop_dmc_in_rw_ctxt_descr_default 0x00000000
303#define regk_iop_dmc_in_rw_ctxt_descr_md1_default 0x00000000
304#define regk_iop_dmc_in_rw_ctxt_descr_md2_default 0x00000000
305#define regk_iop_dmc_in_rw_data_descr_default 0x00000000
306#define regk_iop_dmc_in_rw_group_descr_default 0x00000000
307#define regk_iop_dmc_in_rw_intr_mask_default 0x00000000
308#define regk_iop_dmc_in_rw_stream_ctrl_default 0x00000000
309#define regk_iop_dmc_in_save_down 0x00000020
310#define regk_iop_dmc_in_save_up 0x00000020
311#define regk_iop_dmc_in_set_reg 0x00000050
312#define regk_iop_dmc_in_set_w_size1 0x00000190
313#define regk_iop_dmc_in_set_w_size2 0x000001a0
314#define regk_iop_dmc_in_set_w_size4 0x000001c0
315#define regk_iop_dmc_in_store_c 0x00000002
316#define regk_iop_dmc_in_store_descr 0x00000000
317#define regk_iop_dmc_in_store_g 0x00000004
318#define regk_iop_dmc_in_store_md 0x00000001
319#define regk_iop_dmc_in_update_down 0x00000020
320#define regk_iop_dmc_in_yes 0x00000001
321#endif /* __iop_dmc_in_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_out_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_out_defs_asm.h
new file mode 100644
index 000000000000..9fe1a8054371
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_out_defs_asm.h
@@ -0,0 +1,349 @@
1#ifndef __iop_dmc_out_defs_asm_h
2#define __iop_dmc_out_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_dmc_out.r
7 * id: iop_dmc_out.r,v 1.30 2005/02/16 09:14:11 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_dmc_out_defs_asm.h ../../inst/io_proc/rtl/iop_dmc_out.r
11 * id: $Id: iop_dmc_out_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_dmc_out, type rw */
57#define reg_iop_dmc_out_rw_cfg___trf_lim___lsb 0
58#define reg_iop_dmc_out_rw_cfg___trf_lim___width 16
59#define reg_iop_dmc_out_rw_cfg___last_at_trf_lim___lsb 16
60#define reg_iop_dmc_out_rw_cfg___last_at_trf_lim___width 1
61#define reg_iop_dmc_out_rw_cfg___last_at_trf_lim___bit 16
62#define reg_iop_dmc_out_rw_cfg___dth_intr___lsb 17
63#define reg_iop_dmc_out_rw_cfg___dth_intr___width 3
64#define reg_iop_dmc_out_rw_cfg_offset 0
65
66/* Register rw_ctrl, scope iop_dmc_out, type rw */
67#define reg_iop_dmc_out_rw_ctrl___dif_en___lsb 0
68#define reg_iop_dmc_out_rw_ctrl___dif_en___width 1
69#define reg_iop_dmc_out_rw_ctrl___dif_en___bit 0
70#define reg_iop_dmc_out_rw_ctrl___dif_dis___lsb 1
71#define reg_iop_dmc_out_rw_ctrl___dif_dis___width 1
72#define reg_iop_dmc_out_rw_ctrl___dif_dis___bit 1
73#define reg_iop_dmc_out_rw_ctrl_offset 4
74
75/* Register r_stat, scope iop_dmc_out, type r */
76#define reg_iop_dmc_out_r_stat___dif_en___lsb 0
77#define reg_iop_dmc_out_r_stat___dif_en___width 1
78#define reg_iop_dmc_out_r_stat___dif_en___bit 0
79#define reg_iop_dmc_out_r_stat_offset 8
80
81/* Register rw_stream_cmd, scope iop_dmc_out, type rw */
82#define reg_iop_dmc_out_rw_stream_cmd___cmd___lsb 0
83#define reg_iop_dmc_out_rw_stream_cmd___cmd___width 10
84#define reg_iop_dmc_out_rw_stream_cmd___n___lsb 16
85#define reg_iop_dmc_out_rw_stream_cmd___n___width 8
86#define reg_iop_dmc_out_rw_stream_cmd_offset 12
87
88/* Register rs_stream_data, scope iop_dmc_out, type rs */
89#define reg_iop_dmc_out_rs_stream_data_offset 16
90
91/* Register r_stream_data, scope iop_dmc_out, type r */
92#define reg_iop_dmc_out_r_stream_data_offset 20
93
94/* Register r_stream_stat, scope iop_dmc_out, type r */
95#define reg_iop_dmc_out_r_stream_stat___dth___lsb 0
96#define reg_iop_dmc_out_r_stream_stat___dth___width 7
97#define reg_iop_dmc_out_r_stream_stat___dv___lsb 16
98#define reg_iop_dmc_out_r_stream_stat___dv___width 1
99#define reg_iop_dmc_out_r_stream_stat___dv___bit 16
100#define reg_iop_dmc_out_r_stream_stat___all_avail___lsb 17
101#define reg_iop_dmc_out_r_stream_stat___all_avail___width 1
102#define reg_iop_dmc_out_r_stream_stat___all_avail___bit 17
103#define reg_iop_dmc_out_r_stream_stat___last___lsb 18
104#define reg_iop_dmc_out_r_stream_stat___last___width 1
105#define reg_iop_dmc_out_r_stream_stat___last___bit 18
106#define reg_iop_dmc_out_r_stream_stat___size___lsb 19
107#define reg_iop_dmc_out_r_stream_stat___size___width 3
108#define reg_iop_dmc_out_r_stream_stat___data_md_valid___lsb 22
109#define reg_iop_dmc_out_r_stream_stat___data_md_valid___width 1
110#define reg_iop_dmc_out_r_stream_stat___data_md_valid___bit 22
111#define reg_iop_dmc_out_r_stream_stat___ctxt_md_valid___lsb 23
112#define reg_iop_dmc_out_r_stream_stat___ctxt_md_valid___width 1
113#define reg_iop_dmc_out_r_stream_stat___ctxt_md_valid___bit 23
114#define reg_iop_dmc_out_r_stream_stat___group_md_valid___lsb 24
115#define reg_iop_dmc_out_r_stream_stat___group_md_valid___width 1
116#define reg_iop_dmc_out_r_stream_stat___group_md_valid___bit 24
117#define reg_iop_dmc_out_r_stream_stat___stream_busy___lsb 25
118#define reg_iop_dmc_out_r_stream_stat___stream_busy___width 1
119#define reg_iop_dmc_out_r_stream_stat___stream_busy___bit 25
120#define reg_iop_dmc_out_r_stream_stat___cmd_rdy___lsb 26
121#define reg_iop_dmc_out_r_stream_stat___cmd_rdy___width 1
122#define reg_iop_dmc_out_r_stream_stat___cmd_rdy___bit 26
123#define reg_iop_dmc_out_r_stream_stat___cmd_rq___lsb 27
124#define reg_iop_dmc_out_r_stream_stat___cmd_rq___width 1
125#define reg_iop_dmc_out_r_stream_stat___cmd_rq___bit 27
126#define reg_iop_dmc_out_r_stream_stat_offset 24
127
128/* Register r_data_descr, scope iop_dmc_out, type r */
129#define reg_iop_dmc_out_r_data_descr___ctrl___lsb 0
130#define reg_iop_dmc_out_r_data_descr___ctrl___width 8
131#define reg_iop_dmc_out_r_data_descr___stat___lsb 8
132#define reg_iop_dmc_out_r_data_descr___stat___width 8
133#define reg_iop_dmc_out_r_data_descr___md___lsb 16
134#define reg_iop_dmc_out_r_data_descr___md___width 16
135#define reg_iop_dmc_out_r_data_descr_offset 28
136
137/* Register r_ctxt_descr, scope iop_dmc_out, type r */
138#define reg_iop_dmc_out_r_ctxt_descr___ctrl___lsb 0
139#define reg_iop_dmc_out_r_ctxt_descr___ctrl___width 8
140#define reg_iop_dmc_out_r_ctxt_descr___stat___lsb 8
141#define reg_iop_dmc_out_r_ctxt_descr___stat___width 8
142#define reg_iop_dmc_out_r_ctxt_descr___md0___lsb 16
143#define reg_iop_dmc_out_r_ctxt_descr___md0___width 16
144#define reg_iop_dmc_out_r_ctxt_descr_offset 32
145
146/* Register r_ctxt_descr_md1, scope iop_dmc_out, type r */
147#define reg_iop_dmc_out_r_ctxt_descr_md1_offset 36
148
149/* Register r_ctxt_descr_md2, scope iop_dmc_out, type r */
150#define reg_iop_dmc_out_r_ctxt_descr_md2_offset 40
151
152/* Register r_group_descr, scope iop_dmc_out, type r */
153#define reg_iop_dmc_out_r_group_descr___ctrl___lsb 0
154#define reg_iop_dmc_out_r_group_descr___ctrl___width 8
155#define reg_iop_dmc_out_r_group_descr___stat___lsb 8
156#define reg_iop_dmc_out_r_group_descr___stat___width 8
157#define reg_iop_dmc_out_r_group_descr___md___lsb 16
158#define reg_iop_dmc_out_r_group_descr___md___width 16
159#define reg_iop_dmc_out_r_group_descr_offset 52
160
161/* Register rw_data_descr, scope iop_dmc_out, type rw */
162#define reg_iop_dmc_out_rw_data_descr___md___lsb 16
163#define reg_iop_dmc_out_rw_data_descr___md___width 16
164#define reg_iop_dmc_out_rw_data_descr_offset 56
165
166/* Register rw_ctxt_descr, scope iop_dmc_out, type rw */
167#define reg_iop_dmc_out_rw_ctxt_descr___md0___lsb 16
168#define reg_iop_dmc_out_rw_ctxt_descr___md0___width 16
169#define reg_iop_dmc_out_rw_ctxt_descr_offset 60
170
171/* Register rw_ctxt_descr_md1, scope iop_dmc_out, type rw */
172#define reg_iop_dmc_out_rw_ctxt_descr_md1_offset 64
173
174/* Register rw_ctxt_descr_md2, scope iop_dmc_out, type rw */
175#define reg_iop_dmc_out_rw_ctxt_descr_md2_offset 68
176
177/* Register rw_group_descr, scope iop_dmc_out, type rw */
178#define reg_iop_dmc_out_rw_group_descr___md___lsb 16
179#define reg_iop_dmc_out_rw_group_descr___md___width 16
180#define reg_iop_dmc_out_rw_group_descr_offset 80
181
182/* Register rw_intr_mask, scope iop_dmc_out, type rw */
183#define reg_iop_dmc_out_rw_intr_mask___data_md___lsb 0
184#define reg_iop_dmc_out_rw_intr_mask___data_md___width 1
185#define reg_iop_dmc_out_rw_intr_mask___data_md___bit 0
186#define reg_iop_dmc_out_rw_intr_mask___ctxt_md___lsb 1
187#define reg_iop_dmc_out_rw_intr_mask___ctxt_md___width 1
188#define reg_iop_dmc_out_rw_intr_mask___ctxt_md___bit 1
189#define reg_iop_dmc_out_rw_intr_mask___group_md___lsb 2
190#define reg_iop_dmc_out_rw_intr_mask___group_md___width 1
191#define reg_iop_dmc_out_rw_intr_mask___group_md___bit 2
192#define reg_iop_dmc_out_rw_intr_mask___cmd_rdy___lsb 3
193#define reg_iop_dmc_out_rw_intr_mask___cmd_rdy___width 1
194#define reg_iop_dmc_out_rw_intr_mask___cmd_rdy___bit 3
195#define reg_iop_dmc_out_rw_intr_mask___dth___lsb 4
196#define reg_iop_dmc_out_rw_intr_mask___dth___width 1
197#define reg_iop_dmc_out_rw_intr_mask___dth___bit 4
198#define reg_iop_dmc_out_rw_intr_mask___dv___lsb 5
199#define reg_iop_dmc_out_rw_intr_mask___dv___width 1
200#define reg_iop_dmc_out_rw_intr_mask___dv___bit 5
201#define reg_iop_dmc_out_rw_intr_mask___last_data___lsb 6
202#define reg_iop_dmc_out_rw_intr_mask___last_data___width 1
203#define reg_iop_dmc_out_rw_intr_mask___last_data___bit 6
204#define reg_iop_dmc_out_rw_intr_mask___trf_lim___lsb 7
205#define reg_iop_dmc_out_rw_intr_mask___trf_lim___width 1
206#define reg_iop_dmc_out_rw_intr_mask___trf_lim___bit 7
207#define reg_iop_dmc_out_rw_intr_mask___cmd_rq___lsb 8
208#define reg_iop_dmc_out_rw_intr_mask___cmd_rq___width 1
209#define reg_iop_dmc_out_rw_intr_mask___cmd_rq___bit 8
210#define reg_iop_dmc_out_rw_intr_mask_offset 84
211
212/* Register rw_ack_intr, scope iop_dmc_out, type rw */
213#define reg_iop_dmc_out_rw_ack_intr___data_md___lsb 0
214#define reg_iop_dmc_out_rw_ack_intr___data_md___width 1
215#define reg_iop_dmc_out_rw_ack_intr___data_md___bit 0
216#define reg_iop_dmc_out_rw_ack_intr___ctxt_md___lsb 1
217#define reg_iop_dmc_out_rw_ack_intr___ctxt_md___width 1
218#define reg_iop_dmc_out_rw_ack_intr___ctxt_md___bit 1
219#define reg_iop_dmc_out_rw_ack_intr___group_md___lsb 2
220#define reg_iop_dmc_out_rw_ack_intr___group_md___width 1
221#define reg_iop_dmc_out_rw_ack_intr___group_md___bit 2
222#define reg_iop_dmc_out_rw_ack_intr___cmd_rdy___lsb 3
223#define reg_iop_dmc_out_rw_ack_intr___cmd_rdy___width 1
224#define reg_iop_dmc_out_rw_ack_intr___cmd_rdy___bit 3
225#define reg_iop_dmc_out_rw_ack_intr___dth___lsb 4
226#define reg_iop_dmc_out_rw_ack_intr___dth___width 1
227#define reg_iop_dmc_out_rw_ack_intr___dth___bit 4
228#define reg_iop_dmc_out_rw_ack_intr___dv___lsb 5
229#define reg_iop_dmc_out_rw_ack_intr___dv___width 1
230#define reg_iop_dmc_out_rw_ack_intr___dv___bit 5
231#define reg_iop_dmc_out_rw_ack_intr___last_data___lsb 6
232#define reg_iop_dmc_out_rw_ack_intr___last_data___width 1
233#define reg_iop_dmc_out_rw_ack_intr___last_data___bit 6
234#define reg_iop_dmc_out_rw_ack_intr___trf_lim___lsb 7
235#define reg_iop_dmc_out_rw_ack_intr___trf_lim___width 1
236#define reg_iop_dmc_out_rw_ack_intr___trf_lim___bit 7
237#define reg_iop_dmc_out_rw_ack_intr___cmd_rq___lsb 8
238#define reg_iop_dmc_out_rw_ack_intr___cmd_rq___width 1
239#define reg_iop_dmc_out_rw_ack_intr___cmd_rq___bit 8
240#define reg_iop_dmc_out_rw_ack_intr_offset 88
241
242/* Register r_intr, scope iop_dmc_out, type r */
243#define reg_iop_dmc_out_r_intr___data_md___lsb 0
244#define reg_iop_dmc_out_r_intr___data_md___width 1
245#define reg_iop_dmc_out_r_intr___data_md___bit 0
246#define reg_iop_dmc_out_r_intr___ctxt_md___lsb 1
247#define reg_iop_dmc_out_r_intr___ctxt_md___width 1
248#define reg_iop_dmc_out_r_intr___ctxt_md___bit 1
249#define reg_iop_dmc_out_r_intr___group_md___lsb 2
250#define reg_iop_dmc_out_r_intr___group_md___width 1
251#define reg_iop_dmc_out_r_intr___group_md___bit 2
252#define reg_iop_dmc_out_r_intr___cmd_rdy___lsb 3
253#define reg_iop_dmc_out_r_intr___cmd_rdy___width 1
254#define reg_iop_dmc_out_r_intr___cmd_rdy___bit 3
255#define reg_iop_dmc_out_r_intr___dth___lsb 4
256#define reg_iop_dmc_out_r_intr___dth___width 1
257#define reg_iop_dmc_out_r_intr___dth___bit 4
258#define reg_iop_dmc_out_r_intr___dv___lsb 5
259#define reg_iop_dmc_out_r_intr___dv___width 1
260#define reg_iop_dmc_out_r_intr___dv___bit 5
261#define reg_iop_dmc_out_r_intr___last_data___lsb 6
262#define reg_iop_dmc_out_r_intr___last_data___width 1
263#define reg_iop_dmc_out_r_intr___last_data___bit 6
264#define reg_iop_dmc_out_r_intr___trf_lim___lsb 7
265#define reg_iop_dmc_out_r_intr___trf_lim___width 1
266#define reg_iop_dmc_out_r_intr___trf_lim___bit 7
267#define reg_iop_dmc_out_r_intr___cmd_rq___lsb 8
268#define reg_iop_dmc_out_r_intr___cmd_rq___width 1
269#define reg_iop_dmc_out_r_intr___cmd_rq___bit 8
270#define reg_iop_dmc_out_r_intr_offset 92
271
272/* Register r_masked_intr, scope iop_dmc_out, type r */
273#define reg_iop_dmc_out_r_masked_intr___data_md___lsb 0
274#define reg_iop_dmc_out_r_masked_intr___data_md___width 1
275#define reg_iop_dmc_out_r_masked_intr___data_md___bit 0
276#define reg_iop_dmc_out_r_masked_intr___ctxt_md___lsb 1
277#define reg_iop_dmc_out_r_masked_intr___ctxt_md___width 1
278#define reg_iop_dmc_out_r_masked_intr___ctxt_md___bit 1
279#define reg_iop_dmc_out_r_masked_intr___group_md___lsb 2
280#define reg_iop_dmc_out_r_masked_intr___group_md___width 1
281#define reg_iop_dmc_out_r_masked_intr___group_md___bit 2
282#define reg_iop_dmc_out_r_masked_intr___cmd_rdy___lsb 3
283#define reg_iop_dmc_out_r_masked_intr___cmd_rdy___width 1
284#define reg_iop_dmc_out_r_masked_intr___cmd_rdy___bit 3
285#define reg_iop_dmc_out_r_masked_intr___dth___lsb 4
286#define reg_iop_dmc_out_r_masked_intr___dth___width 1
287#define reg_iop_dmc_out_r_masked_intr___dth___bit 4
288#define reg_iop_dmc_out_r_masked_intr___dv___lsb 5
289#define reg_iop_dmc_out_r_masked_intr___dv___width 1
290#define reg_iop_dmc_out_r_masked_intr___dv___bit 5
291#define reg_iop_dmc_out_r_masked_intr___last_data___lsb 6
292#define reg_iop_dmc_out_r_masked_intr___last_data___width 1
293#define reg_iop_dmc_out_r_masked_intr___last_data___bit 6
294#define reg_iop_dmc_out_r_masked_intr___trf_lim___lsb 7
295#define reg_iop_dmc_out_r_masked_intr___trf_lim___width 1
296#define reg_iop_dmc_out_r_masked_intr___trf_lim___bit 7
297#define reg_iop_dmc_out_r_masked_intr___cmd_rq___lsb 8
298#define reg_iop_dmc_out_r_masked_intr___cmd_rq___width 1
299#define reg_iop_dmc_out_r_masked_intr___cmd_rq___bit 8
300#define reg_iop_dmc_out_r_masked_intr_offset 96
301
302
303/* Constants */
304#define regk_iop_dmc_out_ack_pkt 0x00000100
305#define regk_iop_dmc_out_array 0x00000008
306#define regk_iop_dmc_out_burst 0x00000020
307#define regk_iop_dmc_out_copy_next 0x00000010
308#define regk_iop_dmc_out_copy_up 0x00000020
309#define regk_iop_dmc_out_dis_c 0x00000010
310#define regk_iop_dmc_out_dis_g 0x00000020
311#define regk_iop_dmc_out_lim1 0x00000000
312#define regk_iop_dmc_out_lim16 0x00000004
313#define regk_iop_dmc_out_lim2 0x00000001
314#define regk_iop_dmc_out_lim32 0x00000005
315#define regk_iop_dmc_out_lim4 0x00000002
316#define regk_iop_dmc_out_lim64 0x00000006
317#define regk_iop_dmc_out_lim8 0x00000003
318#define regk_iop_dmc_out_load_c 0x00000200
319#define regk_iop_dmc_out_load_c_n 0x00000280
320#define regk_iop_dmc_out_load_c_next 0x00000240
321#define regk_iop_dmc_out_load_d 0x00000140
322#define regk_iop_dmc_out_load_g 0x00000300
323#define regk_iop_dmc_out_load_g_down 0x000003c0
324#define regk_iop_dmc_out_load_g_next 0x00000340
325#define regk_iop_dmc_out_load_g_up 0x00000380
326#define regk_iop_dmc_out_next_en 0x00000010
327#define regk_iop_dmc_out_next_pkt 0x00000010
328#define regk_iop_dmc_out_no 0x00000000
329#define regk_iop_dmc_out_restore 0x00000020
330#define regk_iop_dmc_out_rw_cfg_default 0x00000000
331#define regk_iop_dmc_out_rw_ctxt_descr_default 0x00000000
332#define regk_iop_dmc_out_rw_ctxt_descr_md1_default 0x00000000
333#define regk_iop_dmc_out_rw_ctxt_descr_md2_default 0x00000000
334#define regk_iop_dmc_out_rw_data_descr_default 0x00000000
335#define regk_iop_dmc_out_rw_group_descr_default 0x00000000
336#define regk_iop_dmc_out_rw_intr_mask_default 0x00000000
337#define regk_iop_dmc_out_save_down 0x00000020
338#define regk_iop_dmc_out_save_up 0x00000020
339#define regk_iop_dmc_out_set_reg 0x00000050
340#define regk_iop_dmc_out_set_w_size1 0x00000190
341#define regk_iop_dmc_out_set_w_size2 0x000001a0
342#define regk_iop_dmc_out_set_w_size4 0x000001c0
343#define regk_iop_dmc_out_store_c 0x00000002
344#define regk_iop_dmc_out_store_descr 0x00000000
345#define regk_iop_dmc_out_store_g 0x00000004
346#define regk_iop_dmc_out_store_md 0x00000001
347#define regk_iop_dmc_out_update_down 0x00000020
348#define regk_iop_dmc_out_yes 0x00000001
349#endif /* __iop_dmc_out_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_defs_asm.h
new file mode 100644
index 000000000000..974dee082f9f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_defs_asm.h
@@ -0,0 +1,234 @@
1#ifndef __iop_fifo_in_defs_asm_h
2#define __iop_fifo_in_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_in.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:07 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_fifo_in_defs_asm.h ../../inst/io_proc/rtl/iop_fifo_in.r
11 * id: $Id: iop_fifo_in_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_fifo_in, type rw */
57#define reg_iop_fifo_in_rw_cfg___avail_lim___lsb 0
58#define reg_iop_fifo_in_rw_cfg___avail_lim___width 3
59#define reg_iop_fifo_in_rw_cfg___byte_order___lsb 3
60#define reg_iop_fifo_in_rw_cfg___byte_order___width 2
61#define reg_iop_fifo_in_rw_cfg___trig___lsb 5
62#define reg_iop_fifo_in_rw_cfg___trig___width 2
63#define reg_iop_fifo_in_rw_cfg___last_dis_dif_in___lsb 7
64#define reg_iop_fifo_in_rw_cfg___last_dis_dif_in___width 1
65#define reg_iop_fifo_in_rw_cfg___last_dis_dif_in___bit 7
66#define reg_iop_fifo_in_rw_cfg___mode___lsb 8
67#define reg_iop_fifo_in_rw_cfg___mode___width 2
68#define reg_iop_fifo_in_rw_cfg_offset 0
69
70/* Register rw_ctrl, scope iop_fifo_in, type rw */
71#define reg_iop_fifo_in_rw_ctrl___dif_in_en___lsb 0
72#define reg_iop_fifo_in_rw_ctrl___dif_in_en___width 1
73#define reg_iop_fifo_in_rw_ctrl___dif_in_en___bit 0
74#define reg_iop_fifo_in_rw_ctrl___dif_out_en___lsb 1
75#define reg_iop_fifo_in_rw_ctrl___dif_out_en___width 1
76#define reg_iop_fifo_in_rw_ctrl___dif_out_en___bit 1
77#define reg_iop_fifo_in_rw_ctrl_offset 4
78
79/* Register r_stat, scope iop_fifo_in, type r */
80#define reg_iop_fifo_in_r_stat___avail_bytes___lsb 0
81#define reg_iop_fifo_in_r_stat___avail_bytes___width 4
82#define reg_iop_fifo_in_r_stat___last___lsb 4
83#define reg_iop_fifo_in_r_stat___last___width 8
84#define reg_iop_fifo_in_r_stat___dif_in_en___lsb 12
85#define reg_iop_fifo_in_r_stat___dif_in_en___width 1
86#define reg_iop_fifo_in_r_stat___dif_in_en___bit 12
87#define reg_iop_fifo_in_r_stat___dif_out_en___lsb 13
88#define reg_iop_fifo_in_r_stat___dif_out_en___width 1
89#define reg_iop_fifo_in_r_stat___dif_out_en___bit 13
90#define reg_iop_fifo_in_r_stat_offset 8
91
92/* Register rs_rd1byte, scope iop_fifo_in, type rs */
93#define reg_iop_fifo_in_rs_rd1byte___data___lsb 0
94#define reg_iop_fifo_in_rs_rd1byte___data___width 8
95#define reg_iop_fifo_in_rs_rd1byte_offset 12
96
97/* Register r_rd1byte, scope iop_fifo_in, type r */
98#define reg_iop_fifo_in_r_rd1byte___data___lsb 0
99#define reg_iop_fifo_in_r_rd1byte___data___width 8
100#define reg_iop_fifo_in_r_rd1byte_offset 16
101
102/* Register rs_rd2byte, scope iop_fifo_in, type rs */
103#define reg_iop_fifo_in_rs_rd2byte___data___lsb 0
104#define reg_iop_fifo_in_rs_rd2byte___data___width 16
105#define reg_iop_fifo_in_rs_rd2byte_offset 20
106
107/* Register r_rd2byte, scope iop_fifo_in, type r */
108#define reg_iop_fifo_in_r_rd2byte___data___lsb 0
109#define reg_iop_fifo_in_r_rd2byte___data___width 16
110#define reg_iop_fifo_in_r_rd2byte_offset 24
111
112/* Register rs_rd3byte, scope iop_fifo_in, type rs */
113#define reg_iop_fifo_in_rs_rd3byte___data___lsb 0
114#define reg_iop_fifo_in_rs_rd3byte___data___width 24
115#define reg_iop_fifo_in_rs_rd3byte_offset 28
116
117/* Register r_rd3byte, scope iop_fifo_in, type r */
118#define reg_iop_fifo_in_r_rd3byte___data___lsb 0
119#define reg_iop_fifo_in_r_rd3byte___data___width 24
120#define reg_iop_fifo_in_r_rd3byte_offset 32
121
122/* Register rs_rd4byte, scope iop_fifo_in, type rs */
123#define reg_iop_fifo_in_rs_rd4byte___data___lsb 0
124#define reg_iop_fifo_in_rs_rd4byte___data___width 32
125#define reg_iop_fifo_in_rs_rd4byte_offset 36
126
127/* Register r_rd4byte, scope iop_fifo_in, type r */
128#define reg_iop_fifo_in_r_rd4byte___data___lsb 0
129#define reg_iop_fifo_in_r_rd4byte___data___width 32
130#define reg_iop_fifo_in_r_rd4byte_offset 40
131
132/* Register rw_set_last, scope iop_fifo_in, type rw */
133#define reg_iop_fifo_in_rw_set_last_offset 44
134
135/* Register rw_strb_dif_in, scope iop_fifo_in, type rw */
136#define reg_iop_fifo_in_rw_strb_dif_in___last___lsb 0
137#define reg_iop_fifo_in_rw_strb_dif_in___last___width 2
138#define reg_iop_fifo_in_rw_strb_dif_in_offset 48
139
140/* Register rw_intr_mask, scope iop_fifo_in, type rw */
141#define reg_iop_fifo_in_rw_intr_mask___urun___lsb 0
142#define reg_iop_fifo_in_rw_intr_mask___urun___width 1
143#define reg_iop_fifo_in_rw_intr_mask___urun___bit 0
144#define reg_iop_fifo_in_rw_intr_mask___last_data___lsb 1
145#define reg_iop_fifo_in_rw_intr_mask___last_data___width 1
146#define reg_iop_fifo_in_rw_intr_mask___last_data___bit 1
147#define reg_iop_fifo_in_rw_intr_mask___dav___lsb 2
148#define reg_iop_fifo_in_rw_intr_mask___dav___width 1
149#define reg_iop_fifo_in_rw_intr_mask___dav___bit 2
150#define reg_iop_fifo_in_rw_intr_mask___avail___lsb 3
151#define reg_iop_fifo_in_rw_intr_mask___avail___width 1
152#define reg_iop_fifo_in_rw_intr_mask___avail___bit 3
153#define reg_iop_fifo_in_rw_intr_mask___orun___lsb 4
154#define reg_iop_fifo_in_rw_intr_mask___orun___width 1
155#define reg_iop_fifo_in_rw_intr_mask___orun___bit 4
156#define reg_iop_fifo_in_rw_intr_mask_offset 52
157
158/* Register rw_ack_intr, scope iop_fifo_in, type rw */
159#define reg_iop_fifo_in_rw_ack_intr___urun___lsb 0
160#define reg_iop_fifo_in_rw_ack_intr___urun___width 1
161#define reg_iop_fifo_in_rw_ack_intr___urun___bit 0
162#define reg_iop_fifo_in_rw_ack_intr___last_data___lsb 1
163#define reg_iop_fifo_in_rw_ack_intr___last_data___width 1
164#define reg_iop_fifo_in_rw_ack_intr___last_data___bit 1
165#define reg_iop_fifo_in_rw_ack_intr___dav___lsb 2
166#define reg_iop_fifo_in_rw_ack_intr___dav___width 1
167#define reg_iop_fifo_in_rw_ack_intr___dav___bit 2
168#define reg_iop_fifo_in_rw_ack_intr___avail___lsb 3
169#define reg_iop_fifo_in_rw_ack_intr___avail___width 1
170#define reg_iop_fifo_in_rw_ack_intr___avail___bit 3
171#define reg_iop_fifo_in_rw_ack_intr___orun___lsb 4
172#define reg_iop_fifo_in_rw_ack_intr___orun___width 1
173#define reg_iop_fifo_in_rw_ack_intr___orun___bit 4
174#define reg_iop_fifo_in_rw_ack_intr_offset 56
175
176/* Register r_intr, scope iop_fifo_in, type r */
177#define reg_iop_fifo_in_r_intr___urun___lsb 0
178#define reg_iop_fifo_in_r_intr___urun___width 1
179#define reg_iop_fifo_in_r_intr___urun___bit 0
180#define reg_iop_fifo_in_r_intr___last_data___lsb 1
181#define reg_iop_fifo_in_r_intr___last_data___width 1
182#define reg_iop_fifo_in_r_intr___last_data___bit 1
183#define reg_iop_fifo_in_r_intr___dav___lsb 2
184#define reg_iop_fifo_in_r_intr___dav___width 1
185#define reg_iop_fifo_in_r_intr___dav___bit 2
186#define reg_iop_fifo_in_r_intr___avail___lsb 3
187#define reg_iop_fifo_in_r_intr___avail___width 1
188#define reg_iop_fifo_in_r_intr___avail___bit 3
189#define reg_iop_fifo_in_r_intr___orun___lsb 4
190#define reg_iop_fifo_in_r_intr___orun___width 1
191#define reg_iop_fifo_in_r_intr___orun___bit 4
192#define reg_iop_fifo_in_r_intr_offset 60
193
194/* Register r_masked_intr, scope iop_fifo_in, type r */
195#define reg_iop_fifo_in_r_masked_intr___urun___lsb 0
196#define reg_iop_fifo_in_r_masked_intr___urun___width 1
197#define reg_iop_fifo_in_r_masked_intr___urun___bit 0
198#define reg_iop_fifo_in_r_masked_intr___last_data___lsb 1
199#define reg_iop_fifo_in_r_masked_intr___last_data___width 1
200#define reg_iop_fifo_in_r_masked_intr___last_data___bit 1
201#define reg_iop_fifo_in_r_masked_intr___dav___lsb 2
202#define reg_iop_fifo_in_r_masked_intr___dav___width 1
203#define reg_iop_fifo_in_r_masked_intr___dav___bit 2
204#define reg_iop_fifo_in_r_masked_intr___avail___lsb 3
205#define reg_iop_fifo_in_r_masked_intr___avail___width 1
206#define reg_iop_fifo_in_r_masked_intr___avail___bit 3
207#define reg_iop_fifo_in_r_masked_intr___orun___lsb 4
208#define reg_iop_fifo_in_r_masked_intr___orun___width 1
209#define reg_iop_fifo_in_r_masked_intr___orun___bit 4
210#define reg_iop_fifo_in_r_masked_intr_offset 64
211
212
213/* Constants */
214#define regk_iop_fifo_in_dif_in 0x00000002
215#define regk_iop_fifo_in_hi 0x00000000
216#define regk_iop_fifo_in_neg 0x00000002
217#define regk_iop_fifo_in_no 0x00000000
218#define regk_iop_fifo_in_order16 0x00000001
219#define regk_iop_fifo_in_order24 0x00000002
220#define regk_iop_fifo_in_order32 0x00000003
221#define regk_iop_fifo_in_order8 0x00000000
222#define regk_iop_fifo_in_pos 0x00000001
223#define regk_iop_fifo_in_pos_neg 0x00000003
224#define regk_iop_fifo_in_rw_cfg_default 0x00000024
225#define regk_iop_fifo_in_rw_ctrl_default 0x00000000
226#define regk_iop_fifo_in_rw_intr_mask_default 0x00000000
227#define regk_iop_fifo_in_rw_set_last_default 0x00000000
228#define regk_iop_fifo_in_rw_strb_dif_in_default 0x00000000
229#define regk_iop_fifo_in_size16 0x00000002
230#define regk_iop_fifo_in_size24 0x00000001
231#define regk_iop_fifo_in_size32 0x00000000
232#define regk_iop_fifo_in_size8 0x00000003
233#define regk_iop_fifo_in_yes 0x00000001
234#endif /* __iop_fifo_in_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_extra_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_extra_defs_asm.h
new file mode 100644
index 000000000000..e00fab0c9335
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_extra_defs_asm.h
@@ -0,0 +1,155 @@
1#ifndef __iop_fifo_in_extra_defs_asm_h
2#define __iop_fifo_in_extra_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_in_extra.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:08 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_fifo_in_extra_defs_asm.h ../../inst/io_proc/rtl/iop_fifo_in_extra.r
11 * id: $Id: iop_fifo_in_extra_defs_asm.h,v 1.1 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_wr_data, scope iop_fifo_in_extra, type rw */
57#define reg_iop_fifo_in_extra_rw_wr_data_offset 0
58
59/* Register r_stat, scope iop_fifo_in_extra, type r */
60#define reg_iop_fifo_in_extra_r_stat___avail_bytes___lsb 0
61#define reg_iop_fifo_in_extra_r_stat___avail_bytes___width 4
62#define reg_iop_fifo_in_extra_r_stat___last___lsb 4
63#define reg_iop_fifo_in_extra_r_stat___last___width 8
64#define reg_iop_fifo_in_extra_r_stat___dif_in_en___lsb 12
65#define reg_iop_fifo_in_extra_r_stat___dif_in_en___width 1
66#define reg_iop_fifo_in_extra_r_stat___dif_in_en___bit 12
67#define reg_iop_fifo_in_extra_r_stat___dif_out_en___lsb 13
68#define reg_iop_fifo_in_extra_r_stat___dif_out_en___width 1
69#define reg_iop_fifo_in_extra_r_stat___dif_out_en___bit 13
70#define reg_iop_fifo_in_extra_r_stat_offset 4
71
72/* Register rw_strb_dif_in, scope iop_fifo_in_extra, type rw */
73#define reg_iop_fifo_in_extra_rw_strb_dif_in___last___lsb 0
74#define reg_iop_fifo_in_extra_rw_strb_dif_in___last___width 2
75#define reg_iop_fifo_in_extra_rw_strb_dif_in_offset 8
76
77/* Register rw_intr_mask, scope iop_fifo_in_extra, type rw */
78#define reg_iop_fifo_in_extra_rw_intr_mask___urun___lsb 0
79#define reg_iop_fifo_in_extra_rw_intr_mask___urun___width 1
80#define reg_iop_fifo_in_extra_rw_intr_mask___urun___bit 0
81#define reg_iop_fifo_in_extra_rw_intr_mask___last_data___lsb 1
82#define reg_iop_fifo_in_extra_rw_intr_mask___last_data___width 1
83#define reg_iop_fifo_in_extra_rw_intr_mask___last_data___bit 1
84#define reg_iop_fifo_in_extra_rw_intr_mask___dav___lsb 2
85#define reg_iop_fifo_in_extra_rw_intr_mask___dav___width 1
86#define reg_iop_fifo_in_extra_rw_intr_mask___dav___bit 2
87#define reg_iop_fifo_in_extra_rw_intr_mask___avail___lsb 3
88#define reg_iop_fifo_in_extra_rw_intr_mask___avail___width 1
89#define reg_iop_fifo_in_extra_rw_intr_mask___avail___bit 3
90#define reg_iop_fifo_in_extra_rw_intr_mask___orun___lsb 4
91#define reg_iop_fifo_in_extra_rw_intr_mask___orun___width 1
92#define reg_iop_fifo_in_extra_rw_intr_mask___orun___bit 4
93#define reg_iop_fifo_in_extra_rw_intr_mask_offset 12
94
95/* Register rw_ack_intr, scope iop_fifo_in_extra, type rw */
96#define reg_iop_fifo_in_extra_rw_ack_intr___urun___lsb 0
97#define reg_iop_fifo_in_extra_rw_ack_intr___urun___width 1
98#define reg_iop_fifo_in_extra_rw_ack_intr___urun___bit 0
99#define reg_iop_fifo_in_extra_rw_ack_intr___last_data___lsb 1
100#define reg_iop_fifo_in_extra_rw_ack_intr___last_data___width 1
101#define reg_iop_fifo_in_extra_rw_ack_intr___last_data___bit 1
102#define reg_iop_fifo_in_extra_rw_ack_intr___dav___lsb 2
103#define reg_iop_fifo_in_extra_rw_ack_intr___dav___width 1
104#define reg_iop_fifo_in_extra_rw_ack_intr___dav___bit 2
105#define reg_iop_fifo_in_extra_rw_ack_intr___avail___lsb 3
106#define reg_iop_fifo_in_extra_rw_ack_intr___avail___width 1
107#define reg_iop_fifo_in_extra_rw_ack_intr___avail___bit 3
108#define reg_iop_fifo_in_extra_rw_ack_intr___orun___lsb 4
109#define reg_iop_fifo_in_extra_rw_ack_intr___orun___width 1
110#define reg_iop_fifo_in_extra_rw_ack_intr___orun___bit 4
111#define reg_iop_fifo_in_extra_rw_ack_intr_offset 16
112
113/* Register r_intr, scope iop_fifo_in_extra, type r */
114#define reg_iop_fifo_in_extra_r_intr___urun___lsb 0
115#define reg_iop_fifo_in_extra_r_intr___urun___width 1
116#define reg_iop_fifo_in_extra_r_intr___urun___bit 0
117#define reg_iop_fifo_in_extra_r_intr___last_data___lsb 1
118#define reg_iop_fifo_in_extra_r_intr___last_data___width 1
119#define reg_iop_fifo_in_extra_r_intr___last_data___bit 1
120#define reg_iop_fifo_in_extra_r_intr___dav___lsb 2
121#define reg_iop_fifo_in_extra_r_intr___dav___width 1
122#define reg_iop_fifo_in_extra_r_intr___dav___bit 2
123#define reg_iop_fifo_in_extra_r_intr___avail___lsb 3
124#define reg_iop_fifo_in_extra_r_intr___avail___width 1
125#define reg_iop_fifo_in_extra_r_intr___avail___bit 3
126#define reg_iop_fifo_in_extra_r_intr___orun___lsb 4
127#define reg_iop_fifo_in_extra_r_intr___orun___width 1
128#define reg_iop_fifo_in_extra_r_intr___orun___bit 4
129#define reg_iop_fifo_in_extra_r_intr_offset 20
130
131/* Register r_masked_intr, scope iop_fifo_in_extra, type r */
132#define reg_iop_fifo_in_extra_r_masked_intr___urun___lsb 0
133#define reg_iop_fifo_in_extra_r_masked_intr___urun___width 1
134#define reg_iop_fifo_in_extra_r_masked_intr___urun___bit 0
135#define reg_iop_fifo_in_extra_r_masked_intr___last_data___lsb 1
136#define reg_iop_fifo_in_extra_r_masked_intr___last_data___width 1
137#define reg_iop_fifo_in_extra_r_masked_intr___last_data___bit 1
138#define reg_iop_fifo_in_extra_r_masked_intr___dav___lsb 2
139#define reg_iop_fifo_in_extra_r_masked_intr___dav___width 1
140#define reg_iop_fifo_in_extra_r_masked_intr___dav___bit 2
141#define reg_iop_fifo_in_extra_r_masked_intr___avail___lsb 3
142#define reg_iop_fifo_in_extra_r_masked_intr___avail___width 1
143#define reg_iop_fifo_in_extra_r_masked_intr___avail___bit 3
144#define reg_iop_fifo_in_extra_r_masked_intr___orun___lsb 4
145#define reg_iop_fifo_in_extra_r_masked_intr___orun___width 1
146#define reg_iop_fifo_in_extra_r_masked_intr___orun___bit 4
147#define reg_iop_fifo_in_extra_r_masked_intr_offset 24
148
149
150/* Constants */
151#define regk_iop_fifo_in_extra_fifo_in 0x00000002
152#define regk_iop_fifo_in_extra_no 0x00000000
153#define regk_iop_fifo_in_extra_rw_intr_mask_default 0x00000000
154#define regk_iop_fifo_in_extra_yes 0x00000001
155#endif /* __iop_fifo_in_extra_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_defs_asm.h
new file mode 100644
index 000000000000..9ec5f4a826df
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_defs_asm.h
@@ -0,0 +1,254 @@
1#ifndef __iop_fifo_out_defs_asm_h
2#define __iop_fifo_out_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_out.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:09 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_fifo_out_defs_asm.h ../../inst/io_proc/rtl/iop_fifo_out.r
11 * id: $Id: iop_fifo_out_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_fifo_out, type rw */
57#define reg_iop_fifo_out_rw_cfg___free_lim___lsb 0
58#define reg_iop_fifo_out_rw_cfg___free_lim___width 3
59#define reg_iop_fifo_out_rw_cfg___byte_order___lsb 3
60#define reg_iop_fifo_out_rw_cfg___byte_order___width 2
61#define reg_iop_fifo_out_rw_cfg___trig___lsb 5
62#define reg_iop_fifo_out_rw_cfg___trig___width 2
63#define reg_iop_fifo_out_rw_cfg___last_dis_dif_in___lsb 7
64#define reg_iop_fifo_out_rw_cfg___last_dis_dif_in___width 1
65#define reg_iop_fifo_out_rw_cfg___last_dis_dif_in___bit 7
66#define reg_iop_fifo_out_rw_cfg___mode___lsb 8
67#define reg_iop_fifo_out_rw_cfg___mode___width 2
68#define reg_iop_fifo_out_rw_cfg___delay_out_last___lsb 10
69#define reg_iop_fifo_out_rw_cfg___delay_out_last___width 1
70#define reg_iop_fifo_out_rw_cfg___delay_out_last___bit 10
71#define reg_iop_fifo_out_rw_cfg___last_dis_dif_out___lsb 11
72#define reg_iop_fifo_out_rw_cfg___last_dis_dif_out___width 1
73#define reg_iop_fifo_out_rw_cfg___last_dis_dif_out___bit 11
74#define reg_iop_fifo_out_rw_cfg_offset 0
75
76/* Register rw_ctrl, scope iop_fifo_out, type rw */
77#define reg_iop_fifo_out_rw_ctrl___dif_in_en___lsb 0
78#define reg_iop_fifo_out_rw_ctrl___dif_in_en___width 1
79#define reg_iop_fifo_out_rw_ctrl___dif_in_en___bit 0
80#define reg_iop_fifo_out_rw_ctrl___dif_out_en___lsb 1
81#define reg_iop_fifo_out_rw_ctrl___dif_out_en___width 1
82#define reg_iop_fifo_out_rw_ctrl___dif_out_en___bit 1
83#define reg_iop_fifo_out_rw_ctrl_offset 4
84
85/* Register r_stat, scope iop_fifo_out, type r */
86#define reg_iop_fifo_out_r_stat___avail_bytes___lsb 0
87#define reg_iop_fifo_out_r_stat___avail_bytes___width 4
88#define reg_iop_fifo_out_r_stat___last___lsb 4
89#define reg_iop_fifo_out_r_stat___last___width 8
90#define reg_iop_fifo_out_r_stat___dif_in_en___lsb 12
91#define reg_iop_fifo_out_r_stat___dif_in_en___width 1
92#define reg_iop_fifo_out_r_stat___dif_in_en___bit 12
93#define reg_iop_fifo_out_r_stat___dif_out_en___lsb 13
94#define reg_iop_fifo_out_r_stat___dif_out_en___width 1
95#define reg_iop_fifo_out_r_stat___dif_out_en___bit 13
96#define reg_iop_fifo_out_r_stat___zero_data_last___lsb 14
97#define reg_iop_fifo_out_r_stat___zero_data_last___width 1
98#define reg_iop_fifo_out_r_stat___zero_data_last___bit 14
99#define reg_iop_fifo_out_r_stat_offset 8
100
101/* Register rw_wr1byte, scope iop_fifo_out, type rw */
102#define reg_iop_fifo_out_rw_wr1byte___data___lsb 0
103#define reg_iop_fifo_out_rw_wr1byte___data___width 8
104#define reg_iop_fifo_out_rw_wr1byte_offset 12
105
106/* Register rw_wr2byte, scope iop_fifo_out, type rw */
107#define reg_iop_fifo_out_rw_wr2byte___data___lsb 0
108#define reg_iop_fifo_out_rw_wr2byte___data___width 16
109#define reg_iop_fifo_out_rw_wr2byte_offset 16
110
111/* Register rw_wr3byte, scope iop_fifo_out, type rw */
112#define reg_iop_fifo_out_rw_wr3byte___data___lsb 0
113#define reg_iop_fifo_out_rw_wr3byte___data___width 24
114#define reg_iop_fifo_out_rw_wr3byte_offset 20
115
116/* Register rw_wr4byte, scope iop_fifo_out, type rw */
117#define reg_iop_fifo_out_rw_wr4byte___data___lsb 0
118#define reg_iop_fifo_out_rw_wr4byte___data___width 32
119#define reg_iop_fifo_out_rw_wr4byte_offset 24
120
121/* Register rw_wr1byte_last, scope iop_fifo_out, type rw */
122#define reg_iop_fifo_out_rw_wr1byte_last___data___lsb 0
123#define reg_iop_fifo_out_rw_wr1byte_last___data___width 8
124#define reg_iop_fifo_out_rw_wr1byte_last_offset 28
125
126/* Register rw_wr2byte_last, scope iop_fifo_out, type rw */
127#define reg_iop_fifo_out_rw_wr2byte_last___data___lsb 0
128#define reg_iop_fifo_out_rw_wr2byte_last___data___width 16
129#define reg_iop_fifo_out_rw_wr2byte_last_offset 32
130
131/* Register rw_wr3byte_last, scope iop_fifo_out, type rw */
132#define reg_iop_fifo_out_rw_wr3byte_last___data___lsb 0
133#define reg_iop_fifo_out_rw_wr3byte_last___data___width 24
134#define reg_iop_fifo_out_rw_wr3byte_last_offset 36
135
136/* Register rw_wr4byte_last, scope iop_fifo_out, type rw */
137#define reg_iop_fifo_out_rw_wr4byte_last___data___lsb 0
138#define reg_iop_fifo_out_rw_wr4byte_last___data___width 32
139#define reg_iop_fifo_out_rw_wr4byte_last_offset 40
140
141/* Register rw_set_last, scope iop_fifo_out, type rw */
142#define reg_iop_fifo_out_rw_set_last_offset 44
143
144/* Register rs_rd_data, scope iop_fifo_out, type rs */
145#define reg_iop_fifo_out_rs_rd_data_offset 48
146
147/* Register r_rd_data, scope iop_fifo_out, type r */
148#define reg_iop_fifo_out_r_rd_data_offset 52
149
150/* Register rw_strb_dif_out, scope iop_fifo_out, type rw */
151#define reg_iop_fifo_out_rw_strb_dif_out_offset 56
152
153/* Register rw_intr_mask, scope iop_fifo_out, type rw */
154#define reg_iop_fifo_out_rw_intr_mask___urun___lsb 0
155#define reg_iop_fifo_out_rw_intr_mask___urun___width 1
156#define reg_iop_fifo_out_rw_intr_mask___urun___bit 0
157#define reg_iop_fifo_out_rw_intr_mask___last_data___lsb 1
158#define reg_iop_fifo_out_rw_intr_mask___last_data___width 1
159#define reg_iop_fifo_out_rw_intr_mask___last_data___bit 1
160#define reg_iop_fifo_out_rw_intr_mask___dav___lsb 2
161#define reg_iop_fifo_out_rw_intr_mask___dav___width 1
162#define reg_iop_fifo_out_rw_intr_mask___dav___bit 2
163#define reg_iop_fifo_out_rw_intr_mask___free___lsb 3
164#define reg_iop_fifo_out_rw_intr_mask___free___width 1
165#define reg_iop_fifo_out_rw_intr_mask___free___bit 3
166#define reg_iop_fifo_out_rw_intr_mask___orun___lsb 4
167#define reg_iop_fifo_out_rw_intr_mask___orun___width 1
168#define reg_iop_fifo_out_rw_intr_mask___orun___bit 4
169#define reg_iop_fifo_out_rw_intr_mask_offset 60
170
171/* Register rw_ack_intr, scope iop_fifo_out, type rw */
172#define reg_iop_fifo_out_rw_ack_intr___urun___lsb 0
173#define reg_iop_fifo_out_rw_ack_intr___urun___width 1
174#define reg_iop_fifo_out_rw_ack_intr___urun___bit 0
175#define reg_iop_fifo_out_rw_ack_intr___last_data___lsb 1
176#define reg_iop_fifo_out_rw_ack_intr___last_data___width 1
177#define reg_iop_fifo_out_rw_ack_intr___last_data___bit 1
178#define reg_iop_fifo_out_rw_ack_intr___dav___lsb 2
179#define reg_iop_fifo_out_rw_ack_intr___dav___width 1
180#define reg_iop_fifo_out_rw_ack_intr___dav___bit 2
181#define reg_iop_fifo_out_rw_ack_intr___free___lsb 3
182#define reg_iop_fifo_out_rw_ack_intr___free___width 1
183#define reg_iop_fifo_out_rw_ack_intr___free___bit 3
184#define reg_iop_fifo_out_rw_ack_intr___orun___lsb 4
185#define reg_iop_fifo_out_rw_ack_intr___orun___width 1
186#define reg_iop_fifo_out_rw_ack_intr___orun___bit 4
187#define reg_iop_fifo_out_rw_ack_intr_offset 64
188
189/* Register r_intr, scope iop_fifo_out, type r */
190#define reg_iop_fifo_out_r_intr___urun___lsb 0
191#define reg_iop_fifo_out_r_intr___urun___width 1
192#define reg_iop_fifo_out_r_intr___urun___bit 0
193#define reg_iop_fifo_out_r_intr___last_data___lsb 1
194#define reg_iop_fifo_out_r_intr___last_data___width 1
195#define reg_iop_fifo_out_r_intr___last_data___bit 1
196#define reg_iop_fifo_out_r_intr___dav___lsb 2
197#define reg_iop_fifo_out_r_intr___dav___width 1
198#define reg_iop_fifo_out_r_intr___dav___bit 2
199#define reg_iop_fifo_out_r_intr___free___lsb 3
200#define reg_iop_fifo_out_r_intr___free___width 1
201#define reg_iop_fifo_out_r_intr___free___bit 3
202#define reg_iop_fifo_out_r_intr___orun___lsb 4
203#define reg_iop_fifo_out_r_intr___orun___width 1
204#define reg_iop_fifo_out_r_intr___orun___bit 4
205#define reg_iop_fifo_out_r_intr_offset 68
206
207/* Register r_masked_intr, scope iop_fifo_out, type r */
208#define reg_iop_fifo_out_r_masked_intr___urun___lsb 0
209#define reg_iop_fifo_out_r_masked_intr___urun___width 1
210#define reg_iop_fifo_out_r_masked_intr___urun___bit 0
211#define reg_iop_fifo_out_r_masked_intr___last_data___lsb 1
212#define reg_iop_fifo_out_r_masked_intr___last_data___width 1
213#define reg_iop_fifo_out_r_masked_intr___last_data___bit 1
214#define reg_iop_fifo_out_r_masked_intr___dav___lsb 2
215#define reg_iop_fifo_out_r_masked_intr___dav___width 1
216#define reg_iop_fifo_out_r_masked_intr___dav___bit 2
217#define reg_iop_fifo_out_r_masked_intr___free___lsb 3
218#define reg_iop_fifo_out_r_masked_intr___free___width 1
219#define reg_iop_fifo_out_r_masked_intr___free___bit 3
220#define reg_iop_fifo_out_r_masked_intr___orun___lsb 4
221#define reg_iop_fifo_out_r_masked_intr___orun___width 1
222#define reg_iop_fifo_out_r_masked_intr___orun___bit 4
223#define reg_iop_fifo_out_r_masked_intr_offset 72
224
225
226/* Constants */
227#define regk_iop_fifo_out_hi 0x00000000
228#define regk_iop_fifo_out_neg 0x00000002
229#define regk_iop_fifo_out_no 0x00000000
230#define regk_iop_fifo_out_order16 0x00000001
231#define regk_iop_fifo_out_order24 0x00000002
232#define regk_iop_fifo_out_order32 0x00000003
233#define regk_iop_fifo_out_order8 0x00000000
234#define regk_iop_fifo_out_pos 0x00000001
235#define regk_iop_fifo_out_pos_neg 0x00000003
236#define regk_iop_fifo_out_rw_cfg_default 0x00000024
237#define regk_iop_fifo_out_rw_ctrl_default 0x00000000
238#define regk_iop_fifo_out_rw_intr_mask_default 0x00000000
239#define regk_iop_fifo_out_rw_set_last_default 0x00000000
240#define regk_iop_fifo_out_rw_strb_dif_out_default 0x00000000
241#define regk_iop_fifo_out_rw_wr1byte_default 0x00000000
242#define regk_iop_fifo_out_rw_wr1byte_last_default 0x00000000
243#define regk_iop_fifo_out_rw_wr2byte_default 0x00000000
244#define regk_iop_fifo_out_rw_wr2byte_last_default 0x00000000
245#define regk_iop_fifo_out_rw_wr3byte_default 0x00000000
246#define regk_iop_fifo_out_rw_wr3byte_last_default 0x00000000
247#define regk_iop_fifo_out_rw_wr4byte_default 0x00000000
248#define regk_iop_fifo_out_rw_wr4byte_last_default 0x00000000
249#define regk_iop_fifo_out_size16 0x00000002
250#define regk_iop_fifo_out_size24 0x00000001
251#define regk_iop_fifo_out_size32 0x00000000
252#define regk_iop_fifo_out_size8 0x00000003
253#define regk_iop_fifo_out_yes 0x00000001
254#endif /* __iop_fifo_out_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_extra_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_extra_defs_asm.h
new file mode 100644
index 000000000000..0f84a50cf77c
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_extra_defs_asm.h
@@ -0,0 +1,158 @@
1#ifndef __iop_fifo_out_extra_defs_asm_h
2#define __iop_fifo_out_extra_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_out_extra.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:10 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_fifo_out_extra_defs_asm.h ../../inst/io_proc/rtl/iop_fifo_out_extra.r
11 * id: $Id: iop_fifo_out_extra_defs_asm.h,v 1.1 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rs_rd_data, scope iop_fifo_out_extra, type rs */
57#define reg_iop_fifo_out_extra_rs_rd_data_offset 0
58
59/* Register r_rd_data, scope iop_fifo_out_extra, type r */
60#define reg_iop_fifo_out_extra_r_rd_data_offset 4
61
62/* Register r_stat, scope iop_fifo_out_extra, type r */
63#define reg_iop_fifo_out_extra_r_stat___avail_bytes___lsb 0
64#define reg_iop_fifo_out_extra_r_stat___avail_bytes___width 4
65#define reg_iop_fifo_out_extra_r_stat___last___lsb 4
66#define reg_iop_fifo_out_extra_r_stat___last___width 8
67#define reg_iop_fifo_out_extra_r_stat___dif_in_en___lsb 12
68#define reg_iop_fifo_out_extra_r_stat___dif_in_en___width 1
69#define reg_iop_fifo_out_extra_r_stat___dif_in_en___bit 12
70#define reg_iop_fifo_out_extra_r_stat___dif_out_en___lsb 13
71#define reg_iop_fifo_out_extra_r_stat___dif_out_en___width 1
72#define reg_iop_fifo_out_extra_r_stat___dif_out_en___bit 13
73#define reg_iop_fifo_out_extra_r_stat___zero_data_last___lsb 14
74#define reg_iop_fifo_out_extra_r_stat___zero_data_last___width 1
75#define reg_iop_fifo_out_extra_r_stat___zero_data_last___bit 14
76#define reg_iop_fifo_out_extra_r_stat_offset 8
77
78/* Register rw_strb_dif_out, scope iop_fifo_out_extra, type rw */
79#define reg_iop_fifo_out_extra_rw_strb_dif_out_offset 12
80
81/* Register rw_intr_mask, scope iop_fifo_out_extra, type rw */
82#define reg_iop_fifo_out_extra_rw_intr_mask___urun___lsb 0
83#define reg_iop_fifo_out_extra_rw_intr_mask___urun___width 1
84#define reg_iop_fifo_out_extra_rw_intr_mask___urun___bit 0
85#define reg_iop_fifo_out_extra_rw_intr_mask___last_data___lsb 1
86#define reg_iop_fifo_out_extra_rw_intr_mask___last_data___width 1
87#define reg_iop_fifo_out_extra_rw_intr_mask___last_data___bit 1
88#define reg_iop_fifo_out_extra_rw_intr_mask___dav___lsb 2
89#define reg_iop_fifo_out_extra_rw_intr_mask___dav___width 1
90#define reg_iop_fifo_out_extra_rw_intr_mask___dav___bit 2
91#define reg_iop_fifo_out_extra_rw_intr_mask___free___lsb 3
92#define reg_iop_fifo_out_extra_rw_intr_mask___free___width 1
93#define reg_iop_fifo_out_extra_rw_intr_mask___free___bit 3
94#define reg_iop_fifo_out_extra_rw_intr_mask___orun___lsb 4
95#define reg_iop_fifo_out_extra_rw_intr_mask___orun___width 1
96#define reg_iop_fifo_out_extra_rw_intr_mask___orun___bit 4
97#define reg_iop_fifo_out_extra_rw_intr_mask_offset 16
98
99/* Register rw_ack_intr, scope iop_fifo_out_extra, type rw */
100#define reg_iop_fifo_out_extra_rw_ack_intr___urun___lsb 0
101#define reg_iop_fifo_out_extra_rw_ack_intr___urun___width 1
102#define reg_iop_fifo_out_extra_rw_ack_intr___urun___bit 0
103#define reg_iop_fifo_out_extra_rw_ack_intr___last_data___lsb 1
104#define reg_iop_fifo_out_extra_rw_ack_intr___last_data___width 1
105#define reg_iop_fifo_out_extra_rw_ack_intr___last_data___bit 1
106#define reg_iop_fifo_out_extra_rw_ack_intr___dav___lsb 2
107#define reg_iop_fifo_out_extra_rw_ack_intr___dav___width 1
108#define reg_iop_fifo_out_extra_rw_ack_intr___dav___bit 2
109#define reg_iop_fifo_out_extra_rw_ack_intr___free___lsb 3
110#define reg_iop_fifo_out_extra_rw_ack_intr___free___width 1
111#define reg_iop_fifo_out_extra_rw_ack_intr___free___bit 3
112#define reg_iop_fifo_out_extra_rw_ack_intr___orun___lsb 4
113#define reg_iop_fifo_out_extra_rw_ack_intr___orun___width 1
114#define reg_iop_fifo_out_extra_rw_ack_intr___orun___bit 4
115#define reg_iop_fifo_out_extra_rw_ack_intr_offset 20
116
117/* Register r_intr, scope iop_fifo_out_extra, type r */
118#define reg_iop_fifo_out_extra_r_intr___urun___lsb 0
119#define reg_iop_fifo_out_extra_r_intr___urun___width 1
120#define reg_iop_fifo_out_extra_r_intr___urun___bit 0
121#define reg_iop_fifo_out_extra_r_intr___last_data___lsb 1
122#define reg_iop_fifo_out_extra_r_intr___last_data___width 1
123#define reg_iop_fifo_out_extra_r_intr___last_data___bit 1
124#define reg_iop_fifo_out_extra_r_intr___dav___lsb 2
125#define reg_iop_fifo_out_extra_r_intr___dav___width 1
126#define reg_iop_fifo_out_extra_r_intr___dav___bit 2
127#define reg_iop_fifo_out_extra_r_intr___free___lsb 3
128#define reg_iop_fifo_out_extra_r_intr___free___width 1
129#define reg_iop_fifo_out_extra_r_intr___free___bit 3
130#define reg_iop_fifo_out_extra_r_intr___orun___lsb 4
131#define reg_iop_fifo_out_extra_r_intr___orun___width 1
132#define reg_iop_fifo_out_extra_r_intr___orun___bit 4
133#define reg_iop_fifo_out_extra_r_intr_offset 24
134
135/* Register r_masked_intr, scope iop_fifo_out_extra, type r */
136#define reg_iop_fifo_out_extra_r_masked_intr___urun___lsb 0
137#define reg_iop_fifo_out_extra_r_masked_intr___urun___width 1
138#define reg_iop_fifo_out_extra_r_masked_intr___urun___bit 0
139#define reg_iop_fifo_out_extra_r_masked_intr___last_data___lsb 1
140#define reg_iop_fifo_out_extra_r_masked_intr___last_data___width 1
141#define reg_iop_fifo_out_extra_r_masked_intr___last_data___bit 1
142#define reg_iop_fifo_out_extra_r_masked_intr___dav___lsb 2
143#define reg_iop_fifo_out_extra_r_masked_intr___dav___width 1
144#define reg_iop_fifo_out_extra_r_masked_intr___dav___bit 2
145#define reg_iop_fifo_out_extra_r_masked_intr___free___lsb 3
146#define reg_iop_fifo_out_extra_r_masked_intr___free___width 1
147#define reg_iop_fifo_out_extra_r_masked_intr___free___bit 3
148#define reg_iop_fifo_out_extra_r_masked_intr___orun___lsb 4
149#define reg_iop_fifo_out_extra_r_masked_intr___orun___width 1
150#define reg_iop_fifo_out_extra_r_masked_intr___orun___bit 4
151#define reg_iop_fifo_out_extra_r_masked_intr_offset 28
152
153
154/* Constants */
155#define regk_iop_fifo_out_extra_no 0x00000000
156#define regk_iop_fifo_out_extra_rw_intr_mask_default 0x00000000
157#define regk_iop_fifo_out_extra_yes 0x00000001
158#endif /* __iop_fifo_out_extra_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_mpu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_mpu_defs_asm.h
new file mode 100644
index 000000000000..80490c82cc29
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_mpu_defs_asm.h
@@ -0,0 +1,177 @@
1#ifndef __iop_mpu_defs_asm_h
2#define __iop_mpu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_mpu.r
7 * id: iop_mpu.r,v 1.30 2005/02/17 08:12:33 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_mpu_defs_asm.h ../../inst/io_proc/rtl/iop_mpu.r
11 * id: $Id: iop_mpu_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56#define STRIDE_iop_mpu_rw_r 4
57/* Register rw_r, scope iop_mpu, type rw */
58#define reg_iop_mpu_rw_r_offset 0
59
60/* Register rw_ctrl, scope iop_mpu, type rw */
61#define reg_iop_mpu_rw_ctrl___en___lsb 0
62#define reg_iop_mpu_rw_ctrl___en___width 1
63#define reg_iop_mpu_rw_ctrl___en___bit 0
64#define reg_iop_mpu_rw_ctrl_offset 128
65
66/* Register r_pc, scope iop_mpu, type r */
67#define reg_iop_mpu_r_pc___addr___lsb 0
68#define reg_iop_mpu_r_pc___addr___width 12
69#define reg_iop_mpu_r_pc_offset 132
70
71/* Register r_stat, scope iop_mpu, type r */
72#define reg_iop_mpu_r_stat___instr_reg_busy___lsb 0
73#define reg_iop_mpu_r_stat___instr_reg_busy___width 1
74#define reg_iop_mpu_r_stat___instr_reg_busy___bit 0
75#define reg_iop_mpu_r_stat___intr_busy___lsb 1
76#define reg_iop_mpu_r_stat___intr_busy___width 1
77#define reg_iop_mpu_r_stat___intr_busy___bit 1
78#define reg_iop_mpu_r_stat___intr_vect___lsb 2
79#define reg_iop_mpu_r_stat___intr_vect___width 16
80#define reg_iop_mpu_r_stat_offset 136
81
82/* Register rw_instr, scope iop_mpu, type rw */
83#define reg_iop_mpu_rw_instr_offset 140
84
85/* Register rw_immediate, scope iop_mpu, type rw */
86#define reg_iop_mpu_rw_immediate_offset 144
87
88/* Register r_trace, scope iop_mpu, type r */
89#define reg_iop_mpu_r_trace___intr_vect___lsb 0
90#define reg_iop_mpu_r_trace___intr_vect___width 16
91#define reg_iop_mpu_r_trace___pc___lsb 16
92#define reg_iop_mpu_r_trace___pc___width 12
93#define reg_iop_mpu_r_trace___en___lsb 28
94#define reg_iop_mpu_r_trace___en___width 1
95#define reg_iop_mpu_r_trace___en___bit 28
96#define reg_iop_mpu_r_trace___instr_reg_busy___lsb 29
97#define reg_iop_mpu_r_trace___instr_reg_busy___width 1
98#define reg_iop_mpu_r_trace___instr_reg_busy___bit 29
99#define reg_iop_mpu_r_trace___intr_busy___lsb 30
100#define reg_iop_mpu_r_trace___intr_busy___width 1
101#define reg_iop_mpu_r_trace___intr_busy___bit 30
102#define reg_iop_mpu_r_trace_offset 148
103
104/* Register r_wr_stat, scope iop_mpu, type r */
105#define reg_iop_mpu_r_wr_stat___r0___lsb 0
106#define reg_iop_mpu_r_wr_stat___r0___width 1
107#define reg_iop_mpu_r_wr_stat___r0___bit 0
108#define reg_iop_mpu_r_wr_stat___r1___lsb 1
109#define reg_iop_mpu_r_wr_stat___r1___width 1
110#define reg_iop_mpu_r_wr_stat___r1___bit 1
111#define reg_iop_mpu_r_wr_stat___r2___lsb 2
112#define reg_iop_mpu_r_wr_stat___r2___width 1
113#define reg_iop_mpu_r_wr_stat___r2___bit 2
114#define reg_iop_mpu_r_wr_stat___r3___lsb 3
115#define reg_iop_mpu_r_wr_stat___r3___width 1
116#define reg_iop_mpu_r_wr_stat___r3___bit 3
117#define reg_iop_mpu_r_wr_stat___r4___lsb 4
118#define reg_iop_mpu_r_wr_stat___r4___width 1
119#define reg_iop_mpu_r_wr_stat___r4___bit 4
120#define reg_iop_mpu_r_wr_stat___r5___lsb 5
121#define reg_iop_mpu_r_wr_stat___r5___width 1
122#define reg_iop_mpu_r_wr_stat___r5___bit 5
123#define reg_iop_mpu_r_wr_stat___r6___lsb 6
124#define reg_iop_mpu_r_wr_stat___r6___width 1
125#define reg_iop_mpu_r_wr_stat___r6___bit 6
126#define reg_iop_mpu_r_wr_stat___r7___lsb 7
127#define reg_iop_mpu_r_wr_stat___r7___width 1
128#define reg_iop_mpu_r_wr_stat___r7___bit 7
129#define reg_iop_mpu_r_wr_stat___r8___lsb 8
130#define reg_iop_mpu_r_wr_stat___r8___width 1
131#define reg_iop_mpu_r_wr_stat___r8___bit 8
132#define reg_iop_mpu_r_wr_stat___r9___lsb 9
133#define reg_iop_mpu_r_wr_stat___r9___width 1
134#define reg_iop_mpu_r_wr_stat___r9___bit 9
135#define reg_iop_mpu_r_wr_stat___r10___lsb 10
136#define reg_iop_mpu_r_wr_stat___r10___width 1
137#define reg_iop_mpu_r_wr_stat___r10___bit 10
138#define reg_iop_mpu_r_wr_stat___r11___lsb 11
139#define reg_iop_mpu_r_wr_stat___r11___width 1
140#define reg_iop_mpu_r_wr_stat___r11___bit 11
141#define reg_iop_mpu_r_wr_stat___r12___lsb 12
142#define reg_iop_mpu_r_wr_stat___r12___width 1
143#define reg_iop_mpu_r_wr_stat___r12___bit 12
144#define reg_iop_mpu_r_wr_stat___r13___lsb 13
145#define reg_iop_mpu_r_wr_stat___r13___width 1
146#define reg_iop_mpu_r_wr_stat___r13___bit 13
147#define reg_iop_mpu_r_wr_stat___r14___lsb 14
148#define reg_iop_mpu_r_wr_stat___r14___width 1
149#define reg_iop_mpu_r_wr_stat___r14___bit 14
150#define reg_iop_mpu_r_wr_stat___r15___lsb 15
151#define reg_iop_mpu_r_wr_stat___r15___width 1
152#define reg_iop_mpu_r_wr_stat___r15___bit 15
153#define reg_iop_mpu_r_wr_stat_offset 152
154
155#define STRIDE_iop_mpu_rw_thread 4
156/* Register rw_thread, scope iop_mpu, type rw */
157#define reg_iop_mpu_rw_thread___addr___lsb 0
158#define reg_iop_mpu_rw_thread___addr___width 12
159#define reg_iop_mpu_rw_thread_offset 156
160
161#define STRIDE_iop_mpu_rw_intr 4
162/* Register rw_intr, scope iop_mpu, type rw */
163#define reg_iop_mpu_rw_intr___addr___lsb 0
164#define reg_iop_mpu_rw_intr___addr___width 12
165#define reg_iop_mpu_rw_intr_offset 196
166
167
168/* Constants */
169#define regk_iop_mpu_no 0x00000000
170#define regk_iop_mpu_r_pc_default 0x00000000
171#define regk_iop_mpu_rw_ctrl_default 0x00000000
172#define regk_iop_mpu_rw_intr_size 0x00000010
173#define regk_iop_mpu_rw_r_size 0x00000010
174#define regk_iop_mpu_rw_thread_default 0x00000000
175#define regk_iop_mpu_rw_thread_size 0x00000004
176#define regk_iop_mpu_yes 0x00000001
177#endif /* __iop_mpu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_reg_space_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_reg_space_asm.h
new file mode 100644
index 000000000000..a20b8857b4d0
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_reg_space_asm.h
@@ -0,0 +1,44 @@
1/* Autogenerated Changes here will be lost!
2 * generated by ../gen_sw.pl Mon Apr 11 16:10:18 2005 iop_sw.cfg
3 */
4#define iop_version 0
5#define iop_fifo_in0_extra 64
6#define iop_fifo_in1_extra 128
7#define iop_fifo_out0_extra 192
8#define iop_fifo_out1_extra 256
9#define iop_trigger_grp0 320
10#define iop_trigger_grp1 384
11#define iop_trigger_grp2 448
12#define iop_trigger_grp3 512
13#define iop_trigger_grp4 576
14#define iop_trigger_grp5 640
15#define iop_trigger_grp6 704
16#define iop_trigger_grp7 768
17#define iop_crc_par0 896
18#define iop_crc_par1 1024
19#define iop_dmc_in0 1152
20#define iop_dmc_in1 1280
21#define iop_dmc_out0 1408
22#define iop_dmc_out1 1536
23#define iop_fifo_in0 1664
24#define iop_fifo_in1 1792
25#define iop_fifo_out0 1920
26#define iop_fifo_out1 2048
27#define iop_scrc_in0 2176
28#define iop_scrc_in1 2304
29#define iop_scrc_out0 2432
30#define iop_scrc_out1 2560
31#define iop_timer_grp0 2688
32#define iop_timer_grp1 2816
33#define iop_timer_grp2 2944
34#define iop_timer_grp3 3072
35#define iop_sap_in 3328
36#define iop_sap_out 3584
37#define iop_spu0 3840
38#define iop_spu1 4096
39#define iop_sw_cfg 4352
40#define iop_sw_cpu 4608
41#define iop_sw_mpu 4864
42#define iop_sw_spu0 5120
43#define iop_sw_spu1 5376
44#define iop_mpu 5632
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_in_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_in_defs_asm.h
new file mode 100644
index 000000000000..a4a10ff300b3
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_in_defs_asm.h
@@ -0,0 +1,182 @@
1#ifndef __iop_sap_in_defs_asm_h
2#define __iop_sap_in_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_sap_in.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sap_in_defs_asm.h ../../inst/io_proc/rtl/iop_sap_in.r
11 * id: $Id: iop_sap_in_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_bus0_sync, scope iop_sap_in, type rw */
57#define reg_iop_sap_in_rw_bus0_sync___byte0_sel___lsb 0
58#define reg_iop_sap_in_rw_bus0_sync___byte0_sel___width 2
59#define reg_iop_sap_in_rw_bus0_sync___byte0_ext_src___lsb 2
60#define reg_iop_sap_in_rw_bus0_sync___byte0_ext_src___width 3
61#define reg_iop_sap_in_rw_bus0_sync___byte0_edge___lsb 5
62#define reg_iop_sap_in_rw_bus0_sync___byte0_edge___width 2
63#define reg_iop_sap_in_rw_bus0_sync___byte0_delay___lsb 7
64#define reg_iop_sap_in_rw_bus0_sync___byte0_delay___width 1
65#define reg_iop_sap_in_rw_bus0_sync___byte0_delay___bit 7
66#define reg_iop_sap_in_rw_bus0_sync___byte1_sel___lsb 8
67#define reg_iop_sap_in_rw_bus0_sync___byte1_sel___width 2
68#define reg_iop_sap_in_rw_bus0_sync___byte1_ext_src___lsb 10
69#define reg_iop_sap_in_rw_bus0_sync___byte1_ext_src___width 3
70#define reg_iop_sap_in_rw_bus0_sync___byte1_edge___lsb 13
71#define reg_iop_sap_in_rw_bus0_sync___byte1_edge___width 2
72#define reg_iop_sap_in_rw_bus0_sync___byte1_delay___lsb 15
73#define reg_iop_sap_in_rw_bus0_sync___byte1_delay___width 1
74#define reg_iop_sap_in_rw_bus0_sync___byte1_delay___bit 15
75#define reg_iop_sap_in_rw_bus0_sync___byte2_sel___lsb 16
76#define reg_iop_sap_in_rw_bus0_sync___byte2_sel___width 2
77#define reg_iop_sap_in_rw_bus0_sync___byte2_ext_src___lsb 18
78#define reg_iop_sap_in_rw_bus0_sync___byte2_ext_src___width 3
79#define reg_iop_sap_in_rw_bus0_sync___byte2_edge___lsb 21
80#define reg_iop_sap_in_rw_bus0_sync___byte2_edge___width 2
81#define reg_iop_sap_in_rw_bus0_sync___byte2_delay___lsb 23
82#define reg_iop_sap_in_rw_bus0_sync___byte2_delay___width 1
83#define reg_iop_sap_in_rw_bus0_sync___byte2_delay___bit 23
84#define reg_iop_sap_in_rw_bus0_sync___byte3_sel___lsb 24
85#define reg_iop_sap_in_rw_bus0_sync___byte3_sel___width 2
86#define reg_iop_sap_in_rw_bus0_sync___byte3_ext_src___lsb 26
87#define reg_iop_sap_in_rw_bus0_sync___byte3_ext_src___width 3
88#define reg_iop_sap_in_rw_bus0_sync___byte3_edge___lsb 29
89#define reg_iop_sap_in_rw_bus0_sync___byte3_edge___width 2
90#define reg_iop_sap_in_rw_bus0_sync___byte3_delay___lsb 31
91#define reg_iop_sap_in_rw_bus0_sync___byte3_delay___width 1
92#define reg_iop_sap_in_rw_bus0_sync___byte3_delay___bit 31
93#define reg_iop_sap_in_rw_bus0_sync_offset 0
94
95/* Register rw_bus1_sync, scope iop_sap_in, type rw */
96#define reg_iop_sap_in_rw_bus1_sync___byte0_sel___lsb 0
97#define reg_iop_sap_in_rw_bus1_sync___byte0_sel___width 2
98#define reg_iop_sap_in_rw_bus1_sync___byte0_ext_src___lsb 2
99#define reg_iop_sap_in_rw_bus1_sync___byte0_ext_src___width 3
100#define reg_iop_sap_in_rw_bus1_sync___byte0_edge___lsb 5
101#define reg_iop_sap_in_rw_bus1_sync___byte0_edge___width 2
102#define reg_iop_sap_in_rw_bus1_sync___byte0_delay___lsb 7
103#define reg_iop_sap_in_rw_bus1_sync___byte0_delay___width 1
104#define reg_iop_sap_in_rw_bus1_sync___byte0_delay___bit 7
105#define reg_iop_sap_in_rw_bus1_sync___byte1_sel___lsb 8
106#define reg_iop_sap_in_rw_bus1_sync___byte1_sel___width 2
107#define reg_iop_sap_in_rw_bus1_sync___byte1_ext_src___lsb 10
108#define reg_iop_sap_in_rw_bus1_sync___byte1_ext_src___width 3
109#define reg_iop_sap_in_rw_bus1_sync___byte1_edge___lsb 13
110#define reg_iop_sap_in_rw_bus1_sync___byte1_edge___width 2
111#define reg_iop_sap_in_rw_bus1_sync___byte1_delay___lsb 15
112#define reg_iop_sap_in_rw_bus1_sync___byte1_delay___width 1
113#define reg_iop_sap_in_rw_bus1_sync___byte1_delay___bit 15
114#define reg_iop_sap_in_rw_bus1_sync___byte2_sel___lsb 16
115#define reg_iop_sap_in_rw_bus1_sync___byte2_sel___width 2
116#define reg_iop_sap_in_rw_bus1_sync___byte2_ext_src___lsb 18
117#define reg_iop_sap_in_rw_bus1_sync___byte2_ext_src___width 3
118#define reg_iop_sap_in_rw_bus1_sync___byte2_edge___lsb 21
119#define reg_iop_sap_in_rw_bus1_sync___byte2_edge___width 2
120#define reg_iop_sap_in_rw_bus1_sync___byte2_delay___lsb 23
121#define reg_iop_sap_in_rw_bus1_sync___byte2_delay___width 1
122#define reg_iop_sap_in_rw_bus1_sync___byte2_delay___bit 23
123#define reg_iop_sap_in_rw_bus1_sync___byte3_sel___lsb 24
124#define reg_iop_sap_in_rw_bus1_sync___byte3_sel___width 2
125#define reg_iop_sap_in_rw_bus1_sync___byte3_ext_src___lsb 26
126#define reg_iop_sap_in_rw_bus1_sync___byte3_ext_src___width 3
127#define reg_iop_sap_in_rw_bus1_sync___byte3_edge___lsb 29
128#define reg_iop_sap_in_rw_bus1_sync___byte3_edge___width 2
129#define reg_iop_sap_in_rw_bus1_sync___byte3_delay___lsb 31
130#define reg_iop_sap_in_rw_bus1_sync___byte3_delay___width 1
131#define reg_iop_sap_in_rw_bus1_sync___byte3_delay___bit 31
132#define reg_iop_sap_in_rw_bus1_sync_offset 4
133
134#define STRIDE_iop_sap_in_rw_gio 4
135/* Register rw_gio, scope iop_sap_in, type rw */
136#define reg_iop_sap_in_rw_gio___sync_sel___lsb 0
137#define reg_iop_sap_in_rw_gio___sync_sel___width 2
138#define reg_iop_sap_in_rw_gio___sync_ext_src___lsb 2
139#define reg_iop_sap_in_rw_gio___sync_ext_src___width 3
140#define reg_iop_sap_in_rw_gio___sync_edge___lsb 5
141#define reg_iop_sap_in_rw_gio___sync_edge___width 2
142#define reg_iop_sap_in_rw_gio___delay___lsb 7
143#define reg_iop_sap_in_rw_gio___delay___width 1
144#define reg_iop_sap_in_rw_gio___delay___bit 7
145#define reg_iop_sap_in_rw_gio___logic___lsb 8
146#define reg_iop_sap_in_rw_gio___logic___width 2
147#define reg_iop_sap_in_rw_gio_offset 8
148
149
150/* Constants */
151#define regk_iop_sap_in_and 0x00000002
152#define regk_iop_sap_in_ext_clk200 0x00000003
153#define regk_iop_sap_in_gio1 0x00000000
154#define regk_iop_sap_in_gio13 0x00000005
155#define regk_iop_sap_in_gio18 0x00000003
156#define regk_iop_sap_in_gio19 0x00000004
157#define regk_iop_sap_in_gio21 0x00000006
158#define regk_iop_sap_in_gio23 0x00000005
159#define regk_iop_sap_in_gio29 0x00000007
160#define regk_iop_sap_in_gio5 0x00000004
161#define regk_iop_sap_in_gio6 0x00000001
162#define regk_iop_sap_in_gio7 0x00000002
163#define regk_iop_sap_in_inv 0x00000001
164#define regk_iop_sap_in_neg 0x00000002
165#define regk_iop_sap_in_no 0x00000000
166#define regk_iop_sap_in_no_del_ext_clk200 0x00000001
167#define regk_iop_sap_in_none 0x00000000
168#define regk_iop_sap_in_or 0x00000003
169#define regk_iop_sap_in_pos 0x00000001
170#define regk_iop_sap_in_pos_neg 0x00000003
171#define regk_iop_sap_in_rw_bus0_sync_default 0x02020202
172#define regk_iop_sap_in_rw_bus1_sync_default 0x02020202
173#define regk_iop_sap_in_rw_gio_default 0x00000002
174#define regk_iop_sap_in_rw_gio_size 0x00000020
175#define regk_iop_sap_in_timer_grp0_tmr3 0x00000006
176#define regk_iop_sap_in_timer_grp1_tmr3 0x00000004
177#define regk_iop_sap_in_timer_grp2_tmr3 0x00000005
178#define regk_iop_sap_in_timer_grp3_tmr3 0x00000007
179#define regk_iop_sap_in_tmr_clk200 0x00000000
180#define regk_iop_sap_in_two_clk200 0x00000002
181#define regk_iop_sap_in_yes 0x00000001
182#endif /* __iop_sap_in_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_out_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_out_defs_asm.h
new file mode 100644
index 000000000000..0ec727f92a25
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_out_defs_asm.h
@@ -0,0 +1,346 @@
1#ifndef __iop_sap_out_defs_asm_h
2#define __iop_sap_out_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_sap_out.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sap_out_defs_asm.h ../../inst/io_proc/rtl/iop_sap_out.r
11 * id: $Id: iop_sap_out_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_gen_gated, scope iop_sap_out, type rw */
57#define reg_iop_sap_out_rw_gen_gated___clk0_src___lsb 0
58#define reg_iop_sap_out_rw_gen_gated___clk0_src___width 2
59#define reg_iop_sap_out_rw_gen_gated___clk0_gate_src___lsb 2
60#define reg_iop_sap_out_rw_gen_gated___clk0_gate_src___width 2
61#define reg_iop_sap_out_rw_gen_gated___clk0_force_src___lsb 4
62#define reg_iop_sap_out_rw_gen_gated___clk0_force_src___width 3
63#define reg_iop_sap_out_rw_gen_gated___clk1_src___lsb 7
64#define reg_iop_sap_out_rw_gen_gated___clk1_src___width 2
65#define reg_iop_sap_out_rw_gen_gated___clk1_gate_src___lsb 9
66#define reg_iop_sap_out_rw_gen_gated___clk1_gate_src___width 2
67#define reg_iop_sap_out_rw_gen_gated___clk1_force_src___lsb 11
68#define reg_iop_sap_out_rw_gen_gated___clk1_force_src___width 3
69#define reg_iop_sap_out_rw_gen_gated___clk2_src___lsb 14
70#define reg_iop_sap_out_rw_gen_gated___clk2_src___width 2
71#define reg_iop_sap_out_rw_gen_gated___clk2_gate_src___lsb 16
72#define reg_iop_sap_out_rw_gen_gated___clk2_gate_src___width 2
73#define reg_iop_sap_out_rw_gen_gated___clk2_force_src___lsb 18
74#define reg_iop_sap_out_rw_gen_gated___clk2_force_src___width 3
75#define reg_iop_sap_out_rw_gen_gated___clk3_src___lsb 21
76#define reg_iop_sap_out_rw_gen_gated___clk3_src___width 2
77#define reg_iop_sap_out_rw_gen_gated___clk3_gate_src___lsb 23
78#define reg_iop_sap_out_rw_gen_gated___clk3_gate_src___width 2
79#define reg_iop_sap_out_rw_gen_gated___clk3_force_src___lsb 25
80#define reg_iop_sap_out_rw_gen_gated___clk3_force_src___width 3
81#define reg_iop_sap_out_rw_gen_gated_offset 0
82
83/* Register rw_bus0, scope iop_sap_out, type rw */
84#define reg_iop_sap_out_rw_bus0___byte0_clk_sel___lsb 0
85#define reg_iop_sap_out_rw_bus0___byte0_clk_sel___width 3
86#define reg_iop_sap_out_rw_bus0___byte0_gated_clk___lsb 3
87#define reg_iop_sap_out_rw_bus0___byte0_gated_clk___width 2
88#define reg_iop_sap_out_rw_bus0___byte0_clk_inv___lsb 5
89#define reg_iop_sap_out_rw_bus0___byte0_clk_inv___width 1
90#define reg_iop_sap_out_rw_bus0___byte0_clk_inv___bit 5
91#define reg_iop_sap_out_rw_bus0___byte1_clk_sel___lsb 6
92#define reg_iop_sap_out_rw_bus0___byte1_clk_sel___width 3
93#define reg_iop_sap_out_rw_bus0___byte1_gated_clk___lsb 9
94#define reg_iop_sap_out_rw_bus0___byte1_gated_clk___width 2
95#define reg_iop_sap_out_rw_bus0___byte1_clk_inv___lsb 11
96#define reg_iop_sap_out_rw_bus0___byte1_clk_inv___width 1
97#define reg_iop_sap_out_rw_bus0___byte1_clk_inv___bit 11
98#define reg_iop_sap_out_rw_bus0___byte2_clk_sel___lsb 12
99#define reg_iop_sap_out_rw_bus0___byte2_clk_sel___width 3
100#define reg_iop_sap_out_rw_bus0___byte2_gated_clk___lsb 15
101#define reg_iop_sap_out_rw_bus0___byte2_gated_clk___width 2
102#define reg_iop_sap_out_rw_bus0___byte2_clk_inv___lsb 17
103#define reg_iop_sap_out_rw_bus0___byte2_clk_inv___width 1
104#define reg_iop_sap_out_rw_bus0___byte2_clk_inv___bit 17
105#define reg_iop_sap_out_rw_bus0___byte3_clk_sel___lsb 18
106#define reg_iop_sap_out_rw_bus0___byte3_clk_sel___width 3
107#define reg_iop_sap_out_rw_bus0___byte3_gated_clk___lsb 21
108#define reg_iop_sap_out_rw_bus0___byte3_gated_clk___width 2
109#define reg_iop_sap_out_rw_bus0___byte3_clk_inv___lsb 23
110#define reg_iop_sap_out_rw_bus0___byte3_clk_inv___width 1
111#define reg_iop_sap_out_rw_bus0___byte3_clk_inv___bit 23
112#define reg_iop_sap_out_rw_bus0_offset 4
113
114/* Register rw_bus1, scope iop_sap_out, type rw */
115#define reg_iop_sap_out_rw_bus1___byte0_clk_sel___lsb 0
116#define reg_iop_sap_out_rw_bus1___byte0_clk_sel___width 3
117#define reg_iop_sap_out_rw_bus1___byte0_gated_clk___lsb 3
118#define reg_iop_sap_out_rw_bus1___byte0_gated_clk___width 2
119#define reg_iop_sap_out_rw_bus1___byte0_clk_inv___lsb 5
120#define reg_iop_sap_out_rw_bus1___byte0_clk_inv___width 1
121#define reg_iop_sap_out_rw_bus1___byte0_clk_inv___bit 5
122#define reg_iop_sap_out_rw_bus1___byte1_clk_sel___lsb 6
123#define reg_iop_sap_out_rw_bus1___byte1_clk_sel___width 3
124#define reg_iop_sap_out_rw_bus1___byte1_gated_clk___lsb 9
125#define reg_iop_sap_out_rw_bus1___byte1_gated_clk___width 2
126#define reg_iop_sap_out_rw_bus1___byte1_clk_inv___lsb 11
127#define reg_iop_sap_out_rw_bus1___byte1_clk_inv___width 1
128#define reg_iop_sap_out_rw_bus1___byte1_clk_inv___bit 11
129#define reg_iop_sap_out_rw_bus1___byte2_clk_sel___lsb 12
130#define reg_iop_sap_out_rw_bus1___byte2_clk_sel___width 3
131#define reg_iop_sap_out_rw_bus1___byte2_gated_clk___lsb 15
132#define reg_iop_sap_out_rw_bus1___byte2_gated_clk___width 2
133#define reg_iop_sap_out_rw_bus1___byte2_clk_inv___lsb 17
134#define reg_iop_sap_out_rw_bus1___byte2_clk_inv___width 1
135#define reg_iop_sap_out_rw_bus1___byte2_clk_inv___bit 17
136#define reg_iop_sap_out_rw_bus1___byte3_clk_sel___lsb 18
137#define reg_iop_sap_out_rw_bus1___byte3_clk_sel___width 3
138#define reg_iop_sap_out_rw_bus1___byte3_gated_clk___lsb 21
139#define reg_iop_sap_out_rw_bus1___byte3_gated_clk___width 2
140#define reg_iop_sap_out_rw_bus1___byte3_clk_inv___lsb 23
141#define reg_iop_sap_out_rw_bus1___byte3_clk_inv___width 1
142#define reg_iop_sap_out_rw_bus1___byte3_clk_inv___bit 23
143#define reg_iop_sap_out_rw_bus1_offset 8
144
145/* Register rw_bus0_lo_oe, scope iop_sap_out, type rw */
146#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_sel___lsb 0
147#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_sel___width 3
148#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_ext___lsb 3
149#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_ext___width 3
150#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_gated_clk___lsb 6
151#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_gated_clk___width 2
152#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_inv___lsb 8
153#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_inv___width 1
154#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_clk_inv___bit 8
155#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_logic___lsb 9
156#define reg_iop_sap_out_rw_bus0_lo_oe___byte0_logic___width 2
157#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_sel___lsb 11
158#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_sel___width 3
159#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_ext___lsb 14
160#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_ext___width 3
161#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_gated_clk___lsb 17
162#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_gated_clk___width 2
163#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_inv___lsb 19
164#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_inv___width 1
165#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_clk_inv___bit 19
166#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_logic___lsb 20
167#define reg_iop_sap_out_rw_bus0_lo_oe___byte1_logic___width 2
168#define reg_iop_sap_out_rw_bus0_lo_oe_offset 12
169
170/* Register rw_bus0_hi_oe, scope iop_sap_out, type rw */
171#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_sel___lsb 0
172#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_sel___width 3
173#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_ext___lsb 3
174#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_ext___width 3
175#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_gated_clk___lsb 6
176#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_gated_clk___width 2
177#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_inv___lsb 8
178#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_inv___width 1
179#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_clk_inv___bit 8
180#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_logic___lsb 9
181#define reg_iop_sap_out_rw_bus0_hi_oe___byte2_logic___width 2
182#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_sel___lsb 11
183#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_sel___width 3
184#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_ext___lsb 14
185#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_ext___width 3
186#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_gated_clk___lsb 17
187#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_gated_clk___width 2
188#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_inv___lsb 19
189#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_inv___width 1
190#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_clk_inv___bit 19
191#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_logic___lsb 20
192#define reg_iop_sap_out_rw_bus0_hi_oe___byte3_logic___width 2
193#define reg_iop_sap_out_rw_bus0_hi_oe_offset 16
194
195/* Register rw_bus1_lo_oe, scope iop_sap_out, type rw */
196#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_sel___lsb 0
197#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_sel___width 3
198#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_ext___lsb 3
199#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_ext___width 3
200#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_gated_clk___lsb 6
201#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_gated_clk___width 2
202#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_inv___lsb 8
203#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_inv___width 1
204#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_clk_inv___bit 8
205#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_logic___lsb 9
206#define reg_iop_sap_out_rw_bus1_lo_oe___byte0_logic___width 2
207#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_sel___lsb 11
208#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_sel___width 3
209#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_ext___lsb 14
210#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_ext___width 3
211#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_gated_clk___lsb 17
212#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_gated_clk___width 2
213#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_inv___lsb 19
214#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_inv___width 1
215#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_clk_inv___bit 19
216#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_logic___lsb 20
217#define reg_iop_sap_out_rw_bus1_lo_oe___byte1_logic___width 2
218#define reg_iop_sap_out_rw_bus1_lo_oe_offset 20
219
220/* Register rw_bus1_hi_oe, scope iop_sap_out, type rw */
221#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_sel___lsb 0
222#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_sel___width 3
223#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_ext___lsb 3
224#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_ext___width 3
225#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_gated_clk___lsb 6
226#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_gated_clk___width 2
227#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_inv___lsb 8
228#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_inv___width 1
229#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_clk_inv___bit 8
230#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_logic___lsb 9
231#define reg_iop_sap_out_rw_bus1_hi_oe___byte2_logic___width 2
232#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_sel___lsb 11
233#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_sel___width 3
234#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_ext___lsb 14
235#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_ext___width 3
236#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_gated_clk___lsb 17
237#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_gated_clk___width 2
238#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_inv___lsb 19
239#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_inv___width 1
240#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_clk_inv___bit 19
241#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_logic___lsb 20
242#define reg_iop_sap_out_rw_bus1_hi_oe___byte3_logic___width 2
243#define reg_iop_sap_out_rw_bus1_hi_oe_offset 24
244
245#define STRIDE_iop_sap_out_rw_gio 4
246/* Register rw_gio, scope iop_sap_out, type rw */
247#define reg_iop_sap_out_rw_gio___out_clk_sel___lsb 0
248#define reg_iop_sap_out_rw_gio___out_clk_sel___width 3
249#define reg_iop_sap_out_rw_gio___out_clk_ext___lsb 3
250#define reg_iop_sap_out_rw_gio___out_clk_ext___width 4
251#define reg_iop_sap_out_rw_gio___out_gated_clk___lsb 7
252#define reg_iop_sap_out_rw_gio___out_gated_clk___width 2
253#define reg_iop_sap_out_rw_gio___out_clk_inv___lsb 9
254#define reg_iop_sap_out_rw_gio___out_clk_inv___width 1
255#define reg_iop_sap_out_rw_gio___out_clk_inv___bit 9
256#define reg_iop_sap_out_rw_gio___out_logic___lsb 10
257#define reg_iop_sap_out_rw_gio___out_logic___width 1
258#define reg_iop_sap_out_rw_gio___out_logic___bit 10
259#define reg_iop_sap_out_rw_gio___oe_clk_sel___lsb 11
260#define reg_iop_sap_out_rw_gio___oe_clk_sel___width 3
261#define reg_iop_sap_out_rw_gio___oe_clk_ext___lsb 14
262#define reg_iop_sap_out_rw_gio___oe_clk_ext___width 3
263#define reg_iop_sap_out_rw_gio___oe_gated_clk___lsb 17
264#define reg_iop_sap_out_rw_gio___oe_gated_clk___width 2
265#define reg_iop_sap_out_rw_gio___oe_clk_inv___lsb 19
266#define reg_iop_sap_out_rw_gio___oe_clk_inv___width 1
267#define reg_iop_sap_out_rw_gio___oe_clk_inv___bit 19
268#define reg_iop_sap_out_rw_gio___oe_logic___lsb 20
269#define reg_iop_sap_out_rw_gio___oe_logic___width 2
270#define reg_iop_sap_out_rw_gio_offset 28
271
272
273/* Constants */
274#define regk_iop_sap_out_and 0x00000002
275#define regk_iop_sap_out_clk0 0x00000000
276#define regk_iop_sap_out_clk1 0x00000001
277#define regk_iop_sap_out_clk12 0x00000002
278#define regk_iop_sap_out_clk2 0x00000002
279#define regk_iop_sap_out_clk200 0x00000001
280#define regk_iop_sap_out_clk3 0x00000003
281#define regk_iop_sap_out_ext 0x00000003
282#define regk_iop_sap_out_gated 0x00000004
283#define regk_iop_sap_out_gio1 0x00000000
284#define regk_iop_sap_out_gio13 0x00000002
285#define regk_iop_sap_out_gio13_clk 0x0000000c
286#define regk_iop_sap_out_gio15 0x00000001
287#define regk_iop_sap_out_gio18 0x00000003
288#define regk_iop_sap_out_gio18_clk 0x0000000d
289#define regk_iop_sap_out_gio1_clk 0x00000008
290#define regk_iop_sap_out_gio21_clk 0x0000000e
291#define regk_iop_sap_out_gio23 0x00000002
292#define regk_iop_sap_out_gio29_clk 0x0000000f
293#define regk_iop_sap_out_gio31 0x00000003
294#define regk_iop_sap_out_gio5 0x00000001
295#define regk_iop_sap_out_gio5_clk 0x00000009
296#define regk_iop_sap_out_gio6_clk 0x0000000a
297#define regk_iop_sap_out_gio7 0x00000000
298#define regk_iop_sap_out_gio7_clk 0x0000000b
299#define regk_iop_sap_out_gio_in13 0x00000001
300#define regk_iop_sap_out_gio_in21 0x00000002
301#define regk_iop_sap_out_gio_in29 0x00000003
302#define regk_iop_sap_out_gio_in5 0x00000000
303#define regk_iop_sap_out_inv 0x00000001
304#define regk_iop_sap_out_nand 0x00000003
305#define regk_iop_sap_out_no 0x00000000
306#define regk_iop_sap_out_none 0x00000000
307#define regk_iop_sap_out_rw_bus0_default 0x00000000
308#define regk_iop_sap_out_rw_bus0_hi_oe_default 0x00000000
309#define regk_iop_sap_out_rw_bus0_lo_oe_default 0x00000000
310#define regk_iop_sap_out_rw_bus1_default 0x00000000
311#define regk_iop_sap_out_rw_bus1_hi_oe_default 0x00000000
312#define regk_iop_sap_out_rw_bus1_lo_oe_default 0x00000000
313#define regk_iop_sap_out_rw_gen_gated_default 0x00000000
314#define regk_iop_sap_out_rw_gio_default 0x00000000
315#define regk_iop_sap_out_rw_gio_size 0x00000020
316#define regk_iop_sap_out_spu0_gio0 0x00000002
317#define regk_iop_sap_out_spu0_gio1 0x00000003
318#define regk_iop_sap_out_spu0_gio12 0x00000004
319#define regk_iop_sap_out_spu0_gio13 0x00000004
320#define regk_iop_sap_out_spu0_gio14 0x00000004
321#define regk_iop_sap_out_spu0_gio15 0x00000004
322#define regk_iop_sap_out_spu0_gio2 0x00000002
323#define regk_iop_sap_out_spu0_gio3 0x00000003
324#define regk_iop_sap_out_spu0_gio4 0x00000002
325#define regk_iop_sap_out_spu0_gio5 0x00000003
326#define regk_iop_sap_out_spu0_gio6 0x00000002
327#define regk_iop_sap_out_spu0_gio7 0x00000003
328#define regk_iop_sap_out_spu1_gio0 0x00000005
329#define regk_iop_sap_out_spu1_gio1 0x00000006
330#define regk_iop_sap_out_spu1_gio12 0x00000007
331#define regk_iop_sap_out_spu1_gio13 0x00000007
332#define regk_iop_sap_out_spu1_gio14 0x00000007
333#define regk_iop_sap_out_spu1_gio15 0x00000007
334#define regk_iop_sap_out_spu1_gio2 0x00000005
335#define regk_iop_sap_out_spu1_gio3 0x00000006
336#define regk_iop_sap_out_spu1_gio4 0x00000005
337#define regk_iop_sap_out_spu1_gio5 0x00000006
338#define regk_iop_sap_out_spu1_gio6 0x00000005
339#define regk_iop_sap_out_spu1_gio7 0x00000006
340#define regk_iop_sap_out_timer_grp0_tmr2 0x00000004
341#define regk_iop_sap_out_timer_grp1_tmr2 0x00000005
342#define regk_iop_sap_out_timer_grp2_tmr2 0x00000006
343#define regk_iop_sap_out_timer_grp3_tmr2 0x00000007
344#define regk_iop_sap_out_tmr 0x00000005
345#define regk_iop_sap_out_yes 0x00000001
346#endif /* __iop_sap_out_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_in_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_in_defs_asm.h
new file mode 100644
index 000000000000..2cf5721597fc
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_in_defs_asm.h
@@ -0,0 +1,111 @@
1#ifndef __iop_scrc_in_defs_asm_h
2#define __iop_scrc_in_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_scrc_in.r
7 * id: iop_scrc_in.r,v 1.10 2005/02/16 09:13:58 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_scrc_in_defs_asm.h ../../inst/io_proc/rtl/iop_scrc_in.r
11 * id: $Id: iop_scrc_in_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_scrc_in, type rw */
57#define reg_iop_scrc_in_rw_cfg___trig___lsb 0
58#define reg_iop_scrc_in_rw_cfg___trig___width 2
59#define reg_iop_scrc_in_rw_cfg_offset 0
60
61/* Register rw_ctrl, scope iop_scrc_in, type rw */
62#define reg_iop_scrc_in_rw_ctrl___dif_in_en___lsb 0
63#define reg_iop_scrc_in_rw_ctrl___dif_in_en___width 1
64#define reg_iop_scrc_in_rw_ctrl___dif_in_en___bit 0
65#define reg_iop_scrc_in_rw_ctrl_offset 4
66
67/* Register r_stat, scope iop_scrc_in, type r */
68#define reg_iop_scrc_in_r_stat___err___lsb 0
69#define reg_iop_scrc_in_r_stat___err___width 1
70#define reg_iop_scrc_in_r_stat___err___bit 0
71#define reg_iop_scrc_in_r_stat_offset 8
72
73/* Register rw_init_crc, scope iop_scrc_in, type rw */
74#define reg_iop_scrc_in_rw_init_crc_offset 12
75
76/* Register rs_computed_crc, scope iop_scrc_in, type rs */
77#define reg_iop_scrc_in_rs_computed_crc_offset 16
78
79/* Register r_computed_crc, scope iop_scrc_in, type r */
80#define reg_iop_scrc_in_r_computed_crc_offset 20
81
82/* Register rw_crc, scope iop_scrc_in, type rw */
83#define reg_iop_scrc_in_rw_crc_offset 24
84
85/* Register rw_correct_crc, scope iop_scrc_in, type rw */
86#define reg_iop_scrc_in_rw_correct_crc_offset 28
87
88/* Register rw_wr1bit, scope iop_scrc_in, type rw */
89#define reg_iop_scrc_in_rw_wr1bit___data___lsb 0
90#define reg_iop_scrc_in_rw_wr1bit___data___width 2
91#define reg_iop_scrc_in_rw_wr1bit___last___lsb 2
92#define reg_iop_scrc_in_rw_wr1bit___last___width 2
93#define reg_iop_scrc_in_rw_wr1bit_offset 32
94
95
96/* Constants */
97#define regk_iop_scrc_in_dif_in 0x00000002
98#define regk_iop_scrc_in_hi 0x00000000
99#define regk_iop_scrc_in_neg 0x00000002
100#define regk_iop_scrc_in_no 0x00000000
101#define regk_iop_scrc_in_pos 0x00000001
102#define regk_iop_scrc_in_pos_neg 0x00000003
103#define regk_iop_scrc_in_r_computed_crc_default 0x00000000
104#define regk_iop_scrc_in_rs_computed_crc_default 0x00000000
105#define regk_iop_scrc_in_rw_cfg_default 0x00000000
106#define regk_iop_scrc_in_rw_ctrl_default 0x00000000
107#define regk_iop_scrc_in_rw_init_crc_default 0x00000000
108#define regk_iop_scrc_in_set0 0x00000000
109#define regk_iop_scrc_in_set1 0x00000001
110#define regk_iop_scrc_in_yes 0x00000001
111#endif /* __iop_scrc_in_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_out_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_out_defs_asm.h
new file mode 100644
index 000000000000..640a25725f20
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_out_defs_asm.h
@@ -0,0 +1,105 @@
1#ifndef __iop_scrc_out_defs_asm_h
2#define __iop_scrc_out_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_scrc_out.r
7 * id: iop_scrc_out.r,v 1.11 2005/02/16 09:13:38 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_scrc_out_defs_asm.h ../../inst/io_proc/rtl/iop_scrc_out.r
11 * id: $Id: iop_scrc_out_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_scrc_out, type rw */
57#define reg_iop_scrc_out_rw_cfg___trig___lsb 0
58#define reg_iop_scrc_out_rw_cfg___trig___width 2
59#define reg_iop_scrc_out_rw_cfg___inv_crc___lsb 2
60#define reg_iop_scrc_out_rw_cfg___inv_crc___width 1
61#define reg_iop_scrc_out_rw_cfg___inv_crc___bit 2
62#define reg_iop_scrc_out_rw_cfg_offset 0
63
64/* Register rw_ctrl, scope iop_scrc_out, type rw */
65#define reg_iop_scrc_out_rw_ctrl___strb_src___lsb 0
66#define reg_iop_scrc_out_rw_ctrl___strb_src___width 1
67#define reg_iop_scrc_out_rw_ctrl___strb_src___bit 0
68#define reg_iop_scrc_out_rw_ctrl___out_src___lsb 1
69#define reg_iop_scrc_out_rw_ctrl___out_src___width 1
70#define reg_iop_scrc_out_rw_ctrl___out_src___bit 1
71#define reg_iop_scrc_out_rw_ctrl_offset 4
72
73/* Register rw_init_crc, scope iop_scrc_out, type rw */
74#define reg_iop_scrc_out_rw_init_crc_offset 8
75
76/* Register rw_crc, scope iop_scrc_out, type rw */
77#define reg_iop_scrc_out_rw_crc_offset 12
78
79/* Register rw_data, scope iop_scrc_out, type rw */
80#define reg_iop_scrc_out_rw_data___val___lsb 0
81#define reg_iop_scrc_out_rw_data___val___width 1
82#define reg_iop_scrc_out_rw_data___val___bit 0
83#define reg_iop_scrc_out_rw_data_offset 16
84
85/* Register r_computed_crc, scope iop_scrc_out, type r */
86#define reg_iop_scrc_out_r_computed_crc_offset 20
87
88
89/* Constants */
90#define regk_iop_scrc_out_crc 0x00000001
91#define regk_iop_scrc_out_data 0x00000000
92#define regk_iop_scrc_out_dif 0x00000001
93#define regk_iop_scrc_out_hi 0x00000000
94#define regk_iop_scrc_out_neg 0x00000002
95#define regk_iop_scrc_out_no 0x00000000
96#define regk_iop_scrc_out_pos 0x00000001
97#define regk_iop_scrc_out_pos_neg 0x00000003
98#define regk_iop_scrc_out_reg 0x00000000
99#define regk_iop_scrc_out_rw_cfg_default 0x00000000
100#define regk_iop_scrc_out_rw_crc_default 0x00000000
101#define regk_iop_scrc_out_rw_ctrl_default 0x00000000
102#define regk_iop_scrc_out_rw_data_default 0x00000000
103#define regk_iop_scrc_out_rw_init_crc_default 0x00000000
104#define regk_iop_scrc_out_yes 0x00000001
105#endif /* __iop_scrc_out_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_spu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_spu_defs_asm.h
new file mode 100644
index 000000000000..bb402c1aa761
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_spu_defs_asm.h
@@ -0,0 +1,573 @@
1#ifndef __iop_spu_defs_asm_h
2#define __iop_spu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_spu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_spu_defs_asm.h ../../inst/io_proc/rtl/iop_spu.r
11 * id: $Id: iop_spu_defs_asm.h,v 1.5 2005/04/24 18:31:06 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56#define STRIDE_iop_spu_rw_r 4
57/* Register rw_r, scope iop_spu, type rw */
58#define reg_iop_spu_rw_r_offset 0
59
60/* Register rw_seq_pc, scope iop_spu, type rw */
61#define reg_iop_spu_rw_seq_pc___addr___lsb 0
62#define reg_iop_spu_rw_seq_pc___addr___width 12
63#define reg_iop_spu_rw_seq_pc_offset 64
64
65/* Register rw_fsm_pc, scope iop_spu, type rw */
66#define reg_iop_spu_rw_fsm_pc___addr___lsb 0
67#define reg_iop_spu_rw_fsm_pc___addr___width 12
68#define reg_iop_spu_rw_fsm_pc_offset 68
69
70/* Register rw_ctrl, scope iop_spu, type rw */
71#define reg_iop_spu_rw_ctrl___fsm___lsb 0
72#define reg_iop_spu_rw_ctrl___fsm___width 1
73#define reg_iop_spu_rw_ctrl___fsm___bit 0
74#define reg_iop_spu_rw_ctrl___en___lsb 1
75#define reg_iop_spu_rw_ctrl___en___width 1
76#define reg_iop_spu_rw_ctrl___en___bit 1
77#define reg_iop_spu_rw_ctrl_offset 72
78
79/* Register rw_fsm_inputs3_0, scope iop_spu, type rw */
80#define reg_iop_spu_rw_fsm_inputs3_0___val0___lsb 0
81#define reg_iop_spu_rw_fsm_inputs3_0___val0___width 5
82#define reg_iop_spu_rw_fsm_inputs3_0___src0___lsb 5
83#define reg_iop_spu_rw_fsm_inputs3_0___src0___width 3
84#define reg_iop_spu_rw_fsm_inputs3_0___val1___lsb 8
85#define reg_iop_spu_rw_fsm_inputs3_0___val1___width 5
86#define reg_iop_spu_rw_fsm_inputs3_0___src1___lsb 13
87#define reg_iop_spu_rw_fsm_inputs3_0___src1___width 3
88#define reg_iop_spu_rw_fsm_inputs3_0___val2___lsb 16
89#define reg_iop_spu_rw_fsm_inputs3_0___val2___width 5
90#define reg_iop_spu_rw_fsm_inputs3_0___src2___lsb 21
91#define reg_iop_spu_rw_fsm_inputs3_0___src2___width 3
92#define reg_iop_spu_rw_fsm_inputs3_0___val3___lsb 24
93#define reg_iop_spu_rw_fsm_inputs3_0___val3___width 5
94#define reg_iop_spu_rw_fsm_inputs3_0___src3___lsb 29
95#define reg_iop_spu_rw_fsm_inputs3_0___src3___width 3
96#define reg_iop_spu_rw_fsm_inputs3_0_offset 76
97
98/* Register rw_fsm_inputs7_4, scope iop_spu, type rw */
99#define reg_iop_spu_rw_fsm_inputs7_4___val4___lsb 0
100#define reg_iop_spu_rw_fsm_inputs7_4___val4___width 5
101#define reg_iop_spu_rw_fsm_inputs7_4___src4___lsb 5
102#define reg_iop_spu_rw_fsm_inputs7_4___src4___width 3
103#define reg_iop_spu_rw_fsm_inputs7_4___val5___lsb 8
104#define reg_iop_spu_rw_fsm_inputs7_4___val5___width 5
105#define reg_iop_spu_rw_fsm_inputs7_4___src5___lsb 13
106#define reg_iop_spu_rw_fsm_inputs7_4___src5___width 3
107#define reg_iop_spu_rw_fsm_inputs7_4___val6___lsb 16
108#define reg_iop_spu_rw_fsm_inputs7_4___val6___width 5
109#define reg_iop_spu_rw_fsm_inputs7_4___src6___lsb 21
110#define reg_iop_spu_rw_fsm_inputs7_4___src6___width 3
111#define reg_iop_spu_rw_fsm_inputs7_4___val7___lsb 24
112#define reg_iop_spu_rw_fsm_inputs7_4___val7___width 5
113#define reg_iop_spu_rw_fsm_inputs7_4___src7___lsb 29
114#define reg_iop_spu_rw_fsm_inputs7_4___src7___width 3
115#define reg_iop_spu_rw_fsm_inputs7_4_offset 80
116
117/* Register rw_gio_out, scope iop_spu, type rw */
118#define reg_iop_spu_rw_gio_out_offset 84
119
120/* Register rw_bus0_out, scope iop_spu, type rw */
121#define reg_iop_spu_rw_bus0_out_offset 88
122
123/* Register rw_bus1_out, scope iop_spu, type rw */
124#define reg_iop_spu_rw_bus1_out_offset 92
125
126/* Register r_gio_in, scope iop_spu, type r */
127#define reg_iop_spu_r_gio_in_offset 96
128
129/* Register r_bus0_in, scope iop_spu, type r */
130#define reg_iop_spu_r_bus0_in_offset 100
131
132/* Register r_bus1_in, scope iop_spu, type r */
133#define reg_iop_spu_r_bus1_in_offset 104
134
135/* Register rw_gio_out_set, scope iop_spu, type rw */
136#define reg_iop_spu_rw_gio_out_set_offset 108
137
138/* Register rw_gio_out_clr, scope iop_spu, type rw */
139#define reg_iop_spu_rw_gio_out_clr_offset 112
140
141/* Register rs_wr_stat, scope iop_spu, type rs */
142#define reg_iop_spu_rs_wr_stat___r0___lsb 0
143#define reg_iop_spu_rs_wr_stat___r0___width 1
144#define reg_iop_spu_rs_wr_stat___r0___bit 0
145#define reg_iop_spu_rs_wr_stat___r1___lsb 1
146#define reg_iop_spu_rs_wr_stat___r1___width 1
147#define reg_iop_spu_rs_wr_stat___r1___bit 1
148#define reg_iop_spu_rs_wr_stat___r2___lsb 2
149#define reg_iop_spu_rs_wr_stat___r2___width 1
150#define reg_iop_spu_rs_wr_stat___r2___bit 2
151#define reg_iop_spu_rs_wr_stat___r3___lsb 3
152#define reg_iop_spu_rs_wr_stat___r3___width 1
153#define reg_iop_spu_rs_wr_stat___r3___bit 3
154#define reg_iop_spu_rs_wr_stat___r4___lsb 4
155#define reg_iop_spu_rs_wr_stat___r4___width 1
156#define reg_iop_spu_rs_wr_stat___r4___bit 4
157#define reg_iop_spu_rs_wr_stat___r5___lsb 5
158#define reg_iop_spu_rs_wr_stat___r5___width 1
159#define reg_iop_spu_rs_wr_stat___r5___bit 5
160#define reg_iop_spu_rs_wr_stat___r6___lsb 6
161#define reg_iop_spu_rs_wr_stat___r6___width 1
162#define reg_iop_spu_rs_wr_stat___r6___bit 6
163#define reg_iop_spu_rs_wr_stat___r7___lsb 7
164#define reg_iop_spu_rs_wr_stat___r7___width 1
165#define reg_iop_spu_rs_wr_stat___r7___bit 7
166#define reg_iop_spu_rs_wr_stat___r8___lsb 8
167#define reg_iop_spu_rs_wr_stat___r8___width 1
168#define reg_iop_spu_rs_wr_stat___r8___bit 8
169#define reg_iop_spu_rs_wr_stat___r9___lsb 9
170#define reg_iop_spu_rs_wr_stat___r9___width 1
171#define reg_iop_spu_rs_wr_stat___r9___bit 9
172#define reg_iop_spu_rs_wr_stat___r10___lsb 10
173#define reg_iop_spu_rs_wr_stat___r10___width 1
174#define reg_iop_spu_rs_wr_stat___r10___bit 10
175#define reg_iop_spu_rs_wr_stat___r11___lsb 11
176#define reg_iop_spu_rs_wr_stat___r11___width 1
177#define reg_iop_spu_rs_wr_stat___r11___bit 11
178#define reg_iop_spu_rs_wr_stat___r12___lsb 12
179#define reg_iop_spu_rs_wr_stat___r12___width 1
180#define reg_iop_spu_rs_wr_stat___r12___bit 12
181#define reg_iop_spu_rs_wr_stat___r13___lsb 13
182#define reg_iop_spu_rs_wr_stat___r13___width 1
183#define reg_iop_spu_rs_wr_stat___r13___bit 13
184#define reg_iop_spu_rs_wr_stat___r14___lsb 14
185#define reg_iop_spu_rs_wr_stat___r14___width 1
186#define reg_iop_spu_rs_wr_stat___r14___bit 14
187#define reg_iop_spu_rs_wr_stat___r15___lsb 15
188#define reg_iop_spu_rs_wr_stat___r15___width 1
189#define reg_iop_spu_rs_wr_stat___r15___bit 15
190#define reg_iop_spu_rs_wr_stat_offset 116
191
192/* Register r_wr_stat, scope iop_spu, type r */
193#define reg_iop_spu_r_wr_stat___r0___lsb 0
194#define reg_iop_spu_r_wr_stat___r0___width 1
195#define reg_iop_spu_r_wr_stat___r0___bit 0
196#define reg_iop_spu_r_wr_stat___r1___lsb 1
197#define reg_iop_spu_r_wr_stat___r1___width 1
198#define reg_iop_spu_r_wr_stat___r1___bit 1
199#define reg_iop_spu_r_wr_stat___r2___lsb 2
200#define reg_iop_spu_r_wr_stat___r2___width 1
201#define reg_iop_spu_r_wr_stat___r2___bit 2
202#define reg_iop_spu_r_wr_stat___r3___lsb 3
203#define reg_iop_spu_r_wr_stat___r3___width 1
204#define reg_iop_spu_r_wr_stat___r3___bit 3
205#define reg_iop_spu_r_wr_stat___r4___lsb 4
206#define reg_iop_spu_r_wr_stat___r4___width 1
207#define reg_iop_spu_r_wr_stat___r4___bit 4
208#define reg_iop_spu_r_wr_stat___r5___lsb 5
209#define reg_iop_spu_r_wr_stat___r5___width 1
210#define reg_iop_spu_r_wr_stat___r5___bit 5
211#define reg_iop_spu_r_wr_stat___r6___lsb 6
212#define reg_iop_spu_r_wr_stat___r6___width 1
213#define reg_iop_spu_r_wr_stat___r6___bit 6
214#define reg_iop_spu_r_wr_stat___r7___lsb 7
215#define reg_iop_spu_r_wr_stat___r7___width 1
216#define reg_iop_spu_r_wr_stat___r7___bit 7
217#define reg_iop_spu_r_wr_stat___r8___lsb 8
218#define reg_iop_spu_r_wr_stat___r8___width 1
219#define reg_iop_spu_r_wr_stat___r8___bit 8
220#define reg_iop_spu_r_wr_stat___r9___lsb 9
221#define reg_iop_spu_r_wr_stat___r9___width 1
222#define reg_iop_spu_r_wr_stat___r9___bit 9
223#define reg_iop_spu_r_wr_stat___r10___lsb 10
224#define reg_iop_spu_r_wr_stat___r10___width 1
225#define reg_iop_spu_r_wr_stat___r10___bit 10
226#define reg_iop_spu_r_wr_stat___r11___lsb 11
227#define reg_iop_spu_r_wr_stat___r11___width 1
228#define reg_iop_spu_r_wr_stat___r11___bit 11
229#define reg_iop_spu_r_wr_stat___r12___lsb 12
230#define reg_iop_spu_r_wr_stat___r12___width 1
231#define reg_iop_spu_r_wr_stat___r12___bit 12
232#define reg_iop_spu_r_wr_stat___r13___lsb 13
233#define reg_iop_spu_r_wr_stat___r13___width 1
234#define reg_iop_spu_r_wr_stat___r13___bit 13
235#define reg_iop_spu_r_wr_stat___r14___lsb 14
236#define reg_iop_spu_r_wr_stat___r14___width 1
237#define reg_iop_spu_r_wr_stat___r14___bit 14
238#define reg_iop_spu_r_wr_stat___r15___lsb 15
239#define reg_iop_spu_r_wr_stat___r15___width 1
240#define reg_iop_spu_r_wr_stat___r15___bit 15
241#define reg_iop_spu_r_wr_stat_offset 120
242
243/* Register r_reg_indexed_by_bus0_in, scope iop_spu, type r */
244#define reg_iop_spu_r_reg_indexed_by_bus0_in_offset 124
245
246/* Register r_stat_in, scope iop_spu, type r */
247#define reg_iop_spu_r_stat_in___timer_grp_lo___lsb 0
248#define reg_iop_spu_r_stat_in___timer_grp_lo___width 4
249#define reg_iop_spu_r_stat_in___fifo_out_last___lsb 4
250#define reg_iop_spu_r_stat_in___fifo_out_last___width 1
251#define reg_iop_spu_r_stat_in___fifo_out_last___bit 4
252#define reg_iop_spu_r_stat_in___fifo_out_rdy___lsb 5
253#define reg_iop_spu_r_stat_in___fifo_out_rdy___width 1
254#define reg_iop_spu_r_stat_in___fifo_out_rdy___bit 5
255#define reg_iop_spu_r_stat_in___fifo_out_all___lsb 6
256#define reg_iop_spu_r_stat_in___fifo_out_all___width 1
257#define reg_iop_spu_r_stat_in___fifo_out_all___bit 6
258#define reg_iop_spu_r_stat_in___fifo_in_rdy___lsb 7
259#define reg_iop_spu_r_stat_in___fifo_in_rdy___width 1
260#define reg_iop_spu_r_stat_in___fifo_in_rdy___bit 7
261#define reg_iop_spu_r_stat_in___dmc_out_all___lsb 8
262#define reg_iop_spu_r_stat_in___dmc_out_all___width 1
263#define reg_iop_spu_r_stat_in___dmc_out_all___bit 8
264#define reg_iop_spu_r_stat_in___dmc_out_dth___lsb 9
265#define reg_iop_spu_r_stat_in___dmc_out_dth___width 1
266#define reg_iop_spu_r_stat_in___dmc_out_dth___bit 9
267#define reg_iop_spu_r_stat_in___dmc_out_eop___lsb 10
268#define reg_iop_spu_r_stat_in___dmc_out_eop___width 1
269#define reg_iop_spu_r_stat_in___dmc_out_eop___bit 10
270#define reg_iop_spu_r_stat_in___dmc_out_dv___lsb 11
271#define reg_iop_spu_r_stat_in___dmc_out_dv___width 1
272#define reg_iop_spu_r_stat_in___dmc_out_dv___bit 11
273#define reg_iop_spu_r_stat_in___dmc_out_last___lsb 12
274#define reg_iop_spu_r_stat_in___dmc_out_last___width 1
275#define reg_iop_spu_r_stat_in___dmc_out_last___bit 12
276#define reg_iop_spu_r_stat_in___dmc_out_cmd_rq___lsb 13
277#define reg_iop_spu_r_stat_in___dmc_out_cmd_rq___width 1
278#define reg_iop_spu_r_stat_in___dmc_out_cmd_rq___bit 13
279#define reg_iop_spu_r_stat_in___dmc_out_cmd_rdy___lsb 14
280#define reg_iop_spu_r_stat_in___dmc_out_cmd_rdy___width 1
281#define reg_iop_spu_r_stat_in___dmc_out_cmd_rdy___bit 14
282#define reg_iop_spu_r_stat_in___pcrc_correct___lsb 15
283#define reg_iop_spu_r_stat_in___pcrc_correct___width 1
284#define reg_iop_spu_r_stat_in___pcrc_correct___bit 15
285#define reg_iop_spu_r_stat_in___timer_grp_hi___lsb 16
286#define reg_iop_spu_r_stat_in___timer_grp_hi___width 4
287#define reg_iop_spu_r_stat_in___dmc_in_sth___lsb 20
288#define reg_iop_spu_r_stat_in___dmc_in_sth___width 1
289#define reg_iop_spu_r_stat_in___dmc_in_sth___bit 20
290#define reg_iop_spu_r_stat_in___dmc_in_full___lsb 21
291#define reg_iop_spu_r_stat_in___dmc_in_full___width 1
292#define reg_iop_spu_r_stat_in___dmc_in_full___bit 21
293#define reg_iop_spu_r_stat_in___dmc_in_cmd_rdy___lsb 22
294#define reg_iop_spu_r_stat_in___dmc_in_cmd_rdy___width 1
295#define reg_iop_spu_r_stat_in___dmc_in_cmd_rdy___bit 22
296#define reg_iop_spu_r_stat_in___spu_gio_out___lsb 23
297#define reg_iop_spu_r_stat_in___spu_gio_out___width 4
298#define reg_iop_spu_r_stat_in___sync_clk12___lsb 27
299#define reg_iop_spu_r_stat_in___sync_clk12___width 1
300#define reg_iop_spu_r_stat_in___sync_clk12___bit 27
301#define reg_iop_spu_r_stat_in___scrc_out_data___lsb 28
302#define reg_iop_spu_r_stat_in___scrc_out_data___width 1
303#define reg_iop_spu_r_stat_in___scrc_out_data___bit 28
304#define reg_iop_spu_r_stat_in___scrc_in_err___lsb 29
305#define reg_iop_spu_r_stat_in___scrc_in_err___width 1
306#define reg_iop_spu_r_stat_in___scrc_in_err___bit 29
307#define reg_iop_spu_r_stat_in___mc_busy___lsb 30
308#define reg_iop_spu_r_stat_in___mc_busy___width 1
309#define reg_iop_spu_r_stat_in___mc_busy___bit 30
310#define reg_iop_spu_r_stat_in___mc_owned___lsb 31
311#define reg_iop_spu_r_stat_in___mc_owned___width 1
312#define reg_iop_spu_r_stat_in___mc_owned___bit 31
313#define reg_iop_spu_r_stat_in_offset 128
314
315/* Register r_trigger_in, scope iop_spu, type r */
316#define reg_iop_spu_r_trigger_in_offset 132
317
318/* Register r_special_stat, scope iop_spu, type r */
319#define reg_iop_spu_r_special_stat___c_flag___lsb 0
320#define reg_iop_spu_r_special_stat___c_flag___width 1
321#define reg_iop_spu_r_special_stat___c_flag___bit 0
322#define reg_iop_spu_r_special_stat___v_flag___lsb 1
323#define reg_iop_spu_r_special_stat___v_flag___width 1
324#define reg_iop_spu_r_special_stat___v_flag___bit 1
325#define reg_iop_spu_r_special_stat___z_flag___lsb 2
326#define reg_iop_spu_r_special_stat___z_flag___width 1
327#define reg_iop_spu_r_special_stat___z_flag___bit 2
328#define reg_iop_spu_r_special_stat___n_flag___lsb 3
329#define reg_iop_spu_r_special_stat___n_flag___width 1
330#define reg_iop_spu_r_special_stat___n_flag___bit 3
331#define reg_iop_spu_r_special_stat___xor_bus0_r2_0___lsb 4
332#define reg_iop_spu_r_special_stat___xor_bus0_r2_0___width 1
333#define reg_iop_spu_r_special_stat___xor_bus0_r2_0___bit 4
334#define reg_iop_spu_r_special_stat___xor_bus1_r3_0___lsb 5
335#define reg_iop_spu_r_special_stat___xor_bus1_r3_0___width 1
336#define reg_iop_spu_r_special_stat___xor_bus1_r3_0___bit 5
337#define reg_iop_spu_r_special_stat___xor_bus0m_r2_0___lsb 6
338#define reg_iop_spu_r_special_stat___xor_bus0m_r2_0___width 1
339#define reg_iop_spu_r_special_stat___xor_bus0m_r2_0___bit 6
340#define reg_iop_spu_r_special_stat___xor_bus1m_r3_0___lsb 7
341#define reg_iop_spu_r_special_stat___xor_bus1m_r3_0___width 1
342#define reg_iop_spu_r_special_stat___xor_bus1m_r3_0___bit 7
343#define reg_iop_spu_r_special_stat___fsm_in0___lsb 8
344#define reg_iop_spu_r_special_stat___fsm_in0___width 1
345#define reg_iop_spu_r_special_stat___fsm_in0___bit 8
346#define reg_iop_spu_r_special_stat___fsm_in1___lsb 9
347#define reg_iop_spu_r_special_stat___fsm_in1___width 1
348#define reg_iop_spu_r_special_stat___fsm_in1___bit 9
349#define reg_iop_spu_r_special_stat___fsm_in2___lsb 10
350#define reg_iop_spu_r_special_stat___fsm_in2___width 1
351#define reg_iop_spu_r_special_stat___fsm_in2___bit 10
352#define reg_iop_spu_r_special_stat___fsm_in3___lsb 11
353#define reg_iop_spu_r_special_stat___fsm_in3___width 1
354#define reg_iop_spu_r_special_stat___fsm_in3___bit 11
355#define reg_iop_spu_r_special_stat___fsm_in4___lsb 12
356#define reg_iop_spu_r_special_stat___fsm_in4___width 1
357#define reg_iop_spu_r_special_stat___fsm_in4___bit 12
358#define reg_iop_spu_r_special_stat___fsm_in5___lsb 13
359#define reg_iop_spu_r_special_stat___fsm_in5___width 1
360#define reg_iop_spu_r_special_stat___fsm_in5___bit 13
361#define reg_iop_spu_r_special_stat___fsm_in6___lsb 14
362#define reg_iop_spu_r_special_stat___fsm_in6___width 1
363#define reg_iop_spu_r_special_stat___fsm_in6___bit 14
364#define reg_iop_spu_r_special_stat___fsm_in7___lsb 15
365#define reg_iop_spu_r_special_stat___fsm_in7___width 1
366#define reg_iop_spu_r_special_stat___fsm_in7___bit 15
367#define reg_iop_spu_r_special_stat___event0___lsb 16
368#define reg_iop_spu_r_special_stat___event0___width 1
369#define reg_iop_spu_r_special_stat___event0___bit 16
370#define reg_iop_spu_r_special_stat___event1___lsb 17
371#define reg_iop_spu_r_special_stat___event1___width 1
372#define reg_iop_spu_r_special_stat___event1___bit 17
373#define reg_iop_spu_r_special_stat___event2___lsb 18
374#define reg_iop_spu_r_special_stat___event2___width 1
375#define reg_iop_spu_r_special_stat___event2___bit 18
376#define reg_iop_spu_r_special_stat___event3___lsb 19
377#define reg_iop_spu_r_special_stat___event3___width 1
378#define reg_iop_spu_r_special_stat___event3___bit 19
379#define reg_iop_spu_r_special_stat_offset 136
380
381/* Register rw_reg_access, scope iop_spu, type rw */
382#define reg_iop_spu_rw_reg_access___addr___lsb 0
383#define reg_iop_spu_rw_reg_access___addr___width 13
384#define reg_iop_spu_rw_reg_access___imm_hi___lsb 16
385#define reg_iop_spu_rw_reg_access___imm_hi___width 16
386#define reg_iop_spu_rw_reg_access_offset 140
387
388#define STRIDE_iop_spu_rw_event_cfg 4
389/* Register rw_event_cfg, scope iop_spu, type rw */
390#define reg_iop_spu_rw_event_cfg___addr___lsb 0
391#define reg_iop_spu_rw_event_cfg___addr___width 12
392#define reg_iop_spu_rw_event_cfg___src___lsb 12
393#define reg_iop_spu_rw_event_cfg___src___width 2
394#define reg_iop_spu_rw_event_cfg___eq_en___lsb 14
395#define reg_iop_spu_rw_event_cfg___eq_en___width 1
396#define reg_iop_spu_rw_event_cfg___eq_en___bit 14
397#define reg_iop_spu_rw_event_cfg___eq_inv___lsb 15
398#define reg_iop_spu_rw_event_cfg___eq_inv___width 1
399#define reg_iop_spu_rw_event_cfg___eq_inv___bit 15
400#define reg_iop_spu_rw_event_cfg___gt_en___lsb 16
401#define reg_iop_spu_rw_event_cfg___gt_en___width 1
402#define reg_iop_spu_rw_event_cfg___gt_en___bit 16
403#define reg_iop_spu_rw_event_cfg___gt_inv___lsb 17
404#define reg_iop_spu_rw_event_cfg___gt_inv___width 1
405#define reg_iop_spu_rw_event_cfg___gt_inv___bit 17
406#define reg_iop_spu_rw_event_cfg_offset 144
407
408#define STRIDE_iop_spu_rw_event_mask 4
409/* Register rw_event_mask, scope iop_spu, type rw */
410#define reg_iop_spu_rw_event_mask_offset 160
411
412#define STRIDE_iop_spu_rw_event_val 4
413/* Register rw_event_val, scope iop_spu, type rw */
414#define reg_iop_spu_rw_event_val_offset 176
415
416/* Register rw_event_ret, scope iop_spu, type rw */
417#define reg_iop_spu_rw_event_ret___addr___lsb 0
418#define reg_iop_spu_rw_event_ret___addr___width 12
419#define reg_iop_spu_rw_event_ret_offset 192
420
421/* Register r_trace, scope iop_spu, type r */
422#define reg_iop_spu_r_trace___fsm___lsb 0
423#define reg_iop_spu_r_trace___fsm___width 1
424#define reg_iop_spu_r_trace___fsm___bit 0
425#define reg_iop_spu_r_trace___en___lsb 1
426#define reg_iop_spu_r_trace___en___width 1
427#define reg_iop_spu_r_trace___en___bit 1
428#define reg_iop_spu_r_trace___c_flag___lsb 2
429#define reg_iop_spu_r_trace___c_flag___width 1
430#define reg_iop_spu_r_trace___c_flag___bit 2
431#define reg_iop_spu_r_trace___v_flag___lsb 3
432#define reg_iop_spu_r_trace___v_flag___width 1
433#define reg_iop_spu_r_trace___v_flag___bit 3
434#define reg_iop_spu_r_trace___z_flag___lsb 4
435#define reg_iop_spu_r_trace___z_flag___width 1
436#define reg_iop_spu_r_trace___z_flag___bit 4
437#define reg_iop_spu_r_trace___n_flag___lsb 5
438#define reg_iop_spu_r_trace___n_flag___width 1
439#define reg_iop_spu_r_trace___n_flag___bit 5
440#define reg_iop_spu_r_trace___seq_addr___lsb 6
441#define reg_iop_spu_r_trace___seq_addr___width 12
442#define reg_iop_spu_r_trace___fsm_addr___lsb 20
443#define reg_iop_spu_r_trace___fsm_addr___width 12
444#define reg_iop_spu_r_trace_offset 196
445
446/* Register r_fsm_trace, scope iop_spu, type r */
447#define reg_iop_spu_r_fsm_trace___fsm___lsb 0
448#define reg_iop_spu_r_fsm_trace___fsm___width 1
449#define reg_iop_spu_r_fsm_trace___fsm___bit 0
450#define reg_iop_spu_r_fsm_trace___en___lsb 1
451#define reg_iop_spu_r_fsm_trace___en___width 1
452#define reg_iop_spu_r_fsm_trace___en___bit 1
453#define reg_iop_spu_r_fsm_trace___tmr_done___lsb 2
454#define reg_iop_spu_r_fsm_trace___tmr_done___width 1
455#define reg_iop_spu_r_fsm_trace___tmr_done___bit 2
456#define reg_iop_spu_r_fsm_trace___inp0___lsb 3
457#define reg_iop_spu_r_fsm_trace___inp0___width 1
458#define reg_iop_spu_r_fsm_trace___inp0___bit 3
459#define reg_iop_spu_r_fsm_trace___inp1___lsb 4
460#define reg_iop_spu_r_fsm_trace___inp1___width 1
461#define reg_iop_spu_r_fsm_trace___inp1___bit 4
462#define reg_iop_spu_r_fsm_trace___inp2___lsb 5
463#define reg_iop_spu_r_fsm_trace___inp2___width 1
464#define reg_iop_spu_r_fsm_trace___inp2___bit 5
465#define reg_iop_spu_r_fsm_trace___inp3___lsb 6
466#define reg_iop_spu_r_fsm_trace___inp3___width 1
467#define reg_iop_spu_r_fsm_trace___inp3___bit 6
468#define reg_iop_spu_r_fsm_trace___event0___lsb 7
469#define reg_iop_spu_r_fsm_trace___event0___width 1
470#define reg_iop_spu_r_fsm_trace___event0___bit 7
471#define reg_iop_spu_r_fsm_trace___event1___lsb 8
472#define reg_iop_spu_r_fsm_trace___event1___width 1
473#define reg_iop_spu_r_fsm_trace___event1___bit 8
474#define reg_iop_spu_r_fsm_trace___event2___lsb 9
475#define reg_iop_spu_r_fsm_trace___event2___width 1
476#define reg_iop_spu_r_fsm_trace___event2___bit 9
477#define reg_iop_spu_r_fsm_trace___event3___lsb 10
478#define reg_iop_spu_r_fsm_trace___event3___width 1
479#define reg_iop_spu_r_fsm_trace___event3___bit 10
480#define reg_iop_spu_r_fsm_trace___gio_out___lsb 11
481#define reg_iop_spu_r_fsm_trace___gio_out___width 8
482#define reg_iop_spu_r_fsm_trace___fsm_addr___lsb 20
483#define reg_iop_spu_r_fsm_trace___fsm_addr___width 12
484#define reg_iop_spu_r_fsm_trace_offset 200
485
486#define STRIDE_iop_spu_rw_brp 4
487/* Register rw_brp, scope iop_spu, type rw */
488#define reg_iop_spu_rw_brp___addr___lsb 0
489#define reg_iop_spu_rw_brp___addr___width 12
490#define reg_iop_spu_rw_brp___fsm___lsb 12
491#define reg_iop_spu_rw_brp___fsm___width 1
492#define reg_iop_spu_rw_brp___fsm___bit 12
493#define reg_iop_spu_rw_brp___en___lsb 13
494#define reg_iop_spu_rw_brp___en___width 1
495#define reg_iop_spu_rw_brp___en___bit 13
496#define reg_iop_spu_rw_brp_offset 204
497
498
499/* Constants */
500#define regk_iop_spu_attn_hi 0x00000005
501#define regk_iop_spu_attn_lo 0x00000005
502#define regk_iop_spu_attn_r0 0x00000000
503#define regk_iop_spu_attn_r1 0x00000001
504#define regk_iop_spu_attn_r10 0x00000002
505#define regk_iop_spu_attn_r11 0x00000003
506#define regk_iop_spu_attn_r12 0x00000004
507#define regk_iop_spu_attn_r13 0x00000005
508#define regk_iop_spu_attn_r14 0x00000006
509#define regk_iop_spu_attn_r15 0x00000007
510#define regk_iop_spu_attn_r2 0x00000002
511#define regk_iop_spu_attn_r3 0x00000003
512#define regk_iop_spu_attn_r4 0x00000004
513#define regk_iop_spu_attn_r5 0x00000005
514#define regk_iop_spu_attn_r6 0x00000006
515#define regk_iop_spu_attn_r7 0x00000007
516#define regk_iop_spu_attn_r8 0x00000000
517#define regk_iop_spu_attn_r9 0x00000001
518#define regk_iop_spu_c 0x00000000
519#define regk_iop_spu_flag 0x00000002
520#define regk_iop_spu_gio_in 0x00000000
521#define regk_iop_spu_gio_out 0x00000005
522#define regk_iop_spu_gio_out0 0x00000008
523#define regk_iop_spu_gio_out1 0x00000009
524#define regk_iop_spu_gio_out2 0x0000000a
525#define regk_iop_spu_gio_out3 0x0000000b
526#define regk_iop_spu_gio_out4 0x0000000c
527#define regk_iop_spu_gio_out5 0x0000000d
528#define regk_iop_spu_gio_out6 0x0000000e
529#define regk_iop_spu_gio_out7 0x0000000f
530#define regk_iop_spu_n 0x00000003
531#define regk_iop_spu_no 0x00000000
532#define regk_iop_spu_r0 0x00000008
533#define regk_iop_spu_r1 0x00000009
534#define regk_iop_spu_r10 0x0000000a
535#define regk_iop_spu_r11 0x0000000b
536#define regk_iop_spu_r12 0x0000000c
537#define regk_iop_spu_r13 0x0000000d
538#define regk_iop_spu_r14 0x0000000e
539#define regk_iop_spu_r15 0x0000000f
540#define regk_iop_spu_r2 0x0000000a
541#define regk_iop_spu_r3 0x0000000b
542#define regk_iop_spu_r4 0x0000000c
543#define regk_iop_spu_r5 0x0000000d
544#define regk_iop_spu_r6 0x0000000e
545#define regk_iop_spu_r7 0x0000000f
546#define regk_iop_spu_r8 0x00000008
547#define regk_iop_spu_r9 0x00000009
548#define regk_iop_spu_reg_hi 0x00000002
549#define regk_iop_spu_reg_lo 0x00000002
550#define regk_iop_spu_rw_brp_default 0x00000000
551#define regk_iop_spu_rw_brp_size 0x00000004
552#define regk_iop_spu_rw_ctrl_default 0x00000000
553#define regk_iop_spu_rw_event_cfg_size 0x00000004
554#define regk_iop_spu_rw_event_mask_size 0x00000004
555#define regk_iop_spu_rw_event_val_size 0x00000004
556#define regk_iop_spu_rw_gio_out_default 0x00000000
557#define regk_iop_spu_rw_r_size 0x00000010
558#define regk_iop_spu_rw_reg_access_default 0x00000000
559#define regk_iop_spu_stat_in 0x00000002
560#define regk_iop_spu_statin_hi 0x00000004
561#define regk_iop_spu_statin_lo 0x00000004
562#define regk_iop_spu_trig 0x00000003
563#define regk_iop_spu_trigger 0x00000006
564#define regk_iop_spu_v 0x00000001
565#define regk_iop_spu_wsts_gioout_spec 0x00000001
566#define regk_iop_spu_xor 0x00000003
567#define regk_iop_spu_xor_bus0_r2_0 0x00000000
568#define regk_iop_spu_xor_bus0m_r2_0 0x00000002
569#define regk_iop_spu_xor_bus1_r3_0 0x00000001
570#define regk_iop_spu_xor_bus1m_r3_0 0x00000003
571#define regk_iop_spu_yes 0x00000001
572#define regk_iop_spu_z 0x00000002
573#endif /* __iop_spu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cfg_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cfg_defs_asm.h
new file mode 100644
index 000000000000..3be60f9b024c
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cfg_defs_asm.h
@@ -0,0 +1,1052 @@
1#ifndef __iop_sw_cfg_defs_asm_h
2#define __iop_sw_cfg_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_cfg.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sw_cfg_defs_asm.h ../../inst/io_proc/rtl/guinness/iop_sw_cfg.r
11 * id: $Id: iop_sw_cfg_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_crc_par0_owner, scope iop_sw_cfg, type rw */
57#define reg_iop_sw_cfg_rw_crc_par0_owner___cfg___lsb 0
58#define reg_iop_sw_cfg_rw_crc_par0_owner___cfg___width 2
59#define reg_iop_sw_cfg_rw_crc_par0_owner_offset 0
60
61/* Register rw_crc_par1_owner, scope iop_sw_cfg, type rw */
62#define reg_iop_sw_cfg_rw_crc_par1_owner___cfg___lsb 0
63#define reg_iop_sw_cfg_rw_crc_par1_owner___cfg___width 2
64#define reg_iop_sw_cfg_rw_crc_par1_owner_offset 4
65
66/* Register rw_dmc_in0_owner, scope iop_sw_cfg, type rw */
67#define reg_iop_sw_cfg_rw_dmc_in0_owner___cfg___lsb 0
68#define reg_iop_sw_cfg_rw_dmc_in0_owner___cfg___width 2
69#define reg_iop_sw_cfg_rw_dmc_in0_owner_offset 8
70
71/* Register rw_dmc_in1_owner, scope iop_sw_cfg, type rw */
72#define reg_iop_sw_cfg_rw_dmc_in1_owner___cfg___lsb 0
73#define reg_iop_sw_cfg_rw_dmc_in1_owner___cfg___width 2
74#define reg_iop_sw_cfg_rw_dmc_in1_owner_offset 12
75
76/* Register rw_dmc_out0_owner, scope iop_sw_cfg, type rw */
77#define reg_iop_sw_cfg_rw_dmc_out0_owner___cfg___lsb 0
78#define reg_iop_sw_cfg_rw_dmc_out0_owner___cfg___width 2
79#define reg_iop_sw_cfg_rw_dmc_out0_owner_offset 16
80
81/* Register rw_dmc_out1_owner, scope iop_sw_cfg, type rw */
82#define reg_iop_sw_cfg_rw_dmc_out1_owner___cfg___lsb 0
83#define reg_iop_sw_cfg_rw_dmc_out1_owner___cfg___width 2
84#define reg_iop_sw_cfg_rw_dmc_out1_owner_offset 20
85
86/* Register rw_fifo_in0_owner, scope iop_sw_cfg, type rw */
87#define reg_iop_sw_cfg_rw_fifo_in0_owner___cfg___lsb 0
88#define reg_iop_sw_cfg_rw_fifo_in0_owner___cfg___width 2
89#define reg_iop_sw_cfg_rw_fifo_in0_owner_offset 24
90
91/* Register rw_fifo_in0_extra_owner, scope iop_sw_cfg, type rw */
92#define reg_iop_sw_cfg_rw_fifo_in0_extra_owner___cfg___lsb 0
93#define reg_iop_sw_cfg_rw_fifo_in0_extra_owner___cfg___width 2
94#define reg_iop_sw_cfg_rw_fifo_in0_extra_owner_offset 28
95
96/* Register rw_fifo_in1_owner, scope iop_sw_cfg, type rw */
97#define reg_iop_sw_cfg_rw_fifo_in1_owner___cfg___lsb 0
98#define reg_iop_sw_cfg_rw_fifo_in1_owner___cfg___width 2
99#define reg_iop_sw_cfg_rw_fifo_in1_owner_offset 32
100
101/* Register rw_fifo_in1_extra_owner, scope iop_sw_cfg, type rw */
102#define reg_iop_sw_cfg_rw_fifo_in1_extra_owner___cfg___lsb 0
103#define reg_iop_sw_cfg_rw_fifo_in1_extra_owner___cfg___width 2
104#define reg_iop_sw_cfg_rw_fifo_in1_extra_owner_offset 36
105
106/* Register rw_fifo_out0_owner, scope iop_sw_cfg, type rw */
107#define reg_iop_sw_cfg_rw_fifo_out0_owner___cfg___lsb 0
108#define reg_iop_sw_cfg_rw_fifo_out0_owner___cfg___width 2
109#define reg_iop_sw_cfg_rw_fifo_out0_owner_offset 40
110
111/* Register rw_fifo_out0_extra_owner, scope iop_sw_cfg, type rw */
112#define reg_iop_sw_cfg_rw_fifo_out0_extra_owner___cfg___lsb 0
113#define reg_iop_sw_cfg_rw_fifo_out0_extra_owner___cfg___width 2
114#define reg_iop_sw_cfg_rw_fifo_out0_extra_owner_offset 44
115
116/* Register rw_fifo_out1_owner, scope iop_sw_cfg, type rw */
117#define reg_iop_sw_cfg_rw_fifo_out1_owner___cfg___lsb 0
118#define reg_iop_sw_cfg_rw_fifo_out1_owner___cfg___width 2
119#define reg_iop_sw_cfg_rw_fifo_out1_owner_offset 48
120
121/* Register rw_fifo_out1_extra_owner, scope iop_sw_cfg, type rw */
122#define reg_iop_sw_cfg_rw_fifo_out1_extra_owner___cfg___lsb 0
123#define reg_iop_sw_cfg_rw_fifo_out1_extra_owner___cfg___width 2
124#define reg_iop_sw_cfg_rw_fifo_out1_extra_owner_offset 52
125
126/* Register rw_sap_in_owner, scope iop_sw_cfg, type rw */
127#define reg_iop_sw_cfg_rw_sap_in_owner___cfg___lsb 0
128#define reg_iop_sw_cfg_rw_sap_in_owner___cfg___width 2
129#define reg_iop_sw_cfg_rw_sap_in_owner_offset 56
130
131/* Register rw_sap_out_owner, scope iop_sw_cfg, type rw */
132#define reg_iop_sw_cfg_rw_sap_out_owner___cfg___lsb 0
133#define reg_iop_sw_cfg_rw_sap_out_owner___cfg___width 2
134#define reg_iop_sw_cfg_rw_sap_out_owner_offset 60
135
136/* Register rw_scrc_in0_owner, scope iop_sw_cfg, type rw */
137#define reg_iop_sw_cfg_rw_scrc_in0_owner___cfg___lsb 0
138#define reg_iop_sw_cfg_rw_scrc_in0_owner___cfg___width 2
139#define reg_iop_sw_cfg_rw_scrc_in0_owner_offset 64
140
141/* Register rw_scrc_in1_owner, scope iop_sw_cfg, type rw */
142#define reg_iop_sw_cfg_rw_scrc_in1_owner___cfg___lsb 0
143#define reg_iop_sw_cfg_rw_scrc_in1_owner___cfg___width 2
144#define reg_iop_sw_cfg_rw_scrc_in1_owner_offset 68
145
146/* Register rw_scrc_out0_owner, scope iop_sw_cfg, type rw */
147#define reg_iop_sw_cfg_rw_scrc_out0_owner___cfg___lsb 0
148#define reg_iop_sw_cfg_rw_scrc_out0_owner___cfg___width 2
149#define reg_iop_sw_cfg_rw_scrc_out0_owner_offset 72
150
151/* Register rw_scrc_out1_owner, scope iop_sw_cfg, type rw */
152#define reg_iop_sw_cfg_rw_scrc_out1_owner___cfg___lsb 0
153#define reg_iop_sw_cfg_rw_scrc_out1_owner___cfg___width 2
154#define reg_iop_sw_cfg_rw_scrc_out1_owner_offset 76
155
156/* Register rw_spu0_owner, scope iop_sw_cfg, type rw */
157#define reg_iop_sw_cfg_rw_spu0_owner___cfg___lsb 0
158#define reg_iop_sw_cfg_rw_spu0_owner___cfg___width 2
159#define reg_iop_sw_cfg_rw_spu0_owner_offset 80
160
161/* Register rw_spu1_owner, scope iop_sw_cfg, type rw */
162#define reg_iop_sw_cfg_rw_spu1_owner___cfg___lsb 0
163#define reg_iop_sw_cfg_rw_spu1_owner___cfg___width 2
164#define reg_iop_sw_cfg_rw_spu1_owner_offset 84
165
166/* Register rw_timer_grp0_owner, scope iop_sw_cfg, type rw */
167#define reg_iop_sw_cfg_rw_timer_grp0_owner___cfg___lsb 0
168#define reg_iop_sw_cfg_rw_timer_grp0_owner___cfg___width 2
169#define reg_iop_sw_cfg_rw_timer_grp0_owner_offset 88
170
171/* Register rw_timer_grp1_owner, scope iop_sw_cfg, type rw */
172#define reg_iop_sw_cfg_rw_timer_grp1_owner___cfg___lsb 0
173#define reg_iop_sw_cfg_rw_timer_grp1_owner___cfg___width 2
174#define reg_iop_sw_cfg_rw_timer_grp1_owner_offset 92
175
176/* Register rw_timer_grp2_owner, scope iop_sw_cfg, type rw */
177#define reg_iop_sw_cfg_rw_timer_grp2_owner___cfg___lsb 0
178#define reg_iop_sw_cfg_rw_timer_grp2_owner___cfg___width 2
179#define reg_iop_sw_cfg_rw_timer_grp2_owner_offset 96
180
181/* Register rw_timer_grp3_owner, scope iop_sw_cfg, type rw */
182#define reg_iop_sw_cfg_rw_timer_grp3_owner___cfg___lsb 0
183#define reg_iop_sw_cfg_rw_timer_grp3_owner___cfg___width 2
184#define reg_iop_sw_cfg_rw_timer_grp3_owner_offset 100
185
186/* Register rw_trigger_grp0_owner, scope iop_sw_cfg, type rw */
187#define reg_iop_sw_cfg_rw_trigger_grp0_owner___cfg___lsb 0
188#define reg_iop_sw_cfg_rw_trigger_grp0_owner___cfg___width 2
189#define reg_iop_sw_cfg_rw_trigger_grp0_owner_offset 104
190
191/* Register rw_trigger_grp1_owner, scope iop_sw_cfg, type rw */
192#define reg_iop_sw_cfg_rw_trigger_grp1_owner___cfg___lsb 0
193#define reg_iop_sw_cfg_rw_trigger_grp1_owner___cfg___width 2
194#define reg_iop_sw_cfg_rw_trigger_grp1_owner_offset 108
195
196/* Register rw_trigger_grp2_owner, scope iop_sw_cfg, type rw */
197#define reg_iop_sw_cfg_rw_trigger_grp2_owner___cfg___lsb 0
198#define reg_iop_sw_cfg_rw_trigger_grp2_owner___cfg___width 2
199#define reg_iop_sw_cfg_rw_trigger_grp2_owner_offset 112
200
201/* Register rw_trigger_grp3_owner, scope iop_sw_cfg, type rw */
202#define reg_iop_sw_cfg_rw_trigger_grp3_owner___cfg___lsb 0
203#define reg_iop_sw_cfg_rw_trigger_grp3_owner___cfg___width 2
204#define reg_iop_sw_cfg_rw_trigger_grp3_owner_offset 116
205
206/* Register rw_trigger_grp4_owner, scope iop_sw_cfg, type rw */
207#define reg_iop_sw_cfg_rw_trigger_grp4_owner___cfg___lsb 0
208#define reg_iop_sw_cfg_rw_trigger_grp4_owner___cfg___width 2
209#define reg_iop_sw_cfg_rw_trigger_grp4_owner_offset 120
210
211/* Register rw_trigger_grp5_owner, scope iop_sw_cfg, type rw */
212#define reg_iop_sw_cfg_rw_trigger_grp5_owner___cfg___lsb 0
213#define reg_iop_sw_cfg_rw_trigger_grp5_owner___cfg___width 2
214#define reg_iop_sw_cfg_rw_trigger_grp5_owner_offset 124
215
216/* Register rw_trigger_grp6_owner, scope iop_sw_cfg, type rw */
217#define reg_iop_sw_cfg_rw_trigger_grp6_owner___cfg___lsb 0
218#define reg_iop_sw_cfg_rw_trigger_grp6_owner___cfg___width 2
219#define reg_iop_sw_cfg_rw_trigger_grp6_owner_offset 128
220
221/* Register rw_trigger_grp7_owner, scope iop_sw_cfg, type rw */
222#define reg_iop_sw_cfg_rw_trigger_grp7_owner___cfg___lsb 0
223#define reg_iop_sw_cfg_rw_trigger_grp7_owner___cfg___width 2
224#define reg_iop_sw_cfg_rw_trigger_grp7_owner_offset 132
225
226/* Register rw_bus0_mask, scope iop_sw_cfg, type rw */
227#define reg_iop_sw_cfg_rw_bus0_mask___byte0___lsb 0
228#define reg_iop_sw_cfg_rw_bus0_mask___byte0___width 8
229#define reg_iop_sw_cfg_rw_bus0_mask___byte1___lsb 8
230#define reg_iop_sw_cfg_rw_bus0_mask___byte1___width 8
231#define reg_iop_sw_cfg_rw_bus0_mask___byte2___lsb 16
232#define reg_iop_sw_cfg_rw_bus0_mask___byte2___width 8
233#define reg_iop_sw_cfg_rw_bus0_mask___byte3___lsb 24
234#define reg_iop_sw_cfg_rw_bus0_mask___byte3___width 8
235#define reg_iop_sw_cfg_rw_bus0_mask_offset 136
236
237/* Register rw_bus0_oe_mask, scope iop_sw_cfg, type rw */
238#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte0___lsb 0
239#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte0___width 1
240#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte0___bit 0
241#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte1___lsb 1
242#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte1___width 1
243#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte1___bit 1
244#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte2___lsb 2
245#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte2___width 1
246#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte2___bit 2
247#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte3___lsb 3
248#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte3___width 1
249#define reg_iop_sw_cfg_rw_bus0_oe_mask___byte3___bit 3
250#define reg_iop_sw_cfg_rw_bus0_oe_mask_offset 140
251
252/* Register rw_bus1_mask, scope iop_sw_cfg, type rw */
253#define reg_iop_sw_cfg_rw_bus1_mask___byte0___lsb 0
254#define reg_iop_sw_cfg_rw_bus1_mask___byte0___width 8
255#define reg_iop_sw_cfg_rw_bus1_mask___byte1___lsb 8
256#define reg_iop_sw_cfg_rw_bus1_mask___byte1___width 8
257#define reg_iop_sw_cfg_rw_bus1_mask___byte2___lsb 16
258#define reg_iop_sw_cfg_rw_bus1_mask___byte2___width 8
259#define reg_iop_sw_cfg_rw_bus1_mask___byte3___lsb 24
260#define reg_iop_sw_cfg_rw_bus1_mask___byte3___width 8
261#define reg_iop_sw_cfg_rw_bus1_mask_offset 144
262
263/* Register rw_bus1_oe_mask, scope iop_sw_cfg, type rw */
264#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte0___lsb 0
265#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte0___width 1
266#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte0___bit 0
267#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte1___lsb 1
268#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte1___width 1
269#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte1___bit 1
270#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte2___lsb 2
271#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte2___width 1
272#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte2___bit 2
273#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte3___lsb 3
274#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte3___width 1
275#define reg_iop_sw_cfg_rw_bus1_oe_mask___byte3___bit 3
276#define reg_iop_sw_cfg_rw_bus1_oe_mask_offset 148
277
278/* Register rw_gio_mask, scope iop_sw_cfg, type rw */
279#define reg_iop_sw_cfg_rw_gio_mask___val___lsb 0
280#define reg_iop_sw_cfg_rw_gio_mask___val___width 32
281#define reg_iop_sw_cfg_rw_gio_mask_offset 152
282
283/* Register rw_gio_oe_mask, scope iop_sw_cfg, type rw */
284#define reg_iop_sw_cfg_rw_gio_oe_mask___val___lsb 0
285#define reg_iop_sw_cfg_rw_gio_oe_mask___val___width 32
286#define reg_iop_sw_cfg_rw_gio_oe_mask_offset 156
287
288/* Register rw_pinmapping, scope iop_sw_cfg, type rw */
289#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte0___lsb 0
290#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte0___width 2
291#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte1___lsb 2
292#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte1___width 2
293#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte2___lsb 4
294#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte2___width 2
295#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte3___lsb 6
296#define reg_iop_sw_cfg_rw_pinmapping___bus0_byte3___width 2
297#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte0___lsb 8
298#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte0___width 2
299#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte1___lsb 10
300#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte1___width 2
301#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte2___lsb 12
302#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte2___width 2
303#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte3___lsb 14
304#define reg_iop_sw_cfg_rw_pinmapping___bus1_byte3___width 2
305#define reg_iop_sw_cfg_rw_pinmapping___gio3_0___lsb 16
306#define reg_iop_sw_cfg_rw_pinmapping___gio3_0___width 2
307#define reg_iop_sw_cfg_rw_pinmapping___gio7_4___lsb 18
308#define reg_iop_sw_cfg_rw_pinmapping___gio7_4___width 2
309#define reg_iop_sw_cfg_rw_pinmapping___gio11_8___lsb 20
310#define reg_iop_sw_cfg_rw_pinmapping___gio11_8___width 2
311#define reg_iop_sw_cfg_rw_pinmapping___gio15_12___lsb 22
312#define reg_iop_sw_cfg_rw_pinmapping___gio15_12___width 2
313#define reg_iop_sw_cfg_rw_pinmapping___gio19_16___lsb 24
314#define reg_iop_sw_cfg_rw_pinmapping___gio19_16___width 2
315#define reg_iop_sw_cfg_rw_pinmapping___gio23_20___lsb 26
316#define reg_iop_sw_cfg_rw_pinmapping___gio23_20___width 2
317#define reg_iop_sw_cfg_rw_pinmapping___gio27_24___lsb 28
318#define reg_iop_sw_cfg_rw_pinmapping___gio27_24___width 2
319#define reg_iop_sw_cfg_rw_pinmapping___gio31_28___lsb 30
320#define reg_iop_sw_cfg_rw_pinmapping___gio31_28___width 2
321#define reg_iop_sw_cfg_rw_pinmapping_offset 160
322
323/* Register rw_bus_out_cfg, scope iop_sw_cfg, type rw */
324#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_lo___lsb 0
325#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_lo___width 3
326#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_hi___lsb 3
327#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_hi___width 3
328#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_lo_oe___lsb 6
329#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_lo_oe___width 3
330#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_hi_oe___lsb 9
331#define reg_iop_sw_cfg_rw_bus_out_cfg___bus0_hi_oe___width 3
332#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_lo___lsb 12
333#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_lo___width 3
334#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_hi___lsb 15
335#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_hi___width 3
336#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_lo_oe___lsb 18
337#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_lo_oe___width 3
338#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_hi_oe___lsb 21
339#define reg_iop_sw_cfg_rw_bus_out_cfg___bus1_hi_oe___width 3
340#define reg_iop_sw_cfg_rw_bus_out_cfg_offset 164
341
342/* Register rw_gio_out_grp0_cfg, scope iop_sw_cfg, type rw */
343#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio0___lsb 0
344#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio0___width 4
345#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio0_oe___lsb 4
346#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio0_oe___width 2
347#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio1___lsb 6
348#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio1___width 4
349#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio1_oe___lsb 10
350#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio1_oe___width 2
351#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio2___lsb 12
352#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio2___width 4
353#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio2_oe___lsb 16
354#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio2_oe___width 2
355#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio3___lsb 18
356#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio3___width 4
357#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio3_oe___lsb 22
358#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg___gio3_oe___width 2
359#define reg_iop_sw_cfg_rw_gio_out_grp0_cfg_offset 168
360
361/* Register rw_gio_out_grp1_cfg, scope iop_sw_cfg, type rw */
362#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio4___lsb 0
363#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio4___width 4
364#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio4_oe___lsb 4
365#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio4_oe___width 2
366#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio5___lsb 6
367#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio5___width 4
368#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio5_oe___lsb 10
369#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio5_oe___width 2
370#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio6___lsb 12
371#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio6___width 4
372#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio6_oe___lsb 16
373#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio6_oe___width 2
374#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio7___lsb 18
375#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio7___width 4
376#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio7_oe___lsb 22
377#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg___gio7_oe___width 2
378#define reg_iop_sw_cfg_rw_gio_out_grp1_cfg_offset 172
379
380/* Register rw_gio_out_grp2_cfg, scope iop_sw_cfg, type rw */
381#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio8___lsb 0
382#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio8___width 4
383#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio8_oe___lsb 4
384#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio8_oe___width 2
385#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio9___lsb 6
386#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio9___width 4
387#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio9_oe___lsb 10
388#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio9_oe___width 2
389#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio10___lsb 12
390#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio10___width 4
391#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio10_oe___lsb 16
392#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio10_oe___width 2
393#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio11___lsb 18
394#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio11___width 4
395#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio11_oe___lsb 22
396#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg___gio11_oe___width 2
397#define reg_iop_sw_cfg_rw_gio_out_grp2_cfg_offset 176
398
399/* Register rw_gio_out_grp3_cfg, scope iop_sw_cfg, type rw */
400#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio12___lsb 0
401#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio12___width 4
402#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio12_oe___lsb 4
403#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio12_oe___width 2
404#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio13___lsb 6
405#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio13___width 4
406#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio13_oe___lsb 10
407#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio13_oe___width 2
408#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio14___lsb 12
409#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio14___width 4
410#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio14_oe___lsb 16
411#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio14_oe___width 2
412#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio15___lsb 18
413#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio15___width 4
414#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio15_oe___lsb 22
415#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg___gio15_oe___width 2
416#define reg_iop_sw_cfg_rw_gio_out_grp3_cfg_offset 180
417
418/* Register rw_gio_out_grp4_cfg, scope iop_sw_cfg, type rw */
419#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio16___lsb 0
420#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio16___width 4
421#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio16_oe___lsb 4
422#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio16_oe___width 2
423#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio17___lsb 6
424#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio17___width 4
425#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio17_oe___lsb 10
426#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio17_oe___width 2
427#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio18___lsb 12
428#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio18___width 4
429#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio18_oe___lsb 16
430#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio18_oe___width 2
431#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio19___lsb 18
432#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio19___width 4
433#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio19_oe___lsb 22
434#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg___gio19_oe___width 2
435#define reg_iop_sw_cfg_rw_gio_out_grp4_cfg_offset 184
436
437/* Register rw_gio_out_grp5_cfg, scope iop_sw_cfg, type rw */
438#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio20___lsb 0
439#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio20___width 4
440#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio20_oe___lsb 4
441#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio20_oe___width 2
442#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio21___lsb 6
443#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio21___width 4
444#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio21_oe___lsb 10
445#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio21_oe___width 2
446#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio22___lsb 12
447#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio22___width 4
448#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio22_oe___lsb 16
449#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio22_oe___width 2
450#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio23___lsb 18
451#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio23___width 4
452#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio23_oe___lsb 22
453#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg___gio23_oe___width 2
454#define reg_iop_sw_cfg_rw_gio_out_grp5_cfg_offset 188
455
456/* Register rw_gio_out_grp6_cfg, scope iop_sw_cfg, type rw */
457#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio24___lsb 0
458#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio24___width 4
459#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio24_oe___lsb 4
460#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio24_oe___width 2
461#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio25___lsb 6
462#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio25___width 4
463#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio25_oe___lsb 10
464#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio25_oe___width 2
465#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio26___lsb 12
466#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio26___width 4
467#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio26_oe___lsb 16
468#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio26_oe___width 2
469#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio27___lsb 18
470#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio27___width 4
471#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio27_oe___lsb 22
472#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg___gio27_oe___width 2
473#define reg_iop_sw_cfg_rw_gio_out_grp6_cfg_offset 192
474
475/* Register rw_gio_out_grp7_cfg, scope iop_sw_cfg, type rw */
476#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio28___lsb 0
477#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio28___width 4
478#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio28_oe___lsb 4
479#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio28_oe___width 2
480#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio29___lsb 6
481#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio29___width 4
482#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio29_oe___lsb 10
483#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio29_oe___width 2
484#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio30___lsb 12
485#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio30___width 4
486#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio30_oe___lsb 16
487#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio30_oe___width 2
488#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio31___lsb 18
489#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio31___width 4
490#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio31_oe___lsb 22
491#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg___gio31_oe___width 2
492#define reg_iop_sw_cfg_rw_gio_out_grp7_cfg_offset 196
493
494/* Register rw_spu0_cfg, scope iop_sw_cfg, type rw */
495#define reg_iop_sw_cfg_rw_spu0_cfg___bus0_in___lsb 0
496#define reg_iop_sw_cfg_rw_spu0_cfg___bus0_in___width 2
497#define reg_iop_sw_cfg_rw_spu0_cfg___bus1_in___lsb 2
498#define reg_iop_sw_cfg_rw_spu0_cfg___bus1_in___width 2
499#define reg_iop_sw_cfg_rw_spu0_cfg_offset 200
500
501/* Register rw_spu1_cfg, scope iop_sw_cfg, type rw */
502#define reg_iop_sw_cfg_rw_spu1_cfg___bus0_in___lsb 0
503#define reg_iop_sw_cfg_rw_spu1_cfg___bus0_in___width 2
504#define reg_iop_sw_cfg_rw_spu1_cfg___bus1_in___lsb 2
505#define reg_iop_sw_cfg_rw_spu1_cfg___bus1_in___width 2
506#define reg_iop_sw_cfg_rw_spu1_cfg_offset 204
507
508/* Register rw_timer_grp0_cfg, scope iop_sw_cfg, type rw */
509#define reg_iop_sw_cfg_rw_timer_grp0_cfg___ext_clk___lsb 0
510#define reg_iop_sw_cfg_rw_timer_grp0_cfg___ext_clk___width 3
511#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_en___lsb 3
512#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_en___width 1
513#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_en___bit 3
514#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_en___lsb 4
515#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_en___width 1
516#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_en___bit 4
517#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_en___lsb 5
518#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_en___width 1
519#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_en___bit 5
520#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_en___lsb 6
521#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_en___width 1
522#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_en___bit 6
523#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_dis___lsb 7
524#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_dis___width 1
525#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr0_dis___bit 7
526#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_dis___lsb 8
527#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_dis___width 1
528#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr1_dis___bit 8
529#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_dis___lsb 9
530#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_dis___width 1
531#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr2_dis___bit 9
532#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_dis___lsb 10
533#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_dis___width 1
534#define reg_iop_sw_cfg_rw_timer_grp0_cfg___tmr3_dis___bit 10
535#define reg_iop_sw_cfg_rw_timer_grp0_cfg_offset 208
536
537/* Register rw_timer_grp1_cfg, scope iop_sw_cfg, type rw */
538#define reg_iop_sw_cfg_rw_timer_grp1_cfg___ext_clk___lsb 0
539#define reg_iop_sw_cfg_rw_timer_grp1_cfg___ext_clk___width 3
540#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_en___lsb 3
541#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_en___width 1
542#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_en___bit 3
543#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_en___lsb 4
544#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_en___width 1
545#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_en___bit 4
546#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_en___lsb 5
547#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_en___width 1
548#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_en___bit 5
549#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_en___lsb 6
550#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_en___width 1
551#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_en___bit 6
552#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_dis___lsb 7
553#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_dis___width 1
554#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr0_dis___bit 7
555#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_dis___lsb 8
556#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_dis___width 1
557#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr1_dis___bit 8
558#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_dis___lsb 9
559#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_dis___width 1
560#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr2_dis___bit 9
561#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_dis___lsb 10
562#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_dis___width 1
563#define reg_iop_sw_cfg_rw_timer_grp1_cfg___tmr3_dis___bit 10
564#define reg_iop_sw_cfg_rw_timer_grp1_cfg_offset 212
565
566/* Register rw_timer_grp2_cfg, scope iop_sw_cfg, type rw */
567#define reg_iop_sw_cfg_rw_timer_grp2_cfg___ext_clk___lsb 0
568#define reg_iop_sw_cfg_rw_timer_grp2_cfg___ext_clk___width 3
569#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_en___lsb 3
570#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_en___width 1
571#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_en___bit 3
572#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_en___lsb 4
573#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_en___width 1
574#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_en___bit 4
575#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_en___lsb 5
576#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_en___width 1
577#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_en___bit 5
578#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_en___lsb 6
579#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_en___width 1
580#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_en___bit 6
581#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_dis___lsb 7
582#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_dis___width 1
583#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr0_dis___bit 7
584#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_dis___lsb 8
585#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_dis___width 1
586#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr1_dis___bit 8
587#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_dis___lsb 9
588#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_dis___width 1
589#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr2_dis___bit 9
590#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_dis___lsb 10
591#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_dis___width 1
592#define reg_iop_sw_cfg_rw_timer_grp2_cfg___tmr3_dis___bit 10
593#define reg_iop_sw_cfg_rw_timer_grp2_cfg_offset 216
594
595/* Register rw_timer_grp3_cfg, scope iop_sw_cfg, type rw */
596#define reg_iop_sw_cfg_rw_timer_grp3_cfg___ext_clk___lsb 0
597#define reg_iop_sw_cfg_rw_timer_grp3_cfg___ext_clk___width 3
598#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_en___lsb 3
599#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_en___width 1
600#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_en___bit 3
601#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_en___lsb 4
602#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_en___width 1
603#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_en___bit 4
604#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_en___lsb 5
605#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_en___width 1
606#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_en___bit 5
607#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_en___lsb 6
608#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_en___width 1
609#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_en___bit 6
610#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_dis___lsb 7
611#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_dis___width 1
612#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr0_dis___bit 7
613#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_dis___lsb 8
614#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_dis___width 1
615#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr1_dis___bit 8
616#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_dis___lsb 9
617#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_dis___width 1
618#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr2_dis___bit 9
619#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_dis___lsb 10
620#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_dis___width 1
621#define reg_iop_sw_cfg_rw_timer_grp3_cfg___tmr3_dis___bit 10
622#define reg_iop_sw_cfg_rw_timer_grp3_cfg_offset 220
623
624/* Register rw_trigger_grps_cfg, scope iop_sw_cfg, type rw */
625#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_dis___lsb 0
626#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_dis___width 1
627#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_dis___bit 0
628#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_en___lsb 1
629#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_en___width 1
630#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp0_en___bit 1
631#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_dis___lsb 2
632#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_dis___width 1
633#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_dis___bit 2
634#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_en___lsb 3
635#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_en___width 1
636#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp1_en___bit 3
637#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_dis___lsb 4
638#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_dis___width 1
639#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_dis___bit 4
640#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_en___lsb 5
641#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_en___width 1
642#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp2_en___bit 5
643#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_dis___lsb 6
644#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_dis___width 1
645#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_dis___bit 6
646#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_en___lsb 7
647#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_en___width 1
648#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp3_en___bit 7
649#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_dis___lsb 8
650#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_dis___width 1
651#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_dis___bit 8
652#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_en___lsb 9
653#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_en___width 1
654#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp4_en___bit 9
655#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_dis___lsb 10
656#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_dis___width 1
657#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_dis___bit 10
658#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_en___lsb 11
659#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_en___width 1
660#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp5_en___bit 11
661#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_dis___lsb 12
662#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_dis___width 1
663#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_dis___bit 12
664#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_en___lsb 13
665#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_en___width 1
666#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp6_en___bit 13
667#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_dis___lsb 14
668#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_dis___width 1
669#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_dis___bit 14
670#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_en___lsb 15
671#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_en___width 1
672#define reg_iop_sw_cfg_rw_trigger_grps_cfg___grp7_en___bit 15
673#define reg_iop_sw_cfg_rw_trigger_grps_cfg_offset 224
674
675/* Register rw_pdp0_cfg, scope iop_sw_cfg, type rw */
676#define reg_iop_sw_cfg_rw_pdp0_cfg___dmc0_usr___lsb 0
677#define reg_iop_sw_cfg_rw_pdp0_cfg___dmc0_usr___width 1
678#define reg_iop_sw_cfg_rw_pdp0_cfg___dmc0_usr___bit 0
679#define reg_iop_sw_cfg_rw_pdp0_cfg___out_strb___lsb 1
680#define reg_iop_sw_cfg_rw_pdp0_cfg___out_strb___width 5
681#define reg_iop_sw_cfg_rw_pdp0_cfg___in_src___lsb 6
682#define reg_iop_sw_cfg_rw_pdp0_cfg___in_src___width 3
683#define reg_iop_sw_cfg_rw_pdp0_cfg___in_size___lsb 9
684#define reg_iop_sw_cfg_rw_pdp0_cfg___in_size___width 3
685#define reg_iop_sw_cfg_rw_pdp0_cfg___in_last___lsb 12
686#define reg_iop_sw_cfg_rw_pdp0_cfg___in_last___width 2
687#define reg_iop_sw_cfg_rw_pdp0_cfg___in_strb___lsb 14
688#define reg_iop_sw_cfg_rw_pdp0_cfg___in_strb___width 4
689#define reg_iop_sw_cfg_rw_pdp0_cfg___out_src___lsb 18
690#define reg_iop_sw_cfg_rw_pdp0_cfg___out_src___width 1
691#define reg_iop_sw_cfg_rw_pdp0_cfg___out_src___bit 18
692#define reg_iop_sw_cfg_rw_pdp0_cfg_offset 228
693
694/* Register rw_pdp1_cfg, scope iop_sw_cfg, type rw */
695#define reg_iop_sw_cfg_rw_pdp1_cfg___dmc1_usr___lsb 0
696#define reg_iop_sw_cfg_rw_pdp1_cfg___dmc1_usr___width 1
697#define reg_iop_sw_cfg_rw_pdp1_cfg___dmc1_usr___bit 0
698#define reg_iop_sw_cfg_rw_pdp1_cfg___out_strb___lsb 1
699#define reg_iop_sw_cfg_rw_pdp1_cfg___out_strb___width 5
700#define reg_iop_sw_cfg_rw_pdp1_cfg___in_src___lsb 6
701#define reg_iop_sw_cfg_rw_pdp1_cfg___in_src___width 3
702#define reg_iop_sw_cfg_rw_pdp1_cfg___in_size___lsb 9
703#define reg_iop_sw_cfg_rw_pdp1_cfg___in_size___width 3
704#define reg_iop_sw_cfg_rw_pdp1_cfg___in_last___lsb 12
705#define reg_iop_sw_cfg_rw_pdp1_cfg___in_last___width 2
706#define reg_iop_sw_cfg_rw_pdp1_cfg___in_strb___lsb 14
707#define reg_iop_sw_cfg_rw_pdp1_cfg___in_strb___width 4
708#define reg_iop_sw_cfg_rw_pdp1_cfg___out_src___lsb 18
709#define reg_iop_sw_cfg_rw_pdp1_cfg___out_src___width 1
710#define reg_iop_sw_cfg_rw_pdp1_cfg___out_src___bit 18
711#define reg_iop_sw_cfg_rw_pdp1_cfg_offset 232
712
713/* Register rw_sdp_cfg, scope iop_sw_cfg, type rw */
714#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_out0_strb___lsb 0
715#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_out0_strb___width 3
716#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_out1_strb___lsb 3
717#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_out1_strb___width 3
718#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_data___lsb 6
719#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_data___width 3
720#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_last___lsb 9
721#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_last___width 2
722#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_strb___lsb 11
723#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in0_strb___width 3
724#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_data___lsb 14
725#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_data___width 3
726#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_last___lsb 17
727#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_last___width 2
728#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_strb___lsb 19
729#define reg_iop_sw_cfg_rw_sdp_cfg___sdp_in1_strb___width 3
730#define reg_iop_sw_cfg_rw_sdp_cfg_offset 236
731
732
733/* Constants */
734#define regk_iop_sw_cfg_a 0x00000001
735#define regk_iop_sw_cfg_b 0x00000002
736#define regk_iop_sw_cfg_bus0 0x00000000
737#define regk_iop_sw_cfg_bus0_rot16 0x00000004
738#define regk_iop_sw_cfg_bus0_rot24 0x00000006
739#define regk_iop_sw_cfg_bus0_rot8 0x00000002
740#define regk_iop_sw_cfg_bus1 0x00000001
741#define regk_iop_sw_cfg_bus1_rot16 0x00000005
742#define regk_iop_sw_cfg_bus1_rot24 0x00000007
743#define regk_iop_sw_cfg_bus1_rot8 0x00000003
744#define regk_iop_sw_cfg_clk12 0x00000000
745#define regk_iop_sw_cfg_cpu 0x00000000
746#define regk_iop_sw_cfg_dmc0 0x00000000
747#define regk_iop_sw_cfg_dmc1 0x00000001
748#define regk_iop_sw_cfg_gated_clk0 0x00000010
749#define regk_iop_sw_cfg_gated_clk1 0x00000011
750#define regk_iop_sw_cfg_gated_clk2 0x00000012
751#define regk_iop_sw_cfg_gated_clk3 0x00000013
752#define regk_iop_sw_cfg_gio0 0x00000004
753#define regk_iop_sw_cfg_gio1 0x00000001
754#define regk_iop_sw_cfg_gio2 0x00000005
755#define regk_iop_sw_cfg_gio3 0x00000002
756#define regk_iop_sw_cfg_gio4 0x00000006
757#define regk_iop_sw_cfg_gio5 0x00000003
758#define regk_iop_sw_cfg_gio6 0x00000007
759#define regk_iop_sw_cfg_gio7 0x00000004
760#define regk_iop_sw_cfg_gio_in0 0x00000000
761#define regk_iop_sw_cfg_gio_in1 0x00000001
762#define regk_iop_sw_cfg_gio_in10 0x00000002
763#define regk_iop_sw_cfg_gio_in11 0x00000003
764#define regk_iop_sw_cfg_gio_in14 0x00000004
765#define regk_iop_sw_cfg_gio_in15 0x00000005
766#define regk_iop_sw_cfg_gio_in18 0x00000002
767#define regk_iop_sw_cfg_gio_in19 0x00000003
768#define regk_iop_sw_cfg_gio_in20 0x00000004
769#define regk_iop_sw_cfg_gio_in21 0x00000005
770#define regk_iop_sw_cfg_gio_in26 0x00000006
771#define regk_iop_sw_cfg_gio_in27 0x00000007
772#define regk_iop_sw_cfg_gio_in28 0x00000006
773#define regk_iop_sw_cfg_gio_in29 0x00000007
774#define regk_iop_sw_cfg_gio_in4 0x00000000
775#define regk_iop_sw_cfg_gio_in5 0x00000001
776#define regk_iop_sw_cfg_last_timer_grp0_tmr2 0x00000001
777#define regk_iop_sw_cfg_last_timer_grp1_tmr2 0x00000001
778#define regk_iop_sw_cfg_last_timer_grp2_tmr2 0x00000002
779#define regk_iop_sw_cfg_last_timer_grp2_tmr3 0x00000003
780#define regk_iop_sw_cfg_last_timer_grp3_tmr2 0x00000002
781#define regk_iop_sw_cfg_last_timer_grp3_tmr3 0x00000003
782#define regk_iop_sw_cfg_mpu 0x00000001
783#define regk_iop_sw_cfg_none 0x00000000
784#define regk_iop_sw_cfg_par0 0x00000000
785#define regk_iop_sw_cfg_par1 0x00000001
786#define regk_iop_sw_cfg_pdp_out0 0x00000002
787#define regk_iop_sw_cfg_pdp_out0_hi 0x00000001
788#define regk_iop_sw_cfg_pdp_out0_hi_rot8 0x00000005
789#define regk_iop_sw_cfg_pdp_out0_lo 0x00000000
790#define regk_iop_sw_cfg_pdp_out0_lo_rot8 0x00000004
791#define regk_iop_sw_cfg_pdp_out1 0x00000003
792#define regk_iop_sw_cfg_pdp_out1_hi 0x00000003
793#define regk_iop_sw_cfg_pdp_out1_hi_rot8 0x00000005
794#define regk_iop_sw_cfg_pdp_out1_lo 0x00000002
795#define regk_iop_sw_cfg_pdp_out1_lo_rot8 0x00000004
796#define regk_iop_sw_cfg_rw_bus0_mask_default 0x00000000
797#define regk_iop_sw_cfg_rw_bus0_oe_mask_default 0x00000000
798#define regk_iop_sw_cfg_rw_bus1_mask_default 0x00000000
799#define regk_iop_sw_cfg_rw_bus1_oe_mask_default 0x00000000
800#define regk_iop_sw_cfg_rw_bus_out_cfg_default 0x00000000
801#define regk_iop_sw_cfg_rw_crc_par0_owner_default 0x00000000
802#define regk_iop_sw_cfg_rw_crc_par1_owner_default 0x00000000
803#define regk_iop_sw_cfg_rw_dmc_in0_owner_default 0x00000000
804#define regk_iop_sw_cfg_rw_dmc_in1_owner_default 0x00000000
805#define regk_iop_sw_cfg_rw_dmc_out0_owner_default 0x00000000
806#define regk_iop_sw_cfg_rw_dmc_out1_owner_default 0x00000000
807#define regk_iop_sw_cfg_rw_fifo_in0_extra_owner_default 0x00000000
808#define regk_iop_sw_cfg_rw_fifo_in0_owner_default 0x00000000
809#define regk_iop_sw_cfg_rw_fifo_in1_extra_owner_default 0x00000000
810#define regk_iop_sw_cfg_rw_fifo_in1_owner_default 0x00000000
811#define regk_iop_sw_cfg_rw_fifo_out0_extra_owner_default 0x00000000
812#define regk_iop_sw_cfg_rw_fifo_out0_owner_default 0x00000000
813#define regk_iop_sw_cfg_rw_fifo_out1_extra_owner_default 0x00000000
814#define regk_iop_sw_cfg_rw_fifo_out1_owner_default 0x00000000
815#define regk_iop_sw_cfg_rw_gio_mask_default 0x00000000
816#define regk_iop_sw_cfg_rw_gio_oe_mask_default 0x00000000
817#define regk_iop_sw_cfg_rw_gio_out_grp0_cfg_default 0x00000000
818#define regk_iop_sw_cfg_rw_gio_out_grp1_cfg_default 0x00000000
819#define regk_iop_sw_cfg_rw_gio_out_grp2_cfg_default 0x00000000
820#define regk_iop_sw_cfg_rw_gio_out_grp3_cfg_default 0x00000000
821#define regk_iop_sw_cfg_rw_gio_out_grp4_cfg_default 0x00000000
822#define regk_iop_sw_cfg_rw_gio_out_grp5_cfg_default 0x00000000
823#define regk_iop_sw_cfg_rw_gio_out_grp6_cfg_default 0x00000000
824#define regk_iop_sw_cfg_rw_gio_out_grp7_cfg_default 0x00000000
825#define regk_iop_sw_cfg_rw_pdp0_cfg_default 0x00000000
826#define regk_iop_sw_cfg_rw_pdp1_cfg_default 0x00000000
827#define regk_iop_sw_cfg_rw_pinmapping_default 0x55555555
828#define regk_iop_sw_cfg_rw_sap_in_owner_default 0x00000000
829#define regk_iop_sw_cfg_rw_sap_out_owner_default 0x00000000
830#define regk_iop_sw_cfg_rw_scrc_in0_owner_default 0x00000000
831#define regk_iop_sw_cfg_rw_scrc_in1_owner_default 0x00000000
832#define regk_iop_sw_cfg_rw_scrc_out0_owner_default 0x00000000
833#define regk_iop_sw_cfg_rw_scrc_out1_owner_default 0x00000000
834#define regk_iop_sw_cfg_rw_sdp_cfg_default 0x00000000
835#define regk_iop_sw_cfg_rw_spu0_cfg_default 0x00000000
836#define regk_iop_sw_cfg_rw_spu0_owner_default 0x00000000
837#define regk_iop_sw_cfg_rw_spu1_cfg_default 0x00000000
838#define regk_iop_sw_cfg_rw_spu1_owner_default 0x00000000
839#define regk_iop_sw_cfg_rw_timer_grp0_cfg_default 0x00000000
840#define regk_iop_sw_cfg_rw_timer_grp0_owner_default 0x00000000
841#define regk_iop_sw_cfg_rw_timer_grp1_cfg_default 0x00000000
842#define regk_iop_sw_cfg_rw_timer_grp1_owner_default 0x00000000
843#define regk_iop_sw_cfg_rw_timer_grp2_cfg_default 0x00000000
844#define regk_iop_sw_cfg_rw_timer_grp2_owner_default 0x00000000
845#define regk_iop_sw_cfg_rw_timer_grp3_cfg_default 0x00000000
846#define regk_iop_sw_cfg_rw_timer_grp3_owner_default 0x00000000
847#define regk_iop_sw_cfg_rw_trigger_grp0_owner_default 0x00000000
848#define regk_iop_sw_cfg_rw_trigger_grp1_owner_default 0x00000000
849#define regk_iop_sw_cfg_rw_trigger_grp2_owner_default 0x00000000
850#define regk_iop_sw_cfg_rw_trigger_grp3_owner_default 0x00000000
851#define regk_iop_sw_cfg_rw_trigger_grp4_owner_default 0x00000000
852#define regk_iop_sw_cfg_rw_trigger_grp5_owner_default 0x00000000
853#define regk_iop_sw_cfg_rw_trigger_grp6_owner_default 0x00000000
854#define regk_iop_sw_cfg_rw_trigger_grp7_owner_default 0x00000000
855#define regk_iop_sw_cfg_rw_trigger_grps_cfg_default 0x00000000
856#define regk_iop_sw_cfg_sdp_out0 0x00000008
857#define regk_iop_sw_cfg_sdp_out1 0x00000009
858#define regk_iop_sw_cfg_size16 0x00000002
859#define regk_iop_sw_cfg_size24 0x00000003
860#define regk_iop_sw_cfg_size32 0x00000004
861#define regk_iop_sw_cfg_size8 0x00000001
862#define regk_iop_sw_cfg_spu0 0x00000002
863#define regk_iop_sw_cfg_spu0_bus_out0_hi 0x00000006
864#define regk_iop_sw_cfg_spu0_bus_out0_lo 0x00000006
865#define regk_iop_sw_cfg_spu0_bus_out1_hi 0x00000007
866#define regk_iop_sw_cfg_spu0_bus_out1_lo 0x00000007
867#define regk_iop_sw_cfg_spu0_g0 0x0000000e
868#define regk_iop_sw_cfg_spu0_g1 0x0000000e
869#define regk_iop_sw_cfg_spu0_g2 0x0000000e
870#define regk_iop_sw_cfg_spu0_g3 0x0000000e
871#define regk_iop_sw_cfg_spu0_g4 0x0000000e
872#define regk_iop_sw_cfg_spu0_g5 0x0000000e
873#define regk_iop_sw_cfg_spu0_g6 0x0000000e
874#define regk_iop_sw_cfg_spu0_g7 0x0000000e
875#define regk_iop_sw_cfg_spu0_gio0 0x00000000
876#define regk_iop_sw_cfg_spu0_gio1 0x00000001
877#define regk_iop_sw_cfg_spu0_gio2 0x00000000
878#define regk_iop_sw_cfg_spu0_gio5 0x00000005
879#define regk_iop_sw_cfg_spu0_gio6 0x00000006
880#define regk_iop_sw_cfg_spu0_gio7 0x00000007
881#define regk_iop_sw_cfg_spu0_gio_out0 0x00000008
882#define regk_iop_sw_cfg_spu0_gio_out1 0x00000009
883#define regk_iop_sw_cfg_spu0_gio_out2 0x0000000a
884#define regk_iop_sw_cfg_spu0_gio_out3 0x0000000b
885#define regk_iop_sw_cfg_spu0_gio_out4 0x0000000c
886#define regk_iop_sw_cfg_spu0_gio_out5 0x0000000d
887#define regk_iop_sw_cfg_spu0_gio_out6 0x0000000e
888#define regk_iop_sw_cfg_spu0_gio_out7 0x0000000f
889#define regk_iop_sw_cfg_spu0_gioout0 0x00000000
890#define regk_iop_sw_cfg_spu0_gioout1 0x00000000
891#define regk_iop_sw_cfg_spu0_gioout10 0x0000000e
892#define regk_iop_sw_cfg_spu0_gioout11 0x0000000e
893#define regk_iop_sw_cfg_spu0_gioout12 0x0000000e
894#define regk_iop_sw_cfg_spu0_gioout13 0x0000000e
895#define regk_iop_sw_cfg_spu0_gioout14 0x0000000e
896#define regk_iop_sw_cfg_spu0_gioout15 0x0000000e
897#define regk_iop_sw_cfg_spu0_gioout16 0x0000000e
898#define regk_iop_sw_cfg_spu0_gioout17 0x0000000e
899#define regk_iop_sw_cfg_spu0_gioout18 0x0000000e
900#define regk_iop_sw_cfg_spu0_gioout19 0x0000000e
901#define regk_iop_sw_cfg_spu0_gioout2 0x00000002
902#define regk_iop_sw_cfg_spu0_gioout20 0x0000000e
903#define regk_iop_sw_cfg_spu0_gioout21 0x0000000e
904#define regk_iop_sw_cfg_spu0_gioout22 0x0000000e
905#define regk_iop_sw_cfg_spu0_gioout23 0x0000000e
906#define regk_iop_sw_cfg_spu0_gioout24 0x0000000e
907#define regk_iop_sw_cfg_spu0_gioout25 0x0000000e
908#define regk_iop_sw_cfg_spu0_gioout26 0x0000000e
909#define regk_iop_sw_cfg_spu0_gioout27 0x0000000e
910#define regk_iop_sw_cfg_spu0_gioout28 0x0000000e
911#define regk_iop_sw_cfg_spu0_gioout29 0x0000000e
912#define regk_iop_sw_cfg_spu0_gioout3 0x00000002
913#define regk_iop_sw_cfg_spu0_gioout30 0x0000000e
914#define regk_iop_sw_cfg_spu0_gioout31 0x0000000e
915#define regk_iop_sw_cfg_spu0_gioout4 0x00000004
916#define regk_iop_sw_cfg_spu0_gioout5 0x00000004
917#define regk_iop_sw_cfg_spu0_gioout6 0x00000006
918#define regk_iop_sw_cfg_spu0_gioout7 0x00000006
919#define regk_iop_sw_cfg_spu0_gioout8 0x0000000e
920#define regk_iop_sw_cfg_spu0_gioout9 0x0000000e
921#define regk_iop_sw_cfg_spu1 0x00000003
922#define regk_iop_sw_cfg_spu1_bus_out0_hi 0x00000006
923#define regk_iop_sw_cfg_spu1_bus_out0_lo 0x00000006
924#define regk_iop_sw_cfg_spu1_bus_out1_hi 0x00000007
925#define regk_iop_sw_cfg_spu1_bus_out1_lo 0x00000007
926#define regk_iop_sw_cfg_spu1_g0 0x0000000f
927#define regk_iop_sw_cfg_spu1_g1 0x0000000f
928#define regk_iop_sw_cfg_spu1_g2 0x0000000f
929#define regk_iop_sw_cfg_spu1_g3 0x0000000f
930#define regk_iop_sw_cfg_spu1_g4 0x0000000f
931#define regk_iop_sw_cfg_spu1_g5 0x0000000f
932#define regk_iop_sw_cfg_spu1_g6 0x0000000f
933#define regk_iop_sw_cfg_spu1_g7 0x0000000f
934#define regk_iop_sw_cfg_spu1_gio0 0x00000002
935#define regk_iop_sw_cfg_spu1_gio1 0x00000003
936#define regk_iop_sw_cfg_spu1_gio2 0x00000002
937#define regk_iop_sw_cfg_spu1_gio5 0x00000005
938#define regk_iop_sw_cfg_spu1_gio6 0x00000006
939#define regk_iop_sw_cfg_spu1_gio7 0x00000007
940#define regk_iop_sw_cfg_spu1_gio_out0 0x00000008
941#define regk_iop_sw_cfg_spu1_gio_out1 0x00000009
942#define regk_iop_sw_cfg_spu1_gio_out2 0x0000000a
943#define regk_iop_sw_cfg_spu1_gio_out3 0x0000000b
944#define regk_iop_sw_cfg_spu1_gio_out4 0x0000000c
945#define regk_iop_sw_cfg_spu1_gio_out5 0x0000000d
946#define regk_iop_sw_cfg_spu1_gio_out6 0x0000000e
947#define regk_iop_sw_cfg_spu1_gio_out7 0x0000000f
948#define regk_iop_sw_cfg_spu1_gioout0 0x00000001
949#define regk_iop_sw_cfg_spu1_gioout1 0x00000001
950#define regk_iop_sw_cfg_spu1_gioout10 0x0000000f
951#define regk_iop_sw_cfg_spu1_gioout11 0x0000000f
952#define regk_iop_sw_cfg_spu1_gioout12 0x0000000f
953#define regk_iop_sw_cfg_spu1_gioout13 0x0000000f
954#define regk_iop_sw_cfg_spu1_gioout14 0x0000000f
955#define regk_iop_sw_cfg_spu1_gioout15 0x0000000f
956#define regk_iop_sw_cfg_spu1_gioout16 0x0000000f
957#define regk_iop_sw_cfg_spu1_gioout17 0x0000000f
958#define regk_iop_sw_cfg_spu1_gioout18 0x0000000f
959#define regk_iop_sw_cfg_spu1_gioout19 0x0000000f
960#define regk_iop_sw_cfg_spu1_gioout2 0x00000003
961#define regk_iop_sw_cfg_spu1_gioout20 0x0000000f
962#define regk_iop_sw_cfg_spu1_gioout21 0x0000000f
963#define regk_iop_sw_cfg_spu1_gioout22 0x0000000f
964#define regk_iop_sw_cfg_spu1_gioout23 0x0000000f
965#define regk_iop_sw_cfg_spu1_gioout24 0x0000000f
966#define regk_iop_sw_cfg_spu1_gioout25 0x0000000f
967#define regk_iop_sw_cfg_spu1_gioout26 0x0000000f
968#define regk_iop_sw_cfg_spu1_gioout27 0x0000000f
969#define regk_iop_sw_cfg_spu1_gioout28 0x0000000f
970#define regk_iop_sw_cfg_spu1_gioout29 0x0000000f
971#define regk_iop_sw_cfg_spu1_gioout3 0x00000003
972#define regk_iop_sw_cfg_spu1_gioout30 0x0000000f
973#define regk_iop_sw_cfg_spu1_gioout31 0x0000000f
974#define regk_iop_sw_cfg_spu1_gioout4 0x00000005
975#define regk_iop_sw_cfg_spu1_gioout5 0x00000005
976#define regk_iop_sw_cfg_spu1_gioout6 0x00000007
977#define regk_iop_sw_cfg_spu1_gioout7 0x00000007
978#define regk_iop_sw_cfg_spu1_gioout8 0x0000000f
979#define regk_iop_sw_cfg_spu1_gioout9 0x0000000f
980#define regk_iop_sw_cfg_strb_timer_grp0_tmr0 0x00000001
981#define regk_iop_sw_cfg_strb_timer_grp0_tmr1 0x00000002
982#define regk_iop_sw_cfg_strb_timer_grp1_tmr0 0x00000001
983#define regk_iop_sw_cfg_strb_timer_grp1_tmr1 0x00000002
984#define regk_iop_sw_cfg_strb_timer_grp2_tmr0 0x00000003
985#define regk_iop_sw_cfg_strb_timer_grp2_tmr1 0x00000002
986#define regk_iop_sw_cfg_strb_timer_grp3_tmr0 0x00000003
987#define regk_iop_sw_cfg_strb_timer_grp3_tmr1 0x00000002
988#define regk_iop_sw_cfg_timer_grp0 0x00000000
989#define regk_iop_sw_cfg_timer_grp0_rot 0x00000001
990#define regk_iop_sw_cfg_timer_grp0_strb0 0x0000000a
991#define regk_iop_sw_cfg_timer_grp0_strb1 0x0000000a
992#define regk_iop_sw_cfg_timer_grp0_strb2 0x0000000a
993#define regk_iop_sw_cfg_timer_grp0_strb3 0x0000000a
994#define regk_iop_sw_cfg_timer_grp0_tmr0 0x00000004
995#define regk_iop_sw_cfg_timer_grp0_tmr1 0x00000004
996#define regk_iop_sw_cfg_timer_grp1 0x00000000
997#define regk_iop_sw_cfg_timer_grp1_rot 0x00000001
998#define regk_iop_sw_cfg_timer_grp1_strb0 0x0000000b
999#define regk_iop_sw_cfg_timer_grp1_strb1 0x0000000b
1000#define regk_iop_sw_cfg_timer_grp1_strb2 0x0000000b
1001#define regk_iop_sw_cfg_timer_grp1_strb3 0x0000000b
1002#define regk_iop_sw_cfg_timer_grp1_tmr0 0x00000005
1003#define regk_iop_sw_cfg_timer_grp1_tmr1 0x00000005
1004#define regk_iop_sw_cfg_timer_grp2 0x00000000
1005#define regk_iop_sw_cfg_timer_grp2_rot 0x00000001
1006#define regk_iop_sw_cfg_timer_grp2_strb0 0x0000000c
1007#define regk_iop_sw_cfg_timer_grp2_strb1 0x0000000c
1008#define regk_iop_sw_cfg_timer_grp2_strb2 0x0000000c
1009#define regk_iop_sw_cfg_timer_grp2_strb3 0x0000000c
1010#define regk_iop_sw_cfg_timer_grp2_tmr0 0x00000006
1011#define regk_iop_sw_cfg_timer_grp2_tmr1 0x00000006
1012#define regk_iop_sw_cfg_timer_grp3 0x00000000
1013#define regk_iop_sw_cfg_timer_grp3_rot 0x00000001
1014#define regk_iop_sw_cfg_timer_grp3_strb0 0x0000000d
1015#define regk_iop_sw_cfg_timer_grp3_strb1 0x0000000d
1016#define regk_iop_sw_cfg_timer_grp3_strb2 0x0000000d
1017#define regk_iop_sw_cfg_timer_grp3_strb3 0x0000000d
1018#define regk_iop_sw_cfg_timer_grp3_tmr0 0x00000007
1019#define regk_iop_sw_cfg_timer_grp3_tmr1 0x00000007
1020#define regk_iop_sw_cfg_trig0_0 0x00000000
1021#define regk_iop_sw_cfg_trig0_1 0x00000000
1022#define regk_iop_sw_cfg_trig0_2 0x00000000
1023#define regk_iop_sw_cfg_trig0_3 0x00000000
1024#define regk_iop_sw_cfg_trig1_0 0x00000000
1025#define regk_iop_sw_cfg_trig1_1 0x00000000
1026#define regk_iop_sw_cfg_trig1_2 0x00000000
1027#define regk_iop_sw_cfg_trig1_3 0x00000000
1028#define regk_iop_sw_cfg_trig2_0 0x00000000
1029#define regk_iop_sw_cfg_trig2_1 0x00000000
1030#define regk_iop_sw_cfg_trig2_2 0x00000000
1031#define regk_iop_sw_cfg_trig2_3 0x00000000
1032#define regk_iop_sw_cfg_trig3_0 0x00000000
1033#define regk_iop_sw_cfg_trig3_1 0x00000000
1034#define regk_iop_sw_cfg_trig3_2 0x00000000
1035#define regk_iop_sw_cfg_trig3_3 0x00000000
1036#define regk_iop_sw_cfg_trig4_0 0x00000001
1037#define regk_iop_sw_cfg_trig4_1 0x00000001
1038#define regk_iop_sw_cfg_trig4_2 0x00000001
1039#define regk_iop_sw_cfg_trig4_3 0x00000001
1040#define regk_iop_sw_cfg_trig5_0 0x00000001
1041#define regk_iop_sw_cfg_trig5_1 0x00000001
1042#define regk_iop_sw_cfg_trig5_2 0x00000001
1043#define regk_iop_sw_cfg_trig5_3 0x00000001
1044#define regk_iop_sw_cfg_trig6_0 0x00000001
1045#define regk_iop_sw_cfg_trig6_1 0x00000001
1046#define regk_iop_sw_cfg_trig6_2 0x00000001
1047#define regk_iop_sw_cfg_trig6_3 0x00000001
1048#define regk_iop_sw_cfg_trig7_0 0x00000001
1049#define regk_iop_sw_cfg_trig7_1 0x00000001
1050#define regk_iop_sw_cfg_trig7_2 0x00000001
1051#define regk_iop_sw_cfg_trig7_3 0x00000001
1052#endif /* __iop_sw_cfg_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cpu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cpu_defs_asm.h
new file mode 100644
index 000000000000..db347bcba025
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cpu_defs_asm.h
@@ -0,0 +1,1758 @@
1#ifndef __iop_sw_cpu_defs_asm_h
2#define __iop_sw_cpu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_cpu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sw_cpu_defs_asm.h ../../inst/io_proc/rtl/guinness/iop_sw_cpu.r
11 * id: $Id: iop_sw_cpu_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_mc_ctrl, scope iop_sw_cpu, type rw */
57#define reg_iop_sw_cpu_rw_mc_ctrl___keep_owner___lsb 0
58#define reg_iop_sw_cpu_rw_mc_ctrl___keep_owner___width 1
59#define reg_iop_sw_cpu_rw_mc_ctrl___keep_owner___bit 0
60#define reg_iop_sw_cpu_rw_mc_ctrl___cmd___lsb 1
61#define reg_iop_sw_cpu_rw_mc_ctrl___cmd___width 2
62#define reg_iop_sw_cpu_rw_mc_ctrl___size___lsb 3
63#define reg_iop_sw_cpu_rw_mc_ctrl___size___width 3
64#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu0_mem___lsb 6
65#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu0_mem___width 1
66#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu0_mem___bit 6
67#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu1_mem___lsb 7
68#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu1_mem___width 1
69#define reg_iop_sw_cpu_rw_mc_ctrl___wr_spu1_mem___bit 7
70#define reg_iop_sw_cpu_rw_mc_ctrl_offset 0
71
72/* Register rw_mc_data, scope iop_sw_cpu, type rw */
73#define reg_iop_sw_cpu_rw_mc_data___val___lsb 0
74#define reg_iop_sw_cpu_rw_mc_data___val___width 32
75#define reg_iop_sw_cpu_rw_mc_data_offset 4
76
77/* Register rw_mc_addr, scope iop_sw_cpu, type rw */
78#define reg_iop_sw_cpu_rw_mc_addr_offset 8
79
80/* Register rs_mc_data, scope iop_sw_cpu, type rs */
81#define reg_iop_sw_cpu_rs_mc_data_offset 12
82
83/* Register r_mc_data, scope iop_sw_cpu, type r */
84#define reg_iop_sw_cpu_r_mc_data_offset 16
85
86/* Register r_mc_stat, scope iop_sw_cpu, type r */
87#define reg_iop_sw_cpu_r_mc_stat___busy_cpu___lsb 0
88#define reg_iop_sw_cpu_r_mc_stat___busy_cpu___width 1
89#define reg_iop_sw_cpu_r_mc_stat___busy_cpu___bit 0
90#define reg_iop_sw_cpu_r_mc_stat___busy_mpu___lsb 1
91#define reg_iop_sw_cpu_r_mc_stat___busy_mpu___width 1
92#define reg_iop_sw_cpu_r_mc_stat___busy_mpu___bit 1
93#define reg_iop_sw_cpu_r_mc_stat___busy_spu0___lsb 2
94#define reg_iop_sw_cpu_r_mc_stat___busy_spu0___width 1
95#define reg_iop_sw_cpu_r_mc_stat___busy_spu0___bit 2
96#define reg_iop_sw_cpu_r_mc_stat___busy_spu1___lsb 3
97#define reg_iop_sw_cpu_r_mc_stat___busy_spu1___width 1
98#define reg_iop_sw_cpu_r_mc_stat___busy_spu1___bit 3
99#define reg_iop_sw_cpu_r_mc_stat___owned_by_cpu___lsb 4
100#define reg_iop_sw_cpu_r_mc_stat___owned_by_cpu___width 1
101#define reg_iop_sw_cpu_r_mc_stat___owned_by_cpu___bit 4
102#define reg_iop_sw_cpu_r_mc_stat___owned_by_mpu___lsb 5
103#define reg_iop_sw_cpu_r_mc_stat___owned_by_mpu___width 1
104#define reg_iop_sw_cpu_r_mc_stat___owned_by_mpu___bit 5
105#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu0___lsb 6
106#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu0___width 1
107#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu0___bit 6
108#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu1___lsb 7
109#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu1___width 1
110#define reg_iop_sw_cpu_r_mc_stat___owned_by_spu1___bit 7
111#define reg_iop_sw_cpu_r_mc_stat_offset 20
112
113/* Register rw_bus0_clr_mask, scope iop_sw_cpu, type rw */
114#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte0___lsb 0
115#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte0___width 8
116#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte1___lsb 8
117#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte1___width 8
118#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte2___lsb 16
119#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte2___width 8
120#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte3___lsb 24
121#define reg_iop_sw_cpu_rw_bus0_clr_mask___byte3___width 8
122#define reg_iop_sw_cpu_rw_bus0_clr_mask_offset 24
123
124/* Register rw_bus0_set_mask, scope iop_sw_cpu, type rw */
125#define reg_iop_sw_cpu_rw_bus0_set_mask___byte0___lsb 0
126#define reg_iop_sw_cpu_rw_bus0_set_mask___byte0___width 8
127#define reg_iop_sw_cpu_rw_bus0_set_mask___byte1___lsb 8
128#define reg_iop_sw_cpu_rw_bus0_set_mask___byte1___width 8
129#define reg_iop_sw_cpu_rw_bus0_set_mask___byte2___lsb 16
130#define reg_iop_sw_cpu_rw_bus0_set_mask___byte2___width 8
131#define reg_iop_sw_cpu_rw_bus0_set_mask___byte3___lsb 24
132#define reg_iop_sw_cpu_rw_bus0_set_mask___byte3___width 8
133#define reg_iop_sw_cpu_rw_bus0_set_mask_offset 28
134
135/* Register rw_bus0_oe_clr_mask, scope iop_sw_cpu, type rw */
136#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte0___lsb 0
137#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte0___width 1
138#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte0___bit 0
139#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte1___lsb 1
140#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte1___width 1
141#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte1___bit 1
142#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte2___lsb 2
143#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte2___width 1
144#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte2___bit 2
145#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte3___lsb 3
146#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte3___width 1
147#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask___byte3___bit 3
148#define reg_iop_sw_cpu_rw_bus0_oe_clr_mask_offset 32
149
150/* Register rw_bus0_oe_set_mask, scope iop_sw_cpu, type rw */
151#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte0___lsb 0
152#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte0___width 1
153#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte0___bit 0
154#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte1___lsb 1
155#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte1___width 1
156#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte1___bit 1
157#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte2___lsb 2
158#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte2___width 1
159#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte2___bit 2
160#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte3___lsb 3
161#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte3___width 1
162#define reg_iop_sw_cpu_rw_bus0_oe_set_mask___byte3___bit 3
163#define reg_iop_sw_cpu_rw_bus0_oe_set_mask_offset 36
164
165/* Register r_bus0_in, scope iop_sw_cpu, type r */
166#define reg_iop_sw_cpu_r_bus0_in_offset 40
167
168/* Register rw_bus1_clr_mask, scope iop_sw_cpu, type rw */
169#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte0___lsb 0
170#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte0___width 8
171#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte1___lsb 8
172#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte1___width 8
173#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte2___lsb 16
174#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte2___width 8
175#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte3___lsb 24
176#define reg_iop_sw_cpu_rw_bus1_clr_mask___byte3___width 8
177#define reg_iop_sw_cpu_rw_bus1_clr_mask_offset 44
178
179/* Register rw_bus1_set_mask, scope iop_sw_cpu, type rw */
180#define reg_iop_sw_cpu_rw_bus1_set_mask___byte0___lsb 0
181#define reg_iop_sw_cpu_rw_bus1_set_mask___byte0___width 8
182#define reg_iop_sw_cpu_rw_bus1_set_mask___byte1___lsb 8
183#define reg_iop_sw_cpu_rw_bus1_set_mask___byte1___width 8
184#define reg_iop_sw_cpu_rw_bus1_set_mask___byte2___lsb 16
185#define reg_iop_sw_cpu_rw_bus1_set_mask___byte2___width 8
186#define reg_iop_sw_cpu_rw_bus1_set_mask___byte3___lsb 24
187#define reg_iop_sw_cpu_rw_bus1_set_mask___byte3___width 8
188#define reg_iop_sw_cpu_rw_bus1_set_mask_offset 48
189
190/* Register rw_bus1_oe_clr_mask, scope iop_sw_cpu, type rw */
191#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte0___lsb 0
192#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte0___width 1
193#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte0___bit 0
194#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte1___lsb 1
195#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte1___width 1
196#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte1___bit 1
197#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte2___lsb 2
198#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte2___width 1
199#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte2___bit 2
200#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte3___lsb 3
201#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte3___width 1
202#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask___byte3___bit 3
203#define reg_iop_sw_cpu_rw_bus1_oe_clr_mask_offset 52
204
205/* Register rw_bus1_oe_set_mask, scope iop_sw_cpu, type rw */
206#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte0___lsb 0
207#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte0___width 1
208#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte0___bit 0
209#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte1___lsb 1
210#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte1___width 1
211#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte1___bit 1
212#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte2___lsb 2
213#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte2___width 1
214#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte2___bit 2
215#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte3___lsb 3
216#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte3___width 1
217#define reg_iop_sw_cpu_rw_bus1_oe_set_mask___byte3___bit 3
218#define reg_iop_sw_cpu_rw_bus1_oe_set_mask_offset 56
219
220/* Register r_bus1_in, scope iop_sw_cpu, type r */
221#define reg_iop_sw_cpu_r_bus1_in_offset 60
222
223/* Register rw_gio_clr_mask, scope iop_sw_cpu, type rw */
224#define reg_iop_sw_cpu_rw_gio_clr_mask___val___lsb 0
225#define reg_iop_sw_cpu_rw_gio_clr_mask___val___width 32
226#define reg_iop_sw_cpu_rw_gio_clr_mask_offset 64
227
228/* Register rw_gio_set_mask, scope iop_sw_cpu, type rw */
229#define reg_iop_sw_cpu_rw_gio_set_mask___val___lsb 0
230#define reg_iop_sw_cpu_rw_gio_set_mask___val___width 32
231#define reg_iop_sw_cpu_rw_gio_set_mask_offset 68
232
233/* Register rw_gio_oe_clr_mask, scope iop_sw_cpu, type rw */
234#define reg_iop_sw_cpu_rw_gio_oe_clr_mask___val___lsb 0
235#define reg_iop_sw_cpu_rw_gio_oe_clr_mask___val___width 32
236#define reg_iop_sw_cpu_rw_gio_oe_clr_mask_offset 72
237
238/* Register rw_gio_oe_set_mask, scope iop_sw_cpu, type rw */
239#define reg_iop_sw_cpu_rw_gio_oe_set_mask___val___lsb 0
240#define reg_iop_sw_cpu_rw_gio_oe_set_mask___val___width 32
241#define reg_iop_sw_cpu_rw_gio_oe_set_mask_offset 76
242
243/* Register r_gio_in, scope iop_sw_cpu, type r */
244#define reg_iop_sw_cpu_r_gio_in_offset 80
245
246/* Register rw_intr0_mask, scope iop_sw_cpu, type rw */
247#define reg_iop_sw_cpu_rw_intr0_mask___mpu_0___lsb 0
248#define reg_iop_sw_cpu_rw_intr0_mask___mpu_0___width 1
249#define reg_iop_sw_cpu_rw_intr0_mask___mpu_0___bit 0
250#define reg_iop_sw_cpu_rw_intr0_mask___mpu_1___lsb 1
251#define reg_iop_sw_cpu_rw_intr0_mask___mpu_1___width 1
252#define reg_iop_sw_cpu_rw_intr0_mask___mpu_1___bit 1
253#define reg_iop_sw_cpu_rw_intr0_mask___mpu_2___lsb 2
254#define reg_iop_sw_cpu_rw_intr0_mask___mpu_2___width 1
255#define reg_iop_sw_cpu_rw_intr0_mask___mpu_2___bit 2
256#define reg_iop_sw_cpu_rw_intr0_mask___mpu_3___lsb 3
257#define reg_iop_sw_cpu_rw_intr0_mask___mpu_3___width 1
258#define reg_iop_sw_cpu_rw_intr0_mask___mpu_3___bit 3
259#define reg_iop_sw_cpu_rw_intr0_mask___mpu_4___lsb 4
260#define reg_iop_sw_cpu_rw_intr0_mask___mpu_4___width 1
261#define reg_iop_sw_cpu_rw_intr0_mask___mpu_4___bit 4
262#define reg_iop_sw_cpu_rw_intr0_mask___mpu_5___lsb 5
263#define reg_iop_sw_cpu_rw_intr0_mask___mpu_5___width 1
264#define reg_iop_sw_cpu_rw_intr0_mask___mpu_5___bit 5
265#define reg_iop_sw_cpu_rw_intr0_mask___mpu_6___lsb 6
266#define reg_iop_sw_cpu_rw_intr0_mask___mpu_6___width 1
267#define reg_iop_sw_cpu_rw_intr0_mask___mpu_6___bit 6
268#define reg_iop_sw_cpu_rw_intr0_mask___mpu_7___lsb 7
269#define reg_iop_sw_cpu_rw_intr0_mask___mpu_7___width 1
270#define reg_iop_sw_cpu_rw_intr0_mask___mpu_7___bit 7
271#define reg_iop_sw_cpu_rw_intr0_mask___mpu_8___lsb 8
272#define reg_iop_sw_cpu_rw_intr0_mask___mpu_8___width 1
273#define reg_iop_sw_cpu_rw_intr0_mask___mpu_8___bit 8
274#define reg_iop_sw_cpu_rw_intr0_mask___mpu_9___lsb 9
275#define reg_iop_sw_cpu_rw_intr0_mask___mpu_9___width 1
276#define reg_iop_sw_cpu_rw_intr0_mask___mpu_9___bit 9
277#define reg_iop_sw_cpu_rw_intr0_mask___mpu_10___lsb 10
278#define reg_iop_sw_cpu_rw_intr0_mask___mpu_10___width 1
279#define reg_iop_sw_cpu_rw_intr0_mask___mpu_10___bit 10
280#define reg_iop_sw_cpu_rw_intr0_mask___mpu_11___lsb 11
281#define reg_iop_sw_cpu_rw_intr0_mask___mpu_11___width 1
282#define reg_iop_sw_cpu_rw_intr0_mask___mpu_11___bit 11
283#define reg_iop_sw_cpu_rw_intr0_mask___mpu_12___lsb 12
284#define reg_iop_sw_cpu_rw_intr0_mask___mpu_12___width 1
285#define reg_iop_sw_cpu_rw_intr0_mask___mpu_12___bit 12
286#define reg_iop_sw_cpu_rw_intr0_mask___mpu_13___lsb 13
287#define reg_iop_sw_cpu_rw_intr0_mask___mpu_13___width 1
288#define reg_iop_sw_cpu_rw_intr0_mask___mpu_13___bit 13
289#define reg_iop_sw_cpu_rw_intr0_mask___mpu_14___lsb 14
290#define reg_iop_sw_cpu_rw_intr0_mask___mpu_14___width 1
291#define reg_iop_sw_cpu_rw_intr0_mask___mpu_14___bit 14
292#define reg_iop_sw_cpu_rw_intr0_mask___mpu_15___lsb 15
293#define reg_iop_sw_cpu_rw_intr0_mask___mpu_15___width 1
294#define reg_iop_sw_cpu_rw_intr0_mask___mpu_15___bit 15
295#define reg_iop_sw_cpu_rw_intr0_mask___spu0_0___lsb 16
296#define reg_iop_sw_cpu_rw_intr0_mask___spu0_0___width 1
297#define reg_iop_sw_cpu_rw_intr0_mask___spu0_0___bit 16
298#define reg_iop_sw_cpu_rw_intr0_mask___spu0_1___lsb 17
299#define reg_iop_sw_cpu_rw_intr0_mask___spu0_1___width 1
300#define reg_iop_sw_cpu_rw_intr0_mask___spu0_1___bit 17
301#define reg_iop_sw_cpu_rw_intr0_mask___spu0_2___lsb 18
302#define reg_iop_sw_cpu_rw_intr0_mask___spu0_2___width 1
303#define reg_iop_sw_cpu_rw_intr0_mask___spu0_2___bit 18
304#define reg_iop_sw_cpu_rw_intr0_mask___spu0_3___lsb 19
305#define reg_iop_sw_cpu_rw_intr0_mask___spu0_3___width 1
306#define reg_iop_sw_cpu_rw_intr0_mask___spu0_3___bit 19
307#define reg_iop_sw_cpu_rw_intr0_mask___spu0_4___lsb 20
308#define reg_iop_sw_cpu_rw_intr0_mask___spu0_4___width 1
309#define reg_iop_sw_cpu_rw_intr0_mask___spu0_4___bit 20
310#define reg_iop_sw_cpu_rw_intr0_mask___spu0_5___lsb 21
311#define reg_iop_sw_cpu_rw_intr0_mask___spu0_5___width 1
312#define reg_iop_sw_cpu_rw_intr0_mask___spu0_5___bit 21
313#define reg_iop_sw_cpu_rw_intr0_mask___spu0_6___lsb 22
314#define reg_iop_sw_cpu_rw_intr0_mask___spu0_6___width 1
315#define reg_iop_sw_cpu_rw_intr0_mask___spu0_6___bit 22
316#define reg_iop_sw_cpu_rw_intr0_mask___spu0_7___lsb 23
317#define reg_iop_sw_cpu_rw_intr0_mask___spu0_7___width 1
318#define reg_iop_sw_cpu_rw_intr0_mask___spu0_7___bit 23
319#define reg_iop_sw_cpu_rw_intr0_mask___spu1_8___lsb 24
320#define reg_iop_sw_cpu_rw_intr0_mask___spu1_8___width 1
321#define reg_iop_sw_cpu_rw_intr0_mask___spu1_8___bit 24
322#define reg_iop_sw_cpu_rw_intr0_mask___spu1_9___lsb 25
323#define reg_iop_sw_cpu_rw_intr0_mask___spu1_9___width 1
324#define reg_iop_sw_cpu_rw_intr0_mask___spu1_9___bit 25
325#define reg_iop_sw_cpu_rw_intr0_mask___spu1_10___lsb 26
326#define reg_iop_sw_cpu_rw_intr0_mask___spu1_10___width 1
327#define reg_iop_sw_cpu_rw_intr0_mask___spu1_10___bit 26
328#define reg_iop_sw_cpu_rw_intr0_mask___spu1_11___lsb 27
329#define reg_iop_sw_cpu_rw_intr0_mask___spu1_11___width 1
330#define reg_iop_sw_cpu_rw_intr0_mask___spu1_11___bit 27
331#define reg_iop_sw_cpu_rw_intr0_mask___spu1_12___lsb 28
332#define reg_iop_sw_cpu_rw_intr0_mask___spu1_12___width 1
333#define reg_iop_sw_cpu_rw_intr0_mask___spu1_12___bit 28
334#define reg_iop_sw_cpu_rw_intr0_mask___spu1_13___lsb 29
335#define reg_iop_sw_cpu_rw_intr0_mask___spu1_13___width 1
336#define reg_iop_sw_cpu_rw_intr0_mask___spu1_13___bit 29
337#define reg_iop_sw_cpu_rw_intr0_mask___spu1_14___lsb 30
338#define reg_iop_sw_cpu_rw_intr0_mask___spu1_14___width 1
339#define reg_iop_sw_cpu_rw_intr0_mask___spu1_14___bit 30
340#define reg_iop_sw_cpu_rw_intr0_mask___spu1_15___lsb 31
341#define reg_iop_sw_cpu_rw_intr0_mask___spu1_15___width 1
342#define reg_iop_sw_cpu_rw_intr0_mask___spu1_15___bit 31
343#define reg_iop_sw_cpu_rw_intr0_mask_offset 84
344
345/* Register rw_ack_intr0, scope iop_sw_cpu, type rw */
346#define reg_iop_sw_cpu_rw_ack_intr0___mpu_0___lsb 0
347#define reg_iop_sw_cpu_rw_ack_intr0___mpu_0___width 1
348#define reg_iop_sw_cpu_rw_ack_intr0___mpu_0___bit 0
349#define reg_iop_sw_cpu_rw_ack_intr0___mpu_1___lsb 1
350#define reg_iop_sw_cpu_rw_ack_intr0___mpu_1___width 1
351#define reg_iop_sw_cpu_rw_ack_intr0___mpu_1___bit 1
352#define reg_iop_sw_cpu_rw_ack_intr0___mpu_2___lsb 2
353#define reg_iop_sw_cpu_rw_ack_intr0___mpu_2___width 1
354#define reg_iop_sw_cpu_rw_ack_intr0___mpu_2___bit 2
355#define reg_iop_sw_cpu_rw_ack_intr0___mpu_3___lsb 3
356#define reg_iop_sw_cpu_rw_ack_intr0___mpu_3___width 1
357#define reg_iop_sw_cpu_rw_ack_intr0___mpu_3___bit 3
358#define reg_iop_sw_cpu_rw_ack_intr0___mpu_4___lsb 4
359#define reg_iop_sw_cpu_rw_ack_intr0___mpu_4___width 1
360#define reg_iop_sw_cpu_rw_ack_intr0___mpu_4___bit 4
361#define reg_iop_sw_cpu_rw_ack_intr0___mpu_5___lsb 5
362#define reg_iop_sw_cpu_rw_ack_intr0___mpu_5___width 1
363#define reg_iop_sw_cpu_rw_ack_intr0___mpu_5___bit 5
364#define reg_iop_sw_cpu_rw_ack_intr0___mpu_6___lsb 6
365#define reg_iop_sw_cpu_rw_ack_intr0___mpu_6___width 1
366#define reg_iop_sw_cpu_rw_ack_intr0___mpu_6___bit 6
367#define reg_iop_sw_cpu_rw_ack_intr0___mpu_7___lsb 7
368#define reg_iop_sw_cpu_rw_ack_intr0___mpu_7___width 1
369#define reg_iop_sw_cpu_rw_ack_intr0___mpu_7___bit 7
370#define reg_iop_sw_cpu_rw_ack_intr0___mpu_8___lsb 8
371#define reg_iop_sw_cpu_rw_ack_intr0___mpu_8___width 1
372#define reg_iop_sw_cpu_rw_ack_intr0___mpu_8___bit 8
373#define reg_iop_sw_cpu_rw_ack_intr0___mpu_9___lsb 9
374#define reg_iop_sw_cpu_rw_ack_intr0___mpu_9___width 1
375#define reg_iop_sw_cpu_rw_ack_intr0___mpu_9___bit 9
376#define reg_iop_sw_cpu_rw_ack_intr0___mpu_10___lsb 10
377#define reg_iop_sw_cpu_rw_ack_intr0___mpu_10___width 1
378#define reg_iop_sw_cpu_rw_ack_intr0___mpu_10___bit 10
379#define reg_iop_sw_cpu_rw_ack_intr0___mpu_11___lsb 11
380#define reg_iop_sw_cpu_rw_ack_intr0___mpu_11___width 1
381#define reg_iop_sw_cpu_rw_ack_intr0___mpu_11___bit 11
382#define reg_iop_sw_cpu_rw_ack_intr0___mpu_12___lsb 12
383#define reg_iop_sw_cpu_rw_ack_intr0___mpu_12___width 1
384#define reg_iop_sw_cpu_rw_ack_intr0___mpu_12___bit 12
385#define reg_iop_sw_cpu_rw_ack_intr0___mpu_13___lsb 13
386#define reg_iop_sw_cpu_rw_ack_intr0___mpu_13___width 1
387#define reg_iop_sw_cpu_rw_ack_intr0___mpu_13___bit 13
388#define reg_iop_sw_cpu_rw_ack_intr0___mpu_14___lsb 14
389#define reg_iop_sw_cpu_rw_ack_intr0___mpu_14___width 1
390#define reg_iop_sw_cpu_rw_ack_intr0___mpu_14___bit 14
391#define reg_iop_sw_cpu_rw_ack_intr0___mpu_15___lsb 15
392#define reg_iop_sw_cpu_rw_ack_intr0___mpu_15___width 1
393#define reg_iop_sw_cpu_rw_ack_intr0___mpu_15___bit 15
394#define reg_iop_sw_cpu_rw_ack_intr0___spu0_0___lsb 16
395#define reg_iop_sw_cpu_rw_ack_intr0___spu0_0___width 1
396#define reg_iop_sw_cpu_rw_ack_intr0___spu0_0___bit 16
397#define reg_iop_sw_cpu_rw_ack_intr0___spu0_1___lsb 17
398#define reg_iop_sw_cpu_rw_ack_intr0___spu0_1___width 1
399#define reg_iop_sw_cpu_rw_ack_intr0___spu0_1___bit 17
400#define reg_iop_sw_cpu_rw_ack_intr0___spu0_2___lsb 18
401#define reg_iop_sw_cpu_rw_ack_intr0___spu0_2___width 1
402#define reg_iop_sw_cpu_rw_ack_intr0___spu0_2___bit 18
403#define reg_iop_sw_cpu_rw_ack_intr0___spu0_3___lsb 19
404#define reg_iop_sw_cpu_rw_ack_intr0___spu0_3___width 1
405#define reg_iop_sw_cpu_rw_ack_intr0___spu0_3___bit 19
406#define reg_iop_sw_cpu_rw_ack_intr0___spu0_4___lsb 20
407#define reg_iop_sw_cpu_rw_ack_intr0___spu0_4___width 1
408#define reg_iop_sw_cpu_rw_ack_intr0___spu0_4___bit 20
409#define reg_iop_sw_cpu_rw_ack_intr0___spu0_5___lsb 21
410#define reg_iop_sw_cpu_rw_ack_intr0___spu0_5___width 1
411#define reg_iop_sw_cpu_rw_ack_intr0___spu0_5___bit 21
412#define reg_iop_sw_cpu_rw_ack_intr0___spu0_6___lsb 22
413#define reg_iop_sw_cpu_rw_ack_intr0___spu0_6___width 1
414#define reg_iop_sw_cpu_rw_ack_intr0___spu0_6___bit 22
415#define reg_iop_sw_cpu_rw_ack_intr0___spu0_7___lsb 23
416#define reg_iop_sw_cpu_rw_ack_intr0___spu0_7___width 1
417#define reg_iop_sw_cpu_rw_ack_intr0___spu0_7___bit 23
418#define reg_iop_sw_cpu_rw_ack_intr0___spu1_8___lsb 24
419#define reg_iop_sw_cpu_rw_ack_intr0___spu1_8___width 1
420#define reg_iop_sw_cpu_rw_ack_intr0___spu1_8___bit 24
421#define reg_iop_sw_cpu_rw_ack_intr0___spu1_9___lsb 25
422#define reg_iop_sw_cpu_rw_ack_intr0___spu1_9___width 1
423#define reg_iop_sw_cpu_rw_ack_intr0___spu1_9___bit 25
424#define reg_iop_sw_cpu_rw_ack_intr0___spu1_10___lsb 26
425#define reg_iop_sw_cpu_rw_ack_intr0___spu1_10___width 1
426#define reg_iop_sw_cpu_rw_ack_intr0___spu1_10___bit 26
427#define reg_iop_sw_cpu_rw_ack_intr0___spu1_11___lsb 27
428#define reg_iop_sw_cpu_rw_ack_intr0___spu1_11___width 1
429#define reg_iop_sw_cpu_rw_ack_intr0___spu1_11___bit 27
430#define reg_iop_sw_cpu_rw_ack_intr0___spu1_12___lsb 28
431#define reg_iop_sw_cpu_rw_ack_intr0___spu1_12___width 1
432#define reg_iop_sw_cpu_rw_ack_intr0___spu1_12___bit 28
433#define reg_iop_sw_cpu_rw_ack_intr0___spu1_13___lsb 29
434#define reg_iop_sw_cpu_rw_ack_intr0___spu1_13___width 1
435#define reg_iop_sw_cpu_rw_ack_intr0___spu1_13___bit 29
436#define reg_iop_sw_cpu_rw_ack_intr0___spu1_14___lsb 30
437#define reg_iop_sw_cpu_rw_ack_intr0___spu1_14___width 1
438#define reg_iop_sw_cpu_rw_ack_intr0___spu1_14___bit 30
439#define reg_iop_sw_cpu_rw_ack_intr0___spu1_15___lsb 31
440#define reg_iop_sw_cpu_rw_ack_intr0___spu1_15___width 1
441#define reg_iop_sw_cpu_rw_ack_intr0___spu1_15___bit 31
442#define reg_iop_sw_cpu_rw_ack_intr0_offset 88
443
444/* Register r_intr0, scope iop_sw_cpu, type r */
445#define reg_iop_sw_cpu_r_intr0___mpu_0___lsb 0
446#define reg_iop_sw_cpu_r_intr0___mpu_0___width 1
447#define reg_iop_sw_cpu_r_intr0___mpu_0___bit 0
448#define reg_iop_sw_cpu_r_intr0___mpu_1___lsb 1
449#define reg_iop_sw_cpu_r_intr0___mpu_1___width 1
450#define reg_iop_sw_cpu_r_intr0___mpu_1___bit 1
451#define reg_iop_sw_cpu_r_intr0___mpu_2___lsb 2
452#define reg_iop_sw_cpu_r_intr0___mpu_2___width 1
453#define reg_iop_sw_cpu_r_intr0___mpu_2___bit 2
454#define reg_iop_sw_cpu_r_intr0___mpu_3___lsb 3
455#define reg_iop_sw_cpu_r_intr0___mpu_3___width 1
456#define reg_iop_sw_cpu_r_intr0___mpu_3___bit 3
457#define reg_iop_sw_cpu_r_intr0___mpu_4___lsb 4
458#define reg_iop_sw_cpu_r_intr0___mpu_4___width 1
459#define reg_iop_sw_cpu_r_intr0___mpu_4___bit 4
460#define reg_iop_sw_cpu_r_intr0___mpu_5___lsb 5
461#define reg_iop_sw_cpu_r_intr0___mpu_5___width 1
462#define reg_iop_sw_cpu_r_intr0___mpu_5___bit 5
463#define reg_iop_sw_cpu_r_intr0___mpu_6___lsb 6
464#define reg_iop_sw_cpu_r_intr0___mpu_6___width 1
465#define reg_iop_sw_cpu_r_intr0___mpu_6___bit 6
466#define reg_iop_sw_cpu_r_intr0___mpu_7___lsb 7
467#define reg_iop_sw_cpu_r_intr0___mpu_7___width 1
468#define reg_iop_sw_cpu_r_intr0___mpu_7___bit 7
469#define reg_iop_sw_cpu_r_intr0___mpu_8___lsb 8
470#define reg_iop_sw_cpu_r_intr0___mpu_8___width 1
471#define reg_iop_sw_cpu_r_intr0___mpu_8___bit 8
472#define reg_iop_sw_cpu_r_intr0___mpu_9___lsb 9
473#define reg_iop_sw_cpu_r_intr0___mpu_9___width 1
474#define reg_iop_sw_cpu_r_intr0___mpu_9___bit 9
475#define reg_iop_sw_cpu_r_intr0___mpu_10___lsb 10
476#define reg_iop_sw_cpu_r_intr0___mpu_10___width 1
477#define reg_iop_sw_cpu_r_intr0___mpu_10___bit 10
478#define reg_iop_sw_cpu_r_intr0___mpu_11___lsb 11
479#define reg_iop_sw_cpu_r_intr0___mpu_11___width 1
480#define reg_iop_sw_cpu_r_intr0___mpu_11___bit 11
481#define reg_iop_sw_cpu_r_intr0___mpu_12___lsb 12
482#define reg_iop_sw_cpu_r_intr0___mpu_12___width 1
483#define reg_iop_sw_cpu_r_intr0___mpu_12___bit 12
484#define reg_iop_sw_cpu_r_intr0___mpu_13___lsb 13
485#define reg_iop_sw_cpu_r_intr0___mpu_13___width 1
486#define reg_iop_sw_cpu_r_intr0___mpu_13___bit 13
487#define reg_iop_sw_cpu_r_intr0___mpu_14___lsb 14
488#define reg_iop_sw_cpu_r_intr0___mpu_14___width 1
489#define reg_iop_sw_cpu_r_intr0___mpu_14___bit 14
490#define reg_iop_sw_cpu_r_intr0___mpu_15___lsb 15
491#define reg_iop_sw_cpu_r_intr0___mpu_15___width 1
492#define reg_iop_sw_cpu_r_intr0___mpu_15___bit 15
493#define reg_iop_sw_cpu_r_intr0___spu0_0___lsb 16
494#define reg_iop_sw_cpu_r_intr0___spu0_0___width 1
495#define reg_iop_sw_cpu_r_intr0___spu0_0___bit 16
496#define reg_iop_sw_cpu_r_intr0___spu0_1___lsb 17
497#define reg_iop_sw_cpu_r_intr0___spu0_1___width 1
498#define reg_iop_sw_cpu_r_intr0___spu0_1___bit 17
499#define reg_iop_sw_cpu_r_intr0___spu0_2___lsb 18
500#define reg_iop_sw_cpu_r_intr0___spu0_2___width 1
501#define reg_iop_sw_cpu_r_intr0___spu0_2___bit 18
502#define reg_iop_sw_cpu_r_intr0___spu0_3___lsb 19
503#define reg_iop_sw_cpu_r_intr0___spu0_3___width 1
504#define reg_iop_sw_cpu_r_intr0___spu0_3___bit 19
505#define reg_iop_sw_cpu_r_intr0___spu0_4___lsb 20
506#define reg_iop_sw_cpu_r_intr0___spu0_4___width 1
507#define reg_iop_sw_cpu_r_intr0___spu0_4___bit 20
508#define reg_iop_sw_cpu_r_intr0___spu0_5___lsb 21
509#define reg_iop_sw_cpu_r_intr0___spu0_5___width 1
510#define reg_iop_sw_cpu_r_intr0___spu0_5___bit 21
511#define reg_iop_sw_cpu_r_intr0___spu0_6___lsb 22
512#define reg_iop_sw_cpu_r_intr0___spu0_6___width 1
513#define reg_iop_sw_cpu_r_intr0___spu0_6___bit 22
514#define reg_iop_sw_cpu_r_intr0___spu0_7___lsb 23
515#define reg_iop_sw_cpu_r_intr0___spu0_7___width 1
516#define reg_iop_sw_cpu_r_intr0___spu0_7___bit 23
517#define reg_iop_sw_cpu_r_intr0___spu1_8___lsb 24
518#define reg_iop_sw_cpu_r_intr0___spu1_8___width 1
519#define reg_iop_sw_cpu_r_intr0___spu1_8___bit 24
520#define reg_iop_sw_cpu_r_intr0___spu1_9___lsb 25
521#define reg_iop_sw_cpu_r_intr0___spu1_9___width 1
522#define reg_iop_sw_cpu_r_intr0___spu1_9___bit 25
523#define reg_iop_sw_cpu_r_intr0___spu1_10___lsb 26
524#define reg_iop_sw_cpu_r_intr0___spu1_10___width 1
525#define reg_iop_sw_cpu_r_intr0___spu1_10___bit 26
526#define reg_iop_sw_cpu_r_intr0___spu1_11___lsb 27
527#define reg_iop_sw_cpu_r_intr0___spu1_11___width 1
528#define reg_iop_sw_cpu_r_intr0___spu1_11___bit 27
529#define reg_iop_sw_cpu_r_intr0___spu1_12___lsb 28
530#define reg_iop_sw_cpu_r_intr0___spu1_12___width 1
531#define reg_iop_sw_cpu_r_intr0___spu1_12___bit 28
532#define reg_iop_sw_cpu_r_intr0___spu1_13___lsb 29
533#define reg_iop_sw_cpu_r_intr0___spu1_13___width 1
534#define reg_iop_sw_cpu_r_intr0___spu1_13___bit 29
535#define reg_iop_sw_cpu_r_intr0___spu1_14___lsb 30
536#define reg_iop_sw_cpu_r_intr0___spu1_14___width 1
537#define reg_iop_sw_cpu_r_intr0___spu1_14___bit 30
538#define reg_iop_sw_cpu_r_intr0___spu1_15___lsb 31
539#define reg_iop_sw_cpu_r_intr0___spu1_15___width 1
540#define reg_iop_sw_cpu_r_intr0___spu1_15___bit 31
541#define reg_iop_sw_cpu_r_intr0_offset 92
542
543/* Register r_masked_intr0, scope iop_sw_cpu, type r */
544#define reg_iop_sw_cpu_r_masked_intr0___mpu_0___lsb 0
545#define reg_iop_sw_cpu_r_masked_intr0___mpu_0___width 1
546#define reg_iop_sw_cpu_r_masked_intr0___mpu_0___bit 0
547#define reg_iop_sw_cpu_r_masked_intr0___mpu_1___lsb 1
548#define reg_iop_sw_cpu_r_masked_intr0___mpu_1___width 1
549#define reg_iop_sw_cpu_r_masked_intr0___mpu_1___bit 1
550#define reg_iop_sw_cpu_r_masked_intr0___mpu_2___lsb 2
551#define reg_iop_sw_cpu_r_masked_intr0___mpu_2___width 1
552#define reg_iop_sw_cpu_r_masked_intr0___mpu_2___bit 2
553#define reg_iop_sw_cpu_r_masked_intr0___mpu_3___lsb 3
554#define reg_iop_sw_cpu_r_masked_intr0___mpu_3___width 1
555#define reg_iop_sw_cpu_r_masked_intr0___mpu_3___bit 3
556#define reg_iop_sw_cpu_r_masked_intr0___mpu_4___lsb 4
557#define reg_iop_sw_cpu_r_masked_intr0___mpu_4___width 1
558#define reg_iop_sw_cpu_r_masked_intr0___mpu_4___bit 4
559#define reg_iop_sw_cpu_r_masked_intr0___mpu_5___lsb 5
560#define reg_iop_sw_cpu_r_masked_intr0___mpu_5___width 1
561#define reg_iop_sw_cpu_r_masked_intr0___mpu_5___bit 5
562#define reg_iop_sw_cpu_r_masked_intr0___mpu_6___lsb 6
563#define reg_iop_sw_cpu_r_masked_intr0___mpu_6___width 1
564#define reg_iop_sw_cpu_r_masked_intr0___mpu_6___bit 6
565#define reg_iop_sw_cpu_r_masked_intr0___mpu_7___lsb 7
566#define reg_iop_sw_cpu_r_masked_intr0___mpu_7___width 1
567#define reg_iop_sw_cpu_r_masked_intr0___mpu_7___bit 7
568#define reg_iop_sw_cpu_r_masked_intr0___mpu_8___lsb 8
569#define reg_iop_sw_cpu_r_masked_intr0___mpu_8___width 1
570#define reg_iop_sw_cpu_r_masked_intr0___mpu_8___bit 8
571#define reg_iop_sw_cpu_r_masked_intr0___mpu_9___lsb 9
572#define reg_iop_sw_cpu_r_masked_intr0___mpu_9___width 1
573#define reg_iop_sw_cpu_r_masked_intr0___mpu_9___bit 9
574#define reg_iop_sw_cpu_r_masked_intr0___mpu_10___lsb 10
575#define reg_iop_sw_cpu_r_masked_intr0___mpu_10___width 1
576#define reg_iop_sw_cpu_r_masked_intr0___mpu_10___bit 10
577#define reg_iop_sw_cpu_r_masked_intr0___mpu_11___lsb 11
578#define reg_iop_sw_cpu_r_masked_intr0___mpu_11___width 1
579#define reg_iop_sw_cpu_r_masked_intr0___mpu_11___bit 11
580#define reg_iop_sw_cpu_r_masked_intr0___mpu_12___lsb 12
581#define reg_iop_sw_cpu_r_masked_intr0___mpu_12___width 1
582#define reg_iop_sw_cpu_r_masked_intr0___mpu_12___bit 12
583#define reg_iop_sw_cpu_r_masked_intr0___mpu_13___lsb 13
584#define reg_iop_sw_cpu_r_masked_intr0___mpu_13___width 1
585#define reg_iop_sw_cpu_r_masked_intr0___mpu_13___bit 13
586#define reg_iop_sw_cpu_r_masked_intr0___mpu_14___lsb 14
587#define reg_iop_sw_cpu_r_masked_intr0___mpu_14___width 1
588#define reg_iop_sw_cpu_r_masked_intr0___mpu_14___bit 14
589#define reg_iop_sw_cpu_r_masked_intr0___mpu_15___lsb 15
590#define reg_iop_sw_cpu_r_masked_intr0___mpu_15___width 1
591#define reg_iop_sw_cpu_r_masked_intr0___mpu_15___bit 15
592#define reg_iop_sw_cpu_r_masked_intr0___spu0_0___lsb 16
593#define reg_iop_sw_cpu_r_masked_intr0___spu0_0___width 1
594#define reg_iop_sw_cpu_r_masked_intr0___spu0_0___bit 16
595#define reg_iop_sw_cpu_r_masked_intr0___spu0_1___lsb 17
596#define reg_iop_sw_cpu_r_masked_intr0___spu0_1___width 1
597#define reg_iop_sw_cpu_r_masked_intr0___spu0_1___bit 17
598#define reg_iop_sw_cpu_r_masked_intr0___spu0_2___lsb 18
599#define reg_iop_sw_cpu_r_masked_intr0___spu0_2___width 1
600#define reg_iop_sw_cpu_r_masked_intr0___spu0_2___bit 18
601#define reg_iop_sw_cpu_r_masked_intr0___spu0_3___lsb 19
602#define reg_iop_sw_cpu_r_masked_intr0___spu0_3___width 1
603#define reg_iop_sw_cpu_r_masked_intr0___spu0_3___bit 19
604#define reg_iop_sw_cpu_r_masked_intr0___spu0_4___lsb 20
605#define reg_iop_sw_cpu_r_masked_intr0___spu0_4___width 1
606#define reg_iop_sw_cpu_r_masked_intr0___spu0_4___bit 20
607#define reg_iop_sw_cpu_r_masked_intr0___spu0_5___lsb 21
608#define reg_iop_sw_cpu_r_masked_intr0___spu0_5___width 1
609#define reg_iop_sw_cpu_r_masked_intr0___spu0_5___bit 21
610#define reg_iop_sw_cpu_r_masked_intr0___spu0_6___lsb 22
611#define reg_iop_sw_cpu_r_masked_intr0___spu0_6___width 1
612#define reg_iop_sw_cpu_r_masked_intr0___spu0_6___bit 22
613#define reg_iop_sw_cpu_r_masked_intr0___spu0_7___lsb 23
614#define reg_iop_sw_cpu_r_masked_intr0___spu0_7___width 1
615#define reg_iop_sw_cpu_r_masked_intr0___spu0_7___bit 23
616#define reg_iop_sw_cpu_r_masked_intr0___spu1_8___lsb 24
617#define reg_iop_sw_cpu_r_masked_intr0___spu1_8___width 1
618#define reg_iop_sw_cpu_r_masked_intr0___spu1_8___bit 24
619#define reg_iop_sw_cpu_r_masked_intr0___spu1_9___lsb 25
620#define reg_iop_sw_cpu_r_masked_intr0___spu1_9___width 1
621#define reg_iop_sw_cpu_r_masked_intr0___spu1_9___bit 25
622#define reg_iop_sw_cpu_r_masked_intr0___spu1_10___lsb 26
623#define reg_iop_sw_cpu_r_masked_intr0___spu1_10___width 1
624#define reg_iop_sw_cpu_r_masked_intr0___spu1_10___bit 26
625#define reg_iop_sw_cpu_r_masked_intr0___spu1_11___lsb 27
626#define reg_iop_sw_cpu_r_masked_intr0___spu1_11___width 1
627#define reg_iop_sw_cpu_r_masked_intr0___spu1_11___bit 27
628#define reg_iop_sw_cpu_r_masked_intr0___spu1_12___lsb 28
629#define reg_iop_sw_cpu_r_masked_intr0___spu1_12___width 1
630#define reg_iop_sw_cpu_r_masked_intr0___spu1_12___bit 28
631#define reg_iop_sw_cpu_r_masked_intr0___spu1_13___lsb 29
632#define reg_iop_sw_cpu_r_masked_intr0___spu1_13___width 1
633#define reg_iop_sw_cpu_r_masked_intr0___spu1_13___bit 29
634#define reg_iop_sw_cpu_r_masked_intr0___spu1_14___lsb 30
635#define reg_iop_sw_cpu_r_masked_intr0___spu1_14___width 1
636#define reg_iop_sw_cpu_r_masked_intr0___spu1_14___bit 30
637#define reg_iop_sw_cpu_r_masked_intr0___spu1_15___lsb 31
638#define reg_iop_sw_cpu_r_masked_intr0___spu1_15___width 1
639#define reg_iop_sw_cpu_r_masked_intr0___spu1_15___bit 31
640#define reg_iop_sw_cpu_r_masked_intr0_offset 96
641
642/* Register rw_intr1_mask, scope iop_sw_cpu, type rw */
643#define reg_iop_sw_cpu_rw_intr1_mask___mpu_16___lsb 0
644#define reg_iop_sw_cpu_rw_intr1_mask___mpu_16___width 1
645#define reg_iop_sw_cpu_rw_intr1_mask___mpu_16___bit 0
646#define reg_iop_sw_cpu_rw_intr1_mask___mpu_17___lsb 1
647#define reg_iop_sw_cpu_rw_intr1_mask___mpu_17___width 1
648#define reg_iop_sw_cpu_rw_intr1_mask___mpu_17___bit 1
649#define reg_iop_sw_cpu_rw_intr1_mask___mpu_18___lsb 2
650#define reg_iop_sw_cpu_rw_intr1_mask___mpu_18___width 1
651#define reg_iop_sw_cpu_rw_intr1_mask___mpu_18___bit 2
652#define reg_iop_sw_cpu_rw_intr1_mask___mpu_19___lsb 3
653#define reg_iop_sw_cpu_rw_intr1_mask___mpu_19___width 1
654#define reg_iop_sw_cpu_rw_intr1_mask___mpu_19___bit 3
655#define reg_iop_sw_cpu_rw_intr1_mask___mpu_20___lsb 4
656#define reg_iop_sw_cpu_rw_intr1_mask___mpu_20___width 1
657#define reg_iop_sw_cpu_rw_intr1_mask___mpu_20___bit 4
658#define reg_iop_sw_cpu_rw_intr1_mask___mpu_21___lsb 5
659#define reg_iop_sw_cpu_rw_intr1_mask___mpu_21___width 1
660#define reg_iop_sw_cpu_rw_intr1_mask___mpu_21___bit 5
661#define reg_iop_sw_cpu_rw_intr1_mask___mpu_22___lsb 6
662#define reg_iop_sw_cpu_rw_intr1_mask___mpu_22___width 1
663#define reg_iop_sw_cpu_rw_intr1_mask___mpu_22___bit 6
664#define reg_iop_sw_cpu_rw_intr1_mask___mpu_23___lsb 7
665#define reg_iop_sw_cpu_rw_intr1_mask___mpu_23___width 1
666#define reg_iop_sw_cpu_rw_intr1_mask___mpu_23___bit 7
667#define reg_iop_sw_cpu_rw_intr1_mask___mpu_24___lsb 8
668#define reg_iop_sw_cpu_rw_intr1_mask___mpu_24___width 1
669#define reg_iop_sw_cpu_rw_intr1_mask___mpu_24___bit 8
670#define reg_iop_sw_cpu_rw_intr1_mask___mpu_25___lsb 9
671#define reg_iop_sw_cpu_rw_intr1_mask___mpu_25___width 1
672#define reg_iop_sw_cpu_rw_intr1_mask___mpu_25___bit 9
673#define reg_iop_sw_cpu_rw_intr1_mask___mpu_26___lsb 10
674#define reg_iop_sw_cpu_rw_intr1_mask___mpu_26___width 1
675#define reg_iop_sw_cpu_rw_intr1_mask___mpu_26___bit 10
676#define reg_iop_sw_cpu_rw_intr1_mask___mpu_27___lsb 11
677#define reg_iop_sw_cpu_rw_intr1_mask___mpu_27___width 1
678#define reg_iop_sw_cpu_rw_intr1_mask___mpu_27___bit 11
679#define reg_iop_sw_cpu_rw_intr1_mask___mpu_28___lsb 12
680#define reg_iop_sw_cpu_rw_intr1_mask___mpu_28___width 1
681#define reg_iop_sw_cpu_rw_intr1_mask___mpu_28___bit 12
682#define reg_iop_sw_cpu_rw_intr1_mask___mpu_29___lsb 13
683#define reg_iop_sw_cpu_rw_intr1_mask___mpu_29___width 1
684#define reg_iop_sw_cpu_rw_intr1_mask___mpu_29___bit 13
685#define reg_iop_sw_cpu_rw_intr1_mask___mpu_30___lsb 14
686#define reg_iop_sw_cpu_rw_intr1_mask___mpu_30___width 1
687#define reg_iop_sw_cpu_rw_intr1_mask___mpu_30___bit 14
688#define reg_iop_sw_cpu_rw_intr1_mask___mpu_31___lsb 15
689#define reg_iop_sw_cpu_rw_intr1_mask___mpu_31___width 1
690#define reg_iop_sw_cpu_rw_intr1_mask___mpu_31___bit 15
691#define reg_iop_sw_cpu_rw_intr1_mask___spu0_8___lsb 16
692#define reg_iop_sw_cpu_rw_intr1_mask___spu0_8___width 1
693#define reg_iop_sw_cpu_rw_intr1_mask___spu0_8___bit 16
694#define reg_iop_sw_cpu_rw_intr1_mask___spu0_9___lsb 17
695#define reg_iop_sw_cpu_rw_intr1_mask___spu0_9___width 1
696#define reg_iop_sw_cpu_rw_intr1_mask___spu0_9___bit 17
697#define reg_iop_sw_cpu_rw_intr1_mask___spu0_10___lsb 18
698#define reg_iop_sw_cpu_rw_intr1_mask___spu0_10___width 1
699#define reg_iop_sw_cpu_rw_intr1_mask___spu0_10___bit 18
700#define reg_iop_sw_cpu_rw_intr1_mask___spu0_11___lsb 19
701#define reg_iop_sw_cpu_rw_intr1_mask___spu0_11___width 1
702#define reg_iop_sw_cpu_rw_intr1_mask___spu0_11___bit 19
703#define reg_iop_sw_cpu_rw_intr1_mask___spu0_12___lsb 20
704#define reg_iop_sw_cpu_rw_intr1_mask___spu0_12___width 1
705#define reg_iop_sw_cpu_rw_intr1_mask___spu0_12___bit 20
706#define reg_iop_sw_cpu_rw_intr1_mask___spu0_13___lsb 21
707#define reg_iop_sw_cpu_rw_intr1_mask___spu0_13___width 1
708#define reg_iop_sw_cpu_rw_intr1_mask___spu0_13___bit 21
709#define reg_iop_sw_cpu_rw_intr1_mask___spu0_14___lsb 22
710#define reg_iop_sw_cpu_rw_intr1_mask___spu0_14___width 1
711#define reg_iop_sw_cpu_rw_intr1_mask___spu0_14___bit 22
712#define reg_iop_sw_cpu_rw_intr1_mask___spu0_15___lsb 23
713#define reg_iop_sw_cpu_rw_intr1_mask___spu0_15___width 1
714#define reg_iop_sw_cpu_rw_intr1_mask___spu0_15___bit 23
715#define reg_iop_sw_cpu_rw_intr1_mask___spu1_0___lsb 24
716#define reg_iop_sw_cpu_rw_intr1_mask___spu1_0___width 1
717#define reg_iop_sw_cpu_rw_intr1_mask___spu1_0___bit 24
718#define reg_iop_sw_cpu_rw_intr1_mask___spu1_1___lsb 25
719#define reg_iop_sw_cpu_rw_intr1_mask___spu1_1___width 1
720#define reg_iop_sw_cpu_rw_intr1_mask___spu1_1___bit 25
721#define reg_iop_sw_cpu_rw_intr1_mask___spu1_2___lsb 26
722#define reg_iop_sw_cpu_rw_intr1_mask___spu1_2___width 1
723#define reg_iop_sw_cpu_rw_intr1_mask___spu1_2___bit 26
724#define reg_iop_sw_cpu_rw_intr1_mask___spu1_3___lsb 27
725#define reg_iop_sw_cpu_rw_intr1_mask___spu1_3___width 1
726#define reg_iop_sw_cpu_rw_intr1_mask___spu1_3___bit 27
727#define reg_iop_sw_cpu_rw_intr1_mask___spu1_4___lsb 28
728#define reg_iop_sw_cpu_rw_intr1_mask___spu1_4___width 1
729#define reg_iop_sw_cpu_rw_intr1_mask___spu1_4___bit 28
730#define reg_iop_sw_cpu_rw_intr1_mask___spu1_5___lsb 29
731#define reg_iop_sw_cpu_rw_intr1_mask___spu1_5___width 1
732#define reg_iop_sw_cpu_rw_intr1_mask___spu1_5___bit 29
733#define reg_iop_sw_cpu_rw_intr1_mask___spu1_6___lsb 30
734#define reg_iop_sw_cpu_rw_intr1_mask___spu1_6___width 1
735#define reg_iop_sw_cpu_rw_intr1_mask___spu1_6___bit 30
736#define reg_iop_sw_cpu_rw_intr1_mask___spu1_7___lsb 31
737#define reg_iop_sw_cpu_rw_intr1_mask___spu1_7___width 1
738#define reg_iop_sw_cpu_rw_intr1_mask___spu1_7___bit 31
739#define reg_iop_sw_cpu_rw_intr1_mask_offset 100
740
741/* Register rw_ack_intr1, scope iop_sw_cpu, type rw */
742#define reg_iop_sw_cpu_rw_ack_intr1___mpu_16___lsb 0
743#define reg_iop_sw_cpu_rw_ack_intr1___mpu_16___width 1
744#define reg_iop_sw_cpu_rw_ack_intr1___mpu_16___bit 0
745#define reg_iop_sw_cpu_rw_ack_intr1___mpu_17___lsb 1
746#define reg_iop_sw_cpu_rw_ack_intr1___mpu_17___width 1
747#define reg_iop_sw_cpu_rw_ack_intr1___mpu_17___bit 1
748#define reg_iop_sw_cpu_rw_ack_intr1___mpu_18___lsb 2
749#define reg_iop_sw_cpu_rw_ack_intr1___mpu_18___width 1
750#define reg_iop_sw_cpu_rw_ack_intr1___mpu_18___bit 2
751#define reg_iop_sw_cpu_rw_ack_intr1___mpu_19___lsb 3
752#define reg_iop_sw_cpu_rw_ack_intr1___mpu_19___width 1
753#define reg_iop_sw_cpu_rw_ack_intr1___mpu_19___bit 3
754#define reg_iop_sw_cpu_rw_ack_intr1___mpu_20___lsb 4
755#define reg_iop_sw_cpu_rw_ack_intr1___mpu_20___width 1
756#define reg_iop_sw_cpu_rw_ack_intr1___mpu_20___bit 4
757#define reg_iop_sw_cpu_rw_ack_intr1___mpu_21___lsb 5
758#define reg_iop_sw_cpu_rw_ack_intr1___mpu_21___width 1
759#define reg_iop_sw_cpu_rw_ack_intr1___mpu_21___bit 5
760#define reg_iop_sw_cpu_rw_ack_intr1___mpu_22___lsb 6
761#define reg_iop_sw_cpu_rw_ack_intr1___mpu_22___width 1
762#define reg_iop_sw_cpu_rw_ack_intr1___mpu_22___bit 6
763#define reg_iop_sw_cpu_rw_ack_intr1___mpu_23___lsb 7
764#define reg_iop_sw_cpu_rw_ack_intr1___mpu_23___width 1
765#define reg_iop_sw_cpu_rw_ack_intr1___mpu_23___bit 7
766#define reg_iop_sw_cpu_rw_ack_intr1___mpu_24___lsb 8
767#define reg_iop_sw_cpu_rw_ack_intr1___mpu_24___width 1
768#define reg_iop_sw_cpu_rw_ack_intr1___mpu_24___bit 8
769#define reg_iop_sw_cpu_rw_ack_intr1___mpu_25___lsb 9
770#define reg_iop_sw_cpu_rw_ack_intr1___mpu_25___width 1
771#define reg_iop_sw_cpu_rw_ack_intr1___mpu_25___bit 9
772#define reg_iop_sw_cpu_rw_ack_intr1___mpu_26___lsb 10
773#define reg_iop_sw_cpu_rw_ack_intr1___mpu_26___width 1
774#define reg_iop_sw_cpu_rw_ack_intr1___mpu_26___bit 10
775#define reg_iop_sw_cpu_rw_ack_intr1___mpu_27___lsb 11
776#define reg_iop_sw_cpu_rw_ack_intr1___mpu_27___width 1
777#define reg_iop_sw_cpu_rw_ack_intr1___mpu_27___bit 11
778#define reg_iop_sw_cpu_rw_ack_intr1___mpu_28___lsb 12
779#define reg_iop_sw_cpu_rw_ack_intr1___mpu_28___width 1
780#define reg_iop_sw_cpu_rw_ack_intr1___mpu_28___bit 12
781#define reg_iop_sw_cpu_rw_ack_intr1___mpu_29___lsb 13
782#define reg_iop_sw_cpu_rw_ack_intr1___mpu_29___width 1
783#define reg_iop_sw_cpu_rw_ack_intr1___mpu_29___bit 13
784#define reg_iop_sw_cpu_rw_ack_intr1___mpu_30___lsb 14
785#define reg_iop_sw_cpu_rw_ack_intr1___mpu_30___width 1
786#define reg_iop_sw_cpu_rw_ack_intr1___mpu_30___bit 14
787#define reg_iop_sw_cpu_rw_ack_intr1___mpu_31___lsb 15
788#define reg_iop_sw_cpu_rw_ack_intr1___mpu_31___width 1
789#define reg_iop_sw_cpu_rw_ack_intr1___mpu_31___bit 15
790#define reg_iop_sw_cpu_rw_ack_intr1___spu0_8___lsb 16
791#define reg_iop_sw_cpu_rw_ack_intr1___spu0_8___width 1
792#define reg_iop_sw_cpu_rw_ack_intr1___spu0_8___bit 16
793#define reg_iop_sw_cpu_rw_ack_intr1___spu0_9___lsb 17
794#define reg_iop_sw_cpu_rw_ack_intr1___spu0_9___width 1
795#define reg_iop_sw_cpu_rw_ack_intr1___spu0_9___bit 17
796#define reg_iop_sw_cpu_rw_ack_intr1___spu0_10___lsb 18
797#define reg_iop_sw_cpu_rw_ack_intr1___spu0_10___width 1
798#define reg_iop_sw_cpu_rw_ack_intr1___spu0_10___bit 18
799#define reg_iop_sw_cpu_rw_ack_intr1___spu0_11___lsb 19
800#define reg_iop_sw_cpu_rw_ack_intr1___spu0_11___width 1
801#define reg_iop_sw_cpu_rw_ack_intr1___spu0_11___bit 19
802#define reg_iop_sw_cpu_rw_ack_intr1___spu0_12___lsb 20
803#define reg_iop_sw_cpu_rw_ack_intr1___spu0_12___width 1
804#define reg_iop_sw_cpu_rw_ack_intr1___spu0_12___bit 20
805#define reg_iop_sw_cpu_rw_ack_intr1___spu0_13___lsb 21
806#define reg_iop_sw_cpu_rw_ack_intr1___spu0_13___width 1
807#define reg_iop_sw_cpu_rw_ack_intr1___spu0_13___bit 21
808#define reg_iop_sw_cpu_rw_ack_intr1___spu0_14___lsb 22
809#define reg_iop_sw_cpu_rw_ack_intr1___spu0_14___width 1
810#define reg_iop_sw_cpu_rw_ack_intr1___spu0_14___bit 22
811#define reg_iop_sw_cpu_rw_ack_intr1___spu0_15___lsb 23
812#define reg_iop_sw_cpu_rw_ack_intr1___spu0_15___width 1
813#define reg_iop_sw_cpu_rw_ack_intr1___spu0_15___bit 23
814#define reg_iop_sw_cpu_rw_ack_intr1___spu1_0___lsb 24
815#define reg_iop_sw_cpu_rw_ack_intr1___spu1_0___width 1
816#define reg_iop_sw_cpu_rw_ack_intr1___spu1_0___bit 24
817#define reg_iop_sw_cpu_rw_ack_intr1___spu1_1___lsb 25
818#define reg_iop_sw_cpu_rw_ack_intr1___spu1_1___width 1
819#define reg_iop_sw_cpu_rw_ack_intr1___spu1_1___bit 25
820#define reg_iop_sw_cpu_rw_ack_intr1___spu1_2___lsb 26
821#define reg_iop_sw_cpu_rw_ack_intr1___spu1_2___width 1
822#define reg_iop_sw_cpu_rw_ack_intr1___spu1_2___bit 26
823#define reg_iop_sw_cpu_rw_ack_intr1___spu1_3___lsb 27
824#define reg_iop_sw_cpu_rw_ack_intr1___spu1_3___width 1
825#define reg_iop_sw_cpu_rw_ack_intr1___spu1_3___bit 27
826#define reg_iop_sw_cpu_rw_ack_intr1___spu1_4___lsb 28
827#define reg_iop_sw_cpu_rw_ack_intr1___spu1_4___width 1
828#define reg_iop_sw_cpu_rw_ack_intr1___spu1_4___bit 28
829#define reg_iop_sw_cpu_rw_ack_intr1___spu1_5___lsb 29
830#define reg_iop_sw_cpu_rw_ack_intr1___spu1_5___width 1
831#define reg_iop_sw_cpu_rw_ack_intr1___spu1_5___bit 29
832#define reg_iop_sw_cpu_rw_ack_intr1___spu1_6___lsb 30
833#define reg_iop_sw_cpu_rw_ack_intr1___spu1_6___width 1
834#define reg_iop_sw_cpu_rw_ack_intr1___spu1_6___bit 30
835#define reg_iop_sw_cpu_rw_ack_intr1___spu1_7___lsb 31
836#define reg_iop_sw_cpu_rw_ack_intr1___spu1_7___width 1
837#define reg_iop_sw_cpu_rw_ack_intr1___spu1_7___bit 31
838#define reg_iop_sw_cpu_rw_ack_intr1_offset 104
839
840/* Register r_intr1, scope iop_sw_cpu, type r */
841#define reg_iop_sw_cpu_r_intr1___mpu_16___lsb 0
842#define reg_iop_sw_cpu_r_intr1___mpu_16___width 1
843#define reg_iop_sw_cpu_r_intr1___mpu_16___bit 0
844#define reg_iop_sw_cpu_r_intr1___mpu_17___lsb 1
845#define reg_iop_sw_cpu_r_intr1___mpu_17___width 1
846#define reg_iop_sw_cpu_r_intr1___mpu_17___bit 1
847#define reg_iop_sw_cpu_r_intr1___mpu_18___lsb 2
848#define reg_iop_sw_cpu_r_intr1___mpu_18___width 1
849#define reg_iop_sw_cpu_r_intr1___mpu_18___bit 2
850#define reg_iop_sw_cpu_r_intr1___mpu_19___lsb 3
851#define reg_iop_sw_cpu_r_intr1___mpu_19___width 1
852#define reg_iop_sw_cpu_r_intr1___mpu_19___bit 3
853#define reg_iop_sw_cpu_r_intr1___mpu_20___lsb 4
854#define reg_iop_sw_cpu_r_intr1___mpu_20___width 1
855#define reg_iop_sw_cpu_r_intr1___mpu_20___bit 4
856#define reg_iop_sw_cpu_r_intr1___mpu_21___lsb 5
857#define reg_iop_sw_cpu_r_intr1___mpu_21___width 1
858#define reg_iop_sw_cpu_r_intr1___mpu_21___bit 5
859#define reg_iop_sw_cpu_r_intr1___mpu_22___lsb 6
860#define reg_iop_sw_cpu_r_intr1___mpu_22___width 1
861#define reg_iop_sw_cpu_r_intr1___mpu_22___bit 6
862#define reg_iop_sw_cpu_r_intr1___mpu_23___lsb 7
863#define reg_iop_sw_cpu_r_intr1___mpu_23___width 1
864#define reg_iop_sw_cpu_r_intr1___mpu_23___bit 7
865#define reg_iop_sw_cpu_r_intr1___mpu_24___lsb 8
866#define reg_iop_sw_cpu_r_intr1___mpu_24___width 1
867#define reg_iop_sw_cpu_r_intr1___mpu_24___bit 8
868#define reg_iop_sw_cpu_r_intr1___mpu_25___lsb 9
869#define reg_iop_sw_cpu_r_intr1___mpu_25___width 1
870#define reg_iop_sw_cpu_r_intr1___mpu_25___bit 9
871#define reg_iop_sw_cpu_r_intr1___mpu_26___lsb 10
872#define reg_iop_sw_cpu_r_intr1___mpu_26___width 1
873#define reg_iop_sw_cpu_r_intr1___mpu_26___bit 10
874#define reg_iop_sw_cpu_r_intr1___mpu_27___lsb 11
875#define reg_iop_sw_cpu_r_intr1___mpu_27___width 1
876#define reg_iop_sw_cpu_r_intr1___mpu_27___bit 11
877#define reg_iop_sw_cpu_r_intr1___mpu_28___lsb 12
878#define reg_iop_sw_cpu_r_intr1___mpu_28___width 1
879#define reg_iop_sw_cpu_r_intr1___mpu_28___bit 12
880#define reg_iop_sw_cpu_r_intr1___mpu_29___lsb 13
881#define reg_iop_sw_cpu_r_intr1___mpu_29___width 1
882#define reg_iop_sw_cpu_r_intr1___mpu_29___bit 13
883#define reg_iop_sw_cpu_r_intr1___mpu_30___lsb 14
884#define reg_iop_sw_cpu_r_intr1___mpu_30___width 1
885#define reg_iop_sw_cpu_r_intr1___mpu_30___bit 14
886#define reg_iop_sw_cpu_r_intr1___mpu_31___lsb 15
887#define reg_iop_sw_cpu_r_intr1___mpu_31___width 1
888#define reg_iop_sw_cpu_r_intr1___mpu_31___bit 15
889#define reg_iop_sw_cpu_r_intr1___spu0_8___lsb 16
890#define reg_iop_sw_cpu_r_intr1___spu0_8___width 1
891#define reg_iop_sw_cpu_r_intr1___spu0_8___bit 16
892#define reg_iop_sw_cpu_r_intr1___spu0_9___lsb 17
893#define reg_iop_sw_cpu_r_intr1___spu0_9___width 1
894#define reg_iop_sw_cpu_r_intr1___spu0_9___bit 17
895#define reg_iop_sw_cpu_r_intr1___spu0_10___lsb 18
896#define reg_iop_sw_cpu_r_intr1___spu0_10___width 1
897#define reg_iop_sw_cpu_r_intr1___spu0_10___bit 18
898#define reg_iop_sw_cpu_r_intr1___spu0_11___lsb 19
899#define reg_iop_sw_cpu_r_intr1___spu0_11___width 1
900#define reg_iop_sw_cpu_r_intr1___spu0_11___bit 19
901#define reg_iop_sw_cpu_r_intr1___spu0_12___lsb 20
902#define reg_iop_sw_cpu_r_intr1___spu0_12___width 1
903#define reg_iop_sw_cpu_r_intr1___spu0_12___bit 20
904#define reg_iop_sw_cpu_r_intr1___spu0_13___lsb 21
905#define reg_iop_sw_cpu_r_intr1___spu0_13___width 1
906#define reg_iop_sw_cpu_r_intr1___spu0_13___bit 21
907#define reg_iop_sw_cpu_r_intr1___spu0_14___lsb 22
908#define reg_iop_sw_cpu_r_intr1___spu0_14___width 1
909#define reg_iop_sw_cpu_r_intr1___spu0_14___bit 22
910#define reg_iop_sw_cpu_r_intr1___spu0_15___lsb 23
911#define reg_iop_sw_cpu_r_intr1___spu0_15___width 1
912#define reg_iop_sw_cpu_r_intr1___spu0_15___bit 23
913#define reg_iop_sw_cpu_r_intr1___spu1_0___lsb 24
914#define reg_iop_sw_cpu_r_intr1___spu1_0___width 1
915#define reg_iop_sw_cpu_r_intr1___spu1_0___bit 24
916#define reg_iop_sw_cpu_r_intr1___spu1_1___lsb 25
917#define reg_iop_sw_cpu_r_intr1___spu1_1___width 1
918#define reg_iop_sw_cpu_r_intr1___spu1_1___bit 25
919#define reg_iop_sw_cpu_r_intr1___spu1_2___lsb 26
920#define reg_iop_sw_cpu_r_intr1___spu1_2___width 1
921#define reg_iop_sw_cpu_r_intr1___spu1_2___bit 26
922#define reg_iop_sw_cpu_r_intr1___spu1_3___lsb 27
923#define reg_iop_sw_cpu_r_intr1___spu1_3___width 1
924#define reg_iop_sw_cpu_r_intr1___spu1_3___bit 27
925#define reg_iop_sw_cpu_r_intr1___spu1_4___lsb 28
926#define reg_iop_sw_cpu_r_intr1___spu1_4___width 1
927#define reg_iop_sw_cpu_r_intr1___spu1_4___bit 28
928#define reg_iop_sw_cpu_r_intr1___spu1_5___lsb 29
929#define reg_iop_sw_cpu_r_intr1___spu1_5___width 1
930#define reg_iop_sw_cpu_r_intr1___spu1_5___bit 29
931#define reg_iop_sw_cpu_r_intr1___spu1_6___lsb 30
932#define reg_iop_sw_cpu_r_intr1___spu1_6___width 1
933#define reg_iop_sw_cpu_r_intr1___spu1_6___bit 30
934#define reg_iop_sw_cpu_r_intr1___spu1_7___lsb 31
935#define reg_iop_sw_cpu_r_intr1___spu1_7___width 1
936#define reg_iop_sw_cpu_r_intr1___spu1_7___bit 31
937#define reg_iop_sw_cpu_r_intr1_offset 108
938
939/* Register r_masked_intr1, scope iop_sw_cpu, type r */
940#define reg_iop_sw_cpu_r_masked_intr1___mpu_16___lsb 0
941#define reg_iop_sw_cpu_r_masked_intr1___mpu_16___width 1
942#define reg_iop_sw_cpu_r_masked_intr1___mpu_16___bit 0
943#define reg_iop_sw_cpu_r_masked_intr1___mpu_17___lsb 1
944#define reg_iop_sw_cpu_r_masked_intr1___mpu_17___width 1
945#define reg_iop_sw_cpu_r_masked_intr1___mpu_17___bit 1
946#define reg_iop_sw_cpu_r_masked_intr1___mpu_18___lsb 2
947#define reg_iop_sw_cpu_r_masked_intr1___mpu_18___width 1
948#define reg_iop_sw_cpu_r_masked_intr1___mpu_18___bit 2
949#define reg_iop_sw_cpu_r_masked_intr1___mpu_19___lsb 3
950#define reg_iop_sw_cpu_r_masked_intr1___mpu_19___width 1
951#define reg_iop_sw_cpu_r_masked_intr1___mpu_19___bit 3
952#define reg_iop_sw_cpu_r_masked_intr1___mpu_20___lsb 4
953#define reg_iop_sw_cpu_r_masked_intr1___mpu_20___width 1
954#define reg_iop_sw_cpu_r_masked_intr1___mpu_20___bit 4
955#define reg_iop_sw_cpu_r_masked_intr1___mpu_21___lsb 5
956#define reg_iop_sw_cpu_r_masked_intr1___mpu_21___width 1
957#define reg_iop_sw_cpu_r_masked_intr1___mpu_21___bit 5
958#define reg_iop_sw_cpu_r_masked_intr1___mpu_22___lsb 6
959#define reg_iop_sw_cpu_r_masked_intr1___mpu_22___width 1
960#define reg_iop_sw_cpu_r_masked_intr1___mpu_22___bit 6
961#define reg_iop_sw_cpu_r_masked_intr1___mpu_23___lsb 7
962#define reg_iop_sw_cpu_r_masked_intr1___mpu_23___width 1
963#define reg_iop_sw_cpu_r_masked_intr1___mpu_23___bit 7
964#define reg_iop_sw_cpu_r_masked_intr1___mpu_24___lsb 8
965#define reg_iop_sw_cpu_r_masked_intr1___mpu_24___width 1
966#define reg_iop_sw_cpu_r_masked_intr1___mpu_24___bit 8
967#define reg_iop_sw_cpu_r_masked_intr1___mpu_25___lsb 9
968#define reg_iop_sw_cpu_r_masked_intr1___mpu_25___width 1
969#define reg_iop_sw_cpu_r_masked_intr1___mpu_25___bit 9
970#define reg_iop_sw_cpu_r_masked_intr1___mpu_26___lsb 10
971#define reg_iop_sw_cpu_r_masked_intr1___mpu_26___width 1
972#define reg_iop_sw_cpu_r_masked_intr1___mpu_26___bit 10
973#define reg_iop_sw_cpu_r_masked_intr1___mpu_27___lsb 11
974#define reg_iop_sw_cpu_r_masked_intr1___mpu_27___width 1
975#define reg_iop_sw_cpu_r_masked_intr1___mpu_27___bit 11
976#define reg_iop_sw_cpu_r_masked_intr1___mpu_28___lsb 12
977#define reg_iop_sw_cpu_r_masked_intr1___mpu_28___width 1
978#define reg_iop_sw_cpu_r_masked_intr1___mpu_28___bit 12
979#define reg_iop_sw_cpu_r_masked_intr1___mpu_29___lsb 13
980#define reg_iop_sw_cpu_r_masked_intr1___mpu_29___width 1
981#define reg_iop_sw_cpu_r_masked_intr1___mpu_29___bit 13
982#define reg_iop_sw_cpu_r_masked_intr1___mpu_30___lsb 14
983#define reg_iop_sw_cpu_r_masked_intr1___mpu_30___width 1
984#define reg_iop_sw_cpu_r_masked_intr1___mpu_30___bit 14
985#define reg_iop_sw_cpu_r_masked_intr1___mpu_31___lsb 15
986#define reg_iop_sw_cpu_r_masked_intr1___mpu_31___width 1
987#define reg_iop_sw_cpu_r_masked_intr1___mpu_31___bit 15
988#define reg_iop_sw_cpu_r_masked_intr1___spu0_8___lsb 16
989#define reg_iop_sw_cpu_r_masked_intr1___spu0_8___width 1
990#define reg_iop_sw_cpu_r_masked_intr1___spu0_8___bit 16
991#define reg_iop_sw_cpu_r_masked_intr1___spu0_9___lsb 17
992#define reg_iop_sw_cpu_r_masked_intr1___spu0_9___width 1
993#define reg_iop_sw_cpu_r_masked_intr1___spu0_9___bit 17
994#define reg_iop_sw_cpu_r_masked_intr1___spu0_10___lsb 18
995#define reg_iop_sw_cpu_r_masked_intr1___spu0_10___width 1
996#define reg_iop_sw_cpu_r_masked_intr1___spu0_10___bit 18
997#define reg_iop_sw_cpu_r_masked_intr1___spu0_11___lsb 19
998#define reg_iop_sw_cpu_r_masked_intr1___spu0_11___width 1
999#define reg_iop_sw_cpu_r_masked_intr1___spu0_11___bit 19
1000#define reg_iop_sw_cpu_r_masked_intr1___spu0_12___lsb 20
1001#define reg_iop_sw_cpu_r_masked_intr1___spu0_12___width 1
1002#define reg_iop_sw_cpu_r_masked_intr1___spu0_12___bit 20
1003#define reg_iop_sw_cpu_r_masked_intr1___spu0_13___lsb 21
1004#define reg_iop_sw_cpu_r_masked_intr1___spu0_13___width 1
1005#define reg_iop_sw_cpu_r_masked_intr1___spu0_13___bit 21
1006#define reg_iop_sw_cpu_r_masked_intr1___spu0_14___lsb 22
1007#define reg_iop_sw_cpu_r_masked_intr1___spu0_14___width 1
1008#define reg_iop_sw_cpu_r_masked_intr1___spu0_14___bit 22
1009#define reg_iop_sw_cpu_r_masked_intr1___spu0_15___lsb 23
1010#define reg_iop_sw_cpu_r_masked_intr1___spu0_15___width 1
1011#define reg_iop_sw_cpu_r_masked_intr1___spu0_15___bit 23
1012#define reg_iop_sw_cpu_r_masked_intr1___spu1_0___lsb 24
1013#define reg_iop_sw_cpu_r_masked_intr1___spu1_0___width 1
1014#define reg_iop_sw_cpu_r_masked_intr1___spu1_0___bit 24
1015#define reg_iop_sw_cpu_r_masked_intr1___spu1_1___lsb 25
1016#define reg_iop_sw_cpu_r_masked_intr1___spu1_1___width 1
1017#define reg_iop_sw_cpu_r_masked_intr1___spu1_1___bit 25
1018#define reg_iop_sw_cpu_r_masked_intr1___spu1_2___lsb 26
1019#define reg_iop_sw_cpu_r_masked_intr1___spu1_2___width 1
1020#define reg_iop_sw_cpu_r_masked_intr1___spu1_2___bit 26
1021#define reg_iop_sw_cpu_r_masked_intr1___spu1_3___lsb 27
1022#define reg_iop_sw_cpu_r_masked_intr1___spu1_3___width 1
1023#define reg_iop_sw_cpu_r_masked_intr1___spu1_3___bit 27
1024#define reg_iop_sw_cpu_r_masked_intr1___spu1_4___lsb 28
1025#define reg_iop_sw_cpu_r_masked_intr1___spu1_4___width 1
1026#define reg_iop_sw_cpu_r_masked_intr1___spu1_4___bit 28
1027#define reg_iop_sw_cpu_r_masked_intr1___spu1_5___lsb 29
1028#define reg_iop_sw_cpu_r_masked_intr1___spu1_5___width 1
1029#define reg_iop_sw_cpu_r_masked_intr1___spu1_5___bit 29
1030#define reg_iop_sw_cpu_r_masked_intr1___spu1_6___lsb 30
1031#define reg_iop_sw_cpu_r_masked_intr1___spu1_6___width 1
1032#define reg_iop_sw_cpu_r_masked_intr1___spu1_6___bit 30
1033#define reg_iop_sw_cpu_r_masked_intr1___spu1_7___lsb 31
1034#define reg_iop_sw_cpu_r_masked_intr1___spu1_7___width 1
1035#define reg_iop_sw_cpu_r_masked_intr1___spu1_7___bit 31
1036#define reg_iop_sw_cpu_r_masked_intr1_offset 112
1037
1038/* Register rw_intr2_mask, scope iop_sw_cpu, type rw */
1039#define reg_iop_sw_cpu_rw_intr2_mask___mpu_0___lsb 0
1040#define reg_iop_sw_cpu_rw_intr2_mask___mpu_0___width 1
1041#define reg_iop_sw_cpu_rw_intr2_mask___mpu_0___bit 0
1042#define reg_iop_sw_cpu_rw_intr2_mask___mpu_1___lsb 1
1043#define reg_iop_sw_cpu_rw_intr2_mask___mpu_1___width 1
1044#define reg_iop_sw_cpu_rw_intr2_mask___mpu_1___bit 1
1045#define reg_iop_sw_cpu_rw_intr2_mask___mpu_2___lsb 2
1046#define reg_iop_sw_cpu_rw_intr2_mask___mpu_2___width 1
1047#define reg_iop_sw_cpu_rw_intr2_mask___mpu_2___bit 2
1048#define reg_iop_sw_cpu_rw_intr2_mask___mpu_3___lsb 3
1049#define reg_iop_sw_cpu_rw_intr2_mask___mpu_3___width 1
1050#define reg_iop_sw_cpu_rw_intr2_mask___mpu_3___bit 3
1051#define reg_iop_sw_cpu_rw_intr2_mask___mpu_4___lsb 4
1052#define reg_iop_sw_cpu_rw_intr2_mask___mpu_4___width 1
1053#define reg_iop_sw_cpu_rw_intr2_mask___mpu_4___bit 4
1054#define reg_iop_sw_cpu_rw_intr2_mask___mpu_5___lsb 5
1055#define reg_iop_sw_cpu_rw_intr2_mask___mpu_5___width 1
1056#define reg_iop_sw_cpu_rw_intr2_mask___mpu_5___bit 5
1057#define reg_iop_sw_cpu_rw_intr2_mask___mpu_6___lsb 6
1058#define reg_iop_sw_cpu_rw_intr2_mask___mpu_6___width 1
1059#define reg_iop_sw_cpu_rw_intr2_mask___mpu_6___bit 6
1060#define reg_iop_sw_cpu_rw_intr2_mask___mpu_7___lsb 7
1061#define reg_iop_sw_cpu_rw_intr2_mask___mpu_7___width 1
1062#define reg_iop_sw_cpu_rw_intr2_mask___mpu_7___bit 7
1063#define reg_iop_sw_cpu_rw_intr2_mask___spu0_0___lsb 8
1064#define reg_iop_sw_cpu_rw_intr2_mask___spu0_0___width 1
1065#define reg_iop_sw_cpu_rw_intr2_mask___spu0_0___bit 8
1066#define reg_iop_sw_cpu_rw_intr2_mask___spu0_1___lsb 9
1067#define reg_iop_sw_cpu_rw_intr2_mask___spu0_1___width 1
1068#define reg_iop_sw_cpu_rw_intr2_mask___spu0_1___bit 9
1069#define reg_iop_sw_cpu_rw_intr2_mask___spu0_2___lsb 10
1070#define reg_iop_sw_cpu_rw_intr2_mask___spu0_2___width 1
1071#define reg_iop_sw_cpu_rw_intr2_mask___spu0_2___bit 10
1072#define reg_iop_sw_cpu_rw_intr2_mask___spu0_3___lsb 11
1073#define reg_iop_sw_cpu_rw_intr2_mask___spu0_3___width 1
1074#define reg_iop_sw_cpu_rw_intr2_mask___spu0_3___bit 11
1075#define reg_iop_sw_cpu_rw_intr2_mask___spu0_4___lsb 12
1076#define reg_iop_sw_cpu_rw_intr2_mask___spu0_4___width 1
1077#define reg_iop_sw_cpu_rw_intr2_mask___spu0_4___bit 12
1078#define reg_iop_sw_cpu_rw_intr2_mask___spu0_5___lsb 13
1079#define reg_iop_sw_cpu_rw_intr2_mask___spu0_5___width 1
1080#define reg_iop_sw_cpu_rw_intr2_mask___spu0_5___bit 13
1081#define reg_iop_sw_cpu_rw_intr2_mask___spu0_6___lsb 14
1082#define reg_iop_sw_cpu_rw_intr2_mask___spu0_6___width 1
1083#define reg_iop_sw_cpu_rw_intr2_mask___spu0_6___bit 14
1084#define reg_iop_sw_cpu_rw_intr2_mask___spu0_7___lsb 15
1085#define reg_iop_sw_cpu_rw_intr2_mask___spu0_7___width 1
1086#define reg_iop_sw_cpu_rw_intr2_mask___spu0_7___bit 15
1087#define reg_iop_sw_cpu_rw_intr2_mask___dmc_in0___lsb 16
1088#define reg_iop_sw_cpu_rw_intr2_mask___dmc_in0___width 1
1089#define reg_iop_sw_cpu_rw_intr2_mask___dmc_in0___bit 16
1090#define reg_iop_sw_cpu_rw_intr2_mask___dmc_out0___lsb 17
1091#define reg_iop_sw_cpu_rw_intr2_mask___dmc_out0___width 1
1092#define reg_iop_sw_cpu_rw_intr2_mask___dmc_out0___bit 17
1093#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0___lsb 18
1094#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0___width 1
1095#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0___bit 18
1096#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0___lsb 19
1097#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0___width 1
1098#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0___bit 19
1099#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0_extra___lsb 20
1100#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0_extra___width 1
1101#define reg_iop_sw_cpu_rw_intr2_mask___fifo_in0_extra___bit 20
1102#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0_extra___lsb 21
1103#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0_extra___width 1
1104#define reg_iop_sw_cpu_rw_intr2_mask___fifo_out0_extra___bit 21
1105#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp0___lsb 22
1106#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp0___width 1
1107#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp0___bit 22
1108#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp1___lsb 23
1109#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp1___width 1
1110#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp1___bit 23
1111#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp2___lsb 24
1112#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp2___width 1
1113#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp2___bit 24
1114#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp3___lsb 25
1115#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp3___width 1
1116#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp3___bit 25
1117#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp4___lsb 26
1118#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp4___width 1
1119#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp4___bit 26
1120#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp5___lsb 27
1121#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp5___width 1
1122#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp5___bit 27
1123#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp6___lsb 28
1124#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp6___width 1
1125#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp6___bit 28
1126#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp7___lsb 29
1127#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp7___width 1
1128#define reg_iop_sw_cpu_rw_intr2_mask___trigger_grp7___bit 29
1129#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp0___lsb 30
1130#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp0___width 1
1131#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp0___bit 30
1132#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp1___lsb 31
1133#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp1___width 1
1134#define reg_iop_sw_cpu_rw_intr2_mask___timer_grp1___bit 31
1135#define reg_iop_sw_cpu_rw_intr2_mask_offset 116
1136
1137/* Register rw_ack_intr2, scope iop_sw_cpu, type rw */
1138#define reg_iop_sw_cpu_rw_ack_intr2___mpu_0___lsb 0
1139#define reg_iop_sw_cpu_rw_ack_intr2___mpu_0___width 1
1140#define reg_iop_sw_cpu_rw_ack_intr2___mpu_0___bit 0
1141#define reg_iop_sw_cpu_rw_ack_intr2___mpu_1___lsb 1
1142#define reg_iop_sw_cpu_rw_ack_intr2___mpu_1___width 1
1143#define reg_iop_sw_cpu_rw_ack_intr2___mpu_1___bit 1
1144#define reg_iop_sw_cpu_rw_ack_intr2___mpu_2___lsb 2
1145#define reg_iop_sw_cpu_rw_ack_intr2___mpu_2___width 1
1146#define reg_iop_sw_cpu_rw_ack_intr2___mpu_2___bit 2
1147#define reg_iop_sw_cpu_rw_ack_intr2___mpu_3___lsb 3
1148#define reg_iop_sw_cpu_rw_ack_intr2___mpu_3___width 1
1149#define reg_iop_sw_cpu_rw_ack_intr2___mpu_3___bit 3
1150#define reg_iop_sw_cpu_rw_ack_intr2___mpu_4___lsb 4
1151#define reg_iop_sw_cpu_rw_ack_intr2___mpu_4___width 1
1152#define reg_iop_sw_cpu_rw_ack_intr2___mpu_4___bit 4
1153#define reg_iop_sw_cpu_rw_ack_intr2___mpu_5___lsb 5
1154#define reg_iop_sw_cpu_rw_ack_intr2___mpu_5___width 1
1155#define reg_iop_sw_cpu_rw_ack_intr2___mpu_5___bit 5
1156#define reg_iop_sw_cpu_rw_ack_intr2___mpu_6___lsb 6
1157#define reg_iop_sw_cpu_rw_ack_intr2___mpu_6___width 1
1158#define reg_iop_sw_cpu_rw_ack_intr2___mpu_6___bit 6
1159#define reg_iop_sw_cpu_rw_ack_intr2___mpu_7___lsb 7
1160#define reg_iop_sw_cpu_rw_ack_intr2___mpu_7___width 1
1161#define reg_iop_sw_cpu_rw_ack_intr2___mpu_7___bit 7
1162#define reg_iop_sw_cpu_rw_ack_intr2___spu0_0___lsb 8
1163#define reg_iop_sw_cpu_rw_ack_intr2___spu0_0___width 1
1164#define reg_iop_sw_cpu_rw_ack_intr2___spu0_0___bit 8
1165#define reg_iop_sw_cpu_rw_ack_intr2___spu0_1___lsb 9
1166#define reg_iop_sw_cpu_rw_ack_intr2___spu0_1___width 1
1167#define reg_iop_sw_cpu_rw_ack_intr2___spu0_1___bit 9
1168#define reg_iop_sw_cpu_rw_ack_intr2___spu0_2___lsb 10
1169#define reg_iop_sw_cpu_rw_ack_intr2___spu0_2___width 1
1170#define reg_iop_sw_cpu_rw_ack_intr2___spu0_2___bit 10
1171#define reg_iop_sw_cpu_rw_ack_intr2___spu0_3___lsb 11
1172#define reg_iop_sw_cpu_rw_ack_intr2___spu0_3___width 1
1173#define reg_iop_sw_cpu_rw_ack_intr2___spu0_3___bit 11
1174#define reg_iop_sw_cpu_rw_ack_intr2___spu0_4___lsb 12
1175#define reg_iop_sw_cpu_rw_ack_intr2___spu0_4___width 1
1176#define reg_iop_sw_cpu_rw_ack_intr2___spu0_4___bit 12
1177#define reg_iop_sw_cpu_rw_ack_intr2___spu0_5___lsb 13
1178#define reg_iop_sw_cpu_rw_ack_intr2___spu0_5___width 1
1179#define reg_iop_sw_cpu_rw_ack_intr2___spu0_5___bit 13
1180#define reg_iop_sw_cpu_rw_ack_intr2___spu0_6___lsb 14
1181#define reg_iop_sw_cpu_rw_ack_intr2___spu0_6___width 1
1182#define reg_iop_sw_cpu_rw_ack_intr2___spu0_6___bit 14
1183#define reg_iop_sw_cpu_rw_ack_intr2___spu0_7___lsb 15
1184#define reg_iop_sw_cpu_rw_ack_intr2___spu0_7___width 1
1185#define reg_iop_sw_cpu_rw_ack_intr2___spu0_7___bit 15
1186#define reg_iop_sw_cpu_rw_ack_intr2_offset 120
1187
1188/* Register r_intr2, scope iop_sw_cpu, type r */
1189#define reg_iop_sw_cpu_r_intr2___mpu_0___lsb 0
1190#define reg_iop_sw_cpu_r_intr2___mpu_0___width 1
1191#define reg_iop_sw_cpu_r_intr2___mpu_0___bit 0
1192#define reg_iop_sw_cpu_r_intr2___mpu_1___lsb 1
1193#define reg_iop_sw_cpu_r_intr2___mpu_1___width 1
1194#define reg_iop_sw_cpu_r_intr2___mpu_1___bit 1
1195#define reg_iop_sw_cpu_r_intr2___mpu_2___lsb 2
1196#define reg_iop_sw_cpu_r_intr2___mpu_2___width 1
1197#define reg_iop_sw_cpu_r_intr2___mpu_2___bit 2
1198#define reg_iop_sw_cpu_r_intr2___mpu_3___lsb 3
1199#define reg_iop_sw_cpu_r_intr2___mpu_3___width 1
1200#define reg_iop_sw_cpu_r_intr2___mpu_3___bit 3
1201#define reg_iop_sw_cpu_r_intr2___mpu_4___lsb 4
1202#define reg_iop_sw_cpu_r_intr2___mpu_4___width 1
1203#define reg_iop_sw_cpu_r_intr2___mpu_4___bit 4
1204#define reg_iop_sw_cpu_r_intr2___mpu_5___lsb 5
1205#define reg_iop_sw_cpu_r_intr2___mpu_5___width 1
1206#define reg_iop_sw_cpu_r_intr2___mpu_5___bit 5
1207#define reg_iop_sw_cpu_r_intr2___mpu_6___lsb 6
1208#define reg_iop_sw_cpu_r_intr2___mpu_6___width 1
1209#define reg_iop_sw_cpu_r_intr2___mpu_6___bit 6
1210#define reg_iop_sw_cpu_r_intr2___mpu_7___lsb 7
1211#define reg_iop_sw_cpu_r_intr2___mpu_7___width 1
1212#define reg_iop_sw_cpu_r_intr2___mpu_7___bit 7
1213#define reg_iop_sw_cpu_r_intr2___spu0_0___lsb 8
1214#define reg_iop_sw_cpu_r_intr2___spu0_0___width 1
1215#define reg_iop_sw_cpu_r_intr2___spu0_0___bit 8
1216#define reg_iop_sw_cpu_r_intr2___spu0_1___lsb 9
1217#define reg_iop_sw_cpu_r_intr2___spu0_1___width 1
1218#define reg_iop_sw_cpu_r_intr2___spu0_1___bit 9
1219#define reg_iop_sw_cpu_r_intr2___spu0_2___lsb 10
1220#define reg_iop_sw_cpu_r_intr2___spu0_2___width 1
1221#define reg_iop_sw_cpu_r_intr2___spu0_2___bit 10
1222#define reg_iop_sw_cpu_r_intr2___spu0_3___lsb 11
1223#define reg_iop_sw_cpu_r_intr2___spu0_3___width 1
1224#define reg_iop_sw_cpu_r_intr2___spu0_3___bit 11
1225#define reg_iop_sw_cpu_r_intr2___spu0_4___lsb 12
1226#define reg_iop_sw_cpu_r_intr2___spu0_4___width 1
1227#define reg_iop_sw_cpu_r_intr2___spu0_4___bit 12
1228#define reg_iop_sw_cpu_r_intr2___spu0_5___lsb 13
1229#define reg_iop_sw_cpu_r_intr2___spu0_5___width 1
1230#define reg_iop_sw_cpu_r_intr2___spu0_5___bit 13
1231#define reg_iop_sw_cpu_r_intr2___spu0_6___lsb 14
1232#define reg_iop_sw_cpu_r_intr2___spu0_6___width 1
1233#define reg_iop_sw_cpu_r_intr2___spu0_6___bit 14
1234#define reg_iop_sw_cpu_r_intr2___spu0_7___lsb 15
1235#define reg_iop_sw_cpu_r_intr2___spu0_7___width 1
1236#define reg_iop_sw_cpu_r_intr2___spu0_7___bit 15
1237#define reg_iop_sw_cpu_r_intr2___dmc_in0___lsb 16
1238#define reg_iop_sw_cpu_r_intr2___dmc_in0___width 1
1239#define reg_iop_sw_cpu_r_intr2___dmc_in0___bit 16
1240#define reg_iop_sw_cpu_r_intr2___dmc_out0___lsb 17
1241#define reg_iop_sw_cpu_r_intr2___dmc_out0___width 1
1242#define reg_iop_sw_cpu_r_intr2___dmc_out0___bit 17
1243#define reg_iop_sw_cpu_r_intr2___fifo_in0___lsb 18
1244#define reg_iop_sw_cpu_r_intr2___fifo_in0___width 1
1245#define reg_iop_sw_cpu_r_intr2___fifo_in0___bit 18
1246#define reg_iop_sw_cpu_r_intr2___fifo_out0___lsb 19
1247#define reg_iop_sw_cpu_r_intr2___fifo_out0___width 1
1248#define reg_iop_sw_cpu_r_intr2___fifo_out0___bit 19
1249#define reg_iop_sw_cpu_r_intr2___fifo_in0_extra___lsb 20
1250#define reg_iop_sw_cpu_r_intr2___fifo_in0_extra___width 1
1251#define reg_iop_sw_cpu_r_intr2___fifo_in0_extra___bit 20
1252#define reg_iop_sw_cpu_r_intr2___fifo_out0_extra___lsb 21
1253#define reg_iop_sw_cpu_r_intr2___fifo_out0_extra___width 1
1254#define reg_iop_sw_cpu_r_intr2___fifo_out0_extra___bit 21
1255#define reg_iop_sw_cpu_r_intr2___trigger_grp0___lsb 22
1256#define reg_iop_sw_cpu_r_intr2___trigger_grp0___width 1
1257#define reg_iop_sw_cpu_r_intr2___trigger_grp0___bit 22
1258#define reg_iop_sw_cpu_r_intr2___trigger_grp1___lsb 23
1259#define reg_iop_sw_cpu_r_intr2___trigger_grp1___width 1
1260#define reg_iop_sw_cpu_r_intr2___trigger_grp1___bit 23
1261#define reg_iop_sw_cpu_r_intr2___trigger_grp2___lsb 24
1262#define reg_iop_sw_cpu_r_intr2___trigger_grp2___width 1
1263#define reg_iop_sw_cpu_r_intr2___trigger_grp2___bit 24
1264#define reg_iop_sw_cpu_r_intr2___trigger_grp3___lsb 25
1265#define reg_iop_sw_cpu_r_intr2___trigger_grp3___width 1
1266#define reg_iop_sw_cpu_r_intr2___trigger_grp3___bit 25
1267#define reg_iop_sw_cpu_r_intr2___trigger_grp4___lsb 26
1268#define reg_iop_sw_cpu_r_intr2___trigger_grp4___width 1
1269#define reg_iop_sw_cpu_r_intr2___trigger_grp4___bit 26
1270#define reg_iop_sw_cpu_r_intr2___trigger_grp5___lsb 27
1271#define reg_iop_sw_cpu_r_intr2___trigger_grp5___width 1
1272#define reg_iop_sw_cpu_r_intr2___trigger_grp5___bit 27
1273#define reg_iop_sw_cpu_r_intr2___trigger_grp6___lsb 28
1274#define reg_iop_sw_cpu_r_intr2___trigger_grp6___width 1
1275#define reg_iop_sw_cpu_r_intr2___trigger_grp6___bit 28
1276#define reg_iop_sw_cpu_r_intr2___trigger_grp7___lsb 29
1277#define reg_iop_sw_cpu_r_intr2___trigger_grp7___width 1
1278#define reg_iop_sw_cpu_r_intr2___trigger_grp7___bit 29
1279#define reg_iop_sw_cpu_r_intr2___timer_grp0___lsb 30
1280#define reg_iop_sw_cpu_r_intr2___timer_grp0___width 1
1281#define reg_iop_sw_cpu_r_intr2___timer_grp0___bit 30
1282#define reg_iop_sw_cpu_r_intr2___timer_grp1___lsb 31
1283#define reg_iop_sw_cpu_r_intr2___timer_grp1___width 1
1284#define reg_iop_sw_cpu_r_intr2___timer_grp1___bit 31
1285#define reg_iop_sw_cpu_r_intr2_offset 124
1286
1287/* Register r_masked_intr2, scope iop_sw_cpu, type r */
1288#define reg_iop_sw_cpu_r_masked_intr2___mpu_0___lsb 0
1289#define reg_iop_sw_cpu_r_masked_intr2___mpu_0___width 1
1290#define reg_iop_sw_cpu_r_masked_intr2___mpu_0___bit 0
1291#define reg_iop_sw_cpu_r_masked_intr2___mpu_1___lsb 1
1292#define reg_iop_sw_cpu_r_masked_intr2___mpu_1___width 1
1293#define reg_iop_sw_cpu_r_masked_intr2___mpu_1___bit 1
1294#define reg_iop_sw_cpu_r_masked_intr2___mpu_2___lsb 2
1295#define reg_iop_sw_cpu_r_masked_intr2___mpu_2___width 1
1296#define reg_iop_sw_cpu_r_masked_intr2___mpu_2___bit 2
1297#define reg_iop_sw_cpu_r_masked_intr2___mpu_3___lsb 3
1298#define reg_iop_sw_cpu_r_masked_intr2___mpu_3___width 1
1299#define reg_iop_sw_cpu_r_masked_intr2___mpu_3___bit 3
1300#define reg_iop_sw_cpu_r_masked_intr2___mpu_4___lsb 4
1301#define reg_iop_sw_cpu_r_masked_intr2___mpu_4___width 1
1302#define reg_iop_sw_cpu_r_masked_intr2___mpu_4___bit 4
1303#define reg_iop_sw_cpu_r_masked_intr2___mpu_5___lsb 5
1304#define reg_iop_sw_cpu_r_masked_intr2___mpu_5___width 1
1305#define reg_iop_sw_cpu_r_masked_intr2___mpu_5___bit 5
1306#define reg_iop_sw_cpu_r_masked_intr2___mpu_6___lsb 6
1307#define reg_iop_sw_cpu_r_masked_intr2___mpu_6___width 1
1308#define reg_iop_sw_cpu_r_masked_intr2___mpu_6___bit 6
1309#define reg_iop_sw_cpu_r_masked_intr2___mpu_7___lsb 7
1310#define reg_iop_sw_cpu_r_masked_intr2___mpu_7___width 1
1311#define reg_iop_sw_cpu_r_masked_intr2___mpu_7___bit 7
1312#define reg_iop_sw_cpu_r_masked_intr2___spu0_0___lsb 8
1313#define reg_iop_sw_cpu_r_masked_intr2___spu0_0___width 1
1314#define reg_iop_sw_cpu_r_masked_intr2___spu0_0___bit 8
1315#define reg_iop_sw_cpu_r_masked_intr2___spu0_1___lsb 9
1316#define reg_iop_sw_cpu_r_masked_intr2___spu0_1___width 1
1317#define reg_iop_sw_cpu_r_masked_intr2___spu0_1___bit 9
1318#define reg_iop_sw_cpu_r_masked_intr2___spu0_2___lsb 10
1319#define reg_iop_sw_cpu_r_masked_intr2___spu0_2___width 1
1320#define reg_iop_sw_cpu_r_masked_intr2___spu0_2___bit 10
1321#define reg_iop_sw_cpu_r_masked_intr2___spu0_3___lsb 11
1322#define reg_iop_sw_cpu_r_masked_intr2___spu0_3___width 1
1323#define reg_iop_sw_cpu_r_masked_intr2___spu0_3___bit 11
1324#define reg_iop_sw_cpu_r_masked_intr2___spu0_4___lsb 12
1325#define reg_iop_sw_cpu_r_masked_intr2___spu0_4___width 1
1326#define reg_iop_sw_cpu_r_masked_intr2___spu0_4___bit 12
1327#define reg_iop_sw_cpu_r_masked_intr2___spu0_5___lsb 13
1328#define reg_iop_sw_cpu_r_masked_intr2___spu0_5___width 1
1329#define reg_iop_sw_cpu_r_masked_intr2___spu0_5___bit 13
1330#define reg_iop_sw_cpu_r_masked_intr2___spu0_6___lsb 14
1331#define reg_iop_sw_cpu_r_masked_intr2___spu0_6___width 1
1332#define reg_iop_sw_cpu_r_masked_intr2___spu0_6___bit 14
1333#define reg_iop_sw_cpu_r_masked_intr2___spu0_7___lsb 15
1334#define reg_iop_sw_cpu_r_masked_intr2___spu0_7___width 1
1335#define reg_iop_sw_cpu_r_masked_intr2___spu0_7___bit 15
1336#define reg_iop_sw_cpu_r_masked_intr2___dmc_in0___lsb 16
1337#define reg_iop_sw_cpu_r_masked_intr2___dmc_in0___width 1
1338#define reg_iop_sw_cpu_r_masked_intr2___dmc_in0___bit 16
1339#define reg_iop_sw_cpu_r_masked_intr2___dmc_out0___lsb 17
1340#define reg_iop_sw_cpu_r_masked_intr2___dmc_out0___width 1
1341#define reg_iop_sw_cpu_r_masked_intr2___dmc_out0___bit 17
1342#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0___lsb 18
1343#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0___width 1
1344#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0___bit 18
1345#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0___lsb 19
1346#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0___width 1
1347#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0___bit 19
1348#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0_extra___lsb 20
1349#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0_extra___width 1
1350#define reg_iop_sw_cpu_r_masked_intr2___fifo_in0_extra___bit 20
1351#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0_extra___lsb 21
1352#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0_extra___width 1
1353#define reg_iop_sw_cpu_r_masked_intr2___fifo_out0_extra___bit 21
1354#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp0___lsb 22
1355#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp0___width 1
1356#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp0___bit 22
1357#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp1___lsb 23
1358#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp1___width 1
1359#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp1___bit 23
1360#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp2___lsb 24
1361#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp2___width 1
1362#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp2___bit 24
1363#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp3___lsb 25
1364#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp3___width 1
1365#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp3___bit 25
1366#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp4___lsb 26
1367#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp4___width 1
1368#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp4___bit 26
1369#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp5___lsb 27
1370#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp5___width 1
1371#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp5___bit 27
1372#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp6___lsb 28
1373#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp6___width 1
1374#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp6___bit 28
1375#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp7___lsb 29
1376#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp7___width 1
1377#define reg_iop_sw_cpu_r_masked_intr2___trigger_grp7___bit 29
1378#define reg_iop_sw_cpu_r_masked_intr2___timer_grp0___lsb 30
1379#define reg_iop_sw_cpu_r_masked_intr2___timer_grp0___width 1
1380#define reg_iop_sw_cpu_r_masked_intr2___timer_grp0___bit 30
1381#define reg_iop_sw_cpu_r_masked_intr2___timer_grp1___lsb 31
1382#define reg_iop_sw_cpu_r_masked_intr2___timer_grp1___width 1
1383#define reg_iop_sw_cpu_r_masked_intr2___timer_grp1___bit 31
1384#define reg_iop_sw_cpu_r_masked_intr2_offset 128
1385
1386/* Register rw_intr3_mask, scope iop_sw_cpu, type rw */
1387#define reg_iop_sw_cpu_rw_intr3_mask___mpu_16___lsb 0
1388#define reg_iop_sw_cpu_rw_intr3_mask___mpu_16___width 1
1389#define reg_iop_sw_cpu_rw_intr3_mask___mpu_16___bit 0
1390#define reg_iop_sw_cpu_rw_intr3_mask___mpu_17___lsb 1
1391#define reg_iop_sw_cpu_rw_intr3_mask___mpu_17___width 1
1392#define reg_iop_sw_cpu_rw_intr3_mask___mpu_17___bit 1
1393#define reg_iop_sw_cpu_rw_intr3_mask___mpu_18___lsb 2
1394#define reg_iop_sw_cpu_rw_intr3_mask___mpu_18___width 1
1395#define reg_iop_sw_cpu_rw_intr3_mask___mpu_18___bit 2
1396#define reg_iop_sw_cpu_rw_intr3_mask___mpu_19___lsb 3
1397#define reg_iop_sw_cpu_rw_intr3_mask___mpu_19___width 1
1398#define reg_iop_sw_cpu_rw_intr3_mask___mpu_19___bit 3
1399#define reg_iop_sw_cpu_rw_intr3_mask___mpu_20___lsb 4
1400#define reg_iop_sw_cpu_rw_intr3_mask___mpu_20___width 1
1401#define reg_iop_sw_cpu_rw_intr3_mask___mpu_20___bit 4
1402#define reg_iop_sw_cpu_rw_intr3_mask___mpu_21___lsb 5
1403#define reg_iop_sw_cpu_rw_intr3_mask___mpu_21___width 1
1404#define reg_iop_sw_cpu_rw_intr3_mask___mpu_21___bit 5
1405#define reg_iop_sw_cpu_rw_intr3_mask___mpu_22___lsb 6
1406#define reg_iop_sw_cpu_rw_intr3_mask___mpu_22___width 1
1407#define reg_iop_sw_cpu_rw_intr3_mask___mpu_22___bit 6
1408#define reg_iop_sw_cpu_rw_intr3_mask___mpu_23___lsb 7
1409#define reg_iop_sw_cpu_rw_intr3_mask___mpu_23___width 1
1410#define reg_iop_sw_cpu_rw_intr3_mask___mpu_23___bit 7
1411#define reg_iop_sw_cpu_rw_intr3_mask___spu1_0___lsb 8
1412#define reg_iop_sw_cpu_rw_intr3_mask___spu1_0___width 1
1413#define reg_iop_sw_cpu_rw_intr3_mask___spu1_0___bit 8
1414#define reg_iop_sw_cpu_rw_intr3_mask___spu1_1___lsb 9
1415#define reg_iop_sw_cpu_rw_intr3_mask___spu1_1___width 1
1416#define reg_iop_sw_cpu_rw_intr3_mask___spu1_1___bit 9
1417#define reg_iop_sw_cpu_rw_intr3_mask___spu1_2___lsb 10
1418#define reg_iop_sw_cpu_rw_intr3_mask___spu1_2___width 1
1419#define reg_iop_sw_cpu_rw_intr3_mask___spu1_2___bit 10
1420#define reg_iop_sw_cpu_rw_intr3_mask___spu1_3___lsb 11
1421#define reg_iop_sw_cpu_rw_intr3_mask___spu1_3___width 1
1422#define reg_iop_sw_cpu_rw_intr3_mask___spu1_3___bit 11
1423#define reg_iop_sw_cpu_rw_intr3_mask___spu1_4___lsb 12
1424#define reg_iop_sw_cpu_rw_intr3_mask___spu1_4___width 1
1425#define reg_iop_sw_cpu_rw_intr3_mask___spu1_4___bit 12
1426#define reg_iop_sw_cpu_rw_intr3_mask___spu1_5___lsb 13
1427#define reg_iop_sw_cpu_rw_intr3_mask___spu1_5___width 1
1428#define reg_iop_sw_cpu_rw_intr3_mask___spu1_5___bit 13
1429#define reg_iop_sw_cpu_rw_intr3_mask___spu1_6___lsb 14
1430#define reg_iop_sw_cpu_rw_intr3_mask___spu1_6___width 1
1431#define reg_iop_sw_cpu_rw_intr3_mask___spu1_6___bit 14
1432#define reg_iop_sw_cpu_rw_intr3_mask___spu1_7___lsb 15
1433#define reg_iop_sw_cpu_rw_intr3_mask___spu1_7___width 1
1434#define reg_iop_sw_cpu_rw_intr3_mask___spu1_7___bit 15
1435#define reg_iop_sw_cpu_rw_intr3_mask___dmc_in1___lsb 16
1436#define reg_iop_sw_cpu_rw_intr3_mask___dmc_in1___width 1
1437#define reg_iop_sw_cpu_rw_intr3_mask___dmc_in1___bit 16
1438#define reg_iop_sw_cpu_rw_intr3_mask___dmc_out1___lsb 17
1439#define reg_iop_sw_cpu_rw_intr3_mask___dmc_out1___width 1
1440#define reg_iop_sw_cpu_rw_intr3_mask___dmc_out1___bit 17
1441#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1___lsb 18
1442#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1___width 1
1443#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1___bit 18
1444#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1___lsb 19
1445#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1___width 1
1446#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1___bit 19
1447#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1_extra___lsb 20
1448#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1_extra___width 1
1449#define reg_iop_sw_cpu_rw_intr3_mask___fifo_in1_extra___bit 20
1450#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1_extra___lsb 21
1451#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1_extra___width 1
1452#define reg_iop_sw_cpu_rw_intr3_mask___fifo_out1_extra___bit 21
1453#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp0___lsb 22
1454#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp0___width 1
1455#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp0___bit 22
1456#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp1___lsb 23
1457#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp1___width 1
1458#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp1___bit 23
1459#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp2___lsb 24
1460#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp2___width 1
1461#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp2___bit 24
1462#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp3___lsb 25
1463#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp3___width 1
1464#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp3___bit 25
1465#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp4___lsb 26
1466#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp4___width 1
1467#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp4___bit 26
1468#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp5___lsb 27
1469#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp5___width 1
1470#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp5___bit 27
1471#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp6___lsb 28
1472#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp6___width 1
1473#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp6___bit 28
1474#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp7___lsb 29
1475#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp7___width 1
1476#define reg_iop_sw_cpu_rw_intr3_mask___trigger_grp7___bit 29
1477#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp2___lsb 30
1478#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp2___width 1
1479#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp2___bit 30
1480#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp3___lsb 31
1481#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp3___width 1
1482#define reg_iop_sw_cpu_rw_intr3_mask___timer_grp3___bit 31
1483#define reg_iop_sw_cpu_rw_intr3_mask_offset 132
1484
1485/* Register rw_ack_intr3, scope iop_sw_cpu, type rw */
1486#define reg_iop_sw_cpu_rw_ack_intr3___mpu_16___lsb 0
1487#define reg_iop_sw_cpu_rw_ack_intr3___mpu_16___width 1
1488#define reg_iop_sw_cpu_rw_ack_intr3___mpu_16___bit 0
1489#define reg_iop_sw_cpu_rw_ack_intr3___mpu_17___lsb 1
1490#define reg_iop_sw_cpu_rw_ack_intr3___mpu_17___width 1
1491#define reg_iop_sw_cpu_rw_ack_intr3___mpu_17___bit 1
1492#define reg_iop_sw_cpu_rw_ack_intr3___mpu_18___lsb 2
1493#define reg_iop_sw_cpu_rw_ack_intr3___mpu_18___width 1
1494#define reg_iop_sw_cpu_rw_ack_intr3___mpu_18___bit 2
1495#define reg_iop_sw_cpu_rw_ack_intr3___mpu_19___lsb 3
1496#define reg_iop_sw_cpu_rw_ack_intr3___mpu_19___width 1
1497#define reg_iop_sw_cpu_rw_ack_intr3___mpu_19___bit 3
1498#define reg_iop_sw_cpu_rw_ack_intr3___mpu_20___lsb 4
1499#define reg_iop_sw_cpu_rw_ack_intr3___mpu_20___width 1
1500#define reg_iop_sw_cpu_rw_ack_intr3___mpu_20___bit 4
1501#define reg_iop_sw_cpu_rw_ack_intr3___mpu_21___lsb 5
1502#define reg_iop_sw_cpu_rw_ack_intr3___mpu_21___width 1
1503#define reg_iop_sw_cpu_rw_ack_intr3___mpu_21___bit 5
1504#define reg_iop_sw_cpu_rw_ack_intr3___mpu_22___lsb 6
1505#define reg_iop_sw_cpu_rw_ack_intr3___mpu_22___width 1
1506#define reg_iop_sw_cpu_rw_ack_intr3___mpu_22___bit 6
1507#define reg_iop_sw_cpu_rw_ack_intr3___mpu_23___lsb 7
1508#define reg_iop_sw_cpu_rw_ack_intr3___mpu_23___width 1
1509#define reg_iop_sw_cpu_rw_ack_intr3___mpu_23___bit 7
1510#define reg_iop_sw_cpu_rw_ack_intr3___spu1_0___lsb 8
1511#define reg_iop_sw_cpu_rw_ack_intr3___spu1_0___width 1
1512#define reg_iop_sw_cpu_rw_ack_intr3___spu1_0___bit 8
1513#define reg_iop_sw_cpu_rw_ack_intr3___spu1_1___lsb 9
1514#define reg_iop_sw_cpu_rw_ack_intr3___spu1_1___width 1
1515#define reg_iop_sw_cpu_rw_ack_intr3___spu1_1___bit 9
1516#define reg_iop_sw_cpu_rw_ack_intr3___spu1_2___lsb 10
1517#define reg_iop_sw_cpu_rw_ack_intr3___spu1_2___width 1
1518#define reg_iop_sw_cpu_rw_ack_intr3___spu1_2___bit 10
1519#define reg_iop_sw_cpu_rw_ack_intr3___spu1_3___lsb 11
1520#define reg_iop_sw_cpu_rw_ack_intr3___spu1_3___width 1
1521#define reg_iop_sw_cpu_rw_ack_intr3___spu1_3___bit 11
1522#define reg_iop_sw_cpu_rw_ack_intr3___spu1_4___lsb 12
1523#define reg_iop_sw_cpu_rw_ack_intr3___spu1_4___width 1
1524#define reg_iop_sw_cpu_rw_ack_intr3___spu1_4___bit 12
1525#define reg_iop_sw_cpu_rw_ack_intr3___spu1_5___lsb 13
1526#define reg_iop_sw_cpu_rw_ack_intr3___spu1_5___width 1
1527#define reg_iop_sw_cpu_rw_ack_intr3___spu1_5___bit 13
1528#define reg_iop_sw_cpu_rw_ack_intr3___spu1_6___lsb 14
1529#define reg_iop_sw_cpu_rw_ack_intr3___spu1_6___width 1
1530#define reg_iop_sw_cpu_rw_ack_intr3___spu1_6___bit 14
1531#define reg_iop_sw_cpu_rw_ack_intr3___spu1_7___lsb 15
1532#define reg_iop_sw_cpu_rw_ack_intr3___spu1_7___width 1
1533#define reg_iop_sw_cpu_rw_ack_intr3___spu1_7___bit 15
1534#define reg_iop_sw_cpu_rw_ack_intr3_offset 136
1535
1536/* Register r_intr3, scope iop_sw_cpu, type r */
1537#define reg_iop_sw_cpu_r_intr3___mpu_16___lsb 0
1538#define reg_iop_sw_cpu_r_intr3___mpu_16___width 1
1539#define reg_iop_sw_cpu_r_intr3___mpu_16___bit 0
1540#define reg_iop_sw_cpu_r_intr3___mpu_17___lsb 1
1541#define reg_iop_sw_cpu_r_intr3___mpu_17___width 1
1542#define reg_iop_sw_cpu_r_intr3___mpu_17___bit 1
1543#define reg_iop_sw_cpu_r_intr3___mpu_18___lsb 2
1544#define reg_iop_sw_cpu_r_intr3___mpu_18___width 1
1545#define reg_iop_sw_cpu_r_intr3___mpu_18___bit 2
1546#define reg_iop_sw_cpu_r_intr3___mpu_19___lsb 3
1547#define reg_iop_sw_cpu_r_intr3___mpu_19___width 1
1548#define reg_iop_sw_cpu_r_intr3___mpu_19___bit 3
1549#define reg_iop_sw_cpu_r_intr3___mpu_20___lsb 4
1550#define reg_iop_sw_cpu_r_intr3___mpu_20___width 1
1551#define reg_iop_sw_cpu_r_intr3___mpu_20___bit 4
1552#define reg_iop_sw_cpu_r_intr3___mpu_21___lsb 5
1553#define reg_iop_sw_cpu_r_intr3___mpu_21___width 1
1554#define reg_iop_sw_cpu_r_intr3___mpu_21___bit 5
1555#define reg_iop_sw_cpu_r_intr3___mpu_22___lsb 6
1556#define reg_iop_sw_cpu_r_intr3___mpu_22___width 1
1557#define reg_iop_sw_cpu_r_intr3___mpu_22___bit 6
1558#define reg_iop_sw_cpu_r_intr3___mpu_23___lsb 7
1559#define reg_iop_sw_cpu_r_intr3___mpu_23___width 1
1560#define reg_iop_sw_cpu_r_intr3___mpu_23___bit 7
1561#define reg_iop_sw_cpu_r_intr3___spu1_0___lsb 8
1562#define reg_iop_sw_cpu_r_intr3___spu1_0___width 1
1563#define reg_iop_sw_cpu_r_intr3___spu1_0___bit 8
1564#define reg_iop_sw_cpu_r_intr3___spu1_1___lsb 9
1565#define reg_iop_sw_cpu_r_intr3___spu1_1___width 1
1566#define reg_iop_sw_cpu_r_intr3___spu1_1___bit 9
1567#define reg_iop_sw_cpu_r_intr3___spu1_2___lsb 10
1568#define reg_iop_sw_cpu_r_intr3___spu1_2___width 1
1569#define reg_iop_sw_cpu_r_intr3___spu1_2___bit 10
1570#define reg_iop_sw_cpu_r_intr3___spu1_3___lsb 11
1571#define reg_iop_sw_cpu_r_intr3___spu1_3___width 1
1572#define reg_iop_sw_cpu_r_intr3___spu1_3___bit 11
1573#define reg_iop_sw_cpu_r_intr3___spu1_4___lsb 12
1574#define reg_iop_sw_cpu_r_intr3___spu1_4___width 1
1575#define reg_iop_sw_cpu_r_intr3___spu1_4___bit 12
1576#define reg_iop_sw_cpu_r_intr3___spu1_5___lsb 13
1577#define reg_iop_sw_cpu_r_intr3___spu1_5___width 1
1578#define reg_iop_sw_cpu_r_intr3___spu1_5___bit 13
1579#define reg_iop_sw_cpu_r_intr3___spu1_6___lsb 14
1580#define reg_iop_sw_cpu_r_intr3___spu1_6___width 1
1581#define reg_iop_sw_cpu_r_intr3___spu1_6___bit 14
1582#define reg_iop_sw_cpu_r_intr3___spu1_7___lsb 15
1583#define reg_iop_sw_cpu_r_intr3___spu1_7___width 1
1584#define reg_iop_sw_cpu_r_intr3___spu1_7___bit 15
1585#define reg_iop_sw_cpu_r_intr3___dmc_in1___lsb 16
1586#define reg_iop_sw_cpu_r_intr3___dmc_in1___width 1
1587#define reg_iop_sw_cpu_r_intr3___dmc_in1___bit 16
1588#define reg_iop_sw_cpu_r_intr3___dmc_out1___lsb 17
1589#define reg_iop_sw_cpu_r_intr3___dmc_out1___width 1
1590#define reg_iop_sw_cpu_r_intr3___dmc_out1___bit 17
1591#define reg_iop_sw_cpu_r_intr3___fifo_in1___lsb 18
1592#define reg_iop_sw_cpu_r_intr3___fifo_in1___width 1
1593#define reg_iop_sw_cpu_r_intr3___fifo_in1___bit 18
1594#define reg_iop_sw_cpu_r_intr3___fifo_out1___lsb 19
1595#define reg_iop_sw_cpu_r_intr3___fifo_out1___width 1
1596#define reg_iop_sw_cpu_r_intr3___fifo_out1___bit 19
1597#define reg_iop_sw_cpu_r_intr3___fifo_in1_extra___lsb 20
1598#define reg_iop_sw_cpu_r_intr3___fifo_in1_extra___width 1
1599#define reg_iop_sw_cpu_r_intr3___fifo_in1_extra___bit 20
1600#define reg_iop_sw_cpu_r_intr3___fifo_out1_extra___lsb 21
1601#define reg_iop_sw_cpu_r_intr3___fifo_out1_extra___width 1
1602#define reg_iop_sw_cpu_r_intr3___fifo_out1_extra___bit 21
1603#define reg_iop_sw_cpu_r_intr3___trigger_grp0___lsb 22
1604#define reg_iop_sw_cpu_r_intr3___trigger_grp0___width 1
1605#define reg_iop_sw_cpu_r_intr3___trigger_grp0___bit 22
1606#define reg_iop_sw_cpu_r_intr3___trigger_grp1___lsb 23
1607#define reg_iop_sw_cpu_r_intr3___trigger_grp1___width 1
1608#define reg_iop_sw_cpu_r_intr3___trigger_grp1___bit 23
1609#define reg_iop_sw_cpu_r_intr3___trigger_grp2___lsb 24
1610#define reg_iop_sw_cpu_r_intr3___trigger_grp2___width 1
1611#define reg_iop_sw_cpu_r_intr3___trigger_grp2___bit 24
1612#define reg_iop_sw_cpu_r_intr3___trigger_grp3___lsb 25
1613#define reg_iop_sw_cpu_r_intr3___trigger_grp3___width 1
1614#define reg_iop_sw_cpu_r_intr3___trigger_grp3___bit 25
1615#define reg_iop_sw_cpu_r_intr3___trigger_grp4___lsb 26
1616#define reg_iop_sw_cpu_r_intr3___trigger_grp4___width 1
1617#define reg_iop_sw_cpu_r_intr3___trigger_grp4___bit 26
1618#define reg_iop_sw_cpu_r_intr3___trigger_grp5___lsb 27
1619#define reg_iop_sw_cpu_r_intr3___trigger_grp5___width 1
1620#define reg_iop_sw_cpu_r_intr3___trigger_grp5___bit 27
1621#define reg_iop_sw_cpu_r_intr3___trigger_grp6___lsb 28
1622#define reg_iop_sw_cpu_r_intr3___trigger_grp6___width 1
1623#define reg_iop_sw_cpu_r_intr3___trigger_grp6___bit 28
1624#define reg_iop_sw_cpu_r_intr3___trigger_grp7___lsb 29
1625#define reg_iop_sw_cpu_r_intr3___trigger_grp7___width 1
1626#define reg_iop_sw_cpu_r_intr3___trigger_grp7___bit 29
1627#define reg_iop_sw_cpu_r_intr3___timer_grp2___lsb 30
1628#define reg_iop_sw_cpu_r_intr3___timer_grp2___width 1
1629#define reg_iop_sw_cpu_r_intr3___timer_grp2___bit 30
1630#define reg_iop_sw_cpu_r_intr3___timer_grp3___lsb 31
1631#define reg_iop_sw_cpu_r_intr3___timer_grp3___width 1
1632#define reg_iop_sw_cpu_r_intr3___timer_grp3___bit 31
1633#define reg_iop_sw_cpu_r_intr3_offset 140
1634
1635/* Register r_masked_intr3, scope iop_sw_cpu, type r */
1636#define reg_iop_sw_cpu_r_masked_intr3___mpu_16___lsb 0
1637#define reg_iop_sw_cpu_r_masked_intr3___mpu_16___width 1
1638#define reg_iop_sw_cpu_r_masked_intr3___mpu_16___bit 0
1639#define reg_iop_sw_cpu_r_masked_intr3___mpu_17___lsb 1
1640#define reg_iop_sw_cpu_r_masked_intr3___mpu_17___width 1
1641#define reg_iop_sw_cpu_r_masked_intr3___mpu_17___bit 1
1642#define reg_iop_sw_cpu_r_masked_intr3___mpu_18___lsb 2
1643#define reg_iop_sw_cpu_r_masked_intr3___mpu_18___width 1
1644#define reg_iop_sw_cpu_r_masked_intr3___mpu_18___bit 2
1645#define reg_iop_sw_cpu_r_masked_intr3___mpu_19___lsb 3
1646#define reg_iop_sw_cpu_r_masked_intr3___mpu_19___width 1
1647#define reg_iop_sw_cpu_r_masked_intr3___mpu_19___bit 3
1648#define reg_iop_sw_cpu_r_masked_intr3___mpu_20___lsb 4
1649#define reg_iop_sw_cpu_r_masked_intr3___mpu_20___width 1
1650#define reg_iop_sw_cpu_r_masked_intr3___mpu_20___bit 4
1651#define reg_iop_sw_cpu_r_masked_intr3___mpu_21___lsb 5
1652#define reg_iop_sw_cpu_r_masked_intr3___mpu_21___width 1
1653#define reg_iop_sw_cpu_r_masked_intr3___mpu_21___bit 5
1654#define reg_iop_sw_cpu_r_masked_intr3___mpu_22___lsb 6
1655#define reg_iop_sw_cpu_r_masked_intr3___mpu_22___width 1
1656#define reg_iop_sw_cpu_r_masked_intr3___mpu_22___bit 6
1657#define reg_iop_sw_cpu_r_masked_intr3___mpu_23___lsb 7
1658#define reg_iop_sw_cpu_r_masked_intr3___mpu_23___width 1
1659#define reg_iop_sw_cpu_r_masked_intr3___mpu_23___bit 7
1660#define reg_iop_sw_cpu_r_masked_intr3___spu1_0___lsb 8
1661#define reg_iop_sw_cpu_r_masked_intr3___spu1_0___width 1
1662#define reg_iop_sw_cpu_r_masked_intr3___spu1_0___bit 8
1663#define reg_iop_sw_cpu_r_masked_intr3___spu1_1___lsb 9
1664#define reg_iop_sw_cpu_r_masked_intr3___spu1_1___width 1
1665#define reg_iop_sw_cpu_r_masked_intr3___spu1_1___bit 9
1666#define reg_iop_sw_cpu_r_masked_intr3___spu1_2___lsb 10
1667#define reg_iop_sw_cpu_r_masked_intr3___spu1_2___width 1
1668#define reg_iop_sw_cpu_r_masked_intr3___spu1_2___bit 10
1669#define reg_iop_sw_cpu_r_masked_intr3___spu1_3___lsb 11
1670#define reg_iop_sw_cpu_r_masked_intr3___spu1_3___width 1
1671#define reg_iop_sw_cpu_r_masked_intr3___spu1_3___bit 11
1672#define reg_iop_sw_cpu_r_masked_intr3___spu1_4___lsb 12
1673#define reg_iop_sw_cpu_r_masked_intr3___spu1_4___width 1
1674#define reg_iop_sw_cpu_r_masked_intr3___spu1_4___bit 12
1675#define reg_iop_sw_cpu_r_masked_intr3___spu1_5___lsb 13
1676#define reg_iop_sw_cpu_r_masked_intr3___spu1_5___width 1
1677#define reg_iop_sw_cpu_r_masked_intr3___spu1_5___bit 13
1678#define reg_iop_sw_cpu_r_masked_intr3___spu1_6___lsb 14
1679#define reg_iop_sw_cpu_r_masked_intr3___spu1_6___width 1
1680#define reg_iop_sw_cpu_r_masked_intr3___spu1_6___bit 14
1681#define reg_iop_sw_cpu_r_masked_intr3___spu1_7___lsb 15
1682#define reg_iop_sw_cpu_r_masked_intr3___spu1_7___width 1
1683#define reg_iop_sw_cpu_r_masked_intr3___spu1_7___bit 15
1684#define reg_iop_sw_cpu_r_masked_intr3___dmc_in1___lsb 16
1685#define reg_iop_sw_cpu_r_masked_intr3___dmc_in1___width 1
1686#define reg_iop_sw_cpu_r_masked_intr3___dmc_in1___bit 16
1687#define reg_iop_sw_cpu_r_masked_intr3___dmc_out1___lsb 17
1688#define reg_iop_sw_cpu_r_masked_intr3___dmc_out1___width 1
1689#define reg_iop_sw_cpu_r_masked_intr3___dmc_out1___bit 17
1690#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1___lsb 18
1691#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1___width 1
1692#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1___bit 18
1693#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1___lsb 19
1694#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1___width 1
1695#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1___bit 19
1696#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1_extra___lsb 20
1697#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1_extra___width 1
1698#define reg_iop_sw_cpu_r_masked_intr3___fifo_in1_extra___bit 20
1699#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1_extra___lsb 21
1700#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1_extra___width 1
1701#define reg_iop_sw_cpu_r_masked_intr3___fifo_out1_extra___bit 21
1702#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp0___lsb 22
1703#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp0___width 1
1704#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp0___bit 22
1705#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp1___lsb 23
1706#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp1___width 1
1707#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp1___bit 23
1708#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp2___lsb 24
1709#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp2___width 1
1710#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp2___bit 24
1711#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp3___lsb 25
1712#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp3___width 1
1713#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp3___bit 25
1714#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp4___lsb 26
1715#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp4___width 1
1716#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp4___bit 26
1717#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp5___lsb 27
1718#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp5___width 1
1719#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp5___bit 27
1720#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp6___lsb 28
1721#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp6___width 1
1722#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp6___bit 28
1723#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp7___lsb 29
1724#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp7___width 1
1725#define reg_iop_sw_cpu_r_masked_intr3___trigger_grp7___bit 29
1726#define reg_iop_sw_cpu_r_masked_intr3___timer_grp2___lsb 30
1727#define reg_iop_sw_cpu_r_masked_intr3___timer_grp2___width 1
1728#define reg_iop_sw_cpu_r_masked_intr3___timer_grp2___bit 30
1729#define reg_iop_sw_cpu_r_masked_intr3___timer_grp3___lsb 31
1730#define reg_iop_sw_cpu_r_masked_intr3___timer_grp3___width 1
1731#define reg_iop_sw_cpu_r_masked_intr3___timer_grp3___bit 31
1732#define reg_iop_sw_cpu_r_masked_intr3_offset 144
1733
1734
1735/* Constants */
1736#define regk_iop_sw_cpu_copy 0x00000000
1737#define regk_iop_sw_cpu_no 0x00000000
1738#define regk_iop_sw_cpu_rd 0x00000002
1739#define regk_iop_sw_cpu_reg_copy 0x00000001
1740#define regk_iop_sw_cpu_rw_bus0_clr_mask_default 0x00000000
1741#define regk_iop_sw_cpu_rw_bus0_oe_clr_mask_default 0x00000000
1742#define regk_iop_sw_cpu_rw_bus0_oe_set_mask_default 0x00000000
1743#define regk_iop_sw_cpu_rw_bus0_set_mask_default 0x00000000
1744#define regk_iop_sw_cpu_rw_bus1_clr_mask_default 0x00000000
1745#define regk_iop_sw_cpu_rw_bus1_oe_clr_mask_default 0x00000000
1746#define regk_iop_sw_cpu_rw_bus1_oe_set_mask_default 0x00000000
1747#define regk_iop_sw_cpu_rw_bus1_set_mask_default 0x00000000
1748#define regk_iop_sw_cpu_rw_gio_clr_mask_default 0x00000000
1749#define regk_iop_sw_cpu_rw_gio_oe_clr_mask_default 0x00000000
1750#define regk_iop_sw_cpu_rw_gio_oe_set_mask_default 0x00000000
1751#define regk_iop_sw_cpu_rw_gio_set_mask_default 0x00000000
1752#define regk_iop_sw_cpu_rw_intr0_mask_default 0x00000000
1753#define regk_iop_sw_cpu_rw_intr1_mask_default 0x00000000
1754#define regk_iop_sw_cpu_rw_intr2_mask_default 0x00000000
1755#define regk_iop_sw_cpu_rw_intr3_mask_default 0x00000000
1756#define regk_iop_sw_cpu_wr 0x00000003
1757#define regk_iop_sw_cpu_yes 0x00000001
1758#endif /* __iop_sw_cpu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_mpu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_mpu_defs_asm.h
new file mode 100644
index 000000000000..ee7dc0435b59
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_mpu_defs_asm.h
@@ -0,0 +1,1776 @@
1#ifndef __iop_sw_mpu_defs_asm_h
2#define __iop_sw_mpu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_mpu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sw_mpu_defs_asm.h ../../inst/io_proc/rtl/guinness/iop_sw_mpu.r
11 * id: $Id: iop_sw_mpu_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_sw_cfg_owner, scope iop_sw_mpu, type rw */
57#define reg_iop_sw_mpu_rw_sw_cfg_owner___cfg___lsb 0
58#define reg_iop_sw_mpu_rw_sw_cfg_owner___cfg___width 2
59#define reg_iop_sw_mpu_rw_sw_cfg_owner_offset 0
60
61/* Register rw_mc_ctrl, scope iop_sw_mpu, type rw */
62#define reg_iop_sw_mpu_rw_mc_ctrl___keep_owner___lsb 0
63#define reg_iop_sw_mpu_rw_mc_ctrl___keep_owner___width 1
64#define reg_iop_sw_mpu_rw_mc_ctrl___keep_owner___bit 0
65#define reg_iop_sw_mpu_rw_mc_ctrl___cmd___lsb 1
66#define reg_iop_sw_mpu_rw_mc_ctrl___cmd___width 2
67#define reg_iop_sw_mpu_rw_mc_ctrl___size___lsb 3
68#define reg_iop_sw_mpu_rw_mc_ctrl___size___width 3
69#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu0_mem___lsb 6
70#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu0_mem___width 1
71#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu0_mem___bit 6
72#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu1_mem___lsb 7
73#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu1_mem___width 1
74#define reg_iop_sw_mpu_rw_mc_ctrl___wr_spu1_mem___bit 7
75#define reg_iop_sw_mpu_rw_mc_ctrl_offset 4
76
77/* Register rw_mc_data, scope iop_sw_mpu, type rw */
78#define reg_iop_sw_mpu_rw_mc_data___val___lsb 0
79#define reg_iop_sw_mpu_rw_mc_data___val___width 32
80#define reg_iop_sw_mpu_rw_mc_data_offset 8
81
82/* Register rw_mc_addr, scope iop_sw_mpu, type rw */
83#define reg_iop_sw_mpu_rw_mc_addr_offset 12
84
85/* Register rs_mc_data, scope iop_sw_mpu, type rs */
86#define reg_iop_sw_mpu_rs_mc_data_offset 16
87
88/* Register r_mc_data, scope iop_sw_mpu, type r */
89#define reg_iop_sw_mpu_r_mc_data_offset 20
90
91/* Register r_mc_stat, scope iop_sw_mpu, type r */
92#define reg_iop_sw_mpu_r_mc_stat___busy_cpu___lsb 0
93#define reg_iop_sw_mpu_r_mc_stat___busy_cpu___width 1
94#define reg_iop_sw_mpu_r_mc_stat___busy_cpu___bit 0
95#define reg_iop_sw_mpu_r_mc_stat___busy_mpu___lsb 1
96#define reg_iop_sw_mpu_r_mc_stat___busy_mpu___width 1
97#define reg_iop_sw_mpu_r_mc_stat___busy_mpu___bit 1
98#define reg_iop_sw_mpu_r_mc_stat___busy_spu0___lsb 2
99#define reg_iop_sw_mpu_r_mc_stat___busy_spu0___width 1
100#define reg_iop_sw_mpu_r_mc_stat___busy_spu0___bit 2
101#define reg_iop_sw_mpu_r_mc_stat___busy_spu1___lsb 3
102#define reg_iop_sw_mpu_r_mc_stat___busy_spu1___width 1
103#define reg_iop_sw_mpu_r_mc_stat___busy_spu1___bit 3
104#define reg_iop_sw_mpu_r_mc_stat___owned_by_cpu___lsb 4
105#define reg_iop_sw_mpu_r_mc_stat___owned_by_cpu___width 1
106#define reg_iop_sw_mpu_r_mc_stat___owned_by_cpu___bit 4
107#define reg_iop_sw_mpu_r_mc_stat___owned_by_mpu___lsb 5
108#define reg_iop_sw_mpu_r_mc_stat___owned_by_mpu___width 1
109#define reg_iop_sw_mpu_r_mc_stat___owned_by_mpu___bit 5
110#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu0___lsb 6
111#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu0___width 1
112#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu0___bit 6
113#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu1___lsb 7
114#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu1___width 1
115#define reg_iop_sw_mpu_r_mc_stat___owned_by_spu1___bit 7
116#define reg_iop_sw_mpu_r_mc_stat_offset 24
117
118/* Register rw_bus0_clr_mask, scope iop_sw_mpu, type rw */
119#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte0___lsb 0
120#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte0___width 8
121#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte1___lsb 8
122#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte1___width 8
123#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte2___lsb 16
124#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte2___width 8
125#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte3___lsb 24
126#define reg_iop_sw_mpu_rw_bus0_clr_mask___byte3___width 8
127#define reg_iop_sw_mpu_rw_bus0_clr_mask_offset 28
128
129/* Register rw_bus0_set_mask, scope iop_sw_mpu, type rw */
130#define reg_iop_sw_mpu_rw_bus0_set_mask___byte0___lsb 0
131#define reg_iop_sw_mpu_rw_bus0_set_mask___byte0___width 8
132#define reg_iop_sw_mpu_rw_bus0_set_mask___byte1___lsb 8
133#define reg_iop_sw_mpu_rw_bus0_set_mask___byte1___width 8
134#define reg_iop_sw_mpu_rw_bus0_set_mask___byte2___lsb 16
135#define reg_iop_sw_mpu_rw_bus0_set_mask___byte2___width 8
136#define reg_iop_sw_mpu_rw_bus0_set_mask___byte3___lsb 24
137#define reg_iop_sw_mpu_rw_bus0_set_mask___byte3___width 8
138#define reg_iop_sw_mpu_rw_bus0_set_mask_offset 32
139
140/* Register rw_bus0_oe_clr_mask, scope iop_sw_mpu, type rw */
141#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte0___lsb 0
142#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte0___width 1
143#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte0___bit 0
144#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte1___lsb 1
145#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte1___width 1
146#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte1___bit 1
147#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte2___lsb 2
148#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte2___width 1
149#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte2___bit 2
150#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte3___lsb 3
151#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte3___width 1
152#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask___byte3___bit 3
153#define reg_iop_sw_mpu_rw_bus0_oe_clr_mask_offset 36
154
155/* Register rw_bus0_oe_set_mask, scope iop_sw_mpu, type rw */
156#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte0___lsb 0
157#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte0___width 1
158#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte0___bit 0
159#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte1___lsb 1
160#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte1___width 1
161#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte1___bit 1
162#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte2___lsb 2
163#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte2___width 1
164#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte2___bit 2
165#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte3___lsb 3
166#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte3___width 1
167#define reg_iop_sw_mpu_rw_bus0_oe_set_mask___byte3___bit 3
168#define reg_iop_sw_mpu_rw_bus0_oe_set_mask_offset 40
169
170/* Register r_bus0_in, scope iop_sw_mpu, type r */
171#define reg_iop_sw_mpu_r_bus0_in_offset 44
172
173/* Register rw_bus1_clr_mask, scope iop_sw_mpu, type rw */
174#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte0___lsb 0
175#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte0___width 8
176#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte1___lsb 8
177#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte1___width 8
178#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte2___lsb 16
179#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte2___width 8
180#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte3___lsb 24
181#define reg_iop_sw_mpu_rw_bus1_clr_mask___byte3___width 8
182#define reg_iop_sw_mpu_rw_bus1_clr_mask_offset 48
183
184/* Register rw_bus1_set_mask, scope iop_sw_mpu, type rw */
185#define reg_iop_sw_mpu_rw_bus1_set_mask___byte0___lsb 0
186#define reg_iop_sw_mpu_rw_bus1_set_mask___byte0___width 8
187#define reg_iop_sw_mpu_rw_bus1_set_mask___byte1___lsb 8
188#define reg_iop_sw_mpu_rw_bus1_set_mask___byte1___width 8
189#define reg_iop_sw_mpu_rw_bus1_set_mask___byte2___lsb 16
190#define reg_iop_sw_mpu_rw_bus1_set_mask___byte2___width 8
191#define reg_iop_sw_mpu_rw_bus1_set_mask___byte3___lsb 24
192#define reg_iop_sw_mpu_rw_bus1_set_mask___byte3___width 8
193#define reg_iop_sw_mpu_rw_bus1_set_mask_offset 52
194
195/* Register rw_bus1_oe_clr_mask, scope iop_sw_mpu, type rw */
196#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte0___lsb 0
197#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte0___width 1
198#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte0___bit 0
199#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte1___lsb 1
200#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte1___width 1
201#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte1___bit 1
202#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte2___lsb 2
203#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte2___width 1
204#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte2___bit 2
205#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte3___lsb 3
206#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte3___width 1
207#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask___byte3___bit 3
208#define reg_iop_sw_mpu_rw_bus1_oe_clr_mask_offset 56
209
210/* Register rw_bus1_oe_set_mask, scope iop_sw_mpu, type rw */
211#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte0___lsb 0
212#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte0___width 1
213#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte0___bit 0
214#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte1___lsb 1
215#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte1___width 1
216#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte1___bit 1
217#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte2___lsb 2
218#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte2___width 1
219#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte2___bit 2
220#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte3___lsb 3
221#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte3___width 1
222#define reg_iop_sw_mpu_rw_bus1_oe_set_mask___byte3___bit 3
223#define reg_iop_sw_mpu_rw_bus1_oe_set_mask_offset 60
224
225/* Register r_bus1_in, scope iop_sw_mpu, type r */
226#define reg_iop_sw_mpu_r_bus1_in_offset 64
227
228/* Register rw_gio_clr_mask, scope iop_sw_mpu, type rw */
229#define reg_iop_sw_mpu_rw_gio_clr_mask___val___lsb 0
230#define reg_iop_sw_mpu_rw_gio_clr_mask___val___width 32
231#define reg_iop_sw_mpu_rw_gio_clr_mask_offset 68
232
233/* Register rw_gio_set_mask, scope iop_sw_mpu, type rw */
234#define reg_iop_sw_mpu_rw_gio_set_mask___val___lsb 0
235#define reg_iop_sw_mpu_rw_gio_set_mask___val___width 32
236#define reg_iop_sw_mpu_rw_gio_set_mask_offset 72
237
238/* Register rw_gio_oe_clr_mask, scope iop_sw_mpu, type rw */
239#define reg_iop_sw_mpu_rw_gio_oe_clr_mask___val___lsb 0
240#define reg_iop_sw_mpu_rw_gio_oe_clr_mask___val___width 32
241#define reg_iop_sw_mpu_rw_gio_oe_clr_mask_offset 76
242
243/* Register rw_gio_oe_set_mask, scope iop_sw_mpu, type rw */
244#define reg_iop_sw_mpu_rw_gio_oe_set_mask___val___lsb 0
245#define reg_iop_sw_mpu_rw_gio_oe_set_mask___val___width 32
246#define reg_iop_sw_mpu_rw_gio_oe_set_mask_offset 80
247
248/* Register r_gio_in, scope iop_sw_mpu, type r */
249#define reg_iop_sw_mpu_r_gio_in_offset 84
250
251/* Register rw_cpu_intr, scope iop_sw_mpu, type rw */
252#define reg_iop_sw_mpu_rw_cpu_intr___intr0___lsb 0
253#define reg_iop_sw_mpu_rw_cpu_intr___intr0___width 1
254#define reg_iop_sw_mpu_rw_cpu_intr___intr0___bit 0
255#define reg_iop_sw_mpu_rw_cpu_intr___intr1___lsb 1
256#define reg_iop_sw_mpu_rw_cpu_intr___intr1___width 1
257#define reg_iop_sw_mpu_rw_cpu_intr___intr1___bit 1
258#define reg_iop_sw_mpu_rw_cpu_intr___intr2___lsb 2
259#define reg_iop_sw_mpu_rw_cpu_intr___intr2___width 1
260#define reg_iop_sw_mpu_rw_cpu_intr___intr2___bit 2
261#define reg_iop_sw_mpu_rw_cpu_intr___intr3___lsb 3
262#define reg_iop_sw_mpu_rw_cpu_intr___intr3___width 1
263#define reg_iop_sw_mpu_rw_cpu_intr___intr3___bit 3
264#define reg_iop_sw_mpu_rw_cpu_intr___intr4___lsb 4
265#define reg_iop_sw_mpu_rw_cpu_intr___intr4___width 1
266#define reg_iop_sw_mpu_rw_cpu_intr___intr4___bit 4
267#define reg_iop_sw_mpu_rw_cpu_intr___intr5___lsb 5
268#define reg_iop_sw_mpu_rw_cpu_intr___intr5___width 1
269#define reg_iop_sw_mpu_rw_cpu_intr___intr5___bit 5
270#define reg_iop_sw_mpu_rw_cpu_intr___intr6___lsb 6
271#define reg_iop_sw_mpu_rw_cpu_intr___intr6___width 1
272#define reg_iop_sw_mpu_rw_cpu_intr___intr6___bit 6
273#define reg_iop_sw_mpu_rw_cpu_intr___intr7___lsb 7
274#define reg_iop_sw_mpu_rw_cpu_intr___intr7___width 1
275#define reg_iop_sw_mpu_rw_cpu_intr___intr7___bit 7
276#define reg_iop_sw_mpu_rw_cpu_intr___intr8___lsb 8
277#define reg_iop_sw_mpu_rw_cpu_intr___intr8___width 1
278#define reg_iop_sw_mpu_rw_cpu_intr___intr8___bit 8
279#define reg_iop_sw_mpu_rw_cpu_intr___intr9___lsb 9
280#define reg_iop_sw_mpu_rw_cpu_intr___intr9___width 1
281#define reg_iop_sw_mpu_rw_cpu_intr___intr9___bit 9
282#define reg_iop_sw_mpu_rw_cpu_intr___intr10___lsb 10
283#define reg_iop_sw_mpu_rw_cpu_intr___intr10___width 1
284#define reg_iop_sw_mpu_rw_cpu_intr___intr10___bit 10
285#define reg_iop_sw_mpu_rw_cpu_intr___intr11___lsb 11
286#define reg_iop_sw_mpu_rw_cpu_intr___intr11___width 1
287#define reg_iop_sw_mpu_rw_cpu_intr___intr11___bit 11
288#define reg_iop_sw_mpu_rw_cpu_intr___intr12___lsb 12
289#define reg_iop_sw_mpu_rw_cpu_intr___intr12___width 1
290#define reg_iop_sw_mpu_rw_cpu_intr___intr12___bit 12
291#define reg_iop_sw_mpu_rw_cpu_intr___intr13___lsb 13
292#define reg_iop_sw_mpu_rw_cpu_intr___intr13___width 1
293#define reg_iop_sw_mpu_rw_cpu_intr___intr13___bit 13
294#define reg_iop_sw_mpu_rw_cpu_intr___intr14___lsb 14
295#define reg_iop_sw_mpu_rw_cpu_intr___intr14___width 1
296#define reg_iop_sw_mpu_rw_cpu_intr___intr14___bit 14
297#define reg_iop_sw_mpu_rw_cpu_intr___intr15___lsb 15
298#define reg_iop_sw_mpu_rw_cpu_intr___intr15___width 1
299#define reg_iop_sw_mpu_rw_cpu_intr___intr15___bit 15
300#define reg_iop_sw_mpu_rw_cpu_intr___intr16___lsb 16
301#define reg_iop_sw_mpu_rw_cpu_intr___intr16___width 1
302#define reg_iop_sw_mpu_rw_cpu_intr___intr16___bit 16
303#define reg_iop_sw_mpu_rw_cpu_intr___intr17___lsb 17
304#define reg_iop_sw_mpu_rw_cpu_intr___intr17___width 1
305#define reg_iop_sw_mpu_rw_cpu_intr___intr17___bit 17
306#define reg_iop_sw_mpu_rw_cpu_intr___intr18___lsb 18
307#define reg_iop_sw_mpu_rw_cpu_intr___intr18___width 1
308#define reg_iop_sw_mpu_rw_cpu_intr___intr18___bit 18
309#define reg_iop_sw_mpu_rw_cpu_intr___intr19___lsb 19
310#define reg_iop_sw_mpu_rw_cpu_intr___intr19___width 1
311#define reg_iop_sw_mpu_rw_cpu_intr___intr19___bit 19
312#define reg_iop_sw_mpu_rw_cpu_intr___intr20___lsb 20
313#define reg_iop_sw_mpu_rw_cpu_intr___intr20___width 1
314#define reg_iop_sw_mpu_rw_cpu_intr___intr20___bit 20
315#define reg_iop_sw_mpu_rw_cpu_intr___intr21___lsb 21
316#define reg_iop_sw_mpu_rw_cpu_intr___intr21___width 1
317#define reg_iop_sw_mpu_rw_cpu_intr___intr21___bit 21
318#define reg_iop_sw_mpu_rw_cpu_intr___intr22___lsb 22
319#define reg_iop_sw_mpu_rw_cpu_intr___intr22___width 1
320#define reg_iop_sw_mpu_rw_cpu_intr___intr22___bit 22
321#define reg_iop_sw_mpu_rw_cpu_intr___intr23___lsb 23
322#define reg_iop_sw_mpu_rw_cpu_intr___intr23___width 1
323#define reg_iop_sw_mpu_rw_cpu_intr___intr23___bit 23
324#define reg_iop_sw_mpu_rw_cpu_intr___intr24___lsb 24
325#define reg_iop_sw_mpu_rw_cpu_intr___intr24___width 1
326#define reg_iop_sw_mpu_rw_cpu_intr___intr24___bit 24
327#define reg_iop_sw_mpu_rw_cpu_intr___intr25___lsb 25
328#define reg_iop_sw_mpu_rw_cpu_intr___intr25___width 1
329#define reg_iop_sw_mpu_rw_cpu_intr___intr25___bit 25
330#define reg_iop_sw_mpu_rw_cpu_intr___intr26___lsb 26
331#define reg_iop_sw_mpu_rw_cpu_intr___intr26___width 1
332#define reg_iop_sw_mpu_rw_cpu_intr___intr26___bit 26
333#define reg_iop_sw_mpu_rw_cpu_intr___intr27___lsb 27
334#define reg_iop_sw_mpu_rw_cpu_intr___intr27___width 1
335#define reg_iop_sw_mpu_rw_cpu_intr___intr27___bit 27
336#define reg_iop_sw_mpu_rw_cpu_intr___intr28___lsb 28
337#define reg_iop_sw_mpu_rw_cpu_intr___intr28___width 1
338#define reg_iop_sw_mpu_rw_cpu_intr___intr28___bit 28
339#define reg_iop_sw_mpu_rw_cpu_intr___intr29___lsb 29
340#define reg_iop_sw_mpu_rw_cpu_intr___intr29___width 1
341#define reg_iop_sw_mpu_rw_cpu_intr___intr29___bit 29
342#define reg_iop_sw_mpu_rw_cpu_intr___intr30___lsb 30
343#define reg_iop_sw_mpu_rw_cpu_intr___intr30___width 1
344#define reg_iop_sw_mpu_rw_cpu_intr___intr30___bit 30
345#define reg_iop_sw_mpu_rw_cpu_intr___intr31___lsb 31
346#define reg_iop_sw_mpu_rw_cpu_intr___intr31___width 1
347#define reg_iop_sw_mpu_rw_cpu_intr___intr31___bit 31
348#define reg_iop_sw_mpu_rw_cpu_intr_offset 88
349
350/* Register r_cpu_intr, scope iop_sw_mpu, type r */
351#define reg_iop_sw_mpu_r_cpu_intr___intr0___lsb 0
352#define reg_iop_sw_mpu_r_cpu_intr___intr0___width 1
353#define reg_iop_sw_mpu_r_cpu_intr___intr0___bit 0
354#define reg_iop_sw_mpu_r_cpu_intr___intr1___lsb 1
355#define reg_iop_sw_mpu_r_cpu_intr___intr1___width 1
356#define reg_iop_sw_mpu_r_cpu_intr___intr1___bit 1
357#define reg_iop_sw_mpu_r_cpu_intr___intr2___lsb 2
358#define reg_iop_sw_mpu_r_cpu_intr___intr2___width 1
359#define reg_iop_sw_mpu_r_cpu_intr___intr2___bit 2
360#define reg_iop_sw_mpu_r_cpu_intr___intr3___lsb 3
361#define reg_iop_sw_mpu_r_cpu_intr___intr3___width 1
362#define reg_iop_sw_mpu_r_cpu_intr___intr3___bit 3
363#define reg_iop_sw_mpu_r_cpu_intr___intr4___lsb 4
364#define reg_iop_sw_mpu_r_cpu_intr___intr4___width 1
365#define reg_iop_sw_mpu_r_cpu_intr___intr4___bit 4
366#define reg_iop_sw_mpu_r_cpu_intr___intr5___lsb 5
367#define reg_iop_sw_mpu_r_cpu_intr___intr5___width 1
368#define reg_iop_sw_mpu_r_cpu_intr___intr5___bit 5
369#define reg_iop_sw_mpu_r_cpu_intr___intr6___lsb 6
370#define reg_iop_sw_mpu_r_cpu_intr___intr6___width 1
371#define reg_iop_sw_mpu_r_cpu_intr___intr6___bit 6
372#define reg_iop_sw_mpu_r_cpu_intr___intr7___lsb 7
373#define reg_iop_sw_mpu_r_cpu_intr___intr7___width 1
374#define reg_iop_sw_mpu_r_cpu_intr___intr7___bit 7
375#define reg_iop_sw_mpu_r_cpu_intr___intr8___lsb 8
376#define reg_iop_sw_mpu_r_cpu_intr___intr8___width 1
377#define reg_iop_sw_mpu_r_cpu_intr___intr8___bit 8
378#define reg_iop_sw_mpu_r_cpu_intr___intr9___lsb 9
379#define reg_iop_sw_mpu_r_cpu_intr___intr9___width 1
380#define reg_iop_sw_mpu_r_cpu_intr___intr9___bit 9
381#define reg_iop_sw_mpu_r_cpu_intr___intr10___lsb 10
382#define reg_iop_sw_mpu_r_cpu_intr___intr10___width 1
383#define reg_iop_sw_mpu_r_cpu_intr___intr10___bit 10
384#define reg_iop_sw_mpu_r_cpu_intr___intr11___lsb 11
385#define reg_iop_sw_mpu_r_cpu_intr___intr11___width 1
386#define reg_iop_sw_mpu_r_cpu_intr___intr11___bit 11
387#define reg_iop_sw_mpu_r_cpu_intr___intr12___lsb 12
388#define reg_iop_sw_mpu_r_cpu_intr___intr12___width 1
389#define reg_iop_sw_mpu_r_cpu_intr___intr12___bit 12
390#define reg_iop_sw_mpu_r_cpu_intr___intr13___lsb 13
391#define reg_iop_sw_mpu_r_cpu_intr___intr13___width 1
392#define reg_iop_sw_mpu_r_cpu_intr___intr13___bit 13
393#define reg_iop_sw_mpu_r_cpu_intr___intr14___lsb 14
394#define reg_iop_sw_mpu_r_cpu_intr___intr14___width 1
395#define reg_iop_sw_mpu_r_cpu_intr___intr14___bit 14
396#define reg_iop_sw_mpu_r_cpu_intr___intr15___lsb 15
397#define reg_iop_sw_mpu_r_cpu_intr___intr15___width 1
398#define reg_iop_sw_mpu_r_cpu_intr___intr15___bit 15
399#define reg_iop_sw_mpu_r_cpu_intr___intr16___lsb 16
400#define reg_iop_sw_mpu_r_cpu_intr___intr16___width 1
401#define reg_iop_sw_mpu_r_cpu_intr___intr16___bit 16
402#define reg_iop_sw_mpu_r_cpu_intr___intr17___lsb 17
403#define reg_iop_sw_mpu_r_cpu_intr___intr17___width 1
404#define reg_iop_sw_mpu_r_cpu_intr___intr17___bit 17
405#define reg_iop_sw_mpu_r_cpu_intr___intr18___lsb 18
406#define reg_iop_sw_mpu_r_cpu_intr___intr18___width 1
407#define reg_iop_sw_mpu_r_cpu_intr___intr18___bit 18
408#define reg_iop_sw_mpu_r_cpu_intr___intr19___lsb 19
409#define reg_iop_sw_mpu_r_cpu_intr___intr19___width 1
410#define reg_iop_sw_mpu_r_cpu_intr___intr19___bit 19
411#define reg_iop_sw_mpu_r_cpu_intr___intr20___lsb 20
412#define reg_iop_sw_mpu_r_cpu_intr___intr20___width 1
413#define reg_iop_sw_mpu_r_cpu_intr___intr20___bit 20
414#define reg_iop_sw_mpu_r_cpu_intr___intr21___lsb 21
415#define reg_iop_sw_mpu_r_cpu_intr___intr21___width 1
416#define reg_iop_sw_mpu_r_cpu_intr___intr21___bit 21
417#define reg_iop_sw_mpu_r_cpu_intr___intr22___lsb 22
418#define reg_iop_sw_mpu_r_cpu_intr___intr22___width 1
419#define reg_iop_sw_mpu_r_cpu_intr___intr22___bit 22
420#define reg_iop_sw_mpu_r_cpu_intr___intr23___lsb 23
421#define reg_iop_sw_mpu_r_cpu_intr___intr23___width 1
422#define reg_iop_sw_mpu_r_cpu_intr___intr23___bit 23
423#define reg_iop_sw_mpu_r_cpu_intr___intr24___lsb 24
424#define reg_iop_sw_mpu_r_cpu_intr___intr24___width 1
425#define reg_iop_sw_mpu_r_cpu_intr___intr24___bit 24
426#define reg_iop_sw_mpu_r_cpu_intr___intr25___lsb 25
427#define reg_iop_sw_mpu_r_cpu_intr___intr25___width 1
428#define reg_iop_sw_mpu_r_cpu_intr___intr25___bit 25
429#define reg_iop_sw_mpu_r_cpu_intr___intr26___lsb 26
430#define reg_iop_sw_mpu_r_cpu_intr___intr26___width 1
431#define reg_iop_sw_mpu_r_cpu_intr___intr26___bit 26
432#define reg_iop_sw_mpu_r_cpu_intr___intr27___lsb 27
433#define reg_iop_sw_mpu_r_cpu_intr___intr27___width 1
434#define reg_iop_sw_mpu_r_cpu_intr___intr27___bit 27
435#define reg_iop_sw_mpu_r_cpu_intr___intr28___lsb 28
436#define reg_iop_sw_mpu_r_cpu_intr___intr28___width 1
437#define reg_iop_sw_mpu_r_cpu_intr___intr28___bit 28
438#define reg_iop_sw_mpu_r_cpu_intr___intr29___lsb 29
439#define reg_iop_sw_mpu_r_cpu_intr___intr29___width 1
440#define reg_iop_sw_mpu_r_cpu_intr___intr29___bit 29
441#define reg_iop_sw_mpu_r_cpu_intr___intr30___lsb 30
442#define reg_iop_sw_mpu_r_cpu_intr___intr30___width 1
443#define reg_iop_sw_mpu_r_cpu_intr___intr30___bit 30
444#define reg_iop_sw_mpu_r_cpu_intr___intr31___lsb 31
445#define reg_iop_sw_mpu_r_cpu_intr___intr31___width 1
446#define reg_iop_sw_mpu_r_cpu_intr___intr31___bit 31
447#define reg_iop_sw_mpu_r_cpu_intr_offset 92
448
449/* Register rw_intr_grp0_mask, scope iop_sw_mpu, type rw */
450#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr0___lsb 0
451#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr0___width 1
452#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr0___bit 0
453#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr0___lsb 1
454#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr0___width 1
455#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr0___bit 1
456#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp0___lsb 2
457#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp0___width 1
458#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp0___bit 2
459#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp4___lsb 3
460#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp4___width 1
461#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp4___bit 3
462#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp0___lsb 4
463#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp0___width 1
464#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp0___bit 4
465#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0___lsb 5
466#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0___width 1
467#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0___bit 5
468#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0_extra___lsb 6
469#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0_extra___width 1
470#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out0_extra___bit 6
471#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out0___lsb 7
472#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out0___width 1
473#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out0___bit 7
474#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr1___lsb 8
475#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr1___width 1
476#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr1___bit 8
477#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr1___lsb 9
478#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr1___width 1
479#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr1___bit 9
480#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp1___lsb 10
481#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp1___width 1
482#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp1___bit 10
483#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp5___lsb 11
484#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp5___width 1
485#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp5___bit 11
486#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp1___lsb 12
487#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp1___width 1
488#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp1___bit 12
489#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0___lsb 13
490#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0___width 1
491#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0___bit 13
492#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0_extra___lsb 14
493#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0_extra___width 1
494#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in0_extra___bit 14
495#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in0___lsb 15
496#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in0___width 1
497#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in0___bit 15
498#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr2___lsb 16
499#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr2___width 1
500#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr2___bit 16
501#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr2___lsb 17
502#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr2___width 1
503#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr2___bit 17
504#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp2___lsb 18
505#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp2___width 1
506#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp2___bit 18
507#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp6___lsb 19
508#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp6___width 1
509#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp6___bit 19
510#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp2___lsb 20
511#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp2___width 1
512#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp2___bit 20
513#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1___lsb 21
514#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1___width 1
515#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1___bit 21
516#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1_extra___lsb 22
517#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1_extra___width 1
518#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_out1_extra___bit 22
519#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out1___lsb 23
520#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out1___width 1
521#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_out1___bit 23
522#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr3___lsb 24
523#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr3___width 1
524#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu0_intr3___bit 24
525#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr3___lsb 25
526#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr3___width 1
527#define reg_iop_sw_mpu_rw_intr_grp0_mask___spu1_intr3___bit 25
528#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp3___lsb 26
529#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp3___width 1
530#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp3___bit 26
531#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp7___lsb 27
532#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp7___width 1
533#define reg_iop_sw_mpu_rw_intr_grp0_mask___trigger_grp7___bit 27
534#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp3___lsb 28
535#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp3___width 1
536#define reg_iop_sw_mpu_rw_intr_grp0_mask___timer_grp3___bit 28
537#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1___lsb 29
538#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1___width 1
539#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1___bit 29
540#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1_extra___lsb 30
541#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1_extra___width 1
542#define reg_iop_sw_mpu_rw_intr_grp0_mask___fifo_in1_extra___bit 30
543#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in1___lsb 31
544#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in1___width 1
545#define reg_iop_sw_mpu_rw_intr_grp0_mask___dmc_in1___bit 31
546#define reg_iop_sw_mpu_rw_intr_grp0_mask_offset 96
547
548/* Register rw_ack_intr_grp0, scope iop_sw_mpu, type rw */
549#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr0___lsb 0
550#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr0___width 1
551#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr0___bit 0
552#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr0___lsb 1
553#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr0___width 1
554#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr0___bit 1
555#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr1___lsb 8
556#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr1___width 1
557#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr1___bit 8
558#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr1___lsb 9
559#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr1___width 1
560#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr1___bit 9
561#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr2___lsb 16
562#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr2___width 1
563#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr2___bit 16
564#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr2___lsb 17
565#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr2___width 1
566#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr2___bit 17
567#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr3___lsb 24
568#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr3___width 1
569#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu0_intr3___bit 24
570#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr3___lsb 25
571#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr3___width 1
572#define reg_iop_sw_mpu_rw_ack_intr_grp0___spu1_intr3___bit 25
573#define reg_iop_sw_mpu_rw_ack_intr_grp0_offset 100
574
575/* Register r_intr_grp0, scope iop_sw_mpu, type r */
576#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr0___lsb 0
577#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr0___width 1
578#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr0___bit 0
579#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr0___lsb 1
580#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr0___width 1
581#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr0___bit 1
582#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp0___lsb 2
583#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp0___width 1
584#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp0___bit 2
585#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp4___lsb 3
586#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp4___width 1
587#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp4___bit 3
588#define reg_iop_sw_mpu_r_intr_grp0___timer_grp0___lsb 4
589#define reg_iop_sw_mpu_r_intr_grp0___timer_grp0___width 1
590#define reg_iop_sw_mpu_r_intr_grp0___timer_grp0___bit 4
591#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0___lsb 5
592#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0___width 1
593#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0___bit 5
594#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0_extra___lsb 6
595#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0_extra___width 1
596#define reg_iop_sw_mpu_r_intr_grp0___fifo_out0_extra___bit 6
597#define reg_iop_sw_mpu_r_intr_grp0___dmc_out0___lsb 7
598#define reg_iop_sw_mpu_r_intr_grp0___dmc_out0___width 1
599#define reg_iop_sw_mpu_r_intr_grp0___dmc_out0___bit 7
600#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr1___lsb 8
601#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr1___width 1
602#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr1___bit 8
603#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr1___lsb 9
604#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr1___width 1
605#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr1___bit 9
606#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp1___lsb 10
607#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp1___width 1
608#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp1___bit 10
609#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp5___lsb 11
610#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp5___width 1
611#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp5___bit 11
612#define reg_iop_sw_mpu_r_intr_grp0___timer_grp1___lsb 12
613#define reg_iop_sw_mpu_r_intr_grp0___timer_grp1___width 1
614#define reg_iop_sw_mpu_r_intr_grp0___timer_grp1___bit 12
615#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0___lsb 13
616#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0___width 1
617#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0___bit 13
618#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0_extra___lsb 14
619#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0_extra___width 1
620#define reg_iop_sw_mpu_r_intr_grp0___fifo_in0_extra___bit 14
621#define reg_iop_sw_mpu_r_intr_grp0___dmc_in0___lsb 15
622#define reg_iop_sw_mpu_r_intr_grp0___dmc_in0___width 1
623#define reg_iop_sw_mpu_r_intr_grp0___dmc_in0___bit 15
624#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr2___lsb 16
625#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr2___width 1
626#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr2___bit 16
627#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr2___lsb 17
628#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr2___width 1
629#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr2___bit 17
630#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp2___lsb 18
631#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp2___width 1
632#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp2___bit 18
633#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp6___lsb 19
634#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp6___width 1
635#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp6___bit 19
636#define reg_iop_sw_mpu_r_intr_grp0___timer_grp2___lsb 20
637#define reg_iop_sw_mpu_r_intr_grp0___timer_grp2___width 1
638#define reg_iop_sw_mpu_r_intr_grp0___timer_grp2___bit 20
639#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1___lsb 21
640#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1___width 1
641#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1___bit 21
642#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1_extra___lsb 22
643#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1_extra___width 1
644#define reg_iop_sw_mpu_r_intr_grp0___fifo_out1_extra___bit 22
645#define reg_iop_sw_mpu_r_intr_grp0___dmc_out1___lsb 23
646#define reg_iop_sw_mpu_r_intr_grp0___dmc_out1___width 1
647#define reg_iop_sw_mpu_r_intr_grp0___dmc_out1___bit 23
648#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr3___lsb 24
649#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr3___width 1
650#define reg_iop_sw_mpu_r_intr_grp0___spu0_intr3___bit 24
651#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr3___lsb 25
652#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr3___width 1
653#define reg_iop_sw_mpu_r_intr_grp0___spu1_intr3___bit 25
654#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp3___lsb 26
655#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp3___width 1
656#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp3___bit 26
657#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp7___lsb 27
658#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp7___width 1
659#define reg_iop_sw_mpu_r_intr_grp0___trigger_grp7___bit 27
660#define reg_iop_sw_mpu_r_intr_grp0___timer_grp3___lsb 28
661#define reg_iop_sw_mpu_r_intr_grp0___timer_grp3___width 1
662#define reg_iop_sw_mpu_r_intr_grp0___timer_grp3___bit 28
663#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1___lsb 29
664#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1___width 1
665#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1___bit 29
666#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1_extra___lsb 30
667#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1_extra___width 1
668#define reg_iop_sw_mpu_r_intr_grp0___fifo_in1_extra___bit 30
669#define reg_iop_sw_mpu_r_intr_grp0___dmc_in1___lsb 31
670#define reg_iop_sw_mpu_r_intr_grp0___dmc_in1___width 1
671#define reg_iop_sw_mpu_r_intr_grp0___dmc_in1___bit 31
672#define reg_iop_sw_mpu_r_intr_grp0_offset 104
673
674/* Register r_masked_intr_grp0, scope iop_sw_mpu, type r */
675#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr0___lsb 0
676#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr0___width 1
677#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr0___bit 0
678#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr0___lsb 1
679#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr0___width 1
680#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr0___bit 1
681#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp0___lsb 2
682#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp0___width 1
683#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp0___bit 2
684#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp4___lsb 3
685#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp4___width 1
686#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp4___bit 3
687#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp0___lsb 4
688#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp0___width 1
689#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp0___bit 4
690#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0___lsb 5
691#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0___width 1
692#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0___bit 5
693#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0_extra___lsb 6
694#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0_extra___width 1
695#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out0_extra___bit 6
696#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out0___lsb 7
697#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out0___width 1
698#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out0___bit 7
699#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr1___lsb 8
700#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr1___width 1
701#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr1___bit 8
702#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr1___lsb 9
703#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr1___width 1
704#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr1___bit 9
705#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp1___lsb 10
706#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp1___width 1
707#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp1___bit 10
708#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp5___lsb 11
709#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp5___width 1
710#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp5___bit 11
711#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp1___lsb 12
712#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp1___width 1
713#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp1___bit 12
714#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0___lsb 13
715#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0___width 1
716#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0___bit 13
717#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0_extra___lsb 14
718#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0_extra___width 1
719#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in0_extra___bit 14
720#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in0___lsb 15
721#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in0___width 1
722#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in0___bit 15
723#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr2___lsb 16
724#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr2___width 1
725#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr2___bit 16
726#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr2___lsb 17
727#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr2___width 1
728#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr2___bit 17
729#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp2___lsb 18
730#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp2___width 1
731#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp2___bit 18
732#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp6___lsb 19
733#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp6___width 1
734#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp6___bit 19
735#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp2___lsb 20
736#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp2___width 1
737#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp2___bit 20
738#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1___lsb 21
739#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1___width 1
740#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1___bit 21
741#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1_extra___lsb 22
742#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1_extra___width 1
743#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_out1_extra___bit 22
744#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out1___lsb 23
745#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out1___width 1
746#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_out1___bit 23
747#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr3___lsb 24
748#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr3___width 1
749#define reg_iop_sw_mpu_r_masked_intr_grp0___spu0_intr3___bit 24
750#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr3___lsb 25
751#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr3___width 1
752#define reg_iop_sw_mpu_r_masked_intr_grp0___spu1_intr3___bit 25
753#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp3___lsb 26
754#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp3___width 1
755#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp3___bit 26
756#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp7___lsb 27
757#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp7___width 1
758#define reg_iop_sw_mpu_r_masked_intr_grp0___trigger_grp7___bit 27
759#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp3___lsb 28
760#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp3___width 1
761#define reg_iop_sw_mpu_r_masked_intr_grp0___timer_grp3___bit 28
762#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1___lsb 29
763#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1___width 1
764#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1___bit 29
765#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1_extra___lsb 30
766#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1_extra___width 1
767#define reg_iop_sw_mpu_r_masked_intr_grp0___fifo_in1_extra___bit 30
768#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in1___lsb 31
769#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in1___width 1
770#define reg_iop_sw_mpu_r_masked_intr_grp0___dmc_in1___bit 31
771#define reg_iop_sw_mpu_r_masked_intr_grp0_offset 108
772
773/* Register rw_intr_grp1_mask, scope iop_sw_mpu, type rw */
774#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr4___lsb 0
775#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr4___width 1
776#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr4___bit 0
777#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr4___lsb 1
778#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr4___width 1
779#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr4___bit 1
780#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp0___lsb 2
781#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp0___width 1
782#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp0___bit 2
783#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp5___lsb 3
784#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp5___width 1
785#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp5___bit 3
786#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp0___lsb 4
787#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp0___width 1
788#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp0___bit 4
789#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0___lsb 5
790#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0___width 1
791#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0___bit 5
792#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0_extra___lsb 6
793#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0_extra___width 1
794#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in0_extra___bit 6
795#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out0___lsb 7
796#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out0___width 1
797#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out0___bit 7
798#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr5___lsb 8
799#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr5___width 1
800#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr5___bit 8
801#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr5___lsb 9
802#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr5___width 1
803#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr5___bit 9
804#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp1___lsb 10
805#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp1___width 1
806#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp1___bit 10
807#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp6___lsb 11
808#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp6___width 1
809#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp6___bit 11
810#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp1___lsb 12
811#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp1___width 1
812#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp1___bit 12
813#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1___lsb 13
814#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1___width 1
815#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1___bit 13
816#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0_extra___lsb 14
817#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0_extra___width 1
818#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0_extra___bit 14
819#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in0___lsb 15
820#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in0___width 1
821#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in0___bit 15
822#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr6___lsb 16
823#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr6___width 1
824#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr6___bit 16
825#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr6___lsb 17
826#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr6___width 1
827#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr6___bit 17
828#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp2___lsb 18
829#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp2___width 1
830#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp2___bit 18
831#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp7___lsb 19
832#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp7___width 1
833#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp7___bit 19
834#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp2___lsb 20
835#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp2___width 1
836#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp2___bit 20
837#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1___lsb 21
838#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1___width 1
839#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1___bit 21
840#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1_extra___lsb 22
841#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1_extra___width 1
842#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_in1_extra___bit 22
843#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out1___lsb 23
844#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out1___width 1
845#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_out1___bit 23
846#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr7___lsb 24
847#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr7___width 1
848#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu0_intr7___bit 24
849#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr7___lsb 25
850#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr7___width 1
851#define reg_iop_sw_mpu_rw_intr_grp1_mask___spu1_intr7___bit 25
852#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp3___lsb 26
853#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp3___width 1
854#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp3___bit 26
855#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp4___lsb 27
856#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp4___width 1
857#define reg_iop_sw_mpu_rw_intr_grp1_mask___trigger_grp4___bit 27
858#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp3___lsb 28
859#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp3___width 1
860#define reg_iop_sw_mpu_rw_intr_grp1_mask___timer_grp3___bit 28
861#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0___lsb 29
862#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0___width 1
863#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out0___bit 29
864#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1_extra___lsb 30
865#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1_extra___width 1
866#define reg_iop_sw_mpu_rw_intr_grp1_mask___fifo_out1_extra___bit 30
867#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in1___lsb 31
868#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in1___width 1
869#define reg_iop_sw_mpu_rw_intr_grp1_mask___dmc_in1___bit 31
870#define reg_iop_sw_mpu_rw_intr_grp1_mask_offset 112
871
872/* Register rw_ack_intr_grp1, scope iop_sw_mpu, type rw */
873#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr4___lsb 0
874#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr4___width 1
875#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr4___bit 0
876#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr4___lsb 1
877#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr4___width 1
878#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr4___bit 1
879#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr5___lsb 8
880#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr5___width 1
881#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr5___bit 8
882#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr5___lsb 9
883#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr5___width 1
884#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr5___bit 9
885#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr6___lsb 16
886#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr6___width 1
887#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr6___bit 16
888#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr6___lsb 17
889#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr6___width 1
890#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr6___bit 17
891#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr7___lsb 24
892#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr7___width 1
893#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu0_intr7___bit 24
894#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr7___lsb 25
895#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr7___width 1
896#define reg_iop_sw_mpu_rw_ack_intr_grp1___spu1_intr7___bit 25
897#define reg_iop_sw_mpu_rw_ack_intr_grp1_offset 116
898
899/* Register r_intr_grp1, scope iop_sw_mpu, type r */
900#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr4___lsb 0
901#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr4___width 1
902#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr4___bit 0
903#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr4___lsb 1
904#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr4___width 1
905#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr4___bit 1
906#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp0___lsb 2
907#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp0___width 1
908#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp0___bit 2
909#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp5___lsb 3
910#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp5___width 1
911#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp5___bit 3
912#define reg_iop_sw_mpu_r_intr_grp1___timer_grp0___lsb 4
913#define reg_iop_sw_mpu_r_intr_grp1___timer_grp0___width 1
914#define reg_iop_sw_mpu_r_intr_grp1___timer_grp0___bit 4
915#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0___lsb 5
916#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0___width 1
917#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0___bit 5
918#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0_extra___lsb 6
919#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0_extra___width 1
920#define reg_iop_sw_mpu_r_intr_grp1___fifo_in0_extra___bit 6
921#define reg_iop_sw_mpu_r_intr_grp1___dmc_out0___lsb 7
922#define reg_iop_sw_mpu_r_intr_grp1___dmc_out0___width 1
923#define reg_iop_sw_mpu_r_intr_grp1___dmc_out0___bit 7
924#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr5___lsb 8
925#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr5___width 1
926#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr5___bit 8
927#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr5___lsb 9
928#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr5___width 1
929#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr5___bit 9
930#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp1___lsb 10
931#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp1___width 1
932#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp1___bit 10
933#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp6___lsb 11
934#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp6___width 1
935#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp6___bit 11
936#define reg_iop_sw_mpu_r_intr_grp1___timer_grp1___lsb 12
937#define reg_iop_sw_mpu_r_intr_grp1___timer_grp1___width 1
938#define reg_iop_sw_mpu_r_intr_grp1___timer_grp1___bit 12
939#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1___lsb 13
940#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1___width 1
941#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1___bit 13
942#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0_extra___lsb 14
943#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0_extra___width 1
944#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0_extra___bit 14
945#define reg_iop_sw_mpu_r_intr_grp1___dmc_in0___lsb 15
946#define reg_iop_sw_mpu_r_intr_grp1___dmc_in0___width 1
947#define reg_iop_sw_mpu_r_intr_grp1___dmc_in0___bit 15
948#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr6___lsb 16
949#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr6___width 1
950#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr6___bit 16
951#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr6___lsb 17
952#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr6___width 1
953#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr6___bit 17
954#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp2___lsb 18
955#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp2___width 1
956#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp2___bit 18
957#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp7___lsb 19
958#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp7___width 1
959#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp7___bit 19
960#define reg_iop_sw_mpu_r_intr_grp1___timer_grp2___lsb 20
961#define reg_iop_sw_mpu_r_intr_grp1___timer_grp2___width 1
962#define reg_iop_sw_mpu_r_intr_grp1___timer_grp2___bit 20
963#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1___lsb 21
964#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1___width 1
965#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1___bit 21
966#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1_extra___lsb 22
967#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1_extra___width 1
968#define reg_iop_sw_mpu_r_intr_grp1___fifo_in1_extra___bit 22
969#define reg_iop_sw_mpu_r_intr_grp1___dmc_out1___lsb 23
970#define reg_iop_sw_mpu_r_intr_grp1___dmc_out1___width 1
971#define reg_iop_sw_mpu_r_intr_grp1___dmc_out1___bit 23
972#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr7___lsb 24
973#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr7___width 1
974#define reg_iop_sw_mpu_r_intr_grp1___spu0_intr7___bit 24
975#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr7___lsb 25
976#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr7___width 1
977#define reg_iop_sw_mpu_r_intr_grp1___spu1_intr7___bit 25
978#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp3___lsb 26
979#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp3___width 1
980#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp3___bit 26
981#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp4___lsb 27
982#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp4___width 1
983#define reg_iop_sw_mpu_r_intr_grp1___trigger_grp4___bit 27
984#define reg_iop_sw_mpu_r_intr_grp1___timer_grp3___lsb 28
985#define reg_iop_sw_mpu_r_intr_grp1___timer_grp3___width 1
986#define reg_iop_sw_mpu_r_intr_grp1___timer_grp3___bit 28
987#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0___lsb 29
988#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0___width 1
989#define reg_iop_sw_mpu_r_intr_grp1___fifo_out0___bit 29
990#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1_extra___lsb 30
991#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1_extra___width 1
992#define reg_iop_sw_mpu_r_intr_grp1___fifo_out1_extra___bit 30
993#define reg_iop_sw_mpu_r_intr_grp1___dmc_in1___lsb 31
994#define reg_iop_sw_mpu_r_intr_grp1___dmc_in1___width 1
995#define reg_iop_sw_mpu_r_intr_grp1___dmc_in1___bit 31
996#define reg_iop_sw_mpu_r_intr_grp1_offset 120
997
998/* Register r_masked_intr_grp1, scope iop_sw_mpu, type r */
999#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr4___lsb 0
1000#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr4___width 1
1001#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr4___bit 0
1002#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr4___lsb 1
1003#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr4___width 1
1004#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr4___bit 1
1005#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp0___lsb 2
1006#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp0___width 1
1007#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp0___bit 2
1008#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp5___lsb 3
1009#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp5___width 1
1010#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp5___bit 3
1011#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp0___lsb 4
1012#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp0___width 1
1013#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp0___bit 4
1014#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0___lsb 5
1015#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0___width 1
1016#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0___bit 5
1017#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0_extra___lsb 6
1018#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0_extra___width 1
1019#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in0_extra___bit 6
1020#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out0___lsb 7
1021#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out0___width 1
1022#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out0___bit 7
1023#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr5___lsb 8
1024#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr5___width 1
1025#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr5___bit 8
1026#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr5___lsb 9
1027#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr5___width 1
1028#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr5___bit 9
1029#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp1___lsb 10
1030#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp1___width 1
1031#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp1___bit 10
1032#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp6___lsb 11
1033#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp6___width 1
1034#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp6___bit 11
1035#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp1___lsb 12
1036#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp1___width 1
1037#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp1___bit 12
1038#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1___lsb 13
1039#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1___width 1
1040#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1___bit 13
1041#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0_extra___lsb 14
1042#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0_extra___width 1
1043#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0_extra___bit 14
1044#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in0___lsb 15
1045#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in0___width 1
1046#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in0___bit 15
1047#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr6___lsb 16
1048#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr6___width 1
1049#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr6___bit 16
1050#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr6___lsb 17
1051#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr6___width 1
1052#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr6___bit 17
1053#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp2___lsb 18
1054#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp2___width 1
1055#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp2___bit 18
1056#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp7___lsb 19
1057#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp7___width 1
1058#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp7___bit 19
1059#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp2___lsb 20
1060#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp2___width 1
1061#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp2___bit 20
1062#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1___lsb 21
1063#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1___width 1
1064#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1___bit 21
1065#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1_extra___lsb 22
1066#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1_extra___width 1
1067#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_in1_extra___bit 22
1068#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out1___lsb 23
1069#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out1___width 1
1070#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_out1___bit 23
1071#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr7___lsb 24
1072#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr7___width 1
1073#define reg_iop_sw_mpu_r_masked_intr_grp1___spu0_intr7___bit 24
1074#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr7___lsb 25
1075#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr7___width 1
1076#define reg_iop_sw_mpu_r_masked_intr_grp1___spu1_intr7___bit 25
1077#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp3___lsb 26
1078#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp3___width 1
1079#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp3___bit 26
1080#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp4___lsb 27
1081#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp4___width 1
1082#define reg_iop_sw_mpu_r_masked_intr_grp1___trigger_grp4___bit 27
1083#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp3___lsb 28
1084#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp3___width 1
1085#define reg_iop_sw_mpu_r_masked_intr_grp1___timer_grp3___bit 28
1086#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0___lsb 29
1087#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0___width 1
1088#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out0___bit 29
1089#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1_extra___lsb 30
1090#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1_extra___width 1
1091#define reg_iop_sw_mpu_r_masked_intr_grp1___fifo_out1_extra___bit 30
1092#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in1___lsb 31
1093#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in1___width 1
1094#define reg_iop_sw_mpu_r_masked_intr_grp1___dmc_in1___bit 31
1095#define reg_iop_sw_mpu_r_masked_intr_grp1_offset 124
1096
1097/* Register rw_intr_grp2_mask, scope iop_sw_mpu, type rw */
1098#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr8___lsb 0
1099#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr8___width 1
1100#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr8___bit 0
1101#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr8___lsb 1
1102#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr8___width 1
1103#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr8___bit 1
1104#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp0___lsb 2
1105#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp0___width 1
1106#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp0___bit 2
1107#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp6___lsb 3
1108#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp6___width 1
1109#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp6___bit 3
1110#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp0___lsb 4
1111#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp0___width 1
1112#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp0___bit 4
1113#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1___lsb 5
1114#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1___width 1
1115#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1___bit 5
1116#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1_extra___lsb 6
1117#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1_extra___width 1
1118#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out1_extra___bit 6
1119#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out0___lsb 7
1120#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out0___width 1
1121#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out0___bit 7
1122#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr9___lsb 8
1123#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr9___width 1
1124#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr9___bit 8
1125#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr9___lsb 9
1126#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr9___width 1
1127#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr9___bit 9
1128#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp1___lsb 10
1129#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp1___width 1
1130#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp1___bit 10
1131#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp7___lsb 11
1132#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp7___width 1
1133#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp7___bit 11
1134#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp1___lsb 12
1135#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp1___width 1
1136#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp1___bit 12
1137#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1___lsb 13
1138#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1___width 1
1139#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1___bit 13
1140#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1_extra___lsb 14
1141#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1_extra___width 1
1142#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in1_extra___bit 14
1143#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in0___lsb 15
1144#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in0___width 1
1145#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in0___bit 15
1146#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr10___lsb 16
1147#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr10___width 1
1148#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr10___bit 16
1149#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr10___lsb 17
1150#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr10___width 1
1151#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr10___bit 17
1152#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp2___lsb 18
1153#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp2___width 1
1154#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp2___bit 18
1155#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp4___lsb 19
1156#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp4___width 1
1157#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp4___bit 19
1158#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp2___lsb 20
1159#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp2___width 1
1160#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp2___bit 20
1161#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0___lsb 21
1162#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0___width 1
1163#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0___bit 21
1164#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0_extra___lsb 22
1165#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0_extra___width 1
1166#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_out0_extra___bit 22
1167#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out1___lsb 23
1168#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out1___width 1
1169#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_out1___bit 23
1170#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr11___lsb 24
1171#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr11___width 1
1172#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu0_intr11___bit 24
1173#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr11___lsb 25
1174#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr11___width 1
1175#define reg_iop_sw_mpu_rw_intr_grp2_mask___spu1_intr11___bit 25
1176#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp3___lsb 26
1177#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp3___width 1
1178#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp3___bit 26
1179#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp5___lsb 27
1180#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp5___width 1
1181#define reg_iop_sw_mpu_rw_intr_grp2_mask___trigger_grp5___bit 27
1182#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp3___lsb 28
1183#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp3___width 1
1184#define reg_iop_sw_mpu_rw_intr_grp2_mask___timer_grp3___bit 28
1185#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0___lsb 29
1186#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0___width 1
1187#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0___bit 29
1188#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0_extra___lsb 30
1189#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0_extra___width 1
1190#define reg_iop_sw_mpu_rw_intr_grp2_mask___fifo_in0_extra___bit 30
1191#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in1___lsb 31
1192#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in1___width 1
1193#define reg_iop_sw_mpu_rw_intr_grp2_mask___dmc_in1___bit 31
1194#define reg_iop_sw_mpu_rw_intr_grp2_mask_offset 128
1195
1196/* Register rw_ack_intr_grp2, scope iop_sw_mpu, type rw */
1197#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr8___lsb 0
1198#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr8___width 1
1199#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr8___bit 0
1200#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr8___lsb 1
1201#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr8___width 1
1202#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr8___bit 1
1203#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr9___lsb 8
1204#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr9___width 1
1205#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr9___bit 8
1206#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr9___lsb 9
1207#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr9___width 1
1208#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr9___bit 9
1209#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr10___lsb 16
1210#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr10___width 1
1211#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr10___bit 16
1212#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr10___lsb 17
1213#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr10___width 1
1214#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr10___bit 17
1215#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr11___lsb 24
1216#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr11___width 1
1217#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu0_intr11___bit 24
1218#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr11___lsb 25
1219#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr11___width 1
1220#define reg_iop_sw_mpu_rw_ack_intr_grp2___spu1_intr11___bit 25
1221#define reg_iop_sw_mpu_rw_ack_intr_grp2_offset 132
1222
1223/* Register r_intr_grp2, scope iop_sw_mpu, type r */
1224#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr8___lsb 0
1225#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr8___width 1
1226#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr8___bit 0
1227#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr8___lsb 1
1228#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr8___width 1
1229#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr8___bit 1
1230#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp0___lsb 2
1231#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp0___width 1
1232#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp0___bit 2
1233#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp6___lsb 3
1234#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp6___width 1
1235#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp6___bit 3
1236#define reg_iop_sw_mpu_r_intr_grp2___timer_grp0___lsb 4
1237#define reg_iop_sw_mpu_r_intr_grp2___timer_grp0___width 1
1238#define reg_iop_sw_mpu_r_intr_grp2___timer_grp0___bit 4
1239#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1___lsb 5
1240#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1___width 1
1241#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1___bit 5
1242#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1_extra___lsb 6
1243#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1_extra___width 1
1244#define reg_iop_sw_mpu_r_intr_grp2___fifo_out1_extra___bit 6
1245#define reg_iop_sw_mpu_r_intr_grp2___dmc_out0___lsb 7
1246#define reg_iop_sw_mpu_r_intr_grp2___dmc_out0___width 1
1247#define reg_iop_sw_mpu_r_intr_grp2___dmc_out0___bit 7
1248#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr9___lsb 8
1249#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr9___width 1
1250#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr9___bit 8
1251#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr9___lsb 9
1252#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr9___width 1
1253#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr9___bit 9
1254#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp1___lsb 10
1255#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp1___width 1
1256#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp1___bit 10
1257#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp7___lsb 11
1258#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp7___width 1
1259#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp7___bit 11
1260#define reg_iop_sw_mpu_r_intr_grp2___timer_grp1___lsb 12
1261#define reg_iop_sw_mpu_r_intr_grp2___timer_grp1___width 1
1262#define reg_iop_sw_mpu_r_intr_grp2___timer_grp1___bit 12
1263#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1___lsb 13
1264#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1___width 1
1265#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1___bit 13
1266#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1_extra___lsb 14
1267#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1_extra___width 1
1268#define reg_iop_sw_mpu_r_intr_grp2___fifo_in1_extra___bit 14
1269#define reg_iop_sw_mpu_r_intr_grp2___dmc_in0___lsb 15
1270#define reg_iop_sw_mpu_r_intr_grp2___dmc_in0___width 1
1271#define reg_iop_sw_mpu_r_intr_grp2___dmc_in0___bit 15
1272#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr10___lsb 16
1273#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr10___width 1
1274#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr10___bit 16
1275#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr10___lsb 17
1276#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr10___width 1
1277#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr10___bit 17
1278#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp2___lsb 18
1279#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp2___width 1
1280#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp2___bit 18
1281#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp4___lsb 19
1282#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp4___width 1
1283#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp4___bit 19
1284#define reg_iop_sw_mpu_r_intr_grp2___timer_grp2___lsb 20
1285#define reg_iop_sw_mpu_r_intr_grp2___timer_grp2___width 1
1286#define reg_iop_sw_mpu_r_intr_grp2___timer_grp2___bit 20
1287#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0___lsb 21
1288#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0___width 1
1289#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0___bit 21
1290#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0_extra___lsb 22
1291#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0_extra___width 1
1292#define reg_iop_sw_mpu_r_intr_grp2___fifo_out0_extra___bit 22
1293#define reg_iop_sw_mpu_r_intr_grp2___dmc_out1___lsb 23
1294#define reg_iop_sw_mpu_r_intr_grp2___dmc_out1___width 1
1295#define reg_iop_sw_mpu_r_intr_grp2___dmc_out1___bit 23
1296#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr11___lsb 24
1297#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr11___width 1
1298#define reg_iop_sw_mpu_r_intr_grp2___spu0_intr11___bit 24
1299#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr11___lsb 25
1300#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr11___width 1
1301#define reg_iop_sw_mpu_r_intr_grp2___spu1_intr11___bit 25
1302#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp3___lsb 26
1303#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp3___width 1
1304#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp3___bit 26
1305#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp5___lsb 27
1306#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp5___width 1
1307#define reg_iop_sw_mpu_r_intr_grp2___trigger_grp5___bit 27
1308#define reg_iop_sw_mpu_r_intr_grp2___timer_grp3___lsb 28
1309#define reg_iop_sw_mpu_r_intr_grp2___timer_grp3___width 1
1310#define reg_iop_sw_mpu_r_intr_grp2___timer_grp3___bit 28
1311#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0___lsb 29
1312#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0___width 1
1313#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0___bit 29
1314#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0_extra___lsb 30
1315#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0_extra___width 1
1316#define reg_iop_sw_mpu_r_intr_grp2___fifo_in0_extra___bit 30
1317#define reg_iop_sw_mpu_r_intr_grp2___dmc_in1___lsb 31
1318#define reg_iop_sw_mpu_r_intr_grp2___dmc_in1___width 1
1319#define reg_iop_sw_mpu_r_intr_grp2___dmc_in1___bit 31
1320#define reg_iop_sw_mpu_r_intr_grp2_offset 136
1321
1322/* Register r_masked_intr_grp2, scope iop_sw_mpu, type r */
1323#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr8___lsb 0
1324#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr8___width 1
1325#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr8___bit 0
1326#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr8___lsb 1
1327#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr8___width 1
1328#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr8___bit 1
1329#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp0___lsb 2
1330#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp0___width 1
1331#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp0___bit 2
1332#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp6___lsb 3
1333#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp6___width 1
1334#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp6___bit 3
1335#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp0___lsb 4
1336#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp0___width 1
1337#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp0___bit 4
1338#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1___lsb 5
1339#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1___width 1
1340#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1___bit 5
1341#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1_extra___lsb 6
1342#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1_extra___width 1
1343#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out1_extra___bit 6
1344#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out0___lsb 7
1345#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out0___width 1
1346#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out0___bit 7
1347#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr9___lsb 8
1348#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr9___width 1
1349#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr9___bit 8
1350#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr9___lsb 9
1351#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr9___width 1
1352#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr9___bit 9
1353#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp1___lsb 10
1354#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp1___width 1
1355#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp1___bit 10
1356#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp7___lsb 11
1357#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp7___width 1
1358#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp7___bit 11
1359#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp1___lsb 12
1360#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp1___width 1
1361#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp1___bit 12
1362#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1___lsb 13
1363#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1___width 1
1364#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1___bit 13
1365#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1_extra___lsb 14
1366#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1_extra___width 1
1367#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in1_extra___bit 14
1368#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in0___lsb 15
1369#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in0___width 1
1370#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in0___bit 15
1371#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr10___lsb 16
1372#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr10___width 1
1373#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr10___bit 16
1374#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr10___lsb 17
1375#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr10___width 1
1376#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr10___bit 17
1377#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp2___lsb 18
1378#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp2___width 1
1379#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp2___bit 18
1380#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp4___lsb 19
1381#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp4___width 1
1382#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp4___bit 19
1383#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp2___lsb 20
1384#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp2___width 1
1385#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp2___bit 20
1386#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0___lsb 21
1387#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0___width 1
1388#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0___bit 21
1389#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0_extra___lsb 22
1390#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0_extra___width 1
1391#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_out0_extra___bit 22
1392#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out1___lsb 23
1393#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out1___width 1
1394#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_out1___bit 23
1395#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr11___lsb 24
1396#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr11___width 1
1397#define reg_iop_sw_mpu_r_masked_intr_grp2___spu0_intr11___bit 24
1398#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr11___lsb 25
1399#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr11___width 1
1400#define reg_iop_sw_mpu_r_masked_intr_grp2___spu1_intr11___bit 25
1401#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp3___lsb 26
1402#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp3___width 1
1403#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp3___bit 26
1404#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp5___lsb 27
1405#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp5___width 1
1406#define reg_iop_sw_mpu_r_masked_intr_grp2___trigger_grp5___bit 27
1407#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp3___lsb 28
1408#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp3___width 1
1409#define reg_iop_sw_mpu_r_masked_intr_grp2___timer_grp3___bit 28
1410#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0___lsb 29
1411#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0___width 1
1412#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0___bit 29
1413#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0_extra___lsb 30
1414#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0_extra___width 1
1415#define reg_iop_sw_mpu_r_masked_intr_grp2___fifo_in0_extra___bit 30
1416#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in1___lsb 31
1417#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in1___width 1
1418#define reg_iop_sw_mpu_r_masked_intr_grp2___dmc_in1___bit 31
1419#define reg_iop_sw_mpu_r_masked_intr_grp2_offset 140
1420
1421/* Register rw_intr_grp3_mask, scope iop_sw_mpu, type rw */
1422#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr12___lsb 0
1423#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr12___width 1
1424#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr12___bit 0
1425#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr12___lsb 1
1426#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr12___width 1
1427#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr12___bit 1
1428#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp0___lsb 2
1429#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp0___width 1
1430#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp0___bit 2
1431#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp7___lsb 3
1432#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp7___width 1
1433#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp7___bit 3
1434#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp0___lsb 4
1435#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp0___width 1
1436#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp0___bit 4
1437#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1___lsb 5
1438#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1___width 1
1439#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1___bit 5
1440#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1_extra___lsb 6
1441#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1_extra___width 1
1442#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in1_extra___bit 6
1443#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out0___lsb 7
1444#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out0___width 1
1445#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out0___bit 7
1446#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr13___lsb 8
1447#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr13___width 1
1448#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr13___bit 8
1449#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr13___lsb 9
1450#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr13___width 1
1451#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr13___bit 9
1452#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp1___lsb 10
1453#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp1___width 1
1454#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp1___bit 10
1455#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp4___lsb 11
1456#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp4___width 1
1457#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp4___bit 11
1458#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp1___lsb 12
1459#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp1___width 1
1460#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp1___bit 12
1461#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0___lsb 13
1462#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0___width 1
1463#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0___bit 13
1464#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0_extra___lsb 14
1465#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0_extra___width 1
1466#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out0_extra___bit 14
1467#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in0___lsb 15
1468#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in0___width 1
1469#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in0___bit 15
1470#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr14___lsb 16
1471#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr14___width 1
1472#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr14___bit 16
1473#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr14___lsb 17
1474#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr14___width 1
1475#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr14___bit 17
1476#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp2___lsb 18
1477#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp2___width 1
1478#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp2___bit 18
1479#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp5___lsb 19
1480#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp5___width 1
1481#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp5___bit 19
1482#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp2___lsb 20
1483#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp2___width 1
1484#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp2___bit 20
1485#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0___lsb 21
1486#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0___width 1
1487#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0___bit 21
1488#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0_extra___lsb 22
1489#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0_extra___width 1
1490#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_in0_extra___bit 22
1491#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out1___lsb 23
1492#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out1___width 1
1493#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_out1___bit 23
1494#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr15___lsb 24
1495#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr15___width 1
1496#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu0_intr15___bit 24
1497#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr15___lsb 25
1498#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr15___width 1
1499#define reg_iop_sw_mpu_rw_intr_grp3_mask___spu1_intr15___bit 25
1500#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp3___lsb 26
1501#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp3___width 1
1502#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp3___bit 26
1503#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp6___lsb 27
1504#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp6___width 1
1505#define reg_iop_sw_mpu_rw_intr_grp3_mask___trigger_grp6___bit 27
1506#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp3___lsb 28
1507#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp3___width 1
1508#define reg_iop_sw_mpu_rw_intr_grp3_mask___timer_grp3___bit 28
1509#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1___lsb 29
1510#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1___width 1
1511#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1___bit 29
1512#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1_extra___lsb 30
1513#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1_extra___width 1
1514#define reg_iop_sw_mpu_rw_intr_grp3_mask___fifo_out1_extra___bit 30
1515#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in1___lsb 31
1516#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in1___width 1
1517#define reg_iop_sw_mpu_rw_intr_grp3_mask___dmc_in1___bit 31
1518#define reg_iop_sw_mpu_rw_intr_grp3_mask_offset 144
1519
1520/* Register rw_ack_intr_grp3, scope iop_sw_mpu, type rw */
1521#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr12___lsb 0
1522#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr12___width 1
1523#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr12___bit 0
1524#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr12___lsb 1
1525#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr12___width 1
1526#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr12___bit 1
1527#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr13___lsb 8
1528#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr13___width 1
1529#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr13___bit 8
1530#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr13___lsb 9
1531#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr13___width 1
1532#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr13___bit 9
1533#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr14___lsb 16
1534#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr14___width 1
1535#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr14___bit 16
1536#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr14___lsb 17
1537#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr14___width 1
1538#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr14___bit 17
1539#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr15___lsb 24
1540#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr15___width 1
1541#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu0_intr15___bit 24
1542#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr15___lsb 25
1543#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr15___width 1
1544#define reg_iop_sw_mpu_rw_ack_intr_grp3___spu1_intr15___bit 25
1545#define reg_iop_sw_mpu_rw_ack_intr_grp3_offset 148
1546
1547/* Register r_intr_grp3, scope iop_sw_mpu, type r */
1548#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr12___lsb 0
1549#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr12___width 1
1550#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr12___bit 0
1551#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr12___lsb 1
1552#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr12___width 1
1553#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr12___bit 1
1554#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp0___lsb 2
1555#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp0___width 1
1556#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp0___bit 2
1557#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp7___lsb 3
1558#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp7___width 1
1559#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp7___bit 3
1560#define reg_iop_sw_mpu_r_intr_grp3___timer_grp0___lsb 4
1561#define reg_iop_sw_mpu_r_intr_grp3___timer_grp0___width 1
1562#define reg_iop_sw_mpu_r_intr_grp3___timer_grp0___bit 4
1563#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1___lsb 5
1564#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1___width 1
1565#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1___bit 5
1566#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1_extra___lsb 6
1567#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1_extra___width 1
1568#define reg_iop_sw_mpu_r_intr_grp3___fifo_in1_extra___bit 6
1569#define reg_iop_sw_mpu_r_intr_grp3___dmc_out0___lsb 7
1570#define reg_iop_sw_mpu_r_intr_grp3___dmc_out0___width 1
1571#define reg_iop_sw_mpu_r_intr_grp3___dmc_out0___bit 7
1572#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr13___lsb 8
1573#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr13___width 1
1574#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr13___bit 8
1575#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr13___lsb 9
1576#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr13___width 1
1577#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr13___bit 9
1578#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp1___lsb 10
1579#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp1___width 1
1580#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp1___bit 10
1581#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp4___lsb 11
1582#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp4___width 1
1583#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp4___bit 11
1584#define reg_iop_sw_mpu_r_intr_grp3___timer_grp1___lsb 12
1585#define reg_iop_sw_mpu_r_intr_grp3___timer_grp1___width 1
1586#define reg_iop_sw_mpu_r_intr_grp3___timer_grp1___bit 12
1587#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0___lsb 13
1588#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0___width 1
1589#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0___bit 13
1590#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0_extra___lsb 14
1591#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0_extra___width 1
1592#define reg_iop_sw_mpu_r_intr_grp3___fifo_out0_extra___bit 14
1593#define reg_iop_sw_mpu_r_intr_grp3___dmc_in0___lsb 15
1594#define reg_iop_sw_mpu_r_intr_grp3___dmc_in0___width 1
1595#define reg_iop_sw_mpu_r_intr_grp3___dmc_in0___bit 15
1596#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr14___lsb 16
1597#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr14___width 1
1598#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr14___bit 16
1599#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr14___lsb 17
1600#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr14___width 1
1601#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr14___bit 17
1602#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp2___lsb 18
1603#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp2___width 1
1604#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp2___bit 18
1605#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp5___lsb 19
1606#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp5___width 1
1607#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp5___bit 19
1608#define reg_iop_sw_mpu_r_intr_grp3___timer_grp2___lsb 20
1609#define reg_iop_sw_mpu_r_intr_grp3___timer_grp2___width 1
1610#define reg_iop_sw_mpu_r_intr_grp3___timer_grp2___bit 20
1611#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0___lsb 21
1612#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0___width 1
1613#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0___bit 21
1614#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0_extra___lsb 22
1615#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0_extra___width 1
1616#define reg_iop_sw_mpu_r_intr_grp3___fifo_in0_extra___bit 22
1617#define reg_iop_sw_mpu_r_intr_grp3___dmc_out1___lsb 23
1618#define reg_iop_sw_mpu_r_intr_grp3___dmc_out1___width 1
1619#define reg_iop_sw_mpu_r_intr_grp3___dmc_out1___bit 23
1620#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr15___lsb 24
1621#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr15___width 1
1622#define reg_iop_sw_mpu_r_intr_grp3___spu0_intr15___bit 24
1623#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr15___lsb 25
1624#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr15___width 1
1625#define reg_iop_sw_mpu_r_intr_grp3___spu1_intr15___bit 25
1626#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp3___lsb 26
1627#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp3___width 1
1628#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp3___bit 26
1629#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp6___lsb 27
1630#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp6___width 1
1631#define reg_iop_sw_mpu_r_intr_grp3___trigger_grp6___bit 27
1632#define reg_iop_sw_mpu_r_intr_grp3___timer_grp3___lsb 28
1633#define reg_iop_sw_mpu_r_intr_grp3___timer_grp3___width 1
1634#define reg_iop_sw_mpu_r_intr_grp3___timer_grp3___bit 28
1635#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1___lsb 29
1636#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1___width 1
1637#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1___bit 29
1638#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1_extra___lsb 30
1639#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1_extra___width 1
1640#define reg_iop_sw_mpu_r_intr_grp3___fifo_out1_extra___bit 30
1641#define reg_iop_sw_mpu_r_intr_grp3___dmc_in1___lsb 31
1642#define reg_iop_sw_mpu_r_intr_grp3___dmc_in1___width 1
1643#define reg_iop_sw_mpu_r_intr_grp3___dmc_in1___bit 31
1644#define reg_iop_sw_mpu_r_intr_grp3_offset 152
1645
1646/* Register r_masked_intr_grp3, scope iop_sw_mpu, type r */
1647#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr12___lsb 0
1648#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr12___width 1
1649#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr12___bit 0
1650#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr12___lsb 1
1651#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr12___width 1
1652#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr12___bit 1
1653#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp0___lsb 2
1654#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp0___width 1
1655#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp0___bit 2
1656#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp7___lsb 3
1657#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp7___width 1
1658#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp7___bit 3
1659#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp0___lsb 4
1660#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp0___width 1
1661#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp0___bit 4
1662#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1___lsb 5
1663#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1___width 1
1664#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1___bit 5
1665#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1_extra___lsb 6
1666#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1_extra___width 1
1667#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in1_extra___bit 6
1668#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out0___lsb 7
1669#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out0___width 1
1670#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out0___bit 7
1671#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr13___lsb 8
1672#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr13___width 1
1673#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr13___bit 8
1674#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr13___lsb 9
1675#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr13___width 1
1676#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr13___bit 9
1677#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp1___lsb 10
1678#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp1___width 1
1679#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp1___bit 10
1680#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp4___lsb 11
1681#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp4___width 1
1682#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp4___bit 11
1683#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp1___lsb 12
1684#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp1___width 1
1685#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp1___bit 12
1686#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0___lsb 13
1687#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0___width 1
1688#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0___bit 13
1689#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0_extra___lsb 14
1690#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0_extra___width 1
1691#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out0_extra___bit 14
1692#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in0___lsb 15
1693#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in0___width 1
1694#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in0___bit 15
1695#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr14___lsb 16
1696#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr14___width 1
1697#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr14___bit 16
1698#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr14___lsb 17
1699#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr14___width 1
1700#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr14___bit 17
1701#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp2___lsb 18
1702#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp2___width 1
1703#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp2___bit 18
1704#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp5___lsb 19
1705#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp5___width 1
1706#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp5___bit 19
1707#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp2___lsb 20
1708#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp2___width 1
1709#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp2___bit 20
1710#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0___lsb 21
1711#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0___width 1
1712#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0___bit 21
1713#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0_extra___lsb 22
1714#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0_extra___width 1
1715#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_in0_extra___bit 22
1716#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out1___lsb 23
1717#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out1___width 1
1718#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_out1___bit 23
1719#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr15___lsb 24
1720#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr15___width 1
1721#define reg_iop_sw_mpu_r_masked_intr_grp3___spu0_intr15___bit 24
1722#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr15___lsb 25
1723#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr15___width 1
1724#define reg_iop_sw_mpu_r_masked_intr_grp3___spu1_intr15___bit 25
1725#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp3___lsb 26
1726#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp3___width 1
1727#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp3___bit 26
1728#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp6___lsb 27
1729#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp6___width 1
1730#define reg_iop_sw_mpu_r_masked_intr_grp3___trigger_grp6___bit 27
1731#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp3___lsb 28
1732#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp3___width 1
1733#define reg_iop_sw_mpu_r_masked_intr_grp3___timer_grp3___bit 28
1734#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1___lsb 29
1735#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1___width 1
1736#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1___bit 29
1737#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1_extra___lsb 30
1738#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1_extra___width 1
1739#define reg_iop_sw_mpu_r_masked_intr_grp3___fifo_out1_extra___bit 30
1740#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in1___lsb 31
1741#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in1___width 1
1742#define reg_iop_sw_mpu_r_masked_intr_grp3___dmc_in1___bit 31
1743#define reg_iop_sw_mpu_r_masked_intr_grp3_offset 156
1744
1745
1746/* Constants */
1747#define regk_iop_sw_mpu_copy 0x00000000
1748#define regk_iop_sw_mpu_cpu 0x00000000
1749#define regk_iop_sw_mpu_mpu 0x00000001
1750#define regk_iop_sw_mpu_no 0x00000000
1751#define regk_iop_sw_mpu_nop 0x00000000
1752#define regk_iop_sw_mpu_rd 0x00000002
1753#define regk_iop_sw_mpu_reg_copy 0x00000001
1754#define regk_iop_sw_mpu_rw_bus0_clr_mask_default 0x00000000
1755#define regk_iop_sw_mpu_rw_bus0_oe_clr_mask_default 0x00000000
1756#define regk_iop_sw_mpu_rw_bus0_oe_set_mask_default 0x00000000
1757#define regk_iop_sw_mpu_rw_bus0_set_mask_default 0x00000000
1758#define regk_iop_sw_mpu_rw_bus1_clr_mask_default 0x00000000
1759#define regk_iop_sw_mpu_rw_bus1_oe_clr_mask_default 0x00000000
1760#define regk_iop_sw_mpu_rw_bus1_oe_set_mask_default 0x00000000
1761#define regk_iop_sw_mpu_rw_bus1_set_mask_default 0x00000000
1762#define regk_iop_sw_mpu_rw_gio_clr_mask_default 0x00000000
1763#define regk_iop_sw_mpu_rw_gio_oe_clr_mask_default 0x00000000
1764#define regk_iop_sw_mpu_rw_gio_oe_set_mask_default 0x00000000
1765#define regk_iop_sw_mpu_rw_gio_set_mask_default 0x00000000
1766#define regk_iop_sw_mpu_rw_intr_grp0_mask_default 0x00000000
1767#define regk_iop_sw_mpu_rw_intr_grp1_mask_default 0x00000000
1768#define regk_iop_sw_mpu_rw_intr_grp2_mask_default 0x00000000
1769#define regk_iop_sw_mpu_rw_intr_grp3_mask_default 0x00000000
1770#define regk_iop_sw_mpu_rw_sw_cfg_owner_default 0x00000000
1771#define regk_iop_sw_mpu_set 0x00000001
1772#define regk_iop_sw_mpu_spu0 0x00000002
1773#define regk_iop_sw_mpu_spu1 0x00000003
1774#define regk_iop_sw_mpu_wr 0x00000003
1775#define regk_iop_sw_mpu_yes 0x00000001
1776#endif /* __iop_sw_mpu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_spu_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_spu_defs_asm.h
new file mode 100644
index 000000000000..0929f144cfa1
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_spu_defs_asm.h
@@ -0,0 +1,691 @@
1#ifndef __iop_sw_spu_defs_asm_h
2#define __iop_sw_spu_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_spu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_sw_spu_defs_asm.h ../../inst/io_proc/rtl/guinness/iop_sw_spu.r
11 * id: $Id: iop_sw_spu_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_mc_ctrl, scope iop_sw_spu, type rw */
57#define reg_iop_sw_spu_rw_mc_ctrl___keep_owner___lsb 0
58#define reg_iop_sw_spu_rw_mc_ctrl___keep_owner___width 1
59#define reg_iop_sw_spu_rw_mc_ctrl___keep_owner___bit 0
60#define reg_iop_sw_spu_rw_mc_ctrl___cmd___lsb 1
61#define reg_iop_sw_spu_rw_mc_ctrl___cmd___width 2
62#define reg_iop_sw_spu_rw_mc_ctrl___size___lsb 3
63#define reg_iop_sw_spu_rw_mc_ctrl___size___width 3
64#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu0_mem___lsb 6
65#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu0_mem___width 1
66#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu0_mem___bit 6
67#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu1_mem___lsb 7
68#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu1_mem___width 1
69#define reg_iop_sw_spu_rw_mc_ctrl___wr_spu1_mem___bit 7
70#define reg_iop_sw_spu_rw_mc_ctrl_offset 0
71
72/* Register rw_mc_data, scope iop_sw_spu, type rw */
73#define reg_iop_sw_spu_rw_mc_data___val___lsb 0
74#define reg_iop_sw_spu_rw_mc_data___val___width 32
75#define reg_iop_sw_spu_rw_mc_data_offset 4
76
77/* Register rw_mc_addr, scope iop_sw_spu, type rw */
78#define reg_iop_sw_spu_rw_mc_addr_offset 8
79
80/* Register rs_mc_data, scope iop_sw_spu, type rs */
81#define reg_iop_sw_spu_rs_mc_data_offset 12
82
83/* Register r_mc_data, scope iop_sw_spu, type r */
84#define reg_iop_sw_spu_r_mc_data_offset 16
85
86/* Register r_mc_stat, scope iop_sw_spu, type r */
87#define reg_iop_sw_spu_r_mc_stat___busy_cpu___lsb 0
88#define reg_iop_sw_spu_r_mc_stat___busy_cpu___width 1
89#define reg_iop_sw_spu_r_mc_stat___busy_cpu___bit 0
90#define reg_iop_sw_spu_r_mc_stat___busy_mpu___lsb 1
91#define reg_iop_sw_spu_r_mc_stat___busy_mpu___width 1
92#define reg_iop_sw_spu_r_mc_stat___busy_mpu___bit 1
93#define reg_iop_sw_spu_r_mc_stat___busy_spu0___lsb 2
94#define reg_iop_sw_spu_r_mc_stat___busy_spu0___width 1
95#define reg_iop_sw_spu_r_mc_stat___busy_spu0___bit 2
96#define reg_iop_sw_spu_r_mc_stat___busy_spu1___lsb 3
97#define reg_iop_sw_spu_r_mc_stat___busy_spu1___width 1
98#define reg_iop_sw_spu_r_mc_stat___busy_spu1___bit 3
99#define reg_iop_sw_spu_r_mc_stat___owned_by_cpu___lsb 4
100#define reg_iop_sw_spu_r_mc_stat___owned_by_cpu___width 1
101#define reg_iop_sw_spu_r_mc_stat___owned_by_cpu___bit 4
102#define reg_iop_sw_spu_r_mc_stat___owned_by_mpu___lsb 5
103#define reg_iop_sw_spu_r_mc_stat___owned_by_mpu___width 1
104#define reg_iop_sw_spu_r_mc_stat___owned_by_mpu___bit 5
105#define reg_iop_sw_spu_r_mc_stat___owned_by_spu0___lsb 6
106#define reg_iop_sw_spu_r_mc_stat___owned_by_spu0___width 1
107#define reg_iop_sw_spu_r_mc_stat___owned_by_spu0___bit 6
108#define reg_iop_sw_spu_r_mc_stat___owned_by_spu1___lsb 7
109#define reg_iop_sw_spu_r_mc_stat___owned_by_spu1___width 1
110#define reg_iop_sw_spu_r_mc_stat___owned_by_spu1___bit 7
111#define reg_iop_sw_spu_r_mc_stat_offset 20
112
113/* Register rw_bus0_clr_mask, scope iop_sw_spu, type rw */
114#define reg_iop_sw_spu_rw_bus0_clr_mask___byte0___lsb 0
115#define reg_iop_sw_spu_rw_bus0_clr_mask___byte0___width 8
116#define reg_iop_sw_spu_rw_bus0_clr_mask___byte1___lsb 8
117#define reg_iop_sw_spu_rw_bus0_clr_mask___byte1___width 8
118#define reg_iop_sw_spu_rw_bus0_clr_mask___byte2___lsb 16
119#define reg_iop_sw_spu_rw_bus0_clr_mask___byte2___width 8
120#define reg_iop_sw_spu_rw_bus0_clr_mask___byte3___lsb 24
121#define reg_iop_sw_spu_rw_bus0_clr_mask___byte3___width 8
122#define reg_iop_sw_spu_rw_bus0_clr_mask_offset 24
123
124/* Register rw_bus0_set_mask, scope iop_sw_spu, type rw */
125#define reg_iop_sw_spu_rw_bus0_set_mask___byte0___lsb 0
126#define reg_iop_sw_spu_rw_bus0_set_mask___byte0___width 8
127#define reg_iop_sw_spu_rw_bus0_set_mask___byte1___lsb 8
128#define reg_iop_sw_spu_rw_bus0_set_mask___byte1___width 8
129#define reg_iop_sw_spu_rw_bus0_set_mask___byte2___lsb 16
130#define reg_iop_sw_spu_rw_bus0_set_mask___byte2___width 8
131#define reg_iop_sw_spu_rw_bus0_set_mask___byte3___lsb 24
132#define reg_iop_sw_spu_rw_bus0_set_mask___byte3___width 8
133#define reg_iop_sw_spu_rw_bus0_set_mask_offset 28
134
135/* Register rw_bus0_oe_clr_mask, scope iop_sw_spu, type rw */
136#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte0___lsb 0
137#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte0___width 1
138#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte0___bit 0
139#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte1___lsb 1
140#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte1___width 1
141#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte1___bit 1
142#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte2___lsb 2
143#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte2___width 1
144#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte2___bit 2
145#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte3___lsb 3
146#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte3___width 1
147#define reg_iop_sw_spu_rw_bus0_oe_clr_mask___byte3___bit 3
148#define reg_iop_sw_spu_rw_bus0_oe_clr_mask_offset 32
149
150/* Register rw_bus0_oe_set_mask, scope iop_sw_spu, type rw */
151#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte0___lsb 0
152#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte0___width 1
153#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte0___bit 0
154#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte1___lsb 1
155#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte1___width 1
156#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte1___bit 1
157#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte2___lsb 2
158#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte2___width 1
159#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte2___bit 2
160#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte3___lsb 3
161#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte3___width 1
162#define reg_iop_sw_spu_rw_bus0_oe_set_mask___byte3___bit 3
163#define reg_iop_sw_spu_rw_bus0_oe_set_mask_offset 36
164
165/* Register r_bus0_in, scope iop_sw_spu, type r */
166#define reg_iop_sw_spu_r_bus0_in_offset 40
167
168/* Register rw_bus1_clr_mask, scope iop_sw_spu, type rw */
169#define reg_iop_sw_spu_rw_bus1_clr_mask___byte0___lsb 0
170#define reg_iop_sw_spu_rw_bus1_clr_mask___byte0___width 8
171#define reg_iop_sw_spu_rw_bus1_clr_mask___byte1___lsb 8
172#define reg_iop_sw_spu_rw_bus1_clr_mask___byte1___width 8
173#define reg_iop_sw_spu_rw_bus1_clr_mask___byte2___lsb 16
174#define reg_iop_sw_spu_rw_bus1_clr_mask___byte2___width 8
175#define reg_iop_sw_spu_rw_bus1_clr_mask___byte3___lsb 24
176#define reg_iop_sw_spu_rw_bus1_clr_mask___byte3___width 8
177#define reg_iop_sw_spu_rw_bus1_clr_mask_offset 44
178
179/* Register rw_bus1_set_mask, scope iop_sw_spu, type rw */
180#define reg_iop_sw_spu_rw_bus1_set_mask___byte0___lsb 0
181#define reg_iop_sw_spu_rw_bus1_set_mask___byte0___width 8
182#define reg_iop_sw_spu_rw_bus1_set_mask___byte1___lsb 8
183#define reg_iop_sw_spu_rw_bus1_set_mask___byte1___width 8
184#define reg_iop_sw_spu_rw_bus1_set_mask___byte2___lsb 16
185#define reg_iop_sw_spu_rw_bus1_set_mask___byte2___width 8
186#define reg_iop_sw_spu_rw_bus1_set_mask___byte3___lsb 24
187#define reg_iop_sw_spu_rw_bus1_set_mask___byte3___width 8
188#define reg_iop_sw_spu_rw_bus1_set_mask_offset 48
189
190/* Register rw_bus1_oe_clr_mask, scope iop_sw_spu, type rw */
191#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte0___lsb 0
192#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte0___width 1
193#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte0___bit 0
194#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte1___lsb 1
195#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte1___width 1
196#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte1___bit 1
197#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte2___lsb 2
198#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte2___width 1
199#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte2___bit 2
200#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte3___lsb 3
201#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte3___width 1
202#define reg_iop_sw_spu_rw_bus1_oe_clr_mask___byte3___bit 3
203#define reg_iop_sw_spu_rw_bus1_oe_clr_mask_offset 52
204
205/* Register rw_bus1_oe_set_mask, scope iop_sw_spu, type rw */
206#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte0___lsb 0
207#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte0___width 1
208#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte0___bit 0
209#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte1___lsb 1
210#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte1___width 1
211#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte1___bit 1
212#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte2___lsb 2
213#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte2___width 1
214#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte2___bit 2
215#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte3___lsb 3
216#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte3___width 1
217#define reg_iop_sw_spu_rw_bus1_oe_set_mask___byte3___bit 3
218#define reg_iop_sw_spu_rw_bus1_oe_set_mask_offset 56
219
220/* Register r_bus1_in, scope iop_sw_spu, type r */
221#define reg_iop_sw_spu_r_bus1_in_offset 60
222
223/* Register rw_gio_clr_mask, scope iop_sw_spu, type rw */
224#define reg_iop_sw_spu_rw_gio_clr_mask___val___lsb 0
225#define reg_iop_sw_spu_rw_gio_clr_mask___val___width 32
226#define reg_iop_sw_spu_rw_gio_clr_mask_offset 64
227
228/* Register rw_gio_set_mask, scope iop_sw_spu, type rw */
229#define reg_iop_sw_spu_rw_gio_set_mask___val___lsb 0
230#define reg_iop_sw_spu_rw_gio_set_mask___val___width 32
231#define reg_iop_sw_spu_rw_gio_set_mask_offset 68
232
233/* Register rw_gio_oe_clr_mask, scope iop_sw_spu, type rw */
234#define reg_iop_sw_spu_rw_gio_oe_clr_mask___val___lsb 0
235#define reg_iop_sw_spu_rw_gio_oe_clr_mask___val___width 32
236#define reg_iop_sw_spu_rw_gio_oe_clr_mask_offset 72
237
238/* Register rw_gio_oe_set_mask, scope iop_sw_spu, type rw */
239#define reg_iop_sw_spu_rw_gio_oe_set_mask___val___lsb 0
240#define reg_iop_sw_spu_rw_gio_oe_set_mask___val___width 32
241#define reg_iop_sw_spu_rw_gio_oe_set_mask_offset 76
242
243/* Register r_gio_in, scope iop_sw_spu, type r */
244#define reg_iop_sw_spu_r_gio_in_offset 80
245
246/* Register rw_bus0_clr_mask_lo, scope iop_sw_spu, type rw */
247#define reg_iop_sw_spu_rw_bus0_clr_mask_lo___byte0___lsb 0
248#define reg_iop_sw_spu_rw_bus0_clr_mask_lo___byte0___width 8
249#define reg_iop_sw_spu_rw_bus0_clr_mask_lo___byte1___lsb 8
250#define reg_iop_sw_spu_rw_bus0_clr_mask_lo___byte1___width 8
251#define reg_iop_sw_spu_rw_bus0_clr_mask_lo_offset 84
252
253/* Register rw_bus0_clr_mask_hi, scope iop_sw_spu, type rw */
254#define reg_iop_sw_spu_rw_bus0_clr_mask_hi___byte2___lsb 0
255#define reg_iop_sw_spu_rw_bus0_clr_mask_hi___byte2___width 8
256#define reg_iop_sw_spu_rw_bus0_clr_mask_hi___byte3___lsb 8
257#define reg_iop_sw_spu_rw_bus0_clr_mask_hi___byte3___width 8
258#define reg_iop_sw_spu_rw_bus0_clr_mask_hi_offset 88
259
260/* Register rw_bus0_set_mask_lo, scope iop_sw_spu, type rw */
261#define reg_iop_sw_spu_rw_bus0_set_mask_lo___byte0___lsb 0
262#define reg_iop_sw_spu_rw_bus0_set_mask_lo___byte0___width 8
263#define reg_iop_sw_spu_rw_bus0_set_mask_lo___byte1___lsb 8
264#define reg_iop_sw_spu_rw_bus0_set_mask_lo___byte1___width 8
265#define reg_iop_sw_spu_rw_bus0_set_mask_lo_offset 92
266
267/* Register rw_bus0_set_mask_hi, scope iop_sw_spu, type rw */
268#define reg_iop_sw_spu_rw_bus0_set_mask_hi___byte2___lsb 0
269#define reg_iop_sw_spu_rw_bus0_set_mask_hi___byte2___width 8
270#define reg_iop_sw_spu_rw_bus0_set_mask_hi___byte3___lsb 8
271#define reg_iop_sw_spu_rw_bus0_set_mask_hi___byte3___width 8
272#define reg_iop_sw_spu_rw_bus0_set_mask_hi_offset 96
273
274/* Register rw_bus1_clr_mask_lo, scope iop_sw_spu, type rw */
275#define reg_iop_sw_spu_rw_bus1_clr_mask_lo___byte0___lsb 0
276#define reg_iop_sw_spu_rw_bus1_clr_mask_lo___byte0___width 8
277#define reg_iop_sw_spu_rw_bus1_clr_mask_lo___byte1___lsb 8
278#define reg_iop_sw_spu_rw_bus1_clr_mask_lo___byte1___width 8
279#define reg_iop_sw_spu_rw_bus1_clr_mask_lo_offset 100
280
281/* Register rw_bus1_clr_mask_hi, scope iop_sw_spu, type rw */
282#define reg_iop_sw_spu_rw_bus1_clr_mask_hi___byte2___lsb 0
283#define reg_iop_sw_spu_rw_bus1_clr_mask_hi___byte2___width 8
284#define reg_iop_sw_spu_rw_bus1_clr_mask_hi___byte3___lsb 8
285#define reg_iop_sw_spu_rw_bus1_clr_mask_hi___byte3___width 8
286#define reg_iop_sw_spu_rw_bus1_clr_mask_hi_offset 104
287
288/* Register rw_bus1_set_mask_lo, scope iop_sw_spu, type rw */
289#define reg_iop_sw_spu_rw_bus1_set_mask_lo___byte0___lsb 0
290#define reg_iop_sw_spu_rw_bus1_set_mask_lo___byte0___width 8
291#define reg_iop_sw_spu_rw_bus1_set_mask_lo___byte1___lsb 8
292#define reg_iop_sw_spu_rw_bus1_set_mask_lo___byte1___width 8
293#define reg_iop_sw_spu_rw_bus1_set_mask_lo_offset 108
294
295/* Register rw_bus1_set_mask_hi, scope iop_sw_spu, type rw */
296#define reg_iop_sw_spu_rw_bus1_set_mask_hi___byte2___lsb 0
297#define reg_iop_sw_spu_rw_bus1_set_mask_hi___byte2___width 8
298#define reg_iop_sw_spu_rw_bus1_set_mask_hi___byte3___lsb 8
299#define reg_iop_sw_spu_rw_bus1_set_mask_hi___byte3___width 8
300#define reg_iop_sw_spu_rw_bus1_set_mask_hi_offset 112
301
302/* Register rw_gio_clr_mask_lo, scope iop_sw_spu, type rw */
303#define reg_iop_sw_spu_rw_gio_clr_mask_lo___val___lsb 0
304#define reg_iop_sw_spu_rw_gio_clr_mask_lo___val___width 16
305#define reg_iop_sw_spu_rw_gio_clr_mask_lo_offset 116
306
307/* Register rw_gio_clr_mask_hi, scope iop_sw_spu, type rw */
308#define reg_iop_sw_spu_rw_gio_clr_mask_hi___val___lsb 0
309#define reg_iop_sw_spu_rw_gio_clr_mask_hi___val___width 16
310#define reg_iop_sw_spu_rw_gio_clr_mask_hi_offset 120
311
312/* Register rw_gio_set_mask_lo, scope iop_sw_spu, type rw */
313#define reg_iop_sw_spu_rw_gio_set_mask_lo___val___lsb 0
314#define reg_iop_sw_spu_rw_gio_set_mask_lo___val___width 16
315#define reg_iop_sw_spu_rw_gio_set_mask_lo_offset 124
316
317/* Register rw_gio_set_mask_hi, scope iop_sw_spu, type rw */
318#define reg_iop_sw_spu_rw_gio_set_mask_hi___val___lsb 0
319#define reg_iop_sw_spu_rw_gio_set_mask_hi___val___width 16
320#define reg_iop_sw_spu_rw_gio_set_mask_hi_offset 128
321
322/* Register rw_gio_oe_clr_mask_lo, scope iop_sw_spu, type rw */
323#define reg_iop_sw_spu_rw_gio_oe_clr_mask_lo___val___lsb 0
324#define reg_iop_sw_spu_rw_gio_oe_clr_mask_lo___val___width 16
325#define reg_iop_sw_spu_rw_gio_oe_clr_mask_lo_offset 132
326
327/* Register rw_gio_oe_clr_mask_hi, scope iop_sw_spu, type rw */
328#define reg_iop_sw_spu_rw_gio_oe_clr_mask_hi___val___lsb 0
329#define reg_iop_sw_spu_rw_gio_oe_clr_mask_hi___val___width 16
330#define reg_iop_sw_spu_rw_gio_oe_clr_mask_hi_offset 136
331
332/* Register rw_gio_oe_set_mask_lo, scope iop_sw_spu, type rw */
333#define reg_iop_sw_spu_rw_gio_oe_set_mask_lo___val___lsb 0
334#define reg_iop_sw_spu_rw_gio_oe_set_mask_lo___val___width 16
335#define reg_iop_sw_spu_rw_gio_oe_set_mask_lo_offset 140
336
337/* Register rw_gio_oe_set_mask_hi, scope iop_sw_spu, type rw */
338#define reg_iop_sw_spu_rw_gio_oe_set_mask_hi___val___lsb 0
339#define reg_iop_sw_spu_rw_gio_oe_set_mask_hi___val___width 16
340#define reg_iop_sw_spu_rw_gio_oe_set_mask_hi_offset 144
341
342/* Register rw_cpu_intr, scope iop_sw_spu, type rw */
343#define reg_iop_sw_spu_rw_cpu_intr___intr0___lsb 0
344#define reg_iop_sw_spu_rw_cpu_intr___intr0___width 1
345#define reg_iop_sw_spu_rw_cpu_intr___intr0___bit 0
346#define reg_iop_sw_spu_rw_cpu_intr___intr1___lsb 1
347#define reg_iop_sw_spu_rw_cpu_intr___intr1___width 1
348#define reg_iop_sw_spu_rw_cpu_intr___intr1___bit 1
349#define reg_iop_sw_spu_rw_cpu_intr___intr2___lsb 2
350#define reg_iop_sw_spu_rw_cpu_intr___intr2___width 1
351#define reg_iop_sw_spu_rw_cpu_intr___intr2___bit 2
352#define reg_iop_sw_spu_rw_cpu_intr___intr3___lsb 3
353#define reg_iop_sw_spu_rw_cpu_intr___intr3___width 1
354#define reg_iop_sw_spu_rw_cpu_intr___intr3___bit 3
355#define reg_iop_sw_spu_rw_cpu_intr___intr4___lsb 4
356#define reg_iop_sw_spu_rw_cpu_intr___intr4___width 1
357#define reg_iop_sw_spu_rw_cpu_intr___intr4___bit 4
358#define reg_iop_sw_spu_rw_cpu_intr___intr5___lsb 5
359#define reg_iop_sw_spu_rw_cpu_intr___intr5___width 1
360#define reg_iop_sw_spu_rw_cpu_intr___intr5___bit 5
361#define reg_iop_sw_spu_rw_cpu_intr___intr6___lsb 6
362#define reg_iop_sw_spu_rw_cpu_intr___intr6___width 1
363#define reg_iop_sw_spu_rw_cpu_intr___intr6___bit 6
364#define reg_iop_sw_spu_rw_cpu_intr___intr7___lsb 7
365#define reg_iop_sw_spu_rw_cpu_intr___intr7___width 1
366#define reg_iop_sw_spu_rw_cpu_intr___intr7___bit 7
367#define reg_iop_sw_spu_rw_cpu_intr___intr8___lsb 8
368#define reg_iop_sw_spu_rw_cpu_intr___intr8___width 1
369#define reg_iop_sw_spu_rw_cpu_intr___intr8___bit 8
370#define reg_iop_sw_spu_rw_cpu_intr___intr9___lsb 9
371#define reg_iop_sw_spu_rw_cpu_intr___intr9___width 1
372#define reg_iop_sw_spu_rw_cpu_intr___intr9___bit 9
373#define reg_iop_sw_spu_rw_cpu_intr___intr10___lsb 10
374#define reg_iop_sw_spu_rw_cpu_intr___intr10___width 1
375#define reg_iop_sw_spu_rw_cpu_intr___intr10___bit 10
376#define reg_iop_sw_spu_rw_cpu_intr___intr11___lsb 11
377#define reg_iop_sw_spu_rw_cpu_intr___intr11___width 1
378#define reg_iop_sw_spu_rw_cpu_intr___intr11___bit 11
379#define reg_iop_sw_spu_rw_cpu_intr___intr12___lsb 12
380#define reg_iop_sw_spu_rw_cpu_intr___intr12___width 1
381#define reg_iop_sw_spu_rw_cpu_intr___intr12___bit 12
382#define reg_iop_sw_spu_rw_cpu_intr___intr13___lsb 13
383#define reg_iop_sw_spu_rw_cpu_intr___intr13___width 1
384#define reg_iop_sw_spu_rw_cpu_intr___intr13___bit 13
385#define reg_iop_sw_spu_rw_cpu_intr___intr14___lsb 14
386#define reg_iop_sw_spu_rw_cpu_intr___intr14___width 1
387#define reg_iop_sw_spu_rw_cpu_intr___intr14___bit 14
388#define reg_iop_sw_spu_rw_cpu_intr___intr15___lsb 15
389#define reg_iop_sw_spu_rw_cpu_intr___intr15___width 1
390#define reg_iop_sw_spu_rw_cpu_intr___intr15___bit 15
391#define reg_iop_sw_spu_rw_cpu_intr_offset 148
392
393/* Register r_cpu_intr, scope iop_sw_spu, type r */
394#define reg_iop_sw_spu_r_cpu_intr___intr0___lsb 0
395#define reg_iop_sw_spu_r_cpu_intr___intr0___width 1
396#define reg_iop_sw_spu_r_cpu_intr___intr0___bit 0
397#define reg_iop_sw_spu_r_cpu_intr___intr1___lsb 1
398#define reg_iop_sw_spu_r_cpu_intr___intr1___width 1
399#define reg_iop_sw_spu_r_cpu_intr___intr1___bit 1
400#define reg_iop_sw_spu_r_cpu_intr___intr2___lsb 2
401#define reg_iop_sw_spu_r_cpu_intr___intr2___width 1
402#define reg_iop_sw_spu_r_cpu_intr___intr2___bit 2
403#define reg_iop_sw_spu_r_cpu_intr___intr3___lsb 3
404#define reg_iop_sw_spu_r_cpu_intr___intr3___width 1
405#define reg_iop_sw_spu_r_cpu_intr___intr3___bit 3
406#define reg_iop_sw_spu_r_cpu_intr___intr4___lsb 4
407#define reg_iop_sw_spu_r_cpu_intr___intr4___width 1
408#define reg_iop_sw_spu_r_cpu_intr___intr4___bit 4
409#define reg_iop_sw_spu_r_cpu_intr___intr5___lsb 5
410#define reg_iop_sw_spu_r_cpu_intr___intr5___width 1
411#define reg_iop_sw_spu_r_cpu_intr___intr5___bit 5
412#define reg_iop_sw_spu_r_cpu_intr___intr6___lsb 6
413#define reg_iop_sw_spu_r_cpu_intr___intr6___width 1
414#define reg_iop_sw_spu_r_cpu_intr___intr6___bit 6
415#define reg_iop_sw_spu_r_cpu_intr___intr7___lsb 7
416#define reg_iop_sw_spu_r_cpu_intr___intr7___width 1
417#define reg_iop_sw_spu_r_cpu_intr___intr7___bit 7
418#define reg_iop_sw_spu_r_cpu_intr___intr8___lsb 8
419#define reg_iop_sw_spu_r_cpu_intr___intr8___width 1
420#define reg_iop_sw_spu_r_cpu_intr___intr8___bit 8
421#define reg_iop_sw_spu_r_cpu_intr___intr9___lsb 9
422#define reg_iop_sw_spu_r_cpu_intr___intr9___width 1
423#define reg_iop_sw_spu_r_cpu_intr___intr9___bit 9
424#define reg_iop_sw_spu_r_cpu_intr___intr10___lsb 10
425#define reg_iop_sw_spu_r_cpu_intr___intr10___width 1
426#define reg_iop_sw_spu_r_cpu_intr___intr10___bit 10
427#define reg_iop_sw_spu_r_cpu_intr___intr11___lsb 11
428#define reg_iop_sw_spu_r_cpu_intr___intr11___width 1
429#define reg_iop_sw_spu_r_cpu_intr___intr11___bit 11
430#define reg_iop_sw_spu_r_cpu_intr___intr12___lsb 12
431#define reg_iop_sw_spu_r_cpu_intr___intr12___width 1
432#define reg_iop_sw_spu_r_cpu_intr___intr12___bit 12
433#define reg_iop_sw_spu_r_cpu_intr___intr13___lsb 13
434#define reg_iop_sw_spu_r_cpu_intr___intr13___width 1
435#define reg_iop_sw_spu_r_cpu_intr___intr13___bit 13
436#define reg_iop_sw_spu_r_cpu_intr___intr14___lsb 14
437#define reg_iop_sw_spu_r_cpu_intr___intr14___width 1
438#define reg_iop_sw_spu_r_cpu_intr___intr14___bit 14
439#define reg_iop_sw_spu_r_cpu_intr___intr15___lsb 15
440#define reg_iop_sw_spu_r_cpu_intr___intr15___width 1
441#define reg_iop_sw_spu_r_cpu_intr___intr15___bit 15
442#define reg_iop_sw_spu_r_cpu_intr_offset 152
443
444/* Register r_hw_intr, scope iop_sw_spu, type r */
445#define reg_iop_sw_spu_r_hw_intr___trigger_grp0___lsb 0
446#define reg_iop_sw_spu_r_hw_intr___trigger_grp0___width 1
447#define reg_iop_sw_spu_r_hw_intr___trigger_grp0___bit 0
448#define reg_iop_sw_spu_r_hw_intr___trigger_grp1___lsb 1
449#define reg_iop_sw_spu_r_hw_intr___trigger_grp1___width 1
450#define reg_iop_sw_spu_r_hw_intr___trigger_grp1___bit 1
451#define reg_iop_sw_spu_r_hw_intr___trigger_grp2___lsb 2
452#define reg_iop_sw_spu_r_hw_intr___trigger_grp2___width 1
453#define reg_iop_sw_spu_r_hw_intr___trigger_grp2___bit 2
454#define reg_iop_sw_spu_r_hw_intr___trigger_grp3___lsb 3
455#define reg_iop_sw_spu_r_hw_intr___trigger_grp3___width 1
456#define reg_iop_sw_spu_r_hw_intr___trigger_grp3___bit 3
457#define reg_iop_sw_spu_r_hw_intr___trigger_grp4___lsb 4
458#define reg_iop_sw_spu_r_hw_intr___trigger_grp4___width 1
459#define reg_iop_sw_spu_r_hw_intr___trigger_grp4___bit 4
460#define reg_iop_sw_spu_r_hw_intr___trigger_grp5___lsb 5
461#define reg_iop_sw_spu_r_hw_intr___trigger_grp5___width 1
462#define reg_iop_sw_spu_r_hw_intr___trigger_grp5___bit 5
463#define reg_iop_sw_spu_r_hw_intr___trigger_grp6___lsb 6
464#define reg_iop_sw_spu_r_hw_intr___trigger_grp6___width 1
465#define reg_iop_sw_spu_r_hw_intr___trigger_grp6___bit 6
466#define reg_iop_sw_spu_r_hw_intr___trigger_grp7___lsb 7
467#define reg_iop_sw_spu_r_hw_intr___trigger_grp7___width 1
468#define reg_iop_sw_spu_r_hw_intr___trigger_grp7___bit 7
469#define reg_iop_sw_spu_r_hw_intr___timer_grp0___lsb 8
470#define reg_iop_sw_spu_r_hw_intr___timer_grp0___width 1
471#define reg_iop_sw_spu_r_hw_intr___timer_grp0___bit 8
472#define reg_iop_sw_spu_r_hw_intr___timer_grp1___lsb 9
473#define reg_iop_sw_spu_r_hw_intr___timer_grp1___width 1
474#define reg_iop_sw_spu_r_hw_intr___timer_grp1___bit 9
475#define reg_iop_sw_spu_r_hw_intr___timer_grp2___lsb 10
476#define reg_iop_sw_spu_r_hw_intr___timer_grp2___width 1
477#define reg_iop_sw_spu_r_hw_intr___timer_grp2___bit 10
478#define reg_iop_sw_spu_r_hw_intr___timer_grp3___lsb 11
479#define reg_iop_sw_spu_r_hw_intr___timer_grp3___width 1
480#define reg_iop_sw_spu_r_hw_intr___timer_grp3___bit 11
481#define reg_iop_sw_spu_r_hw_intr___fifo_out0___lsb 12
482#define reg_iop_sw_spu_r_hw_intr___fifo_out0___width 1
483#define reg_iop_sw_spu_r_hw_intr___fifo_out0___bit 12
484#define reg_iop_sw_spu_r_hw_intr___fifo_out0_extra___lsb 13
485#define reg_iop_sw_spu_r_hw_intr___fifo_out0_extra___width 1
486#define reg_iop_sw_spu_r_hw_intr___fifo_out0_extra___bit 13
487#define reg_iop_sw_spu_r_hw_intr___fifo_in0___lsb 14
488#define reg_iop_sw_spu_r_hw_intr___fifo_in0___width 1
489#define reg_iop_sw_spu_r_hw_intr___fifo_in0___bit 14
490#define reg_iop_sw_spu_r_hw_intr___fifo_in0_extra___lsb 15
491#define reg_iop_sw_spu_r_hw_intr___fifo_in0_extra___width 1
492#define reg_iop_sw_spu_r_hw_intr___fifo_in0_extra___bit 15
493#define reg_iop_sw_spu_r_hw_intr___fifo_out1___lsb 16
494#define reg_iop_sw_spu_r_hw_intr___fifo_out1___width 1
495#define reg_iop_sw_spu_r_hw_intr___fifo_out1___bit 16
496#define reg_iop_sw_spu_r_hw_intr___fifo_out1_extra___lsb 17
497#define reg_iop_sw_spu_r_hw_intr___fifo_out1_extra___width 1
498#define reg_iop_sw_spu_r_hw_intr___fifo_out1_extra___bit 17
499#define reg_iop_sw_spu_r_hw_intr___fifo_in1___lsb 18
500#define reg_iop_sw_spu_r_hw_intr___fifo_in1___width 1
501#define reg_iop_sw_spu_r_hw_intr___fifo_in1___bit 18
502#define reg_iop_sw_spu_r_hw_intr___fifo_in1_extra___lsb 19
503#define reg_iop_sw_spu_r_hw_intr___fifo_in1_extra___width 1
504#define reg_iop_sw_spu_r_hw_intr___fifo_in1_extra___bit 19
505#define reg_iop_sw_spu_r_hw_intr___dmc_out0___lsb 20
506#define reg_iop_sw_spu_r_hw_intr___dmc_out0___width 1
507#define reg_iop_sw_spu_r_hw_intr___dmc_out0___bit 20
508#define reg_iop_sw_spu_r_hw_intr___dmc_in0___lsb 21
509#define reg_iop_sw_spu_r_hw_intr___dmc_in0___width 1
510#define reg_iop_sw_spu_r_hw_intr___dmc_in0___bit 21
511#define reg_iop_sw_spu_r_hw_intr___dmc_out1___lsb 22
512#define reg_iop_sw_spu_r_hw_intr___dmc_out1___width 1
513#define reg_iop_sw_spu_r_hw_intr___dmc_out1___bit 22
514#define reg_iop_sw_spu_r_hw_intr___dmc_in1___lsb 23
515#define reg_iop_sw_spu_r_hw_intr___dmc_in1___width 1
516#define reg_iop_sw_spu_r_hw_intr___dmc_in1___bit 23
517#define reg_iop_sw_spu_r_hw_intr_offset 156
518
519/* Register rw_mpu_intr, scope iop_sw_spu, type rw */
520#define reg_iop_sw_spu_rw_mpu_intr___intr0___lsb 0
521#define reg_iop_sw_spu_rw_mpu_intr___intr0___width 1
522#define reg_iop_sw_spu_rw_mpu_intr___intr0___bit 0
523#define reg_iop_sw_spu_rw_mpu_intr___intr1___lsb 1
524#define reg_iop_sw_spu_rw_mpu_intr___intr1___width 1
525#define reg_iop_sw_spu_rw_mpu_intr___intr1___bit 1
526#define reg_iop_sw_spu_rw_mpu_intr___intr2___lsb 2
527#define reg_iop_sw_spu_rw_mpu_intr___intr2___width 1
528#define reg_iop_sw_spu_rw_mpu_intr___intr2___bit 2
529#define reg_iop_sw_spu_rw_mpu_intr___intr3___lsb 3
530#define reg_iop_sw_spu_rw_mpu_intr___intr3___width 1
531#define reg_iop_sw_spu_rw_mpu_intr___intr3___bit 3
532#define reg_iop_sw_spu_rw_mpu_intr___intr4___lsb 4
533#define reg_iop_sw_spu_rw_mpu_intr___intr4___width 1
534#define reg_iop_sw_spu_rw_mpu_intr___intr4___bit 4
535#define reg_iop_sw_spu_rw_mpu_intr___intr5___lsb 5
536#define reg_iop_sw_spu_rw_mpu_intr___intr5___width 1
537#define reg_iop_sw_spu_rw_mpu_intr___intr5___bit 5
538#define reg_iop_sw_spu_rw_mpu_intr___intr6___lsb 6
539#define reg_iop_sw_spu_rw_mpu_intr___intr6___width 1
540#define reg_iop_sw_spu_rw_mpu_intr___intr6___bit 6
541#define reg_iop_sw_spu_rw_mpu_intr___intr7___lsb 7
542#define reg_iop_sw_spu_rw_mpu_intr___intr7___width 1
543#define reg_iop_sw_spu_rw_mpu_intr___intr7___bit 7
544#define reg_iop_sw_spu_rw_mpu_intr___intr8___lsb 8
545#define reg_iop_sw_spu_rw_mpu_intr___intr8___width 1
546#define reg_iop_sw_spu_rw_mpu_intr___intr8___bit 8
547#define reg_iop_sw_spu_rw_mpu_intr___intr9___lsb 9
548#define reg_iop_sw_spu_rw_mpu_intr___intr9___width 1
549#define reg_iop_sw_spu_rw_mpu_intr___intr9___bit 9
550#define reg_iop_sw_spu_rw_mpu_intr___intr10___lsb 10
551#define reg_iop_sw_spu_rw_mpu_intr___intr10___width 1
552#define reg_iop_sw_spu_rw_mpu_intr___intr10___bit 10
553#define reg_iop_sw_spu_rw_mpu_intr___intr11___lsb 11
554#define reg_iop_sw_spu_rw_mpu_intr___intr11___width 1
555#define reg_iop_sw_spu_rw_mpu_intr___intr11___bit 11
556#define reg_iop_sw_spu_rw_mpu_intr___intr12___lsb 12
557#define reg_iop_sw_spu_rw_mpu_intr___intr12___width 1
558#define reg_iop_sw_spu_rw_mpu_intr___intr12___bit 12
559#define reg_iop_sw_spu_rw_mpu_intr___intr13___lsb 13
560#define reg_iop_sw_spu_rw_mpu_intr___intr13___width 1
561#define reg_iop_sw_spu_rw_mpu_intr___intr13___bit 13
562#define reg_iop_sw_spu_rw_mpu_intr___intr14___lsb 14
563#define reg_iop_sw_spu_rw_mpu_intr___intr14___width 1
564#define reg_iop_sw_spu_rw_mpu_intr___intr14___bit 14
565#define reg_iop_sw_spu_rw_mpu_intr___intr15___lsb 15
566#define reg_iop_sw_spu_rw_mpu_intr___intr15___width 1
567#define reg_iop_sw_spu_rw_mpu_intr___intr15___bit 15
568#define reg_iop_sw_spu_rw_mpu_intr_offset 160
569
570/* Register r_mpu_intr, scope iop_sw_spu, type r */
571#define reg_iop_sw_spu_r_mpu_intr___intr0___lsb 0
572#define reg_iop_sw_spu_r_mpu_intr___intr0___width 1
573#define reg_iop_sw_spu_r_mpu_intr___intr0___bit 0
574#define reg_iop_sw_spu_r_mpu_intr___intr1___lsb 1
575#define reg_iop_sw_spu_r_mpu_intr___intr1___width 1
576#define reg_iop_sw_spu_r_mpu_intr___intr1___bit 1
577#define reg_iop_sw_spu_r_mpu_intr___intr2___lsb 2
578#define reg_iop_sw_spu_r_mpu_intr___intr2___width 1
579#define reg_iop_sw_spu_r_mpu_intr___intr2___bit 2
580#define reg_iop_sw_spu_r_mpu_intr___intr3___lsb 3
581#define reg_iop_sw_spu_r_mpu_intr___intr3___width 1
582#define reg_iop_sw_spu_r_mpu_intr___intr3___bit 3
583#define reg_iop_sw_spu_r_mpu_intr___intr4___lsb 4
584#define reg_iop_sw_spu_r_mpu_intr___intr4___width 1
585#define reg_iop_sw_spu_r_mpu_intr___intr4___bit 4
586#define reg_iop_sw_spu_r_mpu_intr___intr5___lsb 5
587#define reg_iop_sw_spu_r_mpu_intr___intr5___width 1
588#define reg_iop_sw_spu_r_mpu_intr___intr5___bit 5
589#define reg_iop_sw_spu_r_mpu_intr___intr6___lsb 6
590#define reg_iop_sw_spu_r_mpu_intr___intr6___width 1
591#define reg_iop_sw_spu_r_mpu_intr___intr6___bit 6
592#define reg_iop_sw_spu_r_mpu_intr___intr7___lsb 7
593#define reg_iop_sw_spu_r_mpu_intr___intr7___width 1
594#define reg_iop_sw_spu_r_mpu_intr___intr7___bit 7
595#define reg_iop_sw_spu_r_mpu_intr___intr8___lsb 8
596#define reg_iop_sw_spu_r_mpu_intr___intr8___width 1
597#define reg_iop_sw_spu_r_mpu_intr___intr8___bit 8
598#define reg_iop_sw_spu_r_mpu_intr___intr9___lsb 9
599#define reg_iop_sw_spu_r_mpu_intr___intr9___width 1
600#define reg_iop_sw_spu_r_mpu_intr___intr9___bit 9
601#define reg_iop_sw_spu_r_mpu_intr___intr10___lsb 10
602#define reg_iop_sw_spu_r_mpu_intr___intr10___width 1
603#define reg_iop_sw_spu_r_mpu_intr___intr10___bit 10
604#define reg_iop_sw_spu_r_mpu_intr___intr11___lsb 11
605#define reg_iop_sw_spu_r_mpu_intr___intr11___width 1
606#define reg_iop_sw_spu_r_mpu_intr___intr11___bit 11
607#define reg_iop_sw_spu_r_mpu_intr___intr12___lsb 12
608#define reg_iop_sw_spu_r_mpu_intr___intr12___width 1
609#define reg_iop_sw_spu_r_mpu_intr___intr12___bit 12
610#define reg_iop_sw_spu_r_mpu_intr___intr13___lsb 13
611#define reg_iop_sw_spu_r_mpu_intr___intr13___width 1
612#define reg_iop_sw_spu_r_mpu_intr___intr13___bit 13
613#define reg_iop_sw_spu_r_mpu_intr___intr14___lsb 14
614#define reg_iop_sw_spu_r_mpu_intr___intr14___width 1
615#define reg_iop_sw_spu_r_mpu_intr___intr14___bit 14
616#define reg_iop_sw_spu_r_mpu_intr___intr15___lsb 15
617#define reg_iop_sw_spu_r_mpu_intr___intr15___width 1
618#define reg_iop_sw_spu_r_mpu_intr___intr15___bit 15
619#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr0___lsb 16
620#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr0___width 1
621#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr0___bit 16
622#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr1___lsb 17
623#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr1___width 1
624#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr1___bit 17
625#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr2___lsb 18
626#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr2___width 1
627#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr2___bit 18
628#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr3___lsb 19
629#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr3___width 1
630#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr3___bit 19
631#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr4___lsb 20
632#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr4___width 1
633#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr4___bit 20
634#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr5___lsb 21
635#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr5___width 1
636#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr5___bit 21
637#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr6___lsb 22
638#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr6___width 1
639#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr6___bit 22
640#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr7___lsb 23
641#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr7___width 1
642#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr7___bit 23
643#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr8___lsb 24
644#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr8___width 1
645#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr8___bit 24
646#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr9___lsb 25
647#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr9___width 1
648#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr9___bit 25
649#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr10___lsb 26
650#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr10___width 1
651#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr10___bit 26
652#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr11___lsb 27
653#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr11___width 1
654#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr11___bit 27
655#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr12___lsb 28
656#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr12___width 1
657#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr12___bit 28
658#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr13___lsb 29
659#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr13___width 1
660#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr13___bit 29
661#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr14___lsb 30
662#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr14___width 1
663#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr14___bit 30
664#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr15___lsb 31
665#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr15___width 1
666#define reg_iop_sw_spu_r_mpu_intr___other_spu_intr15___bit 31
667#define reg_iop_sw_spu_r_mpu_intr_offset 164
668
669
670/* Constants */
671#define regk_iop_sw_spu_copy 0x00000000
672#define regk_iop_sw_spu_no 0x00000000
673#define regk_iop_sw_spu_nop 0x00000000
674#define regk_iop_sw_spu_rd 0x00000002
675#define regk_iop_sw_spu_reg_copy 0x00000001
676#define regk_iop_sw_spu_rw_bus0_clr_mask_default 0x00000000
677#define regk_iop_sw_spu_rw_bus0_oe_clr_mask_default 0x00000000
678#define regk_iop_sw_spu_rw_bus0_oe_set_mask_default 0x00000000
679#define regk_iop_sw_spu_rw_bus0_set_mask_default 0x00000000
680#define regk_iop_sw_spu_rw_bus1_clr_mask_default 0x00000000
681#define regk_iop_sw_spu_rw_bus1_oe_clr_mask_default 0x00000000
682#define regk_iop_sw_spu_rw_bus1_oe_set_mask_default 0x00000000
683#define regk_iop_sw_spu_rw_bus1_set_mask_default 0x00000000
684#define regk_iop_sw_spu_rw_gio_clr_mask_default 0x00000000
685#define regk_iop_sw_spu_rw_gio_oe_clr_mask_default 0x00000000
686#define regk_iop_sw_spu_rw_gio_oe_set_mask_default 0x00000000
687#define regk_iop_sw_spu_rw_gio_set_mask_default 0x00000000
688#define regk_iop_sw_spu_set 0x00000001
689#define regk_iop_sw_spu_wr 0x00000003
690#define regk_iop_sw_spu_yes 0x00000001
691#endif /* __iop_sw_spu_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_timer_grp_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_timer_grp_defs_asm.h
new file mode 100644
index 000000000000..7129a9a4bedc
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_timer_grp_defs_asm.h
@@ -0,0 +1,237 @@
1#ifndef __iop_timer_grp_defs_asm_h
2#define __iop_timer_grp_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_timer_grp.r
7 * id: iop_timer_grp.r,v 1.29 2005/02/16 09:13:27 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_timer_grp_defs_asm.h ../../inst/io_proc/rtl/iop_timer_grp.r
11 * id: $Id: iop_timer_grp_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register rw_cfg, scope iop_timer_grp, type rw */
57#define reg_iop_timer_grp_rw_cfg___clk_src___lsb 0
58#define reg_iop_timer_grp_rw_cfg___clk_src___width 1
59#define reg_iop_timer_grp_rw_cfg___clk_src___bit 0
60#define reg_iop_timer_grp_rw_cfg___trig___lsb 1
61#define reg_iop_timer_grp_rw_cfg___trig___width 2
62#define reg_iop_timer_grp_rw_cfg___clk_gen_div___lsb 3
63#define reg_iop_timer_grp_rw_cfg___clk_gen_div___width 8
64#define reg_iop_timer_grp_rw_cfg___clk_div___lsb 11
65#define reg_iop_timer_grp_rw_cfg___clk_div___width 8
66#define reg_iop_timer_grp_rw_cfg_offset 0
67
68/* Register rw_half_period, scope iop_timer_grp, type rw */
69#define reg_iop_timer_grp_rw_half_period___quota_lo___lsb 0
70#define reg_iop_timer_grp_rw_half_period___quota_lo___width 15
71#define reg_iop_timer_grp_rw_half_period___quota_hi___lsb 15
72#define reg_iop_timer_grp_rw_half_period___quota_hi___width 15
73#define reg_iop_timer_grp_rw_half_period___quota_hi_sel___lsb 30
74#define reg_iop_timer_grp_rw_half_period___quota_hi_sel___width 1
75#define reg_iop_timer_grp_rw_half_period___quota_hi_sel___bit 30
76#define reg_iop_timer_grp_rw_half_period_offset 4
77
78/* Register rw_half_period_len, scope iop_timer_grp, type rw */
79#define reg_iop_timer_grp_rw_half_period_len_offset 8
80
81#define STRIDE_iop_timer_grp_rw_tmr_cfg 4
82/* Register rw_tmr_cfg, scope iop_timer_grp, type rw */
83#define reg_iop_timer_grp_rw_tmr_cfg___clk_src___lsb 0
84#define reg_iop_timer_grp_rw_tmr_cfg___clk_src___width 3
85#define reg_iop_timer_grp_rw_tmr_cfg___strb___lsb 3
86#define reg_iop_timer_grp_rw_tmr_cfg___strb___width 2
87#define reg_iop_timer_grp_rw_tmr_cfg___run_mode___lsb 5
88#define reg_iop_timer_grp_rw_tmr_cfg___run_mode___width 2
89#define reg_iop_timer_grp_rw_tmr_cfg___out_mode___lsb 7
90#define reg_iop_timer_grp_rw_tmr_cfg___out_mode___width 1
91#define reg_iop_timer_grp_rw_tmr_cfg___out_mode___bit 7
92#define reg_iop_timer_grp_rw_tmr_cfg___active_on_tmr___lsb 8
93#define reg_iop_timer_grp_rw_tmr_cfg___active_on_tmr___width 2
94#define reg_iop_timer_grp_rw_tmr_cfg___inv___lsb 10
95#define reg_iop_timer_grp_rw_tmr_cfg___inv___width 1
96#define reg_iop_timer_grp_rw_tmr_cfg___inv___bit 10
97#define reg_iop_timer_grp_rw_tmr_cfg___en_by_tmr___lsb 11
98#define reg_iop_timer_grp_rw_tmr_cfg___en_by_tmr___width 2
99#define reg_iop_timer_grp_rw_tmr_cfg___dis_by_tmr___lsb 13
100#define reg_iop_timer_grp_rw_tmr_cfg___dis_by_tmr___width 2
101#define reg_iop_timer_grp_rw_tmr_cfg___en_only_by_reg___lsb 15
102#define reg_iop_timer_grp_rw_tmr_cfg___en_only_by_reg___width 1
103#define reg_iop_timer_grp_rw_tmr_cfg___en_only_by_reg___bit 15
104#define reg_iop_timer_grp_rw_tmr_cfg___dis_only_by_reg___lsb 16
105#define reg_iop_timer_grp_rw_tmr_cfg___dis_only_by_reg___width 1
106#define reg_iop_timer_grp_rw_tmr_cfg___dis_only_by_reg___bit 16
107#define reg_iop_timer_grp_rw_tmr_cfg___rst_at_en_strb___lsb 17
108#define reg_iop_timer_grp_rw_tmr_cfg___rst_at_en_strb___width 1
109#define reg_iop_timer_grp_rw_tmr_cfg___rst_at_en_strb___bit 17
110#define reg_iop_timer_grp_rw_tmr_cfg_offset 12
111
112#define STRIDE_iop_timer_grp_rw_tmr_len 4
113/* Register rw_tmr_len, scope iop_timer_grp, type rw */
114#define reg_iop_timer_grp_rw_tmr_len___val___lsb 0
115#define reg_iop_timer_grp_rw_tmr_len___val___width 16
116#define reg_iop_timer_grp_rw_tmr_len_offset 44
117
118/* Register rw_cmd, scope iop_timer_grp, type rw */
119#define reg_iop_timer_grp_rw_cmd___rst___lsb 0
120#define reg_iop_timer_grp_rw_cmd___rst___width 4
121#define reg_iop_timer_grp_rw_cmd___en___lsb 4
122#define reg_iop_timer_grp_rw_cmd___en___width 4
123#define reg_iop_timer_grp_rw_cmd___dis___lsb 8
124#define reg_iop_timer_grp_rw_cmd___dis___width 4
125#define reg_iop_timer_grp_rw_cmd___strb___lsb 12
126#define reg_iop_timer_grp_rw_cmd___strb___width 4
127#define reg_iop_timer_grp_rw_cmd_offset 60
128
129/* Register r_clk_gen_cnt, scope iop_timer_grp, type r */
130#define reg_iop_timer_grp_r_clk_gen_cnt_offset 64
131
132#define STRIDE_iop_timer_grp_rs_tmr_cnt 8
133/* Register rs_tmr_cnt, scope iop_timer_grp, type rs */
134#define reg_iop_timer_grp_rs_tmr_cnt___val___lsb 0
135#define reg_iop_timer_grp_rs_tmr_cnt___val___width 16
136#define reg_iop_timer_grp_rs_tmr_cnt_offset 68
137
138#define STRIDE_iop_timer_grp_r_tmr_cnt 8
139/* Register r_tmr_cnt, scope iop_timer_grp, type r */
140#define reg_iop_timer_grp_r_tmr_cnt___val___lsb 0
141#define reg_iop_timer_grp_r_tmr_cnt___val___width 16
142#define reg_iop_timer_grp_r_tmr_cnt_offset 72
143
144/* Register rw_intr_mask, scope iop_timer_grp, type rw */
145#define reg_iop_timer_grp_rw_intr_mask___tmr0___lsb 0
146#define reg_iop_timer_grp_rw_intr_mask___tmr0___width 1
147#define reg_iop_timer_grp_rw_intr_mask___tmr0___bit 0
148#define reg_iop_timer_grp_rw_intr_mask___tmr1___lsb 1
149#define reg_iop_timer_grp_rw_intr_mask___tmr1___width 1
150#define reg_iop_timer_grp_rw_intr_mask___tmr1___bit 1
151#define reg_iop_timer_grp_rw_intr_mask___tmr2___lsb 2
152#define reg_iop_timer_grp_rw_intr_mask___tmr2___width 1
153#define reg_iop_timer_grp_rw_intr_mask___tmr2___bit 2
154#define reg_iop_timer_grp_rw_intr_mask___tmr3___lsb 3
155#define reg_iop_timer_grp_rw_intr_mask___tmr3___width 1
156#define reg_iop_timer_grp_rw_intr_mask___tmr3___bit 3
157#define reg_iop_timer_grp_rw_intr_mask_offset 100
158
159/* Register rw_ack_intr, scope iop_timer_grp, type rw */
160#define reg_iop_timer_grp_rw_ack_intr___tmr0___lsb 0
161#define reg_iop_timer_grp_rw_ack_intr___tmr0___width 1
162#define reg_iop_timer_grp_rw_ack_intr___tmr0___bit 0
163#define reg_iop_timer_grp_rw_ack_intr___tmr1___lsb 1
164#define reg_iop_timer_grp_rw_ack_intr___tmr1___width 1
165#define reg_iop_timer_grp_rw_ack_intr___tmr1___bit 1
166#define reg_iop_timer_grp_rw_ack_intr___tmr2___lsb 2
167#define reg_iop_timer_grp_rw_ack_intr___tmr2___width 1
168#define reg_iop_timer_grp_rw_ack_intr___tmr2___bit 2
169#define reg_iop_timer_grp_rw_ack_intr___tmr3___lsb 3
170#define reg_iop_timer_grp_rw_ack_intr___tmr3___width 1
171#define reg_iop_timer_grp_rw_ack_intr___tmr3___bit 3
172#define reg_iop_timer_grp_rw_ack_intr_offset 104
173
174/* Register r_intr, scope iop_timer_grp, type r */
175#define reg_iop_timer_grp_r_intr___tmr0___lsb 0
176#define reg_iop_timer_grp_r_intr___tmr0___width 1
177#define reg_iop_timer_grp_r_intr___tmr0___bit 0
178#define reg_iop_timer_grp_r_intr___tmr1___lsb 1
179#define reg_iop_timer_grp_r_intr___tmr1___width 1
180#define reg_iop_timer_grp_r_intr___tmr1___bit 1
181#define reg_iop_timer_grp_r_intr___tmr2___lsb 2
182#define reg_iop_timer_grp_r_intr___tmr2___width 1
183#define reg_iop_timer_grp_r_intr___tmr2___bit 2
184#define reg_iop_timer_grp_r_intr___tmr3___lsb 3
185#define reg_iop_timer_grp_r_intr___tmr3___width 1
186#define reg_iop_timer_grp_r_intr___tmr3___bit 3
187#define reg_iop_timer_grp_r_intr_offset 108
188
189/* Register r_masked_intr, scope iop_timer_grp, type r */
190#define reg_iop_timer_grp_r_masked_intr___tmr0___lsb 0
191#define reg_iop_timer_grp_r_masked_intr___tmr0___width 1
192#define reg_iop_timer_grp_r_masked_intr___tmr0___bit 0
193#define reg_iop_timer_grp_r_masked_intr___tmr1___lsb 1
194#define reg_iop_timer_grp_r_masked_intr___tmr1___width 1
195#define reg_iop_timer_grp_r_masked_intr___tmr1___bit 1
196#define reg_iop_timer_grp_r_masked_intr___tmr2___lsb 2
197#define reg_iop_timer_grp_r_masked_intr___tmr2___width 1
198#define reg_iop_timer_grp_r_masked_intr___tmr2___bit 2
199#define reg_iop_timer_grp_r_masked_intr___tmr3___lsb 3
200#define reg_iop_timer_grp_r_masked_intr___tmr3___width 1
201#define reg_iop_timer_grp_r_masked_intr___tmr3___bit 3
202#define reg_iop_timer_grp_r_masked_intr_offset 112
203
204
205/* Constants */
206#define regk_iop_timer_grp_clk200 0x00000000
207#define regk_iop_timer_grp_clk_gen 0x00000002
208#define regk_iop_timer_grp_complete 0x00000002
209#define regk_iop_timer_grp_div_clk200 0x00000001
210#define regk_iop_timer_grp_div_clk_gen 0x00000003
211#define regk_iop_timer_grp_ext 0x00000001
212#define regk_iop_timer_grp_hi 0x00000000
213#define regk_iop_timer_grp_long_period 0x00000001
214#define regk_iop_timer_grp_neg 0x00000002
215#define regk_iop_timer_grp_no 0x00000000
216#define regk_iop_timer_grp_once 0x00000003
217#define regk_iop_timer_grp_pause 0x00000001
218#define regk_iop_timer_grp_pos 0x00000001
219#define regk_iop_timer_grp_pos_neg 0x00000003
220#define regk_iop_timer_grp_pulse 0x00000000
221#define regk_iop_timer_grp_r_tmr_cnt_size 0x00000004
222#define regk_iop_timer_grp_rs_tmr_cnt_size 0x00000004
223#define regk_iop_timer_grp_rw_cfg_default 0x00000002
224#define regk_iop_timer_grp_rw_intr_mask_default 0x00000000
225#define regk_iop_timer_grp_rw_tmr_cfg_default0 0x00018000
226#define regk_iop_timer_grp_rw_tmr_cfg_default1 0x0001a900
227#define regk_iop_timer_grp_rw_tmr_cfg_default2 0x0001d200
228#define regk_iop_timer_grp_rw_tmr_cfg_default3 0x0001fb00
229#define regk_iop_timer_grp_rw_tmr_cfg_size 0x00000004
230#define regk_iop_timer_grp_rw_tmr_len_default 0x00000000
231#define regk_iop_timer_grp_rw_tmr_len_size 0x00000004
232#define regk_iop_timer_grp_short_period 0x00000000
233#define regk_iop_timer_grp_stop 0x00000000
234#define regk_iop_timer_grp_tmr 0x00000004
235#define regk_iop_timer_grp_toggle 0x00000001
236#define regk_iop_timer_grp_yes 0x00000001
237#endif /* __iop_timer_grp_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_trigger_grp_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_trigger_grp_defs_asm.h
new file mode 100644
index 000000000000..1005d9db80dc
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_trigger_grp_defs_asm.h
@@ -0,0 +1,157 @@
1#ifndef __iop_trigger_grp_defs_asm_h
2#define __iop_trigger_grp_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_trigger_grp.r
7 * id: iop_trigger_grp.r,v 0.20 2005/02/16 09:13:20 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_trigger_grp_defs_asm.h ../../inst/io_proc/rtl/iop_trigger_grp.r
11 * id: $Id: iop_trigger_grp_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56#define STRIDE_iop_trigger_grp_rw_cfg 4
57/* Register rw_cfg, scope iop_trigger_grp, type rw */
58#define reg_iop_trigger_grp_rw_cfg___action___lsb 0
59#define reg_iop_trigger_grp_rw_cfg___action___width 2
60#define reg_iop_trigger_grp_rw_cfg___once___lsb 2
61#define reg_iop_trigger_grp_rw_cfg___once___width 1
62#define reg_iop_trigger_grp_rw_cfg___once___bit 2
63#define reg_iop_trigger_grp_rw_cfg___trig___lsb 3
64#define reg_iop_trigger_grp_rw_cfg___trig___width 3
65#define reg_iop_trigger_grp_rw_cfg___en_only_by_reg___lsb 6
66#define reg_iop_trigger_grp_rw_cfg___en_only_by_reg___width 1
67#define reg_iop_trigger_grp_rw_cfg___en_only_by_reg___bit 6
68#define reg_iop_trigger_grp_rw_cfg___dis_only_by_reg___lsb 7
69#define reg_iop_trigger_grp_rw_cfg___dis_only_by_reg___width 1
70#define reg_iop_trigger_grp_rw_cfg___dis_only_by_reg___bit 7
71#define reg_iop_trigger_grp_rw_cfg_offset 0
72
73/* Register rw_cmd, scope iop_trigger_grp, type rw */
74#define reg_iop_trigger_grp_rw_cmd___dis___lsb 0
75#define reg_iop_trigger_grp_rw_cmd___dis___width 4
76#define reg_iop_trigger_grp_rw_cmd___en___lsb 4
77#define reg_iop_trigger_grp_rw_cmd___en___width 4
78#define reg_iop_trigger_grp_rw_cmd_offset 16
79
80/* Register rw_intr_mask, scope iop_trigger_grp, type rw */
81#define reg_iop_trigger_grp_rw_intr_mask___trig0___lsb 0
82#define reg_iop_trigger_grp_rw_intr_mask___trig0___width 1
83#define reg_iop_trigger_grp_rw_intr_mask___trig0___bit 0
84#define reg_iop_trigger_grp_rw_intr_mask___trig1___lsb 1
85#define reg_iop_trigger_grp_rw_intr_mask___trig1___width 1
86#define reg_iop_trigger_grp_rw_intr_mask___trig1___bit 1
87#define reg_iop_trigger_grp_rw_intr_mask___trig2___lsb 2
88#define reg_iop_trigger_grp_rw_intr_mask___trig2___width 1
89#define reg_iop_trigger_grp_rw_intr_mask___trig2___bit 2
90#define reg_iop_trigger_grp_rw_intr_mask___trig3___lsb 3
91#define reg_iop_trigger_grp_rw_intr_mask___trig3___width 1
92#define reg_iop_trigger_grp_rw_intr_mask___trig3___bit 3
93#define reg_iop_trigger_grp_rw_intr_mask_offset 20
94
95/* Register rw_ack_intr, scope iop_trigger_grp, type rw */
96#define reg_iop_trigger_grp_rw_ack_intr___trig0___lsb 0
97#define reg_iop_trigger_grp_rw_ack_intr___trig0___width 1
98#define reg_iop_trigger_grp_rw_ack_intr___trig0___bit 0
99#define reg_iop_trigger_grp_rw_ack_intr___trig1___lsb 1
100#define reg_iop_trigger_grp_rw_ack_intr___trig1___width 1
101#define reg_iop_trigger_grp_rw_ack_intr___trig1___bit 1
102#define reg_iop_trigger_grp_rw_ack_intr___trig2___lsb 2
103#define reg_iop_trigger_grp_rw_ack_intr___trig2___width 1
104#define reg_iop_trigger_grp_rw_ack_intr___trig2___bit 2
105#define reg_iop_trigger_grp_rw_ack_intr___trig3___lsb 3
106#define reg_iop_trigger_grp_rw_ack_intr___trig3___width 1
107#define reg_iop_trigger_grp_rw_ack_intr___trig3___bit 3
108#define reg_iop_trigger_grp_rw_ack_intr_offset 24
109
110/* Register r_intr, scope iop_trigger_grp, type r */
111#define reg_iop_trigger_grp_r_intr___trig0___lsb 0
112#define reg_iop_trigger_grp_r_intr___trig0___width 1
113#define reg_iop_trigger_grp_r_intr___trig0___bit 0
114#define reg_iop_trigger_grp_r_intr___trig1___lsb 1
115#define reg_iop_trigger_grp_r_intr___trig1___width 1
116#define reg_iop_trigger_grp_r_intr___trig1___bit 1
117#define reg_iop_trigger_grp_r_intr___trig2___lsb 2
118#define reg_iop_trigger_grp_r_intr___trig2___width 1
119#define reg_iop_trigger_grp_r_intr___trig2___bit 2
120#define reg_iop_trigger_grp_r_intr___trig3___lsb 3
121#define reg_iop_trigger_grp_r_intr___trig3___width 1
122#define reg_iop_trigger_grp_r_intr___trig3___bit 3
123#define reg_iop_trigger_grp_r_intr_offset 28
124
125/* Register r_masked_intr, scope iop_trigger_grp, type r */
126#define reg_iop_trigger_grp_r_masked_intr___trig0___lsb 0
127#define reg_iop_trigger_grp_r_masked_intr___trig0___width 1
128#define reg_iop_trigger_grp_r_masked_intr___trig0___bit 0
129#define reg_iop_trigger_grp_r_masked_intr___trig1___lsb 1
130#define reg_iop_trigger_grp_r_masked_intr___trig1___width 1
131#define reg_iop_trigger_grp_r_masked_intr___trig1___bit 1
132#define reg_iop_trigger_grp_r_masked_intr___trig2___lsb 2
133#define reg_iop_trigger_grp_r_masked_intr___trig2___width 1
134#define reg_iop_trigger_grp_r_masked_intr___trig2___bit 2
135#define reg_iop_trigger_grp_r_masked_intr___trig3___lsb 3
136#define reg_iop_trigger_grp_r_masked_intr___trig3___width 1
137#define reg_iop_trigger_grp_r_masked_intr___trig3___bit 3
138#define reg_iop_trigger_grp_r_masked_intr_offset 32
139
140
141/* Constants */
142#define regk_iop_trigger_grp_fall 0x00000002
143#define regk_iop_trigger_grp_fall_lo 0x00000006
144#define regk_iop_trigger_grp_no 0x00000000
145#define regk_iop_trigger_grp_off 0x00000000
146#define regk_iop_trigger_grp_pulse 0x00000000
147#define regk_iop_trigger_grp_rise 0x00000001
148#define regk_iop_trigger_grp_rise_fall 0x00000003
149#define regk_iop_trigger_grp_rise_fall_hi 0x00000007
150#define regk_iop_trigger_grp_rise_fall_lo 0x00000004
151#define regk_iop_trigger_grp_rise_hi 0x00000005
152#define regk_iop_trigger_grp_rw_cfg_default 0x000000c0
153#define regk_iop_trigger_grp_rw_cfg_size 0x00000004
154#define regk_iop_trigger_grp_rw_intr_mask_default 0x00000000
155#define regk_iop_trigger_grp_toggle 0x00000003
156#define regk_iop_trigger_grp_yes 0x00000001
157#endif /* __iop_trigger_grp_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/asm/iop_version_defs_asm.h b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_version_defs_asm.h
new file mode 100644
index 000000000000..e13feb20a7e3
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/asm/iop_version_defs_asm.h
@@ -0,0 +1,64 @@
1#ifndef __iop_version_defs_asm_h
2#define __iop_version_defs_asm_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_version.r
7 * id: iop_version.r,v 1.3 2004/04/22 12:37:54 jonaso Exp
8 * last modfied: Mon Apr 11 16:08:44 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c -asm --outfile asm/iop_version_defs_asm.h ../../inst/io_proc/rtl/guinness/iop_version.r
11 * id: $Id: iop_version_defs_asm.h,v 1.5 2005/04/24 18:31:07 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16
17#ifndef REG_FIELD
18#define REG_FIELD( scope, reg, field, value ) \
19 REG_FIELD_X_( value, reg_##scope##_##reg##___##field##___lsb )
20#define REG_FIELD_X_( value, shift ) ((value) << shift)
21#endif
22
23#ifndef REG_STATE
24#define REG_STATE( scope, reg, field, symbolic_value ) \
25 REG_STATE_X_( regk_##scope##_##symbolic_value, reg_##scope##_##reg##___##field##___lsb )
26#define REG_STATE_X_( k, shift ) (k << shift)
27#endif
28
29#ifndef REG_MASK
30#define REG_MASK( scope, reg, field ) \
31 REG_MASK_X_( reg_##scope##_##reg##___##field##___width, reg_##scope##_##reg##___##field##___lsb )
32#define REG_MASK_X_( width, lsb ) (((1 << width)-1) << lsb)
33#endif
34
35#ifndef REG_LSB
36#define REG_LSB( scope, reg, field ) reg_##scope##_##reg##___##field##___lsb
37#endif
38
39#ifndef REG_BIT
40#define REG_BIT( scope, reg, field ) reg_##scope##_##reg##___##field##___bit
41#endif
42
43#ifndef REG_ADDR
44#define REG_ADDR( scope, inst, reg ) REG_ADDR_X_(inst, reg_##scope##_##reg##_offset)
45#define REG_ADDR_X_( inst, offs ) ((inst) + offs)
46#endif
47
48#ifndef REG_ADDR_VECT
49#define REG_ADDR_VECT( scope, inst, reg, index ) \
50 REG_ADDR_VECT_X_(inst, reg_##scope##_##reg##_offset, index, \
51 STRIDE_##scope##_##reg )
52#define REG_ADDR_VECT_X_( inst, offs, index, stride ) \
53 ((inst) + offs + (index) * stride)
54#endif
55
56/* Register r_version, scope iop_version, type r */
57#define reg_iop_version_r_version___nr___lsb 0
58#define reg_iop_version_r_version___nr___width 8
59#define reg_iop_version_r_version_offset 0
60
61
62/* Constants */
63#define regk_iop_version_v1_0 0x00000001
64#endif /* __iop_version_defs_asm_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_crc_par_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_crc_par_defs.h
new file mode 100644
index 000000000000..90e4785b6474
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_crc_par_defs.h
@@ -0,0 +1,232 @@
1#ifndef __iop_crc_par_defs_h
2#define __iop_crc_par_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_crc_par.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_crc_par_defs.h ../../inst/io_proc/rtl/iop_crc_par.r
11 * id: $Id: iop_crc_par_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_crc_par */
86
87/* Register rw_cfg, scope iop_crc_par, type rw */
88typedef struct {
89 unsigned int mode : 1;
90 unsigned int crc_out : 1;
91 unsigned int rev_out : 1;
92 unsigned int inv_out : 1;
93 unsigned int trig : 2;
94 unsigned int poly : 3;
95 unsigned int dummy1 : 23;
96} reg_iop_crc_par_rw_cfg;
97#define REG_RD_ADDR_iop_crc_par_rw_cfg 0
98#define REG_WR_ADDR_iop_crc_par_rw_cfg 0
99
100/* Register rw_init_crc, scope iop_crc_par, type rw */
101typedef unsigned int reg_iop_crc_par_rw_init_crc;
102#define REG_RD_ADDR_iop_crc_par_rw_init_crc 4
103#define REG_WR_ADDR_iop_crc_par_rw_init_crc 4
104
105/* Register rw_correct_crc, scope iop_crc_par, type rw */
106typedef unsigned int reg_iop_crc_par_rw_correct_crc;
107#define REG_RD_ADDR_iop_crc_par_rw_correct_crc 8
108#define REG_WR_ADDR_iop_crc_par_rw_correct_crc 8
109
110/* Register rw_ctrl, scope iop_crc_par, type rw */
111typedef struct {
112 unsigned int en : 1;
113 unsigned int dummy1 : 31;
114} reg_iop_crc_par_rw_ctrl;
115#define REG_RD_ADDR_iop_crc_par_rw_ctrl 12
116#define REG_WR_ADDR_iop_crc_par_rw_ctrl 12
117
118/* Register rw_set_last, scope iop_crc_par, type rw */
119typedef struct {
120 unsigned int tr_dif : 1;
121 unsigned int dummy1 : 31;
122} reg_iop_crc_par_rw_set_last;
123#define REG_RD_ADDR_iop_crc_par_rw_set_last 16
124#define REG_WR_ADDR_iop_crc_par_rw_set_last 16
125
126/* Register rw_wr1byte, scope iop_crc_par, type rw */
127typedef struct {
128 unsigned int data : 8;
129 unsigned int dummy1 : 24;
130} reg_iop_crc_par_rw_wr1byte;
131#define REG_RD_ADDR_iop_crc_par_rw_wr1byte 20
132#define REG_WR_ADDR_iop_crc_par_rw_wr1byte 20
133
134/* Register rw_wr2byte, scope iop_crc_par, type rw */
135typedef struct {
136 unsigned int data : 16;
137 unsigned int dummy1 : 16;
138} reg_iop_crc_par_rw_wr2byte;
139#define REG_RD_ADDR_iop_crc_par_rw_wr2byte 24
140#define REG_WR_ADDR_iop_crc_par_rw_wr2byte 24
141
142/* Register rw_wr3byte, scope iop_crc_par, type rw */
143typedef struct {
144 unsigned int data : 24;
145 unsigned int dummy1 : 8;
146} reg_iop_crc_par_rw_wr3byte;
147#define REG_RD_ADDR_iop_crc_par_rw_wr3byte 28
148#define REG_WR_ADDR_iop_crc_par_rw_wr3byte 28
149
150/* Register rw_wr4byte, scope iop_crc_par, type rw */
151typedef struct {
152 unsigned int data : 32;
153} reg_iop_crc_par_rw_wr4byte;
154#define REG_RD_ADDR_iop_crc_par_rw_wr4byte 32
155#define REG_WR_ADDR_iop_crc_par_rw_wr4byte 32
156
157/* Register rw_wr1byte_last, scope iop_crc_par, type rw */
158typedef struct {
159 unsigned int data : 8;
160 unsigned int dummy1 : 24;
161} reg_iop_crc_par_rw_wr1byte_last;
162#define REG_RD_ADDR_iop_crc_par_rw_wr1byte_last 36
163#define REG_WR_ADDR_iop_crc_par_rw_wr1byte_last 36
164
165/* Register rw_wr2byte_last, scope iop_crc_par, type rw */
166typedef struct {
167 unsigned int data : 16;
168 unsigned int dummy1 : 16;
169} reg_iop_crc_par_rw_wr2byte_last;
170#define REG_RD_ADDR_iop_crc_par_rw_wr2byte_last 40
171#define REG_WR_ADDR_iop_crc_par_rw_wr2byte_last 40
172
173/* Register rw_wr3byte_last, scope iop_crc_par, type rw */
174typedef struct {
175 unsigned int data : 24;
176 unsigned int dummy1 : 8;
177} reg_iop_crc_par_rw_wr3byte_last;
178#define REG_RD_ADDR_iop_crc_par_rw_wr3byte_last 44
179#define REG_WR_ADDR_iop_crc_par_rw_wr3byte_last 44
180
181/* Register rw_wr4byte_last, scope iop_crc_par, type rw */
182typedef struct {
183 unsigned int data : 32;
184} reg_iop_crc_par_rw_wr4byte_last;
185#define REG_RD_ADDR_iop_crc_par_rw_wr4byte_last 48
186#define REG_WR_ADDR_iop_crc_par_rw_wr4byte_last 48
187
188/* Register r_stat, scope iop_crc_par, type r */
189typedef struct {
190 unsigned int err : 1;
191 unsigned int busy : 1;
192 unsigned int dummy1 : 30;
193} reg_iop_crc_par_r_stat;
194#define REG_RD_ADDR_iop_crc_par_r_stat 52
195
196/* Register r_sh_reg, scope iop_crc_par, type r */
197typedef unsigned int reg_iop_crc_par_r_sh_reg;
198#define REG_RD_ADDR_iop_crc_par_r_sh_reg 56
199
200/* Register r_crc, scope iop_crc_par, type r */
201typedef unsigned int reg_iop_crc_par_r_crc;
202#define REG_RD_ADDR_iop_crc_par_r_crc 60
203
204/* Register rw_strb_rec_dif_in, scope iop_crc_par, type rw */
205typedef struct {
206 unsigned int last : 2;
207 unsigned int dummy1 : 30;
208} reg_iop_crc_par_rw_strb_rec_dif_in;
209#define REG_RD_ADDR_iop_crc_par_rw_strb_rec_dif_in 64
210#define REG_WR_ADDR_iop_crc_par_rw_strb_rec_dif_in 64
211
212
213/* Constants */
214enum {
215 regk_iop_crc_par_calc = 0x00000001,
216 regk_iop_crc_par_ccitt = 0x00000002,
217 regk_iop_crc_par_check = 0x00000000,
218 regk_iop_crc_par_crc16 = 0x00000001,
219 regk_iop_crc_par_crc32 = 0x00000000,
220 regk_iop_crc_par_crc5 = 0x00000003,
221 regk_iop_crc_par_crc5_11 = 0x00000004,
222 regk_iop_crc_par_dif_in = 0x00000002,
223 regk_iop_crc_par_hi = 0x00000000,
224 regk_iop_crc_par_neg = 0x00000002,
225 regk_iop_crc_par_no = 0x00000000,
226 regk_iop_crc_par_pos = 0x00000001,
227 regk_iop_crc_par_pos_neg = 0x00000003,
228 regk_iop_crc_par_rw_cfg_default = 0x00000000,
229 regk_iop_crc_par_rw_ctrl_default = 0x00000000,
230 regk_iop_crc_par_yes = 0x00000001
231};
232#endif /* __iop_crc_par_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_in_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_in_defs.h
new file mode 100644
index 000000000000..76aec6e37f3e
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_in_defs.h
@@ -0,0 +1,325 @@
1#ifndef __iop_dmc_in_defs_h
2#define __iop_dmc_in_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_dmc_in.r
7 * id: iop_dmc_in.r,v 1.26 2005/02/16 09:14:17 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_dmc_in_defs.h ../../inst/io_proc/rtl/iop_dmc_in.r
11 * id: $Id: iop_dmc_in_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_dmc_in */
86
87/* Register rw_cfg, scope iop_dmc_in, type rw */
88typedef struct {
89 unsigned int sth_intr : 3;
90 unsigned int last_dis_dif : 1;
91 unsigned int dummy1 : 28;
92} reg_iop_dmc_in_rw_cfg;
93#define REG_RD_ADDR_iop_dmc_in_rw_cfg 0
94#define REG_WR_ADDR_iop_dmc_in_rw_cfg 0
95
96/* Register rw_ctrl, scope iop_dmc_in, type rw */
97typedef struct {
98 unsigned int dif_en : 1;
99 unsigned int dif_dis : 1;
100 unsigned int stream_clr : 1;
101 unsigned int dummy1 : 29;
102} reg_iop_dmc_in_rw_ctrl;
103#define REG_RD_ADDR_iop_dmc_in_rw_ctrl 4
104#define REG_WR_ADDR_iop_dmc_in_rw_ctrl 4
105
106/* Register r_stat, scope iop_dmc_in, type r */
107typedef struct {
108 unsigned int dif_en : 1;
109 unsigned int dummy1 : 31;
110} reg_iop_dmc_in_r_stat;
111#define REG_RD_ADDR_iop_dmc_in_r_stat 8
112
113/* Register rw_stream_cmd, scope iop_dmc_in, type rw */
114typedef struct {
115 unsigned int cmd : 10;
116 unsigned int dummy1 : 6;
117 unsigned int n : 8;
118 unsigned int dummy2 : 8;
119} reg_iop_dmc_in_rw_stream_cmd;
120#define REG_RD_ADDR_iop_dmc_in_rw_stream_cmd 12
121#define REG_WR_ADDR_iop_dmc_in_rw_stream_cmd 12
122
123/* Register rw_stream_wr_data, scope iop_dmc_in, type rw */
124typedef unsigned int reg_iop_dmc_in_rw_stream_wr_data;
125#define REG_RD_ADDR_iop_dmc_in_rw_stream_wr_data 16
126#define REG_WR_ADDR_iop_dmc_in_rw_stream_wr_data 16
127
128/* Register rw_stream_wr_data_last, scope iop_dmc_in, type rw */
129typedef unsigned int reg_iop_dmc_in_rw_stream_wr_data_last;
130#define REG_RD_ADDR_iop_dmc_in_rw_stream_wr_data_last 20
131#define REG_WR_ADDR_iop_dmc_in_rw_stream_wr_data_last 20
132
133/* Register rw_stream_ctrl, scope iop_dmc_in, type rw */
134typedef struct {
135 unsigned int eop : 1;
136 unsigned int wait : 1;
137 unsigned int keep_md : 1;
138 unsigned int size : 3;
139 unsigned int dummy1 : 26;
140} reg_iop_dmc_in_rw_stream_ctrl;
141#define REG_RD_ADDR_iop_dmc_in_rw_stream_ctrl 24
142#define REG_WR_ADDR_iop_dmc_in_rw_stream_ctrl 24
143
144/* Register r_stream_stat, scope iop_dmc_in, type r */
145typedef struct {
146 unsigned int sth : 7;
147 unsigned int dummy1 : 9;
148 unsigned int full : 1;
149 unsigned int last_pkt : 1;
150 unsigned int data_md_valid : 1;
151 unsigned int ctxt_md_valid : 1;
152 unsigned int group_md_valid : 1;
153 unsigned int stream_busy : 1;
154 unsigned int cmd_rdy : 1;
155 unsigned int dummy2 : 9;
156} reg_iop_dmc_in_r_stream_stat;
157#define REG_RD_ADDR_iop_dmc_in_r_stream_stat 28
158
159/* Register r_data_descr, scope iop_dmc_in, type r */
160typedef struct {
161 unsigned int ctrl : 8;
162 unsigned int stat : 8;
163 unsigned int md : 16;
164} reg_iop_dmc_in_r_data_descr;
165#define REG_RD_ADDR_iop_dmc_in_r_data_descr 32
166
167/* Register r_ctxt_descr, scope iop_dmc_in, type r */
168typedef struct {
169 unsigned int ctrl : 8;
170 unsigned int stat : 8;
171 unsigned int md0 : 16;
172} reg_iop_dmc_in_r_ctxt_descr;
173#define REG_RD_ADDR_iop_dmc_in_r_ctxt_descr 36
174
175/* Register r_ctxt_descr_md1, scope iop_dmc_in, type r */
176typedef unsigned int reg_iop_dmc_in_r_ctxt_descr_md1;
177#define REG_RD_ADDR_iop_dmc_in_r_ctxt_descr_md1 40
178
179/* Register r_ctxt_descr_md2, scope iop_dmc_in, type r */
180typedef unsigned int reg_iop_dmc_in_r_ctxt_descr_md2;
181#define REG_RD_ADDR_iop_dmc_in_r_ctxt_descr_md2 44
182
183/* Register r_group_descr, scope iop_dmc_in, type r */
184typedef struct {
185 unsigned int ctrl : 8;
186 unsigned int stat : 8;
187 unsigned int md : 16;
188} reg_iop_dmc_in_r_group_descr;
189#define REG_RD_ADDR_iop_dmc_in_r_group_descr 56
190
191/* Register rw_data_descr, scope iop_dmc_in, type rw */
192typedef struct {
193 unsigned int dummy1 : 16;
194 unsigned int md : 16;
195} reg_iop_dmc_in_rw_data_descr;
196#define REG_RD_ADDR_iop_dmc_in_rw_data_descr 60
197#define REG_WR_ADDR_iop_dmc_in_rw_data_descr 60
198
199/* Register rw_ctxt_descr, scope iop_dmc_in, type rw */
200typedef struct {
201 unsigned int dummy1 : 16;
202 unsigned int md0 : 16;
203} reg_iop_dmc_in_rw_ctxt_descr;
204#define REG_RD_ADDR_iop_dmc_in_rw_ctxt_descr 64
205#define REG_WR_ADDR_iop_dmc_in_rw_ctxt_descr 64
206
207/* Register rw_ctxt_descr_md1, scope iop_dmc_in, type rw */
208typedef unsigned int reg_iop_dmc_in_rw_ctxt_descr_md1;
209#define REG_RD_ADDR_iop_dmc_in_rw_ctxt_descr_md1 68
210#define REG_WR_ADDR_iop_dmc_in_rw_ctxt_descr_md1 68
211
212/* Register rw_ctxt_descr_md2, scope iop_dmc_in, type rw */
213typedef unsigned int reg_iop_dmc_in_rw_ctxt_descr_md2;
214#define REG_RD_ADDR_iop_dmc_in_rw_ctxt_descr_md2 72
215#define REG_WR_ADDR_iop_dmc_in_rw_ctxt_descr_md2 72
216
217/* Register rw_group_descr, scope iop_dmc_in, type rw */
218typedef struct {
219 unsigned int dummy1 : 16;
220 unsigned int md : 16;
221} reg_iop_dmc_in_rw_group_descr;
222#define REG_RD_ADDR_iop_dmc_in_rw_group_descr 84
223#define REG_WR_ADDR_iop_dmc_in_rw_group_descr 84
224
225/* Register rw_intr_mask, scope iop_dmc_in, type rw */
226typedef struct {
227 unsigned int data_md : 1;
228 unsigned int ctxt_md : 1;
229 unsigned int group_md : 1;
230 unsigned int cmd_rdy : 1;
231 unsigned int sth : 1;
232 unsigned int full : 1;
233 unsigned int dummy1 : 26;
234} reg_iop_dmc_in_rw_intr_mask;
235#define REG_RD_ADDR_iop_dmc_in_rw_intr_mask 88
236#define REG_WR_ADDR_iop_dmc_in_rw_intr_mask 88
237
238/* Register rw_ack_intr, scope iop_dmc_in, type rw */
239typedef struct {
240 unsigned int data_md : 1;
241 unsigned int ctxt_md : 1;
242 unsigned int group_md : 1;
243 unsigned int cmd_rdy : 1;
244 unsigned int sth : 1;
245 unsigned int full : 1;
246 unsigned int dummy1 : 26;
247} reg_iop_dmc_in_rw_ack_intr;
248#define REG_RD_ADDR_iop_dmc_in_rw_ack_intr 92
249#define REG_WR_ADDR_iop_dmc_in_rw_ack_intr 92
250
251/* Register r_intr, scope iop_dmc_in, type r */
252typedef struct {
253 unsigned int data_md : 1;
254 unsigned int ctxt_md : 1;
255 unsigned int group_md : 1;
256 unsigned int cmd_rdy : 1;
257 unsigned int sth : 1;
258 unsigned int full : 1;
259 unsigned int dummy1 : 26;
260} reg_iop_dmc_in_r_intr;
261#define REG_RD_ADDR_iop_dmc_in_r_intr 96
262
263/* Register r_masked_intr, scope iop_dmc_in, type r */
264typedef struct {
265 unsigned int data_md : 1;
266 unsigned int ctxt_md : 1;
267 unsigned int group_md : 1;
268 unsigned int cmd_rdy : 1;
269 unsigned int sth : 1;
270 unsigned int full : 1;
271 unsigned int dummy1 : 26;
272} reg_iop_dmc_in_r_masked_intr;
273#define REG_RD_ADDR_iop_dmc_in_r_masked_intr 100
274
275
276/* Constants */
277enum {
278 regk_iop_dmc_in_ack_pkt = 0x00000100,
279 regk_iop_dmc_in_array = 0x00000008,
280 regk_iop_dmc_in_burst = 0x00000020,
281 regk_iop_dmc_in_copy_next = 0x00000010,
282 regk_iop_dmc_in_copy_up = 0x00000020,
283 regk_iop_dmc_in_dis_c = 0x00000010,
284 regk_iop_dmc_in_dis_g = 0x00000020,
285 regk_iop_dmc_in_lim1 = 0x00000000,
286 regk_iop_dmc_in_lim16 = 0x00000004,
287 regk_iop_dmc_in_lim2 = 0x00000001,
288 regk_iop_dmc_in_lim32 = 0x00000005,
289 regk_iop_dmc_in_lim4 = 0x00000002,
290 regk_iop_dmc_in_lim64 = 0x00000006,
291 regk_iop_dmc_in_lim8 = 0x00000003,
292 regk_iop_dmc_in_load_c = 0x00000200,
293 regk_iop_dmc_in_load_c_n = 0x00000280,
294 regk_iop_dmc_in_load_c_next = 0x00000240,
295 regk_iop_dmc_in_load_d = 0x00000140,
296 regk_iop_dmc_in_load_g = 0x00000300,
297 regk_iop_dmc_in_load_g_down = 0x000003c0,
298 regk_iop_dmc_in_load_g_next = 0x00000340,
299 regk_iop_dmc_in_load_g_up = 0x00000380,
300 regk_iop_dmc_in_next_en = 0x00000010,
301 regk_iop_dmc_in_next_pkt = 0x00000010,
302 regk_iop_dmc_in_no = 0x00000000,
303 regk_iop_dmc_in_restore = 0x00000020,
304 regk_iop_dmc_in_rw_cfg_default = 0x00000000,
305 regk_iop_dmc_in_rw_ctxt_descr_default = 0x00000000,
306 regk_iop_dmc_in_rw_ctxt_descr_md1_default = 0x00000000,
307 regk_iop_dmc_in_rw_ctxt_descr_md2_default = 0x00000000,
308 regk_iop_dmc_in_rw_data_descr_default = 0x00000000,
309 regk_iop_dmc_in_rw_group_descr_default = 0x00000000,
310 regk_iop_dmc_in_rw_intr_mask_default = 0x00000000,
311 regk_iop_dmc_in_rw_stream_ctrl_default = 0x00000000,
312 regk_iop_dmc_in_save_down = 0x00000020,
313 regk_iop_dmc_in_save_up = 0x00000020,
314 regk_iop_dmc_in_set_reg = 0x00000050,
315 regk_iop_dmc_in_set_w_size1 = 0x00000190,
316 regk_iop_dmc_in_set_w_size2 = 0x000001a0,
317 regk_iop_dmc_in_set_w_size4 = 0x000001c0,
318 regk_iop_dmc_in_store_c = 0x00000002,
319 regk_iop_dmc_in_store_descr = 0x00000000,
320 regk_iop_dmc_in_store_g = 0x00000004,
321 regk_iop_dmc_in_store_md = 0x00000001,
322 regk_iop_dmc_in_update_down = 0x00000020,
323 regk_iop_dmc_in_yes = 0x00000001
324};
325#endif /* __iop_dmc_in_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_out_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_out_defs.h
new file mode 100644
index 000000000000..938a0d4c4604
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_dmc_out_defs.h
@@ -0,0 +1,326 @@
1#ifndef __iop_dmc_out_defs_h
2#define __iop_dmc_out_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_dmc_out.r
7 * id: iop_dmc_out.r,v 1.30 2005/02/16 09:14:11 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_dmc_out_defs.h ../../inst/io_proc/rtl/iop_dmc_out.r
11 * id: $Id: iop_dmc_out_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_dmc_out */
86
87/* Register rw_cfg, scope iop_dmc_out, type rw */
88typedef struct {
89 unsigned int trf_lim : 16;
90 unsigned int last_at_trf_lim : 1;
91 unsigned int dth_intr : 3;
92 unsigned int dummy1 : 12;
93} reg_iop_dmc_out_rw_cfg;
94#define REG_RD_ADDR_iop_dmc_out_rw_cfg 0
95#define REG_WR_ADDR_iop_dmc_out_rw_cfg 0
96
97/* Register rw_ctrl, scope iop_dmc_out, type rw */
98typedef struct {
99 unsigned int dif_en : 1;
100 unsigned int dif_dis : 1;
101 unsigned int dummy1 : 30;
102} reg_iop_dmc_out_rw_ctrl;
103#define REG_RD_ADDR_iop_dmc_out_rw_ctrl 4
104#define REG_WR_ADDR_iop_dmc_out_rw_ctrl 4
105
106/* Register r_stat, scope iop_dmc_out, type r */
107typedef struct {
108 unsigned int dif_en : 1;
109 unsigned int dummy1 : 31;
110} reg_iop_dmc_out_r_stat;
111#define REG_RD_ADDR_iop_dmc_out_r_stat 8
112
113/* Register rw_stream_cmd, scope iop_dmc_out, type rw */
114typedef struct {
115 unsigned int cmd : 10;
116 unsigned int dummy1 : 6;
117 unsigned int n : 8;
118 unsigned int dummy2 : 8;
119} reg_iop_dmc_out_rw_stream_cmd;
120#define REG_RD_ADDR_iop_dmc_out_rw_stream_cmd 12
121#define REG_WR_ADDR_iop_dmc_out_rw_stream_cmd 12
122
123/* Register rs_stream_data, scope iop_dmc_out, type rs */
124typedef unsigned int reg_iop_dmc_out_rs_stream_data;
125#define REG_RD_ADDR_iop_dmc_out_rs_stream_data 16
126
127/* Register r_stream_data, scope iop_dmc_out, type r */
128typedef unsigned int reg_iop_dmc_out_r_stream_data;
129#define REG_RD_ADDR_iop_dmc_out_r_stream_data 20
130
131/* Register r_stream_stat, scope iop_dmc_out, type r */
132typedef struct {
133 unsigned int dth : 7;
134 unsigned int dummy1 : 9;
135 unsigned int dv : 1;
136 unsigned int all_avail : 1;
137 unsigned int last : 1;
138 unsigned int size : 3;
139 unsigned int data_md_valid : 1;
140 unsigned int ctxt_md_valid : 1;
141 unsigned int group_md_valid : 1;
142 unsigned int stream_busy : 1;
143 unsigned int cmd_rdy : 1;
144 unsigned int cmd_rq : 1;
145 unsigned int dummy2 : 4;
146} reg_iop_dmc_out_r_stream_stat;
147#define REG_RD_ADDR_iop_dmc_out_r_stream_stat 24
148
149/* Register r_data_descr, scope iop_dmc_out, type r */
150typedef struct {
151 unsigned int ctrl : 8;
152 unsigned int stat : 8;
153 unsigned int md : 16;
154} reg_iop_dmc_out_r_data_descr;
155#define REG_RD_ADDR_iop_dmc_out_r_data_descr 28
156
157/* Register r_ctxt_descr, scope iop_dmc_out, type r */
158typedef struct {
159 unsigned int ctrl : 8;
160 unsigned int stat : 8;
161 unsigned int md0 : 16;
162} reg_iop_dmc_out_r_ctxt_descr;
163#define REG_RD_ADDR_iop_dmc_out_r_ctxt_descr 32
164
165/* Register r_ctxt_descr_md1, scope iop_dmc_out, type r */
166typedef unsigned int reg_iop_dmc_out_r_ctxt_descr_md1;
167#define REG_RD_ADDR_iop_dmc_out_r_ctxt_descr_md1 36
168
169/* Register r_ctxt_descr_md2, scope iop_dmc_out, type r */
170typedef unsigned int reg_iop_dmc_out_r_ctxt_descr_md2;
171#define REG_RD_ADDR_iop_dmc_out_r_ctxt_descr_md2 40
172
173/* Register r_group_descr, scope iop_dmc_out, type r */
174typedef struct {
175 unsigned int ctrl : 8;
176 unsigned int stat : 8;
177 unsigned int md : 16;
178} reg_iop_dmc_out_r_group_descr;
179#define REG_RD_ADDR_iop_dmc_out_r_group_descr 52
180
181/* Register rw_data_descr, scope iop_dmc_out, type rw */
182typedef struct {
183 unsigned int dummy1 : 16;
184 unsigned int md : 16;
185} reg_iop_dmc_out_rw_data_descr;
186#define REG_RD_ADDR_iop_dmc_out_rw_data_descr 56
187#define REG_WR_ADDR_iop_dmc_out_rw_data_descr 56
188
189/* Register rw_ctxt_descr, scope iop_dmc_out, type rw */
190typedef struct {
191 unsigned int dummy1 : 16;
192 unsigned int md0 : 16;
193} reg_iop_dmc_out_rw_ctxt_descr;
194#define REG_RD_ADDR_iop_dmc_out_rw_ctxt_descr 60
195#define REG_WR_ADDR_iop_dmc_out_rw_ctxt_descr 60
196
197/* Register rw_ctxt_descr_md1, scope iop_dmc_out, type rw */
198typedef unsigned int reg_iop_dmc_out_rw_ctxt_descr_md1;
199#define REG_RD_ADDR_iop_dmc_out_rw_ctxt_descr_md1 64
200#define REG_WR_ADDR_iop_dmc_out_rw_ctxt_descr_md1 64
201
202/* Register rw_ctxt_descr_md2, scope iop_dmc_out, type rw */
203typedef unsigned int reg_iop_dmc_out_rw_ctxt_descr_md2;
204#define REG_RD_ADDR_iop_dmc_out_rw_ctxt_descr_md2 68
205#define REG_WR_ADDR_iop_dmc_out_rw_ctxt_descr_md2 68
206
207/* Register rw_group_descr, scope iop_dmc_out, type rw */
208typedef struct {
209 unsigned int dummy1 : 16;
210 unsigned int md : 16;
211} reg_iop_dmc_out_rw_group_descr;
212#define REG_RD_ADDR_iop_dmc_out_rw_group_descr 80
213#define REG_WR_ADDR_iop_dmc_out_rw_group_descr 80
214
215/* Register rw_intr_mask, scope iop_dmc_out, type rw */
216typedef struct {
217 unsigned int data_md : 1;
218 unsigned int ctxt_md : 1;
219 unsigned int group_md : 1;
220 unsigned int cmd_rdy : 1;
221 unsigned int dth : 1;
222 unsigned int dv : 1;
223 unsigned int last_data : 1;
224 unsigned int trf_lim : 1;
225 unsigned int cmd_rq : 1;
226 unsigned int dummy1 : 23;
227} reg_iop_dmc_out_rw_intr_mask;
228#define REG_RD_ADDR_iop_dmc_out_rw_intr_mask 84
229#define REG_WR_ADDR_iop_dmc_out_rw_intr_mask 84
230
231/* Register rw_ack_intr, scope iop_dmc_out, type rw */
232typedef struct {
233 unsigned int data_md : 1;
234 unsigned int ctxt_md : 1;
235 unsigned int group_md : 1;
236 unsigned int cmd_rdy : 1;
237 unsigned int dth : 1;
238 unsigned int dv : 1;
239 unsigned int last_data : 1;
240 unsigned int trf_lim : 1;
241 unsigned int cmd_rq : 1;
242 unsigned int dummy1 : 23;
243} reg_iop_dmc_out_rw_ack_intr;
244#define REG_RD_ADDR_iop_dmc_out_rw_ack_intr 88
245#define REG_WR_ADDR_iop_dmc_out_rw_ack_intr 88
246
247/* Register r_intr, scope iop_dmc_out, type r */
248typedef struct {
249 unsigned int data_md : 1;
250 unsigned int ctxt_md : 1;
251 unsigned int group_md : 1;
252 unsigned int cmd_rdy : 1;
253 unsigned int dth : 1;
254 unsigned int dv : 1;
255 unsigned int last_data : 1;
256 unsigned int trf_lim : 1;
257 unsigned int cmd_rq : 1;
258 unsigned int dummy1 : 23;
259} reg_iop_dmc_out_r_intr;
260#define REG_RD_ADDR_iop_dmc_out_r_intr 92
261
262/* Register r_masked_intr, scope iop_dmc_out, type r */
263typedef struct {
264 unsigned int data_md : 1;
265 unsigned int ctxt_md : 1;
266 unsigned int group_md : 1;
267 unsigned int cmd_rdy : 1;
268 unsigned int dth : 1;
269 unsigned int dv : 1;
270 unsigned int last_data : 1;
271 unsigned int trf_lim : 1;
272 unsigned int cmd_rq : 1;
273 unsigned int dummy1 : 23;
274} reg_iop_dmc_out_r_masked_intr;
275#define REG_RD_ADDR_iop_dmc_out_r_masked_intr 96
276
277
278/* Constants */
279enum {
280 regk_iop_dmc_out_ack_pkt = 0x00000100,
281 regk_iop_dmc_out_array = 0x00000008,
282 regk_iop_dmc_out_burst = 0x00000020,
283 regk_iop_dmc_out_copy_next = 0x00000010,
284 regk_iop_dmc_out_copy_up = 0x00000020,
285 regk_iop_dmc_out_dis_c = 0x00000010,
286 regk_iop_dmc_out_dis_g = 0x00000020,
287 regk_iop_dmc_out_lim1 = 0x00000000,
288 regk_iop_dmc_out_lim16 = 0x00000004,
289 regk_iop_dmc_out_lim2 = 0x00000001,
290 regk_iop_dmc_out_lim32 = 0x00000005,
291 regk_iop_dmc_out_lim4 = 0x00000002,
292 regk_iop_dmc_out_lim64 = 0x00000006,
293 regk_iop_dmc_out_lim8 = 0x00000003,
294 regk_iop_dmc_out_load_c = 0x00000200,
295 regk_iop_dmc_out_load_c_n = 0x00000280,
296 regk_iop_dmc_out_load_c_next = 0x00000240,
297 regk_iop_dmc_out_load_d = 0x00000140,
298 regk_iop_dmc_out_load_g = 0x00000300,
299 regk_iop_dmc_out_load_g_down = 0x000003c0,
300 regk_iop_dmc_out_load_g_next = 0x00000340,
301 regk_iop_dmc_out_load_g_up = 0x00000380,
302 regk_iop_dmc_out_next_en = 0x00000010,
303 regk_iop_dmc_out_next_pkt = 0x00000010,
304 regk_iop_dmc_out_no = 0x00000000,
305 regk_iop_dmc_out_restore = 0x00000020,
306 regk_iop_dmc_out_rw_cfg_default = 0x00000000,
307 regk_iop_dmc_out_rw_ctxt_descr_default = 0x00000000,
308 regk_iop_dmc_out_rw_ctxt_descr_md1_default = 0x00000000,
309 regk_iop_dmc_out_rw_ctxt_descr_md2_default = 0x00000000,
310 regk_iop_dmc_out_rw_data_descr_default = 0x00000000,
311 regk_iop_dmc_out_rw_group_descr_default = 0x00000000,
312 regk_iop_dmc_out_rw_intr_mask_default = 0x00000000,
313 regk_iop_dmc_out_save_down = 0x00000020,
314 regk_iop_dmc_out_save_up = 0x00000020,
315 regk_iop_dmc_out_set_reg = 0x00000050,
316 regk_iop_dmc_out_set_w_size1 = 0x00000190,
317 regk_iop_dmc_out_set_w_size2 = 0x000001a0,
318 regk_iop_dmc_out_set_w_size4 = 0x000001c0,
319 regk_iop_dmc_out_store_c = 0x00000002,
320 regk_iop_dmc_out_store_descr = 0x00000000,
321 regk_iop_dmc_out_store_g = 0x00000004,
322 regk_iop_dmc_out_store_md = 0x00000001,
323 regk_iop_dmc_out_update_down = 0x00000020,
324 regk_iop_dmc_out_yes = 0x00000001
325};
326#endif /* __iop_dmc_out_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_defs.h
new file mode 100644
index 000000000000..e0c982b263fa
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_defs.h
@@ -0,0 +1,255 @@
1#ifndef __iop_fifo_in_defs_h
2#define __iop_fifo_in_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_in.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:07 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_fifo_in_defs.h ../../inst/io_proc/rtl/iop_fifo_in.r
11 * id: $Id: iop_fifo_in_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_fifo_in */
86
87/* Register rw_cfg, scope iop_fifo_in, type rw */
88typedef struct {
89 unsigned int avail_lim : 3;
90 unsigned int byte_order : 2;
91 unsigned int trig : 2;
92 unsigned int last_dis_dif_in : 1;
93 unsigned int mode : 2;
94 unsigned int dummy1 : 22;
95} reg_iop_fifo_in_rw_cfg;
96#define REG_RD_ADDR_iop_fifo_in_rw_cfg 0
97#define REG_WR_ADDR_iop_fifo_in_rw_cfg 0
98
99/* Register rw_ctrl, scope iop_fifo_in, type rw */
100typedef struct {
101 unsigned int dif_in_en : 1;
102 unsigned int dif_out_en : 1;
103 unsigned int dummy1 : 30;
104} reg_iop_fifo_in_rw_ctrl;
105#define REG_RD_ADDR_iop_fifo_in_rw_ctrl 4
106#define REG_WR_ADDR_iop_fifo_in_rw_ctrl 4
107
108/* Register r_stat, scope iop_fifo_in, type r */
109typedef struct {
110 unsigned int avail_bytes : 4;
111 unsigned int last : 8;
112 unsigned int dif_in_en : 1;
113 unsigned int dif_out_en : 1;
114 unsigned int dummy1 : 18;
115} reg_iop_fifo_in_r_stat;
116#define REG_RD_ADDR_iop_fifo_in_r_stat 8
117
118/* Register rs_rd1byte, scope iop_fifo_in, type rs */
119typedef struct {
120 unsigned int data : 8;
121 unsigned int dummy1 : 24;
122} reg_iop_fifo_in_rs_rd1byte;
123#define REG_RD_ADDR_iop_fifo_in_rs_rd1byte 12
124
125/* Register r_rd1byte, scope iop_fifo_in, type r */
126typedef struct {
127 unsigned int data : 8;
128 unsigned int dummy1 : 24;
129} reg_iop_fifo_in_r_rd1byte;
130#define REG_RD_ADDR_iop_fifo_in_r_rd1byte 16
131
132/* Register rs_rd2byte, scope iop_fifo_in, type rs */
133typedef struct {
134 unsigned int data : 16;
135 unsigned int dummy1 : 16;
136} reg_iop_fifo_in_rs_rd2byte;
137#define REG_RD_ADDR_iop_fifo_in_rs_rd2byte 20
138
139/* Register r_rd2byte, scope iop_fifo_in, type r */
140typedef struct {
141 unsigned int data : 16;
142 unsigned int dummy1 : 16;
143} reg_iop_fifo_in_r_rd2byte;
144#define REG_RD_ADDR_iop_fifo_in_r_rd2byte 24
145
146/* Register rs_rd3byte, scope iop_fifo_in, type rs */
147typedef struct {
148 unsigned int data : 24;
149 unsigned int dummy1 : 8;
150} reg_iop_fifo_in_rs_rd3byte;
151#define REG_RD_ADDR_iop_fifo_in_rs_rd3byte 28
152
153/* Register r_rd3byte, scope iop_fifo_in, type r */
154typedef struct {
155 unsigned int data : 24;
156 unsigned int dummy1 : 8;
157} reg_iop_fifo_in_r_rd3byte;
158#define REG_RD_ADDR_iop_fifo_in_r_rd3byte 32
159
160/* Register rs_rd4byte, scope iop_fifo_in, type rs */
161typedef struct {
162 unsigned int data : 32;
163} reg_iop_fifo_in_rs_rd4byte;
164#define REG_RD_ADDR_iop_fifo_in_rs_rd4byte 36
165
166/* Register r_rd4byte, scope iop_fifo_in, type r */
167typedef struct {
168 unsigned int data : 32;
169} reg_iop_fifo_in_r_rd4byte;
170#define REG_RD_ADDR_iop_fifo_in_r_rd4byte 40
171
172/* Register rw_set_last, scope iop_fifo_in, type rw */
173typedef unsigned int reg_iop_fifo_in_rw_set_last;
174#define REG_RD_ADDR_iop_fifo_in_rw_set_last 44
175#define REG_WR_ADDR_iop_fifo_in_rw_set_last 44
176
177/* Register rw_strb_dif_in, scope iop_fifo_in, type rw */
178typedef struct {
179 unsigned int last : 2;
180 unsigned int dummy1 : 30;
181} reg_iop_fifo_in_rw_strb_dif_in;
182#define REG_RD_ADDR_iop_fifo_in_rw_strb_dif_in 48
183#define REG_WR_ADDR_iop_fifo_in_rw_strb_dif_in 48
184
185/* Register rw_intr_mask, scope iop_fifo_in, type rw */
186typedef struct {
187 unsigned int urun : 1;
188 unsigned int last_data : 1;
189 unsigned int dav : 1;
190 unsigned int avail : 1;
191 unsigned int orun : 1;
192 unsigned int dummy1 : 27;
193} reg_iop_fifo_in_rw_intr_mask;
194#define REG_RD_ADDR_iop_fifo_in_rw_intr_mask 52
195#define REG_WR_ADDR_iop_fifo_in_rw_intr_mask 52
196
197/* Register rw_ack_intr, scope iop_fifo_in, type rw */
198typedef struct {
199 unsigned int urun : 1;
200 unsigned int last_data : 1;
201 unsigned int dav : 1;
202 unsigned int avail : 1;
203 unsigned int orun : 1;
204 unsigned int dummy1 : 27;
205} reg_iop_fifo_in_rw_ack_intr;
206#define REG_RD_ADDR_iop_fifo_in_rw_ack_intr 56
207#define REG_WR_ADDR_iop_fifo_in_rw_ack_intr 56
208
209/* Register r_intr, scope iop_fifo_in, type r */
210typedef struct {
211 unsigned int urun : 1;
212 unsigned int last_data : 1;
213 unsigned int dav : 1;
214 unsigned int avail : 1;
215 unsigned int orun : 1;
216 unsigned int dummy1 : 27;
217} reg_iop_fifo_in_r_intr;
218#define REG_RD_ADDR_iop_fifo_in_r_intr 60
219
220/* Register r_masked_intr, scope iop_fifo_in, type r */
221typedef struct {
222 unsigned int urun : 1;
223 unsigned int last_data : 1;
224 unsigned int dav : 1;
225 unsigned int avail : 1;
226 unsigned int orun : 1;
227 unsigned int dummy1 : 27;
228} reg_iop_fifo_in_r_masked_intr;
229#define REG_RD_ADDR_iop_fifo_in_r_masked_intr 64
230
231
232/* Constants */
233enum {
234 regk_iop_fifo_in_dif_in = 0x00000002,
235 regk_iop_fifo_in_hi = 0x00000000,
236 regk_iop_fifo_in_neg = 0x00000002,
237 regk_iop_fifo_in_no = 0x00000000,
238 regk_iop_fifo_in_order16 = 0x00000001,
239 regk_iop_fifo_in_order24 = 0x00000002,
240 regk_iop_fifo_in_order32 = 0x00000003,
241 regk_iop_fifo_in_order8 = 0x00000000,
242 regk_iop_fifo_in_pos = 0x00000001,
243 regk_iop_fifo_in_pos_neg = 0x00000003,
244 regk_iop_fifo_in_rw_cfg_default = 0x00000024,
245 regk_iop_fifo_in_rw_ctrl_default = 0x00000000,
246 regk_iop_fifo_in_rw_intr_mask_default = 0x00000000,
247 regk_iop_fifo_in_rw_set_last_default = 0x00000000,
248 regk_iop_fifo_in_rw_strb_dif_in_default = 0x00000000,
249 regk_iop_fifo_in_size16 = 0x00000002,
250 regk_iop_fifo_in_size24 = 0x00000001,
251 regk_iop_fifo_in_size32 = 0x00000000,
252 regk_iop_fifo_in_size8 = 0x00000003,
253 regk_iop_fifo_in_yes = 0x00000001
254};
255#endif /* __iop_fifo_in_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_extra_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_extra_defs.h
new file mode 100644
index 000000000000..798ac95870e9
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_in_extra_defs.h
@@ -0,0 +1,164 @@
1#ifndef __iop_fifo_in_extra_defs_h
2#define __iop_fifo_in_extra_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_in_extra.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:08 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_fifo_in_extra_defs.h ../../inst/io_proc/rtl/iop_fifo_in_extra.r
11 * id: $Id: iop_fifo_in_extra_defs.h,v 1.1 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_fifo_in_extra */
86
87/* Register rw_wr_data, scope iop_fifo_in_extra, type rw */
88typedef unsigned int reg_iop_fifo_in_extra_rw_wr_data;
89#define REG_RD_ADDR_iop_fifo_in_extra_rw_wr_data 0
90#define REG_WR_ADDR_iop_fifo_in_extra_rw_wr_data 0
91
92/* Register r_stat, scope iop_fifo_in_extra, type r */
93typedef struct {
94 unsigned int avail_bytes : 4;
95 unsigned int last : 8;
96 unsigned int dif_in_en : 1;
97 unsigned int dif_out_en : 1;
98 unsigned int dummy1 : 18;
99} reg_iop_fifo_in_extra_r_stat;
100#define REG_RD_ADDR_iop_fifo_in_extra_r_stat 4
101
102/* Register rw_strb_dif_in, scope iop_fifo_in_extra, type rw */
103typedef struct {
104 unsigned int last : 2;
105 unsigned int dummy1 : 30;
106} reg_iop_fifo_in_extra_rw_strb_dif_in;
107#define REG_RD_ADDR_iop_fifo_in_extra_rw_strb_dif_in 8
108#define REG_WR_ADDR_iop_fifo_in_extra_rw_strb_dif_in 8
109
110/* Register rw_intr_mask, scope iop_fifo_in_extra, type rw */
111typedef struct {
112 unsigned int urun : 1;
113 unsigned int last_data : 1;
114 unsigned int dav : 1;
115 unsigned int avail : 1;
116 unsigned int orun : 1;
117 unsigned int dummy1 : 27;
118} reg_iop_fifo_in_extra_rw_intr_mask;
119#define REG_RD_ADDR_iop_fifo_in_extra_rw_intr_mask 12
120#define REG_WR_ADDR_iop_fifo_in_extra_rw_intr_mask 12
121
122/* Register rw_ack_intr, scope iop_fifo_in_extra, type rw */
123typedef struct {
124 unsigned int urun : 1;
125 unsigned int last_data : 1;
126 unsigned int dav : 1;
127 unsigned int avail : 1;
128 unsigned int orun : 1;
129 unsigned int dummy1 : 27;
130} reg_iop_fifo_in_extra_rw_ack_intr;
131#define REG_RD_ADDR_iop_fifo_in_extra_rw_ack_intr 16
132#define REG_WR_ADDR_iop_fifo_in_extra_rw_ack_intr 16
133
134/* Register r_intr, scope iop_fifo_in_extra, type r */
135typedef struct {
136 unsigned int urun : 1;
137 unsigned int last_data : 1;
138 unsigned int dav : 1;
139 unsigned int avail : 1;
140 unsigned int orun : 1;
141 unsigned int dummy1 : 27;
142} reg_iop_fifo_in_extra_r_intr;
143#define REG_RD_ADDR_iop_fifo_in_extra_r_intr 20
144
145/* Register r_masked_intr, scope iop_fifo_in_extra, type r */
146typedef struct {
147 unsigned int urun : 1;
148 unsigned int last_data : 1;
149 unsigned int dav : 1;
150 unsigned int avail : 1;
151 unsigned int orun : 1;
152 unsigned int dummy1 : 27;
153} reg_iop_fifo_in_extra_r_masked_intr;
154#define REG_RD_ADDR_iop_fifo_in_extra_r_masked_intr 24
155
156
157/* Constants */
158enum {
159 regk_iop_fifo_in_extra_fifo_in = 0x00000002,
160 regk_iop_fifo_in_extra_no = 0x00000000,
161 regk_iop_fifo_in_extra_rw_intr_mask_default = 0x00000000,
162 regk_iop_fifo_in_extra_yes = 0x00000001
163};
164#endif /* __iop_fifo_in_extra_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_defs.h
new file mode 100644
index 000000000000..833e10f02526
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_defs.h
@@ -0,0 +1,278 @@
1#ifndef __iop_fifo_out_defs_h
2#define __iop_fifo_out_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_out.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:09 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_fifo_out_defs.h ../../inst/io_proc/rtl/iop_fifo_out.r
11 * id: $Id: iop_fifo_out_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_fifo_out */
86
87/* Register rw_cfg, scope iop_fifo_out, type rw */
88typedef struct {
89 unsigned int free_lim : 3;
90 unsigned int byte_order : 2;
91 unsigned int trig : 2;
92 unsigned int last_dis_dif_in : 1;
93 unsigned int mode : 2;
94 unsigned int delay_out_last : 1;
95 unsigned int last_dis_dif_out : 1;
96 unsigned int dummy1 : 20;
97} reg_iop_fifo_out_rw_cfg;
98#define REG_RD_ADDR_iop_fifo_out_rw_cfg 0
99#define REG_WR_ADDR_iop_fifo_out_rw_cfg 0
100
101/* Register rw_ctrl, scope iop_fifo_out, type rw */
102typedef struct {
103 unsigned int dif_in_en : 1;
104 unsigned int dif_out_en : 1;
105 unsigned int dummy1 : 30;
106} reg_iop_fifo_out_rw_ctrl;
107#define REG_RD_ADDR_iop_fifo_out_rw_ctrl 4
108#define REG_WR_ADDR_iop_fifo_out_rw_ctrl 4
109
110/* Register r_stat, scope iop_fifo_out, type r */
111typedef struct {
112 unsigned int avail_bytes : 4;
113 unsigned int last : 8;
114 unsigned int dif_in_en : 1;
115 unsigned int dif_out_en : 1;
116 unsigned int zero_data_last : 1;
117 unsigned int dummy1 : 17;
118} reg_iop_fifo_out_r_stat;
119#define REG_RD_ADDR_iop_fifo_out_r_stat 8
120
121/* Register rw_wr1byte, scope iop_fifo_out, type rw */
122typedef struct {
123 unsigned int data : 8;
124 unsigned int dummy1 : 24;
125} reg_iop_fifo_out_rw_wr1byte;
126#define REG_RD_ADDR_iop_fifo_out_rw_wr1byte 12
127#define REG_WR_ADDR_iop_fifo_out_rw_wr1byte 12
128
129/* Register rw_wr2byte, scope iop_fifo_out, type rw */
130typedef struct {
131 unsigned int data : 16;
132 unsigned int dummy1 : 16;
133} reg_iop_fifo_out_rw_wr2byte;
134#define REG_RD_ADDR_iop_fifo_out_rw_wr2byte 16
135#define REG_WR_ADDR_iop_fifo_out_rw_wr2byte 16
136
137/* Register rw_wr3byte, scope iop_fifo_out, type rw */
138typedef struct {
139 unsigned int data : 24;
140 unsigned int dummy1 : 8;
141} reg_iop_fifo_out_rw_wr3byte;
142#define REG_RD_ADDR_iop_fifo_out_rw_wr3byte 20
143#define REG_WR_ADDR_iop_fifo_out_rw_wr3byte 20
144
145/* Register rw_wr4byte, scope iop_fifo_out, type rw */
146typedef struct {
147 unsigned int data : 32;
148} reg_iop_fifo_out_rw_wr4byte;
149#define REG_RD_ADDR_iop_fifo_out_rw_wr4byte 24
150#define REG_WR_ADDR_iop_fifo_out_rw_wr4byte 24
151
152/* Register rw_wr1byte_last, scope iop_fifo_out, type rw */
153typedef struct {
154 unsigned int data : 8;
155 unsigned int dummy1 : 24;
156} reg_iop_fifo_out_rw_wr1byte_last;
157#define REG_RD_ADDR_iop_fifo_out_rw_wr1byte_last 28
158#define REG_WR_ADDR_iop_fifo_out_rw_wr1byte_last 28
159
160/* Register rw_wr2byte_last, scope iop_fifo_out, type rw */
161typedef struct {
162 unsigned int data : 16;
163 unsigned int dummy1 : 16;
164} reg_iop_fifo_out_rw_wr2byte_last;
165#define REG_RD_ADDR_iop_fifo_out_rw_wr2byte_last 32
166#define REG_WR_ADDR_iop_fifo_out_rw_wr2byte_last 32
167
168/* Register rw_wr3byte_last, scope iop_fifo_out, type rw */
169typedef struct {
170 unsigned int data : 24;
171 unsigned int dummy1 : 8;
172} reg_iop_fifo_out_rw_wr3byte_last;
173#define REG_RD_ADDR_iop_fifo_out_rw_wr3byte_last 36
174#define REG_WR_ADDR_iop_fifo_out_rw_wr3byte_last 36
175
176/* Register rw_wr4byte_last, scope iop_fifo_out, type rw */
177typedef struct {
178 unsigned int data : 32;
179} reg_iop_fifo_out_rw_wr4byte_last;
180#define REG_RD_ADDR_iop_fifo_out_rw_wr4byte_last 40
181#define REG_WR_ADDR_iop_fifo_out_rw_wr4byte_last 40
182
183/* Register rw_set_last, scope iop_fifo_out, type rw */
184typedef unsigned int reg_iop_fifo_out_rw_set_last;
185#define REG_RD_ADDR_iop_fifo_out_rw_set_last 44
186#define REG_WR_ADDR_iop_fifo_out_rw_set_last 44
187
188/* Register rs_rd_data, scope iop_fifo_out, type rs */
189typedef unsigned int reg_iop_fifo_out_rs_rd_data;
190#define REG_RD_ADDR_iop_fifo_out_rs_rd_data 48
191
192/* Register r_rd_data, scope iop_fifo_out, type r */
193typedef unsigned int reg_iop_fifo_out_r_rd_data;
194#define REG_RD_ADDR_iop_fifo_out_r_rd_data 52
195
196/* Register rw_strb_dif_out, scope iop_fifo_out, type rw */
197typedef unsigned int reg_iop_fifo_out_rw_strb_dif_out;
198#define REG_RD_ADDR_iop_fifo_out_rw_strb_dif_out 56
199#define REG_WR_ADDR_iop_fifo_out_rw_strb_dif_out 56
200
201/* Register rw_intr_mask, scope iop_fifo_out, type rw */
202typedef struct {
203 unsigned int urun : 1;
204 unsigned int last_data : 1;
205 unsigned int dav : 1;
206 unsigned int free : 1;
207 unsigned int orun : 1;
208 unsigned int dummy1 : 27;
209} reg_iop_fifo_out_rw_intr_mask;
210#define REG_RD_ADDR_iop_fifo_out_rw_intr_mask 60
211#define REG_WR_ADDR_iop_fifo_out_rw_intr_mask 60
212
213/* Register rw_ack_intr, scope iop_fifo_out, type rw */
214typedef struct {
215 unsigned int urun : 1;
216 unsigned int last_data : 1;
217 unsigned int dav : 1;
218 unsigned int free : 1;
219 unsigned int orun : 1;
220 unsigned int dummy1 : 27;
221} reg_iop_fifo_out_rw_ack_intr;
222#define REG_RD_ADDR_iop_fifo_out_rw_ack_intr 64
223#define REG_WR_ADDR_iop_fifo_out_rw_ack_intr 64
224
225/* Register r_intr, scope iop_fifo_out, type r */
226typedef struct {
227 unsigned int urun : 1;
228 unsigned int last_data : 1;
229 unsigned int dav : 1;
230 unsigned int free : 1;
231 unsigned int orun : 1;
232 unsigned int dummy1 : 27;
233} reg_iop_fifo_out_r_intr;
234#define REG_RD_ADDR_iop_fifo_out_r_intr 68
235
236/* Register r_masked_intr, scope iop_fifo_out, type r */
237typedef struct {
238 unsigned int urun : 1;
239 unsigned int last_data : 1;
240 unsigned int dav : 1;
241 unsigned int free : 1;
242 unsigned int orun : 1;
243 unsigned int dummy1 : 27;
244} reg_iop_fifo_out_r_masked_intr;
245#define REG_RD_ADDR_iop_fifo_out_r_masked_intr 72
246
247
248/* Constants */
249enum {
250 regk_iop_fifo_out_hi = 0x00000000,
251 regk_iop_fifo_out_neg = 0x00000002,
252 regk_iop_fifo_out_no = 0x00000000,
253 regk_iop_fifo_out_order16 = 0x00000001,
254 regk_iop_fifo_out_order24 = 0x00000002,
255 regk_iop_fifo_out_order32 = 0x00000003,
256 regk_iop_fifo_out_order8 = 0x00000000,
257 regk_iop_fifo_out_pos = 0x00000001,
258 regk_iop_fifo_out_pos_neg = 0x00000003,
259 regk_iop_fifo_out_rw_cfg_default = 0x00000024,
260 regk_iop_fifo_out_rw_ctrl_default = 0x00000000,
261 regk_iop_fifo_out_rw_intr_mask_default = 0x00000000,
262 regk_iop_fifo_out_rw_set_last_default = 0x00000000,
263 regk_iop_fifo_out_rw_strb_dif_out_default = 0x00000000,
264 regk_iop_fifo_out_rw_wr1byte_default = 0x00000000,
265 regk_iop_fifo_out_rw_wr1byte_last_default = 0x00000000,
266 regk_iop_fifo_out_rw_wr2byte_default = 0x00000000,
267 regk_iop_fifo_out_rw_wr2byte_last_default = 0x00000000,
268 regk_iop_fifo_out_rw_wr3byte_default = 0x00000000,
269 regk_iop_fifo_out_rw_wr3byte_last_default = 0x00000000,
270 regk_iop_fifo_out_rw_wr4byte_default = 0x00000000,
271 regk_iop_fifo_out_rw_wr4byte_last_default = 0x00000000,
272 regk_iop_fifo_out_size16 = 0x00000002,
273 regk_iop_fifo_out_size24 = 0x00000001,
274 regk_iop_fifo_out_size32 = 0x00000000,
275 regk_iop_fifo_out_size8 = 0x00000003,
276 regk_iop_fifo_out_yes = 0x00000001
277};
278#endif /* __iop_fifo_out_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_extra_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_extra_defs.h
new file mode 100644
index 000000000000..4a840aae84ee
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_fifo_out_extra_defs.h
@@ -0,0 +1,164 @@
1#ifndef __iop_fifo_out_extra_defs_h
2#define __iop_fifo_out_extra_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_fifo_out_extra.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:10 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_fifo_out_extra_defs.h ../../inst/io_proc/rtl/iop_fifo_out_extra.r
11 * id: $Id: iop_fifo_out_extra_defs.h,v 1.1 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_fifo_out_extra */
86
87/* Register rs_rd_data, scope iop_fifo_out_extra, type rs */
88typedef unsigned int reg_iop_fifo_out_extra_rs_rd_data;
89#define REG_RD_ADDR_iop_fifo_out_extra_rs_rd_data 0
90
91/* Register r_rd_data, scope iop_fifo_out_extra, type r */
92typedef unsigned int reg_iop_fifo_out_extra_r_rd_data;
93#define REG_RD_ADDR_iop_fifo_out_extra_r_rd_data 4
94
95/* Register r_stat, scope iop_fifo_out_extra, type r */
96typedef struct {
97 unsigned int avail_bytes : 4;
98 unsigned int last : 8;
99 unsigned int dif_in_en : 1;
100 unsigned int dif_out_en : 1;
101 unsigned int zero_data_last : 1;
102 unsigned int dummy1 : 17;
103} reg_iop_fifo_out_extra_r_stat;
104#define REG_RD_ADDR_iop_fifo_out_extra_r_stat 8
105
106/* Register rw_strb_dif_out, scope iop_fifo_out_extra, type rw */
107typedef unsigned int reg_iop_fifo_out_extra_rw_strb_dif_out;
108#define REG_RD_ADDR_iop_fifo_out_extra_rw_strb_dif_out 12
109#define REG_WR_ADDR_iop_fifo_out_extra_rw_strb_dif_out 12
110
111/* Register rw_intr_mask, scope iop_fifo_out_extra, type rw */
112typedef struct {
113 unsigned int urun : 1;
114 unsigned int last_data : 1;
115 unsigned int dav : 1;
116 unsigned int free : 1;
117 unsigned int orun : 1;
118 unsigned int dummy1 : 27;
119} reg_iop_fifo_out_extra_rw_intr_mask;
120#define REG_RD_ADDR_iop_fifo_out_extra_rw_intr_mask 16
121#define REG_WR_ADDR_iop_fifo_out_extra_rw_intr_mask 16
122
123/* Register rw_ack_intr, scope iop_fifo_out_extra, type rw */
124typedef struct {
125 unsigned int urun : 1;
126 unsigned int last_data : 1;
127 unsigned int dav : 1;
128 unsigned int free : 1;
129 unsigned int orun : 1;
130 unsigned int dummy1 : 27;
131} reg_iop_fifo_out_extra_rw_ack_intr;
132#define REG_RD_ADDR_iop_fifo_out_extra_rw_ack_intr 20
133#define REG_WR_ADDR_iop_fifo_out_extra_rw_ack_intr 20
134
135/* Register r_intr, scope iop_fifo_out_extra, type r */
136typedef struct {
137 unsigned int urun : 1;
138 unsigned int last_data : 1;
139 unsigned int dav : 1;
140 unsigned int free : 1;
141 unsigned int orun : 1;
142 unsigned int dummy1 : 27;
143} reg_iop_fifo_out_extra_r_intr;
144#define REG_RD_ADDR_iop_fifo_out_extra_r_intr 24
145
146/* Register r_masked_intr, scope iop_fifo_out_extra, type r */
147typedef struct {
148 unsigned int urun : 1;
149 unsigned int last_data : 1;
150 unsigned int dav : 1;
151 unsigned int free : 1;
152 unsigned int orun : 1;
153 unsigned int dummy1 : 27;
154} reg_iop_fifo_out_extra_r_masked_intr;
155#define REG_RD_ADDR_iop_fifo_out_extra_r_masked_intr 28
156
157
158/* Constants */
159enum {
160 regk_iop_fifo_out_extra_no = 0x00000000,
161 regk_iop_fifo_out_extra_rw_intr_mask_default = 0x00000000,
162 regk_iop_fifo_out_extra_yes = 0x00000001
163};
164#endif /* __iop_fifo_out_extra_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_defs.h
new file mode 100644
index 000000000000..c2b0ba1be60f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_defs.h
@@ -0,0 +1,190 @@
1#ifndef __iop_mpu_defs_h
2#define __iop_mpu_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_mpu.r
7 * id: iop_mpu.r,v 1.30 2005/02/17 08:12:33 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_mpu_defs.h ../../inst/io_proc/rtl/iop_mpu.r
11 * id: $Id: iop_mpu_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_mpu */
86
87#define STRIDE_iop_mpu_rw_r 4
88/* Register rw_r, scope iop_mpu, type rw */
89typedef unsigned int reg_iop_mpu_rw_r;
90#define REG_RD_ADDR_iop_mpu_rw_r 0
91#define REG_WR_ADDR_iop_mpu_rw_r 0
92
93/* Register rw_ctrl, scope iop_mpu, type rw */
94typedef struct {
95 unsigned int en : 1;
96 unsigned int dummy1 : 31;
97} reg_iop_mpu_rw_ctrl;
98#define REG_RD_ADDR_iop_mpu_rw_ctrl 128
99#define REG_WR_ADDR_iop_mpu_rw_ctrl 128
100
101/* Register r_pc, scope iop_mpu, type r */
102typedef struct {
103 unsigned int addr : 12;
104 unsigned int dummy1 : 20;
105} reg_iop_mpu_r_pc;
106#define REG_RD_ADDR_iop_mpu_r_pc 132
107
108/* Register r_stat, scope iop_mpu, type r */
109typedef struct {
110 unsigned int instr_reg_busy : 1;
111 unsigned int intr_busy : 1;
112 unsigned int intr_vect : 16;
113 unsigned int dummy1 : 14;
114} reg_iop_mpu_r_stat;
115#define REG_RD_ADDR_iop_mpu_r_stat 136
116
117/* Register rw_instr, scope iop_mpu, type rw */
118typedef unsigned int reg_iop_mpu_rw_instr;
119#define REG_RD_ADDR_iop_mpu_rw_instr 140
120#define REG_WR_ADDR_iop_mpu_rw_instr 140
121
122/* Register rw_immediate, scope iop_mpu, type rw */
123typedef unsigned int reg_iop_mpu_rw_immediate;
124#define REG_RD_ADDR_iop_mpu_rw_immediate 144
125#define REG_WR_ADDR_iop_mpu_rw_immediate 144
126
127/* Register r_trace, scope iop_mpu, type r */
128typedef struct {
129 unsigned int intr_vect : 16;
130 unsigned int pc : 12;
131 unsigned int en : 1;
132 unsigned int instr_reg_busy : 1;
133 unsigned int intr_busy : 1;
134 unsigned int dummy1 : 1;
135} reg_iop_mpu_r_trace;
136#define REG_RD_ADDR_iop_mpu_r_trace 148
137
138/* Register r_wr_stat, scope iop_mpu, type r */
139typedef struct {
140 unsigned int r0 : 1;
141 unsigned int r1 : 1;
142 unsigned int r2 : 1;
143 unsigned int r3 : 1;
144 unsigned int r4 : 1;
145 unsigned int r5 : 1;
146 unsigned int r6 : 1;
147 unsigned int r7 : 1;
148 unsigned int r8 : 1;
149 unsigned int r9 : 1;
150 unsigned int r10 : 1;
151 unsigned int r11 : 1;
152 unsigned int r12 : 1;
153 unsigned int r13 : 1;
154 unsigned int r14 : 1;
155 unsigned int r15 : 1;
156 unsigned int dummy1 : 16;
157} reg_iop_mpu_r_wr_stat;
158#define REG_RD_ADDR_iop_mpu_r_wr_stat 152
159
160#define STRIDE_iop_mpu_rw_thread 4
161/* Register rw_thread, scope iop_mpu, type rw */
162typedef struct {
163 unsigned int addr : 12;
164 unsigned int dummy1 : 20;
165} reg_iop_mpu_rw_thread;
166#define REG_RD_ADDR_iop_mpu_rw_thread 156
167#define REG_WR_ADDR_iop_mpu_rw_thread 156
168
169#define STRIDE_iop_mpu_rw_intr 4
170/* Register rw_intr, scope iop_mpu, type rw */
171typedef struct {
172 unsigned int addr : 12;
173 unsigned int dummy1 : 20;
174} reg_iop_mpu_rw_intr;
175#define REG_RD_ADDR_iop_mpu_rw_intr 196
176#define REG_WR_ADDR_iop_mpu_rw_intr 196
177
178
179/* Constants */
180enum {
181 regk_iop_mpu_no = 0x00000000,
182 regk_iop_mpu_r_pc_default = 0x00000000,
183 regk_iop_mpu_rw_ctrl_default = 0x00000000,
184 regk_iop_mpu_rw_intr_size = 0x00000010,
185 regk_iop_mpu_rw_r_size = 0x00000010,
186 regk_iop_mpu_rw_thread_default = 0x00000000,
187 regk_iop_mpu_rw_thread_size = 0x00000004,
188 regk_iop_mpu_yes = 0x00000001
189};
190#endif /* __iop_mpu_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_macros.h b/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_macros.h
new file mode 100644
index 000000000000..2ec897ced166
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_macros.h
@@ -0,0 +1,764 @@
1/* ************************************************************************* */
2/* This file is autogenerated by IOPASM Version 1.2 */
3/* DO NOT EDIT THIS FILE - All changes will be lost! */
4/* ************************************************************************* */
5
6
7
8#ifndef __IOP_MPU_MACROS_H__
9#define __IOP_MPU_MACROS_H__
10
11
12/* ************************************************************************* */
13/* REGISTER DEFINITIONS */
14/* ************************************************************************* */
15#define MPU_R0 (0x0)
16#define MPU_R1 (0x1)
17#define MPU_R2 (0x2)
18#define MPU_R3 (0x3)
19#define MPU_R4 (0x4)
20#define MPU_R5 (0x5)
21#define MPU_R6 (0x6)
22#define MPU_R7 (0x7)
23#define MPU_R8 (0x8)
24#define MPU_R9 (0x9)
25#define MPU_R10 (0xa)
26#define MPU_R11 (0xb)
27#define MPU_R12 (0xc)
28#define MPU_R13 (0xd)
29#define MPU_R14 (0xe)
30#define MPU_R15 (0xf)
31#define MPU_PC (0x2)
32#define MPU_WSTS (0x3)
33#define MPU_JADDR (0x4)
34#define MPU_IRP (0x5)
35#define MPU_SRP (0x6)
36#define MPU_T0 (0x8)
37#define MPU_T1 (0x9)
38#define MPU_T2 (0xa)
39#define MPU_T3 (0xb)
40#define MPU_I0 (0x10)
41#define MPU_I1 (0x11)
42#define MPU_I2 (0x12)
43#define MPU_I3 (0x13)
44#define MPU_I4 (0x14)
45#define MPU_I5 (0x15)
46#define MPU_I6 (0x16)
47#define MPU_I7 (0x17)
48#define MPU_I8 (0x18)
49#define MPU_I9 (0x19)
50#define MPU_I10 (0x1a)
51#define MPU_I11 (0x1b)
52#define MPU_I12 (0x1c)
53#define MPU_I13 (0x1d)
54#define MPU_I14 (0x1e)
55#define MPU_I15 (0x1f)
56#define MPU_P2 (0x2)
57#define MPU_P3 (0x3)
58#define MPU_P5 (0x5)
59#define MPU_P6 (0x6)
60#define MPU_P8 (0x8)
61#define MPU_P9 (0x9)
62#define MPU_P10 (0xa)
63#define MPU_P11 (0xb)
64#define MPU_P16 (0x10)
65#define MPU_P17 (0x12)
66#define MPU_P18 (0x12)
67#define MPU_P19 (0x13)
68#define MPU_P20 (0x14)
69#define MPU_P21 (0x15)
70#define MPU_P22 (0x16)
71#define MPU_P23 (0x17)
72#define MPU_P24 (0x18)
73#define MPU_P25 (0x19)
74#define MPU_P26 (0x1a)
75#define MPU_P27 (0x1b)
76#define MPU_P28 (0x1c)
77#define MPU_P29 (0x1d)
78#define MPU_P30 (0x1e)
79#define MPU_P31 (0x1f)
80#define MPU_P1 (0x1)
81#define MPU_REGA (0x1)
82
83
84
85/* ************************************************************************* */
86/* ADDRESS MACROS */
87/* ************************************************************************* */
88#define MK_DWORD_ADDR(ADDR) (ADDR >> 2)
89#define MK_BYTE_ADDR(ADDR) (ADDR)
90
91
92
93/* ************************************************************************* */
94/* INSTRUCTION MACROS */
95/* ************************************************************************* */
96#define MPU_ADD_RRR(S,N,D) (0x4000008C | ((S & ((1 << 5) - 1)) << 16)\
97 | ((N & ((1 << 5) - 1)) << 11)\
98 | ((D & ((1 << 5) - 1)) << 21))
99
100#define MPU_ADD_RRS(S,N,D) (0x4000048C | ((S & ((1 << 5) - 1)) << 16)\
101 | ((N & ((1 << 5) - 1)) << 11)\
102 | ((D & ((1 << 5) - 1)) << 21))
103
104#define MPU_ADD_RSR(S,N,D) (0x4000018C | ((S & ((1 << 5) - 1)) << 16)\
105 | ((N & ((1 << 5) - 1)) << 11)\
106 | ((D & ((1 << 5) - 1)) << 21))
107
108#define MPU_ADD_RSS(S,N,D) (0x4000058C | ((S & ((1 << 5) - 1)) << 16)\
109 | ((N & ((1 << 5) - 1)) << 11)\
110 | ((D & ((1 << 5) - 1)) << 21))
111
112#define MPU_ADD_SRR(S,N,D) (0x4000028C | ((S & ((1 << 5) - 1)) << 16)\
113 | ((N & ((1 << 5) - 1)) << 11)\
114 | ((D & ((1 << 5) - 1)) << 21))
115
116#define MPU_ADD_SRS(S,N,D) (0x4000068C | ((S & ((1 << 5) - 1)) << 16)\
117 | ((N & ((1 << 5) - 1)) << 11)\
118 | ((D & ((1 << 5) - 1)) << 21))
119
120#define MPU_ADD_SSR(S,N,D) (0x4000038C | ((S & ((1 << 5) - 1)) << 16)\
121 | ((N & ((1 << 5) - 1)) << 11)\
122 | ((D & ((1 << 5) - 1)) << 21))
123
124#define MPU_ADD_SSS(S,N,D) (0x4000078C | ((S & ((1 << 5) - 1)) << 16)\
125 | ((N & ((1 << 5) - 1)) << 11)\
126 | ((D & ((1 << 5) - 1)) << 21))
127
128#define MPU_ADDQ_RIR(S,N,D) (0x10000000 | ((S & ((1 << 5) - 1)) << 16)\
129 | ((N & ((1 << 16) - 1)) << 0)\
130 | ((D & ((1 << 5) - 1)) << 21))
131
132#define MPU_ADDQ_IRR(S,N,D) (0x10000000 | ((S & ((1 << 16) - 1)) << 0)\
133 | ((N & ((1 << 5) - 1)) << 16)\
134 | ((D & ((1 << 5) - 1)) << 21))
135
136#define MPU_ADDX_IRR_INSTR(S,N,D) (0xC000008C | ((N & ((1 << 5) - 1)) << 16)\
137 | ((D & ((1 << 5) - 1)) << 21))
138
139#define MPU_ADDX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)
140
141#define MPU_ADDX_RIR_INSTR(S,N,D) (0xC000008C | ((S & ((1 << 5) - 1)) << 16)\
142 | ((D & ((1 << 5) - 1)) << 21))
143
144#define MPU_ADDX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)
145
146#define MPU_ADDX_ISR_INSTR(S,N,D) (0xC000028C | ((N & ((1 << 5) - 1)) << 16)\
147 | ((D & ((1 << 5) - 1)) << 21))
148
149#define MPU_ADDX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)
150
151#define MPU_ADDX_SIR_INSTR(S,N,D) (0xC000028C | ((S & ((1 << 5) - 1)) << 16)\
152 | ((D & ((1 << 5) - 1)) << 21))
153
154#define MPU_ADDX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)
155
156#define MPU_ADDX_IRS_INSTR(S,N,D) (0xC000048C | ((N & ((1 << 5) - 1)) << 16)\
157 | ((D & ((1 << 5) - 1)) << 21))
158
159#define MPU_ADDX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)
160
161#define MPU_ADDX_RIS_INSTR(S,N,D) (0xC000048C | ((S & ((1 << 5) - 1)) << 16)\
162 | ((D & ((1 << 5) - 1)) << 21))
163
164#define MPU_ADDX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)
165
166#define MPU_ADDX_ISS_INSTR(S,N,D) (0xC000068C | ((N & ((1 << 5) - 1)) << 16)\
167 | ((D & ((1 << 5) - 1)) << 21))
168
169#define MPU_ADDX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)
170
171#define MPU_ADDX_SIS_INSTR(S,N,D) (0xC000068C | ((S & ((1 << 5) - 1)) << 16)\
172 | ((D & ((1 << 5) - 1)) << 21))
173
174#define MPU_ADDX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)
175
176#define MPU_AND_RRR(S,N,D) (0x4000008A | ((S & ((1 << 5) - 1)) << 16)\
177 | ((N & ((1 << 5) - 1)) << 11)\
178 | ((D & ((1 << 5) - 1)) << 21))
179
180#define MPU_AND_RRS(S,N,D) (0x4000048A | ((S & ((1 << 5) - 1)) << 16)\
181 | ((N & ((1 << 5) - 1)) << 11)\
182 | ((D & ((1 << 5) - 1)) << 21))
183
184#define MPU_AND_RSR(S,N,D) (0x4000018A | ((S & ((1 << 5) - 1)) << 16)\
185 | ((N & ((1 << 5) - 1)) << 11)\
186 | ((D & ((1 << 5) - 1)) << 21))
187
188#define MPU_AND_RSS(S,N,D) (0x4000058A | ((S & ((1 << 5) - 1)) << 16)\
189 | ((N & ((1 << 5) - 1)) << 11)\
190 | ((D & ((1 << 5) - 1)) << 21))
191
192#define MPU_AND_SRR(S,N,D) (0x4000028A | ((S & ((1 << 5) - 1)) << 16)\
193 | ((N & ((1 << 5) - 1)) << 11)\
194 | ((D & ((1 << 5) - 1)) << 21))
195
196#define MPU_AND_SRS(S,N,D) (0x4000068A | ((S & ((1 << 5) - 1)) << 16)\
197 | ((N & ((1 << 5) - 1)) << 11)\
198 | ((D & ((1 << 5) - 1)) << 21))
199
200#define MPU_AND_SSR(S,N,D) (0x4000038A | ((S & ((1 << 5) - 1)) << 16)\
201 | ((N & ((1 << 5) - 1)) << 11)\
202 | ((D & ((1 << 5) - 1)) << 21))
203
204#define MPU_AND_SSS(S,N,D) (0x4000078A | ((S & ((1 << 5) - 1)) << 16)\
205 | ((N & ((1 << 5) - 1)) << 11)\
206 | ((D & ((1 << 5) - 1)) << 21))
207
208#define MPU_ANDQ_RIR(S,N,D) (0x08000000 | ((S & ((1 << 5) - 1)) << 16)\
209 | ((N & ((1 << 16) - 1)) << 0)\
210 | ((D & ((1 << 5) - 1)) << 21))
211
212#define MPU_ANDQ_IRR(S,N,D) (0x08000000 | ((S & ((1 << 16) - 1)) << 0)\
213 | ((N & ((1 << 5) - 1)) << 16)\
214 | ((D & ((1 << 5) - 1)) << 21))
215
216#define MPU_ANDX_RIR_INSTR(S,N,D) (0xC000008A | ((S & ((1 << 5) - 1)) << 16)\
217 | ((D & ((1 << 5) - 1)) << 21))
218
219#define MPU_ANDX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)
220
221#define MPU_ANDX_IRR_INSTR(S,N,D) (0xC000008A | ((N & ((1 << 5) - 1)) << 16)\
222 | ((D & ((1 << 5) - 1)) << 21))
223
224#define MPU_ANDX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)
225
226#define MPU_ANDX_ISR_INSTR(S,N,D) (0xC000028A | ((N & ((1 << 5) - 1)) << 16)\
227 | ((D & ((1 << 5) - 1)) << 21))
228
229#define MPU_ANDX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)
230
231#define MPU_ANDX_SIR_INSTR(S,N,D) (0xC000028A | ((S & ((1 << 5) - 1)) << 16)\
232 | ((D & ((1 << 5) - 1)) << 21))
233
234#define MPU_ANDX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)
235
236#define MPU_ANDX_IRS_INSTR(S,N,D) (0xC000048A | ((N & ((1 << 5) - 1)) << 16)\
237 | ((D & ((1 << 5) - 1)) << 21))
238
239#define MPU_ANDX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)
240
241#define MPU_ANDX_ISS_INSTR(S,N,D) (0xC000068A | ((N & ((1 << 5) - 1)) << 16)\
242 | ((D & ((1 << 5) - 1)) << 21))
243
244#define MPU_ANDX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)
245
246#define MPU_ANDX_RIS_INSTR(S,N,D) (0xC000048A | ((S & ((1 << 5) - 1)) << 16)\
247 | ((D & ((1 << 5) - 1)) << 21))
248
249#define MPU_ANDX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)
250
251#define MPU_ANDX_SIS_INSTR(S,N,D) (0xC000068A | ((S & ((1 << 5) - 1)) << 16)\
252 | ((D & ((1 << 5) - 1)) << 21))
253
254#define MPU_ANDX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)
255
256#define MPU_BA_I(S) (0x60000000 | ((S & ((1 << 16) - 1)) << 0))
257
258#define MPU_BAR_R(S) (0x62000000 | ((S & ((1 << 5) - 1)) << 11))
259
260#define MPU_BAR_S(S) (0x63000000 | ((S & ((1 << 5) - 1)) << 11))
261
262#define MPU_BBC_RII(S,N,D) (0x78000000 | ((S & ((1 << 5) - 1)) << 16)\
263 | ((N & ((1 << 5) - 1)) << 21)\
264 | ((D & ((1 << 16) - 1)) << 0))
265
266#define MPU_BBS_RII(S,N,D) (0x7C000000 | ((S & ((1 << 5) - 1)) << 16)\
267 | ((N & ((1 << 5) - 1)) << 21)\
268 | ((D & ((1 << 16) - 1)) << 0))
269
270#define MPU_BNZ_RI(S,D) (0x74400000 | ((S & ((1 << 5) - 1)) << 16)\
271 | ((D & ((1 << 16) - 1)) << 0))
272
273#define MPU_BMI_RI(S,D) (0x7FE00000 | ((S & ((1 << 5) - 1)) << 16)\
274 | ((D & ((1 << 16) - 1)) << 0))
275
276#define MPU_BPL_RI(S,D) (0x7BE00000 | ((S & ((1 << 5) - 1)) << 16)\
277 | ((D & ((1 << 16) - 1)) << 0))
278
279#define MPU_BZ_RI(S,D) (0x74000000 | ((S & ((1 << 5) - 1)) << 16)\
280 | ((D & ((1 << 16) - 1)) << 0))
281
282#define MPU_DI() (0x40000001)
283
284#define MPU_EI() (0x40000003)
285
286#define MPU_HALT() (0x40000002)
287
288#define MPU_JIR_I(S) (0x60200000 | ((S & ((1 << 16) - 1)) << 0))
289
290#define MPU_JIR_R(S) (0x62200000 | ((S & ((1 << 5) - 1)) << 11))
291
292#define MPU_JIR_S(S) (0x63200000 | ((S & ((1 << 5) - 1)) << 11))
293
294#define MPU_JNT() (0x61000000)
295
296#define MPU_JSR_I(S) (0x60400000 | ((S & ((1 << 16) - 1)) << 0))
297
298#define MPU_JSR_R(S) (0x62400000 | ((S & ((1 << 5) - 1)) << 11))
299
300#define MPU_JSR_S(S) (0x63400000 | ((S & ((1 << 5) - 1)) << 11))
301
302#define MPU_LSL_RRR(S,N,D) (0x4000008E | ((S & ((1 << 5) - 1)) << 16)\
303 | ((N & ((1 << 5) - 1)) << 11)\
304 | ((D & ((1 << 5) - 1)) << 21))
305
306#define MPU_LSL_RRS(S,N,D) (0x4000048E | ((S & ((1 << 5) - 1)) << 16)\
307 | ((N & ((1 << 5) - 1)) << 11)\
308 | ((D & ((1 << 5) - 1)) << 21))
309
310#define MPU_LSL_RSR(S,N,D) (0x4000018E | ((S & ((1 << 5) - 1)) << 16)\
311 | ((N & ((1 << 5) - 1)) << 11)\
312 | ((D & ((1 << 5) - 1)) << 21))
313
314#define MPU_LSL_RSS(S,N,D) (0x4000058E | ((S & ((1 << 5) - 1)) << 16)\
315 | ((N & ((1 << 5) - 1)) << 11)\
316 | ((D & ((1 << 5) - 1)) << 21))
317
318#define MPU_LSL_SRR(S,N,D) (0x4000028E | ((S & ((1 << 5) - 1)) << 16)\
319 | ((N & ((1 << 5) - 1)) << 11)\
320 | ((D & ((1 << 5) - 1)) << 21))
321
322#define MPU_LSL_SRS(S,N,D) (0x4000068E | ((S & ((1 << 5) - 1)) << 16)\
323 | ((N & ((1 << 5) - 1)) << 11)\
324 | ((D & ((1 << 5) - 1)) << 21))
325
326#define MPU_LSL_SSR(S,N,D) (0x4000038E | ((S & ((1 << 5) - 1)) << 16)\
327 | ((N & ((1 << 5) - 1)) << 11)\
328 | ((D & ((1 << 5) - 1)) << 21))
329
330#define MPU_LSL_SSS(S,N,D) (0x4000078E | ((S & ((1 << 5) - 1)) << 16)\
331 | ((N & ((1 << 5) - 1)) << 11)\
332 | ((D & ((1 << 5) - 1)) << 21))
333
334#define MPU_LSLQ_RIR(S,N,D) (0x18000000 | ((S & ((1 << 5) - 1)) << 16)\
335 | ((N & ((1 << 16) - 1)) << 0)\
336 | ((D & ((1 << 5) - 1)) << 21))
337
338#define MPU_LSR_RRR(S,N,D) (0x4000008F | ((S & ((1 << 5) - 1)) << 16)\
339 | ((N & ((1 << 5) - 1)) << 11)\
340 | ((D & ((1 << 5) - 1)) << 21))
341
342#define MPU_LSR_RRS(S,N,D) (0x4000048F | ((S & ((1 << 5) - 1)) << 16)\
343 | ((N & ((1 << 5) - 1)) << 11)\
344 | ((D & ((1 << 5) - 1)) << 21))
345
346#define MPU_LSR_RSR(S,N,D) (0x4000018F | ((S & ((1 << 5) - 1)) << 16)\
347 | ((N & ((1 << 5) - 1)) << 11)\
348 | ((D & ((1 << 5) - 1)) << 21))
349
350#define MPU_LSR_RSS(S,N,D) (0x4000058F | ((S & ((1 << 5) - 1)) << 16)\
351 | ((N & ((1 << 5) - 1)) << 11)\
352 | ((D & ((1 << 5) - 1)) << 21))
353
354#define MPU_LSR_SRR(S,N,D) (0x4000028F | ((S & ((1 << 5) - 1)) << 16)\
355 | ((N & ((1 << 5) - 1)) << 11)\
356 | ((D & ((1 << 5) - 1)) << 21))
357
358#define MPU_LSR_SRS(S,N,D) (0x4000068F | ((S & ((1 << 5) - 1)) << 16)\
359 | ((N & ((1 << 5) - 1)) << 11)\
360 | ((D & ((1 << 5) - 1)) << 21))
361
362#define MPU_LSR_SSR(S,N,D) (0x4000038F | ((S & ((1 << 5) - 1)) << 16)\
363 | ((N & ((1 << 5) - 1)) << 11)\
364 | ((D & ((1 << 5) - 1)) << 21))
365
366#define MPU_LSR_SSS(S,N,D) (0x4000078F | ((S & ((1 << 5) - 1)) << 16)\
367 | ((N & ((1 << 5) - 1)) << 11)\
368 | ((D & ((1 << 5) - 1)) << 21))
369
370#define MPU_LSRQ_RIR(S,N,D) (0x1C000000 | ((S & ((1 << 5) - 1)) << 16)\
371 | ((N & ((1 << 16) - 1)) << 0)\
372 | ((D & ((1 << 5) - 1)) << 21))
373
374#define MPU_LW_IR(S,D) (0x64400000 | ((S & ((1 << 16) - 1)) << 0)\
375 | ((D & ((1 << 5) - 1)) << 16))
376
377#define MPU_LW_IS(S,D) (0x64600000 | ((S & ((1 << 16) - 1)) << 0)\
378 | ((D & ((1 << 5) - 1)) << 16))
379
380#define MPU_LW_RR(S,D) (0x66400000 | ((S & ((1 << 5) - 1)) << 11)\
381 | ((D & ((1 << 5) - 1)) << 16))
382
383#define MPU_LW_RS(S,D) (0x66600000 | ((S & ((1 << 5) - 1)) << 11)\
384 | ((D & ((1 << 5) - 1)) << 16))
385
386#define MPU_LW_SR(S,D) (0x67400000 | ((S & ((1 << 5) - 1)) << 11)\
387 | ((D & ((1 << 5) - 1)) << 16))
388
389#define MPU_LW_SS(S,D) (0x67600000 | ((S & ((1 << 5) - 1)) << 11)\
390 | ((D & ((1 << 5) - 1)) << 16))
391
392#define MPU_LW_RIR(S,N,D) (0x66400000 | ((S & ((1 << 5) - 1)) << 11)\
393 | ((N & ((1 << 8) - 1)) << 0)\
394 | ((D & ((1 << 5) - 1)) << 16))
395
396#define MPU_LW_RIS(S,N,D) (0x66600000 | ((S & ((1 << 5) - 1)) << 11)\
397 | ((N & ((1 << 8) - 1)) << 0)\
398 | ((D & ((1 << 5) - 1)) << 16))
399
400#define MPU_LW_SIR(S,N,D) (0x67400000 | ((S & ((1 << 5) - 1)) << 11)\
401 | ((N & ((1 << 8) - 1)) << 0)\
402 | ((D & ((1 << 5) - 1)) << 16))
403
404#define MPU_LW_SIS(S,N,D) (0x67600000 | ((S & ((1 << 5) - 1)) << 11)\
405 | ((N & ((1 << 8) - 1)) << 0)\
406 | ((D & ((1 << 5) - 1)) << 16))
407
408#define MPU_MOVE_RR(S,D) (0x40000081 | ((S & ((1 << 5) - 1)) << 11)\
409 | ((D & ((1 << 5) - 1)) << 21))
410
411#define MPU_MOVE_RS(S,D) (0x40000481 | ((S & ((1 << 5) - 1)) << 11)\
412 | ((D & ((1 << 5) - 1)) << 21))
413
414#define MPU_MOVE_SR(S,D) (0x40000181 | ((S & ((1 << 5) - 1)) << 11)\
415 | ((D & ((1 << 5) - 1)) << 21))
416
417#define MPU_MOVE_SS(S,D) (0x40000581 | ((S & ((1 << 5) - 1)) << 11)\
418 | ((D & ((1 << 5) - 1)) << 21))
419
420#define MPU_MOVEQ_IR(S,D) (0x24000000 | ((S & ((1 << 16) - 1)) << 0)\
421 | ((D & ((1 << 5) - 1)) << 21))
422
423#define MPU_MOVEQ_IS(S,D) (0x2C000000 | ((S & ((1 << 16) - 1)) << 0)\
424 | ((D & ((1 << 5) - 1)) << 21))
425
426#define MPU_MOVEX_IR_INSTR(S,D) (0xC0000081 | ((D & ((1 << 5) - 1)) << 21))
427
428#define MPU_MOVEX_IR_IMM(S,D) (S & 0xFFFFFFFF)
429
430#define MPU_MOVEX_IS_INSTR(S,D) (0xC0000481 | ((D & ((1 << 5) - 1)) << 21))
431
432#define MPU_MOVEX_IS_IMM(S,D) (S & 0xFFFFFFFF)
433
434#define MPU_NOP() (0x40000000)
435
436#define MPU_NOT_RR(S,D) (0x40100081 | ((S & ((1 << 5) - 1)) << 11)\
437 | ((D & ((1 << 5) - 1)) << 21))
438
439#define MPU_NOT_RS(S,D) (0x40100481 | ((S & ((1 << 5) - 1)) << 11)\
440 | ((D & ((1 << 5) - 1)) << 21))
441
442#define MPU_NOT_SR(S,D) (0x40100181 | ((S & ((1 << 5) - 1)) << 11)\
443 | ((D & ((1 << 5) - 1)) << 21))
444
445#define MPU_NOT_SS(S,D) (0x40100581 | ((S & ((1 << 5) - 1)) << 11)\
446 | ((D & ((1 << 5) - 1)) << 21))
447
448#define MPU_OR_RRR(S,N,D) (0x4000008B | ((S & ((1 << 5) - 1)) << 16)\
449 | ((N & ((1 << 5) - 1)) << 11)\
450 | ((D & ((1 << 5) - 1)) << 21))
451
452#define MPU_OR_RRS(S,N,D) (0x4000048B | ((S & ((1 << 5) - 1)) << 16)\
453 | ((N & ((1 << 5) - 1)) << 11)\
454 | ((D & ((1 << 5) - 1)) << 21))
455
456#define MPU_OR_RSR(S,N,D) (0x4000018B | ((S & ((1 << 5) - 1)) << 16)\
457 | ((N & ((1 << 5) - 1)) << 11)\
458 | ((D & ((1 << 5) - 1)) << 21))
459
460#define MPU_OR_RSS(S,N,D) (0x4000058B | ((S & ((1 << 5) - 1)) << 16)\
461 | ((N & ((1 << 5) - 1)) << 11)\
462 | ((D & ((1 << 5) - 1)) << 21))
463
464#define MPU_OR_SRR(S,N,D) (0x4000028B | ((S & ((1 << 5) - 1)) << 16)\
465 | ((N & ((1 << 5) - 1)) << 11)\
466 | ((D & ((1 << 5) - 1)) << 21))
467
468#define MPU_OR_SRS(S,N,D) (0x4000068B | ((S & ((1 << 5) - 1)) << 16)\
469 | ((N & ((1 << 5) - 1)) << 11)\
470 | ((D & ((1 << 5) - 1)) << 21))
471
472#define MPU_OR_SSR(S,N,D) (0x4000038B | ((S & ((1 << 5) - 1)) << 16)\
473 | ((N & ((1 << 5) - 1)) << 11)\
474 | ((D & ((1 << 5) - 1)) << 21))
475
476#define MPU_OR_SSS(S,N,D) (0x4000078B | ((S & ((1 << 5) - 1)) << 16)\
477 | ((N & ((1 << 5) - 1)) << 11)\
478 | ((D & ((1 << 5) - 1)) << 21))
479
480#define MPU_ORQ_RIR(S,N,D) (0x0C000000 | ((S & ((1 << 5) - 1)) << 16)\
481 | ((N & ((1 << 16) - 1)) << 0)\
482 | ((D & ((1 << 5) - 1)) << 21))
483
484#define MPU_ORQ_IRR(S,N,D) (0x0C000000 | ((S & ((1 << 16) - 1)) << 0)\
485 | ((N & ((1 << 5) - 1)) << 16)\
486 | ((D & ((1 << 5) - 1)) << 21))
487
488#define MPU_ORX_RIR_INSTR(S,N,D) (0xC000008B | ((S & ((1 << 5) - 1)) << 16)\
489 | ((D & ((1 << 5) - 1)) << 21))
490
491#define MPU_ORX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)
492
493#define MPU_ORX_IRR_INSTR(S,N,D) (0xC000008B | ((N & ((1 << 5) - 1)) << 16)\
494 | ((D & ((1 << 5) - 1)) << 21))
495
496#define MPU_ORX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)
497
498#define MPU_ORX_SIR_INSTR(S,N,D) (0xC000028B | ((S & ((1 << 5) - 1)) << 16)\
499 | ((D & ((1 << 5) - 1)) << 21))
500
501#define MPU_ORX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)
502
503#define MPU_ORX_ISR_INSTR(S,N,D) (0xC000028B | ((N & ((1 << 5) - 1)) << 16)\
504 | ((D & ((1 << 5) - 1)) << 21))
505
506#define MPU_ORX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)
507
508#define MPU_ORX_RIS_INSTR(S,N,D) (0xC000048B | ((S & ((1 << 5) - 1)) << 16)\
509 | ((D & ((1 << 5) - 1)) << 21))
510
511#define MPU_ORX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)
512
513#define MPU_ORX_IRS_INSTR(S,N,D) (0xC000048B | ((N & ((1 << 5) - 1)) << 16)\
514 | ((D & ((1 << 5) - 1)) << 21))
515
516#define MPU_ORX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)
517
518#define MPU_ORX_SIS_INSTR(S,N,D) (0xC000068B | ((S & ((1 << 5) - 1)) << 16)\
519 | ((D & ((1 << 5) - 1)) << 21))
520
521#define MPU_ORX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)
522
523#define MPU_ORX_ISS_INSTR(S,N,D) (0xC000068B | ((N & ((1 << 5) - 1)) << 16)\
524 | ((D & ((1 << 5) - 1)) << 21))
525
526#define MPU_ORX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)
527
528#define MPU_RET() (0x63003000)
529
530#define MPU_RETI() (0x63602800)
531
532#define MPU_RR_IR(S,D) (0x50000000 | ((S & ((1 << 11) - 1)) << 0)\
533 | ((D & ((1 << 5) - 1)) << 21))
534
535#define MPU_RR_SR(S,D) (0x50008000 | ((S & ((1 << 5) - 1)) << 16)\
536 | ((D & ((1 << 5) - 1)) << 21))
537
538#define MPU_RW_RI(S,D) (0x56000000 | ((S & ((1 << 5) - 1)) << 11)\
539 | ((D & ((1 << 11) - 1)) << 0))
540
541#define MPU_RW_RS(S,D) (0x57000000 | ((S & ((1 << 5) - 1)) << 11)\
542 | ((D & ((1 << 5) - 1)) << 16))
543
544#define MPU_RWQ_II(S,D) (0x58000000 | ((S & ((1 << 16) - 1)) << 11)\
545 | ((D & ((1 << 11) - 1)) << 0))
546
547#define MPU_RWQ_IS(S,D) (0x55000000 | ((S & ((1 << 16) - 1)) << 0)\
548 | ((D & ((1 << 5) - 1)) << 16))
549
550#define MPU_RWX_II_INSTR(S,D) (0xD4000000 | ((D & ((1 << 11) - 1)) << 0))
551
552#define MPU_RWX_II_IMM(S,D) (S & 0xFFFFFFFF)
553
554#define MPU_RWX_IS_INSTR(S,D) (0xD5000000 | ((D & ((1 << 5) - 1)) << 16))
555
556#define MPU_RWX_IS_IMM(S,D) (S & 0xFFFFFFFF)
557
558#define MPU_SUB_RRR(S,N,D) (0x4000008D | ((S & ((1 << 5) - 1)) << 16)\
559 | ((N & ((1 << 5) - 1)) << 11)\
560 | ((D & ((1 << 5) - 1)) << 21))
561
562#define MPU_SUB_RRS(S,N,D) (0x4000048D | ((S & ((1 << 5) - 1)) << 16)\
563 | ((N & ((1 << 5) - 1)) << 11)\
564 | ((D & ((1 << 5) - 1)) << 21))
565
566#define MPU_SUB_RSR(S,N,D) (0x4000018D | ((S & ((1 << 5) - 1)) << 16)\
567 | ((N & ((1 << 5) - 1)) << 11)\
568 | ((D & ((1 << 5) - 1)) << 21))
569
570#define MPU_SUB_RSS(S,N,D) (0x4000058D | ((S & ((1 << 5) - 1)) << 16)\
571 | ((N & ((1 << 5) - 1)) << 11)\
572 | ((D & ((1 << 5) - 1)) << 21))
573
574#define MPU_SUB_SRR(S,N,D) (0x4000028D | ((S & ((1 << 5) - 1)) << 16)\
575 | ((N & ((1 << 5) - 1)) << 11)\
576 | ((D & ((1 << 5) - 1)) << 21))
577
578#define MPU_SUB_SRS(S,N,D) (0x4000068D | ((S & ((1 << 5) - 1)) << 16)\
579 | ((N & ((1 << 5) - 1)) << 11)\
580 | ((D & ((1 << 5) - 1)) << 21))
581
582#define MPU_SUB_SSR(S,N,D) (0x4000038D | ((S & ((1 << 5) - 1)) << 16)\
583 | ((N & ((1 << 5) - 1)) << 11)\
584 | ((D & ((1 << 5) - 1)) << 21))
585
586#define MPU_SUB_SSS(S,N,D) (0x4000078D | ((S & ((1 << 5) - 1)) << 16)\
587 | ((N & ((1 << 5) - 1)) << 11)\
588 | ((D & ((1 << 5) - 1)) << 21))
589
590#define MPU_SUBQ_RIR(S,N,D) (0x14000000 | ((S & ((1 << 5) - 1)) << 16)\
591 | ((N & ((1 << 16) - 1)) << 0)\
592 | ((D & ((1 << 5) - 1)) << 21))
593
594#define MPU_SUBX_RIR_INSTR(S,N,D) (0xC000008D | ((S & ((1 << 5) - 1)) << 16)\
595 | ((D & ((1 << 5) - 1)) << 21))
596
597#define MPU_SUBX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)
598
599#define MPU_SUBX_SIR_INSTR(S,N,D) (0xC000028D | ((S & ((1 << 5) - 1)) << 16)\
600 | ((D & ((1 << 5) - 1)) << 21))
601
602#define MPU_SUBX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)
603
604#define MPU_SUBX_RIS_INSTR(S,N,D) (0xC000048D | ((S & ((1 << 5) - 1)) << 16)\
605 | ((D & ((1 << 5) - 1)) << 21))
606
607#define MPU_SUBX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)
608
609#define MPU_SUBX_SIS_INSTR(S,N,D) (0xC000068D | ((S & ((1 << 5) - 1)) << 16)\
610 | ((D & ((1 << 5) - 1)) << 21))
611
612#define MPU_SUBX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)
613
614#define MPU_SW_RI(S,D) (0x64000000 | ((S & ((1 << 5) - 1)) << 16)\
615 | ((D & ((1 << 16) - 1)) << 0))
616
617#define MPU_SW_SI(S,D) (0x64200000 | ((S & ((1 << 5) - 1)) << 16)\
618 | ((D & ((1 << 16) - 1)) << 0))
619
620#define MPU_SW_RR(S,D) (0x66000000 | ((S & ((1 << 5) - 1)) << 16)\
621 | ((D & ((1 << 5) - 1)) << 11))
622
623#define MPU_SW_SR(S,D) (0x66200000 | ((S & ((1 << 5) - 1)) << 16)\
624 | ((D & ((1 << 5) - 1)) << 11))
625
626#define MPU_SW_RS(S,D) (0x67000000 | ((S & ((1 << 5) - 1)) << 16)\
627 | ((D & ((1 << 5) - 1)) << 11))
628
629#define MPU_SW_SS(S,D) (0x67200000 | ((S & ((1 << 5) - 1)) << 16)\
630 | ((D & ((1 << 5) - 1)) << 11))
631
632#define MPU_SW_RIR(S,N,D) (0x66000000 | ((S & ((1 << 5) - 1)) << 16)\
633 | ((N & ((1 << 8) - 1)) << 0)\
634 | ((D & ((1 << 5) - 1)) << 11))
635
636#define MPU_SW_SIR(S,N,D) (0x66200000 | ((S & ((1 << 5) - 1)) << 16)\
637 | ((N & ((1 << 8) - 1)) << 0)\
638 | ((D & ((1 << 5) - 1)) << 11))
639
640#define MPU_SW_RIS(S,N,D) (0x67000000 | ((S & ((1 << 5) - 1)) << 16)\
641 | ((N & ((1 << 8) - 1)) << 0)\
642 | ((D & ((1 << 5) - 1)) << 11))
643
644#define MPU_SW_SIS(S,N,D) (0x67200000 | ((S & ((1 << 5) - 1)) << 16)\
645 | ((N & ((1 << 8) - 1)) << 0)\
646 | ((D & ((1 << 5) - 1)) << 11))
647
648#define MPU_SWX_II_INSTR(S,D) (0xE4000000 | ((D & ((1 << 16) - 1)) << 0))
649
650#define MPU_SWX_II_IMM(S,D) (S & 0xFFFFFFFF)
651
652#define MPU_SWX_IR_INSTR(S,D) (0xE6000000 | ((D & ((1 << 5) - 1)) << 11))
653
654#define MPU_SWX_IR_IMM(S,D) (S & 0xFFFFFFFF)
655
656#define MPU_SWX_IS_INSTR(S,D) (0xE7000000 | ((D & ((1 << 5) - 1)) << 11))
657
658#define MPU_SWX_IS_IMM(S,D) (S & 0xFFFFFFFF)
659
660#define MPU_SWX_IIR_INSTR(S,N,D) (0xE6000000 | ((N & ((1 << 8) - 1)) << 0)\
661 | ((D & ((1 << 5) - 1)) << 11))
662
663#define MPU_SWX_IIR_IMM(S,N,D) (S & 0xFFFFFFFF)
664
665#define MPU_SWX_IIS_INSTR(S,N,D) (0xE7000000 | ((N & ((1 << 8) - 1)) << 0)\
666 | ((D & ((1 << 5) - 1)) << 11))
667
668#define MPU_SWX_IIS_IMM(S,N,D) (S & 0xFFFFFFFF)
669
670#define MPU_XOR_RRR(S,N,D) (0x40000089 | ((S & ((1 << 5) - 1)) << 16)\
671 | ((N & ((1 << 5) - 1)) << 11)\
672 | ((D & ((1 << 5) - 1)) << 21))
673
674#define MPU_XOR_RRS(S,N,D) (0x40000489 | ((S & ((1 << 5) - 1)) << 16)\
675 | ((N & ((1 << 5) - 1)) << 11)\
676 | ((D & ((1 << 5) - 1)) << 21))
677
678#define MPU_XOR_RSR(S,N,D) (0x40000189 | ((S & ((1 << 5) - 1)) << 16)\
679 | ((N & ((1 << 5) - 1)) << 11)\
680 | ((D & ((1 << 5) - 1)) << 21))
681
682#define MPU_XOR_RSS(S,N,D) (0x40000589 | ((S & ((1 << 5) - 1)) << 16)\
683 | ((N & ((1 << 5) - 1)) << 11)\
684 | ((D & ((1 << 5) - 1)) << 21))
685
686#define MPU_XOR_SRR(S,N,D) (0x40000289 | ((S & ((1 << 5) - 1)) << 16)\
687 | ((N & ((1 << 5) - 1)) << 11)\
688 | ((D & ((1 << 5) - 1)) << 21))
689
690#define MPU_XOR_SRS(S,N,D) (0x40000689 | ((S & ((1 << 5) - 1)) << 16)\
691 | ((N & ((1 << 5) - 1)) << 11)\
692 | ((D & ((1 << 5) - 1)) << 21))
693
694#define MPU_XOR_SSR(S,N,D) (0x40000389 | ((S & ((1 << 5) - 1)) << 16)\
695 | ((N & ((1 << 5) - 1)) << 11)\
696 | ((D & ((1 << 5) - 1)) << 21))
697
698#define MPU_XOR_SSS(S,N,D) (0x40000789 | ((S & ((1 << 5) - 1)) << 16)\
699 | ((N & ((1 << 5) - 1)) << 11)\
700 | ((D & ((1 << 5) - 1)) << 21))
701
702#define MPU_XOR_RR(S,D) (0x40000088 | ((S & ((1 << 5) - 1)) << 11)\
703 | ((D & ((1 << 5) - 1)) << 21))
704
705#define MPU_XOR_RS(S,D) (0x40000488 | ((S & ((1 << 5) - 1)) << 11)\
706 | ((D & ((1 << 5) - 1)) << 21))
707
708#define MPU_XOR_SR(S,D) (0x40000188 | ((S & ((1 << 5) - 1)) << 11)\
709 | ((D & ((1 << 5) - 1)) << 21))
710
711#define MPU_XOR_SS(S,D) (0x40000588 | ((S & ((1 << 5) - 1)) << 11)\
712 | ((D & ((1 << 5) - 1)) << 21))
713
714#define MPU_XORQ_RIR(S,N,D) (0x04000000 | ((S & ((1 << 5) - 1)) << 16)\
715 | ((N & ((1 << 16) - 1)) << 0)\
716 | ((D & ((1 << 5) - 1)) << 21))
717
718#define MPU_XORQ_IRR(S,N,D) (0x04000000 | ((S & ((1 << 16) - 1)) << 0)\
719 | ((N & ((1 << 5) - 1)) << 16)\
720 | ((D & ((1 << 5) - 1)) << 21))
721
722#define MPU_XORX_RIR_INSTR(S,N,D) (0xC0000089 | ((S & ((1 << 5) - 1)) << 16)\
723 | ((D & ((1 << 5) - 1)) << 21))
724
725#define MPU_XORX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)
726
727#define MPU_XORX_IRR_INSTR(S,N,D) (0xC0000089 | ((N & ((1 << 5) - 1)) << 16)\
728 | ((D & ((1 << 5) - 1)) << 21))
729
730#define MPU_XORX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)
731
732#define MPU_XORX_SIR_INSTR(S,N,D) (0xC0000289 | ((S & ((1 << 5) - 1)) << 16)\
733 | ((D & ((1 << 5) - 1)) << 21))
734
735#define MPU_XORX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)
736
737#define MPU_XORX_ISR_INSTR(S,N,D) (0xC0000289 | ((N & ((1 << 5) - 1)) << 16)\
738 | ((D & ((1 << 5) - 1)) << 21))
739
740#define MPU_XORX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)
741
742#define MPU_XORX_RIS_INSTR(S,N,D) (0xC0000489 | ((S & ((1 << 5) - 1)) << 16)\
743 | ((D & ((1 << 5) - 1)) << 21))
744
745#define MPU_XORX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)
746
747#define MPU_XORX_IRS_INSTR(S,N,D) (0xC0000489 | ((N & ((1 << 5) - 1)) << 16)\
748 | ((D & ((1 << 5) - 1)) << 21))
749
750#define MPU_XORX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)
751
752#define MPU_XORX_SIS_INSTR(S,N,D) (0xC0000689 | ((S & ((1 << 5) - 1)) << 16)\
753 | ((D & ((1 << 5) - 1)) << 21))
754
755#define MPU_XORX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)
756
757#define MPU_XORX_ISS_INSTR(S,N,D) (0xC0000689 | ((N & ((1 << 5) - 1)) << 16)\
758 | ((D & ((1 << 5) - 1)) << 21))
759
760#define MPU_XORX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)
761
762
763#endif /* end of __IOP_MPU_MACROS_H__ */
764/* End of iop_mpu_macros.h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_reg_space.h b/include/asm-cris/arch-v32/hwregs/iop/iop_reg_space.h
new file mode 100644
index 000000000000..756550f5d6cb
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_reg_space.h
@@ -0,0 +1,44 @@
1/* Autogenerated Changes here will be lost!
2 * generated by ../gen_sw.pl Mon Apr 11 16:10:18 2005 iop_sw.cfg
3 */
4#define regi_iop_version (regi_iop + 0)
5#define regi_iop_fifo_in0_extra (regi_iop + 64)
6#define regi_iop_fifo_in1_extra (regi_iop + 128)
7#define regi_iop_fifo_out0_extra (regi_iop + 192)
8#define regi_iop_fifo_out1_extra (regi_iop + 256)
9#define regi_iop_trigger_grp0 (regi_iop + 320)
10#define regi_iop_trigger_grp1 (regi_iop + 384)
11#define regi_iop_trigger_grp2 (regi_iop + 448)
12#define regi_iop_trigger_grp3 (regi_iop + 512)
13#define regi_iop_trigger_grp4 (regi_iop + 576)
14#define regi_iop_trigger_grp5 (regi_iop + 640)
15#define regi_iop_trigger_grp6 (regi_iop + 704)
16#define regi_iop_trigger_grp7 (regi_iop + 768)
17#define regi_iop_crc_par0 (regi_iop + 896)
18#define regi_iop_crc_par1 (regi_iop + 1024)
19#define regi_iop_dmc_in0 (regi_iop + 1152)
20#define regi_iop_dmc_in1 (regi_iop + 1280)
21#define regi_iop_dmc_out0 (regi_iop + 1408)
22#define regi_iop_dmc_out1 (regi_iop + 1536)
23#define regi_iop_fifo_in0 (regi_iop + 1664)
24#define regi_iop_fifo_in1 (regi_iop + 1792)
25#define regi_iop_fifo_out0 (regi_iop + 1920)
26#define regi_iop_fifo_out1 (regi_iop + 2048)
27#define regi_iop_scrc_in0 (regi_iop + 2176)
28#define regi_iop_scrc_in1 (regi_iop + 2304)
29#define regi_iop_scrc_out0 (regi_iop + 2432)
30#define regi_iop_scrc_out1 (regi_iop + 2560)
31#define regi_iop_timer_grp0 (regi_iop + 2688)
32#define regi_iop_timer_grp1 (regi_iop + 2816)
33#define regi_iop_timer_grp2 (regi_iop + 2944)
34#define regi_iop_timer_grp3 (regi_iop + 3072)
35#define regi_iop_sap_in (regi_iop + 3328)
36#define regi_iop_sap_out (regi_iop + 3584)
37#define regi_iop_spu0 (regi_iop + 3840)
38#define regi_iop_spu1 (regi_iop + 4096)
39#define regi_iop_sw_cfg (regi_iop + 4352)
40#define regi_iop_sw_cpu (regi_iop + 4608)
41#define regi_iop_sw_mpu (regi_iop + 4864)
42#define regi_iop_sw_spu0 (regi_iop + 5120)
43#define regi_iop_sw_spu1 (regi_iop + 5376)
44#define regi_iop_mpu (regi_iop + 5632)
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sap_in_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sap_in_defs.h
new file mode 100644
index 000000000000..5548ac10074f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sap_in_defs.h
@@ -0,0 +1,179 @@
1#ifndef __iop_sap_in_defs_h
2#define __iop_sap_in_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_sap_in.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:45 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sap_in_defs.h ../../inst/io_proc/rtl/iop_sap_in.r
11 * id: $Id: iop_sap_in_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sap_in */
86
87/* Register rw_bus0_sync, scope iop_sap_in, type rw */
88typedef struct {
89 unsigned int byte0_sel : 2;
90 unsigned int byte0_ext_src : 3;
91 unsigned int byte0_edge : 2;
92 unsigned int byte0_delay : 1;
93 unsigned int byte1_sel : 2;
94 unsigned int byte1_ext_src : 3;
95 unsigned int byte1_edge : 2;
96 unsigned int byte1_delay : 1;
97 unsigned int byte2_sel : 2;
98 unsigned int byte2_ext_src : 3;
99 unsigned int byte2_edge : 2;
100 unsigned int byte2_delay : 1;
101 unsigned int byte3_sel : 2;
102 unsigned int byte3_ext_src : 3;
103 unsigned int byte3_edge : 2;
104 unsigned int byte3_delay : 1;
105} reg_iop_sap_in_rw_bus0_sync;
106#define REG_RD_ADDR_iop_sap_in_rw_bus0_sync 0
107#define REG_WR_ADDR_iop_sap_in_rw_bus0_sync 0
108
109/* Register rw_bus1_sync, scope iop_sap_in, type rw */
110typedef struct {
111 unsigned int byte0_sel : 2;
112 unsigned int byte0_ext_src : 3;
113 unsigned int byte0_edge : 2;
114 unsigned int byte0_delay : 1;
115 unsigned int byte1_sel : 2;
116 unsigned int byte1_ext_src : 3;
117 unsigned int byte1_edge : 2;
118 unsigned int byte1_delay : 1;
119 unsigned int byte2_sel : 2;
120 unsigned int byte2_ext_src : 3;
121 unsigned int byte2_edge : 2;
122 unsigned int byte2_delay : 1;
123 unsigned int byte3_sel : 2;
124 unsigned int byte3_ext_src : 3;
125 unsigned int byte3_edge : 2;
126 unsigned int byte3_delay : 1;
127} reg_iop_sap_in_rw_bus1_sync;
128#define REG_RD_ADDR_iop_sap_in_rw_bus1_sync 4
129#define REG_WR_ADDR_iop_sap_in_rw_bus1_sync 4
130
131#define STRIDE_iop_sap_in_rw_gio 4
132/* Register rw_gio, scope iop_sap_in, type rw */
133typedef struct {
134 unsigned int sync_sel : 2;
135 unsigned int sync_ext_src : 3;
136 unsigned int sync_edge : 2;
137 unsigned int delay : 1;
138 unsigned int logic : 2;
139 unsigned int dummy1 : 22;
140} reg_iop_sap_in_rw_gio;
141#define REG_RD_ADDR_iop_sap_in_rw_gio 8
142#define REG_WR_ADDR_iop_sap_in_rw_gio 8
143
144
145/* Constants */
146enum {
147 regk_iop_sap_in_and = 0x00000002,
148 regk_iop_sap_in_ext_clk200 = 0x00000003,
149 regk_iop_sap_in_gio1 = 0x00000000,
150 regk_iop_sap_in_gio13 = 0x00000005,
151 regk_iop_sap_in_gio18 = 0x00000003,
152 regk_iop_sap_in_gio19 = 0x00000004,
153 regk_iop_sap_in_gio21 = 0x00000006,
154 regk_iop_sap_in_gio23 = 0x00000005,
155 regk_iop_sap_in_gio29 = 0x00000007,
156 regk_iop_sap_in_gio5 = 0x00000004,
157 regk_iop_sap_in_gio6 = 0x00000001,
158 regk_iop_sap_in_gio7 = 0x00000002,
159 regk_iop_sap_in_inv = 0x00000001,
160 regk_iop_sap_in_neg = 0x00000002,
161 regk_iop_sap_in_no = 0x00000000,
162 regk_iop_sap_in_no_del_ext_clk200 = 0x00000001,
163 regk_iop_sap_in_none = 0x00000000,
164 regk_iop_sap_in_or = 0x00000003,
165 regk_iop_sap_in_pos = 0x00000001,
166 regk_iop_sap_in_pos_neg = 0x00000003,
167 regk_iop_sap_in_rw_bus0_sync_default = 0x02020202,
168 regk_iop_sap_in_rw_bus1_sync_default = 0x02020202,
169 regk_iop_sap_in_rw_gio_default = 0x00000002,
170 regk_iop_sap_in_rw_gio_size = 0x00000020,
171 regk_iop_sap_in_timer_grp0_tmr3 = 0x00000006,
172 regk_iop_sap_in_timer_grp1_tmr3 = 0x00000004,
173 regk_iop_sap_in_timer_grp2_tmr3 = 0x00000005,
174 regk_iop_sap_in_timer_grp3_tmr3 = 0x00000007,
175 regk_iop_sap_in_tmr_clk200 = 0x00000000,
176 regk_iop_sap_in_two_clk200 = 0x00000002,
177 regk_iop_sap_in_yes = 0x00000001
178};
179#endif /* __iop_sap_in_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sap_out_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sap_out_defs.h
new file mode 100644
index 000000000000..273936996183
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sap_out_defs.h
@@ -0,0 +1,306 @@
1#ifndef __iop_sap_out_defs_h
2#define __iop_sap_out_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_sap_out.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sap_out_defs.h ../../inst/io_proc/rtl/iop_sap_out.r
11 * id: $Id: iop_sap_out_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sap_out */
86
87/* Register rw_gen_gated, scope iop_sap_out, type rw */
88typedef struct {
89 unsigned int clk0_src : 2;
90 unsigned int clk0_gate_src : 2;
91 unsigned int clk0_force_src : 3;
92 unsigned int clk1_src : 2;
93 unsigned int clk1_gate_src : 2;
94 unsigned int clk1_force_src : 3;
95 unsigned int clk2_src : 2;
96 unsigned int clk2_gate_src : 2;
97 unsigned int clk2_force_src : 3;
98 unsigned int clk3_src : 2;
99 unsigned int clk3_gate_src : 2;
100 unsigned int clk3_force_src : 3;
101 unsigned int dummy1 : 4;
102} reg_iop_sap_out_rw_gen_gated;
103#define REG_RD_ADDR_iop_sap_out_rw_gen_gated 0
104#define REG_WR_ADDR_iop_sap_out_rw_gen_gated 0
105
106/* Register rw_bus0, scope iop_sap_out, type rw */
107typedef struct {
108 unsigned int byte0_clk_sel : 3;
109 unsigned int byte0_gated_clk : 2;
110 unsigned int byte0_clk_inv : 1;
111 unsigned int byte1_clk_sel : 3;
112 unsigned int byte1_gated_clk : 2;
113 unsigned int byte1_clk_inv : 1;
114 unsigned int byte2_clk_sel : 3;
115 unsigned int byte2_gated_clk : 2;
116 unsigned int byte2_clk_inv : 1;
117 unsigned int byte3_clk_sel : 3;
118 unsigned int byte3_gated_clk : 2;
119 unsigned int byte3_clk_inv : 1;
120 unsigned int dummy1 : 8;
121} reg_iop_sap_out_rw_bus0;
122#define REG_RD_ADDR_iop_sap_out_rw_bus0 4
123#define REG_WR_ADDR_iop_sap_out_rw_bus0 4
124
125/* Register rw_bus1, scope iop_sap_out, type rw */
126typedef struct {
127 unsigned int byte0_clk_sel : 3;
128 unsigned int byte0_gated_clk : 2;
129 unsigned int byte0_clk_inv : 1;
130 unsigned int byte1_clk_sel : 3;
131 unsigned int byte1_gated_clk : 2;
132 unsigned int byte1_clk_inv : 1;
133 unsigned int byte2_clk_sel : 3;
134 unsigned int byte2_gated_clk : 2;
135 unsigned int byte2_clk_inv : 1;
136 unsigned int byte3_clk_sel : 3;
137 unsigned int byte3_gated_clk : 2;
138 unsigned int byte3_clk_inv : 1;
139 unsigned int dummy1 : 8;
140} reg_iop_sap_out_rw_bus1;
141#define REG_RD_ADDR_iop_sap_out_rw_bus1 8
142#define REG_WR_ADDR_iop_sap_out_rw_bus1 8
143
144/* Register rw_bus0_lo_oe, scope iop_sap_out, type rw */
145typedef struct {
146 unsigned int byte0_clk_sel : 3;
147 unsigned int byte0_clk_ext : 3;
148 unsigned int byte0_gated_clk : 2;
149 unsigned int byte0_clk_inv : 1;
150 unsigned int byte0_logic : 2;
151 unsigned int byte1_clk_sel : 3;
152 unsigned int byte1_clk_ext : 3;
153 unsigned int byte1_gated_clk : 2;
154 unsigned int byte1_clk_inv : 1;
155 unsigned int byte1_logic : 2;
156 unsigned int dummy1 : 10;
157} reg_iop_sap_out_rw_bus0_lo_oe;
158#define REG_RD_ADDR_iop_sap_out_rw_bus0_lo_oe 12
159#define REG_WR_ADDR_iop_sap_out_rw_bus0_lo_oe 12
160
161/* Register rw_bus0_hi_oe, scope iop_sap_out, type rw */
162typedef struct {
163 unsigned int byte2_clk_sel : 3;
164 unsigned int byte2_clk_ext : 3;
165 unsigned int byte2_gated_clk : 2;
166 unsigned int byte2_clk_inv : 1;
167 unsigned int byte2_logic : 2;
168 unsigned int byte3_clk_sel : 3;
169 unsigned int byte3_clk_ext : 3;
170 unsigned int byte3_gated_clk : 2;
171 unsigned int byte3_clk_inv : 1;
172 unsigned int byte3_logic : 2;
173 unsigned int dummy1 : 10;
174} reg_iop_sap_out_rw_bus0_hi_oe;
175#define REG_RD_ADDR_iop_sap_out_rw_bus0_hi_oe 16
176#define REG_WR_ADDR_iop_sap_out_rw_bus0_hi_oe 16
177
178/* Register rw_bus1_lo_oe, scope iop_sap_out, type rw */
179typedef struct {
180 unsigned int byte0_clk_sel : 3;
181 unsigned int byte0_clk_ext : 3;
182 unsigned int byte0_gated_clk : 2;
183 unsigned int byte0_clk_inv : 1;
184 unsigned int byte0_logic : 2;
185 unsigned int byte1_clk_sel : 3;
186 unsigned int byte1_clk_ext : 3;
187 unsigned int byte1_gated_clk : 2;
188 unsigned int byte1_clk_inv : 1;
189 unsigned int byte1_logic : 2;
190 unsigned int dummy1 : 10;
191} reg_iop_sap_out_rw_bus1_lo_oe;
192#define REG_RD_ADDR_iop_sap_out_rw_bus1_lo_oe 20
193#define REG_WR_ADDR_iop_sap_out_rw_bus1_lo_oe 20
194
195/* Register rw_bus1_hi_oe, scope iop_sap_out, type rw */
196typedef struct {
197 unsigned int byte2_clk_sel : 3;
198 unsigned int byte2_clk_ext : 3;
199 unsigned int byte2_gated_clk : 2;
200 unsigned int byte2_clk_inv : 1;
201 unsigned int byte2_logic : 2;
202 unsigned int byte3_clk_sel : 3;
203 unsigned int byte3_clk_ext : 3;
204 unsigned int byte3_gated_clk : 2;
205 unsigned int byte3_clk_inv : 1;
206 unsigned int byte3_logic : 2;
207 unsigned int dummy1 : 10;
208} reg_iop_sap_out_rw_bus1_hi_oe;
209#define REG_RD_ADDR_iop_sap_out_rw_bus1_hi_oe 24
210#define REG_WR_ADDR_iop_sap_out_rw_bus1_hi_oe 24
211
212#define STRIDE_iop_sap_out_rw_gio 4
213/* Register rw_gio, scope iop_sap_out, type rw */
214typedef struct {
215 unsigned int out_clk_sel : 3;
216 unsigned int out_clk_ext : 4;
217 unsigned int out_gated_clk : 2;
218 unsigned int out_clk_inv : 1;
219 unsigned int out_logic : 1;
220 unsigned int oe_clk_sel : 3;
221 unsigned int oe_clk_ext : 3;
222 unsigned int oe_gated_clk : 2;
223 unsigned int oe_clk_inv : 1;
224 unsigned int oe_logic : 2;
225 unsigned int dummy1 : 10;
226} reg_iop_sap_out_rw_gio;
227#define REG_RD_ADDR_iop_sap_out_rw_gio 28
228#define REG_WR_ADDR_iop_sap_out_rw_gio 28
229
230
231/* Constants */
232enum {
233 regk_iop_sap_out_and = 0x00000002,
234 regk_iop_sap_out_clk0 = 0x00000000,
235 regk_iop_sap_out_clk1 = 0x00000001,
236 regk_iop_sap_out_clk12 = 0x00000002,
237 regk_iop_sap_out_clk2 = 0x00000002,
238 regk_iop_sap_out_clk200 = 0x00000001,
239 regk_iop_sap_out_clk3 = 0x00000003,
240 regk_iop_sap_out_ext = 0x00000003,
241 regk_iop_sap_out_gated = 0x00000004,
242 regk_iop_sap_out_gio1 = 0x00000000,
243 regk_iop_sap_out_gio13 = 0x00000002,
244 regk_iop_sap_out_gio13_clk = 0x0000000c,
245 regk_iop_sap_out_gio15 = 0x00000001,
246 regk_iop_sap_out_gio18 = 0x00000003,
247 regk_iop_sap_out_gio18_clk = 0x0000000d,
248 regk_iop_sap_out_gio1_clk = 0x00000008,
249 regk_iop_sap_out_gio21_clk = 0x0000000e,
250 regk_iop_sap_out_gio23 = 0x00000002,
251 regk_iop_sap_out_gio29_clk = 0x0000000f,
252 regk_iop_sap_out_gio31 = 0x00000003,
253 regk_iop_sap_out_gio5 = 0x00000001,
254 regk_iop_sap_out_gio5_clk = 0x00000009,
255 regk_iop_sap_out_gio6_clk = 0x0000000a,
256 regk_iop_sap_out_gio7 = 0x00000000,
257 regk_iop_sap_out_gio7_clk = 0x0000000b,
258 regk_iop_sap_out_gio_in13 = 0x00000001,
259 regk_iop_sap_out_gio_in21 = 0x00000002,
260 regk_iop_sap_out_gio_in29 = 0x00000003,
261 regk_iop_sap_out_gio_in5 = 0x00000000,
262 regk_iop_sap_out_inv = 0x00000001,
263 regk_iop_sap_out_nand = 0x00000003,
264 regk_iop_sap_out_no = 0x00000000,
265 regk_iop_sap_out_none = 0x00000000,
266 regk_iop_sap_out_rw_bus0_default = 0x00000000,
267 regk_iop_sap_out_rw_bus0_hi_oe_default = 0x00000000,
268 regk_iop_sap_out_rw_bus0_lo_oe_default = 0x00000000,
269 regk_iop_sap_out_rw_bus1_default = 0x00000000,
270 regk_iop_sap_out_rw_bus1_hi_oe_default = 0x00000000,
271 regk_iop_sap_out_rw_bus1_lo_oe_default = 0x00000000,
272 regk_iop_sap_out_rw_gen_gated_default = 0x00000000,
273 regk_iop_sap_out_rw_gio_default = 0x00000000,
274 regk_iop_sap_out_rw_gio_size = 0x00000020,
275 regk_iop_sap_out_spu0_gio0 = 0x00000002,
276 regk_iop_sap_out_spu0_gio1 = 0x00000003,
277 regk_iop_sap_out_spu0_gio12 = 0x00000004,
278 regk_iop_sap_out_spu0_gio13 = 0x00000004,
279 regk_iop_sap_out_spu0_gio14 = 0x00000004,
280 regk_iop_sap_out_spu0_gio15 = 0x00000004,
281 regk_iop_sap_out_spu0_gio2 = 0x00000002,
282 regk_iop_sap_out_spu0_gio3 = 0x00000003,
283 regk_iop_sap_out_spu0_gio4 = 0x00000002,
284 regk_iop_sap_out_spu0_gio5 = 0x00000003,
285 regk_iop_sap_out_spu0_gio6 = 0x00000002,
286 regk_iop_sap_out_spu0_gio7 = 0x00000003,
287 regk_iop_sap_out_spu1_gio0 = 0x00000005,
288 regk_iop_sap_out_spu1_gio1 = 0x00000006,
289 regk_iop_sap_out_spu1_gio12 = 0x00000007,
290 regk_iop_sap_out_spu1_gio13 = 0x00000007,
291 regk_iop_sap_out_spu1_gio14 = 0x00000007,
292 regk_iop_sap_out_spu1_gio15 = 0x00000007,
293 regk_iop_sap_out_spu1_gio2 = 0x00000005,
294 regk_iop_sap_out_spu1_gio3 = 0x00000006,
295 regk_iop_sap_out_spu1_gio4 = 0x00000005,
296 regk_iop_sap_out_spu1_gio5 = 0x00000006,
297 regk_iop_sap_out_spu1_gio6 = 0x00000005,
298 regk_iop_sap_out_spu1_gio7 = 0x00000006,
299 regk_iop_sap_out_timer_grp0_tmr2 = 0x00000004,
300 regk_iop_sap_out_timer_grp1_tmr2 = 0x00000005,
301 regk_iop_sap_out_timer_grp2_tmr2 = 0x00000006,
302 regk_iop_sap_out_timer_grp3_tmr2 = 0x00000007,
303 regk_iop_sap_out_tmr = 0x00000005,
304 regk_iop_sap_out_yes = 0x00000001
305};
306#endif /* __iop_sap_out_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_in_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_in_defs.h
new file mode 100644
index 000000000000..4f0a9a81e737
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_in_defs.h
@@ -0,0 +1,160 @@
1#ifndef __iop_scrc_in_defs_h
2#define __iop_scrc_in_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_scrc_in.r
7 * id: iop_scrc_in.r,v 1.10 2005/02/16 09:13:58 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_scrc_in_defs.h ../../inst/io_proc/rtl/iop_scrc_in.r
11 * id: $Id: iop_scrc_in_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_scrc_in */
86
87/* Register rw_cfg, scope iop_scrc_in, type rw */
88typedef struct {
89 unsigned int trig : 2;
90 unsigned int dummy1 : 30;
91} reg_iop_scrc_in_rw_cfg;
92#define REG_RD_ADDR_iop_scrc_in_rw_cfg 0
93#define REG_WR_ADDR_iop_scrc_in_rw_cfg 0
94
95/* Register rw_ctrl, scope iop_scrc_in, type rw */
96typedef struct {
97 unsigned int dif_in_en : 1;
98 unsigned int dummy1 : 31;
99} reg_iop_scrc_in_rw_ctrl;
100#define REG_RD_ADDR_iop_scrc_in_rw_ctrl 4
101#define REG_WR_ADDR_iop_scrc_in_rw_ctrl 4
102
103/* Register r_stat, scope iop_scrc_in, type r */
104typedef struct {
105 unsigned int err : 1;
106 unsigned int dummy1 : 31;
107} reg_iop_scrc_in_r_stat;
108#define REG_RD_ADDR_iop_scrc_in_r_stat 8
109
110/* Register rw_init_crc, scope iop_scrc_in, type rw */
111typedef unsigned int reg_iop_scrc_in_rw_init_crc;
112#define REG_RD_ADDR_iop_scrc_in_rw_init_crc 12
113#define REG_WR_ADDR_iop_scrc_in_rw_init_crc 12
114
115/* Register rs_computed_crc, scope iop_scrc_in, type rs */
116typedef unsigned int reg_iop_scrc_in_rs_computed_crc;
117#define REG_RD_ADDR_iop_scrc_in_rs_computed_crc 16
118
119/* Register r_computed_crc, scope iop_scrc_in, type r */
120typedef unsigned int reg_iop_scrc_in_r_computed_crc;
121#define REG_RD_ADDR_iop_scrc_in_r_computed_crc 20
122
123/* Register rw_crc, scope iop_scrc_in, type rw */
124typedef unsigned int reg_iop_scrc_in_rw_crc;
125#define REG_RD_ADDR_iop_scrc_in_rw_crc 24
126#define REG_WR_ADDR_iop_scrc_in_rw_crc 24
127
128/* Register rw_correct_crc, scope iop_scrc_in, type rw */
129typedef unsigned int reg_iop_scrc_in_rw_correct_crc;
130#define REG_RD_ADDR_iop_scrc_in_rw_correct_crc 28
131#define REG_WR_ADDR_iop_scrc_in_rw_correct_crc 28
132
133/* Register rw_wr1bit, scope iop_scrc_in, type rw */
134typedef struct {
135 unsigned int data : 2;
136 unsigned int last : 2;
137 unsigned int dummy1 : 28;
138} reg_iop_scrc_in_rw_wr1bit;
139#define REG_RD_ADDR_iop_scrc_in_rw_wr1bit 32
140#define REG_WR_ADDR_iop_scrc_in_rw_wr1bit 32
141
142
143/* Constants */
144enum {
145 regk_iop_scrc_in_dif_in = 0x00000002,
146 regk_iop_scrc_in_hi = 0x00000000,
147 regk_iop_scrc_in_neg = 0x00000002,
148 regk_iop_scrc_in_no = 0x00000000,
149 regk_iop_scrc_in_pos = 0x00000001,
150 regk_iop_scrc_in_pos_neg = 0x00000003,
151 regk_iop_scrc_in_r_computed_crc_default = 0x00000000,
152 regk_iop_scrc_in_rs_computed_crc_default = 0x00000000,
153 regk_iop_scrc_in_rw_cfg_default = 0x00000000,
154 regk_iop_scrc_in_rw_ctrl_default = 0x00000000,
155 regk_iop_scrc_in_rw_init_crc_default = 0x00000000,
156 regk_iop_scrc_in_set0 = 0x00000000,
157 regk_iop_scrc_in_set1 = 0x00000001,
158 regk_iop_scrc_in_yes = 0x00000001
159};
160#endif /* __iop_scrc_in_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_out_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_out_defs.h
new file mode 100644
index 000000000000..fd1d6ea1d484
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_scrc_out_defs.h
@@ -0,0 +1,146 @@
1#ifndef __iop_scrc_out_defs_h
2#define __iop_scrc_out_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_scrc_out.r
7 * id: iop_scrc_out.r,v 1.11 2005/02/16 09:13:38 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_scrc_out_defs.h ../../inst/io_proc/rtl/iop_scrc_out.r
11 * id: $Id: iop_scrc_out_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_scrc_out */
86
87/* Register rw_cfg, scope iop_scrc_out, type rw */
88typedef struct {
89 unsigned int trig : 2;
90 unsigned int inv_crc : 1;
91 unsigned int dummy1 : 29;
92} reg_iop_scrc_out_rw_cfg;
93#define REG_RD_ADDR_iop_scrc_out_rw_cfg 0
94#define REG_WR_ADDR_iop_scrc_out_rw_cfg 0
95
96/* Register rw_ctrl, scope iop_scrc_out, type rw */
97typedef struct {
98 unsigned int strb_src : 1;
99 unsigned int out_src : 1;
100 unsigned int dummy1 : 30;
101} reg_iop_scrc_out_rw_ctrl;
102#define REG_RD_ADDR_iop_scrc_out_rw_ctrl 4
103#define REG_WR_ADDR_iop_scrc_out_rw_ctrl 4
104
105/* Register rw_init_crc, scope iop_scrc_out, type rw */
106typedef unsigned int reg_iop_scrc_out_rw_init_crc;
107#define REG_RD_ADDR_iop_scrc_out_rw_init_crc 8
108#define REG_WR_ADDR_iop_scrc_out_rw_init_crc 8
109
110/* Register rw_crc, scope iop_scrc_out, type rw */
111typedef unsigned int reg_iop_scrc_out_rw_crc;
112#define REG_RD_ADDR_iop_scrc_out_rw_crc 12
113#define REG_WR_ADDR_iop_scrc_out_rw_crc 12
114
115/* Register rw_data, scope iop_scrc_out, type rw */
116typedef struct {
117 unsigned int val : 1;
118 unsigned int dummy1 : 31;
119} reg_iop_scrc_out_rw_data;
120#define REG_RD_ADDR_iop_scrc_out_rw_data 16
121#define REG_WR_ADDR_iop_scrc_out_rw_data 16
122
123/* Register r_computed_crc, scope iop_scrc_out, type r */
124typedef unsigned int reg_iop_scrc_out_r_computed_crc;
125#define REG_RD_ADDR_iop_scrc_out_r_computed_crc 20
126
127
128/* Constants */
129enum {
130 regk_iop_scrc_out_crc = 0x00000001,
131 regk_iop_scrc_out_data = 0x00000000,
132 regk_iop_scrc_out_dif = 0x00000001,
133 regk_iop_scrc_out_hi = 0x00000000,
134 regk_iop_scrc_out_neg = 0x00000002,
135 regk_iop_scrc_out_no = 0x00000000,
136 regk_iop_scrc_out_pos = 0x00000001,
137 regk_iop_scrc_out_pos_neg = 0x00000003,
138 regk_iop_scrc_out_reg = 0x00000000,
139 regk_iop_scrc_out_rw_cfg_default = 0x00000000,
140 regk_iop_scrc_out_rw_crc_default = 0x00000000,
141 regk_iop_scrc_out_rw_ctrl_default = 0x00000000,
142 regk_iop_scrc_out_rw_data_default = 0x00000000,
143 regk_iop_scrc_out_rw_init_crc_default = 0x00000000,
144 regk_iop_scrc_out_yes = 0x00000001
145};
146#endif /* __iop_scrc_out_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_spu_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_spu_defs.h
new file mode 100644
index 000000000000..0fda26e2f06f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_spu_defs.h
@@ -0,0 +1,453 @@
1#ifndef __iop_spu_defs_h
2#define __iop_spu_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_spu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_spu_defs.h ../../inst/io_proc/rtl/iop_spu.r
11 * id: $Id: iop_spu_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_spu */
86
87#define STRIDE_iop_spu_rw_r 4
88/* Register rw_r, scope iop_spu, type rw */
89typedef unsigned int reg_iop_spu_rw_r;
90#define REG_RD_ADDR_iop_spu_rw_r 0
91#define REG_WR_ADDR_iop_spu_rw_r 0
92
93/* Register rw_seq_pc, scope iop_spu, type rw */
94typedef struct {
95 unsigned int addr : 12;
96 unsigned int dummy1 : 20;
97} reg_iop_spu_rw_seq_pc;
98#define REG_RD_ADDR_iop_spu_rw_seq_pc 64
99#define REG_WR_ADDR_iop_spu_rw_seq_pc 64
100
101/* Register rw_fsm_pc, scope iop_spu, type rw */
102typedef struct {
103 unsigned int addr : 12;
104 unsigned int dummy1 : 20;
105} reg_iop_spu_rw_fsm_pc;
106#define REG_RD_ADDR_iop_spu_rw_fsm_pc 68
107#define REG_WR_ADDR_iop_spu_rw_fsm_pc 68
108
109/* Register rw_ctrl, scope iop_spu, type rw */
110typedef struct {
111 unsigned int fsm : 1;
112 unsigned int en : 1;
113 unsigned int dummy1 : 30;
114} reg_iop_spu_rw_ctrl;
115#define REG_RD_ADDR_iop_spu_rw_ctrl 72
116#define REG_WR_ADDR_iop_spu_rw_ctrl 72
117
118/* Register rw_fsm_inputs3_0, scope iop_spu, type rw */
119typedef struct {
120 unsigned int val0 : 5;
121 unsigned int src0 : 3;
122 unsigned int val1 : 5;
123 unsigned int src1 : 3;
124 unsigned int val2 : 5;
125 unsigned int src2 : 3;
126 unsigned int val3 : 5;
127 unsigned int src3 : 3;
128} reg_iop_spu_rw_fsm_inputs3_0;
129#define REG_RD_ADDR_iop_spu_rw_fsm_inputs3_0 76
130#define REG_WR_ADDR_iop_spu_rw_fsm_inputs3_0 76
131
132/* Register rw_fsm_inputs7_4, scope iop_spu, type rw */
133typedef struct {
134 unsigned int val4 : 5;
135 unsigned int src4 : 3;
136 unsigned int val5 : 5;
137 unsigned int src5 : 3;
138 unsigned int val6 : 5;
139 unsigned int src6 : 3;
140 unsigned int val7 : 5;
141 unsigned int src7 : 3;
142} reg_iop_spu_rw_fsm_inputs7_4;
143#define REG_RD_ADDR_iop_spu_rw_fsm_inputs7_4 80
144#define REG_WR_ADDR_iop_spu_rw_fsm_inputs7_4 80
145
146/* Register rw_gio_out, scope iop_spu, type rw */
147typedef unsigned int reg_iop_spu_rw_gio_out;
148#define REG_RD_ADDR_iop_spu_rw_gio_out 84
149#define REG_WR_ADDR_iop_spu_rw_gio_out 84
150
151/* Register rw_bus0_out, scope iop_spu, type rw */
152typedef unsigned int reg_iop_spu_rw_bus0_out;
153#define REG_RD_ADDR_iop_spu_rw_bus0_out 88
154#define REG_WR_ADDR_iop_spu_rw_bus0_out 88
155
156/* Register rw_bus1_out, scope iop_spu, type rw */
157typedef unsigned int reg_iop_spu_rw_bus1_out;
158#define REG_RD_ADDR_iop_spu_rw_bus1_out 92
159#define REG_WR_ADDR_iop_spu_rw_bus1_out 92
160
161/* Register r_gio_in, scope iop_spu, type r */
162typedef unsigned int reg_iop_spu_r_gio_in;
163#define REG_RD_ADDR_iop_spu_r_gio_in 96
164
165/* Register r_bus0_in, scope iop_spu, type r */
166typedef unsigned int reg_iop_spu_r_bus0_in;
167#define REG_RD_ADDR_iop_spu_r_bus0_in 100
168
169/* Register r_bus1_in, scope iop_spu, type r */
170typedef unsigned int reg_iop_spu_r_bus1_in;
171#define REG_RD_ADDR_iop_spu_r_bus1_in 104
172
173/* Register rw_gio_out_set, scope iop_spu, type rw */
174typedef unsigned int reg_iop_spu_rw_gio_out_set;
175#define REG_RD_ADDR_iop_spu_rw_gio_out_set 108
176#define REG_WR_ADDR_iop_spu_rw_gio_out_set 108
177
178/* Register rw_gio_out_clr, scope iop_spu, type rw */
179typedef unsigned int reg_iop_spu_rw_gio_out_clr;
180#define REG_RD_ADDR_iop_spu_rw_gio_out_clr 112
181#define REG_WR_ADDR_iop_spu_rw_gio_out_clr 112
182
183/* Register rs_wr_stat, scope iop_spu, type rs */
184typedef struct {
185 unsigned int r0 : 1;
186 unsigned int r1 : 1;
187 unsigned int r2 : 1;
188 unsigned int r3 : 1;
189 unsigned int r4 : 1;
190 unsigned int r5 : 1;
191 unsigned int r6 : 1;
192 unsigned int r7 : 1;
193 unsigned int r8 : 1;
194 unsigned int r9 : 1;
195 unsigned int r10 : 1;
196 unsigned int r11 : 1;
197 unsigned int r12 : 1;
198 unsigned int r13 : 1;
199 unsigned int r14 : 1;
200 unsigned int r15 : 1;
201 unsigned int dummy1 : 16;
202} reg_iop_spu_rs_wr_stat;
203#define REG_RD_ADDR_iop_spu_rs_wr_stat 116
204
205/* Register r_wr_stat, scope iop_spu, type r */
206typedef struct {
207 unsigned int r0 : 1;
208 unsigned int r1 : 1;
209 unsigned int r2 : 1;
210 unsigned int r3 : 1;
211 unsigned int r4 : 1;
212 unsigned int r5 : 1;
213 unsigned int r6 : 1;
214 unsigned int r7 : 1;
215 unsigned int r8 : 1;
216 unsigned int r9 : 1;
217 unsigned int r10 : 1;
218 unsigned int r11 : 1;
219 unsigned int r12 : 1;
220 unsigned int r13 : 1;
221 unsigned int r14 : 1;
222 unsigned int r15 : 1;
223 unsigned int dummy1 : 16;
224} reg_iop_spu_r_wr_stat;
225#define REG_RD_ADDR_iop_spu_r_wr_stat 120
226
227/* Register r_reg_indexed_by_bus0_in, scope iop_spu, type r */
228typedef unsigned int reg_iop_spu_r_reg_indexed_by_bus0_in;
229#define REG_RD_ADDR_iop_spu_r_reg_indexed_by_bus0_in 124
230
231/* Register r_stat_in, scope iop_spu, type r */
232typedef struct {
233 unsigned int timer_grp_lo : 4;
234 unsigned int fifo_out_last : 1;
235 unsigned int fifo_out_rdy : 1;
236 unsigned int fifo_out_all : 1;
237 unsigned int fifo_in_rdy : 1;
238 unsigned int dmc_out_all : 1;
239 unsigned int dmc_out_dth : 1;
240 unsigned int dmc_out_eop : 1;
241 unsigned int dmc_out_dv : 1;
242 unsigned int dmc_out_last : 1;
243 unsigned int dmc_out_cmd_rq : 1;
244 unsigned int dmc_out_cmd_rdy : 1;
245 unsigned int pcrc_correct : 1;
246 unsigned int timer_grp_hi : 4;
247 unsigned int dmc_in_sth : 1;
248 unsigned int dmc_in_full : 1;
249 unsigned int dmc_in_cmd_rdy : 1;
250 unsigned int spu_gio_out : 4;
251 unsigned int sync_clk12 : 1;
252 unsigned int scrc_out_data : 1;
253 unsigned int scrc_in_err : 1;
254 unsigned int mc_busy : 1;
255 unsigned int mc_owned : 1;
256} reg_iop_spu_r_stat_in;
257#define REG_RD_ADDR_iop_spu_r_stat_in 128
258
259/* Register r_trigger_in, scope iop_spu, type r */
260typedef unsigned int reg_iop_spu_r_trigger_in;
261#define REG_RD_ADDR_iop_spu_r_trigger_in 132
262
263/* Register r_special_stat, scope iop_spu, type r */
264typedef struct {
265 unsigned int c_flag : 1;
266 unsigned int v_flag : 1;
267 unsigned int z_flag : 1;
268 unsigned int n_flag : 1;
269 unsigned int xor_bus0_r2_0 : 1;
270 unsigned int xor_bus1_r3_0 : 1;
271 unsigned int xor_bus0m_r2_0 : 1;
272 unsigned int xor_bus1m_r3_0 : 1;
273 unsigned int fsm_in0 : 1;
274 unsigned int fsm_in1 : 1;
275 unsigned int fsm_in2 : 1;
276 unsigned int fsm_in3 : 1;
277 unsigned int fsm_in4 : 1;
278 unsigned int fsm_in5 : 1;
279 unsigned int fsm_in6 : 1;
280 unsigned int fsm_in7 : 1;
281 unsigned int event0 : 1;
282 unsigned int event1 : 1;
283 unsigned int event2 : 1;
284 unsigned int event3 : 1;
285 unsigned int dummy1 : 12;
286} reg_iop_spu_r_special_stat;
287#define REG_RD_ADDR_iop_spu_r_special_stat 136
288
289/* Register rw_reg_access, scope iop_spu, type rw */
290typedef struct {
291 unsigned int addr : 13;
292 unsigned int dummy1 : 3;
293 unsigned int imm_hi : 16;
294} reg_iop_spu_rw_reg_access;
295#define REG_RD_ADDR_iop_spu_rw_reg_access 140
296#define REG_WR_ADDR_iop_spu_rw_reg_access 140
297
298#define STRIDE_iop_spu_rw_event_cfg 4
299/* Register rw_event_cfg, scope iop_spu, type rw */
300typedef struct {
301 unsigned int addr : 12;
302 unsigned int src : 2;
303 unsigned int eq_en : 1;
304 unsigned int eq_inv : 1;
305 unsigned int gt_en : 1;
306 unsigned int gt_inv : 1;
307 unsigned int dummy1 : 14;
308} reg_iop_spu_rw_event_cfg;
309#define REG_RD_ADDR_iop_spu_rw_event_cfg 144
310#define REG_WR_ADDR_iop_spu_rw_event_cfg 144
311
312#define STRIDE_iop_spu_rw_event_mask 4
313/* Register rw_event_mask, scope iop_spu, type rw */
314typedef unsigned int reg_iop_spu_rw_event_mask;
315#define REG_RD_ADDR_iop_spu_rw_event_mask 160
316#define REG_WR_ADDR_iop_spu_rw_event_mask 160
317
318#define STRIDE_iop_spu_rw_event_val 4
319/* Register rw_event_val, scope iop_spu, type rw */
320typedef unsigned int reg_iop_spu_rw_event_val;
321#define REG_RD_ADDR_iop_spu_rw_event_val 176
322#define REG_WR_ADDR_iop_spu_rw_event_val 176
323
324/* Register rw_event_ret, scope iop_spu, type rw */
325typedef struct {
326 unsigned int addr : 12;
327 unsigned int dummy1 : 20;
328} reg_iop_spu_rw_event_ret;
329#define REG_RD_ADDR_iop_spu_rw_event_ret 192
330#define REG_WR_ADDR_iop_spu_rw_event_ret 192
331
332/* Register r_trace, scope iop_spu, type r */
333typedef struct {
334 unsigned int fsm : 1;
335 unsigned int en : 1;
336 unsigned int c_flag : 1;
337 unsigned int v_flag : 1;
338 unsigned int z_flag : 1;
339 unsigned int n_flag : 1;
340 unsigned int seq_addr : 12;
341 unsigned int dummy1 : 2;
342 unsigned int fsm_addr : 12;
343} reg_iop_spu_r_trace;
344#define REG_RD_ADDR_iop_spu_r_trace 196
345
346/* Register r_fsm_trace, scope iop_spu, type r */
347typedef struct {
348 unsigned int fsm : 1;
349 unsigned int en : 1;
350 unsigned int tmr_done : 1;
351 unsigned int inp0 : 1;
352 unsigned int inp1 : 1;
353 unsigned int inp2 : 1;
354 unsigned int inp3 : 1;
355 unsigned int event0 : 1;
356 unsigned int event1 : 1;
357 unsigned int event2 : 1;
358 unsigned int event3 : 1;
359 unsigned int gio_out : 8;
360 unsigned int dummy1 : 1;
361 unsigned int fsm_addr : 12;
362} reg_iop_spu_r_fsm_trace;
363#define REG_RD_ADDR_iop_spu_r_fsm_trace 200
364
365#define STRIDE_iop_spu_rw_brp 4
366/* Register rw_brp, scope iop_spu, type rw */
367typedef struct {
368 unsigned int addr : 12;
369 unsigned int fsm : 1;
370 unsigned int en : 1;
371 unsigned int dummy1 : 18;
372} reg_iop_spu_rw_brp;
373#define REG_RD_ADDR_iop_spu_rw_brp 204
374#define REG_WR_ADDR_iop_spu_rw_brp 204
375
376
377/* Constants */
378enum {
379 regk_iop_spu_attn_hi = 0x00000005,
380 regk_iop_spu_attn_lo = 0x00000005,
381 regk_iop_spu_attn_r0 = 0x00000000,
382 regk_iop_spu_attn_r1 = 0x00000001,
383 regk_iop_spu_attn_r10 = 0x00000002,
384 regk_iop_spu_attn_r11 = 0x00000003,
385 regk_iop_spu_attn_r12 = 0x00000004,
386 regk_iop_spu_attn_r13 = 0x00000005,
387 regk_iop_spu_attn_r14 = 0x00000006,
388 regk_iop_spu_attn_r15 = 0x00000007,
389 regk_iop_spu_attn_r2 = 0x00000002,
390 regk_iop_spu_attn_r3 = 0x00000003,
391 regk_iop_spu_attn_r4 = 0x00000004,
392 regk_iop_spu_attn_r5 = 0x00000005,
393 regk_iop_spu_attn_r6 = 0x00000006,
394 regk_iop_spu_attn_r7 = 0x00000007,
395 regk_iop_spu_attn_r8 = 0x00000000,
396 regk_iop_spu_attn_r9 = 0x00000001,
397 regk_iop_spu_c = 0x00000000,
398 regk_iop_spu_flag = 0x00000002,
399 regk_iop_spu_gio_in = 0x00000000,
400 regk_iop_spu_gio_out = 0x00000005,
401 regk_iop_spu_gio_out0 = 0x00000008,
402 regk_iop_spu_gio_out1 = 0x00000009,
403 regk_iop_spu_gio_out2 = 0x0000000a,
404 regk_iop_spu_gio_out3 = 0x0000000b,
405 regk_iop_spu_gio_out4 = 0x0000000c,
406 regk_iop_spu_gio_out5 = 0x0000000d,
407 regk_iop_spu_gio_out6 = 0x0000000e,
408 regk_iop_spu_gio_out7 = 0x0000000f,
409 regk_iop_spu_n = 0x00000003,
410 regk_iop_spu_no = 0x00000000,
411 regk_iop_spu_r0 = 0x00000008,
412 regk_iop_spu_r1 = 0x00000009,
413 regk_iop_spu_r10 = 0x0000000a,
414 regk_iop_spu_r11 = 0x0000000b,
415 regk_iop_spu_r12 = 0x0000000c,
416 regk_iop_spu_r13 = 0x0000000d,
417 regk_iop_spu_r14 = 0x0000000e,
418 regk_iop_spu_r15 = 0x0000000f,
419 regk_iop_spu_r2 = 0x0000000a,
420 regk_iop_spu_r3 = 0x0000000b,
421 regk_iop_spu_r4 = 0x0000000c,
422 regk_iop_spu_r5 = 0x0000000d,
423 regk_iop_spu_r6 = 0x0000000e,
424 regk_iop_spu_r7 = 0x0000000f,
425 regk_iop_spu_r8 = 0x00000008,
426 regk_iop_spu_r9 = 0x00000009,
427 regk_iop_spu_reg_hi = 0x00000002,
428 regk_iop_spu_reg_lo = 0x00000002,
429 regk_iop_spu_rw_brp_default = 0x00000000,
430 regk_iop_spu_rw_brp_size = 0x00000004,
431 regk_iop_spu_rw_ctrl_default = 0x00000000,
432 regk_iop_spu_rw_event_cfg_size = 0x00000004,
433 regk_iop_spu_rw_event_mask_size = 0x00000004,
434 regk_iop_spu_rw_event_val_size = 0x00000004,
435 regk_iop_spu_rw_gio_out_default = 0x00000000,
436 regk_iop_spu_rw_r_size = 0x00000010,
437 regk_iop_spu_rw_reg_access_default = 0x00000000,
438 regk_iop_spu_stat_in = 0x00000002,
439 regk_iop_spu_statin_hi = 0x00000004,
440 regk_iop_spu_statin_lo = 0x00000004,
441 regk_iop_spu_trig = 0x00000003,
442 regk_iop_spu_trigger = 0x00000006,
443 regk_iop_spu_v = 0x00000001,
444 regk_iop_spu_wsts_gioout_spec = 0x00000001,
445 regk_iop_spu_xor = 0x00000003,
446 regk_iop_spu_xor_bus0_r2_0 = 0x00000000,
447 regk_iop_spu_xor_bus0m_r2_0 = 0x00000002,
448 regk_iop_spu_xor_bus1_r3_0 = 0x00000001,
449 regk_iop_spu_xor_bus1m_r3_0 = 0x00000003,
450 regk_iop_spu_yes = 0x00000001,
451 regk_iop_spu_z = 0x00000002
452};
453#endif /* __iop_spu_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cfg_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cfg_defs.h
new file mode 100644
index 000000000000..d7b6d75884d2
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cfg_defs.h
@@ -0,0 +1,1042 @@
1#ifndef __iop_sw_cfg_defs_h
2#define __iop_sw_cfg_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_cfg.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sw_cfg_defs.h ../../inst/io_proc/rtl/guinness/iop_sw_cfg.r
11 * id: $Id: iop_sw_cfg_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sw_cfg */
86
87/* Register rw_crc_par0_owner, scope iop_sw_cfg, type rw */
88typedef struct {
89 unsigned int cfg : 2;
90 unsigned int dummy1 : 30;
91} reg_iop_sw_cfg_rw_crc_par0_owner;
92#define REG_RD_ADDR_iop_sw_cfg_rw_crc_par0_owner 0
93#define REG_WR_ADDR_iop_sw_cfg_rw_crc_par0_owner 0
94
95/* Register rw_crc_par1_owner, scope iop_sw_cfg, type rw */
96typedef struct {
97 unsigned int cfg : 2;
98 unsigned int dummy1 : 30;
99} reg_iop_sw_cfg_rw_crc_par1_owner;
100#define REG_RD_ADDR_iop_sw_cfg_rw_crc_par1_owner 4
101#define REG_WR_ADDR_iop_sw_cfg_rw_crc_par1_owner 4
102
103/* Register rw_dmc_in0_owner, scope iop_sw_cfg, type rw */
104typedef struct {
105 unsigned int cfg : 2;
106 unsigned int dummy1 : 30;
107} reg_iop_sw_cfg_rw_dmc_in0_owner;
108#define REG_RD_ADDR_iop_sw_cfg_rw_dmc_in0_owner 8
109#define REG_WR_ADDR_iop_sw_cfg_rw_dmc_in0_owner 8
110
111/* Register rw_dmc_in1_owner, scope iop_sw_cfg, type rw */
112typedef struct {
113 unsigned int cfg : 2;
114 unsigned int dummy1 : 30;
115} reg_iop_sw_cfg_rw_dmc_in1_owner;
116#define REG_RD_ADDR_iop_sw_cfg_rw_dmc_in1_owner 12
117#define REG_WR_ADDR_iop_sw_cfg_rw_dmc_in1_owner 12
118
119/* Register rw_dmc_out0_owner, scope iop_sw_cfg, type rw */
120typedef struct {
121 unsigned int cfg : 2;
122 unsigned int dummy1 : 30;
123} reg_iop_sw_cfg_rw_dmc_out0_owner;
124#define REG_RD_ADDR_iop_sw_cfg_rw_dmc_out0_owner 16
125#define REG_WR_ADDR_iop_sw_cfg_rw_dmc_out0_owner 16
126
127/* Register rw_dmc_out1_owner, scope iop_sw_cfg, type rw */
128typedef struct {
129 unsigned int cfg : 2;
130 unsigned int dummy1 : 30;
131} reg_iop_sw_cfg_rw_dmc_out1_owner;
132#define REG_RD_ADDR_iop_sw_cfg_rw_dmc_out1_owner 20
133#define REG_WR_ADDR_iop_sw_cfg_rw_dmc_out1_owner 20
134
135/* Register rw_fifo_in0_owner, scope iop_sw_cfg, type rw */
136typedef struct {
137 unsigned int cfg : 2;
138 unsigned int dummy1 : 30;
139} reg_iop_sw_cfg_rw_fifo_in0_owner;
140#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_in0_owner 24
141#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_in0_owner 24
142
143/* Register rw_fifo_in0_extra_owner, scope iop_sw_cfg, type rw */
144typedef struct {
145 unsigned int cfg : 2;
146 unsigned int dummy1 : 30;
147} reg_iop_sw_cfg_rw_fifo_in0_extra_owner;
148#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_in0_extra_owner 28
149#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_in0_extra_owner 28
150
151/* Register rw_fifo_in1_owner, scope iop_sw_cfg, type rw */
152typedef struct {
153 unsigned int cfg : 2;
154 unsigned int dummy1 : 30;
155} reg_iop_sw_cfg_rw_fifo_in1_owner;
156#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_in1_owner 32
157#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_in1_owner 32
158
159/* Register rw_fifo_in1_extra_owner, scope iop_sw_cfg, type rw */
160typedef struct {
161 unsigned int cfg : 2;
162 unsigned int dummy1 : 30;
163} reg_iop_sw_cfg_rw_fifo_in1_extra_owner;
164#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_in1_extra_owner 36
165#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_in1_extra_owner 36
166
167/* Register rw_fifo_out0_owner, scope iop_sw_cfg, type rw */
168typedef struct {
169 unsigned int cfg : 2;
170 unsigned int dummy1 : 30;
171} reg_iop_sw_cfg_rw_fifo_out0_owner;
172#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_out0_owner 40
173#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_out0_owner 40
174
175/* Register rw_fifo_out0_extra_owner, scope iop_sw_cfg, type rw */
176typedef struct {
177 unsigned int cfg : 2;
178 unsigned int dummy1 : 30;
179} reg_iop_sw_cfg_rw_fifo_out0_extra_owner;
180#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_out0_extra_owner 44
181#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_out0_extra_owner 44
182
183/* Register rw_fifo_out1_owner, scope iop_sw_cfg, type rw */
184typedef struct {
185 unsigned int cfg : 2;
186 unsigned int dummy1 : 30;
187} reg_iop_sw_cfg_rw_fifo_out1_owner;
188#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_out1_owner 48
189#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_out1_owner 48
190
191/* Register rw_fifo_out1_extra_owner, scope iop_sw_cfg, type rw */
192typedef struct {
193 unsigned int cfg : 2;
194 unsigned int dummy1 : 30;
195} reg_iop_sw_cfg_rw_fifo_out1_extra_owner;
196#define REG_RD_ADDR_iop_sw_cfg_rw_fifo_out1_extra_owner 52
197#define REG_WR_ADDR_iop_sw_cfg_rw_fifo_out1_extra_owner 52
198
199/* Register rw_sap_in_owner, scope iop_sw_cfg, type rw */
200typedef struct {
201 unsigned int cfg : 2;
202 unsigned int dummy1 : 30;
203} reg_iop_sw_cfg_rw_sap_in_owner;
204#define REG_RD_ADDR_iop_sw_cfg_rw_sap_in_owner 56
205#define REG_WR_ADDR_iop_sw_cfg_rw_sap_in_owner 56
206
207/* Register rw_sap_out_owner, scope iop_sw_cfg, type rw */
208typedef struct {
209 unsigned int cfg : 2;
210 unsigned int dummy1 : 30;
211} reg_iop_sw_cfg_rw_sap_out_owner;
212#define REG_RD_ADDR_iop_sw_cfg_rw_sap_out_owner 60
213#define REG_WR_ADDR_iop_sw_cfg_rw_sap_out_owner 60
214
215/* Register rw_scrc_in0_owner, scope iop_sw_cfg, type rw */
216typedef struct {
217 unsigned int cfg : 2;
218 unsigned int dummy1 : 30;
219} reg_iop_sw_cfg_rw_scrc_in0_owner;
220#define REG_RD_ADDR_iop_sw_cfg_rw_scrc_in0_owner 64
221#define REG_WR_ADDR_iop_sw_cfg_rw_scrc_in0_owner 64
222
223/* Register rw_scrc_in1_owner, scope iop_sw_cfg, type rw */
224typedef struct {
225 unsigned int cfg : 2;
226 unsigned int dummy1 : 30;
227} reg_iop_sw_cfg_rw_scrc_in1_owner;
228#define REG_RD_ADDR_iop_sw_cfg_rw_scrc_in1_owner 68
229#define REG_WR_ADDR_iop_sw_cfg_rw_scrc_in1_owner 68
230
231/* Register rw_scrc_out0_owner, scope iop_sw_cfg, type rw */
232typedef struct {
233 unsigned int cfg : 2;
234 unsigned int dummy1 : 30;
235} reg_iop_sw_cfg_rw_scrc_out0_owner;
236#define REG_RD_ADDR_iop_sw_cfg_rw_scrc_out0_owner 72
237#define REG_WR_ADDR_iop_sw_cfg_rw_scrc_out0_owner 72
238
239/* Register rw_scrc_out1_owner, scope iop_sw_cfg, type rw */
240typedef struct {
241 unsigned int cfg : 2;
242 unsigned int dummy1 : 30;
243} reg_iop_sw_cfg_rw_scrc_out1_owner;
244#define REG_RD_ADDR_iop_sw_cfg_rw_scrc_out1_owner 76
245#define REG_WR_ADDR_iop_sw_cfg_rw_scrc_out1_owner 76
246
247/* Register rw_spu0_owner, scope iop_sw_cfg, type rw */
248typedef struct {
249 unsigned int cfg : 2;
250 unsigned int dummy1 : 30;
251} reg_iop_sw_cfg_rw_spu0_owner;
252#define REG_RD_ADDR_iop_sw_cfg_rw_spu0_owner 80
253#define REG_WR_ADDR_iop_sw_cfg_rw_spu0_owner 80
254
255/* Register rw_spu1_owner, scope iop_sw_cfg, type rw */
256typedef struct {
257 unsigned int cfg : 2;
258 unsigned int dummy1 : 30;
259} reg_iop_sw_cfg_rw_spu1_owner;
260#define REG_RD_ADDR_iop_sw_cfg_rw_spu1_owner 84
261#define REG_WR_ADDR_iop_sw_cfg_rw_spu1_owner 84
262
263/* Register rw_timer_grp0_owner, scope iop_sw_cfg, type rw */
264typedef struct {
265 unsigned int cfg : 2;
266 unsigned int dummy1 : 30;
267} reg_iop_sw_cfg_rw_timer_grp0_owner;
268#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp0_owner 88
269#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp0_owner 88
270
271/* Register rw_timer_grp1_owner, scope iop_sw_cfg, type rw */
272typedef struct {
273 unsigned int cfg : 2;
274 unsigned int dummy1 : 30;
275} reg_iop_sw_cfg_rw_timer_grp1_owner;
276#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp1_owner 92
277#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp1_owner 92
278
279/* Register rw_timer_grp2_owner, scope iop_sw_cfg, type rw */
280typedef struct {
281 unsigned int cfg : 2;
282 unsigned int dummy1 : 30;
283} reg_iop_sw_cfg_rw_timer_grp2_owner;
284#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp2_owner 96
285#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp2_owner 96
286
287/* Register rw_timer_grp3_owner, scope iop_sw_cfg, type rw */
288typedef struct {
289 unsigned int cfg : 2;
290 unsigned int dummy1 : 30;
291} reg_iop_sw_cfg_rw_timer_grp3_owner;
292#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp3_owner 100
293#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp3_owner 100
294
295/* Register rw_trigger_grp0_owner, scope iop_sw_cfg, type rw */
296typedef struct {
297 unsigned int cfg : 2;
298 unsigned int dummy1 : 30;
299} reg_iop_sw_cfg_rw_trigger_grp0_owner;
300#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp0_owner 104
301#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp0_owner 104
302
303/* Register rw_trigger_grp1_owner, scope iop_sw_cfg, type rw */
304typedef struct {
305 unsigned int cfg : 2;
306 unsigned int dummy1 : 30;
307} reg_iop_sw_cfg_rw_trigger_grp1_owner;
308#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp1_owner 108
309#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp1_owner 108
310
311/* Register rw_trigger_grp2_owner, scope iop_sw_cfg, type rw */
312typedef struct {
313 unsigned int cfg : 2;
314 unsigned int dummy1 : 30;
315} reg_iop_sw_cfg_rw_trigger_grp2_owner;
316#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp2_owner 112
317#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp2_owner 112
318
319/* Register rw_trigger_grp3_owner, scope iop_sw_cfg, type rw */
320typedef struct {
321 unsigned int cfg : 2;
322 unsigned int dummy1 : 30;
323} reg_iop_sw_cfg_rw_trigger_grp3_owner;
324#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp3_owner 116
325#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp3_owner 116
326
327/* Register rw_trigger_grp4_owner, scope iop_sw_cfg, type rw */
328typedef struct {
329 unsigned int cfg : 2;
330 unsigned int dummy1 : 30;
331} reg_iop_sw_cfg_rw_trigger_grp4_owner;
332#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp4_owner 120
333#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp4_owner 120
334
335/* Register rw_trigger_grp5_owner, scope iop_sw_cfg, type rw */
336typedef struct {
337 unsigned int cfg : 2;
338 unsigned int dummy1 : 30;
339} reg_iop_sw_cfg_rw_trigger_grp5_owner;
340#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp5_owner 124
341#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp5_owner 124
342
343/* Register rw_trigger_grp6_owner, scope iop_sw_cfg, type rw */
344typedef struct {
345 unsigned int cfg : 2;
346 unsigned int dummy1 : 30;
347} reg_iop_sw_cfg_rw_trigger_grp6_owner;
348#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp6_owner 128
349#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp6_owner 128
350
351/* Register rw_trigger_grp7_owner, scope iop_sw_cfg, type rw */
352typedef struct {
353 unsigned int cfg : 2;
354 unsigned int dummy1 : 30;
355} reg_iop_sw_cfg_rw_trigger_grp7_owner;
356#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grp7_owner 132
357#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grp7_owner 132
358
359/* Register rw_bus0_mask, scope iop_sw_cfg, type rw */
360typedef struct {
361 unsigned int byte0 : 8;
362 unsigned int byte1 : 8;
363 unsigned int byte2 : 8;
364 unsigned int byte3 : 8;
365} reg_iop_sw_cfg_rw_bus0_mask;
366#define REG_RD_ADDR_iop_sw_cfg_rw_bus0_mask 136
367#define REG_WR_ADDR_iop_sw_cfg_rw_bus0_mask 136
368
369/* Register rw_bus0_oe_mask, scope iop_sw_cfg, type rw */
370typedef struct {
371 unsigned int byte0 : 1;
372 unsigned int byte1 : 1;
373 unsigned int byte2 : 1;
374 unsigned int byte3 : 1;
375 unsigned int dummy1 : 28;
376} reg_iop_sw_cfg_rw_bus0_oe_mask;
377#define REG_RD_ADDR_iop_sw_cfg_rw_bus0_oe_mask 140
378#define REG_WR_ADDR_iop_sw_cfg_rw_bus0_oe_mask 140
379
380/* Register rw_bus1_mask, scope iop_sw_cfg, type rw */
381typedef struct {
382 unsigned int byte0 : 8;
383 unsigned int byte1 : 8;
384 unsigned int byte2 : 8;
385 unsigned int byte3 : 8;
386} reg_iop_sw_cfg_rw_bus1_mask;
387#define REG_RD_ADDR_iop_sw_cfg_rw_bus1_mask 144
388#define REG_WR_ADDR_iop_sw_cfg_rw_bus1_mask 144
389
390/* Register rw_bus1_oe_mask, scope iop_sw_cfg, type rw */
391typedef struct {
392 unsigned int byte0 : 1;
393 unsigned int byte1 : 1;
394 unsigned int byte2 : 1;
395 unsigned int byte3 : 1;
396 unsigned int dummy1 : 28;
397} reg_iop_sw_cfg_rw_bus1_oe_mask;
398#define REG_RD_ADDR_iop_sw_cfg_rw_bus1_oe_mask 148
399#define REG_WR_ADDR_iop_sw_cfg_rw_bus1_oe_mask 148
400
401/* Register rw_gio_mask, scope iop_sw_cfg, type rw */
402typedef struct {
403 unsigned int val : 32;
404} reg_iop_sw_cfg_rw_gio_mask;
405#define REG_RD_ADDR_iop_sw_cfg_rw_gio_mask 152
406#define REG_WR_ADDR_iop_sw_cfg_rw_gio_mask 152
407
408/* Register rw_gio_oe_mask, scope iop_sw_cfg, type rw */
409typedef struct {
410 unsigned int val : 32;
411} reg_iop_sw_cfg_rw_gio_oe_mask;
412#define REG_RD_ADDR_iop_sw_cfg_rw_gio_oe_mask 156
413#define REG_WR_ADDR_iop_sw_cfg_rw_gio_oe_mask 156
414
415/* Register rw_pinmapping, scope iop_sw_cfg, type rw */
416typedef struct {
417 unsigned int bus0_byte0 : 2;
418 unsigned int bus0_byte1 : 2;
419 unsigned int bus0_byte2 : 2;
420 unsigned int bus0_byte3 : 2;
421 unsigned int bus1_byte0 : 2;
422 unsigned int bus1_byte1 : 2;
423 unsigned int bus1_byte2 : 2;
424 unsigned int bus1_byte3 : 2;
425 unsigned int gio3_0 : 2;
426 unsigned int gio7_4 : 2;
427 unsigned int gio11_8 : 2;
428 unsigned int gio15_12 : 2;
429 unsigned int gio19_16 : 2;
430 unsigned int gio23_20 : 2;
431 unsigned int gio27_24 : 2;
432 unsigned int gio31_28 : 2;
433} reg_iop_sw_cfg_rw_pinmapping;
434#define REG_RD_ADDR_iop_sw_cfg_rw_pinmapping 160
435#define REG_WR_ADDR_iop_sw_cfg_rw_pinmapping 160
436
437/* Register rw_bus_out_cfg, scope iop_sw_cfg, type rw */
438typedef struct {
439 unsigned int bus0_lo : 3;
440 unsigned int bus0_hi : 3;
441 unsigned int bus0_lo_oe : 3;
442 unsigned int bus0_hi_oe : 3;
443 unsigned int bus1_lo : 3;
444 unsigned int bus1_hi : 3;
445 unsigned int bus1_lo_oe : 3;
446 unsigned int bus1_hi_oe : 3;
447 unsigned int dummy1 : 8;
448} reg_iop_sw_cfg_rw_bus_out_cfg;
449#define REG_RD_ADDR_iop_sw_cfg_rw_bus_out_cfg 164
450#define REG_WR_ADDR_iop_sw_cfg_rw_bus_out_cfg 164
451
452/* Register rw_gio_out_grp0_cfg, scope iop_sw_cfg, type rw */
453typedef struct {
454 unsigned int gio0 : 4;
455 unsigned int gio0_oe : 2;
456 unsigned int gio1 : 4;
457 unsigned int gio1_oe : 2;
458 unsigned int gio2 : 4;
459 unsigned int gio2_oe : 2;
460 unsigned int gio3 : 4;
461 unsigned int gio3_oe : 2;
462 unsigned int dummy1 : 8;
463} reg_iop_sw_cfg_rw_gio_out_grp0_cfg;
464#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp0_cfg 168
465#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp0_cfg 168
466
467/* Register rw_gio_out_grp1_cfg, scope iop_sw_cfg, type rw */
468typedef struct {
469 unsigned int gio4 : 4;
470 unsigned int gio4_oe : 2;
471 unsigned int gio5 : 4;
472 unsigned int gio5_oe : 2;
473 unsigned int gio6 : 4;
474 unsigned int gio6_oe : 2;
475 unsigned int gio7 : 4;
476 unsigned int gio7_oe : 2;
477 unsigned int dummy1 : 8;
478} reg_iop_sw_cfg_rw_gio_out_grp1_cfg;
479#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp1_cfg 172
480#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp1_cfg 172
481
482/* Register rw_gio_out_grp2_cfg, scope iop_sw_cfg, type rw */
483typedef struct {
484 unsigned int gio8 : 4;
485 unsigned int gio8_oe : 2;
486 unsigned int gio9 : 4;
487 unsigned int gio9_oe : 2;
488 unsigned int gio10 : 4;
489 unsigned int gio10_oe : 2;
490 unsigned int gio11 : 4;
491 unsigned int gio11_oe : 2;
492 unsigned int dummy1 : 8;
493} reg_iop_sw_cfg_rw_gio_out_grp2_cfg;
494#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp2_cfg 176
495#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp2_cfg 176
496
497/* Register rw_gio_out_grp3_cfg, scope iop_sw_cfg, type rw */
498typedef struct {
499 unsigned int gio12 : 4;
500 unsigned int gio12_oe : 2;
501 unsigned int gio13 : 4;
502 unsigned int gio13_oe : 2;
503 unsigned int gio14 : 4;
504 unsigned int gio14_oe : 2;
505 unsigned int gio15 : 4;
506 unsigned int gio15_oe : 2;
507 unsigned int dummy1 : 8;
508} reg_iop_sw_cfg_rw_gio_out_grp3_cfg;
509#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp3_cfg 180
510#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp3_cfg 180
511
512/* Register rw_gio_out_grp4_cfg, scope iop_sw_cfg, type rw */
513typedef struct {
514 unsigned int gio16 : 4;
515 unsigned int gio16_oe : 2;
516 unsigned int gio17 : 4;
517 unsigned int gio17_oe : 2;
518 unsigned int gio18 : 4;
519 unsigned int gio18_oe : 2;
520 unsigned int gio19 : 4;
521 unsigned int gio19_oe : 2;
522 unsigned int dummy1 : 8;
523} reg_iop_sw_cfg_rw_gio_out_grp4_cfg;
524#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp4_cfg 184
525#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp4_cfg 184
526
527/* Register rw_gio_out_grp5_cfg, scope iop_sw_cfg, type rw */
528typedef struct {
529 unsigned int gio20 : 4;
530 unsigned int gio20_oe : 2;
531 unsigned int gio21 : 4;
532 unsigned int gio21_oe : 2;
533 unsigned int gio22 : 4;
534 unsigned int gio22_oe : 2;
535 unsigned int gio23 : 4;
536 unsigned int gio23_oe : 2;
537 unsigned int dummy1 : 8;
538} reg_iop_sw_cfg_rw_gio_out_grp5_cfg;
539#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp5_cfg 188
540#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp5_cfg 188
541
542/* Register rw_gio_out_grp6_cfg, scope iop_sw_cfg, type rw */
543typedef struct {
544 unsigned int gio24 : 4;
545 unsigned int gio24_oe : 2;
546 unsigned int gio25 : 4;
547 unsigned int gio25_oe : 2;
548 unsigned int gio26 : 4;
549 unsigned int gio26_oe : 2;
550 unsigned int gio27 : 4;
551 unsigned int gio27_oe : 2;
552 unsigned int dummy1 : 8;
553} reg_iop_sw_cfg_rw_gio_out_grp6_cfg;
554#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp6_cfg 192
555#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp6_cfg 192
556
557/* Register rw_gio_out_grp7_cfg, scope iop_sw_cfg, type rw */
558typedef struct {
559 unsigned int gio28 : 4;
560 unsigned int gio28_oe : 2;
561 unsigned int gio29 : 4;
562 unsigned int gio29_oe : 2;
563 unsigned int gio30 : 4;
564 unsigned int gio30_oe : 2;
565 unsigned int gio31 : 4;
566 unsigned int gio31_oe : 2;
567 unsigned int dummy1 : 8;
568} reg_iop_sw_cfg_rw_gio_out_grp7_cfg;
569#define REG_RD_ADDR_iop_sw_cfg_rw_gio_out_grp7_cfg 196
570#define REG_WR_ADDR_iop_sw_cfg_rw_gio_out_grp7_cfg 196
571
572/* Register rw_spu0_cfg, scope iop_sw_cfg, type rw */
573typedef struct {
574 unsigned int bus0_in : 2;
575 unsigned int bus1_in : 2;
576 unsigned int dummy1 : 28;
577} reg_iop_sw_cfg_rw_spu0_cfg;
578#define REG_RD_ADDR_iop_sw_cfg_rw_spu0_cfg 200
579#define REG_WR_ADDR_iop_sw_cfg_rw_spu0_cfg 200
580
581/* Register rw_spu1_cfg, scope iop_sw_cfg, type rw */
582typedef struct {
583 unsigned int bus0_in : 2;
584 unsigned int bus1_in : 2;
585 unsigned int dummy1 : 28;
586} reg_iop_sw_cfg_rw_spu1_cfg;
587#define REG_RD_ADDR_iop_sw_cfg_rw_spu1_cfg 204
588#define REG_WR_ADDR_iop_sw_cfg_rw_spu1_cfg 204
589
590/* Register rw_timer_grp0_cfg, scope iop_sw_cfg, type rw */
591typedef struct {
592 unsigned int ext_clk : 3;
593 unsigned int tmr0_en : 1;
594 unsigned int tmr1_en : 1;
595 unsigned int tmr2_en : 1;
596 unsigned int tmr3_en : 1;
597 unsigned int tmr0_dis : 1;
598 unsigned int tmr1_dis : 1;
599 unsigned int tmr2_dis : 1;
600 unsigned int tmr3_dis : 1;
601 unsigned int dummy1 : 21;
602} reg_iop_sw_cfg_rw_timer_grp0_cfg;
603#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp0_cfg 208
604#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp0_cfg 208
605
606/* Register rw_timer_grp1_cfg, scope iop_sw_cfg, type rw */
607typedef struct {
608 unsigned int ext_clk : 3;
609 unsigned int tmr0_en : 1;
610 unsigned int tmr1_en : 1;
611 unsigned int tmr2_en : 1;
612 unsigned int tmr3_en : 1;
613 unsigned int tmr0_dis : 1;
614 unsigned int tmr1_dis : 1;
615 unsigned int tmr2_dis : 1;
616 unsigned int tmr3_dis : 1;
617 unsigned int dummy1 : 21;
618} reg_iop_sw_cfg_rw_timer_grp1_cfg;
619#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp1_cfg 212
620#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp1_cfg 212
621
622/* Register rw_timer_grp2_cfg, scope iop_sw_cfg, type rw */
623typedef struct {
624 unsigned int ext_clk : 3;
625 unsigned int tmr0_en : 1;
626 unsigned int tmr1_en : 1;
627 unsigned int tmr2_en : 1;
628 unsigned int tmr3_en : 1;
629 unsigned int tmr0_dis : 1;
630 unsigned int tmr1_dis : 1;
631 unsigned int tmr2_dis : 1;
632 unsigned int tmr3_dis : 1;
633 unsigned int dummy1 : 21;
634} reg_iop_sw_cfg_rw_timer_grp2_cfg;
635#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp2_cfg 216
636#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp2_cfg 216
637
638/* Register rw_timer_grp3_cfg, scope iop_sw_cfg, type rw */
639typedef struct {
640 unsigned int ext_clk : 3;
641 unsigned int tmr0_en : 1;
642 unsigned int tmr1_en : 1;
643 unsigned int tmr2_en : 1;
644 unsigned int tmr3_en : 1;
645 unsigned int tmr0_dis : 1;
646 unsigned int tmr1_dis : 1;
647 unsigned int tmr2_dis : 1;
648 unsigned int tmr3_dis : 1;
649 unsigned int dummy1 : 21;
650} reg_iop_sw_cfg_rw_timer_grp3_cfg;
651#define REG_RD_ADDR_iop_sw_cfg_rw_timer_grp3_cfg 220
652#define REG_WR_ADDR_iop_sw_cfg_rw_timer_grp3_cfg 220
653
654/* Register rw_trigger_grps_cfg, scope iop_sw_cfg, type rw */
655typedef struct {
656 unsigned int grp0_dis : 1;
657 unsigned int grp0_en : 1;
658 unsigned int grp1_dis : 1;
659 unsigned int grp1_en : 1;
660 unsigned int grp2_dis : 1;
661 unsigned int grp2_en : 1;
662 unsigned int grp3_dis : 1;
663 unsigned int grp3_en : 1;
664 unsigned int grp4_dis : 1;
665 unsigned int grp4_en : 1;
666 unsigned int grp5_dis : 1;
667 unsigned int grp5_en : 1;
668 unsigned int grp6_dis : 1;
669 unsigned int grp6_en : 1;
670 unsigned int grp7_dis : 1;
671 unsigned int grp7_en : 1;
672 unsigned int dummy1 : 16;
673} reg_iop_sw_cfg_rw_trigger_grps_cfg;
674#define REG_RD_ADDR_iop_sw_cfg_rw_trigger_grps_cfg 224
675#define REG_WR_ADDR_iop_sw_cfg_rw_trigger_grps_cfg 224
676
677/* Register rw_pdp0_cfg, scope iop_sw_cfg, type rw */
678typedef struct {
679 unsigned int dmc0_usr : 1;
680 unsigned int out_strb : 5;
681 unsigned int in_src : 3;
682 unsigned int in_size : 3;
683 unsigned int in_last : 2;
684 unsigned int in_strb : 4;
685 unsigned int out_src : 1;
686 unsigned int dummy1 : 13;
687} reg_iop_sw_cfg_rw_pdp0_cfg;
688#define REG_RD_ADDR_iop_sw_cfg_rw_pdp0_cfg 228
689#define REG_WR_ADDR_iop_sw_cfg_rw_pdp0_cfg 228
690
691/* Register rw_pdp1_cfg, scope iop_sw_cfg, type rw */
692typedef struct {
693 unsigned int dmc1_usr : 1;
694 unsigned int out_strb : 5;
695 unsigned int in_src : 3;
696 unsigned int in_size : 3;
697 unsigned int in_last : 2;
698 unsigned int in_strb : 4;
699 unsigned int out_src : 1;
700 unsigned int dummy1 : 13;
701} reg_iop_sw_cfg_rw_pdp1_cfg;
702#define REG_RD_ADDR_iop_sw_cfg_rw_pdp1_cfg 232
703#define REG_WR_ADDR_iop_sw_cfg_rw_pdp1_cfg 232
704
705/* Register rw_sdp_cfg, scope iop_sw_cfg, type rw */
706typedef struct {
707 unsigned int sdp_out0_strb : 3;
708 unsigned int sdp_out1_strb : 3;
709 unsigned int sdp_in0_data : 3;
710 unsigned int sdp_in0_last : 2;
711 unsigned int sdp_in0_strb : 3;
712 unsigned int sdp_in1_data : 3;
713 unsigned int sdp_in1_last : 2;
714 unsigned int sdp_in1_strb : 3;
715 unsigned int dummy1 : 10;
716} reg_iop_sw_cfg_rw_sdp_cfg;
717#define REG_RD_ADDR_iop_sw_cfg_rw_sdp_cfg 236
718#define REG_WR_ADDR_iop_sw_cfg_rw_sdp_cfg 236
719
720
721/* Constants */
722enum {
723 regk_iop_sw_cfg_a = 0x00000001,
724 regk_iop_sw_cfg_b = 0x00000002,
725 regk_iop_sw_cfg_bus0 = 0x00000000,
726 regk_iop_sw_cfg_bus0_rot16 = 0x00000004,
727 regk_iop_sw_cfg_bus0_rot24 = 0x00000006,
728 regk_iop_sw_cfg_bus0_rot8 = 0x00000002,
729 regk_iop_sw_cfg_bus1 = 0x00000001,
730 regk_iop_sw_cfg_bus1_rot16 = 0x00000005,
731 regk_iop_sw_cfg_bus1_rot24 = 0x00000007,
732 regk_iop_sw_cfg_bus1_rot8 = 0x00000003,
733 regk_iop_sw_cfg_clk12 = 0x00000000,
734 regk_iop_sw_cfg_cpu = 0x00000000,
735 regk_iop_sw_cfg_dmc0 = 0x00000000,
736 regk_iop_sw_cfg_dmc1 = 0x00000001,
737 regk_iop_sw_cfg_gated_clk0 = 0x00000010,
738 regk_iop_sw_cfg_gated_clk1 = 0x00000011,
739 regk_iop_sw_cfg_gated_clk2 = 0x00000012,
740 regk_iop_sw_cfg_gated_clk3 = 0x00000013,
741 regk_iop_sw_cfg_gio0 = 0x00000004,
742 regk_iop_sw_cfg_gio1 = 0x00000001,
743 regk_iop_sw_cfg_gio2 = 0x00000005,
744 regk_iop_sw_cfg_gio3 = 0x00000002,
745 regk_iop_sw_cfg_gio4 = 0x00000006,
746 regk_iop_sw_cfg_gio5 = 0x00000003,
747 regk_iop_sw_cfg_gio6 = 0x00000007,
748 regk_iop_sw_cfg_gio7 = 0x00000004,
749 regk_iop_sw_cfg_gio_in0 = 0x00000000,
750 regk_iop_sw_cfg_gio_in1 = 0x00000001,
751 regk_iop_sw_cfg_gio_in10 = 0x00000002,
752 regk_iop_sw_cfg_gio_in11 = 0x00000003,
753 regk_iop_sw_cfg_gio_in14 = 0x00000004,
754 regk_iop_sw_cfg_gio_in15 = 0x00000005,
755 regk_iop_sw_cfg_gio_in18 = 0x00000002,
756 regk_iop_sw_cfg_gio_in19 = 0x00000003,
757 regk_iop_sw_cfg_gio_in20 = 0x00000004,
758 regk_iop_sw_cfg_gio_in21 = 0x00000005,
759 regk_iop_sw_cfg_gio_in26 = 0x00000006,
760 regk_iop_sw_cfg_gio_in27 = 0x00000007,
761 regk_iop_sw_cfg_gio_in28 = 0x00000006,
762 regk_iop_sw_cfg_gio_in29 = 0x00000007,
763 regk_iop_sw_cfg_gio_in4 = 0x00000000,
764 regk_iop_sw_cfg_gio_in5 = 0x00000001,
765 regk_iop_sw_cfg_last_timer_grp0_tmr2 = 0x00000001,
766 regk_iop_sw_cfg_last_timer_grp1_tmr2 = 0x00000001,
767 regk_iop_sw_cfg_last_timer_grp2_tmr2 = 0x00000002,
768 regk_iop_sw_cfg_last_timer_grp2_tmr3 = 0x00000003,
769 regk_iop_sw_cfg_last_timer_grp3_tmr2 = 0x00000002,
770 regk_iop_sw_cfg_last_timer_grp3_tmr3 = 0x00000003,
771 regk_iop_sw_cfg_mpu = 0x00000001,
772 regk_iop_sw_cfg_none = 0x00000000,
773 regk_iop_sw_cfg_par0 = 0x00000000,
774 regk_iop_sw_cfg_par1 = 0x00000001,
775 regk_iop_sw_cfg_pdp_out0 = 0x00000002,
776 regk_iop_sw_cfg_pdp_out0_hi = 0x00000001,
777 regk_iop_sw_cfg_pdp_out0_hi_rot8 = 0x00000005,
778 regk_iop_sw_cfg_pdp_out0_lo = 0x00000000,
779 regk_iop_sw_cfg_pdp_out0_lo_rot8 = 0x00000004,
780 regk_iop_sw_cfg_pdp_out1 = 0x00000003,
781 regk_iop_sw_cfg_pdp_out1_hi = 0x00000003,
782 regk_iop_sw_cfg_pdp_out1_hi_rot8 = 0x00000005,
783 regk_iop_sw_cfg_pdp_out1_lo = 0x00000002,
784 regk_iop_sw_cfg_pdp_out1_lo_rot8 = 0x00000004,
785 regk_iop_sw_cfg_rw_bus0_mask_default = 0x00000000,
786 regk_iop_sw_cfg_rw_bus0_oe_mask_default = 0x00000000,
787 regk_iop_sw_cfg_rw_bus1_mask_default = 0x00000000,
788 regk_iop_sw_cfg_rw_bus1_oe_mask_default = 0x00000000,
789 regk_iop_sw_cfg_rw_bus_out_cfg_default = 0x00000000,
790 regk_iop_sw_cfg_rw_crc_par0_owner_default = 0x00000000,
791 regk_iop_sw_cfg_rw_crc_par1_owner_default = 0x00000000,
792 regk_iop_sw_cfg_rw_dmc_in0_owner_default = 0x00000000,
793 regk_iop_sw_cfg_rw_dmc_in1_owner_default = 0x00000000,
794 regk_iop_sw_cfg_rw_dmc_out0_owner_default = 0x00000000,
795 regk_iop_sw_cfg_rw_dmc_out1_owner_default = 0x00000000,
796 regk_iop_sw_cfg_rw_fifo_in0_extra_owner_default = 0x00000000,
797 regk_iop_sw_cfg_rw_fifo_in0_owner_default = 0x00000000,
798 regk_iop_sw_cfg_rw_fifo_in1_extra_owner_default = 0x00000000,
799 regk_iop_sw_cfg_rw_fifo_in1_owner_default = 0x00000000,
800 regk_iop_sw_cfg_rw_fifo_out0_extra_owner_default = 0x00000000,
801 regk_iop_sw_cfg_rw_fifo_out0_owner_default = 0x00000000,
802 regk_iop_sw_cfg_rw_fifo_out1_extra_owner_default = 0x00000000,
803 regk_iop_sw_cfg_rw_fifo_out1_owner_default = 0x00000000,
804 regk_iop_sw_cfg_rw_gio_mask_default = 0x00000000,
805 regk_iop_sw_cfg_rw_gio_oe_mask_default = 0x00000000,
806 regk_iop_sw_cfg_rw_gio_out_grp0_cfg_default = 0x00000000,
807 regk_iop_sw_cfg_rw_gio_out_grp1_cfg_default = 0x00000000,
808 regk_iop_sw_cfg_rw_gio_out_grp2_cfg_default = 0x00000000,
809 regk_iop_sw_cfg_rw_gio_out_grp3_cfg_default = 0x00000000,
810 regk_iop_sw_cfg_rw_gio_out_grp4_cfg_default = 0x00000000,
811 regk_iop_sw_cfg_rw_gio_out_grp5_cfg_default = 0x00000000,
812 regk_iop_sw_cfg_rw_gio_out_grp6_cfg_default = 0x00000000,
813 regk_iop_sw_cfg_rw_gio_out_grp7_cfg_default = 0x00000000,
814 regk_iop_sw_cfg_rw_pdp0_cfg_default = 0x00000000,
815 regk_iop_sw_cfg_rw_pdp1_cfg_default = 0x00000000,
816 regk_iop_sw_cfg_rw_pinmapping_default = 0x55555555,
817 regk_iop_sw_cfg_rw_sap_in_owner_default = 0x00000000,
818 regk_iop_sw_cfg_rw_sap_out_owner_default = 0x00000000,
819 regk_iop_sw_cfg_rw_scrc_in0_owner_default = 0x00000000,
820 regk_iop_sw_cfg_rw_scrc_in1_owner_default = 0x00000000,
821 regk_iop_sw_cfg_rw_scrc_out0_owner_default = 0x00000000,
822 regk_iop_sw_cfg_rw_scrc_out1_owner_default = 0x00000000,
823 regk_iop_sw_cfg_rw_sdp_cfg_default = 0x00000000,
824 regk_iop_sw_cfg_rw_spu0_cfg_default = 0x00000000,
825 regk_iop_sw_cfg_rw_spu0_owner_default = 0x00000000,
826 regk_iop_sw_cfg_rw_spu1_cfg_default = 0x00000000,
827 regk_iop_sw_cfg_rw_spu1_owner_default = 0x00000000,
828 regk_iop_sw_cfg_rw_timer_grp0_cfg_default = 0x00000000,
829 regk_iop_sw_cfg_rw_timer_grp0_owner_default = 0x00000000,
830 regk_iop_sw_cfg_rw_timer_grp1_cfg_default = 0x00000000,
831 regk_iop_sw_cfg_rw_timer_grp1_owner_default = 0x00000000,
832 regk_iop_sw_cfg_rw_timer_grp2_cfg_default = 0x00000000,
833 regk_iop_sw_cfg_rw_timer_grp2_owner_default = 0x00000000,
834 regk_iop_sw_cfg_rw_timer_grp3_cfg_default = 0x00000000,
835 regk_iop_sw_cfg_rw_timer_grp3_owner_default = 0x00000000,
836 regk_iop_sw_cfg_rw_trigger_grp0_owner_default = 0x00000000,
837 regk_iop_sw_cfg_rw_trigger_grp1_owner_default = 0x00000000,
838 regk_iop_sw_cfg_rw_trigger_grp2_owner_default = 0x00000000,
839 regk_iop_sw_cfg_rw_trigger_grp3_owner_default = 0x00000000,
840 regk_iop_sw_cfg_rw_trigger_grp4_owner_default = 0x00000000,
841 regk_iop_sw_cfg_rw_trigger_grp5_owner_default = 0x00000000,
842 regk_iop_sw_cfg_rw_trigger_grp6_owner_default = 0x00000000,
843 regk_iop_sw_cfg_rw_trigger_grp7_owner_default = 0x00000000,
844 regk_iop_sw_cfg_rw_trigger_grps_cfg_default = 0x00000000,
845 regk_iop_sw_cfg_sdp_out0 = 0x00000008,
846 regk_iop_sw_cfg_sdp_out1 = 0x00000009,
847 regk_iop_sw_cfg_size16 = 0x00000002,
848 regk_iop_sw_cfg_size24 = 0x00000003,
849 regk_iop_sw_cfg_size32 = 0x00000004,
850 regk_iop_sw_cfg_size8 = 0x00000001,
851 regk_iop_sw_cfg_spu0 = 0x00000002,
852 regk_iop_sw_cfg_spu0_bus_out0_hi = 0x00000006,
853 regk_iop_sw_cfg_spu0_bus_out0_lo = 0x00000006,
854 regk_iop_sw_cfg_spu0_bus_out1_hi = 0x00000007,
855 regk_iop_sw_cfg_spu0_bus_out1_lo = 0x00000007,
856 regk_iop_sw_cfg_spu0_g0 = 0x0000000e,
857 regk_iop_sw_cfg_spu0_g1 = 0x0000000e,
858 regk_iop_sw_cfg_spu0_g2 = 0x0000000e,
859 regk_iop_sw_cfg_spu0_g3 = 0x0000000e,
860 regk_iop_sw_cfg_spu0_g4 = 0x0000000e,
861 regk_iop_sw_cfg_spu0_g5 = 0x0000000e,
862 regk_iop_sw_cfg_spu0_g6 = 0x0000000e,
863 regk_iop_sw_cfg_spu0_g7 = 0x0000000e,
864 regk_iop_sw_cfg_spu0_gio0 = 0x00000000,
865 regk_iop_sw_cfg_spu0_gio1 = 0x00000001,
866 regk_iop_sw_cfg_spu0_gio2 = 0x00000000,
867 regk_iop_sw_cfg_spu0_gio5 = 0x00000005,
868 regk_iop_sw_cfg_spu0_gio6 = 0x00000006,
869 regk_iop_sw_cfg_spu0_gio7 = 0x00000007,
870 regk_iop_sw_cfg_spu0_gio_out0 = 0x00000008,
871 regk_iop_sw_cfg_spu0_gio_out1 = 0x00000009,
872 regk_iop_sw_cfg_spu0_gio_out2 = 0x0000000a,
873 regk_iop_sw_cfg_spu0_gio_out3 = 0x0000000b,
874 regk_iop_sw_cfg_spu0_gio_out4 = 0x0000000c,
875 regk_iop_sw_cfg_spu0_gio_out5 = 0x0000000d,
876 regk_iop_sw_cfg_spu0_gio_out6 = 0x0000000e,
877 regk_iop_sw_cfg_spu0_gio_out7 = 0x0000000f,
878 regk_iop_sw_cfg_spu0_gioout0 = 0x00000000,
879 regk_iop_sw_cfg_spu0_gioout1 = 0x00000000,
880 regk_iop_sw_cfg_spu0_gioout10 = 0x0000000e,
881 regk_iop_sw_cfg_spu0_gioout11 = 0x0000000e,
882 regk_iop_sw_cfg_spu0_gioout12 = 0x0000000e,
883 regk_iop_sw_cfg_spu0_gioout13 = 0x0000000e,
884 regk_iop_sw_cfg_spu0_gioout14 = 0x0000000e,
885 regk_iop_sw_cfg_spu0_gioout15 = 0x0000000e,
886 regk_iop_sw_cfg_spu0_gioout16 = 0x0000000e,
887 regk_iop_sw_cfg_spu0_gioout17 = 0x0000000e,
888 regk_iop_sw_cfg_spu0_gioout18 = 0x0000000e,
889 regk_iop_sw_cfg_spu0_gioout19 = 0x0000000e,
890 regk_iop_sw_cfg_spu0_gioout2 = 0x00000002,
891 regk_iop_sw_cfg_spu0_gioout20 = 0x0000000e,
892 regk_iop_sw_cfg_spu0_gioout21 = 0x0000000e,
893 regk_iop_sw_cfg_spu0_gioout22 = 0x0000000e,
894 regk_iop_sw_cfg_spu0_gioout23 = 0x0000000e,
895 regk_iop_sw_cfg_spu0_gioout24 = 0x0000000e,
896 regk_iop_sw_cfg_spu0_gioout25 = 0x0000000e,
897 regk_iop_sw_cfg_spu0_gioout26 = 0x0000000e,
898 regk_iop_sw_cfg_spu0_gioout27 = 0x0000000e,
899 regk_iop_sw_cfg_spu0_gioout28 = 0x0000000e,
900 regk_iop_sw_cfg_spu0_gioout29 = 0x0000000e,
901 regk_iop_sw_cfg_spu0_gioout3 = 0x00000002,
902 regk_iop_sw_cfg_spu0_gioout30 = 0x0000000e,
903 regk_iop_sw_cfg_spu0_gioout31 = 0x0000000e,
904 regk_iop_sw_cfg_spu0_gioout4 = 0x00000004,
905 regk_iop_sw_cfg_spu0_gioout5 = 0x00000004,
906 regk_iop_sw_cfg_spu0_gioout6 = 0x00000006,
907 regk_iop_sw_cfg_spu0_gioout7 = 0x00000006,
908 regk_iop_sw_cfg_spu0_gioout8 = 0x0000000e,
909 regk_iop_sw_cfg_spu0_gioout9 = 0x0000000e,
910 regk_iop_sw_cfg_spu1 = 0x00000003,
911 regk_iop_sw_cfg_spu1_bus_out0_hi = 0x00000006,
912 regk_iop_sw_cfg_spu1_bus_out0_lo = 0x00000006,
913 regk_iop_sw_cfg_spu1_bus_out1_hi = 0x00000007,
914 regk_iop_sw_cfg_spu1_bus_out1_lo = 0x00000007,
915 regk_iop_sw_cfg_spu1_g0 = 0x0000000f,
916 regk_iop_sw_cfg_spu1_g1 = 0x0000000f,
917 regk_iop_sw_cfg_spu1_g2 = 0x0000000f,
918 regk_iop_sw_cfg_spu1_g3 = 0x0000000f,
919 regk_iop_sw_cfg_spu1_g4 = 0x0000000f,
920 regk_iop_sw_cfg_spu1_g5 = 0x0000000f,
921 regk_iop_sw_cfg_spu1_g6 = 0x0000000f,
922 regk_iop_sw_cfg_spu1_g7 = 0x0000000f,
923 regk_iop_sw_cfg_spu1_gio0 = 0x00000002,
924 regk_iop_sw_cfg_spu1_gio1 = 0x00000003,
925 regk_iop_sw_cfg_spu1_gio2 = 0x00000002,
926 regk_iop_sw_cfg_spu1_gio5 = 0x00000005,
927 regk_iop_sw_cfg_spu1_gio6 = 0x00000006,
928 regk_iop_sw_cfg_spu1_gio7 = 0x00000007,
929 regk_iop_sw_cfg_spu1_gio_out0 = 0x00000008,
930 regk_iop_sw_cfg_spu1_gio_out1 = 0x00000009,
931 regk_iop_sw_cfg_spu1_gio_out2 = 0x0000000a,
932 regk_iop_sw_cfg_spu1_gio_out3 = 0x0000000b,
933 regk_iop_sw_cfg_spu1_gio_out4 = 0x0000000c,
934 regk_iop_sw_cfg_spu1_gio_out5 = 0x0000000d,
935 regk_iop_sw_cfg_spu1_gio_out6 = 0x0000000e,
936 regk_iop_sw_cfg_spu1_gio_out7 = 0x0000000f,
937 regk_iop_sw_cfg_spu1_gioout0 = 0x00000001,
938 regk_iop_sw_cfg_spu1_gioout1 = 0x00000001,
939 regk_iop_sw_cfg_spu1_gioout10 = 0x0000000f,
940 regk_iop_sw_cfg_spu1_gioout11 = 0x0000000f,
941 regk_iop_sw_cfg_spu1_gioout12 = 0x0000000f,
942 regk_iop_sw_cfg_spu1_gioout13 = 0x0000000f,
943 regk_iop_sw_cfg_spu1_gioout14 = 0x0000000f,
944 regk_iop_sw_cfg_spu1_gioout15 = 0x0000000f,
945 regk_iop_sw_cfg_spu1_gioout16 = 0x0000000f,
946 regk_iop_sw_cfg_spu1_gioout17 = 0x0000000f,
947 regk_iop_sw_cfg_spu1_gioout18 = 0x0000000f,
948 regk_iop_sw_cfg_spu1_gioout19 = 0x0000000f,
949 regk_iop_sw_cfg_spu1_gioout2 = 0x00000003,
950 regk_iop_sw_cfg_spu1_gioout20 = 0x0000000f,
951 regk_iop_sw_cfg_spu1_gioout21 = 0x0000000f,
952 regk_iop_sw_cfg_spu1_gioout22 = 0x0000000f,
953 regk_iop_sw_cfg_spu1_gioout23 = 0x0000000f,
954 regk_iop_sw_cfg_spu1_gioout24 = 0x0000000f,
955 regk_iop_sw_cfg_spu1_gioout25 = 0x0000000f,
956 regk_iop_sw_cfg_spu1_gioout26 = 0x0000000f,
957 regk_iop_sw_cfg_spu1_gioout27 = 0x0000000f,
958 regk_iop_sw_cfg_spu1_gioout28 = 0x0000000f,
959 regk_iop_sw_cfg_spu1_gioout29 = 0x0000000f,
960 regk_iop_sw_cfg_spu1_gioout3 = 0x00000003,
961 regk_iop_sw_cfg_spu1_gioout30 = 0x0000000f,
962 regk_iop_sw_cfg_spu1_gioout31 = 0x0000000f,
963 regk_iop_sw_cfg_spu1_gioout4 = 0x00000005,
964 regk_iop_sw_cfg_spu1_gioout5 = 0x00000005,
965 regk_iop_sw_cfg_spu1_gioout6 = 0x00000007,
966 regk_iop_sw_cfg_spu1_gioout7 = 0x00000007,
967 regk_iop_sw_cfg_spu1_gioout8 = 0x0000000f,
968 regk_iop_sw_cfg_spu1_gioout9 = 0x0000000f,
969 regk_iop_sw_cfg_strb_timer_grp0_tmr0 = 0x00000001,
970 regk_iop_sw_cfg_strb_timer_grp0_tmr1 = 0x00000002,
971 regk_iop_sw_cfg_strb_timer_grp1_tmr0 = 0x00000001,
972 regk_iop_sw_cfg_strb_timer_grp1_tmr1 = 0x00000002,
973 regk_iop_sw_cfg_strb_timer_grp2_tmr0 = 0x00000003,
974 regk_iop_sw_cfg_strb_timer_grp2_tmr1 = 0x00000002,
975 regk_iop_sw_cfg_strb_timer_grp3_tmr0 = 0x00000003,
976 regk_iop_sw_cfg_strb_timer_grp3_tmr1 = 0x00000002,
977 regk_iop_sw_cfg_timer_grp0 = 0x00000000,
978 regk_iop_sw_cfg_timer_grp0_rot = 0x00000001,
979 regk_iop_sw_cfg_timer_grp0_strb0 = 0x0000000a,
980 regk_iop_sw_cfg_timer_grp0_strb1 = 0x0000000a,
981 regk_iop_sw_cfg_timer_grp0_strb2 = 0x0000000a,
982 regk_iop_sw_cfg_timer_grp0_strb3 = 0x0000000a,
983 regk_iop_sw_cfg_timer_grp0_tmr0 = 0x00000004,
984 regk_iop_sw_cfg_timer_grp0_tmr1 = 0x00000004,
985 regk_iop_sw_cfg_timer_grp1 = 0x00000000,
986 regk_iop_sw_cfg_timer_grp1_rot = 0x00000001,
987 regk_iop_sw_cfg_timer_grp1_strb0 = 0x0000000b,
988 regk_iop_sw_cfg_timer_grp1_strb1 = 0x0000000b,
989 regk_iop_sw_cfg_timer_grp1_strb2 = 0x0000000b,
990 regk_iop_sw_cfg_timer_grp1_strb3 = 0x0000000b,
991 regk_iop_sw_cfg_timer_grp1_tmr0 = 0x00000005,
992 regk_iop_sw_cfg_timer_grp1_tmr1 = 0x00000005,
993 regk_iop_sw_cfg_timer_grp2 = 0x00000000,
994 regk_iop_sw_cfg_timer_grp2_rot = 0x00000001,
995 regk_iop_sw_cfg_timer_grp2_strb0 = 0x0000000c,
996 regk_iop_sw_cfg_timer_grp2_strb1 = 0x0000000c,
997 regk_iop_sw_cfg_timer_grp2_strb2 = 0x0000000c,
998 regk_iop_sw_cfg_timer_grp2_strb3 = 0x0000000c,
999 regk_iop_sw_cfg_timer_grp2_tmr0 = 0x00000006,
1000 regk_iop_sw_cfg_timer_grp2_tmr1 = 0x00000006,
1001 regk_iop_sw_cfg_timer_grp3 = 0x00000000,
1002 regk_iop_sw_cfg_timer_grp3_rot = 0x00000001,
1003 regk_iop_sw_cfg_timer_grp3_strb0 = 0x0000000d,
1004 regk_iop_sw_cfg_timer_grp3_strb1 = 0x0000000d,
1005 regk_iop_sw_cfg_timer_grp3_strb2 = 0x0000000d,
1006 regk_iop_sw_cfg_timer_grp3_strb3 = 0x0000000d,
1007 regk_iop_sw_cfg_timer_grp3_tmr0 = 0x00000007,
1008 regk_iop_sw_cfg_timer_grp3_tmr1 = 0x00000007,
1009 regk_iop_sw_cfg_trig0_0 = 0x00000000,
1010 regk_iop_sw_cfg_trig0_1 = 0x00000000,
1011 regk_iop_sw_cfg_trig0_2 = 0x00000000,
1012 regk_iop_sw_cfg_trig0_3 = 0x00000000,
1013 regk_iop_sw_cfg_trig1_0 = 0x00000000,
1014 regk_iop_sw_cfg_trig1_1 = 0x00000000,
1015 regk_iop_sw_cfg_trig1_2 = 0x00000000,
1016 regk_iop_sw_cfg_trig1_3 = 0x00000000,
1017 regk_iop_sw_cfg_trig2_0 = 0x00000000,
1018 regk_iop_sw_cfg_trig2_1 = 0x00000000,
1019 regk_iop_sw_cfg_trig2_2 = 0x00000000,
1020 regk_iop_sw_cfg_trig2_3 = 0x00000000,
1021 regk_iop_sw_cfg_trig3_0 = 0x00000000,
1022 regk_iop_sw_cfg_trig3_1 = 0x00000000,
1023 regk_iop_sw_cfg_trig3_2 = 0x00000000,
1024 regk_iop_sw_cfg_trig3_3 = 0x00000000,
1025 regk_iop_sw_cfg_trig4_0 = 0x00000001,
1026 regk_iop_sw_cfg_trig4_1 = 0x00000001,
1027 regk_iop_sw_cfg_trig4_2 = 0x00000001,
1028 regk_iop_sw_cfg_trig4_3 = 0x00000001,
1029 regk_iop_sw_cfg_trig5_0 = 0x00000001,
1030 regk_iop_sw_cfg_trig5_1 = 0x00000001,
1031 regk_iop_sw_cfg_trig5_2 = 0x00000001,
1032 regk_iop_sw_cfg_trig5_3 = 0x00000001,
1033 regk_iop_sw_cfg_trig6_0 = 0x00000001,
1034 regk_iop_sw_cfg_trig6_1 = 0x00000001,
1035 regk_iop_sw_cfg_trig6_2 = 0x00000001,
1036 regk_iop_sw_cfg_trig6_3 = 0x00000001,
1037 regk_iop_sw_cfg_trig7_0 = 0x00000001,
1038 regk_iop_sw_cfg_trig7_1 = 0x00000001,
1039 regk_iop_sw_cfg_trig7_2 = 0x00000001,
1040 regk_iop_sw_cfg_trig7_3 = 0x00000001
1041};
1042#endif /* __iop_sw_cfg_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cpu_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cpu_defs.h
new file mode 100644
index 000000000000..5fed844b19e2
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_cpu_defs.h
@@ -0,0 +1,853 @@
1#ifndef __iop_sw_cpu_defs_h
2#define __iop_sw_cpu_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_cpu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sw_cpu_defs.h ../../inst/io_proc/rtl/guinness/iop_sw_cpu.r
11 * id: $Id: iop_sw_cpu_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sw_cpu */
86
87/* Register rw_mc_ctrl, scope iop_sw_cpu, type rw */
88typedef struct {
89 unsigned int keep_owner : 1;
90 unsigned int cmd : 2;
91 unsigned int size : 3;
92 unsigned int wr_spu0_mem : 1;
93 unsigned int wr_spu1_mem : 1;
94 unsigned int dummy1 : 24;
95} reg_iop_sw_cpu_rw_mc_ctrl;
96#define REG_RD_ADDR_iop_sw_cpu_rw_mc_ctrl 0
97#define REG_WR_ADDR_iop_sw_cpu_rw_mc_ctrl 0
98
99/* Register rw_mc_data, scope iop_sw_cpu, type rw */
100typedef struct {
101 unsigned int val : 32;
102} reg_iop_sw_cpu_rw_mc_data;
103#define REG_RD_ADDR_iop_sw_cpu_rw_mc_data 4
104#define REG_WR_ADDR_iop_sw_cpu_rw_mc_data 4
105
106/* Register rw_mc_addr, scope iop_sw_cpu, type rw */
107typedef unsigned int reg_iop_sw_cpu_rw_mc_addr;
108#define REG_RD_ADDR_iop_sw_cpu_rw_mc_addr 8
109#define REG_WR_ADDR_iop_sw_cpu_rw_mc_addr 8
110
111/* Register rs_mc_data, scope iop_sw_cpu, type rs */
112typedef unsigned int reg_iop_sw_cpu_rs_mc_data;
113#define REG_RD_ADDR_iop_sw_cpu_rs_mc_data 12
114
115/* Register r_mc_data, scope iop_sw_cpu, type r */
116typedef unsigned int reg_iop_sw_cpu_r_mc_data;
117#define REG_RD_ADDR_iop_sw_cpu_r_mc_data 16
118
119/* Register r_mc_stat, scope iop_sw_cpu, type r */
120typedef struct {
121 unsigned int busy_cpu : 1;
122 unsigned int busy_mpu : 1;
123 unsigned int busy_spu0 : 1;
124 unsigned int busy_spu1 : 1;
125 unsigned int owned_by_cpu : 1;
126 unsigned int owned_by_mpu : 1;
127 unsigned int owned_by_spu0 : 1;
128 unsigned int owned_by_spu1 : 1;
129 unsigned int dummy1 : 24;
130} reg_iop_sw_cpu_r_mc_stat;
131#define REG_RD_ADDR_iop_sw_cpu_r_mc_stat 20
132
133/* Register rw_bus0_clr_mask, scope iop_sw_cpu, type rw */
134typedef struct {
135 unsigned int byte0 : 8;
136 unsigned int byte1 : 8;
137 unsigned int byte2 : 8;
138 unsigned int byte3 : 8;
139} reg_iop_sw_cpu_rw_bus0_clr_mask;
140#define REG_RD_ADDR_iop_sw_cpu_rw_bus0_clr_mask 24
141#define REG_WR_ADDR_iop_sw_cpu_rw_bus0_clr_mask 24
142
143/* Register rw_bus0_set_mask, scope iop_sw_cpu, type rw */
144typedef struct {
145 unsigned int byte0 : 8;
146 unsigned int byte1 : 8;
147 unsigned int byte2 : 8;
148 unsigned int byte3 : 8;
149} reg_iop_sw_cpu_rw_bus0_set_mask;
150#define REG_RD_ADDR_iop_sw_cpu_rw_bus0_set_mask 28
151#define REG_WR_ADDR_iop_sw_cpu_rw_bus0_set_mask 28
152
153/* Register rw_bus0_oe_clr_mask, scope iop_sw_cpu, type rw */
154typedef struct {
155 unsigned int byte0 : 1;
156 unsigned int byte1 : 1;
157 unsigned int byte2 : 1;
158 unsigned int byte3 : 1;
159 unsigned int dummy1 : 28;
160} reg_iop_sw_cpu_rw_bus0_oe_clr_mask;
161#define REG_RD_ADDR_iop_sw_cpu_rw_bus0_oe_clr_mask 32
162#define REG_WR_ADDR_iop_sw_cpu_rw_bus0_oe_clr_mask 32
163
164/* Register rw_bus0_oe_set_mask, scope iop_sw_cpu, type rw */
165typedef struct {
166 unsigned int byte0 : 1;
167 unsigned int byte1 : 1;
168 unsigned int byte2 : 1;
169 unsigned int byte3 : 1;
170 unsigned int dummy1 : 28;
171} reg_iop_sw_cpu_rw_bus0_oe_set_mask;
172#define REG_RD_ADDR_iop_sw_cpu_rw_bus0_oe_set_mask 36
173#define REG_WR_ADDR_iop_sw_cpu_rw_bus0_oe_set_mask 36
174
175/* Register r_bus0_in, scope iop_sw_cpu, type r */
176typedef unsigned int reg_iop_sw_cpu_r_bus0_in;
177#define REG_RD_ADDR_iop_sw_cpu_r_bus0_in 40
178
179/* Register rw_bus1_clr_mask, scope iop_sw_cpu, type rw */
180typedef struct {
181 unsigned int byte0 : 8;
182 unsigned int byte1 : 8;
183 unsigned int byte2 : 8;
184 unsigned int byte3 : 8;
185} reg_iop_sw_cpu_rw_bus1_clr_mask;
186#define REG_RD_ADDR_iop_sw_cpu_rw_bus1_clr_mask 44
187#define REG_WR_ADDR_iop_sw_cpu_rw_bus1_clr_mask 44
188
189/* Register rw_bus1_set_mask, scope iop_sw_cpu, type rw */
190typedef struct {
191 unsigned int byte0 : 8;
192 unsigned int byte1 : 8;
193 unsigned int byte2 : 8;
194 unsigned int byte3 : 8;
195} reg_iop_sw_cpu_rw_bus1_set_mask;
196#define REG_RD_ADDR_iop_sw_cpu_rw_bus1_set_mask 48
197#define REG_WR_ADDR_iop_sw_cpu_rw_bus1_set_mask 48
198
199/* Register rw_bus1_oe_clr_mask, scope iop_sw_cpu, type rw */
200typedef struct {
201 unsigned int byte0 : 1;
202 unsigned int byte1 : 1;
203 unsigned int byte2 : 1;
204 unsigned int byte3 : 1;
205 unsigned int dummy1 : 28;
206} reg_iop_sw_cpu_rw_bus1_oe_clr_mask;
207#define REG_RD_ADDR_iop_sw_cpu_rw_bus1_oe_clr_mask 52
208#define REG_WR_ADDR_iop_sw_cpu_rw_bus1_oe_clr_mask 52
209
210/* Register rw_bus1_oe_set_mask, scope iop_sw_cpu, type rw */
211typedef struct {
212 unsigned int byte0 : 1;
213 unsigned int byte1 : 1;
214 unsigned int byte2 : 1;
215 unsigned int byte3 : 1;
216 unsigned int dummy1 : 28;
217} reg_iop_sw_cpu_rw_bus1_oe_set_mask;
218#define REG_RD_ADDR_iop_sw_cpu_rw_bus1_oe_set_mask 56
219#define REG_WR_ADDR_iop_sw_cpu_rw_bus1_oe_set_mask 56
220
221/* Register r_bus1_in, scope iop_sw_cpu, type r */
222typedef unsigned int reg_iop_sw_cpu_r_bus1_in;
223#define REG_RD_ADDR_iop_sw_cpu_r_bus1_in 60
224
225/* Register rw_gio_clr_mask, scope iop_sw_cpu, type rw */
226typedef struct {
227 unsigned int val : 32;
228} reg_iop_sw_cpu_rw_gio_clr_mask;
229#define REG_RD_ADDR_iop_sw_cpu_rw_gio_clr_mask 64
230#define REG_WR_ADDR_iop_sw_cpu_rw_gio_clr_mask 64
231
232/* Register rw_gio_set_mask, scope iop_sw_cpu, type rw */
233typedef struct {
234 unsigned int val : 32;
235} reg_iop_sw_cpu_rw_gio_set_mask;
236#define REG_RD_ADDR_iop_sw_cpu_rw_gio_set_mask 68
237#define REG_WR_ADDR_iop_sw_cpu_rw_gio_set_mask 68
238
239/* Register rw_gio_oe_clr_mask, scope iop_sw_cpu, type rw */
240typedef struct {
241 unsigned int val : 32;
242} reg_iop_sw_cpu_rw_gio_oe_clr_mask;
243#define REG_RD_ADDR_iop_sw_cpu_rw_gio_oe_clr_mask 72
244#define REG_WR_ADDR_iop_sw_cpu_rw_gio_oe_clr_mask 72
245
246/* Register rw_gio_oe_set_mask, scope iop_sw_cpu, type rw */
247typedef struct {
248 unsigned int val : 32;
249} reg_iop_sw_cpu_rw_gio_oe_set_mask;
250#define REG_RD_ADDR_iop_sw_cpu_rw_gio_oe_set_mask 76
251#define REG_WR_ADDR_iop_sw_cpu_rw_gio_oe_set_mask 76
252
253/* Register r_gio_in, scope iop_sw_cpu, type r */
254typedef unsigned int reg_iop_sw_cpu_r_gio_in;
255#define REG_RD_ADDR_iop_sw_cpu_r_gio_in 80
256
257/* Register rw_intr0_mask, scope iop_sw_cpu, type rw */
258typedef struct {
259 unsigned int mpu_0 : 1;
260 unsigned int mpu_1 : 1;
261 unsigned int mpu_2 : 1;
262 unsigned int mpu_3 : 1;
263 unsigned int mpu_4 : 1;
264 unsigned int mpu_5 : 1;
265 unsigned int mpu_6 : 1;
266 unsigned int mpu_7 : 1;
267 unsigned int mpu_8 : 1;
268 unsigned int mpu_9 : 1;
269 unsigned int mpu_10 : 1;
270 unsigned int mpu_11 : 1;
271 unsigned int mpu_12 : 1;
272 unsigned int mpu_13 : 1;
273 unsigned int mpu_14 : 1;
274 unsigned int mpu_15 : 1;
275 unsigned int spu0_0 : 1;
276 unsigned int spu0_1 : 1;
277 unsigned int spu0_2 : 1;
278 unsigned int spu0_3 : 1;
279 unsigned int spu0_4 : 1;
280 unsigned int spu0_5 : 1;
281 unsigned int spu0_6 : 1;
282 unsigned int spu0_7 : 1;
283 unsigned int spu1_8 : 1;
284 unsigned int spu1_9 : 1;
285 unsigned int spu1_10 : 1;
286 unsigned int spu1_11 : 1;
287 unsigned int spu1_12 : 1;
288 unsigned int spu1_13 : 1;
289 unsigned int spu1_14 : 1;
290 unsigned int spu1_15 : 1;
291} reg_iop_sw_cpu_rw_intr0_mask;
292#define REG_RD_ADDR_iop_sw_cpu_rw_intr0_mask 84
293#define REG_WR_ADDR_iop_sw_cpu_rw_intr0_mask 84
294
295/* Register rw_ack_intr0, scope iop_sw_cpu, type rw */
296typedef struct {
297 unsigned int mpu_0 : 1;
298 unsigned int mpu_1 : 1;
299 unsigned int mpu_2 : 1;
300 unsigned int mpu_3 : 1;
301 unsigned int mpu_4 : 1;
302 unsigned int mpu_5 : 1;
303 unsigned int mpu_6 : 1;
304 unsigned int mpu_7 : 1;
305 unsigned int mpu_8 : 1;
306 unsigned int mpu_9 : 1;
307 unsigned int mpu_10 : 1;
308 unsigned int mpu_11 : 1;
309 unsigned int mpu_12 : 1;
310 unsigned int mpu_13 : 1;
311 unsigned int mpu_14 : 1;
312 unsigned int mpu_15 : 1;
313 unsigned int spu0_0 : 1;
314 unsigned int spu0_1 : 1;
315 unsigned int spu0_2 : 1;
316 unsigned int spu0_3 : 1;
317 unsigned int spu0_4 : 1;
318 unsigned int spu0_5 : 1;
319 unsigned int spu0_6 : 1;
320 unsigned int spu0_7 : 1;
321 unsigned int spu1_8 : 1;
322 unsigned int spu1_9 : 1;
323 unsigned int spu1_10 : 1;
324 unsigned int spu1_11 : 1;
325 unsigned int spu1_12 : 1;
326 unsigned int spu1_13 : 1;
327 unsigned int spu1_14 : 1;
328 unsigned int spu1_15 : 1;
329} reg_iop_sw_cpu_rw_ack_intr0;
330#define REG_RD_ADDR_iop_sw_cpu_rw_ack_intr0 88
331#define REG_WR_ADDR_iop_sw_cpu_rw_ack_intr0 88
332
333/* Register r_intr0, scope iop_sw_cpu, type r */
334typedef struct {
335 unsigned int mpu_0 : 1;
336 unsigned int mpu_1 : 1;
337 unsigned int mpu_2 : 1;
338 unsigned int mpu_3 : 1;
339 unsigned int mpu_4 : 1;
340 unsigned int mpu_5 : 1;
341 unsigned int mpu_6 : 1;
342 unsigned int mpu_7 : 1;
343 unsigned int mpu_8 : 1;
344 unsigned int mpu_9 : 1;
345 unsigned int mpu_10 : 1;
346 unsigned int mpu_11 : 1;
347 unsigned int mpu_12 : 1;
348 unsigned int mpu_13 : 1;
349 unsigned int mpu_14 : 1;
350 unsigned int mpu_15 : 1;
351 unsigned int spu0_0 : 1;
352 unsigned int spu0_1 : 1;
353 unsigned int spu0_2 : 1;
354 unsigned int spu0_3 : 1;
355 unsigned int spu0_4 : 1;
356 unsigned int spu0_5 : 1;
357 unsigned int spu0_6 : 1;
358 unsigned int spu0_7 : 1;
359 unsigned int spu1_8 : 1;
360 unsigned int spu1_9 : 1;
361 unsigned int spu1_10 : 1;
362 unsigned int spu1_11 : 1;
363 unsigned int spu1_12 : 1;
364 unsigned int spu1_13 : 1;
365 unsigned int spu1_14 : 1;
366 unsigned int spu1_15 : 1;
367} reg_iop_sw_cpu_r_intr0;
368#define REG_RD_ADDR_iop_sw_cpu_r_intr0 92
369
370/* Register r_masked_intr0, scope iop_sw_cpu, type r */
371typedef struct {
372 unsigned int mpu_0 : 1;
373 unsigned int mpu_1 : 1;
374 unsigned int mpu_2 : 1;
375 unsigned int mpu_3 : 1;
376 unsigned int mpu_4 : 1;
377 unsigned int mpu_5 : 1;
378 unsigned int mpu_6 : 1;
379 unsigned int mpu_7 : 1;
380 unsigned int mpu_8 : 1;
381 unsigned int mpu_9 : 1;
382 unsigned int mpu_10 : 1;
383 unsigned int mpu_11 : 1;
384 unsigned int mpu_12 : 1;
385 unsigned int mpu_13 : 1;
386 unsigned int mpu_14 : 1;
387 unsigned int mpu_15 : 1;
388 unsigned int spu0_0 : 1;
389 unsigned int spu0_1 : 1;
390 unsigned int spu0_2 : 1;
391 unsigned int spu0_3 : 1;
392 unsigned int spu0_4 : 1;
393 unsigned int spu0_5 : 1;
394 unsigned int spu0_6 : 1;
395 unsigned int spu0_7 : 1;
396 unsigned int spu1_8 : 1;
397 unsigned int spu1_9 : 1;
398 unsigned int spu1_10 : 1;
399 unsigned int spu1_11 : 1;
400 unsigned int spu1_12 : 1;
401 unsigned int spu1_13 : 1;
402 unsigned int spu1_14 : 1;
403 unsigned int spu1_15 : 1;
404} reg_iop_sw_cpu_r_masked_intr0;
405#define REG_RD_ADDR_iop_sw_cpu_r_masked_intr0 96
406
407/* Register rw_intr1_mask, scope iop_sw_cpu, type rw */
408typedef struct {
409 unsigned int mpu_16 : 1;
410 unsigned int mpu_17 : 1;
411 unsigned int mpu_18 : 1;
412 unsigned int mpu_19 : 1;
413 unsigned int mpu_20 : 1;
414 unsigned int mpu_21 : 1;
415 unsigned int mpu_22 : 1;
416 unsigned int mpu_23 : 1;
417 unsigned int mpu_24 : 1;
418 unsigned int mpu_25 : 1;
419 unsigned int mpu_26 : 1;
420 unsigned int mpu_27 : 1;
421 unsigned int mpu_28 : 1;
422 unsigned int mpu_29 : 1;
423 unsigned int mpu_30 : 1;
424 unsigned int mpu_31 : 1;
425 unsigned int spu0_8 : 1;
426 unsigned int spu0_9 : 1;
427 unsigned int spu0_10 : 1;
428 unsigned int spu0_11 : 1;
429 unsigned int spu0_12 : 1;
430 unsigned int spu0_13 : 1;
431 unsigned int spu0_14 : 1;
432 unsigned int spu0_15 : 1;
433 unsigned int spu1_0 : 1;
434 unsigned int spu1_1 : 1;
435 unsigned int spu1_2 : 1;
436 unsigned int spu1_3 : 1;
437 unsigned int spu1_4 : 1;
438 unsigned int spu1_5 : 1;
439 unsigned int spu1_6 : 1;
440 unsigned int spu1_7 : 1;
441} reg_iop_sw_cpu_rw_intr1_mask;
442#define REG_RD_ADDR_iop_sw_cpu_rw_intr1_mask 100
443#define REG_WR_ADDR_iop_sw_cpu_rw_intr1_mask 100
444
445/* Register rw_ack_intr1, scope iop_sw_cpu, type rw */
446typedef struct {
447 unsigned int mpu_16 : 1;
448 unsigned int mpu_17 : 1;
449 unsigned int mpu_18 : 1;
450 unsigned int mpu_19 : 1;
451 unsigned int mpu_20 : 1;
452 unsigned int mpu_21 : 1;
453 unsigned int mpu_22 : 1;
454 unsigned int mpu_23 : 1;
455 unsigned int mpu_24 : 1;
456 unsigned int mpu_25 : 1;
457 unsigned int mpu_26 : 1;
458 unsigned int mpu_27 : 1;
459 unsigned int mpu_28 : 1;
460 unsigned int mpu_29 : 1;
461 unsigned int mpu_30 : 1;
462 unsigned int mpu_31 : 1;
463 unsigned int spu0_8 : 1;
464 unsigned int spu0_9 : 1;
465 unsigned int spu0_10 : 1;
466 unsigned int spu0_11 : 1;
467 unsigned int spu0_12 : 1;
468 unsigned int spu0_13 : 1;
469 unsigned int spu0_14 : 1;
470 unsigned int spu0_15 : 1;
471 unsigned int spu1_0 : 1;
472 unsigned int spu1_1 : 1;
473 unsigned int spu1_2 : 1;
474 unsigned int spu1_3 : 1;
475 unsigned int spu1_4 : 1;
476 unsigned int spu1_5 : 1;
477 unsigned int spu1_6 : 1;
478 unsigned int spu1_7 : 1;
479} reg_iop_sw_cpu_rw_ack_intr1;
480#define REG_RD_ADDR_iop_sw_cpu_rw_ack_intr1 104
481#define REG_WR_ADDR_iop_sw_cpu_rw_ack_intr1 104
482
483/* Register r_intr1, scope iop_sw_cpu, type r */
484typedef struct {
485 unsigned int mpu_16 : 1;
486 unsigned int mpu_17 : 1;
487 unsigned int mpu_18 : 1;
488 unsigned int mpu_19 : 1;
489 unsigned int mpu_20 : 1;
490 unsigned int mpu_21 : 1;
491 unsigned int mpu_22 : 1;
492 unsigned int mpu_23 : 1;
493 unsigned int mpu_24 : 1;
494 unsigned int mpu_25 : 1;
495 unsigned int mpu_26 : 1;
496 unsigned int mpu_27 : 1;
497 unsigned int mpu_28 : 1;
498 unsigned int mpu_29 : 1;
499 unsigned int mpu_30 : 1;
500 unsigned int mpu_31 : 1;
501 unsigned int spu0_8 : 1;
502 unsigned int spu0_9 : 1;
503 unsigned int spu0_10 : 1;
504 unsigned int spu0_11 : 1;
505 unsigned int spu0_12 : 1;
506 unsigned int spu0_13 : 1;
507 unsigned int spu0_14 : 1;
508 unsigned int spu0_15 : 1;
509 unsigned int spu1_0 : 1;
510 unsigned int spu1_1 : 1;
511 unsigned int spu1_2 : 1;
512 unsigned int spu1_3 : 1;
513 unsigned int spu1_4 : 1;
514 unsigned int spu1_5 : 1;
515 unsigned int spu1_6 : 1;
516 unsigned int spu1_7 : 1;
517} reg_iop_sw_cpu_r_intr1;
518#define REG_RD_ADDR_iop_sw_cpu_r_intr1 108
519
520/* Register r_masked_intr1, scope iop_sw_cpu, type r */
521typedef struct {
522 unsigned int mpu_16 : 1;
523 unsigned int mpu_17 : 1;
524 unsigned int mpu_18 : 1;
525 unsigned int mpu_19 : 1;
526 unsigned int mpu_20 : 1;
527 unsigned int mpu_21 : 1;
528 unsigned int mpu_22 : 1;
529 unsigned int mpu_23 : 1;
530 unsigned int mpu_24 : 1;
531 unsigned int mpu_25 : 1;
532 unsigned int mpu_26 : 1;
533 unsigned int mpu_27 : 1;
534 unsigned int mpu_28 : 1;
535 unsigned int mpu_29 : 1;
536 unsigned int mpu_30 : 1;
537 unsigned int mpu_31 : 1;
538 unsigned int spu0_8 : 1;
539 unsigned int spu0_9 : 1;
540 unsigned int spu0_10 : 1;
541 unsigned int spu0_11 : 1;
542 unsigned int spu0_12 : 1;
543 unsigned int spu0_13 : 1;
544 unsigned int spu0_14 : 1;
545 unsigned int spu0_15 : 1;
546 unsigned int spu1_0 : 1;
547 unsigned int spu1_1 : 1;
548 unsigned int spu1_2 : 1;
549 unsigned int spu1_3 : 1;
550 unsigned int spu1_4 : 1;
551 unsigned int spu1_5 : 1;
552 unsigned int spu1_6 : 1;
553 unsigned int spu1_7 : 1;
554} reg_iop_sw_cpu_r_masked_intr1;
555#define REG_RD_ADDR_iop_sw_cpu_r_masked_intr1 112
556
557/* Register rw_intr2_mask, scope iop_sw_cpu, type rw */
558typedef struct {
559 unsigned int mpu_0 : 1;
560 unsigned int mpu_1 : 1;
561 unsigned int mpu_2 : 1;
562 unsigned int mpu_3 : 1;
563 unsigned int mpu_4 : 1;
564 unsigned int mpu_5 : 1;
565 unsigned int mpu_6 : 1;
566 unsigned int mpu_7 : 1;
567 unsigned int spu0_0 : 1;
568 unsigned int spu0_1 : 1;
569 unsigned int spu0_2 : 1;
570 unsigned int spu0_3 : 1;
571 unsigned int spu0_4 : 1;
572 unsigned int spu0_5 : 1;
573 unsigned int spu0_6 : 1;
574 unsigned int spu0_7 : 1;
575 unsigned int dmc_in0 : 1;
576 unsigned int dmc_out0 : 1;
577 unsigned int fifo_in0 : 1;
578 unsigned int fifo_out0 : 1;
579 unsigned int fifo_in0_extra : 1;
580 unsigned int fifo_out0_extra : 1;
581 unsigned int trigger_grp0 : 1;
582 unsigned int trigger_grp1 : 1;
583 unsigned int trigger_grp2 : 1;
584 unsigned int trigger_grp3 : 1;
585 unsigned int trigger_grp4 : 1;
586 unsigned int trigger_grp5 : 1;
587 unsigned int trigger_grp6 : 1;
588 unsigned int trigger_grp7 : 1;
589 unsigned int timer_grp0 : 1;
590 unsigned int timer_grp1 : 1;
591} reg_iop_sw_cpu_rw_intr2_mask;
592#define REG_RD_ADDR_iop_sw_cpu_rw_intr2_mask 116
593#define REG_WR_ADDR_iop_sw_cpu_rw_intr2_mask 116
594
595/* Register rw_ack_intr2, scope iop_sw_cpu, type rw */
596typedef struct {
597 unsigned int mpu_0 : 1;
598 unsigned int mpu_1 : 1;
599 unsigned int mpu_2 : 1;
600 unsigned int mpu_3 : 1;
601 unsigned int mpu_4 : 1;
602 unsigned int mpu_5 : 1;
603 unsigned int mpu_6 : 1;
604 unsigned int mpu_7 : 1;
605 unsigned int spu0_0 : 1;
606 unsigned int spu0_1 : 1;
607 unsigned int spu0_2 : 1;
608 unsigned int spu0_3 : 1;
609 unsigned int spu0_4 : 1;
610 unsigned int spu0_5 : 1;
611 unsigned int spu0_6 : 1;
612 unsigned int spu0_7 : 1;
613 unsigned int dummy1 : 16;
614} reg_iop_sw_cpu_rw_ack_intr2;
615#define REG_RD_ADDR_iop_sw_cpu_rw_ack_intr2 120
616#define REG_WR_ADDR_iop_sw_cpu_rw_ack_intr2 120
617
618/* Register r_intr2, scope iop_sw_cpu, type r */
619typedef struct {
620 unsigned int mpu_0 : 1;
621 unsigned int mpu_1 : 1;
622 unsigned int mpu_2 : 1;
623 unsigned int mpu_3 : 1;
624 unsigned int mpu_4 : 1;
625 unsigned int mpu_5 : 1;
626 unsigned int mpu_6 : 1;
627 unsigned int mpu_7 : 1;
628 unsigned int spu0_0 : 1;
629 unsigned int spu0_1 : 1;
630 unsigned int spu0_2 : 1;
631 unsigned int spu0_3 : 1;
632 unsigned int spu0_4 : 1;
633 unsigned int spu0_5 : 1;
634 unsigned int spu0_6 : 1;
635 unsigned int spu0_7 : 1;
636 unsigned int dmc_in0 : 1;
637 unsigned int dmc_out0 : 1;
638 unsigned int fifo_in0 : 1;
639 unsigned int fifo_out0 : 1;
640 unsigned int fifo_in0_extra : 1;
641 unsigned int fifo_out0_extra : 1;
642 unsigned int trigger_grp0 : 1;
643 unsigned int trigger_grp1 : 1;
644 unsigned int trigger_grp2 : 1;
645 unsigned int trigger_grp3 : 1;
646 unsigned int trigger_grp4 : 1;
647 unsigned int trigger_grp5 : 1;
648 unsigned int trigger_grp6 : 1;
649 unsigned int trigger_grp7 : 1;
650 unsigned int timer_grp0 : 1;
651 unsigned int timer_grp1 : 1;
652} reg_iop_sw_cpu_r_intr2;
653#define REG_RD_ADDR_iop_sw_cpu_r_intr2 124
654
655/* Register r_masked_intr2, scope iop_sw_cpu, type r */
656typedef struct {
657 unsigned int mpu_0 : 1;
658 unsigned int mpu_1 : 1;
659 unsigned int mpu_2 : 1;
660 unsigned int mpu_3 : 1;
661 unsigned int mpu_4 : 1;
662 unsigned int mpu_5 : 1;
663 unsigned int mpu_6 : 1;
664 unsigned int mpu_7 : 1;
665 unsigned int spu0_0 : 1;
666 unsigned int spu0_1 : 1;
667 unsigned int spu0_2 : 1;
668 unsigned int spu0_3 : 1;
669 unsigned int spu0_4 : 1;
670 unsigned int spu0_5 : 1;
671 unsigned int spu0_6 : 1;
672 unsigned int spu0_7 : 1;
673 unsigned int dmc_in0 : 1;
674 unsigned int dmc_out0 : 1;
675 unsigned int fifo_in0 : 1;
676 unsigned int fifo_out0 : 1;
677 unsigned int fifo_in0_extra : 1;
678 unsigned int fifo_out0_extra : 1;
679 unsigned int trigger_grp0 : 1;
680 unsigned int trigger_grp1 : 1;
681 unsigned int trigger_grp2 : 1;
682 unsigned int trigger_grp3 : 1;
683 unsigned int trigger_grp4 : 1;
684 unsigned int trigger_grp5 : 1;
685 unsigned int trigger_grp6 : 1;
686 unsigned int trigger_grp7 : 1;
687 unsigned int timer_grp0 : 1;
688 unsigned int timer_grp1 : 1;
689} reg_iop_sw_cpu_r_masked_intr2;
690#define REG_RD_ADDR_iop_sw_cpu_r_masked_intr2 128
691
692/* Register rw_intr3_mask, scope iop_sw_cpu, type rw */
693typedef struct {
694 unsigned int mpu_16 : 1;
695 unsigned int mpu_17 : 1;
696 unsigned int mpu_18 : 1;
697 unsigned int mpu_19 : 1;
698 unsigned int mpu_20 : 1;
699 unsigned int mpu_21 : 1;
700 unsigned int mpu_22 : 1;
701 unsigned int mpu_23 : 1;
702 unsigned int spu1_0 : 1;
703 unsigned int spu1_1 : 1;
704 unsigned int spu1_2 : 1;
705 unsigned int spu1_3 : 1;
706 unsigned int spu1_4 : 1;
707 unsigned int spu1_5 : 1;
708 unsigned int spu1_6 : 1;
709 unsigned int spu1_7 : 1;
710 unsigned int dmc_in1 : 1;
711 unsigned int dmc_out1 : 1;
712 unsigned int fifo_in1 : 1;
713 unsigned int fifo_out1 : 1;
714 unsigned int fifo_in1_extra : 1;
715 unsigned int fifo_out1_extra : 1;
716 unsigned int trigger_grp0 : 1;
717 unsigned int trigger_grp1 : 1;
718 unsigned int trigger_grp2 : 1;
719 unsigned int trigger_grp3 : 1;
720 unsigned int trigger_grp4 : 1;
721 unsigned int trigger_grp5 : 1;
722 unsigned int trigger_grp6 : 1;
723 unsigned int trigger_grp7 : 1;
724 unsigned int timer_grp2 : 1;
725 unsigned int timer_grp3 : 1;
726} reg_iop_sw_cpu_rw_intr3_mask;
727#define REG_RD_ADDR_iop_sw_cpu_rw_intr3_mask 132
728#define REG_WR_ADDR_iop_sw_cpu_rw_intr3_mask 132
729
730/* Register rw_ack_intr3, scope iop_sw_cpu, type rw */
731typedef struct {
732 unsigned int mpu_16 : 1;
733 unsigned int mpu_17 : 1;
734 unsigned int mpu_18 : 1;
735 unsigned int mpu_19 : 1;
736 unsigned int mpu_20 : 1;
737 unsigned int mpu_21 : 1;
738 unsigned int mpu_22 : 1;
739 unsigned int mpu_23 : 1;
740 unsigned int spu1_0 : 1;
741 unsigned int spu1_1 : 1;
742 unsigned int spu1_2 : 1;
743 unsigned int spu1_3 : 1;
744 unsigned int spu1_4 : 1;
745 unsigned int spu1_5 : 1;
746 unsigned int spu1_6 : 1;
747 unsigned int spu1_7 : 1;
748 unsigned int dummy1 : 16;
749} reg_iop_sw_cpu_rw_ack_intr3;
750#define REG_RD_ADDR_iop_sw_cpu_rw_ack_intr3 136
751#define REG_WR_ADDR_iop_sw_cpu_rw_ack_intr3 136
752
753/* Register r_intr3, scope iop_sw_cpu, type r */
754typedef struct {
755 unsigned int mpu_16 : 1;
756 unsigned int mpu_17 : 1;
757 unsigned int mpu_18 : 1;
758 unsigned int mpu_19 : 1;
759 unsigned int mpu_20 : 1;
760 unsigned int mpu_21 : 1;
761 unsigned int mpu_22 : 1;
762 unsigned int mpu_23 : 1;
763 unsigned int spu1_0 : 1;
764 unsigned int spu1_1 : 1;
765 unsigned int spu1_2 : 1;
766 unsigned int spu1_3 : 1;
767 unsigned int spu1_4 : 1;
768 unsigned int spu1_5 : 1;
769 unsigned int spu1_6 : 1;
770 unsigned int spu1_7 : 1;
771 unsigned int dmc_in1 : 1;
772 unsigned int dmc_out1 : 1;
773 unsigned int fifo_in1 : 1;
774 unsigned int fifo_out1 : 1;
775 unsigned int fifo_in1_extra : 1;
776 unsigned int fifo_out1_extra : 1;
777 unsigned int trigger_grp0 : 1;
778 unsigned int trigger_grp1 : 1;
779 unsigned int trigger_grp2 : 1;
780 unsigned int trigger_grp3 : 1;
781 unsigned int trigger_grp4 : 1;
782 unsigned int trigger_grp5 : 1;
783 unsigned int trigger_grp6 : 1;
784 unsigned int trigger_grp7 : 1;
785 unsigned int timer_grp2 : 1;
786 unsigned int timer_grp3 : 1;
787} reg_iop_sw_cpu_r_intr3;
788#define REG_RD_ADDR_iop_sw_cpu_r_intr3 140
789
790/* Register r_masked_intr3, scope iop_sw_cpu, type r */
791typedef struct {
792 unsigned int mpu_16 : 1;
793 unsigned int mpu_17 : 1;
794 unsigned int mpu_18 : 1;
795 unsigned int mpu_19 : 1;
796 unsigned int mpu_20 : 1;
797 unsigned int mpu_21 : 1;
798 unsigned int mpu_22 : 1;
799 unsigned int mpu_23 : 1;
800 unsigned int spu1_0 : 1;
801 unsigned int spu1_1 : 1;
802 unsigned int spu1_2 : 1;
803 unsigned int spu1_3 : 1;
804 unsigned int spu1_4 : 1;
805 unsigned int spu1_5 : 1;
806 unsigned int spu1_6 : 1;
807 unsigned int spu1_7 : 1;
808 unsigned int dmc_in1 : 1;
809 unsigned int dmc_out1 : 1;
810 unsigned int fifo_in1 : 1;
811 unsigned int fifo_out1 : 1;
812 unsigned int fifo_in1_extra : 1;
813 unsigned int fifo_out1_extra : 1;
814 unsigned int trigger_grp0 : 1;
815 unsigned int trigger_grp1 : 1;
816 unsigned int trigger_grp2 : 1;
817 unsigned int trigger_grp3 : 1;
818 unsigned int trigger_grp4 : 1;
819 unsigned int trigger_grp5 : 1;
820 unsigned int trigger_grp6 : 1;
821 unsigned int trigger_grp7 : 1;
822 unsigned int timer_grp2 : 1;
823 unsigned int timer_grp3 : 1;
824} reg_iop_sw_cpu_r_masked_intr3;
825#define REG_RD_ADDR_iop_sw_cpu_r_masked_intr3 144
826
827
828/* Constants */
829enum {
830 regk_iop_sw_cpu_copy = 0x00000000,
831 regk_iop_sw_cpu_no = 0x00000000,
832 regk_iop_sw_cpu_rd = 0x00000002,
833 regk_iop_sw_cpu_reg_copy = 0x00000001,
834 regk_iop_sw_cpu_rw_bus0_clr_mask_default = 0x00000000,
835 regk_iop_sw_cpu_rw_bus0_oe_clr_mask_default = 0x00000000,
836 regk_iop_sw_cpu_rw_bus0_oe_set_mask_default = 0x00000000,
837 regk_iop_sw_cpu_rw_bus0_set_mask_default = 0x00000000,
838 regk_iop_sw_cpu_rw_bus1_clr_mask_default = 0x00000000,
839 regk_iop_sw_cpu_rw_bus1_oe_clr_mask_default = 0x00000000,
840 regk_iop_sw_cpu_rw_bus1_oe_set_mask_default = 0x00000000,
841 regk_iop_sw_cpu_rw_bus1_set_mask_default = 0x00000000,
842 regk_iop_sw_cpu_rw_gio_clr_mask_default = 0x00000000,
843 regk_iop_sw_cpu_rw_gio_oe_clr_mask_default = 0x00000000,
844 regk_iop_sw_cpu_rw_gio_oe_set_mask_default = 0x00000000,
845 regk_iop_sw_cpu_rw_gio_set_mask_default = 0x00000000,
846 regk_iop_sw_cpu_rw_intr0_mask_default = 0x00000000,
847 regk_iop_sw_cpu_rw_intr1_mask_default = 0x00000000,
848 regk_iop_sw_cpu_rw_intr2_mask_default = 0x00000000,
849 regk_iop_sw_cpu_rw_intr3_mask_default = 0x00000000,
850 regk_iop_sw_cpu_wr = 0x00000003,
851 regk_iop_sw_cpu_yes = 0x00000001
852};
853#endif /* __iop_sw_cpu_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sw_mpu_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_mpu_defs.h
new file mode 100644
index 000000000000..da718f2a8cad
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_mpu_defs.h
@@ -0,0 +1,893 @@
1#ifndef __iop_sw_mpu_defs_h
2#define __iop_sw_mpu_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_mpu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sw_mpu_defs.h ../../inst/io_proc/rtl/guinness/iop_sw_mpu.r
11 * id: $Id: iop_sw_mpu_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sw_mpu */
86
87/* Register rw_sw_cfg_owner, scope iop_sw_mpu, type rw */
88typedef struct {
89 unsigned int cfg : 2;
90 unsigned int dummy1 : 30;
91} reg_iop_sw_mpu_rw_sw_cfg_owner;
92#define REG_RD_ADDR_iop_sw_mpu_rw_sw_cfg_owner 0
93#define REG_WR_ADDR_iop_sw_mpu_rw_sw_cfg_owner 0
94
95/* Register rw_mc_ctrl, scope iop_sw_mpu, type rw */
96typedef struct {
97 unsigned int keep_owner : 1;
98 unsigned int cmd : 2;
99 unsigned int size : 3;
100 unsigned int wr_spu0_mem : 1;
101 unsigned int wr_spu1_mem : 1;
102 unsigned int dummy1 : 24;
103} reg_iop_sw_mpu_rw_mc_ctrl;
104#define REG_RD_ADDR_iop_sw_mpu_rw_mc_ctrl 4
105#define REG_WR_ADDR_iop_sw_mpu_rw_mc_ctrl 4
106
107/* Register rw_mc_data, scope iop_sw_mpu, type rw */
108typedef struct {
109 unsigned int val : 32;
110} reg_iop_sw_mpu_rw_mc_data;
111#define REG_RD_ADDR_iop_sw_mpu_rw_mc_data 8
112#define REG_WR_ADDR_iop_sw_mpu_rw_mc_data 8
113
114/* Register rw_mc_addr, scope iop_sw_mpu, type rw */
115typedef unsigned int reg_iop_sw_mpu_rw_mc_addr;
116#define REG_RD_ADDR_iop_sw_mpu_rw_mc_addr 12
117#define REG_WR_ADDR_iop_sw_mpu_rw_mc_addr 12
118
119/* Register rs_mc_data, scope iop_sw_mpu, type rs */
120typedef unsigned int reg_iop_sw_mpu_rs_mc_data;
121#define REG_RD_ADDR_iop_sw_mpu_rs_mc_data 16
122
123/* Register r_mc_data, scope iop_sw_mpu, type r */
124typedef unsigned int reg_iop_sw_mpu_r_mc_data;
125#define REG_RD_ADDR_iop_sw_mpu_r_mc_data 20
126
127/* Register r_mc_stat, scope iop_sw_mpu, type r */
128typedef struct {
129 unsigned int busy_cpu : 1;
130 unsigned int busy_mpu : 1;
131 unsigned int busy_spu0 : 1;
132 unsigned int busy_spu1 : 1;
133 unsigned int owned_by_cpu : 1;
134 unsigned int owned_by_mpu : 1;
135 unsigned int owned_by_spu0 : 1;
136 unsigned int owned_by_spu1 : 1;
137 unsigned int dummy1 : 24;
138} reg_iop_sw_mpu_r_mc_stat;
139#define REG_RD_ADDR_iop_sw_mpu_r_mc_stat 24
140
141/* Register rw_bus0_clr_mask, scope iop_sw_mpu, type rw */
142typedef struct {
143 unsigned int byte0 : 8;
144 unsigned int byte1 : 8;
145 unsigned int byte2 : 8;
146 unsigned int byte3 : 8;
147} reg_iop_sw_mpu_rw_bus0_clr_mask;
148#define REG_RD_ADDR_iop_sw_mpu_rw_bus0_clr_mask 28
149#define REG_WR_ADDR_iop_sw_mpu_rw_bus0_clr_mask 28
150
151/* Register rw_bus0_set_mask, scope iop_sw_mpu, type rw */
152typedef struct {
153 unsigned int byte0 : 8;
154 unsigned int byte1 : 8;
155 unsigned int byte2 : 8;
156 unsigned int byte3 : 8;
157} reg_iop_sw_mpu_rw_bus0_set_mask;
158#define REG_RD_ADDR_iop_sw_mpu_rw_bus0_set_mask 32
159#define REG_WR_ADDR_iop_sw_mpu_rw_bus0_set_mask 32
160
161/* Register rw_bus0_oe_clr_mask, scope iop_sw_mpu, type rw */
162typedef struct {
163 unsigned int byte0 : 1;
164 unsigned int byte1 : 1;
165 unsigned int byte2 : 1;
166 unsigned int byte3 : 1;
167 unsigned int dummy1 : 28;
168} reg_iop_sw_mpu_rw_bus0_oe_clr_mask;
169#define REG_RD_ADDR_iop_sw_mpu_rw_bus0_oe_clr_mask 36
170#define REG_WR_ADDR_iop_sw_mpu_rw_bus0_oe_clr_mask 36
171
172/* Register rw_bus0_oe_set_mask, scope iop_sw_mpu, type rw */
173typedef struct {
174 unsigned int byte0 : 1;
175 unsigned int byte1 : 1;
176 unsigned int byte2 : 1;
177 unsigned int byte3 : 1;
178 unsigned int dummy1 : 28;
179} reg_iop_sw_mpu_rw_bus0_oe_set_mask;
180#define REG_RD_ADDR_iop_sw_mpu_rw_bus0_oe_set_mask 40
181#define REG_WR_ADDR_iop_sw_mpu_rw_bus0_oe_set_mask 40
182
183/* Register r_bus0_in, scope iop_sw_mpu, type r */
184typedef unsigned int reg_iop_sw_mpu_r_bus0_in;
185#define REG_RD_ADDR_iop_sw_mpu_r_bus0_in 44
186
187/* Register rw_bus1_clr_mask, scope iop_sw_mpu, type rw */
188typedef struct {
189 unsigned int byte0 : 8;
190 unsigned int byte1 : 8;
191 unsigned int byte2 : 8;
192 unsigned int byte3 : 8;
193} reg_iop_sw_mpu_rw_bus1_clr_mask;
194#define REG_RD_ADDR_iop_sw_mpu_rw_bus1_clr_mask 48
195#define REG_WR_ADDR_iop_sw_mpu_rw_bus1_clr_mask 48
196
197/* Register rw_bus1_set_mask, scope iop_sw_mpu, type rw */
198typedef struct {
199 unsigned int byte0 : 8;
200 unsigned int byte1 : 8;
201 unsigned int byte2 : 8;
202 unsigned int byte3 : 8;
203} reg_iop_sw_mpu_rw_bus1_set_mask;
204#define REG_RD_ADDR_iop_sw_mpu_rw_bus1_set_mask 52
205#define REG_WR_ADDR_iop_sw_mpu_rw_bus1_set_mask 52
206
207/* Register rw_bus1_oe_clr_mask, scope iop_sw_mpu, type rw */
208typedef struct {
209 unsigned int byte0 : 1;
210 unsigned int byte1 : 1;
211 unsigned int byte2 : 1;
212 unsigned int byte3 : 1;
213 unsigned int dummy1 : 28;
214} reg_iop_sw_mpu_rw_bus1_oe_clr_mask;
215#define REG_RD_ADDR_iop_sw_mpu_rw_bus1_oe_clr_mask 56
216#define REG_WR_ADDR_iop_sw_mpu_rw_bus1_oe_clr_mask 56
217
218/* Register rw_bus1_oe_set_mask, scope iop_sw_mpu, type rw */
219typedef struct {
220 unsigned int byte0 : 1;
221 unsigned int byte1 : 1;
222 unsigned int byte2 : 1;
223 unsigned int byte3 : 1;
224 unsigned int dummy1 : 28;
225} reg_iop_sw_mpu_rw_bus1_oe_set_mask;
226#define REG_RD_ADDR_iop_sw_mpu_rw_bus1_oe_set_mask 60
227#define REG_WR_ADDR_iop_sw_mpu_rw_bus1_oe_set_mask 60
228
229/* Register r_bus1_in, scope iop_sw_mpu, type r */
230typedef unsigned int reg_iop_sw_mpu_r_bus1_in;
231#define REG_RD_ADDR_iop_sw_mpu_r_bus1_in 64
232
233/* Register rw_gio_clr_mask, scope iop_sw_mpu, type rw */
234typedef struct {
235 unsigned int val : 32;
236} reg_iop_sw_mpu_rw_gio_clr_mask;
237#define REG_RD_ADDR_iop_sw_mpu_rw_gio_clr_mask 68
238#define REG_WR_ADDR_iop_sw_mpu_rw_gio_clr_mask 68
239
240/* Register rw_gio_set_mask, scope iop_sw_mpu, type rw */
241typedef struct {
242 unsigned int val : 32;
243} reg_iop_sw_mpu_rw_gio_set_mask;
244#define REG_RD_ADDR_iop_sw_mpu_rw_gio_set_mask 72
245#define REG_WR_ADDR_iop_sw_mpu_rw_gio_set_mask 72
246
247/* Register rw_gio_oe_clr_mask, scope iop_sw_mpu, type rw */
248typedef struct {
249 unsigned int val : 32;
250} reg_iop_sw_mpu_rw_gio_oe_clr_mask;
251#define REG_RD_ADDR_iop_sw_mpu_rw_gio_oe_clr_mask 76
252#define REG_WR_ADDR_iop_sw_mpu_rw_gio_oe_clr_mask 76
253
254/* Register rw_gio_oe_set_mask, scope iop_sw_mpu, type rw */
255typedef struct {
256 unsigned int val : 32;
257} reg_iop_sw_mpu_rw_gio_oe_set_mask;
258#define REG_RD_ADDR_iop_sw_mpu_rw_gio_oe_set_mask 80
259#define REG_WR_ADDR_iop_sw_mpu_rw_gio_oe_set_mask 80
260
261/* Register r_gio_in, scope iop_sw_mpu, type r */
262typedef unsigned int reg_iop_sw_mpu_r_gio_in;
263#define REG_RD_ADDR_iop_sw_mpu_r_gio_in 84
264
265/* Register rw_cpu_intr, scope iop_sw_mpu, type rw */
266typedef struct {
267 unsigned int intr0 : 1;
268 unsigned int intr1 : 1;
269 unsigned int intr2 : 1;
270 unsigned int intr3 : 1;
271 unsigned int intr4 : 1;
272 unsigned int intr5 : 1;
273 unsigned int intr6 : 1;
274 unsigned int intr7 : 1;
275 unsigned int intr8 : 1;
276 unsigned int intr9 : 1;
277 unsigned int intr10 : 1;
278 unsigned int intr11 : 1;
279 unsigned int intr12 : 1;
280 unsigned int intr13 : 1;
281 unsigned int intr14 : 1;
282 unsigned int intr15 : 1;
283 unsigned int intr16 : 1;
284 unsigned int intr17 : 1;
285 unsigned int intr18 : 1;
286 unsigned int intr19 : 1;
287 unsigned int intr20 : 1;
288 unsigned int intr21 : 1;
289 unsigned int intr22 : 1;
290 unsigned int intr23 : 1;
291 unsigned int intr24 : 1;
292 unsigned int intr25 : 1;
293 unsigned int intr26 : 1;
294 unsigned int intr27 : 1;
295 unsigned int intr28 : 1;
296 unsigned int intr29 : 1;
297 unsigned int intr30 : 1;
298 unsigned int intr31 : 1;
299} reg_iop_sw_mpu_rw_cpu_intr;
300#define REG_RD_ADDR_iop_sw_mpu_rw_cpu_intr 88
301#define REG_WR_ADDR_iop_sw_mpu_rw_cpu_intr 88
302
303/* Register r_cpu_intr, scope iop_sw_mpu, type r */
304typedef struct {
305 unsigned int intr0 : 1;
306 unsigned int intr1 : 1;
307 unsigned int intr2 : 1;
308 unsigned int intr3 : 1;
309 unsigned int intr4 : 1;
310 unsigned int intr5 : 1;
311 unsigned int intr6 : 1;
312 unsigned int intr7 : 1;
313 unsigned int intr8 : 1;
314 unsigned int intr9 : 1;
315 unsigned int intr10 : 1;
316 unsigned int intr11 : 1;
317 unsigned int intr12 : 1;
318 unsigned int intr13 : 1;
319 unsigned int intr14 : 1;
320 unsigned int intr15 : 1;
321 unsigned int intr16 : 1;
322 unsigned int intr17 : 1;
323 unsigned int intr18 : 1;
324 unsigned int intr19 : 1;
325 unsigned int intr20 : 1;
326 unsigned int intr21 : 1;
327 unsigned int intr22 : 1;
328 unsigned int intr23 : 1;
329 unsigned int intr24 : 1;
330 unsigned int intr25 : 1;
331 unsigned int intr26 : 1;
332 unsigned int intr27 : 1;
333 unsigned int intr28 : 1;
334 unsigned int intr29 : 1;
335 unsigned int intr30 : 1;
336 unsigned int intr31 : 1;
337} reg_iop_sw_mpu_r_cpu_intr;
338#define REG_RD_ADDR_iop_sw_mpu_r_cpu_intr 92
339
340/* Register rw_intr_grp0_mask, scope iop_sw_mpu, type rw */
341typedef struct {
342 unsigned int spu0_intr0 : 1;
343 unsigned int spu1_intr0 : 1;
344 unsigned int trigger_grp0 : 1;
345 unsigned int trigger_grp4 : 1;
346 unsigned int timer_grp0 : 1;
347 unsigned int fifo_out0 : 1;
348 unsigned int fifo_out0_extra : 1;
349 unsigned int dmc_out0 : 1;
350 unsigned int spu0_intr1 : 1;
351 unsigned int spu1_intr1 : 1;
352 unsigned int trigger_grp1 : 1;
353 unsigned int trigger_grp5 : 1;
354 unsigned int timer_grp1 : 1;
355 unsigned int fifo_in0 : 1;
356 unsigned int fifo_in0_extra : 1;
357 unsigned int dmc_in0 : 1;
358 unsigned int spu0_intr2 : 1;
359 unsigned int spu1_intr2 : 1;
360 unsigned int trigger_grp2 : 1;
361 unsigned int trigger_grp6 : 1;
362 unsigned int timer_grp2 : 1;
363 unsigned int fifo_out1 : 1;
364 unsigned int fifo_out1_extra : 1;
365 unsigned int dmc_out1 : 1;
366 unsigned int spu0_intr3 : 1;
367 unsigned int spu1_intr3 : 1;
368 unsigned int trigger_grp3 : 1;
369 unsigned int trigger_grp7 : 1;
370 unsigned int timer_grp3 : 1;
371 unsigned int fifo_in1 : 1;
372 unsigned int fifo_in1_extra : 1;
373 unsigned int dmc_in1 : 1;
374} reg_iop_sw_mpu_rw_intr_grp0_mask;
375#define REG_RD_ADDR_iop_sw_mpu_rw_intr_grp0_mask 96
376#define REG_WR_ADDR_iop_sw_mpu_rw_intr_grp0_mask 96
377
378/* Register rw_ack_intr_grp0, scope iop_sw_mpu, type rw */
379typedef struct {
380 unsigned int spu0_intr0 : 1;
381 unsigned int spu1_intr0 : 1;
382 unsigned int dummy1 : 6;
383 unsigned int spu0_intr1 : 1;
384 unsigned int spu1_intr1 : 1;
385 unsigned int dummy2 : 6;
386 unsigned int spu0_intr2 : 1;
387 unsigned int spu1_intr2 : 1;
388 unsigned int dummy3 : 6;
389 unsigned int spu0_intr3 : 1;
390 unsigned int spu1_intr3 : 1;
391 unsigned int dummy4 : 6;
392} reg_iop_sw_mpu_rw_ack_intr_grp0;
393#define REG_RD_ADDR_iop_sw_mpu_rw_ack_intr_grp0 100
394#define REG_WR_ADDR_iop_sw_mpu_rw_ack_intr_grp0 100
395
396/* Register r_intr_grp0, scope iop_sw_mpu, type r */
397typedef struct {
398 unsigned int spu0_intr0 : 1;
399 unsigned int spu1_intr0 : 1;
400 unsigned int trigger_grp0 : 1;
401 unsigned int trigger_grp4 : 1;
402 unsigned int timer_grp0 : 1;
403 unsigned int fifo_out0 : 1;
404 unsigned int fifo_out0_extra : 1;
405 unsigned int dmc_out0 : 1;
406 unsigned int spu0_intr1 : 1;
407 unsigned int spu1_intr1 : 1;
408 unsigned int trigger_grp1 : 1;
409 unsigned int trigger_grp5 : 1;
410 unsigned int timer_grp1 : 1;
411 unsigned int fifo_in0 : 1;
412 unsigned int fifo_in0_extra : 1;
413 unsigned int dmc_in0 : 1;
414 unsigned int spu0_intr2 : 1;
415 unsigned int spu1_intr2 : 1;
416 unsigned int trigger_grp2 : 1;
417 unsigned int trigger_grp6 : 1;
418 unsigned int timer_grp2 : 1;
419 unsigned int fifo_out1 : 1;
420 unsigned int fifo_out1_extra : 1;
421 unsigned int dmc_out1 : 1;
422 unsigned int spu0_intr3 : 1;
423 unsigned int spu1_intr3 : 1;
424 unsigned int trigger_grp3 : 1;
425 unsigned int trigger_grp7 : 1;
426 unsigned int timer_grp3 : 1;
427 unsigned int fifo_in1 : 1;
428 unsigned int fifo_in1_extra : 1;
429 unsigned int dmc_in1 : 1;
430} reg_iop_sw_mpu_r_intr_grp0;
431#define REG_RD_ADDR_iop_sw_mpu_r_intr_grp0 104
432
433/* Register r_masked_intr_grp0, scope iop_sw_mpu, type r */
434typedef struct {
435 unsigned int spu0_intr0 : 1;
436 unsigned int spu1_intr0 : 1;
437 unsigned int trigger_grp0 : 1;
438 unsigned int trigger_grp4 : 1;
439 unsigned int timer_grp0 : 1;
440 unsigned int fifo_out0 : 1;
441 unsigned int fifo_out0_extra : 1;
442 unsigned int dmc_out0 : 1;
443 unsigned int spu0_intr1 : 1;
444 unsigned int spu1_intr1 : 1;
445 unsigned int trigger_grp1 : 1;
446 unsigned int trigger_grp5 : 1;
447 unsigned int timer_grp1 : 1;
448 unsigned int fifo_in0 : 1;
449 unsigned int fifo_in0_extra : 1;
450 unsigned int dmc_in0 : 1;
451 unsigned int spu0_intr2 : 1;
452 unsigned int spu1_intr2 : 1;
453 unsigned int trigger_grp2 : 1;
454 unsigned int trigger_grp6 : 1;
455 unsigned int timer_grp2 : 1;
456 unsigned int fifo_out1 : 1;
457 unsigned int fifo_out1_extra : 1;
458 unsigned int dmc_out1 : 1;
459 unsigned int spu0_intr3 : 1;
460 unsigned int spu1_intr3 : 1;
461 unsigned int trigger_grp3 : 1;
462 unsigned int trigger_grp7 : 1;
463 unsigned int timer_grp3 : 1;
464 unsigned int fifo_in1 : 1;
465 unsigned int fifo_in1_extra : 1;
466 unsigned int dmc_in1 : 1;
467} reg_iop_sw_mpu_r_masked_intr_grp0;
468#define REG_RD_ADDR_iop_sw_mpu_r_masked_intr_grp0 108
469
470/* Register rw_intr_grp1_mask, scope iop_sw_mpu, type rw */
471typedef struct {
472 unsigned int spu0_intr4 : 1;
473 unsigned int spu1_intr4 : 1;
474 unsigned int trigger_grp0 : 1;
475 unsigned int trigger_grp5 : 1;
476 unsigned int timer_grp0 : 1;
477 unsigned int fifo_in0 : 1;
478 unsigned int fifo_in0_extra : 1;
479 unsigned int dmc_out0 : 1;
480 unsigned int spu0_intr5 : 1;
481 unsigned int spu1_intr5 : 1;
482 unsigned int trigger_grp1 : 1;
483 unsigned int trigger_grp6 : 1;
484 unsigned int timer_grp1 : 1;
485 unsigned int fifo_out1 : 1;
486 unsigned int fifo_out0_extra : 1;
487 unsigned int dmc_in0 : 1;
488 unsigned int spu0_intr6 : 1;
489 unsigned int spu1_intr6 : 1;
490 unsigned int trigger_grp2 : 1;
491 unsigned int trigger_grp7 : 1;
492 unsigned int timer_grp2 : 1;
493 unsigned int fifo_in1 : 1;
494 unsigned int fifo_in1_extra : 1;
495 unsigned int dmc_out1 : 1;
496 unsigned int spu0_intr7 : 1;
497 unsigned int spu1_intr7 : 1;
498 unsigned int trigger_grp3 : 1;
499 unsigned int trigger_grp4 : 1;
500 unsigned int timer_grp3 : 1;
501 unsigned int fifo_out0 : 1;
502 unsigned int fifo_out1_extra : 1;
503 unsigned int dmc_in1 : 1;
504} reg_iop_sw_mpu_rw_intr_grp1_mask;
505#define REG_RD_ADDR_iop_sw_mpu_rw_intr_grp1_mask 112
506#define REG_WR_ADDR_iop_sw_mpu_rw_intr_grp1_mask 112
507
508/* Register rw_ack_intr_grp1, scope iop_sw_mpu, type rw */
509typedef struct {
510 unsigned int spu0_intr4 : 1;
511 unsigned int spu1_intr4 : 1;
512 unsigned int dummy1 : 6;
513 unsigned int spu0_intr5 : 1;
514 unsigned int spu1_intr5 : 1;
515 unsigned int dummy2 : 6;
516 unsigned int spu0_intr6 : 1;
517 unsigned int spu1_intr6 : 1;
518 unsigned int dummy3 : 6;
519 unsigned int spu0_intr7 : 1;
520 unsigned int spu1_intr7 : 1;
521 unsigned int dummy4 : 6;
522} reg_iop_sw_mpu_rw_ack_intr_grp1;
523#define REG_RD_ADDR_iop_sw_mpu_rw_ack_intr_grp1 116
524#define REG_WR_ADDR_iop_sw_mpu_rw_ack_intr_grp1 116
525
526/* Register r_intr_grp1, scope iop_sw_mpu, type r */
527typedef struct {
528 unsigned int spu0_intr4 : 1;
529 unsigned int spu1_intr4 : 1;
530 unsigned int trigger_grp0 : 1;
531 unsigned int trigger_grp5 : 1;
532 unsigned int timer_grp0 : 1;
533 unsigned int fifo_in0 : 1;
534 unsigned int fifo_in0_extra : 1;
535 unsigned int dmc_out0 : 1;
536 unsigned int spu0_intr5 : 1;
537 unsigned int spu1_intr5 : 1;
538 unsigned int trigger_grp1 : 1;
539 unsigned int trigger_grp6 : 1;
540 unsigned int timer_grp1 : 1;
541 unsigned int fifo_out1 : 1;
542 unsigned int fifo_out0_extra : 1;
543 unsigned int dmc_in0 : 1;
544 unsigned int spu0_intr6 : 1;
545 unsigned int spu1_intr6 : 1;
546 unsigned int trigger_grp2 : 1;
547 unsigned int trigger_grp7 : 1;
548 unsigned int timer_grp2 : 1;
549 unsigned int fifo_in1 : 1;
550 unsigned int fifo_in1_extra : 1;
551 unsigned int dmc_out1 : 1;
552 unsigned int spu0_intr7 : 1;
553 unsigned int spu1_intr7 : 1;
554 unsigned int trigger_grp3 : 1;
555 unsigned int trigger_grp4 : 1;
556 unsigned int timer_grp3 : 1;
557 unsigned int fifo_out0 : 1;
558 unsigned int fifo_out1_extra : 1;
559 unsigned int dmc_in1 : 1;
560} reg_iop_sw_mpu_r_intr_grp1;
561#define REG_RD_ADDR_iop_sw_mpu_r_intr_grp1 120
562
563/* Register r_masked_intr_grp1, scope iop_sw_mpu, type r */
564typedef struct {
565 unsigned int spu0_intr4 : 1;
566 unsigned int spu1_intr4 : 1;
567 unsigned int trigger_grp0 : 1;
568 unsigned int trigger_grp5 : 1;
569 unsigned int timer_grp0 : 1;
570 unsigned int fifo_in0 : 1;
571 unsigned int fifo_in0_extra : 1;
572 unsigned int dmc_out0 : 1;
573 unsigned int spu0_intr5 : 1;
574 unsigned int spu1_intr5 : 1;
575 unsigned int trigger_grp1 : 1;
576 unsigned int trigger_grp6 : 1;
577 unsigned int timer_grp1 : 1;
578 unsigned int fifo_out1 : 1;
579 unsigned int fifo_out0_extra : 1;
580 unsigned int dmc_in0 : 1;
581 unsigned int spu0_intr6 : 1;
582 unsigned int spu1_intr6 : 1;
583 unsigned int trigger_grp2 : 1;
584 unsigned int trigger_grp7 : 1;
585 unsigned int timer_grp2 : 1;
586 unsigned int fifo_in1 : 1;
587 unsigned int fifo_in1_extra : 1;
588 unsigned int dmc_out1 : 1;
589 unsigned int spu0_intr7 : 1;
590 unsigned int spu1_intr7 : 1;
591 unsigned int trigger_grp3 : 1;
592 unsigned int trigger_grp4 : 1;
593 unsigned int timer_grp3 : 1;
594 unsigned int fifo_out0 : 1;
595 unsigned int fifo_out1_extra : 1;
596 unsigned int dmc_in1 : 1;
597} reg_iop_sw_mpu_r_masked_intr_grp1;
598#define REG_RD_ADDR_iop_sw_mpu_r_masked_intr_grp1 124
599
600/* Register rw_intr_grp2_mask, scope iop_sw_mpu, type rw */
601typedef struct {
602 unsigned int spu0_intr8 : 1;
603 unsigned int spu1_intr8 : 1;
604 unsigned int trigger_grp0 : 1;
605 unsigned int trigger_grp6 : 1;
606 unsigned int timer_grp0 : 1;
607 unsigned int fifo_out1 : 1;
608 unsigned int fifo_out1_extra : 1;
609 unsigned int dmc_out0 : 1;
610 unsigned int spu0_intr9 : 1;
611 unsigned int spu1_intr9 : 1;
612 unsigned int trigger_grp1 : 1;
613 unsigned int trigger_grp7 : 1;
614 unsigned int timer_grp1 : 1;
615 unsigned int fifo_in1 : 1;
616 unsigned int fifo_in1_extra : 1;
617 unsigned int dmc_in0 : 1;
618 unsigned int spu0_intr10 : 1;
619 unsigned int spu1_intr10 : 1;
620 unsigned int trigger_grp2 : 1;
621 unsigned int trigger_grp4 : 1;
622 unsigned int timer_grp2 : 1;
623 unsigned int fifo_out0 : 1;
624 unsigned int fifo_out0_extra : 1;
625 unsigned int dmc_out1 : 1;
626 unsigned int spu0_intr11 : 1;
627 unsigned int spu1_intr11 : 1;
628 unsigned int trigger_grp3 : 1;
629 unsigned int trigger_grp5 : 1;
630 unsigned int timer_grp3 : 1;
631 unsigned int fifo_in0 : 1;
632 unsigned int fifo_in0_extra : 1;
633 unsigned int dmc_in1 : 1;
634} reg_iop_sw_mpu_rw_intr_grp2_mask;
635#define REG_RD_ADDR_iop_sw_mpu_rw_intr_grp2_mask 128
636#define REG_WR_ADDR_iop_sw_mpu_rw_intr_grp2_mask 128
637
638/* Register rw_ack_intr_grp2, scope iop_sw_mpu, type rw */
639typedef struct {
640 unsigned int spu0_intr8 : 1;
641 unsigned int spu1_intr8 : 1;
642 unsigned int dummy1 : 6;
643 unsigned int spu0_intr9 : 1;
644 unsigned int spu1_intr9 : 1;
645 unsigned int dummy2 : 6;
646 unsigned int spu0_intr10 : 1;
647 unsigned int spu1_intr10 : 1;
648 unsigned int dummy3 : 6;
649 unsigned int spu0_intr11 : 1;
650 unsigned int spu1_intr11 : 1;
651 unsigned int dummy4 : 6;
652} reg_iop_sw_mpu_rw_ack_intr_grp2;
653#define REG_RD_ADDR_iop_sw_mpu_rw_ack_intr_grp2 132
654#define REG_WR_ADDR_iop_sw_mpu_rw_ack_intr_grp2 132
655
656/* Register r_intr_grp2, scope iop_sw_mpu, type r */
657typedef struct {
658 unsigned int spu0_intr8 : 1;
659 unsigned int spu1_intr8 : 1;
660 unsigned int trigger_grp0 : 1;
661 unsigned int trigger_grp6 : 1;
662 unsigned int timer_grp0 : 1;
663 unsigned int fifo_out1 : 1;
664 unsigned int fifo_out1_extra : 1;
665 unsigned int dmc_out0 : 1;
666 unsigned int spu0_intr9 : 1;
667 unsigned int spu1_intr9 : 1;
668 unsigned int trigger_grp1 : 1;
669 unsigned int trigger_grp7 : 1;
670 unsigned int timer_grp1 : 1;
671 unsigned int fifo_in1 : 1;
672 unsigned int fifo_in1_extra : 1;
673 unsigned int dmc_in0 : 1;
674 unsigned int spu0_intr10 : 1;
675 unsigned int spu1_intr10 : 1;
676 unsigned int trigger_grp2 : 1;
677 unsigned int trigger_grp4 : 1;
678 unsigned int timer_grp2 : 1;
679 unsigned int fifo_out0 : 1;
680 unsigned int fifo_out0_extra : 1;
681 unsigned int dmc_out1 : 1;
682 unsigned int spu0_intr11 : 1;
683 unsigned int spu1_intr11 : 1;
684 unsigned int trigger_grp3 : 1;
685 unsigned int trigger_grp5 : 1;
686 unsigned int timer_grp3 : 1;
687 unsigned int fifo_in0 : 1;
688 unsigned int fifo_in0_extra : 1;
689 unsigned int dmc_in1 : 1;
690} reg_iop_sw_mpu_r_intr_grp2;
691#define REG_RD_ADDR_iop_sw_mpu_r_intr_grp2 136
692
693/* Register r_masked_intr_grp2, scope iop_sw_mpu, type r */
694typedef struct {
695 unsigned int spu0_intr8 : 1;
696 unsigned int spu1_intr8 : 1;
697 unsigned int trigger_grp0 : 1;
698 unsigned int trigger_grp6 : 1;
699 unsigned int timer_grp0 : 1;
700 unsigned int fifo_out1 : 1;
701 unsigned int fifo_out1_extra : 1;
702 unsigned int dmc_out0 : 1;
703 unsigned int spu0_intr9 : 1;
704 unsigned int spu1_intr9 : 1;
705 unsigned int trigger_grp1 : 1;
706 unsigned int trigger_grp7 : 1;
707 unsigned int timer_grp1 : 1;
708 unsigned int fifo_in1 : 1;
709 unsigned int fifo_in1_extra : 1;
710 unsigned int dmc_in0 : 1;
711 unsigned int spu0_intr10 : 1;
712 unsigned int spu1_intr10 : 1;
713 unsigned int trigger_grp2 : 1;
714 unsigned int trigger_grp4 : 1;
715 unsigned int timer_grp2 : 1;
716 unsigned int fifo_out0 : 1;
717 unsigned int fifo_out0_extra : 1;
718 unsigned int dmc_out1 : 1;
719 unsigned int spu0_intr11 : 1;
720 unsigned int spu1_intr11 : 1;
721 unsigned int trigger_grp3 : 1;
722 unsigned int trigger_grp5 : 1;
723 unsigned int timer_grp3 : 1;
724 unsigned int fifo_in0 : 1;
725 unsigned int fifo_in0_extra : 1;
726 unsigned int dmc_in1 : 1;
727} reg_iop_sw_mpu_r_masked_intr_grp2;
728#define REG_RD_ADDR_iop_sw_mpu_r_masked_intr_grp2 140
729
730/* Register rw_intr_grp3_mask, scope iop_sw_mpu, type rw */
731typedef struct {
732 unsigned int spu0_intr12 : 1;
733 unsigned int spu1_intr12 : 1;
734 unsigned int trigger_grp0 : 1;
735 unsigned int trigger_grp7 : 1;
736 unsigned int timer_grp0 : 1;
737 unsigned int fifo_in1 : 1;
738 unsigned int fifo_in1_extra : 1;
739 unsigned int dmc_out0 : 1;
740 unsigned int spu0_intr13 : 1;
741 unsigned int spu1_intr13 : 1;
742 unsigned int trigger_grp1 : 1;
743 unsigned int trigger_grp4 : 1;
744 unsigned int timer_grp1 : 1;
745 unsigned int fifo_out0 : 1;
746 unsigned int fifo_out0_extra : 1;
747 unsigned int dmc_in0 : 1;
748 unsigned int spu0_intr14 : 1;
749 unsigned int spu1_intr14 : 1;
750 unsigned int trigger_grp2 : 1;
751 unsigned int trigger_grp5 : 1;
752 unsigned int timer_grp2 : 1;
753 unsigned int fifo_in0 : 1;
754 unsigned int fifo_in0_extra : 1;
755 unsigned int dmc_out1 : 1;
756 unsigned int spu0_intr15 : 1;
757 unsigned int spu1_intr15 : 1;
758 unsigned int trigger_grp3 : 1;
759 unsigned int trigger_grp6 : 1;
760 unsigned int timer_grp3 : 1;
761 unsigned int fifo_out1 : 1;
762 unsigned int fifo_out1_extra : 1;
763 unsigned int dmc_in1 : 1;
764} reg_iop_sw_mpu_rw_intr_grp3_mask;
765#define REG_RD_ADDR_iop_sw_mpu_rw_intr_grp3_mask 144
766#define REG_WR_ADDR_iop_sw_mpu_rw_intr_grp3_mask 144
767
768/* Register rw_ack_intr_grp3, scope iop_sw_mpu, type rw */
769typedef struct {
770 unsigned int spu0_intr12 : 1;
771 unsigned int spu1_intr12 : 1;
772 unsigned int dummy1 : 6;
773 unsigned int spu0_intr13 : 1;
774 unsigned int spu1_intr13 : 1;
775 unsigned int dummy2 : 6;
776 unsigned int spu0_intr14 : 1;
777 unsigned int spu1_intr14 : 1;
778 unsigned int dummy3 : 6;
779 unsigned int spu0_intr15 : 1;
780 unsigned int spu1_intr15 : 1;
781 unsigned int dummy4 : 6;
782} reg_iop_sw_mpu_rw_ack_intr_grp3;
783#define REG_RD_ADDR_iop_sw_mpu_rw_ack_intr_grp3 148
784#define REG_WR_ADDR_iop_sw_mpu_rw_ack_intr_grp3 148
785
786/* Register r_intr_grp3, scope iop_sw_mpu, type r */
787typedef struct {
788 unsigned int spu0_intr12 : 1;
789 unsigned int spu1_intr12 : 1;
790 unsigned int trigger_grp0 : 1;
791 unsigned int trigger_grp7 : 1;
792 unsigned int timer_grp0 : 1;
793 unsigned int fifo_in1 : 1;
794 unsigned int fifo_in1_extra : 1;
795 unsigned int dmc_out0 : 1;
796 unsigned int spu0_intr13 : 1;
797 unsigned int spu1_intr13 : 1;
798 unsigned int trigger_grp1 : 1;
799 unsigned int trigger_grp4 : 1;
800 unsigned int timer_grp1 : 1;
801 unsigned int fifo_out0 : 1;
802 unsigned int fifo_out0_extra : 1;
803 unsigned int dmc_in0 : 1;
804 unsigned int spu0_intr14 : 1;
805 unsigned int spu1_intr14 : 1;
806 unsigned int trigger_grp2 : 1;
807 unsigned int trigger_grp5 : 1;
808 unsigned int timer_grp2 : 1;
809 unsigned int fifo_in0 : 1;
810 unsigned int fifo_in0_extra : 1;
811 unsigned int dmc_out1 : 1;
812 unsigned int spu0_intr15 : 1;
813 unsigned int spu1_intr15 : 1;
814 unsigned int trigger_grp3 : 1;
815 unsigned int trigger_grp6 : 1;
816 unsigned int timer_grp3 : 1;
817 unsigned int fifo_out1 : 1;
818 unsigned int fifo_out1_extra : 1;
819 unsigned int dmc_in1 : 1;
820} reg_iop_sw_mpu_r_intr_grp3;
821#define REG_RD_ADDR_iop_sw_mpu_r_intr_grp3 152
822
823/* Register r_masked_intr_grp3, scope iop_sw_mpu, type r */
824typedef struct {
825 unsigned int spu0_intr12 : 1;
826 unsigned int spu1_intr12 : 1;
827 unsigned int trigger_grp0 : 1;
828 unsigned int trigger_grp7 : 1;
829 unsigned int timer_grp0 : 1;
830 unsigned int fifo_in1 : 1;
831 unsigned int fifo_in1_extra : 1;
832 unsigned int dmc_out0 : 1;
833 unsigned int spu0_intr13 : 1;
834 unsigned int spu1_intr13 : 1;
835 unsigned int trigger_grp1 : 1;
836 unsigned int trigger_grp4 : 1;
837 unsigned int timer_grp1 : 1;
838 unsigned int fifo_out0 : 1;
839 unsigned int fifo_out0_extra : 1;
840 unsigned int dmc_in0 : 1;
841 unsigned int spu0_intr14 : 1;
842 unsigned int spu1_intr14 : 1;
843 unsigned int trigger_grp2 : 1;
844 unsigned int trigger_grp5 : 1;
845 unsigned int timer_grp2 : 1;
846 unsigned int fifo_in0 : 1;
847 unsigned int fifo_in0_extra : 1;
848 unsigned int dmc_out1 : 1;
849 unsigned int spu0_intr15 : 1;
850 unsigned int spu1_intr15 : 1;
851 unsigned int trigger_grp3 : 1;
852 unsigned int trigger_grp6 : 1;
853 unsigned int timer_grp3 : 1;
854 unsigned int fifo_out1 : 1;
855 unsigned int fifo_out1_extra : 1;
856 unsigned int dmc_in1 : 1;
857} reg_iop_sw_mpu_r_masked_intr_grp3;
858#define REG_RD_ADDR_iop_sw_mpu_r_masked_intr_grp3 156
859
860
861/* Constants */
862enum {
863 regk_iop_sw_mpu_copy = 0x00000000,
864 regk_iop_sw_mpu_cpu = 0x00000000,
865 regk_iop_sw_mpu_mpu = 0x00000001,
866 regk_iop_sw_mpu_no = 0x00000000,
867 regk_iop_sw_mpu_nop = 0x00000000,
868 regk_iop_sw_mpu_rd = 0x00000002,
869 regk_iop_sw_mpu_reg_copy = 0x00000001,
870 regk_iop_sw_mpu_rw_bus0_clr_mask_default = 0x00000000,
871 regk_iop_sw_mpu_rw_bus0_oe_clr_mask_default = 0x00000000,
872 regk_iop_sw_mpu_rw_bus0_oe_set_mask_default = 0x00000000,
873 regk_iop_sw_mpu_rw_bus0_set_mask_default = 0x00000000,
874 regk_iop_sw_mpu_rw_bus1_clr_mask_default = 0x00000000,
875 regk_iop_sw_mpu_rw_bus1_oe_clr_mask_default = 0x00000000,
876 regk_iop_sw_mpu_rw_bus1_oe_set_mask_default = 0x00000000,
877 regk_iop_sw_mpu_rw_bus1_set_mask_default = 0x00000000,
878 regk_iop_sw_mpu_rw_gio_clr_mask_default = 0x00000000,
879 regk_iop_sw_mpu_rw_gio_oe_clr_mask_default = 0x00000000,
880 regk_iop_sw_mpu_rw_gio_oe_set_mask_default = 0x00000000,
881 regk_iop_sw_mpu_rw_gio_set_mask_default = 0x00000000,
882 regk_iop_sw_mpu_rw_intr_grp0_mask_default = 0x00000000,
883 regk_iop_sw_mpu_rw_intr_grp1_mask_default = 0x00000000,
884 regk_iop_sw_mpu_rw_intr_grp2_mask_default = 0x00000000,
885 regk_iop_sw_mpu_rw_intr_grp3_mask_default = 0x00000000,
886 regk_iop_sw_mpu_rw_sw_cfg_owner_default = 0x00000000,
887 regk_iop_sw_mpu_set = 0x00000001,
888 regk_iop_sw_mpu_spu0 = 0x00000002,
889 regk_iop_sw_mpu_spu1 = 0x00000003,
890 regk_iop_sw_mpu_wr = 0x00000003,
891 regk_iop_sw_mpu_yes = 0x00000001
892};
893#endif /* __iop_sw_mpu_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_sw_spu_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_spu_defs.h
new file mode 100644
index 000000000000..b59dde4bd0d1
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_sw_spu_defs.h
@@ -0,0 +1,552 @@
1#ifndef __iop_sw_spu_defs_h
2#define __iop_sw_spu_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_sw_spu.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:10:19 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_sw_spu_defs.h ../../inst/io_proc/rtl/guinness/iop_sw_spu.r
11 * id: $Id: iop_sw_spu_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_sw_spu */
86
87/* Register rw_mc_ctrl, scope iop_sw_spu, type rw */
88typedef struct {
89 unsigned int keep_owner : 1;
90 unsigned int cmd : 2;
91 unsigned int size : 3;
92 unsigned int wr_spu0_mem : 1;
93 unsigned int wr_spu1_mem : 1;
94 unsigned int dummy1 : 24;
95} reg_iop_sw_spu_rw_mc_ctrl;
96#define REG_RD_ADDR_iop_sw_spu_rw_mc_ctrl 0
97#define REG_WR_ADDR_iop_sw_spu_rw_mc_ctrl 0
98
99/* Register rw_mc_data, scope iop_sw_spu, type rw */
100typedef struct {
101 unsigned int val : 32;
102} reg_iop_sw_spu_rw_mc_data;
103#define REG_RD_ADDR_iop_sw_spu_rw_mc_data 4
104#define REG_WR_ADDR_iop_sw_spu_rw_mc_data 4
105
106/* Register rw_mc_addr, scope iop_sw_spu, type rw */
107typedef unsigned int reg_iop_sw_spu_rw_mc_addr;
108#define REG_RD_ADDR_iop_sw_spu_rw_mc_addr 8
109#define REG_WR_ADDR_iop_sw_spu_rw_mc_addr 8
110
111/* Register rs_mc_data, scope iop_sw_spu, type rs */
112typedef unsigned int reg_iop_sw_spu_rs_mc_data;
113#define REG_RD_ADDR_iop_sw_spu_rs_mc_data 12
114
115/* Register r_mc_data, scope iop_sw_spu, type r */
116typedef unsigned int reg_iop_sw_spu_r_mc_data;
117#define REG_RD_ADDR_iop_sw_spu_r_mc_data 16
118
119/* Register r_mc_stat, scope iop_sw_spu, type r */
120typedef struct {
121 unsigned int busy_cpu : 1;
122 unsigned int busy_mpu : 1;
123 unsigned int busy_spu0 : 1;
124 unsigned int busy_spu1 : 1;
125 unsigned int owned_by_cpu : 1;
126 unsigned int owned_by_mpu : 1;
127 unsigned int owned_by_spu0 : 1;
128 unsigned int owned_by_spu1 : 1;
129 unsigned int dummy1 : 24;
130} reg_iop_sw_spu_r_mc_stat;
131#define REG_RD_ADDR_iop_sw_spu_r_mc_stat 20
132
133/* Register rw_bus0_clr_mask, scope iop_sw_spu, type rw */
134typedef struct {
135 unsigned int byte0 : 8;
136 unsigned int byte1 : 8;
137 unsigned int byte2 : 8;
138 unsigned int byte3 : 8;
139} reg_iop_sw_spu_rw_bus0_clr_mask;
140#define REG_RD_ADDR_iop_sw_spu_rw_bus0_clr_mask 24
141#define REG_WR_ADDR_iop_sw_spu_rw_bus0_clr_mask 24
142
143/* Register rw_bus0_set_mask, scope iop_sw_spu, type rw */
144typedef struct {
145 unsigned int byte0 : 8;
146 unsigned int byte1 : 8;
147 unsigned int byte2 : 8;
148 unsigned int byte3 : 8;
149} reg_iop_sw_spu_rw_bus0_set_mask;
150#define REG_RD_ADDR_iop_sw_spu_rw_bus0_set_mask 28
151#define REG_WR_ADDR_iop_sw_spu_rw_bus0_set_mask 28
152
153/* Register rw_bus0_oe_clr_mask, scope iop_sw_spu, type rw */
154typedef struct {
155 unsigned int byte0 : 1;
156 unsigned int byte1 : 1;
157 unsigned int byte2 : 1;
158 unsigned int byte3 : 1;
159 unsigned int dummy1 : 28;
160} reg_iop_sw_spu_rw_bus0_oe_clr_mask;
161#define REG_RD_ADDR_iop_sw_spu_rw_bus0_oe_clr_mask 32
162#define REG_WR_ADDR_iop_sw_spu_rw_bus0_oe_clr_mask 32
163
164/* Register rw_bus0_oe_set_mask, scope iop_sw_spu, type rw */
165typedef struct {
166 unsigned int byte0 : 1;
167 unsigned int byte1 : 1;
168 unsigned int byte2 : 1;
169 unsigned int byte3 : 1;
170 unsigned int dummy1 : 28;
171} reg_iop_sw_spu_rw_bus0_oe_set_mask;
172#define REG_RD_ADDR_iop_sw_spu_rw_bus0_oe_set_mask 36
173#define REG_WR_ADDR_iop_sw_spu_rw_bus0_oe_set_mask 36
174
175/* Register r_bus0_in, scope iop_sw_spu, type r */
176typedef unsigned int reg_iop_sw_spu_r_bus0_in;
177#define REG_RD_ADDR_iop_sw_spu_r_bus0_in 40
178
179/* Register rw_bus1_clr_mask, scope iop_sw_spu, type rw */
180typedef struct {
181 unsigned int byte0 : 8;
182 unsigned int byte1 : 8;
183 unsigned int byte2 : 8;
184 unsigned int byte3 : 8;
185} reg_iop_sw_spu_rw_bus1_clr_mask;
186#define REG_RD_ADDR_iop_sw_spu_rw_bus1_clr_mask 44
187#define REG_WR_ADDR_iop_sw_spu_rw_bus1_clr_mask 44
188
189/* Register rw_bus1_set_mask, scope iop_sw_spu, type rw */
190typedef struct {
191 unsigned int byte0 : 8;
192 unsigned int byte1 : 8;
193 unsigned int byte2 : 8;
194 unsigned int byte3 : 8;
195} reg_iop_sw_spu_rw_bus1_set_mask;
196#define REG_RD_ADDR_iop_sw_spu_rw_bus1_set_mask 48
197#define REG_WR_ADDR_iop_sw_spu_rw_bus1_set_mask 48
198
199/* Register rw_bus1_oe_clr_mask, scope iop_sw_spu, type rw */
200typedef struct {
201 unsigned int byte0 : 1;
202 unsigned int byte1 : 1;
203 unsigned int byte2 : 1;
204 unsigned int byte3 : 1;
205 unsigned int dummy1 : 28;
206} reg_iop_sw_spu_rw_bus1_oe_clr_mask;
207#define REG_RD_ADDR_iop_sw_spu_rw_bus1_oe_clr_mask 52
208#define REG_WR_ADDR_iop_sw_spu_rw_bus1_oe_clr_mask 52
209
210/* Register rw_bus1_oe_set_mask, scope iop_sw_spu, type rw */
211typedef struct {
212 unsigned int byte0 : 1;
213 unsigned int byte1 : 1;
214 unsigned int byte2 : 1;
215 unsigned int byte3 : 1;
216 unsigned int dummy1 : 28;
217} reg_iop_sw_spu_rw_bus1_oe_set_mask;
218#define REG_RD_ADDR_iop_sw_spu_rw_bus1_oe_set_mask 56
219#define REG_WR_ADDR_iop_sw_spu_rw_bus1_oe_set_mask 56
220
221/* Register r_bus1_in, scope iop_sw_spu, type r */
222typedef unsigned int reg_iop_sw_spu_r_bus1_in;
223#define REG_RD_ADDR_iop_sw_spu_r_bus1_in 60
224
225/* Register rw_gio_clr_mask, scope iop_sw_spu, type rw */
226typedef struct {
227 unsigned int val : 32;
228} reg_iop_sw_spu_rw_gio_clr_mask;
229#define REG_RD_ADDR_iop_sw_spu_rw_gio_clr_mask 64
230#define REG_WR_ADDR_iop_sw_spu_rw_gio_clr_mask 64
231
232/* Register rw_gio_set_mask, scope iop_sw_spu, type rw */
233typedef struct {
234 unsigned int val : 32;
235} reg_iop_sw_spu_rw_gio_set_mask;
236#define REG_RD_ADDR_iop_sw_spu_rw_gio_set_mask 68
237#define REG_WR_ADDR_iop_sw_spu_rw_gio_set_mask 68
238
239/* Register rw_gio_oe_clr_mask, scope iop_sw_spu, type rw */
240typedef struct {
241 unsigned int val : 32;
242} reg_iop_sw_spu_rw_gio_oe_clr_mask;
243#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_clr_mask 72
244#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_clr_mask 72
245
246/* Register rw_gio_oe_set_mask, scope iop_sw_spu, type rw */
247typedef struct {
248 unsigned int val : 32;
249} reg_iop_sw_spu_rw_gio_oe_set_mask;
250#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_set_mask 76
251#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_set_mask 76
252
253/* Register r_gio_in, scope iop_sw_spu, type r */
254typedef unsigned int reg_iop_sw_spu_r_gio_in;
255#define REG_RD_ADDR_iop_sw_spu_r_gio_in 80
256
257/* Register rw_bus0_clr_mask_lo, scope iop_sw_spu, type rw */
258typedef struct {
259 unsigned int byte0 : 8;
260 unsigned int byte1 : 8;
261 unsigned int dummy1 : 16;
262} reg_iop_sw_spu_rw_bus0_clr_mask_lo;
263#define REG_RD_ADDR_iop_sw_spu_rw_bus0_clr_mask_lo 84
264#define REG_WR_ADDR_iop_sw_spu_rw_bus0_clr_mask_lo 84
265
266/* Register rw_bus0_clr_mask_hi, scope iop_sw_spu, type rw */
267typedef struct {
268 unsigned int byte2 : 8;
269 unsigned int byte3 : 8;
270 unsigned int dummy1 : 16;
271} reg_iop_sw_spu_rw_bus0_clr_mask_hi;
272#define REG_RD_ADDR_iop_sw_spu_rw_bus0_clr_mask_hi 88
273#define REG_WR_ADDR_iop_sw_spu_rw_bus0_clr_mask_hi 88
274
275/* Register rw_bus0_set_mask_lo, scope iop_sw_spu, type rw */
276typedef struct {
277 unsigned int byte0 : 8;
278 unsigned int byte1 : 8;
279 unsigned int dummy1 : 16;
280} reg_iop_sw_spu_rw_bus0_set_mask_lo;
281#define REG_RD_ADDR_iop_sw_spu_rw_bus0_set_mask_lo 92
282#define REG_WR_ADDR_iop_sw_spu_rw_bus0_set_mask_lo 92
283
284/* Register rw_bus0_set_mask_hi, scope iop_sw_spu, type rw */
285typedef struct {
286 unsigned int byte2 : 8;
287 unsigned int byte3 : 8;
288 unsigned int dummy1 : 16;
289} reg_iop_sw_spu_rw_bus0_set_mask_hi;
290#define REG_RD_ADDR_iop_sw_spu_rw_bus0_set_mask_hi 96
291#define REG_WR_ADDR_iop_sw_spu_rw_bus0_set_mask_hi 96
292
293/* Register rw_bus1_clr_mask_lo, scope iop_sw_spu, type rw */
294typedef struct {
295 unsigned int byte0 : 8;
296 unsigned int byte1 : 8;
297 unsigned int dummy1 : 16;
298} reg_iop_sw_spu_rw_bus1_clr_mask_lo;
299#define REG_RD_ADDR_iop_sw_spu_rw_bus1_clr_mask_lo 100
300#define REG_WR_ADDR_iop_sw_spu_rw_bus1_clr_mask_lo 100
301
302/* Register rw_bus1_clr_mask_hi, scope iop_sw_spu, type rw */
303typedef struct {
304 unsigned int byte2 : 8;
305 unsigned int byte3 : 8;
306 unsigned int dummy1 : 16;
307} reg_iop_sw_spu_rw_bus1_clr_mask_hi;
308#define REG_RD_ADDR_iop_sw_spu_rw_bus1_clr_mask_hi 104
309#define REG_WR_ADDR_iop_sw_spu_rw_bus1_clr_mask_hi 104
310
311/* Register rw_bus1_set_mask_lo, scope iop_sw_spu, type rw */
312typedef struct {
313 unsigned int byte0 : 8;
314 unsigned int byte1 : 8;
315 unsigned int dummy1 : 16;
316} reg_iop_sw_spu_rw_bus1_set_mask_lo;
317#define REG_RD_ADDR_iop_sw_spu_rw_bus1_set_mask_lo 108
318#define REG_WR_ADDR_iop_sw_spu_rw_bus1_set_mask_lo 108
319
320/* Register rw_bus1_set_mask_hi, scope iop_sw_spu, type rw */
321typedef struct {
322 unsigned int byte2 : 8;
323 unsigned int byte3 : 8;
324 unsigned int dummy1 : 16;
325} reg_iop_sw_spu_rw_bus1_set_mask_hi;
326#define REG_RD_ADDR_iop_sw_spu_rw_bus1_set_mask_hi 112
327#define REG_WR_ADDR_iop_sw_spu_rw_bus1_set_mask_hi 112
328
329/* Register rw_gio_clr_mask_lo, scope iop_sw_spu, type rw */
330typedef struct {
331 unsigned int val : 16;
332 unsigned int dummy1 : 16;
333} reg_iop_sw_spu_rw_gio_clr_mask_lo;
334#define REG_RD_ADDR_iop_sw_spu_rw_gio_clr_mask_lo 116
335#define REG_WR_ADDR_iop_sw_spu_rw_gio_clr_mask_lo 116
336
337/* Register rw_gio_clr_mask_hi, scope iop_sw_spu, type rw */
338typedef struct {
339 unsigned int val : 16;
340 unsigned int dummy1 : 16;
341} reg_iop_sw_spu_rw_gio_clr_mask_hi;
342#define REG_RD_ADDR_iop_sw_spu_rw_gio_clr_mask_hi 120
343#define REG_WR_ADDR_iop_sw_spu_rw_gio_clr_mask_hi 120
344
345/* Register rw_gio_set_mask_lo, scope iop_sw_spu, type rw */
346typedef struct {
347 unsigned int val : 16;
348 unsigned int dummy1 : 16;
349} reg_iop_sw_spu_rw_gio_set_mask_lo;
350#define REG_RD_ADDR_iop_sw_spu_rw_gio_set_mask_lo 124
351#define REG_WR_ADDR_iop_sw_spu_rw_gio_set_mask_lo 124
352
353/* Register rw_gio_set_mask_hi, scope iop_sw_spu, type rw */
354typedef struct {
355 unsigned int val : 16;
356 unsigned int dummy1 : 16;
357} reg_iop_sw_spu_rw_gio_set_mask_hi;
358#define REG_RD_ADDR_iop_sw_spu_rw_gio_set_mask_hi 128
359#define REG_WR_ADDR_iop_sw_spu_rw_gio_set_mask_hi 128
360
361/* Register rw_gio_oe_clr_mask_lo, scope iop_sw_spu, type rw */
362typedef struct {
363 unsigned int val : 16;
364 unsigned int dummy1 : 16;
365} reg_iop_sw_spu_rw_gio_oe_clr_mask_lo;
366#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_clr_mask_lo 132
367#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_clr_mask_lo 132
368
369/* Register rw_gio_oe_clr_mask_hi, scope iop_sw_spu, type rw */
370typedef struct {
371 unsigned int val : 16;
372 unsigned int dummy1 : 16;
373} reg_iop_sw_spu_rw_gio_oe_clr_mask_hi;
374#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_clr_mask_hi 136
375#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_clr_mask_hi 136
376
377/* Register rw_gio_oe_set_mask_lo, scope iop_sw_spu, type rw */
378typedef struct {
379 unsigned int val : 16;
380 unsigned int dummy1 : 16;
381} reg_iop_sw_spu_rw_gio_oe_set_mask_lo;
382#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_set_mask_lo 140
383#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_set_mask_lo 140
384
385/* Register rw_gio_oe_set_mask_hi, scope iop_sw_spu, type rw */
386typedef struct {
387 unsigned int val : 16;
388 unsigned int dummy1 : 16;
389} reg_iop_sw_spu_rw_gio_oe_set_mask_hi;
390#define REG_RD_ADDR_iop_sw_spu_rw_gio_oe_set_mask_hi 144
391#define REG_WR_ADDR_iop_sw_spu_rw_gio_oe_set_mask_hi 144
392
393/* Register rw_cpu_intr, scope iop_sw_spu, type rw */
394typedef struct {
395 unsigned int intr0 : 1;
396 unsigned int intr1 : 1;
397 unsigned int intr2 : 1;
398 unsigned int intr3 : 1;
399 unsigned int intr4 : 1;
400 unsigned int intr5 : 1;
401 unsigned int intr6 : 1;
402 unsigned int intr7 : 1;
403 unsigned int intr8 : 1;
404 unsigned int intr9 : 1;
405 unsigned int intr10 : 1;
406 unsigned int intr11 : 1;
407 unsigned int intr12 : 1;
408 unsigned int intr13 : 1;
409 unsigned int intr14 : 1;
410 unsigned int intr15 : 1;
411 unsigned int dummy1 : 16;
412} reg_iop_sw_spu_rw_cpu_intr;
413#define REG_RD_ADDR_iop_sw_spu_rw_cpu_intr 148
414#define REG_WR_ADDR_iop_sw_spu_rw_cpu_intr 148
415
416/* Register r_cpu_intr, scope iop_sw_spu, type r */
417typedef struct {
418 unsigned int intr0 : 1;
419 unsigned int intr1 : 1;
420 unsigned int intr2 : 1;
421 unsigned int intr3 : 1;
422 unsigned int intr4 : 1;
423 unsigned int intr5 : 1;
424 unsigned int intr6 : 1;
425 unsigned int intr7 : 1;
426 unsigned int intr8 : 1;
427 unsigned int intr9 : 1;
428 unsigned int intr10 : 1;
429 unsigned int intr11 : 1;
430 unsigned int intr12 : 1;
431 unsigned int intr13 : 1;
432 unsigned int intr14 : 1;
433 unsigned int intr15 : 1;
434 unsigned int dummy1 : 16;
435} reg_iop_sw_spu_r_cpu_intr;
436#define REG_RD_ADDR_iop_sw_spu_r_cpu_intr 152
437
438/* Register r_hw_intr, scope iop_sw_spu, type r */
439typedef struct {
440 unsigned int trigger_grp0 : 1;
441 unsigned int trigger_grp1 : 1;
442 unsigned int trigger_grp2 : 1;
443 unsigned int trigger_grp3 : 1;
444 unsigned int trigger_grp4 : 1;
445 unsigned int trigger_grp5 : 1;
446 unsigned int trigger_grp6 : 1;
447 unsigned int trigger_grp7 : 1;
448 unsigned int timer_grp0 : 1;
449 unsigned int timer_grp1 : 1;
450 unsigned int timer_grp2 : 1;
451 unsigned int timer_grp3 : 1;
452 unsigned int fifo_out0 : 1;
453 unsigned int fifo_out0_extra : 1;
454 unsigned int fifo_in0 : 1;
455 unsigned int fifo_in0_extra : 1;
456 unsigned int fifo_out1 : 1;
457 unsigned int fifo_out1_extra : 1;
458 unsigned int fifo_in1 : 1;
459 unsigned int fifo_in1_extra : 1;
460 unsigned int dmc_out0 : 1;
461 unsigned int dmc_in0 : 1;
462 unsigned int dmc_out1 : 1;
463 unsigned int dmc_in1 : 1;
464 unsigned int dummy1 : 8;
465} reg_iop_sw_spu_r_hw_intr;
466#define REG_RD_ADDR_iop_sw_spu_r_hw_intr 156
467
468/* Register rw_mpu_intr, scope iop_sw_spu, type rw */
469typedef struct {
470 unsigned int intr0 : 1;
471 unsigned int intr1 : 1;
472 unsigned int intr2 : 1;
473 unsigned int intr3 : 1;
474 unsigned int intr4 : 1;
475 unsigned int intr5 : 1;
476 unsigned int intr6 : 1;
477 unsigned int intr7 : 1;
478 unsigned int intr8 : 1;
479 unsigned int intr9 : 1;
480 unsigned int intr10 : 1;
481 unsigned int intr11 : 1;
482 unsigned int intr12 : 1;
483 unsigned int intr13 : 1;
484 unsigned int intr14 : 1;
485 unsigned int intr15 : 1;
486 unsigned int dummy1 : 16;
487} reg_iop_sw_spu_rw_mpu_intr;
488#define REG_RD_ADDR_iop_sw_spu_rw_mpu_intr 160
489#define REG_WR_ADDR_iop_sw_spu_rw_mpu_intr 160
490
491/* Register r_mpu_intr, scope iop_sw_spu, type r */
492typedef struct {
493 unsigned int intr0 : 1;
494 unsigned int intr1 : 1;
495 unsigned int intr2 : 1;
496 unsigned int intr3 : 1;
497 unsigned int intr4 : 1;
498 unsigned int intr5 : 1;
499 unsigned int intr6 : 1;
500 unsigned int intr7 : 1;
501 unsigned int intr8 : 1;
502 unsigned int intr9 : 1;
503 unsigned int intr10 : 1;
504 unsigned int intr11 : 1;
505 unsigned int intr12 : 1;
506 unsigned int intr13 : 1;
507 unsigned int intr14 : 1;
508 unsigned int intr15 : 1;
509 unsigned int other_spu_intr0 : 1;
510 unsigned int other_spu_intr1 : 1;
511 unsigned int other_spu_intr2 : 1;
512 unsigned int other_spu_intr3 : 1;
513 unsigned int other_spu_intr4 : 1;
514 unsigned int other_spu_intr5 : 1;
515 unsigned int other_spu_intr6 : 1;
516 unsigned int other_spu_intr7 : 1;
517 unsigned int other_spu_intr8 : 1;
518 unsigned int other_spu_intr9 : 1;
519 unsigned int other_spu_intr10 : 1;
520 unsigned int other_spu_intr11 : 1;
521 unsigned int other_spu_intr12 : 1;
522 unsigned int other_spu_intr13 : 1;
523 unsigned int other_spu_intr14 : 1;
524 unsigned int other_spu_intr15 : 1;
525} reg_iop_sw_spu_r_mpu_intr;
526#define REG_RD_ADDR_iop_sw_spu_r_mpu_intr 164
527
528
529/* Constants */
530enum {
531 regk_iop_sw_spu_copy = 0x00000000,
532 regk_iop_sw_spu_no = 0x00000000,
533 regk_iop_sw_spu_nop = 0x00000000,
534 regk_iop_sw_spu_rd = 0x00000002,
535 regk_iop_sw_spu_reg_copy = 0x00000001,
536 regk_iop_sw_spu_rw_bus0_clr_mask_default = 0x00000000,
537 regk_iop_sw_spu_rw_bus0_oe_clr_mask_default = 0x00000000,
538 regk_iop_sw_spu_rw_bus0_oe_set_mask_default = 0x00000000,
539 regk_iop_sw_spu_rw_bus0_set_mask_default = 0x00000000,
540 regk_iop_sw_spu_rw_bus1_clr_mask_default = 0x00000000,
541 regk_iop_sw_spu_rw_bus1_oe_clr_mask_default = 0x00000000,
542 regk_iop_sw_spu_rw_bus1_oe_set_mask_default = 0x00000000,
543 regk_iop_sw_spu_rw_bus1_set_mask_default = 0x00000000,
544 regk_iop_sw_spu_rw_gio_clr_mask_default = 0x00000000,
545 regk_iop_sw_spu_rw_gio_oe_clr_mask_default = 0x00000000,
546 regk_iop_sw_spu_rw_gio_oe_set_mask_default = 0x00000000,
547 regk_iop_sw_spu_rw_gio_set_mask_default = 0x00000000,
548 regk_iop_sw_spu_set = 0x00000001,
549 regk_iop_sw_spu_wr = 0x00000003,
550 regk_iop_sw_spu_yes = 0x00000001
551};
552#endif /* __iop_sw_spu_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_timer_grp_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_timer_grp_defs.h
new file mode 100644
index 000000000000..c994114f3b51
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_timer_grp_defs.h
@@ -0,0 +1,249 @@
1#ifndef __iop_timer_grp_defs_h
2#define __iop_timer_grp_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_timer_grp.r
7 * id: iop_timer_grp.r,v 1.29 2005/02/16 09:13:27 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_timer_grp_defs.h ../../inst/io_proc/rtl/iop_timer_grp.r
11 * id: $Id: iop_timer_grp_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_timer_grp */
86
87/* Register rw_cfg, scope iop_timer_grp, type rw */
88typedef struct {
89 unsigned int clk_src : 1;
90 unsigned int trig : 2;
91 unsigned int clk_gen_div : 8;
92 unsigned int clk_div : 8;
93 unsigned int dummy1 : 13;
94} reg_iop_timer_grp_rw_cfg;
95#define REG_RD_ADDR_iop_timer_grp_rw_cfg 0
96#define REG_WR_ADDR_iop_timer_grp_rw_cfg 0
97
98/* Register rw_half_period, scope iop_timer_grp, type rw */
99typedef struct {
100 unsigned int quota_lo : 15;
101 unsigned int quota_hi : 15;
102 unsigned int quota_hi_sel : 1;
103 unsigned int dummy1 : 1;
104} reg_iop_timer_grp_rw_half_period;
105#define REG_RD_ADDR_iop_timer_grp_rw_half_period 4
106#define REG_WR_ADDR_iop_timer_grp_rw_half_period 4
107
108/* Register rw_half_period_len, scope iop_timer_grp, type rw */
109typedef unsigned int reg_iop_timer_grp_rw_half_period_len;
110#define REG_RD_ADDR_iop_timer_grp_rw_half_period_len 8
111#define REG_WR_ADDR_iop_timer_grp_rw_half_period_len 8
112
113#define STRIDE_iop_timer_grp_rw_tmr_cfg 4
114/* Register rw_tmr_cfg, scope iop_timer_grp, type rw */
115typedef struct {
116 unsigned int clk_src : 3;
117 unsigned int strb : 2;
118 unsigned int run_mode : 2;
119 unsigned int out_mode : 1;
120 unsigned int active_on_tmr : 2;
121 unsigned int inv : 1;
122 unsigned int en_by_tmr : 2;
123 unsigned int dis_by_tmr : 2;
124 unsigned int en_only_by_reg : 1;
125 unsigned int dis_only_by_reg : 1;
126 unsigned int rst_at_en_strb : 1;
127 unsigned int dummy1 : 14;
128} reg_iop_timer_grp_rw_tmr_cfg;
129#define REG_RD_ADDR_iop_timer_grp_rw_tmr_cfg 12
130#define REG_WR_ADDR_iop_timer_grp_rw_tmr_cfg 12
131
132#define STRIDE_iop_timer_grp_rw_tmr_len 4
133/* Register rw_tmr_len, scope iop_timer_grp, type rw */
134typedef struct {
135 unsigned int val : 16;
136 unsigned int dummy1 : 16;
137} reg_iop_timer_grp_rw_tmr_len;
138#define REG_RD_ADDR_iop_timer_grp_rw_tmr_len 44
139#define REG_WR_ADDR_iop_timer_grp_rw_tmr_len 44
140
141/* Register rw_cmd, scope iop_timer_grp, type rw */
142typedef struct {
143 unsigned int rst : 4;
144 unsigned int en : 4;
145 unsigned int dis : 4;
146 unsigned int strb : 4;
147 unsigned int dummy1 : 16;
148} reg_iop_timer_grp_rw_cmd;
149#define REG_RD_ADDR_iop_timer_grp_rw_cmd 60
150#define REG_WR_ADDR_iop_timer_grp_rw_cmd 60
151
152/* Register r_clk_gen_cnt, scope iop_timer_grp, type r */
153typedef unsigned int reg_iop_timer_grp_r_clk_gen_cnt;
154#define REG_RD_ADDR_iop_timer_grp_r_clk_gen_cnt 64
155
156#define STRIDE_iop_timer_grp_rs_tmr_cnt 8
157/* Register rs_tmr_cnt, scope iop_timer_grp, type rs */
158typedef struct {
159 unsigned int val : 16;
160 unsigned int dummy1 : 16;
161} reg_iop_timer_grp_rs_tmr_cnt;
162#define REG_RD_ADDR_iop_timer_grp_rs_tmr_cnt 68
163
164#define STRIDE_iop_timer_grp_r_tmr_cnt 8
165/* Register r_tmr_cnt, scope iop_timer_grp, type r */
166typedef struct {
167 unsigned int val : 16;
168 unsigned int dummy1 : 16;
169} reg_iop_timer_grp_r_tmr_cnt;
170#define REG_RD_ADDR_iop_timer_grp_r_tmr_cnt 72
171
172/* Register rw_intr_mask, scope iop_timer_grp, type rw */
173typedef struct {
174 unsigned int tmr0 : 1;
175 unsigned int tmr1 : 1;
176 unsigned int tmr2 : 1;
177 unsigned int tmr3 : 1;
178 unsigned int dummy1 : 28;
179} reg_iop_timer_grp_rw_intr_mask;
180#define REG_RD_ADDR_iop_timer_grp_rw_intr_mask 100
181#define REG_WR_ADDR_iop_timer_grp_rw_intr_mask 100
182
183/* Register rw_ack_intr, scope iop_timer_grp, type rw */
184typedef struct {
185 unsigned int tmr0 : 1;
186 unsigned int tmr1 : 1;
187 unsigned int tmr2 : 1;
188 unsigned int tmr3 : 1;
189 unsigned int dummy1 : 28;
190} reg_iop_timer_grp_rw_ack_intr;
191#define REG_RD_ADDR_iop_timer_grp_rw_ack_intr 104
192#define REG_WR_ADDR_iop_timer_grp_rw_ack_intr 104
193
194/* Register r_intr, scope iop_timer_grp, type r */
195typedef struct {
196 unsigned int tmr0 : 1;
197 unsigned int tmr1 : 1;
198 unsigned int tmr2 : 1;
199 unsigned int tmr3 : 1;
200 unsigned int dummy1 : 28;
201} reg_iop_timer_grp_r_intr;
202#define REG_RD_ADDR_iop_timer_grp_r_intr 108
203
204/* Register r_masked_intr, scope iop_timer_grp, type r */
205typedef struct {
206 unsigned int tmr0 : 1;
207 unsigned int tmr1 : 1;
208 unsigned int tmr2 : 1;
209 unsigned int tmr3 : 1;
210 unsigned int dummy1 : 28;
211} reg_iop_timer_grp_r_masked_intr;
212#define REG_RD_ADDR_iop_timer_grp_r_masked_intr 112
213
214
215/* Constants */
216enum {
217 regk_iop_timer_grp_clk200 = 0x00000000,
218 regk_iop_timer_grp_clk_gen = 0x00000002,
219 regk_iop_timer_grp_complete = 0x00000002,
220 regk_iop_timer_grp_div_clk200 = 0x00000001,
221 regk_iop_timer_grp_div_clk_gen = 0x00000003,
222 regk_iop_timer_grp_ext = 0x00000001,
223 regk_iop_timer_grp_hi = 0x00000000,
224 regk_iop_timer_grp_long_period = 0x00000001,
225 regk_iop_timer_grp_neg = 0x00000002,
226 regk_iop_timer_grp_no = 0x00000000,
227 regk_iop_timer_grp_once = 0x00000003,
228 regk_iop_timer_grp_pause = 0x00000001,
229 regk_iop_timer_grp_pos = 0x00000001,
230 regk_iop_timer_grp_pos_neg = 0x00000003,
231 regk_iop_timer_grp_pulse = 0x00000000,
232 regk_iop_timer_grp_r_tmr_cnt_size = 0x00000004,
233 regk_iop_timer_grp_rs_tmr_cnt_size = 0x00000004,
234 regk_iop_timer_grp_rw_cfg_default = 0x00000002,
235 regk_iop_timer_grp_rw_intr_mask_default = 0x00000000,
236 regk_iop_timer_grp_rw_tmr_cfg_default0 = 0x00018000,
237 regk_iop_timer_grp_rw_tmr_cfg_default1 = 0x0001a900,
238 regk_iop_timer_grp_rw_tmr_cfg_default2 = 0x0001d200,
239 regk_iop_timer_grp_rw_tmr_cfg_default3 = 0x0001fb00,
240 regk_iop_timer_grp_rw_tmr_cfg_size = 0x00000004,
241 regk_iop_timer_grp_rw_tmr_len_default = 0x00000000,
242 regk_iop_timer_grp_rw_tmr_len_size = 0x00000004,
243 regk_iop_timer_grp_short_period = 0x00000000,
244 regk_iop_timer_grp_stop = 0x00000000,
245 regk_iop_timer_grp_tmr = 0x00000004,
246 regk_iop_timer_grp_toggle = 0x00000001,
247 regk_iop_timer_grp_yes = 0x00000001
248};
249#endif /* __iop_timer_grp_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_trigger_grp_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_trigger_grp_defs.h
new file mode 100644
index 000000000000..36e44282399d
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_trigger_grp_defs.h
@@ -0,0 +1,170 @@
1#ifndef __iop_trigger_grp_defs_h
2#define __iop_trigger_grp_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/iop_trigger_grp.r
7 * id: iop_trigger_grp.r,v 0.20 2005/02/16 09:13:20 niklaspa Exp
8 * last modfied: Mon Apr 11 16:08:46 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_trigger_grp_defs.h ../../inst/io_proc/rtl/iop_trigger_grp.r
11 * id: $Id: iop_trigger_grp_defs.h,v 1.5 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_trigger_grp */
86
87#define STRIDE_iop_trigger_grp_rw_cfg 4
88/* Register rw_cfg, scope iop_trigger_grp, type rw */
89typedef struct {
90 unsigned int action : 2;
91 unsigned int once : 1;
92 unsigned int trig : 3;
93 unsigned int en_only_by_reg : 1;
94 unsigned int dis_only_by_reg : 1;
95 unsigned int dummy1 : 24;
96} reg_iop_trigger_grp_rw_cfg;
97#define REG_RD_ADDR_iop_trigger_grp_rw_cfg 0
98#define REG_WR_ADDR_iop_trigger_grp_rw_cfg 0
99
100/* Register rw_cmd, scope iop_trigger_grp, type rw */
101typedef struct {
102 unsigned int dis : 4;
103 unsigned int en : 4;
104 unsigned int dummy1 : 24;
105} reg_iop_trigger_grp_rw_cmd;
106#define REG_RD_ADDR_iop_trigger_grp_rw_cmd 16
107#define REG_WR_ADDR_iop_trigger_grp_rw_cmd 16
108
109/* Register rw_intr_mask, scope iop_trigger_grp, type rw */
110typedef struct {
111 unsigned int trig0 : 1;
112 unsigned int trig1 : 1;
113 unsigned int trig2 : 1;
114 unsigned int trig3 : 1;
115 unsigned int dummy1 : 28;
116} reg_iop_trigger_grp_rw_intr_mask;
117#define REG_RD_ADDR_iop_trigger_grp_rw_intr_mask 20
118#define REG_WR_ADDR_iop_trigger_grp_rw_intr_mask 20
119
120/* Register rw_ack_intr, scope iop_trigger_grp, type rw */
121typedef struct {
122 unsigned int trig0 : 1;
123 unsigned int trig1 : 1;
124 unsigned int trig2 : 1;
125 unsigned int trig3 : 1;
126 unsigned int dummy1 : 28;
127} reg_iop_trigger_grp_rw_ack_intr;
128#define REG_RD_ADDR_iop_trigger_grp_rw_ack_intr 24
129#define REG_WR_ADDR_iop_trigger_grp_rw_ack_intr 24
130
131/* Register r_intr, scope iop_trigger_grp, type r */
132typedef struct {
133 unsigned int trig0 : 1;
134 unsigned int trig1 : 1;
135 unsigned int trig2 : 1;
136 unsigned int trig3 : 1;
137 unsigned int dummy1 : 28;
138} reg_iop_trigger_grp_r_intr;
139#define REG_RD_ADDR_iop_trigger_grp_r_intr 28
140
141/* Register r_masked_intr, scope iop_trigger_grp, type r */
142typedef struct {
143 unsigned int trig0 : 1;
144 unsigned int trig1 : 1;
145 unsigned int trig2 : 1;
146 unsigned int trig3 : 1;
147 unsigned int dummy1 : 28;
148} reg_iop_trigger_grp_r_masked_intr;
149#define REG_RD_ADDR_iop_trigger_grp_r_masked_intr 32
150
151
152/* Constants */
153enum {
154 regk_iop_trigger_grp_fall = 0x00000002,
155 regk_iop_trigger_grp_fall_lo = 0x00000006,
156 regk_iop_trigger_grp_no = 0x00000000,
157 regk_iop_trigger_grp_off = 0x00000000,
158 regk_iop_trigger_grp_pulse = 0x00000000,
159 regk_iop_trigger_grp_rise = 0x00000001,
160 regk_iop_trigger_grp_rise_fall = 0x00000003,
161 regk_iop_trigger_grp_rise_fall_hi = 0x00000007,
162 regk_iop_trigger_grp_rise_fall_lo = 0x00000004,
163 regk_iop_trigger_grp_rise_hi = 0x00000005,
164 regk_iop_trigger_grp_rw_cfg_default = 0x000000c0,
165 regk_iop_trigger_grp_rw_cfg_size = 0x00000004,
166 regk_iop_trigger_grp_rw_intr_mask_default = 0x00000000,
167 regk_iop_trigger_grp_toggle = 0x00000003,
168 regk_iop_trigger_grp_yes = 0x00000001
169};
170#endif /* __iop_trigger_grp_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/iop/iop_version_defs.h b/include/asm-cris/arch-v32/hwregs/iop/iop_version_defs.h
new file mode 100644
index 000000000000..b8d6a910c71c
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/iop/iop_version_defs.h
@@ -0,0 +1,99 @@
1#ifndef __iop_version_defs_h
2#define __iop_version_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/io_proc/rtl/guinness/iop_version.r
7 * id: iop_version.r,v 1.3 2004/04/22 12:37:54 jonaso Exp
8 * last modfied: Mon Apr 11 16:08:44 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile iop_version_defs.h ../../inst/io_proc/rtl/guinness/iop_version.r
11 * id: $Id: iop_version_defs.h,v 1.4 2005/04/24 18:31:05 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope iop_version */
86
87/* Register r_version, scope iop_version, type r */
88typedef struct {
89 unsigned int nr : 8;
90 unsigned int dummy1 : 24;
91} reg_iop_version_r_version;
92#define REG_RD_ADDR_iop_version_r_version 0
93
94
95/* Constants */
96enum {
97 regk_iop_version_v1_0 = 0x00000001
98};
99#endif /* __iop_version_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/irq_nmi_defs.h b/include/asm-cris/arch-v32/hwregs/irq_nmi_defs.h
new file mode 100644
index 000000000000..7b167e3c0572
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/irq_nmi_defs.h
@@ -0,0 +1,104 @@
1#ifndef __irq_nmi_defs_h
2#define __irq_nmi_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../mod/irq_nmi.r
7 * id: <not found>
8 * last modfied: Thu Jan 22 09:22:43 2004
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile irq_nmi_defs.h ../../mod/irq_nmi.r
11 * id: $Id: irq_nmi_defs.h,v 1.1 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope irq_nmi */
86
87/* Register rw_cmd, scope irq_nmi, type rw */
88typedef struct {
89 unsigned int delay : 16;
90 unsigned int op : 2;
91 unsigned int dummy1 : 14;
92} reg_irq_nmi_rw_cmd;
93#define REG_RD_ADDR_irq_nmi_rw_cmd 0
94#define REG_WR_ADDR_irq_nmi_rw_cmd 0
95
96
97/* Constants */
98enum {
99 regk_irq_nmi_ack_irq = 0x00000002,
100 regk_irq_nmi_ack_nmi = 0x00000003,
101 regk_irq_nmi_irq = 0x00000000,
102 regk_irq_nmi_nmi = 0x00000001
103};
104#endif /* __irq_nmi_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/marb_bp_defs.h b/include/asm-cris/arch-v32/hwregs/marb_bp_defs.h
new file mode 100644
index 000000000000..a11fdd3cd907
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/marb_bp_defs.h
@@ -0,0 +1,205 @@
1#ifndef __marb_bp_defs_h
2#define __marb_bp_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/memarb/rtl/guinness/marb_top.r
7 * id: <not found>
8 * last modfied: Fri Nov 7 15:36:04 2003
9 *
10 * by /n/asic/projects/guinness/design/top/inst/rdesc/rdes2c ../../rtl/global.rmap ../../mod/modreg.rmap -base 0xb0000000 ../../inst/memarb/rtl/guinness/marb_top.r
11 * id: $Id: marb_bp_defs.h,v 1.2 2004/06/04 07:15:33 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74/* C-code for register scope marb_bp */
75
76/* Register rw_first_addr, scope marb_bp, type rw */
77typedef unsigned int reg_marb_bp_rw_first_addr;
78#define REG_RD_ADDR_marb_bp_rw_first_addr 0
79#define REG_WR_ADDR_marb_bp_rw_first_addr 0
80
81/* Register rw_last_addr, scope marb_bp, type rw */
82typedef unsigned int reg_marb_bp_rw_last_addr;
83#define REG_RD_ADDR_marb_bp_rw_last_addr 4
84#define REG_WR_ADDR_marb_bp_rw_last_addr 4
85
86/* Register rw_op, scope marb_bp, type rw */
87typedef struct {
88 unsigned int read : 1;
89 unsigned int write : 1;
90 unsigned int read_excl : 1;
91 unsigned int pri_write : 1;
92 unsigned int us_read : 1;
93 unsigned int us_write : 1;
94 unsigned int us_read_excl : 1;
95 unsigned int us_pri_write : 1;
96 unsigned int dummy1 : 24;
97} reg_marb_bp_rw_op;
98#define REG_RD_ADDR_marb_bp_rw_op 8
99#define REG_WR_ADDR_marb_bp_rw_op 8
100
101/* Register rw_clients, scope marb_bp, type rw */
102typedef struct {
103 unsigned int dma0 : 1;
104 unsigned int dma1 : 1;
105 unsigned int dma2 : 1;
106 unsigned int dma3 : 1;
107 unsigned int dma4 : 1;
108 unsigned int dma5 : 1;
109 unsigned int dma6 : 1;
110 unsigned int dma7 : 1;
111 unsigned int dma8 : 1;
112 unsigned int dma9 : 1;
113 unsigned int cpui : 1;
114 unsigned int cpud : 1;
115 unsigned int iop : 1;
116 unsigned int slave : 1;
117 unsigned int dummy1 : 18;
118} reg_marb_bp_rw_clients;
119#define REG_RD_ADDR_marb_bp_rw_clients 12
120#define REG_WR_ADDR_marb_bp_rw_clients 12
121
122/* Register rw_options, scope marb_bp, type rw */
123typedef struct {
124 unsigned int wrap : 1;
125 unsigned int dummy1 : 31;
126} reg_marb_bp_rw_options;
127#define REG_RD_ADDR_marb_bp_rw_options 16
128#define REG_WR_ADDR_marb_bp_rw_options 16
129
130/* Register r_break_addr, scope marb_bp, type r */
131typedef unsigned int reg_marb_bp_r_break_addr;
132#define REG_RD_ADDR_marb_bp_r_break_addr 20
133
134/* Register r_break_op, scope marb_bp, type r */
135typedef struct {
136 unsigned int read : 1;
137 unsigned int write : 1;
138 unsigned int read_excl : 1;
139 unsigned int pri_write : 1;
140 unsigned int us_read : 1;
141 unsigned int us_write : 1;
142 unsigned int us_read_excl : 1;
143 unsigned int us_pri_write : 1;
144 unsigned int dummy1 : 24;
145} reg_marb_bp_r_break_op;
146#define REG_RD_ADDR_marb_bp_r_break_op 24
147
148/* Register r_break_clients, scope marb_bp, type r */
149typedef struct {
150 unsigned int dma0 : 1;
151 unsigned int dma1 : 1;
152 unsigned int dma2 : 1;
153 unsigned int dma3 : 1;
154 unsigned int dma4 : 1;
155 unsigned int dma5 : 1;
156 unsigned int dma6 : 1;
157 unsigned int dma7 : 1;
158 unsigned int dma8 : 1;
159 unsigned int dma9 : 1;
160 unsigned int cpui : 1;
161 unsigned int cpud : 1;
162 unsigned int iop : 1;
163 unsigned int slave : 1;
164 unsigned int dummy1 : 18;
165} reg_marb_bp_r_break_clients;
166#define REG_RD_ADDR_marb_bp_r_break_clients 28
167
168/* Register r_break_first_client, scope marb_bp, type r */
169typedef struct {
170 unsigned int dma0 : 1;
171 unsigned int dma1 : 1;
172 unsigned int dma2 : 1;
173 unsigned int dma3 : 1;
174 unsigned int dma4 : 1;
175 unsigned int dma5 : 1;
176 unsigned int dma6 : 1;
177 unsigned int dma7 : 1;
178 unsigned int dma8 : 1;
179 unsigned int dma9 : 1;
180 unsigned int cpui : 1;
181 unsigned int cpud : 1;
182 unsigned int iop : 1;
183 unsigned int slave : 1;
184 unsigned int dummy1 : 18;
185} reg_marb_bp_r_break_first_client;
186#define REG_RD_ADDR_marb_bp_r_break_first_client 32
187
188/* Register r_break_size, scope marb_bp, type r */
189typedef unsigned int reg_marb_bp_r_break_size;
190#define REG_RD_ADDR_marb_bp_r_break_size 36
191
192/* Register rw_ack, scope marb_bp, type rw */
193typedef unsigned int reg_marb_bp_rw_ack;
194#define REG_RD_ADDR_marb_bp_rw_ack 40
195#define REG_WR_ADDR_marb_bp_rw_ack 40
196
197
198/* Constants */
199enum {
200 regk_marb_bp_no = 0x00000000,
201 regk_marb_bp_rw_op_default = 0x00000000,
202 regk_marb_bp_rw_options_default = 0x00000000,
203 regk_marb_bp_yes = 0x00000001
204};
205#endif /* __marb_bp_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/marb_defs.h b/include/asm-cris/arch-v32/hwregs/marb_defs.h
new file mode 100644
index 000000000000..71e8af0bb3a4
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/marb_defs.h
@@ -0,0 +1,475 @@
1#ifndef __marb_defs_h
2#define __marb_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/memarb/rtl/guinness/marb_top.r
7 * id: <not found>
8 * last modfied: Mon Apr 11 16:12:16 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile marb_defs.h ../../inst/memarb/rtl/guinness/marb_top.r
11 * id: $Id: marb_defs.h,v 1.3 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope marb */
86
87#define STRIDE_marb_rw_int_slots 4
88/* Register rw_int_slots, scope marb, type rw */
89typedef struct {
90 unsigned int owner : 4;
91 unsigned int dummy1 : 28;
92} reg_marb_rw_int_slots;
93#define REG_RD_ADDR_marb_rw_int_slots 0
94#define REG_WR_ADDR_marb_rw_int_slots 0
95
96#define STRIDE_marb_rw_ext_slots 4
97/* Register rw_ext_slots, scope marb, type rw */
98typedef struct {
99 unsigned int owner : 4;
100 unsigned int dummy1 : 28;
101} reg_marb_rw_ext_slots;
102#define REG_RD_ADDR_marb_rw_ext_slots 256
103#define REG_WR_ADDR_marb_rw_ext_slots 256
104
105#define STRIDE_marb_rw_regs_slots 4
106/* Register rw_regs_slots, scope marb, type rw */
107typedef struct {
108 unsigned int owner : 4;
109 unsigned int dummy1 : 28;
110} reg_marb_rw_regs_slots;
111#define REG_RD_ADDR_marb_rw_regs_slots 512
112#define REG_WR_ADDR_marb_rw_regs_slots 512
113
114/* Register rw_intr_mask, scope marb, type rw */
115typedef struct {
116 unsigned int bp0 : 1;
117 unsigned int bp1 : 1;
118 unsigned int bp2 : 1;
119 unsigned int bp3 : 1;
120 unsigned int dummy1 : 28;
121} reg_marb_rw_intr_mask;
122#define REG_RD_ADDR_marb_rw_intr_mask 528
123#define REG_WR_ADDR_marb_rw_intr_mask 528
124
125/* Register rw_ack_intr, scope marb, type rw */
126typedef struct {
127 unsigned int bp0 : 1;
128 unsigned int bp1 : 1;
129 unsigned int bp2 : 1;
130 unsigned int bp3 : 1;
131 unsigned int dummy1 : 28;
132} reg_marb_rw_ack_intr;
133#define REG_RD_ADDR_marb_rw_ack_intr 532
134#define REG_WR_ADDR_marb_rw_ack_intr 532
135
136/* Register r_intr, scope marb, type r */
137typedef struct {
138 unsigned int bp0 : 1;
139 unsigned int bp1 : 1;
140 unsigned int bp2 : 1;
141 unsigned int bp3 : 1;
142 unsigned int dummy1 : 28;
143} reg_marb_r_intr;
144#define REG_RD_ADDR_marb_r_intr 536
145
146/* Register r_masked_intr, scope marb, type r */
147typedef struct {
148 unsigned int bp0 : 1;
149 unsigned int bp1 : 1;
150 unsigned int bp2 : 1;
151 unsigned int bp3 : 1;
152 unsigned int dummy1 : 28;
153} reg_marb_r_masked_intr;
154#define REG_RD_ADDR_marb_r_masked_intr 540
155
156/* Register rw_stop_mask, scope marb, type rw */
157typedef struct {
158 unsigned int dma0 : 1;
159 unsigned int dma1 : 1;
160 unsigned int dma2 : 1;
161 unsigned int dma3 : 1;
162 unsigned int dma4 : 1;
163 unsigned int dma5 : 1;
164 unsigned int dma6 : 1;
165 unsigned int dma7 : 1;
166 unsigned int dma8 : 1;
167 unsigned int dma9 : 1;
168 unsigned int cpui : 1;
169 unsigned int cpud : 1;
170 unsigned int iop : 1;
171 unsigned int slave : 1;
172 unsigned int dummy1 : 18;
173} reg_marb_rw_stop_mask;
174#define REG_RD_ADDR_marb_rw_stop_mask 544
175#define REG_WR_ADDR_marb_rw_stop_mask 544
176
177/* Register r_stopped, scope marb, type r */
178typedef struct {
179 unsigned int dma0 : 1;
180 unsigned int dma1 : 1;
181 unsigned int dma2 : 1;
182 unsigned int dma3 : 1;
183 unsigned int dma4 : 1;
184 unsigned int dma5 : 1;
185 unsigned int dma6 : 1;
186 unsigned int dma7 : 1;
187 unsigned int dma8 : 1;
188 unsigned int dma9 : 1;
189 unsigned int cpui : 1;
190 unsigned int cpud : 1;
191 unsigned int iop : 1;
192 unsigned int slave : 1;
193 unsigned int dummy1 : 18;
194} reg_marb_r_stopped;
195#define REG_RD_ADDR_marb_r_stopped 548
196
197/* Register rw_no_snoop, scope marb, type rw */
198typedef struct {
199 unsigned int dma0 : 1;
200 unsigned int dma1 : 1;
201 unsigned int dma2 : 1;
202 unsigned int dma3 : 1;
203 unsigned int dma4 : 1;
204 unsigned int dma5 : 1;
205 unsigned int dma6 : 1;
206 unsigned int dma7 : 1;
207 unsigned int dma8 : 1;
208 unsigned int dma9 : 1;
209 unsigned int cpui : 1;
210 unsigned int cpud : 1;
211 unsigned int iop : 1;
212 unsigned int slave : 1;
213 unsigned int dummy1 : 18;
214} reg_marb_rw_no_snoop;
215#define REG_RD_ADDR_marb_rw_no_snoop 832
216#define REG_WR_ADDR_marb_rw_no_snoop 832
217
218/* Register rw_no_snoop_rq, scope marb, type rw */
219typedef struct {
220 unsigned int dummy1 : 10;
221 unsigned int cpui : 1;
222 unsigned int cpud : 1;
223 unsigned int dummy2 : 20;
224} reg_marb_rw_no_snoop_rq;
225#define REG_RD_ADDR_marb_rw_no_snoop_rq 836
226#define REG_WR_ADDR_marb_rw_no_snoop_rq 836
227
228
229/* Constants */
230enum {
231 regk_marb_cpud = 0x0000000b,
232 regk_marb_cpui = 0x0000000a,
233 regk_marb_dma0 = 0x00000000,
234 regk_marb_dma1 = 0x00000001,
235 regk_marb_dma2 = 0x00000002,
236 regk_marb_dma3 = 0x00000003,
237 regk_marb_dma4 = 0x00000004,
238 regk_marb_dma5 = 0x00000005,
239 regk_marb_dma6 = 0x00000006,
240 regk_marb_dma7 = 0x00000007,
241 regk_marb_dma8 = 0x00000008,
242 regk_marb_dma9 = 0x00000009,
243 regk_marb_iop = 0x0000000c,
244 regk_marb_no = 0x00000000,
245 regk_marb_r_stopped_default = 0x00000000,
246 regk_marb_rw_ext_slots_default = 0x00000000,
247 regk_marb_rw_ext_slots_size = 0x00000040,
248 regk_marb_rw_int_slots_default = 0x00000000,
249 regk_marb_rw_int_slots_size = 0x00000040,
250 regk_marb_rw_intr_mask_default = 0x00000000,
251 regk_marb_rw_no_snoop_default = 0x00000000,
252 regk_marb_rw_no_snoop_rq_default = 0x00000000,
253 regk_marb_rw_regs_slots_default = 0x00000000,
254 regk_marb_rw_regs_slots_size = 0x00000004,
255 regk_marb_rw_stop_mask_default = 0x00000000,
256 regk_marb_slave = 0x0000000d,
257 regk_marb_yes = 0x00000001
258};
259#endif /* __marb_defs_h */
260#ifndef __marb_bp_defs_h
261#define __marb_bp_defs_h
262
263/*
264 * This file is autogenerated from
265 * file: ../../inst/memarb/rtl/guinness/marb_top.r
266 * id: <not found>
267 * last modfied: Mon Apr 11 16:12:16 2005
268 *
269 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile marb_defs.h ../../inst/memarb/rtl/guinness/marb_top.r
270 * id: $Id: marb_defs.h,v 1.3 2005/04/24 18:30:58 starvik Exp $
271 * Any changes here will be lost.
272 *
273 * -*- buffer-read-only: t -*-
274 */
275/* Main access macros */
276#ifndef REG_RD
277#define REG_RD( scope, inst, reg ) \
278 REG_READ( reg_##scope##_##reg, \
279 (inst) + REG_RD_ADDR_##scope##_##reg )
280#endif
281
282#ifndef REG_WR
283#define REG_WR( scope, inst, reg, val ) \
284 REG_WRITE( reg_##scope##_##reg, \
285 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
286#endif
287
288#ifndef REG_RD_VECT
289#define REG_RD_VECT( scope, inst, reg, index ) \
290 REG_READ( reg_##scope##_##reg, \
291 (inst) + REG_RD_ADDR_##scope##_##reg + \
292 (index) * STRIDE_##scope##_##reg )
293#endif
294
295#ifndef REG_WR_VECT
296#define REG_WR_VECT( scope, inst, reg, index, val ) \
297 REG_WRITE( reg_##scope##_##reg, \
298 (inst) + REG_WR_ADDR_##scope##_##reg + \
299 (index) * STRIDE_##scope##_##reg, (val) )
300#endif
301
302#ifndef REG_RD_INT
303#define REG_RD_INT( scope, inst, reg ) \
304 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
305#endif
306
307#ifndef REG_WR_INT
308#define REG_WR_INT( scope, inst, reg, val ) \
309 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
310#endif
311
312#ifndef REG_RD_INT_VECT
313#define REG_RD_INT_VECT( scope, inst, reg, index ) \
314 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
315 (index) * STRIDE_##scope##_##reg )
316#endif
317
318#ifndef REG_WR_INT_VECT
319#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
320 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
321 (index) * STRIDE_##scope##_##reg, (val) )
322#endif
323
324#ifndef REG_TYPE_CONV
325#define REG_TYPE_CONV( type, orgtype, val ) \
326 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
327#endif
328
329#ifndef reg_page_size
330#define reg_page_size 8192
331#endif
332
333#ifndef REG_ADDR
334#define REG_ADDR( scope, inst, reg ) \
335 ( (inst) + REG_RD_ADDR_##scope##_##reg )
336#endif
337
338#ifndef REG_ADDR_VECT
339#define REG_ADDR_VECT( scope, inst, reg, index ) \
340 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
341 (index) * STRIDE_##scope##_##reg )
342#endif
343
344/* C-code for register scope marb_bp */
345
346/* Register rw_first_addr, scope marb_bp, type rw */
347typedef unsigned int reg_marb_bp_rw_first_addr;
348#define REG_RD_ADDR_marb_bp_rw_first_addr 0
349#define REG_WR_ADDR_marb_bp_rw_first_addr 0
350
351/* Register rw_last_addr, scope marb_bp, type rw */
352typedef unsigned int reg_marb_bp_rw_last_addr;
353#define REG_RD_ADDR_marb_bp_rw_last_addr 4
354#define REG_WR_ADDR_marb_bp_rw_last_addr 4
355
356/* Register rw_op, scope marb_bp, type rw */
357typedef struct {
358 unsigned int rd : 1;
359 unsigned int wr : 1;
360 unsigned int rd_excl : 1;
361 unsigned int pri_wr : 1;
362 unsigned int us_rd : 1;
363 unsigned int us_wr : 1;
364 unsigned int us_rd_excl : 1;
365 unsigned int us_pri_wr : 1;
366 unsigned int dummy1 : 24;
367} reg_marb_bp_rw_op;
368#define REG_RD_ADDR_marb_bp_rw_op 8
369#define REG_WR_ADDR_marb_bp_rw_op 8
370
371/* Register rw_clients, scope marb_bp, type rw */
372typedef struct {
373 unsigned int dma0 : 1;
374 unsigned int dma1 : 1;
375 unsigned int dma2 : 1;
376 unsigned int dma3 : 1;
377 unsigned int dma4 : 1;
378 unsigned int dma5 : 1;
379 unsigned int dma6 : 1;
380 unsigned int dma7 : 1;
381 unsigned int dma8 : 1;
382 unsigned int dma9 : 1;
383 unsigned int cpui : 1;
384 unsigned int cpud : 1;
385 unsigned int iop : 1;
386 unsigned int slave : 1;
387 unsigned int dummy1 : 18;
388} reg_marb_bp_rw_clients;
389#define REG_RD_ADDR_marb_bp_rw_clients 12
390#define REG_WR_ADDR_marb_bp_rw_clients 12
391
392/* Register rw_options, scope marb_bp, type rw */
393typedef struct {
394 unsigned int wrap : 1;
395 unsigned int dummy1 : 31;
396} reg_marb_bp_rw_options;
397#define REG_RD_ADDR_marb_bp_rw_options 16
398#define REG_WR_ADDR_marb_bp_rw_options 16
399
400/* Register r_brk_addr, scope marb_bp, type r */
401typedef unsigned int reg_marb_bp_r_brk_addr;
402#define REG_RD_ADDR_marb_bp_r_brk_addr 20
403
404/* Register r_brk_op, scope marb_bp, type r */
405typedef struct {
406 unsigned int rd : 1;
407 unsigned int wr : 1;
408 unsigned int rd_excl : 1;
409 unsigned int pri_wr : 1;
410 unsigned int us_rd : 1;
411 unsigned int us_wr : 1;
412 unsigned int us_rd_excl : 1;
413 unsigned int us_pri_wr : 1;
414 unsigned int dummy1 : 24;
415} reg_marb_bp_r_brk_op;
416#define REG_RD_ADDR_marb_bp_r_brk_op 24
417
418/* Register r_brk_clients, scope marb_bp, type r */
419typedef struct {
420 unsigned int dma0 : 1;
421 unsigned int dma1 : 1;
422 unsigned int dma2 : 1;
423 unsigned int dma3 : 1;
424 unsigned int dma4 : 1;
425 unsigned int dma5 : 1;
426 unsigned int dma6 : 1;
427 unsigned int dma7 : 1;
428 unsigned int dma8 : 1;
429 unsigned int dma9 : 1;
430 unsigned int cpui : 1;
431 unsigned int cpud : 1;
432 unsigned int iop : 1;
433 unsigned int slave : 1;
434 unsigned int dummy1 : 18;
435} reg_marb_bp_r_brk_clients;
436#define REG_RD_ADDR_marb_bp_r_brk_clients 28
437
438/* Register r_brk_first_client, scope marb_bp, type r */
439typedef struct {
440 unsigned int dma0 : 1;
441 unsigned int dma1 : 1;
442 unsigned int dma2 : 1;
443 unsigned int dma3 : 1;
444 unsigned int dma4 : 1;
445 unsigned int dma5 : 1;
446 unsigned int dma6 : 1;
447 unsigned int dma7 : 1;
448 unsigned int dma8 : 1;
449 unsigned int dma9 : 1;
450 unsigned int cpui : 1;
451 unsigned int cpud : 1;
452 unsigned int iop : 1;
453 unsigned int slave : 1;
454 unsigned int dummy1 : 18;
455} reg_marb_bp_r_brk_first_client;
456#define REG_RD_ADDR_marb_bp_r_brk_first_client 32
457
458/* Register r_brk_size, scope marb_bp, type r */
459typedef unsigned int reg_marb_bp_r_brk_size;
460#define REG_RD_ADDR_marb_bp_r_brk_size 36
461
462/* Register rw_ack, scope marb_bp, type rw */
463typedef unsigned int reg_marb_bp_rw_ack;
464#define REG_RD_ADDR_marb_bp_rw_ack 40
465#define REG_WR_ADDR_marb_bp_rw_ack 40
466
467
468/* Constants */
469enum {
470 regk_marb_bp_no = 0x00000000,
471 regk_marb_bp_rw_op_default = 0x00000000,
472 regk_marb_bp_rw_options_default = 0x00000000,
473 regk_marb_bp_yes = 0x00000001
474};
475#endif /* __marb_bp_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/pinmux_defs.h b/include/asm-cris/arch-v32/hwregs/pinmux_defs.h
new file mode 100644
index 000000000000..9d91c2de1b07
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/pinmux_defs.h
@@ -0,0 +1,357 @@
1#ifndef __pinmux_defs_h
2#define __pinmux_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/pinmux/rtl/guinness/pinmux_regs.r
7 * id: pinmux_regs.r,v 1.40 2005/02/09 16:22:59 perz Exp
8 * last modfied: Mon Apr 11 16:09:11 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile pinmux_defs.h ../../inst/pinmux/rtl/guinness/pinmux_regs.r
11 * id: $Id: pinmux_defs.h,v 1.3 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope pinmux */
86
87/* Register rw_pa, scope pinmux, type rw */
88typedef struct {
89 unsigned int pa0 : 1;
90 unsigned int pa1 : 1;
91 unsigned int pa2 : 1;
92 unsigned int pa3 : 1;
93 unsigned int pa4 : 1;
94 unsigned int pa5 : 1;
95 unsigned int pa6 : 1;
96 unsigned int pa7 : 1;
97 unsigned int csp2_n : 1;
98 unsigned int csp3_n : 1;
99 unsigned int csp5_n : 1;
100 unsigned int csp6_n : 1;
101 unsigned int hsh4 : 1;
102 unsigned int hsh5 : 1;
103 unsigned int hsh6 : 1;
104 unsigned int hsh7 : 1;
105 unsigned int dummy1 : 16;
106} reg_pinmux_rw_pa;
107#define REG_RD_ADDR_pinmux_rw_pa 0
108#define REG_WR_ADDR_pinmux_rw_pa 0
109
110/* Register rw_hwprot, scope pinmux, type rw */
111typedef struct {
112 unsigned int ser1 : 1;
113 unsigned int ser2 : 1;
114 unsigned int ser3 : 1;
115 unsigned int sser0 : 1;
116 unsigned int sser1 : 1;
117 unsigned int ata0 : 1;
118 unsigned int ata1 : 1;
119 unsigned int ata2 : 1;
120 unsigned int ata3 : 1;
121 unsigned int ata : 1;
122 unsigned int eth1 : 1;
123 unsigned int eth1_mgm : 1;
124 unsigned int timer : 1;
125 unsigned int p21 : 1;
126 unsigned int dummy1 : 18;
127} reg_pinmux_rw_hwprot;
128#define REG_RD_ADDR_pinmux_rw_hwprot 4
129#define REG_WR_ADDR_pinmux_rw_hwprot 4
130
131/* Register rw_pb_gio, scope pinmux, type rw */
132typedef struct {
133 unsigned int pb0 : 1;
134 unsigned int pb1 : 1;
135 unsigned int pb2 : 1;
136 unsigned int pb3 : 1;
137 unsigned int pb4 : 1;
138 unsigned int pb5 : 1;
139 unsigned int pb6 : 1;
140 unsigned int pb7 : 1;
141 unsigned int pb8 : 1;
142 unsigned int pb9 : 1;
143 unsigned int pb10 : 1;
144 unsigned int pb11 : 1;
145 unsigned int pb12 : 1;
146 unsigned int pb13 : 1;
147 unsigned int pb14 : 1;
148 unsigned int pb15 : 1;
149 unsigned int pb16 : 1;
150 unsigned int pb17 : 1;
151 unsigned int dummy1 : 14;
152} reg_pinmux_rw_pb_gio;
153#define REG_RD_ADDR_pinmux_rw_pb_gio 8
154#define REG_WR_ADDR_pinmux_rw_pb_gio 8
155
156/* Register rw_pb_iop, scope pinmux, type rw */
157typedef struct {
158 unsigned int pb0 : 1;
159 unsigned int pb1 : 1;
160 unsigned int pb2 : 1;
161 unsigned int pb3 : 1;
162 unsigned int pb4 : 1;
163 unsigned int pb5 : 1;
164 unsigned int pb6 : 1;
165 unsigned int pb7 : 1;
166 unsigned int pb8 : 1;
167 unsigned int pb9 : 1;
168 unsigned int pb10 : 1;
169 unsigned int pb11 : 1;
170 unsigned int pb12 : 1;
171 unsigned int pb13 : 1;
172 unsigned int pb14 : 1;
173 unsigned int pb15 : 1;
174 unsigned int pb16 : 1;
175 unsigned int pb17 : 1;
176 unsigned int dummy1 : 14;
177} reg_pinmux_rw_pb_iop;
178#define REG_RD_ADDR_pinmux_rw_pb_iop 12
179#define REG_WR_ADDR_pinmux_rw_pb_iop 12
180
181/* Register rw_pc_gio, scope pinmux, type rw */
182typedef struct {
183 unsigned int pc0 : 1;
184 unsigned int pc1 : 1;
185 unsigned int pc2 : 1;
186 unsigned int pc3 : 1;
187 unsigned int pc4 : 1;
188 unsigned int pc5 : 1;
189 unsigned int pc6 : 1;
190 unsigned int pc7 : 1;
191 unsigned int pc8 : 1;
192 unsigned int pc9 : 1;
193 unsigned int pc10 : 1;
194 unsigned int pc11 : 1;
195 unsigned int pc12 : 1;
196 unsigned int pc13 : 1;
197 unsigned int pc14 : 1;
198 unsigned int pc15 : 1;
199 unsigned int pc16 : 1;
200 unsigned int pc17 : 1;
201 unsigned int dummy1 : 14;
202} reg_pinmux_rw_pc_gio;
203#define REG_RD_ADDR_pinmux_rw_pc_gio 16
204#define REG_WR_ADDR_pinmux_rw_pc_gio 16
205
206/* Register rw_pc_iop, scope pinmux, type rw */
207typedef struct {
208 unsigned int pc0 : 1;
209 unsigned int pc1 : 1;
210 unsigned int pc2 : 1;
211 unsigned int pc3 : 1;
212 unsigned int pc4 : 1;
213 unsigned int pc5 : 1;
214 unsigned int pc6 : 1;
215 unsigned int pc7 : 1;
216 unsigned int pc8 : 1;
217 unsigned int pc9 : 1;
218 unsigned int pc10 : 1;
219 unsigned int pc11 : 1;
220 unsigned int pc12 : 1;
221 unsigned int pc13 : 1;
222 unsigned int pc14 : 1;
223 unsigned int pc15 : 1;
224 unsigned int pc16 : 1;
225 unsigned int pc17 : 1;
226 unsigned int dummy1 : 14;
227} reg_pinmux_rw_pc_iop;
228#define REG_RD_ADDR_pinmux_rw_pc_iop 20
229#define REG_WR_ADDR_pinmux_rw_pc_iop 20
230
231/* Register rw_pd_gio, scope pinmux, type rw */
232typedef struct {
233 unsigned int pd0 : 1;
234 unsigned int pd1 : 1;
235 unsigned int pd2 : 1;
236 unsigned int pd3 : 1;
237 unsigned int pd4 : 1;
238 unsigned int pd5 : 1;
239 unsigned int pd6 : 1;
240 unsigned int pd7 : 1;
241 unsigned int pd8 : 1;
242 unsigned int pd9 : 1;
243 unsigned int pd10 : 1;
244 unsigned int pd11 : 1;
245 unsigned int pd12 : 1;
246 unsigned int pd13 : 1;
247 unsigned int pd14 : 1;
248 unsigned int pd15 : 1;
249 unsigned int pd16 : 1;
250 unsigned int pd17 : 1;
251 unsigned int dummy1 : 14;
252} reg_pinmux_rw_pd_gio;
253#define REG_RD_ADDR_pinmux_rw_pd_gio 24
254#define REG_WR_ADDR_pinmux_rw_pd_gio 24
255
256/* Register rw_pd_iop, scope pinmux, type rw */
257typedef struct {
258 unsigned int pd0 : 1;
259 unsigned int pd1 : 1;
260 unsigned int pd2 : 1;
261 unsigned int pd3 : 1;
262 unsigned int pd4 : 1;
263 unsigned int pd5 : 1;
264 unsigned int pd6 : 1;
265 unsigned int pd7 : 1;
266 unsigned int pd8 : 1;
267 unsigned int pd9 : 1;
268 unsigned int pd10 : 1;
269 unsigned int pd11 : 1;
270 unsigned int pd12 : 1;
271 unsigned int pd13 : 1;
272 unsigned int pd14 : 1;
273 unsigned int pd15 : 1;
274 unsigned int pd16 : 1;
275 unsigned int pd17 : 1;
276 unsigned int dummy1 : 14;
277} reg_pinmux_rw_pd_iop;
278#define REG_RD_ADDR_pinmux_rw_pd_iop 28
279#define REG_WR_ADDR_pinmux_rw_pd_iop 28
280
281/* Register rw_pe_gio, scope pinmux, type rw */
282typedef struct {
283 unsigned int pe0 : 1;
284 unsigned int pe1 : 1;
285 unsigned int pe2 : 1;
286 unsigned int pe3 : 1;
287 unsigned int pe4 : 1;
288 unsigned int pe5 : 1;
289 unsigned int pe6 : 1;
290 unsigned int pe7 : 1;
291 unsigned int pe8 : 1;
292 unsigned int pe9 : 1;
293 unsigned int pe10 : 1;
294 unsigned int pe11 : 1;
295 unsigned int pe12 : 1;
296 unsigned int pe13 : 1;
297 unsigned int pe14 : 1;
298 unsigned int pe15 : 1;
299 unsigned int pe16 : 1;
300 unsigned int pe17 : 1;
301 unsigned int dummy1 : 14;
302} reg_pinmux_rw_pe_gio;
303#define REG_RD_ADDR_pinmux_rw_pe_gio 32
304#define REG_WR_ADDR_pinmux_rw_pe_gio 32
305
306/* Register rw_pe_iop, scope pinmux, type rw */
307typedef struct {
308 unsigned int pe0 : 1;
309 unsigned int pe1 : 1;
310 unsigned int pe2 : 1;
311 unsigned int pe3 : 1;
312 unsigned int pe4 : 1;
313 unsigned int pe5 : 1;
314 unsigned int pe6 : 1;
315 unsigned int pe7 : 1;
316 unsigned int pe8 : 1;
317 unsigned int pe9 : 1;
318 unsigned int pe10 : 1;
319 unsigned int pe11 : 1;
320 unsigned int pe12 : 1;
321 unsigned int pe13 : 1;
322 unsigned int pe14 : 1;
323 unsigned int pe15 : 1;
324 unsigned int pe16 : 1;
325 unsigned int pe17 : 1;
326 unsigned int dummy1 : 14;
327} reg_pinmux_rw_pe_iop;
328#define REG_RD_ADDR_pinmux_rw_pe_iop 36
329#define REG_WR_ADDR_pinmux_rw_pe_iop 36
330
331/* Register rw_usb_phy, scope pinmux, type rw */
332typedef struct {
333 unsigned int en_usb0 : 1;
334 unsigned int en_usb1 : 1;
335 unsigned int dummy1 : 30;
336} reg_pinmux_rw_usb_phy;
337#define REG_RD_ADDR_pinmux_rw_usb_phy 40
338#define REG_WR_ADDR_pinmux_rw_usb_phy 40
339
340
341/* Constants */
342enum {
343 regk_pinmux_no = 0x00000000,
344 regk_pinmux_rw_hwprot_default = 0x00000000,
345 regk_pinmux_rw_pa_default = 0x00000000,
346 regk_pinmux_rw_pb_gio_default = 0x00000000,
347 regk_pinmux_rw_pb_iop_default = 0x00000000,
348 regk_pinmux_rw_pc_gio_default = 0x00000000,
349 regk_pinmux_rw_pc_iop_default = 0x00000000,
350 regk_pinmux_rw_pd_gio_default = 0x00000000,
351 regk_pinmux_rw_pd_iop_default = 0x00000000,
352 regk_pinmux_rw_pe_gio_default = 0x00000000,
353 regk_pinmux_rw_pe_iop_default = 0x00000000,
354 regk_pinmux_rw_usb_phy_default = 0x00000000,
355 regk_pinmux_yes = 0x00000001
356};
357#endif /* __pinmux_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/reg_map.h b/include/asm-cris/arch-v32/hwregs/reg_map.h
new file mode 100644
index 000000000000..e31502838ec6
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/reg_map.h
@@ -0,0 +1,103 @@
1#ifndef __reg_map_h
2#define __reg_map_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../mod/fakereg.rmap
7 * id: fakereg.rmap,v 1.3 2004/02/11 19:53:22 ronny Exp
8 * last modified: Wed Feb 11 20:53:25 2004
9 * file: ../../rtl/global.rmap
10 * id: global.rmap,v 1.3 2003/08/18 15:08:23 mikaeln Exp
11 * last modified: Mon Aug 18 17:08:23 2003
12 * file: ../../mod/modreg.rmap
13 * id: modreg.rmap,v 1.31 2004/02/20 15:40:04 stefans Exp
14 * last modified: Fri Feb 20 16:40:04 2004
15 *
16 * by /n/asic/design/tools/rdesc/src/rdes2c -map -base 0xb0000000 ../../rtl/global.rmap ../../mod/modreg.rmap ../../inst/io_proc/rtl/guinness/iop_top.r ../../inst/memarb/rtl/guinness/marb_top.r ../../mod/fakereg.rmap
17 * id: $Id: reg_map.h,v 1.7 2005/04/24 18:30:58 starvik Exp $
18 * Any changes here will be lost.
19 *
20 * -*- buffer-read-only: t -*-
21 */
22typedef enum {
23 regi_ata = 0xb0032000,
24 regi_bif_core = 0xb0014000,
25 regi_bif_dma = 0xb0016000,
26 regi_bif_slave = 0xb0018000,
27 regi_config = 0xb003c000,
28 regi_dma0 = 0xb0000000,
29 regi_dma1 = 0xb0002000,
30 regi_dma2 = 0xb0004000,
31 regi_dma3 = 0xb0006000,
32 regi_dma4 = 0xb0008000,
33 regi_dma5 = 0xb000a000,
34 regi_dma6 = 0xb000c000,
35 regi_dma7 = 0xb000e000,
36 regi_dma8 = 0xb0010000,
37 regi_dma9 = 0xb0012000,
38 regi_eth0 = 0xb0034000,
39 regi_eth1 = 0xb0036000,
40 regi_gio = 0xb001a000,
41 regi_iop = 0xb0020000,
42 regi_iop_version = 0xb0020000,
43 regi_iop_fifo_in0_extra = 0xb0020040,
44 regi_iop_fifo_in1_extra = 0xb0020080,
45 regi_iop_fifo_out0_extra = 0xb00200c0,
46 regi_iop_fifo_out1_extra = 0xb0020100,
47 regi_iop_trigger_grp0 = 0xb0020140,
48 regi_iop_trigger_grp1 = 0xb0020180,
49 regi_iop_trigger_grp2 = 0xb00201c0,
50 regi_iop_trigger_grp3 = 0xb0020200,
51 regi_iop_trigger_grp4 = 0xb0020240,
52 regi_iop_trigger_grp5 = 0xb0020280,
53 regi_iop_trigger_grp6 = 0xb00202c0,
54 regi_iop_trigger_grp7 = 0xb0020300,
55 regi_iop_crc_par0 = 0xb0020380,
56 regi_iop_crc_par1 = 0xb0020400,
57 regi_iop_dmc_in0 = 0xb0020480,
58 regi_iop_dmc_in1 = 0xb0020500,
59 regi_iop_dmc_out0 = 0xb0020580,
60 regi_iop_dmc_out1 = 0xb0020600,
61 regi_iop_fifo_in0 = 0xb0020680,
62 regi_iop_fifo_in1 = 0xb0020700,
63 regi_iop_fifo_out0 = 0xb0020780,
64 regi_iop_fifo_out1 = 0xb0020800,
65 regi_iop_scrc_in0 = 0xb0020880,
66 regi_iop_scrc_in1 = 0xb0020900,
67 regi_iop_scrc_out0 = 0xb0020980,
68 regi_iop_scrc_out1 = 0xb0020a00,
69 regi_iop_timer_grp0 = 0xb0020a80,
70 regi_iop_timer_grp1 = 0xb0020b00,
71 regi_iop_timer_grp2 = 0xb0020b80,
72 regi_iop_timer_grp3 = 0xb0020c00,
73 regi_iop_sap_in = 0xb0020d00,
74 regi_iop_sap_out = 0xb0020e00,
75 regi_iop_spu0 = 0xb0020f00,
76 regi_iop_spu1 = 0xb0021000,
77 regi_iop_sw_cfg = 0xb0021100,
78 regi_iop_sw_cpu = 0xb0021200,
79 regi_iop_sw_mpu = 0xb0021300,
80 regi_iop_sw_spu0 = 0xb0021400,
81 regi_iop_sw_spu1 = 0xb0021500,
82 regi_iop_mpu = 0xb0021600,
83 regi_irq = 0xb001c000,
84 regi_irq2 = 0xb005c000,
85 regi_marb = 0xb003e000,
86 regi_marb_bp0 = 0xb003e240,
87 regi_marb_bp1 = 0xb003e280,
88 regi_marb_bp2 = 0xb003e2c0,
89 regi_marb_bp3 = 0xb003e300,
90 regi_pinmux = 0xb0038000,
91 regi_ser0 = 0xb0026000,
92 regi_ser1 = 0xb0028000,
93 regi_ser2 = 0xb002a000,
94 regi_ser3 = 0xb002c000,
95 regi_sser0 = 0xb0022000,
96 regi_sser1 = 0xb0024000,
97 regi_strcop = 0xb0030000,
98 regi_strmux = 0xb003a000,
99 regi_timer = 0xb001e000,
100 regi_timer2 = 0xb005e000,
101 regi_trace = 0xb0040000,
102} reg_scope_instances;
103#endif /* __reg_map_h */
diff --git a/include/asm-cris/arch-v32/hwregs/reg_rdwr.h b/include/asm-cris/arch-v32/hwregs/reg_rdwr.h
new file mode 100644
index 000000000000..44e60233c68f
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/reg_rdwr.h
@@ -0,0 +1,15 @@
1/* $Id: reg_rdwr.h,v 1.6 2005/04/24 18:30:58 starvik Exp $
2 *
3 * Read/write register macros used by *_defs.h
4 */
5
6#ifndef reg_rdwr_h
7#define reg_rdwr_h
8
9
10#define REG_READ(type, addr) *((volatile type *) (addr))
11
12#define REG_WRITE(type, addr, val) \
13 do { *((volatile type *) (addr)) = (val); } while(0)
14
15#endif
diff --git a/include/asm-cris/arch-v32/hwregs/rt_trace_defs.h b/include/asm-cris/arch-v32/hwregs/rt_trace_defs.h
new file mode 100644
index 000000000000..d9f0e924fb23
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/rt_trace_defs.h
@@ -0,0 +1,173 @@
1#ifndef __rt_trace_defs_h
2#define __rt_trace_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/rt_trace/rtl/rt_regs.r
7 * id: rt_regs.r,v 1.18 2005/02/08 15:45:00 stefans Exp
8 * last modfied: Mon Apr 11 16:09:14 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile rt_trace_defs.h ../../inst/rt_trace/rtl/rt_regs.r
11 * id: $Id: rt_trace_defs.h,v 1.1 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope rt_trace */
86
87/* Register rw_cfg, scope rt_trace, type rw */
88typedef struct {
89 unsigned int en : 1;
90 unsigned int mode : 1;
91 unsigned int owner : 1;
92 unsigned int wp : 1;
93 unsigned int stall : 1;
94 unsigned int dummy1 : 3;
95 unsigned int wp_start : 7;
96 unsigned int dummy2 : 1;
97 unsigned int wp_stop : 7;
98 unsigned int dummy3 : 9;
99} reg_rt_trace_rw_cfg;
100#define REG_RD_ADDR_rt_trace_rw_cfg 0
101#define REG_WR_ADDR_rt_trace_rw_cfg 0
102
103/* Register rw_tap_ctrl, scope rt_trace, type rw */
104typedef struct {
105 unsigned int ack_data : 1;
106 unsigned int ack_guru : 1;
107 unsigned int dummy1 : 30;
108} reg_rt_trace_rw_tap_ctrl;
109#define REG_RD_ADDR_rt_trace_rw_tap_ctrl 4
110#define REG_WR_ADDR_rt_trace_rw_tap_ctrl 4
111
112/* Register r_tap_stat, scope rt_trace, type r */
113typedef struct {
114 unsigned int dav : 1;
115 unsigned int empty : 1;
116 unsigned int dummy1 : 30;
117} reg_rt_trace_r_tap_stat;
118#define REG_RD_ADDR_rt_trace_r_tap_stat 8
119
120/* Register rw_tap_data, scope rt_trace, type rw */
121typedef unsigned int reg_rt_trace_rw_tap_data;
122#define REG_RD_ADDR_rt_trace_rw_tap_data 12
123#define REG_WR_ADDR_rt_trace_rw_tap_data 12
124
125/* Register rw_tap_hdata, scope rt_trace, type rw */
126typedef struct {
127 unsigned int op : 4;
128 unsigned int sub_op : 4;
129 unsigned int dummy1 : 24;
130} reg_rt_trace_rw_tap_hdata;
131#define REG_RD_ADDR_rt_trace_rw_tap_hdata 16
132#define REG_WR_ADDR_rt_trace_rw_tap_hdata 16
133
134/* Register r_redir, scope rt_trace, type r */
135typedef unsigned int reg_rt_trace_r_redir;
136#define REG_RD_ADDR_rt_trace_r_redir 20
137
138
139/* Constants */
140enum {
141 regk_rt_trace_brk = 0x0000000c,
142 regk_rt_trace_dbg = 0x00000003,
143 regk_rt_trace_dbgdi = 0x00000004,
144 regk_rt_trace_dbgdo = 0x00000005,
145 regk_rt_trace_gmode = 0x00000000,
146 regk_rt_trace_no = 0x00000000,
147 regk_rt_trace_nop = 0x00000000,
148 regk_rt_trace_normal = 0x00000000,
149 regk_rt_trace_rdmem = 0x00000007,
150 regk_rt_trace_rdmemb = 0x00000009,
151 regk_rt_trace_rdpreg = 0x00000002,
152 regk_rt_trace_rdreg = 0x00000001,
153 regk_rt_trace_rdsreg = 0x00000003,
154 regk_rt_trace_redir = 0x00000006,
155 regk_rt_trace_ret = 0x0000000b,
156 regk_rt_trace_rw_cfg_default = 0x00000000,
157 regk_rt_trace_trcfg = 0x00000001,
158 regk_rt_trace_wp = 0x00000001,
159 regk_rt_trace_wp0 = 0x00000001,
160 regk_rt_trace_wp1 = 0x00000002,
161 regk_rt_trace_wp2 = 0x00000004,
162 regk_rt_trace_wp3 = 0x00000008,
163 regk_rt_trace_wp4 = 0x00000010,
164 regk_rt_trace_wp5 = 0x00000020,
165 regk_rt_trace_wp6 = 0x00000040,
166 regk_rt_trace_wrmem = 0x00000008,
167 regk_rt_trace_wrmemb = 0x0000000a,
168 regk_rt_trace_wrpreg = 0x00000005,
169 regk_rt_trace_wrreg = 0x00000004,
170 regk_rt_trace_wrsreg = 0x00000006,
171 regk_rt_trace_yes = 0x00000001
172};
173#endif /* __rt_trace_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/ser_defs.h b/include/asm-cris/arch-v32/hwregs/ser_defs.h
new file mode 100644
index 000000000000..01c2fab97d43
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/ser_defs.h
@@ -0,0 +1,308 @@
1#ifndef __ser_defs_h
2#define __ser_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/ser/rtl/ser_regs.r
7 * id: ser_regs.r,v 1.23 2005/02/08 13:58:35 perz Exp
8 * last modfied: Mon Apr 11 16:09:21 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile ser_defs.h ../../inst/ser/rtl/ser_regs.r
11 * id: $Id: ser_defs.h,v 1.10 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope ser */
86
87/* Register rw_tr_ctrl, scope ser, type rw */
88typedef struct {
89 unsigned int base_freq : 3;
90 unsigned int en : 1;
91 unsigned int par : 2;
92 unsigned int par_en : 1;
93 unsigned int data_bits : 1;
94 unsigned int stop_bits : 1;
95 unsigned int stop : 1;
96 unsigned int rts_delay : 3;
97 unsigned int rts_setup : 1;
98 unsigned int auto_rts : 1;
99 unsigned int txd : 1;
100 unsigned int auto_cts : 1;
101 unsigned int dummy1 : 15;
102} reg_ser_rw_tr_ctrl;
103#define REG_RD_ADDR_ser_rw_tr_ctrl 0
104#define REG_WR_ADDR_ser_rw_tr_ctrl 0
105
106/* Register rw_tr_dma_en, scope ser, type rw */
107typedef struct {
108 unsigned int en : 1;
109 unsigned int dummy1 : 31;
110} reg_ser_rw_tr_dma_en;
111#define REG_RD_ADDR_ser_rw_tr_dma_en 4
112#define REG_WR_ADDR_ser_rw_tr_dma_en 4
113
114/* Register rw_rec_ctrl, scope ser, type rw */
115typedef struct {
116 unsigned int base_freq : 3;
117 unsigned int en : 1;
118 unsigned int par : 2;
119 unsigned int par_en : 1;
120 unsigned int data_bits : 1;
121 unsigned int dma_mode : 1;
122 unsigned int dma_err : 1;
123 unsigned int sampling : 1;
124 unsigned int timeout : 3;
125 unsigned int auto_eop : 1;
126 unsigned int half_duplex : 1;
127 unsigned int rts_n : 1;
128 unsigned int loopback : 1;
129 unsigned int dummy1 : 14;
130} reg_ser_rw_rec_ctrl;
131#define REG_RD_ADDR_ser_rw_rec_ctrl 8
132#define REG_WR_ADDR_ser_rw_rec_ctrl 8
133
134/* Register rw_tr_baud_div, scope ser, type rw */
135typedef struct {
136 unsigned int div : 16;
137 unsigned int dummy1 : 16;
138} reg_ser_rw_tr_baud_div;
139#define REG_RD_ADDR_ser_rw_tr_baud_div 12
140#define REG_WR_ADDR_ser_rw_tr_baud_div 12
141
142/* Register rw_rec_baud_div, scope ser, type rw */
143typedef struct {
144 unsigned int div : 16;
145 unsigned int dummy1 : 16;
146} reg_ser_rw_rec_baud_div;
147#define REG_RD_ADDR_ser_rw_rec_baud_div 16
148#define REG_WR_ADDR_ser_rw_rec_baud_div 16
149
150/* Register rw_xoff, scope ser, type rw */
151typedef struct {
152 unsigned int chr : 8;
153 unsigned int automatic : 1;
154 unsigned int dummy1 : 23;
155} reg_ser_rw_xoff;
156#define REG_RD_ADDR_ser_rw_xoff 20
157#define REG_WR_ADDR_ser_rw_xoff 20
158
159/* Register rw_xoff_clr, scope ser, type rw */
160typedef struct {
161 unsigned int clr : 1;
162 unsigned int dummy1 : 31;
163} reg_ser_rw_xoff_clr;
164#define REG_RD_ADDR_ser_rw_xoff_clr 24
165#define REG_WR_ADDR_ser_rw_xoff_clr 24
166
167/* Register rw_dout, scope ser, type rw */
168typedef struct {
169 unsigned int data : 8;
170 unsigned int dummy1 : 24;
171} reg_ser_rw_dout;
172#define REG_RD_ADDR_ser_rw_dout 28
173#define REG_WR_ADDR_ser_rw_dout 28
174
175/* Register rs_stat_din, scope ser, type rs */
176typedef struct {
177 unsigned int data : 8;
178 unsigned int dummy1 : 8;
179 unsigned int dav : 1;
180 unsigned int framing_err : 1;
181 unsigned int par_err : 1;
182 unsigned int orun : 1;
183 unsigned int rec_err : 1;
184 unsigned int rxd : 1;
185 unsigned int tr_idle : 1;
186 unsigned int tr_empty : 1;
187 unsigned int tr_rdy : 1;
188 unsigned int cts_n : 1;
189 unsigned int xoff_detect : 1;
190 unsigned int rts_n : 1;
191 unsigned int txd : 1;
192 unsigned int dummy2 : 3;
193} reg_ser_rs_stat_din;
194#define REG_RD_ADDR_ser_rs_stat_din 32
195
196/* Register r_stat_din, scope ser, type r */
197typedef struct {
198 unsigned int data : 8;
199 unsigned int dummy1 : 8;
200 unsigned int dav : 1;
201 unsigned int framing_err : 1;
202 unsigned int par_err : 1;
203 unsigned int orun : 1;
204 unsigned int rec_err : 1;
205 unsigned int rxd : 1;
206 unsigned int tr_idle : 1;
207 unsigned int tr_empty : 1;
208 unsigned int tr_rdy : 1;
209 unsigned int cts_n : 1;
210 unsigned int xoff_detect : 1;
211 unsigned int rts_n : 1;
212 unsigned int txd : 1;
213 unsigned int dummy2 : 3;
214} reg_ser_r_stat_din;
215#define REG_RD_ADDR_ser_r_stat_din 36
216
217/* Register rw_rec_eop, scope ser, type rw */
218typedef struct {
219 unsigned int set : 1;
220 unsigned int dummy1 : 31;
221} reg_ser_rw_rec_eop;
222#define REG_RD_ADDR_ser_rw_rec_eop 40
223#define REG_WR_ADDR_ser_rw_rec_eop 40
224
225/* Register rw_intr_mask, scope ser, type rw */
226typedef struct {
227 unsigned int tr_rdy : 1;
228 unsigned int tr_empty : 1;
229 unsigned int tr_idle : 1;
230 unsigned int dav : 1;
231 unsigned int dummy1 : 28;
232} reg_ser_rw_intr_mask;
233#define REG_RD_ADDR_ser_rw_intr_mask 44
234#define REG_WR_ADDR_ser_rw_intr_mask 44
235
236/* Register rw_ack_intr, scope ser, type rw */
237typedef struct {
238 unsigned int tr_rdy : 1;
239 unsigned int tr_empty : 1;
240 unsigned int tr_idle : 1;
241 unsigned int dav : 1;
242 unsigned int dummy1 : 28;
243} reg_ser_rw_ack_intr;
244#define REG_RD_ADDR_ser_rw_ack_intr 48
245#define REG_WR_ADDR_ser_rw_ack_intr 48
246
247/* Register r_intr, scope ser, type r */
248typedef struct {
249 unsigned int tr_rdy : 1;
250 unsigned int tr_empty : 1;
251 unsigned int tr_idle : 1;
252 unsigned int dav : 1;
253 unsigned int dummy1 : 28;
254} reg_ser_r_intr;
255#define REG_RD_ADDR_ser_r_intr 52
256
257/* Register r_masked_intr, scope ser, type r */
258typedef struct {
259 unsigned int tr_rdy : 1;
260 unsigned int tr_empty : 1;
261 unsigned int tr_idle : 1;
262 unsigned int dav : 1;
263 unsigned int dummy1 : 28;
264} reg_ser_r_masked_intr;
265#define REG_RD_ADDR_ser_r_masked_intr 56
266
267
268/* Constants */
269enum {
270 regk_ser_active = 0x00000000,
271 regk_ser_bits1 = 0x00000000,
272 regk_ser_bits2 = 0x00000001,
273 regk_ser_bits7 = 0x00000001,
274 regk_ser_bits8 = 0x00000000,
275 regk_ser_del0_5 = 0x00000000,
276 regk_ser_del1 = 0x00000001,
277 regk_ser_del1_5 = 0x00000002,
278 regk_ser_del2 = 0x00000003,
279 regk_ser_del2_5 = 0x00000004,
280 regk_ser_del3 = 0x00000005,
281 regk_ser_del3_5 = 0x00000006,
282 regk_ser_del4 = 0x00000007,
283 regk_ser_even = 0x00000000,
284 regk_ser_ext = 0x00000001,
285 regk_ser_f100 = 0x00000007,
286 regk_ser_f29_493 = 0x00000004,
287 regk_ser_f32 = 0x00000005,
288 regk_ser_f32_768 = 0x00000006,
289 regk_ser_ignore = 0x00000001,
290 regk_ser_inactive = 0x00000001,
291 regk_ser_majority = 0x00000001,
292 regk_ser_mark = 0x00000002,
293 regk_ser_middle = 0x00000000,
294 regk_ser_no = 0x00000000,
295 regk_ser_odd = 0x00000001,
296 regk_ser_off = 0x00000000,
297 regk_ser_rw_intr_mask_default = 0x00000000,
298 regk_ser_rw_rec_baud_div_default = 0x00000000,
299 regk_ser_rw_rec_ctrl_default = 0x00010000,
300 regk_ser_rw_tr_baud_div_default = 0x00000000,
301 regk_ser_rw_tr_ctrl_default = 0x00008000,
302 regk_ser_rw_tr_dma_en_default = 0x00000000,
303 regk_ser_rw_xoff_default = 0x00000000,
304 regk_ser_space = 0x00000003,
305 regk_ser_stop = 0x00000000,
306 regk_ser_yes = 0x00000001
307};
308#endif /* __ser_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/sser_defs.h b/include/asm-cris/arch-v32/hwregs/sser_defs.h
new file mode 100644
index 000000000000..8d1dab218b91
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/sser_defs.h
@@ -0,0 +1,331 @@
1#ifndef __sser_defs_h
2#define __sser_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/syncser/rtl/sser_regs.r
7 * id: sser_regs.r,v 1.24 2005/02/11 14:27:36 gunnard Exp
8 * last modfied: Mon Apr 11 16:09:48 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile sser_defs.h ../../inst/syncser/rtl/sser_regs.r
11 * id: $Id: sser_defs.h,v 1.3 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope sser */
86
87/* Register rw_cfg, scope sser, type rw */
88typedef struct {
89 unsigned int clk_div : 16;
90 unsigned int base_freq : 3;
91 unsigned int gate_clk : 1;
92 unsigned int clkgate_ctrl : 1;
93 unsigned int clkgate_in : 1;
94 unsigned int clk_dir : 1;
95 unsigned int clk_od_mode : 1;
96 unsigned int out_clk_pol : 1;
97 unsigned int out_clk_src : 2;
98 unsigned int clk_in_sel : 1;
99 unsigned int hold_pol : 1;
100 unsigned int prepare : 1;
101 unsigned int en : 1;
102 unsigned int dummy1 : 1;
103} reg_sser_rw_cfg;
104#define REG_RD_ADDR_sser_rw_cfg 0
105#define REG_WR_ADDR_sser_rw_cfg 0
106
107/* Register rw_frm_cfg, scope sser, type rw */
108typedef struct {
109 unsigned int wordrate : 10;
110 unsigned int rec_delay : 3;
111 unsigned int tr_delay : 3;
112 unsigned int early_wend : 1;
113 unsigned int level : 2;
114 unsigned int type : 1;
115 unsigned int clk_pol : 1;
116 unsigned int fr_in_rxclk : 1;
117 unsigned int clk_src : 1;
118 unsigned int out_off : 1;
119 unsigned int out_on : 1;
120 unsigned int frame_pin_dir : 1;
121 unsigned int frame_pin_use : 2;
122 unsigned int status_pin_dir : 1;
123 unsigned int status_pin_use : 2;
124 unsigned int dummy1 : 1;
125} reg_sser_rw_frm_cfg;
126#define REG_RD_ADDR_sser_rw_frm_cfg 4
127#define REG_WR_ADDR_sser_rw_frm_cfg 4
128
129/* Register rw_tr_cfg, scope sser, type rw */
130typedef struct {
131 unsigned int tr_en : 1;
132 unsigned int stop : 1;
133 unsigned int urun_stop : 1;
134 unsigned int eop_stop : 1;
135 unsigned int sample_size : 6;
136 unsigned int sh_dir : 1;
137 unsigned int clk_pol : 1;
138 unsigned int clk_src : 1;
139 unsigned int use_dma : 1;
140 unsigned int mode : 2;
141 unsigned int frm_src : 1;
142 unsigned int use60958 : 1;
143 unsigned int iec60958_ckdiv : 2;
144 unsigned int rate_ctrl : 1;
145 unsigned int use_md : 1;
146 unsigned int dual_i2s : 1;
147 unsigned int data_pin_use : 2;
148 unsigned int od_mode : 1;
149 unsigned int bulk_wspace : 2;
150 unsigned int dummy1 : 4;
151} reg_sser_rw_tr_cfg;
152#define REG_RD_ADDR_sser_rw_tr_cfg 8
153#define REG_WR_ADDR_sser_rw_tr_cfg 8
154
155/* Register rw_rec_cfg, scope sser, type rw */
156typedef struct {
157 unsigned int rec_en : 1;
158 unsigned int force_eop : 1;
159 unsigned int stop : 1;
160 unsigned int orun_stop : 1;
161 unsigned int eop_stop : 1;
162 unsigned int sample_size : 6;
163 unsigned int sh_dir : 1;
164 unsigned int clk_pol : 1;
165 unsigned int clk_src : 1;
166 unsigned int use_dma : 1;
167 unsigned int mode : 2;
168 unsigned int frm_src : 2;
169 unsigned int use60958 : 1;
170 unsigned int iec60958_ui_len : 5;
171 unsigned int slave2_en : 1;
172 unsigned int slave3_en : 1;
173 unsigned int fifo_thr : 2;
174 unsigned int dummy1 : 3;
175} reg_sser_rw_rec_cfg;
176#define REG_RD_ADDR_sser_rw_rec_cfg 12
177#define REG_WR_ADDR_sser_rw_rec_cfg 12
178
179/* Register rw_tr_data, scope sser, type rw */
180typedef struct {
181 unsigned int data : 16;
182 unsigned int md : 1;
183 unsigned int dummy1 : 15;
184} reg_sser_rw_tr_data;
185#define REG_RD_ADDR_sser_rw_tr_data 16
186#define REG_WR_ADDR_sser_rw_tr_data 16
187
188/* Register r_rec_data, scope sser, type r */
189typedef struct {
190 unsigned int data : 16;
191 unsigned int md : 1;
192 unsigned int ext_clk : 1;
193 unsigned int status_in : 1;
194 unsigned int frame_in : 1;
195 unsigned int din : 1;
196 unsigned int data_in : 1;
197 unsigned int clk_in : 1;
198 unsigned int dummy1 : 9;
199} reg_sser_r_rec_data;
200#define REG_RD_ADDR_sser_r_rec_data 20
201
202/* Register rw_extra, scope sser, type rw */
203typedef struct {
204 unsigned int clkoff_cycles : 20;
205 unsigned int clkoff_en : 1;
206 unsigned int clkon_en : 1;
207 unsigned int dout_delay : 5;
208 unsigned int dummy1 : 5;
209} reg_sser_rw_extra;
210#define REG_RD_ADDR_sser_rw_extra 24
211#define REG_WR_ADDR_sser_rw_extra 24
212
213/* Register rw_intr_mask, scope sser, type rw */
214typedef struct {
215 unsigned int trdy : 1;
216 unsigned int rdav : 1;
217 unsigned int tidle : 1;
218 unsigned int rstop : 1;
219 unsigned int urun : 1;
220 unsigned int orun : 1;
221 unsigned int md_rec : 1;
222 unsigned int md_sent : 1;
223 unsigned int r958err : 1;
224 unsigned int dummy1 : 23;
225} reg_sser_rw_intr_mask;
226#define REG_RD_ADDR_sser_rw_intr_mask 28
227#define REG_WR_ADDR_sser_rw_intr_mask 28
228
229/* Register rw_ack_intr, scope sser, type rw */
230typedef struct {
231 unsigned int trdy : 1;
232 unsigned int rdav : 1;
233 unsigned int tidle : 1;
234 unsigned int rstop : 1;
235 unsigned int urun : 1;
236 unsigned int orun : 1;
237 unsigned int md_rec : 1;
238 unsigned int md_sent : 1;
239 unsigned int r958err : 1;
240 unsigned int dummy1 : 23;
241} reg_sser_rw_ack_intr;
242#define REG_RD_ADDR_sser_rw_ack_intr 32
243#define REG_WR_ADDR_sser_rw_ack_intr 32
244
245/* Register r_intr, scope sser, type r */
246typedef struct {
247 unsigned int trdy : 1;
248 unsigned int rdav : 1;
249 unsigned int tidle : 1;
250 unsigned int rstop : 1;
251 unsigned int urun : 1;
252 unsigned int orun : 1;
253 unsigned int md_rec : 1;
254 unsigned int md_sent : 1;
255 unsigned int r958err : 1;
256 unsigned int dummy1 : 23;
257} reg_sser_r_intr;
258#define REG_RD_ADDR_sser_r_intr 36
259
260/* Register r_masked_intr, scope sser, type r */
261typedef struct {
262 unsigned int trdy : 1;
263 unsigned int rdav : 1;
264 unsigned int tidle : 1;
265 unsigned int rstop : 1;
266 unsigned int urun : 1;
267 unsigned int orun : 1;
268 unsigned int md_rec : 1;
269 unsigned int md_sent : 1;
270 unsigned int r958err : 1;
271 unsigned int dummy1 : 23;
272} reg_sser_r_masked_intr;
273#define REG_RD_ADDR_sser_r_masked_intr 40
274
275
276/* Constants */
277enum {
278 regk_sser_both = 0x00000002,
279 regk_sser_bulk = 0x00000001,
280 regk_sser_clk100 = 0x00000000,
281 regk_sser_clk_in = 0x00000000,
282 regk_sser_const0 = 0x00000003,
283 regk_sser_dout = 0x00000002,
284 regk_sser_edge = 0x00000000,
285 regk_sser_ext = 0x00000001,
286 regk_sser_ext_clk = 0x00000001,
287 regk_sser_f100 = 0x00000000,
288 regk_sser_f29_493 = 0x00000004,
289 regk_sser_f32 = 0x00000005,
290 regk_sser_f32_768 = 0x00000006,
291 regk_sser_frm = 0x00000003,
292 regk_sser_gio0 = 0x00000000,
293 regk_sser_gio1 = 0x00000001,
294 regk_sser_hispeed = 0x00000001,
295 regk_sser_hold = 0x00000002,
296 regk_sser_in = 0x00000000,
297 regk_sser_inf = 0x00000003,
298 regk_sser_intern = 0x00000000,
299 regk_sser_intern_clk = 0x00000001,
300 regk_sser_intern_tb = 0x00000000,
301 regk_sser_iso = 0x00000000,
302 regk_sser_level = 0x00000001,
303 regk_sser_lospeed = 0x00000000,
304 regk_sser_lsbfirst = 0x00000000,
305 regk_sser_msbfirst = 0x00000001,
306 regk_sser_neg = 0x00000001,
307 regk_sser_neg_lo = 0x00000000,
308 regk_sser_no = 0x00000000,
309 regk_sser_no_clk = 0x00000007,
310 regk_sser_nojitter = 0x00000002,
311 regk_sser_out = 0x00000001,
312 regk_sser_pos = 0x00000000,
313 regk_sser_pos_hi = 0x00000001,
314 regk_sser_rec = 0x00000000,
315 regk_sser_rw_cfg_default = 0x00000000,
316 regk_sser_rw_extra_default = 0x00000000,
317 regk_sser_rw_frm_cfg_default = 0x00000000,
318 regk_sser_rw_intr_mask_default = 0x00000000,
319 regk_sser_rw_rec_cfg_default = 0x00000000,
320 regk_sser_rw_tr_cfg_default = 0x01800000,
321 regk_sser_rw_tr_data_default = 0x00000000,
322 regk_sser_thr16 = 0x00000001,
323 regk_sser_thr32 = 0x00000002,
324 regk_sser_thr8 = 0x00000000,
325 regk_sser_tr = 0x00000001,
326 regk_sser_ts_out = 0x00000003,
327 regk_sser_tx_bulk = 0x00000002,
328 regk_sser_wiresave = 0x00000002,
329 regk_sser_yes = 0x00000001
330};
331#endif /* __sser_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/strcop.h b/include/asm-cris/arch-v32/hwregs/strcop.h
new file mode 100644
index 000000000000..35131ba466f3
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/strcop.h
@@ -0,0 +1,57 @@
1// $Id: strcop.h,v 1.3 2003/10/22 13:27:12 henriken Exp $
2
3// Streamcop meta-data configuration structs
4
5struct strcop_meta_out {
6 unsigned char csumsel : 3;
7 unsigned char ciphsel : 3;
8 unsigned char ciphconf : 2;
9 unsigned char hashsel : 3;
10 unsigned char hashconf : 1;
11 unsigned char hashmode : 1;
12 unsigned char decrypt : 1;
13 unsigned char dlkey : 1;
14 unsigned char cbcmode : 1;
15};
16
17struct strcop_meta_in {
18 unsigned char dmasel : 3;
19 unsigned char sync : 1;
20 unsigned char res1 : 5;
21 unsigned char res2;
22};
23
24// Source definitions
25
26enum {
27 src_none = 0,
28 src_dma = 1,
29 src_des = 2,
30 src_sha1 = 3,
31 src_csum = 4,
32 src_aes = 5,
33 src_md5 = 6,
34 src_res = 7
35};
36
37// Cipher definitions
38
39enum {
40 ciph_des = 0,
41 ciph_3des = 1,
42 ciph_aes = 2
43};
44
45// Hash definitions
46
47enum {
48 hash_sha1 = 0,
49 hash_md5 = 1
50};
51
52enum {
53 hash_noiv = 0,
54 hash_iv = 1
55};
56
57
diff --git a/include/asm-cris/arch-v32/hwregs/strcop_defs.h b/include/asm-cris/arch-v32/hwregs/strcop_defs.h
new file mode 100644
index 000000000000..bd145a49b2c4
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/strcop_defs.h
@@ -0,0 +1,109 @@
1#ifndef __strcop_defs_h
2#define __strcop_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/strcop/rtl/strcop_regs.r
7 * id: strcop_regs.r,v 1.5 2003/10/15 12:09:45 kriskn Exp
8 * last modfied: Mon Apr 11 16:09:38 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile strcop_defs.h ../../inst/strcop/rtl/strcop_regs.r
11 * id: $Id: strcop_defs.h,v 1.7 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope strcop */
86
87/* Register rw_cfg, scope strcop, type rw */
88typedef struct {
89 unsigned int td3 : 1;
90 unsigned int td2 : 1;
91 unsigned int td1 : 1;
92 unsigned int ipend : 1;
93 unsigned int ignore_sync : 1;
94 unsigned int en : 1;
95 unsigned int dummy1 : 26;
96} reg_strcop_rw_cfg;
97#define REG_RD_ADDR_strcop_rw_cfg 0
98#define REG_WR_ADDR_strcop_rw_cfg 0
99
100
101/* Constants */
102enum {
103 regk_strcop_big = 0x00000001,
104 regk_strcop_d = 0x00000001,
105 regk_strcop_e = 0x00000000,
106 regk_strcop_little = 0x00000000,
107 regk_strcop_rw_cfg_default = 0x00000002
108};
109#endif /* __strcop_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/strmux_defs.h b/include/asm-cris/arch-v32/hwregs/strmux_defs.h
new file mode 100644
index 000000000000..67474855c499
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/strmux_defs.h
@@ -0,0 +1,127 @@
1#ifndef __strmux_defs_h
2#define __strmux_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/strmux/rtl/guinness/strmux_regs.r
7 * id: strmux_regs.r,v 1.10 2005/02/10 10:10:46 perz Exp
8 * last modfied: Mon Apr 11 16:09:43 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile strmux_defs.h ../../inst/strmux/rtl/guinness/strmux_regs.r
11 * id: $Id: strmux_defs.h,v 1.5 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope strmux */
86
87/* Register rw_cfg, scope strmux, type rw */
88typedef struct {
89 unsigned int dma0 : 3;
90 unsigned int dma1 : 3;
91 unsigned int dma2 : 3;
92 unsigned int dma3 : 3;
93 unsigned int dma4 : 3;
94 unsigned int dma5 : 3;
95 unsigned int dma6 : 3;
96 unsigned int dma7 : 3;
97 unsigned int dma8 : 3;
98 unsigned int dma9 : 3;
99 unsigned int dummy1 : 2;
100} reg_strmux_rw_cfg;
101#define REG_RD_ADDR_strmux_rw_cfg 0
102#define REG_WR_ADDR_strmux_rw_cfg 0
103
104
105/* Constants */
106enum {
107 regk_strmux_ata = 0x00000003,
108 regk_strmux_eth0 = 0x00000001,
109 regk_strmux_eth1 = 0x00000004,
110 regk_strmux_ext0 = 0x00000001,
111 regk_strmux_ext1 = 0x00000001,
112 regk_strmux_ext2 = 0x00000001,
113 regk_strmux_ext3 = 0x00000001,
114 regk_strmux_iop0 = 0x00000002,
115 regk_strmux_iop1 = 0x00000001,
116 regk_strmux_off = 0x00000000,
117 regk_strmux_p21 = 0x00000004,
118 regk_strmux_rw_cfg_default = 0x00000000,
119 regk_strmux_ser0 = 0x00000002,
120 regk_strmux_ser1 = 0x00000002,
121 regk_strmux_ser2 = 0x00000004,
122 regk_strmux_ser3 = 0x00000003,
123 regk_strmux_sser0 = 0x00000003,
124 regk_strmux_sser1 = 0x00000003,
125 regk_strmux_strcop = 0x00000002
126};
127#endif /* __strmux_defs_h */
diff --git a/include/asm-cris/arch-v32/hwregs/supp_reg.h b/include/asm-cris/arch-v32/hwregs/supp_reg.h
new file mode 100644
index 000000000000..ffe49625ae36
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/supp_reg.h
@@ -0,0 +1,78 @@
1#ifndef __SUPP_REG_H__
2#define __SUPP_REG_H__
3
4/* Macros for reading and writing support/special registers. */
5
6#ifndef STRINGIFYFY
7#define STRINGIFYFY(i) #i
8#endif
9
10#ifndef STRINGIFY
11#define STRINGIFY(i) STRINGIFYFY(i)
12#endif
13
14#define SPEC_REG_BZ "BZ"
15#define SPEC_REG_VR "VR"
16#define SPEC_REG_PID "PID"
17#define SPEC_REG_SRS "SRS"
18#define SPEC_REG_WZ "WZ"
19#define SPEC_REG_EXS "EXS"
20#define SPEC_REG_EDA "EDA"
21#define SPEC_REG_MOF "MOF"
22#define SPEC_REG_DZ "DZ"
23#define SPEC_REG_EBP "EBP"
24#define SPEC_REG_ERP "ERP"
25#define SPEC_REG_SRP "SRP"
26#define SPEC_REG_NRP "NRP"
27#define SPEC_REG_CCS "CCS"
28#define SPEC_REG_USP "USP"
29#define SPEC_REG_SPC "SPC"
30
31#define RW_MM_CFG 0
32#define RW_MM_KBASE_LO 1
33#define RW_MM_KBASE_HI 2
34#define RW_MM_CAUSE 3
35#define RW_MM_TLB_SEL 4
36#define RW_MM_TLB_LO 5
37#define RW_MM_TLB_HI 6
38#define RW_MM_TLB_PGD 7
39
40#define BANK_GC 0
41#define BANK_IM 1
42#define BANK_DM 2
43#define BANK_BP 3
44
45#define RW_GC_CFG 0
46#define RW_GC_CCS 1
47#define RW_GC_SRS 2
48#define RW_GC_NRP 3
49#define RW_GC_EXS 4
50#define RW_GC_R0 8
51#define RW_GC_R1 9
52
53#define SPEC_REG_WR(r,v) \
54__asm__ __volatile__ ("move %0, $" r : : "r" (v));
55
56#define SPEC_REG_RD(r,v) \
57__asm__ __volatile__ ("move $" r ",%0" : "=r" (v));
58
59#define NOP() \
60 __asm__ __volatile__ ("nop");
61
62#define SUPP_BANK_SEL(b) \
63 SPEC_REG_WR(SPEC_REG_SRS,b); \
64 NOP(); \
65 NOP(); \
66 NOP();
67
68#define SUPP_REG_WR(r,v) \
69__asm__ __volatile__ ("move %0, $S" STRINGIFYFY(r) "\n\t" \
70 "nop\n\t" \
71 "nop\n\t" \
72 "nop\n\t" \
73 : : "r" (v));
74
75#define SUPP_REG_RD(r,v) \
76__asm__ __volatile__ ("move $S" STRINGIFYFY(r) ",%0" : "=r" (v));
77
78#endif /* __SUPP_REG_H__ */
diff --git a/include/asm-cris/arch-v32/hwregs/timer_defs.h b/include/asm-cris/arch-v32/hwregs/timer_defs.h
new file mode 100644
index 000000000000..20c8c89ec076
--- /dev/null
+++ b/include/asm-cris/arch-v32/hwregs/timer_defs.h
@@ -0,0 +1,266 @@
1#ifndef __timer_defs_h
2#define __timer_defs_h
3
4/*
5 * This file is autogenerated from
6 * file: ../../inst/timer/rtl/timer_regs.r
7 * id: timer_regs.r,v 1.7 2003/03/11 11:16:59 perz Exp
8 * last modfied: Mon Apr 11 16:09:53 2005
9 *
10 * by /n/asic/design/tools/rdesc/src/rdes2c --outfile timer_defs.h ../../inst/timer/rtl/timer_regs.r
11 * id: $Id: timer_defs.h,v 1.6 2005/04/24 18:30:58 starvik Exp $
12 * Any changes here will be lost.
13 *
14 * -*- buffer-read-only: t -*-
15 */
16/* Main access macros */
17#ifndef REG_RD
18#define REG_RD( scope, inst, reg ) \
19 REG_READ( reg_##scope##_##reg, \
20 (inst) + REG_RD_ADDR_##scope##_##reg )
21#endif
22
23#ifndef REG_WR
24#define REG_WR( scope, inst, reg, val ) \
25 REG_WRITE( reg_##scope##_##reg, \
26 (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
27#endif
28
29#ifndef REG_RD_VECT
30#define REG_RD_VECT( scope, inst, reg, index ) \
31 REG_READ( reg_##scope##_##reg, \
32 (inst) + REG_RD_ADDR_##scope##_##reg + \
33 (index) * STRIDE_##scope##_##reg )
34#endif
35
36#ifndef REG_WR_VECT
37#define REG_WR_VECT( scope, inst, reg, index, val ) \
38 REG_WRITE( reg_##scope##_##reg, \
39 (inst) + REG_WR_ADDR_##scope##_##reg + \
40 (index) * STRIDE_##scope##_##reg, (val) )
41#endif
42
43#ifndef REG_RD_INT
44#define REG_RD_INT( scope, inst, reg ) \
45 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
46#endif
47
48#ifndef REG_WR_INT
49#define REG_WR_INT( scope, inst, reg, val ) \
50 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
51#endif
52
53#ifndef REG_RD_INT_VECT
54#define REG_RD_INT_VECT( scope, inst, reg, index ) \
55 REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
56 (index) * STRIDE_##scope##_##reg )
57#endif
58
59#ifndef REG_WR_INT_VECT
60#define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
61 REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
62 (index) * STRIDE_##scope##_##reg, (val) )
63#endif
64
65#ifndef REG_TYPE_CONV
66#define REG_TYPE_CONV( type, orgtype, val ) \
67 ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
68#endif
69
70#ifndef reg_page_size
71#define reg_page_size 8192
72#endif
73
74#ifndef REG_ADDR
75#define REG_ADDR( scope, inst, reg ) \
76 ( (inst) + REG_RD_ADDR_##scope##_##reg )
77#endif
78
79#ifndef REG_ADDR_VECT
80#define REG_ADDR_VECT( scope, inst, reg, index ) \
81 ( (inst) + REG_RD_ADDR_##scope##_##reg + \
82 (index) * STRIDE_##scope##_##reg )
83#endif
84
85/* C-code for register scope timer */
86
87/* Register rw_tmr0_div, scope timer, type rw */
88typedef unsigned int reg_timer_rw_tmr0_div;
89#define REG_RD_ADDR_timer_rw_tmr0_div 0
90#define REG_WR_ADDR_timer_rw_tmr0_div 0
91
92/* Register r_tmr0_data, scope timer, type r */
93typedef unsigned int reg_timer_r_tmr0_data;
94#define REG_RD_ADDR_timer_r_tmr0_data 4
95
96/* Register rw_tmr0_ctrl, scope timer, type rw */
97typedef struct {
98 unsigned int op : 2;
99 unsigned int freq : 3;
100 unsigned int dummy1 : 27;
101} reg_timer_rw_tmr0_ctrl;
102#define REG_RD_ADDR_timer_rw_tmr0_ctrl 8
103#define REG_WR_ADDR_timer_rw_tmr0_ctrl 8
104
105/* Register rw_tmr1_div, scope timer, type rw */
106typedef unsigned int reg_timer_rw_tmr1_div;
107#define REG_RD_ADDR_timer_rw_tmr1_div 16
108#define REG_WR_ADDR_timer_rw_tmr1_div 16
109
110/* Register r_tmr1_data, scope timer, type r */
111typedef unsigned int reg_timer_r_tmr1_data;
112#define REG_RD_ADDR_timer_r_tmr1_data 20
113
114/* Register rw_tmr1_ctrl, scope timer, type rw */
115typedef struct {
116 unsigned int op : 2;
117 unsigned int freq : 3;
118 unsigned int dummy1 : 27;
119} reg_timer_rw_tmr1_ctrl;
120#define REG_RD_ADDR_timer_rw_tmr1_ctrl 24
121#define REG_WR_ADDR_timer_rw_tmr1_ctrl 24
122
123/* Register rs_cnt_data, scope timer, type rs */
124typedef struct {
125 unsigned int tmr : 24;
126 unsigned int cnt : 8;
127} reg_timer_rs_cnt_data;
128#define REG_RD_ADDR_timer_rs_cnt_data 32
129
130/* Register r_cnt_data, scope timer, type r */
131typedef struct {
132 unsigned int tmr : 24;
133 unsigned int cnt : 8;
134} reg_timer_r_cnt_data;
135#define REG_RD_ADDR_timer_r_cnt_data 36
136
137/* Register rw_cnt_cfg, scope timer, type rw */
138typedef struct {
139 unsigned int clk : 2;
140 unsigned int dummy1 : 30;
141} reg_timer_rw_cnt_cfg;
142#define REG_RD_ADDR_timer_rw_cnt_cfg 40
143#define REG_WR_ADDR_timer_rw_cnt_cfg 40
144
145/* Register rw_trig, scope timer, type rw */
146typedef unsigned int reg_timer_rw_trig;
147#define REG_RD_ADDR_timer_rw_trig 48
148#define REG_WR_ADDR_timer_rw_trig 48
149
150/* Register rw_trig_cfg, scope timer, type rw */
151typedef struct {
152 unsigned int tmr : 2;
153 unsigned int dummy1 : 30;
154} reg_timer_rw_trig_cfg;
155#define REG_RD_ADDR_timer_rw_trig_cfg 52
156#define REG_WR_ADDR_timer_rw_trig_cfg 52
157
158/* Register r_time, scope timer, type r */
159typedef unsigned int reg_timer_r_time;
160#define REG_RD_ADDR_timer_r_time 56
161
162/* Register rw_out, scope timer, type rw */
163typedef struct {
164 unsigned int tmr : 2;
165 unsigned int dummy1 : 30;
166} reg_timer_rw_out;
167#define REG_RD_ADDR_timer_rw_out 60
168#define REG_WR_ADDR_timer_rw_out 60
169
170/* Register rw_wd_ctrl, scope timer, type rw */
171typedef struct {
172 unsigned int cnt : 8;
173 unsigned int cmd : 1;
174 unsigned int key : 7;
175 unsigned int dummy1 : 16;
176} reg_timer_rw_wd_ctrl;
177#define REG_RD_ADDR_timer_rw_wd_ctrl 64
178#define REG_WR_ADDR_timer_rw_wd_ctrl 64
179
180/* Register r_wd_stat, scope timer, type r */
181typedef struct {
182 unsigned int cnt : 8;
183 unsigned int cmd : 1;
184 unsigned int dummy1 : 23;
185} reg_timer_r_wd_stat;
186#define REG_RD_ADDR_timer_r_wd_stat 68
187
188/* Register rw_intr_mask, scope timer, type rw */
189typedef struct {
190 unsigned int tmr0 : 1;
191 unsigned int tmr1 : 1;
192 unsigned int cnt : 1;
193 unsigned int trig : 1;
194 unsigned int dummy1 : 28;
195} reg_timer_rw_intr_mask;
196#define REG_RD_ADDR_timer_rw_intr_mask 72
197#define REG_WR_ADDR_timer_rw_intr_mask 72
198
199/* Register rw_ack_intr, scope timer, type rw */
200typedef struct {
201 unsigned int tmr0 : 1;
202 unsigned int tmr1 : 1;
203 unsigned int cnt : 1;
204 unsigned int trig : 1;
205 unsigned int dummy1 : 28;
206} reg_timer_rw_ack_intr;
207#define REG_RD_ADDR_timer_rw_ack_intr 76
208#define REG_WR_ADDR_timer_rw_ack_intr 76
209
210/* Register r_intr, scope timer, type r */
211typedef struct {
212 unsigned int tmr0 : 1;
213 unsigned int tmr1 : 1;
214 unsigned int cnt : 1;
215 unsigned int trig : 1;
216 unsigned int dummy1 : 28;
217} reg_timer_r_intr;
218#define REG_RD_ADDR_timer_r_intr 80
219
220/* Register r_masked_intr, scope timer, type r */
221typedef struct {
222 unsigned int tmr0 : 1;
223 unsigned int tmr1 : 1;
224 unsigned int cnt : 1;
225 unsigned int trig : 1;
226 unsigned int dummy1 : 28;
227} reg_timer_r_masked_intr;
228#define REG_RD_ADDR_timer_r_masked_intr 84
229
230/* Register rw_test, scope timer, type rw */
231typedef struct {
232 unsigned int dis : 1;
233 unsigned int en : 1;
234 unsigned int dummy1 : 30;
235} reg_timer_rw_test;
236#define REG_RD_ADDR_timer_rw_test 88
237#define REG_WR_ADDR_timer_rw_test 88
238
239
240/* Constants */
241enum {
242 regk_timer_ext = 0x00000001,
243 regk_timer_f100 = 0x00000007,
244 regk_timer_f29_493 = 0x00000004,
245 regk_timer_f32 = 0x00000005,
246 regk_timer_f32_768 = 0x00000006,
247 regk_timer_hold = 0x00000001,
248 regk_timer_ld = 0x00000000,
249 regk_timer_no = 0x00000000,
250 regk_timer_off = 0x00000000,
251 regk_timer_run = 0x00000002,
252 regk_timer_rw_cnt_cfg_default = 0x00000000,
253 regk_timer_rw_intr_mask_default = 0x00000000,
254 regk_timer_rw_out_default = 0x00000000,
255 regk_timer_rw_test_default = 0x00000000,
256 regk_timer_rw_tmr0_ctrl_default = 0x00000000,
257 regk_timer_rw_tmr1_ctrl_default = 0x00000000,
258 regk_timer_rw_trig_cfg_default = 0x00000000,
259 regk_timer_start = 0x00000001,
260 regk_timer_stop = 0x00000000,
261 regk_timer_time = 0x00000001,
262 regk_timer_tmr0 = 0x00000002,
263 regk_timer_tmr1 = 0x00000003,
264 regk_timer_yes = 0x00000001
265};
266#endif /* __timer_defs_h */
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h
new file mode 100644
index 000000000000..24f5604f566a
--- /dev/null
+++ b/include/asm-cris/arch-v32/ide.h
@@ -0,0 +1,61 @@
1/*
2 * linux/include/asm-cris/ide.h
3 *
4 * Copyright (C) 2000-2004 Axis Communications AB
5 *
6 * Authors: Bjorn Wesen, Mikael Starvik
7 *
8 */
9
10/*
11 * This file contains the ETRAX FS specific IDE code.
12 */
13
14#ifndef __ASMCRIS_IDE_H
15#define __ASMCRIS_IDE_H
16
17#ifdef __KERNEL__
18
19#include <asm/arch/hwregs/intr_vect.h>
20#include <asm/arch/hwregs/ata_defs.h>
21#include <asm/io.h>
22#include <asm-generic/ide_iops.h>
23
24
25/* ETRAX FS can support 4 IDE busses on the same pins (serialized) */
26
27#define MAX_HWIFS 4
28
29extern __inline__ int ide_default_irq(unsigned long base)
30{
31 /* all IDE busses share the same IRQ,
32 * this has the side-effect that ide-probe.c will cluster our 4 interfaces
33 * together in a hwgroup, and will serialize accesses. this is good, because
34 * we can't access more than one interface at the same time on ETRAX100.
35 */
36 return ATA_INTR_VECT;
37}
38
39extern __inline__ unsigned long ide_default_io_base(int index)
40{
41 reg_ata_rw_ctrl2 ctrl2 = {.sel = index};
42 /* we have no real I/O base address per interface, since all go through the
43 * same register. but in a bitfield in that register, we have the i/f number.
44 * so we can use the io_base to remember that bitfield.
45 */
46 ctrl2.sel = index;
47
48 return REG_TYPE_CONV(unsigned long, reg_ata_rw_ctrl2, ctrl2);
49}
50
51/* some configuration options we don't need */
52
53#undef SUPPORT_VLB_SYNC
54#define SUPPORT_VLB_SYNC 0
55
56#define IDE_ARCH_ACK_INTR
57#define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif)
58
59#endif /* __KERNEL__ */
60
61#endif /* __ASMCRIS_IDE_H */
diff --git a/include/asm-cris/arch-v32/intmem.h b/include/asm-cris/arch-v32/intmem.h
new file mode 100644
index 000000000000..c0ada33bf90f
--- /dev/null
+++ b/include/asm-cris/arch-v32/intmem.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_CRIS_INTMEM_H
2#define _ASM_CRIS_INTMEM_H
3
4void* crisv32_intmem_alloc(unsigned size, unsigned align);
5void crisv32_intmem_free(void* addr);
6void* crisv32_intmem_phys_to_virt(unsigned long addr);
7unsigned long crisv32_intmem_virt_to_phys(void *addr);
8
9#endif /* _ASM_CRIS_ARCH_INTMEM_H */
diff --git a/include/asm-cris/arch-v32/io.h b/include/asm-cris/arch-v32/io.h
new file mode 100644
index 000000000000..4c80263ec634
--- /dev/null
+++ b/include/asm-cris/arch-v32/io.h
@@ -0,0 +1,98 @@
1#ifndef _ASM_ARCH_CRIS_IO_H
2#define _ASM_ARCH_CRIS_IO_H
3
4#include <asm/arch/hwregs/reg_map.h>
5#include <asm/arch/hwregs/reg_rdwr.h>
6#include <asm/arch/hwregs/gio_defs.h>
7#include <linux/config.h>
8
9enum crisv32_io_dir
10{
11 crisv32_io_dir_in = 0,
12 crisv32_io_dir_out = 1
13};
14
15struct crisv32_ioport
16{
17 unsigned long* oe;
18 unsigned long* data;
19 unsigned long* data_in;
20 unsigned int pin_count;
21};
22
23struct crisv32_iopin
24{
25 struct crisv32_ioport* port;
26 int bit;
27};
28
29extern struct crisv32_ioport crisv32_ioports[];
30
31extern struct crisv32_iopin crisv32_led1_green;
32extern struct crisv32_iopin crisv32_led1_red;
33extern struct crisv32_iopin crisv32_led2_green;
34extern struct crisv32_iopin crisv32_led2_red;
35extern struct crisv32_iopin crisv32_led3_green;
36extern struct crisv32_iopin crisv32_led3_red;
37
38extern inline void crisv32_io_set(struct crisv32_iopin* iopin,
39 int val)
40{
41 if (val)
42 *iopin->port->data |= iopin->bit;
43 else
44 *iopin->port->data &= ~iopin->bit;
45}
46
47extern inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
48 enum crisv32_io_dir dir)
49{
50 if (dir == crisv32_io_dir_in)
51 *iopin->port->oe &= ~iopin->bit;
52 else
53 *iopin->port->oe |= iopin->bit;
54}
55
56extern inline int crisv32_io_rd(struct crisv32_iopin* iopin)
57{
58 return ((*iopin->port->data_in & iopin->bit) ? 1 : 0);
59}
60
61int crisv32_io_get(struct crisv32_iopin* iopin,
62 unsigned int port, unsigned int pin);
63int crisv32_io_get_name(struct crisv32_iopin* iopin,
64 char* name);
65
66#define LED_OFF 0x00
67#define LED_GREEN 0x01
68#define LED_RED 0x02
69#define LED_ORANGE (LED_GREEN | LED_RED)
70
71#define LED_NETWORK_SET(x) \
72 do { \
73 LED_NETWORK_SET_G((x) & LED_GREEN); \
74 LED_NETWORK_SET_R((x) & LED_RED); \
75 } while (0)
76#define LED_ACTIVE_SET(x) \
77 do { \
78 LED_ACTIVE_SET_G((x) & LED_GREEN); \
79 LED_ACTIVE_SET_R((x) & LED_RED); \
80 } while (0)
81
82#define LED_NETWORK_SET_G(x) \
83 crisv32_io_set(&crisv32_led1_green, !(x));
84#define LED_NETWORK_SET_R(x) \
85 crisv32_io_set(&crisv32_led1_red, !(x));
86#define LED_ACTIVE_SET_G(x) \
87 crisv32_io_set(&crisv32_led2_green, !(x));
88#define LED_ACTIVE_SET_R(x) \
89 crisv32_io_set(&crisv32_led2_red, !(x));
90#define LED_DISK_WRITE(x) \
91 do{\
92 crisv32_io_set(&crisv32_led3_green, !(x)); \
93 crisv32_io_set(&crisv32_led3_red, !(x)); \
94 }while(0)
95#define LED_DISK_READ(x) \
96 crisv32_io_set(&crisv32_led3_green, !(x));
97
98#endif
diff --git a/include/asm-cris/arch-v32/irq.h b/include/asm-cris/arch-v32/irq.h
new file mode 100644
index 000000000000..d35aa8174c2f
--- /dev/null
+++ b/include/asm-cris/arch-v32/irq.h
@@ -0,0 +1,120 @@
1#ifndef _ASM_ARCH_IRQ_H
2#define _ASM_ARCH_IRQ_H
3
4#include <linux/config.h>
5#include "hwregs/intr_vect.h"
6
7/* Number of non-cpu interrupts. */
8#define NR_IRQS 0x50 /* Exceptions + IRQs */
9#define NR_REAL_IRQS 0x20 /* IRQs */
10#define FIRST_IRQ 0x31 /* Exception number for first IRQ */
11
12#ifndef __ASSEMBLY__
13/* Global IRQ vector. */
14typedef void (*irqvectptr)(void);
15
16struct etrax_interrupt_vector {
17 irqvectptr v[256];
18};
19
20extern struct etrax_interrupt_vector *etrax_irv; /* head.S */
21
22void mask_irq(int irq);
23void unmask_irq(int irq);
24
25void set_exception_vector(int n, irqvectptr addr);
26
27/* Save registers so that they match pt_regs. */
28#define SAVE_ALL \
29 "subq 12,$sp\n\t" \
30 "move $erp,[$sp]\n\t" \
31 "subq 4,$sp\n\t" \
32 "move $srp,[$sp]\n\t" \
33 "subq 4,$sp\n\t" \
34 "move $ccs,[$sp]\n\t" \
35 "subq 4,$sp\n\t" \
36 "move $spc,[$sp]\n\t" \
37 "subq 4,$sp\n\t" \
38 "move $mof,[$sp]\n\t" \
39 "subq 4,$sp\n\t" \
40 "move $srs,[$sp]\n\t" \
41 "subq 4,$sp\n\t" \
42 "move.d $acr,[$sp]\n\t" \
43 "subq 14*4,$sp\n\t" \
44 "movem $r13,[$sp]\n\t" \
45 "subq 4,$sp\n\t" \
46 "move.d $r10,[$sp]\n"
47
48#define STR2(x) #x
49#define STR(x) STR2(x)
50
51#define IRQ_NAME2(nr) nr##_interrupt(void)
52#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
53
54/*
55 * The reason for setting the S-bit when debugging the kernel is that we want
56 * hardware breakpoints to remain active while we are in an exception handler.
57 * Note that we cannot simply copy S1, since we may come here from user-space,
58 * or any context where the S-bit wasn't set.
59 */
60#ifdef CONFIG_ETRAX_KGDB
61#define KGDB_FIXUP \
62 "move $ccs, $r10\n\t" \
63 "or.d (1<<9), $r10\n\t" \
64 "move $r10, $ccs\n\t"
65#else
66#define KGDB_FIXUP ""
67#endif
68
69/*
70 * Make sure the causing IRQ is blocked, then call do_IRQ. After that, unblock
71 * and jump to ret_from_intr which is found in entry.S.
72 *
73 * The reason for blocking the IRQ is to allow an sti() before the handler,
74 * which will acknowledge the interrupt, is run. The actual blocking is made
75 * by crisv32_do_IRQ.
76 */
77#define BUILD_IRQ(nr, mask) \
78void IRQ_NAME(nr); \
79__asm__ ( \
80 ".text\n\t" \
81 "IRQ" #nr "_interrupt:\n\t" \
82 SAVE_ALL \
83 KGDB_FIXUP \
84 "move.d "#nr",$r10\n\t" \
85 "move.d $sp,$r12\n\t" \
86 "jsr crisv32_do_IRQ\n\t" \
87 "moveq 1, $r11\n\t" \
88 "jump ret_from_intr\n\t" \
89 "nop\n\t");
90/*
91 * This is subtle. The timer interrupt is crucial and it should not be disabled
92 * for too long. However, if it had been a normal interrupt as per BUILD_IRQ, it
93 * would have been BLOCK'ed, and then softirq's are run before we return here to
94 * UNBLOCK. If the softirq's take too much time to run, the timer irq won't run
95 * and the watchdog will kill us.
96 *
97 * Furthermore, if a lot of other irq's occur before we return here, the
98 * multiple_irq handler is run and it prioritizes the timer interrupt. However
99 * if we had BLOCK'edit here, we would not get the multiple_irq at all.
100 *
101 * The non-blocking here is based on the knowledge that the timer interrupt is
102 * registred as a fast interrupt (SA_INTERRUPT) so that we _know_ there will not
103 * be an sti() before the timer irq handler is run to acknowledge the interrupt.
104 */
105#define BUILD_TIMER_IRQ(nr, mask) \
106void IRQ_NAME(nr); \
107__asm__ ( \
108 ".text\n\t" \
109 "IRQ" #nr "_interrupt:\n\t" \
110 SAVE_ALL \
111 KGDB_FIXUP \
112 "move.d "#nr",$r10\n\t" \
113 "move.d $sp,$r12\n\t" \
114 "jsr crisv32_do_IRQ\n\t" \
115 "moveq 0,$r11\n\t" \
116 "jump ret_from_intr\n\t" \
117 "nop\n\t");
118
119#endif /* __ASSEMBLY__ */
120#endif /* _ASM_ARCH_IRQ_H */
diff --git a/include/asm-cris/arch-v32/juliette.h b/include/asm-cris/arch-v32/juliette.h
new file mode 100644
index 000000000000..f1f81725e57b
--- /dev/null
+++ b/include/asm-cris/arch-v32/juliette.h
@@ -0,0 +1,326 @@
1#ifndef _ASM_JULIETTE_H
2#define _ASM_JULIETTE_H
3
4/* juliette _IOC_TYPE, bits 8 to 15 in ioctl cmd */
5
6#define JULIOCTYPE 42
7
8/* supported ioctl _IOC_NR's */
9
10#define JULSTARTDMA 0x1 /* start a picture asynchronously */
11
12/* set parameters */
13
14#define SETDEFAULT 0x2 /* CCD/VIDEO/SS1M */
15#define SETPARAMETERS 0x3 /* CCD/VIDEO */
16#define SETSIZE 0x4 /* CCD/VIDEO/SS1M */
17#define SETCOMPRESSION 0x5 /* CCD/VIDEO/SS1M */
18#define SETCOLORLEVEL 0x6 /* CCD/VIDEO */
19#define SETBRIGHTNESS 0x7 /* CCD */
20#define SETROTATION 0x8 /* CCD */
21#define SETTEXT 0x9 /* CCD/VIDEO/SS1M */
22#define SETCLOCK 0xa /* CCD/VIDEO/SS1M */
23#define SETDATE 0xb /* CCD/VIDEO/SS1M */
24#define SETTIMEFORMAT 0xc /* CCD/VIDEO/SS1M */
25#define SETDATEFORMAT 0xd /* VIDEO */
26#define SETTEXTALIGNMENT 0xe /* VIDEO */
27#define SETFPS 0xf /* CCD/VIDEO/SS1M */
28#define SETVGA 0xff /* VIDEO */
29#define SETCOMMENT 0xfe /* CCD/VIDEO */
30
31/* get parameters */
32
33#define GETDRIVERTYPE 0x10 /* CCD/VIDEO/SS1M */
34#define GETNBROFCAMERAS 0x11 /* CCD/VIDEO/SS1M */
35#define GETPARAMETERS 0x12 /* CCD/VIDEO/SS1M */
36#define GETBUFFERSIZE 0x13 /* CCD/VIDEO/SS1M */
37#define GETVIDEOTYPE 0x14 /* VIDEO/SS1M */
38#define GETVIDEOSIGNAL 0x15 /* VIDEO */
39#define GETMODULATION 0x16 /* VIDEO */
40#define GETDCYVALUES 0xa0 /* CCD /SS1M */
41#define GETDCYWIDTH 0xa1 /* CCD /SS1M */
42#define GETDCYHEIGHT 0xa2 /* CCD /SS1M */
43#define GETSIZE 0xa3 /* CCD/VIDEO */
44#define GETCOMPRESSION 0xa4 /* CCD/VIDEO */
45
46/* detect and get parameters */
47
48#define DETECTMODULATION 0x17 /* VIDEO */
49#define DETECTVIDEOTYPE 0x18 /* VIDEO */
50#define DETECTVIDEOSIGNAL 0x19 /* VIDEO */
51
52/* configure default parameters */
53
54#define CONFIGUREDEFAULT 0x20 /* CCD/VIDEO/SS1M */
55#define DEFSIZE 0x21 /* CCD/VIDEO/SS1M */
56#define DEFCOMPRESSION 0x22 /* CCD/VIDEO/SS1M */
57#define DEFCOLORLEVEL 0x23 /* CCD/VIDEO */
58#define DEFBRIGHTNESS 0x24 /* CCD */
59#define DEFROTATION 0x25 /* CCD */
60#define DEFWHITEBALANCE 0x26 /* CCD */
61#define DEFEXPOSURE 0x27 /* CCD */
62#define DEFAUTOEXPWINDOW 0x28 /* CCD */
63#define DEFTEXT 0x29 /* CCD/VIDEO/SS1M */
64#define DEFCLOCK 0x2a /* CCD/VIDEO/SS1M */
65#define DEFDATE 0x2b /* CCD/VIDEO/SS1M */
66#define DEFTIMEFORMAT 0x2c /* CCD/VIDEO/SS1M */
67#define DEFDATEFORMAT 0x2d /* VIDEO */
68#define DEFTEXTALIGNMENT 0x2e /* VIDEO */
69#define DEFFPS 0x2f /* CCD/VIDEO/SS1M */
70#define DEFTEXTSTRING 0x30 /* CCD/VIDEO/SS1M */
71#define DEFHEADERINFO 0x31 /* CCD/VIDEO/SS1M */
72#define DEFWEXAR 0x32 /* CCD */
73#define DEFLINEDELAY 0x33 /* CCD */
74#define DEFDISABLEDVIDEO 0x34 /* VIDEO */
75#define DEFVIDEOTYPE 0x35 /* VIDEO */
76#define DEFMODULATION 0x36 /* VIDEO */
77#define DEFXOFFSET 0x37 /* VIDEO */
78#define DEFYOFFSET 0x38 /* VIDEO */
79#define DEFYCMODE 0x39 /* VIDEO */
80#define DEFVCRMODE 0x3a /* VIDEO */
81#define DEFSTOREDCYVALUES 0x3b /* CCD/VIDEO/SS1M */
82#define DEFWCDS 0x3c /* CCD */
83#define DEFVGA 0x3d /* VIDEO */
84#define DEFCOMMENT 0x3e /* CCD/VIDEO */
85#define DEFCOMMENTSIZE 0x3f /* CCD/VIDEO */
86#define DEFCOMMENTTEXT 0x50 /* CCD/VIDEO */
87#define DEFSTOREDCYTEXT 0x51 /* VIDEO */
88
89
90#define JULABORTDMA 0x70 /* Abort current DMA transfer */
91
92/* juliette general i/o port */
93
94#define JIO_READBITS 0x40 /* read and return current port bits */
95#define JIO_SETBITS 0x41 /* set bits marked by 1 in the argument */
96#define JIO_CLRBITS 0x42 /* clr bits marked by 1 in the argument */
97#define JIO_READDIR 0x43 /* read direction, 0=input 1=output */
98#define JIO_SETINPUT 0x44 /* set direction, 0=unchanged 1=input
99 returns current dir */
100#define JIO_SETOUTPUT 0x45 /* set direction, 0=unchanged 1=output
101 returns current dir */
102
103/**** YumYum internal adresses ****/
104
105/* Juliette buffer addresses */
106
107#define BUFFER1_VIDEO 0x1100
108#define BUFFER2_VIDEO 0x2800
109#define ACDC_BUFF_VIDEO 0x0aaa
110#define BUFFER1 0x1700
111#define BUFFER2 0x2b01
112#define ACDC_BUFFER 0x1200
113#define BUFFER1_SS1M 0x1100
114#define BUFFER2_SS1M 0x2800
115#define ACDC_BUFF_SS1M 0x0900
116
117/* Juliette parameter memory addresses */
118
119#define PA_BUFFER_CNT 0x3f09 /* CCD/VIDEO */
120#define PA_CCD_BUFFER 0x3f10 /* CCD */
121#define PA_VIDEO_BUFFER 0x3f10 /* VIDEO */
122#define PA_DCT_BUFFER 0x3f11 /* CCD/VIDEO */
123#define PA_TEMP 0x3f12 /* CCD/VIDEO */
124#define PA_VIDEOLINE_RD 0x3f13 /* VIDEO */
125#define PA_VIDEOLINE_WR 0x3f14 /* VIDEO */
126#define PA_VI_HDELAY0 0x3f15 /* VIDEO */
127#define PA_VI_VDELAY0 0x3f16 /* VIDEO */
128#define PA_VI_HDELAY1 0x3f17 /* VIDEO */
129#define PA_VI_VDELAY1 0x3f18 /* VIDEO */
130#define PA_VI_HDELAY2 0x3f19 /* VIDEO */
131#define PA_VI_VDELAY2 0x3f1a /* VIDEO */
132#define PA_VI_HDELAY3 0x3f1b /* VIDEO */
133#define PA_VI_VDELAY3 0x3f1c /* VIDEO */
134#define PA_VI_CTRL 0x3f20 /* VIDEO */
135#define PA_JPEG_CTRL 0x3f22 /* CCD/VIDEO */
136#define PA_BUFFER_SIZE 0x3f24 /* CCD/VIDEO */
137#define PA_PAL_NTSC 0x3f25 /* VIDEO */
138#define PA_MACROBLOCKS 0x3f26 /* CCD/VIDEO */
139#define PA_COLOR 0x3f27 /* VIDEO */
140#define PA_MEMCH1CNT2 0x3f28 /* CCD/VIDEO */
141#define PA_MEMCH1CNT3 0x3f29 /* VIDEO */
142#define PA_MEMCH1STR2 0x3f2a /* CCD/VIDEO */
143#define PA_MEMCH1STR3 0x3f2b /* VIDEO */
144#define PA_BUFFERS 0x3f2c /* CCD/VIDEO */
145#define PA_PROGRAM 0x3f2d /* CCD/VIDEO */
146#define PA_ROTATION 0x3f2e /* CCD */
147#define PA_PC 0x3f30 /* CCD/VIDEO */
148#define PA_PC2 0x3f31 /* VIDEO */
149#define PA_ODD_LINE 0x3f32 /* VIDEO */
150#define PA_EXP_DELAY 0x3f34 /* CCD */
151#define PA_MACROBLOCK_CNT 0x3f35 /* CCD/VIDEO */
152#define PA_DRAM_PTR1_L 0x3f36 /* CCD/VIDEO */
153#define PA_CLPOB_CNT 0x3f37 /* CCD */
154#define PA_DRAM_PTR1_H 0x3f38 /* CCD/VIDEO */
155#define PA_DRAM_PTR2_L 0x3f3a /* VIDEO */
156#define PA_DRAM_PTR2_H 0x3f3c /* VIDEO */
157#define PA_CCD_LINE_CNT 0x3f3f /* CCD */
158#define PA_VIDEO_LINE_CNT 0x3f3f /* VIDEO */
159#define PA_TEXT 0x3f41 /* CCD/VIDEO */
160#define PA_CAMERA_CHANGED 0x3f42 /* VIDEO */
161#define PA_TEXTALIGNMENT 0x3f43 /* VIDEO */
162#define PA_DISABLED 0x3f44 /* VIDEO */
163#define PA_MACROBLOCKTEXT 0x3f45 /* VIDEO */
164#define PA_VGA 0x3f46 /* VIDEO */
165#define PA_ZERO 0x3ffe /* VIDEO */
166#define PA_NULL 0x3fff /* CCD/VIDEO */
167
168typedef enum {
169 jpeg = 0,
170 dummy = 1
171} request_type;
172
173typedef enum {
174 hugesize = 0,
175 fullsize = 1,
176 halfsize = 2,
177 fieldsize = 3
178} size_type;
179
180typedef enum {
181 min = 0,
182 low = 1,
183 medium = 2,
184 high = 3,
185 very_high = 4,
186 very_low = 5,
187 q1 = 6,
188 q2 = 7,
189 q3 = 8,
190 q4 = 9,
191 q5 = 10,
192 q6 = 11
193} compr_type;
194
195typedef enum {
196 deg_0 = 0,
197 deg_180 = 1,
198 deg_90 = 2,
199 deg_270 = 3
200} rotation_type;
201
202typedef enum {
203 auto_white = 0,
204 hold = 1,
205 fixed_outdoor = 2,
206 fixed_indoor = 3,
207 fixed_fluor = 4
208} white_balance_type;
209
210typedef enum {
211 auto_exp = 0,
212 fixed_exp = 1
213} exposure_type;
214
215typedef enum {
216 no_window = 0,
217 center = 1,
218 top = 2,
219 lower = 3,
220 left = 4,
221 right = 5,
222 spot = 6,
223 cw = 7
224} exp_window_type;
225
226typedef enum {
227 h_24 = 0,
228 h_12 = 1,
229 h_24P = 2
230} hour_type;
231
232typedef enum {
233 standard = 0,
234 YYYY_MM_DD = 1,
235 Www_Mmm_DD_YYYY = 2,
236 Www_DD_MM_YYYY = 3
237} date_type;
238
239typedef enum {
240 left_align = 0,
241 center_align = 1,
242 right_align = 2
243} alignment_type;
244
245typedef enum {
246 off = 0,
247 on = 1,
248 no = 0,
249 yes = 1
250} enable_type;
251
252typedef enum {
253 disabled = 0,
254 enabled = 1,
255 extended = 2
256} comment_type;
257
258typedef enum {
259 pal = 0,
260 ntsc = 1
261} video_type;
262
263typedef enum {
264 pal_bghi_ntsc_m = 0,
265 ntsc_4_43_50hz_pal_4_43_60hz = 1,
266 pal_n_ntsc_4_43_60hz = 2,
267 ntsc_n_pal_m = 3,
268 secam_pal_4_43_60hz = 4
269} modulation_type;
270
271typedef enum {
272 cam0 = 0,
273 cam1 = 1,
274 cam2 = 2,
275 cam3 = 3,
276 quad = 32
277} camera_type;
278
279typedef enum {
280 video_driver = 0,
281 ccd_driver = 1
282} driver_type;
283
284struct jul_param {
285 request_type req_type;
286 size_type size;
287 compr_type compression;
288 rotation_type rotation;
289 int color_level;
290 int brightness;
291 white_balance_type white_balance;
292 exposure_type exposure;
293 exp_window_type auto_exp_window;
294 hour_type time_format;
295 date_type date_format;
296 alignment_type text_alignment;
297 enable_type text;
298 enable_type clock;
299 enable_type date;
300 enable_type fps;
301 enable_type vga;
302 enable_type comment;
303};
304
305struct video_param {
306 enable_type disabled;
307 modulation_type modulation;
308 video_type video;
309 enable_type signal;
310 enable_type vcr;
311 int xoffset;
312 int yoffset;
313};
314
315/* The juliette_request structure is used during the JULSTARTDMA asynchronous
316 * picture-taking ioctl call as an argument to specify a buffer which will get
317 * the final picture.
318 */
319
320struct juliette_request {
321 char *buf; /* Pointer to the buffer to hold picture data */
322 unsigned int buflen; /* Length of the above buffer */
323 unsigned int size; /* Resulting length, 0 if the picture is not ready */
324};
325
326#endif
diff --git a/include/asm-cris/arch-v32/memmap.h b/include/asm-cris/arch-v32/memmap.h
new file mode 100644
index 000000000000..d29df5644d3e
--- /dev/null
+++ b/include/asm-cris/arch-v32/memmap.h
@@ -0,0 +1,24 @@
1#ifndef _ASM_ARCH_MEMMAP_H
2#define _ASM_ARCH_MEMMAP_H
3
4#define MEM_CSE0_START (0x00000000)
5#define MEM_CSE0_SIZE (0x04000000)
6#define MEM_CSE1_START (0x04000000)
7#define MEM_CSE1_SIZE (0x04000000)
8#define MEM_CSR0_START (0x08000000)
9#define MEM_CSR1_START (0x0c000000)
10#define MEM_CSP0_START (0x10000000)
11#define MEM_CSP1_START (0x14000000)
12#define MEM_CSP2_START (0x18000000)
13#define MEM_CSP3_START (0x1c000000)
14#define MEM_CSP4_START (0x20000000)
15#define MEM_CSP5_START (0x24000000)
16#define MEM_CSP6_START (0x28000000)
17#define MEM_CSP7_START (0x2c000000)
18#define MEM_INTMEM_START (0x38000000)
19#define MEM_INTMEM_SIZE (0x00020000)
20#define MEM_DRAM_START (0x40000000)
21
22#define MEM_NON_CACHEABLE (0x80000000)
23
24#endif
diff --git a/include/asm-cris/arch-v32/mmu.h b/include/asm-cris/arch-v32/mmu.h
new file mode 100644
index 000000000000..6bcdc3fdf7dc
--- /dev/null
+++ b/include/asm-cris/arch-v32/mmu.h
@@ -0,0 +1,111 @@
1#ifndef _ASM_CRIS_ARCH_MMU_H
2#define _ASM_CRIS_ARCH_MMU_H
3
4/* MMU context type. */
5typedef struct
6{
7 unsigned int page_id;
8} mm_context_t;
9
10/* Kernel memory segments. */
11#define KSEG_F 0xf0000000UL
12#define KSEG_E 0xe0000000UL
13#define KSEG_D 0xd0000000UL
14#define KSEG_C 0xc0000000UL
15#define KSEG_B 0xb0000000UL
16#define KSEG_A 0xa0000000UL
17#define KSEG_9 0x90000000UL
18#define KSEG_8 0x80000000UL
19#define KSEG_7 0x70000000UL
20#define KSEG_6 0x60000000UL
21#define KSEG_5 0x50000000UL
22#define KSEG_4 0x40000000UL
23#define KSEG_3 0x30000000UL
24#define KSEG_2 0x20000000UL
25#define KSEG_1 0x10000000UL
26#define KSEG_0 0x00000000UL
27
28/*
29 * CRISv32 PTE bits:
30 *
31 * Bit: 31-13 12-5 4 3 2 1 0
32 * +-----+------+--------+-------+--------+-------+---------+
33 * | pfn | zero | global | valid | kernel | write | execute |
34 * +-----+------+--------+-------+--------+-------+---------+
35 */
36
37/*
38 * Defines for accessing the bits. Also define some synonyms for use with
39 * the software-based defined bits below.
40 */
41#define _PAGE_EXECUTE (1 << 0) /* Execution bit. */
42#define _PAGE_WE (1 << 1) /* Write bit. */
43#define _PAGE_SILENT_WRITE (1 << 1) /* Same as above. */
44#define _PAGE_KERNEL (1 << 2) /* Kernel mode page. */
45#define _PAGE_VALID (1 << 3) /* Page is valid. */
46#define _PAGE_SILENT_READ (1 << 3) /* Same as above. */
47#define _PAGE_GLOBAL (1 << 4) /* Global page. */
48
49/*
50 * The hardware doesn't care about these bits, but the kernel uses them in
51 * software.
52 */
53#define _PAGE_PRESENT (1 << 5) /* Page is present in memory. */
54#define _PAGE_FILE (1 << 6) /* 1=pagecache, 0=swap (when !present) */
55#define _PAGE_ACCESSED (1 << 6) /* Simulated in software using valid bit. */
56#define _PAGE_MODIFIED (1 << 7) /* Simulated in software using we bit. */
57#define _PAGE_READ (1 << 8) /* Read enabled. */
58#define _PAGE_WRITE (1 << 9) /* Write enabled. */
59
60/* Define some higher level generic page attributes. */
61#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
62#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
63
64#define _PAGE_TABLE (_PAGE_PRESENT | __READABLE | __WRITEABLE)
65#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED)
66
67#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
68#define PAGE_SHARED __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \
69 _PAGE_ACCESSED)
70#define PAGE_SHARED_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \
71 _PAGE_ACCESSED | _PAGE_EXECUTE)
72
73#define PAGE_READONLY __pgprot(_PAGE_PRESENT | __READABLE)
74#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_EXECUTE | _PAGE_ACCESSED)
75
76#define PAGE_COPY __pgprot(_PAGE_PRESENT | __READABLE)
77#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_EXECUTE)
78#define PAGE_KERNEL __pgprot(_PAGE_GLOBAL | _PAGE_KERNEL | \
79 _PAGE_PRESENT | __READABLE | __WRITEABLE)
80#define PAGE_KERNEL_EXEC __pgprot(_PAGE_GLOBAL | _PAGE_KERNEL | _PAGE_EXECUTE | \
81 _PAGE_PRESENT | __READABLE | __WRITEABLE)
82#define PAGE_SIGNAL_TRAMPOLINE __pgprot(_PAGE_GLOBAL | _PAGE_EXECUTE | \
83 _PAGE_PRESENT | __READABLE)
84
85#define _KERNPG_TABLE (_PAGE_TABLE | _PAGE_KERNEL)
86
87/* CRISv32 can do page protection for execute.
88 * Write permissions imply read permissions.
89 * Note that the numbers are in Execute-Write-Read order!
90 */
91#define __P000 PAGE_NONE
92#define __P001 PAGE_READONLY
93#define __P010 PAGE_COPY
94#define __P011 PAGE_COPY
95#define __P100 PAGE_READONLY_EXEC
96#define __P101 PAGE_READONLY_EXEC
97#define __P110 PAGE_COPY_EXEC
98#define __P111 PAGE_COPY_EXEC
99
100#define __S000 PAGE_NONE
101#define __S001 PAGE_READONLY
102#define __S010 PAGE_SHARED
103#define __S011 PAGE_SHARED
104#define __S100 PAGE_READONLY_EXEC
105#define __S101 PAGE_READONLY_EXEC
106#define __S110 PAGE_SHARED_EXEC
107#define __S111 PAGE_SHARED_EXEC
108
109#define PTE_FILE_MAX_BITS 25
110
111#endif /* _ASM_CRIS_ARCH_MMU_H */
diff --git a/include/asm-cris/arch-v32/offset.h b/include/asm-cris/arch-v32/offset.h
new file mode 100644
index 000000000000..597419b033f9
--- /dev/null
+++ b/include/asm-cris/arch-v32/offset.h
@@ -0,0 +1,35 @@
1#ifndef __ASM_OFFSETS_H__
2#define __ASM_OFFSETS_H__
3/*
4 * DO NOT MODIFY.
5 *
6 * This file was generated by arch/cris/Makefile
7 *
8 */
9
10#define PT_orig_r10 0 /* offsetof(struct pt_regs, orig_r10) */
11#define PT_r13 56 /* offsetof(struct pt_regs, r13) */
12#define PT_r12 52 /* offsetof(struct pt_regs, r12) */
13#define PT_r11 48 /* offsetof(struct pt_regs, r11) */
14#define PT_r10 44 /* offsetof(struct pt_regs, r10) */
15#define PT_r9 40 /* offsetof(struct pt_regs, r9) */
16#define PT_acr 60 /* offsetof(struct pt_regs, acr) */
17#define PT_srs 64 /* offsetof(struct pt_regs, srs) */
18#define PT_mof 68 /* offsetof(struct pt_regs, mof) */
19#define PT_ccs 76 /* offsetof(struct pt_regs, ccs) */
20#define PT_srp 80 /* offsetof(struct pt_regs, srp) */
21
22#define TI_task 0 /* offsetof(struct thread_info, task) */
23#define TI_flags 8 /* offsetof(struct thread_info, flags) */
24#define TI_preempt_count 16 /* offsetof(struct thread_info, preempt_count) */
25
26#define THREAD_ksp 0 /* offsetof(struct thread_struct, ksp) */
27#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
28#define THREAD_ccs 8 /* offsetof(struct thread_struct, ccs) */
29
30#define TASK_pid 149 /* offsetof(struct task_struct, pid) */
31
32#define LCLONE_VM 256 /* CLONE_VM */
33#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */
34
35#endif
diff --git a/include/asm-cris/arch-v32/page.h b/include/asm-cris/arch-v32/page.h
new file mode 100644
index 000000000000..77827bc17cca
--- /dev/null
+++ b/include/asm-cris/arch-v32/page.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_CRIS_ARCH_PAGE_H
2#define _ASM_CRIS_ARCH_PAGE_H
3
4#include <linux/config.h>
5
6#ifdef __KERNEL__
7
8#define PAGE_OFFSET KSEG_C /* kseg_c is mapped to physical ram. */
9
10/*
11 * Macros to convert between physical and virtual addresses. By stripiing a
12 * selected bit it's possible to convert between KSEG_x and 0x40000000 where the
13 * DRAM really resides. DRAM is virtually at 0xc.
14 */
15#ifndef CONFIG_ETRAXFS_SIM
16#define __pa(x) ((unsigned long)(x) & 0x7fffffff)
17#define __va(x) ((void *)((unsigned long)(x) | 0x80000000))
18#else
19#define __pa(x) ((unsigned long)(x) & 0x3fffffff)
20#define __va(x) ((void *)((unsigned long)(x) | 0xc0000000))
21#endif
22
23#define VM_STACK_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
24 VM_MAYREAD | VM_MAYWRITE)
25
26#endif /* __KERNEL__ */
27
28#endif /* _ASM_CRIS_ARCH_PAGE_H */
diff --git a/include/asm-cris/arch-v32/pgtable.h b/include/asm-cris/arch-v32/pgtable.h
new file mode 100644
index 000000000000..08cb7ff7e4e7
--- /dev/null
+++ b/include/asm-cris/arch-v32/pgtable.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_CRIS_ARCH_PGTABLE_H
2#define _ASM_CRIS_ARCH_PGTABLE_H
3
4/* Define the kernels virtual memory area. */
5#define VMALLOC_START KSEG_D
6#define VMALLOC_END KSEG_E
7#define VMALLOC_VMADDR(x) ((unsigned long)(x))
8
9#endif /* _ASM_CRIS_ARCH_PGTABLE_H */
diff --git a/include/asm-cris/arch-v32/pinmux.h b/include/asm-cris/arch-v32/pinmux.h
new file mode 100644
index 000000000000..a66dc9970919
--- /dev/null
+++ b/include/asm-cris/arch-v32/pinmux.h
@@ -0,0 +1,39 @@
1#ifndef _ASM_CRIS_ARCH_PINMUX_H
2#define _ASM_CRIS_ARCH_PINMUX_H
3
4#define PORT_B 0
5#define PORT_C 1
6#define PORT_D 2
7#define PORT_E 3
8
9enum pin_mode
10{
11 pinmux_none = 0,
12 pinmux_fixed,
13 pinmux_gpio,
14 pinmux_iop
15};
16
17enum fixed_function
18{
19 pinmux_ser1,
20 pinmux_ser2,
21 pinmux_ser3,
22 pinmux_sser0,
23 pinmux_sser1,
24 pinmux_ata0,
25 pinmux_ata1,
26 pinmux_ata2,
27 pinmux_ata3,
28 pinmux_ata,
29 pinmux_eth1,
30 pinmux_timer
31};
32
33int crisv32_pinmux_init(void);
34int crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode);
35int crisv32_pinmux_alloc_fixed(enum fixed_function function);
36int crisv32_pinmux_dealloc(int port, int first_pin, int last_pin);
37void crisv32_pinmux_dump(void);
38
39#endif
diff --git a/include/asm-cris/arch-v32/processor.h b/include/asm-cris/arch-v32/processor.h
new file mode 100644
index 000000000000..8c939bf27987
--- /dev/null
+++ b/include/asm-cris/arch-v32/processor.h
@@ -0,0 +1,60 @@
1#ifndef _ASM_CRIS_ARCH_PROCESSOR_H
2#define _ASM_CRIS_ARCH_PROCESSOR_H
3
4#include <linux/config.h>
5
6/* Return current instruction pointer. */
7#define current_text_addr() \
8 ({void *pc; __asm__ __volatile__ ("lapcq .,%0" : "=rm" (pc)); pc;})
9
10/*
11 * Since CRIS doesn't do hardware task-switching this hasn't really anything to
12 * do with the proccessor itself, it's just here for legacy reasons. This is
13 * used when task-switching using _resume defined in entry.S. The offsets here
14 * are hardcoded into _resume, so if this struct is changed, entry.S needs to be
15 * changed as well.
16 */
17struct thread_struct {
18 unsigned long ksp; /* Kernel stack pointer. */
19 unsigned long usp; /* User stack pointer. */
20 unsigned long ccs; /* Saved flags register. */
21};
22
23/*
24 * User-space process size. This is hardcoded into a few places, so don't
25 * changed it unless everything's clear!
26 */
27#ifndef CONFIG_ETRAXFS_SIM
28#define TASK_SIZE (0xB0000000UL)
29#else
30#define TASK_SIZE (0xA0000000UL)
31#endif
32
33/* CCS I=1, enable interrupts. */
34#define INIT_THREAD { 0, 0, (1 << I_CCS_BITNR) }
35
36#define KSTK_EIP(tsk) \
37({ \
38 unsigned long eip = 0; \
39 unsigned long regs = (unsigned long)user_regs(tsk); \
40 if (regs > PAGE_SIZE && virt_addr_valid(regs)) \
41 eip = ((struct pt_regs *)regs)->erp; \
42 eip; \
43})
44
45/*
46 * Give the thread a program location, set user-mode and switch user
47 * stackpointer.
48 */
49#define start_thread(regs, ip, usp) \
50do { \
51 set_fs(USER_DS); \
52 regs->erp = ip; \
53 regs->ccs |= 1 << (U_CCS_BITNR + CCS_SHIFT); \
54 wrusp(usp); \
55} while(0)
56
57/* Nothing special to do for v32 when handling a kernel bus fault fixup. */
58#define arch_fixup(regs) {};
59
60#endif /* _ASM_CRIS_ARCH_PROCESSOR_H */
diff --git a/include/asm-cris/arch-v32/ptrace.h b/include/asm-cris/arch-v32/ptrace.h
new file mode 100644
index 000000000000..516cc7062d94
--- /dev/null
+++ b/include/asm-cris/arch-v32/ptrace.h
@@ -0,0 +1,114 @@
1#ifndef _CRIS_ARCH_PTRACE_H
2#define _CRIS_ARCH_PTRACE_H
3
4/* Register numbers in the ptrace system call interface */
5
6#define PT_ORIG_R10 0
7#define PT_R0 1
8#define PT_R1 2
9#define PT_R2 3
10#define PT_R3 4
11#define PT_R4 5
12#define PT_R5 6
13#define PT_R6 7
14#define PT_R7 8
15#define PT_R8 9
16#define PT_R9 10
17#define PT_R10 11
18#define PT_R11 12
19#define PT_R12 13
20#define PT_R13 14
21#define PT_ACR 15
22#define PT_SRS 16
23#define PT_MOF 17
24#define PT_SPC 18
25#define PT_CCS 19
26#define PT_SRP 20
27#define PT_ERP 21 /* This is actually the debugged process' PC */
28#define PT_EXS 22
29#define PT_EDA 23
30#define PT_USP 24 /* special case - USP is not in the pt_regs */
31#define PT_PPC 25 /* special case - pseudo PC */
32#define PT_BP 26 /* Base number for BP registers. */
33#define PT_BP_CTRL 26 /* BP control register. */
34#define PT_MAX 40
35
36/* Condition code bit numbers. */
37#define C_CCS_BITNR 0
38#define V_CCS_BITNR 1
39#define Z_CCS_BITNR 2
40#define N_CCS_BITNR 3
41#define X_CCS_BITNR 4
42#define I_CCS_BITNR 5
43#define U_CCS_BITNR 6
44#define P_CCS_BITNR 7
45#define R_CCS_BITNR 8
46#define S_CCS_BITNR 9
47#define M_CCS_BITNR 30
48#define Q_CCS_BITNR 31
49#define CCS_SHIFT 10 /* Shift count for each level in CCS */
50
51/* pt_regs not only specifices the format in the user-struct during
52 * ptrace but is also the frame format used in the kernel prologue/epilogues
53 * themselves
54 */
55
56struct pt_regs {
57 unsigned long orig_r10;
58 /* pushed by movem r13, [sp] in SAVE_ALL. */
59 unsigned long r0;
60 unsigned long r1;
61 unsigned long r2;
62 unsigned long r3;
63 unsigned long r4;
64 unsigned long r5;
65 unsigned long r6;
66 unsigned long r7;
67 unsigned long r8;
68 unsigned long r9;
69 unsigned long r10;
70 unsigned long r11;
71 unsigned long r12;
72 unsigned long r13;
73 unsigned long acr;
74 unsigned long srs;
75 unsigned long mof;
76 unsigned long spc;
77 unsigned long ccs;
78 unsigned long srp;
79 unsigned long erp; /* This is actually the debugged process' PC */
80 /* For debugging purposes; saved only when needed. */
81 unsigned long exs;
82 unsigned long eda;
83};
84
85/* switch_stack is the extra stuff pushed onto the stack in _resume (entry.S)
86 * when doing a context-switch. it is used (apart from in resume) when a new
87 * thread is made and we need to make _resume (which is starting it for the
88 * first time) realise what is going on.
89 *
90 * Actually, the use is very close to the thread struct (TSS) in that both the
91 * switch_stack and the TSS are used to keep thread stuff when switching in
92 * _resume.
93 */
94
95struct switch_stack {
96 unsigned long r0;
97 unsigned long r1;
98 unsigned long r2;
99 unsigned long r3;
100 unsigned long r4;
101 unsigned long r5;
102 unsigned long r6;
103 unsigned long r7;
104 unsigned long r8;
105 unsigned long r9;
106 unsigned long return_ip; /* ip that _resume will return to */
107};
108
109#define user_mode(regs) (((regs)->ccs & (1 << (U_CCS_BITNR + CCS_SHIFT))) != 0)
110#define instruction_pointer(regs) ((regs)->erp)
111extern void show_regs(struct pt_regs *);
112#define profile_pc(regs) instruction_pointer(regs)
113
114#endif
diff --git a/include/asm-cris/arch-v32/spinlock.h b/include/asm-cris/arch-v32/spinlock.h
new file mode 100644
index 000000000000..52df72a62232
--- /dev/null
+++ b/include/asm-cris/arch-v32/spinlock.h
@@ -0,0 +1,163 @@
1#ifndef __ASM_ARCH_SPINLOCK_H
2#define __ASM_ARCH_SPINLOCK_H
3
4#include <asm/system.h>
5
6#define RW_LOCK_BIAS 0x01000000
7#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
8#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
9
10#define spin_is_locked(x) (*(volatile signed char *)(&(x)->lock) <= 0)
11#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x))
12
13extern void cris_spin_unlock(void *l, int val);
14extern void cris_spin_lock(void *l);
15extern int cris_spin_trylock(void* l);
16
17static inline void _raw_spin_unlock(spinlock_t *lock)
18{
19 __asm__ volatile ("move.d %1,%0" \
20 : "=m" (lock->lock) \
21 : "r" (1) \
22 : "memory");
23}
24
25static inline int _raw_spin_trylock(spinlock_t *lock)
26{
27 return cris_spin_trylock((void*)&lock->lock);
28}
29
30static inline void _raw_spin_lock(spinlock_t *lock)
31{
32 cris_spin_lock((void*)&lock->lock);
33}
34
35static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
36{
37 _raw_spin_lock(lock);
38}
39
40/*
41 * Read-write spinlocks, allowing multiple readers
42 * but only one writer.
43 *
44 * NOTE! it is quite common to have readers in interrupts
45 * but no interrupt writers. For those circumstances we
46 * can "mix" irq-safe locks - any writer needs to get a
47 * irq-safe write-lock, but readers can get non-irqsafe
48 * read-locks.
49 */
50typedef struct {
51 spinlock_t lock;
52 volatile int counter;
53#ifdef CONFIG_PREEMPT
54 unsigned int break_lock;
55#endif
56} rwlock_t;
57
58#define RW_LOCK_UNLOCKED (rwlock_t) { {1}, 0 }
59
60#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while (0)
61
62/**
63 * read_can_lock - would read_trylock() succeed?
64 * @lock: the rwlock in question.
65 */
66#define read_can_lock(x) ((int)(x)->counter >= 0)
67
68/**
69 * write_can_lock - would write_trylock() succeed?
70 * @lock: the rwlock in question.
71 */
72#define write_can_lock(x) ((x)->counter == 0)
73
74#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
75
76/* read_lock, read_unlock are pretty straightforward. Of course it somehow
77 * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */
78
79static __inline__ void _raw_read_lock(rwlock_t *rw)
80{
81 unsigned long flags;
82 local_irq_save(flags);
83 _raw_spin_lock(&rw->lock);
84
85 rw->counter++;
86
87 _raw_spin_unlock(&rw->lock);
88 local_irq_restore(flags);
89}
90
91static __inline__ void _raw_read_unlock(rwlock_t *rw)
92{
93 unsigned long flags;
94 local_irq_save(flags);
95 _raw_spin_lock(&rw->lock);
96
97 rw->counter--;
98
99 _raw_spin_unlock(&rw->lock);
100 local_irq_restore(flags);
101}
102
103/* write_lock is less trivial. We optimistically grab the lock and check
104 * if we surprised any readers. If so we release the lock and wait till
105 * they're all gone before trying again
106 *
107 * Also note that we don't use the _irqsave / _irqrestore suffixes here.
108 * If we're called with interrupts enabled and we've got readers (or other
109 * writers) in interrupt handlers someone fucked up and we'd dead-lock
110 * sooner or later anyway. prumpf */
111
112static __inline__ void _raw_write_lock(rwlock_t *rw)
113{
114retry:
115 _raw_spin_lock(&rw->lock);
116
117 if(rw->counter != 0) {
118 /* this basically never happens */
119 _raw_spin_unlock(&rw->lock);
120
121 while(rw->counter != 0);
122
123 goto retry;
124 }
125
126 /* got it. now leave without unlocking */
127 rw->counter = -1; /* remember we are locked */
128}
129
130/* write_unlock is absolutely trivial - we don't have to wait for anything */
131
132static __inline__ void _raw_write_unlock(rwlock_t *rw)
133{
134 rw->counter = 0;
135 _raw_spin_unlock(&rw->lock);
136}
137
138static __inline__ int _raw_write_trylock(rwlock_t *rw)
139{
140 _raw_spin_lock(&rw->lock);
141 if (rw->counter != 0) {
142 /* this basically never happens */
143 _raw_spin_unlock(&rw->lock);
144
145 return 0;
146 }
147
148 /* got it. now leave without unlocking */
149 rw->counter = -1; /* remember we are locked */
150 return 1;
151}
152
153static __inline__ int is_read_locked(rwlock_t *rw)
154{
155 return rw->counter > 0;
156}
157
158static __inline__ int is_write_locked(rwlock_t *rw)
159{
160 return rw->counter < 0;
161}
162
163#endif /* __ASM_ARCH_SPINLOCK_H */
diff --git a/include/asm-cris/arch-v32/system.h b/include/asm-cris/arch-v32/system.h
new file mode 100644
index 000000000000..b9afbb95e0bb
--- /dev/null
+++ b/include/asm-cris/arch-v32/system.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_CRIS_ARCH_SYSTEM_H
2#define _ASM_CRIS_ARCH_SYSTEM_H
3
4#include <linux/config.h>
5
6/* Read the CPU version register. */
7extern inline unsigned long rdvr(void)
8{
9 unsigned char vr;
10
11 __asm__ __volatile__ ("move $vr, %0" : "=rm" (vr));
12 return vr;
13}
14
15#define cris_machine_name "crisv32"
16
17/* Read the user-mode stack pointer. */
18extern inline unsigned long rdusp(void)
19{
20 unsigned long usp;
21
22 __asm__ __volatile__ ("move $usp, %0" : "=rm" (usp));
23 return usp;
24}
25
26/* Read the current stack pointer. */
27extern inline unsigned long rdsp(void)
28{
29 unsigned long sp;
30
31 __asm__ __volatile__ ("move.d $sp, %0" : "=rm" (sp));
32 return sp;
33}
34
35/* Write the user-mode stack pointer. */
36#define wrusp(usp) __asm__ __volatile__ ("move %0, $usp" : : "rm" (usp))
37
38#define nop() __asm__ __volatile__ ("nop");
39
40#define xchg(ptr,x) \
41 ((__typeof__(*(ptr)))__xchg((unsigned long) (x),(ptr),sizeof(*(ptr))))
42
43#define tas(ptr) (xchg((ptr),1))
44
45struct __xchg_dummy { unsigned long a[100]; };
46#define __xg(x) ((struct __xchg_dummy *)(x))
47
48/* Used for interrupt control. */
49#define local_save_flags(x) \
50 __asm__ __volatile__ ("move $ccs, %0" : "=rm" (x) : : "memory");
51
52#define local_irq_restore(x) \
53 __asm__ __volatile__ ("move %0, $ccs" : : "rm" (x) : "memory");
54
55#define local_irq_disable() __asm__ __volatile__ ("di" : : : "memory");
56#define local_irq_enable() __asm__ __volatile__ ("ei" : : : "memory");
57
58#define irqs_disabled() \
59({ \
60 unsigned long flags; \
61 \
62 local_save_flags(flags);\
63 !(flags & (1 << I_CCS_BITNR)); \
64})
65
66/* Used for spinlocks, etc. */
67#define local_irq_save(x) \
68 __asm__ __volatile__ ("move $ccs, %0\n\tdi" : "=rm" (x) : : "memory");
69
70#ifdef CONFIG_SMP
71typedef struct {
72 volatile unsigned int lock __attribute__ ((aligned(4)));
73#ifdef CONFIG_PREEMPT
74 unsigned int break_lock;
75#endif
76} spinlock_t;
77#endif
78
79#endif /* _ASM_CRIS_ARCH_SYSTEM_H */
diff --git a/include/asm-cris/arch-v32/thread_info.h b/include/asm-cris/arch-v32/thread_info.h
new file mode 100644
index 000000000000..a7a182307da0
--- /dev/null
+++ b/include/asm-cris/arch-v32/thread_info.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_CRIS_ARCH_THREAD_INFO_H
2#define _ASM_CRIS_ARCH_THREAD_INFO_H
3
4/* Return a thread_info struct. */
5extern inline struct thread_info *current_thread_info(void)
6{
7 struct thread_info *ti;
8
9 __asm__ __volatile__ ("and.d $sp, %0" : "=r" (ti) : "0" (~8191UL));
10 return ti;
11}
12
13#endif /* _ASM_CRIS_ARCH_THREAD_INFO_H */
diff --git a/include/asm-cris/arch-v32/timex.h b/include/asm-cris/arch-v32/timex.h
new file mode 100644
index 000000000000..4d0fd23b21e9
--- /dev/null
+++ b/include/asm-cris/arch-v32/timex.h
@@ -0,0 +1,31 @@
1#ifndef _ASM_CRIS_ARCH_TIMEX_H
2#define _ASM_CRIS_ARCH_TIMEX_H
3
4#include <asm/arch/hwregs/reg_map.h>
5#include <asm/arch/hwregs/reg_rdwr.h>
6#include <asm/arch/hwregs/timer_defs.h>
7
8/*
9 * The clock runs at 100MHz, we divide it by 1000000. If you change anything
10 * here you must check time.c as well.
11 */
12
13#define CLOCK_TICK_RATE 100000000 /* Underlying frequency of the HZ timer */
14
15/* The timer0 values gives 10 ns resolution but interrupts at HZ. */
16#define TIMER0_FREQ (CLOCK_TICK_RATE)
17#define TIMER0_DIV (TIMER0_FREQ/(HZ))
18
19/* Convert the value in step of 10 ns to 1us without overflow: */
20#define GET_JIFFIES_USEC() \
21 ( (TIMER0_DIV - REG_RD(timer, regi_timer, r_tmr0_data)) /100 )
22
23extern unsigned long get_ns_in_jiffie(void);
24
25extern inline unsigned long get_us_in_jiffie_highres(void)
26{
27 return get_ns_in_jiffie() / 1000;
28}
29
30#endif
31
diff --git a/include/asm-cris/arch-v32/tlb.h b/include/asm-cris/arch-v32/tlb.h
new file mode 100644
index 000000000000..4effb1253660
--- /dev/null
+++ b/include/asm-cris/arch-v32/tlb.h
@@ -0,0 +1,14 @@
1#ifndef _CRIS_ARCH_TLB_H
2#define _CRIS_ARCH_TLB_H
3
4/*
5 * The TLB is a 64-entry cache. Each entry has a 8-bit page_id that is used
6 * to store the "process" it belongs to (=> fast mm context switch). The
7 * last page_id is never used so we can make TLB entries that never matches.
8 */
9#define NUM_TLB_ENTRIES 64
10#define NUM_PAGEID 256
11#define INVALID_PAGEID 255
12#define NO_CONTEXT -1
13
14#endif /* _CRIS_ARCH_TLB_H */
diff --git a/include/asm-cris/arch-v32/uaccess.h b/include/asm-cris/arch-v32/uaccess.h
new file mode 100644
index 000000000000..055a0bdbe835
--- /dev/null
+++ b/include/asm-cris/arch-v32/uaccess.h
@@ -0,0 +1,748 @@
1/*
2 * Authors: Hans-Peter Nilsson (hp@axis.com)
3 *
4 */
5#ifndef _CRIS_ARCH_UACCESS_H
6#define _CRIS_ARCH_UACCESS_H
7
8/*
9 * We don't tell gcc that we are accessing memory, but this is OK
10 * because we do not write to any memory gcc knows about, so there
11 * are no aliasing issues.
12 *
13 * Note that PC at a fault is the address *at* the faulting
14 * instruction for CRISv32.
15 */
16#define __put_user_asm(x, addr, err, op) \
17 __asm__ __volatile__( \
18 "2: "op" %1,[%2]\n" \
19 "4:\n" \
20 " .section .fixup,\"ax\"\n" \
21 "3: move.d %3,%0\n" \
22 " jump 4b\n" \
23 " nop\n" \
24 " .previous\n" \
25 " .section __ex_table,\"a\"\n" \
26 " .dword 2b,3b\n" \
27 " .previous\n" \
28 : "=r" (err) \
29 : "r" (x), "r" (addr), "g" (-EFAULT), "0" (err))
30
31#define __put_user_asm_64(x, addr, err) do { \
32 int dummy_for_put_user_asm_64_; \
33 __asm__ __volatile__( \
34 "2: move.d %M2,[%1+]\n" \
35 "4: move.d %H2,[%1]\n" \
36 "5:\n" \
37 " .section .fixup,\"ax\"\n" \
38 "3: move.d %4,%0\n" \
39 " jump 5b\n" \
40 " .previous\n" \
41 " .section __ex_table,\"a\"\n" \
42 " .dword 2b,3b\n" \
43 " .dword 4b,3b\n" \
44 " .previous\n" \
45 : "=r" (err), "=b" (dummy_for_put_user_asm_64_) \
46 : "r" (x), "1" (addr), "g" (-EFAULT), \
47 "0" (err)); \
48 } while (0)
49
50/* See comment before __put_user_asm. */
51
52#define __get_user_asm(x, addr, err, op) \
53 __asm__ __volatile__( \
54 "2: "op" [%2],%1\n" \
55 "4:\n" \
56 " .section .fixup,\"ax\"\n" \
57 "3: move.d %3,%0\n" \
58 " jump 4b\n" \
59 " moveq 0,%1\n" \
60 " .previous\n" \
61 " .section __ex_table,\"a\"\n" \
62 " .dword 2b,3b\n" \
63 " .previous\n" \
64 : "=r" (err), "=r" (x) \
65 : "r" (addr), "g" (-EFAULT), "0" (err))
66
67#define __get_user_asm_64(x, addr, err) do { \
68 int dummy_for_get_user_asm_64_; \
69 __asm__ __volatile__( \
70 "2: move.d [%2+],%M1\n" \
71 "4: move.d [%2],%H1\n" \
72 "5:\n" \
73 " .section .fixup,\"ax\"\n" \
74 "3: move.d %4,%0\n" \
75 " jump 5b\n" \
76 " moveq 0,%1\n" \
77 " .previous\n" \
78 " .section __ex_table,\"a\"\n" \
79 " .dword 2b,3b\n" \
80 " .dword 4b,3b\n" \
81 " .previous\n" \
82 : "=r" (err), "=r" (x), \
83 "=b" (dummy_for_get_user_asm_64_) \
84 : "2" (addr), "g" (-EFAULT), "0" (err));\
85 } while (0)
86
87/*
88 * Copy a null terminated string from userspace.
89 *
90 * Must return:
91 * -EFAULT for an exception
92 * count if we hit the buffer limit
93 * bytes copied if we hit a null byte
94 * (without the null byte)
95 */
96extern inline long
97__do_strncpy_from_user(char *dst, const char *src, long count)
98{
99 long res;
100
101 if (count == 0)
102 return 0;
103
104 /*
105 * Currently, in 2.4.0-test9, most ports use a simple byte-copy loop.
106 * So do we.
107 *
108 * This code is deduced from:
109 *
110 * char tmp2;
111 * long tmp1, tmp3;
112 * tmp1 = count;
113 * while ((*dst++ = (tmp2 = *src++)) != 0
114 * && --tmp1)
115 * ;
116 *
117 * res = count - tmp1;
118 *
119 * with tweaks.
120 */
121
122 __asm__ __volatile__ (
123 " move.d %3,%0\n"
124 "5: move.b [%2+],$acr\n"
125 "1: beq 2f\n"
126 " move.b $acr,[%1+]\n"
127
128 " subq 1,%0\n"
129 "2: bne 1b\n"
130 " move.b [%2+],$acr\n"
131
132 " sub.d %3,%0\n"
133 " neg.d %0,%0\n"
134 "3:\n"
135 " .section .fixup,\"ax\"\n"
136 "4: move.d %7,%0\n"
137 " jump 3b\n"
138 " nop\n"
139
140 /* The address for a fault at the first move is trivial.
141 The address for a fault at the second move is that of
142 the preceding branch insn, since the move insn is in
143 its delay-slot. That address is also a branch
144 target. Just so you don't get confused... */
145 " .previous\n"
146 " .section __ex_table,\"a\"\n"
147 " .dword 5b,4b\n"
148 " .dword 2b,4b\n"
149 " .previous"
150 : "=r" (res), "=b" (dst), "=b" (src), "=r" (count)
151 : "3" (count), "1" (dst), "2" (src), "g" (-EFAULT)
152 : "acr");
153
154 return res;
155}
156
157/* A few copy asms to build up the more complex ones from.
158
159 Note again, a post-increment is performed regardless of whether a bus
160 fault occurred in that instruction, and PC for a faulted insn is the
161 address for the insn, or for the preceding branch when in a delay-slot. */
162
163#define __asm_copy_user_cont(to, from, ret, COPY, FIXUP, TENTRY) \
164 __asm__ __volatile__ ( \
165 COPY \
166 "1:\n" \
167 " .section .fixup,\"ax\"\n" \
168 FIXUP \
169 " .previous\n" \
170 " .section __ex_table,\"a\"\n" \
171 TENTRY \
172 " .previous\n" \
173 : "=b" (to), "=b" (from), "=r" (ret) \
174 : "0" (to), "1" (from), "2" (ret) \
175 : "acr", "memory")
176
177#define __asm_copy_from_user_1(to, from, ret) \
178 __asm_copy_user_cont(to, from, ret, \
179 "2: move.b [%1+],$acr\n" \
180 " move.b $acr,[%0+]\n", \
181 "3: addq 1,%2\n" \
182 " jump 1b\n" \
183 " clear.b [%0+]\n", \
184 " .dword 2b,3b\n")
185
186#define __asm_copy_from_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
187 __asm_copy_user_cont(to, from, ret, \
188 COPY \
189 "2: move.w [%1+],$acr\n" \
190 " move.w $acr,[%0+]\n", \
191 FIXUP \
192 "3: addq 2,%2\n" \
193 " jump 1b\n" \
194 " clear.w [%0+]\n", \
195 TENTRY \
196 " .dword 2b,3b\n")
197
198#define __asm_copy_from_user_2(to, from, ret) \
199 __asm_copy_from_user_2x_cont(to, from, ret, "", "", "")
200
201#define __asm_copy_from_user_3(to, from, ret) \
202 __asm_copy_from_user_2x_cont(to, from, ret, \
203 "4: move.b [%1+],$acr\n" \
204 " move.b $acr,[%0+]\n", \
205 "5: addq 1,%2\n" \
206 " clear.b [%0+]\n", \
207 " .dword 4b,5b\n")
208
209#define __asm_copy_from_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
210 __asm_copy_user_cont(to, from, ret, \
211 COPY \
212 "2: move.d [%1+],$acr\n" \
213 " move.d $acr,[%0+]\n", \
214 FIXUP \
215 "3: addq 4,%2\n" \
216 " jump 1b\n" \
217 " clear.d [%0+]\n", \
218 TENTRY \
219 " .dword 2b,3b\n")
220
221#define __asm_copy_from_user_4(to, from, ret) \
222 __asm_copy_from_user_4x_cont(to, from, ret, "", "", "")
223
224#define __asm_copy_from_user_5(to, from, ret) \
225 __asm_copy_from_user_4x_cont(to, from, ret, \
226 "4: move.b [%1+],$acr\n" \
227 " move.b $acr,[%0+]\n", \
228 "5: addq 1,%2\n" \
229 " clear.b [%0+]\n", \
230 " .dword 4b,5b\n")
231
232#define __asm_copy_from_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
233 __asm_copy_from_user_4x_cont(to, from, ret, \
234 COPY \
235 "4: move.w [%1+],$acr\n" \
236 " move.w $acr,[%0+]\n", \
237 FIXUP \
238 "5: addq 2,%2\n" \
239 " clear.w [%0+]\n", \
240 TENTRY \
241 " .dword 4b,5b\n")
242
243#define __asm_copy_from_user_6(to, from, ret) \
244 __asm_copy_from_user_6x_cont(to, from, ret, "", "", "")
245
246#define __asm_copy_from_user_7(to, from, ret) \
247 __asm_copy_from_user_6x_cont(to, from, ret, \
248 "6: move.b [%1+],$acr\n" \
249 " move.b $acr,[%0+]\n", \
250 "7: addq 1,%2\n" \
251 " clear.b [%0+]\n", \
252 " .dword 6b,7b\n")
253
254#define __asm_copy_from_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
255 __asm_copy_from_user_4x_cont(to, from, ret, \
256 COPY \
257 "4: move.d [%1+],$acr\n" \
258 " move.d $acr,[%0+]\n", \
259 FIXUP \
260 "5: addq 4,%2\n" \
261 " clear.d [%0+]\n", \
262 TENTRY \
263 " .dword 4b,5b\n")
264
265#define __asm_copy_from_user_8(to, from, ret) \
266 __asm_copy_from_user_8x_cont(to, from, ret, "", "", "")
267
268#define __asm_copy_from_user_9(to, from, ret) \
269 __asm_copy_from_user_8x_cont(to, from, ret, \
270 "6: move.b [%1+],$acr\n" \
271 " move.b $acr,[%0+]\n", \
272 "7: addq 1,%2\n" \
273 " clear.b [%0+]\n", \
274 " .dword 6b,7b\n")
275
276#define __asm_copy_from_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
277 __asm_copy_from_user_8x_cont(to, from, ret, \
278 COPY \
279 "6: move.w [%1+],$acr\n" \
280 " move.w $acr,[%0+]\n", \
281 FIXUP \
282 "7: addq 2,%2\n" \
283 " clear.w [%0+]\n", \
284 TENTRY \
285 " .dword 6b,7b\n")
286
287#define __asm_copy_from_user_10(to, from, ret) \
288 __asm_copy_from_user_10x_cont(to, from, ret, "", "", "")
289
290#define __asm_copy_from_user_11(to, from, ret) \
291 __asm_copy_from_user_10x_cont(to, from, ret, \
292 "8: move.b [%1+],$acr\n" \
293 " move.b $acr,[%0+]\n", \
294 "9: addq 1,%2\n" \
295 " clear.b [%0+]\n", \
296 " .dword 8b,9b\n")
297
298#define __asm_copy_from_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
299 __asm_copy_from_user_8x_cont(to, from, ret, \
300 COPY \
301 "6: move.d [%1+],$acr\n" \
302 " move.d $acr,[%0+]\n", \
303 FIXUP \
304 "7: addq 4,%2\n" \
305 " clear.d [%0+]\n", \
306 TENTRY \
307 " .dword 6b,7b\n")
308
309#define __asm_copy_from_user_12(to, from, ret) \
310 __asm_copy_from_user_12x_cont(to, from, ret, "", "", "")
311
312#define __asm_copy_from_user_13(to, from, ret) \
313 __asm_copy_from_user_12x_cont(to, from, ret, \
314 "8: move.b [%1+],$acr\n" \
315 " move.b $acr,[%0+]\n", \
316 "9: addq 1,%2\n" \
317 " clear.b [%0+]\n", \
318 " .dword 8b,9b\n")
319
320#define __asm_copy_from_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
321 __asm_copy_from_user_12x_cont(to, from, ret, \
322 COPY \
323 "8: move.w [%1+],$acr\n" \
324 " move.w $acr,[%0+]\n", \
325 FIXUP \
326 "9: addq 2,%2\n" \
327 " clear.w [%0+]\n", \
328 TENTRY \
329 " .dword 8b,9b\n")
330
331#define __asm_copy_from_user_14(to, from, ret) \
332 __asm_copy_from_user_14x_cont(to, from, ret, "", "", "")
333
334#define __asm_copy_from_user_15(to, from, ret) \
335 __asm_copy_from_user_14x_cont(to, from, ret, \
336 "10: move.b [%1+],$acr\n" \
337 " move.b $acr,[%0+]\n", \
338 "11: addq 1,%2\n" \
339 " clear.b [%0+]\n", \
340 " .dword 10b,11b\n")
341
342#define __asm_copy_from_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
343 __asm_copy_from_user_12x_cont(to, from, ret, \
344 COPY \
345 "8: move.d [%1+],$acr\n" \
346 " move.d $acr,[%0+]\n", \
347 FIXUP \
348 "9: addq 4,%2\n" \
349 " clear.d [%0+]\n", \
350 TENTRY \
351 " .dword 8b,9b\n")
352
353#define __asm_copy_from_user_16(to, from, ret) \
354 __asm_copy_from_user_16x_cont(to, from, ret, "", "", "")
355
356#define __asm_copy_from_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
357 __asm_copy_from_user_16x_cont(to, from, ret, \
358 COPY \
359 "10: move.d [%1+],$acr\n" \
360 " move.d $acr,[%0+]\n", \
361 FIXUP \
362 "11: addq 4,%2\n" \
363 " clear.d [%0+]\n", \
364 TENTRY \
365 " .dword 10b,11b\n")
366
367#define __asm_copy_from_user_20(to, from, ret) \
368 __asm_copy_from_user_20x_cont(to, from, ret, "", "", "")
369
370#define __asm_copy_from_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
371 __asm_copy_from_user_20x_cont(to, from, ret, \
372 COPY \
373 "12: move.d [%1+],$acr\n" \
374 " move.d $acr,[%0+]\n", \
375 FIXUP \
376 "13: addq 4,%2\n" \
377 " clear.d [%0+]\n", \
378 TENTRY \
379 " .dword 12b,13b\n")
380
381#define __asm_copy_from_user_24(to, from, ret) \
382 __asm_copy_from_user_24x_cont(to, from, ret, "", "", "")
383
384/* And now, the to-user ones. */
385
386#define __asm_copy_to_user_1(to, from, ret) \
387 __asm_copy_user_cont(to, from, ret, \
388 " move.b [%1+],$acr\n" \
389 "2: move.b $acr,[%0+]\n", \
390 "3: jump 1b\n" \
391 " addq 1,%2\n", \
392 " .dword 2b,3b\n")
393
394#define __asm_copy_to_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
395 __asm_copy_user_cont(to, from, ret, \
396 COPY \
397 " move.w [%1+],$acr\n" \
398 "2: move.w $acr,[%0+]\n", \
399 FIXUP \
400 "3: jump 1b\n" \
401 " addq 2,%2\n", \
402 TENTRY \
403 " .dword 2b,3b\n")
404
405#define __asm_copy_to_user_2(to, from, ret) \
406 __asm_copy_to_user_2x_cont(to, from, ret, "", "", "")
407
408#define __asm_copy_to_user_3(to, from, ret) \
409 __asm_copy_to_user_2x_cont(to, from, ret, \
410 " move.b [%1+],$acr\n" \
411 "4: move.b $acr,[%0+]\n", \
412 "5: addq 1,%2\n", \
413 " .dword 4b,5b\n")
414
415#define __asm_copy_to_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
416 __asm_copy_user_cont(to, from, ret, \
417 COPY \
418 " move.d [%1+],$acr\n" \
419 "2: move.d $acr,[%0+]\n", \
420 FIXUP \
421 "3: jump 1b\n" \
422 " addq 4,%2\n", \
423 TENTRY \
424 " .dword 2b,3b\n")
425
426#define __asm_copy_to_user_4(to, from, ret) \
427 __asm_copy_to_user_4x_cont(to, from, ret, "", "", "")
428
429#define __asm_copy_to_user_5(to, from, ret) \
430 __asm_copy_to_user_4x_cont(to, from, ret, \
431 " move.b [%1+],$acr\n" \
432 "4: move.b $acr,[%0+]\n", \
433 "5: addq 1,%2\n", \
434 " .dword 4b,5b\n")
435
436#define __asm_copy_to_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
437 __asm_copy_to_user_4x_cont(to, from, ret, \
438 COPY \
439 " move.w [%1+],$acr\n" \
440 "4: move.w $acr,[%0+]\n", \
441 FIXUP \
442 "5: addq 2,%2\n", \
443 TENTRY \
444 " .dword 4b,5b\n")
445
446#define __asm_copy_to_user_6(to, from, ret) \
447 __asm_copy_to_user_6x_cont(to, from, ret, "", "", "")
448
449#define __asm_copy_to_user_7(to, from, ret) \
450 __asm_copy_to_user_6x_cont(to, from, ret, \
451 " move.b [%1+],$acr\n" \
452 "6: move.b $acr,[%0+]\n", \
453 "7: addq 1,%2\n", \
454 " .dword 6b,7b\n")
455
456#define __asm_copy_to_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
457 __asm_copy_to_user_4x_cont(to, from, ret, \
458 COPY \
459 " move.d [%1+],$acr\n" \
460 "4: move.d $acr,[%0+]\n", \
461 FIXUP \
462 "5: addq 4,%2\n", \
463 TENTRY \
464 " .dword 4b,5b\n")
465
466#define __asm_copy_to_user_8(to, from, ret) \
467 __asm_copy_to_user_8x_cont(to, from, ret, "", "", "")
468
469#define __asm_copy_to_user_9(to, from, ret) \
470 __asm_copy_to_user_8x_cont(to, from, ret, \
471 " move.b [%1+],$acr\n" \
472 "6: move.b $acr,[%0+]\n", \
473 "7: addq 1,%2\n", \
474 " .dword 6b,7b\n")
475
476#define __asm_copy_to_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
477 __asm_copy_to_user_8x_cont(to, from, ret, \
478 COPY \
479 " move.w [%1+],$acr\n" \
480 "6: move.w $acr,[%0+]\n", \
481 FIXUP \
482 "7: addq 2,%2\n", \
483 TENTRY \
484 " .dword 6b,7b\n")
485
486#define __asm_copy_to_user_10(to, from, ret) \
487 __asm_copy_to_user_10x_cont(to, from, ret, "", "", "")
488
489#define __asm_copy_to_user_11(to, from, ret) \
490 __asm_copy_to_user_10x_cont(to, from, ret, \
491 " move.b [%1+],$acr\n" \
492 "8: move.b $acr,[%0+]\n", \
493 "9: addq 1,%2\n", \
494 " .dword 8b,9b\n")
495
496#define __asm_copy_to_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
497 __asm_copy_to_user_8x_cont(to, from, ret, \
498 COPY \
499 " move.d [%1+],$acr\n" \
500 "6: move.d $acr,[%0+]\n", \
501 FIXUP \
502 "7: addq 4,%2\n", \
503 TENTRY \
504 " .dword 6b,7b\n")
505
506#define __asm_copy_to_user_12(to, from, ret) \
507 __asm_copy_to_user_12x_cont(to, from, ret, "", "", "")
508
509#define __asm_copy_to_user_13(to, from, ret) \
510 __asm_copy_to_user_12x_cont(to, from, ret, \
511 " move.b [%1+],$acr\n" \
512 "8: move.b $acr,[%0+]\n", \
513 "9: addq 1,%2\n", \
514 " .dword 8b,9b\n")
515
516#define __asm_copy_to_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
517 __asm_copy_to_user_12x_cont(to, from, ret, \
518 COPY \
519 " move.w [%1+],$acr\n" \
520 "8: move.w $acr,[%0+]\n", \
521 FIXUP \
522 "9: addq 2,%2\n", \
523 TENTRY \
524 " .dword 8b,9b\n")
525
526#define __asm_copy_to_user_14(to, from, ret) \
527 __asm_copy_to_user_14x_cont(to, from, ret, "", "", "")
528
529#define __asm_copy_to_user_15(to, from, ret) \
530 __asm_copy_to_user_14x_cont(to, from, ret, \
531 " move.b [%1+],$acr\n" \
532 "10: move.b $acr,[%0+]\n", \
533 "11: addq 1,%2\n", \
534 " .dword 10b,11b\n")
535
536#define __asm_copy_to_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
537 __asm_copy_to_user_12x_cont(to, from, ret, \
538 COPY \
539 " move.d [%1+],$acr\n" \
540 "8: move.d $acr,[%0+]\n", \
541 FIXUP \
542 "9: addq 4,%2\n", \
543 TENTRY \
544 " .dword 8b,9b\n")
545
546#define __asm_copy_to_user_16(to, from, ret) \
547 __asm_copy_to_user_16x_cont(to, from, ret, "", "", "")
548
549#define __asm_copy_to_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
550 __asm_copy_to_user_16x_cont(to, from, ret, \
551 COPY \
552 " move.d [%1+],$acr\n" \
553 "10: move.d $acr,[%0+]\n", \
554 FIXUP \
555 "11: addq 4,%2\n", \
556 TENTRY \
557 " .dword 10b,11b\n")
558
559#define __asm_copy_to_user_20(to, from, ret) \
560 __asm_copy_to_user_20x_cont(to, from, ret, "", "", "")
561
562#define __asm_copy_to_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
563 __asm_copy_to_user_20x_cont(to, from, ret, \
564 COPY \
565 " move.d [%1+],$acr\n" \
566 "12: move.d $acr,[%0+]\n", \
567 FIXUP \
568 "13: addq 4,%2\n", \
569 TENTRY \
570 " .dword 12b,13b\n")
571
572#define __asm_copy_to_user_24(to, from, ret) \
573 __asm_copy_to_user_24x_cont(to, from, ret, "", "", "")
574
575/* Define a few clearing asms with exception handlers. */
576
577/* This frame-asm is like the __asm_copy_user_cont one, but has one less
578 input. */
579
580#define __asm_clear(to, ret, CLEAR, FIXUP, TENTRY) \
581 __asm__ __volatile__ ( \
582 CLEAR \
583 "1:\n" \
584 " .section .fixup,\"ax\"\n" \
585 FIXUP \
586 " .previous\n" \
587 " .section __ex_table,\"a\"\n" \
588 TENTRY \
589 " .previous" \
590 : "=b" (to), "=r" (ret) \
591 : "0" (to), "1" (ret) \
592 : "memory")
593
594#define __asm_clear_1(to, ret) \
595 __asm_clear(to, ret, \
596 "2: clear.b [%0+]\n", \
597 "3: jump 1b\n" \
598 " addq 1,%1\n", \
599 " .dword 2b,3b\n")
600
601#define __asm_clear_2(to, ret) \
602 __asm_clear(to, ret, \
603 "2: clear.w [%0+]\n", \
604 "3: jump 1b\n" \
605 " addq 2,%1\n", \
606 " .dword 2b,3b\n")
607
608#define __asm_clear_3(to, ret) \
609 __asm_clear(to, ret, \
610 "2: clear.w [%0+]\n" \
611 "3: clear.b [%0+]\n", \
612 "4: addq 2,%1\n" \
613 "5: jump 1b\n" \
614 " addq 1,%1\n", \
615 " .dword 2b,4b\n" \
616 " .dword 3b,5b\n")
617
618#define __asm_clear_4x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
619 __asm_clear(to, ret, \
620 CLEAR \
621 "2: clear.d [%0+]\n", \
622 FIXUP \
623 "3: jump 1b\n" \
624 " addq 4,%1\n", \
625 TENTRY \
626 " .dword 2b,3b\n")
627
628#define __asm_clear_4(to, ret) \
629 __asm_clear_4x_cont(to, ret, "", "", "")
630
631#define __asm_clear_8x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
632 __asm_clear_4x_cont(to, ret, \
633 CLEAR \
634 "4: clear.d [%0+]\n", \
635 FIXUP \
636 "5: addq 4,%1\n", \
637 TENTRY \
638 " .dword 4b,5b\n")
639
640#define __asm_clear_8(to, ret) \
641 __asm_clear_8x_cont(to, ret, "", "", "")
642
643#define __asm_clear_12x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
644 __asm_clear_8x_cont(to, ret, \
645 CLEAR \
646 "6: clear.d [%0+]\n", \
647 FIXUP \
648 "7: addq 4,%1\n", \
649 TENTRY \
650 " .dword 6b,7b\n")
651
652#define __asm_clear_12(to, ret) \
653 __asm_clear_12x_cont(to, ret, "", "", "")
654
655#define __asm_clear_16x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
656 __asm_clear_12x_cont(to, ret, \
657 CLEAR \
658 "8: clear.d [%0+]\n", \
659 FIXUP \
660 "9: addq 4,%1\n", \
661 TENTRY \
662 " .dword 8b,9b\n")
663
664#define __asm_clear_16(to, ret) \
665 __asm_clear_16x_cont(to, ret, "", "", "")
666
667#define __asm_clear_20x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
668 __asm_clear_16x_cont(to, ret, \
669 CLEAR \
670 "10: clear.d [%0+]\n", \
671 FIXUP \
672 "11: addq 4,%1\n", \
673 TENTRY \
674 " .dword 10b,11b\n")
675
676#define __asm_clear_20(to, ret) \
677 __asm_clear_20x_cont(to, ret, "", "", "")
678
679#define __asm_clear_24x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
680 __asm_clear_20x_cont(to, ret, \
681 CLEAR \
682 "12: clear.d [%0+]\n", \
683 FIXUP \
684 "13: addq 4,%1\n", \
685 TENTRY \
686 " .dword 12b,13b\n")
687
688#define __asm_clear_24(to, ret) \
689 __asm_clear_24x_cont(to, ret, "", "", "")
690
691/*
692 * Return the size of a string (including the ending 0)
693 *
694 * Return length of string in userspace including terminating 0
695 * or 0 for error. Return a value greater than N if too long.
696 */
697
698extern inline long
699strnlen_user(const char *s, long n)
700{
701 long res, tmp1;
702
703 if (!access_ok(VERIFY_READ, s, 0))
704 return 0;
705
706 /*
707 * This code is deduced from:
708 *
709 * tmp1 = n;
710 * while (tmp1-- > 0 && *s++)
711 * ;
712 *
713 * res = n - tmp1;
714 *
715 * (with tweaks).
716 */
717
718 __asm__ __volatile__ (
719 " move.d %1,$acr\n"
720 " cmpq 0,$acr\n"
721 "0:\n"
722 " ble 1f\n"
723 " subq 1,$acr\n"
724
725 "4: test.b [%0+]\n"
726 " bne 0b\n"
727 " cmpq 0,$acr\n"
728 "1:\n"
729 " move.d %1,%0\n"
730 " sub.d $acr,%0\n"
731 "2:\n"
732 " .section .fixup,\"ax\"\n"
733
734 "3: jump 2b\n"
735 " clear.d %0\n"
736
737 " .previous\n"
738 " .section __ex_table,\"a\"\n"
739 " .dword 4b,3b\n"
740 " .previous\n"
741 : "=r" (res), "=r" (tmp1)
742 : "0" (s), "1" (n)
743 : "acr");
744
745 return res;
746}
747
748#endif
diff --git a/include/asm-cris/arch-v32/unistd.h b/include/asm-cris/arch-v32/unistd.h
new file mode 100644
index 000000000000..5d369d4439d9
--- /dev/null
+++ b/include/asm-cris/arch-v32/unistd.h
@@ -0,0 +1,148 @@
1#ifndef _ASM_CRIS_ARCH_UNISTD_H_
2#define _ASM_CRIS_ARCH_UNISTD_H_
3
4/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
5/*
6 * Don't remove the .ifnc tests; they are an insurance against
7 * any hard-to-spot gcc register allocation bugs.
8 */
9#define _syscall0(type,name) \
10type name(void) \
11{ \
12 register long __a __asm__ ("r10"); \
13 register long __n_ __asm__ ("r9") = (__NR_##name); \
14 __asm__ __volatile__ (".ifnc %0%1,$r10$r9\n\t" \
15 ".err\n\t" \
16 ".endif\n\t" \
17 "break 13" \
18 : "=r" (__a) \
19 : "r" (__n_)); \
20 if (__a >= 0) \
21 return (type) __a; \
22 errno = -__a; \
23 return (type) -1; \
24}
25
26#define _syscall1(type,name,type1,arg1) \
27type name(type1 arg1) \
28{ \
29 register long __a __asm__ ("r10") = (long) arg1; \
30 register long __n_ __asm__ ("r9") = (__NR_##name); \
31 __asm__ __volatile__ (".ifnc %0%1,$r10$r9\n\t" \
32 ".err\n\t" \
33 ".endif\n\t" \
34 "break 13" \
35 : "=r" (__a) \
36 : "r" (__n_), "0" (__a)); \
37 if (__a >= 0) \
38 return (type) __a; \
39 errno = -__a; \
40 return (type) -1; \
41}
42
43#define _syscall2(type,name,type1,arg1,type2,arg2) \
44type name(type1 arg1,type2 arg2) \
45{ \
46 register long __a __asm__ ("r10") = (long) arg1; \
47 register long __b __asm__ ("r11") = (long) arg2; \
48 register long __n_ __asm__ ("r9") = (__NR_##name); \
49 __asm__ __volatile__ (".ifnc %0%1%3,$r10$r9$r11\n\t" \
50 ".err\n\t" \
51 ".endif\n\t" \
52 "break 13" \
53 : "=r" (__a) \
54 : "r" (__n_), "0" (__a), "r" (__b)); \
55 if (__a >= 0) \
56 return (type) __a; \
57 errno = -__a; \
58 return (type) -1; \
59}
60
61#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
62type name(type1 arg1,type2 arg2,type3 arg3) \
63{ \
64 register long __a __asm__ ("r10") = (long) arg1; \
65 register long __b __asm__ ("r11") = (long) arg2; \
66 register long __c __asm__ ("r12") = (long) arg3; \
67 register long __n_ __asm__ ("r9") = (__NR_##name); \
68 __asm__ __volatile__ (".ifnc %0%1%3%4,$r10$r9$r11$r12\n\t" \
69 ".err\n\t" \
70 ".endif\n\t" \
71 "break 13" \
72 : "=r" (__a) \
73 : "r" (__n_), "0" (__a), "r" (__b), "r" (__c)); \
74 if (__a >= 0) \
75 return (type) __a; \
76 errno = -__a; \
77 return (type) -1; \
78}
79
80#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
81type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
82{ \
83 register long __a __asm__ ("r10") = (long) arg1; \
84 register long __b __asm__ ("r11") = (long) arg2; \
85 register long __c __asm__ ("r12") = (long) arg3; \
86 register long __d __asm__ ("r13") = (long) arg4; \
87 register long __n_ __asm__ ("r9") = (__NR_##name); \
88 __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \
89 ".err\n\t" \
90 ".endif\n\t" \
91 "break 13" \
92 : "=r" (__a) \
93 : "r" (__n_), "0" (__a), "r" (__b), \
94 "r" (__c), "r" (__d)); \
95 if (__a >= 0) \
96 return (type) __a; \
97 errno = -__a; \
98 return (type) -1; \
99}
100
101#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
102 type5,arg5) \
103type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
104{ \
105 register long __a __asm__ ("r10") = (long) arg1; \
106 register long __b __asm__ ("r11") = (long) arg2; \
107 register long __c __asm__ ("r12") = (long) arg3; \
108 register long __d __asm__ ("r13") = (long) arg4; \
109 register long __e __asm__ ("mof") = (long) arg5; \
110 register long __n_ __asm__ ("r9") = (__NR_##name); \
111 __asm__ __volatile__ (".ifnc %0%1%3%4%5%6,$r10$r9$r11$r12$r13$mof\n\t" \
112 ".err\n\t" \
113 ".endif\n\t" \
114 "break 13" \
115 : "=r" (__a) \
116 : "r" (__n_), "0" (__a), "r" (__b), \
117 "r" (__c), "r" (__d), "h" (__e)); \
118 if (__a >= 0) \
119 return (type) __a; \
120 errno = -__a; \
121 return (type) -1; \
122}
123
124#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
125 type5,arg5,type6,arg6) \
126type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
127{ \
128 register long __a __asm__ ("r10") = (long) arg1; \
129 register long __b __asm__ ("r11") = (long) arg2; \
130 register long __c __asm__ ("r12") = (long) arg3; \
131 register long __d __asm__ ("r13") = (long) arg4; \
132 register long __e __asm__ ("mof") = (long) arg5; \
133 register long __f __asm__ ("srp") = (long) arg6; \
134 register long __n_ __asm__ ("r9") = (__NR_##name); \
135 __asm__ __volatile__ (".ifnc %0%1%3%4%5%6%7,$r10$r9$r11$r12$r13$mof$srp\n\t" \
136 ".err\n\t" \
137 ".endif\n\t" \
138 "break 13" \
139 : "=r" (__a) \
140 : "r" (__n_), "0" (__a), "r" (__b), \
141 "r" (__c), "r" (__d), "h" (__e), "x" (__f)); \
142 if (__a >= 0) \
143 return (type) __a; \
144 errno = -__a; \
145 return (type) -1; \
146}
147
148#endif
diff --git a/include/asm-cris/arch-v32/user.h b/include/asm-cris/arch-v32/user.h
new file mode 100644
index 000000000000..03fa1f3c3c00
--- /dev/null
+++ b/include/asm-cris/arch-v32/user.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_CRIS_ARCH_USER_H
2#define _ASM_CRIS_ARCH_USER_H
3
4/* User-mode register used for core dumps. */
5
6struct user_regs_struct {
7 unsigned long r0; /* General registers. */
8 unsigned long r1;
9 unsigned long r2;
10 unsigned long r3;
11 unsigned long r4;
12 unsigned long r5;
13 unsigned long r6;
14 unsigned long r7;
15 unsigned long r8;
16 unsigned long r9;
17 unsigned long r10;
18 unsigned long r11;
19 unsigned long r12;
20 unsigned long r13;
21 unsigned long sp; /* R14, Stack pointer. */
22 unsigned long acr; /* R15, Address calculation register. */
23 unsigned long bz; /* P0, Constant zero (8-bits). */
24 unsigned long vr; /* P1, Version register (8-bits). */
25 unsigned long pid; /* P2, Process ID (8-bits). */
26 unsigned long srs; /* P3, Support register select (8-bits). */
27 unsigned long wz; /* P4, Constant zero (16-bits). */
28 unsigned long exs; /* P5, Exception status. */
29 unsigned long eda; /* P6, Exception data address. */
30 unsigned long mof; /* P7, Multiply overflow regiter. */
31 unsigned long dz; /* P8, Constant zero (32-bits). */
32 unsigned long ebp; /* P9, Exception base pointer. */
33 unsigned long erp; /* P10, Exception return pointer. */
34 unsigned long srp; /* P11, Subroutine return pointer. */
35 unsigned long nrp; /* P12, NMI return pointer. */
36 unsigned long ccs; /* P13, Condition code stack. */
37 unsigned long usp; /* P14, User mode stack pointer. */
38 unsigned long spc; /* P15, Single step PC. */
39};
40
41#endif /* _ASM_CRIS_ARCH_USER_H */
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index b3dfea5a71e4..70605b09e8b7 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -4,21 +4,14 @@
4#define __ASM_CRIS_ATOMIC__ 4#define __ASM_CRIS_ATOMIC__
5 5
6#include <asm/system.h> 6#include <asm/system.h>
7#include <asm/arch/atomic.h>
7 8
8/* 9/*
9 * Atomic operations that C can't guarantee us. Useful for 10 * Atomic operations that C can't guarantee us. Useful for
10 * resource counting etc.. 11 * resource counting etc..
11 */ 12 */
12 13
13/* 14typedef struct { volatile int counter; } atomic_t;
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 */
18
19#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
20
21typedef struct { int counter; } atomic_t;
22 15
23#define ATOMIC_INIT(i) { (i) } 16#define ATOMIC_INIT(i) { (i) }
24 17
@@ -30,29 +23,26 @@ typedef struct { int counter; } atomic_t;
30extern __inline__ void atomic_add(int i, volatile atomic_t *v) 23extern __inline__ void atomic_add(int i, volatile atomic_t *v)
31{ 24{
32 unsigned long flags; 25 unsigned long flags;
33 local_save_flags(flags); 26 cris_atomic_save(v, flags);
34 local_irq_disable();
35 v->counter += i; 27 v->counter += i;
36 local_irq_restore(flags); 28 cris_atomic_restore(v, flags);
37} 29}
38 30
39extern __inline__ void atomic_sub(int i, volatile atomic_t *v) 31extern __inline__ void atomic_sub(int i, volatile atomic_t *v)
40{ 32{
41 unsigned long flags; 33 unsigned long flags;
42 local_save_flags(flags); 34 cris_atomic_save(v, flags);
43 local_irq_disable();
44 v->counter -= i; 35 v->counter -= i;
45 local_irq_restore(flags); 36 cris_atomic_restore(v, flags);
46} 37}
47 38
48extern __inline__ int atomic_add_return(int i, volatile atomic_t *v) 39extern __inline__ int atomic_add_return(int i, volatile atomic_t *v)
49{ 40{
50 unsigned long flags; 41 unsigned long flags;
51 int retval; 42 int retval;
52 local_save_flags(flags); 43 cris_atomic_save(v, flags);
53 local_irq_disable();
54 retval = (v->counter += i); 44 retval = (v->counter += i);
55 local_irq_restore(flags); 45 cris_atomic_restore(v, flags);
56 return retval; 46 return retval;
57} 47}
58 48
@@ -62,10 +52,9 @@ extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v)
62{ 52{
63 unsigned long flags; 53 unsigned long flags;
64 int retval; 54 int retval;
65 local_save_flags(flags); 55 cris_atomic_save(v, flags);
66 local_irq_disable();
67 retval = (v->counter -= i); 56 retval = (v->counter -= i);
68 local_irq_restore(flags); 57 cris_atomic_restore(v, flags);
69 return retval; 58 return retval;
70} 59}
71 60
@@ -73,39 +62,35 @@ extern __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v)
73{ 62{
74 int retval; 63 int retval;
75 unsigned long flags; 64 unsigned long flags;
76 local_save_flags(flags); 65 cris_atomic_save(v, flags);
77 local_irq_disable();
78 retval = (v->counter -= i) == 0; 66 retval = (v->counter -= i) == 0;
79 local_irq_restore(flags); 67 cris_atomic_restore(v, flags);
80 return retval; 68 return retval;
81} 69}
82 70
83extern __inline__ void atomic_inc(volatile atomic_t *v) 71extern __inline__ void atomic_inc(volatile atomic_t *v)
84{ 72{
85 unsigned long flags; 73 unsigned long flags;
86 local_save_flags(flags); 74 cris_atomic_save(v, flags);
87 local_irq_disable();
88 (v->counter)++; 75 (v->counter)++;
89 local_irq_restore(flags); 76 cris_atomic_restore(v, flags);
90} 77}
91 78
92extern __inline__ void atomic_dec(volatile atomic_t *v) 79extern __inline__ void atomic_dec(volatile atomic_t *v)
93{ 80{
94 unsigned long flags; 81 unsigned long flags;
95 local_save_flags(flags); 82 cris_atomic_save(v, flags);
96 local_irq_disable();
97 (v->counter)--; 83 (v->counter)--;
98 local_irq_restore(flags); 84 cris_atomic_restore(v, flags);
99} 85}
100 86
101extern __inline__ int atomic_inc_return(volatile atomic_t *v) 87extern __inline__ int atomic_inc_return(volatile atomic_t *v)
102{ 88{
103 unsigned long flags; 89 unsigned long flags;
104 int retval; 90 int retval;
105 local_save_flags(flags); 91 cris_atomic_save(v, flags);
106 local_irq_disable();
107 retval = (v->counter)++; 92 retval = (v->counter)++;
108 local_irq_restore(flags); 93 cris_atomic_restore(v, flags);
109 return retval; 94 return retval;
110} 95}
111 96
@@ -113,20 +98,18 @@ extern __inline__ int atomic_dec_return(volatile atomic_t *v)
113{ 98{
114 unsigned long flags; 99 unsigned long flags;
115 int retval; 100 int retval;
116 local_save_flags(flags); 101 cris_atomic_save(v, flags);
117 local_irq_disable();
118 retval = (v->counter)--; 102 retval = (v->counter)--;
119 local_irq_restore(flags); 103 cris_atomic_restore(v, flags);
120 return retval; 104 return retval;
121} 105}
122extern __inline__ int atomic_dec_and_test(volatile atomic_t *v) 106extern __inline__ int atomic_dec_and_test(volatile atomic_t *v)
123{ 107{
124 int retval; 108 int retval;
125 unsigned long flags; 109 unsigned long flags;
126 local_save_flags(flags); 110 cris_atomic_save(v, flags);
127 local_irq_disable();
128 retval = --(v->counter) == 0; 111 retval = --(v->counter) == 0;
129 local_irq_restore(flags); 112 cris_atomic_restore(v, flags);
130 return retval; 113 return retval;
131} 114}
132 115
@@ -134,10 +117,9 @@ extern __inline__ int atomic_inc_and_test(volatile atomic_t *v)
134{ 117{
135 int retval; 118 int retval;
136 unsigned long flags; 119 unsigned long flags;
137 local_save_flags(flags); 120 cris_atomic_save(v, flags);
138 local_irq_disable();
139 retval = ++(v->counter) == 0; 121 retval = ++(v->counter) == 0;
140 local_irq_restore(flags); 122 cris_atomic_restore(v, flags);
141 return retval; 123 return retval;
142} 124}
143 125
diff --git a/include/asm-cris/axisflashmap.h b/include/asm-cris/axisflashmap.h
index 600bb8715d89..7a8d3114e682 100644
--- a/include/asm-cris/axisflashmap.h
+++ b/include/asm-cris/axisflashmap.h
@@ -40,4 +40,7 @@ struct partitiontable_entry {
40#define PARTITION_TYPE_KERNEL 0x0002 40#define PARTITION_TYPE_KERNEL 0x0002
41#define PARTITION_TYPE_JFFS 0x0003 41#define PARTITION_TYPE_JFFS 0x0003
42 42
43/* The master mtd for the entire flash. */
44extern struct mtd_info* axisflash_mtd;
45
43#endif 46#endif
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index d7861115d731..e3da57f97964 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -16,6 +16,7 @@
16 16
17#include <asm/arch/bitops.h> 17#include <asm/arch/bitops.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/atomic.h>
19#include <linux/compiler.h> 20#include <linux/compiler.h>
20 21
21/* 22/*
@@ -88,7 +89,7 @@ struct __dummy { unsigned long a[100]; };
88 * It also implies a memory barrier. 89 * It also implies a memory barrier.
89 */ 90 */
90 91
91extern inline int test_and_set_bit(int nr, void *addr) 92extern inline int test_and_set_bit(int nr, volatile unsigned long *addr)
92{ 93{
93 unsigned int mask, retval; 94 unsigned int mask, retval;
94 unsigned long flags; 95 unsigned long flags;
@@ -96,15 +97,15 @@ extern inline int test_and_set_bit(int nr, void *addr)
96 97
97 adr += nr >> 5; 98 adr += nr >> 5;
98 mask = 1 << (nr & 0x1f); 99 mask = 1 << (nr & 0x1f);
99 local_save_flags(flags); 100 cris_atomic_save(addr, flags);
100 local_irq_disable();
101 retval = (mask & *adr) != 0; 101 retval = (mask & *adr) != 0;
102 *adr |= mask; 102 *adr |= mask;
103 cris_atomic_restore(addr, flags);
103 local_irq_restore(flags); 104 local_irq_restore(flags);
104 return retval; 105 return retval;
105} 106}
106 107
107extern inline int __test_and_set_bit(int nr, void *addr) 108extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
108{ 109{
109 unsigned int mask, retval; 110 unsigned int mask, retval;
110 unsigned int *adr = (unsigned int *)addr; 111 unsigned int *adr = (unsigned int *)addr;
@@ -131,7 +132,7 @@ extern inline int __test_and_set_bit(int nr, void *addr)
131 * It also implies a memory barrier. 132 * It also implies a memory barrier.
132 */ 133 */
133 134
134extern inline int test_and_clear_bit(int nr, void *addr) 135extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
135{ 136{
136 unsigned int mask, retval; 137 unsigned int mask, retval;
137 unsigned long flags; 138 unsigned long flags;
@@ -139,11 +140,10 @@ extern inline int test_and_clear_bit(int nr, void *addr)
139 140
140 adr += nr >> 5; 141 adr += nr >> 5;
141 mask = 1 << (nr & 0x1f); 142 mask = 1 << (nr & 0x1f);
142 local_save_flags(flags); 143 cris_atomic_save(addr, flags);
143 local_irq_disable();
144 retval = (mask & *adr) != 0; 144 retval = (mask & *adr) != 0;
145 *adr &= ~mask; 145 *adr &= ~mask;
146 local_irq_restore(flags); 146 cris_atomic_restore(addr, flags);
147 return retval; 147 return retval;
148} 148}
149 149
@@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, void *addr)
157 * but actually fail. You must protect multiple accesses with a lock. 157 * but actually fail. You must protect multiple accesses with a lock.
158 */ 158 */
159 159
160extern inline int __test_and_clear_bit(int nr, void *addr) 160extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
161{ 161{
162 unsigned int mask, retval; 162 unsigned int mask, retval;
163 unsigned int *adr = (unsigned int *)addr; 163 unsigned int *adr = (unsigned int *)addr;
@@ -177,24 +177,23 @@ extern inline int __test_and_clear_bit(int nr, void *addr)
177 * It also implies a memory barrier. 177 * It also implies a memory barrier.
178 */ 178 */
179 179
180extern inline int test_and_change_bit(int nr, void *addr) 180extern inline int test_and_change_bit(int nr, volatile unsigned long *addr)
181{ 181{
182 unsigned int mask, retval; 182 unsigned int mask, retval;
183 unsigned long flags; 183 unsigned long flags;
184 unsigned int *adr = (unsigned int *)addr; 184 unsigned int *adr = (unsigned int *)addr;
185 adr += nr >> 5; 185 adr += nr >> 5;
186 mask = 1 << (nr & 0x1f); 186 mask = 1 << (nr & 0x1f);
187 local_save_flags(flags); 187 cris_atomic_save(addr, flags);
188 local_irq_disable();
189 retval = (mask & *adr) != 0; 188 retval = (mask & *adr) != 0;
190 *adr ^= mask; 189 *adr ^= mask;
191 local_irq_restore(flags); 190 cris_atomic_restore(addr, flags);
192 return retval; 191 return retval;
193} 192}
194 193
195/* WARNING: non atomic and it can be reordered! */ 194/* WARNING: non atomic and it can be reordered! */
196 195
197extern inline int __test_and_change_bit(int nr, void *addr) 196extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
198{ 197{
199 unsigned int mask, retval; 198 unsigned int mask, retval;
200 unsigned int *adr = (unsigned int *)addr; 199 unsigned int *adr = (unsigned int *)addr;
@@ -215,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, void *addr)
215 * This routine doesn't need to be atomic. 214 * This routine doesn't need to be atomic.
216 */ 215 */
217 216
218extern inline int test_bit(int nr, const void *addr) 217extern inline int test_bit(int nr, const volatile unsigned long *addr)
219{ 218{
220 unsigned int mask; 219 unsigned int mask;
221 unsigned int *adr = (unsigned int *)addr; 220 unsigned int *adr = (unsigned int *)addr;
@@ -259,7 +258,7 @@ extern inline int test_bit(int nr, const void *addr)
259 * @offset: The bitnumber to start searching at 258 * @offset: The bitnumber to start searching at
260 * @size: The maximum size to search 259 * @size: The maximum size to search
261 */ 260 */
262extern inline int find_next_zero_bit (void * addr, int size, int offset) 261extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
263{ 262{
264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 263 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265 unsigned long result = offset & ~31UL; 264 unsigned long result = offset & ~31UL;
@@ -301,7 +300,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
301 * @offset: The bitnumber to start searching at 300 * @offset: The bitnumber to start searching at
302 * @size: The maximum size to search 301 * @size: The maximum size to search
303 */ 302 */
304static __inline__ int find_next_bit(void *addr, int size, int offset) 303static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
305{ 304{
306 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 305 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
307 unsigned long result = offset & ~31UL; 306 unsigned long result = offset & ~31UL;
@@ -367,7 +366,7 @@ found_middle:
367#define minix_test_bit(nr,addr) test_bit(nr,addr) 366#define minix_test_bit(nr,addr) test_bit(nr,addr)
368#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
369 368
370extern inline int sched_find_first_bit(unsigned long *b) 369extern inline int sched_find_first_bit(const unsigned long *b)
371{ 370{
372 if (unlikely(b[0])) 371 if (unlikely(b[0]))
373 return __ffs(b[0]); 372 return __ffs(b[0]);
diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
index 0d770f60127a..0b5c3fdaefe1 100644
--- a/include/asm-cris/dma-mapping.h
+++ b/include/asm-cris/dma-mapping.h
@@ -1,125 +1,179 @@
1/* DMA mapping. Nothing tricky here, just virt_to_phys */
2
1#ifndef _ASM_CRIS_DMA_MAPPING_H 3#ifndef _ASM_CRIS_DMA_MAPPING_H
2#define _ASM_CRIS_DMA_MAPPING_H 4#define _ASM_CRIS_DMA_MAPPING_H
3 5
4#include "scatterlist.h" 6#include <linux/mm.h>
7#include <linux/kernel.h>
5 8
6static inline int 9#include <asm/cache.h>
7dma_supported(struct device *dev, u64 mask) 10#include <asm/io.h>
8{ 11#include <asm/scatterlist.h>
9 BUG();
10 return 0;
11}
12 12
13static inline int 13#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
14dma_set_mask(struct device *dev, u64 dma_mask) 14#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
15{ 15
16 BUG(); 16#ifdef CONFIG_PCI
17 return 1; 17void *dma_alloc_coherent(struct device *dev, size_t size,
18} 18 dma_addr_t *dma_handle, int flag);
19 19
20void dma_free_coherent(struct device *dev, size_t size,
21 void *vaddr, dma_addr_t dma_handle);
22#else
20static inline void * 23static inline void *
21dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 24dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
22 int flag) 25 int flag)
23{ 26{
24 BUG(); 27 BUG();
25 return NULL; 28 return NULL;
26} 29}
27 30
28static inline void 31static inline void
29dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 32dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
30 dma_addr_t dma_handle) 33 dma_addr_t dma_handle)
31{ 34{
32 BUG(); 35 BUG();
33} 36}
34 37#endif
35static inline dma_addr_t 38static inline dma_addr_t
36dma_map_single(struct device *dev, void *cpu_addr, size_t size, 39dma_map_single(struct device *dev, void *ptr, size_t size,
37 enum dma_data_direction direction) 40 enum dma_data_direction direction)
38{ 41{
39 BUG(); 42 BUG_ON(direction == DMA_NONE);
40 return 0; 43 return virt_to_phys(ptr);
41} 44}
42 45
43static inline void 46static inline void
44dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 47dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
45 enum dma_data_direction direction) 48 enum dma_data_direction direction)
46{ 49{
47 BUG(); 50 BUG_ON(direction == DMA_NONE);
51}
52
53static inline int
54dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
55 enum dma_data_direction direction)
56{
57 printk("Map sg\n");
58 return nents;
48} 59}
49 60
50static inline dma_addr_t 61static inline dma_addr_t
51dma_map_page(struct device *dev, struct page *page, 62dma_map_page(struct device *dev, struct page *page, unsigned long offset,
52 unsigned long offset, size_t size, 63 size_t size, enum dma_data_direction direction)
53 enum dma_data_direction direction)
54{ 64{
55 BUG(); 65 BUG_ON(direction == DMA_NONE);
56 return 0; 66 return page_to_phys(page) + offset;
57} 67}
58 68
59static inline void 69static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, 70dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
61 enum dma_data_direction direction) 71 enum dma_data_direction direction)
62{ 72{
63 BUG(); 73 BUG_ON(direction == DMA_NONE);
64} 74}
65 75
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 1;
72}
73 76
74static inline void 77static inline void
75dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 78dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
76 enum dma_data_direction direction) 79 enum dma_data_direction direction)
77{ 80{
78 BUG(); 81 BUG_ON(direction == DMA_NONE);
79} 82}
80 83
81static inline void 84static inline void
82dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size, 85dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
83 enum dma_data_direction direction) 86 enum dma_data_direction direction)
84{ 87{
85 BUG();
86} 88}
87 89
88static inline void 90static inline void
89dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems, 91dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
90 enum dma_data_direction direction) 92 enum dma_data_direction direction)
91{ 93{
92 BUG();
93} 94}
94 95
95/* Now for the API extensions over the pci_ one */ 96static inline void
97dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
98 unsigned long offset, size_t size,
99 enum dma_data_direction direction)
100{
101}
96 102
97#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 103static inline void
98#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 104dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
99#define dma_is_consistent(d) (1) 105 unsigned long offset, size_t size,
106 enum dma_data_direction direction)
107{
108}
100 109
101static inline int 110static inline void
102dma_get_cache_alignment(void) 111dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
112 enum dma_data_direction direction)
103{ 113{
104 /* no easy way to get cache size on all processors, so return
105 * the maximum possible, to be safe */
106 return (1 << L1_CACHE_SHIFT_MAX);
107} 114}
108 115
109static inline void 116static inline void
110dma_sync_single_range(struct device *dev, dma_addr_t dma_handle, 117dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
111 unsigned long offset, size_t size, 118 enum dma_data_direction direction)
112 enum dma_data_direction direction)
113{ 119{
114 BUG();
115} 120}
116 121
122static inline int
123dma_mapping_error(dma_addr_t dma_addr)
124{
125 return 0;
126}
127
128static inline int
129dma_supported(struct device *dev, u64 mask)
130{
131 /*
132 * we fall back to GFP_DMA when the mask isn't all 1s,
133 * so we can't guarantee allocations that must be
134 * within a tighter range than GFP_DMA..
135 */
136 if(mask < 0x00ffffff)
137 return 0;
138
139 return 1;
140}
141
142static inline int
143dma_set_mask(struct device *dev, u64 mask)
144{
145 if(!dev->dma_mask || !dma_supported(dev, mask))
146 return -EIO;
147
148 *dev->dma_mask = mask;
149
150 return 0;
151}
152
153static inline int
154dma_get_cache_alignment(void)
155{
156 return (1 << L1_CACHE_SHIFT_MAX);
157}
158
159#define dma_is_consistent(d) (1)
160
117static inline void 161static inline void
118dma_cache_sync(void *vaddr, size_t size, 162dma_cache_sync(void *vaddr, size_t size,
119 enum dma_data_direction direction) 163 enum dma_data_direction direction)
120{ 164{
121 BUG();
122} 165}
123 166
124#endif 167#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
168extern int
169dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
170 dma_addr_t device_addr, size_t size, int flags);
171
172extern void
173dma_release_declared_memory(struct device *dev);
125 174
175extern void *
176dma_mark_declared_memory_occupied(struct device *dev,
177 dma_addr_t device_addr, size_t size);
178
179#endif
diff --git a/include/asm-cris/dma.h b/include/asm-cris/dma.h
index c229fac35cdc..6f188dc56138 100644
--- a/include/asm-cris/dma.h
+++ b/include/asm-cris/dma.h
@@ -10,4 +10,12 @@
10 10
11#define MAX_DMA_ADDRESS PAGE_OFFSET 11#define MAX_DMA_ADDRESS PAGE_OFFSET
12 12
13/* From PCI */
14
15#ifdef CONFIG_PCI
16extern int isa_dma_bridge_buggy;
17#else
18#define isa_dma_bridge_buggy (0)
19#endif
20
13#endif /* _ASM_DMA_H */ 21#endif /* _ASM_DMA_H */
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index d37fd5c4a567..87a60bd8e667 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -8,6 +8,27 @@
8#include <asm/arch/elf.h> 8#include <asm/arch/elf.h>
9#include <asm/user.h> 9#include <asm/user.h>
10 10
11#define R_CRIS_NONE 0
12#define R_CRIS_8 1
13#define R_CRIS_16 2
14#define R_CRIS_32 3
15#define R_CRIS_8_PCREL 4
16#define R_CRIS_16_PCREL 5
17#define R_CRIS_32_PCREL 6
18#define R_CRIS_GNU_VTINHERIT 7
19#define R_CRIS_GNU_VTENTRY 8
20#define R_CRIS_COPY 9
21#define R_CRIS_GLOB_DAT 10
22#define R_CRIS_JUMP_SLOT 11
23#define R_CRIS_RELATIVE 12
24#define R_CRIS_16_GOT 13
25#define R_CRIS_32_GOT 14
26#define R_CRIS_16_GOTPLT 15
27#define R_CRIS_32_GOTPLT 16
28#define R_CRIS_32_GOTREL 17
29#define R_CRIS_32_PLT_GOTREL 18
30#define R_CRIS_32_PLT_PCREL 19
31
11typedef unsigned long elf_greg_t; 32typedef unsigned long elf_greg_t;
12 33
13/* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is 34/* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
@@ -19,17 +40,29 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
19typedef unsigned long elf_fpregset_t; 40typedef unsigned long elf_fpregset_t;
20 41
21/* 42/*
22 * This is used to ensure we don't load something for the wrong architecture.
23 */
24#define elf_check_arch(x) ( (x)->e_machine == EM_CRIS )
25
26/*
27 * These are used to set parameters in the core dumps. 43 * These are used to set parameters in the core dumps.
28 */ 44 */
29#define ELF_CLASS ELFCLASS32 45#define ELF_CLASS ELFCLASS32
30#define ELF_DATA ELFDATA2LSB; 46#define ELF_DATA ELFDATA2LSB
31#define ELF_ARCH EM_CRIS 47#define ELF_ARCH EM_CRIS
32 48
49/* The master for these definitions is {binutils}/include/elf/cris.h: */
50/* User symbols in this file have a leading underscore. */
51#define EF_CRIS_UNDERSCORE 0x00000001
52
53/* This is a mask for different incompatible machine variants. */
54#define EF_CRIS_VARIANT_MASK 0x0000000e
55
56/* Variant 0; may contain v0..10 object. */
57#define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000
58
59/* Variant 1; contains v32 object. */
60#define EF_CRIS_VARIANT_V32 0x00000002
61
62/* Variant 2; contains object compatible with v32 and v10. */
63#define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004
64/* End of excerpt from {binutils}/include/elf/cris.h. */
65
33#define USE_ELF_CORE_DUMP 66#define USE_ELF_CORE_DUMP
34 67
35#define ELF_EXEC_PAGESIZE 8192 68#define ELF_EXEC_PAGESIZE 8192
diff --git a/include/asm-cris/etraxgpio.h b/include/asm-cris/etraxgpio.h
index cf04af9635cc..80ee10f70d43 100644
--- a/include/asm-cris/etraxgpio.h
+++ b/include/asm-cris/etraxgpio.h
@@ -13,7 +13,7 @@
13 are enabled. 13 are enabled.
14 * 14 *
15 * 15 *
16 * For ETRAX 200 (ARCH_V32): 16 * For ETRAX FS (ARCH_V32):
17 * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction 17 * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction
18 * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction 18 * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction
19 * /dev/gpioc minor 2, 18 bit GPIO, each bit can change direction 19 * /dev/gpioc minor 2, 18 bit GPIO, each bit can change direction
@@ -39,10 +39,10 @@
39#define ETRAXGPIO_IOCTYPE 43 39#define ETRAXGPIO_IOCTYPE 43
40#define GPIO_MINOR_A 0 40#define GPIO_MINOR_A 0
41#define GPIO_MINOR_B 1 41#define GPIO_MINOR_B 1
42#define GPIO_MINOR_C 2 42#define GPIO_MINOR_LEDS 2
43#define GPIO_MINOR_D 3 43#define GPIO_MINOR_C 3
44#define GPIO_MINOR_E 4 44#define GPIO_MINOR_D 4
45#define GPIO_MINOR_LEDS 5 45#define GPIO_MINOR_E 5
46#define GPIO_MINOR_LAST 5 46#define GPIO_MINOR_LAST 5
47#endif 47#endif
48 48
diff --git a/include/asm-cris/hardirq.h b/include/asm-cris/hardirq.h
index f4d136228ee1..1c13dd3faac3 100644
--- a/include/asm-cris/hardirq.h
+++ b/include/asm-cris/hardirq.h
@@ -1,18 +1,17 @@
1#ifndef __ASM_HARDIRQ_H 1#ifndef __ASM_HARDIRQ_H
2#define __ASM_HARDIRQ_H 2#define __ASM_HARDIRQ_H
3 3
4/* only non-SMP supported */
5
6#include <linux/threads.h> 4#include <linux/threads.h>
7#include <linux/cache.h> 5#include <linux/cache.h>
8 6
9/* entry.S is sensitive to the offsets of these fields */
10typedef struct { 7typedef struct {
11 unsigned int __softirq_pending; 8 unsigned int __softirq_pending;
12} ____cacheline_aligned irq_cpustat_t; 9} ____cacheline_aligned irq_cpustat_t;
13 10
14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 11#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
15 12
13void ack_bad_irq(unsigned int irq);
14
16#define HARDIRQ_BITS 8 15#define HARDIRQ_BITS 8
17 16
18/* 17/*
diff --git a/include/asm-cris/hw_irq.h b/include/asm-cris/hw_irq.h
new file mode 100644
index 000000000000..341536a234e9
--- /dev/null
+++ b/include/asm-cris/hw_irq.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
5
6#endif
7
diff --git a/include/asm-cris/ide.h b/include/asm-cris/ide.h
new file mode 100644
index 000000000000..a894f66665f8
--- /dev/null
+++ b/include/asm-cris/ide.h
@@ -0,0 +1 @@
#include <asm/arch/ide.h>
diff --git a/include/asm-cris/io.h b/include/asm-cris/io.h
index 1d2b51701e8d..16e791b3c721 100644
--- a/include/asm-cris/io.h
+++ b/include/asm-cris/io.h
@@ -3,6 +3,21 @@
3 3
4#include <asm/page.h> /* for __va, __pa */ 4#include <asm/page.h> /* for __va, __pa */
5#include <asm/arch/io.h> 5#include <asm/arch/io.h>
6#include <linux/kernel.h>
7
8struct cris_io_operations
9{
10 u32 (*read_mem)(void *addr, int size);
11 void (*write_mem)(u32 val, int size, void *addr);
12 u32 (*read_io)(u32 port, void *addr, int size, int count);
13 void (*write_io)(u32 port, void *addr, int size, int count);
14};
15
16#ifdef CONFIG_PCI
17extern struct cris_io_operations *cris_iops;
18#else
19#define cris_iops ((struct cris_io_operations*)NULL)
20#endif
6 21
7/* 22/*
8 * Change virtual addresses to physical addresses and vv. 23 * Change virtual addresses to physical addresses and vv.
@@ -18,14 +33,17 @@ extern inline void * phys_to_virt(unsigned long address)
18 return __va(address); 33 return __va(address);
19} 34}
20 35
21extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); 36extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
37extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot);
22 38
23extern inline void * ioremap (unsigned long offset, unsigned long size) 39extern inline void __iomem * ioremap (unsigned long offset, unsigned long size)
24{ 40{
25 return __ioremap(offset, size, 0); 41 return __ioremap(offset, size, 0);
26} 42}
27 43
28extern void iounmap(void *addr); 44extern void iounmap(volatile void * __iomem addr);
45
46extern void __iomem * ioremap_nocache(unsigned long offset, unsigned long size);
29 47
30/* 48/*
31 * IO bus memory addresses are also 1:1 with the physical address 49 * IO bus memory addresses are also 1:1 with the physical address
@@ -39,9 +57,32 @@ extern void iounmap(void *addr);
39 * differently. On the CRIS architecture, we just read/write the 57 * differently. On the CRIS architecture, we just read/write the
40 * memory location directly. 58 * memory location directly.
41 */ 59 */
42#define readb(addr) (*(volatile unsigned char *) (addr)) 60#ifdef CONFIG_PCI
43#define readw(addr) (*(volatile unsigned short *) (addr)) 61#define PCI_SPACE(x) ((((unsigned)(x)) & 0x10000000) == 0x10000000)
44#define readl(addr) (*(volatile unsigned int *) (addr)) 62#else
63#define PCI_SPACE(x) 0
64#endif
65static inline unsigned char readb(const volatile void __iomem *addr)
66{
67 if (PCI_SPACE(addr) && cris_iops)
68 return cris_iops->read_mem((void*)addr, 1);
69 else
70 return *(volatile unsigned char __force *) addr;
71}
72static inline unsigned short readw(const volatile void __iomem *addr)
73{
74 if (PCI_SPACE(addr) && cris_iops)
75 return cris_iops->read_mem((void*)addr, 2);
76 else
77 return *(volatile unsigned short __force *) addr;
78}
79static inline unsigned int readl(const volatile void __iomem *addr)
80{
81 if (PCI_SPACE(addr) && cris_iops)
82 return cris_iops->read_mem((void*)addr, 4);
83 else
84 return *(volatile unsigned int __force *) addr;
85}
45#define readb_relaxed(addr) readb(addr) 86#define readb_relaxed(addr) readb(addr)
46#define readw_relaxed(addr) readw(addr) 87#define readw_relaxed(addr) readw(addr)
47#define readl_relaxed(addr) readl(addr) 88#define readl_relaxed(addr) readl(addr)
@@ -49,9 +90,27 @@ extern void iounmap(void *addr);
49#define __raw_readw readw 90#define __raw_readw readw
50#define __raw_readl readl 91#define __raw_readl readl
51 92
52#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) 93static inline void writeb(unsigned char b, volatile void __iomem *addr)
53#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) 94{
54#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) 95 if (PCI_SPACE(addr) && cris_iops)
96 cris_iops->write_mem(b, 1, (void*)addr);
97 else
98 *(volatile unsigned char __force *) addr = b;
99}
100static inline void writew(unsigned short b, volatile void __iomem *addr)
101{
102 if (PCI_SPACE(addr) && cris_iops)
103 cris_iops->write_mem(b, 2, (void*)addr);
104 else
105 *(volatile unsigned short __force *) addr = b;
106}
107static inline void writel(unsigned int b, volatile void __iomem *addr)
108{
109 if (PCI_SPACE(addr) && cris_iops)
110 cris_iops->write_mem(b, 4, (void*)addr);
111 else
112 *(volatile unsigned int __force *) addr = b;
113}
55#define __raw_writeb writeb 114#define __raw_writeb writeb
56#define __raw_writew writew 115#define __raw_writew writew
57#define __raw_writel writel 116#define __raw_writel writel
@@ -66,25 +125,25 @@ extern void iounmap(void *addr);
66 * Again, CRIS does not require mem IO specific function. 125 * Again, CRIS does not require mem IO specific function.
67 */ 126 */
68 127
69#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) 128#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
70 129
71/* The following is junk needed for the arch-independent code but which 130/* The following is junk needed for the arch-independent code but which
72 * we never use in the CRIS port 131 * we never use in the CRIS port
73 */ 132 */
74 133
75#define IO_SPACE_LIMIT 0xffff 134#define IO_SPACE_LIMIT 0xffff
76#define inb(x) (0) 135#define inb(port) (cris_iops ? cris_iops->read_io(port,NULL,1,1) : 0)
77#define inw(x) (0) 136#define inw(port) (cris_iops ? cris_iops->read_io(port,NULL,2,1) : 0)
78#define inl(x) (0) 137#define inl(port) (cris_iops ? cris_iops->read_io(port,NULL,4,1) : 0)
79#define outb(x,y) 138#define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0)
80#define outw(x,y) 139#define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0)
81#define outl(x,y) 140#define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0)
82#define insb(x,y,z) 141#define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1)
83#define insw(x,y,z) 142#define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1)
84#define insl(x,y,z) 143#define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1)
85#define outsb(x,y,z) 144#define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count)
86#define outsw(x,y,z) 145#define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count)
87#define outsl(x,y,z) 146#define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count)
88 147
89/* 148/*
90 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 149 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h
index 87f342517bb1..8e787fdaedd4 100644
--- a/include/asm-cris/irq.h
+++ b/include/asm-cris/irq.h
@@ -8,16 +8,6 @@ extern __inline__ int irq_canonicalize(int irq)
8 return irq; 8 return irq;
9} 9}
10 10
11extern void disable_irq(unsigned int);
12extern void enable_irq(unsigned int);
13
14#define disable_irq_nosync disable_irq
15#define enable_irq_nosync enable_irq
16
17struct irqaction;
18struct pt_regs;
19int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
20
21#endif /* _ASM_IRQ_H */ 11#endif /* _ASM_IRQ_H */
22 12
23 13
diff --git a/include/asm-cris/kmap_types.h b/include/asm-cris/kmap_types.h
index eec0974c2417..492988cb9077 100644
--- a/include/asm-cris/kmap_types.h
+++ b/include/asm-cris/kmap_types.h
@@ -17,8 +17,8 @@ enum km_type {
17 KM_PTE1, 17 KM_PTE1,
18 KM_IRQ0, 18 KM_IRQ0,
19 KM_IRQ1, 19 KM_IRQ1,
20 KM_CRYPTO_USER, 20 KM_SOFTIRQ0,
21 KM_CRYPTO_SOFTIRQ, 21 KM_SOFTIRQ1,
22 KM_TYPE_NR 22 KM_TYPE_NR
23}; 23};
24 24
diff --git a/include/asm-cris/mmu_context.h b/include/asm-cris/mmu_context.h
index f9308c5bbd99..e6e659dc757b 100644
--- a/include/asm-cris/mmu_context.h
+++ b/include/asm-cris/mmu_context.h
@@ -15,7 +15,7 @@ extern void switch_mm(struct mm_struct *prev, struct mm_struct *next,
15 * registers like cr3 on the i386 15 * registers like cr3 on the i386
16 */ 16 */
17 17
18extern volatile pgd_t *current_pgd; /* defined in arch/cris/mm/fault.c */ 18extern volatile DEFINE_PER_CPU(pgd_t *,current_pgd); /* defined in arch/cris/mm/fault.c */
19 19
20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
21{ 21{
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index c767da1ef8f5..bbf17bd39385 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -29,18 +29,15 @@
29 */ 29 */
30#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
31typedef struct { unsigned long pte; } pte_t; 31typedef struct { unsigned long pte; } pte_t;
32typedef struct { unsigned long pmd; } pmd_t;
33typedef struct { unsigned long pgd; } pgd_t; 32typedef struct { unsigned long pgd; } pgd_t;
34typedef struct { unsigned long pgprot; } pgprot_t; 33typedef struct { unsigned long pgprot; } pgprot_t;
35#endif 34#endif
36 35
37#define pte_val(x) ((x).pte) 36#define pte_val(x) ((x).pte)
38#define pmd_val(x) ((x).pmd)
39#define pgd_val(x) ((x).pgd) 37#define pgd_val(x) ((x).pgd)
40#define pgprot_val(x) ((x).pgprot) 38#define pgprot_val(x) ((x).pgprot)
41 39
42#define __pte(x) ((pte_t) { (x) } ) 40#define __pte(x) ((pte_t) { (x) } )
43#define __pmd(x) ((pmd_t) { (x) } )
44#define __pgd(x) ((pgd_t) { (x) } ) 41#define __pgd(x) ((pgd_t) { (x) } )
45#define __pgprot(x) ((pgprot_t) { (x) } ) 42#define __pgprot(x) ((pgprot_t) { (x) } )
46 43
@@ -73,10 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73 70
74#ifndef __ASSEMBLY__ 71#ifndef __ASSEMBLY__
75 72
76#define BUG() do { \
77 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
78} while (0)
79
80/* Pure 2^n version of get_order */ 73/* Pure 2^n version of get_order */
81static inline int get_order(unsigned long size) 74static inline int get_order(unsigned long size)
82{ 75{
diff --git a/include/asm-cris/pci.h b/include/asm-cris/pci.h
index c61041531889..2064bc1de074 100644
--- a/include/asm-cris/pci.h
+++ b/include/asm-cris/pci.h
@@ -1,13 +1,105 @@
1#ifndef __ASM_CRIS_PCI_H 1#ifndef __ASM_CRIS_PCI_H
2#define __ASM_CRIS_PCI_H 2#define __ASM_CRIS_PCI_H
3 3
4#include <linux/config.h>
5
6#ifdef __KERNEL__
7#include <linux/mm.h> /* for struct page */
8
9/* Can be used to override the logic in pci_scan_bus for skipping
10 already-configured bus numbers - to be used for buggy BIOSes
11 or architectures with incomplete PCI setup by the loader */
12
13#define pcibios_assign_all_busses(void) 1
14
15extern unsigned long pci_mem_start;
16#define PCIBIOS_MIN_IO 0x1000
17#define PCIBIOS_MIN_MEM 0x10000000
18
19#define PCIBIOS_MIN_CARDBUS_IO 0x4000
20
21void pcibios_config_init(void);
22struct pci_bus * pcibios_scan_root(int bus);
23int pcibios_assign_resources(void);
24
25void pcibios_set_master(struct pci_dev *dev);
26void pcibios_penalize_isa_irq(int irq);
27struct irq_routing_table *pcibios_get_irq_routing_table(void);
28int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
29
30/* Dynamic DMA mapping stuff.
31 * i386 has everything mapped statically.
32 */
33
34#include <linux/types.h>
35#include <linux/slab.h>
4#include <asm/scatterlist.h> 36#include <asm/scatterlist.h>
5#include <asm-generic/pci-dma-compat.h> 37#include <linux/string.h>
38#include <asm/io.h>
6 39
7/* ETRAX chips don't have a PCI bus. This file is just here because some stupid .c code 40struct pci_dev;
8 * includes it even if CONFIG_PCI is not set. 41
42/* The PCI address space does equal the physical memory
43 * address space. The networking and block device layers use
44 * this boolean for bounce buffer decisions.
9 */ 45 */
10#define PCI_DMA_BUS_IS_PHYS (1) 46#define PCI_DMA_BUS_IS_PHYS (1)
11 47
12#endif /* __ASM_CRIS_PCI_H */ 48/* pci_unmap_{page,single} is a nop so... */
49#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
50#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
51#define pci_unmap_addr(PTR, ADDR_NAME) (0)
52#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
53#define pci_unmap_len(PTR, LEN_NAME) (0)
54#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
55
56/* This is always fine. */
57#define pci_dac_dma_supported(pci_dev, mask) (1)
13 58
59static inline dma64_addr_t
60pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
61{
62 return ((dma64_addr_t) page_to_phys(page) +
63 (dma64_addr_t) offset);
64}
65
66static inline struct page *
67pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
68{
69 return pfn_to_page(dma_addr >> PAGE_SHIFT);
70}
71
72static inline unsigned long
73pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
74{
75 return (dma_addr & ~PAGE_MASK);
76}
77
78static inline void
79pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
80{
81}
82
83static inline void
84pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
85{
86}
87
88#define HAVE_PCI_MMAP
89extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
90 enum pci_mmap_state mmap_state, int write_combine);
91
92
93static inline void pcibios_add_platform_entries(struct pci_dev *dev)
94{
95}
96
97#endif /* __KERNEL__ */
98
99/* implement the pci_ DMA API in terms of the generic device dma_ one */
100#include <asm-generic/pci-dma-compat.h>
101
102/* generic pci stuff */
103#include <asm-generic/pci.h>
104
105#endif /* __ASM_CRIS_PCI_H */
diff --git a/include/asm-cris/pgalloc.h b/include/asm-cris/pgalloc.h
index b202e62ed6e0..a131776edf41 100644
--- a/include/asm-cris/pgalloc.h
+++ b/include/asm-cris/pgalloc.h
@@ -47,16 +47,6 @@ extern inline void pte_free(struct page *pte)
47 47
48#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 48#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
49 49
50/*
51 * We don't have any real pmd's, and this code never triggers because
52 * the pgd will always be present..
53 */
54
55#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
56#define pmd_free(x) do { } while (0)
57#define __pmd_free_tlb(tlb,x) do { } while (0)
58#define pgd_populate(mm, pmd, pte) BUG()
59
60#define check_pgt_cache() do { } while (0) 50#define check_pgt_cache() do { } while (0)
61 51
62#endif 52#endif
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index f7042944b073..a9143bed99db 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -5,7 +5,8 @@
5#ifndef _CRIS_PGTABLE_H 5#ifndef _CRIS_PGTABLE_H
6#define _CRIS_PGTABLE_H 6#define _CRIS_PGTABLE_H
7 7
8#include <asm-generic/4level-fixup.h> 8#include <asm/page.h>
9#include <asm-generic/pgtable-nopmd.h>
9 10
10#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
11#include <linux/config.h> 12#include <linux/config.h>
@@ -41,22 +42,14 @@ extern void paging_init(void);
41 * but the define is needed for a generic inline function.) 42 * but the define is needed for a generic inline function.)
42 */ 43 */
43#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 44#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
44#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) 45#define set_pgu(pudptr, pudval) (*(pudptr) = pudval)
45 46
46/* PMD_SHIFT determines the size of the area a second-level page table can 47/* PGDIR_SHIFT determines the size of the area a second-level page table can
47 * map. It is equal to the page size times the number of PTE's that fit in 48 * map. It is equal to the page size times the number of PTE's that fit in
48 * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number. 49 * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number.
49 */ 50 */
50 51
51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2)) 52#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2))
52#define PMD_SIZE (1UL << PMD_SHIFT)
53#define PMD_MASK (~(PMD_SIZE-1))
54
55/* PGDIR_SHIFT determines what a third-level page table entry can map.
56 * Since we fold into a two-level structure, this is the same as PMD_SHIFT.
57 */
58
59#define PGDIR_SHIFT PMD_SHIFT
60#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 53#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
61#define PGDIR_MASK (~(PGDIR_SIZE-1)) 54#define PGDIR_MASK (~(PGDIR_SIZE-1))
62 55
@@ -67,7 +60,6 @@ extern void paging_init(void);
67 * divide it by 4 (shift by 2). 60 * divide it by 4 (shift by 2).
68 */ 61 */
69#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2)) 62#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2))
70#define PTRS_PER_PMD 1
71#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2)) 63#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2))
72 64
73/* calculate how many PGD entries a user-level program can use 65/* calculate how many PGD entries a user-level program can use
@@ -105,7 +97,7 @@ extern unsigned long empty_zero_page;
105#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) 97#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
106#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) 98#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0)
107 99
108#define pmd_none(x) (!pmd_val(x)) 100#define pmd_none(x) (!pmd_val(x))
109/* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad 101/* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad
110 * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries. 102 * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries.
111 */ 103 */
@@ -116,16 +108,6 @@ extern unsigned long empty_zero_page;
116#ifndef __ASSEMBLY__ 108#ifndef __ASSEMBLY__
117 109
118/* 110/*
119 * The "pgd_xxx()" functions here are trivial for a folded two-level
120 * setup: the pgd is never bad, and a pmd always exists (as it's folded
121 * into the pgd entry)
122 */
123extern inline int pgd_none(pgd_t pgd) { return 0; }
124extern inline int pgd_bad(pgd_t pgd) { return 0; }
125extern inline int pgd_present(pgd_t pgd) { return 1; }
126extern inline void pgd_clear(pgd_t * pgdp) { }
127
128/*
129 * The following only work if pte_present() is true. 111 * The following only work if pte_present() is true.
130 * Undefined behaviour if not.. 112 * Undefined behaviour if not..
131 */ 113 */
@@ -275,7 +257,7 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
275#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 257#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
276 258
277/* to find an entry in a page-table-directory. */ 259/* to find an entry in a page-table-directory. */
278#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 260#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
279 261
280/* to find an entry in a page-table-directory */ 262/* to find an entry in a page-table-directory */
281extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) 263extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
@@ -286,12 +268,6 @@ extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
286/* to find an entry in a kernel page-table-directory */ 268/* to find an entry in a kernel page-table-directory */
287#define pgd_offset_k(address) pgd_offset(&init_mm, address) 269#define pgd_offset_k(address) pgd_offset(&init_mm, address)
288 270
289/* Find an entry in the second-level page table.. */
290extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
291{
292 return (pmd_t *) dir;
293}
294
295/* Find an entry in the third-level page table.. */ 271/* Find an entry in the third-level page table.. */
296#define __pte_offset(address) \ 272#define __pte_offset(address) \
297 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 273 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
@@ -308,8 +284,6 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
308 284
309#define pte_ERROR(e) \ 285#define pte_ERROR(e) \
310 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) 286 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
311#define pmd_ERROR(e) \
312 printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
313#define pgd_ERROR(e) \ 287#define pgd_ERROR(e) \
314 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) 288 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
315 289
@@ -348,5 +322,7 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma,
348#define pte_to_pgoff(x) (pte_val(x) >> 6) 322#define pte_to_pgoff(x) (pte_val(x) >> 6)
349#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) 323#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE)
350 324
325typedef pte_t *pte_addr_t;
326
351#endif /* __ASSEMBLY__ */ 327#endif /* __ASSEMBLY__ */
352#endif /* _CRIS_PGTABLE_H */ 328#endif /* _CRIS_PGTABLE_H */
diff --git a/include/asm-cris/processor.h b/include/asm-cris/processor.h
index 623bdf06d911..0dc218117bd8 100644
--- a/include/asm-cris/processor.h
+++ b/include/asm-cris/processor.h
@@ -55,15 +55,6 @@ unsigned long get_wchan(struct task_struct *p);
55 55
56#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 56#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
57 57
58/*
59 * Free current thread data structures etc..
60 */
61
62extern inline void exit_thread(void)
63{
64 /* Nothing needs to be done. */
65}
66
67extern unsigned long thread_saved_pc(struct task_struct *tsk); 58extern unsigned long thread_saved_pc(struct task_struct *tsk);
68 59
69/* Free all resources held by a thread. */ 60/* Free all resources held by a thread. */
diff --git a/include/asm-cris/ptrace.h b/include/asm-cris/ptrace.h
index 7a8c2880e487..1ec69a7ea836 100644
--- a/include/asm-cris/ptrace.h
+++ b/include/asm-cris/ptrace.h
@@ -9,4 +9,6 @@
9#define PTRACE_SETREGS 13 9#define PTRACE_SETREGS 13
10#endif 10#endif
11 11
12#define profile_pc(regs) instruction_pointer(regs)
13
12#endif /* _CRIS_PTRACE_H */ 14#endif /* _CRIS_PTRACE_H */
diff --git a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h
index 605aa7eaaaf8..8ed7636ab311 100644
--- a/include/asm-cris/semaphore.h
+++ b/include/asm-cris/semaphore.h
@@ -72,10 +72,9 @@ extern inline void down(struct semaphore * sem)
72 might_sleep(); 72 might_sleep();
73 73
74 /* atomically decrement the semaphores count, and if its negative, we wait */ 74 /* atomically decrement the semaphores count, and if its negative, we wait */
75 local_save_flags(flags); 75 cris_atomic_save(sem, flags);
76 local_irq_disable();
77 failed = --(sem->count.counter) < 0; 76 failed = --(sem->count.counter) < 0;
78 local_irq_restore(flags); 77 cris_atomic_restore(sem, flags);
79 if(failed) { 78 if(failed) {
80 __down(sem); 79 __down(sem);
81 } 80 }
@@ -95,10 +94,9 @@ extern inline int down_interruptible(struct semaphore * sem)
95 might_sleep(); 94 might_sleep();
96 95
97 /* atomically decrement the semaphores count, and if its negative, we wait */ 96 /* atomically decrement the semaphores count, and if its negative, we wait */
98 local_save_flags(flags); 97 cris_atomic_save(sem, flags);
99 local_irq_disable();
100 failed = --(sem->count.counter) < 0; 98 failed = --(sem->count.counter) < 0;
101 local_irq_restore(flags); 99 cris_atomic_restore(sem, flags);
102 if(failed) 100 if(failed)
103 failed = __down_interruptible(sem); 101 failed = __down_interruptible(sem);
104 return(failed); 102 return(failed);
@@ -109,13 +107,13 @@ extern inline int down_trylock(struct semaphore * sem)
109 unsigned long flags; 107 unsigned long flags;
110 int failed; 108 int failed;
111 109
112 local_save_flags(flags); 110 cris_atomic_save(sem, flags);
113 local_irq_disable();
114 failed = --(sem->count.counter) < 0; 111 failed = --(sem->count.counter) < 0;
115 local_irq_restore(flags); 112 cris_atomic_restore(sem, flags);
116 if(failed) 113 if(failed)
117 failed = __down_trylock(sem); 114 failed = __down_trylock(sem);
118 return(failed); 115 return(failed);
116
119} 117}
120 118
121/* 119/*
@@ -130,10 +128,9 @@ extern inline void up(struct semaphore * sem)
130 int wakeup; 128 int wakeup;
131 129
132 /* atomically increment the semaphores count, and if it was negative, we wake people */ 130 /* atomically increment the semaphores count, and if it was negative, we wake people */
133 local_save_flags(flags); 131 cris_atomic_save(sem, flags);
134 local_irq_disable();
135 wakeup = ++(sem->count.counter) <= 0; 132 wakeup = ++(sem->count.counter) <= 0;
136 local_irq_restore(flags); 133 cris_atomic_restore(sem, flags);
137 if(wakeup) { 134 if(wakeup) {
138 __up(sem); 135 __up(sem);
139 } 136 }
diff --git a/include/asm-cris/smp.h b/include/asm-cris/smp.h
index c2f4feaa041d..dca5ef1d8c97 100644
--- a/include/asm-cris/smp.h
+++ b/include/asm-cris/smp.h
@@ -1,4 +1,11 @@
1#ifndef __ASM_SMP_H 1#ifndef __ASM_SMP_H
2#define __ASM_SMP_H 2#define __ASM_SMP_H
3 3
4#include <linux/cpumask.h>
5
6extern cpumask_t phys_cpu_present_map;
7#define cpu_possible_map phys_cpu_present_map
8
9#define __smp_processor_id() (current_thread_info()->cpu)
10
4#endif 11#endif
diff --git a/include/asm-cris/spinlock.h b/include/asm-cris/spinlock.h
new file mode 100644
index 000000000000..2e8ba8afc7af
--- /dev/null
+++ b/include/asm-cris/spinlock.h
@@ -0,0 +1 @@
#include <asm/arch/spinlock.h>
diff --git a/include/asm-cris/sync_serial.h b/include/asm-cris/sync_serial.h
new file mode 100644
index 000000000000..f930b6e00663
--- /dev/null
+++ b/include/asm-cris/sync_serial.h
@@ -0,0 +1,106 @@
1/*
2 * ioctl defines for synchronous serial port driver
3 *
4 * Copyright (c) 2001-2003 Axis Communications AB
5 *
6 * Author: Mikael Starvik
7 *
8 */
9
10#ifndef SYNC_SERIAL_H
11#define SYNC_SERIAL_H
12
13#include <linux/ioctl.h>
14
15#define SSP_SPEED _IOR('S', 0, unsigned int)
16#define SSP_MODE _IOR('S', 1, unsigned int)
17#define SSP_FRAME_SYNC _IOR('S', 2, unsigned int)
18#define SSP_IPOLARITY _IOR('S', 3, unsigned int)
19#define SSP_OPOLARITY _IOR('S', 4, unsigned int)
20#define SSP_SPI _IOR('S', 5, unsigned int)
21#define SSP_INBUFCHUNK _IOR('S', 6, unsigned int)
22
23/* Values for SSP_SPEED */
24#define SSP150 0
25#define SSP300 1
26#define SSP600 2
27#define SSP1200 3
28#define SSP2400 4
29#define SSP4800 5
30#define SSP9600 6
31#define SSP19200 7
32#define SSP28800 8
33#define SSP57600 9
34#define SSP115200 10
35#define SSP230400 11
36#define SSP460800 12
37#define SSP921600 13
38#define SSP3125000 14
39#define CODEC 15
40
41#define FREQ_4MHz 0
42#define FREQ_2MHz 1
43#define FREQ_1MHz 2
44#define FREQ_512kHz 3
45#define FREQ_256kHz 4
46#define FREQ_128kHz 5
47#define FREQ_64kHz 6
48#define FREQ_32kHz 7
49
50/* Used by application to set CODEC divider, word rate and frame rate */
51#define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28))
52
53/* Used by driver to extract speed */
54#define GET_SPEED(x) (x & 0xff)
55#define GET_FREQ(x) ((x & 0xff00) >> 8)
56#define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1)
57#define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1)
58
59/* Values for SSP_MODE */
60#define MASTER_OUTPUT 0
61#define SLAVE_OUTPUT 1
62#define MASTER_INPUT 2
63#define SLAVE_INPUT 3
64#define MASTER_BIDIR 4
65#define SLAVE_BIDIR 5
66
67/* Values for SSP_FRAME_SYNC */
68#define NORMAL_SYNC 1
69#define EARLY_SYNC 2
70
71#define BIT_SYNC 4
72#define WORD_SYNC 8
73#define EXTENDED_SYNC 0x10
74
75#define SYNC_OFF 0x20
76#define SYNC_ON 0x40
77#define WORD_SIZE_8 0x80
78#define WORD_SIZE_12 0x100
79#define WORD_SIZE_16 0x200
80#define WORD_SIZE_24 0x400
81#define WORD_SIZE_32 0x800
82#define BIT_ORDER_LSB 0x1000
83#define BIT_ORDER_MSB 0x2000
84#define FLOW_CONTROL_ENABLE 0x4000
85#define FLOW_CONTROL_DISABLE 0x8000
86#define CLOCK_GATED 0x10000
87#define CLOCK_NOT_GATED 0x20000
88
89/* Values for SSP_IPOLARITY and SSP_OPOLARITY */
90#define CLOCK_NORMAL 1
91#define CLOCK_INVERT 2
92#define CLOCK_INEGEDGE CLOCK_NORMAL
93#define CLOCK_IPOSEDGE CLOCK_INVERT
94#define FRAME_NORMAL 4
95#define FRAME_INVERT 8
96#define STATUS_NORMAL 0x10
97#define STATUS_INVERT 0x20
98
99/* Values for SSP_SPI */
100#define SPI_MASTER 0
101#define SPI_SLAVE 1
102
103/* Values for SSP_INBUFCHUNK */
104/* plain integer with the size of DMA chunks */
105
106#endif
diff --git a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h
index 16d9a491fdb3..be0836d2f282 100644
--- a/include/asm-cris/termbits.h
+++ b/include/asm-cris/termbits.h
@@ -152,7 +152,7 @@ struct termios {
152#define B921600 0010005 152#define B921600 0010005
153#define B1843200 0010006 153#define B1843200 0010006
154#define B6250000 0010007 154#define B6250000 0010007
155/* etrax 200 supports this as well */ 155/* ETRAX FS supports this as well */
156#define B12500000 0010010 156#define B12500000 0010010
157#define CIBAUD 002003600000 /* input baud rate (used in v32) */ 157#define CIBAUD 002003600000 /* input baud rate (used in v32) */
158/* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX 158/* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h
index 5ba4b7865cc5..cef0140fc104 100644
--- a/include/asm-cris/thread_info.h
+++ b/include/asm-cris/thread_info.h
@@ -43,7 +43,7 @@ struct thread_info {
43 43
44#endif 44#endif
45 45
46#define PREEMPT_ACTIVE 0x4000000 46#define PREEMPT_ACTIVE 0x10000000
47 47
48/* 48/*
49 * macros/functions for gaining access to the thread information structure 49 * macros/functions for gaining access to the thread information structure
diff --git a/include/asm-cris/timex.h b/include/asm-cris/timex.h
index 375c41af47de..3fb069a37717 100644
--- a/include/asm-cris/timex.h
+++ b/include/asm-cris/timex.h
@@ -14,7 +14,7 @@
14 * used so it does not matter. 14 * used so it does not matter.
15 */ 15 */
16 16
17typedef unsigned int cycles_t; 17typedef unsigned long long cycles_t;
18 18
19extern inline cycles_t get_cycles(void) 19extern inline cycles_t get_cycles(void)
20{ 20{
diff --git a/include/asm-cris/tlbflush.h b/include/asm-cris/tlbflush.h
index 1781fe1a32f6..6ed7d9ae90db 100644
--- a/include/asm-cris/tlbflush.h
+++ b/include/asm-cris/tlbflush.h
@@ -18,13 +18,26 @@
18 * 18 *
19 */ 19 */
20 20
21extern void __flush_tlb_all(void);
22extern void __flush_tlb_mm(struct mm_struct *mm);
23extern void __flush_tlb_page(struct vm_area_struct *vma,
24 unsigned long addr);
25
26#ifdef CONFIG_SMP
21extern void flush_tlb_all(void); 27extern void flush_tlb_all(void);
22extern void flush_tlb_mm(struct mm_struct *mm); 28extern void flush_tlb_mm(struct mm_struct *mm);
23extern void flush_tlb_page(struct vm_area_struct *vma, 29extern void flush_tlb_page(struct vm_area_struct *vma,
24 unsigned long addr); 30 unsigned long addr);
25extern void flush_tlb_range(struct vm_area_struct *vma, 31#else
26 unsigned long start, 32#define flush_tlb_all __flush_tlb_all
27 unsigned long end); 33#define flush_tlb_mm __flush_tlb_mm
34#define flush_tlb_page __flush_tlb_page
35#endif
36
37static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long start, unsigned long end)
38{
39 flush_tlb_mm(vma->vm_mm);
40}
28 41
29extern inline void flush_tlb_pgtables(struct mm_struct *mm, 42extern inline void flush_tlb_pgtables(struct mm_struct *mm,
30 unsigned long start, unsigned long end) 43 unsigned long start, unsigned long end)
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 41a0d450ba1d..8fa6d6c7afce 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -52,7 +52,7 @@ typedef unsigned long long u64;
52typedef u32 dma_addr_t; 52typedef u32 dma_addr_t;
53typedef u32 dma64_addr_t; 53typedef u32 dma64_addr_t;
54 54
55typedef unsigned int kmem_bufctl_t; 55typedef unsigned short kmem_bufctl_t;
56 56
57#endif /* __ASSEMBLY__ */ 57#endif /* __ASSEMBLY__ */
58 58
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index e80bf276b101..28232ad2ff34 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -288,8 +288,15 @@
288#define __NR_mq_timedreceive (__NR_mq_open+3) 288#define __NR_mq_timedreceive (__NR_mq_open+3)
289#define __NR_mq_notify (__NR_mq_open+4) 289#define __NR_mq_notify (__NR_mq_open+4)
290#define __NR_mq_getsetattr (__NR_mq_open+5) 290#define __NR_mq_getsetattr (__NR_mq_open+5)
291 291#define __NR_sys_kexec_load 283
292#define NR_syscalls 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
298#define NR_syscalls 289
299
293 300
294 301
295#ifdef __KERNEL__ 302#ifdef __KERNEL__
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index 9d4cc47bde39..ee1d8b5d8168 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -22,6 +22,14 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
22 region->end = res->end; 22 region->end = res->end;
23} 23}
24 24
25static inline void
26pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
27 struct pci_bus_region *region)
28{
29 res->start = region->start;
30 res->end = region->end;
31}
32
25#define pcibios_scan_all_fns(a, b) 0 33#define pcibios_scan_all_fns(a, b) 0
26 34
27#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 195ccdc069e6..450eae22c39a 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -11,5 +11,6 @@ extern char _sinittext[], _einittext[];
11extern char _sextratext[] __attribute__((weak)); 11extern char _sextratext[] __attribute__((weak));
12extern char _eextratext[] __attribute__((weak)); 12extern char _eextratext[] __attribute__((weak));
13extern char _end[]; 13extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[];
14 15
15#endif /* _ASM_GENERIC_SECTIONS_H_ */ 16#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 9db0b712d57a..ddf1739dc7fd 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -311,6 +311,20 @@ static inline int find_first_zero_bit(const unsigned long *addr, unsigned size)
311int find_next_zero_bit(const unsigned long *addr, int size, int offset); 311int find_next_zero_bit(const unsigned long *addr, int size, int offset);
312 312
313/** 313/**
314 * __ffs - find first bit in word.
315 * @word: The word to search
316 *
317 * Undefined if no bit exists, so code should check against 0 first.
318 */
319static inline unsigned long __ffs(unsigned long word)
320{
321 __asm__("bsfl %1,%0"
322 :"=r" (word)
323 :"rm" (word));
324 return word;
325}
326
327/**
314 * find_first_bit - find the first set bit in a memory region 328 * find_first_bit - find the first set bit in a memory region
315 * @addr: The address to start the search at 329 * @addr: The address to start the search at
316 * @size: The maximum size to search 330 * @size: The maximum size to search
@@ -320,22 +334,15 @@ int find_next_zero_bit(const unsigned long *addr, int size, int offset);
320 */ 334 */
321static inline int find_first_bit(const unsigned long *addr, unsigned size) 335static inline int find_first_bit(const unsigned long *addr, unsigned size)
322{ 336{
323 int d0, d1; 337 int x = 0;
324 int res; 338
325 339 while (x < size) {
326 /* This looks at memory. Mark it volatile to tell gcc not to move it around */ 340 unsigned long val = *addr++;
327 __asm__ __volatile__( 341 if (val)
328 "xorl %%eax,%%eax\n\t" 342 return __ffs(val) + x;
329 "repe; scasl\n\t" 343 x += (sizeof(*addr)<<3);
330 "jz 1f\n\t" 344 }
331 "leal -4(%%edi),%%edi\n\t" 345 return x;
332 "bsfl (%%edi),%%eax\n"
333 "1:\tsubl %%ebx,%%edi\n\t"
334 "shll $3,%%edi\n\t"
335 "addl %%edi,%%eax"
336 :"=a" (res), "=&c" (d0), "=&D" (d1)
337 :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
338 return res;
339} 346}
340 347
341/** 348/**
@@ -360,20 +367,6 @@ static inline unsigned long ffz(unsigned long word)
360 return word; 367 return word;
361} 368}
362 369
363/**
364 * __ffs - find first bit in word.
365 * @word: The word to search
366 *
367 * Undefined if no bit exists, so code should check against 0 first.
368 */
369static inline unsigned long __ffs(unsigned long word)
370{
371 __asm__("bsfl %1,%0"
372 :"=r" (word)
373 :"rm" (word));
374 return word;
375}
376
377/* 370/*
378 * fls: find last bit set. 371 * fls: find last bit set.
379 */ 372 */
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 33acd50fd9a8..92d638fc8b11 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -1,6 +1,7 @@
1/* defines for inline arch setup functions */ 1/* defines for inline arch setup functions */
2 2
3#include <asm/fixmap.h> 3#include <asm/fixmap.h>
4#include <asm/i8259.h>
4#include "cobalt.h" 5#include "cobalt.h"
5 6
6static inline void do_timer_interrupt_hook(struct pt_regs *regs) 7static inline void do_timer_interrupt_hook(struct pt_regs *regs)
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 78c85985aee3..2cbab30734d6 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -18,11 +18,9 @@ extern unsigned int pcibios_assign_all_busses(void);
18#define pcibios_scan_all_fns(a, b) 0 18#define pcibios_scan_all_fns(a, b) 0
19 19
20extern unsigned long pci_mem_start; 20extern unsigned long pci_mem_start;
21#define PCIBIOS_MIN_IO 0x1000 21#define PCIBIOS_MIN_IO 0x4000
22#define PCIBIOS_MIN_MEM (pci_mem_start) 22#define PCIBIOS_MIN_MEM (pci_mem_start)
23 23
24#define PCIBIOS_MIN_CARDBUS_IO 0x4000
25
26void pcibios_config_init(void); 24void pcibios_config_init(void);
27struct pci_bus * pcibios_scan_root(int bus); 25struct pci_bus * pcibios_scan_root(int bus);
28 26
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index b926cb4f4cfd..05532875e39e 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -55,6 +55,9 @@ struct pt_regs {
55#define PTRACE_SET_THREAD_AREA 26 55#define PTRACE_SET_THREAD_AREA 26
56 56
57#ifdef __KERNEL__ 57#ifdef __KERNEL__
58
59#include <asm/vm86.h>
60
58struct task_struct; 61struct task_struct;
59extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); 62extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
60 63
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index edad9b4712fa..a283738b80b3 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -37,9 +37,6 @@ extern int smp_num_siblings;
37extern cpumask_t cpu_sibling_map[]; 37extern cpumask_t cpu_sibling_map[];
38extern cpumask_t cpu_core_map[]; 38extern cpumask_t cpu_core_map[];
39 39
40extern void smp_flush_tlb(void);
41extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
42extern void smp_invalidate_rcv(void); /* Process an NMI */
43extern void (*mtrr_hook) (void); 40extern void (*mtrr_hook) (void);
44extern void zap_low_mappings (void); 41extern void zap_low_mappings (void);
45extern void lock_ipi_call_lock(void); 42extern void lock_ipi_call_lock(void);
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 517f1649ee64..3a0c69524656 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -266,6 +266,9 @@
266#define __NR_ioprio_set 1274 266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275 267#define __NR_ioprio_get 1275
268#define __NR_set_zone_reclaim 1276 268#define __NR_set_zone_reclaim 1276
269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279
269 272
270#ifdef __KERNEL__ 273#ifdef __KERNEL__
271 274
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index ee741c150176..98d79a3d54fa 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -253,6 +253,10 @@ extern void
253pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 253pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
254 struct resource *res); 254 struct resource *res);
255 255
256extern void
257pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
258 struct pci_bus_region *region);
259
256static inline void pcibios_add_platform_entries(struct pci_dev *dev) 260static inline void pcibios_add_platform_entries(struct pci_dev *dev)
257{ 261{
258} 262}
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index c5883dbed63f..9483d4bfacf7 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -109,6 +109,7 @@ static inline long IS_DPERR(const uint offset)
109 * and dual port ram. 109 * and dual port ram.
110 */ 110 */
111extern cpm_cpm2_t *cpmp; /* Pointer to comm processor */ 111extern cpm_cpm2_t *cpmp; /* Pointer to comm processor */
112
112extern uint cpm_dpalloc(uint size, uint align); 113extern uint cpm_dpalloc(uint size, uint align);
113extern int cpm_dpfree(uint offset); 114extern int cpm_dpfree(uint offset);
114extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align); 115extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align);
@@ -116,6 +117,8 @@ extern void cpm_dpdump(void);
116extern void *cpm_dpram_addr(uint offset); 117extern void *cpm_dpram_addr(uint offset);
117extern void cpm_setbrg(uint brg, uint rate); 118extern void cpm_setbrg(uint brg, uint rate);
118extern void cpm2_fastbrg(uint brg, uint rate, int div16); 119extern void cpm2_fastbrg(uint brg, uint rate, int div16);
120extern void cpm2_reset(void);
121
119 122
120/* Buffer descriptors used by many of the CPM protocols. 123/* Buffer descriptors used by many of the CPM protocols.
121*/ 124*/
@@ -1087,5 +1090,3 @@ typedef struct im_idma {
1087 1090
1088#endif /* __CPM2__ */ 1091#endif /* __CPM2__ */
1089#endif /* __KERNEL__ */ 1092#endif /* __KERNEL__ */
1090
1091
diff --git a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h
index 7f0487afebbe..6f74f59938d4 100644
--- a/include/asm-ppc/dma-mapping.h
+++ b/include/asm-ppc/dma-mapping.h
@@ -117,7 +117,7 @@ dma_map_page(struct device *dev, struct page *page,
117 117
118 __dma_sync_page(page, offset, size, direction); 118 __dma_sync_page(page, offset, size, direction);
119 119
120 return (page - mem_map) * PAGE_SIZE + PCI_DRAM_OFFSET + offset; 120 return page_to_bus(page) + offset;
121} 121}
122 122
123/* We do nothing. */ 123/* We do nothing. */
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
index 87f051138b9d..21e41c9b7267 100644
--- a/include/asm-ppc/ibm44x.h
+++ b/include/asm-ppc/ibm44x.h
@@ -35,8 +35,10 @@
35#define PPC44x_LOW_SLOT 63 35#define PPC44x_LOW_SLOT 63
36 36
37/* LS 32-bits of UART0 physical address location for early serial text debug */ 37/* LS 32-bits of UART0 physical address location for early serial text debug */
38#ifdef CONFIG_440SP 38#if defined(CONFIG_440SP)
39#define UART0_PHYS_IO_BASE 0xf0000200 39#define UART0_PHYS_IO_BASE 0xf0000200
40#elif defined(CONFIG_440EP)
41#define UART0_PHYS_IO_BASE 0xe0000000
40#else 42#else
41#define UART0_PHYS_IO_BASE 0x40000200 43#define UART0_PHYS_IO_BASE 0x40000200
42#endif 44#endif
@@ -49,11 +51,16 @@
49/* 51/*
50 * Standard 4GB "page" definitions 52 * Standard 4GB "page" definitions
51 */ 53 */
52#ifdef CONFIG_440SP 54#if defined(CONFIG_440SP)
53#define PPC44x_IO_PAGE 0x0000000100000000ULL 55#define PPC44x_IO_PAGE 0x0000000100000000ULL
54#define PPC44x_PCICFG_PAGE 0x0000000900000000ULL 56#define PPC44x_PCICFG_PAGE 0x0000000900000000ULL
55#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE 57#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE
56#define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL 58#define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL
59#elif defined(CONFIG_440EP)
60#define PPC44x_IO_PAGE 0x0000000000000000ULL
61#define PPC44x_PCICFG_PAGE 0x0000000000000000ULL
62#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE
63#define PPC44x_PCIMEM_PAGE 0x0000000000000000ULL
57#else 64#else
58#define PPC44x_IO_PAGE 0x0000000100000000ULL 65#define PPC44x_IO_PAGE 0x0000000100000000ULL
59#define PPC44x_PCICFG_PAGE 0x0000000200000000ULL 66#define PPC44x_PCICFG_PAGE 0x0000000200000000ULL
@@ -64,7 +71,7 @@
64/* 71/*
65 * 36-bit trap ranges 72 * 36-bit trap ranges
66 */ 73 */
67#ifdef CONFIG_440SP 74#if defined(CONFIG_440SP)
68#define PPC44x_IO_LO 0xf0000000UL 75#define PPC44x_IO_LO 0xf0000000UL
69#define PPC44x_IO_HI 0xf0000fffUL 76#define PPC44x_IO_HI 0xf0000fffUL
70#define PPC44x_PCI0CFG_LO 0x0ec00000UL 77#define PPC44x_PCI0CFG_LO 0x0ec00000UL
@@ -75,6 +82,13 @@
75#define PPC44x_PCI2CFG_HI 0x2ec00007UL 82#define PPC44x_PCI2CFG_HI 0x2ec00007UL
76#define PPC44x_PCIMEM_LO 0x80000000UL 83#define PPC44x_PCIMEM_LO 0x80000000UL
77#define PPC44x_PCIMEM_HI 0xdfffffffUL 84#define PPC44x_PCIMEM_HI 0xdfffffffUL
85#elif defined(CONFIG_440EP)
86#define PPC44x_IO_LO 0xef500000UL
87#define PPC44x_IO_HI 0xefffffffUL
88#define PPC44x_PCI0CFG_LO 0xeec00000UL
89#define PPC44x_PCI0CFG_HI 0xeecfffffUL
90#define PPC44x_PCIMEM_LO 0xa0000000UL
91#define PPC44x_PCIMEM_HI 0xdfffffffUL
78#else 92#else
79#define PPC44x_IO_LO 0x40000000UL 93#define PPC44x_IO_LO 0x40000000UL
80#define PPC44x_IO_HI 0x40000fffUL 94#define PPC44x_IO_HI 0x40000fffUL
@@ -152,6 +166,12 @@
152#define DCRN_SDR_UART0 0x0120 166#define DCRN_SDR_UART0 0x0120
153#define DCRN_SDR_UART1 0x0121 167#define DCRN_SDR_UART1 0x0121
154 168
169#ifdef CONFIG_440EP
170#define DCRN_SDR_UART2 0x0122
171#define DCRN_SDR_UART3 0x0123
172#define DCRN_SDR_CUST0 0x4000
173#endif
174
155/* SDR read/write helper macros */ 175/* SDR read/write helper macros */
156#define SDR_READ(offset) ({\ 176#define SDR_READ(offset) ({\
157 mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \ 177 mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \
@@ -169,6 +189,14 @@
169#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */ 189#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
170#define DCRN_MAL_BASE 0x180 190#define DCRN_MAL_BASE 0x180
171 191
192#ifdef CONFIG_440EP
193#define DCRN_DMA2P40_BASE 0x300
194#define DCRN_DMA2P41_BASE 0x308
195#define DCRN_DMA2P42_BASE 0x310
196#define DCRN_DMA2P43_BASE 0x318
197#define DCRN_DMA2P4SR_BASE 0x320
198#endif
199
172/* UIC */ 200/* UIC */
173#define DCRN_UIC0_BASE 0xc0 201#define DCRN_UIC0_BASE 0xc0
174#define DCRN_UIC1_BASE 0xd0 202#define DCRN_UIC1_BASE 0xd0
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index 35260afa33a9..e807be96e981 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -97,6 +97,10 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
97 97
98#elif CONFIG_44x 98#elif CONFIG_44x
99 99
100#if defined(CONFIG_BAMBOO)
101#include <platforms/4xx/bamboo.h>
102#endif
103
100#if defined(CONFIG_EBONY) 104#if defined(CONFIG_EBONY)
101#include <platforms/4xx/ebony.h> 105#include <platforms/4xx/ebony.h>
102#endif 106#endif
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
index 8c61d93043af..3f7b5669e6d5 100644
--- a/include/asm-ppc/ibm_ocp.h
+++ b/include/asm-ppc/ibm_ocp.h
@@ -71,6 +71,8 @@ struct ocp_func_emac_data {
71 71
72/* Sysfs support */ 72/* Sysfs support */
73#define OCP_SYSFS_EMAC_DATA() \ 73#define OCP_SYSFS_EMAC_DATA() \
74OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, rgmii_idx) \
75OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, rgmii_mux) \
74OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_idx) \ 76OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_idx) \
75OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_mux) \ 77OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_mux) \
76OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_idx) \ 78OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_idx) \
@@ -78,9 +80,14 @@ OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_rx_chan) \
78OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_tx_chan) \ 80OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_tx_chan) \
79OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, wol_irq) \ 81OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, wol_irq) \
80OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mdio_idx) \ 82OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mdio_idx) \
83OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, tah_idx) \
84OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, phy_mode) \
85OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "0x%08x\n", emac, phy_map) \
81 \ 86 \
82void ocp_show_emac_data(struct device *dev) \ 87void ocp_show_emac_data(struct device *dev) \
83{ \ 88{ \
89 device_create_file(dev, &dev_attr_emac_rgmii_idx); \
90 device_create_file(dev, &dev_attr_emac_rgmii_mux); \
84 device_create_file(dev, &dev_attr_emac_zmii_idx); \ 91 device_create_file(dev, &dev_attr_emac_zmii_idx); \
85 device_create_file(dev, &dev_attr_emac_zmii_mux); \ 92 device_create_file(dev, &dev_attr_emac_zmii_mux); \
86 device_create_file(dev, &dev_attr_emac_mal_idx); \ 93 device_create_file(dev, &dev_attr_emac_mal_idx); \
@@ -88,6 +95,9 @@ void ocp_show_emac_data(struct device *dev) \
88 device_create_file(dev, &dev_attr_emac_mal_tx_chan); \ 95 device_create_file(dev, &dev_attr_emac_mal_tx_chan); \
89 device_create_file(dev, &dev_attr_emac_wol_irq); \ 96 device_create_file(dev, &dev_attr_emac_wol_irq); \
90 device_create_file(dev, &dev_attr_emac_mdio_idx); \ 97 device_create_file(dev, &dev_attr_emac_mdio_idx); \
98 device_create_file(dev, &dev_attr_emac_tah_idx); \
99 device_create_file(dev, &dev_attr_emac_phy_mode); \
100 device_create_file(dev, &dev_attr_emac_phy_map); \
91} 101}
92 102
93#ifdef CONFIG_40x 103#ifdef CONFIG_40x
@@ -157,7 +167,7 @@ OCP_SYSFS_ADDTL(struct ocp_func_iic_data, "%d\n", iic, fast_mode) \
157 \ 167 \
158void ocp_show_iic_data(struct device *dev) \ 168void ocp_show_iic_data(struct device *dev) \
159{ \ 169{ \
160 device_create_file(dev, &dev_attr_iic_fast_mode); \ 170 device_create_file(dev, &dev_attr_iic_fast_mode); \
161} 171}
162#endif /* __IBM_OCP_H__ */ 172#endif /* __IBM_OCP_H__ */
163#endif /* __KERNEL__ */ 173#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h
index f5196a4efbe0..77b1e092c206 100644
--- a/include/asm-ppc/mpc10x.h
+++ b/include/asm-ppc/mpc10x.h
@@ -163,7 +163,8 @@ enum ppc_sys_devices {
163 MPC10X_IIC1, 163 MPC10X_IIC1,
164 MPC10X_DMA0, 164 MPC10X_DMA0,
165 MPC10X_DMA1, 165 MPC10X_DMA1,
166 MPC10X_DUART, 166 MPC10X_UART0,
167 MPC10X_UART1,
167}; 168};
168 169
169int mpc10x_bridge_init(struct pci_controller *hose, 170int mpc10x_bridge_init(struct pci_controller *hose,
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index a13d55870e62..a811e440c978 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -105,6 +105,10 @@ extern void
105pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 105pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
106 struct resource *res); 106 struct resource *res);
107 107
108extern void
109pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
110 struct pci_bus_region *region);
111
108extern void pcibios_add_platform_entries(struct pci_dev *dev); 112extern void pcibios_add_platform_entries(struct pci_dev *dev);
109 113
110struct file; 114struct file;
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 4d4b20c9de78..92f30b28b252 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -202,18 +202,64 @@ extern unsigned long ioremap_bot, ioremap_base;
202 * 202 *
203 * Note that these bits preclude future use of a page size 203 * Note that these bits preclude future use of a page size
204 * less than 4KB. 204 * less than 4KB.
205 *
206 *
207 * PPC 440 core has following TLB attribute fields;
208 *
209 * TLB1:
210 * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
211 * RPN................................. - - - - - - ERPN.......
212 *
213 * TLB2:
214 * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
215 * - - - - - - U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR
216 *
217 * There are some constrains and options, to decide mapping software bits
218 * into TLB entry.
219 *
220 * - PRESENT *must* be in the bottom three bits because swap cache
221 * entries use the top 29 bits for TLB2.
222 *
223 * - FILE *must* be in the bottom three bits because swap cache
224 * entries use the top 29 bits for TLB2.
225 *
226 * - CACHE COHERENT bit (M) has no effect on PPC440 core, because it
227 * doesn't support SMP. So we can use this as software bit, like
228 * DIRTY.
229 *
230 * With the PPC 44x Linux implementation, the 0-11th LSBs of the PTE are used
231 * for memory protection related functions (see PTE structure in
232 * include/asm-ppc/mmu.h). The _PAGE_XXX definitions in this file map to the
233 * above bits. Note that the bit values are CPU specific, not architecture
234 * specific.
235 *
236 * The kernel PTE entry holds an arch-dependent swp_entry structure under
237 * certain situations. In other words, in such situations some portion of
238 * the PTE bits are used as a swp_entry. In the PPC implementation, the
239 * 3-24th LSB are shared with swp_entry, however the 0-2nd three LSB still
240 * hold protection values. That means the three protection bits are
241 * reserved for both PTE and SWAP entry at the most significant three
242 * LSBs.
243 *
244 * There are three protection bits available for SWAP entry:
245 * _PAGE_PRESENT
246 * _PAGE_FILE
247 * _PAGE_HASHPTE (if HW has)
248 *
249 * So those three bits have to be inside of 0-2nd LSB of PTE.
250 *
205 */ 251 */
252
206#define _PAGE_PRESENT 0x00000001 /* S: PTE valid */ 253#define _PAGE_PRESENT 0x00000001 /* S: PTE valid */
207#define _PAGE_RW 0x00000002 /* S: Write permission */ 254#define _PAGE_RW 0x00000002 /* S: Write permission */
208#define _PAGE_DIRTY 0x00000004 /* S: Page dirty */ 255#define _PAGE_FILE 0x00000004 /* S: nonlinear file mapping */
209#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */ 256#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */
210#define _PAGE_HWWRITE 0x00000010 /* H: Dirty & RW */ 257#define _PAGE_HWWRITE 0x00000010 /* H: Dirty & RW */
211#define _PAGE_HWEXEC 0x00000020 /* H: Execute permission */ 258#define _PAGE_HWEXEC 0x00000020 /* H: Execute permission */
212#define _PAGE_USER 0x00000040 /* S: User page */ 259#define _PAGE_USER 0x00000040 /* S: User page */
213#define _PAGE_ENDIAN 0x00000080 /* H: E bit */ 260#define _PAGE_ENDIAN 0x00000080 /* H: E bit */
214#define _PAGE_GUARDED 0x00000100 /* H: G bit */ 261#define _PAGE_GUARDED 0x00000100 /* H: G bit */
215#define _PAGE_COHERENT 0x00000200 /* H: M bit */ 262#define _PAGE_DIRTY 0x00000200 /* S: Page dirty */
216#define _PAGE_FILE 0x00000400 /* S: nonlinear file mapping */
217#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */ 263#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */
218#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */ 264#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */
219 265
diff --git a/include/asm-ppc/ppc_asm.h b/include/asm-ppc/ppc_asm.h
index f76221def484..bb53e2def363 100644
--- a/include/asm-ppc/ppc_asm.h
+++ b/include/asm-ppc/ppc_asm.h
@@ -186,6 +186,12 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
186#define PPC405_ERR77_SYNC 186#define PPC405_ERR77_SYNC
187#endif 187#endif
188 188
189#ifdef CONFIG_IBM440EP_ERR42
190#define PPC440EP_ERR42 isync
191#else
192#define PPC440EP_ERR42
193#endif
194
189/* The boring bits... */ 195/* The boring bits... */
190 196
191/* Condition Register Bit Fields */ 197/* Condition Register Bit Fields */
diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
index a7894e0fbbb1..3173ab3d2eb9 100644
--- a/include/asm-ppc/unistd.h
+++ b/include/asm-ppc/unistd.h
@@ -279,8 +279,11 @@
279#define __NR_waitid 272 279#define __NR_waitid 272
280#define __NR_ioprio_set 273 280#define __NR_ioprio_set 273
281#define __NR_ioprio_get 274 281#define __NR_ioprio_get 274
282#define __NR_inotify_init 275
283#define __NR_inotify_add_watch 276
284#define __NR_inotify_rm_watch 277
282 285
283#define __NR_syscalls 275 286#define __NR_syscalls 278
284 287
285#define __NR(n) #n 288#define __NR(n) #n
286 289
diff --git a/include/asm-ppc64/iSeries/HvReleaseData.h b/include/asm-ppc64/iSeries/HvReleaseData.h
index 01a1f13ea4a0..c8162e5ccb21 100644
--- a/include/asm-ppc64/iSeries/HvReleaseData.h
+++ b/include/asm-ppc64/iSeries/HvReleaseData.h
@@ -39,6 +39,11 @@
39 * know that this PLIC does not support running an OS "that old". 39 * know that this PLIC does not support running an OS "that old".
40 */ 40 */
41 41
42#define HVREL_TAGSINACTIVE 0x8000
43#define HVREL_32BIT 0x4000
44#define HVREL_NOSHAREDPROCS 0x2000
45#define HVREL_NOHMT 0x1000
46
42struct HvReleaseData { 47struct HvReleaseData {
43 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */ 48 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */
44 u16 xSize; /* Size of this control block x04-x05 */ 49 u16 xSize; /* Size of this control block x04-x05 */
@@ -46,11 +51,7 @@ struct HvReleaseData {
46 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */ 51 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */
47 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */ 52 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */
48 u32 xRsvd1; /* Reserved x14-x17 */ 53 u32 xRsvd1; /* Reserved x14-x17 */
49 u16 xTagsMode:1; /* 0 == tags active, 1 == tags inactive */ 54 u16 xFlags;
50 u16 xAddressSize:1; /* 0 == 64-bit, 1 == 32-bit */
51 u16 xNoSharedProcs:1; /* 0 == shared procs, 1 == no shared */
52 u16 xNoHMT:1; /* 0 == allow HMT, 1 == no HMT */
53 u16 xRsvd2:12; /* Reserved x18-x19 */
54 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */ 55 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */
55 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */ 56 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */
56 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */ 57 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h
index 038e5df7e9f8..5c32e38c1c01 100644
--- a/include/asm-ppc64/iSeries/LparMap.h
+++ b/include/asm-ppc64/iSeries/LparMap.h
@@ -49,19 +49,26 @@
49 * entry to map the Esid to the Vsid. 49 * entry to map the Esid to the Vsid.
50*/ 50*/
51 51
52#define HvEsidsToMap 2
53#define HvRangesToMap 1
54
52/* Hypervisor initially maps 32MB of the load area */ 55/* Hypervisor initially maps 32MB of the load area */
53#define HvPagesToMap 8192 56#define HvPagesToMap 8192
54 57
55struct LparMap { 58struct LparMap {
56 u64 xNumberEsids; // Number of ESID/VSID pairs (1) 59 u64 xNumberEsids; // Number of ESID/VSID pairs
57 u64 xNumberRanges; // Number of VA ranges to map (1) 60 u64 xNumberRanges; // Number of VA ranges to map
58 u64 xSegmentTableOffs; // Page number within load area of seg table (0) 61 u64 xSegmentTableOffs; // Page number within load area of seg table
59 u64 xRsvd[5]; 62 u64 xRsvd[5];
60 u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) 63 struct {
61 u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) 64 u64 xKernelEsid; // Esid used to map kernel load
62 u64 xPages; // Number of pages to be mapped (8192) 65 u64 xKernelVsid; // Vsid used to map kernel load
63 u64 xOffset; // Offset from start of load area (0) 66 } xEsids[HvEsidsToMap];
64 u64 xVPN; // Virtual Page Number (0x000C000000000000) 67 struct {
68 u64 xPages; // Number of pages to be mapped
69 u64 xOffset; // Offset from start of load area
70 u64 xVPN; // Virtual Page Number
71 } xRanges[HvRangesToMap];
65}; 72};
66 73
67extern struct LparMap xLparMap; 74extern struct LparMap xLparMap;
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index f0c1d2d92672..f0ef06375947 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -84,7 +84,7 @@ struct machdep_calls {
84 84
85 void (*init_IRQ)(void); 85 void (*init_IRQ)(void);
86 int (*get_irq)(struct pt_regs *); 86 int (*get_irq)(struct pt_regs *);
87 void (*cpu_irq_down)(void); 87 void (*cpu_irq_down)(int secondary);
88 88
89 /* PCI stuff */ 89 /* PCI stuff */
90 void (*pcibios_fixup)(void); 90 void (*pcibios_fixup)(void);
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index 3d07ddd11e3b..70348a851313 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -200,6 +200,8 @@ extern long native_hpte_insert(unsigned long hpte_group, unsigned long va,
200 unsigned long prpn, 200 unsigned long prpn,
201 unsigned long vflags, unsigned long rflags); 201 unsigned long vflags, unsigned long rflags);
202 202
203extern void stabs_alloc(void);
204
203#endif /* __ASSEMBLY__ */ 205#endif /* __ASSEMBLY__ */
204 206
205/* 207/*
@@ -336,6 +338,9 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
336 | (ea >> SID_SHIFT)); 338 | (ea >> SID_SHIFT));
337} 339}
338 340
341#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
342#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
343
339#endif /* __ASSEMBLY */ 344#endif /* __ASSEMBLY */
340 345
341#endif /* _PPC64_MMU_H_ */ 346#endif /* _PPC64_MMU_H_ */
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
index faa772223075..4d057452f59b 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-ppc64/pci.h
@@ -134,6 +134,10 @@ extern void
134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
135 struct resource *res); 135 struct resource *res);
136 136
137extern void
138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
139 struct pci_bus_region *region);
140
137extern int 141extern int
138unmap_bus_range(struct pci_bus *bus); 142unmap_bus_range(struct pci_bus *bus);
139 143
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h
index fcdcfd26a26b..1e9b19073230 100644
--- a/include/asm-ppc64/topology.h
+++ b/include/asm-ppc64/topology.h
@@ -33,6 +33,7 @@ static inline int node_to_first_cpu(int node)
33 return first_cpu(tmp); 33 return first_cpu(tmp);
34} 34}
35 35
36#define pcibus_to_node(node) (-1)
36#define pcibus_to_cpumask(bus) (cpu_online_map) 37#define pcibus_to_cpumask(bus) (cpu_online_map)
37 38
38#define nr_cpus_node(node) (nr_cpus_in_node[node]) 39#define nr_cpus_node(node) (nr_cpus_in_node[node])
@@ -59,8 +60,10 @@ static inline int node_to_first_cpu(int node)
59 .nr_balance_failed = 0, \ 60 .nr_balance_failed = 0, \
60} 61}
61 62
62#endif /* CONFIG_NUMA */ 63#else
63 64
64#include <asm-generic/topology.h> 65#include <asm-generic/topology.h>
65 66
67#endif /* CONFIG_NUMA */
68
66#endif /* _ASM_PPC64_TOPOLOGY_H */ 69#endif /* _ASM_PPC64_TOPOLOGY_H */
diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
index 4a94acf6bfed..977bc980c1af 100644
--- a/include/asm-ppc64/unistd.h
+++ b/include/asm-ppc64/unistd.h
@@ -285,8 +285,11 @@
285#define __NR_waitid 272 285#define __NR_waitid 272
286#define __NR_ioprio_set 273 286#define __NR_ioprio_set 273
287#define __NR_ioprio_get 274 287#define __NR_ioprio_get 274
288#define __NR_inotify_init 275
289#define __NR_inotify_add_watch 276
290#define __NR_inotify_rm_watch 277
288 291
289#define __NR_syscalls 275 292#define __NR_syscalls 278
290#ifdef __KERNEL__ 293#ifdef __KERNEL__
291#define NR_syscalls __NR_syscalls 294#define NR_syscalls __NR_syscalls
292#endif 295#endif
diff --git a/include/asm-ppc64/xics.h b/include/asm-ppc64/xics.h
index 0c45e14e26ca..1092af55d707 100644
--- a/include/asm-ppc64/xics.h
+++ b/include/asm-ppc64/xics.h
@@ -17,7 +17,7 @@
17void xics_init_IRQ(void); 17void xics_init_IRQ(void);
18int xics_get_irq(struct pt_regs *); 18int xics_get_irq(struct pt_regs *);
19void xics_setup_cpu(void); 19void xics_setup_cpu(void);
20void xics_teardown_cpu(void); 20void xics_teardown_cpu(int secondary);
21void xics_cause_IPI(int cpu); 21void xics_cause_IPI(int cpu);
22void xics_request_IPIs(void); 22void xics_request_IPIs(void);
23void xics_migrate_irqs_away(void); 23void xics_migrate_irqs_away(void);
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index d5a05cf47168..9d86ba6f12d0 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -123,19 +123,19 @@ typedef struct {
123#define atomic64_read(v) ((v)->counter) 123#define atomic64_read(v) ((v)->counter)
124#define atomic64_set(v,i) (((v)->counter) = (i)) 124#define atomic64_set(v,i) (((v)->counter) = (i))
125 125
126static __inline__ void atomic64_add(int i, atomic64_t * v) 126static __inline__ void atomic64_add(long long i, atomic64_t * v)
127{ 127{
128 __CSG_LOOP(v, i, "agr"); 128 __CSG_LOOP(v, i, "agr");
129} 129}
130static __inline__ long long atomic64_add_return(int i, atomic64_t * v) 130static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
131{ 131{
132 return __CSG_LOOP(v, i, "agr"); 132 return __CSG_LOOP(v, i, "agr");
133} 133}
134static __inline__ long long atomic64_add_negative(int i, atomic64_t * v) 134static __inline__ long long atomic64_add_negative(long long i, atomic64_t * v)
135{ 135{
136 return __CSG_LOOP(v, i, "agr") < 0; 136 return __CSG_LOOP(v, i, "agr") < 0;
137} 137}
138static __inline__ void atomic64_sub(int i, atomic64_t * v) 138static __inline__ void atomic64_sub(long long i, atomic64_t * v)
139{ 139{
140 __CSG_LOOP(v, i, "sgr"); 140 __CSG_LOOP(v, i, "sgr");
141} 141}
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 16bb08499c7f..8651524217fd 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -527,13 +527,64 @@ __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
527 __constant_test_bit((nr),(addr)) : \ 527 __constant_test_bit((nr),(addr)) : \
528 __test_bit((nr),(addr)) ) 528 __test_bit((nr),(addr)) )
529 529
530#ifndef __s390x__ 530/*
531 * ffz = Find First Zero in word. Undefined if no zero exists,
532 * so code should check against ~0UL first..
533 */
534static inline unsigned long ffz(unsigned long word)
535{
536 unsigned long bit = 0;
537
538#ifdef __s390x__
539 if (likely((word & 0xffffffff) == 0xffffffff)) {
540 word >>= 32;
541 bit += 32;
542 }
543#endif
544 if (likely((word & 0xffff) == 0xffff)) {
545 word >>= 16;
546 bit += 16;
547 }
548 if (likely((word & 0xff) == 0xff)) {
549 word >>= 8;
550 bit += 8;
551 }
552 return bit + _zb_findmap[word & 0xff];
553}
554
555/*
556 * __ffs = find first bit in word. Undefined if no bit exists,
557 * so code should check against 0UL first..
558 */
559static inline unsigned long __ffs (unsigned long word)
560{
561 unsigned long bit = 0;
562
563#ifdef __s390x__
564 if (likely((word & 0xffffffff) == 0)) {
565 word >>= 32;
566 bit += 32;
567 }
568#endif
569 if (likely((word & 0xffff) == 0)) {
570 word >>= 16;
571 bit += 16;
572 }
573 if (likely((word & 0xff) == 0)) {
574 word >>= 8;
575 bit += 8;
576 }
577 return bit + _sb_findmap[word & 0xff];
578}
531 579
532/* 580/*
533 * Find-bit routines.. 581 * Find-bit routines..
534 */ 582 */
583
584#ifndef __s390x__
585
535static inline int 586static inline int
536find_first_zero_bit(const unsigned long * addr, unsigned int size) 587find_first_zero_bit(const unsigned long * addr, unsigned long size)
537{ 588{
538 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 589 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
539 unsigned long cmp, count; 590 unsigned long cmp, count;
@@ -548,7 +599,7 @@ find_first_zero_bit(const unsigned long * addr, unsigned int size)
548 " srl %2,5\n" 599 " srl %2,5\n"
549 "0: c %1,0(%0,%4)\n" 600 "0: c %1,0(%0,%4)\n"
550 " jne 1f\n" 601 " jne 1f\n"
551 " ahi %0,4\n" 602 " la %0,4(%0)\n"
552 " brct %2,0b\n" 603 " brct %2,0b\n"
553 " lr %0,%3\n" 604 " lr %0,%3\n"
554 " j 4f\n" 605 " j 4f\n"
@@ -574,7 +625,7 @@ find_first_zero_bit(const unsigned long * addr, unsigned int size)
574} 625}
575 626
576static inline int 627static inline int
577find_first_bit(const unsigned long * addr, unsigned int size) 628find_first_bit(const unsigned long * addr, unsigned long size)
578{ 629{
579 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 630 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
580 unsigned long cmp, count; 631 unsigned long cmp, count;
@@ -589,7 +640,7 @@ find_first_bit(const unsigned long * addr, unsigned int size)
589 " srl %2,5\n" 640 " srl %2,5\n"
590 "0: c %1,0(%0,%4)\n" 641 "0: c %1,0(%0,%4)\n"
591 " jne 1f\n" 642 " jne 1f\n"
592 " ahi %0,4\n" 643 " la %0,4(%0)\n"
593 " brct %2,0b\n" 644 " brct %2,0b\n"
594 " lr %0,%3\n" 645 " lr %0,%3\n"
595 " j 4f\n" 646 " j 4f\n"
@@ -614,89 +665,8 @@ find_first_bit(const unsigned long * addr, unsigned int size)
614 return (res < size) ? res : size; 665 return (res < size) ? res : size;
615} 666}
616 667
617static inline int
618find_next_zero_bit (const unsigned long * addr, int size, int offset)
619{
620 unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
621 unsigned long bitvec, reg;
622 int set, bit = offset & 31, res;
623
624 if (bit) {
625 /*
626 * Look for zero in first word
627 */
628 bitvec = (*p) >> bit;
629 __asm__(" slr %0,%0\n"
630 " lhi %2,0xff\n"
631 " tml %1,0xffff\n"
632 " jno 0f\n"
633 " ahi %0,16\n"
634 " srl %1,16\n"
635 "0: tml %1,0x00ff\n"
636 " jno 1f\n"
637 " ahi %0,8\n"
638 " srl %1,8\n"
639 "1: nr %1,%2\n"
640 " ic %1,0(%1,%3)\n"
641 " alr %0,%1"
642 : "=&d" (set), "+a" (bitvec), "=&d" (reg)
643 : "a" (&_zb_findmap) : "cc" );
644 if (set < (32 - bit))
645 return set + offset;
646 offset += 32 - bit;
647 p++;
648 }
649 /*
650 * No zero yet, search remaining full words for a zero
651 */
652 res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr));
653 return (offset + res);
654}
655
656static inline int
657find_next_bit (const unsigned long * addr, int size, int offset)
658{
659 unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
660 unsigned long bitvec, reg;
661 int set, bit = offset & 31, res;
662
663 if (bit) {
664 /*
665 * Look for set bit in first word
666 */
667 bitvec = (*p) >> bit;
668 __asm__(" slr %0,%0\n"
669 " lhi %2,0xff\n"
670 " tml %1,0xffff\n"
671 " jnz 0f\n"
672 " ahi %0,16\n"
673 " srl %1,16\n"
674 "0: tml %1,0x00ff\n"
675 " jnz 1f\n"
676 " ahi %0,8\n"
677 " srl %1,8\n"
678 "1: nr %1,%2\n"
679 " ic %1,0(%1,%3)\n"
680 " alr %0,%1"
681 : "=&d" (set), "+a" (bitvec), "=&d" (reg)
682 : "a" (&_sb_findmap) : "cc" );
683 if (set < (32 - bit))
684 return set + offset;
685 offset += 32 - bit;
686 p++;
687 }
688 /*
689 * No set bit yet, search remaining full words for a bit
690 */
691 res = find_first_bit (p, size - 32 * (p - (unsigned long *) addr));
692 return (offset + res);
693}
694
695#else /* __s390x__ */ 668#else /* __s390x__ */
696 669
697/*
698 * Find-bit routines..
699 */
700static inline unsigned long 670static inline unsigned long
701find_first_zero_bit(const unsigned long * addr, unsigned long size) 671find_first_zero_bit(const unsigned long * addr, unsigned long size)
702{ 672{
@@ -712,7 +682,7 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
712 " srlg %2,%2,6\n" 682 " srlg %2,%2,6\n"
713 "0: cg %1,0(%0,%4)\n" 683 "0: cg %1,0(%0,%4)\n"
714 " jne 1f\n" 684 " jne 1f\n"
715 " aghi %0,8\n" 685 " la %0,8(%0)\n"
716 " brct %2,0b\n" 686 " brct %2,0b\n"
717 " lgr %0,%3\n" 687 " lgr %0,%3\n"
718 " j 5f\n" 688 " j 5f\n"
@@ -785,143 +755,66 @@ find_first_bit(const unsigned long * addr, unsigned long size)
785 return (res < size) ? res : size; 755 return (res < size) ? res : size;
786} 756}
787 757
788static inline unsigned long
789find_next_zero_bit (const unsigned long * addr, unsigned long size, unsigned long offset)
790{
791 unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
792 unsigned long bitvec, reg;
793 unsigned long set, bit = offset & 63, res;
794
795 if (bit) {
796 /*
797 * Look for zero in first word
798 */
799 bitvec = (*p) >> bit;
800 __asm__(" lhi %2,-1\n"
801 " slgr %0,%0\n"
802 " clr %1,%2\n"
803 " jne 0f\n"
804 " aghi %0,32\n"
805 " srlg %1,%1,32\n"
806 "0: lghi %2,0xff\n"
807 " tmll %1,0xffff\n"
808 " jno 1f\n"
809 " aghi %0,16\n"
810 " srlg %1,%1,16\n"
811 "1: tmll %1,0x00ff\n"
812 " jno 2f\n"
813 " aghi %0,8\n"
814 " srlg %1,%1,8\n"
815 "2: ngr %1,%2\n"
816 " ic %1,0(%1,%3)\n"
817 " algr %0,%1"
818 : "=&d" (set), "+a" (bitvec), "=&d" (reg)
819 : "a" (&_zb_findmap) : "cc" );
820 if (set < (64 - bit))
821 return set + offset;
822 offset += 64 - bit;
823 p++;
824 }
825 /*
826 * No zero yet, search remaining full words for a zero
827 */
828 res = find_first_zero_bit (p, size - 64 * (p - (unsigned long *) addr));
829 return (offset + res);
830}
831
832static inline unsigned long
833find_next_bit (const unsigned long * addr, unsigned long size, unsigned long offset)
834{
835 unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
836 unsigned long bitvec, reg;
837 unsigned long set, bit = offset & 63, res;
838
839 if (bit) {
840 /*
841 * Look for zero in first word
842 */
843 bitvec = (*p) >> bit;
844 __asm__(" slgr %0,%0\n"
845 " ltr %1,%1\n"
846 " jnz 0f\n"
847 " aghi %0,32\n"
848 " srlg %1,%1,32\n"
849 "0: lghi %2,0xff\n"
850 " tmll %1,0xffff\n"
851 " jnz 1f\n"
852 " aghi %0,16\n"
853 " srlg %1,%1,16\n"
854 "1: tmll %1,0x00ff\n"
855 " jnz 2f\n"
856 " aghi %0,8\n"
857 " srlg %1,%1,8\n"
858 "2: ngr %1,%2\n"
859 " ic %1,0(%1,%3)\n"
860 " algr %0,%1"
861 : "=&d" (set), "+a" (bitvec), "=&d" (reg)
862 : "a" (&_sb_findmap) : "cc" );
863 if (set < (64 - bit))
864 return set + offset;
865 offset += 64 - bit;
866 p++;
867 }
868 /*
869 * No set bit yet, search remaining full words for a bit
870 */
871 res = find_first_bit (p, size - 64 * (p - (unsigned long *) addr));
872 return (offset + res);
873}
874
875#endif /* __s390x__ */ 758#endif /* __s390x__ */
876 759
877/* 760static inline int
878 * ffz = Find First Zero in word. Undefined if no zero exists, 761find_next_zero_bit (const unsigned long * addr, unsigned long size,
879 * so code should check against ~0UL first.. 762 unsigned long offset)
880 */
881static inline unsigned long ffz(unsigned long word)
882{ 763{
883 unsigned long bit = 0; 764 const unsigned long *p;
884 765 unsigned long bit, set;
885#ifdef __s390x__ 766
886 if (likely((word & 0xffffffff) == 0xffffffff)) { 767 if (offset >= size)
887 word >>= 32; 768 return size;
888 bit += 32; 769 bit = offset & (__BITOPS_WORDSIZE - 1);
889 } 770 offset -= bit;
890#endif 771 size -= offset;
891 if (likely((word & 0xffff) == 0xffff)) { 772 p = addr + offset / __BITOPS_WORDSIZE;
892 word >>= 16; 773 if (bit) {
893 bit += 16; 774 /*
775 * s390 version of ffz returns __BITOPS_WORDSIZE
776 * if no zero bit is present in the word.
777 */
778 set = ffz(*p >> bit) + bit;
779 if (set >= size)
780 return size + offset;
781 if (set < __BITOPS_WORDSIZE)
782 return set + offset;
783 offset += __BITOPS_WORDSIZE;
784 size -= __BITOPS_WORDSIZE;
785 p++;
894 } 786 }
895 if (likely((word & 0xff) == 0xff)) { 787 return offset + find_first_zero_bit(p, size);
896 word >>= 8;
897 bit += 8;
898 }
899 return bit + _zb_findmap[word & 0xff];
900} 788}
901 789
902/* 790static inline int
903 * __ffs = find first bit in word. Undefined if no bit exists, 791find_next_bit (const unsigned long * addr, unsigned long size,
904 * so code should check against 0UL first.. 792 unsigned long offset)
905 */
906static inline unsigned long __ffs (unsigned long word)
907{ 793{
908 unsigned long bit = 0; 794 const unsigned long *p;
909 795 unsigned long bit, set;
910#ifdef __s390x__ 796
911 if (likely((word & 0xffffffff) == 0)) { 797 if (offset >= size)
912 word >>= 32; 798 return size;
913 bit += 32; 799 bit = offset & (__BITOPS_WORDSIZE - 1);
800 offset -= bit;
801 size -= offset;
802 p = addr + offset / __BITOPS_WORDSIZE;
803 if (bit) {
804 /*
805 * s390 version of __ffs returns __BITOPS_WORDSIZE
806 * if no one bit is present in the word.
807 */
808 set = __ffs(*p & (~0UL << bit));
809 if (set >= size)
810 return size + offset;
811 if (set < __BITOPS_WORDSIZE)
812 return set + offset;
813 offset += __BITOPS_WORDSIZE;
814 size -= __BITOPS_WORDSIZE;
815 p++;
914 } 816 }
915#endif 817 return offset + find_first_bit(p, size);
916 if (likely((word & 0xffff) == 0)) {
917 word >>= 16;
918 bit += 16;
919 }
920 if (likely((word & 0xff) == 0)) {
921 word >>= 8;
922 bit += 8;
923 }
924 return bit + _sb_findmap[word & 0xff];
925} 818}
926 819
927/* 820/*
@@ -1031,49 +924,6 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size)
1031 return (res < size) ? res : size; 924 return (res < size) ? res : size;
1032} 925}
1033 926
1034static inline int
1035ext2_find_next_zero_bit(void *vaddr, unsigned int size, unsigned offset)
1036{
1037 unsigned long *addr = vaddr;
1038 unsigned long *p = addr + (offset >> 5);
1039 unsigned long word, reg;
1040 unsigned int bit = offset & 31UL, res;
1041
1042 if (offset >= size)
1043 return size;
1044
1045 if (bit) {
1046 __asm__(" ic %0,0(%1)\n"
1047 " icm %0,2,1(%1)\n"
1048 " icm %0,4,2(%1)\n"
1049 " icm %0,8,3(%1)"
1050 : "=&a" (word) : "a" (p) : "cc" );
1051 word >>= bit;
1052 res = bit;
1053 /* Look for zero in first longword */
1054 __asm__(" lhi %2,0xff\n"
1055 " tml %1,0xffff\n"
1056 " jno 0f\n"
1057 " ahi %0,16\n"
1058 " srl %1,16\n"
1059 "0: tml %1,0x00ff\n"
1060 " jno 1f\n"
1061 " ahi %0,8\n"
1062 " srl %1,8\n"
1063 "1: nr %1,%2\n"
1064 " ic %1,0(%1,%3)\n"
1065 " alr %0,%1"
1066 : "+&d" (res), "+&a" (word), "=&d" (reg)
1067 : "a" (&_zb_findmap) : "cc" );
1068 if (res < 32)
1069 return (p - addr)*32 + res;
1070 p++;
1071 }
1072 /* No zero yet, search remaining full bytes for a zero */
1073 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
1074 return (p - addr) * 32 + res;
1075}
1076
1077#else /* __s390x__ */ 927#else /* __s390x__ */
1078 928
1079static inline unsigned long 929static inline unsigned long
@@ -1120,56 +970,46 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size)
1120 return (res < size) ? res : size; 970 return (res < size) ? res : size;
1121} 971}
1122 972
1123static inline unsigned long 973#endif /* __s390x__ */
974
975static inline int
1124ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset) 976ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
1125{ 977{
1126 unsigned long *addr = vaddr; 978 unsigned long *addr = vaddr, *p;
1127 unsigned long *p = addr + (offset >> 6); 979 unsigned long word, bit, set;
1128 unsigned long word, reg;
1129 unsigned long bit = offset & 63UL, res;
1130 980
1131 if (offset >= size) 981 if (offset >= size)
1132 return size; 982 return size;
1133 983 bit = offset & (__BITOPS_WORDSIZE - 1);
984 offset -= bit;
985 size -= offset;
986 p = addr + offset / __BITOPS_WORDSIZE;
1134 if (bit) { 987 if (bit) {
1135 __asm__(" lrvg %0,%1" /* load reversed, neat instruction */ 988#ifndef __s390x__
1136 : "=a" (word) : "m" (*p) ); 989 asm(" ic %0,0(%1)\n"
1137 word >>= bit; 990 " icm %0,2,1(%1)\n"
1138 res = bit; 991 " icm %0,4,2(%1)\n"
1139 /* Look for zero in first 8 byte word */ 992 " icm %0,8,3(%1)"
1140 __asm__(" lghi %2,0xff\n" 993 : "=&a" (word) : "a" (p), "m" (*p) : "cc" );
1141 " tmll %1,0xffff\n" 994#else
1142 " jno 2f\n" 995 asm(" lrvg %0,%1" : "=a" (word) : "m" (*p) );
1143 " ahi %0,16\n" 996#endif
1144 " srlg %1,%1,16\n" 997 /*
1145 "0: tmll %1,0xffff\n" 998 * s390 version of ffz returns __BITOPS_WORDSIZE
1146 " jno 2f\n" 999 * if no zero bit is present in the word.
1147 " ahi %0,16\n" 1000 */
1148 " srlg %1,%1,16\n" 1001 set = ffz(word >> bit) + bit;
1149 "1: tmll %1,0xffff\n" 1002 if (set >= size)
1150 " jno 2f\n" 1003 return size + offset;
1151 " ahi %0,16\n" 1004 if (set < __BITOPS_WORDSIZE)
1152 " srl %1,16\n" 1005 return set + offset;
1153 "2: tmll %1,0x00ff\n" 1006 offset += __BITOPS_WORDSIZE;
1154 " jno 3f\n" 1007 size -= __BITOPS_WORDSIZE;
1155 " ahi %0,8\n" 1008 p++;
1156 " srl %1,8\n"
1157 "3: ngr %1,%2\n"
1158 " ic %1,0(%1,%3)\n"
1159 " alr %0,%1"
1160 : "+&d" (res), "+a" (word), "=&d" (reg)
1161 : "a" (&_zb_findmap) : "cc" );
1162 if (res < 64)
1163 return (p - addr)*64 + res;
1164 p++;
1165 } 1009 }
1166 /* No zero yet, search remaining full bytes for a zero */ 1010 return offset + ext2_find_first_zero_bit(p, size);
1167 res = ext2_find_first_zero_bit (p, size - 64 * (p - addr));
1168 return (p - addr) * 64 + res;
1169} 1011}
1170 1012
1171#endif /* __s390x__ */
1172
1173/* Bitmap functions for the minix filesystem. */ 1013/* Bitmap functions for the minix filesystem. */
1174/* FIXME !!! */ 1014/* FIXME !!! */
1175#define minix_test_and_set_bit(nr,addr) \ 1015#define minix_test_and_set_bit(nr,addr) \
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 76b5b19c0ae2..afe6a9f9b0ae 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -90,7 +90,6 @@
90#define __LC_SYSTEM_TIMER 0x278 90#define __LC_SYSTEM_TIMER 0x278
91#define __LC_LAST_UPDATE_CLOCK 0x280 91#define __LC_LAST_UPDATE_CLOCK 0x280
92#define __LC_STEAL_CLOCK 0x288 92#define __LC_STEAL_CLOCK 0x288
93#define __LC_DIAG44_OPCODE 0x290
94#define __LC_KERNEL_STACK 0xD40 93#define __LC_KERNEL_STACK 0xD40
95#define __LC_THREAD_INFO 0xD48 94#define __LC_THREAD_INFO 0xD48
96#define __LC_ASYNC_STACK 0xD50 95#define __LC_ASYNC_STACK 0xD50
@@ -286,8 +285,7 @@ struct _lowcore
286 __u64 system_timer; /* 0x278 */ 285 __u64 system_timer; /* 0x278 */
287 __u64 last_update_clock; /* 0x280 */ 286 __u64 last_update_clock; /* 0x280 */
288 __u64 steal_clock; /* 0x288 */ 287 __u64 steal_clock; /* 0x288 */
289 __u32 diag44_opcode; /* 0x290 */ 288 __u8 pad8[0xc00-0x290]; /* 0x290 */
290 __u8 pad8[0xc00-0x294]; /* 0x294 */
291 /* System info area */ 289 /* System info area */
292 __u64 save_area[16]; /* 0xc00 */ 290 __u64 save_area[16]; /* 0xc00 */
293 __u8 pad9[0xd40-0xc80]; /* 0xc80 */ 291 __u8 pad9[0xd40-0xc80]; /* 0xc80 */
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 8bd14de69e35..4ec652ebb3b1 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -203,7 +203,10 @@ unsigned long get_wchan(struct task_struct *p);
203# define cpu_relax() asm volatile ("diag 0,0,68" : : : "memory") 203# define cpu_relax() asm volatile ("diag 0,0,68" : : : "memory")
204#else /* __s390x__ */ 204#else /* __s390x__ */
205# define cpu_relax() \ 205# define cpu_relax() \
206 asm volatile ("ex 0,%0" : : "i" (__LC_DIAG44_OPCODE) : "memory") 206 do { \
207 if (MACHINE_HAS_DIAG44) \
208 asm volatile ("diag 0,0,68" : : : "memory"); \
209 } while (0)
207#endif /* __s390x__ */ 210#endif /* __s390x__ */
208 211
209/* 212/*
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 53cc736b9820..8ff10300f7ee 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -11,21 +11,16 @@
11#ifndef __ASM_SPINLOCK_H 11#ifndef __ASM_SPINLOCK_H
12#define __ASM_SPINLOCK_H 12#define __ASM_SPINLOCK_H
13 13
14#ifdef __s390x__ 14static inline int
15/* 15_raw_compare_and_swap(volatile unsigned int *lock,
16 * Grmph, take care of %&#! user space programs that include 16 unsigned int old, unsigned int new)
17 * asm/spinlock.h. The diagnose is only available in kernel 17{
18 * context. 18 asm volatile ("cs %0,%3,0(%4)"
19 */ 19 : "=d" (old), "=m" (*lock)
20#ifdef __KERNEL__ 20 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
21#include <asm/lowcore.h> 21 : "cc", "memory" );
22#define __DIAG44_INSN "ex" 22 return old;
23#define __DIAG44_OPERAND __LC_DIAG44_OPCODE 23}
24#else
25#define __DIAG44_INSN "#"
26#define __DIAG44_OPERAND 0
27#endif
28#endif /* __s390x__ */
29 24
30/* 25/*
31 * Simple spin lock operations. There are two variants, one clears IRQ's 26 * Simple spin lock operations. There are two variants, one clears IRQ's
@@ -41,58 +36,35 @@ typedef struct {
41#endif 36#endif
42} __attribute__ ((aligned (4))) spinlock_t; 37} __attribute__ ((aligned (4))) spinlock_t;
43 38
44#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } 39#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
45#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) 40#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
46#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock) 41#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock)
47#define spin_is_locked(x) ((x)->lock != 0) 42#define spin_is_locked(x) ((x)->lock != 0)
48#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 43#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
49 44
50extern inline void _raw_spin_lock(spinlock_t *lp) 45extern void _raw_spin_lock_wait(spinlock_t *lp, unsigned int pc);
46extern int _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc);
47
48static inline void _raw_spin_lock(spinlock_t *lp)
51{ 49{
52#ifndef __s390x__ 50 unsigned long pc = (unsigned long) __builtin_return_address(0);
53 unsigned int reg1, reg2; 51
54 __asm__ __volatile__(" bras %0,1f\n" 52 if (unlikely(_raw_compare_and_swap(&lp->lock, 0, pc) != 0))
55 "0: diag 0,0,68\n" 53 _raw_spin_lock_wait(lp, pc);
56 "1: slr %1,%1\n"
57 " cs %1,%0,0(%3)\n"
58 " jl 0b\n"
59 : "=&d" (reg1), "=&d" (reg2), "=m" (lp->lock)
60 : "a" (&lp->lock), "m" (lp->lock)
61 : "cc", "memory" );
62#else /* __s390x__ */
63 unsigned long reg1, reg2;
64 __asm__ __volatile__(" bras %1,1f\n"
65 "0: " __DIAG44_INSN " 0,%4\n"
66 "1: slr %0,%0\n"
67 " cs %0,%1,0(%3)\n"
68 " jl 0b\n"
69 : "=&d" (reg1), "=&d" (reg2), "=m" (lp->lock)
70 : "a" (&lp->lock), "i" (__DIAG44_OPERAND),
71 "m" (lp->lock) : "cc", "memory" );
72#endif /* __s390x__ */
73} 54}
74 55
75extern inline int _raw_spin_trylock(spinlock_t *lp) 56static inline int _raw_spin_trylock(spinlock_t *lp)
76{ 57{
77 unsigned long reg; 58 unsigned long pc = (unsigned long) __builtin_return_address(0);
78 unsigned int result; 59
79 60 if (likely(_raw_compare_and_swap(&lp->lock, 0, pc) == 0))
80 __asm__ __volatile__(" basr %1,0\n" 61 return 1;
81 "0: cs %0,%1,0(%3)" 62 return _raw_spin_trylock_retry(lp, pc);
82 : "=d" (result), "=&d" (reg), "=m" (lp->lock)
83 : "a" (&lp->lock), "m" (lp->lock), "0" (0)
84 : "cc", "memory" );
85 return !result;
86} 63}
87 64
88extern inline void _raw_spin_unlock(spinlock_t *lp) 65static inline void _raw_spin_unlock(spinlock_t *lp)
89{ 66{
90 unsigned int old; 67 _raw_compare_and_swap(&lp->lock, lp->lock, 0);
91
92 __asm__ __volatile__("cs %0,%3,0(%4)"
93 : "=d" (old), "=m" (lp->lock)
94 : "0" (lp->lock), "d" (0), "a" (lp)
95 : "cc", "memory" );
96} 68}
97 69
98/* 70/*
@@ -106,7 +78,7 @@ extern inline void _raw_spin_unlock(spinlock_t *lp)
106 * read-locks. 78 * read-locks.
107 */ 79 */
108typedef struct { 80typedef struct {
109 volatile unsigned long lock; 81 volatile unsigned int lock;
110 volatile unsigned long owner_pc; 82 volatile unsigned long owner_pc;
111#ifdef CONFIG_PREEMPT 83#ifdef CONFIG_PREEMPT
112 unsigned int break_lock; 84 unsigned int break_lock;
@@ -129,123 +101,55 @@ typedef struct {
129 */ 101 */
130#define write_can_lock(x) ((x)->lock == 0) 102#define write_can_lock(x) ((x)->lock == 0)
131 103
132#ifndef __s390x__ 104extern void _raw_read_lock_wait(rwlock_t *lp);
133#define _raw_read_lock(rw) \ 105extern int _raw_read_trylock_retry(rwlock_t *lp);
134 asm volatile(" l 2,0(%1)\n" \ 106extern void _raw_write_lock_wait(rwlock_t *lp);
135 " j 1f\n" \ 107extern int _raw_write_trylock_retry(rwlock_t *lp);
136 "0: diag 0,0,68\n" \ 108
137 "1: la 2,0(2)\n" /* clear high (=write) bit */ \ 109static inline void _raw_read_lock(rwlock_t *rw)
138 " la 3,1(2)\n" /* one more reader */ \ 110{
139 " cs 2,3,0(%1)\n" /* try to write new value */ \ 111 unsigned int old;
140 " jl 0b" \ 112 old = rw->lock & 0x7fffffffU;
141 : "=m" ((rw)->lock) : "a" (&(rw)->lock), \ 113 if (_raw_compare_and_swap(&rw->lock, old, old + 1) != old)
142 "m" ((rw)->lock) : "2", "3", "cc", "memory" ) 114 _raw_read_lock_wait(rw);
143#else /* __s390x__ */ 115}
144#define _raw_read_lock(rw) \ 116
145 asm volatile(" lg 2,0(%1)\n" \ 117static inline void _raw_read_unlock(rwlock_t *rw)
146 " j 1f\n" \ 118{
147 "0: " __DIAG44_INSN " 0,%2\n" \ 119 unsigned int old, cmp;
148 "1: nihh 2,0x7fff\n" /* clear high (=write) bit */ \ 120
149 " la 3,1(2)\n" /* one more reader */ \ 121 old = rw->lock;
150 " csg 2,3,0(%1)\n" /* try to write new value */ \ 122 do {
151 " jl 0b" \ 123 cmp = old;
152 : "=m" ((rw)->lock) \ 124 old = _raw_compare_and_swap(&rw->lock, old, old - 1);
153 : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND), \ 125 } while (cmp != old);
154 "m" ((rw)->lock) : "2", "3", "cc", "memory" ) 126}
155#endif /* __s390x__ */ 127
156 128static inline void _raw_write_lock(rwlock_t *rw)
157#ifndef __s390x__ 129{
158#define _raw_read_unlock(rw) \ 130 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
159 asm volatile(" l 2,0(%1)\n" \ 131 _raw_write_lock_wait(rw);
160 " j 1f\n" \ 132}
161 "0: diag 0,0,68\n" \ 133
162 "1: lr 3,2\n" \ 134static inline void _raw_write_unlock(rwlock_t *rw)
163 " ahi 3,-1\n" /* one less reader */ \ 135{
164 " cs 2,3,0(%1)\n" \ 136 _raw_compare_and_swap(&rw->lock, 0x80000000, 0);
165 " jl 0b" \ 137}
166 : "=m" ((rw)->lock) : "a" (&(rw)->lock), \ 138
167 "m" ((rw)->lock) : "2", "3", "cc", "memory" ) 139static inline int _raw_read_trylock(rwlock_t *rw)
168#else /* __s390x__ */ 140{
169#define _raw_read_unlock(rw) \ 141 unsigned int old;
170 asm volatile(" lg 2,0(%1)\n" \ 142 old = rw->lock & 0x7fffffffU;
171 " j 1f\n" \ 143 if (likely(_raw_compare_and_swap(&rw->lock, old, old + 1) == old))
172 "0: " __DIAG44_INSN " 0,%2\n" \ 144 return 1;
173 "1: lgr 3,2\n" \ 145 return _raw_read_trylock_retry(rw);
174 " bctgr 3,0\n" /* one less reader */ \ 146}
175 " csg 2,3,0(%1)\n" \ 147
176 " jl 0b" \ 148static inline int _raw_write_trylock(rwlock_t *rw)
177 : "=m" ((rw)->lock) \
178 : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND), \
179 "m" ((rw)->lock) : "2", "3", "cc", "memory" )
180#endif /* __s390x__ */
181
182#ifndef __s390x__
183#define _raw_write_lock(rw) \
184 asm volatile(" lhi 3,1\n" \
185 " sll 3,31\n" /* new lock value = 0x80000000 */ \
186 " j 1f\n" \
187 "0: diag 0,0,68\n" \
188 "1: slr 2,2\n" /* old lock value must be 0 */ \
189 " cs 2,3,0(%1)\n" \
190 " jl 0b" \
191 : "=m" ((rw)->lock) : "a" (&(rw)->lock), \
192 "m" ((rw)->lock) : "2", "3", "cc", "memory" )
193#else /* __s390x__ */
194#define _raw_write_lock(rw) \
195 asm volatile(" llihh 3,0x8000\n" /* new lock value = 0x80...0 */ \
196 " j 1f\n" \
197 "0: " __DIAG44_INSN " 0,%2\n" \
198 "1: slgr 2,2\n" /* old lock value must be 0 */ \
199 " csg 2,3,0(%1)\n" \
200 " jl 0b" \
201 : "=m" ((rw)->lock) \
202 : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND), \
203 "m" ((rw)->lock) : "2", "3", "cc", "memory" )
204#endif /* __s390x__ */
205
206#ifndef __s390x__
207#define _raw_write_unlock(rw) \
208 asm volatile(" slr 3,3\n" /* new lock value = 0 */ \
209 " j 1f\n" \
210 "0: diag 0,0,68\n" \
211 "1: lhi 2,1\n" \
212 " sll 2,31\n" /* old lock value must be 0x80000000 */ \
213 " cs 2,3,0(%1)\n" \
214 " jl 0b" \
215 : "=m" ((rw)->lock) : "a" (&(rw)->lock), \
216 "m" ((rw)->lock) : "2", "3", "cc", "memory" )
217#else /* __s390x__ */
218#define _raw_write_unlock(rw) \
219 asm volatile(" slgr 3,3\n" /* new lock value = 0 */ \
220 " j 1f\n" \
221 "0: " __DIAG44_INSN " 0,%2\n" \
222 "1: llihh 2,0x8000\n" /* old lock value must be 0x8..0 */\
223 " csg 2,3,0(%1)\n" \
224 " jl 0b" \
225 : "=m" ((rw)->lock) \
226 : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND), \
227 "m" ((rw)->lock) : "2", "3", "cc", "memory" )
228#endif /* __s390x__ */
229
230#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
231
232extern inline int _raw_write_trylock(rwlock_t *rw)
233{ 149{
234 unsigned long result, reg; 150 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0))
235 151 return 1;
236 __asm__ __volatile__( 152 return _raw_write_trylock_retry(rw);
237#ifndef __s390x__
238 " lhi %1,1\n"
239 " sll %1,31\n"
240 " cs %0,%1,0(%3)"
241#else /* __s390x__ */
242 " llihh %1,0x8000\n"
243 "0: csg %0,%1,0(%3)\n"
244#endif /* __s390x__ */
245 : "=d" (result), "=&d" (reg), "=m" (rw->lock)
246 : "a" (&rw->lock), "m" (rw->lock), "0" (0UL)
247 : "cc", "memory" );
248 return result == 0;
249} 153}
250 154
251#endif /* __ASM_SPINLOCK_H */ 155#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 363db45f8d07..221e965da924 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -274,8 +274,13 @@
274#define __NR_request_key 279 274#define __NR_request_key 279
275#define __NR_keyctl 280 275#define __NR_keyctl 280
276#define __NR_waitid 281 276#define __NR_waitid 281
277#define __NR_ioprio_set 282
278#define __NR_ioprio_get 283
279#define __NR_inotify_init 284
280#define __NR_inotify_add_watch 285
281#define __NR_inotify_rm_watch 286
277 282
278#define NR_syscalls 282 283#define NR_syscalls 287
279 284
280/* 285/*
281 * There are some system calls that are not present on 64 bit, some 286 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index aee17d7e2e44..58dba518239e 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -167,12 +167,12 @@
167#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ 167#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
168#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ 168#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
169#define __NR_getsockname 150 /* Common */ 169#define __NR_getsockname 150 /* Common */
170/* #define __NR_getmsg 151 SunOS Specific */ 170#define __NR_inotify_init 151 /* Linux specific */
171/* #define __NR_putmsg 152 SunOS Specific */ 171#define __NR_inotify_add_watch 152 /* Linux specific */
172#define __NR_poll 153 /* Common */ 172#define __NR_poll 153 /* Common */
173#define __NR_getdents64 154 /* Linux specific */ 173#define __NR_getdents64 154 /* Linux specific */
174#define __NR_fcntl64 155 /* Linux sparc32 Specific */ 174#define __NR_fcntl64 155 /* Linux sparc32 Specific */
175/* #define __NR_getdirentires 156 SunOS Specific */ 175#define __NR_inotify_rm_watch 156 /* Linux specific */
176#define __NR_statfs 157 /* Common */ 176#define __NR_statfs 157 /* Common */
177#define __NR_fstatfs 158 /* Common */ 177#define __NR_fstatfs 158 /* Common */
178#define __NR_umount 159 /* Common */ 178#define __NR_umount 159 /* Common */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index f59144c6b76a..51ec2879b881 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -167,12 +167,12 @@
167#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ 167#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
168#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ 168#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
169#define __NR_getsockname 150 /* Common */ 169#define __NR_getsockname 150 /* Common */
170/* #define __NR_getmsg 151 SunOS Specific */ 170#define __NR_inotify_init 151 /* Linux specific */
171/* #define __NR_putmsg 152 SunOS Specific */ 171#define __NR_inotify_add_watch 152 /* Linux specific */
172#define __NR_poll 153 /* Common */ 172#define __NR_poll 153 /* Common */
173#define __NR_getdents64 154 /* Linux specific */ 173#define __NR_getdents64 154 /* Linux specific */
174/* #define __NR_fcntl64 155 Linux sparc32 Specific */ 174/* #define __NR_fcntl64 155 Linux sparc32 Specific */
175/* #define __NR_getdirentries 156 SunOS Specific */ 175#define __NR_inotify_rm_watch 156 /* Linux specific */
176#define __NR_statfs 157 /* Common */ 176#define __NR_statfs 157 /* Common */
177#define __NR_fstatfs 158 /* Common */ 177#define __NR_fstatfs 158 /* Common */
178#define __NR_umount 159 /* Common */ 178#define __NR_umount 159 /* Common */
diff --git a/include/asm-um/vm86.h b/include/asm-um/vm86.h
new file mode 100644
index 000000000000..7801f82de1f4
--- /dev/null
+++ b/include/asm-um/vm86.h
@@ -0,0 +1,6 @@
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-v850/bitops.h b/include/asm-v850/bitops.h
index 7c4ecaf5151c..0e5c2f210872 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/bitops.h -- Bit operations 2 * include/asm-v850/bitops.h -- Bit operations
3 * 3 *
4 * Copyright (C) 2001,02,03,04 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,04,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,04,05 Miles Bader <miles@gnu.org>
6 * Copyright (C) 1992 Linus Torvalds. 6 * Copyright (C) 1992 Linus Torvalds.
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General 8 * This file is subject to the terms and conditions of the GNU General
@@ -157,7 +157,7 @@ extern __inline__ int __test_bit (int nr, const void *addr)
157#define find_first_zero_bit(addr, size) \ 157#define find_first_zero_bit(addr, size) \
158 find_next_zero_bit ((addr), (size), 0) 158 find_next_zero_bit ((addr), (size), 0)
159 159
160extern __inline__ int find_next_zero_bit (void *addr, int size, int offset) 160extern __inline__ int find_next_zero_bit(const void *addr, int size, int offset)
161{ 161{
162 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 162 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
163 unsigned long result = offset & ~31UL; 163 unsigned long result = offset & ~31UL;
diff --git a/include/asm-v850/cache.h b/include/asm-v850/cache.h
index 027f8c9090cd..cbf9096e8517 100644
--- a/include/asm-v850/cache.h
+++ b/include/asm-v850/cache.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/cache.h -- Cache operations 2 * include/asm-v850/cache.h -- Cache operations
3 * 3 *
4 * Copyright (C) 2001 NEC Corporation 4 * Copyright (C) 2001,05 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -20,6 +20,9 @@
20#ifndef L1_CACHE_BYTES 20#ifndef L1_CACHE_BYTES
21/* This processor has no cache, so just choose an arbitrary value. */ 21/* This processor has no cache, so just choose an arbitrary value. */
22#define L1_CACHE_BYTES 16 22#define L1_CACHE_BYTES 16
23#define L1_CACHE_SHIFT 4
23#endif 24#endif
24 25
26#define L1_CACHE_SHIFT_MAX L1_CACHE_SHIFT
27
25#endif /* __V850_CACHE_H__ */ 28#endif /* __V850_CACHE_H__ */
diff --git a/include/asm-v850/io.h b/include/asm-v850/io.h
index bb5efd1b4b7d..cc364fcbec10 100644
--- a/include/asm-v850/io.h
+++ b/include/asm-v850/io.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/io.h -- Misc I/O operations 2 * include/asm-v850/io.h -- Misc I/O operations
3 * 3 *
4 * Copyright (C) 2001,02,03,04 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,04,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,04,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -27,12 +27,12 @@
27#define readw_relaxed(a) readw(a) 27#define readw_relaxed(a) readw(a)
28#define readl_relaxed(a) readl(a) 28#define readl_relaxed(a) readl(a)
29 29
30#define writeb(b, addr) \ 30#define writeb(val, addr) \
31 (void)((*(volatile unsigned char *) (addr)) = (b)) 31 (void)((*(volatile unsigned char *) (addr)) = (val))
32#define writew(b, addr) \ 32#define writew(val, addr) \
33 (void)((*(volatile unsigned short *) (addr)) = (b)) 33 (void)((*(volatile unsigned short *) (addr)) = (val))
34#define writel(b, addr) \ 34#define writel(val, addr) \
35 (void)((*(volatile unsigned int *) (addr)) = (b)) 35 (void)((*(volatile unsigned int *) (addr)) = (val))
36 36
37#define __raw_readb readb 37#define __raw_readb readb
38#define __raw_readw readw 38#define __raw_readw readw
@@ -96,11 +96,22 @@ outsl (unsigned long port, const void *src, unsigned long count)
96 outl (*p++, port); 96 outl (*p++, port);
97} 97}
98 98
99#define iounmap(addr) ((void)0) 99
100#define ioremap(physaddr, size) (physaddr) 100/* Some places try to pass in an loff_t for PHYSADDR (?!), so we cast it to
101#define ioremap_nocache(physaddr, size) (physaddr) 101 long before casting it to a pointer to avoid compiler warnings. */
102#define ioremap_writethrough(physaddr, size) (physaddr) 102#define ioremap(physaddr, size) ((void __iomem *)(unsigned long)(physaddr))
103#define ioremap_fullcache(physaddr, size) (physaddr) 103#define iounmap(addr) ((void)0)
104
105#define ioremap_nocache(physaddr, size) ioremap (physaddr, size)
106#define ioremap_writethrough(physaddr, size) ioremap (physaddr, size)
107#define ioremap_fullcache(physaddr, size) ioremap (physaddr, size)
108
109#define ioread8(addr) readb (addr)
110#define ioread16(addr) readw (addr)
111#define ioread32(addr) readl (addr)
112#define iowrite8(val, addr) writeb (val, addr)
113#define iowrite16(val, addr) writew (val, addr)
114#define iowrite32(val, addr) writel (val, addr)
104 115
105#define mmiowb() 116#define mmiowb()
106 117
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index 06085b0c043e..d6091622935d 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/page.h -- VM ops 2 * include/asm-v850/page.h -- VM ops
3 * 3 *
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -132,6 +132,7 @@ extern __inline__ int get_order (unsigned long size)
132 132
133#define pfn_to_page(pfn) virt_to_page (pfn_to_virt (pfn)) 133#define pfn_to_page(pfn) virt_to_page (pfn_to_virt (pfn))
134#define page_to_pfn(page) virt_to_pfn (page_to_virt (page)) 134#define page_to_pfn(page) virt_to_pfn (page_to_virt (page))
135#define pfn_valid(pfn) ((pfn) < max_mapnr)
135 136
136#define virt_addr_valid(kaddr) \ 137#define virt_addr_valid(kaddr) \
137 (((void *)(kaddr) >= (void *)PAGE_OFFSET) && MAP_NR (kaddr) < max_mapnr) 138 (((void *)(kaddr) >= (void *)PAGE_OFFSET) && MAP_NR (kaddr) < max_mapnr)
diff --git a/include/asm-v850/pci.h b/include/asm-v850/pci.h
index 8e79be0fe99d..4581826e1cac 100644
--- a/include/asm-v850/pci.h
+++ b/include/asm-v850/pci.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/pci.h -- PCI support 2 * include/asm-v850/pci.h -- PCI support
3 * 3 *
4 * Copyright (C) 2001,02 NEC Corporation 4 * Copyright (C) 2001,02,05 NEC Corporation
5 * Copyright (C) 2001,02 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -48,12 +48,12 @@ pci_unmap_single (struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
48 perform a pci_dma_sync_for_device, and then the device again owns 48 perform a pci_dma_sync_for_device, and then the device again owns
49 the buffer. */ 49 the buffer. */
50extern void 50extern void
51pci_dma_sync_single_for_cpu (struct pci_dev *dev, dma_addr_t dma_addr, size_t size, 51pci_dma_sync_single_for_cpu (struct pci_dev *dev, dma_addr_t dma_addr,
52 int dir); 52 size_t size, int dir);
53 53
54extern void 54extern void
55pci_dma_sync_single_for_device (struct pci_dev *dev, dma_addr_t dma_addr, size_t size, 55pci_dma_sync_single_for_device (struct pci_dev *dev, dma_addr_t dma_addr,
56 int dir); 56 size_t size, int dir);
57 57
58 58
59/* Do multiple DMA mappings at once. */ 59/* Do multiple DMA mappings at once. */
@@ -65,6 +65,28 @@ extern void
65pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len, 65pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,
66 int dir); 66 int dir);
67 67
68/* SG-list versions of pci_dma_sync functions. */
69extern void
70pci_dma_sync_sg_for_cpu (struct pci_dev *dev,
71 struct scatterlist *sg, int sg_len,
72 int dir);
73extern void
74pci_dma_sync_sg_for_device (struct pci_dev *dev,
75 struct scatterlist *sg, int sg_len,
76 int dir);
77
78#define pci_map_page(dev, page, offs, size, dir) \
79 pci_map_single(dev, (page_address(page) + (offs)), size, dir)
80#define pci_unmap_page(dev,addr,sz,dir) \
81 pci_unmap_single(dev, addr, sz, dir)
82
83/* Test for pci_map_single or pci_map_page having generated an error. */
84static inline int
85pci_dma_mapping_error (dma_addr_t dma_addr)
86{
87 return dma_addr == 0;
88}
89
68/* Allocate and map kernel buffer using consistent mode DMA for PCI 90/* Allocate and map kernel buffer using consistent mode DMA for PCI
69 device. Returns non-NULL cpu-view pointer to the buffer if 91 device. Returns non-NULL cpu-view pointer to the buffer if
70 successful and sets *DMA_ADDR to the pci side dma address as well, 92 successful and sets *DMA_ADDR to the pci side dma address as well,
@@ -91,6 +113,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
91} 113}
92#endif 114#endif
93 115
116extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
117extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr);
118
94static inline void pcibios_add_platform_entries(struct pci_dev *dev) 119static inline void pcibios_add_platform_entries(struct pci_dev *dev)
95{ 120{
96} 121}
diff --git a/include/asm-v850/pgtable.h b/include/asm-v850/pgtable.h
index 76e380e481e9..3cf8775ce85f 100644
--- a/include/asm-v850/pgtable.h
+++ b/include/asm-v850/pgtable.h
@@ -23,6 +23,8 @@
23#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 23#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
24#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 24#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
25 25
26static inline int pte_file (pte_t pte) { return 0; }
27
26 28
27/* These mean nothing to !CONFIG_MMU. */ 29/* These mean nothing to !CONFIG_MMU. */
28#define PAGE_NONE __pgprot(0) 30#define PAGE_NONE __pgprot(0)
diff --git a/include/asm-v850/v850e2_cache.h b/include/asm-v850/v850e2_cache.h
index 61acda1023e8..87edf0d311d5 100644
--- a/include/asm-v850/v850e2_cache.h
+++ b/include/asm-v850/v850e2_cache.h
@@ -2,8 +2,8 @@
2 * include/asm-v850/v850e2_cache_cache.h -- Cache control for V850E2 2 * include/asm-v850/v850e2_cache_cache.h -- Cache control for V850E2
3 * cache memories 3 * cache memories
4 * 4 *
5 * Copyright (C) 2003 NEC Electronics Corporation 5 * Copyright (C) 2003,05 NEC Electronics Corporation
6 * Copyright (C) 2003 Miles Bader <miles@gnu.org> 6 * Copyright (C) 2003,05 Miles Bader <miles@gnu.org>
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General 8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this 9 * Public License. See the file COPYING in the main directory of this
@@ -69,6 +69,7 @@
69 69
70/* For <asm/cache.h> */ 70/* For <asm/cache.h> */
71#define L1_CACHE_BYTES V850E2_CACHE_LINE_SIZE 71#define L1_CACHE_BYTES V850E2_CACHE_LINE_SIZE
72#define L1_CACHE_SHIFT V850E2_CACHE_LINE_SIZE_BITS
72 73
73 74
74#endif /* __V850_V850E2_CACHE_H__ */ 75#endif /* __V850_V850E2_CACHE_H__ */
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index a31bb99be53f..05a0d374404b 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -348,8 +348,7 @@ static inline int sched_find_first_bit(const unsigned long *b)
348 return __ffs(b[0]); 348 return __ffs(b[0]);
349 if (b[1]) 349 if (b[1])
350 return __ffs(b[1]) + 64; 350 return __ffs(b[1]) + 64;
351 if (b[2]) 351 return __ffs(b[2]) + 128;
352 return __ffs(b[2]) + 128;
353} 352}
354 353
355/** 354/**
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h
index 3d2a666a5dd5..eed785667289 100644
--- a/include/asm-x86_64/bug.h
+++ b/include/asm-x86_64/bug.h
@@ -8,17 +8,24 @@
8 * this frame. 8 * this frame.
9 */ 9 */
10struct bug_frame { 10struct bug_frame {
11 unsigned char ud2[2]; 11 unsigned char ud2[2];
12 unsigned char mov;
12 /* should use 32bit offset instead, but the assembler doesn't 13 /* should use 32bit offset instead, but the assembler doesn't
13 like it */ 14 like it */
14 char *filename; 15 char *filename;
16 unsigned char ret;
15 unsigned short line; 17 unsigned short line;
16} __attribute__((packed)); 18} __attribute__((packed));
17 19
18#ifdef CONFIG_BUG 20#ifdef CONFIG_BUG
19#define HAVE_ARCH_BUG 21#define HAVE_ARCH_BUG
20#define BUG() \ 22/* We turn the bug frame into valid instructions to not confuse
21 asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ 23 the disassembler. Thanks to Jan Beulich & Suresh Siddha
24 for nice instruction selection.
25 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
26#define BUG() \
27 asm volatile( \
28 "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \
22 "i"(__LINE__), "i" (__stringify(__FILE__))) 29 "i"(__LINE__), "i" (__stringify(__FILE__)))
23void out_of_line_bug(void); 30void out_of_line_bug(void);
24#else 31#else
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
index 6aefb9c0280d..c89b58bebee2 100644
--- a/include/asm-x86_64/desc.h
+++ b/include/asm-x86_64/desc.h
@@ -75,6 +75,7 @@ struct desc_ptr {
75 */ 75 */
76extern struct desc_struct default_ldt[]; 76extern struct desc_struct default_ldt[];
77extern struct gate_struct idt_table[]; 77extern struct gate_struct idt_table[];
78extern struct desc_ptr cpu_gdt_descr[];
78 79
79static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) 80static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)
80{ 81{
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h
index d1841847ed89..5e166b9d3bde 100644
--- a/include/asm-x86_64/ipi.h
+++ b/include/asm-x86_64/ipi.h
@@ -82,30 +82,27 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
82 */ 82 */
83 local_irq_save(flags); 83 local_irq_save(flags);
84 84
85 for (query_cpu = 0; query_cpu < NR_CPUS; ++query_cpu) { 85 for_each_cpu_mask(query_cpu, mask) {
86 if (cpu_isset(query_cpu, mask)) { 86 /*
87 87 * Wait for idle.
88 /* 88 */
89 * Wait for idle. 89 apic_wait_icr_idle();
90 */ 90
91 apic_wait_icr_idle(); 91 /*
92 92 * prepare target chip field
93 /* 93 */
94 * prepare target chip field 94 cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]);
95 */ 95 apic_write_around(APIC_ICR2, cfg);
96 cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); 96
97 apic_write_around(APIC_ICR2, cfg); 97 /*
98 98 * program the ICR
99 /* 99 */
100 * program the ICR 100 cfg = __prepare_ICR(0, vector, APIC_DEST_PHYSICAL);
101 */ 101
102 cfg = __prepare_ICR(0, vector, APIC_DEST_PHYSICAL); 102 /*
103 103 * Send the IPI. The write to APIC_ICR fires this off.
104 /* 104 */
105 * Send the IPI. The write to APIC_ICR fires this off. 105 apic_write_around(APIC_ICR, cfg);
106 */
107 apic_write_around(APIC_ICR, cfg);
108 }
109 } 106 }
110 local_irq_restore(flags); 107 local_irq_restore(flags);
111} 108}
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h
index eb3b7aa9eb9f..4482657777bb 100644
--- a/include/asm-x86_64/irq.h
+++ b/include/asm-x86_64/irq.h
@@ -57,4 +57,6 @@ int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
57extern void fixup_irqs(cpumask_t map); 57extern void fixup_irqs(cpumask_t map);
58#endif 58#endif
59 59
60#define __ARCH_HAS_DO_SOFTIRQ 1
61
60#endif /* _ASM_IRQ_H */ 62#endif /* _ASM_IRQ_H */
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index bc700232728d..ba15279a79d0 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -218,7 +218,7 @@ extern inline unsigned int cpuid_edx(unsigned int op)
218#define MSR_K7_PERFCTR3 0xC0010007 218#define MSR_K7_PERFCTR3 0xC0010007
219#define MSR_K8_TOP_MEM1 0xC001001A 219#define MSR_K8_TOP_MEM1 0xC001001A
220#define MSR_K8_TOP_MEM2 0xC001001D 220#define MSR_K8_TOP_MEM2 0xC001001D
221#define MSR_K8_SYSCFG 0xC0000010 221#define MSR_K8_SYSCFG 0xC0010010
222 222
223/* K6 MSRs */ 223/* K6 MSRs */
224#define MSR_K6_EFER 0xC0000080 224#define MSR_K6_EFER 0xC0000080
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index eeb3088a1c9e..9c4527eb55e2 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -22,11 +22,9 @@ extern unsigned int pcibios_assign_all_busses(void);
22extern int no_iommu, force_iommu; 22extern int no_iommu, force_iommu;
23 23
24extern unsigned long pci_mem_start; 24extern unsigned long pci_mem_start;
25#define PCIBIOS_MIN_IO 0x1000 25#define PCIBIOS_MIN_IO 0x4000
26#define PCIBIOS_MIN_MEM (pci_mem_start) 26#define PCIBIOS_MIN_MEM (pci_mem_start)
27 27
28#define PCIBIOS_MIN_CARDBUS_IO 0x4000
29
30void pcibios_config_init(void); 28void pcibios_config_init(void);
31struct pci_bus * pcibios_scan_root(int bus); 29struct pci_bus * pcibios_scan_root(int bus);
32extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); 30extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 4eec176c3c39..4e167b5ea8f3 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -176,6 +176,8 @@ extern inline void pgd_clear (pgd_t * pgd)
176 (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD) 176 (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD)
177#define __PAGE_KERNEL_LARGE \ 177#define __PAGE_KERNEL_LARGE \
178 (__PAGE_KERNEL | _PAGE_PSE) 178 (__PAGE_KERNEL | _PAGE_PSE)
179#define __PAGE_KERNEL_LARGE_EXEC \
180 (__PAGE_KERNEL_EXEC | _PAGE_PSE)
179 181
180#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) 182#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL)
181 183
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index aeb1b73e21e1..de8b57b2b62b 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -46,12 +46,12 @@ extern int pic_mode;
46extern void lock_ipi_call_lock(void); 46extern void lock_ipi_call_lock(void);
47extern void unlock_ipi_call_lock(void); 47extern void unlock_ipi_call_lock(void);
48extern int smp_num_siblings; 48extern int smp_num_siblings;
49extern void smp_flush_tlb(void);
50extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
51extern void smp_send_reschedule(int cpu); 49extern void smp_send_reschedule(int cpu);
52extern void smp_invalidate_rcv(void); /* Process an NMI */
53extern void zap_low_mappings(void); 50extern void zap_low_mappings(void);
54void smp_stop_cpu(void); 51void smp_stop_cpu(void);
52extern int smp_call_function_single(int cpuid, void (*func) (void *info),
53 void *info, int retry, int wait);
54
55extern cpumask_t cpu_sibling_map[NR_CPUS]; 55extern cpumask_t cpu_sibling_map[NR_CPUS];
56extern cpumask_t cpu_core_map[NR_CPUS]; 56extern cpumask_t cpu_core_map[NR_CPUS];
57extern u8 phys_proc_id[NR_CPUS]; 57extern u8 phys_proc_id[NR_CPUS];
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index 76165736e43a..8606e170a7dc 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -116,12 +116,12 @@ struct alt_instr {
116/* 116/*
117 * Alternative inline assembly with input. 117 * Alternative inline assembly with input.
118 * 118 *
119 * Pecularities: 119 * Peculiarities:
120 * No memory clobber here. 120 * No memory clobber here.
121 * Argument numbers start with 1. 121 * Argument numbers start with 1.
122 * Best is to use constraints that are fixed size (like (%1) ... "r") 122 * Best is to use constraints that are fixed size (like (%1) ... "r")
123 * If you use variable sized constraints like "m" or "g" in the 123 * If you use variable sized constraints like "m" or "g" in the
124 * replacement maake sure to pad to the worst case length. 124 * replacement make sure to pad to the worst case length.
125 */ 125 */
126#define alternative_input(oldinstr, newinstr, feature, input...) \ 126#define alternative_input(oldinstr, newinstr, feature, input...) \
127 asm volatile ("661:\n\t" oldinstr "\n662:\n" \ 127 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
@@ -335,9 +335,6 @@ void cpu_idle_wait(void);
335void disable_hlt(void); 335void disable_hlt(void);
336void enable_hlt(void); 336void enable_hlt(void);
337 337
338#define HAVE_EAT_KEY
339void eat_key(void);
340
341extern unsigned long arch_align_stack(unsigned long sp); 338extern unsigned long arch_align_stack(unsigned long sp);
342 339
343#endif 340#endif
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index 061742382520..505b0cf906de 100644
--- a/include/asm-x86_64/tlbflush.h
+++ b/include/asm-x86_64/tlbflush.h
@@ -56,8 +56,9 @@ extern unsigned long pgkern_mask;
56 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 56 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
57 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables 57 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
58 * 58 *
59 * ..but the x86_64 has somewhat limited tlb flushing capabilities, 59 * x86-64 can only flush individual pages or full VMs. For a range flush
60 * and page-granular flushes are available only on i486 and up. 60 * we always do the full VM. Might be worth trying if for a small
61 * range a few INVLPGs in a row are a win.
61 */ 62 */
62 63
63#ifndef CONFIG_SMP 64#ifndef CONFIG_SMP
@@ -115,7 +116,9 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
115static inline void flush_tlb_pgtables(struct mm_struct *mm, 116static inline void flush_tlb_pgtables(struct mm_struct *mm,
116 unsigned long start, unsigned long end) 117 unsigned long start, unsigned long end)
117{ 118{
118 /* x86_64 does not keep any page table caches in TLB */ 119 /* x86_64 does not keep any page table caches in a software TLB.
120 The CPUs do in their hardware TLBs, but they are handled
121 by the normal TLB flushing algorithms. */
119} 122}
120 123
121#endif /* _X8664_TLBFLUSH_H */ 124#endif /* _X8664_TLBFLUSH_H */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index f85cbe919e13..b46a5205ee7b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -453,9 +453,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
453 * If this matches the last registration, any IRQ resources for gsi 453 * If this matches the last registration, any IRQ resources for gsi
454 * are freed. 454 * are freed.
455 */ 455 */
456#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
457void acpi_unregister_gsi (u32 gsi); 456void acpi_unregister_gsi (u32 gsi);
458#endif
459 457
460#ifdef CONFIG_ACPI_PCI 458#ifdef CONFIG_ACPI_PCI
461 459
@@ -480,9 +478,7 @@ struct pci_dev;
480int acpi_pci_irq_enable (struct pci_dev *dev); 478int acpi_pci_irq_enable (struct pci_dev *dev);
481void acpi_penalize_isa_irq(int irq, int active); 479void acpi_penalize_isa_irq(int irq, int active);
482 480
483#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
484void acpi_pci_irq_disable (struct pci_dev *dev); 481void acpi_pci_irq_disable (struct pci_dev *dev);
485#endif
486 482
487struct acpi_pci_driver { 483struct acpi_pci_driver {
488 struct acpi_pci_driver *next; 484 struct acpi_pci_driver *next;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0881b5cdee3d..19bd8e7e11bf 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -301,6 +301,7 @@ struct blk_queue_tag {
301 struct list_head busy_list; /* fifo list of busy tags */ 301 struct list_head busy_list; /* fifo list of busy tags */
302 int busy; /* current depth */ 302 int busy; /* current depth */
303 int max_depth; /* what we will send to device */ 303 int max_depth; /* what we will send to device */
304 int real_max_depth; /* what the array can hold */
304 atomic_t refcnt; /* map can be shared */ 305 atomic_t refcnt; /* map can be shared */
305}; 306};
306 307
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index c28050136164..1d68428c925d 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -48,12 +48,12 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
48 48
49#else 49#else
50 50
51struct dcookie_user * dcookie_register(void) 51static inline struct dcookie_user * dcookie_register(void)
52{ 52{
53 return NULL; 53 return NULL;
54} 54}
55 55
56void dcookie_unregister(struct dcookie_user * user) 56static inline void dcookie_unregister(struct dcookie_user * user)
57{ 57{
58 return; 58 return;
59} 59}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0f53e0124941..f9adf75fd9b4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -697,11 +697,13 @@ extern struct list_head file_lock_list;
697#include <linux/fcntl.h> 697#include <linux/fcntl.h>
698 698
699extern int fcntl_getlk(struct file *, struct flock __user *); 699extern int fcntl_getlk(struct file *, struct flock __user *);
700extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); 700extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
701 struct flock __user *);
701 702
702#if BITS_PER_LONG == 32 703#if BITS_PER_LONG == 32
703extern int fcntl_getlk64(struct file *, struct flock64 __user *); 704extern int fcntl_getlk64(struct file *, struct flock64 __user *);
704extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *); 705extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
706 struct flock64 __user *);
705#endif 707#endif
706 708
707extern void send_sigio(struct fown_struct *fown, int fd, int band); 709extern void send_sigio(struct fown_struct *fown, int fd, int band);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index d07a92c94776..602c305c8585 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -21,7 +21,7 @@
21 */ 21 */
22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
23 const char *old_name, const char *new_name, 23 const char *old_name, const char *new_name,
24 int isdir) 24 int isdir, struct inode *target)
25{ 25{
26 u32 cookie = inotify_get_cookie(); 26 u32 cookie = inotify_get_cookie();
27 27
@@ -36,31 +36,30 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
36 isdir = IN_ISDIR; 36 isdir = IN_ISDIR;
37 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name); 37 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name);
38 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name); 38 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name);
39
40 if (target) {
41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL);
42 inotify_inode_is_dead(target);
43 }
39} 44}
40 45
41/* 46/*
42 * fsnotify_unlink - file was unlinked 47 * fsnotify_nameremove - a filename was removed from a directory
43 */ 48 */
44static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir) 49static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
45{ 50{
46 struct inode *inode = dentry->d_inode; 51 if (isdir)
47 52 isdir = IN_ISDIR;
48 inode_dir_notify(dir, DN_DELETE); 53 dnotify_parent(dentry, DN_DELETE);
49 inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name); 54 inotify_dentry_parent_queue_event(dentry, IN_DELETE|isdir, 0, dentry->d_name.name);
50 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
51
52 inotify_inode_is_dead(inode);
53} 55}
54 56
55/* 57/*
56 * fsnotify_rmdir - directory was removed 58 * fsnotify_inoderemove - an inode is going away
57 */ 59 */
58static inline void fsnotify_rmdir(struct dentry *dentry, struct inode *inode, 60static inline void fsnotify_inoderemove(struct inode *inode)
59 struct inode *dir)
60{ 61{
61 inode_dir_notify(dir, DN_DELETE); 62 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
62 inotify_inode_queue_event(dir,IN_DELETE|IN_ISDIR,0,dentry->d_name.name);
63 inotify_inode_queue_event(inode, IN_DELETE_SELF | IN_ISDIR, 0, NULL);
64 inotify_inode_is_dead(inode); 63 inotify_inode_is_dead(inode);
65} 64}
66 65
diff --git a/include/linux/ftape.h b/include/linux/ftape.h
index c6b38d5b9186..72faeec9f6e1 100644
--- a/include/linux/ftape.h
+++ b/include/linux/ftape.h
@@ -165,7 +165,7 @@ typedef union {
165# undef CONFIG_FT_FDC_DMA 165# undef CONFIG_FT_FDC_DMA
166# define CONFIG_FT_FDC_DMA 2 166# define CONFIG_FT_FDC_DMA 2
167# endif 167# endif
168#elif CONFIG_FT_ALT_FDC == 1 /* CONFIG_FT_MACH2 */ 168#elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */
169# if CONFIG_FT_FDC_BASE == 0 169# if CONFIG_FT_FDC_BASE == 0
170# undef CONFIG_FT_FDC_BASE 170# undef CONFIG_FT_FDC_BASE
171# define CONFIG_FT_FDC_BASE 0x370 171# define CONFIG_FT_FDC_BASE 0x370
diff --git a/include/linux/input.h b/include/linux/input.h
index b9cc0ac71f44..bdc53c6cc962 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -811,9 +811,9 @@ struct input_dev {
811 811
812 void *private; 812 void *private;
813 813
814 char *name; 814 const char *name;
815 char *phys; 815 const char *phys;
816 char *uniq; 816 const char *uniq;
817 struct input_id id; 817 struct input_id id;
818 818
819 unsigned long evbit[NBITS(EV_MAX)]; 819 unsigned long evbit[NBITS(EV_MAX)];
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 8e5a10410a30..9263d2db2d67 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -29,7 +29,7 @@ struct mb_cache_op {
29 29
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t,
31 int, int); 31 int, int);
32void mb_cache_shrink(struct mb_cache *, struct block_device *); 32void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 33void mb_cache_destroy(struct mb_cache *);
34 34
35/* Functions on cache entries */ 35/* Functions on cache entries */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6eb7f48317f8..82d7024f0765 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -625,10 +625,16 @@ static inline int page_mapped(struct page *page)
625 * Used to decide whether a process gets delivered SIGBUS or 625 * Used to decide whether a process gets delivered SIGBUS or
626 * just gets major/minor fault counters bumped up. 626 * just gets major/minor fault counters bumped up.
627 */ 627 */
628#define VM_FAULT_OOM (-1) 628#define VM_FAULT_OOM 0x00
629#define VM_FAULT_SIGBUS 0 629#define VM_FAULT_SIGBUS 0x01
630#define VM_FAULT_MINOR 1 630#define VM_FAULT_MINOR 0x02
631#define VM_FAULT_MAJOR 2 631#define VM_FAULT_MAJOR 0x03
632
633/*
634 * Special case for get_user_pages.
635 * Must be in a distinct bit from the above VM_FAULT_ flags.
636 */
637#define VM_FAULT_WRITE 0x10
632 638
633#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 639#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
634 640
@@ -704,7 +710,13 @@ extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsign
704extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)); 710extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
705extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 711extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
706extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 712extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
707extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); 713extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
714
715static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access)
716{
717 return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE);
718}
719
708extern int make_pages_present(unsigned long addr, unsigned long end); 720extern int make_pages_present(unsigned long addr, unsigned long end);
709extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 721extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
710void install_arg_page(struct vm_area_struct *, struct page *, unsigned long); 722void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 70c2a9dc4b2b..6552b71bfa73 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -12,15 +12,13 @@
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ARPD 8 15#define NETLINK_ISCSI 8 /* Open-iSCSI */
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10 17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */
19#define NETLINK_NETFILTER 12 /* netfilter subsystem */ 18#define NETLINK_NETFILTER 12 /* netfilter subsystem */
20#define NETLINK_IP6_FW 13 19#define NETLINK_IP6_FW 13
21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ 21#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
23#define NETLINK_TAPBASE 16 /* 16 to 31 are ethertap */
24 22
25#define MAX_LINKS 32 23#define MAX_LINKS 32
26 24
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7ac14961ba22..8621cf42b46f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -971,6 +971,8 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en
971 971
972#define isa_bridge ((struct pci_dev *)NULL) 972#define isa_bridge ((struct pci_dev *)NULL)
973 973
974#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
975
974#else 976#else
975 977
976/* 978/*
@@ -985,9 +987,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
985 return 0; 987 return 0;
986} 988}
987#endif 989#endif
988
989#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
990
991#endif /* !CONFIG_PCI */ 990#endif /* !CONFIG_PCI */
992 991
993/* these helpers provide future and backwards compatibility 992/* these helpers provide future and backwards compatibility
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d2ad2c4f835a..bc4cc10fabe9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1020,6 +1020,7 @@
1020#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 1020#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
1021#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 1021#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
1022#define PCI_DEVICE_ID_PLX_R753 0x1152 1022#define PCI_DEVICE_ID_PLX_R753 0x1152
1023#define PCI_DEVICE_ID_PLX_OLITEC 0x1187
1023#define PCI_DEVICE_ID_PLX_9030 0x9030 1024#define PCI_DEVICE_ID_PLX_9030 0x9030
1024#define PCI_DEVICE_ID_PLX_9050 0x9050 1025#define PCI_DEVICE_ID_PLX_9050 0x9050
1025#define PCI_DEVICE_ID_PLX_9060 0x9060 1026#define PCI_DEVICE_ID_PLX_9060 0x9060
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 6213e976eade..4bf1659f8aa8 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -248,6 +248,7 @@ struct bitmap {
248 248
249/* these are used only by md/bitmap */ 249/* these are used only by md/bitmap */
250int bitmap_create(mddev_t *mddev); 250int bitmap_create(mddev_t *mddev);
251void bitmap_flush(mddev_t *mddev);
251void bitmap_destroy(mddev_t *mddev); 252void bitmap_destroy(mddev_t *mddev);
252int bitmap_active(struct bitmap *bitmap); 253int bitmap_active(struct bitmap *bitmap);
253 254
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 30b64f3534f4..f6fca8f2f3ca 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -104,7 +104,7 @@
104#define PORT_MPSC 63 104#define PORT_MPSC 63
105 105
106/* TXX9 type number */ 106/* TXX9 type number */
107#define PORT_TXX9 64 107#define PORT_TXX9 64
108 108
109/* NEC VR4100 series SIU/DSIU */ 109/* NEC VR4100 series SIU/DSIU */
110#define PORT_VR41XX_SIU 65 110#define PORT_VR41XX_SIU 65
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 4c8e552471b0..80b2dfde2e80 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -111,7 +111,7 @@ static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int n
111{ 111{
112 return kmem_cache_alloc(cachep, flags); 112 return kmem_cache_alloc(cachep, flags);
113} 113}
114static inline void *kmalloc_node(size_t size, int flags, int node) 114static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node)
115{ 115{
116 return kmalloc(size, flags); 116 return kmalloc(size, flags);
117} 117}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 239f520cc49e..bfe3e763ccf2 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -7,7 +7,6 @@
7#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/pagemap.h>
11 10
12#include <asm/atomic.h> 11#include <asm/atomic.h>
13#include <asm/page.h> 12#include <asm/page.h>
@@ -255,6 +254,8 @@ static inline void put_swap_token(struct mm_struct *mm)
255 254
256#define si_swapinfo(val) \ 255#define si_swapinfo(val) \
257 do { (val)->freeswap = (val)->totalswap = 0; } while (0) 256 do { (val)->freeswap = (val)->totalswap = 0; } while (0)
257/* only sparc can not include linux/pagemap.h in this file
258 * so leave page_cache_release and release_pages undeclared... */
258#define free_page_and_swap_cache(page) \ 259#define free_page_and_swap_cache(page) \
259 page_cache_release(page) 260 page_cache_release(page)
260#define free_pages_and_swap_cache(pages, nr) \ 261#define free_pages_and_swap_cache(pages, nr) \
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bfbbe94b297d..e82be96d4906 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -145,6 +145,7 @@ enum
145 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ 145 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */ 146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ 147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
148}; 149};
149 150
150 151
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 4c2c82336d10..84876077027f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -42,8 +42,7 @@ struct uinput_request {
42 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ 42 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
43 43
44 int retval; 44 int retval;
45 wait_queue_head_t waitq; 45 struct completion done;
46 int completed;
47 46
48 union { 47 union {
49 int effect_id; 48 int effect_id;
@@ -62,7 +61,7 @@ struct uinput_device {
62 61
63 struct uinput_request *requests[UINPUT_NUM_REQUESTS]; 62 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
64 wait_queue_head_t requests_waitq; 63 wait_queue_head_t requests_waitq;
65 struct semaphore requests_sem; 64 spinlock_t requests_lock;
66}; 65};
67#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
68 67
diff --git a/include/linux/usb_input.h b/include/linux/usb_input.h
new file mode 100644
index 000000000000..716e0cc16043
--- /dev/null
+++ b/include/linux/usb_input.h
@@ -0,0 +1,25 @@
1#ifndef __USB_INPUT_H
2#define __USB_INPUT_H
3
4/*
5 * Copyright (C) 2005 Dmitry Torokhov
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#include <linux/usb.h>
13#include <linux/input.h>
14#include <asm/byteorder.h>
15
16static inline void
17usb_to_input_id(const struct usb_device *dev, struct input_id *id)
18{
19 id->bustype = BUS_USB;
20 id->vendor = le16_to_cpu(dev->descriptor.idVendor);
21 id->product = le16_to_cpu(dev->descriptor.idProduct);
22 id->version = le16_to_cpu(dev->descriptor.bcdDevice);
23}
24
25#endif
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 88ba0d29f8c8..1192ed8f4fe8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -47,4 +47,14 @@ struct watchdog_info {
47#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ 47#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */
48#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ 48#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */
49 49
50#ifdef __KERNEL__
51
52#ifdef CONFIG_WATCHDOG_NOWAYOUT
53#define WATCHDOG_NOWAYOUT 1
54#else
55#define WATCHDOG_NOWAYOUT 0
56#endif
57
58#endif /* __KERNEL__ */
59
50#endif /* ifndef _LINUX_WATCHDOG_H */ 60#endif /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 850076ea14d3..74f7b78c22d2 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -506,6 +506,11 @@ extern int zlib_deflateReset (z_streamp strm);
506 stream state was inconsistent (such as zalloc or state being NULL). 506 stream state was inconsistent (such as zalloc or state being NULL).
507*/ 507*/
508 508
509static inline unsigned long deflateBound(unsigned long s)
510{
511 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
512}
513
509extern int zlib_deflateParams (z_streamp strm, int level, int strategy); 514extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
510/* 515/*
511 Dynamically update the compression level and compression strategy. The 516 Dynamically update the compression level and compression strategy. The
diff --git a/include/media/tuner.h b/include/media/tuner.h
index d8c0a5563289..eeaa15ddee85 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -1,5 +1,5 @@
1 1
2/* $Id: tuner.h,v 1.42 2005/07/06 09:42:19 mchehab Exp $ 2/* $Id: tuner.h,v 1.45 2005/07/28 18:41:21 mchehab Exp $
3 * 3 *
4 tuner.h - definition for different tuners 4 tuner.h - definition for different tuners
5 5
@@ -108,6 +108,8 @@
108 108
109#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 109#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
110#define TUNER_PHILIPS_FMD1216ME_MK3 63 110#define TUNER_PHILIPS_FMD1216ME_MK3 63
111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */
112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
111 113
112#define NOTUNER 0 114#define NOTUNER 0
113#define PAL 1 /* PAL_BG */ 115#define PAL 1 /* PAL_BG */
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index 5c4fe30e8d1d..854a2c2f105b 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -24,4 +24,3 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee,
24 unsigned char *eeprom_data); 24 unsigned char *eeprom_data);
25 25
26int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); 26int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);
27int tveeprom_dump(unsigned char *eedata, int len);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 42a84c53678b..06b24f637026 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -57,12 +57,6 @@
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" , __FUNCTION__ , ## 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" , __FUNCTION__ , ## arg)
59 59
60#ifdef HCI_DATA_DUMP
61#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len)
62#else
63#define BT_DMP(D...)
64#endif
65
66extern struct proc_dir_entry *proc_bt; 60extern struct proc_dir_entry *proc_bt;
67 61
68/* Connection and socket states */ 62/* Connection and socket states */
@@ -174,8 +168,6 @@ static inline int skb_frags_no(struct sk_buff *skb)
174 return n; 168 return n;
175} 169}
176 170
177void bt_dump(char *pref, __u8 *buf, int count);
178
179int bt_err(__u16 code); 171int bt_err(__u16 code);
180 172
181#endif /* __BLUETOOTH_H */ 173#endif /* __BLUETOOTH_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f4f9aba07ac2..5010f0c5a56e 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1236,7 +1236,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
1236 tp->left_out = tp->sacked_out + tp->lost_out; 1236 tp->left_out = tp->sacked_out + tp->lost_out;
1237} 1237}
1238 1238
1239/* Set slow start threshould and cwnd not falling to slow start */ 1239/* Set slow start threshold and cwnd not falling to slow start */
1240static inline void __tcp_enter_cwr(struct tcp_sock *tp) 1240static inline void __tcp_enter_cwr(struct tcp_sock *tp)
1241{ 1241{
1242 tp->undo_marker = 0; 1242 tp->undo_marker = 0;
diff --git a/include/sound/core.h b/include/sound/core.h
index f8c4ef0aa352..38b357fc8958 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -126,25 +126,26 @@ struct snd_monitor_file {
126 struct snd_monitor_file *next; 126 struct snd_monitor_file *next;
127}; 127};
128 128
129struct snd_shutdown_f_ops; /* define it later */ 129struct snd_shutdown_f_ops; /* define it later in init.c */
130 130
131/* main structure for soundcard */ 131/* main structure for soundcard */
132 132
133struct _snd_card { 133struct _snd_card {
134 int number; /* number of soundcard (index to snd_cards) */ 134 int number; /* number of soundcard (index to
135 snd_cards) */
135 136
136 char id[16]; /* id string of this card */ 137 char id[16]; /* id string of this card */
137 char driver[16]; /* driver name */ 138 char driver[16]; /* driver name */
138 char shortname[32]; /* short name of this soundcard */ 139 char shortname[32]; /* short name of this soundcard */
139 char longname[80]; /* name of this soundcard */ 140 char longname[80]; /* name of this soundcard */
140 char mixername[80]; /* mixer name */ 141 char mixername[80]; /* mixer name */
141 char components[80]; /* card components delimited with space */ 142 char components[80]; /* card components delimited with
142 143 space */
143 struct module *module; /* top-level module */ 144 struct module *module; /* top-level module */
144 145
145 void *private_data; /* private data for soundcard */ 146 void *private_data; /* private data for soundcard */
146 void (*private_free) (snd_card_t *card); /* callback for freeing of private data */ 147 void (*private_free) (snd_card_t *card); /* callback for freeing of
147 148 private data */
148 struct list_head devices; /* devices */ 149 struct list_head devices; /* devices */
149 150
150 unsigned int last_numid; /* last used numeric ID */ 151 unsigned int last_numid; /* last used numeric ID */
@@ -160,7 +161,8 @@ struct _snd_card {
160 struct proc_dir_entry *proc_root_link; /* number link to real id */ 161 struct proc_dir_entry *proc_root_link; /* number link to real id */
161 162
162 struct snd_monitor_file *files; /* all files associated to this card */ 163 struct snd_monitor_file *files; /* all files associated to this card */
163 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown state */ 164 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown
165 state */
164 spinlock_t files_lock; /* lock the files for this card */ 166 spinlock_t files_lock; /* lock the files for this card */
165 int shutdown; /* this card is going down */ 167 int shutdown; /* this card is going down */
166 wait_queue_head_t shutdown_sleep; 168 wait_queue_head_t shutdown_sleep;
@@ -196,8 +198,6 @@ static inline void snd_power_unlock(snd_card_t *card)
196 up(&card->power_lock); 198 up(&card->power_lock);
197} 199}
198 200
199int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file);
200
201static inline unsigned int snd_power_get_state(snd_card_t *card) 201static inline unsigned int snd_power_get_state(snd_card_t *card)
202{ 202{
203 return card->power_state; 203 return card->power_state;
@@ -208,6 +208,10 @@ static inline void snd_power_change_state(snd_card_t *card, unsigned int state)
208 card->power_state = state; 208 card->power_state = state;
209 wake_up(&card->power_sleep); 209 wake_up(&card->power_sleep);
210} 210}
211
212/* init.c */
213int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file);
214
211int snd_card_set_pm_callback(snd_card_t *card, 215int snd_card_set_pm_callback(snd_card_t *card,
212 int (*suspend)(snd_card_t *, pm_message_t), 216 int (*suspend)(snd_card_t *, pm_message_t),
213 int (*resume)(snd_card_t *), 217 int (*resume)(snd_card_t *),
@@ -238,15 +242,14 @@ static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct fi
238 242
239#endif /* CONFIG_PM */ 243#endif /* CONFIG_PM */
240 244
241/* device.c */
242
243struct _snd_minor { 245struct _snd_minor {
244 struct list_head list; /* list of all minors per card */ 246 struct list_head list; /* list of all minors per card */
245 int number; /* minor number */ 247 int number; /* minor number */
246 int device; /* device number */ 248 int device; /* device number */
247 const char *comment; /* for /proc/asound/devices */ 249 const char *comment; /* for /proc/asound/devices */
248 struct file_operations *f_ops; /* file operations */ 250 struct file_operations *f_ops; /* file operations */
249 char name[0]; /* device name (keep at the end of structure) */ 251 char name[0]; /* device name (keep at the end of
252 structure) */
250}; 253};
251 254
252typedef struct _snd_minor snd_minor_t; 255typedef struct _snd_minor snd_minor_t;
@@ -287,12 +290,12 @@ void snd_memory_init(void);
287void snd_memory_done(void); 290void snd_memory_done(void);
288int snd_memory_info_init(void); 291int snd_memory_info_init(void);
289int snd_memory_info_done(void); 292int snd_memory_info_done(void);
290void *snd_hidden_kmalloc(size_t size, int flags); 293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags);
291void *snd_hidden_kcalloc(size_t n, size_t size, int flags); 294void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags);
292void snd_hidden_kfree(const void *obj); 295void snd_hidden_kfree(const void *obj);
293void *snd_hidden_vmalloc(unsigned long size); 296void *snd_hidden_vmalloc(unsigned long size);
294void snd_hidden_vfree(void *obj); 297void snd_hidden_vfree(void *obj);
295char *snd_hidden_kstrdup(const char *s, int flags); 298char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags);
296#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) 299#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
297#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) 300#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
298#define kfree(obj) snd_hidden_kfree(obj) 301#define kfree(obj) snd_hidden_kfree(obj)
@@ -411,7 +414,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
411 printk(fmt ,##args) 414 printk(fmt ,##args)
412#endif 415#endif
413/** 416/**
414 * snd_assert - run-time assersion macro 417 * snd_assert - run-time assertion macro
415 * @expr: expression 418 * @expr: expression
416 * @args...: the action 419 * @args...: the action
417 * 420 *
@@ -427,7 +430,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
427 }\ 430 }\
428} while (0) 431} while (0)
429/** 432/**
430 * snd_runtime_check - run-time assersion macro 433 * snd_runtime_check - run-time assertion macro
431 * @expr: expression 434 * @expr: expression
432 * @args...: the action 435 * @args...: the action
433 * 436 *
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 948e9a1aebef..0d12456ec3ae 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -51,7 +51,7 @@
51#ifdef CONFIG_SND_DEBUG_MEMORY 51#ifdef CONFIG_SND_DEBUG_MEMORY
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/vmalloc.h> 53#include <linux/vmalloc.h>
54void *snd_wrapper_kmalloc(size_t, int); 54void *snd_wrapper_kmalloc(size_t, unsigned int __nocast);
55#undef kmalloc 55#undef kmalloc
56void snd_wrapper_kfree(const void *); 56void snd_wrapper_kfree(const void *);
57#undef kfree 57#undef kfree
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index c50b91958ff9..c2ef3f023687 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1167,6 +1167,7 @@ int snd_emu10k1_create(snd_card_t * card,
1167 unsigned short extout_mask, 1167 unsigned short extout_mask,
1168 long max_cache_bytes, 1168 long max_cache_bytes,
1169 int enable_ir, 1169 int enable_ir,
1170 uint subsystem,
1170 emu10k1_t ** remu); 1171 emu10k1_t ** remu);
1171 1172
1172int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1173int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
diff --git a/include/sound/version.h b/include/sound/version.h
index 46acfa8c9988..c085136f391f 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.9" 2#define CONFIG_SND_VERSION "1.0.9b"
3#define CONFIG_SND_DATE " (Sun May 29 07:31:02 2005 UTC)" 3#define CONFIG_SND_DATE " (Thu Jul 28 12:20:13 2005 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index a7e29933f2d0..7a60a3888667 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -233,37 +233,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs);
233/* 233/*
234 * lowlevel functions 234 * lowlevel functions
235 */ 235 */
236inline static int vx_test_and_ack(vx_core_t *chip) 236static inline int vx_test_and_ack(vx_core_t *chip)
237{ 237{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO); 238 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 239 return chip->ops->test_and_ack(chip);
240} 240}
241 241
242inline static void vx_validate_irq(vx_core_t *chip, int enable) 242static inline void vx_validate_irq(vx_core_t *chip, int enable)
243{ 243{
244 snd_assert(chip->ops->validate_irq, return); 244 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 245 chip->ops->validate_irq(chip, enable);
246} 246}
247 247
248inline static unsigned char snd_vx_inb(vx_core_t *chip, int reg) 248static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg)
249{ 249{
250 snd_assert(chip->ops->in8, return 0); 250 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 251 return chip->ops->in8(chip, reg);
252} 252}
253 253
254inline static unsigned int snd_vx_inl(vx_core_t *chip, int reg) 254static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg)
255{ 255{
256 snd_assert(chip->ops->in32, return 0); 256 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 257 return chip->ops->in32(chip, reg);
258} 258}
259 259
260inline static void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) 260static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val)
261{ 261{
262 snd_assert(chip->ops->out8, return); 262 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 263 chip->ops->out8(chip, reg, val);
264} 264}
265 265
266inline static void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) 266static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val)
267{ 267{
268 snd_assert(chip->ops->out32, return); 268 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 269 chip->ops->out32(chip, reg, val);
@@ -303,14 +303,14 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time);
303/* 303/*
304 * pseudo-DMA transfer 304 * pseudo-DMA transfer
305 */ 305 */
306inline static void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, 306static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime,
307 vx_pipe_t *pipe, int count) 307 vx_pipe_t *pipe, int count)
308{ 308{
309 snd_assert(chip->ops->dma_write, return); 309 snd_assert(chip->ops->dma_write, return);
310 chip->ops->dma_write(chip, runtime, pipe, count); 310 chip->ops->dma_write(chip, runtime, pipe, count);
311} 311}
312 312
313inline static void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, 313static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime,
314 vx_pipe_t *pipe, int count) 314 vx_pipe_t *pipe, int count)
315{ 315{
316 snd_assert(chip->ops->dma_read, return); 316 snd_assert(chip->ops->dma_read, return);
diff --git a/init/Kconfig b/init/Kconfig
index 75755ef50c89..05a75c4f5ce2 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -231,7 +231,7 @@ config CPUSETS
231 bool "Cpuset support" 231 bool "Cpuset support"
232 depends on SMP 232 depends on SMP
233 help 233 help
234 This options will let you create and manage CPUSET's which 234 This option will let you create and manage CPUSETs which
235 allow dynamically partitioning a system into sets of CPUs and 235 allow dynamically partitioning a system into sets of CPUs and
236 Memory Nodes and assigning tasks to run only within those sets. 236 Memory Nodes and assigning tasks to run only within those sets.
237 This is primarily useful on large SMP or NUMA systems. 237 This is primarily useful on large SMP or NUMA systems.
diff --git a/init/main.c b/init/main.c
index b5e421e39ede..c9c311cf1771 100644
--- a/init/main.c
+++ b/init/main.c
@@ -51,6 +51,7 @@
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/bugs.h> 52#include <asm/bugs.h>
53#include <asm/setup.h> 53#include <asm/setup.h>
54#include <asm/sections.h>
54 55
55/* 56/*
56 * This is one of the first .c files built. Error out early 57 * This is one of the first .c files built. Error out early
@@ -323,8 +324,6 @@ static void __init setup_per_cpu_areas(void)
323{ 324{
324 unsigned long size, i; 325 unsigned long size, i;
325 char *ptr; 326 char *ptr;
326 /* Created by linker magic */
327 extern char __per_cpu_start[], __per_cpu_end[];
328 327
329 /* Copy section for each CPU (we discard the original) */ 328 /* Copy section for each CPU (we discard the original) */
330 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); 329 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
diff --git a/ipc/sem.c b/ipc/sem.c
index 7e8a25c82ef3..70975ce0784a 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -895,7 +895,7 @@ static inline void lock_semundo(void)
895 struct sem_undo_list *undo_list; 895 struct sem_undo_list *undo_list;
896 896
897 undo_list = current->sysvsem.undo_list; 897 undo_list = current->sysvsem.undo_list;
898 if ((undo_list != NULL) && (atomic_read(&undo_list->refcnt) != 1)) 898 if (undo_list)
899 spin_lock(&undo_list->lock); 899 spin_lock(&undo_list->lock);
900} 900}
901 901
@@ -915,7 +915,7 @@ static inline void unlock_semundo(void)
915 struct sem_undo_list *undo_list; 915 struct sem_undo_list *undo_list;
916 916
917 undo_list = current->sysvsem.undo_list; 917 undo_list = current->sysvsem.undo_list;
918 if ((undo_list != NULL) && (atomic_read(&undo_list->refcnt) != 1)) 918 if (undo_list)
919 spin_unlock(&undo_list->lock); 919 spin_unlock(&undo_list->lock);
920} 920}
921 921
@@ -943,9 +943,7 @@ static inline int get_undo_list(struct sem_undo_list **undo_listp)
943 if (undo_list == NULL) 943 if (undo_list == NULL)
944 return -ENOMEM; 944 return -ENOMEM;
945 memset(undo_list, 0, size); 945 memset(undo_list, 0, size);
946 /* don't initialize unodhd->lock here. It's done 946 spin_lock_init(&undo_list->lock);
947 * in copy_semundo() instead.
948 */
949 atomic_set(&undo_list->refcnt, 1); 947 atomic_set(&undo_list->refcnt, 1);
950 current->sysvsem.undo_list = undo_list; 948 current->sysvsem.undo_list = undo_list;
951 } 949 }
@@ -1231,8 +1229,6 @@ int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
1231 error = get_undo_list(&undo_list); 1229 error = get_undo_list(&undo_list);
1232 if (error) 1230 if (error)
1233 return error; 1231 return error;
1234 if (atomic_read(&undo_list->refcnt) == 1)
1235 spin_lock_init(&undo_list->lock);
1236 atomic_inc(&undo_list->refcnt); 1232 atomic_inc(&undo_list->refcnt);
1237 tsk->sysvsem.undo_list = undo_list; 1233 tsk->sysvsem.undo_list = undo_list;
1238 } else 1234 } else
diff --git a/ipc/shm.c b/ipc/shm.c
index cce022435dbc..1d6cf08d950b 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -170,7 +170,7 @@ static struct vm_operations_struct shm_vm_ops = {
170 .open = shm_open, /* callback for a new vm-area open */ 170 .open = shm_open, /* callback for a new vm-area open */
171 .close = shm_close, /* callback for when the vm-area is released */ 171 .close = shm_close, /* callback for when the vm-area is released */
172 .nopage = shmem_nopage, 172 .nopage = shmem_nopage,
173#ifdef CONFIG_NUMA 173#if defined(CONFIG_NUMA) && defined(CONFIG_SHMEM)
174 .set_policy = shmem_set_policy, 174 .set_policy = shmem_set_policy,
175 .get_policy = shmem_get_policy, 175 .get_policy = shmem_get_policy,
176#endif 176#endif
diff --git a/kernel/capability.c b/kernel/capability.c
index 64db1ee820c2..8986a37a67ea 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -31,8 +31,14 @@ static DEFINE_SPINLOCK(task_capability_lock);
31 * uninteresting and/or not to be changed. 31 * uninteresting and/or not to be changed.
32 */ 32 */
33 33
34/* 34/**
35 * sys_capget - get the capabilities of a given process. 35 * sys_capget - get the capabilities of a given process.
36 * @header: pointer to struct that contains capability version and
37 * target pid data
38 * @dataptr: pointer to struct that contains the effective, permitted,
39 * and inheritable capabilities that are returned
40 *
41 * Returns 0 on success and < 0 on error.
36 */ 42 */
37asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) 43asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
38{ 44{
@@ -141,8 +147,14 @@ static inline int cap_set_all(kernel_cap_t *effective,
141 return ret; 147 return ret;
142} 148}
143 149
144/* 150/**
145 * sys_capset - set capabilities for a given process, all processes, or all 151 * sys_capset - set capabilities for a process or a group of processes
152 * @header: pointer to struct that contains capability version and
153 * target pid data
154 * @data: pointer to struct that contains the effective, permitted,
155 * and inheritable capabilities
156 *
157 * Set capabilities for a given process, all processes, or all
146 * processes in a given process group. 158 * processes in a given process group.
147 * 159 *
148 * The restrictions on setting capabilities are specified as: 160 * The restrictions on setting capabilities are specified as:
@@ -152,6 +164,8 @@ static inline int cap_set_all(kernel_cap_t *effective,
152 * I: any raised capabilities must be a subset of the (old current) permitted 164 * I: any raised capabilities must be a subset of the (old current) permitted
153 * P: any raised capabilities must be a subset of the (old current) permitted 165 * P: any raised capabilities must be a subset of the (old current) permitted
154 * E: must be set to a subset of (new target) permitted 166 * E: must be set to a subset of (new target) permitted
167 *
168 * Returns 0 on success and < 0 on error.
155 */ 169 */
156asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) 170asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
157{ 171{
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 984c0bf3807f..805fb9097318 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1440,10 +1440,10 @@ void __init cpuset_init_smp(void)
1440 1440
1441/** 1441/**
1442 * cpuset_fork - attach newly forked task to its parents cpuset. 1442 * cpuset_fork - attach newly forked task to its parents cpuset.
1443 * @p: pointer to task_struct of forking parent process. 1443 * @tsk: pointer to task_struct of forking parent process.
1444 * 1444 *
1445 * Description: By default, on fork, a task inherits its 1445 * Description: By default, on fork, a task inherits its
1446 * parents cpuset. The pointer to the shared cpuset is 1446 * parent's cpuset. The pointer to the shared cpuset is
1447 * automatically copied in fork.c by dup_task_struct(). 1447 * automatically copied in fork.c by dup_task_struct().
1448 * This cpuset_fork() routine need only increment the usage 1448 * This cpuset_fork() routine need only increment the usage
1449 * counter in that cpuset. 1449 * counter in that cpuset.
@@ -1471,7 +1471,6 @@ void cpuset_fork(struct task_struct *tsk)
1471 * by the cpuset_sem semaphore. If you don't hold cpuset_sem, 1471 * by the cpuset_sem semaphore. If you don't hold cpuset_sem,
1472 * then a zero cpuset use count is a license to any other task to 1472 * then a zero cpuset use count is a license to any other task to
1473 * nuke the cpuset immediately. 1473 * nuke the cpuset immediately.
1474 *
1475 **/ 1474 **/
1476 1475
1477void cpuset_exit(struct task_struct *tsk) 1476void cpuset_exit(struct task_struct *tsk)
@@ -1521,7 +1520,9 @@ void cpuset_init_current_mems_allowed(void)
1521 current->mems_allowed = NODE_MASK_ALL; 1520 current->mems_allowed = NODE_MASK_ALL;
1522} 1521}
1523 1522
1524/* 1523/**
1524 * cpuset_update_current_mems_allowed - update mems parameters to new values
1525 *
1525 * If the current tasks cpusets mems_allowed changed behind our backs, 1526 * If the current tasks cpusets mems_allowed changed behind our backs,
1526 * update current->mems_allowed and mems_generation to the new value. 1527 * update current->mems_allowed and mems_generation to the new value.
1527 * Do not call this routine if in_interrupt(). 1528 * Do not call this routine if in_interrupt().
@@ -1540,13 +1541,20 @@ void cpuset_update_current_mems_allowed(void)
1540 } 1541 }
1541} 1542}
1542 1543
1544/**
1545 * cpuset_restrict_to_mems_allowed - limit nodes to current mems_allowed
1546 * @nodes: pointer to a node bitmap that is and-ed with mems_allowed
1547 */
1543void cpuset_restrict_to_mems_allowed(unsigned long *nodes) 1548void cpuset_restrict_to_mems_allowed(unsigned long *nodes)
1544{ 1549{
1545 bitmap_and(nodes, nodes, nodes_addr(current->mems_allowed), 1550 bitmap_and(nodes, nodes, nodes_addr(current->mems_allowed),
1546 MAX_NUMNODES); 1551 MAX_NUMNODES);
1547} 1552}
1548 1553
1549/* 1554/**
1555 * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed
1556 * @zl: the zonelist to be checked
1557 *
1550 * Are any of the nodes on zonelist zl allowed in current->mems_allowed? 1558 * Are any of the nodes on zonelist zl allowed in current->mems_allowed?
1551 */ 1559 */
1552int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 1560int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
@@ -1562,8 +1570,12 @@ int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
1562 return 0; 1570 return 0;
1563} 1571}
1564 1572
1565/* 1573/**
1566 * Is 'current' valid, and is zone z allowed in current->mems_allowed? 1574 * cpuset_zone_allowed - is zone z allowed in current->mems_allowed
1575 * @z: zone in question
1576 *
1577 * Is zone z allowed in current->mems_allowed, or is
1578 * the CPU in interrupt context? (zone is always allowed in this case)
1567 */ 1579 */
1568int cpuset_zone_allowed(struct zone *z) 1580int cpuset_zone_allowed(struct zone *z)
1569{ 1581{
diff --git a/kernel/crash_dump.c b/kernel/crash_dump.c
index 459ba49e376a..334c37f5218a 100644
--- a/kernel/crash_dump.c
+++ b/kernel/crash_dump.c
@@ -18,7 +18,16 @@
18/* Stores the physical address of elf header of crash image. */ 18/* Stores the physical address of elf header of crash image. */
19unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; 19unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
20 20
21/* 21/**
22 * copy_oldmem_page - copy one page from "oldmem"
23 * @pfn: page frame number to be copied
24 * @buf: target memory address for the copy; this can be in kernel address
25 * space or user address space (see @userbuf)
26 * @csize: number of bytes to copy
27 * @offset: offset in bytes into the page (based on pfn) to begin the copy
28 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
29 * otherwise @buf is in kernel address space, use memcpy().
30 *
22 * Copy a page from "oldmem". For this page, there is no pte mapped 31 * Copy a page from "oldmem". For this page, there is no pte mapped
23 * in the current kernel. We stitch up a pte, similar to kmap_atomic. 32 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
24 */ 33 */
diff --git a/kernel/exit.c b/kernel/exit.c
index 9d1b10ed0135..5b0fb9f09f21 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -829,8 +829,10 @@ fastcall NORET_TYPE void do_exit(long code)
829 acct_update_integrals(tsk); 829 acct_update_integrals(tsk);
830 update_mem_hiwater(tsk); 830 update_mem_hiwater(tsk);
831 group_dead = atomic_dec_and_test(&tsk->signal->live); 831 group_dead = atomic_dec_and_test(&tsk->signal->live);
832 if (group_dead) 832 if (group_dead) {
833 del_timer_sync(&tsk->signal->real_timer);
833 acct_process(code); 834 acct_process(code);
835 }
834 exit_mm(tsk); 836 exit_mm(tsk);
835 837
836 exit_sem(tsk); 838 exit_sem(tsk);
diff --git a/kernel/itimer.c b/kernel/itimer.c
index a72cb0e5aa4b..7c1b25e25e47 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -112,28 +112,11 @@ asmlinkage long sys_getitimer(int which, struct itimerval __user *value)
112 return error; 112 return error;
113} 113}
114 114
115/*
116 * Called with P->sighand->siglock held and P->signal->real_timer inactive.
117 * If interval is nonzero, arm the timer for interval ticks from now.
118 */
119static inline void it_real_arm(struct task_struct *p, unsigned long interval)
120{
121 p->signal->it_real_value = interval; /* XXX unnecessary field?? */
122 if (interval == 0)
123 return;
124 if (interval > (unsigned long) LONG_MAX)
125 interval = LONG_MAX;
126 /* the "+ 1" below makes sure that the timer doesn't go off before
127 * the interval requested. This could happen if
128 * time requested % (usecs per jiffy) is more than the usecs left
129 * in the current jiffy */
130 p->signal->real_timer.expires = jiffies + interval + 1;
131 add_timer(&p->signal->real_timer);
132}
133 115
134void it_real_fn(unsigned long __data) 116void it_real_fn(unsigned long __data)
135{ 117{
136 struct task_struct * p = (struct task_struct *) __data; 118 struct task_struct * p = (struct task_struct *) __data;
119 unsigned long inc = p->signal->it_real_incr;
137 120
138 send_group_sig_info(SIGALRM, SEND_SIG_PRIV, p); 121 send_group_sig_info(SIGALRM, SEND_SIG_PRIV, p);
139 122
@@ -141,14 +124,23 @@ void it_real_fn(unsigned long __data)
141 * Now restart the timer if necessary. We don't need any locking 124 * Now restart the timer if necessary. We don't need any locking
142 * here because do_setitimer makes sure we have finished running 125 * here because do_setitimer makes sure we have finished running
143 * before it touches anything. 126 * before it touches anything.
127 * Note, we KNOW we are (or should be) at a jiffie edge here so
128 * we don't need the +1 stuff. Also, we want to use the prior
129 * expire value so as to not "slip" a jiffie if we are late.
130 * Deal with requesting a time prior to "now" here rather than
131 * in add_timer.
144 */ 132 */
145 it_real_arm(p, p->signal->it_real_incr); 133 if (!inc)
134 return;
135 while (time_before_eq(p->signal->real_timer.expires, jiffies))
136 p->signal->real_timer.expires += inc;
137 add_timer(&p->signal->real_timer);
146} 138}
147 139
148int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) 140int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
149{ 141{
150 struct task_struct *tsk = current; 142 struct task_struct *tsk = current;
151 unsigned long val, interval; 143 unsigned long val, interval, expires;
152 cputime_t cval, cinterval, nval, ninterval; 144 cputime_t cval, cinterval, nval, ninterval;
153 145
154 switch (which) { 146 switch (which) {
@@ -164,7 +156,10 @@ again:
164 } 156 }
165 tsk->signal->it_real_incr = 157 tsk->signal->it_real_incr =
166 timeval_to_jiffies(&value->it_interval); 158 timeval_to_jiffies(&value->it_interval);
167 it_real_arm(tsk, timeval_to_jiffies(&value->it_value)); 159 expires = timeval_to_jiffies(&value->it_value);
160 if (expires)
161 mod_timer(&tsk->signal->real_timer,
162 jiffies + 1 + expires);
168 spin_unlock_irq(&tsk->sighand->siglock); 163 spin_unlock_irq(&tsk->sighand->siglock);
169 if (ovalue) { 164 if (ovalue) {
170 jiffies_to_timeval(val, &ovalue->it_value); 165 jiffies_to_timeval(val, &ovalue->it_value);
diff --git a/kernel/module.c b/kernel/module.c
index 068e271ab3a5..c32995fbd8fd 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -250,13 +250,18 @@ static inline unsigned int block_size(int val)
250/* Created by linker magic */ 250/* Created by linker magic */
251extern char __per_cpu_start[], __per_cpu_end[]; 251extern char __per_cpu_start[], __per_cpu_end[];
252 252
253static void *percpu_modalloc(unsigned long size, unsigned long align) 253static void *percpu_modalloc(unsigned long size, unsigned long align,
254 const char *name)
254{ 255{
255 unsigned long extra; 256 unsigned long extra;
256 unsigned int i; 257 unsigned int i;
257 void *ptr; 258 void *ptr;
258 259
259 BUG_ON(align > SMP_CACHE_BYTES); 260 if (align > SMP_CACHE_BYTES) {
261 printk(KERN_WARNING "%s: per-cpu alignment %li > %i\n",
262 name, align, SMP_CACHE_BYTES);
263 align = SMP_CACHE_BYTES;
264 }
260 265
261 ptr = __per_cpu_start; 266 ptr = __per_cpu_start;
262 for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { 267 for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {
@@ -348,7 +353,8 @@ static int percpu_modinit(void)
348} 353}
349__initcall(percpu_modinit); 354__initcall(percpu_modinit);
350#else /* ... !CONFIG_SMP */ 355#else /* ... !CONFIG_SMP */
351static inline void *percpu_modalloc(unsigned long size, unsigned long align) 356static inline void *percpu_modalloc(unsigned long size, unsigned long align,
357 const char *name)
352{ 358{
353 return NULL; 359 return NULL;
354} 360}
@@ -1644,7 +1650,8 @@ static struct module *load_module(void __user *umod,
1644 if (pcpuindex) { 1650 if (pcpuindex) {
1645 /* We have a special allocation for this section. */ 1651 /* We have a special allocation for this section. */
1646 percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size, 1652 percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
1647 sechdrs[pcpuindex].sh_addralign); 1653 sechdrs[pcpuindex].sh_addralign,
1654 mod->name);
1648 if (!percpu) { 1655 if (!percpu) {
1649 err = -ENOMEM; 1656 err = -ENOMEM;
1650 goto free_mod; 1657 goto free_mod;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 5b7b4736d82b..38798a2ff994 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -896,21 +896,10 @@ static int adjust_abs_time(struct k_clock *clock, struct timespec *tp,
896 jiffies_64_f = get_jiffies_64(); 896 jiffies_64_f = get_jiffies_64();
897 } 897 }
898 /* 898 /*
899 * Take away now to get delta 899 * Take away now to get delta and normalize
900 */ 900 */
901 oc.tv_sec -= now.tv_sec; 901 set_normalized_timespec(&oc, oc.tv_sec - now.tv_sec,
902 oc.tv_nsec -= now.tv_nsec; 902 oc.tv_nsec - now.tv_nsec);
903 /*
904 * Normalize...
905 */
906 while ((oc.tv_nsec - NSEC_PER_SEC) >= 0) {
907 oc.tv_nsec -= NSEC_PER_SEC;
908 oc.tv_sec++;
909 }
910 while ((oc.tv_nsec) < 0) {
911 oc.tv_nsec += NSEC_PER_SEC;
912 oc.tv_sec--;
913 }
914 }else{ 903 }else{
915 jiffies_64_f = get_jiffies_64(); 904 jiffies_64_f = get_jiffies_64();
916 } 905 }
@@ -1177,7 +1166,6 @@ void exit_itimers(struct signal_struct *sig)
1177 tmr = list_entry(sig->posix_timers.next, struct k_itimer, list); 1166 tmr = list_entry(sig->posix_timers.next, struct k_itimer, list);
1178 itimer_delete(tmr); 1167 itimer_delete(tmr);
1179 } 1168 }
1180 del_timer_sync(&sig->real_timer);
1181} 1169}
1182 1170
1183/* 1171/*
diff --git a/kernel/power/smp.c b/kernel/power/smp.c
index bbe23079c62c..911fc62b8225 100644
--- a/kernel/power/smp.c
+++ b/kernel/power/smp.c
@@ -38,7 +38,7 @@ void disable_nonboot_cpus(void)
38 } 38 }
39 printk("Error taking cpu %d down: %d\n", cpu, error); 39 printk("Error taking cpu %d down: %d\n", cpu, error);
40 } 40 }
41 BUG_ON(smp_processor_id() != 0); 41 BUG_ON(raw_smp_processor_id() != 0);
42 if (error) 42 if (error)
43 panic("cpus not sleeping"); 43 panic("cpus not sleeping");
44} 44}
diff --git a/kernel/sys.c b/kernel/sys.c
index a74039036fb4..0bcaed6560ac 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -371,7 +371,6 @@ void kernel_restart(char *cmd)
371{ 371{
372 notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); 372 notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
373 system_state = SYSTEM_RESTART; 373 system_state = SYSTEM_RESTART;
374 device_suspend(PMSG_FREEZE);
375 device_shutdown(); 374 device_shutdown();
376 if (!cmd) { 375 if (!cmd) {
377 printk(KERN_EMERG "Restarting system.\n"); 376 printk(KERN_EMERG "Restarting system.\n");
@@ -393,7 +392,6 @@ void kernel_kexec(void)
393 } 392 }
394 notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); 393 notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
395 system_state = SYSTEM_RESTART; 394 system_state = SYSTEM_RESTART;
396 device_suspend(PMSG_FREEZE);
397 device_shutdown(); 395 device_shutdown();
398 printk(KERN_EMERG "Starting new kernel\n"); 396 printk(KERN_EMERG "Starting new kernel\n");
399 machine_shutdown(); 397 machine_shutdown();
@@ -406,7 +404,6 @@ void kernel_halt(void)
406{ 404{
407 notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); 405 notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
408 system_state = SYSTEM_HALT; 406 system_state = SYSTEM_HALT;
409 device_suspend(PMSG_SUSPEND);
410 device_shutdown(); 407 device_shutdown();
411 printk(KERN_EMERG "System halted.\n"); 408 printk(KERN_EMERG "System halted.\n");
412 machine_halt(); 409 machine_halt();
@@ -417,7 +414,6 @@ void kernel_power_off(void)
417{ 414{
418 notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); 415 notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
419 system_state = SYSTEM_POWER_OFF; 416 system_state = SYSTEM_POWER_OFF;
420 device_suspend(PMSG_SUSPEND);
421 device_shutdown(); 417 device_shutdown();
422 printk(KERN_EMERG "Power down.\n"); 418 printk(KERN_EMERG "Power down.\n");
423 machine_power_off(); 419 machine_power_off();
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 42b40ae5eada..1ab2370e2efa 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -79,7 +79,6 @@ cond_syscall(sys_request_key);
79cond_syscall(sys_keyctl); 79cond_syscall(sys_keyctl);
80cond_syscall(compat_sys_keyctl); 80cond_syscall(compat_sys_keyctl);
81cond_syscall(compat_sys_socketcall); 81cond_syscall(compat_sys_socketcall);
82cond_syscall(sys_set_zone_reclaim);
83cond_syscall(sys_inotify_init); 82cond_syscall(sys_inotify_init);
84cond_syscall(sys_inotify_add_watch); 83cond_syscall(sys_inotify_add_watch);
85cond_syscall(sys_inotify_rm_watch); 84cond_syscall(sys_inotify_rm_watch);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e60b9c36f1f0..3e0bbee549ea 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -114,6 +114,7 @@ extern int unaligned_enabled;
114extern int sysctl_ieee_emulation_warnings; 114extern int sysctl_ieee_emulation_warnings;
115#endif 115#endif
116extern int sysctl_userprocess_debug; 116extern int sysctl_userprocess_debug;
117extern int spin_retry;
117#endif 118#endif
118 119
119extern int sysctl_hz_timer; 120extern int sysctl_hz_timer;
@@ -647,7 +648,16 @@ static ctl_table kern_table[] = {
647 .mode = 0644, 648 .mode = 0644,
648 .proc_handler = &proc_dointvec, 649 .proc_handler = &proc_dointvec,
649 }, 650 },
650 651#if defined(CONFIG_ARCH_S390)
652 {
653 .ctl_name = KERN_SPIN_RETRY,
654 .procname = "spin_retry",
655 .data = &spin_retry,
656 .maxlen = sizeof (int),
657 .mode = 0644,
658 .proc_handler = &proc_dointvec,
659 },
660#endif
651 { .ctl_name = 0 } 661 { .ctl_name = 0 }
652}; 662};
653 663
diff --git a/kernel/time.c b/kernel/time.c
index d4335c1c884c..dd5ae1162a8f 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -128,7 +128,7 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __us
128 * as real UNIX machines always do it. This avoids all headaches about 128 * as real UNIX machines always do it. This avoids all headaches about
129 * daylight saving times and warping kernel clocks. 129 * daylight saving times and warping kernel clocks.
130 */ 130 */
131inline static void warp_clock(void) 131static inline void warp_clock(void)
132{ 132{
133 write_seqlock_irq(&xtime_lock); 133 write_seqlock_irq(&xtime_lock);
134 wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60; 134 wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 0c421295e613..299f7f3b5b08 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -141,7 +141,7 @@ config DEBUG_IOREMAP
141 141
142config DEBUG_FS 142config DEBUG_FS
143 bool "Debug Filesystem" 143 bool "Debug Filesystem"
144 depends on DEBUG_KERNEL 144 depends on DEBUG_KERNEL && SYSFS
145 help 145 help
146 debugfs is a virtual file system that kernel developers use to put 146 debugfs is a virtual file system that kernel developers use to put
147 debugging files into. Enable this option to be able to read and 147 debugging files into. Enable this option to be able to read and
diff --git a/lib/Makefile b/lib/Makefile
index beed1585294c..f28d9031303c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,11 +5,11 @@
5lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ 5lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
6 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ 6 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
8 sha1.o halfmd4.o 8 sha1.o
9 9
10lib-y += kobject.o kref.o kobject_uevent.o klist.o 10lib-y += kobject.o kref.o kobject_uevent.o klist.o
11 11
12obj-y += sort.o parser.o 12obj-y += sort.o parser.o halfmd4.o
13 13
14ifeq ($(CONFIG_DEBUG_KOBJECT),y) 14ifeq ($(CONFIG_DEBUG_KOBJECT),y)
15CFLAGS_kobject.o += -DDEBUG 15CFLAGS_kobject.o += -DDEBUG
diff --git a/lib/crc32.c b/lib/crc32.c
index 58b222783f9c..065198f98b3f 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -473,7 +473,7 @@ static u32 test_step(u32 init, unsigned char *buf, size_t len)
473 init = bitreverse(init); 473 init = bitreverse(init);
474 crc2 = bitreverse(crc1); 474 crc2 = bitreverse(crc1);
475 if (crc1 != bitreverse(crc2)) 475 if (crc1 != bitreverse(crc2))
476 printf("\nBit reversal fail: 0x%08x -> %0x08x -> 0x%08x\n", 476 printf("\nBit reversal fail: 0x%08x -> 0x%08x -> 0x%08x\n",
477 crc1, crc2, bitreverse(crc2)); 477 crc1, crc2, bitreverse(crc2));
478 crc1 = crc32_le(init, buf, len); 478 crc1 = crc32_le(init, buf, len);
479 if (crc1 != crc2) 479 if (crc1 != crc2)
diff --git a/lib/inflate.c b/lib/inflate.c
index 75e7d303c72e..6db6e98d1637 100644
--- a/lib/inflate.c
+++ b/lib/inflate.c
@@ -326,7 +326,7 @@ DEBG("huft1 ");
326 { 326 {
327 *t = (struct huft *)NULL; 327 *t = (struct huft *)NULL;
328 *m = 0; 328 *m = 0;
329 return 0; 329 return 2;
330 } 330 }
331 331
332DEBG("huft2 "); 332DEBG("huft2 ");
@@ -374,6 +374,7 @@ DEBG("huft5 ");
374 if ((j = *p++) != 0) 374 if ((j = *p++) != 0)
375 v[x[j]++] = i; 375 v[x[j]++] = i;
376 } while (++i < n); 376 } while (++i < n);
377 n = x[g]; /* set n to length of v */
377 378
378DEBG("h6 "); 379DEBG("h6 ");
379 380
@@ -410,12 +411,13 @@ DEBG1("1 ");
410DEBG1("2 "); 411DEBG1("2 ");
411 f -= a + 1; /* deduct codes from patterns left */ 412 f -= a + 1; /* deduct codes from patterns left */
412 xp = c + k; 413 xp = c + k;
413 while (++j < z) /* try smaller tables up to z bits */ 414 if (j < z)
414 { 415 while (++j < z) /* try smaller tables up to z bits */
415 if ((f <<= 1) <= *++xp) 416 {
416 break; /* enough codes to use up j bits */ 417 if ((f <<= 1) <= *++xp)
417 f -= *xp; /* else deduct codes from patterns */ 418 break; /* enough codes to use up j bits */
418 } 419 f -= *xp; /* else deduct codes from patterns */
420 }
419 } 421 }
420DEBG1("3 "); 422DEBG1("3 ");
421 z = 1 << j; /* table entries for j-bit table */ 423 z = 1 << j; /* table entries for j-bit table */
diff --git a/lib/zlib_inflate/inftrees.c b/lib/zlib_inflate/inftrees.c
index 874950ec4858..c5f66fbb0dd0 100644
--- a/lib/zlib_inflate/inftrees.c
+++ b/lib/zlib_inflate/inftrees.c
@@ -141,7 +141,7 @@ static int huft_build(
141 { 141 {
142 *t = NULL; 142 *t = NULL;
143 *m = 0; 143 *m = 0;
144 return Z_OK; 144 return Z_DATA_ERROR;
145 } 145 }
146 146
147 147
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index fbd1111ea119..6bf720bc662c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -301,6 +301,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
301{ 301{
302 struct mm_struct *mm = vma->vm_mm; 302 struct mm_struct *mm = vma->vm_mm;
303 unsigned long address; 303 unsigned long address;
304 pte_t *ptep;
304 pte_t pte; 305 pte_t pte;
305 struct page *page; 306 struct page *page;
306 307
@@ -309,9 +310,17 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
309 BUG_ON(end & ~HPAGE_MASK); 310 BUG_ON(end & ~HPAGE_MASK);
310 311
311 for (address = start; address < end; address += HPAGE_SIZE) { 312 for (address = start; address < end; address += HPAGE_SIZE) {
312 pte = huge_ptep_get_and_clear(mm, address, huge_pte_offset(mm, address)); 313 ptep = huge_pte_offset(mm, address);
314 if (! ptep)
315 /* This can happen on truncate, or if an
316 * mmap() is aborted due to an error before
317 * the prefault */
318 continue;
319
320 pte = huge_ptep_get_and_clear(mm, address, ptep);
313 if (pte_none(pte)) 321 if (pte_none(pte))
314 continue; 322 continue;
323
315 page = pte_page(pte); 324 page = pte_page(pte);
316 put_page(page); 325 put_page(page);
317 } 326 }
diff --git a/mm/madvise.c b/mm/madvise.c
index 73180a22877e..c8c01a12fea4 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -83,9 +83,6 @@ static long madvise_willneed(struct vm_area_struct * vma,
83{ 83{
84 struct file *file = vma->vm_file; 84 struct file *file = vma->vm_file;
85 85
86 if (!file)
87 return -EBADF;
88
89 if (file->f_mapping->a_ops->get_xip_page) { 86 if (file->f_mapping->a_ops->get_xip_page) {
90 /* no bad return value, but ignore advice */ 87 /* no bad return value, but ignore advice */
91 return 0; 88 return 0;
@@ -140,11 +137,16 @@ static long madvise_dontneed(struct vm_area_struct * vma,
140 return 0; 137 return 0;
141} 138}
142 139
143static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, 140static long
144 unsigned long start, unsigned long end, int behavior) 141madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
142 unsigned long start, unsigned long end, int behavior)
145{ 143{
144 struct file *filp = vma->vm_file;
146 long error = -EBADF; 145 long error = -EBADF;
147 146
147 if (!filp)
148 goto out;
149
148 switch (behavior) { 150 switch (behavior) {
149 case MADV_NORMAL: 151 case MADV_NORMAL:
150 case MADV_SEQUENTIAL: 152 case MADV_SEQUENTIAL:
@@ -165,6 +167,7 @@ static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev
165 break; 167 break;
166 } 168 }
167 169
170out:
168 return error; 171 return error;
169} 172}
170 173
diff --git a/mm/memory.c b/mm/memory.c
index beabdefa6254..e046b7e4b530 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -776,8 +776,8 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
776 * Do a quick page-table lookup for a single page. 776 * Do a quick page-table lookup for a single page.
777 * mm->page_table_lock must be held. 777 * mm->page_table_lock must be held.
778 */ 778 */
779static struct page * 779static struct page *__follow_page(struct mm_struct *mm, unsigned long address,
780__follow_page(struct mm_struct *mm, unsigned long address, int read, int write) 780 int read, int write, int accessed)
781{ 781{
782 pgd_t *pgd; 782 pgd_t *pgd;
783 pud_t *pud; 783 pud_t *pud;
@@ -818,9 +818,11 @@ __follow_page(struct mm_struct *mm, unsigned long address, int read, int write)
818 pfn = pte_pfn(pte); 818 pfn = pte_pfn(pte);
819 if (pfn_valid(pfn)) { 819 if (pfn_valid(pfn)) {
820 page = pfn_to_page(pfn); 820 page = pfn_to_page(pfn);
821 if (write && !pte_dirty(pte) && !PageDirty(page)) 821 if (accessed) {
822 set_page_dirty(page); 822 if (write && !pte_dirty(pte) &&!PageDirty(page))
823 mark_page_accessed(page); 823 set_page_dirty(page);
824 mark_page_accessed(page);
825 }
824 return page; 826 return page;
825 } 827 }
826 } 828 }
@@ -829,16 +831,19 @@ out:
829 return NULL; 831 return NULL;
830} 832}
831 833
832struct page * 834inline struct page *
833follow_page(struct mm_struct *mm, unsigned long address, int write) 835follow_page(struct mm_struct *mm, unsigned long address, int write)
834{ 836{
835 return __follow_page(mm, address, /*read*/0, write); 837 return __follow_page(mm, address, 0, write, 1);
836} 838}
837 839
838int 840/*
839check_user_page_readable(struct mm_struct *mm, unsigned long address) 841 * check_user_page_readable() can be called frm niterrupt context by oprofile,
842 * so we need to avoid taking any non-irq-safe locks
843 */
844int check_user_page_readable(struct mm_struct *mm, unsigned long address)
840{ 845{
841 return __follow_page(mm, address, /*read*/1, /*write*/0) != NULL; 846 return __follow_page(mm, address, 1, 0, 0) != NULL;
842} 847}
843EXPORT_SYMBOL(check_user_page_readable); 848EXPORT_SYMBOL(check_user_page_readable);
844 849
@@ -908,9 +913,13 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
908 pud = pud_offset(pgd, pg); 913 pud = pud_offset(pgd, pg);
909 BUG_ON(pud_none(*pud)); 914 BUG_ON(pud_none(*pud));
910 pmd = pmd_offset(pud, pg); 915 pmd = pmd_offset(pud, pg);
911 BUG_ON(pmd_none(*pmd)); 916 if (pmd_none(*pmd))
917 return i ? : -EFAULT;
912 pte = pte_offset_map(pmd, pg); 918 pte = pte_offset_map(pmd, pg);
913 BUG_ON(pte_none(*pte)); 919 if (pte_none(*pte)) {
920 pte_unmap(pte);
921 return i ? : -EFAULT;
922 }
914 if (pages) { 923 if (pages) {
915 pages[i] = pte_page(*pte); 924 pages[i] = pte_page(*pte);
916 get_page(pages[i]); 925 get_page(pages[i]);
@@ -935,11 +944,13 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
935 } 944 }
936 spin_lock(&mm->page_table_lock); 945 spin_lock(&mm->page_table_lock);
937 do { 946 do {
947 int write_access = write;
938 struct page *page; 948 struct page *page;
939 int lookup_write = write;
940 949
941 cond_resched_lock(&mm->page_table_lock); 950 cond_resched_lock(&mm->page_table_lock);
942 while (!(page = follow_page(mm, start, lookup_write))) { 951 while (!(page = follow_page(mm, start, write_access))) {
952 int ret;
953
943 /* 954 /*
944 * Shortcut for anonymous pages. We don't want 955 * Shortcut for anonymous pages. We don't want
945 * to force the creation of pages tables for 956 * to force the creation of pages tables for
@@ -947,13 +958,23 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
947 * nobody touched so far. This is important 958 * nobody touched so far. This is important
948 * for doing a core dump for these mappings. 959 * for doing a core dump for these mappings.
949 */ 960 */
950 if (!lookup_write && 961 if (!write && untouched_anonymous_page(mm,vma,start)) {
951 untouched_anonymous_page(mm,vma,start)) {
952 page = ZERO_PAGE(start); 962 page = ZERO_PAGE(start);
953 break; 963 break;
954 } 964 }
955 spin_unlock(&mm->page_table_lock); 965 spin_unlock(&mm->page_table_lock);
956 switch (handle_mm_fault(mm,vma,start,write)) { 966 ret = __handle_mm_fault(mm, vma, start, write_access);
967
968 /*
969 * The VM_FAULT_WRITE bit tells us that do_wp_page has
970 * broken COW when necessary, even if maybe_mkwrite
971 * decided not to set pte_write. We can thus safely do
972 * subsequent page lookups as if they were reads.
973 */
974 if (ret & VM_FAULT_WRITE)
975 write_access = 0;
976
977 switch (ret & ~VM_FAULT_WRITE) {
957 case VM_FAULT_MINOR: 978 case VM_FAULT_MINOR:
958 tsk->min_flt++; 979 tsk->min_flt++;
959 break; 980 break;
@@ -967,14 +988,6 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
967 default: 988 default:
968 BUG(); 989 BUG();
969 } 990 }
970 /*
971 * Now that we have performed a write fault
972 * and surely no longer have a shared page we
973 * shouldn't write, we shouldn't ignore an
974 * unwritable page in the page table if
975 * we are forcing write access.
976 */
977 lookup_write = write && !force;
978 spin_lock(&mm->page_table_lock); 991 spin_lock(&mm->page_table_lock);
979 } 992 }
980 if (pages) { 993 if (pages) {
@@ -1224,6 +1237,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1224 struct page *old_page, *new_page; 1237 struct page *old_page, *new_page;
1225 unsigned long pfn = pte_pfn(pte); 1238 unsigned long pfn = pte_pfn(pte);
1226 pte_t entry; 1239 pte_t entry;
1240 int ret;
1227 1241
1228 if (unlikely(!pfn_valid(pfn))) { 1242 if (unlikely(!pfn_valid(pfn))) {
1229 /* 1243 /*
@@ -1251,7 +1265,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1251 lazy_mmu_prot_update(entry); 1265 lazy_mmu_prot_update(entry);
1252 pte_unmap(page_table); 1266 pte_unmap(page_table);
1253 spin_unlock(&mm->page_table_lock); 1267 spin_unlock(&mm->page_table_lock);
1254 return VM_FAULT_MINOR; 1268 return VM_FAULT_MINOR|VM_FAULT_WRITE;
1255 } 1269 }
1256 } 1270 }
1257 pte_unmap(page_table); 1271 pte_unmap(page_table);
@@ -1278,6 +1292,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1278 /* 1292 /*
1279 * Re-check the pte - we dropped the lock 1293 * Re-check the pte - we dropped the lock
1280 */ 1294 */
1295 ret = VM_FAULT_MINOR;
1281 spin_lock(&mm->page_table_lock); 1296 spin_lock(&mm->page_table_lock);
1282 page_table = pte_offset_map(pmd, address); 1297 page_table = pte_offset_map(pmd, address);
1283 if (likely(pte_same(*page_table, pte))) { 1298 if (likely(pte_same(*page_table, pte))) {
@@ -1294,12 +1309,13 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1294 1309
1295 /* Free the old page.. */ 1310 /* Free the old page.. */
1296 new_page = old_page; 1311 new_page = old_page;
1312 ret |= VM_FAULT_WRITE;
1297 } 1313 }
1298 pte_unmap(page_table); 1314 pte_unmap(page_table);
1299 page_cache_release(new_page); 1315 page_cache_release(new_page);
1300 page_cache_release(old_page); 1316 page_cache_release(old_page);
1301 spin_unlock(&mm->page_table_lock); 1317 spin_unlock(&mm->page_table_lock);
1302 return VM_FAULT_MINOR; 1318 return ret;
1303 1319
1304no_new_page: 1320no_new_page:
1305 page_cache_release(old_page); 1321 page_cache_release(old_page);
@@ -1991,7 +2007,6 @@ static inline int handle_pte_fault(struct mm_struct *mm,
1991 if (write_access) { 2007 if (write_access) {
1992 if (!pte_write(entry)) 2008 if (!pte_write(entry))
1993 return do_wp_page(mm, vma, address, pte, pmd, entry); 2009 return do_wp_page(mm, vma, address, pte, pmd, entry);
1994
1995 entry = pte_mkdirty(entry); 2010 entry = pte_mkdirty(entry);
1996 } 2011 }
1997 entry = pte_mkyoung(entry); 2012 entry = pte_mkyoung(entry);
@@ -2006,7 +2021,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
2006/* 2021/*
2007 * By the time we get here, we already hold the mm semaphore 2022 * By the time we get here, we already hold the mm semaphore
2008 */ 2023 */
2009int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma, 2024int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma,
2010 unsigned long address, int write_access) 2025 unsigned long address, int write_access)
2011{ 2026{
2012 pgd_t *pgd; 2027 pgd_t *pgd;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index cb41c31e7c87..b4eababc8198 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -443,7 +443,7 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
443 struct mempolicy *new; 443 struct mempolicy *new;
444 DECLARE_BITMAP(nodes, MAX_NUMNODES); 444 DECLARE_BITMAP(nodes, MAX_NUMNODES);
445 445
446 if (mode > MPOL_MAX) 446 if (mode < 0 || mode > MPOL_MAX)
447 return -EINVAL; 447 return -EINVAL;
448 err = get_nodes(nodes, nmask, maxnode, mode); 448 err = get_nodes(nodes, nmask, maxnode, mode);
449 if (err) 449 if (err)
@@ -1138,11 +1138,11 @@ void mpol_free_shared_policy(struct shared_policy *p)
1138 while (next) { 1138 while (next) {
1139 n = rb_entry(next, struct sp_node, nd); 1139 n = rb_entry(next, struct sp_node, nd);
1140 next = rb_next(&n->nd); 1140 next = rb_next(&n->nd);
1141 rb_erase(&n->nd, &p->root);
1141 mpol_free(n->policy); 1142 mpol_free(n->policy);
1142 kmem_cache_free(sn_cache, n); 1143 kmem_cache_free(sn_cache, n);
1143 } 1144 }
1144 spin_unlock(&p->lock); 1145 spin_unlock(&p->lock);
1145 p->root = RB_ROOT;
1146} 1146}
1147 1147
1148/* assumes fs == KERNEL_DS */ 1148/* assumes fs == KERNEL_DS */
diff --git a/mm/mmap.c b/mm/mmap.c
index da3fa90a0aae..404319477e71 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -143,7 +143,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
143 leave 3% of the size of this process for other processes */ 143 leave 3% of the size of this process for other processes */
144 allowed -= current->mm->total_vm / 32; 144 allowed -= current->mm->total_vm / 32;
145 145
146 if (atomic_read(&vm_committed_space) < allowed) 146 /*
147 * cast `allowed' as a signed long because vm_committed_space
148 * sometimes has a negative value
149 */
150 if (atomic_read(&vm_committed_space) < (long)allowed)
147 return 0; 151 return 0;
148 152
149 vm_unacct_memory(pages); 153 vm_unacct_memory(pages);
diff --git a/mm/mremap.c b/mm/mremap.c
index ec7238a78f36..fc45dc9a617b 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -229,6 +229,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
229 * since do_munmap() will decrement it by old_len == new_len 229 * since do_munmap() will decrement it by old_len == new_len
230 */ 230 */
231 mm->total_vm += new_len >> PAGE_SHIFT; 231 mm->total_vm += new_len >> PAGE_SHIFT;
232 __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
232 233
233 if (do_munmap(mm, old_addr, old_len) < 0) { 234 if (do_munmap(mm, old_addr, old_len) < 0) {
234 /* OOM: unable to split vma, just get accounts right */ 235 /* OOM: unable to split vma, just get accounts right */
@@ -243,7 +244,6 @@ static unsigned long move_vma(struct vm_area_struct *vma,
243 vma->vm_next->vm_flags |= VM_ACCOUNT; 244 vma->vm_next->vm_flags |= VM_ACCOUNT;
244 } 245 }
245 246
246 __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
247 if (vm_flags & VM_LOCKED) { 247 if (vm_flags & VM_LOCKED) {
248 mm->locked_vm += new_len >> PAGE_SHIFT; 248 mm->locked_vm += new_len >> PAGE_SHIFT;
249 if (new_len > old_len) 249 if (new_len > old_len)
diff --git a/mm/nommu.c b/mm/nommu.c
index ce74452c02d9..fd4e8df0f02d 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1167,7 +1167,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
1167 leave 3% of the size of this process for other processes */ 1167 leave 3% of the size of this process for other processes */
1168 allowed -= current->mm->total_vm / 32; 1168 allowed -= current->mm->total_vm / 32;
1169 1169
1170 if (atomic_read(&vm_committed_space) < allowed) 1170 /*
1171 * cast `allowed' as a signed long because vm_committed_space
1172 * sometimes has a negative value
1173 */
1174 if (atomic_read(&vm_committed_space) < (long)allowed)
1171 return 0; 1175 return 0;
1172 1176
1173 vm_unacct_memory(pages); 1177 vm_unacct_memory(pages);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1d6ba6a4b594..8d088371196a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1061,20 +1061,19 @@ unsigned int nr_free_pages_pgdat(pg_data_t *pgdat)
1061 1061
1062static unsigned int nr_free_zone_pages(int offset) 1062static unsigned int nr_free_zone_pages(int offset)
1063{ 1063{
1064 pg_data_t *pgdat; 1064 /* Just pick one node, since fallback list is circular */
1065 pg_data_t *pgdat = NODE_DATA(numa_node_id());
1065 unsigned int sum = 0; 1066 unsigned int sum = 0;
1066 1067
1067 for_each_pgdat(pgdat) { 1068 struct zonelist *zonelist = pgdat->node_zonelists + offset;
1068 struct zonelist *zonelist = pgdat->node_zonelists + offset; 1069 struct zone **zonep = zonelist->zones;
1069 struct zone **zonep = zonelist->zones; 1070 struct zone *zone;
1070 struct zone *zone;
1071 1071
1072 for (zone = *zonep++; zone; zone = *zonep++) { 1072 for (zone = *zonep++; zone; zone = *zonep++) {
1073 unsigned long size = zone->present_pages; 1073 unsigned long size = zone->present_pages;
1074 unsigned long high = zone->pages_high; 1074 unsigned long high = zone->pages_high;
1075 if (size > high) 1075 if (size > high)
1076 sum += size - high; 1076 sum += size - high;
1077 }
1078 } 1077 }
1079 1078
1080 return sum; 1079 return sum;
@@ -1861,7 +1860,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
1861 unsigned long *zones_size, unsigned long *zholes_size) 1860 unsigned long *zones_size, unsigned long *zholes_size)
1862{ 1861{
1863 unsigned long i, j; 1862 unsigned long i, j;
1864 const unsigned long zone_required_alignment = 1UL << (MAX_ORDER-1);
1865 int cpu, nid = pgdat->node_id; 1863 int cpu, nid = pgdat->node_id;
1866 unsigned long zone_start_pfn = pgdat->node_start_pfn; 1864 unsigned long zone_start_pfn = pgdat->node_start_pfn;
1867 1865
@@ -1934,9 +1932,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
1934 zone->zone_mem_map = pfn_to_page(zone_start_pfn); 1932 zone->zone_mem_map = pfn_to_page(zone_start_pfn);
1935 zone->zone_start_pfn = zone_start_pfn; 1933 zone->zone_start_pfn = zone_start_pfn;
1936 1934
1937 if ((zone_start_pfn) & (zone_required_alignment-1))
1938 printk(KERN_CRIT "BUG: wrong zone alignment, it will crash\n");
1939
1940 memmap_init(size, nid, j, zone_start_pfn); 1935 memmap_init(size, nid, j, zone_start_pfn);
1941 1936
1942 zonetable_add(zone, nid, j, zone_start_pfn, size); 1937 zonetable_add(zone, nid, j, zone_start_pfn, size);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fb5524365bc2..ffa26c10bfe8 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -299,7 +299,6 @@ struct hci_dev *hci_dev_get(int index)
299 read_unlock(&hci_dev_list_lock); 299 read_unlock(&hci_dev_list_lock);
300 return hdev; 300 return hdev;
301} 301}
302EXPORT_SYMBOL(hci_dev_get);
303 302
304/* ---- Inquiry support ---- */ 303/* ---- Inquiry support ---- */
305static void inquiry_cache_flush(struct hci_dev *hdev) 304static void inquiry_cache_flush(struct hci_dev *hdev)
@@ -1042,7 +1041,6 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p
1042 1041
1043 return 0; 1042 return 0;
1044} 1043}
1045EXPORT_SYMBOL(hci_send_cmd);
1046 1044
1047/* Get data from the previously sent command */ 1045/* Get data from the previously sent command */
1048void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf) 1046void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index c4b592b4ef10..46367bd129c3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1035,9 +1035,11 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
1035 ev->type = type; 1035 ev->type = type;
1036 memcpy(ev->data, data, dlen); 1036 memcpy(ev->data, data, dlen);
1037 1037
1038 bt_cb(skb)->incoming = 1;
1039 do_gettimeofday(&skb->stamp);
1040
1038 skb->pkt_type = HCI_EVENT_PKT; 1041 skb->pkt_type = HCI_EVENT_PKT;
1039 skb->dev = (void *) hdev; 1042 skb->dev = (void *) hdev;
1040 hci_send_to_sock(hdev, skb); 1043 hci_send_to_sock(hdev, skb);
1041 kfree_skb(skb); 1044 kfree_skb(skb);
1042} 1045}
1043EXPORT_SYMBOL(hci_si_event);
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c
index 9efb0a093612..ee6a66979913 100644
--- a/net/bluetooth/lib.c
+++ b/net/bluetooth/lib.c
@@ -34,31 +34,6 @@
34 34
35#include <net/bluetooth/bluetooth.h> 35#include <net/bluetooth/bluetooth.h>
36 36
37void bt_dump(char *pref, __u8 *buf, int count)
38{
39 char *ptr;
40 char line[100];
41 unsigned int i;
42
43 printk(KERN_INFO "%s: dump, len %d\n", pref, count);
44
45 ptr = line;
46 *ptr = 0;
47 for (i = 0; i < count; i++) {
48 ptr += sprintf(ptr, " %2.2X", buf[i]);
49
50 if (i && !((i + 1) % 20)) {
51 printk(KERN_INFO "%s:%s\n", pref, line);
52 ptr = line;
53 *ptr = 0;
54 }
55 }
56
57 if (line[0])
58 printk(KERN_INFO "%s:%s\n", pref, line);
59}
60EXPORT_SYMBOL(bt_dump);
61
62void baswap(bdaddr_t *dst, bdaddr_t *src) 37void baswap(bdaddr_t *dst, bdaddr_t *src)
63{ 38{
64 unsigned char *d = (unsigned char *) dst; 39 unsigned char *d = (unsigned char *) dst;
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index e9e6fda66f1a..27bf5047cd33 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -389,8 +389,6 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
389 rfcomm_dlc_unlock(d); 389 rfcomm_dlc_unlock(d);
390 390
391 skb_queue_purge(&d->tx_queue); 391 skb_queue_purge(&d->tx_queue);
392 rfcomm_session_put(s);
393
394 rfcomm_dlc_unlink(d); 392 rfcomm_dlc_unlink(d);
395 } 393 }
396 394
@@ -600,8 +598,6 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
600 goto failed; 598 goto failed;
601 } 599 }
602 600
603 rfcomm_session_hold(s);
604
605 s->initiator = 1; 601 s->initiator = 1;
606 602
607 bacpy(&addr.l2_bdaddr, dst); 603 bacpy(&addr.l2_bdaddr, dst);
diff --git a/net/core/dev.c b/net/core/dev.c
index ff9dc029233a..52a3bf7ae177 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -901,8 +901,7 @@ int dev_close(struct net_device *dev)
901 smp_mb__after_clear_bit(); /* Commit netif_running(). */ 901 smp_mb__after_clear_bit(); /* Commit netif_running(). */
902 while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) { 902 while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
903 /* No hurry. */ 903 /* No hurry. */
904 current->state = TASK_INTERRUPTIBLE; 904 msleep(1);
905 schedule_timeout(1);
906 } 905 }
907 906
908 /* 907 /*
diff --git a/net/core/dst.c b/net/core/dst.c
index fc434ade5270..334790da9f16 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -45,6 +45,7 @@ static struct timer_list dst_gc_timer =
45static void dst_run_gc(unsigned long dummy) 45static void dst_run_gc(unsigned long dummy)
46{ 46{
47 int delayed = 0; 47 int delayed = 0;
48 int work_performed;
48 struct dst_entry * dst, **dstp; 49 struct dst_entry * dst, **dstp;
49 50
50 if (!spin_trylock(&dst_lock)) { 51 if (!spin_trylock(&dst_lock)) {
@@ -52,9 +53,9 @@ static void dst_run_gc(unsigned long dummy)
52 return; 53 return;
53 } 54 }
54 55
55
56 del_timer(&dst_gc_timer); 56 del_timer(&dst_gc_timer);
57 dstp = &dst_garbage_list; 57 dstp = &dst_garbage_list;
58 work_performed = 0;
58 while ((dst = *dstp) != NULL) { 59 while ((dst = *dstp) != NULL) {
59 if (atomic_read(&dst->__refcnt)) { 60 if (atomic_read(&dst->__refcnt)) {
60 dstp = &dst->next; 61 dstp = &dst->next;
@@ -62,6 +63,7 @@ static void dst_run_gc(unsigned long dummy)
62 continue; 63 continue;
63 } 64 }
64 *dstp = dst->next; 65 *dstp = dst->next;
66 work_performed = 1;
65 67
66 dst = dst_destroy(dst); 68 dst = dst_destroy(dst);
67 if (dst) { 69 if (dst) {
@@ -86,9 +88,14 @@ static void dst_run_gc(unsigned long dummy)
86 dst_gc_timer_inc = DST_GC_MAX; 88 dst_gc_timer_inc = DST_GC_MAX;
87 goto out; 89 goto out;
88 } 90 }
89 if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX) 91 if (!work_performed) {
90 dst_gc_timer_expires = DST_GC_MAX; 92 if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX)
91 dst_gc_timer_inc += DST_GC_INC; 93 dst_gc_timer_expires = DST_GC_MAX;
94 dst_gc_timer_inc += DST_GC_INC;
95 } else {
96 dst_gc_timer_inc = DST_GC_INC;
97 dst_gc_timer_expires = DST_GC_MIN;
98 }
92 dst_gc_timer.expires = jiffies + dst_gc_timer_expires; 99 dst_gc_timer.expires = jiffies + dst_gc_timer_expires;
93#if RT_CACHE_DEBUG >= 2 100#if RT_CACHE_DEBUG >= 2
94 printk("dst_total: %d/%d %ld\n", 101 printk("dst_total: %d/%d %ld\n",
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 975d651312dc..8eb083b6041a 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -363,7 +363,7 @@ struct pktgen_thread {
363 * All Rights Reserved. 363 * All Rights Reserved.
364 * 364 *
365 */ 365 */
366inline static s64 divremdi3(s64 x, s64 y, int type) 366static inline s64 divremdi3(s64 x, s64 y, int type)
367{ 367{
368 u64 a = (x < 0) ? -x : x; 368 u64 a = (x < 0) ? -x : x;
369 u64 b = (y < 0) ? -y : y; 369 u64 b = (y < 0) ? -y : y;
diff --git a/net/core/sock.c b/net/core/sock.c
index 8b35ccdc2b3b..12f6d9a2a522 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -206,13 +206,14 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
206 */ 206 */
207 207
208#ifdef SO_DONTLINGER /* Compatibility item... */ 208#ifdef SO_DONTLINGER /* Compatibility item... */
209 switch (optname) { 209 if (optname == SO_DONTLINGER) {
210 case SO_DONTLINGER: 210 lock_sock(sk);
211 sock_reset_flag(sk, SOCK_LINGER); 211 sock_reset_flag(sk, SOCK_LINGER);
212 return 0; 212 release_sock(sk);
213 return 0;
213 } 214 }
214#endif 215#endif
215 216
216 if(optlen<sizeof(int)) 217 if(optlen<sizeof(int))
217 return(-EINVAL); 218 return(-EINVAL);
218 219
diff --git a/net/core/utils.c b/net/core/utils.c
index e11a8654f363..88eb8b68e26b 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -23,10 +23,10 @@
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/init.h> 24#include <linux/init.h>
25 25
26#include <asm/byteorder.h>
26#include <asm/system.h> 27#include <asm/system.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28 29
29
30/* 30/*
31 This is a maximally equidistributed combined Tausworthe generator 31 This is a maximally equidistributed combined Tausworthe generator
32 based on code from GNU Scientific Library 1.5 (30 Jun 2004) 32 based on code from GNU Scientific Library 1.5 (30 Jun 2004)
@@ -153,3 +153,38 @@ int net_ratelimit(void)
153EXPORT_SYMBOL(net_random); 153EXPORT_SYMBOL(net_random);
154EXPORT_SYMBOL(net_ratelimit); 154EXPORT_SYMBOL(net_ratelimit);
155EXPORT_SYMBOL(net_srandom); 155EXPORT_SYMBOL(net_srandom);
156
157/*
158 * Convert an ASCII string to binary IP.
159 * This is outside of net/ipv4/ because various code that uses IP addresses
160 * is otherwise not dependent on the TCP/IP stack.
161 */
162
163__u32 in_aton(const char *str)
164{
165 unsigned long l;
166 unsigned int val;
167 int i;
168
169 l = 0;
170 for (i = 0; i < 4; i++)
171 {
172 l <<= 8;
173 if (*str != '\0')
174 {
175 val = 0;
176 while (*str != '\0' && *str != '.')
177 {
178 val *= 10;
179 val += *str - '0';
180 str++;
181 }
182 l |= val;
183 if (*str != '\0')
184 str++;
185 }
186 }
187 return(htonl(l));
188}
189
190EXPORT_SYMBOL(in_aton);
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index fc561c0ae8e2..0b3d9f1d8069 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -124,7 +124,7 @@ config IP_ROUTE_MULTIPATH
124 124
125config IP_ROUTE_MULTIPATH_CACHED 125config IP_ROUTE_MULTIPATH_CACHED
126 bool "IP: equal cost multipath with caching support (EXPERIMENTAL)" 126 bool "IP: equal cost multipath with caching support (EXPERIMENTAL)"
127 depends on: IP_ROUTE_MULTIPATH 127 depends on IP_ROUTE_MULTIPATH
128 help 128 help
129 Normally, equal cost multipath routing is not supported by the 129 Normally, equal cost multipath routing is not supported by the
130 routing cache. If you say Y here, alternative routes are cached 130 routing cache. If you say Y here, alternative routes are cached
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 5718cdb3a61e..55dc6cca1e7b 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Linux TCP/IP (INET) layer. 2# Makefile for the Linux TCP/IP (INET) layer.
3# 3#
4 4
5obj-y := utils.o route.o inetpeer.o protocol.o \ 5obj-y := route.o inetpeer.o protocol.o \
6 ip_input.o ip_fragment.o ip_forward.o ip_options.o \ 6 ip_input.o ip_fragment.o ip_forward.o ip_options.o \
7 ip_output.o ip_sockglue.o \ 7 ip_output.o ip_sockglue.o \
8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \ 8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c886b28ba9f5..e278cb9d0075 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -593,10 +593,13 @@ static void fib_hash_move(struct hlist_head *new_info_hash,
593 struct hlist_head *new_laddrhash, 593 struct hlist_head *new_laddrhash,
594 unsigned int new_size) 594 unsigned int new_size)
595{ 595{
596 struct hlist_head *old_info_hash, *old_laddrhash;
596 unsigned int old_size = fib_hash_size; 597 unsigned int old_size = fib_hash_size;
597 unsigned int i; 598 unsigned int i, bytes;
598 599
599 write_lock(&fib_info_lock); 600 write_lock(&fib_info_lock);
601 old_info_hash = fib_info_hash;
602 old_laddrhash = fib_info_laddrhash;
600 fib_hash_size = new_size; 603 fib_hash_size = new_size;
601 604
602 for (i = 0; i < old_size; i++) { 605 for (i = 0; i < old_size; i++) {
@@ -636,6 +639,10 @@ static void fib_hash_move(struct hlist_head *new_info_hash,
636 fib_info_laddrhash = new_laddrhash; 639 fib_info_laddrhash = new_laddrhash;
637 640
638 write_unlock(&fib_info_lock); 641 write_unlock(&fib_info_lock);
642
643 bytes = old_size * sizeof(struct hlist_head *);
644 fib_hash_free(old_info_hash, bytes);
645 fib_hash_free(old_laddrhash, bytes);
639} 646}
640 647
641struct fib_info * 648struct fib_info *
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 279f57abfecb..3d78464f64ea 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -936,8 +936,7 @@ int icmp_rcv(struct sk_buff *skb)
936 case CHECKSUM_HW: 936 case CHECKSUM_HW:
937 if (!(u16)csum_fold(skb->csum)) 937 if (!(u16)csum_fold(skb->csum))
938 break; 938 break;
939 NETDEBUG(if (net_ratelimit()) 939 LIMIT_NETDEBUG(printk(KERN_DEBUG "icmp v4 hw csum failure\n"));
940 printk(KERN_DEBUG "icmp v4 hw csum failure\n"));
941 case CHECKSUM_NONE: 940 case CHECKSUM_NONE:
942 if ((u16)csum_fold(skb_checksum(skb, 0, skb->len, 0))) 941 if ((u16)csum_fold(skb_checksum(skb, 0, skb->len, 0)))
943 goto error; 942 goto error;
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 7f68e27eb4ea..eb377ae15305 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -377,7 +377,7 @@ static struct ipq *ip_frag_create(unsigned hash, struct iphdr *iph, u32 user)
377 return ip_frag_intern(hash, qp); 377 return ip_frag_intern(hash, qp);
378 378
379out_nomem: 379out_nomem:
380 NETDEBUG(if (net_ratelimit()) printk(KERN_ERR "ip_frag_create: no memory left !\n")); 380 LIMIT_NETDEBUG(printk(KERN_ERR "ip_frag_create: no memory left !\n"));
381 return NULL; 381 return NULL;
382} 382}
383 383
@@ -625,10 +625,8 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
625 return head; 625 return head;
626 626
627out_nomem: 627out_nomem:
628 NETDEBUG(if (net_ratelimit()) 628 LIMIT_NETDEBUG(printk(KERN_ERR "IP: queue_glue: no memory for gluing "
629 printk(KERN_ERR 629 "queue %p\n", qp));
630 "IP: queue_glue: no memory for gluing queue %p\n",
631 qp));
632 goto out_fail; 630 goto out_fail;
633out_oversize: 631out_oversize:
634 if (net_ratelimit()) 632 if (net_ratelimit())
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 884835522224..f0d5740d7e22 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -290,7 +290,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
290 290
291 dev_hold(dev); 291 dev_hold(dev);
292 ipgre_tunnel_link(nt); 292 ipgre_tunnel_link(nt);
293 /* Do not decrement MOD_USE_COUNT here. */
294 return nt; 293 return nt;
295 294
296failed: 295failed:
@@ -1277,12 +1276,28 @@ err1:
1277 goto out; 1276 goto out;
1278} 1277}
1279 1278
1280static void ipgre_fini(void) 1279static void __exit ipgre_destroy_tunnels(void)
1280{
1281 int prio;
1282
1283 for (prio = 0; prio < 4; prio++) {
1284 int h;
1285 for (h = 0; h < HASH_SIZE; h++) {
1286 struct ip_tunnel *t;
1287 while ((t = tunnels[prio][h]) != NULL)
1288 unregister_netdevice(t->dev);
1289 }
1290 }
1291}
1292
1293static void __exit ipgre_fini(void)
1281{ 1294{
1282 if (inet_del_protocol(&ipgre_protocol, IPPROTO_GRE) < 0) 1295 if (inet_del_protocol(&ipgre_protocol, IPPROTO_GRE) < 0)
1283 printk(KERN_INFO "ipgre close: can't remove protocol\n"); 1296 printk(KERN_INFO "ipgre close: can't remove protocol\n");
1284 1297
1285 unregister_netdev(ipgre_fb_tunnel_dev); 1298 rtnl_lock();
1299 ipgre_destroy_tunnels();
1300 rtnl_unlock();
1286} 1301}
1287 1302
1288module_init(ipgre_init); 1303module_init(ipgre_init);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index fc7c481d0d79..ff4bd067b397 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -848,6 +848,9 @@ mc_msf_out:
848 848
849 case IP_IPSEC_POLICY: 849 case IP_IPSEC_POLICY:
850 case IP_XFRM_POLICY: 850 case IP_XFRM_POLICY:
851 err = -EPERM;
852 if (!capable(CAP_NET_ADMIN))
853 break;
851 err = xfrm_user_policy(sk, optname, optval, optlen); 854 err = xfrm_user_policy(sk, optname, optval, optlen);
852 break; 855 break;
853 856
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index c3947cd566b7..c05c1df0bb04 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -255,7 +255,6 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
255 255
256 dev_hold(dev); 256 dev_hold(dev);
257 ipip_tunnel_link(nt); 257 ipip_tunnel_link(nt);
258 /* Do not decrement MOD_USE_COUNT here. */
259 return nt; 258 return nt;
260 259
261failed: 260failed:
@@ -920,12 +919,29 @@ static int __init ipip_init(void)
920 goto out; 919 goto out;
921} 920}
922 921
922static void __exit ipip_destroy_tunnels(void)
923{
924 int prio;
925
926 for (prio = 1; prio < 4; prio++) {
927 int h;
928 for (h = 0; h < HASH_SIZE; h++) {
929 struct ip_tunnel *t;
930 while ((t = tunnels[prio][h]) != NULL)
931 unregister_netdevice(t->dev);
932 }
933 }
934}
935
923static void __exit ipip_fini(void) 936static void __exit ipip_fini(void)
924{ 937{
925 if (ipip_unregister() < 0) 938 if (ipip_unregister() < 0)
926 printk(KERN_INFO "ipip close: can't deregister tunnel\n"); 939 printk(KERN_INFO "ipip close: can't deregister tunnel\n");
927 940
928 unregister_netdev(ipip_fb_tunnel_dev); 941 rtnl_lock();
942 ipip_destroy_tunnels();
943 unregister_netdevice(ipip_fb_tunnel_dev);
944 rtnl_unlock();
929} 945}
930 946
931module_init(ipip_init); 947module_init(ipip_init);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 7833d920bdba..dc806b578427 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -362,7 +362,7 @@ out:
362 362
363/* Fill oifs list. It is called under write locked mrt_lock. */ 363/* Fill oifs list. It is called under write locked mrt_lock. */
364 364
365static void ipmr_update_threshoulds(struct mfc_cache *cache, unsigned char *ttls) 365static void ipmr_update_thresholds(struct mfc_cache *cache, unsigned char *ttls)
366{ 366{
367 int vifi; 367 int vifi;
368 368
@@ -727,7 +727,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
727 if (c != NULL) { 727 if (c != NULL) {
728 write_lock_bh(&mrt_lock); 728 write_lock_bh(&mrt_lock);
729 c->mfc_parent = mfc->mfcc_parent; 729 c->mfc_parent = mfc->mfcc_parent;
730 ipmr_update_threshoulds(c, mfc->mfcc_ttls); 730 ipmr_update_thresholds(c, mfc->mfcc_ttls);
731 if (!mrtsock) 731 if (!mrtsock)
732 c->mfc_flags |= MFC_STATIC; 732 c->mfc_flags |= MFC_STATIC;
733 write_unlock_bh(&mrt_lock); 733 write_unlock_bh(&mrt_lock);
@@ -744,7 +744,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
744 c->mfc_origin=mfc->mfcc_origin.s_addr; 744 c->mfc_origin=mfc->mfcc_origin.s_addr;
745 c->mfc_mcastgrp=mfc->mfcc_mcastgrp.s_addr; 745 c->mfc_mcastgrp=mfc->mfcc_mcastgrp.s_addr;
746 c->mfc_parent=mfc->mfcc_parent; 746 c->mfc_parent=mfc->mfcc_parent;
747 ipmr_update_threshoulds(c, mfc->mfcc_ttls); 747 ipmr_update_thresholds(c, mfc->mfcc_ttls);
748 if (!mrtsock) 748 if (!mrtsock)
749 c->mfc_flags |= MFC_STATIC; 749 c->mfc_flags |= MFC_STATIC;
750 750
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 63bf88264980..a7f0c821a9b2 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -510,9 +510,14 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
510 /* Welcome, Mr. Bond. We've been expecting you... */ 510 /* Welcome, Mr. Bond. We've been expecting you... */
511 __set_bit(IPS_EXPECTED_BIT, &conntrack->status); 511 __set_bit(IPS_EXPECTED_BIT, &conntrack->status);
512 conntrack->master = exp->master; 512 conntrack->master = exp->master;
513#if CONFIG_IP_NF_CONNTRACK_MARK 513#ifdef CONFIG_IP_NF_CONNTRACK_MARK
514 conntrack->mark = exp->master->mark; 514 conntrack->mark = exp->master->mark;
515#endif 515#endif
516#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
517 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
518 /* this is ugly, but there is no other place where to put it */
519 conntrack->nat.masq_index = exp->master->nat.masq_index;
520#endif
516 nf_conntrack_get(&conntrack->master->ct_general); 521 nf_conntrack_get(&conntrack->master->ct_general);
517 CONNTRACK_STAT_INC(expect_new); 522 CONNTRACK_STAT_INC(expect_new);
518 } else { 523 } else {
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index bc59d0d6e89e..91d5ea1dbbc9 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -102,6 +102,10 @@ ip_nat_fn(unsigned int hooknum,
102 return NF_ACCEPT; 102 return NF_ACCEPT;
103 } 103 }
104 104
105 /* Don't try to NAT if this packet is not conntracked */
106 if (ct == &ip_conntrack_untracked)
107 return NF_ACCEPT;
108
105 switch (ctinfo) { 109 switch (ctinfo) {
106 case IP_CT_RELATED: 110 case IP_CT_RELATED:
107 case IP_CT_RELATED+IP_CT_IS_REPLY: 111 case IP_CT_RELATED+IP_CT_IS_REPLY:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 62f62bb05c2a..5d91213d34c0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1494,12 +1494,11 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1494 * to destinations, already remembered 1494 * to destinations, already remembered
1495 * to the moment of synflood. 1495 * to the moment of synflood.
1496 */ 1496 */
1497 NETDEBUG(if (net_ratelimit()) \ 1497 LIMIT_NETDEBUG(printk(KERN_DEBUG "TCP: drop open "
1498 printk(KERN_DEBUG "TCP: drop open " 1498 "request from %u.%u."
1499 "request from %u.%u." 1499 "%u.%u/%u\n",
1500 "%u.%u/%u\n", \ 1500 NIPQUAD(saddr),
1501 NIPQUAD(saddr), 1501 ntohs(skb->h.th->source)));
1502 ntohs(skb->h.th->source)));
1503 dst_release(dst); 1502 dst_release(dst);
1504 goto drop_and_free; 1503 goto drop_and_free;
1505 } 1504 }
@@ -1627,8 +1626,7 @@ static int tcp_v4_checksum_init(struct sk_buff *skb)
1627 skb->nh.iph->daddr, skb->csum)) 1626 skb->nh.iph->daddr, skb->csum))
1628 return 0; 1627 return 0;
1629 1628
1630 NETDEBUG(if (net_ratelimit()) 1629 LIMIT_NETDEBUG(printk(KERN_DEBUG "hw tcp v4 csum failed\n"));
1631 printk(KERN_DEBUG "hw tcp v4 csum failed\n"));
1632 skb->ip_summed = CHECKSUM_NONE; 1630 skb->ip_summed = CHECKSUM_NONE;
1633 } 1631 }
1634 if (skb->len <= 76) { 1632 if (skb->len <= 76) {
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e3f8ea1bfa9c..7d076f0db100 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -403,11 +403,9 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb)
403 sk->sk_send_head = skb; 403 sk->sk_send_head = skb;
404} 404}
405 405
406static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) 406static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
407{ 407{
408 struct tcp_sock *tp = tcp_sk(sk); 408 if (skb->len <= mss_now ||
409
410 if (skb->len <= tp->mss_cache ||
411 !(sk->sk_route_caps & NETIF_F_TSO)) { 409 !(sk->sk_route_caps & NETIF_F_TSO)) {
412 /* Avoid the costly divide in the normal 410 /* Avoid the costly divide in the normal
413 * non-TSO case. 411 * non-TSO case.
@@ -417,10 +415,10 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb)
417 } else { 415 } else {
418 unsigned int factor; 416 unsigned int factor;
419 417
420 factor = skb->len + (tp->mss_cache - 1); 418 factor = skb->len + (mss_now - 1);
421 factor /= tp->mss_cache; 419 factor /= mss_now;
422 skb_shinfo(skb)->tso_segs = factor; 420 skb_shinfo(skb)->tso_segs = factor;
423 skb_shinfo(skb)->tso_size = tp->mss_cache; 421 skb_shinfo(skb)->tso_size = mss_now;
424 } 422 }
425} 423}
426 424
@@ -429,7 +427,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb)
429 * packet to the list. This won't be called frequently, I hope. 427 * packet to the list. This won't be called frequently, I hope.
430 * Remember, these are still headerless SKBs at this point. 428 * Remember, these are still headerless SKBs at this point.
431 */ 429 */
432static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) 430static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now)
433{ 431{
434 struct tcp_sock *tp = tcp_sk(sk); 432 struct tcp_sock *tp = tcp_sk(sk);
435 struct sk_buff *buff; 433 struct sk_buff *buff;
@@ -492,8 +490,8 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len)
492 } 490 }
493 491
494 /* Fix up tso_factor for both original and new SKB. */ 492 /* Fix up tso_factor for both original and new SKB. */
495 tcp_set_skb_tso_segs(sk, skb); 493 tcp_set_skb_tso_segs(sk, skb, mss_now);
496 tcp_set_skb_tso_segs(sk, buff); 494 tcp_set_skb_tso_segs(sk, buff, mss_now);
497 495
498 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { 496 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) {
499 tp->lost_out += tcp_skb_pcount(skb); 497 tp->lost_out += tcp_skb_pcount(skb);
@@ -569,7 +567,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
569 * factor and mss. 567 * factor and mss.
570 */ 568 */
571 if (tcp_skb_pcount(skb) > 1) 569 if (tcp_skb_pcount(skb) > 1)
572 tcp_set_skb_tso_segs(sk, skb); 570 tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk, 1));
573 571
574 return 0; 572 return 0;
575} 573}
@@ -734,12 +732,14 @@ static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, struct sk_buff *sk
734/* This must be invoked the first time we consider transmitting 732/* This must be invoked the first time we consider transmitting
735 * SKB onto the wire. 733 * SKB onto the wire.
736 */ 734 */
737static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb) 735static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
738{ 736{
739 int tso_segs = tcp_skb_pcount(skb); 737 int tso_segs = tcp_skb_pcount(skb);
740 738
741 if (!tso_segs) { 739 if (!tso_segs ||
742 tcp_set_skb_tso_segs(sk, skb); 740 (tso_segs > 1 &&
741 skb_shinfo(skb)->tso_size != mss_now)) {
742 tcp_set_skb_tso_segs(sk, skb, mss_now);
743 tso_segs = tcp_skb_pcount(skb); 743 tso_segs = tcp_skb_pcount(skb);
744 } 744 }
745 return tso_segs; 745 return tso_segs;
@@ -817,7 +817,7 @@ static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb,
817 struct tcp_sock *tp = tcp_sk(sk); 817 struct tcp_sock *tp = tcp_sk(sk);
818 unsigned int cwnd_quota; 818 unsigned int cwnd_quota;
819 819
820 tcp_init_tso_segs(sk, skb); 820 tcp_init_tso_segs(sk, skb, cur_mss);
821 821
822 if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) 822 if (!tcp_nagle_test(tp, skb, cur_mss, nonagle))
823 return 0; 823 return 0;
@@ -854,7 +854,7 @@ int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp)
854 * know that all the data is in scatter-gather pages, and that the 854 * know that all the data is in scatter-gather pages, and that the
855 * packet has never been sent out before (and thus is not cloned). 855 * packet has never been sent out before (and thus is not cloned).
856 */ 856 */
857static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len) 857static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, unsigned int mss_now)
858{ 858{
859 struct sk_buff *buff; 859 struct sk_buff *buff;
860 int nlen = skb->len - len; 860 int nlen = skb->len - len;
@@ -887,8 +887,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len)
887 skb_split(skb, buff, len); 887 skb_split(skb, buff, len);
888 888
889 /* Fix up tso_factor for both original and new SKB. */ 889 /* Fix up tso_factor for both original and new SKB. */
890 tcp_set_skb_tso_segs(sk, skb); 890 tcp_set_skb_tso_segs(sk, skb, mss_now);
891 tcp_set_skb_tso_segs(sk, buff); 891 tcp_set_skb_tso_segs(sk, buff, mss_now);
892 892
893 /* Link BUFF into the send queue. */ 893 /* Link BUFF into the send queue. */
894 skb_header_release(buff); 894 skb_header_release(buff);
@@ -972,19 +972,18 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
972 if (unlikely(sk->sk_state == TCP_CLOSE)) 972 if (unlikely(sk->sk_state == TCP_CLOSE))
973 return 0; 973 return 0;
974 974
975 skb = sk->sk_send_head;
976 if (unlikely(!skb))
977 return 0;
978
979 tso_segs = tcp_init_tso_segs(sk, skb);
980 cwnd_quota = tcp_cwnd_test(tp, skb);
981 if (unlikely(!cwnd_quota))
982 goto out;
983
984 sent_pkts = 0; 975 sent_pkts = 0;
985 while (likely(tcp_snd_wnd_test(tp, skb, mss_now))) { 976 while ((skb = sk->sk_send_head)) {
977 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
986 BUG_ON(!tso_segs); 978 BUG_ON(!tso_segs);
987 979
980 cwnd_quota = tcp_cwnd_test(tp, skb);
981 if (!cwnd_quota)
982 break;
983
984 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
985 break;
986
988 if (tso_segs == 1) { 987 if (tso_segs == 1) {
989 if (unlikely(!tcp_nagle_test(tp, skb, mss_now, 988 if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
990 (tcp_skb_is_last(sk, skb) ? 989 (tcp_skb_is_last(sk, skb) ?
@@ -1006,11 +1005,11 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
1006 limit = skb->len - trim; 1005 limit = skb->len - trim;
1007 } 1006 }
1008 if (skb->len > limit) { 1007 if (skb->len > limit) {
1009 if (tso_fragment(sk, skb, limit)) 1008 if (tso_fragment(sk, skb, limit, mss_now))
1010 break; 1009 break;
1011 } 1010 }
1012 } else if (unlikely(skb->len > mss_now)) { 1011 } else if (unlikely(skb->len > mss_now)) {
1013 if (unlikely(tcp_fragment(sk, skb, mss_now))) 1012 if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now)))
1014 break; 1013 break;
1015 } 1014 }
1016 1015
@@ -1026,27 +1025,12 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
1026 1025
1027 tcp_minshall_update(tp, mss_now, skb); 1026 tcp_minshall_update(tp, mss_now, skb);
1028 sent_pkts++; 1027 sent_pkts++;
1029
1030 /* Do not optimize this to use tso_segs. If we chopped up
1031 * the packet above, tso_segs will no longer be valid.
1032 */
1033 cwnd_quota -= tcp_skb_pcount(skb);
1034
1035 BUG_ON(cwnd_quota < 0);
1036 if (!cwnd_quota)
1037 break;
1038
1039 skb = sk->sk_send_head;
1040 if (!skb)
1041 break;
1042 tso_segs = tcp_init_tso_segs(sk, skb);
1043 } 1028 }
1044 1029
1045 if (likely(sent_pkts)) { 1030 if (likely(sent_pkts)) {
1046 tcp_cwnd_validate(sk, tp); 1031 tcp_cwnd_validate(sk, tp);
1047 return 0; 1032 return 0;
1048 } 1033 }
1049out:
1050 return !tp->packets_out && sk->sk_send_head; 1034 return !tp->packets_out && sk->sk_send_head;
1051} 1035}
1052 1036
@@ -1076,7 +1060,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now)
1076 1060
1077 BUG_ON(!skb || skb->len < mss_now); 1061 BUG_ON(!skb || skb->len < mss_now);
1078 1062
1079 tso_segs = tcp_init_tso_segs(sk, skb); 1063 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
1080 cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH); 1064 cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH);
1081 1065
1082 if (likely(cwnd_quota)) { 1066 if (likely(cwnd_quota)) {
@@ -1093,11 +1077,11 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now)
1093 limit = skb->len - trim; 1077 limit = skb->len - trim;
1094 } 1078 }
1095 if (skb->len > limit) { 1079 if (skb->len > limit) {
1096 if (unlikely(tso_fragment(sk, skb, limit))) 1080 if (unlikely(tso_fragment(sk, skb, limit, mss_now)))
1097 return; 1081 return;
1098 } 1082 }
1099 } else if (unlikely(skb->len > mss_now)) { 1083 } else if (unlikely(skb->len > mss_now)) {
1100 if (unlikely(tcp_fragment(sk, skb, mss_now))) 1084 if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now)))
1101 return; 1085 return;
1102 } 1086 }
1103 1087
@@ -1388,7 +1372,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1388 int old_factor = tcp_skb_pcount(skb); 1372 int old_factor = tcp_skb_pcount(skb);
1389 int new_factor; 1373 int new_factor;
1390 1374
1391 if (tcp_fragment(sk, skb, cur_mss)) 1375 if (tcp_fragment(sk, skb, cur_mss, cur_mss))
1392 return -ENOMEM; /* We'll try again later. */ 1376 return -ENOMEM; /* We'll try again later. */
1393 1377
1394 /* New SKB created, account for it. */ 1378 /* New SKB created, account for it. */
@@ -1991,7 +1975,7 @@ int tcp_write_wakeup(struct sock *sk)
1991 skb->len > mss) { 1975 skb->len > mss) {
1992 seg_size = min(seg_size, mss); 1976 seg_size = min(seg_size, mss);
1993 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; 1977 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
1994 if (tcp_fragment(sk, skb, seg_size)) 1978 if (tcp_fragment(sk, skb, seg_size, mss))
1995 return -1; 1979 return -1;
1996 /* SWS override triggered forced fragmentation. 1980 /* SWS override triggered forced fragmentation.
1997 * Disable TSO, the connection is too sick. */ 1981 * Disable TSO, the connection is too sick. */
@@ -2000,7 +1984,7 @@ int tcp_write_wakeup(struct sock *sk)
2000 sk->sk_route_caps &= ~NETIF_F_TSO; 1984 sk->sk_route_caps &= ~NETIF_F_TSO;
2001 } 1985 }
2002 } else if (!tcp_skb_pcount(skb)) 1986 } else if (!tcp_skb_pcount(skb))
2003 tcp_set_skb_tso_segs(sk, skb); 1987 tcp_set_skb_tso_segs(sk, skb, mss);
2004 1988
2005 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; 1989 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
2006 TCP_SKB_CB(skb)->when = tcp_time_stamp; 1990 TCP_SKB_CB(skb)->when = tcp_time_stamp;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 7c24e64b443f..dc4d07357e3a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -628,7 +628,7 @@ back_from_confirm:
628 /* ... which is an evident application bug. --ANK */ 628 /* ... which is an evident application bug. --ANK */
629 release_sock(sk); 629 release_sock(sk);
630 630
631 NETDEBUG(if (net_ratelimit()) printk(KERN_DEBUG "udp cork app bug 2\n")); 631 LIMIT_NETDEBUG(printk(KERN_DEBUG "udp cork app bug 2\n"));
632 err = -EINVAL; 632 err = -EINVAL;
633 goto out; 633 goto out;
634 } 634 }
@@ -693,7 +693,7 @@ static int udp_sendpage(struct sock *sk, struct page *page, int offset,
693 if (unlikely(!up->pending)) { 693 if (unlikely(!up->pending)) {
694 release_sock(sk); 694 release_sock(sk);
695 695
696 NETDEBUG(if (net_ratelimit()) printk(KERN_DEBUG "udp cork app bug 3\n")); 696 LIMIT_NETDEBUG(printk(KERN_DEBUG "udp cork app bug 3\n"));
697 return -EINVAL; 697 return -EINVAL;
698 } 698 }
699 699
@@ -1102,7 +1102,7 @@ static int udp_checksum_init(struct sk_buff *skb, struct udphdr *uh,
1102 skb->ip_summed = CHECKSUM_UNNECESSARY; 1102 skb->ip_summed = CHECKSUM_UNNECESSARY;
1103 if (!udp_check(uh, ulen, saddr, daddr, skb->csum)) 1103 if (!udp_check(uh, ulen, saddr, daddr, skb->csum))
1104 return 0; 1104 return 0;
1105 NETDEBUG(if (net_ratelimit()) printk(KERN_DEBUG "udp v4 hw csum failure.\n")); 1105 LIMIT_NETDEBUG(printk(KERN_DEBUG "udp v4 hw csum failure.\n"));
1106 skb->ip_summed = CHECKSUM_NONE; 1106 skb->ip_summed = CHECKSUM_NONE;
1107 } 1107 }
1108 if (skb->ip_summed != CHECKSUM_UNNECESSARY) 1108 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
@@ -1181,14 +1181,13 @@ int udp_rcv(struct sk_buff *skb)
1181 return(0); 1181 return(0);
1182 1182
1183short_packet: 1183short_packet:
1184 NETDEBUG(if (net_ratelimit()) 1184 LIMIT_NETDEBUG(printk(KERN_DEBUG "UDP: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n",
1185 printk(KERN_DEBUG "UDP: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n", 1185 NIPQUAD(saddr),
1186 NIPQUAD(saddr), 1186 ntohs(uh->source),
1187 ntohs(uh->source), 1187 ulen,
1188 ulen, 1188 len,
1189 len, 1189 NIPQUAD(daddr),
1190 NIPQUAD(daddr), 1190 ntohs(uh->dest)));
1191 ntohs(uh->dest)));
1192no_header: 1191no_header:
1193 UDP_INC_STATS_BH(UDP_MIB_INERRORS); 1192 UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1194 kfree_skb(skb); 1193 kfree_skb(skb);
@@ -1199,13 +1198,12 @@ csum_error:
1199 * RFC1122: OK. Discards the bad packet silently (as far as 1198 * RFC1122: OK. Discards the bad packet silently (as far as
1200 * the network is concerned, anyway) as per 4.1.3.4 (MUST). 1199 * the network is concerned, anyway) as per 4.1.3.4 (MUST).
1201 */ 1200 */
1202 NETDEBUG(if (net_ratelimit()) 1201 LIMIT_NETDEBUG(printk(KERN_DEBUG "UDP: bad checksum. From %d.%d.%d.%d:%d to %d.%d.%d.%d:%d ulen %d\n",
1203 printk(KERN_DEBUG "UDP: bad checksum. From %d.%d.%d.%d:%d to %d.%d.%d.%d:%d ulen %d\n", 1202 NIPQUAD(saddr),
1204 NIPQUAD(saddr), 1203 ntohs(uh->source),
1205 ntohs(uh->source), 1204 NIPQUAD(daddr),
1206 NIPQUAD(daddr), 1205 ntohs(uh->dest),
1207 ntohs(uh->dest), 1206 ulen));
1208 ulen));
1209drop: 1207drop:
1210 UDP_INC_STATS_BH(UDP_MIB_INERRORS); 1208 UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1211 kfree_skb(skb); 1209 kfree_skb(skb);
diff --git a/net/ipv4/utils.c b/net/ipv4/utils.c
deleted file mode 100644
index 6aecd7a43534..000000000000
--- a/net/ipv4/utils.c
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Various kernel-resident INET utility functions; mainly
7 * for format conversion and debugging output.
8 *
9 * Version: $Id: utils.c,v 1.8 2000/10/03 07:29:01 anton Exp $
10 *
11 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Fixes:
14 * Alan Cox : verify_area check.
15 * Alan Cox : removed old debugging.
16 * Andi Kleen : add net_ratelimit()
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
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23
24#include <linux/module.h>
25#include <linux/types.h>
26#include <asm/byteorder.h>
27
28/*
29 * Convert an ASCII string to binary IP.
30 */
31
32__u32 in_aton(const char *str)
33{
34 unsigned long l;
35 unsigned int val;
36 int i;
37
38 l = 0;
39 for (i = 0; i < 4; i++)
40 {
41 l <<= 8;
42 if (*str != '\0')
43 {
44 val = 0;
45 while (*str != '\0' && *str != '.')
46 {
47 val *= 10;
48 val += *str - '0';
49 str++;
50 }
51 l |= val;
52 if (*str != '\0')
53 str++;
54 }
55 }
56 return(htonl(l));
57}
58
59EXPORT_SYMBOL(in_aton);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1f2c2f9e353f..ae652ca14bc9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -792,13 +792,8 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
792 if (ipv6_addr_any(&fl->fl6_src)) { 792 if (ipv6_addr_any(&fl->fl6_src)) {
793 err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src); 793 err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src);
794 794
795 if (err) { 795 if (err)
796#if IP6_DEBUG >= 2
797 printk(KERN_DEBUG "ip6_dst_lookup: "
798 "no available source address\n");
799#endif
800 goto out_err_release; 796 goto out_err_release;
801 }
802 } 797 }
803 798
804 return 0; 799 return 0;
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index f3ef4c38d315..3bc144a79fa5 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -504,6 +504,9 @@ done:
504 break; 504 break;
505 case IPV6_IPSEC_POLICY: 505 case IPV6_IPSEC_POLICY:
506 case IPV6_XFRM_POLICY: 506 case IPV6_XFRM_POLICY:
507 retv = -EPERM;
508 if (!capable(CAP_NET_ADMIN))
509 break;
507 retv = xfrm_user_policy(sk, optname, optval, optlen); 510 retv = xfrm_user_policy(sk, optname, optval, optlen);
508 break; 511 break;
509 512
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index b788f55e139b..e553e5b80d6e 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -195,7 +195,6 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
195 dev_hold(dev); 195 dev_hold(dev);
196 196
197 ipip6_tunnel_link(nt); 197 ipip6_tunnel_link(nt);
198 /* Do not decrement MOD_USE_COUNT here. */
199 return nt; 198 return nt;
200 199
201failed: 200failed:
@@ -794,10 +793,28 @@ static struct net_protocol sit_protocol = {
794 .err_handler = ipip6_err, 793 .err_handler = ipip6_err,
795}; 794};
796 795
796static void __exit sit_destroy_tunnels(void)
797{
798 int prio;
799
800 for (prio = 1; prio < 4; prio++) {
801 int h;
802 for (h = 0; h < HASH_SIZE; h++) {
803 struct ip_tunnel *t;
804 while ((t = tunnels[prio][h]) != NULL)
805 unregister_netdevice(t->dev);
806 }
807 }
808}
809
797void __exit sit_cleanup(void) 810void __exit sit_cleanup(void)
798{ 811{
799 inet_del_protocol(&sit_protocol, IPPROTO_IPV6); 812 inet_del_protocol(&sit_protocol, IPPROTO_IPV6);
800 unregister_netdev(ipip6_fb_tunnel_dev); 813
814 rtnl_lock();
815 sit_destroy_tunnels();
816 unregister_netdevice(ipip6_fb_tunnel_dev);
817 rtnl_unlock();
801} 818}
802 819
803int __init sit_init(void) 820int __init sit_init(void)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index ad6b12043874..9f5aabd58fa9 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -178,17 +178,31 @@ const char *dbg_print_ptype(int val)
178} 178}
179 179
180 180
181/* Main Window Initialization */ 181void replace_button_icon(GladeXML * xml, GdkDrawable * window,
182 GtkStyle * style, gchar * btn_name, gchar ** xpm)
183{
184 GdkPixmap *pixmap;
185 GdkBitmap *mask;
186 GtkToolButton *button;
187 GtkWidget *image;
182 188
189 pixmap = gdk_pixmap_create_from_xpm_d(window, &mask,
190 &style->bg[GTK_STATE_NORMAL],
191 xpm);
192
193 button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name));
194 image = gtk_image_new_from_pixmap(pixmap, mask);
195 gtk_widget_show(image);
196 gtk_tool_button_set_icon_widget(button, image);
197}
183 198
199/* Main Window Initialization */
184void init_main_window(const gchar * glade_file) 200void init_main_window(const gchar * glade_file)
185{ 201{
186 GladeXML *xml; 202 GladeXML *xml;
187 GtkWidget *widget; 203 GtkWidget *widget;
188 GtkTextBuffer *txtbuf; 204 GtkTextBuffer *txtbuf;
189 char title[256]; 205 char title[256];
190 GdkPixmap *pixmap;
191 GdkBitmap *mask;
192 GtkStyle *style; 206 GtkStyle *style;
193 207
194 xml = glade_xml_new(glade_file, "window1", NULL); 208 xml = glade_xml_new(glade_file, "window1", NULL);
@@ -221,36 +235,22 @@ void init_main_window(const gchar * glade_file)
221 style = gtk_widget_get_style(main_wnd); 235 style = gtk_widget_get_style(main_wnd);
222 widget = glade_xml_get_widget(xml, "toolbar1"); 236 widget = glade_xml_get_widget(xml, "toolbar1");
223 237
224 pixmap = gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, 238#if 0 /* Use stock Gtk icons instead */
225 &style->bg[GTK_STATE_NORMAL], 239 replace_button_icon(xml, main_wnd->window, style,
226 (gchar **) xpm_single_view); 240 "button1", (gchar **) xpm_back);
227 gtk_image_set_from_pixmap(GTK_IMAGE 241 replace_button_icon(xml, main_wnd->window, style,
228 (((GtkToolbarChild 242 "button2", (gchar **) xpm_load);
229 *) (g_list_nth(GTK_TOOLBAR(widget)-> 243 replace_button_icon(xml, main_wnd->window, style,
230 children, 244 "button3", (gchar **) xpm_save);
231 5)->data))->icon), 245#endif
232 pixmap, mask); 246 replace_button_icon(xml, main_wnd->window, style,
233 pixmap = 247 "button4", (gchar **) xpm_single_view);
234 gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, 248 replace_button_icon(xml, main_wnd->window, style,
235 &style->bg[GTK_STATE_NORMAL], 249 "button5", (gchar **) xpm_split_view);
236 (gchar **) xpm_split_view); 250 replace_button_icon(xml, main_wnd->window, style,
237 gtk_image_set_from_pixmap(GTK_IMAGE 251 "button6", (gchar **) xpm_tree_view);
238 (((GtkToolbarChild 252
239 *) (g_list_nth(GTK_TOOLBAR(widget)-> 253#if 0
240 children,
241 6)->data))->icon),
242 pixmap, mask);
243 pixmap =
244 gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask,
245 &style->bg[GTK_STATE_NORMAL],
246 (gchar **) xpm_tree_view);
247 gtk_image_set_from_pixmap(GTK_IMAGE
248 (((GtkToolbarChild
249 *) (g_list_nth(GTK_TOOLBAR(widget)->
250 children,
251 7)->data))->icon),
252 pixmap, mask);
253
254 switch (view_mode) { 254 switch (view_mode) {
255 case SINGLE_VIEW: 255 case SINGLE_VIEW:
256 widget = glade_xml_get_widget(xml, "button4"); 256 widget = glade_xml_get_widget(xml, "button4");
@@ -265,7 +265,7 @@ void init_main_window(const gchar * glade_file)
265 g_signal_emit_by_name(widget, "clicked"); 265 g_signal_emit_by_name(widget, "clicked");
266 break; 266 break;
267 } 267 }
268 268#endif
269 txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); 269 txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
270 tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", 270 tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
271 "foreground", "red", 271 "foreground", "red",
@@ -322,7 +322,7 @@ void init_left_tree(void)
322 gtk_tree_view_set_model(view, model1); 322 gtk_tree_view_set_model(view, model1);
323 gtk_tree_view_set_headers_visible(view, TRUE); 323 gtk_tree_view_set_headers_visible(view, TRUE);
324 gtk_tree_view_set_rules_hint(view, FALSE); 324 gtk_tree_view_set_rules_hint(view, FALSE);
325 325
326 column = gtk_tree_view_column_new(); 326 column = gtk_tree_view_column_new();
327 gtk_tree_view_append_column(view, column); 327 gtk_tree_view_append_column(view, column);
328 gtk_tree_view_column_set_title(column, _("Options")); 328 gtk_tree_view_column_set_title(column, _("Options"));
@@ -334,11 +334,11 @@ void init_left_tree(void)
334 renderer, 334 renderer,
335 "active", COL_BTNACT, 335 "active", COL_BTNACT,
336 "inconsistent", COL_BTNINC, 336 "inconsistent", COL_BTNINC,
337 "visible", COL_BTNVIS, 337 "visible", COL_BTNVIS,
338 "radio", COL_BTNRAD, NULL); 338 "radio", COL_BTNRAD, NULL);
339 renderer = gtk_cell_renderer_text_new(); 339 renderer = gtk_cell_renderer_text_new();
340 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 340 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
341 renderer, FALSE); 341 renderer, FALSE);
342 gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), 342 gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
343 renderer, 343 renderer,
344 "text", COL_OPTION, 344 "text", COL_OPTION,
@@ -386,7 +386,7 @@ void init_right_tree(void)
386 renderer, 386 renderer,
387 "active", COL_BTNACT, 387 "active", COL_BTNACT,
388 "inconsistent", COL_BTNINC, 388 "inconsistent", COL_BTNINC,
389 "visible", COL_BTNVIS, 389 "visible", COL_BTNVIS,
390 "radio", COL_BTNRAD, NULL); 390 "radio", COL_BTNRAD, NULL);
391 /*g_signal_connect(G_OBJECT(renderer), "toggled", 391 /*g_signal_connect(G_OBJECT(renderer), "toggled",
392 G_CALLBACK(renderer_toggled), NULL); */ 392 G_CALLBACK(renderer_toggled), NULL); */
@@ -806,7 +806,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
806} 806}
807 807
808 808
809void on_back_pressed(GtkButton * button, gpointer user_data) 809void on_back_clicked(GtkButton * button, gpointer user_data)
810{ 810{
811 enum prop_type ptype; 811 enum prop_type ptype;
812 812
@@ -821,13 +821,13 @@ void on_back_pressed(GtkButton * button, gpointer user_data)
821} 821}
822 822
823 823
824void on_load_pressed(GtkButton * button, gpointer user_data) 824void on_load_clicked(GtkButton * button, gpointer user_data)
825{ 825{
826 on_load1_activate(NULL, user_data); 826 on_load1_activate(NULL, user_data);
827} 827}
828 828
829 829
830void on_save_pressed(GtkButton * button, gpointer user_data) 830void on_save_clicked(GtkButton * button, gpointer user_data)
831{ 831{
832 on_save1_activate(NULL, user_data); 832 on_save1_activate(NULL, user_data);
833} 833}
@@ -850,9 +850,12 @@ void on_split_clicked(GtkButton * button, gpointer user_data)
850 gtk_widget_show(tree1_w); 850 gtk_widget_show(tree1_w);
851 gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); 851 gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h);
852 gtk_paned_set_position(GTK_PANED(hpaned), w / 2); 852 gtk_paned_set_position(GTK_PANED(hpaned), w / 2);
853 if (tree2) 853 if (tree2)
854 gtk_tree_store_clear(tree2); 854 gtk_tree_store_clear(tree2);
855 display_list(); 855 display_list();
856
857 /* Disable back btn, like in full mode. */
858 gtk_widget_set_sensitive(back_btn, FALSE);
856} 859}
857 860
858 861
@@ -868,13 +871,13 @@ void on_full_clicked(GtkButton * button, gpointer user_data)
868} 871}
869 872
870 873
871void on_collapse_pressed(GtkButton * button, gpointer user_data) 874void on_collapse_clicked(GtkButton * button, gpointer user_data)
872{ 875{
873 gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); 876 gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w));
874} 877}
875 878
876 879
877void on_expand_pressed(GtkButton * button, gpointer user_data) 880void on_expand_clicked(GtkButton * button, gpointer user_data)
878{ 881{
879 gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); 882 gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
880} 883}
@@ -1242,13 +1245,13 @@ static gchar **fill_row(struct menu *menu)
1242 row[COL_VALUE] = 1245 row[COL_VALUE] =
1243 g_strdup(menu_get_prompt(def_menu)); 1246 g_strdup(menu_get_prompt(def_menu));
1244 } 1247 }
1245 if(sym->flags & SYMBOL_CHOICEVAL) 1248 if (sym->flags & SYMBOL_CHOICEVAL)
1246 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); 1249 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
1247 1250
1248 stype = sym_get_type(sym); 1251 stype = sym_get_type(sym);
1249 switch (stype) { 1252 switch (stype) {
1250 case S_BOOLEAN: 1253 case S_BOOLEAN:
1251 if(GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE) 1254 if (GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE)
1252 row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); 1255 row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
1253 if (sym_is_choice(sym)) 1256 if (sym_is_choice(sym))
1254 break; 1257 break;
@@ -1423,7 +1426,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
1423 child2); 1426 child2);
1424 gtk_tree_store_remove(tree2, &tmp); 1427 gtk_tree_store_remove(tree2, &tmp);
1425 if (!valid) 1428 if (!valid)
1426 return; // next parent 1429 return; // next parent
1427 else 1430 else
1428 goto reparse; // next child 1431 goto reparse; // next child
1429 } else 1432 } else
@@ -1448,7 +1451,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
1448 child2); 1451 child2);
1449 gtk_tree_store_remove(tree2, &tmp); 1452 gtk_tree_store_remove(tree2, &tmp);
1450 if (!valid) 1453 if (!valid)
1451 return; // next parent 1454 return; // next parent
1452 else 1455 else
1453 goto reparse; // next child 1456 goto reparse; // next child
1454 } 1457 }
@@ -1486,12 +1489,12 @@ static void display_tree(struct menu *menu)
1486 if (sym) 1489 if (sym)
1487 sym->flags &= ~SYMBOL_CHANGED; 1490 sym->flags &= ~SYMBOL_CHANGED;
1488 1491
1489 if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) && 1492 if ((view_mode == SPLIT_VIEW)
1490 (tree == tree1)) 1493 && !(child->flags & MENU_ROOT) && (tree == tree1))
1491 continue; 1494 continue;
1492 1495
1493 if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) && 1496 if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT)
1494 (tree == tree2)) 1497 && (tree == tree2))
1495 continue; 1498 continue;
1496 1499
1497 if (menu_is_visible(child) || show_all) 1500 if (menu_is_visible(child) || show_all)
@@ -1513,11 +1516,12 @@ static void display_tree(struct menu *menu)
1513 && (tree == tree2)) 1516 && (tree == tree2))
1514 continue; 1517 continue;
1515/* 1518/*
1516 if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) || 1519 if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
1517 (view_mode == FULL_VIEW) 1520 || (view_mode == FULL_VIEW)
1518 || (view_mode == SPLIT_VIEW))*/ 1521 || (view_mode == SPLIT_VIEW))*/
1519 if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) 1522 if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT))
1520 || (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW)) { 1523 || (view_mode == FULL_VIEW)
1524 || (view_mode == SPLIT_VIEW)) {
1521 indent++; 1525 indent++;
1522 display_tree(child); 1526 display_tree(child);
1523 indent--; 1527 indent--;
@@ -1530,9 +1534,9 @@ static void display_tree_part(void)
1530{ 1534{
1531 if (tree2) 1535 if (tree2)
1532 gtk_tree_store_clear(tree2); 1536 gtk_tree_store_clear(tree2);
1533 if(view_mode == SINGLE_VIEW) 1537 if (view_mode == SINGLE_VIEW)
1534 display_tree(current); 1538 display_tree(current);
1535 else if(view_mode == SPLIT_VIEW) 1539 else if (view_mode == SPLIT_VIEW)
1536 display_tree(browsed); 1540 display_tree(browsed);
1537 gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); 1541 gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
1538} 1542}
@@ -1551,24 +1555,22 @@ static void display_list(void)
1551 1555
1552void fixup_rootmenu(struct menu *menu) 1556void fixup_rootmenu(struct menu *menu)
1553{ 1557{
1554 struct menu *child; 1558 struct menu *child;
1555 static int menu_cnt = 0; 1559 static int menu_cnt = 0;
1556 1560
1557 menu->flags |= MENU_ROOT; 1561 menu->flags |= MENU_ROOT;
1558 for (child = menu->list; child; child = child->next) { 1562 for (child = menu->list; child; child = child->next) {
1559 if (child->prompt && child->prompt->type == P_MENU) { 1563 if (child->prompt && child->prompt->type == P_MENU) {
1560 menu_cnt++; 1564 menu_cnt++;
1561 fixup_rootmenu(child); 1565 fixup_rootmenu(child);
1562 menu_cnt--; 1566 menu_cnt--;
1563 } else if (!menu_cnt) 1567 } else if (!menu_cnt)
1564 fixup_rootmenu(child); 1568 fixup_rootmenu(child);
1565 } 1569 }
1566} 1570}
1567 1571
1568 1572
1569/* Main */ 1573/* Main */
1570
1571
1572int main(int ac, char *av[]) 1574int main(int ac, char *av[])
1573{ 1575{
1574 const char *name; 1576 const char *name;
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index ace4706ab251..f8744ed64967 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -13,6 +13,11 @@
13 <property name="default_height">480</property> 13 <property name="default_height">480</property>
14 <property name="resizable">True</property> 14 <property name="resizable">True</property>
15 <property name="destroy_with_parent">False</property> 15 <property name="destroy_with_parent">False</property>
16 <property name="decorated">True</property>
17 <property name="skip_taskbar_hint">False</property>
18 <property name="skip_pager_hint">False</property>
19 <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
20 <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
16 <signal name="destroy" handler="on_window1_destroy" object="window1"/> 21 <signal name="destroy" handler="on_window1_destroy" object="window1"/>
17 <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> 22 <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/>
18 <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> 23 <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/>
@@ -46,7 +51,7 @@
46 <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> 51 <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/>
47 52
48 <child internal-child="image"> 53 <child internal-child="image">
49 <widget class="GtkImage" id="image27"> 54 <widget class="GtkImage" id="image39">
50 <property name="visible">True</property> 55 <property name="visible">True</property>
51 <property name="stock">gtk-open</property> 56 <property name="stock">gtk-open</property>
52 <property name="icon_size">1</property> 57 <property name="icon_size">1</property>
@@ -69,7 +74,7 @@
69 <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> 74 <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
70 75
71 <child internal-child="image"> 76 <child internal-child="image">
72 <widget class="GtkImage" id="image28"> 77 <widget class="GtkImage" id="image40">
73 <property name="visible">True</property> 78 <property name="visible">True</property>
74 <property name="stock">gtk-save</property> 79 <property name="stock">gtk-save</property>
75 <property name="icon_size">1</property> 80 <property name="icon_size">1</property>
@@ -91,7 +96,7 @@
91 <signal name="activate" handler="on_save_as1_activate"/> 96 <signal name="activate" handler="on_save_as1_activate"/>
92 97
93 <child internal-child="image"> 98 <child internal-child="image">
94 <widget class="GtkImage" id="image29"> 99 <widget class="GtkImage" id="image41">
95 <property name="visible">True</property> 100 <property name="visible">True</property>
96 <property name="stock">gtk-save-as</property> 101 <property name="stock">gtk-save-as</property>
97 <property name="icon_size">1</property> 102 <property name="icon_size">1</property>
@@ -105,7 +110,7 @@
105 </child> 110 </child>
106 111
107 <child> 112 <child>
108 <widget class="GtkMenuItem" id="separator1"> 113 <widget class="GtkSeparatorMenuItem" id="separator1">
109 <property name="visible">True</property> 114 <property name="visible">True</property>
110 </widget> 115 </widget>
111 </child> 116 </child>
@@ -119,7 +124,7 @@
119 <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> 124 <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
120 125
121 <child internal-child="image"> 126 <child internal-child="image">
122 <widget class="GtkImage" id="image30"> 127 <widget class="GtkImage" id="image42">
123 <property name="visible">True</property> 128 <property name="visible">True</property>
124 <property name="stock">gtk-quit</property> 129 <property name="stock">gtk-quit</property>
125 <property name="icon_size">1</property> 130 <property name="icon_size">1</property>
@@ -179,7 +184,7 @@
179 </child> 184 </child>
180 185
181 <child> 186 <child>
182 <widget class="GtkMenuItem" id="separator2"> 187 <widget class="GtkSeparatorMenuItem" id="separator2">
183 <property name="visible">True</property> 188 <property name="visible">True</property>
184 </widget> 189 </widget>
185 </child> 190 </child>
@@ -228,7 +233,7 @@
228 <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> 233 <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/>
229 234
230 <child internal-child="image"> 235 <child internal-child="image">
231 <widget class="GtkImage" id="image31"> 236 <widget class="GtkImage" id="image43">
232 <property name="visible">True</property> 237 <property name="visible">True</property>
233 <property name="stock">gtk-dialog-question</property> 238 <property name="stock">gtk-dialog-question</property>
234 <property name="icon_size">1</property> 239 <property name="icon_size">1</property>
@@ -250,7 +255,7 @@
250 <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> 255 <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
251 256
252 <child internal-child="image"> 257 <child internal-child="image">
253 <widget class="GtkImage" id="image32"> 258 <widget class="GtkImage" id="image44">
254 <property name="visible">True</property> 259 <property name="visible">True</property>
255 <property name="stock">gtk-properties</property> 260 <property name="stock">gtk-properties</property>
256 <property name="icon_size">1</property> 261 <property name="icon_size">1</property>
@@ -271,7 +276,7 @@
271 <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> 276 <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/>
272 277
273 <child internal-child="image"> 278 <child internal-child="image">
274 <widget class="GtkImage" id="image33"> 279 <widget class="GtkImage" id="image45">
275 <property name="visible">True</property> 280 <property name="visible">True</property>
276 <property name="stock">gtk-justify-fill</property> 281 <property name="stock">gtk-justify-fill</property>
277 <property name="icon_size">1</property> 282 <property name="icon_size">1</property>
@@ -308,109 +313,207 @@
308 <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> 313 <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
309 <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> 314 <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
310 <property name="tooltips">True</property> 315 <property name="tooltips">True</property>
316 <property name="show_arrow">True</property>
311 317
312 <child> 318 <child>
313 <widget class="button" id="button1"> 319 <widget class="GtkToolButton" id="button1">
314 <property name="visible">True</property> 320 <property name="visible">True</property>
315 <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> 321 <property name="tooltip" translatable="yes">Goes up of one level (single view)</property>
316 <property name="label" translatable="yes">Back</property> 322 <property name="label" translatable="yes">Back</property>
317 <property name="use_underline">True</property> 323 <property name="use_underline">True</property>
318 <property name="stock_pixmap">gtk-undo</property> 324 <property name="stock_id">gtk-undo</property>
319 <signal name="pressed" handler="on_back_pressed"/> 325 <property name="visible_horizontal">True</property>
326 <property name="visible_vertical">True</property>
327 <property name="is_important">False</property>
328 <signal name="clicked" handler="on_back_clicked"/>
320 </widget> 329 </widget>
330 <packing>
331 <property name="expand">False</property>
332 <property name="homogeneous">True</property>
333 </packing>
321 </child> 334 </child>
322 335
323 <child> 336 <child>
324 <widget class="GtkVSeparator" id="vseparator1"> 337 <widget class="GtkToolItem" id="toolitem1">
325 <property name="visible">True</property> 338 <property name="visible">True</property>
339 <property name="visible_horizontal">True</property>
340 <property name="visible_vertical">True</property>
341 <property name="is_important">False</property>
342
343 <child>
344 <widget class="GtkVSeparator" id="vseparator1">
345 <property name="visible">True</property>
346 </widget>
347 </child>
326 </widget> 348 </widget>
349 <packing>
350 <property name="expand">False</property>
351 <property name="homogeneous">False</property>
352 </packing>
327 </child> 353 </child>
328 354
329 <child> 355 <child>
330 <widget class="button" id="button2"> 356 <widget class="GtkToolButton" id="button2">
331 <property name="visible">True</property> 357 <property name="visible">True</property>
332 <property name="tooltip" translatable="yes">Load a config file</property> 358 <property name="tooltip" translatable="yes">Load a config file</property>
333 <property name="label" translatable="yes">Load</property> 359 <property name="label" translatable="yes">Load</property>
334 <property name="use_underline">True</property> 360 <property name="use_underline">True</property>
335 <property name="stock_pixmap">gtk-open</property> 361 <property name="stock_id">gtk-open</property>
336 <signal name="pressed" handler="on_load_pressed"/> 362 <property name="visible_horizontal">True</property>
363 <property name="visible_vertical">True</property>
364 <property name="is_important">False</property>
365 <signal name="clicked" handler="on_load_clicked"/>
337 </widget> 366 </widget>
367 <packing>
368 <property name="expand">False</property>
369 <property name="homogeneous">True</property>
370 </packing>
338 </child> 371 </child>
339 372
340 <child> 373 <child>
341 <widget class="button" id="button3"> 374 <widget class="GtkToolButton" id="button3">
342 <property name="visible">True</property> 375 <property name="visible">True</property>
343 <property name="tooltip" translatable="yes">Save a config file</property> 376 <property name="tooltip" translatable="yes">Save a config file</property>
344 <property name="label" translatable="yes">Save</property> 377 <property name="label" translatable="yes">Save</property>
345 <property name="use_underline">True</property> 378 <property name="use_underline">True</property>
346 <property name="stock_pixmap">gtk-save</property> 379 <property name="stock_id">gtk-save</property>
347 <signal name="pressed" handler="on_save_pressed"/> 380 <property name="visible_horizontal">True</property>
381 <property name="visible_vertical">True</property>
382 <property name="is_important">False</property>
383 <signal name="clicked" handler="on_save_clicked"/>
348 </widget> 384 </widget>
385 <packing>
386 <property name="expand">False</property>
387 <property name="homogeneous">True</property>
388 </packing>
349 </child> 389 </child>
350 390
351 <child> 391 <child>
352 <widget class="GtkVSeparator" id="vseparator2"> 392 <widget class="GtkToolItem" id="toolitem2">
353 <property name="visible">True</property> 393 <property name="visible">True</property>
394 <property name="visible_horizontal">True</property>
395 <property name="visible_vertical">True</property>
396 <property name="is_important">False</property>
397
398 <child>
399 <widget class="GtkVSeparator" id="vseparator2">
400 <property name="visible">True</property>
401 </widget>
402 </child>
354 </widget> 403 </widget>
404 <packing>
405 <property name="expand">False</property>
406 <property name="homogeneous">False</property>
407 </packing>
355 </child> 408 </child>
356 409
357 <child> 410 <child>
358 <widget class="button" id="button4"> 411 <widget class="GtkToolButton" id="button4">
359 <property name="visible">True</property> 412 <property name="visible">True</property>
360 <property name="tooltip" translatable="yes">Single view</property> 413 <property name="tooltip" translatable="yes">Single view</property>
361 <property name="label" translatable="yes">Single</property> 414 <property name="label" translatable="yes">Single</property>
362 <property name="use_underline">True</property> 415 <property name="use_underline">True</property>
363 <property name="stock_pixmap">gtk-missing-image</property> 416 <property name="stock_id">gtk-missing-image</property>
417 <property name="visible_horizontal">True</property>
418 <property name="visible_vertical">True</property>
419 <property name="is_important">False</property>
364 <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> 420 <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/>
365 </widget> 421 </widget>
422 <packing>
423 <property name="expand">False</property>
424 <property name="homogeneous">True</property>
425 </packing>
366 </child> 426 </child>
367 427
368 <child> 428 <child>
369 <widget class="button" id="button5"> 429 <widget class="GtkToolButton" id="button5">
370 <property name="visible">True</property> 430 <property name="visible">True</property>
371 <property name="tooltip" translatable="yes">Split view</property> 431 <property name="tooltip" translatable="yes">Split view</property>
372 <property name="label" translatable="yes">Split</property> 432 <property name="label" translatable="yes">Split</property>
373 <property name="use_underline">True</property> 433 <property name="use_underline">True</property>
374 <property name="stock_pixmap">gtk-missing-image</property> 434 <property name="stock_id">gtk-missing-image</property>
435 <property name="visible_horizontal">True</property>
436 <property name="visible_vertical">True</property>
437 <property name="is_important">False</property>
375 <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> 438 <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/>
376 </widget> 439 </widget>
440 <packing>
441 <property name="expand">False</property>
442 <property name="homogeneous">True</property>
443 </packing>
377 </child> 444 </child>
378 445
379 <child> 446 <child>
380 <widget class="button" id="button6"> 447 <widget class="GtkToolButton" id="button6">
381 <property name="visible">True</property> 448 <property name="visible">True</property>
382 <property name="tooltip" translatable="yes">Full view</property> 449 <property name="tooltip" translatable="yes">Full view</property>
383 <property name="label" translatable="yes">Full</property> 450 <property name="label" translatable="yes">Full</property>
384 <property name="use_underline">True</property> 451 <property name="use_underline">True</property>
385 <property name="stock_pixmap">gtk-missing-image</property> 452 <property name="stock_id">gtk-missing-image</property>
453 <property name="visible_horizontal">True</property>
454 <property name="visible_vertical">True</property>
455 <property name="is_important">False</property>
386 <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> 456 <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/>
387 </widget> 457 </widget>
458 <packing>
459 <property name="expand">False</property>
460 <property name="homogeneous">True</property>
461 </packing>
388 </child> 462 </child>
389 463
390 <child> 464 <child>
391 <widget class="GtkVSeparator" id="vseparator3"> 465 <widget class="GtkToolItem" id="toolitem3">
392 <property name="visible">True</property> 466 <property name="visible">True</property>
467 <property name="visible_horizontal">True</property>
468 <property name="visible_vertical">True</property>
469 <property name="is_important">False</property>
470
471 <child>
472 <widget class="GtkVSeparator" id="vseparator3">
473 <property name="visible">True</property>
474 </widget>
475 </child>
393 </widget> 476 </widget>
477 <packing>
478 <property name="expand">False</property>
479 <property name="homogeneous">False</property>
480 </packing>
394 </child> 481 </child>
395 482
396 <child> 483 <child>
397 <widget class="button" id="button7"> 484 <widget class="GtkToolButton" id="button7">
398 <property name="visible">True</property> 485 <property name="visible">True</property>
399 <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> 486 <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property>
400 <property name="label" translatable="yes">Collapse</property> 487 <property name="label" translatable="yes">Collapse</property>
401 <property name="use_underline">True</property> 488 <property name="use_underline">True</property>
402 <signal name="pressed" handler="on_collapse_pressed"/> 489 <property name="stock_id">gtk-remove</property>
490 <property name="visible_horizontal">True</property>
491 <property name="visible_vertical">True</property>
492 <property name="is_important">False</property>
493 <signal name="clicked" handler="on_collapse_clicked"/>
403 </widget> 494 </widget>
495 <packing>
496 <property name="expand">False</property>
497 <property name="homogeneous">True</property>
498 </packing>
404 </child> 499 </child>
405 500
406 <child> 501 <child>
407 <widget class="button" id="button8"> 502 <widget class="GtkToolButton" id="button8">
408 <property name="visible">True</property> 503 <property name="visible">True</property>
409 <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> 504 <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property>
410 <property name="label" translatable="yes">Expand</property> 505 <property name="label" translatable="yes">Expand</property>
411 <property name="use_underline">True</property> 506 <property name="use_underline">True</property>
412 <signal name="pressed" handler="on_expand_pressed"/> 507 <property name="stock_id">gtk-add</property>
508 <property name="visible_horizontal">True</property>
509 <property name="visible_vertical">True</property>
510 <property name="is_important">False</property>
511 <signal name="clicked" handler="on_expand_clicked"/>
413 </widget> 512 </widget>
513 <packing>
514 <property name="expand">False</property>
515 <property name="homogeneous">True</property>
516 </packing>
414 </child> 517 </child>
415 </widget> 518 </widget>
416 </child> 519 </child>
@@ -505,6 +608,8 @@
505 <property name="visible">True</property> 608 <property name="visible">True</property>
506 <property name="can_focus">True</property> 609 <property name="can_focus">True</property>
507 <property name="editable">False</property> 610 <property name="editable">False</property>
611 <property name="overwrite">False</property>
612 <property name="accepts_tab">True</property>
508 <property name="justification">GTK_JUSTIFY_LEFT</property> 613 <property name="justification">GTK_JUSTIFY_LEFT</property>
509 <property name="wrap_mode">GTK_WRAP_WORD</property> 614 <property name="wrap_mode">GTK_WRAP_WORD</property>
510 <property name="cursor_visible">True</property> 615 <property name="cursor_visible">True</property>
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index fea262860ea0..a6516a64b297 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -49,9 +49,6 @@ asmlinkage long sys_add_key(const char __user *_type,
49 goto error; 49 goto error;
50 type[31] = '\0'; 50 type[31] = '\0';
51 51
52 if (!type[0])
53 goto error;
54
55 ret = -EPERM; 52 ret = -EPERM;
56 if (type[0] == '.') 53 if (type[0] == '.')
57 goto error; 54 goto error;
@@ -144,6 +141,10 @@ asmlinkage long sys_request_key(const char __user *_type,
144 goto error; 141 goto error;
145 type[31] = '\0'; 142 type[31] = '\0';
146 143
144 ret = -EPERM;
145 if (type[0] == '.')
146 goto error;
147
147 /* pull the description into kernel space */ 148 /* pull the description into kernel space */
148 ret = -EFAULT; 149 ret = -EFAULT;
149 dlen = strnlen_user(_description, PAGE_SIZE - 1); 150 dlen = strnlen_user(_description, PAGE_SIZE - 1);
@@ -362,7 +363,7 @@ long keyctl_revoke_key(key_serial_t id)
362 363
363 key_put(key); 364 key_put(key);
364 error: 365 error:
365 return 0; 366 return ret;
366 367
367} /* end keyctl_revoke_key() */ 368} /* end keyctl_revoke_key() */
368 369
@@ -685,6 +686,8 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
685 goto can_read_key2; 686 goto can_read_key2;
686 687
687 ret = PTR_ERR(skey); 688 ret = PTR_ERR(skey);
689 if (ret == -EAGAIN)
690 ret = -EACCES;
688 goto error2; 691 goto error2;
689 } 692 }
690 693
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index a1f6bac647a1..9c208c756df8 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -201,7 +201,11 @@ static void keyring_destroy(struct key *keyring)
201 201
202 if (keyring->description) { 202 if (keyring->description) {
203 write_lock(&keyring_name_lock); 203 write_lock(&keyring_name_lock);
204 list_del(&keyring->type_data.link); 204
205 if (keyring->type_data.link.next != NULL &&
206 !list_empty(&keyring->type_data.link))
207 list_del(&keyring->type_data.link);
208
205 write_unlock(&keyring_name_lock); 209 write_unlock(&keyring_name_lock);
206 } 210 }
207 211
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 9b0369c5a223..c089f78fb94e 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -678,7 +678,7 @@ long join_session_keyring(const char *name)
678 keyring = keyring_alloc(name, tsk->uid, tsk->gid, 0, NULL); 678 keyring = keyring_alloc(name, tsk->uid, tsk->gid, 0, NULL);
679 if (IS_ERR(keyring)) { 679 if (IS_ERR(keyring)) {
680 ret = PTR_ERR(keyring); 680 ret = PTR_ERR(keyring);
681 goto error; 681 goto error2;
682 } 682 }
683 } 683 }
684 else if (IS_ERR(keyring)) { 684 else if (IS_ERR(keyring)) {
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index dfcd983af1fd..90c1506d007c 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -405,7 +405,7 @@ struct key *request_key_and_link(struct key_type *type,
405 key_user_put(user); 405 key_user_put(user);
406 406
407 /* link the new key into the appropriate keyring */ 407 /* link the new key into the appropriate keyring */
408 if (!PTR_ERR(key)) 408 if (!IS_ERR(key))
409 request_key_link(key, dest_keyring); 409 request_key_link(key, dest_keyring);
410 } 410 }
411 411
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 5e755a3f4cae..9f9463000683 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -826,7 +826,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
826 sid = sbsec->def_sid; 826 sid = sbsec->def_sid;
827 rc = 0; 827 rc = 0;
828 } else { 828 } else {
829 rc = security_context_to_sid(context, rc, &sid); 829 rc = security_context_to_sid_default(context, rc, &sid,
830 sbsec->def_sid);
830 if (rc) { 831 if (rc) {
831 printk(KERN_WARNING "%s: context_to_sid(%s) " 832 printk(KERN_WARNING "%s: context_to_sid(%s) "
832 "returned %d for dev=%s ino=%ld\n", 833 "returned %d for dev=%s ino=%ld\n",
@@ -3125,12 +3126,12 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
3125 3126
3126 if (sk->sk_family == PF_INET) { 3127 if (sk->sk_family == PF_INET) {
3127 addr4 = (struct sockaddr_in *)address; 3128 addr4 = (struct sockaddr_in *)address;
3128 if (addrlen != sizeof(struct sockaddr_in)) 3129 if (addrlen < sizeof(struct sockaddr_in))
3129 return -EINVAL; 3130 return -EINVAL;
3130 snum = ntohs(addr4->sin_port); 3131 snum = ntohs(addr4->sin_port);
3131 } else { 3132 } else {
3132 addr6 = (struct sockaddr_in6 *)address; 3133 addr6 = (struct sockaddr_in6 *)address;
3133 if (addrlen != sizeof(struct sockaddr_in6)) 3134 if (addrlen < SIN6_LEN_RFC2133)
3134 return -EINVAL; 3135 return -EINVAL;
3135 snum = ntohs(addr6->sin6_port); 3136 snum = ntohs(addr6->sin6_port);
3136 } 3137 }
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index fa187c9a351d..71c0a19c9753 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -65,6 +65,8 @@ int security_sid_to_context(u32 sid, char **scontext,
65int security_context_to_sid(char *scontext, u32 scontext_len, 65int security_context_to_sid(char *scontext, u32 scontext_len,
66 u32 *out_sid); 66 u32 *out_sid);
67 67
68int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *out_sid, u32 def_sid);
69
68int security_get_user_sids(u32 callsid, char *username, 70int security_get_user_sids(u32 callsid, char *username,
69 u32 **sids, u32 *nel); 71 u32 **sids, u32 *nel);
70 72
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index 756036bcc243..d4c32c39ccc9 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include "sidtab.h"
18#include "mls.h" 19#include "mls.h"
19#include "policydb.h" 20#include "policydb.h"
20#include "services.h" 21#include "services.h"
@@ -208,6 +209,26 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
208} 209}
209 210
210/* 211/*
212 * Copies the MLS range from `src' into `dst'.
213 */
214static inline int mls_copy_context(struct context *dst,
215 struct context *src)
216{
217 int l, rc = 0;
218
219 /* Copy the MLS range from the source context */
220 for (l = 0; l < 2; l++) {
221 dst->range.level[l].sens = src->range.level[l].sens;
222 rc = ebitmap_cpy(&dst->range.level[l].cat,
223 &src->range.level[l].cat);
224 if (rc)
225 break;
226 }
227
228 return rc;
229}
230
231/*
211 * Set the MLS fields in the security context structure 232 * Set the MLS fields in the security context structure
212 * `context' based on the string representation in 233 * `context' based on the string representation in
213 * the string `*scontext'. Update `*scontext' to 234 * the string `*scontext'. Update `*scontext' to
@@ -216,10 +237,20 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
216 * 237 *
217 * This function modifies the string in place, inserting 238 * This function modifies the string in place, inserting
218 * NULL characters to terminate the MLS fields. 239 * NULL characters to terminate the MLS fields.
240 *
241 * If a def_sid is provided and no MLS field is present,
242 * copy the MLS field of the associated default context.
243 * Used for upgraded to MLS systems where objects may lack
244 * MLS fields.
245 *
246 * Policy read-lock must be held for sidtab lookup.
247 *
219 */ 248 */
220int mls_context_to_sid(char oldc, 249int mls_context_to_sid(char oldc,
221 char **scontext, 250 char **scontext,
222 struct context *context) 251 struct context *context,
252 struct sidtab *s,
253 u32 def_sid)
223{ 254{
224 255
225 char delim; 256 char delim;
@@ -231,9 +262,23 @@ int mls_context_to_sid(char oldc,
231 if (!selinux_mls_enabled) 262 if (!selinux_mls_enabled)
232 return 0; 263 return 0;
233 264
234 /* No MLS component to the security context. */ 265 /*
235 if (!oldc) 266 * No MLS component to the security context, try and map to
267 * default if provided.
268 */
269 if (!oldc) {
270 struct context *defcon;
271
272 if (def_sid == SECSID_NULL)
273 goto out;
274
275 defcon = sidtab_search(s, def_sid);
276 if (!defcon)
277 goto out;
278
279 rc = mls_copy_context(context, defcon);
236 goto out; 280 goto out;
281 }
237 282
238 /* Extract low sensitivity. */ 283 /* Extract low sensitivity. */
239 scontextp = p = *scontext; 284 scontextp = p = *scontext;
@@ -334,26 +379,6 @@ out:
334} 379}
335 380
336/* 381/*
337 * Copies the MLS range from `src' into `dst'.
338 */
339static inline int mls_copy_context(struct context *dst,
340 struct context *src)
341{
342 int l, rc = 0;
343
344 /* Copy the MLS range from the source context */
345 for (l = 0; l < 2; l++) {
346 dst->range.level[l].sens = src->range.level[l].sens;
347 rc = ebitmap_cpy(&dst->range.level[l].cat,
348 &src->range.level[l].cat);
349 if (rc)
350 break;
351 }
352
353 return rc;
354}
355
356/*
357 * Copies the effective MLS range from `src' into `dst'. 382 * Copies the effective MLS range from `src' into `dst'.
358 */ 383 */
359static inline int mls_scopy_context(struct context *dst, 384static inline int mls_scopy_context(struct context *dst,
diff --git a/security/selinux/ss/mls.h b/security/selinux/ss/mls.h
index 0d37beaa85e2..03de697c8058 100644
--- a/security/selinux/ss/mls.h
+++ b/security/selinux/ss/mls.h
@@ -23,7 +23,9 @@ int mls_context_isvalid(struct policydb *p, struct context *c);
23 23
24int mls_context_to_sid(char oldc, 24int mls_context_to_sid(char oldc,
25 char **scontext, 25 char **scontext,
26 struct context *context); 26 struct context *context,
27 struct sidtab *s,
28 u32 def_sid);
27 29
28int mls_convert_context(struct policydb *oldp, 30int mls_convert_context(struct policydb *oldp,
29 struct policydb *newp, 31 struct policydb *newp,
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index bfa5a7dd6cf5..45d317044cb2 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -601,18 +601,7 @@ out:
601 601
602} 602}
603 603
604/** 604static int security_context_to_sid_core(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
605 * security_context_to_sid - Obtain a SID for a given security context.
606 * @scontext: security context
607 * @scontext_len: length in bytes
608 * @sid: security identifier, SID
609 *
610 * Obtains a SID associated with the security context that
611 * has the string representation specified by @scontext.
612 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
613 * memory is available, or 0 on success.
614 */
615int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
616{ 605{
617 char *scontext2; 606 char *scontext2;
618 struct context context; 607 struct context context;
@@ -703,7 +692,7 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
703 692
704 context.type = typdatum->value; 693 context.type = typdatum->value;
705 694
706 rc = mls_context_to_sid(oldc, &p, &context); 695 rc = mls_context_to_sid(oldc, &p, &context, &sidtab, def_sid);
707 if (rc) 696 if (rc)
708 goto out_unlock; 697 goto out_unlock;
709 698
@@ -727,6 +716,46 @@ out:
727 return rc; 716 return rc;
728} 717}
729 718
719/**
720 * security_context_to_sid - Obtain a SID for a given security context.
721 * @scontext: security context
722 * @scontext_len: length in bytes
723 * @sid: security identifier, SID
724 *
725 * Obtains a SID associated with the security context that
726 * has the string representation specified by @scontext.
727 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
728 * memory is available, or 0 on success.
729 */
730int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
731{
732 return security_context_to_sid_core(scontext, scontext_len,
733 sid, SECSID_NULL);
734}
735
736/**
737 * security_context_to_sid_default - Obtain a SID for a given security context,
738 * falling back to specified default if needed.
739 *
740 * @scontext: security context
741 * @scontext_len: length in bytes
742 * @sid: security identifier, SID
743 * @def_sid: default SID to assign on errror
744 *
745 * Obtains a SID associated with the security context that
746 * has the string representation specified by @scontext.
747 * The default SID is passed to the MLS layer to be used to allow
748 * kernel labeling of the MLS field if the MLS field is not present
749 * (for upgrading to MLS without full relabel).
750 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
751 * memory is available, or 0 on success.
752 */
753int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
754{
755 return security_context_to_sid_core(scontext, scontext_len,
756 sid, def_sid);
757}
758
730static int compute_sid_handle_invalid_context( 759static int compute_sid_handle_invalid_context(
731 struct context *scontext, 760 struct context *scontext,
732 struct context *tcontext, 761 struct context *tcontext,
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig
index 34c1740aa6e9..2e4a5e0d16db 100644
--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -20,5 +20,17 @@ config SND_ARMAACI
20 select SND_PCM 20 select SND_PCM
21 select SND_AC97_CODEC 21 select SND_AC97_CODEC
22 22
23endmenu 23config SND_PXA2XX_PCM
24 tristate
25 select SND_PCM
26
27config SND_PXA2XX_AC97
28 tristate "AC97 driver for the Intel PXA2xx chip"
29 depends on ARCH_PXA && SND
30 select SND_PXA2XX_PCM
31 select SND_AC97_CODEC
32 help
33 Say Y or M if you want to support any AC97 codec attached to
34 the PXA2xx AC97 interface.
24 35
36endmenu
diff --git a/sound/arm/Makefile b/sound/arm/Makefile
index f74ec28e1068..103f136926d9 100644
--- a/sound/arm/Makefile
+++ b/sound/arm/Makefile
@@ -3,9 +3,11 @@
3# 3#
4 4
5snd-sa11xx-uda1341-objs := sa11xx-uda1341.o 5snd-sa11xx-uda1341-objs := sa11xx-uda1341.o
6snd-aaci-objs := aaci.o devdma.o
7snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
8snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
6 9
7# Toplevel Module Dependency
8obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o 10obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o
9
10obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o 11obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o
11snd-aaci-objs := aaci.o devdma.o 12obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o
13obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
new file mode 100644
index 000000000000..46052304e230
--- /dev/null
+++ b/sound/arm/pxa2xx-ac97.c
@@ -0,0 +1,410 @@
1/*
2 * linux/sound/pxa2xx-ac97.c -- AC97 support for the Intel PXA2xx chip.
3 *
4 * Author: Nicolas Pitre
5 * Created: Dec 02, 2004
6 * Copyright: MontaVista Software Inc.
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#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/device.h>
17#include <linux/interrupt.h>
18#include <linux/wait.h>
19#include <linux/delay.h>
20
21#include <sound/driver.h>
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/ac97_codec.h>
25#include <sound/initval.h>
26
27#include <asm/irq.h>
28#include <asm/semaphore.h>
29#include <asm/hardware.h>
30#include <asm/arch/pxa-regs.h>
31#include <asm/arch/audio.h>
32
33#include "pxa2xx-pcm.h"
34
35
36static DECLARE_MUTEX(car_mutex);
37static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
38static volatile long gsr_bits;
39
40static unsigned short pxa2xx_ac97_read(ac97_t *ac97, unsigned short reg)
41{
42 unsigned short val = -1;
43 volatile u32 *reg_addr;
44
45 down(&car_mutex);
46 if (CAR & CAR_CAIP) {
47 printk(KERN_CRIT"%s: CAR_CAIP already set\n", __FUNCTION__);
48 goto out;
49 }
50
51 /* set up primary or secondary codec space */
52 reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
53 reg_addr += (reg >> 1);
54
55 /* start read access across the ac97 link */
56 gsr_bits = 0;
57 val = *reg_addr;
58 if (reg == AC97_GPIO_STATUS)
59 goto out;
60 wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1);
61 if (!gsr_bits & GSR_SDONE) {
62 printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n",
63 __FUNCTION__, reg, gsr_bits);
64 val = -1;
65 goto out;
66 }
67
68 /* valid data now */
69 gsr_bits = 0;
70 val = *reg_addr;
71 /* but we've just started another cycle... */
72 wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1);
73
74out: up(&car_mutex);
75 return val;
76}
77
78static void pxa2xx_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
79{
80 volatile u32 *reg_addr;
81
82 down(&car_mutex);
83
84 if (CAR & CAR_CAIP) {
85 printk(KERN_CRIT "%s: CAR_CAIP already set\n", __FUNCTION__);
86 goto out;
87 }
88
89 /* set up primary or secondary codec space */
90 reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
91 reg_addr += (reg >> 1);
92 gsr_bits = 0;
93 *reg_addr = val;
94 wait_event_timeout(gsr_wq, gsr_bits & GSR_CDONE, 1);
95 if (!gsr_bits & GSR_SDONE)
96 printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
97 __FUNCTION__, reg, gsr_bits);
98
99out: up(&car_mutex);
100}
101
102static void pxa2xx_ac97_reset(ac97_t *ac97)
103{
104 /* First, try cold reset */
105 GCR &= GCR_COLD_RST; /* clear everything but nCRST */
106 GCR &= ~GCR_COLD_RST; /* then assert nCRST */
107
108 gsr_bits = 0;
109#ifdef CONFIG_PXA27x
110 /* PXA27x Developers Manual section 13.5.2.2.1 */
111 pxa_set_cken(1 << 31, 1);
112 udelay(5);
113 pxa_set_cken(1 << 31, 0);
114 GCR = GCR_COLD_RST;
115 udelay(50);
116#else
117 GCR = GCR_COLD_RST;
118 GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
119 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
120#endif
121
122 if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
123 printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
124 __FUNCTION__, gsr_bits);
125
126 /* let's try warm reset */
127 gsr_bits = 0;
128#ifdef CONFIG_PXA27x
129 /* warm reset broken on Bulverde,
130 so manually keep AC97 reset high */
131 pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
132 udelay(10);
133 GCR |= GCR_WARM_RST;
134 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
135 udelay(50);
136#else
137 GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;;
138 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
139#endif
140
141 if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)))
142 printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
143 __FUNCTION__, gsr_bits);
144 }
145
146 GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
147 GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
148}
149
150static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id, struct pt_regs *regs)
151{
152 long status;
153
154 status = GSR;
155 if (status) {
156 GSR = status;
157 gsr_bits |= status;
158 wake_up(&gsr_wq);
159
160#ifdef CONFIG_PXA27x
161 /* Although we don't use those we still need to clear them
162 since they tend to spuriously trigger when MMC is used
163 (hardware bug? go figure)... */
164 MISR = MISR_EOC;
165 PISR = PISR_EOC;
166 MCSR = MCSR_EOC;
167#endif
168
169 return IRQ_HANDLED;
170 }
171
172 return IRQ_NONE;
173}
174
175static ac97_bus_ops_t pxa2xx_ac97_ops = {
176 .read = pxa2xx_ac97_read,
177 .write = pxa2xx_ac97_write,
178 .reset = pxa2xx_ac97_reset,
179};
180
181static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_out = {
182 .name = "AC97 PCM out",
183 .dev_addr = __PREG(PCDR),
184 .drcmr = &DRCMRTXPCDR,
185 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
186 DCMD_BURST32 | DCMD_WIDTH4,
187};
188
189static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_in = {
190 .name = "AC97 PCM in",
191 .dev_addr = __PREG(PCDR),
192 .drcmr = &DRCMRRXPCDR,
193 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
194 DCMD_BURST32 | DCMD_WIDTH4,
195};
196
197static snd_pcm_t *pxa2xx_ac97_pcm;
198static ac97_t *pxa2xx_ac97_ac97;
199
200static int pxa2xx_ac97_pcm_startup(snd_pcm_substream_t *substream)
201{
202 snd_pcm_runtime_t *runtime = substream->runtime;
203 pxa2xx_audio_ops_t *platform_ops;
204 int r;
205
206 runtime->hw.channels_min = 2;
207 runtime->hw.channels_max = 2;
208
209 r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
210 AC97_RATES_FRONT_DAC : AC97_RATES_ADC;
211 runtime->hw.rates = pxa2xx_ac97_ac97->rates[r];
212 snd_pcm_limit_hw_rates(runtime);
213
214 platform_ops = substream->pcm->card->dev->platform_data;
215 if (platform_ops && platform_ops->startup)
216 return platform_ops->startup(substream, platform_ops->priv);
217 else
218 return 0;
219}
220
221static void pxa2xx_ac97_pcm_shutdown(snd_pcm_substream_t *substream)
222{
223 pxa2xx_audio_ops_t *platform_ops;
224
225 platform_ops = substream->pcm->card->dev->platform_data;
226 if (platform_ops && platform_ops->shutdown)
227 platform_ops->shutdown(substream, platform_ops->priv);
228}
229
230static int pxa2xx_ac97_pcm_prepare(snd_pcm_substream_t *substream)
231{
232 snd_pcm_runtime_t *runtime = substream->runtime;
233 int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
234 AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
235 return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate);
236}
237
238static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = {
239 .playback_params = &pxa2xx_ac97_pcm_out,
240 .capture_params = &pxa2xx_ac97_pcm_in,
241 .startup = pxa2xx_ac97_pcm_startup,
242 .shutdown = pxa2xx_ac97_pcm_shutdown,
243 .prepare = pxa2xx_ac97_pcm_prepare,
244};
245
246#ifdef CONFIG_PM
247
248static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state)
249{
250 if (card->power_state != SNDRV_CTL_POWER_D3cold) {
251 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
252 snd_pcm_suspend_all(pxa2xx_ac97_pcm);
253 snd_ac97_suspend(pxa2xx_ac97_ac97);
254 snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
255 if (platform_ops && platform_ops->suspend)
256 platform_ops->suspend(platform_ops->priv);
257 GCR |= GCR_ACLINK_OFF;
258 pxa_set_cken(CKEN2_AC97, 0);
259 }
260
261 return 0;
262}
263
264static int pxa2xx_ac97_do_resume(snd_card_t *card, unsigned int state)
265{
266 if (card->power_state != SNDRV_CTL_POWER_D0) {
267 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
268 pxa_set_cken(CKEN2_AC97, 1);
269 if (platform_ops && platform_ops->resume)
270 platform_ops->resume(platform_ops->priv);
271 snd_ac97_resume(pxa2xx_ac97_ac97);
272 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
273 }
274
275 return 0;
276}
277
278static int pxa2xx_ac97_suspend(struct device *_dev, u32 state, u32 level)
279{
280 snd_card_t *card = dev_get_drvdata(_dev);
281 int ret = 0;
282
283 if (card && level == SUSPEND_DISABLE)
284 ret = pxa2xx_ac97_do_suspend(card, SNDRV_CTL_POWER_D3cold);
285
286 return ret;
287}
288
289static int pxa2xx_ac97_resume(struct device *_dev, u32 level)
290{
291 snd_card_t *card = dev_get_drvdata(_dev);
292 int ret = 0;
293
294 if (card && level == RESUME_ENABLE)
295 ret = pxa2xx_ac97_do_resume(card, SNDRV_CTL_POWER_D0);
296
297 return ret;
298}
299
300#else
301#define pxa2xx_ac97_suspend NULL
302#define pxa2xx_ac97_resume NULL
303#endif
304
305static int pxa2xx_ac97_probe(struct device *dev)
306{
307 snd_card_t *card;
308 ac97_bus_t *ac97_bus;
309 ac97_template_t ac97_template;
310 int ret;
311
312 ret = -ENOMEM;
313 card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
314 THIS_MODULE, 0);
315 if (!card)
316 goto err;
317
318 card->dev = dev;
319 strncpy(card->driver, dev->driver->name, sizeof(card->driver));
320
321 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
322 if (ret)
323 goto err;
324
325 ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
326 if (ret < 0)
327 goto err;
328
329 pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
330 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
331 pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
332 pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
333#ifdef CONFIG_PXA27x
334 /* Use GPIO 113 as AC97 Reset on Bulverde */
335 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
336#endif
337 pxa_set_cken(CKEN2_AC97, 1);
338
339 ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
340 if (ret)
341 goto err;
342 memset(&ac97_template, 0, sizeof(ac97_template));
343 ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
344 if (ret)
345 goto err;
346
347 snprintf(card->shortname, sizeof(card->shortname),
348 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
349 snprintf(card->longname, sizeof(card->longname),
350 "%s (%s)", dev->driver->name, card->mixername);
351
352 snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend,
353 pxa2xx_ac97_do_resume, NULL);
354 ret = snd_card_register(card);
355 if (ret == 0) {
356 dev_set_drvdata(dev, card);
357 return 0;
358 }
359
360 err:
361 if (card)
362 snd_card_free(card);
363 if (CKEN & CKEN2_AC97) {
364 GCR |= GCR_ACLINK_OFF;
365 free_irq(IRQ_AC97, NULL);
366 pxa_set_cken(CKEN2_AC97, 0);
367 }
368 return ret;
369}
370
371static int pxa2xx_ac97_remove(struct device *dev)
372{
373 snd_card_t *card = dev_get_drvdata(dev);
374
375 if (card) {
376 snd_card_free(card);
377 dev_set_drvdata(dev, NULL);
378 GCR |= GCR_ACLINK_OFF;
379 free_irq(IRQ_AC97, NULL);
380 pxa_set_cken(CKEN2_AC97, 0);
381 }
382
383 return 0;
384}
385
386static struct device_driver pxa2xx_ac97_driver = {
387 .name = "pxa2xx-ac97",
388 .bus = &platform_bus_type,
389 .probe = pxa2xx_ac97_probe,
390 .remove = pxa2xx_ac97_remove,
391 .suspend = pxa2xx_ac97_suspend,
392 .resume = pxa2xx_ac97_resume,
393};
394
395static int __init pxa2xx_ac97_init(void)
396{
397 return driver_register(&pxa2xx_ac97_driver);
398}
399
400static void __exit pxa2xx_ac97_exit(void)
401{
402 driver_unregister(&pxa2xx_ac97_driver);
403}
404
405module_init(pxa2xx_ac97_init);
406module_exit(pxa2xx_ac97_exit);
407
408MODULE_AUTHOR("Nicolas Pitre");
409MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
410MODULE_LICENSE("GPL");
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c
new file mode 100644
index 000000000000..b1eb53b02eae
--- /dev/null
+++ b/sound/arm/pxa2xx-pcm.c
@@ -0,0 +1,367 @@
1/*
2 * linux/sound/arm/pxa2xx-pcm.c -- ALSA PCM interface for the Intel PXA2xx chip
3 *
4 * Author: Nicolas Pitre
5 * Created: Nov 30, 2004
6 * Copyright: (C) 2004 MontaVista Software, Inc.
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#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/device.h>
16#include <linux/slab.h>
17#include <linux/dma-mapping.h>
18
19#include <sound/driver.h>
20#include <sound/core.h>
21#include <sound/pcm.h>
22#include <sound/pcm_params.h>
23
24#include <asm/dma.h>
25#include <asm/hardware.h>
26#include <asm/arch/pxa-regs.h>
27
28#include "pxa2xx-pcm.h"
29
30
31static const snd_pcm_hardware_t pxa2xx_pcm_hardware = {
32 .info = SNDRV_PCM_INFO_MMAP |
33 SNDRV_PCM_INFO_MMAP_VALID |
34 SNDRV_PCM_INFO_INTERLEAVED |
35 SNDRV_PCM_INFO_PAUSE,
36 .formats = SNDRV_PCM_FMTBIT_S16_LE,
37 .period_bytes_min = 32,
38 .period_bytes_max = 8192 - 32,
39 .periods_min = 1,
40 .periods_max = PAGE_SIZE/sizeof(pxa_dma_desc),
41 .buffer_bytes_max = 128 * 1024,
42 .fifo_size = 32,
43};
44
45struct pxa2xx_runtime_data {
46 int dma_ch;
47 pxa2xx_pcm_dma_params_t *params;
48 pxa_dma_desc *dma_desc_array;
49 dma_addr_t dma_desc_array_phys;
50};
51
52static int pxa2xx_pcm_hw_params(snd_pcm_substream_t *substream,
53 snd_pcm_hw_params_t *params)
54{
55 snd_pcm_runtime_t *runtime = substream->runtime;
56 struct pxa2xx_runtime_data *rtd = runtime->private_data;
57 size_t totsize = params_buffer_bytes(params);
58 size_t period = params_period_bytes(params);
59 pxa_dma_desc *dma_desc;
60 dma_addr_t dma_buff_phys, next_desc_phys;
61
62 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
63 runtime->dma_bytes = totsize;
64
65 dma_desc = rtd->dma_desc_array;
66 next_desc_phys = rtd->dma_desc_array_phys;
67 dma_buff_phys = runtime->dma_addr;
68 do {
69 next_desc_phys += sizeof(pxa_dma_desc);
70 dma_desc->ddadr = next_desc_phys;
71 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
72 dma_desc->dsadr = dma_buff_phys;
73 dma_desc->dtadr = rtd->params->dev_addr;
74 } else {
75 dma_desc->dsadr = rtd->params->dev_addr;
76 dma_desc->dtadr = dma_buff_phys;
77 }
78 if (period > totsize)
79 period = totsize;
80 dma_desc->dcmd = rtd->params->dcmd | period | DCMD_ENDIRQEN;
81 dma_desc++;
82 dma_buff_phys += period;
83 } while (totsize -= period);
84 dma_desc[-1].ddadr = rtd->dma_desc_array_phys;
85
86 return 0;
87}
88
89static int pxa2xx_pcm_hw_free(snd_pcm_substream_t *substream)
90{
91 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
92
93 *rtd->params->drcmr = 0;
94 snd_pcm_set_runtime_buffer(substream, NULL);
95 return 0;
96}
97
98static int pxa2xx_pcm_prepare(snd_pcm_substream_t *substream)
99{
100 pxa2xx_pcm_client_t *client = substream->private_data;
101 snd_pcm_runtime_t *runtime = substream->runtime;
102 struct pxa2xx_runtime_data *rtd = runtime->private_data;
103
104 DCSR(rtd->dma_ch) &= ~DCSR_RUN;
105 DCSR(rtd->dma_ch) = 0;
106 DCMD(rtd->dma_ch) = 0;
107 *rtd->params->drcmr = rtd->dma_ch | DRCMR_MAPVLD;
108
109 return client->prepare(substream);
110}
111
112static int pxa2xx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
113{
114 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
115 int ret = 0;
116
117 switch (cmd) {
118 case SNDRV_PCM_TRIGGER_START:
119 DDADR(rtd->dma_ch) = rtd->dma_desc_array_phys;
120 DCSR(rtd->dma_ch) = DCSR_RUN;
121 break;
122
123 case SNDRV_PCM_TRIGGER_STOP:
124 case SNDRV_PCM_TRIGGER_SUSPEND:
125 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
126 DCSR(rtd->dma_ch) &= ~DCSR_RUN;
127 break;
128
129 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
130 DCSR(rtd->dma_ch) |= DCSR_RUN;
131 break;
132
133 default:
134 ret = -EINVAL;
135 }
136
137 return ret;
138}
139
140static void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id, struct pt_regs *regs)
141{
142 snd_pcm_substream_t *substream = dev_id;
143 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
144 int dcsr;
145
146 dcsr = DCSR(dma_ch);
147 DCSR(dma_ch) = dcsr & ~DCSR_STOPIRQEN;
148
149 if (dcsr & DCSR_ENDINTR) {
150 snd_pcm_period_elapsed(substream);
151 } else {
152 printk( KERN_ERR "%s: DMA error on channel %d (DCSR=%#x)\n",
153 rtd->params->name, dma_ch, dcsr );
154 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
155 }
156}
157
158static snd_pcm_uframes_t pxa2xx_pcm_pointer(snd_pcm_substream_t *substream)
159{
160 snd_pcm_runtime_t *runtime = substream->runtime;
161 struct pxa2xx_runtime_data *rtd = runtime->private_data;
162 dma_addr_t ptr = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
163 DSADR(rtd->dma_ch) : DTADR(rtd->dma_ch);
164 snd_pcm_uframes_t x = bytes_to_frames(runtime, ptr - runtime->dma_addr);
165 if (x == runtime->buffer_size)
166 x = 0;
167 return x;
168}
169
170static int
171pxa2xx_pcm_hw_rule_mult32(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *rule)
172{
173 snd_interval_t *i = hw_param_interval(params, rule->var);
174 int changed = 0;
175
176 if (i->min & 31) {
177 i->min = (i->min & ~31) + 32;
178 i->openmin = 0;
179 changed = 1;
180 }
181
182 if (i->max & 31) {
183 i->max &= ~31;
184 i->openmax = 0;
185 changed = 1;
186 }
187
188 return changed;
189}
190
191static int pxa2xx_pcm_open(snd_pcm_substream_t *substream)
192{
193 pxa2xx_pcm_client_t *client = substream->private_data;
194 snd_pcm_runtime_t *runtime = substream->runtime;
195 struct pxa2xx_runtime_data *rtd;
196 int ret;
197
198 runtime->hw = pxa2xx_pcm_hardware;
199
200 /*
201 * For mysterious reasons (and despite what the manual says)
202 * playback samples are lost if the DMA count is not a multiple
203 * of the DMA burst size. Let's add a rule to enforce that.
204 */
205 ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
206 pxa2xx_pcm_hw_rule_mult32, NULL,
207 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -1);
208 if (ret)
209 goto out;
210 ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
211 pxa2xx_pcm_hw_rule_mult32, NULL,
212 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
213 if (ret)
214 goto out;
215
216 ret = -ENOMEM;
217 rtd = kmalloc(sizeof(*rtd), GFP_KERNEL);
218 if (!rtd)
219 goto out;
220 rtd->dma_desc_array =
221 dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
222 &rtd->dma_desc_array_phys, GFP_KERNEL);
223 if (!rtd->dma_desc_array)
224 goto err1;
225
226 rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
227 client->playback_params : client->capture_params;
228 ret = pxa_request_dma(rtd->params->name, DMA_PRIO_LOW,
229 pxa2xx_pcm_dma_irq, substream);
230 if (ret < 0)
231 goto err2;
232 rtd->dma_ch = ret;
233
234 runtime->private_data = rtd;
235 ret = client->startup(substream);
236 if (!ret)
237 goto out;
238
239 pxa_free_dma(rtd->dma_ch);
240 err2:
241 dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
242 rtd->dma_desc_array, rtd->dma_desc_array_phys);
243 err1:
244 kfree(rtd);
245 out:
246 return ret;
247}
248
249static int pxa2xx_pcm_close(snd_pcm_substream_t *substream)
250{
251 pxa2xx_pcm_client_t *client = substream->private_data;
252 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
253
254 pxa_free_dma(rtd->dma_ch);
255 client->shutdown(substream);
256 dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
257 rtd->dma_desc_array, rtd->dma_desc_array_phys);
258 kfree(rtd);
259 return 0;
260}
261
262static int
263pxa2xx_pcm_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *vma)
264{
265 snd_pcm_runtime_t *runtime = substream->runtime;
266 return dma_mmap_writecombine(substream->pcm->card->dev, vma,
267 runtime->dma_area,
268 runtime->dma_addr,
269 runtime->dma_bytes);
270}
271
272static snd_pcm_ops_t pxa2xx_pcm_ops = {
273 .open = pxa2xx_pcm_open,
274 .close = pxa2xx_pcm_close,
275 .ioctl = snd_pcm_lib_ioctl,
276 .hw_params = pxa2xx_pcm_hw_params,
277 .hw_free = pxa2xx_pcm_hw_free,
278 .prepare = pxa2xx_pcm_prepare,
279 .trigger = pxa2xx_pcm_trigger,
280 .pointer = pxa2xx_pcm_pointer,
281 .mmap = pxa2xx_pcm_mmap,
282};
283
284static int pxa2xx_pcm_preallocate_dma_buffer(snd_pcm_t *pcm, int stream)
285{
286 snd_pcm_substream_t *substream = pcm->streams[stream].substream;
287 struct snd_dma_buffer *buf = &substream->dma_buffer;
288 size_t size = pxa2xx_pcm_hardware.buffer_bytes_max;
289 buf->dev.type = SNDRV_DMA_TYPE_DEV;
290 buf->dev.dev = pcm->card->dev;
291 buf->private_data = NULL;
292 buf->area = dma_alloc_writecombine(pcm->card->dev, size,
293 &buf->addr, GFP_KERNEL);
294 if (!buf->area)
295 return -ENOMEM;
296 buf->bytes = size;
297 return 0;
298}
299
300static void pxa2xx_pcm_free_dma_buffers(snd_pcm_t *pcm)
301{
302 snd_pcm_substream_t *substream;
303 struct snd_dma_buffer *buf;
304 int stream;
305
306 for (stream = 0; stream < 2; stream++) {
307 substream = pcm->streams[stream].substream;
308 if (!substream)
309 continue;
310 buf = &substream->dma_buffer;
311 if (!buf->area)
312 continue;
313 dma_free_writecombine(pcm->card->dev, buf->bytes,
314 buf->area, buf->addr);
315 buf->area = NULL;
316 }
317}
318
319static u64 pxa2xx_pcm_dmamask = 0xffffffff;
320
321int pxa2xx_pcm_new(snd_card_t *card, pxa2xx_pcm_client_t *client, snd_pcm_t **rpcm)
322{
323 snd_pcm_t *pcm;
324 int play = client->playback_params ? 1 : 0;
325 int capt = client->capture_params ? 1 : 0;
326 int ret;
327
328 ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm);
329 if (ret)
330 goto out;
331
332 pcm->private_data = client;
333 pcm->private_free = pxa2xx_pcm_free_dma_buffers;
334
335 if (!card->dev->dma_mask)
336 card->dev->dma_mask = &pxa2xx_pcm_dmamask;
337 if (!card->dev->coherent_dma_mask)
338 card->dev->coherent_dma_mask = 0xffffffff;
339
340 if (play) {
341 int stream = SNDRV_PCM_STREAM_PLAYBACK;
342 snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);
343 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);
344 if (ret)
345 goto out;
346 }
347 if (capt) {
348 int stream = SNDRV_PCM_STREAM_CAPTURE;
349 snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);
350 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);
351 if (ret)
352 goto out;
353 }
354
355 if (rpcm)
356 *rpcm = pcm;
357 ret = 0;
358
359 out:
360 return ret;
361}
362
363EXPORT_SYMBOL(pxa2xx_pcm_new);
364
365MODULE_AUTHOR("Nicolas Pitre");
366MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module");
367MODULE_LICENSE("GPL");
diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h
new file mode 100644
index 000000000000..43517597cab9
--- /dev/null
+++ b/sound/arm/pxa2xx-pcm.h
@@ -0,0 +1,29 @@
1/*
2 * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip
3 *
4 * Author: Nicolas Pitre
5 * Created: Nov 30, 2004
6 * Copyright: MontaVista Software, Inc.
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
13typedef struct {
14 char *name; /* stream identifier */
15 u32 dcmd; /* DMA descriptor dcmd field */
16 volatile u32 *drcmr; /* the DMA request channel to use */
17 u32 dev_addr; /* device physical address for DMA */
18} pxa2xx_pcm_dma_params_t;
19
20typedef struct {
21 pxa2xx_pcm_dma_params_t *playback_params;
22 pxa2xx_pcm_dma_params_t *capture_params;
23 int (*startup)(snd_pcm_substream_t *);
24 void (*shutdown)(snd_pcm_substream_t *);
25 int (*prepare)(snd_pcm_substream_t *);
26} pxa2xx_pcm_client_t;
27
28extern int pxa2xx_pcm_new(snd_card_t *, pxa2xx_pcm_client_t *, snd_pcm_t **);
29
diff --git a/sound/core/device.c b/sound/core/device.c
index 18c71f913d2a..ca00ad7740c9 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -28,7 +28,7 @@
28/** 28/**
29 * snd_device_new - create an ALSA device component 29 * snd_device_new - create an ALSA device component
30 * @card: the card instance 30 * @card: the card instance
31 * @type: the device type, SNDRV_DEV_TYPE_XXX 31 * @type: the device type, SNDRV_DEV_XXX
32 * @device_data: the data pointer of this device 32 * @device_data: the data pointer of this device
33 * @ops: the operator table 33 * @ops: the operator table
34 * 34 *
@@ -46,7 +46,9 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type,
46{ 46{
47 snd_device_t *dev; 47 snd_device_t *dev;
48 48
49 snd_assert(card != NULL && device_data != NULL && ops != NULL, return -ENXIO); 49 snd_assert(card != NULL, return -ENXIO);
50 snd_assert(device_data != NULL, return -ENXIO);
51 snd_assert(ops != NULL, return -ENXIO);
50 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); 52 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
51 if (dev == NULL) 53 if (dev == NULL)
52 return -ENOMEM; 54 return -ENOMEM;
@@ -102,7 +104,7 @@ int snd_device_free(snd_card_t *card, void *device_data)
102} 104}
103 105
104/** 106/**
105 * snd_device_free - disconnect the device 107 * snd_device_disconnect - disconnect the device
106 * @card: the card instance 108 * @card: the card instance
107 * @device_data: the data pointer to disconnect 109 * @device_data: the data pointer to disconnect
108 * 110 *
@@ -118,7 +120,7 @@ int snd_device_disconnect(snd_card_t *card, void *device_data)
118{ 120{
119 struct list_head *list; 121 struct list_head *list;
120 snd_device_t *dev; 122 snd_device_t *dev;
121 123
122 snd_assert(card != NULL, return -ENXIO); 124 snd_assert(card != NULL, return -ENXIO);
123 snd_assert(device_data != NULL, return -ENXIO); 125 snd_assert(device_data != NULL, return -ENXIO);
124 list_for_each(list, &card->devices) { 126 list_for_each(list, &card->devices) {
@@ -154,8 +156,9 @@ int snd_device_register(snd_card_t *card, void *device_data)
154 struct list_head *list; 156 struct list_head *list;
155 snd_device_t *dev; 157 snd_device_t *dev;
156 int err; 158 int err;
157 159
158 snd_assert(card != NULL && device_data != NULL, return -ENXIO); 160 snd_assert(card != NULL, return -ENXIO);
161 snd_assert(device_data != NULL, return -ENXIO);
159 list_for_each(list, &card->devices) { 162 list_for_each(list, &card->devices) {
160 dev = snd_device(list); 163 dev = snd_device(list);
161 if (dev->device_data != device_data) 164 if (dev->device_data != device_data)
diff --git a/sound/core/info.c b/sound/core/info.c
index 5e122bbe7c92..7f8bdf7b0058 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -702,7 +702,7 @@ int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len)
702} 702}
703 703
704/** 704/**
705 * snd_info_get_line - parse a string token 705 * snd_info_get_str - parse a string token
706 * @dest: the buffer to store the string token 706 * @dest: the buffer to store the string token
707 * @src: the original string 707 * @src: the original string
708 * @len: the max. length of token - 1 708 * @len: the max. length of token - 1
@@ -939,7 +939,8 @@ int snd_info_unregister(snd_info_entry_t * entry)
939{ 939{
940 struct proc_dir_entry *root; 940 struct proc_dir_entry *root;
941 941
942 snd_assert(entry != NULL && entry->p != NULL, return -ENXIO); 942 snd_assert(entry != NULL, return -ENXIO);
943 snd_assert(entry->p != NULL, return -ENXIO);
943 root = entry->parent == NULL ? snd_proc_root : entry->parent->p; 944 root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
944 snd_assert(root, return -ENXIO); 945 snd_assert(root, return -ENXIO);
945 down(&info_mutex); 946 down(&info_mutex);
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index dbc23e35fa06..02132561c3f8 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -105,7 +105,8 @@ struct snd_mem_list {
105 */ 105 */
106 106
107static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, 107static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,
108 dma_addr_t *dma_handle, int flags) 108 dma_addr_t *dma_handle,
109 unsigned int __nocast flags)
109{ 110{
110 void *ret; 111 void *ret;
111 u64 dma_mask, coherent_dma_mask; 112 u64 dma_mask, coherent_dma_mask;
diff --git a/sound/core/memory.c b/sound/core/memory.c
index c1fb28e84330..f6895577bf86 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -89,7 +89,7 @@ void snd_memory_done(void)
89 } 89 }
90} 90}
91 91
92static void *__snd_kmalloc(size_t size, int flags, void *caller) 92static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller)
93{ 93{
94 unsigned long cpu_flags; 94 unsigned long cpu_flags;
95 struct snd_alloc_track *t; 95 struct snd_alloc_track *t;
@@ -111,12 +111,12 @@ static void *__snd_kmalloc(size_t size, int flags, void *caller)
111} 111}
112 112
113#define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); 113#define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0));
114void *snd_hidden_kmalloc(size_t size, int flags) 114void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags)
115{ 115{
116 return _snd_kmalloc(size, flags); 116 return _snd_kmalloc(size, flags);
117} 117}
118 118
119void *snd_hidden_kcalloc(size_t n, size_t size, int flags) 119void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags)
120{ 120{
121 void *ret = NULL; 121 void *ret = NULL;
122 if (n != 0 && size > INT_MAX / n) 122 if (n != 0 && size > INT_MAX / n)
@@ -184,7 +184,7 @@ void snd_hidden_vfree(void *obj)
184 snd_wrapper_vfree(obj); 184 snd_wrapper_vfree(obj);
185} 185}
186 186
187char *snd_hidden_kstrdup(const char *s, int flags) 187char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags)
188{ 188{
189 int len; 189 int len;
190 char *buf; 190 char *buf;
diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile
index 64cb50d7b589..402e2b4a34c6 100644
--- a/sound/core/seq/Makefile
+++ b/sound/core/seq/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_SND_VIRMIDI) += snd-seq-virmidi.o snd-seq-midi-event.o
38obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o 38obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o
39obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o 39obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
40obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o 40obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
41obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-instr.o 41obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-midi-emul.o snd-seq-instr.o
42obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o 42obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o
43obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o 43obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o
44obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o 44obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
index 0779c41ca037..32e91c6b25fe 100644
--- a/sound/core/seq/instr/ainstr_gf1.c
+++ b/sound/core/seq/instr/ainstr_gf1.c
@@ -50,7 +50,8 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
50{ 50{
51 gf1_wave_t *wp, *prev; 51 gf1_wave_t *wp, *prev;
52 gf1_xwave_t xp; 52 gf1_xwave_t xp;
53 int err, gfp_mask; 53 int err;
54 unsigned int gfp_mask;
54 unsigned int real_size; 55 unsigned int real_size;
55 56
56 gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; 57 gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
index 39ff72b2aab3..2622b8679ca7 100644
--- a/sound/core/seq/instr/ainstr_iw.c
+++ b/sound/core/seq/instr/ainstr_iw.c
@@ -58,7 +58,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
58 iwffff_xenv_t *ex, 58 iwffff_xenv_t *ex,
59 char __user **data, 59 char __user **data,
60 long *len, 60 long *len,
61 int gfp_mask) 61 unsigned int __nocast gfp_mask)
62{ 62{
63 __u32 stype; 63 __u32 stype;
64 iwffff_env_record_t *rp, *rp_last; 64 iwffff_env_record_t *rp, *rp_last;
@@ -128,7 +128,8 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
128{ 128{
129 iwffff_wave_t *wp, *prev; 129 iwffff_wave_t *wp, *prev;
130 iwffff_xwave_t xp; 130 iwffff_xwave_t xp;
131 int err, gfp_mask; 131 int err;
132 unsigned int gfp_mask;
132 unsigned int real_size; 133 unsigned int real_size;
133 134
134 gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; 135 gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
@@ -234,7 +235,8 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
234 iwffff_xinstrument_t ix; 235 iwffff_xinstrument_t ix;
235 iwffff_layer_t *lp, *prev_lp; 236 iwffff_layer_t *lp, *prev_lp;
236 iwffff_xlayer_t lx; 237 iwffff_xlayer_t lx;
237 int err, gfp_mask; 238 int err;
239 unsigned int gfp_mask;
238 240
239 if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) 241 if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
240 return -EINVAL; 242 return -EINVAL;
diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h
index da23c4db8dd5..973786758c55 100644
--- a/sound/core/seq/oss/seq_oss_device.h
+++ b/sound/core/seq/oss/seq_oss_device.h
@@ -158,21 +158,21 @@ void snd_seq_oss_readq_info_read(seq_oss_readq_t *q, snd_info_buffer_t *buf);
158#define is_nonblock_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK) 158#define is_nonblock_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_NONBLOCK)
159 159
160/* dispatch event */ 160/* dispatch event */
161inline static int 161static inline int
162snd_seq_oss_dispatch(seq_oss_devinfo_t *dp, snd_seq_event_t *ev, int atomic, int hop) 162snd_seq_oss_dispatch(seq_oss_devinfo_t *dp, snd_seq_event_t *ev, int atomic, int hop)
163{ 163{
164 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop); 164 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);
165} 165}
166 166
167/* ioctl */ 167/* ioctl */
168inline static int 168static inline int
169snd_seq_oss_control(seq_oss_devinfo_t *dp, unsigned int type, void *arg) 169snd_seq_oss_control(seq_oss_devinfo_t *dp, unsigned int type, void *arg)
170{ 170{
171 return snd_seq_kernel_client_ctl(dp->cseq, type, arg); 171 return snd_seq_kernel_client_ctl(dp->cseq, type, arg);
172} 172}
173 173
174/* fill the addresses in header */ 174/* fill the addresses in header */
175inline static void 175static inline void
176snd_seq_oss_fill_addr(seq_oss_devinfo_t *dp, snd_seq_event_t *ev, 176snd_seq_oss_fill_addr(seq_oss_devinfo_t *dp, snd_seq_event_t *ev,
177 int dest_client, int dest_port) 177 int dest_client, int dest_port)
178{ 178{
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 00d841e82fbc..03acb2d519ba 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -36,12 +36,12 @@
36#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem) 36#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
37 37
38 38
39inline static int snd_seq_pool_available(pool_t *pool) 39static inline int snd_seq_pool_available(pool_t *pool)
40{ 40{
41 return pool->total_elements - atomic_read(&pool->counter); 41 return pool->total_elements - atomic_read(&pool->counter);
42} 42}
43 43
44inline static int snd_seq_output_ok(pool_t *pool) 44static inline int snd_seq_output_ok(pool_t *pool)
45{ 45{
46 return snd_seq_pool_available(pool) >= pool->room; 46 return snd_seq_pool_available(pool) >= pool->room;
47} 47}
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index 57be9155eb62..4374829ea770 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -134,7 +134,7 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; 134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data;
135 unsigned char msg[10]; /* buffer for constructing midi messages */ 135 unsigned char msg[10]; /* buffer for constructing midi messages */
136 snd_rawmidi_substream_t *substream; 136 snd_rawmidi_substream_t *substream;
137 int res; 137 int len;
138 138
139 snd_assert(msynth != NULL, return -EINVAL); 139 snd_assert(msynth != NULL, return -EINVAL);
140 substream = msynth->output_rfile.output; 140 substream = msynth->output_rfile.output;
@@ -146,20 +146,16 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
146 snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); 146 snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags);
147 return 0; 147 return 0;
148 } 148 }
149 res = snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); 149 snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
150 snd_midi_event_reset_decode(msynth->parser); 150 snd_midi_event_reset_decode(msynth->parser);
151 if (res < 0)
152 return res;
153 } else { 151 } else {
154 if (msynth->parser == NULL) 152 if (msynth->parser == NULL)
155 return -EIO; 153 return -EIO;
156 res = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); 154 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev);
157 if (res < 0) 155 if (len < 0)
158 return res; 156 return 0;
159 if ((res = dump_midi(substream, msg, res)) < 0) { 157 if (dump_midi(substream, msg, len) < 0)
160 snd_midi_event_reset_decode(msynth->parser); 158 snd_midi_event_reset_decode(msynth->parser);
161 return res;
162 }
163 } 159 }
164 return 0; 160 return 0;
165} 161}
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
index df1e2bb39745..603b63716db6 100644
--- a/sound/core/seq/seq_midi_event.c
+++ b/sound/core/seq/seq_midi_event.c
@@ -146,7 +146,7 @@ void snd_midi_event_free(snd_midi_event_t *dev)
146/* 146/*
147 * initialize record 147 * initialize record
148 */ 148 */
149inline static void reset_encode(snd_midi_event_t *dev) 149static inline void reset_encode(snd_midi_event_t *dev)
150{ 150{
151 dev->read = 0; 151 dev->read = 0;
152 dev->qlen = 0; 152 dev->qlen = 0;
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c
index 9f393023c327..508e6d67ee19 100644
--- a/sound/core/wrappers.c
+++ b/sound/core/wrappers.c
@@ -27,7 +27,7 @@
27#include <linux/fs.h> 27#include <linux/fs.h>
28 28
29#ifdef CONFIG_SND_DEBUG_MEMORY 29#ifdef CONFIG_SND_DEBUG_MEMORY
30void *snd_wrapper_kmalloc(size_t size, int flags) 30void *snd_wrapper_kmalloc(size_t size, unsigned int __nocast flags)
31{ 31{
32 return kmalloc(size, flags); 32 return kmalloc(size, flags);
33} 33}
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 964b97e70c84..986df35fb829 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -168,7 +168,7 @@ typedef struct _snd_uart16550 {
168 168
169static snd_card_t *snd_serial_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 169static snd_card_t *snd_serial_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
170 170
171inline static void snd_uart16550_add_timer(snd_uart16550_t *uart) 171static inline void snd_uart16550_add_timer(snd_uart16550_t *uart)
172{ 172{
173 if (! uart->timer_running) { 173 if (! uart->timer_running) {
174 /* timer 38600bps * 10bit * 16byte */ 174 /* timer 38600bps * 10bit * 16byte */
@@ -178,7 +178,7 @@ inline static void snd_uart16550_add_timer(snd_uart16550_t *uart)
178 } 178 }
179} 179}
180 180
181inline static void snd_uart16550_del_timer(snd_uart16550_t *uart) 181static inline void snd_uart16550_del_timer(snd_uart16550_t *uart)
182{ 182{
183 if (uart->timer_running) { 183 if (uart->timer_running) {
184 del_timer(&uart->buffer_timer); 184 del_timer(&uart->buffer_timer);
@@ -187,7 +187,7 @@ inline static void snd_uart16550_del_timer(snd_uart16550_t *uart)
187} 187}
188 188
189/* This macro is only used in snd_uart16550_io_loop */ 189/* This macro is only used in snd_uart16550_io_loop */
190inline static void snd_uart16550_buffer_output(snd_uart16550_t *uart) 190static inline void snd_uart16550_buffer_output(snd_uart16550_t *uart)
191{ 191{
192 unsigned short buff_out = uart->buff_out; 192 unsigned short buff_out = uart->buff_out;
193 if( uart->buff_in_count > 0 ) { 193 if( uart->buff_in_count > 0 ) {
@@ -579,7 +579,7 @@ static int snd_uart16550_output_close(snd_rawmidi_substream_t * substream)
579 return 0; 579 return 0;
580}; 580};
581 581
582inline static int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num ) 582static inline int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num )
583{ 583{
584 if( uart->buff_in_count + Num < TX_BUFF_SIZE ) 584 if( uart->buff_in_count + Num < TX_BUFF_SIZE )
585 return 1; 585 return 1;
@@ -587,7 +587,7 @@ inline static int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num
587 return 0; 587 return 0;
588} 588}
589 589
590inline static int snd_uart16550_write_buffer(snd_uart16550_t *uart, unsigned char byte) 590static inline int snd_uart16550_write_buffer(snd_uart16550_t *uart, unsigned char byte)
591{ 591{
592 unsigned short buff_in = uart->buff_in; 592 unsigned short buff_in = uart->buff_in;
593 if( uart->buff_in_count < TX_BUFF_SIZE ) { 593 if( uart->buff_in_count < TX_BUFF_SIZE ) {
diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c
index 18114713c3b3..4fc38bde34f4 100644
--- a/sound/drivers/vx/vx_uer.c
+++ b/sound/drivers/vx/vx_uer.c
@@ -162,34 +162,24 @@ static int vx_read_uer_status(vx_core_t *chip, int *mode)
162 162
163static int vx_calc_clock_from_freq(vx_core_t *chip, int freq) 163static int vx_calc_clock_from_freq(vx_core_t *chip, int freq)
164{ 164{
165#define XX_FECH48000 0x0000004B 165 int hexfreq;
166#define XX_FECH32000 0x00000171 166
167#define XX_FECH24000 0x0000024B 167 snd_assert(freq > 0, return 0);
168#define XX_FECH16000 0x00000371 168
169#define XX_FECH12000 0x0000044B 169 hexfreq = (28224000 * 10) / freq;
170#define XX_FECH8000 0x00000571 170 hexfreq = (hexfreq + 5) / 10;
171#define XX_FECH44100 0x0000007F 171
172#define XX_FECH29400 0x0000016F 172 /* max freq = 55125 Hz */
173#define XX_FECH22050 0x0000027F 173 snd_assert(hexfreq > 0x00000200, return 0);
174#define XX_FECH14000 0x000003EF 174
175#define XX_FECH11025 0x0000047F 175 if (hexfreq <= 0x03ff)
176#define XX_FECH7350 0x000005BF 176 return hexfreq - 0x00000201;
177 177 if (hexfreq <= 0x07ff)
178 switch (freq) { 178 return (hexfreq / 2) - 1;
179 case 48000: return XX_FECH48000; 179 if (hexfreq <= 0x0fff)
180 case 44100: return XX_FECH44100; 180 return (hexfreq / 4) + 0x000001ff;
181 case 32000: return XX_FECH32000; 181
182 case 29400: return XX_FECH29400; 182 return 0x5fe; /* min freq = 6893 Hz */
183 case 24000: return XX_FECH24000;
184 case 22050: return XX_FECH22050;
185 case 16000: return XX_FECH16000;
186 case 14000: return XX_FECH14000;
187 case 12000: return XX_FECH12000;
188 case 11025: return XX_FECH11025;
189 case 8000: return XX_FECH8000;
190 case 7350: return XX_FECH7350;
191 default: return freq; /* The value is already correct */
192 }
193} 183}
194 184
195 185
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index f5e6018ea3f4..5adde308a00f 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -554,7 +554,6 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
554 if (snd_pcm_running(ak4114->capture_substream)) { 554 if (snd_pcm_running(ak4114->capture_substream)) {
555 // printk("rate changed (%i <- %i)\n", runtime->rate, res); 555 // printk("rate changed (%i <- %i)\n", runtime->rate, res);
556 snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING); 556 snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING);
557 wake_up(&runtime->sleep);
558 res = 1; 557 res = 1;
559 } 558 }
560 snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags); 559 snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags);
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 94bbd344be5e..a636d9ce3502 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -417,11 +417,13 @@ static int snd_gus_check_version(snd_gus_card_t * gus)
417 return 0; 417 return 0;
418} 418}
419 419
420#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
420static void snd_gus_seq_dev_free(snd_seq_device_t *seq_dev) 421static void snd_gus_seq_dev_free(snd_seq_device_t *seq_dev)
421{ 422{
422 snd_gus_card_t *gus = seq_dev->private_data; 423 snd_gus_card_t *gus = seq_dev->private_data;
423 gus->seq_dev = NULL; 424 gus->seq_dev = NULL;
424} 425}
426#endif
425 427
426int snd_gus_initialize(snd_gus_card_t *gus) 428int snd_gus_initialize(snd_gus_card_t *gus)
427{ 429{
diff --git a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c
index 4afc4a1bc140..26e693078cb3 100644
--- a/sound/isa/sb/emu8000_patch.c
+++ b/sound/isa/sb/emu8000_patch.c
@@ -128,7 +128,7 @@ snd_emu8000_write_wait(emu8000_t *emu)
128 * This is therefore much slower than need be, but is at least 128 * This is therefore much slower than need be, but is at least
129 * working. 129 * working.
130 */ 130 */
131inline static void 131static inline void
132write_word(emu8000_t *emu, int *offset, unsigned short data) 132write_word(emu8000_t *emu, int *offset, unsigned short data)
133{ 133{
134 if (emu8000_reset_addr) { 134 if (emu8000_reset_addr) {
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index cc5a2c6dec16..ff4b59968027 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -688,7 +688,7 @@ static struct sbmix_elem snd_als4000_ctl_3d_poweroff_switch =
688 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); 688 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01);
689static struct sbmix_elem snd_als4000_ctl_3d_delay = 689static struct sbmix_elem snd_als4000_ctl_3d_delay =
690 SB_SINGLE("3D Delay", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f); 690 SB_SINGLE("3D Delay", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f);
691#if NOT_AVAILABLE 691#ifdef NOT_AVAILABLE
692static struct sbmix_elem snd_als4000_ctl_fmdac = 692static struct sbmix_elem snd_als4000_ctl_fmdac =
693 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01); 693 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01);
694static struct sbmix_elem snd_als4000_ctl_qsound = 694static struct sbmix_elem snd_als4000_ctl_qsound =
@@ -723,7 +723,7 @@ static struct sbmix_elem *snd_als4000_controls[] = {
723 &snd_als4000_ctl_3d_output_ratio, 723 &snd_als4000_ctl_3d_output_ratio,
724 &snd_als4000_ctl_3d_delay, 724 &snd_als4000_ctl_3d_delay,
725 &snd_als4000_ctl_3d_poweroff_switch, 725 &snd_als4000_ctl_3d_poweroff_switch,
726#if NOT_AVAILABLE 726#ifdef NOT_AVAILABLE
727 &snd_als4000_ctl_fmdac, 727 &snd_als4000_ctl_fmdac,
728 &snd_als4000_ctl_qsound, 728 &snd_als4000_ctl_qsound,
729#endif 729#endif
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 0e13623f69f0..32379688eed4 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -34,7 +34,7 @@
34 34
35/* weird stuff, derived from port I/O tracing with dosemu */ 35/* weird stuff, derived from port I/O tracing with dosemu */
36 36
37unsigned char page_zero[] __initdata = { 37static unsigned char page_zero[] __initdata = {
380x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 380x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00,
390x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00, 390x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00,
400x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00, 400x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00,
@@ -61,7 +61,7 @@ unsigned char page_zero[] __initdata = {
610x1d, 0x02, 0xdf 610x1d, 0x02, 0xdf
62}; 62};
63 63
64unsigned char page_one[] __initdata = { 64static unsigned char page_one[] __initdata = {
650x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 650x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00,
660x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00, 660x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00,
670x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, 670x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01,
@@ -88,7 +88,7 @@ unsigned char page_one[] __initdata = {
880x60, 0x00, 0x1b 880x60, 0x00, 0x1b
89}; 89};
90 90
91unsigned char page_two[] __initdata = { 91static unsigned char page_two[] __initdata = {
920xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4, 920xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4,
930x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 930x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00,
940x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 940x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -103,7 +103,7 @@ unsigned char page_two[] __initdata = {
1030x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44 1030x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44
104}; 104};
105 105
106unsigned char page_three[] __initdata = { 106static unsigned char page_three[] __initdata = {
1070x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06, 1070x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06,
1080x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1080x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -118,7 +118,7 @@ unsigned char page_three[] __initdata = {
1180x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40 1180x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40
119}; 119};
120 120
121unsigned char page_four[] __initdata = { 121static unsigned char page_four[] __initdata = {
1220x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02, 1220x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02,
1230x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1230x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -133,7 +133,7 @@ unsigned char page_four[] __initdata = {
1330x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01 1330x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01
134}; 134};
135 135
136unsigned char page_six[] __initdata = { 136static unsigned char page_six[] __initdata = {
1370x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 1370x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00,
1380x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e, 1380x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e,
1390x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00, 1390x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00,
@@ -154,7 +154,7 @@ unsigned char page_six[] __initdata = {
1540x80, 0x00, 0x7e, 0x80, 0x80 1540x80, 0x00, 0x7e, 0x80, 0x80
155}; 155};
156 156
157unsigned char page_seven[] __initdata = { 157static unsigned char page_seven[] __initdata = {
1580x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 1580x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00,
1590x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 1590x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
1600x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f, 1600x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f,
@@ -181,7 +181,7 @@ unsigned char page_seven[] __initdata = {
1810x00, 0x02, 0x00 1810x00, 0x02, 0x00
182}; 182};
183 183
184unsigned char page_zero_v2[] __initdata = { 184static unsigned char page_zero_v2[] __initdata = {
1850x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1850x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -193,7 +193,7 @@ unsigned char page_zero_v2[] __initdata = {
1930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 1930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
194}; 194};
195 195
196unsigned char page_one_v2[] __initdata = { 196static unsigned char page_one_v2[] __initdata = {
1970x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 1970x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,
1980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -205,21 +205,21 @@ unsigned char page_one_v2[] __initdata = {
2050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 2050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
206}; 206};
207 207
208unsigned char page_two_v2[] __initdata = { 208static unsigned char page_two_v2[] __initdata = {
2090x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2090x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2100x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2100x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2130x00, 0x00, 0x00, 0x00 2130x00, 0x00, 0x00, 0x00
214}; 214};
215unsigned char page_three_v2[] __initdata = { 215static unsigned char page_three_v2[] __initdata = {
2160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2170x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2170x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2180x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2180x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2190x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2190x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2200x00, 0x00, 0x00, 0x00 2200x00, 0x00, 0x00, 0x00
221}; 221};
222unsigned char page_four_v2[] __initdata = { 222static unsigned char page_four_v2[] __initdata = {
2230x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2230x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2250x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2250x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -227,7 +227,7 @@ unsigned char page_four_v2[] __initdata = {
2270x00, 0x00, 0x00, 0x00 2270x00, 0x00, 0x00, 0x00
228}; 228};
229 229
230unsigned char page_seven_v2[] __initdata = { 230static unsigned char page_seven_v2[] __initdata = {
2310x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2310x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2330x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2330x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -239,7 +239,7 @@ unsigned char page_seven_v2[] __initdata = {
2390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 2390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
240}; 240};
241 241
242unsigned char mod_v2[] __initdata = { 242static unsigned char mod_v2[] __initdata = {
2430x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, 2430x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02,
2440x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05, 2440x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05,
2450x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0, 2450x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0,
@@ -269,7 +269,7 @@ unsigned char mod_v2[] __initdata = {
2690x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01, 2690x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01,
2700x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01 2700x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01
271}; 271};
272unsigned char coefficients[] __initdata = { 272static unsigned char coefficients[] __initdata = {
2730x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03, 2730x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03,
2740x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 2740x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49,
2750x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01, 2750x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01,
@@ -305,14 +305,14 @@ unsigned char coefficients[] __initdata = {
3050x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02, 3050x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02,
3060xba 3060xba
307}; 307};
308unsigned char coefficients2[] __initdata = { 308static unsigned char coefficients2[] __initdata = {
3090x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f, 3090x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f,
3100xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d, 3100xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d,
3110x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07, 3110x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07,
3120x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00, 3120x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00,
3130x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00 3130x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00
314}; 314};
315unsigned char coefficients3[] __initdata = { 315static unsigned char coefficients3[] __initdata = {
3160x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00, 3160x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00,
3170x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc, 3170x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc,
3180x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01, 3180x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01,
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 2704e1598add..2ceb46f1d40f 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -1557,7 +1557,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
1557/* All the burgundy functions: */ 1557/* All the burgundy functions: */
1558 1558
1559/* Waits for busy flag to clear */ 1559/* Waits for busy flag to clear */
1560inline static void 1560static inline void
1561awacs_burgundy_busy_wait(void) 1561awacs_burgundy_busy_wait(void)
1562{ 1562{
1563 int count = 50; /* > 2 samples at 44k1 */ 1563 int count = 50; /* > 2 samples at 44k1 */
@@ -1565,7 +1565,7 @@ awacs_burgundy_busy_wait(void)
1565 udelay(1) ; 1565 udelay(1) ;
1566} 1566}
1567 1567
1568inline static void 1568static inline void
1569awacs_burgundy_extend_wait(void) 1569awacs_burgundy_extend_wait(void)
1570{ 1570{
1571 int count = 50 ; /* > 2 samples at 44k1 */ 1571 int count = 50 ; /* > 2 samples at 44k1 */
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index 3ed38765dcc4..a617ccb40e00 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -714,7 +714,7 @@ static int __init attach_pss(struct address_info *hw_config)
714 714
715 disable_all_emulations(); 715 disable_all_emulations();
716 716
717#if YOU_REALLY_WANT_TO_ALLOCATE_THESE_RESOURCES 717#ifdef YOU_REALLY_WANT_TO_ALLOCATE_THESE_RESOURCES
718 if (sound_alloc_dma(hw_config->dma, "PSS")) 718 if (sound_alloc_dma(hw_config->dma, "PSS"))
719 { 719 {
720 printk("pss.c: Can't allocate DMA channel.\n"); 720 printk("pss.c: Can't allocate DMA channel.\n");
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a4b72cd2eea0..6983eea226da 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -367,6 +367,7 @@ int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value)
367 ac97->regs[reg] = value; 367 ac97->regs[reg] = value;
368 ac97->bus->ops->write(ac97, reg, value); 368 ac97->bus->ops->write(ac97, reg, value);
369 } 369 }
370 set_bit(reg, ac97->reg_accessed);
370 up(&ac97->reg_mutex); 371 up(&ac97->reg_mutex);
371 return change; 372 return change;
372} 373}
@@ -410,6 +411,7 @@ int snd_ac97_update_bits_nolock(ac97_t *ac97, unsigned short reg,
410 ac97->regs[reg] = new; 411 ac97->regs[reg] = new;
411 ac97->bus->ops->write(ac97, reg, new); 412 ac97->bus->ops->write(ac97, reg, new);
412 } 413 }
414 set_bit(reg, ac97->reg_accessed);
413 return change; 415 return change;
414} 416}
415 417
@@ -1076,6 +1078,11 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max
1076 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { 1078 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
1077 unsigned short val; 1079 unsigned short val;
1078 snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); 1080 snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));
1081 /* Do the read twice due to buffers on some ac97 codecs.
1082 * e.g. The STAC9704 returns exactly what you wrote the the register
1083 * if you read it immediately. This causes the detect routine to fail.
1084 */
1085 val = snd_ac97_read(ac97, reg);
1079 val = snd_ac97_read(ac97, reg); 1086 val = snd_ac97_read(ac97, reg);
1080 if (! *lo_max && (val & 0x7f) == cbit[i]) 1087 if (! *lo_max && (val & 0x7f) == cbit[i])
1081 *lo_max = max[i]; 1088 *lo_max = max[i];
@@ -2224,7 +2231,7 @@ void snd_ac97_restore_iec958(ac97_t *ac97)
2224 */ 2231 */
2225void snd_ac97_resume(ac97_t *ac97) 2232void snd_ac97_resume(ac97_t *ac97)
2226{ 2233{
2227 int i; 2234 unsigned long end_time;
2228 2235
2229 if (ac97->bus->ops->reset) { 2236 if (ac97->bus->ops->reset) {
2230 ac97->bus->ops->reset(ac97); 2237 ac97->bus->ops->reset(ac97);
@@ -2242,26 +2249,26 @@ void snd_ac97_resume(ac97_t *ac97)
2242 snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); 2249 snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]);
2243 if (ac97_is_audio(ac97)) { 2250 if (ac97_is_audio(ac97)) {
2244 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101); 2251 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101);
2245 for (i = HZ/10; i >= 0; i--) { 2252 end_time = jiffies + msecs_to_jiffies(100);
2253 do {
2246 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) 2254 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
2247 break; 2255 break;
2248 set_current_state(TASK_UNINTERRUPTIBLE); 2256 set_current_state(TASK_UNINTERRUPTIBLE);
2249 schedule_timeout(1); 2257 schedule_timeout(1);
2250 } 2258 } while (time_after_eq(end_time, jiffies));
2251 /* FIXME: extra delay */ 2259 /* FIXME: extra delay */
2252 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); 2260 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
2253 if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) { 2261 if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000)
2254 set_current_state(TASK_UNINTERRUPTIBLE); 2262 msleep(250);
2255 schedule_timeout(HZ/4);
2256 }
2257 } else { 2263 } else {
2258 for (i = HZ/10; i >= 0; i--) { 2264 end_time = jiffies + msecs_to_jiffies(100);
2265 do {
2259 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); 2266 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
2260 if (val != 0xffff && (val & 1) != 0) 2267 if (val != 0xffff && (val & 1) != 0)
2261 break; 2268 break;
2262 set_current_state(TASK_UNINTERRUPTIBLE); 2269 set_current_state(TASK_UNINTERRUPTIBLE);
2263 schedule_timeout(1); 2270 schedule_timeout(1);
2264 } 2271 } while (time_after_eq(end_time, jiffies));
2265 } 2272 }
2266__reset_ready: 2273__reset_ready:
2267 2274
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index a15eb8522b7c..66edc857d3e6 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1528,6 +1528,9 @@ static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = {
1528 }, 1528 },
1529 AC97_SURROUND_JACK_MODE_CTL, 1529 AC97_SURROUND_JACK_MODE_CTL,
1530 AC97_CHANNEL_MODE_CTL, 1530 AC97_CHANNEL_MODE_CTL,
1531
1532 AC97_SINGLE("Headphone Jack Sense", AC97_AD_JACK_SPDIF, 10, 1, 0),
1533 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),
1531}; 1534};
1532 1535
1533static int patch_ad1888_specific(ac97_t *ac97) 1536static int patch_ad1888_specific(ac97_t *ac97)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index eb5c36d31a52..f08ae71f902d 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -399,7 +399,7 @@ static int snd_ali_codec_ready( ali_t *codec,
399 unsigned long end_time; 399 unsigned long end_time;
400 unsigned int res; 400 unsigned int res;
401 401
402 end_time = jiffies + 10 * (HZ >> 2); 402 end_time = jiffies + 10 * msecs_to_jiffies(250);
403 do { 403 do {
404 res = snd_ali_5451_peek(codec,port); 404 res = snd_ali_5451_peek(codec,port);
405 if (! (res & 0x8000)) 405 if (! (res & 0x8000))
@@ -422,7 +422,7 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched)
422 dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); 422 dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER);
423 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); 423 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
424 424
425 end_time = jiffies + 10 * (HZ >> 2); 425 end_time = jiffies + 10 * msecs_to_jiffies(250);
426 do { 426 do {
427 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); 427 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
428 if (dwChk2 != dwChk1) 428 if (dwChk2 != dwChk1)
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index a6b4b8d589fd..8d2002951bd7 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -265,6 +265,7 @@ struct snd_atiixp {
265 */ 265 */
266static struct pci_device_id snd_atiixp_ids[] = { 266static struct pci_device_id snd_atiixp_ids[] = {
267 { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ 267 { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */
268 { 0x1002, 0x4378, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */
268 { 0, } 269 { 0, }
269}; 270};
270 271
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index b4503385ea69..f5a4ac1ceef9 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -306,7 +306,7 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
306#define CM_REG_FM_PCI 0x50 306#define CM_REG_FM_PCI 0x50
307 307
308/* 308/*
309 * for CMI-8338 .. this is not valid for CMI-8738. 309 * access from SB-mixer port
310 */ 310 */
311#define CM_REG_EXTENT_IND 0xf0 311#define CM_REG_EXTENT_IND 0xf0
312#define CM_VPHONE_MASK 0xe0 /* Phone volume control (0-3) << 5 */ 312#define CM_VPHONE_MASK 0xe0 /* Phone volume control (0-3) << 5 */
@@ -315,6 +315,7 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
315#define CM_VSPKM 0x08 /* Speaker mute control, default high */ 315#define CM_VSPKM 0x08 /* Speaker mute control, default high */
316#define CM_RLOOPREN 0x04 /* Rec. R-channel enable */ 316#define CM_RLOOPREN 0x04 /* Rec. R-channel enable */
317#define CM_RLOOPLEN 0x02 /* Rec. L-channel enable */ 317#define CM_RLOOPLEN 0x02 /* Rec. L-channel enable */
318#define CM_VADMIC3 0x01 /* Mic record boost */
318 319
319/* 320/*
320 * CMI-8338 spec ver 0.5 (this is not valid for CMI-8738): 321 * CMI-8338 spec ver 0.5 (this is not valid for CMI-8738):
@@ -488,32 +489,34 @@ struct snd_stru_cmipci {
488 489
489 490
490/* read/write operations for dword register */ 491/* read/write operations for dword register */
491inline static void snd_cmipci_write(cmipci_t *cm, unsigned int cmd, unsigned int data) 492static inline void snd_cmipci_write(cmipci_t *cm, unsigned int cmd, unsigned int data)
492{ 493{
493 outl(data, cm->iobase + cmd); 494 outl(data, cm->iobase + cmd);
494} 495}
495inline static unsigned int snd_cmipci_read(cmipci_t *cm, unsigned int cmd) 496
497static inline unsigned int snd_cmipci_read(cmipci_t *cm, unsigned int cmd)
496{ 498{
497 return inl(cm->iobase + cmd); 499 return inl(cm->iobase + cmd);
498} 500}
499 501
500/* read/write operations for word register */ 502/* read/write operations for word register */
501inline static void snd_cmipci_write_w(cmipci_t *cm, unsigned int cmd, unsigned short data) 503static inline void snd_cmipci_write_w(cmipci_t *cm, unsigned int cmd, unsigned short data)
502{ 504{
503 outw(data, cm->iobase + cmd); 505 outw(data, cm->iobase + cmd);
504} 506}
505inline static unsigned short snd_cmipci_read_w(cmipci_t *cm, unsigned int cmd) 507
508static inline unsigned short snd_cmipci_read_w(cmipci_t *cm, unsigned int cmd)
506{ 509{
507 return inw(cm->iobase + cmd); 510 return inw(cm->iobase + cmd);
508} 511}
509 512
510/* read/write operations for byte register */ 513/* read/write operations for byte register */
511inline static void snd_cmipci_write_b(cmipci_t *cm, unsigned int cmd, unsigned char data) 514static inline void snd_cmipci_write_b(cmipci_t *cm, unsigned int cmd, unsigned char data)
512{ 515{
513 outb(data, cm->iobase + cmd); 516 outb(data, cm->iobase + cmd);
514} 517}
515 518
516inline static unsigned char snd_cmipci_read_b(cmipci_t *cm, unsigned int cmd) 519static inline unsigned char snd_cmipci_read_b(cmipci_t *cm, unsigned int cmd)
517{ 520{
518 return inb(cm->iobase + cmd); 521 return inb(cm->iobase + cmd);
519} 522}
@@ -2133,8 +2136,12 @@ static snd_kcontrol_new_t snd_cmipci_mixers[] __devinitdata = {
2133 CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), 2136 CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15),
2134 CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), 2137 CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0),
2135 CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), 2138 CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0),
2136 CMIPCI_MIXER_SW_MONO("Mic Boost", CM_REG_MIXER2, CM_MICGAINZ_SHIFT, 1), 2139 CMIPCI_MIXER_SW_MONO("Mic Boost Playback Switch", CM_REG_MIXER2, CM_MICGAINZ_SHIFT, 1),
2137 CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), 2140 CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7),
2141 CMIPCI_SB_VOL_MONO("Phone Playback Volume", CM_REG_EXTENT_IND, 5, 7),
2142 CMIPCI_DOUBLE("Phone Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 4, 4, 1, 0, 0),
2143 CMIPCI_DOUBLE("PC Speaker Playnack Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0),
2144 CMIPCI_DOUBLE("Mic Boost Capture Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 0, 0, 1, 0, 0),
2138}; 2145};
2139 2146
2140/* 2147/*
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index eb3c52b03af3..c7a370d4f923 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -542,7 +542,7 @@ static void snd_cs4281_delay(unsigned int delay)
542 } 542 }
543} 543}
544 544
545inline static void snd_cs4281_delay_long(void) 545static inline void snd_cs4281_delay_long(void)
546{ 546{
547 set_current_state(TASK_UNINTERRUPTIBLE); 547 set_current_state(TASK_UNINTERRUPTIBLE);
548 schedule_timeout(1); 548 schedule_timeout(1);
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fd4c50c88bc9..ff28af1f658e 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -2400,8 +2400,7 @@ static void snd_cs46xx_codec_reset (ac97_t * ac97)
2400 if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05) 2400 if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05)
2401 return; 2401 return;
2402 2402
2403 set_current_state(TASK_UNINTERRUPTIBLE); 2403 msleep(10);
2404 schedule_timeout(HZ/100);
2405 } while (time_after_eq(end_time, jiffies)); 2404 } while (time_after_eq(end_time, jiffies));
2406 2405
2407 snd_printk("CS46xx secondary codec dont respond!\n"); 2406 snd_printk("CS46xx secondary codec dont respond!\n");
@@ -2435,8 +2434,7 @@ static int __devinit cs46xx_detect_codec(cs46xx_t *chip, int codec)
2435 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97[codec]); 2434 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97[codec]);
2436 return err; 2435 return err;
2437 } 2436 }
2438 set_current_state(TASK_INTERRUPTIBLE); 2437 msleep(10);
2439 schedule_timeout(HZ/100);
2440 } 2438 }
2441 snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec); 2439 snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec);
2442 return -ENXIO; 2440 return -ENXIO;
@@ -3018,8 +3016,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip)
3018 /* 3016 /*
3019 * Wait until the PLL has stabilized. 3017 * Wait until the PLL has stabilized.
3020 */ 3018 */
3021 set_current_state(TASK_UNINTERRUPTIBLE); 3019 msleep(100);
3022 schedule_timeout(HZ/10); /* 100ms */
3023 3020
3024 /* 3021 /*
3025 * Turn on clocking of the core so that we can setup the serial ports. 3022 * Turn on clocking of the core so that we can setup the serial ports.
@@ -3072,8 +3069,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip)
3072 */ 3069 */
3073 if (snd_cs46xx_peekBA0(chip, BA0_ACSTS) & ACSTS_CRDY) 3070 if (snd_cs46xx_peekBA0(chip, BA0_ACSTS) & ACSTS_CRDY)
3074 goto ok1; 3071 goto ok1;
3075 set_current_state(TASK_UNINTERRUPTIBLE); 3072 msleep(10);
3076 schedule_timeout((HZ+99)/100);
3077 } 3073 }
3078 3074
3079 3075
@@ -3122,8 +3118,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip)
3122 */ 3118 */
3123 if ((snd_cs46xx_peekBA0(chip, BA0_ACISV) & (ACISV_ISV3 | ACISV_ISV4)) == (ACISV_ISV3 | ACISV_ISV4)) 3119 if ((snd_cs46xx_peekBA0(chip, BA0_ACISV) & (ACISV_ISV3 | ACISV_ISV4)) == (ACISV_ISV3 | ACISV_ISV4))
3124 goto ok2; 3120 goto ok2;
3125 set_current_state(TASK_UNINTERRUPTIBLE); 3121 msleep(10);
3126 schedule_timeout((HZ+99)/100);
3127 } 3122 }
3128 3123
3129#ifndef CONFIG_SND_CS46XX_NEW_DSP 3124#ifndef CONFIG_SND_CS46XX_NEW_DSP
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 2085a998eaeb..b17142cabead 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -52,6 +52,7 @@ static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
52static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 52static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
53static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 53static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
54static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 54static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
55static uint subsystem[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* Force card subsystem model */
55 56
56module_param_array(index, int, NULL, 0444); 57module_param_array(index, int, NULL, 0444);
57MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); 58MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");
@@ -71,7 +72,8 @@ module_param_array(max_buffer_size, int, NULL, 0444);
71MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); 72MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB.");
72module_param_array(enable_ir, bool, NULL, 0444); 73module_param_array(enable_ir, bool, NULL, 0444);
73MODULE_PARM_DESC(enable_ir, "Enable IR."); 74MODULE_PARM_DESC(enable_ir, "Enable IR.");
74 75module_param_array(subsystem, uint, NULL, 0444);
76MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
75/* 77/*
76 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 78 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400
77 */ 79 */
@@ -122,7 +124,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
122 max_buffer_size[dev] = 1024; 124 max_buffer_size[dev] = 1024;
123 if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], 125 if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
124 (long)max_buffer_size[dev] * 1024 * 1024, 126 (long)max_buffer_size[dev] * 1024 * 1024,
125 enable_ir[dev], 127 enable_ir[dev], subsystem[dev],
126 &emu)) < 0) { 128 &emu)) < 0) {
127 snd_card_free(card); 129 snd_card_free(card);
128 return err; 130 return err;
@@ -140,7 +142,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
140 return err; 142 return err;
141 } 143 }
142 /* This stores the periods table. */ 144 /* This stores the periods table. */
143 if (emu->audigy && emu->revision == 4) { /* P16V */ 145 if (emu->card_capabilities->ca0151_chip) { /* P16V */
144 if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1024, &emu->p16v_buffer) < 0) { 146 if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1024, &emu->p16v_buffer) < 0) {
145 snd_p16v_free(emu); 147 snd_p16v_free(emu);
146 return -ENOMEM; 148 return -ENOMEM;
@@ -161,7 +163,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
161 snd_card_free(card); 163 snd_card_free(card);
162 return err; 164 return err;
163 } 165 }
164 if (emu->audigy && emu->revision == 4) { /* P16V */ 166 if (emu->card_capabilities->ca0151_chip) { /* P16V */
165 if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) { 167 if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) {
166 snd_card_free(card); 168 snd_card_free(card);
167 return err; 169 return err;
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index a341e758acde..746b51ef3966 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -191,7 +191,7 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir)
191 /* Set playback routing. */ 191 /* Set playback routing. */
192 snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, 0x78e4); 192 snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, 0x78e4);
193 } 193 }
194 if (emu->audigy && (emu->serial == 0x10011102) ) { /* audigy2 Value */ 194 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
195 /* Hacks for Alice3 to work independent of haP16V driver */ 195 /* Hacks for Alice3 to work independent of haP16V driver */
196 u32 tmp; 196 u32 tmp;
197 197
@@ -253,6 +253,8 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir)
253 HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); 253 HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
254 else 254 else
255 outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); 255 outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
256 /* FIXME: Remove all these emu->model and replace it with a card recognition parameter,
257 * e.g. card_capabilities->joystick */
256 } else if (emu->model == 0x20 || 258 } else if (emu->model == 0x20 ||
257 emu->model == 0xc400 || 259 emu->model == 0xc400 ||
258 (emu->model == 0x21 && emu->revision < 6)) 260 (emu->model == 0x21 && emu->revision < 6))
@@ -299,12 +301,12 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir)
299 if (emu->audigy) { 301 if (emu->audigy) {
300 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); 302 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
301 303
302 if (emu->revision == 4) { /* audigy2 */ 304 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
303 /* Unmute Analog now. Set GPO6 to 1 for Apollo. 305 /* Unmute Analog now. Set GPO6 to 1 for Apollo.
304 * This has to be done after init ALice3 I2SOut beyond 48KHz. 306 * This has to be done after init ALice3 I2SOut beyond 48KHz.
305 * So, sequence is important. */ 307 * So, sequence is important. */
306 outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG); 308 outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG);
307 } else if (emu->serial == 0x10011102) { /* audigy2 value */ 309 } else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */
308 /* Unmute Analog now. */ 310 /* Unmute Analog now. */
309 outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG); 311 outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG);
310 } else { 312 } else {
@@ -614,6 +616,7 @@ static int snd_emu10k1_dev_free(snd_device_t *device)
614 616
615static emu_chip_details_t emu_chip_details[] = { 617static emu_chip_details_t emu_chip_details[] = {
616 /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/ 618 /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/
619 /* Tested by James@superbug.co.uk 3rd July 2005 */
617 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102, 620 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
618 .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]", 621 .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]",
619 .id = "Audigy2", 622 .id = "Audigy2",
@@ -627,6 +630,14 @@ static emu_chip_details_t emu_chip_details[] = {
627 .emu10k2_chip = 1, 630 .emu10k2_chip = 1,
628 .ca0108_chip = 1, 631 .ca0108_chip = 1,
629 .ac97_chip = 1} , 632 .ac97_chip = 1} ,
633 /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */
634 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
635 .driver = "Audigy2", .name = "E-mu 1212m [4001]",
636 .id = "EMU1212m",
637 .emu10k2_chip = 1,
638 .ca0102_chip = 1,
639 .ecard = 1} ,
640 /* Tested by James@superbug.co.uk 3rd July 2005 */
630 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, 641 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102,
631 .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", 642 .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]",
632 .id = "Audigy2", 643 .id = "Audigy2",
@@ -687,18 +698,18 @@ static emu_chip_details_t emu_chip_details[] = {
687 .ca0151_chip = 1, 698 .ca0151_chip = 1,
688 .spdif_bug = 1, 699 .spdif_bug = 1,
689 .ac97_chip = 1} , 700 .ac97_chip = 1} ,
690 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10020052, 701 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102,
691 .driver = "Audigy", .name = "Audigy 1 ES [SB0160]", 702 .driver = "Audigy", .name = "Audigy 1 [SB0090]",
692 .id = "Audigy", 703 .id = "Audigy",
693 .emu10k2_chip = 1, 704 .emu10k2_chip = 1,
694 .ca0102_chip = 1, 705 .ca0102_chip = 1,
695 .spdif_bug = 1,
696 .ac97_chip = 1} , 706 .ac97_chip = 1} ,
697 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102, 707 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102,
698 .driver = "Audigy", .name = "Audigy 1 [SB0090]", 708 .driver = "Audigy", .name = "Audigy 1 ES [SB0160]",
699 .id = "Audigy", 709 .id = "Audigy",
700 .emu10k2_chip = 1, 710 .emu10k2_chip = 1,
701 .ca0102_chip = 1, 711 .ca0102_chip = 1,
712 .spdif_bug = 1,
702 .ac97_chip = 1} , 713 .ac97_chip = 1} ,
703 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102, 714 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102,
704 .driver = "Audigy", .name = "Audigy 1 [SB0090]", 715 .driver = "Audigy", .name = "Audigy 1 [SB0090]",
@@ -712,54 +723,49 @@ static emu_chip_details_t emu_chip_details[] = {
712 .emu10k2_chip = 1, 723 .emu10k2_chip = 1,
713 .ca0102_chip = 1, 724 .ca0102_chip = 1,
714 .ac97_chip = 1} , 725 .ac97_chip = 1} ,
715 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102, 726 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102,
716 .driver = "EMU10K1", .name = "E-mu APS [4001]", 727 .driver = "EMU10K1", .name = "SBLive! [SB0105]",
717 .id = "APS",
718 .emu10k1_chip = 1,
719 .ecard = 1} ,
720 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
721 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]",
722 .id = "Live", 728 .id = "Live",
723 .emu10k1_chip = 1, 729 .emu10k1_chip = 1,
724 .ac97_chip = 1, 730 .ac97_chip = 1,
725 .sblive51 = 1} , 731 .sblive51 = 1} ,
726 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, 732 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102,
727 .driver = "EMU10K1", .name = "SB Live 5.1", 733 .driver = "EMU10K1", .name = "SBLive! Value [SB0103]",
728 .id = "Live", 734 .id = "Live",
729 .emu10k1_chip = 1, 735 .emu10k1_chip = 1,
730 .ac97_chip = 1, 736 .ac97_chip = 1,
731 .sblive51 = 1} , 737 .sblive51 = 1} ,
732 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, 738 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102,
733 .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", 739 .driver = "EMU10K1", .name = "SBLive! Value [SB0101]",
734 .id = "Live",
735 .emu10k1_chip = 1,
736 .ac97_chip = 1} ,
737 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
738 .driver = "EMU10K1", .name = "SBLive! [CT4620]",
739 .id = "Live", 740 .id = "Live",
740 .emu10k1_chip = 1, 741 .emu10k1_chip = 1,
741 .ac97_chip = 1, 742 .ac97_chip = 1,
742 .sblive51 = 1} , 743 .sblive51 = 1} ,
743 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102, 744 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
744 .driver = "EMU10K1", .name = "SBLive! Value [CT4670]", 745 .driver = "EMU10K1", .name = "SB Live 5.1",
745 .id = "Live", 746 .id = "Live",
746 .emu10k1_chip = 1, 747 .emu10k1_chip = 1,
747 .ac97_chip = 1, 748 .ac97_chip = 1,
748 .sblive51 = 1} , 749 .sblive51 = 1} ,
749 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102, 750 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
750 .driver = "EMU10K1", .name = "SBLive! Value [CT4780]", 751 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]",
751 .id = "Live", 752 .id = "Live",
752 .emu10k1_chip = 1, 753 .emu10k1_chip = 1,
753 .ac97_chip = 1, 754 .ac97_chip = 1,
754 .sblive51 = 1} , 755 .sblive51 = 1} ,
755 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102, 756 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
756 .driver = "EMU10K1", .name = "SB PCI512 [CT4790]", 757 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]",
757 .id = "Live", 758 .id = "Live",
758 .emu10k1_chip = 1, 759 .emu10k1_chip = 1,
759 .ac97_chip = 1, 760 .ac97_chip = 1,
760 .sblive51 = 1} , 761 .sblive51 = 1} ,
761 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102, 762 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102,
762 .driver = "EMU10K1", .name = "SBLive! Value [CT4830]", 763 .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]",
764 .id = "Live",
765 .emu10k1_chip = 1,
766 .ac97_chip = 1} ,
767 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102,
768 .driver = "EMU10K1", .name = "SBLive! Value [CT4871]",
763 .id = "Live", 769 .id = "Live",
764 .emu10k1_chip = 1, 770 .emu10k1_chip = 1,
765 .ac97_chip = 1, 771 .ac97_chip = 1,
@@ -770,50 +776,50 @@ static emu_chip_details_t emu_chip_details[] = {
770 .emu10k1_chip = 1, 776 .emu10k1_chip = 1,
771 .ac97_chip = 1, 777 .ac97_chip = 1,
772 .sblive51 = 1} , 778 .sblive51 = 1} ,
773 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, 779 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102,
774 .driver = "EMU10K1", .name = "SBLive! Value [CT4832]", 780 .driver = "EMU10K1", .name = "SBLive! Value [CT4870]",
775 .id = "Live", 781 .id = "Live",
776 .emu10k1_chip = 1, 782 .emu10k1_chip = 1,
777 .ac97_chip = 1, 783 .ac97_chip = 1,
778 .sblive51 = 1} , 784 .sblive51 = 1} ,
779 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, 785 /* Tested by James@superbug.co.uk 3rd July 2005 */
780 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 786 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102,
787 .driver = "EMU10K1", .name = "SBLive! Value [CT4832]",
781 .id = "Live", 788 .id = "Live",
782 .emu10k1_chip = 1, 789 .emu10k1_chip = 1,
783 .ac97_chip = 1, 790 .ac97_chip = 1,
784 .sblive51 = 1} , 791 .sblive51 = 1} ,
785 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102, 792 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102,
786 .driver = "EMU10K1", .name = "SBLive! Value [CT4870]", 793 .driver = "EMU10K1", .name = "SBLive! Value [CT4830]",
787 .id = "Live", 794 .id = "Live",
788 .emu10k1_chip = 1, 795 .emu10k1_chip = 1,
789 .ac97_chip = 1, 796 .ac97_chip = 1,
790 .sblive51 = 1} , 797 .sblive51 = 1} ,
791 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102, 798 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102,
792 .driver = "EMU10K1", .name = "SBLive! Value [CT4871]", 799 .driver = "EMU10K1", .name = "SB PCI512 [CT4790]",
793 .id = "Live", 800 .id = "Live",
794 .emu10k1_chip = 1, 801 .emu10k1_chip = 1,
795 .ac97_chip = 1, 802 .ac97_chip = 1,
796 .sblive51 = 1} , 803 .sblive51 = 1} ,
797 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 804 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102,
798 .driver = "EMU10K1", .name = "SBLive! Value [SB0060]", 805 .driver = "EMU10K1", .name = "SBLive! Value [CT4780]",
799 .id = "Live", 806 .id = "Live",
800 .emu10k1_chip = 1, 807 .emu10k1_chip = 1,
801 .ac97_chip = 1, 808 .ac97_chip = 1,
802 .sblive51 = 1} , 809 .sblive51 = 1} ,
803 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102, 810 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102,
804 .driver = "EMU10K1", .name = "SBLive! Value [SB0101]", 811 .driver = "EMU10K1", .name = "E-mu APS [4001]",
805 .id = "Live", 812 .id = "APS",
806 .emu10k1_chip = 1, 813 .emu10k1_chip = 1,
807 .ac97_chip = 1, 814 .ecard = 1} ,
808 .sblive51 = 1} , 815 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
809 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102, 816 .driver = "EMU10K1", .name = "SBLive! [CT4620]",
810 .driver = "EMU10K1", .name = "SBLive! Value [SB0103]",
811 .id = "Live", 817 .id = "Live",
812 .emu10k1_chip = 1, 818 .emu10k1_chip = 1,
813 .ac97_chip = 1, 819 .ac97_chip = 1,
814 .sblive51 = 1} , 820 .sblive51 = 1} ,
815 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102, 821 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102,
816 .driver = "EMU10K1", .name = "SBLive! [SB0105]", 822 .driver = "EMU10K1", .name = "SBLive! Value [CT4670]",
817 .id = "Live", 823 .id = "Live",
818 .emu10k1_chip = 1, 824 .emu10k1_chip = 1,
819 .ac97_chip = 1, 825 .ac97_chip = 1,
@@ -833,6 +839,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
833 unsigned short extout_mask, 839 unsigned short extout_mask,
834 long max_cache_bytes, 840 long max_cache_bytes,
835 int enable_ir, 841 int enable_ir,
842 uint subsystem,
836 emu10k1_t ** remu) 843 emu10k1_t ** remu)
837{ 844{
838 emu10k1_t *emu; 845 emu10k1_t *emu;
@@ -878,10 +885,16 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
878 885
879 for (c = emu_chip_details; c->vendor; c++) { 886 for (c = emu_chip_details; c->vendor; c++) {
880 if (c->vendor == pci->vendor && c->device == pci->device) { 887 if (c->vendor == pci->vendor && c->device == pci->device) {
881 if (c->subsystem && c->subsystem != emu->serial) 888 if (subsystem) {
882 continue; 889 if (c->subsystem && (c->subsystem == subsystem) ) {
883 if (c->revision && c->revision != emu->revision) 890 break;
884 continue; 891 } else continue;
892 } else {
893 if (c->subsystem && (c->subsystem != emu->serial) )
894 continue;
895 if (c->revision && c->revision != emu->revision)
896 continue;
897 }
885 break; 898 break;
886 } 899 }
887 } 900 }
@@ -892,10 +905,14 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
892 return -ENOENT; 905 return -ENOENT;
893 } 906 }
894 emu->card_capabilities = c; 907 emu->card_capabilities = c;
895 if (c->subsystem != 0) 908 if (c->subsystem && !subsystem)
896 snd_printdd("Sound card name=%s\n", c->name); 909 snd_printdd("Sound card name=%s\n", c->name);
897 else 910 else if (subsystem)
898 snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x\n", c->name, pci->vendor, pci->device, emu->serial); 911 snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n",
912 c->name, pci->vendor, pci->device, emu->serial, c->subsystem);
913 else
914 snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n",
915 c->name, pci->vendor, pci->device, emu->serial);
899 916
900 if (!*card->id && c->id) { 917 if (!*card->id && c->id) {
901 int i, n = 0; 918 int i, n = 0;
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index 7a595f0dd7a1..6afeaeab3e13 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -495,7 +495,7 @@ static int synth_free_pages(emu10k1_t *emu, emu10k1_memblk_t *blk)
495} 495}
496 496
497/* calculate buffer pointer from offset address */ 497/* calculate buffer pointer from offset address */
498inline static void *offset_ptr(emu10k1_t *emu, int page, int offset) 498static inline void *offset_ptr(emu10k1_t *emu, int page, int offset)
499{ 499{
500 char *ptr; 500 char *ptr;
501 snd_assert(page >= 0 && page < emu->max_cache_pages, return NULL); 501 snd_assert(page >= 0 && page < emu->max_cache_pages, return NULL);
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 98f980189892..a1691330d3b6 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -822,7 +822,7 @@ static int snd_p16v_volume_put_analog_unknown(snd_kcontrol_t * kcontrol,
822static snd_kcontrol_new_t snd_p16v_volume_control_analog_front = 822static snd_kcontrol_new_t snd_p16v_volume_control_analog_front =
823{ 823{
824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
825 .name = "HD Analog Front Volume", 825 .name = "HD Analog Front Playback Volume",
826 .info = snd_p16v_volume_info, 826 .info = snd_p16v_volume_info,
827 .get = snd_p16v_volume_get_analog_front, 827 .get = snd_p16v_volume_get_analog_front,
828 .put = snd_p16v_volume_put_analog_front 828 .put = snd_p16v_volume_put_analog_front
@@ -831,7 +831,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_front =
831static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe = 831static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe =
832{ 832{
833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
834 .name = "HD Analog Center/LFE Volume", 834 .name = "HD Analog Center/LFE Playback Volume",
835 .info = snd_p16v_volume_info, 835 .info = snd_p16v_volume_info,
836 .get = snd_p16v_volume_get_analog_center_lfe, 836 .get = snd_p16v_volume_get_analog_center_lfe,
837 .put = snd_p16v_volume_put_analog_center_lfe 837 .put = snd_p16v_volume_put_analog_center_lfe
@@ -840,7 +840,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe =
840static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown = 840static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown =
841{ 841{
842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
843 .name = "HD Analog Unknown Volume", 843 .name = "HD Analog Unknown Playback Volume",
844 .info = snd_p16v_volume_info, 844 .info = snd_p16v_volume_info,
845 .get = snd_p16v_volume_get_analog_unknown, 845 .get = snd_p16v_volume_get_analog_unknown,
846 .put = snd_p16v_volume_put_analog_unknown 846 .put = snd_p16v_volume_put_analog_unknown
@@ -849,7 +849,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown =
849static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear = 849static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear =
850{ 850{
851 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 851 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
852 .name = "HD Analog Rear Volume", 852 .name = "HD Analog Rear Playback Volume",
853 .info = snd_p16v_volume_info, 853 .info = snd_p16v_volume_info,
854 .get = snd_p16v_volume_get_analog_rear, 854 .get = snd_p16v_volume_get_analog_rear,
855 .put = snd_p16v_volume_put_analog_rear 855 .put = snd_p16v_volume_put_analog_rear
@@ -858,7 +858,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear =
858static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front = 858static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front =
859{ 859{
860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
861 .name = "HD SPDIF Front Volume", 861 .name = "HD SPDIF Front Playback Volume",
862 .info = snd_p16v_volume_info, 862 .info = snd_p16v_volume_info,
863 .get = snd_p16v_volume_get_spdif_front, 863 .get = snd_p16v_volume_get_spdif_front,
864 .put = snd_p16v_volume_put_spdif_front 864 .put = snd_p16v_volume_put_spdif_front
@@ -867,7 +867,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front =
867static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe = 867static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe =
868{ 868{
869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
870 .name = "HD SPDIF Center/LFE Volume", 870 .name = "HD SPDIF Center/LFE Playback Volume",
871 .info = snd_p16v_volume_info, 871 .info = snd_p16v_volume_info,
872 .get = snd_p16v_volume_get_spdif_center_lfe, 872 .get = snd_p16v_volume_get_spdif_center_lfe,
873 .put = snd_p16v_volume_put_spdif_center_lfe 873 .put = snd_p16v_volume_put_spdif_center_lfe
@@ -876,7 +876,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe =
876static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown = 876static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown =
877{ 877{
878 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 878 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
879 .name = "HD SPDIF Unknown Volume", 879 .name = "HD SPDIF Unknown Playback Volume",
880 .info = snd_p16v_volume_info, 880 .info = snd_p16v_volume_info,
881 .get = snd_p16v_volume_get_spdif_unknown, 881 .get = snd_p16v_volume_get_spdif_unknown,
882 .put = snd_p16v_volume_put_spdif_unknown 882 .put = snd_p16v_volume_put_spdif_unknown
@@ -885,7 +885,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown =
885static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear = 885static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear =
886{ 886{
887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
888 .name = "HD SPDIF Rear Volume", 888 .name = "HD SPDIF Rear Playback Volume",
889 .info = snd_p16v_volume_info, 889 .info = snd_p16v_volume_info,
890 .get = snd_p16v_volume_get_spdif_rear, 890 .get = snd_p16v_volume_get_spdif_rear,
891 .put = snd_p16v_volume_put_spdif_rear 891 .put = snd_p16v_volume_put_spdif_rear
@@ -936,7 +936,7 @@ static int snd_p16v_capture_source_put(snd_kcontrol_t * kcontrol,
936static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata = 936static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata =
937{ 937{
938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
939 .name = "HD Capture source", 939 .name = "HD source Capture",
940 .info = snd_p16v_capture_source_info, 940 .info = snd_p16v_capture_source_info,
941 .get = snd_p16v_capture_source_get, 941 .get = snd_p16v_capture_source_get,
942 .put = snd_p16v_capture_source_put 942 .put = snd_p16v_capture_source_put
@@ -985,7 +985,7 @@ static int snd_p16v_capture_channel_put(snd_kcontrol_t * kcontrol,
985static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata = 985static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata =
986{ 986{
987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
988 .name = "HD Capture channel", 988 .name = "HD channel Capture",
989 .info = snd_p16v_capture_channel_info, 989 .info = snd_p16v_capture_channel_info,
990 .get = snd_p16v_capture_channel_get, 990 .get = snd_p16v_capture_channel_get,
991 .put = snd_p16v_capture_channel_put 991 .put = snd_p16v_capture_channel_put
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 4e63498a58b2..78a81f3912a1 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -685,6 +685,15 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97,
685 return 0; 685 return 0;
686} 686}
687 687
688static void snd_es1371_codec_wait(ac97_t *ac97)
689{
690 msleep(750);
691 snd_es1371_codec_read(ac97, AC97_RESET);
692 snd_es1371_codec_read(ac97, AC97_VENDOR_ID1);
693 snd_es1371_codec_read(ac97, AC97_VENDOR_ID2);
694 msleep(50);
695}
696
688static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate) 697static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate)
689{ 698{
690 unsigned int n, truncm, freq, result; 699 unsigned int n, truncm, freq, result;
@@ -1585,6 +1594,7 @@ static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq)
1585 static ac97_bus_ops_t ops = { 1594 static ac97_bus_ops_t ops = {
1586 .write = snd_es1371_codec_write, 1595 .write = snd_es1371_codec_write,
1587 .read = snd_es1371_codec_read, 1596 .read = snd_es1371_codec_read,
1597 .wait = snd_es1371_codec_wait,
1588 }; 1598 };
1589 1599
1590 if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0) 1600 if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0)
@@ -2008,21 +2018,11 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
2008 if (pci->vendor == es1371_ac97_reset_hack[idx].vid && 2018 if (pci->vendor == es1371_ac97_reset_hack[idx].vid &&
2009 pci->device == es1371_ac97_reset_hack[idx].did && 2019 pci->device == es1371_ac97_reset_hack[idx].did &&
2010 ensoniq->rev == es1371_ac97_reset_hack[idx].rev) { 2020 ensoniq->rev == es1371_ac97_reset_hack[idx].rev) {
2011 unsigned long tmo;
2012 signed long tmo2;
2013
2014 ensoniq->cssr |= ES_1371_ST_AC97_RST; 2021 ensoniq->cssr |= ES_1371_ST_AC97_RST;
2015 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); 2022 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
2016 /* need to delay around 20ms(bleech) to give 2023 /* need to delay around 20ms(bleech) to give
2017 some CODECs enough time to wakeup */ 2024 some CODECs enough time to wakeup */
2018 tmo = jiffies + (HZ / 50) + 1; 2025 msleep(20);
2019 while (1) {
2020 tmo2 = tmo - jiffies;
2021 if (tmo2 <= 0)
2022 break;
2023 set_current_state(TASK_UNINTERRUPTIBLE);
2024 schedule_timeout(tmo2);
2025 }
2026 break; 2026 break;
2027 } 2027 }
2028 /* AC'97 warm reset to start the bitclk */ 2028 /* AC'97 warm reset to start the bitclk */
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index ea889b311390..9d7a28783930 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -636,7 +636,7 @@ static void __maestro_write(es1968_t *chip, u16 reg, u16 data)
636 chip->maestro_map[reg] = data; 636 chip->maestro_map[reg] = data;
637} 637}
638 638
639inline static void maestro_write(es1968_t *chip, u16 reg, u16 data) 639static inline void maestro_write(es1968_t *chip, u16 reg, u16 data)
640{ 640{
641 unsigned long flags; 641 unsigned long flags;
642 spin_lock_irqsave(&chip->reg_lock, flags); 642 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -654,7 +654,7 @@ static u16 __maestro_read(es1968_t *chip, u16 reg)
654 return chip->maestro_map[reg]; 654 return chip->maestro_map[reg];
655} 655}
656 656
657inline static u16 maestro_read(es1968_t *chip, u16 reg) 657static inline u16 maestro_read(es1968_t *chip, u16 reg)
658{ 658{
659 unsigned long flags; 659 unsigned long flags;
660 u16 result; 660 u16 result;
@@ -664,11 +664,6 @@ inline static u16 maestro_read(es1968_t *chip, u16 reg)
664 return result; 664 return result;
665} 665}
666 666
667#define big_mdelay(msec) do {\
668 set_current_state(TASK_UNINTERRUPTIBLE);\
669 schedule_timeout(((msec) * HZ + 999) / 1000);\
670} while (0)
671
672/* Wait for the codec bus to be free */ 667/* Wait for the codec bus to be free */
673static int snd_es1968_ac97_wait(es1968_t *chip) 668static int snd_es1968_ac97_wait(es1968_t *chip)
674{ 669{
@@ -755,7 +750,7 @@ static void __apu_set_register(es1968_t *chip, u16 channel, u8 reg, u16 data)
755 apu_data_set(chip, data); 750 apu_data_set(chip, data);
756} 751}
757 752
758inline static void apu_set_register(es1968_t *chip, u16 channel, u8 reg, u16 data) 753static inline void apu_set_register(es1968_t *chip, u16 channel, u8 reg, u16 data)
759{ 754{
760 unsigned long flags; 755 unsigned long flags;
761 spin_lock_irqsave(&chip->reg_lock, flags); 756 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -771,7 +766,7 @@ static u16 __apu_get_register(es1968_t *chip, u16 channel, u8 reg)
771 return __maestro_read(chip, IDR0_DATA_PORT); 766 return __maestro_read(chip, IDR0_DATA_PORT);
772} 767}
773 768
774inline static u16 apu_get_register(es1968_t *chip, u16 channel, u8 reg) 769static inline u16 apu_get_register(es1968_t *chip, u16 channel, u8 reg)
775{ 770{
776 unsigned long flags; 771 unsigned long flags;
777 u16 v; 772 u16 v;
@@ -957,7 +952,7 @@ static u32 snd_es1968_compute_rate(es1968_t *chip, u32 freq)
957} 952}
958 953
959/* get current pointer */ 954/* get current pointer */
960inline static unsigned int 955static inline unsigned int
961snd_es1968_get_dma_ptr(es1968_t *chip, esschan_t *es) 956snd_es1968_get_dma_ptr(es1968_t *chip, esschan_t *es)
962{ 957{
963 unsigned int offset; 958 unsigned int offset;
@@ -978,7 +973,7 @@ static void snd_es1968_apu_set_freq(es1968_t *chip, int apu, int freq)
978} 973}
979 974
980/* spin lock held */ 975/* spin lock held */
981inline static void snd_es1968_trigger_apu(es1968_t *esm, int apu, int mode) 976static inline void snd_es1968_trigger_apu(es1968_t *esm, int apu, int mode)
982{ 977{
983 /* set the APU mode */ 978 /* set the APU mode */
984 __apu_set_register(esm, apu, 0, 979 __apu_set_register(esm, apu, 0,
@@ -1809,8 +1804,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
1809 snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR); 1804 snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR);
1810 do_gettimeofday(&start_time); 1805 do_gettimeofday(&start_time);
1811 spin_unlock_irq(&chip->reg_lock); 1806 spin_unlock_irq(&chip->reg_lock);
1812 set_current_state(TASK_UNINTERRUPTIBLE); 1807 msleep(50);
1813 schedule_timeout(HZ / 20); /* 50 msec */
1814 spin_lock_irq(&chip->reg_lock); 1808 spin_lock_irq(&chip->reg_lock);
1815 offset = __apu_get_register(chip, apu, 5); 1809 offset = __apu_get_register(chip, apu, 5);
1816 do_gettimeofday(&stop_time); 1810 do_gettimeofday(&stop_time);
@@ -2093,7 +2087,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
2093 outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */ 2087 outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */
2094 udelay(20); 2088 udelay(20);
2095 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */ 2089 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */
2096 big_mdelay(20); 2090 msleep(20);
2097 2091
2098 outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ 2092 outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */
2099 outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38); 2093 outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38);
@@ -2109,7 +2103,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
2109 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */ 2103 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */
2110 udelay(20); 2104 udelay(20);
2111 outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */ 2105 outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */
2112 big_mdelay(500); 2106 msleep(500);
2113 //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); 2107 //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38);
2114 outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); 2108 outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a);
2115 outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); 2109 outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c);
@@ -2135,7 +2129,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
2135 2129
2136 if (w > 10000) { 2130 if (w > 10000) {
2137 outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ 2131 outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */
2138 big_mdelay(500); /* oh my.. */ 2132 msleep(500); /* oh my.. */
2139 outb(inb(ioaddr + 0x37) & ~0x08, 2133 outb(inb(ioaddr + 0x37) & ~0x08,
2140 ioaddr + 0x37); 2134 ioaddr + 0x37);
2141 udelay(1); 2135 udelay(1);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 59991560d492..dd0d99d2ad27 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -262,6 +262,9 @@ enum {
262#define AC_PINCTL_OUT_EN (1<<6) 262#define AC_PINCTL_OUT_EN (1<<6)
263#define AC_PINCTL_HP_EN (1<<7) 263#define AC_PINCTL_HP_EN (1<<7)
264 264
265/* Unsolicited response - 8bit */
266#define AC_USRSP_EN (1<<7)
267
265/* configuration default - 32bit */ 268/* configuration default - 32bit */
266#define AC_DEFCFG_SEQUENCE (0xf<<0) 269#define AC_DEFCFG_SEQUENCE (0xf<<0)
267#define AC_DEFCFG_DEF_ASSOC (0xf<<4) 270#define AC_DEFCFG_DEF_ASSOC (0xf<<4)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 5e0cca36ed57..288ab0764830 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -178,6 +178,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
178#define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */ 178#define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */
179#define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */ 179#define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */
180 180
181/* GCTL unsolicited response enable bit */
182#define ICH6_GCTL_UREN (1<<8)
183
181/* GCTL reset bit */ 184/* GCTL reset bit */
182#define ICH6_GCTL_RESET (1<<0) 185#define ICH6_GCTL_RESET (1<<0)
183 186
@@ -562,6 +565,9 @@ static int azx_reset(azx_t *chip)
562 return -EBUSY; 565 return -EBUSY;
563 } 566 }
564 567
568 /* Accept unsolicited responses */
569 azx_writel(chip, GCTL, azx_readl(chip, GCTL) | ICH6_GCTL_UREN);
570
565 /* detect codecs */ 571 /* detect codecs */
566 if (! chip->codec_mask) { 572 if (! chip->codec_mask) {
567 chip->codec_mask = azx_readw(chip, STATESTS); 573 chip->codec_mask = azx_readw(chip, STATESTS);
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 2d6e3e3d0a38..86f195f19eef 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -408,7 +408,7 @@ static int cmi9880_fill_multi_dac_nids(struct hda_codec *codec, const struct aut
408 /* search for an empty channel */ 408 /* search for an empty channel */
409 for (j = 0; j < cfg->line_outs; j++) { 409 for (j = 0; j < cfg->line_outs; j++) {
410 if (! assigned[j]) { 410 if (! assigned[j]) {
411 spec->dac_nids[i] = i + 0x03; 411 spec->dac_nids[i] = j + 0x03;
412 assigned[j] = 1; 412 assigned[j] = 1;
413 break; 413 break;
414 } 414 }
@@ -444,11 +444,10 @@ static int cmi9880_fill_multi_init(struct hda_codec *codec, const struct auto_pi
444 len = snd_hda_get_connections(codec, nid, conn, 4); 444 len = snd_hda_get_connections(codec, nid, conn, 4);
445 for (k = 0; k < len; k++) 445 for (k = 0; k < len; k++)
446 if (conn[k] == spec->dac_nids[i]) { 446 if (conn[k] == spec->dac_nids[i]) {
447 spec->multi_init[j].param = j; 447 spec->multi_init[j].param = k;
448 break; 448 break;
449 } 449 }
450 j++; 450 j++;
451 break;
452 } 451 }
453 } 452 }
454 return 0; 453 return 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index bab89843d850..9b8569900787 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -40,6 +40,7 @@ enum {
40 ALC880_W810, 40 ALC880_W810,
41 ALC880_Z71V, 41 ALC880_Z71V,
42 ALC880_AUTO, 42 ALC880_AUTO,
43 ALC880_6ST,
43 ALC880_6ST_DIG, 44 ALC880_6ST_DIG,
44 ALC880_F1734, 45 ALC880_F1734,
45 ALC880_ASUS, 46 ALC880_ASUS,
@@ -119,6 +120,7 @@ struct alc_spec {
119 unsigned int num_kctl_alloc, num_kctl_used; 120 unsigned int num_kctl_alloc, num_kctl_used;
120 snd_kcontrol_new_t *kctl_alloc; 121 snd_kcontrol_new_t *kctl_alloc;
121 struct hda_input_mux private_imux; 122 struct hda_input_mux private_imux;
123 hda_nid_t private_dac_nids[4];
122}; 124};
123 125
124 126
@@ -1547,9 +1549,10 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1547 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, 1549 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG },
1548 { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, 1550 { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG },
1549 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, 1551 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG },
1550 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, 1552 /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */
1551 { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, 1553 { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG },
1552 { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, 1554 /* note subvendor = 0 below */
1555 /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */
1553 1556
1554 { .modelname = "w810", .config = ALC880_W810 }, 1557 { .modelname = "w810", .config = ALC880_W810 },
1555 { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, 1558 { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 },
@@ -1557,7 +1560,10 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1557 { .modelname = "z71v", .config = ALC880_Z71V }, 1560 { .modelname = "z71v", .config = ALC880_Z71V },
1558 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, 1561 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V },
1559 1562
1560 { .modelname = "6statack-digout", .config = ALC880_6ST_DIG }, 1563 { .modelname = "6stack", .config = ALC880_6ST },
1564 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */
1565
1566 { .modelname = "6stack-digout", .config = ALC880_6ST_DIG },
1561 { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, 1567 { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG },
1562 { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, 1568 { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG },
1563 { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, 1569 { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG },
@@ -1644,6 +1650,15 @@ static struct alc_config_preset alc880_presets[] = {
1644 .channel_mode = alc880_fivestack_modes, 1650 .channel_mode = alc880_fivestack_modes,
1645 .input_mux = &alc880_capture_source, 1651 .input_mux = &alc880_capture_source,
1646 }, 1652 },
1653 [ALC880_6ST] = {
1654 .mixers = { alc880_six_stack_mixer },
1655 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs },
1656 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
1657 .dac_nids = alc880_6st_dac_nids,
1658 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
1659 .channel_mode = alc880_sixstack_modes,
1660 .input_mux = &alc880_6stack_capture_source,
1661 },
1647 [ALC880_6ST_DIG] = { 1662 [ALC880_6ST_DIG] = {
1648 .mixers = { alc880_six_stack_mixer }, 1663 .mixers = { alc880_six_stack_mixer },
1649 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, 1664 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs },
@@ -1656,7 +1671,8 @@ static struct alc_config_preset alc880_presets[] = {
1656 }, 1671 },
1657 [ALC880_W810] = { 1672 [ALC880_W810] = {
1658 .mixers = { alc880_w810_base_mixer }, 1673 .mixers = { alc880_w810_base_mixer },
1659 .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs }, 1674 .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs,
1675 alc880_gpio2_init_verbs },
1660 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), 1676 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
1661 .dac_nids = alc880_w810_dac_nids, 1677 .dac_nids = alc880_w810_dac_nids,
1662 .dig_out_nid = ALC880_DIGOUT_NID, 1678 .dig_out_nid = ALC880_DIGOUT_NID,
@@ -1666,8 +1682,7 @@ static struct alc_config_preset alc880_presets[] = {
1666 }, 1682 },
1667 [ALC880_Z71V] = { 1683 [ALC880_Z71V] = {
1668 .mixers = { alc880_z71v_mixer }, 1684 .mixers = { alc880_z71v_mixer },
1669 .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs, 1685 .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs },
1670 alc880_gpio2_init_verbs },
1671 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), 1686 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
1672 .dac_nids = alc880_z71v_dac_nids, 1687 .dac_nids = alc880_z71v_dac_nids,
1673 .dig_out_nid = ALC880_DIGOUT_NID, 1688 .dig_out_nid = ALC880_DIGOUT_NID,
@@ -1809,6 +1824,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pi
1809 int i, j; 1824 int i, j;
1810 1825
1811 memset(assigned, 0, sizeof(assigned)); 1826 memset(assigned, 0, sizeof(assigned));
1827 spec->multiout.dac_nids = spec->private_dac_nids;
1812 1828
1813 /* check the pins hardwired to audio widget */ 1829 /* check the pins hardwired to audio widget */
1814 for (i = 0; i < cfg->line_outs; i++) { 1830 for (i = 0; i < cfg->line_outs; i++) {
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 013be2ea513a..9d503da7320d 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -30,32 +30,37 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <sound/core.h> 32#include <sound/core.h>
33#include <sound/asoundef.h>
33#include "hda_codec.h" 34#include "hda_codec.h"
34#include "hda_local.h" 35#include "hda_local.h"
35 36
36#undef STAC_TEST 37#undef STAC_TEST
37 38
39#define NUM_CONTROL_ALLOC 32
40#define STAC_HP_EVENT 0x37
41#define STAC_UNSOL_ENABLE (AC_USRSP_EN | STAC_HP_EVENT)
42
38struct sigmatel_spec { 43struct sigmatel_spec {
44 snd_kcontrol_new_t *mixers[4];
45 unsigned int num_mixers;
46
47 unsigned int surr_switch: 1;
48
39 /* playback */ 49 /* playback */
40 struct hda_multi_out multiout; 50 struct hda_multi_out multiout;
41 hda_nid_t playback_nid; 51 hda_nid_t dac_nids[4];
42 52
43 /* capture */ 53 /* capture */
44 hda_nid_t *adc_nids; 54 hda_nid_t *adc_nids;
45 unsigned int num_adcs; 55 unsigned int num_adcs;
46 hda_nid_t *mux_nids; 56 hda_nid_t *mux_nids;
47 unsigned int num_muxes; 57 unsigned int num_muxes;
48 hda_nid_t capture_nid;
49 hda_nid_t dig_in_nid; 58 hda_nid_t dig_in_nid;
50 59
51 /* power management*/ 60#ifdef STAC_TEST
52 hda_nid_t *pstate_nids;
53 unsigned int num_pstates;
54
55 /* pin widgets */ 61 /* pin widgets */
56 hda_nid_t *pin_nids; 62 hda_nid_t *pin_nids;
57 unsigned int num_pins; 63 unsigned int num_pins;
58#ifdef STAC_TEST
59 unsigned int *pin_configs; 64 unsigned int *pin_configs;
60#endif 65#endif
61 66
@@ -64,16 +69,20 @@ struct sigmatel_spec {
64 snd_kcontrol_new_t *mixer; 69 snd_kcontrol_new_t *mixer;
65 70
66 /* capture source */ 71 /* capture source */
67 struct hda_input_mux input_mux; 72 struct hda_input_mux *input_mux;
68 char input_labels[HDA_MAX_NUM_INPUTS][16];
69 unsigned int cur_mux[2]; 73 unsigned int cur_mux[2];
70 74
71 /* channel mode */ 75 /* channel mode */
72 unsigned int num_ch_modes; 76 unsigned int num_ch_modes;
73 unsigned int cur_ch_mode; 77 unsigned int cur_ch_mode;
74 const struct sigmatel_channel_mode *channel_modes;
75 78
76 struct hda_pcm pcm_rec[1]; /* PCM information */ 79 struct hda_pcm pcm_rec[2]; /* PCM information */
80
81 /* dynamic controls and input_mux */
82 struct auto_pin_cfg autocfg;
83 unsigned int num_kctl_alloc, num_kctl_used;
84 snd_kcontrol_new_t *kctl_alloc;
85 struct hda_input_mux private_imux;
77}; 86};
78 87
79static hda_nid_t stac9200_adc_nids[1] = { 88static hda_nid_t stac9200_adc_nids[1] = {
@@ -88,14 +97,6 @@ static hda_nid_t stac9200_dac_nids[1] = {
88 0x02, 97 0x02,
89}; 98};
90 99
91static hda_nid_t stac9200_pstate_nids[3] = {
92 0x01, 0x02, 0x03,
93};
94
95static hda_nid_t stac9200_pin_nids[8] = {
96 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
97};
98
99static hda_nid_t stac922x_adc_nids[2] = { 100static hda_nid_t stac922x_adc_nids[2] = {
100 0x06, 0x07, 101 0x06, 0x07,
101}; 102};
@@ -104,24 +105,22 @@ static hda_nid_t stac922x_mux_nids[2] = {
104 0x12, 0x13, 105 0x12, 0x13,
105}; 106};
106 107
107static hda_nid_t stac922x_dac_nids[4] = { 108#ifdef STAC_TEST
108 0x02, 0x03, 0x04, 0x05, 109static hda_nid_t stac9200_pin_nids[8] = {
109}; 110 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
110
111static hda_nid_t stac922x_pstate_nids[8] = {
112 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11,
113}; 111};
114 112
115static hda_nid_t stac922x_pin_nids[10] = { 113static hda_nid_t stac922x_pin_nids[10] = {
116 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 114 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
117 0x0f, 0x10, 0x11, 0x15, 0x1b, 115 0x0f, 0x10, 0x11, 0x15, 0x1b,
118}; 116};
117#endif
119 118
120static int stac92xx_mux_enum_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 119static int stac92xx_mux_enum_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
121{ 120{
122 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
123 struct sigmatel_spec *spec = codec->spec; 122 struct sigmatel_spec *spec = codec->spec;
124 return snd_hda_input_mux_info(&spec->input_mux, uinfo); 123 return snd_hda_input_mux_info(spec->input_mux, uinfo);
125} 124}
126 125
127static int stac92xx_mux_enum_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 126static int stac92xx_mux_enum_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
@@ -140,26 +139,64 @@ static int stac92xx_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
140 struct sigmatel_spec *spec = codec->spec; 139 struct sigmatel_spec *spec = codec->spec;
141 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 140 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
142 141
143 return snd_hda_input_mux_put(codec, &spec->input_mux, ucontrol, 142 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
144 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); 143 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
145} 144}
146 145
147static struct hda_verb stac9200_ch2_init[] = { 146static struct hda_verb stac9200_core_init[] = {
148 /* set dac0mux for dac converter */ 147 /* set dac0mux for dac converter */
149 { 0x07, 0x701, 0x00}, 148 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
150 {} 149 {}
151}; 150};
152 151
153static struct hda_verb stac922x_ch2_init[] = { 152static struct hda_verb stac922x_core_init[] = {
154 /* set master volume and direct control */ 153 /* set master volume and direct control */
155 { 0x16, 0x70f, 0xff}, 154 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
156 {} 155 {}
157}; 156};
158 157
159struct sigmatel_channel_mode { 158static int stac922x_channel_modes[3] = {2, 6, 8};
160 unsigned int channels; 159
161 const struct hda_verb *sequence; 160static int stac922x_ch_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
162}; 161{
162 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
163 struct sigmatel_spec *spec = codec->spec;
164
165 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
166 uinfo->count = 1;
167 uinfo->value.enumerated.items = spec->num_ch_modes;
168 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
169 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
170 sprintf(uinfo->value.enumerated.name, "%dch",
171 stac922x_channel_modes[uinfo->value.enumerated.item]);
172 return 0;
173}
174
175static int stac922x_ch_mode_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
176{
177 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
178 struct sigmatel_spec *spec = codec->spec;
179
180 ucontrol->value.enumerated.item[0] = spec->cur_ch_mode;
181 return 0;
182}
183
184static int stac922x_ch_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
185{
186 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
187 struct sigmatel_spec *spec = codec->spec;
188
189 if (ucontrol->value.enumerated.item[0] >= spec->num_ch_modes)
190 ucontrol->value.enumerated.item[0] = spec->num_ch_modes;
191 if (ucontrol->value.enumerated.item[0] == spec->cur_ch_mode &&
192 ! codec->in_resume)
193 return 0;
194
195 spec->cur_ch_mode = ucontrol->value.enumerated.item[0];
196 spec->multiout.max_channels = stac922x_channel_modes[spec->cur_ch_mode];
197
198 return 1;
199}
163 200
164static snd_kcontrol_new_t stac9200_mixer[] = { 201static snd_kcontrol_new_t stac9200_mixer[] = {
165 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 202 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
@@ -174,13 +211,12 @@ static snd_kcontrol_new_t stac9200_mixer[] = {
174 }, 211 },
175 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), 212 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
176 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), 213 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
177 HDA_CODEC_VOLUME("Input Mux Volume", 0x0c, 0, HDA_OUTPUT), 214 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
178 { } /* end */ 215 { } /* end */
179}; 216};
180 217
218/* This needs to be generated dynamically based on sequence */
181static snd_kcontrol_new_t stac922x_mixer[] = { 219static snd_kcontrol_new_t stac922x_mixer[] = {
182 HDA_CODEC_VOLUME("PCM Playback Volume", 0x2, 0x0, HDA_OUTPUT),
183 HDA_CODEC_MUTE("PCM Playback Switch", 0x2, 0x0, HDA_OUTPUT),
184 { 220 {
185 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
186 .name = "Input Source", 222 .name = "Input Source",
@@ -195,14 +231,38 @@ static snd_kcontrol_new_t stac922x_mixer[] = {
195 { } /* end */ 231 { } /* end */
196}; 232};
197 233
234static snd_kcontrol_new_t stac922x_ch_mode_mixer[] = {
235 {
236 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
237 .name = "Channel Mode",
238 .info = stac922x_ch_mode_info,
239 .get = stac922x_ch_mode_get,
240 .put = stac922x_ch_mode_put,
241 },
242 { } /* end */
243};
244
198static int stac92xx_build_controls(struct hda_codec *codec) 245static int stac92xx_build_controls(struct hda_codec *codec)
199{ 246{
200 struct sigmatel_spec *spec = codec->spec; 247 struct sigmatel_spec *spec = codec->spec;
201 int err; 248 int err;
249 int i;
202 250
203 err = snd_hda_add_new_ctls(codec, spec->mixer); 251 err = snd_hda_add_new_ctls(codec, spec->mixer);
204 if (err < 0) 252 if (err < 0)
205 return err; 253 return err;
254
255 for (i = 0; i < spec->num_mixers; i++) {
256 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
257 if (err < 0)
258 return err;
259 }
260
261 if (spec->surr_switch) {
262 err = snd_hda_add_new_ctls(codec, stac922x_ch_mode_mixer);
263 if (err < 0)
264 return err;
265 }
206 if (spec->multiout.dig_out_nid) { 266 if (spec->multiout.dig_out_nid) {
207 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); 267 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
208 if (err < 0) 268 if (err < 0)
@@ -222,9 +282,9 @@ static unsigned int stac9200_pin_configs[8] = {
222 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 282 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
223}; 283};
224 284
225static unsigned int stac922x_pin_configs[14] = { 285static unsigned int stac922x_pin_configs[10] = {
226 0x40000100, 0x40000100, 0x40000100, 0x01114010, 286 0x01014010, 0x01014011, 0x01014012, 0x0221401f,
227 0x01813122, 0x40000100, 0x01447010, 0x01c47010, 287 0x01813122, 0x01014014, 0x01441030, 0x01c41030,
228 0x40000100, 0x40000100, 288 0x40000100, 0x40000100,
229}; 289};
230 290
@@ -255,180 +315,66 @@ static void stac92xx_set_config_regs(struct hda_codec *codec)
255} 315}
256#endif 316#endif
257 317
258static int stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, unsigned int value)
259{
260 unsigned int pin_ctl;
261
262 pin_ctl = snd_hda_codec_read(codec, nid, 0,
263 AC_VERB_GET_PIN_WIDGET_CONTROL,
264 0x00);
265 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
266 pin_ctl | value);
267
268 return 0;
269}
270
271static int stac92xx_set_vref(struct hda_codec *codec, hda_nid_t nid)
272{
273 unsigned int vref_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) >> AC_PINCAP_VREF_SHIFT;
274 unsigned int vref_ctl = AC_PINCTL_VREF_HIZ;
275
276 if (vref_caps & AC_PINCAP_VREF_100)
277 vref_ctl = AC_PINCTL_VREF_100;
278 else if (vref_caps & AC_PINCAP_VREF_80)
279 vref_ctl = AC_PINCTL_VREF_80;
280 else if (vref_caps & AC_PINCAP_VREF_50)
281 vref_ctl = AC_PINCTL_VREF_50;
282 else if (vref_caps & AC_PINCAP_VREF_GRD)
283 vref_ctl = AC_PINCTL_VREF_GRD;
284
285 stac92xx_set_pinctl(codec, nid, vref_ctl);
286
287 return 0;
288}
289
290/* 318/*
291 * retrieve the default device type from the default config value 319 * Analog playback callbacks
292 */ 320 */
293#define get_defcfg_type(cfg) ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) 321static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
294#define get_defcfg_location(cfg) ((cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT) 322 struct hda_codec *codec,
295 323 snd_pcm_substream_t *substream)
296static int stac92xx_config_pin(struct hda_codec *codec, hda_nid_t nid, unsigned int pin_cfg)
297{ 324{
298 struct sigmatel_spec *spec = codec->spec; 325 struct sigmatel_spec *spec = codec->spec;
299 u32 location = get_defcfg_location(pin_cfg); 326 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
300 char *label;
301 const char *type = NULL;
302 int ainput = 0;
303
304 switch(get_defcfg_type(pin_cfg)) {
305 case AC_JACK_HP_OUT:
306 /* Enable HP amp */
307 stac92xx_set_pinctl(codec, nid, AC_PINCTL_HP_EN);
308 /* Fall through */
309 case AC_JACK_SPDIF_OUT:
310 case AC_JACK_LINE_OUT:
311 case AC_JACK_SPEAKER:
312 /* Enable output */
313 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
314 break;
315 case AC_JACK_SPDIF_IN:
316 stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN);
317 break;
318 case AC_JACK_MIC_IN:
319 if ((location & 0x0f) == AC_JACK_LOC_FRONT)
320 type = "Front Mic";
321 else
322 type = "Mic";
323 ainput = 1;
324 /* Set vref */
325 stac92xx_set_vref(codec, nid);
326 stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN);
327 break;
328 case AC_JACK_CD:
329 type = "CD";
330 ainput = 1;
331 stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN);
332 break;
333 case AC_JACK_LINE_IN:
334 if ((location & 0x0f) == AC_JACK_LOC_FRONT)
335 type = "Front Line";
336 else
337 type = "Line";
338 ainput = 1;
339 stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN);
340 break;
341 case AC_JACK_AUX:
342 if ((location & 0x0f) == AC_JACK_LOC_FRONT)
343 type = "Front Aux";
344 else
345 type = "Aux";
346 ainput = 1;
347 stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN);
348 break;
349 }
350
351 if (ainput) {
352 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
353 int i, j, num_cons, index = -1;
354 if (!type)
355 type = "Input";
356 label = spec->input_labels[spec->input_mux.num_items];
357 strcpy(label, type);
358 spec->input_mux.items[spec->input_mux.num_items].label = label;
359 for (i=0; i<spec->num_muxes; i++) {
360 num_cons = snd_hda_get_connections(codec, spec->mux_nids[i], con_lst, HDA_MAX_NUM_INPUTS);
361 for (j=0; j<num_cons; j++)
362 if (con_lst[j] == nid) {
363 index = j;
364 break;
365 }
366 if (index >= 0)
367 break;
368 }
369 spec->input_mux.items[spec->input_mux.num_items].index = index;
370 spec->input_mux.num_items++;
371 }
372
373 return 0;
374} 327}
375 328
376static int stac92xx_config_pins(struct hda_codec *codec) 329/*
330 * set up the i/o for analog out
331 * when the digital out is available, copy the front out to digital out, too.
332 */
333static int stac92xx_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_out *mout,
334 unsigned int stream_tag,
335 unsigned int format,
336 snd_pcm_substream_t *substream)
377{ 337{
378 struct sigmatel_spec *spec = codec->spec; 338 hda_nid_t *nids = mout->dac_nids;
339 int chs = substream->runtime->channels;
379 int i; 340 int i;
380 unsigned int pin_cfg;
381 341
382 for (i=0; i < spec->num_pins; i++) { 342 down(&codec->spdif_mutex);
383 /* Default to disabled */ 343 if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) {
384 snd_hda_codec_write(codec, spec->pin_nids[i], 0, 344 if (chs == 2 &&
385 AC_VERB_SET_PIN_WIDGET_CONTROL, 345 snd_hda_is_supported_format(codec, mout->dig_out_nid, format) &&
386 0x00); 346 ! (codec->spdif_status & IEC958_AES0_NONAUDIO)) {
387 347 mout->dig_out_used = HDA_DIG_ANALOG_DUP;
388 pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0, 348 /* setup digital receiver */
389 AC_VERB_GET_CONFIG_DEFAULT, 349 snd_hda_codec_setup_stream(codec, mout->dig_out_nid,
390 0x00); 350 stream_tag, 0, format);
391 if (((pin_cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT) == AC_JACK_PORT_NONE) 351 } else {
392 continue; /* Move on */ 352 mout->dig_out_used = 0;
393 353 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0);
394 stac92xx_config_pin(codec, spec->pin_nids[i], pin_cfg); 354 }
395 } 355 }
396 356 up(&codec->spdif_mutex);
397 return 0; 357
398} 358 /* front */
399 359 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format);
400static int stac92xx_init(struct hda_codec *codec) 360 if (mout->hp_nid)
401{ 361 /* headphone out will just decode front left/right (stereo) */
402 struct sigmatel_spec *spec = codec->spec; 362 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 0, format);
403 int i; 363 /* surrounds */
404 364 if (mout->max_channels > 2)
405 for (i=0; i < spec->num_pstates; i++) 365 for (i = 1; i < mout->num_dacs; i++) {
406 snd_hda_codec_write(codec, spec->pstate_nids[i], 0, 366 if ((mout->max_channels == 6) && (i == 3))
407 AC_VERB_SET_POWER_STATE, 0x00); 367 break;
408 368 if (chs >= (i + 1) * 2) /* independent out */
409 mdelay(100); 369 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, i * 2,
410 370 format);
411 snd_hda_sequence_write(codec, spec->init); 371 else /* copy front */
412 372 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 0,
413#ifdef STAC_TEST 373 format);
414 stac92xx_set_config_regs(codec); 374 }
415#endif
416
417 stac92xx_config_pins(codec);
418
419 return 0; 375 return 0;
420} 376}
421 377
422/*
423 * Analog playback callbacks
424 */
425static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
426 struct hda_codec *codec,
427 snd_pcm_substream_t *substream)
428{
429 struct sigmatel_spec *spec = codec->spec;
430 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
431}
432 378
433static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, 379static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
434 struct hda_codec *codec, 380 struct hda_codec *codec,
@@ -437,7 +383,7 @@ static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
437 snd_pcm_substream_t *substream) 383 snd_pcm_substream_t *substream)
438{ 384{
439 struct sigmatel_spec *spec = codec->spec; 385 struct sigmatel_spec *spec = codec->spec;
440 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, 386 return stac92xx_multi_out_analog_prepare(codec, &spec->multiout, stream_tag,
441 format, substream); 387 format, substream);
442} 388}
443 389
@@ -516,7 +462,7 @@ static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
516static struct hda_pcm_stream stac92xx_pcm_analog_playback = { 462static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
517 .substreams = 1, 463 .substreams = 1,
518 .channels_min = 2, 464 .channels_min = 2,
519 .channels_max = 2, 465 .channels_max = 8,
520 .nid = 0x02, /* NID to query formats and rates */ 466 .nid = 0x02, /* NID to query formats and rates */
521 .ops = { 467 .ops = {
522 .open = stac92xx_playback_pcm_open, 468 .open = stac92xx_playback_pcm_open,
@@ -544,11 +490,9 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
544 codec->num_pcms = 1; 490 codec->num_pcms = 1;
545 codec->pcm_info = info; 491 codec->pcm_info = info;
546 492
547 info->name = "STAC92xx"; 493 info->name = "STAC92xx Analog";
548 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 494 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
549 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->playback_nid;
550 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 495 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
551 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->capture_nid;
552 496
553 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 497 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
554 codec->num_pcms++; 498 codec->num_pcms++;
@@ -567,21 +511,413 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
567 return 0; 511 return 0;
568} 512}
569 513
514enum {
515 STAC_CTL_WIDGET_VOL,
516 STAC_CTL_WIDGET_MUTE,
517};
518
519static snd_kcontrol_new_t stac92xx_control_templates[] = {
520 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
521 HDA_CODEC_MUTE(NULL, 0, 0, 0),
522};
523
524/* add dynamic controls */
525static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
526{
527 snd_kcontrol_new_t *knew;
528
529 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
530 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
531
532 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
533 if (! knew)
534 return -ENOMEM;
535 if (spec->kctl_alloc) {
536 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
537 kfree(spec->kctl_alloc);
538 }
539 spec->kctl_alloc = knew;
540 spec->num_kctl_alloc = num;
541 }
542
543 knew = &spec->kctl_alloc[spec->num_kctl_used];
544 *knew = stac92xx_control_templates[type];
545 knew->name = kstrdup(name, GFP_KERNEL);
546 if (! knew->name)
547 return -ENOMEM;
548 knew->private_value = val;
549 spec->num_kctl_used++;
550 return 0;
551}
552
553/* fill in the dac_nids table from the parsed pin configuration */
554static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
555{
556 struct sigmatel_spec *spec = codec->spec;
557 hda_nid_t nid;
558 int i;
559
560 /* check the pins hardwired to audio widget */
561 for (i = 0; i < cfg->line_outs; i++) {
562 nid = cfg->line_out_pins[i];
563 spec->multiout.dac_nids[i] = snd_hda_codec_read(codec, nid, 0,
564 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
565 }
566
567 spec->multiout.num_dacs = cfg->line_outs;
568
569 return 0;
570}
571
572/* add playback controls from the parsed DAC table */
573static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, const struct auto_pin_cfg *cfg)
574{
575 char name[32];
576 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" };
577 hda_nid_t nid;
578 int i, err;
579
580 for (i = 0; i < cfg->line_outs; i++) {
581 if (! spec->multiout.dac_nids[i])
582 continue;
583
584 nid = spec->multiout.dac_nids[i];
585
586 if (i == 2) {
587 /* Center/LFE */
588 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Center Playback Volume",
589 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0)
590 return err;
591 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "LFE Playback Volume",
592 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0)
593 return err;
594 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Center Playback Switch",
595 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0)
596 return err;
597 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "LFE Playback Switch",
598 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0)
599 return err;
600 } else {
601 sprintf(name, "%s Playback Volume", chname[i]);
602 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
603 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0)
604 return err;
605 sprintf(name, "%s Playback Switch", chname[i]);
606 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
607 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0)
608 return err;
609 }
610 }
611
612 return 0;
613}
614
615/* add playback controls for HP output */
616static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, struct auto_pin_cfg *cfg)
617{
618 struct sigmatel_spec *spec = codec->spec;
619 hda_nid_t pin = cfg->hp_pin;
620 hda_nid_t nid;
621 int i, err;
622 unsigned int wid_caps;
623
624 if (! pin)
625 return 0;
626
627 wid_caps = snd_hda_param_read(codec, pin, AC_PAR_AUDIO_WIDGET_CAP);
628 if (wid_caps & AC_WCAP_UNSOL_CAP)
629 /* Enable unsolicited responses on the HP widget */
630 snd_hda_codec_write(codec, pin, 0,
631 AC_VERB_SET_UNSOLICITED_ENABLE,
632 STAC_UNSOL_ENABLE);
633
634 nid = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
635 for (i = 0; i < cfg->line_outs; i++) {
636 if (! spec->multiout.dac_nids[i])
637 continue;
638 if (spec->multiout.dac_nids[i] == nid)
639 return 0;
640 }
641
642 spec->multiout.hp_nid = nid;
643
644 /* control HP volume/switch on the output mixer amp */
645 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Headphone Playback Volume",
646 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0)
647 return err;
648 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Headphone Playback Switch",
649 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0)
650 return err;
651
652 return 0;
653}
654
655/* create playback/capture controls for input pins */
656static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
657{
658 struct sigmatel_spec *spec = codec->spec;
659 static char *labels[AUTO_PIN_LAST] = {
660 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"
661 };
662 struct hda_input_mux *imux = &spec->private_imux;
663 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
664 int i, j, k;
665
666 for (i = 0; i < AUTO_PIN_LAST; i++) {
667 int index = -1;
668 if (cfg->input_pins[i]) {
669 imux->items[imux->num_items].label = labels[i];
670
671 for (j=0; j<spec->num_muxes; j++) {
672 int num_cons = snd_hda_get_connections(codec, spec->mux_nids[j], con_lst, HDA_MAX_NUM_INPUTS);
673 for (k=0; k<num_cons; k++)
674 if (con_lst[k] == cfg->input_pins[i]) {
675 index = k;
676 break;
677 }
678 if (index >= 0)
679 break;
680 }
681 imux->items[imux->num_items].index = index;
682 imux->num_items++;
683 }
684 }
685
686 return 0;
687}
688
689static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
690
691{
692 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
693}
694
695static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
696{
697 struct sigmatel_spec *spec = codec->spec;
698 int i;
699
700 for (i = 0; i < spec->autocfg.line_outs; i++) {
701 hda_nid_t nid = spec->autocfg.line_out_pins[i];
702 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
703 }
704}
705
706static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
707{
708 struct sigmatel_spec *spec = codec->spec;
709 hda_nid_t pin;
710
711 pin = spec->autocfg.hp_pin;
712 if (pin) /* connect to front */
713 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
714}
715
716static int stac922x_parse_auto_config(struct hda_codec *codec)
717{
718 struct sigmatel_spec *spec = codec->spec;
719 int err;
720
721 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg)) < 0)
722 return err;
723 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
724 return err;
725 if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin)
726 return 0; /* can't find valid pin config */
727
728 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
729 (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 ||
730 (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
731 return err;
732
733 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
734 if (spec->multiout.max_channels > 2) {
735 spec->surr_switch = 1;
736 spec->cur_ch_mode = 1;
737 spec->num_ch_modes = 2;
738 if (spec->multiout.max_channels == 8) {
739 spec->cur_ch_mode++;
740 spec->num_ch_modes++;
741 }
742 }
743
744 if (spec->autocfg.dig_out_pin) {
745 spec->multiout.dig_out_nid = 0x08;
746 stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_out_pin, AC_PINCTL_OUT_EN);
747 }
748 if (spec->autocfg.dig_in_pin) {
749 spec->dig_in_nid = 0x09;
750 stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_in_pin, AC_PINCTL_IN_EN);
751 }
752
753 if (spec->kctl_alloc)
754 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
755
756 spec->input_mux = &spec->private_imux;
757
758 return 1;
759}
760
761static int stac9200_parse_auto_config(struct hda_codec *codec)
762{
763 struct sigmatel_spec *spec = codec->spec;
764 int err;
765
766 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg)) < 0)
767 return err;
768
769 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
770 return err;
771
772 if (spec->autocfg.dig_out_pin) {
773 spec->multiout.dig_out_nid = 0x05;
774 stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_out_pin, AC_PINCTL_OUT_EN);
775 }
776 if (spec->autocfg.dig_in_pin) {
777 spec->dig_in_nid = 0x04;
778 stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_in_pin, AC_PINCTL_IN_EN);
779 }
780
781 if (spec->kctl_alloc)
782 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
783
784 spec->input_mux = &spec->private_imux;
785
786 return 1;
787}
788
789static int stac92xx_init_pstate(struct hda_codec *codec)
790{
791 hda_nid_t nid, nid_start;
792 int nodes;
793
794 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_POWER_STATE, 0x00);
795
796 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid_start);
797 for (nid = nid_start; nid < nodes + nid_start; nid++) {
798 unsigned int wid_caps = snd_hda_param_read(codec, nid,
799 AC_PAR_AUDIO_WIDGET_CAP);
800 if (wid_caps & AC_WCAP_POWER)
801 snd_hda_codec_write(codec, nid, 0,
802 AC_VERB_SET_POWER_STATE, 0x00);
803 }
804
805 mdelay(100);
806
807 return 0;
808}
809
810static int stac92xx_init(struct hda_codec *codec)
811{
812 struct sigmatel_spec *spec = codec->spec;
813
814 stac92xx_init_pstate(codec);
815
816 snd_hda_sequence_write(codec, spec->init);
817
818 stac92xx_auto_init_multi_out(codec);
819 stac92xx_auto_init_hp_out(codec);
820
821 return 0;
822}
823
570static void stac92xx_free(struct hda_codec *codec) 824static void stac92xx_free(struct hda_codec *codec)
571{ 825{
572 kfree(codec->spec); 826 struct sigmatel_spec *spec = codec->spec;
827 int i;
828
829 if (! spec)
830 return;
831
832 if (spec->kctl_alloc) {
833 for (i = 0; i < spec->num_kctl_used; i++)
834 kfree(spec->kctl_alloc[i].name);
835 kfree(spec->kctl_alloc);
836 }
837
838 kfree(spec);
839}
840
841static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
842 unsigned int flag)
843{
844 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
845 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
846 snd_hda_codec_write(codec, nid, 0,
847 AC_VERB_SET_PIN_WIDGET_CONTROL,
848 pin_ctl | flag);
849}
850
851static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
852 unsigned int flag)
853{
854 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
855 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
856 snd_hda_codec_write(codec, nid, 0,
857 AC_VERB_SET_PIN_WIDGET_CONTROL,
858 pin_ctl & ~flag);
859}
860
861static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
862{
863 struct sigmatel_spec *spec = codec->spec;
864 struct auto_pin_cfg *cfg = &spec->autocfg;
865 int i, presence;
866
867 if ((res >> 26) != STAC_HP_EVENT)
868 return;
869
870 presence = snd_hda_codec_read(codec, cfg->hp_pin, 0,
871 AC_VERB_GET_PIN_SENSE, 0x00) >> 31;
872
873 if (presence) {
874 /* disable lineouts, enable hp */
875 for (i = 0; i < cfg->line_outs; i++)
876 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
877 AC_PINCTL_OUT_EN);
878 stac92xx_set_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN);
879 } else {
880 /* enable lineouts, disable hp */
881 for (i = 0; i < cfg->line_outs; i++)
882 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
883 AC_PINCTL_OUT_EN);
884 stac92xx_reset_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN);
885 }
886}
887
888#ifdef CONFIG_PM
889static int stac92xx_resume(struct hda_codec *codec)
890{
891 struct sigmatel_spec *spec = codec->spec;
892 int i;
893
894 stac92xx_init(codec);
895 for (i = 0; i < spec->num_mixers; i++)
896 snd_hda_resume_ctls(codec, spec->mixers[i]);
897 if (spec->multiout.dig_out_nid)
898 snd_hda_resume_spdif_out(codec);
899 if (spec->dig_in_nid)
900 snd_hda_resume_spdif_in(codec);
901
902 return 0;
573} 903}
904#endif
574 905
575static struct hda_codec_ops stac92xx_patch_ops = { 906static struct hda_codec_ops stac92xx_patch_ops = {
576 .build_controls = stac92xx_build_controls, 907 .build_controls = stac92xx_build_controls,
577 .build_pcms = stac92xx_build_pcms, 908 .build_pcms = stac92xx_build_pcms,
578 .init = stac92xx_init, 909 .init = stac92xx_init,
579 .free = stac92xx_free, 910 .free = stac92xx_free,
911 .unsol_event = stac92xx_unsol_event,
912#ifdef CONFIG_PM
913 .resume = stac92xx_resume,
914#endif
580}; 915};
581 916
582static int patch_stac9200(struct hda_codec *codec) 917static int patch_stac9200(struct hda_codec *codec)
583{ 918{
584 struct sigmatel_spec *spec; 919 struct sigmatel_spec *spec;
920 int err;
585 921
586 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 922 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
587 if (spec == NULL) 923 if (spec == NULL)
@@ -589,26 +925,27 @@ static int patch_stac9200(struct hda_codec *codec)
589 925
590 codec->spec = spec; 926 codec->spec = spec;
591 927
928#ifdef STAC_TEST
929 spec->pin_nids = stac9200_pin_nids;
930 spec->num_pins = 8;
931 spec->pin_configs = stac9200_pin_configs;
932 stac92xx_set_config_regs(codec);
933#endif
592 spec->multiout.max_channels = 2; 934 spec->multiout.max_channels = 2;
593 spec->multiout.num_dacs = 1; 935 spec->multiout.num_dacs = 1;
594 spec->multiout.dac_nids = stac9200_dac_nids; 936 spec->multiout.dac_nids = stac9200_dac_nids;
595 spec->multiout.dig_out_nid = 0x05;
596 spec->dig_in_nid = 0x04;
597 spec->adc_nids = stac9200_adc_nids; 937 spec->adc_nids = stac9200_adc_nids;
598 spec->mux_nids = stac9200_mux_nids; 938 spec->mux_nids = stac9200_mux_nids;
599 spec->num_muxes = 1; 939 spec->num_muxes = 1;
600 spec->input_mux.num_items = 0; 940
601 spec->pstate_nids = stac9200_pstate_nids; 941 spec->init = stac9200_core_init;
602 spec->num_pstates = 3;
603 spec->pin_nids = stac9200_pin_nids;
604#ifdef STAC_TEST
605 spec->pin_configs = stac9200_pin_configs;
606#endif
607 spec->num_pins = 8;
608 spec->init = stac9200_ch2_init;
609 spec->mixer = stac9200_mixer; 942 spec->mixer = stac9200_mixer;
610 spec->playback_nid = 0x02; 943
611 spec->capture_nid = 0x03; 944 err = stac9200_parse_auto_config(codec);
945 if (err < 0) {
946 stac92xx_free(codec);
947 return err;
948 }
612 949
613 codec->patch_ops = stac92xx_patch_ops; 950 codec->patch_ops = stac92xx_patch_ops;
614 951
@@ -618,6 +955,7 @@ static int patch_stac9200(struct hda_codec *codec)
618static int patch_stac922x(struct hda_codec *codec) 955static int patch_stac922x(struct hda_codec *codec)
619{ 956{
620 struct sigmatel_spec *spec; 957 struct sigmatel_spec *spec;
958 int err;
621 959
622 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 960 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
623 if (spec == NULL) 961 if (spec == NULL)
@@ -625,26 +963,26 @@ static int patch_stac922x(struct hda_codec *codec)
625 963
626 codec->spec = spec; 964 codec->spec = spec;
627 965
628 spec->multiout.max_channels = 2;
629 spec->multiout.num_dacs = 4;
630 spec->multiout.dac_nids = stac922x_dac_nids;
631 spec->multiout.dig_out_nid = 0x08;
632 spec->dig_in_nid = 0x09;
633 spec->adc_nids = stac922x_adc_nids;
634 spec->mux_nids = stac922x_mux_nids;
635 spec->num_muxes = 2;
636 spec->input_mux.num_items = 0;
637 spec->pstate_nids = stac922x_pstate_nids;
638 spec->num_pstates = 8;
639 spec->pin_nids = stac922x_pin_nids;
640#ifdef STAC_TEST 966#ifdef STAC_TEST
967 spec->num_pins = 10;
968 spec->pin_nids = stac922x_pin_nids;
641 spec->pin_configs = stac922x_pin_configs; 969 spec->pin_configs = stac922x_pin_configs;
970 stac92xx_set_config_regs(codec);
642#endif 971#endif
643 spec->num_pins = 10; 972 spec->adc_nids = stac922x_adc_nids;
644 spec->init = stac922x_ch2_init; 973 spec->mux_nids = stac922x_mux_nids;
974 spec->num_muxes = 2;
975
976 spec->init = stac922x_core_init;
645 spec->mixer = stac922x_mixer; 977 spec->mixer = stac922x_mixer;
646 spec->playback_nid = 0x02; 978
647 spec->capture_nid = 0x06; 979 spec->multiout.dac_nids = spec->dac_nids;
980
981 err = stac922x_parse_auto_config(codec);
982 if (err < 0) {
983 stac92xx_free(codec);
984 return err;
985 }
648 986
649 codec->patch_ops = stac92xx_patch_ops; 987 codec->patch_ops = stac92xx_patch_ops;
650 988
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index cc16f95f9cef..d7af3e474432 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -424,6 +424,7 @@ struct _snd_intel8x0 {
424 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ 424 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */
425 425
426 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ 426 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
427 unsigned int sdm_saved; /* SDM reg value */
427 428
428 ac97_bus_t *ac97_bus; 429 ac97_bus_t *ac97_bus;
429 ac97_t *ac97[3]; 430 ac97_t *ac97[3];
@@ -2373,6 +2374,11 @@ static int intel8x0_suspend(snd_card_t *card, pm_message_t state)
2373 for (i = 0; i < 3; i++) 2374 for (i = 0; i < 3; i++)
2374 if (chip->ac97[i]) 2375 if (chip->ac97[i])
2375 snd_ac97_suspend(chip->ac97[i]); 2376 snd_ac97_suspend(chip->ac97[i]);
2377 if (chip->device_type == DEVICE_INTEL_ICH4)
2378 chip->sdm_saved = igetbyte(chip, ICHREG(SDM));
2379
2380 if (chip->irq >= 0)
2381 free_irq(chip->irq, (void *)chip);
2376 pci_disable_device(chip->pci); 2382 pci_disable_device(chip->pci);
2377 return 0; 2383 return 0;
2378} 2384}
@@ -2384,7 +2390,19 @@ static int intel8x0_resume(snd_card_t *card)
2384 2390
2385 pci_enable_device(chip->pci); 2391 pci_enable_device(chip->pci);
2386 pci_set_master(chip->pci); 2392 pci_set_master(chip->pci);
2387 snd_intel8x0_chip_init(chip, 0); 2393 request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip);
2394 synchronize_irq(chip->irq);
2395 snd_intel8x0_chip_init(chip, 1);
2396
2397 /* re-initialize mixer stuff */
2398 if (chip->device_type == DEVICE_INTEL_ICH4) {
2399 /* enable separate SDINs for ICH4 */
2400 iputbyte(chip, ICHREG(SDM), chip->sdm_saved);
2401 /* use slot 10/11 for SPDIF */
2402 iputdword(chip, ICHREG(GLOB_CNT),
2403 (igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_PCM_SPDIF_MASK) |
2404 ICH_PCM_SPDIF_1011);
2405 }
2388 2406
2389 /* refill nocache */ 2407 /* refill nocache */
2390 if (chip->fix_nocache) 2408 if (chip->fix_nocache)
@@ -2451,8 +2469,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip)
2451 } 2469 }
2452 do_gettimeofday(&start_time); 2470 do_gettimeofday(&start_time);
2453 spin_unlock_irq(&chip->reg_lock); 2471 spin_unlock_irq(&chip->reg_lock);
2454 set_current_state(TASK_UNINTERRUPTIBLE); 2472 msleep(50);
2455 schedule_timeout(HZ / 20);
2456 spin_lock_irq(&chip->reg_lock); 2473 spin_lock_irq(&chip->reg_lock);
2457 /* check the position */ 2474 /* check the position */
2458 pos = ichdev->fragsize1; 2475 pos = ichdev->fragsize1;
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 096f15132853..39b5e7db1543 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1050,27 +1050,22 @@ static struct m3_hv_quirk m3_hv_quirk_list[] = {
1050 * lowlevel functions 1050 * lowlevel functions
1051 */ 1051 */
1052 1052
1053#define big_mdelay(msec) do {\ 1053static inline void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg)
1054 set_current_state(TASK_UNINTERRUPTIBLE);\
1055 schedule_timeout(((msec) * HZ) / 1000);\
1056} while (0)
1057
1058inline static void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg)
1059{ 1054{
1060 outw(value, chip->iobase + reg); 1055 outw(value, chip->iobase + reg);
1061} 1056}
1062 1057
1063inline static u16 snd_m3_inw(m3_t *chip, unsigned long reg) 1058static inline u16 snd_m3_inw(m3_t *chip, unsigned long reg)
1064{ 1059{
1065 return inw(chip->iobase + reg); 1060 return inw(chip->iobase + reg);
1066} 1061}
1067 1062
1068inline static void snd_m3_outb(m3_t *chip, u8 value, unsigned long reg) 1063static inline void snd_m3_outb(m3_t *chip, u8 value, unsigned long reg)
1069{ 1064{
1070 outb(value, chip->iobase + reg); 1065 outb(value, chip->iobase + reg);
1071} 1066}
1072 1067
1073inline static u8 snd_m3_inb(m3_t *chip, unsigned long reg) 1068static inline u8 snd_m3_inb(m3_t *chip, unsigned long reg)
1074{ 1069{
1075 return inb(chip->iobase + reg); 1070 return inb(chip->iobase + reg);
1076} 1071}
@@ -1096,7 +1091,7 @@ static void snd_m3_assp_write(m3_t *chip, u16 region, u16 index, u16 data)
1096static void snd_m3_assp_halt(m3_t *chip) 1091static void snd_m3_assp_halt(m3_t *chip)
1097{ 1092{
1098 chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK; 1093 chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK;
1099 big_mdelay(10); 1094 msleep(10);
1100 snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B); 1095 snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B);
1101} 1096}
1102 1097
@@ -2108,9 +2103,9 @@ static void snd_m3_ac97_reset(m3_t *chip)
2108 */ 2103 */
2109 tmp = inw(io + RING_BUS_CTRL_A); 2104 tmp = inw(io + RING_BUS_CTRL_A);
2110 outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A); 2105 outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A);
2111 big_mdelay(20); 2106 msleep(20);
2112 outw(tmp, io + RING_BUS_CTRL_A); 2107 outw(tmp, io + RING_BUS_CTRL_A);
2113 big_mdelay(50); 2108 msleep(50);
2114#endif 2109#endif
2115} 2110}
2116 2111
@@ -2525,9 +2520,13 @@ static void
2525snd_m3_enable_ints(m3_t *chip) 2520snd_m3_enable_ints(m3_t *chip)
2526{ 2521{
2527 unsigned long io = chip->iobase; 2522 unsigned long io = chip->iobase;
2523 unsigned short val;
2528 2524
2529 /* TODO: MPU401 not supported yet */ 2525 /* TODO: MPU401 not supported yet */
2530 outw(ASSP_INT_ENABLE | HV_INT_ENABLE /*| MPU401_INT_ENABLE*/, io + HOST_INT_CTRL); 2526 val = ASSP_INT_ENABLE /*| MPU401_INT_ENABLE*/;
2527 if (chip->hv_quirk && (chip->hv_quirk->config & HV_CTRL_ENABLE))
2528 val |= HV_INT_ENABLE;
2529 outw(val, io + HOST_INT_CTRL);
2531 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE, 2530 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE,
2532 io + ASSP_CONTROL_C); 2531 io + ASSP_CONTROL_C);
2533} 2532}
@@ -2589,7 +2588,7 @@ static int m3_suspend(snd_card_t *card, pm_message_t state)
2589 snd_pcm_suspend_all(chip->pcm); 2588 snd_pcm_suspend_all(chip->pcm);
2590 snd_ac97_suspend(chip->ac97); 2589 snd_ac97_suspend(chip->ac97);
2591 2590
2592 big_mdelay(10); /* give the assp a chance to idle.. */ 2591 msleep(10); /* give the assp a chance to idle.. */
2593 2592
2594 snd_m3_assp_halt(chip); 2593 snd_m3_assp_halt(chip);
2595 2594
@@ -2697,6 +2696,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2697 } 2696 }
2698 2697
2699 spin_lock_init(&chip->reg_lock); 2698 spin_lock_init(&chip->reg_lock);
2699 spin_lock_init(&chip->ac97_lock);
2700
2700 switch (pci->device) { 2701 switch (pci->device) {
2701 case PCI_DEVICE_ID_ESS_ALLEGRO: 2702 case PCI_DEVICE_ID_ESS_ALLEGRO:
2702 case PCI_DEVICE_ID_ESS_ALLEGRO_1: 2703 case PCI_DEVICE_ID_ESS_ALLEGRO_1:
@@ -2765,6 +2766,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2765 snd_m3_assp_init(chip); 2766 snd_m3_assp_init(chip);
2766 snd_m3_amp_enable(chip, 1); 2767 snd_m3_amp_enable(chip, 1);
2767 2768
2769 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
2770
2768 if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, 2771 if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ,
2769 card->driver, (void *)chip)) { 2772 card->driver, (void *)chip)) {
2770 snd_printk("unable to grab IRQ %d\n", pci->irq); 2773 snd_printk("unable to grab IRQ %d\n", pci->irq);
@@ -2786,9 +2789,6 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2786 return err; 2789 return err;
2787 } 2790 }
2788 2791
2789 spin_lock_init(&chip->ac97_lock);
2790 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
2791
2792 if ((err = snd_m3_mixer(chip)) < 0) 2792 if ((err = snd_m3_mixer(chip)) < 0)
2793 return err; 2793 return err;
2794 2794
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 082c0d0f73d2..6c868d913634 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -445,9 +445,9 @@ static int snd_mixart_trigger(snd_pcm_substream_t *subs, int cmd)
445 445
446static int mixart_sync_nonblock_events(mixart_mgr_t *mgr) 446static int mixart_sync_nonblock_events(mixart_mgr_t *mgr)
447{ 447{
448 int timeout = HZ; 448 unsigned long timeout = jiffies + HZ;
449 while (atomic_read(&mgr->msg_processed) > 0) { 449 while (atomic_read(&mgr->msg_processed) > 0) {
450 if (! timeout--) { 450 if (time_after(jiffies, timeout)) {
451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); 451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n");
452 return -EBUSY; 452 return -EBUSY;
453 } 453 }
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 8a52091f8552..7eb20b8f89f6 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -285,43 +285,43 @@ MODULE_DEVICE_TABLE(pci, snd_nm256_ids);
285 * lowlvel stuffs 285 * lowlvel stuffs
286 */ 286 */
287 287
288inline static u8 288static inline u8
289snd_nm256_readb(nm256_t *chip, int offset) 289snd_nm256_readb(nm256_t *chip, int offset)
290{ 290{
291 return readb(chip->cport + offset); 291 return readb(chip->cport + offset);
292} 292}
293 293
294inline static u16 294static inline u16
295snd_nm256_readw(nm256_t *chip, int offset) 295snd_nm256_readw(nm256_t *chip, int offset)
296{ 296{
297 return readw(chip->cport + offset); 297 return readw(chip->cport + offset);
298} 298}
299 299
300inline static u32 300static inline u32
301snd_nm256_readl(nm256_t *chip, int offset) 301snd_nm256_readl(nm256_t *chip, int offset)
302{ 302{
303 return readl(chip->cport + offset); 303 return readl(chip->cport + offset);
304} 304}
305 305
306inline static void 306static inline void
307snd_nm256_writeb(nm256_t *chip, int offset, u8 val) 307snd_nm256_writeb(nm256_t *chip, int offset, u8 val)
308{ 308{
309 writeb(val, chip->cport + offset); 309 writeb(val, chip->cport + offset);
310} 310}
311 311
312inline static void 312static inline void
313snd_nm256_writew(nm256_t *chip, int offset, u16 val) 313snd_nm256_writew(nm256_t *chip, int offset, u16 val)
314{ 314{
315 writew(val, chip->cport + offset); 315 writew(val, chip->cport + offset);
316} 316}
317 317
318inline static void 318static inline void
319snd_nm256_writel(nm256_t *chip, int offset, u32 val) 319snd_nm256_writel(nm256_t *chip, int offset, u32 val)
320{ 320{
321 writel(val, chip->cport + offset); 321 writel(val, chip->cport + offset);
322} 322}
323 323
324inline static void 324static inline void
325snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size) 325snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size)
326{ 326{
327 offset -= chip->buffer_start; 327 offset -= chip->buffer_start;
@@ -926,7 +926,7 @@ snd_nm256_init_chip(nm256_t *chip)
926} 926}
927 927
928 928
929inline static void 929static inline void
930snd_nm256_intr_check(nm256_t *chip) 930snd_nm256_intr_check(nm256_t *chip)
931{ 931{
932 if (chip->badintrcount++ > 1000) { 932 if (chip->badintrcount++ > 1000) {
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index a673cc438b91..796621de5009 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -445,6 +445,7 @@ struct _hdsp {
445 u32 control2_register; /* cached value */ 445 u32 control2_register; /* cached value */
446 u32 creg_spdif; 446 u32 creg_spdif;
447 u32 creg_spdif_stream; 447 u32 creg_spdif_stream;
448 int clock_source_locked;
448 char *card_name; /* digiface/multiface */ 449 char *card_name; /* digiface/multiface */
449 HDSP_IO_Type io_type; /* ditto, but for code use */ 450 HDSP_IO_Type io_type; /* ditto, but for code use */
450 unsigned short firmware_rev; 451 unsigned short firmware_rev;
@@ -678,8 +679,7 @@ static int snd_hdsp_load_firmware_from_cache(hdsp_t *hdsp) {
678 } 679 }
679 680
680 if ((1000 / HZ) < 3000) { 681 if ((1000 / HZ) < 3000) {
681 set_current_state(TASK_UNINTERRUPTIBLE); 682 ssleep(3);
682 schedule_timeout((3000 * HZ + 999) / 1000);
683 } else { 683 } else {
684 mdelay(3000); 684 mdelay(3000);
685 } 685 }
@@ -2095,6 +2095,34 @@ static int snd_hdsp_put_clock_source(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
2095 return change; 2095 return change;
2096} 2096}
2097 2097
2098static int snd_hdsp_info_clock_source_lock(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
2099{
2100 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
2101 uinfo->count = 1;
2102 uinfo->value.integer.min = 0;
2103 uinfo->value.integer.max = 1;
2104 return 0;
2105}
2106
2107static int snd_hdsp_get_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
2108{
2109 hdsp_t *hdsp = snd_kcontrol_chip(kcontrol);
2110
2111 ucontrol->value.integer.value[0] = hdsp->clock_source_locked;
2112 return 0;
2113}
2114
2115static int snd_hdsp_put_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
2116{
2117 hdsp_t *hdsp = snd_kcontrol_chip(kcontrol);
2118 int change;
2119
2120 change = (int)ucontrol->value.integer.value[0] != hdsp->clock_source_locked;
2121 if (change)
2122 hdsp->clock_source_locked = ucontrol->value.integer.value[0];
2123 return change;
2124}
2125
2098#define HDSP_DA_GAIN(xname, xindex) \ 2126#define HDSP_DA_GAIN(xname, xindex) \
2099{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2127{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \
2100 .name = xname, \ 2128 .name = xname, \
@@ -3117,6 +3145,15 @@ HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0),
3117HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), 3145HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0),
3118/* 'Sample Clock Source' complies with the alsa control naming scheme */ 3146/* 'Sample Clock Source' complies with the alsa control naming scheme */
3119HDSP_CLOCK_SOURCE("Sample Clock Source", 0), 3147HDSP_CLOCK_SOURCE("Sample Clock Source", 0),
3148{
3149 /* FIXME: should be PCM or MIXER? */
3150 /* .iface = SNDRV_CTL_ELEM_IFACE_PCM, */
3151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3152 .name = "Sample Clock Source Locking",
3153 .info = snd_hdsp_info_clock_source_lock,
3154 .get = snd_hdsp_get_clock_source_lock,
3155 .put = snd_hdsp_put_clock_source_lock,
3156},
3120HDSP_SYSTEM_CLOCK_MODE("System Clock Mode", 0), 3157HDSP_SYSTEM_CLOCK_MODE("System Clock Mode", 0),
3121HDSP_PREF_SYNC_REF("Preferred Sync Reference", 0), 3158HDSP_PREF_SYNC_REF("Preferred Sync Reference", 0),
3122HDSP_AUTOSYNC_REF("AutoSync Reference", 0), 3159HDSP_AUTOSYNC_REF("AutoSync Reference", 0),
@@ -3349,6 +3386,7 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
3349 snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); 3386 snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode);
3350 3387
3351 snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); 3388 snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate);
3389 snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No");
3352 3390
3353 snd_iprintf(buffer, "\n"); 3391 snd_iprintf(buffer, "\n");
3354 3392
@@ -3853,13 +3891,14 @@ static int snd_hdsp_hw_params(snd_pcm_substream_t *substream,
3853 */ 3891 */
3854 3892
3855 spin_lock_irq(&hdsp->lock); 3893 spin_lock_irq(&hdsp->lock);
3856 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { 3894 if (! hdsp->clock_source_locked) {
3857 spin_unlock_irq(&hdsp->lock); 3895 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) {
3858 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); 3896 spin_unlock_irq(&hdsp->lock);
3859 return err; 3897 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
3860 } else { 3898 return err;
3861 spin_unlock_irq(&hdsp->lock); 3899 }
3862 } 3900 }
3901 spin_unlock_irq(&hdsp->lock);
3863 3902
3864 if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) { 3903 if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) {
3865 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); 3904 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
@@ -4284,13 +4323,17 @@ static int snd_hdsp_playback_open(snd_pcm_substream_t *substream)
4284 4323
4285 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); 4324 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
4286 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes); 4325 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes);
4287 if (hdsp->io_type == H9632) { 4326 if (hdsp->clock_source_locked) {
4288 runtime->hw.channels_min = hdsp->qs_out_channels; 4327 runtime->hw.rate_min = runtime->hw.rate_max = hdsp->system_sample_rate;
4289 runtime->hw.channels_max = hdsp->ss_out_channels; 4328 } else if (hdsp->io_type == H9632) {
4290 runtime->hw.rate_max = 192000; 4329 runtime->hw.rate_max = 192000;
4291 runtime->hw.rates = SNDRV_PCM_RATE_KNOT; 4330 runtime->hw.rates = SNDRV_PCM_RATE_KNOT;
4292 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdsp_hw_constraints_9632_sample_rates); 4331 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdsp_hw_constraints_9632_sample_rates);
4293 } 4332 }
4333 if (hdsp->io_type == H9632) {
4334 runtime->hw.channels_min = hdsp->qs_out_channels;
4335 runtime->hw.channels_max = hdsp->ss_out_channels;
4336 }
4294 4337
4295 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 4338 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
4296 snd_hdsp_hw_rule_out_channels, hdsp, 4339 snd_hdsp_hw_rule_out_channels, hdsp,
@@ -5036,8 +5079,7 @@ static int __devinit snd_hdsp_create(snd_card_t *card,
5036 if (!is_9652 && !is_9632) { 5079 if (!is_9652 && !is_9632) {
5037 /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ 5080 /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */
5038 if ((1000 / HZ) < 2000) { 5081 if ((1000 / HZ) < 2000) {
5039 set_current_state(TASK_UNINTERRUPTIBLE); 5082 ssleep(2);
5040 schedule_timeout((2000 * HZ + 999) / 1000);
5041 } else { 5083 } else {
5042 mdelay(2000); 5084 mdelay(2000);
5043 } 5085 }
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index f3037402d58f..1bc9d0df8516 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -1470,7 +1470,7 @@ static int snd_rme9652_get_tc_valid(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu
1470 return 0; 1470 return 0;
1471} 1471}
1472 1472
1473#if ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE 1473#ifdef ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE
1474 1474
1475/* FIXME: this routine needs a port to the new control API --jk */ 1475/* FIXME: this routine needs a port to the new control API --jk */
1476 1476
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index ccd5ca2ba16f..29d89bfba0a4 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -472,6 +472,7 @@ void snd_trident_write_voice_regs(trident_t * trident,
472 break; 472 break;
473 default: 473 default:
474 snd_BUG(); 474 snd_BUG();
475 return;
475 } 476 }
476 477
477 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 478 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
@@ -3152,8 +3153,7 @@ static int snd_trident_gameport_open(struct gameport *gameport, int mode)
3152 switch (mode) { 3153 switch (mode) {
3153 case GAMEPORT_MODE_COOKED: 3154 case GAMEPORT_MODE_COOKED:
3154 outb(GAMEPORT_MODE_ADC, TRID_REG(chip, GAMEPORT_GCR)); 3155 outb(GAMEPORT_MODE_ADC, TRID_REG(chip, GAMEPORT_GCR));
3155 set_current_state(TASK_UNINTERRUPTIBLE); 3156 msleep(20);
3156 schedule_timeout(1 + 20 * HZ / 1000); /* 20msec */
3157 return 0; 3157 return 0;
3158 case GAMEPORT_MODE_RAW: 3158 case GAMEPORT_MODE_RAW:
3159 outb(0, TRID_REG(chip, GAMEPORT_GCR)); 3159 outb(0, TRID_REG(chip, GAMEPORT_GCR));
@@ -3204,7 +3204,7 @@ static inline void snd_trident_free_gameport(trident_t *chip) { }
3204/* 3204/*
3205 * delay for 1 tick 3205 * delay for 1 tick
3206 */ 3206 */
3207inline static void do_delay(trident_t *chip) 3207static inline void do_delay(trident_t *chip)
3208{ 3208{
3209 set_current_state(TASK_UNINTERRUPTIBLE); 3209 set_current_state(TASK_UNINTERRUPTIBLE);
3210 schedule_timeout(1); 3210 schedule_timeout(1);
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c
index 6cc282681e09..333d3790692a 100644
--- a/sound/pci/trident/trident_memory.c
+++ b/sound/pci/trident/trident_memory.c
@@ -118,7 +118,7 @@ static inline void set_silent_tlb(trident_t *trident, int page)
118#endif /* PAGE_SIZE */ 118#endif /* PAGE_SIZE */
119 119
120/* calculate buffer pointer from offset address */ 120/* calculate buffer pointer from offset address */
121inline static void *offset_ptr(trident_t *trident, int offset) 121static inline void *offset_ptr(trident_t *trident, int offset)
122{ 122{
123 char *ptr; 123 char *ptr;
124 ptr = page_to_ptr(trident, get_aligned_page(offset)); 124 ptr = page_to_ptr(trident, get_aligned_page(offset));
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 42c48f0ce8e8..4889600387c8 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -547,8 +547,7 @@ static void snd_via82xx_codec_wait(ac97_t *ac97)
547 int err; 547 int err;
548 err = snd_via82xx_codec_ready(chip, ac97->num); 548 err = snd_via82xx_codec_ready(chip, ac97->num);
549 /* here we need to wait fairly for long time.. */ 549 /* here we need to wait fairly for long time.. */
550 set_current_state(TASK_UNINTERRUPTIBLE); 550 msleep(500);
551 schedule_timeout(HZ/2);
552} 551}
553 552
554static void snd_via82xx_codec_write(ac97_t *ac97, 553static void snd_via82xx_codec_write(ac97_t *ac97,
@@ -1847,7 +1846,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip)
1847static int snd_via82xx_chip_init(via82xx_t *chip) 1846static int snd_via82xx_chip_init(via82xx_t *chip)
1848{ 1847{
1849 unsigned int val; 1848 unsigned int val;
1850 int max_count; 1849 unsigned long end_time;
1851 unsigned char pval; 1850 unsigned char pval;
1852 1851
1853#if 0 /* broken on K7M? */ 1852#if 0 /* broken on K7M? */
@@ -1889,14 +1888,14 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
1889 } 1888 }
1890 1889
1891 /* wait until codec ready */ 1890 /* wait until codec ready */
1892 max_count = ((3 * HZ) / 4) + 1; 1891 end_time = jiffies + msecs_to_jiffies(750);
1893 do { 1892 do {
1894 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 1893 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
1895 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 1894 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
1896 break; 1895 break;
1897 set_current_state(TASK_UNINTERRUPTIBLE); 1896 set_current_state(TASK_UNINTERRUPTIBLE);
1898 schedule_timeout(1); 1897 schedule_timeout(1);
1899 } while (--max_count > 0); 1898 } while (time_before(jiffies, end_time));
1900 1899
1901 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 1900 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
1902 snd_printk("AC'97 codec is not ready [0x%x]\n", val); 1901 snd_printk("AC'97 codec is not ready [0x%x]\n", val);
@@ -1905,7 +1904,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
1905 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 1904 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
1906 VIA_REG_AC97_SECONDARY_VALID | 1905 VIA_REG_AC97_SECONDARY_VALID |
1907 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 1906 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
1908 max_count = ((3 * HZ) / 4) + 1; 1907 end_time = jiffies + msecs_to_jiffies(750);
1909 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 1908 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
1910 VIA_REG_AC97_SECONDARY_VALID | 1909 VIA_REG_AC97_SECONDARY_VALID |
1911 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 1910 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
@@ -1916,7 +1915,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
1916 } 1915 }
1917 set_current_state(TASK_INTERRUPTIBLE); 1916 set_current_state(TASK_INTERRUPTIBLE);
1918 schedule_timeout(1); 1917 schedule_timeout(1);
1919 } while (--max_count > 0); 1918 } while (time_before(jiffies, end_time));
1920 /* This is ok, the most of motherboards have only one codec */ 1919 /* This is ok, the most of motherboards have only one codec */
1921 1920
1922 __ac97_ok2: 1921 __ac97_ok2:
@@ -2178,7 +2177,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2178 { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ 2177 { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */
2179 { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */ 2178 { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */
2180 { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */ 2179 { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */
2181 { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_NO_VRA }, /* Twinhead mobo */ 2180 { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_SRC }, /* Twinhead laptop */
2182 { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */ 2181 { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */
2183 { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */ 2182 { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */
2184 { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */ 2183 { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */
@@ -2187,6 +2186,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2187 { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ 2186 { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */
2188 { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ 2187 { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */
2189 { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */ 2188 { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */
2189 { .subvendor = 0x4005, .subdevice = 0x4710, .action = VIA_DXS_SRC }, /* MSI K7T266 Pro2 (MS-6380 V2.0) BIOS 3.7 */
2190 { } /* terminator */ 2190 { } /* terminator */
2191 }; 2191 };
2192 struct dxs_whitelist *w; 2192 struct dxs_whitelist *w;
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5896d289f9ac..4a9779cc9733 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -408,8 +408,7 @@ static void snd_via82xx_codec_wait(ac97_t *ac97)
408 int err; 408 int err;
409 err = snd_via82xx_codec_ready(chip, ac97->num); 409 err = snd_via82xx_codec_ready(chip, ac97->num);
410 /* here we need to wait fairly for long time.. */ 410 /* here we need to wait fairly for long time.. */
411 set_current_state(TASK_UNINTERRUPTIBLE); 411 msleep(500);
412 schedule_timeout(HZ/2);
413} 412}
414 413
415static void snd_via82xx_codec_write(ac97_t *ac97, 414static void snd_via82xx_codec_write(ac97_t *ac97,
@@ -923,7 +922,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip)
923static int snd_via82xx_chip_init(via82xx_t *chip) 922static int snd_via82xx_chip_init(via82xx_t *chip)
924{ 923{
925 unsigned int val; 924 unsigned int val;
926 int max_count; 925 unsigned long end_time;
927 unsigned char pval; 926 unsigned char pval;
928 927
929 pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval); 928 pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval);
@@ -962,14 +961,14 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
962 } 961 }
963 962
964 /* wait until codec ready */ 963 /* wait until codec ready */
965 max_count = ((3 * HZ) / 4) + 1; 964 end_time = jiffies + msecs_to_jiffies(750);
966 do { 965 do {
967 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 966 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
968 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 967 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
969 break; 968 break;
970 set_current_state(TASK_UNINTERRUPTIBLE); 969 set_current_state(TASK_UNINTERRUPTIBLE);
971 schedule_timeout(1); 970 schedule_timeout(1);
972 } while (--max_count > 0); 971 } while (time_before(jiffies, end_time));
973 972
974 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 973 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
975 snd_printk("AC'97 codec is not ready [0x%x]\n", val); 974 snd_printk("AC'97 codec is not ready [0x%x]\n", val);
@@ -977,7 +976,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
977 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 976 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
978 VIA_REG_AC97_SECONDARY_VALID | 977 VIA_REG_AC97_SECONDARY_VALID |
979 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 978 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
980 max_count = ((3 * HZ) / 4) + 1; 979 end_time = jiffies + msecs_to_jiffies(750);
981 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 980 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
982 VIA_REG_AC97_SECONDARY_VALID | 981 VIA_REG_AC97_SECONDARY_VALID |
983 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 982 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
@@ -988,7 +987,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
988 } 987 }
989 set_current_state(TASK_INTERRUPTIBLE); 988 set_current_state(TASK_INTERRUPTIBLE);
990 schedule_timeout(1); 989 schedule_timeout(1);
991 } while (--max_count > 0); 990 } while (time_before(jiffies, end_time));
992 /* This is ok, the most of motherboards have only one codec */ 991 /* This is ok, the most of motherboards have only one codec */
993 992
994 __ac97_ok2: 993 __ac97_ok2:
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 683e9799976f..967bd5e6b23c 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -82,7 +82,7 @@ static int vx2_reg_index[VX_REG_MAX] = {
82 [VX_GPIOC] = 0, /* on the PLX */ 82 [VX_GPIOC] = 0, /* on the PLX */
83}; 83};
84 84
85inline static unsigned long vx2_reg_addr(vx_core_t *_chip, int reg) 85static inline unsigned long vx2_reg_addr(vx_core_t *_chip, int reg)
86{ 86{
87 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 87 struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
88 return chip->port[vx2_reg_index[reg]] + vx2_reg_offset[reg]; 88 return chip->port[vx2_reg_index[reg]] + vx2_reg_offset[reg];
@@ -235,7 +235,7 @@ static void vx2_setup_pseudo_dma(vx_core_t *chip, int do_write)
235/* 235/*
236 * vx_release_pseudo_dma - disable the pseudo-DMA mode 236 * vx_release_pseudo_dma - disable the pseudo-DMA mode
237 */ 237 */
238inline static void vx2_release_pseudo_dma(vx_core_t *chip) 238static inline void vx2_release_pseudo_dma(vx_core_t *chip)
239{ 239{
240 /* HREQ pin disabled. */ 240 /* HREQ pin disabled. */
241 vx_outl(chip, ICR, 0); 241 vx_outl(chip, ICR, 0);
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 2ae79610ecb5..d54f88a1b525 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -84,16 +84,16 @@ static inline void snd_ymfpci_writel(ymfpci_t *chip, u32 offset, u32 val)
84 84
85static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary) 85static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
86{ 86{
87 signed long end_time; 87 unsigned long end_time;
88 u32 reg = secondary ? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR; 88 u32 reg = secondary ? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR;
89 89
90 end_time = (jiffies + ((3 * HZ) / 4)) + 1; 90 end_time = jiffies + msecs_to_jiffies(750);
91 do { 91 do {
92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) 92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
93 return 0; 93 return 0;
94 set_current_state(TASK_UNINTERRUPTIBLE); 94 set_current_state(TASK_UNINTERRUPTIBLE);
95 schedule_timeout(1); 95 schedule_timeout(1);
96 } while (end_time - (signed long)jiffies >= 0); 96 } while (time_before(jiffies, end_time));
97 snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); 97 snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
98 return -EBUSY; 98 return -EBUSY;
99} 99}
diff --git a/sound/pcmcia/Kconfig b/sound/pcmcia/Kconfig
index 3611e298834f..5d1b0b762efa 100644
--- a/sound/pcmcia/Kconfig
+++ b/sound/pcmcia/Kconfig
@@ -8,23 +8,12 @@ config SND_VXPOCKET
8 depends on SND && PCMCIA && ISA 8 depends on SND && PCMCIA && ISA
9 select SND_VX_LIB 9 select SND_VX_LIB
10 help 10 help
11 Say Y here to include support for Digigram VXpocket 11 Say Y here to include support for Digigram VXpocket and
12 soundcards. 12 VXpocket 440 soundcards.
13 13
14 To compile this driver as a module, choose M here: the module 14 To compile this driver as a module, choose M here: the module
15 will be called snd-vxpocket. 15 will be called snd-vxpocket.
16 16
17config SND_VXP440
18 tristate "Digigram VXpocket 440"
19 depends on SND && PCMCIA && ISA
20 select SND_VX_LIB
21 help
22 Say Y here to include support for Digigram VXpocket 440
23 soundcards.
24
25 To compile this driver as a module, choose M here: the module
26 will be called snd-vxp440.
27
28config SND_PDAUDIOCF 17config SND_PDAUDIOCF
29 tristate "Sound Core PDAudioCF" 18 tristate "Sound Core PDAudioCF"
30 depends on SND && PCMCIA && ISA 19 depends on SND && PCMCIA && ISA
diff --git a/sound/pcmcia/vx/Makefile b/sound/pcmcia/vx/Makefile
index f35dfa1af094..54971f01e968 100644
--- a/sound/pcmcia/vx/Makefile
+++ b/sound/pcmcia/vx/Makefile
@@ -3,9 +3,6 @@
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> 3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4# 4#
5 5
6snd-vx-cs-objs := vx_entry.o vxp_ops.o vxp_mixer.o 6snd-vxpocket-objs := vxpocket.o vxp_ops.o vxp_mixer.o
7snd-vxpocket-objs := vxpocket.o
8snd-vxp440-objs := vxp440.o
9 7
10obj-$(CONFIG_SND_VXPOCKET) += snd-vxpocket.o snd-vx-cs.o 8obj-$(CONFIG_SND_VXPOCKET) += snd-vxpocket.o
11obj-$(CONFIG_SND_VXP440) += snd-vxp440.o snd-vx-cs.o
diff --git a/sound/pcmcia/vx/vx_entry.c b/sound/pcmcia/vx/vx_entry.c
deleted file mode 100644
index df7a39ba9680..000000000000
--- a/sound/pcmcia/vx/vx_entry.c
+++ /dev/null
@@ -1,375 +0,0 @@
1/*
2 * Driver for Digigram VXpocket soundcards
3 *
4 * PCMCIA entry part
5 *
6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <sound/driver.h>
24#include <sound/core.h>
25#include "vxpocket.h"
26#include <pcmcia/ciscode.h>
27#include <pcmcia/cisreg.h>
28
29
30MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
31MODULE_DESCRIPTION("Common routines for Digigram PCMCIA VX drivers");
32MODULE_LICENSE("GPL");
33
34/*
35 * prototypes
36 */
37static void vxpocket_config(dev_link_t *link);
38
39
40static void vxpocket_release(dev_link_t *link)
41{
42 if (link->state & DEV_CONFIG) {
43 /* release cs resources */
44 pcmcia_release_configuration(link->handle);
45 pcmcia_release_io(link->handle, &link->io);
46 pcmcia_release_irq(link->handle, &link->irq);
47 link->state &= ~DEV_CONFIG;
48 }
49}
50
51/*
52 * destructor
53 */
54static int snd_vxpocket_free(vx_core_t *chip)
55{
56 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
57 struct snd_vxp_entry *hw;
58 dev_link_t *link = &vxp->link;
59
60 vxpocket_release(link);
61
62 /* Break the link with Card Services */
63 if (link->handle)
64 pcmcia_deregister_client(link->handle);
65
66 hw = vxp->hw_entry;
67 if (hw)
68 hw->card_list[vxp->index] = NULL;
69 chip->card = NULL;
70 kfree(chip->dev);
71
72 snd_vx_free_firmware(chip);
73 kfree(chip);
74 return 0;
75}
76
77static int snd_vxpocket_dev_free(snd_device_t *device)
78{
79 vx_core_t *chip = device->device_data;
80 return snd_vxpocket_free(chip);
81}
82
83/*
84 * snd_vxpocket_attach - attach callback for cs
85 * @hw: the hardware information
86 */
87dev_link_t *snd_vxpocket_attach(struct snd_vxp_entry *hw)
88{
89 client_reg_t client_reg; /* Register with cardmgr */
90 dev_link_t *link; /* Info for cardmgr */
91 int i, ret;
92 vx_core_t *chip;
93 struct snd_vxpocket *vxp;
94 snd_card_t *card;
95 static snd_device_ops_t ops = {
96 .dev_free = snd_vxpocket_dev_free,
97 };
98
99 snd_printdd(KERN_DEBUG "vxpocket_attach called\n");
100 /* find an empty slot from the card list */
101 for (i = 0; i < SNDRV_CARDS; i++) {
102 if (! hw->card_list[i])
103 break;
104 }
105 if (i >= SNDRV_CARDS) {
106 snd_printk(KERN_ERR "vxpocket: too many cards found\n");
107 return NULL;
108 }
109 if (! hw->enable_table[i])
110 return NULL; /* disabled explicitly */
111
112 /* ok, create a card instance */
113 card = snd_card_new(hw->index_table[i], hw->id_table[i], THIS_MODULE, 0);
114 if (card == NULL) {
115 snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
116 return NULL;
117 }
118
119 chip = snd_vx_create(card, hw->hardware, hw->ops,
120 sizeof(struct snd_vxpocket) - sizeof(vx_core_t));
121 if (! chip)
122 return NULL;
123
124#ifdef SND_VX_FW_LOADER
125 /* fake a device here since pcmcia doesn't give a valid device... */
126 chip->dev = kcalloc(1, sizeof(*chip->dev), GFP_KERNEL);
127 if (! chip->dev) {
128 snd_printk(KERN_ERR "vxp: can't malloc chip->dev\n");
129 kfree(chip);
130 snd_card_free(card);
131 return NULL;
132 }
133 device_initialize(chip->dev);
134 sprintf(chip->dev->bus_id, "vxpocket%d", i);
135#endif
136
137 if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) {
138 kfree(chip);
139 snd_card_free(card);
140 return NULL;
141 }
142
143 vxp = (struct snd_vxpocket *)chip;
144 vxp->index = i;
145 vxp->hw_entry = hw;
146 chip->ibl.size = hw->ibl[i];
147 hw->card_list[i] = chip;
148
149 link = &vxp->link;
150 link->priv = chip;
151
152 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
153 link->io.NumPorts1 = 16;
154
155 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
156 // link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
157
158 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
159 link->irq.Handler = &snd_vx_irq_handler;
160 link->irq.Instance = chip;
161
162 link->conf.Attributes = CONF_ENABLE_IRQ;
163 link->conf.Vcc = 50;
164 link->conf.IntType = INT_MEMORY_AND_IO;
165 link->conf.ConfigIndex = 1;
166 link->conf.Present = PRESENT_OPTION;
167
168 /* Register with Card Services */
169 memset(&client_reg, 0, sizeof(client_reg));
170 client_reg.dev_info = hw->dev_info;
171 client_reg.Version = 0x0210;
172 client_reg.event_callback_args.client_data = link;
173
174 ret = pcmcia_register_client(&link->handle, &client_reg);
175 if (ret != CS_SUCCESS) {
176 cs_error(link->handle, RegisterClient, ret);
177 snd_card_free(card);
178 return NULL;
179 }
180
181 /* Chain drivers */
182 link->next = hw->dev_list;
183 hw->dev_list = link;
184
185 /* snd_card_set_pm_callback(card, snd_vxpocket_suspend, snd_vxpocket_resume, chip); */
186
187 return link;
188}
189
190
191/**
192 * snd_vxpocket_assign_resources - initialize the hardware and card instance.
193 * @port: i/o port for the card
194 * @irq: irq number for the card
195 *
196 * this function assigns the specified port and irq, boot the card,
197 * create pcm and control instances, and initialize the rest hardware.
198 *
199 * returns 0 if successful, or a negative error code.
200 */
201static int snd_vxpocket_assign_resources(vx_core_t *chip, int port, int irq)
202{
203 int err;
204 snd_card_t *card = chip->card;
205 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
206
207 snd_printdd(KERN_DEBUG "vxpocket assign resources: port = 0x%x, irq = %d\n", port, irq);
208 vxp->port = port;
209
210 sprintf(card->shortname, "Digigram %s", card->driver);
211 sprintf(card->longname, "%s at 0x%x, irq %i",
212 card->shortname, port, irq);
213
214 chip->irq = irq;
215
216 if ((err = snd_vx_setup_firmware(chip)) < 0)
217 return err;
218
219 return 0;
220}
221
222
223/*
224 * snd_vxpocket_detach - detach callback for cs
225 * @hw: the hardware information
226 */
227void snd_vxpocket_detach(struct snd_vxp_entry *hw, dev_link_t *link)
228{
229 vx_core_t *chip;
230
231 if (! link)
232 return;
233
234 chip = link->priv;
235
236 snd_printdd(KERN_DEBUG "vxpocket_detach called\n");
237 /* Remove the interface data from the linked list */
238 if (hw) {
239 dev_link_t **linkp;
240 /* Locate device structure */
241 for (linkp = &hw->dev_list; *linkp; linkp = &(*linkp)->next)
242 if (*linkp == link) {
243 *linkp = link->next;
244 break;
245 }
246 }
247 chip->chip_status |= VX_STAT_IS_STALE; /* to be sure */
248 snd_card_disconnect(chip->card);
249 snd_card_free_in_thread(chip->card);
250}
251
252/*
253 * configuration callback
254 */
255
256#define CS_CHECK(fn, ret) \
257do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
258
259static void vxpocket_config(dev_link_t *link)
260{
261 client_handle_t handle = link->handle;
262 vx_core_t *chip = link->priv;
263 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
264 tuple_t tuple;
265 cisparse_t *parse = NULL;
266 u_short buf[32];
267 int last_fn, last_ret;
268
269 snd_printdd(KERN_DEBUG "vxpocket_config called\n");
270 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
271 if (! parse) {
272 snd_printk(KERN_ERR "vx: cannot allocate\n");
273 return;
274 }
275 tuple.Attributes = 0;
276 tuple.TupleData = (cisdata_t *)buf;
277 tuple.TupleDataMax = sizeof(buf);
278 tuple.TupleOffset = 0;
279 tuple.DesiredTuple = CISTPL_CONFIG;
280 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
281 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
282 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse));
283 link->conf.ConfigBase = parse->config.base;
284 link->conf.Present = parse->config.rmask[0];
285
286 /* Configure card */
287 link->state |= DEV_CONFIG;
288
289 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io));
290 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
291 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
292
293 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
294 goto failed;
295
296 link->dev = &vxp->node;
297 link->state &= ~DEV_CONFIG_PENDING;
298 kfree(parse);
299 return;
300
301cs_failed:
302 cs_error(link->handle, last_fn, last_ret);
303failed:
304 pcmcia_release_configuration(link->handle);
305 pcmcia_release_io(link->handle, &link->io);
306 pcmcia_release_irq(link->handle, &link->irq);
307 link->state &= ~DEV_CONFIG;
308 kfree(parse);
309}
310
311
312/*
313 * event callback
314 */
315int vxpocket_event(event_t event, int priority, event_callback_args_t *args)
316{
317 dev_link_t *link = args->client_data;
318 vx_core_t *chip = link->priv;
319
320 switch (event) {
321 case CS_EVENT_CARD_REMOVAL:
322 snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
323 link->state &= ~DEV_PRESENT;
324 if (link->state & DEV_CONFIG) {
325 chip->chip_status |= VX_STAT_IS_STALE;
326 }
327 break;
328 case CS_EVENT_CARD_INSERTION:
329 snd_printdd(KERN_DEBUG "CARD_INSERTION..\n");
330 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
331 vxpocket_config(link);
332 break;
333#ifdef CONFIG_PM
334 case CS_EVENT_PM_SUSPEND:
335 snd_printdd(KERN_DEBUG "SUSPEND\n");
336 link->state |= DEV_SUSPEND;
337 if (chip && chip->card->pm_suspend) {
338 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
339 chip->card->pm_suspend(chip->card, PMSG_SUSPEND);
340 }
341 /* Fall through... */
342 case CS_EVENT_RESET_PHYSICAL:
343 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
344 if (link->state & DEV_CONFIG)
345 pcmcia_release_configuration(link->handle);
346 break;
347 case CS_EVENT_PM_RESUME:
348 snd_printdd(KERN_DEBUG "RESUME\n");
349 link->state &= ~DEV_SUSPEND;
350 /* Fall through... */
351 case CS_EVENT_CARD_RESET:
352 snd_printdd(KERN_DEBUG "CARD_RESET\n");
353 if (DEV_OK(link)) {
354 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
355 snd_printdd(KERN_DEBUG "requestconfig...\n");
356 pcmcia_request_configuration(link->handle, &link->conf);
357 if (chip && chip->card->pm_resume) {
358 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
359 chip->card->pm_resume(chip->card);
360 }
361 }
362 snd_printdd(KERN_DEBUG "resume done!\n");
363 break;
364#endif
365 }
366 return 0;
367}
368
369/*
370 * exported stuffs
371 */
372EXPORT_SYMBOL(snd_vxpocket_ops);
373EXPORT_SYMBOL(snd_vxpocket_attach);
374EXPORT_SYMBOL(vxpocket_event);
375EXPORT_SYMBOL(snd_vxpocket_detach);
diff --git a/sound/pcmcia/vx/vxp440.c b/sound/pcmcia/vx/vxp440.c
deleted file mode 100644
index 59190a833001..000000000000
--- a/sound/pcmcia/vx/vxp440.c
+++ /dev/null
@@ -1,14 +0,0 @@
1#define COMPILE_VXP440
2
3/*
4 add the following as /etc/pcmcia/vxp440.conf:
5
6 device "snd-vxp440"
7 class "audio" module "snd-vxp440"
8
9 card "Digigram VX-POCKET440"
10 manfid 0x01f1, 0x0100
11 bind "snd-vxp440"
12*/
13
14#include "vxpocket.c"
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index ef6734271607..6f15c3d03ab5 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -49,7 +49,7 @@ static int vxp_reg_offset[VX_REG_MAX] = {
49}; 49};
50 50
51 51
52inline static unsigned long vxp_reg_addr(vx_core_t *_chip, int reg) 52static inline unsigned long vxp_reg_addr(vx_core_t *_chip, int reg)
53{ 53{
54 struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; 54 struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
55 return chip->port + vxp_reg_offset[reg]; 55 return chip->port + vxp_reg_offset[reg];
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 62d6fa128148..3a82161d3b24 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -24,21 +24,17 @@
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <sound/core.h> 25#include <sound/core.h>
26#include "vxpocket.h" 26#include "vxpocket.h"
27#include <pcmcia/ciscode.h>
28#include <pcmcia/cisreg.h>
27#include <sound/initval.h> 29#include <sound/initval.h>
28 30
29/* 31/*
30 */ 32 */
31 33
32#ifdef COMPILE_VXP440
33#define CARD_NAME "VXPocket440"
34#else
35#define CARD_NAME "VXPocket"
36#endif
37
38MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); 34MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
39MODULE_DESCRIPTION("Digigram " CARD_NAME); 35MODULE_DESCRIPTION("Digigram VXPocket");
40MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
41MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); 37MODULE_SUPPORTED_DEVICE("{{Digigram,VXPocket},{Digigram,VXPocket440}}");
42 38
43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
@@ -46,82 +42,405 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
46static int ibl[SNDRV_CARDS]; 42static int ibl[SNDRV_CARDS];
47 43
48module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
49MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 45MODULE_PARM_DESC(index, "Index value for VXPocket soundcard.");
50module_param_array(id, charp, NULL, 0444); 46module_param_array(id, charp, NULL, 0444);
51MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); 47MODULE_PARM_DESC(id, "ID string for VXPocket soundcard.");
52module_param_array(enable, bool, NULL, 0444); 48module_param_array(enable, bool, NULL, 0444);
53MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); 49MODULE_PARM_DESC(enable, "Enable VXPocket soundcard.");
54module_param_array(ibl, int, NULL, 0444); 50module_param_array(ibl, int, NULL, 0444);
55MODULE_PARM_DESC(ibl, "Capture IBL size for " CARD_NAME " soundcard."); 51MODULE_PARM_DESC(ibl, "Capture IBL size for VXPocket soundcard.");
56 52
57 53
58/* 54/*
59 */ 55 */
60 56
61#ifdef COMPILE_VXP440 57static unsigned int card_alloc;
58static dev_link_t *dev_list; /* Linked list of devices */
59static dev_info_t dev_info = "snd-vxpocket";
62 60
63/* 1 DSP, 1 sync UER, 1 sync World Clock (NIY) */
64/* SMPTE (NIY) */
65/* 2 stereo analog input (line/micro) */
66/* 2 stereo analog output */
67/* Only output levels can be modified */
68/* UER, but only for the first two inputs and outputs. */
69 61
70#define NUM_CODECS 2 62static int vxpocket_event(event_t event, int priority, event_callback_args_t *args);
71#define CARD_TYPE VX_TYPE_VXP440
72#define DEV_INFO "snd-vxp440"
73 63
74#else
75 64
76/* 1 DSP, 1 sync UER */ 65/*
77/* 1 programmable clock (NIY) */ 66 */
78/* 1 stereo analog input (line/micro) */ 67static void vxpocket_release(dev_link_t *link)
79/* 1 stereo analog output */ 68{
80/* Only output levels can be modified */ 69 if (link->state & DEV_CONFIG) {
70 /* release cs resources */
71 pcmcia_release_configuration(link->handle);
72 pcmcia_release_io(link->handle, &link->io);
73 pcmcia_release_irq(link->handle, &link->irq);
74 link->state &= ~DEV_CONFIG;
75 }
76 if (link->handle) {
77 /* Break the link with Card Services */
78 pcmcia_deregister_client(link->handle);
79 link->handle = NULL;
80 }
81}
81 82
82#define NUM_CODECS 1 83/*
83#define CARD_TYPE VX_TYPE_VXPOCKET 84 * destructor, called from snd_card_free_in_thread()
84#define DEV_INFO "snd-vxpocket" 85 */
86static int snd_vxpocket_dev_free(snd_device_t *device)
87{
88 vx_core_t *chip = device->device_data;
85 89
86#endif 90 snd_vx_free_firmware(chip);
91 kfree(chip);
92 return 0;
93}
87 94
88static dev_info_t dev_info = DEV_INFO;
89 95
90static struct snd_vx_hardware vxp_hw = { 96/*
91 .name = CARD_NAME, 97 * Hardware information
92 .type = CARD_TYPE, 98 */
99
100/* VX-pocket V2
101 *
102 * 1 DSP, 1 sync UER
103 * 1 programmable clock (NIY)
104 * 1 stereo analog input (line/micro)
105 * 1 stereo analog output
106 * Only output levels can be modified
107 */
108
109static struct snd_vx_hardware vxpocket_hw = {
110 .name = "VXPocket",
111 .type = VX_TYPE_VXPOCKET,
93 112
94 /* hardware specs */ 113 /* hardware specs */
95 .num_codecs = NUM_CODECS, 114 .num_codecs = 1,
96 .num_ins = NUM_CODECS, 115 .num_ins = 1,
97 .num_outs = NUM_CODECS, 116 .num_outs = 1,
98 .output_level_max = VX_ANALOG_OUT_LEVEL_MAX, 117 .output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
99}; 118};
100 119
101static struct snd_vxp_entry hw_entry = { 120/* VX-pocket 440
102 .dev_info = &dev_info, 121 *
122 * 1 DSP, 1 sync UER, 1 sync World Clock (NIY)
123 * SMPTE (NIY)
124 * 2 stereo analog input (line/micro)
125 * 2 stereo analog output
126 * Only output levels can be modified
127 * UER, but only for the first two inputs and outputs.
128 */
103 129
104 /* module parameters */ 130static struct snd_vx_hardware vxp440_hw = {
105 .index_table = index, 131 .name = "VXPocket440",
106 .id_table = id, 132 .type = VX_TYPE_VXP440,
107 .enable_table = enable, 133
108 .ibl = ibl, 134 /* hardware specs */
135 .num_codecs = 2,
136 .num_ins = 2,
137 .num_outs = 2,
138 .output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
139};
140
141
142/*
143 * create vxpocket instance
144 */
145static struct snd_vxpocket *snd_vxpocket_new(snd_card_t *card, int ibl)
146{
147 client_reg_t client_reg; /* Register with cardmgr */
148 dev_link_t *link; /* Info for cardmgr */
149 vx_core_t *chip;
150 struct snd_vxpocket *vxp;
151 int ret;
152 static snd_device_ops_t ops = {
153 .dev_free = snd_vxpocket_dev_free,
154 };
155
156 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
157 sizeof(struct snd_vxpocket) - sizeof(vx_core_t));
158 if (! chip)
159 return NULL;
160
161 if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) {
162 kfree(chip);
163 return NULL;
164 }
165 chip->ibl.size = ibl;
166
167 vxp = (struct snd_vxpocket *)chip;
168
169 link = &vxp->link;
170 link->priv = chip;
171
172 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
173 link->io.NumPorts1 = 16;
174
175 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
176
177 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
178 link->irq.Handler = &snd_vx_irq_handler;
179 link->irq.Instance = chip;
180
181 link->conf.Attributes = CONF_ENABLE_IRQ;
182 link->conf.Vcc = 50;
183 link->conf.IntType = INT_MEMORY_AND_IO;
184 link->conf.ConfigIndex = 1;
185 link->conf.Present = PRESENT_OPTION;
186
187 /* Register with Card Services */
188 memset(&client_reg, 0, sizeof(client_reg));
189 client_reg.dev_info = &dev_info;
190 client_reg.EventMask =
191 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL
192#ifdef CONFIG_PM
193 | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET
194 | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME
195#endif
196 ;
197 client_reg.event_handler = &vxpocket_event;
198 client_reg.Version = 0x0210;
199 client_reg.event_callback_args.client_data = link;
200
201 ret = pcmcia_register_client(&link->handle, &client_reg);
202 if (ret != CS_SUCCESS) {
203 cs_error(link->handle, RegisterClient, ret);
204 return NULL;
205 }
206
207 return vxp;
208}
209
210
211/**
212 * snd_vxpocket_assign_resources - initialize the hardware and card instance.
213 * @port: i/o port for the card
214 * @irq: irq number for the card
215 *
216 * this function assigns the specified port and irq, boot the card,
217 * create pcm and control instances, and initialize the rest hardware.
218 *
219 * returns 0 if successful, or a negative error code.
220 */
221static int snd_vxpocket_assign_resources(vx_core_t *chip, int port, int irq)
222{
223 int err;
224 snd_card_t *card = chip->card;
225 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
226
227 snd_printdd(KERN_DEBUG "vxpocket assign resources: port = 0x%x, irq = %d\n", port, irq);
228 vxp->port = port;
229
230 sprintf(card->shortname, "Digigram %s", card->driver);
231 sprintf(card->longname, "%s at 0x%x, irq %i",
232 card->shortname, port, irq);
233
234 chip->irq = irq;
235
236 if ((err = snd_vx_setup_firmware(chip)) < 0)
237 return err;
238
239 return 0;
240}
241
242
243/*
244 * configuration callback
245 */
246
247#define CS_CHECK(fn, ret) \
248do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
249
250static void vxpocket_config(dev_link_t *link)
251{
252 client_handle_t handle = link->handle;
253 vx_core_t *chip = link->priv;
254 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
255 tuple_t tuple;
256 cisparse_t *parse;
257 u_short buf[32];
258 int last_fn, last_ret;
259
260 snd_printdd(KERN_DEBUG "vxpocket_config called\n");
261 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
262 if (! parse) {
263 snd_printk(KERN_ERR "vx: cannot allocate\n");
264 return;
265 }
266 tuple.Attributes = 0;
267 tuple.TupleData = (cisdata_t *)buf;
268 tuple.TupleDataMax = sizeof(buf);
269 tuple.TupleOffset = 0;
270 tuple.DesiredTuple = CISTPL_CONFIG;
271 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
272 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
273 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse));
274 link->conf.ConfigBase = parse->config.base;
275 link->conf.Present = parse->config.rmask[0];
276
277 /* redefine hardware record according to the VERSION1 string */
278 tuple.DesiredTuple = CISTPL_VERS_1;
279 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
280 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
281 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse));
282 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
283 snd_printdd("VX-pocket is detected\n");
284 } else {
285 snd_printdd("VX-pocket 440 is detected\n");
286 /* overwrite the hardware information */
287 chip->hw = &vxp440_hw;
288 chip->type = vxp440_hw.type;
289 strcpy(chip->card->driver, vxp440_hw.name);
290 }
291
292 /* Configure card */
293 link->state |= DEV_CONFIG;
294
295 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io));
296 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
297 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
298
299 chip->dev = &handle_to_dev(link->handle);
300
301 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
302 goto failed;
303
304 link->dev = &vxp->node;
305 link->state &= ~DEV_CONFIG_PENDING;
306 kfree(parse);
307 return;
308
309cs_failed:
310 cs_error(link->handle, last_fn, last_ret);
311failed:
312 pcmcia_release_configuration(link->handle);
313 pcmcia_release_io(link->handle, &link->io);
314 pcmcia_release_irq(link->handle, &link->irq);
315 link->state &= ~DEV_CONFIG;
316 kfree(parse);
317}
318
319
320/*
321 * event callback
322 */
323static int vxpocket_event(event_t event, int priority, event_callback_args_t *args)
324{
325 dev_link_t *link = args->client_data;
326 vx_core_t *chip = link->priv;
327
328 switch (event) {
329 case CS_EVENT_CARD_REMOVAL:
330 snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
331 link->state &= ~DEV_PRESENT;
332 if (link->state & DEV_CONFIG)
333 chip->chip_status |= VX_STAT_IS_STALE;
334 break;
335 case CS_EVENT_CARD_INSERTION:
336 snd_printdd(KERN_DEBUG "CARD_INSERTION..\n");
337 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
338 vxpocket_config(link);
339 break;
340#ifdef CONFIG_PM
341 case CS_EVENT_PM_SUSPEND:
342 snd_printdd(KERN_DEBUG "SUSPEND\n");
343 link->state |= DEV_SUSPEND;
344 if (chip && chip->card->pm_suspend) {
345 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
346 chip->card->pm_suspend(chip->card, PMSG_SUSPEND);
347 }
348 /* Fall through... */
349 case CS_EVENT_RESET_PHYSICAL:
350 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
351 if (link->state & DEV_CONFIG)
352 pcmcia_release_configuration(link->handle);
353 break;
354 case CS_EVENT_PM_RESUME:
355 snd_printdd(KERN_DEBUG "RESUME\n");
356 link->state &= ~DEV_SUSPEND;
357 /* Fall through... */
358 case CS_EVENT_CARD_RESET:
359 snd_printdd(KERN_DEBUG "CARD_RESET\n");
360 if (DEV_OK(link)) {
361 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
362 snd_printdd(KERN_DEBUG "requestconfig...\n");
363 pcmcia_request_configuration(link->handle, &link->conf);
364 if (chip && chip->card->pm_resume) {
365 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
366 chip->card->pm_resume(chip->card);
367 }
368 }
369 snd_printdd(KERN_DEBUG "resume done!\n");
370 break;
371#endif
372 }
373 return 0;
374}
109 375
110 /* h/w config */
111 .hardware = &vxp_hw,
112 .ops = &snd_vxpocket_ops,
113};
114 376
115/* 377/*
116 */ 378 */
117static dev_link_t *vxp_attach(void) 379static dev_link_t *vxp_attach(void)
118{ 380{
119 return snd_vxpocket_attach(&hw_entry); 381 snd_card_t *card;
382 struct snd_vxpocket *vxp;
383 int i;
384
385 /* find an empty slot from the card list */
386 for (i = 0; i < SNDRV_CARDS; i++) {
387 if (! card_alloc & (1 << i))
388 break;
389 }
390 if (i >= SNDRV_CARDS) {
391 snd_printk(KERN_ERR "vxpocket: too many cards found\n");
392 return NULL;
393 }
394 if (! enable[i])
395 return NULL; /* disabled explicitly */
396
397 /* ok, create a card instance */
398 card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
399 if (card == NULL) {
400 snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
401 return NULL;
402 }
403
404 vxp = snd_vxpocket_new(card, ibl[i]);
405 if (! vxp) {
406 snd_card_free(card);
407 return NULL;
408 }
409
410 vxp->index = index[i];
411 card_alloc |= 1 << i;
412
413 /* Chain drivers */
414 vxp->link.next = dev_list;
415 dev_list = &vxp->link;
416
417 return &vxp->link;
120} 418}
121 419
122static void vxp_detach(dev_link_t *link) 420static void vxp_detach(dev_link_t *link)
123{ 421{
124 snd_vxpocket_detach(&hw_entry, link); 422 struct snd_vxpocket *vxp;
423 vx_core_t *chip;
424 dev_link_t **linkp;
425
426 if (! link)
427 return;
428
429 vxp = link->priv;
430 chip = (vx_core_t *)vxp;
431 card_alloc &= ~(1 << vxp->index);
432
433 /* Remove the interface data from the linked list */
434 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
435 if (*linkp == link) {
436 *linkp = link->next;
437 break;
438 }
439
440 chip->chip_status |= VX_STAT_IS_STALE; /* to be sure */
441 snd_card_disconnect(chip->card);
442 vxpocket_release(link);
443 snd_card_free_in_thread(chip->card);
125} 444}
126 445
127/* 446/*
@@ -137,7 +456,7 @@ MODULE_DEVICE_TABLE(pcmcia, vxp_ids);
137static struct pcmcia_driver vxp_cs_driver = { 456static struct pcmcia_driver vxp_cs_driver = {
138 .owner = THIS_MODULE, 457 .owner = THIS_MODULE,
139 .drv = { 458 .drv = {
140 .name = DEV_INFO, 459 .name = "snd-vxpocket",
141 }, 460 },
142 .attach = vxp_attach, 461 .attach = vxp_attach,
143 .detach = vxp_detach, 462 .detach = vxp_detach,
@@ -152,7 +471,7 @@ static int __init init_vxpocket(void)
152static void __exit exit_vxpocket(void) 471static void __exit exit_vxpocket(void)
153{ 472{
154 pcmcia_unregister_driver(&vxp_cs_driver); 473 pcmcia_unregister_driver(&vxp_cs_driver);
155 BUG_ON(hw_entry.dev_list != NULL); 474 BUG_ON(dev_list != NULL);
156} 475}
157 476
158module_init(init_vxpocket); 477module_init(init_vxpocket);
diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h
index 4462c04a4e8f..70754aa3dd11 100644
--- a/sound/pcmcia/vx/vxpocket.h
+++ b/sound/pcmcia/vx/vxpocket.h
@@ -28,24 +28,6 @@
28#include <pcmcia/cistpl.h> 28#include <pcmcia/cistpl.h>
29#include <pcmcia/ds.h> 29#include <pcmcia/ds.h>
30 30
31struct snd_vxp_entry {
32 dev_info_t *dev_info;
33
34 /* module parameters */
35 int *index_table;
36 char **id_table;
37 int *enable_table;
38 int *ibl;
39
40 /* h/w config */
41 struct snd_vx_hardware *hardware;
42 struct snd_vx_ops *ops;
43
44 /* slots */
45 vx_core_t *card_list[SNDRV_CARDS];
46 dev_link_t *dev_list; /* Linked list of devices */
47};
48
49struct snd_vxpocket { 31struct snd_vxpocket {
50 32
51 vx_core_t core; 33 vx_core_t core;
@@ -57,8 +39,7 @@ struct snd_vxpocket {
57 unsigned int regCDSP; /* current CDSP register */ 39 unsigned int regCDSP; /* current CDSP register */
58 unsigned int regDIALOG; /* current DIALOG register */ 40 unsigned int regDIALOG; /* current DIALOG register */
59 41
60 int index; 42 int index; /* card index */
61 struct snd_vxp_entry *hw_entry;
62 43
63 /* pcmcia stuff */ 44 /* pcmcia stuff */
64 dev_link_t link; 45 dev_link_t link;
@@ -70,12 +51,6 @@ extern struct snd_vx_ops snd_vxpocket_ops;
70void vx_set_mic_boost(vx_core_t *chip, int boost); 51void vx_set_mic_boost(vx_core_t *chip, int boost);
71void vx_set_mic_level(vx_core_t *chip, int level); 52void vx_set_mic_level(vx_core_t *chip, int level);
72 53
73/*
74 * pcmcia stuff
75 */
76dev_link_t *snd_vxpocket_attach(struct snd_vxp_entry *hw);
77void snd_vxpocket_detach(struct snd_vxp_entry *hw, dev_link_t *link);
78
79int vxp_add_mic_controls(vx_core_t *chip); 54int vxp_add_mic_controls(vx_core_t *chip);
80 55
81/* Constants used to access the CDSP register (0x08). */ 56/* Constants used to access the CDSP register (0x08). */
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 061e52d3d771..758ca1bcbcf2 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -103,7 +103,7 @@ static void screamer_recalibrate(pmac_t *chip)
103 snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); 103 snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]);
104 if (chip->manufacturer == 0x1) 104 if (chip->manufacturer == 0x1)
105 /* delay for broken crystal part */ 105 /* delay for broken crystal part */
106 big_mdelay(750); 106 msleep(750);
107 snd_pmac_awacs_write_noreg(chip, 1, 107 snd_pmac_awacs_write_noreg(chip, 1,
108 chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE); 108 chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE);
109 snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); 109 snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]);
@@ -653,10 +653,10 @@ static void snd_pmac_awacs_resume(pmac_t *chip)
653{ 653{
654 if (machine_is_compatible("PowerBook3,1") 654 if (machine_is_compatible("PowerBook3,1")
655 || machine_is_compatible("PowerBook3,2")) { 655 || machine_is_compatible("PowerBook3,2")) {
656 big_mdelay(100); 656 msleep(100);
657 snd_pmac_awacs_write_reg(chip, 1, 657 snd_pmac_awacs_write_reg(chip, 1,
658 chip->awacs_reg[1] & ~MASK_PAROUT); 658 chip->awacs_reg[1] & ~MASK_PAROUT);
659 big_mdelay(300); 659 msleep(300);
660 } 660 }
661 661
662 awacs_restore_all_regs(chip); 662 awacs_restore_all_regs(chip);
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c
index 3f837d9f3eb1..edbc0484e22a 100644
--- a/sound/ppc/burgundy.c
+++ b/sound/ppc/burgundy.c
@@ -30,7 +30,7 @@
30 30
31 31
32/* Waits for busy flag to clear */ 32/* Waits for busy flag to clear */
33inline static void 33static inline void
34snd_pmac_burgundy_busy_wait(pmac_t *chip) 34snd_pmac_burgundy_busy_wait(pmac_t *chip)
35{ 35{
36 int timeout = 50; 36 int timeout = 50;
@@ -40,7 +40,7 @@ snd_pmac_burgundy_busy_wait(pmac_t *chip)
40 printk(KERN_DEBUG "burgundy_busy_wait: timeout\n"); 40 printk(KERN_DEBUG "burgundy_busy_wait: timeout\n");
41} 41}
42 42
43inline static void 43static inline void
44snd_pmac_burgundy_extend_wait(pmac_t *chip) 44snd_pmac_burgundy_extend_wait(pmac_t *chip)
45{ 45{
46 int timeout; 46 int timeout;
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 75b8b7423036..844d76152ea2 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -153,7 +153,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream)
153/* 153/*
154 * wait while run status is on 154 * wait while run status is on
155 */ 155 */
156inline static void 156static inline void
157snd_pmac_wait_ack(pmac_stream_t *rec) 157snd_pmac_wait_ack(pmac_stream_t *rec)
158{ 158{
159 int timeout = 50000; 159 int timeout = 50000;
@@ -177,7 +177,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip)
177/* 177/*
178 * stop the DMA transfer 178 * stop the DMA transfer
179 */ 179 */
180inline static void snd_pmac_dma_stop(pmac_stream_t *rec) 180static inline void snd_pmac_dma_stop(pmac_stream_t *rec)
181{ 181{
182 out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16); 182 out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
183 snd_pmac_wait_ack(rec); 183 snd_pmac_wait_ack(rec);
@@ -186,7 +186,7 @@ inline static void snd_pmac_dma_stop(pmac_stream_t *rec)
186/* 186/*
187 * set the command pointer address 187 * set the command pointer address
188 */ 188 */
189inline static void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cmd) 189static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cmd)
190{ 190{
191 out_le32(&rec->dma->cmdptr, cmd->addr); 191 out_le32(&rec->dma->cmdptr, cmd->addr);
192} 192}
@@ -194,7 +194,7 @@ inline static void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm
194/* 194/*
195 * start the DMA 195 * start the DMA
196 */ 196 */
197inline static void snd_pmac_dma_run(pmac_stream_t *rec, int status) 197static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status)
198{ 198{
199 out_le32(&rec->dma->control, status | (status << 16)); 199 out_le32(&rec->dma->control, status | (status << 16));
200} 200}
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h
index 582db5220119..ae3bb6c6edff 100644
--- a/sound/ppc/pmac.h
+++ b/sound/ppc/pmac.h
@@ -212,9 +212,4 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui
212 212
213int snd_pmac_add_automute(pmac_t *chip); 213int snd_pmac_add_automute(pmac_t *chip);
214 214
215#define big_mdelay(msec) do {\
216 set_current_state(TASK_UNINTERRUPTIBLE);\
217 schedule_timeout(((msec) * HZ + 999) / 1000);\
218} while (0)
219
220#endif /* __PMAC_H */ 215#endif /* __PMAC_H */
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 36c5d5d45bb1..b94437c024b1 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -945,7 +945,7 @@ static void device_change_handler(void *self)
945 check_mute(chip, &mix->line_mute, 0, mix->auto_mute_notify, 945 check_mute(chip, &mix->line_mute, 0, mix->auto_mute_notify,
946 chip->lineout_sw_ctl); 946 chip->lineout_sw_ctl);
947 if (mix->anded_reset) 947 if (mix->anded_reset)
948 big_mdelay(10); 948 msleep(10);
949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, 949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify,
950 chip->speaker_sw_ctl); 950 chip->speaker_sw_ctl);
951 mix->drc_enable = 0; 951 mix->drc_enable = 0;
@@ -954,7 +954,7 @@ static void device_change_handler(void *self)
954 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, 954 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify,
955 chip->speaker_sw_ctl); 955 chip->speaker_sw_ctl);
956 if (mix->anded_reset) 956 if (mix->anded_reset)
957 big_mdelay(10); 957 msleep(10);
958 check_mute(chip, &mix->hp_mute, 1, mix->auto_mute_notify, 958 check_mute(chip, &mix->hp_mute, 1, mix->auto_mute_notify,
959 chip->master_sw_ctl); 959 chip->master_sw_ctl);
960 if (mix->line_mute.addr != 0) 960 if (mix->line_mute.addr != 0)
@@ -1109,22 +1109,22 @@ static void tumbler_reset_audio(pmac_t *chip)
1109 DBG("(I) codec anded reset !\n"); 1109 DBG("(I) codec anded reset !\n");
1110 write_audio_gpio(&mix->hp_mute, 0); 1110 write_audio_gpio(&mix->hp_mute, 0);
1111 write_audio_gpio(&mix->amp_mute, 0); 1111 write_audio_gpio(&mix->amp_mute, 0);
1112 big_mdelay(200); 1112 msleep(200);
1113 write_audio_gpio(&mix->hp_mute, 1); 1113 write_audio_gpio(&mix->hp_mute, 1);
1114 write_audio_gpio(&mix->amp_mute, 1); 1114 write_audio_gpio(&mix->amp_mute, 1);
1115 big_mdelay(100); 1115 msleep(100);
1116 write_audio_gpio(&mix->hp_mute, 0); 1116 write_audio_gpio(&mix->hp_mute, 0);
1117 write_audio_gpio(&mix->amp_mute, 0); 1117 write_audio_gpio(&mix->amp_mute, 0);
1118 big_mdelay(100); 1118 msleep(100);
1119 } else { 1119 } else {
1120 DBG("(I) codec normal reset !\n"); 1120 DBG("(I) codec normal reset !\n");
1121 1121
1122 write_audio_gpio(&mix->audio_reset, 0); 1122 write_audio_gpio(&mix->audio_reset, 0);
1123 big_mdelay(200); 1123 msleep(200);
1124 write_audio_gpio(&mix->audio_reset, 1); 1124 write_audio_gpio(&mix->audio_reset, 1);
1125 big_mdelay(100); 1125 msleep(100);
1126 write_audio_gpio(&mix->audio_reset, 0); 1126 write_audio_gpio(&mix->audio_reset, 0);
1127 big_mdelay(100); 1127 msleep(100);
1128 } 1128 }
1129} 1129}
1130 1130
diff --git a/sound/sparc/Kconfig b/sound/sparc/Kconfig
index 2358df1c45a9..25a8a558ef92 100644
--- a/sound/sparc/Kconfig
+++ b/sound/sparc/Kconfig
@@ -7,12 +7,30 @@ config SND_SUN_AMD7930
7 tristate "Sun AMD7930" 7 tristate "Sun AMD7930"
8 depends on SBUS && SND 8 depends on SBUS && SND
9 select SND_PCM 9 select SND_PCM
10 help
11 Say Y here to include support for AMD7930 sound device on Sun.
12
13 To compile this driver as a module, choose M here: the module
14 will be called snd-sun-amd7930.
10 15
11# dep_tristate 'Sun DBRI' CONFIG_SND_SUN_DBRI $CONFIG_SND
12config SND_SUN_CS4231 16config SND_SUN_CS4231
13 tristate "Sun CS4231" 17 tristate "Sun CS4231"
14 depends on SND 18 depends on SND
15 select SND_PCM 19 select SND_PCM
20 help
21 Say Y here to include support for CS4231 sound device on Sun.
16 22
17endmenu 23 To compile this driver as a module, choose M here: the module
24 will be called snd-sun-cs4231.
25
26config SND_SUN_DBRI
27 tristate "Sun DBRI"
28 depends on SND && SBUS
29 select SND_PCM
30 help
31 Say Y here to include support for DBRI sound device on Sun.
32
33 To compile this driver as a module, choose M here: the module
34 will be called snd-sun-dbri.
18 35
36endmenu
diff --git a/sound/sparc/Makefile b/sound/sparc/Makefile
index 6809cc92d276..3cd89c67c2f2 100644
--- a/sound/sparc/Makefile
+++ b/sound/sparc/Makefile
@@ -4,9 +4,9 @@
4# 4#
5 5
6snd-sun-amd7930-objs := amd7930.o 6snd-sun-amd7930-objs := amd7930.o
7#snd-sun-dbri-objs := dbri.o
8snd-sun-cs4231-objs := cs4231.o 7snd-sun-cs4231-objs := cs4231.o
8snd-sun-dbri-objs := dbri.o
9 9
10obj-$(CONFIG_SND_SUN_AMD7930) += snd-sun-amd7930.o 10obj-$(CONFIG_SND_SUN_AMD7930) += snd-sun-amd7930.o
11#obj-$(CONFIG_SND_SUN_DBRI) += snd-sun-dbri.o
12obj-$(CONFIG_SND_SUN_CS4231) += snd-sun-cs4231.o 11obj-$(CONFIG_SND_SUN_CS4231) += snd-sun-cs4231.o
12obj-$(CONFIG_SND_SUN_DBRI) += snd-sun-dbri.o
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
new file mode 100644
index 000000000000..941c7b1e7ebb
--- /dev/null
+++ b/sound/sparc/dbri.c
@@ -0,0 +1,2729 @@
1/*
2 * Driver for DBRI sound chip found on Sparcs.
3 * Copyright (C) 2004 Martin Habets (mhabets@users.sourceforge.net)
4 *
5 * Based entirely upon drivers/sbus/audio/dbri.c which is:
6 * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
7 * Copyright (C) 1998, 1999 Brent Baccala (baccala@freesoft.org)
8 *
9 * This is the lowlevel driver for the DBRI & MMCODEC duo used for ISDN & AUDIO
10 * on Sun SPARCstation 10, 20, LX and Voyager models.
11 *
12 * - DBRI: AT&T T5900FX Dual Basic Rates ISDN Interface. It is a 32 channel
13 * data time multiplexer with ISDN support (aka T7259)
14 * Interfaces: SBus,ISDN NT & TE, CHI, 4 bits parallel.
15 * CHI: (spelled ki) Concentration Highway Interface (AT&T or Intel bus ?).
16 * Documentation:
17 * - "STP 4000SBus Dual Basic Rate ISDN (DBRI) Tranceiver" from
18 * Sparc Technology Business (courtesy of Sun Support)
19 * - Data sheet of the T7903, a newer but very similar ISA bus equivalent
20 * available from the Lucent (formarly AT&T microelectronics) home
21 * page.
22 * - http://www.freesoft.org/Linux/DBRI/
23 * - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec
24 * Interfaces: CHI, Audio In & Out, 2 bits parallel
25 * Documentation: from the Crystal Semiconductor home page.
26 *
27 * The DBRI is a 32 pipe machine, each pipe can transfer some bits between
28 * memory and a serial device (long pipes, nr 0-15) or between two serial
29 * devices (short pipes, nr 16-31), or simply send a fixed data to a serial
30 * device (short pipes).
31 * A timeslot defines the bit-offset and nr of bits read from a serial device.
32 * The timeslots are linked to 6 circular lists, one for each direction for
33 * each serial device (NT,TE,CHI). A timeslot is associated to 1 or 2 pipes
34 * (the second one is a monitor/tee pipe, valid only for serial input).
35 *
36 * The mmcodec is connected via the CHI bus and needs the data & some
37 * parameters (volume, balance, output selection) timemultiplexed in 8 byte
38 * chunks. It also has a control mode, which serves for audio format setting.
39 *
40 * Looking at the CS4215 data sheet it is easy to set up 2 or 4 codecs on
41 * the same CHI bus, so I thought perhaps it is possible to use the onboard
42 * & the speakerbox codec simultanously, giving 2 (not very independent :-)
43 * audio devices. But the SUN HW group decided against it, at least on my
44 * LX the speakerbox connector has at least 1 pin missing and 1 wrongly
45 * connected.
46 */
47
48#include <sound/driver.h>
49#include <linux/interrupt.h>
50#include <linux/delay.h>
51
52#include <sound/core.h>
53#include <sound/pcm.h>
54#include <sound/pcm_params.h>
55#include <sound/info.h>
56#include <sound/control.h>
57#include <sound/initval.h>
58
59#include <asm/irq.h>
60#include <asm/io.h>
61#include <asm/sbus.h>
62#include <asm/atomic.h>
63
64MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets");
65MODULE_DESCRIPTION("Sun DBRI");
66MODULE_LICENSE("GPL");
67MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}");
68
69static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
70static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
71static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
72
73module_param_array(index, int, NULL, 0444);
74MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard.");
75module_param_array(id, charp, NULL, 0444);
76MODULE_PARM_DESC(id, "ID string for Sun DBRI soundcard.");
77module_param_array(enable, bool, NULL, 0444);
78MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
79
80#define DBRI_DEBUG
81
82#define D_INT (1<<0)
83#define D_GEN (1<<1)
84#define D_CMD (1<<2)
85#define D_MM (1<<3)
86#define D_USR (1<<4)
87#define D_DESC (1<<5)
88
89static int dbri_debug = 0;
90module_param(dbri_debug, int, 0444);
91MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
92
93#ifdef DBRI_DEBUG
94static char *cmds[] = {
95 "WAIT", "PAUSE", "JUMP", "IIQ", "REX", "SDP", "CDP", "DTS",
96 "SSP", "CHI", "NT", "TE", "CDEC", "TEST", "CDM", "RESRV"
97};
98
99#define dprintk(a, x...) if(dbri_debug & a) printk(KERN_DEBUG x)
100
101#define DBRI_CMD(cmd, intr, value) ((cmd << 28) | \
102 (1 << 27) | \
103 value)
104#else
105#define dprintk(a, x...)
106
107#define DBRI_CMD(cmd, intr, value) ((cmd << 28) | \
108 (intr << 27) | \
109 value)
110#endif /* DBRI_DEBUG */
111
112/***************************************************************************
113 CS4215 specific definitions and structures
114****************************************************************************/
115
116struct cs4215 {
117 __u8 data[4]; /* Data mode: Time slots 5-8 */
118 __u8 ctrl[4]; /* Ctrl mode: Time slots 1-4 */
119 __u8 onboard;
120 __u8 offset; /* Bit offset from frame sync to time slot 1 */
121 volatile __u32 status;
122 volatile __u32 version;
123 __u8 precision; /* In bits, either 8 or 16 */
124 __u8 channels; /* 1 or 2 */
125};
126
127/*
128 * Control mode first
129 */
130
131/* Time Slot 1, Status register */
132#define CS4215_CLB (1<<2) /* Control Latch Bit */
133#define CS4215_OLB (1<<3) /* 1: line: 2.0V, speaker 4V */
134 /* 0: line: 2.8V, speaker 8V */
135#define CS4215_MLB (1<<4) /* 1: Microphone: 20dB gain disabled */
136#define CS4215_RSRVD_1 (1<<5)
137
138/* Time Slot 2, Data Format Register */
139#define CS4215_DFR_LINEAR16 0
140#define CS4215_DFR_ULAW 1
141#define CS4215_DFR_ALAW 2
142#define CS4215_DFR_LINEAR8 3
143#define CS4215_DFR_STEREO (1<<2)
144static struct {
145 unsigned short freq;
146 unsigned char xtal;
147 unsigned char csval;
148} CS4215_FREQ[] = {
149 { 8000, (1 << 4), (0 << 3) },
150 { 16000, (1 << 4), (1 << 3) },
151 { 27429, (1 << 4), (2 << 3) }, /* Actually 24428.57 */
152 { 32000, (1 << 4), (3 << 3) },
153 /* { NA, (1 << 4), (4 << 3) }, */
154 /* { NA, (1 << 4), (5 << 3) }, */
155 { 48000, (1 << 4), (6 << 3) },
156 { 9600, (1 << 4), (7 << 3) },
157 { 5513, (2 << 4), (0 << 3) }, /* Actually 5512.5 */
158 { 11025, (2 << 4), (1 << 3) },
159 { 18900, (2 << 4), (2 << 3) },
160 { 22050, (2 << 4), (3 << 3) },
161 { 37800, (2 << 4), (4 << 3) },
162 { 44100, (2 << 4), (5 << 3) },
163 { 33075, (2 << 4), (6 << 3) },
164 { 6615, (2 << 4), (7 << 3) },
165 { 0, 0, 0}
166};
167
168#define CS4215_HPF (1<<7) /* High Pass Filter, 1: Enabled */
169
170#define CS4215_12_MASK 0xfcbf /* Mask off reserved bits in slot 1 & 2 */
171
172/* Time Slot 3, Serial Port Control register */
173#define CS4215_XEN (1<<0) /* 0: Enable serial output */
174#define CS4215_XCLK (1<<1) /* 1: Master mode: Generate SCLK */
175#define CS4215_BSEL_64 (0<<2) /* Bitrate: 64 bits per frame */
176#define CS4215_BSEL_128 (1<<2)
177#define CS4215_BSEL_256 (2<<2)
178#define CS4215_MCK_MAST (0<<4) /* Master clock */
179#define CS4215_MCK_XTL1 (1<<4) /* 24.576 MHz clock source */
180#define CS4215_MCK_XTL2 (2<<4) /* 16.9344 MHz clock source */
181#define CS4215_MCK_CLK1 (3<<4) /* Clockin, 256 x Fs */
182#define CS4215_MCK_CLK2 (4<<4) /* Clockin, see DFR */
183
184/* Time Slot 4, Test Register */
185#define CS4215_DAD (1<<0) /* 0:Digital-Dig loop, 1:Dig-Analog-Dig loop */
186#define CS4215_ENL (1<<1) /* Enable Loopback Testing */
187
188/* Time Slot 5, Parallel Port Register */
189/* Read only here and the same as the in data mode */
190
191/* Time Slot 6, Reserved */
192
193/* Time Slot 7, Version Register */
194#define CS4215_VERSION_MASK 0xf /* Known versions 0/C, 1/D, 2/E */
195
196/* Time Slot 8, Reserved */
197
198/*
199 * Data mode
200 */
201/* Time Slot 1-2: Left Channel Data, 2-3: Right Channel Data */
202
203/* Time Slot 5, Output Setting */
204#define CS4215_LO(v) v /* Left Output Attenuation 0x3f: -94.5 dB */
205#define CS4215_LE (1<<6) /* Line Out Enable */
206#define CS4215_HE (1<<7) /* Headphone Enable */
207
208/* Time Slot 6, Output Setting */
209#define CS4215_RO(v) v /* Right Output Attenuation 0x3f: -94.5 dB */
210#define CS4215_SE (1<<6) /* Speaker Enable */
211#define CS4215_ADI (1<<7) /* A/D Data Invalid: Busy in calibration */
212
213/* Time Slot 7, Input Setting */
214#define CS4215_LG(v) v /* Left Gain Setting 0xf: 22.5 dB */
215#define CS4215_IS (1<<4) /* Input Select: 1=Microphone, 0=Line */
216#define CS4215_OVR (1<<5) /* 1: Overrange condition occurred */
217#define CS4215_PIO0 (1<<6) /* Parallel I/O 0 */
218#define CS4215_PIO1 (1<<7)
219
220/* Time Slot 8, Input Setting */
221#define CS4215_RG(v) v /* Right Gain Setting 0xf: 22.5 dB */
222#define CS4215_MA(v) (v<<4) /* Monitor Path Attenuation 0xf: mute */
223
224/***************************************************************************
225 DBRI specific definitions and structures
226****************************************************************************/
227
228/* DBRI main registers */
229#define REG0 0x00UL /* Status and Control */
230#define REG1 0x04UL /* Mode and Interrupt */
231#define REG2 0x08UL /* Parallel IO */
232#define REG3 0x0cUL /* Test */
233#define REG8 0x20UL /* Command Queue Pointer */
234#define REG9 0x24UL /* Interrupt Queue Pointer */
235
236#define DBRI_NO_CMDS 64
237#define DBRI_NO_INTS 1 /* Note: the value of this define was
238 * originally 2. The ringbuffer to store
239 * interrupts in dma is currently broken.
240 * This is a temporary fix until the ringbuffer
241 * is fixed.
242 */
243#define DBRI_INT_BLK 64
244#define DBRI_NO_DESCS 64
245#define DBRI_NO_PIPES 32
246
247#define DBRI_MM_ONB 1
248#define DBRI_MM_SB 2
249
250#define DBRI_REC 0
251#define DBRI_PLAY 1
252#define DBRI_NO_STREAMS 2
253
254/* One transmit/receive descriptor */
255struct dbri_mem {
256 volatile __u32 word1;
257 volatile __u32 ba; /* Transmit/Receive Buffer Address */
258 volatile __u32 nda; /* Next Descriptor Address */
259 volatile __u32 word4;
260};
261
262/* This structure is in a DMA region where it can accessed by both
263 * the CPU and the DBRI
264 */
265struct dbri_dma {
266 volatile s32 cmd[DBRI_NO_CMDS]; /* Place for commands */
267 volatile s32 intr[DBRI_NO_INTS * DBRI_INT_BLK]; /* Interrupt field */
268 struct dbri_mem desc[DBRI_NO_DESCS]; /* Xmit/receive descriptors */
269};
270
271#define dbri_dma_off(member, elem) \
272 ((u32)(unsigned long) \
273 (&(((struct dbri_dma *)0)->member[elem])))
274
275enum in_or_out { PIPEinput, PIPEoutput };
276
277struct dbri_pipe {
278 u32 sdp; /* SDP command word */
279 enum in_or_out direction;
280 int nextpipe; /* Next pipe in linked list */
281 int prevpipe;
282 int cycle; /* Offset of timeslot (bits) */
283 int length; /* Length of timeslot (bits) */
284 int first_desc; /* Index of first descriptor */
285 int desc; /* Index of active descriptor */
286 volatile __u32 *recv_fixed_ptr; /* Ptr to receive fixed data */
287};
288
289struct dbri_desc {
290 int inuse; /* Boolean flag */
291 int next; /* Index of next desc, or -1 */
292 unsigned int len;
293};
294
295/* Per stream (playback or record) information */
296typedef struct dbri_streaminfo {
297 snd_pcm_substream_t *substream;
298 u32 dvma_buffer; /* Device view of Alsa DMA buffer */
299 int left; /* # of bytes left in DMA buffer */
300 int size; /* Size of DMA buffer */
301 size_t offset; /* offset in user buffer */
302 int pipe; /* Data pipe used */
303 int left_gain; /* mixer elements */
304 int right_gain;
305 int balance;
306} dbri_streaminfo_t;
307
308/* This structure holds the information for both chips (DBRI & CS4215) */
309typedef struct snd_dbri {
310 snd_card_t *card; /* ALSA card */
311 snd_pcm_t *pcm;
312
313 int regs_size, irq; /* Needed for unload */
314 struct sbus_dev *sdev; /* SBUS device info */
315 spinlock_t lock;
316
317 volatile struct dbri_dma *dma; /* Pointer to our DMA block */
318 u32 dma_dvma; /* DBRI visible DMA address */
319
320 void __iomem *regs; /* dbri HW regs */
321 int dbri_version; /* 'e' and up is OK */
322 int dbri_irqp; /* intr queue pointer */
323 int wait_seen;
324
325 struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */
326 struct dbri_desc descs[DBRI_NO_DESCS];
327
328 int chi_in_pipe;
329 int chi_out_pipe;
330 int chi_bpf;
331
332 struct cs4215 mm; /* mmcodec special info */
333 /* per stream (playback/record) info */
334 struct dbri_streaminfo stream_info[DBRI_NO_STREAMS];
335
336 struct snd_dbri *next;
337} snd_dbri_t;
338
339/* Needed for the ALSA macros to work */
340#define chip_t snd_dbri_t
341
342#define DBRI_MAX_VOLUME 63 /* Output volume */
343#define DBRI_MAX_GAIN 15 /* Input gain */
344#define DBRI_RIGHT_BALANCE 255
345#define DBRI_MID_BALANCE (DBRI_RIGHT_BALANCE >> 1)
346
347/* DBRI Reg0 - Status Control Register - defines. (Page 17) */
348#define D_P (1<<15) /* Program command & queue pointer valid */
349#define D_G (1<<14) /* Allow 4-Word SBus Burst */
350#define D_S (1<<13) /* Allow 16-Word SBus Burst */
351#define D_E (1<<12) /* Allow 8-Word SBus Burst */
352#define D_X (1<<7) /* Sanity Timer Disable */
353#define D_T (1<<6) /* Permit activation of the TE interface */
354#define D_N (1<<5) /* Permit activation of the NT interface */
355#define D_C (1<<4) /* Permit activation of the CHI interface */
356#define D_F (1<<3) /* Force Sanity Timer Time-Out */
357#define D_D (1<<2) /* Disable Master Mode */
358#define D_H (1<<1) /* Halt for Analysis */
359#define D_R (1<<0) /* Soft Reset */
360
361/* DBRI Reg1 - Mode and Interrupt Register - defines. (Page 18) */
362#define D_LITTLE_END (1<<8) /* Byte Order */
363#define D_BIG_END (0<<8) /* Byte Order */
364#define D_MRR (1<<4) /* Multiple Error Ack on SBus (readonly) */
365#define D_MLE (1<<3) /* Multiple Late Error on SBus (readonly) */
366#define D_LBG (1<<2) /* Lost Bus Grant on SBus (readonly) */
367#define D_MBE (1<<1) /* Burst Error on SBus (readonly) */
368#define D_IR (1<<0) /* Interrupt Indicator (readonly) */
369
370/* DBRI Reg2 - Parallel IO Register - defines. (Page 18) */
371#define D_ENPIO3 (1<<7) /* Enable Pin 3 */
372#define D_ENPIO2 (1<<6) /* Enable Pin 2 */
373#define D_ENPIO1 (1<<5) /* Enable Pin 1 */
374#define D_ENPIO0 (1<<4) /* Enable Pin 0 */
375#define D_ENPIO (0xf0) /* Enable all the pins */
376#define D_PIO3 (1<<3) /* Pin 3: 1: Data mode, 0: Ctrl mode */
377#define D_PIO2 (1<<2) /* Pin 2: 1: Onboard PDN */
378#define D_PIO1 (1<<1) /* Pin 1: 0: Reset */
379#define D_PIO0 (1<<0) /* Pin 0: 1: Speakerbox PDN */
380
381/* DBRI Commands (Page 20) */
382#define D_WAIT 0x0 /* Stop execution */
383#define D_PAUSE 0x1 /* Flush long pipes */
384#define D_JUMP 0x2 /* New command queue */
385#define D_IIQ 0x3 /* Initialize Interrupt Queue */
386#define D_REX 0x4 /* Report command execution via interrupt */
387#define D_SDP 0x5 /* Setup Data Pipe */
388#define D_CDP 0x6 /* Continue Data Pipe (reread NULL Pointer) */
389#define D_DTS 0x7 /* Define Time Slot */
390#define D_SSP 0x8 /* Set short Data Pipe */
391#define D_CHI 0x9 /* Set CHI Global Mode */
392#define D_NT 0xa /* NT Command */
393#define D_TE 0xb /* TE Command */
394#define D_CDEC 0xc /* Codec setup */
395#define D_TEST 0xd /* No comment */
396#define D_CDM 0xe /* CHI Data mode command */
397
398/* Special bits for some commands */
399#define D_PIPE(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */
400
401/* Setup Data Pipe */
402/* IRM */
403#define D_SDP_2SAME (1<<18) /* Report 2nd time in a row value rcvd */
404#define D_SDP_CHANGE (2<<18) /* Report any changes */
405#define D_SDP_EVERY (3<<18) /* Report any changes */
406#define D_SDP_EOL (1<<17) /* EOL interrupt enable */
407#define D_SDP_IDLE (1<<16) /* HDLC idle interrupt enable */
408
409/* Pipe data MODE */
410#define D_SDP_MEM (0<<13) /* To/from memory */
411#define D_SDP_HDLC (2<<13)
412#define D_SDP_HDLC_D (3<<13) /* D Channel (prio control) */
413#define D_SDP_SER (4<<13) /* Serial to serial */
414#define D_SDP_FIXED (6<<13) /* Short only */
415#define D_SDP_MODE(v) ((v)&(7<<13))
416
417#define D_SDP_TO_SER (1<<12) /* Direction */
418#define D_SDP_FROM_SER (0<<12) /* Direction */
419#define D_SDP_MSB (1<<11) /* Bit order within Byte */
420#define D_SDP_LSB (0<<11) /* Bit order within Byte */
421#define D_SDP_P (1<<10) /* Pointer Valid */
422#define D_SDP_A (1<<8) /* Abort */
423#define D_SDP_C (1<<7) /* Clear */
424
425/* Define Time Slot */
426#define D_DTS_VI (1<<17) /* Valid Input Time-Slot Descriptor */
427#define D_DTS_VO (1<<16) /* Valid Output Time-Slot Descriptor */
428#define D_DTS_INS (1<<15) /* Insert Time Slot */
429#define D_DTS_DEL (0<<15) /* Delete Time Slot */
430#define D_DTS_PRVIN(v) ((v)<<10) /* Previous In Pipe */
431#define D_DTS_PRVOUT(v) ((v)<<5) /* Previous Out Pipe */
432
433/* Time Slot defines */
434#define D_TS_LEN(v) ((v)<<24) /* Number of bits in this time slot */
435#define D_TS_CYCLE(v) ((v)<<14) /* Bit Count at start of TS */
436#define D_TS_DI (1<<13) /* Data Invert */
437#define D_TS_1CHANNEL (0<<10) /* Single Channel / Normal mode */
438#define D_TS_MONITOR (2<<10) /* Monitor pipe */
439#define D_TS_NONCONTIG (3<<10) /* Non contiguous mode */
440#define D_TS_ANCHOR (7<<10) /* Starting short pipes */
441#define D_TS_MON(v) ((v)<<5) /* Monitor Pipe */
442#define D_TS_NEXT(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */
443
444/* Concentration Highway Interface Modes */
445#define D_CHI_CHICM(v) ((v)<<16) /* Clock mode */
446#define D_CHI_IR (1<<15) /* Immediate Interrupt Report */
447#define D_CHI_EN (1<<14) /* CHIL Interrupt enabled */
448#define D_CHI_OD (1<<13) /* Open Drain Enable */
449#define D_CHI_FE (1<<12) /* Sample CHIFS on Rising Frame Edge */
450#define D_CHI_FD (1<<11) /* Frame Drive */
451#define D_CHI_BPF(v) ((v)<<0) /* Bits per Frame */
452
453/* NT: These are here for completeness */
454#define D_NT_FBIT (1<<17) /* Frame Bit */
455#define D_NT_NBF (1<<16) /* Number of bad frames to loose framing */
456#define D_NT_IRM_IMM (1<<15) /* Interrupt Report & Mask: Immediate */
457#define D_NT_IRM_EN (1<<14) /* Interrupt Report & Mask: Enable */
458#define D_NT_ISNT (1<<13) /* Configfure interface as NT */
459#define D_NT_FT (1<<12) /* Fixed Timing */
460#define D_NT_EZ (1<<11) /* Echo Channel is Zeros */
461#define D_NT_IFA (1<<10) /* Inhibit Final Activation */
462#define D_NT_ACT (1<<9) /* Activate Interface */
463#define D_NT_MFE (1<<8) /* Multiframe Enable */
464#define D_NT_RLB(v) ((v)<<5) /* Remote Loopback */
465#define D_NT_LLB(v) ((v)<<2) /* Local Loopback */
466#define D_NT_FACT (1<<1) /* Force Activation */
467#define D_NT_ABV (1<<0) /* Activate Bipolar Violation */
468
469/* Codec Setup */
470#define D_CDEC_CK(v) ((v)<<24) /* Clock Select */
471#define D_CDEC_FED(v) ((v)<<12) /* FSCOD Falling Edge Delay */
472#define D_CDEC_RED(v) ((v)<<0) /* FSCOD Rising Edge Delay */
473
474/* Test */
475#define D_TEST_RAM(v) ((v)<<16) /* RAM Pointer */
476#define D_TEST_SIZE(v) ((v)<<11) /* */
477#define D_TEST_ROMONOFF 0x5 /* Toggle ROM opcode monitor on/off */
478#define D_TEST_PROC 0x6 /* MicroProcessor test */
479#define D_TEST_SER 0x7 /* Serial-Controller test */
480#define D_TEST_RAMREAD 0x8 /* Copy from Ram to system memory */
481#define D_TEST_RAMWRITE 0x9 /* Copy into Ram from system memory */
482#define D_TEST_RAMBIST 0xa /* RAM Built-In Self Test */
483#define D_TEST_MCBIST 0xb /* Microcontroller Built-In Self Test */
484#define D_TEST_DUMP 0xe /* ROM Dump */
485
486/* CHI Data Mode */
487#define D_CDM_THI (1<<8) /* Transmit Data on CHIDR Pin */
488#define D_CDM_RHI (1<<7) /* Receive Data on CHIDX Pin */
489#define D_CDM_RCE (1<<6) /* Receive on Rising Edge of CHICK */
490#define D_CDM_XCE (1<<2) /* Transmit Data on Rising Edge of CHICK */
491#define D_CDM_XEN (1<<1) /* Transmit Highway Enable */
492#define D_CDM_REN (1<<0) /* Receive Highway Enable */
493
494/* The Interrupts */
495#define D_INTR_BRDY 1 /* Buffer Ready for processing */
496#define D_INTR_MINT 2 /* Marked Interrupt in RD/TD */
497#define D_INTR_IBEG 3 /* Flag to idle transition detected (HDLC) */
498#define D_INTR_IEND 4 /* Idle to flag transition detected (HDLC) */
499#define D_INTR_EOL 5 /* End of List */
500#define D_INTR_CMDI 6 /* Command has bean read */
501#define D_INTR_XCMP 8 /* Transmission of frame complete */
502#define D_INTR_SBRI 9 /* BRI status change info */
503#define D_INTR_FXDT 10 /* Fixed data change */
504#define D_INTR_CHIL 11 /* CHI lost frame sync (channel 36 only) */
505#define D_INTR_COLL 11 /* Unrecoverable D-Channel collision */
506#define D_INTR_DBYT 12 /* Dropped by frame slip */
507#define D_INTR_RBYT 13 /* Repeated by frame slip */
508#define D_INTR_LINT 14 /* Lost Interrupt */
509#define D_INTR_UNDR 15 /* DMA underrun */
510
511#define D_INTR_TE 32
512#define D_INTR_NT 34
513#define D_INTR_CHI 36
514#define D_INTR_CMD 38
515
516#define D_INTR_GETCHAN(v) (((v)>>24) & 0x3f)
517#define D_INTR_GETCODE(v) (((v)>>20) & 0xf)
518#define D_INTR_GETCMD(v) (((v)>>16) & 0xf)
519#define D_INTR_GETVAL(v) ((v) & 0xffff)
520#define D_INTR_GETRVAL(v) ((v) & 0xfffff)
521
522#define D_P_0 0 /* TE receive anchor */
523#define D_P_1 1 /* TE transmit anchor */
524#define D_P_2 2 /* NT transmit anchor */
525#define D_P_3 3 /* NT receive anchor */
526#define D_P_4 4 /* CHI send data */
527#define D_P_5 5 /* CHI receive data */
528#define D_P_6 6 /* */
529#define D_P_7 7 /* */
530#define D_P_8 8 /* */
531#define D_P_9 9 /* */
532#define D_P_10 10 /* */
533#define D_P_11 11 /* */
534#define D_P_12 12 /* */
535#define D_P_13 13 /* */
536#define D_P_14 14 /* */
537#define D_P_15 15 /* */
538#define D_P_16 16 /* CHI anchor pipe */
539#define D_P_17 17 /* CHI send */
540#define D_P_18 18 /* CHI receive */
541#define D_P_19 19 /* CHI receive */
542#define D_P_20 20 /* CHI receive */
543#define D_P_21 21 /* */
544#define D_P_22 22 /* */
545#define D_P_23 23 /* */
546#define D_P_24 24 /* */
547#define D_P_25 25 /* */
548#define D_P_26 26 /* */
549#define D_P_27 27 /* */
550#define D_P_28 28 /* */
551#define D_P_29 29 /* */
552#define D_P_30 30 /* */
553#define D_P_31 31 /* */
554
555/* Transmit descriptor defines */
556#define DBRI_TD_F (1<<31) /* End of Frame */
557#define DBRI_TD_D (1<<30) /* Do not append CRC */
558#define DBRI_TD_CNT(v) ((v)<<16) /* Number of valid bytes in the buffer */
559#define DBRI_TD_B (1<<15) /* Final interrupt */
560#define DBRI_TD_M (1<<14) /* Marker interrupt */
561#define DBRI_TD_I (1<<13) /* Transmit Idle Characters */
562#define DBRI_TD_FCNT(v) (v) /* Flag Count */
563#define DBRI_TD_UNR (1<<3) /* Underrun: transmitter is out of data */
564#define DBRI_TD_ABT (1<<2) /* Abort: frame aborted */
565#define DBRI_TD_TBC (1<<0) /* Transmit buffer Complete */
566#define DBRI_TD_STATUS(v) ((v)&0xff) /* Transmit status */
567 /* Maximum buffer size per TD: almost 8Kb */
568#define DBRI_TD_MAXCNT ((1 << 13) - 1)
569
570/* Receive descriptor defines */
571#define DBRI_RD_F (1<<31) /* End of Frame */
572#define DBRI_RD_C (1<<30) /* Completed buffer */
573#define DBRI_RD_B (1<<15) /* Final interrupt */
574#define DBRI_RD_M (1<<14) /* Marker interrupt */
575#define DBRI_RD_BCNT(v) (v) /* Buffer size */
576#define DBRI_RD_CRC (1<<7) /* 0: CRC is correct */
577#define DBRI_RD_BBC (1<<6) /* 1: Bad Byte received */
578#define DBRI_RD_ABT (1<<5) /* Abort: frame aborted */
579#define DBRI_RD_OVRN (1<<3) /* Overrun: data lost */
580#define DBRI_RD_STATUS(v) ((v)&0xff) /* Receive status */
581#define DBRI_RD_CNT(v) (((v)>>16)&0x1fff) /* Valid bytes in the buffer */
582
583/* stream_info[] access */
584/* Translate the ALSA direction into the array index */
585#define DBRI_STREAMNO(substream) \
586 (substream->stream == \
587 SNDRV_PCM_STREAM_PLAYBACK? DBRI_PLAY: DBRI_REC)
588
589/* Return a pointer to dbri_streaminfo */
590#define DBRI_STREAM(dbri, substream) &dbri->stream_info[DBRI_STREAMNO(substream)]
591
592static snd_dbri_t *dbri_list = NULL; /* All DBRI devices */
593
594/*
595 * Short data pipes transmit LSB first. The CS4215 receives MSB first. Grrr.
596 * So we have to reverse the bits. Note: not all bit lengths are supported
597 */
598static __u32 reverse_bytes(__u32 b, int len)
599{
600 switch (len) {
601 case 32:
602 b = ((b & 0xffff0000) >> 16) | ((b & 0x0000ffff) << 16);
603 case 16:
604 b = ((b & 0xff00ff00) >> 8) | ((b & 0x00ff00ff) << 8);
605 case 8:
606 b = ((b & 0xf0f0f0f0) >> 4) | ((b & 0x0f0f0f0f) << 4);
607 case 4:
608 b = ((b & 0xcccccccc) >> 2) | ((b & 0x33333333) << 2);
609 case 2:
610 b = ((b & 0xaaaaaaaa) >> 1) | ((b & 0x55555555) << 1);
611 case 1:
612 case 0:
613 break;
614 default:
615 printk(KERN_ERR "DBRI reverse_bytes: unsupported length\n");
616 };
617
618 return b;
619}
620
621/*
622****************************************************************************
623************** DBRI initialization and command synchronization *************
624****************************************************************************
625
626Commands are sent to the DBRI by building a list of them in memory,
627then writing the address of the first list item to DBRI register 8.
628The list is terminated with a WAIT command, which can generate a
629CPU interrupt if required.
630
631Since the DBRI can run in parallel with the CPU, several means of
632synchronization present themselves. The original scheme (Rudolf's)
633was to set a flag when we "cmdlock"ed the DBRI, clear the flag when
634an interrupt signaled completion, and wait on a wait_queue if a routine
635attempted to cmdlock while the flag was set. The problems arose when
636we tried to cmdlock from inside an interrupt handler, which might
637cause scheduling in an interrupt (if we waited), etc, etc
638
639A more sophisticated scheme might involve a circular command buffer
640or an array of command buffers. A routine could fill one with
641commands and link it onto a list. When a interrupt signaled
642completion of the current command buffer, look on the list for
643the next one.
644
645I've decided to implement something much simpler - after each command,
646the CPU waits for the DBRI to finish the command by polling the P bit
647in DBRI register 0. I've tried to implement this in such a way
648that might make implementing a more sophisticated scheme easier.
649
650Every time a routine wants to write commands to the DBRI, it must
651first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd
652in return. After the commands have been writen, dbri_cmdsend() is
653called with the final pointer value.
654
655*/
656
657enum dbri_lock_t { NoGetLock, GetLock };
658
659static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get)
660{
661#ifndef SMP
662 if ((get == GetLock) && spin_is_locked(&dbri->lock)) {
663 printk(KERN_ERR "DBRI: cmdlock called while in spinlock.");
664 }
665#endif
666
667 /*if (get == GetLock) spin_lock(&dbri->lock); */
668 return &dbri->dma->cmd[0];
669}
670
671static void dbri_process_interrupt_buffer(snd_dbri_t *);
672
673static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd)
674{
675 int MAXLOOPS = 1000000;
676 int maxloops = MAXLOOPS;
677 volatile s32 *ptr;
678
679 for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) {
680 dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
681 }
682
683 if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) {
684 printk("DBRI: Command buffer overflow! (bug in driver)\n");
685 /* Ignore the last part. */
686 cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3];
687 }
688
689 *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0);
690 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);
691 dbri->wait_seen = 0;
692 sbus_writel(dbri->dma_dvma, dbri->regs + REG8);
693 while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P))
694 barrier();
695 if (maxloops == 0) {
696 printk(KERN_ERR "DBRI: Chip never completed command buffer\n");
697 dprintk(D_CMD, "DBRI: Chip never completed command buffer\n");
698 } else {
699 while ((--maxloops) > 0 && (!dbri->wait_seen))
700 dbri_process_interrupt_buffer(dbri);
701 if (maxloops == 0) {
702 printk(KERN_ERR "DBRI: Chip never acked WAIT\n");
703 dprintk(D_CMD, "DBRI: Chip never acked WAIT\n");
704 } else {
705 dprintk(D_CMD, "Chip completed command "
706 "buffer (%d)\n", MAXLOOPS - maxloops);
707 }
708 }
709
710 /*spin_unlock(&dbri->lock); */
711}
712
713/* Lock must be held when calling this */
714static void dbri_reset(snd_dbri_t * dbri)
715{
716 int i;
717
718 dprintk(D_GEN, "reset 0:%x 2:%x 8:%x 9:%x\n",
719 sbus_readl(dbri->regs + REG0),
720 sbus_readl(dbri->regs + REG2),
721 sbus_readl(dbri->regs + REG8), sbus_readl(dbri->regs + REG9));
722
723 sbus_writel(D_R, dbri->regs + REG0); /* Soft Reset */
724 for (i = 0; (sbus_readl(dbri->regs + REG0) & D_R) && i < 64; i++)
725 udelay(10);
726}
727
728/* Lock must not be held before calling this */
729static void dbri_initialize(snd_dbri_t * dbri)
730{
731 volatile s32 *cmd;
732 u32 dma_addr, tmp;
733 unsigned long flags;
734 int n;
735
736 spin_lock_irqsave(&dbri->lock, flags);
737
738 dbri_reset(dbri);
739
740 cmd = dbri_cmdlock(dbri, NoGetLock);
741 dprintk(D_GEN, "init: cmd: %p, int: %p\n",
742 &dbri->dma->cmd[0], &dbri->dma->intr[0]);
743
744 /*
745 * Initialize the interrupt ringbuffer.
746 */
747 for (n = 0; n < DBRI_NO_INTS - 1; n++) {
748 dma_addr = dbri->dma_dvma;
749 dma_addr += dbri_dma_off(intr, ((n + 1) & DBRI_INT_BLK));
750 dbri->dma->intr[n * DBRI_INT_BLK] = dma_addr;
751 }
752 dma_addr = dbri->dma_dvma + dbri_dma_off(intr, 0);
753 dbri->dma->intr[n * DBRI_INT_BLK] = dma_addr;
754 dbri->dbri_irqp = 1;
755
756 /* Initialize pipes */
757 for (n = 0; n < DBRI_NO_PIPES; n++)
758 dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1;
759
760 /* We should query the openprom to see what burst sizes this
761 * SBus supports. For now, just disable all SBus bursts */
762 tmp = sbus_readl(dbri->regs + REG0);
763 tmp &= ~(D_G | D_S | D_E);
764 sbus_writel(tmp, dbri->regs + REG0);
765
766 /*
767 * Set up the interrupt queue
768 */
769 dma_addr = dbri->dma_dvma + dbri_dma_off(intr, 0);
770 *(cmd++) = DBRI_CMD(D_IIQ, 0, 0);
771 *(cmd++) = dma_addr;
772
773 dbri_cmdsend(dbri, cmd);
774 spin_unlock_irqrestore(&dbri->lock, flags);
775}
776
777/*
778****************************************************************************
779************************** DBRI data pipe management ***********************
780****************************************************************************
781
782While DBRI control functions use the command and interrupt buffers, the
783main data path takes the form of data pipes, which can be short (command
784and interrupt driven), or long (attached to DMA buffers). These functions
785provide a rudimentary means of setting up and managing the DBRI's pipes,
786but the calling functions have to make sure they respect the pipes' linked
787list ordering, among other things. The transmit and receive functions
788here interface closely with the transmit and receive interrupt code.
789
790*/
791static int pipe_active(snd_dbri_t * dbri, int pipe)
792{
793 return ((pipe >= 0) && (dbri->pipes[pipe].desc != -1));
794}
795
796/* reset_pipe(dbri, pipe)
797 *
798 * Called on an in-use pipe to clear anything being transmitted or received
799 * Lock must be held before calling this.
800 */
801static void reset_pipe(snd_dbri_t * dbri, int pipe)
802{
803 int sdp;
804 int desc;
805 volatile int *cmd;
806
807 if (pipe < 0 || pipe > 31) {
808 printk("DBRI: reset_pipe called with illegal pipe number\n");
809 return;
810 }
811
812 sdp = dbri->pipes[pipe].sdp;
813 if (sdp == 0) {
814 printk("DBRI: reset_pipe called on uninitialized pipe\n");
815 return;
816 }
817
818 cmd = dbri_cmdlock(dbri, NoGetLock);
819 *(cmd++) = DBRI_CMD(D_SDP, 0, sdp | D_SDP_C | D_SDP_P);
820 *(cmd++) = 0;
821 dbri_cmdsend(dbri, cmd);
822
823 desc = dbri->pipes[pipe].first_desc;
824 while (desc != -1) {
825 dbri->descs[desc].inuse = 0;
826 desc = dbri->descs[desc].next;
827 }
828
829 dbri->pipes[pipe].desc = -1;
830 dbri->pipes[pipe].first_desc = -1;
831}
832
833/* FIXME: direction as an argument? */
834static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp)
835{
836 if (pipe < 0 || pipe > 31) {
837 printk("DBRI: setup_pipe called with illegal pipe number\n");
838 return;
839 }
840
841 if ((sdp & 0xf800) != sdp) {
842 printk("DBRI: setup_pipe called with strange SDP value\n");
843 /* sdp &= 0xf800; */
844 }
845
846 /* If this is a fixed receive pipe, arrange for an interrupt
847 * every time its data changes
848 */
849 if (D_SDP_MODE(sdp) == D_SDP_FIXED && !(sdp & D_SDP_TO_SER))
850 sdp |= D_SDP_CHANGE;
851
852 sdp |= D_PIPE(pipe);
853 dbri->pipes[pipe].sdp = sdp;
854 dbri->pipes[pipe].desc = -1;
855 dbri->pipes[pipe].first_desc = -1;
856 if (sdp & D_SDP_TO_SER)
857 dbri->pipes[pipe].direction = PIPEoutput;
858 else
859 dbri->pipes[pipe].direction = PIPEinput;
860
861 reset_pipe(dbri, pipe);
862}
863
864/* FIXME: direction not needed */
865static void link_time_slot(snd_dbri_t * dbri, int pipe,
866 enum in_or_out direction, int basepipe,
867 int length, int cycle)
868{
869 volatile s32 *cmd;
870 int val;
871 int prevpipe;
872 int nextpipe;
873
874 if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) {
875 printk
876 ("DBRI: link_time_slot called with illegal pipe number\n");
877 return;
878 }
879
880 if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) {
881 printk("DBRI: link_time_slot called on uninitialized pipe\n");
882 return;
883 }
884
885 /* Deal with CHI special case:
886 * "If transmission on edges 0 or 1 is desired, then cycle n
887 * (where n = # of bit times per frame...) must be used."
888 * - DBRI data sheet, page 11
889 */
890 if (basepipe == 16 && direction == PIPEoutput && cycle == 0)
891 cycle = dbri->chi_bpf;
892
893 if (basepipe == pipe) {
894 prevpipe = pipe;
895 nextpipe = pipe;
896 } else {
897 /* We're not initializing a new linked list (basepipe != pipe),
898 * so run through the linked list and find where this pipe
899 * should be sloted in, based on its cycle. CHI confuses
900 * things a bit, since it has a single anchor for both its
901 * transmit and receive lists.
902 */
903 if (basepipe == 16) {
904 if (direction == PIPEinput) {
905 prevpipe = dbri->chi_in_pipe;
906 } else {
907 prevpipe = dbri->chi_out_pipe;
908 }
909 } else {
910 prevpipe = basepipe;
911 }
912
913 nextpipe = dbri->pipes[prevpipe].nextpipe;
914
915 while (dbri->pipes[nextpipe].cycle < cycle
916 && dbri->pipes[nextpipe].nextpipe != basepipe) {
917 prevpipe = nextpipe;
918 nextpipe = dbri->pipes[nextpipe].nextpipe;
919 }
920 }
921
922 if (prevpipe == 16) {
923 if (direction == PIPEinput) {
924 dbri->chi_in_pipe = pipe;
925 } else {
926 dbri->chi_out_pipe = pipe;
927 }
928 } else {
929 dbri->pipes[prevpipe].nextpipe = pipe;
930 }
931
932 dbri->pipes[pipe].nextpipe = nextpipe;
933 dbri->pipes[pipe].cycle = cycle;
934 dbri->pipes[pipe].length = length;
935
936 cmd = dbri_cmdlock(dbri, NoGetLock);
937
938 if (direction == PIPEinput) {
939 val = D_DTS_VI | D_DTS_INS | D_DTS_PRVIN(prevpipe) | pipe;
940 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
941 *(cmd++) =
942 D_TS_LEN(length) | D_TS_CYCLE(cycle) | D_TS_NEXT(nextpipe);
943 *(cmd++) = 0;
944 } else {
945 val = D_DTS_VO | D_DTS_INS | D_DTS_PRVOUT(prevpipe) | pipe;
946 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
947 *(cmd++) = 0;
948 *(cmd++) =
949 D_TS_LEN(length) | D_TS_CYCLE(cycle) | D_TS_NEXT(nextpipe);
950 }
951
952 dbri_cmdsend(dbri, cmd);
953}
954
955static void unlink_time_slot(snd_dbri_t * dbri, int pipe,
956 enum in_or_out direction, int prevpipe,
957 int nextpipe)
958{
959 volatile s32 *cmd;
960 int val;
961
962 if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) {
963 printk
964 ("DBRI: unlink_time_slot called with illegal pipe number\n");
965 return;
966 }
967
968 cmd = dbri_cmdlock(dbri, NoGetLock);
969
970 if (direction == PIPEinput) {
971 val = D_DTS_VI | D_DTS_DEL | D_DTS_PRVIN(prevpipe) | pipe;
972 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
973 *(cmd++) = D_TS_NEXT(nextpipe);
974 *(cmd++) = 0;
975 } else {
976 val = D_DTS_VO | D_DTS_DEL | D_DTS_PRVOUT(prevpipe) | pipe;
977 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
978 *(cmd++) = 0;
979 *(cmd++) = D_TS_NEXT(nextpipe);
980 }
981
982 dbri_cmdsend(dbri, cmd);
983}
984
985/* xmit_fixed() / recv_fixed()
986 *
987 * Transmit/receive data on a "fixed" pipe - i.e, one whose contents are not
988 * expected to change much, and which we don't need to buffer.
989 * The DBRI only interrupts us when the data changes (receive pipes),
990 * or only changes the data when this function is called (transmit pipes).
991 * Only short pipes (numbers 16-31) can be used in fixed data mode.
992 *
993 * These function operate on a 32-bit field, no matter how large
994 * the actual time slot is. The interrupt handler takes care of bit
995 * ordering and alignment. An 8-bit time slot will always end up
996 * in the low-order 8 bits, filled either MSB-first or LSB-first,
997 * depending on the settings passed to setup_pipe()
998 */
999static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data)
1000{
1001 volatile s32 *cmd;
1002
1003 if (pipe < 16 || pipe > 31) {
1004 printk("DBRI: xmit_fixed: Illegal pipe number\n");
1005 return;
1006 }
1007
1008 if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) {
1009 printk("DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe);
1010 return;
1011 }
1012
1013 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
1014 printk("DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe);
1015 return;
1016 }
1017
1018 if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) {
1019 printk("DBRI: xmit_fixed: Called on receive pipe %d\n", pipe);
1020 return;
1021 }
1022
1023 /* DBRI short pipes always transmit LSB first */
1024
1025 if (dbri->pipes[pipe].sdp & D_SDP_MSB)
1026 data = reverse_bytes(data, dbri->pipes[pipe].length);
1027
1028 cmd = dbri_cmdlock(dbri, GetLock);
1029
1030 *(cmd++) = DBRI_CMD(D_SSP, 0, pipe);
1031 *(cmd++) = data;
1032
1033 dbri_cmdsend(dbri, cmd);
1034}
1035
1036static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr)
1037{
1038 if (pipe < 16 || pipe > 31) {
1039 printk("DBRI: recv_fixed called with illegal pipe number\n");
1040 return;
1041 }
1042
1043 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
1044 printk("DBRI: recv_fixed called on non-fixed pipe %d\n", pipe);
1045 return;
1046 }
1047
1048 if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) {
1049 printk("DBRI: recv_fixed called on transmit pipe %d\n", pipe);
1050 return;
1051 }
1052
1053 dbri->pipes[pipe].recv_fixed_ptr = ptr;
1054}
1055
1056/* setup_descs()
1057 *
1058 * Setup transmit/receive data on a "long" pipe - i.e, one associated
1059 * with a DMA buffer.
1060 *
1061 * Only pipe numbers 0-15 can be used in this mode.
1062 *
1063 * This function takes a stream number pointing to a data buffer,
1064 * and work by building chains of descriptors which identify the
1065 * data buffers. Buffers too large for a single descriptor will
1066 * be spread across multiple descriptors.
1067 */
1068static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
1069{
1070 dbri_streaminfo_t *info = &dbri->stream_info[streamno];
1071 __u32 dvma_buffer;
1072 int desc = 0;
1073 int len;
1074 int first_desc = -1;
1075 int last_desc = -1;
1076
1077 if (info->pipe < 0 || info->pipe > 15) {
1078 printk("DBRI: setup_descs: Illegal pipe number\n");
1079 return -2;
1080 }
1081
1082 if (dbri->pipes[info->pipe].sdp == 0) {
1083 printk("DBRI: setup_descs: Uninitialized pipe %d\n",
1084 info->pipe);
1085 return -2;
1086 }
1087
1088 dvma_buffer = info->dvma_buffer;
1089 len = info->size;
1090
1091 if (streamno == DBRI_PLAY) {
1092 if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) {
1093 printk("DBRI: setup_descs: Called on receive pipe %d\n",
1094 info->pipe);
1095 return -2;
1096 }
1097 } else {
1098 if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) {
1099 printk
1100 ("DBRI: setup_descs: Called on transmit pipe %d\n",
1101 info->pipe);
1102 return -2;
1103 }
1104 /* Should be able to queue multiple buffers to receive on a pipe */
1105 if (pipe_active(dbri, info->pipe)) {
1106 printk("DBRI: recv_on_pipe: Called on active pipe %d\n",
1107 info->pipe);
1108 return -2;
1109 }
1110
1111 /* Make sure buffer size is multiple of four */
1112 len &= ~3;
1113 }
1114
1115 while (len > 0) {
1116 int mylen;
1117
1118 for (; desc < DBRI_NO_DESCS; desc++) {
1119 if (!dbri->descs[desc].inuse)
1120 break;
1121 }
1122 if (desc == DBRI_NO_DESCS) {
1123 printk("DBRI: setup_descs: No descriptors\n");
1124 return -1;
1125 }
1126
1127 if (len > DBRI_TD_MAXCNT) {
1128 mylen = DBRI_TD_MAXCNT; /* 8KB - 1 */
1129 } else {
1130 mylen = len;
1131 }
1132 if (mylen > period) {
1133 mylen = period;
1134 }
1135
1136 dbri->descs[desc].inuse = 1;
1137 dbri->descs[desc].next = -1;
1138 dbri->dma->desc[desc].ba = dvma_buffer;
1139 dbri->dma->desc[desc].nda = 0;
1140
1141 if (streamno == DBRI_PLAY) {
1142 dbri->descs[desc].len = mylen;
1143 dbri->dma->desc[desc].word1 = DBRI_TD_CNT(mylen);
1144 dbri->dma->desc[desc].word4 = 0;
1145 if (first_desc != -1)
1146 dbri->dma->desc[desc].word1 |= DBRI_TD_M;
1147 } else {
1148 dbri->descs[desc].len = 0;
1149 dbri->dma->desc[desc].word1 = 0;
1150 dbri->dma->desc[desc].word4 =
1151 DBRI_RD_B | DBRI_RD_BCNT(mylen);
1152 }
1153
1154 if (first_desc == -1) {
1155 first_desc = desc;
1156 } else {
1157 dbri->descs[last_desc].next = desc;
1158 dbri->dma->desc[last_desc].nda =
1159 dbri->dma_dvma + dbri_dma_off(desc, desc);
1160 }
1161
1162 last_desc = desc;
1163 dvma_buffer += mylen;
1164 len -= mylen;
1165 }
1166
1167 if (first_desc == -1 || last_desc == -1) {
1168 printk("DBRI: setup_descs: Not enough descriptors available\n");
1169 return -1;
1170 }
1171
1172 dbri->dma->desc[last_desc].word1 &= ~DBRI_TD_M;
1173 if (streamno == DBRI_PLAY) {
1174 dbri->dma->desc[last_desc].word1 |=
1175 DBRI_TD_I | DBRI_TD_F | DBRI_TD_B;
1176 }
1177 dbri->pipes[info->pipe].first_desc = first_desc;
1178 dbri->pipes[info->pipe].desc = first_desc;
1179
1180 for (desc = first_desc; desc != -1; desc = dbri->descs[desc].next) {
1181 dprintk(D_DESC, "DESC %d: %08x %08x %08x %08x\n",
1182 desc,
1183 dbri->dma->desc[desc].word1,
1184 dbri->dma->desc[desc].ba,
1185 dbri->dma->desc[desc].nda, dbri->dma->desc[desc].word4);
1186 }
1187 return 0;
1188}
1189
1190/*
1191****************************************************************************
1192************************** DBRI - CHI interface ****************************
1193****************************************************************************
1194
1195The CHI is a four-wire (clock, frame sync, data in, data out) time-division
1196multiplexed serial interface which the DBRI can operate in either master
1197(give clock/frame sync) or slave (take clock/frame sync) mode.
1198
1199*/
1200
1201enum master_or_slave { CHImaster, CHIslave };
1202
1203static void reset_chi(snd_dbri_t * dbri, enum master_or_slave master_or_slave,
1204 int bits_per_frame)
1205{
1206 volatile s32 *cmd;
1207 int val;
1208 static int chi_initialized = 0; /* FIXME: mutex? */
1209
1210 if (!chi_initialized) {
1211
1212 cmd = dbri_cmdlock(dbri, GetLock);
1213
1214 /* Set CHI Anchor: Pipe 16 */
1215
1216 val = D_DTS_VI | D_DTS_INS | D_DTS_PRVIN(16) | D_PIPE(16);
1217 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
1218 *(cmd++) = D_TS_ANCHOR | D_TS_NEXT(16);
1219 *(cmd++) = 0;
1220
1221 val = D_DTS_VO | D_DTS_INS | D_DTS_PRVOUT(16) | D_PIPE(16);
1222 *(cmd++) = DBRI_CMD(D_DTS, 0, val);
1223 *(cmd++) = 0;
1224 *(cmd++) = D_TS_ANCHOR | D_TS_NEXT(16);
1225
1226 dbri->pipes[16].sdp = 1;
1227 dbri->pipes[16].nextpipe = 16;
1228 dbri->chi_in_pipe = 16;
1229 dbri->chi_out_pipe = 16;
1230
1231#if 0
1232 chi_initialized++;
1233#endif
1234 } else {
1235 int pipe;
1236
1237 for (pipe = dbri->chi_in_pipe;
1238 pipe != 16; pipe = dbri->pipes[pipe].nextpipe) {
1239 unlink_time_slot(dbri, pipe, PIPEinput,
1240 16, dbri->pipes[pipe].nextpipe);
1241 }
1242 for (pipe = dbri->chi_out_pipe;
1243 pipe != 16; pipe = dbri->pipes[pipe].nextpipe) {
1244 unlink_time_slot(dbri, pipe, PIPEoutput,
1245 16, dbri->pipes[pipe].nextpipe);
1246 }
1247
1248 dbri->chi_in_pipe = 16;
1249 dbri->chi_out_pipe = 16;
1250
1251 cmd = dbri_cmdlock(dbri, GetLock);
1252 }
1253
1254 if (master_or_slave == CHIslave) {
1255 /* Setup DBRI for CHI Slave - receive clock, frame sync (FS)
1256 *
1257 * CHICM = 0 (slave mode, 8 kHz frame rate)
1258 * IR = give immediate CHI status interrupt
1259 * EN = give CHI status interrupt upon change
1260 */
1261 *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(0));
1262 } else {
1263 /* Setup DBRI for CHI Master - generate clock, FS
1264 *
1265 * BPF = bits per 8 kHz frame
1266 * 12.288 MHz / CHICM_divisor = clock rate
1267 * FD = 1 - drive CHIFS on rising edge of CHICK
1268 */
1269 int clockrate = bits_per_frame * 8;
1270 int divisor = 12288 / clockrate;
1271
1272 if (divisor > 255 || divisor * clockrate != 12288)
1273 printk("DBRI: illegal bits_per_frame in setup_chi\n");
1274
1275 *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD
1276 | D_CHI_BPF(bits_per_frame));
1277 }
1278
1279 dbri->chi_bpf = bits_per_frame;
1280
1281 /* CHI Data Mode
1282 *
1283 * RCE = 0 - receive on falling edge of CHICK
1284 * XCE = 1 - transmit on rising edge of CHICK
1285 * XEN = 1 - enable transmitter
1286 * REN = 1 - enable receiver
1287 */
1288
1289 *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0);
1290 *(cmd++) = DBRI_CMD(D_CDM, 0, D_CDM_XCE | D_CDM_XEN | D_CDM_REN);
1291
1292 dbri_cmdsend(dbri, cmd);
1293}
1294
1295/*
1296****************************************************************************
1297*********************** CS4215 audio codec management **********************
1298****************************************************************************
1299
1300In the standard SPARC audio configuration, the CS4215 codec is attached
1301to the DBRI via the CHI interface and few of the DBRI's PIO pins.
1302
1303*/
1304static void cs4215_setup_pipes(snd_dbri_t * dbri)
1305{
1306 /*
1307 * Data mode:
1308 * Pipe 4: Send timeslots 1-4 (audio data)
1309 * Pipe 20: Send timeslots 5-8 (part of ctrl data)
1310 * Pipe 6: Receive timeslots 1-4 (audio data)
1311 * Pipe 21: Receive timeslots 6-7. We can only receive 20 bits via
1312 * interrupt, and the rest of the data (slot 5 and 8) is
1313 * not relevant for us (only for doublechecking).
1314 *
1315 * Control mode:
1316 * Pipe 17: Send timeslots 1-4 (slots 5-8 are readonly)
1317 * Pipe 18: Receive timeslot 1 (clb).
1318 * Pipe 19: Receive timeslot 7 (version).
1319 */
1320
1321 setup_pipe(dbri, 4, D_SDP_MEM | D_SDP_TO_SER | D_SDP_MSB);
1322 setup_pipe(dbri, 20, D_SDP_FIXED | D_SDP_TO_SER | D_SDP_MSB);
1323 setup_pipe(dbri, 6, D_SDP_MEM | D_SDP_FROM_SER | D_SDP_MSB);
1324 setup_pipe(dbri, 21, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB);
1325
1326 setup_pipe(dbri, 17, D_SDP_FIXED | D_SDP_TO_SER | D_SDP_MSB);
1327 setup_pipe(dbri, 18, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB);
1328 setup_pipe(dbri, 19, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB);
1329}
1330
1331static int cs4215_init_data(struct cs4215 *mm)
1332{
1333 /*
1334 * No action, memory resetting only.
1335 *
1336 * Data Time Slot 5-8
1337 * Speaker,Line and Headphone enable. Gain set to the half.
1338 * Input is mike.
1339 */
1340 mm->data[0] = CS4215_LO(0x20) | CS4215_HE | CS4215_LE;
1341 mm->data[1] = CS4215_RO(0x20) | CS4215_SE;
1342 mm->data[2] = CS4215_LG(0x8) | CS4215_IS | CS4215_PIO0 | CS4215_PIO1;
1343 mm->data[3] = CS4215_RG(0x8) | CS4215_MA(0xf);
1344
1345 /*
1346 * Control Time Slot 1-4
1347 * 0: Default I/O voltage scale
1348 * 1: 8 bit ulaw, 8kHz, mono, high pass filter disabled
1349 * 2: Serial enable, CHI master, 128 bits per frame, clock 1
1350 * 3: Tests disabled
1351 */
1352 mm->ctrl[0] = CS4215_RSRVD_1 | CS4215_MLB;
1353 mm->ctrl[1] = CS4215_DFR_ULAW | CS4215_FREQ[0].csval;
1354 mm->ctrl[2] = CS4215_XCLK | CS4215_BSEL_128 | CS4215_FREQ[0].xtal;
1355 mm->ctrl[3] = 0;
1356
1357 mm->status = 0;
1358 mm->version = 0xff;
1359 mm->precision = 8; /* For ULAW */
1360 mm->channels = 2;
1361
1362 return 0;
1363}
1364
1365static void cs4215_setdata(snd_dbri_t * dbri, int muted)
1366{
1367 if (muted) {
1368 dbri->mm.data[0] |= 63;
1369 dbri->mm.data[1] |= 63;
1370 dbri->mm.data[2] &= ~15;
1371 dbri->mm.data[3] &= ~15;
1372 } else {
1373 /* Start by setting the playback attenuation. */
1374 dbri_streaminfo_t *info = &dbri->stream_info[DBRI_PLAY];
1375 int left_gain = info->left_gain % 64;
1376 int right_gain = info->right_gain % 64;
1377
1378 if (info->balance < DBRI_MID_BALANCE) {
1379 right_gain *= info->balance;
1380 right_gain /= DBRI_MID_BALANCE;
1381 } else {
1382 left_gain *= DBRI_RIGHT_BALANCE - info->balance;
1383 left_gain /= DBRI_MID_BALANCE;
1384 }
1385
1386 dbri->mm.data[0] &= ~0x3f; /* Reset the volume bits */
1387 dbri->mm.data[1] &= ~0x3f;
1388 dbri->mm.data[0] |= (DBRI_MAX_VOLUME - left_gain);
1389 dbri->mm.data[1] |= (DBRI_MAX_VOLUME - right_gain);
1390
1391 /* Now set the recording gain. */
1392 info = &dbri->stream_info[DBRI_REC];
1393 left_gain = info->left_gain % 16;
1394 right_gain = info->right_gain % 16;
1395 dbri->mm.data[2] |= CS4215_LG(left_gain);
1396 dbri->mm.data[3] |= CS4215_RG(right_gain);
1397 }
1398
1399 xmit_fixed(dbri, 20, *(int *)dbri->mm.data);
1400}
1401
1402/*
1403 * Set the CS4215 to data mode.
1404 */
1405static void cs4215_open(snd_dbri_t * dbri)
1406{
1407 int data_width;
1408 u32 tmp;
1409
1410 dprintk(D_MM, "cs4215_open: %d channels, %d bits\n",
1411 dbri->mm.channels, dbri->mm.precision);
1412
1413 /* Temporarily mute outputs, and wait 1/8000 sec (125 us)
1414 * to make sure this takes. This avoids clicking noises.
1415 */
1416
1417 cs4215_setdata(dbri, 1);
1418 udelay(125);
1419
1420 /*
1421 * Data mode:
1422 * Pipe 4: Send timeslots 1-4 (audio data)
1423 * Pipe 20: Send timeslots 5-8 (part of ctrl data)
1424 * Pipe 6: Receive timeslots 1-4 (audio data)
1425 * Pipe 21: Receive timeslots 6-7. We can only receive 20 bits via
1426 * interrupt, and the rest of the data (slot 5 and 8) is
1427 * not relevant for us (only for doublechecking).
1428 *
1429 * Just like in control mode, the time slots are all offset by eight
1430 * bits. The CS4215, it seems, observes TSIN (the delayed signal)
1431 * even if it's the CHI master. Don't ask me...
1432 */
1433 tmp = sbus_readl(dbri->regs + REG0);
1434 tmp &= ~(D_C); /* Disable CHI */
1435 sbus_writel(tmp, dbri->regs + REG0);
1436
1437 /* Switch CS4215 to data mode - set PIO3 to 1 */
1438 sbus_writel(D_ENPIO | D_PIO1 | D_PIO3 |
1439 (dbri->mm.onboard ? D_PIO0 : D_PIO2), dbri->regs + REG2);
1440
1441 reset_chi(dbri, CHIslave, 128);
1442
1443 /* Note: this next doesn't work for 8-bit stereo, because the two
1444 * channels would be on timeslots 1 and 3, with 2 and 4 idle.
1445 * (See CS4215 datasheet Fig 15)
1446 *
1447 * DBRI non-contiguous mode would be required to make this work.
1448 */
1449 data_width = dbri->mm.channels * dbri->mm.precision;
1450
1451 link_time_slot(dbri, 20, PIPEoutput, 16, 32, dbri->mm.offset + 32);
1452 link_time_slot(dbri, 4, PIPEoutput, 16, data_width, dbri->mm.offset);
1453 link_time_slot(dbri, 6, PIPEinput, 16, data_width, dbri->mm.offset);
1454 link_time_slot(dbri, 21, PIPEinput, 16, 16, dbri->mm.offset + 40);
1455
1456 /* FIXME: enable CHI after _setdata? */
1457 tmp = sbus_readl(dbri->regs + REG0);
1458 tmp |= D_C; /* Enable CHI */
1459 sbus_writel(tmp, dbri->regs + REG0);
1460
1461 cs4215_setdata(dbri, 0);
1462}
1463
1464/*
1465 * Send the control information (i.e. audio format)
1466 */
1467static int cs4215_setctrl(snd_dbri_t * dbri)
1468{
1469 int i, val;
1470 u32 tmp;
1471
1472 /* FIXME - let the CPU do something useful during these delays */
1473
1474 /* Temporarily mute outputs, and wait 1/8000 sec (125 us)
1475 * to make sure this takes. This avoids clicking noises.
1476 */
1477
1478 cs4215_setdata(dbri, 1);
1479 udelay(125);
1480
1481 /*
1482 * Enable Control mode: Set DBRI's PIO3 (4215's D/~C) to 0, then wait
1483 * 12 cycles <= 12/(5512.5*64) sec = 34.01 usec
1484 */
1485 val = D_ENPIO | D_PIO1 | (dbri->mm.onboard ? D_PIO0 : D_PIO2);
1486 sbus_writel(val, dbri->regs + REG2);
1487 dprintk(D_MM, "cs4215_setctrl: reg2=0x%x\n", val);
1488 udelay(34);
1489
1490 /* In Control mode, the CS4215 is a slave device, so the DBRI must
1491 * operate as CHI master, supplying clocking and frame synchronization.
1492 *
1493 * In Data mode, however, the CS4215 must be CHI master to insure
1494 * that its data stream is synchronous with its codec.
1495 *
1496 * The upshot of all this? We start by putting the DBRI into master
1497 * mode, program the CS4215 in Control mode, then switch the CS4215
1498 * into Data mode and put the DBRI into slave mode. Various timing
1499 * requirements must be observed along the way.
1500 *
1501 * Oh, and one more thing, on a SPARCStation 20 (and maybe
1502 * others?), the addressing of the CS4215's time slots is
1503 * offset by eight bits, so we add eight to all the "cycle"
1504 * values in the Define Time Slot (DTS) commands. This is
1505 * done in hardware by a TI 248 that delays the DBRI->4215
1506 * frame sync signal by eight clock cycles. Anybody know why?
1507 */
1508 tmp = sbus_readl(dbri->regs + REG0);
1509 tmp &= ~D_C; /* Disable CHI */
1510 sbus_writel(tmp, dbri->regs + REG0);
1511
1512 reset_chi(dbri, CHImaster, 128);
1513
1514 /*
1515 * Control mode:
1516 * Pipe 17: Send timeslots 1-4 (slots 5-8 are readonly)
1517 * Pipe 18: Receive timeslot 1 (clb).
1518 * Pipe 19: Receive timeslot 7 (version).
1519 */
1520
1521 link_time_slot(dbri, 17, PIPEoutput, 16, 32, dbri->mm.offset);
1522 link_time_slot(dbri, 18, PIPEinput, 16, 8, dbri->mm.offset);
1523 link_time_slot(dbri, 19, PIPEinput, 16, 8, dbri->mm.offset + 48);
1524
1525 /* Wait for the chip to echo back CLB (Control Latch Bit) as zero */
1526 dbri->mm.ctrl[0] &= ~CS4215_CLB;
1527 xmit_fixed(dbri, 17, *(int *)dbri->mm.ctrl);
1528
1529 tmp = sbus_readl(dbri->regs + REG0);
1530 tmp |= D_C; /* Enable CHI */
1531 sbus_writel(tmp, dbri->regs + REG0);
1532
1533 for (i = 64; ((dbri->mm.status & 0xe4) != 0x20); --i) {
1534 udelay(125);
1535 }
1536 if (i == 0) {
1537 dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n",
1538 dbri->mm.status);
1539 return -1;
1540 }
1541
1542 /* Disable changes to our copy of the version number, as we are about
1543 * to leave control mode.
1544 */
1545 recv_fixed(dbri, 19, NULL);
1546
1547 /* Terminate CS4215 control mode - data sheet says
1548 * "Set CLB=1 and send two more frames of valid control info"
1549 */
1550 dbri->mm.ctrl[0] |= CS4215_CLB;
1551 xmit_fixed(dbri, 17, *(int *)dbri->mm.ctrl);
1552
1553 /* Two frames of control info @ 8kHz frame rate = 250 us delay */
1554 udelay(250);
1555
1556 cs4215_setdata(dbri, 0);
1557
1558 return 0;
1559}
1560
1561/*
1562 * Setup the codec with the sampling rate, audio format and number of
1563 * channels.
1564 * As part of the process we resend the settings for the data
1565 * timeslots as well.
1566 */
1567static int cs4215_prepare(snd_dbri_t * dbri, unsigned int rate,
1568 snd_pcm_format_t format, unsigned int channels)
1569{
1570 int freq_idx;
1571 int ret = 0;
1572
1573 /* Lookup index for this rate */
1574 for (freq_idx = 0; CS4215_FREQ[freq_idx].freq != 0; freq_idx++) {
1575 if (CS4215_FREQ[freq_idx].freq == rate)
1576 break;
1577 }
1578 if (CS4215_FREQ[freq_idx].freq != rate) {
1579 printk(KERN_WARNING "DBRI: Unsupported rate %d Hz\n", rate);
1580 return -1;
1581 }
1582
1583 switch (format) {
1584 case SNDRV_PCM_FORMAT_MU_LAW:
1585 dbri->mm.ctrl[1] = CS4215_DFR_ULAW;
1586 dbri->mm.precision = 8;
1587 break;
1588 case SNDRV_PCM_FORMAT_A_LAW:
1589 dbri->mm.ctrl[1] = CS4215_DFR_ALAW;
1590 dbri->mm.precision = 8;
1591 break;
1592 case SNDRV_PCM_FORMAT_U8:
1593 dbri->mm.ctrl[1] = CS4215_DFR_LINEAR8;
1594 dbri->mm.precision = 8;
1595 break;
1596 case SNDRV_PCM_FORMAT_S16_BE:
1597 dbri->mm.ctrl[1] = CS4215_DFR_LINEAR16;
1598 dbri->mm.precision = 16;
1599 break;
1600 default:
1601 printk(KERN_WARNING "DBRI: Unsupported format %d\n", format);
1602 return -1;
1603 }
1604
1605 /* Add rate parameters */
1606 dbri->mm.ctrl[1] |= CS4215_FREQ[freq_idx].csval;
1607 dbri->mm.ctrl[2] = CS4215_XCLK |
1608 CS4215_BSEL_128 | CS4215_FREQ[freq_idx].xtal;
1609
1610 dbri->mm.channels = channels;
1611 /* Stereo bit: 8 bit stereo not working yet. */
1612 if ((channels > 1) && (dbri->mm.precision == 16))
1613 dbri->mm.ctrl[1] |= CS4215_DFR_STEREO;
1614
1615 ret = cs4215_setctrl(dbri);
1616 if (ret == 0)
1617 cs4215_open(dbri); /* set codec to data mode */
1618
1619 return ret;
1620}
1621
1622/*
1623 *
1624 */
1625static int cs4215_init(snd_dbri_t * dbri)
1626{
1627 u32 reg2 = sbus_readl(dbri->regs + REG2);
1628 dprintk(D_MM, "cs4215_init: reg2=0x%x\n", reg2);
1629
1630 /* Look for the cs4215 chips */
1631 if (reg2 & D_PIO2) {
1632 dprintk(D_MM, "Onboard CS4215 detected\n");
1633 dbri->mm.onboard = 1;
1634 }
1635 if (reg2 & D_PIO0) {
1636 dprintk(D_MM, "Speakerbox detected\n");
1637 dbri->mm.onboard = 0;
1638
1639 if (reg2 & D_PIO2) {
1640 printk(KERN_INFO "DBRI: Using speakerbox / "
1641 "ignoring onboard mmcodec.\n");
1642 sbus_writel(D_ENPIO2, dbri->regs + REG2);
1643 }
1644 }
1645
1646 if (!(reg2 & (D_PIO0 | D_PIO2))) {
1647 printk(KERN_ERR "DBRI: no mmcodec found.\n");
1648 return -EIO;
1649 }
1650
1651 cs4215_setup_pipes(dbri);
1652
1653 cs4215_init_data(&dbri->mm);
1654
1655 /* Enable capture of the status & version timeslots. */
1656 recv_fixed(dbri, 18, &dbri->mm.status);
1657 recv_fixed(dbri, 19, &dbri->mm.version);
1658
1659 dbri->mm.offset = dbri->mm.onboard ? 0 : 8;
1660 if (cs4215_setctrl(dbri) == -1 || dbri->mm.version == 0xff) {
1661 dprintk(D_MM, "CS4215 failed probe at offset %d\n",
1662 dbri->mm.offset);
1663 return -EIO;
1664 }
1665 dprintk(D_MM, "Found CS4215 at offset %d\n", dbri->mm.offset);
1666
1667 return 0;
1668}
1669
1670/*
1671****************************************************************************
1672*************************** DBRI interrupt handler *************************
1673****************************************************************************
1674
1675The DBRI communicates with the CPU mainly via a circular interrupt
1676buffer. When an interrupt is signaled, the CPU walks through the
1677buffer and calls dbri_process_one_interrupt() for each interrupt word.
1678Complicated interrupts are handled by dedicated functions (which
1679appear first in this file). Any pending interrupts can be serviced by
1680calling dbri_process_interrupt_buffer(), which works even if the CPU's
1681interrupts are disabled. This function is used by dbri_cmdsend()
1682to make sure we're synced up with the chip after each command sequence,
1683even if we're running cli'ed.
1684
1685*/
1686
1687/* xmit_descs()
1688 *
1689 * Transmit the current TD's for recording/playing, if needed.
1690 * For playback, ALSA has filled the DMA memory with new data (we hope).
1691 */
1692static void xmit_descs(unsigned long data)
1693{
1694 snd_dbri_t *dbri = (snd_dbri_t *) data;
1695 dbri_streaminfo_t *info;
1696 volatile s32 *cmd;
1697 unsigned long flags;
1698 int first_td;
1699
1700 if (dbri == NULL)
1701 return; /* Disabled */
1702
1703 /* First check the recording stream for buffer overflow */
1704 info = &dbri->stream_info[DBRI_REC];
1705 spin_lock_irqsave(&dbri->lock, flags);
1706
1707 if ((info->left >= info->size) && (info->pipe >= 0)) {
1708 first_td = dbri->pipes[info->pipe].first_desc;
1709
1710 dprintk(D_DESC, "xmit_descs rec @ TD %d\n", first_td);
1711
1712 /* Stream could be closed by the time we run. */
1713 if (first_td < 0) {
1714 goto play;
1715 }
1716
1717 cmd = dbri_cmdlock(dbri, NoGetLock);
1718 *(cmd++) = DBRI_CMD(D_SDP, 0,
1719 dbri->pipes[info->pipe].sdp
1720 | D_SDP_P | D_SDP_EVERY | D_SDP_C);
1721 *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
1722 dbri_cmdsend(dbri, cmd);
1723
1724 /* Reset our admin of the pipe & bytes read. */
1725 dbri->pipes[info->pipe].desc = first_td;
1726 info->left = 0;
1727 }
1728
1729play:
1730 spin_unlock_irqrestore(&dbri->lock, flags);
1731
1732 /* Now check the playback stream for buffer underflow */
1733 info = &dbri->stream_info[DBRI_PLAY];
1734 spin_lock_irqsave(&dbri->lock, flags);
1735
1736 if ((info->left <= 0) && (info->pipe >= 0)) {
1737 first_td = dbri->pipes[info->pipe].first_desc;
1738
1739 dprintk(D_DESC, "xmit_descs play @ TD %d\n", first_td);
1740
1741 /* Stream could be closed by the time we run. */
1742 if (first_td < 0) {
1743 spin_unlock_irqrestore(&dbri->lock, flags);
1744 return;
1745 }
1746
1747 cmd = dbri_cmdlock(dbri, NoGetLock);
1748 *(cmd++) = DBRI_CMD(D_SDP, 0,
1749 dbri->pipes[info->pipe].sdp
1750 | D_SDP_P | D_SDP_EVERY | D_SDP_C);
1751 *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
1752 dbri_cmdsend(dbri, cmd);
1753
1754 /* Reset our admin of the pipe & bytes written. */
1755 dbri->pipes[info->pipe].desc = first_td;
1756 info->left = info->size;
1757 }
1758 spin_unlock_irqrestore(&dbri->lock, flags);
1759}
1760
1761DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0);
1762
1763/* transmission_complete_intr()
1764 *
1765 * Called by main interrupt handler when DBRI signals transmission complete
1766 * on a pipe (interrupt triggered by the B bit in a transmit descriptor).
1767 *
1768 * Walks through the pipe's list of transmit buffer descriptors, releasing
1769 * each one's DMA buffer (if present), flagging the descriptor available,
1770 * and signaling its callback routine (if present), before proceeding
1771 * to the next one. Stops when the first descriptor is found without
1772 * TBC (Transmit Buffer Complete) set, or we've run through them all.
1773 */
1774
1775static void transmission_complete_intr(snd_dbri_t * dbri, int pipe)
1776{
1777 dbri_streaminfo_t *info;
1778 int td;
1779 int status;
1780
1781 info = &dbri->stream_info[DBRI_PLAY];
1782
1783 td = dbri->pipes[pipe].desc;
1784 while (td >= 0) {
1785 if (td >= DBRI_NO_DESCS) {
1786 printk(KERN_ERR "DBRI: invalid td on pipe %d\n", pipe);
1787 return;
1788 }
1789
1790 status = DBRI_TD_STATUS(dbri->dma->desc[td].word4);
1791 if (!(status & DBRI_TD_TBC)) {
1792 break;
1793 }
1794
1795 dprintk(D_INT, "TD %d, status 0x%02x\n", td, status);
1796
1797 dbri->dma->desc[td].word4 = 0; /* Reset it for next time. */
1798 info->offset += dbri->descs[td].len;
1799 info->left -= dbri->descs[td].len;
1800
1801 /* On the last TD, transmit them all again. */
1802 if (dbri->descs[td].next == -1) {
1803 if (info->left > 0) {
1804 printk(KERN_WARNING
1805 "%d bytes left after last transfer.\n",
1806 info->left);
1807 info->left = 0;
1808 }
1809 tasklet_schedule(&xmit_descs_task);
1810 }
1811
1812 td = dbri->descs[td].next;
1813 dbri->pipes[pipe].desc = td;
1814 }
1815
1816 /* Notify ALSA */
1817 if (spin_is_locked(&dbri->lock)) {
1818 spin_unlock(&dbri->lock);
1819 snd_pcm_period_elapsed(info->substream);
1820 spin_lock(&dbri->lock);
1821 } else
1822 snd_pcm_period_elapsed(info->substream);
1823}
1824
1825static void reception_complete_intr(snd_dbri_t * dbri, int pipe)
1826{
1827 dbri_streaminfo_t *info;
1828 int rd = dbri->pipes[pipe].desc;
1829 s32 status;
1830
1831 if (rd < 0 || rd >= DBRI_NO_DESCS) {
1832 printk(KERN_ERR "DBRI: invalid rd on pipe %d\n", pipe);
1833 return;
1834 }
1835
1836 dbri->descs[rd].inuse = 0;
1837 dbri->pipes[pipe].desc = dbri->descs[rd].next;
1838 status = dbri->dma->desc[rd].word1;
1839 dbri->dma->desc[rd].word1 = 0; /* Reset it for next time. */
1840
1841 info = &dbri->stream_info[DBRI_REC];
1842 info->offset += DBRI_RD_CNT(status);
1843 info->left += DBRI_RD_CNT(status);
1844
1845 /* FIXME: Check status */
1846
1847 dprintk(D_INT, "Recv RD %d, status 0x%02x, len %d\n",
1848 rd, DBRI_RD_STATUS(status), DBRI_RD_CNT(status));
1849
1850 /* On the last TD, transmit them all again. */
1851 if (dbri->descs[rd].next == -1) {
1852 if (info->left > info->size) {
1853 printk(KERN_WARNING
1854 "%d bytes recorded in %d size buffer.\n",
1855 info->left, info->size);
1856 }
1857 tasklet_schedule(&xmit_descs_task);
1858 }
1859
1860 /* Notify ALSA */
1861 if (spin_is_locked(&dbri->lock)) {
1862 spin_unlock(&dbri->lock);
1863 snd_pcm_period_elapsed(info->substream);
1864 spin_lock(&dbri->lock);
1865 } else
1866 snd_pcm_period_elapsed(info->substream);
1867}
1868
1869static void dbri_process_one_interrupt(snd_dbri_t * dbri, int x)
1870{
1871 int val = D_INTR_GETVAL(x);
1872 int channel = D_INTR_GETCHAN(x);
1873 int command = D_INTR_GETCMD(x);
1874 int code = D_INTR_GETCODE(x);
1875#ifdef DBRI_DEBUG
1876 int rval = D_INTR_GETRVAL(x);
1877#endif
1878
1879 if (channel == D_INTR_CMD) {
1880 dprintk(D_CMD, "INTR: Command: %-5s Value:%d\n",
1881 cmds[command], val);
1882 } else {
1883 dprintk(D_INT, "INTR: Chan:%d Code:%d Val:%#x\n",
1884 channel, code, rval);
1885 }
1886
1887 if (channel == D_INTR_CMD && command == D_WAIT) {
1888 dbri->wait_seen++;
1889 return;
1890 }
1891
1892 switch (code) {
1893 case D_INTR_BRDY:
1894 reception_complete_intr(dbri, channel);
1895 break;
1896 case D_INTR_XCMP:
1897 case D_INTR_MINT:
1898 transmission_complete_intr(dbri, channel);
1899 break;
1900 case D_INTR_UNDR:
1901 /* UNDR - Transmission underrun
1902 * resend SDP command with clear pipe bit (C) set
1903 */
1904 {
1905 volatile s32 *cmd;
1906
1907 int pipe = channel;
1908 int td = dbri->pipes[pipe].desc;
1909
1910 dbri->dma->desc[td].word4 = 0;
1911 cmd = dbri_cmdlock(dbri, NoGetLock);
1912 *(cmd++) = DBRI_CMD(D_SDP, 0,
1913 dbri->pipes[pipe].sdp
1914 | D_SDP_P | D_SDP_C | D_SDP_2SAME);
1915 *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, td);
1916 dbri_cmdsend(dbri, cmd);
1917 }
1918 break;
1919 case D_INTR_FXDT:
1920 /* FXDT - Fixed data change */
1921 if (dbri->pipes[channel].sdp & D_SDP_MSB)
1922 val = reverse_bytes(val, dbri->pipes[channel].length);
1923
1924 if (dbri->pipes[channel].recv_fixed_ptr)
1925 *(dbri->pipes[channel].recv_fixed_ptr) = val;
1926 break;
1927 default:
1928 if (channel != D_INTR_CMD)
1929 printk(KERN_WARNING
1930 "DBRI: Ignored Interrupt: %d (0x%x)\n", code, x);
1931 }
1932}
1933
1934/* dbri_process_interrupt_buffer advances through the DBRI's interrupt
1935 * buffer until it finds a zero word (indicating nothing more to do
1936 * right now). Non-zero words require processing and are handed off
1937 * to dbri_process_one_interrupt AFTER advancing the pointer. This
1938 * order is important since we might recurse back into this function
1939 * and need to make sure the pointer has been advanced first.
1940 */
1941static void dbri_process_interrupt_buffer(snd_dbri_t * dbri)
1942{
1943 s32 x;
1944
1945 while ((x = dbri->dma->intr[dbri->dbri_irqp]) != 0) {
1946 dbri->dma->intr[dbri->dbri_irqp] = 0;
1947 dbri->dbri_irqp++;
1948 if (dbri->dbri_irqp == (DBRI_NO_INTS * DBRI_INT_BLK))
1949 dbri->dbri_irqp = 1;
1950 else if ((dbri->dbri_irqp & (DBRI_INT_BLK - 1)) == 0)
1951 dbri->dbri_irqp++;
1952
1953 dbri_process_one_interrupt(dbri, x);
1954 }
1955}
1956
1957static irqreturn_t snd_dbri_interrupt(int irq, void *dev_id,
1958 struct pt_regs *regs)
1959{
1960 snd_dbri_t *dbri = dev_id;
1961 static int errcnt = 0;
1962 int x;
1963
1964 if (dbri == NULL)
1965 return IRQ_NONE;
1966 spin_lock(&dbri->lock);
1967
1968 /*
1969 * Read it, so the interrupt goes away.
1970 */
1971 x = sbus_readl(dbri->regs + REG1);
1972
1973 if (x & (D_MRR | D_MLE | D_LBG | D_MBE)) {
1974 u32 tmp;
1975
1976 if (x & D_MRR)
1977 printk(KERN_ERR
1978 "DBRI: Multiple Error Ack on SBus reg1=0x%x\n",
1979 x);
1980 if (x & D_MLE)
1981 printk(KERN_ERR
1982 "DBRI: Multiple Late Error on SBus reg1=0x%x\n",
1983 x);
1984 if (x & D_LBG)
1985 printk(KERN_ERR
1986 "DBRI: Lost Bus Grant on SBus reg1=0x%x\n", x);
1987 if (x & D_MBE)
1988 printk(KERN_ERR
1989 "DBRI: Burst Error on SBus reg1=0x%x\n", x);
1990
1991 /* Some of these SBus errors cause the chip's SBus circuitry
1992 * to be disabled, so just re-enable and try to keep going.
1993 *
1994 * The only one I've seen is MRR, which will be triggered
1995 * if you let a transmit pipe underrun, then try to CDP it.
1996 *
1997 * If these things persist, we should probably reset
1998 * and re-init the chip.
1999 */
2000 if ((++errcnt) % 10 == 0) {
2001 dprintk(D_INT, "Interrupt errors exceeded.\n");
2002 dbri_reset(dbri);
2003 } else {
2004 tmp = sbus_readl(dbri->regs + REG0);
2005 tmp &= ~(D_D);
2006 sbus_writel(tmp, dbri->regs + REG0);
2007 }
2008 }
2009
2010 dbri_process_interrupt_buffer(dbri);
2011
2012 /* FIXME: Write 0 into regs to ACK interrupt */
2013
2014 spin_unlock(&dbri->lock);
2015
2016 return IRQ_HANDLED;
2017}
2018
2019/****************************************************************************
2020 PCM Interface
2021****************************************************************************/
2022static snd_pcm_hardware_t snd_dbri_pcm_hw = {
2023 .info = (SNDRV_PCM_INFO_MMAP |
2024 SNDRV_PCM_INFO_INTERLEAVED |
2025 SNDRV_PCM_INFO_BLOCK_TRANSFER |
2026 SNDRV_PCM_INFO_MMAP_VALID),
2027 .formats = SNDRV_PCM_FMTBIT_MU_LAW |
2028 SNDRV_PCM_FMTBIT_A_LAW |
2029 SNDRV_PCM_FMTBIT_U8 |
2030 SNDRV_PCM_FMTBIT_S16_BE,
2031 .rates = SNDRV_PCM_RATE_8000_48000,
2032 .rate_min = 8000,
2033 .rate_max = 48000,
2034 .channels_min = 1,
2035 .channels_max = 2,
2036 .buffer_bytes_max = (64 * 1024),
2037 .period_bytes_min = 1,
2038 .period_bytes_max = DBRI_TD_MAXCNT,
2039 .periods_min = 1,
2040 .periods_max = 1024,
2041};
2042
2043static int snd_dbri_open(snd_pcm_substream_t * substream)
2044{
2045 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2046 snd_pcm_runtime_t *runtime = substream->runtime;
2047 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2048 unsigned long flags;
2049
2050 dprintk(D_USR, "open audio output.\n");
2051 runtime->hw = snd_dbri_pcm_hw;
2052
2053 spin_lock_irqsave(&dbri->lock, flags);
2054 info->substream = substream;
2055 info->left = 0;
2056 info->offset = 0;
2057 info->dvma_buffer = 0;
2058 info->pipe = -1;
2059 spin_unlock_irqrestore(&dbri->lock, flags);
2060
2061 cs4215_open(dbri);
2062
2063 return 0;
2064}
2065
2066static int snd_dbri_close(snd_pcm_substream_t * substream)
2067{
2068 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2069 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2070
2071 dprintk(D_USR, "close audio output.\n");
2072 info->substream = NULL;
2073 info->left = 0;
2074 info->offset = 0;
2075
2076 return 0;
2077}
2078
2079static int snd_dbri_hw_params(snd_pcm_substream_t * substream,
2080 snd_pcm_hw_params_t * hw_params)
2081{
2082 snd_pcm_runtime_t *runtime = substream->runtime;
2083 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2084 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2085 int direction;
2086 int ret;
2087
2088 /* set sampling rate, audio format and number of channels */
2089 ret = cs4215_prepare(dbri, params_rate(hw_params),
2090 params_format(hw_params),
2091 params_channels(hw_params));
2092 if (ret != 0)
2093 return ret;
2094
2095 if ((ret = snd_pcm_lib_malloc_pages(substream,
2096 params_buffer_bytes(hw_params))) < 0) {
2097 snd_printk(KERN_ERR "malloc_pages failed with %d\n", ret);
2098 return ret;
2099 }
2100
2101 /* hw_params can get called multiple times. Only map the DMA once.
2102 */
2103 if (info->dvma_buffer == 0) {
2104 if (DBRI_STREAMNO(substream) == DBRI_PLAY)
2105 direction = SBUS_DMA_TODEVICE;
2106 else
2107 direction = SBUS_DMA_FROMDEVICE;
2108
2109 info->dvma_buffer = sbus_map_single(dbri->sdev,
2110 runtime->dma_area,
2111 params_buffer_bytes(hw_params),
2112 direction);
2113 }
2114
2115 direction = params_buffer_bytes(hw_params);
2116 dprintk(D_USR, "hw_params: %d bytes, dvma=%x\n",
2117 direction, info->dvma_buffer);
2118 return 0;
2119}
2120
2121static int snd_dbri_hw_free(snd_pcm_substream_t * substream)
2122{
2123 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2124 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2125 int direction;
2126 dprintk(D_USR, "hw_free.\n");
2127
2128 /* hw_free can get called multiple times. Only unmap the DMA once.
2129 */
2130 if (info->dvma_buffer) {
2131 if (DBRI_STREAMNO(substream) == DBRI_PLAY)
2132 direction = SBUS_DMA_TODEVICE;
2133 else
2134 direction = SBUS_DMA_FROMDEVICE;
2135
2136 sbus_unmap_single(dbri->sdev, info->dvma_buffer,
2137 substream->runtime->buffer_size, direction);
2138 info->dvma_buffer = 0;
2139 }
2140 info->pipe = -1;
2141
2142 return snd_pcm_lib_free_pages(substream);
2143}
2144
2145static int snd_dbri_prepare(snd_pcm_substream_t * substream)
2146{
2147 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2148 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2149 snd_pcm_runtime_t *runtime = substream->runtime;
2150 int ret;
2151
2152 info->size = snd_pcm_lib_buffer_bytes(substream);
2153 if (DBRI_STREAMNO(substream) == DBRI_PLAY)
2154 info->pipe = 4; /* Send pipe */
2155 else {
2156 info->pipe = 6; /* Receive pipe */
2157 info->left = info->size; /* To trigger submittal */
2158 }
2159
2160 spin_lock_irq(&dbri->lock);
2161
2162 /* Setup the all the transmit/receive desciptors to cover the
2163 * whole DMA buffer.
2164 */
2165 ret = setup_descs(dbri, DBRI_STREAMNO(substream),
2166 snd_pcm_lib_period_bytes(substream));
2167
2168 runtime->stop_threshold = DBRI_TD_MAXCNT / runtime->channels;
2169
2170 spin_unlock_irq(&dbri->lock);
2171
2172 dprintk(D_USR, "prepare audio output. %d bytes\n", info->size);
2173 return ret;
2174}
2175
2176static int snd_dbri_trigger(snd_pcm_substream_t * substream, int cmd)
2177{
2178 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2179 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2180 int ret = 0;
2181
2182 switch (cmd) {
2183 case SNDRV_PCM_TRIGGER_START:
2184 dprintk(D_USR, "start audio, period is %d bytes\n",
2185 (int)snd_pcm_lib_period_bytes(substream));
2186 /* Enable & schedule the tasklet that re-submits the TDs. */
2187 xmit_descs_task.data = (unsigned long)dbri;
2188 tasklet_schedule(&xmit_descs_task);
2189 break;
2190 case SNDRV_PCM_TRIGGER_STOP:
2191 dprintk(D_USR, "stop audio.\n");
2192 /* Make the tasklet bail out immediately. */
2193 xmit_descs_task.data = 0;
2194 reset_pipe(dbri, info->pipe);
2195 break;
2196 default:
2197 ret = -EINVAL;
2198 }
2199
2200 return ret;
2201}
2202
2203static snd_pcm_uframes_t snd_dbri_pointer(snd_pcm_substream_t * substream)
2204{
2205 snd_dbri_t *dbri = snd_pcm_substream_chip(substream);
2206 dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream);
2207 snd_pcm_uframes_t ret;
2208
2209 ret = bytes_to_frames(substream->runtime, info->offset)
2210 % substream->runtime->buffer_size;
2211 dprintk(D_USR, "I/O pointer: %ld frames, %d bytes left.\n",
2212 ret, info->left);
2213 return ret;
2214}
2215
2216static snd_pcm_ops_t snd_dbri_ops = {
2217 .open = snd_dbri_open,
2218 .close = snd_dbri_close,
2219 .ioctl = snd_pcm_lib_ioctl,
2220 .hw_params = snd_dbri_hw_params,
2221 .hw_free = snd_dbri_hw_free,
2222 .prepare = snd_dbri_prepare,
2223 .trigger = snd_dbri_trigger,
2224 .pointer = snd_dbri_pointer,
2225};
2226
2227static int __devinit snd_dbri_pcm(snd_dbri_t * dbri)
2228{
2229 snd_pcm_t *pcm;
2230 int err;
2231
2232 if ((err = snd_pcm_new(dbri->card,
2233 /* ID */ "sun_dbri",
2234 /* device */ 0,
2235 /* playback count */ 1,
2236 /* capture count */ 1, &pcm)) < 0)
2237 return err;
2238 snd_assert(pcm != NULL, return -EINVAL);
2239
2240 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_dbri_ops);
2241 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_dbri_ops);
2242
2243 pcm->private_data = dbri;
2244 pcm->info_flags = 0;
2245 strcpy(pcm->name, dbri->card->shortname);
2246 dbri->pcm = pcm;
2247
2248 if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm,
2249 SNDRV_DMA_TYPE_CONTINUOUS,
2250 snd_dma_continuous_data(GFP_KERNEL),
2251 64 * 1024, 64 * 1024)) < 0) {
2252 return err;
2253 }
2254
2255 return 0;
2256}
2257
2258/*****************************************************************************
2259 Mixer interface
2260*****************************************************************************/
2261
2262static int snd_cs4215_info_volume(snd_kcontrol_t * kcontrol,
2263 snd_ctl_elem_info_t * uinfo)
2264{
2265 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2266 uinfo->count = 2;
2267 uinfo->value.integer.min = 0;
2268 if (kcontrol->private_value == DBRI_PLAY) {
2269 uinfo->value.integer.max = DBRI_MAX_VOLUME;
2270 } else {
2271 uinfo->value.integer.max = DBRI_MAX_GAIN;
2272 }
2273 return 0;
2274}
2275
2276static int snd_cs4215_get_volume(snd_kcontrol_t * kcontrol,
2277 snd_ctl_elem_value_t * ucontrol)
2278{
2279 snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol);
2280 dbri_streaminfo_t *info;
2281 snd_assert(dbri != NULL, return -EINVAL);
2282 info = &dbri->stream_info[kcontrol->private_value];
2283 snd_assert(info != NULL, return -EINVAL);
2284
2285 ucontrol->value.integer.value[0] = info->left_gain;
2286 ucontrol->value.integer.value[1] = info->right_gain;
2287 return 0;
2288}
2289
2290static int snd_cs4215_put_volume(snd_kcontrol_t * kcontrol,
2291 snd_ctl_elem_value_t * ucontrol)
2292{
2293 snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol);
2294 dbri_streaminfo_t *info = &dbri->stream_info[kcontrol->private_value];
2295 unsigned long flags;
2296 int changed = 0;
2297
2298 if (info->left_gain != ucontrol->value.integer.value[0]) {
2299 info->left_gain = ucontrol->value.integer.value[0];
2300 changed = 1;
2301 }
2302 if (info->right_gain != ucontrol->value.integer.value[1]) {
2303 info->right_gain = ucontrol->value.integer.value[1];
2304 changed = 1;
2305 }
2306 if (changed == 1) {
2307 /* First mute outputs, and wait 1/8000 sec (125 us)
2308 * to make sure this takes. This avoids clicking noises.
2309 */
2310 spin_lock_irqsave(&dbri->lock, flags);
2311
2312 cs4215_setdata(dbri, 1);
2313 udelay(125);
2314 cs4215_setdata(dbri, 0);
2315
2316 spin_unlock_irqrestore(&dbri->lock, flags);
2317 }
2318 return changed;
2319}
2320
2321static int snd_cs4215_info_single(snd_kcontrol_t * kcontrol,
2322 snd_ctl_elem_info_t * uinfo)
2323{
2324 int mask = (kcontrol->private_value >> 16) & 0xff;
2325
2326 uinfo->type = (mask == 1) ?
2327 SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;
2328 uinfo->count = 1;
2329 uinfo->value.integer.min = 0;
2330 uinfo->value.integer.max = mask;
2331 return 0;
2332}
2333
2334static int snd_cs4215_get_single(snd_kcontrol_t * kcontrol,
2335 snd_ctl_elem_value_t * ucontrol)
2336{
2337 snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol);
2338 int elem = kcontrol->private_value & 0xff;
2339 int shift = (kcontrol->private_value >> 8) & 0xff;
2340 int mask = (kcontrol->private_value >> 16) & 0xff;
2341 int invert = (kcontrol->private_value >> 24) & 1;
2342 snd_assert(dbri != NULL, return -EINVAL);
2343
2344 if (elem < 4) {
2345 ucontrol->value.integer.value[0] =
2346 (dbri->mm.data[elem] >> shift) & mask;
2347 } else {
2348 ucontrol->value.integer.value[0] =
2349 (dbri->mm.ctrl[elem - 4] >> shift) & mask;
2350 }
2351
2352 if (invert == 1) {
2353 ucontrol->value.integer.value[0] =
2354 mask - ucontrol->value.integer.value[0];
2355 }
2356 return 0;
2357}
2358
2359static int snd_cs4215_put_single(snd_kcontrol_t * kcontrol,
2360 snd_ctl_elem_value_t * ucontrol)
2361{
2362 snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol);
2363 unsigned long flags;
2364 int elem = kcontrol->private_value & 0xff;
2365 int shift = (kcontrol->private_value >> 8) & 0xff;
2366 int mask = (kcontrol->private_value >> 16) & 0xff;
2367 int invert = (kcontrol->private_value >> 24) & 1;
2368 int changed = 0;
2369 unsigned short val;
2370 snd_assert(dbri != NULL, return -EINVAL);
2371
2372 val = (ucontrol->value.integer.value[0] & mask);
2373 if (invert == 1)
2374 val = mask - val;
2375 val <<= shift;
2376
2377 if (elem < 4) {
2378 dbri->mm.data[elem] = (dbri->mm.data[elem] &
2379 ~(mask << shift)) | val;
2380 changed = (val != dbri->mm.data[elem]);
2381 } else {
2382 dbri->mm.ctrl[elem - 4] = (dbri->mm.ctrl[elem - 4] &
2383 ~(mask << shift)) | val;
2384 changed = (val != dbri->mm.ctrl[elem - 4]);
2385 }
2386
2387 dprintk(D_GEN, "put_single: mask=0x%x, changed=%d, "
2388 "mixer-value=%ld, mm-value=0x%x\n",
2389 mask, changed, ucontrol->value.integer.value[0],
2390 dbri->mm.data[elem & 3]);
2391
2392 if (changed) {
2393 /* First mute outputs, and wait 1/8000 sec (125 us)
2394 * to make sure this takes. This avoids clicking noises.
2395 */
2396 spin_lock_irqsave(&dbri->lock, flags);
2397
2398 cs4215_setdata(dbri, 1);
2399 udelay(125);
2400 cs4215_setdata(dbri, 0);
2401
2402 spin_unlock_irqrestore(&dbri->lock, flags);
2403 }
2404 return changed;
2405}
2406
2407/* Entries 0-3 map to the 4 data timeslots, entries 4-7 map to the 4 control
2408 timeslots. Shift is the bit offset in the timeslot, mask defines the
2409 number of bits. invert is a boolean for use with attenuation.
2410 */
2411#define CS4215_SINGLE(xname, entry, shift, mask, invert) \
2412{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
2413 .info = snd_cs4215_info_single, \
2414 .get = snd_cs4215_get_single, .put = snd_cs4215_put_single, \
2415 .private_value = entry | (shift << 8) | (mask << 16) | (invert << 24) },
2416
2417static snd_kcontrol_new_t dbri_controls[] __devinitdata = {
2418 {
2419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2420 .name = "Playback Volume",
2421 .info = snd_cs4215_info_volume,
2422 .get = snd_cs4215_get_volume,
2423 .put = snd_cs4215_put_volume,
2424 .private_value = DBRI_PLAY,
2425 },
2426 CS4215_SINGLE("Headphone switch", 0, 7, 1, 0)
2427 CS4215_SINGLE("Line out switch", 0, 6, 1, 0)
2428 CS4215_SINGLE("Speaker switch", 1, 6, 1, 0)
2429 {
2430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2431 .name = "Capture Volume",
2432 .info = snd_cs4215_info_volume,
2433 .get = snd_cs4215_get_volume,
2434 .put = snd_cs4215_put_volume,
2435 .private_value = DBRI_REC,
2436 },
2437 /* FIXME: mic/line switch */
2438 CS4215_SINGLE("Line in switch", 2, 4, 1, 0)
2439 CS4215_SINGLE("High Pass Filter switch", 5, 7, 1, 0)
2440 CS4215_SINGLE("Monitor Volume", 3, 4, 0xf, 1)
2441 CS4215_SINGLE("Mic boost", 4, 4, 1, 1)
2442};
2443
2444#define NUM_CS4215_CONTROLS (sizeof(dbri_controls)/sizeof(snd_kcontrol_new_t))
2445
2446static int __init snd_dbri_mixer(snd_dbri_t * dbri)
2447{
2448 snd_card_t *card;
2449 int idx, err;
2450
2451 snd_assert(dbri != NULL && dbri->card != NULL, return -EINVAL);
2452
2453 card = dbri->card;
2454 strcpy(card->mixername, card->shortname);
2455
2456 for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) {
2457 if ((err = snd_ctl_add(card,
2458 snd_ctl_new1(&dbri_controls[idx],
2459 dbri))) < 0)
2460 return err;
2461 }
2462
2463 for (idx = DBRI_REC; idx < DBRI_NO_STREAMS; idx++) {
2464 dbri->stream_info[idx].left_gain = 0;
2465 dbri->stream_info[idx].right_gain = 0;
2466 dbri->stream_info[idx].balance = DBRI_MID_BALANCE;
2467 }
2468
2469 return 0;
2470}
2471
2472/****************************************************************************
2473 /proc interface
2474****************************************************************************/
2475static void dbri_regs_read(snd_info_entry_t * entry, snd_info_buffer_t * buffer)
2476{
2477 snd_dbri_t *dbri = entry->private_data;
2478
2479 snd_iprintf(buffer, "REG0: 0x%x\n", sbus_readl(dbri->regs + REG0));
2480 snd_iprintf(buffer, "REG2: 0x%x\n", sbus_readl(dbri->regs + REG2));
2481 snd_iprintf(buffer, "REG8: 0x%x\n", sbus_readl(dbri->regs + REG8));
2482 snd_iprintf(buffer, "REG9: 0x%x\n", sbus_readl(dbri->regs + REG9));
2483}
2484
2485#ifdef DBRI_DEBUG
2486static void dbri_debug_read(snd_info_entry_t * entry,
2487 snd_info_buffer_t * buffer)
2488{
2489 snd_dbri_t *dbri = entry->private_data;
2490 int pipe;
2491 snd_iprintf(buffer, "debug=%d\n", dbri_debug);
2492
2493 snd_iprintf(buffer, "CHI pipe in=%d, out=%d\n",
2494 dbri->chi_in_pipe, dbri->chi_out_pipe);
2495 for (pipe = 0; pipe < 32; pipe++) {
2496 if (pipe_active(dbri, pipe)) {
2497 struct dbri_pipe *pptr = &dbri->pipes[pipe];
2498 snd_iprintf(buffer,
2499 "Pipe %d: %s SDP=0x%x desc=%d, "
2500 "len=%d @ %d prev: %d next %d\n",
2501 pipe,
2502 (pptr->direction ==
2503 PIPEinput ? "input" : "output"), pptr->sdp,
2504 pptr->desc, pptr->length, pptr->cycle,
2505 pptr->prevpipe, pptr->nextpipe);
2506 }
2507 }
2508}
2509
2510static void dbri_debug_write(snd_info_entry_t * entry,
2511 snd_info_buffer_t * buffer)
2512{
2513 char line[80];
2514 int i;
2515
2516 if (snd_info_get_line(buffer, line, 80) == 0) {
2517 sscanf(line, "%d\n", &i);
2518 dbri_debug = i & 0x3f;
2519 }
2520}
2521#endif
2522
2523void snd_dbri_proc(snd_dbri_t * dbri)
2524{
2525 snd_info_entry_t *entry;
2526 int err;
2527
2528 err = snd_card_proc_new(dbri->card, "regs", &entry);
2529 snd_info_set_text_ops(entry, dbri, 1024, dbri_regs_read);
2530
2531#ifdef DBRI_DEBUG
2532 err = snd_card_proc_new(dbri->card, "debug", &entry);
2533 snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read);
2534 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */
2535 entry->c.text.write_size = 256;
2536 entry->c.text.write = dbri_debug_write;
2537#endif
2538}
2539
2540/*
2541****************************************************************************
2542**************************** Initialization ********************************
2543****************************************************************************
2544*/
2545static void snd_dbri_free(snd_dbri_t * dbri);
2546
2547static int __init snd_dbri_create(snd_card_t * card,
2548 struct sbus_dev *sdev,
2549 struct linux_prom_irqs *irq, int dev)
2550{
2551 snd_dbri_t *dbri = card->private_data;
2552 int err;
2553
2554 spin_lock_init(&dbri->lock);
2555 dbri->card = card;
2556 dbri->sdev = sdev;
2557 dbri->irq = irq->pri;
2558 dbri->dbri_version = sdev->prom_name[9];
2559
2560 dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma),
2561 &dbri->dma_dvma);
2562 memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));
2563
2564 dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",
2565 dbri->dma, dbri->dma_dvma);
2566
2567 /* Map the registers into memory. */
2568 dbri->regs_size = sdev->reg_addrs[0].reg_size;
2569 dbri->regs = sbus_ioremap(&sdev->resource[0], 0,
2570 dbri->regs_size, "DBRI Registers");
2571 if (!dbri->regs) {
2572 printk(KERN_ERR "DBRI: could not allocate registers\n");
2573 sbus_free_consistent(sdev, sizeof(struct dbri_dma),
2574 (void *)dbri->dma, dbri->dma_dvma);
2575 return -EIO;
2576 }
2577
2578 err = request_irq(dbri->irq, snd_dbri_interrupt, SA_SHIRQ,
2579 "DBRI audio", dbri);
2580 if (err) {
2581 printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq);
2582 sbus_iounmap(dbri->regs, dbri->regs_size);
2583 sbus_free_consistent(sdev, sizeof(struct dbri_dma),
2584 (void *)dbri->dma, dbri->dma_dvma);
2585 return err;
2586 }
2587
2588 /* Do low level initialization of the DBRI and CS4215 chips */
2589 dbri_initialize(dbri);
2590 err = cs4215_init(dbri);
2591 if (err) {
2592 snd_dbri_free(dbri);
2593 return err;
2594 }
2595
2596 dbri->next = dbri_list;
2597 dbri_list = dbri;
2598
2599 return 0;
2600}
2601
2602static void snd_dbri_free(snd_dbri_t * dbri)
2603{
2604 dprintk(D_GEN, "snd_dbri_free\n");
2605 dbri_reset(dbri);
2606
2607 if (dbri->irq)
2608 free_irq(dbri->irq, dbri);
2609
2610 if (dbri->regs)
2611 sbus_iounmap(dbri->regs, dbri->regs_size);
2612
2613 if (dbri->dma)
2614 sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma),
2615 (void *)dbri->dma, dbri->dma_dvma);
2616}
2617
2618static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
2619{
2620 snd_dbri_t *dbri;
2621 struct linux_prom_irqs irq;
2622 struct resource *rp;
2623 snd_card_t *card;
2624 static int dev = 0;
2625 int err;
2626
2627 if (sdev->prom_name[9] < 'e') {
2628 printk(KERN_ERR "DBRI: unsupported chip version %c found.\n",
2629 sdev->prom_name[9]);
2630 return -EIO;
2631 }
2632
2633 if (dev >= SNDRV_CARDS)
2634 return -ENODEV;
2635 if (!enable[dev]) {
2636 dev++;
2637 return -ENOENT;
2638 }
2639
2640 prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
2641
2642 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
2643 sizeof(snd_dbri_t));
2644 if (card == NULL)
2645 return -ENOMEM;
2646
2647 strcpy(card->driver, "DBRI");
2648 strcpy(card->shortname, "Sun DBRI");
2649 rp = &sdev->resource[0];
2650 sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
2651 card->shortname,
2652 rp->flags & 0xffL, rp->start, __irq_itoa(irq.pri));
2653
2654 if ((err = snd_dbri_create(card, sdev, &irq, dev)) < 0) {
2655 snd_card_free(card);
2656 return err;
2657 }
2658
2659 dbri = (snd_dbri_t *) card->private_data;
2660 if ((err = snd_dbri_pcm(dbri)) < 0) {
2661 snd_dbri_free(dbri);
2662 snd_card_free(card);
2663 return err;
2664 }
2665
2666 if ((err = snd_dbri_mixer(dbri)) < 0) {
2667 snd_dbri_free(dbri);
2668 snd_card_free(card);
2669 return err;
2670 }
2671
2672 /* /proc file handling */
2673 snd_dbri_proc(dbri);
2674
2675 if ((err = snd_card_register(card)) < 0) {
2676 snd_dbri_free(dbri);
2677 snd_card_free(card);
2678 return err;
2679 }
2680
2681 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
2682 dev, dbri->regs,
2683 dbri->irq, dbri->dbri_version, dbri->mm.version);
2684 dev++;
2685
2686 return 0;
2687}
2688
2689/* Probe for the dbri chip and then attach the driver. */
2690static int __init dbri_init(void)
2691{
2692 struct sbus_bus *sbus;
2693 struct sbus_dev *sdev;
2694 int found = 0;
2695
2696 /* Probe each SBUS for the DBRI chip(s). */
2697 for_all_sbusdev(sdev, sbus) {
2698 /*
2699 * The version is coded in the last character
2700 */
2701 if (!strncmp(sdev->prom_name, "SUNW,DBRI", 9)) {
2702 dprintk(D_GEN, "DBRI: Found %s in SBUS slot %d\n",
2703 sdev->prom_name, sdev->slot);
2704
2705 if (dbri_attach(sdev->prom_node, sdev) == 0)
2706 found++;
2707 }
2708 }
2709
2710 return (found > 0) ? 0 : -EIO;
2711}
2712
2713static void __exit dbri_exit(void)
2714{
2715 snd_dbri_t *this = dbri_list;
2716
2717 while (this != NULL) {
2718 snd_dbri_t *next = this->next;
2719 snd_card_t *card = this->card;
2720
2721 snd_dbri_free(this);
2722 snd_card_free(card);
2723 this = next;
2724 }
2725 dbri_list = NULL;
2726}
2727
2728module_init(dbri_init);
2729module_exit(dbri_exit);
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index a75695045f29..8298c462c291 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -153,6 +153,7 @@ struct snd_usb_substream {
153 unsigned int format; /* USB data format */ 153 unsigned int format; /* USB data format */
154 unsigned int datapipe; /* the data i/o pipe */ 154 unsigned int datapipe; /* the data i/o pipe */
155 unsigned int syncpipe; /* 1 - async out or adaptive in */ 155 unsigned int syncpipe; /* 1 - async out or adaptive in */
156 unsigned int datainterval; /* log_2 of data packet interval */
156 unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */ 157 unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */
157 unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ 158 unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */
158 unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ 159 unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */
@@ -212,7 +213,7 @@ static snd_usb_audio_t *usb_chip[SNDRV_CARDS];
212 * convert a sampling rate into our full speed format (fs/1000 in Q16.16) 213 * convert a sampling rate into our full speed format (fs/1000 in Q16.16)
213 * this will overflow at approx 524 kHz 214 * this will overflow at approx 524 kHz
214 */ 215 */
215inline static unsigned get_usb_full_speed_rate(unsigned int rate) 216static inline unsigned get_usb_full_speed_rate(unsigned int rate)
216{ 217{
217 return ((rate << 13) + 62) / 125; 218 return ((rate << 13) + 62) / 125;
218} 219}
@@ -221,19 +222,19 @@ inline static unsigned get_usb_full_speed_rate(unsigned int rate)
221 * convert a sampling rate into USB high speed format (fs/8000 in Q16.16) 222 * convert a sampling rate into USB high speed format (fs/8000 in Q16.16)
222 * this will overflow at approx 4 MHz 223 * this will overflow at approx 4 MHz
223 */ 224 */
224inline static unsigned get_usb_high_speed_rate(unsigned int rate) 225static inline unsigned get_usb_high_speed_rate(unsigned int rate)
225{ 226{
226 return ((rate << 10) + 62) / 125; 227 return ((rate << 10) + 62) / 125;
227} 228}
228 229
229/* convert our full speed USB rate into sampling rate in Hz */ 230/* convert our full speed USB rate into sampling rate in Hz */
230inline static unsigned get_full_speed_hz(unsigned int usb_rate) 231static inline unsigned get_full_speed_hz(unsigned int usb_rate)
231{ 232{
232 return (usb_rate * 125 + (1 << 12)) >> 13; 233 return (usb_rate * 125 + (1 << 12)) >> 13;
233} 234}
234 235
235/* convert our high speed USB rate into sampling rate in Hz */ 236/* convert our high speed USB rate into sampling rate in Hz */
236inline static unsigned get_high_speed_hz(unsigned int usb_rate) 237static inline unsigned get_high_speed_hz(unsigned int usb_rate)
237{ 238{
238 return (usb_rate * 125 + (1 << 9)) >> 10; 239 return (usb_rate * 125 + (1 << 9)) >> 10;
239} 240}
@@ -518,7 +519,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs,
518 if (subs->fill_max) 519 if (subs->fill_max)
519 counts = subs->maxframesize; /* fixed */ 520 counts = subs->maxframesize; /* fixed */
520 else { 521 else {
521 subs->phase = (subs->phase & 0xffff) + subs->freqm; 522 subs->phase = (subs->phase & 0xffff)
523 + (subs->freqm << subs->datainterval);
522 counts = subs->phase >> 16; 524 counts = subs->phase >> 16;
523 if (counts > subs->maxframesize) 525 if (counts > subs->maxframesize)
524 counts = subs->maxframesize; 526 counts = subs->maxframesize;
@@ -790,7 +792,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
790 */ 792 */
791static int wait_clear_urbs(snd_usb_substream_t *subs) 793static int wait_clear_urbs(snd_usb_substream_t *subs)
792{ 794{
793 int timeout = HZ; 795 unsigned long end_time = jiffies + msecs_to_jiffies(1000);
794 unsigned int i; 796 unsigned int i;
795 int alive; 797 int alive;
796 798
@@ -810,7 +812,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
810 break; 812 break;
811 set_current_state(TASK_UNINTERRUPTIBLE); 813 set_current_state(TASK_UNINTERRUPTIBLE);
812 schedule_timeout(1); 814 schedule_timeout(1);
813 } while (--timeout > 0); 815 } while (time_before(jiffies, end_time));
814 if (alive) 816 if (alive)
815 snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); 817 snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive);
816 return 0; 818 return 0;
@@ -899,16 +901,19 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
899 else 901 else
900 subs->freqn = get_usb_high_speed_rate(rate); 902 subs->freqn = get_usb_high_speed_rate(rate);
901 subs->freqm = subs->freqn; 903 subs->freqm = subs->freqn;
902 subs->freqmax = subs->freqn + (subs->freqn >> 2); /* max. allowed frequency */ 904 /* calculate max. frequency */
903 subs->phase = 0; 905 if (subs->maxpacksize) {
904 906 /* whatever fits into a max. size packet */
905 /* calculate the max. size of packet */
906 maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16;
907 if (subs->maxpacksize && maxsize > subs->maxpacksize) {
908 //snd_printd(KERN_DEBUG "maxsize %d is greater than defined size %d\n",
909 // maxsize, subs->maxpacksize);
910 maxsize = subs->maxpacksize; 907 maxsize = subs->maxpacksize;
908 subs->freqmax = (maxsize / (frame_bits >> 3))
909 << (16 - subs->datainterval);
910 } else {
911 /* no max. packet size: just take 25% higher than nominal */
912 subs->freqmax = subs->freqn + (subs->freqn >> 2);
913 maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3))
914 >> (16 - subs->datainterval);
911 } 915 }
916 subs->phase = 0;
912 917
913 if (subs->fill_max) 918 if (subs->fill_max)
914 subs->curpacksize = subs->maxpacksize; 919 subs->curpacksize = subs->maxpacksize;
@@ -918,7 +923,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
918 if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) 923 if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
919 urb_packs = nrpacks; 924 urb_packs = nrpacks;
920 else 925 else
921 urb_packs = nrpacks * 8; 926 urb_packs = (nrpacks * 8) >> subs->datainterval;
922 927
923 /* allocate a temporary buffer for playback */ 928 /* allocate a temporary buffer for playback */
924 if (is_playback) { 929 if (is_playback) {
@@ -991,7 +996,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
991 u->urb->pipe = subs->datapipe; 996 u->urb->pipe = subs->datapipe;
992 u->urb->transfer_flags = URB_ISO_ASAP; 997 u->urb->transfer_flags = URB_ISO_ASAP;
993 u->urb->number_of_packets = u->packets; 998 u->urb->number_of_packets = u->packets;
994 u->urb->interval = 1; 999 u->urb->interval = 1 << subs->datainterval;
995 u->urb->context = u; 1000 u->urb->context = u;
996 u->urb->complete = snd_usb_complete_callback(snd_complete_urb); 1001 u->urb->complete = snd_usb_complete_callback(snd_complete_urb);
997 } 1002 }
@@ -1195,6 +1200,12 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
1195 subs->datapipe = usb_sndisocpipe(dev, ep); 1200 subs->datapipe = usb_sndisocpipe(dev, ep);
1196 else 1201 else
1197 subs->datapipe = usb_rcvisocpipe(dev, ep); 1202 subs->datapipe = usb_rcvisocpipe(dev, ep);
1203 if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH &&
1204 get_endpoint(alts, 0)->bInterval >= 1 &&
1205 get_endpoint(alts, 0)->bInterval <= 4)
1206 subs->datainterval = get_endpoint(alts, 0)->bInterval - 1;
1207 else
1208 subs->datainterval = 0;
1198 subs->syncpipe = subs->syncinterval = 0; 1209 subs->syncpipe = subs->syncinterval = 0;
1199 subs->maxpacksize = fmt->maxpacksize; 1210 subs->maxpacksize = fmt->maxpacksize;
1200 subs->fill_max = 0; 1211 subs->fill_max = 0;
@@ -2397,10 +2408,9 @@ static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp,
2397 if (chip->usb_id == USB_ID(0x041e, 0x3000) || 2408 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||
2398 chip->usb_id == USB_ID(0x041e, 0x3020)) { 2409 chip->usb_id == USB_ID(0x041e, 0x3020)) {
2399 if (fmt[3] == USB_FORMAT_TYPE_I && 2410 if (fmt[3] == USB_FORMAT_TYPE_I &&
2400 stream == SNDRV_PCM_STREAM_PLAYBACK &&
2401 fp->rates != SNDRV_PCM_RATE_48000 && 2411 fp->rates != SNDRV_PCM_RATE_48000 &&
2402 fp->rates != SNDRV_PCM_RATE_96000) 2412 fp->rates != SNDRV_PCM_RATE_96000)
2403 return -1; /* use 48k only */ 2413 return -1;
2404 } 2414 }
2405#endif 2415#endif
2406 return 0; 2416 return 0;
@@ -2492,8 +2502,10 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2492 fp->altset_idx = i; 2502 fp->altset_idx = i;
2493 fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; 2503 fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
2494 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; 2504 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
2495 /* FIXME: decode wMaxPacketSize of high bandwith endpoints */
2496 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 2505 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
2506 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH)
2507 fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1)
2508 * (fp->maxpacksize & 0x7ff);
2497 fp->attributes = csep[3]; 2509 fp->attributes = csep[3];
2498 2510
2499 /* some quirks for attributes here */ 2511 /* some quirks for attributes here */
@@ -2723,7 +2735,8 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip,
2723 * to detect the sample rate is by looking at wMaxPacketSize. 2735 * to detect the sample rate is by looking at wMaxPacketSize.
2724 */ 2736 */
2725static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, 2737static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2726 struct usb_interface *iface) 2738 struct usb_interface *iface,
2739 const snd_usb_audio_quirk_t *quirk)
2727{ 2740{
2728 static const struct audioformat ua_format = { 2741 static const struct audioformat ua_format = {
2729 .format = SNDRV_PCM_FORMAT_S24_3LE, 2742 .format = SNDRV_PCM_FORMAT_S24_3LE,
@@ -2814,7 +2827,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2814/* 2827/*
2815 * Create a stream for an Edirol UA-1000 interface. 2828 * Create a stream for an Edirol UA-1000 interface.
2816 */ 2829 */
2817static int create_ua1000_quirk(snd_usb_audio_t *chip, struct usb_interface *iface) 2830static int create_ua1000_quirk(snd_usb_audio_t *chip,
2831 struct usb_interface *iface,
2832 const snd_usb_audio_quirk_t *quirk)
2818{ 2833{
2819 static const struct audioformat ua1000_format = { 2834 static const struct audioformat ua1000_format = {
2820 .format = SNDRV_PCM_FORMAT_S32_LE, 2835 .format = SNDRV_PCM_FORMAT_S32_LE,
@@ -2891,6 +2906,13 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
2891 return 0; 2906 return 0;
2892} 2907}
2893 2908
2909static int ignore_interface_quirk(snd_usb_audio_t *chip,
2910 struct usb_interface *iface,
2911 const snd_usb_audio_quirk_t *quirk)
2912{
2913 return 0;
2914}
2915
2894 2916
2895/* 2917/*
2896 * boot quirks 2918 * boot quirks
@@ -2926,8 +2948,6 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
2926 2948
2927static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) 2949static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev)
2928{ 2950{
2929#if 0
2930 /* TODO: enable this when high speed synchronization actually works */
2931 u8 buf = 1; 2951 u8 buf = 1;
2932 2952
2933 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, 2953 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a,
@@ -2939,7 +2959,6 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev)
2939 1, 2000, NULL, 0, 1000); 2959 1, 2000, NULL, 0, 1000);
2940 return -ENODEV; 2960 return -ENODEV;
2941 } 2961 }
2942#endif
2943 return 0; 2962 return 0;
2944} 2963}
2945 2964
@@ -2956,28 +2975,28 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip,
2956 struct usb_interface *iface, 2975 struct usb_interface *iface,
2957 const snd_usb_audio_quirk_t *quirk) 2976 const snd_usb_audio_quirk_t *quirk)
2958{ 2977{
2959 switch (quirk->type) { 2978 typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *,
2960 case QUIRK_MIDI_FIXED_ENDPOINT: 2979 const snd_usb_audio_quirk_t *);
2961 case QUIRK_MIDI_YAMAHA: 2980 static const quirk_func_t quirk_funcs[] = {
2962 case QUIRK_MIDI_MIDIMAN: 2981 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
2963 case QUIRK_MIDI_NOVATION: 2982 [QUIRK_COMPOSITE] = create_composite_quirk,
2964 case QUIRK_MIDI_MOTU: 2983 [QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface,
2965 case QUIRK_MIDI_EMAGIC: 2984 [QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface,
2966 return snd_usb_create_midi_interface(chip, iface, quirk); 2985 [QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface,
2967 case QUIRK_COMPOSITE: 2986 [QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface,
2968 return create_composite_quirk(chip, iface, quirk); 2987 [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface,
2969 case QUIRK_AUDIO_FIXED_ENDPOINT: 2988 [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface,
2970 return create_fixed_stream_quirk(chip, iface, quirk); 2989 [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface,
2971 case QUIRK_AUDIO_STANDARD_INTERFACE: 2990 [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface,
2972 case QUIRK_MIDI_STANDARD_INTERFACE: 2991 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk,
2973 return create_standard_interface_quirk(chip, iface, quirk); 2992 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
2974 case QUIRK_AUDIO_EDIROL_UA700_UA25: 2993 [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk,
2975 return create_ua700_ua25_quirk(chip, iface); 2994 [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
2976 case QUIRK_AUDIO_EDIROL_UA1000: 2995 };
2977 return create_ua1000_quirk(chip, iface); 2996
2978 case QUIRK_IGNORE_INTERFACE: 2997 if (quirk->type < QUIRK_TYPE_COUNT) {
2979 return 0; 2998 return quirk_funcs[quirk->type](chip, iface, quirk);
2980 default: 2999 } else {
2981 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 3000 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
2982 return -ENXIO; 3001 return -ENXIO;
2983 } 3002 }
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index aedb42aaa749..ad9eab211d8f 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -153,20 +153,24 @@ struct snd_usb_audio {
153#define QUIRK_NO_INTERFACE -2 153#define QUIRK_NO_INTERFACE -2
154#define QUIRK_ANY_INTERFACE -1 154#define QUIRK_ANY_INTERFACE -1
155 155
156/* quirk type */ 156enum quirk_type {
157#define QUIRK_MIDI_FIXED_ENDPOINT 0 157 QUIRK_IGNORE_INTERFACE,
158#define QUIRK_MIDI_YAMAHA 1 158 QUIRK_COMPOSITE,
159#define QUIRK_MIDI_MIDIMAN 2 159 QUIRK_MIDI_STANDARD_INTERFACE,
160#define QUIRK_COMPOSITE 3 160 QUIRK_MIDI_FIXED_ENDPOINT,
161#define QUIRK_AUDIO_FIXED_ENDPOINT 4 161 QUIRK_MIDI_YAMAHA,
162#define QUIRK_AUDIO_STANDARD_INTERFACE 5 162 QUIRK_MIDI_MIDIMAN,
163#define QUIRK_MIDI_STANDARD_INTERFACE 6 163 QUIRK_MIDI_NOVATION,
164#define QUIRK_AUDIO_EDIROL_UA700_UA25 7 164 QUIRK_MIDI_RAW,
165#define QUIRK_AUDIO_EDIROL_UA1000 8 165 QUIRK_MIDI_EMAGIC,
166#define QUIRK_IGNORE_INTERFACE 9 166 QUIRK_MIDI_MIDITECH,
167#define QUIRK_MIDI_NOVATION 10 167 QUIRK_AUDIO_STANDARD_INTERFACE,
168#define QUIRK_MIDI_MOTU 11 168 QUIRK_AUDIO_FIXED_ENDPOINT,
169#define QUIRK_MIDI_EMAGIC 12 169 QUIRK_AUDIO_EDIROL_UA700_UA25,
170 QUIRK_AUDIO_EDIROL_UA1000,
171
172 QUIRK_TYPE_COUNT
173};
170 174
171typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; 175typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t;
172typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; 176typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t;
@@ -175,7 +179,7 @@ struct snd_usb_audio_quirk {
175 const char *vendor_name; 179 const char *vendor_name;
176 const char *product_name; 180 const char *product_name;
177 int16_t ifnum; 181 int16_t ifnum;
178 int16_t type; 182 uint16_t type;
179 const void *data; 183 const void *data;
180}; 184};
181 185
@@ -205,11 +209,13 @@ struct snd_usb_midi_endpoint_info {
205 209
206/* for QUIRK_IGNORE_INTERFACE, data is NULL */ 210/* for QUIRK_IGNORE_INTERFACE, data is NULL */
207 211
208/* for QUIRK_MIDI_NOVATION and _MOTU, data is NULL */ 212/* for QUIRK_MIDI_NOVATION and _RAW, data is NULL */
209 213
210/* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info 214/* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info
211 * structure (out_cables and in_cables only) */ 215 * structure (out_cables and in_cables only) */
212 216
217/* for QUIRK_MIDI_MIDITECH, data is NULL */
218
213/* 219/*
214 */ 220 */
215 221
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index bee70068dce0..5778a9b725ec 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -524,16 +524,16 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = {
524}; 524};
525 525
526/* 526/*
527 * Mark of the Unicorn USB MIDI protocol: raw MIDI. 527 * "raw" protocol: used by the MOTU FastLane.
528 */ 528 */
529 529
530static void snd_usbmidi_motu_input(snd_usb_midi_in_endpoint_t* ep, 530static void snd_usbmidi_raw_input(snd_usb_midi_in_endpoint_t* ep,
531 uint8_t* buffer, int buffer_length) 531 uint8_t* buffer, int buffer_length)
532{ 532{
533 snd_usbmidi_input_data(ep, 0, buffer, buffer_length); 533 snd_usbmidi_input_data(ep, 0, buffer, buffer_length);
534} 534}
535 535
536static void snd_usbmidi_motu_output(snd_usb_midi_out_endpoint_t* ep) 536static void snd_usbmidi_raw_output(snd_usb_midi_out_endpoint_t* ep)
537{ 537{
538 int count; 538 int count;
539 539
@@ -549,9 +549,9 @@ static void snd_usbmidi_motu_output(snd_usb_midi_out_endpoint_t* ep)
549 ep->urb->transfer_buffer_length = count; 549 ep->urb->transfer_buffer_length = count;
550} 550}
551 551
552static struct usb_protocol_ops snd_usbmidi_motu_ops = { 552static struct usb_protocol_ops snd_usbmidi_raw_ops = {
553 .input = snd_usbmidi_motu_input, 553 .input = snd_usbmidi_raw_input,
554 .output = snd_usbmidi_motu_output, 554 .output = snd_usbmidi_raw_output,
555}; 555};
556 556
557/* 557/*
@@ -1505,8 +1505,8 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1505 umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; 1505 umidi->usb_protocol_ops = &snd_usbmidi_novation_ops;
1506 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 1506 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
1507 break; 1507 break;
1508 case QUIRK_MIDI_MOTU: 1508 case QUIRK_MIDI_RAW:
1509 umidi->usb_protocol_ops = &snd_usbmidi_motu_ops; 1509 umidi->usb_protocol_ops = &snd_usbmidi_raw_ops;
1510 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 1510 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
1511 break; 1511 break;
1512 case QUIRK_MIDI_EMAGIC: 1512 case QUIRK_MIDI_EMAGIC:
@@ -1515,6 +1515,9 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1515 sizeof(snd_usb_midi_endpoint_info_t)); 1515 sizeof(snd_usb_midi_endpoint_info_t));
1516 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); 1516 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
1517 break; 1517 break;
1518 case QUIRK_MIDI_MIDITECH:
1519 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
1520 break;
1518 default: 1521 default:
1519 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 1522 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
1520 err = -ENXIO; 1523 err = -ENXIO;
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index e73c1c9d3e73..fa7056f5caaf 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -363,7 +363,7 @@ static int get_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int *value
363} 363}
364 364
365/* channel = 0: master, 1 = first channel */ 365/* channel = 0: master, 1 = first channel */
366inline static int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int *value) 366static inline int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int *value)
367{ 367{
368 return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); 368 return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value);
369} 369}
@@ -399,7 +399,7 @@ static int set_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int value)
399 return set_ctl_value(cval, SET_CUR, validx, value); 399 return set_ctl_value(cval, SET_CUR, validx, value);
400} 400}
401 401
402inline static int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int value) 402static inline int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int value)
403{ 403{
404 return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value); 404 return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value);
405} 405}
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index f5135641b3e2..f74e652a1e51 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -116,6 +116,7 @@ YAMAHA_DEVICE(0x1039, NULL),
116YAMAHA_DEVICE(0x103a, NULL), 116YAMAHA_DEVICE(0x103a, NULL),
117YAMAHA_DEVICE(0x103b, NULL), 117YAMAHA_DEVICE(0x103b, NULL),
118YAMAHA_DEVICE(0x103c, NULL), 118YAMAHA_DEVICE(0x103c, NULL),
119YAMAHA_DEVICE(0x103d, NULL),
119YAMAHA_DEVICE(0x2000, "DGP-7"), 120YAMAHA_DEVICE(0x2000, "DGP-7"),
120YAMAHA_DEVICE(0x2001, "DGP-5"), 121YAMAHA_DEVICE(0x2001, "DGP-5"),
121YAMAHA_DEVICE(0x2002, NULL), 122YAMAHA_DEVICE(0x2002, NULL),
@@ -1259,7 +1260,12 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1259/* Mark of the Unicorn devices */ 1260/* Mark of the Unicorn devices */
1260{ 1261{
1261 /* thanks to Robert A. Lerche <ral 'at' msbit.com> */ 1262 /* thanks to Robert A. Lerche <ral 'at' msbit.com> */
1262 USB_DEVICE(0x07fd, 0x0001), 1263 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
1264 USB_DEVICE_ID_MATCH_PRODUCT |
1265 USB_DEVICE_ID_MATCH_DEV_SUBCLASS,
1266 .idVendor = 0x07fd,
1267 .idProduct = 0x0001,
1268 .bDeviceSubClass = 2,
1263 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { 1269 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1264 .vendor_name = "MOTU", 1270 .vendor_name = "MOTU",
1265 .product_name = "Fastlane", 1271 .product_name = "Fastlane",
@@ -1268,7 +1274,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1268 .data = & (const snd_usb_audio_quirk_t[]) { 1274 .data = & (const snd_usb_audio_quirk_t[]) {
1269 { 1275 {
1270 .ifnum = 0, 1276 .ifnum = 0,
1271 .type = QUIRK_MIDI_MOTU 1277 .type = QUIRK_MIDI_RAW
1272 }, 1278 },
1273 { 1279 {
1274 .ifnum = 1, 1280 .ifnum = 1,
@@ -1373,6 +1379,25 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1373}, 1379},
1374 1380
1375{ 1381{
1382 USB_DEVICE(0x4752, 0x0011),
1383 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1384 .vendor_name = "Miditech",
1385 .product_name = "Midistart-2",
1386 .ifnum = 0,
1387 .type = QUIRK_MIDI_MIDITECH
1388 }
1389},
1390{
1391 USB_DEVICE(0x7104, 0x2202),
1392 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1393 .vendor_name = "Miditech",
1394 .product_name = "MidiStudio-2",
1395 .ifnum = 0,
1396 .type = QUIRK_MIDI_MIDITECH
1397 }
1398},
1399
1400{
1376 /* 1401 /*
1377 * Some USB MIDI devices don't have an audio control interface, 1402 * Some USB MIDI devices don't have an audio control interface,
1378 * so we have to grab MIDI streaming interfaces here. 1403 * so we have to grab MIDI streaming interfaces here.
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index bef9b0c142c4..0281a362857a 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -232,8 +232,7 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp)
232 if (err) 232 if (err)
233 return err; 233 return err;
234 if (dsp->index == 1) { 234 if (dsp->index == 1) {
235 set_current_state(TASK_UNINTERRUPTIBLE); 235 msleep(250); // give the device some time
236 schedule_timeout(HZ/4); // give the device some time
237 err = usX2Y_AsyncSeq04_init(priv); 236 err = usX2Y_AsyncSeq04_init(priv);
238 if (err) { 237 if (err) {
239 snd_printk("usX2Y_AsyncSeq04_init error \n"); 238 snd_printk("usX2Y_AsyncSeq04_init error \n");
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index bb2c8e9000c6..ef28061287f2 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -50,6 +50,7 @@
50 Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y. 50 Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y.
51*/ 51*/
52 52
53#include <linux/delay.h>
53#include "usbusx2yaudio.c" 54#include "usbusx2yaudio.c"
54 55
55#if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) 56#if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1)
@@ -520,11 +521,8 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream)
520 usX2Y->hwdep_pcm_shm->playback_iso_start = -1; 521 usX2Y->hwdep_pcm_shm->playback_iso_start = -1;
521 if (atomic_read(&subs->state) < state_PREPARED) { 522 if (atomic_read(&subs->state) < state_PREPARED) {
522 while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { 523 while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) {
523 signed long timeout;
524 snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); 524 snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames);
525 set_current_state(TASK_INTERRUPTIBLE); 525 if (msleep_interruptible(10)) {
526 timeout = schedule_timeout(HZ/100 + 1);
527 if (signal_pending(current)) {
528 err = -ERESTARTSYS; 526 err = -ERESTARTSYS;
529 goto up_prepare_mutex; 527 goto up_prepare_mutex;
530 } 528 }