aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-21 12:52:36 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-21 12:52:36 -0400
commita748422ee45725e04e1d3792fa19dfa90ddfd116 (patch)
tree978e12895468baaa9f7ab2747b9f7d50beaf1717
parentc63e31c2cc1ec67372920b5e1aff8204d04dd172 (diff)
parentf4ffaa452e71495a06376f12f772342bc57051fc (diff)
Merge branch 'master'
-rw-r--r--CREDITS6
-rw-r--r--Documentation/DMA-API.txt49
-rw-r--r--Documentation/DMA-mapping.txt26
-rw-r--r--Documentation/DocBook/libata.tmpl2
-rw-r--r--Documentation/block/switching-sched.txt22
-rw-r--r--Documentation/cpu-freq/index.txt2
-rw-r--r--Documentation/feature-removal-schedule.txt13
-rw-r--r--Documentation/filesystems/vfs.txt12
-rw-r--r--Documentation/i2c/busses/i2c-parport16
-rw-r--r--Documentation/isdn/README.gigaset286
-rw-r--r--Documentation/kbuild/modules.txt2
-rw-r--r--Documentation/laptop-mode.txt10
-rw-r--r--Documentation/memory-barriers.txt68
-rw-r--r--Documentation/mtrr.txt23
-rw-r--r--Documentation/networking/xfrm_sync.txt166
-rw-r--r--Documentation/scsi/scsi_eh.txt14
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt19
-rw-r--r--Documentation/serial/driver22
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl16
-rw-r--r--Documentation/vm/hugetlbpage.txt31
-rw-r--r--Documentation/x86_64/boot-options.txt5
-rw-r--r--Kbuild2
-rw-r--r--MAINTAINERS19
-rw-r--r--Makefile56
-rw-r--r--README23
-rw-r--r--arch/alpha/Kconfig5
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c1
-rw-r--r--arch/alpha/kernel/setup.c17
-rw-r--r--arch/alpha/kernel/smp.c8
-rw-r--r--arch/arm/Kconfig6
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in1
-rw-r--r--arch/arm/common/scoop.c12
-rw-r--r--arch/arm/configs/ep93xx_defconfig79
-rw-r--r--arch/arm/configs/ixp2000_defconfig59
-rw-r--r--arch/arm/configs/ixp23xx_defconfig58
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/setup.c14
-rw-r--r--arch/arm/mach-at91rm9200/devices.c12
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-omap1/devices.c11
-rw-r--r--arch/arm/mach-omap2/devices.c10
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c9
-rw-r--r--arch/arm/mach-s3c2410/clock.c4
-rw-r--r--arch/arm/mach-s3c2410/common-smdk.c3
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c2
-rw-r--r--arch/arm/mm/cache-v4wb.S26
-rw-r--r--arch/arm/mm/init.c7
-rw-r--r--arch/arm/mm/proc-sa110.S25
-rw-r--r--arch/arm/mm/proc-sa1100.S37
-rw-r--r--arch/arm/plat-omap/clock.c3
-rw-r--r--arch/arm/plat-omap/devices.c22
-rw-r--r--arch/arm/vfp/vfpdouble.c29
-rw-r--r--arch/arm/vfp/vfphw.S6
-rw-r--r--arch/arm/vfp/vfpsingle.c9
-rw-r--r--arch/arm26/kernel/armksyms.c1
-rw-r--r--arch/cris/kernel/crisksyms.c1
-rw-r--r--arch/frv/kernel/entry.S26
-rw-r--r--arch/frv/kernel/frv_ksyms.c1
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c1
-rw-r--r--arch/i386/Kconfig73
-rw-r--r--arch/i386/Kconfig.cpu2
-rw-r--r--arch/i386/Kconfig.debug9
-rw-r--r--arch/i386/boot/video.S5
-rw-r--r--arch/i386/kernel/Makefile2
-rw-r--r--arch/i386/kernel/acpi/boot.c11
-rw-r--r--arch/i386/kernel/apic.c23
-rw-r--r--arch/i386/kernel/apm.c2
-rw-r--r--arch/i386/kernel/cpu/amd.c4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c22
-rw-r--r--arch/i386/kernel/cpuid.c2
-rw-r--r--arch/i386/kernel/i386_ksyms.c1
-rw-r--r--arch/i386/kernel/kprobes.c18
-rw-r--r--arch/i386/kernel/mpparse.c43
-rw-r--r--arch/i386/kernel/msr.c2
-rw-r--r--arch/i386/kernel/reboot_fixups.c2
-rw-r--r--arch/i386/kernel/setup.c36
-rw-r--r--arch/i386/kernel/syscall_table.S1
-rw-r--r--arch/i386/kernel/traps.c16
-rw-r--r--arch/i386/mach-voyager/voyager_cat.c11
-rw-r--r--arch/i386/mm/init.c2
-rw-r--r--arch/i386/pci/direct.c13
-rw-r--r--arch/i386/pci/irq.c3
-rw-r--r--arch/i386/pci/mmconfig.c67
-rw-r--r--arch/ia64/Kconfig19
-rw-r--r--arch/ia64/kernel/Makefile3
-rw-r--r--arch/ia64/kernel/acpi-ext.c143
-rw-r--r--arch/ia64/kernel/entry.S4
-rw-r--r--arch/ia64/kernel/kprobes.c10
-rw-r--r--arch/ia64/kernel/mca.c43
-rw-r--r--arch/ia64/kernel/mca_asm.S10
-rw-r--r--arch/ia64/kernel/module.c2
-rw-r--r--arch/ia64/mm/discontig.c66
-rw-r--r--arch/ia64/mm/fault.c3
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c2
-rw-r--r--arch/m32r/Kconfig5
-rw-r--r--arch/m32r/kernel/entry.S55
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c29
-rw-r--r--arch/m32r/kernel/process.c4
-rw-r--r--arch/m32r/kernel/setup.c12
-rw-r--r--arch/m32r/kernel/signal.c4
-rw-r--r--arch/m32r/kernel/smpboot.c19
-rw-r--r--arch/m32r/lib/Makefile4
-rw-r--r--arch/m32r/lib/getuser.S88
-rw-r--r--arch/m32r/lib/putuser.S84
-rw-r--r--arch/m68k/kernel/m68k_ksyms.c1
-rw-r--r--arch/m68knommu/kernel/m68k_ksyms.c1
-rw-r--r--arch/mips/Kconfig30
-rw-r--r--arch/mips/Makefile12
-rw-r--r--arch/mips/au1000/common/Makefile2
-rw-r--r--arch/mips/au1000/common/int-handler.S68
-rw-r--r--arch/mips/au1000/common/irq.c20
-rw-r--r--arch/mips/cobalt/Makefile2
-rw-r--r--arch/mips/cobalt/int-handler.S25
-rw-r--r--arch/mips/cobalt/irq.c6
-rw-r--r--arch/mips/configs/tb0287_defconfig1096
-rw-r--r--arch/mips/ddb5xxx/ddb5074/Makefile2
-rw-r--r--arch/mips/ddb5xxx/ddb5074/int-handler.S120
-rw-r--r--arch/mips/ddb5xxx/ddb5074/irq.c26
-rw-r--r--arch/mips/ddb5xxx/ddb5476/Makefile2
-rw-r--r--arch/mips/ddb5xxx/ddb5476/int-handler.S112
-rw-r--r--arch/mips/ddb5xxx/ddb5476/irq.c30
-rw-r--r--arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c6
-rw-r--r--arch/mips/ddb5xxx/ddb5477/Makefile2
-rw-r--r--arch/mips/ddb5xxx/ddb5477/int-handler.S75
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq.c24
-rw-r--r--arch/mips/dec/boot/decstation.c3
-rw-r--r--arch/mips/dec/int-handler.S14
-rw-r--r--arch/mips/dec/setup.c3
-rw-r--r--arch/mips/galileo-boards/ev96100/Makefile2
-rw-r--r--arch/mips/galileo-boards/ev96100/int-handler.S33
-rw-r--r--arch/mips/galileo-boards/ev96100/irq.c19
-rw-r--r--arch/mips/gt64120/ev64120/Makefile2
-rw-r--r--arch/mips/gt64120/ev64120/int-handler.S113
-rw-r--r--arch/mips/gt64120/ev64120/irq.c27
-rw-r--r--arch/mips/gt64120/momenco_ocelot/Makefile2
-rw-r--r--arch/mips/gt64120/momenco_ocelot/int-handler.S131
-rw-r--r--arch/mips/gt64120/momenco_ocelot/irq.c36
-rw-r--r--arch/mips/ite-boards/generic/Makefile2
-rw-r--r--arch/mips/ite-boards/generic/int-handler.S63
-rw-r--r--arch/mips/ite-boards/generic/irq.c18
-rw-r--r--arch/mips/ite-boards/generic/time.c1
-rw-r--r--arch/mips/ite-boards/ivr/init.c2
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c2
-rw-r--r--arch/mips/jazz/Makefile2
-rw-r--r--arch/mips/jazz/int-handler.S282
-rw-r--r--arch/mips/jazz/irq.c78
-rw-r--r--arch/mips/jmr3927/common/rtc_ds1742.c60
-rw-r--r--arch/mips/jmr3927/rbhma3100/Makefile2
-rw-r--r--arch/mips/jmr3927/rbhma3100/int-handler.S74
-rw-r--r--arch/mips/jmr3927/rbhma3100/irq.c6
-rw-r--r--arch/mips/kernel/Makefile5
-rw-r--r--arch/mips/kernel/asm-offsets.c3
-rw-r--r--arch/mips/kernel/entry.S69
-rw-r--r--arch/mips/kernel/gdb-low.S24
-rw-r--r--arch/mips/kernel/gdb-stub.c61
-rw-r--r--arch/mips/kernel/genex.S43
-rw-r--r--arch/mips/kernel/head.S57
-rw-r--r--arch/mips/kernel/i8259.c4
-rw-r--r--arch/mips/kernel/irq-msc01.c9
-rw-r--r--arch/mips/kernel/irq.c18
-rw-r--r--arch/mips/kernel/kspd.c398
-rw-r--r--arch/mips/kernel/linux32.c10
-rw-r--r--arch/mips/kernel/mips-mt.c449
-rw-r--r--arch/mips/kernel/mips_ksyms.c16
-rw-r--r--arch/mips/kernel/process.c21
-rw-r--r--arch/mips/kernel/ptrace.c14
-rw-r--r--arch/mips/kernel/ptrace32.c14
-rw-r--r--arch/mips/kernel/r4k_switch.S34
-rw-r--r--arch/mips/kernel/rtlx.c517
-rw-r--r--arch/mips/kernel/scall32-o32.S13
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/setup.c5
-rw-r--r--arch/mips/kernel/smp-mt.c (renamed from arch/mips/kernel/smp_mt.c)44
-rw-r--r--arch/mips/kernel/smp.c12
-rw-r--r--arch/mips/kernel/smtc-asm.S130
-rw-r--r--arch/mips/kernel/smtc-proc.c93
-rw-r--r--arch/mips/kernel/smtc.c1322
-rw-r--r--arch/mips/kernel/time.c3
-rw-r--r--arch/mips/kernel/traps.c212
-rw-r--r--arch/mips/kernel/vmlinux.lds.S2
-rw-r--r--arch/mips/kernel/vpe.c659
-rw-r--r--arch/mips/lasat/Makefile2
-rw-r--r--arch/mips/lasat/interrupt.c14
-rw-r--r--arch/mips/lasat/lasatIRQ.S69
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c92
-rw-r--r--arch/mips/mips-boards/generic/Makefile4
-rw-r--r--arch/mips/mips-boards/generic/gdb_hook.c2
-rw-r--r--arch/mips/mips-boards/generic/init.c1
-rw-r--r--arch/mips/mips-boards/generic/memory.c9
-rw-r--r--arch/mips/mips-boards/generic/mipsIRQ.S155
-rw-r--r--arch/mips/mips-boards/generic/time.c68
-rw-r--r--arch/mips/mips-boards/malta/Makefile1
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c102
-rw-r--r--arch/mips/mips-boards/malta/malta_smp.c128
-rw-r--r--arch/mips/mips-boards/sead/sead_int.c86
-rw-r--r--arch/mips/mips-boards/sim/cmdline.c59
-rw-r--r--arch/mips/mips-boards/sim/sim_cmdline.c6
-rw-r--r--arch/mips/mips-boards/sim/sim_int.c64
-rw-r--r--arch/mips/mips-boards/sim/sim_irq.S4
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c9
-rw-r--r--arch/mips/mips-boards/sim/sim_smp.c14
-rw-r--r--arch/mips/mm/c-r3k.c5
-rw-r--r--arch/mips/mm/c-r4k.c20
-rw-r--r--arch/mips/mm/c-sb1.c1
-rw-r--r--arch/mips/mm/c-tx39.c7
-rw-r--r--arch/mips/mm/cache.c1
-rw-r--r--arch/mips/mm/fault.c13
-rw-r--r--arch/mips/mm/highmem.c2
-rw-r--r--arch/mips/mm/init.c48
-rw-r--r--arch/mips/mm/sc-rm7k.c2
-rw-r--r--arch/mips/mm/tlb-r4k.c85
-rw-r--r--arch/mips/mm/tlbex.c87
-rw-r--r--arch/mips/momentum/jaguar_atx/Makefile2
-rw-r--r--arch/mips/momentum/jaguar_atx/int-handler.S128
-rw-r--r--arch/mips/momentum/jaguar_atx/irq.c35
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c36
-rw-r--r--arch/mips/momentum/ocelot_3/Makefile2
-rw-r--r--arch/mips/momentum/ocelot_3/int-handler.S137
-rw-r--r--arch/mips/momentum/ocelot_3/irq.c38
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c24
-rw-r--r--arch/mips/momentum/ocelot_c/Makefile2
-rw-r--r--arch/mips/momentum/ocelot_c/int-handler.S102
-rw-r--r--arch/mips/momentum/ocelot_c/irq.c30
-rw-r--r--arch/mips/momentum/ocelot_g/Makefile2
-rw-r--r--arch/mips/momentum/ocelot_g/int-handler.S131
-rw-r--r--arch/mips/momentum/ocelot_g/irq.c38
-rw-r--r--arch/mips/philips/pnx8550/common/Makefile2
-rw-r--r--arch/mips/philips/pnx8550/common/int.c23
-rw-r--r--arch/mips/philips/pnx8550/common/mipsIRQ.S76
-rw-r--r--arch/mips/philips/pnx8550/common/platform.c1
-rw-r--r--arch/mips/pmc-sierra/yosemite/Makefile2
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq-handler.S93
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c33
-rw-r--r--arch/mips/qemu/Makefile2
-rw-r--r--arch/mips/qemu/q-int.S17
-rw-r--r--arch/mips/qemu/q-irq.c3
-rw-r--r--arch/mips/sgi-ip22/Makefile2
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c59
-rw-r--r--arch/mips/sgi-ip22/ip22-irq.S118
-rw-r--r--arch/mips/sgi-ip27/Makefile2
-rw-r--r--arch/mips/sgi-ip27/TODO4
-rw-r--r--arch/mips/sgi-ip27/ip27-irq-glue.S45
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c27
-rw-r--r--arch/mips/sgi-ip32/Makefile2
-rw-r--r--arch/mips/sgi-ip32/ip32-irq-glue.S86
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c33
-rw-r--r--arch/mips/sibyte/bcm1480/Makefile2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c77
-rw-r--r--arch/mips/sibyte/bcm1480/irq_handler.S165
-rw-r--r--arch/mips/sibyte/sb1250/Makefile2
-rw-r--r--arch/mips/sibyte/sb1250/irq.c78
-rw-r--r--arch/mips/sibyte/sb1250/irq_handler.S147
-rw-r--r--arch/mips/sni/Makefile2
-rw-r--r--arch/mips/sni/int-handler.S106
-rw-r--r--arch/mips/sni/irq.c37
-rw-r--r--arch/mips/tx4927/common/Makefile2
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c30
-rw-r--r--arch/mips/tx4927/common/tx4927_irq_handler.S103
-rw-r--r--arch/mips/tx4938/common/Makefile2
-rw-r--r--arch/mips/tx4938/common/irq.c21
-rw-r--r--arch/mips/tx4938/common/irq_handler.S84
-rw-r--r--arch/mips/vr41xx/Kconfig13
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/mips/vr41xx/common/int-handler.S114
-rw-r--r--arch/mips/vr41xx/common/irq.c29
-rw-r--r--arch/parisc/Kconfig5
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c1
-rw-r--r--arch/powerpc/Kconfig11
-rw-r--r--arch/powerpc/Makefile4
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/entry_32.S35
-rw-r--r--arch/powerpc/kernel/head_64.S49
-rw-r--r--arch/powerpc/kernel/idle.c4
-rw-r--r--arch/powerpc/kernel/idle_6xx.S63
-rw-r--r--arch/powerpc/kernel/idle_power4.S10
-rw-r--r--arch/powerpc/kernel/irq.c36
-rw-r--r--arch/powerpc/kernel/kprobes.c14
-rw-r--r--arch/powerpc/kernel/prom_init.c5
-rw-r--r--arch/powerpc/kernel/rtas-proc.c4
-rw-r--r--arch/powerpc/kernel/systbl.S1
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c2
-rw-r--r--arch/powerpc/platforms/chrp/chrp.h1
-rw-r--r--arch/powerpc/platforms/chrp/pci.c6
-rw-r--r--arch/powerpc/platforms/chrp/setup.c44
-rw-r--r--arch/powerpc/platforms/iseries/setup.c7
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c6
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c2
-rw-r--r--arch/ppc/boot/lib/Makefile2
-rw-r--r--arch/ppc/syslib/ppc_sys.c9
-rw-r--r--arch/s390/Makefile1
-rw-r--r--arch/s390/defconfig48
-rw-r--r--arch/sh/Kconfig5
-rw-r--r--arch/sh/kernel/sh_ksyms.c1
-rw-r--r--arch/sh64/kernel/sh_ksyms.c1
-rw-r--r--arch/sparc/kernel/smp.c2
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c1
-rw-r--r--arch/sparc/kernel/systbls.S2
-rw-r--r--arch/sparc/math-emu/Makefile2
-rw-r--r--arch/sparc64/Kconfig5
-rw-r--r--arch/sparc64/defconfig10
-rw-r--r--arch/sparc64/kernel/kprobes.c12
-rw-r--r--arch/sparc64/kernel/pci.c1
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c2
-rw-r--r--arch/sparc64/kernel/ptrace.c23
-rw-r--r--arch/sparc64/kernel/setup.c2
-rw-r--r--arch/sparc64/kernel/smp.c41
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c1
-rw-r--r--arch/sparc64/kernel/sys32.S1
-rw-r--r--arch/sparc64/kernel/systbls.S4
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/um/Makefile3
-rw-r--r--arch/um/drivers/cow.h2
-rw-r--r--arch/um/drivers/cow_sys.h2
-rw-r--r--arch/um/drivers/cow_user.c96
-rw-r--r--arch/um/drivers/mconsole_kern.c8
-rw-r--r--arch/um/drivers/net_user.c4
-rw-r--r--arch/um/drivers/slirp_user.c2
-rw-r--r--arch/um/include/kern_util.h4
-rw-r--r--arch/um/include/longjmp.h4
-rw-r--r--arch/um/include/sysdep-i386/kernel-offsets.h2
-rw-r--r--arch/um/include/sysdep-x86_64/kernel-offsets.h2
-rw-r--r--arch/um/include/tt/tt.h3
-rw-r--r--arch/um/include/user.h6
-rw-r--r--arch/um/include/user_util.h3
-rw-r--r--arch/um/kernel/ksyms.c5
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c2
-rw-r--r--arch/um/os-Linux/helper.c10
-rw-r--r--arch/um/os-Linux/mem.c141
-rw-r--r--arch/um/os-Linux/process.c8
-rw-r--r--arch/um/os-Linux/sigio.c2
-rw-r--r--arch/um/os-Linux/skas/mem.c4
-rw-r--r--arch/um/os-Linux/skas/process.c40
-rw-r--r--arch/um/os-Linux/start_up.c24
-rw-r--r--arch/um/os-Linux/sys-i386/tls.c1
-rw-r--r--arch/um/os-Linux/trap.c4
-rw-r--r--arch/um/os-Linux/uaccess.c4
-rw-r--r--arch/um/os-Linux/umid.c15
-rw-r--r--arch/um/os-Linux/user_syms.c9
-rw-r--r--arch/um/os-Linux/util.c2
-rw-r--r--arch/um/scripts/Makefile.rules6
-rw-r--r--arch/um/sys-i386/ksyms.c4
-rw-r--r--arch/um/sys-i386/ptrace_user.c2
-rw-r--r--arch/um/sys-i386/signal.c8
-rw-r--r--arch/um/sys-i386/stub_segv.c4
-rw-r--r--arch/um/sys-i386/tls.c2
-rw-r--r--arch/um/sys-x86_64/signal.c2
-rw-r--r--arch/um/sys-x86_64/stub_segv.c10
-rw-r--r--arch/v850/kernel/v850_ksyms.c1
-rw-r--r--arch/x86_64/Kconfig10
-rw-r--r--arch/x86_64/Makefile24
-rw-r--r--arch/x86_64/boot/video.S5
-rw-r--r--arch/x86_64/defconfig57
-rw-r--r--arch/x86_64/ia32/ia32entry.S24
-rw-r--r--arch/x86_64/kernel/Makefile4
-rw-r--r--arch/x86_64/kernel/aperture.c2
-rw-r--r--arch/x86_64/kernel/e820.c36
-rw-r--r--arch/x86_64/kernel/entry.S28
-rw-r--r--arch/x86_64/kernel/kprobes.c10
-rw-r--r--arch/x86_64/kernel/mce.c8
-rw-r--r--arch/x86_64/kernel/nmi.c7
-rw-r--r--arch/x86_64/kernel/pci-dma.c2
-rw-r--r--arch/x86_64/kernel/process.c14
-rw-r--r--arch/x86_64/kernel/ptrace.c5
-rw-r--r--arch/x86_64/kernel/setup.c8
-rw-r--r--arch/x86_64/kernel/time.c4
-rw-r--r--arch/x86_64/kernel/traps.c5
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S2
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c3
-rw-r--r--arch/x86_64/mm/init.c37
-rw-r--r--arch/x86_64/mm/numa.c46
-rw-r--r--arch/x86_64/mm/srat.c170
-rw-r--r--arch/x86_64/pci/mmconfig.c53
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c1
-rw-r--r--block/as-iosched.c5
-rw-r--r--block/cfq-iosched.c53
-rw-r--r--block/elevator.c2
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--block/scsi_ioctl.c101
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/base/bus.c5
-rw-r--r--drivers/base/class.c13
-rw-r--r--drivers/base/dd.c2
-rw-r--r--drivers/base/node.c2
-rw-r--r--drivers/base/power/suspend.c12
-rw-r--r--drivers/block/cciss.c96
-rw-r--r--drivers/cdrom/aztcd.c2
-rw-r--r--drivers/char/Kconfig4
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/agp/efficeon-agp.c8
-rw-r--r--drivers/char/applicom.c2
-rw-r--r--drivers/char/cs5535_gpio.c5
-rw-r--r--drivers/char/drm/drmP.h4
-rw-r--r--drivers/char/drm/drm_drv.c4
-rw-r--r--drivers/char/drm/drm_memory.c134
-rw-r--r--drivers/char/drm/drm_memory.h128
-rw-r--r--drivers/char/drm/drm_memory_debug.h2
-rw-r--r--drivers/char/drm/drm_pci.c1
-rw-r--r--drivers/char/drm/via_irq.c12
-rw-r--r--drivers/char/dtlk.c2
-rw-r--r--drivers/char/ipmi/ipmi_bt_sm.c2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/random.c1
-rw-r--r--drivers/char/sonypi.c3
-rw-r--r--drivers/char/tlclk.c36
-rw-r--r--drivers/char/tty_io.c36
-rw-r--r--drivers/cpufreq/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq.c25
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c6
-rw-r--r--drivers/firmware/Makefile3
-rw-r--r--drivers/firmware/dmi_scan.c (renamed from arch/i386/kernel/dmi_scan.c)12
-rw-r--r--drivers/hwmon/hdaps.c14
-rw-r--r--drivers/hwmon/w83792d.c5
-rw-r--r--drivers/i2c/busses/Kconfig5
-rw-r--r--drivers/i2c/busses/i2c-i801.c5
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.h2
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c8
-rw-r--r--drivers/i2c/chips/ds1374.c16
-rw-r--r--drivers/i2c/chips/m41t00.c24
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/atiixp.c1
-rw-r--r--drivers/ide/pci/pdc202xx_old.c2
-rw-r--r--drivers/ide/setup-pci.c13
-rw-r--r--drivers/infiniband/core/cache.c2
-rw-r--r--drivers/infiniband/core/mad.c7
-rw-r--r--drivers/infiniband/core/verbs.c34
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c12
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_pe800.c10
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c124
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c118
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h5
-rw-r--r--drivers/infiniband/hw/mthca/Kconfig11
-rw-r--r--drivers/infiniband/hw/mthca/Makefile4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_av.c100
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.h1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h23
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mad.c42
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c28
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.h3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c46
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c27
-rw-r--r--drivers/infiniband/ulp/ipoib/Kconfig3
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h7
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_fs.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c22
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c88
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c58
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c6
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c19
-rw-r--r--drivers/isdn/gigaset/Kconfig4
-rw-r--r--drivers/isdn/gigaset/asyncdata.c132
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c870
-rw-r--r--drivers/isdn/gigaset/common.c505
-rw-r--r--drivers/isdn/gigaset/ev-layer.c667
-rw-r--r--drivers/isdn/gigaset/gigaset.h600
-rw-r--r--drivers/isdn/gigaset/i4l.c231
-rw-r--r--drivers/isdn/gigaset/interface.c235
-rw-r--r--drivers/isdn/gigaset/isocdata.c139
-rw-r--r--drivers/isdn/gigaset/proc.c51
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c455
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c20
-rw-r--r--drivers/leds/Kconfig27
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-s3c24xx.c163
-rw-r--r--drivers/md/Kconfig11
-rw-r--r--drivers/md/md.c25
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/bt8xx/Makefile2
-rw-r--r--drivers/media/video/cx25840/Makefile2
-rw-r--r--drivers/media/video/cx88/Makefile6
-rw-r--r--drivers/media/video/em28xx/Makefile2
-rw-r--r--drivers/media/video/saa7134/Makefile6
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c3
-rw-r--r--drivers/message/fusion/mptsas.c10
-rw-r--r--drivers/mtd/devices/Kconfig13
-rw-r--r--drivers/mtd/devices/Makefile1
-rw-r--r--drivers/mtd/devices/blkmtd.c819
-rw-r--r--drivers/net/b44.c64
-rw-r--r--drivers/net/bnx2.c2
-rw-r--r--drivers/net/chelsio/Makefile2
-rw-r--r--drivers/net/hydra.h177
-rw-r--r--drivers/net/irda/irda-usb.c365
-rw-r--r--drivers/net/irda/irda-usb.h43
-rw-r--r--drivers/net/irda/smsc-ircc2.c523
-rw-r--r--drivers/net/ixgb/ixgb_main.c13
-rw-r--r--drivers/net/mv643xx_eth.c19
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/ne.c2
-rw-r--r--drivers/net/netconsole.c1
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c6
-rw-r--r--drivers/net/sky2.h2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sungem_phy.c11
-rw-r--r--drivers/net/tg3.c100
-rw-r--r--drivers/net/tg3.h3
-rw-r--r--drivers/net/typhoon.c2
-rw-r--r--drivers/net/via-rhine.c7
-rw-r--r--drivers/net/wan/Kconfig97
-rw-r--r--drivers/net/wan/Makefile13
-rw-r--r--drivers/net/wan/sdla_chdlc.c4428
-rw-r--r--drivers/net/wan/sdla_fr.c5061
-rw-r--r--drivers/net/wan/sdla_ft1.c345
-rw-r--r--drivers/net/wan/sdla_ppp.c3430
-rw-r--r--drivers/net/wan/sdla_x25.c5497
-rw-r--r--drivers/net/wan/sdladrv.c2314
-rw-r--r--drivers/net/wan/sdlamain.c1346
-rw-r--r--drivers/net/wan/wanpipe_multppp.c2358
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/airo.c46
-rw-r--r--drivers/net/wireless/atmel.c11
-rw-r--r--drivers/net/wireless/bcm43xx/Kconfig3
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h17
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c8
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_dma.c13
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_power.c115
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_power.h9
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c115
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h16
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c8
-rw-r--r--drivers/net/wireless/orinoco.c2
-rw-r--r--drivers/parport/parport_pc.c20
-rw-r--r--drivers/parport/parport_serial.c2
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c3
-rw-r--r--drivers/pci/msi.c227
-rw-r--r--drivers/pci/pci-driver.c6
-rw-r--r--drivers/pci/pci.c12
-rw-r--r--drivers/pci/pci.h11
-rw-r--r--drivers/pci/quirks.c33
-rw-r--r--drivers/pcmcia/at91_cf.c51
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c8
-rw-r--r--drivers/pnp/manager.c4
-rw-r--r--drivers/rtc/Kconfig10
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/class.c2
-rw-r--r--drivers/rtc/rtc-ds1672.c72
-rw-r--r--drivers/rtc/rtc-ep93xx.c2
-rw-r--r--drivers/rtc/rtc-m48t86.c9
-rw-r--r--drivers/rtc/rtc-pcf8563.c11
-rw-r--r--drivers/rtc/rtc-proc.c2
-rw-r--r--drivers/rtc/rtc-rs5c372.c28
-rw-r--r--drivers/rtc/rtc-sa1100.c14
-rw-r--r--drivers/rtc/rtc-test.c3
-rw-r--r--drivers/rtc/rtc-vr41xx.c (renamed from drivers/char/vr41xx_rtc.c)404
-rw-r--r--drivers/rtc/rtc-x1205.c29
-rw-r--r--drivers/s390/block/dasd.c45
-rw-r--r--drivers/s390/block/dasd_proc.c17
-rw-r--r--drivers/s390/char/keyboard.c2
-rw-r--r--drivers/s390/char/tape_block.c4
-rw-r--r--drivers/s390/char/tape_core.c10
-rw-r--r--drivers/s390/cio/blacklist.c4
-rw-r--r--drivers/s390/cio/cio.c2
-rw-r--r--drivers/s390/cio/cio_debug.h22
-rw-r--r--drivers/scsi/3w-9xxx.c9
-rw-r--r--drivers/scsi/3w-xxxx.c3
-rw-r--r--drivers/scsi/Kconfig24
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/aacraid/aachba.c94
-rw-r--r--drivers/scsi/aacraid/aacraid.h11
-rw-r--r--drivers/scsi/aacraid/commctrl.c12
-rw-r--r--drivers/scsi/aacraid/commsup.c41
-rw-r--r--drivers/scsi/aacraid/linit.c64
-rw-r--r--drivers/scsi/aacraid/rkt.c4
-rw-r--r--drivers/scsi/aacraid/rx.c4
-rw-r--r--drivers/scsi/aacraid/sa.c2
-rw-r--r--drivers/scsi/ahci.c1
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c166
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c4
-rw-r--r--drivers/scsi/ata_piix.c1
-rw-r--r--drivers/scsi/hosts.c12
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c251
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c1
-rw-r--r--drivers/scsi/ibmvscsi/srp.h227
-rw-r--r--drivers/scsi/ibmvscsi/viosrp.h17
-rw-r--r--drivers/scsi/ipr.c122
-rw-r--r--drivers/scsi/ipr.h46
-rw-r--r--drivers/scsi/libata-core.c1
-rw-r--r--drivers/scsi/libata-scsi.c8
-rw-r--r--drivers/scsi/libata.h1
-rw-r--r--drivers/scsi/pdc_adma.c1
-rw-r--r--drivers/scsi/qlogicfc.c2228
-rw-r--r--drivers/scsi/qlogicfc_asm.c9751
-rw-r--r--drivers/scsi/sata_mv.c3
-rw-r--r--drivers/scsi/sata_nv.c1
-rw-r--r--drivers/scsi/sata_promise.c1
-rw-r--r--drivers/scsi/sata_qstor.c1
-rw-r--r--drivers/scsi/sata_sil.c1
-rw-r--r--drivers/scsi/sata_sil24.c1
-rw-r--r--drivers/scsi/sata_sis.c1
-rw-r--r--drivers/scsi/sata_svw.c1
-rw-r--r--drivers/scsi/sata_sx4.c1
-rw-r--r--drivers/scsi/sata_uli.c1
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/sata_vsc.c1
-rw-r--r--drivers/scsi/scsi.c5
-rw-r--r--drivers/scsi/scsi_devinfo.c4
-rw-r--r--drivers/scsi/scsi_error.c4
-rw-r--r--drivers/scsi/scsi_ioctl.c176
-rw-r--r--drivers/scsi/scsi_lib.c15
-rw-r--r--drivers/scsi/scsi_sas_internal.h38
-rw-r--r--drivers/scsi/scsi_scan.c19
-rw-r--r--drivers/scsi/scsi_transport_fc.c466
-rw-r--r--drivers/scsi/scsi_transport_sas.c67
-rw-r--r--drivers/scsi/sg.c7
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_defs.h2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c205
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.h2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c113
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.h2
-rw-r--r--drivers/serial/m32r_sio.c1
-rw-r--r--drivers/sn/ioc3.c5
-rw-r--r--drivers/usb/atm/ueagle-atm.c52
-rw-r--r--drivers/usb/core/Kconfig7
-rw-r--r--drivers/usb/core/hcd-pci.c7
-rw-r--r--drivers/usb/core/hub.c8
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/gadget/Kconfig4
-rw-r--r--drivers/usb/gadget/at91_udc.c4
-rw-r--r--drivers/usb/gadget/ether.c6
-rw-r--r--drivers/usb/gadget/file_storage.c38
-rw-r--r--drivers/usb/gadget/gadget_chips.h6
-rw-r--r--drivers/usb/gadget/inode.c24
-rw-r--r--drivers/usb/gadget/net2280.c93
-rw-r--r--drivers/usb/gadget/net2280.h415
-rw-r--r--drivers/usb/gadget/zero.c7
-rw-r--r--drivers/usb/host/ohci-at91.c35
-rw-r--r--drivers/usb/host/ohci-s3c2410.c41
-rw-r--r--drivers/usb/host/pci-quirks.c1
-rw-r--r--drivers/usb/host/pci-quirks.h7
-rw-r--r--drivers/usb/host/uhci-hcd.c7
-rw-r--r--drivers/usb/host/uhci-hcd.h1
-rw-r--r--drivers/usb/host/uhci-hub.c18
-rw-r--r--drivers/usb/input/Kconfig56
-rw-r--r--drivers/usb/input/Makefile1
-rw-r--r--drivers/usb/input/hid-core.c14
-rw-r--r--drivers/usb/input/hid-ff.c6
-rw-r--r--drivers/usb/input/hid.h5
-rw-r--r--drivers/usb/input/keyspan_remote.c2
-rw-r--r--drivers/usb/input/usbtouchscreen.c605
-rw-r--r--drivers/usb/input/wacom.c136
-rw-r--r--drivers/usb/misc/usbtest.c13
-rw-r--r--drivers/usb/net/asix.c327
-rw-r--r--drivers/usb/net/pegasus.c2
-rw-r--r--drivers/usb/net/rndis_host.c28
-rw-r--r--drivers/usb/serial/Kconfig9
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/console.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h15
-rw-r--r--drivers/usb/serial/funsoft.c65
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h4
-rw-r--r--drivers/usb/serial/usb-serial.c16
-rw-r--r--drivers/usb/serial/usb-serial.h6
-rw-r--r--drivers/usb/storage/Kconfig3
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_base.c2
-rw-r--r--drivers/video/fbmem.c19
-rw-r--r--drivers/video/pm2fb.c4
-rw-r--r--drivers/video/savage/savagefb_driver.c8
-rw-r--r--drivers/video/vesafb.c27
-rw-r--r--fs/9p/vfs_super.c13
-rw-r--r--fs/Kconfig9
-rw-r--r--fs/configfs/dir.c2
-rw-r--r--fs/eventpoll.c4
-rw-r--r--fs/exec.c46
-rw-r--r--fs/ext3/resize.c2
-rw-r--r--fs/fifo.c65
-rw-r--r--fs/fuse/dev.c286
-rw-r--r--fs/fuse/dir.c118
-rw-r--r--fs/fuse/file.c66
-rw-r--r--fs/fuse/fuse_i.h72
-rw-r--r--fs/fuse/inode.c158
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/lockd/svclock.c2
-rw-r--r--fs/locks.c9
-rw-r--r--fs/namespace.c7
-rw-r--r--fs/nfs/dir.c5
-rw-r--r--fs/nfs/direct.c8
-rw-r--r--fs/nfs/file.c5
-rw-r--r--fs/nfs/inode.c5
-rw-r--r--fs/nfs/nfs4proc.c10
-rw-r--r--fs/nfsd/auth.c46
-rw-r--r--fs/nfsd/export.c3
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs4acl.c8
-rw-r--r--fs/nfsd/nfs4callback.c6
-rw-r--r--fs/nfsd/nfs4proc.c4
-rw-r--r--fs/nfsd/nfs4state.c150
-rw-r--r--fs/nfsd/nfs4xdr.c62
-rw-r--r--fs/nfsd/nfsproc.c2
-rw-r--r--fs/nfsd/vfs.c6
-rw-r--r--fs/ocfs2/cluster/heartbeat.c40
-rw-r--r--fs/ocfs2/dlm/userdlm.c74
-rw-r--r--fs/ocfs2/file.c19
-rw-r--r--fs/open.c24
-rw-r--r--fs/partitions/check.c43
-rw-r--r--fs/pipe.c317
-rw-r--r--fs/proc/base.c21
-rw-r--r--fs/proc/vmcore.c4
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/select.c30
-rw-r--r--fs/splice.c866
-rw-r--r--fs/sync.c4
-rw-r--r--fs/sysfs/dir.c1
-rw-r--r--fs/sysfs/file.c76
-rw-r--r--fs/sysfs/sysfs.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c20
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h8
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h16
-rw-r--r--fs/xfs/xfs_ialloc.c15
-rw-r--r--fs/xfs/xfs_iget.c29
-rw-r--r--fs/xfs/xfs_inode.c27
-rw-r--r--fs/xfs/xfs_inode.h1
-rw-r--r--fs/xfs/xfs_mount.c2
-rw-r--r--include/asm-alpha/numnodes.h7
-rw-r--r--include/asm-arm/arch-cl7500/hardware.h4
-rw-r--r--include/asm-arm/arch-cl7500/memory.h6
-rw-r--r--include/asm-arm/arch-ebsa110/debug-macro.S2
-rw-r--r--include/asm-arm/arch-ebsa110/hardware.h3
-rw-r--r--include/asm-arm/arch-ebsa110/memory.h6
-rw-r--r--include/asm-arm/arch-ebsa110/uncompress.h2
-rw-r--r--include/asm-arm/arch-ebsa285/hardware.h7
-rw-r--r--include/asm-arm/arch-ebsa285/memory.h12
-rw-r--r--include/asm-arm/arch-ixp23xx/debug-macro.S3
-rw-r--r--include/asm-arm/arch-l7200/hardware.h3
-rw-r--r--include/asm-arm/arch-l7200/memory.h6
-rw-r--r--include/asm-arm/arch-lh7a40x/memory.h2
-rw-r--r--include/asm-arm/arch-rpc/hardware.h3
-rw-r--r--include/asm-arm/arch-rpc/memory.h6
-rw-r--r--include/asm-arm/arch-s3c2410/leds-gpio.h28
-rw-r--r--include/asm-arm/arch-sa1100/hardware.h4
-rw-r--r--include/asm-arm/arch-sa1100/memory.h7
-rw-r--r--include/asm-arm/arch-shark/hardware.h6
-rw-r--r--include/asm-arm/arch-shark/memory.h6
-rw-r--r--include/asm-arm/fpstate.h2
-rw-r--r--include/asm-arm/memory.h8
-rw-r--r--include/asm-arm/numnodes.h26
-rw-r--r--include/asm-arm/unistd.h18
-rw-r--r--include/asm-arm/vfpmacros.h8
-rw-r--r--include/asm-cris/system.h1
-rw-r--r--include/asm-cris/unistd.h2
-rw-r--r--include/asm-frv/system.h2
-rw-r--r--include/asm-frv/unistd.h2
-rw-r--r--include/asm-h8300/system.h2
-rw-r--r--include/asm-h8300/unistd.h2
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/atomic.h5
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/e820.h4
-rw-r--r--include/asm-i386/hpet.h1
-rw-r--r--include/asm-i386/i387.h30
-rw-r--r--include/asm-i386/mpspec.h1
-rw-r--r--include/asm-i386/numnodes.h18
-rw-r--r--include/asm-i386/unistd.h9
-rw-r--r--include/asm-ia64/acpi-ext.h11
-rw-r--r--include/asm-ia64/kdebug.h2
-rw-r--r--include/asm-ia64/mca.h5
-rw-r--r--include/asm-ia64/mutex.h2
-rw-r--r--include/asm-ia64/numnodes.h20
-rw-r--r--include/asm-ia64/unistd.h6
-rw-r--r--include/asm-ia64/vga.h2
-rw-r--r--include/asm-m32r/assembler.h5
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h22
-rw-r--r--include/asm-m32r/numnodes.h15
-rw-r--r--include/asm-m32r/ptrace.h25
-rw-r--r--include/asm-m32r/semaphore.h64
-rw-r--r--include/asm-m32r/sigcontext.h2
-rw-r--r--include/asm-m32r/smp.h3
-rw-r--r--include/asm-m32r/system.h71
-rw-r--r--include/asm-m32r/uaccess.h266
-rw-r--r--include/asm-m32r/unistd.h2
-rw-r--r--include/asm-mips/asmmacro.h47
-rw-r--r--include/asm-mips/cacheflush.h1
-rw-r--r--include/asm-mips/cpu-features.h2
-rw-r--r--include/asm-mips/cpu-info.h10
-rw-r--r--include/asm-mips/ds1742.h13
-rw-r--r--include/asm-mips/elf.h45
-rw-r--r--include/asm-mips/fpu.h4
-rw-r--r--include/asm-mips/hazards.h2
-rw-r--r--include/asm-mips/interrupt.h65
-rw-r--r--include/asm-mips/irq.h30
-rw-r--r--include/asm-mips/kspd.h36
-rw-r--r--include/asm-mips/mach-generic/ide.h46
-rw-r--r--include/asm-mips/mach-jmr3927/ds1742.h4
-rw-r--r--include/asm-mips/mach-mips/param.h13
-rw-r--r--include/asm-mips/marvell.h2
-rw-r--r--include/asm-mips/mips-boards/atlas.h18
-rw-r--r--include/asm-mips/mips-boards/atlasint.h19
-rw-r--r--include/asm-mips/mips_mt.h15
-rw-r--r--include/asm-mips/mipsmtregs.h16
-rw-r--r--include/asm-mips/mipsregs.h136
-rw-r--r--include/asm-mips/mmu_context.h112
-rw-r--r--include/asm-mips/numnodes.h7
-rw-r--r--include/asm-mips/processor.h22
-rw-r--r--include/asm-mips/ptrace.h4
-rw-r--r--include/asm-mips/r4kcache.h130
-rw-r--r--include/asm-mips/rtc.h4
-rw-r--r--include/asm-mips/rtlx.h38
-rw-r--r--include/asm-mips/serial.h12
-rw-r--r--include/asm-mips/smtc.h55
-rw-r--r--include/asm-mips/smtc_ipi.h118
-rw-r--r--include/asm-mips/smtc_proc.h23
-rw-r--r--include/asm-mips/stackframe.h187
-rw-r--r--include/asm-mips/system.h34
-rw-r--r--include/asm-mips/unistd.h18
-rw-r--r--include/asm-mips/vpe.h37
-rw-r--r--include/asm-parisc/numnodes.h7
-rw-r--r--include/asm-powerpc/irq.h7
-rw-r--r--include/asm-powerpc/numnodes.h9
-rw-r--r--include/asm-powerpc/thread_info.h8
-rw-r--r--include/asm-powerpc/unistd.h3
-rw-r--r--include/asm-s390/atomic.h2
-rw-r--r--include/asm-s390/ebcdic.h12
-rw-r--r--include/asm-sh/numnodes.h7
-rw-r--r--include/asm-sh/unistd.h2
-rw-r--r--include/asm-sh64/unistd.h2
-rw-r--r--include/asm-sparc/unistd.h4
-rw-r--r--include/asm-sparc/vga.h33
-rw-r--r--include/asm-sparc64/percpu.h2
-rw-r--r--include/asm-sparc64/unistd.h4
-rw-r--r--include/asm-um/ptrace-i386.h3
-rw-r--r--include/asm-v850/system.h2
-rw-r--r--include/asm-x86_64/cache.h4
-rw-r--r--include/asm-x86_64/cpufeature.h1
-rw-r--r--include/asm-x86_64/e820.h3
-rw-r--r--include/asm-x86_64/hpet.h2
-rw-r--r--include/asm-x86_64/i387.h20
-rw-r--r--include/asm-x86_64/ia32_unistd.h2
-rw-r--r--include/asm-x86_64/io.h2
-rw-r--r--include/asm-x86_64/mce.h7
-rw-r--r--include/asm-x86_64/mmzone.h3
-rw-r--r--include/asm-x86_64/numa.h3
-rw-r--r--include/asm-x86_64/numnodes.h12
-rw-r--r--include/asm-x86_64/percpu.h2
-rw-r--r--include/asm-x86_64/timex.h2
-rw-r--r--include/asm-x86_64/unistd.h6
-rw-r--r--include/asm-xtensa/ioctls.h2
-rw-r--r--include/asm-xtensa/system.h2
-rw-r--r--include/linux/blkdev.h4
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/fs.h19
-rw-r--r--include/linux/genhd.h1
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/leds.h51
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mm.h5
-rw-r--r--include/linux/mv643xx.h2
-rw-r--r--include/linux/netfilter.h42
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h52
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h (renamed from net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.h)0
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h (renamed from net/ipv4/netfilter/ip_conntrack_helper_h323_types.h)0
-rw-r--r--include/linux/netfilter_ipv6.h3
-rw-r--r--include/linux/numa.h8
-rw-r--r--include/linux/page-flags.h24
-rw-r--r--include/linux/pci.h33
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/pipe_fs_i.h19
-rw-r--r--include/linux/pm.h8
-rw-r--r--include/linux/pm_legacy.h7
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/sched.h15
-rw-r--r--include/linux/screen_info.h3
-rw-r--r--include/linux/sdla_asy.h226
-rw-r--r--include/linux/sdla_chdlc.h813
-rw-r--r--include/linux/sdla_ppp.h575
-rw-r--r--include/linux/sdla_x25.h772
-rw-r--r--include/linux/sdladrv.h66
-rw-r--r--include/linux/sdlapci.h72
-rw-r--r--include/linux/sdlasfm.h104
-rw-r--r--include/linux/seqlock.h4
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/string.h17
-rw-r--r--include/linux/sunrpc/metrics.h12
-rw-r--r--include/linux/sunrpc/svc.h9
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/linux/swap.h1
-rw-r--r--include/linux/syscalls.h11
-rw-r--r--include/linux/sysfs.h6
-rw-r--r--include/linux/tty_flip.h25
-rw-r--r--include/linux/usb/net2280.h444
-rw-r--r--include/linux/vermagic.h7
-rw-r--r--include/linux/wanpipe.h483
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/ieee80211softmac.h3
-rw-r--r--include/net/inet6_hashtables.h70
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/sock.h1
-rw-r--r--include/net/x25device.h1
-rw-r--r--include/net/xfrm.h8
-rw-r--r--include/rdma/ib_sa.h28
-rw-r--r--include/rdma/ib_verbs.h28
-rw-r--r--include/scsi/scsi_devinfo.h1
-rw-r--r--include/scsi/scsi_host.h1
-rw-r--r--include/scsi/scsi_ioctl.h2
-rw-r--r--include/scsi/scsi_transport.h5
-rw-r--r--include/scsi/scsi_transport_fc.h41
-rw-r--r--include/sound/pcm.h3
-rw-r--r--ipc/shm.c2
-rw-r--r--ipc/util.c3
-rw-r--r--kernel/exit.c6
-rw-r--r--kernel/fork.c9
-rw-r--r--kernel/hrtimer.c1
-rw-r--r--kernel/irq/Makefile3
-rw-r--r--kernel/irq/migration.c5
-rw-r--r--kernel/kprobes.c3
-rw-r--r--kernel/panic.c1
-rw-r--r--kernel/power/pm.c20
-rw-r--r--kernel/power/snapshot.c9
-rw-r--r--kernel/ptrace.c7
-rw-r--r--kernel/sched.c62
-rw-r--r--kernel/signal.c5
-rw-r--r--kernel/sys_ni.c12
-rw-r--r--kernel/timer.c31
-rw-r--r--kernel/uid16.c59
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/kobject.c1
-rw-r--r--lib/string.c5
-rw-r--r--mm/bootmem.c9
-rw-r--r--mm/madvise.c3
-rw-r--r--mm/mempolicy.c1
-rw-r--r--mm/migrate.c8
-rw-r--r--mm/mmap.c34
-rw-r--r--mm/nommu.c18
-rw-r--r--mm/oom_kill.c71
-rw-r--r--mm/page-writeback.c5
-rw-r--r--mm/page_alloc.c80
-rw-r--r--mm/slab.c30
-rw-r--r--mm/slob.c10
-rw-r--r--net/atm/clip.c460
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/bridge/br_input.c3
-rw-r--r--net/bridge/br_netfilter.c13
-rw-r--r--net/bridge/netfilter/ebtables.c38
-rw-r--r--net/core/dev.c10
-rw-r--r--net/core/dv.c5
-rw-r--r--net/core/filter.c5
-rw-r--r--net/core/flow.c8
-rw-r--r--net/core/gen_estimator.c3
-rw-r--r--net/core/neighbour.c16
-rw-r--r--net/core/net-sysfs.c2
-rw-r--r--net/core/request_sock.c4
-rw-r--r--net/core/skbuff.c8
-rw-r--r--net/core/stream.c1
-rw-r--r--net/core/utils.c4
-rw-r--r--net/core/wireless.c8
-rw-r--r--net/dccp/ipv4.c2
-rw-r--r--net/ieee80211/softmac/Kconfig1
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_assoc.c5
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_event.c40
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_io.c18
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_scan.c2
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c10
-rw-r--r--net/ipv4/arp.c4
-rw-r--r--net/ipv4/devinet.c1
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/fib_trie.c14
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/inet_hashtables.c4
-rw-r--r--net/ipv4/ip_fragment.c15
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_output.c8
-rw-r--r--net/ipv4/ipcomp.c13
-rw-r--r--net/ipv4/ipip.c4
-rw-r--r--net/ipv4/netfilter.c50
-rw-r--r--net/ipv4/netfilter/Kconfig1
-rw-r--r--net/ipv4/netfilter/arp_tables.c4
-rw-r--r--net/ipv4/netfilter/arptable_filter.c19
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323.c66
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c23
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c7
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_udp.c7
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c268
-rw-r--r--net/ipv4/netfilter/ip_nat_helper_h323.c71
-rw-r--r--net/ipv4/netfilter/ip_nat_rule.c2
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c159
-rw-r--r--net/ipv4/netfilter/ip_queue.c31
-rw-r--r--net/ipv4/netfilter/ip_tables.c4
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c40
-rw-r--r--net/ipv4/netfilter/ipt_REJECT.c9
-rw-r--r--net/ipv4/netfilter/iptable_filter.c21
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c33
-rw-r--r--net/ipv4/netfilter/iptable_raw.c35
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c223
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c20
-rw-r--r--net/ipv4/proc.c4
-rw-r--r--net/ipv4/route.c7
-rw-r--r--net/ipv4/tcp_input.c1
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv4/tcp_output.c11
-rw-r--r--net/ipv4/tunnel4.c8
-rw-r--r--net/ipv4/xfrm4_input.c4
-rw-r--r--net/ipv6/exthdrs.c16
-rw-r--r--net/ipv6/icmp.c4
-rw-r--r--net/ipv6/inet6_hashtables.c80
-rw-r--r--net/ipv6/ip6_input.c3
-rw-r--r--net/ipv6/ip6_tunnel.c12
-rw-r--r--net/ipv6/ipcomp6.c8
-rw-r--r--net/ipv6/netfilter.c52
-rw-r--r--net/ipv6/netfilter/ip6_queue.c31
-rw-r--r--net/ipv6/netfilter/ip6_tables.c4
-rw-r--r--net/ipv6/netfilter/ip6table_filter.c21
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c33
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c15
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c179
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c12
-rw-r--r--net/ipv6/proc.c4
-rw-r--r--net/ipv6/reassembly.c18
-rw-r--r--net/ipv6/sit.c2
-rw-r--r--net/ipv6/tunnel6.c8
-rw-r--r--net/ipv6/xfrm6_policy.c8
-rw-r--r--net/llc/llc_input.c3
-rw-r--r--net/netfilter/core.c51
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c50
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c50
-rw-r--r--net/netfilter/nf_conntrack_standalone.c115
-rw-r--r--net/netfilter/nf_queue.c49
-rw-r--r--net/netfilter/nfnetlink_log.c25
-rw-r--r--net/netfilter/nfnetlink_queue.c27
-rw-r--r--net/netfilter/x_tables.c4
-rw-r--r--net/sched/act_police.c8
-rw-r--r--net/sctp/proc.c2
-rw-r--r--net/socket.c7
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c1
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c11
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c14
-rw-r--r--net/sunrpc/stats.c3
-rw-r--r--net/tipc/name_distr.c3
-rw-r--r--net/wanrouter/af_wanpipe.c2
-rw-r--r--net/xfrm/xfrm_state.c25
-rw-r--r--scripts/Kbuild.include5
-rw-r--r--scripts/Makefile.lib5
-rwxr-xr-x[-rw-r--r--]scripts/bloat-o-meter0
-rwxr-xr-x[-rw-r--r--]scripts/checkstack.pl0
-rw-r--r--scripts/gen_initramfs_list.sh225
-rw-r--r--scripts/kconfig/conf.c24
-rw-r--r--scripts/kconfig/confdata.c2
-rw-r--r--scripts/kconfig/lxdialog/checklist.c19
-rw-r--r--scripts/kconfig/lxdialog/menubox.c19
-rw-r--r--scripts/mod/modpost.c15
-rwxr-xr-x[-rw-r--r--]scripts/namespace.pl0
-rwxr-xr-x[-rw-r--r--]scripts/show_delta0
-rwxr-xr-xscripts/ver_linux4
-rw-r--r--security/keys/key.c4
-rw-r--r--security/keys/keyring.c1
-rw-r--r--security/keys/process_keys.c41
-rw-r--r--security/selinux/ss/mls.c2
-rw-r--r--security/selinux/xfrm.c4
-rw-r--r--sound/core/oss/pcm_oss.c7
-rw-r--r--sound/core/pcm.c2
-rw-r--r--sound/core/pcm_native.c6
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c42
-rw-r--r--sound/isa/ad1848/ad1848.c16
-rw-r--r--sound/isa/adlib.c11
-rw-r--r--sound/isa/cmi8330.c16
-rw-r--r--sound/isa/cs423x/cs4231.c16
-rw-r--r--sound/isa/cs423x/cs4236.c16
-rw-r--r--sound/isa/es1688/es1688.c16
-rw-r--r--sound/isa/es18xx.c16
-rw-r--r--sound/isa/gus/gusclassic.c16
-rw-r--r--sound/isa/gus/gusextreme.c16
-rw-r--r--sound/isa/gus/gusmax.c16
-rw-r--r--sound/isa/gus/interwave.c16
-rw-r--r--sound/isa/opl3sa2.c16
-rw-r--r--sound/isa/opti9xx/miro.c7
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c7
-rw-r--r--sound/isa/sb/sb16.c16
-rw-r--r--sound/isa/sb/sb8.c16
-rw-r--r--sound/isa/sgalaxy.c16
-rw-r--r--sound/isa/sscape.c16
-rw-r--r--sound/isa/wavefront/wavefront.c16
-rw-r--r--sound/oss/Kconfig318
-rw-r--r--sound/oss/emu10k1/main.c3
-rw-r--r--sound/pci/ac97/ac97_codec.c1
-rw-r--r--sound/pci/als300.c5
-rw-r--r--sound/pci/au88x0/au88x0.h13
-rw-r--r--sound/pci/au88x0/au88x0_core.c2
-rw-r--r--sound/pci/au88x0/au88x0_eq.c2
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c2
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c5
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_sigmatel.c3
-rw-r--r--sound/pci/via82xx.c1
-rw-r--r--usr/Makefile91
-rw-r--r--usr/gen_init_cpio.c4
1121 files changed, 22717 insertions, 56251 deletions
diff --git a/CREDITS b/CREDITS
index 0bf31eac6dc2..787564bc248b 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3382,7 +3382,7 @@ S: Germany
3382 3382
3383N: Geert Uytterhoeven 3383N: Geert Uytterhoeven
3384E: geert@linux-m68k.org 3384E: geert@linux-m68k.org
3385W: http://home.tvd.be/cr26864/ 3385W: http://users.telenet.be/geertu/
3386P: 1024/862678A6 C51D 361C 0BD1 4C90 B275 C553 6EEA 11BA 8626 78A6 3386P: 1024/862678A6 C51D 361C 0BD1 4C90 B275 C553 6EEA 11BA 8626 78A6
3387D: m68k/Amiga and PPC/CHRP Longtrail coordinator 3387D: m68k/Amiga and PPC/CHRP Longtrail coordinator
3388D: Frame buffer device and XF68_FBDev maintainer 3388D: Frame buffer device and XF68_FBDev maintainer
@@ -3392,8 +3392,8 @@ D: Amiga Buddha and Catweasel chipset IDE
3392D: Atari Falcon chipset IDE 3392D: Atari Falcon chipset IDE
3393D: Amiga Gayle chipset IDE 3393D: Amiga Gayle chipset IDE
3394D: mipsel NEC DDB Vrc-5074 3394D: mipsel NEC DDB Vrc-5074
3395S: Emiel Vlieberghlaan 2A/21 3395S: Haterbeekstraat 55B
3396S: B-3010 Kessel-Lo 3396S: B-3200 Aarschot
3397S: Belgium 3397S: Belgium
3398 3398
3399N: Chris Vance 3399N: Chris Vance
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 1af0f2d50220..2ffb0d62f0fe 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -33,7 +33,9 @@ pci_alloc_consistent(struct pci_dev *dev, size_t size,
33 33
34Consistent memory is memory for which a write by either the device or 34Consistent memory is memory for which a write by either the device or
35the processor can immediately be read by the processor or device 35the processor can immediately be read by the processor or device
36without having to worry about caching effects. 36without having to worry about caching effects. (You may however need
37to make sure to flush the processor's write buffers before telling
38devices to read that memory.)
37 39
38This routine allocates a region of <size> bytes of consistent memory. 40This routine allocates a region of <size> bytes of consistent memory.
39it also returns a <dma_handle> which may be cast to an unsigned 41it also returns a <dma_handle> which may be cast to an unsigned
@@ -304,12 +306,12 @@ dma address with dma_mapping_error(). A non zero return value means the mapping
304could not be created and the driver should take appropriate action (eg 306could not be created and the driver should take appropriate action (eg
305reduce current DMA mapping usage or delay and try again later). 307reduce current DMA mapping usage or delay and try again later).
306 308
307int 309 int
308dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 310 dma_map_sg(struct device *dev, struct scatterlist *sg,
309 enum dma_data_direction direction) 311 int nents, enum dma_data_direction direction)
310int 312 int
311pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, 313 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
312 int nents, int direction) 314 int nents, int direction)
313 315
314Maps a scatter gather list from the block layer. 316Maps a scatter gather list from the block layer.
315 317
@@ -327,12 +329,33 @@ critical that the driver do something, in the case of a block driver
327aborting the request or even oopsing is better than doing nothing and 329aborting the request or even oopsing is better than doing nothing and
328corrupting the filesystem. 330corrupting the filesystem.
329 331
330void 332With scatterlists, you use the resulting mapping like this:
331dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 333
332 enum dma_data_direction direction) 334 int i, count = dma_map_sg(dev, sglist, nents, direction);
333void 335 struct scatterlist *sg;
334pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, 336
335 int nents, int direction) 337 for (i = 0, sg = sglist; i < count; i++, sg++) {
338 hw_address[i] = sg_dma_address(sg);
339 hw_len[i] = sg_dma_len(sg);
340 }
341
342where nents is the number of entries in the sglist.
343
344The implementation is free to merge several consecutive sglist entries
345into one (e.g. with an IOMMU, or if several pages just happen to be
346physically contiguous) and returns the actual number of sg entries it
347mapped them to. On failure 0, is returned.
348
349Then you should loop count times (note: this can be less than nents times)
350and use sg_dma_address() and sg_dma_len() macros where you previously
351accessed sg->address and sg->length as shown above.
352
353 void
354 dma_unmap_sg(struct device *dev, struct scatterlist *sg,
355 int nhwentries, enum dma_data_direction direction)
356 void
357 pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
358 int nents, int direction)
336 359
337unmap the previously mapped scatter/gather list. All the parameters 360unmap the previously mapped scatter/gather list. All the parameters
338must be the same as those and passed in to the scatter/gather mapping 361must be the same as those and passed in to the scatter/gather mapping
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index ee4bb73683cd..7c717699032c 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -58,11 +58,15 @@ translating each of those pages back to a kernel address using
58something like __va(). [ EDIT: Update this when we integrate 58something like __va(). [ EDIT: Update this when we integrate
59Gerd Knorr's generic code which does this. ] 59Gerd Knorr's generic code which does this. ]
60 60
61This rule also means that you may not use kernel image addresses 61This rule also means that you may use neither kernel image addresses
62(ie. items in the kernel's data/text/bss segment, or your driver's) 62(items in data/text/bss segments), nor module image addresses, nor
63nor may you use kernel stack addresses for DMA. Both of these items 63stack addresses for DMA. These could all be mapped somewhere entirely
64might be mapped somewhere entirely different than the rest of physical 64different than the rest of physical memory. Even if those classes of
65memory. 65memory could physically work with DMA, you'd need to ensure the I/O
66buffers were cacheline-aligned. Without that, you'd see cacheline
67sharing problems (data corruption) on CPUs with DMA-incoherent caches.
68(The CPU could write to one word, DMA would write to a different one
69in the same cache line, and one of them could be overwritten.)
66 70
67Also, this means that you cannot take the return of a kmap() 71Also, this means that you cannot take the return of a kmap()
68call and DMA to/from that. This is similar to vmalloc(). 72call and DMA to/from that. This is similar to vmalloc().
@@ -194,7 +198,7 @@ document for how to handle this case.
194Finally, if your device can only drive the low 24-bits of 198Finally, if your device can only drive the low 24-bits of
195address during PCI bus mastering you might do something like: 199address during PCI bus mastering you might do something like:
196 200
197 if (pci_set_dma_mask(pdev, 0x00ffffff)) { 201 if (pci_set_dma_mask(pdev, DMA_24BIT_MASK)) {
198 printk(KERN_WARNING 202 printk(KERN_WARNING
199 "mydev: 24-bit DMA addressing not available.\n"); 203 "mydev: 24-bit DMA addressing not available.\n");
200 goto ignore_this_device; 204 goto ignore_this_device;
@@ -212,7 +216,7 @@ functions (for example a sound card provides playback and record
212functions) and the various different functions have _different_ 216functions) and the various different functions have _different_
213DMA addressing limitations, you may wish to probe each mask and 217DMA addressing limitations, you may wish to probe each mask and
214only provide the functionality which the machine can handle. It 218only provide the functionality which the machine can handle. It
215is important that the last call to pci_set_dma_mask() be for the 219is important that the last call to pci_set_dma_mask() be for the
216most specific mask. 220most specific mask.
217 221
218Here is pseudo-code showing how this might be done: 222Here is pseudo-code showing how this might be done:
@@ -284,6 +288,11 @@ There are two types of DMA mappings:
284 288
285 in order to get correct behavior on all platforms. 289 in order to get correct behavior on all platforms.
286 290
291 Also, on some platforms your driver may need to flush CPU write
292 buffers in much the same way as it needs to flush write buffers
293 found in PCI bridges (such as by reading a register's value
294 after writing it).
295
287- Streaming DMA mappings which are usually mapped for one DMA transfer, 296- Streaming DMA mappings which are usually mapped for one DMA transfer,
288 unmapped right after it (unless you use pci_dma_sync_* below) and for which 297 unmapped right after it (unless you use pci_dma_sync_* below) and for which
289 hardware can optimize for sequential accesses. 298 hardware can optimize for sequential accesses.
@@ -303,6 +312,9 @@ There are two types of DMA mappings:
303 312
304Neither type of DMA mapping has alignment restrictions that come 313Neither type of DMA mapping has alignment restrictions that come
305from PCI, although some devices may have such restrictions. 314from PCI, although some devices may have such restrictions.
315Also, systems with caches that aren't DMA-coherent will work better
316when the underlying buffers don't share cache lines with other data.
317
306 318
307 Using Consistent DMA mappings. 319 Using Consistent DMA mappings.
308 320
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl
index 5bcbb6ee3bc0..f869b03929db 100644
--- a/Documentation/DocBook/libata.tmpl
+++ b/Documentation/DocBook/libata.tmpl
@@ -705,7 +705,7 @@ and other resources, etc.
705 705
706 <sect1><title>ata_scsi_error()</title> 706 <sect1><title>ata_scsi_error()</title>
707 <para> 707 <para>
708 ata_scsi_error() is the current hostt->eh_strategy_handler() 708 ata_scsi_error() is the current transportt->eh_strategy_handler()
709 for libata. As discussed above, this will be entered in two 709 for libata. As discussed above, this will be entered in two
710 cases - timeout and ATAPI error completion. This function 710 cases - timeout and ATAPI error completion. This function
711 calls low level libata driver's eng_timeout() callback, the 711 calls low level libata driver's eng_timeout() callback, the
diff --git a/Documentation/block/switching-sched.txt b/Documentation/block/switching-sched.txt
new file mode 100644
index 000000000000..5fa130a67531
--- /dev/null
+++ b/Documentation/block/switching-sched.txt
@@ -0,0 +1,22 @@
1As of the Linux 2.6.10 kernel, it is now possible to change the
2IO scheduler for a given block device on the fly (thus making it possible,
3for instance, to set the CFQ scheduler for the system default, but
4set a specific device to use the anticipatory or noop schedulers - which
5can improve that device's throughput).
6
7To set a specific scheduler, simply do this:
8
9echo SCHEDNAME > /sys/block/DEV/queue/scheduler
10
11where SCHEDNAME is the name of a defined IO scheduler, and DEV is the
12device name (hda, hdb, sga, or whatever you happen to have).
13
14The list of defined schedulers can be found by simply doing
15a "cat /sys/block/DEV/queue/scheduler" - the list of valid names
16will be displayed, with the currently selected scheduler in brackets:
17
18# cat /sys/block/hda/queue/scheduler
19noop anticipatory deadline [cfq]
20# echo anticipatory > /sys/block/hda/queue/scheduler
21# cat /sys/block/hda/queue/scheduler
22noop [anticipatory] deadline cfq
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt
index 5009805f9378..ffdb5323df37 100644
--- a/Documentation/cpu-freq/index.txt
+++ b/Documentation/cpu-freq/index.txt
@@ -53,4 +53,4 @@ the CPUFreq Mailing list:
53* http://lists.linux.org.uk/mailman/listinfo/cpufreq 53* http://lists.linux.org.uk/mailman/listinfo/cpufreq
54 54
55Clock and voltage scaling for the SA-1100: 55Clock and voltage scaling for the SA-1100:
56* http://www.lart.tudelft.nl/projects/scaling 56* http://www.lartmaker.nl/projects/scaling
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 59d0c74c79c9..421bcfff6ad2 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -25,8 +25,9 @@ Who: Adrian Bunk <bunk@stusta.de>
25 25
26--------------------------- 26---------------------------
27 27
28What: drivers depending on OBSOLETE_OSS_DRIVER 28What: drivers that were depending on OBSOLETE_OSS_DRIVER
29When: January 2006 29 (config options already removed)
30When: before 2.6.19
30Why: OSS drivers with ALSA replacements 31Why: OSS drivers with ALSA replacements
31Who: Adrian Bunk <bunk@stusta.de> 32Who: Adrian Bunk <bunk@stusta.de>
32 33
@@ -71,14 +72,6 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
71 72
72--------------------------- 73---------------------------
73 74
74What: remove EXPORT_SYMBOL(panic_timeout)
75When: April 2006
76Files: kernel/panic.c
77Why: No modular usage in the kernel.
78Who: Adrian Bunk <bunk@stusta.de>
79
80---------------------------
81
82What: remove EXPORT_SYMBOL(insert_resource) 75What: remove EXPORT_SYMBOL(insert_resource)
83When: April 2006 76When: April 2006
84Files: kernel/resource.c 77Files: kernel/resource.c
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index adaa899e5c90..3a2e5520c1e3 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -694,7 +694,7 @@ struct file_operations
694---------------------- 694----------------------
695 695
696This describes how the VFS can manipulate an open file. As of kernel 696This describes how the VFS can manipulate an open file. As of kernel
6972.6.13, the following members are defined: 6972.6.17, the following members are defined:
698 698
699struct file_operations { 699struct file_operations {
700 loff_t (*llseek) (struct file *, loff_t, int); 700 loff_t (*llseek) (struct file *, loff_t, int);
@@ -723,6 +723,10 @@ struct file_operations {
723 int (*check_flags)(int); 723 int (*check_flags)(int);
724 int (*dir_notify)(struct file *filp, unsigned long arg); 724 int (*dir_notify)(struct file *filp, unsigned long arg);
725 int (*flock) (struct file *, int, struct file_lock *); 725 int (*flock) (struct file *, int, struct file_lock *);
726 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned
727int);
728 ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned
729int);
726}; 730};
727 731
728Again, all methods are called without any locks being held, unless 732Again, all methods are called without any locks being held, unless
@@ -790,6 +794,12 @@ otherwise noted.
790 794
791 flock: called by the flock(2) system call 795 flock: called by the flock(2) system call
792 796
797 splice_write: called by the VFS to splice data from a pipe to a file. This
798 method is used by the splice(2) system call
799
800 splice_read: called by the VFS to splice data from file to a pipe. This
801 method is used by the splice(2) system call
802
793Note that the file operations are implemented by the specific 803Note that the file operations are implemented by the specific
794filesystem in which the inode resides. When opening a device node 804filesystem in which the inode resides. When opening a device node
795(character or block special) most filesystems will call special 805(character or block special) most filesystems will call special
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport
index d9f23c0763f1..77b995dfca22 100644
--- a/Documentation/i2c/busses/i2c-parport
+++ b/Documentation/i2c/busses/i2c-parport
@@ -12,18 +12,22 @@ meant as a replacement for the older, individual drivers:
12 teletext adapters) 12 teletext adapters)
13 13
14It currently supports the following devices: 14It currently supports the following devices:
15 * Philips adapter 15 * (type=0) Philips adapter
16 * home brew teletext adapter 16 * (type=1) home brew teletext adapter
17 * Velleman K8000 adapter 17 * (type=2) Velleman K8000 adapter
18 * ELV adapter 18 * (type=3) ELV adapter
19 * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) 19 * (type=4) Analog Devices ADM1032 evaluation board
20 * Barco LPT->DVI (K5800236) adapter 20 * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031
21 * (type=6) Barco LPT->DVI (K5800236) adapter
21 22
22These devices use different pinout configurations, so you have to tell 23These devices use different pinout configurations, so you have to tell
23the driver what you have, using the type module parameter. There is no 24the driver what you have, using the type module parameter. There is no
24way to autodetect the devices. Support for different pinout configurations 25way to autodetect the devices. Support for different pinout configurations
25can be easily added when needed. 26can be easily added when needed.
26 27
28Earlier kernels defaulted to type=0 (Philips). But now, if the type
29parameter is missing, the driver will simply fail to initialize.
30
27 31
28Building your own adapter 32Building your own adapter
29------------------------- 33-------------------------
diff --git a/Documentation/isdn/README.gigaset b/Documentation/isdn/README.gigaset
new file mode 100644
index 000000000000..85a64defd385
--- /dev/null
+++ b/Documentation/isdn/README.gigaset
@@ -0,0 +1,286 @@
1GigaSet 307x Device Driver
2==========================
3
41. Requirements
5 ------------
61.1. Hardware
7 --------
8 This release supports the connection of the Gigaset 307x/417x family of
9 ISDN DECT bases via Gigaset M101 Data, Gigaset M105 Data or direct USB
10 connection. The following devices are reported to be compatible:
11 307x/417x:
12 Gigaset SX255isdn
13 Gigaset SX353isdn
14 Sinus 45 [AB] isdn (Deutsche Telekom)
15 Sinus 721X/XA
16 Vox Chicago 390 ISDN (KPN Telecom)
17 M101:
18 Sinus 45 Data 1 (Telekom)
19 M105:
20 Gigaset USB Adapter DECT
21 Sinus 45 Data 2 (Telekom)
22 Sinus 721 data
23 Chicago 390 USB (KPN)
24 See also http://www.erbze.info/sinus_gigaset.htm and
25 http://gigaset307x.sourceforge.net/
26
27 We had also reports from users of Gigaset M105 who could use the drivers
28 with SX 100 and CX 100 ISDN bases (only in unimodem mode, see section 2.4.)
29 If you have another device that works with our driver, please let us know.
30 For example, Gigaset SX205isdn/Sinus 721 X SE and Gigaset SX303isdn bases
31 are just versions without answering machine of models known to work, so
32 they should work just as well; but so far we are lacking positive reports
33 on these.
34
35 Chances of getting an USB device to work are good if the output of
36 lsusb
37 at the command line contains one of the following:
38 ID 0681:0001
39 ID 0681:0002
40 ID 0681:0009
41 ID 0681:0021
42 ID 0681:0022
43
441.2. Software
45 --------
46 The driver works with ISDN4linux and so can be used with any software
47 which is able to use ISDN4linux for ISDN connections (voice or data).
48 CAPI4Linux support is planned but not yet available.
49
50 There are some user space tools available at
51 http://sourceforge.net/projects/gigaset307x/
52 which provide access to additional device specific functions like SMS,
53 phonebook or call journal.
54
55
562. How to use the driver
57 ---------------------
582.1. Modules
59 -------
60 To get the device working, you have to load the proper kernel module. You
61 can do this using
62 modprobe modulename
63 where modulename is usb_gigaset (M105) or bas_gigaset (direct USB
64 connection to the base).
65
662.2. Device nodes for user space programs
67 ------------------------------------
68 The device can be accessed from user space (eg. by the user space tools
69 mentioned in 1.2.) through the device nodes:
70
71 - /dev/ttyGU0 for M105 (USB data boxes)
72 - /dev/ttyGB0 for the base driver (direct USB connection)
73
74 You can also select a "default device" which is used by the frontends when
75 no device node is given as parameter, by creating a symlink /dev/ttyG to
76 one of them, eg.:
77
78 ln -s /dev/ttyGB0 /dev/ttyG
79
802.3. ISDN4linux
81 ----------
82 This is the "normal" mode of operation. After loading the module you can
83 set up the ISDN system just as you'd do with any ISDN card.
84 Your distribution should provide some configuration utility.
85 If not, you can use some HOWTOs like
86 http://www.linuxhaven.de/dlhp/HOWTO/DE-ISDN-HOWTO-5.html
87 If this doesn't work, because you have some recent device like SX100 where
88 debug output (see section 3.2.) shows something like this when dialing
89 CMD Received: ERROR
90 Available Params: 0
91 Connection State: 0, Response: -1
92 gigaset_process_response: resp_code -1 in ConState 0 !
93 Timeout occurred
94 you might need to use unimodem mode:
95
962.4. Unimodem mode
97 -------------
98 This is needed for some devices [e.g. SX100] as they have problems with
99 the "normal" commands.
100
101 If you have installed the command line tool gigacontr, you can enter
102 unimodem mode using
103 gigacontr --mode unimodem
104 You can switch back using
105 gigacontr --mode isdn
106
107 You can also load the driver using e.g.
108 modprobe usb_gigaset startmode=0
109 to prevent the driver from starting in "isdn4linux mode".
110
111 In this mode the device works like a modem connected to a serial port
112 (the /dev/ttyGU0, ... mentioned above) which understands the commands
113 ATZ init, reset
114 => OK or ERROR
115 ATD
116 ATDT dial
117 => OK, CONNECT,
118 BUSY,
119 NO DIAL TONE,
120 NO CARRIER,
121 NO ANSWER
122 <pause>+++<pause> change to command mode when connected
123 ATH hangup
124
125 You can use some configuration tool of your distribution to configure this
126 "modem" or configure pppd/wvdial manually. There are some example ppp
127 configuration files and chat scripts in the gigaset-VERSION/ppp directory.
128 Please note that the USB drivers are not able to change the state of the
129 control lines (the M105 driver can be configured to use some undocumented
130 control requests, if you really need the control lines, though). This means
131 you must use "Stupid Mode" if you are using wvdial or you should use the
132 nocrtscts option of pppd.
133 You must also assure that the ppp_async module is loaded with the parameter
134 flag_time=0. You can do this e.g. by adding a line like
135
136 options ppp_async flag_time=0
137
138 to /etc/modprobe.conf. If your distribution has some local module
139 configuration file like /etc/modprobe.conf.local,
140 using that should be preferred.
141
1422.5. Call-ID (CID) mode
143 ------------------
144 Call-IDs are numbers used to tag commands to, and responses from, the
145 Gigaset base in order to support the simultaneous handling of multiple
146 ISDN calls. Their use can be enabled ("CID mode") or disabled ("Unimodem
147 mode"). Without Call-IDs (in Unimodem mode), only a very limited set of
148 functions is available. It allows outgoing data connections only, but
149 does not signal incoming calls or other base events.
150
151 DECT cordless data devices (M10x) permanently occupy the cordless
152 connection to the base while Call-IDs are activated. As the Gigaset
153 bases only support one DECT data connection at a time, this prevents
154 other DECT cordless data devices from accessing the base.
155
156 During active operation, the driver switches to the necessary mode
157 automatically. However, for the reasons above, the mode chosen when
158 the device is not in use (idle) can be selected by the user.
159 - If you want to receive incoming calls, you can use the default
160 settings (CID mode).
161 - If you have several DECT data devices (M10x) which you want to use
162 in turn, select Unimodem mode by passing the parameter "cidmode=0" to
163 the driver ("modprobe usb_gigaset cidmode=0" or modprobe.conf).
164
165 If you want both of these at once, you are out of luck.
166
167 You can also use /sys/module/<name>/parameters/cidmode for changing
168 the CID mode setting (<name> is usb_gigaset or bas_gigaset).
169
170
1713. Troubleshooting
172 ---------------
1733.1. Solutions to frequently reported problems
174 -----------------------------------------
175 Problem:
176 You have a slow provider and isdn4linux gives up dialing too early.
177 Solution:
178 Load the isdn module using the dialtimeout option. You can do this e.g.
179 by adding a line like
180
181 options isdn dialtimeout=15
182
183 to /etc/modprobe.conf. If your distribution has some local module
184 configuration file like /etc/modprobe.conf.local,
185 using that should be preferred.
186
187 Problem:
188 Your isdn script aborts with a message about isdnlog.
189 Solution:
190 Try deactivating (or commenting out) isdnlog. This driver does not
191 support it.
192
193 Problem:
194 You have two or more DECT data adapters (M101/M105) and only the
195 first one you turn on works.
196 Solution:
197 Select Unimodem mode for all DECT data adapters. (see section 2.4.)
198
1993.2. Telling the driver to provide more information
200 ----------------------------------------------
201 Building the driver with the "Gigaset debugging" kernel configuration
202 option (CONFIG_GIGASET_DEBUG) gives it the ability to produce additional
203 information useful for debugging.
204
205 You can control the amount of debugging information the driver produces by
206 writing an appropriate value to /sys/module/gigaset/parameters/debug, e.g.
207 echo 0 > /sys/module/gigaset/parameters/debug
208 switches off debugging output completely,
209 echo 0x10a020 > /sys/module/gigaset/parameters/debug
210 enables the standard set of debugging output messages. These values are
211 bit patterns where every bit controls a certain type of debugging output.
212 See the constants DEBUG_* in the source file gigaset.h for details.
213
214 The initial value can be set using the debug parameter when loading the
215 module "gigaset", e.g. by adding a line
216 options gigaset debug=0
217 to /etc/modprobe.conf, ...
218
219 Generated debugging information can be found
220 - as output of the command
221 dmesg
222 - in system log files written by your syslog daemon, usually
223 in /var/log/, e.g. /var/log/messages.
224
2253.3. Reporting problems and bugs
226 ---------------------------
227 If you can't solve problems with the driver on your own, feel free to
228 use one of the forums, bug trackers, or mailing lists on
229 http://sourceforge.net/projects/gigaset307x
230 or write an electronic mail to the maintainers.
231
232 Try to provide as much information as possible, such as
233 - distribution
234 - kernel version (uname -r)
235 - gcc version (gcc --version)
236 - hardware architecture (uname -m, ...)
237 - type and firmware version of your device (base and wireless module,
238 if any)
239 - output of "lsusb -v" (if using an USB device)
240 - error messages
241 - relevant system log messages (it would help if you activate debug
242 output as described in 3.2.)
243
244 For help with general configuration problems not specific to our driver,
245 such as isdn4linux and network configuration issues, please refer to the
246 appropriate forums and newsgroups.
247
2483.4. Reporting problem solutions
249 ---------------------------
250 If you solved a problem with our drivers, wrote startup scripts for your
251 distribution, ... feel free to contact us (using one of the places
252 mentioned in 3.3.). We'd like to add scripts, hints, documentation
253 to the driver and/or the project web page.
254
255
2564. Links, other software
257 ---------------------
258 - Sourceforge project developing this driver and associated tools
259 http://sourceforge.net/projects/gigaset307x
260 - Yahoo! Group on the Siemens Gigaset family of devices
261 http://de.groups.yahoo.com/group/Siemens-Gigaset
262 - Siemens Gigaset/T-Sinus compatibility table
263 http://www.erbze.info/sinus_gigaset.htm
264
265
2665. Credits
267 -------
268 Thanks to
269
270 Karsten Keil
271 for his help with isdn4linux
272 Deti Fliegl
273 for his base driver code
274 Dennis Dietrich
275 for his kernel 2.6 patches
276 Andreas Rummel
277 for his work and logs to get unimodem mode working
278 Andreas Degert
279 for his logs and patches to get cx 100 working
280 Dietrich Feist
281 for his generous donation of one M105 and two M101 cordless adapters
282 Christoph Schweers
283 for his generous donation of a M34 device
284
285 and all the other people who sent logs and other information.
286
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index fcccf2432f98..61fc079eb966 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -44,7 +44,7 @@ What is covered within this file is mainly information to authors
44of modules. The author of an external modules should supply 44of modules. The author of an external modules should supply
45a makefile that hides most of the complexity so one only has to type 45a makefile that hides most of the complexity so one only has to type
46'make' to build the module. A complete example will be present in 46'make' to build the module. A complete example will be present in
47chapter ¤. Creating a kbuild file for an external module". 47chapter 4, "Creating a kbuild file for an external module".
48 48
49 49
50=== 2. How to build external modules 50=== 2. How to build external modules
diff --git a/Documentation/laptop-mode.txt b/Documentation/laptop-mode.txt
index b18e21675906..5696e879449b 100644
--- a/Documentation/laptop-mode.txt
+++ b/Documentation/laptop-mode.txt
@@ -919,11 +919,11 @@ int main(int argc, char **argv)
919 int settle_time = 60; 919 int settle_time = 60;
920 920
921 /* Parse the simple command-line */ 921 /* Parse the simple command-line */
922 if (ac == 2) 922 if (argc == 2)
923 disk = av[1]; 923 disk = argv[1];
924 else if (ac == 4) { 924 else if (argc == 4) {
925 settle_time = atoi(av[2]); 925 settle_time = atoi(argv[2]);
926 disk = av[3]; 926 disk = argv[3];
927 } else 927 } else
928 usage(); 928 usage();
929 929
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index f8550310a6d5..92f0056d928c 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -610,6 +610,7 @@ loads. Consider the following sequence of events:
610 610
611 CPU 1 CPU 2 611 CPU 1 CPU 2
612 ======================= ======================= 612 ======================= =======================
613 { B = 7; X = 9; Y = 8; C = &Y }
613 STORE A = 1 614 STORE A = 1
614 STORE B = 2 615 STORE B = 2
615 <write barrier> 616 <write barrier>
@@ -651,7 +652,20 @@ In the above example, CPU 2 perceives that B is 7, despite the load of *C
651(which would be B) coming after the the LOAD of C. 652(which would be B) coming after the the LOAD of C.
652 653
653If, however, a data dependency barrier were to be placed between the load of C 654If, however, a data dependency barrier were to be placed between the load of C
654and the load of *C (ie: B) on CPU 2, then the following will occur: 655and the load of *C (ie: B) on CPU 2:
656
657 CPU 1 CPU 2
658 ======================= =======================
659 { B = 7; X = 9; Y = 8; C = &Y }
660 STORE A = 1
661 STORE B = 2
662 <write barrier>
663 STORE C = &B LOAD X
664 STORE D = 4 LOAD C (gets &B)
665 <data dependency barrier>
666 LOAD *C (reads B)
667
668then the following will occur:
655 669
656 +-------+ : : : : 670 +-------+ : : : :
657 | | +------+ +-------+ 671 | | +------+ +-------+
@@ -829,8 +843,8 @@ There are some more advanced barrier functions:
829 (*) smp_mb__after_atomic_inc(); 843 (*) smp_mb__after_atomic_inc();
830 844
831 These are for use with atomic add, subtract, increment and decrement 845 These are for use with atomic add, subtract, increment and decrement
832 functions, especially when used for reference counting. These functions 846 functions that don't return a value, especially when used for reference
833 do not imply memory barriers. 847 counting. These functions do not imply memory barriers.
834 848
835 As an example, consider a piece of code that marks an object as being dead 849 As an example, consider a piece of code that marks an object as being dead
836 and then decrements the object's reference count: 850 and then decrements the object's reference count:
@@ -1263,15 +1277,17 @@ else.
1263ATOMIC OPERATIONS 1277ATOMIC OPERATIONS
1264----------------- 1278-----------------
1265 1279
1266Though they are technically interprocessor interaction considerations, atomic 1280Whilst they are technically interprocessor interaction considerations, atomic
1267operations are noted specially as they do _not_ generally imply memory 1281operations are noted specially as some of them imply full memory barriers and
1268barriers. The possible offenders include: 1282some don't, but they're very heavily relied on as a group throughout the
1283kernel.
1284
1285Any atomic operation that modifies some state in memory and returns information
1286about the state (old or new) implies an SMP-conditional general memory barrier
1287(smp_mb()) on each side of the actual operation. These include:
1269 1288
1270 xchg(); 1289 xchg();
1271 cmpxchg(); 1290 cmpxchg();
1272 test_and_set_bit();
1273 test_and_clear_bit();
1274 test_and_change_bit();
1275 atomic_cmpxchg(); 1291 atomic_cmpxchg();
1276 atomic_inc_return(); 1292 atomic_inc_return();
1277 atomic_dec_return(); 1293 atomic_dec_return();
@@ -1282,21 +1298,31 @@ barriers. The possible offenders include:
1282 atomic_sub_and_test(); 1298 atomic_sub_and_test();
1283 atomic_add_negative(); 1299 atomic_add_negative();
1284 atomic_add_unless(); 1300 atomic_add_unless();
1301 test_and_set_bit();
1302 test_and_clear_bit();
1303 test_and_change_bit();
1285 1304
1286These may be used for such things as implementing LOCK operations or controlling 1305These are used for such things as implementing LOCK-class and UNLOCK-class
1287the lifetime of objects by decreasing their reference counts. In such cases 1306operations and adjusting reference counters towards object destruction, and as
1288they need preceding memory barriers. 1307such the implicit memory barrier effects are necessary.
1289 1308
1290The following may also be possible offenders as they may be used as UNLOCK
1291operations.
1292 1309
1310The following operation are potential problems as they do _not_ imply memory
1311barriers, but might be used for implementing such things as UNLOCK-class
1312operations:
1313
1314 atomic_set();
1293 set_bit(); 1315 set_bit();
1294 clear_bit(); 1316 clear_bit();
1295 change_bit(); 1317 change_bit();
1296 atomic_set();
1297 1318
1319With these the appropriate explicit memory barrier should be used if necessary
1320(smp_mb__before_clear_bit() for instance).
1298 1321
1299The following are a little tricky: 1322
1323The following also do _not_ imply memory barriers, and so may require explicit
1324memory barriers under some circumstances (smp_mb__before_atomic_dec() for
1325instance)):
1300 1326
1301 atomic_add(); 1327 atomic_add();
1302 atomic_sub(); 1328 atomic_sub();
@@ -1317,10 +1343,12 @@ specific order.
1317 1343
1318 1344
1319Basically, each usage case has to be carefully considered as to whether memory 1345Basically, each usage case has to be carefully considered as to whether memory
1320barriers are needed or not. The simplest rule is probably: if the atomic 1346barriers are needed or not.
1321operation is protected by a lock, then it does not require a barrier unless 1347
1322there's another operation within the critical section with respect to which an 1348[!] Note that special memory barrier primitives are available for these
1323ordering must be maintained. 1349situations because on some CPUs the atomic instructions used imply full memory
1350barriers, and so barrier instructions are superfluous in conjunction with them,
1351and in such cases the special barrier primitives will be no-ops.
1324 1352
1325See Documentation/atomic_ops.txt for more information. 1353See Documentation/atomic_ops.txt for more information.
1326 1354
diff --git a/Documentation/mtrr.txt b/Documentation/mtrr.txt
index b78af1c32996..c39ac395970e 100644
--- a/Documentation/mtrr.txt
+++ b/Documentation/mtrr.txt
@@ -138,19 +138,29 @@ Reading MTRRs from a C program using ioctl()'s:
138 138
139*/ 139*/
140#include <stdio.h> 140#include <stdio.h>
141#include <stdlib.h>
141#include <string.h> 142#include <string.h>
142#include <sys/types.h> 143#include <sys/types.h>
143#include <sys/stat.h> 144#include <sys/stat.h>
144#include <fcntl.h> 145#include <fcntl.h>
145#include <sys/ioctl.h> 146#include <sys/ioctl.h>
146#include <errno.h> 147#include <errno.h>
147#define MTRR_NEED_STRINGS
148#include <asm/mtrr.h> 148#include <asm/mtrr.h>
149 149
150#define TRUE 1 150#define TRUE 1
151#define FALSE 0 151#define FALSE 0
152#define ERRSTRING strerror (errno) 152#define ERRSTRING strerror (errno)
153 153
154static char *mtrr_strings[MTRR_NUM_TYPES] =
155{
156 "uncachable", /* 0 */
157 "write-combining", /* 1 */
158 "?", /* 2 */
159 "?", /* 3 */
160 "write-through", /* 4 */
161 "write-protect", /* 5 */
162 "write-back", /* 6 */
163};
154 164
155int main () 165int main ()
156{ 166{
@@ -232,13 +242,22 @@ Creating MTRRs from a C programme using ioctl()'s:
232#include <fcntl.h> 242#include <fcntl.h>
233#include <sys/ioctl.h> 243#include <sys/ioctl.h>
234#include <errno.h> 244#include <errno.h>
235#define MTRR_NEED_STRINGS
236#include <asm/mtrr.h> 245#include <asm/mtrr.h>
237 246
238#define TRUE 1 247#define TRUE 1
239#define FALSE 0 248#define FALSE 0
240#define ERRSTRING strerror (errno) 249#define ERRSTRING strerror (errno)
241 250
251static char *mtrr_strings[MTRR_NUM_TYPES] =
252{
253 "uncachable", /* 0 */
254 "write-combining", /* 1 */
255 "?", /* 2 */
256 "?", /* 3 */
257 "write-through", /* 4 */
258 "write-protect", /* 5 */
259 "write-back", /* 6 */
260};
242 261
243int main (int argc, char **argv) 262int main (int argc, char **argv)
244{ 263{
diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt
new file mode 100644
index 000000000000..8be626f7c0b8
--- /dev/null
+++ b/Documentation/networking/xfrm_sync.txt
@@ -0,0 +1,166 @@
1
2The sync patches work is based on initial patches from
3Krisztian <hidden@balabit.hu> and others and additional patches
4from Jamal <hadi@cyberus.ca>.
5
6The end goal for syncing is to be able to insert attributes + generate
7events so that the an SA can be safely moved from one machine to another
8for HA purposes.
9The idea is to synchronize the SA so that the takeover machine can do
10the processing of the SA as accurate as possible if it has access to it.
11
12We already have the ability to generate SA add/del/upd events.
13These patches add ability to sync and have accurate lifetime byte (to
14ensure proper decay of SAs) and replay counters to avoid replay attacks
15with as minimal loss at failover time.
16This way a backup stays as closely uptodate as an active member.
17
18Because the above items change for every packet the SA receives,
19it is possible for a lot of the events to be generated.
20For this reason, we also add a nagle-like algorithm to restrict
21the events. i.e we are going to set thresholds to say "let me
22know if the replay sequence threshold is reached or 10 secs have passed"
23These thresholds are set system-wide via sysctls or can be updated
24per SA.
25
26The identified items that need to be synchronized are:
27- the lifetime byte counter
28note that: lifetime time limit is not important if you assume the failover
29machine is known ahead of time since the decay of the time countdown
30is not driven by packet arrival.
31- the replay sequence for both inbound and outbound
32
331) Message Structure
34----------------------
35
36nlmsghdr:aevent_id:optional-TLVs.
37
38The netlink message types are:
39
40XFRM_MSG_NEWAE and XFRM_MSG_GETAE.
41
42A XFRM_MSG_GETAE does not have TLVs.
43A XFRM_MSG_NEWAE will have at least two TLVs (as is
44discussed further below).
45
46aevent_id structure looks like:
47
48 struct xfrm_aevent_id {
49 struct xfrm_usersa_id sa_id;
50 __u32 flags;
51 };
52
53xfrm_usersa_id in this message layout identifies the SA.
54
55flags are used to indicate different things. The possible
56flags are:
57 XFRM_AE_RTHR=1, /* replay threshold*/
58 XFRM_AE_RVAL=2, /* replay value */
59 XFRM_AE_LVAL=4, /* lifetime value */
60 XFRM_AE_ETHR=8, /* expiry timer threshold */
61 XFRM_AE_CR=16, /* Event cause is replay update */
62 XFRM_AE_CE=32, /* Event cause is timer expiry */
63 XFRM_AE_CU=64, /* Event cause is policy update */
64
65How these flags are used is dependent on the direction of the
66message (kernel<->user) as well the cause (config, query or event).
67This is described below in the different messages.
68
69The pid will be set appropriately in netlink to recognize direction
70(0 to the kernel and pid = processid that created the event
71when going from kernel to user space)
72
73A program needs to subscribe to multicast group XFRMNLGRP_AEVENTS
74to get notified of these events.
75
762) TLVS reflect the different parameters:
77-----------------------------------------
78
79a) byte value (XFRMA_LTIME_VAL)
80This TLV carries the running/current counter for byte lifetime since
81last event.
82
83b)replay value (XFRMA_REPLAY_VAL)
84This TLV carries the running/current counter for replay sequence since
85last event.
86
87c)replay threshold (XFRMA_REPLAY_THRESH)
88This TLV carries the threshold being used by the kernel to trigger events
89when the replay sequence is exceeded.
90
91d) expiry timer (XFRMA_ETIMER_THRESH)
92This is a timer value in milliseconds which is used as the nagle
93value to rate limit the events.
94
953) Default configurations for the parameters:
96----------------------------------------------
97
98By default these events should be turned off unless there is
99at least one listener registered to listen to the multicast
100group XFRMNLGRP_AEVENTS.
101
102Programs installing SAs will need to specify the two thresholds, however,
103in order to not change existing applications such as racoon
104we also provide default threshold values for these different parameters
105in case they are not specified.
106
107the two sysctls/proc entries are:
108a) /proc/sys/net/core/sysctl_xfrm_aevent_etime
109used to provide default values for the XFRMA_ETIMER_THRESH in incremental
110units of time of 100ms. The default is 10 (1 second)
111
112b) /proc/sys/net/core/sysctl_xfrm_aevent_rseqth
113used to provide default values for XFRMA_REPLAY_THRESH parameter
114in incremental packet count. The default is two packets.
115
1164) Message types
117----------------
118
119a) XFRM_MSG_GETAE issued by user-->kernel.
120XFRM_MSG_GETAE does not carry any TLVs.
121The response is a XFRM_MSG_NEWAE which is formatted based on what
122XFRM_MSG_GETAE queried for.
123The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
124*if XFRM_AE_RTHR flag is set, then XFRMA_REPLAY_THRESH is also retrieved
125*if XFRM_AE_ETHR flag is set, then XFRMA_ETIMER_THRESH is also retrieved
126
127b) XFRM_MSG_NEWAE is issued by either user space to configure
128or kernel to announce events or respond to a XFRM_MSG_GETAE.
129
130i) user --> kernel to configure a specific SA.
131any of the values or threshold parameters can be updated by passing the
132appropriate TLV.
133A response is issued back to the sender in user space to indicate success
134or failure.
135In the case of success, additionally an event with
136XFRM_MSG_NEWAE is also issued to any listeners as described in iii).
137
138ii) kernel->user direction as a response to XFRM_MSG_GETAE
139The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
140The threshold TLVs will be included if explicitly requested in
141the XFRM_MSG_GETAE message.
142
143iii) kernel->user to report as event if someone sets any values or
144thresholds for an SA using XFRM_MSG_NEWAE (as described in #i above).
145In such a case XFRM_AE_CU flag is set to inform the user that
146the change happened as a result of an update.
147The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
148
149iv) kernel->user to report event when replay threshold or a timeout
150is exceeded.
151In such a case either XFRM_AE_CR (replay exceeded) or XFRM_AE_CE (timeout
152happened) is set to inform the user what happened.
153Note the two flags are mutually exclusive.
154The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
155
156Exceptions to threshold settings
157--------------------------------
158
159If you have an SA that is getting hit by traffic in bursts such that
160there is a period where the timer threshold expires with no packets
161seen, then an odd behavior is seen as follows:
162The first packet arrival after a timer expiry will trigger a timeout
163aevent; i.e we dont wait for a timeout period or a packet threshold
164to be reached. This is done for simplicity and efficiency reasons.
165
166-JHS
diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt
index 331afd791cbb..ce767b90bb0d 100644
--- a/Documentation/scsi/scsi_eh.txt
+++ b/Documentation/scsi/scsi_eh.txt
@@ -19,9 +19,9 @@ TABLE OF CONTENTS
19 [2-1-1] Overview 19 [2-1-1] Overview
20 [2-1-2] Flow of scmds through EH 20 [2-1-2] Flow of scmds through EH
21 [2-1-3] Flow of control 21 [2-1-3] Flow of control
22 [2-2] EH through hostt->eh_strategy_handler() 22 [2-2] EH through transportt->eh_strategy_handler()
23 [2-2-1] Pre hostt->eh_strategy_handler() SCSI midlayer conditions 23 [2-2-1] Pre transportt->eh_strategy_handler() SCSI midlayer conditions
24 [2-2-2] Post hostt->eh_strategy_handler() SCSI midlayer conditions 24 [2-2-2] Post transportt->eh_strategy_handler() SCSI midlayer conditions
25 [2-2-3] Things to consider 25 [2-2-3] Things to consider
26 26
27 27
@@ -413,9 +413,9 @@ scmd->allowed.
413 layer of failure of the scmds. 413 layer of failure of the scmds.
414 414
415 415
416[2-2] EH through hostt->eh_strategy_handler() 416[2-2] EH through transportt->eh_strategy_handler()
417 417
418 hostt->eh_strategy_handler() is invoked in the place of 418 transportt->eh_strategy_handler() is invoked in the place of
419scsi_unjam_host() and it is responsible for whole recovery process. 419scsi_unjam_host() and it is responsible for whole recovery process.
420On completion, the handler should have made lower layers forget about 420On completion, the handler should have made lower layers forget about
421all failed scmds and either ready for new commands or offline. Also, 421all failed scmds and either ready for new commands or offline. Also,
@@ -424,7 +424,7 @@ SCSI midlayer. IOW, of the steps described in [2-1-2], all steps
424except for #1 must be implemented by eh_strategy_handler(). 424except for #1 must be implemented by eh_strategy_handler().
425 425
426 426
427[2-2-1] Pre hostt->eh_strategy_handler() SCSI midlayer conditions 427[2-2-1] Pre transportt->eh_strategy_handler() SCSI midlayer conditions
428 428
429 The following conditions are true on entry to the handler. 429 The following conditions are true on entry to the handler.
430 430
@@ -437,7 +437,7 @@ except for #1 must be implemented by eh_strategy_handler().
437 - shost->host_failed == shost->host_busy 437 - shost->host_failed == shost->host_busy
438 438
439 439
440[2-2-2] Post hostt->eh_strategy_handler() SCSI midlayer conditions 440[2-2-2] Post transportt->eh_strategy_handler() SCSI midlayer conditions
441 441
442 The following conditions must be true on exit from the handler. 442 The following conditions must be true on exit from the handler.
443 443
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index 8bbae3e1abdf..75a535a975c3 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -804,7 +804,6 @@ Summary:
804 eh_bus_reset_handler - issue SCSI bus reset 804 eh_bus_reset_handler - issue SCSI bus reset
805 eh_device_reset_handler - issue SCSI device reset 805 eh_device_reset_handler - issue SCSI device reset
806 eh_host_reset_handler - reset host (host bus adapter) 806 eh_host_reset_handler - reset host (host bus adapter)
807 eh_strategy_handler - driver supplied alternate to scsi_unjam_host()
808 info - supply information about given host 807 info - supply information about given host
809 ioctl - driver can respond to ioctls 808 ioctl - driver can respond to ioctls
810 proc_info - supports /proc/scsi/{driver_name}/{host_no} 809 proc_info - supports /proc/scsi/{driver_name}/{host_no}
@@ -970,24 +969,6 @@ Details:
970 969
971 970
972/** 971/**
973 * eh_strategy_handler - driver supplied alternate to scsi_unjam_host()
974 * @shp: host on which error has occurred
975 *
976 * Returns TRUE if host unjammed, else FALSE.
977 *
978 * Locks: none
979 *
980 * Calling context: kernel thread
981 *
982 * Notes: Invoked from scsi_eh thread. LLD supplied alternate to
983 * scsi_unjam_host() found in scsi_error.c
984 *
985 * Optionally defined in: LLD
986 **/
987 int eh_strategy_handler(struct Scsi_Host * shp)
988
989
990/**
991 * info - supply information about given host: driver name plus data 972 * info - supply information about given host: driver name plus data
992 * to distinguish given host 973 * to distinguish given host
993 * @shp: host to supply information about 974 * @shp: host to supply information about
diff --git a/Documentation/serial/driver b/Documentation/serial/driver
index 42ef9970bc86..df82116a9f26 100644
--- a/Documentation/serial/driver
+++ b/Documentation/serial/driver
@@ -3,14 +3,11 @@
3 -------------------- 3 --------------------
4 4
5 5
6 $Id: driver,v 1.10 2002/07/22 15:27:30 rmk Exp $
7
8
9This document is meant as a brief overview of some aspects of the new serial 6This document is meant as a brief overview of some aspects of the new serial
10driver. It is not complete, any questions you have should be directed to 7driver. It is not complete, any questions you have should be directed to
11<rmk@arm.linux.org.uk> 8<rmk@arm.linux.org.uk>
12 9
13The reference implementation is contained within serial_amba.c. 10The reference implementation is contained within amba_pl011.c.
14 11
15 12
16 13
@@ -31,6 +28,11 @@ The serial core provides a few helper functions. This includes identifing
31the correct port structure (via uart_get_console) and decoding command line 28the correct port structure (via uart_get_console) and decoding command line
32arguments (uart_parse_options). 29arguments (uart_parse_options).
33 30
31There is also a helper function (uart_write_console) which performs a
32character by character write, translating newlines to CRLF sequences.
33Driver writers are recommended to use this function rather than implementing
34their own version.
35
34 36
35Locking 37Locking
36------- 38-------
@@ -86,6 +88,7 @@ hardware.
86 - TIOCM_DTR DTR signal. 88 - TIOCM_DTR DTR signal.
87 - TIOCM_OUT1 OUT1 signal. 89 - TIOCM_OUT1 OUT1 signal.
88 - TIOCM_OUT2 OUT2 signal. 90 - TIOCM_OUT2 OUT2 signal.
91 - TIOCM_LOOP Set the port into loopback mode.
89 If the appropriate bit is set, the signal should be driven 92 If the appropriate bit is set, the signal should be driven
90 active. If the bit is clear, the signal should be driven 93 active. If the bit is clear, the signal should be driven
91 inactive. 94 inactive.
@@ -141,6 +144,10 @@ hardware.
141 enable_ms(port) 144 enable_ms(port)
142 Enable the modem status interrupts. 145 Enable the modem status interrupts.
143 146
147 This method may be called multiple times. Modem status
148 interrupts should be disabled when the shutdown method is
149 called.
150
144 Locking: port->lock taken. 151 Locking: port->lock taken.
145 Interrupts: locally disabled. 152 Interrupts: locally disabled.
146 This call must not sleep 153 This call must not sleep
@@ -160,6 +167,8 @@ hardware.
160 state. Enable the port for reception. It should not activate 167 state. Enable the port for reception. It should not activate
161 RTS nor DTR; this will be done via a separate call to set_mctrl. 168 RTS nor DTR; this will be done via a separate call to set_mctrl.
162 169
170 This method will only be called when the port is initially opened.
171
163 Locking: port_sem taken. 172 Locking: port_sem taken.
164 Interrupts: globally disabled. 173 Interrupts: globally disabled.
165 174
@@ -169,6 +178,11 @@ hardware.
169 RTS nor DTR; this will have already been done via a separate 178 RTS nor DTR; this will have already been done via a separate
170 call to set_mctrl. 179 call to set_mctrl.
171 180
181 Drivers must not access port->info once this call has completed.
182
183 This method will only be called when there are no more users of
184 this port.
185
172 Locking: port_sem taken. 186 Locking: port_sem taken.
173 Interrupts: caller dependent. 187 Interrupts: caller dependent.
174 188
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 6feef9e82b63..68eeebc17ff4 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -1123,8 +1123,8 @@
1123 if ((err = pci_enable_device(pci)) < 0) 1123 if ((err = pci_enable_device(pci)) < 0)
1124 return err; 1124 return err;
1125 /* check PCI availability (28bit DMA) */ 1125 /* check PCI availability (28bit DMA) */
1126 if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || 1126 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
1127 pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { 1127 pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
1128 printk(KERN_ERR "error to set 28bit mask DMA\n"); 1128 printk(KERN_ERR "error to set 28bit mask DMA\n");
1129 pci_disable_device(pci); 1129 pci_disable_device(pci);
1130 return -ENXIO; 1130 return -ENXIO;
@@ -1216,7 +1216,7 @@
1216 The allocation of PCI resources is done in the 1216 The allocation of PCI resources is done in the
1217 <function>probe()</function> function, and usually an extra 1217 <function>probe()</function> function, and usually an extra
1218 <function>xxx_create()</function> function is written for this 1218 <function>xxx_create()</function> function is written for this
1219 purpose. 1219 purpose.
1220 </para> 1220 </para>
1221 1221
1222 <para> 1222 <para>
@@ -1225,7 +1225,7 @@
1225 allocating resources. Also, you need to set the proper PCI DMA 1225 allocating resources. Also, you need to set the proper PCI DMA
1226 mask to limit the accessed i/o range. In some cases, you might 1226 mask to limit the accessed i/o range. In some cases, you might
1227 need to call <function>pci_set_master()</function> function, 1227 need to call <function>pci_set_master()</function> function,
1228 too. 1228 too.
1229 </para> 1229 </para>
1230 1230
1231 <para> 1231 <para>
@@ -1236,8 +1236,8 @@
1236<![CDATA[ 1236<![CDATA[
1237 if ((err = pci_enable_device(pci)) < 0) 1237 if ((err = pci_enable_device(pci)) < 0)
1238 return err; 1238 return err;
1239 if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || 1239 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
1240 pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { 1240 pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
1241 printk(KERN_ERR "error to set 28bit mask DMA\n"); 1241 printk(KERN_ERR "error to set 28bit mask DMA\n");
1242 pci_disable_device(pci); 1242 pci_disable_device(pci);
1243 return -ENXIO; 1243 return -ENXIO;
@@ -1256,13 +1256,13 @@
1256 functions. Unlike ALSA ver.0.5.x., there are no helpers for 1256 functions. Unlike ALSA ver.0.5.x., there are no helpers for
1257 that. And these resources must be released in the destructor 1257 that. And these resources must be released in the destructor
1258 function (see below). Also, on ALSA 0.9.x, you don't need to 1258 function (see below). Also, on ALSA 0.9.x, you don't need to
1259 allocate (pseudo-)DMA for PCI like ALSA 0.5.x. 1259 allocate (pseudo-)DMA for PCI like ALSA 0.5.x.
1260 </para> 1260 </para>
1261 1261
1262 <para> 1262 <para>
1263 Now assume that this PCI device has an I/O port with 8 bytes 1263 Now assume that this PCI device has an I/O port with 8 bytes
1264 and an interrupt. Then struct <structname>mychip</structname> will have the 1264 and an interrupt. Then struct <structname>mychip</structname> will have the
1265 following fields: 1265 following fields:
1266 1266
1267 <informalexample> 1267 <informalexample>
1268 <programlisting> 1268 <programlisting>
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 1ad9af1ca4d0..687104bfd09a 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -27,12 +27,21 @@ number of free hugetlb pages at any time. It also displays information about
27the configured hugepage size - this is needed for generating the proper 27the configured hugepage size - this is needed for generating the proper
28alignment and size of the arguments to the above system calls. 28alignment and size of the arguments to the above system calls.
29 29
30The output of "cat /proc/meminfo" will have output like: 30The output of "cat /proc/meminfo" will have lines like:
31 31
32..... 32.....
33HugePages_Total: xxx 33HugePages_Total: xxx
34HugePages_Free: yyy 34HugePages_Free: yyy
35Hugepagesize: zzz KB 35HugePages_Rsvd: www
36Hugepagesize: zzz kB
37
38where:
39HugePages_Total is the size of the pool of hugepages.
40HugePages_Free is the number of hugepages in the pool that are not yet
41allocated.
42HugePages_Rsvd is short for "reserved," and is the number of hugepages
43for which a commitment to allocate from the pool has been made, but no
44allocation has yet been made. It's vaguely analogous to overcommit.
36 45
37/proc/filesystems should also show a filesystem of type "hugetlbfs" configured 46/proc/filesystems should also show a filesystem of type "hugetlbfs" configured
38in the kernel. 47in the kernel.
@@ -42,11 +51,11 @@ pages in the kernel. Super user can dynamically request more (or free some
42pre-configured) hugepages. 51pre-configured) hugepages.
43The allocation (or deallocation) of hugetlb pages is possible only if there are 52The allocation (or deallocation) of hugetlb pages is possible only if there are
44enough physically contiguous free pages in system (freeing of hugepages is 53enough physically contiguous free pages in system (freeing of hugepages is
45possible only if there are enough hugetlb pages free that can be transfered 54possible only if there are enough hugetlb pages free that can be transferred
46back to regular memory pool). 55back to regular memory pool).
47 56
48Pages that are used as hugetlb pages are reserved inside the kernel and can 57Pages that are used as hugetlb pages are reserved inside the kernel and cannot
49not be used for other purposes. 58be used for other purposes.
50 59
51Once the kernel with Hugetlb page support is built and running, a user can 60Once the kernel with Hugetlb page support is built and running, a user can
52use either the mmap system call or shared memory system calls to start using 61use either the mmap system call or shared memory system calls to start using
@@ -60,7 +69,7 @@ Use the following command to dynamically allocate/deallocate hugepages:
60This command will try to configure 20 hugepages in the system. The success 69This command will try to configure 20 hugepages in the system. The success
61or failure of allocation depends on the amount of physically contiguous 70or failure of allocation depends on the amount of physically contiguous
62memory that is preset in system at this time. System administrators may want 71memory that is preset in system at this time. System administrators may want
63to put this command in one of the local rc init file. This will enable the 72to put this command in one of the local rc init files. This will enable the
64kernel to request huge pages early in the boot process (when the possibility 73kernel to request huge pages early in the boot process (when the possibility
65of getting physical contiguous pages is still very high). 74of getting physical contiguous pages is still very high).
66 75
@@ -78,8 +87,8 @@ the uid and gid of the current process are taken. The mode option sets the
78mode of root of file system to value & 0777. This value is given in octal. 87mode of root of file system to value & 0777. This value is given in octal.
79By default the value 0755 is picked. The size option sets the maximum value of 88By default the value 0755 is picked. The size option sets the maximum value of
80memory (huge pages) allowed for that filesystem (/mnt/huge). The size is 89memory (huge pages) allowed for that filesystem (/mnt/huge). The size is
81rounded down to HPAGE_SIZE. The option nr_inode sets the maximum number of 90rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of
82inodes that /mnt/huge can use. If the size or nr_inode options are not 91inodes that /mnt/huge can use. If the size or nr_inodes options are not
83provided on command line then no limits are set. For size and nr_inodes 92provided on command line then no limits are set. For size and nr_inodes
84options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For 93options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For
85example, size=2K has the same meaning as size=2048. An example is given at 94example, size=2K has the same meaning as size=2048. An example is given at
@@ -88,7 +97,7 @@ the end of this document.
88read and write system calls are not supported on files that reside on hugetlb 97read and write system calls are not supported on files that reside on hugetlb
89file systems. 98file systems.
90 99
91A regular chown, chgrp and chmod commands (with right permissions) could be 100Regular chown, chgrp, and chmod commands (with right permissions) could be
92used to change the file attributes on hugetlbfs. 101used to change the file attributes on hugetlbfs.
93 102
94Also, it is important to note that no such mount command is required if the 103Also, it is important to note that no such mount command is required if the
@@ -96,8 +105,8 @@ applications are going to use only shmat/shmget system calls. Users who
96wish to use hugetlb page via shared memory segment should be a member of 105wish to use hugetlb page via shared memory segment should be a member of
97a supplementary group and system admin needs to configure that gid into 106a supplementary group and system admin needs to configure that gid into
98/proc/sys/vm/hugetlb_shm_group. It is possible for same or different 107/proc/sys/vm/hugetlb_shm_group. It is possible for same or different
99applications to use any combination of mmaps and shm* calls. Though the 108applications to use any combination of mmaps and shm* calls, though the
100mount of filesystem will be required for using mmaps. 109mount of filesystem will be required for using mmap calls.
101 110
102******************************************************************* 111*******************************************************************
103 112
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index 1921353259ae..f2cd6ef53ff3 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -151,6 +151,11 @@ NUMA
151 151
152 numa=fake=X Fake X nodes and ignore NUMA setup of the actual machine. 152 numa=fake=X Fake X nodes and ignore NUMA setup of the actual machine.
153 153
154 numa=hotadd=percent
155 Only allow hotadd memory to preallocate page structures upto
156 percent of already available memory.
157 numa=hotadd=0 will disable hotadd memory.
158
154ACPI 159ACPI
155 160
156 acpi=off Don't enable ACPI 161 acpi=off Don't enable ACPI
diff --git a/Kbuild b/Kbuild
index 95d6a00bace0..2d4f95e4b89f 100644
--- a/Kbuild
+++ b/Kbuild
@@ -18,7 +18,7 @@ define sed-y
18 "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" 18 "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
19endef 19endef
20# Override default regexp for specific architectures 20# Override default regexp for specific architectures
21sed-$(CONFIG_MIPS) := "/^@@@/s///p" 21sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}"
22 22
23quiet_cmd_offsets = GEN $@ 23quiet_cmd_offsets = GEN $@
24define cmd_offsets 24define cmd_offsets
diff --git a/MAINTAINERS b/MAINTAINERS
index f97657b7e2c7..61060e82fb0e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -411,6 +411,7 @@ AX.25 NETWORK LAYER
411P: Ralf Baechle 411P: Ralf Baechle
412M: ralf@linux-mips.org 412M: ralf@linux-mips.org
413L: linux-hams@vger.kernel.org 413L: linux-hams@vger.kernel.org
414W: http://www.linux-ax25.org/
414S: Maintained 415S: Maintained
415 416
416BAYCOM/HDLCDRV DRIVERS FOR AX.25 417BAYCOM/HDLCDRV DRIVERS FOR AX.25
@@ -1457,6 +1458,13 @@ M: support@pathscale.com
1457L: openib-general@openib.org 1458L: openib-general@openib.org
1458S: Supported 1459S: Supported
1459 1460
1461IPMI SUBSYSTEM
1462P: Corey Minyard
1463M: minyard@acm.org
1464L: openipmi-developer@lists.sourceforge.net
1465W: http://openipmi.sourceforge.net/
1466S: Supported
1467
1460IPX NETWORK LAYER 1468IPX NETWORK LAYER
1461P: Arnaldo Carvalho de Melo 1469P: Arnaldo Carvalho de Melo
1462M: acme@conectiva.com.br 1470M: acme@conectiva.com.br
@@ -1556,9 +1564,7 @@ S: Maintained
1556 1564
1557KEXEC 1565KEXEC
1558P: Eric Biederman 1566P: Eric Biederman
1559P: Randy Dunlap
1560M: ebiederm@xmission.com 1567M: ebiederm@xmission.com
1561M: rdunlap@xenotime.net
1562W: http://www.xmission.com/~ebiederm/files/kexec/ 1568W: http://www.xmission.com/~ebiederm/files/kexec/
1563L: linux-kernel@vger.kernel.org 1569L: linux-kernel@vger.kernel.org
1564L: fastboot@osdl.org 1570L: fastboot@osdl.org
@@ -1871,6 +1877,7 @@ NETROM NETWORK LAYER
1871P: Ralf Baechle 1877P: Ralf Baechle
1872M: ralf@linux-mips.org 1878M: ralf@linux-mips.org
1873L: linux-hams@vger.kernel.org 1879L: linux-hams@vger.kernel.org
1880W: http://www.linux-ax25.org/
1874S: Maintained 1881S: Maintained
1875 1882
1876NETWORK BLOCK DEVICE 1883NETWORK BLOCK DEVICE
@@ -2262,6 +2269,7 @@ ROSE NETWORK LAYER
2262P: Ralf Baechle 2269P: Ralf Baechle
2263M: ralf@linux-mips.org 2270M: ralf@linux-mips.org
2264L: linux-hams@vger.kernel.org 2271L: linux-hams@vger.kernel.org
2272W: http://www.linux-ax25.org/
2265S: Maintained 2273S: Maintained
2266 2274
2267RISCOM8 DRIVER 2275RISCOM8 DRIVER
@@ -3060,13 +3068,6 @@ M: khali@linux-fr.org
3060L: lm-sensors@lm-sensors.org 3068L: lm-sensors@lm-sensors.org
3061S: Odd Fixes 3069S: Odd Fixes
3062 3070
3063WAN ROUTER & SANGOMA WANPIPE DRIVERS & API (X.25, FRAME RELAY, PPP, CISCO HDLC)
3064P: Nenad Corbic
3065M: ncorbic@sangoma.com
3066M: dm@sangoma.com
3067W: http://www.sangoma.com
3068S: Supported
3069
3070WATCHDOG DEVICE DRIVERS 3071WATCHDOG DEVICE DRIVERS
3071P: Wim Van Sebroeck 3072P: Wim Van Sebroeck
3072M: wim@iguana.be 3073M: wim@iguana.be
diff --git a/Makefile b/Makefile
index b4019426fa25..a940eaefe1c4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 17 3SUBLEVEL = 17
4EXTRAVERSION =-rc1 4EXTRAVERSION =-rc2
5NAME=Sliding Snow Leopard 5NAME=Sliding Snow Leopard
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -1112,7 +1112,6 @@ modules_install: _emodinst_ _emodinst_post
1112install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) 1112install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1113PHONY += _emodinst_ 1113PHONY += _emodinst_
1114_emodinst_: 1114_emodinst_:
1115 $(Q)rm -rf $(MODLIB)/$(install-dir)
1116 $(Q)mkdir -p $(MODLIB)/$(install-dir) 1115 $(Q)mkdir -p $(MODLIB)/$(install-dir)
1117 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst 1116 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
1118 1117
@@ -1275,40 +1274,43 @@ kernelversion:
1275 1274
1276# Single targets 1275# Single targets
1277# --------------------------------------------------------------------------- 1276# ---------------------------------------------------------------------------
1278# The directory part is taken from first prerequisite, so this 1277# Single targets are compatible with:
1279# works even with external modules 1278# - build whith mixed source and output
1279# - build with separate output dir 'make O=...'
1280# - external modules
1281#
1282# target-dir => where to store outputfile
1283# build-dir => directory in kernel source tree to use
1284
1285ifeq ($(KBUILD_EXTMOD),)
1286 build-dir = $(patsubst %/,%,$(dir $@))
1287 target-dir = $(dir $@)
1288else
1289 zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
1290 build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
1291 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
1292endif
1293
1280%.s: %.c prepare scripts FORCE 1294%.s: %.c prepare scripts FORCE
1281 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1295 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1282%.i: %.c prepare scripts FORCE 1296%.i: %.c prepare scripts FORCE
1283 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1297 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1284%.o: %.c prepare scripts FORCE 1298%.o: %.c prepare scripts FORCE
1285 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1299 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1286%.lst: %.c prepare scripts FORCE 1300%.lst: %.c prepare scripts FORCE
1287 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1301 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1288%.s: %.S prepare scripts FORCE 1302%.s: %.S prepare scripts FORCE
1289 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1303 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1290%.o: %.S prepare scripts FORCE 1304%.o: %.S prepare scripts FORCE
1291 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) 1305 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1292
1293# For external modules we shall include any directory of the target,
1294# but usual case there is no directory part.
1295# make M=`pwd` module.o => $(dir $@)=./
1296# make M=`pwd` foo/module.o => $(dir $@)=foo/
1297# make M=`pwd` / => $(dir $@)=/
1298
1299ifeq ($(KBUILD_EXTMOD),)
1300 target-dir = $(@D)
1301else
1302 zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
1303 target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
1304endif
1305 1306
1306/ %/: scripts prepare FORCE 1307# Modules
1308/ %/: prepare scripts FORCE
1307 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1309 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1308 $(build)=$(target-dir) 1310 $(build)=$(build-dir)
1309%.ko: scripts FORCE 1311%.ko: prepare scripts FORCE
1310 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1312 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1311 $(build)=$(target-dir) $(@:.ko=.o) 1313 $(build)=$(build-dir) $(@:.ko=.o)
1312 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost 1314 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
1313 1315
1314# FIXME Should go into a make.lib or something 1316# FIXME Should go into a make.lib or something
diff --git a/README b/README
index 05e055530bbb..3e264723b863 100644
--- a/README
+++ b/README
@@ -165,10 +165,31 @@ CONFIGURING the kernel:
165 "make xconfig" X windows (Qt) based configuration tool. 165 "make xconfig" X windows (Qt) based configuration tool.
166 "make gconfig" X windows (Gtk) based configuration tool. 166 "make gconfig" X windows (Gtk) based configuration tool.
167 "make oldconfig" Default all questions based on the contents of 167 "make oldconfig" Default all questions based on the contents of
168 your existing ./.config file. 168 your existing ./.config file and asking about
169 new config symbols.
169 "make silentoldconfig" 170 "make silentoldconfig"
170 Like above, but avoids cluttering the screen 171 Like above, but avoids cluttering the screen
171 with questions already answered. 172 with questions already answered.
173 "make defconfig" Create a ./.config file by using the default
174 symbol values from arch/$ARCH/defconfig.
175 "make allyesconfig"
176 Create a ./.config file by setting symbol
177 values to 'y' as much as possible.
178 "make allmodconfig"
179 Create a ./.config file by setting symbol
180 values to 'm' as much as possible.
181 "make allnoconfig" Create a ./.config file by setting symbol
182 values to 'n' as much as possible.
183 "make randconfig" Create a ./.config file by setting symbol
184 values to random values.
185
186 The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
187 also use the environment variable KCONFIG_ALLCONFIG to specify a
188 filename that contains config options that the user requires to be
189 set to a specific value. If KCONFIG_ALLCONFIG=filename is not used,
190 "make *config" checks for a file named "all{yes/mod/no/random}.config"
191 for symbol values that are to be forced. If this file is not found,
192 it checks for a file named "all.config" to contain forced values.
172 193
173 NOTES on "make config": 194 NOTES on "make config":
174 - having unnecessary drivers will make the kernel bigger, and can 195 - having unnecessary drivers will make the kernel bigger, and can
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 9bef61b30367..8290b69da202 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -549,6 +549,11 @@ config NUMA
549 Access). This option is for configuring high-end multiprocessor 549 Access). This option is for configuring high-end multiprocessor
550 server machines. If in doubt, say N. 550 server machines. If in doubt, say N.
551 551
552config NODES_SHIFT
553 int
554 default "7"
555 depends on NEED_MULTIPLE_NODES
556
552# LARGE_VMALLOC is racy, if you *really* need it then fix it first 557# LARGE_VMALLOC is racy, if you *really* need it then fix it first
553config ALPHA_LARGE_VMALLOC 558config ALPHA_LARGE_VMALLOC
554 bool 559 bool
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index 9d6186d50245..c645c5e14786 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -76,7 +76,6 @@ EXPORT_SYMBOL(strncpy);
76EXPORT_SYMBOL(strnlen); 76EXPORT_SYMBOL(strnlen);
77EXPORT_SYMBOL(strncat); 77EXPORT_SYMBOL(strncat);
78EXPORT_SYMBOL(strstr); 78EXPORT_SYMBOL(strstr);
79EXPORT_SYMBOL(strpbrk);
80EXPORT_SYMBOL(strchr); 79EXPORT_SYMBOL(strchr);
81EXPORT_SYMBOL(strrchr); 80EXPORT_SYMBOL(strrchr);
82EXPORT_SYMBOL(memcmp); 81EXPORT_SYMBOL(memcmp);
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index a15e18a00258..558b83368559 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -24,6 +24,7 @@
24#include <linux/config.h> /* CONFIG_ALPHA_LCA etc */ 24#include <linux/config.h> /* CONFIG_ALPHA_LCA etc */
25#include <linux/mc146818rtc.h> 25#include <linux/mc146818rtc.h>
26#include <linux/console.h> 26#include <linux/console.h>
27#include <linux/cpu.h>
27#include <linux/errno.h> 28#include <linux/errno.h>
28#include <linux/init.h> 29#include <linux/init.h>
29#include <linux/string.h> 30#include <linux/string.h>
@@ -471,6 +472,22 @@ page_is_ram(unsigned long pfn)
471 return 0; 472 return 0;
472} 473}
473 474
475static int __init
476register_cpus(void)
477{
478 int i;
479
480 for_each_possible_cpu(i) {
481 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
482 if (!p)
483 return -ENOMEM;
484 register_cpu(p, i, NULL);
485 }
486 return 0;
487}
488
489arch_initcall(register_cpus);
490
474void __init 491void __init
475setup_arch(char **cmdline_p) 492setup_arch(char **cmdline_p)
476{ 493{
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 02c2db08114a..185255416e85 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -439,7 +439,7 @@ setup_smp(void)
439 if ((cpu->flags & 0x1cc) == 0x1cc) { 439 if ((cpu->flags & 0x1cc) == 0x1cc) {
440 smp_num_probed++; 440 smp_num_probed++;
441 /* Assume here that "whami" == index */ 441 /* Assume here that "whami" == index */
442 cpu_set(i, cpu_possible_map); 442 cpu_set(i, cpu_present_mask);
443 cpu->pal_revision = boot_cpu_palrev; 443 cpu->pal_revision = boot_cpu_palrev;
444 } 444 }
445 445
@@ -450,9 +450,8 @@ setup_smp(void)
450 } 450 }
451 } else { 451 } else {
452 smp_num_probed = 1; 452 smp_num_probed = 1;
453 cpu_set(boot_cpuid, cpu_possible_map); 453 cpu_set(boot_cpuid, cpu_present_mask);
454 } 454 }
455 cpu_present_mask = cpumask_of_cpu(boot_cpuid);
456 455
457 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 456 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
458 smp_num_probed, cpu_possible_map.bits[0]); 457 smp_num_probed, cpu_possible_map.bits[0]);
@@ -488,9 +487,8 @@ void __devinit
488smp_prepare_boot_cpu(void) 487smp_prepare_boot_cpu(void)
489{ 488{
490 /* 489 /*
491 * Mark the boot cpu (current cpu) as both present and online 490 * Mark the boot cpu (current cpu) as online
492 */ 491 */
493 cpu_set(smp_processor_id(), cpu_present_mask);
494 cpu_set(smp_processor_id(), cpu_online_map); 492 cpu_set(smp_processor_id(), cpu_online_map);
495} 493}
496 494
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index dc5a9332c915..1dbf6ddb300d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -512,6 +512,12 @@ config ARCH_DISCONTIGMEM_ENABLE
512 or have huge holes in the physical address space for other reasons. 512 or have huge holes in the physical address space for other reasons.
513 See <file:Documentation/vm/numa> for more. 513 See <file:Documentation/vm/numa> for more.
514 514
515config NODES_SHIFT
516 int
517 default "4" if ARCH_LH7A40X
518 default "2"
519 depends on NEED_MULTIPLE_NODES
520
515source "mm/Kconfig" 521source "mm/Kconfig"
516 522
517config LEDS 523config LEDS
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index eed616113e47..153a07e7222b 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -18,6 +18,7 @@ SECTIONS
18 _start = .; 18 _start = .;
19 *(.start) 19 *(.start)
20 *(.text) 20 *(.text)
21 *(.text.*)
21 *(.fixup) 22 *(.fixup)
22 *(.gnu.warning) 23 *(.gnu.warning)
23 *(.rodata) 24 *(.rodata)
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 5e830f444c6c..314ebd3a1d71 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -18,6 +18,18 @@
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/hardware/scoop.h> 19#include <asm/hardware/scoop.h>
20 20
21/* PCMCIA to Scoop linkage
22
23 There is no easy way to link multiple scoop devices into one
24 single entity for the pxa2xx_pcmcia device so this structure
25 is used which is setup by the platform code.
26
27 This file is never modular so this symbol is always
28 accessile to the board support files.
29*/
30struct scoop_pcmcia_config *platform_scoop_config;
31EXPORT_SYMBOL(platform_scoop_config);
32
21#define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr))) 33#define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
22 34
23struct scoop_dev { 35struct scoop_dev {
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 8dcc8e8ec813..b69e88bbc909 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -1,12 +1,14 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16 3# Linux kernel version: 2.6.17-rc2
4# Mon Mar 20 14:54:51 2006 4# Wed Apr 19 21:21:01 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_VECTORS_BASE=0xffff0000
10 12
11# 13#
12# Code maturity level options 14# Code maturity level options
@@ -28,6 +30,7 @@ CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set 30# CONFIG_AUDIT is not set
29CONFIG_IKCONFIG=y 31CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y 32CONFIG_IKCONFIG_PROC=y
33# CONFIG_RELAY is not set
31CONFIG_INITRAMFS_SOURCE="" 34CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y 35CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -43,10 +46,6 @@ CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y 46CONFIG_FUTEX=y
44CONFIG_EPOLL=y 47CONFIG_EPOLL=y
45CONFIG_SHMEM=y 48CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50CONFIG_SLAB=y 49CONFIG_SLAB=y
51# CONFIG_TINY_SHMEM is not set 50# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=0 51CONFIG_BASE_SMALL=0
@@ -59,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y
59CONFIG_MODULES=y 58CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y 59CONFIG_MODULE_UNLOAD=y
61CONFIG_MODULE_FORCE_UNLOAD=y 60CONFIG_MODULE_FORCE_UNLOAD=y
62CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_MODVERSIONS is not set 61# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set 62# CONFIG_MODULE_SRCVERSION_ALL is not set
65CONFIG_KMOD=y 63CONFIG_KMOD=y
@@ -67,6 +65,7 @@ CONFIG_KMOD=y
67# 65#
68# Block layer 66# Block layer
69# 67#
68# CONFIG_BLK_DEV_IO_TRACE is not set
70 69
71# 70#
72# IO Schedulers 71# IO Schedulers
@@ -94,6 +93,7 @@ CONFIG_ARCH_EP93XX=y
94# CONFIG_ARCH_IOP3XX is not set 93# CONFIG_ARCH_IOP3XX is not set
95# CONFIG_ARCH_IXP4XX is not set 94# CONFIG_ARCH_IXP4XX is not set
96# CONFIG_ARCH_IXP2000 is not set 95# CONFIG_ARCH_IXP2000 is not set
96# CONFIG_ARCH_IXP23XX is not set
97# CONFIG_ARCH_L7200 is not set 97# CONFIG_ARCH_L7200 is not set
98# CONFIG_ARCH_PXA is not set 98# CONFIG_ARCH_PXA is not set
99# CONFIG_ARCH_RPC is not set 99# CONFIG_ARCH_RPC is not set
@@ -112,7 +112,6 @@ CONFIG_ARCH_EP93XX=y
112# 112#
113# Cirrus EP93xx Implementation Options 113# Cirrus EP93xx Implementation Options
114# 114#
115CONFIG_CRUNCH=y
116 115
117# 116#
118# EP93xx Platforms 117# EP93xx Platforms
@@ -232,12 +231,15 @@ CONFIG_SYN_COOKIES=y
232# CONFIG_INET_AH is not set 231# CONFIG_INET_AH is not set
233# CONFIG_INET_ESP is not set 232# CONFIG_INET_ESP is not set
234# CONFIG_INET_IPCOMP is not set 233# CONFIG_INET_IPCOMP is not set
234# CONFIG_INET_XFRM_TUNNEL is not set
235# CONFIG_INET_TUNNEL is not set 235# CONFIG_INET_TUNNEL is not set
236CONFIG_INET_DIAG=y 236CONFIG_INET_DIAG=y
237CONFIG_INET_TCP_DIAG=y 237CONFIG_INET_TCP_DIAG=y
238# CONFIG_TCP_CONG_ADVANCED is not set 238# CONFIG_TCP_CONG_ADVANCED is not set
239CONFIG_TCP_CONG_BIC=y 239CONFIG_TCP_CONG_BIC=y
240# CONFIG_IPV6 is not set 240# CONFIG_IPV6 is not set
241# CONFIG_INET6_XFRM_TUNNEL is not set
242# CONFIG_INET6_TUNNEL is not set
241# CONFIG_NETFILTER is not set 243# CONFIG_NETFILTER is not set
242 244
243# 245#
@@ -346,7 +348,6 @@ CONFIG_MTD_CFI_I2=y
346# CONFIG_MTD_OTP is not set 348# CONFIG_MTD_OTP is not set
347CONFIG_MTD_CFI_INTELEXT=y 349CONFIG_MTD_CFI_INTELEXT=y
348CONFIG_MTD_CFI_AMDSTD=y 350CONFIG_MTD_CFI_AMDSTD=y
349CONFIG_MTD_CFI_AMDSTD_RETRY=0
350CONFIG_MTD_CFI_STAA=y 351CONFIG_MTD_CFI_STAA=y
351CONFIG_MTD_CFI_UTIL=y 352CONFIG_MTD_CFI_UTIL=y
352# CONFIG_MTD_RAM is not set 353# CONFIG_MTD_RAM is not set
@@ -371,7 +372,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
371# CONFIG_MTD_SLRAM is not set 372# CONFIG_MTD_SLRAM is not set
372# CONFIG_MTD_PHRAM is not set 373# CONFIG_MTD_PHRAM is not set
373# CONFIG_MTD_MTDRAM is not set 374# CONFIG_MTD_MTDRAM is not set
374# CONFIG_MTD_BLKMTD is not set
375# CONFIG_MTD_BLOCK2MTD is not set 375# CONFIG_MTD_BLOCK2MTD is not set
376 376
377# 377#
@@ -412,7 +412,7 @@ CONFIG_MTD_NAND_IDS=y
412# CONFIG_BLK_DEV_NBD is not set 412# CONFIG_BLK_DEV_NBD is not set
413# CONFIG_BLK_DEV_UB is not set 413# CONFIG_BLK_DEV_UB is not set
414# CONFIG_BLK_DEV_RAM is not set 414# CONFIG_BLK_DEV_RAM is not set
415CONFIG_BLK_DEV_RAM_COUNT=16 415# CONFIG_BLK_DEV_INITRD is not set
416# CONFIG_CDROM_PKTCDVD is not set 416# CONFIG_CDROM_PKTCDVD is not set
417# CONFIG_ATA_OVER_ETH is not set 417# CONFIG_ATA_OVER_ETH is not set
418 418
@@ -576,13 +576,13 @@ CONFIG_WATCHDOG=y
576# Watchdog Device Drivers 576# Watchdog Device Drivers
577# 577#
578# CONFIG_SOFT_WATCHDOG is not set 578# CONFIG_SOFT_WATCHDOG is not set
579CONFIG_EP93XX_WATCHDOG=y
579 580
580# 581#
581# USB-based Watchdog Cards 582# USB-based Watchdog Cards
582# 583#
583# CONFIG_USBPCWATCHDOG is not set 584# CONFIG_USBPCWATCHDOG is not set
584# CONFIG_NVRAM is not set 585# CONFIG_NVRAM is not set
585# CONFIG_RTC is not set
586# CONFIG_DTLK is not set 586# CONFIG_DTLK is not set
587# CONFIG_R3964 is not set 587# CONFIG_R3964 is not set
588 588
@@ -626,9 +626,7 @@ CONFIG_I2C_ALGOBIT=y
626# CONFIG_SENSORS_PCF8574 is not set 626# CONFIG_SENSORS_PCF8574 is not set
627# CONFIG_SENSORS_PCA9539 is not set 627# CONFIG_SENSORS_PCA9539 is not set
628# CONFIG_SENSORS_PCF8591 is not set 628# CONFIG_SENSORS_PCF8591 is not set
629# CONFIG_SENSORS_RTC8564 is not set
630# CONFIG_SENSORS_MAX6875 is not set 629# CONFIG_SENSORS_MAX6875 is not set
631# CONFIG_RTC_X1205_I2C is not set
632CONFIG_I2C_DEBUG_CORE=y 630CONFIG_I2C_DEBUG_CORE=y
633CONFIG_I2C_DEBUG_ALGO=y 631CONFIG_I2C_DEBUG_ALGO=y
634CONFIG_I2C_DEBUG_BUS=y 632CONFIG_I2C_DEBUG_BUS=y
@@ -690,7 +688,16 @@ CONFIG_HWMON=y
690# 688#
691 689
692# 690#
693# Multimedia Capabilities Port drivers 691# LED devices
692#
693# CONFIG_NEW_LEDS is not set
694
695#
696# LED drivers
697#
698
699#
700# LED Triggers
694# 701#
695 702
696# 703#
@@ -702,6 +709,7 @@ CONFIG_HWMON=y
702# Digital Video Broadcasting Devices 709# Digital Video Broadcasting Devices
703# 710#
704# CONFIG_DVB is not set 711# CONFIG_DVB is not set
712# CONFIG_USB_DABUSB is not set
705 713
706# 714#
707# Graphics support 715# Graphics support
@@ -718,6 +726,7 @@ CONFIG_HWMON=y
718# 726#
719CONFIG_USB_ARCH_HAS_HCD=y 727CONFIG_USB_ARCH_HAS_HCD=y
720# CONFIG_USB_ARCH_HAS_OHCI is not set 728# CONFIG_USB_ARCH_HAS_OHCI is not set
729# CONFIG_USB_ARCH_HAS_EHCI is not set
721CONFIG_USB=y 730CONFIG_USB=y
722CONFIG_USB_DEBUG=y 731CONFIG_USB_DEBUG=y
723 732
@@ -776,15 +785,6 @@ CONFIG_USB_STORAGE=y
776# CONFIG_USB_MICROTEK is not set 785# CONFIG_USB_MICROTEK is not set
777 786
778# 787#
779# USB Multimedia devices
780#
781# CONFIG_USB_DABUSB is not set
782
783#
784# Video4Linux support is needed for USB Multimedia device support
785#
786
787#
788# USB Network Adapters 788# USB Network Adapters
789# 789#
790# CONFIG_USB_CATC is not set 790# CONFIG_USB_CATC is not set
@@ -813,6 +813,7 @@ CONFIG_USB_SERIAL_CONSOLE=y
813# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 813# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
814# CONFIG_USB_SERIAL_EMPEG is not set 814# CONFIG_USB_SERIAL_EMPEG is not set
815# CONFIG_USB_SERIAL_FTDI_SIO is not set 815# CONFIG_USB_SERIAL_FTDI_SIO is not set
816# CONFIG_USB_SERIAL_FUNSOFT is not set
816# CONFIG_USB_SERIAL_VISOR is not set 817# CONFIG_USB_SERIAL_VISOR is not set
817# CONFIG_USB_SERIAL_IPAQ is not set 818# CONFIG_USB_SERIAL_IPAQ is not set
818# CONFIG_USB_SERIAL_IR is not set 819# CONFIG_USB_SERIAL_IR is not set
@@ -825,6 +826,7 @@ CONFIG_USB_SERIAL_CONSOLE=y
825# CONFIG_USB_SERIAL_KLSI is not set 826# CONFIG_USB_SERIAL_KLSI is not set
826# CONFIG_USB_SERIAL_KOBIL_SCT is not set 827# CONFIG_USB_SERIAL_KOBIL_SCT is not set
827# CONFIG_USB_SERIAL_MCT_U232 is not set 828# CONFIG_USB_SERIAL_MCT_U232 is not set
829# CONFIG_USB_SERIAL_NAVMAN is not set
828CONFIG_USB_SERIAL_PL2303=y 830CONFIG_USB_SERIAL_PL2303=y
829# CONFIG_USB_SERIAL_HP4X is not set 831# CONFIG_USB_SERIAL_HP4X is not set
830# CONFIG_USB_SERIAL_SAFE is not set 832# CONFIG_USB_SERIAL_SAFE is not set
@@ -865,6 +867,32 @@ CONFIG_USB_SERIAL_PL2303=y
865# CONFIG_MMC is not set 867# CONFIG_MMC is not set
866 868
867# 869#
870# Real Time Clock
871#
872CONFIG_RTC_LIB=y
873CONFIG_RTC_CLASS=y
874CONFIG_RTC_HCTOSYS=y
875CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
876
877#
878# RTC interfaces
879#
880CONFIG_RTC_INTF_SYSFS=y
881CONFIG_RTC_INTF_PROC=y
882CONFIG_RTC_INTF_DEV=y
883
884#
885# RTC drivers
886#
887# CONFIG_RTC_DRV_X1205 is not set
888# CONFIG_RTC_DRV_DS1672 is not set
889# CONFIG_RTC_DRV_PCF8563 is not set
890# CONFIG_RTC_DRV_RS5C372 is not set
891CONFIG_RTC_DRV_M48T86=y
892CONFIG_RTC_DRV_EP93XX=y
893# CONFIG_RTC_DRV_TEST is not set
894
895#
868# File systems 896# File systems
869# 897#
870CONFIG_EXT2_FS=y 898CONFIG_EXT2_FS=y
@@ -912,7 +940,6 @@ CONFIG_SYSFS=y
912CONFIG_TMPFS=y 940CONFIG_TMPFS=y
913# CONFIG_HUGETLB_PAGE is not set 941# CONFIG_HUGETLB_PAGE is not set
914CONFIG_RAMFS=y 942CONFIG_RAMFS=y
915# CONFIG_RELAYFS_FS is not set
916# CONFIG_CONFIGFS_FS is not set 943# CONFIG_CONFIGFS_FS is not set
917 944
918# 945#
@@ -1044,6 +1071,7 @@ CONFIG_LOG_BUF_SHIFT=14
1044CONFIG_DETECT_SOFTLOCKUP=y 1071CONFIG_DETECT_SOFTLOCKUP=y
1045# CONFIG_SCHEDSTATS is not set 1072# CONFIG_SCHEDSTATS is not set
1046CONFIG_DEBUG_SLAB=y 1073CONFIG_DEBUG_SLAB=y
1074# CONFIG_DEBUG_SLAB_LEAK is not set
1047CONFIG_DEBUG_MUTEXES=y 1075CONFIG_DEBUG_MUTEXES=y
1048CONFIG_DEBUG_SPINLOCK=y 1076CONFIG_DEBUG_SPINLOCK=y
1049# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1077# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
@@ -1053,6 +1081,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1053# CONFIG_DEBUG_FS is not set 1081# CONFIG_DEBUG_FS is not set
1054# CONFIG_DEBUG_VM is not set 1082# CONFIG_DEBUG_VM is not set
1055CONFIG_FRAME_POINTER=y 1083CONFIG_FRAME_POINTER=y
1084# CONFIG_UNWIND_INFO is not set
1056CONFIG_FORCED_INLINING=y 1085CONFIG_FORCED_INLINING=y
1057# CONFIG_RCU_TORTURE_TEST is not set 1086# CONFIG_RCU_TORTURE_TEST is not set
1058CONFIG_DEBUG_USER=y 1087CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
index 7b02ca04c3ee..e6f3e4873d6c 100644
--- a/arch/arm/configs/ixp2000_defconfig
+++ b/arch/arm/configs/ixp2000_defconfig
@@ -1,18 +1,19 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc2 3# Linux kernel version: 2.6.17-rc2
4# Wed Feb 8 04:49:11 2006 4# Wed Apr 19 21:12:49 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_VECTORS_BASE=0xffff0000
10 12
11# 13#
12# Code maturity level options 14# Code maturity level options
13# 15#
14CONFIG_EXPERIMENTAL=y 16CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
17CONFIG_INIT_ENV_ARG_LIMIT=32 18CONFIG_INIT_ENV_ARG_LIMIT=32
18 19
@@ -29,6 +30,7 @@ CONFIG_BSD_PROCESS_ACCT=y
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31# CONFIG_IKCONFIG is not set 32# CONFIG_IKCONFIG is not set
33# CONFIG_RELAY is not set
32CONFIG_INITRAMFS_SOURCE="" 34CONFIG_INITRAMFS_SOURCE=""
33CONFIG_UID16=y 35CONFIG_UID16=y
34CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -44,10 +46,6 @@ CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y 46CONFIG_FUTEX=y
45CONFIG_EPOLL=y 47CONFIG_EPOLL=y
46CONFIG_SHMEM=y 48CONFIG_SHMEM=y
47CONFIG_CC_ALIGN_FUNCTIONS=0
48CONFIG_CC_ALIGN_LABELS=0
49CONFIG_CC_ALIGN_LOOPS=0
50CONFIG_CC_ALIGN_JUMPS=0
51CONFIG_SLAB=y 49CONFIG_SLAB=y
52# CONFIG_TINY_SHMEM is not set 50# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0 51CONFIG_BASE_SMALL=0
@@ -60,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y
60CONFIG_MODULES=y 58CONFIG_MODULES=y
61CONFIG_MODULE_UNLOAD=y 59CONFIG_MODULE_UNLOAD=y
62# CONFIG_MODULE_FORCE_UNLOAD is not set 60# CONFIG_MODULE_FORCE_UNLOAD is not set
63CONFIG_OBSOLETE_MODPARM=y
64# CONFIG_MODVERSIONS is not set 61# CONFIG_MODVERSIONS is not set
65# CONFIG_MODULE_SRCVERSION_ALL is not set 62# CONFIG_MODULE_SRCVERSION_ALL is not set
66CONFIG_KMOD=y 63CONFIG_KMOD=y
@@ -68,6 +65,7 @@ CONFIG_KMOD=y
68# 65#
69# Block layer 66# Block layer
70# 67#
68# CONFIG_BLK_DEV_IO_TRACE is not set
71 69
72# 70#
73# IO Schedulers 71# IO Schedulers
@@ -89,11 +87,13 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
89# CONFIG_ARCH_CLPS711X is not set 87# CONFIG_ARCH_CLPS711X is not set
90# CONFIG_ARCH_CO285 is not set 88# CONFIG_ARCH_CO285 is not set
91# CONFIG_ARCH_EBSA110 is not set 89# CONFIG_ARCH_EBSA110 is not set
90# CONFIG_ARCH_EP93XX is not set
92# CONFIG_ARCH_FOOTBRIDGE is not set 91# CONFIG_ARCH_FOOTBRIDGE is not set
93# CONFIG_ARCH_INTEGRATOR is not set 92# CONFIG_ARCH_INTEGRATOR is not set
94# CONFIG_ARCH_IOP3XX is not set 93# CONFIG_ARCH_IOP3XX is not set
95# CONFIG_ARCH_IXP4XX is not set 94# CONFIG_ARCH_IXP4XX is not set
96CONFIG_ARCH_IXP2000=y 95CONFIG_ARCH_IXP2000=y
96# CONFIG_ARCH_IXP23XX is not set
97# CONFIG_ARCH_L7200 is not set 97# CONFIG_ARCH_L7200 is not set
98# CONFIG_ARCH_PXA is not set 98# CONFIG_ARCH_PXA is not set
99# CONFIG_ARCH_RPC is not set 99# CONFIG_ARCH_RPC is not set
@@ -123,6 +123,7 @@ CONFIG_ARCH_IXDP2800=y
123CONFIG_ARCH_IXDP2X00=y 123CONFIG_ARCH_IXDP2X00=y
124CONFIG_ARCH_IXDP2401=y 124CONFIG_ARCH_IXDP2401=y
125CONFIG_ARCH_IXDP2801=y 125CONFIG_ARCH_IXDP2801=y
126CONFIG_MACH_IXDP28X5=y
126CONFIG_ARCH_IXDP2X01=y 127CONFIG_ARCH_IXDP2X01=y
127# CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO is not set 128# CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO is not set
128 129
@@ -147,7 +148,6 @@ CONFIG_XSCALE_PMU=y
147# Bus support 148# Bus support
148# 149#
149CONFIG_PCI=y 150CONFIG_PCI=y
150CONFIG_PCI_LEGACY_PROC=y
151# CONFIG_PCI_DEBUG is not set 151# CONFIG_PCI_DEBUG is not set
152 152
153# 153#
@@ -160,6 +160,7 @@ CONFIG_PCI_LEGACY_PROC=y
160# 160#
161# CONFIG_PREEMPT is not set 161# CONFIG_PREEMPT is not set
162# CONFIG_NO_IDLE_HZ is not set 162# CONFIG_NO_IDLE_HZ is not set
163CONFIG_HZ=100
163# CONFIG_AEABI is not set 164# CONFIG_AEABI is not set
164# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 165# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
165CONFIG_SELECT_MEMORY_MODEL=y 166CONFIG_SELECT_MEMORY_MODEL=y
@@ -213,6 +214,7 @@ CONFIG_NET=y
213# 214#
214# Networking options 215# Networking options
215# 216#
217# CONFIG_NETDEBUG is not set
216CONFIG_PACKET=y 218CONFIG_PACKET=y
217CONFIG_PACKET_MMAP=y 219CONFIG_PACKET_MMAP=y
218CONFIG_UNIX=y 220CONFIG_UNIX=y
@@ -232,12 +234,15 @@ CONFIG_SYN_COOKIES=y
232# CONFIG_INET_AH is not set 234# CONFIG_INET_AH is not set
233# CONFIG_INET_ESP is not set 235# CONFIG_INET_ESP is not set
234# CONFIG_INET_IPCOMP is not set 236# CONFIG_INET_IPCOMP is not set
237# CONFIG_INET_XFRM_TUNNEL is not set
235# CONFIG_INET_TUNNEL is not set 238# CONFIG_INET_TUNNEL is not set
236CONFIG_INET_DIAG=y 239CONFIG_INET_DIAG=y
237CONFIG_INET_TCP_DIAG=y 240CONFIG_INET_TCP_DIAG=y
238# CONFIG_TCP_CONG_ADVANCED is not set 241# CONFIG_TCP_CONG_ADVANCED is not set
239CONFIG_TCP_CONG_BIC=y 242CONFIG_TCP_CONG_BIC=y
240# CONFIG_IPV6 is not set 243# CONFIG_IPV6 is not set
244# CONFIG_INET6_XFRM_TUNNEL is not set
245# CONFIG_INET6_TUNNEL is not set
241# CONFIG_NETFILTER is not set 246# CONFIG_NETFILTER is not set
242 247
243# 248#
@@ -347,7 +352,6 @@ CONFIG_MTD_CFI_UTIL=y
347# CONFIG_MTD_ROM is not set 352# CONFIG_MTD_ROM is not set
348# CONFIG_MTD_ABSENT is not set 353# CONFIG_MTD_ABSENT is not set
349# CONFIG_MTD_OBSOLETE_CHIPS is not set 354# CONFIG_MTD_OBSOLETE_CHIPS is not set
350# CONFIG_MTD_XIP is not set
351 355
352# 356#
353# Mapping drivers for chip access 357# Mapping drivers for chip access
@@ -366,7 +370,6 @@ CONFIG_MTD_IXP2000=y
366# CONFIG_MTD_SLRAM is not set 370# CONFIG_MTD_SLRAM is not set
367# CONFIG_MTD_PHRAM is not set 371# CONFIG_MTD_PHRAM is not set
368# CONFIG_MTD_MTDRAM is not set 372# CONFIG_MTD_MTDRAM is not set
369# CONFIG_MTD_BLKMTD is not set
370# CONFIG_MTD_BLOCK2MTD is not set 373# CONFIG_MTD_BLOCK2MTD is not set
371 374
372# 375#
@@ -614,8 +617,9 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
614# 617#
615CONFIG_SERIAL_8250=y 618CONFIG_SERIAL_8250=y
616CONFIG_SERIAL_8250_CONSOLE=y 619CONFIG_SERIAL_8250_CONSOLE=y
620CONFIG_SERIAL_8250_PCI=y
617CONFIG_SERIAL_8250_NR_UARTS=3 621CONFIG_SERIAL_8250_NR_UARTS=3
618CONFIG_SERIAL_8250_RUNTIME_UARTS=4 622CONFIG_SERIAL_8250_RUNTIME_UARTS=3
619# CONFIG_SERIAL_8250_EXTENDED is not set 623# CONFIG_SERIAL_8250_EXTENDED is not set
620 624
621# 625#
@@ -623,6 +627,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
623# 627#
624CONFIG_SERIAL_CORE=y 628CONFIG_SERIAL_CORE=y
625CONFIG_SERIAL_CORE_CONSOLE=y 629CONFIG_SERIAL_CORE_CONSOLE=y
630# CONFIG_SERIAL_JSM is not set
626CONFIG_UNIX98_PTYS=y 631CONFIG_UNIX98_PTYS=y
627CONFIG_LEGACY_PTYS=y 632CONFIG_LEGACY_PTYS=y
628CONFIG_LEGACY_PTY_COUNT=256 633CONFIG_LEGACY_PTY_COUNT=256
@@ -650,7 +655,6 @@ CONFIG_IXP2000_WATCHDOG=y
650# CONFIG_PCIPCWATCHDOG is not set 655# CONFIG_PCIPCWATCHDOG is not set
651# CONFIG_WDTPCI is not set 656# CONFIG_WDTPCI is not set
652# CONFIG_NVRAM is not set 657# CONFIG_NVRAM is not set
653# CONFIG_RTC is not set
654# CONFIG_DTLK is not set 658# CONFIG_DTLK is not set
655# CONFIG_R3964 is not set 659# CONFIG_R3964 is not set
656# CONFIG_APPLICOM is not set 660# CONFIG_APPLICOM is not set
@@ -696,7 +700,6 @@ CONFIG_I2C_IXP2000=y
696# CONFIG_I2C_PARPORT_LIGHT is not set 700# CONFIG_I2C_PARPORT_LIGHT is not set
697# CONFIG_I2C_PROSAVAGE is not set 701# CONFIG_I2C_PROSAVAGE is not set
698# CONFIG_I2C_SAVAGE4 is not set 702# CONFIG_I2C_SAVAGE4 is not set
699# CONFIG_SCx200_ACB is not set
700# CONFIG_I2C_SIS5595 is not set 703# CONFIG_I2C_SIS5595 is not set
701# CONFIG_I2C_SIS630 is not set 704# CONFIG_I2C_SIS630 is not set
702# CONFIG_I2C_SIS96X is not set 705# CONFIG_I2C_SIS96X is not set
@@ -715,9 +718,7 @@ CONFIG_SENSORS_EEPROM=y
715# CONFIG_SENSORS_PCF8574 is not set 718# CONFIG_SENSORS_PCF8574 is not set
716# CONFIG_SENSORS_PCA9539 is not set 719# CONFIG_SENSORS_PCA9539 is not set
717# CONFIG_SENSORS_PCF8591 is not set 720# CONFIG_SENSORS_PCF8591 is not set
718# CONFIG_SENSORS_RTC8564 is not set
719# CONFIG_SENSORS_MAX6875 is not set 721# CONFIG_SENSORS_MAX6875 is not set
720# CONFIG_RTC_X1205_I2C is not set
721# CONFIG_I2C_DEBUG_CORE is not set 722# CONFIG_I2C_DEBUG_CORE is not set
722# CONFIG_I2C_DEBUG_ALGO is not set 723# CONFIG_I2C_DEBUG_ALGO is not set
723# CONFIG_I2C_DEBUG_BUS is not set 724# CONFIG_I2C_DEBUG_BUS is not set
@@ -730,6 +731,11 @@ CONFIG_SENSORS_EEPROM=y
730# CONFIG_SPI_MASTER is not set 731# CONFIG_SPI_MASTER is not set
731 732
732# 733#
734# Dallas's 1-wire bus
735#
736# CONFIG_W1 is not set
737
738#
733# Hardware Monitoring support 739# Hardware Monitoring support
734# 740#
735CONFIG_HWMON=y 741CONFIG_HWMON=y
@@ -742,6 +748,7 @@ CONFIG_HWMON=y
742# CONFIG_SENSORS_ASB100 is not set 748# CONFIG_SENSORS_ASB100 is not set
743# CONFIG_SENSORS_ATXP1 is not set 749# CONFIG_SENSORS_ATXP1 is not set
744# CONFIG_SENSORS_DS1621 is not set 750# CONFIG_SENSORS_DS1621 is not set
751# CONFIG_SENSORS_F71805F is not set
745# CONFIG_SENSORS_FSCHER is not set 752# CONFIG_SENSORS_FSCHER is not set
746# CONFIG_SENSORS_FSCPOS is not set 753# CONFIG_SENSORS_FSCPOS is not set
747# CONFIG_SENSORS_GL518SM is not set 754# CONFIG_SENSORS_GL518SM is not set
@@ -776,7 +783,16 @@ CONFIG_HWMON=y
776# 783#
777 784
778# 785#
779# Multimedia Capabilities Port drivers 786# LED devices
787#
788# CONFIG_NEW_LEDS is not set
789
790#
791# LED drivers
792#
793
794#
795# LED Triggers
780# 796#
781 797
782# 798#
@@ -804,6 +820,7 @@ CONFIG_HWMON=y
804# 820#
805CONFIG_USB_ARCH_HAS_HCD=y 821CONFIG_USB_ARCH_HAS_HCD=y
806CONFIG_USB_ARCH_HAS_OHCI=y 822CONFIG_USB_ARCH_HAS_OHCI=y
823CONFIG_USB_ARCH_HAS_EHCI=y
807# CONFIG_USB is not set 824# CONFIG_USB is not set
808 825
809# 826#
@@ -821,6 +838,12 @@ CONFIG_USB_ARCH_HAS_OHCI=y
821# CONFIG_MMC is not set 838# CONFIG_MMC is not set
822 839
823# 840#
841# Real Time Clock
842#
843CONFIG_RTC_LIB=y
844# CONFIG_RTC_CLASS is not set
845
846#
824# File systems 847# File systems
825# 848#
826CONFIG_EXT2_FS=y 849CONFIG_EXT2_FS=y
@@ -870,7 +893,6 @@ CONFIG_SYSFS=y
870CONFIG_TMPFS=y 893CONFIG_TMPFS=y
871# CONFIG_HUGETLB_PAGE is not set 894# CONFIG_HUGETLB_PAGE is not set
872CONFIG_RAMFS=y 895CONFIG_RAMFS=y
873# CONFIG_RELAYFS_FS is not set
874# CONFIG_CONFIGFS_FS is not set 896# CONFIG_CONFIGFS_FS is not set
875 897
876# 898#
@@ -972,6 +994,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
972# CONFIG_DEBUG_FS is not set 994# CONFIG_DEBUG_FS is not set
973# CONFIG_DEBUG_VM is not set 995# CONFIG_DEBUG_VM is not set
974CONFIG_FRAME_POINTER=y 996CONFIG_FRAME_POINTER=y
997# CONFIG_UNWIND_INFO is not set
975CONFIG_FORCED_INLINING=y 998CONFIG_FORCED_INLINING=y
976# CONFIG_RCU_TORTURE_TEST is not set 999# CONFIG_RCU_TORTURE_TEST is not set
977CONFIG_DEBUG_USER=y 1000CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
index 1a2751e9ab05..9ce898a6cf87 100644
--- a/arch/arm/configs/ixp23xx_defconfig
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -1,12 +1,14 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16 3# Linux kernel version: 2.6.17-rc2
4# Tue Mar 21 03:27:20 2006 4# Wed Apr 19 21:13:50 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_VECTORS_BASE=0xffff0000
10 12
11# 13#
12# Code maturity level options 14# Code maturity level options
@@ -28,6 +30,7 @@ CONFIG_BSD_PROCESS_ACCT=y
28CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
30# CONFIG_IKCONFIG is not set 32# CONFIG_IKCONFIG is not set
33# CONFIG_RELAY is not set
31CONFIG_INITRAMFS_SOURCE="" 34CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y 35CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -43,10 +46,6 @@ CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y 46CONFIG_FUTEX=y
44CONFIG_EPOLL=y 47CONFIG_EPOLL=y
45CONFIG_SHMEM=y 48CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50CONFIG_SLAB=y 49CONFIG_SLAB=y
51# CONFIG_TINY_SHMEM is not set 50# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=0 51CONFIG_BASE_SMALL=0
@@ -59,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y
59CONFIG_MODULES=y 58CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y 59CONFIG_MODULE_UNLOAD=y
61# CONFIG_MODULE_FORCE_UNLOAD is not set 60# CONFIG_MODULE_FORCE_UNLOAD is not set
62CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_MODVERSIONS is not set 61# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set 62# CONFIG_MODULE_SRCVERSION_ALL is not set
65CONFIG_KMOD=y 63CONFIG_KMOD=y
@@ -67,6 +65,7 @@ CONFIG_KMOD=y
67# 65#
68# Block layer 66# Block layer
69# 67#
68# CONFIG_BLK_DEV_IO_TRACE is not set
70 69
71# 70#
72# IO Schedulers 71# IO Schedulers
@@ -143,7 +142,6 @@ CONFIG_CPU_BIG_ENDIAN=y
143# Bus support 142# Bus support
144# 143#
145CONFIG_PCI=y 144CONFIG_PCI=y
146CONFIG_PCI_LEGACY_PROC=y
147# CONFIG_PCI_DEBUG is not set 145# CONFIG_PCI_DEBUG is not set
148 146
149# 147#
@@ -230,12 +228,15 @@ CONFIG_SYN_COOKIES=y
230# CONFIG_INET_AH is not set 228# CONFIG_INET_AH is not set
231# CONFIG_INET_ESP is not set 229# CONFIG_INET_ESP is not set
232# CONFIG_INET_IPCOMP is not set 230# CONFIG_INET_IPCOMP is not set
231# CONFIG_INET_XFRM_TUNNEL is not set
233# CONFIG_INET_TUNNEL is not set 232# CONFIG_INET_TUNNEL is not set
234CONFIG_INET_DIAG=y 233CONFIG_INET_DIAG=y
235CONFIG_INET_TCP_DIAG=y 234CONFIG_INET_TCP_DIAG=y
236# CONFIG_TCP_CONG_ADVANCED is not set 235# CONFIG_TCP_CONG_ADVANCED is not set
237CONFIG_TCP_CONG_BIC=y 236CONFIG_TCP_CONG_BIC=y
238# CONFIG_IPV6 is not set 237# CONFIG_IPV6 is not set
238# CONFIG_INET6_XFRM_TUNNEL is not set
239# CONFIG_INET6_TUNNEL is not set
239# CONFIG_NETFILTER is not set 240# CONFIG_NETFILTER is not set
240 241
241# 242#
@@ -365,7 +366,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
365# CONFIG_MTD_SLRAM is not set 366# CONFIG_MTD_SLRAM is not set
366# CONFIG_MTD_PHRAM is not set 367# CONFIG_MTD_PHRAM is not set
367# CONFIG_MTD_MTDRAM is not set 368# CONFIG_MTD_MTDRAM is not set
368# CONFIG_MTD_BLKMTD is not set
369# CONFIG_MTD_BLOCK2MTD is not set 369# CONFIG_MTD_BLOCK2MTD is not set
370 370
371# 371#
@@ -527,7 +527,6 @@ CONFIG_BLK_DEV_SD=y
527# CONFIG_SCSI_INIA100 is not set 527# CONFIG_SCSI_INIA100 is not set
528# CONFIG_SCSI_SYM53C8XX_2 is not set 528# CONFIG_SCSI_SYM53C8XX_2 is not set
529# CONFIG_SCSI_IPR is not set 529# CONFIG_SCSI_IPR is not set
530# CONFIG_SCSI_QLOGIC_FC is not set
531# CONFIG_SCSI_QLOGIC_1280 is not set 530# CONFIG_SCSI_QLOGIC_1280 is not set
532# CONFIG_SCSI_QLA_FC is not set 531# CONFIG_SCSI_QLA_FC is not set
533# CONFIG_SCSI_LPFC is not set 532# CONFIG_SCSI_LPFC is not set
@@ -735,6 +734,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
735# 734#
736CONFIG_SERIAL_8250=y 735CONFIG_SERIAL_8250=y
737CONFIG_SERIAL_8250_CONSOLE=y 736CONFIG_SERIAL_8250_CONSOLE=y
737CONFIG_SERIAL_8250_PCI=y
738CONFIG_SERIAL_8250_NR_UARTS=4 738CONFIG_SERIAL_8250_NR_UARTS=4
739CONFIG_SERIAL_8250_RUNTIME_UARTS=4 739CONFIG_SERIAL_8250_RUNTIME_UARTS=4
740# CONFIG_SERIAL_8250_EXTENDED is not set 740# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -776,7 +776,6 @@ CONFIG_WATCHDOG=y
776# 776#
777# CONFIG_USBPCWATCHDOG is not set 777# CONFIG_USBPCWATCHDOG is not set
778# CONFIG_NVRAM is not set 778# CONFIG_NVRAM is not set
779# CONFIG_RTC is not set
780# CONFIG_DTLK is not set 779# CONFIG_DTLK is not set
781# CONFIG_R3964 is not set 780# CONFIG_R3964 is not set
782# CONFIG_APPLICOM is not set 781# CONFIG_APPLICOM is not set
@@ -821,7 +820,6 @@ CONFIG_I2C_ALGOBIT=y
821# CONFIG_I2C_PARPORT_LIGHT is not set 820# CONFIG_I2C_PARPORT_LIGHT is not set
822# CONFIG_I2C_PROSAVAGE is not set 821# CONFIG_I2C_PROSAVAGE is not set
823# CONFIG_I2C_SAVAGE4 is not set 822# CONFIG_I2C_SAVAGE4 is not set
824# CONFIG_SCx200_ACB is not set
825# CONFIG_I2C_SIS5595 is not set 823# CONFIG_I2C_SIS5595 is not set
826# CONFIG_I2C_SIS630 is not set 824# CONFIG_I2C_SIS630 is not set
827# CONFIG_I2C_SIS96X is not set 825# CONFIG_I2C_SIS96X is not set
@@ -840,9 +838,7 @@ CONFIG_SENSORS_EEPROM=y
840# CONFIG_SENSORS_PCF8574 is not set 838# CONFIG_SENSORS_PCF8574 is not set
841# CONFIG_SENSORS_PCA9539 is not set 839# CONFIG_SENSORS_PCA9539 is not set
842# CONFIG_SENSORS_PCF8591 is not set 840# CONFIG_SENSORS_PCF8591 is not set
843# CONFIG_SENSORS_RTC8564 is not set
844# CONFIG_SENSORS_MAX6875 is not set 841# CONFIG_SENSORS_MAX6875 is not set
845# CONFIG_RTC_X1205_I2C is not set
846# CONFIG_I2C_DEBUG_CORE is not set 842# CONFIG_I2C_DEBUG_CORE is not set
847# CONFIG_I2C_DEBUG_ALGO is not set 843# CONFIG_I2C_DEBUG_ALGO is not set
848# CONFIG_I2C_DEBUG_BUS is not set 844# CONFIG_I2C_DEBUG_BUS is not set
@@ -907,7 +903,16 @@ CONFIG_HWMON=y
907# 903#
908 904
909# 905#
910# Multimedia Capabilities Port drivers 906# LED devices
907#
908# CONFIG_NEW_LEDS is not set
909
910#
911# LED drivers
912#
913
914#
915# LED Triggers
911# 916#
912 917
913# 918#
@@ -919,6 +924,7 @@ CONFIG_HWMON=y
919# Digital Video Broadcasting Devices 924# Digital Video Broadcasting Devices
920# 925#
921# CONFIG_DVB is not set 926# CONFIG_DVB is not set
927# CONFIG_USB_DABUSB is not set
922 928
923# 929#
924# Graphics support 930# Graphics support
@@ -935,6 +941,7 @@ CONFIG_HWMON=y
935# 941#
936CONFIG_USB_ARCH_HAS_HCD=y 942CONFIG_USB_ARCH_HAS_HCD=y
937CONFIG_USB_ARCH_HAS_OHCI=y 943CONFIG_USB_ARCH_HAS_OHCI=y
944CONFIG_USB_ARCH_HAS_EHCI=y
938CONFIG_USB=y 945CONFIG_USB=y
939# CONFIG_USB_DEBUG is not set 946# CONFIG_USB_DEBUG is not set
940 947
@@ -1000,9 +1007,7 @@ CONFIG_USB_STORAGE=y
1000# CONFIG_USB_ACECAD is not set 1007# CONFIG_USB_ACECAD is not set
1001# CONFIG_USB_KBTAB is not set 1008# CONFIG_USB_KBTAB is not set
1002# CONFIG_USB_POWERMATE is not set 1009# CONFIG_USB_POWERMATE is not set
1003# CONFIG_USB_MTOUCH is not set 1010# CONFIG_USB_TOUCHSCREEN is not set
1004# CONFIG_USB_ITMTOUCH is not set
1005# CONFIG_USB_EGALAX is not set
1006# CONFIG_USB_YEALINK is not set 1011# CONFIG_USB_YEALINK is not set
1007# CONFIG_USB_XPAD is not set 1012# CONFIG_USB_XPAD is not set
1008# CONFIG_USB_ATI_REMOTE is not set 1013# CONFIG_USB_ATI_REMOTE is not set
@@ -1017,15 +1022,6 @@ CONFIG_USB_STORAGE=y
1017# CONFIG_USB_MICROTEK is not set 1022# CONFIG_USB_MICROTEK is not set
1018 1023
1019# 1024#
1020# USB Multimedia devices
1021#
1022# CONFIG_USB_DABUSB is not set
1023
1024#
1025# Video4Linux support is needed for USB Multimedia device support
1026#
1027
1028#
1029# USB Network Adapters 1025# USB Network Adapters
1030# 1026#
1031# CONFIG_USB_CATC is not set 1027# CONFIG_USB_CATC is not set
@@ -1076,6 +1072,12 @@ CONFIG_USB_MON=y
1076# CONFIG_MMC is not set 1072# CONFIG_MMC is not set
1077 1073
1078# 1074#
1075# Real Time Clock
1076#
1077CONFIG_RTC_LIB=y
1078# CONFIG_RTC_CLASS is not set
1079
1080#
1079# File systems 1081# File systems
1080# 1082#
1081CONFIG_EXT2_FS=y 1083CONFIG_EXT2_FS=y
@@ -1127,7 +1129,6 @@ CONFIG_SYSFS=y
1127CONFIG_TMPFS=y 1129CONFIG_TMPFS=y
1128# CONFIG_HUGETLB_PAGE is not set 1130# CONFIG_HUGETLB_PAGE is not set
1129CONFIG_RAMFS=y 1131CONFIG_RAMFS=y
1130# CONFIG_RELAYFS_FS is not set
1131# CONFIG_CONFIGFS_FS is not set 1132# CONFIG_CONFIGFS_FS is not set
1132 1133
1133# 1134#
@@ -1268,6 +1269,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1268# CONFIG_DEBUG_FS is not set 1269# CONFIG_DEBUG_FS is not set
1269# CONFIG_DEBUG_VM is not set 1270# CONFIG_DEBUG_VM is not set
1270CONFIG_FRAME_POINTER=y 1271CONFIG_FRAME_POINTER=y
1272# CONFIG_UNWIND_INFO is not set
1271CONFIG_FORCED_INLINING=y 1273CONFIG_FORCED_INLINING=y
1272# CONFIG_RCU_TORTURE_TEST is not set 1274# CONFIG_RCU_TORTURE_TEST is not set
1273CONFIG_DEBUG_USER=y 1275CONFIG_DEBUG_USER=y
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index ee083b3f0522..c49b5d4d7fca 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -101,7 +101,6 @@ EXPORT_SYMBOL(__raw_writesl);
101 101
102 /* string / mem functions */ 102 /* string / mem functions */
103EXPORT_SYMBOL(strchr); 103EXPORT_SYMBOL(strchr);
104EXPORT_SYMBOL(strpbrk);
105EXPORT_SYMBOL(strrchr); 104EXPORT_SYMBOL(strrchr);
106EXPORT_SYMBOL(memset); 105EXPORT_SYMBOL(memset);
107EXPORT_SYMBOL(memcpy); 106EXPORT_SYMBOL(memcpy);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 437528403959..9fc9af88c60c 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -322,6 +322,12 @@ static void __init setup_processor(void)
322 sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS); 322 sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS);
323 sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); 323 sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS);
324 elf_hwcap = list->elf_hwcap; 324 elf_hwcap = list->elf_hwcap;
325#ifndef CONFIG_ARM_THUMB
326 elf_hwcap &= ~HWCAP_THUMB;
327#endif
328#ifndef CONFIG_VFP
329 elf_hwcap &= ~HWCAP_VFP;
330#endif
325 331
326 cpu_proc_init(); 332 cpu_proc_init();
327} 333}
@@ -401,7 +407,7 @@ static void __init early_initrd(char **p)
401} 407}
402__early_param("initrd=", early_initrd); 408__early_param("initrd=", early_initrd);
403 409
404static void __init add_memory(unsigned long start, unsigned long size) 410static void __init arm_add_memory(unsigned long start, unsigned long size)
405{ 411{
406 /* 412 /*
407 * Ensure that start/size are aligned to a page boundary. 413 * Ensure that start/size are aligned to a page boundary.
@@ -439,7 +445,7 @@ static void __init early_mem(char **p)
439 if (**p == '@') 445 if (**p == '@')
440 start = memparse(*p + 1, p); 446 start = memparse(*p + 1, p);
441 447
442 add_memory(start, size); 448 arm_add_memory(start, size);
443} 449}
444__early_param("mem=", early_mem); 450__early_param("mem=", early_mem);
445 451
@@ -581,7 +587,7 @@ static int __init parse_tag_mem32(const struct tag *tag)
581 tag->u.mem.start, tag->u.mem.size / 1024); 587 tag->u.mem.start, tag->u.mem.size / 1024);
582 return -EINVAL; 588 return -EINVAL;
583 } 589 }
584 add_memory(tag->u.mem.start, tag->u.mem.size); 590 arm_add_memory(tag->u.mem.start, tag->u.mem.size);
585 return 0; 591 return 0;
586} 592}
587 593
@@ -801,7 +807,7 @@ static int __init topology_init(void)
801{ 807{
802 int cpu; 808 int cpu;
803 809
804 for_each_cpu(cpu) 810 for_each_possible_cpu(cpu)
805 register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL); 811 register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL);
806 812
807 return 0; 813 return 0;
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c
index 1781b8f342c4..bfe47bd6e50c 100644
--- a/arch/arm/mach-at91rm9200/devices.c
+++ b/arch/arm/mach-at91rm9200/devices.c
@@ -194,13 +194,23 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
194#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) 194#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
195static struct at91_cf_data cf_data; 195static struct at91_cf_data cf_data;
196 196
197static struct resource at91_cf_resources[] = {
198 [0] = {
199 .start = AT91_CF_BASE,
200 /* ties up CS4, CS5, and CS6 */
201 .end = AT91_CF_BASE + (0x30000000 - 1),
202 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
203 },
204};
205
197static struct platform_device at91rm9200_cf_device = { 206static struct platform_device at91rm9200_cf_device = {
198 .name = "at91_cf", 207 .name = "at91_cf",
199 .id = -1, 208 .id = -1,
200 .dev = { 209 .dev = {
201 .platform_data = &cf_data, 210 .platform_data = &cf_data,
202 }, 211 },
203 .num_resources = 0, 212 .resource = at91_cf_resources,
213 .num_resources = ARRAY_SIZE(at91_cf_resources),
204}; 214};
205 215
206void __init at91_add_device_cf(struct at91_cf_data *data) 216void __init at91_add_device_cf(struct at91_cf_data *data)
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index a0888e160e3b..00b761ff0f9c 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -91,7 +91,7 @@ static void ixp4xx_config_irq(unsigned irq, enum ixp4xx_irq_type type);
91/* 91/*
92 * IRQ -> GPIO mapping table 92 * IRQ -> GPIO mapping table
93 */ 93 */
94static char irq2gpio[32] = { 94static signed char irq2gpio[32] = {
95 -1, -1, -1, -1, -1, -1, 0, 1, 95 -1, -1, -1, -1, -1, -1, 0, 1,
96 -1, -1, -1, -1, -1, -1, -1, -1, 96 -1, -1, -1, -1, -1, -1, -1, -1,
97 -1, -1, -1, 2, 3, 4, 5, 6, 97 -1, -1, -1, 2, 3, 4, 5, 6,
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 876c38da14f7..847329cafc5c 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -25,10 +25,6 @@
25#include <asm/arch/mux.h> 25#include <asm/arch/mux.h>
26#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27 27
28extern void omap_nop_release(struct device *dev);
29
30/*-------------------------------------------------------------------------*/
31
32#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE) 28#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
33 29
34static u64 irda_dmamask = 0xffffffff; 30static u64 irda_dmamask = 0xffffffff;
@@ -37,7 +33,6 @@ static struct platform_device omap1610ir_device = {
37 .name = "omap1610-ir", 33 .name = "omap1610-ir",
38 .id = -1, 34 .id = -1,
39 .dev = { 35 .dev = {
40 .release = omap_nop_release,
41 .dma_mask = &irda_dmamask, 36 .dma_mask = &irda_dmamask,
42 }, 37 },
43}; 38};
@@ -84,9 +79,6 @@ static struct resource rtc_resources[] = {
84static struct platform_device omap_rtc_device = { 79static struct platform_device omap_rtc_device = {
85 .name = "omap_rtc", 80 .name = "omap_rtc",
86 .id = -1, 81 .id = -1,
87 .dev = {
88 .release = omap_nop_release,
89 },
90 .num_resources = ARRAY_SIZE(rtc_resources), 82 .num_resources = ARRAY_SIZE(rtc_resources),
91 .resource = rtc_resources, 83 .resource = rtc_resources,
92}; 84};
@@ -124,9 +116,6 @@ static struct resource sti_resources[] = {
124static struct platform_device sti_device = { 116static struct platform_device sti_device = {
125 .name = "sti", 117 .name = "sti",
126 .id = -1, 118 .id = -1,
127 .dev = {
128 .release = omap_nop_release,
129 },
130 .num_resources = ARRAY_SIZE(sti_resources), 119 .num_resources = ARRAY_SIZE(sti_resources),
131 .resource = sti_resources, 120 .resource = sti_resources,
132}; 121};
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index def9e5370edf..fb7f91da1aad 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -25,10 +25,6 @@
25#include <asm/arch/mux.h> 25#include <asm/arch/mux.h>
26#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27 27
28extern void omap_nop_release(struct device *dev);
29
30/*-------------------------------------------------------------------------*/
31
32#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 28#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
33 29
34#define OMAP2_I2C_BASE2 0x48072000 30#define OMAP2_I2C_BASE2 0x48072000
@@ -49,9 +45,6 @@ static struct resource i2c_resources2[] = {
49static struct platform_device omap_i2c_device2 = { 45static struct platform_device omap_i2c_device2 = {
50 .name = "i2c_omap", 46 .name = "i2c_omap",
51 .id = 2, 47 .id = 2,
52 .dev = {
53 .release = omap_nop_release,
54 },
55 .num_resources = ARRAY_SIZE(i2c_resources2), 48 .num_resources = ARRAY_SIZE(i2c_resources2),
56 .resource = i2c_resources2, 49 .resource = i2c_resources2,
57}; 50};
@@ -100,9 +93,6 @@ static struct resource sti_resources[] = {
100static struct platform_device sti_device = { 93static struct platform_device sti_device = {
101 .name = "sti", 94 .name = "sti",
102 .id = -1, 95 .id = -1,
103 .dev = {
104 .release = omap_nop_release,
105 },
106 .num_resources = ARRAY_SIZE(sti_resources), 96 .num_resources = ARRAY_SIZE(sti_resources),
107 .resource = sti_resources, 97 .resource = sti_resources,
108}; 98};
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index b371d723635f..8a25a1c8019f 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -196,12 +196,9 @@ static int __init corgi_ssp_probe(struct platform_device *dev)
196 int ret; 196 int ret;
197 197
198 /* Chip Select - Disable All */ 198 /* Chip Select - Disable All */
199 GPDR(ssp_machinfo->cs_lcdcon) |= GPIO_bit(ssp_machinfo->cs_lcdcon); /* output */ 199 pxa_gpio_mode(ssp_machinfo->cs_lcdcon | GPIO_OUT | GPIO_DFLT_HIGH);
200 GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ 200 pxa_gpio_mode(ssp_machinfo->cs_max1111 | GPIO_OUT | GPIO_DFLT_HIGH);
201 GPDR(ssp_machinfo->cs_max1111) |= GPIO_bit(ssp_machinfo->cs_max1111); /* output */ 201 pxa_gpio_mode(ssp_machinfo->cs_ads7846 | GPIO_OUT | GPIO_DFLT_HIGH);
202 GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
203 GPDR(ssp_machinfo->cs_ads7846) |= GPIO_bit(ssp_machinfo->cs_ads7846); /* output */
204 GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/
205 202
206 ret = ssp_init(&corgi_ssp_dev, ssp_machinfo->port, 0); 203 ret = ssp_init(&corgi_ssp_dev, ssp_machinfo->port, 0);
207 204
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index b7f85e6d6b76..6de713ad319a 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -367,6 +367,8 @@ static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
367 source = S3C2410_MISCCR_CLK0_UPLL; 367 source = S3C2410_MISCCR_CLK0_UPLL;
368 else if (parent == &clk_f) 368 else if (parent == &clk_f)
369 source = S3C2410_MISCCR_CLK0_FCLK; 369 source = S3C2410_MISCCR_CLK0_FCLK;
370 else if (parent == &clk_h)
371 source = S3C2410_MISCCR_CLK0_HCLK;
370 else if (parent == &clk_p) 372 else if (parent == &clk_p)
371 source = S3C2410_MISCCR_CLK0_PCLK; 373 source = S3C2410_MISCCR_CLK0_PCLK;
372 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0) 374 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
@@ -376,6 +378,8 @@ static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
376 else 378 else
377 return -EINVAL; 379 return -EINVAL;
378 380
381 clk->parent = parent;
382
379 if (clk == &s3c24xx_dclk0) 383 if (clk == &s3c24xx_dclk0)
380 mask = S3C2410_MISCCR_CLK0_MASK; 384 mask = S3C2410_MISCCR_CLK0_MASK;
381 else { 385 else {
diff --git a/arch/arm/mach-s3c2410/common-smdk.c b/arch/arm/mach-s3c2410/common-smdk.c
index 36b8291b5e03..c940890f621f 100644
--- a/arch/arm/mach-s3c2410/common-smdk.c
+++ b/arch/arm/mach-s3c2410/common-smdk.c
@@ -37,6 +37,7 @@
37 37
38#include <asm/arch/nand.h> 38#include <asm/arch/nand.h>
39 39
40#include "common-smdk.h"
40#include "devs.h" 41#include "devs.h"
41#include "pm.h" 42#include "pm.h"
42 43
@@ -49,7 +50,7 @@ static struct mtd_partition smdk_default_nand_part[] = {
49 .offset = 0, 50 .offset = 0,
50 }, 51 },
51 [1] = { 52 [1] = {
52 .name = "S3C2410 flash parition 1", 53 .name = "S3C2410 flash partition 1",
53 .offset = 0, 54 .offset = 0,
54 .size = SZ_2M, 55 .size = SZ_2M,
55 }, 56 },
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
index 57a15974d4b5..d7a30ed6c327 100644
--- a/arch/arm/mach-s3c2410/s3c2440-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -139,7 +139,7 @@ static int s3c2440_clk_add(struct sys_device *sysdev)
139 139
140 clkdivn = __raw_readl(S3C2410_CLKDIVN); 140 clkdivn = __raw_readl(S3C2410_CLKDIVN);
141 clkdivn |= S3C2440_CLKDIVN_UCLK; 141 clkdivn |= S3C2440_CLKDIVN_UCLK;
142 __raw_writel(camdivn, S3C2410_CLKDIVN); 142 __raw_writel(clkdivn, S3C2410_CLKDIVN);
143 143
144 mutex_unlock(&clocks_mutex); 144 mutex_unlock(&clocks_mutex);
145 } 145 }
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index 5c4055b62d97..54e3c5bb5186 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -10,7 +10,7 @@
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <asm/hardware.h> 13#include <asm/memory.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include "proc-macros.S" 15#include "proc-macros.S"
16 16
@@ -46,6 +46,11 @@
46 */ 46 */
47#define CACHE_DLIMIT (CACHE_DSIZE * 4) 47#define CACHE_DLIMIT (CACHE_DSIZE * 4)
48 48
49 .data
50flush_base:
51 .long FLUSH_BASE
52 .text
53
49/* 54/*
50 * flush_user_cache_all() 55 * flush_user_cache_all()
51 * 56 *
@@ -63,11 +68,21 @@ ENTRY(v4wb_flush_kern_cache_all)
63 mov ip, #0 68 mov ip, #0
64 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 69 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
65__flush_whole_cache: 70__flush_whole_cache:
66 mov r0, #FLUSH_BASE 71 ldr r3, =flush_base
67 add r1, r0, #CACHE_DSIZE 72 ldr r1, [r3, #0]
681: ldr r2, [r0], #32 73 eor r1, r1, #CACHE_DSIZE
69 cmp r0, r1 74 str r1, [r3, #0]
75 add r2, r1, #CACHE_DSIZE
761: ldr r3, [r1], #32
77 cmp r1, r2
78 blo 1b
79#ifdef FLUSH_BASE_MINICACHE
80 add r2, r2, #FLUSH_BASE_MINICACHE - FLUSH_BASE
81 sub r1, r2, #512 @ only 512 bytes
821: ldr r3, [r1], #32
83 cmp r1, r2
70 blo 1b 84 blo 1b
85#endif
71 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer 86 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer
72 mov pc, lr 87 mov pc, lr
73 88
@@ -82,6 +97,7 @@ __flush_whole_cache:
82 * - flags - vma_area_struct flags describing address space 97 * - flags - vma_area_struct flags describing address space
83 */ 98 */
84ENTRY(v4wb_flush_user_cache_range) 99ENTRY(v4wb_flush_user_cache_range)
100 mov ip, #0
85 sub r3, r1, r0 @ calculate total size 101 sub r3, r1, r0 @ calculate total size
86 tst r2, #VM_EXEC @ executable region? 102 tst r2, #VM_EXEC @ executable region?
87 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 103 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 88279124317a..9ea1f87a7079 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/setup.h> 22#include <asm/setup.h>
23#include <asm/sizes.h>
23#include <asm/tlb.h> 24#include <asm/tlb.h>
24 25
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
@@ -455,14 +456,14 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
455#ifdef FLUSH_BASE 456#ifdef FLUSH_BASE
456 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS); 457 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS);
457 map.virtual = FLUSH_BASE; 458 map.virtual = FLUSH_BASE;
458 map.length = PGDIR_SIZE; 459 map.length = SZ_1M;
459 map.type = MT_CACHECLEAN; 460 map.type = MT_CACHECLEAN;
460 create_mapping(&map); 461 create_mapping(&map);
461#endif 462#endif
462#ifdef FLUSH_BASE_MINICACHE 463#ifdef FLUSH_BASE_MINICACHE
463 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + PGDIR_SIZE); 464 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + SZ_1M);
464 map.virtual = FLUSH_BASE_MINICACHE; 465 map.virtual = FLUSH_BASE_MINICACHE;
465 map.length = PGDIR_SIZE; 466 map.length = SZ_1M;
466 map.type = MT_MINICLEAN; 467 map.type = MT_MINICLEAN;
467 create_mapping(&map); 468 create_mapping(&map);
468#endif 469#endif
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index c916a6cae404..a2dd5ae1077d 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -26,22 +26,7 @@
26 * the cache line size of the I and D cache 26 * the cache line size of the I and D cache
27 */ 27 */
28#define DCACHELINESIZE 32 28#define DCACHELINESIZE 32
29#define FLUSH_OFFSET 32768
30 29
31 .macro flush_110_dcache rd, ra, re
32 ldr \rd, =flush_base
33 ldr \ra, [\rd]
34 eor \ra, \ra, #FLUSH_OFFSET
35 str \ra, [\rd]
36 add \re, \ra, #16384 @ only necessary for 16k
371001: ldr \rd, [\ra], #DCACHELINESIZE
38 teq \re, \ra
39 bne 1001b
40 .endm
41
42 .data
43flush_base:
44 .long FLUSH_BASE
45 .text 30 .text
46 31
47/* 32/*
@@ -145,13 +130,11 @@ ENTRY(cpu_sa110_dcache_clean_area)
145 */ 130 */
146 .align 5 131 .align 5
147ENTRY(cpu_sa110_switch_mm) 132ENTRY(cpu_sa110_switch_mm)
148 flush_110_dcache r3, ip, r1 133 str lr, [sp, #-4]!
149 mov r1, #0 134 bl v4wb_flush_kern_cache_all @ clears IP
150 mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache
151 mcr p15, 0, r1, c7, c10, 4 @ drain WB
152 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 135 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
153 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 136 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
154 mov pc, lr 137 ldr pc, [sp], #4
155 138
156/* 139/*
157 * cpu_sa110_set_pte(ptep, pte) 140 * cpu_sa110_set_pte(ptep, pte)
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 41f21f2dd8ff..777ad99c1439 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -30,30 +30,6 @@
30 * the cache line size of the I and D cache 30 * the cache line size of the I and D cache
31 */ 31 */
32#define DCACHELINESIZE 32 32#define DCACHELINESIZE 32
33#define FLUSH_OFFSET 32768
34
35 .macro flush_1100_dcache rd, ra, re
36 ldr \rd, =flush_base
37 ldr \ra, [\rd]
38 eor \ra, \ra, #FLUSH_OFFSET
39 str \ra, [\rd]
40 add \re, \ra, #8192 @ only necessary for 8k
411001: ldr \rd, [\ra], #DCACHELINESIZE
42 teq \re, \ra
43 bne 1001b
44#ifdef FLUSH_BASE_MINICACHE
45 add \ra, \ra, #FLUSH_BASE_MINICACHE - FLUSH_BASE
46 add \re, \ra, #512 @ only 512 bytes
471002: ldr \rd, [\ra], #DCACHELINESIZE
48 teq \re, \ra
49 bne 1002b
50#endif
51 .endm
52
53 .data
54flush_base:
55 .long FLUSH_BASE
56 .text
57 33
58 __INIT 34 __INIT
59 35
@@ -79,9 +55,8 @@ ENTRY(cpu_sa1100_proc_fin)
79 stmfd sp!, {lr} 55 stmfd sp!, {lr}
80 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE 56 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
81 msr cpsr_c, ip 57 msr cpsr_c, ip
82 flush_1100_dcache r0, r1, r2 @ clean caches 58 bl v4wb_flush_kern_cache_all
83 mov r0, #0 59 mcr p15, 0, ip, c15, c2, 2 @ Disable clock switching
84 mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching
85 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 60 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
86 bic r0, r0, #0x1000 @ ...i............ 61 bic r0, r0, #0x1000 @ ...i............
87 bic r0, r0, #0x000e @ ............wca. 62 bic r0, r0, #0x000e @ ............wca.
@@ -167,14 +142,12 @@ ENTRY(cpu_sa1100_dcache_clean_area)
167 */ 142 */
168 .align 5 143 .align 5
169ENTRY(cpu_sa1100_switch_mm) 144ENTRY(cpu_sa1100_switch_mm)
170 flush_1100_dcache r3, ip, r1 145 str lr, [sp, #-4]!
171 mov ip, #0 146 bl v4wb_flush_kern_cache_all @ clears IP
172 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
173 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB 147 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
174 mcr p15, 0, ip, c7, c10, 4 @ drain WB
175 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 148 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
176 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 149 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
177 mov pc, lr 150 ldr pc, [sp], #4
178 151
179/* 152/*
180 * cpu_sa1100_set_pte(ptep, pte) 153 * cpu_sa1100_set_pte(ptep, pte)
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 06485c193ee3..32ec04c58bcd 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -58,7 +58,7 @@ struct clk * clk_get(struct device *dev, const char *id)
58 if (p->id == idno && 58 if (p->id == idno &&
59 strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 59 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
60 clk = p; 60 clk = p;
61 break; 61 goto found;
62 } 62 }
63 } 63 }
64 64
@@ -69,6 +69,7 @@ struct clk * clk_get(struct device *dev, const char *id)
69 } 69 }
70 } 70 }
71 71
72found:
72 mutex_unlock(&clocks_mutex); 73 mutex_unlock(&clocks_mutex);
73 74
74 return clk; 75 return clk;
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 079b67deac0f..5d5d6eb222dd 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -26,14 +26,6 @@
26#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27#include <asm/arch/menelaus.h> 27#include <asm/arch/menelaus.h>
28 28
29
30void omap_nop_release(struct device *dev)
31{
32 /* Nothing */
33}
34
35/*-------------------------------------------------------------------------*/
36
37#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 29#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
38 30
39#define OMAP1_I2C_BASE 0xfffb3800 31#define OMAP1_I2C_BASE 0xfffb3800
@@ -59,9 +51,6 @@ static struct resource i2c_resources1[] = {
59static struct platform_device omap_i2c_device1 = { 51static struct platform_device omap_i2c_device1 = {
60 .name = "i2c_omap", 52 .name = "i2c_omap",
61 .id = 1, 53 .id = 1,
62 .dev = {
63 .release = omap_nop_release,
64 },
65 .num_resources = ARRAY_SIZE(i2c_resources1), 54 .num_resources = ARRAY_SIZE(i2c_resources1),
66 .resource = i2c_resources1, 55 .resource = i2c_resources1,
67}; 56};
@@ -187,7 +176,6 @@ static struct platform_device mmc_omap_device1 = {
187 .name = "mmci-omap", 176 .name = "mmci-omap",
188 .id = 1, 177 .id = 1,
189 .dev = { 178 .dev = {
190 .release = omap_nop_release,
191 .dma_mask = &mmc1_dmamask, 179 .dma_mask = &mmc1_dmamask,
192 .platform_data = &mmc1_conf, 180 .platform_data = &mmc1_conf,
193 }, 181 },
@@ -217,7 +205,6 @@ static struct platform_device mmc_omap_device2 = {
217 .name = "mmci-omap", 205 .name = "mmci-omap",
218 .id = 2, 206 .id = 2,
219 .dev = { 207 .dev = {
220 .release = omap_nop_release,
221 .dma_mask = &mmc2_dmamask, 208 .dma_mask = &mmc2_dmamask,
222 .platform_data = &mmc2_conf, 209 .platform_data = &mmc2_conf,
223 }, 210 },
@@ -321,9 +308,6 @@ static struct resource uwire_resources[] = {
321static struct platform_device omap_uwire_device = { 308static struct platform_device omap_uwire_device = {
322 .name = "omap_uwire", 309 .name = "omap_uwire",
323 .id = -1, 310 .id = -1,
324 .dev = {
325 .release = omap_nop_release,
326 },
327 .num_resources = ARRAY_SIZE(uwire_resources), 311 .num_resources = ARRAY_SIZE(uwire_resources),
328 .resource = uwire_resources, 312 .resource = uwire_resources,
329}; 313};
@@ -365,9 +349,6 @@ static struct resource wdt_resources[] = {
365static struct platform_device omap_wdt_device = { 349static struct platform_device omap_wdt_device = {
366 .name = "omap_wdt", 350 .name = "omap_wdt",
367 .id = -1, 351 .id = -1,
368 .dev = {
369 .release = omap_nop_release,
370 },
371 .num_resources = ARRAY_SIZE(wdt_resources), 352 .num_resources = ARRAY_SIZE(wdt_resources),
372 .resource = wdt_resources, 353 .resource = wdt_resources,
373}; 354};
@@ -401,9 +382,6 @@ static struct resource rng_resources[] = {
401static struct platform_device omap_rng_device = { 382static struct platform_device omap_rng_device = {
402 .name = "omap_rng", 383 .name = "omap_rng",
403 .id = -1, 384 .id = -1,
404 .dev = {
405 .release = omap_nop_release,
406 },
407 .num_resources = ARRAY_SIZE(rng_resources), 385 .num_resources = ARRAY_SIZE(rng_resources),
408 .resource = rng_resources, 386 .resource = rng_resources,
409}; 387};
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 9b367a65cb4d..febd115dba28 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -588,6 +588,7 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
588 struct vfp_double vdm; 588 struct vfp_double vdm;
589 u32 d, exceptions = 0; 589 u32 d, exceptions = 0;
590 int rmode = fpscr & FPSCR_RMODE_MASK; 590 int rmode = fpscr & FPSCR_RMODE_MASK;
591 int tm;
591 592
592 vfp_double_unpack(&vdm, vfp_get_double(dm)); 593 vfp_double_unpack(&vdm, vfp_get_double(dm));
593 vfp_double_dump("VDM", &vdm); 594 vfp_double_dump("VDM", &vdm);
@@ -595,10 +596,14 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
595 /* 596 /*
596 * Do we have denormalised number? 597 * Do we have denormalised number?
597 */ 598 */
598 if (vfp_double_type(&vdm) & VFP_DENORMAL) 599 tm = vfp_double_type(&vdm);
600 if (tm & VFP_DENORMAL)
599 exceptions |= FPSCR_IDC; 601 exceptions |= FPSCR_IDC;
600 602
601 if (vdm.exponent >= 1023 + 32) { 603 if (tm & VFP_NAN) {
604 d = 0;
605 exceptions |= FPSCR_IOC;
606 } else if (vdm.exponent >= 1023 + 32) {
602 d = 0x7fffffff; 607 d = 0x7fffffff;
603 if (vdm.sign) 608 if (vdm.sign)
604 d = ~d; 609 d = ~d;
@@ -1122,9 +1127,9 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1122{ 1127{
1123 u32 op = inst & FOP_MASK; 1128 u32 op = inst & FOP_MASK;
1124 u32 exceptions = 0; 1129 u32 exceptions = 0;
1125 unsigned int dd = vfp_get_sd(inst); 1130 unsigned int dd = vfp_get_dd(inst);
1126 unsigned int dn = vfp_get_sn(inst); 1131 unsigned int dn = vfp_get_dn(inst);
1127 unsigned int dm = vfp_get_sm(inst); 1132 unsigned int dm = vfp_get_dm(inst);
1128 unsigned int vecitr, veclen, vecstride; 1133 unsigned int vecitr, veclen, vecstride;
1129 u32 (*fop)(int, int, s32, u32); 1134 u32 (*fop)(int, int, s32, u32);
1130 1135
@@ -1141,7 +1146,7 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1141 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride, 1146 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride,
1142 (veclen >> FPSCR_LENGTH_BIT) + 1); 1147 (veclen >> FPSCR_LENGTH_BIT) + 1);
1143 1148
1144 fop = (op == FOP_EXT) ? fop_extfns[dn] : fop_fns[FOP_TO_IDX(op)]; 1149 fop = (op == FOP_EXT) ? fop_extfns[FEXT_TO_IDX(inst)] : fop_fns[FOP_TO_IDX(op)];
1145 if (!fop) 1150 if (!fop)
1146 goto invalid; 1151 goto invalid;
1147 1152
@@ -1149,17 +1154,13 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1149 u32 except; 1154 u32 except;
1150 1155
1151 if (op == FOP_EXT) 1156 if (op == FOP_EXT)
1152 pr_debug("VFP: itr%d (d%u.%u) = op[%u] (d%u.%u)\n", 1157 pr_debug("VFP: itr%d (d%u) = op[%u] (d%u)\n",
1153 vecitr >> FPSCR_LENGTH_BIT, 1158 vecitr >> FPSCR_LENGTH_BIT,
1154 dd >> 1, dd & 1, dn, 1159 dd, dn, dm);
1155 dm >> 1, dm & 1);
1156 else 1160 else
1157 pr_debug("VFP: itr%d (d%u.%u) = (d%u.%u) op[%u] (d%u.%u)\n", 1161 pr_debug("VFP: itr%d (d%u) = (d%u) op[%u] (d%u)\n",
1158 vecitr >> FPSCR_LENGTH_BIT, 1162 vecitr >> FPSCR_LENGTH_BIT,
1159 dd >> 1, dd & 1, 1163 dd, dn, FOP_TO_IDX(op), dm);
1160 dn >> 1, dn & 1,
1161 FOP_TO_IDX(op),
1162 dm >> 1, dm & 1);
1163 1164
1164 except = fop(dd, dn, dm, fpscr); 1165 except = fop(dd, dn, dm, fpscr);
1165 pr_debug("VFP: itr%d: exceptions=%08x\n", 1166 pr_debug("VFP: itr%d: exceptions=%08x\n",
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index b7ed57e00cd4..a3f65b47aea9 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -189,11 +189,10 @@ vfp_put_float:
189 189
190 .globl vfp_get_double 190 .globl vfp_get_double
191vfp_get_double: 191vfp_get_double:
192 mov r0, r0, lsr #1
193 add pc, pc, r0, lsl #3 192 add pc, pc, r0, lsl #3
194 mov r0, r0 193 mov r0, r0
195 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 194 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
196 mrrc p10, 1, r0, r1, c\dr @ fmrrd r0, r1, d\dr 195 mrrc p11, 1, r0, r1, c\dr @ fmrrd r0, r1, d\dr
197 mov pc, lr 196 mov pc, lr
198 .endr 197 .endr
199 198
@@ -204,10 +203,9 @@ vfp_get_double:
204 203
205 .globl vfp_put_double 204 .globl vfp_put_double
206vfp_put_double: 205vfp_put_double:
207 mov r0, r0, lsr #1
208 add pc, pc, r0, lsl #3 206 add pc, pc, r0, lsl #3
209 mov r0, r0 207 mov r0, r0
210 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 208 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
211 mcrr p10, 1, r1, r2, c\dr @ fmrrd r1, r2, d\dr 209 mcrr p11, 1, r1, r2, c\dr @ fmdrr r1, r2, d\dr
212 mov pc, lr 210 mov pc, lr
213 .endr 211 .endr
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c
index 14dd696ddeb1..4ac27f193934 100644
--- a/arch/arm/vfp/vfpsingle.c
+++ b/arch/arm/vfp/vfpsingle.c
@@ -632,6 +632,7 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr)
632 struct vfp_single vsm; 632 struct vfp_single vsm;
633 u32 d, exceptions = 0; 633 u32 d, exceptions = 0;
634 int rmode = fpscr & FPSCR_RMODE_MASK; 634 int rmode = fpscr & FPSCR_RMODE_MASK;
635 int tm;
635 636
636 vfp_single_unpack(&vsm, m); 637 vfp_single_unpack(&vsm, m);
637 vfp_single_dump("VSM", &vsm); 638 vfp_single_dump("VSM", &vsm);
@@ -639,10 +640,14 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr)
639 /* 640 /*
640 * Do we have a denormalised number? 641 * Do we have a denormalised number?
641 */ 642 */
643 tm = vfp_single_type(&vsm);
642 if (vfp_single_type(&vsm) & VFP_DENORMAL) 644 if (vfp_single_type(&vsm) & VFP_DENORMAL)
643 exceptions |= FPSCR_IDC; 645 exceptions |= FPSCR_IDC;
644 646
645 if (vsm.exponent >= 127 + 32) { 647 if (tm & VFP_NAN) {
648 d = 0;
649 exceptions |= FPSCR_IOC;
650 } else if (vsm.exponent >= 127 + 32) {
646 /* 651 /*
647 * m >= 2^31-2^7: invalid 652 * m >= 2^31-2^7: invalid
648 */ 653 */
@@ -1188,7 +1193,7 @@ u32 vfp_single_cpdo(u32 inst, u32 fpscr)
1188 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride, 1193 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride,
1189 (veclen >> FPSCR_LENGTH_BIT) + 1); 1194 (veclen >> FPSCR_LENGTH_BIT) + 1);
1190 1195
1191 fop = (op == FOP_EXT) ? fop_extfns[sn] : fop_fns[FOP_TO_IDX(op)]; 1196 fop = (op == FOP_EXT) ? fop_extfns[FEXT_TO_IDX(inst)] : fop_fns[FOP_TO_IDX(op)];
1192 if (!fop) 1197 if (!fop)
1193 goto invalid; 1198 goto invalid;
1194 1199
diff --git a/arch/arm26/kernel/armksyms.c b/arch/arm26/kernel/armksyms.c
index a6a1b3373444..9d66c27f2724 100644
--- a/arch/arm26/kernel/armksyms.c
+++ b/arch/arm26/kernel/armksyms.c
@@ -152,7 +152,6 @@ EXPORT_SYMBOL(strncmp);
152EXPORT_SYMBOL(strchr); 152EXPORT_SYMBOL(strchr);
153EXPORT_SYMBOL(strlen); 153EXPORT_SYMBOL(strlen);
154EXPORT_SYMBOL(strnlen); 154EXPORT_SYMBOL(strnlen);
155EXPORT_SYMBOL(strpbrk);
156EXPORT_SYMBOL(strrchr); 155EXPORT_SYMBOL(strrchr);
157EXPORT_SYMBOL(strstr); 156EXPORT_SYMBOL(strstr);
158EXPORT_SYMBOL(memset); 157EXPORT_SYMBOL(memset);
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index de39725da920..d57859053ce7 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -39,7 +39,6 @@ EXPORT_SYMBOL(loops_per_usec);
39/* String functions */ 39/* String functions */
40EXPORT_SYMBOL(memcmp); 40EXPORT_SYMBOL(memcmp);
41EXPORT_SYMBOL(memmove); 41EXPORT_SYMBOL(memmove);
42EXPORT_SYMBOL(strpbrk);
43EXPORT_SYMBOL(strstr); 42EXPORT_SYMBOL(strstr);
44EXPORT_SYMBOL(strcpy); 43EXPORT_SYMBOL(strcpy);
45EXPORT_SYMBOL(strchr); 44EXPORT_SYMBOL(strchr);
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 1d21c8d34d8a..a9b59527a741 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1170,12 +1170,6 @@ __syscall_badsys:
1170# syscall vector table 1170# syscall vector table
1171# 1171#
1172############################################################################### 1172###############################################################################
1173#ifdef CONFIG_MMU
1174#define __MMU(X) X
1175#else
1176#define __MMU(X) sys_ni_syscall
1177#endif
1178
1179 .section .rodata 1173 .section .rodata
1180ALIGN 1174ALIGN
1181 .globl sys_call_table 1175 .globl sys_call_table
@@ -1305,7 +1299,7 @@ sys_call_table:
1305 .long sys_newuname 1299 .long sys_newuname
1306 .long sys_ni_syscall /* old "cacheflush" */ 1300 .long sys_ni_syscall /* old "cacheflush" */
1307 .long sys_adjtimex 1301 .long sys_adjtimex
1308 .long __MMU(sys_mprotect) /* 125 */ 1302 .long sys_mprotect /* 125 */
1309 .long sys_sigprocmask 1303 .long sys_sigprocmask
1310 .long sys_ni_syscall /* old "create_module" */ 1304 .long sys_ni_syscall /* old "create_module" */
1311 .long sys_init_module 1305 .long sys_init_module
@@ -1324,16 +1318,16 @@ sys_call_table:
1324 .long sys_getdents 1318 .long sys_getdents
1325 .long sys_select 1319 .long sys_select
1326 .long sys_flock 1320 .long sys_flock
1327 .long __MMU(sys_msync) 1321 .long sys_msync
1328 .long sys_readv /* 145 */ 1322 .long sys_readv /* 145 */
1329 .long sys_writev 1323 .long sys_writev
1330 .long sys_getsid 1324 .long sys_getsid
1331 .long sys_fdatasync 1325 .long sys_fdatasync
1332 .long sys_sysctl 1326 .long sys_sysctl
1333 .long __MMU(sys_mlock) /* 150 */ 1327 .long sys_mlock /* 150 */
1334 .long __MMU(sys_munlock) 1328 .long sys_munlock
1335 .long __MMU(sys_mlockall) 1329 .long sys_mlockall
1336 .long __MMU(sys_munlockall) 1330 .long sys_munlockall
1337 .long sys_sched_setparam 1331 .long sys_sched_setparam
1338 .long sys_sched_getparam /* 155 */ 1332 .long sys_sched_getparam /* 155 */
1339 .long sys_sched_setscheduler 1333 .long sys_sched_setscheduler
@@ -1343,7 +1337,7 @@ sys_call_table:
1343 .long sys_sched_get_priority_min /* 160 */ 1337 .long sys_sched_get_priority_min /* 160 */
1344 .long sys_sched_rr_get_interval 1338 .long sys_sched_rr_get_interval
1345 .long sys_nanosleep 1339 .long sys_nanosleep
1346 .long __MMU(sys_mremap) 1340 .long sys_mremap
1347 .long sys_setresuid16 1341 .long sys_setresuid16
1348 .long sys_getresuid16 /* 165 */ 1342 .long sys_getresuid16 /* 165 */
1349 .long sys_ni_syscall /* for vm86 */ 1343 .long sys_ni_syscall /* for vm86 */
@@ -1398,8 +1392,8 @@ sys_call_table:
1398 .long sys_setfsuid /* 215 */ 1392 .long sys_setfsuid /* 215 */
1399 .long sys_setfsgid 1393 .long sys_setfsgid
1400 .long sys_pivot_root 1394 .long sys_pivot_root
1401 .long __MMU(sys_mincore) 1395 .long sys_mincore
1402 .long __MMU(sys_madvise) 1396 .long sys_madvise
1403 .long sys_getdents64 /* 220 */ 1397 .long sys_getdents64 /* 220 */
1404 .long sys_fcntl64 1398 .long sys_fcntl64
1405 .long sys_ni_syscall /* reserved for TUX */ 1399 .long sys_ni_syscall /* reserved for TUX */
@@ -1437,7 +1431,7 @@ sys_call_table:
1437 .long sys_epoll_create 1431 .long sys_epoll_create
1438 .long sys_epoll_ctl /* 255 */ 1432 .long sys_epoll_ctl /* 255 */
1439 .long sys_epoll_wait 1433 .long sys_epoll_wait
1440 .long __MMU(sys_remap_file_pages) 1434 .long sys_remap_file_pages
1441 .long sys_set_tid_address 1435 .long sys_set_tid_address
1442 .long sys_timer_create 1436 .long sys_timer_create
1443 .long sys_timer_settime /* 260 */ 1437 .long sys_timer_settime /* 260 */
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c
index 07c8ffa0dd39..0f273a7aca5a 100644
--- a/arch/frv/kernel/frv_ksyms.c
+++ b/arch/frv/kernel/frv_ksyms.c
@@ -27,7 +27,6 @@ EXPORT_SYMBOL(__ioremap);
27EXPORT_SYMBOL(iounmap); 27EXPORT_SYMBOL(iounmap);
28 28
29EXPORT_SYMBOL(strnlen); 29EXPORT_SYMBOL(strnlen);
30EXPORT_SYMBOL(strpbrk);
31EXPORT_SYMBOL(strrchr); 30EXPORT_SYMBOL(strrchr);
32EXPORT_SYMBOL(strstr); 31EXPORT_SYMBOL(strstr);
33EXPORT_SYMBOL(strchr); 32EXPORT_SYMBOL(strchr);
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
index b6cd78c972bb..f8d6dee84781 100644
--- a/arch/h8300/kernel/h8300_ksyms.c
+++ b/arch/h8300/kernel/h8300_ksyms.c
@@ -25,7 +25,6 @@ extern char h8300_debug_device[];
25/* platform dependent support */ 25/* platform dependent support */
26 26
27EXPORT_SYMBOL(strnlen); 27EXPORT_SYMBOL(strnlen);
28EXPORT_SYMBOL(strpbrk);
29EXPORT_SYMBOL(strrchr); 28EXPORT_SYMBOL(strrchr);
30EXPORT_SYMBOL(strstr); 29EXPORT_SYMBOL(strstr);
31EXPORT_SYMBOL(strchr); 30EXPORT_SYMBOL(strchr);
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f17bd1d2707e..18ec9fe6deb6 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -53,6 +53,35 @@ source "init/Kconfig"
53 53
54menu "Processor type and features" 54menu "Processor type and features"
55 55
56config SMP
57 bool "Symmetric multi-processing support"
58 ---help---
59 This enables support for systems with more than one CPU. If you have
60 a system with only one CPU, like most personal computers, say N. If
61 you have a system with more than one CPU, say Y.
62
63 If you say N here, the kernel will run on single and multiprocessor
64 machines, but will use only one CPU of a multiprocessor machine. If
65 you say Y here, the kernel will run on many, but not all,
66 singleprocessor machines. On a singleprocessor machine, the kernel
67 will run faster if you say N here.
68
69 Note that if you say Y here and choose architecture "586" or
70 "Pentium" under "Processor family", the kernel will not work on 486
71 architectures. Similarly, multiprocessor kernels for the "PPro"
72 architecture may not work on all Pentium based boards.
73
74 People using multiprocessor machines who say Y here should also say
75 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
76 Management" code will be disabled if you say Y here.
77
78 See also the <file:Documentation/smp.txt>,
79 <file:Documentation/i386/IO-APIC.txt>,
80 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
81 <http://www.tldp.org/docs.html#howto>.
82
83 If you don't know what to do here, say N.
84
56choice 85choice
57 prompt "Subarchitecture Type" 86 prompt "Subarchitecture Type"
58 default X86_PC 87 default X86_PC
@@ -178,35 +207,6 @@ config HPET_EMULATE_RTC
178 depends on HPET_TIMER && RTC=y 207 depends on HPET_TIMER && RTC=y
179 default y 208 default y
180 209
181config SMP
182 bool "Symmetric multi-processing support"
183 ---help---
184 This enables support for systems with more than one CPU. If you have
185 a system with only one CPU, like most personal computers, say N. If
186 you have a system with more than one CPU, say Y.
187
188 If you say N here, the kernel will run on single and multiprocessor
189 machines, but will use only one CPU of a multiprocessor machine. If
190 you say Y here, the kernel will run on many, but not all,
191 singleprocessor machines. On a singleprocessor machine, the kernel
192 will run faster if you say N here.
193
194 Note that if you say Y here and choose architecture "586" or
195 "Pentium" under "Processor family", the kernel will not work on 486
196 architectures. Similarly, multiprocessor kernels for the "PPro"
197 architecture may not work on all Pentium based boards.
198
199 People using multiprocessor machines who say Y here should also say
200 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
201 Management" code will be disabled if you say Y here.
202
203 See also the <file:Documentation/smp.txt>,
204 <file:Documentation/i386/IO-APIC.txt>,
205 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
206 <http://www.tldp.org/docs.html#howto>.
207
208 If you don't know what to do here, say N.
209
210config NR_CPUS 210config NR_CPUS
211 int "Maximum number of CPUs (2-255)" 211 int "Maximum number of CPUs (2-255)"
212 range 2 255 212 range 2 255
@@ -522,6 +522,12 @@ config NUMA
522comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 522comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
523 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) 523 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI)
524 524
525config NODES_SHIFT
526 int
527 default "4" if X86_NUMAQ
528 default "3"
529 depends on NEED_MULTIPLE_NODES
530
525config HAVE_ARCH_BOOTMEM_NODE 531config HAVE_ARCH_BOOTMEM_NODE
526 bool 532 bool
527 depends on NUMA 533 depends on NUMA
@@ -757,15 +763,6 @@ config HOTPLUG_CPU
757 763
758 Say N. 764 Say N.
759 765
760config DOUBLEFAULT
761 default y
762 bool "Enable doublefault exception handler" if EMBEDDED
763 help
764 This option allows trapping of rare doublefault exceptions that
765 would otherwise cause a system to silently reboot. Disabling this
766 option saves about 4k and might cause you much additional grey
767 hair.
768
769endmenu 766endmenu
770 767
771 768
diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
index 79603b3471f9..eb130482ba18 100644
--- a/arch/i386/Kconfig.cpu
+++ b/arch/i386/Kconfig.cpu
@@ -311,5 +311,5 @@ config X86_OOSTORE
311 311
312config X86_TSC 312config X86_TSC
313 bool 313 bool
314 depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1) && !X86_NUMAQ 314 depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1 || MGEODE_LX) && !X86_NUMAQ
315 default y 315 default y
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index 6e97df6979e8..c92191b1fb67 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -81,4 +81,13 @@ config X86_MPPARSE
81 depends on X86_LOCAL_APIC && !X86_VISWS 81 depends on X86_LOCAL_APIC && !X86_VISWS
82 default y 82 default y
83 83
84config DOUBLEFAULT
85 default y
86 bool "Enable doublefault exception handler" if EMBEDDED
87 help
88 This option allows trapping of rare doublefault exceptions that
89 would otherwise cause a system to silently reboot. Disabling this
90 option saves about 4k and might cause you much additional grey
91 hair.
92
84endmenu 93endmenu
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 0000a2674537..c9343c3a8082 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -97,6 +97,7 @@
97#define PARAM_VESAPM_OFF 0x30 97#define PARAM_VESAPM_OFF 0x30
98#define PARAM_LFB_PAGES 0x32 98#define PARAM_LFB_PAGES 0x32
99#define PARAM_VESA_ATTRIB 0x34 99#define PARAM_VESA_ATTRIB 0x34
100#define PARAM_CAPABILITIES 0x36
100 101
101/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ 102/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
102#ifdef CONFIG_VIDEO_RETAIN 103#ifdef CONFIG_VIDEO_RETAIN
@@ -233,6 +234,10 @@ mopar_gr:
233 movw 18(%di), %ax 234 movw 18(%di), %ax
234 movl %eax, %fs:(PARAM_LFB_SIZE) 235 movl %eax, %fs:(PARAM_LFB_SIZE)
235 236
237# store mode capabilities
238 movl 10(%di), %eax
239 movl %eax, %fs:(PARAM_CAPABILITIES)
240
236# switching the DAC to 8-bit is for <= 8 bpp only 241# switching the DAC to 8-bit is for <= 8 bpp only
237 movw %fs:(PARAM_LFB_DEPTH), %ax 242 movw %fs:(PARAM_LFB_DEPTH), %ax
238 cmpw $8, %ax 243 cmpw $8, %ax
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 5b9ed21216cf..96fb8a020af2 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o init_task.o vmlinux.lds
6 6
7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ 7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ 9 pci-dma.o i386_ksyms.o i387.o bootflag.o \
10 quirks.o i8237.o topology.o alternative.o 10 quirks.o i8237.o topology.o alternative.o
11 11
12obj-y += cpu/ 12obj-y += cpu/
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 033066176b3e..049a25583793 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -215,7 +215,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
215{ 215{
216 struct acpi_table_madt *madt = NULL; 216 struct acpi_table_madt *madt = NULL;
217 217
218 if (!phys_addr || !size) 218 if (!phys_addr || !size || !cpu_has_apic)
219 return -EINVAL; 219 return -EINVAL;
220 220
221 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); 221 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
@@ -693,6 +693,9 @@ static int __init acpi_parse_madt_lapic_entries(void)
693{ 693{
694 int count; 694 int count;
695 695
696 if (!cpu_has_apic)
697 return -ENODEV;
698
696 /* 699 /*
697 * Note that the LAPIC address is obtained from the MADT (32-bit value) 700 * Note that the LAPIC address is obtained from the MADT (32-bit value)
698 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 701 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
@@ -751,6 +754,9 @@ static int __init acpi_parse_madt_ioapic_entries(void)
751 return -ENODEV; 754 return -ENODEV;
752 } 755 }
753 756
757 if (!cpu_has_apic)
758 return -ENODEV;
759
754 /* 760 /*
755 * if "noapic" boot option, don't look for IO-APICs 761 * if "noapic" boot option, don't look for IO-APICs
756 */ 762 */
@@ -1096,6 +1102,9 @@ int __init acpi_boot_table_init(void)
1096 dmi_check_system(acpi_dmi_table); 1102 dmi_check_system(acpi_dmi_table);
1097#endif 1103#endif
1098 1104
1105 if (!cpu_has_apic)
1106 return -ENODEV;
1107
1099 /* 1108 /*
1100 * If acpi_disabled, bail out 1109 * If acpi_disabled, bail out
1101 * One exception: acpi=ht continues far enough to enumerate LAPICs 1110 * One exception: acpi=ht continues far enough to enumerate LAPICs
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 6273bf74c203..254cee9f0b7b 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -62,6 +62,18 @@ int apic_verbosity;
62 62
63static void apic_pm_activate(void); 63static void apic_pm_activate(void);
64 64
65int modern_apic(void)
66{
67 unsigned int lvr, version;
68 /* AMD systems use old APIC versions, so check the CPU */
69 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
70 boot_cpu_data.x86 >= 0xf)
71 return 1;
72 lvr = apic_read(APIC_LVR);
73 version = GET_APIC_VERSION(lvr);
74 return version >= 0x14;
75}
76
65/* 77/*
66 * 'what should we do if we get a hw irq event on an illegal vector'. 78 * 'what should we do if we get a hw irq event on an illegal vector'.
67 * each architecture has to answer this themselves. 79 * each architecture has to answer this themselves.
@@ -119,10 +131,7 @@ void enable_NMI_through_LVT0 (void * dummy)
119 131
120int get_physical_broadcast(void) 132int get_physical_broadcast(void)
121{ 133{
122 unsigned int lvr, version; 134 if (modern_apic())
123 lvr = apic_read(APIC_LVR);
124 version = GET_APIC_VERSION(lvr);
125 if (!APIC_INTEGRATED(version) || version >= 0x14)
126 return 0xff; 135 return 0xff;
127 else 136 else
128 return 0xf; 137 return 0xf;
@@ -349,9 +358,9 @@ int __init verify_local_APIC(void)
349 358
350void __init sync_Arb_IDs(void) 359void __init sync_Arb_IDs(void)
351{ 360{
352 /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 */ 361 /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
353 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); 362 And not needed on AMD */
354 if (ver >= 0x14) /* P4 or higher */ 363 if (modern_apic())
355 return; 364 return;
356 /* 365 /*
357 * Wait for idle. 366 * Wait for idle.
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index da30a374dd4e..df0e1745f189 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -1079,7 +1079,7 @@ static int apm_console_blank(int blank)
1079 break; 1079 break;
1080 } 1080 }
1081 1081
1082 if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) { 1082 if (error == APM_NOT_ENGAGED) {
1083 static int tried; 1083 static int tried;
1084 int eng_error; 1084 int eng_error;
1085 if (tried++ == 0) { 1085 if (tried++ == 0) {
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 0810f81f2a05..786d1a57048b 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -207,13 +207,13 @@ static void __init init_amd(struct cpuinfo_x86 *c)
207 set_bit(X86_FEATURE_K7, c->x86_capability); 207 set_bit(X86_FEATURE_K7, c->x86_capability);
208 break; 208 break;
209 } 209 }
210 if (c->x86 >= 6)
211 set_bit(X86_FEATURE_FXSAVE_LEAK, c->x86_capability);
210 212
211 display_cacheinfo(c); 213 display_cacheinfo(c);
212 214
213 if (cpuid_eax(0x80000000) >= 0x80000008) { 215 if (cpuid_eax(0x80000000) >= 0x80000008) {
214 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; 216 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
215 if (c->x86_max_cores & (c->x86_max_cores - 1))
216 c->x86_max_cores = 1;
217 } 217 }
218 218
219 if (cpuid_eax(0x80000000) >= 0x80000007) { 219 if (cpuid_eax(0x80000000) >= 0x80000007) {
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 712a26bd4457..71fffa174425 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -46,7 +46,7 @@
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: " 48#define BFX PFX "BIOS error: "
49#define VERSION "version 1.60.1" 49#define VERSION "version 1.60.2"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -55,7 +55,7 @@ static DEFINE_MUTEX(fidvid_mutex);
55static struct powernow_k8_data *powernow_data[NR_CPUS]; 55static struct powernow_k8_data *powernow_data[NR_CPUS];
56 56
57#ifndef CONFIG_SMP 57#ifndef CONFIG_SMP
58static cpumask_t cpu_core_map[1] = { CPU_MASK_ALL }; 58static cpumask_t cpu_core_map[1];
59#endif 59#endif
60 60
61/* Return a frequency in MHz, given an input fid */ 61/* Return a frequency in MHz, given an input fid */
@@ -905,11 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
905{ 905{
906 cpumask_t oldmask = CPU_MASK_ALL; 906 cpumask_t oldmask = CPU_MASK_ALL;
907 struct powernow_k8_data *data = powernow_data[pol->cpu]; 907 struct powernow_k8_data *data = powernow_data[pol->cpu];
908 u32 checkfid = data->currfid; 908 u32 checkfid;
909 u32 checkvid = data->currvid; 909 u32 checkvid;
910 unsigned int newstate; 910 unsigned int newstate;
911 int ret = -EIO; 911 int ret = -EIO;
912 912
913 if (!data)
914 return -EINVAL;
915
916 checkfid = data->currfid;
917 checkvid = data->currvid;
918
913 /* only run on specific CPU from here on */ 919 /* only run on specific CPU from here on */
914 oldmask = current->cpus_allowed; 920 oldmask = current->cpus_allowed;
915 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 921 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
@@ -969,6 +975,9 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
969{ 975{
970 struct powernow_k8_data *data = powernow_data[pol->cpu]; 976 struct powernow_k8_data *data = powernow_data[pol->cpu];
971 977
978 if (!data)
979 return -EINVAL;
980
972 return cpufreq_frequency_table_verify(pol, data->powernow_table); 981 return cpufreq_frequency_table_verify(pol, data->powernow_table);
973} 982}
974 983
@@ -977,7 +986,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
977{ 986{
978 struct powernow_k8_data *data; 987 struct powernow_k8_data *data;
979 cpumask_t oldmask = CPU_MASK_ALL; 988 cpumask_t oldmask = CPU_MASK_ALL;
980 int rc, i; 989 int rc;
981 990
982 if (!cpu_online(pol->cpu)) 991 if (!cpu_online(pol->cpu))
983 return -ENODEV; 992 return -ENODEV;
@@ -1063,8 +1072,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1063 printk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1072 printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1064 data->currfid, data->currvid); 1073 data->currfid, data->currvid);
1065 1074
1066 for_each_cpu_mask(i, cpu_core_map[pol->cpu]) 1075 powernow_data[pol->cpu] = data;
1067 powernow_data[i] = data;
1068 1076
1069 return 0; 1077 return 0;
1070 1078
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
index 006141d1c12a..1d9a4abcdfc7 100644
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -168,7 +168,7 @@ static int cpuid_class_device_create(int i)
168 return err; 168 return err;
169} 169}
170 170
171static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 171static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
172{ 172{
173 unsigned int cpu = (unsigned long)hcpu; 173 unsigned int cpu = (unsigned long)hcpu;
174 174
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index 055325056a74..036a9857936f 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -19,7 +19,6 @@ EXPORT_SYMBOL(__put_user_2);
19EXPORT_SYMBOL(__put_user_4); 19EXPORT_SYMBOL(__put_user_4);
20EXPORT_SYMBOL(__put_user_8); 20EXPORT_SYMBOL(__put_user_8);
21 21
22EXPORT_SYMBOL(strpbrk);
23EXPORT_SYMBOL(strstr); 22EXPORT_SYMBOL(strstr);
24 23
25#ifdef CONFIG_SMP 24#ifdef CONFIG_SMP
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index f19768789e8a..043f5292e70a 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -43,7 +43,7 @@ DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
44 44
45/* insert a jmp code */ 45/* insert a jmp code */
46static inline void set_jmp_op(void *from, void *to) 46static __always_inline void set_jmp_op(void *from, void *to)
47{ 47{
48 struct __arch_jmp_op { 48 struct __arch_jmp_op {
49 char op; 49 char op;
@@ -57,7 +57,7 @@ static inline void set_jmp_op(void *from, void *to)
57/* 57/*
58 * returns non-zero if opcodes can be boosted. 58 * returns non-zero if opcodes can be boosted.
59 */ 59 */
60static inline int can_boost(kprobe_opcode_t opcode) 60static __always_inline int can_boost(kprobe_opcode_t opcode)
61{ 61{
62 switch (opcode & 0xf0 ) { 62 switch (opcode & 0xf0 ) {
63 case 0x70: 63 case 0x70:
@@ -88,7 +88,7 @@ static inline int can_boost(kprobe_opcode_t opcode)
88/* 88/*
89 * returns non-zero if opcode modifies the interrupt flag. 89 * returns non-zero if opcode modifies the interrupt flag.
90 */ 90 */
91static inline int is_IF_modifier(kprobe_opcode_t opcode) 91static int __kprobes is_IF_modifier(kprobe_opcode_t opcode)
92{ 92{
93 switch (opcode) { 93 switch (opcode) {
94 case 0xfa: /* cli */ 94 case 0xfa: /* cli */
@@ -138,7 +138,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
138 mutex_unlock(&kprobe_mutex); 138 mutex_unlock(&kprobe_mutex);
139} 139}
140 140
141static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 141static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
142{ 142{
143 kcb->prev_kprobe.kp = kprobe_running(); 143 kcb->prev_kprobe.kp = kprobe_running();
144 kcb->prev_kprobe.status = kcb->kprobe_status; 144 kcb->prev_kprobe.status = kcb->kprobe_status;
@@ -146,7 +146,7 @@ static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
146 kcb->prev_kprobe.saved_eflags = kcb->kprobe_saved_eflags; 146 kcb->prev_kprobe.saved_eflags = kcb->kprobe_saved_eflags;
147} 147}
148 148
149static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) 149static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
150{ 150{
151 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 151 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
152 kcb->kprobe_status = kcb->prev_kprobe.status; 152 kcb->kprobe_status = kcb->prev_kprobe.status;
@@ -154,7 +154,7 @@ static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
154 kcb->kprobe_saved_eflags = kcb->prev_kprobe.saved_eflags; 154 kcb->kprobe_saved_eflags = kcb->prev_kprobe.saved_eflags;
155} 155}
156 156
157static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, 157static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
158 struct kprobe_ctlblk *kcb) 158 struct kprobe_ctlblk *kcb)
159{ 159{
160 __get_cpu_var(current_kprobe) = p; 160 __get_cpu_var(current_kprobe) = p;
@@ -164,7 +164,7 @@ static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
164 kcb->kprobe_saved_eflags &= ~IF_MASK; 164 kcb->kprobe_saved_eflags &= ~IF_MASK;
165} 165}
166 166
167static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 167static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
168{ 168{
169 regs->eflags |= TF_MASK; 169 regs->eflags |= TF_MASK;
170 regs->eflags &= ~IF_MASK; 170 regs->eflags &= ~IF_MASK;
@@ -507,7 +507,7 @@ no_change:
507 * Interrupts are disabled on entry as trap1 is an interrupt gate and they 507 * Interrupts are disabled on entry as trap1 is an interrupt gate and they
508 * remain disabled thoroughout this function. 508 * remain disabled thoroughout this function.
509 */ 509 */
510static inline int post_kprobe_handler(struct pt_regs *regs) 510static int __kprobes post_kprobe_handler(struct pt_regs *regs)
511{ 511{
512 struct kprobe *cur = kprobe_running(); 512 struct kprobe *cur = kprobe_running();
513 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 513 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -543,7 +543,7 @@ out:
543 return 1; 543 return 1;
544} 544}
545 545
546static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 546static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
547{ 547{
548 struct kprobe *cur = kprobe_running(); 548 struct kprobe *cur = kprobe_running();
549 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 549 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 8d8aa9d1796d..34d21e21e012 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -38,12 +38,6 @@
38int smp_found_config; 38int smp_found_config;
39unsigned int __initdata maxcpus = NR_CPUS; 39unsigned int __initdata maxcpus = NR_CPUS;
40 40
41#ifdef CONFIG_HOTPLUG_CPU
42#define CPU_HOTPLUG_ENABLED (1)
43#else
44#define CPU_HOTPLUG_ENABLED (0)
45#endif
46
47/* 41/*
48 * Various Linux-internal data structures created from the 42 * Various Linux-internal data structures created from the
49 * MP-table. 43 * MP-table.
@@ -110,21 +104,6 @@ static int __init mpf_checksum(unsigned char *mp, int len)
110static int mpc_record; 104static int mpc_record;
111static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; 105static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata;
112 106
113#ifdef CONFIG_X86_NUMAQ
114static int MP_valid_apicid(int apicid, int version)
115{
116 return hweight_long(apicid & 0xf) == 1 && (apicid >> 4) != 0xf;
117}
118#else
119static int MP_valid_apicid(int apicid, int version)
120{
121 if (version >= 0x14)
122 return apicid < 0xff;
123 else
124 return apicid < 0xf;
125}
126#endif
127
128static void __devinit MP_processor_info (struct mpc_config_processor *m) 107static void __devinit MP_processor_info (struct mpc_config_processor *m)
129{ 108{
130 int ver, apicid; 109 int ver, apicid;
@@ -190,12 +169,6 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
190 169
191 ver = m->mpc_apicver; 170 ver = m->mpc_apicver;
192 171
193 if (!MP_valid_apicid(apicid, ver)) {
194 printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
195 m->mpc_apicid, MAX_APICS);
196 return;
197 }
198
199 /* 172 /*
200 * Validate version 173 * Validate version
201 */ 174 */
@@ -225,7 +198,14 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
225 cpu_set(num_processors, cpu_possible_map); 198 cpu_set(num_processors, cpu_possible_map);
226 num_processors++; 199 num_processors++;
227 200
228 if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) { 201 /*
202 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
203 * but we need to work other dependencies like SMP_SUSPEND etc
204 * before this can be done without some confusion.
205 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
206 * - Ashok Raj <ashok.raj@intel.com>
207 */
208 if (num_processors > 8) {
229 switch (boot_cpu_data.x86_vendor) { 209 switch (boot_cpu_data.x86_vendor) {
230 case X86_VENDOR_INTEL: 210 case X86_VENDOR_INTEL:
231 if (!APIC_XAPIC(ver)) { 211 if (!APIC_XAPIC(ver)) {
@@ -249,6 +229,13 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
249 229
250 mpc_oem_bus_info(m, str, translation_table[mpc_record]); 230 mpc_oem_bus_info(m, str, translation_table[mpc_record]);
251 231
232 if (m->mpc_busid >= MAX_MP_BUSSES) {
233 printk(KERN_WARNING "MP table busid value (%d) for bustype %s "
234 " is too large, max. supported is %d\n",
235 m->mpc_busid, str, MAX_MP_BUSSES - 1);
236 return;
237 }
238
252 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) { 239 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
253 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; 240 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
254 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) { 241 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index 1d0a55e68760..7a328230e540 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -251,7 +251,7 @@ static int msr_class_device_create(int i)
251 return err; 251 return err;
252} 252}
253 253
254static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 254static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
255{ 255{
256 unsigned int cpu = (unsigned long)hcpu; 256 unsigned int cpu = (unsigned long)hcpu;
257 257
diff --git a/arch/i386/kernel/reboot_fixups.c b/arch/i386/kernel/reboot_fixups.c
index 10e21a4773dd..99aab41a05b0 100644
--- a/arch/i386/kernel/reboot_fixups.c
+++ b/arch/i386/kernel/reboot_fixups.c
@@ -51,7 +51,5 @@ void mach_reboot_fixups(void)
51 51
52 cur->reboot_fixup(dev); 52 cur->reboot_fixup(dev);
53 } 53 }
54
55 printk(KERN_WARNING "No reboot fixup found for your hardware\n");
56} 54}
57 55
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index eacc3f0a2ea4..80cb3b2d0997 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -963,6 +963,36 @@ efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
963 return 0; 963 return 0;
964} 964}
965 965
966 /*
967 * This function checks if the entire range <start,end> is mapped with type.
968 *
969 * Note: this function only works correct if the e820 table is sorted and
970 * not-overlapping, which is the case
971 */
972int __init
973e820_all_mapped(unsigned long start, unsigned long end, unsigned type)
974{
975 int i;
976 for (i = 0; i < e820.nr_map; i++) {
977 struct e820entry *ei = &e820.map[i];
978 if (type && ei->type != type)
979 continue;
980 /* is the region (part) in overlap with the current region ?*/
981 if (ei->addr >= end || ei->addr + ei->size <= start)
982 continue;
983 /* if the region is at the beginning of <start,end> we move
984 * start to the end of the region since it's ok until there
985 */
986 if (ei->addr <= start)
987 start = ei->addr + ei->size;
988 /* if start is now at or beyond end, we're done, full
989 * coverage */
990 if (start >= end)
991 return 1; /* we're done */
992 }
993 return 0;
994}
995
966/* 996/*
967 * Find the highest page frame number we have available 997 * Find the highest page frame number we have available
968 */ 998 */
@@ -1317,8 +1347,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
1317/* 1347/*
1318 * Request address space for all standard resources 1348 * Request address space for all standard resources
1319 * 1349 *
1320 * This is called just before pcibios_assign_resources(), which is also 1350 * This is called just before pcibios_init(), which is also a
1321 * an fs_initcall, but is linked in later (in arch/i386/pci/i386.c). 1351 * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
1322 */ 1352 */
1323static int __init request_standard_resources(void) 1353static int __init request_standard_resources(void)
1324{ 1354{
@@ -1339,7 +1369,7 @@ static int __init request_standard_resources(void)
1339 return 0; 1369 return 0;
1340} 1370}
1341 1371
1342fs_initcall(request_standard_resources); 1372subsys_initcall(request_standard_resources);
1343 1373
1344static void __init register_memory(void) 1374static void __init register_memory(void)
1345{ 1375{
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 4f58b9c0efe3..f48bef15b4f0 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -314,3 +314,4 @@ ENTRY(sys_call_table)
314 .long sys_get_robust_list 314 .long sys_get_robust_list
315 .long sys_splice 315 .long sys_splice
316 .long sys_sync_file_range 316 .long sys_sync_file_range
317 .long sys_tee /* 315 */
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index e38527994590..2d22f5761b1d 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -365,6 +365,9 @@ void die(const char * str, struct pt_regs * regs, long err)
365 365
366 if (++die.lock_owner_depth < 3) { 366 if (++die.lock_owner_depth < 3) {
367 int nl = 0; 367 int nl = 0;
368 unsigned long esp;
369 unsigned short ss;
370
368 handle_BUG(regs); 371 handle_BUG(regs);
369 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 372 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
370#ifdef CONFIG_PREEMPT 373#ifdef CONFIG_PREEMPT
@@ -387,8 +390,19 @@ void die(const char * str, struct pt_regs * regs, long err)
387 printk("\n"); 390 printk("\n");
388 if (notify_die(DIE_OOPS, str, regs, err, 391 if (notify_die(DIE_OOPS, str, regs, err,
389 current->thread.trap_no, SIGSEGV) != 392 current->thread.trap_no, SIGSEGV) !=
390 NOTIFY_STOP) 393 NOTIFY_STOP) {
391 show_registers(regs); 394 show_registers(regs);
395 /* Executive summary in case the oops scrolled away */
396 esp = (unsigned long) (&regs->esp);
397 savesegment(ss, ss);
398 if (user_mode(regs)) {
399 esp = regs->esp;
400 ss = regs->xss & 0xffff;
401 }
402 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->eip);
403 print_symbol("%s", regs->eip);
404 printk(" SS:ESP %04x:%08lx\n", ss, esp);
405 }
392 else 406 else
393 regs = NULL; 407 regs = NULL;
394 } else 408 } else
diff --git a/arch/i386/mach-voyager/voyager_cat.c b/arch/i386/mach-voyager/voyager_cat.c
index 23967fe658d3..10d21df14531 100644
--- a/arch/i386/mach-voyager/voyager_cat.c
+++ b/arch/i386/mach-voyager/voyager_cat.c
@@ -106,15 +106,20 @@ voyager_module_t *voyager_cat_list;
106 106
107/* the I/O port assignments for the VIC and QIC */ 107/* the I/O port assignments for the VIC and QIC */
108static struct resource vic_res = { 108static struct resource vic_res = {
109 "Voyager Interrupt Controller", 0xFC00, 0xFC6F }; 109 .name = "Voyager Interrupt Controller",
110 .start = 0xFC00,
111 .end = 0xFC6F
112};
110static struct resource qic_res = { 113static struct resource qic_res = {
111 "Quad Interrupt Controller", 0xFC70, 0xFCFF }; 114 .name = "Quad Interrupt Controller",
115 .start = 0xFC70,
116 .end = 0xFCFF
117};
112 118
113/* This function is used to pack a data bit stream inside a message. 119/* This function is used to pack a data bit stream inside a message.
114 * It writes num_bits of the data buffer in msg starting at start_bit. 120 * It writes num_bits of the data buffer in msg starting at start_bit.
115 * Note: This function assumes that any unused bit in the data stream 121 * Note: This function assumes that any unused bit in the data stream
116 * is set to zero so that the ors will work correctly */ 122 * is set to zero so that the ors will work correctly */
117#define BITS_PER_BYTE 8
118static void 123static void
119cat_pack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits) 124cat_pack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits)
120{ 125{
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 9f66ac582a8b..ae6534ad8161 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -651,6 +651,7 @@ void __init mem_init(void)
651 * Specifically, in the case of x86, we will always add 651 * Specifically, in the case of x86, we will always add
652 * memory to the highmem for now. 652 * memory to the highmem for now.
653 */ 653 */
654#ifdef CONFIG_HOTPLUG_MEMORY
654#ifndef CONFIG_NEED_MULTIPLE_NODES 655#ifndef CONFIG_NEED_MULTIPLE_NODES
655int add_memory(u64 start, u64 size) 656int add_memory(u64 start, u64 size)
656{ 657{
@@ -667,6 +668,7 @@ int remove_memory(u64 start, u64 size)
667 return -EINVAL; 668 return -EINVAL;
668} 669}
669#endif 670#endif
671#endif
670 672
671kmem_cache_t *pgd_cache; 673kmem_cache_t *pgd_cache;
672kmem_cache_t *pmd_cache; 674kmem_cache_t *pmd_cache;
diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
index 99012b93bd12..5d81fb510375 100644
--- a/arch/i386/pci/direct.c
+++ b/arch/i386/pci/direct.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/dmi.h>
7#include "pci.h" 8#include "pci.h"
8 9
9/* 10/*
@@ -18,8 +19,10 @@ int pci_conf1_read(unsigned int seg, unsigned int bus,
18{ 19{
19 unsigned long flags; 20 unsigned long flags;
20 21
21 if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) 22 if ((bus > 255) || (devfn > 255) || (reg > 255)) {
23 *value = -1;
22 return -EINVAL; 24 return -EINVAL;
25 }
23 26
24 spin_lock_irqsave(&pci_config_lock, flags); 27 spin_lock_irqsave(&pci_config_lock, flags);
25 28
@@ -91,8 +94,10 @@ static int pci_conf2_read(unsigned int seg, unsigned int bus,
91 unsigned long flags; 94 unsigned long flags;
92 int dev, fn; 95 int dev, fn;
93 96
94 if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) 97 if ((bus > 255) || (devfn > 255) || (reg > 255)) {
98 *value = -1;
95 return -EINVAL; 99 return -EINVAL;
100 }
96 101
97 dev = PCI_SLOT(devfn); 102 dev = PCI_SLOT(devfn);
98 fn = PCI_FUNC(devfn); 103 fn = PCI_FUNC(devfn);
@@ -188,6 +193,10 @@ static int __init pci_sanity_check(struct pci_raw_ops *o)
188 193
189 if (pci_probe & PCI_NO_CHECKS) 194 if (pci_probe & PCI_NO_CHECKS)
190 return 1; 195 return 1;
196 /* Assume Type 1 works for newer systems.
197 This handles machines that don't have anything on PCI Bus 0. */
198 if (dmi_get_year(DMI_BIOS_DATE) >= 2001)
199 return 1;
191 200
192 for (devfn = 0; devfn < 0x100; devfn++) { 201 for (devfn = 0; devfn < 0x100; devfn++) {
193 if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x)) 202 if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x))
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 3ca59cad05f3..73235443fda7 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -588,7 +588,10 @@ static __init int via_router_probe(struct irq_router *r,
588 case PCI_DEVICE_ID_VIA_82C596: 588 case PCI_DEVICE_ID_VIA_82C596:
589 case PCI_DEVICE_ID_VIA_82C686: 589 case PCI_DEVICE_ID_VIA_82C686:
590 case PCI_DEVICE_ID_VIA_8231: 590 case PCI_DEVICE_ID_VIA_8231:
591 case PCI_DEVICE_ID_VIA_8233A:
591 case PCI_DEVICE_ID_VIA_8235: 592 case PCI_DEVICE_ID_VIA_8235:
593 case PCI_DEVICE_ID_VIA_8237:
594 case PCI_DEVICE_ID_VIA_8237_SATA:
592 /* FIXME: add new ones for 8233/5 */ 595 /* FIXME: add new ones for 8233/5 */
593 r->name = "VIA"; 596 r->name = "VIA";
594 r->get = pirq_via_get; 597 r->get = pirq_via_get;
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 613789071f30..6b1ea0c9a570 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -12,14 +12,20 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <asm/e820.h>
15#include "pci.h" 16#include "pci.h"
16 17
18#define MMCONFIG_APER_SIZE (256*1024*1024)
19
20/* Assume systems with more busses have correct MCFG */
21#define MAX_CHECK_BUS 16
22
17#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) 23#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
18 24
19/* The base address of the last MMCONFIG device accessed */ 25/* The base address of the last MMCONFIG device accessed */
20static u32 mmcfg_last_accessed_device; 26static u32 mmcfg_last_accessed_device;
21 27
22static DECLARE_BITMAP(fallback_slots, 32); 28static DECLARE_BITMAP(fallback_slots, MAX_CHECK_BUS*32);
23 29
24/* 30/*
25 * Functions for accessing PCI configuration space with MMCONFIG accesses 31 * Functions for accessing PCI configuration space with MMCONFIG accesses
@@ -29,8 +35,8 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
29 int cfg_num = -1; 35 int cfg_num = -1;
30 struct acpi_table_mcfg_config *cfg; 36 struct acpi_table_mcfg_config *cfg;
31 37
32 if (seg == 0 && bus == 0 && 38 if (seg == 0 && bus < MAX_CHECK_BUS &&
33 test_bit(PCI_SLOT(devfn), fallback_slots)) 39 test_bit(PCI_SLOT(devfn) + 32*bus, fallback_slots))
34 return 0; 40 return 0;
35 41
36 while (1) { 42 while (1) {
@@ -74,8 +80,10 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
74 unsigned long flags; 80 unsigned long flags;
75 u32 base; 81 u32 base;
76 82
77 if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) 83 if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
84 *value = -1;
78 return -EINVAL; 85 return -EINVAL;
86 }
79 87
80 base = get_base_addr(seg, bus, devfn); 88 base = get_base_addr(seg, bus, devfn);
81 if (!base) 89 if (!base)
@@ -146,29 +154,34 @@ static struct pci_raw_ops pci_mmcfg = {
146 Normally this can be expressed in the MCFG by not listing them 154 Normally this can be expressed in the MCFG by not listing them
147 and assigning suitable _SEGs, but this isn't implemented in some BIOS. 155 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
148 Instead try to discover all devices on bus 0 that are unreachable using MM 156 Instead try to discover all devices on bus 0 that are unreachable using MM
149 and fallback for them. 157 and fallback for them. */
150 We only do this for bus 0/seg 0 */
151static __init void unreachable_devices(void) 158static __init void unreachable_devices(void)
152{ 159{
153 int i; 160 int i, k;
154 unsigned long flags; 161 unsigned long flags;
155 162
156 for (i = 0; i < 32; i++) { 163 for (k = 0; k < MAX_CHECK_BUS; k++) {
157 u32 val1; 164 for (i = 0; i < 32; i++) {
158 u32 addr; 165 u32 val1;
159 166 u32 addr;
160 pci_conf1_read(0, 0, PCI_DEVFN(i, 0), 0, 4, &val1); 167
161 if (val1 == 0xffffffff) 168 pci_conf1_read(0, k, PCI_DEVFN(i, 0), 0, 4, &val1);
162 continue; 169 if (val1 == 0xffffffff)
163 170 continue;
164 /* Locking probably not needed, but safer */ 171
165 spin_lock_irqsave(&pci_config_lock, flags); 172 /* Locking probably not needed, but safer */
166 addr = get_base_addr(0, 0, PCI_DEVFN(i, 0)); 173 spin_lock_irqsave(&pci_config_lock, flags);
167 if (addr != 0) 174 addr = get_base_addr(0, k, PCI_DEVFN(i, 0));
168 pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0)); 175 if (addr != 0)
169 if (addr == 0 || readl((u32 __iomem *)mmcfg_virt_addr) != val1) 176 pci_exp_set_dev_base(addr, k, PCI_DEVFN(i, 0));
170 set_bit(i, fallback_slots); 177 if (addr == 0 ||
171 spin_unlock_irqrestore(&pci_config_lock, flags); 178 readl((u32 __iomem *)mmcfg_virt_addr) != val1) {
179 set_bit(i, fallback_slots);
180 printk(KERN_NOTICE
181 "PCI: No mmconfig possible on %x:%x\n", k, i);
182 }
183 spin_unlock_irqrestore(&pci_config_lock, flags);
184 }
172 } 185 }
173} 186}
174 187
@@ -183,6 +196,14 @@ void __init pci_mmcfg_init(void)
183 (pci_mmcfg_config[0].base_address == 0)) 196 (pci_mmcfg_config[0].base_address == 0))
184 return; 197 return;
185 198
199 if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
200 pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE,
201 E820_RESERVED)) {
202 printk(KERN_ERR "PCI: BIOS Bug: MCFG area is not E820-reserved\n");
203 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
204 return;
205 }
206
186 printk(KERN_INFO "PCI: Using MMCONFIG\n"); 207 printk(KERN_INFO "PCI: Using MMCONFIG\n");
187 raw_pci_ops = &pci_mmcfg; 208 raw_pci_ops = &pci_mmcfg;
188 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 209 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index edffe25a477a..9f40eeff0b5c 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -260,15 +260,6 @@ config NR_CPUS
260 than 64 will cause the use of a CPU mask array, causing a small 260 than 64 will cause the use of a CPU mask array, causing a small
261 performance hit. 261 performance hit.
262 262
263config IA64_NR_NODES
264 int "Maximum number of NODEs (256-1024)" if (IA64_SGI_SN2 || IA64_GENERIC)
265 range 256 1024
266 depends on IA64_SGI_SN2 || IA64_GENERIC
267 default "256"
268 help
269 This option specifies the maximum number of nodes in your SSI system.
270 If in doubt, use the default.
271
272config HOTPLUG_CPU 263config HOTPLUG_CPU
273 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 264 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
274 depends on SMP && EXPERIMENTAL 265 depends on SMP && EXPERIMENTAL
@@ -352,6 +343,16 @@ config NUMA
352 Access). This option is for configuring high-end multiprocessor 343 Access). This option is for configuring high-end multiprocessor
353 server systems. If in doubt, say N. 344 server systems. If in doubt, say N.
354 345
346config NODES_SHIFT
347 int "Max num nodes shift(3-10)"
348 range 3 10
349 default "8"
350 depends on NEED_MULTIPLE_NODES
351 help
352 This option specifies the maximum number of nodes in your SSI system.
353 MAX_NUMNODES will be 2^(This value).
354 If in doubt, use the default.
355
355# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent. 356# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
356# VIRTUAL_MEM_MAP has been retained for historical reasons. 357# VIRTUAL_MEM_MAP has been retained for historical reasons.
357config VIRTUAL_MEM_MAP 358config VIRTUAL_MEM_MAP
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 59e871dae742..09a0dbc17fb6 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.lds
7obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \ 7obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \
8 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \ 8 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \
9 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \ 9 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
10 unwind.o mca.o mca_asm.o topology.o dmi_scan.o 10 unwind.o mca.o mca_asm.o topology.o
11 11
12obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o 12obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o
13obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o 13obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
@@ -30,7 +30,6 @@ obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o 30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o
31obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o 31obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o
32mca_recovery-y += mca_drv.o mca_drv_asm.o 32mca_recovery-y += mca_drv.o mca_drv_asm.o
33dmi_scan-y += ../../i386/kernel/dmi_scan.o
34 33
35# The gate DSO image is built using a special linker script. 34# The gate DSO image is built using a special linker script.
36targets += gate.so gate-syms.o 35targets += gate.so gate-syms.o
diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c
index 4a5574ff007b..fff82929d225 100644
--- a/arch/ia64/kernel/acpi-ext.c
+++ b/arch/ia64/kernel/acpi-ext.c
@@ -1,105 +1,104 @@
1/* 1/*
2 * arch/ia64/kernel/acpi-ext.c 2 * (c) Copyright 2003, 2006 Hewlett-Packard Development Company, L.P.
3 * Alex Williamson <alex.williamson@hp.com>
4 * Bjorn Helgaas <bjorn.helgaas@hp.com>
3 * 5 *
4 * Copyright (C) 2003 Hewlett-Packard 6 * This program is free software; you can redistribute it and/or modify
5 * Copyright (C) Alex Williamson 7 * it under the terms of the GNU General Public License version 2 as
6 * Copyright (C) Bjorn Helgaas 8 * published by the Free Software Foundation.
7 *
8 * Vendor specific extensions to ACPI.
9 */ 9 */
10 10
11#include <linux/config.h> 11#include <linux/config.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <linux/efi.h>
16 15
17#include <asm/acpi-ext.h> 16#include <asm/acpi-ext.h>
18 17
19struct acpi_vendor_descriptor { 18/*
20 u8 guid_id; 19 * Device CSRs that do not appear in PCI config space should be described
21 efi_guid_t guid; 20 * via ACPI. This would normally be done with Address Space Descriptors
22}; 21 * marked as "consumer-only," but old versions of Windows and Linux ignore
22 * the producer/consumer flag, so HP invented a vendor-defined resource to
23 * describe the location and size of CSR space.
24 */
23 25
24struct acpi_vendor_info { 26struct acpi_vendor_uuid hp_ccsr_uuid = {
25 struct acpi_vendor_descriptor *descriptor; 27 .subtype = 2,
26 u8 *data; 28 .data = { 0xf9, 0xad, 0xe9, 0x69, 0x4f, 0x92, 0x5f, 0xab, 0xf6, 0x4a,
27 u32 length; 29 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad },
28}; 30};
29 31
30acpi_status 32static acpi_status hp_ccsr_locate(acpi_handle obj, u64 *base, u64 *length)
31acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
32{ 33{
33 struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; 34 acpi_status status;
34 struct acpi_resource_vendor *vendor; 35 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
35 struct acpi_vendor_descriptor *descriptor; 36 struct acpi_resource *resource;
36 u32 byte_length; 37 struct acpi_resource_vendor_typed *vendor;
37
38 if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
39 return AE_OK;
40
41 vendor = (struct acpi_resource_vendor *)&resource->data;
42 descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
43 if (vendor->byte_length <= sizeof(*info->descriptor) ||
44 descriptor->guid_id != info->descriptor->guid_id ||
45 efi_guidcmp(descriptor->guid, info->descriptor->guid))
46 return AE_OK;
47
48 byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
49 info->data = acpi_os_allocate(byte_length);
50 if (!info->data)
51 return AE_NO_MEMORY;
52
53 memcpy(info->data,
54 vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
55 byte_length);
56 info->length = byte_length;
57 return AE_CTRL_TERMINATE;
58}
59 38
60acpi_status 39 status = acpi_get_vendor_resource(obj, METHOD_NAME__CRS, &hp_ccsr_uuid,
61acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, 40 &buffer);
62 u8 ** data, u32 * byte_length)
63{
64 struct acpi_vendor_info info;
65 41
66 info.descriptor = id; 42 resource = buffer.pointer;
67 info.data = NULL; 43 vendor = &resource->data.vendor_typed;
68 44
69 acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, 45 if (ACPI_FAILURE(status) || vendor->byte_length < 16) {
70 &info); 46 status = AE_NOT_FOUND;
71 if (!info.data) 47 goto exit;
72 return AE_NOT_FOUND; 48 }
73 49
74 *data = info.data; 50 memcpy(base, vendor->byte_data, sizeof(*base));
75 *byte_length = info.length; 51 memcpy(length, vendor->byte_data + 8, sizeof(*length));
76 return AE_OK; 52
53 exit:
54 acpi_os_free(buffer.pointer);
55 return status;
77} 56}
78 57
79struct acpi_vendor_descriptor hp_ccsr_descriptor = { 58struct csr_space {
80 .guid_id = 2, 59 u64 base;
81 .guid = 60 u64 length;
82 EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
83 0x37, 0x0e, 0xad)
84}; 61};
85 62
86acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length) 63static acpi_status find_csr_space(struct acpi_resource *resource, void *data)
87{ 64{
65 struct csr_space *space = data;
66 struct acpi_resource_address64 addr;
88 acpi_status status; 67 acpi_status status;
89 u8 *data;
90 u32 length;
91 68
92 status = 69 status = acpi_resource_to_address64(resource, &addr);
93 acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); 70 if (ACPI_SUCCESS(status) &&
71 addr.resource_type == ACPI_MEMORY_RANGE &&
72 addr.address_length &&
73 addr.producer_consumer == ACPI_CONSUMER) {
74 space->base = addr.minimum;
75 space->length = addr.address_length;
76 return AE_CTRL_TERMINATE;
77 }
78 return AE_OK; /* keep looking */
79}
94 80
95 if (ACPI_FAILURE(status) || length != 16) 81static acpi_status hp_crs_locate(acpi_handle obj, u64 *base, u64 *length)
96 return AE_NOT_FOUND; 82{
83 struct csr_space space = { 0, 0 };
97 84
98 memcpy(csr_base, data, sizeof(*csr_base)); 85 acpi_walk_resources(obj, METHOD_NAME__CRS, find_csr_space, &space);
99 memcpy(csr_length, data + 8, sizeof(*csr_length)); 86 if (!space.length)
100 acpi_os_free(data); 87 return AE_NOT_FOUND;
101 88
89 *base = space.base;
90 *length = space.length;
102 return AE_OK; 91 return AE_OK;
103} 92}
104 93
94acpi_status hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
95{
96 acpi_status status;
97
98 status = hp_ccsr_locate(obj, csr_base, csr_length);
99 if (ACPI_SUCCESS(status))
100 return status;
101
102 return hp_crs_locate(obj, csr_base, csr_length);
103}
105EXPORT_SYMBOL(hp_acpi_csr_space); 104EXPORT_SYMBOL(hp_acpi_csr_space);
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 750e8e7fbdc3..e30798811216 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1606,5 +1606,9 @@ sys_call_table:
1606 data8 sys_ni_syscall // 1295 reserved for ppoll 1606 data8 sys_ni_syscall // 1295 reserved for ppoll
1607 data8 sys_unshare 1607 data8 sys_unshare
1608 data8 sys_splice 1608 data8 sys_splice
1609 data8 sys_set_robust_list
1610 data8 sys_get_robust_list
1611 data8 sys_sync_file_range // 1300
1612 data8 sys_tee
1609 1613
1610 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1614 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 789881ca83d4..f9039f88d01d 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -251,7 +251,7 @@ static void __kprobes prepare_break_inst(uint template, uint slot,
251 update_kprobe_inst_flag(template, slot, major_opcode, kprobe_inst, p); 251 update_kprobe_inst_flag(template, slot, major_opcode, kprobe_inst, p);
252} 252}
253 253
254static inline void get_kprobe_inst(bundle_t *bundle, uint slot, 254static void __kprobes get_kprobe_inst(bundle_t *bundle, uint slot,
255 unsigned long *kprobe_inst, uint *major_opcode) 255 unsigned long *kprobe_inst, uint *major_opcode)
256{ 256{
257 unsigned long kprobe_inst_p0, kprobe_inst_p1; 257 unsigned long kprobe_inst_p0, kprobe_inst_p1;
@@ -278,7 +278,7 @@ static inline void get_kprobe_inst(bundle_t *bundle, uint slot,
278} 278}
279 279
280/* Returns non-zero if the addr is in the Interrupt Vector Table */ 280/* Returns non-zero if the addr is in the Interrupt Vector Table */
281static inline int in_ivt_functions(unsigned long addr) 281static int __kprobes in_ivt_functions(unsigned long addr)
282{ 282{
283 return (addr >= (unsigned long)__start_ivt_text 283 return (addr >= (unsigned long)__start_ivt_text
284 && addr < (unsigned long)__end_ivt_text); 284 && addr < (unsigned long)__end_ivt_text);
@@ -308,19 +308,19 @@ static int __kprobes valid_kprobe_addr(int template, int slot,
308 return 0; 308 return 0;
309} 309}
310 310
311static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 311static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
312{ 312{
313 kcb->prev_kprobe.kp = kprobe_running(); 313 kcb->prev_kprobe.kp = kprobe_running();
314 kcb->prev_kprobe.status = kcb->kprobe_status; 314 kcb->prev_kprobe.status = kcb->kprobe_status;
315} 315}
316 316
317static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) 317static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
318{ 318{
319 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 319 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
320 kcb->kprobe_status = kcb->prev_kprobe.status; 320 kcb->kprobe_status = kcb->prev_kprobe.status;
321} 321}
322 322
323static inline void set_current_kprobe(struct kprobe *p, 323static void __kprobes set_current_kprobe(struct kprobe *p,
324 struct kprobe_ctlblk *kcb) 324 struct kprobe_ctlblk *kcb)
325{ 325{
326 __get_cpu_var(current_kprobe) = p; 326 __get_cpu_var(current_kprobe) = p;
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 8963171788d5..6a0880639bc9 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -581,10 +581,12 @@ ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *regs)
581{ 581{
582 unsigned long flags; 582 unsigned long flags;
583 int cpu = smp_processor_id(); 583 int cpu = smp_processor_id();
584 struct ia64_mca_notify_die nd =
585 { .sos = NULL, .monarch_cpu = &monarch_cpu };
584 586
585 /* Mask all interrupts */ 587 /* Mask all interrupts */
586 local_irq_save(flags); 588 local_irq_save(flags);
587 if (notify_die(DIE_MCA_RENDZVOUS_ENTER, "MCA", regs, 0, 0, 0) 589 if (notify_die(DIE_MCA_RENDZVOUS_ENTER, "MCA", regs, (long)&nd, 0, 0)
588 == NOTIFY_STOP) 590 == NOTIFY_STOP)
589 ia64_mca_spin(__FUNCTION__); 591 ia64_mca_spin(__FUNCTION__);
590 592
@@ -594,7 +596,7 @@ ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *regs)
594 */ 596 */
595 ia64_sal_mc_rendez(); 597 ia64_sal_mc_rendez();
596 598
597 if (notify_die(DIE_MCA_RENDZVOUS_PROCESS, "MCA", regs, 0, 0, 0) 599 if (notify_die(DIE_MCA_RENDZVOUS_PROCESS, "MCA", regs, (long)&nd, 0, 0)
598 == NOTIFY_STOP) 600 == NOTIFY_STOP)
599 ia64_mca_spin(__FUNCTION__); 601 ia64_mca_spin(__FUNCTION__);
600 602
@@ -602,7 +604,7 @@ ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *regs)
602 while (monarch_cpu != -1) 604 while (monarch_cpu != -1)
603 cpu_relax(); /* spin until monarch leaves */ 605 cpu_relax(); /* spin until monarch leaves */
604 606
605 if (notify_die(DIE_MCA_RENDZVOUS_LEAVE, "MCA", regs, 0, 0, 0) 607 if (notify_die(DIE_MCA_RENDZVOUS_LEAVE, "MCA", regs, (long)&nd, 0, 0)
606 == NOTIFY_STOP) 608 == NOTIFY_STOP)
607 ia64_mca_spin(__FUNCTION__); 609 ia64_mca_spin(__FUNCTION__);
608 610
@@ -961,7 +963,7 @@ no_mod:
961 */ 963 */
962 964
963static void 965static void
964ia64_wait_for_slaves(int monarch) 966ia64_wait_for_slaves(int monarch, const char *type)
965{ 967{
966 int c, wait = 0, missing = 0; 968 int c, wait = 0, missing = 0;
967 for_each_online_cpu(c) { 969 for_each_online_cpu(c) {
@@ -987,7 +989,7 @@ ia64_wait_for_slaves(int monarch)
987 } 989 }
988 if (!missing) 990 if (!missing)
989 goto all_in; 991 goto all_in;
990 printk(KERN_INFO "OS MCA slave did not rendezvous on cpu"); 992 printk(KERN_INFO "OS %s slave did not rendezvous on cpu", type);
991 for_each_online_cpu(c) { 993 for_each_online_cpu(c) {
992 if (c == monarch) 994 if (c == monarch)
993 continue; 995 continue;
@@ -998,7 +1000,7 @@ ia64_wait_for_slaves(int monarch)
998 return; 1000 return;
999 1001
1000all_in: 1002all_in:
1001 printk(KERN_INFO "All OS MCA slaves have reached rendezvous\n"); 1003 printk(KERN_INFO "All OS %s slaves have reached rendezvous\n", type);
1002 return; 1004 return;
1003} 1005}
1004 1006
@@ -1023,6 +1025,8 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1023 &sos->proc_state_param; 1025 &sos->proc_state_param;
1024 int recover, cpu = smp_processor_id(); 1026 int recover, cpu = smp_processor_id();
1025 task_t *previous_current; 1027 task_t *previous_current;
1028 struct ia64_mca_notify_die nd =
1029 { .sos = sos, .monarch_cpu = &monarch_cpu };
1026 1030
1027 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */ 1031 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */
1028 console_loglevel = 15; /* make sure printks make it to console */ 1032 console_loglevel = 15; /* make sure printks make it to console */
@@ -1031,10 +1035,10 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1031 1035
1032 previous_current = ia64_mca_modify_original_stack(regs, sw, sos, "MCA"); 1036 previous_current = ia64_mca_modify_original_stack(regs, sw, sos, "MCA");
1033 monarch_cpu = cpu; 1037 monarch_cpu = cpu;
1034 if (notify_die(DIE_MCA_MONARCH_ENTER, "MCA", regs, 0, 0, 0) 1038 if (notify_die(DIE_MCA_MONARCH_ENTER, "MCA", regs, (long)&nd, 0, 0)
1035 == NOTIFY_STOP) 1039 == NOTIFY_STOP)
1036 ia64_mca_spin(__FUNCTION__); 1040 ia64_mca_spin(__FUNCTION__);
1037 ia64_wait_for_slaves(cpu); 1041 ia64_wait_for_slaves(cpu, "MCA");
1038 1042
1039 /* Wakeup all the processors which are spinning in the rendezvous loop. 1043 /* Wakeup all the processors which are spinning in the rendezvous loop.
1040 * They will leave SAL, then spin in the OS with interrupts disabled 1044 * They will leave SAL, then spin in the OS with interrupts disabled
@@ -1043,7 +1047,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1043 * spinning in SAL does not work. 1047 * spinning in SAL does not work.
1044 */ 1048 */
1045 ia64_mca_wakeup_all(); 1049 ia64_mca_wakeup_all();
1046 if (notify_die(DIE_MCA_MONARCH_PROCESS, "MCA", regs, 0, 0, 0) 1050 if (notify_die(DIE_MCA_MONARCH_PROCESS, "MCA", regs, (long)&nd, 0, 0)
1047 == NOTIFY_STOP) 1051 == NOTIFY_STOP)
1048 ia64_mca_spin(__FUNCTION__); 1052 ia64_mca_spin(__FUNCTION__);
1049 1053
@@ -1064,7 +1068,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1064 ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA); 1068 ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA);
1065 sos->os_status = IA64_MCA_CORRECTED; 1069 sos->os_status = IA64_MCA_CORRECTED;
1066 } 1070 }
1067 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, 0, 0, recover) 1071 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover)
1068 == NOTIFY_STOP) 1072 == NOTIFY_STOP)
1069 ia64_mca_spin(__FUNCTION__); 1073 ia64_mca_spin(__FUNCTION__);
1070 1074
@@ -1351,10 +1355,14 @@ ia64_init_handler(struct pt_regs *regs, struct switch_stack *sw,
1351 static atomic_t monarchs; 1355 static atomic_t monarchs;
1352 task_t *previous_current; 1356 task_t *previous_current;
1353 int cpu = smp_processor_id(); 1357 int cpu = smp_processor_id();
1358 struct ia64_mca_notify_die nd =
1359 { .sos = sos, .monarch_cpu = &monarch_cpu };
1354 1360
1355 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */ 1361 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */
1356 console_loglevel = 15; /* make sure printks make it to console */ 1362 console_loglevel = 15; /* make sure printks make it to console */
1357 1363
1364 (void) notify_die(DIE_INIT_ENTER, "INIT", regs, (long)&nd, 0, 0);
1365
1358 printk(KERN_INFO "Entered OS INIT handler. PSP=%lx cpu=%d monarch=%ld\n", 1366 printk(KERN_INFO "Entered OS INIT handler. PSP=%lx cpu=%d monarch=%ld\n",
1359 sos->proc_state_param, cpu, sos->monarch); 1367 sos->proc_state_param, cpu, sos->monarch);
1360 salinfo_log_wakeup(SAL_INFO_TYPE_INIT, NULL, 0, 0); 1368 salinfo_log_wakeup(SAL_INFO_TYPE_INIT, NULL, 0, 0);
@@ -1390,15 +1398,15 @@ ia64_init_handler(struct pt_regs *regs, struct switch_stack *sw,
1390 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_INIT; 1398 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_INIT;
1391 while (monarch_cpu == -1) 1399 while (monarch_cpu == -1)
1392 cpu_relax(); /* spin until monarch enters */ 1400 cpu_relax(); /* spin until monarch enters */
1393 if (notify_die(DIE_INIT_SLAVE_ENTER, "INIT", regs, 0, 0, 0) 1401 if (notify_die(DIE_INIT_SLAVE_ENTER, "INIT", regs, (long)&nd, 0, 0)
1394 == NOTIFY_STOP) 1402 == NOTIFY_STOP)
1395 ia64_mca_spin(__FUNCTION__); 1403 ia64_mca_spin(__FUNCTION__);
1396 if (notify_die(DIE_INIT_SLAVE_PROCESS, "INIT", regs, 0, 0, 0) 1404 if (notify_die(DIE_INIT_SLAVE_PROCESS, "INIT", regs, (long)&nd, 0, 0)
1397 == NOTIFY_STOP) 1405 == NOTIFY_STOP)
1398 ia64_mca_spin(__FUNCTION__); 1406 ia64_mca_spin(__FUNCTION__);
1399 while (monarch_cpu != -1) 1407 while (monarch_cpu != -1)
1400 cpu_relax(); /* spin until monarch leaves */ 1408 cpu_relax(); /* spin until monarch leaves */
1401 if (notify_die(DIE_INIT_SLAVE_LEAVE, "INIT", regs, 0, 0, 0) 1409 if (notify_die(DIE_INIT_SLAVE_LEAVE, "INIT", regs, (long)&nd, 0, 0)
1402 == NOTIFY_STOP) 1410 == NOTIFY_STOP)
1403 ia64_mca_spin(__FUNCTION__); 1411 ia64_mca_spin(__FUNCTION__);
1404 printk("Slave on cpu %d returning to normal service.\n", cpu); 1412 printk("Slave on cpu %d returning to normal service.\n", cpu);
@@ -1409,7 +1417,7 @@ ia64_init_handler(struct pt_regs *regs, struct switch_stack *sw,
1409 } 1417 }
1410 1418
1411 monarch_cpu = cpu; 1419 monarch_cpu = cpu;
1412 if (notify_die(DIE_INIT_MONARCH_ENTER, "INIT", regs, 0, 0, 0) 1420 if (notify_die(DIE_INIT_MONARCH_ENTER, "INIT", regs, (long)&nd, 0, 0)
1413 == NOTIFY_STOP) 1421 == NOTIFY_STOP)
1414 ia64_mca_spin(__FUNCTION__); 1422 ia64_mca_spin(__FUNCTION__);
1415 1423
@@ -1421,15 +1429,15 @@ ia64_init_handler(struct pt_regs *regs, struct switch_stack *sw,
1421 */ 1429 */
1422 printk("Delaying for 5 seconds...\n"); 1430 printk("Delaying for 5 seconds...\n");
1423 udelay(5*1000000); 1431 udelay(5*1000000);
1424 ia64_wait_for_slaves(cpu); 1432 ia64_wait_for_slaves(cpu, "INIT");
1425 /* If nobody intercepts DIE_INIT_MONARCH_PROCESS then we drop through 1433 /* If nobody intercepts DIE_INIT_MONARCH_PROCESS then we drop through
1426 * to default_monarch_init_process() above and just print all the 1434 * to default_monarch_init_process() above and just print all the
1427 * tasks. 1435 * tasks.
1428 */ 1436 */
1429 if (notify_die(DIE_INIT_MONARCH_PROCESS, "INIT", regs, 0, 0, 0) 1437 if (notify_die(DIE_INIT_MONARCH_PROCESS, "INIT", regs, (long)&nd, 0, 0)
1430 == NOTIFY_STOP) 1438 == NOTIFY_STOP)
1431 ia64_mca_spin(__FUNCTION__); 1439 ia64_mca_spin(__FUNCTION__);
1432 if (notify_die(DIE_INIT_MONARCH_LEAVE, "INIT", regs, 0, 0, 0) 1440 if (notify_die(DIE_INIT_MONARCH_LEAVE, "INIT", regs, (long)&nd, 0, 0)
1433 == NOTIFY_STOP) 1441 == NOTIFY_STOP)
1434 ia64_mca_spin(__FUNCTION__); 1442 ia64_mca_spin(__FUNCTION__);
1435 printk("\nINIT dump complete. Monarch on cpu %d returning to normal service.\n", cpu); 1443 printk("\nINIT dump complete. Monarch on cpu %d returning to normal service.\n", cpu);
@@ -1631,6 +1639,7 @@ ia64_mca_init(void)
1631 printk(KERN_INFO "Increasing MCA rendezvous timeout from " 1639 printk(KERN_INFO "Increasing MCA rendezvous timeout from "
1632 "%ld to %ld milliseconds\n", timeout, isrv.v0); 1640 "%ld to %ld milliseconds\n", timeout, isrv.v0);
1633 timeout = isrv.v0; 1641 timeout = isrv.v0;
1642 (void) notify_die(DIE_MCA_NEW_TIMEOUT, "MCA", NULL, timeout, 0, 0);
1634 continue; 1643 continue;
1635 } 1644 }
1636 printk(KERN_ERR "Failed to register rendezvous interrupt " 1645 printk(KERN_ERR "Failed to register rendezvous interrupt "
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index 60a464bfd9e2..6dff024cd62b 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -827,7 +827,7 @@ ia64_state_restore:
827 ld8 r9=[temp2],16 // sal_gp 827 ld8 r9=[temp2],16 // sal_gp
828 ;; 828 ;;
829 ld8 r22=[temp1],16 // pal_min_state, virtual 829 ld8 r22=[temp1],16 // pal_min_state, virtual
830 ld8 r21=[temp2],16 // prev_IA64_KR_CURRENT 830 ld8 r13=[temp2],16 // prev_IA64_KR_CURRENT
831 ;; 831 ;;
832 ld8 r16=[temp1],16 // prev_IA64_KR_CURRENT_STACK 832 ld8 r16=[temp1],16 // prev_IA64_KR_CURRENT_STACK
833 ld8 r20=[temp2],16 // prev_task 833 ld8 r20=[temp2],16 // prev_task
@@ -848,7 +848,7 @@ ia64_state_restore:
848 mov cr.iim=temp3 848 mov cr.iim=temp3
849 mov cr.iha=temp4 849 mov cr.iha=temp4
850 dep r22=0,r22,62,1 // pal_min_state, physical, uncached 850 dep r22=0,r22,62,1 // pal_min_state, physical, uncached
851 mov IA64_KR(CURRENT)=r21 851 mov IA64_KR(CURRENT)=r13
852 ld8 r8=[temp1] // os_status 852 ld8 r8=[temp1] // os_status
853 ld8 r10=[temp2] // context 853 ld8 r10=[temp2] // context
854 854
@@ -856,7 +856,7 @@ ia64_state_restore:
856 * avoid any dependencies on the algorithm in ia64_switch_to(), just 856 * avoid any dependencies on the algorithm in ia64_switch_to(), just
857 * purge any existing CURRENT_STACK mapping and insert the new one. 857 * purge any existing CURRENT_STACK mapping and insert the new one.
858 * 858 *
859 * r16 contains prev_IA64_KR_CURRENT_STACK, r21 contains 859 * r16 contains prev_IA64_KR_CURRENT_STACK, r13 contains
860 * prev_IA64_KR_CURRENT, these values may have been changed by the C 860 * prev_IA64_KR_CURRENT, these values may have been changed by the C
861 * code. Do not use r8, r9, r10, r22, they contain values ready for 861 * code. Do not use r8, r9, r10, r22, they contain values ready for
862 * the return to SAL. 862 * the return to SAL.
@@ -873,7 +873,7 @@ ia64_state_restore:
873 ;; 873 ;;
874 srlz.d 874 srlz.d
875 875
876 extr.u r19=r21,61,3 // r21 = prev_IA64_KR_CURRENT 876 extr.u r19=r13,61,3 // r13 = prev_IA64_KR_CURRENT
877 shl r20=r16,IA64_GRANULE_SHIFT // r16 = prev_IA64_KR_CURRENT_STACK 877 shl r20=r16,IA64_GRANULE_SHIFT // r16 = prev_IA64_KR_CURRENT_STACK
878 movl r21=PAGE_KERNEL // page properties 878 movl r21=PAGE_KERNEL // page properties
879 ;; 879 ;;
@@ -883,7 +883,7 @@ ia64_state_restore:
883(p6) br.spnt 1f // the dreaded cpu 0 idle task in region 5:( 883(p6) br.spnt 1f // the dreaded cpu 0 idle task in region 5:(
884 ;; 884 ;;
885 mov cr.itir=r18 885 mov cr.itir=r18
886 mov cr.ifa=r21 886 mov cr.ifa=r13
887 mov r20=IA64_TR_CURRENT_STACK 887 mov r20=IA64_TR_CURRENT_STACK
888 ;; 888 ;;
889 itr.d dtr[r20]=r21 889 itr.d dtr[r20]=r21
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 7a2f0a798d12..3a30cfc9574f 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -947,7 +947,7 @@ void
947percpu_modcopy (void *pcpudst, const void *src, unsigned long size) 947percpu_modcopy (void *pcpudst, const void *src, unsigned long size)
948{ 948{
949 unsigned int i; 949 unsigned int i;
950 for_each_cpu(i) { 950 for_each_possible_cpu(i) {
951 memcpy(pcpudst + __per_cpu_offset[i], src, size); 951 memcpy(pcpudst + __per_cpu_offset[i], src, size);
952 } 952 }
953} 953}
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index ec9eeb89975d..b6bcc9fa3603 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -519,6 +519,68 @@ void __cpuinit *per_cpu_init(void)
519} 519}
520#endif /* CONFIG_SMP */ 520#endif /* CONFIG_SMP */
521 521
522#ifdef CONFIG_VIRTUAL_MEM_MAP
523static inline int find_next_valid_pfn_for_pgdat(pg_data_t *pgdat, int i)
524{
525 unsigned long end_address, hole_next_pfn;
526 unsigned long stop_address;
527
528 end_address = (unsigned long) &vmem_map[pgdat->node_start_pfn + i];
529 end_address = PAGE_ALIGN(end_address);
530
531 stop_address = (unsigned long) &vmem_map[
532 pgdat->node_start_pfn + pgdat->node_spanned_pages];
533
534 do {
535 pgd_t *pgd;
536 pud_t *pud;
537 pmd_t *pmd;
538 pte_t *pte;
539
540 pgd = pgd_offset_k(end_address);
541 if (pgd_none(*pgd)) {
542 end_address += PGDIR_SIZE;
543 continue;
544 }
545
546 pud = pud_offset(pgd, end_address);
547 if (pud_none(*pud)) {
548 end_address += PUD_SIZE;
549 continue;
550 }
551
552 pmd = pmd_offset(pud, end_address);
553 if (pmd_none(*pmd)) {
554 end_address += PMD_SIZE;
555 continue;
556 }
557
558 pte = pte_offset_kernel(pmd, end_address);
559retry_pte:
560 if (pte_none(*pte)) {
561 end_address += PAGE_SIZE;
562 pte++;
563 if ((end_address < stop_address) &&
564 (end_address != ALIGN(end_address, 1UL << PMD_SHIFT)))
565 goto retry_pte;
566 continue;
567 }
568 /* Found next valid vmem_map page */
569 break;
570 } while (end_address < stop_address);
571
572 end_address = min(end_address, stop_address);
573 end_address = end_address - (unsigned long) vmem_map + sizeof(struct page) - 1;
574 hole_next_pfn = end_address / sizeof(struct page);
575 return hole_next_pfn - pgdat->node_start_pfn;
576}
577#else
578static inline int find_next_valid_pfn_for_pgdat(pg_data_t *pgdat, int i)
579{
580 return i + 1;
581}
582#endif
583
522/** 584/**
523 * show_mem - give short summary of memory stats 585 * show_mem - give short summary of memory stats
524 * 586 *
@@ -547,8 +609,10 @@ void show_mem(void)
547 struct page *page; 609 struct page *page;
548 if (pfn_valid(pgdat->node_start_pfn + i)) 610 if (pfn_valid(pgdat->node_start_pfn + i))
549 page = pfn_to_page(pgdat->node_start_pfn + i); 611 page = pfn_to_page(pgdat->node_start_pfn + i);
550 else 612 else {
613 i = find_next_valid_pfn_for_pgdat(pgdat, i) - 1;
551 continue; 614 continue;
615 }
552 if (PageReserved(page)) 616 if (PageReserved(page))
553 reserved++; 617 reserved++;
554 else if (PageSwapCache(page)) 618 else if (PageSwapCache(page))
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index af7eb087dca7..d98ec49570b8 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -60,6 +60,9 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
60 struct siginfo si; 60 struct siginfo si;
61 unsigned long mask; 61 unsigned long mask;
62 62
63 /* mmap_sem is performance critical.... */
64 prefetchw(&mm->mmap_sem);
65
63 /* 66 /*
64 * If we're in an interrupt or have no user context, we must not take the fault.. 67 * If we're in an interrupt or have no user context, we must not take the fault..
65 */ 68 */
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index d0abddd9ffe6..8255a9be4632 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -1831,7 +1831,7 @@ xpc_initiate_allocate(partid_t partid, int ch_number, u32 flags, void **payload)
1831{ 1831{
1832 struct xpc_partition *part = &xpc_partitions[partid]; 1832 struct xpc_partition *part = &xpc_partitions[partid];
1833 enum xpc_retval ret = xpcUnknownReason; 1833 enum xpc_retval ret = xpcUnknownReason;
1834 struct xpc_msg *msg; 1834 struct xpc_msg *msg = NULL;
1835 1835
1836 1836
1837 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 1837 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 05c864c6c2d9..41fd490af3b4 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -285,6 +285,11 @@ config NUMA
285 depends on SMP && BROKEN 285 depends on SMP && BROKEN
286 default n 286 default n
287 287
288config NODES_SHIFT
289 int
290 default "1"
291 depends on NEED_MULTIPLE_NODES
292
288# turning this on wastes a bunch of space. 293# turning this on wastes a bunch of space.
289# Summit needs it only when NUMA is on 294# Summit needs it only when NUMA is on
290config BOOT_IOREMAP 295config BOOT_IOREMAP
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S
index 3871b65f0c82..920bb742b7a2 100644
--- a/arch/m32r/kernel/entry.S
+++ b/arch/m32r/kernel/entry.S
@@ -20,7 +20,7 @@
20 * Stack layout in 'ret_from_system_call': 20 * Stack layout in 'ret_from_system_call':
21 * ptrace needs to have all regs on the stack. 21 * ptrace needs to have all regs on the stack.
22 * if the order here is changed, it needs to be 22 * if the order here is changed, it needs to be
23 * updated in fork.c:copy_process, signal.c:do_signal, 23 * updated in fork.c:copy_thread, signal.c:do_signal,
24 * ptrace.c and ptrace.h 24 * ptrace.c and ptrace.h
25 * 25 *
26 * M32Rx/M32R2 M32R 26 * M32Rx/M32R2 M32R
@@ -41,18 +41,17 @@
41 * @(0x38,sp) - syscall_nr ditto 41 * @(0x38,sp) - syscall_nr ditto
42 * @(0x3c,sp) - acc0h @(0x3c,sp) - acch 42 * @(0x3c,sp) - acc0h @(0x3c,sp) - acch
43 * @(0x40,sp) - acc0l @(0x40,sp) - accl 43 * @(0x40,sp) - acc0l @(0x40,sp) - accl
44 * @(0x44,sp) - acc1h @(0x44,sp) - psw 44 * @(0x44,sp) - acc1h @(0x44,sp) - dummy_acc1h
45 * @(0x48,sp) - acc1l @(0x48,sp) - bpc 45 * @(0x48,sp) - acc1l @(0x48,sp) - dummy_acc1l
46 * @(0x4c,sp) - psw @(0x4c,sp) - bbpsw 46 * @(0x4c,sp) - psw ditto
47 * @(0x50,sp) - bpc @(0x50,sp) - bbpc 47 * @(0x50,sp) - bpc ditto
48 * @(0x54,sp) - bbpsw @(0x54,sp) - spu (cr3) 48 * @(0x54,sp) - bbpsw ditto
49 * @(0x58,sp) - bbpc @(0x58,sp) - fp (r13) 49 * @(0x58,sp) - bbpc ditto
50 * @(0x5c,sp) - spu (cr3) @(0x5c,sp) - lr (r14) 50 * @(0x5c,sp) - spu (cr3) ditto
51 * @(0x60,sp) - fp (r13) @(0x60,sp) - spi (cr12) 51 * @(0x60,sp) - fp (r13) ditto
52 * @(0x64,sp) - lr (r14) @(0x64,sp) - orig_r0 52 * @(0x64,sp) - lr (r14) ditto
53 * @(0x68,sp) - spi (cr2) 53 * @(0x68,sp) - spi (cr2) ditto
54 * @(0x6c,sp) - orig_r0 54 * @(0x6c,sp) - orig_r0 ditto
55 *
56 */ 55 */
57 56
58#include <linux/config.h> 57#include <linux/config.h>
@@ -102,6 +101,12 @@
102#define ACC0L(reg) @(0x40,reg) 101#define ACC0L(reg) @(0x40,reg)
103#define ACC1H(reg) @(0x44,reg) 102#define ACC1H(reg) @(0x44,reg)
104#define ACC1L(reg) @(0x48,reg) 103#define ACC1L(reg) @(0x48,reg)
104#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
105#define ACCH(reg) @(0x3C,reg)
106#define ACCL(reg) @(0x40,reg)
107#else
108#error unknown isa configuration
109#endif
105#define PSW(reg) @(0x4C,reg) 110#define PSW(reg) @(0x4C,reg)
106#define BPC(reg) @(0x50,reg) 111#define BPC(reg) @(0x50,reg)
107#define BBPSW(reg) @(0x54,reg) 112#define BBPSW(reg) @(0x54,reg)
@@ -111,21 +116,6 @@
111#define LR(reg) @(0x64,reg) 116#define LR(reg) @(0x64,reg)
112#define SP(reg) @(0x68,reg) 117#define SP(reg) @(0x68,reg)
113#define ORIG_R0(reg) @(0x6C,reg) 118#define ORIG_R0(reg) @(0x6C,reg)
114#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
115#define ACCH(reg) @(0x3C,reg)
116#define ACCL(reg) @(0x40,reg)
117#define PSW(reg) @(0x44,reg)
118#define BPC(reg) @(0x48,reg)
119#define BBPSW(reg) @(0x4C,reg)
120#define BBPC(reg) @(0x50,reg)
121#define SPU(reg) @(0x54,reg)
122#define FP(reg) @(0x58,reg) /* FP = R13 */
123#define LR(reg) @(0x5C,reg)
124#define SP(reg) @(0x60,reg)
125#define ORIG_R0(reg) @(0x64,reg)
126#else
127#error unknown isa configuration
128#endif
129 119
130CF_MASK = 0x00000001 120CF_MASK = 0x00000001
131TF_MASK = 0x00000100 121TF_MASK = 0x00000100
@@ -142,7 +132,7 @@ VM_MASK = 0x00020000
142#endif 132#endif
143 133
144ENTRY(ret_from_fork) 134ENTRY(ret_from_fork)
145 ld r0, @sp+ 135 pop r0
146 bl schedule_tail 136 bl schedule_tail
147 GET_THREAD_INFO(r8) 137 GET_THREAD_INFO(r8)
148 bra syscall_exit 138 bra syscall_exit
@@ -231,7 +221,7 @@ restore_all:
231 RESTORE_ALL 221 RESTORE_ALL
232 222
233 # perform work that needs to be done immediately before resumption 223 # perform work that needs to be done immediately before resumption
234 # r9 : frags 224 # r9 : flags
235 ALIGN 225 ALIGN
236work_pending: 226work_pending:
237 and3 r4, r9, #_TIF_NEED_RESCHED 227 and3 r4, r9, #_TIF_NEED_RESCHED
@@ -320,7 +310,7 @@ ENTRY(ei_handler)
320; GET_ICU_STATUS; 310; GET_ICU_STATUS;
321 seth r0, #shigh(M32R_ICU_ISTS_ADDR) 311 seth r0, #shigh(M32R_ICU_ISTS_ADDR)
322 ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) 312 ld r0, @(low(M32R_ICU_ISTS_ADDR),r0)
323 st r0, @-sp 313 push r0
324#if defined(CONFIG_SMP) 314#if defined(CONFIG_SMP)
325 /* 315 /*
326 * If IRQ == 0 --> Nothing to do, Not write IMASK 316 * If IRQ == 0 --> Nothing to do, Not write IMASK
@@ -557,7 +547,7 @@ check_end:
557#endif /* CONFIG_PLAT_M32104UT */ 547#endif /* CONFIG_PLAT_M32104UT */
558 bl do_IRQ 548 bl do_IRQ
559#endif /* CONFIG_SMP */ 549#endif /* CONFIG_SMP */
560 ld r14, @sp+ 550 pop r14
561 seth r0, #shigh(M32R_ICU_IMASK_ADDR) 551 seth r0, #shigh(M32R_ICU_IMASK_ADDR)
562 st r14, @(low(M32R_ICU_IMASK_ADDR),r0) 552 st r14, @(low(M32R_ICU_IMASK_ADDR),r0)
563#else 553#else
@@ -1015,4 +1005,3 @@ ENTRY(sys_call_table)
1015 .long sys_waitid 1005 .long sys_waitid
1016 1006
1017syscall_table_size=(.-sys_call_table) 1007syscall_table_size=(.-sys_call_table)
1018
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index be8b711367ec..c50330fa83b9 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -23,9 +23,6 @@ EXPORT_SYMBOL(boot_cpu_data);
23EXPORT_SYMBOL(dump_fpu); 23EXPORT_SYMBOL(dump_fpu);
24EXPORT_SYMBOL(__ioremap); 24EXPORT_SYMBOL(__ioremap);
25EXPORT_SYMBOL(iounmap); 25EXPORT_SYMBOL(iounmap);
26EXPORT_SYMBOL(enable_irq);
27EXPORT_SYMBOL(disable_irq);
28EXPORT_SYMBOL(disable_irq_nosync);
29EXPORT_SYMBOL(kernel_thread); 26EXPORT_SYMBOL(kernel_thread);
30EXPORT_SYMBOL(__down); 27EXPORT_SYMBOL(__down);
31EXPORT_SYMBOL(__down_interruptible); 28EXPORT_SYMBOL(__down_interruptible);
@@ -38,13 +35,6 @@ EXPORT_SYMBOL(__udelay);
38EXPORT_SYMBOL(__delay); 35EXPORT_SYMBOL(__delay);
39EXPORT_SYMBOL(__const_udelay); 36EXPORT_SYMBOL(__const_udelay);
40 37
41EXPORT_SYMBOL(__get_user_1);
42EXPORT_SYMBOL(__get_user_2);
43EXPORT_SYMBOL(__get_user_4);
44
45EXPORT_SYMBOL(strpbrk);
46EXPORT_SYMBOL(strstr);
47
48EXPORT_SYMBOL(strncpy_from_user); 38EXPORT_SYMBOL(strncpy_from_user);
49EXPORT_SYMBOL(__strncpy_from_user); 39EXPORT_SYMBOL(__strncpy_from_user);
50EXPORT_SYMBOL(clear_user); 40EXPORT_SYMBOL(clear_user);
@@ -59,11 +49,8 @@ extern void *dcache_dummy;
59EXPORT_SYMBOL(dcache_dummy); 49EXPORT_SYMBOL(dcache_dummy);
60#endif 50#endif
61EXPORT_SYMBOL(cpu_data); 51EXPORT_SYMBOL(cpu_data);
62EXPORT_SYMBOL(cpu_online_map);
63EXPORT_SYMBOL(cpu_callout_map);
64 52
65/* Global SMP stuff */ 53/* Global SMP stuff */
66EXPORT_SYMBOL(synchronize_irq);
67EXPORT_SYMBOL(smp_call_function); 54EXPORT_SYMBOL(smp_call_function);
68 55
69/* TLB flushing */ 56/* TLB flushing */
@@ -83,27 +70,11 @@ EXPORT_SYMBOL(__lshrdi3);
83EXPORT_SYMBOL(__muldi3); 70EXPORT_SYMBOL(__muldi3);
84 71
85/* memory and string operations */ 72/* memory and string operations */
86EXPORT_SYMBOL(memchr);
87EXPORT_SYMBOL(memcpy); 73EXPORT_SYMBOL(memcpy);
88/* EXPORT_SYMBOL(memcpy_fromio); // not implement yet */
89/* EXPORT_SYMBOL(memcpy_toio); // not implement yet */
90EXPORT_SYMBOL(memset); 74EXPORT_SYMBOL(memset);
91/* EXPORT_SYMBOL(memset_io); // not implement yet */
92EXPORT_SYMBOL(memmove);
93EXPORT_SYMBOL(memcmp);
94EXPORT_SYMBOL(memscan);
95EXPORT_SYMBOL(copy_page); 75EXPORT_SYMBOL(copy_page);
96EXPORT_SYMBOL(clear_page); 76EXPORT_SYMBOL(clear_page);
97
98EXPORT_SYMBOL(strcat);
99EXPORT_SYMBOL(strchr);
100EXPORT_SYMBOL(strcmp);
101EXPORT_SYMBOL(strcpy);
102EXPORT_SYMBOL(strlen); 77EXPORT_SYMBOL(strlen);
103EXPORT_SYMBOL(strncat);
104EXPORT_SYMBOL(strncmp);
105EXPORT_SYMBOL(strnlen);
106EXPORT_SYMBOL(strncpy);
107 78
108EXPORT_SYMBOL(_inb); 79EXPORT_SYMBOL(_inb);
109EXPORT_SYMBOL(_inw); 80EXPORT_SYMBOL(_inw);
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index 5dfc7ea45cf7..065f5e719058 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -116,6 +116,10 @@ void cpu_idle (void)
116 116
117void machine_restart(char *__unused) 117void machine_restart(char *__unused)
118{ 118{
119#if defined(CONFIG_PLAT_MAPPI3)
120 outw(1, (unsigned long)PLD_REBOOT);
121#endif
122
119 printk("Please push reset button!\n"); 123 printk("Please push reset button!\n");
120 while (1) 124 while (1)
121 cpu_relax(); 125 cpu_relax();
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index 0d78942b4c76..3cd3c2988a48 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/kernel.h>
12#include <linux/stddef.h> 13#include <linux/stddef.h>
13#include <linux/fs.h> 14#include <linux/fs.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
@@ -219,8 +220,6 @@ static unsigned long __init setup_memory(void)
219extern unsigned long setup_memory(void); 220extern unsigned long setup_memory(void);
220#endif /* CONFIG_DISCONTIGMEM */ 221#endif /* CONFIG_DISCONTIGMEM */
221 222
222#define M32R_PCC_PCATCR 0x00ef7014 /* will move to m32r.h */
223
224void __init setup_arch(char **cmdline_p) 223void __init setup_arch(char **cmdline_p)
225{ 224{
226 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 225 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
@@ -269,15 +268,14 @@ void __init setup_arch(char **cmdline_p)
269 paging_init(); 268 paging_init();
270} 269}
271 270
272static struct cpu cpu[NR_CPUS]; 271static struct cpu cpu_devices[NR_CPUS];
273 272
274static int __init topology_init(void) 273static int __init topology_init(void)
275{ 274{
276 int cpu_id; 275 int i;
277 276
278 for (cpu_id = 0; cpu_id < NR_CPUS; cpu_id++) 277 for_each_present_cpu(i)
279 if (cpu_possible(cpu_id)) 278 register_cpu(&cpu_devices[i], i, NULL);
280 register_cpu(&cpu[cpu_id], cpu_id, NULL);
281 279
282 return 0; 280 return 0;
283} 281}
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index cb33097fefc4..6498ee70bb73 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -118,6 +118,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
118#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) 118#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
119 COPY(acch); 119 COPY(acch);
120 COPY(accl); 120 COPY(accl);
121 COPY(dummy_acc1h);
122 COPY(dummy_acc1l);
121#else 123#else
122#error unknown isa configuration 124#error unknown isa configuration
123#endif 125#endif
@@ -203,6 +205,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
203#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) 205#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
204 COPY(acch); 206 COPY(acch);
205 COPY(accl); 207 COPY(accl);
208 COPY(dummy_acc1h);
209 COPY(dummy_acc1l);
206#else 210#else
207#error unknown isa configuration 211#error unknown isa configuration
208#endif 212#endif
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index d7ec16e7fb25..840b4348bf0c 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -39,8 +39,10 @@
39 * Martin J. Bligh : Added support for multi-quad systems 39 * Martin J. Bligh : Added support for multi-quad systems
40 */ 40 */
41 41
42#include <linux/module.h>
42#include <linux/config.h> 43#include <linux/config.h>
43#include <linux/init.h> 44#include <linux/init.h>
45#include <linux/kernel.h>
44#include <linux/mm.h> 46#include <linux/mm.h>
45#include <linux/smp_lock.h> 47#include <linux/smp_lock.h>
46#include <linux/irq.h> 48#include <linux/irq.h>
@@ -72,11 +74,15 @@ physid_mask_t phys_cpu_present_map;
72 74
73/* Bitmask of currently online CPUs */ 75/* Bitmask of currently online CPUs */
74cpumask_t cpu_online_map; 76cpumask_t cpu_online_map;
77EXPORT_SYMBOL(cpu_online_map);
75 78
76cpumask_t cpu_bootout_map; 79cpumask_t cpu_bootout_map;
77cpumask_t cpu_bootin_map; 80cpumask_t cpu_bootin_map;
78cpumask_t cpu_callout_map;
79static cpumask_t cpu_callin_map; 81static cpumask_t cpu_callin_map;
82cpumask_t cpu_callout_map;
83EXPORT_SYMBOL(cpu_callout_map);
84cpumask_t cpu_possible_map = CPU_MASK_ALL;
85EXPORT_SYMBOL(cpu_possible_map);
80 86
81/* Per CPU bogomips and other parameters */ 87/* Per CPU bogomips and other parameters */
82struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned; 88struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned;
@@ -110,7 +116,6 @@ static unsigned int calibration_result;
110 116
111void smp_prepare_boot_cpu(void); 117void smp_prepare_boot_cpu(void);
112void smp_prepare_cpus(unsigned int); 118void smp_prepare_cpus(unsigned int);
113static void smp_tune_scheduling(void);
114static void init_ipi_lock(void); 119static void init_ipi_lock(void);
115static void do_boot_cpu(int); 120static void do_boot_cpu(int);
116int __cpu_up(unsigned int); 121int __cpu_up(unsigned int);
@@ -177,6 +182,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
177 } 182 }
178 for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) 183 for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++)
179 physid_set(phys_id, phys_cpu_present_map); 184 physid_set(phys_id, phys_cpu_present_map);
185#ifndef CONFIG_HOTPLUG_CPU
186 cpu_present_map = cpu_possible_map;
187#endif
180 188
181 show_mp_info(nr_cpu); 189 show_mp_info(nr_cpu);
182 190
@@ -186,7 +194,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
186 * Setup boot CPU information 194 * Setup boot CPU information
187 */ 195 */
188 smp_store_cpu_info(0); /* Final full version of the data */ 196 smp_store_cpu_info(0); /* Final full version of the data */
189 smp_tune_scheduling();
190 197
191 /* 198 /*
192 * If SMP should be disabled, then really disable it! 199 * If SMP should be disabled, then really disable it!
@@ -230,11 +237,6 @@ smp_done:
230 Dprintk("Boot done.\n"); 237 Dprintk("Boot done.\n");
231} 238}
232 239
233static void __init smp_tune_scheduling(void)
234{
235 /* Nothing to do. */
236}
237
238/* 240/*
239 * init_ipi_lock : Initialize IPI locks. 241 * init_ipi_lock : Initialize IPI locks.
240 */ 242 */
@@ -629,4 +631,3 @@ static void __init unmap_cpu_to_physid(int cpu_id, int phys_id)
629 physid_2_cpu[phys_id] = -1; 631 physid_2_cpu[phys_id] = -1;
630 cpu_2_physid[cpu_id] = -1; 632 cpu_2_physid[cpu_id] = -1;
631} 633}
632
diff --git a/arch/m32r/lib/Makefile b/arch/m32r/lib/Makefile
index e632d10c7d78..d16b4e40d1ae 100644
--- a/arch/m32r/lib/Makefile
+++ b/arch/m32r/lib/Makefile
@@ -2,6 +2,6 @@
2# Makefile for M32R-specific library files.. 2# Makefile for M32R-specific library files..
3# 3#
4 4
5lib-y := checksum.o ashxdi3.o memset.o memcpy.o getuser.o \ 5lib-y := checksum.o ashxdi3.o memset.o memcpy.o \
6 putuser.o delay.o strlen.o usercopy.o csum_partial_copy.o 6 delay.o strlen.o usercopy.o csum_partial_copy.o
7 7
diff --git a/arch/m32r/lib/getuser.S b/arch/m32r/lib/getuser.S
deleted file mode 100644
index 58a0db055c5c..000000000000
--- a/arch/m32r/lib/getuser.S
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * __get_user functions.
3 *
4 * (C) Copyright 2001 Hirokazu Takata
5 *
6 * These functions have a non-standard call interface
7 * to make them more efficient, especially as they
8 * return an error value in addition to the "real"
9 * return value.
10 */
11
12#include <linux/config.h>
13
14/*
15 * __get_user_X
16 *
17 * Inputs: r0 contains the address
18 *
19 * Outputs: r0 is error code (0 or -EFAULT)
20 * r1 contains zero-extended value
21 *
22 * These functions should not modify any other registers,
23 * as they get called from within inline assembly.
24 */
25
26#ifdef CONFIG_ISA_DUAL_ISSUE
27
28 .text
29 .balign 4
30 .globl __get_user_1
31__get_user_1:
321: ldub r1, @r0 || ldi r0, #0
33 jmp r14
34
35 .balign 4
36 .globl __get_user_2
37__get_user_2:
382: lduh r1, @r0 || ldi r0, #0
39 jmp r14
40
41 .balign 4
42 .globl __get_user_4
43__get_user_4:
443: ld r1, @r0 || ldi r0, #0
45 jmp r14
46
47bad_get_user:
48 ldi r1, #0 || ldi r0, #-14
49 jmp r14
50
51#else /* not CONFIG_ISA_DUAL_ISSUE */
52
53 .text
54 .balign 4
55 .globl __get_user_1
56__get_user_1:
571: ldub r1, @r0
58 ldi r0, #0
59 jmp r14
60
61 .balign 4
62 .globl __get_user_2
63__get_user_2:
642: lduh r1, @r0
65 ldi r0, #0
66 jmp r14
67
68 .balign 4
69 .globl __get_user_4
70__get_user_4:
713: ld r1, @r0
72 ldi r0, #0
73 jmp r14
74
75bad_get_user:
76 ldi r1, #0
77 ldi r0, #-14
78 jmp r14
79
80#endif /* not CONFIG_ISA_DUAL_ISSUE */
81
82.section __ex_table,"a"
83 .long 1b,bad_get_user
84 .long 2b,bad_get_user
85 .long 3b,bad_get_user
86.previous
87
88 .end
diff --git a/arch/m32r/lib/putuser.S b/arch/m32r/lib/putuser.S
deleted file mode 100644
index 218154cc3890..000000000000
--- a/arch/m32r/lib/putuser.S
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * __put_user functions.
3 *
4 * (C) Copyright 1998 Linus Torvalds
5 * (C) Copyright 2001 Hirokazu Takata
6 *
7 * These functions have a non-standard call interface
8 * to make them more efficient.
9 */
10
11#include <linux/config.h>
12
13/*
14 * __put_user_X
15 *
16 * Inputs: r0 contains the address
17 * r1 contains the value
18 *
19 * Outputs: r0 is error code (0 or -EFAULT)
20 * r1 is corrupted (will contain "current_task").
21 *
22 * These functions should not modify any other registers,
23 * as they get called from within inline assembly.
24 */
25
26#ifdef CONFIG_ISA_DUAL_ISSUE
27
28 .text
29 .balign 4
30 .globl __put_user_1
31__put_user_1:
321: stb r1, @r0 || ldi r0, #0
33 jmp r14
34
35 .balign 4
36 .globl __put_user_2
37__put_user_2:
382: sth r1, @r0 || ldi r0, #0
39 jmp r14
40
41 .balign 4
42 .globl __put_user_4
43__put_user_4:
443: st r1, @r0 || ldi r0, #0
45 jmp r14
46
47bad_put_user:
48 ldi r0, #-14 || jmp r14
49
50#else /* not CONFIG_ISA_DUAL_ISSUE */
51
52 .text
53 .balign 4
54 .globl __put_user_1
55__put_user_1:
561: stb r1, @r0
57 ldi r0, #0
58 jmp r14
59
60 .balign 4
61 .globl __put_user_2
62__put_user_2:
632: sth r1, @r0
64 ldi r0, #0
65 jmp r14
66
67 .balign 4
68 .globl __put_user_4
69__put_user_4:
703: st r1, @r0
71 ldi r0, #0
72 jmp r14
73
74bad_put_user:
75 ldi r0, #-14
76 jmp r14
77
78#endif /* not CONFIG_ISA_DUAL_ISSUE */
79
80.section __ex_table,"a"
81 .long 1b,bad_put_user
82 .long 2b,bad_put_user
83 .long 3b,bad_put_user
84.previous
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
index c3319514a85e..5b7952ea2bae 100644
--- a/arch/m68k/kernel/m68k_ksyms.c
+++ b/arch/m68k/kernel/m68k_ksyms.c
@@ -57,7 +57,6 @@ EXPORT_SYMBOL(dump_thread);
57EXPORT_SYMBOL(strnlen); 57EXPORT_SYMBOL(strnlen);
58EXPORT_SYMBOL(strrchr); 58EXPORT_SYMBOL(strrchr);
59EXPORT_SYMBOL(strstr); 59EXPORT_SYMBOL(strstr);
60EXPORT_SYMBOL(strpbrk);
61EXPORT_SYMBOL(enable_irq); 60EXPORT_SYMBOL(enable_irq);
62EXPORT_SYMBOL(disable_irq); 61EXPORT_SYMBOL(disable_irq);
63EXPORT_SYMBOL(kernel_thread); 62EXPORT_SYMBOL(kernel_thread);
diff --git a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c
index f9b4ea16c099..4320d5dcc9cb 100644
--- a/arch/m68knommu/kernel/m68k_ksyms.c
+++ b/arch/m68knommu/kernel/m68k_ksyms.c
@@ -26,7 +26,6 @@ EXPORT_SYMBOL(__ioremap);
26EXPORT_SYMBOL(iounmap); 26EXPORT_SYMBOL(iounmap);
27EXPORT_SYMBOL(dump_fpu); 27EXPORT_SYMBOL(dump_fpu);
28EXPORT_SYMBOL(strnlen); 28EXPORT_SYMBOL(strnlen);
29EXPORT_SYMBOL(strpbrk);
30EXPORT_SYMBOL(strrchr); 29EXPORT_SYMBOL(strrchr);
31EXPORT_SYMBOL(strstr); 30EXPORT_SYMBOL(strstr);
32EXPORT_SYMBOL(strchr); 31EXPORT_SYMBOL(strchr);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e15709ce8866..87f0b79c6b15 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -816,6 +816,10 @@ config GENERIC_CALIBRATE_DELAY
816 bool 816 bool
817 default y 817 default y
818 818
819config SCHED_NO_NO_OMIT_FRAME_POINTER
820 bool
821 default y
822
819# 823#
820# Select some configuration options automatically based on user selections. 824# Select some configuration options automatically based on user selections.
821# 825#
@@ -1443,6 +1447,10 @@ choice
1443 prompt "MIPS MT options" 1447 prompt "MIPS MT options"
1444 depends on MIPS_MT 1448 depends on MIPS_MT
1445 1449
1450config MIPS_MT_SMTC
1451 bool "SMTC: Use all TCs on all VPEs for SMP"
1452 select SMP
1453
1446config MIPS_MT_SMP 1454config MIPS_MT_SMP
1447 bool "Use 1 TC on each available VPE for SMP" 1455 bool "Use 1 TC on each available VPE for SMP"
1448 select SMP 1456 select SMP
@@ -1456,6 +1464,11 @@ config MIPS_VPE_LOADER
1456 1464
1457endchoice 1465endchoice
1458 1466
1467config MIPS_MT_FPAFF
1468 bool "Dynamic FPU affinity for FP-intensive threads"
1469 depends on MIPS_MT
1470 default y
1471
1459config MIPS_VPE_LOADER_TOM 1472config MIPS_VPE_LOADER_TOM
1460 bool "Load VPE program into memory hidden from linux" 1473 bool "Load VPE program into memory hidden from linux"
1461 depends on MIPS_VPE_LOADER 1474 depends on MIPS_VPE_LOADER
@@ -1472,6 +1485,16 @@ config MIPS_VPE_APSP_API
1472 depends on MIPS_VPE_LOADER 1485 depends on MIPS_VPE_LOADER
1473 help 1486 help
1474 1487
1488config MIPS_APSP_KSPD
1489 bool "Enable KSPD"
1490 depends on MIPS_VPE_APSP_API
1491 default y
1492 help
1493 KSPD is a kernel daemon that accepts syscall requests from the SP
1494 side, actions them and returns the results. It also handles the
1495 "exit" syscall notifying other kernel modules the SP program is
1496 exiting. You probably want to say yes here.
1497
1475config SB1_PASS_1_WORKAROUNDS 1498config SB1_PASS_1_WORKAROUNDS
1476 bool 1499 bool
1477 depends on CPU_SB1_PASS_1 1500 depends on CPU_SB1_PASS_1
@@ -1590,11 +1613,16 @@ config ARCH_FLATMEM_ENABLE
1590 def_bool y 1613 def_bool y
1591 depends on !NUMA 1614 depends on !NUMA
1592 1615
1616config NODES_SHIFT
1617 int
1618 default "6"
1619 depends on NEED_MULTIPLE_NODES
1620
1593source "mm/Kconfig" 1621source "mm/Kconfig"
1594 1622
1595config SMP 1623config SMP
1596 bool "Multi-Processing support" 1624 bool "Multi-Processing support"
1597 depends on CPU_RM9000 || ((SIBYTE_BCM1x80 || SIBYTE_BCM1x55 || SIBYTE_SB1250 || QEMU) && !SIBYTE_STANDALONE) || SGI_IP27 || MIPS_MT_SMP 1625 depends on CPU_RM9000 || ((SIBYTE_BCM1x80 || SIBYTE_BCM1x55 || SIBYTE_SB1250 || QEMU) && !SIBYTE_STANDALONE) || SGI_IP27 || MIPS_MT_SMP || MIPS_MT_SMTC
1598 ---help--- 1626 ---help---
1599 This enables support for systems with more than one CPU. If you have 1627 This enables support for systems with more than one CPU. If you have
1600 a system with only one CPU, like most personal computers, say N. If 1628 a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 9a69e0f0ab76..69b9c1b8fafc 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -105,18 +105,18 @@ cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
105cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap 105cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap
106cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap 106cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
107cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap 107cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
108cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips2 -mtune=r4600) \ 108cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
109 -Wa,-mips32 -Wa,--trap 109 -Wa,-mips32 -Wa,--trap
110cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips2 -mtune=r4600) \ 110cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
111 -Wa,-mips32r2 -Wa,--trap 111 -Wa,-mips32r2 -Wa,--trap
112cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips2 -mtune=r4600) \ 112cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
113 -Wa,-mips64 -Wa,--trap 113 -Wa,-mips64 -Wa,--trap
114cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips2 -mtune=r4600 ) \ 114cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
115 -Wa,-mips64r2 -Wa,--trap 115 -Wa,-mips64r2 -Wa,--trap
116cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap 116cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
117cflags-$(CONFIG_CPU_R5432) += $(call cc-options,-march=r5400,-march=r5000) \ 117cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \
118 -Wa,--trap 118 -Wa,--trap
119cflags-$(CONFIG_CPU_NEVADA) += $(call cc-options,-march=rm5200,-march=r5000) \ 119cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
120 -Wa,--trap 120 -Wa,--trap
121cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 121cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
122 -Wa,--trap 122 -Wa,--trap
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index a1edfd1f643c..bf682f50b859 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -6,7 +6,7 @@
6# Makefile for the Alchemy Au1000 CPU, generic files. 6# Makefile for the Alchemy Au1000 CPU, generic files.
7# 7#
8 8
9obj-y += prom.o int-handler.o irq.o puts.o time.o reset.o \ 9obj-y += prom.o irq.o puts.o time.o reset.o \
10 au1xxx_irqmap.o clocks.o platform.o power.o setup.o \ 10 au1xxx_irqmap.o clocks.o platform.o power.o setup.o \
11 sleeper.o cputable.o dma.o dbdma.o gpio.o 11 sleeper.o cputable.o dma.o dbdma.o gpio.o
12 12
diff --git a/arch/mips/au1000/common/int-handler.S b/arch/mips/au1000/common/int-handler.S
deleted file mode 100644
index 1c4ca883321e..000000000000
--- a/arch/mips/au1000/common/int-handler.S
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: ppopov@mvista.com
4 *
5 * Interrupt dispatcher for Au1000 boards.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18 .text
19 .set macro
20 .set noat
21 .align 5
22
23NESTED(au1000_IRQ, PT_SIZE, sp)
24 SAVE_ALL
25 CLI # Important: mark KERNEL mode !
26
27 mfc0 t0,CP0_CAUSE # get pending interrupts
28 mfc0 t1,CP0_STATUS # get enabled interrupts
29 and t0,t1 # isolate allowed ones
30
31 andi t0,0xff00 # isolate pending bits
32 beqz t0, 3f # spurious interrupt
33
34 andi a0, t0, CAUSEF_IP7
35 beq a0, zero, 1f
36 move a0, sp
37 jal mips_timer_interrupt
38 j ret_from_irq
39
401:
41 andi a0, t0, CAUSEF_IP2 # Interrupt Controller 0, Request 0
42 beq a0, zero, 2f
43 move a0,sp
44 jal intc0_req0_irqdispatch
45 j ret_from_irq
462:
47 andi a0, t0, CAUSEF_IP3 # Interrupt Controller 0, Request 1
48 beq a0, zero, 3f
49 move a0,sp
50 jal intc0_req1_irqdispatch
51 j ret_from_irq
523:
53 andi a0, t0, CAUSEF_IP4 # Interrupt Controller 1, Request 0
54 beq a0, zero, 4f
55 move a0,sp
56 jal intc1_req0_irqdispatch
57 j ret_from_irq
584:
59 andi a0, t0, CAUSEF_IP5 # Interrupt Controller 1, Request 1
60 beq a0, zero, 5f
61 move a0, sp
62 jal intc1_req1_irqdispatch
63 j ret_from_irq
64
655:
66 move a0, sp
67 j spurious_interrupt
68END(au1000_IRQ)
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index 1339a0979f66..da61de776154 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -66,7 +66,6 @@
66#define EXT_INTC1_REQ1 5 /* IP 5 */ 66#define EXT_INTC1_REQ1 5 /* IP 5 */
67#define MIPS_TIMER_IP 7 /* IP 7 */ 67#define MIPS_TIMER_IP 7 /* IP 7 */
68 68
69extern asmlinkage void au1000_IRQ(void);
70extern void set_debug_traps(void); 69extern void set_debug_traps(void);
71extern irq_cpustat_t irq_stat [NR_CPUS]; 70extern irq_cpustat_t irq_stat [NR_CPUS];
72 71
@@ -446,7 +445,6 @@ void __init arch_init_irq(void)
446 extern int au1xxx_ic0_nr_irqs; 445 extern int au1xxx_ic0_nr_irqs;
447 446
448 cp0_status = read_c0_status(); 447 cp0_status = read_c0_status();
449 set_except_vector(0, au1000_IRQ);
450 448
451 /* Initialize interrupt controllers to a safe state. 449 /* Initialize interrupt controllers to a safe state.
452 */ 450 */
@@ -661,3 +659,21 @@ restore_au1xxx_intctl(void)
661 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync(); 659 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
662} 660}
663#endif /* CONFIG_PM */ 661#endif /* CONFIG_PM */
662
663asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
664{
665 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
666
667 if (pending & CAUSEF_IP7)
668 mips_timer_interrupt(regs);
669 else if (pending & CAUSEF_IP2)
670 intc0_req0_irqdispatch(regs);
671 else if (pending & CAUSEF_IP3)
672 intc0_req1_irqdispatch(regs);
673 else if (pending & CAUSEF_IP4)
674 intc1_req0_irqdispatch(regs);
675 else if (pending & CAUSEF_IP5)
676 intc1_req1_irqdispatch(regs);
677 else
678 spurious_interrupt(regs);
679}
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index 720e757b2b64..225ac8f34ccd 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Cobalt micro systems family specific parts of the kernel 2# Makefile for the Cobalt micro systems family specific parts of the kernel
3# 3#
4 4
5obj-y := irq.o int-handler.o reset.o setup.o 5obj-y := irq.o reset.o setup.o
6 6
7obj-$(CONFIG_EARLY_PRINTK) += console.o 7obj-$(CONFIG_EARLY_PRINTK) += console.o
8 8
diff --git a/arch/mips/cobalt/int-handler.S b/arch/mips/cobalt/int-handler.S
deleted file mode 100644
index e75d5e3ca868..000000000000
--- a/arch/mips/cobalt/int-handler.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle
7 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/mach-cobalt/cobalt.h>
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14
15 .text
16 .align 5
17 NESTED(cobalt_handle_int, PT_SIZE, sp)
18 SAVE_ALL
19 CLI
20
21 PTR_LA ra, ret_from_irq
22 move a0, sp
23 j cobalt_irq
24
25 END(cobalt_handle_int)
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index f9a108820d6e..0b75f4fb7195 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -20,8 +20,6 @@
20 20
21#include <asm/mach-cobalt/cobalt.h> 21#include <asm/mach-cobalt/cobalt.h>
22 22
23extern void cobalt_handle_int(void);
24
25/* 23/*
26 * We have two types of interrupts that we handle, ones that come in through 24 * We have two types of interrupts that we handle, ones that come in through
27 * the CPU interrupt lines, and ones that come in on the via chip. The CPU 25 * the CPU interrupt lines, and ones that come in on the via chip. The CPU
@@ -79,7 +77,7 @@ static inline void via_pic_irq(struct pt_regs *regs)
79 do_IRQ(irq, regs); 77 do_IRQ(irq, regs);
80} 78}
81 79
82asmlinkage void cobalt_irq(struct pt_regs *regs) 80asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
83{ 81{
84 unsigned pending; 82 unsigned pending;
85 83
@@ -122,8 +120,6 @@ void __init arch_init_irq(void)
122 */ 120 */
123 GALILEO_OUTL(0, GT_INTRMASK_OFS); 121 GALILEO_OUTL(0, GT_INTRMASK_OFS);
124 122
125 set_except_vector(0, cobalt_handle_int);
126
127 init_i8259_irqs(); /* 0 ... 15 */ 123 init_i8259_irqs(); /* 0 ... 15 */
128 mips_cpu_irq_init(COBALT_CPU_IRQ); /* 16 ... 23 */ 124 mips_cpu_irq_init(COBALT_CPU_IRQ); /* 16 ... 23 */
129 125
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
new file mode 100644
index 000000000000..8a1e3ace0b2c
--- /dev/null
+++ b/arch/mips/configs/tb0287_defconfig
@@ -0,0 +1,1096 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16
4# Wed Mar 22 11:07:34 2006
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MIPS_MTX1 is not set
12# CONFIG_MIPS_BOSPORUS is not set
13# CONFIG_MIPS_PB1000 is not set
14# CONFIG_MIPS_PB1100 is not set
15# CONFIG_MIPS_PB1500 is not set
16# CONFIG_MIPS_PB1550 is not set
17# CONFIG_MIPS_PB1200 is not set
18# CONFIG_MIPS_DB1000 is not set
19# CONFIG_MIPS_DB1100 is not set
20# CONFIG_MIPS_DB1500 is not set
21# CONFIG_MIPS_DB1550 is not set
22# CONFIG_MIPS_DB1200 is not set
23# CONFIG_MIPS_MIRAGE is not set
24# CONFIG_MIPS_COBALT is not set
25# CONFIG_MACH_DECSTATION is not set
26# CONFIG_MIPS_EV64120 is not set
27# CONFIG_MIPS_EV96100 is not set
28# CONFIG_MIPS_IVR is not set
29# CONFIG_MIPS_ITE8172 is not set
30# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set
33# CONFIG_MIPS_MALTA is not set
34# CONFIG_MIPS_SEAD is not set
35# CONFIG_MIPS_SIM is not set
36# CONFIG_MOMENCO_JAGUAR_ATX is not set
37# CONFIG_MOMENCO_OCELOT is not set
38# CONFIG_MOMENCO_OCELOT_3 is not set
39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set
44# CONFIG_DDB5074 is not set
45# CONFIG_DDB5476 is not set
46# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set
49# CONFIG_QEMU is not set
50# CONFIG_SGI_IP22 is not set
51# CONFIG_SGI_IP27 is not set
52# CONFIG_SGI_IP32 is not set
53# CONFIG_SIBYTE_BIGSUR is not set
54# CONFIG_SIBYTE_SWARM is not set
55# CONFIG_SIBYTE_SENTOSA is not set
56# CONFIG_SIBYTE_RHONE is not set
57# CONFIG_SIBYTE_CARMEL is not set
58# CONFIG_SIBYTE_PTSWARM is not set
59# CONFIG_SIBYTE_LITTLESUR is not set
60# CONFIG_SIBYTE_CRHINE is not set
61# CONFIG_SIBYTE_CRHONE is not set
62# CONFIG_SNI_RM200_PCI is not set
63# CONFIG_TOSHIBA_JMR3927 is not set
64# CONFIG_TOSHIBA_RBTX4927 is not set
65# CONFIG_TOSHIBA_RBTX4938 is not set
66# CONFIG_CASIO_E55 is not set
67# CONFIG_IBM_WORKPAD is not set
68# CONFIG_NEC_CMBVR4133 is not set
69CONFIG_TANBAC_TB022X=y
70# CONFIG_TANBAC_TB0226 is not set
71CONFIG_TANBAC_TB0287=y
72# CONFIG_VICTOR_MPC30X is not set
73# CONFIG_ZAO_CAPCELLA is not set
74CONFIG_PCI_VR41XX=y
75# CONFIG_VRC4173 is not set
76CONFIG_RWSEM_GENERIC_SPINLOCK=y
77CONFIG_GENERIC_CALIBRATE_DELAY=y
78CONFIG_DMA_NONCOHERENT=y
79CONFIG_DMA_NEED_PCI_MAP_STATE=y
80# CONFIG_CPU_BIG_ENDIAN is not set
81CONFIG_CPU_LITTLE_ENDIAN=y
82CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
83CONFIG_IRQ_CPU=y
84CONFIG_MIPS_L1_CACHE_SHIFT=5
85
86#
87# CPU selection
88#
89# CONFIG_CPU_MIPS32_R1 is not set
90# CONFIG_CPU_MIPS32_R2 is not set
91# CONFIG_CPU_MIPS64_R1 is not set
92# CONFIG_CPU_MIPS64_R2 is not set
93# CONFIG_CPU_R3000 is not set
94# CONFIG_CPU_TX39XX is not set
95CONFIG_CPU_VR41XX=y
96# CONFIG_CPU_R4300 is not set
97# CONFIG_CPU_R4X00 is not set
98# CONFIG_CPU_TX49XX is not set
99# CONFIG_CPU_R5000 is not set
100# CONFIG_CPU_R5432 is not set
101# CONFIG_CPU_R6000 is not set
102# CONFIG_CPU_NEVADA is not set
103# CONFIG_CPU_R8000 is not set
104# CONFIG_CPU_R10000 is not set
105# CONFIG_CPU_RM7000 is not set
106# CONFIG_CPU_RM9000 is not set
107# CONFIG_CPU_SB1 is not set
108CONFIG_SYS_HAS_CPU_VR41XX=y
109CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
110CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
111CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
112CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
113
114#
115# Kernel type
116#
117CONFIG_32BIT=y
118# CONFIG_64BIT is not set
119CONFIG_PAGE_SIZE_4KB=y
120# CONFIG_PAGE_SIZE_8KB is not set
121# CONFIG_PAGE_SIZE_16KB is not set
122# CONFIG_PAGE_SIZE_64KB is not set
123# CONFIG_MIPS_MT is not set
124# CONFIG_CPU_ADVANCED is not set
125CONFIG_CPU_HAS_SYNC=y
126CONFIG_GENERIC_HARDIRQS=y
127CONFIG_GENERIC_IRQ_PROBE=y
128CONFIG_ARCH_FLATMEM_ENABLE=y
129CONFIG_SELECT_MEMORY_MODEL=y
130CONFIG_FLATMEM_MANUAL=y
131# CONFIG_DISCONTIGMEM_MANUAL is not set
132# CONFIG_SPARSEMEM_MANUAL is not set
133CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4
137CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set
140
141#
142# Code maturity level options
143#
144CONFIG_EXPERIMENTAL=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156# CONFIG_BSD_PROCESS_ACCT is not set
157CONFIG_SYSCTL=y
158# CONFIG_AUDIT is not set
159# CONFIG_IKCONFIG is not set
160CONFIG_INITRAMFS_SOURCE=""
161# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
162CONFIG_EMBEDDED=y
163CONFIG_KALLSYMS=y
164# CONFIG_KALLSYMS_EXTRA_PASS is not set
165# CONFIG_HOTPLUG is not set
166CONFIG_PRINTK=y
167CONFIG_BUG=y
168CONFIG_ELF_CORE=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172CONFIG_SHMEM=y
173CONFIG_CC_ALIGN_FUNCTIONS=0
174CONFIG_CC_ALIGN_LABELS=0
175CONFIG_CC_ALIGN_LOOPS=0
176CONFIG_CC_ALIGN_JUMPS=0
177CONFIG_SLAB=y
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180# CONFIG_SLOB is not set
181
182#
183# Loadable module support
184#
185CONFIG_MODULES=y
186CONFIG_MODULE_UNLOAD=y
187# CONFIG_MODULE_FORCE_UNLOAD is not set
188CONFIG_OBSOLETE_MODPARM=y
189CONFIG_MODVERSIONS=y
190CONFIG_MODULE_SRCVERSION_ALL=y
191CONFIG_KMOD=y
192
193#
194# Block layer
195#
196# CONFIG_LBD is not set
197
198#
199# IO Schedulers
200#
201CONFIG_IOSCHED_NOOP=y
202CONFIG_IOSCHED_AS=y
203CONFIG_IOSCHED_DEADLINE=y
204CONFIG_IOSCHED_CFQ=y
205CONFIG_DEFAULT_AS=y
206# CONFIG_DEFAULT_DEADLINE is not set
207# CONFIG_DEFAULT_CFQ is not set
208# CONFIG_DEFAULT_NOOP is not set
209CONFIG_DEFAULT_IOSCHED="anticipatory"
210
211#
212# Bus options (PCI, PCMCIA, EISA, ISA, TC)
213#
214CONFIG_HW_HAS_PCI=y
215CONFIG_PCI=y
216# CONFIG_PCI_LEGACY_PROC is not set
217CONFIG_MMU=y
218
219#
220# PCCARD (PCMCIA/CardBus) support
221#
222# CONFIG_PCCARD is not set
223
224#
225# PCI Hotplug Support
226#
227# CONFIG_HOTPLUG_PCI is not set
228
229#
230# Executable file formats
231#
232CONFIG_BINFMT_ELF=y
233# CONFIG_BINFMT_MISC is not set
234CONFIG_TRAD_SIGNALS=y
235
236#
237# Networking
238#
239CONFIG_NET=y
240
241#
242# Networking options
243#
244# CONFIG_NETDEBUG is not set
245CONFIG_PACKET=y
246# CONFIG_PACKET_MMAP is not set
247CONFIG_UNIX=y
248CONFIG_XFRM=y
249CONFIG_XFRM_USER=m
250# CONFIG_NET_KEY is not set
251CONFIG_INET=y
252CONFIG_IP_MULTICAST=y
253CONFIG_IP_ADVANCED_ROUTER=y
254CONFIG_ASK_IP_FIB_HASH=y
255# CONFIG_IP_FIB_TRIE is not set
256CONFIG_IP_FIB_HASH=y
257CONFIG_IP_MULTIPLE_TABLES=y
258CONFIG_IP_ROUTE_MULTIPATH=y
259# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
260CONFIG_IP_ROUTE_VERBOSE=y
261CONFIG_IP_PNP=y
262# CONFIG_IP_PNP_DHCP is not set
263CONFIG_IP_PNP_BOOTP=y
264# CONFIG_IP_PNP_RARP is not set
265CONFIG_NET_IPIP=m
266CONFIG_NET_IPGRE=m
267# CONFIG_NET_IPGRE_BROADCAST is not set
268# CONFIG_IP_MROUTE is not set
269# CONFIG_ARPD is not set
270CONFIG_SYN_COOKIES=y
271# CONFIG_INET_AH is not set
272# CONFIG_INET_ESP is not set
273# CONFIG_INET_IPCOMP is not set
274CONFIG_INET_TUNNEL=m
275CONFIG_INET_DIAG=y
276CONFIG_INET_TCP_DIAG=y
277CONFIG_TCP_CONG_ADVANCED=y
278
279#
280# TCP congestion control
281#
282CONFIG_TCP_CONG_BIC=y
283CONFIG_TCP_CONG_CUBIC=m
284CONFIG_TCP_CONG_WESTWOOD=m
285CONFIG_TCP_CONG_HTCP=m
286# CONFIG_TCP_CONG_HSTCP is not set
287# CONFIG_TCP_CONG_HYBLA is not set
288# CONFIG_TCP_CONG_VEGAS is not set
289# CONFIG_TCP_CONG_SCALABLE is not set
290# CONFIG_IPV6 is not set
291# CONFIG_NETFILTER is not set
292
293#
294# DCCP Configuration (EXPERIMENTAL)
295#
296# CONFIG_IP_DCCP is not set
297
298#
299# SCTP Configuration (EXPERIMENTAL)
300#
301# CONFIG_IP_SCTP is not set
302
303#
304# TIPC Configuration (EXPERIMENTAL)
305#
306# CONFIG_TIPC is not set
307# CONFIG_ATM is not set
308# CONFIG_BRIDGE is not set
309# CONFIG_VLAN_8021Q is not set
310# CONFIG_DECNET is not set
311# CONFIG_LLC2 is not set
312# CONFIG_IPX is not set
313# CONFIG_ATALK is not set
314# CONFIG_X25 is not set
315# CONFIG_LAPB is not set
316# CONFIG_NET_DIVERT is not set
317# CONFIG_ECONET is not set
318# CONFIG_WAN_ROUTER is not set
319
320#
321# QoS and/or fair queueing
322#
323# CONFIG_NET_SCHED is not set
324
325#
326# Network testing
327#
328# CONFIG_NET_PKTGEN is not set
329# CONFIG_HAMRADIO is not set
330# CONFIG_IRDA is not set
331# CONFIG_BT is not set
332# CONFIG_IEEE80211 is not set
333
334#
335# Device Drivers
336#
337
338#
339# Generic Driver Options
340#
341CONFIG_STANDALONE=y
342CONFIG_PREVENT_FIRMWARE_BUILD=y
343# CONFIG_FW_LOADER is not set
344
345#
346# Connector - unified userspace <-> kernelspace linker
347#
348# CONFIG_CONNECTOR is not set
349
350#
351# Memory Technology Devices (MTD)
352#
353# CONFIG_MTD is not set
354
355#
356# Parallel port support
357#
358# CONFIG_PARPORT is not set
359
360#
361# Plug and Play support
362#
363
364#
365# Block devices
366#
367# CONFIG_BLK_CPQ_DA is not set
368# CONFIG_BLK_CPQ_CISS_DA is not set
369# CONFIG_BLK_DEV_DAC960 is not set
370# CONFIG_BLK_DEV_UMEM is not set
371# CONFIG_BLK_DEV_COW_COMMON is not set
372CONFIG_BLK_DEV_LOOP=m
373# CONFIG_BLK_DEV_CRYPTOLOOP is not set
374CONFIG_BLK_DEV_NBD=m
375# CONFIG_BLK_DEV_SX8 is not set
376# CONFIG_BLK_DEV_UB is not set
377CONFIG_BLK_DEV_RAM=y
378CONFIG_BLK_DEV_RAM_COUNT=16
379CONFIG_BLK_DEV_RAM_SIZE=4096
380# CONFIG_BLK_DEV_INITRD is not set
381# CONFIG_CDROM_PKTCDVD is not set
382# CONFIG_ATA_OVER_ETH is not set
383
384#
385# ATA/ATAPI/MFM/RLL support
386#
387CONFIG_IDE=y
388CONFIG_BLK_DEV_IDE=y
389
390#
391# Please see Documentation/ide.txt for help/info on IDE drives
392#
393# CONFIG_BLK_DEV_IDE_SATA is not set
394CONFIG_BLK_DEV_IDEDISK=y
395# CONFIG_IDEDISK_MULTI_MODE is not set
396# CONFIG_BLK_DEV_IDECD is not set
397# CONFIG_BLK_DEV_IDETAPE is not set
398# CONFIG_BLK_DEV_IDEFLOPPY is not set
399# CONFIG_BLK_DEV_IDESCSI is not set
400# CONFIG_IDE_TASK_IOCTL is not set
401
402#
403# IDE chipset support/bugfixes
404#
405CONFIG_IDE_GENERIC=y
406CONFIG_BLK_DEV_IDEPCI=y
407# CONFIG_IDEPCI_SHARE_IRQ is not set
408# CONFIG_BLK_DEV_OFFBOARD is not set
409# CONFIG_BLK_DEV_GENERIC is not set
410# CONFIG_BLK_DEV_OPTI621 is not set
411CONFIG_BLK_DEV_IDEDMA_PCI=y
412# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
413# CONFIG_IDEDMA_PCI_AUTO is not set
414# CONFIG_BLK_DEV_AEC62XX is not set
415# CONFIG_BLK_DEV_ALI15X3 is not set
416# CONFIG_BLK_DEV_AMD74XX is not set
417# CONFIG_BLK_DEV_CMD64X is not set
418# CONFIG_BLK_DEV_TRIFLEX is not set
419# CONFIG_BLK_DEV_CY82C693 is not set
420# CONFIG_BLK_DEV_CS5520 is not set
421# CONFIG_BLK_DEV_CS5530 is not set
422# CONFIG_BLK_DEV_HPT34X is not set
423# CONFIG_BLK_DEV_HPT366 is not set
424# CONFIG_BLK_DEV_SC1200 is not set
425# CONFIG_BLK_DEV_PIIX is not set
426# CONFIG_BLK_DEV_IT821X is not set
427# CONFIG_BLK_DEV_NS87415 is not set
428# CONFIG_BLK_DEV_PDC202XX_OLD is not set
429# CONFIG_BLK_DEV_PDC202XX_NEW is not set
430# CONFIG_BLK_DEV_SVWKS is not set
431CONFIG_BLK_DEV_SIIMAGE=y
432# CONFIG_BLK_DEV_SLC90E66 is not set
433# CONFIG_BLK_DEV_TRM290 is not set
434# CONFIG_BLK_DEV_VIA82CXXX is not set
435# CONFIG_IDE_ARM is not set
436CONFIG_BLK_DEV_IDEDMA=y
437# CONFIG_IDEDMA_IVB is not set
438# CONFIG_IDEDMA_AUTO is not set
439# CONFIG_BLK_DEV_HD is not set
440
441#
442# SCSI device support
443#
444# CONFIG_RAID_ATTRS is not set
445CONFIG_SCSI=y
446CONFIG_SCSI_PROC_FS=y
447
448#
449# SCSI support type (disk, tape, CD-ROM)
450#
451CONFIG_BLK_DEV_SD=y
452# CONFIG_CHR_DEV_ST is not set
453# CONFIG_CHR_DEV_OSST is not set
454# CONFIG_BLK_DEV_SR is not set
455# CONFIG_CHR_DEV_SG is not set
456# CONFIG_CHR_DEV_SCH is not set
457
458#
459# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
460#
461# CONFIG_SCSI_MULTI_LUN is not set
462# CONFIG_SCSI_CONSTANTS is not set
463# CONFIG_SCSI_LOGGING is not set
464
465#
466# SCSI Transport Attributes
467#
468# CONFIG_SCSI_SPI_ATTRS is not set
469# CONFIG_SCSI_FC_ATTRS is not set
470# CONFIG_SCSI_ISCSI_ATTRS is not set
471# CONFIG_SCSI_SAS_ATTRS is not set
472
473#
474# SCSI low-level drivers
475#
476# CONFIG_ISCSI_TCP is not set
477# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
478# CONFIG_SCSI_3W_9XXX is not set
479# CONFIG_SCSI_ACARD is not set
480# CONFIG_SCSI_AACRAID is not set
481# CONFIG_SCSI_AIC7XXX is not set
482# CONFIG_SCSI_AIC7XXX_OLD is not set
483# CONFIG_SCSI_AIC79XX is not set
484# CONFIG_SCSI_DPT_I2O is not set
485# CONFIG_MEGARAID_NEWGEN is not set
486# CONFIG_MEGARAID_LEGACY is not set
487# CONFIG_MEGARAID_SAS is not set
488# CONFIG_SCSI_SATA is not set
489# CONFIG_SCSI_DMX3191D is not set
490# CONFIG_SCSI_FUTURE_DOMAIN is not set
491# CONFIG_SCSI_IPS is not set
492# CONFIG_SCSI_INITIO is not set
493# CONFIG_SCSI_INIA100 is not set
494# CONFIG_SCSI_SYM53C8XX_2 is not set
495# CONFIG_SCSI_IPR is not set
496# CONFIG_SCSI_QLOGIC_FC is not set
497# CONFIG_SCSI_QLOGIC_1280 is not set
498# CONFIG_SCSI_QLA_FC is not set
499# CONFIG_SCSI_LPFC is not set
500# CONFIG_SCSI_DC395x is not set
501# CONFIG_SCSI_DC390T is not set
502# CONFIG_SCSI_NSP32 is not set
503# CONFIG_SCSI_DEBUG is not set
504
505#
506# Multi-device support (RAID and LVM)
507#
508# CONFIG_MD is not set
509
510#
511# Fusion MPT device support
512#
513# CONFIG_FUSION is not set
514# CONFIG_FUSION_SPI is not set
515# CONFIG_FUSION_FC is not set
516# CONFIG_FUSION_SAS is not set
517
518#
519# IEEE 1394 (FireWire) support
520#
521CONFIG_IEEE1394=m
522
523#
524# Subsystem Options
525#
526# CONFIG_IEEE1394_VERBOSEDEBUG is not set
527# CONFIG_IEEE1394_OUI_DB is not set
528CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
529CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
530# CONFIG_IEEE1394_EXPORT_FULL_API is not set
531
532#
533# Device Drivers
534#
535
536#
537# Texas Instruments PCILynx requires I2C
538#
539CONFIG_IEEE1394_OHCI1394=m
540
541#
542# Protocol Drivers
543#
544CONFIG_IEEE1394_VIDEO1394=m
545CONFIG_IEEE1394_SBP2=m
546# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
547CONFIG_IEEE1394_ETH1394=m
548CONFIG_IEEE1394_DV1394=m
549CONFIG_IEEE1394_RAWIO=m
550
551#
552# I2O device support
553#
554# CONFIG_I2O is not set
555
556#
557# Network device support
558#
559CONFIG_NETDEVICES=y
560CONFIG_DUMMY=m
561# CONFIG_BONDING is not set
562# CONFIG_EQUALIZER is not set
563# CONFIG_TUN is not set
564
565#
566# ARCnet devices
567#
568# CONFIG_ARCNET is not set
569
570#
571# PHY device support
572#
573# CONFIG_PHYLIB is not set
574
575#
576# Ethernet (10 or 100Mbit)
577#
578CONFIG_NET_ETHERNET=y
579CONFIG_MII=y
580# CONFIG_HAPPYMEAL is not set
581# CONFIG_SUNGEM is not set
582# CONFIG_CASSINI is not set
583# CONFIG_NET_VENDOR_3COM is not set
584# CONFIG_DM9000 is not set
585
586#
587# Tulip family network device support
588#
589# CONFIG_NET_TULIP is not set
590# CONFIG_HP100 is not set
591# CONFIG_NET_PCI is not set
592
593#
594# Ethernet (1000 Mbit)
595#
596# CONFIG_ACENIC is not set
597# CONFIG_DL2K is not set
598# CONFIG_E1000 is not set
599# CONFIG_NS83820 is not set
600# CONFIG_HAMACHI is not set
601# CONFIG_YELLOWFIN is not set
602CONFIG_R8169=y
603# CONFIG_R8169_NAPI is not set
604# CONFIG_SIS190 is not set
605# CONFIG_SKGE is not set
606# CONFIG_SKY2 is not set
607# CONFIG_SK98LIN is not set
608# CONFIG_TIGON3 is not set
609# CONFIG_BNX2 is not set
610
611#
612# Ethernet (10000 Mbit)
613#
614# CONFIG_CHELSIO_T1 is not set
615# CONFIG_IXGB is not set
616# CONFIG_S2IO is not set
617
618#
619# Token Ring devices
620#
621# CONFIG_TR is not set
622
623#
624# Wireless LAN (non-hamradio)
625#
626# CONFIG_NET_RADIO is not set
627
628#
629# Wan interfaces
630#
631# CONFIG_WAN is not set
632# CONFIG_FDDI is not set
633# CONFIG_HIPPI is not set
634# CONFIG_PPP is not set
635# CONFIG_SLIP is not set
636# CONFIG_NET_FC is not set
637# CONFIG_SHAPER is not set
638# CONFIG_NETCONSOLE is not set
639# CONFIG_NETPOLL is not set
640# CONFIG_NET_POLL_CONTROLLER is not set
641
642#
643# ISDN subsystem
644#
645# CONFIG_ISDN is not set
646
647#
648# Telephony Support
649#
650# CONFIG_PHONE is not set
651
652#
653# Input device support
654#
655CONFIG_INPUT=y
656
657#
658# Userland interfaces
659#
660# CONFIG_INPUT_MOUSEDEV is not set
661# CONFIG_INPUT_JOYDEV is not set
662# CONFIG_INPUT_TSDEV is not set
663# CONFIG_INPUT_EVDEV is not set
664# CONFIG_INPUT_EVBUG is not set
665
666#
667# Input Device Drivers
668#
669# CONFIG_INPUT_KEYBOARD is not set
670# CONFIG_INPUT_MOUSE is not set
671# CONFIG_INPUT_JOYSTICK is not set
672# CONFIG_INPUT_TOUCHSCREEN is not set
673# CONFIG_INPUT_MISC is not set
674
675#
676# Hardware I/O ports
677#
678# CONFIG_SERIO is not set
679# CONFIG_GAMEPORT is not set
680
681#
682# Character devices
683#
684CONFIG_VT=y
685CONFIG_VT_CONSOLE=y
686CONFIG_HW_CONSOLE=y
687# CONFIG_SERIAL_NONSTANDARD is not set
688
689#
690# Serial drivers
691#
692# CONFIG_SERIAL_8250 is not set
693
694#
695# Non-8250 serial port support
696#
697CONFIG_SERIAL_CORE=y
698CONFIG_SERIAL_CORE_CONSOLE=y
699CONFIG_SERIAL_VR41XX=y
700CONFIG_SERIAL_VR41XX_CONSOLE=y
701# CONFIG_SERIAL_JSM is not set
702CONFIG_UNIX98_PTYS=y
703CONFIG_LEGACY_PTYS=y
704CONFIG_LEGACY_PTY_COUNT=256
705
706#
707# IPMI
708#
709# CONFIG_IPMI_HANDLER is not set
710
711#
712# Watchdog Cards
713#
714# CONFIG_WATCHDOG is not set
715# CONFIG_RTC is not set
716# CONFIG_GEN_RTC is not set
717# CONFIG_RTC_VR41XX is not set
718# CONFIG_DTLK is not set
719# CONFIG_R3964 is not set
720# CONFIG_APPLICOM is not set
721# CONFIG_TANBAC_TB0219 is not set
722
723#
724# Ftape, the floppy tape device driver
725#
726# CONFIG_DRM is not set
727CONFIG_GPIO_VR41XX=y
728# CONFIG_RAW_DRIVER is not set
729
730#
731# TPM devices
732#
733# CONFIG_TCG_TPM is not set
734# CONFIG_TELCLOCK is not set
735
736#
737# I2C support
738#
739# CONFIG_I2C is not set
740
741#
742# SPI support
743#
744# CONFIG_SPI is not set
745# CONFIG_SPI_MASTER is not set
746
747#
748# Dallas's 1-wire bus
749#
750# CONFIG_W1 is not set
751
752#
753# Hardware Monitoring support
754#
755# CONFIG_HWMON is not set
756# CONFIG_HWMON_VID is not set
757
758#
759# Misc devices
760#
761
762#
763# Multimedia Capabilities Port drivers
764#
765
766#
767# Multimedia devices
768#
769# CONFIG_VIDEO_DEV is not set
770
771#
772# Digital Video Broadcasting Devices
773#
774# CONFIG_DVB is not set
775
776#
777# Graphics support
778#
779# CONFIG_FB is not set
780
781#
782# Console display driver support
783#
784# CONFIG_VGA_CONSOLE is not set
785CONFIG_DUMMY_CONSOLE=y
786
787#
788# Sound
789#
790# CONFIG_SOUND is not set
791
792#
793# USB support
794#
795CONFIG_USB_ARCH_HAS_HCD=y
796CONFIG_USB_ARCH_HAS_OHCI=y
797CONFIG_USB=m
798# CONFIG_USB_DEBUG is not set
799
800#
801# Miscellaneous USB options
802#
803# CONFIG_USB_DEVICEFS is not set
804# CONFIG_USB_BANDWIDTH is not set
805# CONFIG_USB_DYNAMIC_MINORS is not set
806# CONFIG_USB_OTG is not set
807
808#
809# USB Host Controller Drivers
810#
811CONFIG_USB_EHCI_HCD=m
812# CONFIG_USB_EHCI_SPLIT_ISO is not set
813# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
814# CONFIG_USB_ISP116X_HCD is not set
815CONFIG_USB_OHCI_HCD=m
816# CONFIG_USB_OHCI_BIG_ENDIAN is not set
817CONFIG_USB_OHCI_LITTLE_ENDIAN=y
818# CONFIG_USB_UHCI_HCD is not set
819# CONFIG_USB_SL811_HCD is not set
820
821#
822# USB Device Class drivers
823#
824# CONFIG_USB_ACM is not set
825# CONFIG_USB_PRINTER is not set
826
827#
828# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
829#
830
831#
832# may also be needed; see USB_STORAGE Help for more information
833#
834CONFIG_USB_STORAGE=m
835# CONFIG_USB_STORAGE_DEBUG is not set
836# CONFIG_USB_STORAGE_DATAFAB is not set
837# CONFIG_USB_STORAGE_FREECOM is not set
838# CONFIG_USB_STORAGE_ISD200 is not set
839# CONFIG_USB_STORAGE_DPCM is not set
840# CONFIG_USB_STORAGE_USBAT is not set
841# CONFIG_USB_STORAGE_SDDR09 is not set
842# CONFIG_USB_STORAGE_SDDR55 is not set
843# CONFIG_USB_STORAGE_JUMPSHOT is not set
844# CONFIG_USB_STORAGE_ALAUDA is not set
845# CONFIG_USB_LIBUSUAL is not set
846
847#
848# USB Input Devices
849#
850CONFIG_USB_HID=m
851CONFIG_USB_HIDINPUT=y
852# CONFIG_USB_HIDINPUT_POWERBOOK is not set
853# CONFIG_HID_FF is not set
854# CONFIG_USB_HIDDEV is not set
855
856#
857# USB HID Boot Protocol drivers
858#
859# CONFIG_USB_KBD is not set
860# CONFIG_USB_MOUSE is not set
861# CONFIG_USB_AIPTEK is not set
862# CONFIG_USB_WACOM is not set
863# CONFIG_USB_ACECAD is not set
864# CONFIG_USB_KBTAB is not set
865# CONFIG_USB_POWERMATE is not set
866# CONFIG_USB_MTOUCH is not set
867# CONFIG_USB_ITMTOUCH is not set
868# CONFIG_USB_EGALAX is not set
869# CONFIG_USB_YEALINK is not set
870# CONFIG_USB_XPAD is not set
871# CONFIG_USB_ATI_REMOTE is not set
872# CONFIG_USB_ATI_REMOTE2 is not set
873# CONFIG_USB_KEYSPAN_REMOTE is not set
874# CONFIG_USB_APPLETOUCH is not set
875
876#
877# USB Imaging devices
878#
879# CONFIG_USB_MDC800 is not set
880# CONFIG_USB_MICROTEK is not set
881
882#
883# USB Multimedia devices
884#
885# CONFIG_USB_DABUSB is not set
886
887#
888# Video4Linux support is needed for USB Multimedia device support
889#
890
891#
892# USB Network Adapters
893#
894# CONFIG_USB_CATC is not set
895# CONFIG_USB_KAWETH is not set
896# CONFIG_USB_PEGASUS is not set
897# CONFIG_USB_RTL8150 is not set
898# CONFIG_USB_USBNET is not set
899CONFIG_USB_MON=y
900
901#
902# USB port drivers
903#
904
905#
906# USB Serial Converter support
907#
908# CONFIG_USB_SERIAL is not set
909
910#
911# USB Miscellaneous drivers
912#
913# CONFIG_USB_EMI62 is not set
914# CONFIG_USB_EMI26 is not set
915# CONFIG_USB_AUERSWALD is not set
916# CONFIG_USB_RIO500 is not set
917# CONFIG_USB_LEGOTOWER is not set
918# CONFIG_USB_LCD is not set
919# CONFIG_USB_LED is not set
920# CONFIG_USB_CYTHERM is not set
921# CONFIG_USB_PHIDGETKIT is not set
922# CONFIG_USB_PHIDGETSERVO is not set
923# CONFIG_USB_IDMOUSE is not set
924# CONFIG_USB_SISUSBVGA is not set
925# CONFIG_USB_LD is not set
926
927#
928# USB DSL modem support
929#
930
931#
932# USB Gadget Support
933#
934# CONFIG_USB_GADGET is not set
935
936#
937# MMC/SD Card support
938#
939# CONFIG_MMC is not set
940
941#
942# InfiniBand support
943#
944# CONFIG_INFINIBAND is not set
945
946#
947# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
948#
949
950#
951# File systems
952#
953CONFIG_EXT2_FS=y
954# CONFIG_EXT2_FS_XATTR is not set
955# CONFIG_EXT2_FS_XIP is not set
956CONFIG_EXT3_FS=y
957CONFIG_EXT3_FS_XATTR=y
958# CONFIG_EXT3_FS_POSIX_ACL is not set
959# CONFIG_EXT3_FS_SECURITY is not set
960CONFIG_JBD=y
961# CONFIG_JBD_DEBUG is not set
962CONFIG_FS_MBCACHE=y
963# CONFIG_REISERFS_FS is not set
964# CONFIG_JFS_FS is not set
965# CONFIG_FS_POSIX_ACL is not set
966CONFIG_XFS_FS=y
967CONFIG_XFS_QUOTA=y
968# CONFIG_XFS_SECURITY is not set
969CONFIG_XFS_POSIX_ACL=y
970# CONFIG_XFS_RT is not set
971# CONFIG_OCFS2_FS is not set
972# CONFIG_MINIX_FS is not set
973CONFIG_ROMFS_FS=m
974CONFIG_INOTIFY=y
975# CONFIG_QUOTA is not set
976CONFIG_QUOTACTL=y
977# CONFIG_DNOTIFY is not set
978# CONFIG_AUTOFS_FS is not set
979CONFIG_AUTOFS4_FS=y
980# CONFIG_FUSE_FS is not set
981
982#
983# CD-ROM/DVD Filesystems
984#
985# CONFIG_ISO9660_FS is not set
986# CONFIG_UDF_FS is not set
987
988#
989# DOS/FAT/NT Filesystems
990#
991# CONFIG_MSDOS_FS is not set
992# CONFIG_VFAT_FS is not set
993# CONFIG_NTFS_FS is not set
994
995#
996# Pseudo filesystems
997#
998CONFIG_PROC_FS=y
999CONFIG_PROC_KCORE=y
1000CONFIG_SYSFS=y
1001CONFIG_TMPFS=y
1002# CONFIG_HUGETLB_PAGE is not set
1003CONFIG_RAMFS=y
1004# CONFIG_RELAYFS_FS is not set
1005# CONFIG_CONFIGFS_FS is not set
1006
1007#
1008# Miscellaneous filesystems
1009#
1010# CONFIG_ADFS_FS is not set
1011# CONFIG_AFFS_FS is not set
1012# CONFIG_HFS_FS is not set
1013# CONFIG_HFSPLUS_FS is not set
1014# CONFIG_BEFS_FS is not set
1015# CONFIG_BFS_FS is not set
1016# CONFIG_EFS_FS is not set
1017CONFIG_CRAMFS=m
1018# CONFIG_VXFS_FS is not set
1019# CONFIG_HPFS_FS is not set
1020# CONFIG_QNX4FS_FS is not set
1021# CONFIG_SYSV_FS is not set
1022# CONFIG_UFS_FS is not set
1023
1024#
1025# Network File Systems
1026#
1027CONFIG_NFS_FS=y
1028CONFIG_NFS_V3=y
1029# CONFIG_NFS_V3_ACL is not set
1030# CONFIG_NFS_V4 is not set
1031# CONFIG_NFS_DIRECTIO is not set
1032# CONFIG_NFSD is not set
1033CONFIG_ROOT_NFS=y
1034CONFIG_LOCKD=y
1035CONFIG_LOCKD_V4=y
1036CONFIG_NFS_COMMON=y
1037CONFIG_SUNRPC=y
1038# CONFIG_RPCSEC_GSS_KRB5 is not set
1039# CONFIG_RPCSEC_GSS_SPKM3 is not set
1040# CONFIG_SMB_FS is not set
1041# CONFIG_CIFS is not set
1042# CONFIG_NCP_FS is not set
1043# CONFIG_CODA_FS is not set
1044# CONFIG_AFS_FS is not set
1045# CONFIG_9P_FS is not set
1046
1047#
1048# Partition Types
1049#
1050# CONFIG_PARTITION_ADVANCED is not set
1051CONFIG_MSDOS_PARTITION=y
1052
1053#
1054# Native Language Support
1055#
1056# CONFIG_NLS is not set
1057
1058#
1059# Profiling support
1060#
1061# CONFIG_PROFILING is not set
1062
1063#
1064# Kernel hacking
1065#
1066# CONFIG_PRINTK_TIME is not set
1067# CONFIG_MAGIC_SYSRQ is not set
1068# CONFIG_DEBUG_KERNEL is not set
1069CONFIG_LOG_BUF_SHIFT=14
1070CONFIG_CROSSCOMPILE=y
1071CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
1072
1073#
1074# Security options
1075#
1076CONFIG_KEYS=y
1077CONFIG_KEYS_DEBUG_PROC_KEYS=y
1078# CONFIG_SECURITY is not set
1079
1080#
1081# Cryptographic options
1082#
1083# CONFIG_CRYPTO is not set
1084
1085#
1086# Hardware crypto devices
1087#
1088
1089#
1090# Library routines
1091#
1092# CONFIG_CRC_CCITT is not set
1093# CONFIG_CRC16 is not set
1094CONFIG_CRC32=y
1095# CONFIG_LIBCRC32C is not set
1096CONFIG_ZLIB_INFLATE=m
diff --git a/arch/mips/ddb5xxx/ddb5074/Makefile b/arch/mips/ddb5xxx/ddb5074/Makefile
index 488206b8d94e..304c02107b46 100644
--- a/arch/mips/ddb5xxx/ddb5074/Makefile
+++ b/arch/mips/ddb5xxx/ddb5074/Makefile
@@ -3,6 +3,6 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y += setup.o irq.o int-handler.o nile4_pic.o 6obj-y += setup.o irq.o nile4_pic.o
7 7
8EXTRA_AFLAGS := $(CFLAGS) 8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5074/int-handler.S b/arch/mips/ddb5xxx/ddb5074/int-handler.S
deleted file mode 100644
index a78644150b37..000000000000
--- a/arch/mips/ddb5xxx/ddb5074/int-handler.S
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * arch/mips/ddb5074/int-handler.S -- NEC DDB Vrc-5074 interrupt handler
3 *
4 * Based on arch/mips/sgi/kernel/indyIRQ.S
5 *
6 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
7 *
8 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
9 * Sony Software Development Center Europe (SDCE), Brussels
10 */
11#include <asm/asm.h>
12#include <asm/mipsregs.h>
13#include <asm/regdef.h>
14#include <asm/stackframe.h>
15
16/* A lot of complication here is taken away because:
17 *
18 * 1) We handle one interrupt and return, sitting in a loop and moving across
19 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
20 * common case is one pending IRQ so optimize in that direction.
21 *
22 * 2) We need not check against bits in the status register IRQ mask, that
23 * would make this routine slow as hell.
24 *
25 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
26 * between like BSD spl() brain-damage.
27 *
28 * Furthermore, the IRQs on the INDY look basically (barring software IRQs
29 * which we don't use at all) like:
30 *
31 * MIPS IRQ Source
32 * -------- ------
33 * 0 Software (ignored)
34 * 1 Software (ignored)
35 * 2 Local IRQ level zero
36 * 3 Local IRQ level one
37 * 4 8254 Timer zero
38 * 5 8254 Timer one
39 * 6 Bus Error
40 * 7 R4k timer (what we use)
41 *
42 * We handle the IRQ according to _our_ priority which is:
43 *
44 * Highest ---- R4k Timer
45 * Local IRQ zero
46 * Local IRQ one
47 * Bus Error
48 * 8254 Timer zero
49 * Lowest ---- 8254 Timer one
50 *
51 * then we just return, if multiple IRQs are pending then we will just take
52 * another exception, big deal.
53 */
54
55 .text
56 .set noreorder
57 .set noat
58 .align 5
59 NESTED(ddbIRQ, PT_SIZE, sp)
60 SAVE_ALL
61 CLI
62 .set at
63 mfc0 s0, CP0_CAUSE # get irq mask
64
65#if 1
66 mfc0 t2,CP0_STATUS # get enabled interrupts
67 and s0,t2 # isolate allowed ones
68#endif
69 /* First we check for r4k counter/timer IRQ. */
70 andi a0, s0, CAUSEF_IP2 # delay slot, check local level zero
71 beq a0, zero, 1f
72 andi a0, s0, CAUSEF_IP3 # delay slot, check local level one
73
74 /* Wheee, local level zero interrupt. */
75 jal ddb_local0_irqdispatch
76 move a0, sp # delay slot
77
78 j ret_from_irq
79 nop # delay slot
80
811:
82 beq a0, zero, 1f
83 andi a0, s0, CAUSEF_IP6 # delay slot, check bus error
84
85 /* Wheee, local level one interrupt. */
86 move a0, sp
87 jal ddb_local1_irqdispatch
88 nop
89
90 j ret_from_irq
91 nop
92
931:
94 beq a0, zero, 1f
95 nop
96
97 /* Wheee, an asynchronous bus error... */
98 move a0, sp
99 jal ddb_buserror_irq
100 nop
101
102 j ret_from_irq
103 nop
104
1051:
106 /* Here by mistake? This is possible, what can happen
107 * is that by the time we take the exception the IRQ
108 * pin goes low, so just leave if this is the case.
109 */
110 andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5)
111 beq a0, zero, 1f
112
113 /* Must be one of the 8254 timers... */
114 move a0, sp
115 jal ddb_8254timer_irq
116 nop
1171:
118 j ret_from_irq
119 nop
120 END(ddbIRQ)
diff --git a/arch/mips/ddb5xxx/ddb5074/irq.c b/arch/mips/ddb5xxx/ddb5074/irq.c
index 45088a1be414..60c087b7738c 100644
--- a/arch/mips/ddb5xxx/ddb5074/irq.c
+++ b/arch/mips/ddb5xxx/ddb5074/irq.c
@@ -21,8 +21,6 @@
21#include <asm/ddb5xxx/ddb5074.h> 21#include <asm/ddb5xxx/ddb5074.h>
22 22
23 23
24extern asmlinkage void ddbIRQ(void);
25
26static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL }; 24static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
27 25
28#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */ 26#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
@@ -90,7 +88,7 @@ static void m1543_irq_setup(void)
90 88
91} 89}
92 90
93void ddb_local0_irqdispatch(struct pt_regs *regs) 91static void ddb_local0_irqdispatch(struct pt_regs *regs)
94{ 92{
95 u32 mask; 93 u32 mask;
96 int nile4_irq; 94 int nile4_irq;
@@ -118,29 +116,41 @@ void ddb_local0_irqdispatch(struct pt_regs *regs)
118 } 116 }
119} 117}
120 118
121void ddb_local1_irqdispatch(void) 119static void ddb_local1_irqdispatch(void)
122{ 120{
123 printk("ddb_local1_irqdispatch called\n"); 121 printk("ddb_local1_irqdispatch called\n");
124} 122}
125 123
126void ddb_buserror_irq(void) 124static void ddb_buserror_irq(void)
127{ 125{
128 printk("ddb_buserror_irq called\n"); 126 printk("ddb_buserror_irq called\n");
129} 127}
130 128
131void ddb_8254timer_irq(void) 129static void ddb_8254timer_irq(void)
132{ 130{
133 printk("ddb_8254timer_irq called\n"); 131 printk("ddb_8254timer_irq called\n");
134} 132}
135 133
134asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
135{
136 unsigned int pending = read_c0_cause() & read_c0_status();
137
138 if (pending & CAUSEF_IP2)
139 ddb_local0_irqdispatch(regs);
140 else if (pending & CAUSEF_IP3)
141 ddb_local1_irqdispatch();
142 else if (pending & CAUSEF_IP6)
143 ddb_buserror_irq();
144 else if (pending & (CAUSEF_IP4 | CAUSEF_IP5))
145 ddb_8254timer_irq();
146}
147
136void __init arch_init_irq(void) 148void __init arch_init_irq(void)
137{ 149{
138 /* setup cascade interrupts */ 150 /* setup cascade interrupts */
139 setup_irq(NILE4_IRQ_BASE + NILE4_INT_INTE, &irq_cascade); 151 setup_irq(NILE4_IRQ_BASE + NILE4_INT_INTE, &irq_cascade);
140 setup_irq(CPU_IRQ_BASE + CPU_NILE4_CASCADE, &irq_cascade); 152 setup_irq(CPU_IRQ_BASE + CPU_NILE4_CASCADE, &irq_cascade);
141 153
142 set_except_vector(0, ddbIRQ);
143
144 nile4_irq_setup(NILE4_IRQ_BASE); 154 nile4_irq_setup(NILE4_IRQ_BASE);
145 m1543_irq_setup(); 155 m1543_irq_setup();
146 init_i8259_irqs(); 156 init_i8259_irqs();
diff --git a/arch/mips/ddb5xxx/ddb5476/Makefile b/arch/mips/ddb5xxx/ddb5476/Makefile
index 61eec363cb02..ab0312cb47b4 100644
--- a/arch/mips/ddb5xxx/ddb5476/Makefile
+++ b/arch/mips/ddb5xxx/ddb5476/Makefile
@@ -3,7 +3,7 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y += setup.o irq.o int-handler.o nile4_pic.o vrc5476_irq.o 6obj-y += setup.o irq.o nile4_pic.o vrc5476_irq.o
7obj-$(CONFIG_KGDB) += dbg_io.o 7obj-$(CONFIG_KGDB) += dbg_io.o
8 8
9EXTRA_AFLAGS := $(CFLAGS) 9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5476/int-handler.S b/arch/mips/ddb5xxx/ddb5476/int-handler.S
deleted file mode 100644
index 12c292e189ba..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/int-handler.S
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ddb5476
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18#include <asm/ddb5xxx/ddb5476.h>
19
20/*
21 * first level interrupt dispatcher for ocelot board -
22 * We check for the timer first, then check PCI ints A and D.
23 * Then check for serial IRQ and fall through.
24 */
25 .align 5
26 NESTED(ddb5476_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 .set noreorder
31 mfc0 t0, CP0_CAUSE
32 mfc0 t2, CP0_STATUS
33
34 and t0, t2
35
36 andi t1, t0, STATUSF_IP7 /* cpu timer */
37 bnez t1, ll_cpu_ip7
38 andi t1, t0, STATUSF_IP2 /* vrc5476 & i8259 */
39 bnez t1, ll_cpu_ip2
40 andi t1, t0, STATUSF_IP3
41 bnez t1, ll_cpu_ip3
42 andi t1, t0, STATUSF_IP4
43 bnez t1, ll_cpu_ip4
44 andi t1, t0, STATUSF_IP5
45 bnez t1, ll_cpu_ip5
46 andi t1, t0, STATUSF_IP6
47 bnez t1, ll_cpu_ip6
48 andi t1, t0, STATUSF_IP0 /* software int 0 */
49 bnez t1, ll_cpu_ip0
50 andi t1, t0, STATUSF_IP1 /* software int 1 */
51 bnez t1, ll_cpu_ip1
52 nop
53
54 .set reorder
55
56 /* wrong alarm or masked ... */
57 // j spurious_interrupt
58 move a0, sp
59 jal vrc5476_irq_dispatch
60 j ret_from_irq
61 nop
62
63 .align 5
64
65ll_cpu_ip0:
66 li a0, CPU_IRQ_BASE + 0
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70
71ll_cpu_ip1:
72 li a0, CPU_IRQ_BASE + 1
73 move a1, sp
74 jal do_IRQ
75 j ret_from_irq
76
77ll_cpu_ip2: /* jump to second-level dispatching */
78 move a0, sp
79 jal vrc5476_irq_dispatch
80 j ret_from_irq
81
82ll_cpu_ip3:
83 li a0, CPU_IRQ_BASE + 3
84 move a1, sp
85 jal do_IRQ
86 j ret_from_irq
87
88ll_cpu_ip4:
89 li a0, CPU_IRQ_BASE + 4
90 move a1, sp
91 jal do_IRQ
92 j ret_from_irq
93
94ll_cpu_ip5:
95 li a0, CPU_IRQ_BASE + 5
96 move a1, sp
97 jal do_IRQ
98 j ret_from_irq
99
100ll_cpu_ip6:
101 li a0, CPU_IRQ_BASE + 6
102 move a1, sp
103 jal do_IRQ
104 j ret_from_irq
105
106ll_cpu_ip7:
107 li a0, CPU_IRQ_BASE + 7
108 move a1, sp
109 jal do_IRQ
110 j ret_from_irq
111
112 END(ddb5476_handle_int)
diff --git a/arch/mips/ddb5xxx/ddb5476/irq.c b/arch/mips/ddb5xxx/ddb5476/irq.c
index 5388b5868c4a..7583a1f30711 100644
--- a/arch/mips/ddb5xxx/ddb5476/irq.c
+++ b/arch/mips/ddb5xxx/ddb5476/irq.c
@@ -110,11 +110,36 @@ static void nile4_irq_setup(void)
110static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL }; 110static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
111static struct irqaction irq_error = { no_action, 0, CPU_MASK_NONE, "error", NULL, NULL }; 111static struct irqaction irq_error = { no_action, 0, CPU_MASK_NONE, "error", NULL, NULL };
112 112
113extern asmlinkage void ddb5476_handle_int(void);
114extern int setup_irq(unsigned int irq, struct irqaction *irqaction); 113extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
115extern void mips_cpu_irq_init(u32 irq_base); 114extern void mips_cpu_irq_init(u32 irq_base);
116extern void vrc5476_irq_init(u32 irq_base); 115extern void vrc5476_irq_init(u32 irq_base);
117 116
117extern void vrc5476_irq_dispatch(struct pt_regs *regs);
118
119asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
120{
121 unsigned int pending = read_c0_cause() & read_c0_status();
122
123 if (pending & STATUSF_IP7)
124 do_IRQ(CPU_IRQ_BASE + 7, regs);
125 else if (pending & STATUSF_IP2)
126 vrc5476_irq_dispatch(regs);
127 else if (pending & STATUSF_IP3)
128 do_IRQ(CPU_IRQ_BASE + 3, regs);
129 else if (pending & STATUSF_IP4)
130 do_IRQ(CPU_IRQ_BASE + 4, regs);
131 else if (pending & STATUSF_IP5)
132 do_IRQ(CPU_IRQ_BASE + 5, regs);
133 else if (pending & STATUSF_IP6)
134 do_IRQ(CPU_IRQ_BASE + 6, regs);
135 else if (pending & STATUSF_IP0)
136 do_IRQ(CPU_IRQ_BASE, regs);
137 else if (pending & STATUSF_IP1)
138 do_IRQ(CPU_IRQ_BASE + 1, regs);
139
140 vrc5476_irq_dispatch(regs);
141}
142
118void __init arch_init_irq(void) 143void __init arch_init_irq(void)
119{ 144{
120 /* hardware initialization */ 145 /* hardware initialization */
@@ -137,7 +162,4 @@ void __init arch_init_irq(void)
137 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_LBRT, &irq_error); 162 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_LBRT, &irq_error);
138 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCIS, &irq_error); 163 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCIS, &irq_error);
139 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCI, &irq_error); 164 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCI, &irq_error);
140
141 /* setup the grandpa intr vector */
142 set_except_vector(0, ddb5476_handle_int);
143} 165}
diff --git a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
index f66fe5b58636..a3c5e7b18018 100644
--- a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
+++ b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
@@ -77,11 +77,9 @@ vrc5476_irq_init(u32 base)
77} 77}
78 78
79 79
80asmlinkage void 80void
81vrc5476_irq_dispatch(struct pt_regs *regs) 81vrc5476_irq_dispatch(struct pt_regs *regs)
82{ 82{
83 extern void spurious_interrupt(void);
84
85 u32 mask; 83 u32 mask;
86 int nile4_irq; 84 int nile4_irq;
87 85
@@ -107,5 +105,5 @@ vrc5476_irq_dispatch(struct pt_regs *regs)
107 return; 105 return;
108 } 106 }
109 } 107 }
110 spurious_interrupt(); 108 spurious_interrupt(regs);
111} 109}
diff --git a/arch/mips/ddb5xxx/ddb5477/Makefile b/arch/mips/ddb5xxx/ddb5477/Makefile
index b79b43c9f93b..ea68815ad17a 100644
--- a/arch/mips/ddb5xxx/ddb5477/Makefile
+++ b/arch/mips/ddb5xxx/ddb5477/Makefile
@@ -2,7 +2,7 @@
2# Makefile for NEC DDB-Vrc5477 board 2# Makefile for NEC DDB-Vrc5477 board
3# 3#
4 4
5obj-y += int-handler.o irq.o irq_5477.o setup.o lcd44780.o 5obj-y += irq.o irq_5477.o setup.o lcd44780.o
6 6
7obj-$(CONFIG_RUNTIME_DEBUG) += debug.o 7obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
8obj-$(CONFIG_KGDB) += kgdb_io.o 8obj-$(CONFIG_KGDB) += kgdb_io.o
diff --git a/arch/mips/ddb5xxx/ddb5477/int-handler.S b/arch/mips/ddb5xxx/ddb5477/int-handler.S
deleted file mode 100644
index a2502a14400e..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/int-handler.S
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ddb5477
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/ddb5xxx/ddb5477.h>
18
19/*
20 * first level interrupt dispatcher for ocelot board -
21 * We check for the timer first, then check PCI ints A and D.
22 * Then check for serial IRQ and fall through.
23 */
24 .align 5
25 NESTED(ddb5477_handle_int, PT_SIZE, sp)
26 SAVE_ALL
27 CLI
28 .set at
29 .set noreorder
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP7 /* cpu timer */
36 bnez t1, ll_cputimer_irq
37 andi t1, t0, (STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP4 | STATUSF_IP5 | STATUSF_IP6 )
38 bnez t1, ll_vrc5477_irq
39 andi t1, t0, STATUSF_IP0 /* software int 0 */
40 bnez t1, ll_cpu_ip0
41 andi t1, t0, STATUSF_IP1 /* software int 1 */
42 bnez t1, ll_cpu_ip1
43 nop
44 .set reorder
45
46 /* wrong alarm or masked ... */
47 j spurious_interrupt
48 nop
49 END(ddb5477_handle_int)
50
51 .align 5
52
53ll_vrc5477_irq:
54 move a0, sp
55 jal vrc5477_irq_dispatch
56 j ret_from_irq
57
58ll_cputimer_irq:
59 li a0, CPU_IRQ_BASE + 7
60 move a1, sp
61 jal do_IRQ
62 j ret_from_irq
63
64
65ll_cpu_ip0:
66 li a0, CPU_IRQ_BASE + 0
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70
71ll_cpu_ip1:
72 li a0, CPU_IRQ_BASE + 1
73 move a1, sp
74 jal do_IRQ
75 j ret_from_irq
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
index 9ffe1a9142ca..de433cf9fb50 100644
--- a/arch/mips/ddb5xxx/ddb5477/irq.c
+++ b/arch/mips/ddb5xxx/ddb5477/irq.c
@@ -75,7 +75,6 @@ set_pci_int_attr(u32 pci, u32 intn, u32 active, u32 trigger)
75 75
76extern void vrc5477_irq_init(u32 base); 76extern void vrc5477_irq_init(u32 base);
77extern void mips_cpu_irq_init(u32 base); 77extern void mips_cpu_irq_init(u32 base);
78extern asmlinkage void ddb5477_handle_int(void);
79extern int setup_irq(unsigned int irq, struct irqaction *irqaction); 78extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
80static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL }; 79static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
81 80
@@ -135,9 +134,6 @@ void __init arch_init_irq(void)
135 /* setup cascade interrupts */ 134 /* setup cascade interrupts */
136 setup_irq(VRC5477_IRQ_BASE + VRC5477_I8259_CASCADE, &irq_cascade); 135 setup_irq(VRC5477_IRQ_BASE + VRC5477_I8259_CASCADE, &irq_cascade);
137 setup_irq(CPU_IRQ_BASE + CPU_VRC5477_CASCADE, &irq_cascade); 136 setup_irq(CPU_IRQ_BASE + CPU_VRC5477_CASCADE, &irq_cascade);
138
139 /* hook up the first-level interrupt handler */
140 set_except_vector(0, ddb5477_handle_int);
141} 137}
142 138
143u8 i8259_interrupt_ack(void) 139u8 i8259_interrupt_ack(void)
@@ -159,7 +155,7 @@ u8 i8259_interrupt_ack(void)
159 * the first level int-handler will jump here if it is a vrc5477 irq 155 * the first level int-handler will jump here if it is a vrc5477 irq
160 */ 156 */
161#define NUM_5477_IRQS 32 157#define NUM_5477_IRQS 32
162asmlinkage void 158static void
163vrc5477_irq_dispatch(struct pt_regs *regs) 159vrc5477_irq_dispatch(struct pt_regs *regs)
164{ 160{
165 u32 intStatus; 161 u32 intStatus;
@@ -197,3 +193,21 @@ vrc5477_irq_dispatch(struct pt_regs *regs)
197 } 193 }
198 } 194 }
199} 195}
196
197#define VR5477INTS (STATUSF_IP2|STATUSF_IP3|STATUSF_IP4|STATUSF_IP5|STATUSF_IP6)
198
199asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
200{
201 unsigned int pending = read_c0_cause() & read_c0_status();
202
203 if (pending & STATUSF_IP7)
204 do_IRQ(CPU_IRQ_BASE + 7, regs);
205 else if (pending & VR5477INTS)
206 vrc5477_irq_dispatch(regs);
207 else if (pending & STATUSF_IP0)
208 do_IRQ(CPU_IRQ_BASE, regs);
209 else if (pending & STATUSF_IP1)
210 do_IRQ(CPU_IRQ_BASE + 1, regs);
211 else
212 spurious_interrupt(regs);
213}
diff --git a/arch/mips/dec/boot/decstation.c b/arch/mips/dec/boot/decstation.c
index 56fd4277555e..4db8bacaf22d 100644
--- a/arch/mips/dec/boot/decstation.c
+++ b/arch/mips/dec/boot/decstation.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * arch/mips/dec/decstation.c 2 * arch/mips/dec/decstation.c
3 */ 3 */
4#include <asm/sections.h>
4 5
5#define RELOC 6#define RELOC
6#define INITRD 7#define INITRD
@@ -24,7 +25,7 @@
24#define INITRD_START (*(unsigned long *) (PARAM+0x218)) 25#define INITRD_START (*(unsigned long *) (PARAM+0x218))
25#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c)) 26#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
26 27
27extern int _ftext, _end; /* begin and end of kernel image */ 28extern int _ftext; /* begin and end of kernel image */
28extern void kernel_entry(int, char **, unsigned long, int *); 29extern void kernel_entry(int, char **, unsigned long, int *);
29 30
30void * memcpy(void * dest, const void *src, unsigned int count) 31void * memcpy(void * dest, const void *src, unsigned int count)
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S
index 41fa372007bf..e8ec93e33fe6 100644
--- a/arch/mips/dec/int-handler.S
+++ b/arch/mips/dec/int-handler.S
@@ -36,7 +36,7 @@
36 .text 36 .text
37 .set noreorder 37 .set noreorder
38/* 38/*
39 * decstation_handle_int: Interrupt handler for DECstations 39 * plat_irq_dispatch: Interrupt handler for DECstations
40 * 40 *
41 * We follow the model in the Indy interrupt code by David Miller, where he 41 * We follow the model in the Indy interrupt code by David Miller, where he
42 * says: a lot of complication here is taken away because: 42 * says: a lot of complication here is taken away because:
@@ -125,11 +125,7 @@
125 * just take another exception, big deal. 125 * just take another exception, big deal.
126 */ 126 */
127 .align 5 127 .align 5
128 NESTED(decstation_handle_int, PT_SIZE, ra) 128 NESTED(plat_irq_dispatch, PT_SIZE, ra)
129 .set noat
130 SAVE_ALL
131 CLI # TEST: interrupts should be off
132 .set at
133 .set noreorder 129 .set noreorder
134 130
135 /* 131 /*
@@ -282,9 +278,11 @@ fpu:
282#endif 278#endif
283 279
284spurious: 280spurious:
285 j spurious_interrupt 281 jal spurious_interrupt
286 nop 282 nop
287 END(decstation_handle_int) 283 j ret_from_irq
284 nop
285 END(plat_irq_dispatch)
288 286
289/* 287/*
290 * Generic unimplemented interrupt routines -- cpu_mask_nr_tbl 288 * Generic unimplemented interrupt routines -- cpu_mask_nr_tbl
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index 7c1ca8f6330e..ad5d436d80c1 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -48,8 +48,6 @@ extern void dec_machine_halt(void);
48extern void dec_machine_power_off(void); 48extern void dec_machine_power_off(void);
49extern irqreturn_t dec_intr_halt(int irq, void *dev_id, struct pt_regs *regs); 49extern irqreturn_t dec_intr_halt(int irq, void *dev_id, struct pt_regs *regs);
50 50
51extern asmlinkage void decstation_handle_int(void);
52
53unsigned long dec_kn_slot_base, dec_kn_slot_size; 51unsigned long dec_kn_slot_base, dec_kn_slot_size;
54 52
55EXPORT_SYMBOL(dec_kn_slot_base); 53EXPORT_SYMBOL(dec_kn_slot_base);
@@ -744,7 +742,6 @@ void __init arch_init_irq(void)
744 panic("Don't know how to set this up!"); 742 panic("Don't know how to set this up!");
745 break; 743 break;
746 } 744 }
747 set_except_vector(0, decstation_handle_int);
748 745
749 /* Free the FPU interrupt if the exception is present. */ 746 /* Free the FPU interrupt if the exception is present. */
750 if (!cpu_has_nofpuex) { 747 if (!cpu_has_nofpuex) {
diff --git a/arch/mips/galileo-boards/ev96100/Makefile b/arch/mips/galileo-boards/ev96100/Makefile
index 58c02f9db69d..cd868ec78cbc 100644
--- a/arch/mips/galileo-boards/ev96100/Makefile
+++ b/arch/mips/galileo-boards/ev96100/Makefile
@@ -6,4 +6,4 @@
6# Makefile for the Galileo EV96100 board. 6# Makefile for the Galileo EV96100 board.
7# 7#
8 8
9obj-y += init.o irq.o puts.o reset.o time.o int-handler.o setup.o 9obj-y += init.o irq.o puts.o reset.o time.o setup.o
diff --git a/arch/mips/galileo-boards/ev96100/int-handler.S b/arch/mips/galileo-boards/ev96100/int-handler.S
deleted file mode 100644
index ff4d10a38859..000000000000
--- a/arch/mips/galileo-boards/ev96100/int-handler.S
+++ /dev/null
@@ -1,33 +0,0 @@
1#include <asm/asm.h>
2#include <asm/mipsregs.h>
3#include <asm/regdef.h>
4#include <asm/stackframe.h>
5
6 .set noat
7 .align 5
8
9NESTED(ev96100IRQ, PT_SIZE, sp)
10 SAVE_ALL
11 CLI # Important: mark KERNEL mode !
12
13 mfc0 t0, CP0_CAUSE # get pending interrupts
14 mfc0 t1, CP0_STATUS # get enabled interrupts
15 and t0, t1 # isolate allowed ones
16
17 # FIX ME add R7000 extensions
18 andi t0,0xff00 # isolate pending bits
19 andi a0, t0, CAUSEF_IP7
20 beq a0, zero, 1f
21 move a0, sp
22 jal mips_timer_interrupt
23 j ret_from_irq
24
251: beqz t0, 3f # spurious interrupt
26
27 move a0, t0
28 move a1, sp
29 jal ev96100_cpu_irq
30 j ret_from_irq
31
323: j spurious_interrupt
33 END(ev96100IRQ)
diff --git a/arch/mips/galileo-boards/ev96100/irq.c b/arch/mips/galileo-boards/ev96100/irq.c
index 97bf094da4fe..ee5d6720f23b 100644
--- a/arch/mips/galileo-boards/ev96100/irq.c
+++ b/arch/mips/galileo-boards/ev96100/irq.c
@@ -40,8 +40,6 @@
40#include <linux/interrupt.h> 40#include <linux/interrupt.h>
41#include <asm/irq_cpu.h> 41#include <asm/irq_cpu.h>
42 42
43extern asmlinkage void ev96100IRQ(void);
44
45static inline unsigned int ffz8(unsigned int word) 43static inline unsigned int ffz8(unsigned int word)
46{ 44{
47 unsigned long k; 45 unsigned long k;
@@ -54,13 +52,26 @@ static inline unsigned int ffz8(unsigned int word)
54 return k; 52 return k;
55} 53}
56 54
57asmlinkage void ev96100_cpu_irq(unsigned int pendin) 55extern void mips_timer_interrupt(struct pt_regs *regs);
56
57asmlinkage void ev96100_cpu_irq(unsigned int pending, struct pt_regs *regs)
58{ 58{
59 do_IRQ(ffz8(pending >> 8), regs); 59 do_IRQ(ffz8(pending >> 8), regs);
60} 60}
61 61
62asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
63{
64 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
65
66 if (pending & CAUSEF_IP7)
67 mips_timer_interrupt(regs);
68 else if (pending)
69 ev96100_cpu_irq(pending, regs);
70 else
71 spurious_interrupt(regs);
72}
73
62void __init arch_init_irq(void) 74void __init arch_init_irq(void)
63{ 75{
64 set_except_vector(0, ev96100IRQ);
65 mips_cpu_irq_init(0); 76 mips_cpu_irq_init(0);
66} 77}
diff --git a/arch/mips/gt64120/ev64120/Makefile b/arch/mips/gt64120/ev64120/Makefile
index ebe91c57e173..b2c53a8f8718 100644
--- a/arch/mips/gt64120/ev64120/Makefile
+++ b/arch/mips/gt64120/ev64120/Makefile
@@ -6,6 +6,6 @@
6# Makefile for the Galileo EV64120 board. 6# Makefile for the Galileo EV64120 board.
7# 7#
8 8
9obj-y += int-handler.o irq.o promcon.o reset.o serialGT.o setup.o 9obj-y += irq.o promcon.o reset.o serialGT.o setup.o
10 10
11EXTRA_AFLAGS := $(CFLAGS) 11EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/gt64120/ev64120/int-handler.S b/arch/mips/gt64120/ev64120/int-handler.S
deleted file mode 100644
index 752435faf2de..000000000000
--- a/arch/mips/gt64120/ev64120/int-handler.S
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * int-handler.S
3 *
4 * Based on the cobalt handler.
5 */
6#include <asm/asm.h>
7#include <asm/mipsregs.h>
8#include <asm/addrspace.h>
9#include <asm/regdef.h>
10#include <asm/stackframe.h>
11
12/*
13 * galileo_handle_int -
14 * We check for the timer first, then check PCI ints A and D.
15 * Then check for serial IRQ and fall through.
16 */
17 .align 5
18 .set reorder
19 .set noat
20 NESTED(galileo_handle_int, PT_SIZE, sp)
21 SAVE_ALL
22 CLI
23 .set at
24 mfc0 t0,CP0_CAUSE
25 mfc0 t2,CP0_STATUS
26
27 and t0,t2
28
29 andi t1,t0,STATUSF_IP4 /* int2 hardware line (timer) */
30 bnez t1,ll_gt64120_irq
31 andi t1,t0,STATUSF_IP2 /* int0 hardware line */
32 bnez t1,ll_pci_intA
33 andi t1,t0,STATUSF_IP5 /* int3 hardware line */
34 bnez t1,ll_pci_intD
35 andi t1,t0,STATUSF_IP6 /* int4 hardware line */
36 bnez t1,ll_serial_irq
37 andi t1,t0,STATUSF_IP7 /* compare int */
38 bnez t1,ll_compare_irq
39 nop
40
41 /* wrong alarm or masked ... */
42 j spurious_interrupt
43 nop
44 END(galileo_handle_int)
45
46
47 .align 5
48 .set reorder
49ll_gt64120_irq:
50 li a0,4
51 move a1,sp
52 jal do_IRQ
53 nop
54 j ret_from_irq
55 nop
56
57 .align 5
58 .set reorder
59ll_compare_irq:
60 li a0,7
61 move a1,sp
62 jal do_IRQ
63 nop
64 j ret_from_irq
65 nop
66
67 .align 5
68 .set reorder
69ll_pci_intA:
70 move a0,sp
71 jal pci_intA
72 nop
73 j ret_from_irq
74 nop
75
76#if 0
77 .align 5
78 .set reorder
79ll_pci_intB:
80 move a0,sp
81 jal pci_intB
82 nop
83 j ret_from_irq
84 nop
85
86 .align 5
87 .set reorder
88ll_pci_intC:
89 move a0,sp
90 jal pci_intC
91 nop
92 j ret_from_irq
93 nop
94#endif
95
96 .align 5
97 .set reorder
98ll_pci_intD:
99 move a0,sp
100 jal pci_intD
101 nop
102 j ret_from_irq
103 nop
104
105 .align 5
106 .set reorder
107ll_serial_irq:
108 li a0,6
109 move a1,sp
110 jal do_IRQ
111 nop
112 j ret_from_irq
113 nop
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
index 3b186159b21a..46c468b26b30 100644
--- a/arch/mips/gt64120/ev64120/irq.c
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -46,14 +46,22 @@
46#include <asm/system.h> 46#include <asm/system.h>
47#include <asm/gt64120.h> 47#include <asm/gt64120.h>
48 48
49asmlinkage inline void pci_intA(struct pt_regs *regs) 49asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
50{ 50{
51 do_IRQ(GT_INTA, regs); 51 unsigned int pending = read_c0_status() & read_c0_cause();
52} 52
53 53 if (pending & STATUSF_IP4) /* int2 hardware line (timer) */
54asmlinkage inline void pci_intD(struct pt_regs *regs) 54 do_IRQ(4, regs);
55{ 55 else if (pending & STATUSF_IP2) /* int0 hardware line */
56 do_IRQ(GT_INTD, regs); 56 do_IRQ(GT_INTA, regs);
57 else if (pending & STATUSF_IP5) /* int3 hardware line */
58 do_IRQ(GT_INTD, regs);
59 else if (pending & STATUSF_IP6) /* int4 hardware line */
60 do_IRQ(6, regs);
61 else if (pending & STATUSF_IP7) /* compare int */
62 do_IRQ(7, regs);
63 else
64 spurious_interrupt(regs);
57} 65}
58 66
59static void disable_ev64120_irq(unsigned int irq_nr) 67static void disable_ev64120_irq(unsigned int irq_nr)
@@ -109,16 +117,11 @@ static struct hw_interrupt_type ev64120_irq_type = {
109 117
110void gt64120_irq_setup(void) 118void gt64120_irq_setup(void)
111{ 119{
112 extern asmlinkage void galileo_handle_int(void);
113
114 /* 120 /*
115 * Clear all of the interrupts while we change the able around a bit. 121 * Clear all of the interrupts while we change the able around a bit.
116 */ 122 */
117 clear_c0_status(ST0_IM); 123 clear_c0_status(ST0_IM);
118 124
119 /* Sets the exception_handler array. */
120 set_except_vector(0, galileo_handle_int);
121
122 local_irq_disable(); 125 local_irq_disable();
123 126
124 /* 127 /*
diff --git a/arch/mips/gt64120/momenco_ocelot/Makefile b/arch/mips/gt64120/momenco_ocelot/Makefile
index 7b59c6567c79..6f708df8373b 100644
--- a/arch/mips/gt64120/momenco_ocelot/Makefile
+++ b/arch/mips/gt64120/momenco_ocelot/Makefile
@@ -2,7 +2,7 @@
2# Makefile for Momentum's Ocelot board. 2# Makefile for Momentum's Ocelot board.
3# 3#
4 4
5obj-y += int-handler.o irq.o prom.o reset.o setup.o 5obj-y += irq.o prom.o reset.o setup.o
6 6
7obj-$(CONFIG_KGDB) += dbg_io.o 7obj-$(CONFIG_KGDB) += dbg_io.o
8 8
diff --git a/arch/mips/gt64120/momenco_ocelot/int-handler.S b/arch/mips/gt64120/momenco_ocelot/int-handler.S
deleted file mode 100644
index 808acef248cc..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/int-handler.S
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ocelot board.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18/*
19 * first level interrupt dispatcher for ocelot board -
20 * We check for the timer first, then check PCI ints A and D.
21 * Then check for serial IRQ and fall through.
22 */
23 .align 5
24 NESTED(ocelot_handle_int, PT_SIZE, sp)
25 SAVE_ALL
26 CLI
27 .set at
28 mfc0 t0, CP0_CAUSE
29 mfc0 t2, CP0_STATUS
30
31 and t0, t2
32
33 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
34 bnez t1, ll_pri_enet_irq
35 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
36 bnez t1, ll_sec_enet_irq
37 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
38 bnez t1, ll_uart1_irq
39 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
40 bnez t1, ll_cpci_irq
41 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
42 bnez t1, ll_galileo_irq
43 andi t1, t0, STATUSF_IP7 /* cpu timer */
44 bnez t1, ll_cputimer_irq
45
46 /* now look at the extended interrupts */
47 mfc0 t0, CP0_CAUSE
48 cfc0 t1, CP0_S1_INTCONTROL
49
50 /* shift the mask 8 bits left to line up the bits */
51 sll t2, t1, 8
52
53 and t0, t2
54 srl t0, t0, 16
55
56 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
57 bnez t1, ll_pmc1_irq
58 andi t1, t0, STATUSF_IP9 /* int7 hardware line */
59 bnez t1, ll_pmc2_irq
60 andi t1, t0, STATUSF_IP10 /* int8 hardware line */
61 bnez t1, ll_cpci_abcd_irq
62 andi t1, t0, STATUSF_IP11 /* int9 hardware line */
63 bnez t1, ll_uart2_irq
64
65 .set reorder
66
67 /* wrong alarm or masked ... */
68 j spurious_interrupt
69 nop
70 END(ocelot_handle_int)
71
72 .align 5
73ll_pri_enet_irq:
74 li a0, 2
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_sec_enet_irq:
80 li a0, 3
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84
85ll_uart1_irq:
86 li a0, 4
87 move a1, sp
88 jal do_IRQ
89 j ret_from_irq
90
91ll_cpci_irq:
92 li a0, 5
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_galileo_irq:
98 li a0, 6
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_cputimer_irq:
104 li a0, 7
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_pmc1_irq:
110 li a0, 8
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pmc2_irq:
116 li a0, 9
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_cpci_abcd_irq:
122 li a0, 10
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_uart2_irq:
128 li a0, 11
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
diff --git a/arch/mips/gt64120/momenco_ocelot/irq.c b/arch/mips/gt64120/momenco_ocelot/irq.c
index 4f108da71b23..885f67f32ea3 100644
--- a/arch/mips/gt64120/momenco_ocelot/irq.c
+++ b/arch/mips/gt64120/momenco_ocelot/irq.c
@@ -48,7 +48,38 @@
48#include <asm/mipsregs.h> 48#include <asm/mipsregs.h>
49#include <asm/system.h> 49#include <asm/system.h>
50 50
51extern asmlinkage void ocelot_handle_int(void); 51asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
52{
53 unsigned int pending = read_c0_status() & read_c0_cause();
54
55 if (pending & STATUSF_IP2) /* int0 hardware line */
56 do_IRQ(2, regs);
57 else if (pending & STATUSF_IP3) /* int1 hardware line */
58 do_IRQ(3, regs);
59 else if (pending & STATUSF_IP4) /* int2 hardware line */
60 do_IRQ(4, regs);
61 else if (pending & STATUSF_IP5) /* int3 hardware line */
62 do_IRQ(5, regs);
63 else if (pending & STATUSF_IP6) /* int4 hardware line */
64 do_IRQ(6, regs);
65 else if (pending & STATUSF_IP7) /* cpu timer */
66 do_IRQ(7, regs);
67 else {
68 /*
69 * Now look at the extended interrupts
70 */
71 pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
72
73 if (pending & STATUSF_IP8) /* int6 hardware line */
74 do_IRQ(8, regs);
75 else if (pending & STATUSF_IP9) /* int7 hardware line */
76 do_IRQ(9, regs);
77 else if (pending & STATUSF_IP10) /* int8 hardware line */
78 do_IRQ(10, regs);
79 else if (pending & STATUSF_IP11) /* int9 hardware line */
80 do_IRQ(11, regs);
81 }
82}
52 83
53void __init arch_init_irq(void) 84void __init arch_init_irq(void)
54{ 85{
@@ -59,9 +90,6 @@ void __init arch_init_irq(void)
59 clear_c0_status(ST0_IM); 90 clear_c0_status(ST0_IM);
60 local_irq_disable(); 91 local_irq_disable();
61 92
62 /* Sets the first-level interrupt dispatcher. */
63 set_except_vector(0, ocelot_handle_int);
64
65 mips_cpu_irq_init(0); 93 mips_cpu_irq_init(0);
66 rm7k_cpu_irq_init(8); 94 rm7k_cpu_irq_init(8);
67} 95}
diff --git a/arch/mips/ite-boards/generic/Makefile b/arch/mips/ite-boards/generic/Makefile
index 0e7853f43983..63431538d0ec 100644
--- a/arch/mips/ite-boards/generic/Makefile
+++ b/arch/mips/ite-boards/generic/Makefile
@@ -6,7 +6,7 @@
6# Makefile for the ITE 8172 (qed-4n-s01b) board, generic files. 6# Makefile for the ITE 8172 (qed-4n-s01b) board, generic files.
7# 7#
8 8
9obj-y += it8172_setup.o irq.o int-handler.o pmon_prom.o \ 9obj-y += it8172_setup.o irq.o pmon_prom.o \
10 time.o lpc.o puts.o reset.o 10 time.o lpc.o puts.o reset.o
11 11
12obj-$(CONFIG_IT8172_CIR)+= it8172_cir.o 12obj-$(CONFIG_IT8172_CIR)+= it8172_cir.o
diff --git a/arch/mips/ite-boards/generic/int-handler.S b/arch/mips/ite-boards/generic/int-handler.S
deleted file mode 100644
index d190d8add9cb..000000000000
--- a/arch/mips/ite-boards/generic/int-handler.S
+++ /dev/null
@@ -1,63 +0,0 @@
1#include <asm/asm.h>
2#include <asm/mipsregs.h>
3#include <asm/regdef.h>
4#include <asm/stackframe.h>
5
6 .text
7 .set macro
8 .set noat
9 .align 5
10
11NESTED(it8172_IRQ, PT_SIZE, sp)
12 SAVE_ALL
13 CLI # Important: mark KERNEL mode !
14
15 /* We're working with 'reorder' set at this point. */
16 /*
17 * Get pending interrupts
18 */
19
20 mfc0 t0,CP0_CAUSE # get pending interrupts
21 mfc0 t1,CP0_STATUS # get enabled interrupts
22 and t0,t1 # isolate allowed ones
23
24 andi t0,0xff00 # isolate pending bits
25 beqz t0, 3f # spurious interrupt
26
27 andi a0, t0, CAUSEF_IP7
28 beq a0, zero, 1f
29
30 li a0, 127 # MIPS_CPU_TIMER_IRQ = (NR_IRQS-1)
31 move a1, sp
32 jal ll_timer_interrupt
33 j ret_from_irq
34 nop
35
361:
37 andi a0, t0, CAUSEF_IP2 # the only int we expect at this time
38 beq a0, zero, 3f
39 move a0,sp
40 jal it8172_hw0_irqdispatch
41
42 mfc0 t0,CP0_STATUS # disable interrupts
43 ori t0,1
44 xori t0,1
45 mtc0 t0,CP0_STATUS
46 nop
47 nop
48 nop
49
50 la a1, ret_from_irq
51 jr a1
52 nop
53
543:
55 move a0, sp
56 jal mips_spurious_interrupt
57 nop
58 la a1, ret_from_irq
59 jr a1
60 nop
61
62END(it8172_IRQ)
63
diff --git a/arch/mips/ite-boards/generic/irq.c b/arch/mips/ite-boards/generic/irq.c
index e67f96129491..77be7216bdd0 100644
--- a/arch/mips/ite-boards/generic/irq.c
+++ b/arch/mips/ite-boards/generic/irq.c
@@ -62,12 +62,8 @@
62 62
63#define ALLINTS_NOTIMER (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4) 63#define ALLINTS_NOTIMER (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
64 64
65void disable_it8172_irq(unsigned int irq_nr);
66void enable_it8172_irq(unsigned int irq_nr);
67
68extern void set_debug_traps(void); 65extern void set_debug_traps(void);
69extern void mips_timer_interrupt(int irq, struct pt_regs *regs); 66extern void mips_timer_interrupt(int irq, struct pt_regs *regs);
70extern asmlinkage void it8172_IRQ(void);
71 67
72struct it8172_intc_regs volatile *it8172_hw0_icregs = 68struct it8172_intc_regs volatile *it8172_hw0_icregs =
73 (struct it8172_intc_regs volatile *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_INTC_BASE)); 69 (struct it8172_intc_regs volatile *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_INTC_BASE));
@@ -181,8 +177,6 @@ void __init arch_init_irq(void)
181 int i; 177 int i;
182 unsigned long flags; 178 unsigned long flags;
183 179
184 set_except_vector(0, it8172_IRQ);
185
186 /* mask all interrupts */ 180 /* mask all interrupts */
187 it8172_hw0_icregs->lb_mask = 0xffff; 181 it8172_hw0_icregs->lb_mask = 0xffff;
188 it8172_hw0_icregs->lpc_mask = 0xffff; 182 it8172_hw0_icregs->lpc_mask = 0xffff;
@@ -282,6 +276,18 @@ void it8172_hw0_irqdispatch(struct pt_regs *regs)
282 do_IRQ(irq, regs); 276 do_IRQ(irq, regs);
283} 277}
284 278
279asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
280{
281 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
282
283 if (!pending)
284 mips_spurious_interrupt(regs);
285 else if (pending & CAUSEF_IP7)
286 ll_timer_interrupt(127, regs);
287 else if (pending & CAUSEF_IP2)
288 it8172_hw0_irqdispatch(regs);
289}
290
285void show_pending_irqs(void) 291void show_pending_irqs(void)
286{ 292{
287 fputs("intstatus: "); 293 fputs("intstatus: ");
diff --git a/arch/mips/ite-boards/generic/time.c b/arch/mips/ite-boards/generic/time.c
index b79817bb6cce..dee497a91807 100644
--- a/arch/mips/ite-boards/generic/time.c
+++ b/arch/mips/ite-boards/generic/time.c
@@ -29,6 +29,7 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/mc146818rtc.h>
32 33
33#include <asm/time.h> 34#include <asm/time.h>
34#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c
index b774db035b31..05cf9218c432 100644
--- a/arch/mips/ite-boards/ivr/init.c
+++ b/arch/mips/ite-boards/ivr/init.c
@@ -34,13 +34,13 @@
34#include <asm/bootinfo.h> 34#include <asm/bootinfo.h>
35#include <linux/string.h> 35#include <linux/string.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <asm/sections.h>
37#include <asm/it8172/it8172.h> 38#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_dbg.h> 39#include <asm/it8172/it8172_dbg.h>
39 40
40int prom_argc; 41int prom_argc;
41char **prom_argv, **prom_envp; 42char **prom_argv, **prom_envp;
42 43
43extern char _end;
44extern void __init prom_init_cmdline(void); 44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c
index e8ec8be66a80..ea2a754cafe5 100644
--- a/arch/mips/ite-boards/qed-4n-s01b/init.c
+++ b/arch/mips/ite-boards/qed-4n-s01b/init.c
@@ -34,13 +34,13 @@
34#include <asm/bootinfo.h> 34#include <asm/bootinfo.h>
35#include <linux/string.h> 35#include <linux/string.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <asm/sections.h>
37#include <asm/it8172/it8172.h> 38#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_dbg.h> 39#include <asm/it8172/it8172_dbg.h>
39 40
40int prom_argc; 41int prom_argc;
41char **prom_argv, **prom_envp; 42char **prom_argv, **prom_envp;
42 43
43extern char _end;
44extern void __init prom_init_cmdline(void); 44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
diff --git a/arch/mips/jazz/Makefile b/arch/mips/jazz/Makefile
index 85749246a671..02bd39add891 100644
--- a/arch/mips/jazz/Makefile
+++ b/arch/mips/jazz/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the Jazz family specific parts of the kernel 2# Makefile for the Jazz family specific parts of the kernel
3# 3#
4 4
5obj-y := int-handler.o irq.o jazzdma.o reset.o setup.o 5obj-y := irq.o jazzdma.o reset.o setup.o
6 6
7EXTRA_AFLAGS := $(CFLAGS) 7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/jazz/int-handler.S b/arch/mips/jazz/int-handler.S
deleted file mode 100644
index dc752c67b528..000000000000
--- a/arch/mips/jazz/int-handler.S
+++ /dev/null
@@ -1,282 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle and Andreas Busse
7 *
8 * Jazz family specific interrupt stuff
9 *
10 * To do: On Jazz machines we remap some non-ISA interrupts to ISA
11 * interrupts. These interrupts should use their own vectors.
12 * Squeeze the last cycles out of the handlers. Only a dead
13 * cycle is a good cycle.
14 */
15#include <asm/asm.h>
16#include <asm/mipsregs.h>
17#include <asm/jazz.h>
18#include <asm/regdef.h>
19#include <asm/stackframe.h>
20
21/*
22 * jazz_handle_int: Interrupt handler for the ACER Pica-61 boards
23 */
24 .set noreorder
25
26 NESTED(jazz_handle_int, PT_SIZE, ra)
27 .set noat
28 SAVE_ALL
29 CLI
30 .set at
31
32 /*
33 * Get pending interrupts
34 */
35 mfc0 t0,CP0_CAUSE # get pending interrupts
36 mfc0 t1,CP0_STATUS # get enabled interrupts
37 and t0,t1 # isolate allowed ones
38 andi t0,0xff00 # isolate pending bits
39 beqz t0,3f
40 sll t0,16 # delay slot
41
42 /*
43 * Find irq with highest priority
44 * FIXME: This is slow - use binary search
45 */
46 la t1,ll_vectors
471: bltz t0,2f # found pending irq
48 sll t0,1
49 b 1b
50 subu t1,PTRSIZE # delay slot
51
52 /*
53 * Do the low-level stuff
54 */
552: lw t0,(t1)
56 jr t0
57 nop # delay slot
58 END(jazz_handle_int)
59
60ll_sw0: li s1,~IE_SW0
61 mfc0 t0,CP0_CAUSE
62 and t0,s1
63 mtc0 t0,CP0_CAUSE
64 PANIC("Unimplemented sw0 handler")
65
66ll_sw1: li s1,~IE_SW1
67 mfc0 t0,CP0_CAUSE
68 and t0,s1
69 mtc0 t0,CP0_CAUSE
70 PANIC("Unimplemented sw1 handler")
71
72ll_local_dma: li s1,~IE_IRQ0
73 PANIC("Unimplemented local_dma handler")
74
75ll_local_dev: lbu t0,JAZZ_IO_IRQ_SOURCE
76#if PTRSIZE == 8 /* True 64 bit kernel */
77 dsll t0,1
78#endif
79 .set reorder
80 LONG_L t0,local_vector(t0)
81 jr t0
82 .set noreorder
83
84/*
85 * The braindead PICA hardware gives us no way to distinguish if we really
86 * received interrupt 7 from the (E)ISA bus or if we just received an
87 * interrupt with no findable cause. This sometimes happens with braindead
88 * cards. Oh well - for all the Jazz boxes slots are more or less just
89 * whistles and bells and we're aware of the problem.
90 */
91ll_isa_irq: lw a0, JAZZ_EISA_IRQ_ACK
92
93 jal do_IRQ
94 move a1,sp
95
96 j ret_from_irq
97 nop
98
99/*
100 * Hmm... This is not just a plain PC clone so the question is
101 * which devices on Jazz machines can generate an (E)ISA NMI?
102 * (Writing to nonexistent memory?)
103 */
104ll_isa_nmi: li s1,~IE_IRQ3
105 PANIC("Unimplemented isa_nmi handler")
106
107/*
108 * Timer IRQ - remapped to be more similar to an IBM compatible.
109 *
110 * The timer interrupt is handled specially to ensure that the jiffies
111 * variable is updated at all times. Specifically, the timer interrupt is
112 * just like the complete handlers except that it is invoked with interrupts
113 * disabled and should never re-enable them. If other interrupts were
114 * allowed to be processed while the timer interrupt is active, then the
115 * other interrupts would have to avoid using the jiffies variable for delay
116 * and interval timing operations to avoid hanging the system.
117 */
118ll_timer: lw zero,JAZZ_TIMER_REGISTER # timer irq cleared on read
119 li s1,~IE_IRQ4
120
121 li a0, JAZZ_TIMER_IRQ
122 jal do_IRQ
123 move a1,sp
124
125 mfc0 t0,CP0_STATUS # disable interrupts again
126 ori t0,1
127 xori t0,1
128 mtc0 t0,CP0_STATUS
129
130 j ret_from_irq
131 nop
132
133/*
134 * CPU count/compare IRQ (unused)
135 */
136ll_count: j ret_from_irq
137 mtc0 zero,CP0_COMPARE
138
139#if 0
140/*
141 * Call the handler for the interrupt
142 * (Currently unused)
143 */
144call_real: /*
145 * temporarily disable interrupt
146 */
147 mfc0 t2,CP0_STATUS
148 and t2,s1
149 mtc0 t2,CP0_STATUS
150 nor s1,zero,s1
151 jal do_IRQ
152
153 /*
154 * reenable interrupt
155 */
156 mfc0 t2,CP0_STATUS
157 or t2,s1
158 mtc0 t2,CP0_STATUS
159 j ret_from_irq
160#endif
161
162 .data
163 PTR ll_sw0 # SW0
164 PTR ll_sw1 # SW1
165 PTR ll_local_dma # Local DMA
166 PTR ll_local_dev # Local devices
167 PTR ll_isa_irq # ISA IRQ
168 PTR ll_isa_nmi # ISA NMI
169 PTR ll_timer # Timer
170ll_vectors: PTR ll_count # Count/Compare IRQ
171
172 /*
173 * Interrupt handlers for local devices.
174 */
175 .text
176 .set reorder
177loc_no_irq: PANIC("Unimplemented loc_no_irq handler")
178/*
179 * Parallel port IRQ
180 */
181loc_parallel: li s1,~JAZZ_IE_PARALLEL
182 li a0,JAZZ_PARALLEL_IRQ
183 b loc_call
184
185/*
186 * Floppy IRQ
187 */
188loc_floppy: li s1,~JAZZ_IE_FLOPPY
189 li a0,JAZZ_FLOPPY_IRQ
190 b loc_call
191
192/*
193 * Sound IRQ
194 */
195loc_sound: PANIC("Unimplemented loc_sound handler")
196loc_video: PANIC("Unimplemented loc_video handler")
197
198/*
199 * Ethernet interrupt handler
200 */
201loc_ethernet: li s1,~JAZZ_IE_ETHERNET
202 li a0,JAZZ_ETHERNET_IRQ
203 b loc_call
204
205/*
206 * SCSI interrupt handler
207 */
208loc_scsi: li s1,~JAZZ_IE_SCSI
209 li a0,JAZZ_SCSI_IRQ
210 b loc_call
211
212/*
213 * Keyboard interrupt handler
214 */
215loc_keyboard: li s1,~JAZZ_IE_KEYBOARD
216 li a0,JAZZ_KEYBOARD_IRQ
217 b loc_call
218
219/*
220 * Mouse interrupt handler
221 */
222loc_mouse: li s1,~JAZZ_IE_MOUSE
223 li a0,JAZZ_MOUSE_IRQ
224 b loc_call
225
226/*
227 * Serial port 1 IRQ
228 */
229loc_serial1: li s1,~JAZZ_IE_SERIAL1
230 li a0,JAZZ_SERIAL1_IRQ
231 b loc_call
232
233/*
234 * Serial port 2 IRQ
235 */
236loc_serial2: li s1,~JAZZ_IE_SERIAL2
237 li a0,JAZZ_SERIAL2_IRQ
238 b loc_call
239
240/*
241 * Call the interrupt handler for an interrupt generated by a
242 * local device.
243 */
244loc_call: /*
245 * Temporarily disable interrupt source
246 */
247 lhu t2,JAZZ_IO_IRQ_ENABLE
248 and t2,s1
249 sh t2,JAZZ_IO_IRQ_ENABLE
250
251 nor s1,zero,s1
252 jal do_IRQ
253
254 /*
255 * Reenable interrupt
256 */
257 lhu t2,JAZZ_IO_IRQ_ENABLE
258 or t2,s1
259 sh t2,JAZZ_IO_IRQ_ENABLE
260
261 j ret_from_irq
262
263/*
264 * "Jump extender" to reach spurious_interrupt
265 */
2663: j spurious_interrupt
267
268/*
269 * Vectors for interrupts generated by local devices
270 */
271 .data
272local_vector: PTR loc_no_irq
273 PTR loc_parallel
274 PTR loc_floppy
275 PTR loc_sound
276 PTR loc_video
277 PTR loc_ethernet
278 PTR loc_scsi
279 PTR loc_keyboard
280 PTR loc_mouse
281 PTR loc_serial1
282 PTR loc_serial2
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index b309b1bcf2e8..becc9accd495 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -15,8 +15,6 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/jazz.h> 16#include <asm/jazz.h>
17 17
18extern asmlinkage void jazz_handle_int(void);
19
20static DEFINE_SPINLOCK(r4030_lock); 18static DEFINE_SPINLOCK(r4030_lock);
21 19
22static void enable_r4030_irq(unsigned int irq) 20static void enable_r4030_irq(unsigned int irq)
@@ -90,10 +88,82 @@ void __init init_r4030_ints(void)
90 */ 88 */
91void __init arch_init_irq(void) 89void __init arch_init_irq(void)
92{ 90{
93 set_except_vector(0, jazz_handle_int);
94
95 init_i8259_irqs(); /* Integrated i8259 */ 91 init_i8259_irqs(); /* Integrated i8259 */
96 init_r4030_ints(); 92 init_r4030_ints();
97 93
98 change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1); 94 change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1);
99} 95}
96
97static void loc_call(unsigned int irq, struct pt_regs *regs, unsigned int mask)
98{
99 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
100 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) & mask);
101 do_IRQ(irq, regs);
102 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
103 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | mask);
104}
105
106static void ll_local_dev(struct pt_regs *regs)
107{
108 switch (r4030_read_reg32(JAZZ_IO_IRQ_SOURCE)) {
109 case 0:
110 panic("Unimplemented loc_no_irq handler");
111 break;
112 case 4:
113 loc_call(JAZZ_PARALLEL_IRQ, regs, JAZZ_IE_PARALLEL);
114 break;
115 case 8:
116 loc_call(JAZZ_PARALLEL_IRQ, regs, JAZZ_IE_FLOPPY);
117 break;
118 case 12:
119 panic("Unimplemented loc_sound handler");
120 break;
121 case 16:
122 panic("Unimplemented loc_video handler");
123 break;
124 case 20:
125 loc_call(JAZZ_ETHERNET_IRQ, regs, JAZZ_IE_ETHERNET);
126 break;
127 case 24:
128 loc_call(JAZZ_SCSI_IRQ, regs, JAZZ_IE_SCSI);
129 break;
130 case 28:
131 loc_call(JAZZ_KEYBOARD_IRQ, regs, JAZZ_IE_KEYBOARD);
132 break;
133 case 32:
134 loc_call(JAZZ_MOUSE_IRQ, regs, JAZZ_IE_MOUSE);
135 break;
136 case 36:
137 loc_call(JAZZ_SERIAL1_IRQ, regs, JAZZ_IE_SERIAL1);
138 break;
139 case 40:
140 loc_call(JAZZ_SERIAL2_IRQ, regs, JAZZ_IE_SERIAL2);
141 break;
142 }
143}
144
145asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
146{
147 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
148
149 if (pending & IE_IRQ5)
150 write_c0_compare(0);
151 else if (pending & IE_IRQ4) {
152 r4030_read_reg32(JAZZ_TIMER_REGISTER);
153 do_IRQ(JAZZ_TIMER_IRQ, regs);
154 } else if (pending & IE_IRQ3)
155 panic("Unimplemented ISA NMI handler");
156 else if (pending & IE_IRQ2)
157 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK), regs);
158 else if (pending & IE_IRQ1) {
159 ll_local_dev(regs);
160 } else if (unlikely(pending & IE_IRQ0))
161 panic("Unimplemented local_dma handler");
162 else if (pending & IE_SW1) {
163 clear_c0_cause(IE_SW1);
164 panic("Unimplemented sw1 handler");
165 } else if (pending & IE_SW0) {
166 clear_c0_cause(IE_SW0);
167 panic("Unimplemented sw0 handler");
168 }
169}
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c
index a6bd3f4d3049..e6561345d12a 100644
--- a/arch/mips/jmr3927/common/rtc_ds1742.c
+++ b/arch/mips/jmr3927/common/rtc_ds1742.c
@@ -60,15 +60,15 @@ rtc_ds1742_get_time(void)
60 unsigned long flags; 60 unsigned long flags;
61 61
62 spin_lock_irqsave(&rtc_lock, flags); 62 spin_lock_irqsave(&rtc_lock, flags);
63 CMOS_WRITE(RTC_READ, RTC_CONTROL); 63 rtc_write(RTC_READ, RTC_CONTROL);
64 second = BCD2BIN(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); 64 second = BCD2BIN(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
65 minute = BCD2BIN(CMOS_READ(RTC_MINUTES)); 65 minute = BCD2BIN(rtc_read(RTC_MINUTES));
66 hour = BCD2BIN(CMOS_READ(RTC_HOURS)); 66 hour = BCD2BIN(rtc_read(RTC_HOURS));
67 day = BCD2BIN(CMOS_READ(RTC_DATE)); 67 day = BCD2BIN(rtc_read(RTC_DATE));
68 month = BCD2BIN(CMOS_READ(RTC_MONTH)); 68 month = BCD2BIN(rtc_read(RTC_MONTH));
69 year = BCD2BIN(CMOS_READ(RTC_YEAR)); 69 year = BCD2BIN(rtc_read(RTC_YEAR));
70 century = BCD2BIN(CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK); 70 century = BCD2BIN(rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK);
71 CMOS_WRITE(0, RTC_CONTROL); 71 rtc_write(0, RTC_CONTROL);
72 spin_unlock_irqrestore(&rtc_lock, flags); 72 spin_unlock_irqrestore(&rtc_lock, flags);
73 73
74 year += century * 100; 74 year += century * 100;
@@ -87,16 +87,16 @@ rtc_ds1742_set_time(unsigned long t)
87 unsigned long flags; 87 unsigned long flags;
88 88
89 spin_lock_irqsave(&rtc_lock, flags); 89 spin_lock_irqsave(&rtc_lock, flags);
90 CMOS_WRITE(RTC_READ, RTC_CONTROL); 90 rtc_write(RTC_READ, RTC_CONTROL);
91 cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); 91 cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
92 cmos_minute = (u8)CMOS_READ(RTC_MINUTES); 92 cmos_minute = (u8)rtc_read(RTC_MINUTES);
93 cmos_hour = (u8)CMOS_READ(RTC_HOURS); 93 cmos_hour = (u8)rtc_read(RTC_HOURS);
94 cmos_day = (u8)CMOS_READ(RTC_DATE); 94 cmos_day = (u8)rtc_read(RTC_DATE);
95 cmos_month = (u8)CMOS_READ(RTC_MONTH); 95 cmos_month = (u8)rtc_read(RTC_MONTH);
96 cmos_year = (u8)CMOS_READ(RTC_YEAR); 96 cmos_year = (u8)rtc_read(RTC_YEAR);
97 cmos_century = CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK; 97 cmos_century = rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK;
98 98
99 CMOS_WRITE(RTC_WRITE, RTC_CONTROL); 99 rtc_write(RTC_WRITE, RTC_CONTROL);
100 100
101 /* convert */ 101 /* convert */
102 to_tm(t, &tm); 102 to_tm(t, &tm);
@@ -104,18 +104,18 @@ rtc_ds1742_set_time(unsigned long t)
104 /* check each field one by one */ 104 /* check each field one by one */
105 year = BIN2BCD(tm.tm_year - EPOCH); 105 year = BIN2BCD(tm.tm_year - EPOCH);
106 if (year != cmos_year) { 106 if (year != cmos_year) {
107 CMOS_WRITE(year,RTC_YEAR); 107 rtc_write(year,RTC_YEAR);
108 } 108 }
109 109
110 month = BIN2BCD(tm.tm_mon); 110 month = BIN2BCD(tm.tm_mon);
111 if (month != (cmos_month & 0x1f)) { 111 if (month != (cmos_month & 0x1f)) {
112 CMOS_WRITE((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH); 112 rtc_write((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH);
113 } 113 }
114 114
115 day = BIN2BCD(tm.tm_mday); 115 day = BIN2BCD(tm.tm_mday);
116 if (day != cmos_day) { 116 if (day != cmos_day) {
117 117
118 CMOS_WRITE(day, RTC_DATE); 118 rtc_write(day, RTC_DATE);
119 } 119 }
120 120
121 if (cmos_hour & 0x40) { 121 if (cmos_hour & 0x40) {
@@ -130,20 +130,20 @@ rtc_ds1742_set_time(unsigned long t)
130 /* 24 hour format */ 130 /* 24 hour format */
131 hour = BIN2BCD(tm.tm_hour) & 0x3f; 131 hour = BIN2BCD(tm.tm_hour) & 0x3f;
132 } 132 }
133 if (hour != cmos_hour) CMOS_WRITE(hour, RTC_HOURS); 133 if (hour != cmos_hour) rtc_write(hour, RTC_HOURS);
134 134
135 minute = BIN2BCD(tm.tm_min); 135 minute = BIN2BCD(tm.tm_min);
136 if (minute != cmos_minute) { 136 if (minute != cmos_minute) {
137 CMOS_WRITE(minute, RTC_MINUTES); 137 rtc_write(minute, RTC_MINUTES);
138 } 138 }
139 139
140 second = BIN2BCD(tm.tm_sec); 140 second = BIN2BCD(tm.tm_sec);
141 if (second != cmos_second) { 141 if (second != cmos_second) {
142 CMOS_WRITE(second & RTC_SECONDS_MASK,RTC_SECONDS); 142 rtc_write(second & RTC_SECONDS_MASK,RTC_SECONDS);
143 } 143 }
144 144
145 /* RTC_CENTURY and RTC_CONTROL share same address... */ 145 /* RTC_CENTURY and RTC_CONTROL share same address... */
146 CMOS_WRITE(cmos_century, RTC_CONTROL); 146 rtc_write(cmos_century, RTC_CONTROL);
147 spin_unlock_irqrestore(&rtc_lock, flags); 147 spin_unlock_irqrestore(&rtc_lock, flags);
148 148
149 return 0; 149 return 0;
@@ -163,9 +163,9 @@ rtc_ds1742_init(unsigned long base)
163 rtc_mips_set_time = rtc_ds1742_set_time; 163 rtc_mips_set_time = rtc_ds1742_set_time;
164 164
165 /* clear oscillator stop bit */ 165 /* clear oscillator stop bit */
166 CMOS_WRITE(RTC_READ, RTC_CONTROL); 166 rtc_write(RTC_READ, RTC_CONTROL);
167 cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); 167 cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK);
168 CMOS_WRITE(RTC_WRITE, RTC_CONTROL); 168 rtc_write(RTC_WRITE, RTC_CONTROL);
169 CMOS_WRITE(cmos_second, RTC_SECONDS); /* clear msb */ 169 rtc_write(cmos_second, RTC_SECONDS); /* clear msb */
170 CMOS_WRITE(0, RTC_CONTROL); 170 rtc_write(0, RTC_CONTROL);
171} 171}
diff --git a/arch/mips/jmr3927/rbhma3100/Makefile b/arch/mips/jmr3927/rbhma3100/Makefile
index 75bf418b94c0..baf5077813c1 100644
--- a/arch/mips/jmr3927/rbhma3100/Makefile
+++ b/arch/mips/jmr3927/rbhma3100/Makefile
@@ -2,7 +2,7 @@
2# Makefile for TOSHIBA JMR-TX3927 board 2# Makefile for TOSHIBA JMR-TX3927 board
3# 3#
4 4
5obj-y += init.o int-handler.o irq.o setup.o 5obj-y += init.o irq.o setup.o
6obj-$(CONFIG_RUNTIME_DEBUG) += debug.o 6obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
7obj-$(CONFIG_KGDB) += kgdb_io.o 7obj-$(CONFIG_KGDB) += kgdb_io.o
8 8
diff --git a/arch/mips/jmr3927/rbhma3100/int-handler.S b/arch/mips/jmr3927/rbhma3100/int-handler.S
deleted file mode 100644
index f85bbf407542..000000000000
--- a/arch/mips/jmr3927/rbhma3100/int-handler.S
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * Based on arch/mips/tsdb/kernel/int-handler.S
7 *
8 * Copyright (C) 2000-2001 Toshiba Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#include <asm/asm.h>
32#include <asm/mipsregs.h>
33#include <asm/regdef.h>
34#include <asm/stackframe.h>
35#include <asm/jmr3927/jmr3927.h>
36
37 /* A lot of complication here is taken away because:
38 *
39 * 1) We handle one interrupt and return, sitting in a loop
40 * and moving across all the pending IRQ bits in the cause
41 * register is _NOT_ the answer, the common case is one
42 * pending IRQ so optimize in that direction.
43 *
44 * 2) We need not check against bits in the status register
45 * IRQ mask, that would make this routine slow as hell.
46 *
47 * 3) Linux only thinks in terms of all IRQs on or all IRQs
48 * off, nothing in between like BSD spl() brain-damage.
49 *
50 */
51
52/* Flush write buffer (needed?)
53 * NOTE: TX39xx performs "non-blocking load", so explicitly use the target
54 * register of LBU to flush immediately.
55 */
56#define FLUSH_WB(tmp) \
57 la tmp, JMR3927_IOC_REV_ADDR; \
58 lbu tmp, (tmp); \
59 move tmp, zero;
60
61 .text
62 .set noreorder
63 .set noat
64 .align 5
65 NESTED(jmr3927_IRQ, PT_SIZE, sp)
66 SAVE_ALL
67 CLI
68 .set at
69 jal jmr3927_irc_irqdispatch
70 move a0, sp
71 FLUSH_WB(t0)
72 j ret_from_irq
73 nop
74 END(jmr3927_IRQ)
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c
index 2810727f1d4e..11304d1354f4 100644
--- a/arch/mips/jmr3927/rbhma3100/irq.c
+++ b/arch/mips/jmr3927/rbhma3100/irq.c
@@ -77,8 +77,6 @@ static int jmr3927_gen_iack(void)
77} 77}
78#endif 78#endif
79 79
80extern asmlinkage void jmr3927_IRQ(void);
81
82#define irc_dlevel 0 80#define irc_dlevel 0
83#define irc_elevel 1 81#define irc_elevel 1
84 82
@@ -262,7 +260,7 @@ void jmr3927_spurious(struct pt_regs *regs)
262 regs->cp0_cause, regs->cp0_epc, regs->regs[31]); 260 regs->cp0_cause, regs->cp0_epc, regs->regs[31]);
263} 261}
264 262
265void jmr3927_irc_irqdispatch(struct pt_regs *regs) 263asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
266{ 264{
267 int irq; 265 int irq;
268 266
@@ -398,8 +396,6 @@ void __init arch_init_irq(void)
398 396
399 jmr3927_irq_init(NR_ISA_IRQS); 397 jmr3927_irq_init(NR_ISA_IRQS);
400 398
401 set_except_vector(0, jmr3927_IRQ);
402
403 /* setup irq space */ 399 /* setup irq space */
404 add_tb_irq_space(&jmr3927_isac_irqspace); 400 add_tb_irq_space(&jmr3927_isac_irqspace);
405 add_tb_irq_space(&jmr3927_ioc_irqspace); 401 add_tb_irq_space(&jmr3927_ioc_irqspace);
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 309d54cceda3..34e8a256765c 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -34,8 +34,11 @@ obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o
34 34
35obj-$(CONFIG_SMP) += smp.o 35obj-$(CONFIG_SMP) += smp.o
36 36
37obj-$(CONFIG_MIPS_MT_SMP) += smp_mt.o 37obj-$(CONFIG_MIPS_MT) += mips-mt.o
38obj-$(CONFIG_MIPS_MT_SMTC) += smtc.o smtc-asm.o smtc-proc.o
39obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
38 40
41obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
39obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 42obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
40obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 43obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
41 44
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index ca6b03c773be..92b28b674d6f 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -69,6 +69,9 @@ void output_ptreg_defines(void)
69 offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr); 69 offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr);
70 offset("#define PT_STATUS ", struct pt_regs, cp0_status); 70 offset("#define PT_STATUS ", struct pt_regs, cp0_status);
71 offset("#define PT_CAUSE ", struct pt_regs, cp0_cause); 71 offset("#define PT_CAUSE ", struct pt_regs, cp0_cause);
72#ifdef CONFIG_MIPS_MT_SMTC
73 offset("#define PT_TCSTATUS ", struct pt_regs, cp0_tcstatus);
74#endif /* CONFIG_MIPS_MT_SMTC */
72 size("#define PT_SIZE ", struct pt_regs); 75 size("#define PT_SIZE ", struct pt_regs);
73 linefeed; 76 linefeed;
74} 77}
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index 83c87fe4ee4f..d101d2fb24ca 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -17,6 +17,9 @@
17#include <asm/isadep.h> 17#include <asm/isadep.h>
18#include <asm/thread_info.h> 18#include <asm/thread_info.h>
19#include <asm/war.h> 19#include <asm/war.h>
20#ifdef CONFIG_MIPS_MT_SMTC
21#include <asm/mipsmtregs.h>
22#endif
20 23
21#ifdef CONFIG_PREEMPT 24#ifdef CONFIG_PREEMPT
22 .macro preempt_stop 25 .macro preempt_stop
@@ -75,6 +78,37 @@ FEXPORT(syscall_exit)
75 bnez t0, syscall_exit_work 78 bnez t0, syscall_exit_work
76 79
77FEXPORT(restore_all) # restore full frame 80FEXPORT(restore_all) # restore full frame
81#ifdef CONFIG_MIPS_MT_SMTC
82/* Detect and execute deferred IPI "interrupts" */
83 move a0,sp
84 jal deferred_smtc_ipi
85/* Re-arm any temporarily masked interrupts not explicitly "acked" */
86 mfc0 v0, CP0_TCSTATUS
87 ori v1, v0, TCSTATUS_IXMT
88 mtc0 v1, CP0_TCSTATUS
89 andi v0, TCSTATUS_IXMT
90 ehb
91 mfc0 t0, CP0_TCCONTEXT
92 DMT 9 # dmt t1
93 jal mips_ihb
94 mfc0 t2, CP0_STATUS
95 andi t3, t0, 0xff00
96 or t2, t2, t3
97 mtc0 t2, CP0_STATUS
98 ehb
99 andi t1, t1, VPECONTROL_TE
100 beqz t1, 1f
101 EMT
1021:
103 mfc0 v1, CP0_TCSTATUS
104 /* We set IXMT above, XOR should cler it here */
105 xori v1, v1, TCSTATUS_IXMT
106 or v1, v0, v1
107 mtc0 v1, CP0_TCSTATUS
108 ehb
109 xor t0, t0, t3
110 mtc0 t0, CP0_TCCONTEXT
111#endif /* CONFIG_MIPS_MT_SMTC */
78 .set noat 112 .set noat
79 RESTORE_TEMP 113 RESTORE_TEMP
80 RESTORE_AT 114 RESTORE_AT
@@ -120,28 +154,17 @@ syscall_exit_work:
120 jal do_syscall_trace 154 jal do_syscall_trace
121 b resume_userspace 155 b resume_userspace
122 156
157#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
158
123/* 159/*
124 * Common spurious interrupt handler. 160 * MIPS32R2 Instruction Hazard Barrier - must be called
161 *
162 * For C code use the inline version named instruction_hazard().
125 */ 163 */
126LEAF(spurious_interrupt) 164LEAF(mips_ihb)
127 /* 165 .set mips32r2
128 * Someone tried to fool us by sending an interrupt but we 166 jr.hb ra
129 * couldn't find a cause for it. 167 nop
130 */ 168 END(mips_ihb)
131 PTR_LA t1, irq_err_count 169
132#ifdef CONFIG_SMP 170#endif /* CONFIG_CPU_MIPSR2 or CONFIG_MIPS_MT */
1331: ll t0, (t1)
134 addiu t0, 1
135 sc t0, (t1)
136#if R10000_LLSC_WAR
137 beqzl t0, 1b
138#else
139 beqz t0, 1b
140#endif
141#else
142 lw t0, (t1)
143 addiu t0, 1
144 sw t0, (t1)
145#endif
146 j ret_from_irq
147 END(spurious_interrupt)
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S
index 235ad9f6bd35..10f28fb9f008 100644
--- a/arch/mips/kernel/gdb-low.S
+++ b/arch/mips/kernel/gdb-low.S
@@ -283,11 +283,33 @@
283 */ 283 */
284 284
2853: 2853:
286#ifdef CONFIG_MIPS_MT_SMTC
287 /* Read-modify write of Status must be atomic */
288 mfc0 t2, CP0_TCSTATUS
289 ori t1, t2, TCSTATUS_IXMT
290 mtc0 t1, CP0_TCSTATUS
291 andi t2, t2, TCSTATUS_IXMT
292 ehb
293 DMT 9 # dmt t1
294 jal mips_ihb
295 nop
296#endif /* CONFIG_MIPS_MT_SMTC */
286 mfc0 t0, CP0_STATUS 297 mfc0 t0, CP0_STATUS
287 ori t0, 0x1f 298 ori t0, 0x1f
288 xori t0, 0x1f 299 xori t0, 0x1f
289 mtc0 t0, CP0_STATUS 300 mtc0 t0, CP0_STATUS
290 301#ifdef CONFIG_MIPS_MT_SMTC
302 andi t1, t1, VPECONTROL_TE
303 beqz t1, 9f
304 nop
305 EMT # emt
3069:
307 mfc0 t1, CP0_TCSTATUS
308 xori t1, t1, TCSTATUS_IXMT
309 or t1, t1, t2
310 mtc0 t1, CP0_TCSTATUS
311 ehb
312#endif /* CONFIG_MIPS_MT_SMTC */
291 LONG_L v0, GDB_FR_STATUS(sp) 313 LONG_L v0, GDB_FR_STATUS(sp)
292 LONG_L v1, GDB_FR_EPC(sp) 314 LONG_L v1, GDB_FR_EPC(sp)
293 mtc0 v0, CP0_STATUS 315 mtc0 v0, CP0_STATUS
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
index d4f88e0af24c..6ecbdc1fefd1 100644
--- a/arch/mips/kernel/gdb-stub.c
+++ b/arch/mips/kernel/gdb-stub.c
@@ -140,6 +140,7 @@
140#include <asm/system.h> 140#include <asm/system.h>
141#include <asm/gdb-stub.h> 141#include <asm/gdb-stub.h>
142#include <asm/inst.h> 142#include <asm/inst.h>
143#include <asm/smp.h>
143 144
144/* 145/*
145 * external low-level support routines 146 * external low-level support routines
@@ -669,6 +670,64 @@ static void kgdb_wait(void *arg)
669 local_irq_restore(flags); 670 local_irq_restore(flags);
670} 671}
671 672
673/*
674 * GDB stub needs to call kgdb_wait on all processor with interrupts
675 * disabled, so it uses it's own special variant.
676 */
677static int kgdb_smp_call_kgdb_wait(void)
678{
679#ifdef CONFIG_SMP
680 struct call_data_struct data;
681 int i, cpus = num_online_cpus() - 1;
682 int cpu = smp_processor_id();
683
684 /*
685 * Can die spectacularly if this CPU isn't yet marked online
686 */
687 BUG_ON(!cpu_online(cpu));
688
689 if (!cpus)
690 return 0;
691
692 if (spin_is_locked(&smp_call_lock)) {
693 /*
694 * Some other processor is trying to make us do something
695 * but we're not going to respond... give up
696 */
697 return -1;
698 }
699
700 /*
701 * We will continue here, accepting the fact that
702 * the kernel may deadlock if another CPU attempts
703 * to call smp_call_function now...
704 */
705
706 data.func = kgdb_wait;
707 data.info = NULL;
708 atomic_set(&data.started, 0);
709 data.wait = 0;
710
711 spin_lock(&smp_call_lock);
712 call_data = &data;
713 mb();
714
715 /* Send a message to all other CPUs and wait for them to respond */
716 for (i = 0; i < NR_CPUS; i++)
717 if (cpu_online(i) && i != cpu)
718 core_send_ipi(i, SMP_CALL_FUNCTION);
719
720 /* Wait for response */
721 /* FIXME: lock-up detection, backtrace on lock-up */
722 while (atomic_read(&data.started) != cpus)
723 barrier();
724
725 call_data = NULL;
726 spin_unlock(&smp_call_lock);
727#endif
728
729 return 0;
730}
672 731
673/* 732/*
674 * This function does all command processing for interfacing to gdb. It 733 * This function does all command processing for interfacing to gdb. It
@@ -718,7 +777,7 @@ void handle_exception (struct gdb_regs *regs)
718 /* 777 /*
719 * force other cpus to enter kgdb 778 * force other cpus to enter kgdb
720 */ 779 */
721 smp_call_function(kgdb_wait, NULL, 0, 0); 780 kgdb_smp_call_kgdb_wait();
722 781
723 /* 782 /*
724 * If we're in breakpoint() increment the PC 783 * If we're in breakpoint() increment the PC
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 13f22d1d0e8b..ff7af369f286 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <asm/asm.h> 14#include <asm/asm.h>
15#include <asm/asmmacro.h>
15#include <asm/cacheops.h> 16#include <asm/cacheops.h>
16#include <asm/regdef.h> 17#include <asm/regdef.h>
17#include <asm/fpregdef.h> 18#include <asm/fpregdef.h>
@@ -122,6 +123,20 @@ handle_vcei:
122 .set pop 123 .set pop
123 END(except_vec3_r4000) 124 END(except_vec3_r4000)
124 125
126 __FINIT
127
128 .align 5
129NESTED(handle_int, PT_SIZE, sp)
130 SAVE_ALL
131 CLI
132
133 PTR_LA ra, ret_from_irq
134 move a0, sp
135 j plat_irq_dispatch
136 END(handle_int)
137
138 __INIT
139
125/* 140/*
126 * Special interrupt vector for MIPS64 ISA & embedded MIPS processors. 141 * Special interrupt vector for MIPS64 ISA & embedded MIPS processors.
127 * This is a dedicated interrupt exception vector which reduces the 142 * This is a dedicated interrupt exception vector which reduces the
@@ -157,6 +172,15 @@ NESTED(except_vec_vi, 0, sp)
157 SAVE_AT 172 SAVE_AT
158 .set push 173 .set push
159 .set noreorder 174 .set noreorder
175#ifdef CONFIG_MIPS_MT_SMTC
176 /*
177 * To keep from blindly blocking *all* interrupts
178 * during service by SMTC kernel, we also want to
179 * pass the IM value to be cleared.
180 */
181EXPORT(except_vec_vi_mori)
182 ori a0, $0, 0
183#endif /* CONFIG_MIPS_MT_SMTC */
160EXPORT(except_vec_vi_lui) 184EXPORT(except_vec_vi_lui)
161 lui v0, 0 /* Patched */ 185 lui v0, 0 /* Patched */
162 j except_vec_vi_handler 186 j except_vec_vi_handler
@@ -173,6 +197,25 @@ EXPORT(except_vec_vi_end)
173NESTED(except_vec_vi_handler, 0, sp) 197NESTED(except_vec_vi_handler, 0, sp)
174 SAVE_TEMP 198 SAVE_TEMP
175 SAVE_STATIC 199 SAVE_STATIC
200#ifdef CONFIG_MIPS_MT_SMTC
201 /*
202 * SMTC has an interesting problem that interrupts are level-triggered,
203 * and the CLI macro will clear EXL, potentially causing a duplicate
204 * interrupt service invocation. So we need to clear the associated
205 * IM bit of Status prior to doing CLI, and restore it after the
206 * service routine has been invoked - we must assume that the
207 * service routine will have cleared the state, and any active
208 * level represents a new or otherwised unserviced event...
209 */
210 mfc0 t1, CP0_STATUS
211 and t0, a0, t1
212 mfc0 t2, CP0_TCCONTEXT
213 or t0, t0, t2
214 mtc0 t0, CP0_TCCONTEXT
215 xor t1, t1, t0
216 mtc0 t1, CP0_STATUS
217 ehb
218#endif /* CONFIG_MIPS_MT_SMTC */
176 CLI 219 CLI
177 move a0, sp 220 move a0, sp
178 jalr v0 221 jalr v0
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 2e9122a4213a..bdf6f6eff721 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -18,6 +18,7 @@
18#include <linux/threads.h> 18#include <linux/threads.h>
19 19
20#include <asm/asm.h> 20#include <asm/asm.h>
21#include <asm/asmmacro.h>
21#include <asm/regdef.h> 22#include <asm/regdef.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/mipsregs.h> 24#include <asm/mipsregs.h>
@@ -82,12 +83,33 @@
82 */ 83 */
83 .macro setup_c0_status set clr 84 .macro setup_c0_status set clr
84 .set push 85 .set push
86#ifdef CONFIG_MIPS_MT_SMTC
87 /*
88 * For SMTC, we need to set privilege and disable interrupts only for
89 * the current TC, using the TCStatus register.
90 */
91 mfc0 t0, CP0_TCSTATUS
92 /* Fortunately CU 0 is in the same place in both registers */
93 /* Set TCU0, TMX, TKSU (for later inversion) and IXMT */
94 li t1, ST0_CU0 | 0x08001c00
95 or t0, t1
96 /* Clear TKSU, leave IXMT */
97 xori t0, 0x00001800
98 mtc0 t0, CP0_TCSTATUS
99 ehb
100 /* We need to leave the global IE bit set, but clear EXL...*/
101 mfc0 t0, CP0_STATUS
102 or t0, ST0_CU0 | ST0_EXL | ST0_ERL | \set | \clr
103 xor t0, ST0_EXL | ST0_ERL | \clr
104 mtc0 t0, CP0_STATUS
105#else
85 mfc0 t0, CP0_STATUS 106 mfc0 t0, CP0_STATUS
86 or t0, ST0_CU0|\set|0x1f|\clr 107 or t0, ST0_CU0|\set|0x1f|\clr
87 xor t0, 0x1f|\clr 108 xor t0, 0x1f|\clr
88 mtc0 t0, CP0_STATUS 109 mtc0 t0, CP0_STATUS
89 .set noreorder 110 .set noreorder
90 sll zero,3 # ehb 111 sll zero,3 # ehb
112#endif
91 .set pop 113 .set pop
92 .endm 114 .endm
93 115
@@ -134,6 +156,24 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
134 156
135 ARC64_TWIDDLE_PC 157 ARC64_TWIDDLE_PC
136 158
159#ifdef CONFIG_MIPS_MT_SMTC
160 /*
161 * In SMTC kernel, "CLI" is thread-specific, in TCStatus.
162 * We still need to enable interrupts globally in Status,
163 * and clear EXL/ERL.
164 *
165 * TCContext is used to track interrupt levels under
166 * service in SMTC kernel. Clear for boot TC before
167 * allowing any interrupts.
168 */
169 mtc0 zero, CP0_TCCONTEXT
170
171 mfc0 t0, CP0_STATUS
172 ori t0, t0, 0xff1f
173 xori t0, t0, 0x001e
174 mtc0 t0, CP0_STATUS
175#endif /* CONFIG_MIPS_MT_SMTC */
176
137 PTR_LA t0, __bss_start # clear .bss 177 PTR_LA t0, __bss_start # clear .bss
138 LONG_S zero, (t0) 178 LONG_S zero, (t0)
139 PTR_LA t1, __bss_stop - LONGSIZE 179 PTR_LA t1, __bss_stop - LONGSIZE
@@ -166,8 +206,25 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
166 * function after setting up the stack and gp registers. 206 * function after setting up the stack and gp registers.
167 */ 207 */
168NESTED(smp_bootstrap, 16, sp) 208NESTED(smp_bootstrap, 16, sp)
209#ifdef CONFIG_MIPS_MT_SMTC
210 /*
211 * Read-modify-writes of Status must be atomic, and this
212 * is one case where CLI is invoked without EXL being
213 * necessarily set. The CLI and setup_c0_status will
214 * in fact be redundant for all but the first TC of
215 * each VPE being booted.
216 */
217 DMT 10 # dmt t2 /* t0, t1 are used by CLI and setup_c0_status() */
218 jal mips_ihb
219#endif /* CONFIG_MIPS_MT_SMTC */
169 setup_c0_status_sec 220 setup_c0_status_sec
170 smp_slave_setup 221 smp_slave_setup
222#ifdef CONFIG_MIPS_MT_SMTC
223 andi t2, t2, VPECONTROL_TE
224 beqz t2, 2f
225 EMT # emt
2262:
227#endif /* CONFIG_MIPS_MT_SMTC */
171 j start_secondary 228 j start_secondary
172 END(smp_bootstrap) 229 END(smp_bootstrap)
173#endif /* CONFIG_SMP */ 230#endif /* CONFIG_SMP */
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index b974ac9057f6..2125ba5f1d9b 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -187,6 +187,10 @@ handle_real_irq:
187 outb(cached_21,0x21); 187 outb(cached_21,0x21);
188 outb(0x60+irq,0x20); /* 'Specific EOI' to master */ 188 outb(0x60+irq,0x20); /* 'Specific EOI' to master */
189 } 189 }
190#ifdef CONFIG_MIPS_MT_SMTC
191 if (irq_hwmask[irq] & ST0_IM)
192 set_c0_status(irq_hwmask[irq] & ST0_IM);
193#endif /* CONFIG_MIPS_MT_SMTC */
190 spin_unlock_irqrestore(&i8259A_lock, flags); 194 spin_unlock_irqrestore(&i8259A_lock, flags);
191 return; 195 return;
192 196
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index 3f653c7cfbf3..97ebdc754b9e 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -76,6 +76,11 @@ static void level_mask_and_ack_msc_irq(unsigned int irq)
76 mask_msc_irq(irq); 76 mask_msc_irq(irq);
77 if (!cpu_has_veic) 77 if (!cpu_has_veic)
78 MSCIC_WRITE(MSC01_IC_EOI, 0); 78 MSCIC_WRITE(MSC01_IC_EOI, 0);
79#ifdef CONFIG_MIPS_MT_SMTC
80 /* This actually needs to be a call into platform code */
81 if (irq_hwmask[irq] & ST0_IM)
82 set_c0_status(irq_hwmask[irq] & ST0_IM);
83#endif /* CONFIG_MIPS_MT_SMTC */
79} 84}
80 85
81/* 86/*
@@ -92,6 +97,10 @@ static void edge_mask_and_ack_msc_irq(unsigned int irq)
92 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r | ~MSC01_IC_SUP_EDGE_BIT); 97 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r | ~MSC01_IC_SUP_EDGE_BIT);
93 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r); 98 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r);
94 } 99 }
100#ifdef CONFIG_MIPS_MT_SMTC
101 if (irq_hwmask[irq] & ST0_IM)
102 set_c0_status(irq_hwmask[irq] & ST0_IM);
103#endif /* CONFIG_MIPS_MT_SMTC */
95} 104}
96 105
97/* 106/*
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 3dd76b3d2967..3dce742e716f 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -38,6 +38,15 @@ void ack_bad_irq(unsigned int irq)
38 38
39atomic_t irq_err_count; 39atomic_t irq_err_count;
40 40
41#ifdef CONFIG_MIPS_MT_SMTC
42/*
43 * SMTC Kernel needs to manipulate low-level CPU interrupt mask
44 * in do_IRQ. These are passed in setup_irq_smtc() and stored
45 * in this table.
46 */
47unsigned long irq_hwmask[NR_IRQS];
48#endif /* CONFIG_MIPS_MT_SMTC */
49
41#undef do_IRQ 50#undef do_IRQ
42 51
43/* 52/*
@@ -49,6 +58,7 @@ asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs)
49{ 58{
50 irq_enter(); 59 irq_enter();
51 60
61 __DO_IRQ_SMTC_HOOK();
52 __do_IRQ(irq, regs); 62 __do_IRQ(irq, regs);
53 63
54 irq_exit(); 64 irq_exit();
@@ -101,6 +111,11 @@ skip:
101 return 0; 111 return 0;
102} 112}
103 113
114asmlinkage void spurious_interrupt(struct pt_regs *regs)
115{
116 atomic_inc(&irq_err_count);
117}
118
104#ifdef CONFIG_KGDB 119#ifdef CONFIG_KGDB
105extern void breakpoint(void); 120extern void breakpoint(void);
106extern void set_debug_traps(void); 121extern void set_debug_traps(void);
@@ -124,6 +139,9 @@ void __init init_IRQ(void)
124 irq_desc[i].depth = 1; 139 irq_desc[i].depth = 1;
125 irq_desc[i].handler = &no_irq_type; 140 irq_desc[i].handler = &no_irq_type;
126 spin_lock_init(&irq_desc[i].lock); 141 spin_lock_init(&irq_desc[i].lock);
142#ifdef CONFIG_MIPS_MT_SMTC
143 irq_hwmask[i] = 0;
144#endif /* CONFIG_MIPS_MT_SMTC */
127 } 145 }
128 146
129 arch_init_irq(); 147 arch_init_irq();
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
new file mode 100644
index 000000000000..f06a144c7881
--- /dev/null
+++ b/arch/mips/kernel/kspd.c
@@ -0,0 +1,398 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/unistd.h>
21#include <linux/file.h>
22#include <linux/fs.h>
23#include <linux/syscalls.h>
24#include <linux/workqueue.h>
25#include <linux/errno.h>
26#include <linux/list.h>
27
28#include <asm/vpe.h>
29#include <asm/rtlx.h>
30#include <asm/kspd.h>
31
32static struct workqueue_struct *workqueue = NULL;
33static struct work_struct work;
34
35extern unsigned long cpu_khz;
36
37struct mtsp_syscall {
38 int cmd;
39 unsigned char abi;
40 unsigned char size;
41};
42
43struct mtsp_syscall_ret {
44 int retval;
45 int errno;
46};
47
48struct mtsp_syscall_generic {
49 int arg0;
50 int arg1;
51 int arg2;
52 int arg3;
53 int arg4;
54 int arg5;
55 int arg6;
56};
57
58static struct list_head kspd_notifylist;
59static int sp_stopping = 0;
60
61/* these should match with those in the SDE kit */
62#define MTSP_SYSCALL_BASE 0
63#define MTSP_SYSCALL_EXIT (MTSP_SYSCALL_BASE + 0)
64#define MTSP_SYSCALL_OPEN (MTSP_SYSCALL_BASE + 1)
65#define MTSP_SYSCALL_READ (MTSP_SYSCALL_BASE + 2)
66#define MTSP_SYSCALL_WRITE (MTSP_SYSCALL_BASE + 3)
67#define MTSP_SYSCALL_CLOSE (MTSP_SYSCALL_BASE + 4)
68#define MTSP_SYSCALL_LSEEK32 (MTSP_SYSCALL_BASE + 5)
69#define MTSP_SYSCALL_ISATTY (MTSP_SYSCALL_BASE + 6)
70#define MTSP_SYSCALL_GETTIME (MTSP_SYSCALL_BASE + 7)
71#define MTSP_SYSCALL_PIPEFREQ (MTSP_SYSCALL_BASE + 8)
72#define MTSP_SYSCALL_GETTOD (MTSP_SYSCALL_BASE + 9)
73
74#define MTSP_O_RDONLY 0x0000
75#define MTSP_O_WRONLY 0x0001
76#define MTSP_O_RDWR 0x0002
77#define MTSP_O_NONBLOCK 0x0004
78#define MTSP_O_APPEND 0x0008
79#define MTSP_O_SHLOCK 0x0010
80#define MTSP_O_EXLOCK 0x0020
81#define MTSP_O_ASYNC 0x0040
82#define MTSP_O_FSYNC O_SYNC
83#define MTSP_O_NOFOLLOW 0x0100
84#define MTSP_O_SYNC 0x0080
85#define MTSP_O_CREAT 0x0200
86#define MTSP_O_TRUNC 0x0400
87#define MTSP_O_EXCL 0x0800
88#define MTSP_O_BINARY 0x8000
89
90#define SP_VPE 1
91
92struct apsp_table {
93 int sp;
94 int ap;
95};
96
97/* we might want to do the mode flags too */
98struct apsp_table open_flags_table[] = {
99 { MTSP_O_RDWR, O_RDWR },
100 { MTSP_O_WRONLY, O_WRONLY },
101 { MTSP_O_CREAT, O_CREAT },
102 { MTSP_O_TRUNC, O_TRUNC },
103 { MTSP_O_NONBLOCK, O_NONBLOCK },
104 { MTSP_O_APPEND, O_APPEND },
105 { MTSP_O_NOFOLLOW, O_NOFOLLOW }
106};
107
108struct apsp_table syscall_command_table[] = {
109 { MTSP_SYSCALL_OPEN, __NR_open },
110 { MTSP_SYSCALL_CLOSE, __NR_close },
111 { MTSP_SYSCALL_READ, __NR_read },
112 { MTSP_SYSCALL_WRITE, __NR_write },
113 { MTSP_SYSCALL_LSEEK32, __NR_lseek }
114};
115
116static int sp_syscall(int num, int arg0, int arg1, int arg2, int arg3)
117{
118 register long int _num __asm__ ("$2") = num;
119 register long int _arg0 __asm__ ("$4") = arg0;
120 register long int _arg1 __asm__ ("$5") = arg1;
121 register long int _arg2 __asm__ ("$6") = arg2;
122 register long int _arg3 __asm__ ("$7") = arg3;
123
124 mm_segment_t old_fs;
125
126 old_fs = get_fs();
127 set_fs(KERNEL_DS);
128
129 __asm__ __volatile__ (
130 " syscall \n"
131 : "=r" (_num), "=r" (_arg3)
132 : "r" (_num), "r" (_arg0), "r" (_arg1), "r" (_arg2), "r" (_arg3));
133
134 set_fs(old_fs);
135
136 /* $a3 is error flag */
137 if (_arg3)
138 return -_num;
139
140 return _num;
141}
142
143static int translate_syscall_command(int cmd)
144{
145 int i;
146 int ret = -1;
147
148 for (i = 0; i < ARRAY_SIZE(syscall_command_table); i++) {
149 if ((cmd == syscall_command_table[i].sp))
150 return syscall_command_table[i].ap;
151 }
152
153 return ret;
154}
155
156static unsigned int translate_open_flags(int flags)
157{
158 int i;
159 unsigned int ret = 0;
160
161 for (i = 0; i < (sizeof(open_flags_table) / sizeof(struct apsp_table));
162 i++) {
163 if( (flags & open_flags_table[i].sp) ) {
164 ret |= open_flags_table[i].ap;
165 }
166 }
167
168 return ret;
169}
170
171
172static void sp_setfsuidgid( uid_t uid, gid_t gid)
173{
174 current->fsuid = uid;
175 current->fsgid = gid;
176
177 key_fsuid_changed(current);
178 key_fsgid_changed(current);
179}
180
181/*
182 * Expects a request to be on the sysio channel. Reads it. Decides whether
183 * its a linux syscall and runs it, or whatever. Puts the return code back
184 * into the request and sends the whole thing back.
185 */
186void sp_work_handle_request(void)
187{
188 struct mtsp_syscall sc;
189 struct mtsp_syscall_generic generic;
190 struct mtsp_syscall_ret ret;
191 struct kspd_notifications *n;
192 struct timeval tv;
193 struct timezone tz;
194 int cmd;
195
196 char *vcwd;
197 mm_segment_t old_fs;
198 int size;
199
200 ret.retval = -1;
201
202 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall), 0)) {
203 printk(KERN_ERR "Expected request but nothing to read\n");
204 return;
205 }
206
207 size = sc.size;
208
209 if (size) {
210 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size, 0)) {
211 printk(KERN_ERR "Expected request but nothing to read\n");
212 return;
213 }
214 }
215
216 /* Run the syscall at the priviledge of the user who loaded the
217 SP program */
218
219 if (vpe_getuid(SP_VPE))
220 sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE));
221
222 switch (sc.cmd) {
223 /* needs the flags argument translating from SDE kit to
224 linux */
225 case MTSP_SYSCALL_PIPEFREQ:
226 ret.retval = cpu_khz * 1000;
227 ret.errno = 0;
228 break;
229
230 case MTSP_SYSCALL_GETTOD:
231 memset(&tz, 0, sizeof(tz));
232 if ((ret.retval = sp_syscall(__NR_gettimeofday, (int)&tv,
233 (int)&tz, 0,0)) == 0)
234 ret.retval = tv.tv_sec;
235
236 ret.errno = errno;
237 break;
238
239 case MTSP_SYSCALL_EXIT:
240 list_for_each_entry(n, &kspd_notifylist, list)
241 n->kspd_sp_exit(SP_VPE);
242 sp_stopping = 1;
243
244 printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
245 generic.arg0);
246 break;
247
248 case MTSP_SYSCALL_OPEN:
249 generic.arg1 = translate_open_flags(generic.arg1);
250
251 vcwd = vpe_getcwd(SP_VPE);
252
253 /* change to the cwd of the process that loaded the SP program */
254 old_fs = get_fs();
255 set_fs(KERNEL_DS);
256 sys_chdir(vcwd);
257 set_fs(old_fs);
258
259 sc.cmd = __NR_open;
260
261 /* fall through */
262
263 default:
264 if ((sc.cmd >= __NR_Linux) &&
265 (sc.cmd <= (__NR_Linux + __NR_Linux_syscalls)) )
266 cmd = sc.cmd;
267 else
268 cmd = translate_syscall_command(sc.cmd);
269
270 if (cmd >= 0) {
271 ret.retval = sp_syscall(cmd, generic.arg0, generic.arg1,
272 generic.arg2, generic.arg3);
273 ret.errno = errno;
274 } else
275 printk(KERN_WARNING
276 "KSPD: Unknown SP syscall number %d\n", sc.cmd);
277 break;
278 } /* switch */
279
280 if (vpe_getuid(SP_VPE))
281 sp_setfsuidgid( 0, 0);
282
283 if ((rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(struct mtsp_syscall_ret), 0))
284 < sizeof(struct mtsp_syscall_ret))
285 printk("KSPD: sp_work_handle_request failed to send to SP\n");
286}
287
288static void sp_cleanup(void)
289{
290 struct files_struct *files = current->files;
291 int i, j;
292 struct fdtable *fdt;
293
294 j = 0;
295
296 /*
297 * It is safe to dereference the fd table without RCU or
298 * ->file_lock
299 */
300 fdt = files_fdtable(files);
301 for (;;) {
302 unsigned long set;
303 i = j * __NFDBITS;
304 if (i >= fdt->max_fdset || i >= fdt->max_fds)
305 break;
306 set = fdt->open_fds->fds_bits[j++];
307 while (set) {
308 if (set & 1) {
309 struct file * file = xchg(&fdt->fd[i], NULL);
310 if (file)
311 filp_close(file, files);
312 }
313 i++;
314 set >>= 1;
315 }
316 }
317}
318
319static int channel_open = 0;
320
321/* the work handler */
322static void sp_work(void *data)
323{
324 if (!channel_open) {
325 if( rtlx_open(RTLX_CHANNEL_SYSIO, 1) != 0) {
326 printk("KSPD: unable to open sp channel\n");
327 sp_stopping = 1;
328 } else {
329 channel_open++;
330 printk(KERN_DEBUG "KSPD: SP channel opened\n");
331 }
332 } else {
333 /* wait for some data, allow it to sleep */
334 rtlx_read_poll(RTLX_CHANNEL_SYSIO, 1);
335
336 /* Check we haven't been woken because we are stopping */
337 if (!sp_stopping)
338 sp_work_handle_request();
339 }
340
341 if (!sp_stopping)
342 queue_work(workqueue, &work);
343 else
344 sp_cleanup();
345}
346
347static void startwork(int vpe)
348{
349 sp_stopping = channel_open = 0;
350
351 if (workqueue == NULL) {
352 if ((workqueue = create_singlethread_workqueue("kspd")) == NULL) {
353 printk(KERN_ERR "unable to start kspd\n");
354 return;
355 }
356
357 INIT_WORK(&work, sp_work, NULL);
358 queue_work(workqueue, &work);
359 } else
360 queue_work(workqueue, &work);
361
362}
363
364static void stopwork(int vpe)
365{
366 sp_stopping = 1;
367
368 printk(KERN_DEBUG "KSPD: SP stopping\n");
369}
370
371void kspd_notify(struct kspd_notifications *notify)
372{
373 list_add(&notify->list, &kspd_notifylist);
374}
375
376static struct vpe_notifications notify;
377static int kspd_module_init(void)
378{
379 INIT_LIST_HEAD(&kspd_notifylist);
380
381 notify.start = startwork;
382 notify.stop = stopwork;
383 vpe_notify(SP_VPE, &notify);
384
385 return 0;
386}
387
388static void kspd_module_exit(void)
389{
390
391}
392
393module_init(kspd_module_init);
394module_exit(kspd_module_exit);
395
396MODULE_DESCRIPTION("MIPS KSPD");
397MODULE_AUTHOR("Elizabeth Oldham, MIPS Technologies, Inc.");
398MODULE_LICENSE("GPL");
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 3f40c37a9ee6..7c953bcc5f6a 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -1182,6 +1182,16 @@ asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
1182 return sys_readahead(fd, merge_64(a2, a3), count); 1182 return sys_readahead(fd, merge_64(a2, a3), count);
1183} 1183}
1184 1184
1185asmlinkage long sys32_sync_file_range(int fd, int __pad,
1186 unsigned long a2, unsigned long a3,
1187 unsigned long a4, unsigned long a5,
1188 int flags)
1189{
1190 return sys_sync_file_range(fd,
1191 merge_64(a2, a3), merge_64(a4, a5),
1192 flags);
1193}
1194
1185/* Argument list sizes for sys_socketcall */ 1195/* Argument list sizes for sys_socketcall */
1186#define AL(x) ((x) * sizeof(unsigned int)) 1196#define AL(x) ((x) * sizeof(unsigned int))
1187static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), 1197static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c
new file mode 100644
index 000000000000..02237a685ec7
--- /dev/null
+++ b/arch/mips/kernel/mips-mt.c
@@ -0,0 +1,449 @@
1/*
2 * General MIPS MT support routines, usable in AP/SP, SMVP, or SMTC kernels
3 * Copyright (C) 2005 Mips Technologies, Inc
4 */
5
6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/cpumask.h>
9#include <linux/interrupt.h>
10
11#include <asm/cpu.h>
12#include <asm/processor.h>
13#include <asm/atomic.h>
14#include <asm/system.h>
15#include <asm/hardirq.h>
16#include <asm/mmu_context.h>
17#include <asm/smp.h>
18#include <asm/mipsmtregs.h>
19#include <asm/r4kcache.h>
20#include <asm/cacheflush.h>
21
22/*
23 * CPU mask used to set process affinity for MT VPEs/TCs with FPUs
24 */
25
26cpumask_t mt_fpu_cpumask;
27
28#ifdef CONFIG_MIPS_MT_FPAFF
29
30#include <linux/cpu.h>
31#include <linux/delay.h>
32#include <asm/uaccess.h>
33
34unsigned long mt_fpemul_threshold = 0;
35
36/*
37 * Replacement functions for the sys_sched_setaffinity() and
38 * sys_sched_getaffinity() system calls, so that we can integrate
39 * FPU affinity with the user's requested processor affinity.
40 * This code is 98% identical with the sys_sched_setaffinity()
41 * and sys_sched_getaffinity() system calls, and should be
42 * updated when kernel/sched.c changes.
43 */
44
45/*
46 * find_process_by_pid - find a process with a matching PID value.
47 * used in sys_sched_set/getaffinity() in kernel/sched.c, so
48 * cloned here.
49 */
50static inline task_t *find_process_by_pid(pid_t pid)
51{
52 return pid ? find_task_by_pid(pid) : current;
53}
54
55
56/*
57 * mipsmt_sys_sched_setaffinity - set the cpu affinity of a process
58 */
59asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
60 unsigned long __user *user_mask_ptr)
61{
62 cpumask_t new_mask;
63 cpumask_t effective_mask;
64 int retval;
65 task_t *p;
66
67 if (len < sizeof(new_mask))
68 return -EINVAL;
69
70 if (copy_from_user(&new_mask, user_mask_ptr, sizeof(new_mask)))
71 return -EFAULT;
72
73 lock_cpu_hotplug();
74 read_lock(&tasklist_lock);
75
76 p = find_process_by_pid(pid);
77 if (!p) {
78 read_unlock(&tasklist_lock);
79 unlock_cpu_hotplug();
80 return -ESRCH;
81 }
82
83 /*
84 * It is not safe to call set_cpus_allowed with the
85 * tasklist_lock held. We will bump the task_struct's
86 * usage count and drop tasklist_lock before invoking
87 * set_cpus_allowed.
88 */
89 get_task_struct(p);
90
91 retval = -EPERM;
92 if ((current->euid != p->euid) && (current->euid != p->uid) &&
93 !capable(CAP_SYS_NICE)) {
94 read_unlock(&tasklist_lock);
95 goto out_unlock;
96 }
97
98 /* Record new user-specified CPU set for future reference */
99 p->thread.user_cpus_allowed = new_mask;
100
101 /* Unlock the task list */
102 read_unlock(&tasklist_lock);
103
104 /* Compute new global allowed CPU set if necessary */
105 if( (p->thread.mflags & MF_FPUBOUND)
106 && cpus_intersects(new_mask, mt_fpu_cpumask)) {
107 cpus_and(effective_mask, new_mask, mt_fpu_cpumask);
108 retval = set_cpus_allowed(p, effective_mask);
109 } else {
110 p->thread.mflags &= ~MF_FPUBOUND;
111 retval = set_cpus_allowed(p, new_mask);
112 }
113
114
115out_unlock:
116 put_task_struct(p);
117 unlock_cpu_hotplug();
118 return retval;
119}
120
121/*
122 * mipsmt_sys_sched_getaffinity - get the cpu affinity of a process
123 */
124asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
125 unsigned long __user *user_mask_ptr)
126{
127 unsigned int real_len;
128 cpumask_t mask;
129 int retval;
130 task_t *p;
131
132 real_len = sizeof(mask);
133 if (len < real_len)
134 return -EINVAL;
135
136 lock_cpu_hotplug();
137 read_lock(&tasklist_lock);
138
139 retval = -ESRCH;
140 p = find_process_by_pid(pid);
141 if (!p)
142 goto out_unlock;
143
144 retval = 0;
145
146 cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map);
147
148out_unlock:
149 read_unlock(&tasklist_lock);
150 unlock_cpu_hotplug();
151 if (retval)
152 return retval;
153 if (copy_to_user(user_mask_ptr, &mask, real_len))
154 return -EFAULT;
155 return real_len;
156}
157
158#endif /* CONFIG_MIPS_MT_FPAFF */
159
160/*
161 * Dump new MIPS MT state for the core. Does not leave TCs halted.
162 * Takes an argument which taken to be a pre-call MVPControl value.
163 */
164
165void mips_mt_regdump(unsigned long mvpctl)
166{
167 unsigned long flags;
168 unsigned long vpflags;
169 unsigned long mvpconf0;
170 int nvpe;
171 int ntc;
172 int i;
173 int tc;
174 unsigned long haltval;
175 unsigned long tcstatval;
176#ifdef CONFIG_MIPS_MT_SMTC
177 void smtc_soft_dump(void);
178#endif /* CONFIG_MIPT_MT_SMTC */
179
180 local_irq_save(flags);
181 vpflags = dvpe();
182 printk("=== MIPS MT State Dump ===\n");
183 printk("-- Global State --\n");
184 printk(" MVPControl Passed: %08lx\n", mvpctl);
185 printk(" MVPControl Read: %08lx\n", vpflags);
186 printk(" MVPConf0 : %08lx\n", (mvpconf0 = read_c0_mvpconf0()));
187 nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
188 ntc = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
189 printk("-- per-VPE State --\n");
190 for(i = 0; i < nvpe; i++) {
191 for(tc = 0; tc < ntc; tc++) {
192 settc(tc);
193 if((read_tc_c0_tcbind() & TCBIND_CURVPE) == i) {
194 printk(" VPE %d\n", i);
195 printk(" VPEControl : %08lx\n", read_vpe_c0_vpecontrol());
196 printk(" VPEConf0 : %08lx\n", read_vpe_c0_vpeconf0());
197 printk(" VPE%d.Status : %08lx\n",
198 i, read_vpe_c0_status());
199 printk(" VPE%d.EPC : %08lx\n", i, read_vpe_c0_epc());
200 printk(" VPE%d.Cause : %08lx\n", i, read_vpe_c0_cause());
201 printk(" VPE%d.Config7 : %08lx\n",
202 i, read_vpe_c0_config7());
203 break; /* Next VPE */
204 }
205 }
206 }
207 printk("-- per-TC State --\n");
208 for(tc = 0; tc < ntc; tc++) {
209 settc(tc);
210 if(read_tc_c0_tcbind() == read_c0_tcbind()) {
211 /* Are we dumping ourself? */
212 haltval = 0; /* Then we're not halted, and mustn't be */
213 tcstatval = flags; /* And pre-dump TCStatus is flags */
214 printk(" TC %d (current TC with VPE EPC above)\n", tc);
215 } else {
216 haltval = read_tc_c0_tchalt();
217 write_tc_c0_tchalt(1);
218 tcstatval = read_tc_c0_tcstatus();
219 printk(" TC %d\n", tc);
220 }
221 printk(" TCStatus : %08lx\n", tcstatval);
222 printk(" TCBind : %08lx\n", read_tc_c0_tcbind());
223 printk(" TCRestart : %08lx\n", read_tc_c0_tcrestart());
224 printk(" TCHalt : %08lx\n", haltval);
225 printk(" TCContext : %08lx\n", read_tc_c0_tccontext());
226 if (!haltval)
227 write_tc_c0_tchalt(0);
228 }
229#ifdef CONFIG_MIPS_MT_SMTC
230 smtc_soft_dump();
231#endif /* CONFIG_MIPT_MT_SMTC */
232 printk("===========================\n");
233 evpe(vpflags);
234 local_irq_restore(flags);
235}
236
237static int mt_opt_norps = 0;
238static int mt_opt_rpsctl = -1;
239static int mt_opt_nblsu = -1;
240static int mt_opt_forceconfig7 = 0;
241static int mt_opt_config7 = -1;
242
243static int __init rps_disable(char *s)
244{
245 mt_opt_norps = 1;
246 return 1;
247}
248__setup("norps", rps_disable);
249
250static int __init rpsctl_set(char *str)
251{
252 get_option(&str, &mt_opt_rpsctl);
253 return 1;
254}
255__setup("rpsctl=", rpsctl_set);
256
257static int __init nblsu_set(char *str)
258{
259 get_option(&str, &mt_opt_nblsu);
260 return 1;
261}
262__setup("nblsu=", nblsu_set);
263
264static int __init config7_set(char *str)
265{
266 get_option(&str, &mt_opt_config7);
267 mt_opt_forceconfig7 = 1;
268 return 1;
269}
270__setup("config7=", config7_set);
271
272/* Experimental cache flush control parameters that should go away some day */
273int mt_protiflush = 0;
274int mt_protdflush = 0;
275int mt_n_iflushes = 1;
276int mt_n_dflushes = 1;
277
278static int __init set_protiflush(char *s)
279{
280 mt_protiflush = 1;
281 return 1;
282}
283__setup("protiflush", set_protiflush);
284
285static int __init set_protdflush(char *s)
286{
287 mt_protdflush = 1;
288 return 1;
289}
290__setup("protdflush", set_protdflush);
291
292static int __init niflush(char *s)
293{
294 get_option(&s, &mt_n_iflushes);
295 return 1;
296}
297__setup("niflush=", niflush);
298
299static int __init ndflush(char *s)
300{
301 get_option(&s, &mt_n_dflushes);
302 return 1;
303}
304__setup("ndflush=", ndflush);
305#ifdef CONFIG_MIPS_MT_FPAFF
306static int fpaff_threshold = -1;
307
308static int __init fpaff_thresh(char *str)
309{
310 get_option(&str, &fpaff_threshold);
311 return 1;
312}
313
314__setup("fpaff=", fpaff_thresh);
315#endif /* CONFIG_MIPS_MT_FPAFF */
316
317static unsigned int itc_base = 0;
318
319static int __init set_itc_base(char *str)
320{
321 get_option(&str, &itc_base);
322 return 1;
323}
324
325__setup("itcbase=", set_itc_base);
326
327void mips_mt_set_cpuoptions(void)
328{
329 unsigned int oconfig7 = read_c0_config7();
330 unsigned int nconfig7 = oconfig7;
331
332 if (mt_opt_norps) {
333 printk("\"norps\" option deprectated: use \"rpsctl=\"\n");
334 }
335 if (mt_opt_rpsctl >= 0) {
336 printk("34K return prediction stack override set to %d.\n",
337 mt_opt_rpsctl);
338 if (mt_opt_rpsctl)
339 nconfig7 |= (1 << 2);
340 else
341 nconfig7 &= ~(1 << 2);
342 }
343 if (mt_opt_nblsu >= 0) {
344 printk("34K ALU/LSU sync override set to %d.\n", mt_opt_nblsu);
345 if (mt_opt_nblsu)
346 nconfig7 |= (1 << 5);
347 else
348 nconfig7 &= ~(1 << 5);
349 }
350 if (mt_opt_forceconfig7) {
351 printk("CP0.Config7 forced to 0x%08x.\n", mt_opt_config7);
352 nconfig7 = mt_opt_config7;
353 }
354 if (oconfig7 != nconfig7) {
355 __asm__ __volatile("sync");
356 write_c0_config7(nconfig7);
357 ehb ();
358 printk("Config7: 0x%08x\n", read_c0_config7());
359 }
360
361 /* Report Cache management debug options */
362 if (mt_protiflush)
363 printk("I-cache flushes single-threaded\n");
364 if (mt_protdflush)
365 printk("D-cache flushes single-threaded\n");
366 if (mt_n_iflushes != 1)
367 printk("I-Cache Flushes Repeated %d times\n", mt_n_iflushes);
368 if (mt_n_dflushes != 1)
369 printk("D-Cache Flushes Repeated %d times\n", mt_n_dflushes);
370
371#ifdef CONFIG_MIPS_MT_FPAFF
372 /* FPU Use Factor empirically derived from experiments on 34K */
373#define FPUSEFACTOR 333
374
375 if (fpaff_threshold >= 0) {
376 mt_fpemul_threshold = fpaff_threshold;
377 } else {
378 mt_fpemul_threshold =
379 (FPUSEFACTOR * (loops_per_jiffy/(500000/HZ))) / HZ;
380 }
381 printk("FPU Affinity set after %ld emulations\n",
382 mt_fpemul_threshold);
383#endif /* CONFIG_MIPS_MT_FPAFF */
384
385 if (itc_base != 0) {
386 /*
387 * Configure ITC mapping. This code is very
388 * specific to the 34K core family, which uses
389 * a special mode bit ("ITC") in the ErrCtl
390 * register to enable access to ITC control
391 * registers via cache "tag" operations.
392 */
393 unsigned long ectlval;
394 unsigned long itcblkgrn;
395
396 /* ErrCtl register is known as "ecc" to Linux */
397 ectlval = read_c0_ecc();
398 write_c0_ecc(ectlval | (0x1 << 26));
399 ehb();
400#define INDEX_0 (0x80000000)
401#define INDEX_8 (0x80000008)
402 /* Read "cache tag" for Dcache pseudo-index 8 */
403 cache_op(Index_Load_Tag_D, INDEX_8);
404 ehb();
405 itcblkgrn = read_c0_dtaglo();
406 itcblkgrn &= 0xfffe0000;
407 /* Set for 128 byte pitch of ITC cells */
408 itcblkgrn |= 0x00000c00;
409 /* Stage in Tag register */
410 write_c0_dtaglo(itcblkgrn);
411 ehb();
412 /* Write out to ITU with CACHE op */
413 cache_op(Index_Store_Tag_D, INDEX_8);
414 /* Now set base address, and turn ITC on with 0x1 bit */
415 write_c0_dtaglo((itc_base & 0xfffffc00) | 0x1 );
416 ehb();
417 /* Write out to ITU with CACHE op */
418 cache_op(Index_Store_Tag_D, INDEX_0);
419 write_c0_ecc(ectlval);
420 ehb();
421 printk("Mapped %ld ITC cells starting at 0x%08x\n",
422 ((itcblkgrn & 0x7fe00000) >> 20), itc_base);
423 }
424}
425
426/*
427 * Function to protect cache flushes from concurrent execution
428 * depends on MP software model chosen.
429 */
430
431void mt_cflush_lockdown(void)
432{
433#ifdef CONFIG_MIPS_MT_SMTC
434 void smtc_cflush_lockdown(void);
435
436 smtc_cflush_lockdown();
437#endif /* CONFIG_MIPS_MT_SMTC */
438 /* FILL IN VSMP and AP/SP VERSIONS HERE */
439}
440
441void mt_cflush_release(void)
442{
443#ifdef CONFIG_MIPS_MT_SMTC
444 void smtc_cflush_release(void);
445
446 smtc_cflush_release();
447#endif /* CONFIG_MIPS_MT_SMTC */
448 /* FILL IN VSMP and AP/SP VERSIONS HERE */
449}
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 86e42c633f73..0a71a4c33716 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -28,22 +28,9 @@ extern long __strnlen_user_asm(const char *s);
28/* 28/*
29 * String functions 29 * String functions
30 */ 30 */
31EXPORT_SYMBOL(memchr);
32EXPORT_SYMBOL(memcmp);
33EXPORT_SYMBOL(memset); 31EXPORT_SYMBOL(memset);
34EXPORT_SYMBOL(memcpy); 32EXPORT_SYMBOL(memcpy);
35EXPORT_SYMBOL(memmove); 33EXPORT_SYMBOL(memmove);
36EXPORT_SYMBOL(strcat);
37EXPORT_SYMBOL(strchr);
38#ifdef CONFIG_64BIT
39EXPORT_SYMBOL(strncmp);
40#endif
41EXPORT_SYMBOL(strlen);
42EXPORT_SYMBOL(strpbrk);
43EXPORT_SYMBOL(strncat);
44EXPORT_SYMBOL(strnlen);
45EXPORT_SYMBOL(strrchr);
46EXPORT_SYMBOL(strstr);
47 34
48EXPORT_SYMBOL(kernel_thread); 35EXPORT_SYMBOL(kernel_thread);
49 36
@@ -62,6 +49,3 @@ EXPORT_SYMBOL(__strnlen_user_asm);
62EXPORT_SYMBOL(csum_partial); 49EXPORT_SYMBOL(csum_partial);
63 50
64EXPORT_SYMBOL(invalid_pte_table); 51EXPORT_SYMBOL(invalid_pte_table);
65#ifdef CONFIG_GENERIC_IRQ_PROBE
66EXPORT_SYMBOL(probe_irq_mask);
67#endif
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c66db5e5ab62..199a06e873c6 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -41,6 +41,10 @@
41#include <asm/elf.h> 41#include <asm/elf.h>
42#include <asm/isadep.h> 42#include <asm/isadep.h>
43#include <asm/inst.h> 43#include <asm/inst.h>
44#ifdef CONFIG_MIPS_MT_SMTC
45#include <asm/mipsmtregs.h>
46extern void smtc_idle_loop_hook(void);
47#endif /* CONFIG_MIPS_MT_SMTC */
44 48
45/* 49/*
46 * The idle thread. There's no useful work to be done, so just try to conserve 50 * The idle thread. There's no useful work to be done, so just try to conserve
@@ -51,9 +55,13 @@ ATTRIB_NORET void cpu_idle(void)
51{ 55{
52 /* endless idle loop with no priority at all */ 56 /* endless idle loop with no priority at all */
53 while (1) { 57 while (1) {
54 while (!need_resched()) 58 while (!need_resched()) {
59#ifdef CONFIG_MIPS_MT_SMTC
60 smtc_idle_loop_hook();
61#endif /* CONFIG_MIPS_MT_SMTC */
55 if (cpu_wait) 62 if (cpu_wait)
56 (*cpu_wait)(); 63 (*cpu_wait)();
64 }
57 preempt_enable_no_resched(); 65 preempt_enable_no_resched();
58 schedule(); 66 schedule();
59 preempt_disable(); 67 preempt_disable();
@@ -177,6 +185,17 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
177 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); 185 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
178 clear_tsk_thread_flag(p, TIF_USEDFPU); 186 clear_tsk_thread_flag(p, TIF_USEDFPU);
179 187
188#ifdef CONFIG_MIPS_MT_FPAFF
189 /*
190 * FPU affinity support is cleaner if we track the
191 * user-visible CPU affinity from the very beginning.
192 * The generic cpus_allowed mask will already have
193 * been copied from the parent before copy_thread
194 * is invoked.
195 */
196 p->thread.user_cpus_allowed = p->cpus_allowed;
197#endif /* CONFIG_MIPS_MT_FPAFF */
198
180 if (clone_flags & CLONE_SETTLS) 199 if (clone_flags & CLONE_SETTLS)
181 ti->tp_value = regs->regs[7]; 200 ti->tp_value = regs->regs[7];
182 201
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index f838b36cc765..f3106d0771b0 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -248,10 +248,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
248 break; 248 break;
249 case FPC_EIR: { /* implementation / version register */ 249 case FPC_EIR: { /* implementation / version register */
250 unsigned int flags; 250 unsigned int flags;
251#ifdef CONFIG_MIPS_MT_SMTC
252 unsigned int irqflags;
253 unsigned int mtflags;
254#endif /* CONFIG_MIPS_MT_SMTC */
251 255
252 if (!cpu_has_fpu) 256 if (!cpu_has_fpu)
253 break; 257 break;
254 258
259#ifdef CONFIG_MIPS_MT_SMTC
260 /* Read-modify-write of Status must be atomic */
261 local_irq_save(irqflags);
262 mtflags = dmt();
263#endif /* CONFIG_MIPS_MT_SMTC */
264
255 preempt_disable(); 265 preempt_disable();
256 if (cpu_has_mipsmt) { 266 if (cpu_has_mipsmt) {
257 unsigned int vpflags = dvpe(); 267 unsigned int vpflags = dvpe();
@@ -266,6 +276,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
266 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 276 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
267 write_c0_status(flags); 277 write_c0_status(flags);
268 } 278 }
279#ifdef CONFIG_MIPS_MT_SMTC
280 emt(mtflags);
281 local_irq_restore(irqflags);
282#endif /* CONFIG_MIPS_MT_SMTC */
269 preempt_enable(); 283 preempt_enable();
270 break; 284 break;
271 } 285 }
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 0d5cf97af727..8704dc0496ea 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -173,12 +173,22 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
173 break; 173 break;
174 case FPC_EIR: { /* implementation / version register */ 174 case FPC_EIR: { /* implementation / version register */
175 unsigned int flags; 175 unsigned int flags;
176#ifdef CONFIG_MIPS_MT_SMTC
177 unsigned int irqflags;
178 unsigned int mtflags;
179#endif /* CONFIG_MIPS_MT_SMTC */
176 180
177 if (!cpu_has_fpu) { 181 if (!cpu_has_fpu) {
178 tmp = 0; 182 tmp = 0;
179 break; 183 break;
180 } 184 }
181 185
186#ifdef CONFIG_MIPS_MT_SMTC
187 /* Read-modify-write of Status must be atomic */
188 local_irq_save(irqflags);
189 mtflags = dmt();
190#endif /* CONFIG_MIPS_MT_SMTC */
191
182 preempt_disable(); 192 preempt_disable();
183 if (cpu_has_mipsmt) { 193 if (cpu_has_mipsmt) {
184 unsigned int vpflags = dvpe(); 194 unsigned int vpflags = dvpe();
@@ -193,6 +203,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
193 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 203 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
194 write_c0_status(flags); 204 write_c0_status(flags);
195 } 205 }
206#ifdef CONFIG_MIPS_MT_SMTC
207 emt(mtflags);
208 local_irq_restore(irqflags);
209#endif /* CONFIG_MIPS_MT_SMTC */
196 preempt_enable(); 210 preempt_enable();
197 break; 211 break;
198 } 212 }
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index d2afbd19a9c8..0b1b54acee9f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -88,7 +88,18 @@
88 88
89 PTR_ADDIU t0, $28, _THREAD_SIZE - 32 89 PTR_ADDIU t0, $28, _THREAD_SIZE - 32
90 set_saved_sp t0, t1, t2 90 set_saved_sp t0, t1, t2
91 91#ifdef CONFIG_MIPS_MT_SMTC
92 /* Read-modify-writes of Status must be atomic on a VPE */
93 mfc0 t2, CP0_TCSTATUS
94 ori t1, t2, TCSTATUS_IXMT
95 mtc0 t1, CP0_TCSTATUS
96 andi t2, t2, TCSTATUS_IXMT
97 ehb
98 DMT 8 # dmt t0
99 move t1,ra
100 jal mips_ihb
101 move ra,t1
102#endif /* CONFIG_MIPS_MT_SMTC */
92 mfc0 t1, CP0_STATUS /* Do we really need this? */ 103 mfc0 t1, CP0_STATUS /* Do we really need this? */
93 li a3, 0xff01 104 li a3, 0xff01
94 and t1, a3 105 and t1, a3
@@ -97,6 +108,18 @@
97 and a2, a3 108 and a2, a3
98 or a2, t1 109 or a2, t1
99 mtc0 a2, CP0_STATUS 110 mtc0 a2, CP0_STATUS
111#ifdef CONFIG_MIPS_MT_SMTC
112 ehb
113 andi t0, t0, VPECONTROL_TE
114 beqz t0, 1f
115 emt
1161:
117 mfc0 t1, CP0_TCSTATUS
118 xori t1, t1, TCSTATUS_IXMT
119 or t1, t1, t2
120 mtc0 t1, CP0_TCSTATUS
121 ehb
122#endif /* CONFIG_MIPS_MT_SMTC */
100 move v0, a0 123 move v0, a0
101 jr ra 124 jr ra
102 END(resume) 125 END(resume)
@@ -131,10 +154,19 @@ LEAF(_restore_fp)
131#define FPU_DEFAULT 0x00000000 154#define FPU_DEFAULT 0x00000000
132 155
133LEAF(_init_fpu) 156LEAF(_init_fpu)
157#ifdef CONFIG_MIPS_MT_SMTC
158 /* Rather than manipulate per-VPE Status, set per-TC bit in TCStatus */
159 mfc0 t0, CP0_TCSTATUS
160 /* Bit position is the same for Status, TCStatus */
161 li t1, ST0_CU1
162 or t0, t1
163 mtc0 t0, CP0_TCSTATUS
164#else /* Normal MIPS CU1 enable */
134 mfc0 t0, CP0_STATUS 165 mfc0 t0, CP0_STATUS
135 li t1, ST0_CU1 166 li t1, ST0_CU1
136 or t0, t1 167 or t0, t1
137 mtc0 t0, CP0_STATUS 168 mtc0 t0, CP0_STATUS
169#endif /* CONFIG_MIPS_MT_SMTC */
138 fpu_enable_hazard 170 fpu_enable_hazard
139 171
140 li t1, FPU_DEFAULT 172 li t1, FPU_DEFAULT
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 986a9cf23067..6179805af9f0 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -21,45 +21,44 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <asm/uaccess.h>
25#include <linux/slab.h>
26#include <linux/list.h>
27#include <linux/vmalloc.h>
28#include <linux/elf.h>
29#include <linux/seq_file.h>
30#include <linux/syscalls.h>
31#include <linux/moduleloader.h>
24#include <linux/interrupt.h> 32#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/poll.h> 33#include <linux/poll.h>
27#include <linux/sched.h> 34#include <linux/sched.h>
28#include <linux/wait.h> 35#include <linux/wait.h>
29
30#include <asm/mipsmtregs.h> 36#include <asm/mipsmtregs.h>
31#include <asm/bitops.h> 37#include <asm/cacheflush.h>
38#include <asm/atomic.h>
32#include <asm/cpu.h> 39#include <asm/cpu.h>
33#include <asm/processor.h> 40#include <asm/processor.h>
41#include <asm/system.h>
42#include <asm/vpe.h>
34#include <asm/rtlx.h> 43#include <asm/rtlx.h>
35#include <asm/uaccess.h>
36 44
37#define RTLX_TARG_VPE 1 45#define RTLX_TARG_VPE 1
38 46
39static struct rtlx_info *rtlx; 47static struct rtlx_info *rtlx;
40static int major; 48static int major;
41static char module_name[] = "rtlx"; 49static char module_name[] = "rtlx";
42static struct irqaction irq;
43static int irq_num;
44
45static inline int spacefree(int read, int write, int size)
46{
47 if (read == write) {
48 /*
49 * never fill the buffer completely, so indexes are always
50 * equal if empty and only empty, or !equal if data available
51 */
52 return size - 1;
53 }
54
55 return ((read + size - write) % size) - 1;
56}
57 50
58static struct chan_waitqueues { 51static struct chan_waitqueues {
59 wait_queue_head_t rt_queue; 52 wait_queue_head_t rt_queue;
60 wait_queue_head_t lx_queue; 53 wait_queue_head_t lx_queue;
54 int in_open;
61} channel_wqs[RTLX_CHANNELS]; 55} channel_wqs[RTLX_CHANNELS];
62 56
57static struct irqaction irq;
58static int irq_num;
59static struct vpe_notifications notify;
60static int sp_stopping = 0;
61
63extern void *vpe_get_shared(int index); 62extern void *vpe_get_shared(int index);
64 63
65static void rtlx_dispatch(struct pt_regs *regs) 64static void rtlx_dispatch(struct pt_regs *regs)
@@ -67,174 +66,298 @@ static void rtlx_dispatch(struct pt_regs *regs)
67 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ, regs); 66 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ, regs);
68} 67}
69 68
69
70/* Interrupt handler may be called before rtlx_init has otherwise had
71 a chance to run.
72*/
70static irqreturn_t rtlx_interrupt(int irq, void *dev_id, struct pt_regs *regs) 73static irqreturn_t rtlx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
71{ 74{
72 int i; 75 int i;
73 76
74 for (i = 0; i < RTLX_CHANNELS; i++) { 77 for (i = 0; i < RTLX_CHANNELS; i++) {
75 struct rtlx_channel *chan = &rtlx->channel[i]; 78 wake_up(&channel_wqs[i].lx_queue);
76 79 wake_up(&channel_wqs[i].rt_queue);
77 if (chan->lx_read != chan->lx_write)
78 wake_up_interruptible(&channel_wqs[i].lx_queue);
79 } 80 }
80 81
81 return IRQ_HANDLED; 82 return IRQ_HANDLED;
82} 83}
83 84
84/* call when we have the address of the shared structure from the SP side. */ 85static __attribute_used__ void dump_rtlx(void)
85static int rtlx_init(struct rtlx_info *rtlxi)
86{ 86{
87 int i; 87 int i;
88 88
89 if (rtlxi->id != RTLX_ID) { 89 printk("id 0x%lx state %d\n", rtlx->id, rtlx->state);
90 printk(KERN_WARNING "no valid RTLX id at 0x%p\n", rtlxi);
91 return -ENOEXEC;
92 }
93 90
94 /* initialise the wait queues */
95 for (i = 0; i < RTLX_CHANNELS; i++) { 91 for (i = 0; i < RTLX_CHANNELS; i++) {
96 init_waitqueue_head(&channel_wqs[i].rt_queue); 92 struct rtlx_channel *chan = &rtlx->channel[i];
97 init_waitqueue_head(&channel_wqs[i].lx_queue);
98 }
99 93
100 /* set up for interrupt handling */ 94 printk(" rt_state %d lx_state %d buffer_size %d\n",
101 memset(&irq, 0, sizeof(struct irqaction)); 95 chan->rt_state, chan->lx_state, chan->buffer_size);
102 96
103 if (cpu_has_vint) 97 printk(" rt_read %d rt_write %d\n",
104 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); 98 chan->rt_read, chan->rt_write);
105 99
106 irq_num = MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ; 100 printk(" lx_read %d lx_write %d\n",
107 irq.handler = rtlx_interrupt; 101 chan->lx_read, chan->lx_write);
108 irq.flags = SA_INTERRUPT; 102
109 irq.name = "RTLX"; 103 printk(" rt_buffer <%s>\n", chan->rt_buffer);
110 irq.dev_id = rtlx; 104 printk(" lx_buffer <%s>\n", chan->lx_buffer);
111 setup_irq(irq_num, &irq); 105 }
106}
107
108/* call when we have the address of the shared structure from the SP side. */
109static int rtlx_init(struct rtlx_info *rtlxi)
110{
111 if (rtlxi->id != RTLX_ID) {
112 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%x\n", rtlxi, rtlxi->id);
113 return -ENOEXEC;
114 }
112 115
113 rtlx = rtlxi; 116 rtlx = rtlxi;
114 117
115 return 0; 118 return 0;
116} 119}
117 120
118/* only allow one open process at a time to open each channel */ 121/* notifications */
119static int rtlx_open(struct inode *inode, struct file *filp) 122static void starting(int vpe)
120{ 123{
121 int minor, ret; 124 int i;
125 sp_stopping = 0;
126
127 /* force a reload of rtlx */
128 rtlx=NULL;
129
130 /* wake up any sleeping rtlx_open's */
131 for (i = 0; i < RTLX_CHANNELS; i++)
132 wake_up_interruptible(&channel_wqs[i].lx_queue);
133}
134
135static void stopping(int vpe)
136{
137 int i;
138
139 sp_stopping = 1;
140 for (i = 0; i < RTLX_CHANNELS; i++)
141 wake_up_interruptible(&channel_wqs[i].lx_queue);
142}
143
144
145int rtlx_open(int index, int can_sleep)
146{
147 int ret;
122 struct rtlx_channel *chan; 148 struct rtlx_channel *chan;
149 volatile struct rtlx_info **p;
123 150
124 /* assume only 1 device at the mo. */ 151 if (index >= RTLX_CHANNELS) {
125 minor = MINOR(inode->i_rdev); 152 printk(KERN_DEBUG "rtlx_open index out of range\n");
153 return -ENOSYS;
154 }
155
156 if (channel_wqs[index].in_open) {
157 printk(KERN_DEBUG "rtlx_open channel %d already opened\n", index);
158 return -EBUSY;
159 }
160
161 channel_wqs[index].in_open++;
126 162
127 if (rtlx == NULL) { 163 if (rtlx == NULL) {
128 struct rtlx_info **p;
129 if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) { 164 if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) {
130 printk(KERN_ERR "vpe_get_shared is NULL. " 165 if (can_sleep) {
131 "Has an SP program been loaded?\n"); 166 DECLARE_WAITQUEUE(wait, current);
132 return -EFAULT; 167
168 /* go to sleep */
169 add_wait_queue(&channel_wqs[index].lx_queue, &wait);
170
171 set_current_state(TASK_INTERRUPTIBLE);
172 while ((p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) {
173 schedule();
174 set_current_state(TASK_INTERRUPTIBLE);
175 }
176
177 set_current_state(TASK_RUNNING);
178 remove_wait_queue(&channel_wqs[index].lx_queue, &wait);
179
180 /* back running */
181 } else {
182 printk( KERN_DEBUG "No SP program loaded, and device "
183 "opened with O_NONBLOCK\n");
184 channel_wqs[index].in_open = 0;
185 return -ENOSYS;
186 }
133 } 187 }
134 188
135 if (*p == NULL) { 189 if (*p == NULL) {
136 printk(KERN_ERR "vpe_shared %p %p\n", p, *p); 190 if (can_sleep) {
137 return -EFAULT; 191 DECLARE_WAITQUEUE(wait, current);
192
193 /* go to sleep */
194 add_wait_queue(&channel_wqs[index].lx_queue, &wait);
195
196 set_current_state(TASK_INTERRUPTIBLE);
197 while (*p == NULL) {
198 schedule();
199
200 /* reset task state to interruptable otherwise
201 we'll whizz round here like a very fast loopy
202 thing. schedule() appears to return with state
203 set to TASK_RUNNING.
204
205 If the loaded SP program, for whatever reason,
206 doesn't set up the shared structure *p will never
207 become true. So whoever connected to either /dev/rt?
208 or if it was kspd, will then take up rather a lot of
209 processor cycles.
210 */
211
212 set_current_state(TASK_INTERRUPTIBLE);
213 }
214
215 set_current_state(TASK_RUNNING);
216 remove_wait_queue(&channel_wqs[index].lx_queue, &wait);
217
218 /* back running */
219 }
220 else {
221 printk(" *vpe_get_shared is NULL. "
222 "Has an SP program been loaded?\n");
223 channel_wqs[index].in_open = 0;
224 return -ENOSYS;
225 }
226 }
227
228 if ((unsigned int)*p < KSEG0) {
229 printk(KERN_WARNING "vpe_get_shared returned an invalid pointer "
230 "maybe an error code %d\n", (int)*p);
231 channel_wqs[index].in_open = 0;
232 return -ENOSYS;
138 } 233 }
139 234
140 if ((ret = rtlx_init(*p)) < 0) 235 if ((ret = rtlx_init(*p)) < 0) {
141 return ret; 236 channel_wqs[index].in_open = 0;
237 return ret;
238 }
142 } 239 }
143 240
144 chan = &rtlx->channel[minor]; 241 chan = &rtlx->channel[index];
145 242
146 if (test_and_set_bit(RTLX_STATE_OPENED, &chan->lx_state)) 243 if (chan->lx_state == RTLX_STATE_OPENED) {
147 return -EBUSY; 244 channel_wqs[index].in_open = 0;
245 return -EBUSY;
246 }
148 247
248 chan->lx_state = RTLX_STATE_OPENED;
249 channel_wqs[index].in_open = 0;
149 return 0; 250 return 0;
150} 251}
151 252
152static int rtlx_release(struct inode *inode, struct file *filp) 253int rtlx_release(int index)
153{ 254{
154 int minor = MINOR(inode->i_rdev); 255 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED;
155
156 clear_bit(RTLX_STATE_OPENED, &rtlx->channel[minor].lx_state);
157 smp_mb__after_clear_bit();
158
159 return 0; 256 return 0;
160} 257}
161 258
162static unsigned int rtlx_poll(struct file *file, poll_table * wait) 259unsigned int rtlx_read_poll(int index, int can_sleep)
163{ 260{
164 int minor; 261 struct rtlx_channel *chan;
165 unsigned int mask = 0;
166 struct rtlx_channel *chan;
167 262
168 minor = MINOR(file->f_dentry->d_inode->i_rdev); 263 if (rtlx == NULL)
169 chan = &rtlx->channel[minor]; 264 return 0;
170 265
171 poll_wait(file, &channel_wqs[minor].rt_queue, wait); 266 chan = &rtlx->channel[index];
172 poll_wait(file, &channel_wqs[minor].lx_queue, wait);
173 267
174 /* data available to read? */ 268 /* data available to read? */
175 if (chan->lx_read != chan->lx_write) 269 if (chan->lx_read == chan->lx_write) {
176 mask |= POLLIN | POLLRDNORM; 270 if (can_sleep) {
271 DECLARE_WAITQUEUE(wait, current);
177 272
178 /* space to write */ 273 /* go to sleep */
179 if (spacefree(chan->rt_read, chan->rt_write, chan->buffer_size)) 274 add_wait_queue(&channel_wqs[index].lx_queue, &wait);
180 mask |= POLLOUT | POLLWRNORM;
181 275
182 return mask; 276 set_current_state(TASK_INTERRUPTIBLE);
277 while (chan->lx_read == chan->lx_write) {
278 schedule();
279
280 set_current_state(TASK_INTERRUPTIBLE);
281
282 if (sp_stopping) {
283 set_current_state(TASK_RUNNING);
284 remove_wait_queue(&channel_wqs[index].lx_queue, &wait);
285 return 0;
286 }
287 }
288
289 set_current_state(TASK_RUNNING);
290 remove_wait_queue(&channel_wqs[index].lx_queue, &wait);
291
292 /* back running */
293 }
294 else
295 return 0;
296 }
297
298 return (chan->lx_write + chan->buffer_size - chan->lx_read)
299 % chan->buffer_size;
183} 300}
184 301
185static ssize_t rtlx_read(struct file *file, char __user * buffer, size_t count, 302static inline int write_spacefree(int read, int write, int size)
186 loff_t * ppos)
187{ 303{
188 unsigned long failed; 304 if (read == write) {
189 size_t fl = 0L; 305 /*
190 int minor; 306 * Never fill the buffer completely, so indexes are always
191 struct rtlx_channel *lx; 307 * equal if empty and only empty, or !equal if data available
192 DECLARE_WAITQUEUE(wait, current); 308 */
309 return size - 1;
310 }
193 311
194 minor = MINOR(file->f_dentry->d_inode->i_rdev); 312 return ((read + size - write) % size) - 1;
195 lx = &rtlx->channel[minor]; 313}
196 314
197 /* data available? */ 315unsigned int rtlx_write_poll(int index)
198 if (lx->lx_write == lx->lx_read) { 316{
199 if (file->f_flags & O_NONBLOCK) 317 struct rtlx_channel *chan = &rtlx->channel[index];
200 return 0; /* -EAGAIN makes cat whinge */ 318 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size);
319}
201 320
202 /* go to sleep */ 321static inline void copy_to(void *dst, void *src, size_t count, int user)
203 add_wait_queue(&channel_wqs[minor].lx_queue, &wait); 322{
204 set_current_state(TASK_INTERRUPTIBLE); 323 if (user)
324 copy_to_user(dst, src, count);
325 else
326 memcpy(dst, src, count);
327}
205 328
206 while (lx->lx_write == lx->lx_read) 329static inline void copy_from(void *dst, void *src, size_t count, int user)
207 schedule(); 330{
331 if (user)
332 copy_from_user(dst, src, count);
333 else
334 memcpy(dst, src, count);
335}
208 336
209 set_current_state(TASK_RUNNING); 337ssize_t rtlx_read(int index, void *buff, size_t count, int user)
210 remove_wait_queue(&channel_wqs[minor].lx_queue, &wait); 338{
339 size_t fl = 0L;
340 struct rtlx_channel *lx;
211 341
212 /* back running */ 342 if (rtlx == NULL)
213 } 343 return -ENOSYS;
344
345 lx = &rtlx->channel[index];
214 346
215 /* find out how much in total */ 347 /* find out how much in total */
216 count = min(count, 348 count = min(count,
217 (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) % lx->buffer_size); 349 (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read)
350 % lx->buffer_size);
218 351
219 /* then how much from the read pointer onwards */ 352 /* then how much from the read pointer onwards */
220 fl = min(count, (size_t)lx->buffer_size - lx->lx_read); 353 fl = min( count, (size_t)lx->buffer_size - lx->lx_read);
221 354
222 failed = copy_to_user (buffer, &lx->lx_buffer[lx->lx_read], fl); 355 copy_to(buff, &lx->lx_buffer[lx->lx_read], fl, user);
223 if (failed) {
224 count = fl - failed;
225 goto out;
226 }
227 356
228 /* and if there is anything left at the beginning of the buffer */ 357 /* and if there is anything left at the beginning of the buffer */
229 if (count - fl) { 358 if ( count - fl )
230 failed = copy_to_user (buffer + fl, lx->lx_buffer, count - fl); 359 copy_to (buff + fl, lx->lx_buffer, count - fl, user);
231 if (failed) {
232 count -= failed;
233 goto out;
234 }
235 }
236 360
237out:
238 /* update the index */ 361 /* update the index */
239 lx->lx_read += count; 362 lx->lx_read += count;
240 lx->lx_read %= lx->buffer_size; 363 lx->lx_read %= lx->buffer_size;
@@ -242,20 +365,101 @@ out:
242 return count; 365 return count;
243} 366}
244 367
245static ssize_t rtlx_write(struct file *file, const char __user * buffer, 368ssize_t rtlx_write(int index, void *buffer, size_t count, int user)
369{
370 struct rtlx_channel *rt;
371 size_t fl;
372
373 if (rtlx == NULL)
374 return(-ENOSYS);
375
376 rt = &rtlx->channel[index];
377
378 /* total number of bytes to copy */
379 count = min(count,
380 (size_t)write_spacefree(rt->rt_read, rt->rt_write,
381 rt->buffer_size));
382
383 /* first bit from write pointer to the end of the buffer, or count */
384 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
385
386 copy_from (&rt->rt_buffer[rt->rt_write], buffer, fl, user);
387
388 /* if there's any left copy to the beginning of the buffer */
389 if( count - fl )
390 copy_from (rt->rt_buffer, buffer + fl, count - fl, user);
391
392 rt->rt_write += count;
393 rt->rt_write %= rt->buffer_size;
394
395 return(count);
396}
397
398
399static int file_open(struct inode *inode, struct file *filp)
400{
401 int minor = MINOR(inode->i_rdev);
402
403 return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
404}
405
406static int file_release(struct inode *inode, struct file *filp)
407{
408 int minor;
409 minor = MINOR(inode->i_rdev);
410
411 return rtlx_release(minor);
412}
413
414static unsigned int file_poll(struct file *file, poll_table * wait)
415{
416 int minor;
417 unsigned int mask = 0;
418
419 minor = MINOR(file->f_dentry->d_inode->i_rdev);
420
421 poll_wait(file, &channel_wqs[minor].rt_queue, wait);
422 poll_wait(file, &channel_wqs[minor].lx_queue, wait);
423
424 if (rtlx == NULL)
425 return 0;
426
427 /* data available to read? */
428 if (rtlx_read_poll(minor, 0))
429 mask |= POLLIN | POLLRDNORM;
430
431 /* space to write */
432 if (rtlx_write_poll(minor))
433 mask |= POLLOUT | POLLWRNORM;
434
435 return mask;
436}
437
438static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
439 loff_t * ppos)
440{
441 int minor = MINOR(file->f_dentry->d_inode->i_rdev);
442
443 /* data available? */
444 if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) {
445 return 0; // -EAGAIN makes cat whinge
446 }
447
448 return rtlx_read(minor, buffer, count, 1);
449}
450
451static ssize_t file_write(struct file *file, const char __user * buffer,
246 size_t count, loff_t * ppos) 452 size_t count, loff_t * ppos)
247{ 453{
248 unsigned long failed;
249 int minor; 454 int minor;
250 struct rtlx_channel *rt; 455 struct rtlx_channel *rt;
251 size_t fl;
252 DECLARE_WAITQUEUE(wait, current); 456 DECLARE_WAITQUEUE(wait, current);
253 457
254 minor = MINOR(file->f_dentry->d_inode->i_rdev); 458 minor = MINOR(file->f_dentry->d_inode->i_rdev);
255 rt = &rtlx->channel[minor]; 459 rt = &rtlx->channel[minor];
256 460
257 /* any space left... */ 461 /* any space left... */
258 if (!spacefree(rt->rt_read, rt->rt_write, rt->buffer_size)) { 462 if (!rtlx_write_poll(minor)) {
259 463
260 if (file->f_flags & O_NONBLOCK) 464 if (file->f_flags & O_NONBLOCK)
261 return -EAGAIN; 465 return -EAGAIN;
@@ -263,61 +467,64 @@ static ssize_t rtlx_write(struct file *file, const char __user * buffer,
263 add_wait_queue(&channel_wqs[minor].rt_queue, &wait); 467 add_wait_queue(&channel_wqs[minor].rt_queue, &wait);
264 set_current_state(TASK_INTERRUPTIBLE); 468 set_current_state(TASK_INTERRUPTIBLE);
265 469
266 while (!spacefree(rt->rt_read, rt->rt_write, rt->buffer_size)) 470 while (!rtlx_write_poll(minor))
267 schedule(); 471 schedule();
268 472
269 set_current_state(TASK_RUNNING); 473 set_current_state(TASK_RUNNING);
270 remove_wait_queue(&channel_wqs[minor].rt_queue, &wait); 474 remove_wait_queue(&channel_wqs[minor].rt_queue, &wait);
271 } 475 }
272 476
273 /* total number of bytes to copy */ 477 return rtlx_write(minor, (void *)buffer, count, 1);
274 count = min(count, (size_t)spacefree(rt->rt_read, rt->rt_write, rt->buffer_size) );
275
276 /* first bit from write pointer to the end of the buffer, or count */
277 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
278
279 failed = copy_from_user(&rt->rt_buffer[rt->rt_write], buffer, fl);
280 if (failed) {
281 count = fl - failed;
282 goto out;
283 }
284
285 /* if there's any left copy to the beginning of the buffer */
286 if (count - fl) {
287 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
288 if (failed) {
289 count -= failed;
290 goto out;
291 }
292 }
293
294out:
295 rt->rt_write += count;
296 rt->rt_write %= rt->buffer_size;
297
298 return count;
299} 478}
300 479
301static struct file_operations rtlx_fops = { 480static struct file_operations rtlx_fops = {
302 .owner = THIS_MODULE, 481 .owner = THIS_MODULE,
303 .open = rtlx_open, 482 .open = file_open,
304 .release = rtlx_release, 483 .release = file_release,
305 .write = rtlx_write, 484 .write = file_write,
306 .read = rtlx_read, 485 .read = file_read,
307 .poll = rtlx_poll 486 .poll = file_poll
308}; 487};
309 488
489static struct irqaction rtlx_irq = {
490 .handler = rtlx_interrupt,
491 .flags = SA_INTERRUPT,
492 .name = "RTLX",
493};
494
495static int rtlx_irq_num = MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ;
496
310static char register_chrdev_failed[] __initdata = 497static char register_chrdev_failed[] __initdata =
311 KERN_ERR "rtlx_module_init: unable to register device\n"; 498 KERN_ERR "rtlx_module_init: unable to register device\n";
312 499
313static int __init rtlx_module_init(void) 500static int rtlx_module_init(void)
314{ 501{
502 int i;
503
315 major = register_chrdev(0, module_name, &rtlx_fops); 504 major = register_chrdev(0, module_name, &rtlx_fops);
316 if (major < 0) { 505 if (major < 0) {
317 printk(register_chrdev_failed); 506 printk(register_chrdev_failed);
318 return major; 507 return major;
319 } 508 }
320 509
510 /* initialise the wait queues */
511 for (i = 0; i < RTLX_CHANNELS; i++) {
512 init_waitqueue_head(&channel_wqs[i].rt_queue);
513 init_waitqueue_head(&channel_wqs[i].lx_queue);
514 channel_wqs[i].in_open = 0;
515 }
516
517 /* set up notifiers */
518 notify.start = starting;
519 notify.stop = stopping;
520 vpe_notify(RTLX_TARG_VPE, &notify);
521
522 if (cpu_has_vint)
523 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
524
525 rtlx_irq.dev_id = rtlx;
526 setup_irq(rtlx_irq_num, &rtlx_irq);
527
321 return 0; 528 return 0;
322} 529}
323 530
@@ -330,5 +537,5 @@ module_init(rtlx_module_init);
330module_exit(rtlx_module_exit); 537module_exit(rtlx_module_exit);
331 538
332MODULE_DESCRIPTION("MIPS RTLX"); 539MODULE_DESCRIPTION("MIPS RTLX");
333MODULE_AUTHOR("Elizabeth Clarke, MIPS Technologies, Inc."); 540MODULE_AUTHOR("Elizabeth Oldham, MIPS Technologies, Inc.");
334MODULE_LICENSE("GPL"); 541MODULE_LICENSE("GPL");
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 2f2dc54b2e26..a0ac0e5f61ad 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -569,8 +569,19 @@ einval: li v0, -EINVAL
569 sys sys_tkill 2 569 sys sys_tkill 2
570 sys sys_sendfile64 5 570 sys sys_sendfile64 5
571 sys sys_futex 6 571 sys sys_futex 6
572#ifdef CONFIG_MIPS_MT_FPAFF
573 /*
574 * For FPU affinity scheduling on MIPS MT processors, we need to
575 * intercept sys_sched_xxxaffinity() calls until we get a proper hook
576 * in kernel/sched.c. Considered only temporary we only support these
577 * hooks for the 32-bit kernel - there is no MIPS64 MT processor atm.
578 */
579 sys mipsmt_sys_sched_setaffinity 3
580 sys mipsmt_sys_sched_getaffinity 3
581#else
572 sys sys_sched_setaffinity 3 582 sys sys_sched_setaffinity 3
573 sys sys_sched_getaffinity 3 /* 4240 */ 583 sys sys_sched_getaffinity 3 /* 4240 */
584#endif /* CONFIG_MIPS_MT_FPAFF */
574 sys sys_io_setup 2 585 sys sys_io_setup 2
575 sys sys_io_destroy 1 586 sys sys_io_destroy 1
576 sys sys_io_getevents 5 587 sys sys_io_getevents 5
@@ -634,6 +645,8 @@ einval: li v0, -EINVAL
634 sys sys_pselect6 6 645 sys sys_pselect6 6
635 sys sys_ppoll 5 646 sys sys_ppoll 5
636 sys sys_unshare 1 647 sys sys_unshare 1
648 sys sys_splice 4
649 sys sys_sync_file_range 7 /* 4305 */
637 .endm 650 .endm
638 651
639 /* We pre-compute the number of _instruction_ bytes needed to 652 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 98bf25df56f3..9ba750887377 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -460,3 +460,5 @@ sys_call_table:
460 PTR sys_pselect6 /* 5260 */ 460 PTR sys_pselect6 /* 5260 */
461 PTR sys_ppoll 461 PTR sys_ppoll
462 PTR sys_unshare 462 PTR sys_unshare
463 PTR sys_splice
464 PTR sys_sync_file_range
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 05a2c0567dae..942aca26f9c4 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -386,3 +386,5 @@ EXPORT(sysn32_call_table)
386 PTR sys_pselect6 386 PTR sys_pselect6
387 PTR sys_ppoll /* 6265 */ 387 PTR sys_ppoll /* 6265 */
388 PTR sys_unshare 388 PTR sys_unshare
389 PTR sys_splice
390 PTR sys_sync_file_range
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 19c4ca481b02..b53a9207f530 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -508,4 +508,6 @@ sys_call_table:
508 PTR sys_pselect6 508 PTR sys_pselect6
509 PTR sys_ppoll 509 PTR sys_ppoll
510 PTR sys_unshare 510 PTR sys_unshare
511 PTR sys_splice
512 PTR sys32_sync_file_range /* 4305 */
511 .size sys_call_table,.-sys_call_table 513 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index dcbfd27071f0..bcf1b10e518f 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -529,7 +529,10 @@ void __init setup_arch(char **cmdline_p)
529 529
530int __init fpu_disable(char *s) 530int __init fpu_disable(char *s)
531{ 531{
532 cpu_data[0].options &= ~MIPS_CPU_FPU; 532 int i;
533
534 for (i = 0; i < NR_CPUS; i++)
535 cpu_data[i].options &= ~MIPS_CPU_FPU;
533 536
534 return 1; 537 return 1;
535} 538}
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp-mt.c
index 993b8bf56aaf..57770902b9ae 100644
--- a/arch/mips/kernel/smp_mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -1,8 +1,4 @@
1/* 1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * Elizabeth Clarke (beth@mips.com)
5 *
6 * This program is free software; you can distribute it and/or modify it 2 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as 3 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation. 4 * published by the Free Software Foundation.
@@ -16,6 +12,10 @@
16 * with this program; if not, write to the Free Software Foundation, Inc., 12 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 * 14 *
15 * Copyright (C) 2004, 05, 06 MIPS Technologies, Inc.
16 * Elizabeth Clarke (beth@mips.com)
17 * Ralf Baechle (ralf@linux-mips.org)
18 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
19 */ 19 */
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
@@ -24,6 +24,7 @@
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25 25
26#include <asm/atomic.h> 26#include <asm/atomic.h>
27#include <asm/cacheflush.h>
27#include <asm/cpu.h> 28#include <asm/cpu.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/system.h> 30#include <asm/system.h>
@@ -33,8 +34,8 @@
33#include <asm/time.h> 34#include <asm/time.h>
34#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
35#include <asm/mipsmtregs.h> 36#include <asm/mipsmtregs.h>
36#include <asm/cacheflush.h> 37#include <asm/mips_mt.h>
37#include <asm/mips-boards/maltaint.h> 38#include <asm/mips-boards/maltaint.h> /* This is f*cking wrong */
38 39
39#define MIPS_CPU_IPI_RESCHED_IRQ 0 40#define MIPS_CPU_IPI_RESCHED_IRQ 0
40#define MIPS_CPU_IPI_CALL_IRQ 1 41#define MIPS_CPU_IPI_CALL_IRQ 1
@@ -66,6 +67,7 @@ void __init sanitize_tlb_entries(void)
66 if (!cpu_has_mipsmt) 67 if (!cpu_has_mipsmt)
67 return; 68 return;
68 69
70 /* Enable VPC */
69 set_c0_mvpcontrol(MVPCONTROL_VPC); 71 set_c0_mvpcontrol(MVPCONTROL_VPC);
70 72
71 back_to_back_c0_hazard(); 73 back_to_back_c0_hazard();
@@ -106,12 +108,12 @@ void __init sanitize_tlb_entries(void)
106 108
107static void ipi_resched_dispatch (struct pt_regs *regs) 109static void ipi_resched_dispatch (struct pt_regs *regs)
108{ 110{
109 do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs); 111 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ, regs);
110} 112}
111 113
112static void ipi_call_dispatch (struct pt_regs *regs) 114static void ipi_call_dispatch (struct pt_regs *regs)
113{ 115{
114 do_IRQ(MIPS_CPU_IPI_CALL_IRQ, regs); 116 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ, regs);
115} 117}
116 118
117irqreturn_t ipi_resched_interrupt(int irq, void *dev_id, struct pt_regs *regs) 119irqreturn_t ipi_resched_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -148,6 +150,11 @@ void plat_smp_setup(void)
148 unsigned long val; 150 unsigned long val;
149 int i, num; 151 int i, num;
150 152
153#ifdef CONFIG_MIPS_MT_FPAFF
154 /* If we have an FPU, enroll ourselves in the FPU-full mask */
155 if (cpu_has_fpu)
156 cpu_set(0, mt_fpu_cpumask);
157#endif /* CONFIG_MIPS_MT_FPAFF */
151 if (!cpu_has_mipsmt) 158 if (!cpu_has_mipsmt)
152 return; 159 return;
153 160
@@ -155,6 +162,8 @@ void plat_smp_setup(void)
155 dvpe(); 162 dvpe();
156 dmt(); 163 dmt();
157 164
165 mips_mt_set_cpuoptions();
166
158 /* Put MVPE's into 'configuration state' */ 167 /* Put MVPE's into 'configuration state' */
159 set_c0_mvpcontrol(MVPCONTROL_VPC); 168 set_c0_mvpcontrol(MVPCONTROL_VPC);
160 169
@@ -189,11 +198,13 @@ void plat_smp_setup(void)
189 198
190 if (i != 0) { 199 if (i != 0) {
191 write_vpe_c0_status((read_c0_status() & ~(ST0_IM | ST0_IE | ST0_KSU)) | ST0_CU0); 200 write_vpe_c0_status((read_c0_status() & ~(ST0_IM | ST0_IE | ST0_KSU)) | ST0_CU0);
192 write_vpe_c0_cause(read_vpe_c0_cause() & ~CAUSEF_IP);
193 201
194 /* set config to be the same as vpe0, particularly kseg0 coherency alg */ 202 /* set config to be the same as vpe0, particularly kseg0 coherency alg */
195 write_vpe_c0_config( read_c0_config()); 203 write_vpe_c0_config( read_c0_config());
196 204
205 /* make sure there are no software interrupts pending */
206 write_vpe_c0_cause(read_vpe_c0_cause() & ~(C_SW1|C_SW0));
207
197 /* Propagate Config7 */ 208 /* Propagate Config7 */
198 write_vpe_c0_config7(read_c0_config7()); 209 write_vpe_c0_config7(read_c0_config7());
199 } 210 }
@@ -233,16 +244,16 @@ void plat_smp_setup(void)
233 /* We'll wait until starting the secondaries before starting MVPE */ 244 /* We'll wait until starting the secondaries before starting MVPE */
234 245
235 printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); 246 printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num);
247}
236 248
249void __init plat_prepare_cpus(unsigned int max_cpus)
250{
237 /* set up ipi interrupts */ 251 /* set up ipi interrupts */
238 if (cpu_has_vint) { 252 if (cpu_has_vint) {
239 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 253 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch);
240 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 254 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch);
241 } 255 }
242}
243 256
244void __init plat_prepare_cpus(unsigned int max_cpus)
245{
246 cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 257 cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
247 cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ; 258 cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ;
248 259
@@ -287,7 +298,8 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
287 /* global pointer */ 298 /* global pointer */
288 write_tc_gpr_gp((unsigned long)gp); 299 write_tc_gpr_gp((unsigned long)gp);
289 300
290 flush_icache_range((unsigned long)gp, (unsigned long)(gp + 1)); 301 flush_icache_range((unsigned long)gp,
302 (unsigned long)(gp + sizeof(struct thread_info)));
291 303
292 /* finally out of configuration and into chaos */ 304 /* finally out of configuration and into chaos */
293 clear_c0_mvpcontrol(MVPCONTROL_VPC); 305 clear_c0_mvpcontrol(MVPCONTROL_VPC);
@@ -305,6 +317,12 @@ void prom_smp_finish(void)
305{ 317{
306 write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ)); 318 write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ));
307 319
320#ifdef CONFIG_MIPS_MT_FPAFF
321 /* If we have an FPU, enroll ourselves in the FPU-full mask */
322 if (cpu_has_fpu)
323 cpu_set(smp_processor_id(), mt_fpu_cpumask);
324#endif /* CONFIG_MIPS_MT_FPAFF */
325
308 local_irq_enable(); 326 local_irq_enable();
309} 327}
310 328
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 78d171bfa331..d42f358754ad 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -38,6 +38,10 @@
38#include <asm/mmu_context.h> 38#include <asm/mmu_context.h>
39#include <asm/smp.h> 39#include <asm/smp.h>
40 40
41#ifdef CONFIG_MIPS_MT_SMTC
42#include <asm/mipsmtregs.h>
43#endif /* CONFIG_MIPS_MT_SMTC */
44
41cpumask_t phys_cpu_present_map; /* Bitmask of available CPUs */ 45cpumask_t phys_cpu_present_map; /* Bitmask of available CPUs */
42volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ 46volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
43cpumask_t cpu_online_map; /* Bitmask of currently online CPUs */ 47cpumask_t cpu_online_map; /* Bitmask of currently online CPUs */
@@ -85,6 +89,10 @@ asmlinkage void start_secondary(void)
85{ 89{
86 unsigned int cpu; 90 unsigned int cpu;
87 91
92#ifdef CONFIG_MIPS_MT_SMTC
93 /* Only do cpu_probe for first TC of CPU */
94 if ((read_c0_tcbind() & TCBIND_CURTC) == 0)
95#endif /* CONFIG_MIPS_MT_SMTC */
88 cpu_probe(); 96 cpu_probe();
89 cpu_report(); 97 cpu_report();
90 per_cpu_trap_init(); 98 per_cpu_trap_init();
@@ -179,11 +187,13 @@ int smp_call_function (void (*func) (void *info), void *info, int retry,
179 if (wait) 187 if (wait)
180 while (atomic_read(&data.finished) != cpus) 188 while (atomic_read(&data.finished) != cpus)
181 barrier(); 189 barrier();
190 call_data = NULL;
182 spin_unlock(&smp_call_lock); 191 spin_unlock(&smp_call_lock);
183 192
184 return 0; 193 return 0;
185} 194}
186 195
196
187void smp_call_function_interrupt(void) 197void smp_call_function_interrupt(void)
188{ 198{
189 void (*func) (void *info) = call_data->func; 199 void (*func) (void *info) = call_data->func;
@@ -446,5 +456,3 @@ subsys_initcall(topology_init);
446 456
447EXPORT_SYMBOL(flush_tlb_page); 457EXPORT_SYMBOL(flush_tlb_page);
448EXPORT_SYMBOL(flush_tlb_one); 458EXPORT_SYMBOL(flush_tlb_one);
449EXPORT_SYMBOL(cpu_data);
450EXPORT_SYMBOL(synchronize_irq);
diff --git a/arch/mips/kernel/smtc-asm.S b/arch/mips/kernel/smtc-asm.S
new file mode 100644
index 000000000000..c9d65196d917
--- /dev/null
+++ b/arch/mips/kernel/smtc-asm.S
@@ -0,0 +1,130 @@
1/*
2 * Assembly Language Functions for MIPS MT SMTC support
3 */
4
5/*
6 * This file should be built into the kernel only if CONFIG_MIPS_MT_SMTC is set. */
7
8#include <asm/regdef.h>
9#include <asm/asmmacro.h>
10#include <asm/stackframe.h>
11#include <asm/stackframe.h>
12
13/*
14 * "Software Interrupt" linkage.
15 *
16 * This is invoked when an "Interrupt" is sent from one TC to another,
17 * where the TC to be interrupted is halted, has it's Restart address
18 * and Status values saved by the "remote control" thread, then modified
19 * to cause execution to begin here, in kenel mode. This code then
20 * disguises the TC state as that of an exception and transfers
21 * control to the general exception or vectored interrupt handler.
22 */
23 .set noreorder
24
25/*
26The __smtc_ipi_vector would use k0 and k1 as temporaries and
271) Set EXL (this is per-VPE, so this can't be done by proxy!)
282) Restore the K/CU and IXMT bits to the pre "exception" state
29 (EXL means no interrupts and access to the kernel map).
303) Set EPC to be the saved value of TCRestart.
314) Jump to the exception handler entry point passed by the sender.
32
33CAN WE PROVE THAT WE WON'T DO THIS IF INTS DISABLED??
34*/
35
36/*
37 * Reviled and slandered vision: Set EXL and restore K/CU/IXMT
38 * state of pre-halt thread, then save everything and call
39 * thought some function pointer to imaginary_exception, which
40 * will parse a register value or memory message queue to
41 * deliver things like interprocessor interrupts. On return
42 * from that function, jump to the global ret_from_irq code
43 * to invoke the scheduler and return as appropriate.
44 */
45
46#define PT_PADSLOT4 (PT_R0-8)
47#define PT_PADSLOT5 (PT_R0-4)
48
49 .text
50 .align 5
51FEXPORT(__smtc_ipi_vector)
52 .set noat
53 /* Disable thread scheduling to make Status update atomic */
54 DMT 27 # dmt k1
55 ehb
56 /* Set EXL */
57 mfc0 k0,CP0_STATUS
58 ori k0,k0,ST0_EXL
59 mtc0 k0,CP0_STATUS
60 ehb
61 /* Thread scheduling now inhibited by EXL. Restore TE state. */
62 andi k1,k1,VPECONTROL_TE
63 beqz k1,1f
64 emt
651:
66 /*
67 * The IPI sender has put some information on the anticipated
68 * kernel stack frame. If we were in user mode, this will be
69 * built above the saved kernel SP. If we were already in the
70 * kernel, it will be built above the current CPU SP.
71 *
72 * Were we in kernel mode, as indicated by CU0?
73 */
74 sll k1,k0,3
75 .set noreorder
76 bltz k1,2f
77 move k1,sp
78 .set reorder
79 /*
80 * If previously in user mode, set CU0 and use kernel stack.
81 */
82 li k1,ST0_CU0
83 or k1,k1,k0
84 mtc0 k1,CP0_STATUS
85 ehb
86 get_saved_sp
87 /* Interrupting TC will have pre-set values in slots in the new frame */
882: subu k1,k1,PT_SIZE
89 /* Load TCStatus Value */
90 lw k0,PT_TCSTATUS(k1)
91 /* Write it to TCStatus to restore CU/KSU/IXMT state */
92 mtc0 k0,$2,1
93 ehb
94 lw k0,PT_EPC(k1)
95 mtc0 k0,CP0_EPC
96 /* Save all will redundantly recompute the SP, but use it for now */
97 SAVE_ALL
98 CLI
99 move a0,sp
100 /* Function to be invoked passed stack pad slot 5 */
101 lw t0,PT_PADSLOT5(sp)
102 /* Argument from sender passed in stack pad slot 4 */
103 lw a1,PT_PADSLOT4(sp)
104 jalr t0
105 nop
106 j ret_from_irq
107 nop
108
109/*
110 * Called from idle loop to provoke processing of queued IPIs
111 * First IPI message in queue passed as argument.
112 */
113
114LEAF(self_ipi)
115 /* Before anything else, block interrupts */
116 mfc0 t0,CP0_TCSTATUS
117 ori t1,t0,TCSTATUS_IXMT
118 mtc0 t1,CP0_TCSTATUS
119 ehb
120 /* We know we're in kernel mode, so prepare stack frame */
121 subu t1,sp,PT_SIZE
122 sw ra,PT_EPC(t1)
123 sw a0,PT_PADSLOT4(t1)
124 la t2,ipi_decode
125 sw t2,PT_PADSLOT5(t1)
126 /* Save pre-disable value of TCStatus */
127 sw t0,PT_TCSTATUS(t1)
128 j __smtc_ipi_vector
129 nop
130END(self_ipi)
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
new file mode 100644
index 000000000000..6f3709996172
--- /dev/null
+++ b/arch/mips/kernel/smtc-proc.c
@@ -0,0 +1,93 @@
1/*
2 * /proc hooks for SMTC kernel
3 * Copyright (C) 2005 Mips Technologies, Inc
4 */
5
6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/cpumask.h>
9#include <linux/interrupt.h>
10
11#include <asm/cpu.h>
12#include <asm/processor.h>
13#include <asm/atomic.h>
14#include <asm/system.h>
15#include <asm/hardirq.h>
16#include <asm/mmu_context.h>
17#include <asm/smp.h>
18#include <asm/mipsregs.h>
19#include <asm/cacheflush.h>
20#include <linux/proc_fs.h>
21
22#include <asm/smtc_proc.h>
23
24/*
25 * /proc diagnostic and statistics hooks
26 */
27
28/*
29 * Statistics gathered
30 */
31unsigned long selfipis[NR_CPUS];
32
33struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
34
35static struct proc_dir_entry *smtc_stats;
36
37atomic_t smtc_fpu_recoveries;
38
39static int proc_read_smtc(char *page, char **start, off_t off,
40 int count, int *eof, void *data)
41{
42 int totalen = 0;
43 int len;
44 int i;
45 extern unsigned long ebase;
46
47 len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status);
48 totalen += len;
49 page += len;
50 len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7());
51 totalen += len;
52 page += len;
53 len = sprintf(page, "EBASE: 0x%08lx\n", ebase);
54 totalen += len;
55 page += len;
56 len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n");
57 totalen += len;
58 page += len;
59 for (i=0; i < NR_CPUS; i++) {
60 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
61 totalen += len;
62 page += len;
63 }
64 len = sprintf(page, "Self-IPIs by CPU:\n");
65 totalen += len;
66 page += len;
67 for(i = 0; i < NR_CPUS; i++) {
68 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
69 totalen += len;
70 page += len;
71 }
72 len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n",
73 atomic_read(&smtc_fpu_recoveries));
74 totalen += len;
75 page += len;
76
77 return totalen;
78}
79
80void init_smtc_stats(void)
81{
82 int i;
83
84 for (i=0; i<NR_CPUS; i++) {
85 smtc_cpu_stats[i].timerints = 0;
86 smtc_cpu_stats[i].selfipis = 0;
87 }
88
89 atomic_set(&smtc_fpu_recoveries, 0);
90
91 smtc_stats = create_proc_read_entry("smtc", 0444, NULL,
92 proc_read_smtc, NULL);
93}
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
new file mode 100644
index 000000000000..2e8e52c135e6
--- /dev/null
+++ b/arch/mips/kernel/smtc.c
@@ -0,0 +1,1322 @@
1/* Copyright (C) 2004 Mips Technologies, Inc */
2
3#include <linux/kernel.h>
4#include <linux/sched.h>
5#include <linux/cpumask.h>
6#include <linux/interrupt.h>
7
8#include <asm/cpu.h>
9#include <asm/processor.h>
10#include <asm/atomic.h>
11#include <asm/system.h>
12#include <asm/hardirq.h>
13#include <asm/hazards.h>
14#include <asm/mmu_context.h>
15#include <asm/smp.h>
16#include <asm/mipsregs.h>
17#include <asm/cacheflush.h>
18#include <asm/time.h>
19#include <asm/addrspace.h>
20#include <asm/smtc.h>
21#include <asm/smtc_ipi.h>
22#include <asm/smtc_proc.h>
23
24/*
25 * This file should be built into the kernel only if CONFIG_MIPS_MT_SMTC is set.
26 */
27
28/*
29 * MIPSCPU_INT_BASE is identically defined in both
30 * asm-mips/mips-boards/maltaint.h and asm-mips/mips-boards/simint.h,
31 * but as yet there's no properly organized include structure that
32 * will ensure that the right *int.h file will be included for a
33 * given platform build.
34 */
35
36#define MIPSCPU_INT_BASE 16
37
38#define MIPS_CPU_IPI_IRQ 1
39
40#define LOCK_MT_PRA() \
41 local_irq_save(flags); \
42 mtflags = dmt()
43
44#define UNLOCK_MT_PRA() \
45 emt(mtflags); \
46 local_irq_restore(flags)
47
48#define LOCK_CORE_PRA() \
49 local_irq_save(flags); \
50 mtflags = dvpe()
51
52#define UNLOCK_CORE_PRA() \
53 evpe(mtflags); \
54 local_irq_restore(flags)
55
56/*
57 * Data structures purely associated with SMTC parallelism
58 */
59
60
61/*
62 * Table for tracking ASIDs whose lifetime is prolonged.
63 */
64
65asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
66
67/*
68 * Clock interrupt "latch" buffers, per "CPU"
69 */
70
71unsigned int ipi_timer_latch[NR_CPUS];
72
73/*
74 * Number of InterProcessor Interupt (IPI) message buffers to allocate
75 */
76
77#define IPIBUF_PER_CPU 4
78
79struct smtc_ipi_q IPIQ[NR_CPUS];
80struct smtc_ipi_q freeIPIq;
81
82
83/* Forward declarations */
84
85void ipi_decode(struct pt_regs *, struct smtc_ipi *);
86void post_direct_ipi(int cpu, struct smtc_ipi *pipi);
87void setup_cross_vpe_interrupts(void);
88void init_smtc_stats(void);
89
90/* Global SMTC Status */
91
92unsigned int smtc_status = 0;
93
94/* Boot command line configuration overrides */
95
96static int vpelimit = 0;
97static int tclimit = 0;
98static int ipibuffers = 0;
99static int nostlb = 0;
100static int asidmask = 0;
101unsigned long smtc_asid_mask = 0xff;
102
103static int __init maxvpes(char *str)
104{
105 get_option(&str, &vpelimit);
106 return 1;
107}
108
109static int __init maxtcs(char *str)
110{
111 get_option(&str, &tclimit);
112 return 1;
113}
114
115static int __init ipibufs(char *str)
116{
117 get_option(&str, &ipibuffers);
118 return 1;
119}
120
121static int __init stlb_disable(char *s)
122{
123 nostlb = 1;
124 return 1;
125}
126
127static int __init asidmask_set(char *str)
128{
129 get_option(&str, &asidmask);
130 switch(asidmask) {
131 case 0x1:
132 case 0x3:
133 case 0x7:
134 case 0xf:
135 case 0x1f:
136 case 0x3f:
137 case 0x7f:
138 case 0xff:
139 smtc_asid_mask = (unsigned long)asidmask;
140 break;
141 default:
142 printk("ILLEGAL ASID mask 0x%x from command line\n", asidmask);
143 }
144 return 1;
145}
146
147__setup("maxvpes=", maxvpes);
148__setup("maxtcs=", maxtcs);
149__setup("ipibufs=", ipibufs);
150__setup("nostlb", stlb_disable);
151__setup("asidmask=", asidmask_set);
152
153/* Enable additional debug checks before going into CPU idle loop */
154#define SMTC_IDLE_HOOK_DEBUG
155
156#ifdef SMTC_IDLE_HOOK_DEBUG
157
158static int hang_trig = 0;
159
160static int __init hangtrig_enable(char *s)
161{
162 hang_trig = 1;
163 return 1;
164}
165
166
167__setup("hangtrig", hangtrig_enable);
168
169#define DEFAULT_BLOCKED_IPI_LIMIT 32
170
171static int timerq_limit = DEFAULT_BLOCKED_IPI_LIMIT;
172
173static int __init tintq(char *str)
174{
175 get_option(&str, &timerq_limit);
176 return 1;
177}
178
179__setup("tintq=", tintq);
180
181int imstuckcount[2][8];
182/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
183int vpemask[2][8] = {{0,1,1,0,0,0,0,1},{0,1,0,0,0,0,0,1}};
184int tcnoprog[NR_CPUS];
185static atomic_t idle_hook_initialized = {0};
186static int clock_hang_reported[NR_CPUS];
187
188#endif /* SMTC_IDLE_HOOK_DEBUG */
189
190/* Initialize shared TLB - the should probably migrate to smtc_setup_cpus() */
191
192void __init sanitize_tlb_entries(void)
193{
194 printk("Deprecated sanitize_tlb_entries() invoked\n");
195}
196
197
198/*
199 * Configure shared TLB - VPC configuration bit must be set by caller
200 */
201
202void smtc_configure_tlb(void)
203{
204 int i,tlbsiz,vpes;
205 unsigned long mvpconf0;
206 unsigned long config1val;
207
208 /* Set up ASID preservation table */
209 for (vpes=0; vpes<MAX_SMTC_TLBS; vpes++) {
210 for(i = 0; i < MAX_SMTC_ASIDS; i++) {
211 smtc_live_asid[vpes][i] = 0;
212 }
213 }
214 mvpconf0 = read_c0_mvpconf0();
215
216 if ((vpes = ((mvpconf0 & MVPCONF0_PVPE)
217 >> MVPCONF0_PVPE_SHIFT) + 1) > 1) {
218 /* If we have multiple VPEs, try to share the TLB */
219 if ((mvpconf0 & MVPCONF0_TLBS) && !nostlb) {
220 /*
221 * If TLB sizing is programmable, shared TLB
222 * size is the total available complement.
223 * Otherwise, we have to take the sum of all
224 * static VPE TLB entries.
225 */
226 if ((tlbsiz = ((mvpconf0 & MVPCONF0_PTLBE)
227 >> MVPCONF0_PTLBE_SHIFT)) == 0) {
228 /*
229 * If there's more than one VPE, there had better
230 * be more than one TC, because we need one to bind
231 * to each VPE in turn to be able to read
232 * its configuration state!
233 */
234 settc(1);
235 /* Stop the TC from doing anything foolish */
236 write_tc_c0_tchalt(TCHALT_H);
237 mips_ihb();
238 /* No need to un-Halt - that happens later anyway */
239 for (i=0; i < vpes; i++) {
240 write_tc_c0_tcbind(i);
241 /*
242 * To be 100% sure we're really getting the right
243 * information, we exit the configuration state
244 * and do an IHB after each rebinding.
245 */
246 write_c0_mvpcontrol(
247 read_c0_mvpcontrol() & ~ MVPCONTROL_VPC );
248 mips_ihb();
249 /*
250 * Only count if the MMU Type indicated is TLB
251 */
252 if(((read_vpe_c0_config() & MIPS_CONF_MT) >> 7) == 1) {
253 config1val = read_vpe_c0_config1();
254 tlbsiz += ((config1val >> 25) & 0x3f) + 1;
255 }
256
257 /* Put core back in configuration state */
258 write_c0_mvpcontrol(
259 read_c0_mvpcontrol() | MVPCONTROL_VPC );
260 mips_ihb();
261 }
262 }
263 write_c0_mvpcontrol(read_c0_mvpcontrol() | MVPCONTROL_STLB);
264
265 /*
266 * Setup kernel data structures to use software total,
267 * rather than read the per-VPE Config1 value. The values
268 * for "CPU 0" gets copied to all the other CPUs as part
269 * of their initialization in smtc_cpu_setup().
270 */
271
272 tlbsiz = tlbsiz & 0x3f; /* MIPS32 limits TLB indices to 64 */
273 cpu_data[0].tlbsize = tlbsiz;
274 smtc_status |= SMTC_TLB_SHARED;
275
276 printk("TLB of %d entry pairs shared by %d VPEs\n",
277 tlbsiz, vpes);
278 } else {
279 printk("WARNING: TLB Not Sharable on SMTC Boot!\n");
280 }
281 }
282}
283
284
285/*
286 * Incrementally build the CPU map out of constituent MIPS MT cores,
287 * using the specified available VPEs and TCs. Plaform code needs
288 * to ensure that each MIPS MT core invokes this routine on reset,
289 * one at a time(!).
290 *
291 * This version of the build_cpu_map and prepare_cpus routines assumes
292 * that *all* TCs of a MIPS MT core will be used for Linux, and that
293 * they will be spread across *all* available VPEs (to minimise the
294 * loss of efficiency due to exception service serialization).
295 * An improved version would pick up configuration information and
296 * possibly leave some TCs/VPEs as "slave" processors.
297 *
298 * Use c0_MVPConf0 to find out how many TCs are available, setting up
299 * phys_cpu_present_map and the logical/physical mappings.
300 */
301
302int __init mipsmt_build_cpu_map(int start_cpu_slot)
303{
304 int i, ntcs;
305
306 /*
307 * The CPU map isn't actually used for anything at this point,
308 * so it's not clear what else we should do apart from set
309 * everything up so that "logical" = "physical".
310 */
311 ntcs = ((read_c0_mvpconf0() & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
312 for (i=start_cpu_slot; i<NR_CPUS && i<ntcs; i++) {
313 cpu_set(i, phys_cpu_present_map);
314 __cpu_number_map[i] = i;
315 __cpu_logical_map[i] = i;
316 }
317 /* Initialize map of CPUs with FPUs */
318 cpus_clear(mt_fpu_cpumask);
319
320 /* One of those TC's is the one booting, and not a secondary... */
321 printk("%i available secondary CPU TC(s)\n", i - 1);
322
323 return i;
324}
325
326/*
327 * Common setup before any secondaries are started
328 * Make sure all CPU's are in a sensible state before we boot any of the
329 * secondaries.
330 *
331 * For MIPS MT "SMTC" operation, we set up all TCs, spread as evenly
332 * as possible across the available VPEs.
333 */
334
335static void smtc_tc_setup(int vpe, int tc, int cpu)
336{
337 settc(tc);
338 write_tc_c0_tchalt(TCHALT_H);
339 mips_ihb();
340 write_tc_c0_tcstatus((read_tc_c0_tcstatus()
341 & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT))
342 | TCSTATUS_A);
343 write_tc_c0_tccontext(0);
344 /* Bind tc to vpe */
345 write_tc_c0_tcbind(vpe);
346 /* In general, all TCs should have the same cpu_data indications */
347 memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips));
348 /* For 34Kf, start with TC/CPU 0 as sole owner of single FPU context */
349 if (cpu_data[0].cputype == CPU_34K)
350 cpu_data[cpu].options &= ~MIPS_CPU_FPU;
351 cpu_data[cpu].vpe_id = vpe;
352 cpu_data[cpu].tc_id = tc;
353}
354
355
356void mipsmt_prepare_cpus(void)
357{
358 int i, vpe, tc, ntc, nvpe, tcpervpe, slop, cpu;
359 unsigned long flags;
360 unsigned long val;
361 int nipi;
362 struct smtc_ipi *pipi;
363
364 /* disable interrupts so we can disable MT */
365 local_irq_save(flags);
366 /* disable MT so we can configure */
367 dvpe();
368 dmt();
369
370 freeIPIq.lock = SPIN_LOCK_UNLOCKED;
371
372 /*
373 * We probably don't have as many VPEs as we do SMP "CPUs",
374 * but it's possible - and in any case we'll never use more!
375 */
376 for (i=0; i<NR_CPUS; i++) {
377 IPIQ[i].head = IPIQ[i].tail = NULL;
378 IPIQ[i].lock = SPIN_LOCK_UNLOCKED;
379 IPIQ[i].depth = 0;
380 ipi_timer_latch[i] = 0;
381 }
382
383 /* cpu_data index starts at zero */
384 cpu = 0;
385 cpu_data[cpu].vpe_id = 0;
386 cpu_data[cpu].tc_id = 0;
387 cpu++;
388
389 /* Report on boot-time options */
390 mips_mt_set_cpuoptions ();
391 if (vpelimit > 0)
392 printk("Limit of %d VPEs set\n", vpelimit);
393 if (tclimit > 0)
394 printk("Limit of %d TCs set\n", tclimit);
395 if (nostlb) {
396 printk("Shared TLB Use Inhibited - UNSAFE for Multi-VPE Operation\n");
397 }
398 if (asidmask)
399 printk("ASID mask value override to 0x%x\n", asidmask);
400
401 /* Temporary */
402#ifdef SMTC_IDLE_HOOK_DEBUG
403 if (hang_trig)
404 printk("Logic Analyser Trigger on suspected TC hang\n");
405#endif /* SMTC_IDLE_HOOK_DEBUG */
406
407 /* Put MVPE's into 'configuration state' */
408 write_c0_mvpcontrol( read_c0_mvpcontrol() | MVPCONTROL_VPC );
409
410 val = read_c0_mvpconf0();
411 nvpe = ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
412 if (vpelimit > 0 && nvpe > vpelimit)
413 nvpe = vpelimit;
414 ntc = ((val & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
415 if (ntc > NR_CPUS)
416 ntc = NR_CPUS;
417 if (tclimit > 0 && ntc > tclimit)
418 ntc = tclimit;
419 tcpervpe = ntc / nvpe;
420 slop = ntc % nvpe; /* Residual TCs, < NVPE */
421
422 /* Set up shared TLB */
423 smtc_configure_tlb();
424
425 for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) {
426 /*
427 * Set the MVP bits.
428 */
429 settc(tc);
430 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_MVP);
431 if (vpe != 0)
432 printk(", ");
433 printk("VPE %d: TC", vpe);
434 for (i = 0; i < tcpervpe; i++) {
435 /*
436 * TC 0 is bound to VPE 0 at reset,
437 * and is presumably executing this
438 * code. Leave it alone!
439 */
440 if (tc != 0) {
441 smtc_tc_setup(vpe,tc, cpu);
442 cpu++;
443 }
444 printk(" %d", tc);
445 tc++;
446 }
447 if (slop) {
448 if (tc != 0) {
449 smtc_tc_setup(vpe,tc, cpu);
450 cpu++;
451 }
452 printk(" %d", tc);
453 tc++;
454 slop--;
455 }
456 if (vpe != 0) {
457 /*
458 * Clear any stale software interrupts from VPE's Cause
459 */
460 write_vpe_c0_cause(0);
461
462 /*
463 * Clear ERL/EXL of VPEs other than 0
464 * and set restricted interrupt enable/mask.
465 */
466 write_vpe_c0_status((read_vpe_c0_status()
467 & ~(ST0_BEV | ST0_ERL | ST0_EXL | ST0_IM))
468 | (STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP7
469 | ST0_IE));
470 /*
471 * set config to be the same as vpe0,
472 * particularly kseg0 coherency alg
473 */
474 write_vpe_c0_config(read_c0_config());
475 /* Clear any pending timer interrupt */
476 write_vpe_c0_compare(0);
477 /* Propagate Config7 */
478 write_vpe_c0_config7(read_c0_config7());
479 }
480 /* enable multi-threading within VPE */
481 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE);
482 /* enable the VPE */
483 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
484 }
485
486 /*
487 * Pull any physically present but unused TCs out of circulation.
488 */
489 while (tc < (((val & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1)) {
490 cpu_clear(tc, phys_cpu_present_map);
491 cpu_clear(tc, cpu_present_map);
492 tc++;
493 }
494
495 /* release config state */
496 write_c0_mvpcontrol( read_c0_mvpcontrol() & ~ MVPCONTROL_VPC );
497
498 printk("\n");
499
500 /* Set up coprocessor affinity CPU mask(s) */
501
502 for (tc = 0; tc < ntc; tc++) {
503 if(cpu_data[tc].options & MIPS_CPU_FPU)
504 cpu_set(tc, mt_fpu_cpumask);
505 }
506
507 /* set up ipi interrupts... */
508
509 /* If we have multiple VPEs running, set up the cross-VPE interrupt */
510
511 if (nvpe > 1)
512 setup_cross_vpe_interrupts();
513
514 /* Set up queue of free IPI "messages". */
515 nipi = NR_CPUS * IPIBUF_PER_CPU;
516 if (ipibuffers > 0)
517 nipi = ipibuffers;
518
519 pipi = kmalloc(nipi *sizeof(struct smtc_ipi), GFP_KERNEL);
520 if (pipi == NULL)
521 panic("kmalloc of IPI message buffers failed\n");
522 else
523 printk("IPI buffer pool of %d buffers\n", nipi);
524 for (i = 0; i < nipi; i++) {
525 smtc_ipi_nq(&freeIPIq, pipi);
526 pipi++;
527 }
528
529 /* Arm multithreading and enable other VPEs - but all TCs are Halted */
530 emt(EMT_ENABLE);
531 evpe(EVPE_ENABLE);
532 local_irq_restore(flags);
533 /* Initialize SMTC /proc statistics/diagnostics */
534 init_smtc_stats();
535}
536
537
538/*
539 * Setup the PC, SP, and GP of a secondary processor and start it
540 * running!
541 * smp_bootstrap is the place to resume from
542 * __KSTK_TOS(idle) is apparently the stack pointer
543 * (unsigned long)idle->thread_info the gp
544 *
545 */
546void smtc_boot_secondary(int cpu, struct task_struct *idle)
547{
548 extern u32 kernelsp[NR_CPUS];
549 long flags;
550 int mtflags;
551
552 LOCK_MT_PRA();
553 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
554 dvpe();
555 }
556 settc(cpu_data[cpu].tc_id);
557
558 /* pc */
559 write_tc_c0_tcrestart((unsigned long)&smp_bootstrap);
560
561 /* stack pointer */
562 kernelsp[cpu] = __KSTK_TOS(idle);
563 write_tc_gpr_sp(__KSTK_TOS(idle));
564
565 /* global pointer */
566 write_tc_gpr_gp((unsigned long)idle->thread_info);
567
568 smtc_status |= SMTC_MTC_ACTIVE;
569 write_tc_c0_tchalt(0);
570 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
571 evpe(EVPE_ENABLE);
572 }
573 UNLOCK_MT_PRA();
574}
575
576void smtc_init_secondary(void)
577{
578 /*
579 * Start timer on secondary VPEs if necessary.
580 * mips_timer_setup should already have been invoked by init/main
581 * on "boot" TC. Like per_cpu_trap_init() hack, this assumes that
582 * SMTC init code assigns TCs consdecutively and in ascending order
583 * to across available VPEs.
584 */
585 if(((read_c0_tcbind() & TCBIND_CURTC) != 0)
586 && ((read_c0_tcbind() & TCBIND_CURVPE)
587 != cpu_data[smp_processor_id() - 1].vpe_id)){
588 write_c0_compare (read_c0_count() + mips_hpt_frequency/HZ);
589 }
590
591 local_irq_enable();
592}
593
594void smtc_smp_finish(void)
595{
596 printk("TC %d going on-line as CPU %d\n",
597 cpu_data[smp_processor_id()].tc_id, smp_processor_id());
598}
599
600void smtc_cpus_done(void)
601{
602}
603
604/*
605 * Support for SMTC-optimized driver IRQ registration
606 */
607
608/*
609 * SMTC Kernel needs to manipulate low-level CPU interrupt mask
610 * in do_IRQ. These are passed in setup_irq_smtc() and stored
611 * in this table.
612 */
613
614int setup_irq_smtc(unsigned int irq, struct irqaction * new,
615 unsigned long hwmask)
616{
617 irq_hwmask[irq] = hwmask;
618
619 return setup_irq(irq, new);
620}
621
622/*
623 * IPI model for SMTC is tricky, because interrupts aren't TC-specific.
624 * Within a VPE one TC can interrupt another by different approaches.
625 * The easiest to get right would probably be to make all TCs except
626 * the target IXMT and set a software interrupt, but an IXMT-based
627 * scheme requires that a handler must run before a new IPI could
628 * be sent, which would break the "broadcast" loops in MIPS MT.
629 * A more gonzo approach within a VPE is to halt the TC, extract
630 * its Restart, Status, and a couple of GPRs, and program the Restart
631 * address to emulate an interrupt.
632 *
633 * Within a VPE, one can be confident that the target TC isn't in
634 * a critical EXL state when halted, since the write to the Halt
635 * register could not have issued on the writing thread if the
636 * halting thread had EXL set. So k0 and k1 of the target TC
637 * can be used by the injection code. Across VPEs, one can't
638 * be certain that the target TC isn't in a critical exception
639 * state. So we try a two-step process of sending a software
640 * interrupt to the target VPE, which either handles the event
641 * itself (if it was the target) or injects the event within
642 * the VPE.
643 */
644
645void smtc_ipi_qdump(void)
646{
647 int i;
648
649 for (i = 0; i < NR_CPUS ;i++) {
650 printk("IPIQ[%d]: head = 0x%x, tail = 0x%x, depth = %d\n",
651 i, (unsigned)IPIQ[i].head, (unsigned)IPIQ[i].tail,
652 IPIQ[i].depth);
653 }
654}
655
656/*
657 * The standard atomic.h primitives don't quite do what we want
658 * here: We need an atomic add-and-return-previous-value (which
659 * could be done with atomic_add_return and a decrement) and an
660 * atomic set/zero-and-return-previous-value (which can't really
661 * be done with the atomic.h primitives). And since this is
662 * MIPS MT, we can assume that we have LL/SC.
663 */
664static __inline__ int atomic_postincrement(unsigned int *pv)
665{
666 unsigned long result;
667
668 unsigned long temp;
669
670 __asm__ __volatile__(
671 "1: ll %0, %2 \n"
672 " addu %1, %0, 1 \n"
673 " sc %1, %2 \n"
674 " beqz %1, 1b \n"
675 " sync \n"
676 : "=&r" (result), "=&r" (temp), "=m" (*pv)
677 : "m" (*pv)
678 : "memory");
679
680 return result;
681}
682
683/* No longer used in IPI dispatch, but retained for future recycling */
684
685static __inline__ int atomic_postclear(unsigned int *pv)
686{
687 unsigned long result;
688
689 unsigned long temp;
690
691 __asm__ __volatile__(
692 "1: ll %0, %2 \n"
693 " or %1, $0, $0 \n"
694 " sc %1, %2 \n"
695 " beqz %1, 1b \n"
696 " sync \n"
697 : "=&r" (result), "=&r" (temp), "=m" (*pv)
698 : "m" (*pv)
699 : "memory");
700
701 return result;
702}
703
704
705void smtc_send_ipi(int cpu, int type, unsigned int action)
706{
707 int tcstatus;
708 struct smtc_ipi *pipi;
709 long flags;
710 int mtflags;
711
712 if (cpu == smp_processor_id()) {
713 printk("Cannot Send IPI to self!\n");
714 return;
715 }
716 /* Set up a descriptor, to be delivered either promptly or queued */
717 pipi = smtc_ipi_dq(&freeIPIq);
718 if (pipi == NULL) {
719 bust_spinlocks(1);
720 mips_mt_regdump(dvpe());
721 panic("IPI Msg. Buffers Depleted\n");
722 }
723 pipi->type = type;
724 pipi->arg = (void *)action;
725 pipi->dest = cpu;
726 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
727 /* If not on same VPE, enqueue and send cross-VPE interupt */
728 smtc_ipi_nq(&IPIQ[cpu], pipi);
729 LOCK_CORE_PRA();
730 settc(cpu_data[cpu].tc_id);
731 write_vpe_c0_cause(read_vpe_c0_cause() | C_SW1);
732 UNLOCK_CORE_PRA();
733 } else {
734 /*
735 * Not sufficient to do a LOCK_MT_PRA (dmt) here,
736 * since ASID shootdown on the other VPE may
737 * collide with this operation.
738 */
739 LOCK_CORE_PRA();
740 settc(cpu_data[cpu].tc_id);
741 /* Halt the targeted TC */
742 write_tc_c0_tchalt(TCHALT_H);
743 mips_ihb();
744
745 /*
746 * Inspect TCStatus - if IXMT is set, we have to queue
747 * a message. Otherwise, we set up the "interrupt"
748 * of the other TC
749 */
750 tcstatus = read_tc_c0_tcstatus();
751
752 if ((tcstatus & TCSTATUS_IXMT) != 0) {
753 /*
754 * Spin-waiting here can deadlock,
755 * so we queue the message for the target TC.
756 */
757 write_tc_c0_tchalt(0);
758 UNLOCK_CORE_PRA();
759 /* Try to reduce redundant timer interrupt messages */
760 if(type == SMTC_CLOCK_TICK) {
761 if(atomic_postincrement(&ipi_timer_latch[cpu])!=0) {
762 smtc_ipi_nq(&freeIPIq, pipi);
763 return;
764 }
765 }
766 smtc_ipi_nq(&IPIQ[cpu], pipi);
767 } else {
768 post_direct_ipi(cpu, pipi);
769 write_tc_c0_tchalt(0);
770 UNLOCK_CORE_PRA();
771 }
772 }
773}
774
775/*
776 * Send IPI message to Halted TC, TargTC/TargVPE already having been set
777 */
778void post_direct_ipi(int cpu, struct smtc_ipi *pipi)
779{
780 struct pt_regs *kstack;
781 unsigned long tcstatus;
782 unsigned long tcrestart;
783 extern u32 kernelsp[NR_CPUS];
784 extern void __smtc_ipi_vector(void);
785
786 /* Extract Status, EPC from halted TC */
787 tcstatus = read_tc_c0_tcstatus();
788 tcrestart = read_tc_c0_tcrestart();
789 /* If TCRestart indicates a WAIT instruction, advance the PC */
790 if ((tcrestart & 0x80000000)
791 && ((*(unsigned int *)tcrestart & 0xfe00003f) == 0x42000020)) {
792 tcrestart += 4;
793 }
794 /*
795 * Save on TC's future kernel stack
796 *
797 * CU bit of Status is indicator that TC was
798 * already running on a kernel stack...
799 */
800 if(tcstatus & ST0_CU0) {
801 /* Note that this "- 1" is pointer arithmetic */
802 kstack = ((struct pt_regs *)read_tc_gpr_sp()) - 1;
803 } else {
804 kstack = ((struct pt_regs *)kernelsp[cpu]) - 1;
805 }
806
807 kstack->cp0_epc = (long)tcrestart;
808 /* Save TCStatus */
809 kstack->cp0_tcstatus = tcstatus;
810 /* Pass token of operation to be performed kernel stack pad area */
811 kstack->pad0[4] = (unsigned long)pipi;
812 /* Pass address of function to be called likewise */
813 kstack->pad0[5] = (unsigned long)&ipi_decode;
814 /* Set interrupt exempt and kernel mode */
815 tcstatus |= TCSTATUS_IXMT;
816 tcstatus &= ~TCSTATUS_TKSU;
817 write_tc_c0_tcstatus(tcstatus);
818 ehb();
819 /* Set TC Restart address to be SMTC IPI vector */
820 write_tc_c0_tcrestart(__smtc_ipi_vector);
821}
822
823void ipi_resched_interrupt(struct pt_regs *regs)
824{
825 /* Return from interrupt should be enough to cause scheduler check */
826}
827
828
829void ipi_call_interrupt(struct pt_regs *regs)
830{
831 /* Invoke generic function invocation code in smp.c */
832 smp_call_function_interrupt();
833}
834
835void ipi_decode(struct pt_regs *regs, struct smtc_ipi *pipi)
836{
837 void *arg_copy = pipi->arg;
838 int type_copy = pipi->type;
839 int dest_copy = pipi->dest;
840
841 smtc_ipi_nq(&freeIPIq, pipi);
842 switch (type_copy) {
843 case SMTC_CLOCK_TICK:
844 /* Invoke Clock "Interrupt" */
845 ipi_timer_latch[dest_copy] = 0;
846#ifdef SMTC_IDLE_HOOK_DEBUG
847 clock_hang_reported[dest_copy] = 0;
848#endif /* SMTC_IDLE_HOOK_DEBUG */
849 local_timer_interrupt(0, NULL, regs);
850 break;
851 case LINUX_SMP_IPI:
852 switch ((int)arg_copy) {
853 case SMP_RESCHEDULE_YOURSELF:
854 ipi_resched_interrupt(regs);
855 break;
856 case SMP_CALL_FUNCTION:
857 ipi_call_interrupt(regs);
858 break;
859 default:
860 printk("Impossible SMTC IPI Argument 0x%x\n",
861 (int)arg_copy);
862 break;
863 }
864 break;
865 default:
866 printk("Impossible SMTC IPI Type 0x%x\n", type_copy);
867 break;
868 }
869}
870
871void deferred_smtc_ipi(struct pt_regs *regs)
872{
873 struct smtc_ipi *pipi;
874 unsigned long flags;
875/* DEBUG */
876 int q = smp_processor_id();
877
878 /*
879 * Test is not atomic, but much faster than a dequeue,
880 * and the vast majority of invocations will have a null queue.
881 */
882 if(IPIQ[q].head != NULL) {
883 while((pipi = smtc_ipi_dq(&IPIQ[q])) != NULL) {
884 /* ipi_decode() should be called with interrupts off */
885 local_irq_save(flags);
886 ipi_decode(regs, pipi);
887 local_irq_restore(flags);
888 }
889 }
890}
891
892/*
893 * Send clock tick to all TCs except the one executing the funtion
894 */
895
896void smtc_timer_broadcast(int vpe)
897{
898 int cpu;
899 int myTC = cpu_data[smp_processor_id()].tc_id;
900 int myVPE = cpu_data[smp_processor_id()].vpe_id;
901
902 smtc_cpu_stats[smp_processor_id()].timerints++;
903
904 for_each_online_cpu(cpu) {
905 if (cpu_data[cpu].vpe_id == myVPE &&
906 cpu_data[cpu].tc_id != myTC)
907 smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
908 }
909}
910
911/*
912 * Cross-VPE interrupts in the SMTC prototype use "software interrupts"
913 * set via cross-VPE MTTR manipulation of the Cause register. It would be
914 * in some regards preferable to have external logic for "doorbell" hardware
915 * interrupts.
916 */
917
918static int cpu_ipi_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_IRQ;
919
920static irqreturn_t ipi_interrupt(int irq, void *dev_idm, struct pt_regs *regs)
921{
922 int my_vpe = cpu_data[smp_processor_id()].vpe_id;
923 int my_tc = cpu_data[smp_processor_id()].tc_id;
924 int cpu;
925 struct smtc_ipi *pipi;
926 unsigned long tcstatus;
927 int sent;
928 long flags;
929 unsigned int mtflags;
930 unsigned int vpflags;
931
932 /*
933 * So long as cross-VPE interrupts are done via
934 * MFTR/MTTR read-modify-writes of Cause, we need
935 * to stop other VPEs whenever the local VPE does
936 * anything similar.
937 */
938 local_irq_save(flags);
939 vpflags = dvpe();
940 clear_c0_cause(0x100 << MIPS_CPU_IPI_IRQ);
941 set_c0_status(0x100 << MIPS_CPU_IPI_IRQ);
942 irq_enable_hazard();
943 evpe(vpflags);
944 local_irq_restore(flags);
945
946 /*
947 * Cross-VPE Interrupt handler: Try to directly deliver IPIs
948 * queued for TCs on this VPE other than the current one.
949 * Return-from-interrupt should cause us to drain the queue
950 * for the current TC, so we ought not to have to do it explicitly here.
951 */
952
953 for_each_online_cpu(cpu) {
954 if (cpu_data[cpu].vpe_id != my_vpe)
955 continue;
956
957 pipi = smtc_ipi_dq(&IPIQ[cpu]);
958 if (pipi != NULL) {
959 if (cpu_data[cpu].tc_id != my_tc) {
960 sent = 0;
961 LOCK_MT_PRA();
962 settc(cpu_data[cpu].tc_id);
963 write_tc_c0_tchalt(TCHALT_H);
964 mips_ihb();
965 tcstatus = read_tc_c0_tcstatus();
966 if ((tcstatus & TCSTATUS_IXMT) == 0) {
967 post_direct_ipi(cpu, pipi);
968 sent = 1;
969 }
970 write_tc_c0_tchalt(0);
971 UNLOCK_MT_PRA();
972 if (!sent) {
973 smtc_ipi_req(&IPIQ[cpu], pipi);
974 }
975 } else {
976 /*
977 * ipi_decode() should be called
978 * with interrupts off
979 */
980 local_irq_save(flags);
981 ipi_decode(regs, pipi);
982 local_irq_restore(flags);
983 }
984 }
985 }
986
987 return IRQ_HANDLED;
988}
989
990static void ipi_irq_dispatch(struct pt_regs *regs)
991{
992 do_IRQ(cpu_ipi_irq, regs);
993}
994
995static struct irqaction irq_ipi;
996
997void setup_cross_vpe_interrupts(void)
998{
999 if (!cpu_has_vint)
1000 panic("SMTC Kernel requires Vectored Interupt support");
1001
1002 set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch);
1003
1004 irq_ipi.handler = ipi_interrupt;
1005 irq_ipi.flags = SA_INTERRUPT;
1006 irq_ipi.name = "SMTC_IPI";
1007
1008 setup_irq_smtc(cpu_ipi_irq, &irq_ipi, (0x100 << MIPS_CPU_IPI_IRQ));
1009
1010 irq_desc[cpu_ipi_irq].status |= IRQ_PER_CPU;
1011}
1012
1013/*
1014 * SMTC-specific hacks invoked from elsewhere in the kernel.
1015 */
1016
1017void smtc_idle_loop_hook(void)
1018{
1019#ifdef SMTC_IDLE_HOOK_DEBUG
1020 int im;
1021 int flags;
1022 int mtflags;
1023 int bit;
1024 int vpe;
1025 int tc;
1026 int hook_ntcs;
1027 /*
1028 * printk within DMT-protected regions can deadlock,
1029 * so buffer diagnostic messages for later output.
1030 */
1031 char *pdb_msg;
1032 char id_ho_db_msg[768]; /* worst-case use should be less than 700 */
1033
1034 if (atomic_read(&idle_hook_initialized) == 0) { /* fast test */
1035 if (atomic_add_return(1, &idle_hook_initialized) == 1) {
1036 int mvpconf0;
1037 /* Tedious stuff to just do once */
1038 mvpconf0 = read_c0_mvpconf0();
1039 hook_ntcs = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
1040 if (hook_ntcs > NR_CPUS)
1041 hook_ntcs = NR_CPUS;
1042 for (tc = 0; tc < hook_ntcs; tc++) {
1043 tcnoprog[tc] = 0;
1044 clock_hang_reported[tc] = 0;
1045 }
1046 for (vpe = 0; vpe < 2; vpe++)
1047 for (im = 0; im < 8; im++)
1048 imstuckcount[vpe][im] = 0;
1049 printk("Idle loop test hook initialized for %d TCs\n", hook_ntcs);
1050 atomic_set(&idle_hook_initialized, 1000);
1051 } else {
1052 /* Someone else is initializing in parallel - let 'em finish */
1053 while (atomic_read(&idle_hook_initialized) < 1000)
1054 ;
1055 }
1056 }
1057
1058 /* Have we stupidly left IXMT set somewhere? */
1059 if (read_c0_tcstatus() & 0x400) {
1060 write_c0_tcstatus(read_c0_tcstatus() & ~0x400);
1061 ehb();
1062 printk("Dangling IXMT in cpu_idle()\n");
1063 }
1064
1065 /* Have we stupidly left an IM bit turned off? */
1066#define IM_LIMIT 2000
1067 local_irq_save(flags);
1068 mtflags = dmt();
1069 pdb_msg = &id_ho_db_msg[0];
1070 im = read_c0_status();
1071 vpe = cpu_data[smp_processor_id()].vpe_id;
1072 for (bit = 0; bit < 8; bit++) {
1073 /*
1074 * In current prototype, I/O interrupts
1075 * are masked for VPE > 0
1076 */
1077 if (vpemask[vpe][bit]) {
1078 if (!(im & (0x100 << bit)))
1079 imstuckcount[vpe][bit]++;
1080 else
1081 imstuckcount[vpe][bit] = 0;
1082 if (imstuckcount[vpe][bit] > IM_LIMIT) {
1083 set_c0_status(0x100 << bit);
1084 ehb();
1085 imstuckcount[vpe][bit] = 0;
1086 pdb_msg += sprintf(pdb_msg,
1087 "Dangling IM %d fixed for VPE %d\n", bit,
1088 vpe);
1089 }
1090 }
1091 }
1092
1093 /*
1094 * Now that we limit outstanding timer IPIs, check for hung TC
1095 */
1096 for (tc = 0; tc < NR_CPUS; tc++) {
1097 /* Don't check ourself - we'll dequeue IPIs just below */
1098 if ((tc != smp_processor_id()) &&
1099 ipi_timer_latch[tc] > timerq_limit) {
1100 if (clock_hang_reported[tc] == 0) {
1101 pdb_msg += sprintf(pdb_msg,
1102 "TC %d looks hung with timer latch at %d\n",
1103 tc, ipi_timer_latch[tc]);
1104 clock_hang_reported[tc]++;
1105 }
1106 }
1107 }
1108 emt(mtflags);
1109 local_irq_restore(flags);
1110 if (pdb_msg != &id_ho_db_msg[0])
1111 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg);
1112#endif /* SMTC_IDLE_HOOK_DEBUG */
1113 /*
1114 * To the extent that we've ever turned interrupts off,
1115 * we may have accumulated deferred IPIs. This is subtle.
1116 * If we use the smtc_ipi_qdepth() macro, we'll get an
1117 * exact number - but we'll also disable interrupts
1118 * and create a window of failure where a new IPI gets
1119 * queued after we test the depth but before we re-enable
1120 * interrupts. So long as IXMT never gets set, however,
1121 * we should be OK: If we pick up something and dispatch
1122 * it here, that's great. If we see nothing, but concurrent
1123 * with this operation, another TC sends us an IPI, IXMT
1124 * is clear, and we'll handle it as a real pseudo-interrupt
1125 * and not a pseudo-pseudo interrupt.
1126 */
1127 if (IPIQ[smp_processor_id()].depth > 0) {
1128 struct smtc_ipi *pipi;
1129 extern void self_ipi(struct smtc_ipi *);
1130
1131 if ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()])) != NULL) {
1132 self_ipi(pipi);
1133 smtc_cpu_stats[smp_processor_id()].selfipis++;
1134 }
1135 }
1136}
1137
1138void smtc_soft_dump(void)
1139{
1140 int i;
1141
1142 printk("Counter Interrupts taken per CPU (TC)\n");
1143 for (i=0; i < NR_CPUS; i++) {
1144 printk("%d: %ld\n", i, smtc_cpu_stats[i].timerints);
1145 }
1146 printk("Self-IPI invocations:\n");
1147 for (i=0; i < NR_CPUS; i++) {
1148 printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
1149 }
1150 smtc_ipi_qdump();
1151 printk("Timer IPI Backlogs:\n");
1152 for (i=0; i < NR_CPUS; i++) {
1153 printk("%d: %d\n", i, ipi_timer_latch[i]);
1154 }
1155 printk("%d Recoveries of \"stolen\" FPU\n",
1156 atomic_read(&smtc_fpu_recoveries));
1157}
1158
1159
1160/*
1161 * TLB management routines special to SMTC
1162 */
1163
1164void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
1165{
1166 unsigned long flags, mtflags, tcstat, prevhalt, asid;
1167 int tlb, i;
1168
1169 /*
1170 * It would be nice to be able to use a spinlock here,
1171 * but this is invoked from within TLB flush routines
1172 * that protect themselves with DVPE, so if a lock is
1173 * held by another TC, it'll never be freed.
1174 *
1175 * DVPE/DMT must not be done with interrupts enabled,
1176 * so even so most callers will already have disabled
1177 * them, let's be really careful...
1178 */
1179
1180 local_irq_save(flags);
1181 if (smtc_status & SMTC_TLB_SHARED) {
1182 mtflags = dvpe();
1183 tlb = 0;
1184 } else {
1185 mtflags = dmt();
1186 tlb = cpu_data[cpu].vpe_id;
1187 }
1188 asid = asid_cache(cpu);
1189
1190 do {
1191 if (!((asid += ASID_INC) & ASID_MASK) ) {
1192 if (cpu_has_vtag_icache)
1193 flush_icache_all();
1194 /* Traverse all online CPUs (hack requires contigous range) */
1195 for (i = 0; i < num_online_cpus(); i++) {
1196 /*
1197 * We don't need to worry about our own CPU, nor those of
1198 * CPUs who don't share our TLB.
1199 */
1200 if ((i != smp_processor_id()) &&
1201 ((smtc_status & SMTC_TLB_SHARED) ||
1202 (cpu_data[i].vpe_id == cpu_data[cpu].vpe_id))) {
1203 settc(cpu_data[i].tc_id);
1204 prevhalt = read_tc_c0_tchalt() & TCHALT_H;
1205 if (!prevhalt) {
1206 write_tc_c0_tchalt(TCHALT_H);
1207 mips_ihb();
1208 }
1209 tcstat = read_tc_c0_tcstatus();
1210 smtc_live_asid[tlb][(tcstat & ASID_MASK)] |= (asiduse)(0x1 << i);
1211 if (!prevhalt)
1212 write_tc_c0_tchalt(0);
1213 }
1214 }
1215 if (!asid) /* fix version if needed */
1216 asid = ASID_FIRST_VERSION;
1217 local_flush_tlb_all(); /* start new asid cycle */
1218 }
1219 } while (smtc_live_asid[tlb][(asid & ASID_MASK)]);
1220
1221 /*
1222 * SMTC shares the TLB within VPEs and possibly across all VPEs.
1223 */
1224 for (i = 0; i < num_online_cpus(); i++) {
1225 if ((smtc_status & SMTC_TLB_SHARED) ||
1226 (cpu_data[i].vpe_id == cpu_data[cpu].vpe_id))
1227 cpu_context(i, mm) = asid_cache(i) = asid;
1228 }
1229
1230 if (smtc_status & SMTC_TLB_SHARED)
1231 evpe(mtflags);
1232 else
1233 emt(mtflags);
1234 local_irq_restore(flags);
1235}
1236
1237/*
1238 * Invoked from macros defined in mmu_context.h
1239 * which must already have disabled interrupts
1240 * and done a DVPE or DMT as appropriate.
1241 */
1242
1243void smtc_flush_tlb_asid(unsigned long asid)
1244{
1245 int entry;
1246 unsigned long ehi;
1247
1248 entry = read_c0_wired();
1249
1250 /* Traverse all non-wired entries */
1251 while (entry < current_cpu_data.tlbsize) {
1252 write_c0_index(entry);
1253 ehb();
1254 tlb_read();
1255 ehb();
1256 ehi = read_c0_entryhi();
1257 if((ehi & ASID_MASK) == asid) {
1258 /*
1259 * Invalidate only entries with specified ASID,
1260 * makiing sure all entries differ.
1261 */
1262 write_c0_entryhi(CKSEG0 + (entry << (PAGE_SHIFT + 1)));
1263 write_c0_entrylo0(0);
1264 write_c0_entrylo1(0);
1265 mtc0_tlbw_hazard();
1266 tlb_write_indexed();
1267 }
1268 entry++;
1269 }
1270 write_c0_index(PARKED_INDEX);
1271 tlbw_use_hazard();
1272}
1273
1274/*
1275 * Support for single-threading cache flush operations.
1276 */
1277
1278int halt_state_save[NR_CPUS];
1279
1280/*
1281 * To really, really be sure that nothing is being done
1282 * by other TCs, halt them all. This code assumes that
1283 * a DVPE has already been done, so while their Halted
1284 * state is theoretically architecturally unstable, in
1285 * practice, it's not going to change while we're looking
1286 * at it.
1287 */
1288
1289void smtc_cflush_lockdown(void)
1290{
1291 int cpu;
1292
1293 for_each_online_cpu(cpu) {
1294 if (cpu != smp_processor_id()) {
1295 settc(cpu_data[cpu].tc_id);
1296 halt_state_save[cpu] = read_tc_c0_tchalt();
1297 write_tc_c0_tchalt(TCHALT_H);
1298 }
1299 }
1300 mips_ihb();
1301}
1302
1303/* It would be cheating to change the cpu_online states during a flush! */
1304
1305void smtc_cflush_release(void)
1306{
1307 int cpu;
1308
1309 /*
1310 * Start with a hazard barrier to ensure
1311 * that all CACHE ops have played through.
1312 */
1313 mips_ihb();
1314
1315 for_each_online_cpu(cpu) {
1316 if (cpu != smp_processor_id()) {
1317 settc(cpu_data[cpu].tc_id);
1318 write_tc_c0_tchalt(halt_state_save[cpu]);
1319 }
1320 }
1321 mips_ihb();
1322}
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 5e51a2d8f3f0..13ff4da598cd 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -116,8 +116,7 @@ static void c0_timer_ack(void)
116 write_c0_compare(expirelo); 116 write_c0_compare(expirelo);
117 117
118 /* Check to see if we have missed any timer interrupts. */ 118 /* Check to see if we have missed any timer interrupts. */
119 count = read_c0_count(); 119 while (((count = read_c0_count()) - expirelo) < 0x7fffffff) {
120 if ((count - expirelo) < 0x7fffffff) {
121 /* missed_timer_count++; */ 120 /* missed_timer_count++; */
122 expirelo = count + cycles_per_jiffy; 121 expirelo = count + cycles_per_jiffy;
123 write_c0_compare(expirelo); 122 write_c0_compare(expirelo);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index bed0eb6cf55d..4901f0a37fca 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -42,6 +42,7 @@
42#include <asm/watch.h> 42#include <asm/watch.h>
43#include <asm/types.h> 43#include <asm/types.h>
44 44
45extern asmlinkage void handle_int(void);
45extern asmlinkage void handle_tlbm(void); 46extern asmlinkage void handle_tlbm(void);
46extern asmlinkage void handle_tlbl(void); 47extern asmlinkage void handle_tlbl(void);
47extern asmlinkage void handle_tlbs(void); 48extern asmlinkage void handle_tlbs(void);
@@ -279,9 +280,16 @@ static DEFINE_SPINLOCK(die_lock);
279NORET_TYPE void ATTRIB_NORET die(const char * str, struct pt_regs * regs) 280NORET_TYPE void ATTRIB_NORET die(const char * str, struct pt_regs * regs)
280{ 281{
281 static int die_counter; 282 static int die_counter;
283#ifdef CONFIG_MIPS_MT_SMTC
284 unsigned long dvpret = dvpe();
285#endif /* CONFIG_MIPS_MT_SMTC */
282 286
283 console_verbose(); 287 console_verbose();
284 spin_lock_irq(&die_lock); 288 spin_lock_irq(&die_lock);
289 bust_spinlocks(1);
290#ifdef CONFIG_MIPS_MT_SMTC
291 mips_mt_regdump(dvpret);
292#endif /* CONFIG_MIPS_MT_SMTC */
285 printk("%s[#%d]:\n", str, ++die_counter); 293 printk("%s[#%d]:\n", str, ++die_counter);
286 show_registers(regs); 294 show_registers(regs);
287 spin_unlock_irq(&die_lock); 295 spin_unlock_irq(&die_lock);
@@ -750,12 +758,43 @@ asmlinkage void do_cpu(struct pt_regs *regs)
750 &current->thread.fpu.soft); 758 &current->thread.fpu.soft);
751 if (sig) 759 if (sig)
752 force_sig(sig, current); 760 force_sig(sig, current);
761#ifdef CONFIG_MIPS_MT_FPAFF
762 else {
763 /*
764 * MIPS MT processors may have fewer FPU contexts
765 * than CPU threads. If we've emulated more than
766 * some threshold number of instructions, force
767 * migration to a "CPU" that has FP support.
768 */
769 if(mt_fpemul_threshold > 0
770 && ((current->thread.emulated_fp++
771 > mt_fpemul_threshold))) {
772 /*
773 * If there's no FPU present, or if the
774 * application has already restricted
775 * the allowed set to exclude any CPUs
776 * with FPUs, we'll skip the procedure.
777 */
778 if (cpus_intersects(current->cpus_allowed,
779 mt_fpu_cpumask)) {
780 cpumask_t tmask;
781
782 cpus_and(tmask,
783 current->thread.user_cpus_allowed,
784 mt_fpu_cpumask);
785 set_cpus_allowed(current, tmask);
786 current->thread.mflags |= MF_FPUBOUND;
787 }
788 }
789 }
790#endif /* CONFIG_MIPS_MT_FPAFF */
753 } 791 }
754 792
755 return; 793 return;
756 794
757 case 2: 795 case 2:
758 case 3: 796 case 3:
797 die_if_kernel("do_cpu invoked from kernel context!", regs);
759 break; 798 break;
760 } 799 }
761 800
@@ -793,6 +832,36 @@ asmlinkage void do_mcheck(struct pt_regs *regs)
793 832
794asmlinkage void do_mt(struct pt_regs *regs) 833asmlinkage void do_mt(struct pt_regs *regs)
795{ 834{
835 int subcode;
836
837 die_if_kernel("MIPS MT Thread exception in kernel", regs);
838
839 subcode = (read_vpe_c0_vpecontrol() & VPECONTROL_EXCPT)
840 >> VPECONTROL_EXCPT_SHIFT;
841 switch (subcode) {
842 case 0:
843 printk(KERN_ERR "Thread Underflow\n");
844 break;
845 case 1:
846 printk(KERN_ERR "Thread Overflow\n");
847 break;
848 case 2:
849 printk(KERN_ERR "Invalid YIELD Qualifier\n");
850 break;
851 case 3:
852 printk(KERN_ERR "Gating Storage Exception\n");
853 break;
854 case 4:
855 printk(KERN_ERR "YIELD Scheduler Exception\n");
856 break;
857 case 5:
858 printk(KERN_ERR "Gating Storage Schedulier Exception\n");
859 break;
860 default:
861 printk(KERN_ERR "*** UNKNOWN THREAD EXCEPTION %d ***\n",
862 subcode);
863 break;
864 }
796 die_if_kernel("MIPS MT Thread exception in kernel", regs); 865 die_if_kernel("MIPS MT Thread exception in kernel", regs);
797 866
798 force_sig(SIGILL, current); 867 force_sig(SIGILL, current);
@@ -928,7 +997,15 @@ void ejtag_exception_handler(struct pt_regs *regs)
928 */ 997 */
929void nmi_exception_handler(struct pt_regs *regs) 998void nmi_exception_handler(struct pt_regs *regs)
930{ 999{
1000#ifdef CONFIG_MIPS_MT_SMTC
1001 unsigned long dvpret = dvpe();
1002 bust_spinlocks(1);
1003 printk("NMI taken!!!!\n");
1004 mips_mt_regdump(dvpret);
1005#else
1006 bust_spinlocks(1);
931 printk("NMI taken!!!!\n"); 1007 printk("NMI taken!!!!\n");
1008#endif /* CONFIG_MIPS_MT_SMTC */
932 die("NMI", regs); 1009 die("NMI", regs);
933 while(1) ; 1010 while(1) ;
934} 1011}
@@ -960,27 +1037,29 @@ void *set_except_vector(int n, void *addr)
960 1037
961#ifdef CONFIG_CPU_MIPSR2 1038#ifdef CONFIG_CPU_MIPSR2
962/* 1039/*
963 * Shadow register allocation 1040 * MIPSR2 shadow register set allocation
964 * FIXME: SMP... 1041 * FIXME: SMP...
965 */ 1042 */
966 1043
967/* MIPSR2 shadow register sets */ 1044static struct shadow_registers {
968struct shadow_registers { 1045 /*
969 spinlock_t sr_lock; /* */ 1046 * Number of shadow register sets supported
970 int sr_supported; /* Number of shadow register sets supported */ 1047 */
971 int sr_allocated; /* Bitmap of allocated shadow registers */ 1048 unsigned long sr_supported;
1049 /*
1050 * Bitmap of allocated shadow registers
1051 */
1052 unsigned long sr_allocated;
972} shadow_registers; 1053} shadow_registers;
973 1054
974void mips_srs_init(void) 1055static void mips_srs_init(void)
975{ 1056{
976#ifdef CONFIG_CPU_MIPSR2_SRS 1057#ifdef CONFIG_CPU_MIPSR2_SRS
977 shadow_registers.sr_supported = ((read_c0_srsctl() >> 26) & 0x0f) + 1; 1058 shadow_registers.sr_supported = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
978 printk ("%d MIPSR2 register sets available\n", shadow_registers.sr_supported); 1059 printk(KERN_INFO "%d MIPSR2 register sets available\n",
979#else 1060 shadow_registers.sr_supported);
980 shadow_registers.sr_supported = 1;
981#endif 1061#endif
982 shadow_registers.sr_allocated = 1; /* Set 0 used by kernel */ 1062 shadow_registers.sr_allocated = 1; /* Set 0 used by kernel */
983 spin_lock_init(&shadow_registers.sr_lock);
984} 1063}
985 1064
986int mips_srs_max(void) 1065int mips_srs_max(void)
@@ -988,38 +1067,30 @@ int mips_srs_max(void)
988 return shadow_registers.sr_supported; 1067 return shadow_registers.sr_supported;
989} 1068}
990 1069
991int mips_srs_alloc (void) 1070int mips_srs_alloc(void)
992{ 1071{
993 struct shadow_registers *sr = &shadow_registers; 1072 struct shadow_registers *sr = &shadow_registers;
994 unsigned long flags;
995 int set; 1073 int set;
996 1074
997 spin_lock_irqsave(&sr->sr_lock, flags); 1075again:
1076 set = find_first_zero_bit(&sr->sr_allocated, sr->sr_supported);
1077 if (set >= sr->sr_supported)
1078 return -1;
998 1079
999 for (set = 0; set < sr->sr_supported; set++) { 1080 if (test_and_set_bit(set, &sr->sr_allocated))
1000 if ((sr->sr_allocated & (1 << set)) == 0) { 1081 goto again;
1001 sr->sr_allocated |= 1 << set;
1002 spin_unlock_irqrestore(&sr->sr_lock, flags);
1003 return set;
1004 }
1005 }
1006 1082
1007 /* None available */ 1083 return set;
1008 spin_unlock_irqrestore(&sr->sr_lock, flags);
1009 return -1;
1010} 1084}
1011 1085
1012void mips_srs_free (int set) 1086void mips_srs_free(int set)
1013{ 1087{
1014 struct shadow_registers *sr = &shadow_registers; 1088 struct shadow_registers *sr = &shadow_registers;
1015 unsigned long flags;
1016 1089
1017 spin_lock_irqsave(&sr->sr_lock, flags); 1090 clear_bit(set, &sr->sr_allocated);
1018 sr->sr_allocated &= ~(1 << set);
1019 spin_unlock_irqrestore(&sr->sr_lock, flags);
1020} 1091}
1021 1092
1022void *set_vi_srs_handler (int n, void *addr, int srs) 1093static void *set_vi_srs_handler(int n, void *addr, int srs)
1023{ 1094{
1024 unsigned long handler; 1095 unsigned long handler;
1025 unsigned long old_handler = vi_handlers[n]; 1096 unsigned long old_handler = vi_handlers[n];
@@ -1032,8 +1103,7 @@ void *set_vi_srs_handler (int n, void *addr, int srs)
1032 if (addr == NULL) { 1103 if (addr == NULL) {
1033 handler = (unsigned long) do_default_vi; 1104 handler = (unsigned long) do_default_vi;
1034 srs = 0; 1105 srs = 0;
1035 } 1106 } else
1036 else
1037 handler = (unsigned long) addr; 1107 handler = (unsigned long) addr;
1038 vi_handlers[n] = (unsigned long) addr; 1108 vi_handlers[n] = (unsigned long) addr;
1039 1109
@@ -1045,8 +1115,7 @@ void *set_vi_srs_handler (int n, void *addr, int srs)
1045 if (cpu_has_veic) { 1115 if (cpu_has_veic) {
1046 if (board_bind_eic_interrupt) 1116 if (board_bind_eic_interrupt)
1047 board_bind_eic_interrupt (n, srs); 1117 board_bind_eic_interrupt (n, srs);
1048 } 1118 } else if (cpu_has_vint) {
1049 else if (cpu_has_vint) {
1050 /* SRSMap is only defined if shadow sets are implemented */ 1119 /* SRSMap is only defined if shadow sets are implemented */
1051 if (mips_srs_max() > 1) 1120 if (mips_srs_max() > 1)
1052 change_c0_srsmap (0xf << n*4, srs << n*4); 1121 change_c0_srsmap (0xf << n*4, srs << n*4);
@@ -1060,6 +1129,15 @@ void *set_vi_srs_handler (int n, void *addr, int srs)
1060 1129
1061 extern char except_vec_vi, except_vec_vi_lui; 1130 extern char except_vec_vi, except_vec_vi_lui;
1062 extern char except_vec_vi_ori, except_vec_vi_end; 1131 extern char except_vec_vi_ori, except_vec_vi_end;
1132#ifdef CONFIG_MIPS_MT_SMTC
1133 /*
1134 * We need to provide the SMTC vectored interrupt handler
1135 * not only with the address of the handler, but with the
1136 * Status.IM bit to be masked before going there.
1137 */
1138 extern char except_vec_vi_mori;
1139 const int mori_offset = &except_vec_vi_mori - &except_vec_vi;
1140#endif /* CONFIG_MIPS_MT_SMTC */
1063 const int handler_len = &except_vec_vi_end - &except_vec_vi; 1141 const int handler_len = &except_vec_vi_end - &except_vec_vi;
1064 const int lui_offset = &except_vec_vi_lui - &except_vec_vi; 1142 const int lui_offset = &except_vec_vi_lui - &except_vec_vi;
1065 const int ori_offset = &except_vec_vi_ori - &except_vec_vi; 1143 const int ori_offset = &except_vec_vi_ori - &except_vec_vi;
@@ -1073,6 +1151,12 @@ void *set_vi_srs_handler (int n, void *addr, int srs)
1073 } 1151 }
1074 1152
1075 memcpy (b, &except_vec_vi, handler_len); 1153 memcpy (b, &except_vec_vi, handler_len);
1154#ifdef CONFIG_MIPS_MT_SMTC
1155 if (n > 7)
1156 printk("Vector index %d exceeds SMTC maximum\n", n);
1157 w = (u32 *)(b + mori_offset);
1158 *w = (*w & 0xffff0000) | (0x100 << n);
1159#endif /* CONFIG_MIPS_MT_SMTC */
1076 w = (u32 *)(b + lui_offset); 1160 w = (u32 *)(b + lui_offset);
1077 *w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff); 1161 *w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff);
1078 w = (u32 *)(b + ori_offset); 1162 w = (u32 *)(b + ori_offset);
@@ -1095,9 +1179,9 @@ void *set_vi_srs_handler (int n, void *addr, int srs)
1095 return (void *)old_handler; 1179 return (void *)old_handler;
1096} 1180}
1097 1181
1098void *set_vi_handler (int n, void *addr) 1182void *set_vi_handler(int n, void *addr)
1099{ 1183{
1100 return set_vi_srs_handler (n, addr, 0); 1184 return set_vi_srs_handler(n, addr, 0);
1101} 1185}
1102#endif 1186#endif
1103 1187
@@ -1113,8 +1197,29 @@ extern asmlinkage int _restore_fp_context(struct sigcontext *sc);
1113extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc); 1197extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc);
1114extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc); 1198extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc);
1115 1199
1200#ifdef CONFIG_SMP
1201static int smp_save_fp_context(struct sigcontext *sc)
1202{
1203 return cpu_has_fpu
1204 ? _save_fp_context(sc)
1205 : fpu_emulator_save_context(sc);
1206}
1207
1208static int smp_restore_fp_context(struct sigcontext *sc)
1209{
1210 return cpu_has_fpu
1211 ? _restore_fp_context(sc)
1212 : fpu_emulator_restore_context(sc);
1213}
1214#endif
1215
1116static inline void signal_init(void) 1216static inline void signal_init(void)
1117{ 1217{
1218#ifdef CONFIG_SMP
1219 /* For now just do the cpu_has_fpu check when the functions are invoked */
1220 save_fp_context = smp_save_fp_context;
1221 restore_fp_context = smp_restore_fp_context;
1222#else
1118 if (cpu_has_fpu) { 1223 if (cpu_has_fpu) {
1119 save_fp_context = _save_fp_context; 1224 save_fp_context = _save_fp_context;
1120 restore_fp_context = _restore_fp_context; 1225 restore_fp_context = _restore_fp_context;
@@ -1122,6 +1227,7 @@ static inline void signal_init(void)
1122 save_fp_context = fpu_emulator_save_context; 1227 save_fp_context = fpu_emulator_save_context;
1123 restore_fp_context = fpu_emulator_restore_context; 1228 restore_fp_context = fpu_emulator_restore_context;
1124 } 1229 }
1230#endif
1125} 1231}
1126 1232
1127#ifdef CONFIG_MIPS32_COMPAT 1233#ifdef CONFIG_MIPS32_COMPAT
@@ -1158,6 +1264,20 @@ void __init per_cpu_trap_init(void)
1158{ 1264{
1159 unsigned int cpu = smp_processor_id(); 1265 unsigned int cpu = smp_processor_id();
1160 unsigned int status_set = ST0_CU0; 1266 unsigned int status_set = ST0_CU0;
1267#ifdef CONFIG_MIPS_MT_SMTC
1268 int secondaryTC = 0;
1269 int bootTC = (cpu == 0);
1270
1271 /*
1272 * Only do per_cpu_trap_init() for first TC of Each VPE.
1273 * Note that this hack assumes that the SMTC init code
1274 * assigns TCs consecutively and in ascending order.
1275 */
1276
1277 if (((read_c0_tcbind() & TCBIND_CURTC) != 0) &&
1278 ((read_c0_tcbind() & TCBIND_CURVPE) == cpu_data[cpu - 1].vpe_id))
1279 secondaryTC = 1;
1280#endif /* CONFIG_MIPS_MT_SMTC */
1161 1281
1162 /* 1282 /*
1163 * Disable coprocessors and select 32-bit or 64-bit addressing 1283 * Disable coprocessors and select 32-bit or 64-bit addressing
@@ -1180,6 +1300,10 @@ void __init per_cpu_trap_init(void)
1180 write_c0_hwrena (0x0000000f); /* Allow rdhwr to all registers */ 1300 write_c0_hwrena (0x0000000f); /* Allow rdhwr to all registers */
1181#endif 1301#endif
1182 1302
1303#ifdef CONFIG_MIPS_MT_SMTC
1304 if (!secondaryTC) {
1305#endif /* CONFIG_MIPS_MT_SMTC */
1306
1183 /* 1307 /*
1184 * Interrupt handling. 1308 * Interrupt handling.
1185 */ 1309 */
@@ -1196,6 +1320,9 @@ void __init per_cpu_trap_init(void)
1196 } else 1320 } else
1197 set_c0_cause(CAUSEF_IV); 1321 set_c0_cause(CAUSEF_IV);
1198 } 1322 }
1323#ifdef CONFIG_MIPS_MT_SMTC
1324 }
1325#endif /* CONFIG_MIPS_MT_SMTC */
1199 1326
1200 cpu_data[cpu].asid_cache = ASID_FIRST_VERSION; 1327 cpu_data[cpu].asid_cache = ASID_FIRST_VERSION;
1201 TLBMISS_HANDLER_SETUP(); 1328 TLBMISS_HANDLER_SETUP();
@@ -1205,8 +1332,14 @@ void __init per_cpu_trap_init(void)
1205 BUG_ON(current->mm); 1332 BUG_ON(current->mm);
1206 enter_lazy_tlb(&init_mm, current); 1333 enter_lazy_tlb(&init_mm, current);
1207 1334
1208 cpu_cache_init(); 1335#ifdef CONFIG_MIPS_MT_SMTC
1209 tlb_init(); 1336 if (bootTC) {
1337#endif /* CONFIG_MIPS_MT_SMTC */
1338 cpu_cache_init();
1339 tlb_init();
1340#ifdef CONFIG_MIPS_MT_SMTC
1341 }
1342#endif /* CONFIG_MIPS_MT_SMTC */
1210} 1343}
1211 1344
1212/* Install CPU exception handler */ 1345/* Install CPU exception handler */
@@ -1278,7 +1411,7 @@ void __init trap_init(void)
1278 if (cpu_has_veic || cpu_has_vint) { 1411 if (cpu_has_veic || cpu_has_vint) {
1279 int nvec = cpu_has_veic ? 64 : 8; 1412 int nvec = cpu_has_veic ? 64 : 8;
1280 for (i = 0; i < nvec; i++) 1413 for (i = 0; i < nvec; i++)
1281 set_vi_handler (i, NULL); 1414 set_vi_handler(i, NULL);
1282 } 1415 }
1283 else if (cpu_has_divec) 1416 else if (cpu_has_divec)
1284 set_handler(0x200, &except_vec4, 0x8); 1417 set_handler(0x200, &except_vec4, 0x8);
@@ -1297,6 +1430,7 @@ void __init trap_init(void)
1297 if (board_be_init) 1430 if (board_be_init)
1298 board_be_init(); 1431 board_be_init();
1299 1432
1433 set_except_vector(0, handle_int);
1300 set_except_vector(1, handle_tlbm); 1434 set_except_vector(1, handle_tlbm);
1301 set_except_vector(2, handle_tlbl); 1435 set_except_vector(2, handle_tlbl);
1302 set_except_vector(3, handle_tlbs); 1436 set_except_vector(3, handle_tlbs);
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 2ad0cedf29fe..14fa00e3cdfa 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -2,7 +2,7 @@
2#include <asm/asm-offsets.h> 2#include <asm/asm-offsets.h>
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4 4
5#undef mips /* CPP really sucks for this job */ 5#undef mips
6#define mips mips 6#define mips mips
7OUTPUT_ARCH(mips) 7OUTPUT_ARCH(mips)
8ENTRY(kernel_entry) 8ENTRY(kernel_entry)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index ae83b755cf4a..80ffaa6d50ad 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -13,7 +13,6 @@
13 * You should have received a copy of the GNU General Public License along 13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc., 14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */ 16 */
18 17
19/* 18/*
@@ -27,11 +26,8 @@
27 * 26 *
28 * To load and run, simply cat a SP 'program file' to /dev/vpe1. 27 * To load and run, simply cat a SP 'program file' to /dev/vpe1.
29 * i.e cat spapp >/dev/vpe1. 28 * i.e cat spapp >/dev/vpe1.
30 *
31 * You'll need to have the following device files.
32 * mknod /dev/vpe0 c 63 0
33 * mknod /dev/vpe1 c 63 1
34 */ 29 */
30
35#include <linux/config.h> 31#include <linux/config.h>
36#include <linux/kernel.h> 32#include <linux/kernel.h>
37#include <linux/module.h> 33#include <linux/module.h>
@@ -55,6 +51,8 @@
55#include <asm/cpu.h> 51#include <asm/cpu.h>
56#include <asm/processor.h> 52#include <asm/processor.h>
57#include <asm/system.h> 53#include <asm/system.h>
54#include <asm/vpe.h>
55#include <asm/kspd.h>
58 56
59typedef void *vpe_handle; 57typedef void *vpe_handle;
60 58
@@ -68,6 +66,11 @@ typedef void *vpe_handle;
68static char module_name[] = "vpe"; 66static char module_name[] = "vpe";
69static int major; 67static int major;
70 68
69#ifdef CONFIG_MIPS_APSP_KSPD
70 static struct kspd_notifications kspd_events;
71static int kspd_events_reqd = 0;
72#endif
73
71/* grab the likely amount of memory we will need. */ 74/* grab the likely amount of memory we will need. */
72#ifdef CONFIG_MIPS_VPE_LOADER_TOM 75#ifdef CONFIG_MIPS_VPE_LOADER_TOM
73#define P_SIZE (2 * 1024 * 1024) 76#define P_SIZE (2 * 1024 * 1024)
@@ -76,7 +79,10 @@ static int major;
76#define P_SIZE (256 * 1024) 79#define P_SIZE (256 * 1024)
77#endif 80#endif
78 81
82extern unsigned long physical_memsize;
83
79#define MAX_VPES 16 84#define MAX_VPES 16
85#define VPE_PATH_MAX 256
80 86
81enum vpe_state { 87enum vpe_state {
82 VPE_STATE_UNUSED = 0, 88 VPE_STATE_UNUSED = 0,
@@ -102,6 +108,8 @@ struct vpe {
102 unsigned long len; 108 unsigned long len;
103 char *pbuffer; 109 char *pbuffer;
104 unsigned long plen; 110 unsigned long plen;
111 unsigned int uid, gid;
112 char cwd[VPE_PATH_MAX];
105 113
106 unsigned long __start; 114 unsigned long __start;
107 115
@@ -113,6 +121,9 @@ struct vpe {
113 121
114 /* shared symbol address */ 122 /* shared symbol address */
115 void *shared_ptr; 123 void *shared_ptr;
124
125 /* the list of who wants to know when something major happens */
126 struct list_head notify;
116}; 127};
117 128
118struct tc { 129struct tc {
@@ -138,7 +149,7 @@ struct vpecontrol_ {
138} vpecontrol; 149} vpecontrol;
139 150
140static void release_progmem(void *ptr); 151static void release_progmem(void *ptr);
141static void dump_vpe(struct vpe * v); 152/* static __attribute_used__ void dump_vpe(struct vpe * v); */
142extern void save_gp_address(unsigned int secbase, unsigned int rel); 153extern void save_gp_address(unsigned int secbase, unsigned int rel);
143 154
144/* get the vpe associated with this minor */ 155/* get the vpe associated with this minor */
@@ -146,12 +157,14 @@ struct vpe *get_vpe(int minor)
146{ 157{
147 struct vpe *v; 158 struct vpe *v;
148 159
160 if (!cpu_has_mipsmt)
161 return NULL;
162
149 list_for_each_entry(v, &vpecontrol.vpe_list, list) { 163 list_for_each_entry(v, &vpecontrol.vpe_list, list) {
150 if (v->minor == minor) 164 if (v->minor == minor)
151 return v; 165 return v;
152 } 166 }
153 167
154 printk(KERN_DEBUG "VPE: get_vpe minor %d not found\n", minor);
155 return NULL; 168 return NULL;
156} 169}
157 170
@@ -165,8 +178,6 @@ struct tc *get_tc(int index)
165 return t; 178 return t;
166 } 179 }
167 180
168 printk(KERN_DEBUG "VPE: get_tc index %d not found\n", index);
169
170 return NULL; 181 return NULL;
171} 182}
172 183
@@ -179,8 +190,6 @@ struct tc *get_tc_unused(void)
179 return t; 190 return t;
180 } 191 }
181 192
182 printk(KERN_DEBUG "VPE: All TC's are in use\n");
183
184 return NULL; 193 return NULL;
185} 194}
186 195
@@ -190,13 +199,13 @@ struct vpe *alloc_vpe(int minor)
190 struct vpe *v; 199 struct vpe *v;
191 200
192 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) { 201 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) {
193 printk(KERN_WARNING "VPE: alloc_vpe no mem\n");
194 return NULL; 202 return NULL;
195 } 203 }
196 204
197 INIT_LIST_HEAD(&v->tc); 205 INIT_LIST_HEAD(&v->tc);
198 list_add_tail(&v->list, &vpecontrol.vpe_list); 206 list_add_tail(&v->list, &vpecontrol.vpe_list);
199 207
208 INIT_LIST_HEAD(&v->notify);
200 v->minor = minor; 209 v->minor = minor;
201 return v; 210 return v;
202} 211}
@@ -207,7 +216,6 @@ struct tc *alloc_tc(int index)
207 struct tc *t; 216 struct tc *t;
208 217
209 if ((t = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) { 218 if ((t = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) {
210 printk(KERN_WARNING "VPE: alloc_tc no mem\n");
211 return NULL; 219 return NULL;
212 } 220 }
213 221
@@ -236,20 +244,16 @@ void dump_mtregs(void)
236 printk("config3 0x%lx MT %ld\n", val, 244 printk("config3 0x%lx MT %ld\n", val,
237 (val & CONFIG3_MT) >> CONFIG3_MT_SHIFT); 245 (val & CONFIG3_MT) >> CONFIG3_MT_SHIFT);
238 246
239 val = read_c0_mvpconf0();
240 printk("mvpconf0 0x%lx, PVPE %ld PTC %ld M %ld\n", val,
241 (val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT,
242 val & MVPCONF0_PTC, (val & MVPCONF0_M) >> MVPCONF0_M_SHIFT);
243
244 val = read_c0_mvpcontrol(); 247 val = read_c0_mvpcontrol();
245 printk("MVPControl 0x%lx, STLB %ld VPC %ld EVP %ld\n", val, 248 printk("MVPControl 0x%lx, STLB %ld VPC %ld EVP %ld\n", val,
246 (val & MVPCONTROL_STLB) >> MVPCONTROL_STLB_SHIFT, 249 (val & MVPCONTROL_STLB) >> MVPCONTROL_STLB_SHIFT,
247 (val & MVPCONTROL_VPC) >> MVPCONTROL_VPC_SHIFT, 250 (val & MVPCONTROL_VPC) >> MVPCONTROL_VPC_SHIFT,
248 (val & MVPCONTROL_EVP)); 251 (val & MVPCONTROL_EVP));
249 252
250 val = read_c0_vpeconf0(); 253 val = read_c0_mvpconf0();
251 printk("VPEConf0 0x%lx MVP %ld\n", val, 254 printk("mvpconf0 0x%lx, PVPE %ld PTC %ld M %ld\n", val,
252 (val & VPECONF0_MVP) >> VPECONF0_MVP_SHIFT); 255 (val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT,
256 val & MVPCONF0_PTC, (val & MVPCONF0_M) >> MVPCONF0_M_SHIFT);
253} 257}
254 258
255/* Find some VPE program space */ 259/* Find some VPE program space */
@@ -354,9 +358,9 @@ static int apply_r_mips_gprel16(struct module *me, uint32_t *location,
354 } 358 }
355 359
356 if( (rel > 32768) || (rel < -32768) ) { 360 if( (rel > 32768) || (rel < -32768) ) {
357 printk(KERN_ERR 361 printk(KERN_DEBUG "VPE loader: apply_r_mips_gprel16: "
358 "apply_r_mips_gprel16: relative address out of range 0x%x %d\n", 362 "relative address 0x%x out of range of gp register\n",
359 rel, rel); 363 rel);
360 return -ENOEXEC; 364 return -ENOEXEC;
361 } 365 }
362 366
@@ -374,8 +378,8 @@ static int apply_r_mips_pc16(struct module *me, uint32_t *location,
374 rel -= 1; // and one instruction less due to the branch delay slot. 378 rel -= 1; // and one instruction less due to the branch delay slot.
375 379
376 if( (rel > 32768) || (rel < -32768) ) { 380 if( (rel > 32768) || (rel < -32768) ) {
377 printk(KERN_ERR 381 printk(KERN_DEBUG "VPE loader: "
378 "apply_r_mips_pc16: relative address out of range 0x%x\n", rel); 382 "apply_r_mips_pc16: relative address out of range 0x%x\n", rel);
379 return -ENOEXEC; 383 return -ENOEXEC;
380 } 384 }
381 385
@@ -396,7 +400,8 @@ static int apply_r_mips_26(struct module *me, uint32_t *location,
396 Elf32_Addr v) 400 Elf32_Addr v)
397{ 401{
398 if (v % 4) { 402 if (v % 4) {
399 printk(KERN_ERR "module %s: dangerous relocation mod4\n", me->name); 403 printk(KERN_DEBUG "VPE loader: apply_r_mips_26 "
404 " unaligned relocation\n");
400 return -ENOEXEC; 405 return -ENOEXEC;
401 } 406 }
402 407
@@ -459,12 +464,13 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
459 /* 464 /*
460 * The value for the HI16 had best be the same. 465 * The value for the HI16 had best be the same.
461 */ 466 */
462 if (v != l->value) { 467 if (v != l->value) {
463 printk("%d != %d\n", v, l->value); 468 printk(KERN_DEBUG "VPE loader: "
464 goto out_danger; 469 "apply_r_mips_lo16/hi16: "
470 "inconsistent value information\n");
471 return -ENOEXEC;
465 } 472 }
466 473
467
468 /* 474 /*
469 * Do the HI16 relocation. Note that we actually don't 475 * Do the HI16 relocation. Note that we actually don't
470 * need to know anything about the LO16 itself, except 476 * need to know anything about the LO16 itself, except
@@ -500,11 +506,6 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
500 *location = insnlo; 506 *location = insnlo;
501 507
502 return 0; 508 return 0;
503
504out_danger:
505 printk(KERN_ERR "module %s: dangerous " "relocation\n", me->name);
506
507 return -ENOEXEC;
508} 509}
509 510
510static int (*reloc_handlers[]) (struct module *me, uint32_t *location, 511static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
@@ -518,6 +519,15 @@ static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
518 [R_MIPS_PC16] = apply_r_mips_pc16 519 [R_MIPS_PC16] = apply_r_mips_pc16
519}; 520};
520 521
522static char *rstrs[] = {
523 [R_MIPS_NONE] = "MIPS_NONE",
524 [R_MIPS_32] = "MIPS_32",
525 [R_MIPS_26] = "MIPS_26",
526 [R_MIPS_HI16] = "MIPS_HI16",
527 [R_MIPS_LO16] = "MIPS_LO16",
528 [R_MIPS_GPREL16] = "MIPS_GPREL16",
529 [R_MIPS_PC16] = "MIPS_PC16"
530};
521 531
522int apply_relocations(Elf32_Shdr *sechdrs, 532int apply_relocations(Elf32_Shdr *sechdrs,
523 const char *strtab, 533 const char *strtab,
@@ -552,15 +562,13 @@ int apply_relocations(Elf32_Shdr *sechdrs,
552 562
553 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v); 563 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v);
554 if( res ) { 564 if( res ) {
555 printk(KERN_DEBUG 565 char *r = rstrs[ELF32_R_TYPE(r_info)];
556 "relocation error 0x%x sym refer <%s> value 0x%x " 566 printk(KERN_WARNING "VPE loader: .text+0x%x "
557 "type 0x%x r_info 0x%x\n", 567 "relocation type %s for symbol \"%s\" failed\n",
558 (unsigned int)location, strtab + sym->st_name, v, 568 rel[i].r_offset, r ? r : "UNKNOWN",
559 r_info, ELF32_R_TYPE(r_info)); 569 strtab + sym->st_name);
560 }
561
562 if (res)
563 return res; 570 return res;
571 }
564 } 572 }
565 573
566 return 0; 574 return 0;
@@ -576,7 +584,7 @@ void save_gp_address(unsigned int secbase, unsigned int rel)
576 584
577 585
578/* Change all symbols so that sh_value encodes the pointer directly. */ 586/* Change all symbols so that sh_value encodes the pointer directly. */
579static int simplify_symbols(Elf_Shdr * sechdrs, 587static void simplify_symbols(Elf_Shdr * sechdrs,
580 unsigned int symindex, 588 unsigned int symindex,
581 const char *strtab, 589 const char *strtab,
582 const char *secstrings, 590 const char *secstrings,
@@ -585,18 +593,21 @@ static int simplify_symbols(Elf_Shdr * sechdrs,
585 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; 593 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
586 unsigned long secbase, bssbase = 0; 594 unsigned long secbase, bssbase = 0;
587 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); 595 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
588 int ret = 0, size; 596 int size;
589 597
590 /* find the .bss section for COMMON symbols */ 598 /* find the .bss section for COMMON symbols */
591 for (i = 0; i < nsecs; i++) { 599 for (i = 0; i < nsecs; i++) {
592 if (strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) == 0) 600 if (strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) == 0) {
593 bssbase = sechdrs[i].sh_addr; 601 bssbase = sechdrs[i].sh_addr;
602 break;
603 }
594 } 604 }
595 605
596 for (i = 1; i < n; i++) { 606 for (i = 1; i < n; i++) {
597 switch (sym[i].st_shndx) { 607 switch (sym[i].st_shndx) {
598 case SHN_COMMON: 608 case SHN_COMMON:
599 /* Allocate space for the symbol in the .bss section. st_value is currently size. 609 /* Allocate space for the symbol in the .bss section.
610 st_value is currently size.
600 We want it to have the address of the symbol. */ 611 We want it to have the address of the symbol. */
601 612
602 size = sym[i].st_value; 613 size = sym[i].st_value;
@@ -614,11 +625,9 @@ static int simplify_symbols(Elf_Shdr * sechdrs,
614 break; 625 break;
615 626
616 case SHN_MIPS_SCOMMON: 627 case SHN_MIPS_SCOMMON:
617 628 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON"
618 printk(KERN_DEBUG 629 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name,
619 "simplify_symbols: ignoring SHN_MIPS_SCOMMON symbol <%s> st_shndx %d\n", 630 sym[i].st_shndx);
620 strtab + sym[i].st_name, sym[i].st_shndx);
621
622 // .sbss section 631 // .sbss section
623 break; 632 break;
624 633
@@ -632,10 +641,7 @@ static int simplify_symbols(Elf_Shdr * sechdrs,
632 sym[i].st_value += secbase; 641 sym[i].st_value += secbase;
633 break; 642 break;
634 } 643 }
635
636 } 644 }
637
638 return ret;
639} 645}
640 646
641#ifdef DEBUG_ELFLOADER 647#ifdef DEBUG_ELFLOADER
@@ -655,9 +661,26 @@ static void dump_elfsymbols(Elf_Shdr * sechdrs, unsigned int symindex,
655 661
656static void dump_tc(struct tc *t) 662static void dump_tc(struct tc *t)
657{ 663{
658 printk(KERN_WARNING "VPE: TC index %d TCStatus 0x%lx halt 0x%lx\n", 664 unsigned long val;
659 t->index, read_tc_c0_tcstatus(), read_tc_c0_tchalt()); 665
660 printk(KERN_WARNING "VPE: tcrestart 0x%lx\n", read_tc_c0_tcrestart()); 666 settc(t->index);
667 printk(KERN_DEBUG "VPE loader: TC index %d targtc %ld "
668 "TCStatus 0x%lx halt 0x%lx\n",
669 t->index, read_c0_vpecontrol() & VPECONTROL_TARGTC,
670 read_tc_c0_tcstatus(), read_tc_c0_tchalt());
671
672 printk(KERN_DEBUG " tcrestart 0x%lx\n", read_tc_c0_tcrestart());
673 printk(KERN_DEBUG " tcbind 0x%lx\n", read_tc_c0_tcbind());
674
675 val = read_c0_vpeconf0();
676 printk(KERN_DEBUG " VPEConf0 0x%lx MVP %ld\n", val,
677 (val & VPECONF0_MVP) >> VPECONF0_MVP_SHIFT);
678
679 printk(KERN_DEBUG " c0 status 0x%lx\n", read_vpe_c0_status());
680 printk(KERN_DEBUG " c0 cause 0x%lx\n", read_vpe_c0_cause());
681
682 printk(KERN_DEBUG " c0 badvaddr 0x%lx\n", read_vpe_c0_badvaddr());
683 printk(KERN_DEBUG " c0 epc 0x%lx\n", read_vpe_c0_epc());
661} 684}
662 685
663static void dump_tclist(void) 686static void dump_tclist(void)
@@ -672,96 +695,108 @@ static void dump_tclist(void)
672/* We are prepared so configure and start the VPE... */ 695/* We are prepared so configure and start the VPE... */
673int vpe_run(struct vpe * v) 696int vpe_run(struct vpe * v)
674{ 697{
675 unsigned long val; 698 struct vpe_notifications *n;
699 unsigned long val, dmt_flag;
676 struct tc *t; 700 struct tc *t;
677 701
678 /* check we are the Master VPE */ 702 /* check we are the Master VPE */
679 val = read_c0_vpeconf0(); 703 val = read_c0_vpeconf0();
680 if (!(val & VPECONF0_MVP)) { 704 if (!(val & VPECONF0_MVP)) {
681 printk(KERN_WARNING 705 printk(KERN_WARNING
682 "VPE: only Master VPE's are allowed to configure MT\n"); 706 "VPE loader: only Master VPE's are allowed to configure MT\n");
683 return -1; 707 return -1;
684 } 708 }
685 709
686 /* disable MT (using dvpe) */ 710 /* disable MT (using dvpe) */
687 dvpe(); 711 dvpe();
688 712
713 if (!list_empty(&v->tc)) {
714 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
715 printk(KERN_WARNING "VPE loader: TC %d is already in use.\n",
716 t->index);
717 return -ENOEXEC;
718 }
719 } else {
720 printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n",
721 v->minor);
722 return -ENOEXEC;
723 }
724
689 /* Put MVPE's into 'configuration state' */ 725 /* Put MVPE's into 'configuration state' */
690 set_c0_mvpcontrol(MVPCONTROL_VPC); 726 set_c0_mvpcontrol(MVPCONTROL_VPC);
691 727
692 if (!list_empty(&v->tc)) {
693 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
694 printk(KERN_WARNING "VPE: TC %d is already in use.\n",
695 t->index);
696 return -ENOEXEC;
697 }
698 } else {
699 printk(KERN_WARNING "VPE: No TC's associated with VPE %d\n",
700 v->minor);
701 return -ENOEXEC;
702 }
703
704 settc(t->index); 728 settc(t->index);
705 729
706 val = read_vpe_c0_vpeconf0();
707
708 /* should check it is halted, and not activated */ 730 /* should check it is halted, and not activated */
709 if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) { 731 if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) {
710 printk(KERN_WARNING "VPE: TC %d is already doing something!\n", 732 printk(KERN_WARNING "VPE loader: TC %d is already doing something!\n",
711 t->index); 733 t->index);
712
713 dump_tclist(); 734 dump_tclist();
714 return -ENOEXEC; 735 return -ENOEXEC;
715 } 736 }
716 737
738 /*
739 * Disable multi-threaded execution whilst we activate, clear the
740 * halt bit and bound the tc to the other VPE...
741 */
742 dmt_flag = dmt();
743
717 /* Write the address we want it to start running from in the TCPC register. */ 744 /* Write the address we want it to start running from in the TCPC register. */
718 write_tc_c0_tcrestart((unsigned long)v->__start); 745 write_tc_c0_tcrestart((unsigned long)v->__start);
719
720 /* write the sivc_info address to tccontext */
721 write_tc_c0_tccontext((unsigned long)0); 746 write_tc_c0_tccontext((unsigned long)0);
722 747 /*
723 /* Set up the XTC bit in vpeconf0 to point at our tc */ 748 * Mark the TC as activated, not interrupt exempt and not dynamically
724 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | (t->index << VPECONF0_XTC_SHIFT)); 749 * allocatable
725 750 */
726 /* mark the TC as activated, not interrupt exempt and not dynamically allocatable */
727 val = read_tc_c0_tcstatus(); 751 val = read_tc_c0_tcstatus();
728 val = (val & ~(TCSTATUS_DA | TCSTATUS_IXMT)) | TCSTATUS_A; 752 val = (val & ~(TCSTATUS_DA | TCSTATUS_IXMT)) | TCSTATUS_A;
729 write_tc_c0_tcstatus(val); 753 write_tc_c0_tcstatus(val);
730 754
731 write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H); 755 write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H);
732 756
733 /* set up VPE1 */
734 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() & ~VPECONTROL_TE); // no multiple TC's
735 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA); // enable this VPE
736
737 /* 757 /*
738 * The sde-kit passes 'memsize' to __start in $a3, so set something 758 * The sde-kit passes 'memsize' to __start in $a3, so set something
739 * here... 759 * here... Or set $a3 to zero and define DFLT_STACK_SIZE and
740 * Or set $a3 (register 7) to zero and define DFLT_STACK_SIZE and
741 * DFLT_HEAP_SIZE when you compile your program 760 * DFLT_HEAP_SIZE when you compile your program
742 */ 761 */
762 mttgpr(7, physical_memsize);
763
764
765 /* set up VPE1 */
766 /*
767 * bind the TC to VPE 1 as late as possible so we only have the final
768 * VPE registers to set up, and so an EJTAG probe can trigger on it
769 */
770 write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | v->minor);
743 771
744 mttgpr(7, 0); 772 /* Set up the XTC bit in vpeconf0 to point at our tc */
773 write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC))
774 | (t->index << VPECONF0_XTC_SHIFT));
745 775
746 /* set config to be the same as vpe0, particularly kseg0 coherency alg */ 776 /* enable this VPE */
747 write_vpe_c0_config(read_c0_config()); 777 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
748 778
749 /* clear out any left overs from a previous program */ 779 /* clear out any left overs from a previous program */
780 write_vpe_c0_status(0);
750 write_vpe_c0_cause(0); 781 write_vpe_c0_cause(0);
751 782
752 /* take system out of configuration state */ 783 /* take system out of configuration state */
753 clear_c0_mvpcontrol(MVPCONTROL_VPC); 784 clear_c0_mvpcontrol(MVPCONTROL_VPC);
754 785
755 /* clear interrupts enabled IE, ERL, EXL, and KSU from c0 status */ 786 /* now safe to re-enable multi-threading */
756 write_vpe_c0_status(read_vpe_c0_status() & ~(ST0_ERL | ST0_KSU | ST0_IE | ST0_EXL)); 787 emt(dmt_flag);
757 788
758 /* set it running */ 789 /* set it running */
759 evpe(EVPE_ENABLE); 790 evpe(EVPE_ENABLE);
760 791
792 list_for_each_entry(n, &v->notify, list) {
793 n->start(v->minor);
794 }
795
761 return 0; 796 return 0;
762} 797}
763 798
764static unsigned long find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs, 799static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
765 unsigned int symindex, const char *strtab, 800 unsigned int symindex, const char *strtab,
766 struct module *mod) 801 struct module *mod)
767{ 802{
@@ -778,26 +813,28 @@ static unsigned long find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
778 } 813 }
779 } 814 }
780 815
816 if ( (v->__start == 0) || (v->shared_ptr == NULL))
817 return -1;
818
781 return 0; 819 return 0;
782} 820}
783 821
784/* 822/*
785 * Allocates a VPE with some program code space(the load address), copies 823 * Allocates a VPE with some program code space(the load address), copies the
786 * the contents of the program (p)buffer performing relocatations/etc, 824 * contents of the program (p)buffer performing relocatations/etc, free's it
787 * free's it when finished. 825 * when finished.
788*/ 826 */
789int vpe_elfload(struct vpe * v) 827int vpe_elfload(struct vpe * v)
790{ 828{
791 Elf_Ehdr *hdr; 829 Elf_Ehdr *hdr;
792 Elf_Shdr *sechdrs; 830 Elf_Shdr *sechdrs;
793 long err = 0; 831 long err = 0;
794 char *secstrings, *strtab = NULL; 832 char *secstrings, *strtab = NULL;
795 unsigned int len, i, symindex = 0, strindex = 0; 833 unsigned int len, i, symindex = 0, strindex = 0, relocate = 0;
796
797 struct module mod; // so we can re-use the relocations code 834 struct module mod; // so we can re-use the relocations code
798 835
799 memset(&mod, 0, sizeof(struct module)); 836 memset(&mod, 0, sizeof(struct module));
800 strcpy(mod.name, "VPE dummy prog module"); 837 strcpy(mod.name, "VPE loader");
801 838
802 hdr = (Elf_Ehdr *) v->pbuffer; 839 hdr = (Elf_Ehdr *) v->pbuffer;
803 len = v->plen; 840 len = v->plen;
@@ -805,16 +842,22 @@ int vpe_elfload(struct vpe * v)
805 /* Sanity checks against insmoding binaries or wrong arch, 842 /* Sanity checks against insmoding binaries or wrong arch,
806 weird elf version */ 843 weird elf version */
807 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 844 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
808 || hdr->e_type != ET_REL || !elf_check_arch(hdr) 845 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
846 || !elf_check_arch(hdr)
809 || hdr->e_shentsize != sizeof(*sechdrs)) { 847 || hdr->e_shentsize != sizeof(*sechdrs)) {
810 printk(KERN_WARNING 848 printk(KERN_WARNING
811 "VPE program, wrong arch or weird elf version\n"); 849 "VPE loader: program wrong arch or weird elf version\n");
812 850
813 return -ENOEXEC; 851 return -ENOEXEC;
814 } 852 }
815 853
854 if (hdr->e_type == ET_REL)
855 relocate = 1;
856
816 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) { 857 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) {
817 printk(KERN_ERR "VPE program length %u truncated\n", len); 858 printk(KERN_ERR "VPE loader: program length %u truncated\n",
859 len);
860
818 return -ENOEXEC; 861 return -ENOEXEC;
819 } 862 }
820 863
@@ -826,82 +869,126 @@ int vpe_elfload(struct vpe * v)
826 /* And these should exist, but gcc whinges if we don't init them */ 869 /* And these should exist, but gcc whinges if we don't init them */
827 symindex = strindex = 0; 870 symindex = strindex = 0;
828 871
829 for (i = 1; i < hdr->e_shnum; i++) { 872 if (relocate) {
830 873 for (i = 1; i < hdr->e_shnum; i++) {
831 if (sechdrs[i].sh_type != SHT_NOBITS 874 if (sechdrs[i].sh_type != SHT_NOBITS
832 && len < sechdrs[i].sh_offset + sechdrs[i].sh_size) { 875 && len < sechdrs[i].sh_offset + sechdrs[i].sh_size) {
833 printk(KERN_ERR "VPE program length %u truncated\n", 876 printk(KERN_ERR "VPE program length %u truncated\n",
834 len); 877 len);
835 return -ENOEXEC; 878 return -ENOEXEC;
836 } 879 }
837 880
838 /* Mark all sections sh_addr with their address in the 881 /* Mark all sections sh_addr with their address in the
839 temporary image. */ 882 temporary image. */
840 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; 883 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset;
841 884
842 /* Internal symbols and strings. */ 885 /* Internal symbols and strings. */
843 if (sechdrs[i].sh_type == SHT_SYMTAB) { 886 if (sechdrs[i].sh_type == SHT_SYMTAB) {
844 symindex = i; 887 symindex = i;
845 strindex = sechdrs[i].sh_link; 888 strindex = sechdrs[i].sh_link;
846 strtab = (char *)hdr + sechdrs[strindex].sh_offset; 889 strtab = (char *)hdr + sechdrs[strindex].sh_offset;
890 }
847 } 891 }
892 layout_sections(&mod, hdr, sechdrs, secstrings);
848 } 893 }
849 894
850 layout_sections(&mod, hdr, sechdrs, secstrings);
851
852 v->load_addr = alloc_progmem(mod.core_size); 895 v->load_addr = alloc_progmem(mod.core_size);
853 memset(v->load_addr, 0, mod.core_size); 896 memset(v->load_addr, 0, mod.core_size);
854 897
855 printk("VPE elf_loader: loading to %p\n", v->load_addr); 898 printk("VPE loader: loading to %p\n", v->load_addr);
856 899
857 for (i = 0; i < hdr->e_shnum; i++) { 900 if (relocate) {
858 void *dest; 901 for (i = 0; i < hdr->e_shnum; i++) {
902 void *dest;
859 903
860 if (!(sechdrs[i].sh_flags & SHF_ALLOC)) 904 if (!(sechdrs[i].sh_flags & SHF_ALLOC))
861 continue; 905 continue;
862 906
863 dest = v->load_addr + sechdrs[i].sh_entsize; 907 dest = v->load_addr + sechdrs[i].sh_entsize;
864 908
865 if (sechdrs[i].sh_type != SHT_NOBITS) 909 if (sechdrs[i].sh_type != SHT_NOBITS)
866 memcpy(dest, (void *)sechdrs[i].sh_addr, 910 memcpy(dest, (void *)sechdrs[i].sh_addr,
867 sechdrs[i].sh_size); 911 sechdrs[i].sh_size);
868 /* Update sh_addr to point to copy in image. */ 912 /* Update sh_addr to point to copy in image. */
869 sechdrs[i].sh_addr = (unsigned long)dest; 913 sechdrs[i].sh_addr = (unsigned long)dest;
870 }
871 914
872 /* Fix up syms, so that st_value is a pointer to location. */ 915 printk(KERN_DEBUG " section sh_name %s sh_addr 0x%x\n",
873 err = 916 secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr);
874 simplify_symbols(sechdrs, symindex, strtab, secstrings, 917 }
875 hdr->e_shnum, &mod);
876 if (err < 0) {
877 printk(KERN_WARNING "VPE: unable to simplify symbols\n");
878 goto cleanup;
879 }
880 918
881 /* Now do relocations. */ 919 /* Fix up syms, so that st_value is a pointer to location. */
882 for (i = 1; i < hdr->e_shnum; i++) { 920 simplify_symbols(sechdrs, symindex, strtab, secstrings,
883 const char *strtab = (char *)sechdrs[strindex].sh_addr; 921 hdr->e_shnum, &mod);
884 unsigned int info = sechdrs[i].sh_info; 922
885 923 /* Now do relocations. */
886 /* Not a valid relocation section? */ 924 for (i = 1; i < hdr->e_shnum; i++) {
887 if (info >= hdr->e_shnum) 925 const char *strtab = (char *)sechdrs[strindex].sh_addr;
888 continue; 926 unsigned int info = sechdrs[i].sh_info;
889 927
890 /* Don't bother with non-allocated sections */ 928 /* Not a valid relocation section? */
891 if (!(sechdrs[info].sh_flags & SHF_ALLOC)) 929 if (info >= hdr->e_shnum)
892 continue; 930 continue;
893 931
894 if (sechdrs[i].sh_type == SHT_REL) 932 /* Don't bother with non-allocated sections */
895 err = 933 if (!(sechdrs[info].sh_flags & SHF_ALLOC))
896 apply_relocations(sechdrs, strtab, symindex, i, &mod); 934 continue;
897 else if (sechdrs[i].sh_type == SHT_RELA) 935
898 err = apply_relocate_add(sechdrs, strtab, symindex, i, 936 if (sechdrs[i].sh_type == SHT_REL)
899 &mod); 937 err = apply_relocations(sechdrs, strtab, symindex, i,
900 if (err < 0) { 938 &mod);
901 printk(KERN_WARNING 939 else if (sechdrs[i].sh_type == SHT_RELA)
902 "vpe_elfload: error in relocations err %ld\n", 940 err = apply_relocate_add(sechdrs, strtab, symindex, i,
903 err); 941 &mod);
904 goto cleanup; 942 if (err < 0)
943 return err;
944
945 }
946 } else {
947 for (i = 0; i < hdr->e_shnum; i++) {
948
949 /* Internal symbols and strings. */
950 if (sechdrs[i].sh_type == SHT_SYMTAB) {
951 symindex = i;
952 strindex = sechdrs[i].sh_link;
953 strtab = (char *)hdr + sechdrs[strindex].sh_offset;
954
955 /* mark the symtab's address for when we try to find the
956 magic symbols */
957 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset;
958 }
959
960 /* filter sections we dont want in the final image */
961 if (!(sechdrs[i].sh_flags & SHF_ALLOC) ||
962 (sechdrs[i].sh_type == SHT_MIPS_REGINFO)) {
963 printk( KERN_DEBUG " ignoring section, "
964 "name %s type %x address 0x%x \n",
965 secstrings + sechdrs[i].sh_name,
966 sechdrs[i].sh_type, sechdrs[i].sh_addr);
967 continue;
968 }
969
970 if (sechdrs[i].sh_addr < (unsigned int)v->load_addr) {
971 printk( KERN_WARNING "VPE loader: "
972 "fully linked image has invalid section, "
973 "name %s type %x address 0x%x, before load "
974 "address of 0x%x\n",
975 secstrings + sechdrs[i].sh_name,
976 sechdrs[i].sh_type, sechdrs[i].sh_addr,
977 (unsigned int)v->load_addr);
978 return -ENOEXEC;
979 }
980
981 printk(KERN_DEBUG " copying section sh_name %s, sh_addr 0x%x "
982 "size 0x%x0 from x%p\n",
983 secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr,
984 sechdrs[i].sh_size, hdr + sechdrs[i].sh_offset);
985
986 if (sechdrs[i].sh_type != SHT_NOBITS)
987 memcpy((void *)sechdrs[i].sh_addr,
988 (char *)hdr + sechdrs[i].sh_offset,
989 sechdrs[i].sh_size);
990 else
991 memset((void *)sechdrs[i].sh_addr, 0, sechdrs[i].sh_size);
905 } 992 }
906 } 993 }
907 994
@@ -910,71 +997,104 @@ int vpe_elfload(struct vpe * v)
910 (unsigned long)v->load_addr + v->len); 997 (unsigned long)v->load_addr + v->len);
911 998
912 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) { 999 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) {
1000 if (v->__start == 0) {
1001 printk(KERN_WARNING "VPE loader: program does not contain "
1002 "a __start symbol\n");
1003 return -ENOEXEC;
1004 }
913 1005
914 printk(KERN_WARNING 1006 if (v->shared_ptr == NULL)
915 "VPE: program doesn't contain __start or vpe_shared symbols\n"); 1007 printk(KERN_WARNING "VPE loader: "
916 err = -ENOEXEC; 1008 "program does not contain vpe_shared symbol.\n"
1009 " Unable to use AMVP (AP/SP) facilities.\n");
917 } 1010 }
918 1011
919 printk(" elf loaded\n"); 1012 printk(" elf loaded\n");
920 1013 return 0;
921cleanup:
922 return err;
923} 1014}
924 1015
925static void dump_vpe(struct vpe * v) 1016__attribute_used__ void dump_vpe(struct vpe * v)
926{ 1017{
927 struct tc *t; 1018 struct tc *t;
928 1019
1020 settc(v->minor);
1021
929 printk(KERN_DEBUG "VPEControl 0x%lx\n", read_vpe_c0_vpecontrol()); 1022 printk(KERN_DEBUG "VPEControl 0x%lx\n", read_vpe_c0_vpecontrol());
930 printk(KERN_DEBUG "VPEConf0 0x%lx\n", read_vpe_c0_vpeconf0()); 1023 printk(KERN_DEBUG "VPEConf0 0x%lx\n", read_vpe_c0_vpeconf0());
931 1024
932 list_for_each_entry(t, &vpecontrol.tc_list, list) { 1025 list_for_each_entry(t, &vpecontrol.tc_list, list)
933 dump_tc(t); 1026 dump_tc(t);
934 }
935} 1027}
936 1028
937/* checks for VPE is unused and gets ready to load program */ 1029static void cleanup_tc(struct tc *tc)
1030{
1031 int tmp;
1032
1033 /* Put MVPE's into 'configuration state' */
1034 set_c0_mvpcontrol(MVPCONTROL_VPC);
1035
1036 settc(tc->index);
1037 tmp = read_tc_c0_tcstatus();
1038
1039 /* mark not allocated and not dynamically allocatable */
1040 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1041 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1042 write_tc_c0_tcstatus(tmp);
1043
1044 write_tc_c0_tchalt(TCHALT_H);
1045
1046 /* bind it to anything other than VPE1 */
1047 write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
1048
1049 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1050}
1051
1052static int getcwd(char *buff, int size)
1053{
1054 mm_segment_t old_fs;
1055 int ret;
1056
1057 old_fs = get_fs();
1058 set_fs(KERNEL_DS);
1059
1060 ret = sys_getcwd(buff,size);
1061
1062 set_fs(old_fs);
1063
1064 return ret;
1065}
1066
1067/* checks VPE is unused and gets ready to load program */
938static int vpe_open(struct inode *inode, struct file *filp) 1068static int vpe_open(struct inode *inode, struct file *filp)
939{ 1069{
940 int minor; 1070 int minor, ret;
941 struct vpe *v; 1071 struct vpe *v;
1072 struct vpe_notifications *not;
942 1073
943 /* assume only 1 device at the mo. */ 1074 /* assume only 1 device at the mo. */
944 if ((minor = MINOR(inode->i_rdev)) != 1) { 1075 if ((minor = MINOR(inode->i_rdev)) != 1) {
945 printk(KERN_WARNING "VPE: only vpe1 is supported\n"); 1076 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
946 return -ENODEV; 1077 return -ENODEV;
947 } 1078 }
948 1079
949 if ((v = get_vpe(minor)) == NULL) { 1080 if ((v = get_vpe(minor)) == NULL) {
950 printk(KERN_WARNING "VPE: unable to get vpe\n"); 1081 printk(KERN_WARNING "VPE loader: unable to get vpe\n");
951 return -ENODEV; 1082 return -ENODEV;
952 } 1083 }
953 1084
954 if (v->state != VPE_STATE_UNUSED) { 1085 if (v->state != VPE_STATE_UNUSED) {
955 unsigned long tmp;
956 struct tc *t;
957
958 printk(KERN_WARNING "VPE: device %d already in use\n", minor);
959
960 dvpe(); 1086 dvpe();
961 dump_vpe(v);
962
963 printk(KERN_WARNING "VPE: re-initialising %d\n", minor);
964
965 release_progmem(v->load_addr);
966 1087
967 t = get_tc(minor); 1088 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n");
968 settc(minor);
969 tmp = read_tc_c0_tcstatus();
970 1089
971 /* mark not allocated and not dynamically allocatable */ 1090 dump_tc(get_tc(minor));
972 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
973 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
974 write_tc_c0_tcstatus(tmp);
975 1091
976 write_tc_c0_tchalt(TCHALT_H); 1092 list_for_each_entry(not, &v->notify, list) {
1093 not->stop(minor);
1094 }
977 1095
1096 release_progmem(v->load_addr);
1097 cleanup_tc(get_tc(minor));
978 } 1098 }
979 1099
980 // allocate it so when we get write ops we know it's expected. 1100 // allocate it so when we get write ops we know it's expected.
@@ -986,6 +1106,24 @@ static int vpe_open(struct inode *inode, struct file *filp)
986 v->load_addr = NULL; 1106 v->load_addr = NULL;
987 v->len = 0; 1107 v->len = 0;
988 1108
1109 v->uid = filp->f_uid;
1110 v->gid = filp->f_gid;
1111
1112#ifdef CONFIG_MIPS_APSP_KSPD
1113 /* get kspd to tell us when a syscall_exit happens */
1114 if (!kspd_events_reqd) {
1115 kspd_notify(&kspd_events);
1116 kspd_events_reqd++;
1117 }
1118#endif
1119
1120 v->cwd[0] = 0;
1121 ret = getcwd(v->cwd, VPE_PATH_MAX);
1122 if (ret < 0)
1123 printk(KERN_WARNING "VPE loader: open, getcwd returned %d\n", ret);
1124
1125 v->shared_ptr = NULL;
1126 v->__start = 0;
989 return 0; 1127 return 0;
990} 1128}
991 1129
@@ -1006,14 +1144,22 @@ static int vpe_release(struct inode *inode, struct file *filp)
1006 if (vpe_elfload(v) >= 0) 1144 if (vpe_elfload(v) >= 0)
1007 vpe_run(v); 1145 vpe_run(v);
1008 else { 1146 else {
1009 printk(KERN_WARNING "VPE: ELF load failed.\n"); 1147 printk(KERN_WARNING "VPE loader: ELF load failed.\n");
1010 ret = -ENOEXEC; 1148 ret = -ENOEXEC;
1011 } 1149 }
1012 } else { 1150 } else {
1013 printk(KERN_WARNING "VPE: only elf files are supported\n"); 1151 printk(KERN_WARNING "VPE loader: only elf files are supported\n");
1014 ret = -ENOEXEC; 1152 ret = -ENOEXEC;
1015 } 1153 }
1016 1154
1155 /* It's good to be able to run the SP and if it chokes have a look at
1156 the /dev/rt?. But if we reset the pointer to the shared struct we
1157 loose what has happened. So perhaps if garbage is sent to the vpe
1158 device, use it as a trigger for the reset. Hopefully a nice
1159 executable will be along shortly. */
1160 if (ret < 0)
1161 v->shared_ptr = NULL;
1162
1017 // cleanup any temp buffers 1163 // cleanup any temp buffers
1018 if (v->pbuffer) 1164 if (v->pbuffer)
1019 vfree(v->pbuffer); 1165 vfree(v->pbuffer);
@@ -1033,21 +1179,19 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer,
1033 return -ENODEV; 1179 return -ENODEV;
1034 1180
1035 if (v->pbuffer == NULL) { 1181 if (v->pbuffer == NULL) {
1036 printk(KERN_ERR "vpe_write: no pbuffer\n"); 1182 printk(KERN_ERR "VPE loader: no buffer for program\n");
1037 return -ENOMEM; 1183 return -ENOMEM;
1038 } 1184 }
1039 1185
1040 if ((count + v->len) > v->plen) { 1186 if ((count + v->len) > v->plen) {
1041 printk(KERN_WARNING 1187 printk(KERN_WARNING
1042 "VPE Loader: elf size too big. Perhaps strip uneeded symbols\n"); 1188 "VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
1043 return -ENOMEM; 1189 return -ENOMEM;
1044 } 1190 }
1045 1191
1046 count -= copy_from_user(v->pbuffer + v->len, buffer, count); 1192 count -= copy_from_user(v->pbuffer + v->len, buffer, count);
1047 if (!count) { 1193 if (!count)
1048 printk("vpe_write: copy_to_user failed\n");
1049 return -EFAULT; 1194 return -EFAULT;
1050 }
1051 1195
1052 v->len += count; 1196 v->len += count;
1053 return ret; 1197 return ret;
@@ -1149,16 +1293,70 @@ void *vpe_get_shared(int index)
1149{ 1293{
1150 struct vpe *v; 1294 struct vpe *v;
1151 1295
1152 if ((v = get_vpe(index)) == NULL) { 1296 if ((v = get_vpe(index)) == NULL)
1153 printk(KERN_WARNING "vpe: invalid vpe index %d\n", index);
1154 return NULL; 1297 return NULL;
1155 }
1156 1298
1157 return v->shared_ptr; 1299 return v->shared_ptr;
1158} 1300}
1159 1301
1160EXPORT_SYMBOL(vpe_get_shared); 1302EXPORT_SYMBOL(vpe_get_shared);
1161 1303
1304int vpe_getuid(int index)
1305{
1306 struct vpe *v;
1307
1308 if ((v = get_vpe(index)) == NULL)
1309 return -1;
1310
1311 return v->uid;
1312}
1313
1314EXPORT_SYMBOL(vpe_getuid);
1315
1316int vpe_getgid(int index)
1317{
1318 struct vpe *v;
1319
1320 if ((v = get_vpe(index)) == NULL)
1321 return -1;
1322
1323 return v->gid;
1324}
1325
1326EXPORT_SYMBOL(vpe_getgid);
1327
1328int vpe_notify(int index, struct vpe_notifications *notify)
1329{
1330 struct vpe *v;
1331
1332 if ((v = get_vpe(index)) == NULL)
1333 return -1;
1334
1335 list_add(&notify->list, &v->notify);
1336 return 0;
1337}
1338
1339EXPORT_SYMBOL(vpe_notify);
1340
1341char *vpe_getcwd(int index)
1342{
1343 struct vpe *v;
1344
1345 if ((v = get_vpe(index)) == NULL)
1346 return NULL;
1347
1348 return v->cwd;
1349}
1350
1351EXPORT_SYMBOL(vpe_getcwd);
1352
1353#ifdef CONFIG_MIPS_APSP_KSPD
1354static void kspd_sp_exit( int sp_id)
1355{
1356 cleanup_tc(get_tc(sp_id));
1357}
1358#endif
1359
1162static int __init vpe_module_init(void) 1360static int __init vpe_module_init(void)
1163{ 1361{
1164 struct vpe *v = NULL; 1362 struct vpe *v = NULL;
@@ -1201,7 +1399,8 @@ static int __init vpe_module_init(void)
1201 return -ENODEV; 1399 return -ENODEV;
1202 } 1400 }
1203 1401
1204 list_add(&t->tc, &v->tc); /* add the tc to the list of this vpe's tc's. */ 1402 /* add the tc to the list of this vpe's tc's. */
1403 list_add(&t->tc, &v->tc);
1205 1404
1206 /* deactivate all but vpe0 */ 1405 /* deactivate all but vpe0 */
1207 if (i != 0) { 1406 if (i != 0) {
@@ -1222,10 +1421,12 @@ static int __init vpe_module_init(void)
1222 ~(ST0_IM | ST0_IE | ST0_KSU)) 1421 ~(ST0_IM | ST0_IE | ST0_KSU))
1223 | ST0_CU0); 1422 | ST0_CU0);
1224 1423
1225 /* set config to be the same as vpe0, particularly kseg0 coherency alg */ 1424 /*
1425 * Set config to be the same as vpe0,
1426 * particularly kseg0 coherency alg
1427 */
1226 write_vpe_c0_config(read_c0_config()); 1428 write_vpe_c0_config(read_c0_config());
1227 } 1429 }
1228
1229 } 1430 }
1230 1431
1231 /* TC's */ 1432 /* TC's */
@@ -1234,23 +1435,28 @@ static int __init vpe_module_init(void)
1234 if (i != 0) { 1435 if (i != 0) {
1235 unsigned long tmp; 1436 unsigned long tmp;
1236 1437
1237 /* tc 0 will of course be running.... */
1238 if (i == 0)
1239 t->state = TC_STATE_RUNNING;
1240
1241 settc(i); 1438 settc(i);
1242 1439
1243 /* bind a TC to each VPE, May as well put all excess TC's 1440 /* Any TC that is bound to VPE0 gets left as is - in case
1244 on the last VPE */ 1441 we are running SMTC on VPE0. A TC that is bound to any
1245 if (i >= (((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1)) 1442 other VPE gets bound to VPE0, ideally I'd like to make
1246 write_tc_c0_tcbind(read_tc_c0_tcbind() | 1443 it homeless but it doesn't appear to let me bind a TC
1247 ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT)); 1444 to a non-existent VPE. Which is perfectly reasonable.
1248 else 1445
1249 write_tc_c0_tcbind(read_tc_c0_tcbind() | i); 1446 The (un)bound state is visible to an EJTAG probe so may
1447 notify GDB...
1448 */
1449
1450 if (((tmp = read_tc_c0_tcbind()) & TCBIND_CURVPE)) {
1451 /* tc is bound >vpe0 */
1452 write_tc_c0_tcbind(tmp & ~TCBIND_CURVPE);
1453
1454 t->pvpe = get_vpe(0); /* set the parent vpe */
1455 }
1250 1456
1251 tmp = read_tc_c0_tcstatus(); 1457 tmp = read_tc_c0_tcstatus();
1252 1458
1253 /* mark not allocated and not dynamically allocatable */ 1459 /* mark not activated and not dynamically allocatable */
1254 tmp &= ~(TCSTATUS_A | TCSTATUS_DA); 1460 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1255 tmp |= TCSTATUS_IXMT; /* interrupt exempt */ 1461 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1256 write_tc_c0_tcstatus(tmp); 1462 write_tc_c0_tcstatus(tmp);
@@ -1262,6 +1468,9 @@ static int __init vpe_module_init(void)
1262 /* release config state */ 1468 /* release config state */
1263 clear_c0_mvpcontrol(MVPCONTROL_VPC); 1469 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1264 1470
1471#ifdef CONFIG_MIPS_APSP_KSPD
1472 kspd_events.kspd_sp_exit = kspd_sp_exit;
1473#endif
1265 return 0; 1474 return 0;
1266} 1475}
1267 1476
@@ -1281,5 +1490,5 @@ static void __exit vpe_module_exit(void)
1281module_init(vpe_module_init); 1490module_init(vpe_module_init);
1282module_exit(vpe_module_exit); 1491module_exit(vpe_module_exit);
1283MODULE_DESCRIPTION("MIPS VPE Loader"); 1492MODULE_DESCRIPTION("MIPS VPE Loader");
1284MODULE_AUTHOR("Elizabeth Clarke, MIPS Technologies, Inc"); 1493MODULE_AUTHOR("Elizabeth Oldham, MIPS Technologies, Inc.");
1285MODULE_LICENSE("GPL"); 1494MODULE_LICENSE("GPL");
diff --git a/arch/mips/lasat/Makefile b/arch/mips/lasat/Makefile
index 0d5aec436725..99f5046fdf49 100644
--- a/arch/mips/lasat/Makefile
+++ b/arch/mips/lasat/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-y += reset.o setup.o prom.o lasat_board.o \ 5obj-y += reset.o setup.o prom.o lasat_board.o \
6 at93c.o interrupt.o lasatIRQ.o 6 at93c.o interrupt.o
7 7
8obj-$(CONFIG_LASAT_SYSCTL) += sysctl.o 8obj-$(CONFIG_LASAT_SYSCTL) += sysctl.o
9obj-$(CONFIG_DS1603) += ds1603.o 9obj-$(CONFIG_DS1603) += ds1603.o
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index 852a41901a5e..2d3472b21ebb 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -27,14 +27,13 @@
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/lasat/lasatint.h> 29#include <asm/lasat/lasatint.h>
30#include <asm/time.h>
30#include <asm/gdb-stub.h> 31#include <asm/gdb-stub.h>
31 32
32static volatile int *lasat_int_status = NULL; 33static volatile int *lasat_int_status = NULL;
33static volatile int *lasat_int_mask = NULL; 34static volatile int *lasat_int_mask = NULL;
34static volatile int lasat_int_mask_shift; 35static volatile int lasat_int_mask_shift;
35 36
36extern asmlinkage void lasatIRQ(void);
37
38void disable_lasat_irq(unsigned int irq_nr) 37void disable_lasat_irq(unsigned int irq_nr)
39{ 38{
40 unsigned long flags; 39 unsigned long flags;
@@ -109,11 +108,17 @@ static unsigned long get_int_status_200(void)
109 return int_status; 108 return int_status;
110} 109}
111 110
112void lasat_hw0_irqdispatch(struct pt_regs *regs) 111asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
113{ 112{
114 unsigned long int_status; 113 unsigned long int_status;
114 unsigned int cause = read_c0_cause();
115 int irq; 115 int irq;
116 116
117 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */
118 ll_timer_interrupt(7, regs);
119 return;
120 }
121
117 int_status = get_int_status(); 122 int_status = get_int_status();
118 123
119 /* if int_status == 0, then the interrupt has already been cleared */ 124 /* if int_status == 0, then the interrupt has already been cleared */
@@ -147,9 +152,6 @@ void __init arch_init_irq(void)
147 panic("arch_init_irq: mips_machtype incorrect"); 152 panic("arch_init_irq: mips_machtype incorrect");
148 } 153 }
149 154
150 /* Now safe to set the exception vector. */
151 set_except_vector(0, lasatIRQ);
152
153 for (i = 0; i <= LASATINT_END; i++) { 155 for (i = 0; i <= LASATINT_END; i++) {
154 irq_desc[i].status = IRQ_DISABLED; 156 irq_desc[i].status = IRQ_DISABLED;
155 irq_desc[i].action = 0; 157 irq_desc[i].action = 0;
diff --git a/arch/mips/lasat/lasatIRQ.S b/arch/mips/lasat/lasatIRQ.S
deleted file mode 100644
index 2a2b0d056561..000000000000
--- a/arch/mips/lasat/lasatIRQ.S
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Interrupt exception dispatch code.
19 */
20#include <asm/asm.h>
21#include <asm/mipsregs.h>
22#include <asm/regdef.h>
23#include <asm/stackframe.h>
24
25 .text
26 .set noreorder
27 .align 5
28 NESTED(lasatIRQ, PT_SIZE, sp)
29 .set noat
30 SAVE_ALL
31 CLI
32 .set at
33 .set noreorder
34
35 mfc0 s0, CP0_CAUSE # get irq mask
36
37 /* First we check for r4k counter/timer IRQ. */
38 andi a0, s0, CAUSEF_IP7
39 beq a0, zero, 1f
40 andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
41
42 /* Wheee, a timer interrupt. */
43 li a0, 7
44 jal ll_timer_interrupt
45 move a1, sp
46
47 j ret_from_irq
48 nop
49
501:
51 /* Wheee, combined hardware level zero interrupt. */
52 jal lasat_hw0_irqdispatch
53 move a0, sp # delay slot
54
55 j ret_from_irq
56 nop # delay slot
57
581:
59 /*
60 * Here by mistake? This is possible, what can happen is that by the
61 * time we take the exception the IRQ pin goes low, so just leave if
62 * this is the case.
63 */
64 move a1,s0
65 mfc0 a1, CP0_EPC
66
67 j ret_from_irq
68 nop
69 END(lasatIRQ)
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index bc0ebc69bfb3..db53950b7cfb 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -39,8 +39,6 @@
39 39
40static struct atlas_ictrl_regs *atlas_hw0_icregs; 40static struct atlas_ictrl_regs *atlas_hw0_icregs;
41 41
42extern asmlinkage void mipsIRQ(void);
43
44#if 0 42#if 0
45#define DEBUG_INT(x...) printk(x) 43#define DEBUG_INT(x...) printk(x)
46#else 44#else
@@ -98,7 +96,7 @@ static inline int ls1bit32(unsigned int x)
98 return b; 96 return b;
99} 97}
100 98
101void atlas_hw0_irqdispatch(struct pt_regs *regs) 99static inline void atlas_hw0_irqdispatch(struct pt_regs *regs)
102{ 100{
103 unsigned long int_status; 101 unsigned long int_status;
104 int irq; 102 int irq;
@@ -116,6 +114,91 @@ void atlas_hw0_irqdispatch(struct pt_regs *regs)
116 do_IRQ(irq, regs); 114 do_IRQ(irq, regs);
117} 115}
118 116
117static inline int clz(unsigned long x)
118{
119 __asm__ (
120 " .set push \n"
121 " .set mips32 \n"
122 " clz %0, %1 \n"
123 " .set pop \n"
124 : "=r" (x)
125 : "r" (x));
126
127 return x;
128}
129
130/*
131 * Version of ffs that only looks at bits 12..15.
132 */
133static inline unsigned int irq_ffs(unsigned int pending)
134{
135#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
136 return -clz(pending) + 31 - CAUSEB_IP;
137#else
138 unsigned int a0 = 7;
139 unsigned int t0;
140
141 t0 = s0 & 0xf000;
142 t0 = t0 < 1;
143 t0 = t0 << 2;
144 a0 = a0 - t0;
145 s0 = s0 << t0;
146
147 t0 = s0 & 0xc000;
148 t0 = t0 < 1;
149 t0 = t0 << 1;
150 a0 = a0 - t0;
151 s0 = s0 << t0;
152
153 t0 = s0 & 0x8000;
154 t0 = t0 < 1;
155 //t0 = t0 << 2;
156 a0 = a0 - t0;
157 //s0 = s0 << t0;
158
159 return a0;
160#endif
161}
162
163/*
164 * IRQs on the Atlas board look basically (barring software IRQs which we
165 * don't use at all and all external interrupt sources are combined together
166 * on hardware interrupt 0 (MIPS IRQ 2)) like:
167 *
168 * MIPS IRQ Source
169 * -------- ------
170 * 0 Software (ignored)
171 * 1 Software (ignored)
172 * 2 Combined hardware interrupt (hw0)
173 * 3 Hardware (ignored)
174 * 4 Hardware (ignored)
175 * 5 Hardware (ignored)
176 * 6 Hardware (ignored)
177 * 7 R4k timer (what we use)
178 *
179 * We handle the IRQ according to _our_ priority which is:
180 *
181 * Highest ---- R4k Timer
182 * Lowest ---- Combined hardware interrupt
183 *
184 * then we just return, if multiple IRQs are pending then we will just take
185 * another exception, big deal.
186 */
187asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
188{
189 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
190 int irq;
191
192 irq = irq_ffs(pending);
193
194 if (irq == MIPSCPU_INT_ATLAS)
195 atlas_hw0_irqdispatch(regs);
196 else if (irq > 0)
197 do_IRQ(MIPSCPU_INT_BASE + irq, regs);
198 else
199 spurious_interrupt(regs);
200}
201
119void __init arch_init_irq(void) 202void __init arch_init_irq(void)
120{ 203{
121 int i; 204 int i;
@@ -128,9 +211,6 @@ void __init arch_init_irq(void)
128 */ 211 */
129 atlas_hw0_icregs->intrsten = 0xffffffff; 212 atlas_hw0_icregs->intrsten = 0xffffffff;
130 213
131 /* Now safe to set the exception vector. */
132 set_except_vector(0, mipsIRQ);
133
134 for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) { 214 for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) {
135 irq_desc[i].status = IRQ_DISABLED; 215 irq_desc[i].status = IRQ_DISABLED;
136 irq_desc[i].action = 0; 216 irq_desc[i].action = 0;
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile
index b21bc6887fa8..be47c1c2bc80 100644
--- a/arch/mips/mips-boards/generic/Makefile
+++ b/arch/mips/mips-boards/generic/Makefile
@@ -18,8 +18,8 @@
18# Makefile for the MIPS boards generic routines under Linux. 18# Makefile for the MIPS boards generic routines under Linux.
19# 19#
20 20
21obj-y := mipsIRQ.o reset.o display.o init.o memory.o \ 21obj-y := reset.o display.o init.o memory.o printf.o \
22 printf.o cmdline.o time.o 22 cmdline.o time.o
23obj-$(CONFIG_PCI) += pci.o 23obj-$(CONFIG_PCI) += pci.o
24obj-$(CONFIG_KGDB) += gdb_hook.o 24obj-$(CONFIG_KGDB) += gdb_hook.o
25 25
diff --git a/arch/mips/mips-boards/generic/gdb_hook.c b/arch/mips/mips-boards/generic/gdb_hook.c
index 91a2ccbe3730..6a1854de4579 100644
--- a/arch/mips/mips-boards/generic/gdb_hook.c
+++ b/arch/mips/mips-boards/generic/gdb_hook.c
@@ -25,7 +25,7 @@
25#include <asm/serial.h> 25#include <asm/serial.h>
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28static struct serial_state rs_table[RS_TABLE_SIZE] = { 28static struct serial_state rs_table[] = {
29 SERIAL_PORT_DFNS /* Defined in serial.h */ 29 SERIAL_PORT_DFNS /* Defined in serial.h */
30}; 30};
31 31
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index eab5a705e989..17dfe6a8cab9 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -220,7 +220,6 @@ void __init kgdb_config (void)
220 generic_putDebugChar (*s++); 220 generic_putDebugChar (*s++);
221 } 221 }
222 222
223 kgdb_enabled = 1;
224 /* Breakpoint is invoked after interrupts are initialised */ 223 /* Breakpoint is invoked after interrupts are initialised */
225 } 224 }
226} 225}
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index 32c9210373ac..bc4d093685bb 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -22,10 +22,12 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/pfn.h>
25#include <linux/string.h> 26#include <linux/string.h>
26 27
27#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
28#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/sections.h>
29 31
30#include <asm/mips-boards/prom.h> 32#include <asm/mips-boards/prom.h>
31 33
@@ -46,9 +48,6 @@ static char *mtypes[3] = {
46}; 48};
47#endif 49#endif
48 50
49/* References to section boundaries */
50extern char _end;
51
52struct prom_pmemblock * __init prom_getmdesc(void) 51struct prom_pmemblock * __init prom_getmdesc(void)
53{ 52{
54 char *memsize_str; 53 char *memsize_str;
@@ -106,10 +105,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
106 105
107 mdesc[3].type = yamon_dontuse; 106 mdesc[3].type = yamon_dontuse;
108 mdesc[3].base = 0x00100000; 107 mdesc[3].base = 0x00100000;
109 mdesc[3].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[3].base; 108 mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) - mdesc[3].base;
110 109
111 mdesc[4].type = yamon_free; 110 mdesc[4].type = yamon_free;
112 mdesc[4].base = CPHYSADDR(PAGE_ALIGN(&_end)); 111 mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end));
113 mdesc[4].size = memsize - mdesc[4].base; 112 mdesc[4].size = memsize - mdesc[4].base;
114 113
115 return &mdesc[0]; 114 return &mdesc[0];
diff --git a/arch/mips/mips-boards/generic/mipsIRQ.S b/arch/mips/mips-boards/generic/mipsIRQ.S
deleted file mode 100644
index ddd5c73a2971..000000000000
--- a/arch/mips/mips-boards/generic/mipsIRQ.S
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Interrupt exception dispatch code.
23 *
24 */
25#include <linux/config.h>
26
27#include <asm/asm.h>
28#include <asm/mipsregs.h>
29#include <asm/regdef.h>
30#include <asm/stackframe.h>
31
32#ifdef CONFIG_MIPS_ATLAS
33#include <asm/mips-boards/atlasint.h>
34#define CASCADE_IRQ MIPSCPU_INT_ATLAS
35#define CASCADE_DISPATCH atlas_hw0_irqdispatch
36#endif
37#ifdef CONFIG_MIPS_MALTA
38#include <asm/mips-boards/maltaint.h>
39#define CASCADE_IRQ MIPSCPU_INT_I8259A
40#define CASCADE_DISPATCH malta_hw0_irqdispatch
41#endif
42#ifdef CONFIG_MIPS_SEAD
43#include <asm/mips-boards/seadint.h>
44#endif
45
46/* A lot of complication here is taken away because:
47 *
48 * 1) We handle one interrupt and return, sitting in a loop and moving across
49 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
50 * common case is one pending IRQ so optimize in that direction.
51 *
52 * 2) We need not check against bits in the status register IRQ mask, that
53 * would make this routine slow as hell.
54 *
55 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
56 * between like BSD spl() brain-damage.
57 *
58 * Furthermore, the IRQs on the MIPS board look basically (barring software
59 * IRQs which we don't use at all and all external interrupt sources are
60 * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
61 *
62 * MIPS IRQ Source
63 * -------- ------
64 * 0 Software (ignored)
65 * 1 Software (ignored)
66 * 2 Combined hardware interrupt (hw0)
67 * 3 Hardware (ignored)
68 * 4 Hardware (ignored)
69 * 5 Hardware (ignored)
70 * 6 Hardware (ignored)
71 * 7 R4k timer (what we use)
72 *
73 * Note: On the SEAD board thing are a little bit different.
74 * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
75 * wired to UART1.
76 *
77 * We handle the IRQ according to _our_ priority which is:
78 *
79 * Highest ---- R4k Timer
80 * Lowest ---- Combined hardware interrupt
81 *
82 * then we just return, if multiple IRQs are pending then we will just take
83 * another exception, big deal.
84 */
85
86 .text
87 .set noreorder
88 .set noat
89 .align 5
90 NESTED(mipsIRQ, PT_SIZE, sp)
91 SAVE_ALL
92 CLI
93 .set at
94
95 mfc0 s0, CP0_CAUSE # get irq bits
96 mfc0 s1, CP0_STATUS # get irq mask
97 andi s0, ST0_IM # CAUSE.CE may be non-zero!
98 and s0, s1
99
100#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
101 .set mips32
102 clz a0, s0
103 .set mips0
104 negu a0
105 addu a0, 31-CAUSEB_IP
106 bltz a0, spurious
107#else
108 beqz s0, spurious
109 li a0, 7
110
111 and t0, s0, 0xf000
112 sltiu t0, t0, 1
113 sll t0, 2
114 subu a0, t0
115 sll s0, t0
116
117 and t0, s0, 0xc000
118 sltiu t0, t0, 1
119 sll t0, 1
120 subu a0, t0
121 sll s0, t0
122
123 and t0, s0, 0x8000
124 sltiu t0, t0, 1
125 # sll t0, 0
126 subu a0, t0
127 # sll s0, t0
128#endif
129
130#ifdef CASCADE_IRQ
131 li a1, CASCADE_IRQ
132 bne a0, a1, 1f
133 addu a0, MIPSCPU_INT_BASE
134
135 jal CASCADE_DISPATCH
136 move a0, sp
137
138 j ret_from_irq
139 nop
1401:
141#else
142 addu a0, MIPSCPU_INT_BASE
143#endif
144
145 jal do_IRQ
146 move a1, sp
147
148 j ret_from_irq
149 nop
150
151
152spurious:
153 j spurious_interrupt
154 nop
155 END(mipsIRQ)
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index 93f3bf2c2b22..a9f6124b3a22 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -30,6 +30,7 @@
30#include <linux/mc146818rtc.h> 30#include <linux/mc146818rtc.h>
31 31
32#include <asm/mipsregs.h> 32#include <asm/mipsregs.h>
33#include <asm/mipsmtregs.h>
33#include <asm/ptrace.h> 34#include <asm/ptrace.h>
34#include <asm/hardirq.h> 35#include <asm/hardirq.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
@@ -50,16 +51,23 @@ unsigned long cpu_khz;
50static char display_string[] = " LINUX ON ATLAS "; 51static char display_string[] = " LINUX ON ATLAS ";
51#endif 52#endif
52#if defined(CONFIG_MIPS_MALTA) 53#if defined(CONFIG_MIPS_MALTA)
54#if defined(CONFIG_MIPS_MT_SMTC)
55static char display_string[] = " SMTC LINUX ON MALTA ";
56#else
53static char display_string[] = " LINUX ON MALTA "; 57static char display_string[] = " LINUX ON MALTA ";
58#endif /* CONFIG_MIPS_MT_SMTC */
54#endif 59#endif
55#if defined(CONFIG_MIPS_SEAD) 60#if defined(CONFIG_MIPS_SEAD)
56static char display_string[] = " LINUX ON SEAD "; 61static char display_string[] = " LINUX ON SEAD ";
57#endif 62#endif
58static unsigned int display_count = 0; 63static unsigned int display_count;
59#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8) 64#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
60 65
61static unsigned int timer_tick_count=0; 66#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
67
68static unsigned int timer_tick_count;
62static int mips_cpu_timer_irq; 69static int mips_cpu_timer_irq;
70extern void smtc_timer_broadcast(int);
63 71
64static inline void scroll_display_message(void) 72static inline void scroll_display_message(void)
65{ 73{
@@ -75,15 +83,55 @@ static void mips_timer_dispatch (struct pt_regs *regs)
75 do_IRQ (mips_cpu_timer_irq, regs); 83 do_IRQ (mips_cpu_timer_irq, regs);
76} 84}
77 85
86/*
87 * Redeclare until I get around mopping the timer code insanity on MIPS.
88 */
78extern int null_perf_irq(struct pt_regs *regs); 89extern int null_perf_irq(struct pt_regs *regs);
79 90
80extern int (*perf_irq)(struct pt_regs *regs); 91extern int (*perf_irq)(struct pt_regs *regs);
81 92
82irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 93irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
83{ 94{
84 int r2 = cpu_has_mips_r2;
85 int cpu = smp_processor_id(); 95 int cpu = smp_processor_id();
96 int r2 = cpu_has_mips_r2;
97
98#ifdef CONFIG_MIPS_MT_SMTC
99 /*
100 * In an SMTC system, one Count/Compare set exists per VPE.
101 * Which TC within a VPE gets the interrupt is essentially
102 * random - we only know that it shouldn't be one with
103 * IXMT set. Whichever TC gets the interrupt needs to
104 * send special interprocessor interrupts to the other
105 * TCs to make sure that they schedule, etc.
106 *
107 * That code is specific to the SMTC kernel, not to
108 * the a particular platform, so it's invoked from
109 * the general MIPS timer_interrupt routine.
110 */
111
112 /*
113 * DVPE is necessary so long as cross-VPE interrupts
114 * are done via read-modify-write of Cause register.
115 */
116 int vpflags = dvpe();
117 write_c0_compare (read_c0_count() - 1);
118 clear_c0_cause(CPUCTR_IMASKBIT);
119 evpe(vpflags);
120
121 if (cpu_data[cpu].vpe_id == 0) {
122 timer_interrupt(irq, dev_id, regs);
123 scroll_display_message();
124 } else
125 write_c0_compare (read_c0_count() + ( mips_hpt_frequency/HZ));
126 smtc_timer_broadcast(cpu_data[cpu].vpe_id);
86 127
128 if (cpu != 0)
129 /*
130 * Other CPUs should do profiling and process accounting
131 */
132 local_timer_interrupt(irq, dev_id, regs);
133
134#else /* CONFIG_MIPS_MT_SMTC */
87 if (cpu == 0) { 135 if (cpu == 0) {
88 /* 136 /*
89 * CPU 0 handles the global timer interrupt job and process 137 * CPU 0 handles the global timer interrupt job and process
@@ -107,12 +155,14 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
107 * More support needs to be added to kernel/time for 155 * More support needs to be added to kernel/time for
108 * counter/timer interrupts on multiple CPU's 156 * counter/timer interrupts on multiple CPU's
109 */ 157 */
110 write_c0_compare (read_c0_count() + (mips_hpt_frequency/HZ)); 158 write_c0_compare(read_c0_count() + (mips_hpt_frequency/HZ));
159
111 /* 160 /*
112 * other CPUs should do profiling and process accounting 161 * Other CPUs should do profiling and process accounting
113 */ 162 */
114 local_timer_interrupt (irq, dev_id, regs); 163 local_timer_interrupt(irq, dev_id, regs);
115 } 164 }
165#endif /* CONFIG_MIPS_MT_SMTC */
116 166
117out: 167out:
118 return IRQ_HANDLED; 168 return IRQ_HANDLED;
@@ -126,7 +176,7 @@ static unsigned int __init estimate_cpu_frequency(void)
126 unsigned int prid = read_c0_prid() & 0xffff00; 176 unsigned int prid = read_c0_prid() & 0xffff00;
127 unsigned int count; 177 unsigned int count;
128 178
129#ifdef CONFIG_MIPS_SEAD 179#if defined(CONFIG_MIPS_SEAD) || defined(CONFIG_MIPS_SIM)
130 /* 180 /*
131 * The SEAD board doesn't have a real time clock, so we can't 181 * The SEAD board doesn't have a real time clock, so we can't
132 * really calculate the timer frequency 182 * really calculate the timer frequency
@@ -211,7 +261,11 @@ void __init mips_timer_setup(struct irqaction *irq)
211 261
212 /* we are using the cpu counter for timer interrupts */ 262 /* we are using the cpu counter for timer interrupts */
213 irq->handler = mips_timer_interrupt; /* we use our own handler */ 263 irq->handler = mips_timer_interrupt; /* we use our own handler */
264#ifdef CONFIG_MIPS_MT_SMTC
265 setup_irq_smtc(mips_cpu_timer_irq, irq, CPUCTR_IMASKBIT);
266#else
214 setup_irq(mips_cpu_timer_irq, irq); 267 setup_irq(mips_cpu_timer_irq, irq);
268#endif /* CONFIG_MIPS_MT_SMTC */
215 269
216#ifdef CONFIG_SMP 270#ifdef CONFIG_SMP
217 /* irq_desc(riptor) is a global resource, when the interrupt overlaps 271 /* irq_desc(riptor) is a global resource, when the interrupt overlaps
diff --git a/arch/mips/mips-boards/malta/Makefile b/arch/mips/mips-boards/malta/Makefile
index fd4c143c0e2f..77ee5c6d33c1 100644
--- a/arch/mips/mips-boards/malta/Makefile
+++ b/arch/mips/mips-boards/malta/Makefile
@@ -20,3 +20,4 @@
20# 20#
21 21
22obj-y := malta_int.o malta_setup.o 22obj-y := malta_int.o malta_setup.o
23obj-$(CONFIG_SMP) += malta_smp.o
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
index d06dc5ad6c9e..64db07d4dbe5 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -40,7 +40,6 @@
40#include <asm/mips-boards/msc01_pci.h> 40#include <asm/mips-boards/msc01_pci.h>
41#include <asm/msc01_ic.h> 41#include <asm/msc01_ic.h>
42 42
43extern asmlinkage void mipsIRQ(void);
44extern void mips_timer_interrupt(void); 43extern void mips_timer_interrupt(void);
45 44
46static DEFINE_SPINLOCK(mips_irq_lock); 45static DEFINE_SPINLOCK(mips_irq_lock);
@@ -114,13 +113,14 @@ static inline int get_int(void)
114 return irq; 113 return irq;
115} 114}
116 115
117void malta_hw0_irqdispatch(struct pt_regs *regs) 116static void malta_hw0_irqdispatch(struct pt_regs *regs)
118{ 117{
119 int irq; 118 int irq;
120 119
121 irq = get_int(); 120 irq = get_int();
122 if (irq < 0) 121 if (irq < 0) {
123 return; /* interrupt has already been cleared */ 122 return; /* interrupt has already been cleared */
123 }
124 124
125 do_IRQ(MALTA_INT_BASE+irq, regs); 125 do_IRQ(MALTA_INT_BASE+irq, regs);
126} 126}
@@ -182,6 +182,92 @@ void corehi_irqdispatch(struct pt_regs *regs)
182 die("CoreHi interrupt", regs); 182 die("CoreHi interrupt", regs);
183} 183}
184 184
185static inline int clz(unsigned long x)
186{
187 __asm__ (
188 " .set push \n"
189 " .set mips32 \n"
190 " clz %0, %1 \n"
191 " .set pop \n"
192 : "=r" (x)
193 : "r" (x));
194
195 return x;
196}
197
198/*
199 * Version of ffs that only looks at bits 12..15.
200 */
201static inline unsigned int irq_ffs(unsigned int pending)
202{
203#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
204 return -clz(pending) + 31 - CAUSEB_IP;
205#else
206 unsigned int a0 = 7;
207 unsigned int t0;
208
209 t0 = s0 & 0xf000;
210 t0 = t0 < 1;
211 t0 = t0 << 2;
212 a0 = a0 - t0;
213 s0 = s0 << t0;
214
215 t0 = s0 & 0xc000;
216 t0 = t0 < 1;
217 t0 = t0 << 1;
218 a0 = a0 - t0;
219 s0 = s0 << t0;
220
221 t0 = s0 & 0x8000;
222 t0 = t0 < 1;
223 //t0 = t0 << 2;
224 a0 = a0 - t0;
225 //s0 = s0 << t0;
226
227 return a0;
228#endif
229}
230
231/*
232 * IRQs on the Malta board look basically (barring software IRQs which we
233 * don't use at all and all external interrupt sources are combined together
234 * on hardware interrupt 0 (MIPS IRQ 2)) like:
235 *
236 * MIPS IRQ Source
237 * -------- ------
238 * 0 Software (ignored)
239 * 1 Software (ignored)
240 * 2 Combined hardware interrupt (hw0)
241 * 3 Hardware (ignored)
242 * 4 Hardware (ignored)
243 * 5 Hardware (ignored)
244 * 6 Hardware (ignored)
245 * 7 R4k timer (what we use)
246 *
247 * We handle the IRQ according to _our_ priority which is:
248 *
249 * Highest ---- R4k Timer
250 * Lowest ---- Combined hardware interrupt
251 *
252 * then we just return, if multiple IRQs are pending then we will just take
253 * another exception, big deal.
254 */
255
256asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
257{
258 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
259 int irq;
260
261 irq = irq_ffs(pending);
262
263 if (irq == MIPSCPU_INT_I8259A)
264 malta_hw0_irqdispatch(regs);
265 else if (irq > 0)
266 do_IRQ(MIPSCPU_INT_BASE + irq, regs);
267 else
268 spurious_interrupt(regs);
269}
270
185static struct irqaction i8259irq = { 271static struct irqaction i8259irq = {
186 .handler = no_action, 272 .handler = no_action,
187 .name = "XT-PIC cascade" 273 .name = "XT-PIC cascade"
@@ -214,7 +300,6 @@ int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap)/sizeof(msc_irqmap_t);
214 300
215void __init arch_init_irq(void) 301void __init arch_init_irq(void)
216{ 302{
217 set_except_vector(0, mipsIRQ);
218 init_i8259_irqs(); 303 init_i8259_irqs();
219 304
220 if (!cpu_has_veic) 305 if (!cpu_has_veic)
@@ -240,12 +325,17 @@ void __init arch_init_irq(void)
240 else if (cpu_has_vint) { 325 else if (cpu_has_vint) {
241 set_vi_handler (MIPSCPU_INT_I8259A, malta_hw0_irqdispatch); 326 set_vi_handler (MIPSCPU_INT_I8259A, malta_hw0_irqdispatch);
242 set_vi_handler (MIPSCPU_INT_COREHI, corehi_irqdispatch); 327 set_vi_handler (MIPSCPU_INT_COREHI, corehi_irqdispatch);
243 328#ifdef CONFIG_MIPS_MT_SMTC
329 setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq,
330 (0x100 << MIPSCPU_INT_I8259A));
331 setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI,
332 &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI));
333#else /* Not SMTC */
244 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq); 334 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq);
245 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction); 335 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
336#endif /* CONFIG_MIPS_MT_SMTC */
246 } 337 }
247 else { 338 else {
248 set_except_vector(0, mipsIRQ);
249 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq); 339 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq);
250 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction); 340 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
251 } 341 }
diff --git a/arch/mips/mips-boards/malta/malta_smp.c b/arch/mips/mips-boards/malta/malta_smp.c
new file mode 100644
index 000000000000..6c6c8eeedbce
--- /dev/null
+++ b/arch/mips/mips-boards/malta/malta_smp.c
@@ -0,0 +1,128 @@
1/*
2 * Malta Platform-specific hooks for SMP operation
3 */
4
5#include <linux/kernel.h>
6#include <linux/sched.h>
7#include <linux/cpumask.h>
8#include <linux/interrupt.h>
9
10#include <asm/atomic.h>
11#include <asm/cpu.h>
12#include <asm/processor.h>
13#include <asm/system.h>
14#include <asm/hardirq.h>
15#include <asm/mmu_context.h>
16#include <asm/smp.h>
17#ifdef CONFIG_MIPS_MT_SMTC
18#include <asm/smtc_ipi.h>
19#endif /* CONFIG_MIPS_MT_SMTC */
20
21/* VPE/SMP Prototype implements platform interfaces directly */
22#if !defined(CONFIG_MIPS_MT_SMP)
23
24/*
25 * Cause the specified action to be performed on a targeted "CPU"
26 */
27
28void core_send_ipi(int cpu, unsigned int action)
29{
30/* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */
31#ifdef CONFIG_MIPS_MT_SMTC
32 smtc_send_ipi(cpu, LINUX_SMP_IPI, action);
33#endif /* CONFIG_MIPS_MT_SMTC */
34}
35
36/*
37 * Detect available CPUs/VPEs/TCs and populate phys_cpu_present_map
38 */
39
40void __init prom_build_cpu_map(void)
41{
42 int nextslot;
43
44 /*
45 * As of November, 2004, MIPSsim only simulates one core
46 * at a time. However, that core may be a MIPS MT core
47 * with multiple virtual processors and thread contexts.
48 */
49
50 if (read_c0_config3() & (1<<2)) {
51 nextslot = mipsmt_build_cpu_map(1);
52 }
53}
54
55/*
56 * Platform "CPU" startup hook
57 */
58
59void prom_boot_secondary(int cpu, struct task_struct *idle)
60{
61#ifdef CONFIG_MIPS_MT_SMTC
62 smtc_boot_secondary(cpu, idle);
63#endif /* CONFIG_MIPS_MT_SMTC */
64}
65
66/*
67 * Post-config but pre-boot cleanup entry point
68 */
69
70void prom_init_secondary(void)
71{
72#ifdef CONFIG_MIPS_MT_SMTC
73 void smtc_init_secondary(void);
74 int myvpe;
75
76 /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */
77 myvpe = read_c0_tcbind() & TCBIND_CURVPE;
78 if (myvpe != 0) {
79 /* Ideally, this should be done only once per VPE, but... */
80 clear_c0_status(STATUSF_IP2);
81 set_c0_status(STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP3
82 | STATUSF_IP4 | STATUSF_IP5 | STATUSF_IP6
83 | STATUSF_IP7);
84 }
85
86 smtc_init_secondary();
87#endif /* CONFIG_MIPS_MT_SMTC */
88}
89
90/*
91 * Platform SMP pre-initialization
92 *
93 * As noted above, we can assume a single CPU for now
94 * but it may be multithreaded.
95 */
96
97void plat_smp_setup(void)
98{
99 if (read_c0_config3() & (1<<2))
100 mipsmt_build_cpu_map(0);
101}
102
103void __init plat_prepare_cpus(unsigned int max_cpus)
104{
105 if (read_c0_config3() & (1<<2))
106 mipsmt_prepare_cpus();
107}
108
109/*
110 * SMP initialization finalization entry point
111 */
112
113void prom_smp_finish(void)
114{
115#ifdef CONFIG_MIPS_MT_SMTC
116 smtc_smp_finish();
117#endif /* CONFIG_MIPS_MT_SMTC */
118}
119
120/*
121 * Hook for after all CPUs are online
122 */
123
124void prom_cpus_done(void)
125{
126}
127
128#endif /* CONFIG_MIPS32R2_MT_SMP */
diff --git a/arch/mips/mips-boards/sead/sead_int.c b/arch/mips/mips-boards/sead/sead_int.c
index 90fda0d9915f..9168d934c661 100644
--- a/arch/mips/mips-boards/sead/sead_int.c
+++ b/arch/mips/mips-boards/sead/sead_int.c
@@ -24,16 +24,94 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25 25
26#include <asm/irq_cpu.h> 26#include <asm/irq_cpu.h>
27#include <asm/mipsregs.h>
27#include <asm/system.h> 28#include <asm/system.h>
28 29
29#include <asm/mips-boards/seadint.h> 30#include <asm/mips-boards/seadint.h>
30 31
31extern asmlinkage void mipsIRQ(void); 32static inline int clz(unsigned long x)
33{
34 __asm__ (
35 " .set push \n"
36 " .set mips32 \n"
37 " clz %0, %1 \n"
38 " .set pop \n"
39 : "=r" (x)
40 : "r" (x));
41
42 return x;
43}
44
45/*
46 * Version of ffs that only looks at bits 12..15.
47 */
48static inline unsigned int irq_ffs(unsigned int pending)
49{
50#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
51 return -clz(pending) + 31 - CAUSEB_IP;
52#else
53 unsigned int a0 = 7;
54 unsigned int t0;
55
56 t0 = s0 & 0xf000;
57 t0 = t0 < 1;
58 t0 = t0 << 2;
59 a0 = a0 - t0;
60 s0 = s0 << t0;
61
62 t0 = s0 & 0xc000;
63 t0 = t0 < 1;
64 t0 = t0 << 1;
65 a0 = a0 - t0;
66 s0 = s0 << t0;
67
68 t0 = s0 & 0x8000;
69 t0 = t0 < 1;
70 //t0 = t0 << 2;
71 a0 = a0 - t0;
72 //s0 = s0 << t0;
73
74 return a0;
75#endif
76}
77
78/*
79 * IRQs on the SEAD board look basically are combined together on hardware
80 * interrupt 0 (MIPS IRQ 2)) like:
81 *
82 * MIPS IRQ Source
83 * -------- ------
84 * 0 Software (ignored)
85 * 1 Software (ignored)
86 * 2 UART0 (hw0)
87 * 3 UART1 (hw1)
88 * 4 Hardware (ignored)
89 * 5 Hardware (ignored)
90 * 6 Hardware (ignored)
91 * 7 R4k timer (what we use)
92 *
93 * We handle the IRQ according to _our_ priority which is:
94 *
95 * Highest ---- R4k Timer
96 * Lowest ---- Combined hardware interrupt
97 *
98 * then we just return, if multiple IRQs are pending then we will just take
99 * another exception, big deal.
100 */
101asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
102{
103 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
104 int irq;
105
106 irq = irq_ffs(pending);
107
108 if (irq >= 0)
109 do_IRQ(MIPSCPU_INT_BASE + irq, regs);
110 else
111 spurious_interrupt(regs);
112}
32 113
33void __init arch_init_irq(void) 114void __init arch_init_irq(void)
34{ 115{
35 mips_cpu_irq_init(MIPSCPU_INT_BASE); 116 mips_cpu_irq_init(MIPSCPU_INT_BASE);
36
37 /* Now safe to set the exception vector. */
38 set_except_vector(0, mipsIRQ);
39} 117}
diff --git a/arch/mips/mips-boards/sim/cmdline.c b/arch/mips/mips-boards/sim/cmdline.c
deleted file mode 100644
index fef9fbd8e710..000000000000
--- a/arch/mips/mips-boards/sim/cmdline.c
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Kernel command line creation using the prom monitor (YAMON) argc/argv.
19 */
20#include <linux/init.h>
21#include <linux/string.h>
22
23#include <asm/bootinfo.h>
24
25extern int prom_argc;
26extern int *_prom_argv;
27
28/*
29 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
30 * This macro take care of sign extension.
31 */
32#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
33
34char arcs_cmdline[CL_SIZE];
35
36char * __init prom_getcmdline(void)
37{
38 return &(arcs_cmdline[0]);
39}
40
41
42void __init prom_init_cmdline(void)
43{
44 char *cp;
45 int actr;
46
47 actr = 1; /* Always ignore argv[0] */
48
49 cp = &(arcs_cmdline[0]);
50 while(actr < prom_argc) {
51 strcpy(cp, prom_argv(actr));
52 cp += strlen(prom_argv(actr));
53 *cp++ = ' ';
54 actr++;
55 }
56 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
57 --cp;
58 *cp = '\0';
59}
diff --git a/arch/mips/mips-boards/sim/sim_cmdline.c b/arch/mips/mips-boards/sim/sim_cmdline.c
index 9df37c6fca36..c63021a5dc6c 100644
--- a/arch/mips/mips-boards/sim/sim_cmdline.c
+++ b/arch/mips/mips-boards/sim/sim_cmdline.c
@@ -26,8 +26,10 @@ char * __init prom_getcmdline(void)
26 return arcs_cmdline; 26 return arcs_cmdline;
27} 27}
28 28
29
30void __init prom_init_cmdline(void) 29void __init prom_init_cmdline(void)
31{ 30{
32 /* nothing to do */ 31 char *cp;
32 cp = arcs_cmdline;
33 /* Get boot line from environment? */
34 *cp = '\0';
33} 35}
diff --git a/arch/mips/mips-boards/sim/sim_int.c b/arch/mips/mips-boards/sim/sim_int.c
index a4d0a2c05031..2c15c8efec4e 100644
--- a/arch/mips/mips-boards/sim/sim_int.c
+++ b/arch/mips/mips-boards/sim/sim_int.c
@@ -25,17 +25,71 @@
25 25
26extern void mips_cpu_irq_init(int); 26extern void mips_cpu_irq_init(int);
27 27
28extern asmlinkage void simIRQ(void); 28static inline int clz(unsigned long x)
29{
30 __asm__ (
31 " .set push \n"
32 " .set mips32 \n"
33 " clz %0, %1 \n"
34 " .set pop \n"
35 : "=r" (x)
36 : "r" (x));
37
38 return x;
39}
40
41/*
42 * Version of ffs that only looks at bits 12..15.
43 */
44static inline unsigned int irq_ffs(unsigned int pending)
45{
46#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
47 return -clz(pending) + 31 - CAUSEB_IP;
48#else
49 unsigned int a0 = 7;
50 unsigned int t0;
51
52 t0 = s0 & 0xf000;
53 t0 = t0 < 1;
54 t0 = t0 << 2;
55 a0 = a0 - t0;
56 s0 = s0 << t0;
57
58 t0 = s0 & 0xc000;
59 t0 = t0 < 1;
60 t0 = t0 << 1;
61 a0 = a0 - t0;
62 s0 = s0 << t0;
29 63
30asmlinkage void sim_hw0_irqdispatch(struct pt_regs *regs) 64 t0 = s0 & 0x8000;
65 t0 = t0 < 1;
66 //t0 = t0 << 2;
67 a0 = a0 - t0;
68 //s0 = s0 << t0;
69
70 return a0;
71#endif
72}
73
74static inline void sim_hw0_irqdispatch(struct pt_regs *regs)
31{ 75{
32 do_IRQ(2, regs); 76 do_IRQ(2, regs);
33} 77}
34 78
35void __init arch_init_irq(void) 79asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
36{ 80{
37 /* Now safe to set the exception vector. */ 81 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
38 set_except_vector(0, simIRQ); 82 int irq;
83
84 irq = irq_ffs(pending);
39 85
86 if (irq > 0)
87 do_IRQ(MIPSCPU_INT_BASE + irq, regs);
88 else
89 spurious_interrupt(regs);
90}
91
92void __init arch_init_irq(void)
93{
40 mips_cpu_irq_init(MIPSCPU_INT_BASE); 94 mips_cpu_irq_init(MIPSCPU_INT_BASE);
41} 95}
diff --git a/arch/mips/mips-boards/sim/sim_irq.S b/arch/mips/mips-boards/sim/sim_irq.S
index da52297a2216..d16cf3822076 100644
--- a/arch/mips/mips-boards/sim/sim_irq.S
+++ b/arch/mips/mips-boards/sim/sim_irq.S
@@ -94,6 +94,8 @@
94 94
95 95
96spurious: 96spurious:
97 j spurious_interrupt 97 jal spurious_interrupt
98 nop
99 j ret_from_irq
98 nop 100 nop
99 END(simIRQ) 101 END(simIRQ)
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index e57f737bab10..f7ce76983328 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -18,9 +18,11 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/bootmem.h> 20#include <linux/bootmem.h>
21#include <linux/pfn.h>
21 22
22#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
23#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/sections.h>
24 26
25#include <asm/mips-boards/prom.h> 27#include <asm/mips-boards/prom.h>
26 28
@@ -39,9 +41,6 @@ static char *mtypes[3] = {
39}; 41};
40#endif 42#endif
41 43
42/* References to section boundaries */
43extern char _end;
44
45struct prom_pmemblock * __init prom_getmdesc(void) 44struct prom_pmemblock * __init prom_getmdesc(void)
46{ 45{
47 unsigned int memsize; 46 unsigned int memsize;
@@ -61,10 +60,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
61 60
62 mdesc[2].type = simmem_reserved; 61 mdesc[2].type = simmem_reserved;
63 mdesc[2].base = 0x00100000; 62 mdesc[2].base = 0x00100000;
64 mdesc[2].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[2].base; 63 mdesc[2].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[2].base;
65 64
66 mdesc[3].type = simmem_free; 65 mdesc[3].type = simmem_free;
67 mdesc[3].base = CPHYSADDR(PAGE_ALIGN(&_end)); 66 mdesc[3].base = CPHYSADDR(PFN_ALIGN(&_end));
68 mdesc[3].size = memsize - mdesc[3].base; 67 mdesc[3].size = memsize - mdesc[3].base;
69 68
70 return &mdesc[0]; 69 return &mdesc[0];
diff --git a/arch/mips/mips-boards/sim/sim_smp.c b/arch/mips/mips-boards/sim/sim_smp.c
index a9f0c2bfe4ad..b7084e7c4bf9 100644
--- a/arch/mips/mips-boards/sim/sim_smp.c
+++ b/arch/mips/mips-boards/sim/sim_smp.c
@@ -44,8 +44,6 @@
44void core_send_ipi(int cpu, unsigned int action) 44void core_send_ipi(int cpu, unsigned int action)
45{ 45{
46#ifdef CONFIG_MIPS_MT_SMTC 46#ifdef CONFIG_MIPS_MT_SMTC
47 void smtc_send_ipi(int, int, unsigned int);
48
49 smtc_send_ipi(cpu, LINUX_SMP_IPI, action); 47 smtc_send_ipi(cpu, LINUX_SMP_IPI, action);
50#endif /* CONFIG_MIPS_MT_SMTC */ 48#endif /* CONFIG_MIPS_MT_SMTC */
51/* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */ 49/* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */
@@ -59,15 +57,8 @@ void core_send_ipi(int cpu, unsigned int action)
59void __init prom_build_cpu_map(void) 57void __init prom_build_cpu_map(void)
60{ 58{
61#ifdef CONFIG_MIPS_MT_SMTC 59#ifdef CONFIG_MIPS_MT_SMTC
62 extern int mipsmt_build_cpu_map(int startslot);
63 int nextslot; 60 int nextslot;
64 61
65 cpus_clear(phys_cpu_present_map);
66
67 /* Register the boot CPU */
68
69 smp_prepare_boot_cpu();
70
71 /* 62 /*
72 * As of November, 2004, MIPSsim only simulates one core 63 * As of November, 2004, MIPSsim only simulates one core
73 * at a time. However, that core may be a MIPS MT core 64 * at a time. However, that core may be a MIPS MT core
@@ -87,8 +78,6 @@ void __init prom_build_cpu_map(void)
87void prom_boot_secondary(int cpu, struct task_struct *idle) 78void prom_boot_secondary(int cpu, struct task_struct *idle)
88{ 79{
89#ifdef CONFIG_MIPS_MT_SMTC 80#ifdef CONFIG_MIPS_MT_SMTC
90 extern void smtc_boot_secondary(int cpu, struct task_struct *t);
91
92 smtc_boot_secondary(cpu, idle); 81 smtc_boot_secondary(cpu, idle);
93#endif /* CONFIG_MIPS_MT_SMTC */ 82#endif /* CONFIG_MIPS_MT_SMTC */
94} 83}
@@ -113,7 +102,6 @@ void prom_init_secondary(void)
113void prom_prepare_cpus(unsigned int max_cpus) 102void prom_prepare_cpus(unsigned int max_cpus)
114{ 103{
115#ifdef CONFIG_MIPS_MT_SMTC 104#ifdef CONFIG_MIPS_MT_SMTC
116 void mipsmt_prepare_cpus(int c);
117 /* 105 /*
118 * As noted above, we can assume a single CPU for now 106 * As noted above, we can assume a single CPU for now
119 * but it may be multithreaded. 107 * but it may be multithreaded.
@@ -132,8 +120,6 @@ void prom_prepare_cpus(unsigned int max_cpus)
132void prom_smp_finish(void) 120void prom_smp_finish(void)
133{ 121{
134#ifdef CONFIG_MIPS_MT_SMTC 122#ifdef CONFIG_MIPS_MT_SMTC
135 void smtc_smp_finish(void);
136
137 smtc_smp_finish(); 123 smtc_smp_finish();
138#endif /* CONFIG_MIPS_MT_SMTC */ 124#endif /* CONFIG_MIPS_MT_SMTC */
139} 125}
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 9dd1352d5748..bb041a22f20a 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -260,6 +260,10 @@ static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page,
260{ 260{
261} 261}
262 262
263static void local_r3k_flush_data_cache_page(unsigned long addr)
264{
265}
266
263static void r3k_flush_data_cache_page(unsigned long addr) 267static void r3k_flush_data_cache_page(unsigned long addr)
264{ 268{
265} 269}
@@ -335,6 +339,7 @@ void __init r3k_cache_init(void)
335 flush_icache_range = r3k_flush_icache_range; 339 flush_icache_range = r3k_flush_icache_range;
336 340
337 flush_cache_sigtramp = r3k_flush_cache_sigtramp; 341 flush_cache_sigtramp = r3k_flush_cache_sigtramp;
342 local_flush_data_cache_page = local_r3k_flush_data_cache_page;
338 flush_data_cache_page = r3k_flush_data_cache_page; 343 flush_data_cache_page = r3k_flush_data_cache_page;
339 344
340 _dma_cache_wback_inv = r3k_dma_cache_wback_inv; 345 _dma_cache_wback_inv = r3k_dma_cache_wback_inv;
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 32b7f6aeb983..4182e1176fae 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -154,7 +154,8 @@ static inline void blast_icache32_r4600_v1_page_indexed(unsigned long page)
154 154
155static inline void tx49_blast_icache32_page_indexed(unsigned long page) 155static inline void tx49_blast_icache32_page_indexed(unsigned long page)
156{ 156{
157 unsigned long start = page; 157 unsigned long indexmask = current_cpu_data.icache.waysize - 1;
158 unsigned long start = INDEX_BASE + (page & indexmask);
158 unsigned long end = start + PAGE_SIZE; 159 unsigned long end = start + PAGE_SIZE;
159 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; 160 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
160 unsigned long ws_end = current_cpu_data.icache.ways << 161 unsigned long ws_end = current_cpu_data.icache.ways <<
@@ -749,12 +750,12 @@ static void __init probe_pcache(void)
749 icache_size = 1 << (12 + ((config & CONF_IC) >> 9)); 750 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
750 c->icache.linesz = 16 << ((config & CONF_IB) >> 5); 751 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
751 c->icache.ways = 2; 752 c->icache.ways = 2;
752 c->icache.waybit = ffs(icache_size/2) - 1; 753 c->icache.waybit = __ffs(icache_size/2);
753 754
754 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6)); 755 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
755 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4); 756 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
756 c->dcache.ways = 2; 757 c->dcache.ways = 2;
757 c->dcache.waybit= ffs(dcache_size/2) - 1; 758 c->dcache.waybit= __ffs(dcache_size/2);
758 759
759 c->options |= MIPS_CPU_CACHE_CDEX_P; 760 c->options |= MIPS_CPU_CACHE_CDEX_P;
760 break; 761 break;
@@ -837,12 +838,12 @@ static void __init probe_pcache(void)
837 icache_size = 1 << (10 + ((config & CONF_IC) >> 9)); 838 icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
838 c->icache.linesz = 16 << ((config & CONF_IB) >> 5); 839 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
839 c->icache.ways = 2; 840 c->icache.ways = 2;
840 c->icache.waybit = ffs(icache_size/2) - 1; 841 c->icache.waybit = __ffs(icache_size/2);
841 842
842 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6)); 843 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6));
843 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4); 844 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
844 c->dcache.ways = 2; 845 c->dcache.ways = 2;
845 c->dcache.waybit = ffs(dcache_size/2) - 1; 846 c->dcache.waybit = __ffs(dcache_size/2);
846 847
847 c->options |= MIPS_CPU_CACHE_CDEX_P; 848 c->options |= MIPS_CPU_CACHE_CDEX_P;
848 break; 849 break;
@@ -873,12 +874,12 @@ static void __init probe_pcache(void)
873 icache_size = 1 << (12 + ((config & CONF_IC) >> 9)); 874 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
874 c->icache.linesz = 16 << ((config & CONF_IB) >> 5); 875 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
875 c->icache.ways = 4; 876 c->icache.ways = 4;
876 c->icache.waybit = ffs(icache_size / c->icache.ways) - 1; 877 c->icache.waybit = __ffs(icache_size / c->icache.ways);
877 878
878 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6)); 879 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
879 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4); 880 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
880 c->dcache.ways = 4; 881 c->dcache.ways = 4;
881 c->dcache.waybit = ffs(dcache_size / c->dcache.ways) - 1; 882 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways);
882 883
883#if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR) 884#if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR)
884 c->options |= MIPS_CPU_CACHE_CDEX_P; 885 c->options |= MIPS_CPU_CACHE_CDEX_P;
@@ -906,7 +907,7 @@ static void __init probe_pcache(void)
906 icache_size = c->icache.sets * 907 icache_size = c->icache.sets *
907 c->icache.ways * 908 c->icache.ways *
908 c->icache.linesz; 909 c->icache.linesz;
909 c->icache.waybit = ffs(icache_size/c->icache.ways) - 1; 910 c->icache.waybit = __ffs(icache_size/c->icache.ways);
910 911
911 if (config & 0x8) /* VI bit */ 912 if (config & 0x8) /* VI bit */
912 c->icache.flags |= MIPS_CACHE_VTAG; 913 c->icache.flags |= MIPS_CACHE_VTAG;
@@ -926,7 +927,7 @@ static void __init probe_pcache(void)
926 dcache_size = c->dcache.sets * 927 dcache_size = c->dcache.sets *
927 c->dcache.ways * 928 c->dcache.ways *
928 c->dcache.linesz; 929 c->dcache.linesz;
929 c->dcache.waybit = ffs(dcache_size/c->dcache.ways) - 1; 930 c->dcache.waybit = __ffs(dcache_size/c->dcache.ways);
930 931
931 c->options |= MIPS_CPU_PREFETCH; 932 c->options |= MIPS_CPU_PREFETCH;
932 break; 933 break;
@@ -1198,6 +1199,7 @@ void __init r4k_cache_init(void)
1198 1199
1199 flush_cache_sigtramp = r4k_flush_cache_sigtramp; 1200 flush_cache_sigtramp = r4k_flush_cache_sigtramp;
1200 flush_icache_all = r4k_flush_icache_all; 1201 flush_icache_all = r4k_flush_icache_all;
1202 local_flush_data_cache_page = local_r4k_flush_data_cache_page;
1201 flush_data_cache_page = r4k_flush_data_cache_page; 1203 flush_data_cache_page = r4k_flush_data_cache_page;
1202 flush_icache_range = r4k_flush_icache_range; 1204 flush_icache_range = r4k_flush_icache_range;
1203 1205
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
index 2f08b535f20e..f9b129491b1e 100644
--- a/arch/mips/mm/c-sb1.c
+++ b/arch/mips/mm/c-sb1.c
@@ -528,6 +528,7 @@ void sb1_cache_init(void)
528 flush_cache_page = sb1_flush_cache_page; 528 flush_cache_page = sb1_flush_cache_page;
529 529
530 flush_cache_sigtramp = sb1_flush_cache_sigtramp; 530 flush_cache_sigtramp = sb1_flush_cache_sigtramp;
531 local_flush_data_cache_page = (void *) sb1_nop;
531 flush_data_cache_page = (void *) sb1_nop; 532 flush_data_cache_page = (void *) sb1_nop;
532 533
533 /* Full flush */ 534 /* Full flush */
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index fe232e3988e3..5dfc9b1901f6 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -216,6 +216,11 @@ static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page
216 tx39_blast_icache_page_indexed(page); 216 tx39_blast_icache_page_indexed(page);
217} 217}
218 218
219static void local_tx39_flush_data_cache_page(void * addr)
220{
221 tx39_blast_dcache_page(addr);
222}
223
219static void tx39_flush_data_cache_page(unsigned long addr) 224static void tx39_flush_data_cache_page(unsigned long addr)
220{ 225{
221 tx39_blast_dcache_page(addr); 226 tx39_blast_dcache_page(addr);
@@ -381,6 +386,7 @@ void __init tx39_cache_init(void)
381 flush_icache_range = (void *) tx39h_flush_icache_all; 386 flush_icache_range = (void *) tx39h_flush_icache_all;
382 387
383 flush_cache_sigtramp = (void *) tx39h_flush_icache_all; 388 flush_cache_sigtramp = (void *) tx39h_flush_icache_all;
389 local_flush_data_cache_page = (void *) tx39h_flush_icache_all;
384 flush_data_cache_page = (void *) tx39h_flush_icache_all; 390 flush_data_cache_page = (void *) tx39h_flush_icache_all;
385 391
386 _dma_cache_wback_inv = tx39h_dma_cache_wback_inv; 392 _dma_cache_wback_inv = tx39h_dma_cache_wback_inv;
@@ -406,6 +412,7 @@ void __init tx39_cache_init(void)
406 flush_icache_range = tx39_flush_icache_range; 412 flush_icache_range = tx39_flush_icache_range;
407 413
408 flush_cache_sigtramp = tx39_flush_cache_sigtramp; 414 flush_cache_sigtramp = tx39_flush_cache_sigtramp;
415 local_flush_data_cache_page = local_tx39_flush_data_cache_page;
409 flush_data_cache_page = tx39_flush_data_cache_page; 416 flush_data_cache_page = tx39_flush_data_cache_page;
410 417
411 _dma_cache_wback_inv = tx39_dma_cache_wback_inv; 418 _dma_cache_wback_inv = tx39_dma_cache_wback_inv;
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 591c22b080e4..83a56296be86 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -30,6 +30,7 @@ void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
30 30
31/* MIPS specific cache operations */ 31/* MIPS specific cache operations */
32void (*flush_cache_sigtramp)(unsigned long addr); 32void (*flush_cache_sigtramp)(unsigned long addr);
33void (*local_flush_data_cache_page)(void * addr);
33void (*flush_data_cache_page)(unsigned long addr); 34void (*flush_data_cache_page)(unsigned long addr);
34void (*flush_icache_all)(void); 35void (*flush_icache_all)(void);
35 36
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 2d9624fd10ec..e3a617224868 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -157,7 +157,6 @@ no_context:
157 * Oops. The kernel tried to access some bad page. We'll have to 157 * Oops. The kernel tried to access some bad page. We'll have to
158 * terminate things with extreme prejudice. 158 * terminate things with extreme prejudice.
159 */ 159 */
160
161 bust_spinlocks(1); 160 bust_spinlocks(1);
162 161
163 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at " 162 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
@@ -188,11 +187,20 @@ do_sigbus:
188 /* Kernel mode? Handle exceptions or die */ 187 /* Kernel mode? Handle exceptions or die */
189 if (!user_mode(regs)) 188 if (!user_mode(regs))
190 goto no_context; 189 goto no_context;
191 190 else
192 /* 191 /*
193 * Send a sigbus, regardless of whether we were in kernel 192 * Send a sigbus, regardless of whether we were in kernel
194 * or user mode. 193 * or user mode.
195 */ 194 */
195#if 0
196 printk("do_page_fault() #3: sending SIGBUS to %s for "
197 "invalid %s\n%0*lx (epc == %0*lx, ra == %0*lx)\n",
198 tsk->comm,
199 write ? "write access to" : "read access from",
200 field, address,
201 field, (unsigned long) regs->cp0_epc,
202 field, (unsigned long) regs->regs[31]);
203#endif
196 tsk->thread.cp0_badvaddr = address; 204 tsk->thread.cp0_badvaddr = address;
197 info.si_signo = SIGBUS; 205 info.si_signo = SIGBUS;
198 info.si_errno = 0; 206 info.si_errno = 0;
@@ -201,7 +209,6 @@ do_sigbus:
201 force_sig_info(SIGBUS, &info, tsk); 209 force_sig_info(SIGBUS, &info, tsk);
202 210
203 return; 211 return;
204
205vmalloc_fault: 212vmalloc_fault:
206 { 213 {
207 /* 214 /*
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 1f7b37b38f5c..0c544375b856 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -83,6 +83,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
83 preempt_check_resched(); 83 preempt_check_resched();
84} 84}
85 85
86#ifndef CONFIG_LIMITED_DMA
86/* 87/*
87 * This is the same as kmap_atomic() but can map memory that doesn't 88 * This is the same as kmap_atomic() but can map memory that doesn't
88 * have a struct page associated with it. 89 * have a struct page associated with it.
@@ -101,6 +102,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
101 102
102 return (void*) vaddr; 103 return (void*) vaddr;
103} 104}
105#endif /* CONFIG_LIMITED_DMA */
104 106
105struct page *__kmap_atomic_to_page(void *ptr) 107struct page *__kmap_atomic_to_page(void *ptr)
106{ 108{
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index ad89c442f299..c22308b93ff0 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -276,6 +276,20 @@ void __init mem_init(void)
276} 276}
277#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 277#endif /* !CONFIG_NEED_MULTIPLE_NODES */
278 278
279void free_init_pages(char *what, unsigned long begin, unsigned long end)
280{
281 unsigned long addr;
282
283 for (addr = begin; addr < end; addr += PAGE_SIZE) {
284 ClearPageReserved(virt_to_page(addr));
285 init_page_count(virt_to_page(addr));
286 memset((void *)addr, 0xcc, PAGE_SIZE);
287 free_page(addr);
288 totalram_pages++;
289 }
290 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
291}
292
279#ifdef CONFIG_BLK_DEV_INITRD 293#ifdef CONFIG_BLK_DEV_INITRD
280void free_initrd_mem(unsigned long start, unsigned long end) 294void free_initrd_mem(unsigned long start, unsigned long end)
281{ 295{
@@ -284,16 +298,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
284 start = (unsigned long)phys_to_virt(CPHYSADDR(start)); 298 start = (unsigned long)phys_to_virt(CPHYSADDR(start));
285 end = (unsigned long)phys_to_virt(CPHYSADDR(end)); 299 end = (unsigned long)phys_to_virt(CPHYSADDR(end));
286#endif 300#endif
287 if (start < end) 301 free_init_pages("initrd memory", start, end);
288 printk(KERN_INFO "Freeing initrd memory: %ldk freed\n",
289 (end - start) >> 10);
290
291 for (; start < end; start += PAGE_SIZE) {
292 ClearPageReserved(virt_to_page(start));
293 init_page_count(virt_to_page(start));
294 free_page(start);
295 totalram_pages++;
296 }
297} 302}
298#endif 303#endif
299 304
@@ -301,24 +306,17 @@ extern unsigned long prom_free_prom_memory(void);
301 306
302void free_initmem(void) 307void free_initmem(void)
303{ 308{
304 unsigned long addr, page, freed; 309 unsigned long start, end, freed;
305 310
306 freed = prom_free_prom_memory(); 311 freed = prom_free_prom_memory();
312 if (freed)
313 printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed);
307 314
308 addr = (unsigned long) &__init_begin; 315 start = (unsigned long)(&__init_begin);
309 while (addr < (unsigned long) &__init_end) { 316 end = (unsigned long)(&__init_end);
310#ifdef CONFIG_64BIT 317#ifdef CONFIG_64BIT
311 page = PAGE_OFFSET | CPHYSADDR(addr); 318 start = PAGE_OFFSET | CPHYSADDR(start);
312#else 319 end = PAGE_OFFSET | CPHYSADDR(end);
313 page = addr;
314#endif 320#endif
315 ClearPageReserved(virt_to_page(page)); 321 free_init_pages("unused kernel memory", start, end);
316 init_page_count(virt_to_page(page));
317 free_page(page);
318 totalram_pages++;
319 freed += PAGE_SIZE;
320 addr += PAGE_SIZE;
321 }
322 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n",
323 freed >> 10);
324} 322}
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index 3b6cc9ba1b05..31ec73052423 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -138,7 +138,7 @@ void __init rm7k_sc_init(void)
138 138
139 c->scache.linesz = sc_lsize; 139 c->scache.linesz = sc_lsize;
140 c->scache.ways = 4; 140 c->scache.ways = 4;
141 c->scache.waybit= ffs(scache_size / c->scache.ways) - 1; 141 c->scache.waybit= __ffs(scache_size / c->scache.ways);
142 c->scache.waysize = scache_size / c->scache.ways; 142 c->scache.waysize = scache_size / c->scache.ways;
143 c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways); 143 c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
144 printk(KERN_INFO "Secondary cache size %dK, linesize %d bytes.\n", 144 printk(KERN_INFO "Secondary cache size %dK, linesize %d bytes.\n",
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index a865f2394cb0..9dca099ba16b 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -32,13 +32,35 @@ extern void build_tlb_refill_handler(void);
32 "nop; nop; nop; nop; nop; nop;\n\t" \ 32 "nop; nop; nop; nop; nop; nop;\n\t" \
33 ".set reorder\n\t") 33 ".set reorder\n\t")
34 34
35/* Atomicity and interruptability */
36#ifdef CONFIG_MIPS_MT_SMTC
37
38#include <asm/smtc.h>
39#include <asm/mipsmtregs.h>
40
41#define ENTER_CRITICAL(flags) \
42 { \
43 unsigned int mvpflags; \
44 local_irq_save(flags);\
45 mvpflags = dvpe()
46#define EXIT_CRITICAL(flags) \
47 evpe(mvpflags); \
48 local_irq_restore(flags); \
49 }
50#else
51
52#define ENTER_CRITICAL(flags) local_irq_save(flags)
53#define EXIT_CRITICAL(flags) local_irq_restore(flags)
54
55#endif /* CONFIG_MIPS_MT_SMTC */
56
35void local_flush_tlb_all(void) 57void local_flush_tlb_all(void)
36{ 58{
37 unsigned long flags; 59 unsigned long flags;
38 unsigned long old_ctx; 60 unsigned long old_ctx;
39 int entry; 61 int entry;
40 62
41 local_irq_save(flags); 63 ENTER_CRITICAL(flags);
42 /* Save old context and create impossible VPN2 value */ 64 /* Save old context and create impossible VPN2 value */
43 old_ctx = read_c0_entryhi(); 65 old_ctx = read_c0_entryhi();
44 write_c0_entrylo0(0); 66 write_c0_entrylo0(0);
@@ -57,7 +79,7 @@ void local_flush_tlb_all(void)
57 } 79 }
58 tlbw_use_hazard(); 80 tlbw_use_hazard();
59 write_c0_entryhi(old_ctx); 81 write_c0_entryhi(old_ctx);
60 local_irq_restore(flags); 82 EXIT_CRITICAL(flags);
61} 83}
62 84
63/* All entries common to a mm share an asid. To effectively flush 85/* All entries common to a mm share an asid. To effectively flush
@@ -87,6 +109,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
87 unsigned long flags; 109 unsigned long flags;
88 int size; 110 int size;
89 111
112 ENTER_CRITICAL(flags);
90 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 113 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
91 size = (size + 1) >> 1; 114 size = (size + 1) >> 1;
92 local_irq_save(flags); 115 local_irq_save(flags);
@@ -120,7 +143,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
120 } else { 143 } else {
121 drop_mmu_context(mm, cpu); 144 drop_mmu_context(mm, cpu);
122 } 145 }
123 local_irq_restore(flags); 146 EXIT_CRITICAL(flags);
124 } 147 }
125} 148}
126 149
@@ -129,9 +152,9 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
129 unsigned long flags; 152 unsigned long flags;
130 int size; 153 int size;
131 154
155 ENTER_CRITICAL(flags);
132 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 156 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
133 size = (size + 1) >> 1; 157 size = (size + 1) >> 1;
134 local_irq_save(flags);
135 if (size <= current_cpu_data.tlbsize / 2) { 158 if (size <= current_cpu_data.tlbsize / 2) {
136 int pid = read_c0_entryhi(); 159 int pid = read_c0_entryhi();
137 160
@@ -162,7 +185,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
162 } else { 185 } else {
163 local_flush_tlb_all(); 186 local_flush_tlb_all();
164 } 187 }
165 local_irq_restore(flags); 188 EXIT_CRITICAL(flags);
166} 189}
167 190
168void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) 191void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
@@ -175,7 +198,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
175 198
176 newpid = cpu_asid(cpu, vma->vm_mm); 199 newpid = cpu_asid(cpu, vma->vm_mm);
177 page &= (PAGE_MASK << 1); 200 page &= (PAGE_MASK << 1);
178 local_irq_save(flags); 201 ENTER_CRITICAL(flags);
179 oldpid = read_c0_entryhi(); 202 oldpid = read_c0_entryhi();
180 write_c0_entryhi(page | newpid); 203 write_c0_entryhi(page | newpid);
181 mtc0_tlbw_hazard(); 204 mtc0_tlbw_hazard();
@@ -194,7 +217,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
194 217
195 finish: 218 finish:
196 write_c0_entryhi(oldpid); 219 write_c0_entryhi(oldpid);
197 local_irq_restore(flags); 220 EXIT_CRITICAL(flags);
198 } 221 }
199} 222}
200 223
@@ -207,7 +230,7 @@ void local_flush_tlb_one(unsigned long page)
207 unsigned long flags; 230 unsigned long flags;
208 int oldpid, idx; 231 int oldpid, idx;
209 232
210 local_irq_save(flags); 233 ENTER_CRITICAL(flags);
211 oldpid = read_c0_entryhi(); 234 oldpid = read_c0_entryhi();
212 page &= (PAGE_MASK << 1); 235 page &= (PAGE_MASK << 1);
213 write_c0_entryhi(page); 236 write_c0_entryhi(page);
@@ -226,7 +249,7 @@ void local_flush_tlb_one(unsigned long page)
226 } 249 }
227 write_c0_entryhi(oldpid); 250 write_c0_entryhi(oldpid);
228 251
229 local_irq_restore(flags); 252 EXIT_CRITICAL(flags);
230} 253}
231 254
232/* 255/*
@@ -249,7 +272,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
249 if (current->active_mm != vma->vm_mm) 272 if (current->active_mm != vma->vm_mm)
250 return; 273 return;
251 274
252 local_irq_save(flags); 275 ENTER_CRITICAL(flags);
253 276
254 pid = read_c0_entryhi() & ASID_MASK; 277 pid = read_c0_entryhi() & ASID_MASK;
255 address &= (PAGE_MASK << 1); 278 address &= (PAGE_MASK << 1);
@@ -277,7 +300,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
277 else 300 else
278 tlb_write_indexed(); 301 tlb_write_indexed();
279 tlbw_use_hazard(); 302 tlbw_use_hazard();
280 local_irq_restore(flags); 303 EXIT_CRITICAL(flags);
281} 304}
282 305
283#if 0 306#if 0
@@ -291,7 +314,7 @@ static void r4k_update_mmu_cache_hwbug(struct vm_area_struct * vma,
291 pte_t *ptep; 314 pte_t *ptep;
292 int idx; 315 int idx;
293 316
294 local_irq_save(flags); 317 ENTER_CRITICAL(flags);
295 address &= (PAGE_MASK << 1); 318 address &= (PAGE_MASK << 1);
296 asid = read_c0_entryhi() & ASID_MASK; 319 asid = read_c0_entryhi() & ASID_MASK;
297 write_c0_entryhi(address | asid); 320 write_c0_entryhi(address | asid);
@@ -310,7 +333,7 @@ static void r4k_update_mmu_cache_hwbug(struct vm_area_struct * vma,
310 else 333 else
311 tlb_write_indexed(); 334 tlb_write_indexed();
312 tlbw_use_hazard(); 335 tlbw_use_hazard();
313 local_irq_restore(flags); 336 EXIT_CRITICAL(flags);
314} 337}
315#endif 338#endif
316 339
@@ -322,7 +345,7 @@ void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
322 unsigned long old_pagemask; 345 unsigned long old_pagemask;
323 unsigned long old_ctx; 346 unsigned long old_ctx;
324 347
325 local_irq_save(flags); 348 ENTER_CRITICAL(flags);
326 /* Save old context and create impossible VPN2 value */ 349 /* Save old context and create impossible VPN2 value */
327 old_ctx = read_c0_entryhi(); 350 old_ctx = read_c0_entryhi();
328 old_pagemask = read_c0_pagemask(); 351 old_pagemask = read_c0_pagemask();
@@ -342,7 +365,7 @@ void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
342 BARRIER; 365 BARRIER;
343 write_c0_pagemask(old_pagemask); 366 write_c0_pagemask(old_pagemask);
344 local_flush_tlb_all(); 367 local_flush_tlb_all();
345 local_irq_restore(flags); 368 EXIT_CRITICAL(flags);
346} 369}
347 370
348/* 371/*
@@ -362,7 +385,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
362 unsigned long old_pagemask; 385 unsigned long old_pagemask;
363 unsigned long old_ctx; 386 unsigned long old_ctx;
364 387
365 local_irq_save(flags); 388 ENTER_CRITICAL(flags);
366 /* Save old context and create impossible VPN2 value */ 389 /* Save old context and create impossible VPN2 value */
367 old_ctx = read_c0_entryhi(); 390 old_ctx = read_c0_entryhi();
368 old_pagemask = read_c0_pagemask(); 391 old_pagemask = read_c0_pagemask();
@@ -386,10 +409,11 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
386 write_c0_entryhi(old_ctx); 409 write_c0_entryhi(old_ctx);
387 write_c0_pagemask(old_pagemask); 410 write_c0_pagemask(old_pagemask);
388out: 411out:
389 local_irq_restore(flags); 412 EXIT_CRITICAL(flags);
390 return ret; 413 return ret;
391} 414}
392 415
416extern void __init sanitize_tlb_entries(void);
393static void __init probe_tlb(unsigned long config) 417static void __init probe_tlb(unsigned long config)
394{ 418{
395 struct cpuinfo_mips *c = &current_cpu_data; 419 struct cpuinfo_mips *c = &current_cpu_data;
@@ -402,6 +426,14 @@ static void __init probe_tlb(unsigned long config)
402 */ 426 */
403 if ((c->processor_id & 0xff0000) == PRID_COMP_LEGACY) 427 if ((c->processor_id & 0xff0000) == PRID_COMP_LEGACY)
404 return; 428 return;
429#ifdef CONFIG_MIPS_MT_SMTC
430 /*
431 * If TLB is shared in SMTC system, total size already
432 * has been calculated and written into cpu_data tlbsize
433 */
434 if((smtc_status & SMTC_TLB_SHARED) == SMTC_TLB_SHARED)
435 return;
436#endif /* CONFIG_MIPS_MT_SMTC */
405 437
406 reg = read_c0_config1(); 438 reg = read_c0_config1();
407 if (!((config >> 7) & 3)) 439 if (!((config >> 7) & 3))
@@ -410,6 +442,15 @@ static void __init probe_tlb(unsigned long config)
410 c->tlbsize = ((reg >> 25) & 0x3f) + 1; 442 c->tlbsize = ((reg >> 25) & 0x3f) + 1;
411} 443}
412 444
445static int __initdata ntlb = 0;
446static int __init set_ntlb(char *str)
447{
448 get_option(&str, &ntlb);
449 return 1;
450}
451
452__setup("ntlb=", set_ntlb);
453
413void __init tlb_init(void) 454void __init tlb_init(void)
414{ 455{
415 unsigned int config = read_c0_config(); 456 unsigned int config = read_c0_config();
@@ -432,5 +473,15 @@ void __init tlb_init(void)
432 473
433 /* Did I tell you that ARC SUCKS? */ 474 /* Did I tell you that ARC SUCKS? */
434 475
476 if (ntlb) {
477 if (ntlb > 1 && ntlb <= current_cpu_data.tlbsize) {
478 int wired = current_cpu_data.tlbsize - ntlb;
479 write_c0_wired(wired);
480 write_c0_index(wired-1);
481 printk ("Restricting TLB to %d entries\n", ntlb);
482 } else
483 printk("Ignoring invalid argument ntlb=%d\n", ntlb);
484 }
485
435 build_tlb_refill_handler(); 486 build_tlb_refill_handler();
436} 487}
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 599b3c297186..053dbacac56b 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -7,6 +7,16 @@
7 * 7 *
8 * Copyright (C) 2004,2005 by Thiemo Seufer 8 * Copyright (C) 2004,2005 by Thiemo Seufer
9 * Copyright (C) 2005 Maciej W. Rozycki 9 * Copyright (C) 2005 Maciej W. Rozycki
10 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
11 *
12 * ... and the days got worse and worse and now you see
13 * I've gone completly out of my mind.
14 *
15 * They're coming to take me a away haha
16 * they're coming to take me a away hoho hihi haha
17 * to the funny farm where code is beautiful all the time ...
18 *
19 * (Condolences to Napoleon XIV)
10 */ 20 */
11 21
12#include <stdarg.h> 22#include <stdarg.h>
@@ -68,6 +78,7 @@ enum fields
68 BIMM = 0x040, 78 BIMM = 0x040,
69 JIMM = 0x080, 79 JIMM = 0x080,
70 FUNC = 0x100, 80 FUNC = 0x100,
81 SET = 0x200
71}; 82};
72 83
73#define OP_MASK 0x2f 84#define OP_MASK 0x2f
@@ -86,6 +97,8 @@ enum fields
86#define JIMM_SH 0 97#define JIMM_SH 0
87#define FUNC_MASK 0x2f 98#define FUNC_MASK 0x2f
88#define FUNC_SH 0 99#define FUNC_SH 0
100#define SET_MASK 0x7
101#define SET_SH 0
89 102
90enum opcode { 103enum opcode {
91 insn_invalid, 104 insn_invalid,
@@ -129,8 +142,8 @@ static __initdata struct insn insn_table[] = {
129 { insn_bne, M(bne_op,0,0,0,0,0), RS | RT | BIMM }, 142 { insn_bne, M(bne_op,0,0,0,0,0), RS | RT | BIMM },
130 { insn_daddiu, M(daddiu_op,0,0,0,0,0), RS | RT | SIMM }, 143 { insn_daddiu, M(daddiu_op,0,0,0,0,0), RS | RT | SIMM },
131 { insn_daddu, M(spec_op,0,0,0,0,daddu_op), RS | RT | RD }, 144 { insn_daddu, M(spec_op,0,0,0,0,daddu_op), RS | RT | RD },
132 { insn_dmfc0, M(cop0_op,dmfc_op,0,0,0,0), RT | RD }, 145 { insn_dmfc0, M(cop0_op,dmfc_op,0,0,0,0), RT | RD | SET},
133 { insn_dmtc0, M(cop0_op,dmtc_op,0,0,0,0), RT | RD }, 146 { insn_dmtc0, M(cop0_op,dmtc_op,0,0,0,0), RT | RD | SET},
134 { insn_dsll, M(spec_op,0,0,0,0,dsll_op), RT | RD | RE }, 147 { insn_dsll, M(spec_op,0,0,0,0,dsll_op), RT | RD | RE },
135 { insn_dsll32, M(spec_op,0,0,0,0,dsll32_op), RT | RD | RE }, 148 { insn_dsll32, M(spec_op,0,0,0,0,dsll32_op), RT | RD | RE },
136 { insn_dsra, M(spec_op,0,0,0,0,dsra_op), RT | RD | RE }, 149 { insn_dsra, M(spec_op,0,0,0,0,dsra_op), RT | RD | RE },
@@ -145,8 +158,8 @@ static __initdata struct insn insn_table[] = {
145 { insn_lld, M(lld_op,0,0,0,0,0), RS | RT | SIMM }, 158 { insn_lld, M(lld_op,0,0,0,0,0), RS | RT | SIMM },
146 { insn_lui, M(lui_op,0,0,0,0,0), RT | SIMM }, 159 { insn_lui, M(lui_op,0,0,0,0,0), RT | SIMM },
147 { insn_lw, M(lw_op,0,0,0,0,0), RS | RT | SIMM }, 160 { insn_lw, M(lw_op,0,0,0,0,0), RS | RT | SIMM },
148 { insn_mfc0, M(cop0_op,mfc_op,0,0,0,0), RT | RD }, 161 { insn_mfc0, M(cop0_op,mfc_op,0,0,0,0), RT | RD | SET},
149 { insn_mtc0, M(cop0_op,mtc_op,0,0,0,0), RT | RD }, 162 { insn_mtc0, M(cop0_op,mtc_op,0,0,0,0), RT | RD | SET},
150 { insn_ori, M(ori_op,0,0,0,0,0), RS | RT | UIMM }, 163 { insn_ori, M(ori_op,0,0,0,0,0), RS | RT | UIMM },
151 { insn_rfe, M(cop0_op,cop_op,0,0,0,rfe_op), 0 }, 164 { insn_rfe, M(cop0_op,cop_op,0,0,0,rfe_op), 0 },
152 { insn_sc, M(sc_op,0,0,0,0,0), RS | RT | SIMM }, 165 { insn_sc, M(sc_op,0,0,0,0,0), RS | RT | SIMM },
@@ -242,6 +255,14 @@ static __init u32 build_func(u32 arg)
242 return arg & FUNC_MASK; 255 return arg & FUNC_MASK;
243} 256}
244 257
258static __init u32 build_set(u32 arg)
259{
260 if (arg & ~SET_MASK)
261 printk(KERN_WARNING "TLB synthesizer field overflow\n");
262
263 return arg & SET_MASK;
264}
265
245/* 266/*
246 * The order of opcode arguments is implicitly left to right, 267 * The order of opcode arguments is implicitly left to right,
247 * starting with RS and ending with FUNC or IMM. 268 * starting with RS and ending with FUNC or IMM.
@@ -273,6 +294,7 @@ static void __init build_insn(u32 **buf, enum opcode opc, ...)
273 if (ip->fields & BIMM) op |= build_bimm(va_arg(ap, s32)); 294 if (ip->fields & BIMM) op |= build_bimm(va_arg(ap, s32));
274 if (ip->fields & JIMM) op |= build_jimm(va_arg(ap, u32)); 295 if (ip->fields & JIMM) op |= build_jimm(va_arg(ap, u32));
275 if (ip->fields & FUNC) op |= build_func(va_arg(ap, u32)); 296 if (ip->fields & FUNC) op |= build_func(va_arg(ap, u32));
297 if (ip->fields & SET) op |= build_set(va_arg(ap, u32));
276 va_end(ap); 298 va_end(ap);
277 299
278 **buf = op; 300 **buf = op;
@@ -358,8 +380,8 @@ I_u1s2(_bgezl);
358I_u1s2(_bltz); 380I_u1s2(_bltz);
359I_u1s2(_bltzl); 381I_u1s2(_bltzl);
360I_u1u2s3(_bne); 382I_u1u2s3(_bne);
361I_u1u2(_dmfc0); 383I_u1u2u3(_dmfc0);
362I_u1u2(_dmtc0); 384I_u1u2u3(_dmtc0);
363I_u2u1s3(_daddiu); 385I_u2u1s3(_daddiu);
364I_u3u1u2(_daddu); 386I_u3u1u2(_daddu);
365I_u2u1u3(_dsll); 387I_u2u1u3(_dsll);
@@ -376,8 +398,8 @@ I_u2s3u1(_ll);
376I_u2s3u1(_lld); 398I_u2s3u1(_lld);
377I_u1s2(_lui); 399I_u1s2(_lui);
378I_u2s3u1(_lw); 400I_u2s3u1(_lw);
379I_u1u2(_mfc0); 401I_u1u2u3(_mfc0);
380I_u1u2(_mtc0); 402I_u1u2u3(_mtc0);
381I_u2u1u3(_ori); 403I_u2u1u3(_ori);
382I_0(_rfe); 404I_0(_rfe);
383I_u2s3u1(_sc); 405I_u2s3u1(_sc);
@@ -451,8 +473,8 @@ L_LA(_r3000_write_probe_fail)
451# define i_SLL(buf, rs, rt, sh) i_dsll(buf, rs, rt, sh) 473# define i_SLL(buf, rs, rt, sh) i_dsll(buf, rs, rt, sh)
452# define i_SRA(buf, rs, rt, sh) i_dsra(buf, rs, rt, sh) 474# define i_SRA(buf, rs, rt, sh) i_dsra(buf, rs, rt, sh)
453# define i_SRL(buf, rs, rt, sh) i_dsrl(buf, rs, rt, sh) 475# define i_SRL(buf, rs, rt, sh) i_dsrl(buf, rs, rt, sh)
454# define i_MFC0(buf, rt, rd) i_dmfc0(buf, rt, rd) 476# define i_MFC0(buf, rt, rd...) i_dmfc0(buf, rt, rd)
455# define i_MTC0(buf, rt, rd) i_dmtc0(buf, rt, rd) 477# define i_MTC0(buf, rt, rd...) i_dmtc0(buf, rt, rd)
456# define i_ADDIU(buf, rs, rt, val) i_daddiu(buf, rs, rt, val) 478# define i_ADDIU(buf, rs, rt, val) i_daddiu(buf, rs, rt, val)
457# define i_ADDU(buf, rs, rt, rd) i_daddu(buf, rs, rt, rd) 479# define i_ADDU(buf, rs, rt, rd) i_daddu(buf, rs, rt, rd)
458# define i_SUBU(buf, rs, rt, rd) i_dsubu(buf, rs, rt, rd) 480# define i_SUBU(buf, rs, rt, rd) i_dsubu(buf, rs, rt, rd)
@@ -464,8 +486,8 @@ L_LA(_r3000_write_probe_fail)
464# define i_SLL(buf, rs, rt, sh) i_sll(buf, rs, rt, sh) 486# define i_SLL(buf, rs, rt, sh) i_sll(buf, rs, rt, sh)
465# define i_SRA(buf, rs, rt, sh) i_sra(buf, rs, rt, sh) 487# define i_SRA(buf, rs, rt, sh) i_sra(buf, rs, rt, sh)
466# define i_SRL(buf, rs, rt, sh) i_srl(buf, rs, rt, sh) 488# define i_SRL(buf, rs, rt, sh) i_srl(buf, rs, rt, sh)
467# define i_MFC0(buf, rt, rd) i_mfc0(buf, rt, rd) 489# define i_MFC0(buf, rt, rd...) i_mfc0(buf, rt, rd)
468# define i_MTC0(buf, rt, rd) i_mtc0(buf, rt, rd) 490# define i_MTC0(buf, rt, rd...) i_mtc0(buf, rt, rd)
469# define i_ADDIU(buf, rs, rt, val) i_addiu(buf, rs, rt, val) 491# define i_ADDIU(buf, rs, rt, val) i_addiu(buf, rs, rt, val)
470# define i_ADDU(buf, rs, rt, rd) i_addu(buf, rs, rt, rd) 492# define i_ADDU(buf, rs, rt, rd) i_addu(buf, rs, rt, rd)
471# define i_SUBU(buf, rs, rt, rd) i_subu(buf, rs, rt, rd) 493# define i_SUBU(buf, rs, rt, rd) i_subu(buf, rs, rt, rd)
@@ -670,14 +692,15 @@ static void __init il_bgezl(u32 **p, struct reloc **r, unsigned int reg,
670#define K1 27 692#define K1 27
671 693
672/* Some CP0 registers */ 694/* Some CP0 registers */
673#define C0_INDEX 0 695#define C0_INDEX 0, 0
674#define C0_ENTRYLO0 2 696#define C0_ENTRYLO0 2, 0
675#define C0_ENTRYLO1 3 697#define C0_TCBIND 2, 2
676#define C0_CONTEXT 4 698#define C0_ENTRYLO1 3, 0
677#define C0_BADVADDR 8 699#define C0_CONTEXT 4, 0
678#define C0_ENTRYHI 10 700#define C0_BADVADDR 8, 0
679#define C0_EPC 14 701#define C0_ENTRYHI 10, 0
680#define C0_XCONTEXT 20 702#define C0_EPC 14, 0
703#define C0_XCONTEXT 20, 0
681 704
682#ifdef CONFIG_64BIT 705#ifdef CONFIG_64BIT
683# define GET_CONTEXT(buf, reg) i_MFC0(buf, reg, C0_XCONTEXT) 706# define GET_CONTEXT(buf, reg) i_MFC0(buf, reg, C0_XCONTEXT)
@@ -742,7 +765,7 @@ static void __init build_r3000_tlb_refill_handler(void)
742 } 765 }
743#endif 766#endif
744 767
745 memcpy((void *)CAC_BASE, tlb_handler, 0x80); 768 memcpy((void *)ebase, tlb_handler, 0x80);
746} 769}
747 770
748/* 771/*
@@ -951,12 +974,20 @@ build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
951 /* No i_nop needed here, since the next insn doesn't touch TMP. */ 974 /* No i_nop needed here, since the next insn doesn't touch TMP. */
952 975
953#ifdef CONFIG_SMP 976#ifdef CONFIG_SMP
977# ifdef CONFIG_MIPS_MT_SMTC
978 /*
979 * SMTC uses TCBind value as "CPU" index
980 */
981 i_mfc0(p, ptr, C0_TCBIND);
982 i_dsrl(p, ptr, ptr, 19);
983# else
954 /* 984 /*
955 * 64 bit SMP running in XKPHYS has smp_processor_id() << 3 985 * 64 bit SMP running in XKPHYS has smp_processor_id() << 3
956 * stored in CONTEXT. 986 * stored in CONTEXT.
957 */ 987 */
958 i_dmfc0(p, ptr, C0_CONTEXT); 988 i_dmfc0(p, ptr, C0_CONTEXT);
959 i_dsrl(p, ptr, ptr, 23); 989 i_dsrl(p, ptr, ptr, 23);
990#endif
960 i_LA_mostly(p, tmp, pgdc); 991 i_LA_mostly(p, tmp, pgdc);
961 i_daddu(p, ptr, ptr, tmp); 992 i_daddu(p, ptr, ptr, tmp);
962 i_dmfc0(p, tmp, C0_BADVADDR); 993 i_dmfc0(p, tmp, C0_BADVADDR);
@@ -1014,9 +1045,21 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1014 1045
1015 /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */ 1046 /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */
1016#ifdef CONFIG_SMP 1047#ifdef CONFIG_SMP
1048#ifdef CONFIG_MIPS_MT_SMTC
1049 /*
1050 * SMTC uses TCBind value as "CPU" index
1051 */
1052 i_mfc0(p, ptr, C0_TCBIND);
1053 i_LA_mostly(p, tmp, pgdc);
1054 i_srl(p, ptr, ptr, 19);
1055#else
1056 /*
1057 * smp_processor_id() << 3 is stored in CONTEXT.
1058 */
1017 i_mfc0(p, ptr, C0_CONTEXT); 1059 i_mfc0(p, ptr, C0_CONTEXT);
1018 i_LA_mostly(p, tmp, pgdc); 1060 i_LA_mostly(p, tmp, pgdc);
1019 i_srl(p, ptr, ptr, 23); 1061 i_srl(p, ptr, ptr, 23);
1062#endif
1020 i_addu(p, ptr, tmp, ptr); 1063 i_addu(p, ptr, tmp, ptr);
1021#else 1064#else
1022 i_LA_mostly(p, ptr, pgdc); 1065 i_LA_mostly(p, ptr, pgdc);
@@ -1247,7 +1290,7 @@ static void __init build_r4000_tlb_refill_handler(void)
1247 } 1290 }
1248#endif 1291#endif
1249 1292
1250 memcpy((void *)CAC_BASE, final_handler, 0x100); 1293 memcpy((void *)ebase, final_handler, 0x100);
1251} 1294}
1252 1295
1253/* 1296/*
diff --git a/arch/mips/momentum/jaguar_atx/Makefile b/arch/mips/momentum/jaguar_atx/Makefile
index 20bbd3ea44a8..67372f3f9654 100644
--- a/arch/mips/momentum/jaguar_atx/Makefile
+++ b/arch/mips/momentum/jaguar_atx/Makefile
@@ -6,7 +6,7 @@
6# unless it's something special (ie not a .c file). 6# unless it's something special (ie not a .c file).
7# 7#
8 8
9obj-y += int-handler.o irq.o prom.o reset.o setup.o 9obj-y += irq.o prom.o reset.o setup.o
10 10
11obj-$(CONFIG_SERIAL_8250_CONSOLE) += ja-console.o 11obj-$(CONFIG_SERIAL_8250_CONSOLE) += ja-console.o
12obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o 12obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o
diff --git a/arch/mips/momentum/jaguar_atx/int-handler.S b/arch/mips/momentum/jaguar_atx/int-handler.S
deleted file mode 100644
index 55bc789733f2..000000000000
--- a/arch/mips/momentum/jaguar_atx/int-handler.S
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Based on work:
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: jsun@mvista.com or jsun@junsun.net
8 *
9 * First-level interrupt dispatcher for Jaguar-ATX board.
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#include <asm/asm.h>
17#include <asm/mipsregs.h>
18#include <asm/addrspace.h>
19#include <asm/regdef.h>
20#include <asm/stackframe.h>
21
22/*
23 * First level interrupt dispatcher for Ocelot-CS board
24 */
25 .align 5
26 NESTED(jaguar_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt */
36 bnez t1, ll_sw0_irq
37 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt */
38 bnez t1, ll_sw1_irq
39 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
40 bnez t1, ll_pcixa_irq
41 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
42 bnez t1, ll_pcixb_irq
43 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
44 bnez t1, ll_pcia_irq
45 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
46 bnez t1, ll_pcib_irq
47 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
48 bnez t1, ll_uart_irq
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_cputimer_irq
51
52 nop
53 nop
54
55 /* now look at extended interrupts */
56 mfc0 t0, CP0_CAUSE
57 cfc0 t1, CP0_S1_INTCONTROL
58
59 /* shift the mask 8 bits left to line up the bits */
60 sll t2, t1, 8
61
62 and t0, t2
63 srl t0, t0, 16
64
65 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
66 bnez t1, ll_mv64340_decode_irq
67
68 nop
69 nop
70
71 .set reorder
72
73 /* wrong alarm or masked ... */
74 j spurious_interrupt
75 nop
76 END(jaguar_handle_int)
77
78 .align 5
79ll_sw0_irq:
80 li a0, 0
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84ll_sw1_irq:
85 li a0, 1
86 move a1, sp
87 jal do_IRQ
88 j ret_from_irq
89ll_pcixa_irq:
90 li a0, 2
91 move a1, sp
92 jal do_IRQ
93 j ret_from_irq
94
95ll_pcixb_irq:
96 li a0, 3
97 move a1, sp
98 jal do_IRQ
99 j ret_from_irq
100
101ll_pcia_irq:
102 li a0, 4
103 move a1, sp
104 jal do_IRQ
105 j ret_from_irq
106
107ll_pcib_irq:
108 li a0, 5
109 move a1, sp
110 jal do_IRQ
111 j ret_from_irq
112
113ll_uart_irq:
114 li a0, 6
115 move a1, sp
116 jal do_IRQ
117 j ret_from_irq
118
119ll_cputimer_irq:
120 li a0, 7
121 move a1, sp
122 jal ll_timer_interrupt
123 j ret_from_irq
124
125ll_mv64340_decode_irq:
126 move a0, sp
127 jal ll_mv64340_irq
128 j ret_from_irq
diff --git a/arch/mips/momentum/jaguar_atx/irq.c b/arch/mips/momentum/jaguar_atx/irq.c
index 15588f91ace2..ec4032b38f19 100644
--- a/arch/mips/momentum/jaguar_atx/irq.c
+++ b/arch/mips/momentum/jaguar_atx/irq.c
@@ -10,7 +10,7 @@
10 * Copyright 2001 MontaVista Software Inc. 10 * Copyright 2001 MontaVista Software Inc.
11 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 11 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
12 * 12 *
13 * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org) 13 * Copyright (C) 2000, 01, 06 Ralf Baechle (ralf@linux-mips.org)
14 * 14 *
15 * This program is free software; you can redistribute it and/or modify it 15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the 16 * under the terms of the GNU General Public License as published by the
@@ -38,8 +38,37 @@
38#include <linux/types.h> 38#include <linux/types.h>
39#include <asm/irq_cpu.h> 39#include <asm/irq_cpu.h>
40#include <asm/mipsregs.h> 40#include <asm/mipsregs.h>
41#include <asm/time.h>
41 42
42extern asmlinkage void jaguar_handle_int(void); 43asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
44{
45 unsigned int pending = read_c0_cause() & read_c0_status();
46
47 if (pending & STATUSF_IP0)
48 do_IRQ(0, regs);
49 else if (pending & STATUSF_IP1)
50 do_IRQ(1, regs);
51 else if (pending & STATUSF_IP2)
52 do_IRQ(2, regs);
53 else if (pending & STATUSF_IP3)
54 do_IRQ(3, regs);
55 else if (pending & STATUSF_IP4)
56 do_IRQ(4, regs);
57 else if (pending & STATUSF_IP5)
58 do_IRQ(5, regs);
59 else if (pending & STATUSF_IP6)
60 do_IRQ(6, regs);
61 else if (pending & STATUSF_IP7)
62 ll_timer_interrupt(7, regs);
63 else {
64 /*
65 * Now look at the extended interrupts
66 */
67 pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
68 if (pending & STATUSF_IP8)
69 ll_mv64340_irq(regs);
70 }
71}
43 72
44static struct irqaction cascade_mv64340 = { 73static struct irqaction cascade_mv64340 = {
45 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL 74 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL
@@ -53,8 +82,6 @@ void __init arch_init_irq(void)
53 */ 82 */
54 clear_c0_status(ST0_IM); 83 clear_c0_status(ST0_IM);
55 84
56 /* Sets the first-level interrupt dispatcher. */
57 set_except_vector(0, jaguar_handle_int);
58 mips_cpu_irq_init(0); 85 mips_cpu_irq_init(0);
59 rm7k_cpu_irq_init(8); 86 rm7k_cpu_irq_init(8);
60 87
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index 91d9637143d7..1379c76845dc 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -381,24 +381,24 @@ void __init plat_setup(void)
381 * shut down ethernet ports, just to be sure our memory doesn't get 381 * shut down ethernet ports, just to be sure our memory doesn't get
382 * corrupted by random ethernet traffic. 382 * corrupted by random ethernet traffic.
383 */ 383 */
384 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8); 384 MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8);
385 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8); 385 MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8);
386 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(2), 0xff << 8); 386 MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(2), 0xff << 8);
387 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8); 387 MV_WRITE(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8);
388 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8); 388 MV_WRITE(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8);
389 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(2), 0xff << 8); 389 MV_WRITE(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(2), 0xff << 8);
390 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff); 390 while (MV_READ(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff);
391 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff); 391 while (MV_READ(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff);
392 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(2)) & 0xff); 392 while (MV_READ(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(2)) & 0xff);
393 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff); 393 while (MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff);
394 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff); 394 while (MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff);
395 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(2)) & 0xff); 395 while (MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(2)) & 0xff);
396 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0), 396 MV_WRITE(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(0),
397 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1); 397 MV_READ(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1);
398 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1), 398 MV_WRITE(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(1),
399 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1); 399 MV_READ(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1);
400 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(2), 400 MV_WRITE(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(2),
401 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(2)) & ~1); 401 MV_READ(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(2)) & ~1);
402 402
403 /* Turn off the Bit-Error LED */ 403 /* Turn off the Bit-Error LED */
404 JAGUAR_FPGA_WRITE(0x80, CLR); 404 JAGUAR_FPGA_WRITE(0x80, CLR);
diff --git a/arch/mips/momentum/ocelot_3/Makefile b/arch/mips/momentum/ocelot_3/Makefile
index aab8fd89f830..8bcea64dd27b 100644
--- a/arch/mips/momentum/ocelot_3/Makefile
+++ b/arch/mips/momentum/ocelot_3/Makefile
@@ -5,4 +5,4 @@
5# removes any old dependencies. DON'T put your own dependencies here 5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file). 6# unless it's something special (ie not a .c file).
7# 7#
8obj-y += int-handler.o irq.o prom.o reset.o setup.o 8obj-y += irq.o prom.o reset.o setup.o
diff --git a/arch/mips/momentum/ocelot_3/int-handler.S b/arch/mips/momentum/ocelot_3/int-handler.S
deleted file mode 100644
index 4522f09ed769..000000000000
--- a/arch/mips/momentum/ocelot_3/int-handler.S
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: jsun@mvista.com or jsun@junsun.net
7 *
8 * Copyright 2004 PMC-Sierra
9 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
10 *
11 * Copyright (C) 2004 MontaVista Software Inc.
12 * Author: Manish Lachwani, mlachwani@mvista.com
13 *
14 * First-level interrupt dispatcher for Ocelot-3 board.
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
20 */
21#include <asm/asm.h>
22#include <asm/mipsregs.h>
23#include <asm/addrspace.h>
24#include <asm/regdef.h>
25#include <asm/stackframe.h>
26
27/*
28 * First level interrupt dispatcher for Ocelot-3 board
29 */
30 .align 5
31 NESTED(ocelot3_handle_int, PT_SIZE, sp)
32 SAVE_ALL
33 CLI
34 .set at
35
36 mfc0 t0, CP0_CAUSE
37 mfc0 t2, CP0_STATUS
38
39 and t0, t2
40
41 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt (IRQ0) */
42 bnez t1, ll_sw0_irq
43
44 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt (IRQ1) */
45 bnez t1, ll_sw1_irq
46
47 andi t1, t0, STATUSF_IP2 /* int0 hardware line (IRQ2) */
48 bnez t1, ll_pci0slot1_irq
49
50 andi t1, t0, STATUSF_IP3 /* int1 hardware line (IRQ3) */
51 bnez t1, ll_pci0slot2_irq
52
53 andi t1, t0, STATUSF_IP4 /* int2 hardware line (IRQ4) */
54 bnez t1, ll_pci1slot1_irq
55
56 andi t1, t0, STATUSF_IP5 /* int3 hardware line (IRQ5) */
57 bnez t1, ll_pci1slot2_irq
58
59 andi t1, t0, STATUSF_IP6 /* int4 hardware line (IRQ6) */
60 bnez t1, ll_uart_irq
61
62 andi t1, t0, STATUSF_IP7 /* cpu timer (IRQ7) */
63 bnez t1, ll_cputimer_irq
64
65 /* now look at extended interrupts */
66 mfc0 t0, CP0_CAUSE
67 cfc0 t1, CP0_S1_INTCONTROL
68
69 /* shift the mask 8 bits left to line up the bits */
70 sll t2, t1, 8
71
72 and t0, t2
73 srl t0, t0, 16
74
75 andi t1, t0, STATUSF_IP8 /* int6 hardware line (IRQ9) */
76 bnez t1, ll_mv64340_decode_irq
77
78 .set reorder
79
80 /* wrong alarm or masked ... */
81 j spurious_interrupt
82 nop
83 END(ocelot3_handle_int)
84
85 .align 5
86ll_sw0_irq:
87 li a0, 0 /* IRQ 1 */
88 move a1, sp
89 jal do_IRQ
90 j ret_from_irq
91ll_sw1_irq:
92 li a0, 1 /* IRQ 2 */
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_pci0slot1_irq:
98 li a0, 2 /* IRQ 3 */
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_pci0slot2_irq:
104 li a0, 3 /* IRQ 4 */
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_pci1slot1_irq:
110 li a0, 4 /* IRQ 5 */
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pci1slot2_irq:
116 li a0, 5 /* IRQ 6 */
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_uart_irq:
122 li a0, 6 /* IRQ 7 */
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_cputimer_irq:
128 li a0, 7 /* IRQ 8 */
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
132
133ll_mv64340_decode_irq:
134 move a0, sp
135 jal ll_mv64340_irq
136 j ret_from_irq
137
diff --git a/arch/mips/momentum/ocelot_3/irq.c b/arch/mips/momentum/ocelot_3/irq.c
index 42464dbd4ad2..87c63c340ae3 100644
--- a/arch/mips/momentum/ocelot_3/irq.c
+++ b/arch/mips/momentum/ocelot_3/irq.c
@@ -53,8 +53,6 @@
53#include <asm/mipsregs.h> 53#include <asm/mipsregs.h>
54#include <asm/system.h> 54#include <asm/system.h>
55 55
56extern asmlinkage void ocelot3_handle_int(void);
57
58static struct irqaction cascade_mv64340 = { 56static struct irqaction cascade_mv64340 = {
59 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL 57 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL
60}; 58};
@@ -67,9 +65,6 @@ void __init arch_init_irq(void)
67 */ 65 */
68 clear_c0_status(ST0_IM | ST0_BEV); 66 clear_c0_status(ST0_IM | ST0_BEV);
69 67
70 /* Sets the first-level interrupt dispatcher. */
71 set_except_vector(0, ocelot3_handle_int);
72 mips_cpu_irq_init(0);
73 rm7k_cpu_irq_init(8); 68 rm7k_cpu_irq_init(8);
74 69
75 /* set up the cascading interrupts */ 70 /* set up the cascading interrupts */
@@ -79,3 +74,36 @@ void __init arch_init_irq(void)
79 set_c0_status(ST0_IM); /* IE in the status register */ 74 set_c0_status(ST0_IM); /* IE in the status register */
80 75
81} 76}
77
78asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
79{
80 unsigned int pending = read_c0_cause() & read_c0_status();
81
82 if (pending & STATUSF_IP0)
83 do_IRQ(0, regs);
84 else if (pending & STATUSF_IP1)
85 do_IRQ(1, regs);
86 else if (pending & STATUSF_IP2)
87 do_IRQ(2, regs);
88 else if (pending & STATUSF_IP3)
89 do_IRQ(3, regs);
90 else if (pending & STATUSF_IP4)
91 do_IRQ(4, regs);
92 else if (pending & STATUSF_IP5)
93 do_IRQ(5, regs);
94 else if (pending & STATUSF_IP6)
95 do_IRQ(6, regs);
96 else if (pending & STATUSF_IP7)
97 do_IRQ(7, regs);
98 else {
99 /*
100 * Now look at the extended interrupts
101 */
102 pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
103
104 if (pending & STATUSF_IP8)
105 ll_mv64340_irq(regs);
106 else
107 spurious_interrupt(regs);
108 }
109}
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index 370e75d0e75c..c69195234309 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -329,22 +329,22 @@ void __init plat_setup(void)
329 /* shut down ethernet ports, just to be sure our memory doesn't get 329 /* shut down ethernet ports, just to be sure our memory doesn't get
330 * corrupted by random ethernet traffic. 330 * corrupted by random ethernet traffic.
331 */ 331 */
332 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8); 332 MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8);
333 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8); 333 MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8);
334 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8); 334 MV_WRITE(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8);
335 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8); 335 MV_WRITE(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8);
336 do {} 336 do {}
337 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff); 337 while (MV_READ(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff);
338 do {} 338 do {}
339 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff); 339 while (MV_READ(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff);
340 do {} 340 do {}
341 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff); 341 while (MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff);
342 do {} 342 do {}
343 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff); 343 while (MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff);
344 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0), 344 MV_WRITE(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(0),
345 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1); 345 MV_READ(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1);
346 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1), 346 MV_WRITE(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(1),
347 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1); 347 MV_READ(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1);
348 348
349 /* Turn off the Bit-Error LED */ 349 /* Turn off the Bit-Error LED */
350 OCELOT_FPGA_WRITE(0x80, CLR); 350 OCELOT_FPGA_WRITE(0x80, CLR);
diff --git a/arch/mips/momentum/ocelot_c/Makefile b/arch/mips/momentum/ocelot_c/Makefile
index 91240777f978..94802b4db472 100644
--- a/arch/mips/momentum/ocelot_c/Makefile
+++ b/arch/mips/momentum/ocelot_c/Makefile
@@ -2,7 +2,7 @@
2# Makefile for Momentum Computer's Ocelot-C and -CS boards. 2# Makefile for Momentum Computer's Ocelot-C and -CS boards.
3# 3#
4 4
5obj-y += cpci-irq.o int-handler.o irq.o prom.o reset.o \ 5obj-y += cpci-irq.o irq.o prom.o reset.o \
6 setup.o uart-irq.o 6 setup.o uart-irq.o
7 7
8obj-$(CONFIG_KGDB) += dbg_io.o 8obj-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/momentum/ocelot_c/int-handler.S b/arch/mips/momentum/ocelot_c/int-handler.S
deleted file mode 100644
index 52349d9bf1be..000000000000
--- a/arch/mips/momentum/ocelot_c/int-handler.S
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: jsun@mvista.com or jsun@junsun.net
7 *
8 * First-level interrupt dispatcher for Ocelot-CS board.
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#include <asm/asm.h>
16#include <asm/mipsregs.h>
17#include <asm/addrspace.h>
18#include <asm/regdef.h>
19#include <asm/stackframe.h>
20#include "ocelot_c_fpga.h"
21
22/*
23 * First level interrupt dispatcher for Ocelot-CS board
24 */
25 .align 5
26 NESTED(ocelot_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt */
36 bnez t1, ll_sw0_irq
37 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt */
38 bnez t1, ll_sw1_irq
39 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
40 bnez t1, ll_scsi_irq
41 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
42 bnez t1, ll_uart_decode_irq
43 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
44 bnez t1, ll_pmc_irq
45 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
46 bnez t1, ll_cpci_decode_irq
47 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
48 bnez t1, ll_mv64340_decode_irq
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_cputimer_irq
51
52 .set reorder
53
54 /* wrong alarm or masked ... */
55 j spurious_interrupt
56 nop
57 END(ocelot_handle_int)
58
59 .align 5
60ll_sw0_irq:
61 li a0, 0
62 move a1, sp
63 jal do_IRQ
64 j ret_from_irq
65ll_sw1_irq:
66 li a0, 1
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70ll_scsi_irq:
71 li a0, 2
72 move a1, sp
73 jal do_IRQ
74 j ret_from_irq
75
76ll_uart_decode_irq:
77 move a0, sp
78 jal ll_uart_irq
79 j ret_from_irq
80
81ll_pmc_irq:
82 li a0, 4
83 move a1, sp
84 jal do_IRQ
85 j ret_from_irq
86
87ll_cpci_decode_irq:
88 move a0, sp
89 jal ll_cpci_irq
90 j ret_from_irq
91
92ll_mv64340_decode_irq:
93 move a0, sp
94 jal ll_mv64340_irq
95 j ret_from_irq
96
97ll_cputimer_irq:
98 li a0, 7
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
diff --git a/arch/mips/momentum/ocelot_c/irq.c b/arch/mips/momentum/ocelot_c/irq.c
index a5764bc20e36..86f61ce59e53 100644
--- a/arch/mips/momentum/ocelot_c/irq.c
+++ b/arch/mips/momentum/ocelot_c/irq.c
@@ -48,7 +48,6 @@
48#include <asm/mipsregs.h> 48#include <asm/mipsregs.h>
49#include <asm/system.h> 49#include <asm/system.h>
50 50
51extern asmlinkage void ocelot_handle_int(void);
52extern void uart_irq_init(void); 51extern void uart_irq_init(void);
53extern void cpci_irq_init(void); 52extern void cpci_irq_init(void);
54 53
@@ -60,6 +59,33 @@ static struct irqaction cascade_mv64340 = {
60 no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade via MV64340", NULL, NULL 59 no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade via MV64340", NULL, NULL
61}; 60};
62 61
62extern void ll_uart_irq(struct pt_regs *regs);
63extern void ll_cpci_irq(struct pt_regs *regs);
64
65asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
66{
67 unsigned int pending = read_c0_cause() & read_c0_status();
68
69 if (pending & STATUSF_IP0)
70 do_IRQ(0, regs);
71 else if (pending & STATUSF_IP1)
72 do_IRQ(1, regs);
73 else if (pending & STATUSF_IP2)
74 do_IRQ(2, regs);
75 else if (pending & STATUSF_IP3)
76 ll_uart_irq(regs);
77 else if (pending & STATUSF_IP4)
78 do_IRQ(4, regs);
79 else if (pending & STATUSF_IP5)
80 ll_cpci_irq(regs);
81 else if (pending & STATUSF_IP6)
82 ll_mv64340_irq(regs);
83 else if (pending & STATUSF_IP7)
84 do_IRQ(7, regs);
85 else
86 spurious_interrupt(regs);
87}
88
63void __init arch_init_irq(void) 89void __init arch_init_irq(void)
64{ 90{
65 /* 91 /*
@@ -68,8 +94,6 @@ void __init arch_init_irq(void)
68 */ 94 */
69 clear_c0_status(ST0_IM); 95 clear_c0_status(ST0_IM);
70 96
71 /* Sets the first-level interrupt dispatcher. */
72 set_except_vector(0, ocelot_handle_int);
73 mips_cpu_irq_init(0); 97 mips_cpu_irq_init(0);
74 98
75 /* set up the cascading interrupts */ 99 /* set up the cascading interrupts */
diff --git a/arch/mips/momentum/ocelot_g/Makefile b/arch/mips/momentum/ocelot_g/Makefile
index e5f1cb086973..adb5665d40a9 100644
--- a/arch/mips/momentum/ocelot_g/Makefile
+++ b/arch/mips/momentum/ocelot_g/Makefile
@@ -2,7 +2,7 @@
2# Makefile for Momentum Computer's Ocelot-G board. 2# Makefile for Momentum Computer's Ocelot-G board.
3# 3#
4 4
5obj-y += int-handler.o irq.o gt-irq.o prom.o reset.o setup.o 5obj-y += irq.o gt-irq.o prom.o reset.o setup.o
6obj-$(CONFIG_KGDB) += dbg_io.o 6obj-$(CONFIG_KGDB) += dbg_io.o
7 7
8EXTRA_AFLAGS := $(CFLAGS) 8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/momentum/ocelot_g/int-handler.S b/arch/mips/momentum/ocelot_g/int-handler.S
deleted file mode 100644
index 772e8f713176..000000000000
--- a/arch/mips/momentum/ocelot_g/int-handler.S
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ocelot board.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18/*
19 * first level interrupt dispatcher for ocelot board -
20 * We check for the timer first, then check PCI ints A and D.
21 * Then check for serial IRQ and fall through.
22 */
23 .align 5
24 NESTED(ocelot_handle_int, PT_SIZE, sp)
25 SAVE_ALL
26 CLI
27 .set at
28 mfc0 t0, CP0_CAUSE
29 mfc0 t2, CP0_STATUS
30
31 and t0, t2
32
33 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
34 bnez t1, ll_pri_enet_irq
35 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
36 bnez t1, ll_sec_enet_irq
37 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
38 bnez t1, ll_uart_irq
39 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
40 bnez t1, ll_cpci_irq
41 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
42 bnez t1, ll_galileo_p0_irq
43 andi t1, t0, STATUSF_IP7 /* cpu timer */
44 bnez t1, ll_cputimer_irq
45
46 /* now look at the extended interrupts */
47 mfc0 t0, CP0_CAUSE
48 cfc0 t1, CP0_S1_INTCONTROL
49
50 /* shift the mask 8 bits left to line up the bits */
51 sll t2, t1, 8
52
53 and t0, t2
54 srl t0, t0, 16
55
56 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
57 bnez t1, ll_galileo_p1_irq
58 andi t1, t0, STATUSF_IP9 /* int7 hardware line */
59 bnez t1, ll_pmc_irq
60 andi t1, t0, STATUSF_IP10 /* int8 hardware line */
61 bnez t1, ll_cpci_abcd_irq
62 andi t1, t0, STATUSF_IP11 /* int9 hardware line */
63 bnez t1, ll_testpoint_irq
64
65 .set reorder
66
67 /* wrong alarm or masked ... */
68 j spurious_interrupt
69 nop
70 END(ocelot_handle_int)
71
72 .align 5
73ll_pri_enet_irq:
74 li a0, 2
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_sec_enet_irq:
80 li a0, 3
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84
85ll_uart_irq:
86 li a0, 4
87 move a1, sp
88 jal do_IRQ
89 j ret_from_irq
90
91ll_cpci_irq:
92 li a0, 5
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_galileo_p0_irq:
98 li a0, 6
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_cputimer_irq:
104 li a0, 7
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_galileo_p1_irq:
110 li a0, 8
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pmc_irq:
116 li a0, 9
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_cpci_abcd_irq:
122 li a0, 10
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_testpoint_irq:
128 li a0, 11
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
diff --git a/arch/mips/momentum/ocelot_g/irq.c b/arch/mips/momentum/ocelot_g/irq.c
index 5eb85b164205..7a4a419804f1 100644
--- a/arch/mips/momentum/ocelot_g/irq.c
+++ b/arch/mips/momentum/ocelot_g/irq.c
@@ -48,7 +48,41 @@
48#include <asm/mipsregs.h> 48#include <asm/mipsregs.h>
49#include <asm/system.h> 49#include <asm/system.h>
50 50
51extern asmlinkage void ocelot_handle_int(void); 51asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
52{
53 unsigned int pending = read_c0_cause() & read_c0_status();
54
55 if (pending & STATUSF_IP2)
56 do_IRQ(2, regs);
57 else if (pending & STATUSF_IP3)
58 do_IRQ(3, regs);
59 else if (pending & STATUSF_IP4)
60 do_IRQ(4, regs);
61 else if (pending & STATUSF_IP5)
62 do_IRQ(5, regs);
63 else if (pending & STATUSF_IP6)
64 do_IRQ(6, regs);
65 else if (pending & STATUSF_IP7)
66 do_IRQ(7, regs);
67 else {
68 /*
69 * Now look at the extended interrupts
70 */
71 pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
72
73 if (pending & STATUSF_IP8)
74 do_IRQ(8, regs);
75 else if (pending & STATUSF_IP9)
76 do_IRQ(9, regs);
77 else if (pending & STATUSF_IP10)
78 do_IRQ(10, regs);
79 else if (pending & STATUSF_IP11)
80 do_IRQ(11, regs);
81 else
82 spurious_interrupt(regs);
83 }
84}
85
52extern void gt64240_irq_init(void); 86extern void gt64240_irq_init(void);
53 87
54void __init arch_init_irq(void) 88void __init arch_init_irq(void)
@@ -60,8 +94,6 @@ void __init arch_init_irq(void)
60 clear_c0_status(ST0_IM); 94 clear_c0_status(ST0_IM);
61 local_irq_disable(); 95 local_irq_disable();
62 96
63 /* Sets the first-level interrupt dispatcher. */
64 set_except_vector(0, ocelot_handle_int);
65 mips_cpu_irq_init(0); 97 mips_cpu_irq_init(0);
66 rm7k_cpu_irq_init(8); 98 rm7k_cpu_irq_init(8);
67 99
diff --git a/arch/mips/philips/pnx8550/common/Makefile b/arch/mips/philips/pnx8550/common/Makefile
index 6e38f3bc443c..b7c638166e9f 100644
--- a/arch/mips/philips/pnx8550/common/Makefile
+++ b/arch/mips/philips/pnx8550/common/Makefile
@@ -22,6 +22,6 @@
22# under Linux. 22# under Linux.
23# 23#
24 24
25obj-y := setup.o prom.o mipsIRQ.o int.o reset.o time.o proc.o platform.o 25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
26obj-$(CONFIG_PCI) += pci.o 26obj-$(CONFIG_PCI) += pci.o
27obj-$(CONFIG_KGDB) += gdb_hook.o 27obj-$(CONFIG_KGDB) += gdb_hook.o
diff --git a/arch/mips/philips/pnx8550/common/int.c b/arch/mips/philips/pnx8550/common/int.c
index c500e2d41f2c..39ee6314f627 100644
--- a/arch/mips/philips/pnx8550/common/int.c
+++ b/arch/mips/philips/pnx8550/common/int.c
@@ -38,8 +38,6 @@
38#include <int.h> 38#include <int.h>
39#include <uart.h> 39#include <uart.h>
40 40
41extern asmlinkage void cp0_irqdispatch(void);
42
43static DEFINE_SPINLOCK(irq_lock); 41static DEFINE_SPINLOCK(irq_lock);
44 42
45/* default prio for interrupts */ 43/* default prio for interrupts */
@@ -55,7 +53,7 @@ static char gic_prio[PNX8550_INT_GIC_TOTINT] = {
55 1 // 70 53 1 // 70
56}; 54};
57 55
58void hw0_irqdispatch(int irq, struct pt_regs *regs) 56static void hw0_irqdispatch(int irq, struct pt_regs *regs)
59{ 57{
60 /* find out which interrupt */ 58 /* find out which interrupt */
61 irq = PNX8550_GIC_VECTOR_0 >> 3; 59 irq = PNX8550_GIC_VECTOR_0 >> 3;
@@ -68,7 +66,7 @@ void hw0_irqdispatch(int irq, struct pt_regs *regs)
68} 66}
69 67
70 68
71void timer_irqdispatch(int irq, struct pt_regs *regs) 69static void timer_irqdispatch(int irq, struct pt_regs *regs)
72{ 70{
73 irq = (0x01c0 & read_c0_config7()) >> 6; 71 irq = (0x01c0 & read_c0_config7()) >> 6;
74 72
@@ -88,6 +86,20 @@ void timer_irqdispatch(int irq, struct pt_regs *regs)
88 } 86 }
89} 87}
90 88
89asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
90{
91 unsigned int pending = read_c0_status() & read_c0_cause();
92
93 if (pending & STATUSF_IP2)
94 do_IRQ(2, regs);
95 else if (pending & STATUSF_IP7) {
96 if (read_c0_config7() & 0x01c0)
97 timer_irqdispatch(7, regs);
98 }
99
100 spurious_interrupt(regs);
101}
102
91static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask) 103static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask)
92{ 104{
93 unsigned long status = read_c0_status(); 105 unsigned long status = read_c0_status();
@@ -223,9 +235,6 @@ void __init arch_init_irq(void)
223 int i; 235 int i;
224 int configPR; 236 int configPR;
225 237
226 /* init of cp0 interrupts */
227 set_except_vector(0, cp0_irqdispatch);
228
229 for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) { 238 for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) {
230 irq_desc[i].handler = &level_irq_type; 239 irq_desc[i].handler = &level_irq_type;
231 pnx8550_ack(i); /* mask the irq just in case */ 240 pnx8550_ack(i); /* mask the irq just in case */
diff --git a/arch/mips/philips/pnx8550/common/mipsIRQ.S b/arch/mips/philips/pnx8550/common/mipsIRQ.S
deleted file mode 100644
index 338bffda3fab..000000000000
--- a/arch/mips/philips/pnx8550/common/mipsIRQ.S
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * Copyright (c) 2002 Philips, Inc. All rights.
3 * Copyright (c) 2002 Red Hat, Inc. All rights.
4 *
5 * This software may be freely redistributed under the terms of the
6 * GNU General Public License.
7 *
8 * You should have received a copy of the GNU General Public License
9 * along with this program; if not, write to the Free Software
10 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
11 *
12 * Based upon arch/mips/galileo-boards/ev64240/int-handler.S
13 *
14 */
15#include <asm/asm.h>
16#include <asm/mipsregs.h>
17#include <asm/addrspace.h>
18#include <asm/regdef.h>
19#include <asm/stackframe.h>
20
21/*
22 * cp0_irqdispatch
23 *
24 * Code to handle in-core interrupt exception.
25 */
26
27 .align 5
28 .set reorder
29 .set noat
30 NESTED(cp0_irqdispatch, PT_SIZE, sp)
31 SAVE_ALL
32 CLI
33 .set at
34 mfc0 t0,CP0_CAUSE
35 mfc0 t2,CP0_STATUS
36
37 and t0,t2
38
39 andi t1,t0,STATUSF_IP2 /* int0 hardware line */
40 bnez t1,ll_hw0_irq
41 nop
42
43 andi t1,t0,STATUSF_IP7 /* int5 hardware line */
44 bnez t1,ll_timer_irq
45 nop
46
47 /* wrong alarm or masked ... */
48
49 j spurious_interrupt
50 nop
51 END(cp0_irqdispatch)
52
53 .align 5
54 .set reorder
55ll_hw0_irq:
56 li a0,2
57 move a1,sp
58 jal hw0_irqdispatch
59 nop
60 j ret_from_irq
61 nop
62
63 .align 5
64 .set reorder
65ll_timer_irq:
66 mfc0 t3,CP0_CONFIG,7
67 andi t4,t3,0x01c0
68 beqz t4,ll_timer_out
69 nop
70 li a0,7
71 move a1,sp
72 jal timer_irqdispatch
73 nop
74
75ll_timer_out: j ret_from_irq
76 nop
diff --git a/arch/mips/philips/pnx8550/common/platform.c b/arch/mips/philips/pnx8550/common/platform.c
index a592260fd673..5436b4b97455 100644
--- a/arch/mips/philips/pnx8550/common/platform.c
+++ b/arch/mips/philips/pnx8550/common/platform.c
@@ -18,6 +18,7 @@
18#include <linux/resource.h> 18#include <linux/resource.h>
19#include <linux/serial.h> 19#include <linux/serial.h>
20#include <linux/serial_ip3106.h> 20#include <linux/serial_ip3106.h>
21#include <linux/platform_device.h>
21 22
22#include <int.h> 23#include <int.h>
23#include <usb.h> 24#include <usb.h>
diff --git a/arch/mips/pmc-sierra/yosemite/Makefile b/arch/mips/pmc-sierra/yosemite/Makefile
index ae96a71a3089..e931e0d44229 100644
--- a/arch/mips/pmc-sierra/yosemite/Makefile
+++ b/arch/mips/pmc-sierra/yosemite/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the PMC-Sierra Titan 2# Makefile for the PMC-Sierra Titan
3# 3#
4 4
5obj-y += irq-handler.o irq.o i2c-yosemite.o prom.o py-console.o setup.o 5obj-y += irq.o i2c-yosemite.o prom.o py-console.o setup.o
6 6
7obj-$(CONFIG_KGDB) += dbg_io.o 7obj-$(CONFIG_KGDB) += dbg_io.o
8obj-$(CONFIG_SMP) += smp.o 8obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/mips/pmc-sierra/yosemite/irq-handler.S b/arch/mips/pmc-sierra/yosemite/irq-handler.S
deleted file mode 100644
index 33b9c40d4f5c..000000000000
--- a/arch/mips/pmc-sierra/yosemite/irq-handler.S
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Copyright 2003, 04 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com
4 * Copyright 2004 Ralf Baechle (ralf@linux-mips.org)
5 *
6 * First-level interrupt router for the PMC-Sierra Titan board
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * Titan supports Hypertransport or PCI but not both. Hence, one interrupt
14 * line is shared between the PCI slot A and Hypertransport. This is the
15 * Processor INTB #0.
16 */
17
18#include <linux/config.h>
19#include <asm/asm.h>
20#include <asm/mipsregs.h>
21#include <asm/addrspace.h>
22#include <asm/regdef.h>
23#include <asm/stackframe.h>
24
25 .align 5
26 NESTED(titan_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 .set noreorder
31 la ra, ret_from_irq
32 mfc0 t0, CP0_CAUSE
33 mfc0 t2, CP0_STATUS
34
35 and t0, t2
36
37 andi t2, t0, STATUSF_IP7 /* INTB5 hardware line */
38 bnez t2, ll_timer_irq /* Timer */
39 andi t1, t0, STATUSF_IP2 /* INTB0 hardware line */
40 bnez t1, ll_pcia_irq /* 64-bit PCI */
41 andi t2, t0, STATUSF_IP3 /* INTB1 hardware line */
42 bnez t2, ll_pcib_irq /* second 64-bit PCI slot */
43 andi t1, t0, STATUSF_IP4 /* INTB2 hardware line */
44 bnez t1, ll_duart_irq /* UART */
45 andi t2, t0, STATUSF_IP5 /* SMP inter-core interrupts */
46 bnez t2, ll_smp_irq
47 andi t1, t0, STATUSF_IP6
48 bnez t1, ll_ht_irq /* Hypertransport */
49
50 move a0, sp
51 j do_extended_irq
52 END(titan_handle_int)
53
54 .set reorder
55 .align 5
56
57ll_pcia_irq:
58 li a0, 2
59 move a1, sp
60#ifdef CONFIG_HYPERTRANSPORT
61 j ll_ht_smp_irq_handler
62#else
63 j do_IRQ
64#endif
65
66ll_pcib_irq:
67 li a0, 3
68 move a1, sp
69 j do_IRQ
70
71ll_duart_irq:
72 li a0, 4
73 move a1, sp
74 j do_IRQ
75
76ll_smp_irq:
77 li a0, 5
78 move a1, sp
79#ifdef CONFIG_SMP
80 j titan_mailbox_irq
81#else
82 j do_IRQ
83#endif
84
85ll_ht_irq:
86 li a0, 6
87 move a1, sp
88 j ll_ht_smp_irq_handler
89
90ll_timer_irq:
91 li a0, 7
92 move a1, sp
93 j do_IRQ
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index f4e2897d9bf7..a1f524fc4c10 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -2,6 +2,8 @@
2 * Copyright (C) 2003 PMC-Sierra Inc. 2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com) 3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 * 4 *
5 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
6 *
5 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your 9 * Free Software Foundation; either version 2 of the License, or (at your
@@ -55,7 +57,6 @@
55#define HYPERTRANSPORT_INTC 0x7a /* INTC# */ 57#define HYPERTRANSPORT_INTC 0x7a /* INTC# */
56#define HYPERTRANSPORT_INTD 0x7b /* INTD# */ 58#define HYPERTRANSPORT_INTD 0x7b /* INTD# */
57 59
58extern asmlinkage void titan_handle_int(void);
59extern void jaguar_mailbox_irq(struct pt_regs *); 60extern void jaguar_mailbox_irq(struct pt_regs *);
60 61
61/* 62/*
@@ -125,6 +126,35 @@ asmlinkage void do_extended_irq(struct pt_regs *regs)
125 126
126} 127}
127 128
129asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
130{
131 unsigned int cause = read_c0_cause();
132 unsigned int status = read_c0_status();
133 unsigned int pending = cause & status;
134
135 if (pending & STATUSF_IP7) {
136 do_IRQ(7, regs);
137 } else if (pending & STATUSF_IP2) {
138#ifdef CONFIG_HYPERTRANSPORT
139 ll_ht_smp_irq_handler(2, regs);
140#else
141 do_IRQ(2, regs);
142#endif
143 } else if (pending & STATUSF_IP3) {
144 do_IRQ(3, regs);
145 } else if (pending & STATUSF_IP4) {
146 do_IRQ(4, regs);
147 } else if (pending & STATUSF_IP5) {
148#ifdef CONFIG_SMP
149 titan_mailbox_irq(regs);
150#else
151 do_IRQ(5, regs);
152#endif
153 } else if (pending & STATUSF_IP6) {
154 do_IRQ(4, regs);
155 }
156}
157
128#ifdef CONFIG_KGDB 158#ifdef CONFIG_KGDB
129extern void init_second_port(void); 159extern void init_second_port(void);
130#endif 160#endif
@@ -136,7 +166,6 @@ void __init arch_init_irq(void)
136{ 166{
137 clear_c0_status(ST0_IM); 167 clear_c0_status(ST0_IM);
138 168
139 set_except_vector(0, titan_handle_int);
140 mips_cpu_irq_init(0); 169 mips_cpu_irq_init(0);
141 rm7k_cpu_irq_init(8); 170 rm7k_cpu_irq_init(8);
142 rm9k_cpu_irq_init(12); 171 rm9k_cpu_irq_init(12);
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index 6a8e8bcef552..730f459f3e99 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -2,6 +2,6 @@
2# Makefile for Qemu specific kernel interface routines under Linux. 2# Makefile for Qemu specific kernel interface routines under Linux.
3# 3#
4 4
5obj-y = q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_SMP) += q-smp.o
diff --git a/arch/mips/qemu/q-int.S b/arch/mips/qemu/q-int.S
deleted file mode 100644
index 6e3dfe5eb14b..000000000000
--- a/arch/mips/qemu/q-int.S
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Qemu interrupt handler code.
3 *
4 * Copyright (C) 2005 by Ralf Baechle
5 */
6#include <asm/asm.h>
7#include <asm/regdef.h>
8#include <asm/stackframe.h>
9
10 .align 5
11 NESTED(qemu_handle_int, PT_SIZE, sp)
12 SAVE_ALL
13 CLI
14 move a0, sp
15 PTR_LA ra, ret_from_irq
16 j do_qemu_int
17 END(qemu_handle_int)
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
index 2c4e0704ff10..3352374c4c7d 100644
--- a/arch/mips/qemu/q-irq.c
+++ b/arch/mips/qemu/q-irq.c
@@ -9,7 +9,7 @@
9 9
10extern asmlinkage void qemu_handle_int(void); 10extern asmlinkage void qemu_handle_int(void);
11 11
12asmlinkage void do_qemu_int(struct pt_regs *regs) 12asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
13{ 13{
14 unsigned int pending = read_c0_status() & read_c0_cause(); 14 unsigned int pending = read_c0_status() & read_c0_cause();
15 15
@@ -29,7 +29,6 @@ asmlinkage void do_qemu_int(struct pt_regs *regs)
29 29
30void __init arch_init_irq(void) 30void __init arch_init_irq(void)
31{ 31{
32 set_except_vector(0, qemu_handle_int);
33 mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK; /* 100MHz */ 32 mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK; /* 100MHz */
34 33
35 init_i8259_irqs(); 34 init_i8259_irqs();
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
index eb0820fe50bd..6aa4c0cd169c 100644
--- a/arch/mips/sgi-ip22/Makefile
+++ b/arch/mips/sgi-ip22/Makefile
@@ -3,7 +3,7 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-irq.o ip22-berr.o \ 6obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-berr.o \
7 ip22-time.o ip22-nvram.o ip22-reset.o ip22-setup.o 7 ip22-time.o ip22-nvram.o ip22-reset.o ip22-setup.o
8 8
9obj-$(CONFIG_EISA) += ip22-eisa.o 9obj-$(CONFIG_EISA) += ip22-eisa.o
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index d16fb43b1a93..fc6a7e2b189c 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -37,7 +37,6 @@ static char lc1msk_to_irqnr[256];
37static char lc2msk_to_irqnr[256]; 37static char lc2msk_to_irqnr[256];
38static char lc3msk_to_irqnr[256]; 38static char lc3msk_to_irqnr[256];
39 39
40extern asmlinkage void indyIRQ(void);
41extern int ip22_eisa_init(void); 40extern int ip22_eisa_init(void);
42 41
43static void enable_local0_irq(unsigned int irq) 42static void enable_local0_irq(unsigned int irq)
@@ -224,7 +223,7 @@ static struct hw_interrupt_type ip22_local3_irq_type = {
224 .end = end_local3_irq, 223 .end = end_local3_irq,
225}; 224};
226 225
227void indy_local0_irqdispatch(struct pt_regs *regs) 226static void indy_local0_irqdispatch(struct pt_regs *regs)
228{ 227{
229 u8 mask = sgint->istat0 & sgint->imask0; 228 u8 mask = sgint->istat0 & sgint->imask0;
230 u8 mask2; 229 u8 mask2;
@@ -242,7 +241,7 @@ void indy_local0_irqdispatch(struct pt_regs *regs)
242 return; 241 return;
243} 242}
244 243
245void indy_local1_irqdispatch(struct pt_regs *regs) 244static void indy_local1_irqdispatch(struct pt_regs *regs)
246{ 245{
247 u8 mask = sgint->istat1 & sgint->imask1; 246 u8 mask = sgint->istat1 & sgint->imask1;
248 u8 mask2; 247 u8 mask2;
@@ -262,7 +261,7 @@ void indy_local1_irqdispatch(struct pt_regs *regs)
262 261
263extern void ip22_be_interrupt(int irq, struct pt_regs *regs); 262extern void ip22_be_interrupt(int irq, struct pt_regs *regs);
264 263
265void indy_buserror_irq(struct pt_regs *regs) 264static void indy_buserror_irq(struct pt_regs *regs)
266{ 265{
267 int irq = SGI_BUSERR_IRQ; 266 int irq = SGI_BUSERR_IRQ;
268 267
@@ -307,6 +306,56 @@ static struct irqaction map1_cascade = {
307#define SGI_INTERRUPTS SGINT_LOCAL3 306#define SGI_INTERRUPTS SGINT_LOCAL3
308#endif 307#endif
309 308
309extern void indy_r4k_timer_interrupt(struct pt_regs *regs);
310extern void indy_8254timer_irq(struct pt_regs *regs);
311
312/*
313 * IRQs on the INDY look basically (barring software IRQs which we don't use
314 * at all) like:
315 *
316 * MIPS IRQ Source
317 * -------- ------
318 * 0 Software (ignored)
319 * 1 Software (ignored)
320 * 2 Local IRQ level zero
321 * 3 Local IRQ level one
322 * 4 8254 Timer zero
323 * 5 8254 Timer one
324 * 6 Bus Error
325 * 7 R4k timer (what we use)
326 *
327 * We handle the IRQ according to _our_ priority which is:
328 *
329 * Highest ---- R4k Timer
330 * Local IRQ zero
331 * Local IRQ one
332 * Bus Error
333 * 8254 Timer zero
334 * Lowest ---- 8254 Timer one
335 *
336 * then we just return, if multiple IRQs are pending then we will just take
337 * another exception, big deal.
338 */
339
340asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
341{
342 unsigned int pending = read_c0_cause();
343
344 /*
345 * First we check for r4k counter/timer IRQ.
346 */
347 if (pending & CAUSEF_IP7)
348 indy_r4k_timer_interrupt(regs);
349 else if (pending & CAUSEF_IP2)
350 indy_local0_irqdispatch(regs);
351 else if (pending & CAUSEF_IP3)
352 indy_local1_irqdispatch(regs);
353 else if (pending & CAUSEF_IP6)
354 indy_buserror_irq(regs);
355 else if (pending & (CAUSEF_IP4 | CAUSEF_IP5))
356 indy_8254timer_irq(regs);
357}
358
310extern void mips_cpu_irq_init(unsigned int irq_base); 359extern void mips_cpu_irq_init(unsigned int irq_base);
311 360
312void __init arch_init_irq(void) 361void __init arch_init_irq(void)
@@ -369,8 +418,6 @@ void __init arch_init_irq(void)
369 sgint->cmeimask0 = 0; 418 sgint->cmeimask0 = 0;
370 sgint->cmeimask1 = 0; 419 sgint->cmeimask1 = 0;
371 420
372 set_except_vector(0, indyIRQ);
373
374 /* init CPU irqs */ 421 /* init CPU irqs */
375 mips_cpu_irq_init(SGINT_CPU); 422 mips_cpu_irq_init(SGINT_CPU);
376 423
diff --git a/arch/mips/sgi-ip22/ip22-irq.S b/arch/mips/sgi-ip22/ip22-irq.S
deleted file mode 100644
index 6ccbd9e1d967..000000000000
--- a/arch/mips/sgi-ip22/ip22-irq.S
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * ip22-irq.S: Interrupt exception dispatch code for FullHouse and
3 * Guiness.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 */
7
8#include <asm/asm.h>
9#include <asm/mipsregs.h>
10#include <asm/regdef.h>
11#include <asm/stackframe.h>
12
13/* A lot of complication here is taken away because:
14 *
15 * 1) We handle one interrupt and return, sitting in a loop and moving across
16 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
17 * common case is one pending IRQ so optimize in that direction.
18 *
19 * 2) We need not check against bits in the status register IRQ mask, that
20 * would make this routine slow as hell.
21 *
22 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
23 * between like BSD spl() brain-damage.
24 *
25 * Furthermore, the IRQs on the INDY look basically (barring software IRQs
26 * which we don't use at all) like:
27 *
28 * MIPS IRQ Source
29 * -------- ------
30 * 0 Software (ignored)
31 * 1 Software (ignored)
32 * 2 Local IRQ level zero
33 * 3 Local IRQ level one
34 * 4 8254 Timer zero
35 * 5 8254 Timer one
36 * 6 Bus Error
37 * 7 R4k timer (what we use)
38 *
39 * We handle the IRQ according to _our_ priority which is:
40 *
41 * Highest ---- R4k Timer
42 * Local IRQ zero
43 * Local IRQ one
44 * Bus Error
45 * 8254 Timer zero
46 * Lowest ---- 8254 Timer one
47 *
48 * then we just return, if multiple IRQs are pending then we will just take
49 * another exception, big deal.
50 */
51
52 .text
53 .set noreorder
54 .set noat
55 .align 5
56 NESTED(indyIRQ, PT_SIZE, sp)
57 SAVE_ALL
58 CLI
59 .set at
60 mfc0 s0, CP0_CAUSE # get irq mask
61
62 /* First we check for r4k counter/timer IRQ. */
63 andi a0, s0, CAUSEF_IP7
64 beq a0, zero, 1f
65 andi a0, s0, CAUSEF_IP2 # delay slot, check local level zero
66
67 /* Wheee, a timer interrupt. */
68 jal indy_r4k_timer_interrupt
69 move a0, sp # delay slot
70 j ret_from_irq
71 nop # delay slot
72
731:
74 beq a0, zero, 1f
75 andi a0, s0, CAUSEF_IP3 # delay slot, check local level one
76
77 /* Wheee, local level zero interrupt. */
78 jal indy_local0_irqdispatch
79 move a0, sp # delay slot
80
81 j ret_from_irq
82 nop # delay slot
83
841:
85 beq a0, zero, 1f
86 andi a0, s0, CAUSEF_IP6 # delay slot, check bus error
87
88 /* Wheee, local level one interrupt. */
89 jal indy_local1_irqdispatch
90 move a0, sp # delay slot
91 j ret_from_irq
92 nop # delay slot
93
941:
95 beq a0, zero, 1f
96 andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5) # delay slot
97
98 /* Wheee, an asynchronous bus error... */
99 jal indy_buserror_irq
100 move a0, sp # delay slot
101 j ret_from_irq
102 nop # delay slot
103
1041:
105 /* Here by mistake? It is possible, that by the time we take
106 * the exception the IRQ pin goes low, so just leave if this
107 * is the case.
108 */
109 beq a0, zero, 1f
110 nop # delay slot
111
112 /* Must be one of the 8254 timers... */
113 jal indy_8254timer_irq
114 move a0, sp # delay slot
1151:
116 j ret_from_irq
117 nop # delay slot
118 END(indyIRQ)
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
index 4ba340780c35..686ba14e2882 100644
--- a/arch/mips/sgi-ip27/Makefile
+++ b/arch/mips/sgi-ip27/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the IP27 specific kernel interface routines under Linux. 2# Makefile for the IP27 specific kernel interface routines under Linux.
3# 3#
4 4
5obj-y := ip27-berr.o ip27-console.o ip27-irq.o ip27-init.o ip27-irq-glue.o \ 5obj-y := ip27-berr.o ip27-console.o ip27-irq.o ip27-init.o \
6 ip27-klconfig.o ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o \ 6 ip27-klconfig.o ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o \
7 ip27-timer.o ip27-hubio.o ip27-xtalk.o 7 ip27-timer.o ip27-hubio.o ip27-xtalk.o
8 8
diff --git a/arch/mips/sgi-ip27/TODO b/arch/mips/sgi-ip27/TODO
index 32106131b0d0..19f1512c8f2e 100644
--- a/arch/mips/sgi-ip27/TODO
+++ b/arch/mips/sgi-ip27/TODO
@@ -9,10 +9,6 @@ ip27-init.c:find_lbaord_real. DONE
9in irix? 9in irix?
106. Investigate why things do not work without the setup_test() call 106. Investigate why things do not work without the setup_test() call
11being invoked on all nodes in ip27-memory.c. 11being invoked on all nodes in ip27-memory.c.
127. Too many CLIs in the locore handlers :
13For the low level handlers set up by set_except_vector(),
14__tlb_refill_debug_tramp, __xtlb_refill_debug_tramp and cacheerror,
15investigate whether the code should do CLI, STI or KMODE.
168. Too many do_page_faults invoked - investigate. 128. Too many do_page_faults invoked - investigate.
179. start_thread must turn off UX64 ... and define tlb_refill_debug. 139. start_thread must turn off UX64 ... and define tlb_refill_debug.
1810. Need a bad pmd table, bad pte table. __bad_pmd_table/__bad_pagetable 1410. Need a bad pmd table, bad pte table. __bad_pmd_table/__bad_pagetable
diff --git a/arch/mips/sgi-ip27/ip27-irq-glue.S b/arch/mips/sgi-ip27/ip27-irq-glue.S
deleted file mode 100644
index c304df715e0a..000000000000
--- a/arch/mips/sgi-ip27/ip27-irq-glue.S
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/regdef.h>
12#include <asm/stackframe.h>
13
14 .text
15 .align 5
16NESTED(ip27_irq, PT_SIZE, sp)
17 SAVE_ALL
18 CLI
19
20 mfc0 s0, CP0_CAUSE
21 mfc0 t0, CP0_STATUS
22 and s0, t0
23 move a0, sp
24 PTR_LA ra, ret_from_irq
25
26 /* First check for RT interrupt. */
27 andi t0, s0, CAUSEF_IP4
28 bnez t0, ip4
29 andi t0, s0, CAUSEF_IP2
30 bnez t0, ip2
31 andi t0, s0, CAUSEF_IP3
32 bnez t0, ip3
33 andi t0, s0, CAUSEF_IP5
34 bnez t0, ip5
35 andi t0, s0, CAUSEF_IP6
36 bnez t0, ip6
37 j ra
38
39ip2: j ip27_do_irq_mask0 # PI_INT_PEND_0 or CC_PEND_{A|B}
40ip3: j ip27_do_irq_mask1 # PI_INT_PEND_1
41ip4: j ip27_rt_timer_interrupt
42ip5: j ip27_prof_timer
43ip6: j ip27_hub_error
44
45 END(ip27_irq)
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 2854ac4c9be1..2e643d2f51cb 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -130,7 +130,7 @@ static int ms1bit(unsigned long x)
130 * Kanoj 05.13.00 130 * Kanoj 05.13.00
131 */ 131 */
132 132
133void ip27_do_irq_mask0(struct pt_regs *regs) 133static void ip27_do_irq_mask0(struct pt_regs *regs)
134{ 134{
135 int irq, swlevel; 135 int irq, swlevel;
136 hubreg_t pend0, mask0; 136 hubreg_t pend0, mask0;
@@ -171,7 +171,7 @@ void ip27_do_irq_mask0(struct pt_regs *regs)
171 LOCAL_HUB_L(PI_INT_PEND0); 171 LOCAL_HUB_L(PI_INT_PEND0);
172} 172}
173 173
174void ip27_do_irq_mask1(struct pt_regs *regs) 174static void ip27_do_irq_mask1(struct pt_regs *regs)
175{ 175{
176 int irq, swlevel; 176 int irq, swlevel;
177 hubreg_t pend1, mask1; 177 hubreg_t pend1, mask1;
@@ -196,12 +196,12 @@ void ip27_do_irq_mask1(struct pt_regs *regs)
196 LOCAL_HUB_L(PI_INT_PEND1); 196 LOCAL_HUB_L(PI_INT_PEND1);
197} 197}
198 198
199void ip27_prof_timer(struct pt_regs *regs) 199static void ip27_prof_timer(struct pt_regs *regs)
200{ 200{
201 panic("CPU %d got a profiling interrupt", smp_processor_id()); 201 panic("CPU %d got a profiling interrupt", smp_processor_id());
202} 202}
203 203
204void ip27_hub_error(struct pt_regs *regs) 204static void ip27_hub_error(struct pt_regs *regs)
205{ 205{
206 panic("CPU %d got a hub error interrupt", smp_processor_id()); 206 panic("CPU %d got a hub error interrupt", smp_processor_id());
207} 207}
@@ -421,9 +421,26 @@ int __devinit request_bridge_irq(struct bridge_controller *bc)
421 return irq; 421 return irq;
422} 422}
423 423
424extern void ip27_rt_timer_interrupt(struct pt_regs *regs);
425
426asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
427{
428 unsigned long pending = read_c0_cause() & read_c0_status();
429
430 if (pending & CAUSEF_IP4)
431 ip27_rt_timer_interrupt(regs);
432 else if (pending & CAUSEF_IP2) /* PI_INT_PEND_0 or CC_PEND_{A|B} */
433 ip27_do_irq_mask0(regs);
434 else if (pending & CAUSEF_IP3) /* PI_INT_PEND_1 */
435 ip27_do_irq_mask1(regs);
436 else if (pending & CAUSEF_IP5)
437 ip27_prof_timer(regs);
438 else if (pending & CAUSEF_IP6)
439 ip27_hub_error(regs);
440}
441
424void __init arch_init_irq(void) 442void __init arch_init_irq(void)
425{ 443{
426 set_except_vector(0, ip27_irq);
427} 444}
428 445
429void install_ipi(void) 446void install_ipi(void)
diff --git a/arch/mips/sgi-ip32/Makefile b/arch/mips/sgi-ip32/Makefile
index 470898f4afe1..530bf848c3d0 100644
--- a/arch/mips/sgi-ip32/Makefile
+++ b/arch/mips/sgi-ip32/Makefile
@@ -3,7 +3,7 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y += ip32-berr.o ip32-irq.o ip32-irq-glue.o ip32-setup.o ip32-reset.o \ 6obj-y += ip32-berr.o ip32-irq.o ip32-setup.o ip32-reset.o \
7 crime.o ip32-memory.o 7 crime.o ip32-memory.o
8 8
9EXTRA_AFLAGS := $(CFLAGS) 9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sgi-ip32/ip32-irq-glue.S b/arch/mips/sgi-ip32/ip32-irq-glue.S
deleted file mode 100644
index 200924e1c4f5..000000000000
--- a/arch/mips/sgi-ip32/ip32-irq-glue.S
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * Low level interrupt handler for the SGI O2 aka IP32 aka Moosehead
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2001 Keith M Wesolowski
10 */
11#include <asm/asm.h>
12#include <asm/regdef.h>
13#include <asm/mipsregs.h>
14#include <asm/stackframe.h>
15#include <asm/addrspace.h>
16
17 .text
18 .set noreorder
19 .set noat
20 .align 5
21 NESTED(ip32_handle_int, PT_SIZE, ra)
22 .set noat
23 SAVE_ALL
24 CLI # TEST: interrupts should be off
25 .set at
26 .set noreorder
27
28 mfc0 s0,CP0_CAUSE
29
30 andi t1, s0, IE_IRQ0
31 bnez t1, handle_irq0
32 andi t1, s0, IE_IRQ1
33 bnez t1, handle_irq1
34 andi t1, s0, IE_IRQ2
35 bnez t1, handle_irq2
36 andi t1, s0, IE_IRQ3
37 bnez t1, handle_irq3
38 andi t1, s0, IE_IRQ4
39 bnez t1, handle_irq4
40 andi t1, s0, IE_IRQ5
41 bnez t1, handle_irq5
42 nop
43
44 /* Either someone has triggered the "software interrupts"
45 * or we lost an interrupt somehow. Ignore it.
46 */
47 j ret_from_irq
48 nop
49
50handle_irq0:
51 jal ip32_irq0
52 move a0, sp
53 j ret_from_irq
54 nop
55
56handle_irq1:
57 jal ip32_irq1
58 move a0, sp
59 j ret_from_irq
60 nop
61
62handle_irq2:
63 jal ip32_irq2
64 move a0, sp
65 j ret_from_irq
66 nop
67
68handle_irq3:
69 jal ip32_irq3
70 move a0, sp
71 j ret_from_irq
72 nop
73
74handle_irq4:
75 jal ip32_irq4
76 move a0, sp
77 j ret_from_irq
78 nop
79
80handle_irq5:
81 jal ip32_irq5
82 move a0, sp
83 j ret_from_irq
84 nop
85
86 END(ip32_handle_int)
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 2eb22d692ed9..22a6df94b4a1 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -130,8 +130,6 @@ struct irqaction memerr_irq = { crime_memerr_intr, SA_INTERRUPT,
130struct irqaction cpuerr_irq = { crime_cpuerr_intr, SA_INTERRUPT, 130struct irqaction cpuerr_irq = { crime_cpuerr_intr, SA_INTERRUPT,
131 CPU_MASK_NONE, "CRIME CPU error", NULL, NULL }; 131 CPU_MASK_NONE, "CRIME CPU error", NULL, NULL };
132 132
133extern void ip32_handle_int(void);
134
135/* 133/*
136 * For interrupts wired from a single device to the CPU. Only the clock 134 * For interrupts wired from a single device to the CPU. Only the clock
137 * uses this it seems, which is IRQ 0 and IP7. 135 * uses this it seems, which is IRQ 0 and IP7.
@@ -503,7 +501,7 @@ static void ip32_unknown_interrupt(struct pt_regs *regs)
503 501
504/* CRIME 1.1 appears to deliver all interrupts to this one pin. */ 502/* CRIME 1.1 appears to deliver all interrupts to this one pin. */
505/* change this to loop over all edge-triggered irqs, exception masked out ones */ 503/* change this to loop over all edge-triggered irqs, exception masked out ones */
506void ip32_irq0(struct pt_regs *regs) 504static void ip32_irq0(struct pt_regs *regs)
507{ 505{
508 uint64_t crime_int; 506 uint64_t crime_int;
509 int irq = 0; 507 int irq = 0;
@@ -520,31 +518,49 @@ void ip32_irq0(struct pt_regs *regs)
520 do_IRQ(irq, regs); 518 do_IRQ(irq, regs);
521} 519}
522 520
523void ip32_irq1(struct pt_regs *regs) 521static void ip32_irq1(struct pt_regs *regs)
524{ 522{
525 ip32_unknown_interrupt(regs); 523 ip32_unknown_interrupt(regs);
526} 524}
527 525
528void ip32_irq2(struct pt_regs *regs) 526static void ip32_irq2(struct pt_regs *regs)
529{ 527{
530 ip32_unknown_interrupt(regs); 528 ip32_unknown_interrupt(regs);
531} 529}
532 530
533void ip32_irq3(struct pt_regs *regs) 531static void ip32_irq3(struct pt_regs *regs)
534{ 532{
535 ip32_unknown_interrupt(regs); 533 ip32_unknown_interrupt(regs);
536} 534}
537 535
538void ip32_irq4(struct pt_regs *regs) 536static void ip32_irq4(struct pt_regs *regs)
539{ 537{
540 ip32_unknown_interrupt(regs); 538 ip32_unknown_interrupt(regs);
541} 539}
542 540
543void ip32_irq5(struct pt_regs *regs) 541static void ip32_irq5(struct pt_regs *regs)
544{ 542{
545 ll_timer_interrupt(IP32_R4K_TIMER_IRQ, regs); 543 ll_timer_interrupt(IP32_R4K_TIMER_IRQ, regs);
546} 544}
547 545
546asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
547{
548 unsigned int pending = read_c0_cause();
549
550 if (likely(pending & IE_IRQ0))
551 ip32_irq0(regs);
552 else if (unlikely(pending & IE_IRQ1))
553 ip32_irq1(regs);
554 else if (unlikely(pending & IE_IRQ2))
555 ip32_irq2(regs);
556 else if (unlikely(pending & IE_IRQ3))
557 ip32_irq3(regs);
558 else if (unlikely(pending & IE_IRQ4))
559 ip32_irq4(regs);
560 else if (likely(pending & IE_IRQ5))
561 ip32_irq5(regs);
562}
563
548void __init arch_init_irq(void) 564void __init arch_init_irq(void)
549{ 565{
550 unsigned int irq; 566 unsigned int irq;
@@ -556,7 +572,6 @@ void __init arch_init_irq(void)
556 crime->soft_int = 0; 572 crime->soft_int = 0;
557 mace->perif.ctrl.istat = 0; 573 mace->perif.ctrl.istat = 0;
558 mace->perif.ctrl.imask = 0; 574 mace->perif.ctrl.imask = 0;
559 set_except_vector(0, ip32_handle_int);
560 575
561 for (irq = 0; irq <= IP32_IRQ_MAX; irq++) { 576 for (irq = 0; irq <= IP32_IRQ_MAX; irq++) {
562 hw_irq_controller *controller; 577 hw_irq_controller *controller;
diff --git a/arch/mips/sibyte/bcm1480/Makefile b/arch/mips/sibyte/bcm1480/Makefile
index 538d5a51ae94..7b36ff3873b7 100644
--- a/arch/mips/sibyte/bcm1480/Makefile
+++ b/arch/mips/sibyte/bcm1480/Makefile
@@ -1,4 +1,4 @@
1obj-y := setup.o irq.o irq_handler.o time.o 1obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4 4
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 9cf7d713b13c..e61760b14d99 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -187,9 +187,6 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
187#endif 187#endif
188 188
189 189
190/* Defined in arch/mips/sibyte/bcm1480/irq_handler.S */
191extern void bcm1480_irq_handler(void);
192
193/*****************************************************************************/ 190/*****************************************************************************/
194 191
195static unsigned int startup_bcm1480_irq(unsigned int irq) 192static unsigned int startup_bcm1480_irq(unsigned int irq)
@@ -422,7 +419,6 @@ void __init arch_init_irq(void)
422#endif 419#endif
423 /* Enable necessary IPs, disable the rest */ 420 /* Enable necessary IPs, disable the rest */
424 change_c0_status(ST0_IM, imask); 421 change_c0_status(ST0_IM, imask);
425 set_except_vector(0, bcm1480_irq_handler);
426 422
427#ifdef CONFIG_KGDB 423#ifdef CONFIG_KGDB
428 if (kgdb_flag) { 424 if (kgdb_flag) {
@@ -473,3 +469,76 @@ void bcm1480_kgdb_interrupt(struct pt_regs *regs)
473} 469}
474 470
475#endif /* CONFIG_KGDB */ 471#endif /* CONFIG_KGDB */
472
473static inline int dclz(unsigned long long x)
474{
475 int lz;
476
477 __asm__ (
478 " .set push \n"
479 " .set mips64 \n"
480 " dclz %0, %1 \n"
481 " .set pop \n"
482 : "=r" (lz)
483 : "r" (x));
484
485 return lz;
486}
487
488extern void bcm1480_timer_interrupt(struct pt_regs *regs);
489extern void bcm1480_mailbox_interrupt(struct pt_regs *regs);
490extern void bcm1480_kgdb_interrupt(struct pt_regs *regs);
491
492asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
493{
494 unsigned int pending;
495
496#ifdef CONFIG_SIBYTE_BCM1480_PROF
497 /* Set compare to count to silence count/compare timer interrupts */
498 write_c0_compare(read_c0_count());
499#endif
500
501 pending = read_c0_cause();
502
503#ifdef CONFIG_SIBYTE_BCM1480_PROF
504 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */
505 sbprof_cpu_intr(exception_epc(regs));
506#endif
507
508 if (pending & CAUSEF_IP4)
509 bcm1480_timer_interrupt(regs);
510
511#ifdef CONFIG_SMP
512 if (pending & CAUSEF_IP3)
513 bcm1480_mailbox_interrupt(regs);
514#endif
515
516#ifdef CONFIG_KGDB
517 if (pending & CAUSEF_IP6)
518 bcm1480_kgdb_interrupt(regs); /* KGDB (uart 1) */
519#endif
520
521 if (pending & CAUSEF_IP2) {
522 unsigned long long mask_h, mask_l;
523 unsigned long base;
524
525 /*
526 * Default...we've hit an IP[2] interrupt, which means we've
527 * got to check the 1480 interrupt registers to figure out what
528 * to do. Need to detect which CPU we're on, now that
529 * smp_affinity is supported.
530 */
531 base = A_BCM1480_IMR_MAPPER(smp_processor_id());
532 mask_h = __raw_readq(
533 IOADDR(base + R_BCM1480_IMR_INTERRUPT_STATUS_BASE_H));
534 mask_l = __raw_readq(
535 IOADDR(base + R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L));
536
537 if (!mask_h) {
538 if (mask_h ^ 1)
539 do_IRQ(63 - dclz(mask_h), regs);
540 else
541 do_IRQ(127 - dclz(mask_l), regs);
542 }
543 }
544}
diff --git a/arch/mips/sibyte/bcm1480/irq_handler.S b/arch/mips/sibyte/bcm1480/irq_handler.S
deleted file mode 100644
index 408db88d050f..000000000000
--- a/arch/mips/sibyte/bcm1480/irq_handler.S
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * bcm1480_irq_handler() is the routine that is actually called when an
21 * interrupt occurs. It is installed as the exception vector handler in
22 * init_IRQ() in arch/mips/sibyte/bcm1480/irq.c
23 *
24 * In the handle we figure out which interrupts need handling, and use that
25 * to call the dispatcher, which will take care of actually calling
26 * registered handlers
27 *
28 * Note that we take care of all raised interrupts in one go at the handler.
29 * This is more BSDish than the Indy code, and also, IMHO, more sane.
30 */
31#include <linux/config.h>
32
33#include <asm/addrspace.h>
34#include <asm/asm.h>
35#include <asm/mipsregs.h>
36#include <asm/regdef.h>
37#include <asm/stackframe.h>
38#include <asm/sibyte/sb1250_defs.h>
39#include <asm/sibyte/bcm1480_regs.h>
40#include <asm/sibyte/bcm1480_int.h>
41
42/*
43 * What a pain. We have to be really careful saving the upper 32 bits of any
44 * register across function calls if we don't want them trashed--since were
45 * running in -o32, the calling routing never saves the full 64 bits of a
46 * register across a function call. Being the interrupt handler, we're
47 * guaranteed that interrupts are disabled during this code so we don't have
48 * to worry about random interrupts blasting the high 32 bits.
49 */
50
51 .text
52 .set push
53 .set noreorder
54 .set noat
55 .set mips64
56 #.set mips4
57 .align 5
58 NESTED(bcm1480_irq_handler, PT_SIZE, sp)
59 SAVE_ALL
60 CLI
61
62#ifdef CONFIG_SIBYTE_BCM1480_PROF
63 /* Set compare to count to silence count/compare timer interrupts */
64 mfc0 t1, CP0_COUNT
65 mtc0 t1, CP0_COMPARE /* pause to clear IP[7] bit of cause ? */
66#endif
67 /* Read cause */
68 mfc0 s0, CP0_CAUSE
69
70#ifdef CONFIG_SIBYTE_BCM1480_PROF
71 /* Cpu performance counter interrupt is routed to IP[7] */
72 andi t1, s0, CAUSEF_IP7
73 beqz t1, 0f
74 srl t1, s0, (CAUSEB_BD-2) /* Shift BD bit to bit 2 */
75 and t1, t1, 0x4 /* mask to get just BD bit */
76#ifdef CONFIG_MIPS64
77 dmfc0 a0, CP0_EPC
78 daddu a0, a0, t1 /* a0 = EPC + (BD ? 4 : 0) */
79#else
80 mfc0 a0, CP0_EPC
81 addu a0, a0, t1 /* a0 = EPC + (BD ? 4 : 0) */
82#endif
83 jal sbprof_cpu_intr
84 nop
85 j ret_from_irq
86 nop
870:
88#endif
89
90 /* Timer interrupt is routed to IP[4] */
91 andi t1, s0, CAUSEF_IP4
92 beqz t1, 1f
93 nop
94 jal bcm1480_timer_interrupt
95 move a0, sp /* Pass the registers along */
96 j ret_from_irq
97 nop /* delay slot */
981:
99
100#ifdef CONFIG_SMP
101 /* Mailbox interrupt is routed to IP[3] */
102 andi t1, s0, CAUSEF_IP3
103 beqz t1, 2f
104 nop
105 jal bcm1480_mailbox_interrupt
106 move a0, sp
107 j ret_from_irq
108 nop /* delay slot */
1092:
110#endif
111
112#ifdef CONFIG_KGDB
113 /* KGDB (uart 1) interrupt is routed to IP[6] */
114 andi t1, s0, CAUSEF_IP6
115 beqz t1, 3f
116 nop /* delay slot */
117 jal bcm1480_kgdb_interrupt
118 move a0, sp
119 j ret_from_irq
120 nop /* delay slot */
1213:
122#endif
123
124 and t1, s0, CAUSEF_IP2
125 beqz t1, 9f
126 nop
127
128 /*
129 * Default...we've hit an IP[2] interrupt, which means we've got
130 * to check the 1480 interrupt registers to figure out what to do
131 * Need to detect which CPU we're on, now that smp_affinity is
132 * supported.
133 */
134 PTR_LA v0, CKSEG1 + A_BCM1480_IMR_CPU0_BASE
135#ifdef CONFIG_SMP
136 lw t1, TI_CPU($28)
137 sll t1, t1, BCM1480_IMR_REGISTER_SPACING_SHIFT
138 addu v0, v0, t1
139#endif
140
141 /* Read IP[2] status (get both high and low halves of status) */
142 ld s0, R_BCM1480_IMR_INTERRUPT_STATUS_BASE_H(v0)
143 ld s1, R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L(v0)
144
145 move s2, zero /* intr number */
146 li s3, 64
147
148 beqz s0, 9f /* No interrupts. Return. */
149 move a1, sp
150
151 xori s4, s0, 1 /* if s0 (_H) == 1, it's a low intr, so... */
152 movz s2, s3, s4 /* start the intr number at 64, and */
153 movz s0, s1, s4 /* look at the low status value. */
154
155 dclz s1, s0 /* Find the next interrupt. */
156 dsubu a0, zero, s1
157 daddiu a0, a0, 63
158 jal do_IRQ
159 daddu a0, a0, s2
160
1619: j ret_from_irq
162 nop
163
164 .set pop
165 END(bcm1480_irq_handler)
diff --git a/arch/mips/sibyte/sb1250/Makefile b/arch/mips/sibyte/sb1250/Makefile
index a8af84697588..a2fdbd62f8ac 100644
--- a/arch/mips/sibyte/sb1250/Makefile
+++ b/arch/mips/sibyte/sb1250/Makefile
@@ -1,4 +1,4 @@
1obj-y := setup.o irq.o irq_handler.o time.o 1obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SIBYTE_TBPROF) += bcm1250_tbprof.o 4obj-$(CONFIG_SIBYTE_TBPROF) += bcm1250_tbprof.o
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 589537bfcc3d..0f6e54db4888 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -163,10 +163,6 @@ static void sb1250_set_affinity(unsigned int irq, cpumask_t mask)
163} 163}
164#endif 164#endif
165 165
166
167/* Defined in arch/mips/sibyte/sb1250/irq_handler.S */
168extern void sb1250_irq_handler(void);
169
170/*****************************************************************************/ 166/*****************************************************************************/
171 167
172static unsigned int startup_sb1250_irq(unsigned int irq) 168static unsigned int startup_sb1250_irq(unsigned int irq)
@@ -379,7 +375,6 @@ void __init arch_init_irq(void)
379#endif 375#endif
380 /* Enable necessary IPs, disable the rest */ 376 /* Enable necessary IPs, disable the rest */
381 change_c0_status(ST0_IM, imask); 377 change_c0_status(ST0_IM, imask);
382 set_except_vector(0, sb1250_irq_handler);
383 378
384#ifdef CONFIG_KGDB 379#ifdef CONFIG_KGDB
385 if (kgdb_flag) { 380 if (kgdb_flag) {
@@ -409,7 +404,7 @@ void __init arch_init_irq(void)
409#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port,reg))) 404#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
410#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port,reg))) 405#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
411 406
412void sb1250_kgdb_interrupt(struct pt_regs *regs) 407static void sb1250_kgdb_interrupt(struct pt_regs *regs)
413{ 408{
414 /* 409 /*
415 * Clear break-change status (allow some time for the remote 410 * Clear break-change status (allow some time for the remote
@@ -424,3 +419,74 @@ void sb1250_kgdb_interrupt(struct pt_regs *regs)
424} 419}
425 420
426#endif /* CONFIG_KGDB */ 421#endif /* CONFIG_KGDB */
422
423static inline int dclz(unsigned long long x)
424{
425 int lz;
426
427 __asm__ (
428 " .set push \n"
429 " .set mips64 \n"
430 " dclz %0, %1 \n"
431 " .set pop \n"
432 : "=r" (lz)
433 : "r" (x));
434
435 return lz;
436}
437
438asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
439{
440 unsigned int pending;
441
442#ifdef CONFIG_SIBYTE_SB1250_PROF
443 /* Set compare to count to silence count/compare timer interrupts */
444 write_c0_count(read_c0_count());
445#endif
446
447 /*
448 * What a pain. We have to be really careful saving the upper 32 bits
449 * of any * register across function calls if we don't want them
450 * trashed--since were running in -o32, the calling routing never saves
451 * the full 64 bits of a register across a function call. Being the
452 * interrupt handler, we're guaranteed that interrupts are disabled
453 * during this code so we don't have to worry about random interrupts
454 * blasting the high 32 bits.
455 */
456
457 pending = read_c0_cause();
458
459#ifdef CONFIG_SIBYTE_SB1250_PROF
460 if (pending & CAUSEF_IP7) { /* Cpu performance counter interrupt */
461 sbprof_cpu_intr(exception_epc(regs));
462 }
463#endif
464
465 if (pending & CAUSEF_IP4)
466 sb1250_timer_interrupt(regs);
467
468#ifdef CONFIG_SMP
469 if (pending & CAUSEF_IP3)
470 sb1250_mailbox_interrupt(regs);
471#endif
472
473#ifdef CONFIG_KGDB
474 if (pending & CAUSEF_IP6) /* KGDB (uart 1) */
475 sb1250_kgdb_interrupt(regs);
476#endif
477
478 if (pending & CAUSEF_IP2) {
479 unsigned long long mask;
480
481 /*
482 * Default...we've hit an IP[2] interrupt, which means we've
483 * got to check the 1250 interrupt registers to figure out what
484 * to do. Need to detect which CPU we're on, now that
485 ~ smp_affinity is supported.
486 */
487 mask = __raw_readq(IOADDR(A_IMR_REGISTER(smp_processor_id(),
488 R_IMR_INTERRUPT_STATUS_BASE)));
489 if (mask)
490 do_IRQ(63 - dclz(mask), regs);
491 }
492}
diff --git a/arch/mips/sibyte/sb1250/irq_handler.S b/arch/mips/sibyte/sb1250/irq_handler.S
deleted file mode 100644
index 60edc8fb302b..000000000000
--- a/arch/mips/sibyte/sb1250/irq_handler.S
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * sb1250_handle_int() is the routine that is actually called when an interrupt
21 * occurs. It is installed as the exception vector handler in arch_init_irq()
22 * in arch/mips/sibyte/sb1250/irq.c
23 *
24 * In the handle we figure out which interrupts need handling, and use that to
25 * call the dispatcher, which will take care of actually calling registered
26 * handlers
27 *
28 * Note that we take care of all raised interrupts in one go at the handler.
29 * This is more BSDish than the Indy code, and also, IMHO, more sane.
30 */
31#include <linux/config.h>
32
33#include <asm/addrspace.h>
34#include <asm/asm.h>
35#include <asm/mipsregs.h>
36#include <asm/regdef.h>
37#include <asm/stackframe.h>
38#include <asm/sibyte/sb1250_defs.h>
39#include <asm/sibyte/sb1250_regs.h>
40#include <asm/sibyte/sb1250_int.h>
41
42/*
43 * What a pain. We have to be really careful saving the upper 32 bits of any
44 * register across function calls if we don't want them trashed--since were
45 * running in -o32, the calling routing never saves the full 64 bits of a
46 * register across a function call. Being the interrupt handler, we're
47 * guaranteed that interrupts are disabled during this code so we don't have
48 * to worry about random interrupts blasting the high 32 bits.
49 */
50
51 .text
52 .set push
53 .set noreorder
54 .set noat
55 .set mips64
56 .align 5
57 NESTED(sb1250_irq_handler, PT_SIZE, sp)
58 SAVE_ALL
59 CLI
60
61#ifdef CONFIG_SIBYTE_SB1250_PROF
62 /* Set compare to count to silence count/compare timer interrupts */
63 mfc0 t1, CP0_COUNT
64 mtc0 t1, CP0_COMPARE /* pause to clear IP[7] bit of cause ? */
65#endif
66 /* Read cause */
67 mfc0 s0, CP0_CAUSE
68
69#ifdef CONFIG_SIBYTE_SB1250_PROF
70 /* Cpu performance counter interrupt is routed to IP[7] */
71 andi t1, s0, CAUSEF_IP7
72 beqz t1, 0f
73 srl t1, s0, (CAUSEB_BD-2) /* Shift BD bit to bit 2 */
74 and t1, t1, 0x4 /* mask to get just BD bit */
75 mfc0 a0, CP0_EPC
76 jal sbprof_cpu_intr
77 addu a0, a0, t1 /* a0 = EPC + (BD ? 4 : 0) */
78 j ret_from_irq
79 nop
800:
81#endif
82
83 /* Timer interrupt is routed to IP[4] */
84 andi t1, s0, CAUSEF_IP4
85 beqz t1, 1f
86 nop
87 jal sb1250_timer_interrupt
88 move a0, sp /* Pass the registers along */
89 j ret_from_irq
90 nop # delay slot
911:
92
93#ifdef CONFIG_SMP
94 /* Mailbox interrupt is routed to IP[3] */
95 andi t1, s0, CAUSEF_IP3
96 beqz t1, 2f
97 nop
98 jal sb1250_mailbox_interrupt
99 move a0, sp
100 j ret_from_irq
101 nop # delay slot
1022:
103#endif
104
105#ifdef CONFIG_KGDB
106 /* KGDB (uart 1) interrupt is routed to IP[6] */
107 andi t1, s0, CAUSEF_IP6
108 beqz t1, 1f
109 nop # delay slot
110 jal sb1250_kgdb_interrupt
111 move a0, sp
112 j ret_from_irq
113 nop # delay slot
1141:
115#endif
116
117 and t1, s0, CAUSEF_IP2
118 beqz t1, 4f
119 nop
120
121 /*
122 * Default...we've hit an IP[2] interrupt, which means we've got to
123 * check the 1250 interrupt registers to figure out what to do
124 * Need to detect which CPU we're on, now that smp_affinity is supported.
125 */
126 PTR_LA v0, CKSEG1 + A_IMR_CPU0_BASE
127#ifdef CONFIG_SMP
128 lw t1, TI_CPU($28)
129 sll t1, IMR_REGISTER_SPACING_SHIFT
130 addu v0, t1
131#endif
132 ld s0, R_IMR_INTERRUPT_STATUS_BASE(v0) /* read IP[2] status */
133
134 beqz s0, 4f /* No interrupts. Return */
135 move a1, sp
136
1373: dclz s1, s0 /* Find the next interrupt */
138 dsubu a0, zero, s1
139 daddiu a0, a0, 63
140 jal do_IRQ
141 nop
142
1434: j ret_from_irq
144 nop
145
146 .set pop
147 END(sb1250_irq_handler)
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
index 1e5676e4be86..9c7eaa5fb210 100644
--- a/arch/mips/sni/Makefile
+++ b/arch/mips/sni/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the SNI specific part of the kernel 2# Makefile for the SNI specific part of the kernel
3# 3#
4 4
5obj-y += int-handler.o irq.o pcimt_scache.o reset.o setup.o 5obj-y += irq.o pcimt_scache.o reset.o setup.o
6 6
7EXTRA_AFLAGS := $(CFLAGS) 7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sni/int-handler.S b/arch/mips/sni/int-handler.S
deleted file mode 100644
index 2cdc09f55f18..000000000000
--- a/arch/mips/sni/int-handler.S
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * SNI RM200 PCI specific interrupt handler code.
3 *
4 * Copyright (C) 1994, 95, 96, 97, 98, 1999, 2000, 01 by Ralf Baechle
5 */
6#include <asm/asm.h>
7#include <asm/mipsregs.h>
8#include <asm/regdef.h>
9#include <asm/sni.h>
10#include <asm/stackframe.h>
11
12/*
13 * The PCI ASIC has the nasty property that it may delay writes if it is busy.
14 * As a consequence from writes that have not graduated when we exit from the
15 * interrupt handler we might catch a spurious interrupt. To avoid this we
16 * force the PCI ASIC to graduate all writes by executing a read from the
17 * PCI bus.
18 */
19 .set noreorder
20 .set noat
21 .align 5
22 NESTED(sni_rm200_pci_handle_int, PT_SIZE, sp)
23 SAVE_ALL
24 CLI
25 .set at
26
27 /* Blinken light ... */
28 lb t0, led_cache
29 addiu t0, 1
30 sb t0, led_cache
31 sb t0, PCIMT_CSLED # write only register
32 .data
33led_cache: .byte 0
34 .text
35
36 mfc0 t0, CP0_STATUS
37 mfc0 t1, CP0_CAUSE
38 and t0, t1
39
40 andi t1, t0, 0x0800 # hardware interrupt 1
41 bnez t1, _hwint1
42 andi t1, t0, 0x4000 # hardware interrupt 4
43 bnez t1, _hwint4
44 andi t1, t0, 0x2000 # hardware interrupt 3
45 bnez t1, _hwint3
46 andi t1, t0, 0x1000 # hardware interrupt 2
47 bnez t1, _hwint2
48 andi t1, t0, 0x8000 # hardware interrupt 5
49 bnez t1, _hwint5
50 andi t1, t0, 0x0400 # hardware interrupt 0
51 bnez t1, _hwint0
52 nop
53
54 j restore_all # spurious interrupt
55 nop
56
57 ##############################################################################
58
59/* hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug
60 button interrupts. */
61_hwint0: jal pciasic_hwint0
62 move a0, sp
63 j ret_from_irq
64 nop
65
66/*
67 * hwint 1 deals with EISA and SCSI interrupts
68 */
69_hwint1: jal pciasic_hwint1
70 move a0, sp
71 j ret_from_irq
72 nop
73
74
75/*
76 * This interrupt was used for the com1 console on the first prototypes;
77 * it's unsed otherwise
78 */
79_hwint2: jal pciasic_hwint2
80 move a0, sp
81 j ret_from_irq
82 nop
83
84/*
85 * hwint 3 are the PCI interrupts A - D
86 */
87_hwint3: jal pciasic_hwint3
88 move a0, sp
89 j ret_from_irq
90 nop
91
92/*
93 * hwint 4 is used for only the onboard PCnet 32.
94 */
95_hwint4: jal pciasic_hwint4
96 move a0, sp
97 j ret_from_irq
98 nop
99
100/* hwint5 is the r4k count / compare interrupt */
101_hwint5: jal pciasic_hwint5
102 move a0, sp
103 j ret_from_irq
104 nop
105
106 END(sni_rm200_pci_handle_int)
diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c
index 952038aa4b90..7365b4853ddb 100644
--- a/arch/mips/sni/irq.c
+++ b/arch/mips/sni/irq.c
@@ -19,8 +19,6 @@
19 19
20DEFINE_SPINLOCK(pciasic_lock); 20DEFINE_SPINLOCK(pciasic_lock);
21 21
22extern asmlinkage void sni_rm200_pci_handle_int(void);
23
24static void enable_pciasic_irq(unsigned int irq) 22static void enable_pciasic_irq(unsigned int irq)
25{ 23{
26 unsigned int mask = 1 << (irq - PCIMT_IRQ_INT2); 24 unsigned int mask = 1 << (irq - PCIMT_IRQ_INT2);
@@ -71,20 +69,20 @@ static struct hw_interrupt_type pciasic_irq_type = {
71 * hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug 69 * hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug
72 * button interrupts. Later ... 70 * button interrupts. Later ...
73 */ 71 */
74void pciasic_hwint0(struct pt_regs *regs) 72static void pciasic_hwint0(struct pt_regs *regs)
75{ 73{
76 panic("Received int0 but no handler yet ..."); 74 panic("Received int0 but no handler yet ...");
77} 75}
78 76
79/* This interrupt was used for the com1 console on the first prototypes. */ 77/* This interrupt was used for the com1 console on the first prototypes. */
80void pciasic_hwint2(struct pt_regs *regs) 78static void pciasic_hwint2(struct pt_regs *regs)
81{ 79{
82 /* I think this shouldn't happen on production machines. */ 80 /* I think this shouldn't happen on production machines. */
83 panic("hwint2 and no handler yet"); 81 panic("hwint2 and no handler yet");
84} 82}
85 83
86/* hwint5 is the r4k count / compare interrupt */ 84/* hwint5 is the r4k count / compare interrupt */
87void pciasic_hwint5(struct pt_regs *regs) 85static void pciasic_hwint5(struct pt_regs *regs)
88{ 86{
89 panic("hwint5 and no handler yet"); 87 panic("hwint5 and no handler yet");
90} 88}
@@ -105,7 +103,7 @@ static unsigned int ls1bit8(unsigned int x)
105 * 103 *
106 * The EISA_INT bit in CSITPEND is high active, all others are low active. 104 * The EISA_INT bit in CSITPEND is high active, all others are low active.
107 */ 105 */
108void pciasic_hwint1(struct pt_regs *regs) 106static void pciasic_hwint1(struct pt_regs *regs)
109{ 107{
110 u8 pend = *(volatile char *)PCIMT_CSITPEND; 108 u8 pend = *(volatile char *)PCIMT_CSITPEND;
111 unsigned long flags; 109 unsigned long flags;
@@ -135,7 +133,7 @@ void pciasic_hwint1(struct pt_regs *regs)
135/* 133/*
136 * hwint 3 should deal with the PCI A - D interrupts, 134 * hwint 3 should deal with the PCI A - D interrupts,
137 */ 135 */
138void pciasic_hwint3(struct pt_regs *regs) 136static void pciasic_hwint3(struct pt_regs *regs)
139{ 137{
140 u8 pend = *(volatile char *)PCIMT_CSITPEND; 138 u8 pend = *(volatile char *)PCIMT_CSITPEND;
141 int irq; 139 int irq;
@@ -150,13 +148,34 @@ void pciasic_hwint3(struct pt_regs *regs)
150/* 148/*
151 * hwint 4 is used for only the onboard PCnet 32. 149 * hwint 4 is used for only the onboard PCnet 32.
152 */ 150 */
153void pciasic_hwint4(struct pt_regs *regs) 151static void pciasic_hwint4(struct pt_regs *regs)
154{ 152{
155 clear_c0_status(IE_IRQ4); 153 clear_c0_status(IE_IRQ4);
156 do_IRQ(PCIMT_IRQ_ETHERNET, regs); 154 do_IRQ(PCIMT_IRQ_ETHERNET, regs);
157 set_c0_status(IE_IRQ4); 155 set_c0_status(IE_IRQ4);
158} 156}
159 157
158asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
159{
160 unsigned int pending = read_c0_status() & read_c0_cause();
161 static unsigned char led_cache;
162
163 *(volatile unsigned char *) PCIMT_CSLED = ++led_cache;
164
165 if (pending & 0x0800)
166 pciasic_hwint1(regs);
167 else if (pending & 0x4000)
168 pciasic_hwint4(regs);
169 else if (pending & 0x2000)
170 pciasic_hwint3(regs);
171 else if (pending & 0x1000)
172 pciasic_hwint2(regs);
173 else if (pending & 0x8000)
174 pciasic_hwint5(regs);
175 else if (pending & 0x0400)
176 pciasic_hwint0(regs);
177}
178
160void __init init_pciasic(void) 179void __init init_pciasic(void)
161{ 180{
162 unsigned long flags; 181 unsigned long flags;
@@ -176,8 +195,6 @@ void __init arch_init_irq(void)
176{ 195{
177 int i; 196 int i;
178 197
179 set_except_vector(0, sni_rm200_pci_handle_int);
180
181 init_i8259_irqs(); /* Integrated i8259 */ 198 init_i8259_irqs(); /* Integrated i8259 */
182 init_pciasic(); 199 init_pciasic();
183 200
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile
index 8fa126b296e1..9cb9535ebacb 100644
--- a/arch/mips/tx4927/common/Makefile
+++ b/arch/mips/tx4927/common/Makefile
@@ -6,7 +6,7 @@
6# unless it's something special (ie not a .c file). 6# unless it's something special (ie not a .c file).
7# 7#
8 8
9obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o tx4927_irq_handler.o 9obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o
10 10
11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o 11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
12obj-$(CONFIG_KGDB) += tx4927_dbgio.o 12obj-$(CONFIG_KGDB) += tx4927_dbgio.o
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index 5ab2e2b76018..8ca68015cf40 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -525,8 +525,6 @@ static void tx4927_irq_pic_end(unsigned int irq)
525 */ 525 */
526void __init tx4927_irq_init(void) 526void __init tx4927_irq_init(void)
527{ 527{
528 extern asmlinkage void tx4927_irq_handler(void);
529
530 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n"); 528 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n");
531 529
532 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n"); 530 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n");
@@ -535,16 +533,12 @@ void __init tx4927_irq_init(void)
535 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n"); 533 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n");
536 tx4927_irq_pic_init(); 534 tx4927_irq_pic_init();
537 535
538 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT,
539 "=Calling set_except_vector(tx4927_irq_handler)\n");
540 set_except_vector(0, tx4927_irq_handler);
541
542 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n"); 536 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n");
543 537
544 return; 538 return;
545} 539}
546 540
547int tx4927_irq_nested(void) 541static int tx4927_irq_nested(void)
548{ 542{
549 int sw_irq = 0; 543 int sw_irq = 0;
550 u32 level2; 544 u32 level2;
@@ -582,3 +576,25 @@ int tx4927_irq_nested(void)
582 576
583 return (sw_irq); 577 return (sw_irq);
584} 578}
579
580asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
581{
582 unsigned int pending = read_c0_status() & read_c0_cause();
583
584 if (pending & STATUSF_IP7) /* cpu timer */
585 do_IRQ(TX4927_IRQ_CPU_TIMER, regs);
586 else if (pending & STATUSF_IP2) { /* tx4927 pic */
587 unsigned int irq = tx4927_irq_nested();
588
589 if (unlikely(irq == 0)) {
590 spurious_interrupt(regs);
591 return;
592 }
593 do_IRQ(irq, regs);
594 } else if (pending & STATUSF_IP0) /* user line 0 */
595 do_IRQ(TX4927_IRQ_USER0, regs);
596 else if (pending & STATUSF_IP1) /* user line 1 */
597 do_IRQ(TX4927_IRQ_USER1, regs);
598 else
599 spurious_interrupt(regs);
600}
diff --git a/arch/mips/tx4927/common/tx4927_irq_handler.S b/arch/mips/tx4927/common/tx4927_irq_handler.S
deleted file mode 100644
index dd3ceda9d712..000000000000
--- a/arch/mips/tx4927/common/tx4927_irq_handler.S
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * linux/arch/mips/tx4927/common/tx4927_irq_handler.S
3 *
4 * Primary interrupt handler for tx4927 based systems
5 *
6 * Author: MontaVista Software, Inc.
7 * Author: jsun@mvista.com or jsun@junsun.net
8 * source@mvista.com
9 *
10 * Copyright 2001-2002 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <asm/asm.h>
33#include <asm/mipsregs.h>
34#include <asm/addrspace.h>
35#include <asm/regdef.h>
36#include <asm/stackframe.h>
37#include <asm/tx4927/tx4927.h>
38
39 .align 5
40 NESTED(tx4927_irq_handler, PT_SIZE, sp)
41 SAVE_ALL
42 CLI
43 .set at
44
45 mfc0 t0, CP0_CAUSE
46 mfc0 t1, CP0_STATUS
47 and t0, t1
48
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_ip7
51
52 /* IP6..IP3 multiplexed -- do not use */
53
54 andi t1, t0, STATUSF_IP2 /* tx4927 pic */
55 bnez t1, ll_ip2
56
57 andi t1, t0, STATUSF_IP0 /* user line 0 */
58 bnez t1, ll_ip0
59
60 andi t1, t0, STATUSF_IP1 /* user line 1 */
61 bnez t1, ll_ip1
62
63 .set reorder
64
65 /* wrong alarm or masked ... */
66 j spurious_interrupt
67 nop
68 END(tx4927_irq_handler)
69
70 .align 5
71
72
73ll_ip7:
74 li a0, TX4927_IRQ_CPU_TIMER
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_ip2:
80 jal tx4927_irq_nested
81 nop
82 beqz v0, goto_spurious_interrupt
83 nop
84 move a0, v0
85 move a1, sp
86 jal do_IRQ
87 j ret_from_irq
88
89goto_spurious_interrupt:
90 j spurious_interrupt
91 nop
92
93ll_ip1:
94 li a0, TX4927_IRQ_USER1
95 move a1, sp
96 jal do_IRQ
97 j ret_from_irq
98
99ll_ip0:
100 li a0, TX4927_IRQ_USER0
101 move a1, sp
102 jal do_IRQ
103 j ret_from_irq
diff --git a/arch/mips/tx4938/common/Makefile b/arch/mips/tx4938/common/Makefile
index 74c95c5bcdbf..2033ae77f632 100644
--- a/arch/mips/tx4938/common/Makefile
+++ b/arch/mips/tx4938/common/Makefile
@@ -6,6 +6,6 @@
6# unless it's something special (ie not a .c file). 6# unless it's something special (ie not a .c file).
7# 7#
8 8
9obj-y += prom.o setup.o irq.o irq_handler.o rtc_rx5c348.o 9obj-y += prom.o setup.o irq.o rtc_rx5c348.o
10obj-$(CONFIG_KGDB) += dbgio.o 10obj-$(CONFIG_KGDB) += dbgio.o
11 11
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c
index 4f90d7faf634..873805178d8e 100644
--- a/arch/mips/tx4938/common/irq.c
+++ b/arch/mips/tx4938/common/irq.c
@@ -392,11 +392,8 @@ tx4938_irq_pic_end(unsigned int irq)
392void __init 392void __init
393tx4938_irq_init(void) 393tx4938_irq_init(void)
394{ 394{
395 extern asmlinkage void tx4938_irq_handler(void);
396
397 tx4938_irq_cp0_init(); 395 tx4938_irq_cp0_init();
398 tx4938_irq_pic_init(); 396 tx4938_irq_pic_init();
399 set_except_vector(0, tx4938_irq_handler);
400 397
401 return; 398 return;
402} 399}
@@ -422,3 +419,21 @@ tx4938_irq_nested(void)
422 wbflush(); 419 wbflush();
423 return (sw_irq); 420 return (sw_irq);
424} 421}
422
423asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
424{
425 unsigned int pending = read_c0_cause() & read_c0_status();
426
427 if (pending & STATUSF_IP7)
428 do_IRQ(TX4938_IRQ_CPU_TIMER, regs);
429 else if (pending & STATUSF_IP2) {
430 int irq = tx4938_irq_nested();
431 if (irq)
432 do_IRQ(irq, regs);
433 else
434 spurious_interrupt(regs);
435 } else if (pending & STATUSF_IP1)
436 do_IRQ(TX4938_IRQ_USER1, regs);
437 else if (pending & STATUSF_IP0)
438 do_IRQ(TX4938_IRQ_USER0, regs);
439}
diff --git a/arch/mips/tx4938/common/irq_handler.S b/arch/mips/tx4938/common/irq_handler.S
deleted file mode 100644
index 1b2f72bac42d..000000000000
--- a/arch/mips/tx4938/common/irq_handler.S
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * linux/arch/mips/tx4938/common/handler.S
3 *
4 * Primary interrupt handler for tx4938 based systems
5 * Copyright (C) 2000-2001 Toshiba Corporation
6 *
7 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 *
12 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
13 */
14#include <asm/asm.h>
15#include <asm/mipsregs.h>
16#include <asm/addrspace.h>
17#include <asm/regdef.h>
18#include <asm/stackframe.h>
19#include <asm/tx4938/rbtx4938.h>
20
21
22 .align 5
23 NESTED(tx4938_irq_handler, PT_SIZE, sp)
24 SAVE_ALL
25 CLI
26 .set at
27
28 mfc0 t0, CP0_CAUSE
29 mfc0 t1, CP0_STATUS
30 and t0, t1
31
32 andi t1, t0, STATUSF_IP7 /* cpu timer */
33 bnez t1, ll_ip7
34
35 /* IP6..IP3 multiplexed -- do not use */
36
37 andi t1, t0, STATUSF_IP2 /* tx4938 pic */
38 bnez t1, ll_ip2
39
40 andi t1, t0, STATUSF_IP1 /* user line 1 */
41 bnez t1, ll_ip1
42
43 andi t1, t0, STATUSF_IP0 /* user line 0 */
44 bnez t1, ll_ip0
45
46 .set reorder
47
48 nop
49 END(tx4938_irq_handler)
50
51 .align 5
52
53
54ll_ip7:
55 li a0, TX4938_IRQ_CPU_TIMER
56 move a1, sp
57 jal do_IRQ
58 j ret_from_irq
59
60
61ll_ip2:
62 jal tx4938_irq_nested
63 nop
64 beqz v0, goto_spurious_interrupt
65 nop
66 move a0, v0
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70
71goto_spurious_interrupt:
72 j ret_from_irq
73
74ll_ip1:
75 li a0, TX4938_IRQ_USER1
76 move a1, sp
77 jal do_IRQ
78 j ret_from_irq
79
80ll_ip0:
81 li a0, TX4938_IRQ_USER0
82 move a1, sp
83 jal do_IRQ
84 j ret_from_irq
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index a7add16c9aa4..055a2cdfc841 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -4,6 +4,8 @@ config CASIO_E55
4 select DMA_NONCOHERENT 4 select DMA_NONCOHERENT
5 select IRQ_CPU 5 select IRQ_CPU
6 select ISA 6 select ISA
7 select SYS_HAS_CPU_VR41XX
8 select SYS_SUPPORTS_32BIT_KERNEL
7 select SYS_SUPPORTS_LITTLE_ENDIAN 9 select SYS_SUPPORTS_LITTLE_ENDIAN
8 10
9config IBM_WORKPAD 11config IBM_WORKPAD
@@ -12,6 +14,8 @@ config IBM_WORKPAD
12 select DMA_NONCOHERENT 14 select DMA_NONCOHERENT
13 select IRQ_CPU 15 select IRQ_CPU
14 select ISA 16 select ISA
17 select SYS_HAS_CPU_VR41XX
18 select SYS_SUPPORTS_32BIT_KERNEL
15 select SYS_SUPPORTS_LITTLE_ENDIAN 19 select SYS_SUPPORTS_LITTLE_ENDIAN
16 20
17config NEC_CMBVR4133 21config NEC_CMBVR4133
@@ -21,6 +25,9 @@ config NEC_CMBVR4133
21 select DMA_NONCOHERENT 25 select DMA_NONCOHERENT
22 select IRQ_CPU 26 select IRQ_CPU
23 select HW_HAS_PCI 27 select HW_HAS_PCI
28 select SYS_HAS_CPU_VR41XX
29 select SYS_SUPPORTS_32BIT_KERNEL
30 select SYS_SUPPORTS_LITTLE_ENDIAN
24 31
25config ROCKHOPPER 32config ROCKHOPPER
26 bool "Support for Rockhopper baseboard" 33 bool "Support for Rockhopper baseboard"
@@ -34,6 +41,8 @@ config TANBAC_TB022X
34 select DMA_NONCOHERENT 41 select DMA_NONCOHERENT
35 select HW_HAS_PCI 42 select HW_HAS_PCI
36 select IRQ_CPU 43 select IRQ_CPU
44 select SYS_HAS_CPU_VR41XX
45 select SYS_SUPPORTS_32BIT_KERNEL
37 select SYS_SUPPORTS_LITTLE_ENDIAN 46 select SYS_SUPPORTS_LITTLE_ENDIAN
38 help 47 help
39 The TANBAC VR4131 multichip module(TB0225) and 48 The TANBAC VR4131 multichip module(TB0225) and
@@ -65,6 +74,8 @@ config VICTOR_MPC30X
65 select DMA_NONCOHERENT 74 select DMA_NONCOHERENT
66 select HW_HAS_PCI 75 select HW_HAS_PCI
67 select IRQ_CPU 76 select IRQ_CPU
77 select SYS_HAS_CPU_VR41XX
78 select SYS_SUPPORTS_32BIT_KERNEL
68 select SYS_SUPPORTS_LITTLE_ENDIAN 79 select SYS_SUPPORTS_LITTLE_ENDIAN
69 80
70config ZAO_CAPCELLA 81config ZAO_CAPCELLA
@@ -73,6 +84,8 @@ config ZAO_CAPCELLA
73 select DMA_NONCOHERENT 84 select DMA_NONCOHERENT
74 select HW_HAS_PCI 85 select HW_HAS_PCI
75 select IRQ_CPU 86 select IRQ_CPU
87 select SYS_HAS_CPU_VR41XX
88 select SYS_SUPPORTS_32BIT_KERNEL
76 select SYS_SUPPORTS_LITTLE_ENDIAN 89 select SYS_SUPPORTS_LITTLE_ENDIAN
77 90
78config PCI_VR41XX 91config PCI_VR41XX
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index 9096302a7ecc..aa373974c80f 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 icu.o init.o int-handler.o irq.o pmu.o type.o 5obj-y += bcu.o cmu.o icu.o init.o irq.o pmu.o type.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/int-handler.S b/arch/mips/vr41xx/common/int-handler.S
deleted file mode 100644
index 2b6043f16d09..000000000000
--- a/arch/mips/vr41xx/common/int-handler.S
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * FILE NAME
3 * arch/mips/vr41xx/common/int-handler.S
4 *
5 * BRIEF MODULE DESCRIPTION
6 * Interrupt dispatcher for the NEC VR4100 series.
7 *
8 * Author: Yoichi Yuasa
9 * yyuasa@mvista.com or source@mvista.com
10 *
11 * Copyright 2001 MontaVista Software Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33/*
34 * Changes:
35 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
36 * - New creation, NEC VR4100 series are supported.
37 *
38 * Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
39 * - Coped with INTASSIGN of NEC VR4133.
40 */
41#include <asm/asm.h>
42#include <asm/regdef.h>
43#include <asm/mipsregs.h>
44#include <asm/stackframe.h>
45
46 .text
47 .set noreorder
48
49 .align 5
50 NESTED(vr41xx_handle_interrupt, PT_SIZE, ra)
51 .set noat
52 SAVE_ALL
53 CLI
54 .set at
55 .set noreorder
56
57 /*
58 * Get the pending interrupts
59 */
60 mfc0 t0, CP0_CAUSE
61 mfc0 t1, CP0_STATUS
62 andi t0, 0xff00
63 and t0, t0, t1
64
65 andi t1, t0, CAUSEF_IP7 # MIPS timer interrupt
66 bnez t1, handle_irq
67 li a0, 7
68
69 andi t1, t0, 0x7800 # check for Int1-4
70 beqz t1, 1f
71
72 andi t1, t0, CAUSEF_IP3 # check for Int1
73 bnez t1, handle_int
74 li a0, 3
75
76 andi t1, t0, CAUSEF_IP4 # check for Int2
77 bnez t1, handle_int
78 li a0, 4
79
80 andi t1, t0, CAUSEF_IP5 # check for Int3
81 bnez t1, handle_int
82 li a0, 5
83
84 andi t1, t0, CAUSEF_IP6 # check for Int4
85 bnez t1, handle_int
86 li a0, 6
87
881:
89 andi t1, t0, CAUSEF_IP2 # check for Int0
90 bnez t1, handle_int
91 li a0, 2
92
93 andi t1, t0, CAUSEF_IP0 # check for IP0
94 bnez t1, handle_irq
95 li a0, 0
96
97 andi t1, t0, CAUSEF_IP1 # check for IP1
98 bnez t1, handle_irq
99 li a0, 1
100
101 j spurious_interrupt
102 nop
103
104handle_int:
105 jal irq_dispatch
106 move a1, sp
107 j ret_from_irq
108 nop
109
110handle_irq:
111 jal do_IRQ
112 move a1, sp
113 j ret_from_irq
114 END(vr41xx_handle_interrupt)
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 61aa264275ff..86796bb63c3c 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -59,7 +59,7 @@ int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)
59 59
60EXPORT_SYMBOL_GPL(cascade_irq); 60EXPORT_SYMBOL_GPL(cascade_irq);
61 61
62asmlinkage void irq_dispatch(unsigned int irq, struct pt_regs *regs) 62static void irq_dispatch(unsigned int irq, struct pt_regs *regs)
63{ 63{
64 irq_cascade_t *cascade; 64 irq_cascade_t *cascade;
65 irq_desc_t *desc; 65 irq_desc_t *desc;
@@ -84,11 +84,32 @@ asmlinkage void irq_dispatch(unsigned int irq, struct pt_regs *regs)
84 do_IRQ(irq, regs); 84 do_IRQ(irq, regs);
85} 85}
86 86
87extern asmlinkage void vr41xx_handle_interrupt(void); 87asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
88{
89 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
90
91 if (pending & CAUSEF_IP7)
92 do_IRQ(7, regs);
93 else if (pending & 0x7800) {
94 if (pending & CAUSEF_IP3)
95 irq_dispatch(3, regs);
96 else if (pending & CAUSEF_IP4)
97 irq_dispatch(4, regs);
98 else if (pending & CAUSEF_IP5)
99 irq_dispatch(5, regs);
100 else if (pending & CAUSEF_IP6)
101 irq_dispatch(6, regs);
102 } else if (pending & CAUSEF_IP2)
103 irq_dispatch(2, regs);
104 else if (pending & CAUSEF_IP0)
105 do_IRQ(0, regs);
106 else if (pending & CAUSEF_IP1)
107 do_IRQ(1, regs);
108 else
109 spurious_interrupt(regs);
110}
88 111
89void __init arch_init_irq(void) 112void __init arch_init_irq(void)
90{ 113{
91 mips_cpu_irq_init(MIPS_CPU_IRQ_BASE); 114 mips_cpu_irq_init(MIPS_CPU_IRQ_BASE);
92
93 set_except_vector(0, vr41xx_handle_interrupt);
94} 115}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 2fdf21989dc2..19f911c5dd58 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -177,6 +177,11 @@ config ARCH_DISCONTIGMEM_DEFAULT
177 def_bool y 177 def_bool y
178 depends on ARCH_DISCONTIGMEM_ENABLE 178 depends on ARCH_DISCONTIGMEM_ENABLE
179 179
180config NODES_SHIFT
181 int
182 default "3"
183 depends on NEED_MULTIPLE_NODES
184
180source "kernel/Kconfig.preempt" 185source "kernel/Kconfig.preempt"
181source "kernel/Kconfig.hz" 186source "kernel/Kconfig.hz"
182source "mm/Kconfig" 187source "mm/Kconfig"
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 47ca5c0a323b..fc107add627c 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -31,7 +31,6 @@
31 31
32#include <linux/string.h> 32#include <linux/string.h>
33EXPORT_SYMBOL(memset); 33EXPORT_SYMBOL(memset);
34EXPORT_SYMBOL(strpbrk);
35 34
36#include <asm/atomic.h> 35#include <asm/atomic.h>
37EXPORT_SYMBOL(__xchg8); 36EXPORT_SYMBOL(__xchg8);
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2cdc35ce8045..6729c98b66f9 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -366,6 +366,7 @@ config PPC_PMAC64
366 select U3_DART 366 select U3_DART
367 select MPIC_BROKEN_U3 367 select MPIC_BROKEN_U3
368 select GENERIC_TBSYNC 368 select GENERIC_TBSYNC
369 select PPC_970_NAP
369 default y 370 default y
370 371
371config PPC_PREP 372config PPC_PREP
@@ -383,6 +384,7 @@ config PPC_MAPLE
383 select MPIC_BROKEN_U3 384 select MPIC_BROKEN_U3
384 select GENERIC_TBSYNC 385 select GENERIC_TBSYNC
385 select PPC_UDBG_16550 386 select PPC_UDBG_16550
387 select PPC_970_NAP
386 default n 388 default n
387 help 389 help
388 This option enables support for the Maple 970FX Evaluation Board. 390 This option enables support for the Maple 970FX Evaluation Board.
@@ -457,6 +459,10 @@ config PPC_MPC106
457 bool 459 bool
458 default n 460 default n
459 461
462config PPC_970_NAP
463 bool
464 default n
465
460source "drivers/cpufreq/Kconfig" 466source "drivers/cpufreq/Kconfig"
461 467
462config CPU_FREQ_PMAC 468config CPU_FREQ_PMAC
@@ -649,6 +655,11 @@ config NUMA
649 depends on PPC64 655 depends on PPC64
650 default y if SMP && PPC_PSERIES 656 default y if SMP && PPC_PSERIES
651 657
658config NODES_SHIFT
659 int
660 default "4"
661 depends on NEED_MULTIPLE_NODES
662
652config ARCH_SELECT_MEMORY_MODEL 663config ARCH_SELECT_MEMORY_MODEL
653 def_bool y 664 def_bool y
654 depends on PPC64 665 depends on PPC64
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6ec84d37a337..ed5b26aa8be3 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -104,6 +104,10 @@ ifndef CONFIG_FSL_BOOKE
104CFLAGS += -mstring 104CFLAGS += -mstring
105endif 105endif
106 106
107ifeq ($(CONFIG_6xx),y)
108CFLAGS += -mcpu=powerpc
109endif
110
107cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge 111cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
108cpu-as-$(CONFIG_4xx) += -Wa,-m405 112cpu-as-$(CONFIG_4xx) += -Wa,-m405
109cpu-as-$(CONFIG_6xx) += -Wa,-maltivec 113cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 0cc0995b81b0..803858e86160 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
20 firmware.o sysfs.o 20 firmware.o sysfs.o
21obj-$(CONFIG_PPC64) += vdso64/ 21obj-$(CONFIG_PPC64) += vdso64/
22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
23obj-$(CONFIG_POWER4) += idle_power4.o 23obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
24obj-$(CONFIG_PPC_OF) += of_device.o prom_parse.o 24obj-$(CONFIG_PPC_OF) += of_device.o prom_parse.o
25procfs-$(CONFIG_PPC64) := proc_ppc64.o 25procfs-$(CONFIG_PPC64) := proc_ppc64.o
26obj-$(CONFIG_PROC_FS) += $(procfs-y) 26obj-$(CONFIG_PROC_FS) += $(procfs-y)
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 54b48f330051..8f85c5e8a55a 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -91,6 +91,7 @@ int main(void)
91#endif /* CONFIG_PPC64 */ 91#endif /* CONFIG_PPC64 */
92 92
93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
94 DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
94 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 95 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
95 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 96 DEFINE(TI_TASK, offsetof(struct thread_info, task));
96#ifdef CONFIG_PPC32 97#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index b3a979467225..8866fd26c6b9 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -128,37 +128,36 @@ transfer_to_handler:
128 stw r12,4(r11) 128 stw r12,4(r11)
129#endif 129#endif
130 b 3f 130 b 3f
131
1312: /* if from kernel, check interrupted DOZE/NAP mode and 1322: /* if from kernel, check interrupted DOZE/NAP mode and
132 * check for stack overflow 133 * check for stack overflow
133 */ 134 */
135 lwz r9,THREAD_INFO-THREAD(r12)
136 cmplw r1,r9 /* if r1 <= current->thread_info */
137 ble- stack_ovf /* then the kernel stack overflowed */
1385:
134#ifdef CONFIG_6xx 139#ifdef CONFIG_6xx
135 mfspr r11,SPRN_HID0 140 tophys(r9,r9) /* check local flags */
136 mtcr r11 141 lwz r12,TI_LOCAL_FLAGS(r9)
137BEGIN_FTR_SECTION 142 mtcrf 0x01,r12
138 bt- 8,4f /* Check DOZE */ 143 bt- 31-TLF_NAPPING,4f
139END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
140BEGIN_FTR_SECTION
141 bt- 9,4f /* Check NAP */
142END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
143#endif /* CONFIG_6xx */ 144#endif /* CONFIG_6xx */
144 .globl transfer_to_handler_cont 145 .globl transfer_to_handler_cont
145transfer_to_handler_cont: 146transfer_to_handler_cont:
146 lwz r11,THREAD_INFO-THREAD(r12)
147 cmplw r1,r11 /* if r1 <= current->thread_info */
148 ble- stack_ovf /* then the kernel stack overflowed */
1493: 1473:
150 mflr r9 148 mflr r9
151 lwz r11,0(r9) /* virtual address of handler */ 149 lwz r11,0(r9) /* virtual address of handler */
152 lwz r9,4(r9) /* where to go when done */ 150 lwz r9,4(r9) /* where to go when done */
153 FIX_SRR1(r10,r12)
154 mtspr SPRN_SRR0,r11 151 mtspr SPRN_SRR0,r11
155 mtspr SPRN_SRR1,r10 152 mtspr SPRN_SRR1,r10
156 mtlr r9 153 mtlr r9
157 SYNC 154 SYNC
158 RFI /* jump to handler, enable MMU */ 155 RFI /* jump to handler, enable MMU */
159 156
160#ifdef CONFIG_6xx 157#ifdef CONFIG_6xx
1614: b power_save_6xx_restore 1584: rlwinm r12,r12,0,~_TLF_NAPPING
159 stw r12,TI_LOCAL_FLAGS(r9)
160 b power_save_6xx_restore
162#endif 161#endif
163 162
164/* 163/*
@@ -167,10 +166,10 @@ transfer_to_handler_cont:
167 */ 166 */
168stack_ovf: 167stack_ovf:
169 /* sometimes we use a statically-allocated stack, which is OK. */ 168 /* sometimes we use a statically-allocated stack, which is OK. */
170 lis r11,_end@h 169 lis r12,_end@h
171 ori r11,r11,_end@l 170 ori r12,r12,_end@l
172 cmplw r1,r11 171 cmplw r1,r12
173 ble 3b /* r1 <= &_end is OK */ 172 ble 5b /* r1 <= &_end is OK */
174 SAVE_NVGPRS(r11) 173 SAVE_NVGPRS(r11)
175 addi r3,r1,STACK_FRAME_OVERHEAD 174 addi r3,r1,STACK_FRAME_OVERHEAD
176 lis r1,init_thread_union@ha 175 lis r1,init_thread_union@ha
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index a5ae04a57c78..b7d140430a41 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -376,11 +376,28 @@ label##_common: \
376 bl hdlr; \ 376 bl hdlr; \
377 b .ret_from_except 377 b .ret_from_except
378 378
379/*
380 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur
381 * in the idle task and therefore need the special idle handling.
382 */
383#define STD_EXCEPTION_COMMON_IDLE(trap, label, hdlr) \
384 .align 7; \
385 .globl label##_common; \
386label##_common: \
387 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
388 FINISH_NAP; \
389 DISABLE_INTS; \
390 bl .save_nvgprs; \
391 addi r3,r1,STACK_FRAME_OVERHEAD; \
392 bl hdlr; \
393 b .ret_from_except
394
379#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \ 395#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \
380 .align 7; \ 396 .align 7; \
381 .globl label##_common; \ 397 .globl label##_common; \
382label##_common: \ 398label##_common: \
383 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 399 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
400 FINISH_NAP; \
384 DISABLE_INTS; \ 401 DISABLE_INTS; \
385 bl .ppc64_runlatch_on; \ 402 bl .ppc64_runlatch_on; \
386 addi r3,r1,STACK_FRAME_OVERHEAD; \ 403 addi r3,r1,STACK_FRAME_OVERHEAD; \
@@ -388,6 +405,25 @@ label##_common: \
388 b .ret_from_except_lite 405 b .ret_from_except_lite
389 406
390/* 407/*
408 * When the idle code in power4_idle puts the CPU into NAP mode,
409 * it has to do so in a loop, and relies on the external interrupt
410 * and decrementer interrupt entry code to get it out of the loop.
411 * It sets the _TLF_NAPPING bit in current_thread_info()->local_flags
412 * to signal that it is in the loop and needs help to get out.
413 */
414#ifdef CONFIG_PPC_970_NAP
415#define FINISH_NAP \
416BEGIN_FTR_SECTION \
417 clrrdi r11,r1,THREAD_SHIFT; \
418 ld r9,TI_LOCAL_FLAGS(r11); \
419 andi. r10,r9,_TLF_NAPPING; \
420 bnel power4_fixup_nap; \
421END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
422#else
423#define FINISH_NAP
424#endif
425
426/*
391 * Start of pSeries system interrupt routines 427 * Start of pSeries system interrupt routines
392 */ 428 */
393 . = 0x100 429 . = 0x100
@@ -772,6 +808,7 @@ hardware_interrupt_iSeries_masked:
772 .globl machine_check_common 808 .globl machine_check_common
773machine_check_common: 809machine_check_common:
774 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) 810 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
811 FINISH_NAP
775 DISABLE_INTS 812 DISABLE_INTS
776 bl .save_nvgprs 813 bl .save_nvgprs
777 addi r3,r1,STACK_FRAME_OVERHEAD 814 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -783,7 +820,7 @@ machine_check_common:
783 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception) 820 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
784 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) 821 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
785 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception) 822 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
786 STD_EXCEPTION_COMMON(0xf00, performance_monitor, .performance_monitor_exception) 823 STD_EXCEPTION_COMMON_IDLE(0xf00, performance_monitor, .performance_monitor_exception)
787 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 824 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
788#ifdef CONFIG_ALTIVEC 825#ifdef CONFIG_ALTIVEC
789 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception) 826 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
@@ -1034,6 +1071,7 @@ unrecov_slb:
1034 .globl hardware_interrupt_entry 1071 .globl hardware_interrupt_entry
1035hardware_interrupt_common: 1072hardware_interrupt_common:
1036 EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) 1073 EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN)
1074 FINISH_NAP
1037hardware_interrupt_entry: 1075hardware_interrupt_entry:
1038 DISABLE_INTS 1076 DISABLE_INTS
1039 bl .ppc64_runlatch_on 1077 bl .ppc64_runlatch_on
@@ -1041,6 +1079,15 @@ hardware_interrupt_entry:
1041 bl .do_IRQ 1079 bl .do_IRQ
1042 b .ret_from_except_lite 1080 b .ret_from_except_lite
1043 1081
1082#ifdef CONFIG_PPC_970_NAP
1083power4_fixup_nap:
1084 andc r9,r9,r10
1085 std r9,TI_LOCAL_FLAGS(r11)
1086 ld r10,_LINK(r1) /* make idle task do the */
1087 std r10,_NIP(r1) /* equivalent of a blr */
1088 blr
1089#endif
1090
1044 .align 7 1091 .align 7
1045 .globl alignment_common 1092 .globl alignment_common
1046alignment_common: 1093alignment_common:
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index e9f321d74d85..d491052c8e0c 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -50,9 +50,9 @@ void cpu_idle(void)
50 50
51 set_thread_flag(TIF_POLLING_NRFLAG); 51 set_thread_flag(TIF_POLLING_NRFLAG);
52 while (1) { 52 while (1) {
53 ppc64_runlatch_off();
54
55 while (!need_resched() && !cpu_should_die()) { 53 while (!need_resched() && !cpu_should_die()) {
54 ppc64_runlatch_off();
55
56 if (ppc_md.power_save) { 56 if (ppc_md.power_save) {
57 clear_thread_flag(TIF_POLLING_NRFLAG); 57 clear_thread_flag(TIF_POLLING_NRFLAG);
58 /* 58 /*
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index 12a4efbaa08f..b45fa0e37212 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -22,8 +22,6 @@
22#include <asm/ppc_asm.h> 22#include <asm/ppc_asm.h>
23#include <asm/asm-offsets.h> 23#include <asm/asm-offsets.h>
24 24
25#undef DEBUG
26
27 .text 25 .text
28 26
29/* 27/*
@@ -109,12 +107,6 @@ BEGIN_FTR_SECTION
109 dcbf 0,r4 107 dcbf 0,r4
110 dcbf 0,r4 108 dcbf 0,r4
111END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR) 109END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
112#ifdef DEBUG
113 lis r6,nap_enter_count@ha
114 lwz r4,nap_enter_count@l(r6)
115 addi r4,r4,1
116 stw r4,nap_enter_count@l(r6)
117#endif
1182: 1102:
119BEGIN_FTR_SECTION 111BEGIN_FTR_SECTION
120 /* Go to low speed mode on some 750FX */ 112 /* Go to low speed mode on some 750FX */
@@ -144,48 +136,42 @@ BEGIN_FTR_SECTION
144 DSSALL 136 DSSALL
145 sync 137 sync
146END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 138END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
139 rlwinm r9,r1,0,0,31-THREAD_SHIFT /* current thread_info */
140 lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
141 ori r8,r8,_TLF_NAPPING /* so when we take an exception */
142 stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
147 mfmsr r7 143 mfmsr r7
148 ori r7,r7,MSR_EE 144 ori r7,r7,MSR_EE
149 oris r7,r7,MSR_POW@h 145 oris r7,r7,MSR_POW@h
150 sync 1461: sync
151 isync
152 mtmsr r7 147 mtmsr r7
153 isync 148 isync
154 sync 149 b 1b
155 blr 150
156
157/* 151/*
158 * Return from NAP/DOZE mode, restore some CPU specific registers, 152 * Return from NAP/DOZE mode, restore some CPU specific registers,
159 * we are called with DR/IR still off and r2 containing physical 153 * we are called with DR/IR still off and r2 containing physical
160 * address of current. 154 * address of current. R11 points to the exception frame (physical
155 * address). We have to preserve r10.
161 */ 156 */
162_GLOBAL(power_save_6xx_restore) 157_GLOBAL(power_save_6xx_restore)
163 mfspr r11,SPRN_HID0 158 lwz r9,_LINK(r11) /* interrupted in ppc6xx_idle: */
164 rlwinm. r11,r11,0,10,8 /* Clear NAP & copy NAP bit !state to cr1 EQ */ 159 stw r9,_NIP(r11) /* make it do a blr */
165 cror 4*cr1+eq,4*cr0+eq,4*cr0+eq
166BEGIN_FTR_SECTION
167 rlwinm r11,r11,0,9,7 /* Clear DOZE */
168END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
169 mtspr SPRN_HID0, r11
170 160
171#ifdef DEBUG 161#ifdef CONFIG_SMP
172 beq cr1,1f 162 mfspr r12,SPRN_SPRG3
173 lis r11,(nap_return_count-KERNELBASE)@ha 163 lwz r11,TI_CPU(r12) /* get cpu number * 4 */
174 lwz r9,nap_return_count@l(r11)
175 addi r9,r9,1
176 stw r9,nap_return_count@l(r11)
1771:
178#endif
179
180 rlwinm r9,r1,0,0,18
181 tophys(r9,r9)
182 lwz r11,TI_CPU(r9)
183 slwi r11,r11,2 164 slwi r11,r11,2
165#else
166 li r11,0
167#endif
184 /* Todo make sure all these are in the same page 168 /* Todo make sure all these are in the same page
185 * and load r22 (@ha part + CPU offset) only once 169 * and load r11 (@ha part + CPU offset) only once
186 */ 170 */
187BEGIN_FTR_SECTION 171BEGIN_FTR_SECTION
188 beq cr1,1f 172 mfspr r9,SPRN_HID0
173 andis. r9,r9,HID0_NAP@h
174 beq 1f
189 addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha 175 addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha
190 lwz r9,nap_save_msscr0@l(r9) 176 lwz r9,nap_save_msscr0@l(r9)
191 mtspr SPRN_MSSCR0, r9 177 mtspr SPRN_MSSCR0, r9
@@ -210,10 +196,3 @@ _GLOBAL(nap_save_hid1)
210 196
211_GLOBAL(powersave_lowspeed) 197_GLOBAL(powersave_lowspeed)
212 .long 0 198 .long 0
213
214#ifdef DEBUG
215_GLOBAL(nap_enter_count)
216 .space 4
217_GLOBAL(nap_return_count)
218 .space 4
219#endif
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 6dad1c02496e..d85c7c938eed 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -35,12 +35,16 @@ BEGIN_FTR_SECTION
35 DSSALL 35 DSSALL
36 sync 36 sync
37END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 37END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
38 clrrdi r9,r1,THREAD_SHIFT /* current thread_info */
39 ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
40 ori r8,r8,_TLF_NAPPING /* so when we take an exception */
41 std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
38 mfmsr r7 42 mfmsr r7
39 ori r7,r7,MSR_EE 43 ori r7,r7,MSR_EE
40 oris r7,r7,MSR_POW@h 44 oris r7,r7,MSR_POW@h
41 sync 451: sync
42 isync 46 isync
43 mtmsrd r7 47 mtmsrd r7
44 isync 48 isync
45 sync 49 b 1b
46 blr 50
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index bb5c9501234c..57d560c68897 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -272,18 +272,26 @@ unsigned int virt_irq_to_real_map[NR_IRQS];
272 * Don't use virtual irqs 0, 1, 2 for devices. 272 * Don't use virtual irqs 0, 1, 2 for devices.
273 * The pcnet32 driver considers interrupt numbers < 2 to be invalid, 273 * The pcnet32 driver considers interrupt numbers < 2 to be invalid,
274 * and 2 is the XICS IPI interrupt. 274 * and 2 is the XICS IPI interrupt.
275 * We limit virtual irqs to 17 less than NR_IRQS so that when we 275 * We limit virtual irqs to __irq_offet_value less than virt_irq_max so
276 * offset them by 16 (to reserve the first 16 for ISA interrupts) 276 * that when we offset them we don't end up with an interrupt
277 * we don't end up with an interrupt number >= NR_IRQS. 277 * number >= virt_irq_max.
278 */ 278 */
279#define MIN_VIRT_IRQ 3 279#define MIN_VIRT_IRQ 3
280#define MAX_VIRT_IRQ (NR_IRQS - NUM_ISA_INTERRUPTS - 1) 280
281#define NR_VIRT_IRQS (MAX_VIRT_IRQ - MIN_VIRT_IRQ + 1) 281unsigned int virt_irq_max;
282static unsigned int max_virt_irq;
283static unsigned int nr_virt_irqs;
282 284
283void 285void
284virt_irq_init(void) 286virt_irq_init(void)
285{ 287{
286 int i; 288 int i;
289
290 if ((virt_irq_max == 0) || (virt_irq_max > (NR_IRQS - 1)))
291 virt_irq_max = NR_IRQS - 1;
292 max_virt_irq = virt_irq_max - __irq_offset_value;
293 nr_virt_irqs = max_virt_irq - MIN_VIRT_IRQ + 1;
294
287 for (i = 0; i < NR_IRQS; i++) 295 for (i = 0; i < NR_IRQS; i++)
288 virt_irq_to_real_map[i] = UNDEFINED_IRQ; 296 virt_irq_to_real_map[i] = UNDEFINED_IRQ;
289} 297}
@@ -308,17 +316,17 @@ int virt_irq_create_mapping(unsigned int real_irq)
308 return real_irq; 316 return real_irq;
309 } 317 }
310 318
311 /* map to a number between MIN_VIRT_IRQ and MAX_VIRT_IRQ */ 319 /* map to a number between MIN_VIRT_IRQ and max_virt_irq */
312 virq = real_irq; 320 virq = real_irq;
313 if (virq > MAX_VIRT_IRQ) 321 if (virq > max_virt_irq)
314 virq = (virq % NR_VIRT_IRQS) + MIN_VIRT_IRQ; 322 virq = (virq % nr_virt_irqs) + MIN_VIRT_IRQ;
315 323
316 /* search for this number or a free slot */ 324 /* search for this number or a free slot */
317 first_virq = virq; 325 first_virq = virq;
318 while (virt_irq_to_real_map[virq] != UNDEFINED_IRQ) { 326 while (virt_irq_to_real_map[virq] != UNDEFINED_IRQ) {
319 if (virt_irq_to_real_map[virq] == real_irq) 327 if (virt_irq_to_real_map[virq] == real_irq)
320 return virq; 328 return virq;
321 if (++virq > MAX_VIRT_IRQ) 329 if (++virq > max_virt_irq)
322 virq = MIN_VIRT_IRQ; 330 virq = MIN_VIRT_IRQ;
323 if (virq == first_virq) 331 if (virq == first_virq)
324 goto nospace; /* oops, no free slots */ 332 goto nospace; /* oops, no free slots */
@@ -330,8 +338,8 @@ int virt_irq_create_mapping(unsigned int real_irq)
330 nospace: 338 nospace:
331 if (!warned) { 339 if (!warned) {
332 printk(KERN_CRIT "Interrupt table is full\n"); 340 printk(KERN_CRIT "Interrupt table is full\n");
333 printk(KERN_CRIT "Increase NR_IRQS (currently %d) " 341 printk(KERN_CRIT "Increase virt_irq_max (currently %d) "
334 "in your kernel sources and rebuild.\n", NR_IRQS); 342 "in your kernel sources and rebuild.\n", virt_irq_max);
335 warned = 1; 343 warned = 1;
336 } 344 }
337 return NO_IRQ; 345 return NO_IRQ;
@@ -349,8 +357,8 @@ unsigned int real_irq_to_virt_slowpath(unsigned int real_irq)
349 357
350 virq = real_irq; 358 virq = real_irq;
351 359
352 if (virq > MAX_VIRT_IRQ) 360 if (virq > max_virt_irq)
353 virq = (virq % NR_VIRT_IRQS) + MIN_VIRT_IRQ; 361 virq = (virq % nr_virt_irqs) + MIN_VIRT_IRQ;
354 362
355 first_virq = virq; 363 first_virq = virq;
356 364
@@ -360,7 +368,7 @@ unsigned int real_irq_to_virt_slowpath(unsigned int real_irq)
360 368
361 virq++; 369 virq++;
362 370
363 if (virq >= MAX_VIRT_IRQ) 371 if (virq >= max_virt_irq)
364 virq = 0; 372 virq = 0;
365 373
366 } while (first_virq != virq); 374 } while (first_virq != virq);
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index ad7a90212204..856ef1a832b9 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -88,7 +88,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
88 mutex_unlock(&kprobe_mutex); 88 mutex_unlock(&kprobe_mutex);
89} 89}
90 90
91static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 91static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
92{ 92{
93 kprobe_opcode_t insn = *p->ainsn.insn; 93 kprobe_opcode_t insn = *p->ainsn.insn;
94 94
@@ -101,21 +101,21 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
101 regs->nip = (unsigned long)p->ainsn.insn; 101 regs->nip = (unsigned long)p->ainsn.insn;
102} 102}
103 103
104static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 104static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
105{ 105{
106 kcb->prev_kprobe.kp = kprobe_running(); 106 kcb->prev_kprobe.kp = kprobe_running();
107 kcb->prev_kprobe.status = kcb->kprobe_status; 107 kcb->prev_kprobe.status = kcb->kprobe_status;
108 kcb->prev_kprobe.saved_msr = kcb->kprobe_saved_msr; 108 kcb->prev_kprobe.saved_msr = kcb->kprobe_saved_msr;
109} 109}
110 110
111static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) 111static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
112{ 112{
113 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 113 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
114 kcb->kprobe_status = kcb->prev_kprobe.status; 114 kcb->kprobe_status = kcb->prev_kprobe.status;
115 kcb->kprobe_saved_msr = kcb->prev_kprobe.saved_msr; 115 kcb->kprobe_saved_msr = kcb->prev_kprobe.saved_msr;
116} 116}
117 117
118static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, 118static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
119 struct kprobe_ctlblk *kcb) 119 struct kprobe_ctlblk *kcb)
120{ 120{
121 __get_cpu_var(current_kprobe) = p; 121 __get_cpu_var(current_kprobe) = p;
@@ -141,7 +141,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
141 } 141 }
142} 142}
143 143
144static inline int kprobe_handler(struct pt_regs *regs) 144static int __kprobes kprobe_handler(struct pt_regs *regs)
145{ 145{
146 struct kprobe *p; 146 struct kprobe *p;
147 int ret = 0; 147 int ret = 0;
@@ -334,7 +334,7 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
334 regs->nip = (unsigned long)p->addr + 4; 334 regs->nip = (unsigned long)p->addr + 4;
335} 335}
336 336
337static inline int post_kprobe_handler(struct pt_regs *regs) 337static int __kprobes post_kprobe_handler(struct pt_regs *regs)
338{ 338{
339 struct kprobe *cur = kprobe_running(); 339 struct kprobe *cur = kprobe_running();
340 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 340 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -370,7 +370,7 @@ out:
370 return 1; 370 return 1;
371} 371}
372 372
373static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 373static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
374{ 374{
375 struct kprobe *cur = kprobe_running(); 375 struct kprobe *cur = kprobe_running();
376 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 376 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index d66c5e77fcff..7e4d54821a07 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1528,12 +1528,11 @@ static int __init prom_find_machine_type(void)
1528 * non-IBM designs ! 1528 * non-IBM designs !
1529 * - it has /rtas 1529 * - it has /rtas
1530 */ 1530 */
1531 len = prom_getprop(_prom->root, "model", 1531 len = prom_getprop(_prom->root, "device_type",
1532 compat, sizeof(compat)-1); 1532 compat, sizeof(compat)-1);
1533 if (len <= 0) 1533 if (len <= 0)
1534 return PLATFORM_GENERIC; 1534 return PLATFORM_GENERIC;
1535 compat[len] = 0; 1535 if (strncmp(compat, RELOC("chrp"), 4))
1536 if (strcmp(compat, "chrp"))
1537 return PLATFORM_GENERIC; 1536 return PLATFORM_GENERIC;
1538 1537
1539 /* Default to pSeries. We need to know if we are running LPAR */ 1538 /* Default to pSeries. We need to know if we are running LPAR */
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 456286cf1d14..9c9ad1fa9cce 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -258,11 +258,11 @@ static int __init proc_rtas_init(void)
258 struct proc_dir_entry *entry; 258 struct proc_dir_entry *entry;
259 259
260 if (!machine_is(pseries)) 260 if (!machine_is(pseries))
261 return 1; 261 return -ENODEV;
262 262
263 rtas_node = of_find_node_by_name(NULL, "rtas"); 263 rtas_node = of_find_node_by_name(NULL, "rtas");
264 if (rtas_node == NULL) 264 if (rtas_node == NULL)
265 return 1; 265 return -ENODEV;
266 266
267 entry = create_proc_entry("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL); 267 entry = create_proc_entry("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL);
268 if (entry) 268 if (entry)
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 1424eab450ee..a14c96403840 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -323,3 +323,4 @@ COMPAT_SYS(pselect6)
323COMPAT_SYS(ppoll) 323COMPAT_SYS(ppoll)
324SYSCALL(unshare) 324SYSCALL(unshare)
325SYSCALL(splice) 325SYSCALL(splice)
326SYSCALL(tee)
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 97898d5d34e5..1726bfe38ee0 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -1297,7 +1297,7 @@ static inline void setup_decr(struct spu_state *csa, struct spu *spu)
1297 cycles_t resume_time = get_cycles(); 1297 cycles_t resume_time = get_cycles();
1298 cycles_t delta_time = resume_time - csa->suspend_time; 1298 cycles_t delta_time = resume_time - csa->suspend_time;
1299 1299
1300 csa->lscsa->decr.slot[0] = delta_time; 1300 csa->lscsa->decr.slot[0] -= delta_time;
1301 } 1301 }
1302} 1302}
1303 1303
diff --git a/arch/powerpc/platforms/chrp/chrp.h b/arch/powerpc/platforms/chrp/chrp.h
index 63f0aee4c158..996c28744e96 100644
--- a/arch/powerpc/platforms/chrp/chrp.h
+++ b/arch/powerpc/platforms/chrp/chrp.h
@@ -9,3 +9,4 @@ extern long chrp_time_init(void);
9 9
10extern void chrp_find_bridges(void); 10extern void chrp_find_bridges(void);
11extern void chrp_event_scan(unsigned long); 11extern void chrp_event_scan(unsigned long);
12extern void chrp_pcibios_fixup(void);
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 8ef279ad36ad..ac224876ce59 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -23,6 +23,8 @@
23#include <asm/grackle.h> 23#include <asm/grackle.h>
24#include <asm/rtas.h> 24#include <asm/rtas.h>
25 25
26#include "chrp.h"
27
26/* LongTrail */ 28/* LongTrail */
27void __iomem *gg2_pci_config_base; 29void __iomem *gg2_pci_config_base;
28 30
@@ -314,6 +316,6 @@ chrp_find_bridges(void)
314 } 316 }
315 317
316 /* Do not fixup interrupts from OF tree on pegasos */ 318 /* Do not fixup interrupts from OF tree on pegasos */
317 if (is_pegasos == 0) 319 if (is_pegasos)
318 ppc_md.pcibios_fixup = chrp_pcibios_fixup; 320 ppc_md.pcibios_fixup = NULL;
319} 321}
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 23a201718704..18d89f38796b 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -440,8 +440,6 @@ void __init chrp_init_IRQ(void)
440 440
441 if (_chrp_type == _CHRP_Pegasos) 441 if (_chrp_type == _CHRP_Pegasos)
442 ppc_md.get_irq = i8259_irq; 442 ppc_md.get_irq = i8259_irq;
443 else
444 ppc_md.get_irq = mpic_get_irq;
445 443
446#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 444#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
447 /* see if there is a keyboard in the device tree 445 /* see if there is a keyboard in the device tree
@@ -528,26 +526,24 @@ static int __init chrp_probe(void)
528 /* Assume we have an 8259... */ 526 /* Assume we have an 8259... */
529 __irq_offset_value = NUM_ISA_INTERRUPTS; 527 __irq_offset_value = NUM_ISA_INTERRUPTS;
530 528
531 ppc_md.setup_arch = chrp_setup_arch; 529 return 1;
532 ppc_md.show_cpuinfo = chrp_show_cpuinfo;
533
534 ppc_md.init_IRQ = chrp_init_IRQ;
535 ppc_md.init = chrp_init2;
536
537 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
538
539 ppc_md.restart = rtas_restart;
540 ppc_md.power_off = rtas_power_off;
541 ppc_md.halt = rtas_halt;
542
543 ppc_md.time_init = chrp_time_init;
544 ppc_md.calibrate_decr = generic_calibrate_decr;
545
546 /* this may get overridden with rtas routines later... */
547 ppc_md.set_rtc_time = chrp_set_rtc_time;
548 ppc_md.get_rtc_time = chrp_get_rtc_time;
549
550#ifdef CONFIG_SMP
551 smp_ops = &chrp_smp_ops;
552#endif /* CONFIG_SMP */
553} 530}
531
532define_machine(chrp) {
533 .name = "CHRP",
534 .probe = chrp_probe,
535 .setup_arch = chrp_setup_arch,
536 .init = chrp_init2,
537 .show_cpuinfo = chrp_show_cpuinfo,
538 .init_IRQ = chrp_init_IRQ,
539 .get_irq = mpic_get_irq,
540 .pcibios_fixup = chrp_pcibios_fixup,
541 .restart = rtas_restart,
542 .power_off = rtas_power_off,
543 .halt = rtas_halt,
544 .time_init = chrp_time_init,
545 .set_rtc_time = chrp_set_rtc_time,
546 .get_rtc_time = chrp_get_rtc_time,
547 .calibrate_decr = generic_calibrate_decr,
548 .phys_mem_access_prot = pci_phys_mem_access_prot,
549};
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 6ce8a404ba6b..a6fd9bedb074 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -54,6 +54,7 @@
54#include <asm/iseries/hv_lp_event.h> 54#include <asm/iseries/hv_lp_event.h>
55#include <asm/iseries/lpar_map.h> 55#include <asm/iseries/lpar_map.h>
56#include <asm/udbg.h> 56#include <asm/udbg.h>
57#include <asm/irq.h>
57 58
58#include "naca.h" 59#include "naca.h"
59#include "setup.h" 60#include "setup.h"
@@ -684,6 +685,12 @@ static int __init iseries_probe(void)
684 powerpc_firmware_features |= FW_FEATURE_ISERIES; 685 powerpc_firmware_features |= FW_FEATURE_ISERIES;
685 powerpc_firmware_features |= FW_FEATURE_LPAR; 686 powerpc_firmware_features |= FW_FEATURE_LPAR;
686 687
688 /*
689 * The Hypervisor only allows us up to 256 interrupt
690 * sources (the irq number is passed in a u8).
691 */
692 virt_irq_max = 255;
693
687 return 1; 694 return 1;
688} 695}
689 696
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 780fb27a0099..32eaddfa5470 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -957,8 +957,10 @@ static void eeh_remove_device(struct pci_dev *dev)
957 pci_addr_cache_remove_device(dev); 957 pci_addr_cache_remove_device(dev);
958 958
959 dn = pci_device_to_OF_node(dev); 959 dn = pci_device_to_OF_node(dev);
960 PCI_DN(dn)->pcidev = NULL; 960 if (PCI_DN(dn)->pcidev) {
961 pci_dev_put (dev); 961 PCI_DN(dn)->pcidev = NULL;
962 pci_dev_put (dev);
963 }
962} 964}
963 965
964void eeh_remove_bus_device(struct pci_dev *dev) 966void eeh_remove_bus_device(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index fcc4d561a236..e0000ce769e5 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -488,7 +488,7 @@ static int __init rtas_init(void)
488 /* No RTAS */ 488 /* No RTAS */
489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) { 489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
490 printk(KERN_INFO "rtasd: no event-scan on system\n"); 490 printk(KERN_INFO "rtasd: no event-scan on system\n");
491 return 1; 491 return -ENODEV;
492 } 492 }
493 493
494 entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL); 494 entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL);
diff --git a/arch/ppc/boot/lib/Makefile b/arch/ppc/boot/lib/Makefile
index d4077e69086f..80c84d562fa4 100644
--- a/arch/ppc/boot/lib/Makefile
+++ b/arch/ppc/boot/lib/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5CFLAGS_kbd.o := -Idrivers/char 5CFLAGS_kbd.o := -Idrivers/char
6CFLAGS_vreset.o := -I$(srctree)/arch/ppc/boot/include 6CFLAGS_vreset.o := -Iarch/ppc/boot/include
7 7
8zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 8zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
9 9
diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
index 60c724e11584..7662c4e6e7d6 100644
--- a/arch/ppc/syslib/ppc_sys.c
+++ b/arch/ppc/syslib/ppc_sys.c
@@ -156,12 +156,13 @@ void platform_notify_map(const struct platform_notify_dev_map *map,
156 while (map->bus_id != NULL) { 156 while (map->bus_id != NULL) {
157 idx = -1; 157 idx = -1;
158 s = strrchr(dev->bus_id, '.'); 158 s = strrchr(dev->bus_id, '.');
159 if (s != NULL) 159 if (s != NULL) {
160 idx = (int)simple_strtol(s + 1, NULL, 10); 160 idx = (int)simple_strtol(s + 1, NULL, 10);
161 else 161 len = s - dev->bus_id;
162 } else {
162 s = dev->bus_id; 163 s = dev->bus_id;
163 164 len = strlen(dev->bus_id);
164 len = s - dev->bus_id; 165 }
165 166
166 if (!strncmp(dev->bus_id, map->bus_id, len)) { 167 if (!strncmp(dev->bus_id, map->bus_id, len)) {
167 pdev = container_of(dev, struct platform_device, dev); 168 pdev = container_of(dev, struct platform_device, dev);
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 6c6b197898d0..7bb16fb97d4f 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -67,7 +67,6 @@ cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE)
67endif 67endif
68 68
69CFLAGS += -mbackchain -msoft-float $(cflags-y) 69CFLAGS += -mbackchain -msoft-float $(cflags-y)
70CFLAGS += $(call cc-option,-finline-limit=10000)
71CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare 70CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
72AFLAGS += $(aflags-y) 71AFLAGS += $(aflags-y)
73 72
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index f8d0cd540a06..f4dfc10026d2 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,10 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc2 3# Linux kernel version: 2.6.17-rc1
4# Wed Feb 8 10:44:39 2006 4# Mon Apr 3 14:34:15 2006
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y 7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
8CONFIG_GENERIC_HWEIGHT=y
8CONFIG_GENERIC_CALIBRATE_DELAY=y 9CONFIG_GENERIC_CALIBRATE_DELAY=y
9CONFIG_S390=y 10CONFIG_S390=y
10 11
@@ -30,8 +31,8 @@ CONFIG_AUDIT=y
30CONFIG_IKCONFIG=y 31CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y 32CONFIG_IKCONFIG_PROC=y
32# CONFIG_CPUSETS is not set 33# CONFIG_CPUSETS is not set
34# CONFIG_RELAY is not set
33CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
34CONFIG_UID16=y
35# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
36# CONFIG_EMBEDDED is not set 37# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
@@ -45,10 +46,6 @@ CONFIG_BASE_FULL=y
45CONFIG_FUTEX=y 46CONFIG_FUTEX=y
46CONFIG_EPOLL=y 47CONFIG_EPOLL=y
47CONFIG_SHMEM=y 48CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52CONFIG_SLAB=y 49CONFIG_SLAB=y
53# CONFIG_TINY_SHMEM is not set 50# CONFIG_TINY_SHMEM is not set
54CONFIG_BASE_SMALL=0 51CONFIG_BASE_SMALL=0
@@ -60,7 +57,6 @@ CONFIG_BASE_SMALL=0
60CONFIG_MODULES=y 57CONFIG_MODULES=y
61CONFIG_MODULE_UNLOAD=y 58CONFIG_MODULE_UNLOAD=y
62# CONFIG_MODULE_FORCE_UNLOAD is not set 59# CONFIG_MODULE_FORCE_UNLOAD is not set
63CONFIG_OBSOLETE_MODPARM=y
64CONFIG_MODVERSIONS=y 60CONFIG_MODVERSIONS=y
65# CONFIG_MODULE_SRCVERSION_ALL is not set 61# CONFIG_MODULE_SRCVERSION_ALL is not set
66CONFIG_KMOD=y 62CONFIG_KMOD=y
@@ -69,7 +65,7 @@ CONFIG_STOP_MACHINE=y
69# 65#
70# Block layer 66# Block layer
71# 67#
72# CONFIG_LBD is not set 68# CONFIG_BLK_DEV_IO_TRACE is not set
73 69
74# 70#
75# IO Schedulers 71# IO Schedulers
@@ -91,17 +87,20 @@ CONFIG_DEFAULT_IOSCHED="deadline"
91# 87#
92# Processor type and features 88# Processor type and features
93# 89#
94# CONFIG_64BIT is not set 90CONFIG_64BIT=y
95CONFIG_SMP=y 91CONFIG_SMP=y
96CONFIG_NR_CPUS=32 92CONFIG_NR_CPUS=32
97CONFIG_HOTPLUG_CPU=y 93CONFIG_HOTPLUG_CPU=y
98CONFIG_MATHEMU=y 94CONFIG_DEFAULT_MIGRATION_COST=1000000
95CONFIG_COMPAT=y
96CONFIG_SYSVIPC_COMPAT=y
97CONFIG_BINFMT_ELF32=y
99 98
100# 99#
101# Code generation options 100# Code generation options
102# 101#
103CONFIG_MARCH_G5=y 102# CONFIG_MARCH_G5 is not set
104# CONFIG_MARCH_Z900 is not set 103CONFIG_MARCH_Z900=y
105# CONFIG_MARCH_Z990 is not set 104# CONFIG_MARCH_Z990 is not set
106CONFIG_PACK_STACK=y 105CONFIG_PACK_STACK=y
107# CONFIG_SMALL_STACK is not set 106# CONFIG_SMALL_STACK is not set
@@ -143,7 +142,7 @@ CONFIG_VIRT_CPU_ACCOUNTING=y
143# CONFIG_APPLDATA_BASE is not set 142# CONFIG_APPLDATA_BASE is not set
144CONFIG_NO_IDLE_HZ=y 143CONFIG_NO_IDLE_HZ=y
145CONFIG_NO_IDLE_HZ_INIT=y 144CONFIG_NO_IDLE_HZ_INIT=y
146# CONFIG_KEXEC is not set 145CONFIG_KEXEC=y
147 146
148# 147#
149# Networking 148# Networking
@@ -173,6 +172,7 @@ CONFIG_IP_FIB_HASH=y
173# CONFIG_INET_AH is not set 172# CONFIG_INET_AH is not set
174# CONFIG_INET_ESP is not set 173# CONFIG_INET_ESP is not set
175# CONFIG_INET_IPCOMP is not set 174# CONFIG_INET_IPCOMP is not set
175# CONFIG_INET_XFRM_TUNNEL is not set
176# CONFIG_INET_TUNNEL is not set 176# CONFIG_INET_TUNNEL is not set
177CONFIG_INET_DIAG=y 177CONFIG_INET_DIAG=y
178CONFIG_INET_TCP_DIAG=y 178CONFIG_INET_TCP_DIAG=y
@@ -180,9 +180,11 @@ CONFIG_INET_TCP_DIAG=y
180CONFIG_TCP_CONG_BIC=y 180CONFIG_TCP_CONG_BIC=y
181CONFIG_IPV6=y 181CONFIG_IPV6=y
182# CONFIG_IPV6_PRIVACY is not set 182# CONFIG_IPV6_PRIVACY is not set
183# CONFIG_IPV6_ROUTER_PREF is not set
183# CONFIG_INET6_AH is not set 184# CONFIG_INET6_AH is not set
184# CONFIG_INET6_ESP is not set 185# CONFIG_INET6_ESP is not set
185# CONFIG_INET6_IPCOMP is not set 186# CONFIG_INET6_IPCOMP is not set
187# CONFIG_INET6_XFRM_TUNNEL is not set
186# CONFIG_INET6_TUNNEL is not set 188# CONFIG_INET6_TUNNEL is not set
187# CONFIG_IPV6_TUNNEL is not set 189# CONFIG_IPV6_TUNNEL is not set
188# CONFIG_NETFILTER is not set 190# CONFIG_NETFILTER is not set
@@ -276,6 +278,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
276# CONFIG_DEBUG_DRIVER is not set 278# CONFIG_DEBUG_DRIVER is not set
277 279
278# 280#
281# Connector - unified userspace <-> kernelspace linker
282#
283# CONFIG_CONNECTOR is not set
284
285#
279# SCSI device support 286# SCSI device support
280# 287#
281# CONFIG_RAID_ATTRS is not set 288# CONFIG_RAID_ATTRS is not set
@@ -340,8 +347,7 @@ CONFIG_DASD_PROFILE=y
340CONFIG_DASD_ECKD=y 347CONFIG_DASD_ECKD=y
341CONFIG_DASD_FBA=y 348CONFIG_DASD_FBA=y
342CONFIG_DASD_DIAG=y 349CONFIG_DASD_DIAG=y
343CONFIG_DASD_EER=m 350CONFIG_DASD_EER=y
344# CONFIG_DASD_CMB is not set
345# CONFIG_ATA_OVER_ETH is not set 351# CONFIG_ATA_OVER_ETH is not set
346 352
347# 353#
@@ -354,6 +360,7 @@ CONFIG_MD_RAID0=m
354CONFIG_MD_RAID1=m 360CONFIG_MD_RAID1=m
355# CONFIG_MD_RAID10 is not set 361# CONFIG_MD_RAID10 is not set
356CONFIG_MD_RAID5=m 362CONFIG_MD_RAID5=m
363# CONFIG_MD_RAID5_RESHAPE is not set
357# CONFIG_MD_RAID6 is not set 364# CONFIG_MD_RAID6 is not set
358CONFIG_MD_MULTIPATH=m 365CONFIG_MD_MULTIPATH=m
359# CONFIG_MD_FAULTY is not set 366# CONFIG_MD_FAULTY is not set
@@ -404,6 +411,7 @@ CONFIG_S390_TAPE_BLOCK=y
404# S/390 tape hardware support 411# S/390 tape hardware support
405# 412#
406CONFIG_S390_TAPE_34XX=m 413CONFIG_S390_TAPE_34XX=m
414# CONFIG_S390_TAPE_3590 is not set
407# CONFIG_VMLOGRDR is not set 415# CONFIG_VMLOGRDR is not set
408# CONFIG_VMCP is not set 416# CONFIG_VMCP is not set
409# CONFIG_MONREADER is not set 417# CONFIG_MONREADER is not set
@@ -529,7 +537,6 @@ CONFIG_SYSFS=y
529CONFIG_TMPFS=y 537CONFIG_TMPFS=y
530# CONFIG_HUGETLB_PAGE is not set 538# CONFIG_HUGETLB_PAGE is not set
531CONFIG_RAMFS=y 539CONFIG_RAMFS=y
532# CONFIG_RELAYFS_FS is not set
533# CONFIG_CONFIGFS_FS is not set 540# CONFIG_CONFIGFS_FS is not set
534 541
535# 542#
@@ -619,14 +626,15 @@ CONFIG_LOG_BUF_SHIFT=17
619# CONFIG_DETECT_SOFTLOCKUP is not set 626# CONFIG_DETECT_SOFTLOCKUP is not set
620# CONFIG_SCHEDSTATS is not set 627# CONFIG_SCHEDSTATS is not set
621# CONFIG_DEBUG_SLAB is not set 628# CONFIG_DEBUG_SLAB is not set
622# CONFIG_DEBUG_PREEMPT is not set 629CONFIG_DEBUG_PREEMPT=y
623CONFIG_DEBUG_MUTEXES=y 630CONFIG_DEBUG_MUTEXES=y
624# CONFIG_DEBUG_SPINLOCK is not set 631CONFIG_DEBUG_SPINLOCK=y
625# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 632CONFIG_DEBUG_SPINLOCK_SLEEP=y
626# CONFIG_DEBUG_KOBJECT is not set 633# CONFIG_DEBUG_KOBJECT is not set
627# CONFIG_DEBUG_INFO is not set 634# CONFIG_DEBUG_INFO is not set
628CONFIG_DEBUG_FS=y 635CONFIG_DEBUG_FS=y
629# CONFIG_DEBUG_VM is not set 636# CONFIG_DEBUG_VM is not set
637# CONFIG_UNWIND_INFO is not set
630CONFIG_FORCED_INLINING=y 638CONFIG_FORCED_INLINING=y
631# CONFIG_RCU_TORTURE_TEST is not set 639# CONFIG_RCU_TORTURE_TEST is not set
632 640
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 58583f459471..2bcecf422573 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -527,6 +527,11 @@ config CPU_HAS_SR_RB
527 See <file:Documentation/sh/register-banks.txt> for further 527 See <file:Documentation/sh/register-banks.txt> for further
528 information on SR.RB and register banking in the kernel in general. 528 information on SR.RB and register banking in the kernel in general.
529 529
530config NODES_SHIFT
531 int
532 default "1"
533 depends on NEED_MULTIPLE_NODES
534
530endmenu 535endmenu
531 536
532menu "Boot options" 537menu "Boot options"
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index 1cf94a618be3..d5d032533a8b 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -37,7 +37,6 @@ EXPORT_SYMBOL(disable_irq_nosync);
37EXPORT_SYMBOL(irq_desc); 37EXPORT_SYMBOL(irq_desc);
38EXPORT_SYMBOL(no_irq_type); 38EXPORT_SYMBOL(no_irq_type);
39 39
40EXPORT_SYMBOL(strpbrk);
41EXPORT_SYMBOL(strstr); 40EXPORT_SYMBOL(strstr);
42EXPORT_SYMBOL(strlen); 41EXPORT_SYMBOL(strlen);
43EXPORT_SYMBOL(strnlen); 42EXPORT_SYMBOL(strnlen);
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
index de29c45f23a7..6f3a1c946339 100644
--- a/arch/sh64/kernel/sh_ksyms.c
+++ b/arch/sh64/kernel/sh_ksyms.c
@@ -41,7 +41,6 @@ EXPORT_SYMBOL(kernel_thread);
41/* Networking helper routines. */ 41/* Networking helper routines. */
42EXPORT_SYMBOL(csum_partial_copy); 42EXPORT_SYMBOL(csum_partial_copy);
43 43
44EXPORT_SYMBOL(strpbrk);
45EXPORT_SYMBOL(strstr); 44EXPORT_SYMBOL(strstr);
46 45
47#ifdef CONFIG_VT 46#ifdef CONFIG_VT
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c
index 2be812115197..a93f5da6855d 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp.c
@@ -244,7 +244,7 @@ int setup_profiling_timer(unsigned int multiplier)
244 return -EINVAL; 244 return -EINVAL;
245 245
246 spin_lock_irqsave(&prof_setup_lock, flags); 246 spin_lock_irqsave(&prof_setup_lock, flags);
247 for_each_cpu(i) { 247 for_each_possible_cpu(i) {
248 load_profile_irq(i, lvl14_resolution / multiplier); 248 load_profile_irq(i, lvl14_resolution / multiplier);
249 prof_multiplier(i) = multiplier; 249 prof_multiplier(i) = multiplier;
250 } 250 }
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 2c21d7907635..ec1c9687d679 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -263,7 +263,6 @@ EXPORT_SYMBOL(strcmp);
263EXPORT_SYMBOL(strncmp); 263EXPORT_SYMBOL(strncmp);
264EXPORT_SYMBOL(strchr); 264EXPORT_SYMBOL(strchr);
265EXPORT_SYMBOL(strrchr); 265EXPORT_SYMBOL(strrchr);
266EXPORT_SYMBOL(strpbrk);
267EXPORT_SYMBOL(strstr); 266EXPORT_SYMBOL(strstr);
268EXPORT_SYMBOL(page_kernel); 267EXPORT_SYMBOL(page_kernel);
269 268
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index fbbec5e761c6..db8faa75f94d 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -75,7 +75,7 @@ sys_call_table:
75/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 75/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 78/*280*/ .long sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
diff --git a/arch/sparc/math-emu/Makefile b/arch/sparc/math-emu/Makefile
index f84a9a6162be..8136987977f4 100644
--- a/arch/sparc/math-emu/Makefile
+++ b/arch/sparc/math-emu/Makefile
@@ -5,4 +5,4 @@
5obj-y := math.o 5obj-y := math.o
6 6
7EXTRA_AFLAGS := -ansi 7EXTRA_AFLAGS := -ansi
8EXTRA_CFLAGS = -I. -I$(TOPDIR)/include/math-emu -w 8EXTRA_CFLAGS = -I. -Iinclude/math-emu -w
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index d1e2fc566486..43a66f5407f4 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -187,13 +187,16 @@ config HUGETLB_PAGE_SIZE_512K
187 bool "512K" 187 bool "512K"
188 188
189config HUGETLB_PAGE_SIZE_64K 189config HUGETLB_PAGE_SIZE_64K
190 depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB && !SPARC64_PAGE_SIZE_64K 190 depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB && !SPARC64_PAGE_SIZE_64KB
191 bool "64K" 191 bool "64K"
192 192
193endchoice 193endchoice
194 194
195endmenu 195endmenu
196 196
197config ARCH_SELECT_MEMORY_MODEL
198 def_bool y
199
197config ARCH_SPARSEMEM_ENABLE 200config ARCH_SPARSEMEM_ENABLE
198 def_bool y 201 def_bool y
199 202
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 30389085a359..1317380fa937 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/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.16 3# Linux kernel version: 2.6.16
4# Fri Mar 31 01:40:57 2006 4# Sun Apr 2 19:31:04 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -838,7 +838,6 @@ CONFIG_FB_TILEBLITTING=y
838# CONFIG_FB_NVIDIA is not set 838# CONFIG_FB_NVIDIA is not set
839# CONFIG_FB_RIVA is not set 839# CONFIG_FB_RIVA is not set
840# CONFIG_FB_MATROX is not set 840# CONFIG_FB_MATROX is not set
841# CONFIG_FB_RADEON_OLD is not set
842CONFIG_FB_RADEON=y 841CONFIG_FB_RADEON=y
843CONFIG_FB_RADEON_I2C=y 842CONFIG_FB_RADEON_I2C=y
844# CONFIG_FB_RADEON_DEBUG is not set 843# CONFIG_FB_RADEON_DEBUG is not set
@@ -924,6 +923,7 @@ CONFIG_SND_MTPAV=m
924# PCI devices 923# PCI devices
925# 924#
926# CONFIG_SND_AD1889 is not set 925# CONFIG_SND_AD1889 is not set
926# CONFIG_SND_ALS300 is not set
927CONFIG_SND_ALI5451=m 927CONFIG_SND_ALI5451=m
928# CONFIG_SND_ATIIXP is not set 928# CONFIG_SND_ATIIXP is not set
929# CONFIG_SND_ATIIXP_MODEM is not set 929# CONFIG_SND_ATIIXP_MODEM is not set
@@ -955,6 +955,7 @@ CONFIG_SND_ALI5451=m
955# CONFIG_SND_MIXART is not set 955# CONFIG_SND_MIXART is not set
956# CONFIG_SND_NM256 is not set 956# CONFIG_SND_NM256 is not set
957# CONFIG_SND_PCXHR is not set 957# CONFIG_SND_PCXHR is not set
958# CONFIG_SND_RIPTIDE is not set
958# CONFIG_SND_RME32 is not set 959# CONFIG_SND_RME32 is not set
959# CONFIG_SND_RME96 is not set 960# CONFIG_SND_RME96 is not set
960# CONFIG_SND_RME9652 is not set 961# CONFIG_SND_RME9652 is not set
@@ -1109,6 +1110,11 @@ CONFIG_USB_HIDDEV=y
1109# CONFIG_MMC is not set 1110# CONFIG_MMC is not set
1110 1111
1111# 1112#
1113# LED devices
1114#
1115# CONFIG_NEW_LEDS is not set
1116
1117#
1112# InfiniBand support 1118# InfiniBand support
1113# 1119#
1114# CONFIG_INFINIBAND is not set 1120# CONFIG_INFINIBAND is not set
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index ffc7309e9f22..2e1c824c1cc9 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -63,7 +63,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
63 flushi(p->addr); 63 flushi(p->addr);
64} 64}
65 65
66static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 66static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
67{ 67{
68 kcb->prev_kprobe.kp = kprobe_running(); 68 kcb->prev_kprobe.kp = kprobe_running();
69 kcb->prev_kprobe.status = kcb->kprobe_status; 69 kcb->prev_kprobe.status = kcb->kprobe_status;
@@ -71,7 +71,7 @@ static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
71 kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil; 71 kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil;
72} 72}
73 73
74static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) 74static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
75{ 75{
76 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 76 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
77 kcb->kprobe_status = kcb->prev_kprobe.status; 77 kcb->kprobe_status = kcb->prev_kprobe.status;
@@ -79,7 +79,7 @@ static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
79 kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil; 79 kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil;
80} 80}
81 81
82static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, 82static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
83 struct kprobe_ctlblk *kcb) 83 struct kprobe_ctlblk *kcb)
84{ 84{
85 __get_cpu_var(current_kprobe) = p; 85 __get_cpu_var(current_kprobe) = p;
@@ -87,7 +87,7 @@ static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
87 kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL); 87 kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL);
88} 88}
89 89
90static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs, 90static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs,
91 struct kprobe_ctlblk *kcb) 91 struct kprobe_ctlblk *kcb)
92{ 92{
93 regs->tstate |= TSTATE_PIL; 93 regs->tstate |= TSTATE_PIL;
@@ -273,7 +273,7 @@ static void __kprobes resume_execution(struct kprobe *p,
273 kcb->kprobe_orig_tstate_pil); 273 kcb->kprobe_orig_tstate_pil);
274} 274}
275 275
276static inline int post_kprobe_handler(struct pt_regs *regs) 276static int __kprobes post_kprobe_handler(struct pt_regs *regs)
277{ 277{
278 struct kprobe *cur = kprobe_running(); 278 struct kprobe *cur = kprobe_running();
279 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 279 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -300,7 +300,7 @@ out:
300 return 1; 300 return 1;
301} 301}
302 302
303static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 303static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
304{ 304{
305 struct kprobe *cur = kprobe_running(); 305 struct kprobe *cur = kprobe_running();
306 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 306 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index dfccff29e182..f97ddeb105ac 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -419,6 +419,7 @@ void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region
419 region->start = res->start - zero_res.start; 419 region->start = res->start - zero_res.start;
420 region->end = res->end - zero_res.start; 420 region->end = res->end - zero_res.start;
421} 421}
422EXPORT_SYMBOL(pcibios_resource_to_bus);
422 423
423void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res, 424void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
424 struct pci_bus_region *region) 425 struct pci_bus_region *region)
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 9372d4f376d5..9e94db2573a2 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -1092,7 +1092,7 @@ void sun4v_pci_init(int node, char *model_name)
1092 } 1092 }
1093 } 1093 }
1094 1094
1095 for_each_cpu(i) { 1095 for_each_possible_cpu(i) {
1096 unsigned long page = get_zeroed_page(GFP_ATOMIC); 1096 unsigned long page = get_zeroed_page(GFP_ATOMIC);
1097 1097
1098 if (!page) 1098 if (!page)
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index eb93e9c52846..49e6dedd027d 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -244,6 +244,13 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
244 } 244 }
245 245
246 switch(request) { 246 switch(request) {
247 case PTRACE_PEEKUSR:
248 if (addr != 0)
249 pt_error_return(regs, EIO);
250 else
251 pt_succ_return(regs, 0);
252 goto out_tsk;
253
247 case PTRACE_PEEKTEXT: /* read word at location addr. */ 254 case PTRACE_PEEKTEXT: /* read word at location addr. */
248 case PTRACE_PEEKDATA: { 255 case PTRACE_PEEKDATA: {
249 unsigned long tmp64; 256 unsigned long tmp64;
@@ -602,6 +609,22 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
602 609
603 /* PTRACE_DUMPCORE unsupported... */ 610 /* PTRACE_DUMPCORE unsupported... */
604 611
612 case PTRACE_GETEVENTMSG: {
613 int err;
614
615 if (test_thread_flag(TIF_32BIT))
616 err = put_user(child->ptrace_message,
617 (unsigned int __user *) data);
618 else
619 err = put_user(child->ptrace_message,
620 (unsigned long __user *) data);
621 if (err)
622 pt_error_return(regs, -err);
623 else
624 pt_succ_return(regs, 0);
625 break;
626 }
627
605 default: { 628 default: {
606 int err = ptrace_request(child, request, addr, data); 629 int err = ptrace_request(child, request, addr, data);
607 if (err) 630 if (err)
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 7d0e67c1ce50..005167f82419 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -535,7 +535,7 @@ static int __init topology_init(void)
535 while (!cpu_find_by_instance(ncpus_probed, NULL, NULL)) 535 while (!cpu_find_by_instance(ncpus_probed, NULL, NULL))
536 ncpus_probed++; 536 ncpus_probed++;
537 537
538 for_each_cpu(i) { 538 for_each_possible_cpu(i) {
539 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); 539 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
540 if (p) { 540 if (p) {
541 register_cpu(p, i, NULL); 541 register_cpu(p, i, NULL);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 8175a6968c6b..90eaca3ec9a6 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -745,12 +745,21 @@ struct call_data_struct {
745 int wait; 745 int wait;
746}; 746};
747 747
748static DEFINE_SPINLOCK(call_lock); 748static __cacheline_aligned_in_smp DEFINE_SPINLOCK(call_lock);
749static struct call_data_struct *call_data; 749static struct call_data_struct *call_data;
750 750
751extern unsigned long xcall_call_function; 751extern unsigned long xcall_call_function;
752 752
753/* 753/**
754 * smp_call_function(): Run a function on all other CPUs.
755 * @func: The function to run. This must be fast and non-blocking.
756 * @info: An arbitrary pointer to pass to the function.
757 * @nonatomic: currently unused.
758 * @wait: If true, wait (atomically) until function has completed on other CPUs.
759 *
760 * Returns 0 on success, else a negative status code. Does not return until
761 * remote CPUs are nearly ready to execute <<func>> or are or have executed.
762 *
754 * You must not call this function with disabled interrupts or from a 763 * You must not call this function with disabled interrupts or from a
755 * hardware interrupt handler or from a bottom half handler. 764 * hardware interrupt handler or from a bottom half handler.
756 */ 765 */
@@ -759,7 +768,6 @@ static int smp_call_function_mask(void (*func)(void *info), void *info,
759{ 768{
760 struct call_data_struct data; 769 struct call_data_struct data;
761 int cpus; 770 int cpus;
762 long timeout;
763 771
764 /* Can deadlock when called with interrupts disabled */ 772 /* Can deadlock when called with interrupts disabled */
765 WARN_ON(irqs_disabled()); 773 WARN_ON(irqs_disabled());
@@ -777,31 +785,18 @@ static int smp_call_function_mask(void (*func)(void *info), void *info,
777 goto out_unlock; 785 goto out_unlock;
778 786
779 call_data = &data; 787 call_data = &data;
788 mb();
780 789
781 smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask); 790 smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask);
782 791
783 /* 792 /* Wait for response */
784 * Wait for other cpus to complete function or at 793 while (atomic_read(&data.finished) != cpus)
785 * least snap the call data. 794 cpu_relax();
786 */
787 timeout = 1000000;
788 while (atomic_read(&data.finished) != cpus) {
789 if (--timeout <= 0)
790 goto out_timeout;
791 barrier();
792 udelay(1);
793 }
794 795
795out_unlock: 796out_unlock:
796 spin_unlock(&call_lock); 797 spin_unlock(&call_lock);
797 798
798 return 0; 799 return 0;
799
800out_timeout:
801 spin_unlock(&call_lock);
802 printk("XCALL: Remote cpus not responding, ncpus=%d finished=%d\n",
803 cpus, atomic_read(&data.finished));
804 return 0;
805} 800}
806 801
807int smp_call_function(void (*func)(void *info), void *info, 802int smp_call_function(void (*func)(void *info), void *info,
@@ -1285,7 +1280,7 @@ int setup_profiling_timer(unsigned int multiplier)
1285 return -EINVAL; 1280 return -EINVAL;
1286 1281
1287 spin_lock_irqsave(&prof_setup_lock, flags); 1282 spin_lock_irqsave(&prof_setup_lock, flags);
1288 for_each_cpu(i) 1283 for_each_possible_cpu(i)
1289 prof_multiplier(i) = multiplier; 1284 prof_multiplier(i) = multiplier;
1290 current_tick_offset = (timer_tick_offset / multiplier); 1285 current_tick_offset = (timer_tick_offset / multiplier);
1291 spin_unlock_irqrestore(&prof_setup_lock, flags); 1286 spin_unlock_irqrestore(&prof_setup_lock, flags);
@@ -1313,12 +1308,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
1313 } 1308 }
1314 } 1309 }
1315 1310
1316 for_each_cpu(i) { 1311 for_each_possible_cpu(i) {
1317 if (tlb_type == hypervisor) { 1312 if (tlb_type == hypervisor) {
1318 int j; 1313 int j;
1319 1314
1320 /* XXX get this mapping from machine description */ 1315 /* XXX get this mapping from machine description */
1321 for_each_cpu(j) { 1316 for_each_possible_cpu(j) {
1322 if ((j >> 2) == (i >> 2)) 1317 if ((j >> 2) == (i >> 2))
1323 cpu_set(j, cpu_sibling_map[i]); 1318 cpu_set(j, cpu_sibling_map[i]);
1324 } 1319 }
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index f5e8db1de76b..62d8a99271ea 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -276,7 +276,6 @@ EXPORT_SYMBOL(__prom_getsibling);
276EXPORT_SYMBOL(strlen); 276EXPORT_SYMBOL(strlen);
277EXPORT_SYMBOL(__strlen_user); 277EXPORT_SYMBOL(__strlen_user);
278EXPORT_SYMBOL(__strnlen_user); 278EXPORT_SYMBOL(__strnlen_user);
279EXPORT_SYMBOL(strpbrk);
280 279
281#ifdef CONFIG_SOLARIS_EMUL_MODULE 280#ifdef CONFIG_SOLARIS_EMUL_MODULE
282EXPORT_SYMBOL(linux_sparc_syscall); 281EXPORT_SYMBOL(linux_sparc_syscall);
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index 86dd5cb81e09..f9b75760163c 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -138,6 +138,7 @@ SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1)
138SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2) 138SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2)
139SIGN2(sys32_splice, sys_splice, %o0, %o1) 139SIGN2(sys32_splice, sys_splice, %o0, %o1)
140SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) 140SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
141SIGN2(sys32_tee, sys_tee, %o0, %o1)
141 142
142 .globl sys32_mmap2 143 .globl sys32_mmap2
143sys32_mmap2: 144sys32_mmap2:
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 857b82c82875..62672cd92eca 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -76,7 +76,7 @@ sys_call_table32:
76 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 76 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat 79/*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
@@ -145,7 +145,7 @@ sys_call_table:
145 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy 145 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 148/*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index ff090bb9734b..2793a5d82380 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1130,9 +1130,9 @@ static void cheetah_log_errors(struct pt_regs *regs, struct cheetah_err_info *in
1130 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(), 1130 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(),
1131 afsr, afar, 1131 afsr, afar,
1132 (afsr & CHAFSR_TL1) ? 1 : 0); 1132 (afsr & CHAFSR_TL1) ? 1 : 0);
1133 printk("%s" "ERROR(%d): TPC[%016lx] TNPC[%016lx] TSTATE[%016lx]\n", 1133 printk("%s" "ERROR(%d): TPC[%lx] TNPC[%lx] O7[%lx] TSTATE[%lx]\n",
1134 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(), 1134 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(),
1135 regs->tpc, regs->tnpc, regs->tstate); 1135 regs->tpc, regs->tnpc, regs->u_regs[UREG_I7], regs->tstate);
1136 printk("%s" "ERROR(%d): M_SYND(%lx), E_SYND(%lx)%s%s\n", 1136 printk("%s" "ERROR(%d): M_SYND(%lx), E_SYND(%lx)%s%s\n",
1137 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(), 1137 (recoverable ? KERN_WARNING : KERN_CRIT), smp_processor_id(),
1138 (afsr & CHAFSR_M_SYNDROME) >> CHAFSR_M_SYNDROME_SHIFT, 1138 (afsr & CHAFSR_M_SYNDROME) >> CHAFSR_M_SYNDROME_SHIFT,
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 24790bed2054..a508e7a02891 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -159,6 +159,7 @@ archclean:
159$(SYMLINK_HEADERS): 159$(SYMLINK_HEADERS):
160 @echo ' SYMLINK $@' 160 @echo ' SYMLINK $@'
161ifneq ($(KBUILD_SRC),) 161ifneq ($(KBUILD_SRC),)
162 $(Q)mkdir -p $(objtree)/include/asm-um
162 $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ 163 $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@
163else 164else
164 $(Q)cd $(TOPDIR)/$(dir $@) ; \ 165 $(Q)cd $(TOPDIR)/$(dir $@) ; \
@@ -168,7 +169,7 @@ endif
168include/asm-um/arch: 169include/asm-um/arch:
169 @echo ' SYMLINK $@' 170 @echo ' SYMLINK $@'
170ifneq ($(KBUILD_SRC),) 171ifneq ($(KBUILD_SRC),)
171 $(Q)mkdir -p include/asm-um 172 $(Q)mkdir -p $(objtree)/include/asm-um
172 $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch 173 $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch
173else 174else
174 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch 175 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index 04e3958266e0..dc36b222100b 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg);
46extern int read_cow_header(int (*reader)(__u64, char *, int, void *), 46extern int read_cow_header(int (*reader)(__u64, char *, int, void *),
47 void *arg, __u32 *version_out, 47 void *arg, __u32 *version_out,
48 char **backing_file_out, time_t *mtime_out, 48 char **backing_file_out, time_t *mtime_out,
49 __u64 *size_out, int *sectorsize_out, 49 unsigned long long *size_out, int *sectorsize_out,
50 __u32 *align_out, int *bitmap_offset_out); 50 __u32 *align_out, int *bitmap_offset_out);
51 51
52extern int write_cow_header(char *cow_file, int fd, char *backing_file, 52extern int write_cow_header(char *cow_file, int fd, char *backing_file,
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index 94de4ead4f7a..7a5b4afde692 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -28,7 +28,7 @@ static inline int cow_seek_file(int fd, __u64 offset)
28 return(os_seek_file(fd, offset)); 28 return(os_seek_file(fd, offset));
29} 29}
30 30
31static inline int cow_file_size(char *file, __u64 *size_out) 31static inline int cow_file_size(char *file, unsigned long long *size_out)
32{ 32{
33 return(os_file_size(file, size_out)); 33 return(os_file_size(file, size_out));
34} 34}
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index 61951b721268..6ab852bfcd3a 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -17,30 +17,34 @@
17 17
18#define PATH_LEN_V1 256 18#define PATH_LEN_V1 256
19 19
20typedef __u32 time32_t;
21
20struct cow_header_v1 { 22struct cow_header_v1 {
21 int magic; 23 __s32 magic;
22 int version; 24 __s32 version;
23 char backing_file[PATH_LEN_V1]; 25 char backing_file[PATH_LEN_V1];
24 time_t mtime; 26 time32_t mtime;
25 __u64 size; 27 __u64 size;
26 int sectorsize; 28 __s32 sectorsize;
27}; 29} __attribute__((packed));
28 30
29#define PATH_LEN_V2 MAXPATHLEN 31/* Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in
32 * case other systems have different values for MAXPATHLEN.
33 *
34 * The same must hold for V2 - we want file format compatibility, not anything
35 * else.
36 */
37#define PATH_LEN_V3 4096
38#define PATH_LEN_V2 PATH_LEN_V3
30 39
31struct cow_header_v2 { 40struct cow_header_v2 {
32 __u32 magic; 41 __u32 magic;
33 __u32 version; 42 __u32 version;
34 char backing_file[PATH_LEN_V2]; 43 char backing_file[PATH_LEN_V2];
35 time_t mtime; 44 time32_t mtime;
36 __u64 size; 45 __u64 size;
37 int sectorsize; 46 __s32 sectorsize;
38}; 47} __attribute__((packed));
39
40/* Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in
41 * case other systems have different values for MAXPATHLEN
42 */
43#define PATH_LEN_V3 4096
44 48
45/* Changes from V2 - 49/* Changes from V2 -
46 * PATH_LEN_V3 as described above 50 * PATH_LEN_V3 as described above
@@ -66,6 +70,15 @@ struct cow_header_v2 {
66 * Fixed (finally!) the rounding bug 70 * Fixed (finally!) the rounding bug
67 */ 71 */
68 72
73/* Until Dec2005, __attribute__((packed)) was left out from the below
74 * definition, leading on 64-bit systems to 4 bytes of padding after mtime, to
75 * align size to 8-byte alignment. This shifted all fields above (no padding
76 * was present on 32-bit, no other padding was added).
77 *
78 * However, this _can be detected_: it means that cow_format (always 0 until
79 * now) is shifted onto the first 4 bytes of backing_file, where it is otherwise
80 * impossible to find 4 zeros. -bb */
81
69struct cow_header_v3 { 82struct cow_header_v3 {
70 __u32 magic; 83 __u32 magic;
71 __u32 version; 84 __u32 version;
@@ -75,7 +88,19 @@ struct cow_header_v3 {
75 __u32 alignment; 88 __u32 alignment;
76 __u32 cow_format; 89 __u32 cow_format;
77 char backing_file[PATH_LEN_V3]; 90 char backing_file[PATH_LEN_V3];
78}; 91} __attribute__((packed));
92
93/* This is the broken layout used by some 64-bit binaries. */
94struct cow_header_v3_broken {
95 __u32 magic;
96 __u32 version;
97 __s64 mtime;
98 __u64 size;
99 __u32 sectorsize;
100 __u32 alignment;
101 __u32 cow_format;
102 char backing_file[PATH_LEN_V3];
103} __attribute__((packed));
79 104
80/* COW format definitions - for now, we have only the usual COW bitmap */ 105/* COW format definitions - for now, we have only the usual COW bitmap */
81#define COW_BITMAP 0 106#define COW_BITMAP 0
@@ -84,6 +109,7 @@ union cow_header {
84 struct cow_header_v1 v1; 109 struct cow_header_v1 v1;
85 struct cow_header_v2 v2; 110 struct cow_header_v2 v2;
86 struct cow_header_v3 v3; 111 struct cow_header_v3 v3;
112 struct cow_header_v3_broken v3_b;
87}; 113};
88 114
89#define COW_MAGIC 0x4f4f4f4d /* MOOO */ 115#define COW_MAGIC 0x4f4f4f4d /* MOOO */
@@ -184,8 +210,9 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
184 210
185 err = -EINVAL; 211 err = -EINVAL;
186 if(strlen(backing_file) > sizeof(header->backing_file) - 1){ 212 if(strlen(backing_file) > sizeof(header->backing_file) - 1){
213 /* Below, %zd is for a size_t value */
187 cow_printf("Backing file name \"%s\" is too long - names are " 214 cow_printf("Backing file name \"%s\" is too long - names are "
188 "limited to %d characters\n", backing_file, 215 "limited to %zd characters\n", backing_file,
189 sizeof(header->backing_file) - 1); 216 sizeof(header->backing_file) - 1);
190 goto out_free; 217 goto out_free;
191 } 218 }
@@ -300,7 +327,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
300 *align_out = *sectorsize_out; 327 *align_out = *sectorsize_out;
301 file = header->v2.backing_file; 328 file = header->v2.backing_file;
302 } 329 }
303 else if(version == 3){ 330 /* This is very subtle - see above at union cow_header definition */
331 else if(version == 3 && (*((int*)header->v3.backing_file) != 0)){
304 if(n < sizeof(header->v3)){ 332 if(n < sizeof(header->v3)){
305 cow_printf("read_cow_header - failed to read V3 " 333 cow_printf("read_cow_header - failed to read V3 "
306 "header\n"); 334 "header\n");
@@ -310,9 +338,43 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
310 *size_out = ntohll(header->v3.size); 338 *size_out = ntohll(header->v3.size);
311 *sectorsize_out = ntohl(header->v3.sectorsize); 339 *sectorsize_out = ntohl(header->v3.sectorsize);
312 *align_out = ntohl(header->v3.alignment); 340 *align_out = ntohl(header->v3.alignment);
341 if (*align_out == 0) {
342 cow_printf("read_cow_header - invalid COW header, "
343 "align == 0\n");
344 }
313 *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out); 345 *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out);
314 file = header->v3.backing_file; 346 file = header->v3.backing_file;
315 } 347 }
348 else if(version == 3){
349 cow_printf("read_cow_header - broken V3 file with"
350 " 64-bit layout - recovering content.\n");
351
352 if(n < sizeof(header->v3_b)){
353 cow_printf("read_cow_header - failed to read V3 "
354 "header\n");
355 goto out;
356 }
357
358 /* this was used until Dec2005 - 64bits are needed to represent
359 * 2038+. I.e. we can safely do this truncating cast.
360 *
361 * Additionally, we must use ntohl() instead of ntohll(), since
362 * the program used to use the former (tested - I got mtime
363 * mismatch "0 vs whatever").
364 *
365 * Ever heard about bug-to-bug-compatibility ? ;-) */
366 *mtime_out = (time32_t) ntohl(header->v3_b.mtime);
367
368 *size_out = ntohll(header->v3_b.size);
369 *sectorsize_out = ntohl(header->v3_b.sectorsize);
370 *align_out = ntohl(header->v3_b.alignment);
371 if (*align_out == 0) {
372 cow_printf("read_cow_header - invalid COW header, "
373 "align == 0\n");
374 }
375 *bitmap_offset_out = ROUND_UP(sizeof(header->v3_b), *align_out);
376 file = header->v3_b.backing_file;
377 }
316 else { 378 else {
317 cow_printf("read_cow_header - invalid COW version\n"); 379 cow_printf("read_cow_header - invalid COW version\n");
318 goto out; 380 goto out;
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 28e3760e8b98..6d7173fc55a3 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -62,7 +62,7 @@ static void mc_work_proc(void *unused)
62 unsigned long flags; 62 unsigned long flags;
63 63
64 while(!list_empty(&mc_requests)){ 64 while(!list_empty(&mc_requests)){
65 local_save_flags(flags); 65 local_irq_save(flags);
66 req = list_entry(mc_requests.next, struct mconsole_entry, 66 req = list_entry(mc_requests.next, struct mconsole_entry,
67 list); 67 list);
68 list_del(&req->list); 68 list_del(&req->list);
@@ -87,7 +87,7 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id,
87 if(req.cmd->context == MCONSOLE_INTR) 87 if(req.cmd->context == MCONSOLE_INTR)
88 (*req.cmd->handler)(&req); 88 (*req.cmd->handler)(&req);
89 else { 89 else {
90 new = kmalloc(sizeof(*new), GFP_ATOMIC); 90 new = kmalloc(sizeof(*new), GFP_NOWAIT);
91 if(new == NULL) 91 if(new == NULL)
92 mconsole_reply(&req, "Out of memory", 1, 0); 92 mconsole_reply(&req, "Out of memory", 1, 0);
93 else { 93 else {
@@ -415,7 +415,6 @@ static int mem_config(char *str)
415 415
416 unplugged = page_address(page); 416 unplugged = page_address(page);
417 if(unplug_index == UNPLUGGED_PER_PAGE){ 417 if(unplug_index == UNPLUGGED_PER_PAGE){
418 INIT_LIST_HEAD(&unplugged->list);
419 list_add(&unplugged->list, &unplugged_pages); 418 list_add(&unplugged->list, &unplugged_pages);
420 unplug_index = 0; 419 unplug_index = 0;
421 } 420 }
@@ -616,7 +615,7 @@ static void console_write(struct console *console, const char *string,
616 return; 615 return;
617 616
618 while(1){ 617 while(1){
619 n = min((size_t)len, ARRAY_SIZE(console_buf) - console_index); 618 n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index);
620 strncpy(&console_buf[console_index], string, n); 619 strncpy(&console_buf[console_index], string, n);
621 console_index += n; 620 console_index += n;
622 string += n; 621 string += n;
@@ -655,7 +654,6 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
655 struct mconsole_entry entry; 654 struct mconsole_entry entry;
656 unsigned long flags; 655 unsigned long flags;
657 656
658 INIT_LIST_HEAD(&entry.list);
659 entry.request = *req; 657 entry.request = *req;
660 list_add(&entry.list, &clients); 658 list_add(&entry.list, &clients);
661 spin_lock_irqsave(&console_lock, flags); 659 spin_lock_irqsave(&console_lock, flags);
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 0e2f06187ea7..0a7786e00cfb 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -182,7 +182,9 @@ static int change_tramp(char **argv, char *output, int output_len)
182 pe_data.stdout = fds[1]; 182 pe_data.stdout = fds[1];
183 pid = run_helper(change_pre_exec, &pe_data, argv, NULL); 183 pid = run_helper(change_pre_exec, &pe_data, argv, NULL);
184 184
185 read_output(fds[0], output, output_len); 185 if (pid > 0) /* Avoid hang as we won't get data in failure case. */
186 read_output(fds[0], output, output_len);
187
186 os_close_file(fds[0]); 188 os_close_file(fds[0]);
187 os_close_file(fds[1]); 189 os_close_file(fds[1]);
188 190
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c
index b94c66114bc8..33c5f6e625e8 100644
--- a/arch/um/drivers/slirp_user.c
+++ b/arch/um/drivers/slirp_user.c
@@ -104,7 +104,7 @@ static void slirp_close(int fd, void *data)
104 } 104 }
105 105
106 if(err == 0) { 106 if(err == 0) {
107 printk("slirp_close: process %d has not exited\n"); 107 printk("slirp_close: process %d has not exited\n", pri->pid);
108 return; 108 return;
109 } 109 }
110 110
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index 42557130a408..efa3d33c0be6 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -117,10 +117,6 @@ extern struct task_struct *get_task(int pid, int require);
117extern void machine_halt(void); 117extern void machine_halt(void);
118extern int is_syscall(unsigned long addr); 118extern int is_syscall(unsigned long addr);
119 119
120extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to);
121
122extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to);
123
124extern void free_irq(unsigned int, void *); 120extern void free_irq(unsigned int, void *);
125extern int cpu(void); 121extern int cpu(void);
126 122
diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h
index 018b3819ab0b..8e7053013f7b 100644
--- a/arch/um/include/longjmp.h
+++ b/arch/um/include/longjmp.h
@@ -4,11 +4,11 @@
4#include <setjmp.h> 4#include <setjmp.h>
5#include "os.h" 5#include "os.h"
6 6
7#define UML_SIGLONGJMP(buf, val) do { \ 7#define UML_LONGJMP(buf, val) do { \
8 longjmp(*buf, val); \ 8 longjmp(*buf, val); \
9} while(0) 9} while(0)
10 10
11#define UML_SIGSETJMP(buf, enable) ({ \ 11#define UML_SETJMP(buf, enable) ({ \
12 int n; \ 12 int n; \
13 enable = get_signals(); \ 13 enable = get_signals(); \
14 n = setjmp(*buf); \ 14 n = setjmp(*buf); \
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h
index 82f96c574144..2c13de321f2f 100644
--- a/arch/um/include/sysdep-i386/kernel-offsets.h
+++ b/arch/um/include/sysdep-i386/kernel-offsets.h
@@ -1,6 +1,7 @@
1#include <linux/stddef.h> 1#include <linux/stddef.h>
2#include <linux/sched.h> 2#include <linux/sched.h>
3#include <linux/elf.h> 3#include <linux/elf.h>
4#include <asm/mman.h>
4 5
5#define DEFINE(sym, val) \ 6#define DEFINE(sym, val) \
6 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 7 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -16,6 +17,7 @@
16void foo(void) 17void foo(void)
17{ 18{
18 OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); 19 OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs);
20 DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
19#ifdef CONFIG_MODE_TT 21#ifdef CONFIG_MODE_TT
20 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); 22 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
21#endif 23#endif
diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h
index 5ce93abd0b54..939cc475757a 100644
--- a/arch/um/include/sysdep-x86_64/kernel-offsets.h
+++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h
@@ -4,6 +4,7 @@
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/elf.h> 5#include <linux/elf.h>
6#include <asm/page.h> 6#include <asm/page.h>
7#include <asm/mman.h>
7 8
8#define DEFINE(sym, val) \ 9#define DEFINE(sym, val) \
9 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -18,6 +19,7 @@
18 19
19void foo(void) 20void foo(void)
20{ 21{
22 DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
21#ifdef CONFIG_MODE_TT 23#ifdef CONFIG_MODE_TT
22 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); 24 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
23#endif 25#endif
diff --git a/arch/um/include/tt/tt.h b/arch/um/include/tt/tt.h
index 808521980186..acb8356e1f98 100644
--- a/arch/um/include/tt/tt.h
+++ b/arch/um/include/tt/tt.h
@@ -19,7 +19,8 @@ extern int fork_tramp(void *sig_stack);
19extern int do_proc_op(void *t, int proc_id); 19extern int do_proc_op(void *t, int proc_id);
20extern int tracer(int (*init_proc)(void *), void *sp); 20extern int tracer(int (*init_proc)(void *), void *sp);
21extern void attach_process(int pid); 21extern void attach_process(int pid);
22extern void tracer_panic(char *format, ...); 22extern void tracer_panic(char *format, ...)
23 __attribute__ ((format (printf, 1, 2)));
23extern void set_init_pid(int pid); 24extern void set_init_pid(int pid);
24extern int set_user_mode(void *task); 25extern int set_user_mode(void *task);
25extern void set_tracing(void *t, int tracing); 26extern void set_tracing(void *t, int tracing);
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 91b0ac4ad88c..39f8c8801076 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -6,8 +6,10 @@
6#ifndef __USER_H__ 6#ifndef __USER_H__
7#define __USER_H__ 7#define __USER_H__
8 8
9extern void panic(const char *fmt, ...); 9extern void panic(const char *fmt, ...)
10extern int printk(const char *fmt, ...); 10 __attribute__ ((format (printf, 1, 2)));
11extern int printk(const char *fmt, ...)
12 __attribute__ ((format (printf, 1, 2)));
11extern void schedule(void); 13extern void schedule(void);
12extern void *um_kmalloc(int size); 14extern void *um_kmalloc(int size);
13extern void *um_kmalloc_atomic(int size); 15extern void *um_kmalloc_atomic(int size);
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index fe0c29b5144d..802d7842514d 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -55,7 +55,8 @@ extern int get_pty(void);
55extern void *um_kmalloc(int size); 55extern void *um_kmalloc(int size);
56extern int switcheroo(int fd, int prot, void *from, void *to, int size); 56extern int switcheroo(int fd, int prot, void *from, void *to, int size);
57extern void do_exec(int old_pid, int new_pid); 57extern void do_exec(int old_pid, int new_pid);
58extern void tracer_panic(char *msg, ...); 58extern void tracer_panic(char *msg, ...)
59 __attribute__ ((format (printf, 1, 2)));
59extern int detach(int pid, int sig); 60extern int detach(int pid, int sig);
60extern int attach(int pid); 61extern int attach(int pid);
61extern void kill_child_dead(int pid); 62extern void kill_child_dead(int pid);
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 7713e7a6f476..432cf0b97a13 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -39,7 +39,6 @@ EXPORT_SYMBOL(um_virt_to_phys);
39EXPORT_SYMBOL(mode_tt); 39EXPORT_SYMBOL(mode_tt);
40EXPORT_SYMBOL(handle_page_fault); 40EXPORT_SYMBOL(handle_page_fault);
41EXPORT_SYMBOL(find_iomem); 41EXPORT_SYMBOL(find_iomem);
42EXPORT_SYMBOL(end_iomem);
43 42
44#ifdef CONFIG_MODE_TT 43#ifdef CONFIG_MODE_TT
45EXPORT_SYMBOL(strncpy_from_user_tt); 44EXPORT_SYMBOL(strncpy_from_user_tt);
@@ -89,12 +88,10 @@ EXPORT_SYMBOL(dump_thread);
89EXPORT_SYMBOL(do_gettimeofday); 88EXPORT_SYMBOL(do_gettimeofday);
90EXPORT_SYMBOL(do_settimeofday); 89EXPORT_SYMBOL(do_settimeofday);
91 90
92/* This is here because UML expands open to sys_open, not to a system 91/* This is here because UML expands lseek to sys_lseek, not to a system
93 * call instruction. 92 * call instruction.
94 */ 93 */
95EXPORT_SYMBOL(sys_open);
96EXPORT_SYMBOL(sys_lseek); 94EXPORT_SYMBOL(sys_lseek);
97EXPORT_SYMBOL(sys_read);
98EXPORT_SYMBOL(sys_wait4); 95EXPORT_SYMBOL(sys_wait4);
99 96
100#ifdef CONFIG_SMP 97#ifdef CONFIG_SMP
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 901b85e8a1c6..8f49507e64ef 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -40,7 +40,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
40 int fd) 40 int fd)
41{ 41{
42 struct addr_change change; 42 struct addr_change change;
43 void *output; 43 char *output;
44 int n; 44 int n;
45 45
46 change.what = op; 46 change.what = op;
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 6490a4ff40ac..6987d1d247a2 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -43,7 +43,7 @@ static int helper_child(void *arg)
43 (*data->pre_exec)(data->pre_data); 43 (*data->pre_exec)(data->pre_data);
44 execvp(argv[0], argv); 44 execvp(argv[0], argv);
45 errval = errno; 45 errval = errno;
46 printk("execvp of '%s' failed - errno = %d\n", argv[0], errno); 46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno);
47 os_write_file(data->fd, &errval, sizeof(errval)); 47 os_write_file(data->fd, &errval, sizeof(errval));
48 kill(os_getpid(), SIGKILL); 48 kill(os_getpid(), SIGKILL);
49 return(0); 49 return(0);
@@ -92,15 +92,15 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
92 close(fds[1]); 92 close(fds[1]);
93 fds[1] = -1; 93 fds[1] = -1;
94 94
95 /*Read the errno value from the child.*/ 95 /* Read the errno value from the child, if the exec failed, or get 0 if
96 * the exec succeeded because the pipe fd was set as close-on-exec. */
96 n = os_read_file(fds[0], &ret, sizeof(ret)); 97 n = os_read_file(fds[0], &ret, sizeof(ret));
97 if(n < 0){ 98 if (n < 0) {
98 printk("run_helper : read on pipe failed, ret = %d\n", -n); 99 printk("run_helper : read on pipe failed, ret = %d\n", -n);
99 ret = n; 100 ret = n;
100 kill(pid, SIGKILL); 101 kill(pid, SIGKILL);
101 CATCH_EINTR(waitpid(pid, NULL, 0)); 102 CATCH_EINTR(waitpid(pid, NULL, 0));
102 } 103 } else if(n != 0){
103 else if(n != 0){
104 CATCH_EINTR(n = waitpid(pid, NULL, 0)); 104 CATCH_EINTR(n = waitpid(pid, NULL, 0));
105 ret = -errno; 105 ret = -errno;
106 } else { 106 } else {
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 6ab372da9657..c6432e729241 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -8,6 +8,7 @@
8#include <fcntl.h> 8#include <fcntl.h>
9#include <sys/types.h> 9#include <sys/types.h>
10#include <sys/mman.h> 10#include <sys/mman.h>
11#include <sys/statfs.h>
11#include "kern_util.h" 12#include "kern_util.h"
12#include "user.h" 13#include "user.h"
13#include "user_util.h" 14#include "user_util.h"
@@ -19,6 +20,7 @@
19 20
20#include <sys/param.h> 21#include <sys/param.h>
21 22
23static char *default_tmpdir = "/tmp";
22static char *tempdir = NULL; 24static char *tempdir = NULL;
23 25
24static void __init find_tempdir(void) 26static void __init find_tempdir(void)
@@ -34,7 +36,7 @@ static void __init find_tempdir(void)
34 break; 36 break;
35 } 37 }
36 if((dir == NULL) || (*dir == '\0')) 38 if((dir == NULL) || (*dir == '\0'))
37 dir = "/tmp"; 39 dir = default_tmpdir;
38 40
39 tempdir = malloc(strlen(dir) + 2); 41 tempdir = malloc(strlen(dir) + 2);
40 if(tempdir == NULL){ 42 if(tempdir == NULL){
@@ -46,6 +48,96 @@ static void __init find_tempdir(void)
46 strcat(tempdir, "/"); 48 strcat(tempdir, "/");
47} 49}
48 50
51/* This will return 1, with the first character in buf being the
52 * character following the next instance of c in the file. This will
53 * read the file as needed. If there's an error, -errno is returned;
54 * if the end of the file is reached, 0 is returned.
55 */
56static int next(int fd, char *buf, int size, char c)
57{
58 int n;
59 char *ptr;
60
61 while((ptr = strchr(buf, c)) == NULL){
62 n = read(fd, buf, size - 1);
63 if(n == 0)
64 return 0;
65 else if(n < 0)
66 return -errno;
67
68 buf[n] = '\0';
69 }
70
71 ptr++;
72 memmove(buf, ptr, strlen(ptr) + 1);
73 return 1;
74}
75
76static int checked_tmpdir = 0;
77
78/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner
79 * way to do this than to parse /proc/mounts. statfs will return the
80 * same filesystem magic number and fs id for both /dev and /dev/shm
81 * when they are both tmpfs, so you can't tell if they are different
82 * filesystems. Also, there seems to be no other way of finding the
83 * mount point of a filesystem from within it.
84 *
85 * If a /dev/shm tmpfs entry is found, then we switch to using it.
86 * Otherwise, we stay with the default /tmp.
87 */
88static void which_tmpdir(void)
89{
90 int fd, found;
91 char buf[128] = { '\0' };
92
93 if(checked_tmpdir)
94 return;
95
96 checked_tmpdir = 1;
97
98 printf("Checking for tmpfs mount on /dev/shm...");
99
100 fd = open("/proc/mounts", O_RDONLY);
101 if(fd < 0){
102 printf("failed to open /proc/mounts, errno = %d\n", errno);
103 return;
104 }
105
106 while(1){
107 found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' ');
108 if(found != 1)
109 break;
110
111 if(!strncmp(buf, "/dev/shm", strlen("/dev/shm")))
112 goto found;
113
114 found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), '\n');
115 if(found != 1)
116 break;
117 }
118
119err:
120 if(found == 0)
121 printf("nothing mounted on /dev/shm\n");
122 else if(found < 0)
123 printf("read returned errno %d\n", -found);
124
125 return;
126
127found:
128 found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' ');
129 if(found != 1)
130 goto err;
131
132 if(strncmp(buf, "tmpfs", strlen("tmpfs"))){
133 printf("not tmpfs\n");
134 return;
135 }
136
137 printf("OK\n");
138 default_tmpdir = "/dev/shm";
139}
140
49/* 141/*
50 * This proc still used in tt-mode 142 * This proc still used in tt-mode
51 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). 143 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger).
@@ -53,33 +145,37 @@ static void __init find_tempdir(void)
53 */ 145 */
54int make_tempfile(const char *template, char **out_tempname, int do_unlink) 146int make_tempfile(const char *template, char **out_tempname, int do_unlink)
55{ 147{
56 char tempname[MAXPATHLEN]; 148 char *tempname;
57 int fd; 149 int fd;
58 150
151 which_tmpdir();
152 tempname = malloc(MAXPATHLEN);
153
59 find_tempdir(); 154 find_tempdir();
60 if (*template != '/') 155 if (template[0] != '/')
61 strcpy(tempname, tempdir); 156 strcpy(tempname, tempdir);
62 else 157 else
63 *tempname = 0; 158 tempname[0] = '\0';
64 strcat(tempname, template); 159 strcat(tempname, template);
65 fd = mkstemp(tempname); 160 fd = mkstemp(tempname);
66 if(fd < 0){ 161 if(fd < 0){
67 fprintf(stderr, "open - cannot create %s: %s\n", tempname, 162 fprintf(stderr, "open - cannot create %s: %s\n", tempname,
68 strerror(errno)); 163 strerror(errno));
69 return -1; 164 goto out;
70 } 165 }
71 if(do_unlink && (unlink(tempname) < 0)){ 166 if(do_unlink && (unlink(tempname) < 0)){
72 perror("unlink"); 167 perror("unlink");
73 return -1; 168 goto out;
74 } 169 }
75 if(out_tempname){ 170 if(out_tempname){
76 *out_tempname = strdup(tempname); 171 *out_tempname = tempname;
77 if(*out_tempname == NULL){ 172 } else {
78 perror("strdup"); 173 free(tempname);
79 return -1;
80 }
81 } 174 }
82 return(fd); 175 return(fd);
176out:
177 free(tempname);
178 return -1;
83} 179}
84 180
85#define TEMPNAME_TEMPLATE "vm_file-XXXXXX" 181#define TEMPNAME_TEMPLATE "vm_file-XXXXXX"
@@ -134,3 +230,26 @@ int create_mem_file(unsigned long long len)
134 } 230 }
135 return(fd); 231 return(fd);
136} 232}
233
234
235void check_tmpexec(void)
236{
237 void *addr;
238 int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE);
239
240 addr = mmap(NULL, UM_KERN_PAGE_SIZE,
241 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
242 printf("Checking PROT_EXEC mmap in %s...",tempdir);
243 fflush(stdout);
244 if(addr == MAP_FAILED){
245 err = errno;
246 perror("failed");
247 if(err == EPERM)
248 printf("%s must be not mounted noexec\n",tempdir);
249 exit(1);
250 }
251 printf("OK\n");
252 munmap(addr, UM_KERN_PAGE_SIZE);
253
254 close(fd);
255}
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 8176b0b52047..3505f44f8a25 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -190,7 +190,7 @@ int os_unmap_memory(void *addr, int len)
190} 190}
191 191
192#ifndef MADV_REMOVE 192#ifndef MADV_REMOVE
193#define MADV_REMOVE 0x5 /* remove these pages & resources */ 193#define MADV_REMOVE KERNEL_MADV_REMOVE
194#endif 194#endif
195 195
196int os_drop_memory(void *addr, int length) 196int os_drop_memory(void *addr, int length)
@@ -216,7 +216,7 @@ int can_drop_memory(void)
216 } 216 }
217 217
218 addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, 218 addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
219 MAP_PRIVATE, fd, 0); 219 MAP_SHARED, fd, 0);
220 if(addr == MAP_FAILED){ 220 if(addr == MAP_FAILED){
221 printk("Mapping test memory file failed, err = %d\n", -errno); 221 printk("Mapping test memory file failed, err = %d\n", -errno);
222 return 0; 222 return 0;
@@ -266,11 +266,11 @@ void init_new_thread_signals(int altstack)
266 266
267int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) 267int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
268{ 268{
269 sigjmp_buf buf; 269 jmp_buf buf;
270 int n, enable; 270 int n, enable;
271 271
272 *jmp_ptr = &buf; 272 *jmp_ptr = &buf;
273 n = UML_SIGSETJMP(&buf, enable); 273 n = UML_SETJMP(&buf, enable);
274 if(n != 0) 274 if(n != 0)
275 return(n); 275 return(n);
276 (*fn)(arg); 276 (*fn)(arg);
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 9ba942947146..00e9388e947a 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -304,8 +304,8 @@ out_clear_poll:
304 .size = 0, 304 .size = 0,
305 .used = 0 }); 305 .used = 0 });
306out_free: 306out_free:
307 kfree(p);
308 sigio_unlock(); 307 sigio_unlock();
308 kfree(p);
309out_close2: 309out_close2:
310 close(l_sigio_private[0]); 310 close(l_sigio_private[0]);
311 close(l_sigio_private[1]); 311 close(l_sigio_private[1]);
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index fbb080c2fc26..b3c11cfa995a 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -82,8 +82,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
82 if (offset) { 82 if (offset) {
83 data = (unsigned long *)(mm_idp->stack + 83 data = (unsigned long *)(mm_idp->stack +
84 offset - UML_CONFIG_STUB_DATA); 84 offset - UML_CONFIG_STUB_DATA);
85 printk("do_syscall_stub : ret = %d, offset = %d, " 85 printk("do_syscall_stub : ret = %ld, offset = %ld, "
86 "data = 0x%x\n", ret, offset, data); 86 "data = %p\n", ret, offset, data);
87 syscall = (unsigned long *)((unsigned long)data + data[0]); 87 syscall = (unsigned long *)((unsigned long)data + data[0]);
88 printk("do_syscall_stub: syscall %ld failed, return value = " 88 printk("do_syscall_stub: syscall %ld failed, return value = "
89 "0x%lx, expected return value = 0x%lx\n", 89 "0x%lx, expected return value = 0x%lx\n",
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index bbf34cb91ce1..0776bc18ca85 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -265,7 +265,7 @@ void userspace(union uml_pt_regs *regs)
265 if(err) 265 if(err)
266 panic("userspace - could not resume userspace process, " 266 panic("userspace - could not resume userspace process, "
267 "pid=%d, ptrace operation = %d, errno = %d\n", 267 "pid=%d, ptrace operation = %d, errno = %d\n",
268 op, errno); 268 pid, op, errno);
269 269
270 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 270 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
271 if(err < 0) 271 if(err < 0)
@@ -369,7 +369,7 @@ int copy_context_skas0(unsigned long new_stack, int pid)
369 */ 369 */
370 wait_stub_done(pid, -1, "copy_context_skas0"); 370 wait_stub_done(pid, -1, "copy_context_skas0");
371 if (child_data->err != UML_CONFIG_STUB_DATA) 371 if (child_data->err != UML_CONFIG_STUB_DATA)
372 panic("copy_context_skas0 - stub-child reports error %d\n", 372 panic("copy_context_skas0 - stub-child reports error %ld\n",
373 child_data->err); 373 child_data->err);
374 374
375 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, 375 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
@@ -434,7 +434,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
434 void (*handler)(int)) 434 void (*handler)(int))
435{ 435{
436 unsigned long flags; 436 unsigned long flags;
437 sigjmp_buf switch_buf, fork_buf; 437 jmp_buf switch_buf, fork_buf;
438 int enable; 438 int enable;
439 439
440 *switch_buf_ptr = &switch_buf; 440 *switch_buf_ptr = &switch_buf;
@@ -450,7 +450,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
450 */ 450 */
451 flags = get_signals(); 451 flags = get_signals();
452 block_signals(); 452 block_signals();
453 if(UML_SIGSETJMP(&fork_buf, enable) == 0) 453 if(UML_SETJMP(&fork_buf, enable) == 0)
454 new_thread_proc(stack, handler); 454 new_thread_proc(stack, handler);
455 455
456 remove_sigstack(); 456 remove_sigstack();
@@ -466,35 +466,35 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
466 466
467void thread_wait(void *sw, void *fb) 467void thread_wait(void *sw, void *fb)
468{ 468{
469 sigjmp_buf buf, **switch_buf = sw, *fork_buf; 469 jmp_buf buf, **switch_buf = sw, *fork_buf;
470 int enable; 470 int enable;
471 471
472 *switch_buf = &buf; 472 *switch_buf = &buf;
473 fork_buf = fb; 473 fork_buf = fb;
474 if(UML_SIGSETJMP(&buf, enable) == 0) 474 if(UML_SETJMP(&buf, enable) == 0)
475 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); 475 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
476} 476}
477 477
478void switch_threads(void *me, void *next) 478void switch_threads(void *me, void *next)
479{ 479{
480 sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; 480 jmp_buf my_buf, **me_ptr = me, *next_buf = next;
481 int enable; 481 int enable;
482 482
483 *me_ptr = &my_buf; 483 *me_ptr = &my_buf;
484 if(UML_SIGSETJMP(&my_buf, enable) == 0) 484 if(UML_SETJMP(&my_buf, enable) == 0)
485 UML_SIGLONGJMP(next_buf, 1); 485 UML_LONGJMP(next_buf, 1);
486} 486}
487 487
488static sigjmp_buf initial_jmpbuf; 488static jmp_buf initial_jmpbuf;
489 489
490/* XXX Make these percpu */ 490/* XXX Make these percpu */
491static void (*cb_proc)(void *arg); 491static void (*cb_proc)(void *arg);
492static void *cb_arg; 492static void *cb_arg;
493static sigjmp_buf *cb_back; 493static jmp_buf *cb_back;
494 494
495int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) 495int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
496{ 496{
497 sigjmp_buf **switch_buf = switch_buf_ptr; 497 jmp_buf **switch_buf = switch_buf_ptr;
498 int n, enable; 498 int n, enable;
499 499
500 set_handler(SIGWINCH, (__sighandler_t) sig_handler, 500 set_handler(SIGWINCH, (__sighandler_t) sig_handler,
@@ -502,7 +502,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
502 SIGVTALRM, -1); 502 SIGVTALRM, -1);
503 503
504 *fork_buf_ptr = &initial_jmpbuf; 504 *fork_buf_ptr = &initial_jmpbuf;
505 n = UML_SIGSETJMP(&initial_jmpbuf, enable); 505 n = UML_SETJMP(&initial_jmpbuf, enable);
506 switch(n){ 506 switch(n){
507 case INIT_JMP_NEW_THREAD: 507 case INIT_JMP_NEW_THREAD:
508 new_thread_proc((void *) stack, new_thread_handler); 508 new_thread_proc((void *) stack, new_thread_handler);
@@ -512,7 +512,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
512 break; 512 break;
513 case INIT_JMP_CALLBACK: 513 case INIT_JMP_CALLBACK:
514 (*cb_proc)(cb_arg); 514 (*cb_proc)(cb_arg);
515 UML_SIGLONGJMP(cb_back, 1); 515 UML_LONGJMP(cb_back, 1);
516 break; 516 break;
517 case INIT_JMP_HALT: 517 case INIT_JMP_HALT:
518 kmalloc_ok = 0; 518 kmalloc_ok = 0;
@@ -523,12 +523,12 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
523 default: 523 default:
524 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); 524 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
525 } 525 }
526 UML_SIGLONGJMP(*switch_buf, 1); 526 UML_LONGJMP(*switch_buf, 1);
527} 527}
528 528
529void initial_thread_cb_skas(void (*proc)(void *), void *arg) 529void initial_thread_cb_skas(void (*proc)(void *), void *arg)
530{ 530{
531 sigjmp_buf here; 531 jmp_buf here;
532 int enable; 532 int enable;
533 533
534 cb_proc = proc; 534 cb_proc = proc;
@@ -536,8 +536,8 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
536 cb_back = &here; 536 cb_back = &here;
537 537
538 block_signals(); 538 block_signals();
539 if(UML_SIGSETJMP(&here, enable) == 0) 539 if(UML_SETJMP(&here, enable) == 0)
540 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); 540 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK);
541 unblock_signals(); 541 unblock_signals();
542 542
543 cb_proc = NULL; 543 cb_proc = NULL;
@@ -548,13 +548,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
548void halt_skas(void) 548void halt_skas(void)
549{ 549{
550 block_signals(); 550 block_signals();
551 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT); 551 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
552} 552}
553 553
554void reboot_skas(void) 554void reboot_skas(void)
555{ 555{
556 block_signals(); 556 block_signals();
557 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); 557 UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
558} 558}
559 559
560void switch_mm_skas(struct mm_id *mm_idp) 560void switch_mm_skas(struct mm_id *mm_idp)
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 387e26af301a..503148504009 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -296,29 +296,7 @@ static void __init check_ptrace(void)
296 check_sysemu(); 296 check_sysemu();
297} 297}
298 298
299extern int create_tmp_file(unsigned long long len); 299extern void check_tmpexec(void);
300
301static void check_tmpexec(void)
302{
303 void *addr;
304 int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE);
305
306 addr = mmap(NULL, UM_KERN_PAGE_SIZE,
307 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
308 printf("Checking PROT_EXEC mmap in /tmp...");
309 fflush(stdout);
310 if(addr == MAP_FAILED){
311 err = errno;
312 perror("failed");
313 if(err == EPERM)
314 printf("/tmp must be not mounted noexec\n");
315 exit(1);
316 }
317 printf("OK\n");
318 munmap(addr, UM_KERN_PAGE_SIZE);
319
320 close(fd);
321}
322 300
323void os_early_checks(void) 301void os_early_checks(void)
324{ 302{
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c
index ba21f0e04a2f..120abbe4e3ce 100644
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ b/arch/um/os-Linux/sys-i386/tls.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <linux/unistd.h> 2#include <linux/unistd.h>
2#include "sysdep/tls.h" 3#include "sysdep/tls.h"
3#include "user_util.h" 4#include "user_util.h"
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
index a9f6b26f9828..90b29ae9af46 100644
--- a/arch/um/os-Linux/trap.c
+++ b/arch/um/os-Linux/trap.c
@@ -35,7 +35,7 @@ void os_fill_handlinfo(struct kern_handlers h)
35 35
36void do_longjmp(void *b, int val) 36void do_longjmp(void *b, int val)
37{ 37{
38 sigjmp_buf *buf = b; 38 jmp_buf *buf = b;
39 39
40 UML_SIGLONGJMP(buf, val); 40 UML_LONGJMP(buf, val);
41} 41}
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
index 166fb66995df..e523719330b2 100644
--- a/arch/um/os-Linux/uaccess.c
+++ b/arch/um/os-Linux/uaccess.c
@@ -16,9 +16,9 @@ unsigned long __do_user_copy(void *to, const void *from, int n,
16 unsigned long *faddrp = (unsigned long *) fault_addr, ret; 16 unsigned long *faddrp = (unsigned long *) fault_addr, ret;
17 int enable; 17 int enable;
18 18
19 sigjmp_buf jbuf; 19 jmp_buf jbuf;
20 *fault_catcher = &jbuf; 20 *fault_catcher = &jbuf;
21 if(UML_SIGSETJMP(&jbuf, enable) == 0){ 21 if(UML_SETJMP(&jbuf, enable) == 0){
22 (*op)(to, from, n); 22 (*op)(to, from, n);
23 ret = 0; 23 ret = 0;
24 *faulted_out = 0; 24 *faulted_out = 0;
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index 198e59163288..34bfc1bb9e38 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -120,7 +120,8 @@ static int not_dead_yet(char *dir)
120 120
121 dead = 0; 121 dead = 0;
122 fd = open(file, O_RDONLY); 122 fd = open(file, O_RDONLY);
123 if(fd < 0){ 123 if(fd < 0) {
124 fd = -errno;
124 if(fd != -ENOENT){ 125 if(fd != -ENOENT){
125 printk("not_dead_yet : couldn't open pid file '%s', " 126 printk("not_dead_yet : couldn't open pid file '%s', "
126 "err = %d\n", file, -fd); 127 "err = %d\n", file, -fd);
@@ -130,9 +131,13 @@ static int not_dead_yet(char *dir)
130 131
131 err = 0; 132 err = 0;
132 n = read(fd, pid, sizeof(pid)); 133 n = read(fd, pid, sizeof(pid));
133 if(n <= 0){ 134 if(n < 0){
135 printk("not_dead_yet : couldn't read pid file '%s', "
136 "err = %d\n", file, errno);
137 goto out_close;
138 } else if(n == 0){
134 printk("not_dead_yet : couldn't read pid file '%s', " 139 printk("not_dead_yet : couldn't read pid file '%s', "
135 "err = %d\n", file, -n); 140 "0-byte read\n", file);
136 goto out_close; 141 goto out_close;
137 } 142 }
138 143
@@ -155,9 +160,9 @@ static int not_dead_yet(char *dir)
155 160
156 return err; 161 return err;
157 162
158 out_close: 163out_close:
159 close(fd); 164 close(fd);
160 out: 165out:
161 return 0; 166 return 0;
162} 167}
163 168
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 8da6ab31152a..2598158e1f53 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -18,14 +18,19 @@ extern void *memmove(void *, const void *, size_t);
18extern void *memset(void *, int, size_t); 18extern void *memset(void *, int, size_t);
19extern int printf(const char *, ...); 19extern int printf(const char *, ...);
20 20
21/* If they're not defined, the export is included in lib/string.c.*/
22#ifdef __HAVE_ARCH_STRLEN
21EXPORT_SYMBOL(strlen); 23EXPORT_SYMBOL(strlen);
24#endif
25#ifdef __HAVE_ARCH_STRSTR
26EXPORT_SYMBOL(strstr);
27#endif
28
22EXPORT_SYMBOL(memcpy); 29EXPORT_SYMBOL(memcpy);
23EXPORT_SYMBOL(memmove); 30EXPORT_SYMBOL(memmove);
24EXPORT_SYMBOL(memset); 31EXPORT_SYMBOL(memset);
25EXPORT_SYMBOL(printf); 32EXPORT_SYMBOL(printf);
26 33
27EXPORT_SYMBOL(strstr);
28
29/* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. 34/* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
30 * However, the modules will use the CRC defined *here*, no matter if it is 35 * However, the modules will use the CRC defined *here*, no matter if it is
31 * good; so the versions of these symbols will always match 36 * good; so the versions of these symbols will always match
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index e32065e2fdc8..c47a2a7ce70e 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -104,7 +104,7 @@ void setup_hostinfo(void)
104int setjmp_wrapper(void (*proc)(void *, void *), ...) 104int setjmp_wrapper(void (*proc)(void *, void *), ...)
105{ 105{
106 va_list args; 106 va_list args;
107 sigjmp_buf buf; 107 jmp_buf buf;
108 int n; 108 int n;
109 109
110 n = sigsetjmp(buf, 1); 110 n = sigsetjmp(buf, 1);
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index b696b451774c..5e7a9c310aa5 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -9,10 +9,8 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
9 9
10$(USER_OBJS) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \ 10$(USER_OBJS) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \
11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) 11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@))
12$(USER_OBJS): cmd_checksrc = 12$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
13$(USER_OBJS): quiet_cmd_checksrc = 13 -Dunix -D__unix__ -D__$(SUBARCH)__
14$(USER_OBJS): cmd_force_checksrc =
15$(USER_OBJS): quiet_cmd_force_checksrc =
16 14
17 15
18# The stubs and unmap.o can't try to call mcount or update basic block data 16# The stubs and unmap.o can't try to call mcount or update basic block data
diff --git a/arch/um/sys-i386/ksyms.c b/arch/um/sys-i386/ksyms.c
index db524ab3f743..2a1eac1859ce 100644
--- a/arch/um/sys-i386/ksyms.c
+++ b/arch/um/sys-i386/ksyms.c
@@ -15,7 +15,3 @@ EXPORT_SYMBOL(__up_wakeup);
15 15
16/* Networking helper routines. */ 16/* Networking helper routines. */
17EXPORT_SYMBOL(csum_partial); 17EXPORT_SYMBOL(csum_partial);
18
19/* delay core functions */
20EXPORT_SYMBOL(__const_udelay);
21EXPORT_SYMBOL(__udelay);
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c
index 9f3bd8ed78f5..40aa88531446 100644
--- a/arch/um/sys-i386/ptrace_user.c
+++ b/arch/um/sys-i386/ptrace_user.c
@@ -57,7 +57,7 @@ static void write_debugregs(int pid, unsigned long *regs)
57 if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i], 57 if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i],
58 regs[i]) < 0) 58 regs[i]) < 0)
59 printk("write_debugregs - ptrace failed on " 59 printk("write_debugregs - ptrace failed on "
60 "register %d, value = 0x%x, errno = %d\n", i, 60 "register %d, value = 0x%lx, errno = %d\n", i,
61 regs[i], errno); 61 regs[i], errno);
62 } 62 }
63} 63}
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index f5d0e1c37ea2..0709fc6670c2 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
57 return(0); 57 return(0);
58} 58}
59 59
60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp, 60int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp,
61 struct pt_regs *regs, unsigned long sp) 61 struct pt_regs *regs, unsigned long sp)
62{ 62{
63 struct sigcontext sc; 63 struct sigcontext sc;
@@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
132 return(err); 132 return(err);
133} 133}
134 134
135int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp, 135int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp,
136 struct sigcontext *from, int fpsize, unsigned long sp) 136 struct sigcontext *from, int fpsize, unsigned long sp)
137{ 137{
138 struct _fpstate __user *to_fp; 138 struct _fpstate __user *to_fp;
@@ -147,7 +147,7 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp,
147 * delivery. The sp passed in is the original, and this needs 147 * delivery. The sp passed in is the original, and this needs
148 * to be restored, so we stick it in separately. 148 * to be restored, so we stick it in separately.
149 */ 149 */
150 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp)); 150 err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
151 151
152 if(from_fp != NULL){ 152 if(from_fp != NULL){
153 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 153 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
@@ -167,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
167 return(ret); 167 return(ret);
168} 168}
169 169
170static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp, 170static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp,
171 struct pt_regs *from, unsigned long sp) 171 struct pt_regs *from, unsigned long sp)
172{ 172{
173 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 173 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
index a37f672ec964..2355dc19c46c 100644
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -27,6 +27,6 @@ stub_segv_handler(int sig)
27 * the stack in its original form when we do the sigreturn here, by 27 * the stack in its original form when we do the sigreturn here, by
28 * hand. 28 * hand.
29 */ 29 */
30 __asm__("mov %0,%%esp ; movl %1, %%eax ; " 30 __asm__ __volatile__("mov %0,%%esp ; movl %1, %%eax ; "
31 "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); 31 "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
32} 32}
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c
index a3188e861cc7..71b9796258ef 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/um/sys-i386/tls.c
@@ -378,7 +378,7 @@ static int __init __setup_host_supports_tls(void) {
378 } else 378 } else
379 printk(KERN_ERR " Host TLS support NOT detected! " 379 printk(KERN_ERR " Host TLS support NOT detected! "
380 "TLS support inside UML will not work\n"); 380 "TLS support inside UML will not work\n");
381 return 1; 381 return 0;
382} 382}
383 383
384__initcall(__setup_host_supports_tls); 384__initcall(__setup_host_supports_tls);
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index e75c4e1838b0..a4c46a8af008 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -137,7 +137,7 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
137 * delivery. The sp passed in is the original, and this needs 137 * delivery. The sp passed in is the original, and this needs
138 * to be restored, so we stick it in separately. 138 * to be restored, so we stick it in separately.
139 */ 139 */
140 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp)); 140 err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
141 141
142 if(from_fp != NULL){ 142 if(from_fp != NULL){
143 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 143 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
index a27099533198..1c967026c957 100644
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -33,7 +33,7 @@ stub_segv_handler(int sig)
33 struct ucontext *uc; 33 struct ucontext *uc;
34 int pid; 34 int pid;
35 35
36 __asm__("movq %%rdx, %0" : "=g" (uc) :); 36 __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :);
37 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 37 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
38 &uc->uc_mcontext); 38 &uc->uc_mcontext);
39 39
@@ -44,8 +44,8 @@ stub_segv_handler(int sig)
44 * the signal frame. So, we use the ucontext pointer, which we know 44 * the signal frame. So, we use the ucontext pointer, which we know
45 * already, to get the signal frame pointer, and add 8 to that. 45 * already, to get the signal frame pointer, and add 8 to that.
46 */ 46 */
47 __asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": : 47 __asm__ __volatile__("movq %0, %%rsp; movq %1, %%rax ; syscall": :
48 "g" ((unsigned long) container_of(uc, struct rt_sigframe, 48 "g" ((unsigned long)
49 uc) + 8), 49 container_of(uc, struct rt_sigframe, uc) + 8),
50 "g" (__NR_rt_sigreturn)); 50 "g" (__NR_rt_sigreturn));
51} 51}
diff --git a/arch/v850/kernel/v850_ksyms.c b/arch/v850/kernel/v850_ksyms.c
index 8ffc29c1c89d..6bcfcfe88384 100644
--- a/arch/v850/kernel/v850_ksyms.c
+++ b/arch/v850/kernel/v850_ksyms.c
@@ -43,7 +43,6 @@ EXPORT_SYMBOL (strncmp);
43EXPORT_SYMBOL (strchr); 43EXPORT_SYMBOL (strchr);
44EXPORT_SYMBOL (strlen); 44EXPORT_SYMBOL (strlen);
45EXPORT_SYMBOL (strnlen); 45EXPORT_SYMBOL (strnlen);
46EXPORT_SYMBOL (strpbrk);
47EXPORT_SYMBOL (strrchr); 46EXPORT_SYMBOL (strrchr);
48EXPORT_SYMBOL (strstr); 47EXPORT_SYMBOL (strstr);
49EXPORT_SYMBOL (memset); 48EXPORT_SYMBOL (memset);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 4310b4a311a5..408d44a59756 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -136,6 +136,11 @@ config X86_L1_CACHE_SHIFT
136 default "7" if GENERIC_CPU || MPSC 136 default "7" if GENERIC_CPU || MPSC
137 default "6" if MK8 137 default "6" if MK8
138 138
139config X86_INTERNODE_CACHE_BYTES
140 int
141 default "4096" if X86_VSMP
142 default X86_L1_CACHE_BYTES if !X86_VSMP
143
139config X86_TSC 144config X86_TSC
140 bool 145 bool
141 default y 146 default y
@@ -283,6 +288,11 @@ config K8_NUMA
283 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA 288 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA
284 instead, which also takes priority if both are compiled in. 289 instead, which also takes priority if both are compiled in.
285 290
291config NODES_SHIFT
292 int
293 default "6"
294 depends on NEED_MULTIPLE_NODES
295
286# Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig. 296# Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig.
287 297
288config X86_64_ACPI_NUMA 298config X86_64_ACPI_NUMA
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 585fd4a559c8..e573e2ab5510 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -24,37 +24,37 @@
24LDFLAGS := -m elf_x86_64 24LDFLAGS := -m elf_x86_64
25OBJCOPYFLAGS := -O binary -R .note -R .comment -S 25OBJCOPYFLAGS := -O binary -R .note -R .comment -S
26LDFLAGS_vmlinux := 26LDFLAGS_vmlinux :=
27
28CHECKFLAGS += -D__x86_64__ -m64 27CHECKFLAGS += -D__x86_64__ -m64
29 28
29cflags-y :=
30cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) 30cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
31cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) 31cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
32cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic) 32cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
33CFLAGS += $(cflags-y)
34 33
35CFLAGS += -m64 34cflags-y += -m64
36CFLAGS += -mno-red-zone 35cflags-y += -mno-red-zone
37CFLAGS += -mcmodel=kernel 36cflags-y += -mcmodel=kernel
38CFLAGS += -pipe 37cflags-y += -pipe
39cflags-$(CONFIG_REORDER) += -ffunction-sections 38cflags-$(CONFIG_REORDER) += -ffunction-sections
40# this makes reading assembly source easier, but produces worse code 39# this makes reading assembly source easier, but produces worse code
41# actually it makes the kernel smaller too. 40# actually it makes the kernel smaller too.
42CFLAGS += -fno-reorder-blocks 41cflags-y += -fno-reorder-blocks
43CFLAGS += -Wno-sign-compare 42cflags-y += -Wno-sign-compare
44ifneq ($(CONFIG_UNWIND_INFO),y) 43ifneq ($(CONFIG_UNWIND_INFO),y)
45CFLAGS += -fno-asynchronous-unwind-tables 44cflags-y += -fno-asynchronous-unwind-tables
46endif 45endif
47ifneq ($(CONFIG_DEBUG_INFO),y) 46ifneq ($(CONFIG_DEBUG_INFO),y)
48# -fweb shrinks the kernel a bit, but the difference is very small 47# -fweb shrinks the kernel a bit, but the difference is very small
49# it also messes up debugging, so don't use it for now. 48# it also messes up debugging, so don't use it for now.
50#CFLAGS += $(call cc-option,-fweb) 49#cflags-y += $(call cc-option,-fweb)
51endif 50endif
52# -funit-at-a-time shrinks the kernel .text considerably 51# -funit-at-a-time shrinks the kernel .text considerably
53# unfortunately it makes reading oopses harder. 52# unfortunately it makes reading oopses harder.
54CFLAGS += $(call cc-option,-funit-at-a-time) 53cflags-y += $(call cc-option,-funit-at-a-time)
55# prevent gcc from generating any FP code by mistake 54# prevent gcc from generating any FP code by mistake
56CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) 55cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
57 56
57CFLAGS += $(cflags-y)
58AFLAGS += -m64 58AFLAGS += -m64
59 59
60head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o 60head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
diff --git a/arch/x86_64/boot/video.S b/arch/x86_64/boot/video.S
index 0587477c99f2..32327bb37aff 100644
--- a/arch/x86_64/boot/video.S
+++ b/arch/x86_64/boot/video.S
@@ -97,6 +97,7 @@
97#define PARAM_VESAPM_OFF 0x30 97#define PARAM_VESAPM_OFF 0x30
98#define PARAM_LFB_PAGES 0x32 98#define PARAM_LFB_PAGES 0x32
99#define PARAM_VESA_ATTRIB 0x34 99#define PARAM_VESA_ATTRIB 0x34
100#define PARAM_CAPABILITIES 0x36
100 101
101/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ 102/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
102#ifdef CONFIG_VIDEO_RETAIN 103#ifdef CONFIG_VIDEO_RETAIN
@@ -233,6 +234,10 @@ mopar_gr:
233 movw 18(%di), %ax 234 movw 18(%di), %ax
234 movl %eax, %fs:(PARAM_LFB_SIZE) 235 movl %eax, %fs:(PARAM_LFB_SIZE)
235 236
237# store mode capabilities
238 movl 10(%di), %eax
239 movl %eax, %fs:(PARAM_CAPABILITIES)
240
236# switching the DAC to 8-bit is for <= 8 bpp only 241# switching the DAC to 8-bit is for <= 8 bpp only
237 movw %fs:(PARAM_LFB_DEPTH), %ax 242 movw %fs:(PARAM_LFB_DEPTH), %ax
238 cmpw $8, %ax 243 cmpw $8, %ax
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 566ecc97ee5a..69db0c0721d1 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.16-git9 3# Linux kernel version: 2.6.17-rc1-git11
4# Sat Mar 25 15:18:40 2006 4# Sun Apr 16 07:22:36 2006
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -9,6 +9,7 @@ CONFIG_X86=y
9CONFIG_SEMAPHORE_SLEEPERS=y 9CONFIG_SEMAPHORE_SLEEPERS=y
10CONFIG_MMU=y 10CONFIG_MMU=y
11CONFIG_RWSEM_GENERIC_SPINLOCK=y 11CONFIG_RWSEM_GENERIC_SPINLOCK=y
12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_X86_CMPXCHG=y 14CONFIG_X86_CMPXCHG=y
14CONFIG_EARLY_PRINTK=y 15CONFIG_EARLY_PRINTK=y
@@ -55,11 +56,8 @@ CONFIG_BASE_FULL=y
55CONFIG_FUTEX=y 56CONFIG_FUTEX=y
56CONFIG_EPOLL=y 57CONFIG_EPOLL=y
57CONFIG_SHMEM=y 58CONFIG_SHMEM=y
58CONFIG_CC_ALIGN_FUNCTIONS=0
59CONFIG_CC_ALIGN_LABELS=0
60CONFIG_CC_ALIGN_LOOPS=0
61CONFIG_CC_ALIGN_JUMPS=0
62CONFIG_SLAB=y 59CONFIG_SLAB=y
60CONFIG_DOUBLEFAULT=y
63# CONFIG_TINY_SHMEM is not set 61# CONFIG_TINY_SHMEM is not set
64CONFIG_BASE_SMALL=0 62CONFIG_BASE_SMALL=0
65# CONFIG_SLOB is not set 63# CONFIG_SLOB is not set
@@ -70,7 +68,6 @@ CONFIG_BASE_SMALL=0
70CONFIG_MODULES=y 68CONFIG_MODULES=y
71CONFIG_MODULE_UNLOAD=y 69CONFIG_MODULE_UNLOAD=y
72CONFIG_MODULE_FORCE_UNLOAD=y 70CONFIG_MODULE_FORCE_UNLOAD=y
73CONFIG_OBSOLETE_MODPARM=y
74# CONFIG_MODVERSIONS is not set 71# CONFIG_MODVERSIONS is not set
75# CONFIG_MODULE_SRCVERSION_ALL is not set 72# CONFIG_MODULE_SRCVERSION_ALL is not set
76# CONFIG_KMOD is not set 73# CONFIG_KMOD is not set
@@ -81,6 +78,7 @@ CONFIG_STOP_MACHINE=y
81# 78#
82CONFIG_LBD=y 79CONFIG_LBD=y
83# CONFIG_BLK_DEV_IO_TRACE is not set 80# CONFIG_BLK_DEV_IO_TRACE is not set
81# CONFIG_LSF is not set
84 82
85# 83#
86# IO Schedulers 84# IO Schedulers
@@ -105,6 +103,7 @@ CONFIG_X86_PC=y
105CONFIG_GENERIC_CPU=y 103CONFIG_GENERIC_CPU=y
106CONFIG_X86_L1_CACHE_BYTES=128 104CONFIG_X86_L1_CACHE_BYTES=128
107CONFIG_X86_L1_CACHE_SHIFT=7 105CONFIG_X86_L1_CACHE_SHIFT=7
106CONFIG_X86_INTERNODE_CACHE_BYTES=128
108CONFIG_X86_TSC=y 107CONFIG_X86_TSC=y
109CONFIG_X86_GOOD_APIC=y 108CONFIG_X86_GOOD_APIC=y
110# CONFIG_MICROCODE is not set 109# CONFIG_MICROCODE is not set
@@ -116,12 +115,14 @@ CONFIG_X86_LOCAL_APIC=y
116CONFIG_MTRR=y 115CONFIG_MTRR=y
117CONFIG_SMP=y 116CONFIG_SMP=y
118CONFIG_SCHED_SMT=y 117CONFIG_SCHED_SMT=y
118CONFIG_SCHED_MC=y
119# CONFIG_PREEMPT_NONE is not set 119# CONFIG_PREEMPT_NONE is not set
120CONFIG_PREEMPT_VOLUNTARY=y 120CONFIG_PREEMPT_VOLUNTARY=y
121# CONFIG_PREEMPT is not set 121# CONFIG_PREEMPT is not set
122CONFIG_PREEMPT_BKL=y 122CONFIG_PREEMPT_BKL=y
123CONFIG_NUMA=y 123CONFIG_NUMA=y
124CONFIG_K8_NUMA=y 124CONFIG_K8_NUMA=y
125CONFIG_NODES_SHIFT=6
125CONFIG_X86_64_ACPI_NUMA=y 126CONFIG_X86_64_ACPI_NUMA=y
126CONFIG_NUMA_EMU=y 127CONFIG_NUMA_EMU=y
127CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 128CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
@@ -138,6 +139,7 @@ CONFIG_NEED_MULTIPLE_NODES=y
138CONFIG_SPLIT_PTLOCK_CPUS=4 139CONFIG_SPLIT_PTLOCK_CPUS=4
139CONFIG_MIGRATION=y 140CONFIG_MIGRATION=y
140CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 141CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
142CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y
141CONFIG_NR_CPUS=32 143CONFIG_NR_CPUS=32
142CONFIG_HOTPLUG_CPU=y 144CONFIG_HOTPLUG_CPU=y
143CONFIG_HPET_TIMER=y 145CONFIG_HPET_TIMER=y
@@ -289,6 +291,7 @@ CONFIG_IP_PNP_DHCP=y
289# CONFIG_INET_AH is not set 291# CONFIG_INET_AH is not set
290# CONFIG_INET_ESP is not set 292# CONFIG_INET_ESP is not set
291# CONFIG_INET_IPCOMP is not set 293# CONFIG_INET_IPCOMP is not set
294# CONFIG_INET_XFRM_TUNNEL is not set
292# CONFIG_INET_TUNNEL is not set 295# CONFIG_INET_TUNNEL is not set
293CONFIG_INET_DIAG=y 296CONFIG_INET_DIAG=y
294CONFIG_INET_TCP_DIAG=y 297CONFIG_INET_TCP_DIAG=y
@@ -300,6 +303,7 @@ CONFIG_IPV6=y
300# CONFIG_INET6_AH is not set 303# CONFIG_INET6_AH is not set
301# CONFIG_INET6_ESP is not set 304# CONFIG_INET6_ESP is not set
302# CONFIG_INET6_IPCOMP is not set 305# CONFIG_INET6_IPCOMP is not set
306# CONFIG_INET6_XFRM_TUNNEL is not set
303# CONFIG_INET6_TUNNEL is not set 307# CONFIG_INET6_TUNNEL is not set
304# CONFIG_IPV6_TUNNEL is not set 308# CONFIG_IPV6_TUNNEL is not set
305# CONFIG_NETFILTER is not set 309# CONFIG_NETFILTER is not set
@@ -542,7 +546,6 @@ CONFIG_SCSI_SATA_INTEL_COMBINED=y
542# CONFIG_SCSI_INIA100 is not set 546# CONFIG_SCSI_INIA100 is not set
543# CONFIG_SCSI_SYM53C8XX_2 is not set 547# CONFIG_SCSI_SYM53C8XX_2 is not set
544# CONFIG_SCSI_IPR is not set 548# CONFIG_SCSI_IPR is not set
545# CONFIG_SCSI_QLOGIC_FC is not set
546# CONFIG_SCSI_QLOGIC_1280 is not set 549# CONFIG_SCSI_QLOGIC_1280 is not set
547# CONFIG_SCSI_QLA_FC is not set 550# CONFIG_SCSI_QLA_FC is not set
548# CONFIG_SCSI_LPFC is not set 551# CONFIG_SCSI_LPFC is not set
@@ -704,7 +707,6 @@ CONFIG_S2IO=m
704# Wireless LAN (non-hamradio) 707# Wireless LAN (non-hamradio)
705# 708#
706# CONFIG_NET_RADIO is not set 709# CONFIG_NET_RADIO is not set
707# CONFIG_NET_WIRELESS_RTNETLINK is not set
708 710
709# 711#
710# Wan interfaces 712# Wan interfaces
@@ -791,7 +793,7 @@ CONFIG_HW_CONSOLE=y
791# 793#
792CONFIG_SERIAL_8250=y 794CONFIG_SERIAL_8250=y
793CONFIG_SERIAL_8250_CONSOLE=y 795CONFIG_SERIAL_8250_CONSOLE=y
794# CONFIG_SERIAL_8250_ACPI is not set 796CONFIG_SERIAL_8250_PCI=y
795CONFIG_SERIAL_8250_NR_UARTS=4 797CONFIG_SERIAL_8250_NR_UARTS=4
796CONFIG_SERIAL_8250_RUNTIME_UARTS=4 798CONFIG_SERIAL_8250_RUNTIME_UARTS=4
797# CONFIG_SERIAL_8250_EXTENDED is not set 799# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -921,6 +923,7 @@ CONFIG_HWMON=y
921# Digital Video Broadcasting Devices 923# Digital Video Broadcasting Devices
922# 924#
923# CONFIG_DVB is not set 925# CONFIG_DVB is not set
926# CONFIG_USB_DABUSB is not set
924 927
925# 928#
926# Graphics support 929# Graphics support
@@ -932,6 +935,8 @@ CONFIG_VIDEO_SELECT=y
932# Console display driver support 935# Console display driver support
933# 936#
934CONFIG_VGA_CONSOLE=y 937CONFIG_VGA_CONSOLE=y
938CONFIG_VGACON_SOFT_SCROLLBACK=y
939CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256
935CONFIG_DUMMY_CONSOLE=y 940CONFIG_DUMMY_CONSOLE=y
936 941
937# 942#
@@ -1041,9 +1046,7 @@ CONFIG_USB_HIDINPUT=y
1041# CONFIG_USB_ACECAD is not set 1046# CONFIG_USB_ACECAD is not set
1042# CONFIG_USB_KBTAB is not set 1047# CONFIG_USB_KBTAB is not set
1043# CONFIG_USB_POWERMATE is not set 1048# CONFIG_USB_POWERMATE is not set
1044# CONFIG_USB_MTOUCH is not set 1049# CONFIG_USB_TOUCHSCREEN is not set
1045# CONFIG_USB_ITMTOUCH is not set
1046# CONFIG_USB_EGALAX is not set
1047# CONFIG_USB_YEALINK is not set 1050# CONFIG_USB_YEALINK is not set
1048# CONFIG_USB_XPAD is not set 1051# CONFIG_USB_XPAD is not set
1049# CONFIG_USB_ATI_REMOTE is not set 1052# CONFIG_USB_ATI_REMOTE is not set
@@ -1058,15 +1061,6 @@ CONFIG_USB_HIDINPUT=y
1058# CONFIG_USB_MICROTEK is not set 1061# CONFIG_USB_MICROTEK is not set
1059 1062
1060# 1063#
1061# USB Multimedia devices
1062#
1063# CONFIG_USB_DABUSB is not set
1064
1065#
1066# Video4Linux support is needed for USB Multimedia device support
1067#
1068
1069#
1070# USB Network Adapters 1064# USB Network Adapters
1071# 1065#
1072# CONFIG_USB_CATC is not set 1066# CONFIG_USB_CATC is not set
@@ -1118,9 +1112,23 @@ CONFIG_USB_MON=y
1118# CONFIG_MMC is not set 1112# CONFIG_MMC is not set
1119 1113
1120# 1114#
1115# LED devices
1116#
1117# CONFIG_NEW_LEDS is not set
1118
1119#
1120# LED drivers
1121#
1122
1123#
1124# LED Triggers
1125#
1126
1127#
1121# InfiniBand support 1128# InfiniBand support
1122# 1129#
1123# CONFIG_INFINIBAND is not set 1130# CONFIG_INFINIBAND is not set
1131# CONFIG_IPATH_CORE is not set
1124 1132
1125# 1133#
1126# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1134# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -1128,6 +1136,11 @@ CONFIG_USB_MON=y
1128# CONFIG_EDAC is not set 1136# CONFIG_EDAC is not set
1129 1137
1130# 1138#
1139# Real Time Clock
1140#
1141# CONFIG_RTC_CLASS is not set
1142
1143#
1131# Firmware Drivers 1144# Firmware Drivers
1132# 1145#
1133# CONFIG_EDD is not set 1146# CONFIG_EDD is not set
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 35b2faccdc6c..57fc37e0fb9c 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -15,6 +15,8 @@
15#include <asm/vsyscall32.h> 15#include <asm/vsyscall32.h>
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17 17
18#define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8)
19
18 .macro IA32_ARG_FIXUP noebp=0 20 .macro IA32_ARG_FIXUP noebp=0
19 movl %edi,%r8d 21 movl %edi,%r8d
20 .if \noebp 22 .if \noebp
@@ -109,8 +111,8 @@ ENTRY(ia32_sysenter_target)
109 CFI_REMEMBER_STATE 111 CFI_REMEMBER_STATE
110 jnz sysenter_tracesys 112 jnz sysenter_tracesys
111sysenter_do_call: 113sysenter_do_call:
112 cmpl $(IA32_NR_syscalls),%eax 114 cmpl $(IA32_NR_syscalls-1),%eax
113 jae ia32_badsys 115 ja ia32_badsys
114 IA32_ARG_FIXUP 1 116 IA32_ARG_FIXUP 1
115 call *ia32_sys_call_table(,%rax,8) 117 call *ia32_sys_call_table(,%rax,8)
116 movq %rax,RAX-ARGOFFSET(%rsp) 118 movq %rax,RAX-ARGOFFSET(%rsp)
@@ -210,8 +212,8 @@ ENTRY(ia32_cstar_target)
210 CFI_REMEMBER_STATE 212 CFI_REMEMBER_STATE
211 jnz cstar_tracesys 213 jnz cstar_tracesys
212cstar_do_call: 214cstar_do_call:
213 cmpl $IA32_NR_syscalls,%eax 215 cmpl $IA32_NR_syscalls-1,%eax
214 jae ia32_badsys 216 ja ia32_badsys
215 IA32_ARG_FIXUP 1 217 IA32_ARG_FIXUP 1
216 call *ia32_sys_call_table(,%rax,8) 218 call *ia32_sys_call_table(,%rax,8)
217 movq %rax,RAX-ARGOFFSET(%rsp) 219 movq %rax,RAX-ARGOFFSET(%rsp)
@@ -296,8 +298,8 @@ ENTRY(ia32_syscall)
296 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 298 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
297 jnz ia32_tracesys 299 jnz ia32_tracesys
298ia32_do_syscall: 300ia32_do_syscall:
299 cmpl $(IA32_NR_syscalls),%eax 301 cmpl $(IA32_NR_syscalls-1),%eax
300 jae ia32_badsys 302 ja ia32_badsys
301 IA32_ARG_FIXUP 303 IA32_ARG_FIXUP
302 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative 304 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
303ia32_sysret: 305ia32_sysret:
@@ -685,12 +687,12 @@ ia32_sys_call_table:
685 .quad sys_readlinkat /* 305 */ 687 .quad sys_readlinkat /* 305 */
686 .quad sys_fchmodat 688 .quad sys_fchmodat
687 .quad sys_faccessat 689 .quad sys_faccessat
688 .quad sys_ni_syscall /* pselect6 for now */ 690 .quad quiet_ni_syscall /* pselect6 for now */
689 .quad sys_ni_syscall /* ppoll for now */ 691 .quad quiet_ni_syscall /* ppoll for now */
690 .quad sys_unshare /* 310 */ 692 .quad sys_unshare /* 310 */
691 .quad compat_sys_set_robust_list 693 .quad compat_sys_set_robust_list
692 .quad compat_sys_get_robust_list 694 .quad compat_sys_get_robust_list
695 .quad sys_splice
696 .quad sys_sync_file_range
697 .quad sys_tee
693ia32_syscall_end: 698ia32_syscall_end:
694 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
695 .quad ni_syscall
696 .endr
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index a098a11e7755..059c88313f4e 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -8,7 +8,7 @@ obj-y := process.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
9 x8664_ksyms.o i387.o syscall.o vsyscall.o \ 9 x8664_ksyms.o i387.o syscall.o vsyscall.o \
10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \ 10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
11 dmi_scan.o pci-dma.o pci-nommu.o 11 pci-dma.o pci-nommu.o
12 12
13obj-$(CONFIG_X86_MCE) += mce.o 13obj-$(CONFIG_X86_MCE) += mce.o
14obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 14obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
@@ -49,5 +49,3 @@ intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
49quirks-y += ../../i386/kernel/quirks.o 49quirks-y += ../../i386/kernel/quirks.o
50i8237-y += ../../i386/kernel/i8237.o 50i8237-y += ../../i386/kernel/i8237.o
51msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 51msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
52dmi_scan-y += ../../i386/kernel/dmi_scan.o
53
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index fffd6b0a2fab..70b9d21ed675 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -80,7 +80,7 @@ static int __init aperture_valid(char *name, u64 aper_base, u32 aper_size)
80 printk("Aperture from %s beyond 4GB. Ignoring.\n",name); 80 printk("Aperture from %s beyond 4GB. Ignoring.\n",name);
81 return 0; 81 return 0;
82 } 82 }
83 if (e820_mapped(aper_base, aper_base + aper_size, E820_RAM)) { 83 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
84 printk("Aperture from %s pointing to e820 RAM. Ignoring.\n",name); 84 printk("Aperture from %s pointing to e820 RAM. Ignoring.\n",name);
85 return 0; 85 return 0;
86 } 86 }
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 293cd71a266a..62776c07cff1 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -80,7 +80,12 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
80 return 0; 80 return 0;
81} 81}
82 82
83int __init e820_mapped(unsigned long start, unsigned long end, unsigned type) 83/*
84 * This function checks if any part of the range <start,end> is mapped
85 * with type.
86 */
87int __meminit
88e820_any_mapped(unsigned long start, unsigned long end, unsigned type)
84{ 89{
85 int i; 90 int i;
86 for (i = 0; i < e820.nr_map; i++) { 91 for (i = 0; i < e820.nr_map; i++) {
@@ -94,6 +99,35 @@ int __init e820_mapped(unsigned long start, unsigned long end, unsigned type)
94 return 0; 99 return 0;
95} 100}
96 101
102/*
103 * This function checks if the entire range <start,end> is mapped with type.
104 *
105 * Note: this function only works correct if the e820 table is sorted and
106 * not-overlapping, which is the case
107 */
108int __init e820_all_mapped(unsigned long start, unsigned long end, unsigned type)
109{
110 int i;
111 for (i = 0; i < e820.nr_map; i++) {
112 struct e820entry *ei = &e820.map[i];
113 if (type && ei->type != type)
114 continue;
115 /* is the region (part) in overlap with the current region ?*/
116 if (ei->addr >= end || ei->addr + ei->size <= start)
117 continue;
118
119 /* if the region is at the beginning of <start,end> we move
120 * start to the end of the region since it's ok until there
121 */
122 if (ei->addr <= start)
123 start = ei->addr + ei->size;
124 /* if start is now at or beyond end, we're done, full coverage */
125 if (start >= end)
126 return 1; /* we're done */
127 }
128 return 0;
129}
130
97/* 131/*
98 * Find a free area in a specific range. 132 * Find a free area in a specific range.
99 */ 133 */
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 8538bfea30e6..c946e4fe67a7 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -180,6 +180,10 @@ rff_trace:
180 * 180 *
181 * XXX if we had a free scratch register we could save the RSP into the stack frame 181 * XXX if we had a free scratch register we could save the RSP into the stack frame
182 * and report it properly in ps. Unfortunately we haven't. 182 * and report it properly in ps. Unfortunately we haven't.
183 *
184 * When user can change the frames always force IRET. That is because
185 * it deals with uncanonical addresses better. SYSRET has trouble
186 * with them due to bugs in both AMD and Intel CPUs.
183 */ 187 */
184 188
185ENTRY(system_call) 189ENTRY(system_call)
@@ -254,7 +258,10 @@ sysret_signal:
254 xorl %esi,%esi # oldset -> arg2 258 xorl %esi,%esi # oldset -> arg2
255 call ptregscall_common 259 call ptregscall_common
2561: movl $_TIF_NEED_RESCHED,%edi 2601: movl $_TIF_NEED_RESCHED,%edi
257 jmp sysret_check 261 /* Use IRET because user could have changed frame. This
262 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
263 cli
264 jmp int_with_check
258 265
259badsys: 266badsys:
260 movq $-ENOSYS,RAX-ARGOFFSET(%rsp) 267 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
@@ -280,7 +287,8 @@ tracesys:
280 call syscall_trace_leave 287 call syscall_trace_leave
281 RESTORE_TOP_OF_STACK %rbx 288 RESTORE_TOP_OF_STACK %rbx
282 RESTORE_REST 289 RESTORE_REST
283 jmp ret_from_sys_call 290 /* Use IRET because user could have changed frame */
291 jmp int_ret_from_sys_call
284 CFI_ENDPROC 292 CFI_ENDPROC
285 293
286/* 294/*
@@ -408,25 +416,9 @@ ENTRY(stub_execve)
408 CFI_ADJUST_CFA_OFFSET -8 416 CFI_ADJUST_CFA_OFFSET -8
409 CFI_REGISTER rip, r11 417 CFI_REGISTER rip, r11
410 SAVE_REST 418 SAVE_REST
411 movq %r11, %r15
412 CFI_REGISTER rip, r15
413 FIXUP_TOP_OF_STACK %r11 419 FIXUP_TOP_OF_STACK %r11
414 call sys_execve 420 call sys_execve
415 GET_THREAD_INFO(%rcx)
416 bt $TIF_IA32,threadinfo_flags(%rcx)
417 CFI_REMEMBER_STATE
418 jc exec_32bit
419 RESTORE_TOP_OF_STACK %r11 421 RESTORE_TOP_OF_STACK %r11
420 movq %r15, %r11
421 CFI_REGISTER rip, r11
422 RESTORE_REST
423 pushq %r11
424 CFI_ADJUST_CFA_OFFSET 8
425 CFI_REL_OFFSET rip, 0
426 ret
427
428exec_32bit:
429 CFI_RESTORE_STATE
430 movq %rax,RAX(%rsp) 422 movq %rax,RAX(%rsp)
431 RESTORE_REST 423 RESTORE_REST
432 jmp int_ret_from_sys_call 424 jmp int_ret_from_sys_call
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index accbff3fec49..1eaa5dae6174 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -53,7 +53,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
53/* 53/*
54 * returns non-zero if opcode modifies the interrupt flag. 54 * returns non-zero if opcode modifies the interrupt flag.
55 */ 55 */
56static inline int is_IF_modifier(kprobe_opcode_t *insn) 56static __always_inline int is_IF_modifier(kprobe_opcode_t *insn)
57{ 57{
58 switch (*insn) { 58 switch (*insn) {
59 case 0xfa: /* cli */ 59 case 0xfa: /* cli */
@@ -84,7 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
84 * If it does, return the address of the 32-bit displacement word. 84 * If it does, return the address of the 32-bit displacement word.
85 * If not, return null. 85 * If not, return null.
86 */ 86 */
87static inline s32 *is_riprel(u8 *insn) 87static s32 __kprobes *is_riprel(u8 *insn)
88{ 88{
89#define W(row,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf) \ 89#define W(row,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf) \
90 (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ 90 (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \
@@ -229,7 +229,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
229 mutex_unlock(&kprobe_mutex); 229 mutex_unlock(&kprobe_mutex);
230} 230}
231 231
232static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 232static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
233{ 233{
234 kcb->prev_kprobe.kp = kprobe_running(); 234 kcb->prev_kprobe.kp = kprobe_running();
235 kcb->prev_kprobe.status = kcb->kprobe_status; 235 kcb->prev_kprobe.status = kcb->kprobe_status;
@@ -237,7 +237,7 @@ static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
237 kcb->prev_kprobe.saved_rflags = kcb->kprobe_saved_rflags; 237 kcb->prev_kprobe.saved_rflags = kcb->kprobe_saved_rflags;
238} 238}
239 239
240static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) 240static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
241{ 241{
242 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 242 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
243 kcb->kprobe_status = kcb->prev_kprobe.status; 243 kcb->kprobe_status = kcb->prev_kprobe.status;
@@ -245,7 +245,7 @@ static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
245 kcb->kprobe_saved_rflags = kcb->prev_kprobe.saved_rflags; 245 kcb->kprobe_saved_rflags = kcb->prev_kprobe.saved_rflags;
246} 246}
247 247
248static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, 248static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
249 struct kprobe_ctlblk *kcb) 249 struct kprobe_ctlblk *kcb)
250{ 250{
251 __get_cpu_var(current_kprobe) = p; 251 __get_cpu_var(current_kprobe) = p;
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 10b3e348fc99..6f0790e8b6d3 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -29,6 +29,8 @@
29#define MISC_MCELOG_MINOR 227 29#define MISC_MCELOG_MINOR 227
30#define NR_BANKS 6 30#define NR_BANKS 6
31 31
32atomic_t mce_entry;
33
32static int mce_dont_init; 34static int mce_dont_init;
33 35
34/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic, 36/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic,
@@ -172,10 +174,12 @@ void do_machine_check(struct pt_regs * regs, long error_code)
172 int i; 174 int i;
173 int panicm_found = 0; 175 int panicm_found = 0;
174 176
177 atomic_inc(&mce_entry);
178
175 if (regs) 179 if (regs)
176 notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL); 180 notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL);
177 if (!banks) 181 if (!banks)
178 return; 182 goto out2;
179 183
180 memset(&m, 0, sizeof(struct mce)); 184 memset(&m, 0, sizeof(struct mce));
181 m.cpu = safe_smp_processor_id(); 185 m.cpu = safe_smp_processor_id();
@@ -266,6 +270,8 @@ void do_machine_check(struct pt_regs * regs, long error_code)
266 out: 270 out:
267 /* Last thing done in the machine check exception to clear state. */ 271 /* Last thing done in the machine check exception to clear state. */
268 wrmsrl(MSR_IA32_MCG_STATUS, 0); 272 wrmsrl(MSR_IA32_MCG_STATUS, 0);
273 out2:
274 atomic_dec(&mce_entry);
269} 275}
270 276
271/* 277/*
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index d9e4067faf05..4e6357fe0ec3 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -34,6 +34,7 @@
34#include <asm/proto.h> 34#include <asm/proto.h>
35#include <asm/kdebug.h> 35#include <asm/kdebug.h>
36#include <asm/local.h> 36#include <asm/local.h>
37#include <asm/mce.h>
37 38
38/* 39/*
39 * lapic_nmi_owner tracks the ownership of the lapic NMI hardware: 40 * lapic_nmi_owner tracks the ownership of the lapic NMI hardware:
@@ -480,6 +481,12 @@ void __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
480 __get_cpu_var(nmi_touch) = 0; 481 __get_cpu_var(nmi_touch) = 0;
481 touched = 1; 482 touched = 1;
482 } 483 }
484#ifdef CONFIG_X86_MCE
485 /* Could check oops_in_progress here too, but it's safer
486 not too */
487 if (atomic_read(&mce_entry) > 0)
488 touched = 1;
489#endif
483 if (!touched && __get_cpu_var(last_irq_sum) == sum) { 490 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
484 /* 491 /*
485 * Ayiee, looks like this CPU is stuck ... 492 * Ayiee, looks like this CPU is stuck ...
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 03c9eeedb0f3..af035ede70cd 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -48,9 +48,11 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
48{ 48{
49 struct page *page; 49 struct page *page;
50 int node; 50 int node;
51#ifdef CONFIG_PCI
51 if (dev->bus == &pci_bus_type) 52 if (dev->bus == &pci_bus_type)
52 node = pcibus_to_node(to_pci_dev(dev)->bus); 53 node = pcibus_to_node(to_pci_dev(dev)->bus);
53 else 54 else
55#endif
54 node = numa_node_id(); 56 node = numa_node_id();
55 page = alloc_pages_node(node, gfp, order); 57 page = alloc_pages_node(node, gfp, order);
56 return page ? page_address(page) : NULL; 58 return page ? page_address(page) : NULL;
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 70dd8e5c6889..fb903e65e079 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -575,8 +575,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
575 prev->userrsp = read_pda(oldrsp); 575 prev->userrsp = read_pda(oldrsp);
576 write_pda(oldrsp, next->userrsp); 576 write_pda(oldrsp, next->userrsp);
577 write_pda(pcurrent, next_p); 577 write_pda(pcurrent, next_p);
578
578 /* This must be here to ensure both math_state_restore() and 579 /* This must be here to ensure both math_state_restore() and
579 kernel_fpu_begin() work consistently. */ 580 kernel_fpu_begin() work consistently.
581 And the AMD workaround requires it to be after DS reload. */
580 unlazy_fpu(prev_p); 582 unlazy_fpu(prev_p);
581 write_pda(kernelstack, 583 write_pda(kernelstack,
582 task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); 584 task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
@@ -781,10 +783,16 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
781 } 783 }
782 case ARCH_GET_GS: { 784 case ARCH_GET_GS: {
783 unsigned long base; 785 unsigned long base;
786 unsigned gsindex;
784 if (task->thread.gsindex == GS_TLS_SEL) 787 if (task->thread.gsindex == GS_TLS_SEL)
785 base = read_32bit_tls(task, GS_TLS); 788 base = read_32bit_tls(task, GS_TLS);
786 else if (doit) 789 else if (doit) {
787 rdmsrl(MSR_KERNEL_GS_BASE, base); 790 asm("movl %%gs,%0" : "=r" (gsindex));
791 if (gsindex)
792 rdmsrl(MSR_KERNEL_GS_BASE, base);
793 else
794 base = task->thread.gs;
795 }
788 else 796 else
789 base = task->thread.gs; 797 base = task->thread.gs;
790 ret = put_user(base, (unsigned long __user *)addr); 798 ret = put_user(base, (unsigned long __user *)addr);
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index d44b2c1e63a6..da8e7903d817 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -274,11 +274,6 @@ static int putreg(struct task_struct *child,
274 return -EIO; 274 return -EIO;
275 value &= 0xffff; 275 value &= 0xffff;
276 break; 276 break;
277 case offsetof(struct user_regs_struct, rip):
278 /* Check if the new RIP address is canonical */
279 if (value >= TASK_SIZE_OF(child))
280 return -EIO;
281 break;
282 } 277 }
283 put_stack_long(child, regno - sizeof(struct pt_regs), value); 278 put_stack_long(child, regno - sizeof(struct pt_regs), value);
284 return 0; 279 return 0;
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 0856ad444f90..759070c82751 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -353,8 +353,10 @@ static __init void parse_cmdline_early (char ** cmdline_p)
353 if (fullarg(from, "enable_timer_pin_1")) 353 if (fullarg(from, "enable_timer_pin_1"))
354 disable_timer_pin_1 = -1; 354 disable_timer_pin_1 = -1;
355 355
356 if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) 356 if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) {
357 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
357 disable_apic = 1; 358 disable_apic = 1;
359 }
358 360
359 if (fullarg(from, "noapic")) 361 if (fullarg(from, "noapic"))
360 skip_ioapic_setup = 1; 362 skip_ioapic_setup = 1;
@@ -928,6 +930,10 @@ static int __init init_amd(struct cpuinfo_x86 *c)
928 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) 930 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58))
929 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); 931 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
930 932
933 /* Enable workaround for FXSAVE leak */
934 if (c->x86 >= 6)
935 set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability);
936
931 r = get_model_name(c); 937 r = get_model_name(c);
932 if (!r) { 938 if (!r) {
933 switch (c->x86) { 939 switch (c->x86) {
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index ef8bc46dc140..7392570f975d 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -726,7 +726,7 @@ static __init int late_hpet_init(void)
726 unsigned int ntimer; 726 unsigned int ntimer;
727 727
728 if (!vxtime.hpet_address) 728 if (!vxtime.hpet_address)
729 return -1; 729 return 0;
730 730
731 memset(&hd, 0, sizeof (hd)); 731 memset(&hd, 0, sizeof (hd));
732 732
@@ -917,6 +917,8 @@ void __init time_init(void)
917 vxtime.hpet_address = 0; 917 vxtime.hpet_address = 0;
918 918
919 if (hpet_use_timer) { 919 if (hpet_use_timer) {
920 /* set tick_nsec to use the proper rate for HPET */
921 tick_nsec = TICK_NSEC_HPET;
920 cpu_khz = hpet_calibrate_tsc(); 922 cpu_khz = hpet_calibrate_tsc();
921 timename = "HPET"; 923 timename = "HPET";
922#ifdef CONFIG_X86_PM_TIMER 924#ifdef CONFIG_X86_PM_TIMER
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 6bda322d3caf..2700b1375c1f 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31#include <linux/nmi.h> 31#include <linux/nmi.h>
32#include <linux/kprobes.h> 32#include <linux/kprobes.h>
33#include <linux/kexec.h>
33 34
34#include <asm/system.h> 35#include <asm/system.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
@@ -433,6 +434,8 @@ void __kprobes __die(const char * str, struct pt_regs * regs, long err)
433 printk(KERN_ALERT "RIP "); 434 printk(KERN_ALERT "RIP ");
434 printk_address(regs->rip); 435 printk_address(regs->rip);
435 printk(" RSP <%016lx>\n", regs->rsp); 436 printk(" RSP <%016lx>\n", regs->rsp);
437 if (kexec_should_crash(current))
438 crash_kexec(regs);
436} 439}
437 440
438void die(const char * str, struct pt_regs * regs, long err) 441void die(const char * str, struct pt_regs * regs, long err)
@@ -455,6 +458,8 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs)
455 */ 458 */
456 printk(str, safe_smp_processor_id()); 459 printk(str, safe_smp_processor_id());
457 show_registers(regs); 460 show_registers(regs);
461 if (kexec_should_crash(current))
462 crash_kexec(regs);
458 if (panic_on_timeout || panic_on_oops) 463 if (panic_on_timeout || panic_on_oops)
459 panic("nmi watchdog"); 464 panic("nmi watchdog");
460 printk("console shuts up ...\n"); 465 printk("console shuts up ...\n");
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 39ff0708f803..b81f473c4a19 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -65,7 +65,7 @@ SECTIONS
65 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { 65 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
66 *(.data.cacheline_aligned) 66 *(.data.cacheline_aligned)
67 } 67 }
68 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); 68 . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
69 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { 69 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
70 *(.data.read_mostly) 70 *(.data.read_mostly)
71 } 71 }
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index d78f46056bda..1def21c9f7cd 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -112,7 +112,6 @@ EXPORT_SYMBOL_GPL(unset_nmi_callback);
112#undef memcpy 112#undef memcpy
113#undef memset 113#undef memset
114#undef memmove 114#undef memmove
115#undef strlen
116 115
117extern void * memset(void *,int,__kernel_size_t); 116extern void * memset(void *,int,__kernel_size_t);
118extern size_t strlen(const char *); 117extern size_t strlen(const char *);
@@ -121,8 +120,6 @@ extern void * memcpy(void *,const void *,__kernel_size_t);
121extern void * __memcpy(void *,const void *,__kernel_size_t); 120extern void * __memcpy(void *,const void *,__kernel_size_t);
122 121
123EXPORT_SYMBOL(memset); 122EXPORT_SYMBOL(memset);
124EXPORT_SYMBOL(strlen);
125EXPORT_SYMBOL(strpbrk);
126EXPORT_SYMBOL(memmove); 123EXPORT_SYMBOL(memmove);
127EXPORT_SYMBOL(memcpy); 124EXPORT_SYMBOL(memcpy);
128EXPORT_SYMBOL(__memcpy); 125EXPORT_SYMBOL(__memcpy);
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index e5f7f1c34462..4ba34e95d835 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -305,7 +305,7 @@ static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned
305 if (paddr >= end) 305 if (paddr >= end)
306 break; 306 break;
307 307
308 if (!after_bootmem && !e820_mapped(paddr, paddr+PUD_SIZE, 0)) { 308 if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) {
309 set_pud(pud, __pud(0)); 309 set_pud(pud, __pud(0));
310 continue; 310 continue;
311 } 311 }
@@ -507,9 +507,8 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
507 507
508/* 508/*
509 * Memory hotplug specific functions 509 * Memory hotplug specific functions
510 * These are only for non-NUMA machines right now.
511 */ 510 */
512#ifdef CONFIG_MEMORY_HOTPLUG 511#if defined(CONFIG_ACPI_HOTPLUG_MEMORY) || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
513 512
514void online_page(struct page *page) 513void online_page(struct page *page)
515{ 514{
@@ -520,6 +519,38 @@ void online_page(struct page *page)
520 num_physpages++; 519 num_physpages++;
521} 520}
522 521
522#ifndef CONFIG_MEMORY_HOTPLUG
523/*
524 * Memory Hotadd without sparsemem. The mem_maps have been allocated in advance,
525 * just online the pages.
526 */
527int __add_pages(struct zone *z, unsigned long start_pfn, unsigned long nr_pages)
528{
529 int err = -EIO;
530 unsigned long pfn;
531 unsigned long total = 0, mem = 0;
532 for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) {
533 if (pfn_valid(pfn)) {
534 online_page(pfn_to_page(pfn));
535 err = 0;
536 mem++;
537 }
538 total++;
539 }
540 if (!err) {
541 z->spanned_pages += total;
542 z->present_pages += mem;
543 z->zone_pgdat->node_spanned_pages += total;
544 z->zone_pgdat->node_present_pages += mem;
545 }
546 return err;
547}
548#endif
549
550/*
551 * Memory is added always to NORMAL zone. This means you will never get
552 * additional DMA/DMA32 memory.
553 */
523int add_memory(u64 start, u64 size) 554int add_memory(u64 start, u64 size)
524{ 555{
525 struct pglist_data *pgdat = NODE_DATA(0); 556 struct pglist_data *pgdat = NODE_DATA(0);
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 4be82d6e2b48..cc02573a3271 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -100,11 +100,30 @@ int early_pfn_to_nid(unsigned long pfn)
100} 100}
101#endif 101#endif
102 102
103static void * __init
104early_node_mem(int nodeid, unsigned long start, unsigned long end,
105 unsigned long size)
106{
107 unsigned long mem = find_e820_area(start, end, size);
108 void *ptr;
109 if (mem != -1L)
110 return __va(mem);
111 ptr = __alloc_bootmem_nopanic(size,
112 SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS));
113 if (ptr == 0) {
114 printk(KERN_ERR "Cannot find %lu bytes in node %d\n",
115 size, nodeid);
116 return NULL;
117 }
118 return ptr;
119}
120
103/* Initialize bootmem allocator for a node */ 121/* Initialize bootmem allocator for a node */
104void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) 122void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long end)
105{ 123{
106 unsigned long start_pfn, end_pfn, bootmap_pages, bootmap_size, bootmap_start; 124 unsigned long start_pfn, end_pfn, bootmap_pages, bootmap_size, bootmap_start;
107 unsigned long nodedata_phys; 125 unsigned long nodedata_phys;
126 void *bootmap;
108 const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE); 127 const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE);
109 128
110 start = round_up(start, ZONE_ALIGN); 129 start = round_up(start, ZONE_ALIGN);
@@ -114,13 +133,11 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
114 start_pfn = start >> PAGE_SHIFT; 133 start_pfn = start >> PAGE_SHIFT;
115 end_pfn = end >> PAGE_SHIFT; 134 end_pfn = end >> PAGE_SHIFT;
116 135
117 nodedata_phys = find_e820_area(start, end, pgdat_size); 136 node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size);
118 if (nodedata_phys == -1L) 137 if (node_data[nodeid] == NULL)
119 panic("Cannot find memory pgdat in node %d\n", nodeid); 138 return;
120 139 nodedata_phys = __pa(node_data[nodeid]);
121 Dprintk("nodedata_phys %lx\n", nodedata_phys);
122 140
123 node_data[nodeid] = phys_to_virt(nodedata_phys);
124 memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t)); 141 memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t));
125 NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid]; 142 NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid];
126 NODE_DATA(nodeid)->node_start_pfn = start_pfn; 143 NODE_DATA(nodeid)->node_start_pfn = start_pfn;
@@ -129,9 +146,15 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
129 /* Find a place for the bootmem map */ 146 /* Find a place for the bootmem map */
130 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 147 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
131 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE); 148 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE);
132 bootmap_start = find_e820_area(bootmap_start, end, bootmap_pages<<PAGE_SHIFT); 149 bootmap = early_node_mem(nodeid, bootmap_start, end,
133 if (bootmap_start == -1L) 150 bootmap_pages<<PAGE_SHIFT);
134 panic("Not enough continuous space for bootmap on node %d", nodeid); 151 if (bootmap == NULL) {
152 if (nodedata_phys < start || nodedata_phys >= end)
153 free_bootmem((unsigned long)node_data[nodeid],pgdat_size);
154 node_data[nodeid] = NULL;
155 return;
156 }
157 bootmap_start = __pa(bootmap);
135 Dprintk("bootmap start %lu pages %lu\n", bootmap_start, bootmap_pages); 158 Dprintk("bootmap start %lu pages %lu\n", bootmap_start, bootmap_pages);
136 159
137 bootmap_size = init_bootmem_node(NODE_DATA(nodeid), 160 bootmap_size = init_bootmem_node(NODE_DATA(nodeid),
@@ -142,6 +165,9 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
142 165
143 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); 166 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size);
144 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT); 167 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT);
168#ifdef CONFIG_ACPI_NUMA
169 srat_reserve_add_area(nodeid);
170#endif
145 node_set_online(nodeid); 171 node_set_online(nodeid);
146} 172}
147 173
@@ -335,6 +361,8 @@ __init int numa_setup(char *opt)
335#ifdef CONFIG_ACPI_NUMA 361#ifdef CONFIG_ACPI_NUMA
336 if (!strncmp(opt,"noacpi",6)) 362 if (!strncmp(opt,"noacpi",6))
337 acpi_numa = -1; 363 acpi_numa = -1;
364 if (!strncmp(opt,"hotadd=", 7))
365 hotadd_percent = simple_strtoul(opt+7, NULL, 10);
338#endif 366#endif
339 return 1; 367 return 1;
340} 368}
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 2eb879590dc4..15ae9fcd65a7 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -15,15 +15,26 @@
15#include <linux/bitmap.h> 15#include <linux/bitmap.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/topology.h> 17#include <linux/topology.h>
18#include <linux/bootmem.h>
19#include <linux/mm.h>
18#include <asm/proto.h> 20#include <asm/proto.h>
19#include <asm/numa.h> 21#include <asm/numa.h>
20#include <asm/e820.h> 22#include <asm/e820.h>
21 23
24#if (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
25 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) \
26 && !defined(CONFIG_MEMORY_HOTPLUG)
27#define RESERVE_HOTADD 1
28#endif
29
22static struct acpi_table_slit *acpi_slit; 30static struct acpi_table_slit *acpi_slit;
23 31
24static nodemask_t nodes_parsed __initdata; 32static nodemask_t nodes_parsed __initdata;
25static nodemask_t nodes_found __initdata; 33static nodemask_t nodes_found __initdata;
26static struct bootnode nodes[MAX_NUMNODES] __initdata; 34static struct bootnode nodes[MAX_NUMNODES] __initdata;
35static struct bootnode nodes_add[MAX_NUMNODES] __initdata;
36static int found_add_area __initdata;
37int hotadd_percent __initdata = 10;
27static u8 pxm2node[256] = { [0 ... 255] = 0xff }; 38static u8 pxm2node[256] = { [0 ... 255] = 0xff };
28 39
29/* Too small nodes confuse the VM badly. Usually they result 40/* Too small nodes confuse the VM badly. Usually they result
@@ -71,6 +82,10 @@ static __init int conflicting_nodes(unsigned long start, unsigned long end)
71static __init void cutoff_node(int i, unsigned long start, unsigned long end) 82static __init void cutoff_node(int i, unsigned long start, unsigned long end)
72{ 83{
73 struct bootnode *nd = &nodes[i]; 84 struct bootnode *nd = &nodes[i];
85
86 if (found_add_area)
87 return;
88
74 if (nd->start < start) { 89 if (nd->start < start) {
75 nd->start = start; 90 nd->start = start;
76 if (nd->end < nd->start) 91 if (nd->end < nd->start)
@@ -90,6 +105,8 @@ static __init void bad_srat(void)
90 acpi_numa = -1; 105 acpi_numa = -1;
91 for (i = 0; i < MAX_LOCAL_APIC; i++) 106 for (i = 0; i < MAX_LOCAL_APIC; i++)
92 apicid_to_node[i] = NUMA_NO_NODE; 107 apicid_to_node[i] = NUMA_NO_NODE;
108 for (i = 0; i < MAX_NUMNODES; i++)
109 nodes_add[i].start = nodes[i].end = 0;
93} 110}
94 111
95static __init inline int srat_disabled(void) 112static __init inline int srat_disabled(void)
@@ -155,11 +172,114 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
155 pxm, pa->apic_id, node); 172 pxm, pa->apic_id, node);
156} 173}
157 174
175#ifdef RESERVE_HOTADD
176/*
177 * Protect against too large hotadd areas that would fill up memory.
178 */
179static int hotadd_enough_memory(struct bootnode *nd)
180{
181 static unsigned long allocated;
182 static unsigned long last_area_end;
183 unsigned long pages = (nd->end - nd->start) >> PAGE_SHIFT;
184 long mem = pages * sizeof(struct page);
185 unsigned long addr;
186 unsigned long allowed;
187 unsigned long oldpages = pages;
188
189 if (mem < 0)
190 return 0;
191 allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE;
192 allowed = (allowed / 100) * hotadd_percent;
193 if (allocated + mem > allowed) {
194 /* Give them at least part of their hotadd memory upto hotadd_percent
195 It would be better to spread the limit out
196 over multiple hotplug areas, but that is too complicated
197 right now */
198 if (allocated >= allowed)
199 return 0;
200 pages = (allowed - allocated + mem) / sizeof(struct page);
201 mem = pages * sizeof(struct page);
202 nd->end = nd->start + pages*PAGE_SIZE;
203 }
204 /* Not completely fool proof, but a good sanity check */
205 addr = find_e820_area(last_area_end, end_pfn<<PAGE_SHIFT, mem);
206 if (addr == -1UL)
207 return 0;
208 if (pages != oldpages)
209 printk(KERN_NOTICE "SRAT: Hotadd area limited to %lu bytes\n",
210 pages << PAGE_SHIFT);
211 last_area_end = addr + mem;
212 allocated += mem;
213 return 1;
214}
215
216/*
217 * It is fine to add this area to the nodes data it will be used later
218 * This code supports one contigious hot add area per node.
219 */
220static int reserve_hotadd(int node, unsigned long start, unsigned long end)
221{
222 unsigned long s_pfn = start >> PAGE_SHIFT;
223 unsigned long e_pfn = end >> PAGE_SHIFT;
224 int changed = 0;
225 struct bootnode *nd = &nodes_add[node];
226
227 /* I had some trouble with strange memory hotadd regions breaking
228 the boot. Be very strict here and reject anything unexpected.
229 If you want working memory hotadd write correct SRATs.
230
231 The node size check is a basic sanity check to guard against
232 mistakes */
233 if ((signed long)(end - start) < NODE_MIN_SIZE) {
234 printk(KERN_ERR "SRAT: Hotplug area too small\n");
235 return -1;
236 }
237
238 /* This check might be a bit too strict, but I'm keeping it for now. */
239 if (e820_hole_size(s_pfn, e_pfn) != e_pfn - s_pfn) {
240 printk(KERN_ERR "SRAT: Hotplug area has existing memory\n");
241 return -1;
242 }
243
244 if (!hotadd_enough_memory(&nodes_add[node])) {
245 printk(KERN_ERR "SRAT: Hotplug area too large\n");
246 return -1;
247 }
248
249 /* Looks good */
250
251 found_add_area = 1;
252 if (nd->start == nd->end) {
253 nd->start = start;
254 nd->end = end;
255 changed = 1;
256 } else {
257 if (nd->start == end) {
258 nd->start = start;
259 changed = 1;
260 }
261 if (nd->end == start) {
262 nd->end = end;
263 changed = 1;
264 }
265 if (!changed)
266 printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
267 }
268
269 if ((nd->end >> PAGE_SHIFT) > end_pfn)
270 end_pfn = nd->end >> PAGE_SHIFT;
271
272 if (changed)
273 printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", nd->start, nd->end);
274 return 0;
275}
276#endif
277
158/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 278/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
159void __init 279void __init
160acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) 280acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
161{ 281{
162 struct bootnode *nd; 282 struct bootnode *nd, oldnode;
163 unsigned long start, end; 283 unsigned long start, end;
164 int node, pxm; 284 int node, pxm;
165 int i; 285 int i;
@@ -172,6 +292,8 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
172 } 292 }
173 if (ma->flags.enabled == 0) 293 if (ma->flags.enabled == 0)
174 return; 294 return;
295 if (ma->flags.hot_pluggable && hotadd_percent == 0)
296 return;
175 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 297 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
176 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 298 end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
177 pxm = ma->proximity_domain; 299 pxm = ma->proximity_domain;
@@ -181,10 +303,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
181 bad_srat(); 303 bad_srat();
182 return; 304 return;
183 } 305 }
184 /* It is fine to add this area to the nodes data it will be used later*/
185 if (ma->flags.hot_pluggable == 1)
186 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
187 start, end);
188 i = conflicting_nodes(start, end); 306 i = conflicting_nodes(start, end);
189 if (i == node) { 307 if (i == node) {
190 printk(KERN_WARNING 308 printk(KERN_WARNING
@@ -199,6 +317,7 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
199 return; 317 return;
200 } 318 }
201 nd = &nodes[node]; 319 nd = &nodes[node];
320 oldnode = *nd;
202 if (!node_test_and_set(node, nodes_parsed)) { 321 if (!node_test_and_set(node, nodes_parsed)) {
203 nd->start = start; 322 nd->start = start;
204 nd->end = end; 323 nd->end = end;
@@ -208,8 +327,19 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
208 if (nd->end < end) 327 if (nd->end < end)
209 nd->end = end; 328 nd->end = end;
210 } 329 }
330
211 printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm, 331 printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm,
212 nd->start, nd->end); 332 nd->start, nd->end);
333
334#ifdef RESERVE_HOTADD
335 if (ma->flags.hot_pluggable && reserve_hotadd(node, start, end) < 0) {
336 /* Ignore hotadd region. Undo damage */
337 printk(KERN_NOTICE "SRAT: Hotplug region ignored\n");
338 *nd = oldnode;
339 if ((nd->start | nd->end) == 0)
340 node_clear(node, nodes_parsed);
341 }
342#endif
213} 343}
214 344
215/* Sanity check to catch more bad SRATs (they are amazingly common). 345/* Sanity check to catch more bad SRATs (they are amazingly common).
@@ -225,6 +355,9 @@ static int nodes_cover_memory(void)
225 unsigned long e = nodes[i].end >> PAGE_SHIFT; 355 unsigned long e = nodes[i].end >> PAGE_SHIFT;
226 pxmram += e - s; 356 pxmram += e - s;
227 pxmram -= e820_hole_size(s, e); 357 pxmram -= e820_hole_size(s, e);
358 pxmram -= nodes_add[i].end - nodes_add[i].start;
359 if ((long)pxmram < 0)
360 pxmram = 0;
228 } 361 }
229 362
230 e820ram = end_pfn - e820_hole_size(0, end_pfn); 363 e820ram = end_pfn - e820_hole_size(0, end_pfn);
@@ -258,7 +391,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
258 391
259 /* First clean up the node list */ 392 /* First clean up the node list */
260 for (i = 0; i < MAX_NUMNODES; i++) { 393 for (i = 0; i < MAX_NUMNODES; i++) {
261 cutoff_node(i, start, end); 394 cutoff_node(i, start, end);
262 if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) 395 if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE)
263 unparse_node(i); 396 unparse_node(i);
264 } 397 }
@@ -282,6 +415,12 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
282 /* Finally register nodes */ 415 /* Finally register nodes */
283 for_each_node_mask(i, nodes_parsed) 416 for_each_node_mask(i, nodes_parsed)
284 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 417 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
418 /* Try again in case setup_node_bootmem missed one due
419 to missing bootmem */
420 for_each_node_mask(i, nodes_parsed)
421 if (!node_online(i))
422 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
423
285 for (i = 0; i < NR_CPUS; i++) { 424 for (i = 0; i < NR_CPUS; i++) {
286 if (cpu_to_node[i] == NUMA_NO_NODE) 425 if (cpu_to_node[i] == NUMA_NO_NODE)
287 continue; 426 continue;
@@ -303,6 +442,25 @@ static int node_to_pxm(int n)
303 return 0; 442 return 0;
304} 443}
305 444
445void __init srat_reserve_add_area(int nodeid)
446{
447 if (found_add_area && nodes_add[nodeid].end) {
448 u64 total_mb;
449
450 printk(KERN_INFO "SRAT: Reserving hot-add memory space "
451 "for node %d at %Lx-%Lx\n",
452 nodeid, nodes_add[nodeid].start, nodes_add[nodeid].end);
453 total_mb = (nodes_add[nodeid].end - nodes_add[nodeid].start)
454 >> PAGE_SHIFT;
455 total_mb *= sizeof(struct page);
456 total_mb >>= 20;
457 printk(KERN_INFO "SRAT: This will cost you %Lu MB of "
458 "pre-allocated memory.\n", (unsigned long long)total_mb);
459 reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start,
460 nodes_add[nodeid].end - nodes_add[nodeid].start);
461 }
462}
463
306int __node_distance(int a, int b) 464int __node_distance(int a, int b)
307{ 465{
308 int index; 466 int index;
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index e616500207e4..a2060e4d5de6 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -9,11 +9,16 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/acpi.h> 10#include <linux/acpi.h>
11#include <linux/bitmap.h> 11#include <linux/bitmap.h>
12#include <asm/e820.h>
13
12#include "pci.h" 14#include "pci.h"
13 15
14#define MMCONFIG_APER_SIZE (256*1024*1024) 16#define MMCONFIG_APER_SIZE (256*1024*1024)
17/* Verify the first 16 busses. We assume that systems with more busses
18 get MCFG right. */
19#define MAX_CHECK_BUS 16
15 20
16static DECLARE_BITMAP(fallback_slots, 32); 21static DECLARE_BITMAP(fallback_slots, 32*MAX_CHECK_BUS);
17 22
18/* Static virtual mapping of the MMCONFIG aperture */ 23/* Static virtual mapping of the MMCONFIG aperture */
19struct mmcfg_virt { 24struct mmcfg_virt {
@@ -55,7 +60,8 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
55static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 60static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
56{ 61{
57 char __iomem *addr; 62 char __iomem *addr;
58 if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), fallback_slots)) 63 if (seg == 0 && bus < MAX_CHECK_BUS &&
64 test_bit(32*bus + PCI_SLOT(devfn), fallback_slots))
59 return NULL; 65 return NULL;
60 addr = get_virt(seg, bus); 66 addr = get_virt(seg, bus);
61 if (!addr) 67 if (!addr)
@@ -69,8 +75,10 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
69 char __iomem *addr; 75 char __iomem *addr;
70 76
71 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ 77 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
72 if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) 78 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
79 *value = -1;
73 return -EINVAL; 80 return -EINVAL;
81 }
74 82
75 addr = pci_dev_base(seg, bus, devfn); 83 addr = pci_dev_base(seg, bus, devfn);
76 if (!addr) 84 if (!addr)
@@ -129,21 +137,26 @@ static struct pci_raw_ops pci_mmcfg = {
129 Normally this can be expressed in the MCFG by not listing them 137 Normally this can be expressed in the MCFG by not listing them
130 and assigning suitable _SEGs, but this isn't implemented in some BIOS. 138 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
131 Instead try to discover all devices on bus 0 that are unreachable using MM 139 Instead try to discover all devices on bus 0 that are unreachable using MM
132 and fallback for them. 140 and fallback for them. */
133 We only do this for bus 0/seg 0 */
134static __init void unreachable_devices(void) 141static __init void unreachable_devices(void)
135{ 142{
136 int i; 143 int i, k;
137 for (i = 0; i < 32; i++) { 144 /* Use the max bus number from ACPI here? */
138 u32 val1; 145 for (k = 0; k < MAX_CHECK_BUS; k++) {
139 char __iomem *addr; 146 for (i = 0; i < 32; i++) {
140 147 u32 val1;
141 pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1); 148 char __iomem *addr;
142 if (val1 == 0xffffffff) 149
143 continue; 150 pci_conf1_read(0, k, PCI_DEVFN(i,0), 0, 4, &val1);
144 addr = pci_dev_base(0, 0, PCI_DEVFN(i, 0)); 151 if (val1 == 0xffffffff)
145 if (addr == NULL|| readl(addr) != val1) { 152 continue;
146 set_bit(i, fallback_slots); 153 addr = pci_dev_base(0, k, PCI_DEVFN(i, 0));
154 if (addr == NULL|| readl(addr) != val1) {
155 set_bit(i + 32*k, fallback_slots);
156 printk(KERN_NOTICE
157 "PCI: No mmconfig possible on device %x:%x\n",
158 k, i);
159 }
147 } 160 }
148 } 161 }
149} 162}
@@ -161,6 +174,14 @@ void __init pci_mmcfg_init(void)
161 (pci_mmcfg_config[0].base_address == 0)) 174 (pci_mmcfg_config[0].base_address == 0))
162 return; 175 return;
163 176
177 if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
178 pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE,
179 E820_RESERVED)) {
180 printk(KERN_ERR "PCI: BIOS Bug: MCFG area is not E820-reserved\n");
181 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
182 return;
183 }
184
164 /* RED-PEN i386 doesn't do _nocache right now */ 185 /* RED-PEN i386 doesn't do _nocache right now */
165 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); 186 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
166 if (pci_mmcfg_virt == NULL) { 187 if (pci_mmcfg_virt == NULL) {
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index 152b9370789b..a15b6e3e72c8 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -48,7 +48,6 @@ EXPORT_SYMBOL(memchr);
48EXPORT_SYMBOL(strcat); 48EXPORT_SYMBOL(strcat);
49EXPORT_SYMBOL(strchr); 49EXPORT_SYMBOL(strchr);
50EXPORT_SYMBOL(strlen); 50EXPORT_SYMBOL(strlen);
51EXPORT_SYMBOL(strpbrk);
52EXPORT_SYMBOL(strncat); 51EXPORT_SYMBOL(strncat);
53EXPORT_SYMBOL(strnlen); 52EXPORT_SYMBOL(strnlen);
54EXPORT_SYMBOL(strrchr); 53EXPORT_SYMBOL(strrchr);
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 296708ceceb2..e25a5d79ab27 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1844,9 +1844,10 @@ static void __exit as_exit(void)
1844 DECLARE_COMPLETION(all_gone); 1844 DECLARE_COMPLETION(all_gone);
1845 elv_unregister(&iosched_as); 1845 elv_unregister(&iosched_as);
1846 ioc_gone = &all_gone; 1846 ioc_gone = &all_gone;
1847 barrier(); 1847 /* ioc_gone's update must be visible before reading ioc_count */
1848 smp_wmb();
1848 if (atomic_read(&ioc_count)) 1849 if (atomic_read(&ioc_count))
1849 complete(ioc_gone); 1850 wait_for_completion(ioc_gone);
1850 synchronize_rcu(); 1851 synchronize_rcu();
1851 kmem_cache_destroy(arq_pool); 1852 kmem_cache_destroy(arq_pool);
1852} 1853}
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 67d446de0227..2540dfaa3e38 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1472,19 +1472,37 @@ out:
1472 return cfqq; 1472 return cfqq;
1473} 1473}
1474 1474
1475static void
1476cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic)
1477{
1478 read_lock(&cfq_exit_lock);
1479 rb_erase(&cic->rb_node, &ioc->cic_root);
1480 read_unlock(&cfq_exit_lock);
1481 kmem_cache_free(cfq_ioc_pool, cic);
1482 atomic_dec(&ioc_count);
1483}
1484
1475static struct cfq_io_context * 1485static struct cfq_io_context *
1476cfq_cic_rb_lookup(struct cfq_data *cfqd, struct io_context *ioc) 1486cfq_cic_rb_lookup(struct cfq_data *cfqd, struct io_context *ioc)
1477{ 1487{
1478 struct rb_node *n = ioc->cic_root.rb_node; 1488 struct rb_node *n;
1479 struct cfq_io_context *cic; 1489 struct cfq_io_context *cic;
1480 void *key = cfqd; 1490 void *k, *key = cfqd;
1481 1491
1492restart:
1493 n = ioc->cic_root.rb_node;
1482 while (n) { 1494 while (n) {
1483 cic = rb_entry(n, struct cfq_io_context, rb_node); 1495 cic = rb_entry(n, struct cfq_io_context, rb_node);
1496 /* ->key must be copied to avoid race with cfq_exit_queue() */
1497 k = cic->key;
1498 if (unlikely(!k)) {
1499 cfq_drop_dead_cic(ioc, cic);
1500 goto restart;
1501 }
1484 1502
1485 if (key < cic->key) 1503 if (key < k)
1486 n = n->rb_left; 1504 n = n->rb_left;
1487 else if (key > cic->key) 1505 else if (key > k)
1488 n = n->rb_right; 1506 n = n->rb_right;
1489 else 1507 else
1490 return cic; 1508 return cic;
@@ -1497,29 +1515,37 @@ static inline void
1497cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, 1515cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
1498 struct cfq_io_context *cic) 1516 struct cfq_io_context *cic)
1499{ 1517{
1500 struct rb_node **p = &ioc->cic_root.rb_node; 1518 struct rb_node **p;
1501 struct rb_node *parent = NULL; 1519 struct rb_node *parent;
1502 struct cfq_io_context *__cic; 1520 struct cfq_io_context *__cic;
1503 1521 void *k;
1504 read_lock(&cfq_exit_lock);
1505 1522
1506 cic->ioc = ioc; 1523 cic->ioc = ioc;
1507 cic->key = cfqd; 1524 cic->key = cfqd;
1508 1525
1509 ioc->set_ioprio = cfq_ioc_set_ioprio; 1526 ioc->set_ioprio = cfq_ioc_set_ioprio;
1510 1527restart:
1528 parent = NULL;
1529 p = &ioc->cic_root.rb_node;
1511 while (*p) { 1530 while (*p) {
1512 parent = *p; 1531 parent = *p;
1513 __cic = rb_entry(parent, struct cfq_io_context, rb_node); 1532 __cic = rb_entry(parent, struct cfq_io_context, rb_node);
1533 /* ->key must be copied to avoid race with cfq_exit_queue() */
1534 k = __cic->key;
1535 if (unlikely(!k)) {
1536 cfq_drop_dead_cic(ioc, cic);
1537 goto restart;
1538 }
1514 1539
1515 if (cic->key < __cic->key) 1540 if (cic->key < k)
1516 p = &(*p)->rb_left; 1541 p = &(*p)->rb_left;
1517 else if (cic->key > __cic->key) 1542 else if (cic->key > k)
1518 p = &(*p)->rb_right; 1543 p = &(*p)->rb_right;
1519 else 1544 else
1520 BUG(); 1545 BUG();
1521 } 1546 }
1522 1547
1548 read_lock(&cfq_exit_lock);
1523 rb_link_node(&cic->rb_node, parent, p); 1549 rb_link_node(&cic->rb_node, parent, p);
1524 rb_insert_color(&cic->rb_node, &ioc->cic_root); 1550 rb_insert_color(&cic->rb_node, &ioc->cic_root);
1525 list_add(&cic->queue_list, &cfqd->cic_list); 1551 list_add(&cic->queue_list, &cfqd->cic_list);
@@ -2439,9 +2465,10 @@ static void __exit cfq_exit(void)
2439 DECLARE_COMPLETION(all_gone); 2465 DECLARE_COMPLETION(all_gone);
2440 elv_unregister(&iosched_cfq); 2466 elv_unregister(&iosched_cfq);
2441 ioc_gone = &all_gone; 2467 ioc_gone = &all_gone;
2442 barrier(); 2468 /* ioc_gone's update must be visible before reading ioc_count */
2469 smp_wmb();
2443 if (atomic_read(&ioc_count)) 2470 if (atomic_read(&ioc_count))
2444 complete(ioc_gone); 2471 wait_for_completion(ioc_gone);
2445 synchronize_rcu(); 2472 synchronize_rcu();
2446 cfq_slab_kill(); 2473 cfq_slab_kill();
2447} 2474}
diff --git a/block/elevator.c b/block/elevator.c
index 0d6be03d929e..29825792cbd5 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -895,10 +895,8 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
895EXPORT_SYMBOL(elv_dispatch_sort); 895EXPORT_SYMBOL(elv_dispatch_sort);
896EXPORT_SYMBOL(elv_add_request); 896EXPORT_SYMBOL(elv_add_request);
897EXPORT_SYMBOL(__elv_add_request); 897EXPORT_SYMBOL(__elv_add_request);
898EXPORT_SYMBOL(elv_requeue_request);
899EXPORT_SYMBOL(elv_next_request); 898EXPORT_SYMBOL(elv_next_request);
900EXPORT_SYMBOL(elv_dequeue_request); 899EXPORT_SYMBOL(elv_dequeue_request);
901EXPORT_SYMBOL(elv_queue_empty); 900EXPORT_SYMBOL(elv_queue_empty);
902EXPORT_SYMBOL(elv_completed_request);
903EXPORT_SYMBOL(elevator_exit); 901EXPORT_SYMBOL(elevator_exit);
904EXPORT_SYMBOL(elevator_init); 902EXPORT_SYMBOL(elevator_init);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index e112d1a5dab6..1755c053fd68 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1554,7 +1554,7 @@ void blk_plug_device(request_queue_t *q)
1554 * don't plug a stopped queue, it must be paired with blk_start_queue() 1554 * don't plug a stopped queue, it must be paired with blk_start_queue()
1555 * which will restart the queueing 1555 * which will restart the queueing
1556 */ 1556 */
1557 if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) 1557 if (blk_queue_stopped(q))
1558 return; 1558 return;
1559 1559
1560 if (!test_and_set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) { 1560 if (!test_and_set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) {
@@ -1587,7 +1587,7 @@ EXPORT_SYMBOL(blk_remove_plug);
1587 */ 1587 */
1588void __generic_unplug_device(request_queue_t *q) 1588void __generic_unplug_device(request_queue_t *q)
1589{ 1589{
1590 if (unlikely(test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags))) 1590 if (unlikely(blk_queue_stopped(q)))
1591 return; 1591 return;
1592 1592
1593 if (!blk_remove_plug(q)) 1593 if (!blk_remove_plug(q))
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 24f7af9d0abc..b33eda26e205 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -350,16 +350,51 @@ out:
350 return ret; 350 return ret;
351} 351}
352 352
353/**
354 * sg_scsi_ioctl -- handle deprecated SCSI_IOCTL_SEND_COMMAND ioctl
355 * @file: file this ioctl operates on (optional)
356 * @q: request queue to send scsi commands down
357 * @disk: gendisk to operate on (option)
358 * @sic: userspace structure describing the command to perform
359 *
360 * Send down the scsi command described by @sic to the device below
361 * the request queue @q. If @file is non-NULL it's used to perform
362 * fine-grained permission checks that allow users to send down
363 * non-destructive SCSI commands. If the caller has a struct gendisk
364 * available it should be passed in as @disk to allow the low level
365 * driver to use the information contained in it. A non-NULL @disk
366 * is only allowed if the caller knows that the low level driver doesn't
367 * need it (e.g. in the scsi subsystem).
368 *
369 * Notes:
370 * - This interface is deprecated - users should use the SG_IO
371 * interface instead, as this is a more flexible approach to
372 * performing SCSI commands on a device.
373 * - The SCSI command length is determined by examining the 1st byte
374 * of the given command. There is no way to override this.
375 * - Data transfers are limited to PAGE_SIZE
376 * - The length (x + y) must be at least OMAX_SB_LEN bytes long to
377 * accommodate the sense buffer when an error occurs.
378 * The sense buffer is truncated to OMAX_SB_LEN (16) bytes so that
379 * old code will not be surprised.
380 * - If a Unix error occurs (e.g. ENOMEM) then the user will receive
381 * a negative return and the Unix error code in 'errno'.
382 * If the SCSI command succeeds then 0 is returned.
383 * Positive numbers returned are the compacted SCSI error codes (4
384 * bytes in one int) where the lowest byte is the SCSI status.
385 */
353#define OMAX_SB_LEN 16 /* For backward compatibility */ 386#define OMAX_SB_LEN 16 /* For backward compatibility */
354 387int sg_scsi_ioctl(struct file *file, struct request_queue *q,
355static int sg_scsi_ioctl(struct file *file, request_queue_t *q, 388 struct gendisk *disk, struct scsi_ioctl_command __user *sic)
356 struct gendisk *bd_disk, Scsi_Ioctl_Command __user *sic)
357{ 389{
358 struct request *rq; 390 struct request *rq;
359 int err; 391 int err;
360 unsigned int in_len, out_len, bytes, opcode, cmdlen; 392 unsigned int in_len, out_len, bytes, opcode, cmdlen;
361 char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; 393 char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];
362 394
395 if (!sic)
396 return -EINVAL;
397
363 /* 398 /*
364 * get in an out lengths, verify they don't exceed a page worth of data 399 * get in an out lengths, verify they don't exceed a page worth of data
365 */ 400 */
@@ -393,45 +428,53 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
393 if (copy_from_user(rq->cmd, sic->data, cmdlen)) 428 if (copy_from_user(rq->cmd, sic->data, cmdlen))
394 goto error; 429 goto error;
395 430
396 if (copy_from_user(buffer, sic->data + cmdlen, in_len)) 431 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
397 goto error; 432 goto error;
398 433
399 err = verify_command(file, rq->cmd); 434 err = verify_command(file, rq->cmd);
400 if (err) 435 if (err)
401 goto error; 436 goto error;
402 437
438 /* default. possible overriden later */
439 rq->retries = 5;
440
403 switch (opcode) { 441 switch (opcode) {
404 case SEND_DIAGNOSTIC: 442 case SEND_DIAGNOSTIC:
405 case FORMAT_UNIT: 443 case FORMAT_UNIT:
406 rq->timeout = FORMAT_UNIT_TIMEOUT; 444 rq->timeout = FORMAT_UNIT_TIMEOUT;
407 break; 445 rq->retries = 1;
408 case START_STOP: 446 break;
409 rq->timeout = START_STOP_TIMEOUT; 447 case START_STOP:
410 break; 448 rq->timeout = START_STOP_TIMEOUT;
411 case MOVE_MEDIUM: 449 break;
412 rq->timeout = MOVE_MEDIUM_TIMEOUT; 450 case MOVE_MEDIUM:
413 break; 451 rq->timeout = MOVE_MEDIUM_TIMEOUT;
414 case READ_ELEMENT_STATUS: 452 break;
415 rq->timeout = READ_ELEMENT_STATUS_TIMEOUT; 453 case READ_ELEMENT_STATUS:
416 break; 454 rq->timeout = READ_ELEMENT_STATUS_TIMEOUT;
417 case READ_DEFECT_DATA: 455 break;
418 rq->timeout = READ_DEFECT_DATA_TIMEOUT; 456 case READ_DEFECT_DATA:
419 break; 457 rq->timeout = READ_DEFECT_DATA_TIMEOUT;
420 default: 458 rq->retries = 1;
421 rq->timeout = BLK_DEFAULT_TIMEOUT; 459 break;
422 break; 460 default:
461 rq->timeout = BLK_DEFAULT_TIMEOUT;
462 break;
463 }
464
465 if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) {
466 err = DRIVER_ERROR << 24;
467 goto out;
423 } 468 }
424 469
425 memset(sense, 0, sizeof(sense)); 470 memset(sense, 0, sizeof(sense));
426 rq->sense = sense; 471 rq->sense = sense;
427 rq->sense_len = 0; 472 rq->sense_len = 0;
428
429 rq->data = buffer;
430 rq->data_len = bytes;
431 rq->flags |= REQ_BLOCK_PC; 473 rq->flags |= REQ_BLOCK_PC;
432 rq->retries = 0;
433 474
434 blk_execute_rq(q, bd_disk, rq, 0); 475 blk_execute_rq(q, disk, rq, 0);
476
477out:
435 err = rq->errors & 0xff; /* only 8 bit SCSI status */ 478 err = rq->errors & 0xff; /* only 8 bit SCSI status */
436 if (err) { 479 if (err) {
437 if (rq->sense_len && rq->sense) { 480 if (rq->sense_len && rq->sense) {
@@ -450,7 +493,7 @@ error:
450 blk_put_request(rq); 493 blk_put_request(rq);
451 return err; 494 return err;
452} 495}
453 496EXPORT_SYMBOL_GPL(sg_scsi_ioctl);
454 497
455/* Send basic block requests */ 498/* Send basic block requests */
456static int __blk_send_generic(request_queue_t *q, struct gendisk *bd_disk, int cmd, int data) 499static int __blk_send_generic(request_queue_t *q, struct gendisk *bd_disk, int cmd, int data)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5cb96300eb0f..c24652d31bf9 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -329,7 +329,7 @@ config ACPI_CONTAINER
329config ACPI_HOTPLUG_MEMORY 329config ACPI_HOTPLUG_MEMORY
330 tristate "Memory Hotplug" 330 tristate "Memory Hotplug"
331 depends on ACPI 331 depends on ACPI
332 depends on MEMORY_HOTPLUG 332 depends on MEMORY_HOTPLUG || X86_64
333 default n 333 default n
334 help 334 help
335 This driver adds supports for ACPI Memory Hotplug. This driver 335 This driver adds supports for ACPI Memory Hotplug. This driver
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 48718b7f4fa0..76656acd00d4 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device_driver *drv,
188 up(&dev->sem); 188 up(&dev->sem);
189 if (dev->parent) 189 if (dev->parent)
190 up(&dev->parent->sem); 190 up(&dev->parent->sem);
191
192 if (err > 0) /* success */
193 err = count;
194 else if (err == 0) /* driver didn't accept device */
195 err = -ENODEV;
191 } 196 }
192 put_device(dev); 197 put_device(dev);
193 put_bus(bus); 198 put_bus(bus);
diff --git a/drivers/base/class.c b/drivers/base/class.c
index df7fdabd0730..0e71dff327cd 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -562,14 +562,13 @@ int class_device_add(struct class_device *class_dev)
562 kobject_uevent(&class_dev->kobj, KOBJ_ADD); 562 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
563 563
564 /* notify any interfaces this device is now here */ 564 /* notify any interfaces this device is now here */
565 if (parent_class) { 565 down(&parent_class->sem);
566 down(&parent_class->sem); 566 list_add_tail(&class_dev->node, &parent_class->children);
567 list_add_tail(&class_dev->node, &parent_class->children); 567 list_for_each_entry(class_intf, &parent_class->interfaces, node) {
568 list_for_each_entry(class_intf, &parent_class->interfaces, node) 568 if (class_intf->add)
569 if (class_intf->add) 569 class_intf->add(class_dev, class_intf);
570 class_intf->add(class_dev, class_intf);
571 up(&parent_class->sem);
572 } 570 }
571 up(&parent_class->sem);
573 572
574 register_done: 573 register_done:
575 if (error) { 574 if (error) {
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 730a9ce0a14a..889c71111239 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -209,7 +209,7 @@ static void __device_release_driver(struct device * dev)
209 sysfs_remove_link(&dev->kobj, "driver"); 209 sysfs_remove_link(&dev->kobj, "driver");
210 klist_remove(&dev->knode_driver); 210 klist_remove(&dev->knode_driver);
211 211
212 if (dev->bus->remove) 212 if (dev->bus && dev->bus->remove)
213 dev->bus->remove(dev); 213 dev->bus->remove(dev);
214 else if (drv->remove) 214 else if (drv->remove)
215 drv->remove(dev); 215 drv->remove(dev);
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 16c513aa4d48..c80c3aeed004 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -106,7 +106,7 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
106 other_node = 0; 106 other_node = 0;
107 for (i = 0; i < MAX_NR_ZONES; i++) { 107 for (i = 0; i < MAX_NR_ZONES; i++) {
108 struct zone *z = &pg->node_zones[i]; 108 struct zone *z = &pg->node_zones[i];
109 for (cpu = 0; cpu < NR_CPUS; cpu++) { 109 for_each_online_cpu(cpu) {
110 struct per_cpu_pageset *ps = zone_pcp(z,cpu); 110 struct per_cpu_pageset *ps = zone_pcp(z,cpu);
111 numa_hit += ps->numa_hit; 111 numa_hit += ps->numa_hit;
112 numa_miss += ps->numa_miss; 112 numa_miss += ps->numa_miss;
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index bdb60663f2ef..662209d3f42d 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -10,6 +10,8 @@
10 10
11#include <linux/vt_kern.h> 11#include <linux/vt_kern.h>
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/kallsyms.h>
14#include <linux/pm.h>
13#include "../base.h" 15#include "../base.h"
14#include "power.h" 16#include "power.h"
15 17
@@ -58,6 +60,7 @@ int suspend_device(struct device * dev, pm_message_t state)
58 if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) { 60 if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
59 dev_dbg(dev, "suspending\n"); 61 dev_dbg(dev, "suspending\n");
60 error = dev->bus->suspend(dev, state); 62 error = dev->bus->suspend(dev, state);
63 suspend_report_result(dev->bus->suspend, error);
61 } 64 }
62 up(&dev->sem); 65 up(&dev->sem);
63 return error; 66 return error;
@@ -169,3 +172,12 @@ int device_power_down(pm_message_t state)
169 172
170EXPORT_SYMBOL_GPL(device_power_down); 173EXPORT_SYMBOL_GPL(device_power_down);
171 174
175void __suspend_report_result(const char *function, void *fn, int ret)
176{
177 if (ret) {
178 printk(KERN_ERR "%s(): ", function);
179 print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn);
180 printk("%d\n", ret);
181 }
182}
183EXPORT_SYMBOL_GPL(__suspend_report_result);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1b0fd31c57c3..1319d8f20640 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1180,6 +1180,53 @@ static int revalidate_allvol(ctlr_info_t *host)
1180 return 0; 1180 return 0;
1181} 1181}
1182 1182
1183static inline void complete_buffers(struct bio *bio, int status)
1184{
1185 while (bio) {
1186 struct bio *xbh = bio->bi_next;
1187 int nr_sectors = bio_sectors(bio);
1188
1189 bio->bi_next = NULL;
1190 blk_finished_io(len);
1191 bio_endio(bio, nr_sectors << 9, status ? 0 : -EIO);
1192 bio = xbh;
1193 }
1194
1195}
1196
1197static void cciss_softirq_done(struct request *rq)
1198{
1199 CommandList_struct *cmd = rq->completion_data;
1200 ctlr_info_t *h = hba[cmd->ctlr];
1201 unsigned long flags;
1202 u64bit temp64;
1203 int i, ddir;
1204
1205 if (cmd->Request.Type.Direction == XFER_READ)
1206 ddir = PCI_DMA_FROMDEVICE;
1207 else
1208 ddir = PCI_DMA_TODEVICE;
1209
1210 /* command did not need to be retried */
1211 /* unmap the DMA mapping for all the scatter gather elements */
1212 for(i=0; i<cmd->Header.SGList; i++) {
1213 temp64.val32.lower = cmd->SG[i].Addr.lower;
1214 temp64.val32.upper = cmd->SG[i].Addr.upper;
1215 pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir);
1216 }
1217
1218 complete_buffers(rq->bio, rq->errors);
1219
1220#ifdef CCISS_DEBUG
1221 printk("Done with %p\n", rq);
1222#endif /* CCISS_DEBUG */
1223
1224 spin_lock_irqsave(&h->lock, flags);
1225 end_that_request_last(rq, rq->errors);
1226 cmd_free(h, cmd,1);
1227 spin_unlock_irqrestore(&h->lock, flags);
1228}
1229
1183/* This function will check the usage_count of the drive to be updated/added. 1230/* This function will check the usage_count of the drive to be updated/added.
1184 * If the usage_count is zero then the drive information will be updated and 1231 * If the usage_count is zero then the drive information will be updated and
1185 * the disk will be re-registered with the kernel. If not then it will be 1232 * the disk will be re-registered with the kernel. If not then it will be
@@ -1248,6 +1295,8 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
1248 1295
1249 blk_queue_max_sectors(disk->queue, 512); 1296 blk_queue_max_sectors(disk->queue, 512);
1250 1297
1298 blk_queue_softirq_done(disk->queue, cciss_softirq_done);
1299
1251 disk->queue->queuedata = hba[ctlr]; 1300 disk->queue->queuedata = hba[ctlr];
1252 1301
1253 blk_queue_hardsect_size(disk->queue, 1302 blk_queue_hardsect_size(disk->queue,
@@ -2147,20 +2196,6 @@ static void start_io( ctlr_info_t *h)
2147 addQ (&(h->cmpQ), c); 2196 addQ (&(h->cmpQ), c);
2148 } 2197 }
2149} 2198}
2150
2151static inline void complete_buffers(struct bio *bio, int status)
2152{
2153 while (bio) {
2154 struct bio *xbh = bio->bi_next;
2155 int nr_sectors = bio_sectors(bio);
2156
2157 bio->bi_next = NULL;
2158 blk_finished_io(len);
2159 bio_endio(bio, nr_sectors << 9, status ? 0 : -EIO);
2160 bio = xbh;
2161 }
2162
2163}
2164/* Assumes that CCISS_LOCK(h->ctlr) is held. */ 2199/* Assumes that CCISS_LOCK(h->ctlr) is held. */
2165/* Zeros out the error record and then resends the command back */ 2200/* Zeros out the error record and then resends the command back */
2166/* to the controller */ 2201/* to the controller */
@@ -2178,39 +2213,6 @@ static inline void resend_cciss_cmd( ctlr_info_t *h, CommandList_struct *c)
2178 start_io(h); 2213 start_io(h);
2179} 2214}
2180 2215
2181static void cciss_softirq_done(struct request *rq)
2182{
2183 CommandList_struct *cmd = rq->completion_data;
2184 ctlr_info_t *h = hba[cmd->ctlr];
2185 unsigned long flags;
2186 u64bit temp64;
2187 int i, ddir;
2188
2189 if (cmd->Request.Type.Direction == XFER_READ)
2190 ddir = PCI_DMA_FROMDEVICE;
2191 else
2192 ddir = PCI_DMA_TODEVICE;
2193
2194 /* command did not need to be retried */
2195 /* unmap the DMA mapping for all the scatter gather elements */
2196 for(i=0; i<cmd->Header.SGList; i++) {
2197 temp64.val32.lower = cmd->SG[i].Addr.lower;
2198 temp64.val32.upper = cmd->SG[i].Addr.upper;
2199 pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir);
2200 }
2201
2202 complete_buffers(rq->bio, rq->errors);
2203
2204#ifdef CCISS_DEBUG
2205 printk("Done with %p\n", rq);
2206#endif /* CCISS_DEBUG */
2207
2208 spin_lock_irqsave(&h->lock, flags);
2209 end_that_request_last(rq, rq->errors);
2210 cmd_free(h, cmd,1);
2211 spin_unlock_irqrestore(&h->lock, flags);
2212}
2213
2214/* checks the status of the job and calls complete buffers to mark all 2216/* checks the status of the job and calls complete buffers to mark all
2215 * buffers for the completed job. Note that this function does not need 2217 * buffers for the completed job. Note that this function does not need
2216 * to hold the hba/queue lock. 2218 * to hold the hba/queue lock.
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
index ce4a1ce59d6a..ec004897b634 100644
--- a/drivers/cdrom/aztcd.c
+++ b/drivers/cdrom/aztcd.c
@@ -1763,7 +1763,7 @@ static int __init aztcd_init(void)
1763 release_region(azt_port, 4); 1763 release_region(azt_port, 4);
1764 } 1764 }
1765 } 1765 }
1766 if ((azt_port_auto[i] == 0) || (i == 16)) { 1766 if ((i == 16) || (azt_port_auto[i] == 0)) {
1767 printk(KERN_INFO "aztcd: no AZTECH CD-ROM drive found\n"); 1767 printk(KERN_INFO "aztcd: no AZTECH CD-ROM drive found\n");
1768 return -EIO; 1768 return -EIO;
1769 } 1769 }
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 889cad07774e..402296670d3a 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -805,10 +805,6 @@ config S3C2410_RTC
805 Samsung S3C2410. This can provide periodic interrupt rates 805 Samsung S3C2410. This can provide periodic interrupt rates
806 from 1Hz to 64Hz for user programs, and wakeup from Alarm. 806 from 1Hz to 64Hz for user programs, and wakeup from Alarm.
807 807
808config RTC_VR41XX
809 tristate "NEC VR4100 series Real Time Clock Support"
810 depends on CPU_VR41XX
811
812config COBALT_LCD 808config COBALT_LCD
813 bool "Support for Cobalt LCD" 809 bool "Support for Cobalt LCD"
814 depends on MIPS_COBALT 810 depends on MIPS_COBALT
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index a73cb4956928..f5b01c6d498e 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -67,7 +67,6 @@ obj-$(CONFIG_SGI_DS1286) += ds1286.o
67obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o 67obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o
68obj-$(CONFIG_DS1302) += ds1302.o 68obj-$(CONFIG_DS1302) += ds1302.o
69obj-$(CONFIG_S3C2410_RTC) += s3c2410-rtc.o 69obj-$(CONFIG_S3C2410_RTC) += s3c2410-rtc.o
70obj-$(CONFIG_RTC_VR41XX) += vr41xx_rtc.o
71ifeq ($(CONFIG_GENERIC_NVRAM),y) 70ifeq ($(CONFIG_GENERIC_NVRAM),y)
72 obj-$(CONFIG_NVRAM) += generic_nvram.o 71 obj-$(CONFIG_NVRAM) += generic_nvram.o
73else 72else
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index fed0a87448d8..86a966b65236 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -64,6 +64,12 @@ static struct gatt_mask efficeon_generic_masks[] =
64 {.mask = 0x00000001, .type = 0} 64 {.mask = 0x00000001, .type = 0}
65}; 65};
66 66
67/* This function does the same thing as mask_memory() for this chipset... */
68static inline unsigned long efficeon_mask_memory(unsigned long addr)
69{
70 return addr | 0x00000001;
71}
72
67static struct aper_size_info_lvl2 efficeon_generic_sizes[4] = 73static struct aper_size_info_lvl2 efficeon_generic_sizes[4] =
68{ 74{
69 {256, 65536, 0}, 75 {256, 65536, 0},
@@ -251,7 +257,7 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
251 last_page = NULL; 257 last_page = NULL;
252 for (i = 0; i < count; i++) { 258 for (i = 0; i < count; i++) {
253 int index = pg_start + i; 259 int index = pg_start + i;
254 unsigned long insert = mem->memory[i]; 260 unsigned long insert = efficeon_mask_memory(mem->memory[i]);
255 261
256 page = (unsigned int *) efficeon_private.l1_table[index >> 10]; 262 page = (unsigned int *) efficeon_private.l1_table[index >> 10];
257 263
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 927a5bbe112c..a370e7a0bad5 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -142,7 +142,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc,
142 if (!boardno) 142 if (!boardno)
143 boardno = readb(loc + NUMCARD_OWNER_TO_PC); 143 boardno = readb(loc + NUMCARD_OWNER_TO_PC);
144 144
145 if (!boardno && boardno > MAX_BOARD) { 145 if (!boardno || boardno > MAX_BOARD) {
146 printk(KERN_WARNING "Board #%d (at 0x%lx) is out of range (1 <= x <= %d).\n", 146 printk(KERN_WARNING "Board #%d (at 0x%lx) is out of range (1 <= x <= %d).\n",
147 boardno, physloc, MAX_BOARD); 147 boardno, physloc, MAX_BOARD);
148 return 0; 148 return 0;
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c
index 5d72f50de1ac..46d66037b917 100644
--- a/drivers/char/cs5535_gpio.c
+++ b/drivers/char/cs5535_gpio.c
@@ -241,9 +241,10 @@ static int __init cs5535_gpio_init(void)
241static void __exit cs5535_gpio_cleanup(void) 241static void __exit cs5535_gpio_cleanup(void)
242{ 242{
243 dev_t dev_id = MKDEV(major, 0); 243 dev_t dev_id = MKDEV(major, 0);
244
245 cdev_del(&cs5535_gpio_cdev);
244 unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT); 246 unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
245 if (gpio_base != 0) 247 release_region(gpio_base, CS5535_GPIO_SIZE);
246 release_region(gpio_base, CS5535_GPIO_SIZE);
247} 248}
248 249
249module_init(cs5535_gpio_init); 250module_init(cs5535_gpio_init);
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index edc72a6348a7..e1aadae00623 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -815,8 +815,6 @@ extern int drm_mem_info(char *buf, char **start, off_t offset,
815extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); 815extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
816extern void *drm_ioremap(unsigned long offset, unsigned long size, 816extern void *drm_ioremap(unsigned long offset, unsigned long size,
817 drm_device_t * dev); 817 drm_device_t * dev);
818extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
819 drm_device_t * dev);
820extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev); 818extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev);
821 819
822extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type); 820extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type);
@@ -1022,11 +1020,13 @@ static __inline__ void drm_core_ioremap(struct drm_map *map,
1022 map->handle = drm_ioremap(map->offset, map->size, dev); 1020 map->handle = drm_ioremap(map->offset, map->size, dev);
1023} 1021}
1024 1022
1023#if 0
1025static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, 1024static __inline__ void drm_core_ioremap_nocache(struct drm_map *map,
1026 struct drm_device *dev) 1025 struct drm_device *dev)
1027{ 1026{
1028 map->handle = drm_ioremap_nocache(map->offset, map->size, dev); 1027 map->handle = drm_ioremap_nocache(map->offset, map->size, dev);
1029} 1028}
1029#endif /* 0 */
1030 1030
1031static __inline__ void drm_core_ioremapfree(struct drm_map *map, 1031static __inline__ void drm_core_ioremapfree(struct drm_map *map,
1032 struct drm_device *dev) 1032 struct drm_device *dev)
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index dc6bbe8a18dc..3c0b882a8e72 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -75,8 +75,8 @@ static drm_ioctl_desc_t drm_ioctls[] = {
75 [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = {drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, 75 [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = {drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
76 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = {drm_getsareactx, DRM_AUTH}, 76 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = {drm_getsareactx, DRM_AUTH},
77 77
78 [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, 78 [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, DRM_AUTH|DRM_ROOT_ONLY},
79 [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = {drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, 79 [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = {drm_rmctx, DRM_AUTH|DRM_ROOT_ONLY},
80 [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = {drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, 80 [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = {drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
81 [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, DRM_AUTH}, 81 [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, DRM_AUTH},
82 [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = {drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, 82 [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = {drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c
index dddf8de66143..7e3318e1d1c6 100644
--- a/drivers/char/drm/drm_memory.c
+++ b/drivers/char/drm/drm_memory.c
@@ -80,6 +80,71 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
80} 80}
81 81
82#if __OS_HAS_AGP 82#if __OS_HAS_AGP
83/*
84 * Find the drm_map that covers the range [offset, offset+size).
85 */
86static drm_map_t *drm_lookup_map(unsigned long offset,
87 unsigned long size, drm_device_t * dev)
88{
89 struct list_head *list;
90 drm_map_list_t *r_list;
91 drm_map_t *map;
92
93 list_for_each(list, &dev->maplist->head) {
94 r_list = (drm_map_list_t *) list;
95 map = r_list->map;
96 if (!map)
97 continue;
98 if (map->offset <= offset
99 && (offset + size) <= (map->offset + map->size))
100 return map;
101 }
102 return NULL;
103}
104
105static void *agp_remap(unsigned long offset, unsigned long size,
106 drm_device_t * dev)
107{
108 unsigned long *phys_addr_map, i, num_pages =
109 PAGE_ALIGN(size) / PAGE_SIZE;
110 struct drm_agp_mem *agpmem;
111 struct page **page_map;
112 void *addr;
113
114 size = PAGE_ALIGN(size);
115
116#ifdef __alpha__
117 offset -= dev->hose->mem_space->start;
118#endif
119
120 for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next)
121 if (agpmem->bound <= offset
122 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
123 (offset + size))
124 break;
125 if (!agpmem)
126 return NULL;
127
128 /*
129 * OK, we're mapping AGP space on a chipset/platform on which memory accesses by
130 * the CPU do not get remapped by the GART. We fix this by using the kernel's
131 * page-table instead (that's probably faster anyhow...).
132 */
133 /* note: use vmalloc() because num_pages could be large... */
134 page_map = vmalloc(num_pages * sizeof(struct page *));
135 if (!page_map)
136 return NULL;
137
138 phys_addr_map =
139 agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE;
140 for (i = 0; i < num_pages; ++i)
141 page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT);
142 addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP);
143 vfree(page_map);
144
145 return addr;
146}
147
83/** Wrapper around agp_allocate_memory() */ 148/** Wrapper around agp_allocate_memory() */
84DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) 149DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type)
85{ 150{
@@ -103,5 +168,74 @@ int drm_unbind_agp(DRM_AGP_MEM * handle)
103{ 168{
104 return drm_agp_unbind_memory(handle); 169 return drm_agp_unbind_memory(handle);
105} 170}
171
172#else /* __OS_HAS_AGP */
173
174static inline drm_map_t *drm_lookup_map(unsigned long offset,
175 unsigned long size, drm_device_t * dev)
176{
177 return NULL;
178}
179
180static inline void *agp_remap(unsigned long offset, unsigned long size,
181 drm_device_t * dev)
182{
183 return NULL;
184}
185
106#endif /* agp */ 186#endif /* agp */
187
188void *drm_ioremap(unsigned long offset, unsigned long size,
189 drm_device_t * dev)
190{
191 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
192 drm_map_t *map = drm_lookup_map(offset, size, dev);
193
194 if (map && map->type == _DRM_AGP)
195 return agp_remap(offset, size, dev);
196 }
197 return ioremap(offset, size);
198}
199EXPORT_SYMBOL(drm_ioremap);
200
201#if 0
202void *drm_ioremap_nocache(unsigned long offset,
203 unsigned long size, drm_device_t * dev)
204{
205 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
206 drm_map_t *map = drm_lookup_map(offset, size, dev);
207
208 if (map && map->type == _DRM_AGP)
209 return agp_remap(offset, size, dev);
210 }
211 return ioremap_nocache(offset, size);
212}
213#endif /* 0 */
214
215void drm_ioremapfree(void *pt, unsigned long size,
216 drm_device_t * dev)
217{
218 /*
219 * This is a bit ugly. It would be much cleaner if the DRM API would use separate
220 * routines for handling mappings in the AGP space. Hopefully this can be done in
221 * a future revision of the interface...
222 */
223 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture
224 && ((unsigned long)pt >= VMALLOC_START
225 && (unsigned long)pt < VMALLOC_END)) {
226 unsigned long offset;
227 drm_map_t *map;
228
229 offset = drm_follow_page(pt) | ((unsigned long)pt & ~PAGE_MASK);
230 map = drm_lookup_map(offset, size, dev);
231 if (map && map->type == _DRM_AGP) {
232 vunmap(pt);
233 return;
234 }
235 }
236
237 iounmap(pt);
238}
239EXPORT_SYMBOL(drm_ioremapfree);
240
107#endif /* debug_memory */ 241#endif /* debug_memory */
diff --git a/drivers/char/drm/drm_memory.h b/drivers/char/drm/drm_memory.h
index 3732a61c3762..714d9aedcff5 100644
--- a/drivers/char/drm/drm_memory.h
+++ b/drivers/char/drm/drm_memory.h
@@ -57,71 +57,6 @@
57# endif 57# endif
58#endif 58#endif
59 59
60/*
61 * Find the drm_map that covers the range [offset, offset+size).
62 */
63static inline drm_map_t *drm_lookup_map(unsigned long offset,
64 unsigned long size, drm_device_t * dev)
65{
66 struct list_head *list;
67 drm_map_list_t *r_list;
68 drm_map_t *map;
69
70 list_for_each(list, &dev->maplist->head) {
71 r_list = (drm_map_list_t *) list;
72 map = r_list->map;
73 if (!map)
74 continue;
75 if (map->offset <= offset
76 && (offset + size) <= (map->offset + map->size))
77 return map;
78 }
79 return NULL;
80}
81
82static inline void *agp_remap(unsigned long offset, unsigned long size,
83 drm_device_t * dev)
84{
85 unsigned long *phys_addr_map, i, num_pages =
86 PAGE_ALIGN(size) / PAGE_SIZE;
87 struct drm_agp_mem *agpmem;
88 struct page **page_map;
89 void *addr;
90
91 size = PAGE_ALIGN(size);
92
93#ifdef __alpha__
94 offset -= dev->hose->mem_space->start;
95#endif
96
97 for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next)
98 if (agpmem->bound <= offset
99 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
100 (offset + size))
101 break;
102 if (!agpmem)
103 return NULL;
104
105 /*
106 * OK, we're mapping AGP space on a chipset/platform on which memory accesses by
107 * the CPU do not get remapped by the GART. We fix this by using the kernel's
108 * page-table instead (that's probably faster anyhow...).
109 */
110 /* note: use vmalloc() because num_pages could be large... */
111 page_map = vmalloc(num_pages * sizeof(struct page *));
112 if (!page_map)
113 return NULL;
114
115 phys_addr_map =
116 agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE;
117 for (i = 0; i < num_pages; ++i)
118 page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT);
119 addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP);
120 vfree(page_map);
121
122 return addr;
123}
124
125static inline unsigned long drm_follow_page(void *vaddr) 60static inline unsigned long drm_follow_page(void *vaddr)
126{ 61{
127 pgd_t *pgd = pgd_offset_k((unsigned long)vaddr); 62 pgd_t *pgd = pgd_offset_k((unsigned long)vaddr);
@@ -133,18 +68,6 @@ static inline unsigned long drm_follow_page(void *vaddr)
133 68
134#else /* __OS_HAS_AGP */ 69#else /* __OS_HAS_AGP */
135 70
136static inline drm_map_t *drm_lookup_map(unsigned long offset,
137 unsigned long size, drm_device_t * dev)
138{
139 return NULL;
140}
141
142static inline void *agp_remap(unsigned long offset, unsigned long size,
143 drm_device_t * dev)
144{
145 return NULL;
146}
147
148static inline unsigned long drm_follow_page(void *vaddr) 71static inline unsigned long drm_follow_page(void *vaddr)
149{ 72{
150 return 0; 73 return 0;
@@ -152,51 +75,8 @@ static inline unsigned long drm_follow_page(void *vaddr)
152 75
153#endif 76#endif
154 77
155static inline void *drm_ioremap(unsigned long offset, unsigned long size, 78void *drm_ioremap(unsigned long offset, unsigned long size,
156 drm_device_t * dev) 79 drm_device_t * dev);
157{
158 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
159 drm_map_t *map = drm_lookup_map(offset, size, dev);
160
161 if (map && map->type == _DRM_AGP)
162 return agp_remap(offset, size, dev);
163 }
164 return ioremap(offset, size);
165}
166
167static inline void *drm_ioremap_nocache(unsigned long offset,
168 unsigned long size, drm_device_t * dev)
169{
170 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
171 drm_map_t *map = drm_lookup_map(offset, size, dev);
172
173 if (map && map->type == _DRM_AGP)
174 return agp_remap(offset, size, dev);
175 }
176 return ioremap_nocache(offset, size);
177}
178
179static inline void drm_ioremapfree(void *pt, unsigned long size,
180 drm_device_t * dev)
181{
182 /*
183 * This is a bit ugly. It would be much cleaner if the DRM API would use separate
184 * routines for handling mappings in the AGP space. Hopefully this can be done in
185 * a future revision of the interface...
186 */
187 if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture
188 && ((unsigned long)pt >= VMALLOC_START
189 && (unsigned long)pt < VMALLOC_END)) {
190 unsigned long offset;
191 drm_map_t *map;
192
193 offset = drm_follow_page(pt) | ((unsigned long)pt & ~PAGE_MASK);
194 map = drm_lookup_map(offset, size, dev);
195 if (map && map->type == _DRM_AGP) {
196 vunmap(pt);
197 return;
198 }
199 }
200 80
201 iounmap(pt); 81void drm_ioremapfree(void *pt, unsigned long size,
202} 82 drm_device_t * dev);
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h
index 7868341817da..6543b9a14c42 100644
--- a/drivers/char/drm/drm_memory_debug.h
+++ b/drivers/char/drm/drm_memory_debug.h
@@ -229,6 +229,7 @@ void *drm_ioremap (unsigned long offset, unsigned long size,
229 return pt; 229 return pt;
230} 230}
231 231
232#if 0
232void *drm_ioremap_nocache (unsigned long offset, unsigned long size, 233void *drm_ioremap_nocache (unsigned long offset, unsigned long size,
233 drm_device_t * dev) { 234 drm_device_t * dev) {
234 void *pt; 235 void *pt;
@@ -251,6 +252,7 @@ void *drm_ioremap_nocache (unsigned long offset, unsigned long size,
251 spin_unlock(&drm_mem_lock); 252 spin_unlock(&drm_mem_lock);
252 return pt; 253 return pt;
253} 254}
255#endif /* 0 */
254 256
255void drm_ioremapfree (void *pt, unsigned long size, drm_device_t * dev) { 257void drm_ioremapfree (void *pt, unsigned long size, drm_device_t * dev) {
256 int alloc_count; 258 int alloc_count;
diff --git a/drivers/char/drm/drm_pci.c b/drivers/char/drm/drm_pci.c
index b28ca9cea8a2..86a0f1c22091 100644
--- a/drivers/char/drm/drm_pci.c
+++ b/drivers/char/drm/drm_pci.c
@@ -37,6 +37,7 @@
37 */ 37 */
38 38
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/dma-mapping.h>
40#include "drmP.h" 41#include "drmP.h"
41 42
42/**********************************************************************/ 43/**********************************************************************/
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c
index 6152415644e9..c33d068cde19 100644
--- a/drivers/char/drm/via_irq.c
+++ b/drivers/char/drm/via_irq.c
@@ -196,9 +196,9 @@ via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence,
196{ 196{
197 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 197 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
198 unsigned int cur_irq_sequence; 198 unsigned int cur_irq_sequence;
199 drm_via_irq_t *cur_irq = dev_priv->via_irqs; 199 drm_via_irq_t *cur_irq;
200 int ret = 0; 200 int ret = 0;
201 maskarray_t *masks = dev_priv->irq_masks; 201 maskarray_t *masks;
202 int real_irq; 202 int real_irq;
203 203
204 DRM_DEBUG("%s\n", __FUNCTION__); 204 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -221,8 +221,9 @@ via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence,
221 __FUNCTION__, irq); 221 __FUNCTION__, irq);
222 return DRM_ERR(EINVAL); 222 return DRM_ERR(EINVAL);
223 } 223 }
224 224
225 cur_irq += real_irq; 225 masks = dev_priv->irq_masks;
226 cur_irq = dev_priv->via_irqs + real_irq;
226 227
227 if (masks[real_irq][2] && !force_sequence) { 228 if (masks[real_irq][2] && !force_sequence) {
228 DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ, 229 DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ,
@@ -247,11 +248,12 @@ void via_driver_irq_preinstall(drm_device_t * dev)
247{ 248{
248 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 249 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
249 u32 status; 250 u32 status;
250 drm_via_irq_t *cur_irq = dev_priv->via_irqs; 251 drm_via_irq_t *cur_irq;
251 int i; 252 int i;
252 253
253 DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv); 254 DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv);
254 if (dev_priv) { 255 if (dev_priv) {
256 cur_irq = dev_priv->via_irqs;
255 257
256 dev_priv->irq_enable_mask = VIA_IRQ_VBLANK_ENABLE; 258 dev_priv->irq_enable_mask = VIA_IRQ_VBLANK_ENABLE;
257 dev_priv->irq_pending_mask = VIA_IRQ_VBLANK_PENDING; 259 dev_priv->irq_pending_mask = VIA_IRQ_VBLANK_PENDING;
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index a229915ce1b2..87dcaa237f07 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -490,7 +490,7 @@ for (i = 0; i < 10; i++) \
490 release_region(dtlk_portlist[i], DTLK_IO_EXTENT); 490 release_region(dtlk_portlist[i], DTLK_IO_EXTENT);
491 } 491 }
492 492
493 printk(KERN_INFO "\nDoubleTalk PC - not found\n"); 493 printk(KERN_INFO "DoubleTalk PC - not found\n");
494 return -ENODEV; 494 return -ENODEV;
495} 495}
496 496
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
index 58dcdee1cd71..0030cd8e2e95 100644
--- a/drivers/char/ipmi/ipmi_bt_sm.c
+++ b/drivers/char/ipmi/ipmi_bt_sm.c
@@ -165,7 +165,7 @@ static int bt_start_transaction(struct si_sm_data *bt,
165{ 165{
166 unsigned int i; 166 unsigned int i;
167 167
168 if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) 168 if ((size < 2) || (size > (IPMI_MAX_MSG_LENGTH - 2)))
169 return -1; 169 return -1;
170 170
171 if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) 171 if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED))
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 0ded046d5aa8..9f2f8fdec69a 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -941,6 +941,7 @@ int ipmi_set_gets_events(ipmi_user_t user, int val)
941 list_del(&msg->link); 941 list_del(&msg->link);
942 list_add_tail(&msg->link, &msgs); 942 list_add_tail(&msg->link, &msgs);
943 } 943 }
944 intf->waiting_events_count = 0;
944 } 945 }
945 946
946 /* Hold the events lock while doing this to preserve order. */ 947 /* Hold the events lock while doing this to preserve order. */
@@ -2916,6 +2917,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
2916 2917
2917 copy_event_into_recv_msg(recv_msg, msg); 2918 copy_event_into_recv_msg(recv_msg, msg);
2918 list_add_tail(&(recv_msg->link), &(intf->waiting_events)); 2919 list_add_tail(&(recv_msg->link), &(intf->waiting_events));
2920 intf->waiting_events_count++;
2919 } else { 2921 } else {
2920 /* There's too many things in the queue, discard this 2922 /* There's too many things in the queue, discard this
2921 message. */ 2923 message. */
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index a86c0f29953e..b36eef0e9d19 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2198,11 +2198,11 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
2198 } 2198 }
2199} 2199}
2200 2200
2201static struct ipmi_default_vals 2201static __devinitdata struct ipmi_default_vals
2202{ 2202{
2203 int type; 2203 int type;
2204 int port; 2204 int port;
2205} __devinit ipmi_defaults[] = 2205} ipmi_defaults[] =
2206{ 2206{
2207 { .type = SI_KCS, .port = 0xca2 }, 2207 { .type = SI_KCS, .port = 0xca2 },
2208 { .type = SI_SMIC, .port = 0xca9 }, 2208 { .type = SI_SMIC, .port = 0xca9 },
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 86be04b241e1..58f3512c52e1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1584,7 +1584,6 @@ u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dpo
1584 1584
1585 return twothirdsMD4Transform(daddr, hash); 1585 return twothirdsMD4Transform(daddr, hash);
1586} 1586}
1587EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
1588#endif 1587#endif
1589 1588
1590#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 1589#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index f8dd8527c6aa..a90f5d97df35 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1341,6 +1341,9 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1341 else if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 1341 else if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
1342 PCI_DEVICE_ID_INTEL_ICH6_1, NULL))) 1342 PCI_DEVICE_ID_INTEL_ICH6_1, NULL)))
1343 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3; 1343 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3;
1344 else if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
1345 PCI_DEVICE_ID_INTEL_ICH7_1, NULL)))
1346 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3;
1344 else 1347 else
1345 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2; 1348 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2;
1346 1349
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 2546637a55c0..f58ad7f68267 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -327,7 +327,7 @@ static ssize_t store_received_ref_clk3a(struct device *d,
327 return strnlen(buf, count); 327 return strnlen(buf, count);
328} 328}
329 329
330static DEVICE_ATTR(received_ref_clk3a, S_IWUGO, NULL, 330static DEVICE_ATTR(received_ref_clk3a, (S_IWUSR|S_IWGRP), NULL,
331 store_received_ref_clk3a); 331 store_received_ref_clk3a);
332 332
333 333
@@ -349,7 +349,7 @@ static ssize_t store_received_ref_clk3b(struct device *d,
349 return strnlen(buf, count); 349 return strnlen(buf, count);
350} 350}
351 351
352static DEVICE_ATTR(received_ref_clk3b, S_IWUGO, NULL, 352static DEVICE_ATTR(received_ref_clk3b, (S_IWUSR|S_IWGRP), NULL,
353 store_received_ref_clk3b); 353 store_received_ref_clk3b);
354 354
355 355
@@ -371,7 +371,7 @@ static ssize_t store_enable_clk3b_output(struct device *d,
371 return strnlen(buf, count); 371 return strnlen(buf, count);
372} 372}
373 373
374static DEVICE_ATTR(enable_clk3b_output, S_IWUGO, NULL, 374static DEVICE_ATTR(enable_clk3b_output, (S_IWUSR|S_IWGRP), NULL,
375 store_enable_clk3b_output); 375 store_enable_clk3b_output);
376 376
377static ssize_t store_enable_clk3a_output(struct device *d, 377static ssize_t store_enable_clk3a_output(struct device *d,
@@ -392,7 +392,7 @@ static ssize_t store_enable_clk3a_output(struct device *d,
392 return strnlen(buf, count); 392 return strnlen(buf, count);
393} 393}
394 394
395static DEVICE_ATTR(enable_clk3a_output, S_IWUGO, NULL, 395static DEVICE_ATTR(enable_clk3a_output, (S_IWUSR|S_IWGRP), NULL,
396 store_enable_clk3a_output); 396 store_enable_clk3a_output);
397 397
398static ssize_t store_enable_clkb1_output(struct device *d, 398static ssize_t store_enable_clkb1_output(struct device *d,
@@ -413,7 +413,7 @@ static ssize_t store_enable_clkb1_output(struct device *d,
413 return strnlen(buf, count); 413 return strnlen(buf, count);
414} 414}
415 415
416static DEVICE_ATTR(enable_clkb1_output, S_IWUGO, NULL, 416static DEVICE_ATTR(enable_clkb1_output, (S_IWUSR|S_IWGRP), NULL,
417 store_enable_clkb1_output); 417 store_enable_clkb1_output);
418 418
419 419
@@ -435,7 +435,7 @@ static ssize_t store_enable_clka1_output(struct device *d,
435 return strnlen(buf, count); 435 return strnlen(buf, count);
436} 436}
437 437
438static DEVICE_ATTR(enable_clka1_output, S_IWUGO, NULL, 438static DEVICE_ATTR(enable_clka1_output, (S_IWUSR|S_IWGRP), NULL,
439 store_enable_clka1_output); 439 store_enable_clka1_output);
440 440
441static ssize_t store_enable_clkb0_output(struct device *d, 441static ssize_t store_enable_clkb0_output(struct device *d,
@@ -456,7 +456,7 @@ static ssize_t store_enable_clkb0_output(struct device *d,
456 return strnlen(buf, count); 456 return strnlen(buf, count);
457} 457}
458 458
459static DEVICE_ATTR(enable_clkb0_output, S_IWUGO, NULL, 459static DEVICE_ATTR(enable_clkb0_output, (S_IWUSR|S_IWGRP), NULL,
460 store_enable_clkb0_output); 460 store_enable_clkb0_output);
461 461
462static ssize_t store_enable_clka0_output(struct device *d, 462static ssize_t store_enable_clka0_output(struct device *d,
@@ -477,7 +477,7 @@ static ssize_t store_enable_clka0_output(struct device *d,
477 return strnlen(buf, count); 477 return strnlen(buf, count);
478} 478}
479 479
480static DEVICE_ATTR(enable_clka0_output, S_IWUGO, NULL, 480static DEVICE_ATTR(enable_clka0_output, (S_IWUSR|S_IWGRP), NULL,
481 store_enable_clka0_output); 481 store_enable_clka0_output);
482 482
483static ssize_t store_select_amcb2_transmit_clock(struct device *d, 483static ssize_t store_select_amcb2_transmit_clock(struct device *d,
@@ -519,7 +519,7 @@ static ssize_t store_select_amcb2_transmit_clock(struct device *d,
519 return strnlen(buf, count); 519 return strnlen(buf, count);
520} 520}
521 521
522static DEVICE_ATTR(select_amcb2_transmit_clock, S_IWUGO, NULL, 522static DEVICE_ATTR(select_amcb2_transmit_clock, (S_IWUSR|S_IWGRP), NULL,
523 store_select_amcb2_transmit_clock); 523 store_select_amcb2_transmit_clock);
524 524
525static ssize_t store_select_amcb1_transmit_clock(struct device *d, 525static ssize_t store_select_amcb1_transmit_clock(struct device *d,
@@ -560,7 +560,7 @@ static ssize_t store_select_amcb1_transmit_clock(struct device *d,
560 return strnlen(buf, count); 560 return strnlen(buf, count);
561} 561}
562 562
563static DEVICE_ATTR(select_amcb1_transmit_clock, S_IWUGO, NULL, 563static DEVICE_ATTR(select_amcb1_transmit_clock, (S_IWUSR|S_IWGRP), NULL,
564 store_select_amcb1_transmit_clock); 564 store_select_amcb1_transmit_clock);
565 565
566static ssize_t store_select_redundant_clock(struct device *d, 566static ssize_t store_select_redundant_clock(struct device *d,
@@ -581,7 +581,7 @@ static ssize_t store_select_redundant_clock(struct device *d,
581 return strnlen(buf, count); 581 return strnlen(buf, count);
582} 582}
583 583
584static DEVICE_ATTR(select_redundant_clock, S_IWUGO, NULL, 584static DEVICE_ATTR(select_redundant_clock, (S_IWUSR|S_IWGRP), NULL,
585 store_select_redundant_clock); 585 store_select_redundant_clock);
586 586
587static ssize_t store_select_ref_frequency(struct device *d, 587static ssize_t store_select_ref_frequency(struct device *d,
@@ -602,7 +602,7 @@ static ssize_t store_select_ref_frequency(struct device *d,
602 return strnlen(buf, count); 602 return strnlen(buf, count);
603} 603}
604 604
605static DEVICE_ATTR(select_ref_frequency, S_IWUGO, NULL, 605static DEVICE_ATTR(select_ref_frequency, (S_IWUSR|S_IWGRP), NULL,
606 store_select_ref_frequency); 606 store_select_ref_frequency);
607 607
608static ssize_t store_filter_select(struct device *d, 608static ssize_t store_filter_select(struct device *d,
@@ -623,7 +623,7 @@ static ssize_t store_filter_select(struct device *d,
623 return strnlen(buf, count); 623 return strnlen(buf, count);
624} 624}
625 625
626static DEVICE_ATTR(filter_select, S_IWUGO, NULL, store_filter_select); 626static DEVICE_ATTR(filter_select, (S_IWUSR|S_IWGRP), NULL, store_filter_select);
627 627
628static ssize_t store_hardware_switching_mode(struct device *d, 628static ssize_t store_hardware_switching_mode(struct device *d,
629 struct device_attribute *attr, const char *buf, size_t count) 629 struct device_attribute *attr, const char *buf, size_t count)
@@ -643,7 +643,7 @@ static ssize_t store_hardware_switching_mode(struct device *d,
643 return strnlen(buf, count); 643 return strnlen(buf, count);
644} 644}
645 645
646static DEVICE_ATTR(hardware_switching_mode, S_IWUGO, NULL, 646static DEVICE_ATTR(hardware_switching_mode, (S_IWUSR|S_IWGRP), NULL,
647 store_hardware_switching_mode); 647 store_hardware_switching_mode);
648 648
649static ssize_t store_hardware_switching(struct device *d, 649static ssize_t store_hardware_switching(struct device *d,
@@ -664,7 +664,7 @@ static ssize_t store_hardware_switching(struct device *d,
664 return strnlen(buf, count); 664 return strnlen(buf, count);
665} 665}
666 666
667static DEVICE_ATTR(hardware_switching, S_IWUGO, NULL, 667static DEVICE_ATTR(hardware_switching, (S_IWUSR|S_IWGRP), NULL,
668 store_hardware_switching); 668 store_hardware_switching);
669 669
670static ssize_t store_refalign (struct device *d, 670static ssize_t store_refalign (struct device *d,
@@ -684,7 +684,7 @@ static ssize_t store_refalign (struct device *d,
684 return strnlen(buf, count); 684 return strnlen(buf, count);
685} 685}
686 686
687static DEVICE_ATTR(refalign, S_IWUGO, NULL, store_refalign); 687static DEVICE_ATTR(refalign, (S_IWUSR|S_IWGRP), NULL, store_refalign);
688 688
689static ssize_t store_mode_select (struct device *d, 689static ssize_t store_mode_select (struct device *d,
690 struct device_attribute *attr, const char *buf, size_t count) 690 struct device_attribute *attr, const char *buf, size_t count)
@@ -704,7 +704,7 @@ static ssize_t store_mode_select (struct device *d,
704 return strnlen(buf, count); 704 return strnlen(buf, count);
705} 705}
706 706
707static DEVICE_ATTR(mode_select, S_IWUGO, NULL, store_mode_select); 707static DEVICE_ATTR(mode_select, (S_IWUSR|S_IWGRP), NULL, store_mode_select);
708 708
709static ssize_t store_reset (struct device *d, 709static ssize_t store_reset (struct device *d,
710 struct device_attribute *attr, const char *buf, size_t count) 710 struct device_attribute *attr, const char *buf, size_t count)
@@ -724,7 +724,7 @@ static ssize_t store_reset (struct device *d,
724 return strnlen(buf, count); 724 return strnlen(buf, count);
725} 725}
726 726
727static DEVICE_ATTR(reset, S_IWUGO, NULL, store_reset); 727static DEVICE_ATTR(reset, (S_IWUSR|S_IWGRP), NULL, store_reset);
728 728
729static struct attribute *tlclk_sysfs_entries[] = { 729static struct attribute *tlclk_sysfs_entries[] = {
730 &dev_attr_current_ref.attr, 730 &dev_attr_current_ref.attr,
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 98b126c2ded8..f07637a8f88f 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -351,10 +351,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
351 spin_unlock_irqrestore(&tty->buf.lock, flags); 351 spin_unlock_irqrestore(&tty->buf.lock, flags);
352 return size; 352 return size;
353} 353}
354
355EXPORT_SYMBOL_GPL(tty_buffer_request_room); 354EXPORT_SYMBOL_GPL(tty_buffer_request_room);
356 355
357int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) 356int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars,
357 size_t size)
358{ 358{
359 int copied = 0; 359 int copied = 0;
360 do { 360 do {
@@ -368,17 +368,16 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, s
368 tb->used += space; 368 tb->used += space;
369 copied += space; 369 copied += space;
370 chars += space; 370 chars += space;
371/* printk("Flip insert %d.\n", space); */
372 } 371 }
373 /* There is a small chance that we need to split the data over 372 /* There is a small chance that we need to split the data over
374 several buffers. If this is the case we must loop */ 373 several buffers. If this is the case we must loop */
375 while (unlikely(size > copied)); 374 while (unlikely(size > copied));
376 return copied; 375 return copied;
377} 376}
378
379EXPORT_SYMBOL(tty_insert_flip_string); 377EXPORT_SYMBOL(tty_insert_flip_string);
380 378
381int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) 379int tty_insert_flip_string_flags(struct tty_struct *tty,
380 const unsigned char *chars, const char *flags, size_t size)
382{ 381{
383 int copied = 0; 382 int copied = 0;
384 do { 383 do {
@@ -399,9 +398,20 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *ch
399 while (unlikely(size > copied)); 398 while (unlikely(size > copied));
400 return copied; 399 return copied;
401} 400}
402
403EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); 401EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags);
404 402
403void tty_schedule_flip(struct tty_struct *tty)
404{
405 unsigned long flags;
406 spin_lock_irqsave(&tty->buf.lock, flags);
407 if (tty->buf.tail != NULL) {
408 tty->buf.tail->active = 0;
409 tty->buf.tail->commit = tty->buf.tail->used;
410 }
411 spin_unlock_irqrestore(&tty->buf.lock, flags);
412 schedule_delayed_work(&tty->buf.work, 1);
413}
414EXPORT_SYMBOL(tty_schedule_flip);
405 415
406/* 416/*
407 * Prepare a block of space in the buffer for data. Returns the length 417 * Prepare a block of space in the buffer for data. Returns the length
@@ -1730,7 +1740,7 @@ static void release_dev(struct file * filp)
1730{ 1740{
1731 struct tty_struct *tty, *o_tty; 1741 struct tty_struct *tty, *o_tty;
1732 int pty_master, tty_closing, o_tty_closing, do_sleep; 1742 int pty_master, tty_closing, o_tty_closing, do_sleep;
1733 int devpts_master, devpts; 1743 int devpts;
1734 int idx; 1744 int idx;
1735 char buf[64]; 1745 char buf[64];
1736 unsigned long flags; 1746 unsigned long flags;
@@ -1747,7 +1757,6 @@ static void release_dev(struct file * filp)
1747 pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && 1757 pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
1748 tty->driver->subtype == PTY_TYPE_MASTER); 1758 tty->driver->subtype == PTY_TYPE_MASTER);
1749 devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0; 1759 devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
1750 devpts_master = pty_master && devpts;
1751 o_tty = tty->link; 1760 o_tty = tty->link;
1752 1761
1753#ifdef TTY_PARANOIA_CHECK 1762#ifdef TTY_PARANOIA_CHECK
@@ -2185,6 +2194,7 @@ static int ptmx_open(struct inode * inode, struct file * filp)
2185 return 0; 2194 return 0;
2186out1: 2195out1:
2187 release_dev(filp); 2196 release_dev(filp);
2197 return retval;
2188out: 2198out:
2189 down(&allocated_ptys_lock); 2199 down(&allocated_ptys_lock);
2190 idr_remove(&allocated_ptys, index); 2200 idr_remove(&allocated_ptys, index);
@@ -2713,7 +2723,11 @@ static void __do_SAK(void *arg)
2713 } 2723 }
2714 task_lock(p); 2724 task_lock(p);
2715 if (p->files) { 2725 if (p->files) {
2716 rcu_read_lock(); 2726 /*
2727 * We don't take a ref to the file, so we must
2728 * hold ->file_lock instead.
2729 */
2730 spin_lock(&p->files->file_lock);
2717 fdt = files_fdtable(p->files); 2731 fdt = files_fdtable(p->files);
2718 for (i=0; i < fdt->max_fds; i++) { 2732 for (i=0; i < fdt->max_fds; i++) {
2719 filp = fcheck_files(p->files, i); 2733 filp = fcheck_files(p->files, i);
@@ -2724,11 +2738,11 @@ static void __do_SAK(void *arg)
2724 printk(KERN_NOTICE "SAK: killed process %d" 2738 printk(KERN_NOTICE "SAK: killed process %d"
2725 " (%s): fd#%d opened to the tty\n", 2739 " (%s): fd#%d opened to the tty\n",
2726 p->pid, p->comm, i); 2740 p->pid, p->comm, i);
2727 send_sig(SIGKILL, p, 1); 2741 force_sig(SIGKILL, p);
2728 break; 2742 break;
2729 } 2743 }
2730 } 2744 }
2731 rcu_read_unlock(); 2745 spin_unlock(&p->files->file_lock);
2732 } 2746 }
2733 task_unlock(p); 2747 task_unlock(p);
2734 } while_each_thread(g, p); 2748 } while_each_thread(g, p);
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 60c9be99c6d9..2cc71b66231e 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -99,7 +99,7 @@ config CPU_FREQ_GOV_USERSPACE
99 Enable this cpufreq governor when you either want to set the 99 Enable this cpufreq governor when you either want to set the
100 CPU frequency manually or when an userspace program shall 100 CPU frequency manually or when an userspace program shall
101 be able to set the CPU dynamically, like on LART 101 be able to set the CPU dynamically, like on LART
102 <http://www.lart.tudelft.nl/> 102 <http://www.lartmaker.nl/>.
103 103
104 For details, take a look at <file:Documentation/cpu-freq/>. 104 For details, take a look at <file:Documentation/cpu-freq/>.
105 105
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9b6ae7dc8b8a..9759d05b1972 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -319,7 +319,6 @@ out:
319 } 319 }
320 return -EINVAL; 320 return -EINVAL;
321} 321}
322EXPORT_SYMBOL_GPL(cpufreq_parse_governor);
323 322
324 323
325/* drivers/base/cpu.c */ 324/* drivers/base/cpu.c */
@@ -346,6 +345,8 @@ show_one(scaling_min_freq, min);
346show_one(scaling_max_freq, max); 345show_one(scaling_max_freq, max);
347show_one(scaling_cur_freq, cur); 346show_one(scaling_cur_freq, cur);
348 347
348static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy);
349
349/** 350/**
350 * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access 351 * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access
351 */ 352 */
@@ -364,7 +365,10 @@ static ssize_t store_##file_name \
364 if (ret != 1) \ 365 if (ret != 1) \
365 return -EINVAL; \ 366 return -EINVAL; \
366 \ 367 \
367 ret = cpufreq_set_policy(&new_policy); \ 368 mutex_lock(&policy->lock); \
369 ret = __cpufreq_set_policy(policy, &new_policy); \
370 policy->user_policy.object = policy->object; \
371 mutex_unlock(&policy->lock); \
368 \ 372 \
369 return ret ? ret : count; \ 373 return ret ? ret : count; \
370} 374}
@@ -420,7 +424,15 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
420 if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) 424 if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor))
421 return -EINVAL; 425 return -EINVAL;
422 426
423 ret = cpufreq_set_policy(&new_policy); 427 /* Do not use cpufreq_set_policy here or the user_policy.max
428 will be wrongly overridden */
429 mutex_lock(&policy->lock);
430 ret = __cpufreq_set_policy(policy, &new_policy);
431
432 policy->user_policy.policy = policy->policy;
433 policy->user_policy.governor = policy->governor;
434 mutex_unlock(&policy->lock);
435
424 return ret ? ret : count; 436 return ret ? ret : count;
425} 437}
426 438
@@ -685,7 +697,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
685 if (!cpu_online(j)) 697 if (!cpu_online(j))
686 continue; 698 continue;
687 699
688 dprintk("CPU already managed, adding link\n"); 700 dprintk("CPU %u already managed, adding link\n", j);
689 cpufreq_cpu_get(cpu); 701 cpufreq_cpu_get(cpu);
690 cpu_sys_dev = get_cpu_sysdev(j); 702 cpu_sys_dev = get_cpu_sysdev(j);
691 sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 703 sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
@@ -695,9 +707,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
695 policy->governor = NULL; /* to assure that the starting sequence is 707 policy->governor = NULL; /* to assure that the starting sequence is
696 * run in cpufreq_set_policy */ 708 * run in cpufreq_set_policy */
697 mutex_unlock(&policy->lock); 709 mutex_unlock(&policy->lock);
698 710
699 /* set default policy */ 711 /* set default policy */
700
701 ret = cpufreq_set_policy(&new_policy); 712 ret = cpufreq_set_policy(&new_policy);
702 if (ret) { 713 if (ret) {
703 dprintk("setting policy failed\n"); 714 dprintk("setting policy failed\n");
@@ -707,7 +718,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
707 module_put(cpufreq_driver->owner); 718 module_put(cpufreq_driver->owner);
708 dprintk("initialization complete\n"); 719 dprintk("initialization complete\n");
709 cpufreq_debug_enable_ratelimit(); 720 cpufreq_debug_enable_ratelimit();
710 721
711 return 0; 722 return 0;
712 723
713 724
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 037f6bf4543c..e07a35487bde 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -176,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
176 ret = sscanf (buf, "%u", &input); 176 ret = sscanf (buf, "%u", &input);
177 177
178 mutex_lock(&dbs_mutex); 178 mutex_lock(&dbs_mutex);
179 if (ret != 1 || input > 100 || input < 0 || 179 if (ret != 1 || input > 100 || input <= dbs_tuners_ins.down_threshold) {
180 input <= dbs_tuners_ins.down_threshold) {
181 mutex_unlock(&dbs_mutex); 180 mutex_unlock(&dbs_mutex);
182 return -EINVAL; 181 return -EINVAL;
183 } 182 }
@@ -196,8 +195,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
196 ret = sscanf (buf, "%u", &input); 195 ret = sscanf (buf, "%u", &input);
197 196
198 mutex_lock(&dbs_mutex); 197 mutex_lock(&dbs_mutex);
199 if (ret != 1 || input > 100 || input < 0 || 198 if (ret != 1 || input > 100 || input >= dbs_tuners_ins.up_threshold) {
200 input >= dbs_tuners_ins.up_threshold) {
201 mutex_unlock(&dbs_mutex); 199 mutex_unlock(&dbs_mutex);
202 return -EINVAL; 200 return -EINVAL;
203 } 201 }
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 85429979d0db..98e395f4bb29 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -1,7 +1,8 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4obj-$(CONFIG_EDD) += edd.o 4obj-$(CONFIG_DMI) += dmi_scan.o
5obj-$(CONFIG_EDD) += edd.o
5obj-$(CONFIG_EFI_VARS) += efivars.o 6obj-$(CONFIG_EFI_VARS) += efivars.o
6obj-$(CONFIG_EFI_PCDP) += pcdp.o 7obj-$(CONFIG_EFI_PCDP) += pcdp.o
7obj-$(CONFIG_DELL_RBU) += dell_rbu.o 8obj-$(CONFIG_DELL_RBU) += dell_rbu.o
diff --git a/arch/i386/kernel/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 5efceebc48dc..948bd7e1445a 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -27,7 +27,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
27 else 27 else
28 printk(KERN_ERR "dmi_string: out of memory.\n"); 28 printk(KERN_ERR "dmi_string: out of memory.\n");
29 } 29 }
30 } 30 }
31 31
32 return str; 32 return str;
33} 33}
@@ -41,7 +41,7 @@ static int __init dmi_table(u32 base, int len, int num,
41{ 41{
42 u8 *buf, *data; 42 u8 *buf, *data;
43 int i = 0; 43 int i = 0;
44 44
45 buf = dmi_ioremap(base, len); 45 buf = dmi_ioremap(base, len);
46 if (buf == NULL) 46 if (buf == NULL)
47 return -1; 47 return -1;
@@ -49,9 +49,9 @@ static int __init dmi_table(u32 base, int len, int num,
49 data = buf; 49 data = buf;
50 50
51 /* 51 /*
52 * Stop when we see all the items the table claimed to have 52 * Stop when we see all the items the table claimed to have
53 * OR we run off the end of the table (also happens) 53 * OR we run off the end of the table (also happens)
54 */ 54 */
55 while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { 55 while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
56 struct dmi_header *dm = (struct dmi_header *)data; 56 struct dmi_header *dm = (struct dmi_header *)data;
57 /* 57 /*
@@ -75,7 +75,7 @@ static int __init dmi_checksum(u8 *buf)
75{ 75{
76 u8 sum = 0; 76 u8 sum = 0;
77 int a; 77 int a;
78 78
79 for (a = 0; a < 15; a++) 79 for (a = 0; a < 15; a++)
80 sum += buf[a]; 80 sum += buf[a];
81 81
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 23a9e1ea8e32..1659f6c41458 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -509,12 +509,22 @@ static int hdaps_dmi_match_invert(struct dmi_system_id *id)
509 } \ 509 } \
510} 510}
511 511
512#define HDAPS_DMI_MATCH_LENOVO(model) { \
513 .ident = "Lenovo " model, \
514 .callback = hdaps_dmi_match_invert, \
515 .matches = { \
516 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), \
517 DMI_MATCH(DMI_PRODUCT_VERSION, model) \
518 } \
519}
520
512static int __init hdaps_init(void) 521static int __init hdaps_init(void)
513{ 522{
514 int ret; 523 int ret;
515 524
516 /* Note that DMI_MATCH(...,"ThinkPad T42") will match "ThinkPad T42p" */ 525 /* Note that DMI_MATCH(...,"ThinkPad T42") will match "ThinkPad T42p" */
517 struct dmi_system_id hdaps_whitelist[] = { 526 struct dmi_system_id hdaps_whitelist[] = {
527 HDAPS_DMI_MATCH_NORMAL("ThinkPad H"),
518 HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"), 528 HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"),
519 HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"), 529 HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"),
520 HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"), 530 HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"),
@@ -524,15 +534,17 @@ static int __init hdaps_init(void)
524 HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"), 534 HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"),
525 HDAPS_DMI_MATCH_NORMAL("ThinkPad T42"), 535 HDAPS_DMI_MATCH_NORMAL("ThinkPad T42"),
526 HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"), 536 HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"),
537 HDAPS_DMI_MATCH_LENOVO("ThinkPad T60p"),
527 HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"), 538 HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"),
528 HDAPS_DMI_MATCH_NORMAL("ThinkPad X41 Tablet"), 539 HDAPS_DMI_MATCH_NORMAL("ThinkPad X41 Tablet"),
529 HDAPS_DMI_MATCH_NORMAL("ThinkPad X41"), 540 HDAPS_DMI_MATCH_NORMAL("ThinkPad X41"),
541 HDAPS_DMI_MATCH_LENOVO("ThinkPad X60"),
530 { .ident = NULL } 542 { .ident = NULL }
531 }; 543 };
532 544
533 if (!dmi_check_system(hdaps_whitelist)) { 545 if (!dmi_check_system(hdaps_whitelist)) {
534 printk(KERN_WARNING "hdaps: supported laptop not found!\n"); 546 printk(KERN_WARNING "hdaps: supported laptop not found!\n");
535 ret = -ENXIO; 547 ret = -ENODEV;
536 goto out; 548 goto out;
537 } 549 }
538 550
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 6865c64d8a51..958602e28412 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1161,7 +1161,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1161 bank. */ 1161 bank. */
1162 if (kind < 0) { 1162 if (kind < 0) {
1163 if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) { 1163 if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) {
1164 dev_warn(dev, "Detection failed at step 3\n"); 1164 dev_dbg(dev, "Detection failed at step 1\n");
1165 goto ERROR1; 1165 goto ERROR1;
1166 } 1166 }
1167 val1 = w83792d_read_value(client, W83792D_REG_BANK); 1167 val1 = w83792d_read_value(client, W83792D_REG_BANK);
@@ -1170,6 +1170,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1170 if (!(val1 & 0x07)) { /* is Bank0 */ 1170 if (!(val1 & 0x07)) { /* is Bank0 */
1171 if (((!(val1 & 0x80)) && (val2 != 0xa3)) || 1171 if (((!(val1 & 0x80)) && (val2 != 0xa3)) ||
1172 ((val1 & 0x80) && (val2 != 0x5c))) { 1172 ((val1 & 0x80) && (val2 != 0x5c))) {
1173 dev_dbg(dev, "Detection failed at step 2\n");
1173 goto ERROR1; 1174 goto ERROR1;
1174 } 1175 }
1175 } 1176 }
@@ -1177,7 +1178,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1177 should match */ 1178 should match */
1178 if (w83792d_read_value(client, 1179 if (w83792d_read_value(client,
1179 W83792D_REG_I2C_ADDR) != address) { 1180 W83792D_REG_I2C_ADDR) != address) {
1180 dev_warn(dev, "Detection failed at step 5\n"); 1181 dev_dbg(dev, "Detection failed at step 3\n");
1181 goto ERROR1; 1182 goto ERROR1;
1182 } 1183 }
1183 } 1184 }
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 089c6f5b24de..d6d44946a283 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -286,7 +286,10 @@ config I2C_PARPORT
286 This driver is a replacement for (and was inspired by) an older 286 This driver is a replacement for (and was inspired by) an older
287 driver named i2c-philips-par. The new driver supports more devices, 287 driver named i2c-philips-par. The new driver supports more devices,
288 and makes it easier to add support for new devices. 288 and makes it easier to add support for new devices.
289 289
290 An adapter type parameter is now mandatory. Please read the file
291 Documentation/i2c/busses/i2c-parport for details.
292
290 Another driver exists, named i2c-parport-light, which doesn't depend 293 Another driver exists, named i2c-parport-light, which doesn't depend
291 on the parport driver. This is meant for embedded systems. Don't say 294 on the parport driver. This is meant for embedded systems. Don't say
292 Y here if you intend to say Y or M there. 295 Y here if you intend to say Y or M there.
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 8e0f3158215f..dfca74933625 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -478,6 +478,11 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
478 ret = i801_transaction(); 478 ret = i801_transaction();
479 } 479 }
480 480
481 /* Some BIOSes don't like it when PEC is enabled at reboot or resume
482 time, so we forcibly disable it after every transaction. */
483 if (hwpec)
484 outb_p(0, SMBAUXCTL);
485
481 if(block) 486 if(block)
482 return ret; 487 return ret;
483 if(ret) 488 if(ret)
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index c63025a4c861..e09ebbb2f9f0 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -121,9 +121,14 @@ static struct i2c_adapter parport_adapter = {
121 121
122static int __init i2c_parport_init(void) 122static int __init i2c_parport_init(void)
123{ 123{
124 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { 124 if (type < 0) {
125 printk(KERN_WARNING "i2c-parport: adapter type unspecified\n");
126 return -ENODEV;
127 }
128
129 if (type >= ARRAY_SIZE(adapter_parm)) {
125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 130 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
126 type = 0; 131 return -ENODEV;
127 } 132 }
128 133
129 if (base == 0) { 134 if (base == 0) {
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 7e2e8cd1c14a..934bd55bae15 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -241,9 +241,14 @@ static struct parport_driver i2c_parport_driver = {
241 241
242static int __init i2c_parport_init(void) 242static int __init i2c_parport_init(void)
243{ 243{
244 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { 244 if (type < 0) {
245 printk(KERN_WARNING "i2c-parport: adapter type unspecified\n");
246 return -ENODEV;
247 }
248
249 if (type >= ARRAY_SIZE(adapter_parm)) {
245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 250 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
246 type = 0; 251 return -ENODEV;
247 } 252 }
248 253
249 return parport_register_driver(&i2c_parport_driver); 254 return parport_register_driver(&i2c_parport_driver);
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
index d702e5e0388d..9ddd816d5d0f 100644
--- a/drivers/i2c/busses/i2c-parport.h
+++ b/drivers/i2c/busses/i2c-parport.h
@@ -90,7 +90,7 @@ static struct adapter_parm adapter_parm[] = {
90 }, 90 },
91}; 91};
92 92
93static int type; 93static int type = -1;
94module_param(type, int, 0); 94module_param(type, int, 0);
95MODULE_PARM_DESC(type, 95MODULE_PARM_DESC(type,
96 "Type of adapter:\n" 96 "Type of adapter:\n"
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 3024907cdafe..1a73c0532fc7 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -43,13 +43,6 @@
43#include <linux/init.h> 43#include <linux/init.h>
44#include <asm/io.h> 44#include <asm/io.h>
45 45
46/*
47 HISTORY:
48 2003-05-11 1.0.0 Updated from lm_sensors project for kernel 2.5
49 (was i2c-sis645.c from lm_sensors 2.7.0)
50*/
51#define SIS96x_VERSION "1.0.0"
52
53/* base address register in PCI config space */ 46/* base address register in PCI config space */
54#define SIS96x_BAR 0x04 47#define SIS96x_BAR 0x04
55 48
@@ -337,7 +330,6 @@ static struct pci_driver sis96x_driver = {
337 330
338static int __init i2c_sis96x_init(void) 331static int __init i2c_sis96x_init(void)
339{ 332{
340 printk(KERN_INFO "i2c-sis96x version %s\n", SIS96x_VERSION);
341 return pci_register_driver(&sis96x_driver); 333 return pci_register_driver(&sis96x_driver);
342} 334}
343 335
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c
index 03d09ed5ec2c..4630f1969a09 100644
--- a/drivers/i2c/chips/ds1374.c
+++ b/drivers/i2c/chips/ds1374.c
@@ -27,6 +27,7 @@
27#include <linux/rtc.h> 27#include <linux/rtc.h>
28#include <linux/bcd.h> 28#include <linux/bcd.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/workqueue.h>
30 31
31#define DS1374_REG_TOD0 0x00 32#define DS1374_REG_TOD0 0x00
32#define DS1374_REG_TOD1 0x01 33#define DS1374_REG_TOD1 0x01
@@ -139,7 +140,7 @@ ulong ds1374_get_rtc_time(void)
139 return t1; 140 return t1;
140} 141}
141 142
142static void ds1374_set_tlet(ulong arg) 143static void ds1374_set_work(void *arg)
143{ 144{
144 ulong t1, t2; 145 ulong t1, t2;
145 int limit = 10; /* arbitrary retry limit */ 146 int limit = 10; /* arbitrary retry limit */
@@ -168,17 +169,18 @@ static void ds1374_set_tlet(ulong arg)
168 169
169static ulong new_time; 170static ulong new_time;
170 171
171static DECLARE_TASKLET_DISABLED(ds1374_tasklet, ds1374_set_tlet, 172static struct workqueue_struct *ds1374_workqueue;
172 (ulong) & new_time); 173
174static DECLARE_WORK(ds1374_work, ds1374_set_work, &new_time);
173 175
174int ds1374_set_rtc_time(ulong nowtime) 176int ds1374_set_rtc_time(ulong nowtime)
175{ 177{
176 new_time = nowtime; 178 new_time = nowtime;
177 179
178 if (in_interrupt()) 180 if (in_interrupt())
179 tasklet_schedule(&ds1374_tasklet); 181 queue_work(ds1374_workqueue, &ds1374_work);
180 else 182 else
181 ds1374_set_tlet((ulong) & new_time); 183 ds1374_set_work(&new_time);
182 184
183 return 0; 185 return 0;
184} 186}
@@ -204,6 +206,8 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
204 client->adapter = adap; 206 client->adapter = adap;
205 client->driver = &ds1374_driver; 207 client->driver = &ds1374_driver;
206 208
209 ds1374_workqueue = create_singlethread_workqueue("ds1374");
210
207 if ((rc = i2c_attach_client(client)) != 0) { 211 if ((rc = i2c_attach_client(client)) != 0) {
208 kfree(client); 212 kfree(client);
209 return rc; 213 return rc;
@@ -227,7 +231,7 @@ static int ds1374_detach(struct i2c_client *client)
227 231
228 if ((rc = i2c_detach_client(client)) == 0) { 232 if ((rc = i2c_detach_client(client)) == 0) {
229 kfree(i2c_get_clientdata(client)); 233 kfree(i2c_get_clientdata(client));
230 tasklet_kill(&ds1374_tasklet); 234 destroy_workqueue(ds1374_workqueue);
231 } 235 }
232 return rc; 236 return rc;
233} 237}
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
index b5aabe7cf792..99ab4ec34390 100644
--- a/drivers/i2c/chips/m41t00.c
+++ b/drivers/i2c/chips/m41t00.c
@@ -25,6 +25,7 @@
25#include <linux/rtc.h> 25#include <linux/rtc.h>
26#include <linux/bcd.h> 26#include <linux/bcd.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/workqueue.h>
28 29
29#include <asm/time.h> 30#include <asm/time.h>
30#include <asm/rtc.h> 31#include <asm/rtc.h>
@@ -111,7 +112,7 @@ m41t00_get_rtc_time(void)
111} 112}
112 113
113static void 114static void
114m41t00_set_tlet(ulong arg) 115m41t00_set(void *arg)
115{ 116{
116 struct rtc_time tm; 117 struct rtc_time tm;
117 ulong nowtime = *(ulong *)arg; 118 ulong nowtime = *(ulong *)arg;
@@ -130,13 +131,13 @@ m41t00_set_tlet(ulong arg)
130 if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) 131 if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0)
131 || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f) 132 || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
132 < 0) 133 < 0)
133 || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f) 134 || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x3f)
134 < 0) 135 < 0)
135 || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f) 136 || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x3f)
136 < 0) 137 < 0)
137 || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f) 138 || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x1f)
138 < 0) 139 < 0)
139 || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f) 140 || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0xff)
140 < 0)) 141 < 0))
141 142
142 dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); 143 dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");
@@ -145,9 +146,9 @@ m41t00_set_tlet(ulong arg)
145 return; 146 return;
146} 147}
147 148
148static ulong new_time; 149static ulong new_time;
149 150static struct workqueue_struct *m41t00_wq;
150DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time); 151static DECLARE_WORK(m41t00_work, m41t00_set, &new_time);
151 152
152int 153int
153m41t00_set_rtc_time(ulong nowtime) 154m41t00_set_rtc_time(ulong nowtime)
@@ -155,9 +156,9 @@ m41t00_set_rtc_time(ulong nowtime)
155 new_time = nowtime; 156 new_time = nowtime;
156 157
157 if (in_interrupt()) 158 if (in_interrupt())
158 tasklet_schedule(&m41t00_tasklet); 159 queue_work(m41t00_wq, &m41t00_work);
159 else 160 else
160 m41t00_set_tlet((ulong)&new_time); 161 m41t00_set(&new_time);
161 162
162 return 0; 163 return 0;
163} 164}
@@ -189,6 +190,7 @@ m41t00_probe(struct i2c_adapter *adap, int addr, int kind)
189 return rc; 190 return rc;
190 } 191 }
191 192
193 m41t00_wq = create_singlethread_workqueue("m41t00");
192 save_client = client; 194 save_client = client;
193 return 0; 195 return 0;
194} 196}
@@ -206,7 +208,7 @@ m41t00_detach(struct i2c_client *client)
206 208
207 if ((rc = i2c_detach_client(client)) == 0) { 209 if ((rc = i2c_detach_client(client)) == 0) {
208 kfree(client); 210 kfree(client);
209 tasklet_kill(&m41t00_tasklet); 211 destroy_workqueue(m41t00_wq);
210 } 212 }
211 return rc; 213 return rc;
212} 214}
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index cf84350efc55..8b24b4f2a839 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -731,6 +731,8 @@ static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif)
731 731
732 if(m5229_revision <= 0x20) 732 if(m5229_revision <= 0x20)
733 tmpbyte = (tmpbyte & (~0x02)) | 0x01; 733 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
734 else if (m5229_revision == 0xc7)
735 tmpbyte |= 0x03;
734 else 736 else
735 tmpbyte |= 0x01; 737 tmpbyte |= 0x01;
736 738
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index df9ee9a78435..900efd1da587 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -348,6 +348,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
348 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 348 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
349 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 349 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
350 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 350 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
351 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
351 { 0, }, 352 { 0, },
352}; 353};
353MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); 354MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 6f8f8645b02c..7ce5bf783688 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -798,7 +798,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
798 .autodma = AUTODMA, 798 .autodma = AUTODMA,
799 .bootable = OFF_BOARD, 799 .bootable = OFF_BOARD,
800 .extra = 48, 800 .extra = 48,
801 .flags = IDEPCI_FLAG_FORCE_PDC,
802 },{ /* 2 */ 801 },{ /* 2 */
803 .name = "PDC20263", 802 .name = "PDC20263",
804 .init_setup = init_setup_pdc202ata4, 803 .init_setup = init_setup_pdc202ata4,
@@ -819,7 +818,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
819 .autodma = AUTODMA, 818 .autodma = AUTODMA,
820 .bootable = OFF_BOARD, 819 .bootable = OFF_BOARD,
821 .extra = 48, 820 .extra = 48,
822 .flags = IDEPCI_FLAG_FORCE_PDC,
823 },{ /* 4 */ 821 },{ /* 4 */
824 .name = "PDC20267", 822 .name = "PDC20267",
825 .init_setup = init_setup_pdc202xx, 823 .init_setup = init_setup_pdc202xx,
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 7ebf992e8c2f..462ed3006c30 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -580,7 +580,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
580 int port; 580 int port;
581 int at_least_one_hwif_enabled = 0; 581 int at_least_one_hwif_enabled = 0;
582 ide_hwif_t *hwif, *mate = NULL; 582 ide_hwif_t *hwif, *mate = NULL;
583 static int secondpdc = 0;
584 u8 tmp; 583 u8 tmp;
585 584
586 index->all = 0xf0f0; 585 index->all = 0xf0f0;
@@ -592,21 +591,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
592 for (port = 0; port <= 1; ++port) { 591 for (port = 0; port <= 1; ++port) {
593 ide_pci_enablebit_t *e = &(d->enablebits[port]); 592 ide_pci_enablebit_t *e = &(d->enablebits[port]);
594 593
595 /*
596 * If this is a Promise FakeRaid controller,
597 * the 2nd controller will be marked as
598 * disabled while it is actually there and enabled
599 * by the bios for raid purposes.
600 * Skip the normal "is it enabled" test for those.
601 */
602 if ((d->flags & IDEPCI_FLAG_FORCE_PDC) &&
603 (secondpdc++==1) && (port==1))
604 goto controller_ok;
605
606 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 594 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
607 (tmp & e->mask) != e->val)) 595 (tmp & e->mask) != e->val))
608 continue; /* port not enabled */ 596 continue; /* port not enabled */
609controller_ok:
610 597
611 if (d->channels <= port) 598 if (d->channels <= port)
612 break; 599 break;
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index c57a3871184c..50364c0b090c 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -302,7 +302,7 @@ static void ib_cache_setup_one(struct ib_device *device)
302 kmalloc(sizeof *device->cache.pkey_cache * 302 kmalloc(sizeof *device->cache.pkey_cache *
303 (end_port(device) - start_port(device) + 1), GFP_KERNEL); 303 (end_port(device) - start_port(device) + 1), GFP_KERNEL);
304 device->cache.gid_cache = 304 device->cache.gid_cache =
305 kmalloc(sizeof *device->cache.pkey_cache * 305 kmalloc(sizeof *device->cache.gid_cache *
306 (end_port(device) - start_port(device) + 1), GFP_KERNEL); 306 (end_port(device) - start_port(device) + 1), GFP_KERNEL);
307 307
308 if (!device->cache.pkey_cache || !device->cache.gid_cache) { 308 if (!device->cache.pkey_cache || !device->cache.gid_cache) {
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index ba54c856b0e5..469b6923a2e2 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -228,10 +228,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
228 goto error1; 228 goto error1;
229 } 229 }
230 /* Make sure class supplied is consistent with RMPP */ 230 /* Make sure class supplied is consistent with RMPP */
231 if (ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) { 231 if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) {
232 if (!rmpp_version)
233 goto error1;
234 } else {
235 if (rmpp_version) 232 if (rmpp_version)
236 goto error1; 233 goto error1;
237 } 234 }
@@ -2311,6 +2308,7 @@ static void local_completions(void *data)
2311 local = list_entry(mad_agent_priv->local_list.next, 2308 local = list_entry(mad_agent_priv->local_list.next,
2312 struct ib_mad_local_private, 2309 struct ib_mad_local_private,
2313 completion_list); 2310 completion_list);
2311 list_del(&local->completion_list);
2314 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2312 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
2315 if (local->mad_priv) { 2313 if (local->mad_priv) {
2316 recv_mad_agent = local->recv_mad_agent; 2314 recv_mad_agent = local->recv_mad_agent;
@@ -2362,7 +2360,6 @@ local_send_completion:
2362 &mad_send_wc); 2360 &mad_send_wc);
2363 2361
2364 spin_lock_irqsave(&mad_agent_priv->lock, flags); 2362 spin_lock_irqsave(&mad_agent_priv->lock, flags);
2365 list_del(&local->completion_list);
2366 atomic_dec(&mad_agent_priv->refcount); 2363 atomic_dec(&mad_agent_priv->refcount);
2367 if (!recv) 2364 if (!recv)
2368 kmem_cache_free(ib_mad_cache, local->mad_priv); 2365 kmem_cache_free(ib_mad_cache, local->mad_priv);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index cae0845f472a..b78e7dc69330 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -45,6 +45,40 @@
45#include <rdma/ib_verbs.h> 45#include <rdma/ib_verbs.h>
46#include <rdma/ib_cache.h> 46#include <rdma/ib_cache.h>
47 47
48int ib_rate_to_mult(enum ib_rate rate)
49{
50 switch (rate) {
51 case IB_RATE_2_5_GBPS: return 1;
52 case IB_RATE_5_GBPS: return 2;
53 case IB_RATE_10_GBPS: return 4;
54 case IB_RATE_20_GBPS: return 8;
55 case IB_RATE_30_GBPS: return 12;
56 case IB_RATE_40_GBPS: return 16;
57 case IB_RATE_60_GBPS: return 24;
58 case IB_RATE_80_GBPS: return 32;
59 case IB_RATE_120_GBPS: return 48;
60 default: return -1;
61 }
62}
63EXPORT_SYMBOL(ib_rate_to_mult);
64
65enum ib_rate mult_to_ib_rate(int mult)
66{
67 switch (mult) {
68 case 1: return IB_RATE_2_5_GBPS;
69 case 2: return IB_RATE_5_GBPS;
70 case 4: return IB_RATE_10_GBPS;
71 case 8: return IB_RATE_20_GBPS;
72 case 12: return IB_RATE_30_GBPS;
73 case 16: return IB_RATE_40_GBPS;
74 case 24: return IB_RATE_60_GBPS;
75 case 32: return IB_RATE_80_GBPS;
76 case 48: return IB_RATE_120_GBPS;
77 default: return IB_RATE_PORT_CURRENT;
78 }
79}
80EXPORT_SYMBOL(mult_to_ib_rate);
81
48/* Protection domains */ 82/* Protection domains */
49 83
50struct ib_pd *ib_alloc_pd(struct ib_device *device) 84struct ib_pd *ib_alloc_pd(struct ib_device *device)
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index cd533cf951c2..7d3fb6996b41 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -365,15 +365,3 @@ static ssize_t ipath_diag_write(struct file *fp, const char __user *data,
365bail: 365bail:
366 return ret; 366 return ret;
367} 367}
368
369void ipath_diag_bringup_link(struct ipath_devdata *dd)
370{
371 if (diag_set_link || (dd->ipath_flags & IPATH_LINKACTIVE))
372 return;
373
374 diag_set_link = 1;
375 ipath_cdbg(VERBOSE, "Trying to set to set link active for "
376 "diag pkt\n");
377 ipath_layer_set_linkstate(dd, IPATH_IB_LINKARM);
378 ipath_layer_set_linkstate(dd, IPATH_IB_LINKACTIVE);
379}
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 58a94efb0070..e7617c3982ea 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1729,7 +1729,7 @@ void ipath_free_pddata(struct ipath_devdata *dd, u32 port, int freehdrq)
1729 } 1729 }
1730} 1730}
1731 1731
1732int __init infinipath_init(void) 1732static int __init infinipath_init(void)
1733{ 1733{
1734 int ret; 1734 int ret;
1735 1735
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 60f5f4108069..0bcb428041f3 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -172,8 +172,8 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
172 "was %s\n", dd->ipath_unit, 172 "was %s\n", dd->ipath_unit,
173 ib_linkstate(lstate), 173 ib_linkstate(lstate),
174 ib_linkstate((unsigned) 174 ib_linkstate((unsigned)
175 dd->ipath_lastibcstat 175 dd->ipath_lastibcstat
176 & IPATH_IBSTATE_MASK)); 176 & IPATH_IBSTATE_MASK));
177 } 177 }
178 else { 178 else {
179 lstate = dd->ipath_lastibcstat & IPATH_IBSTATE_MASK; 179 lstate = dd->ipath_lastibcstat & IPATH_IBSTATE_MASK;
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 159d0aed31a5..0ce5f19c9d62 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -528,7 +528,6 @@ extern spinlock_t ipath_devs_lock;
528extern struct ipath_devdata *ipath_lookup(int unit); 528extern struct ipath_devdata *ipath_lookup(int unit);
529 529
530extern u16 ipath_layer_rcv_opcode; 530extern u16 ipath_layer_rcv_opcode;
531extern int ipath_verbs_registered;
532extern int __ipath_layer_intr(struct ipath_devdata *, u32); 531extern int __ipath_layer_intr(struct ipath_devdata *, u32);
533extern int ipath_layer_intr(struct ipath_devdata *, u32); 532extern int ipath_layer_intr(struct ipath_devdata *, u32);
534extern int __ipath_layer_rcv(struct ipath_devdata *, void *, 533extern int __ipath_layer_rcv(struct ipath_devdata *, void *,
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c
index 2cabf6340572..69ed1100701a 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.c
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c
@@ -52,7 +52,7 @@ static int (*layer_rcv)(void *, void *, struct sk_buff *);
52static int (*layer_rcv_lid)(void *, void *); 52static int (*layer_rcv_lid)(void *, void *);
53static int (*verbs_piobufavail)(void *); 53static int (*verbs_piobufavail)(void *);
54static void (*verbs_rcv)(void *, void *, void *, u32); 54static void (*verbs_rcv)(void *, void *, void *, u32);
55int ipath_verbs_registered; 55static int ipath_verbs_registered;
56 56
57static void *(*layer_add_one)(int, struct ipath_devdata *); 57static void *(*layer_add_one)(int, struct ipath_devdata *);
58static void (*layer_remove_one)(void *); 58static void (*layer_remove_one)(void *);
diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c
index e693a7a82667..e1dc4f757062 100644
--- a/drivers/infiniband/hw/ipath/ipath_pe800.c
+++ b/drivers/infiniband/hw/ipath/ipath_pe800.c
@@ -305,8 +305,8 @@ static const struct ipath_cregs ipath_pe_cregs = {
305 * we'll print them and continue. We reuse the same message buffer as 305 * we'll print them and continue. We reuse the same message buffer as
306 * ipath_handle_errors() to avoid excessive stack usage. 306 * ipath_handle_errors() to avoid excessive stack usage.
307 */ 307 */
308void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg, 308static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg,
309 size_t msgl) 309 size_t msgl)
310{ 310{
311 ipath_err_t hwerrs; 311 ipath_err_t hwerrs;
312 u32 bits, ctrl; 312 u32 bits, ctrl;
@@ -552,7 +552,7 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
552 * freeze mode), and enable hardware errors as errors (along with 552 * freeze mode), and enable hardware errors as errors (along with
553 * everything else) in errormask 553 * everything else) in errormask
554 */ 554 */
555void ipath_pe_init_hwerrors(struct ipath_devdata *dd) 555static void ipath_pe_init_hwerrors(struct ipath_devdata *dd)
556{ 556{
557 ipath_err_t val; 557 ipath_err_t val;
558 u64 extsval; 558 u64 extsval;
@@ -577,7 +577,7 @@ void ipath_pe_init_hwerrors(struct ipath_devdata *dd)
577 * ipath_pe_bringup_serdes - bring up the serdes 577 * ipath_pe_bringup_serdes - bring up the serdes
578 * @dd: the infinipath device 578 * @dd: the infinipath device
579 */ 579 */
580int ipath_pe_bringup_serdes(struct ipath_devdata *dd) 580static int ipath_pe_bringup_serdes(struct ipath_devdata *dd)
581{ 581{
582 u64 val, tmp, config1; 582 u64 val, tmp, config1;
583 int ret = 0, change = 0; 583 int ret = 0, change = 0;
@@ -694,7 +694,7 @@ int ipath_pe_bringup_serdes(struct ipath_devdata *dd)
694 * @dd: the infinipath device 694 * @dd: the infinipath device
695 * Called when driver is being unloaded 695 * Called when driver is being unloaded
696 */ 696 */
697void ipath_pe_quiet_serdes(struct ipath_devdata *dd) 697static void ipath_pe_quiet_serdes(struct ipath_devdata *dd)
698{ 698{
699 u64 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0); 699 u64 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0);
700 700
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 6058d70d7577..18890716db1e 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -188,8 +188,8 @@ static void free_qpn(struct ipath_qp_table *qpt, u32 qpn)
188 * Allocate the next available QPN and put the QP into the hash table. 188 * Allocate the next available QPN and put the QP into the hash table.
189 * The hash table holds a reference to the QP. 189 * The hash table holds a reference to the QP.
190 */ 190 */
191int ipath_alloc_qpn(struct ipath_qp_table *qpt, struct ipath_qp *qp, 191static int ipath_alloc_qpn(struct ipath_qp_table *qpt, struct ipath_qp *qp,
192 enum ib_qp_type type) 192 enum ib_qp_type type)
193{ 193{
194 unsigned long flags; 194 unsigned long flags;
195 u32 qpn; 195 u32 qpn;
@@ -232,7 +232,7 @@ bail:
232 * Remove the QP from the table so it can't be found asynchronously by 232 * Remove the QP from the table so it can't be found asynchronously by
233 * the receive interrupt routine. 233 * the receive interrupt routine.
234 */ 234 */
235void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp) 235static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
236{ 236{
237 struct ipath_qp *q, **qpp; 237 struct ipath_qp *q, **qpp;
238 unsigned long flags; 238 unsigned long flags;
@@ -358,6 +358,65 @@ static void ipath_reset_qp(struct ipath_qp *qp)
358} 358}
359 359
360/** 360/**
361 * ipath_error_qp - put a QP into an error state
362 * @qp: the QP to put into an error state
363 *
364 * Flushes both send and receive work queues.
365 * QP r_rq.lock and s_lock should be held.
366 */
367
368static void ipath_error_qp(struct ipath_qp *qp)
369{
370 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
371 struct ib_wc wc;
372
373 _VERBS_INFO("QP%d/%d in error state\n",
374 qp->ibqp.qp_num, qp->remote_qpn);
375
376 spin_lock(&dev->pending_lock);
377 /* XXX What if its already removed by the timeout code? */
378 if (qp->timerwait.next != LIST_POISON1)
379 list_del(&qp->timerwait);
380 if (qp->piowait.next != LIST_POISON1)
381 list_del(&qp->piowait);
382 spin_unlock(&dev->pending_lock);
383
384 wc.status = IB_WC_WR_FLUSH_ERR;
385 wc.vendor_err = 0;
386 wc.byte_len = 0;
387 wc.imm_data = 0;
388 wc.qp_num = qp->ibqp.qp_num;
389 wc.src_qp = 0;
390 wc.wc_flags = 0;
391 wc.pkey_index = 0;
392 wc.slid = 0;
393 wc.sl = 0;
394 wc.dlid_path_bits = 0;
395 wc.port_num = 0;
396
397 while (qp->s_last != qp->s_head) {
398 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
399
400 wc.wr_id = wqe->wr.wr_id;
401 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
402 if (++qp->s_last >= qp->s_size)
403 qp->s_last = 0;
404 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
405 }
406 qp->s_cur = qp->s_tail = qp->s_head;
407 qp->s_hdrwords = 0;
408 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
409
410 wc.opcode = IB_WC_RECV;
411 while (qp->r_rq.tail != qp->r_rq.head) {
412 wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id;
413 if (++qp->r_rq.tail >= qp->r_rq.size)
414 qp->r_rq.tail = 0;
415 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
416 }
417}
418
419/**
361 * ipath_modify_qp - modify the attributes of a queue pair 420 * ipath_modify_qp - modify the attributes of a queue pair
362 * @ibqp: the queue pair who's attributes we're modifying 421 * @ibqp: the queue pair who's attributes we're modifying
363 * @attr: the new attributes 422 * @attr: the new attributes
@@ -821,65 +880,6 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
821} 880}
822 881
823/** 882/**
824 * ipath_error_qp - put a QP into an error state
825 * @qp: the QP to put into an error state
826 *
827 * Flushes both send and receive work queues.
828 * QP r_rq.lock and s_lock should be held.
829 */
830
831void ipath_error_qp(struct ipath_qp *qp)
832{
833 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
834 struct ib_wc wc;
835
836 _VERBS_INFO("QP%d/%d in error state\n",
837 qp->ibqp.qp_num, qp->remote_qpn);
838
839 spin_lock(&dev->pending_lock);
840 /* XXX What if its already removed by the timeout code? */
841 if (qp->timerwait.next != LIST_POISON1)
842 list_del(&qp->timerwait);
843 if (qp->piowait.next != LIST_POISON1)
844 list_del(&qp->piowait);
845 spin_unlock(&dev->pending_lock);
846
847 wc.status = IB_WC_WR_FLUSH_ERR;
848 wc.vendor_err = 0;
849 wc.byte_len = 0;
850 wc.imm_data = 0;
851 wc.qp_num = qp->ibqp.qp_num;
852 wc.src_qp = 0;
853 wc.wc_flags = 0;
854 wc.pkey_index = 0;
855 wc.slid = 0;
856 wc.sl = 0;
857 wc.dlid_path_bits = 0;
858 wc.port_num = 0;
859
860 while (qp->s_last != qp->s_head) {
861 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
862
863 wc.wr_id = wqe->wr.wr_id;
864 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
865 if (++qp->s_last >= qp->s_size)
866 qp->s_last = 0;
867 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
868 }
869 qp->s_cur = qp->s_tail = qp->s_head;
870 qp->s_hdrwords = 0;
871 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
872
873 wc.opcode = IB_WC_RECV;
874 while (qp->r_rq.tail != qp->r_rq.head) {
875 wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id;
876 if (++qp->r_rq.tail >= qp->r_rq.size)
877 qp->r_rq.tail = 0;
878 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
879 }
880}
881
882/**
883 * ipath_get_credit - flush the send work queue of a QP 883 * ipath_get_credit - flush the send work queue of a QP
884 * @qp: the qp who's send work queue to flush 884 * @qp: the qp who's send work queue to flush
885 * @aeth: the Acknowledge Extended Transport Header 885 * @aeth: the Acknowledge Extended Transport Header
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 5ff3de6128b2..01cfb30ee160 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -46,8 +46,8 @@
46 * This is called from ipath_post_ud_send() to forward a WQE addressed 46 * This is called from ipath_post_ud_send() to forward a WQE addressed
47 * to the same HCA. 47 * to the same HCA.
48 */ 48 */
49void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss, 49static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss,
50 u32 length, struct ib_send_wr *wr, struct ib_wc *wc) 50 u32 length, struct ib_send_wr *wr, struct ib_wc *wc)
51{ 51{
52 struct ipath_ibdev *dev = to_idev(sqp->ibqp.device); 52 struct ipath_ibdev *dev = to_idev(sqp->ibqp.device);
53 struct ipath_qp *qp; 53 struct ipath_qp *qp;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 9f27fd35cdbb..8d2558a01f35 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -41,7 +41,7 @@
41/* Not static, because we don't want the compiler removing it */ 41/* Not static, because we don't want the compiler removing it */
42const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR; 42const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR;
43 43
44unsigned int ib_ipath_qp_table_size = 251; 44static unsigned int ib_ipath_qp_table_size = 251;
45module_param_named(qp_table_size, ib_ipath_qp_table_size, uint, S_IRUGO); 45module_param_named(qp_table_size, ib_ipath_qp_table_size, uint, S_IRUGO);
46MODULE_PARM_DESC(qp_table_size, "QP table size"); 46MODULE_PARM_DESC(qp_table_size, "QP table size");
47 47
@@ -87,7 +87,7 @@ const enum ib_wc_opcode ib_ipath_wc_opcode[] = {
87/* 87/*
88 * System image GUID. 88 * System image GUID.
89 */ 89 */
90__be64 sys_image_guid; 90static __be64 sys_image_guid;
91 91
92/** 92/**
93 * ipath_copy_sge - copy data to SGE memory 93 * ipath_copy_sge - copy data to SGE memory
@@ -1110,7 +1110,7 @@ static void ipath_unregister_ib_device(void *arg)
1110 ib_dealloc_device(ibdev); 1110 ib_dealloc_device(ibdev);
1111} 1111}
1112 1112
1113int __init ipath_verbs_init(void) 1113static int __init ipath_verbs_init(void)
1114{ 1114{
1115 return ipath_verbs_register(ipath_register_ib_device, 1115 return ipath_verbs_register(ipath_register_ib_device,
1116 ipath_unregister_ib_device, 1116 ipath_unregister_ib_device,
@@ -1118,33 +1118,33 @@ int __init ipath_verbs_init(void)
1118 ipath_ib_timer); 1118 ipath_ib_timer);
1119} 1119}
1120 1120
1121void __exit ipath_verbs_cleanup(void) 1121static void __exit ipath_verbs_cleanup(void)
1122{ 1122{
1123 ipath_verbs_unregister(); 1123 ipath_verbs_unregister();
1124} 1124}
1125 1125
1126static ssize_t show_rev(struct class_device *cdev, char *buf) 1126static ssize_t show_rev(struct class_device *cdev, char *buf)
1127{ 1127{
1128 struct ipath_ibdev *dev = 1128 struct ipath_ibdev *dev =
1129 container_of(cdev, struct ipath_ibdev, ibdev.class_dev); 1129 container_of(cdev, struct ipath_ibdev, ibdev.class_dev);
1130 int vendor, boardrev, majrev, minrev; 1130 int vendor, boardrev, majrev, minrev;
1131 1131
1132 ipath_layer_query_device(dev->dd, &vendor, &boardrev, 1132 ipath_layer_query_device(dev->dd, &vendor, &boardrev,
1133 &majrev, &minrev); 1133 &majrev, &minrev);
1134 return sprintf(buf, "%d.%d\n", majrev, minrev); 1134 return sprintf(buf, "%d.%d\n", majrev, minrev);
1135} 1135}
1136 1136
1137static ssize_t show_hca(struct class_device *cdev, char *buf) 1137static ssize_t show_hca(struct class_device *cdev, char *buf)
1138{ 1138{
1139 struct ipath_ibdev *dev = 1139 struct ipath_ibdev *dev =
1140 container_of(cdev, struct ipath_ibdev, ibdev.class_dev); 1140 container_of(cdev, struct ipath_ibdev, ibdev.class_dev);
1141 int ret; 1141 int ret;
1142 1142
1143 ret = ipath_layer_get_boardname(dev->dd, buf, 128); 1143 ret = ipath_layer_get_boardname(dev->dd, buf, 128);
1144 if (ret < 0) 1144 if (ret < 0)
1145 goto bail; 1145 goto bail;
1146 strcat(buf, "\n"); 1146 strcat(buf, "\n");
1147 ret = strlen(buf); 1147 ret = strlen(buf);
1148 1148
1149bail: 1149bail:
1150 return ret; 1150 return ret;
@@ -1152,40 +1152,40 @@ bail:
1152 1152
1153static ssize_t show_stats(struct class_device *cdev, char *buf) 1153static ssize_t show_stats(struct class_device *cdev, char *buf)
1154{ 1154{
1155 struct ipath_ibdev *dev = 1155 struct ipath_ibdev *dev =
1156 container_of(cdev, struct ipath_ibdev, ibdev.class_dev); 1156 container_of(cdev, struct ipath_ibdev, ibdev.class_dev);
1157 int i; 1157 int i;
1158 int len; 1158 int len;
1159 1159
1160 len = sprintf(buf, 1160 len = sprintf(buf,
1161 "RC resends %d\n" 1161 "RC resends %d\n"
1162 "RC QACKs %d\n" 1162 "RC QACKs %d\n"
1163 "RC ACKs %d\n" 1163 "RC ACKs %d\n"
1164 "RC SEQ NAKs %d\n" 1164 "RC SEQ NAKs %d\n"
1165 "RC RDMA seq %d\n" 1165 "RC RDMA seq %d\n"
1166 "RC RNR NAKs %d\n" 1166 "RC RNR NAKs %d\n"
1167 "RC OTH NAKs %d\n" 1167 "RC OTH NAKs %d\n"
1168 "RC timeouts %d\n" 1168 "RC timeouts %d\n"
1169 "RC RDMA dup %d\n" 1169 "RC RDMA dup %d\n"
1170 "piobuf wait %d\n" 1170 "piobuf wait %d\n"
1171 "no piobuf %d\n" 1171 "no piobuf %d\n"
1172 "PKT drops %d\n" 1172 "PKT drops %d\n"
1173 "WQE errs %d\n", 1173 "WQE errs %d\n",
1174 dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks, 1174 dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks,
1175 dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks, 1175 dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks,
1176 dev->n_other_naks, dev->n_timeouts, 1176 dev->n_other_naks, dev->n_timeouts,
1177 dev->n_rdma_dup_busy, dev->n_piowait, 1177 dev->n_rdma_dup_busy, dev->n_piowait,
1178 dev->n_no_piobuf, dev->n_pkt_drops, dev->n_wqe_errs); 1178 dev->n_no_piobuf, dev->n_pkt_drops, dev->n_wqe_errs);
1179 for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) { 1179 for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) {
1180 const struct ipath_opcode_stats *si = &dev->opstats[i]; 1180 const struct ipath_opcode_stats *si = &dev->opstats[i];
1181 1181
1182 if (!si->n_packets && !si->n_bytes) 1182 if (!si->n_packets && !si->n_bytes)
1183 continue; 1183 continue;
1184 len += sprintf(buf + len, "%02x %llu/%llu\n", i, 1184 len += sprintf(buf + len, "%02x %llu/%llu\n", i,
1185 (unsigned long long) si->n_packets, 1185 (unsigned long long) si->n_packets,
1186 (unsigned long long) si->n_bytes); 1186 (unsigned long long) si->n_bytes);
1187 } 1187 }
1188 return len; 1188 return len;
1189} 1189}
1190 1190
1191static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); 1191static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
@@ -1194,25 +1194,25 @@ static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL);
1194static CLASS_DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); 1194static CLASS_DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL);
1195 1195
1196static struct class_device_attribute *ipath_class_attributes[] = { 1196static struct class_device_attribute *ipath_class_attributes[] = {
1197 &class_device_attr_hw_rev, 1197 &class_device_attr_hw_rev,
1198 &class_device_attr_hca_type, 1198 &class_device_attr_hca_type,
1199 &class_device_attr_board_id, 1199 &class_device_attr_board_id,
1200 &class_device_attr_stats 1200 &class_device_attr_stats
1201}; 1201};
1202 1202
1203static int ipath_verbs_register_sysfs(struct ib_device *dev) 1203static int ipath_verbs_register_sysfs(struct ib_device *dev)
1204{ 1204{
1205 int i; 1205 int i;
1206 int ret; 1206 int ret;
1207 1207
1208 for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) 1208 for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i)
1209 if (class_device_create_file(&dev->class_dev, 1209 if (class_device_create_file(&dev->class_dev,
1210 ipath_class_attributes[i])) { 1210 ipath_class_attributes[i])) {
1211 ret = 1; 1211 ret = 1;
1212 goto bail; 1212 goto bail;
1213 } 1213 }
1214 1214
1215 ret = 0; 1215 ret = 0;
1216 1216
1217bail: 1217bail:
1218 return ret; 1218 return ret;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index b824632b2a8c..fcafbc7c9e71 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -577,8 +577,6 @@ int ipath_init_qp_table(struct ipath_ibdev *idev, int size);
577 577
578void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc); 578void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);
579 579
580void ipath_error_qp(struct ipath_qp *qp);
581
582void ipath_get_credit(struct ipath_qp *qp, u32 aeth); 580void ipath_get_credit(struct ipath_qp *qp, u32 aeth);
583 581
584void ipath_do_rc_send(unsigned long data); 582void ipath_do_rc_send(unsigned long data);
@@ -607,9 +605,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
607 605
608void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc); 606void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc);
609 607
610void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss,
611 u32 length, struct ib_send_wr *wr, struct ib_wc *wc);
612
613int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr); 608int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr);
614 609
615void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, 610void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
diff --git a/drivers/infiniband/hw/mthca/Kconfig b/drivers/infiniband/hw/mthca/Kconfig
index e88be85b3d5c..9aa5a4468a75 100644
--- a/drivers/infiniband/hw/mthca/Kconfig
+++ b/drivers/infiniband/hw/mthca/Kconfig
@@ -7,10 +7,11 @@ config INFINIBAND_MTHCA
7 ("Tavor") and the MT25208 PCI Express HCA ("Arbel"). 7 ("Tavor") and the MT25208 PCI Express HCA ("Arbel").
8 8
9config INFINIBAND_MTHCA_DEBUG 9config INFINIBAND_MTHCA_DEBUG
10 bool "Verbose debugging output" 10 bool "Verbose debugging output" if EMBEDDED
11 depends on INFINIBAND_MTHCA 11 depends on INFINIBAND_MTHCA
12 default n 12 default y
13 ---help--- 13 ---help---
14 This option causes the mthca driver produce a bunch of debug 14 This option causes debugging code to be compiled into the
15 messages. Select this is you are developing the driver or 15 mthca driver. The output can be turned on via the
16 trying to diagnose a problem. 16 debug_level module parameter (which can also be set after
17 the driver is loaded through sysfs).
diff --git a/drivers/infiniband/hw/mthca/Makefile b/drivers/infiniband/hw/mthca/Makefile
index 47ec5a7cba0b..e388d95d0cf1 100644
--- a/drivers/infiniband/hw/mthca/Makefile
+++ b/drivers/infiniband/hw/mthca/Makefile
@@ -1,7 +1,3 @@
1ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
2EXTRA_CFLAGS += -DDEBUG
3endif
4
5obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o 1obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o
6 2
7ib_mthca-y := mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \ 3ib_mthca-y := mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c
index bc5bdcbe51b5..b12aa03be251 100644
--- a/drivers/infiniband/hw/mthca/mthca_av.c
+++ b/drivers/infiniband/hw/mthca/mthca_av.c
@@ -42,6 +42,20 @@
42 42
43#include "mthca_dev.h" 43#include "mthca_dev.h"
44 44
45enum {
46 MTHCA_RATE_TAVOR_FULL = 0,
47 MTHCA_RATE_TAVOR_1X = 1,
48 MTHCA_RATE_TAVOR_4X = 2,
49 MTHCA_RATE_TAVOR_1X_DDR = 3
50};
51
52enum {
53 MTHCA_RATE_MEMFREE_FULL = 0,
54 MTHCA_RATE_MEMFREE_QUARTER = 1,
55 MTHCA_RATE_MEMFREE_EIGHTH = 2,
56 MTHCA_RATE_MEMFREE_HALF = 3
57};
58
45struct mthca_av { 59struct mthca_av {
46 __be32 port_pd; 60 __be32 port_pd;
47 u8 reserved1; 61 u8 reserved1;
@@ -55,6 +69,90 @@ struct mthca_av {
55 __be32 dgid[4]; 69 __be32 dgid[4];
56}; 70};
57 71
72static enum ib_rate memfree_rate_to_ib(u8 mthca_rate, u8 port_rate)
73{
74 switch (mthca_rate) {
75 case MTHCA_RATE_MEMFREE_EIGHTH:
76 return mult_to_ib_rate(port_rate >> 3);
77 case MTHCA_RATE_MEMFREE_QUARTER:
78 return mult_to_ib_rate(port_rate >> 2);
79 case MTHCA_RATE_MEMFREE_HALF:
80 return mult_to_ib_rate(port_rate >> 1);
81 case MTHCA_RATE_MEMFREE_FULL:
82 default:
83 return mult_to_ib_rate(port_rate);
84 }
85}
86
87static enum ib_rate tavor_rate_to_ib(u8 mthca_rate, u8 port_rate)
88{
89 switch (mthca_rate) {
90 case MTHCA_RATE_TAVOR_1X: return IB_RATE_2_5_GBPS;
91 case MTHCA_RATE_TAVOR_1X_DDR: return IB_RATE_5_GBPS;
92 case MTHCA_RATE_TAVOR_4X: return IB_RATE_10_GBPS;
93 default: return port_rate;
94 }
95}
96
97enum ib_rate mthca_rate_to_ib(struct mthca_dev *dev, u8 mthca_rate, u8 port)
98{
99 if (mthca_is_memfree(dev)) {
100 /* Handle old Arbel FW */
101 if (dev->limits.stat_rate_support == 0x3 && mthca_rate)
102 return IB_RATE_2_5_GBPS;
103
104 return memfree_rate_to_ib(mthca_rate, dev->rate[port - 1]);
105 } else
106 return tavor_rate_to_ib(mthca_rate, dev->rate[port - 1]);
107}
108
109static u8 ib_rate_to_memfree(u8 req_rate, u8 cur_rate)
110{
111 if (cur_rate <= req_rate)
112 return 0;
113
114 /*
115 * Inter-packet delay (IPD) to get from rate X down to a rate
116 * no more than Y is (X - 1) / Y.
117 */
118 switch ((cur_rate - 1) / req_rate) {
119 case 0: return MTHCA_RATE_MEMFREE_FULL;
120 case 1: return MTHCA_RATE_MEMFREE_HALF;
121 case 2: /* fall through */
122 case 3: return MTHCA_RATE_MEMFREE_QUARTER;
123 default: return MTHCA_RATE_MEMFREE_EIGHTH;
124 }
125}
126
127static u8 ib_rate_to_tavor(u8 static_rate)
128{
129 switch (static_rate) {
130 case IB_RATE_2_5_GBPS: return MTHCA_RATE_TAVOR_1X;
131 case IB_RATE_5_GBPS: return MTHCA_RATE_TAVOR_1X_DDR;
132 case IB_RATE_10_GBPS: return MTHCA_RATE_TAVOR_4X;
133 default: return MTHCA_RATE_TAVOR_FULL;
134 }
135}
136
137u8 mthca_get_rate(struct mthca_dev *dev, int static_rate, u8 port)
138{
139 u8 rate;
140
141 if (!static_rate || ib_rate_to_mult(static_rate) >= dev->rate[port - 1])
142 return 0;
143
144 if (mthca_is_memfree(dev))
145 rate = ib_rate_to_memfree(ib_rate_to_mult(static_rate),
146 dev->rate[port - 1]);
147 else
148 rate = ib_rate_to_tavor(static_rate);
149
150 if (!(dev->limits.stat_rate_support & (1 << rate)))
151 rate = 1;
152
153 return rate;
154}
155
58int mthca_create_ah(struct mthca_dev *dev, 156int mthca_create_ah(struct mthca_dev *dev,
59 struct mthca_pd *pd, 157 struct mthca_pd *pd,
60 struct ib_ah_attr *ah_attr, 158 struct ib_ah_attr *ah_attr,
@@ -107,7 +205,7 @@ on_hca_fail:
107 av->g_slid = ah_attr->src_path_bits; 205 av->g_slid = ah_attr->src_path_bits;
108 av->dlid = cpu_to_be16(ah_attr->dlid); 206 av->dlid = cpu_to_be16(ah_attr->dlid);
109 av->msg_sr = (3 << 4) | /* 2K message */ 207 av->msg_sr = (3 << 4) | /* 2K message */
110 ah_attr->static_rate; 208 mthca_get_rate(dev, ah_attr->static_rate, ah_attr->port_num);
111 av->sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); 209 av->sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28);
112 if (ah_attr->ah_flags & IB_AH_GRH) { 210 if (ah_attr->ah_flags & IB_AH_GRH) {
113 av->g_slid |= 0x80; 211 av->g_slid |= 0x80;
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 343eca507870..1985b5dfa481 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -965,6 +965,7 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
965 u32 *outbox; 965 u32 *outbox;
966 u8 field; 966 u8 field;
967 u16 size; 967 u16 size;
968 u16 stat_rate;
968 int err; 969 int err;
969 970
970#define QUERY_DEV_LIM_OUT_SIZE 0x100 971#define QUERY_DEV_LIM_OUT_SIZE 0x100
@@ -995,6 +996,7 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
995#define QUERY_DEV_LIM_MTU_WIDTH_OFFSET 0x36 996#define QUERY_DEV_LIM_MTU_WIDTH_OFFSET 0x36
996#define QUERY_DEV_LIM_VL_PORT_OFFSET 0x37 997#define QUERY_DEV_LIM_VL_PORT_OFFSET 0x37
997#define QUERY_DEV_LIM_MAX_GID_OFFSET 0x3b 998#define QUERY_DEV_LIM_MAX_GID_OFFSET 0x3b
999#define QUERY_DEV_LIM_RATE_SUPPORT_OFFSET 0x3c
998#define QUERY_DEV_LIM_MAX_PKEY_OFFSET 0x3f 1000#define QUERY_DEV_LIM_MAX_PKEY_OFFSET 0x3f
999#define QUERY_DEV_LIM_FLAGS_OFFSET 0x44 1001#define QUERY_DEV_LIM_FLAGS_OFFSET 0x44
1000#define QUERY_DEV_LIM_RSVD_UAR_OFFSET 0x48 1002#define QUERY_DEV_LIM_RSVD_UAR_OFFSET 0x48
@@ -1086,6 +1088,8 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
1086 dev_lim->num_ports = field & 0xf; 1088 dev_lim->num_ports = field & 0xf;
1087 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_GID_OFFSET); 1089 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_GID_OFFSET);
1088 dev_lim->max_gids = 1 << (field & 0xf); 1090 dev_lim->max_gids = 1 << (field & 0xf);
1091 MTHCA_GET(stat_rate, outbox, QUERY_DEV_LIM_RATE_SUPPORT_OFFSET);
1092 dev_lim->stat_rate_support = stat_rate;
1089 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_PKEY_OFFSET); 1093 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_PKEY_OFFSET);
1090 dev_lim->max_pkeys = 1 << (field & 0xf); 1094 dev_lim->max_pkeys = 1 << (field & 0xf);
1091 MTHCA_GET(dev_lim->flags, outbox, QUERY_DEV_LIM_FLAGS_OFFSET); 1095 MTHCA_GET(dev_lim->flags, outbox, QUERY_DEV_LIM_FLAGS_OFFSET);
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.h b/drivers/infiniband/hw/mthca/mthca_cmd.h
index e4ec35c40dd3..2f976f2051d6 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.h
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.h
@@ -146,6 +146,7 @@ struct mthca_dev_lim {
146 int max_vl; 146 int max_vl;
147 int num_ports; 147 int num_ports;
148 int max_gids; 148 int max_gids;
149 u16 stat_rate_support;
149 int max_pkeys; 150 int max_pkeys;
150 u32 flags; 151 u32 flags;
151 int reserved_uars; 152 int reserved_uars;
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index ad52edbefe98..4c1dcb4c1822 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -151,6 +151,7 @@ struct mthca_limits {
151 int reserved_qps; 151 int reserved_qps;
152 int num_srqs; 152 int num_srqs;
153 int max_srq_wqes; 153 int max_srq_wqes;
154 int max_srq_sge;
154 int reserved_srqs; 155 int reserved_srqs;
155 int num_eecs; 156 int num_eecs;
156 int reserved_eecs; 157 int reserved_eecs;
@@ -172,6 +173,7 @@ struct mthca_limits {
172 int reserved_pds; 173 int reserved_pds;
173 u32 page_size_cap; 174 u32 page_size_cap;
174 u32 flags; 175 u32 flags;
176 u16 stat_rate_support;
175 u8 port_width_cap; 177 u8 port_width_cap;
176}; 178};
177 179
@@ -353,10 +355,24 @@ struct mthca_dev {
353 struct ib_mad_agent *send_agent[MTHCA_MAX_PORTS][2]; 355 struct ib_mad_agent *send_agent[MTHCA_MAX_PORTS][2];
354 struct ib_ah *sm_ah[MTHCA_MAX_PORTS]; 356 struct ib_ah *sm_ah[MTHCA_MAX_PORTS];
355 spinlock_t sm_lock; 357 spinlock_t sm_lock;
358 u8 rate[MTHCA_MAX_PORTS];
356}; 359};
357 360
358#define mthca_dbg(mdev, format, arg...) \ 361#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
359 dev_dbg(&mdev->pdev->dev, format, ## arg) 362extern int mthca_debug_level;
363
364#define mthca_dbg(mdev, format, arg...) \
365 do { \
366 if (mthca_debug_level) \
367 dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \
368 } while (0)
369
370#else /* CONFIG_INFINIBAND_MTHCA_DEBUG */
371
372#define mthca_dbg(mdev, format, arg...) do { (void) mdev; } while (0)
373
374#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
375
360#define mthca_err(mdev, format, arg...) \ 376#define mthca_err(mdev, format, arg...) \
361 dev_err(&mdev->pdev->dev, format, ## arg) 377 dev_err(&mdev->pdev->dev, format, ## arg)
362#define mthca_info(mdev, format, arg...) \ 378#define mthca_info(mdev, format, arg...) \
@@ -492,6 +508,7 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq);
492int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, 508int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
493 enum ib_srq_attr_mask attr_mask); 509 enum ib_srq_attr_mask attr_mask);
494int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); 510int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
511int mthca_max_srq_sge(struct mthca_dev *dev);
495void mthca_srq_event(struct mthca_dev *dev, u32 srqn, 512void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
496 enum ib_event_type event_type); 513 enum ib_event_type event_type);
497void mthca_free_srq_wqe(struct mthca_srq *srq, u32 wqe_addr); 514void mthca_free_srq_wqe(struct mthca_srq *srq, u32 wqe_addr);
@@ -542,6 +559,8 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah,
542 struct ib_ud_header *header); 559 struct ib_ud_header *header);
543int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr); 560int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr);
544int mthca_ah_grh_present(struct mthca_ah *ah); 561int mthca_ah_grh_present(struct mthca_ah *ah);
562u8 mthca_get_rate(struct mthca_dev *dev, int static_rate, u8 port);
563enum ib_rate mthca_rate_to_ib(struct mthca_dev *dev, u8 mthca_rate, u8 port);
545 564
546int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); 565int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
547int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); 566int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c
index dfb482eac9a2..4730863ece9a 100644
--- a/drivers/infiniband/hw/mthca/mthca_mad.c
+++ b/drivers/infiniband/hw/mthca/mthca_mad.c
@@ -49,6 +49,30 @@ enum {
49 MTHCA_VENDOR_CLASS2 = 0xa 49 MTHCA_VENDOR_CLASS2 = 0xa
50}; 50};
51 51
52static int mthca_update_rate(struct mthca_dev *dev, u8 port_num)
53{
54 struct ib_port_attr *tprops = NULL;
55 int ret;
56
57 tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
58 if (!tprops)
59 return -ENOMEM;
60
61 ret = ib_query_port(&dev->ib_dev, port_num, tprops);
62 if (ret) {
63 printk(KERN_WARNING "ib_query_port failed (%d) for %s port %d\n",
64 ret, dev->ib_dev.name, port_num);
65 goto out;
66 }
67
68 dev->rate[port_num - 1] = tprops->active_speed *
69 ib_width_enum_to_int(tprops->active_width);
70
71out:
72 kfree(tprops);
73 return ret;
74}
75
52static void update_sm_ah(struct mthca_dev *dev, 76static void update_sm_ah(struct mthca_dev *dev,
53 u8 port_num, u16 lid, u8 sl) 77 u8 port_num, u16 lid, u8 sl)
54{ 78{
@@ -90,6 +114,7 @@ static void smp_snoop(struct ib_device *ibdev,
90 mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) && 114 mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
91 mad->mad_hdr.method == IB_MGMT_METHOD_SET) { 115 mad->mad_hdr.method == IB_MGMT_METHOD_SET) {
92 if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) { 116 if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) {
117 mthca_update_rate(to_mdev(ibdev), port_num);
93 update_sm_ah(to_mdev(ibdev), port_num, 118 update_sm_ah(to_mdev(ibdev), port_num,
94 be16_to_cpup((__be16 *) (mad->data + 58)), 119 be16_to_cpup((__be16 *) (mad->data + 58)),
95 (*(u8 *) (mad->data + 76)) & 0xf); 120 (*(u8 *) (mad->data + 76)) & 0xf);
@@ -246,6 +271,7 @@ int mthca_create_agents(struct mthca_dev *dev)
246{ 271{
247 struct ib_mad_agent *agent; 272 struct ib_mad_agent *agent;
248 int p, q; 273 int p, q;
274 int ret;
249 275
250 spin_lock_init(&dev->sm_lock); 276 spin_lock_init(&dev->sm_lock);
251 277
@@ -255,11 +281,23 @@ int mthca_create_agents(struct mthca_dev *dev)
255 q ? IB_QPT_GSI : IB_QPT_SMI, 281 q ? IB_QPT_GSI : IB_QPT_SMI,
256 NULL, 0, send_handler, 282 NULL, 0, send_handler,
257 NULL, NULL); 283 NULL, NULL);
258 if (IS_ERR(agent)) 284 if (IS_ERR(agent)) {
285 ret = PTR_ERR(agent);
259 goto err; 286 goto err;
287 }
260 dev->send_agent[p][q] = agent; 288 dev->send_agent[p][q] = agent;
261 } 289 }
262 290
291
292 for (p = 1; p <= dev->limits.num_ports; ++p) {
293 ret = mthca_update_rate(dev, p);
294 if (ret) {
295 mthca_err(dev, "Failed to obtain port %d rate."
296 " aborting.\n", p);
297 goto err;
298 }
299 }
300
263 return 0; 301 return 0;
264 302
265err: 303err:
@@ -268,7 +306,7 @@ err:
268 if (dev->send_agent[p][q]) 306 if (dev->send_agent[p][q])
269 ib_unregister_mad_agent(dev->send_agent[p][q]); 307 ib_unregister_mad_agent(dev->send_agent[p][q]);
270 308
271 return PTR_ERR(agent); 309 return ret;
272} 310}
273 311
274void __devexit mthca_free_agents(struct mthca_dev *dev) 312void __devexit mthca_free_agents(struct mthca_dev *dev)
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index 266f347c6707..9b9ff7bff357 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -52,6 +52,14 @@ MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
52MODULE_LICENSE("Dual BSD/GPL"); 52MODULE_LICENSE("Dual BSD/GPL");
53MODULE_VERSION(DRV_VERSION); 53MODULE_VERSION(DRV_VERSION);
54 54
55#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
56
57int mthca_debug_level = 0;
58module_param_named(debug_level, mthca_debug_level, int, 0644);
59MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
60
61#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
62
55#ifdef CONFIG_PCI_MSI 63#ifdef CONFIG_PCI_MSI
56 64
57static int msi_x = 0; 65static int msi_x = 0;
@@ -69,6 +77,10 @@ MODULE_PARM_DESC(msi, "attempt to use MSI if nonzero");
69 77
70#endif /* CONFIG_PCI_MSI */ 78#endif /* CONFIG_PCI_MSI */
71 79
80static int tune_pci = 0;
81module_param(tune_pci, int, 0444);
82MODULE_PARM_DESC(tune_pci, "increase PCI burst from the default set by BIOS if nonzero");
83
72static const char mthca_version[] __devinitdata = 84static const char mthca_version[] __devinitdata =
73 DRV_NAME ": Mellanox InfiniBand HCA driver v" 85 DRV_NAME ": Mellanox InfiniBand HCA driver v"
74 DRV_VERSION " (" DRV_RELDATE ")\n"; 86 DRV_VERSION " (" DRV_RELDATE ")\n";
@@ -90,6 +102,9 @@ static int __devinit mthca_tune_pci(struct mthca_dev *mdev)
90 int cap; 102 int cap;
91 u16 val; 103 u16 val;
92 104
105 if (!tune_pci)
106 return 0;
107
93 /* First try to max out Read Byte Count */ 108 /* First try to max out Read Byte Count */
94 cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_PCIX); 109 cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_PCIX);
95 if (cap) { 110 if (cap) {
@@ -176,6 +191,7 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
176 mdev->limits.reserved_srqs = dev_lim->reserved_srqs; 191 mdev->limits.reserved_srqs = dev_lim->reserved_srqs;
177 mdev->limits.reserved_eecs = dev_lim->reserved_eecs; 192 mdev->limits.reserved_eecs = dev_lim->reserved_eecs;
178 mdev->limits.max_desc_sz = dev_lim->max_desc_sz; 193 mdev->limits.max_desc_sz = dev_lim->max_desc_sz;
194 mdev->limits.max_srq_sge = mthca_max_srq_sge(mdev);
179 /* 195 /*
180 * Subtract 1 from the limit because we need to allocate a 196 * Subtract 1 from the limit because we need to allocate a
181 * spare CQE so the HCA HW can tell the difference between an 197 * spare CQE so the HCA HW can tell the difference between an
@@ -191,6 +207,18 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
191 mdev->limits.port_width_cap = dev_lim->max_port_width; 207 mdev->limits.port_width_cap = dev_lim->max_port_width;
192 mdev->limits.page_size_cap = ~(u32) (dev_lim->min_page_sz - 1); 208 mdev->limits.page_size_cap = ~(u32) (dev_lim->min_page_sz - 1);
193 mdev->limits.flags = dev_lim->flags; 209 mdev->limits.flags = dev_lim->flags;
210 /*
211 * For old FW that doesn't return static rate support, use a
212 * value of 0x3 (only static rate values of 0 or 1 are handled),
213 * except on Sinai, where even old FW can handle static rate
214 * values of 2 and 3.
215 */
216 if (dev_lim->stat_rate_support)
217 mdev->limits.stat_rate_support = dev_lim->stat_rate_support;
218 else if (mdev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
219 mdev->limits.stat_rate_support = 0xf;
220 else
221 mdev->limits.stat_rate_support = 0x3;
194 222
195 /* IB_DEVICE_RESIZE_MAX_WR not supported by driver. 223 /* IB_DEVICE_RESIZE_MAX_WR not supported by driver.
196 May be doable since hardware supports it for SRQ. 224 May be doable since hardware supports it for SRQ.
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 2c250bc11c33..565a24b1756f 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -106,7 +106,7 @@ static int mthca_query_device(struct ib_device *ibdev,
106 props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp; 106 props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp;
107 props->max_srq = mdev->limits.num_srqs - mdev->limits.reserved_srqs; 107 props->max_srq = mdev->limits.num_srqs - mdev->limits.reserved_srqs;
108 props->max_srq_wr = mdev->limits.max_srq_wqes; 108 props->max_srq_wr = mdev->limits.max_srq_wqes;
109 props->max_srq_sge = mdev->limits.max_sg; 109 props->max_srq_sge = mdev->limits.max_srq_sge;
110 props->local_ca_ack_delay = mdev->limits.local_ca_ack_delay; 110 props->local_ca_ack_delay = mdev->limits.local_ca_ack_delay;
111 props->atomic_cap = mdev->limits.flags & DEV_LIM_FLAG_ATOMIC ? 111 props->atomic_cap = mdev->limits.flags & DEV_LIM_FLAG_ATOMIC ?
112 IB_ATOMIC_HCA : IB_ATOMIC_NONE; 112 IB_ATOMIC_HCA : IB_ATOMIC_NONE;
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h
index 2e7f52136965..6676a786d690 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.h
+++ b/drivers/infiniband/hw/mthca/mthca_provider.h
@@ -257,6 +257,8 @@ struct mthca_qp {
257 atomic_t refcount; 257 atomic_t refcount;
258 u32 qpn; 258 u32 qpn;
259 int is_direct; 259 int is_direct;
260 u8 port; /* for SQP and memfree use only */
261 u8 alt_port; /* for memfree use only */
260 u8 transport; 262 u8 transport;
261 u8 state; 263 u8 state;
262 u8 atomic_rd_en; 264 u8 atomic_rd_en;
@@ -278,7 +280,6 @@ struct mthca_qp {
278 280
279struct mthca_sqp { 281struct mthca_sqp {
280 struct mthca_qp qp; 282 struct mthca_qp qp;
281 int port;
282 int pkey_index; 283 int pkey_index;
283 u32 qkey; 284 u32 qkey;
284 u32 send_psn; 285 u32 send_psn;
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 057c8e6af87b..f37b0e367323 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -248,6 +248,9 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
248 return; 248 return;
249 } 249 }
250 250
251 if (event_type == IB_EVENT_PATH_MIG)
252 qp->port = qp->alt_port;
253
251 event.device = &dev->ib_dev; 254 event.device = &dev->ib_dev;
252 event.event = event_type; 255 event.event = event_type;
253 event.element.qp = &qp->ibqp; 256 event.element.qp = &qp->ibqp;
@@ -392,10 +395,16 @@ static void to_ib_ah_attr(struct mthca_dev *dev, struct ib_ah_attr *ib_ah_attr,
392{ 395{
393 memset(ib_ah_attr, 0, sizeof *path); 396 memset(ib_ah_attr, 0, sizeof *path);
394 ib_ah_attr->port_num = (be32_to_cpu(path->port_pkey) >> 24) & 0x3; 397 ib_ah_attr->port_num = (be32_to_cpu(path->port_pkey) >> 24) & 0x3;
398
399 if (ib_ah_attr->port_num == 0 || ib_ah_attr->port_num > dev->limits.num_ports)
400 return;
401
395 ib_ah_attr->dlid = be16_to_cpu(path->rlid); 402 ib_ah_attr->dlid = be16_to_cpu(path->rlid);
396 ib_ah_attr->sl = be32_to_cpu(path->sl_tclass_flowlabel) >> 28; 403 ib_ah_attr->sl = be32_to_cpu(path->sl_tclass_flowlabel) >> 28;
397 ib_ah_attr->src_path_bits = path->g_mylmc & 0x7f; 404 ib_ah_attr->src_path_bits = path->g_mylmc & 0x7f;
398 ib_ah_attr->static_rate = path->static_rate & 0x7; 405 ib_ah_attr->static_rate = mthca_rate_to_ib(dev,
406 path->static_rate & 0x7,
407 ib_ah_attr->port_num);
399 ib_ah_attr->ah_flags = (path->g_mylmc & (1 << 7)) ? IB_AH_GRH : 0; 408 ib_ah_attr->ah_flags = (path->g_mylmc & (1 << 7)) ? IB_AH_GRH : 0;
400 if (ib_ah_attr->ah_flags) { 409 if (ib_ah_attr->ah_flags) {
401 ib_ah_attr->grh.sgid_index = path->mgid_index & (dev->limits.gid_table_len - 1); 410 ib_ah_attr->grh.sgid_index = path->mgid_index & (dev->limits.gid_table_len - 1);
@@ -455,8 +464,10 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m
455 qp_attr->cap.max_recv_sge = qp->rq.max_gs; 464 qp_attr->cap.max_recv_sge = qp->rq.max_gs;
456 qp_attr->cap.max_inline_data = qp->max_inline_data; 465 qp_attr->cap.max_inline_data = qp->max_inline_data;
457 466
458 to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); 467 if (qp->transport == RC || qp->transport == UC) {
459 to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path); 468 to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path);
469 to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path);
470 }
460 471
461 qp_attr->pkey_index = be32_to_cpu(context->pri_path.port_pkey) & 0x7f; 472 qp_attr->pkey_index = be32_to_cpu(context->pri_path.port_pkey) & 0x7f;
462 qp_attr->alt_pkey_index = be32_to_cpu(context->alt_path.port_pkey) & 0x7f; 473 qp_attr->alt_pkey_index = be32_to_cpu(context->alt_path.port_pkey) & 0x7f;
@@ -484,11 +495,11 @@ out:
484} 495}
485 496
486static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah, 497static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah,
487 struct mthca_qp_path *path) 498 struct mthca_qp_path *path, u8 port)
488{ 499{
489 path->g_mylmc = ah->src_path_bits & 0x7f; 500 path->g_mylmc = ah->src_path_bits & 0x7f;
490 path->rlid = cpu_to_be16(ah->dlid); 501 path->rlid = cpu_to_be16(ah->dlid);
491 path->static_rate = !!ah->static_rate; 502 path->static_rate = mthca_get_rate(dev, ah->static_rate, port);
492 503
493 if (ah->ah_flags & IB_AH_GRH) { 504 if (ah->ah_flags & IB_AH_GRH) {
494 if (ah->grh.sgid_index >= dev->limits.gid_table_len) { 505 if (ah->grh.sgid_index >= dev->limits.gid_table_len) {
@@ -634,7 +645,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
634 645
635 if (qp->transport == MLX) 646 if (qp->transport == MLX)
636 qp_context->pri_path.port_pkey |= 647 qp_context->pri_path.port_pkey |=
637 cpu_to_be32(to_msqp(qp)->port << 24); 648 cpu_to_be32(qp->port << 24);
638 else { 649 else {
639 if (attr_mask & IB_QP_PORT) { 650 if (attr_mask & IB_QP_PORT) {
640 qp_context->pri_path.port_pkey |= 651 qp_context->pri_path.port_pkey |=
@@ -657,7 +668,8 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
657 } 668 }
658 669
659 if (attr_mask & IB_QP_AV) { 670 if (attr_mask & IB_QP_AV) {
660 if (mthca_path_set(dev, &attr->ah_attr, &qp_context->pri_path)) 671 if (mthca_path_set(dev, &attr->ah_attr, &qp_context->pri_path,
672 attr_mask & IB_QP_PORT ? attr->port_num : qp->port))
661 return -EINVAL; 673 return -EINVAL;
662 674
663 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH); 675 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH);
@@ -681,7 +693,8 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
681 return -EINVAL; 693 return -EINVAL;
682 } 694 }
683 695
684 if (mthca_path_set(dev, &attr->alt_ah_attr, &qp_context->alt_path)) 696 if (mthca_path_set(dev, &attr->alt_ah_attr, &qp_context->alt_path,
697 attr->alt_ah_attr.port_num))
685 return -EINVAL; 698 return -EINVAL;
686 699
687 qp_context->alt_path.port_pkey |= cpu_to_be32(attr->alt_pkey_index | 700 qp_context->alt_path.port_pkey |= cpu_to_be32(attr->alt_pkey_index |
@@ -791,6 +804,10 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
791 qp->atomic_rd_en = attr->qp_access_flags; 804 qp->atomic_rd_en = attr->qp_access_flags;
792 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) 805 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
793 qp->resp_depth = attr->max_dest_rd_atomic; 806 qp->resp_depth = attr->max_dest_rd_atomic;
807 if (attr_mask & IB_QP_PORT)
808 qp->port = attr->port_num;
809 if (attr_mask & IB_QP_ALT_PATH)
810 qp->alt_port = attr->alt_port_num;
794 811
795 if (is_sqp(dev, qp)) 812 if (is_sqp(dev, qp))
796 store_attrs(to_msqp(qp), attr, attr_mask); 813 store_attrs(to_msqp(qp), attr, attr_mask);
@@ -802,13 +819,13 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
802 if (is_qp0(dev, qp)) { 819 if (is_qp0(dev, qp)) {
803 if (cur_state != IB_QPS_RTR && 820 if (cur_state != IB_QPS_RTR &&
804 new_state == IB_QPS_RTR) 821 new_state == IB_QPS_RTR)
805 init_port(dev, to_msqp(qp)->port); 822 init_port(dev, qp->port);
806 823
807 if (cur_state != IB_QPS_RESET && 824 if (cur_state != IB_QPS_RESET &&
808 cur_state != IB_QPS_ERR && 825 cur_state != IB_QPS_ERR &&
809 (new_state == IB_QPS_RESET || 826 (new_state == IB_QPS_RESET ||
810 new_state == IB_QPS_ERR)) 827 new_state == IB_QPS_ERR))
811 mthca_CLOSE_IB(dev, to_msqp(qp)->port, &status); 828 mthca_CLOSE_IB(dev, qp->port, &status);
812 } 829 }
813 830
814 /* 831 /*
@@ -1212,6 +1229,9 @@ int mthca_alloc_qp(struct mthca_dev *dev,
1212 if (qp->qpn == -1) 1229 if (qp->qpn == -1)
1213 return -ENOMEM; 1230 return -ENOMEM;
1214 1231
1232 /* initialize port to zero for error-catching. */
1233 qp->port = 0;
1234
1215 err = mthca_alloc_qp_common(dev, pd, send_cq, recv_cq, 1235 err = mthca_alloc_qp_common(dev, pd, send_cq, recv_cq,
1216 send_policy, qp); 1236 send_policy, qp);
1217 if (err) { 1237 if (err) {
@@ -1261,7 +1281,7 @@ int mthca_alloc_sqp(struct mthca_dev *dev,
1261 if (err) 1281 if (err)
1262 goto err_out; 1282 goto err_out;
1263 1283
1264 sqp->port = port; 1284 sqp->qp.port = port;
1265 sqp->qp.qpn = mqpn; 1285 sqp->qp.qpn = mqpn;
1266 sqp->qp.transport = MLX; 1286 sqp->qp.transport = MLX;
1267 1287
@@ -1404,10 +1424,10 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
1404 sqp->ud_header.lrh.source_lid = IB_LID_PERMISSIVE; 1424 sqp->ud_header.lrh.source_lid = IB_LID_PERMISSIVE;
1405 sqp->ud_header.bth.solicited_event = !!(wr->send_flags & IB_SEND_SOLICITED); 1425 sqp->ud_header.bth.solicited_event = !!(wr->send_flags & IB_SEND_SOLICITED);
1406 if (!sqp->qp.ibqp.qp_num) 1426 if (!sqp->qp.ibqp.qp_num)
1407 ib_get_cached_pkey(&dev->ib_dev, sqp->port, 1427 ib_get_cached_pkey(&dev->ib_dev, sqp->qp.port,
1408 sqp->pkey_index, &pkey); 1428 sqp->pkey_index, &pkey);
1409 else 1429 else
1410 ib_get_cached_pkey(&dev->ib_dev, sqp->port, 1430 ib_get_cached_pkey(&dev->ib_dev, sqp->qp.port,
1411 wr->wr.ud.pkey_index, &pkey); 1431 wr->wr.ud.pkey_index, &pkey);
1412 sqp->ud_header.bth.pkey = cpu_to_be16(pkey); 1432 sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
1413 sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->wr.ud.remote_qpn); 1433 sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->wr.ud.remote_qpn);
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 2dd3aea05341..adcaf85355ae 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -192,7 +192,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
192 192
193 /* Sanity check SRQ size before proceeding */ 193 /* Sanity check SRQ size before proceeding */
194 if (attr->max_wr > dev->limits.max_srq_wqes || 194 if (attr->max_wr > dev->limits.max_srq_wqes ||
195 attr->max_sge > dev->limits.max_sg) 195 attr->max_sge > dev->limits.max_srq_sge)
196 return -EINVAL; 196 return -EINVAL;
197 197
198 srq->max = attr->max_wr; 198 srq->max = attr->max_wr;
@@ -660,6 +660,31 @@ int mthca_arbel_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
660 return err; 660 return err;
661} 661}
662 662
663int mthca_max_srq_sge(struct mthca_dev *dev)
664{
665 if (mthca_is_memfree(dev))
666 return dev->limits.max_sg;
667
668 /*
669 * SRQ allocations are based on powers of 2 for Tavor,
670 * (although they only need to be multiples of 16 bytes).
671 *
672 * Therefore, we need to base the max number of sg entries on
673 * the largest power of 2 descriptor size that is <= to the
674 * actual max WQE descriptor size, rather than return the
675 * max_sg value given by the firmware (which is based on WQE
676 * sizes as multiples of 16, not powers of 2).
677 *
678 * If SRQ implementation is changed for Tavor to be based on
679 * multiples of 16, the calculation below can be deleted and
680 * the FW max_sg value returned.
681 */
682 return min_t(int, dev->limits.max_sg,
683 ((1 << (fls(dev->limits.max_desc_sz) - 1)) -
684 sizeof (struct mthca_next_seg)) /
685 sizeof (struct mthca_data_seg));
686}
687
663int __devinit mthca_init_srq_table(struct mthca_dev *dev) 688int __devinit mthca_init_srq_table(struct mthca_dev *dev)
664{ 689{
665 int err; 690 int err;
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig
index 8d2e04cac68e..13d6d01c72c0 100644
--- a/drivers/infiniband/ulp/ipoib/Kconfig
+++ b/drivers/infiniband/ulp/ipoib/Kconfig
@@ -10,8 +10,9 @@ config INFINIBAND_IPOIB
10 group: <http://www.ietf.org/html.charters/ipoib-charter.html>. 10 group: <http://www.ietf.org/html.charters/ipoib-charter.html>.
11 11
12config INFINIBAND_IPOIB_DEBUG 12config INFINIBAND_IPOIB_DEBUG
13 bool "IP-over-InfiniBand debugging" 13 bool "IP-over-InfiniBand debugging" if EMBEDDED
14 depends on INFINIBAND_IPOIB 14 depends on INFINIBAND_IPOIB
15 default y
15 ---help--- 16 ---help---
16 This option causes debugging code to be compiled into the 17 This option causes debugging code to be compiled into the
17 IPoIB driver. The output can be turned on via the 18 IPoIB driver. The output can be turned on via the
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index b640107fb732..12a1e0572ef2 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -65,6 +65,8 @@ enum {
65 65
66 IPOIB_RX_RING_SIZE = 128, 66 IPOIB_RX_RING_SIZE = 128,
67 IPOIB_TX_RING_SIZE = 64, 67 IPOIB_TX_RING_SIZE = 64,
68 IPOIB_MAX_QUEUE_SIZE = 8192,
69 IPOIB_MIN_QUEUE_SIZE = 2,
68 70
69 IPOIB_NUM_WC = 4, 71 IPOIB_NUM_WC = 4,
70 72
@@ -230,6 +232,9 @@ static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh)
230 INFINIBAND_ALEN, sizeof(void *)); 232 INFINIBAND_ALEN, sizeof(void *));
231} 233}
232 234
235struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neigh);
236void ipoib_neigh_free(struct ipoib_neigh *neigh);
237
233extern struct workqueue_struct *ipoib_workqueue; 238extern struct workqueue_struct *ipoib_workqueue;
234 239
235/* functions */ 240/* functions */
@@ -329,6 +334,8 @@ static inline void ipoib_unregister_debugfs(void) { }
329#define ipoib_warn(priv, format, arg...) \ 334#define ipoib_warn(priv, format, arg...) \
330 ipoib_printk(KERN_WARNING, priv, format , ## arg) 335 ipoib_printk(KERN_WARNING, priv, format , ## arg)
331 336
337extern int ipoib_sendq_size;
338extern int ipoib_recvq_size;
332 339
333#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 340#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
334extern int ipoib_debug_level; 341extern int ipoib_debug_level;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
index 685258e34034..5dde380e8dbe 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
@@ -213,7 +213,7 @@ static int ipoib_path_seq_show(struct seq_file *file, void *iter_ptr)
213 gid_buf, path.pathrec.dlid ? "yes" : "no"); 213 gid_buf, path.pathrec.dlid ? "yes" : "no");
214 214
215 if (path.pathrec.dlid) { 215 if (path.pathrec.dlid) {
216 rate = ib_sa_rate_enum_to_int(path.pathrec.rate) * 25; 216 rate = ib_rate_to_mult(path.pathrec.rate) * 25;
217 217
218 seq_printf(file, 218 seq_printf(file,
219 " DLID: 0x%04x\n" 219 " DLID: 0x%04x\n"
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index ed65202878d8..a54da42849ae 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -161,7 +161,7 @@ static int ipoib_ib_post_receives(struct net_device *dev)
161 struct ipoib_dev_priv *priv = netdev_priv(dev); 161 struct ipoib_dev_priv *priv = netdev_priv(dev);
162 int i; 162 int i;
163 163
164 for (i = 0; i < IPOIB_RX_RING_SIZE; ++i) { 164 for (i = 0; i < ipoib_recvq_size; ++i) {
165 if (ipoib_alloc_rx_skb(dev, i)) { 165 if (ipoib_alloc_rx_skb(dev, i)) {
166 ipoib_warn(priv, "failed to allocate receive buffer %d\n", i); 166 ipoib_warn(priv, "failed to allocate receive buffer %d\n", i);
167 return -ENOMEM; 167 return -ENOMEM;
@@ -187,7 +187,7 @@ static void ipoib_ib_handle_wc(struct net_device *dev,
187 if (wr_id & IPOIB_OP_RECV) { 187 if (wr_id & IPOIB_OP_RECV) {
188 wr_id &= ~IPOIB_OP_RECV; 188 wr_id &= ~IPOIB_OP_RECV;
189 189
190 if (wr_id < IPOIB_RX_RING_SIZE) { 190 if (wr_id < ipoib_recvq_size) {
191 struct sk_buff *skb = priv->rx_ring[wr_id].skb; 191 struct sk_buff *skb = priv->rx_ring[wr_id].skb;
192 dma_addr_t addr = priv->rx_ring[wr_id].mapping; 192 dma_addr_t addr = priv->rx_ring[wr_id].mapping;
193 193
@@ -252,9 +252,9 @@ static void ipoib_ib_handle_wc(struct net_device *dev,
252 struct ipoib_tx_buf *tx_req; 252 struct ipoib_tx_buf *tx_req;
253 unsigned long flags; 253 unsigned long flags;
254 254
255 if (wr_id >= IPOIB_TX_RING_SIZE) { 255 if (wr_id >= ipoib_sendq_size) {
256 ipoib_warn(priv, "completion event with wrid %d (> %d)\n", 256 ipoib_warn(priv, "completion event with wrid %d (> %d)\n",
257 wr_id, IPOIB_TX_RING_SIZE); 257 wr_id, ipoib_sendq_size);
258 return; 258 return;
259 } 259 }
260 260
@@ -275,7 +275,7 @@ static void ipoib_ib_handle_wc(struct net_device *dev,
275 spin_lock_irqsave(&priv->tx_lock, flags); 275 spin_lock_irqsave(&priv->tx_lock, flags);
276 ++priv->tx_tail; 276 ++priv->tx_tail;
277 if (netif_queue_stopped(dev) && 277 if (netif_queue_stopped(dev) &&
278 priv->tx_head - priv->tx_tail <= IPOIB_TX_RING_SIZE / 2) 278 priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1)
279 netif_wake_queue(dev); 279 netif_wake_queue(dev);
280 spin_unlock_irqrestore(&priv->tx_lock, flags); 280 spin_unlock_irqrestore(&priv->tx_lock, flags);
281 281
@@ -344,13 +344,13 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
344 * means we have to make sure everything is properly recorded and 344 * means we have to make sure everything is properly recorded and
345 * our state is consistent before we call post_send(). 345 * our state is consistent before we call post_send().
346 */ 346 */
347 tx_req = &priv->tx_ring[priv->tx_head & (IPOIB_TX_RING_SIZE - 1)]; 347 tx_req = &priv->tx_ring[priv->tx_head & (ipoib_sendq_size - 1)];
348 tx_req->skb = skb; 348 tx_req->skb = skb;
349 addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len, 349 addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len,
350 DMA_TO_DEVICE); 350 DMA_TO_DEVICE);
351 pci_unmap_addr_set(tx_req, mapping, addr); 351 pci_unmap_addr_set(tx_req, mapping, addr);
352 352
353 if (unlikely(post_send(priv, priv->tx_head & (IPOIB_TX_RING_SIZE - 1), 353 if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1),
354 address->ah, qpn, addr, skb->len))) { 354 address->ah, qpn, addr, skb->len))) {
355 ipoib_warn(priv, "post_send failed\n"); 355 ipoib_warn(priv, "post_send failed\n");
356 ++priv->stats.tx_errors; 356 ++priv->stats.tx_errors;
@@ -363,7 +363,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
363 address->last_send = priv->tx_head; 363 address->last_send = priv->tx_head;
364 ++priv->tx_head; 364 ++priv->tx_head;
365 365
366 if (priv->tx_head - priv->tx_tail == IPOIB_TX_RING_SIZE) { 366 if (priv->tx_head - priv->tx_tail == ipoib_sendq_size) {
367 ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n"); 367 ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n");
368 netif_stop_queue(dev); 368 netif_stop_queue(dev);
369 } 369 }
@@ -488,7 +488,7 @@ static int recvs_pending(struct net_device *dev)
488 int pending = 0; 488 int pending = 0;
489 int i; 489 int i;
490 490
491 for (i = 0; i < IPOIB_RX_RING_SIZE; ++i) 491 for (i = 0; i < ipoib_recvq_size; ++i)
492 if (priv->rx_ring[i].skb) 492 if (priv->rx_ring[i].skb)
493 ++pending; 493 ++pending;
494 494
@@ -527,7 +527,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
527 */ 527 */
528 while ((int) priv->tx_tail - (int) priv->tx_head < 0) { 528 while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
529 tx_req = &priv->tx_ring[priv->tx_tail & 529 tx_req = &priv->tx_ring[priv->tx_tail &
530 (IPOIB_TX_RING_SIZE - 1)]; 530 (ipoib_sendq_size - 1)];
531 dma_unmap_single(priv->ca->dma_device, 531 dma_unmap_single(priv->ca->dma_device,
532 pci_unmap_addr(tx_req, mapping), 532 pci_unmap_addr(tx_req, mapping),
533 tx_req->skb->len, 533 tx_req->skb->len,
@@ -536,7 +536,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
536 ++priv->tx_tail; 536 ++priv->tx_tail;
537 } 537 }
538 538
539 for (i = 0; i < IPOIB_RX_RING_SIZE; ++i) 539 for (i = 0; i < ipoib_recvq_size; ++i)
540 if (priv->rx_ring[i].skb) { 540 if (priv->rx_ring[i].skb) {
541 dma_unmap_single(priv->ca->dma_device, 541 dma_unmap_single(priv->ca->dma_device,
542 pci_unmap_addr(&priv->rx_ring[i], 542 pci_unmap_addr(&priv->rx_ring[i],
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9b0bd7c746ca..cb078a7d0bf5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -41,6 +41,7 @@
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/kernel.h>
44 45
45#include <linux/if_arp.h> /* For ARPHRD_xxx */ 46#include <linux/if_arp.h> /* For ARPHRD_xxx */
46 47
@@ -53,6 +54,14 @@ MODULE_AUTHOR("Roland Dreier");
53MODULE_DESCRIPTION("IP-over-InfiniBand net driver"); 54MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
54MODULE_LICENSE("Dual BSD/GPL"); 55MODULE_LICENSE("Dual BSD/GPL");
55 56
57int ipoib_sendq_size __read_mostly = IPOIB_TX_RING_SIZE;
58int ipoib_recvq_size __read_mostly = IPOIB_RX_RING_SIZE;
59
60module_param_named(send_queue_size, ipoib_sendq_size, int, 0444);
61MODULE_PARM_DESC(send_queue_size, "Number of descriptors in send queue");
62module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444);
63MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue");
64
56#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 65#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
57int ipoib_debug_level; 66int ipoib_debug_level;
58 67
@@ -252,8 +261,8 @@ static void path_free(struct net_device *dev, struct ipoib_path *path)
252 */ 261 */
253 if (neigh->ah) 262 if (neigh->ah)
254 ipoib_put_ah(neigh->ah); 263 ipoib_put_ah(neigh->ah);
255 *to_ipoib_neigh(neigh->neighbour) = NULL; 264
256 kfree(neigh); 265 ipoib_neigh_free(neigh);
257 } 266 }
258 267
259 spin_unlock_irqrestore(&priv->lock, flags); 268 spin_unlock_irqrestore(&priv->lock, flags);
@@ -327,9 +336,8 @@ void ipoib_flush_paths(struct net_device *dev)
327 struct ipoib_dev_priv *priv = netdev_priv(dev); 336 struct ipoib_dev_priv *priv = netdev_priv(dev);
328 struct ipoib_path *path, *tp; 337 struct ipoib_path *path, *tp;
329 LIST_HEAD(remove_list); 338 LIST_HEAD(remove_list);
330 unsigned long flags;
331 339
332 spin_lock_irqsave(&priv->lock, flags); 340 spin_lock_irq(&priv->lock);
333 341
334 list_splice(&priv->path_list, &remove_list); 342 list_splice(&priv->path_list, &remove_list);
335 INIT_LIST_HEAD(&priv->path_list); 343 INIT_LIST_HEAD(&priv->path_list);
@@ -337,14 +345,15 @@ void ipoib_flush_paths(struct net_device *dev)
337 list_for_each_entry(path, &remove_list, list) 345 list_for_each_entry(path, &remove_list, list)
338 rb_erase(&path->rb_node, &priv->path_tree); 346 rb_erase(&path->rb_node, &priv->path_tree);
339 347
340 spin_unlock_irqrestore(&priv->lock, flags);
341
342 list_for_each_entry_safe(path, tp, &remove_list, list) { 348 list_for_each_entry_safe(path, tp, &remove_list, list) {
343 if (path->query) 349 if (path->query)
344 ib_sa_cancel_query(path->query_id, path->query); 350 ib_sa_cancel_query(path->query_id, path->query);
351 spin_unlock_irq(&priv->lock);
345 wait_for_completion(&path->done); 352 wait_for_completion(&path->done);
346 path_free(dev, path); 353 path_free(dev, path);
354 spin_lock_irq(&priv->lock);
347 } 355 }
356 spin_unlock_irq(&priv->lock);
348} 357}
349 358
350static void path_rec_completion(int status, 359static void path_rec_completion(int status,
@@ -373,16 +382,9 @@ static void path_rec_completion(int status,
373 struct ib_ah_attr av = { 382 struct ib_ah_attr av = {
374 .dlid = be16_to_cpu(pathrec->dlid), 383 .dlid = be16_to_cpu(pathrec->dlid),
375 .sl = pathrec->sl, 384 .sl = pathrec->sl,
376 .port_num = priv->port 385 .port_num = priv->port,
386 .static_rate = pathrec->rate
377 }; 387 };
378 int path_rate = ib_sa_rate_enum_to_int(pathrec->rate);
379
380 if (path_rate > 0 && priv->local_rate > path_rate)
381 av.static_rate = (priv->local_rate - 1) / path_rate;
382
383 ipoib_dbg(priv, "static_rate %d for local port %dX, path %dX\n",
384 av.static_rate, priv->local_rate,
385 ib_sa_rate_enum_to_int(pathrec->rate));
386 388
387 ah = ipoib_create_ah(dev, priv->pd, &av); 389 ah = ipoib_create_ah(dev, priv->pd, &av);
388 } 390 }
@@ -481,7 +483,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
481 struct ipoib_path *path; 483 struct ipoib_path *path;
482 struct ipoib_neigh *neigh; 484 struct ipoib_neigh *neigh;
483 485
484 neigh = kmalloc(sizeof *neigh, GFP_ATOMIC); 486 neigh = ipoib_neigh_alloc(skb->dst->neighbour);
485 if (!neigh) { 487 if (!neigh) {
486 ++priv->stats.tx_dropped; 488 ++priv->stats.tx_dropped;
487 dev_kfree_skb_any(skb); 489 dev_kfree_skb_any(skb);
@@ -489,8 +491,6 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
489 } 491 }
490 492
491 skb_queue_head_init(&neigh->queue); 493 skb_queue_head_init(&neigh->queue);
492 neigh->neighbour = skb->dst->neighbour;
493 *to_ipoib_neigh(skb->dst->neighbour) = neigh;
494 494
495 /* 495 /*
496 * We can only be called from ipoib_start_xmit, so we're 496 * We can only be called from ipoib_start_xmit, so we're
@@ -503,7 +503,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
503 path = path_rec_create(dev, 503 path = path_rec_create(dev,
504 (union ib_gid *) (skb->dst->neighbour->ha + 4)); 504 (union ib_gid *) (skb->dst->neighbour->ha + 4));
505 if (!path) 505 if (!path)
506 goto err; 506 goto err_path;
507 507
508 __path_add(dev, path); 508 __path_add(dev, path);
509 } 509 }
@@ -521,17 +521,17 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
521 __skb_queue_tail(&neigh->queue, skb); 521 __skb_queue_tail(&neigh->queue, skb);
522 522
523 if (!path->query && path_rec_start(dev, path)) 523 if (!path->query && path_rec_start(dev, path))
524 goto err; 524 goto err_list;
525 } 525 }
526 526
527 spin_unlock(&priv->lock); 527 spin_unlock(&priv->lock);
528 return; 528 return;
529 529
530err: 530err_list:
531 *to_ipoib_neigh(skb->dst->neighbour) = NULL;
532 list_del(&neigh->list); 531 list_del(&neigh->list);
533 kfree(neigh);
534 532
533err_path:
534 ipoib_neigh_free(neigh);
535 ++priv->stats.tx_dropped; 535 ++priv->stats.tx_dropped;
536 dev_kfree_skb_any(skb); 536 dev_kfree_skb_any(skb);
537 537
@@ -763,8 +763,7 @@ static void ipoib_neigh_destructor(struct neighbour *n)
763 if (neigh->ah) 763 if (neigh->ah)
764 ah = neigh->ah; 764 ah = neigh->ah;
765 list_del(&neigh->list); 765 list_del(&neigh->list);
766 *to_ipoib_neigh(n) = NULL; 766 ipoib_neigh_free(neigh);
767 kfree(neigh);
768 } 767 }
769 768
770 spin_unlock_irqrestore(&priv->lock, flags); 769 spin_unlock_irqrestore(&priv->lock, flags);
@@ -773,6 +772,26 @@ static void ipoib_neigh_destructor(struct neighbour *n)
773 ipoib_put_ah(ah); 772 ipoib_put_ah(ah);
774} 773}
775 774
775struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neighbour)
776{
777 struct ipoib_neigh *neigh;
778
779 neigh = kmalloc(sizeof *neigh, GFP_ATOMIC);
780 if (!neigh)
781 return NULL;
782
783 neigh->neighbour = neighbour;
784 *to_ipoib_neigh(neighbour) = neigh;
785
786 return neigh;
787}
788
789void ipoib_neigh_free(struct ipoib_neigh *neigh)
790{
791 *to_ipoib_neigh(neigh->neighbour) = NULL;
792 kfree(neigh);
793}
794
776static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms) 795static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms)
777{ 796{
778 parms->neigh_destructor = ipoib_neigh_destructor; 797 parms->neigh_destructor = ipoib_neigh_destructor;
@@ -785,20 +804,19 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
785 struct ipoib_dev_priv *priv = netdev_priv(dev); 804 struct ipoib_dev_priv *priv = netdev_priv(dev);
786 805
787 /* Allocate RX/TX "rings" to hold queued skbs */ 806 /* Allocate RX/TX "rings" to hold queued skbs */
788 807 priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
789 priv->rx_ring = kzalloc(IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf),
790 GFP_KERNEL); 808 GFP_KERNEL);
791 if (!priv->rx_ring) { 809 if (!priv->rx_ring) {
792 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n", 810 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
793 ca->name, IPOIB_RX_RING_SIZE); 811 ca->name, ipoib_recvq_size);
794 goto out; 812 goto out;
795 } 813 }
796 814
797 priv->tx_ring = kzalloc(IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf), 815 priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring,
798 GFP_KERNEL); 816 GFP_KERNEL);
799 if (!priv->tx_ring) { 817 if (!priv->tx_ring) {
800 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", 818 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
801 ca->name, IPOIB_TX_RING_SIZE); 819 ca->name, ipoib_sendq_size);
802 goto out_rx_ring_cleanup; 820 goto out_rx_ring_cleanup;
803 } 821 }
804 822
@@ -866,7 +884,7 @@ static void ipoib_setup(struct net_device *dev)
866 dev->hard_header_len = IPOIB_ENCAP_LEN + INFINIBAND_ALEN; 884 dev->hard_header_len = IPOIB_ENCAP_LEN + INFINIBAND_ALEN;
867 dev->addr_len = INFINIBAND_ALEN; 885 dev->addr_len = INFINIBAND_ALEN;
868 dev->type = ARPHRD_INFINIBAND; 886 dev->type = ARPHRD_INFINIBAND;
869 dev->tx_queue_len = IPOIB_TX_RING_SIZE * 2; 887 dev->tx_queue_len = ipoib_sendq_size * 2;
870 dev->features = NETIF_F_VLAN_CHALLENGED | NETIF_F_LLTX; 888 dev->features = NETIF_F_VLAN_CHALLENGED | NETIF_F_LLTX;
871 889
872 /* MTU will be reset when mcast join happens */ 890 /* MTU will be reset when mcast join happens */
@@ -1118,6 +1136,14 @@ static int __init ipoib_init_module(void)
1118{ 1136{
1119 int ret; 1137 int ret;
1120 1138
1139 ipoib_recvq_size = roundup_pow_of_two(ipoib_recvq_size);
1140 ipoib_recvq_size = min(ipoib_recvq_size, IPOIB_MAX_QUEUE_SIZE);
1141 ipoib_recvq_size = max(ipoib_recvq_size, IPOIB_MIN_QUEUE_SIZE);
1142
1143 ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
1144 ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
1145 ipoib_sendq_size = max(ipoib_sendq_size, IPOIB_MIN_QUEUE_SIZE);
1146
1121 ret = ipoib_register_debugfs(); 1147 ret = ipoib_register_debugfs();
1122 if (ret) 1148 if (ret)
1123 return ret; 1149 return ret;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 93c462eaf4fd..1dae4b238252 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -114,8 +114,7 @@ static void ipoib_mcast_free(struct ipoib_mcast *mcast)
114 */ 114 */
115 if (neigh->ah) 115 if (neigh->ah)
116 ipoib_put_ah(neigh->ah); 116 ipoib_put_ah(neigh->ah);
117 *to_ipoib_neigh(neigh->neighbour) = NULL; 117 ipoib_neigh_free(neigh);
118 kfree(neigh);
119 } 118 }
120 119
121 spin_unlock_irqrestore(&priv->lock, flags); 120 spin_unlock_irqrestore(&priv->lock, flags);
@@ -251,6 +250,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
251 .port_num = priv->port, 250 .port_num = priv->port,
252 .sl = mcast->mcmember.sl, 251 .sl = mcast->mcmember.sl,
253 .ah_flags = IB_AH_GRH, 252 .ah_flags = IB_AH_GRH,
253 .static_rate = mcast->mcmember.rate,
254 .grh = { 254 .grh = {
255 .flow_label = be32_to_cpu(mcast->mcmember.flow_label), 255 .flow_label = be32_to_cpu(mcast->mcmember.flow_label),
256 .hop_limit = mcast->mcmember.hop_limit, 256 .hop_limit = mcast->mcmember.hop_limit,
@@ -258,17 +258,8 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
258 .traffic_class = mcast->mcmember.traffic_class 258 .traffic_class = mcast->mcmember.traffic_class
259 } 259 }
260 }; 260 };
261 int path_rate = ib_sa_rate_enum_to_int(mcast->mcmember.rate);
262
263 av.grh.dgid = mcast->mcmember.mgid; 261 av.grh.dgid = mcast->mcmember.mgid;
264 262
265 if (path_rate > 0 && priv->local_rate > path_rate)
266 av.static_rate = (priv->local_rate - 1) / path_rate;
267
268 ipoib_dbg_mcast(priv, "static_rate %d for local port %dX, mcmember %dX\n",
269 av.static_rate, priv->local_rate,
270 ib_sa_rate_enum_to_int(mcast->mcmember.rate));
271
272 ah = ipoib_create_ah(dev, priv->pd, &av); 263 ah = ipoib_create_ah(dev, priv->pd, &av);
273 if (!ah) { 264 if (!ah) {
274 ipoib_warn(priv, "ib_address_create failed\n"); 265 ipoib_warn(priv, "ib_address_create failed\n");
@@ -618,6 +609,22 @@ int ipoib_mcast_start_thread(struct net_device *dev)
618 return 0; 609 return 0;
619} 610}
620 611
612static void wait_for_mcast_join(struct ipoib_dev_priv *priv,
613 struct ipoib_mcast *mcast)
614{
615 spin_lock_irq(&priv->lock);
616 if (mcast && mcast->query) {
617 ib_sa_cancel_query(mcast->query_id, mcast->query);
618 mcast->query = NULL;
619 spin_unlock_irq(&priv->lock);
620 ipoib_dbg_mcast(priv, "waiting for MGID " IPOIB_GID_FMT "\n",
621 IPOIB_GID_ARG(mcast->mcmember.mgid));
622 wait_for_completion(&mcast->done);
623 }
624 else
625 spin_unlock_irq(&priv->lock);
626}
627
621int ipoib_mcast_stop_thread(struct net_device *dev, int flush) 628int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
622{ 629{
623 struct ipoib_dev_priv *priv = netdev_priv(dev); 630 struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -637,28 +644,10 @@ int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
637 if (flush) 644 if (flush)
638 flush_workqueue(ipoib_workqueue); 645 flush_workqueue(ipoib_workqueue);
639 646
640 spin_lock_irq(&priv->lock); 647 wait_for_mcast_join(priv, priv->broadcast);
641 if (priv->broadcast && priv->broadcast->query) {
642 ib_sa_cancel_query(priv->broadcast->query_id, priv->broadcast->query);
643 priv->broadcast->query = NULL;
644 spin_unlock_irq(&priv->lock);
645 ipoib_dbg_mcast(priv, "waiting for bcast\n");
646 wait_for_completion(&priv->broadcast->done);
647 } else
648 spin_unlock_irq(&priv->lock);
649 648
650 list_for_each_entry(mcast, &priv->multicast_list, list) { 649 list_for_each_entry(mcast, &priv->multicast_list, list)
651 spin_lock_irq(&priv->lock); 650 wait_for_mcast_join(priv, mcast);
652 if (mcast->query) {
653 ib_sa_cancel_query(mcast->query_id, mcast->query);
654 mcast->query = NULL;
655 spin_unlock_irq(&priv->lock);
656 ipoib_dbg_mcast(priv, "waiting for MGID " IPOIB_GID_FMT "\n",
657 IPOIB_GID_ARG(mcast->mcmember.mgid));
658 wait_for_completion(&mcast->done);
659 } else
660 spin_unlock_irq(&priv->lock);
661 }
662 651
663 return 0; 652 return 0;
664} 653}
@@ -772,13 +761,11 @@ out:
772 if (skb->dst && 761 if (skb->dst &&
773 skb->dst->neighbour && 762 skb->dst->neighbour &&
774 !*to_ipoib_neigh(skb->dst->neighbour)) { 763 !*to_ipoib_neigh(skb->dst->neighbour)) {
775 struct ipoib_neigh *neigh = kmalloc(sizeof *neigh, GFP_ATOMIC); 764 struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb->dst->neighbour);
776 765
777 if (neigh) { 766 if (neigh) {
778 kref_get(&mcast->ah->ref); 767 kref_get(&mcast->ah->ref);
779 neigh->ah = mcast->ah; 768 neigh->ah = mcast->ah;
780 neigh->neighbour = skb->dst->neighbour;
781 *to_ipoib_neigh(skb->dst->neighbour) = neigh;
782 list_add_tail(&neigh->list, &mcast->neigh_list); 769 list_add_tail(&neigh->list, &mcast->neigh_list);
783 } 770 }
784 } 771 }
@@ -913,6 +900,7 @@ void ipoib_mcast_restart_task(void *dev_ptr)
913 900
914 /* We have to cancel outside of the spinlock */ 901 /* We have to cancel outside of the spinlock */
915 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) { 902 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
903 wait_for_mcast_join(priv, mcast);
916 ipoib_mcast_leave(mcast->dev, mcast); 904 ipoib_mcast_leave(mcast->dev, mcast);
917 ipoib_mcast_free(mcast); 905 ipoib_mcast_free(mcast);
918 } 906 }
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 5f0388027b25..1d49d1643c59 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -159,8 +159,8 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
159 struct ipoib_dev_priv *priv = netdev_priv(dev); 159 struct ipoib_dev_priv *priv = netdev_priv(dev);
160 struct ib_qp_init_attr init_attr = { 160 struct ib_qp_init_attr init_attr = {
161 .cap = { 161 .cap = {
162 .max_send_wr = IPOIB_TX_RING_SIZE, 162 .max_send_wr = ipoib_sendq_size,
163 .max_recv_wr = IPOIB_RX_RING_SIZE, 163 .max_recv_wr = ipoib_recvq_size,
164 .max_send_sge = 1, 164 .max_send_sge = 1,
165 .max_recv_sge = 1 165 .max_recv_sge = 1
166 }, 166 },
@@ -175,7 +175,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
175 } 175 }
176 176
177 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, 177 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev,
178 IPOIB_TX_RING_SIZE + IPOIB_RX_RING_SIZE + 1); 178 ipoib_sendq_size + ipoib_recvq_size + 1);
179 if (IS_ERR(priv->cq)) { 179 if (IS_ERR(priv->cq)) {
180 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name); 180 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name);
181 goto out_free_pd; 181 goto out_free_pd;
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index fd8a95a9c5d3..5bb55742ada6 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -617,6 +617,14 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
617 scmnd->sc_data_direction); 617 scmnd->sc_data_direction);
618} 618}
619 619
620static void srp_remove_req(struct srp_target_port *target, struct srp_request *req,
621 int index)
622{
623 list_del(&req->list);
624 req->next = target->req_head;
625 target->req_head = index;
626}
627
620static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) 628static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
621{ 629{
622 struct srp_request *req; 630 struct srp_request *req;
@@ -664,9 +672,7 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
664 scmnd->host_scribble = (void *) -1L; 672 scmnd->host_scribble = (void *) -1L;
665 scmnd->scsi_done(scmnd); 673 scmnd->scsi_done(scmnd);
666 674
667 list_del(&req->list); 675 srp_remove_req(target, req, rsp->tag & ~SRP_TAG_TSK_MGMT);
668 req->next = target->req_head;
669 target->req_head = rsp->tag & ~SRP_TAG_TSK_MGMT;
670 } else 676 } else
671 req->cmd_done = 1; 677 req->cmd_done = 1;
672 } 678 }
@@ -1188,12 +1194,10 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func)
1188 spin_lock_irq(target->scsi_host->host_lock); 1194 spin_lock_irq(target->scsi_host->host_lock);
1189 1195
1190 if (req->cmd_done) { 1196 if (req->cmd_done) {
1191 list_del(&req->list); 1197 srp_remove_req(target, req, req_index);
1192 req->next = target->req_head;
1193 target->req_head = req_index;
1194
1195 scmnd->scsi_done(scmnd); 1198 scmnd->scsi_done(scmnd);
1196 } else if (!req->tsk_status) { 1199 } else if (!req->tsk_status) {
1200 srp_remove_req(target, req, req_index);
1197 scmnd->result = DID_ABORT << 16; 1201 scmnd->result = DID_ABORT << 16;
1198 ret = SUCCESS; 1202 ret = SUCCESS;
1199 } 1203 }
@@ -1434,6 +1438,7 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1434 p = match_strdup(args); 1438 p = match_strdup(args);
1435 if (strlen(p) != 32) { 1439 if (strlen(p) != 32) {
1436 printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p); 1440 printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p);
1441 kfree(p);
1437 goto out; 1442 goto out;
1438 } 1443 }
1439 1444
diff --git a/drivers/isdn/gigaset/Kconfig b/drivers/isdn/gigaset/Kconfig
index 53c4fb62ed85..5b203fe21dcd 100644
--- a/drivers/isdn/gigaset/Kconfig
+++ b/drivers/isdn/gigaset/Kconfig
@@ -3,8 +3,8 @@ menu "Siemens Gigaset"
3 3
4config ISDN_DRV_GIGASET 4config ISDN_DRV_GIGASET
5 tristate "Siemens Gigaset support (isdn)" 5 tristate "Siemens Gigaset support (isdn)"
6 depends on ISDN_I4L && m 6 depends on ISDN_I4L
7# depends on ISDN_I4L && MODULES 7 select CRC_CCITT
8 help 8 help
9 Say m here if you have a Gigaset or Sinus isdn device. 9 Say m here if you have a Gigaset or Sinus isdn device.
10 10
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index 171f8b703d61..ce3cd77094b3 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (c) 2005 by Tilman Schmidt <tilman@imap.cc>, 4 * Copyright (c) 2005 by Tilman Schmidt <tilman@imap.cc>,
5 * Hansjoerg Lipp <hjlipp@web.de>, 5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Stefan Eilers <Eilers.Stefan@epost.de>. 6 * Stefan Eilers.
7 * 7 *
8 * ===================================================================== 8 * =====================================================================
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -11,10 +11,6 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: asyncdata.c,v 1.2.2.7 2005/11/13 23:05:18 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
@@ -45,7 +41,7 @@ static inline int muststuff(unsigned char c)
45 * number of processed bytes 41 * number of processed bytes
46 */ 42 */
47static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes, 43static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
48 struct inbuf_t *inbuf) 44 struct inbuf_t *inbuf)
49{ 45{
50 struct cardstate *cs = inbuf->cs; 46 struct cardstate *cs = inbuf->cs;
51 unsigned cbytes = cs->cbytes; 47 unsigned cbytes = cs->cbytes;
@@ -55,10 +51,11 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
55 for (;;) { 51 for (;;) {
56 cs->respdata[cbytes] = c; 52 cs->respdata[cbytes] = c;
57 if (c == 10 || c == 13) { 53 if (c == 10 || c == 13) {
58 dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)", 54 gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
59 __func__, cbytes); 55 __func__, cbytes);
60 cs->cbytes = cbytes; 56 cs->cbytes = cbytes;
61 gigaset_handle_modem_response(cs); /* can change cs->dle */ 57 gigaset_handle_modem_response(cs); /* can change
58 cs->dle */
62 cbytes = 0; 59 cbytes = 0;
63 60
64 if (cs->dle && 61 if (cs->dle &&
@@ -71,7 +68,7 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
71 if (cbytes < MAX_RESP_SIZE - 1) 68 if (cbytes < MAX_RESP_SIZE - 1)
72 cbytes++; 69 cbytes++;
73 else 70 else
74 warn("response too large"); 71 dev_warn(cs->dev, "response too large\n");
75 } 72 }
76 73
77 if (!numbytes) 74 if (!numbytes)
@@ -96,11 +93,12 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
96 * number of processed bytes 93 * number of processed bytes
97 */ 94 */
98static inline int lock_loop(unsigned char *src, int numbytes, 95static inline int lock_loop(unsigned char *src, int numbytes,
99 struct inbuf_t *inbuf) 96 struct inbuf_t *inbuf)
100{ 97{
101 struct cardstate *cs = inbuf->cs; 98 struct cardstate *cs = inbuf->cs;
102 99
103 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", numbytes, src, 0); 100 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
101 numbytes, src);
104 gigaset_if_receive(cs, src, numbytes); 102 gigaset_if_receive(cs, src, numbytes);
105 103
106 return numbytes; 104 return numbytes;
@@ -115,24 +113,18 @@ static inline int lock_loop(unsigned char *src, int numbytes,
115 * numbytes (all bytes processed) on error --FIXME 113 * numbytes (all bytes processed) on error --FIXME
116 */ 114 */
117static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes, 115static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
118 struct inbuf_t *inbuf) 116 struct inbuf_t *inbuf)
119{ 117{
120 struct cardstate *cs = inbuf->cs; 118 struct cardstate *cs = inbuf->cs;
121 struct bc_state *bcs = inbuf->bcs; 119 struct bc_state *bcs = inbuf->bcs;
122 int inputstate; 120 int inputstate = bcs->inputstate;
123 __u16 fcs; 121 __u16 fcs = bcs->fcs;
124 struct sk_buff *skb; 122 struct sk_buff *skb = bcs->skb;
125 unsigned char error; 123 unsigned char error;
126 struct sk_buff *compskb; 124 struct sk_buff *compskb;
127 int startbytes = numbytes; 125 int startbytes = numbytes;
128 int l; 126 int l;
129 127
130 IFNULLRETVAL(bcs, numbytes);
131 inputstate = bcs->inputstate;
132 fcs = bcs->fcs;
133 skb = bcs->skb;
134 IFNULLRETVAL(skb, numbytes);
135
136 if (unlikely(inputstate & INS_byte_stuff)) { 128 if (unlikely(inputstate & INS_byte_stuff)) {
137 inputstate &= ~INS_byte_stuff; 129 inputstate &= ~INS_byte_stuff;
138 goto byte_stuff; 130 goto byte_stuff;
@@ -156,39 +148,37 @@ byte_stuff:
156 c ^= PPP_TRANS; 148 c ^= PPP_TRANS;
157#ifdef CONFIG_GIGASET_DEBUG 149#ifdef CONFIG_GIGASET_DEBUG
158 if (unlikely(!muststuff(c))) 150 if (unlikely(!muststuff(c)))
159 dbg(DEBUG_HDLC, 151 gig_dbg(DEBUG_HDLC, "byte stuffed: 0x%02x", c);
160 "byte stuffed: 0x%02x", c);
161#endif 152#endif
162 } else if (unlikely(c == PPP_FLAG)) { 153 } else if (unlikely(c == PPP_FLAG)) {
163 if (unlikely(inputstate & INS_skip_frame)) { 154 if (unlikely(inputstate & INS_skip_frame)) {
164 if (!(inputstate & INS_have_data)) { /* 7E 7E */ 155 if (!(inputstate & INS_have_data)) { /* 7E 7E */
165 //dbg(DEBUG_HDLC, "(7e)7e------------------------");
166#ifdef CONFIG_GIGASET_DEBUG 156#ifdef CONFIG_GIGASET_DEBUG
167 ++bcs->emptycount; 157 ++bcs->emptycount;
168#endif 158#endif
169 } else 159 } else
170 dbg(DEBUG_HDLC, 160 gig_dbg(DEBUG_HDLC,
171 "7e----------------------------"); 161 "7e----------------------------");
172 162
173 /* end of frame */ 163 /* end of frame */
174 error = 1; 164 error = 1;
175 gigaset_rcv_error(NULL, cs, bcs); 165 gigaset_rcv_error(NULL, cs, bcs);
176 } else if (!(inputstate & INS_have_data)) { /* 7E 7E */ 166 } else if (!(inputstate & INS_have_data)) { /* 7E 7E */
177 //dbg(DEBUG_HDLC, "(7e)7e------------------------");
178#ifdef CONFIG_GIGASET_DEBUG 167#ifdef CONFIG_GIGASET_DEBUG
179 ++bcs->emptycount; 168 ++bcs->emptycount;
180#endif 169#endif
181 break; 170 break;
182 } else { 171 } else {
183 dbg(DEBUG_HDLC, 172 gig_dbg(DEBUG_HDLC,
184 "7e----------------------------"); 173 "7e----------------------------");
185 174
186 /* end of frame */ 175 /* end of frame */
187 error = 0; 176 error = 0;
188 177
189 if (unlikely(fcs != PPP_GOODFCS)) { 178 if (unlikely(fcs != PPP_GOODFCS)) {
190 err("Packet checksum at %lu failed, " 179 dev_err(cs->dev,
191 "packet is corrupted (%u bytes)!", 180 "Packet checksum at %lu failed, "
181 "packet is corrupted (%u bytes)!\n",
192 bcs->rcvbytes, skb->len); 182 bcs->rcvbytes, skb->len);
193 compskb = NULL; 183 compskb = NULL;
194 gigaset_rcv_error(compskb, cs, bcs); 184 gigaset_rcv_error(compskb, cs, bcs);
@@ -202,9 +192,11 @@ byte_stuff:
202 skb = NULL; 192 skb = NULL;
203 inputstate |= INS_skip_frame; 193 inputstate |= INS_skip_frame;
204 if (l == 1) { 194 if (l == 1) {
205 err("invalid packet size (1)!"); 195 dev_err(cs->dev,
196 "invalid packet size (1)!\n");
206 error = 1; 197 error = 1;
207 gigaset_rcv_error(NULL, cs, bcs); 198 gigaset_rcv_error(NULL,
199 cs, bcs);
208 } 200 }
209 } 201 }
210 if (likely(!(error || 202 if (likely(!(error ||
@@ -227,7 +219,8 @@ byte_stuff:
227 } else if (likely((skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)) { 219 } else if (likely((skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)) {
228 skb_reserve(skb, HW_HDR_LEN); 220 skb_reserve(skb, HW_HDR_LEN);
229 } else { 221 } else {
230 warn("could not allocate new skb"); 222 dev_warn(cs->dev,
223 "could not allocate new skb\n");
231 inputstate |= INS_skip_frame; 224 inputstate |= INS_skip_frame;
232 } 225 }
233 226
@@ -235,7 +228,7 @@ byte_stuff:
235#ifdef CONFIG_GIGASET_DEBUG 228#ifdef CONFIG_GIGASET_DEBUG
236 } else if (unlikely(muststuff(c))) { 229 } else if (unlikely(muststuff(c))) {
237 /* Should not happen. Possible after ZDLE=1<CR><LF>. */ 230 /* Should not happen. Possible after ZDLE=1<CR><LF>. */
238 dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c); 231 gig_dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
239#endif 232#endif
240 } 233 }
241 234
@@ -243,8 +236,8 @@ byte_stuff:
243 236
244#ifdef CONFIG_GIGASET_DEBUG 237#ifdef CONFIG_GIGASET_DEBUG
245 if (unlikely(!(inputstate & INS_have_data))) { 238 if (unlikely(!(inputstate & INS_have_data))) {
246 dbg(DEBUG_HDLC, 239 gig_dbg(DEBUG_HDLC, "7e (%d x) ================",
247 "7e (%d x) ================", bcs->emptycount); 240 bcs->emptycount);
248 bcs->emptycount = 0; 241 bcs->emptycount = 0;
249 } 242 }
250#endif 243#endif
@@ -253,14 +246,13 @@ byte_stuff:
253 246
254 if (likely(!(inputstate & INS_skip_frame))) { 247 if (likely(!(inputstate & INS_skip_frame))) {
255 if (unlikely(skb->len == SBUFSIZE)) { 248 if (unlikely(skb->len == SBUFSIZE)) {
256 warn("received packet too long"); 249 dev_warn(cs->dev, "received packet too long\n");
257 dev_kfree_skb_any(skb); 250 dev_kfree_skb_any(skb);
258 skb = NULL; 251 skb = NULL;
259 inputstate |= INS_skip_frame; 252 inputstate |= INS_skip_frame;
260 break; 253 break;
261 } 254 }
262 *gigaset_skb_put_quick(skb, 1) = c; 255 *__skb_put(skb, 1) = c;
263 /* *__skb_put (skb, 1) = c; */
264 fcs = crc_ccitt_byte(fcs, c); 256 fcs = crc_ccitt_byte(fcs, c);
265 } 257 }
266 258
@@ -289,19 +281,14 @@ byte_stuff:
289 * numbytes (all bytes processed) on error --FIXME 281 * numbytes (all bytes processed) on error --FIXME
290 */ 282 */
291static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes, 283static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
292 struct inbuf_t *inbuf) 284 struct inbuf_t *inbuf)
293{ 285{
294 struct cardstate *cs = inbuf->cs; 286 struct cardstate *cs = inbuf->cs;
295 struct bc_state *bcs = inbuf->bcs; 287 struct bc_state *bcs = inbuf->bcs;
296 int inputstate; 288 int inputstate = bcs->inputstate;
297 struct sk_buff *skb; 289 struct sk_buff *skb = bcs->skb;
298 int startbytes = numbytes; 290 int startbytes = numbytes;
299 291
300 IFNULLRETVAL(bcs, numbytes);
301 inputstate = bcs->inputstate;
302 skb = bcs->skb;
303 IFNULLRETVAL(skb, numbytes);
304
305 for (;;) { 292 for (;;) {
306 /* add character */ 293 /* add character */
307 inputstate |= INS_have_data; 294 inputstate |= INS_have_data;
@@ -309,13 +296,13 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
309 if (likely(!(inputstate & INS_skip_frame))) { 296 if (likely(!(inputstate & INS_skip_frame))) {
310 if (unlikely(skb->len == SBUFSIZE)) { 297 if (unlikely(skb->len == SBUFSIZE)) {
311 //FIXME just pass skb up and allocate a new one 298 //FIXME just pass skb up and allocate a new one
312 warn("received packet too long"); 299 dev_warn(cs->dev, "received packet too long\n");
313 dev_kfree_skb_any(skb); 300 dev_kfree_skb_any(skb);
314 skb = NULL; 301 skb = NULL;
315 inputstate |= INS_skip_frame; 302 inputstate |= INS_skip_frame;
316 break; 303 break;
317 } 304 }
318 *gigaset_skb_put_quick(skb, 1) = gigaset_invtab[c]; 305 *__skb_put(skb, 1) = gigaset_invtab[c];
319 } 306 }
320 307
321 if (unlikely(!numbytes)) 308 if (unlikely(!numbytes))
@@ -343,7 +330,7 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
343 != NULL)) { 330 != NULL)) {
344 skb_reserve(skb, HW_HDR_LEN); 331 skb_reserve(skb, HW_HDR_LEN);
345 } else { 332 } else {
346 warn("could not allocate new skb"); 333 dev_warn(cs->dev, "could not allocate new skb\n");
347 inputstate |= INS_skip_frame; 334 inputstate |= INS_skip_frame;
348 } 335 }
349 } 336 }
@@ -364,13 +351,13 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
364 351
365 head = atomic_read(&inbuf->head); 352 head = atomic_read(&inbuf->head);
366 tail = atomic_read(&inbuf->tail); 353 tail = atomic_read(&inbuf->tail);
367 dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); 354 gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
368 355
369 if (head != tail) { 356 if (head != tail) {
370 cs = inbuf->cs; 357 cs = inbuf->cs;
371 src = inbuf->data + head; 358 src = inbuf->data + head;
372 numbytes = (head > tail ? RBUFSIZE : tail) - head; 359 numbytes = (head > tail ? RBUFSIZE : tail) - head;
373 dbg(DEBUG_INTR, "processing %u bytes", numbytes); 360 gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
374 361
375 while (numbytes) { 362 while (numbytes) {
376 if (atomic_read(&cs->mstate) == MS_LOCKED) { 363 if (atomic_read(&cs->mstate) == MS_LOCKED) {
@@ -392,8 +379,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
392 379
393 if (!(inbuf->inputstate & INS_DLE_char)) { 380 if (!(inbuf->inputstate & INS_DLE_char)) {
394 381
395 /* FIXME Einfach je nach Modus Funktionszeiger in cs setzen [hier+hdlc_loop]? */ 382 /* FIXME use function pointers? */
396 /* FIXME Spart folgendes "if" und ermoeglicht andere Protokolle */
397 if (inbuf->inputstate & INS_command) 383 if (inbuf->inputstate & INS_command)
398 procbytes = cmd_loop(c, src, numbytes, inbuf); 384 procbytes = cmd_loop(c, src, numbytes, inbuf);
399 else if (inbuf->bcs->proto2 == ISDN_PROTO_L2_HDLC) 385 else if (inbuf->bcs->proto2 == ISDN_PROTO_L2_HDLC)
@@ -403,13 +389,14 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
403 389
404 src += procbytes; 390 src += procbytes;
405 numbytes -= procbytes; 391 numbytes -= procbytes;
406 } else { /* DLE-char */ 392 } else { /* DLE char */
407 inbuf->inputstate &= ~INS_DLE_char; 393 inbuf->inputstate &= ~INS_DLE_char;
408 switch (c) { 394 switch (c) {
409 case 'X': /*begin of command*/ 395 case 'X': /*begin of command*/
410#ifdef CONFIG_GIGASET_DEBUG 396#ifdef CONFIG_GIGASET_DEBUG
411 if (inbuf->inputstate & INS_command) 397 if (inbuf->inputstate & INS_command)
412 err("received <DLE> 'X' in command mode"); 398 dev_err(cs->dev,
399 "received <DLE> 'X' in command mode\n");
413#endif 400#endif
414 inbuf->inputstate |= 401 inbuf->inputstate |=
415 INS_command | INS_DLE_command; 402 INS_command | INS_DLE_command;
@@ -417,7 +404,8 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
417 case '.': /*end of command*/ 404 case '.': /*end of command*/
418#ifdef CONFIG_GIGASET_DEBUG 405#ifdef CONFIG_GIGASET_DEBUG
419 if (!(inbuf->inputstate & INS_command)) 406 if (!(inbuf->inputstate & INS_command))
420 err("received <DLE> '.' in hdlc mode"); 407 dev_err(cs->dev,
408 "received <DLE> '.' in hdlc mode\n");
421#endif 409#endif
422 inbuf->inputstate &= cs->dle ? 410 inbuf->inputstate &= cs->dle ?
423 ~(INS_DLE_command|INS_command) 411 ~(INS_DLE_command|INS_command)
@@ -425,7 +413,9 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
425 break; 413 break;
426 //case DLE_FLAG: /*DLE_FLAG in data stream*/ /* schon oben behandelt! */ 414 //case DLE_FLAG: /*DLE_FLAG in data stream*/ /* schon oben behandelt! */
427 default: 415 default:
428 err("received 0x10 0x%02x!", (int) c); 416 dev_err(cs->dev,
417 "received 0x10 0x%02x!\n",
418 (int) c);
429 /* FIXME: reset driver?? */ 419 /* FIXME: reset driver?? */
430 } 420 }
431 } 421 }
@@ -444,7 +434,7 @@ nextbyte:
444 } 434 }
445 } 435 }
446 436
447 dbg(DEBUG_INTR, "setting head to %u", head); 437 gig_dbg(DEBUG_INTR, "setting head to %u", head);
448 atomic_set(&inbuf->head, head); 438 atomic_set(&inbuf->head, head);
449 } 439 }
450} 440}
@@ -479,14 +469,13 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb, int head, int tail)
479 stuf_cnt++; 469 stuf_cnt++;
480 fcs = crc_ccitt_byte(fcs, *cp++); 470 fcs = crc_ccitt_byte(fcs, *cp++);
481 } 471 }
482 fcs ^= 0xffff; /* complement */ 472 fcs ^= 0xffff; /* complement */
483 473
484 /* size of new buffer: original size + number of stuffing bytes 474 /* size of new buffer: original size + number of stuffing bytes
485 * + 2 bytes FCS + 2 stuffing bytes for FCS (if needed) + 2 flag bytes 475 * + 2 bytes FCS + 2 stuffing bytes for FCS (if needed) + 2 flag bytes
486 */ 476 */
487 hdlc_skb = dev_alloc_skb(skb->len + stuf_cnt + 6 + tail + head); 477 hdlc_skb = dev_alloc_skb(skb->len + stuf_cnt + 6 + tail + head);
488 if (!hdlc_skb) { 478 if (!hdlc_skb) {
489 err("unable to allocate memory for HDLC encoding!");
490 dev_kfree_skb(skb); 479 dev_kfree_skb(skb);
491 return NULL; 480 return NULL;
492 } 481 }
@@ -508,7 +497,7 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb, int head, int tail)
508 } 497 }
509 498
510 /* Finally add FCS (byte stuffed) and flag sequence */ 499 /* Finally add FCS (byte stuffed) and flag sequence */
511 c = (fcs & 0x00ff); /* least significant byte first */ 500 c = (fcs & 0x00ff); /* least significant byte first */
512 if (muststuff(c)) { 501 if (muststuff(c)) {
513 *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; 502 *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE;
514 c ^= PPP_TRANS; 503 c ^= PPP_TRANS;
@@ -546,7 +535,6 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
546 /* worst case: every byte must be stuffed */ 535 /* worst case: every byte must be stuffed */
547 iraw_skb = dev_alloc_skb(2*skb->len + tail + head); 536 iraw_skb = dev_alloc_skb(2*skb->len + tail + head);
548 if (!iraw_skb) { 537 if (!iraw_skb) {
549 err("unable to allocate memory for HDLC encoding!");
550 dev_kfree_skb(skb); 538 dev_kfree_skb(skb);
551 return NULL; 539 return NULL;
552 } 540 }
@@ -577,21 +565,23 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
577 */ 565 */
578int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) 566int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
579{ 567{
580 unsigned len; 568 unsigned len = skb->len;
581 569 unsigned long flags;
582 IFNULLRETVAL(bcs, -EFAULT);
583 IFNULLRETVAL(skb, -EFAULT);
584 len = skb->len;
585 570
586 if (bcs->proto2 == ISDN_PROTO_L2_HDLC) 571 if (bcs->proto2 == ISDN_PROTO_L2_HDLC)
587 skb = HDLC_Encode(skb, HW_HDR_LEN, 0); 572 skb = HDLC_Encode(skb, HW_HDR_LEN, 0);
588 else 573 else
589 skb = iraw_encode(skb, HW_HDR_LEN, 0); 574 skb = iraw_encode(skb, HW_HDR_LEN, 0);
590 if (!skb) 575 if (!skb) {
576 err("unable to allocate memory for encoding!\n");
591 return -ENOMEM; 577 return -ENOMEM;
578 }
592 579
593 skb_queue_tail(&bcs->squeue, skb); 580 skb_queue_tail(&bcs->squeue, skb);
594 tasklet_schedule(&bcs->cs->write_tasklet); 581 spin_lock_irqsave(&bcs->cs->lock, flags);
582 if (bcs->cs->connected)
583 tasklet_schedule(&bcs->cs->write_tasklet);
584 spin_unlock_irqrestore(&bcs->cs->lock, flags);
595 585
596 return len; /* ok so far */ 586 return len; /* ok so far */
597} 587}
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 31f0f07832bc..f86ed6af3aa2 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (c) 2001 by Hansjoerg Lipp <hjlipp@web.de>, 4 * Copyright (c) 2001 by Hansjoerg Lipp <hjlipp@web.de>,
5 * Tilman Schmidt <tilman@imap.cc>, 5 * Tilman Schmidt <tilman@imap.cc>,
6 * Stefan Eilers <Eilers.Stefan@epost.de>. 6 * Stefan Eilers.
7 * 7 *
8 * Based on usb-gigaset.c. 8 * Based on usb-gigaset.c.
9 * 9 *
@@ -13,10 +13,6 @@
13 * published by the Free Software Foundation; either version 2 of 13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version. 14 * the License, or (at your option) any later version.
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: ...
17 * =====================================================================
18 * Version: $Id: bas-gigaset.c,v 1.52.4.19 2006/02/04 18:28:16 hjlipp Exp $
19 * =====================================================================
20 */ 16 */
21 17
22#include "gigaset.h" 18#include "gigaset.h"
@@ -30,7 +26,7 @@
30#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
31 27
32/* Version Information */ 28/* Version Information */
33#define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers <Eilers.Stefan@epost.de>" 29#define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers"
34#define DRIVER_DESC "USB Driver for Gigaset 307x" 30#define DRIVER_DESC "USB Driver for Gigaset 307x"
35 31
36 32
@@ -70,9 +66,6 @@ static struct usb_device_id gigaset_table [] = {
70 66
71MODULE_DEVICE_TABLE(usb, gigaset_table); 67MODULE_DEVICE_TABLE(usb, gigaset_table);
72 68
73/* Get a minor range for your devices from the usb maintainer */
74#define USB_SKEL_MINOR_BASE 200
75
76/*======================= local function prototypes =============================*/ 69/*======================= local function prototypes =============================*/
77 70
78/* This function is called if a new device is connected to the USB port. It 71/* This function is called if a new device is connected to the USB port. It
@@ -88,25 +81,25 @@ static void gigaset_disconnect(struct usb_interface *interface);
88/*==============================================================================*/ 81/*==============================================================================*/
89 82
90struct bas_cardstate { 83struct bas_cardstate {
91 struct usb_device *udev; /* USB device pointer */ 84 struct usb_device *udev; /* USB device pointer */
92 struct usb_interface *interface; /* interface for this device */ 85 struct usb_interface *interface; /* interface for this device */
93 unsigned char minor; /* starting minor number */ 86 unsigned char minor; /* starting minor number */
94 87
95 struct urb *urb_ctrl; /* control pipe default URB */ 88 struct urb *urb_ctrl; /* control pipe default URB */
96 struct usb_ctrlrequest dr_ctrl; 89 struct usb_ctrlrequest dr_ctrl;
97 struct timer_list timer_ctrl; /* control request timeout */ 90 struct timer_list timer_ctrl; /* control request timeout */
98 91
99 struct timer_list timer_atrdy; /* AT command ready timeout */ 92 struct timer_list timer_atrdy; /* AT command ready timeout */
100 struct urb *urb_cmd_out; /* for sending AT commands */ 93 struct urb *urb_cmd_out; /* for sending AT commands */
101 struct usb_ctrlrequest dr_cmd_out; 94 struct usb_ctrlrequest dr_cmd_out;
102 int retry_cmd_out; 95 int retry_cmd_out;
103 96
104 struct urb *urb_cmd_in; /* for receiving AT replies */ 97 struct urb *urb_cmd_in; /* for receiving AT replies */
105 struct usb_ctrlrequest dr_cmd_in; 98 struct usb_ctrlrequest dr_cmd_in;
106 struct timer_list timer_cmd_in; /* receive request timeout */ 99 struct timer_list timer_cmd_in; /* receive request timeout */
107 unsigned char *rcvbuf; /* AT reply receive buffer */ 100 unsigned char *rcvbuf; /* AT reply receive buffer */
108 101
109 struct urb *urb_int_in; /* URB for interrupt pipe */ 102 struct urb *urb_int_in; /* URB for interrupt pipe */
110 unsigned char int_in_buf[3]; 103 unsigned char int_in_buf[3];
111 104
112 spinlock_t lock; /* locks all following */ 105 spinlock_t lock; /* locks all following */
@@ -208,53 +201,54 @@ static inline char *usb_pipetype_str(int pipe)
208 * write content of URB to syslog for debugging 201 * write content of URB to syslog for debugging
209 */ 202 */
210static inline void dump_urb(enum debuglevel level, const char *tag, 203static inline void dump_urb(enum debuglevel level, const char *tag,
211 struct urb *urb) 204 struct urb *urb)
212{ 205{
213#ifdef CONFIG_GIGASET_DEBUG 206#ifdef CONFIG_GIGASET_DEBUG
214 int i; 207 int i;
215 IFNULLRET(tag); 208 gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb);
216 dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb);
217 if (urb) { 209 if (urb) {
218 dbg(level, 210 gig_dbg(level,
219 " dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, " 211 " dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, "
220 "status=%d, hcpriv=0x%08lx, transfer_flags=0x%x,", 212 "status=%d, hcpriv=0x%08lx, transfer_flags=0x%x,",
221 (unsigned long) urb->dev, 213 (unsigned long) urb->dev,
222 usb_pipetype_str(urb->pipe), 214 usb_pipetype_str(urb->pipe),
223 usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe), 215 usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe),
224 usb_pipein(urb->pipe) ? "in" : "out", 216 usb_pipein(urb->pipe) ? "in" : "out",
225 urb->status, (unsigned long) urb->hcpriv, 217 urb->status, (unsigned long) urb->hcpriv,
226 urb->transfer_flags); 218 urb->transfer_flags);
227 dbg(level, 219 gig_dbg(level,
228 " transfer_buffer=0x%08lx[%d], actual_length=%d, " 220 " transfer_buffer=0x%08lx[%d], actual_length=%d, "
229 "bandwidth=%d, setup_packet=0x%08lx,", 221 "bandwidth=%d, setup_packet=0x%08lx,",
230 (unsigned long) urb->transfer_buffer, 222 (unsigned long) urb->transfer_buffer,
231 urb->transfer_buffer_length, urb->actual_length, 223 urb->transfer_buffer_length, urb->actual_length,
232 urb->bandwidth, (unsigned long) urb->setup_packet); 224 urb->bandwidth, (unsigned long) urb->setup_packet);
233 dbg(level, 225 gig_dbg(level,
234 " start_frame=%d, number_of_packets=%d, interval=%d, " 226 " start_frame=%d, number_of_packets=%d, interval=%d, "
235 "error_count=%d,", 227 "error_count=%d,",
236 urb->start_frame, urb->number_of_packets, urb->interval, 228 urb->start_frame, urb->number_of_packets, urb->interval,
237 urb->error_count); 229 urb->error_count);
238 dbg(level, 230 gig_dbg(level,
239 " context=0x%08lx, complete=0x%08lx, iso_frame_desc[]={", 231 " context=0x%08lx, complete=0x%08lx, "
240 (unsigned long) urb->context, 232 "iso_frame_desc[]={",
241 (unsigned long) urb->complete); 233 (unsigned long) urb->context,
234 (unsigned long) urb->complete);
242 for (i = 0; i < urb->number_of_packets; i++) { 235 for (i = 0; i < urb->number_of_packets; i++) {
243 struct usb_iso_packet_descriptor *pifd = &urb->iso_frame_desc[i]; 236 struct usb_iso_packet_descriptor *pifd
244 dbg(level, 237 = &urb->iso_frame_desc[i];
245 " {offset=%u, length=%u, actual_length=%u, " 238 gig_dbg(level,
246 "status=%u}", 239 " {offset=%u, length=%u, actual_length=%u, "
247 pifd->offset, pifd->length, pifd->actual_length, 240 "status=%u}",
248 pifd->status); 241 pifd->offset, pifd->length, pifd->actual_length,
242 pifd->status);
249 } 243 }
250 } 244 }
251 dbg(level, "}}"); 245 gig_dbg(level, "}}");
252#endif 246#endif
253} 247}
254 248
255/* read/set modem control bits etc. (m10x only) */ 249/* read/set modem control bits etc. (m10x only) */
256static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, 250static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
257 unsigned new_state) 251 unsigned new_state)
258{ 252{
259 return -EINVAL; 253 return -EINVAL;
260} 254}
@@ -280,8 +274,8 @@ static inline void error_hangup(struct bc_state *bcs)
280{ 274{
281 struct cardstate *cs = bcs->cs; 275 struct cardstate *cs = bcs->cs;
282 276
283 dbg(DEBUG_ANY, 277 gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d",
284 "%s: scheduling HUP for channel %d", __func__, bcs->channel); 278 __func__, bcs->channel);
285 279
286 if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { 280 if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) {
287 //FIXME what should we do? 281 //FIXME what should we do?
@@ -301,22 +295,19 @@ static inline void error_hangup(struct bc_state *bcs)
301static inline void error_reset(struct cardstate *cs) 295static inline void error_reset(struct cardstate *cs)
302{ 296{
303 //FIXME try to recover without bothering the user 297 //FIXME try to recover without bothering the user
304 err("unrecoverable error - please disconnect the Gigaset base to reset"); 298 dev_err(cs->dev,
299 "unrecoverable error - please disconnect Gigaset base to reset\n");
305} 300}
306 301
307/* check_pending 302/* check_pending
308 * check for completion of pending control request 303 * check for completion of pending control request
309 * parameter: 304 * parameter:
310 * urb USB request block of completed request 305 * ucs hardware specific controller state structure
311 * urb->context = hardware specific controller state structure
312 */ 306 */
313static void check_pending(struct bas_cardstate *ucs) 307static void check_pending(struct bas_cardstate *ucs)
314{ 308{
315 unsigned long flags; 309 unsigned long flags;
316 310
317 IFNULLRET(ucs);
318 IFNULLRET(cardstate);
319
320 spin_lock_irqsave(&ucs->lock, flags); 311 spin_lock_irqsave(&ucs->lock, flags);
321 switch (ucs->pending) { 312 switch (ucs->pending) {
322 case 0: 313 case 0:
@@ -336,8 +327,6 @@ static void check_pending(struct bas_cardstate *ucs)
336 case HD_CLOSE_ATCHANNEL: 327 case HD_CLOSE_ATCHANNEL:
337 if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) 328 if (!(atomic_read(&ucs->basstate) & BS_ATOPEN))
338 ucs->pending = 0; 329 ucs->pending = 0;
339 //wake_up_interruptible(cs->initwait);
340 //FIXME need own wait queue?
341 break; 330 break;
342 case HD_CLOSE_B1CHANNEL: 331 case HD_CLOSE_B1CHANNEL:
343 if (!(atomic_read(&ucs->basstate) & BS_B1OPEN)) 332 if (!(atomic_read(&ucs->basstate) & BS_B1OPEN))
@@ -354,7 +343,9 @@ static void check_pending(struct bas_cardstate *ucs)
354 * are handled separately and should never end up here 343 * are handled separately and should never end up here
355 */ 344 */
356 default: 345 default:
357 warn("unknown pending request 0x%02x cleared", ucs->pending); 346 dev_warn(&ucs->interface->dev,
347 "unknown pending request 0x%02x cleared\n",
348 ucs->pending);
358 ucs->pending = 0; 349 ucs->pending = 0;
359 } 350 }
360 351
@@ -372,27 +363,23 @@ static void check_pending(struct bas_cardstate *ucs)
372static void cmd_in_timeout(unsigned long data) 363static void cmd_in_timeout(unsigned long data)
373{ 364{
374 struct cardstate *cs = (struct cardstate *) data; 365 struct cardstate *cs = (struct cardstate *) data;
375 struct bas_cardstate *ucs; 366 struct bas_cardstate *ucs = cs->hw.bas;
376 unsigned long flags; 367 unsigned long flags;
377 368
378 IFNULLRET(cs);
379 ucs = cs->hw.bas;
380 IFNULLRET(ucs);
381
382 spin_lock_irqsave(&cs->lock, flags); 369 spin_lock_irqsave(&cs->lock, flags);
383 if (!atomic_read(&cs->connected)) { 370 if (unlikely(!cs->connected)) {
384 dbg(DEBUG_USBREQ, "%s: disconnected", __func__); 371 gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__);
385 spin_unlock_irqrestore(&cs->lock, flags); 372 spin_unlock_irqrestore(&cs->lock, flags);
386 return; 373 return;
387 } 374 }
388 if (!ucs->rcvbuf_size) { 375 if (!ucs->rcvbuf_size) {
389 dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); 376 gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__);
390 spin_unlock_irqrestore(&cs->lock, flags); 377 spin_unlock_irqrestore(&cs->lock, flags);
391 return; 378 return;
392 } 379 }
393 spin_unlock_irqrestore(&cs->lock, flags); 380 spin_unlock_irqrestore(&cs->lock, flags);
394 381
395 err("timeout reading AT response"); 382 dev_err(cs->dev, "timeout reading AT response\n");
396 error_reset(cs); //FIXME retry? 383 error_reset(cs); //FIXME retry?
397} 384}
398 385
@@ -412,18 +399,15 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs);
412 */ 399 */
413static int atread_submit(struct cardstate *cs, int timeout) 400static int atread_submit(struct cardstate *cs, int timeout)
414{ 401{
415 struct bas_cardstate *ucs; 402 struct bas_cardstate *ucs = cs->hw.bas;
416 int ret; 403 int ret;
417 404
418 IFNULLRETVAL(cs, -EINVAL); 405 gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)",
419 ucs = cs->hw.bas; 406 ucs->rcvbuf_size);
420 IFNULLRETVAL(ucs, -EINVAL);
421 IFNULLRETVAL(ucs->urb_cmd_in, -EINVAL);
422
423 dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", ucs->rcvbuf_size);
424 407
425 if (ucs->urb_cmd_in->status == -EINPROGRESS) { 408 if (ucs->urb_cmd_in->status == -EINPROGRESS) {
426 err("could not submit HD_READ_ATMESSAGE: URB busy"); 409 dev_err(cs->dev,
410 "could not submit HD_READ_ATMESSAGE: URB busy\n");
427 return -EBUSY; 411 return -EBUSY;
428 } 412 }
429 413
@@ -433,19 +417,19 @@ static int atread_submit(struct cardstate *cs, int timeout)
433 ucs->dr_cmd_in.wIndex = 0; 417 ucs->dr_cmd_in.wIndex = 0;
434 ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size); 418 ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size);
435 usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev, 419 usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev,
436 usb_rcvctrlpipe(ucs->udev, 0), 420 usb_rcvctrlpipe(ucs->udev, 0),
437 (unsigned char*) & ucs->dr_cmd_in, 421 (unsigned char*) & ucs->dr_cmd_in,
438 ucs->rcvbuf, ucs->rcvbuf_size, 422 ucs->rcvbuf, ucs->rcvbuf_size,
439 read_ctrl_callback, cs->inbuf); 423 read_ctrl_callback, cs->inbuf);
440 424
441 if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { 425 if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) {
442 err("could not submit HD_READ_ATMESSAGE: %s", 426 dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n",
443 get_usb_statmsg(ret)); 427 get_usb_statmsg(ret));
444 return ret; 428 return ret;
445 } 429 }
446 430
447 if (timeout > 0) { 431 if (timeout > 0) {
448 dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 432 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
449 ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10; 433 ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10;
450 ucs->timer_cmd_in.data = (unsigned long) cs; 434 ucs->timer_cmd_in.data = (unsigned long) cs;
451 ucs->timer_cmd_in.function = cmd_in_timeout; 435 ucs->timer_cmd_in.function = cmd_in_timeout;
@@ -483,25 +467,14 @@ inline static void update_basstate(struct bas_cardstate *ucs,
483 */ 467 */
484static void read_int_callback(struct urb *urb, struct pt_regs *regs) 468static void read_int_callback(struct urb *urb, struct pt_regs *regs)
485{ 469{
486 struct cardstate *cs; 470 struct cardstate *cs = urb->context;
487 struct bas_cardstate *ucs; 471 struct bas_cardstate *ucs = cs->hw.bas;
488 struct bc_state *bcs; 472 struct bc_state *bcs;
489 unsigned long flags; 473 unsigned long flags;
490 int status; 474 int status;
491 unsigned l; 475 unsigned l;
492 int channel; 476 int channel;
493 477
494 IFNULLRET(urb);
495 cs = (struct cardstate *) urb->context;
496 IFNULLRET(cs);
497 ucs = cs->hw.bas;
498 IFNULLRET(ucs);
499
500 if (unlikely(!atomic_read(&cs->connected))) {
501 warn("%s: disconnected", __func__);
502 return;
503 }
504
505 switch (urb->status) { 478 switch (urb->status) {
506 case 0: /* success */ 479 case 0: /* success */
507 break; 480 break;
@@ -509,11 +482,12 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs)
509 case -ECONNRESET: /* canceled (async) */ 482 case -ECONNRESET: /* canceled (async) */
510 case -EINPROGRESS: /* pending */ 483 case -EINPROGRESS: /* pending */
511 /* ignore silently */ 484 /* ignore silently */
512 dbg(DEBUG_USBREQ, 485 gig_dbg(DEBUG_USBREQ, "%s: %s",
513 "%s: %s", __func__, get_usb_statmsg(urb->status)); 486 __func__, get_usb_statmsg(urb->status));
514 return; 487 return;
515 default: /* severe trouble */ 488 default: /* severe trouble */
516 warn("interrupt read: %s", get_usb_statmsg(urb->status)); 489 dev_warn(cs->dev, "interrupt read: %s\n",
490 get_usb_statmsg(urb->status));
517 //FIXME corrective action? resubmission always ok? 491 //FIXME corrective action? resubmission always ok?
518 goto resubmit; 492 goto resubmit;
519 } 493 }
@@ -521,10 +495,9 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs)
521 l = (unsigned) ucs->int_in_buf[1] + 495 l = (unsigned) ucs->int_in_buf[1] +
522 (((unsigned) ucs->int_in_buf[2]) << 8); 496 (((unsigned) ucs->int_in_buf[2]) << 8);
523 497
524 dbg(DEBUG_USBREQ, 498 gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])",
525 "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", urb->actual_length, 499 urb->actual_length, (int)ucs->int_in_buf[0], l,
526 (int)ucs->int_in_buf[0], l, 500 (int)ucs->int_in_buf[1], (int)ucs->int_in_buf[2]);
527 (int)ucs->int_in_buf[1], (int)ucs->int_in_buf[2]);
528 501
529 channel = 0; 502 channel = 0;
530 503
@@ -570,28 +543,30 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs)
570 case HD_B1_FLOW_CONTROL: 543 case HD_B1_FLOW_CONTROL:
571 bcs = cs->bcs + channel; 544 bcs = cs->bcs + channel;
572 atomic_add((l - BAS_NORMFRAME) * BAS_CORRFRAMES, 545 atomic_add((l - BAS_NORMFRAME) * BAS_CORRFRAMES,
573 &bcs->hw.bas->corrbytes); 546 &bcs->hw.bas->corrbytes);
574 dbg(DEBUG_ISO, 547 gig_dbg(DEBUG_ISO,
575 "Flow control (channel %d, sub %d): 0x%02x => %d", 548 "Flow control (channel %d, sub %d): 0x%02x => %d",
576 channel, bcs->hw.bas->numsub, l, 549 channel, bcs->hw.bas->numsub, l,
577 atomic_read(&bcs->hw.bas->corrbytes)); 550 atomic_read(&bcs->hw.bas->corrbytes));
578 break; 551 break;
579 552
580 case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ 553 case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */
581 if (!l) { 554 if (!l) {
582 warn("HD_RECEIVEATDATA_ACK with length 0 ignored"); 555 dev_warn(cs->dev,
556 "HD_RECEIVEATDATA_ACK with length 0 ignored\n");
583 break; 557 break;
584 } 558 }
585 spin_lock_irqsave(&cs->lock, flags); 559 spin_lock_irqsave(&cs->lock, flags);
586 if (ucs->rcvbuf_size) { 560 if (ucs->rcvbuf_size) {
587 spin_unlock_irqrestore(&cs->lock, flags); 561 spin_unlock_irqrestore(&cs->lock, flags);
588 err("receive AT data overrun, %d bytes lost", l); 562 dev_err(cs->dev,
563 "receive AT data overrun, %d bytes lost\n", l);
589 error_reset(cs); //FIXME reschedule 564 error_reset(cs); //FIXME reschedule
590 break; 565 break;
591 } 566 }
592 if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { 567 if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) {
593 spin_unlock_irqrestore(&cs->lock, flags); 568 spin_unlock_irqrestore(&cs->lock, flags);
594 err("%s: out of memory, %d bytes lost", __func__, l); 569 dev_err(cs->dev, "out of memory, %d bytes lost\n", l);
595 error_reset(cs); //FIXME reschedule 570 error_reset(cs); //FIXME reschedule
596 break; 571 break;
597 } 572 }
@@ -607,25 +582,28 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs)
607 break; 582 break;
608 583
609 case HD_RESET_INTERRUPT_PIPE_ACK: 584 case HD_RESET_INTERRUPT_PIPE_ACK:
610 dbg(DEBUG_USBREQ, "HD_RESET_INTERRUPT_PIPE_ACK"); 585 gig_dbg(DEBUG_USBREQ, "HD_RESET_INTERRUPT_PIPE_ACK");
611 break; 586 break;
612 587
613 case HD_SUSPEND_END: 588 case HD_SUSPEND_END:
614 dbg(DEBUG_USBREQ, "HD_SUSPEND_END"); 589 gig_dbg(DEBUG_USBREQ, "HD_SUSPEND_END");
615 break; 590 break;
616 591
617 default: 592 default:
618 warn("unknown Gigaset signal 0x%02x (%u) ignored", 593 dev_warn(cs->dev,
619 (int) ucs->int_in_buf[0], l); 594 "unknown Gigaset signal 0x%02x (%u) ignored\n",
595 (int) ucs->int_in_buf[0], l);
620 } 596 }
621 597
622 check_pending(ucs); 598 check_pending(ucs);
623 599
624resubmit: 600resubmit:
625 status = usb_submit_urb(urb, SLAB_ATOMIC); 601 spin_lock_irqsave(&cs->lock, flags);
602 status = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV;
603 spin_unlock_irqrestore(&cs->lock, flags);
626 if (unlikely(status)) { 604 if (unlikely(status)) {
627 err("could not resubmit interrupt URB: %s", 605 dev_err(cs->dev, "could not resubmit interrupt URB: %s\n",
628 get_usb_statmsg(status)); 606 get_usb_statmsg(status));
629 error_reset(cs); 607 error_reset(cs);
630 } 608 }
631} 609}
@@ -639,30 +617,22 @@ resubmit:
639 */ 617 */
640static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) 618static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs)
641{ 619{
642 struct cardstate *cs; 620 struct inbuf_t *inbuf = urb->context;
643 struct bas_cardstate *ucs; 621 struct cardstate *cs = inbuf->cs;
622 struct bas_cardstate *ucs = cs->hw.bas;
623 int have_data = 0;
644 unsigned numbytes; 624 unsigned numbytes;
645 unsigned long flags; 625 unsigned long flags;
646 struct inbuf_t *inbuf;
647 int have_data = 0;
648
649 IFNULLRET(urb);
650 inbuf = (struct inbuf_t *) urb->context;
651 IFNULLRET(inbuf);
652 cs = inbuf->cs;
653 IFNULLRET(cs);
654 ucs = cs->hw.bas;
655 IFNULLRET(ucs);
656 626
657 spin_lock_irqsave(&cs->lock, flags); 627 spin_lock_irqsave(&cs->lock, flags);
658 if (!atomic_read(&cs->connected)) { 628 if (unlikely(!cs->connected)) {
659 warn("%s: disconnected", __func__); 629 warn("%s: disconnected", __func__);
660 spin_unlock_irqrestore(&cs->lock, flags); 630 spin_unlock_irqrestore(&cs->lock, flags);
661 return; 631 return;
662 } 632 }
663 633
664 if (!ucs->rcvbuf_size) { 634 if (!ucs->rcvbuf_size) {
665 warn("%s: no receive in progress", __func__); 635 dev_warn(cs->dev, "%s: no receive in progress\n", __func__);
666 spin_unlock_irqrestore(&cs->lock, flags); 636 spin_unlock_irqrestore(&cs->lock, flags);
667 return; 637 return;
668 } 638 }
@@ -673,12 +643,14 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs)
673 case 0: /* normal completion */ 643 case 0: /* normal completion */
674 numbytes = urb->actual_length; 644 numbytes = urb->actual_length;
675 if (unlikely(numbytes == 0)) { 645 if (unlikely(numbytes == 0)) {
676 warn("control read: empty block received"); 646 dev_warn(cs->dev,
647 "control read: empty block received\n");
677 goto retry; 648 goto retry;
678 } 649 }
679 if (unlikely(numbytes != ucs->rcvbuf_size)) { 650 if (unlikely(numbytes != ucs->rcvbuf_size)) {
680 warn("control read: received %d chars, expected %d", 651 dev_warn(cs->dev,
681 numbytes, ucs->rcvbuf_size); 652 "control read: received %d chars, expected %d\n",
653 numbytes, ucs->rcvbuf_size);
682 if (numbytes > ucs->rcvbuf_size) 654 if (numbytes > ucs->rcvbuf_size)
683 numbytes = ucs->rcvbuf_size; 655 numbytes = ucs->rcvbuf_size;
684 } 656 }
@@ -698,23 +670,26 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs)
698 case -ECONNRESET: /* canceled (async) */ 670 case -ECONNRESET: /* canceled (async) */
699 case -EINPROGRESS: /* pending */ 671 case -EINPROGRESS: /* pending */
700 /* no action necessary */ 672 /* no action necessary */
701 dbg(DEBUG_USBREQ, 673 gig_dbg(DEBUG_USBREQ, "%s: %s",
702 "%s: %s", __func__, get_usb_statmsg(urb->status)); 674 __func__, get_usb_statmsg(urb->status));
703 break; 675 break;
704 676
705 default: /* severe trouble */ 677 default: /* severe trouble */
706 warn("control read: %s", get_usb_statmsg(urb->status)); 678 dev_warn(cs->dev, "control read: %s\n",
679 get_usb_statmsg(urb->status));
707 retry: 680 retry:
708 if (ucs->retry_cmd_in++ < BAS_RETRY) { 681 if (ucs->retry_cmd_in++ < BAS_RETRY) {
709 notice("control read: retry %d", ucs->retry_cmd_in); 682 dev_notice(cs->dev, "control read: retry %d\n",
683 ucs->retry_cmd_in);
710 if (atread_submit(cs, BAS_TIMEOUT) >= 0) { 684 if (atread_submit(cs, BAS_TIMEOUT) >= 0) {
711 /* resubmitted - bypass regular exit block */ 685 /* resubmitted - bypass regular exit block */
712 spin_unlock_irqrestore(&cs->lock, flags); 686 spin_unlock_irqrestore(&cs->lock, flags);
713 return; 687 return;
714 } 688 }
715 } else { 689 } else {
716 err("control read: giving up after %d tries", 690 dev_err(cs->dev,
717 ucs->retry_cmd_in); 691 "control read: giving up after %d tries\n",
692 ucs->retry_cmd_in);
718 } 693 }
719 error_reset(cs); 694 error_reset(cs);
720 } 695 }
@@ -724,7 +699,7 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs)
724 ucs->rcvbuf_size = 0; 699 ucs->rcvbuf_size = 0;
725 spin_unlock_irqrestore(&cs->lock, flags); 700 spin_unlock_irqrestore(&cs->lock, flags);
726 if (have_data) { 701 if (have_data) {
727 dbg(DEBUG_INTR, "%s-->BH", __func__); 702 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
728 gigaset_schedule_event(cs); 703 gigaset_schedule_event(cs);
729 } 704 }
730} 705}
@@ -743,21 +718,16 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
743 unsigned long flags; 718 unsigned long flags;
744 int i, rc; 719 int i, rc;
745 720
746 IFNULLRET(urb);
747 IFNULLRET(urb->context);
748 IFNULLRET(cardstate);
749
750 /* status codes not worth bothering the tasklet with */ 721 /* status codes not worth bothering the tasklet with */
751 if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || 722 if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET ||
752 urb->status == -EINPROGRESS)) { 723 urb->status == -EINPROGRESS)) {
753 dbg(DEBUG_ISO, 724 gig_dbg(DEBUG_ISO, "%s: %s",
754 "%s: %s", __func__, get_usb_statmsg(urb->status)); 725 __func__, get_usb_statmsg(urb->status));
755 return; 726 return;
756 } 727 }
757 728
758 bcs = (struct bc_state *) urb->context; 729 bcs = urb->context;
759 ubc = bcs->hw.bas; 730 ubc = bcs->hw.bas;
760 IFNULLRET(ubc);
761 731
762 spin_lock_irqsave(&ubc->isoinlock, flags); 732 spin_lock_irqsave(&ubc->isoinlock, flags);
763 if (likely(ubc->isoindone == NULL)) { 733 if (likely(ubc->isoindone == NULL)) {
@@ -777,14 +747,17 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
777 urb->iso_frame_desc[i].actual_length = 0; 747 urb->iso_frame_desc[i].actual_length = 0;
778 } 748 }
779 if (likely(atomic_read(&ubc->running))) { 749 if (likely(atomic_read(&ubc->running))) {
780 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ 750 /* urb->dev is clobbered by USB subsystem */
751 urb->dev = bcs->cs->hw.bas->udev;
781 urb->transfer_flags = URB_ISO_ASAP; 752 urb->transfer_flags = URB_ISO_ASAP;
782 urb->number_of_packets = BAS_NUMFRAMES; 753 urb->number_of_packets = BAS_NUMFRAMES;
783 dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", __func__); 754 gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit",
755 __func__);
784 rc = usb_submit_urb(urb, SLAB_ATOMIC); 756 rc = usb_submit_urb(urb, SLAB_ATOMIC);
785 if (unlikely(rc != 0)) { 757 if (unlikely(rc != 0)) {
786 err("could not resubmit isochronous read URB: %s", 758 dev_err(bcs->cs->dev,
787 get_usb_statmsg(rc)); 759 "could not resubmit isochronous read "
760 "URB: %s\n", get_usb_statmsg(rc));
788 dump_urb(DEBUG_ISO, "isoc read", urb); 761 dump_urb(DEBUG_ISO, "isoc read", urb);
789 error_hangup(bcs); 762 error_hangup(bcs);
790 } 763 }
@@ -806,23 +779,17 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs)
806 struct bas_bc_state *ubc; 779 struct bas_bc_state *ubc;
807 unsigned long flags; 780 unsigned long flags;
808 781
809 IFNULLRET(urb);
810 IFNULLRET(urb->context);
811 IFNULLRET(cardstate);
812
813 /* status codes not worth bothering the tasklet with */ 782 /* status codes not worth bothering the tasklet with */
814 if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || 783 if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET ||
815 urb->status == -EINPROGRESS)) { 784 urb->status == -EINPROGRESS)) {
816 dbg(DEBUG_ISO, 785 gig_dbg(DEBUG_ISO, "%s: %s",
817 "%s: %s", __func__, get_usb_statmsg(urb->status)); 786 __func__, get_usb_statmsg(urb->status));
818 return; 787 return;
819 } 788 }
820 789
821 /* pass URB context to tasklet */ 790 /* pass URB context to tasklet */
822 ucx = (struct isow_urbctx_t *) urb->context; 791 ucx = urb->context;
823 IFNULLRET(ucx->bcs);
824 ubc = ucx->bcs->hw.bas; 792 ubc = ucx->bcs->hw.bas;
825 IFNULLRET(ubc);
826 793
827 spin_lock_irqsave(&ubc->isooutlock, flags); 794 spin_lock_irqsave(&ubc->isooutlock, flags);
828 ubc->isooutovfl = ubc->isooutdone; 795 ubc->isooutovfl = ubc->isooutdone;
@@ -841,15 +808,11 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs)
841 */ 808 */
842static int starturbs(struct bc_state *bcs) 809static int starturbs(struct bc_state *bcs)
843{ 810{
811 struct bas_bc_state *ubc = bcs->hw.bas;
844 struct urb *urb; 812 struct urb *urb;
845 struct bas_bc_state *ubc;
846 int j, k; 813 int j, k;
847 int rc; 814 int rc;
848 815
849 IFNULLRETVAL(bcs, -EFAULT);
850 ubc = bcs->hw.bas;
851 IFNULLRETVAL(ubc, -EFAULT);
852
853 /* initialize L2 reception */ 816 /* initialize L2 reception */
854 if (bcs->proto2 == ISDN_PROTO_L2_HDLC) 817 if (bcs->proto2 == ISDN_PROTO_L2_HDLC)
855 bcs->inputstate |= INS_flag_hunt; 818 bcs->inputstate |= INS_flag_hunt;
@@ -859,7 +822,7 @@ static int starturbs(struct bc_state *bcs)
859 for (k = 0; k < BAS_INURBS; k++) { 822 for (k = 0; k < BAS_INURBS; k++) {
860 urb = ubc->isoinurbs[k]; 823 urb = ubc->isoinurbs[k];
861 if (!urb) { 824 if (!urb) {
862 err("isoinurbs[%d]==NULL", k); 825 dev_err(bcs->cs->dev, "isoinurbs[%d]==NULL\n", k);
863 rc = -EFAULT; 826 rc = -EFAULT;
864 goto error; 827 goto error;
865 } 828 }
@@ -882,8 +845,9 @@ static int starturbs(struct bc_state *bcs)
882 845
883 dump_urb(DEBUG_ISO, "Initial isoc read", urb); 846 dump_urb(DEBUG_ISO, "Initial isoc read", urb);
884 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { 847 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) {
885 err("could not submit isochronous read URB %d: %s", 848 dev_err(bcs->cs->dev,
886 k, get_usb_statmsg(rc)); 849 "could not submit isochronous read URB %d: %s\n",
850 k, get_usb_statmsg(rc));
887 goto error; 851 goto error;
888 } 852 }
889 } 853 }
@@ -895,7 +859,7 @@ static int starturbs(struct bc_state *bcs)
895 for (k = 0; k < BAS_OUTURBS; ++k) { 859 for (k = 0; k < BAS_OUTURBS; ++k) {
896 urb = ubc->isoouturbs[k].urb; 860 urb = ubc->isoouturbs[k].urb;
897 if (!urb) { 861 if (!urb) {
898 err("isoouturbs[%d].urb==NULL", k); 862 dev_err(bcs->cs->dev, "isoouturbs[%d].urb==NULL\n", k);
899 rc = -EFAULT; 863 rc = -EFAULT;
900 goto error; 864 goto error;
901 } 865 }
@@ -922,8 +886,9 @@ static int starturbs(struct bc_state *bcs)
922 dump_urb(DEBUG_ISO, "Initial isoc write", urb); 886 dump_urb(DEBUG_ISO, "Initial isoc write", urb);
923 rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); 887 rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC);
924 if (rc != 0) { 888 if (rc != 0) {
925 err("could not submit isochronous write URB %d: %s", 889 dev_err(bcs->cs->dev,
926 k, get_usb_statmsg(rc)); 890 "could not submit isochronous write URB %d: %s\n",
891 k, get_usb_statmsg(rc));
927 goto error; 892 goto error;
928 } 893 }
929 } 894 }
@@ -946,20 +911,20 @@ static void stopurbs(struct bas_bc_state *ubc)
946{ 911{
947 int k, rc; 912 int k, rc;
948 913
949 IFNULLRET(ubc);
950
951 atomic_set(&ubc->running, 0); 914 atomic_set(&ubc->running, 0);
952 915
953 for (k = 0; k < BAS_INURBS; ++k) { 916 for (k = 0; k < BAS_INURBS; ++k) {
954 rc = usb_unlink_urb(ubc->isoinurbs[k]); 917 rc = usb_unlink_urb(ubc->isoinurbs[k]);
955 dbg(DEBUG_ISO, "%s: isoc input URB %d unlinked, result = %d", 918 gig_dbg(DEBUG_ISO,
956 __func__, k, rc); 919 "%s: isoc input URB %d unlinked, result = %d",
920 __func__, k, rc);
957 } 921 }
958 922
959 for (k = 0; k < BAS_OUTURBS; ++k) { 923 for (k = 0; k < BAS_OUTURBS; ++k) {
960 rc = usb_unlink_urb(ubc->isoouturbs[k].urb); 924 rc = usb_unlink_urb(ubc->isoouturbs[k].urb);
961 dbg(DEBUG_ISO, "%s: isoc output URB %d unlinked, result = %d", 925 gig_dbg(DEBUG_ISO,
962 __func__, k, rc); 926 "%s: isoc output URB %d unlinked, result = %d",
927 __func__, k, rc);
963 } 928 }
964} 929}
965 930
@@ -977,19 +942,14 @@ static void stopurbs(struct bas_bc_state *ubc)
977 */ 942 */
978static int submit_iso_write_urb(struct isow_urbctx_t *ucx) 943static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
979{ 944{
980 struct urb *urb; 945 struct urb *urb = ucx->urb;
981 struct bas_bc_state *ubc; 946 struct bas_bc_state *ubc = ucx->bcs->hw.bas;
982 struct usb_iso_packet_descriptor *ifd; 947 struct usb_iso_packet_descriptor *ifd;
983 int corrbytes, nframe, rc; 948 int corrbytes, nframe, rc;
949 unsigned long flags;
984 950
985 IFNULLRETVAL(ucx, -EFAULT); 951 /* urb->dev is clobbered by USB subsystem */
986 urb = ucx->urb; 952 urb->dev = ucx->bcs->cs->hw.bas->udev;
987 IFNULLRETVAL(urb, -EFAULT);
988 IFNULLRETVAL(ucx->bcs, -EFAULT);
989 ubc = ucx->bcs->hw.bas;
990 IFNULLRETVAL(ubc, -EFAULT);
991
992 urb->dev = ucx->bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */
993 urb->transfer_flags = URB_ISO_ASAP; 953 urb->transfer_flags = URB_ISO_ASAP;
994 urb->transfer_buffer = ubc->isooutbuf->data; 954 urb->transfer_buffer = ubc->isooutbuf->data;
995 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); 955 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data);
@@ -1000,7 +960,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1000 /* compute frame length according to flow control */ 960 /* compute frame length according to flow control */
1001 ifd->length = BAS_NORMFRAME; 961 ifd->length = BAS_NORMFRAME;
1002 if ((corrbytes = atomic_read(&ubc->corrbytes)) != 0) { 962 if ((corrbytes = atomic_read(&ubc->corrbytes)) != 0) {
1003 dbg(DEBUG_ISO, "%s: corrbytes=%d", __func__, corrbytes); 963 gig_dbg(DEBUG_ISO, "%s: corrbytes=%d",
964 __func__, corrbytes);
1004 if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME) 965 if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME)
1005 corrbytes = BAS_HIGHFRAME - BAS_NORMFRAME; 966 corrbytes = BAS_HIGHFRAME - BAS_NORMFRAME;
1006 else if (corrbytes < BAS_LOWFRAME - BAS_NORMFRAME) 967 else if (corrbytes < BAS_LOWFRAME - BAS_NORMFRAME)
@@ -1008,18 +969,21 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1008 ifd->length += corrbytes; 969 ifd->length += corrbytes;
1009 atomic_add(-corrbytes, &ubc->corrbytes); 970 atomic_add(-corrbytes, &ubc->corrbytes);
1010 } 971 }
1011 //dbg(DEBUG_ISO, "%s: frame %d length=%d", __func__, nframe, ifd->length);
1012 972
1013 /* retrieve block of data to send */ 973 /* retrieve block of data to send */
1014 ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf, ifd->length); 974 ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf,
975 ifd->length);
1015 if (ifd->offset < 0) { 976 if (ifd->offset < 0) {
1016 if (ifd->offset == -EBUSY) { 977 if (ifd->offset == -EBUSY) {
1017 dbg(DEBUG_ISO, "%s: buffer busy at frame %d", 978 gig_dbg(DEBUG_ISO,
1018 __func__, nframe); 979 "%s: buffer busy at frame %d",
1019 /* tasklet will be restarted from gigaset_send_skb() */ 980 __func__, nframe);
981 /* tasklet will be restarted from
982 gigaset_send_skb() */
1020 } else { 983 } else {
1021 err("%s: buffer error %d at frame %d", 984 dev_err(ucx->bcs->cs->dev,
1022 __func__, ifd->offset, nframe); 985 "%s: buffer error %d at frame %d\n",
986 __func__, ifd->offset, nframe);
1023 return ifd->offset; 987 return ifd->offset;
1024 } 988 }
1025 break; 989 break;
@@ -1029,9 +993,14 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1029 ifd->actual_length = 0; 993 ifd->actual_length = 0;
1030 } 994 }
1031 if ((urb->number_of_packets = nframe) > 0) { 995 if ((urb->number_of_packets = nframe) > 0) {
1032 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { 996 spin_lock_irqsave(&ucx->bcs->cs->lock, flags);
1033 err("could not submit isochronous write URB: %s", 997 rc = ucx->bcs->cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV;
1034 get_usb_statmsg(rc)); 998 spin_unlock_irqrestore(&ucx->bcs->cs->lock, flags);
999
1000 if (rc) {
1001 dev_err(ucx->bcs->cs->dev,
1002 "could not submit isochronous write URB: %s\n",
1003 get_usb_statmsg(rc));
1035 dump_urb(DEBUG_ISO, "isoc write", urb); 1004 dump_urb(DEBUG_ISO, "isoc write", urb);
1036 return rc; 1005 return rc;
1037 } 1006 }
@@ -1048,9 +1017,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1048 */ 1017 */
1049static void write_iso_tasklet(unsigned long data) 1018static void write_iso_tasklet(unsigned long data)
1050{ 1019{
1051 struct bc_state *bcs; 1020 struct bc_state *bcs = (struct bc_state *) data;
1052 struct bas_bc_state *ubc; 1021 struct bas_bc_state *ubc = bcs->hw.bas;
1053 struct cardstate *cs; 1022 struct cardstate *cs = bcs->cs;
1054 struct isow_urbctx_t *done, *next, *ovfl; 1023 struct isow_urbctx_t *done, *next, *ovfl;
1055 struct urb *urb; 1024 struct urb *urb;
1056 struct usb_iso_packet_descriptor *ifd; 1025 struct usb_iso_packet_descriptor *ifd;
@@ -1060,22 +1029,10 @@ static void write_iso_tasklet(unsigned long data)
1060 struct sk_buff *skb; 1029 struct sk_buff *skb;
1061 int len; 1030 int len;
1062 1031
1063 bcs = (struct bc_state *) data;
1064 IFNULLRET(bcs);
1065 ubc = bcs->hw.bas;
1066 IFNULLRET(ubc);
1067 cs = bcs->cs;
1068 IFNULLRET(cs);
1069
1070 /* loop while completed URBs arrive in time */ 1032 /* loop while completed URBs arrive in time */
1071 for (;;) { 1033 for (;;) {
1072 if (unlikely(!atomic_read(&cs->connected))) {
1073 warn("%s: disconnected", __func__);
1074 return;
1075 }
1076
1077 if (unlikely(!(atomic_read(&ubc->running)))) { 1034 if (unlikely(!(atomic_read(&ubc->running)))) {
1078 dbg(DEBUG_ISO, "%s: not running", __func__); 1035 gig_dbg(DEBUG_ISO, "%s: not running", __func__);
1079 return; 1036 return;
1080 } 1037 }
1081 1038
@@ -1087,7 +1044,7 @@ static void write_iso_tasklet(unsigned long data)
1087 ubc->isooutovfl = NULL; 1044 ubc->isooutovfl = NULL;
1088 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1045 spin_unlock_irqrestore(&ubc->isooutlock, flags);
1089 if (ovfl) { 1046 if (ovfl) {
1090 err("isochronous write buffer underrun - buy a faster machine :-)"); 1047 dev_err(cs->dev, "isochronous write buffer underrun\n");
1091 error_hangup(bcs); 1048 error_hangup(bcs);
1092 break; 1049 break;
1093 } 1050 }
@@ -1110,7 +1067,8 @@ static void write_iso_tasklet(unsigned long data)
1110 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1067 spin_unlock_irqrestore(&ubc->isooutlock, flags);
1111 if (next) { 1068 if (next) {
1112 /* couldn't put it back */ 1069 /* couldn't put it back */
1113 err("losing isochronous write URB"); 1070 dev_err(cs->dev,
1071 "losing isochronous write URB\n");
1114 error_hangup(bcs); 1072 error_hangup(bcs);
1115 } 1073 }
1116 } 1074 }
@@ -1123,22 +1081,25 @@ static void write_iso_tasklet(unsigned long data)
1123 break; 1081 break;
1124 case -EXDEV: /* inspect individual frames */ 1082 case -EXDEV: /* inspect individual frames */
1125 /* assumptions (for lack of documentation): 1083 /* assumptions (for lack of documentation):
1126 * - actual_length bytes of the frame in error are successfully sent 1084 * - actual_length bytes of the frame in error are
1085 * successfully sent
1127 * - all following frames are not sent at all 1086 * - all following frames are not sent at all
1128 */ 1087 */
1129 dbg(DEBUG_ISO, "%s: URB partially completed", __func__); 1088 gig_dbg(DEBUG_ISO, "%s: URB partially completed",
1089 __func__);
1130 offset = done->limit; /* just in case */ 1090 offset = done->limit; /* just in case */
1131 for (i = 0; i < BAS_NUMFRAMES; i++) { 1091 for (i = 0; i < BAS_NUMFRAMES; i++) {
1132 ifd = &urb->iso_frame_desc[i]; 1092 ifd = &urb->iso_frame_desc[i];
1133 if (ifd->status || 1093 if (ifd->status ||
1134 ifd->actual_length != ifd->length) { 1094 ifd->actual_length != ifd->length) {
1135 warn("isochronous write: frame %d: %s, " 1095 dev_warn(cs->dev,
1136 "only %d of %d bytes sent", 1096 "isochronous write: frame %d: %s, "
1097 "only %d of %d bytes sent\n",
1137 i, get_usb_statmsg(ifd->status), 1098 i, get_usb_statmsg(ifd->status),
1138 ifd->actual_length, ifd->length); 1099 ifd->actual_length, ifd->length);
1139 offset = (ifd->offset + 1100 offset = (ifd->offset +
1140 ifd->actual_length) 1101 ifd->actual_length)
1141 % BAS_OUTBUFSIZE; 1102 % BAS_OUTBUFSIZE;
1142 break; 1103 break;
1143 } 1104 }
1144 } 1105 }
@@ -1148,25 +1109,26 @@ static void write_iso_tasklet(unsigned long data)
1148 ifd = &urb->iso_frame_desc[i]; 1109 ifd = &urb->iso_frame_desc[i];
1149 if (ifd->status != -EINPROGRESS 1110 if (ifd->status != -EINPROGRESS
1150 || ifd->actual_length != 0) { 1111 || ifd->actual_length != 0) {
1151 warn("isochronous write: frame %d: %s, " 1112 dev_warn(cs->dev,
1152 "%d of %d bytes sent", 1113 "isochronous write: frame %d: %s, "
1114 "%d of %d bytes sent\n",
1153 i, get_usb_statmsg(ifd->status), 1115 i, get_usb_statmsg(ifd->status),
1154 ifd->actual_length, ifd->length); 1116 ifd->actual_length, ifd->length);
1155 offset = (ifd->offset + 1117 offset = (ifd->offset +
1156 ifd->actual_length) 1118 ifd->actual_length)
1157 % BAS_OUTBUFSIZE; 1119 % BAS_OUTBUFSIZE;
1158 break; 1120 break;
1159 } 1121 }
1160 } 1122 }
1161#endif 1123#endif
1162 break; 1124 break;
1163 case -EPIPE: //FIXME is this the code for "underrun"? 1125 case -EPIPE: //FIXME is this the code for "underrun"?
1164 err("isochronous write stalled"); 1126 dev_err(cs->dev, "isochronous write stalled\n");
1165 error_hangup(bcs); 1127 error_hangup(bcs);
1166 break; 1128 break;
1167 default: /* severe trouble */ 1129 default: /* severe trouble */
1168 warn("isochronous write: %s", 1130 dev_warn(cs->dev, "isochronous write: %s\n",
1169 get_usb_statmsg(urb->status)); 1131 get_usb_statmsg(urb->status));
1170 } 1132 }
1171 1133
1172 /* mark the write buffer area covered by this URB as free */ 1134 /* mark the write buffer area covered by this URB as free */
@@ -1194,8 +1156,8 @@ static void write_iso_tasklet(unsigned long data)
1194 if (gigaset_isoc_buildframe(bcs, skb->data, len) == -EAGAIN) { 1156 if (gigaset_isoc_buildframe(bcs, skb->data, len) == -EAGAIN) {
1195 /* insufficient buffer space, push back onto queue */ 1157 /* insufficient buffer space, push back onto queue */
1196 skb_queue_head(&bcs->squeue, skb); 1158 skb_queue_head(&bcs->squeue, skb);
1197 dbg(DEBUG_ISO, "%s: skb requeued, qlen=%d", 1159 gig_dbg(DEBUG_ISO, "%s: skb requeued, qlen=%d",
1198 __func__, skb_queue_len(&bcs->squeue)); 1160 __func__, skb_queue_len(&bcs->squeue));
1199 break; 1161 break;
1200 } 1162 }
1201 skb_pull(skb, len); 1163 skb_pull(skb, len);
@@ -1215,28 +1177,16 @@ static void write_iso_tasklet(unsigned long data)
1215 */ 1177 */
1216static void read_iso_tasklet(unsigned long data) 1178static void read_iso_tasklet(unsigned long data)
1217{ 1179{
1218 struct bc_state *bcs; 1180 struct bc_state *bcs = (struct bc_state *) data;
1219 struct bas_bc_state *ubc; 1181 struct bas_bc_state *ubc = bcs->hw.bas;
1220 struct cardstate *cs; 1182 struct cardstate *cs = bcs->cs;
1221 struct urb *urb; 1183 struct urb *urb;
1222 char *rcvbuf; 1184 char *rcvbuf;
1223 unsigned long flags; 1185 unsigned long flags;
1224 int totleft, numbytes, offset, frame, rc; 1186 int totleft, numbytes, offset, frame, rc;
1225 1187
1226 bcs = (struct bc_state *) data;
1227 IFNULLRET(bcs);
1228 ubc = bcs->hw.bas;
1229 IFNULLRET(ubc);
1230 cs = bcs->cs;
1231 IFNULLRET(cs);
1232
1233 /* loop while more completed URBs arrive in the meantime */ 1188 /* loop while more completed URBs arrive in the meantime */
1234 for (;;) { 1189 for (;;) {
1235 if (!atomic_read(&cs->connected)) {
1236 warn("%s: disconnected", __func__);
1237 return;
1238 }
1239
1240 /* retrieve URB */ 1190 /* retrieve URB */
1241 spin_lock_irqsave(&ubc->isoinlock, flags); 1191 spin_lock_irqsave(&ubc->isoinlock, flags);
1242 if (!(urb = ubc->isoindone)) { 1192 if (!(urb = ubc->isoindone)) {
@@ -1245,38 +1195,45 @@ static void read_iso_tasklet(unsigned long data)
1245 } 1195 }
1246 ubc->isoindone = NULL; 1196 ubc->isoindone = NULL;
1247 if (unlikely(ubc->loststatus != -EINPROGRESS)) { 1197 if (unlikely(ubc->loststatus != -EINPROGRESS)) {
1248 warn("isochronous read overrun, dropped URB with status: %s, %d bytes lost", 1198 dev_warn(cs->dev,
1249 get_usb_statmsg(ubc->loststatus), ubc->isoinlost); 1199 "isochronous read overrun, "
1200 "dropped URB with status: %s, %d bytes lost\n",
1201 get_usb_statmsg(ubc->loststatus),
1202 ubc->isoinlost);
1250 ubc->loststatus = -EINPROGRESS; 1203 ubc->loststatus = -EINPROGRESS;
1251 } 1204 }
1252 spin_unlock_irqrestore(&ubc->isoinlock, flags); 1205 spin_unlock_irqrestore(&ubc->isoinlock, flags);
1253 1206
1254 if (unlikely(!(atomic_read(&ubc->running)))) { 1207 if (unlikely(!(atomic_read(&ubc->running)))) {
1255 dbg(DEBUG_ISO, "%s: channel not running, dropped URB with status: %s", 1208 gig_dbg(DEBUG_ISO,
1256 __func__, get_usb_statmsg(urb->status)); 1209 "%s: channel not running, "
1210 "dropped URB with status: %s",
1211 __func__, get_usb_statmsg(urb->status));
1257 return; 1212 return;
1258 } 1213 }
1259 1214
1260 switch (urb->status) { 1215 switch (urb->status) {
1261 case 0: /* normal completion */ 1216 case 0: /* normal completion */
1262 break; 1217 break;
1263 case -EXDEV: /* inspect individual frames (we do that anyway) */ 1218 case -EXDEV: /* inspect individual frames
1264 dbg(DEBUG_ISO, "%s: URB partially completed", __func__); 1219 (we do that anyway) */
1220 gig_dbg(DEBUG_ISO, "%s: URB partially completed",
1221 __func__);
1265 break; 1222 break;
1266 case -ENOENT: 1223 case -ENOENT:
1267 case -ECONNRESET: 1224 case -ECONNRESET:
1268 dbg(DEBUG_ISO, "%s: URB canceled", __func__); 1225 gig_dbg(DEBUG_ISO, "%s: URB canceled", __func__);
1269 continue; /* -> skip */ 1226 continue; /* -> skip */
1270 case -EINPROGRESS: /* huh? */ 1227 case -EINPROGRESS: /* huh? */
1271 dbg(DEBUG_ISO, "%s: URB still pending", __func__); 1228 gig_dbg(DEBUG_ISO, "%s: URB still pending", __func__);
1272 continue; /* -> skip */ 1229 continue; /* -> skip */
1273 case -EPIPE: 1230 case -EPIPE:
1274 err("isochronous read stalled"); 1231 dev_err(cs->dev, "isochronous read stalled\n");
1275 error_hangup(bcs); 1232 error_hangup(bcs);
1276 continue; /* -> skip */ 1233 continue; /* -> skip */
1277 default: /* severe trouble */ 1234 default: /* severe trouble */
1278 warn("isochronous read: %s", 1235 dev_warn(cs->dev, "isochronous read: %s\n",
1279 get_usb_statmsg(urb->status)); 1236 get_usb_statmsg(urb->status));
1280 goto error; 1237 goto error;
1281 } 1238 }
1282 1239
@@ -1284,33 +1241,44 @@ static void read_iso_tasklet(unsigned long data)
1284 totleft = urb->actual_length; 1241 totleft = urb->actual_length;
1285 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { 1242 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) {
1286 if (unlikely(urb->iso_frame_desc[frame].status)) { 1243 if (unlikely(urb->iso_frame_desc[frame].status)) {
1287 warn("isochronous read: frame %d: %s", 1244 dev_warn(cs->dev,
1288 frame, get_usb_statmsg(urb->iso_frame_desc[frame].status)); 1245 "isochronous read: frame %d: %s\n",
1246 frame,
1247 get_usb_statmsg(
1248 urb->iso_frame_desc[frame].status));
1289 break; 1249 break;
1290 } 1250 }
1291 numbytes = urb->iso_frame_desc[frame].actual_length; 1251 numbytes = urb->iso_frame_desc[frame].actual_length;
1292 if (unlikely(numbytes > BAS_MAXFRAME)) { 1252 if (unlikely(numbytes > BAS_MAXFRAME)) {
1293 warn("isochronous read: frame %d: numbytes (%d) > BAS_MAXFRAME", 1253 dev_warn(cs->dev,
1294 frame, numbytes); 1254 "isochronous read: frame %d: "
1255 "numbytes (%d) > BAS_MAXFRAME\n",
1256 frame, numbytes);
1295 break; 1257 break;
1296 } 1258 }
1297 if (unlikely(numbytes > totleft)) { 1259 if (unlikely(numbytes > totleft)) {
1298 warn("isochronous read: frame %d: numbytes (%d) > totleft (%d)", 1260 dev_warn(cs->dev,
1299 frame, numbytes, totleft); 1261 "isochronous read: frame %d: "
1262 "numbytes (%d) > totleft (%d)\n",
1263 frame, numbytes, totleft);
1300 break; 1264 break;
1301 } 1265 }
1302 offset = urb->iso_frame_desc[frame].offset; 1266 offset = urb->iso_frame_desc[frame].offset;
1303 if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { 1267 if (unlikely(offset + numbytes > BAS_INBUFSIZE)) {
1304 warn("isochronous read: frame %d: offset (%d) + numbytes (%d) > BAS_INBUFSIZE", 1268 dev_warn(cs->dev,
1305 frame, offset, numbytes); 1269 "isochronous read: frame %d: "
1270 "offset (%d) + numbytes (%d) "
1271 "> BAS_INBUFSIZE\n",
1272 frame, offset, numbytes);
1306 break; 1273 break;
1307 } 1274 }
1308 gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); 1275 gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs);
1309 totleft -= numbytes; 1276 totleft -= numbytes;
1310 } 1277 }
1311 if (unlikely(totleft > 0)) 1278 if (unlikely(totleft > 0))
1312 warn("isochronous read: %d data bytes missing", 1279 dev_warn(cs->dev,
1313 totleft); 1280 "isochronous read: %d data bytes missing\n",
1281 totleft);
1314 1282
1315 error: 1283 error:
1316 /* URB processed, resubmit */ 1284 /* URB processed, resubmit */
@@ -1318,12 +1286,17 @@ static void read_iso_tasklet(unsigned long data)
1318 urb->iso_frame_desc[frame].status = 0; 1286 urb->iso_frame_desc[frame].status = 0;
1319 urb->iso_frame_desc[frame].actual_length = 0; 1287 urb->iso_frame_desc[frame].actual_length = 0;
1320 } 1288 }
1321 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ 1289 /* urb->dev is clobbered by USB subsystem */
1290 urb->dev = bcs->cs->hw.bas->udev;
1322 urb->transfer_flags = URB_ISO_ASAP; 1291 urb->transfer_flags = URB_ISO_ASAP;
1323 urb->number_of_packets = BAS_NUMFRAMES; 1292 urb->number_of_packets = BAS_NUMFRAMES;
1324 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { 1293 spin_lock_irqsave(&cs->lock, flags);
1325 err("could not resubmit isochronous read URB: %s", 1294 rc = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV;
1326 get_usb_statmsg(rc)); 1295 spin_unlock_irqrestore(&cs->lock, flags);
1296 if (rc) {
1297 dev_err(cs->dev,
1298 "could not resubmit isochronous read URB: %s\n",
1299 get_usb_statmsg(rc));
1327 dump_urb(DEBUG_ISO, "resubmit iso read", urb); 1300 dump_urb(DEBUG_ISO, "resubmit iso read", urb);
1328 error_hangup(bcs); 1301 error_hangup(bcs);
1329 } 1302 }
@@ -1341,15 +1314,10 @@ static void read_iso_tasklet(unsigned long data)
1341static void req_timeout(unsigned long data) 1314static void req_timeout(unsigned long data)
1342{ 1315{
1343 struct bc_state *bcs = (struct bc_state *) data; 1316 struct bc_state *bcs = (struct bc_state *) data;
1344 struct bas_cardstate *ucs; 1317 struct bas_cardstate *ucs = bcs->cs->hw.bas;
1345 int pending; 1318 int pending;
1346 unsigned long flags; 1319 unsigned long flags;
1347 1320
1348 IFNULLRET(bcs);
1349 IFNULLRET(bcs->cs);
1350 ucs = bcs->cs->hw.bas;
1351 IFNULLRET(ucs);
1352
1353 check_pending(ucs); 1321 check_pending(ucs);
1354 1322
1355 spin_lock_irqsave(&ucs->lock, flags); 1323 spin_lock_irqsave(&ucs->lock, flags);
@@ -1359,33 +1327,34 @@ static void req_timeout(unsigned long data)
1359 1327
1360 switch (pending) { 1328 switch (pending) {
1361 case 0: /* no pending request */ 1329 case 0: /* no pending request */
1362 dbg(DEBUG_USBREQ, "%s: no request pending", __func__); 1330 gig_dbg(DEBUG_USBREQ, "%s: no request pending", __func__);
1363 break; 1331 break;
1364 1332
1365 case HD_OPEN_ATCHANNEL: 1333 case HD_OPEN_ATCHANNEL:
1366 err("timeout opening AT channel"); 1334 dev_err(bcs->cs->dev, "timeout opening AT channel\n");
1367 error_reset(bcs->cs); 1335 error_reset(bcs->cs);
1368 break; 1336 break;
1369 1337
1370 case HD_OPEN_B2CHANNEL: 1338 case HD_OPEN_B2CHANNEL:
1371 case HD_OPEN_B1CHANNEL: 1339 case HD_OPEN_B1CHANNEL:
1372 err("timeout opening channel %d", bcs->channel + 1); 1340 dev_err(bcs->cs->dev, "timeout opening channel %d\n",
1341 bcs->channel + 1);
1373 error_hangup(bcs); 1342 error_hangup(bcs);
1374 break; 1343 break;
1375 1344
1376 case HD_CLOSE_ATCHANNEL: 1345 case HD_CLOSE_ATCHANNEL:
1377 err("timeout closing AT channel"); 1346 dev_err(bcs->cs->dev, "timeout closing AT channel\n");
1378 //wake_up_interruptible(cs->initwait);
1379 //FIXME need own wait queue?
1380 break; 1347 break;
1381 1348
1382 case HD_CLOSE_B2CHANNEL: 1349 case HD_CLOSE_B2CHANNEL:
1383 case HD_CLOSE_B1CHANNEL: 1350 case HD_CLOSE_B1CHANNEL:
1384 err("timeout closing channel %d", bcs->channel + 1); 1351 dev_err(bcs->cs->dev, "timeout closing channel %d\n",
1352 bcs->channel + 1);
1385 break; 1353 break;
1386 1354
1387 default: 1355 default:
1388 warn("request 0x%02x timed out, clearing", pending); 1356 dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n",
1357 pending);
1389 } 1358 }
1390} 1359}
1391 1360
@@ -1398,18 +1367,14 @@ static void req_timeout(unsigned long data)
1398 */ 1367 */
1399static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) 1368static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs)
1400{ 1369{
1401 struct bas_cardstate *ucs; 1370 struct bas_cardstate *ucs = urb->context;
1402 unsigned long flags; 1371 unsigned long flags;
1403 1372
1404 IFNULLRET(urb);
1405 IFNULLRET(urb->context);
1406 IFNULLRET(cardstate);
1407
1408 ucs = (struct bas_cardstate *) urb->context;
1409 spin_lock_irqsave(&ucs->lock, flags); 1373 spin_lock_irqsave(&ucs->lock, flags);
1410 if (urb->status && ucs->pending) { 1374 if (urb->status && ucs->pending) {
1411 err("control request 0x%02x failed: %s", 1375 dev_err(&ucs->interface->dev,
1412 ucs->pending, get_usb_statmsg(urb->status)); 1376 "control request 0x%02x failed: %s\n",
1377 ucs->pending, get_usb_statmsg(urb->status));
1413 del_timer(&ucs->timer_ctrl); 1378 del_timer(&ucs->timer_ctrl);
1414 ucs->pending = 0; 1379 ucs->pending = 0;
1415 } 1380 }
@@ -1438,28 +1403,25 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs)
1438 */ 1403 */
1439static int req_submit(struct bc_state *bcs, int req, int val, int timeout) 1404static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
1440{ 1405{
1441 struct bas_cardstate *ucs; 1406 struct bas_cardstate *ucs = bcs->cs->hw.bas;
1442 int ret; 1407 int ret;
1443 unsigned long flags; 1408 unsigned long flags;
1444 1409
1445 IFNULLRETVAL(bcs, -EINVAL); 1410 gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val);
1446 IFNULLRETVAL(bcs->cs, -EINVAL);
1447 ucs = bcs->cs->hw.bas;
1448 IFNULLRETVAL(ucs, -EINVAL);
1449 IFNULLRETVAL(ucs->urb_ctrl, -EINVAL);
1450
1451 dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val);
1452 1411
1453 spin_lock_irqsave(&ucs->lock, flags); 1412 spin_lock_irqsave(&ucs->lock, flags);
1454 if (ucs->pending) { 1413 if (ucs->pending) {
1455 spin_unlock_irqrestore(&ucs->lock, flags); 1414 spin_unlock_irqrestore(&ucs->lock, flags);
1456 err("submission of request 0x%02x failed: request 0x%02x still pending", 1415 dev_err(bcs->cs->dev,
1457 req, ucs->pending); 1416 "submission of request 0x%02x failed: "
1417 "request 0x%02x still pending\n",
1418 req, ucs->pending);
1458 return -EBUSY; 1419 return -EBUSY;
1459 } 1420 }
1460 if (ucs->urb_ctrl->status == -EINPROGRESS) { 1421 if (ucs->urb_ctrl->status == -EINPROGRESS) {
1461 spin_unlock_irqrestore(&ucs->lock, flags); 1422 spin_unlock_irqrestore(&ucs->lock, flags);
1462 err("could not submit request 0x%02x: URB busy", req); 1423 dev_err(bcs->cs->dev,
1424 "could not submit request 0x%02x: URB busy\n", req);
1463 return -EBUSY; 1425 return -EBUSY;
1464 } 1426 }
1465 1427
@@ -1469,19 +1431,19 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
1469 ucs->dr_ctrl.wIndex = 0; 1431 ucs->dr_ctrl.wIndex = 0;
1470 ucs->dr_ctrl.wLength = 0; 1432 ucs->dr_ctrl.wLength = 0;
1471 usb_fill_control_urb(ucs->urb_ctrl, ucs->udev, 1433 usb_fill_control_urb(ucs->urb_ctrl, ucs->udev,
1472 usb_sndctrlpipe(ucs->udev, 0), 1434 usb_sndctrlpipe(ucs->udev, 0),
1473 (unsigned char*) &ucs->dr_ctrl, NULL, 0, 1435 (unsigned char*) &ucs->dr_ctrl, NULL, 0,
1474 write_ctrl_callback, ucs); 1436 write_ctrl_callback, ucs);
1475 if ((ret = usb_submit_urb(ucs->urb_ctrl, SLAB_ATOMIC)) != 0) { 1437 if ((ret = usb_submit_urb(ucs->urb_ctrl, SLAB_ATOMIC)) != 0) {
1476 err("could not submit request 0x%02x: %s", 1438 dev_err(bcs->cs->dev, "could not submit request 0x%02x: %s\n",
1477 req, get_usb_statmsg(ret)); 1439 req, get_usb_statmsg(ret));
1478 spin_unlock_irqrestore(&ucs->lock, flags); 1440 spin_unlock_irqrestore(&ucs->lock, flags);
1479 return ret; 1441 return ret;
1480 } 1442 }
1481 ucs->pending = req; 1443 ucs->pending = req;
1482 1444
1483 if (timeout > 0) { 1445 if (timeout > 0) {
1484 dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 1446 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
1485 ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10; 1447 ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10;
1486 ucs->timer_ctrl.data = (unsigned long) bcs; 1448 ucs->timer_ctrl.data = (unsigned long) bcs;
1487 ucs->timer_ctrl.function = req_timeout; 1449 ucs->timer_ctrl.function = req_timeout;
@@ -1504,19 +1466,18 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1504{ 1466{
1505 int req, ret; 1467 int req, ret;
1506 1468
1507 IFNULLRETVAL(bcs, -EINVAL);
1508
1509 if ((ret = starturbs(bcs)) < 0) { 1469 if ((ret = starturbs(bcs)) < 0) {
1510 err("could not start isochronous I/O for channel %d", 1470 dev_err(bcs->cs->dev,
1511 bcs->channel + 1); 1471 "could not start isochronous I/O for channel %d\n",
1472 bcs->channel + 1);
1512 error_hangup(bcs); 1473 error_hangup(bcs);
1513 return ret; 1474 return ret;
1514 } 1475 }
1515 1476
1516 req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; 1477 req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL;
1517 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { 1478 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) {
1518 err("could not open channel %d: %s", 1479 dev_err(bcs->cs->dev, "could not open channel %d: %s\n",
1519 bcs->channel + 1, get_usb_statmsg(ret)); 1480 bcs->channel + 1, get_usb_statmsg(ret));
1520 stopurbs(bcs->hw.bas); 1481 stopurbs(bcs->hw.bas);
1521 error_hangup(bcs); 1482 error_hangup(bcs);
1522 } 1483 }
@@ -1537,8 +1498,6 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
1537{ 1498{
1538 int req, ret; 1499 int req, ret;
1539 1500
1540 IFNULLRETVAL(bcs, -EINVAL);
1541
1542 if (!(atomic_read(&bcs->cs->hw.bas->basstate) & 1501 if (!(atomic_read(&bcs->cs->hw.bas->basstate) &
1543 (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { 1502 (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) {
1544 /* channel not running: just signal common.c */ 1503 /* channel not running: just signal common.c */
@@ -1548,8 +1507,9 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
1548 1507
1549 req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; 1508 req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL;
1550 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) 1509 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0)
1551 err("could not submit HD_CLOSE_BxCHANNEL request: %s", 1510 dev_err(bcs->cs->dev,
1552 get_usb_statmsg(ret)); 1511 "could not submit HD_CLOSE_BxCHANNEL request: %s\n",
1512 get_usb_statmsg(ret));
1553 return ret; 1513 return ret;
1554} 1514}
1555 1515
@@ -1564,17 +1524,13 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
1564 */ 1524 */
1565static void complete_cb(struct cardstate *cs) 1525static void complete_cb(struct cardstate *cs)
1566{ 1526{
1567 struct cmdbuf_t *cb; 1527 struct cmdbuf_t *cb = cs->cmdbuf;
1568
1569 IFNULLRET(cs);
1570 cb = cs->cmdbuf;
1571 IFNULLRET(cb);
1572 1528
1573 /* unqueue completed buffer */ 1529 /* unqueue completed buffer */
1574 cs->cmdbytes -= cs->curlen; 1530 cs->cmdbytes -= cs->curlen;
1575 dbg(DEBUG_TRANSCMD | DEBUG_LOCKCMD, 1531 gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD,
1576 "write_command: sent %u bytes, %u left", 1532 "write_command: sent %u bytes, %u left",
1577 cs->curlen, cs->cmdbytes); 1533 cs->curlen, cs->cmdbytes);
1578 if ((cs->cmdbuf = cb->next) != NULL) { 1534 if ((cs->cmdbuf = cb->next) != NULL) {
1579 cs->cmdbuf->prev = NULL; 1535 cs->cmdbuf->prev = NULL;
1580 cs->curlen = cs->cmdbuf->len; 1536 cs->curlen = cs->cmdbuf->len;
@@ -1600,15 +1556,9 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len);
1600 */ 1556 */
1601static void write_command_callback(struct urb *urb, struct pt_regs *regs) 1557static void write_command_callback(struct urb *urb, struct pt_regs *regs)
1602{ 1558{
1603 struct cardstate *cs; 1559 struct cardstate *cs = urb->context;
1560 struct bas_cardstate *ucs = cs->hw.bas;
1604 unsigned long flags; 1561 unsigned long flags;
1605 struct bas_cardstate *ucs;
1606
1607 IFNULLRET(urb);
1608 cs = (struct cardstate *) urb->context;
1609 IFNULLRET(cs);
1610 ucs = cs->hw.bas;
1611 IFNULLRET(ucs);
1612 1562
1613 /* check status */ 1563 /* check status */
1614 switch (urb->status) { 1564 switch (urb->status) {
@@ -1618,22 +1568,27 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs)
1618 case -ECONNRESET: /* canceled (async) */ 1568 case -ECONNRESET: /* canceled (async) */
1619 case -EINPROGRESS: /* pending */ 1569 case -EINPROGRESS: /* pending */
1620 /* ignore silently */ 1570 /* ignore silently */
1621 dbg(DEBUG_USBREQ, 1571 gig_dbg(DEBUG_USBREQ, "%s: %s",
1622 "%s: %s", __func__, get_usb_statmsg(urb->status)); 1572 __func__, get_usb_statmsg(urb->status));
1623 return; 1573 return;
1624 default: /* any failure */ 1574 default: /* any failure */
1625 if (++ucs->retry_cmd_out > BAS_RETRY) { 1575 if (++ucs->retry_cmd_out > BAS_RETRY) {
1626 warn("command write: %s, giving up after %d retries", 1576 dev_warn(cs->dev,
1627 get_usb_statmsg(urb->status), ucs->retry_cmd_out); 1577 "command write: %s, "
1578 "giving up after %d retries\n",
1579 get_usb_statmsg(urb->status),
1580 ucs->retry_cmd_out);
1628 break; 1581 break;
1629 } 1582 }
1630 if (cs->cmdbuf == NULL) { 1583 if (cs->cmdbuf == NULL) {
1631 warn("command write: %s, cannot retry - cmdbuf gone", 1584 dev_warn(cs->dev,
1632 get_usb_statmsg(urb->status)); 1585 "command write: %s, "
1586 "cannot retry - cmdbuf gone\n",
1587 get_usb_statmsg(urb->status));
1633 break; 1588 break;
1634 } 1589 }
1635 notice("command write: %s, retry %d", 1590 dev_notice(cs->dev, "command write: %s, retry %d\n",
1636 get_usb_statmsg(urb->status), ucs->retry_cmd_out); 1591 get_usb_statmsg(urb->status), ucs->retry_cmd_out);
1637 if (atwrite_submit(cs, cs->cmdbuf->buf, cs->cmdbuf->len) >= 0) 1592 if (atwrite_submit(cs, cs->cmdbuf->buf, cs->cmdbuf->len) >= 0)
1638 /* resubmitted - bypass regular exit block */ 1593 /* resubmitted - bypass regular exit block */
1639 return; 1594 return;
@@ -1655,13 +1610,9 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs)
1655static void atrdy_timeout(unsigned long data) 1610static void atrdy_timeout(unsigned long data)
1656{ 1611{
1657 struct cardstate *cs = (struct cardstate *) data; 1612 struct cardstate *cs = (struct cardstate *) data;
1658 struct bas_cardstate *ucs; 1613 struct bas_cardstate *ucs = cs->hw.bas;
1659
1660 IFNULLRET(cs);
1661 ucs = cs->hw.bas;
1662 IFNULLRET(ucs);
1663 1614
1664 warn("timeout waiting for HD_READY_SEND_ATDATA"); 1615 dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
1665 1616
1666 /* fake the missing signal - what else can I do? */ 1617 /* fake the missing signal - what else can I do? */
1667 update_basstate(ucs, BS_ATREADY, BS_ATTIMER); 1618 update_basstate(ucs, BS_ATREADY, BS_ATTIMER);
@@ -1682,18 +1633,15 @@ static void atrdy_timeout(unsigned long data)
1682 */ 1633 */
1683static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) 1634static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1684{ 1635{
1685 struct bas_cardstate *ucs; 1636 struct bas_cardstate *ucs = cs->hw.bas;
1637 unsigned long flags;
1686 int ret; 1638 int ret;
1687 1639
1688 IFNULLRETVAL(cs, -EFAULT); 1640 gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len);
1689 ucs = cs->hw.bas;
1690 IFNULLRETVAL(ucs, -EFAULT);
1691 IFNULLRETVAL(ucs->urb_cmd_out, -EFAULT);
1692
1693 dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len);
1694 1641
1695 if (ucs->urb_cmd_out->status == -EINPROGRESS) { 1642 if (ucs->urb_cmd_out->status == -EINPROGRESS) {
1696 err("could not submit HD_WRITE_ATMESSAGE: URB busy"); 1643 dev_err(cs->dev,
1644 "could not submit HD_WRITE_ATMESSAGE: URB busy\n");
1697 return -EBUSY; 1645 return -EBUSY;
1698 } 1646 }
1699 1647
@@ -1707,9 +1655,13 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1707 (unsigned char*) &ucs->dr_cmd_out, buf, len, 1655 (unsigned char*) &ucs->dr_cmd_out, buf, len,
1708 write_command_callback, cs); 1656 write_command_callback, cs);
1709 1657
1710 if ((ret = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC)) != 0) { 1658 spin_lock_irqsave(&cs->lock, flags);
1711 err("could not submit HD_WRITE_ATMESSAGE: %s", 1659 ret = cs->connected ? usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC) : -ENODEV;
1712 get_usb_statmsg(ret)); 1660 spin_unlock_irqrestore(&cs->lock, flags);
1661
1662 if (ret) {
1663 dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n",
1664 get_usb_statmsg(ret));
1713 return ret; 1665 return ret;
1714 } 1666 }
1715 1667
@@ -1718,8 +1670,8 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1718 1670
1719 /* start timeout if necessary */ 1671 /* start timeout if necessary */
1720 if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) { 1672 if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) {
1721 dbg(DEBUG_OUTPUT, 1673 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs",
1722 "setting ATREADY timeout of %d/10 secs", ATRDY_TIMEOUT); 1674 ATRDY_TIMEOUT);
1723 ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; 1675 ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10;
1724 ucs->timer_atrdy.data = (unsigned long) cs; 1676 ucs->timer_atrdy.data = (unsigned long) cs;
1725 ucs->timer_atrdy.function = atrdy_timeout; 1677 ucs->timer_atrdy.function = atrdy_timeout;
@@ -1740,21 +1692,17 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1740static int start_cbsend(struct cardstate *cs) 1692static int start_cbsend(struct cardstate *cs)
1741{ 1693{
1742 struct cmdbuf_t *cb; 1694 struct cmdbuf_t *cb;
1743 struct bas_cardstate *ucs; 1695 struct bas_cardstate *ucs = cs->hw.bas;
1744 unsigned long flags; 1696 unsigned long flags;
1745 int rc; 1697 int rc;
1746 int retval = 0; 1698 int retval = 0;
1747 1699
1748 IFNULLRETVAL(cs, -EFAULT);
1749 ucs = cs->hw.bas;
1750 IFNULLRETVAL(ucs, -EFAULT);
1751
1752 /* check if AT channel is open */ 1700 /* check if AT channel is open */
1753 if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { 1701 if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) {
1754 dbg(DEBUG_TRANSCMD | DEBUG_LOCKCMD, "AT channel not open"); 1702 gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open");
1755 rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); 1703 rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT);
1756 if (rc < 0) { 1704 if (rc < 0) {
1757 err("could not open AT channel"); 1705 dev_err(cs->dev, "could not open AT channel\n");
1758 /* flush command queue */ 1706 /* flush command queue */
1759 spin_lock_irqsave(&cs->cmdlock, flags); 1707 spin_lock_irqsave(&cs->cmdlock, flags);
1760 while (cs->cmdbuf != NULL) 1708 while (cs->cmdbuf != NULL)
@@ -1792,27 +1740,23 @@ static int start_cbsend(struct cardstate *cs)
1792 * cs controller state structure 1740 * cs controller state structure
1793 * buf command string to send 1741 * buf command string to send
1794 * len number of bytes to send (max. IF_WRITEBUF) 1742 * len number of bytes to send (max. IF_WRITEBUF)
1795 * wake_tasklet tasklet to run when transmission is completed (NULL if none) 1743 * wake_tasklet tasklet to run when transmission is completed
1744 * (NULL if none)
1796 * return value: 1745 * return value:
1797 * number of bytes queued on success 1746 * number of bytes queued on success
1798 * error code < 0 on error 1747 * error code < 0 on error
1799 */ 1748 */
1800static int gigaset_write_cmd(struct cardstate *cs, 1749static int gigaset_write_cmd(struct cardstate *cs,
1801 const unsigned char *buf, int len, 1750 const unsigned char *buf, int len,
1802 struct tasklet_struct *wake_tasklet) 1751 struct tasklet_struct *wake_tasklet)
1803{ 1752{
1804 struct cmdbuf_t *cb; 1753 struct cmdbuf_t *cb;
1805 unsigned long flags; 1754 unsigned long flags;
1806 int status; 1755 int status;
1807 1756
1808 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? 1757 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
1809 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 1758 DEBUG_TRANSCMD : DEBUG_LOCKCMD,
1810 "CMD Transmit", len, buf, 0); 1759 "CMD Transmit", len, buf);
1811
1812 if (!atomic_read(&cs->connected)) {
1813 err("%s: not connected", __func__);
1814 return -ENODEV;
1815 }
1816 1760
1817 if (len <= 0) 1761 if (len <= 0)
1818 return 0; /* nothing to do */ 1762 return 0; /* nothing to do */
@@ -1820,7 +1764,7 @@ static int gigaset_write_cmd(struct cardstate *cs,
1820 if (len > IF_WRITEBUF) 1764 if (len > IF_WRITEBUF)
1821 len = IF_WRITEBUF; 1765 len = IF_WRITEBUF;
1822 if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { 1766 if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) {
1823 err("%s: out of memory", __func__); 1767 dev_err(cs->dev, "%s: out of memory\n", __func__);
1824 return -ENOMEM; 1768 return -ENOMEM;
1825 } 1769 }
1826 1770
@@ -1849,7 +1793,8 @@ static int gigaset_write_cmd(struct cardstate *cs,
1849 1793
1850/* gigaset_write_room 1794/* gigaset_write_room
1851 * tty_driver.write_room interface routine 1795 * tty_driver.write_room interface routine
1852 * return number of characters the driver will accept to be written via gigaset_write_cmd 1796 * return number of characters the driver will accept to be written via
1797 * gigaset_write_cmd
1853 * parameter: 1798 * parameter:
1854 * controller state structure 1799 * controller state structure
1855 * return value: 1800 * return value:
@@ -1947,7 +1892,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)
1947 return 0; 1892 return 0;
1948 } 1893 }
1949 tasklet_init(&ubc->sent_tasklet, 1894 tasklet_init(&ubc->sent_tasklet,
1950 &write_iso_tasklet, (unsigned long) bcs); 1895 &write_iso_tasklet, (unsigned long) bcs);
1951 1896
1952 spin_lock_init(&ubc->isoinlock); 1897 spin_lock_init(&ubc->isoinlock);
1953 for (i = 0; i < BAS_INURBS; ++i) 1898 for (i = 0; i < BAS_INURBS; ++i)
@@ -1968,7 +1913,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)
1968 ubc->shared0s = 0; 1913 ubc->shared0s = 0;
1969 ubc->stolen0s = 0; 1914 ubc->stolen0s = 0;
1970 tasklet_init(&ubc->rcvd_tasklet, 1915 tasklet_init(&ubc->rcvd_tasklet,
1971 &read_iso_tasklet, (unsigned long) bcs); 1916 &read_iso_tasklet, (unsigned long) bcs);
1972 return 1; 1917 return 1;
1973} 1918}
1974 1919
@@ -2027,57 +1972,56 @@ static int gigaset_initcshw(struct cardstate *cs)
2027 */ 1972 */
2028static void freeurbs(struct cardstate *cs) 1973static void freeurbs(struct cardstate *cs)
2029{ 1974{
2030 struct bas_cardstate *ucs; 1975 struct bas_cardstate *ucs = cs->hw.bas;
2031 struct bas_bc_state *ubc; 1976 struct bas_bc_state *ubc;
2032 int i, j; 1977 int i, j;
2033 1978
2034 IFNULLRET(cs);
2035 ucs = cs->hw.bas;
2036 IFNULLRET(ucs);
2037
2038 for (j = 0; j < 2; ++j) { 1979 for (j = 0; j < 2; ++j) {
2039 ubc = cs->bcs[j].hw.bas; 1980 ubc = cs->bcs[j].hw.bas;
2040 IFNULLCONT(ubc);
2041 for (i = 0; i < BAS_OUTURBS; ++i) 1981 for (i = 0; i < BAS_OUTURBS; ++i)
2042 if (ubc->isoouturbs[i].urb) { 1982 if (ubc->isoouturbs[i].urb) {
2043 usb_kill_urb(ubc->isoouturbs[i].urb); 1983 usb_kill_urb(ubc->isoouturbs[i].urb);
2044 dbg(DEBUG_INIT, 1984 gig_dbg(DEBUG_INIT,
2045 "%s: isoc output URB %d/%d unlinked", 1985 "%s: isoc output URB %d/%d unlinked",
2046 __func__, j, i); 1986 __func__, j, i);
2047 usb_free_urb(ubc->isoouturbs[i].urb); 1987 usb_free_urb(ubc->isoouturbs[i].urb);
2048 ubc->isoouturbs[i].urb = NULL; 1988 ubc->isoouturbs[i].urb = NULL;
2049 } 1989 }
2050 for (i = 0; i < BAS_INURBS; ++i) 1990 for (i = 0; i < BAS_INURBS; ++i)
2051 if (ubc->isoinurbs[i]) { 1991 if (ubc->isoinurbs[i]) {
2052 usb_kill_urb(ubc->isoinurbs[i]); 1992 usb_kill_urb(ubc->isoinurbs[i]);
2053 dbg(DEBUG_INIT, 1993 gig_dbg(DEBUG_INIT,
2054 "%s: isoc input URB %d/%d unlinked", 1994 "%s: isoc input URB %d/%d unlinked",
2055 __func__, j, i); 1995 __func__, j, i);
2056 usb_free_urb(ubc->isoinurbs[i]); 1996 usb_free_urb(ubc->isoinurbs[i]);
2057 ubc->isoinurbs[i] = NULL; 1997 ubc->isoinurbs[i] = NULL;
2058 } 1998 }
2059 } 1999 }
2060 if (ucs->urb_int_in) { 2000 if (ucs->urb_int_in) {
2061 usb_kill_urb(ucs->urb_int_in); 2001 usb_kill_urb(ucs->urb_int_in);
2062 dbg(DEBUG_INIT, "%s: interrupt input URB unlinked", __func__); 2002 gig_dbg(DEBUG_INIT, "%s: interrupt input URB unlinked",
2003 __func__);
2063 usb_free_urb(ucs->urb_int_in); 2004 usb_free_urb(ucs->urb_int_in);
2064 ucs->urb_int_in = NULL; 2005 ucs->urb_int_in = NULL;
2065 } 2006 }
2066 if (ucs->urb_cmd_out) { 2007 if (ucs->urb_cmd_out) {
2067 usb_kill_urb(ucs->urb_cmd_out); 2008 usb_kill_urb(ucs->urb_cmd_out);
2068 dbg(DEBUG_INIT, "%s: command output URB unlinked", __func__); 2009 gig_dbg(DEBUG_INIT, "%s: command output URB unlinked",
2010 __func__);
2069 usb_free_urb(ucs->urb_cmd_out); 2011 usb_free_urb(ucs->urb_cmd_out);
2070 ucs->urb_cmd_out = NULL; 2012 ucs->urb_cmd_out = NULL;
2071 } 2013 }
2072 if (ucs->urb_cmd_in) { 2014 if (ucs->urb_cmd_in) {
2073 usb_kill_urb(ucs->urb_cmd_in); 2015 usb_kill_urb(ucs->urb_cmd_in);
2074 dbg(DEBUG_INIT, "%s: command input URB unlinked", __func__); 2016 gig_dbg(DEBUG_INIT, "%s: command input URB unlinked",
2017 __func__);
2075 usb_free_urb(ucs->urb_cmd_in); 2018 usb_free_urb(ucs->urb_cmd_in);
2076 ucs->urb_cmd_in = NULL; 2019 ucs->urb_cmd_in = NULL;
2077 } 2020 }
2078 if (ucs->urb_ctrl) { 2021 if (ucs->urb_ctrl) {
2079 usb_kill_urb(ucs->urb_ctrl); 2022 usb_kill_urb(ucs->urb_ctrl);
2080 dbg(DEBUG_INIT, "%s: control output URB unlinked", __func__); 2023 gig_dbg(DEBUG_INIT, "%s: control output URB unlinked",
2024 __func__);
2081 usb_free_urb(ucs->urb_ctrl); 2025 usb_free_urb(ucs->urb_ctrl);
2082 ucs->urb_ctrl = NULL; 2026 ucs->urb_ctrl = NULL;
2083 } 2027 }
@@ -2099,12 +2043,10 @@ static int gigaset_probe(struct usb_interface *interface,
2099 int i, j; 2043 int i, j;
2100 int ret; 2044 int ret;
2101 2045
2102 IFNULLRETVAL(udev, -ENODEV); 2046 gig_dbg(DEBUG_ANY,
2103 2047 "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)",
2104 dbg(DEBUG_ANY, 2048 __func__, le16_to_cpu(udev->descriptor.idVendor),
2105 "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", 2049 le16_to_cpu(udev->descriptor.idProduct));
2106 __func__, le16_to_cpu(udev->descriptor.idVendor),
2107 le16_to_cpu(udev->descriptor.idProduct));
2108 2050
2109 /* See if the device offered us matches what we can accept */ 2051 /* See if the device offered us matches what we can accept */
2110 if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) || 2052 if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) ||
@@ -2112,20 +2054,21 @@ static int gigaset_probe(struct usb_interface *interface,
2112 le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID && 2054 le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID &&
2113 le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID && 2055 le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID &&
2114 le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) { 2056 le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) {
2115 dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__); 2057 gig_dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__);
2116 return -ENODEV; 2058 return -ENODEV;
2117 } 2059 }
2118 2060
2119 /* set required alternate setting */ 2061 /* set required alternate setting */
2120 hostif = interface->cur_altsetting; 2062 hostif = interface->cur_altsetting;
2121 if (hostif->desc.bAlternateSetting != 3) { 2063 if (hostif->desc.bAlternateSetting != 3) {
2122 dbg(DEBUG_ANY, 2064 gig_dbg(DEBUG_ANY,
2123 "%s: wrong alternate setting %d - trying to switch", 2065 "%s: wrong alternate setting %d - trying to switch",
2124 __func__, hostif->desc.bAlternateSetting); 2066 __func__, hostif->desc.bAlternateSetting);
2125 if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) < 0) { 2067 if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) < 0) {
2126 warn("usb_set_interface failed, device %d interface %d altsetting %d", 2068 dev_warn(&udev->dev, "usb_set_interface failed, "
2127 udev->devnum, hostif->desc.bInterfaceNumber, 2069 "device %d interface %d altsetting %d\n",
2128 hostif->desc.bAlternateSetting); 2070 udev->devnum, hostif->desc.bInterfaceNumber,
2071 hostif->desc.bAlternateSetting);
2129 return -ENODEV; 2072 return -ENODEV;
2130 } 2073 }
2131 hostif = interface->cur_altsetting; 2074 hostif = interface->cur_altsetting;
@@ -2134,23 +2077,28 @@ static int gigaset_probe(struct usb_interface *interface,
2134 /* Reject application specific interfaces 2077 /* Reject application specific interfaces
2135 */ 2078 */
2136 if (hostif->desc.bInterfaceClass != 255) { 2079 if (hostif->desc.bInterfaceClass != 255) {
2137 warn("%s: bInterfaceClass == %d", 2080 dev_warn(&udev->dev, "%s: bInterfaceClass == %d\n",
2138 __func__, hostif->desc.bInterfaceClass); 2081 __func__, hostif->desc.bInterfaceClass);
2139 return -ENODEV; 2082 return -ENODEV;
2140 } 2083 }
2141 2084
2142 info("%s: Device matched (Vendor: 0x%x, Product: 0x%x)", 2085 dev_info(&udev->dev,
2143 __func__, le16_to_cpu(udev->descriptor.idVendor), 2086 "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n",
2144 le16_to_cpu(udev->descriptor.idProduct)); 2087 __func__, le16_to_cpu(udev->descriptor.idVendor),
2088 le16_to_cpu(udev->descriptor.idProduct));
2145 2089
2146 cs = gigaset_getunassignedcs(driver); 2090 cs = gigaset_getunassignedcs(driver);
2147 if (!cs) { 2091 if (!cs) {
2148 err("%s: no free cardstate", __func__); 2092 dev_err(&udev->dev, "no free cardstate\n");
2149 return -ENODEV; 2093 return -ENODEV;
2150 } 2094 }
2151 ucs = cs->hw.bas; 2095 ucs = cs->hw.bas;
2096
2097 /* save off device structure ptrs for later use */
2098 usb_get_dev(udev);
2152 ucs->udev = udev; 2099 ucs->udev = udev;
2153 ucs->interface = interface; 2100 ucs->interface = interface;
2101 cs->dev = &interface->dev;
2154 2102
2155 /* allocate URBs: 2103 /* allocate URBs:
2156 * - one for the interrupt pipe 2104 * - one for the interrupt pipe
@@ -2159,22 +2107,22 @@ static int gigaset_probe(struct usb_interface *interface,
2159 */ 2107 */
2160 ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL); 2108 ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL);
2161 if (!ucs->urb_int_in) { 2109 if (!ucs->urb_int_in) {
2162 err("No free urbs available"); 2110 dev_err(cs->dev, "no free urbs available\n");
2163 goto error; 2111 goto error;
2164 } 2112 }
2165 ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL); 2113 ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL);
2166 if (!ucs->urb_cmd_in) { 2114 if (!ucs->urb_cmd_in) {
2167 err("No free urbs available"); 2115 dev_err(cs->dev, "no free urbs available\n");
2168 goto error; 2116 goto error;
2169 } 2117 }
2170 ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL); 2118 ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL);
2171 if (!ucs->urb_cmd_out) { 2119 if (!ucs->urb_cmd_out) {
2172 err("No free urbs available"); 2120 dev_err(cs->dev, "no free urbs available\n");
2173 goto error; 2121 goto error;
2174 } 2122 }
2175 ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL); 2123 ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL);
2176 if (!ucs->urb_ctrl) { 2124 if (!ucs->urb_ctrl) {
2177 err("No free urbs available"); 2125 dev_err(cs->dev, "no free urbs available\n");
2178 goto error; 2126 goto error;
2179 } 2127 }
2180 2128
@@ -2184,7 +2132,7 @@ static int gigaset_probe(struct usb_interface *interface,
2184 ubc->isoouturbs[i].urb = 2132 ubc->isoouturbs[i].urb =
2185 usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); 2133 usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL);
2186 if (!ubc->isoouturbs[i].urb) { 2134 if (!ubc->isoouturbs[i].urb) {
2187 err("No free urbs available"); 2135 dev_err(cs->dev, "no free urbs available\n");
2188 goto error; 2136 goto error;
2189 } 2137 }
2190 } 2138 }
@@ -2192,7 +2140,7 @@ static int gigaset_probe(struct usb_interface *interface,
2192 ubc->isoinurbs[i] = 2140 ubc->isoinurbs[i] =
2193 usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); 2141 usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL);
2194 if (!ubc->isoinurbs[i]) { 2142 if (!ubc->isoinurbs[i]) {
2195 err("No free urbs available"); 2143 dev_err(cs->dev, "no free urbs available\n");
2196 goto error; 2144 goto error;
2197 } 2145 }
2198 } 2146 }
@@ -2204,13 +2152,14 @@ static int gigaset_probe(struct usb_interface *interface,
2204 /* Fill the interrupt urb and send it to the core */ 2152 /* Fill the interrupt urb and send it to the core */
2205 endpoint = &hostif->endpoint[0].desc; 2153 endpoint = &hostif->endpoint[0].desc;
2206 usb_fill_int_urb(ucs->urb_int_in, udev, 2154 usb_fill_int_urb(ucs->urb_int_in, udev,
2207 usb_rcvintpipe(udev, 2155 usb_rcvintpipe(udev,
2208 (endpoint->bEndpointAddress) & 0x0f), 2156 (endpoint->bEndpointAddress) & 0x0f),
2209 ucs->int_in_buf, 3, read_int_callback, cs, 2157 ucs->int_in_buf, 3, read_int_callback, cs,
2210 endpoint->bInterval); 2158 endpoint->bInterval);
2211 ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL); 2159 ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL);
2212 if (ret) { 2160 if (ret) {
2213 err("could not submit interrupt URB: %s", get_usb_statmsg(ret)); 2161 dev_err(cs->dev, "could not submit interrupt URB: %s\n",
2162 get_usb_statmsg(ret));
2214 goto error; 2163 goto error;
2215 } 2164 }
2216 2165
@@ -2221,18 +2170,18 @@ static int gigaset_probe(struct usb_interface *interface,
2221 /* tell common part that the device is ready */ 2170 /* tell common part that the device is ready */
2222 if (startmode == SM_LOCKED) 2171 if (startmode == SM_LOCKED)
2223 atomic_set(&cs->mstate, MS_LOCKED); 2172 atomic_set(&cs->mstate, MS_LOCKED);
2224 if (!gigaset_start(cs))
2225 goto error;
2226 2173
2227 /* save address of controller structure */ 2174 /* save address of controller structure */
2228 usb_set_intfdata(interface, cs); 2175 usb_set_intfdata(interface, cs);
2229 2176
2230 /* set up device sysfs */ 2177 if (!gigaset_start(cs))
2231 gigaset_init_dev_sysfs(interface); 2178 goto error;
2179
2232 return 0; 2180 return 0;
2233 2181
2234error: 2182error:
2235 freeurbs(cs); 2183 freeurbs(cs);
2184 usb_set_intfdata(interface, NULL);
2236 gigaset_unassign(cs); 2185 gigaset_unassign(cs);
2237 return -ENODEV; 2186 return -ENODEV;
2238} 2187}
@@ -2245,23 +2194,22 @@ static void gigaset_disconnect(struct usb_interface *interface)
2245 struct cardstate *cs; 2194 struct cardstate *cs;
2246 struct bas_cardstate *ucs; 2195 struct bas_cardstate *ucs;
2247 2196
2248 /* clear device sysfs */
2249 gigaset_free_dev_sysfs(interface);
2250
2251 cs = usb_get_intfdata(interface); 2197 cs = usb_get_intfdata(interface);
2252 usb_set_intfdata(interface, NULL);
2253 2198
2254 IFNULLRET(cs);
2255 ucs = cs->hw.bas; 2199 ucs = cs->hw.bas;
2256 IFNULLRET(ucs);
2257 2200
2258 info("disconnecting GigaSet base"); 2201 dev_info(cs->dev, "disconnecting Gigaset base\n");
2259 gigaset_stop(cs); 2202 gigaset_stop(cs);
2260 freeurbs(cs); 2203 freeurbs(cs);
2204 usb_set_intfdata(interface, NULL);
2261 kfree(ucs->rcvbuf); 2205 kfree(ucs->rcvbuf);
2262 ucs->rcvbuf = NULL; 2206 ucs->rcvbuf = NULL;
2263 ucs->rcvbuf_size = 0; 2207 ucs->rcvbuf_size = 0;
2264 atomic_set(&ucs->basstate, 0); 2208 atomic_set(&ucs->basstate, 0);
2209 usb_put_dev(ucs->udev);
2210 ucs->interface = NULL;
2211 ucs->udev = NULL;
2212 cs->dev = NULL;
2265 gigaset_unassign(cs); 2213 gigaset_unassign(cs);
2266} 2214}
2267 2215
@@ -2293,13 +2241,14 @@ static int __init bas_gigaset_init(void)
2293 2241
2294 /* allocate memory for our driver state and intialize it */ 2242 /* allocate memory for our driver state and intialize it */
2295 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 2243 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
2296 GIGASET_MODULENAME, GIGASET_DEVNAME, 2244 GIGASET_MODULENAME, GIGASET_DEVNAME,
2297 GIGASET_DEVFSNAME, &gigops, 2245 GIGASET_DEVFSNAME, &gigops,
2298 THIS_MODULE)) == NULL) 2246 THIS_MODULE)) == NULL)
2299 goto error; 2247 goto error;
2300 2248
2301 /* allocate memory for our device state and intialize it */ 2249 /* allocate memory for our device state and intialize it */
2302 cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode, GIGASET_MODULENAME); 2250 cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode,
2251 GIGASET_MODULENAME);
2303 if (!cardstate) 2252 if (!cardstate)
2304 goto error; 2253 goto error;
2305 2254
@@ -2329,19 +2278,18 @@ error: if (cardstate)
2329static void __exit bas_gigaset_exit(void) 2278static void __exit bas_gigaset_exit(void)
2330{ 2279{
2331 gigaset_blockdriver(driver); /* => probe will fail 2280 gigaset_blockdriver(driver); /* => probe will fail
2332 * => no gigaset_start any more 2281 * => no gigaset_start any more
2333 */ 2282 */
2334 2283
2335 gigaset_shutdown(cardstate); 2284 gigaset_shutdown(cardstate);
2336 /* from now on, no isdn callback should be possible */ 2285 /* from now on, no isdn callback should be possible */
2337 2286
2338 if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) { 2287 if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) {
2339 dbg(DEBUG_ANY, "closing AT channel"); 2288 gig_dbg(DEBUG_ANY, "closing AT channel");
2340 if (req_submit(cardstate->bcs, 2289 if (req_submit(cardstate->bcs,
2341 HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) { 2290 HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) {
2342 /* successfully submitted - wait for completion */ 2291 /* successfully submitted */
2343 //wait_event_interruptible(cs->initwait, !cs->hw.bas->pending); 2292 //FIXME wait for completion?
2344 //FIXME need own wait queue? wakeup?
2345 } 2293 }
2346 } 2294 }
2347 2295
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 64371995c1a9..749b3da1236e 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Stuff used by all variants of the driver 2 * Stuff used by all variants of the driver
3 * 3 *
4 * Copyright (c) 2001 by Stefan Eilers <Eilers.Stefan@epost.de>, 4 * Copyright (c) 2001 by Stefan Eilers,
5 * Hansjoerg Lipp <hjlipp@web.de>, 5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Tilman Schmidt <tilman@imap.cc>. 6 * Tilman Schmidt <tilman@imap.cc>.
7 * 7 *
@@ -11,10 +11,6 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: common.c,v 1.104.4.22 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
@@ -23,7 +19,7 @@
23#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
24 20
25/* Version Information */ 21/* Version Information */
26#define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Tilman Schmidt <tilman@imap.cc>, Stefan Eilers <Eilers.Stefan@epost.de>" 22#define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Tilman Schmidt <tilman@imap.cc>, Stefan Eilers"
27#define DRIVER_DESC "Driver for Gigaset 307x" 23#define DRIVER_DESC "Driver for Gigaset 307x"
28 24
29/* Module parameters */ 25/* Module parameters */
@@ -32,21 +28,10 @@ EXPORT_SYMBOL_GPL(gigaset_debuglevel);
32module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR); 28module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR);
33MODULE_PARM_DESC(debug, "debug level"); 29MODULE_PARM_DESC(debug, "debug level");
34 30
35/*====================================================================== 31/* driver state flags */
36 Prototypes of internal functions 32#define VALID_MINOR 0x01
37 */ 33#define VALID_ID 0x02
38 34#define ASSIGNED 0x04
39//static void gigaset_process_response(int resp_code, int parameter,
40// struct at_state_t *at_state,
41// unsigned char ** pstring);
42static struct cardstate *alloc_cs(struct gigaset_driver *drv);
43static void free_cs(struct cardstate *cs);
44static void make_valid(struct cardstate *cs, unsigned mask);
45static void make_invalid(struct cardstate *cs, unsigned mask);
46
47#define VALID_MINOR 0x01
48#define VALID_ID 0x02
49#define ASSIGNED 0x04
50 35
51/* bitwise byte inversion table */ 36/* bitwise byte inversion table */
52__u8 gigaset_invtab[256] = { 37__u8 gigaset_invtab[256] = {
@@ -86,42 +71,40 @@ __u8 gigaset_invtab[256] = {
86EXPORT_SYMBOL_GPL(gigaset_invtab); 71EXPORT_SYMBOL_GPL(gigaset_invtab);
87 72
88void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, 73void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
89 size_t len, const unsigned char *buf, int from_user) 74 size_t len, const unsigned char *buf)
90{ 75{
91 unsigned char outbuf[80]; 76 unsigned char outbuf[80];
92 unsigned char inbuf[80 - 1]; 77 unsigned char c;
93 size_t numin;
94 const unsigned char *in;
95 size_t space = sizeof outbuf - 1; 78 size_t space = sizeof outbuf - 1;
96 unsigned char *out = outbuf; 79 unsigned char *out = outbuf;
80 size_t numin = len;
97 81
98 if (!from_user) { 82 while (numin--) {
99 in = buf; 83 c = *buf++;
100 numin = len; 84 if (c == '~' || c == '^' || c == '\\') {
101 } else { 85 if (!space--)
102 numin = len < sizeof inbuf ? len : sizeof inbuf; 86 break;
103 in = inbuf; 87 *out++ = '\\';
104 if (copy_from_user(inbuf, (const unsigned char __user *) buf, numin)) {
105 strncpy(inbuf, "<FAULT>", sizeof inbuf);
106 numin = sizeof "<FAULT>" - 1;
107 } 88 }
108 } 89 if (c & 0x80) {
109 90 if (!space--)
110 for (; numin && space; --numin, ++in) { 91 break;
111 --space; 92 *out++ = '~';
112 if (*in >= 32) 93 c ^= 0x80;
113 *out++ = *in; 94 }
114 else { 95 if (c < 0x20 || c == 0x7f) {
96 if (!space--)
97 break;
115 *out++ = '^'; 98 *out++ = '^';
116 if (space) { 99 c ^= 0x40;
117 *out++ = '@' + *in;
118 --space;
119 }
120 } 100 }
101 if (!space--)
102 break;
103 *out++ = c;
121 } 104 }
122 *out = 0; 105 *out = 0;
123 106
124 dbg(level, "%s (%u bytes): %s", msg, (unsigned) len, outbuf); 107 gig_dbg(level, "%s (%u bytes): %s", msg, (unsigned) len, outbuf);
125} 108}
126EXPORT_SYMBOL_GPL(gigaset_dbg_buffer); 109EXPORT_SYMBOL_GPL(gigaset_dbg_buffer);
127 110
@@ -146,11 +129,6 @@ int gigaset_enterconfigmode(struct cardstate *cs)
146{ 129{
147 int i, r; 130 int i, r;
148 131
149 if (!atomic_read(&cs->connected)) {
150 err("not connected!");
151 return -1;
152 }
153
154 cs->control_state = TIOCM_RTS; //FIXME 132 cs->control_state = TIOCM_RTS; //FIXME
155 133
156 r = setflags(cs, TIOCM_DTR, 200); 134 r = setflags(cs, TIOCM_DTR, 200);
@@ -174,7 +152,7 @@ int gigaset_enterconfigmode(struct cardstate *cs)
174 return 0; 152 return 0;
175 153
176error: 154error:
177 err("error %d on setuartbits!\n", -r); 155 dev_err(cs->dev, "error %d on setuartbits\n", -r);
178 cs->control_state = TIOCM_RTS|TIOCM_DTR; // FIXME is this a good value? 156 cs->control_state = TIOCM_RTS|TIOCM_DTR; // FIXME is this a good value?
179 cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR); 157 cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR);
180 158
@@ -187,13 +165,13 @@ static int test_timeout(struct at_state_t *at_state)
187 return 0; 165 return 0;
188 166
189 if (--at_state->timer_expires) { 167 if (--at_state->timer_expires) {
190 dbg(DEBUG_MCMD, "decreased timer of %p to %lu", 168 gig_dbg(DEBUG_MCMD, "decreased timer of %p to %lu",
191 at_state, at_state->timer_expires); 169 at_state, at_state->timer_expires);
192 return 0; 170 return 0;
193 } 171 }
194 172
195 if (!gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL, 173 if (!gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL,
196 atomic_read(&at_state->timer_index), NULL)) { 174 at_state->timer_index, NULL)) {
197 //FIXME what should we do? 175 //FIXME what should we do?
198 } 176 }
199 177
@@ -221,10 +199,10 @@ static void timer_tick(unsigned long data)
221 if (test_timeout(at_state)) 199 if (test_timeout(at_state))
222 timeout = 1; 200 timeout = 1;
223 201
224 if (atomic_read(&cs->running)) { 202 if (cs->running) {
225 mod_timer(&cs->timer, jiffies + GIG_TICK); 203 mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK));
226 if (timeout) { 204 if (timeout) {
227 dbg(DEBUG_CMD, "scheduling timeout"); 205 gig_dbg(DEBUG_CMD, "scheduling timeout");
228 tasklet_schedule(&cs->event_tasklet); 206 tasklet_schedule(&cs->event_tasklet);
229 } 207 }
230 } 208 }
@@ -238,13 +216,14 @@ int gigaset_get_channel(struct bc_state *bcs)
238 216
239 spin_lock_irqsave(&bcs->cs->lock, flags); 217 spin_lock_irqsave(&bcs->cs->lock, flags);
240 if (bcs->use_count) { 218 if (bcs->use_count) {
241 dbg(DEBUG_ANY, "could not allocate channel %d", bcs->channel); 219 gig_dbg(DEBUG_ANY, "could not allocate channel %d",
220 bcs->channel);
242 spin_unlock_irqrestore(&bcs->cs->lock, flags); 221 spin_unlock_irqrestore(&bcs->cs->lock, flags);
243 return 0; 222 return 0;
244 } 223 }
245 ++bcs->use_count; 224 ++bcs->use_count;
246 bcs->busy = 1; 225 bcs->busy = 1;
247 dbg(DEBUG_ANY, "allocated channel %d", bcs->channel); 226 gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
248 spin_unlock_irqrestore(&bcs->cs->lock, flags); 227 spin_unlock_irqrestore(&bcs->cs->lock, flags);
249 return 1; 228 return 1;
250} 229}
@@ -255,13 +234,13 @@ void gigaset_free_channel(struct bc_state *bcs)
255 234
256 spin_lock_irqsave(&bcs->cs->lock, flags); 235 spin_lock_irqsave(&bcs->cs->lock, flags);
257 if (!bcs->busy) { 236 if (!bcs->busy) {
258 dbg(DEBUG_ANY, "could not free channel %d", bcs->channel); 237 gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
259 spin_unlock_irqrestore(&bcs->cs->lock, flags); 238 spin_unlock_irqrestore(&bcs->cs->lock, flags);
260 return; 239 return;
261 } 240 }
262 --bcs->use_count; 241 --bcs->use_count;
263 bcs->busy = 0; 242 bcs->busy = 0;
264 dbg(DEBUG_ANY, "freed channel %d", bcs->channel); 243 gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
265 spin_unlock_irqrestore(&bcs->cs->lock, flags); 244 spin_unlock_irqrestore(&bcs->cs->lock, flags);
266} 245}
267 246
@@ -274,14 +253,14 @@ int gigaset_get_channels(struct cardstate *cs)
274 for (i = 0; i < cs->channels; ++i) 253 for (i = 0; i < cs->channels; ++i)
275 if (cs->bcs[i].use_count) { 254 if (cs->bcs[i].use_count) {
276 spin_unlock_irqrestore(&cs->lock, flags); 255 spin_unlock_irqrestore(&cs->lock, flags);
277 dbg(DEBUG_ANY, "could not allocated all channels"); 256 gig_dbg(DEBUG_ANY, "could not allocate all channels");
278 return 0; 257 return 0;
279 } 258 }
280 for (i = 0; i < cs->channels; ++i) 259 for (i = 0; i < cs->channels; ++i)
281 ++cs->bcs[i].use_count; 260 ++cs->bcs[i].use_count;
282 spin_unlock_irqrestore(&cs->lock, flags); 261 spin_unlock_irqrestore(&cs->lock, flags);
283 262
284 dbg(DEBUG_ANY, "allocated all channels"); 263 gig_dbg(DEBUG_ANY, "allocated all channels");
285 264
286 return 1; 265 return 1;
287} 266}
@@ -291,7 +270,7 @@ void gigaset_free_channels(struct cardstate *cs)
291 unsigned long flags; 270 unsigned long flags;
292 int i; 271 int i;
293 272
294 dbg(DEBUG_ANY, "unblocking all channels"); 273 gig_dbg(DEBUG_ANY, "unblocking all channels");
295 spin_lock_irqsave(&cs->lock, flags); 274 spin_lock_irqsave(&cs->lock, flags);
296 for (i = 0; i < cs->channels; ++i) 275 for (i = 0; i < cs->channels; ++i)
297 --cs->bcs[i].use_count; 276 --cs->bcs[i].use_count;
@@ -303,7 +282,7 @@ void gigaset_block_channels(struct cardstate *cs)
303 unsigned long flags; 282 unsigned long flags;
304 int i; 283 int i;
305 284
306 dbg(DEBUG_ANY, "blocking all channels"); 285 gig_dbg(DEBUG_ANY, "blocking all channels");
307 spin_lock_irqsave(&cs->lock, flags); 286 spin_lock_irqsave(&cs->lock, flags);
308 for (i = 0; i < cs->channels; ++i) 287 for (i = 0; i < cs->channels; ++i)
309 ++cs->bcs[i].use_count; 288 ++cs->bcs[i].use_count;
@@ -314,25 +293,27 @@ static void clear_events(struct cardstate *cs)
314{ 293{
315 struct event_t *ev; 294 struct event_t *ev;
316 unsigned head, tail; 295 unsigned head, tail;
296 unsigned long flags;
317 297
318 /* no locking needed (no reader/writer allowed) */ 298 spin_lock_irqsave(&cs->ev_lock, flags);
319 299
320 head = atomic_read(&cs->ev_head); 300 head = cs->ev_head;
321 tail = atomic_read(&cs->ev_tail); 301 tail = cs->ev_tail;
322 302
323 while (tail != head) { 303 while (tail != head) {
324 ev = cs->events + head; 304 ev = cs->events + head;
325 kfree(ev->ptr); 305 kfree(ev->ptr);
326
327 head = (head + 1) % MAX_EVENTS; 306 head = (head + 1) % MAX_EVENTS;
328 } 307 }
329 308
330 atomic_set(&cs->ev_head, tail); 309 cs->ev_head = tail;
310
311 spin_unlock_irqrestore(&cs->ev_lock, flags);
331} 312}
332 313
333struct event_t *gigaset_add_event(struct cardstate *cs, 314struct event_t *gigaset_add_event(struct cardstate *cs,
334 struct at_state_t *at_state, int type, 315 struct at_state_t *at_state, int type,
335 void *ptr, int parameter, void *arg) 316 void *ptr, int parameter, void *arg)
336{ 317{
337 unsigned long flags; 318 unsigned long flags;
338 unsigned next, tail; 319 unsigned next, tail;
@@ -340,9 +321,9 @@ struct event_t *gigaset_add_event(struct cardstate *cs,
340 321
341 spin_lock_irqsave(&cs->ev_lock, flags); 322 spin_lock_irqsave(&cs->ev_lock, flags);
342 323
343 tail = atomic_read(&cs->ev_tail); 324 tail = cs->ev_tail;
344 next = (tail + 1) % MAX_EVENTS; 325 next = (tail + 1) % MAX_EVENTS;
345 if (unlikely(next == atomic_read(&cs->ev_head))) 326 if (unlikely(next == cs->ev_head))
346 err("event queue full"); 327 err("event queue full");
347 else { 328 else {
348 event = cs->events + tail; 329 event = cs->events + tail;
@@ -352,7 +333,7 @@ struct event_t *gigaset_add_event(struct cardstate *cs,
352 event->ptr = ptr; 333 event->ptr = ptr;
353 event->arg = arg; 334 event->arg = arg;
354 event->parameter = parameter; 335 event->parameter = parameter;
355 atomic_set(&cs->ev_tail, next); 336 cs->ev_tail = next;
356 } 337 }
357 338
358 spin_unlock_irqrestore(&cs->ev_lock, flags); 339 spin_unlock_irqrestore(&cs->ev_lock, flags);
@@ -391,14 +372,14 @@ static void gigaset_freebcs(struct bc_state *bcs)
391{ 372{
392 int i; 373 int i;
393 374
394 dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel); 375 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
395 if (!bcs->cs->ops->freebcshw(bcs)) { 376 if (!bcs->cs->ops->freebcshw(bcs)) {
396 dbg(DEBUG_INIT, "failed"); 377 gig_dbg(DEBUG_INIT, "failed");
397 } 378 }
398 379
399 dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); 380 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
400 clear_at_state(&bcs->at_state); 381 clear_at_state(&bcs->at_state);
401 dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); 382 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
402 383
403 if (bcs->skb) 384 if (bcs->skb)
404 dev_kfree_skb(bcs->skb); 385 dev_kfree_skb(bcs->skb);
@@ -408,6 +389,52 @@ static void gigaset_freebcs(struct bc_state *bcs)
408 } 389 }
409} 390}
410 391
392static struct cardstate *alloc_cs(struct gigaset_driver *drv)
393{
394 unsigned long flags;
395 unsigned i;
396 static struct cardstate *ret = NULL;
397
398 spin_lock_irqsave(&drv->lock, flags);
399 for (i = 0; i < drv->minors; ++i) {
400 if (!(drv->flags[i] & VALID_MINOR)) {
401 drv->flags[i] = VALID_MINOR;
402 ret = drv->cs + i;
403 }
404 if (ret)
405 break;
406 }
407 spin_unlock_irqrestore(&drv->lock, flags);
408 return ret;
409}
410
411static void free_cs(struct cardstate *cs)
412{
413 unsigned long flags;
414 struct gigaset_driver *drv = cs->driver;
415 spin_lock_irqsave(&drv->lock, flags);
416 drv->flags[cs->minor_index] = 0;
417 spin_unlock_irqrestore(&drv->lock, flags);
418}
419
420static void make_valid(struct cardstate *cs, unsigned mask)
421{
422 unsigned long flags;
423 struct gigaset_driver *drv = cs->driver;
424 spin_lock_irqsave(&drv->lock, flags);
425 drv->flags[cs->minor_index] |= mask;
426 spin_unlock_irqrestore(&drv->lock, flags);
427}
428
429static void make_invalid(struct cardstate *cs, unsigned mask)
430{
431 unsigned long flags;
432 struct gigaset_driver *drv = cs->driver;
433 spin_lock_irqsave(&drv->lock, flags);
434 drv->flags[cs->minor_index] &= ~mask;
435 spin_unlock_irqrestore(&drv->lock, flags);
436}
437
411void gigaset_freecs(struct cardstate *cs) 438void gigaset_freecs(struct cardstate *cs)
412{ 439{
413 int i; 440 int i;
@@ -416,7 +443,7 @@ void gigaset_freecs(struct cardstate *cs)
416 if (!cs) 443 if (!cs)
417 return; 444 return;
418 445
419 down(&cs->sem); 446 mutex_lock(&cs->mutex);
420 447
421 if (!cs->bcs) 448 if (!cs->bcs)
422 goto f_cs; 449 goto f_cs;
@@ -424,8 +451,9 @@ void gigaset_freecs(struct cardstate *cs)
424 goto f_bcs; 451 goto f_bcs;
425 452
426 spin_lock_irqsave(&cs->lock, flags); 453 spin_lock_irqsave(&cs->lock, flags);
427 atomic_set(&cs->running, 0); 454 cs->running = 0;
428 spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are not rescheduled below */ 455 spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are
456 not rescheduled below */
429 457
430 tasklet_kill(&cs->event_tasklet); 458 tasklet_kill(&cs->event_tasklet);
431 del_timer_sync(&cs->timer); 459 del_timer_sync(&cs->timer);
@@ -434,7 +462,7 @@ void gigaset_freecs(struct cardstate *cs)
434 default: 462 default:
435 gigaset_if_free(cs); 463 gigaset_if_free(cs);
436 464
437 dbg(DEBUG_INIT, "clearing hw"); 465 gig_dbg(DEBUG_INIT, "clearing hw");
438 cs->ops->freecshw(cs); 466 cs->ops->freecshw(cs);
439 467
440 //FIXME cmdbuf 468 //FIXME cmdbuf
@@ -443,36 +471,36 @@ void gigaset_freecs(struct cardstate *cs)
443 case 2: /* error in initcshw */ 471 case 2: /* error in initcshw */
444 /* Deregister from LL */ 472 /* Deregister from LL */
445 make_invalid(cs, VALID_ID); 473 make_invalid(cs, VALID_ID);
446 dbg(DEBUG_INIT, "clearing iif"); 474 gig_dbg(DEBUG_INIT, "clearing iif");
447 gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD); 475 gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);
448 476
449 /* fall through */ 477 /* fall through */
450 case 1: /* error when regestering to LL */ 478 case 1: /* error when regestering to LL */
451 dbg(DEBUG_INIT, "clearing at_state"); 479 gig_dbg(DEBUG_INIT, "clearing at_state");
452 clear_at_state(&cs->at_state); 480 clear_at_state(&cs->at_state);
453 dealloc_at_states(cs); 481 dealloc_at_states(cs);
454 482
455 /* fall through */ 483 /* fall through */
456 case 0: /* error in one call to initbcs */ 484 case 0: /* error in one call to initbcs */
457 for (i = 0; i < cs->channels; ++i) { 485 for (i = 0; i < cs->channels; ++i) {
458 dbg(DEBUG_INIT, "clearing bcs[%d]", i); 486 gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
459 gigaset_freebcs(cs->bcs + i); 487 gigaset_freebcs(cs->bcs + i);
460 } 488 }
461 489
462 clear_events(cs); 490 clear_events(cs);
463 dbg(DEBUG_INIT, "freeing inbuf"); 491 gig_dbg(DEBUG_INIT, "freeing inbuf");
464 kfree(cs->inbuf); 492 kfree(cs->inbuf);
465 } 493 }
466f_bcs: dbg(DEBUG_INIT, "freeing bcs[]"); 494f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
467 kfree(cs->bcs); 495 kfree(cs->bcs);
468f_cs: dbg(DEBUG_INIT, "freeing cs"); 496f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
469 up(&cs->sem); 497 mutex_unlock(&cs->mutex);
470 free_cs(cs); 498 free_cs(cs);
471} 499}
472EXPORT_SYMBOL_GPL(gigaset_freecs); 500EXPORT_SYMBOL_GPL(gigaset_freecs);
473 501
474void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs, 502void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
475 struct cardstate *cs, int cid) 503 struct cardstate *cs, int cid)
476{ 504{
477 int i; 505 int i;
478 506
@@ -482,8 +510,8 @@ void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
482 at_state->pending_commands = 0; 510 at_state->pending_commands = 0;
483 at_state->timer_expires = 0; 511 at_state->timer_expires = 0;
484 at_state->timer_active = 0; 512 at_state->timer_active = 0;
485 atomic_set(&at_state->timer_index, 0); 513 at_state->timer_index = 0;
486 atomic_set(&at_state->seq_index, 0); 514 at_state->seq_index = 0;
487 at_state->ConState = 0; 515 at_state->ConState = 0;
488 for (i = 0; i < STR_NUM; ++i) 516 for (i = 0; i < STR_NUM; ++i)
489 at_state->str_var[i] = NULL; 517 at_state->str_var[i] = NULL;
@@ -501,7 +529,7 @@ void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
501 529
502 530
503static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs, 531static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs,
504 struct cardstate *cs, int inputstate) 532 struct cardstate *cs, int inputstate)
505/* inbuf->read must be allocated before! */ 533/* inbuf->read must be allocated before! */
506{ 534{
507 atomic_set(&inbuf->head, 0); 535 atomic_set(&inbuf->head, 0);
@@ -512,9 +540,50 @@ static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs,
512 inbuf->inputstate = inputstate; 540 inbuf->inputstate = inputstate;
513} 541}
514 542
543/* append received bytes to inbuf */
544int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
545 unsigned numbytes)
546{
547 unsigned n, head, tail, bytesleft;
548
549 gig_dbg(DEBUG_INTR, "received %u bytes", numbytes);
550
551 if (!numbytes)
552 return 0;
553
554 bytesleft = numbytes;
555 tail = atomic_read(&inbuf->tail);
556 head = atomic_read(&inbuf->head);
557 gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
558
559 while (bytesleft) {
560 if (head > tail)
561 n = head - 1 - tail;
562 else if (head == 0)
563 n = (RBUFSIZE-1) - tail;
564 else
565 n = RBUFSIZE - tail;
566 if (!n) {
567 dev_err(inbuf->cs->dev,
568 "buffer overflow (%u bytes lost)", bytesleft);
569 break;
570 }
571 if (n > bytesleft)
572 n = bytesleft;
573 memcpy(inbuf->data + tail, src, n);
574 bytesleft -= n;
575 tail = (tail + n) % RBUFSIZE;
576 src += n;
577 }
578 gig_dbg(DEBUG_INTR, "setting tail to %u", tail);
579 atomic_set(&inbuf->tail, tail);
580 return numbytes != bytesleft;
581}
582EXPORT_SYMBOL_GPL(gigaset_fill_inbuf);
583
515/* Initialize the b-channel structure */ 584/* Initialize the b-channel structure */
516static struct bc_state *gigaset_initbcs(struct bc_state *bcs, 585static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
517 struct cardstate *cs, int channel) 586 struct cardstate *cs, int channel)
518{ 587{
519 int i; 588 int i;
520 589
@@ -526,7 +595,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
526 bcs->trans_down = 0; 595 bcs->trans_down = 0;
527 bcs->trans_up = 0; 596 bcs->trans_up = 0;
528 597
529 dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel); 598 gig_dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel);
530 gigaset_at_init(&bcs->at_state, bcs, cs, -1); 599 gigaset_at_init(&bcs->at_state, bcs, cs, -1);
531 600
532 bcs->rcvbytes = 0; 601 bcs->rcvbytes = 0;
@@ -535,7 +604,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
535 bcs->emptycount = 0; 604 bcs->emptycount = 0;
536#endif 605#endif
537 606
538 dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel); 607 gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel);
539 bcs->fcs = PPP_INITFCS; 608 bcs->fcs = PPP_INITFCS;
540 bcs->inputstate = 0; 609 bcs->inputstate = 0;
541 if (cs->ignoreframes) { 610 if (cs->ignoreframes) {
@@ -544,7 +613,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
544 } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 613 } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
545 skb_reserve(bcs->skb, HW_HDR_LEN); 614 skb_reserve(bcs->skb, HW_HDR_LEN);
546 else { 615 else {
547 warn("could not allocate skb"); 616 dev_warn(cs->dev, "could not allocate skb\n");
548 bcs->inputstate |= INS_skip_frame; 617 bcs->inputstate |= INS_skip_frame;
549 } 618 }
550 619
@@ -559,14 +628,13 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
559 for (i = 0; i < AT_NUM; ++i) 628 for (i = 0; i < AT_NUM; ++i)
560 bcs->commands[i] = NULL; 629 bcs->commands[i] = NULL;
561 630
562 dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); 631 gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel);
563 if (cs->ops->initbcshw(bcs)) 632 if (cs->ops->initbcshw(bcs))
564 return bcs; 633 return bcs;
565 634
566//error: 635 gig_dbg(DEBUG_INIT, " failed");
567 dbg(DEBUG_INIT, " failed");
568 636
569 dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); 637 gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
570 if (bcs->skb) 638 if (bcs->skb)
571 dev_kfree_skb(bcs->skb); 639 dev_kfree_skb(bcs->skb);
572 640
@@ -578,9 +646,10 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
578 * Calls hardware dependent gigaset_initcshw() function 646 * Calls hardware dependent gigaset_initcshw() function
579 * Calls B channel initialization function gigaset_initbcs() for each B channel 647 * Calls B channel initialization function gigaset_initbcs() for each B channel
580 * parameters: 648 * parameters:
581 * drv hardware driver the device belongs to 649 * drv hardware driver the device belongs to
582 * channels number of B channels supported by device 650 * channels number of B channels supported by device
583 * onechannel !=0: B channel data and AT commands share one communication channel 651 * onechannel !=0: B channel data and AT commands share one
652 * communication channel
584 * ==0: B channels have separate communication channels 653 * ==0: B channels have separate communication channels
585 * ignoreframes number of frames to ignore after setting up B channel 654 * ignoreframes number of frames to ignore after setting up B channel
586 * cidmode !=0: start in CallID mode 655 * cidmode !=0: start in CallID mode
@@ -593,17 +662,18 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
593 int cidmode, const char *modulename) 662 int cidmode, const char *modulename)
594{ 663{
595 struct cardstate *cs = NULL; 664 struct cardstate *cs = NULL;
665 unsigned long flags;
596 int i; 666 int i;
597 667
598 dbg(DEBUG_INIT, "allocating cs"); 668 gig_dbg(DEBUG_INIT, "allocating cs");
599 cs = alloc_cs(drv); 669 cs = alloc_cs(drv);
600 if (!cs) 670 if (!cs)
601 goto error; 671 goto error;
602 dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1); 672 gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
603 cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL); 673 cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
604 if (!cs->bcs) 674 if (!cs->bcs)
605 goto error; 675 goto error;
606 dbg(DEBUG_INIT, "allocating inbuf"); 676 gig_dbg(DEBUG_INIT, "allocating inbuf");
607 cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL); 677 cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
608 if (!cs->inbuf) 678 if (!cs->inbuf)
609 goto error; 679 goto error;
@@ -613,19 +683,23 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
613 cs->onechannel = onechannel; 683 cs->onechannel = onechannel;
614 cs->ignoreframes = ignoreframes; 684 cs->ignoreframes = ignoreframes;
615 INIT_LIST_HEAD(&cs->temp_at_states); 685 INIT_LIST_HEAD(&cs->temp_at_states);
616 atomic_set(&cs->running, 0); 686 cs->running = 0;
617 init_timer(&cs->timer); /* clear next & prev */ 687 init_timer(&cs->timer); /* clear next & prev */
618 spin_lock_init(&cs->ev_lock); 688 spin_lock_init(&cs->ev_lock);
619 atomic_set(&cs->ev_tail, 0); 689 cs->ev_tail = 0;
620 atomic_set(&cs->ev_head, 0); 690 cs->ev_head = 0;
621 init_MUTEX_LOCKED(&cs->sem); 691 mutex_init(&cs->mutex);
622 tasklet_init(&cs->event_tasklet, &gigaset_handle_event, (unsigned long) cs); 692 mutex_lock(&cs->mutex);
693
694 tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
695 (unsigned long) cs);
623 atomic_set(&cs->commands_pending, 0); 696 atomic_set(&cs->commands_pending, 0);
624 cs->cur_at_seq = 0; 697 cs->cur_at_seq = 0;
625 cs->gotfwver = -1; 698 cs->gotfwver = -1;
626 cs->open_count = 0; 699 cs->open_count = 0;
700 cs->dev = NULL;
627 cs->tty = NULL; 701 cs->tty = NULL;
628 atomic_set(&cs->cidmode, cidmode != 0); 702 cs->cidmode = cidmode != 0;
629 703
630 //if(onechannel) { //FIXME 704 //if(onechannel) { //FIXME
631 cs->tabnocid = gigaset_tab_nocid_m10x; 705 cs->tabnocid = gigaset_tab_nocid_m10x;
@@ -642,50 +716,43 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
642 atomic_set(&cs->mstate, MS_UNINITIALIZED); 716 atomic_set(&cs->mstate, MS_UNINITIALIZED);
643 717
644 for (i = 0; i < channels; ++i) { 718 for (i = 0; i < channels; ++i) {
645 dbg(DEBUG_INIT, "setting up bcs[%d].read", i); 719 gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
646 if (!gigaset_initbcs(cs->bcs + i, cs, i)) 720 if (!gigaset_initbcs(cs->bcs + i, cs, i))
647 goto error; 721 goto error;
648 } 722 }
649 723
650 ++cs->cs_init; 724 ++cs->cs_init;
651 725
652 dbg(DEBUG_INIT, "setting up at_state"); 726 gig_dbg(DEBUG_INIT, "setting up at_state");
653 spin_lock_init(&cs->lock); 727 spin_lock_init(&cs->lock);
654 gigaset_at_init(&cs->at_state, NULL, cs, 0); 728 gigaset_at_init(&cs->at_state, NULL, cs, 0);
655 cs->dle = 0; 729 cs->dle = 0;
656 cs->cbytes = 0; 730 cs->cbytes = 0;
657 731
658 dbg(DEBUG_INIT, "setting up inbuf"); 732 gig_dbg(DEBUG_INIT, "setting up inbuf");
659 if (onechannel) { //FIXME distinction necessary? 733 if (onechannel) { //FIXME distinction necessary?
660 gigaset_inbuf_init(cs->inbuf, cs->bcs, cs, INS_command); 734 gigaset_inbuf_init(cs->inbuf, cs->bcs, cs, INS_command);
661 } else 735 } else
662 gigaset_inbuf_init(cs->inbuf, NULL, cs, INS_command); 736 gigaset_inbuf_init(cs->inbuf, NULL, cs, INS_command);
663 737
664 atomic_set(&cs->connected, 0); 738 cs->connected = 0;
739 cs->isdn_up = 0;
665 740
666 dbg(DEBUG_INIT, "setting up cmdbuf"); 741 gig_dbg(DEBUG_INIT, "setting up cmdbuf");
667 cs->cmdbuf = cs->lastcmdbuf = NULL; 742 cs->cmdbuf = cs->lastcmdbuf = NULL;
668 spin_lock_init(&cs->cmdlock); 743 spin_lock_init(&cs->cmdlock);
669 cs->curlen = 0; 744 cs->curlen = 0;
670 cs->cmdbytes = 0; 745 cs->cmdbytes = 0;
671 746
672 /* 747 gig_dbg(DEBUG_INIT, "setting up iif");
673 * Tell the ISDN4Linux subsystem (the LL) that
674 * a driver for a USB-Device is available !
675 * If this is done, "isdnctrl" is able to bind a device for this driver even
676 * if no physical usb-device is currently connected.
677 * But this device will just be accessable if a physical USB device is connected
678 * (via "gigaset_probe") .
679 */
680 dbg(DEBUG_INIT, "setting up iif");
681 if (!gigaset_register_to_LL(cs, modulename)) { 748 if (!gigaset_register_to_LL(cs, modulename)) {
682 err("register_isdn=>error"); 749 err("register_isdn failed");
683 goto error; 750 goto error;
684 } 751 }
685 752
686 make_valid(cs, VALID_ID); 753 make_valid(cs, VALID_ID);
687 ++cs->cs_init; 754 ++cs->cs_init;
688 dbg(DEBUG_INIT, "setting up hw"); 755 gig_dbg(DEBUG_INIT, "setting up hw");
689 if (!cs->ops->initcshw(cs)) 756 if (!cs->ops->initcshw(cs))
690 goto error; 757 goto error;
691 758
@@ -693,27 +760,29 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
693 760
694 gigaset_if_init(cs); 761 gigaset_if_init(cs);
695 762
696 atomic_set(&cs->running, 1); 763 spin_lock_irqsave(&cs->lock, flags);
697 cs->timer.data = (unsigned long) cs; 764 cs->running = 1;
698 cs->timer.function = timer_tick; 765 spin_unlock_irqrestore(&cs->lock, flags);
699 cs->timer.expires = jiffies + GIG_TICK; 766 setup_timer(&cs->timer, timer_tick, (unsigned long) cs);
767 cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK);
700 /* FIXME: can jiffies increase too much until the timer is added? 768 /* FIXME: can jiffies increase too much until the timer is added?
701 * Same problem(?) with mod_timer() in timer_tick(). */ 769 * Same problem(?) with mod_timer() in timer_tick(). */
702 add_timer(&cs->timer); 770 add_timer(&cs->timer);
703 771
704 dbg(DEBUG_INIT, "cs initialized!"); 772 gig_dbg(DEBUG_INIT, "cs initialized");
705 up(&cs->sem); 773 mutex_unlock(&cs->mutex);
706 return cs; 774 return cs;
707 775
708error: if (cs) 776error: if (cs)
709 up(&cs->sem); 777 mutex_unlock(&cs->mutex);
710 dbg(DEBUG_INIT, "failed"); 778 gig_dbg(DEBUG_INIT, "failed");
711 gigaset_freecs(cs); 779 gigaset_freecs(cs);
712 return NULL; 780 return NULL;
713} 781}
714EXPORT_SYMBOL_GPL(gigaset_initcs); 782EXPORT_SYMBOL_GPL(gigaset_initcs);
715 783
716/* ReInitialize the b-channel structure */ /* e.g. called on hangup, disconnect */ 784/* ReInitialize the b-channel structure */
785/* e.g. called on hangup, disconnect */
717void gigaset_bcs_reinit(struct bc_state *bcs) 786void gigaset_bcs_reinit(struct bc_state *bcs)
718{ 787{
719 struct sk_buff *skb; 788 struct sk_buff *skb;
@@ -723,12 +792,12 @@ void gigaset_bcs_reinit(struct bc_state *bcs)
723 while ((skb = skb_dequeue(&bcs->squeue)) != NULL) 792 while ((skb = skb_dequeue(&bcs->squeue)) != NULL)
724 dev_kfree_skb(skb); 793 dev_kfree_skb(skb);
725 794
726 spin_lock_irqsave(&cs->lock, flags); //FIXME 795 spin_lock_irqsave(&cs->lock, flags);
727 clear_at_state(&bcs->at_state); 796 clear_at_state(&bcs->at_state);
728 bcs->at_state.ConState = 0; 797 bcs->at_state.ConState = 0;
729 bcs->at_state.timer_active = 0; 798 bcs->at_state.timer_active = 0;
730 bcs->at_state.timer_expires = 0; 799 bcs->at_state.timer_expires = 0;
731 bcs->at_state.cid = -1; /* No CID defined */ 800 bcs->at_state.cid = -1; /* No CID defined */
732 spin_unlock_irqrestore(&cs->lock, flags); 801 spin_unlock_irqrestore(&cs->lock, flags);
733 802
734 bcs->inputstate = 0; 803 bcs->inputstate = 0;
@@ -803,11 +872,14 @@ static void cleanup_cs(struct cardstate *cs)
803 872
804int gigaset_start(struct cardstate *cs) 873int gigaset_start(struct cardstate *cs)
805{ 874{
806 if (down_interruptible(&cs->sem)) 875 unsigned long flags;
876
877 if (mutex_lock_interruptible(&cs->mutex))
807 return 0; 878 return 0;
808 //info("USB device for Gigaset 307x now attached to Dev %d", ucs->minor);
809 879
810 atomic_set(&cs->connected, 1); 880 spin_lock_irqsave(&cs->lock, flags);
881 cs->connected = 1;
882 spin_unlock_irqrestore(&cs->lock, flags);
811 883
812 if (atomic_read(&cs->mstate) != MS_LOCKED) { 884 if (atomic_read(&cs->mstate) != MS_LOCKED) {
813 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS); 885 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
@@ -826,23 +898,26 @@ int gigaset_start(struct cardstate *cs)
826 goto error; 898 goto error;
827 } 899 }
828 900
829 dbg(DEBUG_CMD, "scheduling START"); 901 gig_dbg(DEBUG_CMD, "scheduling START");
830 gigaset_schedule_event(cs); 902 gigaset_schedule_event(cs);
831 903
832 wait_event(cs->waitqueue, !cs->waiting); 904 wait_event(cs->waitqueue, !cs->waiting);
833 905
834 up(&cs->sem); 906 /* set up device sysfs */
907 gigaset_init_dev_sysfs(cs);
908
909 mutex_unlock(&cs->mutex);
835 return 1; 910 return 1;
836 911
837error: 912error:
838 up(&cs->sem); 913 mutex_unlock(&cs->mutex);
839 return 0; 914 return 0;
840} 915}
841EXPORT_SYMBOL_GPL(gigaset_start); 916EXPORT_SYMBOL_GPL(gigaset_start);
842 917
843void gigaset_shutdown(struct cardstate *cs) 918void gigaset_shutdown(struct cardstate *cs)
844{ 919{
845 down(&cs->sem); 920 mutex_lock(&cs->mutex);
846 921
847 cs->waiting = 1; 922 cs->waiting = 1;
848 923
@@ -851,11 +926,11 @@ void gigaset_shutdown(struct cardstate *cs)
851 goto exit; 926 goto exit;
852 } 927 }
853 928
854 dbg(DEBUG_CMD, "scheduling SHUTDOWN"); 929 gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
855 gigaset_schedule_event(cs); 930 gigaset_schedule_event(cs);
856 931
857 if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) { 932 if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
858 warn("aborted"); 933 warn("%s: aborted", __func__);
859 //FIXME 934 //FIXME
860 } 935 }
861 936
@@ -872,15 +947,13 @@ void gigaset_shutdown(struct cardstate *cs)
872 cleanup_cs(cs); 947 cleanup_cs(cs);
873 948
874exit: 949exit:
875 up(&cs->sem); 950 mutex_unlock(&cs->mutex);
876} 951}
877EXPORT_SYMBOL_GPL(gigaset_shutdown); 952EXPORT_SYMBOL_GPL(gigaset_shutdown);
878 953
879void gigaset_stop(struct cardstate *cs) 954void gigaset_stop(struct cardstate *cs)
880{ 955{
881 down(&cs->sem); 956 mutex_lock(&cs->mutex);
882
883 atomic_set(&cs->connected, 0);
884 957
885 cs->waiting = 1; 958 cs->waiting = 1;
886 959
@@ -889,21 +962,21 @@ void gigaset_stop(struct cardstate *cs)
889 goto exit; 962 goto exit;
890 } 963 }
891 964
892 dbg(DEBUG_CMD, "scheduling STOP"); 965 gig_dbg(DEBUG_CMD, "scheduling STOP");
893 gigaset_schedule_event(cs); 966 gigaset_schedule_event(cs);
894 967
895 if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) { 968 if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
896 warn("aborted"); 969 warn("%s: aborted", __func__);
897 //FIXME 970 //FIXME
898 } 971 }
899 972
900 /* Tell the LL that the device is not available .. */ 973 /* clear device sysfs */
901 gigaset_i4l_cmd(cs, ISDN_STAT_STOP); // FIXME move to event layer? 974 gigaset_free_dev_sysfs(cs);
902 975
903 cleanup_cs(cs); 976 cleanup_cs(cs);
904 977
905exit: 978exit:
906 up(&cs->sem); 979 mutex_unlock(&cs->mutex);
907} 980}
908EXPORT_SYMBOL_GPL(gigaset_stop); 981EXPORT_SYMBOL_GPL(gigaset_stop);
909 982
@@ -947,31 +1020,25 @@ void gigaset_debugdrivers(void)
947 1020
948 spin_lock_irqsave(&driver_lock, flags); 1021 spin_lock_irqsave(&driver_lock, flags);
949 list_for_each_entry(drv, &drivers, list) { 1022 list_for_each_entry(drv, &drivers, list) {
950 dbg(DEBUG_DRIVER, "driver %p", drv); 1023 gig_dbg(DEBUG_DRIVER, "driver %p", drv);
951 spin_lock(&drv->lock); 1024 spin_lock(&drv->lock);
952 for (i = 0; i < drv->minors; ++i) { 1025 for (i = 0; i < drv->minors; ++i) {
953 dbg(DEBUG_DRIVER, " index %u", i); 1026 gig_dbg(DEBUG_DRIVER, " index %u", i);
954 dbg(DEBUG_DRIVER, " flags 0x%02x", drv->flags[i]); 1027 gig_dbg(DEBUG_DRIVER, " flags 0x%02x",
1028 drv->flags[i]);
955 cs = drv->cs + i; 1029 cs = drv->cs + i;
956 dbg(DEBUG_DRIVER, " cardstate %p", cs); 1030 gig_dbg(DEBUG_DRIVER, " cardstate %p", cs);
957 dbg(DEBUG_DRIVER, " minor_index %u", cs->minor_index); 1031 gig_dbg(DEBUG_DRIVER, " minor_index %u",
958 dbg(DEBUG_DRIVER, " driver %p", cs->driver); 1032 cs->minor_index);
959 dbg(DEBUG_DRIVER, " i4l id %d", cs->myid); 1033 gig_dbg(DEBUG_DRIVER, " driver %p", cs->driver);
1034 gig_dbg(DEBUG_DRIVER, " i4l id %d", cs->myid);
960 } 1035 }
961 spin_unlock(&drv->lock); 1036 spin_unlock(&drv->lock);
962 } 1037 }
963 spin_unlock_irqrestore(&driver_lock, flags); 1038 spin_unlock_irqrestore(&driver_lock, flags);
964} 1039}
965EXPORT_SYMBOL_GPL(gigaset_debugdrivers);
966
967struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty)
968{
969 if (tty->index < 0 || tty->index >= tty->driver->num)
970 return NULL;
971 return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start);
972}
973 1040
974struct cardstate *gigaset_get_cs_by_minor(unsigned minor) 1041static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
975{ 1042{
976 unsigned long flags; 1043 unsigned long flags;
977 static struct cardstate *ret = NULL; 1044 static struct cardstate *ret = NULL;
@@ -994,6 +1061,13 @@ struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
994 return ret; 1061 return ret;
995} 1062}
996 1063
1064struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty)
1065{
1066 if (tty->index < 0 || tty->index >= tty->driver->num)
1067 return NULL;
1068 return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start);
1069}
1070
997void gigaset_freedriver(struct gigaset_driver *drv) 1071void gigaset_freedriver(struct gigaset_driver *drv)
998{ 1072{
999 unsigned long flags; 1073 unsigned long flags;
@@ -1014,20 +1088,20 @@ EXPORT_SYMBOL_GPL(gigaset_freedriver);
1014/* gigaset_initdriver 1088/* gigaset_initdriver
1015 * Allocate and initialize gigaset_driver structure. Initialize interface. 1089 * Allocate and initialize gigaset_driver structure. Initialize interface.
1016 * parameters: 1090 * parameters:
1017 * minor First minor number 1091 * minor First minor number
1018 * minors Number of minors this driver can handle 1092 * minors Number of minors this driver can handle
1019 * procname Name of the driver (e.g. for /proc/tty/drivers, path in /proc/driver) 1093 * procname Name of the driver
1020 * devname Name of the device files (prefix without minor number) 1094 * devname Name of the device files (prefix without minor number)
1021 * devfsname Devfs name of the device files without %d 1095 * devfsname Devfs name of the device files without %d
1022 * return value: 1096 * return value:
1023 * Pointer to the gigaset_driver structure on success, NULL on failure. 1097 * Pointer to the gigaset_driver structure on success, NULL on failure.
1024 */ 1098 */
1025struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, 1099struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1026 const char *procname, 1100 const char *procname,
1027 const char *devname, 1101 const char *devname,
1028 const char *devfsname, 1102 const char *devfsname,
1029 const struct gigaset_ops *ops, 1103 const struct gigaset_ops *ops,
1030 struct module *owner) 1104 struct module *owner)
1031{ 1105{
1032 struct gigaset_driver *drv; 1106 struct gigaset_driver *drv;
1033 unsigned long flags; 1107 unsigned long flags;
@@ -1036,8 +1110,9 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1036 drv = kmalloc(sizeof *drv, GFP_KERNEL); 1110 drv = kmalloc(sizeof *drv, GFP_KERNEL);
1037 if (!drv) 1111 if (!drv)
1038 return NULL; 1112 return NULL;
1113
1039 if (!try_module_get(owner)) 1114 if (!try_module_get(owner))
1040 return NULL; 1115 goto out1;
1041 1116
1042 drv->cs = NULL; 1117 drv->cs = NULL;
1043 drv->have_tty = 0; 1118 drv->have_tty = 0;
@@ -1051,10 +1126,11 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1051 1126
1052 drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL); 1127 drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL);
1053 if (!drv->cs) 1128 if (!drv->cs)
1054 goto out1; 1129 goto out2;
1130
1055 drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL); 1131 drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL);
1056 if (!drv->flags) 1132 if (!drv->flags)
1057 goto out2; 1133 goto out3;
1058 1134
1059 for (i = 0; i < minors; ++i) { 1135 for (i = 0; i < minors; ++i) {
1060 drv->flags[i] = 0; 1136 drv->flags[i] = 0;
@@ -1071,61 +1147,16 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1071 1147
1072 return drv; 1148 return drv;
1073 1149
1074out2: 1150out3:
1075 kfree(drv->cs); 1151 kfree(drv->cs);
1152out2:
1153 module_put(owner);
1076out1: 1154out1:
1077 kfree(drv); 1155 kfree(drv);
1078 module_put(owner);
1079 return NULL; 1156 return NULL;
1080} 1157}
1081EXPORT_SYMBOL_GPL(gigaset_initdriver); 1158EXPORT_SYMBOL_GPL(gigaset_initdriver);
1082 1159
1083static struct cardstate *alloc_cs(struct gigaset_driver *drv)
1084{
1085 unsigned long flags;
1086 unsigned i;
1087 static struct cardstate *ret = NULL;
1088
1089 spin_lock_irqsave(&drv->lock, flags);
1090 for (i = 0; i < drv->minors; ++i) {
1091 if (!(drv->flags[i] & VALID_MINOR)) {
1092 drv->flags[i] = VALID_MINOR;
1093 ret = drv->cs + i;
1094 }
1095 if (ret)
1096 break;
1097 }
1098 spin_unlock_irqrestore(&drv->lock, flags);
1099 return ret;
1100}
1101
1102static void free_cs(struct cardstate *cs)
1103{
1104 unsigned long flags;
1105 struct gigaset_driver *drv = cs->driver;
1106 spin_lock_irqsave(&drv->lock, flags);
1107 drv->flags[cs->minor_index] = 0;
1108 spin_unlock_irqrestore(&drv->lock, flags);
1109}
1110
1111static void make_valid(struct cardstate *cs, unsigned mask)
1112{
1113 unsigned long flags;
1114 struct gigaset_driver *drv = cs->driver;
1115 spin_lock_irqsave(&drv->lock, flags);
1116 drv->flags[cs->minor_index] |= mask;
1117 spin_unlock_irqrestore(&drv->lock, flags);
1118}
1119
1120static void make_invalid(struct cardstate *cs, unsigned mask)
1121{
1122 unsigned long flags;
1123 struct gigaset_driver *drv = cs->driver;
1124 spin_lock_irqsave(&drv->lock, flags);
1125 drv->flags[cs->minor_index] &= ~mask;
1126 spin_unlock_irqrestore(&drv->lock, flags);
1127}
1128
1129/* For drivers without fixed assignment device<->cardstate (usb) */ 1160/* For drivers without fixed assignment device<->cardstate (usb) */
1130struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv) 1161struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv)
1131{ 1162{
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index fdcb80bb21c7..1ba3424a286b 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Stuff used by all variants of the driver 2 * Stuff used by all variants of the driver
3 * 3 *
4 * Copyright (c) 2001 by Stefan Eilers <Eilers.Stefan@epost.de>, 4 * Copyright (c) 2001 by Stefan Eilers,
5 * Hansjoerg Lipp <hjlipp@web.de>, 5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Tilman Schmidt <tilman@imap.cc>. 6 * Tilman Schmidt <tilman@imap.cc>.
7 * 7 *
@@ -11,82 +11,78 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: ev-layer.c,v 1.4.2.18 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
21 17
22/* ========================================================== */ 18/* ========================================================== */
23/* bit masks for pending commands */ 19/* bit masks for pending commands */
24#define PC_INIT 0x004 20#define PC_DIAL 0x001
25#define PC_DLE0 0x008 21#define PC_HUP 0x002
26#define PC_DLE1 0x010 22#define PC_INIT 0x004
27#define PC_CID 0x080 23#define PC_DLE0 0x008
28#define PC_NOCID 0x100 24#define PC_DLE1 0x010
29#define PC_HUP 0x002 25#define PC_SHUTDOWN 0x020
30#define PC_DIAL 0x001 26#define PC_ACCEPT 0x040
31#define PC_ACCEPT 0x040 27#define PC_CID 0x080
32#define PC_SHUTDOWN 0x020 28#define PC_NOCID 0x100
33#define PC_CIDMODE 0x200 29#define PC_CIDMODE 0x200
34#define PC_UMMODE 0x400 30#define PC_UMMODE 0x400
35 31
36/* types of modem responses */ 32/* types of modem responses */
37#define RT_NOTHING 0 33#define RT_NOTHING 0
38#define RT_ZSAU 1 34#define RT_ZSAU 1
39#define RT_RING 2 35#define RT_RING 2
40#define RT_NUMBER 3 36#define RT_NUMBER 3
41#define RT_STRING 4 37#define RT_STRING 4
42#define RT_HEX 5 38#define RT_HEX 5
43#define RT_ZCAU 6 39#define RT_ZCAU 6
44 40
45/* Possible ASCII responses */ 41/* Possible ASCII responses */
46#define RSP_OK 0 42#define RSP_OK 0
47//#define RSP_BUSY 1 43//#define RSP_BUSY 1
48//#define RSP_CONNECT 2 44//#define RSP_CONNECT 2
49#define RSP_ZGCI 3 45#define RSP_ZGCI 3
50#define RSP_RING 4 46#define RSP_RING 4
51#define RSP_ZAOC 5 47#define RSP_ZAOC 5
52#define RSP_ZCSTR 6 48#define RSP_ZCSTR 6
53#define RSP_ZCFGT 7 49#define RSP_ZCFGT 7
54#define RSP_ZCFG 8 50#define RSP_ZCFG 8
55#define RSP_ZCCR 9 51#define RSP_ZCCR 9
56#define RSP_EMPTY 10 52#define RSP_EMPTY 10
57#define RSP_ZLOG 11 53#define RSP_ZLOG 11
58#define RSP_ZCAU 12 54#define RSP_ZCAU 12
59#define RSP_ZMWI 13 55#define RSP_ZMWI 13
60#define RSP_ZABINFO 14 56#define RSP_ZABINFO 14
61#define RSP_ZSMLSTCHG 15 57#define RSP_ZSMLSTCHG 15
62#define RSP_VAR 100 58#define RSP_VAR 100
63#define RSP_ZSAU (RSP_VAR + VAR_ZSAU) 59#define RSP_ZSAU (RSP_VAR + VAR_ZSAU)
64#define RSP_ZDLE (RSP_VAR + VAR_ZDLE) 60#define RSP_ZDLE (RSP_VAR + VAR_ZDLE)
65#define RSP_ZVLS (RSP_VAR + VAR_ZVLS) 61#define RSP_ZVLS (RSP_VAR + VAR_ZVLS)
66#define RSP_ZCTP (RSP_VAR + VAR_ZCTP) 62#define RSP_ZCTP (RSP_VAR + VAR_ZCTP)
67#define RSP_STR (RSP_VAR + VAR_NUM) 63#define RSP_STR (RSP_VAR + VAR_NUM)
68#define RSP_NMBR (RSP_STR + STR_NMBR) 64#define RSP_NMBR (RSP_STR + STR_NMBR)
69#define RSP_ZCPN (RSP_STR + STR_ZCPN) 65#define RSP_ZCPN (RSP_STR + STR_ZCPN)
70#define RSP_ZCON (RSP_STR + STR_ZCON) 66#define RSP_ZCON (RSP_STR + STR_ZCON)
71#define RSP_ZBC (RSP_STR + STR_ZBC) 67#define RSP_ZBC (RSP_STR + STR_ZBC)
72#define RSP_ZHLC (RSP_STR + STR_ZHLC) 68#define RSP_ZHLC (RSP_STR + STR_ZHLC)
73#define RSP_ERROR -1 /* ERROR */ 69#define RSP_ERROR -1 /* ERROR */
74#define RSP_WRONG_CID -2 /* unknown cid in cmd */ 70#define RSP_WRONG_CID -2 /* unknown cid in cmd */
75//#define RSP_EMPTY -3 71//#define RSP_EMPTY -3
76#define RSP_UNKNOWN -4 /* unknown response */ 72#define RSP_UNKNOWN -4 /* unknown response */
77#define RSP_FAIL -5 /* internal error */ 73#define RSP_FAIL -5 /* internal error */
78#define RSP_INVAL -6 /* invalid response */ 74#define RSP_INVAL -6 /* invalid response */
79 75
80#define RSP_NONE -19 76#define RSP_NONE -19
81#define RSP_STRING -20 77#define RSP_STRING -20
82#define RSP_NULL -21 78#define RSP_NULL -21
83//#define RSP_RETRYFAIL -22 79//#define RSP_RETRYFAIL -22
84//#define RSP_RETRY -23 80//#define RSP_RETRY -23
85//#define RSP_SKIP -24 81//#define RSP_SKIP -24
86#define RSP_INIT -27 82#define RSP_INIT -27
87#define RSP_ANY -26 83#define RSP_ANY -26
88#define RSP_LAST -28 84#define RSP_LAST -28
89#define RSP_NODEV -9 85#define RSP_NODEV -9
90 86
91/* actions for process_response */ 87/* actions for process_response */
92#define ACT_NOTHING 0 88#define ACT_NOTHING 0
@@ -112,7 +108,7 @@
112#define ACT_DISCONNECT 20 108#define ACT_DISCONNECT 20
113#define ACT_CONNECT 21 109#define ACT_CONNECT 21
114#define ACT_REMOTEREJECT 22 110#define ACT_REMOTEREJECT 22
115#define ACT_CONNTIMEOUT 23 111#define ACT_CONNTIMEOUT 23
116#define ACT_REMOTEHUP 24 112#define ACT_REMOTEHUP 24
117#define ACT_ABORTHUP 25 113#define ACT_ABORTHUP 25
118#define ACT_ICALL 26 114#define ACT_ICALL 26
@@ -127,40 +123,40 @@
127#define ACT_ERROR 35 123#define ACT_ERROR 35
128#define ACT_ABORTCID 36 124#define ACT_ABORTCID 36
129#define ACT_ZCAU 37 125#define ACT_ZCAU 37
130#define ACT_NOTIFY_BC_DOWN 38 126#define ACT_NOTIFY_BC_DOWN 38
131#define ACT_NOTIFY_BC_UP 39 127#define ACT_NOTIFY_BC_UP 39
132#define ACT_DIAL 40 128#define ACT_DIAL 40
133#define ACT_ACCEPT 41 129#define ACT_ACCEPT 41
134#define ACT_PROTO_L2 42 130#define ACT_PROTO_L2 42
135#define ACT_HUP 43 131#define ACT_HUP 43
136#define ACT_IF_LOCK 44 132#define ACT_IF_LOCK 44
137#define ACT_START 45 133#define ACT_START 45
138#define ACT_STOP 46 134#define ACT_STOP 46
139#define ACT_FAKEDLE0 47 135#define ACT_FAKEDLE0 47
140#define ACT_FAKEHUP 48 136#define ACT_FAKEHUP 48
141#define ACT_FAKESDOWN 49 137#define ACT_FAKESDOWN 49
142#define ACT_SHUTDOWN 50 138#define ACT_SHUTDOWN 50
143#define ACT_PROC_CIDMODE 51 139#define ACT_PROC_CIDMODE 51
144#define ACT_UMODESET 52 140#define ACT_UMODESET 52
145#define ACT_FAILUMODE 53 141#define ACT_FAILUMODE 53
146#define ACT_CMODESET 54 142#define ACT_CMODESET 54
147#define ACT_FAILCMODE 55 143#define ACT_FAILCMODE 55
148#define ACT_IF_VER 56 144#define ACT_IF_VER 56
149#define ACT_CMD 100 145#define ACT_CMD 100
150 146
151/* at command sequences */ 147/* at command sequences */
152#define SEQ_NONE 0 148#define SEQ_NONE 0
153#define SEQ_INIT 100 149#define SEQ_INIT 100
154#define SEQ_DLE0 200 150#define SEQ_DLE0 200
155#define SEQ_DLE1 250 151#define SEQ_DLE1 250
156#define SEQ_CID 300 152#define SEQ_CID 300
157#define SEQ_NOCID 350 153#define SEQ_NOCID 350
158#define SEQ_HUP 400 154#define SEQ_HUP 400
159#define SEQ_DIAL 600 155#define SEQ_DIAL 600
160#define SEQ_ACCEPT 720 156#define SEQ_ACCEPT 720
161#define SEQ_SHUTDOWN 500 157#define SEQ_SHUTDOWN 500
162#define SEQ_CIDMODE 10 158#define SEQ_CIDMODE 10
163#define SEQ_UMMODE 11 159#define SEQ_UMMODE 11
164 160
165 161
166// 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring 162// 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring
@@ -175,7 +171,7 @@ struct reply_t gigaset_tab_nocid_m10x[]= /* with dle mode */
175 // {ACT_TIMEOUT}}, 171 // {ACT_TIMEOUT}},
176 172
177 {RSP_INIT, -1, -1,SEQ_INIT, 100, INIT_TIMEOUT, 173 {RSP_INIT, -1, -1,SEQ_INIT, 100, INIT_TIMEOUT,
178 {ACT_TIMEOUT}}, /* wait until device is ready */ 174 {ACT_TIMEOUT}}, /* wait until device is ready */
179 175
180 {EV_TIMEOUT, 100,100, -1, 101, 3, {0}, "Z\r"}, /* device in transparent mode? try to initialize it. */ 176 {EV_TIMEOUT, 100,100, -1, 101, 3, {0}, "Z\r"}, /* device in transparent mode? try to initialize it. */
181 {RSP_OK, 101,103, -1, 120, 5, {ACT_GETSTRING}, "+GMR\r"}, /* get version */ 177 {RSP_OK, 101,103, -1, 120, 5, {ACT_GETSTRING}, "+GMR\r"}, /* get version */
@@ -190,8 +186,8 @@ struct reply_t gigaset_tab_nocid_m10x[]= /* with dle mode */
190 {RSP_ERROR, 108,108, -1, 0, 0, {ACT_FAILINIT}}, 186 {RSP_ERROR, 108,108, -1, 0, 0, {ACT_FAILINIT}},
191 187
192 {EV_TIMEOUT, 108,108, -1, 105, 2, {ACT_SETDLE0, 188 {EV_TIMEOUT, 108,108, -1, 105, 2, {ACT_SETDLE0,
193 ACT_HUPMODEM, 189 ACT_HUPMODEM,
194 ACT_TIMEOUT}}, /* still timeout => connection in unimodem mode? */ 190 ACT_TIMEOUT}}, /* still timeout => connection in unimodem mode? */
195 {EV_TIMEOUT, 105,105, -1, 103, 5, {0}, "Z\r"}, 191 {EV_TIMEOUT, 105,105, -1, 103, 5, {0}, "Z\r"},
196 192
197 {RSP_ERROR, 102,102, -1, 107, 5, {0}, "^GETPRE\r"}, /* ERROR on ATZ => maybe in config mode? */ 193 {RSP_ERROR, 102,102, -1, 107, 5, {0}, "^GETPRE\r"}, /* ERROR on ATZ => maybe in config mode? */
@@ -393,7 +389,7 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
393 389
394 390
395#if 0 391#if 0
396static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen uebernehmen 392static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME
397{ 393{
398 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 394 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
399 395
@@ -401,7 +397,7 @@ static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen ueberne
401 {RSP_LAST,0,0,0,0,0,0} 397 {RSP_LAST,0,0,0,0,0,0}
402}; 398};
403 399
404static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen uebernehmen 400static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
405{ 401{
406 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 402 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
407 403
@@ -412,30 +408,30 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen ueberneh
412 408
413static struct resp_type_t resp_type[]= 409static struct resp_type_t resp_type[]=
414{ 410{
415 /*{"", RSP_EMPTY, RT_NOTHING},*/ 411 /*{"", RSP_EMPTY, RT_NOTHING},*/
416 {"OK", RSP_OK, RT_NOTHING}, 412 {"OK", RSP_OK, RT_NOTHING},
417 {"ERROR", RSP_ERROR, RT_NOTHING}, 413 {"ERROR", RSP_ERROR, RT_NOTHING},
418 {"ZSAU", RSP_ZSAU, RT_ZSAU}, 414 {"ZSAU", RSP_ZSAU, RT_ZSAU},
419 {"ZCAU", RSP_ZCAU, RT_ZCAU}, 415 {"ZCAU", RSP_ZCAU, RT_ZCAU},
420 {"RING", RSP_RING, RT_RING}, 416 {"RING", RSP_RING, RT_RING},
421 {"ZGCI", RSP_ZGCI, RT_NUMBER}, 417 {"ZGCI", RSP_ZGCI, RT_NUMBER},
422 {"ZVLS", RSP_ZVLS, RT_NUMBER}, 418 {"ZVLS", RSP_ZVLS, RT_NUMBER},
423 {"ZCTP", RSP_ZCTP, RT_NUMBER}, 419 {"ZCTP", RSP_ZCTP, RT_NUMBER},
424 {"ZDLE", RSP_ZDLE, RT_NUMBER}, 420 {"ZDLE", RSP_ZDLE, RT_NUMBER},
425 {"ZCFGT", RSP_ZCFGT, RT_NUMBER}, 421 {"ZCFGT", RSP_ZCFGT, RT_NUMBER},
426 {"ZCCR", RSP_ZCCR, RT_NUMBER}, 422 {"ZCCR", RSP_ZCCR, RT_NUMBER},
427 {"ZMWI", RSP_ZMWI, RT_NUMBER}, 423 {"ZMWI", RSP_ZMWI, RT_NUMBER},
428 {"ZHLC", RSP_ZHLC, RT_STRING}, 424 {"ZHLC", RSP_ZHLC, RT_STRING},
429 {"ZBC", RSP_ZBC, RT_STRING}, 425 {"ZBC", RSP_ZBC, RT_STRING},
430 {"NMBR", RSP_NMBR, RT_STRING}, 426 {"NMBR", RSP_NMBR, RT_STRING},
431 {"ZCPN", RSP_ZCPN, RT_STRING}, 427 {"ZCPN", RSP_ZCPN, RT_STRING},
432 {"ZCON", RSP_ZCON, RT_STRING}, 428 {"ZCON", RSP_ZCON, RT_STRING},
433 {"ZAOC", RSP_ZAOC, RT_STRING}, 429 {"ZAOC", RSP_ZAOC, RT_STRING},
434 {"ZCSTR", RSP_ZCSTR, RT_STRING}, 430 {"ZCSTR", RSP_ZCSTR, RT_STRING},
435 {"ZCFG", RSP_ZCFG, RT_HEX}, 431 {"ZCFG", RSP_ZCFG, RT_HEX},
436 {"ZLOG", RSP_ZLOG, RT_NOTHING}, 432 {"ZLOG", RSP_ZLOG, RT_NOTHING},
437 {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, 433 {"ZABINFO", RSP_ZABINFO, RT_NOTHING},
438 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, 434 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING},
439 {NULL,0,0} 435 {NULL,0,0}
440}; 436};
441 437
@@ -446,9 +442,7 @@ static int isdn_getnum(char *p)
446{ 442{
447 int v = -1; 443 int v = -1;
448 444
449 IFNULLRETVAL(p, -1); 445 gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
450
451 dbg(DEBUG_TRANSCMD, "string: %s", p);
452 446
453 while (*p >= '0' && *p <= '9') 447 while (*p >= '0' && *p <= '9')
454 v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0'); 448 v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0');
@@ -465,9 +459,7 @@ static int isdn_gethex(char *p)
465 int v = 0; 459 int v = 0;
466 int c; 460 int c;
467 461
468 IFNULLRETVAL(p, -1); 462 gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
469
470 dbg(DEBUG_TRANSCMD, "string: %s", p);
471 463
472 if (!*p) 464 if (!*p)
473 return -1; 465 return -1;
@@ -490,14 +482,6 @@ static int isdn_gethex(char *p)
490 return v; 482 return v;
491} 483}
492 484
493static inline void new_index(atomic_t *index, int max)
494{
495 if (atomic_read(index) == max) //FIXME race?
496 atomic_set(index, 0);
497 else
498 atomic_inc(index);
499}
500
501/* retrieve CID from parsed response 485/* retrieve CID from parsed response
502 * returns 0 if no CID, -1 if invalid CID, or CID value 1..65535 486 * returns 0 if no CID, -1 if invalid CID, or CID value 1..65535
503 */ 487 */
@@ -536,16 +520,14 @@ void gigaset_handle_modem_response(struct cardstate *cs)
536 int cid; 520 int cid;
537 int rawstring; 521 int rawstring;
538 522
539 IFNULLRET(cs);
540
541 len = cs->cbytes; 523 len = cs->cbytes;
542 if (!len) { 524 if (!len) {
543 /* ignore additional LFs/CRs (M10x config mode or cx100) */ 525 /* ignore additional LFs/CRs (M10x config mode or cx100) */
544 dbg(DEBUG_MCMD, "skipped EOL [%02X]", cs->respdata[len]); 526 gig_dbg(DEBUG_MCMD, "skipped EOL [%02X]", cs->respdata[len]);
545 return; 527 return;
546 } 528 }
547 cs->respdata[len] = 0; 529 cs->respdata[len] = 0;
548 dbg(DEBUG_TRANSCMD, "raw string: '%s'", cs->respdata); 530 gig_dbg(DEBUG_TRANSCMD, "raw string: '%s'", cs->respdata);
549 argv[0] = cs->respdata; 531 argv[0] = cs->respdata;
550 params = 1; 532 params = 1;
551 if (cs->at_state.getstring) { 533 if (cs->at_state.getstring) {
@@ -561,7 +543,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
561 case ',': 543 case ',':
562 case '=': 544 case '=':
563 if (params > MAX_REC_PARAMS) { 545 if (params > MAX_REC_PARAMS) {
564 warn("too many parameters in response"); 546 dev_warn(cs->dev,
547 "too many parameters in response\n");
565 /* need last parameter (might be CID) */ 548 /* need last parameter (might be CID) */
566 params--; 549 params--;
567 } 550 }
@@ -572,33 +555,33 @@ void gigaset_handle_modem_response(struct cardstate *cs)
572 cid = params > 1 ? cid_of_response(argv[params-1]) : 0; 555 cid = params > 1 ? cid_of_response(argv[params-1]) : 0;
573 if (cid < 0) { 556 if (cid < 0) {
574 gigaset_add_event(cs, &cs->at_state, RSP_INVAL, 557 gigaset_add_event(cs, &cs->at_state, RSP_INVAL,
575 NULL, 0, NULL); 558 NULL, 0, NULL);
576 return; 559 return;
577 } 560 }
578 561
579 for (j = 1; j < params; ++j) 562 for (j = 1; j < params; ++j)
580 argv[j][-1] = 0; 563 argv[j][-1] = 0;
581 564
582 dbg(DEBUG_TRANSCMD, "CMD received: %s", argv[0]); 565 gig_dbg(DEBUG_TRANSCMD, "CMD received: %s", argv[0]);
583 if (cid) { 566 if (cid) {
584 --params; 567 --params;
585 dbg(DEBUG_TRANSCMD, "CID: %s", argv[params]); 568 gig_dbg(DEBUG_TRANSCMD, "CID: %s", argv[params]);
586 } 569 }
587 dbg(DEBUG_TRANSCMD, "available params: %d", params - 1); 570 gig_dbg(DEBUG_TRANSCMD, "available params: %d", params - 1);
588 for (j = 1; j < params; j++) 571 for (j = 1; j < params; j++)
589 dbg(DEBUG_TRANSCMD, "param %d: %s", j, argv[j]); 572 gig_dbg(DEBUG_TRANSCMD, "param %d: %s", j, argv[j]);
590 } 573 }
591 574
592 spin_lock_irqsave(&cs->ev_lock, flags); 575 spin_lock_irqsave(&cs->ev_lock, flags);
593 head = atomic_read(&cs->ev_head); 576 head = cs->ev_head;
594 tail = atomic_read(&cs->ev_tail); 577 tail = cs->ev_tail;
595 578
596 abort = 1; 579 abort = 1;
597 curarg = 0; 580 curarg = 0;
598 while (curarg < params) { 581 while (curarg < params) {
599 next = (tail + 1) % MAX_EVENTS; 582 next = (tail + 1) % MAX_EVENTS;
600 if (unlikely(next == head)) { 583 if (unlikely(next == head)) {
601 err("event queue full"); 584 dev_err(cs->dev, "event queue full\n");
602 break; 585 break;
603 } 586 }
604 587
@@ -619,8 +602,9 @@ void gigaset_handle_modem_response(struct cardstate *cs)
619 602
620 if (!rt->response) { 603 if (!rt->response) {
621 event->type = RSP_UNKNOWN; 604 event->type = RSP_UNKNOWN;
622 warn("unknown modem response: %s", 605 dev_warn(cs->dev,
623 argv[curarg]); 606 "unknown modem response: %s\n",
607 argv[curarg]);
624 break; 608 break;
625 } 609 }
626 610
@@ -636,7 +620,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
636 break; 620 break;
637 case RT_RING: 621 case RT_RING:
638 if (!cid) { 622 if (!cid) {
639 err("received RING without CID!"); 623 dev_err(cs->dev,
624 "received RING without CID!\n");
640 event->type = RSP_INVAL; 625 event->type = RSP_INVAL;
641 abort = 1; 626 abort = 1;
642 } else { 627 } else {
@@ -664,27 +649,25 @@ void gigaset_handle_modem_response(struct cardstate *cs)
664 event->parameter = ZSAU_DISCONNECT_REQ; 649 event->parameter = ZSAU_DISCONNECT_REQ;
665 else { 650 else {
666 event->parameter = ZSAU_UNKNOWN; 651 event->parameter = ZSAU_UNKNOWN;
667 warn("%s: unknown parameter %s after ZSAU", 652 dev_warn(cs->dev,
668 __func__, argv[curarg]); 653 "%s: unknown parameter %s after ZSAU\n",
654 __func__, argv[curarg]);
669 } 655 }
670 ++curarg; 656 ++curarg;
671 break; 657 break;
672 case RT_STRING: 658 case RT_STRING:
673 if (curarg < params) { 659 if (curarg < params) {
674 len = strlen(argv[curarg]) + 1; 660 event->ptr = kstrdup(argv[curarg], GFP_ATOMIC);
675 event->ptr = kmalloc(len, GFP_ATOMIC); 661 if (!event->ptr)
676 if (event->ptr) 662 dev_err(cs->dev, "out of memory\n");
677 memcpy(event->ptr, argv[curarg], len);
678 else
679 err("no memory for string!");
680 ++curarg; 663 ++curarg;
681 } 664 }
682#ifdef CONFIG_GIGASET_DEBUG 665#ifdef CONFIG_GIGASET_DEBUG
683 if (!event->ptr) 666 if (!event->ptr)
684 dbg(DEBUG_CMD, "string==NULL"); 667 gig_dbg(DEBUG_CMD, "string==NULL");
685 else 668 else
686 dbg(DEBUG_CMD, 669 gig_dbg(DEBUG_CMD, "string==%s",
687 "string==%s", (char *) event->ptr); 670 (char *) event->ptr);
688#endif 671#endif
689 break; 672 break;
690 case RT_ZCAU: 673 case RT_ZCAU:
@@ -694,7 +677,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
694 j = isdn_gethex(argv[curarg + 1]); 677 j = isdn_gethex(argv[curarg + 1]);
695 if (i >= 0 && i < 256 && j >= 0 && j < 256) 678 if (i >= 0 && i < 256 && j >= 0 && j < 256)
696 event->parameter = (unsigned) i << 8 679 event->parameter = (unsigned) i << 8
697 | j; 680 | j;
698 curarg += 2; 681 curarg += 2;
699 } else 682 } else
700 curarg = params - 1; 683 curarg = params - 1;
@@ -712,7 +695,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
712 } else 695 } else
713 event->parameter = -1; 696 event->parameter = -1;
714#ifdef CONFIG_GIGASET_DEBUG 697#ifdef CONFIG_GIGASET_DEBUG
715 dbg(DEBUG_CMD, "parameter==%d", event->parameter); 698 gig_dbg(DEBUG_CMD, "parameter==%d", event->parameter);
716#endif 699#endif
717 break; 700 break;
718 } 701 }
@@ -724,12 +707,13 @@ void gigaset_handle_modem_response(struct cardstate *cs)
724 break; 707 break;
725 } 708 }
726 709
727 atomic_set(&cs->ev_tail, tail); 710 cs->ev_tail = tail;
728 spin_unlock_irqrestore(&cs->ev_lock, flags); 711 spin_unlock_irqrestore(&cs->ev_lock, flags);
729 712
730 if (curarg != params) 713 if (curarg != params)
731 dbg(DEBUG_ANY, "invalid number of processed parameters: %d/%d", 714 gig_dbg(DEBUG_ANY,
732 curarg, params); 715 "invalid number of processed parameters: %d/%d",
716 curarg, params);
733} 717}
734EXPORT_SYMBOL_GPL(gigaset_handle_modem_response); 718EXPORT_SYMBOL_GPL(gigaset_handle_modem_response);
735 719
@@ -739,23 +723,19 @@ EXPORT_SYMBOL_GPL(gigaset_handle_modem_response);
739static void disconnect(struct at_state_t **at_state_p) 723static void disconnect(struct at_state_t **at_state_p)
740{ 724{
741 unsigned long flags; 725 unsigned long flags;
742 struct bc_state *bcs; 726 struct bc_state *bcs = (*at_state_p)->bcs;
743 struct cardstate *cs; 727 struct cardstate *cs = (*at_state_p)->cs;
744 728
745 IFNULLRET(at_state_p); 729 spin_lock_irqsave(&cs->lock, flags);
746 IFNULLRET(*at_state_p); 730 ++(*at_state_p)->seq_index;
747 bcs = (*at_state_p)->bcs;
748 cs = (*at_state_p)->cs;
749 IFNULLRET(cs);
750
751 new_index(&(*at_state_p)->seq_index, MAX_SEQ_INDEX);
752 731
753 /* revert to selected idle mode */ 732 /* revert to selected idle mode */
754 if (!atomic_read(&cs->cidmode)) { 733 if (!cs->cidmode) {
755 cs->at_state.pending_commands |= PC_UMMODE; 734 cs->at_state.pending_commands |= PC_UMMODE;
756 atomic_set(&cs->commands_pending, 1); //FIXME 735 atomic_set(&cs->commands_pending, 1); //FIXME
757 dbg(DEBUG_CMD, "Scheduling PC_UMMODE"); 736 gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
758 } 737 }
738 spin_unlock_irqrestore(&cs->lock, flags);
759 739
760 if (bcs) { 740 if (bcs) {
761 /* B channel assigned: invoke hardware specific handler */ 741 /* B channel assigned: invoke hardware specific handler */
@@ -777,7 +757,7 @@ static void disconnect(struct at_state_t **at_state_p)
777 * The structure should be freed by calling disconnect() after use. 757 * The structure should be freed by calling disconnect() after use.
778 */ 758 */
779static inline struct at_state_t *get_free_channel(struct cardstate *cs, 759static inline struct at_state_t *get_free_channel(struct cardstate *cs,
780 int cid) 760 int cid)
781/* cids: >0: siemens-cid 761/* cids: >0: siemens-cid
782 0: without cid 762 0: without cid
783 -1: no cid assigned yet 763 -1: no cid assigned yet
@@ -826,7 +806,7 @@ static void init_failed(struct cardstate *cs, int mode)
826static void schedule_init(struct cardstate *cs, int state) 806static void schedule_init(struct cardstate *cs, int state)
827{ 807{
828 if (cs->at_state.pending_commands & PC_INIT) { 808 if (cs->at_state.pending_commands & PC_INIT) {
829 dbg(DEBUG_CMD, "not scheduling PC_INIT again"); 809 gig_dbg(DEBUG_CMD, "not scheduling PC_INIT again");
830 return; 810 return;
831 } 811 }
832 atomic_set(&cs->mstate, state); 812 atomic_set(&cs->mstate, state);
@@ -834,52 +814,56 @@ static void schedule_init(struct cardstate *cs, int state)
834 gigaset_block_channels(cs); 814 gigaset_block_channels(cs);
835 cs->at_state.pending_commands |= PC_INIT; 815 cs->at_state.pending_commands |= PC_INIT;
836 atomic_set(&cs->commands_pending, 1); 816 atomic_set(&cs->commands_pending, 1);
837 dbg(DEBUG_CMD, "Scheduling PC_INIT"); 817 gig_dbg(DEBUG_CMD, "Scheduling PC_INIT");
838} 818}
839 819
840/* Add "AT" to a command, add the cid, dle encode it, send the result to the hardware. */ 820/* Add "AT" to a command, add the cid, dle encode it, send the result to the
821 hardware. */
841static void send_command(struct cardstate *cs, const char *cmd, int cid, 822static void send_command(struct cardstate *cs, const char *cmd, int cid,
842 int dle, gfp_t kmallocflags) 823 int dle, gfp_t kmallocflags)
843{ 824{
844 size_t cmdlen, buflen; 825 size_t cmdlen, buflen;
845 char *cmdpos, *cmdbuf, *cmdtail; 826 char *cmdpos, *cmdbuf, *cmdtail;
846 827
847 cmdlen = strlen(cmd); 828 cmdlen = strlen(cmd);
848 buflen = 11 + cmdlen; 829 buflen = 11 + cmdlen;
830 if (unlikely(buflen <= cmdlen)) {
831 dev_err(cs->dev, "integer overflow in buflen\n");
832 return;
833 }
849 834
850 if (likely(buflen > cmdlen)) { 835 cmdbuf = kmalloc(buflen, kmallocflags);
851 cmdbuf = kmalloc(buflen, kmallocflags); 836 if (unlikely(!cmdbuf)) {
852 if (likely(cmdbuf != NULL)) { 837 dev_err(cs->dev, "out of memory\n");
853 cmdpos = cmdbuf + 9; 838 return;
854 cmdtail = cmdpos + cmdlen; 839 }
855 memcpy(cmdpos, cmd, cmdlen);
856
857 if (cid > 0 && cid <= 65535) {
858 do {
859 *--cmdpos = '0' + cid % 10;
860 cid /= 10;
861 ++cmdlen;
862 } while (cid);
863 }
864 840
865 cmdlen += 2; 841 cmdpos = cmdbuf + 9;
866 *--cmdpos = 'T'; 842 cmdtail = cmdpos + cmdlen;
867 *--cmdpos = 'A'; 843 memcpy(cmdpos, cmd, cmdlen);
868 844
869 if (dle) { 845 if (cid > 0 && cid <= 65535) {
870 cmdlen += 4; 846 do {
871 *--cmdpos = '('; 847 *--cmdpos = '0' + cid % 10;
872 *--cmdpos = 0x10; 848 cid /= 10;
873 *cmdtail++ = 0x10; 849 ++cmdlen;
874 *cmdtail++ = ')'; 850 } while (cid);
875 } 851 }
876 852
877 cs->ops->write_cmd(cs, cmdpos, cmdlen, NULL); 853 cmdlen += 2;
878 kfree(cmdbuf); 854 *--cmdpos = 'T';
879 } else 855 *--cmdpos = 'A';
880 err("no memory for command buffer"); 856
881 } else 857 if (dle) {
882 err("overflow in buflen"); 858 cmdlen += 4;
859 *--cmdpos = '(';
860 *--cmdpos = 0x10;
861 *cmdtail++ = 0x10;
862 *cmdtail++ = ')';
863 }
864
865 cs->ops->write_cmd(cs, cmdpos, cmdlen, NULL);
866 kfree(cmdbuf);
883} 867}
884 868
885static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid) 869static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
@@ -910,9 +894,6 @@ static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
910 894
911static void bchannel_down(struct bc_state *bcs) 895static void bchannel_down(struct bc_state *bcs)
912{ 896{
913 IFNULLRET(bcs);
914 IFNULLRET(bcs->cs);
915
916 if (bcs->chstate & CHS_B_UP) { 897 if (bcs->chstate & CHS_B_UP) {
917 bcs->chstate &= ~CHS_B_UP; 898 bcs->chstate &= ~CHS_B_UP;
918 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP); 899 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP);
@@ -930,16 +911,15 @@ static void bchannel_down(struct bc_state *bcs)
930 911
931static void bchannel_up(struct bc_state *bcs) 912static void bchannel_up(struct bc_state *bcs)
932{ 913{
933 IFNULLRET(bcs);
934
935 if (!(bcs->chstate & CHS_D_UP)) { 914 if (!(bcs->chstate & CHS_D_UP)) {
936 notice("%s: D channel not up", __func__); 915 dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
937 bcs->chstate |= CHS_D_UP; 916 bcs->chstate |= CHS_D_UP;
938 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN); 917 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
939 } 918 }
940 919
941 if (bcs->chstate & CHS_B_UP) { 920 if (bcs->chstate & CHS_B_UP) {
942 notice("%s: B channel already up", __func__); 921 dev_notice(bcs->cs->dev, "%s: B channel already up\n",
922 __func__);
943 return; 923 return;
944 } 924 }
945 925
@@ -947,17 +927,21 @@ static void bchannel_up(struct bc_state *bcs)
947 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BCONN); 927 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BCONN);
948} 928}
949 929
950static void start_dial(struct at_state_t *at_state, void *data, int seq_index) 930static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_index)
951{ 931{
952 struct bc_state *bcs = at_state->bcs; 932 struct bc_state *bcs = at_state->bcs;
953 struct cardstate *cs = at_state->cs; 933 struct cardstate *cs = at_state->cs;
954 int retval; 934 int retval;
935 unsigned long flags;
955 936
956 bcs->chstate |= CHS_NOTIFY_LL; 937 bcs->chstate |= CHS_NOTIFY_LL;
957 //atomic_set(&bcs->status, BCS_INIT);
958 938
959 if (atomic_read(&at_state->seq_index) != seq_index) 939 spin_lock_irqsave(&cs->lock, flags);
940 if (at_state->seq_index != seq_index) {
941 spin_unlock_irqrestore(&cs->lock, flags);
960 goto error; 942 goto error;
943 }
944 spin_unlock_irqrestore(&cs->lock, flags);
961 945
962 retval = gigaset_isdn_setup_dial(at_state, data); 946 retval = gigaset_isdn_setup_dial(at_state, data);
963 if (retval != 0) 947 if (retval != 0)
@@ -965,20 +949,14 @@ static void start_dial(struct at_state_t *at_state, void *data, int seq_index)
965 949
966 950
967 at_state->pending_commands |= PC_CID; 951 at_state->pending_commands |= PC_CID;
968 dbg(DEBUG_CMD, "Scheduling PC_CID"); 952 gig_dbg(DEBUG_CMD, "Scheduling PC_CID");
969//#ifdef GIG_MAYINITONDIAL 953 atomic_set(&cs->commands_pending, 1);
970// if (atomic_read(&cs->MState) == MS_UNKNOWN) {
971// cs->at_state.pending_commands |= PC_INIT;
972// dbg(DEBUG_CMD, "Scheduling PC_INIT");
973// }
974//#endif
975 atomic_set(&cs->commands_pending, 1); //FIXME
976 return; 954 return;
977 955
978error: 956error:
979 at_state->pending_commands |= PC_NOCID; 957 at_state->pending_commands |= PC_NOCID;
980 dbg(DEBUG_CMD, "Scheduling PC_NOCID"); 958 gig_dbg(DEBUG_CMD, "Scheduling PC_NOCID");
981 atomic_set(&cs->commands_pending, 1); //FIXME 959 atomic_set(&cs->commands_pending, 1);
982 return; 960 return;
983} 961}
984 962
@@ -991,13 +969,13 @@ static void start_accept(struct at_state_t *at_state)
991 969
992 if (retval == 0) { 970 if (retval == 0) {
993 at_state->pending_commands |= PC_ACCEPT; 971 at_state->pending_commands |= PC_ACCEPT;
994 dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); 972 gig_dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
995 atomic_set(&cs->commands_pending, 1); //FIXME 973 atomic_set(&cs->commands_pending, 1);
996 } else { 974 } else {
997 //FIXME 975 //FIXME
998 at_state->pending_commands |= PC_HUP; 976 at_state->pending_commands |= PC_HUP;
999 dbg(DEBUG_CMD, "Scheduling PC_HUP"); 977 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
1000 atomic_set(&cs->commands_pending, 1); //FIXME 978 atomic_set(&cs->commands_pending, 1);
1001 } 979 }
1002} 980}
1003 981
@@ -1008,9 +986,10 @@ static void do_start(struct cardstate *cs)
1008 if (atomic_read(&cs->mstate) != MS_LOCKED) 986 if (atomic_read(&cs->mstate) != MS_LOCKED)
1009 schedule_init(cs, MS_INIT); 987 schedule_init(cs, MS_INIT);
1010 988
989 cs->isdn_up = 1;
1011 gigaset_i4l_cmd(cs, ISDN_STAT_RUN); 990 gigaset_i4l_cmd(cs, ISDN_STAT_RUN);
1012 // FIXME: not in locked mode 991 // FIXME: not in locked mode
1013 // FIXME 2: only after init sequence 992 // FIXME 2: only after init sequence
1014 993
1015 cs->waiting = 0; 994 cs->waiting = 0;
1016 wake_up(&cs->waitqueue); 995 wake_up(&cs->waitqueue);
@@ -1023,6 +1002,12 @@ static void finish_shutdown(struct cardstate *cs)
1023 atomic_set(&cs->mode, M_UNKNOWN); 1002 atomic_set(&cs->mode, M_UNKNOWN);
1024 } 1003 }
1025 1004
1005 /* Tell the LL that the device is not available .. */
1006 if (cs->isdn_up) {
1007 cs->isdn_up = 0;
1008 gigaset_i4l_cmd(cs, ISDN_STAT_STOP);
1009 }
1010
1026 /* The rest is done by cleanup_cs () in user mode. */ 1011 /* The rest is done by cleanup_cs () in user mode. */
1027 1012
1028 cs->cmd_result = -ENODEV; 1013 cs->cmd_result = -ENODEV;
@@ -1037,15 +1022,20 @@ static void do_shutdown(struct cardstate *cs)
1037 if (atomic_read(&cs->mstate) == MS_READY) { 1022 if (atomic_read(&cs->mstate) == MS_READY) {
1038 atomic_set(&cs->mstate, MS_SHUTDOWN); 1023 atomic_set(&cs->mstate, MS_SHUTDOWN);
1039 cs->at_state.pending_commands |= PC_SHUTDOWN; 1024 cs->at_state.pending_commands |= PC_SHUTDOWN;
1040 atomic_set(&cs->commands_pending, 1); //FIXME 1025 atomic_set(&cs->commands_pending, 1);
1041 dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN"); //FIXME 1026 gig_dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
1042 //gigaset_schedule_event(cs); //FIXME
1043 } else 1027 } else
1044 finish_shutdown(cs); 1028 finish_shutdown(cs);
1045} 1029}
1046 1030
1047static void do_stop(struct cardstate *cs) 1031static void do_stop(struct cardstate *cs)
1048{ 1032{
1033 unsigned long flags;
1034
1035 spin_lock_irqsave(&cs->lock, flags);
1036 cs->connected = 0;
1037 spin_unlock_irqrestore(&cs->lock, flags);
1038
1049 do_shutdown(cs); 1039 do_shutdown(cs);
1050} 1040}
1051 1041
@@ -1069,9 +1059,11 @@ static int reinit_and_retry(struct cardstate *cs, int channel)
1069 return 0; 1059 return 0;
1070 1060
1071 if (channel < 0) 1061 if (channel < 0)
1072 warn("Could not enter cid mode. Reinit device and try again."); 1062 dev_warn(cs->dev,
1063 "Could not enter cid mode. Reinit device and try again.\n");
1073 else { 1064 else {
1074 warn("Could not get a call id. Reinit device and try again."); 1065 dev_warn(cs->dev,
1066 "Could not get a call id. Reinit device and try again.\n");
1075 cs->bcs[channel].at_state.pending_commands |= PC_CID; 1067 cs->bcs[channel].at_state.pending_commands |= PC_CID;
1076 } 1068 }
1077 schedule_init(cs, MS_INIT); 1069 schedule_init(cs, MS_INIT);
@@ -1079,7 +1071,7 @@ static int reinit_and_retry(struct cardstate *cs, int channel)
1079} 1071}
1080 1072
1081static int at_state_invalid(struct cardstate *cs, 1073static int at_state_invalid(struct cardstate *cs,
1082 struct at_state_t *test_ptr) 1074 struct at_state_t *test_ptr)
1083{ 1075{
1084 unsigned long flags; 1076 unsigned long flags;
1085 unsigned channel; 1077 unsigned channel;
@@ -1116,7 +1108,7 @@ static void handle_icall(struct cardstate *cs, struct bc_state *bcs,
1116 case ICALL_ACCEPT: 1108 case ICALL_ACCEPT:
1117 break; 1109 break;
1118 default: 1110 default:
1119 err("internal error: disposition=%d", retval); 1111 dev_err(cs->dev, "internal error: disposition=%d\n", retval);
1120 /* --v-- fall through --v-- */ 1112 /* --v-- fall through --v-- */
1121 case ICALL_IGNORE: 1113 case ICALL_IGNORE:
1122 case ICALL_REJECT: 1114 case ICALL_REJECT:
@@ -1160,7 +1152,6 @@ static int do_lock(struct cardstate *cs)
1160 mode = atomic_read(&cs->mode); 1152 mode = atomic_read(&cs->mode);
1161 atomic_set(&cs->mstate, MS_LOCKED); 1153 atomic_set(&cs->mstate, MS_LOCKED);
1162 atomic_set(&cs->mode, M_UNKNOWN); 1154 atomic_set(&cs->mode, M_UNKNOWN);
1163 //FIXME reset card state / at states / bcs states
1164 1155
1165 return mode; 1156 return mode;
1166} 1157}
@@ -1173,8 +1164,7 @@ static int do_unlock(struct cardstate *cs)
1173 atomic_set(&cs->mstate, MS_UNINITIALIZED); 1164 atomic_set(&cs->mstate, MS_UNINITIALIZED);
1174 atomic_set(&cs->mode, M_UNKNOWN); 1165 atomic_set(&cs->mode, M_UNKNOWN);
1175 gigaset_free_channels(cs); 1166 gigaset_free_channels(cs);
1176 //FIXME reset card state / at states / bcs states 1167 if (cs->connected)
1177 if (atomic_read(&cs->connected))
1178 schedule_init(cs, MS_INIT); 1168 schedule_init(cs, MS_INIT);
1179 1169
1180 return 0; 1170 return 0;
@@ -1203,21 +1193,23 @@ static void do_action(int action, struct cardstate *cs,
1203 at_state->waiting = 1; 1193 at_state->waiting = 1;
1204 break; 1194 break;
1205 case ACT_INIT: 1195 case ACT_INIT:
1206 //FIXME setup everything
1207 cs->at_state.pending_commands &= ~PC_INIT; 1196 cs->at_state.pending_commands &= ~PC_INIT;
1208 cs->cur_at_seq = SEQ_NONE; 1197 cs->cur_at_seq = SEQ_NONE;
1209 atomic_set(&cs->mode, M_UNIMODEM); 1198 atomic_set(&cs->mode, M_UNIMODEM);
1210 if (!atomic_read(&cs->cidmode)) { 1199 spin_lock_irqsave(&cs->lock, flags);
1200 if (!cs->cidmode) {
1201 spin_unlock_irqrestore(&cs->lock, flags);
1211 gigaset_free_channels(cs); 1202 gigaset_free_channels(cs);
1212 atomic_set(&cs->mstate, MS_READY); 1203 atomic_set(&cs->mstate, MS_READY);
1213 break; 1204 break;
1214 } 1205 }
1206 spin_unlock_irqrestore(&cs->lock, flags);
1215 cs->at_state.pending_commands |= PC_CIDMODE; 1207 cs->at_state.pending_commands |= PC_CIDMODE;
1216 atomic_set(&cs->commands_pending, 1); //FIXME 1208 atomic_set(&cs->commands_pending, 1);
1217 dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1209 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
1218 break; 1210 break;
1219 case ACT_FAILINIT: 1211 case ACT_FAILINIT:
1220 warn("Could not initialize the device."); 1212 dev_warn(cs->dev, "Could not initialize the device.\n");
1221 cs->dle = 0; 1213 cs->dle = 0;
1222 init_failed(cs, M_UNKNOWN); 1214 init_failed(cs, M_UNKNOWN);
1223 cs->cur_at_seq = SEQ_NONE; 1215 cs->cur_at_seq = SEQ_NONE;
@@ -1273,8 +1265,8 @@ static void do_action(int action, struct cardstate *cs,
1273 /* get fresh AT state structure for new CID */ 1265 /* get fresh AT state structure for new CID */
1274 at_state2 = get_free_channel(cs, ev->parameter); 1266 at_state2 = get_free_channel(cs, ev->parameter);
1275 if (!at_state2) { 1267 if (!at_state2) {
1276 warn("RING ignored: " 1268 dev_warn(cs->dev,
1277 "could not allocate channel structure"); 1269 "RING ignored: could not allocate channel structure\n");
1278 break; 1270 break;
1279 } 1271 }
1280 1272
@@ -1302,7 +1294,7 @@ static void do_action(int action, struct cardstate *cs,
1302 at_state = *p_at_state; 1294 at_state = *p_at_state;
1303 break; 1295 break;
1304 case ACT_FAILSDOWN: 1296 case ACT_FAILSDOWN:
1305 warn("Could not shut down the device."); 1297 dev_warn(cs->dev, "Could not shut down the device.\n");
1306 /* fall through */ 1298 /* fall through */
1307 case ACT_FAKESDOWN: 1299 case ACT_FAKESDOWN:
1308 case ACT_SDOWN: 1300 case ACT_SDOWN:
@@ -1355,7 +1347,7 @@ static void do_action(int action, struct cardstate *cs,
1355 break; 1347 break;
1356 case ACT_ABORTHUP: 1348 case ACT_ABORTHUP:
1357 cs->cur_at_seq = SEQ_NONE; 1349 cs->cur_at_seq = SEQ_NONE;
1358 warn("Could not hang up."); 1350 dev_warn(cs->dev, "Could not hang up.\n");
1359 at_state->cid = -1; 1351 at_state->cid = -1;
1360 if (bcs && cs->onechannel) 1352 if (bcs && cs->onechannel)
1361 at_state->pending_commands |= PC_DLE0; 1353 at_state->pending_commands |= PC_DLE0;
@@ -1367,14 +1359,15 @@ static void do_action(int action, struct cardstate *cs,
1367 break; 1359 break;
1368 case ACT_FAILDLE0: 1360 case ACT_FAILDLE0:
1369 cs->cur_at_seq = SEQ_NONE; 1361 cs->cur_at_seq = SEQ_NONE;
1370 warn("Could not leave DLE mode."); 1362 dev_warn(cs->dev, "Could not leave DLE mode.\n");
1371 at_state2 = &cs->bcs[cs->curchannel].at_state; 1363 at_state2 = &cs->bcs[cs->curchannel].at_state;
1372 disconnect(&at_state2); 1364 disconnect(&at_state2);
1373 schedule_init(cs, MS_RECOVER); 1365 schedule_init(cs, MS_RECOVER);
1374 break; 1366 break;
1375 case ACT_FAILDLE1: 1367 case ACT_FAILDLE1:
1376 cs->cur_at_seq = SEQ_NONE; 1368 cs->cur_at_seq = SEQ_NONE;
1377 warn("Could not enter DLE mode. Try to hang up."); 1369 dev_warn(cs->dev,
1370 "Could not enter DLE mode. Trying to hang up.\n");
1378 channel = cs->curchannel; 1371 channel = cs->curchannel;
1379 cs->bcs[channel].at_state.pending_commands |= PC_HUP; 1372 cs->bcs[channel].at_state.pending_commands |= PC_HUP;
1380 atomic_set(&cs->commands_pending, 1); 1373 atomic_set(&cs->commands_pending, 1);
@@ -1395,7 +1388,8 @@ static void do_action(int action, struct cardstate *cs,
1395 cs->cur_at_seq = SEQ_NONE; 1388 cs->cur_at_seq = SEQ_NONE;
1396 channel = cs->curchannel; 1389 channel = cs->curchannel;
1397 if (!reinit_and_retry(cs, channel)) { 1390 if (!reinit_and_retry(cs, channel)) {
1398 warn("Could not get a call id. Dialing not possible"); 1391 dev_warn(cs->dev,
1392 "Could not get a call ID. Cannot dial.\n");
1399 at_state2 = &cs->bcs[channel].at_state; 1393 at_state2 = &cs->bcs[channel].at_state;
1400 disconnect(&at_state2); 1394 disconnect(&at_state2);
1401 } 1395 }
@@ -1428,7 +1422,8 @@ static void do_action(int action, struct cardstate *cs,
1428 at_state->pending_commands |= PC_HUP; 1422 at_state->pending_commands |= PC_HUP;
1429 atomic_set(&cs->commands_pending, 1); 1423 atomic_set(&cs->commands_pending, 1);
1430 break; 1424 break;
1431 case ACT_GETSTRING: /* warning: RING, ZDLE, ... are not handled properly any more */ 1425 case ACT_GETSTRING: /* warning: RING, ZDLE, ...
1426 are not handled properly anymore */
1432 at_state->getstring = 1; 1427 at_state->getstring = 1;
1433 break; 1428 break;
1434 case ACT_SETVER: 1429 case ACT_SETVER:
@@ -1469,16 +1464,16 @@ static void do_action(int action, struct cardstate *cs,
1469 case ACT_GOTVER: 1464 case ACT_GOTVER:
1470 if (cs->gotfwver == 0) { 1465 if (cs->gotfwver == 0) {
1471 cs->gotfwver = 1; 1466 cs->gotfwver = 1;
1472 dbg(DEBUG_ANY, 1467 gig_dbg(DEBUG_ANY,
1473 "firmware version %02d.%03d.%02d.%02d", 1468 "firmware version %02d.%03d.%02d.%02d",
1474 cs->fwver[0], cs->fwver[1], 1469 cs->fwver[0], cs->fwver[1],
1475 cs->fwver[2], cs->fwver[3]); 1470 cs->fwver[2], cs->fwver[3]);
1476 break; 1471 break;
1477 } 1472 }
1478 /* fall through */ 1473 /* fall through */
1479 case ACT_FAILVER: 1474 case ACT_FAILVER:
1480 cs->gotfwver = -1; 1475 cs->gotfwver = -1;
1481 err("could not read firmware version."); 1476 dev_err(cs->dev, "could not read firmware version.\n");
1482 break; 1477 break;
1483#ifdef CONFIG_GIGASET_DEBUG 1478#ifdef CONFIG_GIGASET_DEBUG
1484 case ACT_ERROR: 1479 case ACT_ERROR:
@@ -1496,16 +1491,16 @@ static void do_action(int action, struct cardstate *cs,
1496 break; 1491 break;
1497#endif 1492#endif
1498 case ACT_DEBUG: 1493 case ACT_DEBUG:
1499 dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d", 1494 gig_dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d",
1500 __func__, ev->type, at_state->ConState); 1495 __func__, ev->type, at_state->ConState);
1501 break; 1496 break;
1502 case ACT_WARN: 1497 case ACT_WARN:
1503 warn("%s: resp_code %d in ConState %d!", 1498 dev_warn(cs->dev, "%s: resp_code %d in ConState %d!\n",
1504 __func__, ev->type, at_state->ConState); 1499 __func__, ev->type, at_state->ConState);
1505 break; 1500 break;
1506 case ACT_ZCAU: 1501 case ACT_ZCAU:
1507 warn("cause code %04x in connection state %d.", 1502 dev_warn(cs->dev, "cause code %04x in connection state %d.\n",
1508 ev->parameter, at_state->ConState); 1503 ev->parameter, at_state->ConState);
1509 break; 1504 break;
1510 1505
1511 /* events from the LL */ 1506 /* events from the LL */
@@ -1516,14 +1511,14 @@ static void do_action(int action, struct cardstate *cs,
1516 start_accept(at_state); 1511 start_accept(at_state);
1517 break; 1512 break;
1518 case ACT_PROTO_L2: 1513 case ACT_PROTO_L2:
1519 dbg(DEBUG_CMD, 1514 gig_dbg(DEBUG_CMD, "set protocol to %u",
1520 "set protocol to %u", (unsigned) ev->parameter); 1515 (unsigned) ev->parameter);
1521 at_state->bcs->proto2 = ev->parameter; 1516 at_state->bcs->proto2 = ev->parameter;
1522 break; 1517 break;
1523 case ACT_HUP: 1518 case ACT_HUP:
1524 at_state->pending_commands |= PC_HUP; 1519 at_state->pending_commands |= PC_HUP;
1525 atomic_set(&cs->commands_pending, 1); //FIXME 1520 atomic_set(&cs->commands_pending, 1);
1526 dbg(DEBUG_CMD, "Scheduling PC_HUP"); 1521 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
1527 break; 1522 break;
1528 1523
1529 /* hotplug events */ 1524 /* hotplug events */
@@ -1555,17 +1550,19 @@ static void do_action(int action, struct cardstate *cs,
1555 1550
1556 /* events from the proc file system */ // FIXME without ACT_xxxx? 1551 /* events from the proc file system */ // FIXME without ACT_xxxx?
1557 case ACT_PROC_CIDMODE: 1552 case ACT_PROC_CIDMODE:
1558 if (ev->parameter != atomic_read(&cs->cidmode)) { 1553 spin_lock_irqsave(&cs->lock, flags);
1559 atomic_set(&cs->cidmode, ev->parameter); 1554 if (ev->parameter != cs->cidmode) {
1555 cs->cidmode = ev->parameter;
1560 if (ev->parameter) { 1556 if (ev->parameter) {
1561 cs->at_state.pending_commands |= PC_CIDMODE; 1557 cs->at_state.pending_commands |= PC_CIDMODE;
1562 dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1558 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
1563 } else { 1559 } else {
1564 cs->at_state.pending_commands |= PC_UMMODE; 1560 cs->at_state.pending_commands |= PC_UMMODE;
1565 dbg(DEBUG_CMD, "Scheduling PC_UMMODE"); 1561 gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
1566 } 1562 }
1567 atomic_set(&cs->commands_pending, 1); 1563 atomic_set(&cs->commands_pending, 1);
1568 } 1564 }
1565 spin_unlock_irqrestore(&cs->lock, flags);
1569 cs->waiting = 0; 1566 cs->waiting = 0;
1570 wake_up(&cs->waitqueue); 1567 wake_up(&cs->waitqueue);
1571 break; 1568 break;
@@ -1590,7 +1587,7 @@ static void do_action(int action, struct cardstate *cs,
1590 *p_resp_code = RSP_NULL; 1587 *p_resp_code = RSP_NULL;
1591 } 1588 }
1592 } else 1589 } else
1593 err("%s: action==%d!", __func__, action); 1590 dev_err(cs->dev, "%s: action==%d!\n", __func__, action);
1594 } 1591 }
1595} 1592}
1596 1593
@@ -1609,47 +1606,46 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1609 int curact; 1606 int curact;
1610 unsigned long flags; 1607 unsigned long flags;
1611 1608
1612 IFNULLRET(cs);
1613 IFNULLRET(ev);
1614
1615 if (ev->cid >= 0) { 1609 if (ev->cid >= 0) {
1616 at_state = at_state_from_cid(cs, ev->cid); 1610 at_state = at_state_from_cid(cs, ev->cid);
1617 if (!at_state) { 1611 if (!at_state) {
1618 gigaset_add_event(cs, &cs->at_state, RSP_WRONG_CID, 1612 gigaset_add_event(cs, &cs->at_state, RSP_WRONG_CID,
1619 NULL, 0, NULL); 1613 NULL, 0, NULL);
1620 return; 1614 return;
1621 } 1615 }
1622 } else { 1616 } else {
1623 at_state = ev->at_state; 1617 at_state = ev->at_state;
1624 if (at_state_invalid(cs, at_state)) { 1618 if (at_state_invalid(cs, at_state)) {
1625 dbg(DEBUG_ANY, 1619 gig_dbg(DEBUG_ANY, "event for invalid at_state %p",
1626 "event for invalid at_state %p", at_state); 1620 at_state);
1627 return; 1621 return;
1628 } 1622 }
1629 } 1623 }
1630 1624
1631 dbg(DEBUG_CMD, 1625 gig_dbg(DEBUG_CMD, "connection state %d, event %d",
1632 "connection state %d, event %d", at_state->ConState, ev->type); 1626 at_state->ConState, ev->type);
1633 1627
1634 bcs = at_state->bcs; 1628 bcs = at_state->bcs;
1635 sendcid = at_state->cid; 1629 sendcid = at_state->cid;
1636 1630
1637 /* Setting the pointer to the dial array */ 1631 /* Setting the pointer to the dial array */
1638 rep = at_state->replystruct; 1632 rep = at_state->replystruct;
1639 IFNULLRET(rep);
1640 1633
1634 spin_lock_irqsave(&cs->lock, flags);
1641 if (ev->type == EV_TIMEOUT) { 1635 if (ev->type == EV_TIMEOUT) {
1642 if (ev->parameter != atomic_read(&at_state->timer_index) 1636 if (ev->parameter != at_state->timer_index
1643 || !at_state->timer_active) { 1637 || !at_state->timer_active) {
1644 ev->type = RSP_NONE; /* old timeout */ 1638 ev->type = RSP_NONE; /* old timeout */
1645 dbg(DEBUG_ANY, "old timeout"); 1639 gig_dbg(DEBUG_ANY, "old timeout");
1646 } else if (!at_state->waiting) 1640 } else if (!at_state->waiting)
1647 dbg(DEBUG_ANY, "timeout occured"); 1641 gig_dbg(DEBUG_ANY, "timeout occurred");
1648 else 1642 else
1649 dbg(DEBUG_ANY, "stopped waiting"); 1643 gig_dbg(DEBUG_ANY, "stopped waiting");
1650 } 1644 }
1645 spin_unlock_irqrestore(&cs->lock, flags);
1651 1646
1652 /* if the response belongs to a variable in at_state->int_var[VAR_XXXX] or at_state->str_var[STR_XXXX], set it */ 1647 /* if the response belongs to a variable in at_state->int_var[VAR_XXXX]
1648 or at_state->str_var[STR_XXXX], set it */
1653 if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) { 1649 if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) {
1654 index = ev->type - RSP_VAR; 1650 index = ev->type - RSP_VAR;
1655 at_state->int_var[index] = ev->parameter; 1651 at_state->int_var[index] = ev->parameter;
@@ -1657,20 +1653,22 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1657 index = ev->type - RSP_STR; 1653 index = ev->type - RSP_STR;
1658 kfree(at_state->str_var[index]); 1654 kfree(at_state->str_var[index]);
1659 at_state->str_var[index] = ev->ptr; 1655 at_state->str_var[index] = ev->ptr;
1660 ev->ptr = NULL; /* prevent process_events() from deallocating ptr */ 1656 ev->ptr = NULL; /* prevent process_events() from
1657 deallocating ptr */
1661 } 1658 }
1662 1659
1663 if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING) 1660 if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING)
1664 at_state->getstring = 0; 1661 at_state->getstring = 0;
1665 1662
1666 /* Search row in dial array which matches modem response and current constate */ 1663 /* Search row in dial array which matches modem response and current
1664 constate */
1667 for (;; rep++) { 1665 for (;; rep++) {
1668 rcode = rep->resp_code; 1666 rcode = rep->resp_code;
1669 /* dbg (DEBUG_ANY, "rcode %d", rcode); */
1670 if (rcode == RSP_LAST) { 1667 if (rcode == RSP_LAST) {
1671 /* found nothing...*/ 1668 /* found nothing...*/
1672 warn("%s: rcode=RSP_LAST: resp_code %d in ConState %d!", 1669 dev_warn(cs->dev, "%s: rcode=RSP_LAST: "
1673 __func__, ev->type, at_state->ConState); 1670 "resp_code %d in ConState %d!\n",
1671 __func__, ev->type, at_state->ConState);
1674 return; 1672 return;
1675 } 1673 }
1676 if ((rcode == RSP_ANY || rcode == ev->type) 1674 if ((rcode == RSP_ANY || rcode == ev->type)
@@ -1706,14 +1704,14 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1706 } else { 1704 } else {
1707 /* Send command to modem if not NULL... */ 1705 /* Send command to modem if not NULL... */
1708 if (p_command/*rep->command*/) { 1706 if (p_command/*rep->command*/) {
1709 if (atomic_read(&cs->connected)) 1707 if (cs->connected)
1710 send_command(cs, p_command, 1708 send_command(cs, p_command,
1711 sendcid, cs->dle, 1709 sendcid, cs->dle,
1712 GFP_ATOMIC); 1710 GFP_ATOMIC);
1713 else 1711 else
1714 gigaset_add_event(cs, at_state, 1712 gigaset_add_event(cs, at_state,
1715 RSP_NODEV, 1713 RSP_NODEV,
1716 NULL, 0, NULL); 1714 NULL, 0, NULL);
1717 } 1715 }
1718 1716
1719 spin_lock_irqsave(&cs->lock, flags); 1717 spin_lock_irqsave(&cs->lock, flags);
@@ -1723,8 +1721,7 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1723 } else if (rep->timeout > 0) { /* new timeout */ 1721 } else if (rep->timeout > 0) { /* new timeout */
1724 at_state->timer_expires = rep->timeout * 10; 1722 at_state->timer_expires = rep->timeout * 10;
1725 at_state->timer_active = 1; 1723 at_state->timer_active = 1;
1726 new_index(&at_state->timer_index, 1724 ++at_state->timer_index;
1727 MAX_TIMER_INDEX);
1728 } 1725 }
1729 spin_unlock_irqrestore(&cs->lock, flags); 1726 spin_unlock_irqrestore(&cs->lock, flags);
1730 } 1727 }
@@ -1744,17 +1741,16 @@ static void process_command_flags(struct cardstate *cs)
1744 struct bc_state *bcs; 1741 struct bc_state *bcs;
1745 int i; 1742 int i;
1746 int sequence; 1743 int sequence;
1747 1744 unsigned long flags;
1748 IFNULLRET(cs);
1749 1745
1750 atomic_set(&cs->commands_pending, 0); 1746 atomic_set(&cs->commands_pending, 0);
1751 1747
1752 if (cs->cur_at_seq) { 1748 if (cs->cur_at_seq) {
1753 dbg(DEBUG_CMD, "not searching scheduled commands: busy"); 1749 gig_dbg(DEBUG_CMD, "not searching scheduled commands: busy");
1754 return; 1750 return;
1755 } 1751 }
1756 1752
1757 dbg(DEBUG_CMD, "searching scheduled commands"); 1753 gig_dbg(DEBUG_CMD, "searching scheduled commands");
1758 1754
1759 sequence = SEQ_NONE; 1755 sequence = SEQ_NONE;
1760 1756
@@ -1795,8 +1791,9 @@ static void process_command_flags(struct cardstate *cs)
1795 } 1791 }
1796 1792
1797 /* only switch back to unimodem mode, if no commands are pending and no channels are up */ 1793 /* only switch back to unimodem mode, if no commands are pending and no channels are up */
1794 spin_lock_irqsave(&cs->lock, flags);
1798 if (cs->at_state.pending_commands == PC_UMMODE 1795 if (cs->at_state.pending_commands == PC_UMMODE
1799 && !atomic_read(&cs->cidmode) 1796 && !cs->cidmode
1800 && list_empty(&cs->temp_at_states) 1797 && list_empty(&cs->temp_at_states)
1801 && atomic_read(&cs->mode) == M_CID) { 1798 && atomic_read(&cs->mode) == M_CID) {
1802 sequence = SEQ_UMMODE; 1799 sequence = SEQ_UMMODE;
@@ -1810,6 +1807,7 @@ static void process_command_flags(struct cardstate *cs)
1810 } 1807 }
1811 } 1808 }
1812 } 1809 }
1810 spin_unlock_irqrestore(&cs->lock, flags);
1813 cs->at_state.pending_commands &= ~PC_UMMODE; 1811 cs->at_state.pending_commands &= ~PC_UMMODE;
1814 if (sequence != SEQ_NONE) { 1812 if (sequence != SEQ_NONE) {
1815 schedule_sequence(cs, at_state, sequence); 1813 schedule_sequence(cs, at_state, sequence);
@@ -1865,11 +1863,7 @@ static void process_command_flags(struct cardstate *cs)
1865 if (cs->at_state.pending_commands & PC_CIDMODE) { 1863 if (cs->at_state.pending_commands & PC_CIDMODE) {
1866 cs->at_state.pending_commands &= ~PC_CIDMODE; 1864 cs->at_state.pending_commands &= ~PC_CIDMODE;
1867 if (atomic_read(&cs->mode) == M_UNIMODEM) { 1865 if (atomic_read(&cs->mode) == M_UNIMODEM) {
1868#if 0
1869 cs->retry_count = 2;
1870#else
1871 cs->retry_count = 1; 1866 cs->retry_count = 1;
1872#endif
1873 schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE); 1867 schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE);
1874 return; 1868 return;
1875 } 1869 }
@@ -1897,7 +1891,7 @@ static void process_command_flags(struct cardstate *cs)
1897 switch (atomic_read(&cs->mode)) { 1891 switch (atomic_read(&cs->mode)) {
1898 case M_UNIMODEM: 1892 case M_UNIMODEM:
1899 cs->at_state.pending_commands |= PC_CIDMODE; 1893 cs->at_state.pending_commands |= PC_CIDMODE;
1900 dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1894 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
1901 atomic_set(&cs->commands_pending, 1); 1895 atomic_set(&cs->commands_pending, 1);
1902 return; 1896 return;
1903#ifdef GIG_MAYINITONDIAL 1897#ifdef GIG_MAYINITONDIAL
@@ -1926,18 +1920,21 @@ static void process_events(struct cardstate *cs)
1926 int i; 1920 int i;
1927 int check_flags = 0; 1921 int check_flags = 0;
1928 int was_busy; 1922 int was_busy;
1923 unsigned long flags;
1929 1924
1930 /* no locking needed (only one reader) */ 1925 spin_lock_irqsave(&cs->ev_lock, flags);
1931 head = atomic_read(&cs->ev_head); 1926 head = cs->ev_head;
1932 1927
1933 for (i = 0; i < 2 * MAX_EVENTS; ++i) { 1928 for (i = 0; i < 2 * MAX_EVENTS; ++i) {
1934 tail = atomic_read(&cs->ev_tail); 1929 tail = cs->ev_tail;
1935 if (tail == head) { 1930 if (tail == head) {
1936 if (!check_flags && !atomic_read(&cs->commands_pending)) 1931 if (!check_flags && !atomic_read(&cs->commands_pending))
1937 break; 1932 break;
1938 check_flags = 0; 1933 check_flags = 0;
1934 spin_unlock_irqrestore(&cs->ev_lock, flags);
1939 process_command_flags(cs); 1935 process_command_flags(cs);
1940 tail = atomic_read(&cs->ev_tail); 1936 spin_lock_irqsave(&cs->ev_lock, flags);
1937 tail = cs->ev_tail;
1941 if (tail == head) { 1938 if (tail == head) {
1942 if (!atomic_read(&cs->commands_pending)) 1939 if (!atomic_read(&cs->commands_pending))
1943 break; 1940 break;
@@ -1947,18 +1944,23 @@ static void process_events(struct cardstate *cs)
1947 1944
1948 ev = cs->events + head; 1945 ev = cs->events + head;
1949 was_busy = cs->cur_at_seq != SEQ_NONE; 1946 was_busy = cs->cur_at_seq != SEQ_NONE;
1947 spin_unlock_irqrestore(&cs->ev_lock, flags);
1950 process_event(cs, ev); 1948 process_event(cs, ev);
1949 spin_lock_irqsave(&cs->ev_lock, flags);
1951 kfree(ev->ptr); 1950 kfree(ev->ptr);
1952 ev->ptr = NULL; 1951 ev->ptr = NULL;
1953 if (was_busy && cs->cur_at_seq == SEQ_NONE) 1952 if (was_busy && cs->cur_at_seq == SEQ_NONE)
1954 check_flags = 1; 1953 check_flags = 1;
1955 1954
1956 head = (head + 1) % MAX_EVENTS; 1955 head = (head + 1) % MAX_EVENTS;
1957 atomic_set(&cs->ev_head, head); 1956 cs->ev_head = head;
1958 } 1957 }
1959 1958
1959 spin_unlock_irqrestore(&cs->ev_lock, flags);
1960
1960 if (i == 2 * MAX_EVENTS) { 1961 if (i == 2 * MAX_EVENTS) {
1961 err("infinite loop in process_events; aborting."); 1962 dev_err(cs->dev,
1963 "infinite loop in process_events; aborting.\n");
1962 } 1964 }
1963} 1965}
1964 1966
@@ -1970,12 +1972,9 @@ void gigaset_handle_event(unsigned long data)
1970{ 1972{
1971 struct cardstate *cs = (struct cardstate *) data; 1973 struct cardstate *cs = (struct cardstate *) data;
1972 1974
1973 IFNULLRET(cs);
1974 IFNULLRET(cs->inbuf);
1975
1976 /* handle incoming data on control/common channel */ 1975 /* handle incoming data on control/common channel */
1977 if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) { 1976 if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) {
1978 dbg(DEBUG_INTR, "processing new data"); 1977 gig_dbg(DEBUG_INTR, "processing new data");
1979 cs->ops->handle_input(cs->inbuf); 1978 cs->ops->handle_input(cs->inbuf);
1980 } 1979 }
1981 1980
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 729edcdb6dac..9d21ba8757b0 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -1,11 +1,16 @@
1/* Siemens Gigaset 307x driver 1/*
2 * Siemens Gigaset 307x driver
2 * Common header file for all connection variants 3 * Common header file for all connection variants
3 * 4 *
4 * Written by Stefan Eilers <Eilers.Stefan@epost.de> 5 * Written by Stefan Eilers
5 * and Hansjoerg Lipp <hjlipp@web.de> 6 * and Hansjoerg Lipp <hjlipp@web.de>
6 * 7 *
7 * Version: $Id: gigaset.h,v 1.97.4.26 2006/02/04 18:28:16 hjlipp Exp $ 8 * =====================================================================
8 * =========================================================================== 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 * =====================================================================
9 */ 14 */
10 15
11#ifndef GIGASET_H 16#ifndef GIGASET_H
@@ -15,7 +20,6 @@
15#include <linux/kernel.h> 20#include <linux/kernel.h>
16#include <linux/compiler.h> 21#include <linux/compiler.h>
17#include <linux/types.h> 22#include <linux/types.h>
18#include <asm/atomic.h>
19#include <linux/spinlock.h> 23#include <linux/spinlock.h>
20#include <linux/isdnif.h> 24#include <linux/isdnif.h>
21#include <linux/usb.h> 25#include <linux/usb.h>
@@ -27,21 +31,22 @@
27#include <linux/tty.h> 31#include <linux/tty.h>
28#include <linux/tty_driver.h> 32#include <linux/tty_driver.h>
29#include <linux/list.h> 33#include <linux/list.h>
34#include <asm/atomic.h>
30 35
31#define GIG_VERSION {0,5,0,0} 36#define GIG_VERSION {0,5,0,0}
32#define GIG_COMPAT {0,4,0,0} 37#define GIG_COMPAT {0,4,0,0}
33 38
34#define MAX_REC_PARAMS 10 /* Max. number of params in response string */ 39#define MAX_REC_PARAMS 10 /* Max. number of params in response string */
35#define MAX_RESP_SIZE 512 /* Max. size of a response string */ 40#define MAX_RESP_SIZE 512 /* Max. size of a response string */
36#define HW_HDR_LEN 2 /* Header size used to store ack info */ 41#define HW_HDR_LEN 2 /* Header size used to store ack info */
37 42
38#define MAX_EVENTS 64 /* size of event queue */ 43#define MAX_EVENTS 64 /* size of event queue */
39 44
40#define RBUFSIZE 8192 45#define RBUFSIZE 8192
41#define SBUFSIZE 4096 /* sk_buff payload size */ 46#define SBUFSIZE 4096 /* sk_buff payload size */
42 47
43#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ 48#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
44#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ 49#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
45 50
46/* compile time options */ 51/* compile time options */
47#define GIG_MAJOR 0 52#define GIG_MAJOR 0
@@ -50,10 +55,7 @@
50#define GIG_RETRYCID 55#define GIG_RETRYCID
51#define GIG_X75 56#define GIG_X75
52 57
53#define MAX_TIMER_INDEX 1000 58#define GIG_TICK 100 /* in milliseconds */
54#define MAX_SEQ_INDEX 1000
55
56#define GIG_TICK (HZ / 10)
57 59
58/* timeout values (unit: 1 sec) */ 60/* timeout values (unit: 1 sec) */
59#define INIT_TIMEOUT 1 61#define INIT_TIMEOUT 1
@@ -67,74 +69,89 @@
67 69
68#define MAXACT 3 70#define MAXACT 3
69 71
70#define IFNULL(a) if (unlikely(!(a)))
71#define IFNULLRET(a) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); return; }
72#define IFNULLRETVAL(a,b) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); return (b); }
73#define IFNULLCONT(a) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); continue; }
74#define IFNULLGOTO(a,b) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); goto b; }
75
76extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ 72extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
77 73
78/* any combination of these can be given with the 'debug=' parameter to insmod, e.g. 74/* any combination of these can be given with the 'debug=' parameter to insmod,
79 * 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and DEBUG_INTR. */ 75 * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and
76 * DEBUG_INTR.
77 */
80enum debuglevel { /* up to 24 bits (atomic_t) */ 78enum debuglevel { /* up to 24 bits (atomic_t) */
81 DEBUG_REG = 0x0002, /* serial port I/O register operations */ 79 DEBUG_REG = 0x0002, /* serial port I/O register operations */
82 DEBUG_OPEN = 0x0004, /* open/close serial port */ 80 DEBUG_OPEN = 0x0004, /* open/close serial port */
83 DEBUG_INTR = 0x0008, /* interrupt processing */ 81 DEBUG_INTR = 0x0008, /* interrupt processing */
84 DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on interrupt 82 DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
85 requests, not available as run-time option */ 83 interrupt requests, not available as
84 run-time option */
86 DEBUG_CMD = 0x00020, /* sent/received LL commands */ 85 DEBUG_CMD = 0x00020, /* sent/received LL commands */
87 DEBUG_STREAM = 0x00040, /* application data stream I/O events */ 86 DEBUG_STREAM = 0x00040, /* application data stream I/O events */
88 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */ 87 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
89 DEBUG_LLDATA = 0x00100, /* sent/received LL data */ 88 DEBUG_LLDATA = 0x00100, /* sent/received LL data */
90 DEBUG_INTR_0 = 0x00200, /* serial port output interrupt processing */ 89 DEBUG_INTR_0 = 0x00200, /* serial port interrupt processing */
91 DEBUG_DRIVER = 0x00400, /* driver structure */ 90 DEBUG_DRIVER = 0x00400, /* driver structure */
92 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */ 91 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
93 DEBUG_WRITE = 0x01000, /* M105 data write */ 92 DEBUG_WRITE = 0x01000, /* M105 data write */
94 DEBUG_TRANSCMD = 0x02000, /*AT-COMMANDS+RESPONSES*/ 93 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
95 DEBUG_MCMD = 0x04000, /*COMMANDS THAT ARE SENT VERY OFTEN*/ 94 DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */
96 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data structures */ 95 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data
96 structures */
97 DEBUG_LOCK = 0x10000, /* semaphore operations */ 97 DEBUG_LOCK = 0x10000, /* semaphore operations */
98 DEBUG_OUTPUT = 0x20000, /* output to device */ 98 DEBUG_OUTPUT = 0x20000, /* output to device */
99 DEBUG_ISO = 0x40000, /* isochronous transfers */ 99 DEBUG_ISO = 0x40000, /* isochronous transfers */
100 DEBUG_IF = 0x80000, /* character device operations */ 100 DEBUG_IF = 0x80000, /* character device operations */
101 DEBUG_USBREQ = 0x100000, /* USB communication (except payload data) */ 101 DEBUG_USBREQ = 0x100000, /* USB communication (except payload
102 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when MS_LOCKED */ 102 data) */
103 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
104 MS_LOCKED */
103 105
104 DEBUG_ANY = 0x3fffff, /* print message if any of the others is activated */ 106 DEBUG_ANY = 0x3fffff, /* print message if any of the others is
107 activated */
105}; 108};
106 109
107#ifdef CONFIG_GIGASET_DEBUG 110/* missing from linux/device.h ... */
108#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) 111#ifndef dev_notice
109//#define DEBUG_DEFAULT (DEBUG_LOCK | DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUF_IF | DEBUG_DRIVER | DEBUG_OUTPUT | DEBUG_INTR) 112#define dev_notice(dev, format, arg...) \
110#else 113 dev_printk(KERN_NOTICE , dev , format , ## arg)
111#define DEBUG_DEFAULT 0
112#endif 114#endif
113 115
114/* redefine syslog macros to prepend module name instead of entire source path */ 116/* Kernel message macros for situations where dev_printk and friends cannot be
115/* The space before the comma in ", ##" is needed by gcc 2.95 */ 117 * used for lack of reliable access to a device structure.
118 * linux/usb.h already contains these but in an obsolete form which clutters
119 * the log needlessly, and according to the USB maintainer those should be
120 * removed rather than fixed anyway.
121 */
122#undef err
116#undef info 123#undef info
117#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
118
119#undef notice
120#define notice(format, arg...) printk(KERN_NOTICE "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
121
122#undef warn 124#undef warn
123#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 125#undef notice
124 126
125#undef err 127#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
126#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 128 format "\n" , ## arg)
129#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
130 format "\n" , ## arg)
131#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
132 format "\n" , ## arg)
133#define notice(format, arg...) printk(KERN_NOTICE KBUILD_MODNAME ": " \
134 format "\n" , ## arg)
127 135
128#undef dbg
129#ifdef CONFIG_GIGASET_DEBUG 136#ifdef CONFIG_GIGASET_DEBUG
130#define dbg(level, format, arg...) do { if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \ 137
131 printk(KERN_DEBUG "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg); } while (0) 138#define gig_dbg(level, format, arg...) \
139 do { \
140 if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
141 printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
142 ## arg); \
143 } while (0)
144#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
145
132#else 146#else
133#define dbg(level, format, arg...) do {} while (0) 147
148#define gig_dbg(level, format, arg...) do {} while (0)
149#define DEBUG_DEFAULT 0
150
134#endif 151#endif
135 152
136void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, 153void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
137 size_t len, const unsigned char *buf, int from_user); 154 size_t len, const unsigned char *buf);
138 155
139/* connection state */ 156/* connection state */
140#define ZSAU_NONE 0 157#define ZSAU_NONE 0
@@ -148,13 +165,14 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
148#define ZSAU_UNKNOWN -1 165#define ZSAU_UNKNOWN -1
149 166
150/* USB control transfer requests */ 167/* USB control transfer requests */
151#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT) 168#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
152#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT) 169#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
153 170
154/* int-in-events 3070 */ 171/* int-in-events 3070 */
155#define HD_B1_FLOW_CONTROL 0x80 172#define HD_B1_FLOW_CONTROL 0x80
156#define HD_B2_FLOW_CONTROL 0x81 173#define HD_B2_FLOW_CONTROL 0x81
157#define HD_RECEIVEATDATA_ACK (0x35) // 3070 // att: HD_RECEIVE>>AT<<DATA_ACK 174#define HD_RECEIVEATDATA_ACK (0x35) // 3070
175 // att: HD_RECEIVE>>AT<<DATA_ACK
158#define HD_READY_SEND_ATDATA (0x36) // 3070 176#define HD_READY_SEND_ATDATA (0x36) // 3070
159#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070 177#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070
160#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070 178#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070
@@ -181,17 +199,18 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
181#define HD_CLOSE_ATCHANNEL (0x29) // 3070 199#define HD_CLOSE_ATCHANNEL (0x29) // 3070
182 200
183/* USB frames for isochronous transfer */ 201/* USB frames for isochronous transfer */
184#define BAS_FRAMETIME 1 /* number of milliseconds between frames */ 202#define BAS_FRAMETIME 1 /* number of milliseconds between frames */
185#define BAS_NUMFRAMES 8 /* number of frames per URB */ 203#define BAS_NUMFRAMES 8 /* number of frames per URB */
186#define BAS_MAXFRAME 16 /* allocated bytes per frame */ 204#define BAS_MAXFRAME 16 /* allocated bytes per frame */
187#define BAS_NORMFRAME 8 /* send size without flow control */ 205#define BAS_NORMFRAME 8 /* send size without flow control */
188#define BAS_HIGHFRAME 10 /* " " with positive flow control */ 206#define BAS_HIGHFRAME 10 /* " " with positive flow control */
189#define BAS_LOWFRAME 5 /* " " with negative flow control */ 207#define BAS_LOWFRAME 5 /* " " with negative flow control */
190#define BAS_CORRFRAMES 4 /* flow control multiplicator */ 208#define BAS_CORRFRAMES 4 /* flow control multiplicator */
191 209
192#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES) /* size of isochronous input buffer per URB */ 210#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES)
193#define BAS_OUTBUFSIZE 4096 /* size of common isochronous output buffer */ 211 /* size of isoc in buf per URB */
194#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isochronous output buffer */ 212#define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */
213#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */
195 214
196#define BAS_INURBS 3 215#define BAS_INURBS 3
197#define BAS_OUTURBS 3 216#define BAS_OUTURBS 3
@@ -207,40 +226,40 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
207#define AT_NUM 7 226#define AT_NUM 7
208 227
209/* variables in struct at_state_t */ 228/* variables in struct at_state_t */
210#define VAR_ZSAU 0 229#define VAR_ZSAU 0
211#define VAR_ZDLE 1 230#define VAR_ZDLE 1
212#define VAR_ZVLS 2 231#define VAR_ZVLS 2
213#define VAR_ZCTP 3 232#define VAR_ZCTP 3
214#define VAR_NUM 4 233#define VAR_NUM 4
215 234
216#define STR_NMBR 0 235#define STR_NMBR 0
217#define STR_ZCPN 1 236#define STR_ZCPN 1
218#define STR_ZCON 2 237#define STR_ZCON 2
219#define STR_ZBC 3 238#define STR_ZBC 3
220#define STR_ZHLC 4 239#define STR_ZHLC 4
221#define STR_NUM 5 240#define STR_NUM 5
222 241
223#define EV_TIMEOUT -105 242#define EV_TIMEOUT -105
224#define EV_IF_VER -106 243#define EV_IF_VER -106
225#define EV_PROC_CIDMODE -107 244#define EV_PROC_CIDMODE -107
226#define EV_SHUTDOWN -108 245#define EV_SHUTDOWN -108
227#define EV_START -110 246#define EV_START -110
228#define EV_STOP -111 247#define EV_STOP -111
229#define EV_IF_LOCK -112 248#define EV_IF_LOCK -112
230#define EV_PROTO_L2 -113 249#define EV_PROTO_L2 -113
231#define EV_ACCEPT -114 250#define EV_ACCEPT -114
232#define EV_DIAL -115 251#define EV_DIAL -115
233#define EV_HUP -116 252#define EV_HUP -116
234#define EV_BC_OPEN -117 253#define EV_BC_OPEN -117
235#define EV_BC_CLOSED -118 254#define EV_BC_CLOSED -118
236 255
237/* input state */ 256/* input state */
238#define INS_command 0x0001 257#define INS_command 0x0001
239#define INS_DLE_char 0x0002 258#define INS_DLE_char 0x0002
240#define INS_byte_stuff 0x0004 259#define INS_byte_stuff 0x0004
241#define INS_have_data 0x0008 260#define INS_have_data 0x0008
242#define INS_skip_frame 0x0010 261#define INS_skip_frame 0x0010
243#define INS_DLE_command 0x0020 262#define INS_DLE_command 0x0020
244#define INS_flag_hunt 0x0040 263#define INS_flag_hunt 0x0040
245 264
246/* channel state */ 265/* channel state */
@@ -248,27 +267,27 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
248#define CHS_B_UP 0x02 267#define CHS_B_UP 0x02
249#define CHS_NOTIFY_LL 0x04 268#define CHS_NOTIFY_LL 0x04
250 269
251#define ICALL_REJECT 0 270#define ICALL_REJECT 0
252#define ICALL_ACCEPT 1 271#define ICALL_ACCEPT 1
253#define ICALL_IGNORE 2 272#define ICALL_IGNORE 2
254 273
255/* device state */ 274/* device state */
256#define MS_UNINITIALIZED 0 275#define MS_UNINITIALIZED 0
257#define MS_INIT 1 276#define MS_INIT 1
258#define MS_LOCKED 2 277#define MS_LOCKED 2
259#define MS_SHUTDOWN 3 278#define MS_SHUTDOWN 3
260#define MS_RECOVER 4 279#define MS_RECOVER 4
261#define MS_READY 5 280#define MS_READY 5
262 281
263/* mode */ 282/* mode */
264#define M_UNKNOWN 0 283#define M_UNKNOWN 0
265#define M_CONFIG 1 284#define M_CONFIG 1
266#define M_UNIMODEM 2 285#define M_UNIMODEM 2
267#define M_CID 3 286#define M_CID 3
268 287
269/* start mode */ 288/* start mode */
270#define SM_LOCKED 0 289#define SM_LOCKED 0
271#define SM_ISDN 1 /* default */ 290#define SM_ISDN 1 /* default */
272 291
273struct gigaset_ops; 292struct gigaset_ops;
274struct gigaset_driver; 293struct gigaset_driver;
@@ -283,27 +302,26 @@ struct ser_bc_state;
283struct bas_bc_state; 302struct bas_bc_state;
284 303
285struct reply_t { 304struct reply_t {
286 int resp_code; /* RSP_XXXX */ 305 int resp_code; /* RSP_XXXX */
287 int min_ConState; /* <0 => ignore */ 306 int min_ConState; /* <0 => ignore */
288 int max_ConState; /* <0 => ignore */ 307 int max_ConState; /* <0 => ignore */
289 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/ 308 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/
290 int new_ConState; /* <0 => ignore */ 309 int new_ConState; /* <0 => ignore */
291 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/ 310 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/
292 int action[MAXACT]; /* ACT_XXXX */ 311 int action[MAXACT]; /* ACT_XXXX */
293 char *command; /* NULL==none */ 312 char *command; /* NULL==none */
294}; 313};
295 314
296extern struct reply_t gigaset_tab_cid_m10x[]; 315extern struct reply_t gigaset_tab_cid_m10x[];
297extern struct reply_t gigaset_tab_nocid_m10x[]; 316extern struct reply_t gigaset_tab_nocid_m10x[];
298 317
299struct inbuf_t { 318struct inbuf_t {
300 unsigned char *rcvbuf; /* usb-gigaset receive buffer */ 319 unsigned char *rcvbuf; /* usb-gigaset receive buffer */
301 struct bc_state *bcs; 320 struct bc_state *bcs;
302 struct cardstate *cs; 321 struct cardstate *cs;
303 int inputstate; 322 int inputstate;
304 323 atomic_t head, tail;
305 atomic_t head, tail; 324 unsigned char data[RBUFSIZE];
306 unsigned char data[RBUFSIZE];
307}; 325};
308 326
309/* isochronous write buffer structure 327/* isochronous write buffer structure
@@ -319,16 +337,9 @@ struct inbuf_t {
319 * if writesem <= 0, data[write..read-1] is currently being written to 337 * if writesem <= 0, data[write..read-1] is currently being written to
320 * - idle contains the byte value to repeat when the end of valid data is 338 * - idle contains the byte value to repeat when the end of valid data is
321 * reached; if nextread==write (buffer contains no data to send), either the 339 * reached; if nextread==write (buffer contains no data to send), either the
322 * BAS_OUTBUFPAD bytes immediately before data[write] (if write>=BAS_OUTBUFPAD) 340 * BAS_OUTBUFPAD bytes immediately before data[write] (if
323 * or those of the pad area (if write<BAS_OUTBUFPAD) are also filled with that 341 * write>=BAS_OUTBUFPAD) or those of the pad area (if write<BAS_OUTBUFPAD)
324 * value 342 * are also filled with that value
325 * - optionally, the following statistics on the buffer's usage can be collected:
326 * maxfill: maximum number of bytes occupied
327 * idlefills: number of times a frame of idle bytes is prepared
328 * emptygets: number of times the buffer was empty when a data frame was requested
329 * backtoback: number of times two data packets were entered into the buffer
330 * without intervening idle flags
331 * nakedback: set if no idle flags have been inserted since the last data packet
332 */ 343 */
333struct isowbuf_t { 344struct isowbuf_t {
334 atomic_t read; 345 atomic_t read;
@@ -358,34 +369,28 @@ struct isow_urbctx_t {
358 * it is currently assigned a B channel 369 * it is currently assigned a B channel
359 */ 370 */
360struct at_state_t { 371struct at_state_t {
361 struct list_head list; 372 struct list_head list;
362 int waiting; 373 int waiting;
363 int getstring; 374 int getstring;
364 atomic_t timer_index; 375 unsigned timer_index;
365 unsigned long timer_expires; 376 unsigned long timer_expires;
366 int timer_active; 377 int timer_active;
367 unsigned int ConState; /* State of connection */ 378 unsigned int ConState; /* State of connection */
368 struct reply_t *replystruct; 379 struct reply_t *replystruct;
369 int cid; 380 int cid;
370 int int_var[VAR_NUM]; /* see VAR_XXXX */ 381 int int_var[VAR_NUM]; /* see VAR_XXXX */
371 char *str_var[STR_NUM]; /* see STR_XXXX */ 382 char *str_var[STR_NUM]; /* see STR_XXXX */
372 unsigned pending_commands; /* see PC_XXXX */ 383 unsigned pending_commands; /* see PC_XXXX */
373 atomic_t seq_index; 384 unsigned seq_index;
374 385
375 struct cardstate *cs; 386 struct cardstate *cs;
376 struct bc_state *bcs; 387 struct bc_state *bcs;
377}; 388};
378 389
379struct resp_type_t { 390struct resp_type_t {
380 unsigned char *response; 391 unsigned char *response;
381 int resp_code; /* RSP_XXXX */ 392 int resp_code; /* RSP_XXXX */
382 int type; /* RT_XXXX */ 393 int type; /* RT_XXXX */
383};
384
385struct prot_skb {
386 atomic_t empty;
387 struct semaphore *sem;
388 struct sk_buff *skb;
389}; 394};
390 395
391struct event_t { 396struct event_t {
@@ -398,29 +403,29 @@ struct event_t {
398 403
399/* This buffer holds all information about the used B-Channel */ 404/* This buffer holds all information about the used B-Channel */
400struct bc_state { 405struct bc_state {
401 struct sk_buff *tx_skb; /* Current transfer buffer to modem */ 406 struct sk_buff *tx_skb; /* Current transfer buffer to modem */
402 struct sk_buff_head squeue; /* B-Channel send Queue */ 407 struct sk_buff_head squeue; /* B-Channel send Queue */
403 408
404 /* Variables for debugging .. */ 409 /* Variables for debugging .. */
405 int corrupted; /* Counter for corrupted packages */ 410 int corrupted; /* Counter for corrupted packages */
406 int trans_down; /* Counter of packages (downstream) */ 411 int trans_down; /* Counter of packages (downstream) */
407 int trans_up; /* Counter of packages (upstream) */ 412 int trans_up; /* Counter of packages (upstream) */
408 413
409 struct at_state_t at_state; 414 struct at_state_t at_state;
410 unsigned long rcvbytes; 415 unsigned long rcvbytes;
411 416
412 __u16 fcs; 417 __u16 fcs;
413 struct sk_buff *skb; 418 struct sk_buff *skb;
414 int inputstate; /* see INS_XXXX */ 419 int inputstate; /* see INS_XXXX */
415 420
416 int channel; 421 int channel;
417 422
418 struct cardstate *cs; 423 struct cardstate *cs;
419 424
420 unsigned chstate; /* bitmap (CHS_*) */ 425 unsigned chstate; /* bitmap (CHS_*) */
421 int ignore; 426 int ignore;
422 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */ 427 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */
423 char *commands[AT_NUM]; /* see AT_XXXX */ 428 char *commands[AT_NUM]; /* see AT_XXXX */
424 429
425#ifdef CONFIG_GIGASET_DEBUG 430#ifdef CONFIG_GIGASET_DEBUG
426 int emptycount; 431 int emptycount;
@@ -428,37 +433,39 @@ struct bc_state {
428 int busy; 433 int busy;
429 int use_count; 434 int use_count;
430 435
431 /* hardware drivers */ 436 /* private data of hardware drivers */
432 union { 437 union {
433 struct ser_bc_state *ser; /* private data of serial hardware driver */ 438 struct ser_bc_state *ser; /* serial hardware driver */
434 struct usb_bc_state *usb; /* private data of usb hardware driver */ 439 struct usb_bc_state *usb; /* usb hardware driver (m105) */
435 struct bas_bc_state *bas; 440 struct bas_bc_state *bas; /* usb hardware driver (base) */
436 } hw; 441 } hw;
437}; 442};
438 443
439struct cardstate { 444struct cardstate {
440 struct gigaset_driver *driver; 445 struct gigaset_driver *driver;
441 unsigned minor_index; 446 unsigned minor_index;
447 struct device *dev;
442 448
443 const struct gigaset_ops *ops; 449 const struct gigaset_ops *ops;
444 450
445 /* Stuff to handle communication */ 451 /* Stuff to handle communication */
446 //wait_queue_head_t initwait;
447 wait_queue_head_t waitqueue; 452 wait_queue_head_t waitqueue;
448 int waiting; 453 int waiting;
449 atomic_t mode; /* see M_XXXX */ 454 atomic_t mode; /* see M_XXXX */
450 atomic_t mstate; /* Modem state: see MS_XXXX */ 455 atomic_t mstate; /* Modem state: see MS_XXXX */
451 /* only changed by the event layer */ 456 /* only changed by the event layer */
452 int cmd_result; 457 int cmd_result;
453 458
454 int channels; 459 int channels;
455 struct bc_state *bcs; /* Array of struct bc_state */ 460 struct bc_state *bcs; /* Array of struct bc_state */
456 461
457 int onechannel; /* data and commands transmitted in one stream (M10x) */ 462 int onechannel; /* data and commands transmitted in one
463 stream (M10x) */
458 464
459 spinlock_t lock; 465 spinlock_t lock;
460 struct at_state_t at_state; /* at_state_t for cid == 0 */ 466 struct at_state_t at_state; /* at_state_t for cid == 0 */
461 struct list_head temp_at_states; /* list of temporary "struct at_state_t"s without B channel */ 467 struct list_head temp_at_states;/* list of temporary "struct
468 at_state_t"s without B channel */
462 469
463 struct inbuf_t *inbuf; 470 struct inbuf_t *inbuf;
464 471
@@ -474,58 +481,69 @@ struct cardstate {
474 unsigned fwver[4]; 481 unsigned fwver[4];
475 int gotfwver; 482 int gotfwver;
476 483
477 atomic_t running; /* !=0 if events are handled */ 484 unsigned running; /* !=0 if events are handled */
478 atomic_t connected; /* !=0 if hardware is connected */ 485 unsigned connected; /* !=0 if hardware is connected */
486 unsigned isdn_up; /* !=0 after ISDN_STAT_RUN */
479 487
480 atomic_t cidmode; 488 unsigned cidmode;
481 489
482 int myid; /* id for communication with LL */ 490 int myid; /* id for communication with LL */
483 isdn_if iif; 491 isdn_if iif;
484 492
485 struct reply_t *tabnocid; 493 struct reply_t *tabnocid;
486 struct reply_t *tabcid; 494 struct reply_t *tabcid;
487 int cs_init; 495 int cs_init;
488 int ignoreframes; /* frames to ignore after setting up the B channel */ 496 int ignoreframes; /* frames to ignore after setting up the
489 struct semaphore sem; /* locks this structure: */ 497 B channel */
490 /* connected is not changed, */ 498 struct mutex mutex; /* locks this structure:
491 /* hardware_up is not changed, */ 499 * connected is not changed,
492 /* MState is not changed to or from MS_LOCKED */ 500 * hardware_up is not changed,
501 * MState is not changed to or from
502 * MS_LOCKED */
493 503
494 struct timer_list timer; 504 struct timer_list timer;
495 int retry_count; 505 int retry_count;
496 int dle; /* !=0 if modem commands/responses are dle encoded */ 506 int dle; /* !=0 if modem commands/responses are
497 int cur_at_seq; /* sequence of AT commands being processed */ 507 dle encoded */
498 int curchannel; /* channel, those commands are meant for */ 508 int cur_at_seq; /* sequence of AT commands being
499 atomic_t commands_pending; /* flag(s) in xxx.commands_pending have been set */ 509 processed */
500 struct tasklet_struct event_tasklet; /* tasklet for serializing AT commands. Scheduled 510 int curchannel; /* channel those commands are meant
501 * -> for modem reponses (and incomming data for M10x) 511 for */
502 * -> on timeout 512 atomic_t commands_pending; /* flag(s) in xxx.commands_pending have
503 * -> after setting bits in xxx.at_state.pending_command 513 been set */
504 * (e.g. command from LL) */ 514 struct tasklet_struct event_tasklet;
505 struct tasklet_struct write_tasklet; /* tasklet for serial output 515 /* tasklet for serializing AT commands.
506 * (not used in base driver) */ 516 * Scheduled
517 * -> for modem reponses (and
518 * incoming data for M10x)
519 * -> on timeout
520 * -> after setting bits in
521 * xxx.at_state.pending_command
522 * (e.g. command from LL) */
523 struct tasklet_struct write_tasklet;
524 /* tasklet for serial output
525 * (not used in base driver) */
507 526
508 /* event queue */ 527 /* event queue */
509 struct event_t events[MAX_EVENTS]; 528 struct event_t events[MAX_EVENTS];
510 atomic_t ev_tail, ev_head; 529 unsigned ev_tail, ev_head;
511 spinlock_t ev_lock; 530 spinlock_t ev_lock;
512 531
513 /* current modem response */ 532 /* current modem response */
514 unsigned char respdata[MAX_RESP_SIZE]; 533 unsigned char respdata[MAX_RESP_SIZE];
515 unsigned cbytes; 534 unsigned cbytes;
516 535
517 /* hardware drivers */ 536 /* private data of hardware drivers */
518 union { 537 union {
519 struct usb_cardstate *usb; /* private data of USB hardware driver */ 538 struct usb_cardstate *usb; /* USB hardware driver (m105) */
520 struct ser_cardstate *ser; /* private data of serial hardware driver */ 539 struct ser_cardstate *ser; /* serial hardware driver */
521 struct bas_cardstate *bas; /* private data of base hardware driver */ 540 struct bas_cardstate *bas; /* USB hardware driver (base) */
522 } hw; 541 } hw;
523}; 542};
524 543
525struct gigaset_driver { 544struct gigaset_driver {
526 struct list_head list; 545 struct list_head list;
527 spinlock_t lock; /* locks minor tables and blocked */ 546 spinlock_t lock; /* locks minor tables and blocked */
528 //struct semaphore sem; /* locks this structure */
529 struct tty_driver *tty; 547 struct tty_driver *tty;
530 unsigned have_tty; 548 unsigned have_tty;
531 unsigned minor; 549 unsigned minor;
@@ -553,37 +571,42 @@ struct bas_bc_state {
553 struct isow_urbctx_t isoouturbs[BAS_OUTURBS]; 571 struct isow_urbctx_t isoouturbs[BAS_OUTURBS];
554 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl; 572 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl;
555 struct isowbuf_t *isooutbuf; 573 struct isowbuf_t *isooutbuf;
556 unsigned numsub; /* submitted URB counter (for diagnostic messages only) */ 574 unsigned numsub; /* submitted URB counter
575 (for diagnostic messages only) */
557 struct tasklet_struct sent_tasklet; 576 struct tasklet_struct sent_tasklet;
558 577
559 /* isochronous input state */ 578 /* isochronous input state */
560 spinlock_t isoinlock; 579 spinlock_t isoinlock;
561 struct urb *isoinurbs[BAS_INURBS]; 580 struct urb *isoinurbs[BAS_INURBS];
562 unsigned char isoinbuf[BAS_INBUFSIZE * BAS_INURBS]; 581 unsigned char isoinbuf[BAS_INBUFSIZE * BAS_INURBS];
563 struct urb *isoindone; /* completed isoc read URB */ 582 struct urb *isoindone; /* completed isoc read URB */
564 int loststatus; /* status of dropped URB */ 583 int loststatus; /* status of dropped URB */
565 unsigned isoinlost; /* number of bytes lost */ 584 unsigned isoinlost; /* number of bytes lost */
566 /* state of bit unstuffing algorithm (in addition to BC_state.inputstate) */ 585 /* state of bit unstuffing algorithm
567 unsigned seqlen; /* number of '1' bits not yet unstuffed */ 586 (in addition to BC_state.inputstate) */
568 unsigned inbyte, inbits; /* collected bits for next byte */ 587 unsigned seqlen; /* number of '1' bits not yet
588 unstuffed */
589 unsigned inbyte, inbits; /* collected bits for next byte */
569 /* statistics */ 590 /* statistics */
570 unsigned goodbytes; /* bytes correctly received */ 591 unsigned goodbytes; /* bytes correctly received */
571 unsigned alignerrs; /* frames with incomplete byte at end */ 592 unsigned alignerrs; /* frames with incomplete byte at end */
572 unsigned fcserrs; /* FCS errors */ 593 unsigned fcserrs; /* FCS errors */
573 unsigned frameerrs; /* framing errors */ 594 unsigned frameerrs; /* framing errors */
574 unsigned giants; /* long frames */ 595 unsigned giants; /* long frames */
575 unsigned runts; /* short frames */ 596 unsigned runts; /* short frames */
576 unsigned aborts; /* HDLC aborts */ 597 unsigned aborts; /* HDLC aborts */
577 unsigned shared0s; /* '0' bits shared between flags */ 598 unsigned shared0s; /* '0' bits shared between flags */
578 unsigned stolen0s; /* '0' stuff bits also serving as leading flag bits */ 599 unsigned stolen0s; /* '0' stuff bits also serving as
600 leading flag bits */
579 struct tasklet_struct rcvd_tasklet; 601 struct tasklet_struct rcvd_tasklet;
580}; 602};
581 603
582struct gigaset_ops { 604struct gigaset_ops {
583 /* Called from ev-layer.c/interface.c for sending AT commands to the device */ 605 /* Called from ev-layer.c/interface.c for sending AT commands to the
606 device */
584 int (*write_cmd)(struct cardstate *cs, 607 int (*write_cmd)(struct cardstate *cs,
585 const unsigned char *buf, int len, 608 const unsigned char *buf, int len,
586 struct tasklet_struct *wake_tasklet); 609 struct tasklet_struct *wake_tasklet);
587 610
588 /* Called from interface.c for additional device control */ 611 /* Called from interface.c for additional device control */
589 int (*write_room)(struct cardstate *cs); 612 int (*write_room)(struct cardstate *cs);
@@ -604,7 +627,8 @@ struct gigaset_ops {
604 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */ 627 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */
605 int (*freebcshw)(struct bc_state *bcs); 628 int (*freebcshw)(struct bc_state *bcs);
606 629
607 /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting bcs->hw.xxx */ 630 /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting
631 bcs->hw.xxx */
608 void (*reinitbcshw)(struct bc_state *bcs); 632 void (*reinitbcshw)(struct bc_state *bcs);
609 633
610 /* Called by gigaset_initcs() for setting up cs->hw.xxx */ 634 /* Called by gigaset_initcs() for setting up cs->hw.xxx */
@@ -613,13 +637,10 @@ struct gigaset_ops {
613 /* Called by gigaset_freecs() for freeing cs->hw.xxx */ 637 /* Called by gigaset_freecs() for freeing cs->hw.xxx */
614 void (*freecshw)(struct cardstate *cs); 638 void (*freecshw)(struct cardstate *cs);
615 639
616 ///* Called by gigaset_stop() for killing URBs, shutting down the device, ... 640 /* Called from common.c/interface.c for additional serial port
617 // hardwareup: ==0: don't try to shut down the device, hardware is really not accessible 641 control */
618 // !=0: hardware still up */ 642 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state,
619 //void (*stophw)(struct cardstate *cs, int hardwareup); 643 unsigned new_state);
620
621 /* Called from common.c/interface.c for additional serial port control */
622 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state, unsigned new_state);
623 int (*baud_rate)(struct cardstate *cs, unsigned cflag); 644 int (*baud_rate)(struct cardstate *cs, unsigned cflag);
624 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag); 645 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag);
625 646
@@ -639,7 +660,7 @@ struct gigaset_ops {
639 * <DLE_FLAG>: 0x10 660 * <DLE_FLAG>: 0x10
640 * <EVENT>: ((a-z)* | (A-Z)* | (0-10)*)+ 661 * <EVENT>: ((a-z)* | (A-Z)* | (0-10)*)+
641 */ 662 */
642#define DLE_FLAG 0x10 663#define DLE_FLAG 0x10
643 664
644/* =========================================================================== 665/* ===========================================================================
645 * Functions implemented in asyncdata.c 666 * Functions implemented in asyncdata.c
@@ -667,7 +688,8 @@ void gigaset_isoc_input(struct inbuf_t *inbuf);
667 688
668/* Called from bas-gigaset.c to process a block of data 689/* Called from bas-gigaset.c to process a block of data
669 * received through the isochronous channel */ 690 * received through the isochronous channel */
670void gigaset_isoc_receive(unsigned char *src, unsigned count, struct bc_state *bcs); 691void gigaset_isoc_receive(unsigned char *src, unsigned count,
692 struct bc_state *bcs);
671 693
672/* Called from bas-gigaset.c to put a block of data 694/* Called from bas-gigaset.c to put a block of data
673 * into the isochronous output buffer */ 695 * into the isochronous output buffer */
@@ -703,7 +725,7 @@ static inline void gigaset_isdn_rcv_err(struct bc_state *bcs)
703 isdn_ctrl response; 725 isdn_ctrl response;
704 726
705 /* error -> LL */ 727 /* error -> LL */
706 dbg(DEBUG_CMD, "sending L1ERR"); 728 gig_dbg(DEBUG_CMD, "sending L1ERR");
707 response.driver = bcs->cs->myid; 729 response.driver = bcs->cs->myid;
708 response.command = ISDN_STAT_L1ERR; 730 response.command = ISDN_STAT_L1ERR;
709 response.arg = bcs->channel; 731 response.arg = bcs->channel;
@@ -727,8 +749,8 @@ void gigaset_handle_modem_response(struct cardstate *cs);
727 */ 749 */
728 750
729/* initialize sysfs for device */ 751/* initialize sysfs for device */
730void gigaset_init_dev_sysfs(struct usb_interface *interface); 752void gigaset_init_dev_sysfs(struct cardstate *cs);
731void gigaset_free_dev_sysfs(struct usb_interface *interface); 753void gigaset_free_dev_sysfs(struct cardstate *cs);
732 754
733/* =========================================================================== 755/* ===========================================================================
734 * Functions implemented in common.c/gigaset.h 756 * Functions implemented in common.c/gigaset.h
@@ -736,7 +758,7 @@ void gigaset_free_dev_sysfs(struct usb_interface *interface);
736 758
737void gigaset_bcs_reinit(struct bc_state *bcs); 759void gigaset_bcs_reinit(struct bc_state *bcs);
738void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs, 760void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
739 struct cardstate *cs, int cid); 761 struct cardstate *cs, int cid);
740int gigaset_get_channel(struct bc_state *bcs); 762int gigaset_get_channel(struct bc_state *bcs);
741void gigaset_free_channel(struct bc_state *bcs); 763void gigaset_free_channel(struct bc_state *bcs);
742int gigaset_get_channels(struct cardstate *cs); 764int gigaset_get_channels(struct cardstate *cs);
@@ -745,16 +767,15 @@ void gigaset_block_channels(struct cardstate *cs);
745 767
746/* Allocate and initialize driver structure. */ 768/* Allocate and initialize driver structure. */
747struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, 769struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
748 const char *procname, 770 const char *procname,
749 const char *devname, 771 const char *devname,
750 const char *devfsname, 772 const char *devfsname,
751 const struct gigaset_ops *ops, 773 const struct gigaset_ops *ops,
752 struct module *owner); 774 struct module *owner);
753 775
754/* Deallocate driver structure. */ 776/* Deallocate driver structure. */
755void gigaset_freedriver(struct gigaset_driver *drv); 777void gigaset_freedriver(struct gigaset_driver *drv);
756void gigaset_debugdrivers(void); 778void gigaset_debugdrivers(void);
757struct cardstate *gigaset_get_cs_by_minor(unsigned minor);
758struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty); 779struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty);
759struct cardstate *gigaset_get_cs_by_id(int id); 780struct cardstate *gigaset_get_cs_by_id(int id);
760 781
@@ -763,7 +784,8 @@ struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv);
763void gigaset_unassign(struct cardstate *cs); 784void gigaset_unassign(struct cardstate *cs);
764void gigaset_blockdriver(struct gigaset_driver *drv); 785void gigaset_blockdriver(struct gigaset_driver *drv);
765 786
766/* Allocate and initialize card state. Calls hardware dependent gigaset_init[b]cs(). */ 787/* Allocate and initialize card state. Calls hardware dependent
788 gigaset_init[b]cs(). */
767struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, 789struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
768 int onechannel, int ignoreframes, 790 int onechannel, int ignoreframes,
769 int cidmode, const char *modulename); 791 int cidmode, const char *modulename);
@@ -788,8 +810,8 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
788 * ptr must be kmalloc()ed (and not be freed by the caller). 810 * ptr must be kmalloc()ed (and not be freed by the caller).
789 */ 811 */
790struct event_t *gigaset_add_event(struct cardstate *cs, 812struct event_t *gigaset_add_event(struct cardstate *cs,
791 struct at_state_t *at_state, int type, 813 struct at_state_t *at_state, int type,
792 void *ptr, int parameter, void *arg); 814 void *ptr, int parameter, void *arg);
793 815
794/* Called on CONFIG1 command from frontend. */ 816/* Called on CONFIG1 command from frontend. */
795int gigaset_enterconfigmode(struct cardstate *cs); //0: success <0: errorcode 817int gigaset_enterconfigmode(struct cardstate *cs); //0: success <0: errorcode
@@ -799,7 +821,7 @@ static inline void gigaset_schedule_event(struct cardstate *cs)
799{ 821{
800 unsigned long flags; 822 unsigned long flags;
801 spin_lock_irqsave(&cs->lock, flags); 823 spin_lock_irqsave(&cs->lock, flags);
802 if (atomic_read(&cs->running)) 824 if (cs->running)
803 tasklet_schedule(&cs->event_tasklet); 825 tasklet_schedule(&cs->event_tasklet);
804 spin_unlock_irqrestore(&cs->lock, flags); 826 spin_unlock_irqrestore(&cs->lock, flags);
805} 827}
@@ -810,7 +832,7 @@ static inline void gigaset_bchannel_down(struct bc_state *bcs)
810{ 832{
811 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_CLOSED, NULL, 0, NULL); 833 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_CLOSED, NULL, 0, NULL);
812 834
813 dbg(DEBUG_CMD, "scheduling BC_CLOSED"); 835 gig_dbg(DEBUG_CMD, "scheduling BC_CLOSED");
814 gigaset_schedule_event(bcs->cs); 836 gigaset_schedule_event(bcs->cs);
815} 837}
816 838
@@ -820,36 +842,19 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs)
820{ 842{
821 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_OPEN, NULL, 0, NULL); 843 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_OPEN, NULL, 0, NULL);
822 844
823 dbg(DEBUG_CMD, "scheduling BC_OPEN"); 845 gig_dbg(DEBUG_CMD, "scheduling BC_OPEN");
824 gigaset_schedule_event(bcs->cs); 846 gigaset_schedule_event(bcs->cs);
825} 847}
826 848
827/* handling routines for sk_buff */ 849/* handling routines for sk_buff */
828/* ============================= */ 850/* ============================= */
829 851
830/* private version of __skb_put()
831 * append 'len' bytes to the content of 'skb', already knowing that the
832 * existing buffer can accomodate them
833 * returns a pointer to the location where the new bytes should be copied to
834 * This function does not take any locks so it must be called with the
835 * appropriate locks held only.
836 */
837static inline unsigned char *gigaset_skb_put_quick(struct sk_buff *skb,
838 unsigned int len)
839{
840 unsigned char *tmp = skb->tail;
841 /*SKB_LINEAR_ASSERT(skb);*/ /* not needed here */
842 skb->tail += len;
843 skb->len += len;
844 return tmp;
845}
846
847/* pass received skb to LL 852/* pass received skb to LL
848 * Warning: skb must not be accessed anymore! 853 * Warning: skb must not be accessed anymore!
849 */ 854 */
850static inline void gigaset_rcv_skb(struct sk_buff *skb, 855static inline void gigaset_rcv_skb(struct sk_buff *skb,
851 struct cardstate *cs, 856 struct cardstate *cs,
852 struct bc_state *bcs) 857 struct bc_state *bcs)
853{ 858{
854 cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb); 859 cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb);
855 bcs->trans_down++; 860 bcs->trans_down++;
@@ -859,8 +864,8 @@ static inline void gigaset_rcv_skb(struct sk_buff *skb,
859 * Warning: skb must not be accessed anymore! 864 * Warning: skb must not be accessed anymore!
860 */ 865 */
861static inline void gigaset_rcv_error(struct sk_buff *procskb, 866static inline void gigaset_rcv_error(struct sk_buff *procskb,
862 struct cardstate *cs, 867 struct cardstate *cs,
863 struct bc_state *bcs) 868 struct bc_state *bcs)
864{ 869{
865 if (procskb) 870 if (procskb)
866 dev_kfree_skb(procskb); 871 dev_kfree_skb(procskb);
@@ -877,46 +882,9 @@ static inline void gigaset_rcv_error(struct sk_buff *procskb,
877/* bitwise byte inversion table */ 882/* bitwise byte inversion table */
878extern __u8 gigaset_invtab[]; /* in common.c */ 883extern __u8 gigaset_invtab[]; /* in common.c */
879 884
880
881/* append received bytes to inbuf */ 885/* append received bytes to inbuf */
882static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf, 886int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
883 const unsigned char *src, 887 unsigned numbytes);
884 unsigned numbytes)
885{
886 unsigned n, head, tail, bytesleft;
887
888 dbg(DEBUG_INTR, "received %u bytes", numbytes);
889
890 if (!numbytes)
891 return 0;
892
893 bytesleft = numbytes;
894 tail = atomic_read(&inbuf->tail);
895 head = atomic_read(&inbuf->head);
896 dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
897
898 while (bytesleft) {
899 if (head > tail)
900 n = head - 1 - tail;
901 else if (head == 0)
902 n = (RBUFSIZE-1) - tail;
903 else
904 n = RBUFSIZE - tail;
905 if (!n) {
906 err("buffer overflow (%u bytes lost)", bytesleft);
907 break;
908 }
909 if (n > bytesleft)
910 n = bytesleft;
911 memcpy(inbuf->data + tail, src, n);
912 bytesleft -= n;
913 tail = (tail + n) % RBUFSIZE;
914 src += n;
915 }
916 dbg(DEBUG_INTR, "setting tail to %u", tail);
917 atomic_set(&inbuf->tail, tail);
918 return numbytes != bytesleft;
919}
920 888
921/* =========================================================================== 889/* ===========================================================================
922 * Functions implemented in interface.c 890 * Functions implemented in interface.c
@@ -924,7 +892,7 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
924 892
925/* initialize interface */ 893/* initialize interface */
926void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, 894void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
927 const char *devname, const char *devfsname); 895 const char *devname, const char *devfsname);
928/* release interface */ 896/* release interface */
929void gigaset_if_freedriver(struct gigaset_driver *drv); 897void gigaset_if_freedriver(struct gigaset_driver *drv);
930/* add minor */ 898/* add minor */
@@ -933,6 +901,6 @@ void gigaset_if_init(struct cardstate *cs);
933void gigaset_if_free(struct cardstate *cs); 901void gigaset_if_free(struct cardstate *cs);
934/* device received data */ 902/* device received data */
935void gigaset_if_receive(struct cardstate *cs, 903void gigaset_if_receive(struct cardstate *cs,
936 unsigned char *buffer, size_t len); 904 unsigned char *buffer, size_t len);
937 905
938#endif 906#endif
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 731a675f21b0..0815dbfb8291 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Stuff used by all variants of the driver 2 * Stuff used by all variants of the driver
3 * 3 *
4 * Copyright (c) 2001 by Stefan Eilers (Eilers.Stefan@epost.de), 4 * Copyright (c) 2001 by Stefan Eilers,
5 * Hansjoerg Lipp (hjlipp@web.de), 5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Tilman Schmidt (tilman@imap.cc). 6 * Tilman Schmidt <tilman@imap.cc>.
7 * 7 *
8 * ===================================================================== 8 * =====================================================================
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -11,15 +11,11 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: i4l.c,v 1.3.2.9 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
21 17
22/* == Handling of I4L IO ============================================================================*/ 18/* == Handling of I4L IO =====================================================*/
23 19
24/* writebuf_from_LL 20/* writebuf_from_LL
25 * called by LL to transmit data on an open channel 21 * called by LL to transmit data on an open channel
@@ -29,14 +25,16 @@
29 * parameters: 25 * parameters:
30 * driverID driver ID as assigned by LL 26 * driverID driver ID as assigned by LL
31 * channel channel number 27 * channel channel number
32 * ack if != 0 LL wants to be notified on completion via statcallb(ISDN_STAT_BSENT) 28 * ack if != 0 LL wants to be notified on completion via
29 * statcallb(ISDN_STAT_BSENT)
33 * skb skb containing data to send 30 * skb skb containing data to send
34 * return value: 31 * return value:
35 * number of accepted bytes 32 * number of accepted bytes
36 * 0 if temporarily unable to accept data (out of buffer space) 33 * 0 if temporarily unable to accept data (out of buffer space)
37 * <0 on error (eg. -EINVAL) 34 * <0 on error (eg. -EINVAL)
38 */ 35 */
39static int writebuf_from_LL(int driverID, int channel, int ack, struct sk_buff *skb) 36static int writebuf_from_LL(int driverID, int channel, int ack,
37 struct sk_buff *skb)
40{ 38{
41 struct cardstate *cs; 39 struct cardstate *cs;
42 struct bc_state *bcs; 40 struct bc_state *bcs;
@@ -54,31 +52,28 @@ static int writebuf_from_LL(int driverID, int channel, int ack, struct sk_buff *
54 bcs = &cs->bcs[channel]; 52 bcs = &cs->bcs[channel];
55 len = skb->len; 53 len = skb->len;
56 54
57 dbg(DEBUG_LLDATA, 55 gig_dbg(DEBUG_LLDATA,
58 "Receiving data from LL (id: %d, channel: %d, ack: %d, size: %d)", 56 "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)",
59 driverID, channel, ack, len); 57 driverID, channel, ack, len);
60 58
61 if (!len) { 59 if (!len) {
62 if (ack) 60 if (ack)
63 warn("not ACKing empty packet from LL"); 61 notice("%s: not ACKing empty packet", __func__);
64 return 0; 62 return 0;
65 } 63 }
66 if (len > MAX_BUF_SIZE) { 64 if (len > MAX_BUF_SIZE) {
67 err("%s: packet too large (%d bytes)", __func__, channel); 65 err("%s: packet too large (%d bytes)", __func__, len);
68 return -EINVAL; 66 return -EINVAL;
69 } 67 }
70 68
71 if (!atomic_read(&cs->connected))
72 return -ENODEV;
73
74 skblen = ack ? len : 0; 69 skblen = ack ? len : 0;
75 skb->head[0] = skblen & 0xff; 70 skb->head[0] = skblen & 0xff;
76 skb->head[1] = skblen >> 8; 71 skb->head[1] = skblen >> 8;
77 dbg(DEBUG_MCMD, "skb: len=%u, skblen=%u: %02x %02x", len, skblen, 72 gig_dbg(DEBUG_MCMD, "skb: len=%u, skblen=%u: %02x %02x",
78 (unsigned) skb->head[0], (unsigned) skb->head[1]); 73 len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]);
79 74
80 /* pass to device-specific module */ 75 /* pass to device-specific module */
81 return cs->ops->send_skb(bcs, skb); 76 return cs->ops->send_skb(bcs, skb); //FIXME cs->ops->send_skb() must handle !cs->connected correctly
82} 77}
83 78
84void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) 79void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb)
@@ -89,14 +84,14 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb)
89 ++bcs->trans_up; 84 ++bcs->trans_up;
90 85
91 if (skb->len) 86 if (skb->len)
92 warn("%s: skb->len==%d", __func__, skb->len); 87 dev_warn(bcs->cs->dev, "%s: skb->len==%d\n",
88 __func__, skb->len);
93 89
94 len = (unsigned char) skb->head[0] | 90 len = (unsigned char) skb->head[0] |
95 (unsigned) (unsigned char) skb->head[1] << 8; 91 (unsigned) (unsigned char) skb->head[1] << 8;
96 if (len) { 92 if (len) {
97 dbg(DEBUG_MCMD, 93 gig_dbg(DEBUG_MCMD, "ACKing to LL (id: %d, ch: %d, sz: %u)",
98 "Acknowledge sending to LL (id: %d, channel: %d size: %u)", 94 bcs->cs->myid, bcs->channel, len);
99 bcs->cs->myid, bcs->channel, len);
100 95
101 response.driver = bcs->cs->myid; 96 response.driver = bcs->cs->myid;
102 response.command = ISDN_STAT_BSENT; 97 response.command = ISDN_STAT_BSENT;
@@ -119,15 +114,12 @@ static int command_from_LL(isdn_ctrl *cntrl)
119 struct bc_state *bcs; 114 struct bc_state *bcs;
120 int retval = 0; 115 int retval = 0;
121 struct setup_parm *sp; 116 struct setup_parm *sp;
117 unsigned param;
118 unsigned long flags;
122 119
123 //dbg(DEBUG_ANY, "Gigaset_HW: Receiving command");
124 gigaset_debugdrivers(); 120 gigaset_debugdrivers();
125 121
126 /* Terminate this call if no device is present. Bt if the command is "ISDN_CMD_LOCK" or 122 if (!cs) {
127 * "ISDN_CMD_UNLOCK" then execute it due to the fact that they are device independent !
128 */
129 //FIXME "remove test for &connected"
130 if ((!cs || !atomic_read(&cs->connected))) {
131 warn("LL tried to access unknown device with nr. %d", 123 warn("LL tried to access unknown device with nr. %d",
132 cntrl->driver); 124 cntrl->driver);
133 return -ENODEV; 125 return -ENODEV;
@@ -135,29 +127,30 @@ static int command_from_LL(isdn_ctrl *cntrl)
135 127
136 switch (cntrl->command) { 128 switch (cntrl->command) {
137 case ISDN_CMD_IOCTL: 129 case ISDN_CMD_IOCTL:
138 130 gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)",
139 dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver:%d,arg: %ld)", 131 cntrl->driver, cntrl->arg);
140 cntrl->driver, cntrl->arg);
141 132
142 warn("ISDN_CMD_IOCTL is not supported."); 133 warn("ISDN_CMD_IOCTL is not supported.");
143 return -EINVAL; 134 return -EINVAL;
144 135
145 case ISDN_CMD_DIAL: 136 case ISDN_CMD_DIAL:
146 dbg(DEBUG_ANY, "ISDN_CMD_DIAL (driver: %d, channel: %ld, " 137 gig_dbg(DEBUG_ANY,
147 "phone: %s,ownmsn: %s, si1: %d, si2: %d)", 138 "ISDN_CMD_DIAL (driver: %d, ch: %ld, "
148 cntrl->driver, cntrl->arg, 139 "phone: %s, ownmsn: %s, si1: %d, si2: %d)",
149 cntrl->parm.setup.phone, cntrl->parm.setup.eazmsn, 140 cntrl->driver, cntrl->arg,
150 cntrl->parm.setup.si1, cntrl->parm.setup.si2); 141 cntrl->parm.setup.phone, cntrl->parm.setup.eazmsn,
142 cntrl->parm.setup.si1, cntrl->parm.setup.si2);
151 143
152 if (cntrl->arg >= cs->channels) { 144 if (cntrl->arg >= cs->channels) {
153 err("invalid channel (%d)", (int) cntrl->arg); 145 err("ISDN_CMD_DIAL: invalid channel (%d)",
146 (int) cntrl->arg);
154 return -EINVAL; 147 return -EINVAL;
155 } 148 }
156 149
157 bcs = cs->bcs + cntrl->arg; 150 bcs = cs->bcs + cntrl->arg;
158 151
159 if (!gigaset_get_channel(bcs)) { 152 if (!gigaset_get_channel(bcs)) {
160 err("channel not free"); 153 err("ISDN_CMD_DIAL: channel not free");
161 return -EBUSY; 154 return -EBUSY;
162 } 155 }
163 156
@@ -169,42 +162,46 @@ static int command_from_LL(isdn_ctrl *cntrl)
169 } 162 }
170 *sp = cntrl->parm.setup; 163 *sp = cntrl->parm.setup;
171 164
172 if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, 165 spin_lock_irqsave(&cs->lock, flags);
173 atomic_read(&bcs->at_state.seq_index), 166 param = bcs->at_state.seq_index;
174 NULL)) { 167 spin_unlock_irqrestore(&cs->lock, flags);
168
169 if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, param,
170 NULL)) {
175 //FIXME what should we do? 171 //FIXME what should we do?
176 kfree(sp); 172 kfree(sp);
177 gigaset_free_channel(bcs); 173 gigaset_free_channel(bcs);
178 return -ENOMEM; 174 return -ENOMEM;
179 } 175 }
180 176
181 dbg(DEBUG_CMD, "scheduling DIAL"); 177 gig_dbg(DEBUG_CMD, "scheduling DIAL");
182 gigaset_schedule_event(cs); 178 gigaset_schedule_event(cs);
183 break; 179 break;
184 case ISDN_CMD_ACCEPTD: //FIXME 180 case ISDN_CMD_ACCEPTD: //FIXME
185 dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD"); 181 gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD");
186 182
187 if (cntrl->arg >= cs->channels) { 183 if (cntrl->arg >= cs->channels) {
188 err("invalid channel (%d)", (int) cntrl->arg); 184 err("ISDN_CMD_ACCEPTD: invalid channel (%d)",
185 (int) cntrl->arg);
189 return -EINVAL; 186 return -EINVAL;
190 } 187 }
191 188
192 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, 189 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state,
193 EV_ACCEPT, NULL, 0, NULL)) { 190 EV_ACCEPT, NULL, 0, NULL)) {
194 //FIXME what should we do? 191 //FIXME what should we do?
195 return -ENOMEM; 192 return -ENOMEM;
196 } 193 }
197 194
198 dbg(DEBUG_CMD, "scheduling ACCEPT"); 195 gig_dbg(DEBUG_CMD, "scheduling ACCEPT");
199 gigaset_schedule_event(cs); 196 gigaset_schedule_event(cs);
200 197
201 break; 198 break;
202 case ISDN_CMD_ACCEPTB: 199 case ISDN_CMD_ACCEPTB:
203 dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTB"); 200 gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTB");
204 break; 201 break;
205 case ISDN_CMD_HANGUP: 202 case ISDN_CMD_HANGUP:
206 dbg(DEBUG_ANY, 203 gig_dbg(DEBUG_ANY, "ISDN_CMD_HANGUP (ch: %d)",
207 "ISDN_CMD_HANGUP (channel: %d)", (int) cntrl->arg); 204 (int) cntrl->arg);
208 205
209 if (cntrl->arg >= cs->channels) { 206 if (cntrl->arg >= cs->channels) {
210 err("ISDN_CMD_HANGUP: invalid channel (%u)", 207 err("ISDN_CMD_HANGUP: invalid channel (%u)",
@@ -213,66 +210,68 @@ static int command_from_LL(isdn_ctrl *cntrl)
213 } 210 }
214 211
215 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, 212 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state,
216 EV_HUP, NULL, 0, NULL)) { 213 EV_HUP, NULL, 0, NULL)) {
217 //FIXME what should we do? 214 //FIXME what should we do?
218 return -ENOMEM; 215 return -ENOMEM;
219 } 216 }
220 217
221 dbg(DEBUG_CMD, "scheduling HUP"); 218 gig_dbg(DEBUG_CMD, "scheduling HUP");
222 gigaset_schedule_event(cs); 219 gigaset_schedule_event(cs);
223 220
224 break; 221 break;
225 case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME 222 case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME
226 dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ"); 223 gig_dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ");
227 break; 224 break;
228 case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME 225 case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME
229 dbg(DEBUG_ANY, 226 gig_dbg(DEBUG_ANY,
230 "ISDN_CMD_SETEAZ (id:%d, channel: %ld, number: %s)", 227 "ISDN_CMD_SETEAZ (id: %d, ch: %ld, number: %s)",
231 cntrl->driver, cntrl->arg, cntrl->parm.num); 228 cntrl->driver, cntrl->arg, cntrl->parm.num);
232 break; 229 break;
233 case ISDN_CMD_SETL2: /* Set L2 to given protocol */ 230 case ISDN_CMD_SETL2: /* Set L2 to given protocol */
234 dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (Channel: %ld, Proto: %lx)", 231 gig_dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (ch: %ld, proto: %lx)",
235 cntrl->arg & 0xff, (cntrl->arg >> 8)); 232 cntrl->arg & 0xff, (cntrl->arg >> 8));
236 233
237 if ((cntrl->arg & 0xff) >= cs->channels) { 234 if ((cntrl->arg & 0xff) >= cs->channels) {
238 err("invalid channel (%u)", 235 err("ISDN_CMD_SETL2: invalid channel (%u)",
239 (unsigned) cntrl->arg & 0xff); 236 (unsigned) cntrl->arg & 0xff);
240 return -EINVAL; 237 return -EINVAL;
241 } 238 }
242 239
243 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg & 0xff].at_state, 240 if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg & 0xff].at_state,
244 EV_PROTO_L2, NULL, cntrl->arg >> 8, 241 EV_PROTO_L2, NULL, cntrl->arg >> 8,
245 NULL)) { 242 NULL)) {
246 //FIXME what should we do? 243 //FIXME what should we do?
247 return -ENOMEM; 244 return -ENOMEM;
248 } 245 }
249 246
250 dbg(DEBUG_CMD, "scheduling PROTO_L2"); 247 gig_dbg(DEBUG_CMD, "scheduling PROTO_L2");
251 gigaset_schedule_event(cs); 248 gigaset_schedule_event(cs);
252 break; 249 break;
253 case ISDN_CMD_SETL3: /* Set L3 to given protocol */ 250 case ISDN_CMD_SETL3: /* Set L3 to given protocol */
254 dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (Channel: %ld, Proto: %lx)", 251 gig_dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (ch: %ld, proto: %lx)",
255 cntrl->arg & 0xff, (cntrl->arg >> 8)); 252 cntrl->arg & 0xff, (cntrl->arg >> 8));
256 253
257 if ((cntrl->arg & 0xff) >= cs->channels) { 254 if ((cntrl->arg & 0xff) >= cs->channels) {
258 err("invalid channel (%u)", 255 err("ISDN_CMD_SETL3: invalid channel (%u)",
259 (unsigned) cntrl->arg & 0xff); 256 (unsigned) cntrl->arg & 0xff);
260 return -EINVAL; 257 return -EINVAL;
261 } 258 }
262 259
263 if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) { 260 if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) {
264 err("invalid protocol %lu", cntrl->arg >> 8); 261 err("ISDN_CMD_SETL3: invalid protocol %lu",
262 cntrl->arg >> 8);
265 return -EINVAL; 263 return -EINVAL;
266 } 264 }
267 265
268 break; 266 break;
269 case ISDN_CMD_PROCEED: 267 case ISDN_CMD_PROCEED:
270 dbg(DEBUG_ANY, "ISDN_CMD_PROCEED"); //FIXME 268 gig_dbg(DEBUG_ANY, "ISDN_CMD_PROCEED"); //FIXME
271 break; 269 break;
272 case ISDN_CMD_ALERT: 270 case ISDN_CMD_ALERT:
273 dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME 271 gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME
274 if (cntrl->arg >= cs->channels) { 272 if (cntrl->arg >= cs->channels) {
275 err("invalid channel (%d)", (int) cntrl->arg); 273 err("ISDN_CMD_ALERT: invalid channel (%d)",
274 (int) cntrl->arg);
276 return -EINVAL; 275 return -EINVAL;
277 } 276 }
278 //bcs = cs->bcs + cntrl->arg; 277 //bcs = cs->bcs + cntrl->arg;
@@ -280,32 +279,31 @@ static int command_from_LL(isdn_ctrl *cntrl)
280 // FIXME 279 // FIXME
281 break; 280 break;
282 case ISDN_CMD_REDIR: 281 case ISDN_CMD_REDIR:
283 dbg(DEBUG_ANY, "ISDN_CMD_REDIR"); //FIXME 282 gig_dbg(DEBUG_ANY, "ISDN_CMD_REDIR"); //FIXME
284 break; 283 break;
285 case ISDN_CMD_PROT_IO: 284 case ISDN_CMD_PROT_IO:
286 dbg(DEBUG_ANY, "ISDN_CMD_PROT_IO"); 285 gig_dbg(DEBUG_ANY, "ISDN_CMD_PROT_IO");
287 break; 286 break;
288 case ISDN_CMD_FAXCMD: 287 case ISDN_CMD_FAXCMD:
289 dbg(DEBUG_ANY, "ISDN_CMD_FAXCMD"); 288 gig_dbg(DEBUG_ANY, "ISDN_CMD_FAXCMD");
290 break; 289 break;
291 case ISDN_CMD_GETL2: 290 case ISDN_CMD_GETL2:
292 dbg(DEBUG_ANY, "ISDN_CMD_GETL2"); 291 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETL2");
293 break; 292 break;
294 case ISDN_CMD_GETL3: 293 case ISDN_CMD_GETL3:
295 dbg(DEBUG_ANY, "ISDN_CMD_GETL3"); 294 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETL3");
296 break; 295 break;
297 case ISDN_CMD_GETEAZ: 296 case ISDN_CMD_GETEAZ:
298 dbg(DEBUG_ANY, "ISDN_CMD_GETEAZ"); 297 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETEAZ");
299 break; 298 break;
300 case ISDN_CMD_SETSIL: 299 case ISDN_CMD_SETSIL:
301 dbg(DEBUG_ANY, "ISDN_CMD_SETSIL"); 300 gig_dbg(DEBUG_ANY, "ISDN_CMD_SETSIL");
302 break; 301 break;
303 case ISDN_CMD_GETSIL: 302 case ISDN_CMD_GETSIL:
304 dbg(DEBUG_ANY, "ISDN_CMD_GETSIL"); 303 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL");
305 break; 304 break;
306 default: 305 default:
307 err("unknown command %d from LL", 306 err("unknown command %d from LL", cntrl->command);
308 cntrl->command);
309 return -EINVAL; 307 return -EINVAL;
310 } 308 }
311 309
@@ -350,7 +348,8 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data)
350 proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ 348 proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */
351 break; 349 break;
352 default: 350 default:
353 err("invalid protocol: %u", bcs->proto2); 351 dev_err(bcs->cs->dev, "%s: invalid L2 protocol: %u\n",
352 __func__, bcs->proto2);
354 return -EINVAL; 353 return -EINVAL;
355 } 354 }
356 355
@@ -378,7 +377,7 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data)
378 bcs->commands[i] = NULL; 377 bcs->commands[i] = NULL;
379 if (length[i] && 378 if (length[i] &&
380 !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { 379 !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) {
381 err("out of memory"); 380 dev_err(bcs->cs->dev, "out of memory\n");
382 return -ENOMEM; 381 return -ENOMEM;
383 } 382 }
384 } 383 }
@@ -396,10 +395,14 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data)
396 } 395 }
397 396
398 if (bcs->commands[AT_MSN]) 397 if (bcs->commands[AT_MSN])
399 snprintf(bcs->commands[AT_MSN], length[AT_MSN], "^SMSN=%s\r", sp->eazmsn); 398 snprintf(bcs->commands[AT_MSN], length[AT_MSN],
400 snprintf(bcs->commands[AT_BC ], length[AT_BC ], "^SBC=%s\r", bc); 399 "^SMSN=%s\r", sp->eazmsn);
401 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); 400 snprintf(bcs->commands[AT_BC ], length[AT_BC ],
402 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned)bcs->channel + 1); 401 "^SBC=%s\r", bc);
402 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO],
403 "^SBPR=%u\r", proto);
404 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ],
405 "^SISO=%u\r", (unsigned)bcs->channel + 1);
403 406
404 return 0; 407 return 0;
405} 408}
@@ -419,7 +422,8 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state)
419 proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ 422 proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */
420 break; 423 break;
421 default: 424 default:
422 err("invalid protocol: %u", bcs->proto2); 425 dev_err(at_state->cs->dev, "%s: invalid protocol: %u\n",
426 __func__, bcs->proto2);
423 return -EINVAL; 427 return -EINVAL;
424 } 428 }
425 429
@@ -436,13 +440,15 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state)
436 bcs->commands[i] = NULL; 440 bcs->commands[i] = NULL;
437 if (length[i] && 441 if (length[i] &&
438 !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { 442 !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) {
439 err("out of memory"); 443 dev_err(at_state->cs->dev, "out of memory\n");
440 return -ENOMEM; 444 return -ENOMEM;
441 } 445 }
442 } 446 }
443 447
444 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); 448 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO],
445 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned) bcs->channel + 1); 449 "^SBPR=%u\r", proto);
450 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ],
451 "^SISO=%u\r", (unsigned) bcs->channel + 1);
446 452
447 return 0; 453 return 0;
448} 454}
@@ -473,7 +479,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
473 response.parm.setup.si1 = 1; 479 response.parm.setup.si1 = 1;
474 response.parm.setup.si2 = 2; 480 response.parm.setup.si2 = 2;
475 } else { 481 } else {
476 warn("RING ignored - unsupported BC %s", 482 dev_warn(cs->dev, "RING ignored - unsupported BC %s\n",
477 at_state->str_var[STR_ZBC]); 483 at_state->str_var[STR_ZBC]);
478 return ICALL_IGNORE; 484 return ICALL_IGNORE;
479 } 485 }
@@ -491,18 +497,17 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
491 response.parm.setup.eazmsn[0] = 0; 497 response.parm.setup.eazmsn[0] = 0;
492 498
493 if (!bcs) { 499 if (!bcs) {
494 notice("no channel for incoming call"); 500 dev_notice(cs->dev, "no channel for incoming call\n");
495 dbg(DEBUG_CMD, "Sending ICALLW");
496 response.command = ISDN_STAT_ICALLW; 501 response.command = ISDN_STAT_ICALLW;
497 response.arg = 0; //FIXME 502 response.arg = 0; //FIXME
498 } else { 503 } else {
499 dbg(DEBUG_CMD, "Sending ICALL"); 504 gig_dbg(DEBUG_CMD, "Sending ICALL");
500 response.command = ISDN_STAT_ICALL; 505 response.command = ISDN_STAT_ICALL;
501 response.arg = bcs->channel; //FIXME 506 response.arg = bcs->channel; //FIXME
502 } 507 }
503 response.driver = cs->myid; 508 response.driver = cs->myid;
504 retval = cs->iif.statcallb(&response); 509 retval = cs->iif.statcallb(&response);
505 dbg(DEBUG_CMD, "Response: %d", retval); 510 gig_dbg(DEBUG_CMD, "Response: %d", retval);
506 switch (retval) { 511 switch (retval) {
507 case 0: /* no takers */ 512 case 0: /* no takers */
508 return ICALL_IGNORE; 513 return ICALL_IGNORE;
@@ -512,7 +517,8 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
512 case 2: /* reject */ 517 case 2: /* reject */
513 return ICALL_REJECT; 518 return ICALL_REJECT;
514 case 3: /* incomplete */ 519 case 3: /* incomplete */
515 warn("LL requested unsupported feature: Incomplete Number"); 520 dev_warn(cs->dev,
521 "LL requested unsupported feature: Incomplete Number\n");
516 return ICALL_IGNORE; 522 return ICALL_IGNORE;
517 case 4: /* proceeding */ 523 case 4: /* proceeding */
518 /* Gigaset will send ALERTING anyway. 524 /* Gigaset will send ALERTING anyway.
@@ -520,10 +526,11 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
520 */ 526 */
521 return ICALL_ACCEPT; 527 return ICALL_ACCEPT;
522 case 5: /* deflect */ 528 case 5: /* deflect */
523 warn("LL requested unsupported feature: Call Deflection"); 529 dev_warn(cs->dev,
530 "LL requested unsupported feature: Call Deflection\n");
524 return ICALL_IGNORE; 531 return ICALL_IGNORE;
525 default: 532 default:
526 err("LL error %d on ICALL", retval); 533 dev_err(cs->dev, "LL error %d on ICALL\n", retval);
527 return ICALL_IGNORE; 534 return ICALL_IGNORE;
528 } 535 }
529} 536}
@@ -533,7 +540,7 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid)
533{ 540{
534 isdn_if *iif = &cs->iif; 541 isdn_if *iif = &cs->iif;
535 542
536 dbg(DEBUG_ANY, "Register driver capabilities to LL"); 543 gig_dbg(DEBUG_ANY, "Register driver capabilities to LL");
537 544
538 //iif->id[sizeof(iif->id) - 1]=0; 545 //iif->id[sizeof(iif->id) - 1]=0;
539 //strncpy(iif->id, isdnid, sizeof(iif->id) - 1); 546 //strncpy(iif->id, isdnid, sizeof(iif->id) - 1);
@@ -542,26 +549,26 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid)
542 return -ENOMEM; //FIXME EINVAL/...?? 549 return -ENOMEM; //FIXME EINVAL/...??
543 550
544 iif->owner = THIS_MODULE; 551 iif->owner = THIS_MODULE;
545 iif->channels = cs->channels; /* I am supporting just one channel *//* I was supporting...*/ 552 iif->channels = cs->channels;
546 iif->maxbufsize = MAX_BUF_SIZE; 553 iif->maxbufsize = MAX_BUF_SIZE;
547 iif->features = ISDN_FEATURE_L2_TRANS | /* Our device is very advanced, therefore */ 554 iif->features = ISDN_FEATURE_L2_TRANS |
548 ISDN_FEATURE_L2_HDLC | 555 ISDN_FEATURE_L2_HDLC |
549#ifdef GIG_X75 556#ifdef GIG_X75
550 ISDN_FEATURE_L2_X75I | 557 ISDN_FEATURE_L2_X75I |
551#endif 558#endif
552 ISDN_FEATURE_L3_TRANS | 559 ISDN_FEATURE_L3_TRANS |
553 ISDN_FEATURE_P_EURO; 560 ISDN_FEATURE_P_EURO;
554 iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */ 561 iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */
555 iif->command = command_from_LL; 562 iif->command = command_from_LL;
556 iif->writebuf_skb = writebuf_from_LL; 563 iif->writebuf_skb = writebuf_from_LL;
557 iif->writecmd = NULL; /* Don't support isdnctrl */ 564 iif->writecmd = NULL; /* Don't support isdnctrl */
558 iif->readstat = NULL; /* Don't support isdnctrl */ 565 iif->readstat = NULL; /* Don't support isdnctrl */
559 iif->rcvcallb_skb = NULL; /* Will be set by LL */ 566 iif->rcvcallb_skb = NULL; /* Will be set by LL */
560 iif->statcallb = NULL; /* Will be set by LL */ 567 iif->statcallb = NULL; /* Will be set by LL */
561 568
562 if (!register_isdn(iif)) 569 if (!register_isdn(iif))
563 return 0; 570 return 0;
564 571
565 cs->myid = iif->channels; /* Set my device id */ 572 cs->myid = iif->channels; /* Set my device id */
566 return 1; 573 return 1;
567} 574}
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 3a81d9c65141..08e4c4eea14d 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -9,8 +9,6 @@
9 * published by the Free Software Foundation; either version 2 of 9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * Version: $Id: interface.c,v 1.14.4.15 2006/02/04 18:28:16 hjlipp Exp $
13 * =====================================================================
14 */ 12 */
15 13
16#include "gigaset.h" 14#include "gigaset.h"
@@ -24,7 +22,7 @@ static int if_lock(struct cardstate *cs, int *arg)
24{ 22{
25 int cmd = *arg; 23 int cmd = *arg;
26 24
27 dbg(DEBUG_IF, "%u: if_lock (%d)", cs->minor_index, cmd); 25 gig_dbg(DEBUG_IF, "%u: if_lock (%d)", cs->minor_index, cmd);
28 26
29 if (cmd > 1) 27 if (cmd > 1)
30 return -EINVAL; 28 return -EINVAL;
@@ -35,7 +33,7 @@ static int if_lock(struct cardstate *cs, int *arg)
35 } 33 }
36 34
37 if (!cmd && atomic_read(&cs->mstate) == MS_LOCKED 35 if (!cmd && atomic_read(&cs->mstate) == MS_LOCKED
38 && atomic_read(&cs->connected)) { 36 && cs->connected) {
39 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS); 37 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
40 cs->ops->baud_rate(cs, B115200); 38 cs->ops->baud_rate(cs, B115200);
41 cs->ops->set_line_ctrl(cs, CS8); 39 cs->ops->set_line_ctrl(cs, CS8);
@@ -44,12 +42,12 @@ static int if_lock(struct cardstate *cs, int *arg)
44 42
45 cs->waiting = 1; 43 cs->waiting = 1;
46 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_LOCK, 44 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_LOCK,
47 NULL, cmd, NULL)) { 45 NULL, cmd, NULL)) {
48 cs->waiting = 0; 46 cs->waiting = 0;
49 return -ENOMEM; 47 return -ENOMEM;
50 } 48 }
51 49
52 dbg(DEBUG_CMD, "scheduling IF_LOCK"); 50 gig_dbg(DEBUG_CMD, "scheduling IF_LOCK");
53 gigaset_schedule_event(cs); 51 gigaset_schedule_event(cs);
54 52
55 wait_event(cs->waitqueue, !cs->waiting); 53 wait_event(cs->waitqueue, !cs->waiting);
@@ -68,7 +66,7 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
68 static const unsigned compat[4] = GIG_COMPAT; 66 static const unsigned compat[4] = GIG_COMPAT;
69 unsigned cmd = arg[0]; 67 unsigned cmd = arg[0];
70 68
71 dbg(DEBUG_IF, "%u: if_version (%d)", cs->minor_index, cmd); 69 gig_dbg(DEBUG_IF, "%u: if_version (%d)", cs->minor_index, cmd);
72 70
73 switch (cmd) { 71 switch (cmd) {
74 case GIGVER_DRIVER: 72 case GIGVER_DRIVER:
@@ -80,12 +78,12 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
80 case GIGVER_FWBASE: 78 case GIGVER_FWBASE:
81 cs->waiting = 1; 79 cs->waiting = 1;
82 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_VER, 80 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_VER,
83 NULL, 0, arg)) { 81 NULL, 0, arg)) {
84 cs->waiting = 0; 82 cs->waiting = 0;
85 return -ENOMEM; 83 return -ENOMEM;
86 } 84 }
87 85
88 dbg(DEBUG_CMD, "scheduling IF_VER"); 86 gig_dbg(DEBUG_CMD, "scheduling IF_VER");
89 gigaset_schedule_event(cs); 87 gigaset_schedule_event(cs);
90 88
91 wait_event(cs->waitqueue, !cs->waiting); 89 wait_event(cs->waitqueue, !cs->waiting);
@@ -101,7 +99,7 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
101 99
102static int if_config(struct cardstate *cs, int *arg) 100static int if_config(struct cardstate *cs, int *arg)
103{ 101{
104 dbg(DEBUG_IF, "%u: if_config (%d)", cs->minor_index, *arg); 102 gig_dbg(DEBUG_IF, "%u: if_config (%d)", cs->minor_index, *arg);
105 103
106 if (*arg != 1) 104 if (*arg != 1)
107 return -EINVAL; 105 return -EINVAL;
@@ -109,6 +107,11 @@ static int if_config(struct cardstate *cs, int *arg)
109 if (atomic_read(&cs->mstate) != MS_LOCKED) 107 if (atomic_read(&cs->mstate) != MS_LOCKED)
110 return -EBUSY; 108 return -EBUSY;
111 109
110 if (!cs->connected) {
111 err("not connected!");
112 return -ENODEV;
113 }
114
112 *arg = 0; 115 *arg = 0;
113 return gigaset_enterconfigmode(cs); 116 return gigaset_enterconfigmode(cs);
114} 117}
@@ -119,7 +122,7 @@ static int if_config(struct cardstate *cs, int *arg)
119static int if_open(struct tty_struct *tty, struct file *filp); 122static int if_open(struct tty_struct *tty, struct file *filp);
120static void if_close(struct tty_struct *tty, struct file *filp); 123static void if_close(struct tty_struct *tty, struct file *filp);
121static int if_ioctl(struct tty_struct *tty, struct file *file, 124static int if_ioctl(struct tty_struct *tty, struct file *file,
122 unsigned int cmd, unsigned long arg); 125 unsigned int cmd, unsigned long arg);
123static int if_write_room(struct tty_struct *tty); 126static int if_write_room(struct tty_struct *tty);
124static int if_chars_in_buffer(struct tty_struct *tty); 127static int if_chars_in_buffer(struct tty_struct *tty);
125static void if_throttle(struct tty_struct *tty); 128static void if_throttle(struct tty_struct *tty);
@@ -127,9 +130,9 @@ static void if_unthrottle(struct tty_struct *tty);
127static void if_set_termios(struct tty_struct *tty, struct termios *old); 130static void if_set_termios(struct tty_struct *tty, struct termios *old);
128static int if_tiocmget(struct tty_struct *tty, struct file *file); 131static int if_tiocmget(struct tty_struct *tty, struct file *file);
129static int if_tiocmset(struct tty_struct *tty, struct file *file, 132static int if_tiocmset(struct tty_struct *tty, struct file *file,
130 unsigned int set, unsigned int clear); 133 unsigned int set, unsigned int clear);
131static int if_write(struct tty_struct *tty, 134static int if_write(struct tty_struct *tty,
132 const unsigned char *buf, int count); 135 const unsigned char *buf, int count);
133 136
134static struct tty_operations if_ops = { 137static struct tty_operations if_ops = {
135 .open = if_open, 138 .open = if_open,
@@ -153,8 +156,8 @@ static int if_open(struct tty_struct *tty, struct file *filp)
153 struct cardstate *cs; 156 struct cardstate *cs;
154 unsigned long flags; 157 unsigned long flags;
155 158
156 dbg(DEBUG_IF, "%d+%d: %s()", tty->driver->minor_start, tty->index, 159 gig_dbg(DEBUG_IF, "%d+%d: %s()",
157 __FUNCTION__); 160 tty->driver->minor_start, tty->index, __func__);
158 161
159 tty->driver_data = NULL; 162 tty->driver_data = NULL;
160 163
@@ -162,7 +165,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
162 if (!cs) 165 if (!cs)
163 return -ENODEV; 166 return -ENODEV;
164 167
165 if (down_interruptible(&cs->sem)) 168 if (mutex_lock_interruptible(&cs->mutex))
166 return -ERESTARTSYS; // FIXME -EINTR? 169 return -ERESTARTSYS; // FIXME -EINTR?
167 tty->driver_data = cs; 170 tty->driver_data = cs;
168 171
@@ -173,10 +176,9 @@ static int if_open(struct tty_struct *tty, struct file *filp)
173 cs->tty = tty; 176 cs->tty = tty;
174 spin_unlock_irqrestore(&cs->lock, flags); 177 spin_unlock_irqrestore(&cs->lock, flags);
175 tty->low_latency = 1; //FIXME test 178 tty->low_latency = 1; //FIXME test
176 //FIXME
177 } 179 }
178 180
179 up(&cs->sem); 181 mutex_unlock(&cs->mutex);
180 return 0; 182 return 0;
181} 183}
182 184
@@ -187,30 +189,29 @@ static void if_close(struct tty_struct *tty, struct file *filp)
187 189
188 cs = (struct cardstate *) tty->driver_data; 190 cs = (struct cardstate *) tty->driver_data;
189 if (!cs) { 191 if (!cs) {
190 err("cs==NULL in %s", __FUNCTION__); 192 err("cs==NULL in %s", __func__);
191 return; 193 return;
192 } 194 }
193 195
194 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 196 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
195 197
196 down(&cs->sem); 198 mutex_lock(&cs->mutex);
197 199
198 if (!cs->open_count) 200 if (!cs->open_count)
199 warn("%s: device not opened", __FUNCTION__); 201 warn("%s: device not opened", __func__);
200 else { 202 else {
201 if (!--cs->open_count) { 203 if (!--cs->open_count) {
202 spin_lock_irqsave(&cs->lock, flags); 204 spin_lock_irqsave(&cs->lock, flags);
203 cs->tty = NULL; 205 cs->tty = NULL;
204 spin_unlock_irqrestore(&cs->lock, flags); 206 spin_unlock_irqrestore(&cs->lock, flags);
205 //FIXME
206 } 207 }
207 } 208 }
208 209
209 up(&cs->sem); 210 mutex_unlock(&cs->mutex);
210} 211}
211 212
212static int if_ioctl(struct tty_struct *tty, struct file *file, 213static int if_ioctl(struct tty_struct *tty, struct file *file,
213 unsigned int cmd, unsigned long arg) 214 unsigned int cmd, unsigned long arg)
214{ 215{
215 struct cardstate *cs; 216 struct cardstate *cs;
216 int retval = -ENODEV; 217 int retval = -ENODEV;
@@ -220,17 +221,17 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
220 221
221 cs = (struct cardstate *) tty->driver_data; 222 cs = (struct cardstate *) tty->driver_data;
222 if (!cs) { 223 if (!cs) {
223 err("cs==NULL in %s", __FUNCTION__); 224 err("cs==NULL in %s", __func__);
224 return -ENODEV; 225 return -ENODEV;
225 } 226 }
226 227
227 dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __FUNCTION__, cmd); 228 gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd);
228 229
229 if (down_interruptible(&cs->sem)) 230 if (mutex_lock_interruptible(&cs->mutex))
230 return -ERESTARTSYS; // FIXME -EINTR? 231 return -ERESTARTSYS; // FIXME -EINTR?
231 232
232 if (!cs->open_count) 233 if (!cs->open_count)
233 warn("%s: device not opened", __FUNCTION__); 234 warn("%s: device not opened", __func__);
234 else { 235 else {
235 retval = 0; 236 retval = 0;
236 switch (cmd) { 237 switch (cmd) {
@@ -250,37 +251,40 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
250 break; 251 break;
251 case GIGASET_BRKCHARS: 252 case GIGASET_BRKCHARS:
252 //FIXME test if MS_LOCKED 253 //FIXME test if MS_LOCKED
253 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS", 254 if (!cs->connected) {
254 6, (const unsigned char *) arg, 1); 255 gig_dbg(DEBUG_ANY,
255 if (!atomic_read(&cs->connected)) { 256 "can't communicate with unplugged device");
256 dbg(DEBUG_ANY, "can't communicate with unplugged device");
257 retval = -ENODEV; 257 retval = -ENODEV;
258 break; 258 break;
259 } 259 }
260 retval = copy_from_user(&buf, 260 retval = copy_from_user(&buf,
261 (const unsigned char __user *) arg, 6) 261 (const unsigned char __user *) arg, 6)
262 ? -EFAULT : 0; 262 ? -EFAULT : 0;
263 if (retval >= 0) 263 if (retval >= 0) {
264 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
265 6, (const unsigned char *) arg);
264 retval = cs->ops->brkchars(cs, buf); 266 retval = cs->ops->brkchars(cs, buf);
267 }
265 break; 268 break;
266 case GIGASET_VERSION: 269 case GIGASET_VERSION:
267 retval = copy_from_user(version, (unsigned __user *) arg, 270 retval = copy_from_user(version,
268 sizeof version) ? -EFAULT : 0; 271 (unsigned __user *) arg, sizeof version)
272 ? -EFAULT : 0;
269 if (retval >= 0) 273 if (retval >= 0)
270 retval = if_version(cs, version); 274 retval = if_version(cs, version);
271 if (retval >= 0) 275 if (retval >= 0)
272 retval = copy_to_user((unsigned __user *) arg, version, 276 retval = copy_to_user((unsigned __user *) arg,
273 sizeof version) 277 version, sizeof version)
274 ? -EFAULT : 0; 278 ? -EFAULT : 0;
275 break; 279 break;
276 default: 280 default:
277 dbg(DEBUG_ANY, "%s: arg not supported - 0x%04x", 281 gig_dbg(DEBUG_ANY, "%s: arg not supported - 0x%04x",
278 __FUNCTION__, cmd); 282 __func__, cmd);
279 retval = -ENOIOCTLCMD; 283 retval = -ENOIOCTLCMD;
280 } 284 }
281 } 285 }
282 286
283 up(&cs->sem); 287 mutex_unlock(&cs->mutex);
284 288
285 return retval; 289 return retval;
286} 290}
@@ -292,25 +296,25 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)
292 296
293 cs = (struct cardstate *) tty->driver_data; 297 cs = (struct cardstate *) tty->driver_data;
294 if (!cs) { 298 if (!cs) {
295 err("cs==NULL in %s", __FUNCTION__); 299 err("cs==NULL in %s", __func__);
296 return -ENODEV; 300 return -ENODEV;
297 } 301 }
298 302
299 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 303 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
300 304
301 if (down_interruptible(&cs->sem)) 305 if (mutex_lock_interruptible(&cs->mutex))
302 return -ERESTARTSYS; // FIXME -EINTR? 306 return -ERESTARTSYS; // FIXME -EINTR?
303 307
304 // FIXME read from device? 308 // FIXME read from device?
305 retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR); 309 retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR);
306 310
307 up(&cs->sem); 311 mutex_unlock(&cs->mutex);
308 312
309 return retval; 313 return retval;
310} 314}
311 315
312static int if_tiocmset(struct tty_struct *tty, struct file *file, 316static int if_tiocmset(struct tty_struct *tty, struct file *file,
313 unsigned int set, unsigned int clear) 317 unsigned int set, unsigned int clear)
314{ 318{
315 struct cardstate *cs; 319 struct cardstate *cs;
316 int retval; 320 int retval;
@@ -318,18 +322,18 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
318 322
319 cs = (struct cardstate *) tty->driver_data; 323 cs = (struct cardstate *) tty->driver_data;
320 if (!cs) { 324 if (!cs) {
321 err("cs==NULL in %s", __FUNCTION__); 325 err("cs==NULL in %s", __func__);
322 return -ENODEV; 326 return -ENODEV;
323 } 327 }
324 328
325 dbg(DEBUG_IF, 329 gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)",
326 "%u: %s(0x%x, 0x%x)", cs->minor_index, __FUNCTION__, set, clear); 330 cs->minor_index, __func__, set, clear);
327 331
328 if (down_interruptible(&cs->sem)) 332 if (mutex_lock_interruptible(&cs->mutex))
329 return -ERESTARTSYS; // FIXME -EINTR? 333 return -ERESTARTSYS; // FIXME -EINTR?
330 334
331 if (!atomic_read(&cs->connected)) { 335 if (!cs->connected) {
332 dbg(DEBUG_ANY, "can't communicate with unplugged device"); 336 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
333 retval = -ENODEV; 337 retval = -ENODEV;
334 } else { 338 } else {
335 mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR); 339 mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR);
@@ -337,7 +341,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
337 cs->control_state = mc; 341 cs->control_state = mc;
338 } 342 }
339 343
340 up(&cs->sem); 344 mutex_unlock(&cs->mutex);
341 345
342 return retval; 346 return retval;
343} 347}
@@ -349,29 +353,29 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
349 353
350 cs = (struct cardstate *) tty->driver_data; 354 cs = (struct cardstate *) tty->driver_data;
351 if (!cs) { 355 if (!cs) {
352 err("cs==NULL in %s", __FUNCTION__); 356 err("cs==NULL in %s", __func__);
353 return -ENODEV; 357 return -ENODEV;
354 } 358 }
355 359
356 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 360 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
357 361
358 if (down_interruptible(&cs->sem)) 362 if (mutex_lock_interruptible(&cs->mutex))
359 return -ERESTARTSYS; // FIXME -EINTR? 363 return -ERESTARTSYS; // FIXME -EINTR?
360 364
361 if (!cs->open_count) 365 if (!cs->open_count)
362 warn("%s: device not opened", __FUNCTION__); 366 warn("%s: device not opened", __func__);
363 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 367 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
364 warn("can't write to unlocked device"); 368 warn("can't write to unlocked device");
365 retval = -EBUSY; 369 retval = -EBUSY;
366 } else if (!atomic_read(&cs->connected)) { 370 } else if (!cs->connected) {
367 dbg(DEBUG_ANY, "can't write to unplugged device"); 371 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
368 retval = -EBUSY; //FIXME 372 retval = -EBUSY; //FIXME
369 } else { 373 } else {
370 retval = cs->ops->write_cmd(cs, buf, count, 374 retval = cs->ops->write_cmd(cs, buf, count,
371 &cs->if_wake_tasklet); 375 &cs->if_wake_tasklet);
372 } 376 }
373 377
374 up(&cs->sem); 378 mutex_unlock(&cs->mutex);
375 379
376 return retval; 380 return retval;
377} 381}
@@ -383,27 +387,27 @@ static int if_write_room(struct tty_struct *tty)
383 387
384 cs = (struct cardstate *) tty->driver_data; 388 cs = (struct cardstate *) tty->driver_data;
385 if (!cs) { 389 if (!cs) {
386 err("cs==NULL in %s", __FUNCTION__); 390 err("cs==NULL in %s", __func__);
387 return -ENODEV; 391 return -ENODEV;
388 } 392 }
389 393
390 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 394 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
391 395
392 if (down_interruptible(&cs->sem)) 396 if (mutex_lock_interruptible(&cs->mutex))
393 return -ERESTARTSYS; // FIXME -EINTR? 397 return -ERESTARTSYS; // FIXME -EINTR?
394 398
395 if (!cs->open_count) 399 if (!cs->open_count)
396 warn("%s: device not opened", __FUNCTION__); 400 warn("%s: device not opened", __func__);
397 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 401 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
398 warn("can't write to unlocked device"); 402 warn("can't write to unlocked device");
399 retval = -EBUSY; //FIXME 403 retval = -EBUSY; //FIXME
400 } else if (!atomic_read(&cs->connected)) { 404 } else if (!cs->connected) {
401 dbg(DEBUG_ANY, "can't write to unplugged device"); 405 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
402 retval = -EBUSY; //FIXME 406 retval = -EBUSY; //FIXME
403 } else 407 } else
404 retval = cs->ops->write_room(cs); 408 retval = cs->ops->write_room(cs);
405 409
406 up(&cs->sem); 410 mutex_unlock(&cs->mutex);
407 411
408 return retval; 412 return retval;
409} 413}
@@ -415,27 +419,27 @@ static int if_chars_in_buffer(struct tty_struct *tty)
415 419
416 cs = (struct cardstate *) tty->driver_data; 420 cs = (struct cardstate *) tty->driver_data;
417 if (!cs) { 421 if (!cs) {
418 err("cs==NULL in %s", __FUNCTION__); 422 err("cs==NULL in %s", __func__);
419 return -ENODEV; 423 return -ENODEV;
420 } 424 }
421 425
422 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 426 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
423 427
424 if (down_interruptible(&cs->sem)) 428 if (mutex_lock_interruptible(&cs->mutex))
425 return -ERESTARTSYS; // FIXME -EINTR? 429 return -ERESTARTSYS; // FIXME -EINTR?
426 430
427 if (!cs->open_count) 431 if (!cs->open_count)
428 warn("%s: device not opened", __FUNCTION__); 432 warn("%s: device not opened", __func__);
429 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 433 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
430 warn("can't write to unlocked device"); 434 warn("can't write to unlocked device");
431 retval = -EBUSY; 435 retval = -EBUSY;
432 } else if (!atomic_read(&cs->connected)) { 436 } else if (!cs->connected) {
433 dbg(DEBUG_ANY, "can't write to unplugged device"); 437 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
434 retval = -EBUSY; //FIXME 438 retval = -EBUSY; //FIXME
435 } else 439 } else
436 retval = cs->ops->chars_in_buffer(cs); 440 retval = cs->ops->chars_in_buffer(cs);
437 441
438 up(&cs->sem); 442 mutex_unlock(&cs->mutex);
439 443
440 return retval; 444 return retval;
441} 445}
@@ -446,21 +450,21 @@ static void if_throttle(struct tty_struct *tty)
446 450
447 cs = (struct cardstate *) tty->driver_data; 451 cs = (struct cardstate *) tty->driver_data;
448 if (!cs) { 452 if (!cs) {
449 err("cs==NULL in %s", __FUNCTION__); 453 err("cs==NULL in %s", __func__);
450 return; 454 return;
451 } 455 }
452 456
453 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 457 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
454 458
455 down(&cs->sem); 459 mutex_lock(&cs->mutex);
456 460
457 if (!cs->open_count) 461 if (!cs->open_count)
458 warn("%s: device not opened", __FUNCTION__); 462 warn("%s: device not opened", __func__);
459 else { 463 else {
460 //FIXME 464 //FIXME
461 } 465 }
462 466
463 up(&cs->sem); 467 mutex_unlock(&cs->mutex);
464} 468}
465 469
466static void if_unthrottle(struct tty_struct *tty) 470static void if_unthrottle(struct tty_struct *tty)
@@ -469,21 +473,21 @@ static void if_unthrottle(struct tty_struct *tty)
469 473
470 cs = (struct cardstate *) tty->driver_data; 474 cs = (struct cardstate *) tty->driver_data;
471 if (!cs) { 475 if (!cs) {
472 err("cs==NULL in %s", __FUNCTION__); 476 err("cs==NULL in %s", __func__);
473 return; 477 return;
474 } 478 }
475 479
476 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 480 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
477 481
478 down(&cs->sem); 482 mutex_lock(&cs->mutex);
479 483
480 if (!cs->open_count) 484 if (!cs->open_count)
481 warn("%s: device not opened", __FUNCTION__); 485 warn("%s: device not opened", __func__);
482 else { 486 else {
483 //FIXME 487 //FIXME
484 } 488 }
485 489
486 up(&cs->sem); 490 mutex_unlock(&cs->mutex);
487} 491}
488 492
489static void if_set_termios(struct tty_struct *tty, struct termios *old) 493static void if_set_termios(struct tty_struct *tty, struct termios *old)
@@ -496,21 +500,21 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
496 500
497 cs = (struct cardstate *) tty->driver_data; 501 cs = (struct cardstate *) tty->driver_data;
498 if (!cs) { 502 if (!cs) {
499 err("cs==NULL in %s", __FUNCTION__); 503 err("cs==NULL in %s", __func__);
500 return; 504 return;
501 } 505 }
502 506
503 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 507 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
504 508
505 down(&cs->sem); 509 mutex_lock(&cs->mutex);
506 510
507 if (!cs->open_count) { 511 if (!cs->open_count) {
508 warn("%s: device not opened", __FUNCTION__); 512 warn("%s: device not opened", __func__);
509 goto out; 513 goto out;
510 } 514 }
511 515
512 if (!atomic_read(&cs->connected)) { 516 if (!cs->connected) {
513 dbg(DEBUG_ANY, "can't communicate with unplugged device"); 517 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
514 goto out; 518 goto out;
515 } 519 }
516 520
@@ -518,8 +522,8 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
518 iflag = tty->termios->c_iflag; 522 iflag = tty->termios->c_iflag;
519 cflag = tty->termios->c_cflag; 523 cflag = tty->termios->c_cflag;
520 old_cflag = old ? old->c_cflag : cflag; //FIXME? 524 old_cflag = old ? old->c_cflag : cflag; //FIXME?
521 dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x", cs->minor_index, 525 gig_dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x",
522 iflag, cflag, old_cflag); 526 cs->minor_index, iflag, cflag, old_cflag);
523 527
524 /* get a local copy of the current port settings */ 528 /* get a local copy of the current port settings */
525 control_state = cs->control_state; 529 control_state = cs->control_state;
@@ -531,14 +535,15 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
531 * Premature optimization is the root of all evil. 535 * Premature optimization is the root of all evil.
532 */ 536 */
533 537
534 /* reassert DTR and (maybe) RTS on transition from B0 */ 538 /* reassert DTR and (maybe) RTS on transition from B0 */
535 if ((old_cflag & CBAUD) == B0) { 539 if ((old_cflag & CBAUD) == B0) {
536 new_state = control_state | TIOCM_DTR; 540 new_state = control_state | TIOCM_DTR;
537 /* don't set RTS if using hardware flow control */ 541 /* don't set RTS if using hardware flow control */
538 if (!(old_cflag & CRTSCTS)) 542 if (!(old_cflag & CRTSCTS))
539 new_state |= TIOCM_RTS; 543 new_state |= TIOCM_RTS;
540 dbg(DEBUG_IF, "%u: from B0 - set DTR%s", cs->minor_index, 544 gig_dbg(DEBUG_IF, "%u: from B0 - set DTR%s",
541 (new_state & TIOCM_RTS) ? " only" : "/RTS"); 545 cs->minor_index,
546 (new_state & TIOCM_RTS) ? " only" : "/RTS");
542 cs->ops->set_modem_ctrl(cs, control_state, new_state); 547 cs->ops->set_modem_ctrl(cs, control_state, new_state);
543 control_state = new_state; 548 control_state = new_state;
544 } 549 }
@@ -547,7 +552,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
547 552
548 if ((cflag & CBAUD) == B0) { 553 if ((cflag & CBAUD) == B0) {
549 /* Drop RTS and DTR */ 554 /* Drop RTS and DTR */
550 dbg(DEBUG_IF, "%u: to B0 - drop DTR/RTS", cs->minor_index); 555 gig_dbg(DEBUG_IF, "%u: to B0 - drop DTR/RTS", cs->minor_index);
551 new_state = control_state & ~(TIOCM_DTR | TIOCM_RTS); 556 new_state = control_state & ~(TIOCM_DTR | TIOCM_RTS);
552 cs->ops->set_modem_ctrl(cs, control_state, new_state); 557 cs->ops->set_modem_ctrl(cs, control_state, new_state);
553 control_state = new_state; 558 control_state = new_state;
@@ -567,15 +572,17 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
567 * Just do what we have seen with SniffUSB on Win98. 572 * Just do what we have seen with SniffUSB on Win98.
568 */ 573 */
569 /* Drop DTR/RTS if no flow control otherwise assert */ 574 /* Drop DTR/RTS if no flow control otherwise assert */
570 dbg(DEBUG_IF, "%u: control_state %x", cs->minor_index, control_state); 575 gig_dbg(DEBUG_IF, "%u: control_state %x",
576 cs->minor_index, control_state);
571 new_state = control_state; 577 new_state = control_state;
572 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS)) 578 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS))
573 new_state |= TIOCM_DTR | TIOCM_RTS; 579 new_state |= TIOCM_DTR | TIOCM_RTS;
574 else 580 else
575 new_state &= ~(TIOCM_DTR | TIOCM_RTS); 581 new_state &= ~(TIOCM_DTR | TIOCM_RTS);
576 if (new_state != control_state) { 582 if (new_state != control_state) {
577 dbg(DEBUG_IF, "%u: new_state %x", cs->minor_index, new_state); 583 gig_dbg(DEBUG_IF, "%u: new_state %x",
578 gigaset_set_modem_ctrl(cs, control_state, new_state); // FIXME: mct_u232.c sets the old state here. is this a bug? 584 cs->minor_index, new_state);
585 gigaset_set_modem_ctrl(cs, control_state, new_state);
579 control_state = new_state; 586 control_state = new_state;
580 } 587 }
581#endif 588#endif
@@ -584,7 +591,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
584 cs->control_state = control_state; 591 cs->control_state = control_state;
585 592
586out: 593out:
587 up(&cs->sem); 594 mutex_unlock(&cs->mutex);
588} 595}
589 596
590 597
@@ -600,7 +607,7 @@ static void if_wake(unsigned long data)
600 607
601 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 608 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
602 tty->ldisc.write_wakeup) { 609 tty->ldisc.write_wakeup) {
603 dbg(DEBUG_IF, "write wakeup call"); 610 gig_dbg(DEBUG_IF, "write wakeup call");
604 tty->ldisc.write_wakeup(tty); 611 tty->ldisc.write_wakeup(tty);
605 } 612 }
606 613
@@ -635,14 +642,14 @@ void gigaset_if_free(struct cardstate *cs)
635} 642}
636 643
637void gigaset_if_receive(struct cardstate *cs, 644void gigaset_if_receive(struct cardstate *cs,
638 unsigned char *buffer, size_t len) 645 unsigned char *buffer, size_t len)
639{ 646{
640 unsigned long flags; 647 unsigned long flags;
641 struct tty_struct *tty; 648 struct tty_struct *tty;
642 649
643 spin_lock_irqsave(&cs->lock, flags); 650 spin_lock_irqsave(&cs->lock, flags);
644 if ((tty = cs->tty) == NULL) 651 if ((tty = cs->tty) == NULL)
645 dbg(DEBUG_ANY, "receive on closed device"); 652 gig_dbg(DEBUG_ANY, "receive on closed device");
646 else { 653 else {
647 tty_buffer_request_room(tty, len); 654 tty_buffer_request_room(tty, len);
648 tty_insert_flip_string(tty, buffer, len); 655 tty_insert_flip_string(tty, buffer, len);
@@ -655,13 +662,13 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive);
655/* gigaset_if_initdriver 662/* gigaset_if_initdriver
656 * Initialize tty interface. 663 * Initialize tty interface.
657 * parameters: 664 * parameters:
658 * drv Driver 665 * drv Driver
659 * procname Name of the driver (e.g. for /proc/tty/drivers) 666 * procname Name of the driver (e.g. for /proc/tty/drivers)
660 * devname Name of the device files (prefix without minor number) 667 * devname Name of the device files (prefix without minor number)
661 * devfsname Devfs name of the device files without %d 668 * devfsname Devfs name of the device files without %d
662 */ 669 */
663void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, 670void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
664 const char *devname, const char *devfsname) 671 const char *devname, const char *devfsname)
665{ 672{
666 unsigned minors = drv->minors; 673 unsigned minors = drv->minors;
667 int ret; 674 int ret;
@@ -696,7 +703,7 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
696 warn("failed to register tty driver (error %d)", ret); 703 warn("failed to register tty driver (error %d)", ret);
697 goto error; 704 goto error;
698 } 705 }
699 dbg(DEBUG_IF, "tty driver initialized"); 706 gig_dbg(DEBUG_IF, "tty driver initialized");
700 drv->have_tty = 1; 707 drv->have_tty = 1;
701 return; 708 return;
702 709
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 5744eb91b315..45f017ed6e8c 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -10,10 +10,6 @@
10 * published by the Free Software Foundation; either version 2 of 10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version. 11 * the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: ...
14 * =====================================================================
15 * Version: $Id: isocdata.c,v 1.2.2.5 2005/11/13 23:05:19 hjlipp Exp $
16 * =====================================================================
17 */ 13 */
18 14
19#include "gigaset.h" 15#include "gigaset.h"
@@ -87,14 +83,14 @@ static inline int isowbuf_startwrite(struct isowbuf_t *iwb)
87{ 83{
88 if (!atomic_dec_and_test(&iwb->writesem)) { 84 if (!atomic_dec_and_test(&iwb->writesem)) {
89 atomic_inc(&iwb->writesem); 85 atomic_inc(&iwb->writesem);
90 dbg(DEBUG_ISO, 86 gig_dbg(DEBUG_ISO, "%s: couldn't acquire iso write semaphore",
91 "%s: couldn't acquire iso write semaphore", __func__); 87 __func__);
92 return 0; 88 return 0;
93 } 89 }
94#ifdef CONFIG_GIGASET_DEBUG 90#ifdef CONFIG_GIGASET_DEBUG
95 dbg(DEBUG_ISO, 91 gig_dbg(DEBUG_ISO,
96 "%s: acquired iso write semaphore, data[write]=%02x, nbits=%d", 92 "%s: acquired iso write semaphore, data[write]=%02x, nbits=%d",
97 __func__, iwb->data[atomic_read(&iwb->write)], iwb->wbits); 93 __func__, iwb->data[atomic_read(&iwb->write)], iwb->wbits);
98#endif 94#endif
99 return 1; 95 return 1;
100} 96}
@@ -147,7 +143,7 @@ static inline void isowbuf_putflag(struct isowbuf_t *iwb)
147 /* recover the idle flag byte */ 143 /* recover the idle flag byte */
148 write = atomic_read(&iwb->write); 144 write = atomic_read(&iwb->write);
149 iwb->idle = iwb->data[write]; 145 iwb->idle = iwb->data[write];
150 dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle); 146 gig_dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle);
151 /* mask extraneous bits in buffer */ 147 /* mask extraneous bits in buffer */
152 iwb->data[write] &= (1 << iwb->wbits) - 1; 148 iwb->data[write] &= (1 << iwb->wbits) - 1;
153} 149}
@@ -166,15 +162,14 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
166 read = atomic_read(&iwb->nextread); 162 read = atomic_read(&iwb->nextread);
167 write = atomic_read(&iwb->write); 163 write = atomic_read(&iwb->write);
168 if (likely(read == write)) { 164 if (likely(read == write)) {
169 //dbg(DEBUG_STREAM, "%s: send buffer empty", __func__);
170 /* return idle frame */ 165 /* return idle frame */
171 return read < BAS_OUTBUFPAD ? 166 return read < BAS_OUTBUFPAD ?
172 BAS_OUTBUFSIZE : read - BAS_OUTBUFPAD; 167 BAS_OUTBUFSIZE : read - BAS_OUTBUFPAD;
173 } 168 }
174 169
175 limit = read + size; 170 limit = read + size;
176 dbg(DEBUG_STREAM, 171 gig_dbg(DEBUG_STREAM, "%s: read=%d write=%d limit=%d",
177 "%s: read=%d write=%d limit=%d", __func__, read, write, limit); 172 __func__, read, write, limit);
178#ifdef CONFIG_GIGASET_DEBUG 173#ifdef CONFIG_GIGASET_DEBUG
179 if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) { 174 if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) {
180 err("invalid size %d", size); 175 err("invalid size %d", size);
@@ -196,11 +191,12 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
196 return -EBUSY; 191 return -EBUSY;
197 /* write position could have changed */ 192 /* write position could have changed */
198 if (limit >= (write = atomic_read(&iwb->write))) { 193 if (limit >= (write = atomic_read(&iwb->write))) {
199 pbyte = iwb->data[write]; /* save partial byte */ 194 pbyte = iwb->data[write]; /* save
195 partial byte */
200 limit = write + BAS_OUTBUFPAD; 196 limit = write + BAS_OUTBUFPAD;
201 dbg(DEBUG_STREAM, 197 gig_dbg(DEBUG_STREAM,
202 "%s: filling %d->%d with %02x", 198 "%s: filling %d->%d with %02x",
203 __func__, write, limit, iwb->idle); 199 __func__, write, limit, iwb->idle);
204 if (write + BAS_OUTBUFPAD < BAS_OUTBUFSIZE) 200 if (write + BAS_OUTBUFPAD < BAS_OUTBUFSIZE)
205 memset(iwb->data + write, iwb->idle, 201 memset(iwb->data + write, iwb->idle,
206 BAS_OUTBUFPAD); 202 BAS_OUTBUFPAD);
@@ -211,9 +207,11 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
211 - write); 207 - write);
212 limit = 0; 208 limit = 0;
213 } 209 }
214 dbg(DEBUG_STREAM, "%s: restoring %02x at %d", 210 gig_dbg(DEBUG_STREAM,
215 __func__, pbyte, limit); 211 "%s: restoring %02x at %d",
216 iwb->data[limit] = pbyte; /* restore partial byte */ 212 __func__, pbyte, limit);
213 iwb->data[limit] = pbyte; /* restore
214 partial byte */
217 atomic_set(&iwb->write, limit); 215 atomic_set(&iwb->write, limit);
218 } 216 }
219 isowbuf_donewrite(iwb); 217 isowbuf_donewrite(iwb);
@@ -242,19 +240,17 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
242 * write hex bytes to syslog for debugging 240 * write hex bytes to syslog for debugging
243 */ 241 */
244static inline void dump_bytes(enum debuglevel level, const char *tag, 242static inline void dump_bytes(enum debuglevel level, const char *tag,
245 unsigned char *bytes, int count) 243 unsigned char *bytes, int count)
246{ 244{
247#ifdef CONFIG_GIGASET_DEBUG 245#ifdef CONFIG_GIGASET_DEBUG
248 unsigned char c; 246 unsigned char c;
249 static char dbgline[3 * 32 + 1]; 247 static char dbgline[3 * 32 + 1];
250 static const char hexdigit[] = "0123456789abcdef"; 248 static const char hexdigit[] = "0123456789abcdef";
251 int i = 0; 249 int i = 0;
252 IFNULLRET(tag);
253 IFNULLRET(bytes);
254 while (count-- > 0) { 250 while (count-- > 0) {
255 if (i > sizeof(dbgline) - 4) { 251 if (i > sizeof(dbgline) - 4) {
256 dbgline[i] = '\0'; 252 dbgline[i] = '\0';
257 dbg(level, "%s:%s", tag, dbgline); 253 gig_dbg(level, "%s:%s", tag, dbgline);
258 i = 0; 254 i = 0;
259 } 255 }
260 c = *bytes++; 256 c = *bytes++;
@@ -264,7 +260,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
264 dbgline[i++] = hexdigit[c & 0x0f]; 260 dbgline[i++] = hexdigit[c & 0x0f];
265 } 261 }
266 dbgline[i] = '\0'; 262 dbgline[i] = '\0';
267 dbg(level, "%s:%s", tag, dbgline); 263 gig_dbg(level, "%s:%s", tag, dbgline);
268#endif 264#endif
269} 265}
270 266
@@ -380,7 +376,7 @@ static u16 stufftab[5 * 256] = {
380 */ 376 */
381 377
382static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin, 378static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin,
383 int ones) 379 int ones)
384{ 380{
385 u16 stuff; 381 u16 stuff;
386 int shiftinc, newones; 382 int shiftinc, newones;
@@ -422,7 +418,7 @@ static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin,
422 */ 418 */
423 419
424static inline int hdlc_buildframe(struct isowbuf_t *iwb, 420static inline int hdlc_buildframe(struct isowbuf_t *iwb,
425 unsigned char *in, int count) 421 unsigned char *in, int count)
426{ 422{
427 int ones; 423 int ones;
428 u16 fcs; 424 u16 fcs;
@@ -431,8 +427,8 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb,
431 427
432 if (isowbuf_freebytes(iwb) < count + count / 5 + 6 || 428 if (isowbuf_freebytes(iwb) < count + count / 5 + 6 ||
433 !isowbuf_startwrite(iwb)) { 429 !isowbuf_startwrite(iwb)) {
434 dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN", 430 gig_dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN",
435 __func__, isowbuf_freebytes(iwb)); 431 __func__, isowbuf_freebytes(iwb));
436 return -EAGAIN; 432 return -EAGAIN;
437 } 433 }
438 434
@@ -484,11 +480,11 @@ static inline int trans_buildframe(struct isowbuf_t *iwb,
484 480
485 if (isowbuf_freebytes(iwb) < count || 481 if (isowbuf_freebytes(iwb) < count ||
486 !isowbuf_startwrite(iwb)) { 482 !isowbuf_startwrite(iwb)) {
487 dbg(DEBUG_ISO, "can't put %d bytes", count); 483 gig_dbg(DEBUG_ISO, "can't put %d bytes", count);
488 return -EAGAIN; 484 return -EAGAIN;
489 } 485 }
490 486
491 dbg(DEBUG_STREAM, "put %d bytes", count); 487 gig_dbg(DEBUG_STREAM, "put %d bytes", count);
492 write = atomic_read(&iwb->write); 488 write = atomic_read(&iwb->write);
493 do { 489 do {
494 c = gigaset_invtab[*in++]; 490 c = gigaset_invtab[*in++];
@@ -508,11 +504,13 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
508 switch (bcs->proto2) { 504 switch (bcs->proto2) {
509 case ISDN_PROTO_L2_HDLC: 505 case ISDN_PROTO_L2_HDLC:
510 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len); 506 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
511 dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d", __func__, len, result); 507 gig_dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d",
508 __func__, len, result);
512 break; 509 break;
513 default: /* assume transparent */ 510 default: /* assume transparent */
514 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len); 511 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
515 dbg(DEBUG_ISO, "%s: %d bytes trans -> %d", __func__, len, result); 512 gig_dbg(DEBUG_ISO, "%s: %d bytes trans -> %d",
513 __func__, len, result);
516 } 514 }
517 return result; 515 return result;
518} 516}
@@ -528,13 +526,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
528 return; 526 return;
529 } 527 }
530 if (unlikely(bcs->skb->len == SBUFSIZE)) { 528 if (unlikely(bcs->skb->len == SBUFSIZE)) {
531 warn("received oversized packet discarded"); 529 dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
532 bcs->hw.bas->giants++; 530 bcs->hw.bas->giants++;
533 dev_kfree_skb_any(bcs->skb); 531 dev_kfree_skb_any(bcs->skb);
534 bcs->skb = NULL; 532 bcs->skb = NULL;
535 return; 533 return;
536 } 534 }
537 *gigaset_skb_put_quick(bcs->skb, 1) = c; 535 *__skb_put(bcs->skb, 1) = c;
538} 536}
539 537
540/* hdlc_flush 538/* hdlc_flush
@@ -549,7 +547,7 @@ static inline void hdlc_flush(struct bc_state *bcs)
549 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 547 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
550 skb_reserve(bcs->skb, HW_HDR_LEN); 548 skb_reserve(bcs->skb, HW_HDR_LEN);
551 else 549 else
552 err("could not allocate skb"); 550 dev_err(bcs->cs->dev, "could not allocate skb\n");
553 } 551 }
554 552
555 /* reset packet state */ 553 /* reset packet state */
@@ -571,23 +569,25 @@ static inline void hdlc_done(struct bc_state *bcs)
571 569
572 if ((procskb = bcs->skb) == NULL) { 570 if ((procskb = bcs->skb) == NULL) {
573 /* previous error */ 571 /* previous error */
574 dbg(DEBUG_ISO, "%s: skb=NULL", __func__); 572 gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__);
575 gigaset_rcv_error(NULL, bcs->cs, bcs); 573 gigaset_rcv_error(NULL, bcs->cs, bcs);
576 } else if (procskb->len < 2) { 574 } else if (procskb->len < 2) {
577 notice("received short frame (%d octets)", procskb->len); 575 dev_notice(bcs->cs->dev, "received short frame (%d octets)\n",
576 procskb->len);
578 bcs->hw.bas->runts++; 577 bcs->hw.bas->runts++;
579 gigaset_rcv_error(procskb, bcs->cs, bcs); 578 gigaset_rcv_error(procskb, bcs->cs, bcs);
580 } else if (bcs->fcs != PPP_GOODFCS) { 579 } else if (bcs->fcs != PPP_GOODFCS) {
581 notice("frame check error (0x%04x)", bcs->fcs); 580 dev_notice(bcs->cs->dev, "frame check error (0x%04x)\n",
581 bcs->fcs);
582 bcs->hw.bas->fcserrs++; 582 bcs->hw.bas->fcserrs++;
583 gigaset_rcv_error(procskb, bcs->cs, bcs); 583 gigaset_rcv_error(procskb, bcs->cs, bcs);
584 } else { 584 } else {
585 procskb->len -= 2; /* subtract FCS */ 585 procskb->len -= 2; /* subtract FCS */
586 procskb->tail -= 2; 586 procskb->tail -= 2;
587 dbg(DEBUG_ISO, 587 gig_dbg(DEBUG_ISO, "%s: good frame (%d octets)",
588 "%s: good frame (%d octets)", __func__, procskb->len); 588 __func__, procskb->len);
589 dump_bytes(DEBUG_STREAM, 589 dump_bytes(DEBUG_STREAM,
590 "rcv data", procskb->data, procskb->len); 590 "rcv data", procskb->data, procskb->len);
591 bcs->hw.bas->goodbytes += procskb->len; 591 bcs->hw.bas->goodbytes += procskb->len;
592 gigaset_rcv_skb(procskb, bcs->cs, bcs); 592 gigaset_rcv_skb(procskb, bcs->cs, bcs);
593 } 593 }
@@ -595,7 +595,7 @@ static inline void hdlc_done(struct bc_state *bcs)
595 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 595 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
596 skb_reserve(bcs->skb, HW_HDR_LEN); 596 skb_reserve(bcs->skb, HW_HDR_LEN);
597 else 597 else
598 err("could not allocate skb"); 598 dev_err(bcs->cs->dev, "could not allocate skb\n");
599 bcs->fcs = PPP_INITFCS; 599 bcs->fcs = PPP_INITFCS;
600} 600}
601 601
@@ -610,14 +610,14 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
610 return; 610 return;
611 } 611 }
612 612
613 notice("received partial byte (%d bits)", inbits); 613 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
614 bcs->hw.bas->alignerrs++; 614 bcs->hw.bas->alignerrs++;
615 gigaset_rcv_error(bcs->skb, bcs->cs, bcs); 615 gigaset_rcv_error(bcs->skb, bcs->cs, bcs);
616 616
617 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 617 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
618 skb_reserve(bcs->skb, HW_HDR_LEN); 618 skb_reserve(bcs->skb, HW_HDR_LEN);
619 else 619 else
620 err("could not allocate skb"); 620 dev_err(bcs->cs->dev, "could not allocate skb\n");
621 bcs->fcs = PPP_INITFCS; 621 bcs->fcs = PPP_INITFCS;
622} 622}
623 623
@@ -659,16 +659,12 @@ static unsigned char bitcounts[256] = {
659 * bcs receiving B channel structure 659 * bcs receiving B channel structure
660 */ 660 */
661static inline void hdlc_unpack(unsigned char *src, unsigned count, 661static inline void hdlc_unpack(unsigned char *src, unsigned count,
662 struct bc_state *bcs) 662 struct bc_state *bcs)
663{ 663{
664 struct bas_bc_state *ubc; 664 struct bas_bc_state *ubc = bcs->hw.bas;
665 int inputstate; 665 int inputstate;
666 unsigned seqlen, inbyte, inbits; 666 unsigned seqlen, inbyte, inbits;
667 667
668 IFNULLRET(bcs);
669 ubc = bcs->hw.bas;
670 IFNULLRET(ubc);
671
672 /* load previous state: 668 /* load previous state:
673 * inputstate = set of flag bits: 669 * inputstate = set of flag bits:
674 * - INS_flag_hunt: no complete opening flag received since connection setup or last abort 670 * - INS_flag_hunt: no complete opening flag received since connection setup or last abort
@@ -856,7 +852,7 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count,
856 * bcs receiving B channel structure 852 * bcs receiving B channel structure
857 */ 853 */
858static inline void trans_receive(unsigned char *src, unsigned count, 854static inline void trans_receive(unsigned char *src, unsigned count,
859 struct bc_state *bcs) 855 struct bc_state *bcs)
860{ 856{
861 struct sk_buff *skb; 857 struct sk_buff *skb;
862 int dobytes; 858 int dobytes;
@@ -870,7 +866,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
870 if (unlikely((skb = bcs->skb) == NULL)) { 866 if (unlikely((skb = bcs->skb) == NULL)) {
871 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); 867 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
872 if (!skb) { 868 if (!skb) {
873 err("could not allocate skb"); 869 dev_err(bcs->cs->dev, "could not allocate skb\n");
874 return; 870 return;
875 } 871 }
876 skb_reserve(skb, HW_HDR_LEN); 872 skb_reserve(skb, HW_HDR_LEN);
@@ -888,7 +884,8 @@ static inline void trans_receive(unsigned char *src, unsigned count,
888 gigaset_rcv_skb(skb, bcs->cs, bcs); 884 gigaset_rcv_skb(skb, bcs->cs, bcs);
889 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); 885 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
890 if (!skb) { 886 if (!skb) {
891 err("could not allocate skb"); 887 dev_err(bcs->cs->dev,
888 "could not allocate skb\n");
892 return; 889 return;
893 } 890 }
894 skb_reserve(bcs->skb, HW_HDR_LEN); 891 skb_reserve(bcs->skb, HW_HDR_LEN);
@@ -921,8 +918,8 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
921 case '\r': 918 case '\r':
922 case '\n': 919 case '\n':
923 /* end of line */ 920 /* end of line */
924 dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)", 921 gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
925 __func__, cbytes); 922 __func__, cbytes);
926 cs->cbytes = cbytes; 923 cs->cbytes = cbytes;
927 gigaset_handle_modem_response(cs); 924 gigaset_handle_modem_response(cs);
928 cbytes = 0; 925 cbytes = 0;
@@ -932,7 +929,7 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
932 if (cbytes < MAX_RESP_SIZE - 1) 929 if (cbytes < MAX_RESP_SIZE - 1)
933 cbytes++; 930 cbytes++;
934 else 931 else
935 warn("response too large"); 932 dev_warn(cs->dev, "response too large\n");
936 } 933 }
937 } 934 }
938 935
@@ -951,27 +948,27 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
951 948
952 head = atomic_read(&inbuf->head); 949 head = atomic_read(&inbuf->head);
953 while (head != (tail = atomic_read(&inbuf->tail))) { 950 while (head != (tail = atomic_read(&inbuf->tail))) {
954 dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); 951 gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
955 if (head > tail) 952 if (head > tail)
956 tail = RBUFSIZE; 953 tail = RBUFSIZE;
957 src = inbuf->data + head; 954 src = inbuf->data + head;
958 numbytes = tail - head; 955 numbytes = tail - head;
959 dbg(DEBUG_INTR, "processing %u bytes", numbytes); 956 gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
960 957
961 if (atomic_read(&cs->mstate) == MS_LOCKED) { 958 if (atomic_read(&cs->mstate) == MS_LOCKED) {
962 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", 959 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
963 numbytes, src, 0); 960 numbytes, src);
964 gigaset_if_receive(inbuf->cs, src, numbytes); 961 gigaset_if_receive(inbuf->cs, src, numbytes);
965 } else { 962 } else {
966 gigaset_dbg_buffer(DEBUG_CMD, "received response", 963 gigaset_dbg_buffer(DEBUG_CMD, "received response",
967 numbytes, src, 0); 964 numbytes, src);
968 cmd_loop(src, numbytes, inbuf); 965 cmd_loop(src, numbytes, inbuf);
969 } 966 }
970 967
971 head += numbytes; 968 head += numbytes;
972 if (head == RBUFSIZE) 969 if (head == RBUFSIZE)
973 head = 0; 970 head = 0;
974 dbg(DEBUG_INTR, "setting head to %u", head); 971 gig_dbg(DEBUG_INTR, "setting head to %u", head);
975 atomic_set(&inbuf->head, head); 972 atomic_set(&inbuf->head, head);
976 } 973 }
977} 974}
@@ -992,18 +989,18 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
992 */ 989 */
993int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) 990int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
994{ 991{
995 int len; 992 int len = skb->len;
996 993 unsigned long flags;
997 IFNULLRETVAL(bcs, -EFAULT);
998 IFNULLRETVAL(skb, -EFAULT);
999 len = skb->len;
1000 994
1001 skb_queue_tail(&bcs->squeue, skb); 995 skb_queue_tail(&bcs->squeue, skb);
1002 dbg(DEBUG_ISO, 996 gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d",
1003 "%s: skb queued, qlen=%d", __func__, skb_queue_len(&bcs->squeue)); 997 __func__, skb_queue_len(&bcs->squeue));
1004 998
1005 /* tasklet submits URB if necessary */ 999 /* tasklet submits URB if necessary */
1006 tasklet_schedule(&bcs->hw.bas->sent_tasklet); 1000 spin_lock_irqsave(&bcs->cs->lock, flags);
1001 if (bcs->cs->connected)
1002 tasklet_schedule(&bcs->hw.bas->sent_tasklet);
1003 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1007 1004
1008 return len; /* ok so far */ 1005 return len; /* ok so far */
1009} 1006}
diff --git a/drivers/isdn/gigaset/proc.c b/drivers/isdn/gigaset/proc.c
index c6915fa2be6c..d267a636b53c 100644
--- a/drivers/isdn/gigaset/proc.c
+++ b/drivers/isdn/gigaset/proc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Stuff used by all variants of the driver 2 * Stuff used by all variants of the driver
3 * 3 *
4 * Copyright (c) 2001 by Stefan Eilers <Eilers.Stefan@epost.de>, 4 * Copyright (c) 2001 by Stefan Eilers,
5 * Hansjoerg Lipp <hjlipp@web.de>, 5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Tilman Schmidt <tilman@imap.cc>. 6 * Tilman Schmidt <tilman@imap.cc>.
7 * 7 *
@@ -11,26 +11,29 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: proc.c,v 1.5.2.13 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
21#include <linux/ctype.h> 17#include <linux/ctype.h>
22 18
23static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr, char *buf) 19static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr,
20 char *buf)
24{ 21{
25 struct usb_interface *intf = to_usb_interface(dev); 22 int ret;
26 struct cardstate *cs = usb_get_intfdata(intf); 23 unsigned long flags;
27 return sprintf(buf, "%d\n", atomic_read(&cs->cidmode)); // FIXME use scnprintf for 13607 bit architectures (if PAGE_SIZE==4096) 24 struct cardstate *cs = dev_get_drvdata(dev);
25
26 spin_lock_irqsave(&cs->lock, flags);
27 ret = sprintf(buf, "%u\n", cs->cidmode);
28 spin_unlock_irqrestore(&cs->lock, flags);
29
30 return ret;
28} 31}
29 32
30static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 33static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
34 const char *buf, size_t count)
31{ 35{
32 struct usb_interface *intf = to_usb_interface(dev); 36 struct cardstate *cs = dev_get_drvdata(dev);
33 struct cardstate *cs = usb_get_intfdata(intf);
34 long int value; 37 long int value;
35 char *end; 38 char *end;
36 39
@@ -41,23 +44,23 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, co
41 if (value < 0 || value > 1) 44 if (value < 0 || value > 1)
42 return -EINVAL; 45 return -EINVAL;
43 46
44 if (down_interruptible(&cs->sem)) 47 if (mutex_lock_interruptible(&cs->mutex))
45 return -ERESTARTSYS; // FIXME -EINTR? 48 return -ERESTARTSYS; // FIXME -EINTR?
46 49
47 cs->waiting = 1; 50 cs->waiting = 1;
48 if (!gigaset_add_event(cs, &cs->at_state, EV_PROC_CIDMODE, 51 if (!gigaset_add_event(cs, &cs->at_state, EV_PROC_CIDMODE,
49 NULL, value, NULL)) { 52 NULL, value, NULL)) {
50 cs->waiting = 0; 53 cs->waiting = 0;
51 up(&cs->sem); 54 mutex_unlock(&cs->mutex);
52 return -ENOMEM; 55 return -ENOMEM;
53 } 56 }
54 57
55 dbg(DEBUG_CMD, "scheduling PROC_CIDMODE"); 58 gig_dbg(DEBUG_CMD, "scheduling PROC_CIDMODE");
56 gigaset_schedule_event(cs); 59 gigaset_schedule_event(cs);
57 60
58 wait_event(cs->waitqueue, !cs->waiting); 61 wait_event(cs->waitqueue, !cs->waiting);
59 62
60 up(&cs->sem); 63 mutex_unlock(&cs->mutex);
61 64
62 return count; 65 return count;
63} 66}
@@ -65,17 +68,15 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, co
65static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode); 68static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode);
66 69
67/* free sysfs for device */ 70/* free sysfs for device */
68void gigaset_free_dev_sysfs(struct usb_interface *interface) 71void gigaset_free_dev_sysfs(struct cardstate *cs)
69{ 72{
70 dbg(DEBUG_INIT, "removing sysfs entries"); 73 gig_dbg(DEBUG_INIT, "removing sysfs entries");
71 device_remove_file(&interface->dev, &dev_attr_cidmode); 74 device_remove_file(cs->dev, &dev_attr_cidmode);
72} 75}
73EXPORT_SYMBOL_GPL(gigaset_free_dev_sysfs);
74 76
75/* initialize sysfs for device */ 77/* initialize sysfs for device */
76void gigaset_init_dev_sysfs(struct usb_interface *interface) 78void gigaset_init_dev_sysfs(struct cardstate *cs)
77{ 79{
78 dbg(DEBUG_INIT, "setting up sysfs"); 80 gig_dbg(DEBUG_INIT, "setting up sysfs");
79 device_create_file(&interface->dev, &dev_attr_cidmode); 81 device_create_file(cs->dev, &dev_attr_cidmode);
80} 82}
81EXPORT_SYMBOL_GPL(gigaset_init_dev_sysfs);
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 323fc7349dec..bfb73fd5077e 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * USB driver for Gigaset 307x directly or using M105 Data. 2 * USB driver for Gigaset 307x directly or using M105 Data.
3 * 3 *
4 * Copyright (c) 2001 by Stefan Eilers <Eilers.Stefan@epost.de> 4 * Copyright (c) 2001 by Stefan Eilers
5 * and Hansjoerg Lipp <hjlipp@web.de>. 5 * and Hansjoerg Lipp <hjlipp@web.de>.
6 * 6 *
7 * This driver was derived from the USB skeleton driver by 7 * This driver was derived from the USB skeleton driver by
@@ -13,10 +13,6 @@
13 * published by the Free Software Foundation; either version 2 of 13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version. 14 * the License, or (at your option) any later version.
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: ...
17 * =====================================================================
18 * Version: $Id: usb-gigaset.c,v 1.85.4.18 2006/02/04 18:28:16 hjlipp Exp $
19 * =====================================================================
20 */ 16 */
21 17
22#include "gigaset.h" 18#include "gigaset.h"
@@ -29,7 +25,7 @@
29#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
30 26
31/* Version Information */ 27/* Version Information */
32#define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers <Eilers.Stefan@epost.de>" 28#define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers"
33#define DRIVER_DESC "USB Driver for Gigaset 307x using M105" 29#define DRIVER_DESC "USB Driver for Gigaset 307x using M105"
34 30
35/* Module parameters */ 31/* Module parameters */
@@ -62,10 +58,6 @@ static struct usb_device_id gigaset_table [] = {
62 58
63MODULE_DEVICE_TABLE(usb, gigaset_table); 59MODULE_DEVICE_TABLE(usb, gigaset_table);
64 60
65/* Get a minor range for your devices from the usb maintainer */
66#define USB_SKEL_MINOR_BASE 200
67
68
69/* 61/*
70 * Control requests (empty fields: 00) 62 * Control requests (empty fields: 00)
71 * 63 *
@@ -114,7 +106,7 @@ MODULE_DEVICE_TABLE(usb, gigaset_table);
114 */ 106 */
115 107
116static int gigaset_probe(struct usb_interface *interface, 108static int gigaset_probe(struct usb_interface *interface,
117 const struct usb_device_id *id); 109 const struct usb_device_id *id);
118static void gigaset_disconnect(struct usb_interface *interface); 110static void gigaset_disconnect(struct usb_interface *interface);
119 111
120static struct gigaset_driver *driver = NULL; 112static struct gigaset_driver *driver = NULL;
@@ -122,29 +114,29 @@ static struct cardstate *cardstate = NULL;
122 114
123/* usb specific object needed to register this driver with the usb subsystem */ 115/* usb specific object needed to register this driver with the usb subsystem */
124static struct usb_driver gigaset_usb_driver = { 116static struct usb_driver gigaset_usb_driver = {
125 .name = GIGASET_MODULENAME, 117 .name = GIGASET_MODULENAME,
126 .probe = gigaset_probe, 118 .probe = gigaset_probe,
127 .disconnect = gigaset_disconnect, 119 .disconnect = gigaset_disconnect,
128 .id_table = gigaset_table, 120 .id_table = gigaset_table,
129}; 121};
130 122
131struct usb_cardstate { 123struct usb_cardstate {
132 struct usb_device *udev; /* save off the usb device pointer */ 124 struct usb_device *udev; /* usb device pointer */
133 struct usb_interface *interface; /* the interface for this device */ 125 struct usb_interface *interface; /* interface for this device */
134 atomic_t busy; /* bulk output in progress */ 126 atomic_t busy; /* bulk output in progress */
135 127
136 /* Output buffer for commands (M105: and data)*/ 128 /* Output buffer */
137 unsigned char *bulk_out_buffer; /* the buffer to send data */ 129 unsigned char *bulk_out_buffer;
138 int bulk_out_size; /* the size of the send buffer */ 130 int bulk_out_size;
139 __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ 131 __u8 bulk_out_endpointAddr;
140 struct urb *bulk_out_urb; /* the urb used to transmit data */ 132 struct urb *bulk_out_urb;
141 133
142 /* Input buffer for command responses (M105: and data)*/ 134 /* Input buffer */
143 int rcvbuf_size; /* the size of the receive buffer */ 135 int rcvbuf_size;
144 struct urb *read_urb; /* the urb used to receive data */ 136 struct urb *read_urb;
145 __u8 int_in_endpointAddr; /* the address of the bulk in endpoint */ 137 __u8 int_in_endpointAddr;
146 138
147 char bchars[6]; /* req. 0x19 */ 139 char bchars[6]; /* for request 0x19 */
148}; 140};
149 141
150struct usb_bc_state {}; 142struct usb_bc_state {};
@@ -157,19 +149,20 @@ static inline unsigned tiocm_to_gigaset(unsigned state)
157#ifdef CONFIG_GIGASET_UNDOCREQ 149#ifdef CONFIG_GIGASET_UNDOCREQ
158/* WARNING: EXPERIMENTAL! */ 150/* WARNING: EXPERIMENTAL! */
159static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, 151static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
160 unsigned new_state) 152 unsigned new_state)
161{ 153{
154 struct usb_device *udev = cs->hw.usb->udev;
162 unsigned mask, val; 155 unsigned mask, val;
163 int r; 156 int r;
164 157
165 mask = tiocm_to_gigaset(old_state ^ new_state); 158 mask = tiocm_to_gigaset(old_state ^ new_state);
166 val = tiocm_to_gigaset(new_state); 159 val = tiocm_to_gigaset(new_state);
167 160
168 dbg(DEBUG_USBREQ, "set flags 0x%02x with mask 0x%02x", val, mask); 161 gig_dbg(DEBUG_USBREQ, "set flags 0x%02x with mask 0x%02x", val, mask);
169 r = usb_control_msg(cs->hw.usb->udev, 162 // don't use this in an interrupt/BH
170 usb_sndctrlpipe(cs->hw.usb->udev, 0), 7, 0x41, 163 r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 7, 0x41,
171 (val & 0xff) | ((mask & 0xff) << 8), 0, 164 (val & 0xff) | ((mask & 0xff) << 8), 0,
172 NULL, 0, 2000 /*timeout??*/); // don't use this in an interrupt/BH 165 NULL, 0, 2000 /* timeout? */);
173 if (r < 0) 166 if (r < 0)
174 return r; 167 return r;
175 //.. 168 //..
@@ -178,30 +171,29 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
178 171
179static int set_value(struct cardstate *cs, u8 req, u16 val) 172static int set_value(struct cardstate *cs, u8 req, u16 val)
180{ 173{
174 struct usb_device *udev = cs->hw.usb->udev;
181 int r, r2; 175 int r, r2;
182 176
183 dbg(DEBUG_USBREQ, "request %02x (%04x)", (unsigned)req, (unsigned)val); 177 gig_dbg(DEBUG_USBREQ, "request %02x (%04x)",
184 r = usb_control_msg(cs->hw.usb->udev, 178 (unsigned)req, (unsigned)val);
185 usb_sndctrlpipe(cs->hw.usb->udev, 0), 0x12, 0x41, 179 r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x12, 0x41,
186 0xf /*?*/, 0, 180 0xf /*?*/, 0, NULL, 0, 2000 /*?*/);
187 NULL, 0, 2000 /*?*/); /* no idea, what this does */ 181 /* no idea what this does */
188 if (r < 0) { 182 if (r < 0) {
189 err("error %d on request 0x12", -r); 183 dev_err(&udev->dev, "error %d on request 0x12\n", -r);
190 return r; 184 return r;
191 } 185 }
192 186
193 r = usb_control_msg(cs->hw.usb->udev, 187 r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), req, 0x41,
194 usb_sndctrlpipe(cs->hw.usb->udev, 0), req, 0x41, 188 val, 0, NULL, 0, 2000 /*?*/);
195 val, 0,
196 NULL, 0, 2000 /*?*/);
197 if (r < 0) 189 if (r < 0)
198 err("error %d on request 0x%02x", -r, (unsigned)req); 190 dev_err(&udev->dev, "error %d on request 0x%02x\n",
191 -r, (unsigned)req);
199 192
200 r2 = usb_control_msg(cs->hw.usb->udev, 193 r2 = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41,
201 usb_sndctrlpipe(cs->hw.usb->udev, 0), 0x19, 0x41, 194 0, 0, cs->hw.usb->bchars, 6, 2000 /*?*/);
202 0, 0, cs->hw.usb->bchars, 6, 2000 /*?*/);
203 if (r2 < 0) 195 if (r2 < 0)
204 err("error %d on request 0x19", -r2); 196 dev_err(&udev->dev, "error %d on request 0x19\n", -r2);
205 197
206 return r < 0 ? r : (r2 < 0 ? r2 : 0); 198 return r < 0 ? r : (r2 < 0 ? r2 : 0);
207} 199}
@@ -229,8 +221,8 @@ static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag)
229 case B115200: rate = 115200; break; 221 case B115200: rate = 115200; break;
230 default: 222 default:
231 rate = 9600; 223 rate = 9600;
232 err("unsupported baudrate request 0x%x," 224 dev_err(cs->dev, "unsupported baudrate request 0x%x,"
233 " using default of B9600", cflag); 225 " using default of B9600\n", cflag);
234 } 226 }
235 227
236 val = 0x383fff / rate + 1; 228 val = 0x383fff / rate + 1;
@@ -259,7 +251,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag)
259 case CS8: 251 case CS8:
260 val |= 8 << 8; break; 252 val |= 8 << 8; break;
261 default: 253 default:
262 err("CSIZE was not CS5-CS8, using default of 8"); 254 dev_err(cs->dev, "CSIZE was not CS5-CS8, using default of 8\n");
263 val |= 8 << 8; 255 val |= 8 << 8;
264 break; 256 break;
265 } 257 }
@@ -277,7 +269,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag)
277 269
278#else 270#else
279static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, 271static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
280 unsigned new_state) 272 unsigned new_state)
281{ 273{
282 return -EINVAL; 274 return -EINVAL;
283} 275}
@@ -309,15 +301,12 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
309 return 0; 301 return 0;
310} 302}
311 303
312//void send_ack_to_LL(void *data);
313static int write_modem(struct cardstate *cs); 304static int write_modem(struct cardstate *cs);
314static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb); 305static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb);
315 306
316 307
317/* Handling of send queue. If there is already a skb opened, put data to 308/* Write tasklet handler: Continue sending current skb, or send command, or
318 * the transfer buffer by calling "write_modem". Otherwise take a new skb out of the queue. 309 * start sending an skb from the send queue.
319 * This function will be called by the ISR via "transmit_chars" (USB: B-Channel Bulk callback handler
320 * via immediate task queue) or by writebuf_from_LL if the LL wants to transmit data.
321 */ 310 */
322static void gigaset_modem_fill(unsigned long data) 311static void gigaset_modem_fill(unsigned long data)
323{ 312{
@@ -327,10 +316,10 @@ static void gigaset_modem_fill(unsigned long data)
327 unsigned long flags; 316 unsigned long flags;
328 int again; 317 int again;
329 318
330 dbg(DEBUG_OUTPUT, "modem_fill"); 319 gig_dbg(DEBUG_OUTPUT, "modem_fill");
331 320
332 if (atomic_read(&cs->hw.usb->busy)) { 321 if (atomic_read(&cs->hw.usb->busy)) {
333 dbg(DEBUG_OUTPUT, "modem_fill: busy"); 322 gig_dbg(DEBUG_OUTPUT, "modem_fill: busy");
334 return; 323 return;
335 } 324 }
336 325
@@ -341,26 +330,27 @@ static void gigaset_modem_fill(unsigned long data)
341 cb = cs->cmdbuf; 330 cb = cs->cmdbuf;
342 spin_unlock_irqrestore(&cs->cmdlock, flags); 331 spin_unlock_irqrestore(&cs->cmdlock, flags);
343 if (cb) { /* commands to send? */ 332 if (cb) { /* commands to send? */
344 dbg(DEBUG_OUTPUT, "modem_fill: cb"); 333 gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
345 if (send_cb(cs, cb) < 0) { 334 if (send_cb(cs, cb) < 0) {
346 dbg(DEBUG_OUTPUT, 335 gig_dbg(DEBUG_OUTPUT,
347 "modem_fill: send_cb failed"); 336 "modem_fill: send_cb failed");
348 again = 1; /* no callback will be called! */ 337 again = 1; /* no callback will be
338 called! */
349 } 339 }
350 } else { /* skbs to send? */ 340 } else { /* skbs to send? */
351 bcs->tx_skb = skb_dequeue(&bcs->squeue); 341 bcs->tx_skb = skb_dequeue(&bcs->squeue);
352 if (bcs->tx_skb) 342 if (bcs->tx_skb)
353 dbg(DEBUG_INTR, 343 gig_dbg(DEBUG_INTR,
354 "Dequeued skb (Adr: %lx)!", 344 "Dequeued skb (Adr: %lx)!",
355 (unsigned long) bcs->tx_skb); 345 (unsigned long) bcs->tx_skb);
356 } 346 }
357 } 347 }
358 348
359 if (bcs->tx_skb) { 349 if (bcs->tx_skb) {
360 dbg(DEBUG_OUTPUT, "modem_fill: tx_skb"); 350 gig_dbg(DEBUG_OUTPUT, "modem_fill: tx_skb");
361 if (write_modem(cs) < 0) { 351 if (write_modem(cs) < 0) {
362 dbg(DEBUG_OUTPUT, 352 gig_dbg(DEBUG_OUTPUT,
363 "modem_fill: write_modem failed"); 353 "modem_fill: write_modem failed");
364 // FIXME should we tell the LL? 354 // FIXME should we tell the LL?
365 again = 1; /* no callback will be called! */ 355 again = 1; /* no callback will be called! */
366 } 356 }
@@ -371,88 +361,85 @@ static void gigaset_modem_fill(unsigned long data)
371/** 361/**
372 * gigaset_read_int_callback 362 * gigaset_read_int_callback
373 * 363 *
374 * It is called if the data was received from the device. This is almost similiar to 364 * It is called if the data was received from the device.
375 * the interrupt service routine in the serial device.
376 */ 365 */
377static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs) 366static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
378{ 367{
368 struct inbuf_t *inbuf = urb->context;
369 struct cardstate *cs = inbuf->cs;
379 int resubmit = 0; 370 int resubmit = 0;
380 int r; 371 int r;
381 struct cardstate *cs;
382 unsigned numbytes; 372 unsigned numbytes;
383 unsigned char *src; 373 unsigned char *src;
384 //unsigned long flags; 374 unsigned long flags;
385 struct inbuf_t *inbuf;
386
387 IFNULLRET(urb);
388 inbuf = (struct inbuf_t *) urb->context;
389 IFNULLRET(inbuf);
390 //spin_lock_irqsave(&inbuf->lock, flags);
391 cs = inbuf->cs;
392 IFNULLGOTO(cs, exit);
393 IFNULLGOTO(cardstate, exit);
394
395 if (!atomic_read(&cs->connected)) {
396 err("%s: disconnected", __func__);
397 goto exit;
398 }
399 375
400 if (!urb->status) { 376 if (!urb->status) {
377 if (!cs->connected) {
378 err("%s: disconnected", __func__); /* should never happen */
379 return;
380 }
381
401 numbytes = urb->actual_length; 382 numbytes = urb->actual_length;
402 383
403 if (numbytes) { 384 if (numbytes) {
404 src = inbuf->rcvbuf; 385 src = inbuf->rcvbuf;
405 if (unlikely(*src)) 386 if (unlikely(*src))
406 warn("%s: There was no leading 0, but 0x%02x!", 387 dev_warn(cs->dev,
407 __func__, (unsigned) *src); 388 "%s: There was no leading 0, but 0x%02x!\n",
389 __func__, (unsigned) *src);
408 ++src; /* skip leading 0x00 */ 390 ++src; /* skip leading 0x00 */
409 --numbytes; 391 --numbytes;
410 if (gigaset_fill_inbuf(inbuf, src, numbytes)) { 392 if (gigaset_fill_inbuf(inbuf, src, numbytes)) {
411 dbg(DEBUG_INTR, "%s-->BH", __func__); 393 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
412 gigaset_schedule_event(inbuf->cs); 394 gigaset_schedule_event(inbuf->cs);
413 } 395 }
414 } else 396 } else
415 dbg(DEBUG_INTR, "Received zero block length"); 397 gig_dbg(DEBUG_INTR, "Received zero block length");
416 resubmit = 1; 398 resubmit = 1;
417 } else { 399 } else {
418 /* The urb might have been killed. */ 400 /* The urb might have been killed. */
419 dbg(DEBUG_ANY, "%s - nonzero read bulk status received: %d", 401 gig_dbg(DEBUG_ANY, "%s - nonzero read bulk status received: %d",
420 __func__, urb->status); 402 __func__, urb->status);
421 if (urb->status != -ENOENT) /* not killed */ 403 if (urb->status != -ENOENT) { /* not killed */
404 if (!cs->connected) {
405 err("%s: disconnected", __func__); /* should never happen */
406 return;
407 }
422 resubmit = 1; 408 resubmit = 1;
409 }
423 } 410 }
424exit: 411
425 //spin_unlock_irqrestore(&inbuf->lock, flags);
426 if (resubmit) { 412 if (resubmit) {
427 r = usb_submit_urb(urb, SLAB_ATOMIC); 413 spin_lock_irqsave(&cs->lock, flags);
414 r = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV;
415 spin_unlock_irqrestore(&cs->lock, flags);
428 if (r) 416 if (r)
429 err("error %d when resubmitting urb.", -r); 417 dev_err(cs->dev, "error %d when resubmitting urb.\n",
418 -r);
430 } 419 }
431} 420}
432 421
433 422
434/* This callback routine is called when data was transmitted to a B-Channel. 423/* This callback routine is called when data was transmitted to the device. */
435 * Therefore it has to check if there is still data to transmit. This
436 * happens by calling modem_fill via task queue.
437 *
438 */
439static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs) 424static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
440{ 425{
441 struct cardstate *cs = (struct cardstate *) urb->context; 426 struct cardstate *cs = urb->context;
427 unsigned long flags;
442 428
443 IFNULLRET(cs);
444#ifdef CONFIG_GIGASET_DEBUG
445 if (!atomic_read(&cs->connected)) {
446 err("%s:not connected", __func__);
447 return;
448 }
449#endif
450 if (urb->status) 429 if (urb->status)
451 err("bulk transfer failed (status %d)", -urb->status); /* That's all we can do. Communication problems 430 dev_err(cs->dev, "bulk transfer failed (status %d)\n",
452 are handeled by timeouts or network protocols */ 431 -urb->status);
432 /* That's all we can do. Communication problems
433 are handled by timeouts or network protocols. */
453 434
454 atomic_set(&cs->hw.usb->busy, 0); 435 spin_lock_irqsave(&cs->lock, flags);
455 tasklet_schedule(&cs->write_tasklet); 436 if (!cs->connected) {
437 err("%s: not connected", __func__);
438 } else {
439 atomic_set(&cs->hw.usb->busy, 0);
440 tasklet_schedule(&cs->write_tasklet);
441 }
442 spin_unlock_irqrestore(&cs->lock, flags);
456} 443}
457 444
458static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb) 445static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
@@ -469,8 +456,8 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
469 456
470 spin_lock_irqsave(&cs->cmdlock, flags); 457 spin_lock_irqsave(&cs->cmdlock, flags);
471 cs->cmdbytes -= cs->curlen; 458 cs->cmdbytes -= cs->curlen;
472 dbg(DEBUG_OUTPUT, "send_cb: sent %u bytes, %u left", 459 gig_dbg(DEBUG_OUTPUT, "send_cb: sent %u bytes, %u left",
473 cs->curlen, cs->cmdbytes); 460 cs->curlen, cs->cmdbytes);
474 cs->cmdbuf = cb = cb->next; 461 cs->cmdbuf = cb = cb->next;
475 if (cb) { 462 if (cb) {
476 cb->prev = NULL; 463 cb->prev = NULL;
@@ -487,52 +474,51 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
487 } 474 }
488 if (cb) { 475 if (cb) {
489 count = min(cb->len, ucs->bulk_out_size); 476 count = min(cb->len, ucs->bulk_out_size);
477 gig_dbg(DEBUG_OUTPUT, "send_cb: send %d bytes", count);
478
490 usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev, 479 usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev,
491 usb_sndbulkpipe(ucs->udev, 480 usb_sndbulkpipe(ucs->udev,
492 ucs->bulk_out_endpointAddr & 0x0f), 481 ucs->bulk_out_endpointAddr & 0x0f),
493 cb->buf + cb->offset, count, 482 cb->buf + cb->offset, count,
494 gigaset_write_bulk_callback, cs); 483 gigaset_write_bulk_callback, cs);
495 484
496 cb->offset += count; 485 cb->offset += count;
497 cb->len -= count; 486 cb->len -= count;
498 atomic_set(&ucs->busy, 1); 487 atomic_set(&ucs->busy, 1);
499 dbg(DEBUG_OUTPUT, "send_cb: send %d bytes", count);
500 488
501 status = usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC); 489 spin_lock_irqsave(&cs->lock, flags);
490 status = cs->connected ? usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC) : -ENODEV;
491 spin_unlock_irqrestore(&cs->lock, flags);
492
502 if (status) { 493 if (status) {
503 atomic_set(&ucs->busy, 0); 494 atomic_set(&ucs->busy, 0);
504 err("could not submit urb (error %d).", 495 err("could not submit urb (error %d)\n",
505 -status); 496 -status);
506 cb->len = 0; /* skip urb => remove cb+wakeup in next loop cycle */ 497 cb->len = 0; /* skip urb => remove cb+wakeup
498 in next loop cycle */
507 } 499 }
508 } 500 }
509 } while (cb && status); /* bei Fehler naechster Befehl //FIXME: ist das OK? */ 501 } while (cb && status); /* next command on error */
510 502
511 return status; 503 return status;
512} 504}
513 505
514/* Write string into transbuf and send it to modem. 506/* Send command to device. */
515 */
516static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, 507static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
517 int len, struct tasklet_struct *wake_tasklet) 508 int len, struct tasklet_struct *wake_tasklet)
518{ 509{
519 struct cmdbuf_t *cb; 510 struct cmdbuf_t *cb;
520 unsigned long flags; 511 unsigned long flags;
521 512
522 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? 513 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
523 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 514 DEBUG_TRANSCMD : DEBUG_LOCKCMD,
524 "CMD Transmit", len, buf, 0); 515 "CMD Transmit", len, buf);
525
526 if (!atomic_read(&cs->connected)) {
527 err("%s: not connected", __func__);
528 return -ENODEV;
529 }
530 516
531 if (len <= 0) 517 if (len <= 0)
532 return 0; 518 return 0;
533 519
534 if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { 520 if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) {
535 err("%s: out of memory", __func__); 521 dev_err(cs->dev, "%s: out of memory\n", __func__);
536 return -ENOMEM; 522 return -ENOMEM;
537 } 523 }
538 524
@@ -554,7 +540,10 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
554 cs->lastcmdbuf = cb; 540 cs->lastcmdbuf = cb;
555 spin_unlock_irqrestore(&cs->cmdlock, flags); 541 spin_unlock_irqrestore(&cs->cmdlock, flags);
556 542
557 tasklet_schedule(&cs->write_tasklet); 543 spin_lock_irqsave(&cs->lock, flags);
544 if (cs->connected)
545 tasklet_schedule(&cs->write_tasklet);
546 spin_unlock_irqrestore(&cs->lock, flags);
558 return len; 547 return len;
559} 548}
560 549
@@ -578,11 +567,12 @@ static int gigaset_chars_in_buffer(struct cardstate *cs)
578static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6]) 567static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6])
579{ 568{
580#ifdef CONFIG_GIGASET_UNDOCREQ 569#ifdef CONFIG_GIGASET_UNDOCREQ
581 gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf, 0); 570 struct usb_device *udev = cs->hw.usb->udev;
571
572 gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf);
582 memcpy(cs->hw.usb->bchars, buf, 6); 573 memcpy(cs->hw.usb->bchars, buf, 6);
583 return usb_control_msg(cs->hw.usb->udev, 574 return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41,
584 usb_sndctrlpipe(cs->hw.usb->udev, 0), 0x19, 0x41, 575 0, 0, &buf, 6, 2000);
585 0, 0, &buf, 6, 2000);
586#else 576#else
587 return -EINVAL; 577 return -EINVAL;
588#endif 578#endif
@@ -604,7 +594,6 @@ static int gigaset_initbcshw(struct bc_state *bcs)
604 if (!bcs->hw.usb) 594 if (!bcs->hw.usb)
605 return 0; 595 return 0;
606 596
607 //bcs->hw.usb->trans_flg = READY_TO_TRNSMIT; /* B-Channel ready to transmit */
608 return 1; 597 return 1;
609} 598}
610 599
@@ -614,7 +603,6 @@ static void gigaset_reinitbcshw(struct bc_state *bcs)
614 603
615static void gigaset_freecshw(struct cardstate *cs) 604static void gigaset_freecshw(struct cardstate *cs)
616{ 605{
617 //FIXME
618 tasklet_kill(&cs->write_tasklet); 606 tasklet_kill(&cs->write_tasklet);
619 kfree(cs->hw.usb); 607 kfree(cs->hw.usb);
620} 608}
@@ -639,33 +627,21 @@ static int gigaset_initcshw(struct cardstate *cs)
639 //ucs->urb_cmd_out = NULL; 627 //ucs->urb_cmd_out = NULL;
640 ucs->read_urb = NULL; 628 ucs->read_urb = NULL;
641 tasklet_init(&cs->write_tasklet, 629 tasklet_init(&cs->write_tasklet,
642 &gigaset_modem_fill, (unsigned long) cs); 630 &gigaset_modem_fill, (unsigned long) cs);
643 631
644 return 1; 632 return 1;
645} 633}
646 634
647/* Writes the data of the current open skb into the modem. 635/* Send data from current skb to the device. */
648 * We have to protect against multiple calls until the
649 * callback handler () is called , due to the fact that we
650 * are just allowed to send data once to an endpoint. Therefore
651 * we using "trans_flg" to synchonize ...
652 */
653static int write_modem(struct cardstate *cs) 636static int write_modem(struct cardstate *cs)
654{ 637{
655 int ret; 638 int ret = 0;
656 int count; 639 int count;
657 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ 640 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
658 struct usb_cardstate *ucs = cs->hw.usb; 641 struct usb_cardstate *ucs = cs->hw.usb;
659 //unsigned long flags; 642 unsigned long flags;
660
661 IFNULLRETVAL(bcs->tx_skb, -EINVAL);
662
663 dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len);
664 643
665 ret = -ENODEV; 644 gig_dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len);
666 IFNULLGOTO(ucs->bulk_out_buffer, error);
667 IFNULLGOTO(ucs->bulk_out_urb, error);
668 ret = 0;
669 645
670 if (!bcs->tx_skb->len) { 646 if (!bcs->tx_skb->len) {
671 dev_kfree_skb_any(bcs->tx_skb); 647 dev_kfree_skb_any(bcs->tx_skb);
@@ -679,40 +655,42 @@ static int write_modem(struct cardstate *cs)
679 count = min(bcs->tx_skb->len, (unsigned) ucs->bulk_out_size); 655 count = min(bcs->tx_skb->len, (unsigned) ucs->bulk_out_size);
680 memcpy(ucs->bulk_out_buffer, bcs->tx_skb->data, count); 656 memcpy(ucs->bulk_out_buffer, bcs->tx_skb->data, count);
681 skb_pull(bcs->tx_skb, count); 657 skb_pull(bcs->tx_skb, count);
682
683 usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev,
684 usb_sndbulkpipe(ucs->udev,
685 ucs->bulk_out_endpointAddr & 0x0f),
686 ucs->bulk_out_buffer, count,
687 gigaset_write_bulk_callback, cs);
688 atomic_set(&ucs->busy, 1); 658 atomic_set(&ucs->busy, 1);
689 dbg(DEBUG_OUTPUT, "write_modem: send %d bytes", count); 659 gig_dbg(DEBUG_OUTPUT, "write_modem: send %d bytes", count);
660
661 spin_lock_irqsave(&cs->lock, flags);
662 if (cs->connected) {
663 usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev,
664 usb_sndbulkpipe(ucs->udev,
665 ucs->bulk_out_endpointAddr & 0x0f),
666 ucs->bulk_out_buffer, count,
667 gigaset_write_bulk_callback, cs);
668 ret = usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC);
669 } else {
670 ret = -ENODEV;
671 }
672 spin_unlock_irqrestore(&cs->lock, flags);
690 673
691 ret = usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC);
692 if (ret) { 674 if (ret) {
693 err("could not submit urb (error %d).", -ret); 675 err("could not submit urb (error %d)\n", -ret);
694 atomic_set(&ucs->busy, 0); 676 atomic_set(&ucs->busy, 0);
695 } 677 }
678
696 if (!bcs->tx_skb->len) { 679 if (!bcs->tx_skb->len) {
697 /* skb sent completely */ 680 /* skb sent completely */
698 gigaset_skb_sent(bcs, bcs->tx_skb); //FIXME also, when ret<0? 681 gigaset_skb_sent(bcs, bcs->tx_skb); //FIXME also, when ret<0?
699 682
700 dbg(DEBUG_INTR, 683 gig_dbg(DEBUG_INTR, "kfree skb (Adr: %lx)!",
701 "kfree skb (Adr: %lx)!", (unsigned long) bcs->tx_skb); 684 (unsigned long) bcs->tx_skb);
702 dev_kfree_skb_any(bcs->tx_skb); 685 dev_kfree_skb_any(bcs->tx_skb);
703 bcs->tx_skb = NULL; 686 bcs->tx_skb = NULL;
704 } 687 }
705 688
706 return ret; 689 return ret;
707error:
708 dev_kfree_skb_any(bcs->tx_skb);
709 bcs->tx_skb = NULL;
710 return ret;
711
712} 690}
713 691
714static int gigaset_probe(struct usb_interface *interface, 692static int gigaset_probe(struct usb_interface *interface,
715 const struct usb_device_id *id) 693 const struct usb_device_id *id)
716{ 694{
717 int retval; 695 int retval;
718 struct usb_device *udev = interface_to_usbdev(interface); 696 struct usb_device *udev = interface_to_usbdev(interface);
@@ -720,16 +698,14 @@ static int gigaset_probe(struct usb_interface *interface,
720 struct usb_host_interface *hostif; 698 struct usb_host_interface *hostif;
721 struct cardstate *cs = NULL; 699 struct cardstate *cs = NULL;
722 struct usb_cardstate *ucs = NULL; 700 struct usb_cardstate *ucs = NULL;
723 //struct usb_interface_descriptor *iface_desc;
724 struct usb_endpoint_descriptor *endpoint; 701 struct usb_endpoint_descriptor *endpoint;
725 //isdn_ctrl command;
726 int buffer_size; 702 int buffer_size;
727 int alt; 703 int alt;
728 //unsigned long flags;
729 704
730 info("%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", 705 gig_dbg(DEBUG_ANY,
731 __func__, le16_to_cpu(udev->descriptor.idVendor), 706 "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)",
732 le16_to_cpu(udev->descriptor.idProduct)); 707 __func__, le16_to_cpu(udev->descriptor.idVendor),
708 le16_to_cpu(udev->descriptor.idProduct));
733 709
734 retval = -ENODEV; //FIXME 710 retval = -ENODEV; //FIXME
735 711
@@ -744,7 +720,7 @@ static int gigaset_probe(struct usb_interface *interface,
744 ifnum = hostif->desc.bInterfaceNumber; // FIXME ? 720 ifnum = hostif->desc.bInterfaceNumber; // FIXME ?
745 721
746 if (alt != 0 || ifnum != 0) { 722 if (alt != 0 || ifnum != 0) {
747 warn("ifnum %d, alt %d", ifnum, alt); 723 dev_warn(&udev->dev, "ifnum %d, alt %d\n", ifnum, alt);
748 return -ENODEV; 724 return -ENODEV;
749 } 725 }
750 726
@@ -752,42 +728,29 @@ static int gigaset_probe(struct usb_interface *interface,
752 * 728 *
753 */ 729 */
754 if (hostif->desc.bInterfaceClass != 255) { 730 if (hostif->desc.bInterfaceClass != 255) {
755 info("%s: Device matched, but iface_desc[%d]->bInterfaceClass==%d !", 731 dev_info(&udev->dev,
756 __func__, ifnum, hostif->desc.bInterfaceClass); 732 "%s: Device matched but iface_desc[%d]->bInterfaceClass==%d!\n",
733 __func__, ifnum, hostif->desc.bInterfaceClass);
757 return -ENODEV; 734 return -ENODEV;
758 } 735 }
759 736
760 info("%s: Device matched ... !", __func__); 737 dev_info(&udev->dev, "%s: Device matched ... !\n", __func__);
761 738
762 cs = gigaset_getunassignedcs(driver); 739 cs = gigaset_getunassignedcs(driver);
763 if (!cs) { 740 if (!cs) {
764 warn("No free cardstate!"); 741 dev_warn(&udev->dev, "no free cardstate\n");
765 return -ENODEV; 742 return -ENODEV;
766 } 743 }
767 ucs = cs->hw.usb; 744 ucs = cs->hw.usb;
768 745
769#if 0 746 /* save off device structure ptrs for later use */
770 if (usb_set_configuration(udev, udev->config[0].desc.bConfigurationValue) < 0) { 747 usb_get_dev(udev);
771 warn("set_configuration failed"); 748 ucs->udev = udev;
772 goto error; 749 ucs->interface = interface;
773 } 750 cs->dev = &interface->dev;
774
775
776 if (usb_set_interface(udev, ifnum/*==0*/, alt/*==0*/) < 0) {
777 warn("usb_set_interface failed, device %d interface %d altsetting %d",
778 udev->devnum, ifnum, alt);
779 goto error;
780 }
781#endif
782 751
783 /* set up the endpoint information */ 752 /* save address of controller structure */
784 /* check out the endpoints */ 753 usb_set_intfdata(interface, cs); // dev_set_drvdata(&interface->dev, cs);
785 /* We will get 2 endpoints: One for sending commands to the device (bulk out) and one to
786 * poll messages from the device(int in).
787 * Therefore we will have an almost similiar situation as with our serial port handler.
788 * If an connection will be established, we will have to create data in/out pipes
789 * dynamically...
790 */
791 754
792 endpoint = &hostif->endpoint[0].desc; 755 endpoint = &hostif->endpoint[0].desc;
793 756
@@ -796,14 +759,14 @@ static int gigaset_probe(struct usb_interface *interface,
796 ucs->bulk_out_endpointAddr = endpoint->bEndpointAddress; 759 ucs->bulk_out_endpointAddr = endpoint->bEndpointAddress;
797 ucs->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); 760 ucs->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
798 if (!ucs->bulk_out_buffer) { 761 if (!ucs->bulk_out_buffer) {
799 err("Couldn't allocate bulk_out_buffer"); 762 dev_err(cs->dev, "Couldn't allocate bulk_out_buffer\n");
800 retval = -ENOMEM; 763 retval = -ENOMEM;
801 goto error; 764 goto error;
802 } 765 }
803 766
804 ucs->bulk_out_urb = usb_alloc_urb(0, SLAB_KERNEL); 767 ucs->bulk_out_urb = usb_alloc_urb(0, SLAB_KERNEL);
805 if (!ucs->bulk_out_urb) { 768 if (!ucs->bulk_out_urb) {
806 err("Couldn't allocate bulk_out_buffer"); 769 dev_err(cs->dev, "Couldn't allocate bulk_out_urb\n");
807 retval = -ENOMEM; 770 retval = -ENOMEM;
808 goto error; 771 goto error;
809 } 772 }
@@ -811,12 +774,10 @@ static int gigaset_probe(struct usb_interface *interface,
811 endpoint = &hostif->endpoint[1].desc; 774 endpoint = &hostif->endpoint[1].desc;
812 775
813 atomic_set(&ucs->busy, 0); 776 atomic_set(&ucs->busy, 0);
814 ucs->udev = udev;
815 ucs->interface = interface;
816 777
817 ucs->read_urb = usb_alloc_urb(0, SLAB_KERNEL); 778 ucs->read_urb = usb_alloc_urb(0, SLAB_KERNEL);
818 if (!ucs->read_urb) { 779 if (!ucs->read_urb) {
819 err("No free urbs available"); 780 dev_err(cs->dev, "No free urbs available\n");
820 retval = -ENOMEM; 781 retval = -ENOMEM;
821 goto error; 782 goto error;
822 } 783 }
@@ -825,38 +786,33 @@ static int gigaset_probe(struct usb_interface *interface,
825 ucs->int_in_endpointAddr = endpoint->bEndpointAddress; 786 ucs->int_in_endpointAddr = endpoint->bEndpointAddress;
826 cs->inbuf[0].rcvbuf = kmalloc(buffer_size, GFP_KERNEL); 787 cs->inbuf[0].rcvbuf = kmalloc(buffer_size, GFP_KERNEL);
827 if (!cs->inbuf[0].rcvbuf) { 788 if (!cs->inbuf[0].rcvbuf) {
828 err("Couldn't allocate rcvbuf"); 789 dev_err(cs->dev, "Couldn't allocate rcvbuf\n");
829 retval = -ENOMEM; 790 retval = -ENOMEM;
830 goto error; 791 goto error;
831 } 792 }
832 /* Fill the interrupt urb and send it to the core */ 793 /* Fill the interrupt urb and send it to the core */
833 usb_fill_int_urb(ucs->read_urb, udev, 794 usb_fill_int_urb(ucs->read_urb, udev,
834 usb_rcvintpipe(udev, 795 usb_rcvintpipe(udev,
835 endpoint->bEndpointAddress & 0x0f), 796 endpoint->bEndpointAddress & 0x0f),
836 cs->inbuf[0].rcvbuf, buffer_size, 797 cs->inbuf[0].rcvbuf, buffer_size,
837 gigaset_read_int_callback, 798 gigaset_read_int_callback,
838 cs->inbuf + 0, endpoint->bInterval); 799 cs->inbuf + 0, endpoint->bInterval);
839 800
840 retval = usb_submit_urb(ucs->read_urb, SLAB_KERNEL); 801 retval = usb_submit_urb(ucs->read_urb, SLAB_KERNEL);
841 if (retval) { 802 if (retval) {
842 err("Could not submit URB!"); 803 dev_err(cs->dev, "Could not submit URB (error %d)\n", -retval);
843 goto error; 804 goto error;
844 } 805 }
845 806
846 /* tell common part that the device is ready */ 807 /* tell common part that the device is ready */
847 if (startmode == SM_LOCKED) 808 if (startmode == SM_LOCKED)
848 atomic_set(&cs->mstate, MS_LOCKED); 809 atomic_set(&cs->mstate, MS_LOCKED);
810
849 if (!gigaset_start(cs)) { 811 if (!gigaset_start(cs)) {
850 tasklet_kill(&cs->write_tasklet); 812 tasklet_kill(&cs->write_tasklet);
851 retval = -ENODEV; //FIXME 813 retval = -ENODEV; //FIXME
852 goto error; 814 goto error;
853 } 815 }
854
855 /* save address of controller structure */
856 usb_set_intfdata(interface, cs);
857
858 /* set up device sysfs */
859 gigaset_init_dev_sysfs(interface);
860 return 0; 816 return 0;
861 817
862error: 818error:
@@ -868,48 +824,45 @@ error:
868 kfree(cs->inbuf[0].rcvbuf); 824 kfree(cs->inbuf[0].rcvbuf);
869 if (ucs->read_urb != NULL) 825 if (ucs->read_urb != NULL)
870 usb_free_urb(ucs->read_urb); 826 usb_free_urb(ucs->read_urb);
827 usb_set_intfdata(interface, NULL);
871 ucs->read_urb = ucs->bulk_out_urb = NULL; 828 ucs->read_urb = ucs->bulk_out_urb = NULL;
872 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; 829 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL;
830 usb_put_dev(ucs->udev);
831 ucs->udev = NULL;
832 ucs->interface = NULL;
873 gigaset_unassign(cs); 833 gigaset_unassign(cs);
874 return retval; 834 return retval;
875} 835}
876 836
877/**
878 * skel_disconnect
879 */
880static void gigaset_disconnect(struct usb_interface *interface) 837static void gigaset_disconnect(struct usb_interface *interface)
881{ 838{
882 struct cardstate *cs; 839 struct cardstate *cs;
883 struct usb_cardstate *ucs; 840 struct usb_cardstate *ucs;
884 841
885 cs = usb_get_intfdata(interface); 842 cs = usb_get_intfdata(interface);
886
887 /* clear device sysfs */
888 gigaset_free_dev_sysfs(interface);
889
890 usb_set_intfdata(interface, NULL);
891 ucs = cs->hw.usb; 843 ucs = cs->hw.usb;
892 usb_kill_urb(ucs->read_urb); 844 usb_kill_urb(ucs->read_urb);
893 //info("GigaSet USB device #%d will be disconnected", minor);
894 845
895 gigaset_stop(cs); 846 gigaset_stop(cs);
896 847
848 usb_set_intfdata(interface, NULL);
897 tasklet_kill(&cs->write_tasklet); 849 tasklet_kill(&cs->write_tasklet);
898 850
899 usb_kill_urb(ucs->bulk_out_urb); /* FIXME: nur, wenn noetig */ 851 usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */
900 //usb_kill_urb(ucs->urb_cmd_out); /* FIXME: nur, wenn noetig */
901 852
902 kfree(ucs->bulk_out_buffer); 853 kfree(ucs->bulk_out_buffer);
903 if (ucs->bulk_out_urb != NULL) 854 if (ucs->bulk_out_urb != NULL)
904 usb_free_urb(ucs->bulk_out_urb); 855 usb_free_urb(ucs->bulk_out_urb);
905 //if(ucs->urb_cmd_out != NULL)
906 // usb_free_urb(ucs->urb_cmd_out);
907 kfree(cs->inbuf[0].rcvbuf); 856 kfree(cs->inbuf[0].rcvbuf);
908 if (ucs->read_urb != NULL) 857 if (ucs->read_urb != NULL)
909 usb_free_urb(ucs->read_urb); 858 usb_free_urb(ucs->read_urb);
910 ucs->read_urb = ucs->bulk_out_urb/*=ucs->urb_cmd_out*/=NULL; 859 ucs->read_urb = ucs->bulk_out_urb = NULL;
911 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; 860 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL;
912 861
862 usb_put_dev(ucs->udev);
863 ucs->interface = NULL;
864 ucs->udev = NULL;
865 cs->dev = NULL;
913 gigaset_unassign(cs); 866 gigaset_unassign(cs);
914} 867}
915 868
@@ -942,9 +895,9 @@ static int __init usb_gigaset_init(void)
942 895
943 /* allocate memory for our driver state and intialize it */ 896 /* allocate memory for our driver state and intialize it */
944 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 897 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
945 GIGASET_MODULENAME, GIGASET_DEVNAME, 898 GIGASET_MODULENAME, GIGASET_DEVNAME,
946 GIGASET_DEVFSNAME, &ops, 899 GIGASET_DEVFSNAME, &ops,
947 THIS_MODULE)) == NULL) 900 THIS_MODULE)) == NULL)
948 goto error; 901 goto error;
949 902
950 /* allocate memory for our device state and intialize it */ 903 /* allocate memory for our device state and intialize it */
@@ -981,8 +934,8 @@ error: if (cardstate)
981static void __exit usb_gigaset_exit(void) 934static void __exit usb_gigaset_exit(void)
982{ 935{
983 gigaset_blockdriver(driver); /* => probe will fail 936 gigaset_blockdriver(driver); /* => probe will fail
984 * => no gigaset_start any more 937 * => no gigaset_start any more
985 */ 938 */
986 939
987 gigaset_shutdown(cardstate); 940 gigaset_shutdown(cardstate);
988 /* from now on, no isdn callback should be possible */ 941 /* from now on, no isdn callback should be possible */
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index a0927d1b7a0c..918742271c79 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -109,7 +109,7 @@ isdn_ppp_free(isdn_net_local * lp)
109{ 109{
110 struct ippp_struct *is; 110 struct ippp_struct *is;
111 111
112 if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { 112 if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
113 printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", 113 printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
114 __FUNCTION__, lp->ppp_slot); 114 __FUNCTION__, lp->ppp_slot);
115 return 0; 115 return 0;
@@ -126,7 +126,7 @@ isdn_ppp_free(isdn_net_local * lp)
126 lp->netdev->pb->ref_ct--; 126 lp->netdev->pb->ref_ct--;
127 spin_unlock(&lp->netdev->pb->lock); 127 spin_unlock(&lp->netdev->pb->lock);
128#endif /* CONFIG_ISDN_MPP */ 128#endif /* CONFIG_ISDN_MPP */
129 if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { 129 if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
130 printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n", 130 printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
131 __FUNCTION__, lp->ppp_slot); 131 __FUNCTION__, lp->ppp_slot);
132 return 0; 132 return 0;
@@ -279,7 +279,7 @@ isdn_ppp_open(int min, struct file *file)
279 int slot; 279 int slot;
280 struct ippp_struct *is; 280 struct ippp_struct *is;
281 281
282 if (min < 0 || min > ISDN_MAX_CHANNELS) 282 if (min < 0 || min >= ISDN_MAX_CHANNELS)
283 return -ENODEV; 283 return -ENODEV;
284 284
285 slot = isdn_ppp_get_slot(); 285 slot = isdn_ppp_get_slot();
@@ -1042,7 +1042,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
1042 if (lp->master) { // FIXME? 1042 if (lp->master) { // FIXME?
1043 mlp = (isdn_net_local *) lp->master->priv; 1043 mlp = (isdn_net_local *) lp->master->priv;
1044 slot = mlp->ppp_slot; 1044 slot = mlp->ppp_slot;
1045 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 1045 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
1046 printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n", 1046 printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
1047 lp->ppp_slot); 1047 lp->ppp_slot);
1048 goto drop_packet; 1048 goto drop_packet;
@@ -1264,7 +1264,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
1264 /* we have our lp locked from now on */ 1264 /* we have our lp locked from now on */
1265 1265
1266 slot = lp->ppp_slot; 1266 slot = lp->ppp_slot;
1267 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 1267 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
1268 printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n", 1268 printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
1269 lp->ppp_slot); 1269 lp->ppp_slot);
1270 kfree_skb(skb); 1270 kfree_skb(skb);
@@ -1603,7 +1603,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
1603 mp = net_dev->pb; 1603 mp = net_dev->pb;
1604 stats = &mp->stats; 1604 stats = &mp->stats;
1605 slot = lp->ppp_slot; 1605 slot = lp->ppp_slot;
1606 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 1606 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
1607 printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", 1607 printk(KERN_ERR "%s: lp->ppp_slot(%d)\n",
1608 __FUNCTION__, lp->ppp_slot); 1608 __FUNCTION__, lp->ppp_slot);
1609 stats->frame_drops++; 1609 stats->frame_drops++;
@@ -1640,7 +1640,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
1640 is->last_link_seqno = minseq = newseq; 1640 is->last_link_seqno = minseq = newseq;
1641 for (lpq = net_dev->queue;;) { 1641 for (lpq = net_dev->queue;;) {
1642 slot = lpq->ppp_slot; 1642 slot = lpq->ppp_slot;
1643 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 1643 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
1644 printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n", 1644 printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n",
1645 __FUNCTION__, lpq->ppp_slot); 1645 __FUNCTION__, lpq->ppp_slot);
1646 } else { 1646 } else {
@@ -2648,7 +2648,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
2648 2648
2649 printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n", 2649 printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n",
2650 lp->ppp_slot); 2650 lp->ppp_slot);
2651 if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { 2651 if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
2652 printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", 2652 printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
2653 __FUNCTION__, lp->ppp_slot); 2653 __FUNCTION__, lp->ppp_slot);
2654 return; 2654 return;
@@ -2658,7 +2658,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
2658 2658
2659 if(lp->master) { 2659 if(lp->master) {
2660 int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; 2660 int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
2661 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 2661 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
2662 printk(KERN_ERR "%s: slot(%d) out of range\n", 2662 printk(KERN_ERR "%s: slot(%d) out of range\n",
2663 __FUNCTION__, slot); 2663 __FUNCTION__, slot);
2664 return; 2664 return;
@@ -2845,7 +2845,7 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct
2845 2845
2846 if (lp->master) { 2846 if (lp->master) {
2847 slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; 2847 slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
2848 if (slot < 0 || slot > ISDN_MAX_CHANNELS) { 2848 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
2849 printk(KERN_ERR "%s: slot(%d) out of range\n", 2849 printk(KERN_ERR "%s: slot(%d) out of range\n",
2850 __FUNCTION__, slot); 2850 __FUNCTION__, slot);
2851 return; 2851 return;
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 2c4f20b7f021..3f5b64794542 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -14,13 +14,7 @@ config LEDS_CLASS
14 This option enables the led sysfs class in /sys/class/leds. You'll 14 This option enables the led sysfs class in /sys/class/leds. You'll
15 need this to do anything useful with LEDs. If unsure, say N. 15 need this to do anything useful with LEDs. If unsure, say N.
16 16
17config LEDS_TRIGGERS 17comment "LED drivers"
18 bool "LED Trigger support"
19 depends NEW_LEDS
20 help
21 This option enables trigger support for the leds class.
22 These triggers allow kernel events to drive the LEDs and can
23 be configured via sysfs. If unsure, say Y.
24 18
25config LEDS_CORGI 19config LEDS_CORGI
26 tristate "LED Support for the Sharp SL-C7x0 series" 20 tristate "LED Support for the Sharp SL-C7x0 series"
@@ -59,6 +53,23 @@ config LEDS_TOSA
59 This option enables support for the LEDs on Sharp Zaurus 53 This option enables support for the LEDs on Sharp Zaurus
60 SL-6000 series. 54 SL-6000 series.
61 55
56config LEDS_S3C24XX
57 tristate "LED Support for Samsung S3C24XX GPIO LEDs"
58 depends on LEDS_CLASS && ARCH_S3C2410
59 help
60 This option enables support for LEDs connected to GPIO lines
61 on Samsung S3C24XX series CPUs, such as the S3C2410 and S3C2440.
62
63comment "LED Triggers"
64
65config LEDS_TRIGGERS
66 bool "LED Trigger support"
67 depends NEW_LEDS
68 help
69 This option enables trigger support for the leds class.
70 These triggers allow kernel events to drive the LEDs and can
71 be configured via sysfs. If unsure, say Y.
72
62config LEDS_TRIGGER_TIMER 73config LEDS_TRIGGER_TIMER
63 tristate "LED Timer Trigger" 74 tristate "LED Timer Trigger"
64 depends LEDS_TRIGGERS 75 depends LEDS_TRIGGERS
@@ -67,7 +78,7 @@ config LEDS_TRIGGER_TIMER
67 via sysfs. If unsure, say Y. 78 via sysfs. If unsure, say Y.
68 79
69config LEDS_TRIGGER_IDE_DISK 80config LEDS_TRIGGER_IDE_DISK
70 bool "LED Timer Trigger" 81 bool "LED IDE Disk Trigger"
71 depends LEDS_TRIGGERS && BLK_DEV_IDEDISK 82 depends LEDS_TRIGGERS && BLK_DEV_IDEDISK
72 help 83 help
73 This allows LEDs to be controlled by IDE disk activity. 84 This allows LEDs to be controlled by IDE disk activity.
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 40699d3cabbf..40f042633bf5 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
10obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o 10obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o
11obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o 11obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o
12obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o 12obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o
13obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
13 14
14# LED Triggers 15# LED Triggers
15obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o 16obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c
new file mode 100644
index 000000000000..650cf72dc675
--- /dev/null
+++ b/drivers/leds/leds-s3c24xx.c
@@ -0,0 +1,163 @@
1/* drivers/leds/leds-s3c24xx.c
2 *
3 * (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX - LEDs GPIO driver
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/config.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/leds.h>
19
20#include <asm/arch/hardware.h>
21#include <asm/arch/regs-gpio.h>
22#include <asm/arch/leds-gpio.h>
23
24/* our context */
25
26struct s3c24xx_gpio_led {
27 struct led_classdev cdev;
28 struct s3c24xx_led_platdata *pdata;
29};
30
31static inline struct s3c24xx_gpio_led *pdev_to_gpio(struct platform_device *dev)
32{
33 return platform_get_drvdata(dev);
34}
35
36static inline struct s3c24xx_gpio_led *to_gpio(struct led_classdev *led_cdev)
37{
38 return container_of(led_cdev, struct s3c24xx_gpio_led, cdev);
39}
40
41static void s3c24xx_led_set(struct led_classdev *led_cdev,
42 enum led_brightness value)
43{
44 struct s3c24xx_gpio_led *led = to_gpio(led_cdev);
45 struct s3c24xx_led_platdata *pd = led->pdata;
46
47 /* there will be a sort delay between setting the output and
48 * going from output to input when using tristate. */
49
50 s3c2410_gpio_setpin(pd->gpio, (value ? 1 : 0) ^
51 (pd->flags & S3C24XX_LEDF_ACTLOW));
52
53 if (pd->flags & S3C24XX_LEDF_TRISTATE)
54 s3c2410_gpio_cfgpin(pd->gpio,
55 value ? S3C2410_GPIO_OUTPUT : S3C2410_GPIO_INPUT);
56
57}
58
59static int s3c24xx_led_remove(struct platform_device *dev)
60{
61 struct s3c24xx_gpio_led *led = pdev_to_gpio(dev);
62
63 led_classdev_unregister(&led->cdev);
64 kfree(led);
65
66 return 0;
67}
68
69static int s3c24xx_led_probe(struct platform_device *dev)
70{
71 struct s3c24xx_led_platdata *pdata = dev->dev.platform_data;
72 struct s3c24xx_gpio_led *led;
73 int ret;
74
75 led = kzalloc(sizeof(struct s3c24xx_gpio_led), GFP_KERNEL);
76 if (led == NULL) {
77 dev_err(&dev->dev, "No memory for device\n");
78 return -ENOMEM;
79 }
80
81 platform_set_drvdata(dev, led);
82
83 led->cdev.brightness_set = s3c24xx_led_set;
84 led->cdev.default_trigger = pdata->def_trigger;
85 led->cdev.name = pdata->name;
86
87 led->pdata = pdata;
88
89 /* no point in having a pull-up if we are always driving */
90
91 if (pdata->flags & S3C24XX_LEDF_TRISTATE) {
92 s3c2410_gpio_setpin(pdata->gpio, 0);
93 s3c2410_gpio_cfgpin(pdata->gpio, S3C2410_GPIO_INPUT);
94 } else {
95 s3c2410_gpio_pullup(pdata->gpio, 0);
96 s3c2410_gpio_setpin(pdata->gpio, 0);
97 s3c2410_gpio_cfgpin(pdata->gpio, S3C2410_GPIO_OUTPUT);
98 }
99
100 /* register our new led device */
101
102 ret = led_classdev_register(&dev->dev, &led->cdev);
103 if (ret < 0) {
104 dev_err(&dev->dev, "led_classdev_register failed\n");
105 goto exit_err1;
106 }
107
108 return 0;
109
110 exit_err1:
111 kfree(led);
112 return ret;
113}
114
115
116#ifdef CONFIG_PM
117static int s3c24xx_led_suspend(struct platform_device *dev, pm_message_t state)
118{
119 struct s3c24xx_gpio_led *led = pdev_to_gpio(dev);
120
121 led_classdev_suspend(&led->cdev);
122 return 0;
123}
124
125static int s3c24xx_led_resume(struct platform_device *dev)
126{
127 struct s3c24xx_gpio_led *led = pdev_to_gpio(dev);
128
129 led_classdev_resume(&led->cdev);
130 return 0;
131}
132#else
133#define s3c24xx_led_suspend NULL
134#define s3c24xx_led_resume NULL
135#endif
136
137static struct platform_driver s3c24xx_led_driver = {
138 .probe = s3c24xx_led_probe,
139 .remove = s3c24xx_led_remove,
140 .suspend = s3c24xx_led_suspend,
141 .resume = s3c24xx_led_resume,
142 .driver = {
143 .name = "s3c24xx_led",
144 .owner = THIS_MODULE,
145 },
146};
147
148static int __init s3c24xx_led_init(void)
149{
150 return platform_driver_register(&s3c24xx_led_driver);
151}
152
153static void __exit s3c24xx_led_exit(void)
154{
155 platform_driver_unregister(&s3c24xx_led_driver);
156}
157
158module_init(s3c24xx_led_init);
159module_exit(s3c24xx_led_exit);
160
161MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
162MODULE_DESCRIPTION("S3C24XX LED driver");
163MODULE_LICENSE("GPL");
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index fd2aae150ccc..ac25a48362ac 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -139,11 +139,12 @@ config MD_RAID5_RESHAPE
139 is online. However it is still EXPERIMENTAL code. It should 139 is online. However it is still EXPERIMENTAL code. It should
140 work, but please be sure that you have backups. 140 work, but please be sure that you have backups.
141 141
142 You will need a version of mdadm newer than 2.3.1. During the 142 You will need mdadm verion 2.4.1 or later to use this
143 early stage of reshape there is a critical section where live data 143 feature safely. During the early stage of reshape there is
144 is being over-written. A crash during this time needs extra care 144 a critical section where live data is being over-written. A
145 for recovery. The newer mdadm takes a copy of the data in the 145 crash during this time needs extra care for recovery. The
146 critical section and will restore it, if necessary, after a crash. 146 newer mdadm takes a copy of the data in the critical section
147 and will restore it, if necessary, after a crash.
147 148
148 The mdadm usage is e.g. 149 The mdadm usage is e.g.
149 mdadm --grow /dev/md1 --raid-disks=6 150 mdadm --grow /dev/md1 --raid-disks=6
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1ed5152db450..d7316b829a62 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -163,6 +163,7 @@ void md_new_event(mddev_t *mddev)
163{ 163{
164 atomic_inc(&md_event_count); 164 atomic_inc(&md_event_count);
165 wake_up(&md_event_waiters); 165 wake_up(&md_event_waiters);
166 sysfs_notify(&mddev->kobj, NULL, "sync_action");
166} 167}
167EXPORT_SYMBOL_GPL(md_new_event); 168EXPORT_SYMBOL_GPL(md_new_event);
168 169
@@ -278,11 +279,6 @@ static inline int mddev_lock(mddev_t * mddev)
278 return mutex_lock_interruptible(&mddev->reconfig_mutex); 279 return mutex_lock_interruptible(&mddev->reconfig_mutex);
279} 280}
280 281
281static inline void mddev_lock_uninterruptible(mddev_t * mddev)
282{
283 mutex_lock(&mddev->reconfig_mutex);
284}
285
286static inline int mddev_trylock(mddev_t * mddev) 282static inline int mddev_trylock(mddev_t * mddev)
287{ 283{
288 return mutex_trylock(&mddev->reconfig_mutex); 284 return mutex_trylock(&mddev->reconfig_mutex);
@@ -2457,9 +2453,11 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
2457 2453
2458 if (!entry->show) 2454 if (!entry->show)
2459 return -EIO; 2455 return -EIO;
2460 mddev_lock(mddev); 2456 rv = mddev_lock(mddev);
2461 rv = entry->show(mddev, page); 2457 if (!rv) {
2462 mddev_unlock(mddev); 2458 rv = entry->show(mddev, page);
2459 mddev_unlock(mddev);
2460 }
2463 return rv; 2461 return rv;
2464} 2462}
2465 2463
@@ -2473,9 +2471,11 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
2473 2471
2474 if (!entry->store) 2472 if (!entry->store)
2475 return -EIO; 2473 return -EIO;
2476 mddev_lock(mddev); 2474 rv = mddev_lock(mddev);
2477 rv = entry->store(mddev, page, length); 2475 if (!rv) {
2478 mddev_unlock(mddev); 2476 rv = entry->store(mddev, page, length);
2477 mddev_unlock(mddev);
2478 }
2479 return rv; 2479 return rv;
2480} 2480}
2481 2481
@@ -4340,8 +4340,9 @@ static int md_seq_show(struct seq_file *seq, void *v)
4340 return 0; 4340 return 0;
4341 } 4341 }
4342 4342
4343 if (mddev_lock(mddev)!=0) 4343 if (mddev_lock(mddev) < 0)
4344 return -EINTR; 4344 return -EINTR;
4345
4345 if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) { 4346 if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
4346 seq_printf(seq, "%s : %sactive", mdname(mddev), 4347 seq_printf(seq, "%s : %sactive", mdname(mddev),
4347 mddev->pers ? "" : "in"); 4348 mddev->pers ? "" : "in");
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 4092a5e37ffc..b3ea2d63db9b 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -84,4 +84,4 @@ obj-$(CONFIG_USB_IBMCAM) += usbvideo/
84obj-$(CONFIG_USB_KONICAWC) += usbvideo/ 84obj-$(CONFIG_USB_KONICAWC) += usbvideo/
85obj-$(CONFIG_USB_VICAM) += usbvideo/ 85obj-$(CONFIG_USB_VICAM) += usbvideo/
86 86
87EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 87EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile
index 94350f21cdc0..db641a36b197 100644
--- a/drivers/media/video/bt8xx/Makefile
+++ b/drivers/media/video/bt8xx/Makefile
@@ -9,4 +9,4 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \
9obj-$(CONFIG_VIDEO_BT848) += bttv.o 9obj-$(CONFIG_VIDEO_BT848) += bttv.o
10 10
11EXTRA_CFLAGS += -I$(src)/.. 11EXTRA_CFLAGS += -I$(src)/..
12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff --git a/drivers/media/video/cx25840/Makefile b/drivers/media/video/cx25840/Makefile
index 32a896c23d1e..6e8665be8954 100644
--- a/drivers/media/video/cx25840/Makefile
+++ b/drivers/media/video/cx25840/Makefile
@@ -3,4 +3,4 @@ cx25840-objs := cx25840-core.o cx25840-audio.o cx25840-firmware.o \
3 3
4obj-$(CONFIG_VIDEO_CX25840) += cx25840.o 4obj-$(CONFIG_VIDEO_CX25840) += cx25840.o
5 5
6EXTRA_CFLAGS += -I$(src)/.. 6EXTRA_CFLAGS += -Idrivers/media/video
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 6482b9aa6a1f..0dcd09b9b727 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -8,9 +8,9 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o 8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
9obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o 9obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
10 10
11EXTRA_CFLAGS += -I$(src)/.. 11EXTRA_CFLAGS += -Idrivers/media/video
12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
13EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 13EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
14 14
15extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 15extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
16extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1 16extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1
diff --git a/drivers/media/video/em28xx/Makefile b/drivers/media/video/em28xx/Makefile
index da457a05b0dd..826d0e340753 100644
--- a/drivers/media/video/em28xx/Makefile
+++ b/drivers/media/video/em28xx/Makefile
@@ -3,4 +3,4 @@ em28xx-objs := em28xx-video.o em28xx-i2c.o em28xx-cards.o em28xx-core.o \
3 3
4obj-$(CONFIG_VIDEO_EM28XX) += em28xx.o 4obj-$(CONFIG_VIDEO_EM28XX) += em28xx.o
5 5
6EXTRA_CFLAGS += -I$(src)/.. 6EXTRA_CFLAGS += -Idrivers/media/video
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index 1ba998424bbd..be7b9ee697d6 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -11,9 +11,9 @@ obj-$(CONFIG_VIDEO_SAA7134_OSS) += saa7134-oss.o
11 11
12obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o 12obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
13 13
14EXTRA_CFLAGS += -I$(src)/.. 14EXTRA_CFLAGS += -Idrivers/media/video
15EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 15EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
16EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 16EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
17 17
18extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 18extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
19extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 19extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index c98571c9d5a6..13de05532e0a 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -32,6 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/dma-mapping.h>
35 36
36#include "saa7134-reg.h" 37#include "saa7134-reg.h"
37#include "saa7134.h" 38#include "saa7134.h"
@@ -870,7 +871,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
870 pci_name(pci_dev), dev->pci_rev, pci_dev->irq, 871 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
871 dev->pci_lat,pci_resource_start(pci_dev,0)); 872 dev->pci_lat,pci_resource_start(pci_dev,0));
872 pci_set_master(pci_dev); 873 pci_set_master(pci_dev);
873 if (!pci_dma_supported(pci_dev,0xffffffff)) { 874 if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) {
874 printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); 875 printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name);
875 err = -EIO; 876 err = -EIO;
876 goto fail1; 877 goto fail1;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 010d4a39269b..e9716b10acea 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -366,7 +366,15 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
366static int 366static int
367mptsas_slave_configure(struct scsi_device *sdev) 367mptsas_slave_configure(struct scsi_device *sdev)
368{ 368{
369 sas_read_port_mode_page(sdev); 369 struct Scsi_Host *host = sdev->host;
370 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
371
372 /*
373 * RAID volumes placed beyond the last expected port.
374 * Ignore sending sas mode pages in that case..
375 */
376 if (sdev->channel < hd->ioc->num_ports)
377 sas_read_port_mode_page(sdev);
370 378
371 return mptscsih_slave_configure(sdev); 379 return mptscsih_slave_configure(sdev);
372} 380}
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index dd628cb51e31..7fac438b5c32 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -129,8 +129,8 @@ config MTDRAM_ABS_POS
129 allocating space from Linux's available memory. Otherwise, leave 129 allocating space from Linux's available memory. Otherwise, leave
130 this set to zero. Most people will want to leave this as zero. 130 this set to zero. Most people will want to leave this as zero.
131 131
132config MTD_BLKMTD 132config MTD_BLOCK2MTD
133 tristate "MTD emulation using block device" 133 tristate "MTD using block device"
134 depends on MTD 134 depends on MTD
135 help 135 help
136 This driver allows a block device to appear as an MTD. It would 136 This driver allows a block device to appear as an MTD. It would
@@ -141,15 +141,6 @@ config MTD_BLKMTD
141 Testing MTD users (eg JFFS2) on large media and media that might 141 Testing MTD users (eg JFFS2) on large media and media that might
142 be removed during a write (using the floppy drive). 142 be removed during a write (using the floppy drive).
143 143
144config MTD_BLOCK2MTD
145 tristate "MTD using block device (rewrite)"
146 depends on MTD && EXPERIMENTAL
147 help
148 This driver is basically the same at MTD_BLKMTD above, but
149 experienced some interface changes plus serious speedups. In
150 the long term, it should replace MTD_BLKMTD. Right now, you
151 shouldn't entrust important data to it yet.
152
153comment "Disk-On-Chip Device Drivers" 144comment "Disk-On-Chip Device Drivers"
154 145
155config MTD_DOC2000 146config MTD_DOC2000
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
index 7c5ed2178380..b6573670316f 100644
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -21,7 +21,6 @@ obj-$(CONFIG_MTD_PMC551) += pmc551.o
21obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o 21obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o
22obj-$(CONFIG_MTD_MTDRAM) += mtdram.o 22obj-$(CONFIG_MTD_MTDRAM) += mtdram.o
23obj-$(CONFIG_MTD_LART) += lart.o 23obj-$(CONFIG_MTD_LART) += lart.o
24obj-$(CONFIG_MTD_BLKMTD) += blkmtd.o
25obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o 24obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
26obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o 25obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
27obj-$(CONFIG_MTD_M25P80) += m25p80.o 26obj-$(CONFIG_MTD_M25P80) += m25p80.o
diff --git a/drivers/mtd/devices/blkmtd.c b/drivers/mtd/devices/blkmtd.c
deleted file mode 100644
index 79f2e1f23ebd..000000000000
--- a/drivers/mtd/devices/blkmtd.c
+++ /dev/null
@@ -1,819 +0,0 @@
1/*
2 * $Id: blkmtd.c,v 1.27 2005/11/07 11:14:24 gleixner Exp $
3 *
4 * blkmtd.c - use a block device as a fake MTD
5 *
6 * Author: Simon Evans <spse@secret.org.uk>
7 *
8 * Copyright (C) 2001,2002 Simon Evans
9 *
10 * Licence: GPL
11 *
12 * How it works:
13 * The driver uses raw/io to read/write the device and the page
14 * cache to cache access. Writes update the page cache with the
15 * new data and mark it dirty and add the page into a BIO which
16 * is then written out.
17 *
18 * It can be loaded Read-Only to prevent erases and writes to the
19 * medium.
20 *
21 */
22
23#include <linux/config.h>
24#include <linux/module.h>
25#include <linux/fs.h>
26#include <linux/blkdev.h>
27#include <linux/bio.h>
28#include <linux/pagemap.h>
29#include <linux/list.h>
30#include <linux/init.h>
31#include <linux/mount.h>
32#include <linux/mtd/mtd.h>
33#include <linux/mutex.h>
34
35#define err(format, arg...) printk(KERN_ERR "blkmtd: " format "\n" , ## arg)
36#define info(format, arg...) printk(KERN_INFO "blkmtd: " format "\n" , ## arg)
37#define warn(format, arg...) printk(KERN_WARNING "blkmtd: " format "\n" , ## arg)
38#define crit(format, arg...) printk(KERN_CRIT "blkmtd: " format "\n" , ## arg)
39
40
41/* Default erase size in K, always make it a multiple of PAGE_SIZE */
42#define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10) /* 128KiB */
43#define VERSION "$Revision: 1.27 $"
44
45/* Info for the block device */
46struct blkmtd_dev {
47 struct list_head list;
48 struct block_device *blkdev;
49 struct mtd_info mtd_info;
50 struct mutex wrbuf_mutex;
51};
52
53
54/* Static info about the MTD, used in cleanup_module */
55static LIST_HEAD(blkmtd_device_list);
56
57
58static void blkmtd_sync(struct mtd_info *mtd);
59
60#define MAX_DEVICES 4
61
62/* Module parameters passed by insmod/modprobe */
63static char *device[MAX_DEVICES]; /* the block device to use */
64static int erasesz[MAX_DEVICES]; /* optional default erase size */
65static int ro[MAX_DEVICES]; /* optional read only flag */
66static int sync;
67
68
69MODULE_LICENSE("GPL");
70MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
71MODULE_DESCRIPTION("Emulate an MTD using a block device");
72module_param_array(device, charp, NULL, 0);
73MODULE_PARM_DESC(device, "block device to use");
74module_param_array(erasesz, int, NULL, 0);
75MODULE_PARM_DESC(erasesz, "optional erase size to use in KiB. eg 4=4KiB.");
76module_param_array(ro, bool, NULL, 0);
77MODULE_PARM_DESC(ro, "1=Read only, writes and erases cause errors");
78module_param(sync, bool, 0);
79MODULE_PARM_DESC(sync, "1=Synchronous writes");
80
81
82/* completion handler for BIO reads */
83static int bi_read_complete(struct bio *bio, unsigned int bytes_done, int error)
84{
85 if (bio->bi_size)
86 return 1;
87
88 complete((struct completion*)bio->bi_private);
89 return 0;
90}
91
92
93/* completion handler for BIO writes */
94static int bi_write_complete(struct bio *bio, unsigned int bytes_done, int error)
95{
96 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
97 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
98
99 if (bio->bi_size)
100 return 1;
101
102 if(!uptodate)
103 err("bi_write_complete: not uptodate\n");
104
105 do {
106 struct page *page = bvec->bv_page;
107 DEBUG(3, "Cleaning up page %ld\n", page->index);
108 if (--bvec >= bio->bi_io_vec)
109 prefetchw(&bvec->bv_page->flags);
110
111 if (uptodate) {
112 SetPageUptodate(page);
113 } else {
114 ClearPageUptodate(page);
115 SetPageError(page);
116 }
117 clear_page_dirty(page);
118 unlock_page(page);
119 page_cache_release(page);
120 } while (bvec >= bio->bi_io_vec);
121
122 complete((struct completion*)bio->bi_private);
123 return 0;
124}
125
126
127/* read one page from the block device */
128static int blkmtd_readpage(struct blkmtd_dev *dev, struct page *page)
129{
130 struct bio *bio;
131 struct completion event;
132 int err = -ENOMEM;
133
134 if(PageUptodate(page)) {
135 DEBUG(2, "blkmtd: readpage page %ld is already upto date\n", page->index);
136 unlock_page(page);
137 return 0;
138 }
139
140 ClearPageUptodate(page);
141 ClearPageError(page);
142
143 bio = bio_alloc(GFP_KERNEL, 1);
144 if(bio) {
145 init_completion(&event);
146 bio->bi_bdev = dev->blkdev;
147 bio->bi_sector = page->index << (PAGE_SHIFT-9);
148 bio->bi_private = &event;
149 bio->bi_end_io = bi_read_complete;
150 if(bio_add_page(bio, page, PAGE_SIZE, 0) == PAGE_SIZE) {
151 submit_bio(READ_SYNC, bio);
152 wait_for_completion(&event);
153 err = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : -EIO;
154 bio_put(bio);
155 }
156 }
157
158 if(err)
159 SetPageError(page);
160 else
161 SetPageUptodate(page);
162 flush_dcache_page(page);
163 unlock_page(page);
164 return err;
165}
166
167
168/* write out the current BIO and wait for it to finish */
169static int blkmtd_write_out(struct bio *bio)
170{
171 struct completion event;
172 int err;
173
174 if(!bio->bi_vcnt) {
175 bio_put(bio);
176 return 0;
177 }
178
179 init_completion(&event);
180 bio->bi_private = &event;
181 bio->bi_end_io = bi_write_complete;
182 submit_bio(WRITE_SYNC, bio);
183 wait_for_completion(&event);
184 DEBUG(3, "submit_bio completed, bi_vcnt = %d\n", bio->bi_vcnt);
185 err = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : -EIO;
186 bio_put(bio);
187 return err;
188}
189
190
191/**
192 * blkmtd_add_page - add a page to the current BIO
193 * @bio: bio to add to (NULL to alloc initial bio)
194 * @blkdev: block device
195 * @page: page to add
196 * @pagecnt: pages left to add
197 *
198 * Adds a page to the current bio, allocating it if necessary. If it cannot be
199 * added, the current bio is written out and a new one is allocated. Returns
200 * the new bio to add or NULL on error
201 */
202static struct bio *blkmtd_add_page(struct bio *bio, struct block_device *blkdev,
203 struct page *page, int pagecnt)
204{
205
206 retry:
207 if(!bio) {
208 bio = bio_alloc(GFP_KERNEL, pagecnt);
209 if(!bio)
210 return NULL;
211 bio->bi_sector = page->index << (PAGE_SHIFT-9);
212 bio->bi_bdev = blkdev;
213 }
214
215 if(bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) {
216 blkmtd_write_out(bio);
217 bio = NULL;
218 goto retry;
219 }
220 return bio;
221}
222
223
224/**
225 * write_pages - write block of data to device via the page cache
226 * @dev: device to write to
227 * @buf: data source or NULL if erase (output is set to 0xff)
228 * @to: offset into output device
229 * @len: amount to data to write
230 * @retlen: amount of data written
231 *
232 * Grab pages from the page cache and fill them with the source data.
233 * Non page aligned start and end result in a readin of the page and
234 * part of the page being modified. Pages are added to the bio and then written
235 * out.
236 */
237static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
238 size_t len, size_t *retlen)
239{
240 int pagenr, offset;
241 size_t start_len = 0, end_len;
242 int pagecnt = 0;
243 int err = 0;
244 struct bio *bio = NULL;
245 size_t thislen = 0;
246
247 pagenr = to >> PAGE_SHIFT;
248 offset = to & ~PAGE_MASK;
249
250 DEBUG(2, "blkmtd: write_pages: buf = %p to = %ld len = %zd pagenr = %d offset = %d\n",
251 buf, (long)to, len, pagenr, offset);
252
253 /* see if we have to do a partial write at the start */
254 if(offset) {
255 start_len = ((offset + len) > PAGE_SIZE) ? PAGE_SIZE - offset : len;
256 len -= start_len;
257 }
258
259 /* calculate the length of the other two regions */
260 end_len = len & ~PAGE_MASK;
261 len -= end_len;
262
263 if(start_len)
264 pagecnt++;
265
266 if(len)
267 pagecnt += len >> PAGE_SHIFT;
268
269 if(end_len)
270 pagecnt++;
271
272 mutex_lock(&dev->wrbuf_mutex);
273
274 DEBUG(3, "blkmtd: write: start_len = %zd len = %zd end_len = %zd pagecnt = %d\n",
275 start_len, len, end_len, pagecnt);
276
277 if(start_len) {
278 /* do partial start region */
279 struct page *page;
280
281 DEBUG(3, "blkmtd: write: doing partial start, page = %d len = %zd offset = %d\n",
282 pagenr, start_len, offset);
283
284 BUG_ON(!buf);
285 page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
286 lock_page(page);
287 if(PageDirty(page)) {
288 err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
289 to, start_len, len, end_len, pagenr);
290 BUG();
291 }
292 memcpy(page_address(page)+offset, buf, start_len);
293 set_page_dirty(page);
294 SetPageUptodate(page);
295 buf += start_len;
296 thislen = start_len;
297 bio = blkmtd_add_page(bio, dev->blkdev, page, pagecnt);
298 if(!bio) {
299 err = -ENOMEM;
300 err("bio_add_page failed\n");
301 goto write_err;
302 }
303 pagecnt--;
304 pagenr++;
305 }
306
307 /* Now do the main loop to a page aligned, n page sized output */
308 if(len) {
309 int pagesc = len >> PAGE_SHIFT;
310 DEBUG(3, "blkmtd: write: whole pages start = %d, count = %d\n",
311 pagenr, pagesc);
312 while(pagesc) {
313 struct page *page;
314
315 /* see if page is in the page cache */
316 DEBUG(3, "blkmtd: write: grabbing page %d from page cache\n", pagenr);
317 page = grab_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr);
318 if(PageDirty(page)) {
319 BUG();
320 }
321 if(!page) {
322 warn("write: cannot grab cache page %d", pagenr);
323 err = -ENOMEM;
324 goto write_err;
325 }
326 if(!buf) {
327 memset(page_address(page), 0xff, PAGE_SIZE);
328 } else {
329 memcpy(page_address(page), buf, PAGE_SIZE);
330 buf += PAGE_SIZE;
331 }
332 bio = blkmtd_add_page(bio, dev->blkdev, page, pagecnt);
333 if(!bio) {
334 err = -ENOMEM;
335 err("bio_add_page failed\n");
336 goto write_err;
337 }
338 pagenr++;
339 pagecnt--;
340 set_page_dirty(page);
341 SetPageUptodate(page);
342 pagesc--;
343 thislen += PAGE_SIZE;
344 }
345 }
346
347 if(end_len) {
348 /* do the third region */
349 struct page *page;
350 DEBUG(3, "blkmtd: write: doing partial end, page = %d len = %zd\n",
351 pagenr, end_len);
352 BUG_ON(!buf);
353 page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
354 lock_page(page);
355 if(PageDirty(page)) {
356 err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
357 to, start_len, len, end_len, pagenr);
358 BUG();
359 }
360 memcpy(page_address(page), buf, end_len);
361 set_page_dirty(page);
362 SetPageUptodate(page);
363 DEBUG(3, "blkmtd: write: writing out partial end\n");
364 thislen += end_len;
365 bio = blkmtd_add_page(bio, dev->blkdev, page, pagecnt);
366 if(!bio) {
367 err = -ENOMEM;
368 err("bio_add_page failed\n");
369 goto write_err;
370 }
371 pagenr++;
372 }
373
374 DEBUG(3, "blkmtd: write: got %d vectors to write\n", bio->bi_vcnt);
375 write_err:
376 if(bio)
377 blkmtd_write_out(bio);
378
379 DEBUG(2, "blkmtd: write: end, retlen = %zd, err = %d\n", *retlen, err);
380 mutex_unlock(&dev->wrbuf_mutex);
381
382 if(retlen)
383 *retlen = thislen;
384 return err;
385}
386
387
388/* erase a specified part of the device */
389static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
390{
391 struct blkmtd_dev *dev = mtd->priv;
392 struct mtd_erase_region_info *einfo = mtd->eraseregions;
393 int numregions = mtd->numeraseregions;
394 size_t from;
395 u_long len;
396 int err = -EIO;
397 size_t retlen;
398
399 instr->state = MTD_ERASING;
400 from = instr->addr;
401 len = instr->len;
402
403 /* check erase region has valid start and length */
404 DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%zx len = 0x%lx\n",
405 mtd->name+9, from, len);
406 while(numregions) {
407 DEBUG(3, "blkmtd: checking erase region = 0x%08X size = 0x%X num = 0x%x\n",
408 einfo->offset, einfo->erasesize, einfo->numblocks);
409 if(from >= einfo->offset
410 && from < einfo->offset + (einfo->erasesize * einfo->numblocks)) {
411 if(len == einfo->erasesize
412 && ( (from - einfo->offset) % einfo->erasesize == 0))
413 break;
414 }
415 numregions--;
416 einfo++;
417 }
418
419 if(!numregions) {
420 /* Not a valid erase block */
421 err("erase: invalid erase request 0x%lX @ 0x%08zX", len, from);
422 instr->state = MTD_ERASE_FAILED;
423 err = -EIO;
424 }
425
426 if(instr->state != MTD_ERASE_FAILED) {
427 /* do the erase */
428 DEBUG(3, "Doing erase from = %zd len = %ld\n", from, len);
429 err = write_pages(dev, NULL, from, len, &retlen);
430 if(err || retlen != len) {
431 err("erase failed err = %d", err);
432 instr->state = MTD_ERASE_FAILED;
433 } else {
434 instr->state = MTD_ERASE_DONE;
435 }
436 }
437
438 DEBUG(3, "blkmtd: erase: checking callback\n");
439 mtd_erase_callback(instr);
440 DEBUG(2, "blkmtd: erase: finished (err = %d)\n", err);
441 return err;
442}
443
444
445/* read a range of the data via the page cache */
446static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
447 size_t *retlen, u_char *buf)
448{
449 struct blkmtd_dev *dev = mtd->priv;
450 int err = 0;
451 int offset;
452 int pagenr, pages;
453 size_t thislen = 0;
454
455 DEBUG(2, "blkmtd: read: dev = `%s' from = %lld len = %zd buf = %p\n",
456 mtd->name+9, from, len, buf);
457
458 if(from > mtd->size)
459 return -EINVAL;
460 if(from + len > mtd->size)
461 len = mtd->size - from;
462
463 pagenr = from >> PAGE_SHIFT;
464 offset = from - (pagenr << PAGE_SHIFT);
465
466 pages = (offset+len+PAGE_SIZE-1) >> PAGE_SHIFT;
467 DEBUG(3, "blkmtd: read: pagenr = %d offset = %d, pages = %d\n",
468 pagenr, offset, pages);
469
470 while(pages) {
471 struct page *page;
472 int cpylen;
473
474 DEBUG(3, "blkmtd: read: looking for page: %d\n", pagenr);
475 page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
476 if(IS_ERR(page)) {
477 err = -EIO;
478 goto readerr;
479 }
480
481 cpylen = (PAGE_SIZE > len) ? len : PAGE_SIZE;
482 if(offset+cpylen > PAGE_SIZE)
483 cpylen = PAGE_SIZE-offset;
484
485 memcpy(buf + thislen, page_address(page) + offset, cpylen);
486 offset = 0;
487 len -= cpylen;
488 thislen += cpylen;
489 pagenr++;
490 pages--;
491 if(!PageDirty(page))
492 page_cache_release(page);
493 }
494
495 readerr:
496 if(retlen)
497 *retlen = thislen;
498 DEBUG(2, "blkmtd: end read: retlen = %zd, err = %d\n", thislen, err);
499 return err;
500}
501
502
503/* write data to the underlying device */
504static int blkmtd_write(struct mtd_info *mtd, loff_t to, size_t len,
505 size_t *retlen, const u_char *buf)
506{
507 struct blkmtd_dev *dev = mtd->priv;
508 int err;
509
510 if(!len)
511 return 0;
512
513 DEBUG(2, "blkmtd: write: dev = `%s' to = %lld len = %zd buf = %p\n",
514 mtd->name+9, to, len, buf);
515
516 if(to >= mtd->size) {
517 return -ENOSPC;
518 }
519
520 if(to + len > mtd->size) {
521 len = mtd->size - to;
522 }
523
524 err = write_pages(dev, buf, to, len, retlen);
525 if(err > 0)
526 err = 0;
527 DEBUG(2, "blkmtd: write: end, err = %d\n", err);
528 return err;
529}
530
531
532/* sync the device - wait until the write queue is empty */
533static void blkmtd_sync(struct mtd_info *mtd)
534{
535 /* Currently all writes are synchronous */
536}
537
538
539static void free_device(struct blkmtd_dev *dev)
540{
541 DEBUG(2, "blkmtd: free_device() dev = %p\n", dev);
542 if(dev) {
543 kfree(dev->mtd_info.eraseregions);
544 kfree(dev->mtd_info.name);
545 if(dev->blkdev) {
546 invalidate_inode_pages(dev->blkdev->bd_inode->i_mapping);
547 close_bdev_excl(dev->blkdev);
548 }
549 kfree(dev);
550 }
551}
552
553
554/* For a given size and initial erase size, calculate the number
555 * and size of each erase region. Goes round the loop twice,
556 * once to find out how many regions, then allocates space,
557 * then round the loop again to fill it in.
558 */
559static struct mtd_erase_region_info *calc_erase_regions(
560 size_t erase_size, size_t total_size, int *regions)
561{
562 struct mtd_erase_region_info *info = NULL;
563
564 DEBUG(2, "calc_erase_regions, es = %zd size = %zd regions = %d\n",
565 erase_size, total_size, *regions);
566 /* Make any user specified erasesize be a power of 2
567 and at least PAGE_SIZE */
568 if(erase_size) {
569 int es = erase_size;
570 erase_size = 1;
571 while(es != 1) {
572 es >>= 1;
573 erase_size <<= 1;
574 }
575 if(erase_size < PAGE_SIZE)
576 erase_size = PAGE_SIZE;
577 } else {
578 erase_size = CONFIG_MTD_BLKDEV_ERASESIZE;
579 }
580
581 *regions = 0;
582
583 do {
584 int tot_size = total_size;
585 int er_size = erase_size;
586 int count = 0, offset = 0, regcnt = 0;
587
588 while(tot_size) {
589 count = tot_size / er_size;
590 if(count) {
591 tot_size = tot_size % er_size;
592 if(info) {
593 DEBUG(2, "adding to erase info off=%d er=%d cnt=%d\n",
594 offset, er_size, count);
595 (info+regcnt)->offset = offset;
596 (info+regcnt)->erasesize = er_size;
597 (info+regcnt)->numblocks = count;
598 (*regions)++;
599 }
600 regcnt++;
601 offset += (count * er_size);
602 }
603 while(er_size > tot_size)
604 er_size >>= 1;
605 }
606 if(info == NULL) {
607 info = kmalloc(regcnt * sizeof(struct mtd_erase_region_info), GFP_KERNEL);
608 if(!info)
609 break;
610 }
611 } while(!(*regions));
612 DEBUG(2, "calc_erase_regions done, es = %zd size = %zd regions = %d\n",
613 erase_size, total_size, *regions);
614 return info;
615}
616
617
618static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size)
619{
620 struct block_device *bdev;
621 int mode;
622 struct blkmtd_dev *dev;
623
624 if(!devname)
625 return NULL;
626
627 /* Get a handle on the device */
628
629
630#ifdef MODULE
631 mode = (readonly) ? O_RDONLY : O_RDWR;
632 bdev = open_bdev_excl(devname, mode, NULL);
633#else
634 mode = (readonly) ? FMODE_READ : FMODE_WRITE;
635 bdev = open_by_devnum(name_to_dev_t(devname), mode);
636#endif
637 if(IS_ERR(bdev)) {
638 err("error: cannot open device %s", devname);
639 DEBUG(2, "blkmtd: opening bdev returned %ld\n", PTR_ERR(bdev));
640 return NULL;
641 }
642
643 DEBUG(1, "blkmtd: found a block device major = %d, minor = %d\n",
644 MAJOR(bdev->bd_dev), MINOR(bdev->bd_dev));
645
646 if(MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
647 err("attempting to use an MTD device as a block device");
648 blkdev_put(bdev);
649 return NULL;
650 }
651
652 dev = kmalloc(sizeof(struct blkmtd_dev), GFP_KERNEL);
653 if(dev == NULL) {
654 blkdev_put(bdev);
655 return NULL;
656 }
657
658 memset(dev, 0, sizeof(struct blkmtd_dev));
659 dev->blkdev = bdev;
660 if(!readonly) {
661 mutex_init(&dev->wrbuf_mutex);
662 }
663
664 dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
665
666 /* Setup the MTD structure */
667 /* make the name contain the block device in */
668 dev->mtd_info.name = kmalloc(sizeof("blkmtd: ") + strlen(devname), GFP_KERNEL);
669 if(dev->mtd_info.name == NULL)
670 goto devinit_err;
671
672 sprintf(dev->mtd_info.name, "blkmtd: %s", devname);
673 dev->mtd_info.eraseregions = calc_erase_regions(erase_size, dev->mtd_info.size,
674 &dev->mtd_info.numeraseregions);
675 if(dev->mtd_info.eraseregions == NULL)
676 goto devinit_err;
677
678 dev->mtd_info.erasesize = dev->mtd_info.eraseregions->erasesize;
679 DEBUG(1, "blkmtd: init: found %d erase regions\n",
680 dev->mtd_info.numeraseregions);
681
682 if(readonly) {
683 dev->mtd_info.type = MTD_ROM;
684 dev->mtd_info.flags = MTD_CAP_ROM;
685 } else {
686 dev->mtd_info.type = MTD_RAM;
687 dev->mtd_info.flags = MTD_CAP_RAM;
688 dev->mtd_info.erase = blkmtd_erase;
689 dev->mtd_info.write = blkmtd_write;
690 dev->mtd_info.writev = default_mtd_writev;
691 dev->mtd_info.sync = blkmtd_sync;
692 }
693 dev->mtd_info.read = blkmtd_read;
694 dev->mtd_info.readv = default_mtd_readv;
695 dev->mtd_info.priv = dev;
696 dev->mtd_info.owner = THIS_MODULE;
697
698 list_add(&dev->list, &blkmtd_device_list);
699 if (add_mtd_device(&dev->mtd_info)) {
700 /* Device didnt get added, so free the entry */
701 list_del(&dev->list);
702 goto devinit_err;
703 } else {
704 info("mtd%d: [%s] erase_size = %dKiB %s",
705 dev->mtd_info.index, dev->mtd_info.name + strlen("blkmtd: "),
706 dev->mtd_info.erasesize >> 10,
707 readonly ? "(read-only)" : "");
708 }
709
710 return dev;
711
712 devinit_err:
713 free_device(dev);
714 return NULL;
715}
716
717
718/* Cleanup and exit - sync the device and kill of the kernel thread */
719static void __devexit cleanup_blkmtd(void)
720{
721 struct list_head *temp1, *temp2;
722
723 /* Remove the MTD devices */
724 list_for_each_safe(temp1, temp2, &blkmtd_device_list) {
725 struct blkmtd_dev *dev = list_entry(temp1, struct blkmtd_dev,
726 list);
727 blkmtd_sync(&dev->mtd_info);
728 del_mtd_device(&dev->mtd_info);
729 info("mtd%d: [%s] removed", dev->mtd_info.index,
730 dev->mtd_info.name + strlen("blkmtd: "));
731 list_del(&dev->list);
732 free_device(dev);
733 }
734}
735
736#ifndef MODULE
737
738/* Handle kernel boot params */
739
740
741static int __init param_blkmtd_device(char *str)
742{
743 int i;
744
745 for(i = 0; i < MAX_DEVICES; i++) {
746 device[i] = str;
747 DEBUG(2, "blkmtd: device setup: %d = %s\n", i, device[i]);
748 strsep(&str, ",");
749 }
750 return 1;
751}
752
753
754static int __init param_blkmtd_erasesz(char *str)
755{
756 int i;
757 for(i = 0; i < MAX_DEVICES; i++) {
758 char *val = strsep(&str, ",");
759 if(val)
760 erasesz[i] = simple_strtoul(val, NULL, 0);
761 DEBUG(2, "blkmtd: erasesz setup: %d = %d\n", i, erasesz[i]);
762 }
763
764 return 1;
765}
766
767
768static int __init param_blkmtd_ro(char *str)
769{
770 int i;
771 for(i = 0; i < MAX_DEVICES; i++) {
772 char *val = strsep(&str, ",");
773 if(val)
774 ro[i] = simple_strtoul(val, NULL, 0);
775 DEBUG(2, "blkmtd: ro setup: %d = %d\n", i, ro[i]);
776 }
777
778 return 1;
779}
780
781
782static int __init param_blkmtd_sync(char *str)
783{
784 if(str[0] == '1')
785 sync = 1;
786 return 1;
787}
788
789__setup("blkmtd_device=", param_blkmtd_device);
790__setup("blkmtd_erasesz=", param_blkmtd_erasesz);
791__setup("blkmtd_ro=", param_blkmtd_ro);
792__setup("blkmtd_sync=", param_blkmtd_sync);
793
794#endif
795
796
797/* Startup */
798static int __init init_blkmtd(void)
799{
800 int i;
801
802 info("version " VERSION);
803 /* Check args - device[0] is the bare minimum*/
804 if(!device[0]) {
805 err("error: missing `device' name\n");
806 return -EINVAL;
807 }
808
809 for(i = 0; i < MAX_DEVICES; i++)
810 add_device(device[i], ro[i], erasesz[i] << 10);
811
812 if(list_empty(&blkmtd_device_list))
813 return -EINVAL;
814
815 return 0;
816}
817
818module_init(init_blkmtd);
819module_exit(cleanup_blkmtd);
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index c4e12b5cbb92..3d306681919e 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright (C) 2002 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
4 * Fixed by Pekka Pietikainen (pp@ee.oulu.fi) 4 * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
5 * Copyright (C) 2006 Broadcom Corporation.
5 * 6 *
6 * Distribute under GPL. 7 * Distribute under GPL.
7 */ 8 */
@@ -28,8 +29,8 @@
28 29
29#define DRV_MODULE_NAME "b44" 30#define DRV_MODULE_NAME "b44"
30#define PFX DRV_MODULE_NAME ": " 31#define PFX DRV_MODULE_NAME ": "
31#define DRV_MODULE_VERSION "0.97" 32#define DRV_MODULE_VERSION "1.00"
32#define DRV_MODULE_RELDATE "Nov 30, 2005" 33#define DRV_MODULE_RELDATE "Apr 7, 2006"
33 34
34#define B44_DEF_MSG_ENABLE \ 35#define B44_DEF_MSG_ENABLE \
35 (NETIF_MSG_DRV | \ 36 (NETIF_MSG_DRV | \
@@ -136,7 +137,7 @@ static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
136 return readl(bp->regs + reg); 137 return readl(bp->regs + reg);
137} 138}
138 139
139static inline void bw32(const struct b44 *bp, 140static inline void bw32(const struct b44 *bp,
140 unsigned long reg, unsigned long val) 141 unsigned long reg, unsigned long val)
141{ 142{
142 writel(val, bp->regs + reg); 143 writel(val, bp->regs + reg);
@@ -286,13 +287,13 @@ static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
286 val |= ((u32) data[4]) << 8; 287 val |= ((u32) data[4]) << 8;
287 val |= ((u32) data[5]) << 0; 288 val |= ((u32) data[5]) << 0;
288 bw32(bp, B44_CAM_DATA_LO, val); 289 bw32(bp, B44_CAM_DATA_LO, val);
289 val = (CAM_DATA_HI_VALID | 290 val = (CAM_DATA_HI_VALID |
290 (((u32) data[0]) << 8) | 291 (((u32) data[0]) << 8) |
291 (((u32) data[1]) << 0)); 292 (((u32) data[1]) << 0));
292 bw32(bp, B44_CAM_DATA_HI, val); 293 bw32(bp, B44_CAM_DATA_HI, val);
293 bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE | 294 bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
294 (index << CAM_CTRL_INDEX_SHIFT))); 295 (index << CAM_CTRL_INDEX_SHIFT)));
295 b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1); 296 b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
296} 297}
297 298
298static inline void __b44_disable_ints(struct b44 *bp) 299static inline void __b44_disable_ints(struct b44 *bp)
@@ -410,25 +411,18 @@ static void __b44_set_flow_ctrl(struct b44 *bp, u32 pause_flags)
410 411
411static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) 412static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
412{ 413{
413 u32 pause_enab = bp->flags & (B44_FLAG_TX_PAUSE | 414 u32 pause_enab = 0;
414 B44_FLAG_RX_PAUSE);
415 415
416 if (local & ADVERTISE_PAUSE_CAP) { 416 /* The driver supports only rx pause by default because
417 if (local & ADVERTISE_PAUSE_ASYM) { 417 the b44 mac tx pause mechanism generates excessive
418 if (remote & LPA_PAUSE_CAP) 418 pause frames.
419 pause_enab |= (B44_FLAG_TX_PAUSE | 419 Use ethtool to turn on b44 tx pause if necessary.
420 B44_FLAG_RX_PAUSE); 420 */
421 else if (remote & LPA_PAUSE_ASYM) 421 if ((local & ADVERTISE_PAUSE_CAP) &&
422 pause_enab |= B44_FLAG_RX_PAUSE; 422 (local & ADVERTISE_PAUSE_ASYM)){
423 } else { 423 if ((remote & LPA_PAUSE_ASYM) &&
424 if (remote & LPA_PAUSE_CAP) 424 !(remote & LPA_PAUSE_CAP))
425 pause_enab |= (B44_FLAG_TX_PAUSE | 425 pause_enab |= B44_FLAG_RX_PAUSE;
426 B44_FLAG_RX_PAUSE);
427 }
428 } else if (local & ADVERTISE_PAUSE_ASYM) {
429 if ((remote & LPA_PAUSE_CAP) &&
430 (remote & LPA_PAUSE_ASYM))
431 pause_enab |= B44_FLAG_TX_PAUSE;
432 } 426 }
433 427
434 __b44_set_flow_ctrl(bp, pause_enab); 428 __b44_set_flow_ctrl(bp, pause_enab);
@@ -1063,7 +1057,7 @@ static int b44_change_mtu(struct net_device *dev, int new_mtu)
1063 spin_unlock_irq(&bp->lock); 1057 spin_unlock_irq(&bp->lock);
1064 1058
1065 b44_enable_ints(bp); 1059 b44_enable_ints(bp);
1066 1060
1067 return 0; 1061 return 0;
1068} 1062}
1069 1063
@@ -1381,7 +1375,7 @@ static void b44_init_hw(struct b44 *bp)
1381 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); 1375 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
1382 1376
1383 bw32(bp, B44_DMARX_PTR, bp->rx_pending); 1377 bw32(bp, B44_DMARX_PTR, bp->rx_pending);
1384 bp->rx_prod = bp->rx_pending; 1378 bp->rx_prod = bp->rx_pending;
1385 1379
1386 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); 1380 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
1387 1381
@@ -1553,9 +1547,9 @@ static void __b44_set_rx_mode(struct net_device *dev)
1553 val |= RXCONFIG_ALLMULTI; 1547 val |= RXCONFIG_ALLMULTI;
1554 else 1548 else
1555 i = __b44_load_mcast(bp, dev); 1549 i = __b44_load_mcast(bp, dev);
1556 1550
1557 for (; i < 64; i++) { 1551 for (; i < 64; i++) {
1558 __b44_cam_write(bp, zero, i); 1552 __b44_cam_write(bp, zero, i);
1559 } 1553 }
1560 bw32(bp, B44_RXCONFIG, val); 1554 bw32(bp, B44_RXCONFIG, val);
1561 val = br32(bp, B44_CAM_CTRL); 1555 val = br32(bp, B44_CAM_CTRL);
@@ -1737,7 +1731,7 @@ static int b44_set_ringparam(struct net_device *dev,
1737 spin_unlock_irq(&bp->lock); 1731 spin_unlock_irq(&bp->lock);
1738 1732
1739 b44_enable_ints(bp); 1733 b44_enable_ints(bp);
1740 1734
1741 return 0; 1735 return 0;
1742} 1736}
1743 1737
@@ -1782,7 +1776,7 @@ static int b44_set_pauseparam(struct net_device *dev,
1782 spin_unlock_irq(&bp->lock); 1776 spin_unlock_irq(&bp->lock);
1783 1777
1784 b44_enable_ints(bp); 1778 b44_enable_ints(bp);
1785 1779
1786 return 0; 1780 return 0;
1787} 1781}
1788 1782
@@ -1898,7 +1892,7 @@ static int __devinit b44_get_invariants(struct b44 *bp)
1898 bp->core_unit = ssb_core_unit(bp); 1892 bp->core_unit = ssb_core_unit(bp);
1899 bp->dma_offset = SB_PCI_DMA; 1893 bp->dma_offset = SB_PCI_DMA;
1900 1894
1901 /* XXX - really required? 1895 /* XXX - really required?
1902 bp->flags |= B44_FLAG_BUGGY_TXPTR; 1896 bp->flags |= B44_FLAG_BUGGY_TXPTR;
1903 */ 1897 */
1904out: 1898out:
@@ -1946,7 +1940,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
1946 "aborting.\n"); 1940 "aborting.\n");
1947 goto err_out_free_res; 1941 goto err_out_free_res;
1948 } 1942 }
1949 1943
1950 err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); 1944 err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
1951 if (err) { 1945 if (err) {
1952 printk(KERN_ERR PFX "No usable DMA configuration, " 1946 printk(KERN_ERR PFX "No usable DMA configuration, "
@@ -2041,9 +2035,9 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
2041 2035
2042 pci_save_state(bp->pdev); 2036 pci_save_state(bp->pdev);
2043 2037
2044 /* Chip reset provides power to the b44 MAC & PCI cores, which 2038 /* Chip reset provides power to the b44 MAC & PCI cores, which
2045 * is necessary for MAC register access. 2039 * is necessary for MAC register access.
2046 */ 2040 */
2047 b44_chip_reset(bp); 2041 b44_chip_reset(bp);
2048 2042
2049 printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name); 2043 printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
@@ -2091,10 +2085,10 @@ static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
2091 2085
2092 del_timer_sync(&bp->timer); 2086 del_timer_sync(&bp->timer);
2093 2087
2094 spin_lock_irq(&bp->lock); 2088 spin_lock_irq(&bp->lock);
2095 2089
2096 b44_halt(bp); 2090 b44_halt(bp);
2097 netif_carrier_off(bp->dev); 2091 netif_carrier_off(bp->dev);
2098 netif_device_detach(bp->dev); 2092 netif_device_detach(bp->dev);
2099 b44_free_rings(bp); 2093 b44_free_rings(bp);
2100 2094
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 2671da20a496..5ca99e26660a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -63,7 +63,7 @@
63/* Time in jiffies before concluding the transmitter is hung. */ 63/* Time in jiffies before concluding the transmitter is hung. */
64#define TX_TIMEOUT (5*HZ) 64#define TX_TIMEOUT (5*HZ)
65 65
66static char version[] __devinitdata = 66static const char version[] __devinitdata =
67 "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 67 "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
68 68
69MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>"); 69MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>");
diff --git a/drivers/net/chelsio/Makefile b/drivers/net/chelsio/Makefile
index 91e927827c43..54c78d94f48b 100644
--- a/drivers/net/chelsio/Makefile
+++ b/drivers/net/chelsio/Makefile
@@ -4,7 +4,7 @@
4 4
5obj-$(CONFIG_CHELSIO_T1) += cxgb.o 5obj-$(CONFIG_CHELSIO_T1) += cxgb.o
6 6
7EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/chelsio $(DEBUG_FLAGS) 7EXTRA_CFLAGS += -Idrivers/net/chelsio $(DEBUG_FLAGS)
8 8
9 9
10cxgb-objs := cxgb2.o espi.o pm3393.o sge.o subr.o mv88x201x.o 10cxgb-objs := cxgb2.o espi.o pm3393.o sge.o subr.o mv88x201x.o
diff --git a/drivers/net/hydra.h b/drivers/net/hydra.h
deleted file mode 100644
index 37414146258d..000000000000
--- a/drivers/net/hydra.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/* $Linux: hydra.h,v 1.0 1994/10/26 02:03:47 cgd Exp $ */
2
3/*
4 * Copyright (c) 1994 Timo Rossi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Timo Rossi
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * The Hydra Systems card uses the National Semiconductor
35 * 8390 NIC (Network Interface Controller) chip, located
36 * at card base address + 0xffe1. NIC registers are accessible
37 * only at odd byte addresses, so the register offsets must
38 * be multiplied by two.
39 *
40 * Card address PROM is located at card base + 0xffc0 (even byte addresses)
41 *
42 * RAM starts at the card base address, and is 16K or 64K.
43 * The current Amiga NetBSD hydra driver is hardwired for 16K.
44 * It seems that the RAM should be accessed as words or longwords only.
45 *
46 */
47
48/* adapted for Linux by Topi Kanerva 03/29/95
49 with original author's permission */
50
51#define HYDRA_NIC_BASE 0xffe1
52
53/* Page0 registers */
54
55#define NIC_CR 0 /* Command register */
56#define NIC_PSTART (1*2) /* Page start (write) */
57#define NIC_PSTOP (2*2) /* Page stop (write) */
58#define NIC_BNDRY (3*2) /* Boundary pointer */
59#define NIC_TSR (4*2) /* Transmit status (read) */
60#define NIC_TPSR (4*2) /* Transmit page start (write) */
61#define NIC_NCR (5*2) /* Number of collisions, read */
62#define NIC_TBCR0 (5*2) /* Transmit byte count low (write) */
63#define NIC_FIFO (6*2) /* FIFO reg. (read) */
64#define NIC_TBCR1 (6*2) /* Transmit byte count high (write) */
65#define NIC_ISR (7*2) /* Interrupt status register */
66#define NIC_RBCR0 (0xa*2) /* Remote byte count low (write) */
67#define NIC_RBCR1 (0xb*2) /* Remote byte count high (write) */
68#define NIC_RSR (0xc*2) /* Receive status (read) */
69#define NIC_RCR (0xc*2) /* Receive config (write) */
70#define NIC_CNTR0 (0xd*2) /* Frame alignment error count (read) */
71#define NIC_TCR (0xd*2) /* Transmit config (write) */
72#define NIC_CNTR1 (0xe*2) /* CRC error counter (read) */
73#define NIC_DCR (0xe*2) /* Data config (write) */
74#define NIC_CNTR2 (0xf*2) /* missed packet counter (read) */
75#define NIC_IMR (0xf*2) /* Interrupt mask reg. (write) */
76
77/* Page1 registers */
78
79#define NIC_PAR0 (1*2) /* Physical address */
80#define NIC_PAR1 (2*2)
81#define NIC_PAR2 (3*2)
82#define NIC_PAR3 (4*2)
83#define NIC_PAR4 (5*2)
84#define NIC_PAR5 (6*2)
85#define NIC_CURR (7*2) /* Current RX ring-buffer page */
86#define NIC_MAR0 (8*2) /* Multicast address */
87#define NIC_MAR1 (9*2)
88#define NIC_MAR2 (0xa*2)
89#define NIC_MAR3 (0xb*2)
90#define NIC_MAR4 (0xc*2)
91#define NIC_MAR5 (0xd*2)
92#define NIC_MAR6 (0xe*2)
93#define NIC_MAR7 (0xf*2)
94
95/* Command register definitions */
96
97#define CR_STOP 0x01 /* Stop -- software reset command */
98#define CR_START 0x02 /* Start */
99#define CR_TXP 0x04 /* Transmit packet */
100
101#define CR_RD0 0x08 /* Remote DMA cmd */
102#define CR_RD1 0x10
103#define CR_RD2 0x20
104
105#define CR_NODMA CR_RD2
106
107#define CR_PS0 0x40 /* Page select */
108#define CR_PS1 0x80
109
110#define CR_PAGE0 0
111#define CR_PAGE1 CR_PS0
112#define CR_PAGE2 CR_PS1
113
114/* Interrupt status reg. definitions */
115
116#define ISR_PRX 0x01 /* Packet received without errors */
117#define ISR_PTX 0x02 /* Packet transmitted without errors */
118#define ISR_RXE 0x04 /* Receive error */
119#define ISR_TXE 0x08 /* Transmit error */
120#define ISR_OVW 0x10 /* Ring buffer overrun */
121#define ISR_CNT 0x20 /* Counter overflow */
122#define ISR_RDC 0x40 /* Remote DMA compile */
123#define ISR_RST 0x80 /* Reset status */
124
125/* Data config reg. definitions */
126
127#define DCR_WTS 0x01 /* Word transfer select */
128#define DCR_BOS 0x02 /* Byte order select */
129#define DCR_LAS 0x04 /* Long address select */
130#define DCR_LS 0x08 /* Loopback select */
131#define DCR_AR 0x10 /* Auto-init remote */
132#define DCR_FT0 0x20 /* FIFO threshold select */
133#define DCR_FT1 0x40
134
135/* Transmit config reg. definitions */
136
137#define TCR_CRC 0x01 /* Inhibit CRC */
138#define TCR_LB0 0x02 /* Loopback control */
139#define TCR_LB1 0x04
140#define TCR_ATD 0x08 /* Auto transmit disable */
141#define TCR_OFST 0x10 /* Collision offset enable */
142
143/* Transmit status reg. definitions */
144
145#define TSR_PTX 0x01 /* Packet transmitted */
146#define TSR_COL 0x04 /* Transmit collided */
147#define TSR_ABT 0x08 /* Transmit aborted */
148#define TSR_CRS 0x10 /* Carrier sense lost */
149#define TSR_FU 0x20 /* FIFO underrun */
150#define TSR_CDH 0x40 /* CD Heartbeat */
151#define TSR_OWC 0x80 /* Out of Window Collision */
152
153/* Receiver config register definitions */
154
155#define RCR_SEP 0x01 /* Save errored packets */
156#define RCR_AR 0x02 /* Accept runt packets */
157#define RCR_AB 0x04 /* Accept broadcast */
158#define RCR_AM 0x08 /* Accept multicast */
159#define RCR_PRO 0x10 /* Promiscuous mode */
160#define RCR_MON 0x20 /* Monitor mode */
161
162/* Receiver status register definitions */
163
164#define RSR_PRX 0x01 /* Packet received without error */
165#define RSR_CRC 0x02 /* CRC error */
166#define RSR_FAE 0x04 /* Frame alignment error */
167#define RSR_FO 0x08 /* FIFO overrun */
168#define RSR_MPA 0x10 /* Missed packet */
169#define RSR_PHY 0x20 /* Physical address */
170#define RSR_DIS 0x40 /* Received disabled */
171#define RSR_DFR 0x80 /* Deferring (jabber) */
172
173/* Hydra System card address PROM offset */
174
175#define HYDRA_ADDRPROM 0xffc0
176
177
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 6e2ec56cde0b..96bdb73c2283 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 * 2 *
3 * Filename: irda-usb.c 3 * Filename: irda-usb.c
4 * Version: 0.9b 4 * Version: 0.10
5 * Description: IrDA-USB Driver 5 * Description: IrDA-USB Driver
6 * Status: Experimental 6 * Status: Experimental
7 * Author: Dag Brattli <dag@brattli.net> 7 * Author: Dag Brattli <dag@brattli.net>
@@ -9,6 +9,9 @@
9 * Copyright (C) 2000, Roman Weissgaerber <weissg@vienna.at> 9 * Copyright (C) 2000, Roman Weissgaerber <weissg@vienna.at>
10 * Copyright (C) 2001, Dag Brattli <dag@brattli.net> 10 * Copyright (C) 2001, Dag Brattli <dag@brattli.net>
11 * Copyright (C) 2001, Jean Tourrilhes <jt@hpl.hp.com> 11 * Copyright (C) 2001, Jean Tourrilhes <jt@hpl.hp.com>
12 * Copyright (C) 2004, SigmaTel, Inc. <irquality@sigmatel.com>
13 * Copyright (C) 2005, Milan Beno <beno@pobox.sk>
14 * Copyright (C) 2006, Nick Fedchik <nick@fedchik.org.ua>
12 * 15 *
13 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
@@ -61,6 +64,7 @@
61#include <linux/slab.h> 64#include <linux/slab.h>
62#include <linux/rtnetlink.h> 65#include <linux/rtnetlink.h>
63#include <linux/usb.h> 66#include <linux/usb.h>
67#include <linux/firmware.h>
64 68
65#include "irda-usb.h" 69#include "irda-usb.h"
66 70
@@ -78,8 +82,12 @@ static struct usb_device_id dongles[] = {
78 { USB_DEVICE(0x50f, 0x180), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW }, 82 { USB_DEVICE(0x50f, 0x180), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
79 /* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */ 83 /* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */
80 { USB_DEVICE(0x8e9, 0x100), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW }, 84 { USB_DEVICE(0x8e9, 0x100), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
85 /* SigmaTel STIR4210/4220/4116 USB IrDA (VFIR) Bridge */
86 { USB_DEVICE(0x66f, 0x4210), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
87 { USB_DEVICE(0x66f, 0x4220), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
88 { USB_DEVICE(0x66f, 0x4116), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
81 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | 89 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
82 USB_DEVICE_ID_MATCH_INT_SUBCLASS, 90 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
83 .bInterfaceClass = USB_CLASS_APP_SPEC, 91 .bInterfaceClass = USB_CLASS_APP_SPEC,
84 .bInterfaceSubClass = USB_CLASS_IRDA, 92 .bInterfaceSubClass = USB_CLASS_IRDA,
85 .driver_info = IUC_DEFAULT, }, 93 .driver_info = IUC_DEFAULT, },
@@ -99,6 +107,7 @@ MODULE_DEVICE_TABLE(usb, dongles);
99 107
100/*------------------------------------------------------------------*/ 108/*------------------------------------------------------------------*/
101 109
110static void irda_usb_init_qos(struct irda_usb_cb *self) ;
102static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf); 111static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf);
103static void irda_usb_disconnect(struct usb_interface *intf); 112static void irda_usb_disconnect(struct usb_interface *intf);
104static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self); 113static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
@@ -141,7 +150,24 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
141 __u8 *header, 150 __u8 *header,
142 int force) 151 int force)
143{ 152{
144 /* Set the negotiated link speed */ 153 /* Here we check if we have an STIR421x chip,
154 * and if either speed or xbofs (or both) needs
155 * to be changed.
156 */
157 if (self->capability & IUC_STIR_4210 &&
158 ((self->new_speed != -1) || (self->new_xbofs != -1))) {
159
160 /* With STIR421x, speed and xBOFs must be set at the same
161 * time, even if only one of them changes.
162 */
163 if (self->new_speed == -1)
164 self->new_speed = self->speed ;
165
166 if (self->new_xbofs == -1)
167 self->new_xbofs = self->xbofs ;
168 }
169
170 /* Set the link speed */
145 if (self->new_speed != -1) { 171 if (self->new_speed != -1) {
146 /* Hum... Ugly hack :-( 172 /* Hum... Ugly hack :-(
147 * Some device are not compliant with the spec and change 173 * Some device are not compliant with the spec and change
@@ -191,7 +217,11 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
191 *header = SPEED_4000000; 217 *header = SPEED_4000000;
192 self->new_xbofs = 0; 218 self->new_xbofs = 0;
193 break; 219 break;
194 } 220 case 16000000:
221 *header = SPEED_16000000;
222 self->new_xbofs = 0;
223 break;
224 }
195 } else 225 } else
196 /* No change */ 226 /* No change */
197 *header = 0; 227 *header = 0;
@@ -235,6 +265,32 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
235 } 265 }
236} 266}
237 267
268/*
269* calculate turnaround time for SigmaTel header
270*/
271static __u8 get_turnaround_time(struct sk_buff *skb)
272{
273 int turnaround_time = irda_get_mtt(skb);
274
275 if ( turnaround_time == 0 )
276 return 0;
277 else if ( turnaround_time <= 10 )
278 return 1;
279 else if ( turnaround_time <= 50 )
280 return 2;
281 else if ( turnaround_time <= 100 )
282 return 3;
283 else if ( turnaround_time <= 500 )
284 return 4;
285 else if ( turnaround_time <= 1000 )
286 return 5;
287 else if ( turnaround_time <= 5000 )
288 return 6;
289 else
290 return 7;
291}
292
293
238/*------------------------------------------------------------------*/ 294/*------------------------------------------------------------------*/
239/* 295/*
240 * Send a command to change the speed of the dongle 296 * Send a command to change the speed of the dongle
@@ -262,12 +318,18 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
262 /* Set the new speed and xbofs in this fake frame */ 318 /* Set the new speed and xbofs in this fake frame */
263 irda_usb_build_header(self, frame, 1); 319 irda_usb_build_header(self, frame, 1);
264 320
321 if ( self->capability & IUC_STIR_4210 ) {
322 if (frame[0] == 0) return ; // do nothing if no change
323 frame[1] = 0; // other parameters don't change here
324 frame[2] = 0;
325 }
326
265 /* Submit the 0 length IrDA frame to trigger new speed settings */ 327 /* Submit the 0 length IrDA frame to trigger new speed settings */
266 usb_fill_bulk_urb(urb, self->usbdev, 328 usb_fill_bulk_urb(urb, self->usbdev,
267 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), 329 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
268 frame, IRDA_USB_SPEED_MTU, 330 frame, IRDA_USB_SPEED_MTU,
269 speed_bulk_callback, self); 331 speed_bulk_callback, self);
270 urb->transfer_buffer_length = USB_IRDA_HEADER; 332 urb->transfer_buffer_length = self->header_length;
271 urb->transfer_flags = 0; 333 urb->transfer_flags = 0;
272 334
273 /* Irq disabled -> GFP_ATOMIC */ 335 /* Irq disabled -> GFP_ATOMIC */
@@ -383,16 +445,35 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
383 * allocation will be done lower in skb_push(). 445 * allocation will be done lower in skb_push().
384 * Also, we don't use directly skb_cow(), because it require 446 * Also, we don't use directly skb_cow(), because it require
385 * headroom >= 16, which force unnecessary copies - Jean II */ 447 * headroom >= 16, which force unnecessary copies - Jean II */
386 if (skb_headroom(skb) < USB_IRDA_HEADER) { 448 if (skb_headroom(skb) < self->header_length) {
387 IRDA_DEBUG(0, "%s(), Insuficient skb headroom.\n", __FUNCTION__); 449 IRDA_DEBUG(0, "%s(), Insuficient skb headroom.\n", __FUNCTION__);
388 if (skb_cow(skb, USB_IRDA_HEADER)) { 450 if (skb_cow(skb, self->header_length)) {
389 IRDA_WARNING("%s(), failed skb_cow() !!!\n", __FUNCTION__); 451 IRDA_WARNING("%s(), failed skb_cow() !!!\n", __FUNCTION__);
390 goto drop; 452 goto drop;
391 } 453 }
392 } 454 }
393 455
394 /* Change setting for next frame */ 456 /* Change setting for next frame */
395 irda_usb_build_header(self, skb_push(skb, USB_IRDA_HEADER), 0); 457
458 if ( self->capability & IUC_STIR_4210 ) {
459 __u8 turnaround_time;
460 __u8* frame;
461 turnaround_time = get_turnaround_time( skb );
462 frame= skb_push(skb, self->header_length);
463 irda_usb_build_header(self, frame, 0);
464 frame[2] = turnaround_time;
465 if ((skb->len != 0) &&
466 ((skb->len % 128) == 0) &&
467 ((skb->len % 512) != 0)) {
468 /* add extra byte for special SigmaTel feature */
469 frame[1] = 1;
470 skb_put(skb, 1);
471 } else {
472 frame[1] = 0;
473 }
474 } else {
475 irda_usb_build_header(self, skb_push(skb, self->header_length), 0);
476 }
396 477
397 /* FIXME: Make macro out of this one */ 478 /* FIXME: Make macro out of this one */
398 ((struct irda_skb_cb *)skb->cb)->context = self; 479 ((struct irda_skb_cb *)skb->cb)->context = self;
@@ -795,7 +876,7 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
795 } 876 }
796 877
797 /* Check for empty frames */ 878 /* Check for empty frames */
798 if (urb->actual_length <= USB_IRDA_HEADER) { 879 if (urb->actual_length <= self->header_length) {
799 IRDA_WARNING("%s(), empty frame!\n", __FUNCTION__); 880 IRDA_WARNING("%s(), empty frame!\n", __FUNCTION__);
800 goto done; 881 goto done;
801 } 882 }
@@ -816,7 +897,11 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
816 docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD); 897 docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD);
817 898
818 /* Allocate a new skb */ 899 /* Allocate a new skb */
819 newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU); 900 if ( self->capability & IUC_STIR_4210 )
901 newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU + USB_IRDA_SIGMATEL_HEADER);
902 else
903 newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU);
904
820 if (!newskb) { 905 if (!newskb) {
821 self->stats.rx_dropped++; 906 self->stats.rx_dropped++;
822 /* We could deliver the current skb, but this would stall 907 /* We could deliver the current skb, but this would stall
@@ -845,7 +930,7 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
845 930
846 /* Set proper length on skb & remove USB-IrDA header */ 931 /* Set proper length on skb & remove USB-IrDA header */
847 skb_put(dataskb, urb->actual_length); 932 skb_put(dataskb, urb->actual_length);
848 skb_pull(dataskb, USB_IRDA_HEADER); 933 skb_pull(dataskb, self->header_length);
849 934
850 /* Ask the networking layer to queue the packet for the IrDA stack */ 935 /* Ask the networking layer to queue the packet for the IrDA stack */
851 dataskb->dev = self->netdev; 936 dataskb->dev = self->netdev;
@@ -937,6 +1022,191 @@ static int irda_usb_is_receiving(struct irda_usb_cb *self)
937 return 0; /* For now */ 1022 return 0; /* For now */
938} 1023}
939 1024
1025
1026#define STIR421X_PATCH_PRODUCT_VERSION_STR "Product Version: "
1027#define STIR421X_PATCH_COMPONENT_VERSION_STR "Component Version: "
1028#define STIR421X_PATCH_DATA_TAG_STR "STMP"
1029#define STIR421X_PATCH_FILE_VERSION_MAX_OFFSET 512 /* version info is before here */
1030#define STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET 512 /* patch image starts before here */
1031#define STIR421X_PATCH_FILE_END_OF_HEADER_TAG 0x1A /* marks end of patch file header (PC DOS text file EOF character) */
1032
1033/*
1034 * Known firmware patches for STIR421x dongles
1035 */
1036static char * stir421x_patches[] = {
1037 "42101001.sb",
1038 "42101002.sb",
1039};
1040
1041static int stir421x_get_patch_version(unsigned char * patch, const unsigned long patch_len)
1042{
1043 unsigned int version_offset;
1044 unsigned long version_major, version_minor, version_build;
1045 unsigned char * version_start;
1046 int version_found = 0;
1047
1048 for (version_offset = 0;
1049 version_offset < STIR421X_PATCH_FILE_END_OF_HEADER_TAG;
1050 version_offset++) {
1051 if (!memcmp(patch + version_offset,
1052 STIR421X_PATCH_PRODUCT_VERSION_STR,
1053 sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1)) {
1054 version_found = 1;
1055 version_start = patch +
1056 version_offset +
1057 sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1;
1058 break;
1059 }
1060 }
1061
1062 /* We couldn't find a product version on this patch */
1063 if (!version_found)
1064 return -EINVAL;
1065
1066 /* Let's check if the product version is dotted */
1067 if (version_start[3] != '.' ||
1068 version_start[7] != '.')
1069 return -EINVAL;
1070
1071 version_major = simple_strtoul(version_start, NULL, 10);
1072 version_minor = simple_strtoul(version_start + 4, NULL, 10);
1073 version_build = simple_strtoul(version_start + 8, NULL, 10);
1074
1075 IRDA_DEBUG(2, "%s(), Major: %ld Minor: %ld Build: %ld\n",
1076 __FUNCTION__,
1077 version_major, version_minor, version_build);
1078
1079 return (((version_major) << 12) +
1080 ((version_minor) << 8) +
1081 ((version_build / 10) << 4) +
1082 (version_build % 10));
1083
1084}
1085
1086
1087static int stir421x_upload_patch (struct irda_usb_cb *self,
1088 unsigned char * patch,
1089 const unsigned int patch_len)
1090{
1091 int retval = 0;
1092 int actual_len;
1093 unsigned int i = 0, download_amount = 0;
1094 unsigned char * patch_chunk;
1095
1096 IRDA_DEBUG (2, "%s(), Uploading STIR421x Patch\n", __FUNCTION__);
1097
1098 patch_chunk = kzalloc(STIR421X_MAX_PATCH_DOWNLOAD_SIZE, GFP_KERNEL);
1099 if (patch_chunk == NULL)
1100 return -ENOMEM;
1101
1102 /* break up patch into 1023-byte sections */
1103 for (i = 0; retval >= 0 && i < patch_len; i += download_amount) {
1104 download_amount = patch_len - i;
1105 if (download_amount > STIR421X_MAX_PATCH_DOWNLOAD_SIZE)
1106 download_amount = STIR421X_MAX_PATCH_DOWNLOAD_SIZE;
1107
1108 /* download the patch section */
1109 memcpy(patch_chunk, patch + i, download_amount);
1110
1111 retval = usb_bulk_msg (self->usbdev,
1112 usb_sndbulkpipe (self->usbdev,
1113 self->bulk_out_ep),
1114 patch_chunk, download_amount,
1115 &actual_len, msecs_to_jiffies (500));
1116 IRDA_DEBUG (2, "%s(), Sent %u bytes\n", __FUNCTION__,
1117 actual_len);
1118 if (retval == 0)
1119 mdelay(10);
1120 }
1121
1122 kfree(patch_chunk);
1123
1124 if (i != patch_len) {
1125 IRDA_ERROR ("%s(), Pushed %d bytes (!= patch_len (%d))\n",
1126 __FUNCTION__, i, patch_len);
1127 retval = -EIO;
1128 }
1129
1130 if (retval < 0)
1131 /* todo - mark device as not ready */
1132 IRDA_ERROR ("%s(), STIR421x patch upload failed (%d)\n",
1133 __FUNCTION__, retval);
1134
1135 return retval;
1136}
1137
1138
1139static int stir421x_patch_device(struct irda_usb_cb *self)
1140{
1141 unsigned int i, patch_found = 0, data_found = 0, data_offset;
1142 int patch_version, ret = 0;
1143 const struct firmware *fw_entry;
1144
1145 for (i = 0; i < ARRAY_SIZE(stir421x_patches); i++) {
1146 if(request_firmware(&fw_entry, stir421x_patches[i], &self->usbdev->dev) != 0) {
1147 IRDA_ERROR( "%s(), Patch %s is not available\n", __FUNCTION__, stir421x_patches[i]);
1148 continue;
1149 }
1150
1151 /* We found a patch from userspace */
1152 patch_version = stir421x_get_patch_version (fw_entry->data, fw_entry->size);
1153
1154 if (patch_version < 0) {
1155 /* Couldn't fetch a version, let's move on to the next file */
1156 IRDA_ERROR("%s(), version parsing failed\n", __FUNCTION__);
1157 ret = patch_version;
1158 release_firmware(fw_entry);
1159 continue;
1160 }
1161
1162 if (patch_version != self->usbdev->descriptor.bcdDevice) {
1163 /* Patch version and device don't match */
1164 IRDA_ERROR ("%s(), wrong patch version (%d <-> %d)\n",
1165 __FUNCTION__,
1166 patch_version, self->usbdev->descriptor.bcdDevice);
1167 ret = -EINVAL;
1168 release_firmware(fw_entry);
1169 continue;
1170 }
1171
1172 /* If we're here, we've found a correct patch */
1173 patch_found = 1;
1174 break;
1175
1176 }
1177
1178 /* We couldn't find a valid firmware, let's leave */
1179 if (!patch_found)
1180 return ret;
1181
1182 /* The actual image starts after the "STMP" keyword */
1183 for (data_offset = 0; data_offset < STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET; data_offset++) {
1184 if (!memcmp(fw_entry->data + data_offset,
1185 STIR421X_PATCH_DATA_TAG_STR,
1186 sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET))) {
1187 IRDA_DEBUG(2, "%s(), found patch data for STIR421x at offset %d\n",
1188 __FUNCTION__, data_offset);
1189 data_found = 1;
1190 break;
1191 }
1192 }
1193
1194 /* We couldn't find "STMP" from the header */
1195 if (!data_found)
1196 return -EINVAL;
1197
1198 /* Let's upload the patch to the target */
1199 ret = stir421x_upload_patch(self,
1200 &fw_entry->data[data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET)],
1201 fw_entry->size - (data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET)));
1202
1203 release_firmware(fw_entry);
1204
1205 return ret;
1206
1207}
1208
1209
940/********************** IRDA DEVICE CALLBACKS **********************/ 1210/********************** IRDA DEVICE CALLBACKS **********************/
941/* 1211/*
942 * Main calls from the IrDA/Network subsystem. 1212 * Main calls from the IrDA/Network subsystem.
@@ -972,6 +1242,11 @@ static int irda_usb_net_open(struct net_device *netdev)
972 return -1; 1242 return -1;
973 } 1243 }
974 1244
1245 if(self->needspatch) {
1246 IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
1247 return -EIO ;
1248 }
1249
975 /* Initialise default speed and xbofs value 1250 /* Initialise default speed and xbofs value
976 * (IrLAP will change that soon) */ 1251 * (IrLAP will change that soon) */
977 self->speed = -1; 1252 self->speed = -1;
@@ -1050,7 +1325,7 @@ static int irda_usb_net_close(struct net_device *netdev)
1050 del_timer(&self->rx_defer_timer); 1325 del_timer(&self->rx_defer_timer);
1051 1326
1052 /* Deallocate all the Rx path buffers (URBs and skb) */ 1327 /* Deallocate all the Rx path buffers (URBs and skb) */
1053 for (i = 0; i < IU_MAX_RX_URBS; i++) { 1328 for (i = 0; i < self->max_rx_urb; i++) {
1054 struct urb *urb = self->rx_urb[i]; 1329 struct urb *urb = self->rx_urb[i];
1055 struct sk_buff *skb = (struct sk_buff *) urb->context; 1330 struct sk_buff *skb = (struct sk_buff *) urb->context;
1056 /* Cancel the receive command */ 1331 /* Cancel the receive command */
@@ -1426,8 +1701,22 @@ static int irda_usb_probe(struct usb_interface *intf,
1426 spin_lock_init(&self->lock); 1701 spin_lock_init(&self->lock);
1427 init_timer(&self->rx_defer_timer); 1702 init_timer(&self->rx_defer_timer);
1428 1703
1704 self->capability = id->driver_info;
1705 self->needspatch = ((self->capability & IUC_STIR_4210) != 0) ;
1706
1429 /* Create all of the needed urbs */ 1707 /* Create all of the needed urbs */
1430 for (i = 0; i < IU_MAX_RX_URBS; i++) { 1708 if (self->capability & IUC_STIR_4210) {
1709 self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS;
1710 self->header_length = USB_IRDA_SIGMATEL_HEADER;
1711 } else {
1712 self->max_rx_urb = IU_MAX_RX_URBS;
1713 self->header_length = USB_IRDA_HEADER;
1714 }
1715
1716 self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *),
1717 GFP_KERNEL);
1718
1719 for (i = 0; i < self->max_rx_urb; i++) {
1431 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); 1720 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
1432 if (!self->rx_urb[i]) { 1721 if (!self->rx_urb[i]) {
1433 goto err_out_1; 1722 goto err_out_1;
@@ -1479,17 +1768,28 @@ static int irda_usb_probe(struct usb_interface *intf,
1479 goto err_out_3; 1768 goto err_out_3;
1480 } 1769 }
1481 1770
1771 self->usbdev = dev;
1772
1482 /* Find IrDA class descriptor */ 1773 /* Find IrDA class descriptor */
1483 irda_desc = irda_usb_find_class_desc(intf); 1774 irda_desc = irda_usb_find_class_desc(intf);
1484 ret = -ENODEV; 1775 ret = -ENODEV;
1485 if (irda_desc == NULL) 1776 if (irda_desc == NULL)
1486 goto err_out_3; 1777 goto err_out_3;
1487 1778
1779 if (self->needspatch) {
1780 ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
1781 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
1782 if (ret < 0) {
1783 IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
1784 goto err_out_3;
1785 } else {
1786 mdelay(10);
1787 }
1788 }
1789
1488 self->irda_desc = irda_desc; 1790 self->irda_desc = irda_desc;
1489 self->present = 1; 1791 self->present = 1;
1490 self->netopen = 0; 1792 self->netopen = 0;
1491 self->capability = id->driver_info;
1492 self->usbdev = dev;
1493 self->usbintf = intf; 1793 self->usbintf = intf;
1494 1794
1495 /* Allocate the buffer for speed changes */ 1795 /* Allocate the buffer for speed changes */
@@ -1508,8 +1808,32 @@ static int irda_usb_probe(struct usb_interface *intf,
1508 1808
1509 IRDA_MESSAGE("IrDA: Registered device %s\n", net->name); 1809 IRDA_MESSAGE("IrDA: Registered device %s\n", net->name);
1510 usb_set_intfdata(intf, self); 1810 usb_set_intfdata(intf, self);
1811
1812 if (self->needspatch) {
1813 /* Now we fetch and upload the firmware patch */
1814 ret = stir421x_patch_device(self);
1815 self->needspatch = (ret < 0);
1816 if (ret < 0) {
1817 printk("patch_device failed\n");
1818 goto err_out_5;
1819 }
1820
1821 /* replace IrDA class descriptor with what patched device is now reporting */
1822 irda_desc = irda_usb_find_class_desc (self->usbintf);
1823 if (irda_desc == NULL) {
1824 ret = -ENODEV;
1825 goto err_out_5;
1826 }
1827 if (self->irda_desc)
1828 kfree (self->irda_desc);
1829 self->irda_desc = irda_desc;
1830 irda_usb_init_qos(self);
1831 }
1832
1511 return 0; 1833 return 0;
1512 1834
1835err_out_5:
1836 unregister_netdev(self->netdev);
1513err_out_4: 1837err_out_4:
1514 kfree(self->speed_buff); 1838 kfree(self->speed_buff);
1515err_out_3: 1839err_out_3:
@@ -1518,7 +1842,7 @@ err_out_3:
1518err_out_2: 1842err_out_2:
1519 usb_free_urb(self->tx_urb); 1843 usb_free_urb(self->tx_urb);
1520err_out_1: 1844err_out_1:
1521 for (i = 0; i < IU_MAX_RX_URBS; i++) { 1845 for (i = 0; i < self->max_rx_urb; i++) {
1522 if (self->rx_urb[i]) 1846 if (self->rx_urb[i])
1523 usb_free_urb(self->rx_urb[i]); 1847 usb_free_urb(self->rx_urb[i]);
1524 } 1848 }
@@ -1571,7 +1895,7 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1571 /*netif_device_detach(self->netdev);*/ 1895 /*netif_device_detach(self->netdev);*/
1572 netif_stop_queue(self->netdev); 1896 netif_stop_queue(self->netdev);
1573 /* Stop all the receive URBs. Must be synchronous. */ 1897 /* Stop all the receive URBs. Must be synchronous. */
1574 for (i = 0; i < IU_MAX_RX_URBS; i++) 1898 for (i = 0; i < self->max_rx_urb; i++)
1575 usb_kill_urb(self->rx_urb[i]); 1899 usb_kill_urb(self->rx_urb[i]);
1576 /* Cancel Tx and speed URB. 1900 /* Cancel Tx and speed URB.
1577 * Make sure it's synchronous to avoid races. */ 1901 * Make sure it's synchronous to avoid races. */
@@ -1586,8 +1910,9 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1586 self->usbintf = NULL; 1910 self->usbintf = NULL;
1587 1911
1588 /* Clean up our urbs */ 1912 /* Clean up our urbs */
1589 for (i = 0; i < IU_MAX_RX_URBS; i++) 1913 for (i = 0; i < self->max_rx_urb; i++)
1590 usb_free_urb(self->rx_urb[i]); 1914 usb_free_urb(self->rx_urb[i]);
1915 kfree(self->rx_urb);
1591 /* Clean up Tx and speed URB */ 1916 /* Clean up Tx and speed URB */
1592 usb_free_urb(self->tx_urb); 1917 usb_free_urb(self->tx_urb);
1593 usb_free_urb(self->speed_urb); 1918 usb_free_urb(self->speed_urb);
@@ -1648,6 +1973,6 @@ module_exit(usb_irda_cleanup);
1648 */ 1973 */
1649module_param(qos_mtt_bits, int, 0); 1974module_param(qos_mtt_bits, int, 0);
1650MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time"); 1975MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
1651MODULE_AUTHOR("Roman Weissgaerber <weissg@vienna.at>, Dag Brattli <dag@brattli.net> and Jean Tourrilhes <jt@hpl.hp.com>"); 1976MODULE_AUTHOR("Roman Weissgaerber <weissg@vienna.at>, Dag Brattli <dag@brattli.net>, Jean Tourrilhes <jt@hpl.hp.com> and Nick Fedchik <nick@fedchik.org.ua>");
1652MODULE_DESCRIPTION("IrDA-USB Dongle Driver"); 1977MODULE_DESCRIPTION("IrDA-USB Dongle Driver");
1653MODULE_LICENSE("GPL"); 1978MODULE_LICENSE("GPL");
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index 4026af42dd47..d833db52cebf 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 * 2 *
3 * Filename: irda-usb.h 3 * Filename: irda-usb.h
4 * Version: 0.9b 4 * Version: 0.10
5 * Description: IrDA-USB Driver 5 * Description: IrDA-USB Driver
6 * Status: Experimental 6 * Status: Experimental
7 * Author: Dag Brattli <dag@brattli.net> 7 * Author: Dag Brattli <dag@brattli.net>
@@ -9,6 +9,9 @@
9 * Copyright (C) 2001, Roman Weissgaerber <weissg@vienna.at> 9 * Copyright (C) 2001, Roman Weissgaerber <weissg@vienna.at>
10 * Copyright (C) 2000, Dag Brattli <dag@brattli.net> 10 * Copyright (C) 2000, Dag Brattli <dag@brattli.net>
11 * Copyright (C) 2001, Jean Tourrilhes <jt@hpl.hp.com> 11 * Copyright (C) 2001, Jean Tourrilhes <jt@hpl.hp.com>
12 * Copyright (C) 2004, SigmaTel, Inc. <irquality@sigmatel.com>
13 * Copyright (C) 2005, Milan Beno <beno@pobox.sk>
14 * Copyright (C) 2006, Nick FEdchik <nick@fedchik.org.ua>
12 * 15 *
13 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
@@ -31,6 +34,9 @@
31#include <net/irda/irda.h> 34#include <net/irda/irda.h>
32#include <net/irda/irda_device.h> /* struct irlap_cb */ 35#include <net/irda/irda_device.h> /* struct irlap_cb */
33 36
37#define PATCH_FILE_SIZE_MAX 65536
38#define PATCH_FILE_SIZE_MIN 80
39
34#define RX_COPY_THRESHOLD 200 40#define RX_COPY_THRESHOLD 200
35#define IRDA_USB_MAX_MTU 2051 41#define IRDA_USB_MAX_MTU 2051
36#define IRDA_USB_SPEED_MTU 64 /* Weird, but work like this */ 42#define IRDA_USB_SPEED_MTU 64 /* Weird, but work like this */
@@ -79,15 +85,16 @@
79/* Inbound header */ 85/* Inbound header */
80#define MEDIA_BUSY 0x80 86#define MEDIA_BUSY 0x80
81 87
82#define SPEED_2400 0x01 88#define SPEED_2400 0x01
83#define SPEED_9600 0x02 89#define SPEED_9600 0x02
84#define SPEED_19200 0x03 90#define SPEED_19200 0x03
85#define SPEED_38400 0x04 91#define SPEED_38400 0x04
86#define SPEED_57600 0x05 92#define SPEED_57600 0x05
87#define SPEED_115200 0x06 93#define SPEED_115200 0x06
88#define SPEED_576000 0x07 94#define SPEED_576000 0x07
89#define SPEED_1152000 0x08 95#define SPEED_1152000 0x08
90#define SPEED_4000000 0x09 96#define SPEED_4000000 0x09
97#define SPEED_16000000 0x0a
91 98
92/* Basic capabilities */ 99/* Basic capabilities */
93#define IUC_DEFAULT 0x00 /* Basic device compliant with 1.0 spec */ 100#define IUC_DEFAULT 0x00 /* Basic device compliant with 1.0 spec */
@@ -100,11 +107,14 @@
100#define IUC_SMALL_PKT 0x10 /* Device doesn't behave with big Rx packets */ 107#define IUC_SMALL_PKT 0x10 /* Device doesn't behave with big Rx packets */
101#define IUC_MAX_WINDOW 0x20 /* Device underestimate the Rx window */ 108#define IUC_MAX_WINDOW 0x20 /* Device underestimate the Rx window */
102#define IUC_MAX_XBOFS 0x40 /* Device need more xbofs than advertised */ 109#define IUC_MAX_XBOFS 0x40 /* Device need more xbofs than advertised */
110#define IUC_STIR_4210 0x80 /* SigmaTel 4210/4220/4116 VFIR */
103 111
104/* USB class definitions */ 112/* USB class definitions */
105#define USB_IRDA_HEADER 0x01 113#define USB_IRDA_HEADER 0x01
106#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */ 114#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */
107#define USB_DT_IRDA 0x21 115#define USB_DT_IRDA 0x21
116#define USB_IRDA_SIGMATEL_HEADER 0x03
117#define IU_SIGMATEL_MAX_RX_URBS (IU_MAX_ACTIVE_RX_URBS + USB_IRDA_SIGMATEL_HEADER)
108 118
109struct irda_class_desc { 119struct irda_class_desc {
110 __u8 bLength; 120 __u8 bLength;
@@ -123,6 +133,7 @@ struct irda_class_desc {
123 * (6.2.5, USB-IrDA class spec 1.0) */ 133 * (6.2.5, USB-IrDA class spec 1.0) */
124 134
125#define IU_REQ_GET_CLASS_DESC 0x06 135#define IU_REQ_GET_CLASS_DESC 0x06
136#define STIR421X_MAX_PATCH_DOWNLOAD_SIZE 1023
126 137
127struct irda_usb_cb { 138struct irda_usb_cb {
128 struct irda_class_desc *irda_desc; 139 struct irda_class_desc *irda_desc;
@@ -136,7 +147,8 @@ struct irda_usb_cb {
136 __u16 bulk_out_mtu; /* Max Tx packet size in bytes */ 147 __u16 bulk_out_mtu; /* Max Tx packet size in bytes */
137 __u8 bulk_int_ep; /* Interrupt Endpoint assignments */ 148 __u8 bulk_int_ep; /* Interrupt Endpoint assignments */
138 149
139 struct urb *rx_urb[IU_MAX_RX_URBS]; /* URBs used to receive data frames */ 150 __u8 max_rx_urb;
151 struct urb **rx_urb; /* URBs used to receive data frames */
140 struct urb *idle_rx_urb; /* Pointer to idle URB in Rx path */ 152 struct urb *idle_rx_urb; /* Pointer to idle URB in Rx path */
141 struct urb *tx_urb; /* URB used to send data frames */ 153 struct urb *tx_urb; /* URB used to send data frames */
142 struct urb *speed_urb; /* URB used to send speed commands */ 154 struct urb *speed_urb; /* URB used to send speed commands */
@@ -157,6 +169,9 @@ struct irda_usb_cb {
157 __u32 speed; /* Current speed */ 169 __u32 speed; /* Current speed */
158 __s32 new_speed; /* speed we need to set */ 170 __s32 new_speed; /* speed we need to set */
159 171
172 __u8 header_length; /* USB-IrDA frame header size */
173 int needspatch; /* device needs firmware patch */
174
160 struct timer_list rx_defer_timer; /* Wait for Rx error to clear */ 175 struct timer_list rx_defer_timer; /* Wait for Rx error to clear */
161}; 176};
162 177
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index ec94ecdb103d..58f76cefbc83 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -11,6 +11,7 @@
11 * Copyright (c) 2002 Daniele Peri 11 * Copyright (c) 2002 Daniele Peri
12 * All Rights Reserved. 12 * All Rights Reserved.
13 * Copyright (c) 2002 Jean Tourrilhes 13 * Copyright (c) 2002 Jean Tourrilhes
14 * Copyright (c) 2006 Linus Walleij
14 * 15 *
15 * 16 *
16 * Based on smc-ircc.c: 17 * Based on smc-ircc.c:
@@ -61,6 +62,9 @@
61 62
62#include <linux/spinlock.h> 63#include <linux/spinlock.h>
63#include <linux/pm.h> 64#include <linux/pm.h>
65#ifdef CONFIG_PCI
66#include <linux/pci.h>
67#endif
64 68
65#include <net/irda/wrapper.h> 69#include <net/irda/wrapper.h>
66#include <net/irda/irda.h> 70#include <net/irda/irda.h>
@@ -100,6 +104,22 @@ MODULE_PARM_DESC(ircc_transceiver, "Transceiver type");
100 104
101/* Types */ 105/* Types */
102 106
107#ifdef CONFIG_PCI
108struct smsc_ircc_subsystem_configuration {
109 unsigned short vendor; /* PCI vendor ID */
110 unsigned short device; /* PCI vendor ID */
111 unsigned short subvendor; /* PCI subsystem vendor ID */
112 unsigned short subdevice; /* PCI sybsystem device ID */
113 unsigned short sir_io; /* I/O port for SIR */
114 unsigned short fir_io; /* I/O port for FIR */
115 unsigned char fir_irq; /* FIR IRQ */
116 unsigned char fir_dma; /* FIR DMA */
117 unsigned short cfg_base; /* I/O port for chip configuration */
118 int (*preconfigure)(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); /* Preconfig function */
119 const char *name; /* name shown as info */
120};
121#endif
122
103struct smsc_transceiver { 123struct smsc_transceiver {
104 char *name; 124 char *name;
105 void (*set_for_speed)(int fir_base, u32 speed); 125 void (*set_for_speed)(int fir_base, u32 speed);
@@ -202,6 +222,18 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
202static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type); 222static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type);
203static int __init smsc_superio_fdc(unsigned short cfg_base); 223static int __init smsc_superio_fdc(unsigned short cfg_base);
204static int __init smsc_superio_lpc(unsigned short cfg_base); 224static int __init smsc_superio_lpc(unsigned short cfg_base);
225#ifdef CONFIG_PCI
226static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf);
227static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
228static void __init preconfigure_ali_port(struct pci_dev *dev,
229 unsigned short port);
230static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
231static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
232 unsigned short ircc_fir,
233 unsigned short ircc_sir,
234 unsigned char ircc_dma,
235 unsigned char ircc_irq);
236#endif
205 237
206/* Transceivers specific functions */ 238/* Transceivers specific functions */
207 239
@@ -353,6 +385,13 @@ static int __init smsc_ircc_init(void)
353 return ret; 385 return ret;
354 } 386 }
355 387
388#ifdef CONFIG_PCI
389 if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
390 /* Ignore errors from preconfiguration */
391 IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
392 }
393#endif
394
356 dev_count = 0; 395 dev_count = 0;
357 396
358 if (ircc_fir > 0 && ircc_sir > 0) { 397 if (ircc_fir > 0 && ircc_sir > 0) {
@@ -2285,6 +2324,490 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
2285 return ret; 2324 return ret;
2286} 2325}
2287 2326
2327/*
2328 * Look for some specific subsystem setups that need
2329 * pre-configuration not properly done by the BIOS (especially laptops)
2330 * This code is based in part on smcinit.c, tosh1800-smcinit.c
2331 * and tosh2450-smcinit.c. The table lists the device entries
2332 * for ISA bridges with an LPC (Low Pin Count) controller which
2333 * handles the communication with the SMSC device. After the LPC
2334 * controller is initialized through PCI, the SMSC device is initialized
2335 * through a dedicated port in the ISA port-mapped I/O area, this latter
2336 * area is used to configure the SMSC device with default
2337 * SIR and FIR I/O ports, DMA and IRQ. Different vendors have
2338 * used different sets of parameters and different control port
2339 * addresses making a subsystem device table necessary.
2340 */
2341#ifdef CONFIG_PCI
2342#define PCIID_VENDOR_INTEL 0x8086
2343#define PCIID_VENDOR_ALI 0x10b9
2344static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __devinitdata = {
2345 {
2346 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
2347 .device = 0x24cc,
2348 .subvendor = 0x103c,
2349 .subdevice = 0x088c,
2350 /* Quite certain these are the same for nc8000 as for nc6000 */
2351 .sir_io = 0x02f8,
2352 .fir_io = 0x0130,
2353 .fir_irq = 0x05,
2354 .fir_dma = 0x03,
2355 .cfg_base = 0x004e,
2356 .preconfigure = preconfigure_through_82801,
2357 .name = "HP nc8000",
2358 },
2359 {
2360 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
2361 .device = 0x24cc,
2362 .subvendor = 0x103c,
2363 .subdevice = 0x0890,
2364 .sir_io = 0x02f8,
2365 .fir_io = 0x0130,
2366 .fir_irq = 0x05,
2367 .fir_dma = 0x03,
2368 .cfg_base = 0x004e,
2369 .preconfigure = preconfigure_through_82801,
2370 .name = "HP nc6000",
2371 },
2372 {
2373 /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */
2374 .vendor = PCIID_VENDOR_INTEL,
2375 .device = 0x24c0,
2376 .subvendor = 0x1179,
2377 .subdevice = 0xffff, /* 0xffff is "any" */
2378 .sir_io = 0x03f8,
2379 .fir_io = 0x0130,
2380 .fir_irq = 0x07,
2381 .fir_dma = 0x01,
2382 .cfg_base = 0x002e,
2383 .preconfigure = preconfigure_through_82801,
2384 .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge",
2385 },
2386 {
2387 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */
2388 .device = 0x248c,
2389 .subvendor = 0x1179,
2390 .subdevice = 0xffff, /* 0xffff is "any" */
2391 .sir_io = 0x03f8,
2392 .fir_io = 0x0130,
2393 .fir_irq = 0x03,
2394 .fir_dma = 0x03,
2395 .cfg_base = 0x002e,
2396 .preconfigure = preconfigure_through_82801,
2397 .name = "Toshiba laptop with Intel 82801CAM ISA bridge",
2398 },
2399 {
2400 /* 82801DBM (ICH4-M) LPC Interface Bridge */
2401 .vendor = PCIID_VENDOR_INTEL,
2402 .device = 0x24cc,
2403 .subvendor = 0x1179,
2404 .subdevice = 0xffff, /* 0xffff is "any" */
2405 .sir_io = 0x03f8,
2406 .fir_io = 0x0130,
2407 .fir_irq = 0x03,
2408 .fir_dma = 0x03,
2409 .cfg_base = 0x002e,
2410 .preconfigure = preconfigure_through_82801,
2411 .name = "Toshiba laptop with Intel 8281DBM LPC bridge",
2412 },
2413 {
2414 /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */
2415 .vendor = PCIID_VENDOR_ALI,
2416 .device = 0x1533,
2417 .subvendor = 0x1179,
2418 .subdevice = 0xffff, /* 0xffff is "any" */
2419 .sir_io = 0x02e8,
2420 .fir_io = 0x02f8,
2421 .fir_irq = 0x07,
2422 .fir_dma = 0x03,
2423 .cfg_base = 0x002e,
2424 .preconfigure = preconfigure_through_ali,
2425 .name = "Toshiba laptop with ALi ISA bridge",
2426 },
2427 { } // Terminator
2428};
2429
2430
2431/*
2432 * This sets up the basic SMSC parameters
2433 * (FIR port, SIR port, FIR DMA, FIR IRQ)
2434 * through the chip configuration port.
2435 */
2436static int __init preconfigure_smsc_chip(struct
2437 smsc_ircc_subsystem_configuration
2438 *conf)
2439{
2440 unsigned short iobase = conf->cfg_base;
2441 unsigned char tmpbyte;
2442
2443 outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state
2444 outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID
2445 tmpbyte = inb(iobase +1); // Read device ID
2446 IRDA_DEBUG(0,
2447 "Detected Chip id: 0x%02x, setting up registers...\n",
2448 tmpbyte);
2449
2450 /* Disable UART1 and set up SIR I/O port */
2451 outb(0x24, iobase); // select CR24 - UART1 base addr
2452 outb(0x00, iobase + 1); // disable UART1
2453 outb(SMSCSIOFLAT_UART2BASEADDR_REG, iobase); // select CR25 - UART2 base addr
2454 outb( (conf->sir_io >> 2), iobase + 1); // bits 2-9 of 0x3f8
2455 tmpbyte = inb(iobase + 1);
2456 if (tmpbyte != (conf->sir_io >> 2) ) {
2457 IRDA_WARNING("ERROR: could not configure SIR ioport.\n");
2458 IRDA_WARNING("Try to supply ircc_cfg argument.\n");
2459 return -ENXIO;
2460 }
2461
2462 /* Set up FIR IRQ channel for UART2 */
2463 outb(SMSCSIOFLAT_UARTIRQSELECT_REG, iobase); // select CR28 - UART1,2 IRQ select
2464 tmpbyte = inb(iobase + 1);
2465 tmpbyte &= SMSCSIOFLAT_UART1IRQSELECT_MASK; // Do not touch the UART1 portion
2466 tmpbyte |= (conf->fir_irq & SMSCSIOFLAT_UART2IRQSELECT_MASK);
2467 outb(tmpbyte, iobase + 1);
2468 tmpbyte = inb(iobase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
2469 if (tmpbyte != conf->fir_irq) {
2470 IRDA_WARNING("ERROR: could not configure FIR IRQ channel.\n");
2471 return -ENXIO;
2472 }
2473
2474 /* Set up FIR I/O port */
2475 outb(SMSCSIOFLAT_FIRBASEADDR_REG, iobase); // CR2B - SCE (FIR) base addr
2476 outb((conf->fir_io >> 3), iobase + 1);
2477 tmpbyte = inb(iobase + 1);
2478 if (tmpbyte != (conf->fir_io >> 3) ) {
2479 IRDA_WARNING("ERROR: could not configure FIR I/O port.\n");
2480 return -ENXIO;
2481 }
2482
2483 /* Set up FIR DMA channel */
2484 outb(SMSCSIOFLAT_FIRDMASELECT_REG, iobase); // CR2C - SCE (FIR) DMA select
2485 outb((conf->fir_dma & LPC47N227_FIRDMASELECT_MASK), iobase + 1); // DMA
2486 tmpbyte = inb(iobase + 1) & LPC47N227_FIRDMASELECT_MASK;
2487 if (tmpbyte != (conf->fir_dma & LPC47N227_FIRDMASELECT_MASK)) {
2488 IRDA_WARNING("ERROR: could not configure FIR DMA channel.\n");
2489 return -ENXIO;
2490 }
2491
2492 outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode
2493 tmpbyte = inb(iobase + 1);
2494 tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK |
2495 SMSCSIOFLAT_UART2MODE_VAL_IRDA;
2496 outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed
2497
2498 outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel
2499 tmpbyte = inb(iobase + 1);
2500 outb(tmpbyte | LPC47N227_UART2AUTOPWRDOWN_MASK, iobase + 1); // enable UART2 autopower down
2501
2502 /* This one was not part of tosh1800 */
2503 outb(0x0a, iobase); // CR0a - ecp fifo / ir mux
2504 tmpbyte = inb(iobase + 1);
2505 outb(tmpbyte | 0x40, iobase + 1); // send active device to ir port
2506
2507 outb(LPC47N227_UART12POWER_REG, iobase); // CR02 - UART 1,2 power
2508 tmpbyte = inb(iobase + 1);
2509 outb(tmpbyte | LPC47N227_UART2POWERDOWN_MASK, iobase + 1); // UART2 power up mode, UART1 power down
2510
2511 outb(LPC47N227_FDCPOWERVALIDCONF_REG, iobase); // CR00 - FDC Power/valid config cycle
2512 tmpbyte = inb(iobase + 1);
2513 outb(tmpbyte | LPC47N227_VALID_MASK, iobase + 1); // valid config cycle done
2514
2515 outb(LPC47N227_CFGEXITKEY, iobase); // Exit configuration
2516
2517 return 0;
2518}
2519
2520/* 82801CAM generic registers */
2521#define VID 0x00
2522#define DID 0x02
2523#define PIRQ_A_D_ROUT 0x60
2524#define SIRQ_CNTL 0x64
2525#define PIRQ_E_H_ROUT 0x68
2526#define PCI_DMA_C 0x90
2527/* LPC-specific registers */
2528#define COM_DEC 0xe0
2529#define GEN1_DEC 0xe4
2530#define LPC_EN 0xe6
2531#define GEN2_DEC 0xec
2532/*
2533 * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge
2534 * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge.
2535 * They all work the same way!
2536 */
2537static int __init preconfigure_through_82801(struct pci_dev *dev,
2538 struct
2539 smsc_ircc_subsystem_configuration
2540 *conf)
2541{
2542 unsigned short tmpword;
2543 unsigned char tmpbyte;
2544
2545 IRDA_MESSAGE("Setting up Intel 82801 controller and SMSC device\n");
2546 /*
2547 * Select the range for the COMA COM port (SIR)
2548 * Register COM_DEC:
2549 * Bit 7: reserved
2550 * Bit 6-4, COMB decode range
2551 * Bit 3: reserved
2552 * Bit 2-0, COMA decode range
2553 *
2554 * Decode ranges:
2555 * 000 = 0x3f8-0x3ff (COM1)
2556 * 001 = 0x2f8-0x2ff (COM2)
2557 * 010 = 0x220-0x227
2558 * 011 = 0x228-0x22f
2559 * 100 = 0x238-0x23f
2560 * 101 = 0x2e8-0x2ef (COM4)
2561 * 110 = 0x338-0x33f
2562 * 111 = 0x3e8-0x3ef (COM3)
2563 */
2564 pci_read_config_byte(dev, COM_DEC, &tmpbyte);
2565 tmpbyte &= 0xf8; /* mask COMA bits */
2566 switch(conf->sir_io) {
2567 case 0x3f8:
2568 tmpbyte |= 0x00;
2569 break;
2570 case 0x2f8:
2571 tmpbyte |= 0x01;
2572 break;
2573 case 0x220:
2574 tmpbyte |= 0x02;
2575 break;
2576 case 0x228:
2577 tmpbyte |= 0x03;
2578 break;
2579 case 0x238:
2580 tmpbyte |= 0x04;
2581 break;
2582 case 0x2e8:
2583 tmpbyte |= 0x05;
2584 break;
2585 case 0x338:
2586 tmpbyte |= 0x06;
2587 break;
2588 case 0x3e8:
2589 tmpbyte |= 0x07;
2590 break;
2591 default:
2592 tmpbyte |= 0x01; /* COM2 default */
2593 }
2594 IRDA_DEBUG(1, "COM_DEC (write): 0x%02x\n", tmpbyte);
2595 pci_write_config_byte(dev, COM_DEC, tmpbyte);
2596
2597 /* Enable Low Pin Count interface */
2598 pci_read_config_word(dev, LPC_EN, &tmpword);
2599 /* These seem to be set up at all times,
2600 * just make sure it is properly set.
2601 */
2602 switch(conf->cfg_base) {
2603 case 0x04e:
2604 tmpword |= 0x2000;
2605 break;
2606 case 0x02e:
2607 tmpword |= 0x1000;
2608 break;
2609 case 0x062:
2610 tmpword |= 0x0800;
2611 break;
2612 case 0x060:
2613 tmpword |= 0x0400;
2614 break;
2615 default:
2616 IRDA_WARNING("Uncommon I/O base address: 0x%04x\n",
2617 conf->cfg_base);
2618 break;
2619 }
2620 tmpword &= 0xfffd; /* disable LPC COMB */
2621 tmpword |= 0x0001; /* set bit 0 : enable LPC COMA addr range (GEN2) */
2622 IRDA_DEBUG(1, "LPC_EN (write): 0x%04x\n", tmpword);
2623 pci_write_config_word(dev, LPC_EN, tmpword);
2624
2625 /*
2626 * Configure LPC DMA channel
2627 * PCI_DMA_C bits:
2628 * Bit 15-14: DMA channel 7 select
2629 * Bit 13-12: DMA channel 6 select
2630 * Bit 11-10: DMA channel 5 select
2631 * Bit 9-8: Reserved
2632 * Bit 7-6: DMA channel 3 select
2633 * Bit 5-4: DMA channel 2 select
2634 * Bit 3-2: DMA channel 1 select
2635 * Bit 1-0: DMA channel 0 select
2636 * 00 = Reserved value
2637 * 01 = PC/PCI DMA
2638 * 10 = Reserved value
2639 * 11 = LPC I/F DMA
2640 */
2641 pci_read_config_word(dev, PCI_DMA_C, &tmpword);
2642 switch(conf->fir_dma) {
2643 case 0x07:
2644 tmpword |= 0xc000;
2645 break;
2646 case 0x06:
2647 tmpword |= 0x3000;
2648 break;
2649 case 0x05:
2650 tmpword |= 0x0c00;
2651 break;
2652 case 0x03:
2653 tmpword |= 0x00c0;
2654 break;
2655 case 0x02:
2656 tmpword |= 0x0030;
2657 break;
2658 case 0x01:
2659 tmpword |= 0x000c;
2660 break;
2661 case 0x00:
2662 tmpword |= 0x0003;
2663 break;
2664 default:
2665 break; /* do not change settings */
2666 }
2667 IRDA_DEBUG(1, "PCI_DMA_C (write): 0x%04x\n", tmpword);
2668 pci_write_config_word(dev, PCI_DMA_C, tmpword);
2669
2670 /*
2671 * GEN2_DEC bits:
2672 * Bit 15-4: Generic I/O range
2673 * Bit 3-1: reserved (read as 0)
2674 * Bit 0: enable GEN2 range on LPC I/F
2675 */
2676 tmpword = conf->fir_io & 0xfff8;
2677 tmpword |= 0x0001;
2678 IRDA_DEBUG(1, "GEN2_DEC (write): 0x%04x\n", tmpword);
2679 pci_write_config_word(dev, GEN2_DEC, tmpword);
2680
2681 /* Pre-configure chip */
2682 return preconfigure_smsc_chip(conf);
2683}
2684
2685/*
2686 * Pre-configure a certain port on the ALi 1533 bridge.
2687 * This is based on reverse-engineering since ALi does not
2688 * provide any data sheet for the 1533 chip.
2689 */
2690static void __init preconfigure_ali_port(struct pci_dev *dev,
2691 unsigned short port)
2692{
2693 unsigned char reg;
2694 /* These bits obviously control the different ports */
2695 unsigned char mask;
2696 unsigned char tmpbyte;
2697
2698 switch(port) {
2699 case 0x0130:
2700 case 0x0178:
2701 reg = 0xb0;
2702 mask = 0x80;
2703 break;
2704 case 0x03f8:
2705 reg = 0xb4;
2706 mask = 0x80;
2707 break;
2708 case 0x02f8:
2709 reg = 0xb4;
2710 mask = 0x30;
2711 break;
2712 case 0x02e8:
2713 reg = 0xb4;
2714 mask = 0x08;
2715 break;
2716 default:
2717 IRDA_ERROR("Failed to configure unsupported port on ALi 1533 bridge: 0x%04x\n", port);
2718 return;
2719 }
2720
2721 pci_read_config_byte(dev, reg, &tmpbyte);
2722 /* Turn on the right bits */
2723 tmpbyte |= mask;
2724 pci_write_config_byte(dev, reg, tmpbyte);
2725 IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port);
2726 return;
2727}
2728
2729static int __init preconfigure_through_ali(struct pci_dev *dev,
2730 struct
2731 smsc_ircc_subsystem_configuration
2732 *conf)
2733{
2734 /* Configure the two ports on the ALi 1533 */
2735 preconfigure_ali_port(dev, conf->sir_io);
2736 preconfigure_ali_port(dev, conf->fir_io);
2737
2738 /* Pre-configure chip */
2739 return preconfigure_smsc_chip(conf);
2740}
2741
2742static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
2743 unsigned short ircc_fir,
2744 unsigned short ircc_sir,
2745 unsigned char ircc_dma,
2746 unsigned char ircc_irq)
2747{
2748 struct pci_dev *dev = NULL;
2749 unsigned short ss_vendor = 0x0000;
2750 unsigned short ss_device = 0x0000;
2751 int ret = 0;
2752
2753 dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
2754
2755 while (dev != NULL) {
2756 struct smsc_ircc_subsystem_configuration *conf;
2757
2758 /*
2759 * Cache the subsystem vendor/device:
2760 * some manufacturers fail to set this for all components,
2761 * so we save it in case there is just 0x0000 0x0000 on the
2762 * device we want to check.
2763 */
2764 if (dev->subsystem_vendor != 0x0000U) {
2765 ss_vendor = dev->subsystem_vendor;
2766 ss_device = dev->subsystem_device;
2767 }
2768 conf = subsystem_configurations;
2769 for( ; conf->subvendor; conf++) {
2770 if(conf->vendor == dev->vendor &&
2771 conf->device == dev->device &&
2772 conf->subvendor == ss_vendor &&
2773 /* Sometimes these are cached values */
2774 (conf->subdevice == ss_device ||
2775 conf->subdevice == 0xffff)) {
2776 struct smsc_ircc_subsystem_configuration
2777 tmpconf;
2778
2779 memcpy(&tmpconf, conf,
2780 sizeof(struct smsc_ircc_subsystem_configuration));
2781
2782 /*
2783 * Override the default values with anything
2784 * passed in as parameter
2785 */
2786 if (ircc_cfg != 0)
2787 tmpconf.cfg_base = ircc_cfg;
2788 if (ircc_fir != 0)
2789 tmpconf.fir_io = ircc_fir;
2790 if (ircc_sir != 0)
2791 tmpconf.sir_io = ircc_sir;
2792 if (ircc_dma != 0xff)
2793 tmpconf.fir_dma = ircc_dma;
2794 if (ircc_irq != 0xff)
2795 tmpconf.fir_irq = ircc_irq;
2796
2797 IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name);
2798 if (conf->preconfigure)
2799 ret = conf->preconfigure(dev, &tmpconf);
2800 else
2801 ret = -ENODEV;
2802 }
2803 }
2804 dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
2805 }
2806
2807 return ret;
2808}
2809#endif // CONFIG_PCI
2810
2288/************************************************ 2811/************************************************
2289 * 2812 *
2290 * Transceivers specific functions 2813 * Transceivers specific functions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index f9f77e4f5965..cfd67d812f0d 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -357,18 +357,20 @@ ixgb_probe(struct pci_dev *pdev,
357 if((err = pci_enable_device(pdev))) 357 if((err = pci_enable_device(pdev)))
358 return err; 358 return err;
359 359
360 if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { 360 if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) &&
361 !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) {
361 pci_using_dac = 1; 362 pci_using_dac = 1;
362 } else { 363 } else {
363 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { 364 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) ||
365 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
364 IXGB_ERR("No usable DMA configuration, aborting\n"); 366 IXGB_ERR("No usable DMA configuration, aborting\n");
365 return err; 367 goto err_dma_mask;
366 } 368 }
367 pci_using_dac = 0; 369 pci_using_dac = 0;
368 } 370 }
369 371
370 if((err = pci_request_regions(pdev, ixgb_driver_name))) 372 if((err = pci_request_regions(pdev, ixgb_driver_name)))
371 return err; 373 goto err_request_regions;
372 374
373 pci_set_master(pdev); 375 pci_set_master(pdev);
374 376
@@ -502,6 +504,9 @@ err_ioremap:
502 free_netdev(netdev); 504 free_netdev(netdev);
503err_alloc_etherdev: 505err_alloc_etherdev:
504 pci_release_regions(pdev); 506 pci_release_regions(pdev);
507err_request_regions:
508err_dma_mask:
509 pci_disable_device(pdev);
505 return err; 510 return err;
506} 511}
507 512
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 9f2661355a4a..ea62a3e7d586 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -281,10 +281,16 @@ static void mv643xx_eth_tx_timeout_task(struct net_device *dev)
281{ 281{
282 struct mv643xx_private *mp = netdev_priv(dev); 282 struct mv643xx_private *mp = netdev_priv(dev);
283 283
284 netif_device_detach(dev); 284 if (!netif_running(dev))
285 return;
286
287 netif_stop_queue(dev);
288
285 eth_port_reset(mp->port_num); 289 eth_port_reset(mp->port_num);
286 eth_port_start(dev); 290 eth_port_start(dev);
287 netif_device_attach(dev); 291
292 if (mp->tx_ring_size - mp->tx_desc_count >= MAX_DESCS_PER_SKB)
293 netif_wake_queue(dev);
288} 294}
289 295
290/** 296/**
@@ -552,9 +558,9 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id,
552#else 558#else
553 if (eth_int_cause & ETH_INT_CAUSE_RX) 559 if (eth_int_cause & ETH_INT_CAUSE_RX)
554 mv643xx_eth_receive_queue(dev, INT_MAX); 560 mv643xx_eth_receive_queue(dev, INT_MAX);
561#endif
555 if (eth_int_cause_ext & ETH_INT_CAUSE_TX) 562 if (eth_int_cause_ext & ETH_INT_CAUSE_TX)
556 mv643xx_eth_free_completed_tx_descs(dev); 563 mv643xx_eth_free_completed_tx_descs(dev);
557#endif
558 564
559 /* 565 /*
560 * If no real interrupt occured, exit. 566 * If no real interrupt occured, exit.
@@ -1186,7 +1192,12 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1186 1192
1187 BUG_ON(netif_queue_stopped(dev)); 1193 BUG_ON(netif_queue_stopped(dev));
1188 BUG_ON(skb == NULL); 1194 BUG_ON(skb == NULL);
1189 BUG_ON(mp->tx_ring_size - mp->tx_desc_count < MAX_DESCS_PER_SKB); 1195
1196 if (mp->tx_ring_size - mp->tx_desc_count < MAX_DESCS_PER_SKB) {
1197 printk(KERN_ERR "%s: transmit with queue full\n", dev->name);
1198 netif_stop_queue(dev);
1199 return 1;
1200 }
1190 1201
1191 if (has_tiny_unaligned_frags(skb)) { 1202 if (has_tiny_unaligned_frags(skb)) {
1192 if ((skb_linearize(skb, GFP_ATOMIC) != 0)) { 1203 if ((skb_linearize(skb, GFP_ATOMIC) != 0)) {
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 7826afbb9db9..90627756d6fa 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -238,7 +238,7 @@ static int full_duplex[MAX_UNITS];
238#define NATSEMI_RX_LIMIT 2046 /* maximum supported by hardware */ 238#define NATSEMI_RX_LIMIT 2046 /* maximum supported by hardware */
239 239
240/* These identify the driver base version and may not be removed. */ 240/* These identify the driver base version and may not be removed. */
241static char version[] __devinitdata = 241static const char version[] __devinitdata =
242 KERN_INFO DRV_NAME " dp8381x driver, version " 242 KERN_INFO DRV_NAME " dp8381x driver, version "
243 DRV_VERSION ", " DRV_RELDATE "\n" 243 DRV_VERSION ", " DRV_RELDATE "\n"
244 KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" 244 KERN_INFO " originally by Donald Becker <becker@scyld.com>\n"
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 08b218c5bfbc..93c494bcd18d 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -226,7 +226,7 @@ struct net_device * __init ne_probe(int unit)
226 netdev_boot_setup_check(dev); 226 netdev_boot_setup_check(dev);
227 227
228#ifdef CONFIG_TOSHIBA_RBTX4938 228#ifdef CONFIG_TOSHIBA_RBTX4938
229 dev->base_addr = 0x07f20280; 229 dev->base_addr = RBTX4938_RTL_8019_BASE;
230 dev->irq = RBTX4938_RTL_8019_IRQ; 230 dev->irq = RBTX4938_RTL_8019_IRQ;
231#endif 231#endif
232 err = do_ne_probe(dev); 232 err = do_ne_probe(dev);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 75b35ad760de..66e74f740261 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -87,6 +87,7 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
87} 87}
88 88
89static struct console netconsole = { 89static struct console netconsole = {
90 .name = "netcon",
90 .flags = CON_ENABLED | CON_PRINTBUFFER, 91 .flags = CON_ENABLED | CON_PRINTBUFFER,
91 .write = write_msg 92 .write = write_msg
92}; 93};
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 56233afcb2b3..448a09488529 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -1560,7 +1560,7 @@ static void ei_receive(struct net_device *dev)
1560 1560
1561static void ei_rx_overrun(struct net_device *dev) 1561static void ei_rx_overrun(struct net_device *dev)
1562{ 1562{
1563 axnet_dev_t *info = (axnet_dev_t *)dev; 1563 axnet_dev_t *info = PRIV(dev);
1564 long e8390_base = dev->base_addr; 1564 long e8390_base = dev->base_addr;
1565 unsigned char was_txing, must_resend = 0; 1565 unsigned char was_txing, must_resend = 0;
1566 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1566 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 35dbf05c7f06..a70c2b0cc104 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -78,6 +78,8 @@ static const struct pci_device_id skge_id_table[] = {
78 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, 78 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) },
79 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, 79 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) },
80 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, 80 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), },
81 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },
82 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) },
81 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, 83 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) },
82 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ 84 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */
83 { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, 85 { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) },
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 68f9c206a620..67b0eab16589 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -99,8 +99,6 @@ MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
99static const struct pci_device_id sky2_id_table[] = { 99static const struct pci_device_id sky2_id_table[] = {
100 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, 100 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
101 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, 101 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
102 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },
103 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) },
104 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, 102 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) },
105 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, 103 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) },
106 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, 104 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) },
@@ -579,8 +577,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
579 reg = gma_read16(hw, port, GM_PHY_ADDR); 577 reg = gma_read16(hw, port, GM_PHY_ADDR);
580 gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR); 578 gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR);
581 579
582 for (i = 0; i < GM_MIB_CNT_SIZE; i++) 580 for (i = GM_MIB_CNT_BASE; i <= GM_MIB_CNT_END; i += 4)
583 gma_read16(hw, port, GM_MIB_CNT_BASE + 8 * i); 581 gma_read16(hw, port, i);
584 gma_write16(hw, port, GM_PHY_ADDR, reg); 582 gma_write16(hw, port, GM_PHY_ADDR, reg);
585 583
586 /* transmit control */ 584 /* transmit control */
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 62532b4e45c5..89dd18cd12f0 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1375,7 +1375,7 @@ enum {
1375 GM_PHY_ADDR = 0x0088, /* 16 bit r/w GPHY Address Register */ 1375 GM_PHY_ADDR = 0x0088, /* 16 bit r/w GPHY Address Register */
1376/* MIB Counters */ 1376/* MIB Counters */
1377 GM_MIB_CNT_BASE = 0x0100, /* Base Address of MIB Counters */ 1377 GM_MIB_CNT_BASE = 0x0100, /* Base Address of MIB Counters */
1378 GM_MIB_CNT_SIZE = 256, 1378 GM_MIB_CNT_END = 0x025C, /* Last MIB counter */
1379}; 1379};
1380 1380
1381 1381
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 45ad036733e2..9b7805be21da 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -335,7 +335,7 @@ do { \
335 335
336 336
337/* These identify the driver base version and may not be removed. */ 337/* These identify the driver base version and may not be removed. */
338static char version[] __devinitdata = 338static const char version[] __devinitdata =
339KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" 339KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n"
340KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; 340KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n";
341 341
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index cb0aba95d4e3..046371ee5bbe 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -275,7 +275,7 @@ static int bcm5411_init(struct mii_phy* phy)
275 return 0; 275 return 0;
276} 276}
277 277
278static int bcm5411_suspend(struct mii_phy* phy) 278static int generic_suspend(struct mii_phy* phy)
279{ 279{
280 phy_write(phy, MII_BMCR, BMCR_PDOWN); 280 phy_write(phy, MII_BMCR, BMCR_PDOWN);
281 281
@@ -738,7 +738,7 @@ static struct mii_phy_def bcm5401_phy_def = {
738/* Broadcom BCM 5411 */ 738/* Broadcom BCM 5411 */
739static struct mii_phy_ops bcm5411_phy_ops = { 739static struct mii_phy_ops bcm5411_phy_ops = {
740 .init = bcm5411_init, 740 .init = bcm5411_init,
741 .suspend = bcm5411_suspend, 741 .suspend = generic_suspend,
742 .setup_aneg = bcm54xx_setup_aneg, 742 .setup_aneg = bcm54xx_setup_aneg,
743 .setup_forced = bcm54xx_setup_forced, 743 .setup_forced = bcm54xx_setup_forced,
744 .poll_link = genmii_poll_link, 744 .poll_link = genmii_poll_link,
@@ -757,7 +757,7 @@ static struct mii_phy_def bcm5411_phy_def = {
757/* Broadcom BCM 5421 */ 757/* Broadcom BCM 5421 */
758static struct mii_phy_ops bcm5421_phy_ops = { 758static struct mii_phy_ops bcm5421_phy_ops = {
759 .init = bcm5421_init, 759 .init = bcm5421_init,
760 .suspend = bcm5411_suspend, 760 .suspend = generic_suspend,
761 .setup_aneg = bcm54xx_setup_aneg, 761 .setup_aneg = bcm54xx_setup_aneg,
762 .setup_forced = bcm54xx_setup_forced, 762 .setup_forced = bcm54xx_setup_forced,
763 .poll_link = genmii_poll_link, 763 .poll_link = genmii_poll_link,
@@ -776,7 +776,7 @@ static struct mii_phy_def bcm5421_phy_def = {
776/* Broadcom BCM 5421 built-in K2 */ 776/* Broadcom BCM 5421 built-in K2 */
777static struct mii_phy_ops bcm5421k2_phy_ops = { 777static struct mii_phy_ops bcm5421k2_phy_ops = {
778 .init = bcm5421_init, 778 .init = bcm5421_init,
779 .suspend = bcm5411_suspend, 779 .suspend = generic_suspend,
780 .setup_aneg = bcm54xx_setup_aneg, 780 .setup_aneg = bcm54xx_setup_aneg,
781 .setup_forced = bcm54xx_setup_forced, 781 .setup_forced = bcm54xx_setup_forced,
782 .poll_link = genmii_poll_link, 782 .poll_link = genmii_poll_link,
@@ -795,7 +795,7 @@ static struct mii_phy_def bcm5421k2_phy_def = {
795/* Broadcom BCM 5462 built-in Vesta */ 795/* Broadcom BCM 5462 built-in Vesta */
796static struct mii_phy_ops bcm5462V_phy_ops = { 796static struct mii_phy_ops bcm5462V_phy_ops = {
797 .init = bcm5421_init, 797 .init = bcm5421_init,
798 .suspend = bcm5411_suspend, 798 .suspend = generic_suspend,
799 .setup_aneg = bcm54xx_setup_aneg, 799 .setup_aneg = bcm54xx_setup_aneg,
800 .setup_forced = bcm54xx_setup_forced, 800 .setup_forced = bcm54xx_setup_forced,
801 .poll_link = genmii_poll_link, 801 .poll_link = genmii_poll_link,
@@ -816,6 +816,7 @@ static struct mii_phy_def bcm5462V_phy_def = {
816 * would be useful here) --BenH. 816 * would be useful here) --BenH.
817 */ 817 */
818static struct mii_phy_ops marvell_phy_ops = { 818static struct mii_phy_ops marvell_phy_ops = {
819 .suspend = generic_suspend,
819 .setup_aneg = marvell_setup_aneg, 820 .setup_aneg = marvell_setup_aneg,
820 .setup_forced = marvell_setup_forced, 821 .setup_forced = marvell_setup_forced,
821 .poll_link = genmii_poll_link, 822 .poll_link = genmii_poll_link,
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 0b5358072172..73e271e59c6a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -497,21 +497,20 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
497 unsigned long flags; 497 unsigned long flags;
498 498
499 spin_lock_irqsave(&tp->indirect_lock, flags); 499 spin_lock_irqsave(&tp->indirect_lock, flags);
500 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 500 if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
501 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 501 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
502 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
502 503
503 /* Always leave this as zero. */ 504 /* Always leave this as zero. */
504 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 505 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
505 spin_unlock_irqrestore(&tp->indirect_lock, flags); 506 } else {
506} 507 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
508 tw32_f(TG3PCI_MEM_WIN_DATA, val);
507 509
508static void tg3_write_mem_fast(struct tg3 *tp, u32 off, u32 val) 510 /* Always leave this as zero. */
509{ 511 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
510 /* If no workaround is needed, write to mem space directly */ 512 }
511 if (tp->write32 != tg3_write_indirect_reg32) 513 spin_unlock_irqrestore(&tp->indirect_lock, flags);
512 tw32(NIC_SRAM_WIN_BASE + off, val);
513 else
514 tg3_write_mem(tp, off, val);
515} 514}
516 515
517static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) 516static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
@@ -519,11 +518,19 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
519 unsigned long flags; 518 unsigned long flags;
520 519
521 spin_lock_irqsave(&tp->indirect_lock, flags); 520 spin_lock_irqsave(&tp->indirect_lock, flags);
522 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 521 if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
523 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 522 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
523 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
524 524
525 /* Always leave this as zero. */ 525 /* Always leave this as zero. */
526 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 526 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
527 } else {
528 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
529 *val = tr32(TG3PCI_MEM_WIN_DATA);
530
531 /* Always leave this as zero. */
532 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
533 }
527 spin_unlock_irqrestore(&tp->indirect_lock, flags); 534 spin_unlock_irqrestore(&tp->indirect_lock, flags);
528} 535}
529 536
@@ -1367,12 +1374,12 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
1367 } 1374 }
1368 } 1375 }
1369 1376
1377 tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
1378
1370 /* Finally, set the new power state. */ 1379 /* Finally, set the new power state. */
1371 pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); 1380 pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
1372 udelay(100); /* Delay after power state change */ 1381 udelay(100); /* Delay after power state change */
1373 1382
1374 tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
1375
1376 return 0; 1383 return 0;
1377} 1384}
1378 1385
@@ -5828,10 +5835,14 @@ static int tg3_reset_hw(struct tg3 *tp)
5828 GRC_MODE_NO_TX_PHDR_CSUM | 5835 GRC_MODE_NO_TX_PHDR_CSUM |
5829 GRC_MODE_NO_RX_PHDR_CSUM); 5836 GRC_MODE_NO_RX_PHDR_CSUM);
5830 tp->grc_mode |= GRC_MODE_HOST_SENDBDS; 5837 tp->grc_mode |= GRC_MODE_HOST_SENDBDS;
5831 if (tp->tg3_flags & TG3_FLAG_NO_TX_PSEUDO_CSUM) 5838
5832 tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM; 5839 /* Pseudo-header checksum is done by hardware logic and not
5833 if (tp->tg3_flags & TG3_FLAG_NO_RX_PSEUDO_CSUM) 5840 * the offload processers, so make the chip do the pseudo-
5834 tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM; 5841 * header checksums on receive. For transmit it is more
5842 * convenient to do the pseudo-header checksum in software
5843 * as Linux does that on transmit for us in all cases.
5844 */
5845 tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM;
5835 5846
5836 tw32(GRC_MODE, 5847 tw32(GRC_MODE,
5837 tp->grc_mode | 5848 tp->grc_mode |
@@ -6535,11 +6546,11 @@ static void tg3_timer(unsigned long __opaque)
6535 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { 6546 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
6536 u32 val; 6547 u32 val;
6537 6548
6538 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_MBOX, 6549 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX,
6539 FWCMD_NICDRV_ALIVE2); 6550 FWCMD_NICDRV_ALIVE2);
6540 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); 6551 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4);
6541 /* 5 seconds timeout */ 6552 /* 5 seconds timeout */
6542 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); 6553 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5);
6543 val = tr32(GRC_RX_CPU_EVENT); 6554 val = tr32(GRC_RX_CPU_EVENT);
6544 val |= (1 << 14); 6555 val |= (1 << 14);
6545 tw32(GRC_RX_CPU_EVENT, val); 6556 tw32(GRC_RX_CPU_EVENT, val);
@@ -8034,9 +8045,13 @@ static int tg3_test_nvram(struct tg3 *tp)
8034 for (i = 0; i < size; i++) 8045 for (i = 0; i < size; i++)
8035 csum8 += buf8[i]; 8046 csum8 += buf8[i];
8036 8047
8037 if (csum8 == 0) 8048 if (csum8 == 0) {
8038 return 0; 8049 err = 0;
8039 return -EIO; 8050 goto out;
8051 }
8052
8053 err = -EIO;
8054 goto out;
8040 } 8055 }
8041 8056
8042 /* Bootstrap checksum at offset 0x10 */ 8057 /* Bootstrap checksum at offset 0x10 */
@@ -9531,8 +9546,11 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9531 tp->led_ctrl = LED_CTRL_MODE_PHY_1; 9546 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
9532 9547
9533 /* Do not even try poking around in here on Sun parts. */ 9548 /* Do not even try poking around in here on Sun parts. */
9534 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) 9549 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
9550 /* All SUN chips are built-in LOMs. */
9551 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9535 return; 9552 return;
9553 }
9536 9554
9537 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); 9555 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
9538 if (val == NIC_SRAM_DATA_SIG_MAGIC) { 9556 if (val == NIC_SRAM_DATA_SIG_MAGIC) {
@@ -9630,9 +9648,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9630 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 9648 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
9631 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 9649 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
9632 9650
9633 if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) && 9651 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)
9634 (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) &&
9635 (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP))
9636 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 9652 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9637 9653
9638 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { 9654 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
@@ -10257,6 +10273,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10257 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); 10273 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
10258 } 10274 }
10259 10275
10276 if (tp->write32 == tg3_write_indirect_reg32 ||
10277 ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
10278 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
10279 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) ||
10280 (tp->tg3_flags2 & TG3_FLG2_SUN_570X))
10281 tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG;
10282
10260 /* Get eeprom hw config before calling tg3_set_power_state(). 10283 /* Get eeprom hw config before calling tg3_set_power_state().
10261 * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be 10284 * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be
10262 * determined before calling tg3_set_power_state() so that 10285 * determined before calling tg3_set_power_state() so that
@@ -10299,15 +10322,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10299 if (tp->pci_chip_rev_id == CHIPREV_ID_5700_B0) 10322 if (tp->pci_chip_rev_id == CHIPREV_ID_5700_B0)
10300 tp->tg3_flags |= TG3_FLAG_BROKEN_CHECKSUMS; 10323 tp->tg3_flags |= TG3_FLAG_BROKEN_CHECKSUMS;
10301 10324
10302 /* Pseudo-header checksum is done by hardware logic and not
10303 * the offload processers, so make the chip do the pseudo-
10304 * header checksums on receive. For transmit it is more
10305 * convenient to do the pseudo-header checksum in software
10306 * as Linux does that on transmit for us in all cases.
10307 */
10308 tp->tg3_flags |= TG3_FLAG_NO_TX_PSEUDO_CSUM;
10309 tp->tg3_flags &= ~TG3_FLAG_NO_RX_PSEUDO_CSUM;
10310
10311 /* Derive initial jumbo mode from MTU assigned in 10325 /* Derive initial jumbo mode from MTU assigned in
10312 * ether_setup() via the alloc_etherdev() call 10326 * ether_setup() via the alloc_etherdev() call
10313 */ 10327 */
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index c43cc3264202..8c8b987d1250 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2171,8 +2171,7 @@ struct tg3 {
2171#define TG3_FLAG_PCIX_MODE 0x00020000 2171#define TG3_FLAG_PCIX_MODE 0x00020000
2172#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000 2172#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000
2173#define TG3_FLAG_PCI_32BIT 0x00080000 2173#define TG3_FLAG_PCI_32BIT 0x00080000
2174#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000 2174#define TG3_FLAG_SRAM_USE_CONFIG 0x00100000
2175#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000
2176#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 2175#define TG3_FLAG_SERDES_WOL_CAP 0x00400000
2177#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 2176#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000
2178#define TG3_FLAG_10_100_ONLY 0x01000000 2177#define TG3_FLAG_10_100_ONLY 0x01000000
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index c1ce87a5f8d3..d9258d42090c 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -134,7 +134,7 @@ static const int multicast_filter_limit = 32;
134#include "typhoon.h" 134#include "typhoon.h"
135#include "typhoon-firmware.h" 135#include "typhoon-firmware.h"
136 136
137static char version[] __devinitdata = 137static const char version[] __devinitdata =
138 "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 138 "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
139 139
140MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); 140MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index a9b2150909d6..6a23964c1317 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -469,7 +469,7 @@ struct rhine_private {
469 struct sk_buff *tx_skbuff[TX_RING_SIZE]; 469 struct sk_buff *tx_skbuff[TX_RING_SIZE];
470 dma_addr_t tx_skbuff_dma[TX_RING_SIZE]; 470 dma_addr_t tx_skbuff_dma[TX_RING_SIZE];
471 471
472 /* Tx bounce buffers */ 472 /* Tx bounce buffers (Rhine-I only) */
473 unsigned char *tx_buf[TX_RING_SIZE]; 473 unsigned char *tx_buf[TX_RING_SIZE];
474 unsigned char *tx_bufs; 474 unsigned char *tx_bufs;
475 dma_addr_t tx_bufs_dma; 475 dma_addr_t tx_bufs_dma;
@@ -1043,7 +1043,8 @@ static void alloc_tbufs(struct net_device* dev)
1043 rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC); 1043 rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
1044 next += sizeof(struct tx_desc); 1044 next += sizeof(struct tx_desc);
1045 rp->tx_ring[i].next_desc = cpu_to_le32(next); 1045 rp->tx_ring[i].next_desc = cpu_to_le32(next);
1046 rp->tx_buf[i] = &rp->tx_bufs[i * PKT_BUF_SZ]; 1046 if (rp->quirks & rqRhineI)
1047 rp->tx_buf[i] = &rp->tx_bufs[i * PKT_BUF_SZ];
1047 } 1048 }
1048 rp->tx_ring[i-1].next_desc = cpu_to_le32(rp->tx_ring_dma); 1049 rp->tx_ring[i-1].next_desc = cpu_to_le32(rp->tx_ring_dma);
1049 1050
@@ -1091,7 +1092,7 @@ static void rhine_check_media(struct net_device *dev, unsigned int init_media)
1091} 1092}
1092 1093
1093/* Called after status of force_media possibly changed */ 1094/* Called after status of force_media possibly changed */
1094void rhine_set_carrier(struct mii_if_info *mii) 1095static void rhine_set_carrier(struct mii_if_info *mii)
1095{ 1096{
1096 if (mii->force_media) { 1097 if (mii->force_media) {
1097 /* autoneg is off: Link is always assumed to be up */ 1098 /* autoneg is off: Link is always assumed to be up */
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 883cf7da10fc..b5328b0ff927 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -410,103 +410,6 @@ config WAN_ROUTER_DRIVERS
410 410
411 If unsure, say N. 411 If unsure, say N.
412 412
413config VENDOR_SANGOMA
414 tristate "Sangoma WANPIPE(tm) multiprotocol cards"
415 depends on WAN_ROUTER_DRIVERS && WAN_ROUTER && (PCI || ISA) && BROKEN
416 ---help---
417 Driver for S514-PCI/ISA Synchronous Data Link Adapters (SDLA).
418
419 WANPIPE from Sangoma Technologies Inc. <http://www.sangoma.com/>
420 is a family of intelligent multiprotocol WAN adapters with data
421 transfer rates up to 4Mbps. Cards support:
422
423 - X.25, Frame Relay, PPP, Cisco HDLC protocols.
424
425 - API for protocols like HDLC (LAPB), HDLC Streaming, X.25,
426 Frame Relay and BiSync.
427
428 - Ethernet Bridging over Frame Relay protocol.
429
430 - MULTILINK PPP
431
432 - Async PPP (Modem Dialup)
433
434 The next questions will ask you about the protocols you want
435 the driver to support.
436
437 If you have one or more of these cards, say M to this option;
438 and read <file:Documentation/networking/wan-router.txt>.
439
440 To compile this driver as a module, choose M here: the
441 module will be called wanpipe.
442
443config WANPIPE_CHDLC
444 bool "WANPIPE Cisco HDLC support"
445 depends on VENDOR_SANGOMA
446 ---help---
447 Connect a WANPIPE card to a leased line using the Cisco HDLC.
448
449 - Supports Dual Port Cisco HDLC on the S514-PCI/S508-ISA cards
450 which allows user to build applications using the HDLC streaming API.
451
452 - CHDLC Streaming MULTILINK PPP that can bind multiple WANPIPE T1
453 cards into a single logical channel.
454
455 Say Y and the Cisco HDLC support, HDLC streaming API and
456 MULTILINK PPP will be included in the driver.
457
458config WANPIPE_FR
459 bool "WANPIPE Frame Relay support"
460 depends on VENDOR_SANGOMA
461 help
462 Connect a WANPIPE card to a Frame Relay network, or use Frame Relay
463 API to develop custom applications.
464
465 Contains the Ethernet Bridging over Frame Relay feature, where
466 a WANPIPE frame relay link can be directly connected to the Linux
467 kernel bridge. The Frame Relay option is supported on S514-PCI
468 and S508-ISA cards.
469
470 Say Y and the Frame Relay support will be included in the driver.
471
472config WANPIPE_X25
473 bool "WANPIPE X.25 support"
474 depends on VENDOR_SANGOMA
475 help
476 Connect a WANPIPE card to an X.25 network.
477
478 Includes the X.25 API support for custom applications over the
479 X.25 protocol. The X.25 option is supported on S514-PCI and
480 S508-ISA cards.
481
482 Say Y and the X.25 support will be included in the driver.
483
484config WANPIPE_PPP
485 bool "WANPIPE PPP support"
486 depends on VENDOR_SANGOMA
487 help
488 Connect a WANPIPE card to a leased line using Point-to-Point
489 Protocol (PPP).
490
491 The PPP option is supported on S514-PCI/S508-ISA cards.
492
493 Say Y and the PPP support will be included in the driver.
494
495config WANPIPE_MULTPPP
496 bool "WANPIPE Multi-Port PPP support"
497 depends on VENDOR_SANGOMA
498 help
499 Connect a WANPIPE card to a leased line using Point-to-Point
500 Protocol (PPP).
501
502 Uses in-kernel SyncPPP protocol over the Sangoma HDLC Streaming
503 adapter. In this case each Sangoma adapter port can support an
504 independent PPP connection. For example, a single Quad-Port PCI
505 adapter can support up to four independent PPP links. The PPP
506 option is supported on S514-PCI/S508-ISA cards.
507
508 Say Y and the Multi-Port PPP support will be included in the driver.
509
510config CYCLADES_SYNC 413config CYCLADES_SYNC
511 tristate "Cyclom 2X(tm) cards (EXPERIMENTAL)" 414 tristate "Cyclom 2X(tm) cards (EXPERIMENTAL)"
512 depends on WAN_ROUTER_DRIVERS && (PCI || ISA) 415 depends on WAN_ROUTER_DRIVERS && (PCI || ISA)
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index ce6c56b903e7..823c6d5ab90d 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -5,14 +5,6 @@
5# Rewritten to use lists instead of if-statements. 5# Rewritten to use lists instead of if-statements.
6# 6#
7 7
8wanpipe-y := sdlamain.o sdla_ft1.o
9wanpipe-$(CONFIG_WANPIPE_X25) += sdla_x25.o
10wanpipe-$(CONFIG_WANPIPE_FR) += sdla_fr.o
11wanpipe-$(CONFIG_WANPIPE_CHDLC) += sdla_chdlc.o
12wanpipe-$(CONFIG_WANPIPE_PPP) += sdla_ppp.o
13wanpipe-$(CONFIG_WANPIPE_MULTPPP) += wanpipe_multppp.o
14wanpipe-objs := $(wanpipe-y)
15
16cyclomx-y := cycx_main.o 8cyclomx-y := cycx_main.o
17cyclomx-$(CONFIG_CYCLOMX_X25) += cycx_x25.o 9cyclomx-$(CONFIG_CYCLOMX_X25) += cycx_x25.o
18cyclomx-objs := $(cyclomx-y) 10cyclomx-objs := $(cyclomx-y)
@@ -43,11 +35,6 @@ obj-$(CONFIG_LANMEDIA) += lmc/
43 35
44obj-$(CONFIG_DLCI) += dlci.o 36obj-$(CONFIG_DLCI) += dlci.o
45obj-$(CONFIG_SDLA) += sdla.o 37obj-$(CONFIG_SDLA) += sdla.o
46ifeq ($(CONFIG_WANPIPE_MULTPPP),y)
47 obj-$(CONFIG_VENDOR_SANGOMA) += sdladrv.o wanpipe.o syncppp.o
48else
49 obj-$(CONFIG_VENDOR_SANGOMA) += sdladrv.o wanpipe.o
50endif
51obj-$(CONFIG_CYCLADES_SYNC) += cycx_drv.o cyclomx.o 38obj-$(CONFIG_CYCLADES_SYNC) += cycx_drv.o cyclomx.o
52obj-$(CONFIG_LAPBETHER) += lapbether.o 39obj-$(CONFIG_LAPBETHER) += lapbether.o
53obj-$(CONFIG_SBNI) += sbni.o 40obj-$(CONFIG_SBNI) += sbni.o
diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c
deleted file mode 100644
index 496d29237e92..000000000000
--- a/drivers/net/wan/sdla_chdlc.c
+++ /dev/null
@@ -1,4428 +0,0 @@
1/*****************************************************************************
2* sdla_chdlc.c WANPIPE(tm) Multiprotocol WAN Link Driver. Cisco HDLC module.
3*
4* Authors: Nenad Corbic <ncorbic@sangoma.com>
5* Gideon Hack
6*
7* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Feb 28, 2001 Nenad Corbic Updated if_tx_timeout() routine for
15* 2.4.X kernels.
16* Jan 25, 2001 Nenad Corbic Added a TTY Sync serial driver over the
17* HDLC streaming protocol
18* Added a TTY Async serial driver over the
19* Async protocol.
20* Dec 15, 2000 Nenad Corbic Updated for 2.4.X Kernel support
21* Nov 13, 2000 Nenad Corbic Added true interface type encoding option.
22* Tcpdump doesn't support CHDLC inteface
23* types, to fix this "true type" option will set
24* the interface type to RAW IP mode.
25* Nov 07, 2000 Nenad Corbic Added security features for UDP debugging:
26* Deny all and specify allowed requests.
27* Jun 20, 2000 Nenad Corbic Fixed the API IP ERROR bug. Caused by the
28* latest update.
29* May 09, 2000 Nenad Corbic Option to bring down an interface
30* upon disconnect.
31* Mar 23, 2000 Nenad Corbic Improved task queue, bh handling.
32* Mar 16, 2000 Nenad Corbic Fixed the SLARP Dynamic IP addressing.
33* Mar 06, 2000 Nenad Corbic Bug Fix: corrupted mbox recovery.
34* Feb 10, 2000 Gideon Hack Added ASYNC support.
35* Feb 09, 2000 Nenad Corbic Fixed two shutdown bugs in update() and
36* if_stats() functions.
37* Jan 24, 2000 Nenad Corbic Fixed a startup wanpipe state racing,
38* condition between if_open and isr.
39* Jan 10, 2000 Nenad Corbic Added new socket API support.
40* Dev 15, 1999 Nenad Corbic Fixed up header files for 2.0.X kernels
41* Nov 20, 1999 Nenad Corbic Fixed zero length API bug.
42* Sep 30, 1999 Nenad Corbic Fixed dynamic IP and route setup.
43* Sep 23, 1999 Nenad Corbic Added SMP support, fixed tracing
44* Sep 13, 1999 Nenad Corbic Split up Port 0 and 1 into separate devices.
45* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
46* Oct 30, 1998 Jaspreet Singh Added Support for CHDLC API (HDLC STREAMING).
47* Oct 28, 1998 Jaspreet Singh Added Support for Dual Port CHDLC.
48* Aug 07, 1998 David Fong Initial version.
49*****************************************************************************/
50
51#include <linux/module.h>
52#include <linux/kernel.h> /* printk(), and other useful stuff */
53#include <linux/stddef.h> /* offsetof(), etc. */
54#include <linux/errno.h> /* return codes */
55#include <linux/string.h> /* inline memset(), etc. */
56#include <linux/slab.h> /* kmalloc(), kfree() */
57#include <linux/wanrouter.h> /* WAN router definitions */
58#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
59#include <linux/if_arp.h> /* ARPHRD_* defines */
60
61
62#include <asm/uaccess.h>
63#include <linux/inetdevice.h>
64#include <linux/netdevice.h>
65
66#include <linux/in.h> /* sockaddr_in */
67#include <linux/inet.h>
68#include <linux/if.h>
69#include <asm/byteorder.h> /* htons(), etc. */
70#include <linux/sdlapci.h>
71#include <asm/io.h>
72
73#include <linux/sdla_chdlc.h> /* CHDLC firmware API definitions */
74#include <linux/sdla_asy.h> /* CHDLC (async) API definitions */
75
76#include <linux/if_wanpipe_common.h> /* Socket Driver common area */
77#include <linux/if_wanpipe.h>
78
79/* TTY Includes */
80#include <linux/tty.h>
81#include <linux/tty_flip.h>
82#include <linux/serial.h>
83
84
85/****** Defines & Macros ****************************************************/
86
87/* reasons for enabling the timer interrupt on the adapter */
88#define TMR_INT_ENABLED_UDP 0x01
89#define TMR_INT_ENABLED_UPDATE 0x02
90#define TMR_INT_ENABLED_CONFIG 0x10
91
92#define MAX_IP_ERRORS 10
93
94#define TTY_CHDLC_MAX_MTU 2000
95#define CHDLC_DFLT_DATA_LEN 1500 /* default MTU */
96#define CHDLC_HDR_LEN 1
97
98#define CHDLC_API 0x01
99
100#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" )
101#define MAX_BH_BUFF 10
102
103//#define PRINT_DEBUG
104#ifdef PRINT_DEBUG
105#define dbg_printk(format, a...) printk(format, ## a)
106#else
107#define dbg_printk(format, a...)
108#endif
109
110/******Data Structures*****************************************************/
111
112/* This structure is placed in the private data area of the device structure.
113 * The card structure used to occupy the private area but now the following
114 * structure will incorporate the card structure along with CHDLC specific data
115 */
116
117typedef struct chdlc_private_area
118{
119 wanpipe_common_t common;
120 sdla_t *card;
121 int TracingEnabled; /* For enabling Tracing */
122 unsigned long curr_trace_addr; /* Used for Tracing */
123 unsigned long start_trace_addr;
124 unsigned long end_trace_addr;
125 unsigned long base_addr_trace_buffer;
126 unsigned long end_addr_trace_buffer;
127 unsigned short number_trace_elements;
128 unsigned available_buffer_space;
129 unsigned long router_start_time;
130 unsigned char route_status;
131 unsigned char route_removed;
132 unsigned long tick_counter; /* For 5s timeout counter */
133 unsigned long router_up_time;
134 u32 IP_address; /* IP addressing */
135 u32 IP_netmask;
136 u32 ip_local;
137 u32 ip_remote;
138 u32 ip_local_tmp;
139 u32 ip_remote_tmp;
140 u8 ip_error;
141 u8 config_chdlc;
142 u8 config_chdlc_timeout;
143 unsigned char mc; /* Mulitcast support on/off */
144 unsigned short udp_pkt_lgth; /* udp packet processing */
145 char udp_pkt_src;
146 char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
147 unsigned short timer_int_enabled;
148 char update_comms_stats; /* updating comms stats */
149
150 bh_data_t *bh_head; /* Circular buffer for chdlc_bh */
151 unsigned long tq_working;
152 volatile int bh_write;
153 volatile int bh_read;
154 atomic_t bh_buff_used;
155
156 unsigned char interface_down;
157
158 /* Polling work queue entry. Each interface
159 * has its own work queue entry, which is used
160 * to defer events from the interrupt */
161 struct work_struct poll_work;
162 struct timer_list poll_delay_timer;
163
164 u8 gateway;
165 u8 true_if_encoding;
166 //FIXME: add driver stats as per frame relay!
167
168} chdlc_private_area_t;
169
170/* Route Status options */
171#define NO_ROUTE 0x00
172#define ADD_ROUTE 0x01
173#define ROUTE_ADDED 0x02
174#define REMOVE_ROUTE 0x03
175
176
177/* variable for keeping track of enabling/disabling FT1 monitor status */
178static int rCount = 0;
179
180/* variable for tracking how many interfaces to open for WANPIPE on the
181 two ports */
182
183extern void disable_irq(unsigned int);
184extern void enable_irq(unsigned int);
185
186/****** Function Prototypes *************************************************/
187/* WAN link driver entry points. These are called by the WAN router module. */
188static int update(struct wan_device* wandev);
189static int new_if(struct wan_device* wandev, struct net_device* dev,
190 wanif_conf_t* conf);
191
192/* Network device interface */
193static int if_init(struct net_device* dev);
194static int if_open(struct net_device* dev);
195static int if_close(struct net_device* dev);
196static int if_header(struct sk_buff* skb, struct net_device* dev,
197 unsigned short type, void* daddr, void* saddr,
198 unsigned len);
199
200static int if_rebuild_hdr (struct sk_buff *skb);
201static struct net_device_stats* if_stats(struct net_device* dev);
202
203static int if_send(struct sk_buff* skb, struct net_device* dev);
204
205/* CHDLC Firmware interface functions */
206static int chdlc_configure (sdla_t* card, void* data);
207static int chdlc_comm_enable (sdla_t* card);
208static int chdlc_read_version (sdla_t* card, char* str);
209static int chdlc_set_intr_mode (sdla_t* card, unsigned mode);
210static int chdlc_send (sdla_t* card, void* data, unsigned len);
211static int chdlc_read_comm_err_stats (sdla_t* card);
212static int chdlc_read_op_stats (sdla_t* card);
213static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb);
214
215
216static int chdlc_disable_comm_shutdown (sdla_t *card);
217static void if_tx_timeout(struct net_device *dev);
218
219/* Miscellaneous CHDLC Functions */
220static int set_chdlc_config (sdla_t* card);
221static void init_chdlc_tx_rx_buff( sdla_t* card);
222static int process_chdlc_exception(sdla_t *card);
223static int process_global_exception(sdla_t *card);
224static int update_comms_stats(sdla_t* card,
225 chdlc_private_area_t* chdlc_priv_area);
226static int configure_ip (sdla_t* card);
227static int unconfigure_ip (sdla_t* card);
228static void process_route(sdla_t *card);
229static void port_set_state (sdla_t *card, int);
230static int config_chdlc (sdla_t *card);
231static void disable_comm (sdla_t *card);
232
233static void trigger_chdlc_poll(struct net_device *dev);
234static void chdlc_poll(struct net_device *dev);
235static void chdlc_poll_delay (unsigned long dev_ptr);
236
237
238/* Miscellaneous asynchronous interface Functions */
239static int set_asy_config (sdla_t* card);
240static int asy_comm_enable (sdla_t* card);
241
242/* Interrupt handlers */
243static void wpc_isr (sdla_t* card);
244static void rx_intr (sdla_t* card);
245static void timer_intr(sdla_t *);
246
247/* Bottom half handlers */
248static void chdlc_work(struct net_device *dev);
249static int chdlc_work_cleanup(struct net_device *dev);
250static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
251
252/* Miscellaneous functions */
253static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev,
254 struct sk_buff *skb);
255static int reply_udp( unsigned char *data, unsigned int mbox_len );
256static int intr_test( sdla_t* card);
257static int udp_pkt_type( struct sk_buff *skb , sdla_t* card);
258static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
259 struct sk_buff *skb, struct net_device* dev,
260 chdlc_private_area_t* chdlc_priv_area);
261static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
262 chdlc_private_area_t* chdlc_priv_area);
263static unsigned short calc_checksum (char *, int);
264static void s508_lock (sdla_t *card, unsigned long *smp_flags);
265static void s508_unlock (sdla_t *card, unsigned long *smp_flags);
266
267
268static int Intr_test_counter;
269
270/* TTY Global Definitions */
271
272#define NR_PORTS 4
273#define WAN_TTY_MAJOR 226
274#define WAN_TTY_MINOR 0
275
276#define WAN_CARD(port) (tty_card_map[port])
277#define MIN_PORT 0
278#define MAX_PORT NR_PORTS-1
279
280#define CRC_LENGTH 2
281
282static int wanpipe_tty_init(sdla_t *card);
283static void wanpipe_tty_receive(sdla_t *, unsigned, unsigned int);
284static void wanpipe_tty_trigger_poll(sdla_t *card);
285
286static struct tty_driver serial_driver;
287static int tty_init_cnt=0;
288
289static struct serial_state rs_table[NR_PORTS];
290
291static char tty_driver_mode=WANOPT_TTY_SYNC;
292
293static char *opt_decode[] = {"NONE","CRTSCTS","XONXOFF-RX",
294 "CRTSCTS XONXOFF-RX","XONXOFF-TX",
295 "CRTSCTS XONXOFF-TX","CRTSCTS XONXOFF"};
296static char *p_decode[] = {"NONE","ODD","EVEN"};
297
298static void* tty_card_map[NR_PORTS] = {NULL,NULL,NULL,NULL};
299
300
301/****** Public Functions ****************************************************/
302
303/*============================================================================
304 * Cisco HDLC protocol initialization routine.
305 *
306 * This routine is called by the main WANPIPE module during setup. At this
307 * point adapter is completely initialized and firmware is running.
308 * o read firmware version (to make sure it's alive)
309 * o configure adapter
310 * o initialize protocol-specific fields of the adapter data space.
311 *
312 * Return: 0 o.k.
313 * < 0 failure.
314 */
315int wpc_init (sdla_t* card, wandev_conf_t* conf)
316{
317 unsigned char port_num;
318 int err;
319 unsigned long max_permitted_baud = 0;
320 SHARED_MEMORY_INFO_STRUCT *flags;
321
322 union
323 {
324 char str[80];
325 } u;
326 volatile CHDLC_MAILBOX_STRUCT* mb;
327 CHDLC_MAILBOX_STRUCT* mb1;
328 unsigned long timeout;
329
330 /* Verify configuration ID */
331 if (conf->config_id != WANCONFIG_CHDLC) {
332 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
333 card->devname, conf->config_id);
334 return -EINVAL;
335 }
336
337 /* Find out which Port to use */
338 if ((conf->comm_port == WANOPT_PRI) || (conf->comm_port == WANOPT_SEC)){
339 if (card->next){
340
341 if (conf->comm_port != card->next->u.c.comm_port){
342 card->u.c.comm_port = conf->comm_port;
343 }else{
344 printk(KERN_INFO "%s: ERROR - %s port used!\n",
345 card->wandev.name, PORT(conf->comm_port));
346 return -EINVAL;
347 }
348 }else{
349 card->u.c.comm_port = conf->comm_port;
350 }
351 }else{
352 printk(KERN_INFO "%s: ERROR - Invalid Port Selected!\n",
353 card->wandev.name);
354 return -EINVAL;
355 }
356
357
358 /* Initialize protocol-specific fields */
359 if(card->hw.type != SDLA_S514){
360
361 if (card->u.c.comm_port == WANOPT_PRI){
362 card->mbox = (void *) card->hw.dpmbase;
363 }else{
364 card->mbox = (void *) card->hw.dpmbase +
365 SEC_BASE_ADDR_MB_STRUCT - PRI_BASE_ADDR_MB_STRUCT;
366 }
367 }else{
368 /* for a S514 adapter, set a pointer to the actual mailbox in the */
369 /* allocated virtual memory area */
370 if (card->u.c.comm_port == WANOPT_PRI){
371 card->mbox = (void *) card->hw.dpmbase + PRI_BASE_ADDR_MB_STRUCT;
372 }else{
373 card->mbox = (void *) card->hw.dpmbase + SEC_BASE_ADDR_MB_STRUCT;
374 }
375 }
376
377 mb = mb1 = card->mbox;
378
379 if (!card->configured){
380
381 /* The board will place an 'I' in the return code to indicate that it is
382 ready to accept commands. We expect this to be completed in less
383 than 1 second. */
384
385 timeout = jiffies;
386 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
387 if ((jiffies - timeout) > 1*HZ) break;
388
389 if (mb->return_code != 'I') {
390 printk(KERN_INFO
391 "%s: Initialization not completed by adapter\n",
392 card->devname);
393 printk(KERN_INFO "Please contact Sangoma representative.\n");
394 return -EIO;
395 }
396 }
397
398 /* Read firmware version. Note that when adapter initializes, it
399 * clears the mailbox, so it may appear that the first command was
400 * executed successfully when in fact it was merely erased. To work
401 * around this, we execute the first command twice.
402 */
403
404 if (chdlc_read_version(card, u.str))
405 return -EIO;
406
407 printk(KERN_INFO "%s: Running Cisco HDLC firmware v%s\n",
408 card->devname, u.str);
409
410 card->isr = &wpc_isr;
411 card->poll = NULL;
412 card->exec = NULL;
413 card->wandev.update = &update;
414 card->wandev.new_if = &new_if;
415 card->wandev.del_if = NULL;
416 card->wandev.udp_port = conf->udp_port;
417 card->disable_comm = &disable_comm;
418 card->wandev.new_if_cnt = 0;
419
420 /* reset the number of times the 'update()' proc has been called */
421 card->u.c.update_call_count = 0;
422
423 card->wandev.ttl = conf->ttl;
424 card->wandev.interface = conf->interface;
425
426 if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&&
427 card->hw.type != SDLA_S514){
428 printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n",
429 card->devname, PORT(card->u.c.comm_port));
430 return -EIO;
431 }
432
433 card->wandev.clocking = conf->clocking;
434
435 port_num = card->u.c.comm_port;
436
437 /* in API mode, we can configure for "receive only" buffering */
438 if(card->hw.type == SDLA_S514) {
439 card->u.c.receive_only = conf->receive_only;
440 if(conf->receive_only) {
441 printk(KERN_INFO
442 "%s: Configured for 'receive only' mode\n",
443 card->devname);
444 }
445 }
446
447 /* Setup Port Bps */
448
449 if(card->wandev.clocking) {
450 if((port_num == WANOPT_PRI) || card->u.c.receive_only) {
451 /* For Primary Port 0 */
452 max_permitted_baud =
453 (card->hw.type == SDLA_S514) ?
454 PRI_MAX_BAUD_RATE_S514 :
455 PRI_MAX_BAUD_RATE_S508;
456
457 }else if(port_num == WANOPT_SEC) {
458 /* For Secondary Port 1 */
459 max_permitted_baud =
460 (card->hw.type == SDLA_S514) ?
461 SEC_MAX_BAUD_RATE_S514 :
462 SEC_MAX_BAUD_RATE_S508;
463 }
464
465 if(conf->bps > max_permitted_baud) {
466 conf->bps = max_permitted_baud;
467 printk(KERN_INFO "%s: Baud too high!\n",
468 card->wandev.name);
469 printk(KERN_INFO "%s: Baud rate set to %lu bps\n",
470 card->wandev.name, max_permitted_baud);
471 }
472 card->wandev.bps = conf->bps;
473 }else{
474 card->wandev.bps = 0;
475 }
476
477 /* Setup the Port MTU */
478 if((port_num == WANOPT_PRI) || card->u.c.receive_only) {
479
480 /* For Primary Port 0 */
481 card->wandev.mtu =
482 (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
483 min_t(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
484 CHDLC_DFLT_DATA_LEN;
485 } else if(port_num == WANOPT_SEC) {
486 /* For Secondary Port 1 */
487 card->wandev.mtu =
488 (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
489 min_t(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
490 CHDLC_DFLT_DATA_LEN;
491 }
492
493 /* Set up the interrupt status area */
494 /* Read the CHDLC Configuration and obtain:
495 * Ptr to shared memory infor struct
496 * Use this pointer to calculate the value of card->u.c.flags !
497 */
498 mb1->buffer_length = 0;
499 mb1->command = READ_CHDLC_CONFIGURATION;
500 err = sdla_exec(mb1) ? mb1->return_code : CMD_TIMEOUT;
501 if(err != COMMAND_OK) {
502 if(card->hw.type != SDLA_S514)
503 enable_irq(card->hw.irq);
504
505 chdlc_error(card, err, mb1);
506 return -EIO;
507 }
508
509 if(card->hw.type == SDLA_S514){
510 card->u.c.flags = (void *)(card->hw.dpmbase +
511 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
512 ptr_shared_mem_info_struct));
513 }else{
514 card->u.c.flags = (void *)(card->hw.dpmbase +
515 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
516 ptr_shared_mem_info_struct % SDLA_WINDOWSIZE));
517 }
518
519 flags = card->u.c.flags;
520
521 /* This is for the ports link state */
522 card->wandev.state = WAN_DUALPORT;
523 card->u.c.state = WAN_DISCONNECTED;
524
525
526 if (!card->wandev.piggyback){
527 int err;
528
529 /* Perform interrupt testing */
530 err = intr_test(card);
531
532 if(err || (Intr_test_counter < MAX_INTR_TEST_COUNTER)) {
533 printk(KERN_INFO "%s: Interrupt test failed (%i)\n",
534 card->devname, Intr_test_counter);
535 printk(KERN_INFO "%s: Please choose another interrupt\n",
536 card->devname);
537 return -EIO;
538 }
539
540 printk(KERN_INFO "%s: Interrupt test passed (%i)\n",
541 card->devname, Intr_test_counter);
542 card->configured = 1;
543 }
544
545 if ((card->tty_opt=conf->tty) == WANOPT_YES){
546 int err;
547 card->tty_minor = conf->tty_minor;
548
549 /* On ASYNC connections internal clocking
550 * is mandatory */
551 if ((card->u.c.async_mode = conf->tty_mode)){
552 card->wandev.clocking = 1;
553 }
554 err=wanpipe_tty_init(card);
555 if (err){
556 return err;
557 }
558 }else{
559
560
561 if (chdlc_set_intr_mode(card, APP_INT_ON_TIMER)){
562 printk (KERN_INFO "%s: "
563 "Failed to set interrupt triggers!\n",
564 card->devname);
565 return -EIO;
566 }
567
568 /* Mask the Timer interrupt */
569 flags->interrupt_info_struct.interrupt_permission &=
570 ~APP_INT_ON_TIMER;
571 }
572
573 /* If we are using CHDLC in backup mode, this flag will
574 * indicate not to look for IP addresses in config_chdlc()*/
575 card->u.c.backup = conf->backup;
576
577 printk(KERN_INFO "\n");
578
579 return 0;
580}
581
582/******* WAN Device Driver Entry Points *************************************/
583
584/*============================================================================
585 * Update device status & statistics
586 * This procedure is called when updating the PROC file system and returns
587 * various communications statistics. These statistics are accumulated from 3
588 * different locations:
589 * 1) The 'if_stats' recorded for the device.
590 * 2) Communication error statistics on the adapter.
591 * 3) CHDLC operational statistics on the adapter.
592 * The board level statistics are read during a timer interrupt. Note that we
593 * read the error and operational statistics during consecitive timer ticks so
594 * as to minimize the time that we are inside the interrupt handler.
595 *
596 */
597static int update(struct wan_device* wandev)
598{
599 sdla_t* card = wandev->private;
600 struct net_device* dev;
601 volatile chdlc_private_area_t* chdlc_priv_area;
602 SHARED_MEMORY_INFO_STRUCT *flags;
603 unsigned long timeout;
604
605 /* sanity checks */
606 if((wandev == NULL) || (wandev->private == NULL))
607 return -EFAULT;
608
609 if(wandev->state == WAN_UNCONFIGURED)
610 return -ENODEV;
611
612 /* more sanity checks */
613 if(!card->u.c.flags)
614 return -ENODEV;
615
616 if(test_bit(PERI_CRIT, (void*)&card->wandev.critical))
617 return -EAGAIN;
618
619 if((dev=card->wandev.dev) == NULL)
620 return -ENODEV;
621
622 if((chdlc_priv_area=dev->priv) == NULL)
623 return -ENODEV;
624
625 flags = card->u.c.flags;
626 if(chdlc_priv_area->update_comms_stats){
627 return -EAGAIN;
628 }
629
630 /* we will need 2 timer interrupts to complete the */
631 /* reading of the statistics */
632 chdlc_priv_area->update_comms_stats = 2;
633 flags->interrupt_info_struct.interrupt_permission |= APP_INT_ON_TIMER;
634 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE;
635
636 /* wait a maximum of 1 second for the statistics to be updated */
637 timeout = jiffies;
638 for(;;) {
639 if(chdlc_priv_area->update_comms_stats == 0)
640 break;
641 if ((jiffies - timeout) > (1 * HZ)){
642 chdlc_priv_area->update_comms_stats = 0;
643 chdlc_priv_area->timer_int_enabled &=
644 ~TMR_INT_ENABLED_UPDATE;
645 return -EAGAIN;
646 }
647 }
648
649 return 0;
650}
651
652
653/*============================================================================
654 * Create new logical channel.
655 * This routine is called by the router when ROUTER_IFNEW IOCTL is being
656 * handled.
657 * o parse media- and hardware-specific configuration
658 * o make sure that a new channel can be created
659 * o allocate resources, if necessary
660 * o prepare network device structure for registaration.
661 *
662 * Return: 0 o.k.
663 * < 0 failure (channel will not be created)
664 */
665static int new_if(struct wan_device* wandev, struct net_device* dev,
666 wanif_conf_t* conf)
667{
668 sdla_t* card = wandev->private;
669 chdlc_private_area_t* chdlc_priv_area;
670
671
672 printk(KERN_INFO "%s: Configuring Interface: %s\n",
673 card->devname, conf->name);
674
675 if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)) {
676 printk(KERN_INFO "%s: Invalid interface name!\n",
677 card->devname);
678 return -EINVAL;
679 }
680
681 /* allocate and initialize private data */
682 chdlc_priv_area = kmalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
683
684 if(chdlc_priv_area == NULL)
685 return -ENOMEM;
686
687 memset(chdlc_priv_area, 0, sizeof(chdlc_private_area_t));
688
689 chdlc_priv_area->card = card;
690 chdlc_priv_area->common.sk = NULL;
691 chdlc_priv_area->common.func = NULL;
692
693 /* initialize data */
694 strcpy(card->u.c.if_name, conf->name);
695
696 if(card->wandev.new_if_cnt > 0) {
697 kfree(chdlc_priv_area);
698 return -EEXIST;
699 }
700
701 card->wandev.new_if_cnt++;
702
703 chdlc_priv_area->TracingEnabled = 0;
704 chdlc_priv_area->route_status = NO_ROUTE;
705 chdlc_priv_area->route_removed = 0;
706
707 card->u.c.async_mode = conf->async_mode;
708
709 /* setup for asynchronous mode */
710 if(conf->async_mode) {
711 printk(KERN_INFO "%s: Configuring for asynchronous mode\n",
712 wandev->name);
713
714 if(card->u.c.comm_port == WANOPT_PRI) {
715 printk(KERN_INFO
716 "%s:Asynchronous mode on secondary port only\n",
717 wandev->name);
718 kfree(chdlc_priv_area);
719 return -EINVAL;
720 }
721
722 if(strcmp(conf->usedby, "WANPIPE") == 0) {
723 printk(KERN_INFO
724 "%s: Running in WANIPE Async Mode\n", wandev->name);
725 card->u.c.usedby = WANPIPE;
726 }else{
727 card->u.c.usedby = API;
728 }
729
730 if(!card->wandev.clocking) {
731 printk(KERN_INFO
732 "%s: Asynch. clocking must be 'Internal'\n",
733 wandev->name);
734 kfree(chdlc_priv_area);
735 return -EINVAL;
736 }
737
738 if((card->wandev.bps < MIN_ASY_BAUD_RATE) ||
739 (card->wandev.bps > MAX_ASY_BAUD_RATE)) {
740 printk(KERN_INFO "%s: Selected baud rate is invalid.\n",
741 wandev->name);
742 printk(KERN_INFO "Must be between %u and %u bps.\n",
743 MIN_ASY_BAUD_RATE, MAX_ASY_BAUD_RATE);
744 kfree(chdlc_priv_area);
745 return -EINVAL;
746 }
747
748 card->u.c.api_options = 0;
749 if (conf->asy_data_trans == WANOPT_YES) {
750 card->u.c.api_options |= ASY_RX_DATA_TRANSPARENT;
751 }
752
753 card->u.c.protocol_options = 0;
754 if (conf->rts_hs_for_receive == WANOPT_YES) {
755 card->u.c.protocol_options |= ASY_RTS_HS_FOR_RX;
756 }
757 if (conf->xon_xoff_hs_for_receive == WANOPT_YES) {
758 card->u.c.protocol_options |= ASY_XON_XOFF_HS_FOR_RX;
759 }
760 if (conf->xon_xoff_hs_for_transmit == WANOPT_YES) {
761 card->u.c.protocol_options |= ASY_XON_XOFF_HS_FOR_TX;
762 }
763 if (conf->dcd_hs_for_transmit == WANOPT_YES) {
764 card->u.c.protocol_options |= ASY_DCD_HS_FOR_TX;
765 }
766 if (conf->cts_hs_for_transmit == WANOPT_YES) {
767 card->u.c.protocol_options |= ASY_CTS_HS_FOR_TX;
768 }
769
770 card->u.c.tx_bits_per_char = conf->tx_bits_per_char;
771 card->u.c.rx_bits_per_char = conf->rx_bits_per_char;
772 card->u.c.stop_bits = conf->stop_bits;
773 card->u.c.parity = conf->parity;
774 card->u.c.break_timer = conf->break_timer;
775 card->u.c.inter_char_timer = conf->inter_char_timer;
776 card->u.c.rx_complete_length = conf->rx_complete_length;
777 card->u.c.xon_char = conf->xon_char;
778
779 } else { /* setup for synchronous mode */
780
781 card->u.c.protocol_options = 0;
782 if (conf->ignore_dcd == WANOPT_YES){
783 card->u.c.protocol_options |= IGNORE_DCD_FOR_LINK_STAT;
784 }
785 if (conf->ignore_cts == WANOPT_YES){
786 card->u.c.protocol_options |= IGNORE_CTS_FOR_LINK_STAT;
787 }
788
789 if (conf->ignore_keepalive == WANOPT_YES) {
790 card->u.c.protocol_options |=
791 IGNORE_KPALV_FOR_LINK_STAT;
792 card->u.c.kpalv_tx = MIN_Tx_KPALV_TIMER;
793 card->u.c.kpalv_rx = MIN_Rx_KPALV_TIMER;
794 card->u.c.kpalv_err = MIN_KPALV_ERR_TOL;
795
796 } else { /* Do not ignore keepalives */
797 card->u.c.kpalv_tx =
798 ((conf->keepalive_tx_tmr - MIN_Tx_KPALV_TIMER)
799 >= 0) ?
800 min_t(unsigned int, conf->keepalive_tx_tmr,MAX_Tx_KPALV_TIMER) :
801 DEFAULT_Tx_KPALV_TIMER;
802
803 card->u.c.kpalv_rx =
804 ((conf->keepalive_rx_tmr - MIN_Rx_KPALV_TIMER)
805 >= 0) ?
806 min_t(unsigned int, conf->keepalive_rx_tmr,MAX_Rx_KPALV_TIMER) :
807 DEFAULT_Rx_KPALV_TIMER;
808
809 card->u.c.kpalv_err =
810 ((conf->keepalive_err_margin-MIN_KPALV_ERR_TOL)
811 >= 0) ?
812 min_t(unsigned int, conf->keepalive_err_margin,
813 MAX_KPALV_ERR_TOL) :
814 DEFAULT_KPALV_ERR_TOL;
815 }
816
817 /* Setup slarp timer to control delay between slarps */
818 card->u.c.slarp_timer =
819 ((conf->slarp_timer - MIN_SLARP_REQ_TIMER) >= 0) ?
820 min_t(unsigned int, conf->slarp_timer, MAX_SLARP_REQ_TIMER) :
821 DEFAULT_SLARP_REQ_TIMER;
822
823 if (conf->hdlc_streaming == WANOPT_YES) {
824 printk(KERN_INFO "%s: Enabling HDLC STREAMING Mode\n",
825 wandev->name);
826 card->u.c.protocol_options = HDLC_STREAMING_MODE;
827 }
828
829 if ((chdlc_priv_area->true_if_encoding = conf->true_if_encoding) == WANOPT_YES){
830 printk(KERN_INFO
831 "%s: Enabling, true interface type encoding.\n",
832 card->devname);
833 }
834
835 /* Setup wanpipe as a router (WANPIPE) or as an API */
836 if( strcmp(conf->usedby, "WANPIPE") == 0) {
837
838 printk(KERN_INFO "%s: Running in WANPIPE mode!\n",
839 wandev->name);
840 card->u.c.usedby = WANPIPE;
841
842 /* Option to bring down the interface when
843 * the link goes down */
844 if (conf->if_down){
845 set_bit(DYN_OPT_ON,&chdlc_priv_area->interface_down);
846 printk(KERN_INFO
847 "%s: Dynamic interface configuration enabled\n",
848 card->devname);
849 }
850
851 } else if( strcmp(conf->usedby, "API") == 0) {
852 card->u.c.usedby = API;
853 printk(KERN_INFO "%s: Running in API mode !\n",
854 wandev->name);
855 }
856 }
857
858 /* Tells us that if this interface is a
859 * gateway or not */
860 if ((chdlc_priv_area->gateway = conf->gateway) == WANOPT_YES){
861 printk(KERN_INFO "%s: Interface %s is set as a gateway.\n",
862 card->devname,card->u.c.if_name);
863 }
864
865 /* Get Multicast Information */
866 chdlc_priv_area->mc = conf->mc;
867
868 /* prepare network device data space for registration */
869 strcpy(dev->name,card->u.c.if_name);
870
871 dev->init = &if_init;
872 dev->priv = chdlc_priv_area;
873
874 /* Initialize the polling work routine */
875 INIT_WORK(&chdlc_priv_area->poll_work, (void*)(void*)chdlc_poll, dev);
876
877 /* Initialize the polling delay timer */
878 init_timer(&chdlc_priv_area->poll_delay_timer);
879 chdlc_priv_area->poll_delay_timer.data = (unsigned long)dev;
880 chdlc_priv_area->poll_delay_timer.function = chdlc_poll_delay;
881
882 printk(KERN_INFO "\n");
883
884 return 0;
885}
886
887
888/****** Network Device Interface ********************************************/
889
890/*============================================================================
891 * Initialize Linux network interface.
892 *
893 * This routine is called only once for each interface, during Linux network
894 * interface registration. Returning anything but zero will fail interface
895 * registration.
896 */
897static int if_init(struct net_device* dev)
898{
899 chdlc_private_area_t* chdlc_priv_area = dev->priv;
900 sdla_t* card = chdlc_priv_area->card;
901 struct wan_device* wandev = &card->wandev;
902
903 /* Initialize device driver entry points */
904 dev->open = &if_open;
905 dev->stop = &if_close;
906 dev->hard_header = &if_header;
907 dev->rebuild_header = &if_rebuild_hdr;
908 dev->hard_start_xmit = &if_send;
909 dev->get_stats = &if_stats;
910 dev->tx_timeout = &if_tx_timeout;
911 dev->watchdog_timeo = TX_TIMEOUT;
912
913 /* Initialize media-specific parameters */
914 dev->flags |= IFF_POINTOPOINT;
915 dev->flags |= IFF_NOARP;
916
917 /* Enable Mulitcasting if user selected */
918 if (chdlc_priv_area->mc == WANOPT_YES){
919 dev->flags |= IFF_MULTICAST;
920 }
921
922 if (chdlc_priv_area->true_if_encoding){
923 dev->type = ARPHRD_HDLC; /* This breaks the tcpdump */
924 }else{
925 dev->type = ARPHRD_PPP;
926 }
927
928 dev->mtu = card->wandev.mtu;
929 /* for API usage, add the API header size to the requested MTU size */
930 if(card->u.c.usedby == API) {
931 dev->mtu += sizeof(api_tx_hdr_t);
932 }
933
934 dev->hard_header_len = CHDLC_HDR_LEN;
935
936 /* Initialize hardware parameters */
937 dev->irq = wandev->irq;
938 dev->dma = wandev->dma;
939 dev->base_addr = wandev->ioport;
940 dev->mem_start = wandev->maddr;
941 dev->mem_end = wandev->maddr + wandev->msize - 1;
942
943 /* Set transmit buffer queue length
944 * If too low packets will not be retransmitted
945 * by stack.
946 */
947 dev->tx_queue_len = 100;
948 SET_MODULE_OWNER(dev);
949
950 return 0;
951}
952
953/*============================================================================
954 * Open network interface.
955 * o enable communications and interrupts.
956 * o prevent module from unloading by incrementing use count
957 *
958 * Return 0 if O.k. or errno.
959 */
960static int if_open(struct net_device* dev)
961{
962 chdlc_private_area_t* chdlc_priv_area = dev->priv;
963 sdla_t* card = chdlc_priv_area->card;
964 struct timeval tv;
965 int err = 0;
966
967 /* Only one open per interface is allowed */
968
969 if (netif_running(dev))
970 return -EBUSY;
971
972 /* Initialize the work queue entry */
973 chdlc_priv_area->tq_working=0;
974
975 INIT_WORK(&chdlc_priv_area->common.wanpipe_work,
976 (void *)(void *)chdlc_work, dev);
977
978 /* Allocate and initialize BH circular buffer */
979 /* Add 1 to MAX_BH_BUFF so we don't have test with (MAX_BH_BUFF-1) */
980 chdlc_priv_area->bh_head = kmalloc((sizeof(bh_data_t)*(MAX_BH_BUFF+1)),GFP_ATOMIC);
981 memset(chdlc_priv_area->bh_head,0,(sizeof(bh_data_t)*(MAX_BH_BUFF+1)));
982 atomic_set(&chdlc_priv_area->bh_buff_used, 0);
983
984 do_gettimeofday(&tv);
985 chdlc_priv_area->router_start_time = tv.tv_sec;
986
987 netif_start_queue(dev);
988
989 wanpipe_open(card);
990
991 /* TTY is configured during wanpipe_set_termios
992 * call, not here */
993 if (card->tty_opt)
994 return err;
995
996 set_bit(0,&chdlc_priv_area->config_chdlc);
997 chdlc_priv_area->config_chdlc_timeout=jiffies;
998
999 /* Start the CHDLC configuration after 1sec delay.
1000 * This will give the interface initilization time
1001 * to finish its configuration */
1002 mod_timer(&chdlc_priv_area->poll_delay_timer, jiffies + HZ);
1003 return err;
1004}
1005
1006/*============================================================================
1007 * Close network interface.
1008 * o if this is the last close, then disable communications and interrupts.
1009 * o reset flags.
1010 */
1011static int if_close(struct net_device* dev)
1012{
1013 chdlc_private_area_t* chdlc_priv_area = dev->priv;
1014 sdla_t* card = chdlc_priv_area->card;
1015
1016 if (chdlc_priv_area->bh_head){
1017 int i;
1018 struct sk_buff *skb;
1019
1020 for (i=0; i<(MAX_BH_BUFF+1); i++){
1021 skb = ((bh_data_t *)&chdlc_priv_area->bh_head[i])->skb;
1022 if (skb != NULL){
1023 dev_kfree_skb_any(skb);
1024 }
1025 }
1026 kfree(chdlc_priv_area->bh_head);
1027 chdlc_priv_area->bh_head=NULL;
1028 }
1029
1030 netif_stop_queue(dev);
1031 wanpipe_close(card);
1032 del_timer(&chdlc_priv_area->poll_delay_timer);
1033 return 0;
1034}
1035
1036static void disable_comm (sdla_t *card)
1037{
1038 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
1039
1040 if (card->u.c.comm_enabled){
1041 chdlc_disable_comm_shutdown (card);
1042 }else{
1043 flags->interrupt_info_struct.interrupt_permission = 0;
1044 }
1045
1046 if (!tty_init_cnt)
1047 return;
1048
1049 if (card->tty_opt){
1050 struct serial_state * state;
1051 if (!(--tty_init_cnt)){
1052 int e1;
1053 serial_driver.refcount=0;
1054
1055 if ((e1 = tty_unregister_driver(&serial_driver)))
1056 printk("SERIAL: failed to unregister serial driver (%d)\n",
1057 e1);
1058 printk(KERN_INFO "%s: Unregistering TTY Driver, Major %i\n",
1059 card->devname,WAN_TTY_MAJOR);
1060 }
1061 card->tty=NULL;
1062 tty_card_map[card->tty_minor]=NULL;
1063 state = &rs_table[card->tty_minor];
1064 memset(state, 0, sizeof(*state));
1065 }
1066 return;
1067}
1068
1069
1070/*============================================================================
1071 * Build media header.
1072 *
1073 * The trick here is to put packet type (Ethertype) into 'protocol' field of
1074 * the socket buffer, so that we don't forget it. If packet type is not
1075 * supported, set skb->protocol to 0 and discard packet later.
1076 *
1077 * Return: media header length.
1078 */
1079static int if_header(struct sk_buff* skb, struct net_device* dev,
1080 unsigned short type, void* daddr, void* saddr,
1081 unsigned len)
1082{
1083 skb->protocol = htons(type);
1084
1085 return CHDLC_HDR_LEN;
1086}
1087
1088
1089/*============================================================================
1090 * Handle transmit timeout event from netif watchdog
1091 */
1092static void if_tx_timeout(struct net_device *dev)
1093{
1094 chdlc_private_area_t* chan = dev->priv;
1095 sdla_t *card = chan->card;
1096
1097 /* If our device stays busy for at least 5 seconds then we will
1098 * kick start the device by making dev->tbusy = 0. We expect
1099 * that our device never stays busy more than 5 seconds. So this
1100 * is only used as a last resort.
1101 */
1102
1103 ++card->wandev.stats.collisions;
1104
1105 printk (KERN_INFO "%s: Transmit timed out on %s\n", card->devname,dev->name);
1106 netif_wake_queue (dev);
1107}
1108
1109
1110
1111/*============================================================================
1112 * Re-build media header.
1113 *
1114 * Return: 1 physical address resolved.
1115 * 0 physical address not resolved
1116 */
1117static int if_rebuild_hdr (struct sk_buff *skb)
1118{
1119 return 1;
1120}
1121
1122
1123/*============================================================================
1124 * Send a packet on a network interface.
1125 * o set tbusy flag (marks start of the transmission) to block a timer-based
1126 * transmit from overlapping.
1127 * o check link state. If link is not up, then drop the packet.
1128 * o execute adapter send command.
1129 * o free socket buffer
1130 *
1131 * Return: 0 complete (socket buffer must be freed)
1132 * non-0 packet may be re-transmitted (tbusy must be set)
1133 *
1134 * Notes:
1135 * 1. This routine is called either by the protocol stack or by the "net
1136 * bottom half" (with interrupts enabled).
1137 * 2. Setting tbusy flag will inhibit further transmit requests from the
1138 * protocol stack and can be used for flow control with protocol layer.
1139 */
1140static int if_send(struct sk_buff* skb, struct net_device* dev)
1141{
1142 chdlc_private_area_t *chdlc_priv_area = dev->priv;
1143 sdla_t *card = chdlc_priv_area->card;
1144 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
1145 INTERRUPT_INFORMATION_STRUCT *chdlc_int = &flags->interrupt_info_struct;
1146 int udp_type = 0;
1147 unsigned long smp_flags;
1148 int err=0;
1149
1150 netif_stop_queue(dev);
1151
1152 if (skb == NULL){
1153 /* If we get here, some higher layer thinks we've missed an
1154 * tx-done interrupt.
1155 */
1156 printk(KERN_INFO "%s: interface %s got kicked!\n",
1157 card->devname, dev->name);
1158
1159 netif_wake_queue(dev);
1160 return 0;
1161 }
1162
1163 if (ntohs(skb->protocol) != htons(PVC_PROT)){
1164
1165 /* check the udp packet type */
1166
1167 udp_type = udp_pkt_type(skb, card);
1168
1169 if (udp_type == UDP_CPIPE_TYPE){
1170 if(store_udp_mgmt_pkt(UDP_PKT_FRM_STACK, card, skb, dev,
1171 chdlc_priv_area)){
1172 chdlc_int->interrupt_permission |=
1173 APP_INT_ON_TIMER;
1174 }
1175 netif_start_queue(dev);
1176 return 0;
1177 }
1178
1179 /* check to see if the source IP address is a broadcast or */
1180 /* multicast IP address */
1181 if(chk_bcast_mcast_addr(card, dev, skb)){
1182 ++card->wandev.stats.tx_dropped;
1183 dev_kfree_skb_any(skb);
1184 netif_start_queue(dev);
1185 return 0;
1186 }
1187 }
1188
1189 /* Lock the 508 Card: SMP is supported */
1190 if(card->hw.type != SDLA_S514){
1191 s508_lock(card,&smp_flags);
1192 }
1193
1194 if(test_and_set_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
1195
1196 printk(KERN_INFO "%s: Critical in if_send: %lx\n",
1197 card->wandev.name,card->wandev.critical);
1198 ++card->wandev.stats.tx_dropped;
1199 netif_start_queue(dev);
1200 goto if_send_exit_crit;
1201 }
1202
1203 if(card->u.c.state != WAN_CONNECTED){
1204 ++card->wandev.stats.tx_dropped;
1205 netif_start_queue(dev);
1206
1207 }else if(!skb->protocol){
1208 ++card->wandev.stats.tx_errors;
1209 netif_start_queue(dev);
1210
1211 }else {
1212 void* data = skb->data;
1213 unsigned len = skb->len;
1214 unsigned char attr;
1215
1216 /* If it's an API packet pull off the API
1217 * header. Also check that the packet size
1218 * is larger than the API header
1219 */
1220 if (card->u.c.usedby == API){
1221 api_tx_hdr_t* api_tx_hdr;
1222
1223 /* discard the frame if we are configured for */
1224 /* 'receive only' mode or if there is no data */
1225 if (card->u.c.receive_only ||
1226 (len <= sizeof(api_tx_hdr_t))) {
1227
1228 ++card->wandev.stats.tx_dropped;
1229 netif_start_queue(dev);
1230 goto if_send_exit_crit;
1231 }
1232
1233 api_tx_hdr = (api_tx_hdr_t *)data;
1234 attr = api_tx_hdr->attr;
1235 data += sizeof(api_tx_hdr_t);
1236 len -= sizeof(api_tx_hdr_t);
1237 }
1238
1239 if(chdlc_send(card, data, len)) {
1240 netif_stop_queue(dev);
1241 }else{
1242 ++card->wandev.stats.tx_packets;
1243 card->wandev.stats.tx_bytes += len;
1244
1245 netif_start_queue(dev);
1246
1247 dev->trans_start = jiffies;
1248 }
1249 }
1250
1251if_send_exit_crit:
1252
1253 if (!(err=netif_queue_stopped(dev))) {
1254 dev_kfree_skb_any(skb);
1255 }else{
1256 chdlc_priv_area->tick_counter = jiffies;
1257 chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
1258 }
1259
1260 clear_bit(SEND_CRIT, (void*)&card->wandev.critical);
1261 if(card->hw.type != SDLA_S514){
1262 s508_unlock(card,&smp_flags);
1263 }
1264
1265 return err;
1266}
1267
1268
1269/*============================================================================
1270 * Check to see if the packet to be transmitted contains a broadcast or
1271 * multicast source IP address.
1272 */
1273
1274static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
1275 struct sk_buff *skb)
1276{
1277 u32 src_ip_addr;
1278 u32 broadcast_ip_addr = 0;
1279 struct in_device *in_dev;
1280
1281 /* read the IP source address from the outgoing packet */
1282 src_ip_addr = *(u32 *)(skb->data + 12);
1283
1284 /* read the IP broadcast address for the device */
1285 in_dev = dev->ip_ptr;
1286 if(in_dev != NULL) {
1287 struct in_ifaddr *ifa= in_dev->ifa_list;
1288 if(ifa != NULL)
1289 broadcast_ip_addr = ifa->ifa_broadcast;
1290 else
1291 return 0;
1292 }
1293
1294 /* check if the IP Source Address is a Broadcast address */
1295 if((dev->flags & IFF_BROADCAST) && (src_ip_addr == broadcast_ip_addr)) {
1296 printk(KERN_INFO "%s: Broadcast Source Address silently discarded\n",
1297 card->devname);
1298 return 1;
1299 }
1300
1301 /* check if the IP Source Address is a Multicast address */
1302 if((ntohl(src_ip_addr) >= 0xE0000001) &&
1303 (ntohl(src_ip_addr) <= 0xFFFFFFFE)) {
1304 printk(KERN_INFO "%s: Multicast Source Address silently discarded\n",
1305 card->devname);
1306 return 1;
1307 }
1308
1309 return 0;
1310}
1311
1312
1313/*============================================================================
1314 * Reply to UDP Management system.
1315 * Return length of reply.
1316 */
1317static int reply_udp( unsigned char *data, unsigned int mbox_len )
1318{
1319
1320 unsigned short len, udp_length, temp, ip_length;
1321 unsigned long ip_temp;
1322 int even_bound = 0;
1323 chdlc_udp_pkt_t *c_udp_pkt = (chdlc_udp_pkt_t *)data;
1324
1325 /* Set length of packet */
1326 len = sizeof(ip_pkt_t)+
1327 sizeof(udp_pkt_t)+
1328 sizeof(wp_mgmt_t)+
1329 sizeof(cblock_t)+
1330 sizeof(trace_info_t)+
1331 mbox_len;
1332
1333 /* fill in UDP reply */
1334 c_udp_pkt->wp_mgmt.request_reply = UDPMGMT_REPLY;
1335
1336 /* fill in UDP length */
1337 udp_length = sizeof(udp_pkt_t)+
1338 sizeof(wp_mgmt_t)+
1339 sizeof(cblock_t)+
1340 sizeof(trace_info_t)+
1341 mbox_len;
1342
1343 /* put it on an even boundary */
1344 if ( udp_length & 0x0001 ) {
1345 udp_length += 1;
1346 len += 1;
1347 even_bound = 1;
1348 }
1349
1350 temp = (udp_length<<8)|(udp_length>>8);
1351 c_udp_pkt->udp_pkt.udp_length = temp;
1352
1353 /* swap UDP ports */
1354 temp = c_udp_pkt->udp_pkt.udp_src_port;
1355 c_udp_pkt->udp_pkt.udp_src_port =
1356 c_udp_pkt->udp_pkt.udp_dst_port;
1357 c_udp_pkt->udp_pkt.udp_dst_port = temp;
1358
1359 /* add UDP pseudo header */
1360 temp = 0x1100;
1361 *((unsigned short *)(c_udp_pkt->data+mbox_len+even_bound)) = temp;
1362 temp = (udp_length<<8)|(udp_length>>8);
1363 *((unsigned short *)(c_udp_pkt->data+mbox_len+even_bound+2)) = temp;
1364
1365
1366 /* calculate UDP checksum */
1367 c_udp_pkt->udp_pkt.udp_checksum = 0;
1368 c_udp_pkt->udp_pkt.udp_checksum = calc_checksum(&data[UDP_OFFSET],udp_length+UDP_OFFSET);
1369
1370 /* fill in IP length */
1371 ip_length = len;
1372 temp = (ip_length<<8)|(ip_length>>8);
1373 c_udp_pkt->ip_pkt.total_length = temp;
1374
1375 /* swap IP addresses */
1376 ip_temp = c_udp_pkt->ip_pkt.ip_src_address;
1377 c_udp_pkt->ip_pkt.ip_src_address = c_udp_pkt->ip_pkt.ip_dst_address;
1378 c_udp_pkt->ip_pkt.ip_dst_address = ip_temp;
1379
1380 /* fill in IP checksum */
1381 c_udp_pkt->ip_pkt.hdr_checksum = 0;
1382 c_udp_pkt->ip_pkt.hdr_checksum = calc_checksum(data,sizeof(ip_pkt_t));
1383
1384 return len;
1385
1386} /* reply_udp */
1387
1388unsigned short calc_checksum (char *data, int len)
1389{
1390 unsigned short temp;
1391 unsigned long sum=0;
1392 int i;
1393
1394 for( i = 0; i <len; i+=2 ) {
1395 memcpy(&temp,&data[i],2);
1396 sum += (unsigned long)temp;
1397 }
1398
1399 while (sum >> 16 ) {
1400 sum = (sum & 0xffffUL) + (sum >> 16);
1401 }
1402
1403 temp = (unsigned short)sum;
1404 temp = ~temp;
1405
1406 if( temp == 0 )
1407 temp = 0xffff;
1408
1409 return temp;
1410}
1411
1412
1413/*============================================================================
1414 * Get ethernet-style interface statistics.
1415 * Return a pointer to struct enet_statistics.
1416 */
1417static struct net_device_stats* if_stats(struct net_device* dev)
1418{
1419 sdla_t *my_card;
1420 chdlc_private_area_t* chdlc_priv_area;
1421
1422 if ((chdlc_priv_area=dev->priv) == NULL)
1423 return NULL;
1424
1425 my_card = chdlc_priv_area->card;
1426 return &my_card->wandev.stats;
1427}
1428
1429
1430/****** Cisco HDLC Firmware Interface Functions *******************************/
1431
1432/*============================================================================
1433 * Read firmware code version.
1434 * Put code version as ASCII string in str.
1435 */
1436static int chdlc_read_version (sdla_t* card, char* str)
1437{
1438 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1439 int len;
1440 char err;
1441 mb->buffer_length = 0;
1442 mb->command = READ_CHDLC_CODE_VERSION;
1443 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1444
1445 if(err != COMMAND_OK) {
1446 chdlc_error(card,err,mb);
1447 }
1448 else if (str) { /* is not null */
1449 len = mb->buffer_length;
1450 memcpy(str, mb->data, len);
1451 str[len] = '\0';
1452 }
1453 return (err);
1454}
1455
1456/*-----------------------------------------------------------------------------
1457 * Configure CHDLC firmware.
1458 */
1459static int chdlc_configure (sdla_t* card, void* data)
1460{
1461 int err;
1462 CHDLC_MAILBOX_STRUCT *mailbox = card->mbox;
1463 int data_length = sizeof(CHDLC_CONFIGURATION_STRUCT);
1464
1465 mailbox->buffer_length = data_length;
1466 memcpy(mailbox->data, data, data_length);
1467 mailbox->command = SET_CHDLC_CONFIGURATION;
1468 err = sdla_exec(mailbox) ? mailbox->return_code : CMD_TIMEOUT;
1469
1470 if (err != COMMAND_OK) chdlc_error (card, err, mailbox);
1471
1472 return err;
1473}
1474
1475
1476/*============================================================================
1477 * Set interrupt mode -- HDLC Version.
1478 */
1479
1480static int chdlc_set_intr_mode (sdla_t* card, unsigned mode)
1481{
1482 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1483 CHDLC_INT_TRIGGERS_STRUCT* int_data =
1484 (CHDLC_INT_TRIGGERS_STRUCT *)mb->data;
1485 int err;
1486
1487 int_data->CHDLC_interrupt_triggers = mode;
1488 int_data->IRQ = card->hw.irq;
1489 int_data->interrupt_timer = 1;
1490
1491 mb->buffer_length = sizeof(CHDLC_INT_TRIGGERS_STRUCT);
1492 mb->command = SET_CHDLC_INTERRUPT_TRIGGERS;
1493 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1494 if (err != COMMAND_OK)
1495 chdlc_error (card, err, mb);
1496 return err;
1497}
1498
1499
1500/*===========================================================
1501 * chdlc_disable_comm_shutdown
1502 *
1503 * Shutdown() disables the communications. We must
1504 * have a sparate functions, because we must not
1505 * call chdlc_error() hander since the private
1506 * area has already been replaced */
1507
1508static int chdlc_disable_comm_shutdown (sdla_t *card)
1509{
1510 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1511 CHDLC_INT_TRIGGERS_STRUCT* int_data =
1512 (CHDLC_INT_TRIGGERS_STRUCT *)mb->data;
1513 int err;
1514
1515 /* Disable Interrutps */
1516 int_data->CHDLC_interrupt_triggers = 0;
1517 int_data->IRQ = card->hw.irq;
1518 int_data->interrupt_timer = 1;
1519
1520 mb->buffer_length = sizeof(CHDLC_INT_TRIGGERS_STRUCT);
1521 mb->command = SET_CHDLC_INTERRUPT_TRIGGERS;
1522 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1523
1524 /* Disable Communications */
1525
1526 if (card->u.c.async_mode) {
1527 mb->command = DISABLE_ASY_COMMUNICATIONS;
1528 }else{
1529 mb->command = DISABLE_CHDLC_COMMUNICATIONS;
1530 }
1531
1532 mb->buffer_length = 0;
1533 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1534
1535 card->u.c.comm_enabled = 0;
1536
1537 return 0;
1538}
1539
1540/*============================================================================
1541 * Enable communications.
1542 */
1543
1544static int chdlc_comm_enable (sdla_t* card)
1545{
1546 int err;
1547 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1548
1549 mb->buffer_length = 0;
1550 mb->command = ENABLE_CHDLC_COMMUNICATIONS;
1551 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1552 if (err != COMMAND_OK)
1553 chdlc_error(card, err, mb);
1554 else
1555 card->u.c.comm_enabled = 1;
1556
1557 return err;
1558}
1559
1560/*============================================================================
1561 * Read communication error statistics.
1562 */
1563static int chdlc_read_comm_err_stats (sdla_t* card)
1564{
1565 int err;
1566 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1567
1568 mb->buffer_length = 0;
1569 mb->command = READ_COMMS_ERROR_STATS;
1570 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1571 if (err != COMMAND_OK)
1572 chdlc_error(card,err,mb);
1573 return err;
1574}
1575
1576
1577/*============================================================================
1578 * Read CHDLC operational statistics.
1579 */
1580static int chdlc_read_op_stats (sdla_t* card)
1581{
1582 int err;
1583 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1584
1585 mb->buffer_length = 0;
1586 mb->command = READ_CHDLC_OPERATIONAL_STATS;
1587 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1588 if (err != COMMAND_OK)
1589 chdlc_error(card,err,mb);
1590 return err;
1591}
1592
1593
1594/*============================================================================
1595 * Update communications error and general packet statistics.
1596 */
1597static int update_comms_stats(sdla_t* card,
1598 chdlc_private_area_t* chdlc_priv_area)
1599{
1600 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1601 COMMS_ERROR_STATS_STRUCT* err_stats;
1602 CHDLC_OPERATIONAL_STATS_STRUCT *op_stats;
1603
1604 /* on the first timer interrupt, read the comms error statistics */
1605 if(chdlc_priv_area->update_comms_stats == 2) {
1606 if(chdlc_read_comm_err_stats(card))
1607 return 1;
1608 err_stats = (COMMS_ERROR_STATS_STRUCT *)mb->data;
1609 card->wandev.stats.rx_over_errors =
1610 err_stats->Rx_overrun_err_count;
1611 card->wandev.stats.rx_crc_errors =
1612 err_stats->CRC_err_count;
1613 card->wandev.stats.rx_frame_errors =
1614 err_stats->Rx_abort_count;
1615 card->wandev.stats.rx_fifo_errors =
1616 err_stats->Rx_dis_pri_bfrs_full_count;
1617 card->wandev.stats.rx_missed_errors =
1618 card->wandev.stats.rx_fifo_errors;
1619 card->wandev.stats.tx_aborted_errors =
1620 err_stats->sec_Tx_abort_count;
1621 }
1622
1623 /* on the second timer interrupt, read the operational statistics */
1624 else {
1625 if(chdlc_read_op_stats(card))
1626 return 1;
1627 op_stats = (CHDLC_OPERATIONAL_STATS_STRUCT *)mb->data;
1628 card->wandev.stats.rx_length_errors =
1629 (op_stats->Rx_Data_discard_short_count +
1630 op_stats->Rx_Data_discard_long_count);
1631 }
1632
1633 return 0;
1634}
1635
1636/*============================================================================
1637 * Send packet.
1638 * Return: 0 - o.k.
1639 * 1 - no transmit buffers available
1640 */
1641static int chdlc_send (sdla_t* card, void* data, unsigned len)
1642{
1643 CHDLC_DATA_TX_STATUS_EL_STRUCT *txbuf = card->u.c.txbuf;
1644
1645 if (txbuf->opp_flag)
1646 return 1;
1647
1648 sdla_poke(&card->hw, txbuf->ptr_data_bfr, data, len);
1649
1650 txbuf->frame_length = len;
1651 txbuf->opp_flag = 1; /* start transmission */
1652
1653 /* Update transmit buffer control fields */
1654 card->u.c.txbuf = ++txbuf;
1655
1656 if ((void*)txbuf > card->u.c.txbuf_last)
1657 card->u.c.txbuf = card->u.c.txbuf_base;
1658
1659 return 0;
1660}
1661
1662/****** Firmware Error Handler **********************************************/
1663
1664/*============================================================================
1665 * Firmware error handler.
1666 * This routine is called whenever firmware command returns non-zero
1667 * return code.
1668 *
1669 * Return zero if previous command has to be cancelled.
1670 */
1671static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb)
1672{
1673 unsigned cmd = mb->command;
1674
1675 switch (err) {
1676
1677 case CMD_TIMEOUT:
1678 printk(KERN_INFO "%s: command 0x%02X timed out!\n",
1679 card->devname, cmd);
1680 break;
1681
1682 case S514_BOTH_PORTS_SAME_CLK_MODE:
1683 if(cmd == SET_CHDLC_CONFIGURATION) {
1684 printk(KERN_INFO
1685 "%s: Configure both ports for the same clock source\n",
1686 card->devname);
1687 break;
1688 }
1689
1690 default:
1691 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X!\n",
1692 card->devname, cmd, err);
1693 }
1694
1695 return 0;
1696}
1697
1698
1699/********** Bottom Half Handlers ********************************************/
1700
1701/* NOTE: There is no API, BH support for Kernels lower than 2.2.X.
1702 * DO NOT INSERT ANY CODE HERE, NOTICE THE
1703 * PREPROCESSOR STATEMENT ABOVE, UNLESS YOU KNOW WHAT YOU ARE
1704 * DOING */
1705
1706static void chdlc_work(struct net_device * dev)
1707{
1708 chdlc_private_area_t* chan = dev->priv;
1709 sdla_t *card = chan->card;
1710 struct sk_buff *skb;
1711
1712 if (atomic_read(&chan->bh_buff_used) == 0){
1713 clear_bit(0, &chan->tq_working);
1714 return;
1715 }
1716
1717 while (atomic_read(&chan->bh_buff_used)){
1718
1719 skb = ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb;
1720
1721 if (skb != NULL){
1722
1723 if (chan->common.sk == NULL || chan->common.func == NULL){
1724 ++card->wandev.stats.rx_dropped;
1725 dev_kfree_skb_any(skb);
1726 chdlc_work_cleanup(dev);
1727 continue;
1728 }
1729
1730 if (chan->common.func(skb,dev,chan->common.sk) != 0){
1731 /* Sock full cannot send, queue us for another
1732 * try */
1733 atomic_set(&chan->common.receive_block,1);
1734 return;
1735 }else{
1736 chdlc_work_cleanup(dev);
1737 }
1738 }else{
1739 chdlc_work_cleanup(dev);
1740 }
1741 }
1742 clear_bit(0, &chan->tq_working);
1743
1744 return;
1745}
1746
1747static int chdlc_work_cleanup(struct net_device *dev)
1748{
1749 chdlc_private_area_t* chan = dev->priv;
1750
1751 ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb = NULL;
1752
1753 if (chan->bh_read == MAX_BH_BUFF){
1754 chan->bh_read=0;
1755 }else{
1756 ++chan->bh_read;
1757 }
1758
1759 atomic_dec(&chan->bh_buff_used);
1760 return 0;
1761}
1762
1763
1764
1765static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
1766{
1767 /* Check for full */
1768 chdlc_private_area_t* chan = dev->priv;
1769 sdla_t *card = chan->card;
1770
1771 if (atomic_read(&chan->bh_buff_used) == (MAX_BH_BUFF+1)){
1772 ++card->wandev.stats.rx_dropped;
1773 dev_kfree_skb_any(skb);
1774 return 1;
1775 }
1776
1777 ((bh_data_t *)&chan->bh_head[chan->bh_write])->skb = skb;
1778
1779 if (chan->bh_write == MAX_BH_BUFF){
1780 chan->bh_write=0;
1781 }else{
1782 ++chan->bh_write;
1783 }
1784
1785 atomic_inc(&chan->bh_buff_used);
1786
1787 return 0;
1788}
1789
1790/* END OF API BH Support */
1791
1792
1793/****** Interrupt Handlers **************************************************/
1794
1795/*============================================================================
1796 * Cisco HDLC interrupt service routine.
1797 */
1798static void wpc_isr (sdla_t* card)
1799{
1800 struct net_device* dev;
1801 SHARED_MEMORY_INFO_STRUCT* flags = NULL;
1802 int i;
1803 sdla_t *my_card;
1804
1805
1806 /* Check for which port the interrupt has been generated
1807 * Since Secondary Port is piggybacking on the Primary
1808 * the check must be done here.
1809 */
1810
1811 flags = card->u.c.flags;
1812 if (!flags->interrupt_info_struct.interrupt_type){
1813 /* Check for a second port (piggybacking) */
1814 if ((my_card = card->next)){
1815 flags = my_card->u.c.flags;
1816 if (flags->interrupt_info_struct.interrupt_type){
1817 card = my_card;
1818 card->isr(card);
1819 return;
1820 }
1821 }
1822 }
1823
1824 flags = card->u.c.flags;
1825 card->in_isr = 1;
1826 dev = card->wandev.dev;
1827
1828 /* If we get an interrupt with no network device, stop the interrupts
1829 * and issue an error */
1830 if (!card->tty_opt && !dev &&
1831 flags->interrupt_info_struct.interrupt_type !=
1832 COMMAND_COMPLETE_APP_INT_PEND){
1833
1834 goto isr_done;
1835 }
1836
1837 /* if critical due to peripheral operations
1838 * ie. update() or getstats() then reset the interrupt and
1839 * wait for the board to retrigger.
1840 */
1841 if(test_bit(PERI_CRIT, (void*)&card->wandev.critical)) {
1842 printk(KERN_INFO "ISR CRIT TO PERI\n");
1843 goto isr_done;
1844 }
1845
1846 /* On a 508 Card, if critical due to if_send
1847 * Major Error !!! */
1848 if(card->hw.type != SDLA_S514) {
1849 if(test_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
1850 printk(KERN_INFO "%s: Critical while in ISR: %lx\n",
1851 card->devname, card->wandev.critical);
1852 card->in_isr = 0;
1853 flags->interrupt_info_struct.interrupt_type = 0;
1854 return;
1855 }
1856 }
1857
1858 switch(flags->interrupt_info_struct.interrupt_type) {
1859
1860 case RX_APP_INT_PEND: /* 0x01: receive interrupt */
1861 rx_intr(card);
1862 break;
1863
1864 case TX_APP_INT_PEND: /* 0x02: transmit interrupt */
1865 flags->interrupt_info_struct.interrupt_permission &=
1866 ~APP_INT_ON_TX_FRAME;
1867
1868 if (card->tty_opt){
1869 wanpipe_tty_trigger_poll(card);
1870 break;
1871 }
1872
1873 if (dev && netif_queue_stopped(dev)){
1874 if (card->u.c.usedby == API){
1875 netif_start_queue(dev);
1876 wakeup_sk_bh(dev);
1877 }else{
1878 netif_wake_queue(dev);
1879 }
1880 }
1881 break;
1882
1883 case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */
1884 ++ Intr_test_counter;
1885 break;
1886
1887 case CHDLC_EXCEP_COND_APP_INT_PEND: /* 0x20 */
1888 process_chdlc_exception(card);
1889 break;
1890
1891 case GLOBAL_EXCEP_COND_APP_INT_PEND:
1892 process_global_exception(card);
1893 break;
1894
1895 case TIMER_APP_INT_PEND:
1896 timer_intr(card);
1897 break;
1898
1899 default:
1900 printk(KERN_INFO "%s: spurious interrupt 0x%02X!\n",
1901 card->devname,
1902 flags->interrupt_info_struct.interrupt_type);
1903 printk(KERN_INFO "Code name: ");
1904 for(i = 0; i < 4; i ++)
1905 printk(KERN_INFO "%c",
1906 flags->global_info_struct.codename[i]);
1907 printk(KERN_INFO "\nCode version: ");
1908 for(i = 0; i < 4; i ++)
1909 printk(KERN_INFO "%c",
1910 flags->global_info_struct.codeversion[i]);
1911 printk(KERN_INFO "\n");
1912 break;
1913 }
1914
1915isr_done:
1916
1917 card->in_isr = 0;
1918 flags->interrupt_info_struct.interrupt_type = 0;
1919 return;
1920}
1921
1922/*============================================================================
1923 * Receive interrupt handler.
1924 */
1925static void rx_intr (sdla_t* card)
1926{
1927 struct net_device *dev;
1928 chdlc_private_area_t *chdlc_priv_area;
1929 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
1930 CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb;
1931 struct sk_buff *skb;
1932 unsigned len;
1933 unsigned addr = rxbuf->ptr_data_bfr;
1934 void *buf;
1935 int i,udp_type;
1936
1937 if (rxbuf->opp_flag != 0x01) {
1938 printk(KERN_INFO
1939 "%s: corrupted Rx buffer @ 0x%X, flag = 0x%02X!\n",
1940 card->devname, (unsigned)rxbuf, rxbuf->opp_flag);
1941 printk(KERN_INFO "Code name: ");
1942 for(i = 0; i < 4; i ++)
1943 printk(KERN_INFO "%c",
1944 flags->global_info_struct.codename[i]);
1945 printk(KERN_INFO "\nCode version: ");
1946 for(i = 0; i < 4; i ++)
1947 printk(KERN_INFO "%c",
1948 flags->global_info_struct.codeversion[i]);
1949 printk(KERN_INFO "\n");
1950
1951
1952 /* Bug Fix: Mar 6 2000
1953 * If we get a corrupted mailbox, it measn that driver
1954 * is out of sync with the firmware. There is no recovery.
1955 * If we don't turn off all interrupts for this card
1956 * the machine will crash.
1957 */
1958 printk(KERN_INFO "%s: Critical router failure ...!!!\n", card->devname);
1959 printk(KERN_INFO "Please contact Sangoma Technologies !\n");
1960 chdlc_set_intr_mode(card,0);
1961 return;
1962 }
1963
1964 len = rxbuf->frame_length;
1965
1966 if (card->tty_opt){
1967
1968 if (rxbuf->error_flag){
1969 goto rx_exit;
1970 }
1971
1972 if (len <= CRC_LENGTH){
1973 goto rx_exit;
1974 }
1975
1976 if (!card->u.c.async_mode){
1977 len -= CRC_LENGTH;
1978 }
1979
1980 wanpipe_tty_receive(card,addr,len);
1981 goto rx_exit;
1982 }
1983
1984 dev = card->wandev.dev;
1985
1986 if (!dev){
1987 goto rx_exit;
1988 }
1989
1990 if (!netif_running(dev))
1991 goto rx_exit;
1992
1993 chdlc_priv_area = dev->priv;
1994
1995
1996 /* Allocate socket buffer */
1997 skb = dev_alloc_skb(len);
1998
1999 if (skb == NULL) {
2000 printk(KERN_INFO "%s: no socket buffers available!\n",
2001 card->devname);
2002 ++card->wandev.stats.rx_dropped;
2003 goto rx_exit;
2004 }
2005
2006 /* Copy data to the socket buffer */
2007 if((addr + len) > card->u.c.rx_top + 1) {
2008 unsigned tmp = card->u.c.rx_top - addr + 1;
2009 buf = skb_put(skb, tmp);
2010 sdla_peek(&card->hw, addr, buf, tmp);
2011 addr = card->u.c.rx_base;
2012 len -= tmp;
2013 }
2014
2015 buf = skb_put(skb, len);
2016 sdla_peek(&card->hw, addr, buf, len);
2017
2018 skb->protocol = htons(ETH_P_IP);
2019
2020 card->wandev.stats.rx_packets ++;
2021 card->wandev.stats.rx_bytes += skb->len;
2022 udp_type = udp_pkt_type( skb, card );
2023
2024 if(udp_type == UDP_CPIPE_TYPE) {
2025 if(store_udp_mgmt_pkt(UDP_PKT_FRM_NETWORK,
2026 card, skb, dev, chdlc_priv_area)) {
2027 flags->interrupt_info_struct.
2028 interrupt_permission |=
2029 APP_INT_ON_TIMER;
2030 }
2031 } else if(card->u.c.usedby == API) {
2032
2033 api_rx_hdr_t* api_rx_hdr;
2034 skb_push(skb, sizeof(api_rx_hdr_t));
2035 api_rx_hdr = (api_rx_hdr_t*)&skb->data[0x00];
2036 api_rx_hdr->error_flag = rxbuf->error_flag;
2037 api_rx_hdr->time_stamp = rxbuf->time_stamp;
2038
2039 skb->protocol = htons(PVC_PROT);
2040 skb->mac.raw = skb->data;
2041 skb->dev = dev;
2042 skb->pkt_type = WAN_PACKET_DATA;
2043
2044 bh_enqueue(dev, skb);
2045
2046 if (!test_and_set_bit(0,&chdlc_priv_area->tq_working))
2047 wanpipe_queue_work(&chdlc_priv_area->common.wanpipe_work);
2048 }else{
2049 /* FIXME: we should check to see if the received packet is a
2050 multicast packet so that we can increment the multicast
2051 statistic
2052 ++ chdlc_priv_area->if_stats.multicast;
2053 */
2054 /* Pass it up the protocol stack */
2055
2056 skb->dev = dev;
2057 skb->mac.raw = skb->data;
2058 netif_rx(skb);
2059 dev->last_rx = jiffies;
2060 }
2061
2062rx_exit:
2063 /* Release buffer element and calculate a pointer to the next one */
2064 rxbuf->opp_flag = 0x00;
2065 card->u.c.rxmb = ++ rxbuf;
2066 if((void*)rxbuf > card->u.c.rxbuf_last){
2067 card->u.c.rxmb = card->u.c.rxbuf_base;
2068 }
2069}
2070
2071/*============================================================================
2072 * Timer interrupt handler.
2073 * The timer interrupt is used for two purposes:
2074 * 1) Processing udp calls from 'cpipemon'.
2075 * 2) Reading board-level statistics for updating the proc file system.
2076 */
2077void timer_intr(sdla_t *card)
2078{
2079 struct net_device* dev;
2080 chdlc_private_area_t* chdlc_priv_area = NULL;
2081 SHARED_MEMORY_INFO_STRUCT* flags = NULL;
2082
2083 if ((dev = card->wandev.dev)==NULL){
2084 flags = card->u.c.flags;
2085 flags->interrupt_info_struct.interrupt_permission &=
2086 ~APP_INT_ON_TIMER;
2087 return;
2088 }
2089
2090 chdlc_priv_area = dev->priv;
2091
2092 if (chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_CONFIG) {
2093 if (!config_chdlc(card)){
2094 chdlc_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_CONFIG;
2095 }
2096 }
2097
2098 /* process a udp call if pending */
2099 if(chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_UDP) {
2100 process_udp_mgmt_pkt(card, dev,
2101 chdlc_priv_area);
2102 chdlc_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_UDP;
2103 }
2104
2105 /* read the communications statistics if required */
2106 if(chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_UPDATE) {
2107 update_comms_stats(card, chdlc_priv_area);
2108 if(!(-- chdlc_priv_area->update_comms_stats)) {
2109 chdlc_priv_area->timer_int_enabled &=
2110 ~TMR_INT_ENABLED_UPDATE;
2111 }
2112 }
2113
2114 /* only disable the timer interrupt if there are no udp or statistic */
2115 /* updates pending */
2116 if(!chdlc_priv_area->timer_int_enabled) {
2117 flags = card->u.c.flags;
2118 flags->interrupt_info_struct.interrupt_permission &=
2119 ~APP_INT_ON_TIMER;
2120 }
2121}
2122
2123/*------------------------------------------------------------------------------
2124 Miscellaneous Functions
2125 - set_chdlc_config() used to set configuration options on the board
2126------------------------------------------------------------------------------*/
2127
2128static int set_chdlc_config(sdla_t* card)
2129{
2130 CHDLC_CONFIGURATION_STRUCT cfg;
2131
2132 memset(&cfg, 0, sizeof(CHDLC_CONFIGURATION_STRUCT));
2133
2134 if(card->wandev.clocking){
2135 cfg.baud_rate = card->wandev.bps;
2136 }
2137
2138 cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ?
2139 INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35;
2140
2141 cfg.modem_config_options = 0;
2142 cfg.modem_status_timer = 100;
2143
2144 cfg.CHDLC_protocol_options = card->u.c.protocol_options;
2145
2146 if (card->tty_opt){
2147 cfg.CHDLC_API_options = DISCARD_RX_ERROR_FRAMES;
2148 }
2149
2150 cfg.percent_data_buffer_for_Tx = (card->u.c.receive_only) ? 0 : 50;
2151 cfg.CHDLC_statistics_options = (CHDLC_TX_DATA_BYTE_COUNT_STAT |
2152 CHDLC_RX_DATA_BYTE_COUNT_STAT);
2153
2154 if (card->tty_opt){
2155 card->wandev.mtu = TTY_CHDLC_MAX_MTU;
2156 }
2157 cfg.max_CHDLC_data_field_length = card->wandev.mtu;
2158 cfg.transmit_keepalive_timer = card->u.c.kpalv_tx;
2159 cfg.receive_keepalive_timer = card->u.c.kpalv_rx;
2160 cfg.keepalive_error_tolerance = card->u.c.kpalv_err;
2161 cfg.SLARP_request_timer = card->u.c.slarp_timer;
2162
2163 if (cfg.SLARP_request_timer) {
2164 cfg.IP_address = 0;
2165 cfg.IP_netmask = 0;
2166
2167 }else if (card->wandev.dev){
2168 struct net_device *dev = card->wandev.dev;
2169 chdlc_private_area_t *chdlc_priv_area = dev->priv;
2170
2171 struct in_device *in_dev = dev->ip_ptr;
2172
2173 if(in_dev != NULL) {
2174 struct in_ifaddr *ifa = in_dev->ifa_list;
2175
2176 if (ifa != NULL ) {
2177 cfg.IP_address = ntohl(ifa->ifa_local);
2178 cfg.IP_netmask = ntohl(ifa->ifa_mask);
2179 chdlc_priv_area->IP_address = ntohl(ifa->ifa_local);
2180 chdlc_priv_area->IP_netmask = ntohl(ifa->ifa_mask);
2181 }
2182 }
2183
2184 /* FIXME: We must re-think this message in next release
2185 if((cfg.IP_address & 0x000000FF) > 2) {
2186 printk(KERN_WARNING "\n");
2187 printk(KERN_WARNING " WARNING:%s configured with an\n",
2188 card->devname);
2189 printk(KERN_WARNING " invalid local IP address.\n");
2190 printk(KERN_WARNING " Slarp pragmatics will fail.\n");
2191 printk(KERN_WARNING " IP address should be of the\n");
2192 printk(KERN_WARNING " format A.B.C.1 or A.B.C.2.\n");
2193 }
2194 */
2195 }
2196
2197 return chdlc_configure(card, &cfg);
2198}
2199
2200
2201/*-----------------------------------------------------------------------------
2202 set_asy_config() used to set asynchronous configuration options on the board
2203------------------------------------------------------------------------------*/
2204
2205static int set_asy_config(sdla_t* card)
2206{
2207
2208 ASY_CONFIGURATION_STRUCT cfg;
2209 CHDLC_MAILBOX_STRUCT *mailbox = card->mbox;
2210 int err;
2211
2212 memset(&cfg, 0, sizeof(ASY_CONFIGURATION_STRUCT));
2213
2214 if(card->wandev.clocking)
2215 cfg.baud_rate = card->wandev.bps;
2216
2217 cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ?
2218 INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35;
2219
2220 cfg.modem_config_options = 0;
2221 cfg.asy_API_options = card->u.c.api_options;
2222 cfg.asy_protocol_options = card->u.c.protocol_options;
2223 cfg.Tx_bits_per_char = card->u.c.tx_bits_per_char;
2224 cfg.Rx_bits_per_char = card->u.c.rx_bits_per_char;
2225 cfg.stop_bits = card->u.c.stop_bits;
2226 cfg.parity = card->u.c.parity;
2227 cfg.break_timer = card->u.c.break_timer;
2228 cfg.asy_Rx_inter_char_timer = card->u.c.inter_char_timer;
2229 cfg.asy_Rx_complete_length = card->u.c.rx_complete_length;
2230 cfg.XON_char = card->u.c.xon_char;
2231 cfg.XOFF_char = card->u.c.xoff_char;
2232 cfg.asy_statistics_options = (CHDLC_TX_DATA_BYTE_COUNT_STAT |
2233 CHDLC_RX_DATA_BYTE_COUNT_STAT);
2234
2235 mailbox->buffer_length = sizeof(ASY_CONFIGURATION_STRUCT);
2236 memcpy(mailbox->data, &cfg, mailbox->buffer_length);
2237 mailbox->command = SET_ASY_CONFIGURATION;
2238 err = sdla_exec(mailbox) ? mailbox->return_code : CMD_TIMEOUT;
2239 if (err != COMMAND_OK)
2240 chdlc_error (card, err, mailbox);
2241 return err;
2242}
2243
2244/*============================================================================
2245 * Enable asynchronous communications.
2246 */
2247
2248static int asy_comm_enable (sdla_t* card)
2249{
2250
2251 int err;
2252 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
2253
2254 mb->buffer_length = 0;
2255 mb->command = ENABLE_ASY_COMMUNICATIONS;
2256 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2257 if (err != COMMAND_OK && card->wandev.dev)
2258 chdlc_error(card, err, mb);
2259
2260 if (!err)
2261 card->u.c.comm_enabled = 1;
2262
2263 return err;
2264}
2265
2266/*============================================================================
2267 * Process global exception condition
2268 */
2269static int process_global_exception(sdla_t *card)
2270{
2271 CHDLC_MAILBOX_STRUCT* mbox = card->mbox;
2272 int err;
2273
2274 mbox->buffer_length = 0;
2275 mbox->command = READ_GLOBAL_EXCEPTION_CONDITION;
2276 err = sdla_exec(mbox) ? mbox->return_code : CMD_TIMEOUT;
2277
2278 if(err != CMD_TIMEOUT ){
2279
2280 switch(mbox->return_code) {
2281
2282 case EXCEP_MODEM_STATUS_CHANGE:
2283
2284 printk(KERN_INFO "%s: Modem status change\n",
2285 card->devname);
2286
2287 switch(mbox->data[0] & (DCD_HIGH | CTS_HIGH)) {
2288 case (DCD_HIGH):
2289 printk(KERN_INFO "%s: DCD high, CTS low\n",card->devname);
2290 break;
2291 case (CTS_HIGH):
2292 printk(KERN_INFO "%s: DCD low, CTS high\n",card->devname);
2293 break;
2294 case ((DCD_HIGH | CTS_HIGH)):
2295 printk(KERN_INFO "%s: DCD high, CTS high\n",card->devname);
2296 break;
2297 default:
2298 printk(KERN_INFO "%s: DCD low, CTS low\n",card->devname);
2299 break;
2300 }
2301 break;
2302
2303 case EXCEP_TRC_DISABLED:
2304 printk(KERN_INFO "%s: Line trace disabled\n",
2305 card->devname);
2306 break;
2307
2308 case EXCEP_IRQ_TIMEOUT:
2309 printk(KERN_INFO "%s: IRQ timeout occurred\n",
2310 card->devname);
2311 break;
2312
2313 case 0x17:
2314 if (card->tty_opt){
2315 if (card->tty && card->tty_open){
2316 printk(KERN_INFO
2317 "%s: Modem Hangup Exception: Hanging Up!\n",
2318 card->devname);
2319 tty_hangup(card->tty);
2320 }
2321 break;
2322 }
2323
2324 /* If TTY is not used just drop throught */
2325
2326 default:
2327 printk(KERN_INFO "%s: Global exception %x\n",
2328 card->devname, mbox->return_code);
2329 break;
2330 }
2331 }
2332 return 0;
2333}
2334
2335
2336/*============================================================================
2337 * Process chdlc exception condition
2338 */
2339static int process_chdlc_exception(sdla_t *card)
2340{
2341 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
2342 int err;
2343
2344 mb->buffer_length = 0;
2345 mb->command = READ_CHDLC_EXCEPTION_CONDITION;
2346 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2347 if(err != CMD_TIMEOUT) {
2348
2349 switch (err) {
2350
2351 case EXCEP_LINK_ACTIVE:
2352 port_set_state(card, WAN_CONNECTED);
2353 trigger_chdlc_poll(card->wandev.dev);
2354 break;
2355
2356 case EXCEP_LINK_INACTIVE_MODEM:
2357 port_set_state(card, WAN_DISCONNECTED);
2358 unconfigure_ip(card);
2359 trigger_chdlc_poll(card->wandev.dev);
2360 break;
2361
2362 case EXCEP_LINK_INACTIVE_KPALV:
2363 port_set_state(card, WAN_DISCONNECTED);
2364 printk(KERN_INFO "%s: Keepalive timer expired.\n",
2365 card->devname);
2366 unconfigure_ip(card);
2367 trigger_chdlc_poll(card->wandev.dev);
2368 break;
2369
2370 case EXCEP_IP_ADDRESS_DISCOVERED:
2371 if (configure_ip(card))
2372 return -1;
2373 break;
2374
2375 case EXCEP_LOOPBACK_CONDITION:
2376 printk(KERN_INFO "%s: Loopback Condition Detected.\n",
2377 card->devname);
2378 break;
2379
2380 case NO_CHDLC_EXCEP_COND_TO_REPORT:
2381 printk(KERN_INFO "%s: No exceptions reported.\n",
2382 card->devname);
2383 break;
2384 }
2385
2386 }
2387 return 0;
2388}
2389
2390
2391/*============================================================================
2392 * Configure IP from SLARP negotiation
2393 * This adds dynamic routes when SLARP has provided valid addresses
2394 */
2395
2396static int configure_ip (sdla_t* card)
2397{
2398 struct net_device *dev = card->wandev.dev;
2399 chdlc_private_area_t *chdlc_priv_area;
2400 char err;
2401
2402 if (!dev)
2403 return 0;
2404
2405 chdlc_priv_area = dev->priv;
2406
2407
2408 /* set to discover */
2409 if(card->u.c.slarp_timer != 0x00) {
2410 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
2411 CHDLC_CONFIGURATION_STRUCT *cfg;
2412
2413 mb->buffer_length = 0;
2414 mb->command = READ_CHDLC_CONFIGURATION;
2415 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2416
2417 if(err != COMMAND_OK) {
2418 chdlc_error(card,err,mb);
2419 return -1;
2420 }
2421
2422 cfg = (CHDLC_CONFIGURATION_STRUCT *)mb->data;
2423 chdlc_priv_area->IP_address = cfg->IP_address;
2424 chdlc_priv_area->IP_netmask = cfg->IP_netmask;
2425
2426 /* Set flag to add route */
2427 chdlc_priv_area->route_status = ADD_ROUTE;
2428
2429 /* The idea here is to add the route in the poll routine.
2430 This way, we aren't in interrupt context when adding routes */
2431 trigger_chdlc_poll(dev);
2432 }
2433
2434 return 0;
2435}
2436
2437
2438/*============================================================================
2439 * Un-Configure IP negotiated by SLARP
2440 * This removes dynamic routes when the link becomes inactive.
2441 */
2442
2443static int unconfigure_ip (sdla_t* card)
2444{
2445 struct net_device *dev = card->wandev.dev;
2446 chdlc_private_area_t *chdlc_priv_area;
2447
2448 if (!dev)
2449 return 0;
2450
2451 chdlc_priv_area= dev->priv;
2452
2453 if (chdlc_priv_area->route_status == ROUTE_ADDED) {
2454
2455 /* Note: If this function is called, the
2456 * port state has been DISCONNECTED. This state
2457 * change will trigger a poll_disconnected
2458 * function, that will check for this condition.
2459 */
2460 chdlc_priv_area->route_status = REMOVE_ROUTE;
2461
2462 }
2463 return 0;
2464}
2465
2466/*============================================================================
2467 * Routine to add/remove routes
2468 * Called like a polling routine when Routes are flagged to be added/removed.
2469 */
2470
2471static void process_route (sdla_t *card)
2472{
2473 struct net_device *dev = card->wandev.dev;
2474 unsigned char port_num;
2475 chdlc_private_area_t *chdlc_priv_area = NULL;
2476 u32 local_IP_addr = 0;
2477 u32 remote_IP_addr = 0;
2478 u32 IP_netmask, IP_addr;
2479 int err = 0;
2480 struct in_device *in_dev;
2481 mm_segment_t fs;
2482 struct ifreq if_info;
2483 struct sockaddr_in *if_data1, *if_data2;
2484
2485 chdlc_priv_area = dev->priv;
2486 port_num = card->u.c.comm_port;
2487
2488 /* Bug Fix Mar 16 2000
2489 * AND the IP address to the Mask before checking
2490 * the last two bits. */
2491
2492 if((chdlc_priv_area->route_status == ADD_ROUTE) &&
2493 ((chdlc_priv_area->IP_address & ~chdlc_priv_area->IP_netmask) > 2)) {
2494
2495 printk(KERN_INFO "%s: Dynamic route failure.\n",card->devname);
2496
2497 if(card->u.c.slarp_timer) {
2498 u32 addr_net = htonl(chdlc_priv_area->IP_address);
2499
2500 printk(KERN_INFO "%s: Bad IP address %u.%u.%u.%u received\n",
2501 card->devname,
2502 NIPQUAD(addr_net));
2503 printk(KERN_INFO "%s: from remote station.\n",
2504 card->devname);
2505
2506 }else{
2507 u32 addr_net = htonl(chdlc_priv_area->IP_address);
2508
2509 printk(KERN_INFO "%s: Bad IP address %u.%u.%u.%u issued\n",
2510 card->devname,
2511 NIPQUAD(addr_net));
2512 printk(KERN_INFO "%s: to remote station. Local\n",
2513 card->devname);
2514 printk(KERN_INFO "%s: IP address must be A.B.C.1\n",
2515 card->devname);
2516 printk(KERN_INFO "%s: or A.B.C.2.\n",card->devname);
2517 }
2518
2519 /* remove the route due to the IP address error condition */
2520 chdlc_priv_area->route_status = REMOVE_ROUTE;
2521 err = 1;
2522 }
2523
2524 /* If we are removing a route with bad IP addressing, then use the */
2525 /* locally configured IP addresses */
2526 if((chdlc_priv_area->route_status == REMOVE_ROUTE) && err) {
2527
2528 /* do not remove a bad route that has already been removed */
2529 if(chdlc_priv_area->route_removed) {
2530 return;
2531 }
2532
2533 in_dev = dev->ip_ptr;
2534
2535 if(in_dev != NULL) {
2536 struct in_ifaddr *ifa = in_dev->ifa_list;
2537 if (ifa != NULL ) {
2538 local_IP_addr = ifa->ifa_local;
2539 IP_netmask = ifa->ifa_mask;
2540 }
2541 }
2542 }else{
2543 /* According to Cisco HDLC, if the point-to-point address is
2544 A.B.C.1, then we are the opposite (A.B.C.2), and vice-versa.
2545 */
2546 IP_netmask = ntohl(chdlc_priv_area->IP_netmask);
2547 remote_IP_addr = ntohl(chdlc_priv_area->IP_address);
2548
2549
2550 /* If Netmask is 255.255.255.255 the local address
2551 * calculation will fail. Default it back to 255.255.255.0 */
2552 if (IP_netmask == 0xffffffff)
2553 IP_netmask &= 0x00ffffff;
2554
2555 /* Bug Fix Mar 16 2000
2556 * AND the Remote IP address with IP netmask, instead
2557 * of static netmask of 255.255.255.0 */
2558 local_IP_addr = (remote_IP_addr & IP_netmask) +
2559 (~remote_IP_addr & ntohl(0x0003));
2560
2561 if(!card->u.c.slarp_timer) {
2562 IP_addr = local_IP_addr;
2563 local_IP_addr = remote_IP_addr;
2564 remote_IP_addr = IP_addr;
2565 }
2566 }
2567
2568 fs = get_fs(); /* Save file system */
2569 set_fs(get_ds()); /* Get user space block */
2570
2571 /* Setup a structure for adding/removing routes */
2572 memset(&if_info, 0, sizeof(if_info));
2573 strcpy(if_info.ifr_name, dev->name);
2574
2575 switch (chdlc_priv_area->route_status) {
2576
2577 case ADD_ROUTE:
2578
2579 if(!card->u.c.slarp_timer) {
2580 if_data2 = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2581 if_data2->sin_addr.s_addr = remote_IP_addr;
2582 if_data2->sin_family = AF_INET;
2583 err = devinet_ioctl(SIOCSIFDSTADDR, &if_info);
2584 } else {
2585 if_data1 = (struct sockaddr_in *)&if_info.ifr_addr;
2586 if_data1->sin_addr.s_addr = local_IP_addr;
2587 if_data1->sin_family = AF_INET;
2588 if(!(err = devinet_ioctl(SIOCSIFADDR, &if_info))){
2589 if_data2 = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2590 if_data2->sin_addr.s_addr = remote_IP_addr;
2591 if_data2->sin_family = AF_INET;
2592 err = devinet_ioctl(SIOCSIFDSTADDR, &if_info);
2593 }
2594 }
2595
2596 if(err) {
2597 printk(KERN_INFO "%s: Add route %u.%u.%u.%u failed (%d)\n",
2598 card->devname, NIPQUAD(remote_IP_addr), err);
2599 } else {
2600 ((chdlc_private_area_t *)dev->priv)->route_status = ROUTE_ADDED;
2601 printk(KERN_INFO "%s: Dynamic route added.\n",
2602 card->devname);
2603 printk(KERN_INFO "%s: Local IP addr : %u.%u.%u.%u\n",
2604 card->devname, NIPQUAD(local_IP_addr));
2605 printk(KERN_INFO "%s: Remote IP addr: %u.%u.%u.%u\n",
2606 card->devname, NIPQUAD(remote_IP_addr));
2607 chdlc_priv_area->route_removed = 0;
2608 }
2609 break;
2610
2611
2612 case REMOVE_ROUTE:
2613
2614 /* Change the local ip address of the interface to 0.
2615 * This will also delete the destination route.
2616 */
2617 if(!card->u.c.slarp_timer) {
2618 if_data2 = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2619 if_data2->sin_addr.s_addr = 0;
2620 if_data2->sin_family = AF_INET;
2621 err = devinet_ioctl(SIOCSIFDSTADDR, &if_info);
2622 } else {
2623 if_data1 = (struct sockaddr_in *)&if_info.ifr_addr;
2624 if_data1->sin_addr.s_addr = 0;
2625 if_data1->sin_family = AF_INET;
2626 err = devinet_ioctl(SIOCSIFADDR,&if_info);
2627
2628 }
2629 if(err) {
2630 printk(KERN_INFO
2631 "%s: Remove route %u.%u.%u.%u failed, (err %d)\n",
2632 card->devname, NIPQUAD(remote_IP_addr),
2633 err);
2634 } else {
2635 ((chdlc_private_area_t *)dev->priv)->route_status =
2636 NO_ROUTE;
2637 printk(KERN_INFO "%s: Dynamic route removed: %u.%u.%u.%u\n",
2638 card->devname, NIPQUAD(local_IP_addr));
2639 chdlc_priv_area->route_removed = 1;
2640 }
2641 break;
2642 }
2643
2644 set_fs(fs); /* Restore file system */
2645
2646}
2647
2648
2649/*=============================================================================
2650 * Store a UDP management packet for later processing.
2651 */
2652
2653static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
2654 struct sk_buff *skb, struct net_device* dev,
2655 chdlc_private_area_t* chdlc_priv_area)
2656{
2657 int udp_pkt_stored = 0;
2658
2659 if(!chdlc_priv_area->udp_pkt_lgth &&
2660 (skb->len <= MAX_LGTH_UDP_MGNT_PKT)) {
2661 chdlc_priv_area->udp_pkt_lgth = skb->len;
2662 chdlc_priv_area->udp_pkt_src = udp_pkt_src;
2663 memcpy(chdlc_priv_area->udp_pkt_data, skb->data, skb->len);
2664 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UDP;
2665 udp_pkt_stored = 1;
2666 }
2667
2668 if(udp_pkt_src == UDP_PKT_FRM_STACK){
2669 dev_kfree_skb_any(skb);
2670 }else{
2671 dev_kfree_skb_any(skb);
2672 }
2673
2674 return(udp_pkt_stored);
2675}
2676
2677
2678/*=============================================================================
2679 * Process UDP management packet.
2680 */
2681
2682static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
2683 chdlc_private_area_t* chdlc_priv_area )
2684{
2685 unsigned char *buf;
2686 unsigned int frames, len;
2687 struct sk_buff *new_skb;
2688 unsigned short buffer_length, real_len;
2689 unsigned long data_ptr;
2690 unsigned data_length;
2691 int udp_mgmt_req_valid = 1;
2692 CHDLC_MAILBOX_STRUCT *mb = card->mbox;
2693 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
2694 chdlc_udp_pkt_t *chdlc_udp_pkt;
2695 struct timeval tv;
2696 int err;
2697 char ut_char;
2698
2699 chdlc_udp_pkt = (chdlc_udp_pkt_t *) chdlc_priv_area->udp_pkt_data;
2700
2701 if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK){
2702
2703 /* Only these commands are support for remote debugging.
2704 * All others are not */
2705 switch(chdlc_udp_pkt->cblock.command) {
2706
2707 case READ_GLOBAL_STATISTICS:
2708 case READ_MODEM_STATUS:
2709 case READ_CHDLC_LINK_STATUS:
2710 case CPIPE_ROUTER_UP_TIME:
2711 case READ_COMMS_ERROR_STATS:
2712 case READ_CHDLC_OPERATIONAL_STATS:
2713
2714 /* These two commands are executed for
2715 * each request */
2716 case READ_CHDLC_CONFIGURATION:
2717 case READ_CHDLC_CODE_VERSION:
2718 udp_mgmt_req_valid = 1;
2719 break;
2720 default:
2721 udp_mgmt_req_valid = 0;
2722 break;
2723 }
2724 }
2725
2726 if(!udp_mgmt_req_valid) {
2727
2728 /* set length to 0 */
2729 chdlc_udp_pkt->cblock.buffer_length = 0;
2730
2731 /* set return code */
2732 chdlc_udp_pkt->cblock.return_code = 0xCD;
2733
2734 if (net_ratelimit()){
2735 printk(KERN_INFO
2736 "%s: Warning, Illegal UDP command attempted from network: %x\n",
2737 card->devname,chdlc_udp_pkt->cblock.command);
2738 }
2739
2740 } else {
2741 unsigned long trace_status_cfg_addr = 0;
2742 TRACE_STATUS_EL_CFG_STRUCT trace_cfg_struct;
2743 TRACE_STATUS_ELEMENT_STRUCT trace_element_struct;
2744
2745 switch(chdlc_udp_pkt->cblock.command) {
2746
2747 case CPIPE_ENABLE_TRACING:
2748 if (!chdlc_priv_area->TracingEnabled) {
2749
2750 /* OPERATE_DATALINE_MONITOR */
2751
2752 mb->buffer_length = sizeof(LINE_TRACE_CONFIG_STRUCT);
2753 mb->command = SET_TRACE_CONFIGURATION;
2754
2755 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
2756 trace_config = TRACE_ACTIVE;
2757 /* Trace delay mode is not used because it slows
2758 down transfer and results in a standoff situation
2759 when there is a lot of data */
2760
2761 /* Configure the Trace based on user inputs */
2762 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->trace_config |=
2763 chdlc_udp_pkt->data[0];
2764
2765 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
2766 trace_deactivation_timer = 4000;
2767
2768
2769 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2770 if (err != COMMAND_OK) {
2771 chdlc_error(card,err,mb);
2772 card->TracingEnabled = 0;
2773 chdlc_udp_pkt->cblock.return_code = err;
2774 mb->buffer_length = 0;
2775 break;
2776 }
2777
2778 /* Get the base address of the trace element list */
2779 mb->buffer_length = 0;
2780 mb->command = READ_TRACE_CONFIGURATION;
2781 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2782
2783 if (err != COMMAND_OK) {
2784 chdlc_error(card,err,mb);
2785 chdlc_priv_area->TracingEnabled = 0;
2786 chdlc_udp_pkt->cblock.return_code = err;
2787 mb->buffer_length = 0;
2788 break;
2789 }
2790
2791 trace_status_cfg_addr =((LINE_TRACE_CONFIG_STRUCT *)
2792 mb->data) -> ptr_trace_stat_el_cfg_struct;
2793
2794 sdla_peek(&card->hw, trace_status_cfg_addr,
2795 &trace_cfg_struct, sizeof(trace_cfg_struct));
2796
2797 chdlc_priv_area->start_trace_addr = trace_cfg_struct.
2798 base_addr_trace_status_elements;
2799
2800 chdlc_priv_area->number_trace_elements =
2801 trace_cfg_struct.number_trace_status_elements;
2802
2803 chdlc_priv_area->end_trace_addr = (unsigned long)
2804 ((TRACE_STATUS_ELEMENT_STRUCT *)
2805 chdlc_priv_area->start_trace_addr +
2806 (chdlc_priv_area->number_trace_elements - 1));
2807
2808 chdlc_priv_area->base_addr_trace_buffer =
2809 trace_cfg_struct.base_addr_trace_buffer;
2810
2811 chdlc_priv_area->end_addr_trace_buffer =
2812 trace_cfg_struct.end_addr_trace_buffer;
2813
2814 chdlc_priv_area->curr_trace_addr =
2815 trace_cfg_struct.next_trace_element_to_use;
2816
2817 chdlc_priv_area->available_buffer_space = 2000 -
2818 sizeof(ip_pkt_t) -
2819 sizeof(udp_pkt_t) -
2820 sizeof(wp_mgmt_t) -
2821 sizeof(cblock_t) -
2822 sizeof(trace_info_t);
2823 }
2824 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
2825 mb->buffer_length = 0;
2826 chdlc_priv_area->TracingEnabled = 1;
2827 break;
2828
2829
2830 case CPIPE_DISABLE_TRACING:
2831 if (chdlc_priv_area->TracingEnabled) {
2832
2833 /* OPERATE_DATALINE_MONITOR */
2834 mb->buffer_length = sizeof(LINE_TRACE_CONFIG_STRUCT);
2835 mb->command = SET_TRACE_CONFIGURATION;
2836 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
2837 trace_config = TRACE_INACTIVE;
2838 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2839 }
2840
2841 chdlc_priv_area->TracingEnabled = 0;
2842 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
2843 mb->buffer_length = 0;
2844 break;
2845
2846
2847 case CPIPE_GET_TRACE_INFO:
2848
2849 if (!chdlc_priv_area->TracingEnabled) {
2850 chdlc_udp_pkt->cblock.return_code = 1;
2851 mb->buffer_length = 0;
2852 break;
2853 }
2854
2855 chdlc_udp_pkt->trace_info.ismoredata = 0x00;
2856 buffer_length = 0; /* offset of packet already occupied */
2857
2858 for (frames=0; frames < chdlc_priv_area->number_trace_elements; frames++){
2859
2860 trace_pkt_t *trace_pkt = (trace_pkt_t *)
2861 &chdlc_udp_pkt->data[buffer_length];
2862
2863 sdla_peek(&card->hw, chdlc_priv_area->curr_trace_addr,
2864 (unsigned char *)&trace_element_struct,
2865 sizeof(TRACE_STATUS_ELEMENT_STRUCT));
2866
2867 if (trace_element_struct.opp_flag == 0x00) {
2868 break;
2869 }
2870
2871 /* get pointer to real data */
2872 data_ptr = trace_element_struct.ptr_data_bfr;
2873
2874 /* See if there is actual data on the trace buffer */
2875 if (data_ptr){
2876 data_length = trace_element_struct.trace_length;
2877 }else{
2878 data_length = 0;
2879 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
2880 }
2881
2882 if( (chdlc_priv_area->available_buffer_space - buffer_length)
2883 < ( sizeof(trace_pkt_t) + data_length) ) {
2884
2885 /* indicate there are more frames on board & exit */
2886 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
2887 break;
2888 }
2889
2890 trace_pkt->status = trace_element_struct.trace_type;
2891
2892 trace_pkt->time_stamp =
2893 trace_element_struct.trace_time_stamp;
2894
2895 trace_pkt->real_length =
2896 trace_element_struct.trace_length;
2897
2898 /* see if we can fit the frame into the user buffer */
2899 real_len = trace_pkt->real_length;
2900
2901 if (data_ptr == 0) {
2902 trace_pkt->data_avail = 0x00;
2903 } else {
2904 unsigned tmp = 0;
2905
2906 /* get the data from circular buffer
2907 must check for end of buffer */
2908 trace_pkt->data_avail = 0x01;
2909
2910 if ((data_ptr + real_len) >
2911 chdlc_priv_area->end_addr_trace_buffer + 1){
2912
2913 tmp = chdlc_priv_area->end_addr_trace_buffer - data_ptr + 1;
2914 sdla_peek(&card->hw, data_ptr,
2915 trace_pkt->data,tmp);
2916 data_ptr = chdlc_priv_area->base_addr_trace_buffer;
2917 }
2918
2919 sdla_peek(&card->hw, data_ptr,
2920 &trace_pkt->data[tmp], real_len - tmp);
2921 }
2922
2923 /* zero the opp flag to show we got the frame */
2924 ut_char = 0x00;
2925 sdla_poke(&card->hw, chdlc_priv_area->curr_trace_addr, &ut_char, 1);
2926
2927 /* now move onto the next frame */
2928 chdlc_priv_area->curr_trace_addr += sizeof(TRACE_STATUS_ELEMENT_STRUCT);
2929
2930 /* check if we went over the last address */
2931 if ( chdlc_priv_area->curr_trace_addr > chdlc_priv_area->end_trace_addr ) {
2932 chdlc_priv_area->curr_trace_addr = chdlc_priv_area->start_trace_addr;
2933 }
2934
2935 if(trace_pkt->data_avail == 0x01) {
2936 buffer_length += real_len - 1;
2937 }
2938
2939 /* for the header */
2940 buffer_length += sizeof(trace_pkt_t);
2941
2942 } /* For Loop */
2943
2944 if (frames == chdlc_priv_area->number_trace_elements){
2945 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
2946 }
2947 chdlc_udp_pkt->trace_info.num_frames = frames;
2948
2949 mb->buffer_length = buffer_length;
2950 chdlc_udp_pkt->cblock.buffer_length = buffer_length;
2951
2952 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
2953
2954 break;
2955
2956
2957 case CPIPE_FT1_READ_STATUS:
2958 ((unsigned char *)chdlc_udp_pkt->data )[0] =
2959 flags->FT1_info_struct.parallel_port_A_input;
2960
2961 ((unsigned char *)chdlc_udp_pkt->data )[1] =
2962 flags->FT1_info_struct.parallel_port_B_input;
2963
2964 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
2965 chdlc_udp_pkt->cblock.buffer_length = 2;
2966 mb->buffer_length = 2;
2967 break;
2968
2969 case CPIPE_ROUTER_UP_TIME:
2970 do_gettimeofday( &tv );
2971 chdlc_priv_area->router_up_time = tv.tv_sec -
2972 chdlc_priv_area->router_start_time;
2973 *(unsigned long *)&chdlc_udp_pkt->data =
2974 chdlc_priv_area->router_up_time;
2975 mb->buffer_length = sizeof(unsigned long);
2976 chdlc_udp_pkt->cblock.buffer_length = sizeof(unsigned long);
2977 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
2978 break;
2979
2980 case FT1_MONITOR_STATUS_CTRL:
2981 /* Enable FT1 MONITOR STATUS */
2982 if ((chdlc_udp_pkt->data[0] & ENABLE_READ_FT1_STATUS) ||
2983 (chdlc_udp_pkt->data[0] & ENABLE_READ_FT1_OP_STATS)) {
2984
2985 if( rCount++ != 0 ) {
2986 chdlc_udp_pkt->cblock.
2987 return_code = COMMAND_OK;
2988 mb->buffer_length = 1;
2989 break;
2990 }
2991 }
2992
2993 /* Disable FT1 MONITOR STATUS */
2994 if( chdlc_udp_pkt->data[0] == 0) {
2995
2996 if( --rCount != 0) {
2997 chdlc_udp_pkt->cblock.
2998 return_code = COMMAND_OK;
2999 mb->buffer_length = 1;
3000 break;
3001 }
3002 }
3003 goto dflt_1;
3004
3005 default:
3006dflt_1:
3007 /* it's a board command */
3008 mb->command = chdlc_udp_pkt->cblock.command;
3009 mb->buffer_length = chdlc_udp_pkt->cblock.buffer_length;
3010 if (mb->buffer_length) {
3011 memcpy(&mb->data, (unsigned char *) chdlc_udp_pkt->
3012 data, mb->buffer_length);
3013 }
3014 /* run the command on the board */
3015 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
3016 if (err != COMMAND_OK) {
3017 break;
3018 }
3019
3020 /* copy the result back to our buffer */
3021 memcpy(&chdlc_udp_pkt->cblock, mb, sizeof(cblock_t));
3022
3023 if (mb->buffer_length) {
3024 memcpy(&chdlc_udp_pkt->data, &mb->data,
3025 mb->buffer_length);
3026 }
3027
3028 } /* end of switch */
3029 } /* end of else */
3030
3031 /* Fill UDP TTL */
3032 chdlc_udp_pkt->ip_pkt.ttl = card->wandev.ttl;
3033
3034 len = reply_udp(chdlc_priv_area->udp_pkt_data, mb->buffer_length);
3035
3036
3037 if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK){
3038
3039 /* Must check if we interrupted if_send() routine. The
3040 * tx buffers might be used. If so drop the packet */
3041 if (!test_bit(SEND_CRIT,&card->wandev.critical)) {
3042
3043 if(!chdlc_send(card, chdlc_priv_area->udp_pkt_data, len)) {
3044 ++ card->wandev.stats.tx_packets;
3045 card->wandev.stats.tx_bytes += len;
3046 }
3047 }
3048 } else {
3049
3050 /* Pass it up the stack
3051 Allocate socket buffer */
3052 if ((new_skb = dev_alloc_skb(len)) != NULL) {
3053 /* copy data into new_skb */
3054
3055 buf = skb_put(new_skb, len);
3056 memcpy(buf, chdlc_priv_area->udp_pkt_data, len);
3057
3058 /* Decapsulate pkt and pass it up the protocol stack */
3059 new_skb->protocol = htons(ETH_P_IP);
3060 new_skb->dev = dev;
3061 new_skb->mac.raw = new_skb->data;
3062
3063 netif_rx(new_skb);
3064 dev->last_rx = jiffies;
3065 } else {
3066
3067 printk(KERN_INFO "%s: no socket buffers available!\n",
3068 card->devname);
3069 }
3070 }
3071
3072 chdlc_priv_area->udp_pkt_lgth = 0;
3073
3074 return 0;
3075}
3076
3077/*============================================================================
3078 * Initialize Receive and Transmit Buffers.
3079 */
3080
3081static void init_chdlc_tx_rx_buff( sdla_t* card)
3082{
3083 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
3084 CHDLC_TX_STATUS_EL_CFG_STRUCT *tx_config;
3085 CHDLC_RX_STATUS_EL_CFG_STRUCT *rx_config;
3086 char err;
3087
3088 mb->buffer_length = 0;
3089 mb->command = READ_CHDLC_CONFIGURATION;
3090 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
3091
3092 if(err != COMMAND_OK) {
3093 if (card->wandev.dev){
3094 chdlc_error(card,err,mb);
3095 }
3096 return;
3097 }
3098
3099 if(card->hw.type == SDLA_S514) {
3100 tx_config = (CHDLC_TX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
3101 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
3102 ptr_CHDLC_Tx_stat_el_cfg_struct));
3103 rx_config = (CHDLC_RX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
3104 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
3105 ptr_CHDLC_Rx_stat_el_cfg_struct));
3106
3107 /* Setup Head and Tails for buffers */
3108 card->u.c.txbuf_base = (void *)(card->hw.dpmbase +
3109 tx_config->base_addr_Tx_status_elements);
3110 card->u.c.txbuf_last =
3111 (CHDLC_DATA_TX_STATUS_EL_STRUCT *)
3112 card->u.c.txbuf_base +
3113 (tx_config->number_Tx_status_elements - 1);
3114
3115 card->u.c.rxbuf_base = (void *)(card->hw.dpmbase +
3116 rx_config->base_addr_Rx_status_elements);
3117 card->u.c.rxbuf_last =
3118 (CHDLC_DATA_RX_STATUS_EL_STRUCT *)
3119 card->u.c.rxbuf_base +
3120 (rx_config->number_Rx_status_elements - 1);
3121
3122 /* Set up next pointer to be used */
3123 card->u.c.txbuf = (void *)(card->hw.dpmbase +
3124 tx_config->next_Tx_status_element_to_use);
3125 card->u.c.rxmb = (void *)(card->hw.dpmbase +
3126 rx_config->next_Rx_status_element_to_use);
3127 }
3128 else {
3129 tx_config = (CHDLC_TX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
3130 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
3131 ptr_CHDLC_Tx_stat_el_cfg_struct % SDLA_WINDOWSIZE));
3132
3133 rx_config = (CHDLC_RX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
3134 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
3135 ptr_CHDLC_Rx_stat_el_cfg_struct % SDLA_WINDOWSIZE));
3136
3137 /* Setup Head and Tails for buffers */
3138 card->u.c.txbuf_base = (void *)(card->hw.dpmbase +
3139 (tx_config->base_addr_Tx_status_elements % SDLA_WINDOWSIZE));
3140 card->u.c.txbuf_last =
3141 (CHDLC_DATA_TX_STATUS_EL_STRUCT *)card->u.c.txbuf_base
3142 + (tx_config->number_Tx_status_elements - 1);
3143 card->u.c.rxbuf_base = (void *)(card->hw.dpmbase +
3144 (rx_config->base_addr_Rx_status_elements % SDLA_WINDOWSIZE));
3145 card->u.c.rxbuf_last =
3146 (CHDLC_DATA_RX_STATUS_EL_STRUCT *)card->u.c.rxbuf_base
3147 + (rx_config->number_Rx_status_elements - 1);
3148
3149 /* Set up next pointer to be used */
3150 card->u.c.txbuf = (void *)(card->hw.dpmbase +
3151 (tx_config->next_Tx_status_element_to_use % SDLA_WINDOWSIZE));
3152 card->u.c.rxmb = (void *)(card->hw.dpmbase +
3153 (rx_config->next_Rx_status_element_to_use % SDLA_WINDOWSIZE));
3154 }
3155
3156 /* Setup Actual Buffer Start and end addresses */
3157 card->u.c.rx_base = rx_config->base_addr_Rx_buffer;
3158 card->u.c.rx_top = rx_config->end_addr_Rx_buffer;
3159
3160}
3161
3162/*=============================================================================
3163 * Perform Interrupt Test by running READ_CHDLC_CODE_VERSION command MAX_INTR
3164 * _TEST_COUNTER times.
3165 */
3166static int intr_test( sdla_t* card)
3167{
3168 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
3169 int err,i;
3170
3171 Intr_test_counter = 0;
3172
3173 err = chdlc_set_intr_mode(card, APP_INT_ON_COMMAND_COMPLETE);
3174
3175 if (err == CMD_OK) {
3176 for (i = 0; i < MAX_INTR_TEST_COUNTER; i ++) {
3177 mb->buffer_length = 0;
3178 mb->command = READ_CHDLC_CODE_VERSION;
3179 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
3180 if (err != CMD_OK)
3181 chdlc_error(card, err, mb);
3182 }
3183 }
3184 else {
3185 return err;
3186 }
3187
3188 err = chdlc_set_intr_mode(card, 0);
3189
3190 if (err != CMD_OK)
3191 return err;
3192
3193 return 0;
3194}
3195
3196/*==============================================================================
3197 * Determine what type of UDP call it is. CPIPEAB ?
3198 */
3199static int udp_pkt_type(struct sk_buff *skb, sdla_t* card)
3200{
3201 chdlc_udp_pkt_t *chdlc_udp_pkt = (chdlc_udp_pkt_t *)skb->data;
3202
3203#ifdef _WAN_UDP_DEBUG
3204 printk(KERN_INFO "SIG %s = %s\n\
3205 UPP %x = %x\n\
3206 PRT %x = %x\n\
3207 REQ %i = %i\n\
3208 36 th = %x 37th = %x\n",
3209 chdlc_udp_pkt->wp_mgmt.signature,
3210 UDPMGMT_SIGNATURE,
3211 chdlc_udp_pkt->udp_pkt.udp_dst_port,
3212 ntohs(card->wandev.udp_port),
3213 chdlc_udp_pkt->ip_pkt.protocol,
3214 UDPMGMT_UDP_PROTOCOL,
3215 chdlc_udp_pkt->wp_mgmt.request_reply,
3216 UDPMGMT_REQUEST,
3217 skb->data[36], skb->data[37]);
3218#endif
3219
3220 if (!strncmp(chdlc_udp_pkt->wp_mgmt.signature,UDPMGMT_SIGNATURE,8) &&
3221 (chdlc_udp_pkt->udp_pkt.udp_dst_port == ntohs(card->wandev.udp_port)) &&
3222 (chdlc_udp_pkt->ip_pkt.protocol == UDPMGMT_UDP_PROTOCOL) &&
3223 (chdlc_udp_pkt->wp_mgmt.request_reply == UDPMGMT_REQUEST)) {
3224
3225 return UDP_CPIPE_TYPE;
3226
3227 }else{
3228 return UDP_INVALID_TYPE;
3229 }
3230}
3231
3232/*============================================================================
3233 * Set PORT state.
3234 */
3235static void port_set_state (sdla_t *card, int state)
3236{
3237 if (card->u.c.state != state)
3238 {
3239 switch (state)
3240 {
3241 case WAN_CONNECTED:
3242 printk (KERN_INFO "%s: Link connected!\n",
3243 card->devname);
3244 break;
3245
3246 case WAN_CONNECTING:
3247 printk (KERN_INFO "%s: Link connecting...\n",
3248 card->devname);
3249 break;
3250
3251 case WAN_DISCONNECTED:
3252 printk (KERN_INFO "%s: Link disconnected!\n",
3253 card->devname);
3254 break;
3255 }
3256
3257 card->wandev.state = card->u.c.state = state;
3258 if (card->wandev.dev){
3259 struct net_device *dev = card->wandev.dev;
3260 chdlc_private_area_t *chdlc_priv_area = dev->priv;
3261 chdlc_priv_area->common.state = state;
3262 }
3263 }
3264}
3265
3266/*===========================================================================
3267 * config_chdlc
3268 *
3269 * Configure the chdlc protocol and enable communications.
3270 *
3271 * The if_open() function binds this function to the poll routine.
3272 * Therefore, this function will run every time the chdlc interface
3273 * is brought up. We cannot run this function from the if_open
3274 * because if_open does not have access to the remote IP address.
3275 *
3276 * If the communications are not enabled, proceed to configure
3277 * the card and enable communications.
3278 *
3279 * If the communications are enabled, it means that the interface
3280 * was shutdown by ether the user or driver. In this case, we
3281 * have to check that the IP addresses have not changed. If
3282 * the IP addresses have changed, we have to reconfigure the firmware
3283 * and update the changed IP addresses. Otherwise, just exit.
3284 *
3285 */
3286
3287static int config_chdlc (sdla_t *card)
3288{
3289 struct net_device *dev = card->wandev.dev;
3290 chdlc_private_area_t *chdlc_priv_area = dev->priv;
3291 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
3292
3293 if (card->u.c.comm_enabled){
3294
3295 /* Jun 20. 2000: NC
3296 * IP addresses are not used in the API mode */
3297
3298 if ((chdlc_priv_area->ip_local_tmp != chdlc_priv_area->ip_local ||
3299 chdlc_priv_area->ip_remote_tmp != chdlc_priv_area->ip_remote) &&
3300 card->u.c.usedby == WANPIPE) {
3301
3302 /* The IP addersses have changed, we must
3303 * stop the communications and reconfigure
3304 * the card. Reason: the firmware must know
3305 * the local and remote IP addresses. */
3306 disable_comm(card);
3307 port_set_state(card, WAN_DISCONNECTED);
3308 printk(KERN_INFO
3309 "%s: IP addresses changed!\n",
3310 card->devname);
3311 printk(KERN_INFO
3312 "%s: Restarting communications ...\n",
3313 card->devname);
3314 }else{
3315 /* IP addresses are the same and the link is up,
3316 * we don't have to do anything here. Therefore, exit */
3317 return 0;
3318 }
3319 }
3320
3321 chdlc_priv_area->ip_local = chdlc_priv_area->ip_local_tmp;
3322 chdlc_priv_area->ip_remote = chdlc_priv_area->ip_remote_tmp;
3323
3324
3325 /* Setup the Board for asynchronous mode */
3326 if (card->u.c.async_mode){
3327
3328 if (set_asy_config(card)) {
3329 printk (KERN_INFO "%s: Failed CHDLC Async configuration!\n",
3330 card->devname);
3331 return 0;
3332 }
3333 }else{
3334 /* Setup the Board for CHDLC */
3335 if (set_chdlc_config(card)) {
3336 printk (KERN_INFO "%s: Failed CHDLC configuration!\n",
3337 card->devname);
3338 return 0;
3339 }
3340 }
3341
3342 /* Set interrupt mode and mask */
3343 if (chdlc_set_intr_mode(card, APP_INT_ON_RX_FRAME |
3344 APP_INT_ON_GLOBAL_EXCEP_COND |
3345 APP_INT_ON_TX_FRAME |
3346 APP_INT_ON_CHDLC_EXCEP_COND | APP_INT_ON_TIMER)){
3347 printk (KERN_INFO "%s: Failed to set interrupt triggers!\n",
3348 card->devname);
3349 return 0;
3350 }
3351
3352
3353 /* Mask the Transmit and Timer interrupt */
3354 flags->interrupt_info_struct.interrupt_permission &=
3355 ~(APP_INT_ON_TX_FRAME | APP_INT_ON_TIMER);
3356
3357 /* In TTY mode, receive interrupt will be enabled during
3358 * wanpipe_tty_open() operation */
3359 if (card->tty_opt){
3360 flags->interrupt_info_struct.interrupt_permission &= ~APP_INT_ON_RX_FRAME;
3361 }
3362
3363 /* Enable communications */
3364 if (card->u.c.async_mode){
3365 if (asy_comm_enable(card) != 0) {
3366 printk(KERN_INFO "%s: Failed to enable async commnunication!\n",
3367 card->devname);
3368 flags->interrupt_info_struct.interrupt_permission = 0;
3369 card->u.c.comm_enabled=0;
3370 chdlc_set_intr_mode(card,0);
3371 return 0;
3372 }
3373 }else{
3374 if (chdlc_comm_enable(card) != 0) {
3375 printk(KERN_INFO "%s: Failed to enable chdlc communications!\n",
3376 card->devname);
3377 flags->interrupt_info_struct.interrupt_permission = 0;
3378 card->u.c.comm_enabled=0;
3379 chdlc_set_intr_mode(card,0);
3380 return 0;
3381 }
3382 }
3383
3384 /* Initialize Rx/Tx buffer control fields */
3385 init_chdlc_tx_rx_buff(card);
3386 port_set_state(card, WAN_CONNECTING);
3387 return 0;
3388}
3389
3390
3391/*============================================================
3392 * chdlc_poll
3393 *
3394 * Rationale:
3395 * We cannot manipulate the routing tables, or
3396 * ip addresses withing the interrupt. Therefore
3397 * we must perform such actons outside an interrupt
3398 * at a later time.
3399 *
3400 * Description:
3401 * CHDLC polling routine, responsible for
3402 * shutting down interfaces upon disconnect
3403 * and adding/removing routes.
3404 *
3405 * Usage:
3406 * This function is executed for each CHDLC
3407 * interface through a tq_schedule bottom half.
3408 *
3409 * trigger_chdlc_poll() function is used to kick
3410 * the chldc_poll routine.
3411 */
3412
3413static void chdlc_poll(struct net_device *dev)
3414{
3415 chdlc_private_area_t *chdlc_priv_area;
3416 sdla_t *card;
3417 u8 check_gateway=0;
3418 SHARED_MEMORY_INFO_STRUCT* flags;
3419
3420
3421 if (!dev || (chdlc_priv_area=dev->priv) == NULL)
3422 return;
3423
3424 card = chdlc_priv_area->card;
3425 flags = card->u.c.flags;
3426
3427 /* (Re)Configuraiton is in progress, stop what you are
3428 * doing and get out */
3429 if (test_bit(PERI_CRIT,&card->wandev.critical)){
3430 clear_bit(POLL_CRIT,&card->wandev.critical);
3431 return;
3432 }
3433
3434 /* if_open() function has triggered the polling routine
3435 * to determine the configured IP addresses. Once the
3436 * addresses are found, trigger the chdlc configuration */
3437 if (test_bit(0,&chdlc_priv_area->config_chdlc)){
3438
3439 chdlc_priv_area->ip_local_tmp = get_ip_address(dev,WAN_LOCAL_IP);
3440 chdlc_priv_area->ip_remote_tmp = get_ip_address(dev,WAN_POINTOPOINT_IP);
3441
3442 /* Jun 20. 2000 Bug Fix
3443 * Only perform this check in WANPIPE mode, since
3444 * IP addresses are not used in the API mode. */
3445
3446 if (chdlc_priv_area->ip_local_tmp == chdlc_priv_area->ip_remote_tmp &&
3447 card->u.c.slarp_timer == 0x00 &&
3448 !card->u.c.backup &&
3449 card->u.c.usedby == WANPIPE){
3450
3451 if (++chdlc_priv_area->ip_error > MAX_IP_ERRORS){
3452 printk(KERN_INFO "\n%s: --- WARNING ---\n",
3453 card->devname);
3454 printk(KERN_INFO
3455 "%s: The local IP address is the same as the\n",
3456 card->devname);
3457 printk(KERN_INFO
3458 "%s: Point-to-Point IP address.\n",
3459 card->devname);
3460 printk(KERN_INFO "%s: --- WARNING ---\n\n",
3461 card->devname);
3462 }else{
3463 clear_bit(POLL_CRIT,&card->wandev.critical);
3464 chdlc_priv_area->poll_delay_timer.expires = jiffies+HZ;
3465 add_timer(&chdlc_priv_area->poll_delay_timer);
3466 return;
3467 }
3468 }
3469
3470 clear_bit(0,&chdlc_priv_area->config_chdlc);
3471 clear_bit(POLL_CRIT,&card->wandev.critical);
3472
3473 chdlc_priv_area->timer_int_enabled |= TMR_INT_ENABLED_CONFIG;
3474 flags->interrupt_info_struct.interrupt_permission |= APP_INT_ON_TIMER;
3475 return;
3476 }
3477 /* Dynamic interface implementation, as well as dynamic
3478 * routing. */
3479
3480 switch (card->u.c.state){
3481
3482 case WAN_DISCONNECTED:
3483
3484 /* If the dynamic interface configuration is on, and interface
3485 * is up, then bring down the netowrk interface */
3486
3487 if (test_bit(DYN_OPT_ON,&chdlc_priv_area->interface_down) &&
3488 !test_bit(DEV_DOWN, &chdlc_priv_area->interface_down) &&
3489 card->wandev.dev->flags & IFF_UP){
3490
3491 printk(KERN_INFO "%s: Interface %s down.\n",
3492 card->devname,card->wandev.dev->name);
3493 change_dev_flags(card->wandev.dev,(card->wandev.dev->flags&~IFF_UP));
3494 set_bit(DEV_DOWN,&chdlc_priv_area->interface_down);
3495 chdlc_priv_area->route_status = NO_ROUTE;
3496
3497 }else{
3498 /* We need to check if the local IP address is
3499 * zero. If it is, we shouldn't try to remove it.
3500 */
3501
3502 if (card->wandev.dev->flags & IFF_UP &&
3503 get_ip_address(card->wandev.dev,WAN_LOCAL_IP) &&
3504 chdlc_priv_area->route_status != NO_ROUTE &&
3505 card->u.c.slarp_timer){
3506
3507 process_route(card);
3508 }
3509 }
3510 break;
3511
3512 case WAN_CONNECTED:
3513
3514 /* In SMP machine this code can execute before the interface
3515 * comes up. In this case, we must make sure that we do not
3516 * try to bring up the interface before dev_open() is finished */
3517
3518
3519 /* DEV_DOWN will be set only when we bring down the interface
3520 * for the very first time. This way we know that it was us
3521 * that brought the interface down */
3522
3523 if (test_bit(DYN_OPT_ON,&chdlc_priv_area->interface_down) &&
3524 test_bit(DEV_DOWN, &chdlc_priv_area->interface_down) &&
3525 !(card->wandev.dev->flags & IFF_UP)){
3526
3527 printk(KERN_INFO "%s: Interface %s up.\n",
3528 card->devname,card->wandev.dev->name);
3529 change_dev_flags(card->wandev.dev,(card->wandev.dev->flags|IFF_UP));
3530 clear_bit(DEV_DOWN,&chdlc_priv_area->interface_down);
3531 check_gateway=1;
3532 }
3533
3534 if (chdlc_priv_area->route_status == ADD_ROUTE &&
3535 card->u.c.slarp_timer){
3536
3537 process_route(card);
3538 check_gateway=1;
3539 }
3540
3541 if (chdlc_priv_area->gateway && check_gateway)
3542 add_gateway(card,dev);
3543
3544 break;
3545 }
3546
3547 clear_bit(POLL_CRIT,&card->wandev.critical);
3548}
3549
3550/*============================================================
3551 * trigger_chdlc_poll
3552 *
3553 * Description:
3554 * Add a chdlc_poll() work entry into the keventd work queue
3555 * for a specific dlci/interface. This will kick
3556 * the fr_poll() routine at a later time.
3557 *
3558 * Usage:
3559 * Interrupts use this to defer a taks to
3560 * a polling routine.
3561 *
3562 */
3563static void trigger_chdlc_poll(struct net_device *dev)
3564{
3565 chdlc_private_area_t *chdlc_priv_area;
3566 sdla_t *card;
3567
3568 if (!dev)
3569 return;
3570
3571 if ((chdlc_priv_area = dev->priv)==NULL)
3572 return;
3573
3574 card = chdlc_priv_area->card;
3575
3576 if (test_and_set_bit(POLL_CRIT,&card->wandev.critical)){
3577 return;
3578 }
3579 if (test_bit(PERI_CRIT,&card->wandev.critical)){
3580 return;
3581 }
3582 schedule_work(&chdlc_priv_area->poll_work);
3583}
3584
3585
3586static void chdlc_poll_delay (unsigned long dev_ptr)
3587{
3588 struct net_device *dev = (struct net_device *)dev_ptr;
3589 trigger_chdlc_poll(dev);
3590}
3591
3592
3593void s508_lock (sdla_t *card, unsigned long *smp_flags)
3594{
3595 spin_lock_irqsave(&card->wandev.lock, *smp_flags);
3596 if (card->next){
3597 spin_lock(&card->next->wandev.lock);
3598 }
3599}
3600
3601void s508_unlock (sdla_t *card, unsigned long *smp_flags)
3602{
3603 if (card->next){
3604 spin_unlock(&card->next->wandev.lock);
3605 }
3606 spin_unlock_irqrestore(&card->wandev.lock, *smp_flags);
3607}
3608
3609//*********** TTY SECTION ****************
3610
3611static void wanpipe_tty_trigger_tx_irq(sdla_t *card)
3612{
3613 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
3614 INTERRUPT_INFORMATION_STRUCT *chdlc_int = &flags->interrupt_info_struct;
3615 chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
3616}
3617
3618static void wanpipe_tty_trigger_poll(sdla_t *card)
3619{
3620 schedule_work(&card->tty_work);
3621}
3622
3623static void tty_poll_work (void* data)
3624{
3625 sdla_t *card = (sdla_t*)data;
3626 struct tty_struct *tty;
3627
3628 if ((tty=card->tty)==NULL)
3629 return;
3630
3631 tty_wakeup(tty);
3632#if defined(SERIAL_HAVE_POLL_WAIT)
3633 wake_up_interruptible(&tty->poll_wait);
3634#endif
3635 return;
3636}
3637
3638static void wanpipe_tty_close(struct tty_struct *tty, struct file * filp)
3639{
3640 sdla_t *card;
3641 unsigned long smp_flags;
3642
3643 if (!tty || !tty->driver_data){
3644 return;
3645 }
3646
3647 card = (sdla_t*)tty->driver_data;
3648
3649 if (!card)
3650 return;
3651
3652 printk(KERN_INFO "%s: Closing TTY Driver!\n",
3653 card->devname);
3654
3655 /* Sanity Check */
3656 if (!card->tty_open)
3657 return;
3658
3659 wanpipe_close(card);
3660 if (--card->tty_open == 0){
3661
3662 lock_adapter_irq(&card->wandev.lock,&smp_flags);
3663 card->tty=NULL;
3664 chdlc_disable_comm_shutdown(card);
3665 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
3666
3667 kfree(card->tty_buf);
3668 card->tty_buf = NULL;
3669 kfree(card->tty_rx);
3670 card->tty_rx = NULL;
3671 }
3672 return;
3673}
3674static int wanpipe_tty_open(struct tty_struct *tty, struct file * filp)
3675{
3676 unsigned long smp_flags;
3677 sdla_t *card;
3678
3679 if (!tty){
3680 return -ENODEV;
3681 }
3682
3683 if (!tty->driver_data){
3684 int port;
3685 port = tty->index;
3686 if ((port < 0) || (port >= NR_PORTS))
3687 return -ENODEV;
3688
3689 tty->driver_data = WAN_CARD(port);
3690 if (!tty->driver_data)
3691 return -ENODEV;
3692 }
3693
3694 card = (sdla_t*)tty->driver_data;
3695
3696 if (!card){
3697 lock_adapter_irq(&card->wandev.lock,&smp_flags);
3698 card->tty=NULL;
3699 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
3700 return -ENODEV;
3701 }
3702
3703 printk(KERN_INFO "%s: Opening TTY Driver!\n",
3704 card->devname);
3705
3706 if (card->tty_open == 0){
3707 lock_adapter_irq(&card->wandev.lock,&smp_flags);
3708 card->tty=tty;
3709 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
3710
3711 if (!card->tty_buf){
3712 card->tty_buf = kmalloc(TTY_CHDLC_MAX_MTU, GFP_KERNEL);
3713 if (!card->tty_buf){
3714 card->tty_buf=NULL;
3715 card->tty=NULL;
3716 return -ENOMEM;
3717 }
3718 }
3719
3720 if (!card->tty_rx){
3721 card->tty_rx = kmalloc(TTY_CHDLC_MAX_MTU, GFP_KERNEL);
3722 if (!card->tty_rx){
3723 /* Free the buffer above */
3724 kfree(card->tty_buf);
3725 card->tty_buf=NULL;
3726 card->tty=NULL;
3727 return -ENOMEM;
3728 }
3729 }
3730 }
3731
3732 ++card->tty_open;
3733 wanpipe_open(card);
3734 return 0;
3735}
3736
3737static int wanpipe_tty_write(struct tty_struct * tty, const unsigned char *buf, int count)
3738{
3739 unsigned long smp_flags=0;
3740 sdla_t *card=NULL;
3741
3742 if (!tty){
3743 dbg_printk(KERN_INFO "NO TTY in Write\n");
3744 return -ENODEV;
3745 }
3746
3747 card = (sdla_t *)tty->driver_data;
3748
3749 if (!card){
3750 dbg_printk(KERN_INFO "No Card in TTY Write\n");
3751 return -ENODEV;
3752 }
3753
3754 if (count > card->wandev.mtu){
3755 dbg_printk(KERN_INFO "Frame too big in Write %i Max: %i\n",
3756 count,card->wandev.mtu);
3757 return -EINVAL;
3758 }
3759
3760 if (card->wandev.state != WAN_CONNECTED){
3761 dbg_printk(KERN_INFO "Card not connected in TTY Write\n");
3762 return -EINVAL;
3763 }
3764
3765 /* Lock the 508 Card: SMP is supported */
3766 if(card->hw.type != SDLA_S514){
3767 s508_lock(card,&smp_flags);
3768 }
3769
3770 if (test_and_set_bit(SEND_CRIT,(void*)&card->wandev.critical)){
3771 printk(KERN_INFO "%s: Critical in TTY Write\n",
3772 card->devname);
3773
3774 /* Lock the 508 Card: SMP is supported */
3775 if(card->hw.type != SDLA_S514)
3776 s508_unlock(card,&smp_flags);
3777
3778 return -EINVAL;
3779 }
3780
3781 if (chdlc_send(card,(void*)buf,count)){
3782 dbg_printk(KERN_INFO "%s: Failed to send, retry later: kernel!\n",
3783 card->devname);
3784 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
3785
3786 wanpipe_tty_trigger_tx_irq(card);
3787
3788 if(card->hw.type != SDLA_S514)
3789 s508_unlock(card,&smp_flags);
3790 return 0;
3791 }
3792 dbg_printk(KERN_INFO "%s: Packet sent OK: %i\n",card->devname,count);
3793 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
3794
3795 if(card->hw.type != SDLA_S514)
3796 s508_unlock(card,&smp_flags);
3797
3798 return count;
3799}
3800
3801static void wanpipe_tty_receive(sdla_t *card, unsigned addr, unsigned int len)
3802{
3803 unsigned offset=0;
3804 unsigned olen=len;
3805 char fp=0;
3806 struct tty_struct *tty;
3807 int i;
3808 struct tty_ldisc *ld;
3809
3810 if (!card->tty_open){
3811 dbg_printk(KERN_INFO "%s: TTY not open during receive\n",
3812 card->devname);
3813 return;
3814 }
3815
3816 if ((tty=card->tty) == NULL){
3817 dbg_printk(KERN_INFO "%s: No TTY on receive\n",
3818 card->devname);
3819 return;
3820 }
3821
3822 if (!tty->driver_data){
3823 dbg_printk(KERN_INFO "%s: No Driver Data, or Flip on receive\n",
3824 card->devname);
3825 return;
3826 }
3827
3828
3829 if (card->u.c.async_mode){
3830 if ((tty->flip.count+len) >= TTY_FLIPBUF_SIZE){
3831 if (net_ratelimit()){
3832 printk(KERN_INFO
3833 "%s: Received packet size too big: %i bytes, Max: %i!\n",
3834 card->devname,len,TTY_FLIPBUF_SIZE);
3835 }
3836 return;
3837 }
3838
3839
3840 if((addr + len) > card->u.c.rx_top + 1) {
3841 offset = card->u.c.rx_top - addr + 1;
3842
3843 sdla_peek(&card->hw, addr, tty->flip.char_buf_ptr, offset);
3844
3845 addr = card->u.c.rx_base;
3846 len -= offset;
3847
3848 tty->flip.char_buf_ptr+=offset;
3849 tty->flip.count+=offset;
3850 for (i=0;i<offset;i++){
3851 *tty->flip.flag_buf_ptr = 0;
3852 tty->flip.flag_buf_ptr++;
3853 }
3854 }
3855
3856 sdla_peek(&card->hw, addr, tty->flip.char_buf_ptr, len);
3857
3858 tty->flip.char_buf_ptr+=len;
3859 card->tty->flip.count+=len;
3860 for (i=0;i<len;i++){
3861 *tty->flip.flag_buf_ptr = 0;
3862 tty->flip.flag_buf_ptr++;
3863 }
3864
3865 tty->low_latency=1;
3866 tty_flip_buffer_push(tty);
3867 }else{
3868 if (!card->tty_rx){
3869 if (net_ratelimit()){
3870 printk(KERN_INFO
3871 "%s: Receive sync buffer not available!\n",
3872 card->devname);
3873 }
3874 return;
3875 }
3876
3877 if (len > TTY_CHDLC_MAX_MTU){
3878 if (net_ratelimit()){
3879 printk(KERN_INFO
3880 "%s: Received packet size too big: %i bytes, Max: %i!\n",
3881 card->devname,len,TTY_FLIPBUF_SIZE);
3882 }
3883 return;
3884 }
3885
3886
3887 if((addr + len) > card->u.c.rx_top + 1) {
3888 offset = card->u.c.rx_top - addr + 1;
3889
3890 sdla_peek(&card->hw, addr, card->tty_rx, offset);
3891
3892 addr = card->u.c.rx_base;
3893 len -= offset;
3894 }
3895 sdla_peek(&card->hw, addr, card->tty_rx+offset, len);
3896 ld = tty_ldisc_ref(tty);
3897 if (ld) {
3898 if (ld->receive_buf)
3899 ld->receive_buf(tty,card->tty_rx,&fp,olen);
3900 tty_ldisc_deref(ld);
3901 }else{
3902 if (net_ratelimit()){
3903 printk(KERN_INFO
3904 "%s: NO TTY Sync line discipline!\n",
3905 card->devname);
3906 }
3907 }
3908 }
3909
3910 dbg_printk(KERN_INFO "%s: Received Data %i\n",card->devname,olen);
3911 return;
3912}
3913
3914#if 0
3915static int wanpipe_tty_ioctl(struct tty_struct *tty, struct file * file,
3916 unsigned int cmd, unsigned long arg)
3917{
3918 return -ENOIOCTLCMD;
3919}
3920#endif
3921
3922static void wanpipe_tty_stop(struct tty_struct *tty)
3923{
3924 return;
3925}
3926
3927static void wanpipe_tty_start(struct tty_struct *tty)
3928{
3929 return;
3930}
3931
3932static int config_tty (sdla_t *card)
3933{
3934 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
3935
3936 /* Setup the Board for asynchronous mode */
3937 if (card->u.c.async_mode){
3938
3939 if (set_asy_config(card)) {
3940 printk (KERN_INFO "%s: Failed CHDLC Async configuration!\n",
3941 card->devname);
3942 return -EINVAL;
3943 }
3944 }else{
3945 /* Setup the Board for CHDLC */
3946 if (set_chdlc_config(card)) {
3947 printk (KERN_INFO "%s: Failed CHDLC configuration!\n",
3948 card->devname);
3949 return -EINVAL;
3950 }
3951 }
3952
3953 /* Set interrupt mode and mask */
3954 if (chdlc_set_intr_mode(card, APP_INT_ON_RX_FRAME |
3955 APP_INT_ON_GLOBAL_EXCEP_COND |
3956 APP_INT_ON_TX_FRAME |
3957 APP_INT_ON_CHDLC_EXCEP_COND | APP_INT_ON_TIMER)){
3958 printk (KERN_INFO "%s: Failed to set interrupt triggers!\n",
3959 card->devname);
3960 return -EINVAL;
3961 }
3962
3963
3964 /* Mask the Transmit and Timer interrupt */
3965 flags->interrupt_info_struct.interrupt_permission &=
3966 ~(APP_INT_ON_TX_FRAME | APP_INT_ON_TIMER);
3967
3968
3969 /* Enable communications */
3970 if (card->u.c.async_mode){
3971 if (asy_comm_enable(card) != 0) {
3972 printk(KERN_INFO "%s: Failed to enable async commnunication!\n",
3973 card->devname);
3974 flags->interrupt_info_struct.interrupt_permission = 0;
3975 card->u.c.comm_enabled=0;
3976 chdlc_set_intr_mode(card,0);
3977 return -EINVAL;
3978 }
3979 }else{
3980 if (chdlc_comm_enable(card) != 0) {
3981 printk(KERN_INFO "%s: Failed to enable chdlc communications!\n",
3982 card->devname);
3983 flags->interrupt_info_struct.interrupt_permission = 0;
3984 card->u.c.comm_enabled=0;
3985 chdlc_set_intr_mode(card,0);
3986 return -EINVAL;
3987 }
3988 }
3989
3990 /* Initialize Rx/Tx buffer control fields */
3991 init_chdlc_tx_rx_buff(card);
3992 port_set_state(card, WAN_CONNECTING);
3993 return 0;
3994}
3995
3996
3997static int change_speed(sdla_t *card, struct tty_struct *tty,
3998 struct termios *old_termios)
3999{
4000 int baud, ret=0;
4001 unsigned cflag;
4002 int dbits,sbits,parity,handshaking;
4003
4004 cflag = tty->termios->c_cflag;
4005
4006 /* There is always one stop bit */
4007 sbits=WANOPT_ONE;
4008
4009 /* Parity is defaulted to NONE */
4010 parity = WANOPT_NONE;
4011
4012 handshaking=0;
4013
4014 /* byte size and parity */
4015 switch (cflag & CSIZE) {
4016 case CS5: dbits = 5; break;
4017 case CS6: dbits = 6; break;
4018 case CS7: dbits = 7; break;
4019 case CS8: dbits = 8; break;
4020 /* Never happens, but GCC is too dumb to figure it out */
4021 default: dbits = 8; break;
4022 }
4023
4024 /* One more stop bit should be supported, thus increment
4025 * the number of stop bits Max=2 */
4026 if (cflag & CSTOPB) {
4027 sbits = WANOPT_TWO;
4028 }
4029 if (cflag & PARENB) {
4030 parity = WANOPT_EVEN;
4031 }
4032 if (cflag & PARODD){
4033 parity = WANOPT_ODD;
4034 }
4035
4036 /* Determine divisor based on baud rate */
4037 baud = tty_get_baud_rate(tty);
4038
4039 if (!baud)
4040 baud = 9600; /* B0 transition handled in rs_set_termios */
4041
4042 if (cflag & CRTSCTS) {
4043 handshaking|=ASY_RTS_HS_FOR_RX;
4044 }
4045
4046 if (I_IGNPAR(tty))
4047 parity = WANOPT_NONE;
4048
4049 if (I_IXOFF(tty)){
4050 handshaking|=ASY_XON_XOFF_HS_FOR_RX;
4051 handshaking|=ASY_XON_XOFF_HS_FOR_TX;
4052 }
4053
4054 if (I_IXON(tty)){
4055 handshaking|=ASY_XON_XOFF_HS_FOR_RX;
4056 handshaking|=ASY_XON_XOFF_HS_FOR_TX;
4057 }
4058
4059 if (card->u.c.async_mode){
4060 if (card->wandev.bps != baud)
4061 ret=1;
4062 card->wandev.bps = baud;
4063 }
4064
4065 if (card->u.c.async_mode){
4066 if (card->u.c.protocol_options != handshaking)
4067 ret=1;
4068 card->u.c.protocol_options = handshaking;
4069
4070 if (card->u.c.tx_bits_per_char != dbits)
4071 ret=1;
4072 card->u.c.tx_bits_per_char = dbits;
4073
4074 if (card->u.c.rx_bits_per_char != dbits)
4075 ret=1;
4076 card->u.c.rx_bits_per_char = dbits;
4077
4078 if (card->u.c.stop_bits != sbits)
4079 ret=1;
4080 card->u.c.stop_bits = sbits;
4081
4082 if (card->u.c.parity != parity)
4083 ret=1;
4084 card->u.c.parity = parity;
4085
4086 card->u.c.break_timer = 50;
4087 card->u.c.inter_char_timer = 10;
4088 card->u.c.rx_complete_length = 100;
4089 card->u.c.xon_char = 0xFE;
4090 }else{
4091 card->u.c.protocol_options = HDLC_STREAMING_MODE;
4092 }
4093
4094 return ret;
4095}
4096
4097
4098static void wanpipe_tty_set_termios(struct tty_struct *tty, struct termios *old_termios)
4099{
4100 sdla_t *card;
4101 int err=1;
4102
4103 if (!tty){
4104 return;
4105 }
4106
4107 card = (sdla_t *)tty->driver_data;
4108
4109 if (!card)
4110 return;
4111
4112 if (change_speed(card, tty, old_termios) || !card->u.c.comm_enabled){
4113 unsigned long smp_flags;
4114
4115 if (card->u.c.comm_enabled){
4116 lock_adapter_irq(&card->wandev.lock,&smp_flags);
4117 chdlc_disable_comm_shutdown(card);
4118 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
4119 }
4120 lock_adapter_irq(&card->wandev.lock,&smp_flags);
4121 err = config_tty(card);
4122 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
4123 if (card->u.c.async_mode){
4124 printk(KERN_INFO "%s: TTY Async Configuration:\n"
4125 " Baud =%i\n"
4126 " Handshaking =%s\n"
4127 " Tx Dbits =%i\n"
4128 " Rx Dbits =%i\n"
4129 " Parity =%s\n"
4130 " Stop Bits =%i\n",
4131 card->devname,
4132 card->wandev.bps,
4133 opt_decode[card->u.c.protocol_options],
4134 card->u.c.tx_bits_per_char,
4135 card->u.c.rx_bits_per_char,
4136 p_decode[card->u.c.parity] ,
4137 card->u.c.stop_bits);
4138 }else{
4139 printk(KERN_INFO "%s: TTY Sync Configuration:\n"
4140 " Baud =%i\n"
4141 " Protocol =HDLC_STREAMING\n",
4142 card->devname,card->wandev.bps);
4143 }
4144 if (!err){
4145 port_set_state(card,WAN_CONNECTED);
4146 }else{
4147 port_set_state(card,WAN_DISCONNECTED);
4148 }
4149 }
4150 return;
4151}
4152
4153static void wanpipe_tty_put_char(struct tty_struct *tty, unsigned char ch)
4154{
4155 sdla_t *card;
4156 unsigned long smp_flags=0;
4157
4158 if (!tty){
4159 return;
4160 }
4161
4162 card = (sdla_t *)tty->driver_data;
4163
4164 if (!card)
4165 return;
4166
4167 if (card->wandev.state != WAN_CONNECTED)
4168 return;
4169
4170 if(card->hw.type != SDLA_S514)
4171 s508_lock(card,&smp_flags);
4172
4173 if (test_and_set_bit(SEND_CRIT,(void*)&card->wandev.critical)){
4174
4175 wanpipe_tty_trigger_tx_irq(card);
4176
4177 if(card->hw.type != SDLA_S514)
4178 s508_unlock(card,&smp_flags);
4179 return;
4180 }
4181
4182 if (chdlc_send(card,(void*)&ch,1)){
4183 wanpipe_tty_trigger_tx_irq(card);
4184 dbg_printk("%s: Failed to TX char!\n",card->devname);
4185 }
4186
4187 dbg_printk("%s: Char TX OK\n",card->devname);
4188
4189 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
4190
4191 if(card->hw.type != SDLA_S514)
4192 s508_unlock(card,&smp_flags);
4193
4194 return;
4195}
4196
4197static void wanpipe_tty_flush_chars(struct tty_struct *tty)
4198{
4199 return;
4200}
4201
4202static void wanpipe_tty_flush_buffer(struct tty_struct *tty)
4203{
4204 if (!tty)
4205 return;
4206
4207#if defined(SERIAL_HAVE_POLL_WAIT)
4208 wake_up_interruptible(&tty->poll_wait);
4209#endif
4210 tty_wakeup(tty);
4211 return;
4212}
4213
4214/*
4215 * This function is used to send a high-priority XON/XOFF character to
4216 * the device
4217 */
4218static void wanpipe_tty_send_xchar(struct tty_struct *tty, char ch)
4219{
4220 return;
4221}
4222
4223
4224static int wanpipe_tty_chars_in_buffer(struct tty_struct *tty)
4225{
4226 return 0;
4227}
4228
4229
4230static int wanpipe_tty_write_room(struct tty_struct *tty)
4231{
4232 sdla_t *card;
4233
4234 printk(KERN_INFO "TTY Write Room\n");
4235
4236 if (!tty){
4237 return 0;
4238 }
4239
4240 card = (sdla_t *)tty->driver_data;
4241 if (!card)
4242 return 0;
4243
4244 if (card->wandev.state != WAN_CONNECTED)
4245 return 0;
4246
4247 return SEC_MAX_NO_DATA_BYTES_IN_FRAME;
4248}
4249
4250
4251static int set_modem_status(sdla_t *card, unsigned char data)
4252{
4253 CHDLC_MAILBOX_STRUCT *mb = card->mbox;
4254 int err;
4255
4256 mb->buffer_length=1;
4257 mb->command=SET_MODEM_STATUS;
4258 mb->data[0]=data;
4259 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
4260 if (err != COMMAND_OK)
4261 chdlc_error (card, err, mb);
4262
4263 return err;
4264}
4265
4266static void wanpipe_tty_hangup(struct tty_struct *tty)
4267{
4268 sdla_t *card;
4269 unsigned long smp_flags;
4270
4271 printk(KERN_INFO "TTY Hangup!\n");
4272
4273 if (!tty){
4274 return;
4275 }
4276
4277 card = (sdla_t *)tty->driver_data;
4278 if (!card)
4279 return;
4280
4281 lock_adapter_irq(&card->wandev.lock,&smp_flags);
4282 set_modem_status(card,0);
4283 unlock_adapter_irq(&card->wandev.lock,&smp_flags);
4284 return;
4285}
4286
4287static void wanpipe_tty_break(struct tty_struct *tty, int break_state)
4288{
4289 return;
4290}
4291
4292static void wanpipe_tty_wait_until_sent(struct tty_struct *tty, int timeout)
4293{
4294 return;
4295}
4296
4297static void wanpipe_tty_throttle(struct tty_struct * tty)
4298{
4299 return;
4300}
4301
4302static void wanpipe_tty_unthrottle(struct tty_struct * tty)
4303{
4304 return;
4305}
4306
4307int wanpipe_tty_read_proc(char *page, char **start, off_t off, int count,
4308 int *eof, void *data)
4309{
4310 return 0;
4311}
4312
4313/*
4314 * The serial driver boot-time initialization code!
4315 */
4316int wanpipe_tty_init(sdla_t *card)
4317{
4318 struct serial_state * state;
4319
4320 /* Initialize the tty_driver structure */
4321
4322 if (card->tty_minor < 0 || card->tty_minor > NR_PORTS){
4323 printk(KERN_INFO "%s: Illegal Minor TTY number (0-4): %i\n",
4324 card->devname,card->tty_minor);
4325 return -EINVAL;
4326 }
4327
4328 if (WAN_CARD(card->tty_minor)){
4329 printk(KERN_INFO "%s: TTY Minor %i, already in use\n",
4330 card->devname,card->tty_minor);
4331 return -EBUSY;
4332 }
4333
4334 if (tty_init_cnt==0){
4335
4336 printk(KERN_INFO "%s: TTY %s Driver Init: Major %i, Minor Range %i-%i\n",
4337 card->devname,
4338 card->u.c.async_mode ? "ASYNC" : "SYNC",
4339 WAN_TTY_MAJOR,MIN_PORT,MAX_PORT);
4340
4341 tty_driver_mode = card->u.c.async_mode;
4342
4343 memset(&serial_driver, 0, sizeof(struct tty_driver));
4344 serial_driver.magic = TTY_DRIVER_MAGIC;
4345 serial_driver.owner = THIS_MODULE;
4346 serial_driver.driver_name = "wanpipe_tty";
4347 serial_driver.name = "ttyW";
4348 serial_driver.major = WAN_TTY_MAJOR;
4349 serial_driver.minor_start = WAN_TTY_MINOR;
4350 serial_driver.num = NR_PORTS;
4351 serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
4352 serial_driver.subtype = SERIAL_TYPE_NORMAL;
4353
4354 serial_driver.init_termios = tty_std_termios;
4355 serial_driver.init_termios.c_cflag =
4356 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
4357 serial_driver.flags = TTY_DRIVER_REAL_RAW;
4358
4359 serial_driver.refcount = 1; /* !@!@^#^&!! */
4360
4361 serial_driver.open = wanpipe_tty_open;
4362 serial_driver.close = wanpipe_tty_close;
4363 serial_driver.write = wanpipe_tty_write;
4364
4365 serial_driver.put_char = wanpipe_tty_put_char;
4366 serial_driver.flush_chars = wanpipe_tty_flush_chars;
4367 serial_driver.write_room = wanpipe_tty_write_room;
4368 serial_driver.chars_in_buffer = wanpipe_tty_chars_in_buffer;
4369 serial_driver.flush_buffer = wanpipe_tty_flush_buffer;
4370 //serial_driver.ioctl = wanpipe_tty_ioctl;
4371 serial_driver.throttle = wanpipe_tty_throttle;
4372 serial_driver.unthrottle = wanpipe_tty_unthrottle;
4373 serial_driver.send_xchar = wanpipe_tty_send_xchar;
4374 serial_driver.set_termios = wanpipe_tty_set_termios;
4375 serial_driver.stop = wanpipe_tty_stop;
4376 serial_driver.start = wanpipe_tty_start;
4377 serial_driver.hangup = wanpipe_tty_hangup;
4378 serial_driver.break_ctl = wanpipe_tty_break;
4379 serial_driver.wait_until_sent = wanpipe_tty_wait_until_sent;
4380 serial_driver.read_proc = wanpipe_tty_read_proc;
4381
4382 if (tty_register_driver(&serial_driver)){
4383 printk(KERN_INFO "%s: Failed to register serial driver!\n",
4384 card->devname);
4385 }
4386 }
4387
4388
4389 /* The subsequent ports must comply to the initial configuration */
4390 if (tty_driver_mode != card->u.c.async_mode){
4391 printk(KERN_INFO "%s: Error: TTY Driver operation mode mismatch!\n",
4392 card->devname);
4393 printk(KERN_INFO "%s: The TTY driver is configured for %s!\n",
4394 card->devname, tty_driver_mode ? "ASYNC" : "SYNC");
4395 return -EINVAL;
4396 }
4397
4398 tty_init_cnt++;
4399
4400 printk(KERN_INFO "%s: Initializing TTY %s Driver Minor %i\n",
4401 card->devname,
4402 tty_driver_mode ? "ASYNC" : "SYNC",
4403 card->tty_minor);
4404
4405 tty_card_map[card->tty_minor] = card;
4406 state = &rs_table[card->tty_minor];
4407
4408 state->magic = SSTATE_MAGIC;
4409 state->line = 0;
4410 state->type = PORT_UNKNOWN;
4411 state->custom_divisor = 0;
4412 state->close_delay = 5*HZ/10;
4413 state->closing_wait = 30*HZ;
4414 state->icount.cts = state->icount.dsr =
4415 state->icount.rng = state->icount.dcd = 0;
4416 state->icount.rx = state->icount.tx = 0;
4417 state->icount.frame = state->icount.parity = 0;
4418 state->icount.overrun = state->icount.brk = 0;
4419 state->irq = card->wandev.irq;
4420
4421 INIT_WORK(&card->tty_work, tty_poll_work, (void*)card);
4422 return 0;
4423}
4424
4425
4426MODULE_LICENSE("GPL");
4427
4428/****** End ****************************************************************/
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c
deleted file mode 100644
index 7f1ce9d4333e..000000000000
--- a/drivers/net/wan/sdla_fr.c
+++ /dev/null
@@ -1,5061 +0,0 @@
1/*****************************************************************************
2* sdla_fr.c WANPIPE(tm) Multiprotocol WAN Link Driver. Frame relay module.
3*
4* Author(s): Nenad Corbic <ncorbic@sangoma.com>
5* Gideon Hack
6*
7* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Nov 23, 2000 Nenad Corbic o Added support for 2.4.X kernels
15* Nov 15, 2000 David Rokavarg
16* Nenad Corbic o Added frame relay bridging support.
17* Original code from Mark Wells and Kristian Hoffmann has
18* been integrated into the frame relay driver.
19* Nov 13, 2000 Nenad Corbic o Added true interface type encoding option.
20* Tcpdump doesn't support Frame Relay inteface
21* types, to fix this true type option will set
22* the interface type to RAW IP mode.
23* Nov 07, 2000 Nenad Corbic o Added security features for UDP debugging:
24* Deny all and specify allowed requests.
25* Nov 06, 2000 Nenad Corbic o Wanpipe interfaces conform to raw packet interfaces.
26* Moved the if_header into the if_send() routine.
27* The if_header() was breaking the libpcap
28* support. i.e. support for tcpdump, ethereal ...
29* Oct 12. 2000 Nenad Corbic o Added error message in fr_configure
30* Jul 31, 2000 Nenad Corbic o Fixed the Router UP Time.
31* Apr 28, 2000 Nenad Corbic o Added the option to shutdown an interface
32* when the channel gets disconnected.
33* Apr 28, 2000 Nenad Corbic o Added M.Grants patch: disallow duplicate
34* interface setups.
35* Apr 25, 2000 Nenad Corbic o Added M.Grants patch: dynamically add/remove
36* new dlcis/interfaces.
37* Mar 23, 2000 Nenad Corbic o Improved task queue, bh handling.
38* Mar 16, 2000 Nenad Corbic o Added Inverse ARP support
39* Mar 13, 2000 Nenad Corbic o Added new socket API support.
40* Mar 06, 2000 Nenad Corbic o Bug Fix: corrupted mbox recovery.
41* Feb 24, 2000 Nenad Corbic o Fixed up FT1 UDP debugging problem.
42* Dev 15, 1999 Nenad Corbic o Fixed up header files for 2.0.X kernels
43*
44* Nov 08, 1999 Nenad Corbic o Combined all debug UDP calls into one function
45* o Removed the ARP support. This has to be done
46* in the next version.
47* o Only a Node can implement NO signalling.
48* Initialize DLCI during if_open() if NO
49* signalling.
50* o Took out IPX support, implement in next
51* version
52* Sep 29, 1999 Nenad Corbic o Added SMP support and changed the update
53* function to use timer interrupt.
54* o Fixed the CIR bug: Set the value of BC
55* to CIR when the CIR is enabled.
56* o Updated comments, statistics and tracing.
57* Jun 02, 1999 Gideon Hack o Updated for S514 support.
58* Sep 18, 1998 Jaspreet Singh o Updated for 2.2.X kernels.
59* Jul 31, 1998 Jaspreet Singh o Removed wpf_poll routine. The channel/DLCI
60* status is received through an event interrupt.
61* Jul 08, 1998 David Fong o Added inverse ARP support.
62* Mar 26, 1997 Jaspreet Singh o Returning return codes for failed UDP cmds.
63* Jan 28, 1997 Jaspreet Singh o Improved handling of inactive DLCIs.
64* Dec 30, 1997 Jaspreet Singh o Replaced dev_tint() with mark_bh(NET_BH)
65* Dec 16, 1997 Jaspreet Singh o Implemented Multiple IPX support.
66* Nov 26, 1997 Jaspreet Singh o Improved load sharing with multiple boards
67* o Added Cli() to protect enabling of interrupts
68* while polling is called.
69* Nov 24, 1997 Jaspreet Singh o Added counters to avoid enabling of interrupts
70* when they have been disabled by another
71* interface or routine (eg. wpf_poll).
72* Nov 06, 1997 Jaspreet Singh o Added INTR_TEST_MODE to avoid polling
73* routine disable interrupts during interrupt
74* testing.
75* Oct 20, 1997 Jaspreet Singh o Added hooks in for Router UP time.
76* Oct 16, 1997 Jaspreet Singh o The critical flag is used to maintain flow
77* control by avoiding RACE conditions. The
78* cli() and restore_flags() are taken out.
79* The fr_channel structure is appended for
80* Driver Statistics.
81* Oct 15, 1997 Farhan Thawar o updated if_send() and receive for IPX
82* Aug 29, 1997 Farhan Thawar o Removed most of the cli() and sti()
83* o Abstracted the UDP management stuff
84* o Now use tbusy and critical more intelligently
85* Jul 21, 1997 Jaspreet Singh o Can configure T391, T392, N391, N392 & N393
86* through router.conf.
87* o Protected calls to sdla_peek() by adDing
88* save_flags(), cli() and restore_flags().
89* o Added error message for Inactive DLCIs in
90* fr_event() and update_chan_state().
91* o Fixed freeing up of buffers using kfree()
92* when packets are received.
93* Jul 07, 1997 Jaspreet Singh o Added configurable TTL for UDP packets
94* o Added ability to discard multicast and
95* broadcast source addressed packets
96* Jun 27, 1997 Jaspreet Singh o Added FT1 monitor capabilities
97* New case (0x44) statement in if_send routine
98* Added a global variable rCount to keep track
99* of FT1 status enabled on the board.
100* May 29, 1997 Jaspreet Singh o Fixed major Flow Control Problem
101* With multiple boards a problem was seen where
102* the second board always stopped transmitting
103* packet after running for a while. The code
104* got into a stage where the interrupts were
105* disabled and dev->tbusy was set to 1.
106* This caused the If_send() routine to get into
107* the if clause for it(0,dev->tbusy)
108* forever.
109* The code got into this stage due to an
110* interrupt occurring within the if clause for
111* set_bit(0,dev->tbusy). Since an interrupt
112* disables furhter transmit interrupt and
113* makes dev->tbusy = 0, this effect was undone
114* by making dev->tbusy = 1 in the if clause.
115* The Fix checks to see if Transmit interrupts
116* are disabled then do not make dev->tbusy = 1
117* Introduced a global variable: int_occur and
118* added tx_int_enabled in the wan_device
119* structure.
120* May 21, 1997 Jaspreet Singh o Fixed UDP Management for multiple
121* boards.
122*
123* Apr 25, 1997 Farhan Thawar o added UDP Management stuff
124* o fixed bug in if_send() and tx_intr() to
125* sleep and wakeup all devices
126* Mar 11, 1997 Farhan Thawar Version 3.1.1
127* o fixed (+1) bug in fr508_rx_intr()
128* o changed if_send() to return 0 if
129* wandev.critical() is true
130* o free socket buffer in if_send() if
131* returning 0
132* o added tx_intr() routine
133* Jan 30, 1997 Gene Kozin Version 3.1.0
134* o implemented exec() entry point
135* o fixed a bug causing driver configured as
136* a FR switch to be stuck in WAN_
137* mode
138* Jan 02, 1997 Gene Kozin Initial version.
139*****************************************************************************/
140
141#include <linux/module.h>
142#include <linux/kernel.h> /* printk(), and other useful stuff */
143#include <linux/stddef.h> /* offsetof(), etc. */
144#include <linux/errno.h> /* return codes */
145#include <linux/string.h> /* inline memset(), etc. */
146#include <linux/slab.h> /* kmalloc(), kfree() */
147#include <linux/wanrouter.h> /* WAN router definitions */
148#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
149#include <linux/workqueue.h>
150#include <linux/if_arp.h> /* ARPHRD_* defines */
151#include <asm/byteorder.h> /* htons(), etc. */
152#include <asm/io.h> /* for inb(), outb(), etc. */
153#include <linux/time.h> /* for do_gettimeofday */
154#include <linux/in.h> /* sockaddr_in */
155#include <linux/jiffies.h> /* time_after() macro */
156#include <asm/errno.h>
157
158#include <linux/ip.h>
159#include <linux/if.h>
160
161#include <linux/if_wanpipe_common.h> /* Wanpipe Socket */
162#include <linux/if_wanpipe.h>
163
164#include <linux/sdla_fr.h> /* frame relay firmware API definitions */
165
166#include <asm/uaccess.h>
167#include <linux/inetdevice.h>
168#include <linux/netdevice.h>
169
170#include <net/route.h> /* Dynamic Route Creation */
171#include <linux/etherdevice.h> /* eth_type_trans() used for bridging */
172#include <linux/random.h>
173
174/****** Defines & Macros ****************************************************/
175
176#define MAX_CMD_RETRY 10 /* max number of firmware retries */
177
178#define FR_HEADER_LEN 8 /* max encapsulation header size */
179#define FR_CHANNEL_MTU 1500 /* unfragmented logical channel MTU */
180
181/* Q.922 frame types */
182#define Q922_UI 0x03 /* Unnumbered Info frame */
183#define Q922_XID 0xAF
184
185/* DLCI configured or not */
186#define DLCI_NOT_CONFIGURED 0x00
187#define DLCI_CONFIG_PENDING 0x01
188#define DLCI_CONFIGURED 0x02
189
190/* CIR enabled or not */
191#define CIR_ENABLED 0x00
192#define CIR_DISABLED 0x01
193
194#define FRAME_RELAY_API 1
195#define MAX_BH_BUFF 10
196
197/* For handle_IPXWAN() */
198#define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b)))
199
200/****** Data Structures *****************************************************/
201
202/* This is an extention of the 'struct device' we create for each network
203 * interface to keep the rest of channel-specific data.
204 */
205typedef struct fr_channel
206{
207 wanpipe_common_t common;
208 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
209 unsigned dlci_configured ; /* check whether configured or not */
210 unsigned cir_status; /* check whether CIR enabled or not */
211 unsigned dlci; /* logical channel number */
212 unsigned cir; /* committed information rate */
213 unsigned bc; /* committed burst size */
214 unsigned be; /* excess burst size */
215 unsigned mc; /* multicast support on or off */
216 unsigned tx_int_status; /* Transmit Interrupt Status */
217 unsigned short pkt_length; /* Packet Length */
218 unsigned long router_start_time;/* Router start time in seconds */
219 unsigned long tick_counter; /* counter for transmit time out */
220 char dev_pending_devtint; /* interface pending dev_tint() */
221 void *dlci_int_interface; /* pointer to the DLCI Interface */
222 unsigned long IB_addr; /* physical address of Interface Byte */
223 unsigned long state_tick; /* time of the last state change */
224 unsigned char enable_IPX; /* Enable/Disable the use of IPX */
225 unsigned long network_number; /* Internal Network Number for IPX*/
226 sdla_t *card; /* -> owner */
227 unsigned route_flag; /* Add/Rem dest addr in route tables */
228 unsigned inarp; /* Inverse Arp Request status */
229 long inarp_ready; /* Ready to send requests */
230 int inarp_interval; /* Time between InArp Requests */
231 unsigned long inarp_tick; /* InArp jiffies tick counter */
232 long interface_down; /* Bring interface down on disconnect */
233 struct net_device_stats ifstats; /* interface statistics */
234 if_send_stat_t drvstats_if_send;
235 rx_intr_stat_t drvstats_rx_intr;
236 pipe_mgmt_stat_t drvstats_gen;
237 unsigned long router_up_time;
238
239 unsigned short transmit_length;
240 struct sk_buff *delay_skb;
241
242 bh_data_t *bh_head; /* Circular buffer for chdlc_bh */
243 unsigned long tq_working;
244 volatile int bh_write;
245 volatile int bh_read;
246 atomic_t bh_buff_used;
247
248 /* Polling task queue. Each interface
249 * has its own task queue, which is used
250 * to defer events from the interrupt */
251 struct work_struct fr_poll_work;
252 struct timer_list fr_arp_timer;
253
254 u32 ip_local;
255 u32 ip_remote;
256 long config_dlci;
257 long unconfig_dlci;
258
259 /* Whether this interface should be setup as a gateway.
260 * Used by dynamic route setup code */
261 u8 gateway;
262
263 /* True interface type */
264 u8 true_if_encoding;
265 u8 fr_header[FR_HEADER_LEN];
266 char fr_header_len;
267
268} fr_channel_t;
269
270/* Route Flag options */
271#define NO_ROUTE 0x00
272#define ADD_ROUTE 0x01
273#define ROUTE_ADDED 0x02
274#define REMOVE_ROUTE 0x03
275#define ARP_REQ 0x04
276
277/* inarp options */
278#define INARP_NONE 0x00
279#define INARP_REQUEST 0x01
280#define INARP_CONFIGURED 0x02
281
282/* reasons for enabling the timer interrupt on the adapter */
283#define TMR_INT_ENABLED_UDP 0x01
284#define TMR_INT_ENABLED_UPDATE 0x02
285#define TMR_INT_ENABLED_ARP 0x04
286#define TMR_INT_ENABLED_UPDATE_STATE 0x08
287#define TMR_INT_ENABLED_CONFIG 0x10
288#define TMR_INT_ENABLED_UNCONFIG 0x20
289
290
291typedef struct dlci_status
292{
293 unsigned short dlci PACKED;
294 unsigned char state PACKED;
295} dlci_status_t;
296
297typedef struct dlci_IB_mapping
298{
299 unsigned short dlci PACKED;
300 unsigned long addr_value PACKED;
301} dlci_IB_mapping_t;
302
303/* This structure is used for DLCI list Tx interrupt mode. It is used to
304 enable interrupt bit and set the packet length for transmission
305 */
306typedef struct fr_dlci_interface
307{
308 unsigned char gen_interrupt PACKED;
309 unsigned short packet_length PACKED;
310 unsigned char reserved PACKED;
311} fr_dlci_interface_t;
312
313/* variable for keeping track of enabling/disabling FT1 monitor status */
314static int rCount = 0;
315
316extern void disable_irq(unsigned int);
317extern void enable_irq(unsigned int);
318
319/* variable for keeping track of number of interrupts generated during
320 * interrupt test routine
321 */
322static int Intr_test_counter;
323
324/****** Function Prototypes *************************************************/
325
326/* WAN link driver entry points. These are called by the WAN router module. */
327static int update(struct wan_device *wandev);
328static int new_if(struct wan_device *wandev, struct net_device *dev,
329 wanif_conf_t *conf);
330static int del_if(struct wan_device *wandev, struct net_device *dev);
331static void disable_comm (sdla_t *card);
332
333/* WANPIPE-specific entry points */
334static int wpf_exec(struct sdla *card, void *u_cmd, void *u_data);
335
336/* Network device interface */
337static int if_init(struct net_device *dev);
338static int if_open(struct net_device *dev);
339static int if_close(struct net_device *dev);
340
341static void if_tx_timeout(struct net_device *dev);
342
343static int if_rebuild_hdr (struct sk_buff *skb);
344
345static int if_send(struct sk_buff *skb, struct net_device *dev);
346static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
347 struct sk_buff *skb);
348static struct net_device_stats *if_stats(struct net_device *dev);
349
350/* Interrupt handlers */
351static void fr_isr(sdla_t *card);
352static void rx_intr(sdla_t *card);
353static void tx_intr(sdla_t *card);
354static void timer_intr(sdla_t *card);
355static void spur_intr(sdla_t *card);
356
357/* Frame relay firmware interface functions */
358static int fr_read_version(sdla_t *card, char *str);
359static int fr_configure(sdla_t *card, fr_conf_t *conf);
360static int fr_dlci_configure(sdla_t *card, fr_dlc_conf_t *conf, unsigned dlci);
361static int fr_init_dlci (sdla_t *card, fr_channel_t *chan);
362static int fr_set_intr_mode (sdla_t *card, unsigned mode, unsigned mtu, unsigned short timeout);
363static int fr_comm_enable(sdla_t *card);
364static void fr_comm_disable(sdla_t *card);
365static int fr_get_err_stats(sdla_t *card);
366static int fr_get_stats(sdla_t *card);
367static int fr_add_dlci(sdla_t *card, int dlci);
368static int fr_activate_dlci(sdla_t *card, int dlci);
369static int fr_delete_dlci (sdla_t* card, int dlci);
370static int fr_issue_isf(sdla_t *card, int isf);
371static int fr_send(sdla_t *card, int dlci, unsigned char attr, int len,
372 void *buf);
373static int fr_send_data_header(sdla_t *card, int dlci, unsigned char attr, int len,
374 void *buf,unsigned char hdr_len);
375static unsigned int fr_send_hdr(sdla_t *card, int dlci, unsigned int offset);
376
377static int check_dlci_config (sdla_t *card, fr_channel_t *chan);
378static void initialize_rx_tx_buffers (sdla_t *card);
379
380
381/* Firmware asynchronous event handlers */
382static int fr_event(sdla_t *card, int event, fr_mbox_t *mbox);
383static int fr_modem_failure(sdla_t *card, fr_mbox_t *mbox);
384static int fr_dlci_change(sdla_t *card, fr_mbox_t *mbox);
385
386/* Miscellaneous functions */
387static int update_chan_state(struct net_device *dev);
388static void set_chan_state(struct net_device *dev, int state);
389static struct net_device *find_channel(sdla_t *card, unsigned dlci);
390static int is_tx_ready(sdla_t *card, fr_channel_t *chan);
391static unsigned int dec_to_uint(unsigned char *str, int len);
392static int reply_udp( unsigned char *data, unsigned int mbox_len );
393
394static int intr_test( sdla_t* card );
395static void init_chan_statistics( fr_channel_t* chan );
396static void init_global_statistics( sdla_t* card );
397static void read_DLCI_IB_mapping( sdla_t* card, fr_channel_t* chan );
398static int setup_for_delayed_transmit(struct net_device* dev,
399 struct sk_buff *skb);
400
401struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev);
402static int check_tx_status(sdla_t *card, struct net_device *dev);
403
404/* Frame Relay Socket API */
405static void trigger_fr_bh (fr_channel_t *);
406static void fr_bh(struct net_device *dev);
407static int fr_bh_cleanup(struct net_device *dev);
408static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
409
410static void trigger_fr_poll(struct net_device *dev);
411static void fr_poll(struct net_device *dev);
412//static void add_gateway(struct net_device *dev);
413
414static void trigger_unconfig_fr(struct net_device *dev);
415static void unconfig_fr (sdla_t *);
416
417static void trigger_config_fr (sdla_t *);
418static void config_fr (sdla_t *);
419
420
421/* Inverse ARP and Dynamic routing functions */
422int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device *dev);
423int is_arp(void *buf);
424int send_inarp_request(sdla_t *card, struct net_device *dev);
425
426static void trigger_fr_arp(struct net_device *dev);
427static void fr_arp (unsigned long data);
428
429
430/* Udp management functions */
431static int process_udp_mgmt_pkt(sdla_t *card);
432static int udp_pkt_type( struct sk_buff *skb, sdla_t *card );
433static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t* card,
434 struct sk_buff *skb, int dlci);
435
436/* IPX functions */
437static void switch_net_numbers(unsigned char *sendpacket,
438 unsigned long network_number, unsigned char incoming);
439
440static int handle_IPXWAN(unsigned char *sendpacket, char *devname,
441 unsigned char enable_IPX, unsigned long network_number);
442
443/* Lock Functions: SMP supported */
444void s508_s514_unlock(sdla_t *card, unsigned long *smp_flags);
445void s508_s514_lock(sdla_t *card, unsigned long *smp_flags);
446
447unsigned short calc_checksum (char *, int);
448static int setup_fr_header(struct sk_buff *skb,
449 struct net_device* dev, char op_mode);
450
451
452/****** Public Functions ****************************************************/
453
454/*============================================================================
455 * Frame relay protocol initialization routine.
456 *
457 * This routine is called by the main WANPIPE module during setup. At this
458 * point adapter is completely initialized and firmware is running.
459 * o read firmware version (to make sure it's alive)
460 * o configure adapter
461 * o initialize protocol-specific fields of the adapter data space.
462 *
463 * Return: 0 o.k.
464 * < 0 failure.
465 */
466int wpf_init(sdla_t *card, wandev_conf_t *conf)
467{
468
469 int err;
470 fr508_flags_t* flags;
471
472 union
473 {
474 char str[80];
475 fr_conf_t cfg;
476 } u;
477
478 fr_buf_info_t* buf_info;
479 int i;
480
481
482 printk(KERN_INFO "\n");
483
484 /* Verify configuration ID */
485 if (conf->config_id != WANCONFIG_FR) {
486
487 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
488 card->devname, conf->config_id);
489 return -EINVAL;
490
491 }
492
493 /* Initialize protocol-specific fields of adapter data space */
494 switch (card->hw.fwid) {
495
496 case SFID_FR508:
497 card->mbox = (void*)(card->hw.dpmbase +
498 FR508_MBOX_OFFS);
499 card->flags = (void*)(card->hw.dpmbase +
500 FR508_FLAG_OFFS);
501 if(card->hw.type == SDLA_S514) {
502 card->mbox += FR_MB_VECTOR;
503 card->flags += FR_MB_VECTOR;
504 }
505 card->isr = &fr_isr;
506 break;
507
508 default:
509 return -EINVAL;
510 }
511
512 flags = card->flags;
513
514 /* Read firmware version. Note that when adapter initializes, it
515 * clears the mailbox, so it may appear that the first command was
516 * executed successfully when in fact it was merely erased. To work
517 * around this, we execute the first command twice.
518 */
519
520 if (fr_read_version(card, NULL) || fr_read_version(card, u.str))
521 return -EIO;
522
523 printk(KERN_INFO "%s: running frame relay firmware v%s\n",
524 card->devname, u.str);
525
526 /* Adjust configuration */
527 conf->mtu += FR_HEADER_LEN;
528 conf->mtu = (conf->mtu >= MIN_LGTH_FR_DATA_CFG) ?
529 min_t(unsigned int, conf->mtu, FR_MAX_NO_DATA_BYTES_IN_FRAME) :
530 FR_CHANNEL_MTU + FR_HEADER_LEN;
531
532 conf->bps = min_t(unsigned int, conf->bps, 2048000);
533
534 /* Initialze the configuration structure sent to the board to zero */
535 memset(&u.cfg, 0, sizeof(u.cfg));
536
537 memset(card->u.f.dlci_to_dev_map, 0, sizeof(card->u.f.dlci_to_dev_map));
538
539 /* Configure adapter firmware */
540
541 u.cfg.mtu = conf->mtu;
542 u.cfg.kbps = conf->bps / 1000;
543
544 u.cfg.cir_fwd = u.cfg.cir_bwd = 16;
545 u.cfg.bc_fwd = u.cfg.bc_bwd = 16;
546
547 u.cfg.options = 0x0000;
548 printk(KERN_INFO "%s: Global CIR enabled by Default\n", card->devname);
549
550 switch (conf->u.fr.signalling) {
551
552 case WANOPT_FR_ANSI:
553 u.cfg.options = 0x0000;
554 break;
555
556 case WANOPT_FR_Q933:
557 u.cfg.options |= 0x0200;
558 break;
559
560 case WANOPT_FR_LMI:
561 u.cfg.options |= 0x0400;
562 break;
563
564 case WANOPT_NO:
565 u.cfg.options |= 0x0800;
566 break;
567 default:
568 printk(KERN_INFO "%s: Illegal Signalling option\n",
569 card->wandev.name);
570 return -EINVAL;
571 }
572
573
574 card->wandev.signalling = conf->u.fr.signalling;
575
576 if (conf->station == WANOPT_CPE) {
577
578
579 if (conf->u.fr.signalling == WANOPT_NO){
580 printk(KERN_INFO
581 "%s: ERROR - For NO signalling, station must be set to Node!",
582 card->devname);
583 return -EINVAL;
584 }
585
586 u.cfg.station = 0;
587 u.cfg.options |= 0x8000; /* auto config DLCI */
588 card->u.f.dlci_num = 0;
589
590 } else {
591
592 u.cfg.station = 1; /* switch emulation mode */
593
594 /* For switch emulation we have to create a list of dlci(s)
595 * that will be sent to be global SET_DLCI_CONFIGURATION
596 * command in fr_configure() routine.
597 */
598
599 card->u.f.dlci_num = min_t(unsigned int, max_t(unsigned int, conf->u.fr.dlci_num, 1), 100);
600
601 for ( i = 0; i < card->u.f.dlci_num; i++) {
602
603 card->u.f.node_dlci[i] = (unsigned short)
604 conf->u.fr.dlci[i] ? conf->u.fr.dlci[i] : 16;
605
606 }
607 }
608
609 if (conf->clocking == WANOPT_INTERNAL)
610 u.cfg.port |= 0x0001;
611
612 if (conf->interface == WANOPT_RS232)
613 u.cfg.port |= 0x0002;
614
615 if (conf->u.fr.t391)
616 u.cfg.t391 = min_t(unsigned int, conf->u.fr.t391, 30);
617 else
618 u.cfg.t391 = 5;
619
620 if (conf->u.fr.t392)
621 u.cfg.t392 = min_t(unsigned int, conf->u.fr.t392, 30);
622 else
623 u.cfg.t392 = 15;
624
625 if (conf->u.fr.n391)
626 u.cfg.n391 = min_t(unsigned int, conf->u.fr.n391, 255);
627 else
628 u.cfg.n391 = 2;
629
630 if (conf->u.fr.n392)
631 u.cfg.n392 = min_t(unsigned int, conf->u.fr.n392, 10);
632 else
633 u.cfg.n392 = 3;
634
635 if (conf->u.fr.n393)
636 u.cfg.n393 = min_t(unsigned int, conf->u.fr.n393, 10);
637 else
638 u.cfg.n393 = 4;
639
640 if (fr_configure(card, &u.cfg))
641 return -EIO;
642
643 if (card->hw.type == SDLA_S514) {
644
645 buf_info = (void*)(card->hw.dpmbase + FR_MB_VECTOR +
646 FR508_RXBC_OFFS);
647
648 card->rxmb = (void*)(buf_info->rse_next + card->hw.dpmbase);
649
650 card->u.f.rxmb_base =
651 (void*)(buf_info->rse_base + card->hw.dpmbase);
652
653 card->u.f.rxmb_last =
654 (void*)(buf_info->rse_base +
655 (buf_info->rse_num - 1) * sizeof(fr_rx_buf_ctl_t) +
656 card->hw.dpmbase);
657 }else{
658 buf_info = (void*)(card->hw.dpmbase + FR508_RXBC_OFFS);
659
660 card->rxmb = (void*)(buf_info->rse_next -
661 FR_MB_VECTOR + card->hw.dpmbase);
662
663 card->u.f.rxmb_base =
664 (void*)(buf_info->rse_base -
665 FR_MB_VECTOR + card->hw.dpmbase);
666
667 card->u.f.rxmb_last =
668 (void*)(buf_info->rse_base +
669 (buf_info->rse_num - 1) * sizeof(fr_rx_buf_ctl_t) -
670 FR_MB_VECTOR + card->hw.dpmbase);
671 }
672
673 card->u.f.rx_base = buf_info->buf_base;
674 card->u.f.rx_top = buf_info->buf_top;
675
676 card->u.f.tx_interrupts_pending = 0;
677
678 card->wandev.mtu = conf->mtu;
679 card->wandev.bps = conf->bps;
680 card->wandev.interface = conf->interface;
681 card->wandev.clocking = conf->clocking;
682 card->wandev.station = conf->station;
683 card->poll = NULL;
684 card->exec = &wpf_exec;
685 card->wandev.update = &update;
686 card->wandev.new_if = &new_if;
687 card->wandev.del_if = &del_if;
688 card->wandev.state = WAN_DISCONNECTED;
689 card->wandev.ttl = conf->ttl;
690 card->wandev.udp_port = conf->udp_port;
691 card->disable_comm = &disable_comm;
692 card->u.f.arp_dev = NULL;
693
694 /* Intialize global statistics for a card */
695 init_global_statistics( card );
696
697 card->TracingEnabled = 0;
698
699 /* Interrupt Test */
700 Intr_test_counter = 0;
701 card->intr_mode = INTR_TEST_MODE;
702 err = intr_test( card );
703
704 printk(KERN_INFO "%s: End of Interrupt Test rc=0x%x count=%i\n",
705 card->devname,err,Intr_test_counter);
706
707 if (err || (Intr_test_counter < MAX_INTR_TEST_COUNTER)) {
708 printk(KERN_ERR "%s: Interrupt Test Failed, Counter: %i\n",
709 card->devname, Intr_test_counter);
710 printk(KERN_ERR "Please choose another interrupt\n");
711 err = -EIO;
712 return err;
713 }
714
715 printk(KERN_INFO "%s: Interrupt Test Passed, Counter: %i\n",
716 card->devname, Intr_test_counter);
717
718
719 /* Apr 28 2000. Nenad Corbic
720 * Enable commnunications here, not in if_open or new_if, since
721 * interfaces come down when the link is disconnected.
722 */
723
724 /* If you enable comms and then set ints, you get a Tx int as you
725 * perform the SET_INT_TRIGGERS command. So, we only set int
726 * triggers and then adjust the interrupt mask (to disable Tx ints)
727 * before enabling comms.
728 */
729 if (fr_set_intr_mode(card, (FR_INTR_RXRDY | FR_INTR_TXRDY |
730 FR_INTR_DLC | FR_INTR_TIMER | FR_INTR_TX_MULT_DLCIs) ,
731 card->wandev.mtu, 0)) {
732 return -EIO;
733 }
734
735 flags->imask &= ~(FR_INTR_TXRDY | FR_INTR_TIMER);
736
737 if (fr_comm_enable(card)) {
738 return -EIO;
739 }
740 wanpipe_set_state(card, WAN_CONNECTED);
741 spin_lock_init(&card->u.f.if_send_lock);
742
743 printk(KERN_INFO "\n");
744
745 return 0;
746}
747
748/******* WAN Device Driver Entry Points *************************************/
749
750/*============================================================================
751 * Update device status & statistics.
752 */
753static int update(struct wan_device* wandev)
754{
755 volatile sdla_t* card;
756 unsigned long timeout;
757 fr508_flags_t* flags;
758
759 /* sanity checks */
760 if ((wandev == NULL) || (wandev->private == NULL))
761 return -EFAULT;
762
763 if (wandev->state == WAN_UNCONFIGURED)
764 return -ENODEV;
765
766 card = wandev->private;
767 flags = card->flags;
768
769
770 card->u.f.update_comms_stats = 1;
771 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_UPDATE;
772 flags->imask |= FR_INTR_TIMER;
773 timeout = jiffies;
774 for(;;) {
775 if(card->u.f.update_comms_stats == 0)
776 break;
777 if (time_after(jiffies, timeout + 1 * HZ)){
778 card->u.f.update_comms_stats = 0;
779 return -EAGAIN;
780 }
781 }
782
783 return 0;
784}
785
786/*============================================================================
787 * Create new logical channel.
788 * This routine is called by the router when ROUTER_IFNEW IOCTL is being
789 * handled.
790 * o parse media- and hardware-specific configuration
791 * o make sure that a new channel can be created
792 * o allocate resources, if necessary
793 * o prepare network device structure for registaration.
794 *
795 * Return: 0 o.k.
796 * < 0 failure (channel will not be created)
797 */
798static int new_if(struct wan_device* wandev, struct net_device* dev,
799 wanif_conf_t* conf)
800{
801 sdla_t* card = wandev->private;
802 fr_channel_t* chan;
803 int dlci = 0;
804 int err = 0;
805
806
807 if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)) {
808
809 printk(KERN_INFO "%s: Invalid interface name!\n",
810 card->devname);
811 return -EINVAL;
812 }
813
814 /* allocate and initialize private data */
815 chan = kmalloc(sizeof(fr_channel_t), GFP_KERNEL);
816
817 if (chan == NULL)
818 return -ENOMEM;
819
820 memset(chan, 0, sizeof(fr_channel_t));
821 strcpy(chan->name, conf->name);
822 chan->card = card;
823
824 /* verify media address */
825 if (isdigit(conf->addr[0])) {
826
827 dlci = dec_to_uint(conf->addr, 0);
828
829 if (dlci && (dlci <= HIGHEST_VALID_DLCI)) {
830
831 chan->dlci = dlci;
832
833 } else {
834
835 printk(KERN_ERR
836 "%s: Invalid DLCI %u on interface %s!\n",
837 wandev->name, dlci, chan->name);
838 err = -EINVAL;
839 }
840
841 } else {
842 printk(KERN_ERR
843 "%s: Invalid media address on interface %s!\n",
844 wandev->name, chan->name);
845 err = -EINVAL;
846 }
847
848 if ((chan->true_if_encoding = conf->true_if_encoding) == WANOPT_YES){
849 printk(KERN_INFO
850 "%s: Enabling, true interface type encoding.\n",
851 card->devname);
852 }
853
854
855
856 /* Setup wanpipe as a router (WANPIPE) even if it is
857 * a bridged DLCI, or as an API
858 */
859 if (strcmp(conf->usedby, "WANPIPE") == 0 ||
860 strcmp(conf->usedby, "BRIDGE") == 0 ||
861 strcmp(conf->usedby, "BRIDGE_N") == 0){
862
863 if(strcmp(conf->usedby, "WANPIPE") == 0){
864 chan->common.usedby = WANPIPE;
865
866 printk(KERN_INFO "%s: Running in WANPIPE mode.\n",
867 card->devname);
868
869 }else if(strcmp(conf->usedby, "BRIDGE") == 0){
870
871 chan->common.usedby = BRIDGE;
872
873 printk(KERN_INFO "%s: Running in WANPIPE (BRIDGE) mode.\n",
874 card->devname);
875 }else if( strcmp(conf->usedby, "BRIDGE_N") == 0 ){
876
877 chan->common.usedby = BRIDGE_NODE;
878
879 printk(KERN_INFO "%s: Running in WANPIPE (BRIDGE_NODE) mode.\n",
880 card->devname);
881 }
882
883 if (!err){
884 /* Dynamic interface configuration option.
885 * On disconnect, if the options is selected,
886 * the interface will be brought down */
887 if (conf->if_down == WANOPT_YES){
888 set_bit(DYN_OPT_ON,&chan->interface_down);
889 printk(KERN_INFO
890 "%s: Dynamic interface configuration enabled.\n",
891 card->devname);
892 }
893 }
894
895 } else if(strcmp(conf->usedby, "API") == 0){
896
897 chan->common.usedby = API;
898 printk(KERN_INFO "%s: Running in API mode.\n",
899 wandev->name);
900 }
901
902 if (err) {
903
904 kfree(chan);
905 return err;
906 }
907
908 /* place cir,be,bc and other channel specific information into the
909 * chan structure
910 */
911 if (conf->cir) {
912
913 chan->cir = max_t(unsigned int, 1,
914 min_t(unsigned int, conf->cir, 512));
915 chan->cir_status = CIR_ENABLED;
916
917
918 /* If CIR is enabled, force BC to equal CIR
919 * this solves number of potential problems if CIR is
920 * set and BC is not
921 */
922 chan->bc = chan->cir;
923
924 if (conf->be){
925 chan->be = max_t(unsigned int,
926 0, min_t(unsigned int, conf->be, 511));
927 }else{
928 conf->be = 0;
929 }
930
931 printk (KERN_INFO "%s: CIR enabled for DLCI %i \n",
932 wandev->name,chan->dlci);
933 printk (KERN_INFO "%s: CIR = %i ; BC = %i ; BE = %i\n",
934 wandev->name,chan->cir,chan->bc,chan->be);
935
936
937 }else{
938 chan->cir_status = CIR_DISABLED;
939 printk (KERN_INFO "%s: CIR disabled for DLCI %i\n",
940 wandev->name,chan->dlci);
941 }
942
943 chan->mc = conf->mc;
944
945 if (conf->inarp == WANOPT_YES){
946 printk(KERN_INFO "%s: Inverse ARP Support Enabled\n",card->devname);
947 chan->inarp = conf->inarp ? INARP_REQUEST : INARP_NONE;
948 chan->inarp_interval = conf->inarp_interval ? conf->inarp_interval : 10;
949 }else{
950 printk(KERN_INFO "%s: Inverse ARP Support Disabled\n",card->devname);
951 chan->inarp = INARP_NONE;
952 chan->inarp_interval = 10;
953 }
954
955
956 chan->dlci_configured = DLCI_NOT_CONFIGURED;
957
958
959 /*FIXME: IPX disabled in this WANPIPE version */
960 if (conf->enable_IPX == WANOPT_YES){
961 printk(KERN_INFO "%s: ERROR - This version of WANPIPE doesn't support IPX\n",
962 card->devname);
963 kfree(chan);
964 return -EINVAL;
965 }else{
966 chan->enable_IPX = WANOPT_NO;
967 }
968
969 if (conf->network_number){
970 chan->network_number = conf->network_number;
971 }else{
972 chan->network_number = 0xDEADBEEF;
973 }
974
975 chan->route_flag = NO_ROUTE;
976
977 init_chan_statistics(chan);
978
979 chan->transmit_length = 0;
980
981 /* prepare network device data space for registration */
982 strcpy(dev->name,chan->name);
983
984 dev->init = &if_init;
985 dev->priv = chan;
986
987 /* Initialize FR Polling Task Queue
988 * We need a poll routine for each network
989 * interface.
990 */
991 INIT_WORK(&chan->fr_poll_work, (void *)fr_poll, dev);
992
993 init_timer(&chan->fr_arp_timer);
994 chan->fr_arp_timer.data=(unsigned long)dev;
995 chan->fr_arp_timer.function = fr_arp;
996
997 wandev->new_if_cnt++;
998
999 /* Tells us that if this interface is a
1000 * gateway or not */
1001 if ((chan->gateway = conf->gateway) == WANOPT_YES){
1002 printk(KERN_INFO "%s: Interface %s is set as a gateway.\n",
1003 card->devname,dev->name);
1004 }
1005
1006 /* M. Grant Patch Apr 28 2000
1007 * Disallow duplicate dlci configurations. */
1008 if (card->u.f.dlci_to_dev_map[chan->dlci] != NULL) {
1009 kfree(chan);
1010 return -EBUSY;
1011 }
1012
1013 /* Configure this dlci at a later date, when
1014 * the interface comes up. i.e. when if_open()
1015 * executes */
1016 set_bit(0,&chan->config_dlci);
1017
1018 printk(KERN_INFO "\n");
1019
1020 return 0;
1021}
1022
1023/*============================================================================
1024 * Delete logical channel.
1025 */
1026static int del_if(struct wan_device* wandev, struct net_device* dev)
1027{
1028 fr_channel_t* chan = dev->priv;
1029 unsigned long smp_flags=0;
1030
1031 /* This interface is dead, make sure the
1032 * ARP timer is stopped */
1033 del_timer(&chan->fr_arp_timer);
1034
1035 /* If we are a NODE, we must unconfigure this DLCI
1036 * Trigger an unconfigure command that will
1037 * be executed in timer interrupt. We must wait
1038 * for the command to complete. */
1039 trigger_unconfig_fr(dev);
1040
1041 lock_adapter_irq(&wandev->lock, &smp_flags);
1042 wandev->new_if_cnt--;
1043 unlock_adapter_irq(&wandev->lock, &smp_flags);
1044
1045 return 0;
1046}
1047
1048
1049/*=====================================================================
1050 * disable_comm
1051 *
1052 * Description:
1053 * Disable communications.
1054 * This code runs in shutdown (sdlamain.c)
1055 * under critical flag. Therefore it is not
1056 * necessary to set a critical flag here
1057 *
1058 * Usage:
1059 * Commnunications are disabled only on a card
1060 * shutdown.
1061 */
1062
1063static void disable_comm (sdla_t *card)
1064{
1065 printk(KERN_INFO "%s: Disabling Communications!\n",
1066 card->devname);
1067 fr_comm_disable(card);
1068}
1069
1070/****** WANPIPE-specific entry points ***************************************/
1071
1072/*============================================================================
1073 * Execute adapter interface command.
1074 */
1075static int wpf_exec (struct sdla* card, void* u_cmd, void* u_data)
1076{
1077 fr_mbox_t* mbox = card->mbox;
1078 int retry = MAX_CMD_RETRY;
1079 int err, len;
1080 fr_cmd_t cmd;
1081
1082 if(copy_from_user((void*)&cmd, u_cmd, sizeof(cmd)))
1083 return -EFAULT;
1084
1085 /* execute command */
1086 do
1087 {
1088 memcpy(&mbox->cmd, &cmd, sizeof(cmd));
1089
1090 if (cmd.length){
1091 if( copy_from_user((void*)&mbox->data, u_data, cmd.length))
1092 return -EFAULT;
1093 }
1094
1095 if (sdla_exec(mbox))
1096 err = mbox->cmd.result;
1097
1098 else return -EIO;
1099
1100 } while (err && retry-- && fr_event(card, err, mbox));
1101
1102 /* return result */
1103 if (copy_to_user(u_cmd, (void*)&mbox->cmd, sizeof(fr_cmd_t)))
1104 return -EFAULT;
1105
1106 len = mbox->cmd.length;
1107
1108 if (len && u_data && !copy_to_user(u_data, (void*)&mbox->data, len))
1109 return -EFAULT;
1110 return 0;
1111}
1112
1113/****** Network Device Interface ********************************************/
1114
1115/*============================================================================
1116 * Initialize Linux network interface.
1117 *
1118 * This routine is called only once for each interface, during Linux network
1119 * interface registration. Returning anything but zero will fail interface
1120 * registration.
1121 */
1122static int if_init(struct net_device* dev)
1123{
1124 fr_channel_t* chan = dev->priv;
1125 sdla_t* card = chan->card;
1126 struct wan_device* wandev = &card->wandev;
1127
1128 /* Initialize device driver entry points */
1129 dev->open = &if_open;
1130 dev->stop = &if_close;
1131 dev->hard_header = NULL;
1132 dev->rebuild_header = &if_rebuild_hdr;
1133 dev->hard_start_xmit = &if_send;
1134 dev->get_stats = &if_stats;
1135 dev->tx_timeout = &if_tx_timeout;
1136 dev->watchdog_timeo = TX_TIMEOUT;
1137
1138 if (chan->common.usedby == WANPIPE || chan->common.usedby == API){
1139
1140 /* Initialize media-specific parameters */
1141 if (chan->true_if_encoding){
1142 dev->type = ARPHRD_DLCI; /* This breaks tcpdump */
1143 }else{
1144 dev->type = ARPHRD_PPP; /* ARP h/w type */
1145 }
1146
1147 dev->flags |= IFF_POINTOPOINT;
1148 dev->flags |= IFF_NOARP;
1149
1150 /* Enable Multicast addressing */
1151 if (chan->mc == WANOPT_YES){
1152 dev->flags |= IFF_MULTICAST;
1153 }
1154
1155 dev->mtu = wandev->mtu - FR_HEADER_LEN;
1156 /* For an API, the maximum number of bytes that the stack will pass
1157 to the driver is (dev->mtu + dev->hard_header_len). So, adjust the
1158 mtu so that a frame of maximum size can be transmitted by the API.
1159 */
1160 if(chan->common.usedby == API) {
1161 dev->mtu += (sizeof(api_tx_hdr_t) - FR_HEADER_LEN);
1162 }
1163
1164 dev->hard_header_len = FR_HEADER_LEN;/* media header length */
1165 dev->addr_len = 2; /* hardware address length */
1166 *(unsigned short*)dev->dev_addr = htons(chan->dlci);
1167
1168 /* Set transmit buffer queue length */
1169 dev->tx_queue_len = 100;
1170
1171 }else{
1172
1173 /* Setup the interface for Bridging */
1174 int hw_addr=0;
1175 ether_setup(dev);
1176
1177 /* Use a random number to generate the MAC address */
1178 memcpy(dev->dev_addr, "\xFE\xFC\x00\x00\x00\x00", 6);
1179 get_random_bytes(&hw_addr, sizeof(hw_addr));
1180 *(int *)(dev->dev_addr + 2) += hw_addr;
1181 }
1182
1183 /* Initialize hardware parameters (just for reference) */
1184 dev->irq = wandev->irq;
1185 dev->dma = wandev->dma;
1186 dev->base_addr = wandev->ioport;
1187 dev->mem_start = wandev->maddr;
1188 dev->mem_end = wandev->maddr + wandev->msize - 1;
1189 SET_MODULE_OWNER(dev);
1190
1191 return 0;
1192}
1193
1194/*============================================================================
1195 * Open network interface.
1196 * o if this is the first open, then enable communications and interrupts.
1197 * o prevent module from unloading by incrementing use count
1198 *
1199 * Return 0 if O.k. or errno.
1200 */
1201static int if_open(struct net_device* dev)
1202{
1203 fr_channel_t* chan = dev->priv;
1204 sdla_t* card = chan->card;
1205 int err = 0;
1206 struct timeval tv;
1207
1208 if (netif_running(dev))
1209 return -EBUSY;
1210
1211 /* Initialize the task queue */
1212 chan->tq_working=0;
1213
1214 INIT_WORK(&chan->common.wanpipe_work, (void *)fr_bh, dev);
1215
1216 /* Allocate and initialize BH circular buffer */
1217 chan->bh_head = kmalloc((sizeof(bh_data_t)*MAX_BH_BUFF),GFP_ATOMIC);
1218 memset(chan->bh_head,0,(sizeof(bh_data_t)*MAX_BH_BUFF));
1219 atomic_set(&chan->bh_buff_used, 0);
1220
1221 netif_start_queue(dev);
1222
1223 wanpipe_open(card);
1224 do_gettimeofday( &tv );
1225 chan->router_start_time = tv.tv_sec;
1226
1227 if (test_bit(0,&chan->config_dlci)){
1228 trigger_config_fr (card);
1229 }else if (chan->inarp == INARP_REQUEST){
1230 trigger_fr_arp(dev);
1231 }
1232
1233 return err;
1234}
1235
1236/*============================================================================
1237 * Close network interface.
1238 * o if this is the last open, then disable communications and interrupts.
1239 * o reset flags.
1240 */
1241static int if_close(struct net_device* dev)
1242{
1243 fr_channel_t* chan = dev->priv;
1244 sdla_t* card = chan->card;
1245
1246 if (chan->inarp == INARP_CONFIGURED) {
1247 chan->inarp = INARP_REQUEST;
1248 }
1249
1250 netif_stop_queue(dev);
1251 wanpipe_close(card);
1252
1253 return 0;
1254}
1255
1256/*============================================================================
1257 * Re-build media header.
1258 *
1259 * Return: 1 physical address resolved.
1260 * 0 physical address not resolved
1261 */
1262static int if_rebuild_hdr (struct sk_buff* skb)
1263{
1264 struct net_device *dev = skb->dev;
1265 fr_channel_t* chan = dev->priv;
1266 sdla_t* card = chan->card;
1267
1268 printk(KERN_INFO "%s: rebuild_header() called for interface %s!\n",
1269 card->devname, dev->name);
1270 return 1;
1271}
1272
1273/*============================================================================
1274 * Handle transmit timeout event from netif watchdog
1275 */
1276static void if_tx_timeout(struct net_device *dev)
1277{
1278 fr_channel_t* chan = dev->priv;
1279 sdla_t *card = chan->card;
1280
1281 /* If our device stays busy for at least 5 seconds then we will
1282 * kick start the device by making dev->tbusy = 0. We expect
1283 * that our device never stays busy more than 5 seconds. So this
1284 * is only used as a last resort.
1285 */
1286
1287 chan->drvstats_if_send.if_send_tbusy++;
1288 ++chan->ifstats.collisions;
1289
1290 printk (KERN_INFO "%s: Transmit timed out on %s\n",
1291 card->devname, dev->name);
1292 chan->drvstats_if_send.if_send_tbusy_timeout++;
1293 netif_wake_queue (dev);
1294
1295}
1296
1297
1298/*============================================================================
1299 * Send a packet on a network interface.
1300 * o set tbusy flag (marks start of the transmission) to block a timer-based
1301 * transmit from overlapping.
1302 * o set critical flag when accessing board.
1303 * o check link state. If link is not up, then drop the packet.
1304 * o check channel status. If it's down then initiate a call.
1305 * o pass a packet to corresponding WAN device.
1306 * o free socket buffer
1307 *
1308 * Return: 0 complete (socket buffer must be freed)
1309 * non-0 packet may be re-transmitted (tbusy must be set)
1310 *
1311 * Notes:
1312 * 1. This routine is called either by the protocol stack or by the "net
1313 * bottom half" (with interrupts enabled).
1314 *
1315 * 2. Using netif_start_queue() and netif_stop_queue()
1316 * will inhibit further transmit requests from the protocol stack
1317 * and can be used for flow control with protocol layer.
1318 */
1319static int if_send(struct sk_buff* skb, struct net_device* dev)
1320{
1321 fr_channel_t* chan = dev->priv;
1322 sdla_t* card = chan->card;
1323 int err;
1324 unsigned char *sendpacket;
1325 fr508_flags_t* adptr_flags = card->flags;
1326 int udp_type;
1327 long delay_tx_queued = 0;
1328 unsigned long smp_flags=0;
1329 unsigned char attr = 0;
1330
1331 chan->drvstats_if_send.if_send_entry++;
1332
1333 netif_stop_queue(dev);
1334
1335 if (skb == NULL) {
1336 /* if we get here, some higher layer thinks we've missed an
1337 * tx-done interrupt.
1338 */
1339 printk(KERN_INFO "%s: interface %s got kicked!\n",
1340 card->devname, dev->name);
1341 chan->drvstats_if_send.if_send_skb_null ++;
1342
1343 netif_wake_queue(dev);
1344 return 0;
1345 }
1346
1347 /* If a peripheral task is running just drop packets */
1348 if (test_bit(PERI_CRIT, &card->wandev.critical)){
1349
1350 printk(KERN_INFO "%s: Critical in if_send(): Peripheral running!\n",
1351 card->devname);
1352
1353 dev_kfree_skb_any(skb);
1354 netif_start_queue(dev);
1355 return 0;
1356 }
1357
1358 /* We must set the 'tbusy' flag if we already have a packet queued for
1359 transmission in the transmit interrupt handler. However, we must
1360 ensure that the transmit interrupt does not reset the 'tbusy' flag
1361 just before we set it, as this will result in a "transmit timeout".
1362 */
1363 set_bit(SEND_TXIRQ_CRIT, (void*)&card->wandev.critical);
1364 if(chan->transmit_length) {
1365 netif_stop_queue(dev);
1366 chan->tick_counter = jiffies;
1367 clear_bit(SEND_TXIRQ_CRIT, (void*)&card->wandev.critical);
1368 return 1;
1369 }
1370 clear_bit(SEND_TXIRQ_CRIT, (void*)&card->wandev.critical);
1371
1372 /* Move the if_header() code to here. By inserting frame
1373 * relay header in if_header() we would break the
1374 * tcpdump and other packet sniffers */
1375 chan->fr_header_len = setup_fr_header(skb,dev,chan->common.usedby);
1376 if (chan->fr_header_len < 0 ){
1377 ++chan->ifstats.tx_dropped;
1378 ++card->wandev.stats.tx_dropped;
1379
1380 dev_kfree_skb_any(skb);
1381 netif_start_queue(dev);
1382 return 0;
1383 }
1384
1385 sendpacket = skb->data;
1386
1387 udp_type = udp_pkt_type(skb, card);
1388
1389 if(udp_type != UDP_INVALID_TYPE) {
1390 if(store_udp_mgmt_pkt(udp_type, UDP_PKT_FRM_STACK, card, skb,
1391 chan->dlci)) {
1392 adptr_flags->imask |= FR_INTR_TIMER;
1393 if (udp_type == UDP_FPIPE_TYPE){
1394 chan->drvstats_if_send.
1395 if_send_PIPE_request ++;
1396 }
1397 }
1398 netif_start_queue(dev);
1399 return 0;
1400 }
1401
1402 //FIXME: can we do better than sendpacket[2]?
1403 if ((chan->common.usedby == WANPIPE) && (sendpacket[2] == 0x45)) {
1404
1405 /* check to see if the source IP address is a broadcast or */
1406 /* multicast IP address */
1407 if(chk_bcast_mcast_addr(card, dev, skb)){
1408 ++chan->ifstats.tx_dropped;
1409 ++card->wandev.stats.tx_dropped;
1410 dev_kfree_skb_any(skb);
1411 netif_start_queue(dev);
1412 return 0;
1413 }
1414 }
1415
1416
1417 /* Lock the S514/S508 card: SMP Supported */
1418 s508_s514_lock(card,&smp_flags);
1419
1420 if (test_and_set_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
1421
1422 chan->drvstats_if_send.if_send_critical_non_ISR ++;
1423 chan->ifstats.tx_dropped ++;
1424 printk(KERN_INFO "%s Critical in IF_SEND: if_send() already running!\n",
1425 card->devname);
1426 goto if_send_start_and_exit;
1427 }
1428
1429 /* API packet check: minimum packet size must be greater than
1430 * 16 byte API header */
1431 if((chan->common.usedby == API) && (skb->len <= sizeof(api_tx_hdr_t))) {
1432 ++chan->ifstats.tx_dropped;
1433 ++card->wandev.stats.tx_dropped;
1434
1435
1436 goto if_send_start_and_exit;
1437
1438 }else{
1439 /* During API transmission, get rid of the API header */
1440 if (chan->common.usedby == API) {
1441 api_tx_hdr_t* api_tx_hdr;
1442 api_tx_hdr = (api_tx_hdr_t*)&skb->data[0x00];
1443 attr = api_tx_hdr->attr;
1444 skb_pull(skb,sizeof(api_tx_hdr_t));
1445 }
1446 }
1447
1448 if (card->wandev.state != WAN_CONNECTED) {
1449 chan->drvstats_if_send.if_send_wan_disconnected ++;
1450 ++chan->ifstats.tx_dropped;
1451 ++card->wandev.stats.tx_dropped;
1452
1453 } else if (chan->common.state != WAN_CONNECTED) {
1454 chan->drvstats_if_send.if_send_dlci_disconnected ++;
1455
1456 /* Update the DLCI state in timer interrupt */
1457 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_UPDATE_STATE;
1458 adptr_flags->imask |= FR_INTR_TIMER;
1459
1460 ++chan->ifstats.tx_dropped;
1461 ++card->wandev.stats.tx_dropped;
1462
1463 } else if (!is_tx_ready(card, chan)) {
1464 /* No tx buffers available, store for delayed transmit */
1465 if (!setup_for_delayed_transmit(dev, skb)){
1466 set_bit(1,&delay_tx_queued);
1467 }
1468 chan->drvstats_if_send.if_send_no_bfrs++;
1469
1470 } else if (!skb->protocol) {
1471 /* No protocols drop packet */
1472 chan->drvstats_if_send.if_send_protocol_error ++;
1473 ++card->wandev.stats.tx_errors;
1474
1475 } else if (test_bit(ARP_CRIT,&card->wandev.critical)){
1476 /* We are trying to send an ARP Packet, block IP data until
1477 * ARP is sent */
1478 ++chan->ifstats.tx_dropped;
1479 ++card->wandev.stats.tx_dropped;
1480
1481 } else {
1482 //FIXME: IPX is not implemented in this version of Frame Relay ?
1483 if((chan->common.usedby == WANPIPE) &&
1484 sendpacket[1] == 0x00 &&
1485 sendpacket[2] == 0x80 &&
1486 sendpacket[6] == 0x81 &&
1487 sendpacket[7] == 0x37) {
1488
1489 if( chan->enable_IPX ) {
1490 switch_net_numbers(sendpacket,
1491 chan->network_number, 0);
1492 } else {
1493 //FIXME: Take this out when IPX is fixed
1494 printk(KERN_INFO
1495 "%s: WARNING: Unsupported IPX data in send, packet dropped\n",
1496 card->devname);
1497 }
1498
1499 }else{
1500 err = fr_send_data_header(card, chan->dlci, attr, skb->len, skb->data, chan->fr_header_len);
1501 if (err) {
1502 switch(err) {
1503 case FRRES_CIR_OVERFLOW:
1504 case FRRES_BUFFER_OVERFLOW:
1505 if (!setup_for_delayed_transmit(dev, skb)){
1506 set_bit(1,&delay_tx_queued);
1507 }
1508 chan->drvstats_if_send.
1509 if_send_adptr_bfrs_full ++;
1510 break;
1511
1512 case FRRES_TOO_LONG:
1513 if (net_ratelimit()){
1514 printk(KERN_INFO
1515 "%s: Error: Frame too long, transmission failed %i\n",
1516 card->devname, (unsigned int)skb->len);
1517 }
1518 /* Drop down to default */
1519 default:
1520 chan->drvstats_if_send.
1521 if_send_dlci_disconnected ++;
1522 ++chan->ifstats.tx_dropped;
1523 ++card->wandev.stats.tx_dropped;
1524 break;
1525 }
1526 } else {
1527 chan->drvstats_if_send.
1528 if_send_bfr_passed_to_adptr++;
1529 ++chan->ifstats.tx_packets;
1530 ++card->wandev.stats.tx_packets;
1531
1532 chan->ifstats.tx_bytes += skb->len;
1533 card->wandev.stats.tx_bytes += skb->len;
1534 dev->trans_start = jiffies;
1535 }
1536 }
1537 }
1538
1539if_send_start_and_exit:
1540
1541 netif_start_queue(dev);
1542
1543 /* If we queued the packet for transmission, we must not
1544 * deallocate it. The packet is unlinked from the IP stack
1545 * not copied. Therefore, we must keep the original packet */
1546 if (!test_bit(1,&delay_tx_queued)) {
1547 dev_kfree_skb_any(skb);
1548 }else{
1549 adptr_flags->imask |= FR_INTR_TXRDY;
1550 card->u.f.tx_interrupts_pending ++;
1551 }
1552
1553 clear_bit(SEND_CRIT, (void*)&card->wandev.critical);
1554
1555 s508_s514_unlock(card,&smp_flags);
1556
1557 return 0;
1558}
1559
1560
1561
1562/*============================================================================
1563 * Setup so that a frame can be transmitted on the occurrence of a transmit
1564 * interrupt.
1565 */
1566static int setup_for_delayed_transmit(struct net_device* dev,
1567 struct sk_buff *skb)
1568{
1569 fr_channel_t* chan = dev->priv;
1570 sdla_t* card = chan->card;
1571 fr_dlci_interface_t* dlci_interface;
1572 int len = skb->len;
1573
1574 /* Check that the dlci is properly configured,
1575 * before using tx interrupt */
1576 if (!chan->dlci_int_interface){
1577 if (net_ratelimit()){
1578 printk(KERN_INFO
1579 "%s: ERROR on DLCI %i: Not configured properly !\n",
1580 card->devname, chan->dlci);
1581 printk(KERN_INFO "%s: Please contact Sangoma Technologies\n",
1582 card->devname);
1583 }
1584 return 1;
1585 }
1586
1587 dlci_interface = chan->dlci_int_interface;
1588
1589 if(chan->transmit_length) {
1590 printk(KERN_INFO "%s: Big mess in setup_for_del...\n",
1591 card->devname);
1592 return 1;
1593 }
1594
1595 if(len > FR_MAX_NO_DATA_BYTES_IN_FRAME) {
1596 //FIXME: increment some statistic */
1597 return 1;
1598 }
1599
1600 chan->transmit_length = len;
1601 chan->delay_skb = skb;
1602
1603 dlci_interface->gen_interrupt |= FR_INTR_TXRDY;
1604 dlci_interface->packet_length = len;
1605
1606 /* Turn on TX interrupt at the end of if_send */
1607 return 0;
1608}
1609
1610
1611/*============================================================================
1612 * Check to see if the packet to be transmitted contains a broadcast or
1613 * multicast source IP address.
1614 * Return 0 if not broadcast/multicast address, otherwise return 1.
1615 */
1616
1617static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
1618 struct sk_buff *skb)
1619{
1620 u32 src_ip_addr;
1621 u32 broadcast_ip_addr = 0;
1622 struct in_device *in_dev;
1623 fr_channel_t* chan = dev->priv;
1624
1625 /* read the IP source address from the outgoing packet */
1626 src_ip_addr = *(u32 *)(skb->data + 14);
1627
1628 /* read the IP broadcast address for the device */
1629 in_dev = dev->ip_ptr;
1630 if(in_dev != NULL) {
1631 struct in_ifaddr *ifa= in_dev->ifa_list;
1632 if(ifa != NULL)
1633 broadcast_ip_addr = ifa->ifa_broadcast;
1634 else
1635 return 0;
1636 }
1637
1638 /* check if the IP Source Address is a Broadcast address */
1639 if((dev->flags & IFF_BROADCAST) && (src_ip_addr == broadcast_ip_addr)) {
1640 printk(KERN_INFO
1641 "%s: Broadcast Source Address silently discarded\n",
1642 card->devname);
1643 return 1;
1644 }
1645
1646 /* check if the IP Source Address is a Multicast address */
1647 if((chan->mc == WANOPT_NO) && (ntohl(src_ip_addr) >= 0xE0000001) &&
1648 (ntohl(src_ip_addr) <= 0xFFFFFFFE)) {
1649 printk(KERN_INFO
1650 "%s: Multicast Source Address silently discarded\n",
1651 card->devname);
1652 return 1;
1653 }
1654
1655 return 0;
1656}
1657
1658/*============================================================================
1659 * Reply to UDP Management system.
1660 * Return nothing.
1661 */
1662static int reply_udp( unsigned char *data, unsigned int mbox_len )
1663{
1664 unsigned short len, udp_length, temp, ip_length;
1665 unsigned long ip_temp;
1666 int even_bound = 0;
1667
1668
1669 fr_udp_pkt_t *fr_udp_pkt = (fr_udp_pkt_t *)data;
1670
1671 /* Set length of packet */
1672 len = //sizeof(fr_encap_hdr_t)+
1673 sizeof(ip_pkt_t)+
1674 sizeof(udp_pkt_t)+
1675 sizeof(wp_mgmt_t)+
1676 sizeof(cblock_t)+
1677 mbox_len;
1678
1679
1680 /* fill in UDP reply */
1681 fr_udp_pkt->wp_mgmt.request_reply = UDPMGMT_REPLY;
1682
1683 /* fill in UDP length */
1684 udp_length = sizeof(udp_pkt_t)+
1685 sizeof(wp_mgmt_t)+
1686 sizeof(cblock_t)+
1687 mbox_len;
1688
1689
1690 /* put it on an even boundary */
1691 if ( udp_length & 0x0001 ) {
1692 udp_length += 1;
1693 len += 1;
1694 even_bound = 1;
1695 }
1696
1697 temp = (udp_length<<8)|(udp_length>>8);
1698 fr_udp_pkt->udp_pkt.udp_length = temp;
1699
1700 /* swap UDP ports */
1701 temp = fr_udp_pkt->udp_pkt.udp_src_port;
1702 fr_udp_pkt->udp_pkt.udp_src_port =
1703 fr_udp_pkt->udp_pkt.udp_dst_port;
1704 fr_udp_pkt->udp_pkt.udp_dst_port = temp;
1705
1706
1707
1708 /* add UDP pseudo header */
1709 temp = 0x1100;
1710 *((unsigned short *)
1711 (fr_udp_pkt->data+mbox_len+even_bound)) = temp;
1712 temp = (udp_length<<8)|(udp_length>>8);
1713 *((unsigned short *)
1714 (fr_udp_pkt->data+mbox_len+even_bound+2)) = temp;
1715
1716 /* calculate UDP checksum */
1717 fr_udp_pkt->udp_pkt.udp_checksum = 0;
1718
1719 fr_udp_pkt->udp_pkt.udp_checksum =
1720 calc_checksum(&data[UDP_OFFSET/*+sizeof(fr_encap_hdr_t)*/],
1721 udp_length+UDP_OFFSET);
1722
1723 /* fill in IP length */
1724 ip_length = udp_length + sizeof(ip_pkt_t);
1725 temp = (ip_length<<8)|(ip_length>>8);
1726 fr_udp_pkt->ip_pkt.total_length = temp;
1727
1728 /* swap IP addresses */
1729 ip_temp = fr_udp_pkt->ip_pkt.ip_src_address;
1730 fr_udp_pkt->ip_pkt.ip_src_address =
1731 fr_udp_pkt->ip_pkt.ip_dst_address;
1732 fr_udp_pkt->ip_pkt.ip_dst_address = ip_temp;
1733
1734
1735 /* fill in IP checksum */
1736 fr_udp_pkt->ip_pkt.hdr_checksum = 0;
1737 fr_udp_pkt->ip_pkt.hdr_checksum =
1738 calc_checksum(&data[/*sizeof(fr_encap_hdr_t)*/0],
1739 sizeof(ip_pkt_t));
1740
1741 return len;
1742} /* reply_udp */
1743
1744unsigned short calc_checksum (char *data, int len)
1745{
1746 unsigned short temp;
1747 unsigned long sum=0;
1748 int i;
1749
1750 for( i = 0; i <len; i+=2 ) {
1751 memcpy(&temp,&data[i],2);
1752 sum += (unsigned long)temp;
1753 }
1754
1755 while (sum >> 16 ) {
1756 sum = (sum & 0xffffUL) + (sum >> 16);
1757 }
1758
1759 temp = (unsigned short)sum;
1760 temp = ~temp;
1761
1762 if( temp == 0 )
1763 temp = 0xffff;
1764
1765 return temp;
1766}
1767
1768/*
1769 If incoming is 0 (outgoing)- if the net numbers is ours make it 0
1770 if incoming is 1 - if the net number is 0 make it ours
1771
1772*/
1773static void switch_net_numbers(unsigned char *sendpacket, unsigned long network_number, unsigned char incoming)
1774{
1775 unsigned long pnetwork_number;
1776
1777 pnetwork_number = (unsigned long)((sendpacket[14] << 24) +
1778 (sendpacket[15] << 16) + (sendpacket[16] << 8) +
1779 sendpacket[17]);
1780
1781 if (!incoming) {
1782 /* If the destination network number is ours, make it 0 */
1783 if( pnetwork_number == network_number) {
1784 sendpacket[14] = sendpacket[15] = sendpacket[16] =
1785 sendpacket[17] = 0x00;
1786 }
1787 } else {
1788 /* If the incoming network is 0, make it ours */
1789 if( pnetwork_number == 0) {
1790 sendpacket[14] = (unsigned char)(network_number >> 24);
1791 sendpacket[15] = (unsigned char)((network_number &
1792 0x00FF0000) >> 16);
1793 sendpacket[16] = (unsigned char)((network_number &
1794 0x0000FF00) >> 8);
1795 sendpacket[17] = (unsigned char)(network_number &
1796 0x000000FF);
1797 }
1798 }
1799
1800
1801 pnetwork_number = (unsigned long)((sendpacket[26] << 24) +
1802 (sendpacket[27] << 16) + (sendpacket[28] << 8) +
1803 sendpacket[29]);
1804
1805 if( !incoming ) {
1806 /* If the source network is ours, make it 0 */
1807 if( pnetwork_number == network_number) {
1808 sendpacket[26] = sendpacket[27] = sendpacket[28] =
1809 sendpacket[29] = 0x00;
1810 }
1811 } else {
1812 /* If the source network is 0, make it ours */
1813 if( pnetwork_number == 0 ) {
1814 sendpacket[26] = (unsigned char)(network_number >> 24);
1815 sendpacket[27] = (unsigned char)((network_number &
1816 0x00FF0000) >> 16);
1817 sendpacket[28] = (unsigned char)((network_number &
1818 0x0000FF00) >> 8);
1819 sendpacket[29] = (unsigned char)(network_number &
1820 0x000000FF);
1821 }
1822 }
1823} /* switch_net_numbers */
1824
1825/*============================================================================
1826 * Get ethernet-style interface statistics.
1827 * Return a pointer to struct enet_statistics.
1828 */
1829static struct net_device_stats *if_stats(struct net_device *dev)
1830{
1831 fr_channel_t* chan = dev->priv;
1832
1833 if(chan == NULL)
1834 return NULL;
1835
1836 return &chan->ifstats;
1837}
1838
1839/****** Interrupt Handlers **************************************************/
1840
1841/*============================================================================
1842 * fr_isr: S508 frame relay interrupt service routine.
1843 *
1844 * Description:
1845 * Frame relay main interrupt service route. This
1846 * function check the interrupt type and takes
1847 * the appropriate action.
1848 */
1849static void fr_isr (sdla_t* card)
1850{
1851 fr508_flags_t* flags = card->flags;
1852 char *ptr = &flags->iflag;
1853 int i,err;
1854 fr_mbox_t* mbox = card->mbox;
1855
1856 /* This flag prevents nesting of interrupts. See sdla_isr() routine
1857 * in sdlamain.c. */
1858 card->in_isr = 1;
1859
1860 ++card->statistics.isr_entry;
1861
1862
1863 /* All peripheral (configuraiton, re-configuration) events
1864 * take presidence over the ISR. Thus, retrigger */
1865 if (test_bit(PERI_CRIT, (void*)&card->wandev.critical)) {
1866 ++card->statistics.isr_already_critical;
1867 goto fr_isr_exit;
1868 }
1869
1870 if(card->hw.type != SDLA_S514) {
1871 if (test_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
1872 printk(KERN_INFO "%s: Critical while in ISR: If Send Running!\n",
1873 card->devname);
1874 ++card->statistics.isr_already_critical;
1875 goto fr_isr_exit;
1876 }
1877 }
1878
1879 switch (flags->iflag) {
1880
1881 case FR_INTR_RXRDY: /* receive interrupt */
1882 ++card->statistics.isr_rx;
1883 rx_intr(card);
1884 break;
1885
1886
1887 case FR_INTR_TXRDY: /* transmit interrupt */
1888 ++ card->statistics.isr_tx;
1889 tx_intr(card);
1890 break;
1891
1892 case FR_INTR_READY:
1893 Intr_test_counter++;
1894 ++card->statistics.isr_intr_test;
1895 break;
1896
1897 case FR_INTR_DLC: /* Event interrupt occurred */
1898 mbox->cmd.command = FR_READ_STATUS;
1899 mbox->cmd.length = 0;
1900 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
1901 if (err)
1902 fr_event(card, err, mbox);
1903 break;
1904
1905 case FR_INTR_TIMER: /* Timer interrupt */
1906 timer_intr(card);
1907 break;
1908
1909 default:
1910 ++card->statistics.isr_spurious;
1911 spur_intr(card);
1912 printk(KERN_INFO "%s: Interrupt Type 0x%02X!\n",
1913 card->devname, flags->iflag);
1914
1915 printk(KERN_INFO "%s: ID Bytes = ",card->devname);
1916 for(i = 0; i < 8; i ++)
1917 printk(KERN_INFO "0x%02X ", *(ptr + 0x28 + i));
1918 printk(KERN_INFO "\n");
1919
1920 break;
1921 }
1922
1923fr_isr_exit:
1924
1925 card->in_isr = 0;
1926 flags->iflag = 0;
1927 return;
1928}
1929
1930
1931
1932/*===========================================================
1933 * rx_intr Receive interrupt handler.
1934 *
1935 * Description
1936 * Upon receiveing an interrupt:
1937 * 1. Check that the firmware is in sync with
1938 * the driver.
1939 * 2. Find an appropriate network interface
1940 * based on the received dlci number.
1941 * 3. Check that the netowrk interface exists
1942 * and that it's setup properly.
1943 * 4. Copy the data into an skb buffer.
1944 * 5. Check the packet type and take
1945 * appropriate acton: UPD, API, ARP or Data.
1946 */
1947
1948static void rx_intr (sdla_t* card)
1949{
1950 fr_rx_buf_ctl_t* frbuf = card->rxmb;
1951 fr508_flags_t* flags = card->flags;
1952 fr_channel_t* chan;
1953 char *ptr = &flags->iflag;
1954 struct sk_buff* skb;
1955 struct net_device* dev;
1956 void* buf;
1957 unsigned dlci, len, offs, len_incl_hdr;
1958 int i, udp_type;
1959
1960
1961 /* Check that firmware buffers are in sync */
1962 if (frbuf->flag != 0x01) {
1963
1964 printk(KERN_INFO
1965 "%s: corrupted Rx buffer @ 0x%X, flag = 0x%02X!\n",
1966 card->devname, (unsigned)frbuf, frbuf->flag);
1967
1968 printk(KERN_INFO "%s: ID Bytes = ",card->devname);
1969 for(i = 0; i < 8; i ++)
1970 printk(KERN_INFO "0x%02X ", *(ptr + 0x28 + i));
1971 printk(KERN_INFO "\n");
1972
1973 ++card->statistics.rx_intr_corrupt_rx_bfr;
1974
1975 /* Bug Fix: Mar 6 2000
1976 * If we get a corrupted mailbox, it means that driver
1977 * is out of sync with the firmware. There is no recovery.
1978 * If we don't turn off all interrupts for this card
1979 * the machine will crash.
1980 */
1981 printk(KERN_INFO "%s: Critical router failure ...!!!\n", card->devname);
1982 printk(KERN_INFO "Please contact Sangoma Technologies !\n");
1983 fr_set_intr_mode(card, 0, 0, 0);
1984 return;
1985 }
1986
1987 len = frbuf->length;
1988 dlci = frbuf->dlci;
1989 offs = frbuf->offset;
1990
1991 /* Find the network interface for this packet */
1992 dev = find_channel(card, dlci);
1993
1994
1995 /* Check that the network interface is active and
1996 * properly setup */
1997 if (dev == NULL) {
1998 if( net_ratelimit()) {
1999 printk(KERN_INFO "%s: received data on unconfigured DLCI %d!\n",
2000 card->devname, dlci);
2001 }
2002 ++card->statistics.rx_intr_on_orphaned_DLCI;
2003 ++card->wandev.stats.rx_dropped;
2004 goto rx_done;
2005 }
2006
2007 if ((chan = dev->priv) == NULL){
2008 if( net_ratelimit()) {
2009 printk(KERN_INFO "%s: received data on unconfigured DLCI %d!\n",
2010 card->devname, dlci);
2011 }
2012 ++card->statistics.rx_intr_on_orphaned_DLCI;
2013 ++card->wandev.stats.rx_dropped;
2014 goto rx_done;
2015 }
2016
2017 skb = dev_alloc_skb(len);
2018
2019 if (!netif_running(dev) || (skb == NULL)){
2020
2021 ++chan->ifstats.rx_dropped;
2022
2023 if(skb == NULL) {
2024 if (net_ratelimit()) {
2025 printk(KERN_INFO
2026 "%s: no socket buffers available!\n",
2027 card->devname);
2028 }
2029 chan->drvstats_rx_intr.rx_intr_no_socket ++;
2030 }
2031
2032 if (!netif_running(dev)){
2033 chan->drvstats_rx_intr.
2034 rx_intr_dev_not_started ++;
2035 if (skb){
2036 dev_kfree_skb_any(skb);
2037 }
2038 }
2039 goto rx_done;
2040 }
2041
2042 /* Copy data from the board into the socket buffer */
2043 if ((offs + len) > card->u.f.rx_top + 1) {
2044 unsigned tmp = card->u.f.rx_top - offs + 1;
2045
2046 buf = skb_put(skb, tmp);
2047 sdla_peek(&card->hw, offs, buf, tmp);
2048 offs = card->u.f.rx_base;
2049 len -= tmp;
2050 }
2051
2052 buf = skb_put(skb, len);
2053 sdla_peek(&card->hw, offs, buf, len);
2054
2055
2056 /* We got the packet from the bard.
2057 * Check the packet type and take appropriate action */
2058
2059 udp_type = udp_pkt_type( skb, card );
2060
2061 if(udp_type != UDP_INVALID_TYPE) {
2062
2063 /* UDP Debug packet received, store the
2064 * packet and handle it in timer interrupt */
2065
2066 skb_pull(skb, 1);
2067 if (wanrouter_type_trans(skb, dev)){
2068 if(store_udp_mgmt_pkt(udp_type,UDP_PKT_FRM_NETWORK,card,skb,dlci)){
2069
2070 flags->imask |= FR_INTR_TIMER;
2071
2072 if (udp_type == UDP_FPIPE_TYPE){
2073 ++chan->drvstats_rx_intr.rx_intr_PIPE_request;
2074 }
2075 }
2076 }
2077
2078 }else if (chan->common.usedby == API) {
2079
2080 /* We are in API mode.
2081 * Add an API header to the RAW packet
2082 * and queue it into a circular buffer.
2083 * Then kick the fr_bh() bottom half handler */
2084
2085 api_rx_hdr_t* api_rx_hdr;
2086 chan->drvstats_rx_intr.rx_intr_bfr_passed_to_stack ++;
2087 chan->ifstats.rx_packets ++;
2088 card->wandev.stats.rx_packets ++;
2089
2090 chan->ifstats.rx_bytes += skb->len;
2091 card->wandev.stats.rx_bytes += skb->len;
2092
2093 skb_push(skb, sizeof(api_rx_hdr_t));
2094 api_rx_hdr = (api_rx_hdr_t*)&skb->data[0x00];
2095 api_rx_hdr->attr = frbuf->attr;
2096 api_rx_hdr->time_stamp = frbuf->tmstamp;
2097
2098 skb->protocol = htons(ETH_P_IP);
2099 skb->mac.raw = skb->data;
2100 skb->dev = dev;
2101 skb->pkt_type = WAN_PACKET_DATA;
2102
2103 bh_enqueue(dev, skb);
2104
2105 trigger_fr_bh(chan);
2106
2107 }else if (handle_IPXWAN(skb->data,chan->name,chan->enable_IPX, chan->network_number)){
2108
2109 //FIXME: Frame Relay IPX is not supported, Yet !
2110 //if (chan->enable_IPX) {
2111 // fr_send(card, dlci, 0, skb->len,skb->data);
2112 //}
2113 dev_kfree_skb_any(skb);
2114
2115 } else if (is_arp(skb->data)) {
2116
2117 /* ARP support enabled Mar 16 2000
2118 * Process incoming ARP reply/request, setup
2119 * dynamic routes. */
2120
2121 if (process_ARP((arphdr_1490_t *)skb->data, card, dev)) {
2122 if (net_ratelimit()){
2123 printk (KERN_INFO
2124 "%s: Error processing ARP Packet.\n",
2125 card->devname);
2126 }
2127 }
2128 dev_kfree_skb_any(skb);
2129
2130 } else if (skb->data[0] != 0x03) {
2131
2132 if (net_ratelimit()) {
2133 printk(KERN_INFO "%s: Non IETF packet discarded.\n",
2134 card->devname);
2135 }
2136 dev_kfree_skb_any(skb);
2137
2138 } else {
2139
2140 len_incl_hdr = skb->len;
2141 /* Decapsulate packet and pass it up the
2142 protocol stack */
2143 skb->dev = dev;
2144
2145 if (chan->common.usedby == BRIDGE || chan->common.usedby == BRIDGE_NODE){
2146
2147 /* Make sure it's an Ethernet frame, otherwise drop it */
2148 if (!memcmp(skb->data, "\x03\x00\x80\x00\x80\xC2\x00\x07", 8)) {
2149 skb_pull(skb, 8);
2150 skb->protocol=eth_type_trans(skb,dev);
2151 }else{
2152 ++chan->drvstats_rx_intr.rx_intr_bfr_not_passed_to_stack;
2153 ++chan->ifstats.rx_errors;
2154 ++card->wandev.stats.rx_errors;
2155 goto rx_done;
2156 }
2157 }else{
2158
2159 /* remove hardware header */
2160 buf = skb_pull(skb, 1);
2161
2162 if (!wanrouter_type_trans(skb, dev)) {
2163
2164 /* can't decapsulate packet */
2165 dev_kfree_skb_any(skb);
2166
2167 ++chan->drvstats_rx_intr.rx_intr_bfr_not_passed_to_stack;
2168 ++chan->ifstats.rx_errors;
2169 ++card->wandev.stats.rx_errors;
2170 goto rx_done;
2171 }
2172 skb->mac.raw = skb->data;
2173 }
2174
2175
2176 /* Send a packet up the IP stack */
2177 skb->dev->last_rx = jiffies;
2178 netif_rx(skb);
2179 ++chan->drvstats_rx_intr.rx_intr_bfr_passed_to_stack;
2180 ++chan->ifstats.rx_packets;
2181 ++card->wandev.stats.rx_packets;
2182
2183 chan->ifstats.rx_bytes += len_incl_hdr;
2184 card->wandev.stats.rx_bytes += len_incl_hdr;
2185 }
2186
2187rx_done:
2188
2189 /* Release buffer element and calculate a pointer to the next one */
2190 frbuf->flag = 0;
2191 card->rxmb = ++frbuf;
2192 if ((void*)frbuf > card->u.f.rxmb_last)
2193 card->rxmb = card->u.f.rxmb_base;
2194
2195}
2196
2197/*==================================================================
2198 * tx_intr: Transmit interrupt handler.
2199 *
2200 * Rationale:
2201 * If the board is busy transmitting, if_send() will
2202 * buffers a single packet and turn on
2203 * the tx interrupt. Tx interrupt will be called
2204 * by the board, once the firmware can send more
2205 * data. Thus, no polling is required.
2206 *
2207 * Description:
2208 * Tx interrupt is called for each
2209 * configured dlci channel. Thus:
2210 * 1. Obtain the netowrk interface based on the
2211 * dlci number.
2212 * 2. Check that network interface is up and
2213 * properly setup.
2214 * 3. Check for a buffered packet.
2215 * 4. Transmit the packet.
2216 * 5. If we are in WANPIPE mode, mark the
2217 * NET_BH handler.
2218 * 6. If we are in API mode, kick
2219 * the AF_WANPIPE socket for more data.
2220 *
2221 */
2222static void tx_intr(sdla_t *card)
2223{
2224 fr508_flags_t* flags = card->flags;
2225 fr_tx_buf_ctl_t* bctl;
2226 struct net_device* dev;
2227 fr_channel_t* chan;
2228
2229 if(card->hw.type == SDLA_S514){
2230 bctl = (void*)(flags->tse_offs + card->hw.dpmbase);
2231 }else{
2232 bctl = (void*)(flags->tse_offs - FR_MB_VECTOR +
2233 card->hw.dpmbase);
2234 }
2235
2236 /* Find the structure and make it unbusy */
2237 dev = find_channel(card, flags->dlci);
2238 if (dev == NULL){
2239 printk(KERN_INFO "NO DEV IN TX Interrupt\n");
2240 goto end_of_tx_intr;
2241 }
2242
2243 if ((chan = dev->priv) == NULL){
2244 printk(KERN_INFO "NO CHAN IN TX Interrupt\n");
2245 goto end_of_tx_intr;
2246 }
2247
2248 if(!chan->transmit_length || !chan->delay_skb) {
2249 printk(KERN_INFO "%s: tx int error - transmit length zero\n",
2250 card->wandev.name);
2251 goto end_of_tx_intr;
2252 }
2253
2254 /* If the 'if_send()' procedure is currently checking the 'tbusy'
2255 status, then we cannot transmit. Instead, we configure the microcode
2256 so as to re-issue this transmit interrupt at a later stage.
2257 */
2258 if (test_bit(SEND_TXIRQ_CRIT, (void*)&card->wandev.critical)) {
2259
2260 fr_dlci_interface_t* dlci_interface = chan->dlci_int_interface;
2261 bctl->flag = 0xA0;
2262 dlci_interface->gen_interrupt |= FR_INTR_TXRDY;
2263 return;
2264
2265 }else{
2266 bctl->dlci = flags->dlci;
2267 bctl->length = chan->transmit_length+chan->fr_header_len;
2268 sdla_poke(&card->hw,
2269 fr_send_hdr(card,bctl->dlci,bctl->offset),
2270 chan->delay_skb->data,
2271 chan->delay_skb->len);
2272 bctl->flag = 0xC0;
2273
2274 ++chan->ifstats.tx_packets;
2275 ++card->wandev.stats.tx_packets;
2276 chan->ifstats.tx_bytes += chan->transmit_length;
2277 card->wandev.stats.tx_bytes += chan->transmit_length;
2278
2279 /* We must free an sk buffer, which we used
2280 * for delayed transmission; Otherwise, the sock
2281 * will run out of memory */
2282 dev_kfree_skb_any(chan->delay_skb);
2283
2284 chan->delay_skb = NULL;
2285 chan->transmit_length = 0;
2286
2287 dev->trans_start = jiffies;
2288
2289 if (netif_queue_stopped(dev)){
2290 /* If using API, than wakeup socket BH handler */
2291 if (chan->common.usedby == API){
2292 netif_start_queue(dev);
2293 wakeup_sk_bh(dev);
2294 }else{
2295 netif_wake_queue(dev);
2296 }
2297 }
2298 }
2299
2300end_of_tx_intr:
2301
2302 /* if any other interfaces have transmit interrupts pending,
2303 * do not disable the global transmit interrupt */
2304 if(!(-- card->u.f.tx_interrupts_pending))
2305 flags->imask &= ~FR_INTR_TXRDY;
2306
2307
2308}
2309
2310
2311/*============================================================================
2312 * timer_intr: Timer interrupt handler.
2313 *
2314 * Rationale:
2315 * All commans must be executed within the timer
2316 * interrupt since no two commands should execute
2317 * at the same time.
2318 *
2319 * Description:
2320 * The timer interrupt is used to:
2321 * 1. Processing udp calls from 'fpipemon'.
2322 * 2. Processing update calls from /proc file system
2323 * 3. Reading board-level statistics for
2324 * updating the proc file system.
2325 * 4. Sending inverse ARP request packets.
2326 * 5. Configure a dlci/channel.
2327 * 6. Unconfigure a dlci/channel. (Node only)
2328 */
2329
2330static void timer_intr(sdla_t *card)
2331{
2332 fr508_flags_t* flags = card->flags;
2333
2334 /* UDP Debuging: fpipemon call */
2335 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UDP) {
2336 if(card->u.f.udp_type == UDP_FPIPE_TYPE) {
2337 if(process_udp_mgmt_pkt(card)) {
2338 card->u.f.timer_int_enabled &=
2339 ~TMR_INT_ENABLED_UDP;
2340 }
2341 }
2342 }
2343
2344 /* /proc update call : triggered from update() */
2345 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UPDATE) {
2346 fr_get_err_stats(card);
2347 fr_get_stats(card);
2348 card->u.f.update_comms_stats = 0;
2349 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
2350 }
2351
2352 /* Update the channel state call. This is call is
2353 * triggered by if_send() function */
2354 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UPDATE_STATE){
2355 struct net_device *dev;
2356 if (card->wandev.state == WAN_CONNECTED){
2357 for (dev = card->wandev.dev; dev;
2358 dev = *((struct net_device **)dev->priv)){
2359 fr_channel_t *chan = dev->priv;
2360 if (chan->common.state != WAN_CONNECTED){
2361 update_chan_state(dev);
2362 }
2363 }
2364 }
2365 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE_STATE;
2366 }
2367
2368 /* configure a dlci/channel */
2369 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_CONFIG){
2370 config_fr(card);
2371 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_CONFIG;
2372 }
2373
2374 /* unconfigure a dlci/channel */
2375 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG){
2376 unconfig_fr(card);
2377 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
2378 }
2379
2380
2381 /* Transmit ARP packets */
2382 if (card->u.f.timer_int_enabled & TMR_INT_ENABLED_ARP){
2383 int i=0;
2384 struct net_device *dev;
2385
2386 if (card->u.f.arp_dev == NULL)
2387 card->u.f.arp_dev = card->wandev.dev;
2388
2389 dev = card->u.f.arp_dev;
2390
2391 for (;;){
2392
2393 fr_channel_t *chan = dev->priv;
2394
2395 /* If the interface is brought down cancel sending In-ARPs */
2396 if (!(dev->flags&IFF_UP)){
2397 clear_bit(0,&chan->inarp_ready);
2398 }
2399
2400 if (test_bit(0,&chan->inarp_ready)){
2401
2402 if (check_tx_status(card,dev)){
2403 set_bit(ARP_CRIT,&card->wandev.critical);
2404 break;
2405 }
2406
2407 if (!send_inarp_request(card,dev)){
2408 trigger_fr_arp(dev);
2409 chan->inarp_tick = jiffies;
2410 }
2411
2412 clear_bit(0,&chan->inarp_ready);
2413 dev = move_dev_to_next(card,dev);
2414 break;
2415 }
2416 dev = move_dev_to_next(card,dev);
2417
2418 if (++i == card->wandev.new_if_cnt){
2419 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_ARP;
2420 break;
2421 }
2422 }
2423 card->u.f.arp_dev = dev;
2424 }
2425
2426 if(!card->u.f.timer_int_enabled)
2427 flags->imask &= ~FR_INTR_TIMER;
2428}
2429
2430
2431/*============================================================================
2432 * spur_intr: Spurious interrupt handler.
2433 *
2434 * Description:
2435 * We don't know this interrupt.
2436 * Print a warning.
2437 */
2438
2439static void spur_intr (sdla_t* card)
2440{
2441 if (net_ratelimit()){
2442 printk(KERN_INFO "%s: spurious interrupt!\n", card->devname);
2443 }
2444}
2445
2446
2447//FIXME: Fix the IPX in next version
2448/*===========================================================================
2449 * Return 0 for non-IPXWAN packet
2450 * 1 for IPXWAN packet or IPX is not enabled!
2451 * FIXME: Use a IPX structure here not offsets
2452 */
2453static int handle_IPXWAN(unsigned char *sendpacket,
2454 char *devname, unsigned char enable_IPX,
2455 unsigned long network_number)
2456{
2457 int i;
2458
2459 if( sendpacket[1] == 0x00 && sendpacket[2] == 0x80 &&
2460 sendpacket[6] == 0x81 && sendpacket[7] == 0x37) {
2461
2462 /* It's an IPX packet */
2463 if (!enable_IPX){
2464 /* Return 1 so we don't pass it up the stack. */
2465 //FIXME: Take this out when IPX is fixed
2466 if (net_ratelimit()){
2467 printk (KERN_INFO
2468 "%s: WARNING: Unsupported IPX packet received and dropped\n",
2469 devname);
2470 }
2471 return 1;
2472 }
2473 } else {
2474 /* It's not IPX so return and pass it up the stack. */
2475 return 0;
2476 }
2477
2478 if( sendpacket[24] == 0x90 && sendpacket[25] == 0x04){
2479 /* It's IPXWAN */
2480
2481 if( sendpacket[10] == 0x02 && sendpacket[42] == 0x00){
2482
2483 /* It's a timer request packet */
2484 printk(KERN_INFO "%s: Received IPXWAN Timer Request packet\n",
2485 devname);
2486
2487 /* Go through the routing options and answer no to every
2488 * option except Unnumbered RIP/SAP
2489 */
2490 for(i = 49; sendpacket[i] == 0x00; i += 5){
2491 /* 0x02 is the option for Unnumbered RIP/SAP */
2492 if( sendpacket[i + 4] != 0x02){
2493 sendpacket[i + 1] = 0;
2494 }
2495 }
2496
2497 /* Skip over the extended Node ID option */
2498 if( sendpacket[i] == 0x04 ){
2499 i += 8;
2500 }
2501
2502 /* We also want to turn off all header compression opt.
2503 */
2504 for(; sendpacket[i] == 0x80 ;){
2505 sendpacket[i + 1] = 0;
2506 i += (sendpacket[i + 2] << 8) + (sendpacket[i + 3]) + 4;
2507 }
2508
2509 /* Set the packet type to timer response */
2510 sendpacket[42] = 0x01;
2511
2512 printk(KERN_INFO "%s: Sending IPXWAN Timer Response\n",
2513 devname);
2514
2515 } else if( sendpacket[42] == 0x02 ){
2516
2517 /* This is an information request packet */
2518 printk(KERN_INFO
2519 "%s: Received IPXWAN Information Request packet\n",
2520 devname);
2521
2522 /* Set the packet type to information response */
2523 sendpacket[42] = 0x03;
2524
2525 /* Set the router name */
2526 sendpacket[59] = 'F';
2527 sendpacket[60] = 'P';
2528 sendpacket[61] = 'I';
2529 sendpacket[62] = 'P';
2530 sendpacket[63] = 'E';
2531 sendpacket[64] = '-';
2532 sendpacket[65] = CVHexToAscii(network_number >> 28);
2533 sendpacket[66] = CVHexToAscii((network_number & 0x0F000000)>> 24);
2534 sendpacket[67] = CVHexToAscii((network_number & 0x00F00000)>> 20);
2535 sendpacket[68] = CVHexToAscii((network_number & 0x000F0000)>> 16);
2536 sendpacket[69] = CVHexToAscii((network_number & 0x0000F000)>> 12);
2537 sendpacket[70] = CVHexToAscii((network_number & 0x00000F00)>> 8);
2538 sendpacket[71] = CVHexToAscii((network_number & 0x000000F0)>> 4);
2539 sendpacket[72] = CVHexToAscii(network_number & 0x0000000F);
2540 for(i = 73; i < 107; i+= 1)
2541 {
2542 sendpacket[i] = 0;
2543 }
2544
2545 printk(KERN_INFO "%s: Sending IPXWAN Information Response packet\n",
2546 devname);
2547 } else {
2548
2549 printk(KERN_INFO "%s: Unknown IPXWAN packet!\n",devname);
2550 return 0;
2551 }
2552
2553 /* Set the WNodeID to our network address */
2554 sendpacket[43] = (unsigned char)(network_number >> 24);
2555 sendpacket[44] = (unsigned char)((network_number & 0x00FF0000) >> 16);
2556 sendpacket[45] = (unsigned char)((network_number & 0x0000FF00) >> 8);
2557 sendpacket[46] = (unsigned char)(network_number & 0x000000FF);
2558
2559 return 1;
2560 }
2561
2562 /* If we get here, it's an IPX-data packet so it'll get passed up the
2563 * stack.
2564 * switch the network numbers
2565 */
2566 switch_net_numbers(sendpacket, network_number ,1);
2567 return 0;
2568}
2569/*============================================================================
2570 * process_route
2571 *
2572 * Rationale:
2573 * If the interface goes down, or we receive an ARP request,
2574 * we have to change the network interface ip addresses.
2575 * This cannot be done within the interrupt.
2576 *
2577 * Description:
2578 *
2579 * This routine is called as a polling routine to dynamically
2580 * add/delete routes negotiated by inverse ARP. It is in this
2581 * "task" because we don't want routes to be added while in
2582 * interrupt context.
2583 *
2584 * Usage:
2585 * This function is called by fr_poll() polling funtion.
2586 */
2587
2588static void process_route(struct net_device *dev)
2589{
2590 fr_channel_t *chan = dev->priv;
2591 sdla_t *card = chan->card;
2592
2593 struct ifreq if_info;
2594 struct sockaddr_in *if_data;
2595 mm_segment_t fs = get_fs();
2596 u32 ip_tmp;
2597 int err;
2598
2599
2600 switch(chan->route_flag){
2601
2602 case ADD_ROUTE:
2603
2604 /* Set remote addresses */
2605 memset(&if_info, 0, sizeof(if_info));
2606 strcpy(if_info.ifr_name, dev->name);
2607
2608 set_fs(get_ds()); /* get user space block */
2609
2610 if_data = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2611 if_data->sin_addr.s_addr = chan->ip_remote;
2612 if_data->sin_family = AF_INET;
2613 err = devinet_ioctl( SIOCSIFDSTADDR, &if_info );
2614
2615 set_fs(fs); /* restore old block */
2616
2617 if (err) {
2618 printk(KERN_INFO
2619 "%s: Route Add failed. Error: %d\n",
2620 card->devname,err);
2621 printk(KERN_INFO "%s: Address: %u.%u.%u.%u\n",
2622 chan->name, NIPQUAD(chan->ip_remote));
2623
2624 }else {
2625 printk(KERN_INFO "%s: Route Added Successfully: %u.%u.%u.%u\n",
2626 card->devname,NIPQUAD(chan->ip_remote));
2627 chan->route_flag = ROUTE_ADDED;
2628 }
2629 break;
2630
2631 case REMOVE_ROUTE:
2632
2633 /* Set remote addresses */
2634 memset(&if_info, 0, sizeof(if_info));
2635 strcpy(if_info.ifr_name, dev->name);
2636
2637 ip_tmp = get_ip_address(dev,WAN_POINTOPOINT_IP);
2638
2639 set_fs(get_ds()); /* get user space block */
2640
2641 if_data = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2642 if_data->sin_addr.s_addr = 0;
2643 if_data->sin_family = AF_INET;
2644 err = devinet_ioctl( SIOCSIFDSTADDR, &if_info );
2645
2646 set_fs(fs);
2647
2648 if (err) {
2649 printk(KERN_INFO
2650 "%s: Deleting of route failed. Error: %d\n",
2651 card->devname,err);
2652 printk(KERN_INFO "%s: Address: %u.%u.%u.%u\n",
2653 dev->name,NIPQUAD(chan->ip_remote) );
2654
2655 } else {
2656 printk(KERN_INFO "%s: Route Removed Sucessfuly: %u.%u.%u.%u\n",
2657 card->devname,NIPQUAD(ip_tmp));
2658 chan->route_flag = NO_ROUTE;
2659 }
2660 break;
2661
2662 } /* Case Statement */
2663
2664}
2665
2666
2667
2668/****** Frame Relay Firmware-Specific Functions *****************************/
2669
2670/*============================================================================
2671 * Read firmware code version.
2672 * o fill string str with firmware version info.
2673 */
2674static int fr_read_version (sdla_t* card, char* str)
2675{
2676 fr_mbox_t* mbox = card->mbox;
2677 int retry = MAX_CMD_RETRY;
2678 int err;
2679
2680 do
2681 {
2682 mbox->cmd.command = FR_READ_CODE_VERSION;
2683 mbox->cmd.length = 0;
2684 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2685 } while (err && retry-- && fr_event(card, err, mbox));
2686
2687 if (!err && str) {
2688 int len = mbox->cmd.length;
2689 memcpy(str, mbox->data, len);
2690 str[len] = '\0';
2691 }
2692 return err;
2693}
2694
2695/*============================================================================
2696 * Set global configuration.
2697 */
2698static int fr_configure (sdla_t* card, fr_conf_t *conf)
2699{
2700 fr_mbox_t* mbox = card->mbox;
2701 int retry = MAX_CMD_RETRY;
2702 int dlci_num = card->u.f.dlci_num;
2703 int err, i;
2704
2705 do
2706 {
2707 memcpy(mbox->data, conf, sizeof(fr_conf_t));
2708
2709 if (dlci_num) for (i = 0; i < dlci_num; ++i)
2710 ((fr_conf_t*)mbox->data)->dlci[i] =
2711 card->u.f.node_dlci[i];
2712
2713 mbox->cmd.command = FR_SET_CONFIG;
2714 mbox->cmd.length =
2715 sizeof(fr_conf_t) + dlci_num * sizeof(short);
2716
2717 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2718
2719 } while (err && retry-- && fr_event(card, err, mbox));
2720
2721 /*NC Oct 12 2000 */
2722 if (err != CMD_OK){
2723 printk(KERN_ERR "%s: Frame Relay Configuration Failed: rc=0x%x\n",
2724 card->devname,err);
2725 }
2726
2727 return err;
2728}
2729
2730/*============================================================================
2731 * Set DLCI configuration.
2732 */
2733static int fr_dlci_configure (sdla_t* card, fr_dlc_conf_t *conf, unsigned dlci)
2734{
2735 fr_mbox_t* mbox = card->mbox;
2736 int retry = MAX_CMD_RETRY;
2737 int err;
2738
2739 do
2740 {
2741 memcpy(mbox->data, conf, sizeof(fr_dlc_conf_t));
2742 mbox->cmd.dlci = (unsigned short) dlci;
2743 mbox->cmd.command = FR_SET_CONFIG;
2744 mbox->cmd.length = sizeof(fr_dlc_conf_t);
2745 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2746 } while (err && retry--);
2747
2748 return err;
2749}
2750/*============================================================================
2751 * Set interrupt mode.
2752 */
2753static int fr_set_intr_mode (sdla_t* card, unsigned mode, unsigned mtu,
2754 unsigned short timeout)
2755{
2756 fr_mbox_t* mbox = card->mbox;
2757 fr508_intr_ctl_t* ictl = (void*)mbox->data;
2758 int retry = MAX_CMD_RETRY;
2759 int err;
2760
2761 do
2762 {
2763 memset(ictl, 0, sizeof(fr508_intr_ctl_t));
2764 ictl->mode = mode;
2765 ictl->tx_len = mtu;
2766 ictl->irq = card->hw.irq;
2767
2768 /* indicate timeout on timer */
2769 if (mode & 0x20) ictl->timeout = timeout;
2770
2771 mbox->cmd.length = sizeof(fr508_intr_ctl_t);
2772 mbox->cmd.command = FR_SET_INTR_MODE;
2773 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2774
2775 } while (err && retry-- && fr_event(card, err, mbox));
2776
2777 return err;
2778}
2779
2780/*============================================================================
2781 * Enable communications.
2782 */
2783static int fr_comm_enable (sdla_t* card)
2784{
2785 fr_mbox_t* mbox = card->mbox;
2786 int retry = MAX_CMD_RETRY;
2787 int err;
2788
2789 do
2790 {
2791 mbox->cmd.command = FR_COMM_ENABLE;
2792 mbox->cmd.length = 0;
2793 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2794 } while (err && retry-- && fr_event(card, err, mbox));
2795
2796 return err;
2797}
2798
2799/*============================================================================
2800 * fr_comm_disable
2801 *
2802 * Warning: This functin is called by the shutdown() procedure. It is void
2803 * since dev->priv are has already been deallocated and no
2804 * error checking is possible using fr_event() function.
2805 */
2806static void fr_comm_disable (sdla_t* card)
2807{
2808 fr_mbox_t* mbox = card->mbox;
2809 int retry = MAX_CMD_RETRY;
2810 int err;
2811
2812 do {
2813 mbox->cmd.command = FR_SET_MODEM_STATUS;
2814 mbox->cmd.length = 1;
2815 mbox->data[0] = 0;
2816 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2817 } while (err && retry--);
2818
2819 retry = MAX_CMD_RETRY;
2820
2821 do
2822 {
2823 mbox->cmd.command = FR_COMM_DISABLE;
2824 mbox->cmd.length = 0;
2825 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2826 } while (err && retry--);
2827
2828 return;
2829}
2830
2831
2832
2833/*============================================================================
2834 * Get communications error statistics.
2835 */
2836static int fr_get_err_stats (sdla_t* card)
2837{
2838 fr_mbox_t* mbox = card->mbox;
2839 int retry = MAX_CMD_RETRY;
2840 int err;
2841
2842
2843 do
2844 {
2845 mbox->cmd.command = FR_READ_ERROR_STATS;
2846 mbox->cmd.length = 0;
2847 mbox->cmd.dlci = 0;
2848 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2849 } while (err && retry-- && fr_event(card, err, mbox));
2850
2851 if (!err) {
2852 fr_comm_stat_t* stats = (void*)mbox->data;
2853 card->wandev.stats.rx_over_errors = stats->rx_overruns;
2854 card->wandev.stats.rx_crc_errors = stats->rx_bad_crc;
2855 card->wandev.stats.rx_missed_errors = stats->rx_aborts;
2856 card->wandev.stats.rx_length_errors = stats->rx_too_long;
2857 card->wandev.stats.tx_aborted_errors = stats->tx_aborts;
2858
2859 }
2860
2861 return err;
2862}
2863
2864/*============================================================================
2865 * Get statistics.
2866 */
2867static int fr_get_stats (sdla_t* card)
2868{
2869 fr_mbox_t* mbox = card->mbox;
2870 int retry = MAX_CMD_RETRY;
2871 int err;
2872
2873
2874 do
2875 {
2876 mbox->cmd.command = FR_READ_STATISTICS;
2877 mbox->cmd.length = 0;
2878 mbox->cmd.dlci = 0;
2879 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2880 } while (err && retry-- && fr_event(card, err, mbox));
2881
2882 if (!err) {
2883 fr_link_stat_t* stats = (void*)mbox->data;
2884 card->wandev.stats.rx_frame_errors = stats->rx_bad_format;
2885 card->wandev.stats.rx_dropped =
2886 stats->rx_dropped + stats->rx_dropped2;
2887 }
2888
2889 return err;
2890}
2891
2892/*============================================================================
2893 * Add DLCI(s) (Access Node only!).
2894 * This routine will perform the ADD_DLCIs command for the specified DLCI.
2895 */
2896static int fr_add_dlci (sdla_t* card, int dlci)
2897{
2898 fr_mbox_t* mbox = card->mbox;
2899 int retry = MAX_CMD_RETRY;
2900 int err;
2901
2902 do
2903 {
2904 unsigned short* dlci_list = (void*)mbox->data;
2905
2906 mbox->cmd.length = sizeof(short);
2907 dlci_list[0] = dlci;
2908 mbox->cmd.command = FR_ADD_DLCI;
2909 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2910
2911 } while (err && retry-- && fr_event(card, err, mbox));
2912
2913 return err;
2914}
2915
2916/*============================================================================
2917 * Activate DLCI(s) (Access Node only!).
2918 * This routine will perform the ACTIVATE_DLCIs command with a DLCI number.
2919 */
2920static int fr_activate_dlci (sdla_t* card, int dlci)
2921{
2922 fr_mbox_t* mbox = card->mbox;
2923 int retry = MAX_CMD_RETRY;
2924 int err;
2925
2926 do
2927 {
2928 unsigned short* dlci_list = (void*)mbox->data;
2929
2930 mbox->cmd.length = sizeof(short);
2931 dlci_list[0] = dlci;
2932 mbox->cmd.command = FR_ACTIVATE_DLCI;
2933 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2934
2935 } while (err && retry-- && fr_event(card, err, mbox));
2936
2937 return err;
2938}
2939
2940/*============================================================================
2941 * Delete DLCI(s) (Access Node only!).
2942 * This routine will perform the DELETE_DLCIs command with a DLCI number.
2943 */
2944static int fr_delete_dlci (sdla_t* card, int dlci)
2945{
2946 fr_mbox_t* mbox = card->mbox;
2947 int retry = MAX_CMD_RETRY;
2948 int err;
2949
2950 do
2951 {
2952 unsigned short* dlci_list = (void*)mbox->data;
2953
2954 mbox->cmd.length = sizeof(short);
2955 dlci_list[0] = dlci;
2956 mbox->cmd.command = FR_DELETE_DLCI;
2957 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2958
2959 } while (err && retry-- && fr_event(card, err, mbox));
2960
2961 return err;
2962}
2963
2964
2965
2966/*============================================================================
2967 * Issue in-channel signalling frame.
2968 */
2969static int fr_issue_isf (sdla_t* card, int isf)
2970{
2971 fr_mbox_t* mbox = card->mbox;
2972 int retry = MAX_CMD_RETRY;
2973 int err;
2974
2975 do
2976 {
2977 mbox->data[0] = isf;
2978 mbox->cmd.length = 1;
2979 mbox->cmd.command = FR_ISSUE_IS_FRAME;
2980 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2981 } while (err && retry-- && fr_event(card, err, mbox));
2982
2983 return err;
2984}
2985
2986
2987static unsigned int fr_send_hdr (sdla_t*card, int dlci, unsigned int offset)
2988{
2989 struct net_device *dev = find_channel(card,dlci);
2990 fr_channel_t *chan;
2991
2992 if (!dev || !(chan=dev->priv))
2993 return offset;
2994
2995 if (chan->fr_header_len){
2996 sdla_poke(&card->hw, offset, chan->fr_header, chan->fr_header_len);
2997 }
2998
2999 return offset+chan->fr_header_len;
3000}
3001
3002/*============================================================================
3003 * Send a frame on a selected DLCI.
3004 */
3005static int fr_send_data_header (sdla_t* card, int dlci, unsigned char attr, int len,
3006 void *buf, unsigned char hdr_len)
3007{
3008 fr_mbox_t* mbox = card->mbox + 0x800;
3009 int retry = MAX_CMD_RETRY;
3010 int err;
3011
3012 do
3013 {
3014 mbox->cmd.dlci = dlci;
3015 mbox->cmd.attr = attr;
3016 mbox->cmd.length = len+hdr_len;
3017 mbox->cmd.command = FR_WRITE;
3018 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
3019 } while (err && retry-- && fr_event(card, err, mbox));
3020
3021 if (!err) {
3022 fr_tx_buf_ctl_t* frbuf;
3023
3024 if(card->hw.type == SDLA_S514)
3025 frbuf = (void*)(*(unsigned long*)mbox->data +
3026 card->hw.dpmbase);
3027 else
3028 frbuf = (void*)(*(unsigned long*)mbox->data -
3029 FR_MB_VECTOR + card->hw.dpmbase);
3030
3031 sdla_poke(&card->hw, fr_send_hdr(card,dlci,frbuf->offset), buf, len);
3032 frbuf->flag = 0x01;
3033 }
3034
3035 return err;
3036}
3037
3038static int fr_send (sdla_t* card, int dlci, unsigned char attr, int len,
3039 void *buf)
3040{
3041 fr_mbox_t* mbox = card->mbox + 0x800;
3042 int retry = MAX_CMD_RETRY;
3043 int err;
3044
3045 do
3046 {
3047 mbox->cmd.dlci = dlci;
3048 mbox->cmd.attr = attr;
3049 mbox->cmd.length = len;
3050 mbox->cmd.command = FR_WRITE;
3051 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
3052 } while (err && retry-- && fr_event(card, err, mbox));
3053
3054 if (!err) {
3055 fr_tx_buf_ctl_t* frbuf;
3056
3057 if(card->hw.type == SDLA_S514)
3058 frbuf = (void*)(*(unsigned long*)mbox->data +
3059 card->hw.dpmbase);
3060 else
3061 frbuf = (void*)(*(unsigned long*)mbox->data -
3062 FR_MB_VECTOR + card->hw.dpmbase);
3063
3064 sdla_poke(&card->hw, frbuf->offset, buf, len);
3065 frbuf->flag = 0x01;
3066 }
3067
3068 return err;
3069}
3070
3071
3072/****** Firmware Asynchronous Event Handlers ********************************/
3073
3074/*============================================================================
3075 * Main asyncronous event/error handler.
3076 * This routine is called whenever firmware command returns non-zero
3077 * return code.
3078 *
3079 * Return zero if previous command has to be cancelled.
3080 */
3081static int fr_event (sdla_t *card, int event, fr_mbox_t* mbox)
3082{
3083 fr508_flags_t* flags = card->flags;
3084 char *ptr = &flags->iflag;
3085 int i;
3086
3087 switch (event) {
3088
3089 case FRRES_MODEM_FAILURE:
3090 return fr_modem_failure(card, mbox);
3091
3092 case FRRES_CHANNEL_DOWN: {
3093 struct net_device *dev;
3094
3095 /* Remove all routes from associated DLCI's */
3096 for (dev = card->wandev.dev; dev;
3097 dev = *((struct net_device **)dev->priv)) {
3098 fr_channel_t *chan = dev->priv;
3099 if (chan->route_flag == ROUTE_ADDED) {
3100 chan->route_flag = REMOVE_ROUTE;
3101 }
3102
3103 if (chan->inarp == INARP_CONFIGURED) {
3104 chan->inarp = INARP_REQUEST;
3105 }
3106
3107 /* If the link becomes disconnected then,
3108 * all channels will be disconnected
3109 * as well.
3110 */
3111 set_chan_state(dev,WAN_DISCONNECTED);
3112 }
3113
3114 wanpipe_set_state(card, WAN_DISCONNECTED);
3115 return 1;
3116 }
3117
3118 case FRRES_CHANNEL_UP: {
3119 struct net_device *dev;
3120
3121 /* FIXME: Only startup devices that are on the list */
3122
3123 for (dev = card->wandev.dev; dev;
3124 dev = *((struct net_device **)dev->priv)) {
3125
3126 set_chan_state(dev,WAN_CONNECTED);
3127 }
3128
3129 wanpipe_set_state(card, WAN_CONNECTED);
3130 return 1;
3131 }
3132
3133 case FRRES_DLCI_CHANGE:
3134 return fr_dlci_change(card, mbox);
3135
3136 case FRRES_DLCI_MISMATCH:
3137 printk(KERN_INFO "%s: DLCI list mismatch!\n",
3138 card->devname);
3139 return 1;
3140
3141 case CMD_TIMEOUT:
3142 printk(KERN_ERR "%s: command 0x%02X timed out!\n",
3143 card->devname, mbox->cmd.command);
3144 printk(KERN_INFO "%s: ID Bytes = ",card->devname);
3145 for(i = 0; i < 8; i ++)
3146 printk(KERN_INFO "0x%02X ", *(ptr + 0x18 + i));
3147 printk(KERN_INFO "\n");
3148
3149 break;
3150
3151 case FRRES_DLCI_INACTIVE:
3152 break;
3153
3154 case FRRES_CIR_OVERFLOW:
3155 break;
3156
3157 case FRRES_BUFFER_OVERFLOW:
3158 break;
3159
3160 default:
3161 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X!\n"
3162 , card->devname, mbox->cmd.command, event);
3163 }
3164
3165 return 0;
3166}
3167
3168/*============================================================================
3169 * Handle modem error.
3170 *
3171 * Return zero if previous command has to be cancelled.
3172 */
3173static int fr_modem_failure (sdla_t *card, fr_mbox_t* mbox)
3174{
3175 printk(KERN_INFO "%s: physical link down! (modem error 0x%02X)\n",
3176 card->devname, mbox->data[0]);
3177
3178 switch (mbox->cmd.command){
3179 case FR_WRITE:
3180
3181 case FR_READ:
3182 return 0;
3183 }
3184
3185 return 1;
3186}
3187
3188/*============================================================================
3189 * Handle DLCI status change.
3190 *
3191 * Return zero if previous command has to be cancelled.
3192 */
3193static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox)
3194{
3195 dlci_status_t* status = (void*)mbox->data;
3196 int cnt = mbox->cmd.length / sizeof(dlci_status_t);
3197 fr_channel_t *chan;
3198 struct net_device* dev2;
3199
3200
3201 for (; cnt; --cnt, ++status) {
3202
3203 unsigned short dlci= status->dlci;
3204 struct net_device* dev = find_channel(card, dlci);
3205
3206 if (dev == NULL){
3207 printk(KERN_INFO
3208 "%s: CPE contains unconfigured DLCI= %d\n",
3209 card->devname, dlci);
3210
3211 printk(KERN_INFO
3212 "%s: unconfigured DLCI %d reported by network\n"
3213 , card->devname, dlci);
3214
3215 }else{
3216 if (status->state == FR_LINK_INOPER) {
3217 printk(KERN_INFO
3218 "%s: DLCI %u is inactive!\n",
3219 card->devname, dlci);
3220
3221 if (dev && netif_running(dev))
3222 set_chan_state(dev, WAN_DISCONNECTED);
3223 }
3224
3225 if (status->state & FR_DLCI_DELETED) {
3226
3227 printk(KERN_INFO
3228 "%s: DLCI %u has been deleted!\n",
3229 card->devname, dlci);
3230
3231 if (dev && netif_running(dev)){
3232
3233 fr_channel_t *chan = dev->priv;
3234
3235 if (chan->route_flag == ROUTE_ADDED) {
3236 chan->route_flag = REMOVE_ROUTE;
3237 /* The state change will trigger
3238 * the fr polling routine */
3239 }
3240
3241 if (chan->inarp == INARP_CONFIGURED) {
3242 chan->inarp = INARP_REQUEST;
3243 }
3244
3245 set_chan_state(dev, WAN_DISCONNECTED);
3246 }
3247
3248 } else if (status->state & FR_DLCI_ACTIVE) {
3249
3250 chan = dev->priv;
3251
3252 /* This flag is used for configuring specific
3253 DLCI(s) when they become active.
3254 */
3255 chan->dlci_configured = DLCI_CONFIG_PENDING;
3256
3257 set_chan_state(dev, WAN_CONNECTED);
3258
3259 }
3260 }
3261 }
3262
3263 for (dev2 = card->wandev.dev; dev2;
3264 dev2 = *((struct net_device **)dev2->priv)){
3265
3266 chan = dev2->priv;
3267
3268 if (chan->dlci_configured == DLCI_CONFIG_PENDING) {
3269 if (fr_init_dlci(card, chan)){
3270 return 1;
3271 }
3272 }
3273
3274 }
3275 return 1;
3276}
3277
3278
3279static int fr_init_dlci (sdla_t *card, fr_channel_t *chan)
3280{
3281 fr_dlc_conf_t cfg;
3282
3283 memset(&cfg, 0, sizeof(cfg));
3284
3285 if ( chan->cir_status == CIR_DISABLED) {
3286
3287 cfg.cir_fwd = cfg.cir_bwd = 16;
3288 cfg.bc_fwd = cfg.bc_bwd = 16;
3289 cfg.conf_flags = 0x0001;
3290
3291 }else if (chan->cir_status == CIR_ENABLED) {
3292
3293 cfg.cir_fwd = cfg.cir_bwd = chan->cir;
3294 cfg.bc_fwd = cfg.bc_bwd = chan->bc;
3295 cfg.be_fwd = cfg.be_bwd = chan->be;
3296 cfg.conf_flags = 0x0000;
3297 }
3298
3299 if (fr_dlci_configure( card, &cfg , chan->dlci)){
3300 printk(KERN_INFO
3301 "%s: DLCI Configure failed for %d\n",
3302 card->devname, chan->dlci);
3303 return 1;
3304 }
3305
3306 chan->dlci_configured = DLCI_CONFIGURED;
3307
3308 /* Read the interface byte mapping into the channel
3309 * structure.
3310 */
3311 read_DLCI_IB_mapping( card, chan );
3312
3313 return 0;
3314}
3315/******* Miscellaneous ******************************************************/
3316
3317/*============================================================================
3318 * Update channel state.
3319 */
3320static int update_chan_state(struct net_device* dev)
3321{
3322 fr_channel_t* chan = dev->priv;
3323 sdla_t* card = chan->card;
3324 fr_mbox_t* mbox = card->mbox;
3325 int retry = MAX_CMD_RETRY;
3326 int err;
3327
3328 do
3329 {
3330 mbox->cmd.command = FR_LIST_ACTIVE_DLCI;
3331 mbox->cmd.length = 0;
3332 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
3333 } while (err && retry-- && fr_event(card, err, mbox));
3334
3335 if (!err) {
3336
3337 unsigned short* list = (void*)mbox->data;
3338 int cnt = mbox->cmd.length / sizeof(short);
3339
3340 err=1;
3341
3342 for (; cnt; --cnt, ++list) {
3343
3344 if (*list == chan->dlci) {
3345 set_chan_state(dev, WAN_CONNECTED);
3346
3347
3348 /* May 23 2000. NC
3349 * When a dlci is added or restarted,
3350 * the dlci_int_interface pointer must
3351 * be reinitialized. */
3352 if (!chan->dlci_int_interface){
3353 err=fr_init_dlci (card,chan);
3354 }
3355 break;
3356 }
3357 }
3358 }
3359
3360 return err;
3361}
3362
3363/*============================================================================
3364 * Set channel state.
3365 */
3366static void set_chan_state(struct net_device* dev, int state)
3367{
3368 fr_channel_t* chan = dev->priv;
3369 sdla_t* card = chan->card;
3370
3371 if (chan->common.state != state) {
3372
3373 switch (state) {
3374
3375 case WAN_CONNECTED:
3376 printk(KERN_INFO
3377 "%s: Interface %s: DLCI %d connected\n",
3378 card->devname, dev->name, chan->dlci);
3379
3380 /* If the interface was previoulsy down,
3381 * bring it up, since the channel is active */
3382
3383 trigger_fr_poll (dev);
3384 trigger_fr_arp (dev);
3385 break;
3386
3387 case WAN_CONNECTING:
3388 printk(KERN_INFO
3389 "%s: Interface %s: DLCI %d connecting\n",
3390 card->devname, dev->name, chan->dlci);
3391 break;
3392
3393 case WAN_DISCONNECTED:
3394 printk (KERN_INFO
3395 "%s: Interface %s: DLCI %d disconnected!\n",
3396 card->devname, dev->name, chan->dlci);
3397
3398 /* If the interface is up, bring it down,
3399 * since the channel is now disconnected */
3400 trigger_fr_poll (dev);
3401 break;
3402 }
3403
3404 chan->common.state = state;
3405 }
3406
3407 chan->state_tick = jiffies;
3408}
3409
3410/*============================================================================
3411 * Find network device by its channel number.
3412 *
3413 * We need this critical flag because we change
3414 * the dlci_to_dev_map outside the interrupt.
3415 *
3416 * NOTE: del_if() functions updates this array, it uses
3417 * the spin locks to avoid corruption.
3418 */
3419static struct net_device* find_channel(sdla_t* card, unsigned dlci)
3420{
3421 if(dlci > HIGHEST_VALID_DLCI)
3422 return NULL;
3423
3424 return(card->u.f.dlci_to_dev_map[dlci]);
3425}
3426
3427/*============================================================================
3428 * Check to see if a frame can be sent. If no transmit buffers available,
3429 * enable transmit interrupts.
3430 *
3431 * Return: 1 - Tx buffer(s) available
3432 * 0 - no buffers available
3433 */
3434static int is_tx_ready (sdla_t* card, fr_channel_t* chan)
3435{
3436 unsigned char sb;
3437
3438 if(card->hw.type == SDLA_S514)
3439 return 1;
3440
3441 sb = inb(card->hw.port);
3442 if (sb & 0x02)
3443 return 1;
3444
3445 return 0;
3446}
3447
3448/*============================================================================
3449 * Convert decimal string to unsigned integer.
3450 * If len != 0 then only 'len' characters of the string are converted.
3451 */
3452static unsigned int dec_to_uint (unsigned char* str, int len)
3453{
3454 unsigned val;
3455
3456 if (!len)
3457 len = strlen(str);
3458
3459 for (val = 0; len && isdigit(*str); ++str, --len)
3460 val = (val * 10) + (*str - (unsigned)'0');
3461
3462 return val;
3463}
3464
3465
3466
3467/*=============================================================================
3468 * Store a UDP management packet for later processing.
3469 */
3470
3471static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t* card,
3472 struct sk_buff *skb, int dlci)
3473{
3474 int udp_pkt_stored = 0;
3475
3476 struct net_device *dev = find_channel(card, dlci);
3477 fr_channel_t *chan;
3478
3479 if (!dev || !(chan=dev->priv))
3480 return 1;
3481
3482 if(!card->u.f.udp_pkt_lgth && (skb->len <= MAX_LGTH_UDP_MGNT_PKT)){
3483 card->u.f.udp_pkt_lgth = skb->len + chan->fr_header_len;
3484 card->u.f.udp_type = udp_type;
3485 card->u.f.udp_pkt_src = udp_pkt_src;
3486 card->u.f.udp_dlci = dlci;
3487 memcpy(card->u.f.udp_pkt_data, skb->data, skb->len);
3488 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_UDP;
3489 udp_pkt_stored = 1;
3490
3491 }else{
3492 printk(KERN_INFO "ERROR: UDP packet not stored for DLCI %d\n",
3493 dlci);
3494 }
3495
3496 if(udp_pkt_src == UDP_PKT_FRM_STACK){
3497 dev_kfree_skb_any(skb);
3498 }else{
3499 dev_kfree_skb_any(skb);
3500 }
3501
3502 return(udp_pkt_stored);
3503}
3504
3505
3506/*==============================================================================
3507 * Process UDP call of type FPIPE8ND
3508 */
3509static int process_udp_mgmt_pkt(sdla_t* card)
3510{
3511
3512 int c_retry = MAX_CMD_RETRY;
3513 unsigned char *buf;
3514 unsigned char frames;
3515 unsigned int len;
3516 unsigned short buffer_length;
3517 struct sk_buff *new_skb;
3518 fr_mbox_t* mbox = card->mbox;
3519 int err;
3520 struct timeval tv;
3521 int udp_mgmt_req_valid = 1;
3522 struct net_device* dev;
3523 fr_channel_t* chan;
3524 fr_udp_pkt_t *fr_udp_pkt;
3525 unsigned short num_trc_els;
3526 fr_trc_el_t* ptr_trc_el;
3527 fr_trc_el_t trc_el;
3528 fpipemon_trc_t* fpipemon_trc;
3529
3530 char udp_pkt_src = card->u.f.udp_pkt_src;
3531 int dlci = card->u.f.udp_dlci;
3532
3533 /* Find network interface for this packet */
3534 dev = find_channel(card, dlci);
3535 if (!dev){
3536 card->u.f.udp_pkt_lgth = 0;
3537 return 1;
3538 }
3539 if ((chan = dev->priv) == NULL){
3540 card->u.f.udp_pkt_lgth = 0;
3541 return 1;
3542 }
3543
3544 /* If the UDP packet is from the network, we are going to have to
3545 transmit a response. Before doing so, we must check to see that
3546 we are not currently transmitting a frame (in 'if_send()') and
3547 that we are not already in a 'delayed transmit' state.
3548 */
3549 if(udp_pkt_src == UDP_PKT_FRM_NETWORK) {
3550 if (check_tx_status(card,dev)){
3551 card->u.f.udp_pkt_lgth = 0;
3552 return 1;
3553 }
3554 }
3555
3556 fr_udp_pkt = (fr_udp_pkt_t *)card->u.f.udp_pkt_data;
3557
3558 if(udp_pkt_src == UDP_PKT_FRM_NETWORK) {
3559
3560 switch(fr_udp_pkt->cblock.command) {
3561
3562 case FR_READ_MODEM_STATUS:
3563 case FR_READ_STATUS:
3564 case FPIPE_ROUTER_UP_TIME:
3565 case FR_READ_ERROR_STATS:
3566 case FPIPE_DRIVER_STAT_GEN:
3567 case FR_READ_STATISTICS:
3568 case FR_READ_ADD_DLC_STATS:
3569 case FR_READ_CONFIG:
3570 case FR_READ_CODE_VERSION:
3571 udp_mgmt_req_valid = 1;
3572 break;
3573 default:
3574 udp_mgmt_req_valid = 0;
3575 break;
3576 }
3577 }
3578
3579 if(!udp_mgmt_req_valid) {
3580 /* set length to 0 */
3581 fr_udp_pkt->cblock.length = 0;
3582 /* set return code */
3583 fr_udp_pkt->cblock.result = 0xCD;
3584
3585 chan->drvstats_gen.UDP_PIPE_mgmt_direction_err ++;
3586
3587 if (net_ratelimit()){
3588 printk(KERN_INFO
3589 "%s: Warning, Illegal UDP command attempted from network: %x\n",
3590 card->devname,fr_udp_pkt->cblock.command);
3591 }
3592
3593 } else {
3594
3595 switch(fr_udp_pkt->cblock.command) {
3596
3597 case FPIPE_ENABLE_TRACING:
3598 if(!card->TracingEnabled) {
3599 do {
3600 mbox->cmd.command = FR_SET_TRACE_CONFIG;
3601 mbox->cmd.length = 1;
3602 mbox->cmd.dlci = 0x00;
3603 mbox->data[0] = fr_udp_pkt->data[0] |
3604 RESET_TRC;
3605 err = sdla_exec(mbox) ?
3606 mbox->cmd.result : CMD_TIMEOUT;
3607 } while (err && c_retry-- && fr_event(card, err,
3608 mbox));
3609
3610 if(err) {
3611 card->TracingEnabled = 0;
3612 /* set the return code */
3613 fr_udp_pkt->cblock.result =
3614 mbox->cmd.result;
3615 mbox->cmd.length = 0;
3616 break;
3617 }
3618
3619 sdla_peek(&card->hw, NO_TRC_ELEMENTS_OFF,
3620 &num_trc_els, 2);
3621 sdla_peek(&card->hw, BASE_TRC_ELEMENTS_OFF,
3622 &card->u.f.trc_el_base, 4);
3623 card->u.f.curr_trc_el = card->u.f.trc_el_base;
3624 card->u.f.trc_el_last = card->u.f.curr_trc_el +
3625 ((num_trc_els - 1) *
3626 sizeof(fr_trc_el_t));
3627
3628 /* Calculate the maximum trace data area in */
3629 /* the UDP packet */
3630 card->u.f.trc_bfr_space=(MAX_LGTH_UDP_MGNT_PKT -
3631 //sizeof(fr_encap_hdr_t) -
3632 sizeof(ip_pkt_t) -
3633 sizeof(udp_pkt_t) -
3634 sizeof(wp_mgmt_t) -
3635 sizeof(cblock_t));
3636
3637 /* set return code */
3638 fr_udp_pkt->cblock.result = 0;
3639
3640 } else {
3641 /* set return code to line trace already
3642 enabled */
3643 fr_udp_pkt->cblock.result = 1;
3644 }
3645
3646 mbox->cmd.length = 0;
3647 card->TracingEnabled = 1;
3648 break;
3649
3650
3651 case FPIPE_DISABLE_TRACING:
3652 if(card->TracingEnabled) {
3653
3654 do {
3655 mbox->cmd.command = FR_SET_TRACE_CONFIG;
3656 mbox->cmd.length = 1;
3657 mbox->cmd.dlci = 0x00;
3658 mbox->data[0] = ~ACTIVATE_TRC;
3659 err = sdla_exec(mbox) ?
3660 mbox->cmd.result : CMD_TIMEOUT;
3661 } while (err && c_retry-- && fr_event(card, err, mbox));
3662 }
3663
3664 /* set return code */
3665 fr_udp_pkt->cblock.result = 0;
3666 mbox->cmd.length = 0;
3667 card->TracingEnabled = 0;
3668 break;
3669
3670 case FPIPE_GET_TRACE_INFO:
3671
3672 /* Line trace cannot be performed on the 502 */
3673 if(!card->TracingEnabled) {
3674 /* set return code */
3675 fr_udp_pkt->cblock.result = 1;
3676 mbox->cmd.length = 0;
3677 break;
3678 }
3679
3680 ptr_trc_el = (void *)card->u.f.curr_trc_el;
3681
3682 buffer_length = 0;
3683 fr_udp_pkt->data[0x00] = 0x00;
3684
3685 for(frames = 0; frames < MAX_FRMS_TRACED; frames ++) {
3686
3687 sdla_peek(&card->hw, (unsigned long)ptr_trc_el,
3688 (void *)&trc_el.flag,
3689 sizeof(fr_trc_el_t));
3690 if(trc_el.flag == 0x00) {
3691 break;
3692 }
3693 if((card->u.f.trc_bfr_space - buffer_length)
3694 < sizeof(fpipemon_trc_hdr_t)) {
3695 fr_udp_pkt->data[0x00] |= MORE_TRC_DATA;
3696 break;
3697 }
3698
3699 fpipemon_trc =
3700 (fpipemon_trc_t *)&fr_udp_pkt->data[buffer_length];
3701 fpipemon_trc->fpipemon_trc_hdr.status =
3702 trc_el.attr;
3703 fpipemon_trc->fpipemon_trc_hdr.tmstamp =
3704 trc_el.tmstamp;
3705 fpipemon_trc->fpipemon_trc_hdr.length =
3706 trc_el.length;
3707
3708 if(!trc_el.offset || !trc_el.length) {
3709
3710 fpipemon_trc->fpipemon_trc_hdr.data_passed = 0x00;
3711
3712 }else if((trc_el.length + sizeof(fpipemon_trc_hdr_t) + 1) >
3713 (card->u.f.trc_bfr_space - buffer_length)){
3714
3715 fpipemon_trc->fpipemon_trc_hdr.data_passed = 0x00;
3716 fr_udp_pkt->data[0x00] |= MORE_TRC_DATA;
3717
3718 }else {
3719 fpipemon_trc->fpipemon_trc_hdr.data_passed = 0x01;
3720 sdla_peek(&card->hw, trc_el.offset,
3721 fpipemon_trc->data,
3722 trc_el.length);
3723 }
3724
3725 trc_el.flag = 0x00;
3726 sdla_poke(&card->hw, (unsigned long)ptr_trc_el,
3727 &trc_el.flag, 1);
3728
3729 ptr_trc_el ++;
3730 if((void *)ptr_trc_el > card->u.f.trc_el_last)
3731 ptr_trc_el = (void*)card->u.f.trc_el_base;
3732
3733 buffer_length += sizeof(fpipemon_trc_hdr_t);
3734 if(fpipemon_trc->fpipemon_trc_hdr.data_passed) {
3735 buffer_length += trc_el.length;
3736 }
3737
3738 if(fr_udp_pkt->data[0x00] & MORE_TRC_DATA) {
3739 break;
3740 }
3741 }
3742
3743 if(frames == MAX_FRMS_TRACED) {
3744 fr_udp_pkt->data[0x00] |= MORE_TRC_DATA;
3745 }
3746
3747 card->u.f.curr_trc_el = (void *)ptr_trc_el;
3748
3749 /* set the total number of frames passed */
3750 fr_udp_pkt->data[0x00] |=
3751 ((frames << 1) & (MAX_FRMS_TRACED << 1));
3752
3753 /* set the data length and return code */
3754 fr_udp_pkt->cblock.length = mbox->cmd.length = buffer_length;
3755 fr_udp_pkt->cblock.result = 0;
3756 break;
3757
3758 case FPIPE_FT1_READ_STATUS:
3759 sdla_peek(&card->hw, 0xF020,
3760 &fr_udp_pkt->data[0x00] , 2);
3761 fr_udp_pkt->cblock.length = mbox->cmd.length = 2;
3762 fr_udp_pkt->cblock.result = 0;
3763 break;
3764
3765 case FPIPE_FLUSH_DRIVER_STATS:
3766 init_chan_statistics(chan);
3767 init_global_statistics(card);
3768 mbox->cmd.length = 0;
3769 break;
3770
3771 case FPIPE_ROUTER_UP_TIME:
3772 do_gettimeofday(&tv);
3773 chan->router_up_time = tv.tv_sec -
3774 chan->router_start_time;
3775 *(unsigned long *)&fr_udp_pkt->data =
3776 chan->router_up_time;
3777 mbox->cmd.length = fr_udp_pkt->cblock.length = 4;
3778 fr_udp_pkt->cblock.result = 0;
3779 break;
3780
3781 case FPIPE_DRIVER_STAT_IFSEND:
3782 memcpy(fr_udp_pkt->data,
3783 &chan->drvstats_if_send.if_send_entry,
3784 sizeof(if_send_stat_t));
3785 mbox->cmd.length = fr_udp_pkt->cblock.length =sizeof(if_send_stat_t);
3786 fr_udp_pkt->cblock.result = 0;
3787 break;
3788
3789 case FPIPE_DRIVER_STAT_INTR:
3790
3791 memcpy(fr_udp_pkt->data,
3792 &card->statistics.isr_entry,
3793 sizeof(global_stats_t));
3794
3795 memcpy(&fr_udp_pkt->data[sizeof(global_stats_t)],
3796 &chan->drvstats_rx_intr.rx_intr_no_socket,
3797 sizeof(rx_intr_stat_t));
3798
3799 mbox->cmd.length = fr_udp_pkt->cblock.length =
3800 sizeof(global_stats_t) +
3801 sizeof(rx_intr_stat_t);
3802 fr_udp_pkt->cblock.result = 0;
3803 break;
3804
3805 case FPIPE_DRIVER_STAT_GEN:
3806 memcpy(fr_udp_pkt->data,
3807 &chan->drvstats_gen.UDP_PIPE_mgmt_kmalloc_err,
3808 sizeof(pipe_mgmt_stat_t));
3809
3810 memcpy(&fr_udp_pkt->data[sizeof(pipe_mgmt_stat_t)],
3811 &card->statistics, sizeof(global_stats_t));
3812
3813 mbox->cmd.length = fr_udp_pkt->cblock.length = sizeof(global_stats_t)+
3814 sizeof(rx_intr_stat_t);
3815 fr_udp_pkt->cblock.result = 0;
3816 break;
3817
3818
3819 case FR_FT1_STATUS_CTRL:
3820 if(fr_udp_pkt->data[0] == 1) {
3821 if(rCount++ != 0 ){
3822 fr_udp_pkt->cblock.result = 0;
3823 mbox->cmd.length = 1;
3824 break;
3825 }
3826 }
3827
3828 /* Disable FT1 MONITOR STATUS */
3829 if(fr_udp_pkt->data[0] == 0) {
3830 if( --rCount != 0) {
3831 fr_udp_pkt->cblock.result = 0;
3832 mbox->cmd.length = 1;
3833 break;
3834 }
3835 }
3836 goto udp_mgmt_dflt;
3837
3838
3839 default:
3840udp_mgmt_dflt:
3841 do {
3842 memcpy(&mbox->cmd,
3843 &fr_udp_pkt->cblock.command,
3844 sizeof(fr_cmd_t));
3845 if(mbox->cmd.length) {
3846 memcpy(&mbox->data,
3847 (char *)fr_udp_pkt->data,
3848 mbox->cmd.length);
3849 }
3850
3851 err = sdla_exec(mbox) ? mbox->cmd.result :
3852 CMD_TIMEOUT;
3853 } while (err && c_retry-- && fr_event(card, err, mbox));
3854
3855 if(!err)
3856 chan->drvstats_gen.
3857 UDP_PIPE_mgmt_adptr_cmnd_OK ++;
3858 else
3859 chan->drvstats_gen.
3860 UDP_PIPE_mgmt_adptr_cmnd_timeout ++;
3861
3862 /* copy the result back to our buffer */
3863 memcpy(&fr_udp_pkt->cblock.command,
3864 &mbox->cmd, sizeof(fr_cmd_t));
3865
3866 if(mbox->cmd.length) {
3867 memcpy(&fr_udp_pkt->data,
3868 &mbox->data, mbox->cmd.length);
3869 }
3870 }
3871 }
3872
3873 /* Fill UDP TTL */
3874 fr_udp_pkt->ip_pkt.ttl = card->wandev.ttl;
3875 len = reply_udp(card->u.f.udp_pkt_data, mbox->cmd.length);
3876
3877 if(udp_pkt_src == UDP_PKT_FRM_NETWORK) {
3878
3879 chan->fr_header_len=2;
3880 chan->fr_header[0]=Q922_UI;
3881 chan->fr_header[1]=NLPID_IP;
3882
3883 err = fr_send_data_header(card, dlci, 0, len,
3884 card->u.f.udp_pkt_data,chan->fr_header_len);
3885 if (err){
3886 chan->drvstats_gen.UDP_PIPE_mgmt_adptr_send_passed ++;
3887 }else{
3888 chan->drvstats_gen.UDP_PIPE_mgmt_adptr_send_failed ++;
3889 }
3890
3891 } else {
3892 /* Allocate socket buffer */
3893 if((new_skb = dev_alloc_skb(len)) != NULL) {
3894
3895 /* copy data into new_skb */
3896 buf = skb_put(new_skb, len);
3897 memcpy(buf, card->u.f.udp_pkt_data, len);
3898
3899 chan->drvstats_gen.
3900 UDP_PIPE_mgmt_passed_to_stack ++;
3901 new_skb->dev = dev;
3902 new_skb->protocol = htons(ETH_P_IP);
3903 new_skb->mac.raw = new_skb->data;
3904 netif_rx(new_skb);
3905
3906 } else {
3907 chan->drvstats_gen.UDP_PIPE_mgmt_no_socket ++;
3908 printk(KERN_INFO
3909 "%s: UDP mgmt cmnd, no socket buffers available!\n",
3910 card->devname);
3911 }
3912 }
3913
3914 card->u.f.udp_pkt_lgth = 0;
3915
3916 return 1;
3917}
3918
3919/*==============================================================================
3920 * Send Inverse ARP Request
3921 */
3922
3923int send_inarp_request(sdla_t *card, struct net_device *dev)
3924{
3925 int err=0;
3926
3927 arphdr_1490_t *ArpPacket;
3928 arphdr_fr_t *arphdr;
3929 fr_channel_t *chan = dev->priv;
3930 struct in_device *in_dev;
3931
3932 in_dev = dev->ip_ptr;
3933
3934 if(in_dev != NULL ) {
3935
3936 ArpPacket = kmalloc(sizeof(arphdr_1490_t) + sizeof(arphdr_fr_t), GFP_ATOMIC);
3937 /* SNAP Header indicating ARP */
3938 ArpPacket->control = 0x03;
3939 ArpPacket->pad = 0x00;
3940 ArpPacket->NLPID = 0x80;
3941 ArpPacket->OUI[0] = 0;
3942 ArpPacket->OUI[1] = 0;
3943 ArpPacket->OUI[2] = 0;
3944 ArpPacket->PID = 0x0608;
3945
3946 arphdr = (arphdr_fr_t *)(ArpPacket + 1); // Go to ARP Packet
3947
3948 /* InARP request */
3949 arphdr->ar_hrd = 0x0F00; /* Frame Relay HW type */
3950 arphdr->ar_pro = 0x0008; /* IP Protocol */
3951 arphdr->ar_hln = 2; /* HW addr length */
3952 arphdr->ar_pln = 4; /* IP addr length */
3953 arphdr->ar_op = htons(0x08); /* InARP Request */
3954 arphdr->ar_sha = 0; /* src HW DLCI - Doesn't matter */
3955 if(in_dev->ifa_list != NULL)
3956 arphdr->ar_sip = in_dev->ifa_list->ifa_local; /* Local Address */else
3957 arphdr->ar_sip = 0;
3958 arphdr->ar_tha = 0; /* dst HW DLCI - Doesn't matter */
3959 arphdr->ar_tip = 0; /* Remote Address -- what we want */
3960
3961 err = fr_send(card, chan->dlci, 0, sizeof(arphdr_1490_t) + sizeof(arphdr_fr_t),
3962 (void *)ArpPacket);
3963
3964 if (!err){
3965 printk(KERN_INFO "\n%s: Sending InARP request on DLCI %d.\n",
3966 card->devname, chan->dlci);
3967 clear_bit(ARP_CRIT,&card->wandev.critical);
3968 }
3969
3970 kfree(ArpPacket);
3971 }else{
3972 printk(KERN_INFO "%s: INARP ERROR: %s doesn't have a local IP address!\n",
3973 card->devname,dev->name);
3974 return 1;
3975 }
3976
3977 return 0;
3978}
3979
3980
3981/*==============================================================================
3982 * Check packet for ARP Type
3983 */
3984
3985int is_arp(void *buf)
3986{
3987 arphdr_1490_t *arphdr = (arphdr_1490_t *)buf;
3988
3989 if (arphdr->pad == 0x00 &&
3990 arphdr->NLPID == 0x80 &&
3991 arphdr->PID == 0x0608)
3992 return 1;
3993 else return 0;
3994}
3995
3996/*==============================================================================
3997 * Process ARP Packet Type
3998 */
3999
4000int process_ARP(arphdr_1490_t *ArpPacket, sdla_t *card, struct net_device* dev)
4001{
4002
4003
4004 arphdr_fr_t *arphdr = (arphdr_fr_t *)(ArpPacket + 1); /* Skip header */
4005 fr_rx_buf_ctl_t* frbuf = card->rxmb;
4006 struct in_device *in_dev;
4007 fr_channel_t *chan = dev->priv;
4008
4009 /* Before we transmit ARP packet, we must check
4010 * to see that we are not currently transmitting a
4011 * frame (in 'if_send()') and that we are not
4012 * already in a 'delayed transmit' state. */
4013 if (check_tx_status(card,dev)){
4014 if (net_ratelimit()){
4015 printk(KERN_INFO "%s: Disabling comminication to process ARP\n",
4016 card->devname);
4017 }
4018 set_bit(ARP_CRIT,&card->wandev.critical);
4019 return 0;
4020 }
4021
4022 in_dev = dev->ip_ptr;
4023
4024 /* Check that IP addresses exist for our network address */
4025 if (in_dev == NULL || in_dev->ifa_list == NULL)
4026 return -1;
4027
4028 switch (ntohs(arphdr->ar_op)) {
4029
4030 case 0x08: // Inverse ARP request -- Send Reply, add route.
4031
4032 /* Check for valid Address */
4033 printk(KERN_INFO "%s: Recvd PtP addr -InArp Req: %u.%u.%u.%u\n",
4034 card->devname, NIPQUAD(arphdr->ar_sip));
4035
4036
4037 /* Check that the network address is the same as ours, only
4038 * if the netowrk mask is not 255.255.255.255. Otherwise
4039 * this check would not make sense */
4040
4041 if (in_dev->ifa_list->ifa_mask != 0xFFFFFFFF &&
4042 (in_dev->ifa_list->ifa_mask & arphdr->ar_sip) !=
4043 (in_dev->ifa_list->ifa_mask & in_dev->ifa_list->ifa_local)){
4044 printk(KERN_INFO
4045 "%s: Invalid PtP address. %u.%u.%u.%u InARP ignored.\n",
4046 card->devname,NIPQUAD(arphdr->ar_sip));
4047
4048 printk(KERN_INFO "%s: mask %u.%u.%u.%u\n",
4049 card->devname, NIPQUAD(in_dev->ifa_list->ifa_mask));
4050 printk(KERN_INFO "%s: local %u.%u.%u.%u\n",
4051 card->devname,NIPQUAD(in_dev->ifa_list->ifa_local));
4052 return -1;
4053 }
4054
4055 if (in_dev->ifa_list->ifa_local == arphdr->ar_sip){
4056 printk(KERN_INFO
4057 "%s: Local addr = PtP addr. InARP ignored.\n",
4058 card->devname);
4059 return -1;
4060 }
4061
4062 arphdr->ar_op = htons(0x09); /* InARP Reply */
4063
4064 /* Set addresses */
4065 arphdr->ar_tip = arphdr->ar_sip;
4066 arphdr->ar_sip = in_dev->ifa_list->ifa_local;
4067
4068 chan->ip_local = in_dev->ifa_list->ifa_local;
4069 chan->ip_remote = arphdr->ar_sip;
4070
4071 fr_send(card, frbuf->dlci, 0, frbuf->length, (void *)ArpPacket);
4072
4073 if (test_bit(ARP_CRIT,&card->wandev.critical)){
4074 if (net_ratelimit()){
4075 printk(KERN_INFO "%s: ARP Processed Enabling Communication!\n",
4076 card->devname);
4077 }
4078 }
4079 clear_bit(ARP_CRIT,&card->wandev.critical);
4080
4081 chan->ip_local = in_dev->ifa_list->ifa_local;
4082 chan->ip_remote = arphdr->ar_sip;
4083
4084 /* Add Route Flag */
4085 /* The route will be added in the polling routine so
4086 that it is not interrupt context. */
4087
4088 chan->route_flag = ADD_ROUTE;
4089 trigger_fr_poll (dev);
4090
4091 break;
4092
4093 case 0x09: // Inverse ARP reply
4094
4095 /* Check for valid Address */
4096 printk(KERN_INFO "%s: Recvd PtP addr %u.%u.%u.%u -InArp Reply\n",
4097 card->devname, NIPQUAD(arphdr->ar_sip));
4098
4099
4100 /* Compare network addresses, only if network mask
4101 * is not 255.255.255.255 It would not make sense
4102 * to perform this test if the mask was all 1's */
4103
4104 if (in_dev->ifa_list->ifa_mask != 0xffffffff &&
4105 (in_dev->ifa_list->ifa_mask & arphdr->ar_sip) !=
4106 (in_dev->ifa_list->ifa_mask & in_dev->ifa_list->ifa_local)) {
4107
4108 printk(KERN_INFO "%s: Invalid PtP address. InARP ignored.\n",
4109 card->devname);
4110 return -1;
4111 }
4112
4113 /* Make sure that the received IP address is not
4114 * the same as our own local address */
4115 if (in_dev->ifa_list->ifa_local == arphdr->ar_sip) {
4116 printk(KERN_INFO "%s: Local addr = PtP addr. InARP ignored.\n",
4117 card->devname);
4118 return -1;
4119 }
4120
4121 chan->ip_local = in_dev->ifa_list->ifa_local;
4122 chan->ip_remote = arphdr->ar_sip;
4123
4124 /* Add Route Flag */
4125 /* The route will be added in the polling routine so
4126 that it is not interrupt context. */
4127
4128 chan->route_flag = ADD_ROUTE;
4129 chan->inarp = INARP_CONFIGURED;
4130 trigger_fr_poll(dev);
4131
4132 break;
4133 default:
4134 break; // ARP's and RARP's -- Shouldn't happen.
4135 }
4136
4137 return 0;
4138}
4139
4140
4141/*============================================================
4142 * trigger_fr_arp
4143 *
4144 * Description:
4145 * Add an fr_arp() task into a arp
4146 * timer handler for a specific dlci/interface.
4147 * This will kick the fr_arp() routine
4148 * within the specified time interval.
4149 *
4150 * Usage:
4151 * This timer is used to send ARP requests at
4152 * certain time intervals.
4153 * Called by an interrupt to request an action
4154 * at a later date.
4155 */
4156
4157static void trigger_fr_arp(struct net_device *dev)
4158{
4159 fr_channel_t* chan = dev->priv;
4160
4161 mod_timer(&chan->fr_arp_timer, jiffies + chan->inarp_interval * HZ);
4162 return;
4163}
4164
4165
4166
4167/*==============================================================================
4168 * ARP Request Action
4169 *
4170 * This funciton is called by timer interrupt to send an arp request
4171 * to the remote end.
4172 */
4173
4174static void fr_arp (unsigned long data)
4175{
4176 struct net_device *dev = (struct net_device *)data;
4177 fr_channel_t *chan = dev->priv;
4178 volatile sdla_t *card = chan->card;
4179 fr508_flags_t* flags = card->flags;
4180
4181 /* Send ARP packets for all devs' until
4182 * ARP state changes to CONFIGURED */
4183
4184 if (chan->inarp == INARP_REQUEST &&
4185 chan->common.state == WAN_CONNECTED &&
4186 card->wandev.state == WAN_CONNECTED){
4187 set_bit(0,&chan->inarp_ready);
4188 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_ARP;
4189 flags->imask |= FR_INTR_TIMER;
4190 }
4191
4192 return;
4193}
4194
4195
4196/*==============================================================================
4197 * Perform the Interrupt Test by running the READ_CODE_VERSION command MAX_INTR_
4198 * TEST_COUNTER times.
4199 */
4200static int intr_test( sdla_t* card )
4201{
4202 fr_mbox_t* mb = card->mbox;
4203 int err,i;
4204
4205 err = fr_set_intr_mode(card, FR_INTR_READY, card->wandev.mtu, 0 );
4206
4207 if (err == CMD_OK) {
4208
4209 for ( i = 0; i < MAX_INTR_TEST_COUNTER; i++ ) {
4210 /* Run command READ_CODE_VERSION */
4211 mb->cmd.length = 0;
4212 mb->cmd.command = FR_READ_CODE_VERSION;
4213 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
4214 if (err != CMD_OK)
4215 fr_event(card, err, mb);
4216 }
4217
4218 } else {
4219 return err;
4220 }
4221
4222 err = fr_set_intr_mode( card, 0, card->wandev.mtu, 0 );
4223
4224 if( err != CMD_OK )
4225 return err;
4226
4227 return 0;
4228}
4229
4230/*==============================================================================
4231 * Determine what type of UDP call it is. FPIPE8ND ?
4232 */
4233static int udp_pkt_type( struct sk_buff *skb, sdla_t* card )
4234{
4235 fr_udp_pkt_t *fr_udp_pkt = (fr_udp_pkt_t *)skb->data;
4236
4237 /* Quick HACK */
4238
4239
4240 if((fr_udp_pkt->ip_pkt.protocol == UDPMGMT_UDP_PROTOCOL) &&
4241 (fr_udp_pkt->ip_pkt.ver_inet_hdr_length == 0x45) &&
4242 (fr_udp_pkt->udp_pkt.udp_dst_port ==
4243 ntohs(card->wandev.udp_port)) &&
4244 (fr_udp_pkt->wp_mgmt.request_reply ==
4245 UDPMGMT_REQUEST)) {
4246 if(!strncmp(fr_udp_pkt->wp_mgmt.signature,
4247 UDPMGMT_FPIPE_SIGNATURE, 8)){
4248 return UDP_FPIPE_TYPE;
4249 }
4250 }
4251 return UDP_INVALID_TYPE;
4252}
4253
4254
4255/*==============================================================================
4256 * Initializes the Statistics values in the fr_channel structure.
4257 */
4258void init_chan_statistics( fr_channel_t* chan)
4259{
4260 memset(&chan->drvstats_if_send.if_send_entry, 0,
4261 sizeof(if_send_stat_t));
4262 memset(&chan->drvstats_rx_intr.rx_intr_no_socket, 0,
4263 sizeof(rx_intr_stat_t));
4264 memset(&chan->drvstats_gen.UDP_PIPE_mgmt_kmalloc_err, 0,
4265 sizeof(pipe_mgmt_stat_t));
4266}
4267
4268/*==============================================================================
4269 * Initializes the Statistics values in the Sdla_t structure.
4270 */
4271void init_global_statistics( sdla_t* card )
4272{
4273 /* Intialize global statistics for a card */
4274 memset(&card->statistics.isr_entry, 0, sizeof(global_stats_t));
4275}
4276
4277static void read_DLCI_IB_mapping( sdla_t* card, fr_channel_t* chan )
4278{
4279 fr_mbox_t* mbox = card->mbox;
4280 int retry = MAX_CMD_RETRY;
4281 dlci_IB_mapping_t* result;
4282 int err, counter, found;
4283
4284 do {
4285 mbox->cmd.command = FR_READ_DLCI_IB_MAPPING;
4286 mbox->cmd.length = 0;
4287 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4288 } while (err && retry-- && fr_event(card, err, mbox));
4289
4290 if( mbox->cmd.result != 0){
4291 printk(KERN_INFO "%s: Read DLCI IB Mapping failed\n",
4292 chan->name);
4293 }
4294
4295 counter = mbox->cmd.length / sizeof(dlci_IB_mapping_t);
4296 result = (void *)mbox->data;
4297
4298 found = 0;
4299 for (; counter; --counter, ++result) {
4300 if ( result->dlci == chan->dlci ) {
4301 chan->IB_addr = result->addr_value;
4302 if(card->hw.type == SDLA_S514){
4303 chan->dlci_int_interface =
4304 (void*)(card->hw.dpmbase +
4305 chan->IB_addr);
4306 }else{
4307 chan->dlci_int_interface =
4308 (void*)(card->hw.dpmbase +
4309 (chan->IB_addr & 0x00001FFF));
4310
4311 }
4312 found = 1;
4313 break;
4314 }
4315 }
4316 if (!found)
4317 printk( KERN_INFO "%s: DLCI %d not found by IB MAPPING cmd\n",
4318 card->devname, chan->dlci);
4319}
4320
4321
4322
4323void s508_s514_lock(sdla_t *card, unsigned long *smp_flags)
4324{
4325 if (card->hw.type != SDLA_S514){
4326
4327 spin_lock_irqsave(&card->wandev.lock, *smp_flags);
4328 }else{
4329 spin_lock(&card->u.f.if_send_lock);
4330 }
4331 return;
4332}
4333
4334
4335void s508_s514_unlock(sdla_t *card, unsigned long *smp_flags)
4336{
4337 if (card->hw.type != SDLA_S514){
4338
4339 spin_unlock_irqrestore (&card->wandev.lock, *smp_flags);
4340 }else{
4341 spin_unlock(&card->u.f.if_send_lock);
4342 }
4343 return;
4344}
4345
4346
4347
4348/*----------------------------------------------------------------------
4349 RECEIVE INTERRUPT: BOTTOM HALF HANDLERS
4350 ----------------------------------------------------------------------*/
4351
4352
4353/*========================================================
4354 * bh_enqueue
4355 *
4356 * Description:
4357 * Insert a received packet into a circular
4358 * rx queue. This packet will be picked up
4359 * by fr_bh() and sent up the stack to the
4360 * user.
4361 *
4362 * Usage:
4363 * This function is called by rx interrupt,
4364 * in API mode.
4365 *
4366 */
4367
4368static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
4369{
4370 /* Check for full */
4371 fr_channel_t* chan = dev->priv;
4372 sdla_t *card = chan->card;
4373
4374
4375 if (atomic_read(&chan->bh_buff_used) == MAX_BH_BUFF){
4376 ++card->wandev.stats.rx_dropped;
4377 dev_kfree_skb_any(skb);
4378 return 1;
4379 }
4380
4381 ((bh_data_t *)&chan->bh_head[chan->bh_write])->skb = skb;
4382
4383 if (chan->bh_write == (MAX_BH_BUFF-1)){
4384 chan->bh_write=0;
4385 }else{
4386 ++chan->bh_write;
4387 }
4388
4389 atomic_inc(&chan->bh_buff_used);
4390
4391 return 0;
4392}
4393
4394
4395/*========================================================
4396 * trigger_fr_bh
4397 *
4398 * Description:
4399 * Kick the fr_bh() handler
4400 *
4401 * Usage:
4402 * rx interrupt calls this function during
4403 * the API mode.
4404 */
4405
4406static void trigger_fr_bh (fr_channel_t *chan)
4407{
4408 if (!test_and_set_bit(0,&chan->tq_working)){
4409 wanpipe_queue_work(&chan->common.wanpipe_work);
4410 }
4411}
4412
4413
4414/*========================================================
4415 * fr_bh
4416 *
4417 * Description:
4418 * Frame relay receive BH handler.
4419 * Dequeue data from the BH circular
4420 * buffer and pass it up the API sock.
4421 *
4422 * Rationale:
4423 * This fuction is used to offload the
4424 * rx_interrupt during API operation mode.
4425 * The fr_bh() function executes for each
4426 * dlci/interface.
4427 *
4428 * Once receive interrupt copies data from the
4429 * card into an skb buffer, the skb buffer
4430 * is appended to a circular BH buffer.
4431 * Then the interrupt kicks fr_bh() to finish the
4432 * job at a later time (not within the interrupt).
4433 *
4434 * Usage:
4435 * Interrupts use this to defer a task to
4436 * a polling routine.
4437 *
4438 */
4439
4440static void fr_bh(struct net_device * dev)
4441{
4442 fr_channel_t* chan = dev->priv;
4443 sdla_t *card = chan->card;
4444 struct sk_buff *skb;
4445
4446 if (atomic_read(&chan->bh_buff_used) == 0){
4447 clear_bit(0, &chan->tq_working);
4448 return;
4449 }
4450
4451 while (atomic_read(&chan->bh_buff_used)){
4452
4453 if (chan->common.sk == NULL || chan->common.func == NULL){
4454 clear_bit(0, &chan->tq_working);
4455 return;
4456 }
4457
4458 skb = ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb;
4459
4460 if (skb != NULL){
4461
4462 if (chan->common.sk == NULL || chan->common.func == NULL){
4463 ++card->wandev.stats.rx_dropped;
4464 ++chan->ifstats.rx_dropped;
4465 dev_kfree_skb_any(skb);
4466 fr_bh_cleanup(dev);
4467 continue;
4468 }
4469
4470 if (chan->common.func(skb,dev,chan->common.sk) != 0){
4471 /* Sock full cannot send, queue us for
4472 * another try */
4473 atomic_set(&chan->common.receive_block,1);
4474 return;
4475 }else{
4476 fr_bh_cleanup(dev);
4477 }
4478 }else{
4479 fr_bh_cleanup(dev);
4480 }
4481 }
4482 clear_bit(0, &chan->tq_working);
4483
4484 return;
4485}
4486
4487static int fr_bh_cleanup(struct net_device *dev)
4488{
4489 fr_channel_t* chan = dev->priv;
4490
4491 ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb = NULL;
4492
4493 if (chan->bh_read == (MAX_BH_BUFF-1)){
4494 chan->bh_read=0;
4495 }else{
4496 ++chan->bh_read;
4497 }
4498
4499 atomic_dec(&chan->bh_buff_used);
4500 return 0;
4501}
4502
4503
4504/*----------------------------------------------------------------------
4505 POLL BH HANDLERS AND KICK ROUTINES
4506 ----------------------------------------------------------------------*/
4507
4508/*============================================================
4509 * trigger_fr_poll
4510 *
4511 * Description:
4512 * Add a fr_poll() task into a tq_scheduler bh handler
4513 * for a specific dlci/interface. This will kick
4514 * the fr_poll() routine at a later time.
4515 *
4516 * Usage:
4517 * Interrupts use this to defer a taks to
4518 * a polling routine.
4519 *
4520 */
4521static void trigger_fr_poll(struct net_device *dev)
4522{
4523 fr_channel_t* chan = dev->priv;
4524 schedule_work(&chan->fr_poll_work);
4525 return;
4526}
4527
4528
4529/*============================================================
4530 * fr_poll
4531 *
4532 * Rationale:
4533 * We cannot manipulate the routing tables, or
4534 * ip addresses withing the interrupt. Therefore
4535 * we must perform such actons outside an interrupt
4536 * at a later time.
4537 *
4538 * Description:
4539 * Frame relay polling routine, responsible for
4540 * shutting down interfaces upon disconnect
4541 * and adding/removing routes.
4542 *
4543 * Usage:
4544 * This function is executed for each frame relay
4545 * dlci/interface through a tq_schedule bottom half.
4546 *
4547 * trigger_fr_poll() function is used to kick
4548 * the fr_poll routine.
4549 */
4550
4551static void fr_poll(struct net_device *dev)
4552{
4553
4554 fr_channel_t* chan;
4555 sdla_t *card;
4556 u8 check_gateway=0;
4557
4558 if (!dev || (chan = dev->priv) == NULL)
4559 return;
4560
4561 card = chan->card;
4562
4563 /* (Re)Configuraiton is in progress, stop what you are
4564 * doing and get out */
4565 if (test_bit(PERI_CRIT,&card->wandev.critical)){
4566 return;
4567 }
4568
4569 switch (chan->common.state){
4570
4571 case WAN_DISCONNECTED:
4572
4573 if (test_bit(DYN_OPT_ON,&chan->interface_down) &&
4574 !test_bit(DEV_DOWN, &chan->interface_down) &&
4575 dev->flags&IFF_UP){
4576
4577 printk(KERN_INFO "%s: Interface %s is Down.\n",
4578 card->devname,dev->name);
4579 change_dev_flags(dev,dev->flags&~IFF_UP);
4580 set_bit(DEV_DOWN, &chan->interface_down);
4581 chan->route_flag = NO_ROUTE;
4582
4583 }else{
4584 if (chan->inarp != INARP_NONE)
4585 process_route(dev);
4586 }
4587 break;
4588
4589 case WAN_CONNECTED:
4590
4591 if (test_bit(DYN_OPT_ON,&chan->interface_down) &&
4592 test_bit(DEV_DOWN, &chan->interface_down) &&
4593 !(dev->flags&IFF_UP)){
4594
4595 printk(KERN_INFO "%s: Interface %s is Up.\n",
4596 card->devname,dev->name);
4597
4598 change_dev_flags(dev,dev->flags|IFF_UP);
4599 clear_bit(DEV_DOWN, &chan->interface_down);
4600 check_gateway=1;
4601 }
4602
4603 if (chan->inarp != INARP_NONE){
4604 process_route(dev);
4605 check_gateway=1;
4606 }
4607
4608 if (chan->gateway && check_gateway)
4609 add_gateway(card,dev);
4610
4611 break;
4612
4613 }
4614
4615 return;
4616}
4617
4618/*==============================================================
4619 * check_tx_status
4620 *
4621 * Rationale:
4622 * We cannot transmit from an interrupt while
4623 * the if_send is transmitting data. Therefore,
4624 * we must check whether the tx buffers are
4625 * begin used, before we transmit from an
4626 * interrupt.
4627 *
4628 * Description:
4629 * Checks whether it's safe to use the transmit
4630 * buffers.
4631 *
4632 * Usage:
4633 * ARP and UDP handling routines use this function
4634 * because, they need to transmit data during
4635 * an interrupt.
4636 */
4637
4638static int check_tx_status(sdla_t *card, struct net_device *dev)
4639{
4640
4641 if (card->hw.type == SDLA_S514){
4642 if (test_bit(SEND_CRIT, (void*)&card->wandev.critical) ||
4643 test_bit(SEND_TXIRQ_CRIT, (void*)&card->wandev.critical)) {
4644 return 1;
4645 }
4646 }
4647
4648 if (netif_queue_stopped(dev) || (card->u.f.tx_interrupts_pending))
4649 return 1;
4650
4651 return 0;
4652}
4653
4654/*===============================================================
4655 * move_dev_to_next
4656 *
4657 * Description:
4658 * Move the dev pointer to the next location in the
4659 * link list. Check if we are at the end of the
4660 * list, if so start from the begining.
4661 *
4662 * Usage:
4663 * Timer interrupt uses this function to efficiently
4664 * step through the devices that need to send ARP data.
4665 *
4666 */
4667
4668struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev)
4669{
4670 if (card->wandev.new_if_cnt != 1){
4671 if (!*((struct net_device **)dev->priv))
4672 return card->wandev.dev;
4673 else
4674 return *((struct net_device **)dev->priv);
4675 }
4676 return dev;
4677}
4678
4679/*==============================================================
4680 * trigger_config_fr
4681 *
4682 * Rationale:
4683 * All commands must be performed inside of a
4684 * interrupt.
4685 *
4686 * Description:
4687 * Kick the config_fr() routine throught the
4688 * timer interrupt.
4689 */
4690
4691
4692static void trigger_config_fr (sdla_t *card)
4693{
4694 fr508_flags_t* flags = card->flags;
4695
4696 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_CONFIG;
4697 flags->imask |= FR_INTR_TIMER;
4698}
4699
4700
4701/*==============================================================
4702 * config_fr
4703 *
4704 * Rationale:
4705 * All commands must be performed inside of a
4706 * interrupt.
4707 &
4708 * Description:
4709 * Configure a DLCI. This function is executed
4710 * by a timer_interrupt. The if_open() function
4711 * triggers it.
4712 *
4713 * Usage:
4714 * new_if() collects all data necessary to
4715 * configure the DLCI. It sets the chan->dlci_ready
4716 * bit. When the if_open() function is executed
4717 * it checks this bit, and if its set it triggers
4718 * the timer interrupt to execute the config_fr()
4719 * function.
4720 */
4721
4722static void config_fr (sdla_t *card)
4723{
4724 struct net_device *dev;
4725 fr_channel_t *chan;
4726
4727 for (dev = card->wandev.dev; dev;
4728 dev = *((struct net_device **)dev->priv)) {
4729
4730 if ((chan=dev->priv) == NULL)
4731 continue;
4732
4733 if (!test_bit(0,&chan->config_dlci))
4734 continue;
4735
4736 clear_bit(0,&chan->config_dlci);
4737
4738 /* If signalling is set to NO, then setup
4739 * DLCI addresses right away. Don't have to wait for
4740 * link to connect.
4741 */
4742 if (card->wandev.signalling == WANOPT_NO){
4743 printk(KERN_INFO "%s: Signalling set to NO: Mapping DLCI's\n",
4744 card->wandev.name);
4745 if (fr_init_dlci(card,chan)){
4746 printk(KERN_INFO "%s: ERROR: Failed to configure DLCI %i !\n",
4747 card->devname, chan->dlci);
4748 return;
4749 }
4750 }
4751
4752 if (card->wandev.station == WANOPT_CPE) {
4753
4754 update_chan_state(dev);
4755
4756 /* CPE: issue full status enquiry */
4757 fr_issue_isf(card, FR_ISF_FSE);
4758
4759 } else {
4760 /* FR switch: activate DLCI(s) */
4761
4762 /* For Switch emulation we have to ADD and ACTIVATE
4763 * the DLCI(s) that were configured with the SET_DLCI_
4764 * CONFIGURATION command. Add and Activate will fail if
4765 * DLCI specified is not included in the list.
4766 *
4767 * Also If_open is called once for each interface. But
4768 * it does not get in here for all the interface. So
4769 * we have to pass the entire list of DLCI(s) to add
4770 * activate routines.
4771 */
4772
4773 if (!check_dlci_config (card, chan)){
4774 fr_add_dlci(card, chan->dlci);
4775 fr_activate_dlci(card, chan->dlci);
4776 }
4777 }
4778
4779 card->u.f.dlci_to_dev_map[chan->dlci] = dev;
4780 }
4781 return;
4782}
4783
4784
4785/*==============================================================
4786 * config_fr
4787 *
4788 * Rationale:
4789 * All commands must be executed during an interrupt.
4790 *
4791 * Description:
4792 * Trigger uncofig_fr() function through
4793 * the timer interrupt.
4794 *
4795 */
4796
4797static void trigger_unconfig_fr(struct net_device *dev)
4798{
4799 fr_channel_t *chan = dev->priv;
4800 volatile sdla_t *card = chan->card;
4801 unsigned long timeout;
4802 fr508_flags_t* flags = card->flags;
4803 int reset_critical=0;
4804
4805 if (test_bit(PERI_CRIT,(void*)&card->wandev.critical)){
4806 clear_bit(PERI_CRIT,(void*)&card->wandev.critical);
4807 reset_critical=1;
4808 }
4809
4810 /* run unconfig_dlci() function
4811 * throught the timer interrupt */
4812 set_bit(0,(void*)&chan->unconfig_dlci);
4813 card->u.f.timer_int_enabled |= TMR_INT_ENABLED_UNCONFIG;
4814 flags->imask |= FR_INTR_TIMER;
4815
4816 /* Wait for the command to complete */
4817 timeout = jiffies;
4818 for(;;) {
4819
4820 if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG))
4821 break;
4822
4823 if (time_after(jiffies, timeout + 1 * HZ)){
4824 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
4825 printk(KERN_INFO "%s: Failed to delete DLCI %i\n",
4826 card->devname,chan->dlci);
4827 break;
4828 }
4829 }
4830
4831 if (reset_critical){
4832 set_bit(PERI_CRIT,(void*)&card->wandev.critical);
4833 }
4834}
4835
4836/*==============================================================
4837 * unconfig_fr
4838 *
4839 * Rationale:
4840 * All commands must be executed during an interrupt.
4841 *
4842 * Description:
4843 * Remove the dlci from firmware.
4844 * This funciton is used in NODE shutdown.
4845 */
4846
4847static void unconfig_fr (sdla_t *card)
4848{
4849 struct net_device *dev;
4850 fr_channel_t *chan;
4851
4852 for (dev = card->wandev.dev; dev;
4853 dev = *((struct net_device **)dev->priv)){
4854
4855 if ((chan=dev->priv) == NULL)
4856 continue;
4857
4858 if (!test_bit(0,&chan->unconfig_dlci))
4859 continue;
4860
4861 clear_bit(0,&chan->unconfig_dlci);
4862
4863 if (card->wandev.station == WANOPT_NODE){
4864 printk(KERN_INFO "%s: Unconfiguring DLCI %i\n",
4865 card->devname,chan->dlci);
4866 fr_delete_dlci(card,chan->dlci);
4867 }
4868 card->u.f.dlci_to_dev_map[chan->dlci] = NULL;
4869 }
4870}
4871
4872static int setup_fr_header(struct sk_buff *skb, struct net_device* dev,
4873 char op_mode)
4874{
4875 fr_channel_t *chan=dev->priv;
4876
4877 if (op_mode == WANPIPE) {
4878 chan->fr_header[0]=Q922_UI;
4879
4880 switch (htons(skb->protocol)){
4881 case ETH_P_IP:
4882 chan->fr_header[1]=NLPID_IP;
4883 break;
4884 default:
4885 return -EINVAL;
4886 }
4887
4888 return 2;
4889 }
4890
4891 /* If we are in bridging mode, we must apply
4892 * an Ethernet header
4893 */
4894 if (op_mode == BRIDGE || op_mode == BRIDGE_NODE) {
4895 /* Encapsulate the packet as a bridged Ethernet frame. */
4896#ifdef DEBUG
4897 printk(KERN_INFO "%s: encapsulating skb for frame relay\n",
4898 dev->name);
4899#endif
4900 chan->fr_header[0] = 0x03;
4901 chan->fr_header[1] = 0x00;
4902 chan->fr_header[2] = 0x80;
4903 chan->fr_header[3] = 0x00;
4904 chan->fr_header[4] = 0x80;
4905 chan->fr_header[5] = 0xC2;
4906 chan->fr_header[6] = 0x00;
4907 chan->fr_header[7] = 0x07;
4908
4909 /* Yuck. */
4910 skb->protocol = ETH_P_802_3;
4911 return 8;
4912 }
4913
4914 return 0;
4915}
4916
4917
4918static int check_dlci_config (sdla_t *card, fr_channel_t *chan)
4919{
4920 fr_mbox_t* mbox = card->mbox;
4921 int err=0;
4922 fr_conf_t *conf=NULL;
4923 unsigned short dlci_num = chan->dlci;
4924 int dlci_offset=0;
4925 struct net_device *dev = NULL;
4926
4927 mbox->cmd.command = FR_READ_CONFIG;
4928 mbox->cmd.length = 0;
4929 mbox->cmd.dlci = dlci_num;
4930
4931 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4932
4933 if (err == CMD_OK){
4934 return 0;
4935 }
4936
4937 for (dev = card->wandev.dev; dev;
4938 dev=*((struct net_device **)dev->priv))
4939 set_chan_state(dev,WAN_DISCONNECTED);
4940
4941 printk(KERN_INFO "DLCI %i Not configured, configuring\n",dlci_num);
4942
4943 mbox->cmd.command = FR_COMM_DISABLE;
4944 mbox->cmd.length = 0;
4945 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4946 if (err != CMD_OK){
4947 fr_event(card, err, mbox);
4948 return 2;
4949 }
4950
4951 printk(KERN_INFO "Disabled Communications \n");
4952
4953 mbox->cmd.command = FR_READ_CONFIG;
4954 mbox->cmd.length = 0;
4955 mbox->cmd.dlci = 0;
4956
4957 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4958
4959 if (err != CMD_OK){
4960 fr_event(card, err, mbox);
4961 return 2;
4962 }
4963
4964 conf = (fr_conf_t *)mbox->data;
4965
4966 dlci_offset=0;
4967 for (dev = card->wandev.dev; dev;
4968 dev = *((struct net_device **)dev->priv)) {
4969 fr_channel_t *chan_tmp = dev->priv;
4970 conf->dlci[dlci_offset] = chan_tmp->dlci;
4971 dlci_offset++;
4972 }
4973
4974 printk(KERN_INFO "Got Fr configuration Buffer Length is %x Dlci %i Dlci Off %i\n",
4975 mbox->cmd.length,
4976 mbox->cmd.length > 0x20 ? conf->dlci[0] : -1,
4977 dlci_offset );
4978
4979 mbox->cmd.length = 0x20 + dlci_offset*2;
4980
4981 mbox->cmd.command = FR_SET_CONFIG;
4982 mbox->cmd.dlci = 0;
4983
4984 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4985
4986 if (err != CMD_OK){
4987 fr_event(card, err, mbox);
4988 return 2;
4989 }
4990
4991 initialize_rx_tx_buffers (card);
4992
4993
4994 printk(KERN_INFO "Configuraiton Succeded for new DLCI %i\n",dlci_num);
4995
4996 if (fr_comm_enable (card)){
4997 return 2;
4998 }
4999
5000 printk(KERN_INFO "Enabling Communications \n");
5001
5002 for (dev = card->wandev.dev; dev;
5003 dev = *((struct net_device **)dev->priv)) {
5004 fr_channel_t *chan_tmp = dev->priv;
5005 fr_init_dlci(card,chan_tmp);
5006 fr_add_dlci(card, chan_tmp->dlci);
5007 fr_activate_dlci(card, chan_tmp->dlci);
5008 }
5009
5010 printk(KERN_INFO "END OF CONFIGURAITON %i\n",dlci_num);
5011
5012 return 1;
5013}
5014
5015static void initialize_rx_tx_buffers (sdla_t *card)
5016{
5017 fr_buf_info_t* buf_info;
5018
5019 if (card->hw.type == SDLA_S514) {
5020
5021 buf_info = (void*)(card->hw.dpmbase + FR_MB_VECTOR +
5022 FR508_RXBC_OFFS);
5023
5024 card->rxmb = (void*)(buf_info->rse_next + card->hw.dpmbase);
5025
5026 card->u.f.rxmb_base =
5027 (void*)(buf_info->rse_base + card->hw.dpmbase);
5028
5029 card->u.f.rxmb_last =
5030 (void*)(buf_info->rse_base +
5031 (buf_info->rse_num - 1) * sizeof(fr_rx_buf_ctl_t) +
5032 card->hw.dpmbase);
5033 }else{
5034 buf_info = (void*)(card->hw.dpmbase + FR508_RXBC_OFFS);
5035
5036 card->rxmb = (void*)(buf_info->rse_next -
5037 FR_MB_VECTOR + card->hw.dpmbase);
5038
5039 card->u.f.rxmb_base =
5040 (void*)(buf_info->rse_base -
5041 FR_MB_VECTOR + card->hw.dpmbase);
5042
5043 card->u.f.rxmb_last =
5044 (void*)(buf_info->rse_base +
5045 (buf_info->rse_num - 1) * sizeof(fr_rx_buf_ctl_t) -
5046 FR_MB_VECTOR + card->hw.dpmbase);
5047 }
5048
5049 card->u.f.rx_base = buf_info->buf_base;
5050 card->u.f.rx_top = buf_info->buf_top;
5051
5052 card->u.f.tx_interrupts_pending = 0;
5053
5054 return;
5055}
5056
5057
5058
5059MODULE_LICENSE("GPL");
5060
5061/****** End *****************************************************************/
diff --git a/drivers/net/wan/sdla_ft1.c b/drivers/net/wan/sdla_ft1.c
deleted file mode 100644
index 9d6528a50f7b..000000000000
--- a/drivers/net/wan/sdla_ft1.c
+++ /dev/null
@@ -1,345 +0,0 @@
1/*****************************************************************************
2* sdla_chdlc.c WANPIPE(tm) Multiprotocol WAN Link Driver. Cisco HDLC module.
3*
4* Authors: Nenad Corbic <ncorbic@sangoma.com>
5* Gideon Hack
6*
7* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Sep 30, 1999 Nenad Corbic Fixed dynamic IP and route setup.
15* Sep 23, 1999 Nenad Corbic Added SMP support, fixed tracing
16* Sep 13, 1999 Nenad Corbic Split up Port 0 and 1 into separate devices.
17* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
18* Oct 30, 1998 Jaspreet Singh Added Support for CHDLC API (HDLC STREAMING).
19* Oct 28, 1998 Jaspreet Singh Added Support for Dual Port CHDLC.
20* Aug 07, 1998 David Fong Initial version.
21*****************************************************************************/
22
23#include <linux/module.h>
24#include <linux/kernel.h> /* printk(), and other useful stuff */
25#include <linux/stddef.h> /* offsetof(), etc. */
26#include <linux/errno.h> /* return codes */
27#include <linux/string.h> /* inline memset(), etc. */
28#include <linux/slab.h> /* kmalloc(), kfree() */
29#include <linux/wanrouter.h> /* WAN router definitions */
30#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
31#include <linux/if_arp.h> /* ARPHRD_* defines */
32#include <linux/jiffies.h> /* time_after() macro */
33
34#include <linux/inetdevice.h>
35#include <asm/uaccess.h>
36
37#include <linux/in.h> /* sockaddr_in */
38#include <linux/inet.h>
39#include <linux/if.h>
40#include <asm/byteorder.h> /* htons(), etc. */
41#include <linux/sdlapci.h>
42#include <asm/io.h>
43
44#include <linux/sdla_chdlc.h> /* CHDLC firmware API definitions */
45
46/****** Defines & Macros ****************************************************/
47
48/* reasons for enabling the timer interrupt on the adapter */
49#define TMR_INT_ENABLED_UDP 0x0001
50#define TMR_INT_ENABLED_UPDATE 0x0002
51
52#define CHDLC_DFLT_DATA_LEN 1500 /* default MTU */
53#define CHDLC_HDR_LEN 1
54
55#define IFF_POINTTOPOINT 0x10
56
57#define WANPIPE 0x00
58#define API 0x01
59#define CHDLC_API 0x01
60
61#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" )
62
63
64/******Data Structures*****************************************************/
65
66/* This structure is placed in the private data area of the device structure.
67 * The card structure used to occupy the private area but now the following
68 * structure will incorporate the card structure along with CHDLC specific data
69 */
70
71typedef struct chdlc_private_area
72{
73 struct net_device *slave;
74 sdla_t *card;
75 int TracingEnabled; /* For enabling Tracing */
76 unsigned long curr_trace_addr; /* Used for Tracing */
77 unsigned long start_trace_addr;
78 unsigned long end_trace_addr;
79 unsigned long base_addr_trace_buffer;
80 unsigned long end_addr_trace_buffer;
81 unsigned short number_trace_elements;
82 unsigned available_buffer_space;
83 unsigned long router_start_time;
84 unsigned char route_status;
85 unsigned char route_removed;
86 unsigned long tick_counter; /* For 5s timeout counter */
87 unsigned long router_up_time;
88 u32 IP_address; /* IP addressing */
89 u32 IP_netmask;
90 unsigned char mc; /* Mulitcast support on/off */
91 unsigned short udp_pkt_lgth; /* udp packet processing */
92 char udp_pkt_src;
93 char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
94 unsigned short timer_int_enabled;
95 char update_comms_stats; /* updating comms stats */
96 //FIXME: add driver stats as per frame relay!
97
98} chdlc_private_area_t;
99
100/* Route Status options */
101#define NO_ROUTE 0x00
102#define ADD_ROUTE 0x01
103#define ROUTE_ADDED 0x02
104#define REMOVE_ROUTE 0x03
105
106
107/****** Function Prototypes *************************************************/
108/* WAN link driver entry points. These are called by the WAN router module. */
109static int wpft1_exec (struct sdla *card, void *u_cmd, void *u_data);
110static int chdlc_read_version (sdla_t* card, char* str);
111static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb);
112
113/****** Public Functions ****************************************************/
114
115/*============================================================================
116 * Cisco HDLC protocol initialization routine.
117 *
118 * This routine is called by the main WANPIPE module during setup. At this
119 * point adapter is completely initialized and firmware is running.
120 * o read firmware version (to make sure it's alive)
121 * o configure adapter
122 * o initialize protocol-specific fields of the adapter data space.
123 *
124 * Return: 0 o.k.
125 * < 0 failure.
126 */
127int wpft1_init (sdla_t* card, wandev_conf_t* conf)
128{
129 unsigned char port_num;
130 int err;
131
132 union
133 {
134 char str[80];
135 } u;
136 volatile CHDLC_MAILBOX_STRUCT* mb;
137 CHDLC_MAILBOX_STRUCT* mb1;
138 unsigned long timeout;
139
140 /* Verify configuration ID */
141 if (conf->config_id != WANCONFIG_CHDLC) {
142 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
143 card->devname, conf->config_id);
144 return -EINVAL;
145 }
146
147 /* Use primary port */
148 card->u.c.comm_port = 0;
149
150
151 /* Initialize protocol-specific fields */
152 if(card->hw.type != SDLA_S514){
153 card->mbox = (void *) card->hw.dpmbase;
154 }else{
155 card->mbox = (void *) card->hw.dpmbase + PRI_BASE_ADDR_MB_STRUCT;
156 }
157
158 mb = mb1 = card->mbox;
159
160 if (!card->configured){
161
162 /* The board will place an 'I' in the return code to indicate that it is
163 ready to accept commands. We expect this to be completed in less
164 than 1 second. */
165
166 timeout = jiffies;
167 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
168 if (time_after(jiffies, timeout + 1*HZ)) break;
169
170 if (mb->return_code != 'I') {
171 printk(KERN_INFO
172 "%s: Initialization not completed by adapter\n",
173 card->devname);
174 printk(KERN_INFO "Please contact Sangoma representative.\n");
175 return -EIO;
176 }
177 }
178
179 /* Read firmware version. Note that when adapter initializes, it
180 * clears the mailbox, so it may appear that the first command was
181 * executed successfully when in fact it was merely erased. To work
182 * around this, we execute the first command twice.
183 */
184
185 if (chdlc_read_version(card, u.str))
186 return -EIO;
187
188 printk(KERN_INFO "%s: Running FT1 Configuration firmware v%s\n",
189 card->devname, u.str);
190
191 card->isr = NULL;
192 card->poll = NULL;
193 card->exec = &wpft1_exec;
194 card->wandev.update = NULL;
195 card->wandev.new_if = NULL;
196 card->wandev.del_if = NULL;
197 card->wandev.state = WAN_DUALPORT;
198 card->wandev.udp_port = conf->udp_port;
199
200 card->wandev.new_if_cnt = 0;
201
202 /* This is for the ports link state */
203 card->u.c.state = WAN_DISCONNECTED;
204
205 /* reset the number of times the 'update()' proc has been called */
206 card->u.c.update_call_count = 0;
207
208 card->wandev.ttl = 0x7F;
209 card->wandev.interface = 0;
210
211 card->wandev.clocking = 0;
212
213 port_num = card->u.c.comm_port;
214
215 /* Setup Port Bps */
216
217 card->wandev.bps = 0;
218
219 card->wandev.mtu = MIN_LGTH_CHDLC_DATA_CFG;
220
221 /* Set up the interrupt status area */
222 /* Read the CHDLC Configuration and obtain:
223 * Ptr to shared memory infor struct
224 * Use this pointer to calculate the value of card->u.c.flags !
225 */
226 mb1->buffer_length = 0;
227 mb1->command = READ_CHDLC_CONFIGURATION;
228 err = sdla_exec(mb1) ? mb1->return_code : CMD_TIMEOUT;
229 if(err != COMMAND_OK) {
230 chdlc_error(card, err, mb1);
231 return -EIO;
232 }
233
234 if(card->hw.type == SDLA_S514){
235 card->u.c.flags = (void *)(card->hw.dpmbase +
236 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
237 ptr_shared_mem_info_struct));
238 }else{
239 card->u.c.flags = (void *)(card->hw.dpmbase +
240 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
241 ptr_shared_mem_info_struct % SDLA_WINDOWSIZE));
242 }
243
244 card->wandev.state = WAN_FT1_READY;
245 printk(KERN_INFO "%s: FT1 Config Ready !\n",card->devname);
246
247 return 0;
248}
249
250static int wpft1_exec(sdla_t *card, void *u_cmd, void *u_data)
251{
252 CHDLC_MAILBOX_STRUCT* mbox = card->mbox;
253 int len;
254
255 if (copy_from_user((void*)&mbox->command, u_cmd, sizeof(ft1_exec_cmd_t))){
256 return -EFAULT;
257 }
258
259 len = mbox->buffer_length;
260
261 if (len) {
262 if( copy_from_user((void*)&mbox->data, u_data, len)){
263 return -EFAULT;
264 }
265 }
266
267 /* execute command */
268 if (!sdla_exec(mbox)){
269 return -EIO;
270 }
271
272 /* return result */
273 if( copy_to_user(u_cmd, (void*)&mbox->command, sizeof(ft1_exec_cmd_t))){
274 return -EFAULT;
275 }
276
277 len = mbox->buffer_length;
278
279 if (len && u_data && copy_to_user(u_data, (void*)&mbox->data, len)){
280 return -EFAULT;
281 }
282
283 return 0;
284
285}
286
287/*============================================================================
288 * Read firmware code version.
289 * Put code version as ASCII string in str.
290 */
291static int chdlc_read_version (sdla_t* card, char* str)
292{
293 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
294 int len;
295 char err;
296 mb->buffer_length = 0;
297 mb->command = READ_CHDLC_CODE_VERSION;
298 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
299
300 if(err != COMMAND_OK) {
301 chdlc_error(card,err,mb);
302 }
303 else if (str) { /* is not null */
304 len = mb->buffer_length;
305 memcpy(str, mb->data, len);
306 str[len] = '\0';
307 }
308 return (err);
309}
310
311/*============================================================================
312 * Firmware error handler.
313 * This routine is called whenever firmware command returns non-zero
314 * return code.
315 *
316 * Return zero if previous command has to be cancelled.
317 */
318static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb)
319{
320 unsigned cmd = mb->command;
321
322 switch (err) {
323
324 case CMD_TIMEOUT:
325 printk(KERN_ERR "%s: command 0x%02X timed out!\n",
326 card->devname, cmd);
327 break;
328
329 case S514_BOTH_PORTS_SAME_CLK_MODE:
330 if(cmd == SET_CHDLC_CONFIGURATION) {
331 printk(KERN_INFO
332 "%s: Configure both ports for the same clock source\n",
333 card->devname);
334 break;
335 }
336
337 default:
338 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X!\n",
339 card->devname, cmd, err);
340 }
341
342 return 0;
343}
344
345MODULE_LICENSE("GPL");
diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c
deleted file mode 100644
index a4b489cccbbf..000000000000
--- a/drivers/net/wan/sdla_ppp.c
+++ /dev/null
@@ -1,3430 +0,0 @@
1/*****************************************************************************
2* sdla_ppp.c WANPIPE(tm) Multiprotocol WAN Link Driver. PPP module.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Feb 28, 2001 Nenad Corbic o Updated if_tx_timeout() routine for
14* 2.4.X kernels.
15* Nov 29, 2000 Nenad Corbic o Added the 2.4.x kernel support:
16* get_ip_address() function has moved
17* into the ppp_poll() routine. It cannot
18* be called from an interrupt.
19* Nov 07, 2000 Nenad Corbic o Added security features for UDP debugging:
20* Deny all and specify allowed requests.
21* May 02, 2000 Nenad Corbic o Added the dynamic interface shutdown
22* option. When the link goes down, the
23* network interface IFF_UP flag is reset.
24* Mar 06, 2000 Nenad Corbic o Bug Fix: corrupted mbox recovery.
25* Feb 25, 2000 Nenad Corbic o Fixed the FT1 UDP debugger problem.
26* Feb 09, 2000 Nenad Coribc o Shutdown bug fix. update() was called
27* with NULL dev pointer: no check.
28* Jan 24, 2000 Nenad Corbic o Disabled use of CMD complete inter.
29* Dev 15, 1999 Nenad Corbic o Fixed up header files for 2.0.X kernels
30* Oct 25, 1999 Nenad Corbic o Support for 2.0.X kernels
31* Moved dynamic route processing into
32* a polling routine.
33* Oct 07, 1999 Nenad Corbic o Support for S514 PCI card.
34* Gideon Hack o UPD and Updates executed using timer interrupt
35* Sep 10, 1999 Nenad Corbic o Fixed up the /proc statistics
36* Jul 20, 1999 Nenad Corbic o Remove the polling routines and use
37* interrupts instead.
38* Sep 17, 1998 Jaspreet Singh o Updates for 2.2.X Kernels.
39* Aug 13, 1998 Jaspreet Singh o Improved Line Tracing.
40* Jun 22, 1998 David Fong o Added remote IP address assignment
41* Mar 15, 1998 Alan Cox o 2.1.8x basic port.
42* Apr 16, 1998 Jaspreet Singh o using htons() for the IPX protocol.
43* Dec 09, 1997 Jaspreet Singh o Added PAP and CHAP.
44* o Implemented new routines like
45* ppp_set_inbnd_auth(), ppp_set_outbnd_auth(),
46* tokenize() and strstrip().
47* Nov 27, 1997 Jaspreet Singh o Added protection against enabling of irqs
48* while they have been disabled.
49* Nov 24, 1997 Jaspreet Singh o Fixed another RACE condition caused by
50* disabling and enabling of irqs.
51* o Added new counters for stats on disable/enable
52* IRQs.
53* Nov 10, 1997 Jaspreet Singh o Initialized 'skb->mac.raw' to 'skb->data'
54* before every netif_rx().
55* o Free up the device structure in del_if().
56* Nov 07, 1997 Jaspreet Singh o Changed the delay to zero for Line tracing
57* command.
58* Oct 20, 1997 Jaspreet Singh o Added hooks in for Router UP time.
59* Oct 16, 1997 Jaspreet Singh o The critical flag is used to maintain flow
60* control by avoiding RACE conditions. The
61* cli() and restore_flags() are taken out.
62* A new structure, "ppp_private_area", is added
63* to provide Driver Statistics.
64* Jul 21, 1997 Jaspreet Singh o Protected calls to sdla_peek() by adding
65* save_flags(), cli() and restore_flags().
66* Jul 07, 1997 Jaspreet Singh o Added configurable TTL for UDP packets
67* o Added ability to discard mulitcast and
68* broacast source addressed packets.
69* Jun 27, 1997 Jaspreet Singh o Added FT1 monitor capabilities
70* New case (0x25) statement in if_send routine.
71* Added a global variable rCount to keep track
72* of FT1 status enabled on the board.
73* May 22, 1997 Jaspreet Singh o Added change in the PPP_SET_CONFIG command for
74* 508 card to reflect changes in the new
75* ppp508.sfm for supporting:continous transmission
76* of Configure-Request packets without receiving a
77* reply
78* OR-ed 0x300 to conf_flags
79* o Changed connect_tmout from 900 to 0
80* May 21, 1997 Jaspreet Singh o Fixed UDP Management for multiple boards
81* Apr 25, 1997 Farhan Thawar o added UDP Management stuff
82* Mar 11, 1997 Farhan Thawar Version 3.1.1
83* o fixed (+1) bug in rx_intr()
84* o changed if_send() to return 0 if
85* wandev.critical() is true
86* o free socket buffer in if_send() if
87* returning 0
88* Jan 15, 1997 Gene Kozin Version 3.1.0
89* o implemented exec() entry point
90* Jan 06, 1997 Gene Kozin Initial version.
91*****************************************************************************/
92
93#include <linux/module.h>
94#include <linux/kernel.h> /* printk(), and other useful stuff */
95#include <linux/stddef.h> /* offsetof(), etc. */
96#include <linux/errno.h> /* return codes */
97#include <linux/string.h> /* inline memset(), etc. */
98#include <linux/slab.h> /* kmalloc(), kfree() */
99#include <linux/wanrouter.h> /* WAN router definitions */
100#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
101#include <linux/if_arp.h> /* ARPHRD_* defines */
102#include <asm/byteorder.h> /* htons(), etc. */
103#include <linux/in.h> /* sockaddr_in */
104#include <linux/jiffies.h> /* time_after() macro */
105
106
107#include <asm/uaccess.h>
108#include <linux/inetdevice.h>
109#include <linux/netdevice.h>
110
111#include <linux/if.h>
112#include <linux/sdla_ppp.h> /* PPP firmware API definitions */
113#include <linux/sdlasfm.h> /* S514 Type Definition */
114/****** Defines & Macros ****************************************************/
115
116#define PPP_DFLT_MTU 1500 /* default MTU */
117#define PPP_MAX_MTU 4000 /* maximum MTU */
118#define PPP_HDR_LEN 1
119
120#define MAX_IP_ERRORS 100
121
122#define CONNECT_TIMEOUT (90*HZ) /* link connection timeout */
123#define HOLD_DOWN_TIME (5*HZ) /* link hold down time : Changed from 30 to 5 */
124
125/* For handle_IPXWAN() */
126#define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b)))
127
128/* Macro for enabling/disabling debugging comments */
129//#define NEX_DEBUG
130#ifdef NEX_DEBUG
131#define NEX_PRINTK(format, a...) printk(format, ## a)
132#else
133#define NEX_PRINTK(format, a...)
134#endif /* NEX_DEBUG */
135
136#define DCD(a) ( a & 0x08 ? "HIGH" : "LOW" )
137#define CTS(a) ( a & 0x20 ? "HIGH" : "LOW" )
138#define LCP(a) ( a == 0x09 ? "OPEN" : "CLOSED" )
139#define IP(a) ( a == 0x09 ? "ENABLED" : "DISABLED" )
140
141#define TMR_INT_ENABLED_UPDATE 0x01
142#define TMR_INT_ENABLED_PPP_EVENT 0x02
143#define TMR_INT_ENABLED_UDP 0x04
144#define TMR_INT_ENABLED_CONFIG 0x20
145
146/* Set Configuraton Command Definitions */
147#define PERCENT_TX_BUFF 60
148#define TIME_BETWEEN_CONF_REQ 30
149#define TIME_BETWEEN_PAP_CHAP_REQ 30
150#define WAIT_PAP_CHAP_WITHOUT_REPLY 300
151#define WAIT_AFTER_DCD_CTS_LOW 5
152#define TIME_DCD_CTS_LOW_AFTER_LNK_DOWN 10
153#define WAIT_DCD_HIGH_AFTER_ENABLE_COMM 900
154#define MAX_CONF_REQ_WITHOUT_REPLY 10
155#define MAX_TERM_REQ_WITHOUT_REPLY 2
156#define NUM_CONF_NAK_WITHOUT_REPLY 5
157#define NUM_AUTH_REQ_WITHOUT_REPLY 10
158
159#define END_OFFSET 0x1F0
160
161
162/******Data Structures*****************************************************/
163
164/* This structure is placed in the private data area of the device structure.
165 * The card structure used to occupy the private area but now the following
166 * structure will incorporate the card structure along with PPP specific data
167 */
168
169typedef struct ppp_private_area
170{
171 struct net_device *slave;
172 sdla_t* card;
173 unsigned long router_start_time; /*router start time in sec */
174 unsigned long tick_counter; /*used for 5 second counter*/
175 unsigned mc; /*multicast support on or off*/
176 unsigned char enable_IPX;
177 unsigned long network_number;
178 unsigned char pap;
179 unsigned char chap;
180 unsigned char sysname[31]; /* system name for in-bnd auth*/
181 unsigned char userid[511]; /* list of user ids */
182 unsigned char passwd[511]; /* list of passwords */
183 unsigned protocol; /* SKB Protocol */
184 u32 ip_local; /* Local IP Address */
185 u32 ip_remote; /* remote IP Address */
186
187 u32 ip_local_tmp;
188 u32 ip_remote_tmp;
189
190 unsigned char timer_int_enabled; /* Who enabled the timer inter*/
191 unsigned char update_comms_stats; /* Used by update function */
192 unsigned long curr_trace_addr; /* Trace information */
193 unsigned long start_trace_addr;
194 unsigned long end_trace_addr;
195
196 unsigned char interface_down; /* Brind down interface when channel
197 goes down */
198 unsigned long config_wait_timeout; /* After if_open() if in dynamic if mode,
199 wait a few seconds before configuring */
200
201 unsigned short udp_pkt_lgth;
202 char udp_pkt_src;
203 char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
204
205 /* PPP specific statistics */
206
207 if_send_stat_t if_send_stat;
208 rx_intr_stat_t rx_intr_stat;
209 pipe_mgmt_stat_t pipe_mgmt_stat;
210
211 unsigned long router_up_time;
212
213 /* Polling work queue entry. Each interface
214 * has its own work queue entry, which is used
215 * to defer events from the interrupt */
216 struct work_struct poll_work;
217 struct timer_list poll_delay_timer;
218
219 u8 gateway;
220 u8 config_ppp;
221 u8 ip_error;
222
223}ppp_private_area_t;
224
225/* variable for keeping track of enabling/disabling FT1 monitor status */
226static int rCount = 0;
227
228extern void disable_irq(unsigned int);
229extern void enable_irq(unsigned int);
230
231/****** Function Prototypes *************************************************/
232
233/* WAN link driver entry points. These are called by the WAN router module. */
234static int update(struct wan_device *wandev);
235static int new_if(struct wan_device *wandev, struct net_device *dev,
236 wanif_conf_t *conf);
237static int del_if(struct wan_device *wandev, struct net_device *dev);
238
239/* WANPIPE-specific entry points */
240static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data);
241
242/* Network device interface */
243static int if_init(struct net_device *dev);
244static int if_open(struct net_device *dev);
245static int if_close(struct net_device *dev);
246static int if_header(struct sk_buff *skb, struct net_device *dev,
247 unsigned short type,
248 void *daddr, void *saddr, unsigned len);
249
250static void if_tx_timeout(struct net_device *dev);
251
252static int if_rebuild_hdr(struct sk_buff *skb);
253static struct net_device_stats *if_stats(struct net_device *dev);
254static int if_send(struct sk_buff *skb, struct net_device *dev);
255
256
257/* PPP firmware interface functions */
258static int ppp_read_version(sdla_t *card, char *str);
259static int ppp_set_outbnd_auth(sdla_t *card, ppp_private_area_t *ppp_priv_area);
260static int ppp_set_inbnd_auth(sdla_t *card, ppp_private_area_t *ppp_priv_area);
261static int ppp_configure(sdla_t *card, void *data);
262static int ppp_set_intr_mode(sdla_t *card, unsigned char mode);
263static int ppp_comm_enable(sdla_t *card);
264static int ppp_comm_disable(sdla_t *card);
265static int ppp_comm_disable_shutdown(sdla_t *card);
266static int ppp_get_err_stats(sdla_t *card);
267static int ppp_send(sdla_t *card, void *data, unsigned len, unsigned proto);
268static int ppp_error(sdla_t *card, int err, ppp_mbox_t *mb);
269
270static void wpp_isr(sdla_t *card);
271static void rx_intr(sdla_t *card);
272static void event_intr(sdla_t *card);
273static void timer_intr(sdla_t *card);
274
275/* Background polling routines */
276static void process_route(sdla_t *card);
277static void retrigger_comm(sdla_t *card);
278
279/* Miscellaneous functions */
280static int read_info( sdla_t *card );
281static int read_connection_info (sdla_t *card);
282static void remove_route( sdla_t *card );
283static int config508(struct net_device *dev, sdla_t *card);
284static void show_disc_cause(sdla_t * card, unsigned cause);
285static int reply_udp( unsigned char *data, unsigned int mbox_len );
286static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev,
287 ppp_private_area_t *ppp_priv_area);
288static void init_ppp_tx_rx_buff( sdla_t *card );
289static int intr_test( sdla_t *card );
290static int udp_pkt_type( struct sk_buff *skb , sdla_t *card);
291static void init_ppp_priv_struct( ppp_private_area_t *ppp_priv_area);
292static void init_global_statistics( sdla_t *card );
293static int tokenize(char *str, char **tokens);
294static char* strstrip(char *str, char *s);
295static int chk_bcast_mcast_addr(sdla_t* card, struct net_device* dev,
296 struct sk_buff *skb);
297
298static int config_ppp (sdla_t *);
299static void ppp_poll(struct net_device *dev);
300static void trigger_ppp_poll(struct net_device *dev);
301static void ppp_poll_delay (unsigned long dev_ptr);
302
303
304static int Read_connection_info;
305static int Intr_test_counter;
306static unsigned short available_buffer_space;
307
308
309/* IPX functions */
310static void switch_net_numbers(unsigned char *sendpacket, unsigned long network_number,
311 unsigned char incoming);
312static int handle_IPXWAN(unsigned char *sendpacket, char *devname, unsigned char enable_PX,
313 unsigned long network_number, unsigned short proto);
314
315/* Lock Functions */
316static void s508_lock (sdla_t *card, unsigned long *smp_flags);
317static void s508_unlock (sdla_t *card, unsigned long *smp_flags);
318
319static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
320 struct sk_buff *skb, struct net_device* dev,
321 ppp_private_area_t* ppp_priv_area );
322static unsigned short calc_checksum (char *data, int len);
323static void disable_comm (sdla_t *card);
324static int detect_and_fix_tx_bug (sdla_t *card);
325
326/****** Public Functions ****************************************************/
327
328/*============================================================================
329 * PPP protocol initialization routine.
330 *
331 * This routine is called by the main WANPIPE module during setup. At this
332 * point adapter is completely initialized and firmware is running.
333 * o read firmware version (to make sure it's alive)
334 * o configure adapter
335 * o initialize protocol-specific fields of the adapter data space.
336 *
337 * Return: 0 o.k.
338 * < 0 failure.
339 */
340int wpp_init(sdla_t *card, wandev_conf_t *conf)
341{
342 ppp_flags_t *flags;
343 union
344 {
345 char str[80];
346 } u;
347
348 /* Verify configuration ID */
349 if (conf->config_id != WANCONFIG_PPP) {
350
351 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
352 card->devname, conf->config_id);
353 return -EINVAL;
354
355 }
356
357 /* Initialize miscellaneous pointers to structures on the adapter */
358 switch (card->hw.type) {
359
360 case SDLA_S508:
361 card->mbox =(void*)(card->hw.dpmbase + PPP508_MB_OFFS);
362 card->flags=(void*)(card->hw.dpmbase + PPP508_FLG_OFFS);
363 break;
364
365 case SDLA_S514:
366 card->mbox =(void*)(card->hw.dpmbase + PPP514_MB_OFFS);
367 card->flags=(void*)(card->hw.dpmbase + PPP514_FLG_OFFS);
368 break;
369
370 default:
371 return -EINVAL;
372
373 }
374 flags = card->flags;
375
376 /* Read firmware version. Note that when adapter initializes, it
377 * clears the mailbox, so it may appear that the first command was
378 * executed successfully when in fact it was merely erased. To work
379 * around this, we execute the first command twice.
380 */
381 if (ppp_read_version(card, NULL) || ppp_read_version(card, u.str))
382 return -EIO;
383
384 printk(KERN_INFO "%s: running PPP firmware v%s\n",card->devname, u.str);
385 /* Adjust configuration and set defaults */
386 card->wandev.mtu = (conf->mtu) ?
387 min_t(unsigned int, conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU;
388
389 card->wandev.bps = conf->bps;
390 card->wandev.interface = conf->interface;
391 card->wandev.clocking = conf->clocking;
392 card->wandev.station = conf->station;
393 card->isr = &wpp_isr;
394 card->poll = NULL;
395 card->exec = &wpp_exec;
396 card->wandev.update = &update;
397 card->wandev.new_if = &new_if;
398 card->wandev.del_if = &del_if;
399 card->wandev.udp_port = conf->udp_port;
400 card->wandev.ttl = conf->ttl;
401 card->wandev.state = WAN_DISCONNECTED;
402 card->disable_comm = &disable_comm;
403 card->irq_dis_if_send_count = 0;
404 card->irq_dis_poll_count = 0;
405 card->u.p.authenticator = conf->u.ppp.authenticator;
406 card->u.p.ip_mode = conf->u.ppp.ip_mode ?
407 conf->u.ppp.ip_mode : WANOPT_PPP_STATIC;
408 card->TracingEnabled = 0;
409 Read_connection_info = 1;
410
411 /* initialize global statistics */
412 init_global_statistics( card );
413
414
415
416 if (!card->configured){
417 int err;
418
419 Intr_test_counter = 0;
420 err = intr_test(card);
421
422 if(err || (Intr_test_counter < MAX_INTR_TEST_COUNTER)) {
423 printk("%s: Interrupt Test Failed, Counter: %i\n",
424 card->devname, Intr_test_counter);
425 printk( "%s: Please choose another interrupt\n",card->devname);
426 return -EIO;
427 }
428
429 printk(KERN_INFO "%s: Interrupt Test Passed, Counter: %i\n",
430 card->devname, Intr_test_counter);
431 card->configured = 1;
432 }
433
434 ppp_set_intr_mode(card, PPP_INTR_TIMER);
435
436 /* Turn off the transmit and timer interrupt */
437 flags->imask &= ~PPP_INTR_TIMER;
438
439 printk(KERN_INFO "\n");
440
441 return 0;
442}
443
444/******* WAN Device Driver Entry Points *************************************/
445
446/*============================================================================
447 * Update device status & statistics.
448 */
449static int update(struct wan_device *wandev)
450{
451 sdla_t* card = wandev->private;
452 struct net_device* dev;
453 volatile ppp_private_area_t *ppp_priv_area;
454 ppp_flags_t *flags = card->flags;
455 unsigned long timeout;
456
457 /* sanity checks */
458 if ((wandev == NULL) || (wandev->private == NULL))
459 return -EFAULT;
460
461 if (wandev->state == WAN_UNCONFIGURED)
462 return -ENODEV;
463
464 /* Shutdown bug fix. This function can be
465 * called with NULL dev pointer during
466 * shutdown
467 */
468 if ((dev=card->wandev.dev) == NULL){
469 return -ENODEV;
470 }
471
472 if ((ppp_priv_area=dev->priv) == NULL){
473 return -ENODEV;
474 }
475
476 ppp_priv_area->update_comms_stats = 2;
477 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_UPDATE;
478 flags->imask |= PPP_INTR_TIMER;
479
480 /* wait a maximum of 1 second for the statistics to be updated */
481 timeout = jiffies;
482 for(;;) {
483 if(ppp_priv_area->update_comms_stats == 0){
484 break;
485 }
486 if (time_after(jiffies, timeout + 1 * HZ)){
487 ppp_priv_area->update_comms_stats = 0;
488 ppp_priv_area->timer_int_enabled &=
489 ~TMR_INT_ENABLED_UPDATE;
490 return -EAGAIN;
491 }
492 }
493
494 return 0;
495}
496
497/*============================================================================
498 * Create new logical channel.
499 * This routine is called by the router when ROUTER_IFNEW IOCTL is being
500 * handled.
501 * o parse media- and hardware-specific configuration
502 * o make sure that a new channel can be created
503 * o allocate resources, if necessary
504 * o prepare network device structure for registaration.
505 *
506 * Return: 0 o.k.
507 * < 0 failure (channel will not be created)
508 */
509static int new_if(struct wan_device *wandev, struct net_device *dev,
510 wanif_conf_t *conf)
511{
512 sdla_t *card = wandev->private;
513 ppp_private_area_t *ppp_priv_area;
514
515 if (wandev->ndev)
516 return -EEXIST;
517
518
519 printk(KERN_INFO "%s: Configuring Interface: %s\n",
520 card->devname, conf->name);
521
522 if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)) {
523
524 printk(KERN_INFO "%s: Invalid interface name!\n",
525 card->devname);
526 return -EINVAL;
527
528 }
529
530 /* allocate and initialize private data */
531 ppp_priv_area = kmalloc(sizeof(ppp_private_area_t), GFP_KERNEL);
532
533 if( ppp_priv_area == NULL )
534 return -ENOMEM;
535
536 memset(ppp_priv_area, 0, sizeof(ppp_private_area_t));
537
538 ppp_priv_area->card = card;
539
540 /* initialize data */
541 strcpy(card->u.p.if_name, conf->name);
542
543 /* initialize data in ppp_private_area structure */
544
545 init_ppp_priv_struct( ppp_priv_area );
546
547 ppp_priv_area->mc = conf->mc;
548 ppp_priv_area->pap = conf->pap;
549 ppp_priv_area->chap = conf->chap;
550
551 /* Option to bring down the interface when
552 * the link goes down */
553 if (conf->if_down){
554 set_bit(DYN_OPT_ON,&ppp_priv_area->interface_down);
555 printk("%s: Dynamic interface configuration enabled\n",
556 card->devname);
557 }
558
559 /* If no user ids are specified */
560 if(!strlen(conf->userid) && (ppp_priv_area->pap||ppp_priv_area->chap)){
561 kfree(ppp_priv_area);
562 return -EINVAL;
563 }
564
565 /* If no passwords are specified */
566 if(!strlen(conf->passwd) && (ppp_priv_area->pap||ppp_priv_area->chap)){
567 kfree(ppp_priv_area);
568 return -EINVAL;
569 }
570
571 if(strlen(conf->sysname) > 31){
572 kfree(ppp_priv_area);
573 return -EINVAL;
574 }
575
576 /* If no system name is specified */
577 if(!strlen(conf->sysname) && (card->u.p.authenticator)){
578 kfree(ppp_priv_area);
579 return -EINVAL;
580 }
581
582 /* copy the data into the ppp private structure */
583 memcpy(ppp_priv_area->userid, conf->userid, strlen(conf->userid));
584 memcpy(ppp_priv_area->passwd, conf->passwd, strlen(conf->passwd));
585 memcpy(ppp_priv_area->sysname, conf->sysname, strlen(conf->sysname));
586
587
588 ppp_priv_area->enable_IPX = conf->enable_IPX;
589 if (conf->network_number){
590 ppp_priv_area->network_number = conf->network_number;
591 }else{
592 ppp_priv_area->network_number = 0xDEADBEEF;
593 }
594
595 /* Tells us that if this interface is a
596 * gateway or not */
597 if ((ppp_priv_area->gateway = conf->gateway) == WANOPT_YES){
598 printk(KERN_INFO "%s: Interface %s is set as a gateway.\n",
599 card->devname,card->u.p.if_name);
600 }
601
602 /* prepare network device data space for registration */
603 strcpy(dev->name,card->u.p.if_name);
604
605 dev->init = &if_init;
606 dev->priv = ppp_priv_area;
607 dev->mtu = min_t(unsigned int, dev->mtu, card->wandev.mtu);
608
609 /* Initialize the polling work routine */
610 INIT_WORK(&ppp_priv_area->poll_work, (void*)(void*)ppp_poll, dev);
611
612 /* Initialize the polling delay timer */
613 init_timer(&ppp_priv_area->poll_delay_timer);
614 ppp_priv_area->poll_delay_timer.data = (unsigned long)dev;
615 ppp_priv_area->poll_delay_timer.function = ppp_poll_delay;
616
617
618 /* Since we start with dummy IP addresses we can say
619 * that route exists */
620 printk(KERN_INFO "\n");
621
622 return 0;
623}
624
625/*============================================================================
626 * Delete logical channel.
627 */
628static int del_if(struct wan_device *wandev, struct net_device *dev)
629{
630 return 0;
631}
632
633static void disable_comm (sdla_t *card)
634{
635 ppp_comm_disable_shutdown(card);
636 return;
637}
638
639/****** WANPIPE-specific entry points ***************************************/
640
641/*============================================================================
642 * Execute adapter interface command.
643 */
644
645//FIXME: Why do we need this ????
646static int wpp_exec(struct sdla *card, void *u_cmd, void *u_data)
647{
648 ppp_mbox_t *mbox = card->mbox;
649 int len;
650
651 if (copy_from_user((void*)&mbox->cmd, u_cmd, sizeof(ppp_cmd_t)))
652 return -EFAULT;
653
654 len = mbox->cmd.length;
655
656 if (len) {
657
658 if( copy_from_user((void*)&mbox->data, u_data, len))
659 return -EFAULT;
660
661 }
662
663 /* execute command */
664 if (!sdla_exec(mbox))
665 return -EIO;
666
667 /* return result */
668 if( copy_to_user(u_cmd, (void*)&mbox->cmd, sizeof(ppp_cmd_t)))
669 return -EFAULT;
670 len = mbox->cmd.length;
671
672 if (len && u_data && copy_to_user(u_data, (void*)&mbox->data, len))
673 return -EFAULT;
674
675 return 0;
676}
677
678/****** Network Device Interface ********************************************/
679
680/*============================================================================
681 * Initialize Linux network interface.
682 *
683 * This routine is called only once for each interface, during Linux network
684 * interface registration. Returning anything but zero will fail interface
685 * registration.
686 */
687static int if_init(struct net_device *dev)
688{
689 ppp_private_area_t *ppp_priv_area = dev->priv;
690 sdla_t *card = ppp_priv_area->card;
691 struct wan_device *wandev = &card->wandev;
692
693 /* Initialize device driver entry points */
694 dev->open = &if_open;
695 dev->stop = &if_close;
696 dev->hard_header = &if_header;
697 dev->rebuild_header = &if_rebuild_hdr;
698 dev->hard_start_xmit = &if_send;
699 dev->get_stats = &if_stats;
700 dev->tx_timeout = &if_tx_timeout;
701 dev->watchdog_timeo = TX_TIMEOUT;
702
703 /* Initialize media-specific parameters */
704 dev->type = ARPHRD_PPP; /* ARP h/w type */
705 dev->flags |= IFF_POINTOPOINT;
706 dev->flags |= IFF_NOARP;
707
708 /* Enable Mulitcasting if specified by user*/
709 if (ppp_priv_area->mc == WANOPT_YES){
710 dev->flags |= IFF_MULTICAST;
711 }
712
713 dev->mtu = wandev->mtu;
714 dev->hard_header_len = PPP_HDR_LEN; /* media header length */
715
716 /* Initialize hardware parameters (just for reference) */
717 dev->irq = wandev->irq;
718 dev->dma = wandev->dma;
719 dev->base_addr = wandev->ioport;
720 dev->mem_start = wandev->maddr;
721 dev->mem_end = wandev->maddr + wandev->msize - 1;
722
723 /* Set transmit buffer queue length */
724 dev->tx_queue_len = 100;
725 SET_MODULE_OWNER(dev);
726
727 return 0;
728}
729
730/*============================================================================
731 * Open network interface.
732 * o enable communications and interrupts.
733 * o prevent module from unloading by incrementing use count
734 *
735 * Return 0 if O.k. or errno.
736 */
737static int if_open(struct net_device *dev)
738{
739 ppp_private_area_t *ppp_priv_area = dev->priv;
740 sdla_t *card = ppp_priv_area->card;
741 struct timeval tv;
742 //unsigned long smp_flags;
743
744 if (netif_running(dev))
745 return -EBUSY;
746
747 wanpipe_open(card);
748
749 netif_start_queue(dev);
750
751 do_gettimeofday( &tv );
752 ppp_priv_area->router_start_time = tv.tv_sec;
753
754 /* We cannot configure the card here because we don't
755 * have access to the interface IP addresses.
756 * Once the interface initilization is complete, we will be
757 * able to access the IP addresses. Therefore,
758 * configure the ppp link in the poll routine */
759 set_bit(0,&ppp_priv_area->config_ppp);
760 ppp_priv_area->config_wait_timeout=jiffies;
761
762 /* Start the PPP configuration after 1sec delay.
763 * This will give the interface initilization time
764 * to finish its configuration */
765 mod_timer(&ppp_priv_area->poll_delay_timer, jiffies + HZ);
766 return 0;
767}
768
769/*============================================================================
770 * Close network interface.
771 * o if this is the last open, then disable communications and interrupts.
772 * o reset flags.
773 */
774static int if_close(struct net_device *dev)
775{
776 ppp_private_area_t *ppp_priv_area = dev->priv;
777 sdla_t *card = ppp_priv_area->card;
778
779 netif_stop_queue(dev);
780 wanpipe_close(card);
781
782 del_timer (&ppp_priv_area->poll_delay_timer);
783 return 0;
784}
785
786/*============================================================================
787 * Build media header.
788 *
789 * The trick here is to put packet type (Ethertype) into 'protocol' field of
790 * the socket buffer, so that we don't forget it. If packet type is not
791 * supported, set skb->protocol to 0 and discard packet later.
792 *
793 * Return: media header length.
794 */
795static int if_header(struct sk_buff *skb, struct net_device *dev,
796 unsigned short type, void *daddr, void *saddr, unsigned len)
797{
798 switch (type)
799 {
800 case ETH_P_IP:
801 case ETH_P_IPX:
802 skb->protocol = htons(type);
803 break;
804
805 default:
806 skb->protocol = 0;
807 }
808
809 return PPP_HDR_LEN;
810}
811
812/*============================================================================
813 * Re-build media header.
814 *
815 * Return: 1 physical address resolved.
816 * 0 physical address not resolved
817 */
818static int if_rebuild_hdr (struct sk_buff *skb)
819{
820 struct net_device *dev = skb->dev;
821 ppp_private_area_t *ppp_priv_area = dev->priv;
822 sdla_t *card = ppp_priv_area->card;
823
824 printk(KERN_INFO "%s: rebuild_header() called for interface %s!\n",
825 card->devname, dev->name);
826 return 1;
827}
828
829/*============================================================================
830 * Handle transmit timeout event from netif watchdog
831 */
832static void if_tx_timeout(struct net_device *dev)
833{
834 ppp_private_area_t* chan = dev->priv;
835 sdla_t *card = chan->card;
836
837 /* If our device stays busy for at least 5 seconds then we will
838 * kick start the device by making dev->tbusy = 0. We expect
839 * that our device never stays busy more than 5 seconds. So this
840 * is only used as a last resort.
841 */
842
843 ++ chan->if_send_stat.if_send_tbusy;
844 ++card->wandev.stats.collisions;
845
846 printk (KERN_INFO "%s: Transmit timed out on %s\n", card->devname,dev->name);
847 ++chan->if_send_stat.if_send_tbusy_timeout;
848 netif_wake_queue (dev);
849}
850
851
852
853/*============================================================================
854 * Send a packet on a network interface.
855 * o set tbusy flag (marks start of the transmission) to block a timer-based
856 * transmit from overlapping.
857 * o check link state. If link is not up, then drop the packet.
858 * o execute adapter send command.
859 * o free socket buffer
860 *
861 * Return: 0 complete (socket buffer must be freed)
862 * non-0 packet may be re-transmitted (tbusy must be set)
863 *
864 * Notes:
865 * 1. This routine is called either by the protocol stack or by the "net
866 * bottom half" (with interrupts enabled).
867 * 2. Setting tbusy flag will inhibit further transmit requests from the
868 * protocol stack and can be used for flow control with protocol layer.
869 */
870static int if_send (struct sk_buff *skb, struct net_device *dev)
871{
872 ppp_private_area_t *ppp_priv_area = dev->priv;
873 sdla_t *card = ppp_priv_area->card;
874 unsigned char *sendpacket;
875 unsigned long smp_flags;
876 ppp_flags_t *flags = card->flags;
877 int udp_type;
878 int err=0;
879
880 ++ppp_priv_area->if_send_stat.if_send_entry;
881
882 netif_stop_queue(dev);
883
884 if (skb == NULL) {
885
886 /* If we get here, some higher layer thinks we've missed an
887 * tx-done interrupt.
888 */
889 printk(KERN_INFO "%s: interface %s got kicked!\n",
890 card->devname, dev->name);
891
892 ++ppp_priv_area->if_send_stat.if_send_skb_null;
893
894 netif_wake_queue(dev);
895 return 0;
896 }
897
898 sendpacket = skb->data;
899
900 udp_type = udp_pkt_type( skb, card );
901
902
903 if (udp_type == UDP_PTPIPE_TYPE){
904 if(store_udp_mgmt_pkt(UDP_PKT_FRM_STACK, card, skb, dev,
905 ppp_priv_area)){
906 flags->imask |= PPP_INTR_TIMER;
907 }
908 ++ppp_priv_area->if_send_stat.if_send_PIPE_request;
909 netif_start_queue(dev);
910 return 0;
911 }
912
913 /* Check for broadcast and multicast addresses
914 * If found, drop (deallocate) a packet and return.
915 */
916 if(chk_bcast_mcast_addr(card, dev, skb)){
917 ++card->wandev.stats.tx_dropped;
918 dev_kfree_skb_any(skb);
919 netif_start_queue(dev);
920 return 0;
921 }
922
923
924 if(card->hw.type != SDLA_S514){
925 s508_lock(card,&smp_flags);
926 }
927
928 if (test_and_set_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
929
930 printk(KERN_INFO "%s: Critical in if_send: %lx\n",
931 card->wandev.name,card->wandev.critical);
932
933 ++card->wandev.stats.tx_dropped;
934 ++ppp_priv_area->if_send_stat.if_send_critical_non_ISR;
935 netif_start_queue(dev);
936 goto if_send_exit_crit;
937 }
938
939 if (card->wandev.state != WAN_CONNECTED) {
940
941 ++ppp_priv_area->if_send_stat.if_send_wan_disconnected;
942 ++card->wandev.stats.tx_dropped;
943 netif_start_queue(dev);
944
945 } else if (!skb->protocol) {
946 ++ppp_priv_area->if_send_stat.if_send_protocol_error;
947 ++card->wandev.stats.tx_errors;
948 netif_start_queue(dev);
949
950 } else {
951
952 /*If it's IPX change the network numbers to 0 if they're ours.*/
953 if( skb->protocol == htons(ETH_P_IPX) ) {
954 if(ppp_priv_area->enable_IPX) {
955 switch_net_numbers( skb->data,
956 ppp_priv_area->network_number, 0);
957 } else {
958 ++card->wandev.stats.tx_dropped;
959 netif_start_queue(dev);
960 goto if_send_exit_crit;
961 }
962 }
963
964 if (ppp_send(card, skb->data, skb->len, skb->protocol)) {
965 netif_stop_queue(dev);
966 ++ppp_priv_area->if_send_stat.if_send_adptr_bfrs_full;
967 ++ppp_priv_area->if_send_stat.if_send_tx_int_enabled;
968 } else {
969 ++ppp_priv_area->if_send_stat.if_send_bfr_passed_to_adptr;
970 ++card->wandev.stats.tx_packets;
971 card->wandev.stats.tx_bytes += skb->len;
972 netif_start_queue(dev);
973 dev->trans_start = jiffies;
974 }
975 }
976
977if_send_exit_crit:
978
979 if (!(err=netif_queue_stopped(dev))){
980 dev_kfree_skb_any(skb);
981 }else{
982 ppp_priv_area->tick_counter = jiffies;
983 flags->imask |= PPP_INTR_TXRDY; /* unmask Tx interrupts */
984 }
985
986 clear_bit(SEND_CRIT,&card->wandev.critical);
987 if(card->hw.type != SDLA_S514){
988 s508_unlock(card,&smp_flags);
989 }
990
991 return err;
992}
993
994
995/*=============================================================================
996 * Store a UDP management packet for later processing.
997 */
998
999static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
1000 struct sk_buff *skb, struct net_device* dev,
1001 ppp_private_area_t* ppp_priv_area )
1002{
1003 int udp_pkt_stored = 0;
1004
1005 if(!ppp_priv_area->udp_pkt_lgth && (skb->len<=MAX_LGTH_UDP_MGNT_PKT)){
1006 ppp_priv_area->udp_pkt_lgth = skb->len;
1007 ppp_priv_area->udp_pkt_src = udp_pkt_src;
1008 memcpy(ppp_priv_area->udp_pkt_data, skb->data, skb->len);
1009 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_UDP;
1010 ppp_priv_area->protocol = skb->protocol;
1011 udp_pkt_stored = 1;
1012 }else{
1013 if (skb->len > MAX_LGTH_UDP_MGNT_PKT){
1014 printk(KERN_INFO "%s: PIPEMON UDP request too long : %i\n",
1015 card->devname, skb->len);
1016 }else{
1017 printk(KERN_INFO "%s: PIPEMON UPD request already pending\n",
1018 card->devname);
1019 }
1020 ppp_priv_area->udp_pkt_lgth = 0;
1021 }
1022
1023 if(udp_pkt_src == UDP_PKT_FRM_STACK){
1024 dev_kfree_skb_any(skb);
1025 }else{
1026 dev_kfree_skb_any(skb);
1027 }
1028
1029 return(udp_pkt_stored);
1030}
1031
1032
1033
1034/*============================================================================
1035 * Reply to UDP Management system.
1036 * Return length of reply.
1037 */
1038static int reply_udp( unsigned char *data, unsigned int mbox_len )
1039{
1040 unsigned short len, udp_length, temp, ip_length;
1041 unsigned long ip_temp;
1042 int even_bound = 0;
1043 ppp_udp_pkt_t *p_udp_pkt = (ppp_udp_pkt_t *)data;
1044
1045 /* Set length of packet */
1046 len = sizeof(ip_pkt_t)+
1047 sizeof(udp_pkt_t)+
1048 sizeof(wp_mgmt_t)+
1049 sizeof(cblock_t)+
1050 mbox_len;
1051
1052 /* fill in UDP reply */
1053 p_udp_pkt->wp_mgmt.request_reply = UDPMGMT_REPLY;
1054
1055 /* fill in UDP length */
1056 udp_length = sizeof(udp_pkt_t)+
1057 sizeof(wp_mgmt_t)+
1058 sizeof(cblock_t)+
1059 mbox_len;
1060
1061
1062 /* put it on an even boundary */
1063 if ( udp_length & 0x0001 ) {
1064 udp_length += 1;
1065 len += 1;
1066 even_bound=1;
1067 }
1068
1069 temp = (udp_length<<8)|(udp_length>>8);
1070 p_udp_pkt->udp_pkt.udp_length = temp;
1071
1072
1073 /* swap UDP ports */
1074 temp = p_udp_pkt->udp_pkt.udp_src_port;
1075 p_udp_pkt->udp_pkt.udp_src_port =
1076 p_udp_pkt->udp_pkt.udp_dst_port;
1077 p_udp_pkt->udp_pkt.udp_dst_port = temp;
1078
1079
1080 /* add UDP pseudo header */
1081 temp = 0x1100;
1082 *((unsigned short *)(p_udp_pkt->data+mbox_len+even_bound)) = temp;
1083 temp = (udp_length<<8)|(udp_length>>8);
1084 *((unsigned short *)(p_udp_pkt->data+mbox_len+even_bound+2)) = temp;
1085
1086 /* calculate UDP checksum */
1087 p_udp_pkt->udp_pkt.udp_checksum = 0;
1088 p_udp_pkt->udp_pkt.udp_checksum =
1089 calc_checksum(&data[UDP_OFFSET],udp_length+UDP_OFFSET);
1090
1091 /* fill in IP length */
1092 ip_length = udp_length + sizeof(ip_pkt_t);
1093 temp = (ip_length<<8)|(ip_length>>8);
1094 p_udp_pkt->ip_pkt.total_length = temp;
1095
1096 /* swap IP addresses */
1097 ip_temp = p_udp_pkt->ip_pkt.ip_src_address;
1098 p_udp_pkt->ip_pkt.ip_src_address = p_udp_pkt->ip_pkt.ip_dst_address;
1099 p_udp_pkt->ip_pkt.ip_dst_address = ip_temp;
1100
1101 /* fill in IP checksum */
1102 p_udp_pkt->ip_pkt.hdr_checksum = 0;
1103 p_udp_pkt->ip_pkt.hdr_checksum = calc_checksum(data,sizeof(ip_pkt_t));
1104
1105 return len;
1106
1107} /* reply_udp */
1108
1109unsigned short calc_checksum (char *data, int len)
1110{
1111 unsigned short temp;
1112 unsigned long sum=0;
1113 int i;
1114
1115 for( i = 0; i <len; i+=2 ) {
1116 memcpy(&temp,&data[i],2);
1117 sum += (unsigned long)temp;
1118 }
1119
1120 while (sum >> 16 ) {
1121 sum = (sum & 0xffffUL) + (sum >> 16);
1122 }
1123
1124 temp = (unsigned short)sum;
1125 temp = ~temp;
1126
1127 if( temp == 0 )
1128 temp = 0xffff;
1129
1130 return temp;
1131}
1132
1133/*
1134 If incoming is 0 (outgoing)- if the net numbers is ours make it 0
1135 if incoming is 1 - if the net number is 0 make it ours
1136
1137*/
1138static void switch_net_numbers(unsigned char *sendpacket, unsigned long network_number, unsigned char incoming)
1139{
1140 unsigned long pnetwork_number;
1141
1142 pnetwork_number = (unsigned long)((sendpacket[6] << 24) +
1143 (sendpacket[7] << 16) + (sendpacket[8] << 8) +
1144 sendpacket[9]);
1145
1146 if (!incoming) {
1147 //If the destination network number is ours, make it 0
1148 if( pnetwork_number == network_number) {
1149 sendpacket[6] = sendpacket[7] = sendpacket[8] =
1150 sendpacket[9] = 0x00;
1151 }
1152 } else {
1153 //If the incoming network is 0, make it ours
1154 if( pnetwork_number == 0) {
1155 sendpacket[6] = (unsigned char)(network_number >> 24);
1156 sendpacket[7] = (unsigned char)((network_number &
1157 0x00FF0000) >> 16);
1158 sendpacket[8] = (unsigned char)((network_number &
1159 0x0000FF00) >> 8);
1160 sendpacket[9] = (unsigned char)(network_number &
1161 0x000000FF);
1162 }
1163 }
1164
1165
1166 pnetwork_number = (unsigned long)((sendpacket[18] << 24) +
1167 (sendpacket[19] << 16) + (sendpacket[20] << 8) +
1168 sendpacket[21]);
1169
1170 if( !incoming ) {
1171 //If the source network is ours, make it 0
1172 if( pnetwork_number == network_number) {
1173 sendpacket[18] = sendpacket[19] = sendpacket[20] =
1174 sendpacket[21] = 0x00;
1175 }
1176 } else {
1177 //If the source network is 0, make it ours
1178 if( pnetwork_number == 0 ) {
1179 sendpacket[18] = (unsigned char)(network_number >> 24);
1180 sendpacket[19] = (unsigned char)((network_number &
1181 0x00FF0000) >> 16);
1182 sendpacket[20] = (unsigned char)((network_number &
1183 0x0000FF00) >> 8);
1184 sendpacket[21] = (unsigned char)(network_number &
1185 0x000000FF);
1186 }
1187 }
1188} /* switch_net_numbers */
1189
1190/*============================================================================
1191 * Get ethernet-style interface statistics.
1192 * Return a pointer to struct net_device_stats.
1193 */
1194static struct net_device_stats *if_stats(struct net_device *dev)
1195{
1196
1197 ppp_private_area_t *ppp_priv_area = dev->priv;
1198 sdla_t* card;
1199
1200 if( ppp_priv_area == NULL )
1201 return NULL;
1202
1203 card = ppp_priv_area->card;
1204 return &card->wandev.stats;
1205}
1206
1207/****** PPP Firmware Interface Functions ************************************/
1208
1209/*============================================================================
1210 * Read firmware code version.
1211 * Put code version as ASCII string in str.
1212 */
1213static int ppp_read_version(sdla_t *card, char *str)
1214{
1215 ppp_mbox_t *mb = card->mbox;
1216 int err;
1217
1218 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1219 mb->cmd.command = PPP_READ_CODE_VERSION;
1220 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1221
1222 if (err != CMD_OK)
1223
1224 ppp_error(card, err, mb);
1225
1226 else if (str) {
1227
1228 int len = mb->cmd.length;
1229
1230 memcpy(str, mb->data, len);
1231 str[len] = '\0';
1232
1233 }
1234
1235 return err;
1236}
1237/*===========================================================================
1238 * Set Out-Bound Authentication.
1239*/
1240static int ppp_set_outbnd_auth (sdla_t *card, ppp_private_area_t *ppp_priv_area)
1241{
1242 ppp_mbox_t *mb = card->mbox;
1243 int err;
1244
1245 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1246 memset(&mb->data, 0, (strlen(ppp_priv_area->userid) +
1247 strlen(ppp_priv_area->passwd) + 2 ) );
1248 memcpy(mb->data, ppp_priv_area->userid, strlen(ppp_priv_area->userid));
1249 memcpy((mb->data + strlen(ppp_priv_area->userid) + 1),
1250 ppp_priv_area->passwd, strlen(ppp_priv_area->passwd));
1251
1252 mb->cmd.length = strlen(ppp_priv_area->userid) +
1253 strlen(ppp_priv_area->passwd) + 2 ;
1254
1255 mb->cmd.command = PPP_SET_OUTBOUND_AUTH;
1256
1257 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1258
1259 if (err != CMD_OK)
1260 ppp_error(card, err, mb);
1261
1262 return err;
1263}
1264
1265/*===========================================================================
1266 * Set In-Bound Authentication.
1267*/
1268static int ppp_set_inbnd_auth (sdla_t *card, ppp_private_area_t *ppp_priv_area)
1269{
1270 ppp_mbox_t *mb = card->mbox;
1271 int err, i;
1272 char* user_tokens[32];
1273 char* pass_tokens[32];
1274 int userids, passwds;
1275 int add_ptr;
1276
1277 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1278 memset(&mb->data, 0, 1008);
1279 memcpy(mb->data, ppp_priv_area->sysname,
1280 strlen(ppp_priv_area->sysname));
1281
1282 /* Parse the userid string and the password string and build a string
1283 to copy it to the data area of the command structure. The string
1284 will look like "SYS_NAME<NULL>USER1<NULL>PASS1<NULL>USER2<NULL>PASS2
1285 ....<NULL> "
1286 */
1287 userids = tokenize( ppp_priv_area->userid, user_tokens);
1288 passwds = tokenize( ppp_priv_area->passwd, pass_tokens);
1289
1290 if (userids != passwds){
1291 printk(KERN_INFO "%s: Number of passwords does not equal the number of user ids\n", card->devname);
1292 return 1;
1293 }
1294
1295 add_ptr = strlen(ppp_priv_area->sysname) + 1;
1296 for (i=0; i<userids; i++){
1297 memcpy((mb->data + add_ptr), user_tokens[i],
1298 strlen(user_tokens[i]));
1299 memcpy((mb->data + add_ptr + strlen(user_tokens[i]) + 1),
1300 pass_tokens[i], strlen(pass_tokens[i]));
1301 add_ptr = add_ptr + strlen(user_tokens[i]) + 1 +
1302 strlen(pass_tokens[i]) + 1;
1303 }
1304
1305 mb->cmd.length = add_ptr + 1;
1306 mb->cmd.command = PPP_SET_INBOUND_AUTH;
1307
1308 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1309
1310 if (err != CMD_OK)
1311 ppp_error(card, err, mb);
1312
1313 return err;
1314}
1315
1316
1317/*============================================================================
1318 * Tokenize string.
1319 * Parse a string of the following syntax:
1320 * <arg1>,<arg2>,...
1321 * and fill array of tokens with pointers to string elements.
1322 *
1323 */
1324static int tokenize (char *str, char **tokens)
1325{
1326 int cnt = 0;
1327
1328 tokens[0] = strsep(&str, "/");
1329 while (tokens[cnt] && (cnt < 32 - 1))
1330 {
1331 tokens[cnt] = strstrip(tokens[cnt], " \t");
1332 tokens[++cnt] = strsep(&str, "/");
1333 }
1334 return cnt;
1335}
1336
1337/*============================================================================
1338 * Strip leading and trailing spaces off the string str.
1339 */
1340static char* strstrip (char *str, char* s)
1341{
1342 char *eos = str + strlen(str); /* -> end of string */
1343
1344 while (*str && strchr(s, *str))
1345 ++str /* strip leading spaces */
1346 ;
1347 while ((eos > str) && strchr(s, *(eos - 1)))
1348 --eos /* strip trailing spaces */
1349 ;
1350 *eos = '\0';
1351 return str;
1352}
1353/*============================================================================
1354 * Configure PPP firmware.
1355 */
1356static int ppp_configure(sdla_t *card, void *data)
1357{
1358 ppp_mbox_t *mb = card->mbox;
1359 int data_len = sizeof(ppp508_conf_t);
1360 int err;
1361
1362 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1363 memcpy(mb->data, data, data_len);
1364 mb->cmd.length = data_len;
1365 mb->cmd.command = PPP_SET_CONFIG;
1366 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1367
1368 if (err != CMD_OK)
1369 ppp_error(card, err, mb);
1370
1371 return err;
1372}
1373
1374/*============================================================================
1375 * Set interrupt mode.
1376 */
1377static int ppp_set_intr_mode(sdla_t *card, unsigned char mode)
1378{
1379 ppp_mbox_t *mb = card->mbox;
1380 ppp_intr_info_t *ppp_intr_data = (ppp_intr_info_t *) &mb->data[0];
1381 int err;
1382
1383 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1384 ppp_intr_data->i_enable = mode;
1385
1386 ppp_intr_data->irq = card->hw.irq;
1387 mb->cmd.length = 2;
1388
1389 /* If timer has been enabled, set the timer delay to 1sec */
1390 if (mode & 0x80){
1391 ppp_intr_data->timer_len = 250; //5;//100; //250;
1392 mb->cmd.length = 4;
1393 }
1394
1395 mb->cmd.command = PPP_SET_INTR_FLAGS;
1396 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1397
1398 if (err != CMD_OK)
1399 ppp_error(card, err, mb);
1400
1401
1402 return err;
1403}
1404
1405/*============================================================================
1406 * Enable communications.
1407 */
1408static int ppp_comm_enable(sdla_t *card)
1409{
1410 ppp_mbox_t *mb = card->mbox;
1411 int err;
1412
1413 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1414 mb->cmd.command = PPP_COMM_ENABLE;
1415 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1416
1417 if (err != CMD_OK)
1418 ppp_error(card, err, mb);
1419 else
1420 card->u.p.comm_enabled = 1;
1421
1422 return err;
1423}
1424
1425/*============================================================================
1426 * Disable communications.
1427 */
1428static int ppp_comm_disable(sdla_t *card)
1429{
1430 ppp_mbox_t *mb = card->mbox;
1431 int err;
1432
1433 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1434 mb->cmd.command = PPP_COMM_DISABLE;
1435 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1436 if (err != CMD_OK)
1437 ppp_error(card, err, mb);
1438 else
1439 card->u.p.comm_enabled = 0;
1440
1441 return err;
1442}
1443
1444static int ppp_comm_disable_shutdown(sdla_t *card)
1445{
1446 ppp_mbox_t *mb = card->mbox;
1447 ppp_intr_info_t *ppp_intr_data;
1448 int err;
1449
1450 if (!mb){
1451 return 1;
1452 }
1453
1454 ppp_intr_data = (ppp_intr_info_t *) &mb->data[0];
1455
1456 /* Disable all interrupts */
1457 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1458 ppp_intr_data->i_enable = 0;
1459
1460 ppp_intr_data->irq = card->hw.irq;
1461 mb->cmd.length = 2;
1462
1463 mb->cmd.command = PPP_SET_INTR_FLAGS;
1464 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1465
1466 /* Disable communicatinons */
1467 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1468 mb->cmd.command = PPP_COMM_DISABLE;
1469 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1470
1471 card->u.p.comm_enabled = 0;
1472
1473 return 0;
1474}
1475
1476
1477
1478/*============================================================================
1479 * Get communications error statistics.
1480 */
1481static int ppp_get_err_stats(sdla_t *card)
1482{
1483 ppp_mbox_t *mb = card->mbox;
1484 int err;
1485
1486 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
1487 mb->cmd.command = PPP_READ_ERROR_STATS;
1488 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
1489
1490 if (err == CMD_OK) {
1491
1492 ppp_err_stats_t* stats = (void*)mb->data;
1493 card->wandev.stats.rx_over_errors = stats->rx_overrun;
1494 card->wandev.stats.rx_crc_errors = stats->rx_bad_crc;
1495 card->wandev.stats.rx_missed_errors = stats->rx_abort;
1496 card->wandev.stats.rx_length_errors = stats->rx_lost;
1497 card->wandev.stats.tx_aborted_errors = stats->tx_abort;
1498
1499 } else
1500 ppp_error(card, err, mb);
1501
1502 return err;
1503}
1504
1505/*============================================================================
1506 * Send packet.
1507 * Return: 0 - o.k.
1508 * 1 - no transmit buffers available
1509 */
1510static int ppp_send (sdla_t *card, void *data, unsigned len, unsigned proto)
1511{
1512 ppp_buf_ctl_t *txbuf = card->u.p.txbuf;
1513
1514 if (txbuf->flag)
1515 return 1;
1516
1517 sdla_poke(&card->hw, txbuf->buf.ptr, data, len);
1518
1519 txbuf->length = len; /* frame length */
1520
1521 if (proto == htons(ETH_P_IPX))
1522 txbuf->proto = 0x01; /* protocol ID */
1523 else
1524 txbuf->proto = 0x00; /* protocol ID */
1525
1526 txbuf->flag = 1; /* start transmission */
1527
1528 /* Update transmit buffer control fields */
1529 card->u.p.txbuf = ++txbuf;
1530
1531 if ((void*)txbuf > card->u.p.txbuf_last)
1532 card->u.p.txbuf = card->u.p.txbuf_base;
1533
1534 return 0;
1535}
1536
1537/****** Firmware Error Handler **********************************************/
1538
1539/*============================================================================
1540 * Firmware error handler.
1541 * This routine is called whenever firmware command returns non-zero
1542 * return code.
1543 *
1544 * Return zero if previous command has to be cancelled.
1545 */
1546static int ppp_error(sdla_t *card, int err, ppp_mbox_t *mb)
1547{
1548 unsigned cmd = mb->cmd.command;
1549
1550 switch (err) {
1551
1552 case CMD_TIMEOUT:
1553 printk(KERN_ERR "%s: command 0x%02X timed out!\n",
1554 card->devname, cmd);
1555 break;
1556
1557 default:
1558 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X!\n"
1559 , card->devname, cmd, err);
1560 }
1561
1562 return 0;
1563}
1564
1565/****** Interrupt Handlers **************************************************/
1566
1567/*============================================================================
1568 * PPP interrupt service routine.
1569 */
1570static void wpp_isr (sdla_t *card)
1571{
1572 ppp_flags_t *flags = card->flags;
1573 char *ptr = &flags->iflag;
1574 struct net_device *dev = card->wandev.dev;
1575 int i;
1576
1577 card->in_isr = 1;
1578 ++card->statistics.isr_entry;
1579
1580 if (!dev && flags->iflag != PPP_INTR_CMD){
1581 card->in_isr = 0;
1582 flags->iflag = 0;
1583 return;
1584 }
1585
1586 if (test_bit(PERI_CRIT, (void*)&card->wandev.critical)) {
1587 card->in_isr = 0;
1588 flags->iflag = 0;
1589 return;
1590 }
1591
1592
1593 if(card->hw.type != SDLA_S514){
1594 if (test_bit(SEND_CRIT, (void*)&card->wandev.critical)) {
1595 ++card->statistics.isr_already_critical;
1596 printk (KERN_INFO "%s: Critical while in ISR!\n",
1597 card->devname);
1598 card->in_isr = 0;
1599 flags->iflag = 0;
1600 return;
1601 }
1602 }
1603
1604 switch (flags->iflag) {
1605
1606 case PPP_INTR_RXRDY: /* receive interrupt 0x01 (bit 0)*/
1607 ++card->statistics.isr_rx;
1608 rx_intr(card);
1609 break;
1610
1611 case PPP_INTR_TXRDY: /* transmit interrupt 0x02 (bit 1)*/
1612 ++card->statistics.isr_tx;
1613 flags->imask &= ~PPP_INTR_TXRDY;
1614 netif_wake_queue(dev);
1615 break;
1616
1617 case PPP_INTR_CMD: /* interface command completed */
1618 ++Intr_test_counter;
1619 ++card->statistics.isr_intr_test;
1620 break;
1621
1622 case PPP_INTR_MODEM: /* modem status change (DCD, CTS) 0x04 (bit 2)*/
1623 case PPP_INTR_DISC: /* Data link disconnected 0x10 (bit 4)*/
1624 case PPP_INTR_OPEN: /* Data link open 0x20 (bit 5)*/
1625 case PPP_INTR_DROP_DTR: /* DTR drop timeout expired 0x40 bit 6 */
1626 event_intr(card);
1627 break;
1628
1629 case PPP_INTR_TIMER:
1630 timer_intr(card);
1631 break;
1632
1633 default: /* unexpected interrupt */
1634 ++card->statistics.isr_spurious;
1635 printk(KERN_INFO "%s: spurious interrupt 0x%02X!\n",
1636 card->devname, flags->iflag);
1637 printk(KERN_INFO "%s: ID Bytes = ",card->devname);
1638 for(i = 0; i < 8; i ++)
1639 printk(KERN_INFO "0x%02X ", *(ptr + 0x28 + i));
1640 printk(KERN_INFO "\n");
1641 }
1642
1643 card->in_isr = 0;
1644 flags->iflag = 0;
1645 return;
1646}
1647
1648/*============================================================================
1649 * Receive interrupt handler.
1650 */
1651static void rx_intr(sdla_t *card)
1652{
1653 ppp_buf_ctl_t *rxbuf = card->rxmb;
1654 struct net_device *dev = card->wandev.dev;
1655 ppp_private_area_t *ppp_priv_area;
1656 struct sk_buff *skb;
1657 unsigned len;
1658 void *buf;
1659 int i;
1660 ppp_flags_t *flags = card->flags;
1661 char *ptr = &flags->iflag;
1662 int udp_type;
1663
1664
1665 if (rxbuf->flag != 0x01) {
1666
1667 printk(KERN_INFO
1668 "%s: corrupted Rx buffer @ 0x%X, flag = 0x%02X!\n",
1669 card->devname, (unsigned)rxbuf, rxbuf->flag);
1670
1671 printk(KERN_INFO "%s: ID Bytes = ",card->devname);
1672
1673 for(i = 0; i < 8; i ++)
1674 printk(KERN_INFO "0x%02X ", *(ptr + 0x28 + i));
1675 printk(KERN_INFO "\n");
1676
1677 ++card->statistics.rx_intr_corrupt_rx_bfr;
1678
1679
1680 /* Bug Fix: Mar 6 2000
1681 * If we get a corrupted mailbox, it means that driver
1682 * is out of sync with the firmware. There is no recovery.
1683 * If we don't turn off all interrupts for this card
1684 * the machine will crash.
1685 */
1686 printk(KERN_INFO "%s: Critical router failure ...!!!\n", card->devname);
1687 printk(KERN_INFO "Please contact Sangoma Technologies !\n");
1688 ppp_set_intr_mode(card,0);
1689 return;
1690 }
1691
1692 if (dev && netif_running(dev) && dev->priv){
1693
1694 len = rxbuf->length;
1695 ppp_priv_area = dev->priv;
1696
1697 /* Allocate socket buffer */
1698 skb = dev_alloc_skb(len);
1699
1700 if (skb != NULL) {
1701
1702 /* Copy data to the socket buffer */
1703 unsigned addr = rxbuf->buf.ptr;
1704
1705 if ((addr + len) > card->u.p.rx_top + 1) {
1706
1707 unsigned tmp = card->u.p.rx_top - addr + 1;
1708 buf = skb_put(skb, tmp);
1709 sdla_peek(&card->hw, addr, buf, tmp);
1710 addr = card->u.p.rx_base;
1711 len -= tmp;
1712 }
1713 buf = skb_put(skb, len);
1714 sdla_peek(&card->hw, addr, buf, len);
1715
1716 /* Decapsulate packet */
1717 switch (rxbuf->proto) {
1718
1719 case 0x00:
1720 skb->protocol = htons(ETH_P_IP);
1721 break;
1722
1723 case 0x01:
1724 skb->protocol = htons(ETH_P_IPX);
1725 break;
1726 }
1727
1728 udp_type = udp_pkt_type( skb, card );
1729
1730 if (udp_type == UDP_PTPIPE_TYPE){
1731
1732 /* Handle a UDP Request in Timer Interrupt */
1733 if(store_udp_mgmt_pkt(UDP_PKT_FRM_NETWORK, card, skb, dev,
1734 ppp_priv_area)){
1735 flags->imask |= PPP_INTR_TIMER;
1736 }
1737 ++ppp_priv_area->rx_intr_stat.rx_intr_PIPE_request;
1738
1739
1740 } else if (handle_IPXWAN(skb->data,card->devname,
1741 ppp_priv_area->enable_IPX,
1742 ppp_priv_area->network_number,
1743 skb->protocol)) {
1744
1745 /* Handle an IPXWAN packet */
1746 if( ppp_priv_area->enable_IPX) {
1747
1748 /* Make sure we are not already sending */
1749 if (!test_bit(SEND_CRIT, &card->wandev.critical)){
1750 ppp_send(card, skb->data, skb->len, htons(ETH_P_IPX));
1751 }
1752 dev_kfree_skb_any(skb);
1753
1754 } else {
1755 ++card->wandev.stats.rx_dropped;
1756 }
1757 } else {
1758 /* Pass data up the protocol stack */
1759 skb->dev = dev;
1760 skb->mac.raw = skb->data;
1761
1762 ++card->wandev.stats.rx_packets;
1763 card->wandev.stats.rx_bytes += skb->len;
1764 ++ppp_priv_area->rx_intr_stat.rx_intr_bfr_passed_to_stack;
1765 netif_rx(skb);
1766 dev->last_rx = jiffies;
1767 }
1768
1769 } else {
1770
1771 if (net_ratelimit()){
1772 printk(KERN_INFO "%s: no socket buffers available!\n",
1773 card->devname);
1774 }
1775 ++card->wandev.stats.rx_dropped;
1776 ++ppp_priv_area->rx_intr_stat.rx_intr_no_socket;
1777 }
1778
1779 } else {
1780 ++card->statistics.rx_intr_dev_not_started;
1781 }
1782
1783 /* Release buffer element and calculate a pointer to the next one */
1784 rxbuf->flag = 0x00;
1785 card->rxmb = ++rxbuf;
1786 if ((void*)rxbuf > card->u.p.rxbuf_last)
1787 card->rxmb = card->u.p.rxbuf_base;
1788}
1789
1790
1791void event_intr (sdla_t *card)
1792{
1793
1794 struct net_device* dev = card->wandev.dev;
1795 ppp_private_area_t* ppp_priv_area = dev->priv;
1796 volatile ppp_flags_t *flags = card->flags;
1797
1798 switch (flags->iflag){
1799
1800 case PPP_INTR_MODEM: /* modem status change (DCD, CTS) 0x04 (bit 2)*/
1801
1802 if (net_ratelimit()){
1803 printk (KERN_INFO "%s: Modem status: DCD=%s CTS=%s\n",
1804 card->devname, DCD(flags->mstatus), CTS(flags->mstatus));
1805 }
1806 break;
1807
1808 case PPP_INTR_DISC: /* Data link disconnected 0x10 (bit 4)*/
1809
1810 NEX_PRINTK (KERN_INFO "Data link disconnected intr Cause %X\n",
1811 flags->disc_cause);
1812
1813 if (flags->disc_cause &
1814 (PPP_LOCAL_TERMINATION | PPP_DCD_CTS_DROP |
1815 PPP_REMOTE_TERMINATION)) {
1816
1817 if (card->u.p.ip_mode == WANOPT_PPP_PEER) {
1818 set_bit(0,&Read_connection_info);
1819 }
1820 wanpipe_set_state(card, WAN_DISCONNECTED);
1821
1822 show_disc_cause(card, flags->disc_cause);
1823 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_PPP_EVENT;
1824 flags->imask |= PPP_INTR_TIMER;
1825 trigger_ppp_poll(dev);
1826 }
1827 break;
1828
1829 case PPP_INTR_OPEN: /* Data link open 0x20 (bit 5)*/
1830
1831 NEX_PRINTK (KERN_INFO "%s: PPP Link Open, LCP=%s IP=%s\n",
1832 card->devname,LCP(flags->lcp_state),
1833 IP(flags->ip_state));
1834
1835 if (flags->lcp_state == 0x09 &&
1836 (flags->ip_state == 0x09 || flags->ipx_state == 0x09)){
1837
1838 /* Initialize the polling timer and set the state
1839 * to WAN_CONNNECTED */
1840
1841
1842 /* BUG FIX: When the protocol restarts, during heavy
1843 * traffic, board tx buffers and driver tx buffers
1844 * can go out of sync. This checks the condition
1845 * and if the tx buffers are out of sync, the
1846 * protocols are restarted.
1847 * I don't know why the board tx buffer is out
1848 * of sync. It could be that a packets is tx
1849 * while the link is down, but that is not
1850 * possible. The other possiblility is that the
1851 * firmware doesn't reinitialize properly.
1852 * FIXME: A better fix should be found.
1853 */
1854 if (detect_and_fix_tx_bug(card)){
1855
1856 ppp_comm_disable(card);
1857
1858 wanpipe_set_state(card, WAN_DISCONNECTED);
1859
1860 ppp_priv_area->timer_int_enabled |=
1861 TMR_INT_ENABLED_PPP_EVENT;
1862 flags->imask |= PPP_INTR_TIMER;
1863 break;
1864 }
1865
1866 card->state_tick = jiffies;
1867 wanpipe_set_state(card, WAN_CONNECTED);
1868
1869 NEX_PRINTK(KERN_INFO "CON: L Tx: %lx B Tx: %lx || L Rx %lx B Rx %lx\n",
1870 (unsigned long)card->u.p.txbuf, *card->u.p.txbuf_next,
1871 (unsigned long)card->rxmb, *card->u.p.rxbuf_next);
1872
1873 /* Tell timer interrupt that PPP event occurred */
1874 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_PPP_EVENT;
1875 flags->imask |= PPP_INTR_TIMER;
1876
1877 /* If we are in PEER mode, we must first obtain the
1878 * IP information and then go into the poll routine */
1879 if (card->u.p.ip_mode != WANOPT_PPP_PEER){
1880 trigger_ppp_poll(dev);
1881 }
1882 }
1883 break;
1884
1885 case PPP_INTR_DROP_DTR: /* DTR drop timeout expired 0x40 bit 6 */
1886
1887 NEX_PRINTK(KERN_INFO "DTR Drop Timeout Interrrupt \n");
1888
1889 if (card->u.p.ip_mode == WANOPT_PPP_PEER) {
1890 set_bit(0,&Read_connection_info);
1891 }
1892
1893 wanpipe_set_state(card, WAN_DISCONNECTED);
1894
1895 show_disc_cause(card, flags->disc_cause);
1896 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_PPP_EVENT;
1897 flags->imask |= PPP_INTR_TIMER;
1898 trigger_ppp_poll(dev);
1899 break;
1900
1901 default:
1902 printk(KERN_INFO "%s: Error, Invalid PPP Event\n",card->devname);
1903 }
1904}
1905
1906
1907
1908/* TIMER INTERRUPT */
1909
1910void timer_intr (sdla_t *card)
1911{
1912
1913 struct net_device* dev = card->wandev.dev;
1914 ppp_private_area_t* ppp_priv_area = dev->priv;
1915 ppp_flags_t *flags = card->flags;
1916
1917
1918 if (ppp_priv_area->timer_int_enabled & TMR_INT_ENABLED_CONFIG){
1919 if (!config_ppp(card)){
1920 ppp_priv_area->timer_int_enabled &=
1921 ~TMR_INT_ENABLED_CONFIG;
1922 }
1923 }
1924
1925 /* Update statistics */
1926 if (ppp_priv_area->timer_int_enabled & TMR_INT_ENABLED_UPDATE){
1927 ppp_get_err_stats(card);
1928 if(!(--ppp_priv_area->update_comms_stats)){
1929 ppp_priv_area->timer_int_enabled &=
1930 ~TMR_INT_ENABLED_UPDATE;
1931 }
1932 }
1933
1934 /* PPIPEMON UDP request */
1935
1936 if (ppp_priv_area->timer_int_enabled & TMR_INT_ENABLED_UDP){
1937 process_udp_mgmt_pkt(card,dev, ppp_priv_area);
1938 ppp_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_UDP;
1939 }
1940
1941 /* PPP Event */
1942 if (ppp_priv_area->timer_int_enabled & TMR_INT_ENABLED_PPP_EVENT){
1943
1944 if (card->wandev.state == WAN_DISCONNECTED){
1945 retrigger_comm(card);
1946 }
1947
1948 /* If the state is CONNECTING, it means that communicatins were
1949 * enabled. When the remote side enables its comminication we
1950 * should get an interrupt PPP_INTR_OPEN, thus turn off polling
1951 */
1952
1953 else if (card->wandev.state == WAN_CONNECTING){
1954 /* Turn off the timer interrupt */
1955 ppp_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_PPP_EVENT;
1956 }
1957
1958 /* If state is connected and we are in PEER mode
1959 * poll for an IP address which will be provided by remote end.
1960 */
1961 else if ((card->wandev.state == WAN_CONNECTED &&
1962 card->u.p.ip_mode == WANOPT_PPP_PEER) &&
1963 test_bit(0,&Read_connection_info)){
1964
1965 card->state_tick = jiffies;
1966 if (read_connection_info (card)){
1967 printk(KERN_INFO "%s: Failed to read PEER IP Addresses\n",
1968 card->devname);
1969 }else{
1970 clear_bit(0,&Read_connection_info);
1971 set_bit(1,&Read_connection_info);
1972 trigger_ppp_poll(dev);
1973 }
1974 }else{
1975 //FIXME Put the comment back int
1976 ppp_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_PPP_EVENT;
1977 }
1978
1979 }/* End of PPP_EVENT */
1980
1981
1982 /* Only disable the timer interrupt if there are no udp, statistic */
1983 /* updates or events pending */
1984 if(!ppp_priv_area->timer_int_enabled) {
1985 flags->imask &= ~PPP_INTR_TIMER;
1986 }
1987}
1988
1989
1990static int handle_IPXWAN(unsigned char *sendpacket, char *devname, unsigned char enable_IPX, unsigned long network_number, unsigned short proto)
1991{
1992 int i;
1993
1994 if( proto == htons(ETH_P_IPX) ) {
1995 //It's an IPX packet
1996 if(!enable_IPX) {
1997 //Return 1 so we don't pass it up the stack.
1998 return 1;
1999 }
2000 } else {
2001 //It's not IPX so pass it up the stack.
2002 return 0;
2003 }
2004
2005 if( sendpacket[16] == 0x90 &&
2006 sendpacket[17] == 0x04)
2007 {
2008 //It's IPXWAN
2009
2010 if( sendpacket[2] == 0x02 &&
2011 sendpacket[34] == 0x00)
2012 {
2013 //It's a timer request packet
2014 printk(KERN_INFO "%s: Received IPXWAN Timer Request packet\n",devname);
2015
2016 //Go through the routing options and answer no to every
2017 //option except Unnumbered RIP/SAP
2018 for(i = 41; sendpacket[i] == 0x00; i += 5)
2019 {
2020 //0x02 is the option for Unnumbered RIP/SAP
2021 if( sendpacket[i + 4] != 0x02)
2022 {
2023 sendpacket[i + 1] = 0;
2024 }
2025 }
2026
2027 //Skip over the extended Node ID option
2028 if( sendpacket[i] == 0x04 )
2029 {
2030 i += 8;
2031 }
2032
2033 //We also want to turn off all header compression opt.
2034 for(; sendpacket[i] == 0x80 ;)
2035 {
2036 sendpacket[i + 1] = 0;
2037 i += (sendpacket[i + 2] << 8) + (sendpacket[i + 3]) + 4;
2038 }
2039
2040 //Set the packet type to timer response
2041 sendpacket[34] = 0x01;
2042
2043 printk(KERN_INFO "%s: Sending IPXWAN Timer Response\n",devname);
2044 }
2045 else if( sendpacket[34] == 0x02 )
2046 {
2047 //This is an information request packet
2048 printk(KERN_INFO "%s: Received IPXWAN Information Request packet\n",devname);
2049
2050 //Set the packet type to information response
2051 sendpacket[34] = 0x03;
2052
2053 //Set the router name
2054 sendpacket[51] = 'P';
2055 sendpacket[52] = 'T';
2056 sendpacket[53] = 'P';
2057 sendpacket[54] = 'I';
2058 sendpacket[55] = 'P';
2059 sendpacket[56] = 'E';
2060 sendpacket[57] = '-';
2061 sendpacket[58] = CVHexToAscii(network_number >> 28);
2062 sendpacket[59] = CVHexToAscii((network_number & 0x0F000000)>> 24);
2063 sendpacket[60] = CVHexToAscii((network_number & 0x00F00000)>> 20);
2064 sendpacket[61] = CVHexToAscii((network_number & 0x000F0000)>> 16);
2065 sendpacket[62] = CVHexToAscii((network_number & 0x0000F000)>> 12);
2066 sendpacket[63] = CVHexToAscii((network_number & 0x00000F00)>> 8);
2067 sendpacket[64] = CVHexToAscii((network_number & 0x000000F0)>> 4);
2068 sendpacket[65] = CVHexToAscii(network_number & 0x0000000F);
2069 for(i = 66; i < 99; i+= 1)
2070 {
2071 sendpacket[i] = 0;
2072 }
2073
2074 printk(KERN_INFO "%s: Sending IPXWAN Information Response packet\n",devname);
2075 }
2076 else
2077 {
2078 printk(KERN_INFO "%s: Unknown IPXWAN packet!\n",devname);
2079 return 0;
2080 }
2081
2082 //Set the WNodeID to our network address
2083 sendpacket[35] = (unsigned char)(network_number >> 24);
2084 sendpacket[36] = (unsigned char)((network_number & 0x00FF0000) >> 16);
2085 sendpacket[37] = (unsigned char)((network_number & 0x0000FF00) >> 8);
2086 sendpacket[38] = (unsigned char)(network_number & 0x000000FF);
2087
2088 return 1;
2089 } else {
2090 //If we get here it's an IPX-data packet, so it'll get passed up the stack.
2091
2092 //switch the network numbers
2093 switch_net_numbers(sendpacket, network_number, 1);
2094 return 0;
2095 }
2096}
2097
2098/****** Background Polling Routines ****************************************/
2099
2100/* All polling functions are invoked by the TIMER interrupt in the wpp_isr
2101 * routine.
2102 */
2103
2104/*============================================================================
2105 * Monitor active link phase.
2106 */
2107static void process_route (sdla_t *card)
2108{
2109 ppp_flags_t *flags = card->flags;
2110 struct net_device *dev = card->wandev.dev;
2111 ppp_private_area_t *ppp_priv_area = dev->priv;
2112
2113 if ((card->u.p.ip_mode == WANOPT_PPP_PEER) &&
2114 (flags->ip_state == 0x09)){
2115
2116 /* We get ip_local from the firmware in PEER mode.
2117 * Therefore, if ip_local is 0, we failed to obtain
2118 * the remote IP address. */
2119 if (ppp_priv_area->ip_local == 0)
2120 return;
2121
2122 printk(KERN_INFO "%s: IPCP State Opened.\n", card->devname);
2123 if (read_info( card )) {
2124 printk(KERN_INFO
2125 "%s: An error occurred in IP assignment.\n",
2126 card->devname);
2127 } else {
2128 struct in_device *in_dev = dev->ip_ptr;
2129 if (in_dev != NULL ) {
2130 struct in_ifaddr *ifa = in_dev->ifa_list;
2131
2132 printk(KERN_INFO "%s: Assigned Lcl. Addr: %u.%u.%u.%u\n",
2133 card->devname, NIPQUAD(ifa->ifa_local));
2134 printk(KERN_INFO "%s: Assigned Rmt. Addr: %u.%u.%u.%u\n",
2135 card->devname, NIPQUAD(ifa->ifa_address));
2136 }else{
2137 printk(KERN_INFO
2138 "%s: Error: Failed to add a route for PPP interface %s\n",
2139 card->devname,dev->name);
2140 }
2141 }
2142 }
2143}
2144
2145/*============================================================================
2146 * Monitor physical link disconnected phase.
2147 * o if interface is up and the hold-down timeout has expired, then retry
2148 * connection.
2149 */
2150static void retrigger_comm(sdla_t *card)
2151{
2152 struct net_device *dev = card->wandev.dev;
2153
2154 if (dev && ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) {
2155
2156 wanpipe_set_state(card, WAN_CONNECTING);
2157
2158 if(ppp_comm_enable(card) == CMD_OK){
2159 init_ppp_tx_rx_buff( card );
2160 }
2161 }
2162}
2163
2164/****** Miscellaneous Functions *********************************************/
2165
2166/*============================================================================
2167 * Configure S508 adapter.
2168 */
2169static int config508(struct net_device *dev, sdla_t *card)
2170{
2171 ppp508_conf_t cfg;
2172 struct in_device *in_dev = dev->ip_ptr;
2173 ppp_private_area_t *ppp_priv_area = dev->priv;
2174
2175 /* Prepare PPP configuration structure */
2176 memset(&cfg, 0, sizeof(ppp508_conf_t));
2177
2178 if (card->wandev.clocking)
2179 cfg.line_speed = card->wandev.bps;
2180
2181 if (card->wandev.interface == WANOPT_RS232)
2182 cfg.conf_flags |= INTERFACE_LEVEL_RS232;
2183
2184
2185 cfg.conf_flags |= DONT_TERMINATE_LNK_MAX_CONFIG; /*send Configure-Request packets forever*/
2186 cfg.txbuf_percent = PERCENT_TX_BUFF; /* % of Tx bufs */
2187 cfg.mtu_local = card->wandev.mtu;
2188 cfg.mtu_remote = card->wandev.mtu; /* Default */
2189 cfg.restart_tmr = TIME_BETWEEN_CONF_REQ; /* 30 = 3sec */
2190 cfg.auth_rsrt_tmr = TIME_BETWEEN_PAP_CHAP_REQ; /* 30 = 3sec */
2191 cfg.auth_wait_tmr = WAIT_PAP_CHAP_WITHOUT_REPLY; /* 300 = 30s */
2192 cfg.mdm_fail_tmr = WAIT_AFTER_DCD_CTS_LOW; /* 5 = 0.5s */
2193 cfg.dtr_drop_tmr = TIME_DCD_CTS_LOW_AFTER_LNK_DOWN; /* 10 = 1s */
2194 cfg.connect_tmout = WAIT_DCD_HIGH_AFTER_ENABLE_COMM; /* 900 = 90s */
2195 cfg.conf_retry = MAX_CONF_REQ_WITHOUT_REPLY; /* 10 = 1s */
2196 cfg.term_retry = MAX_TERM_REQ_WITHOUT_REPLY; /* 2 times */
2197 cfg.fail_retry = NUM_CONF_NAK_WITHOUT_REPLY; /* 5 times */
2198 cfg.auth_retry = NUM_AUTH_REQ_WITHOUT_REPLY; /* 10 times */
2199
2200
2201 if( !card->u.p.authenticator ) {
2202 printk(KERN_INFO "%s: Device is not configured as an authenticator\n",
2203 card->devname);
2204 cfg.auth_options = NO_AUTHENTICATION;
2205 }else{
2206 printk(KERN_INFO "%s: Device is configured as an authenticator\n",
2207 card->devname);
2208 cfg.auth_options = INBOUND_AUTH;
2209 }
2210
2211 if( ppp_priv_area->pap == WANOPT_YES){
2212 cfg.auth_options |=PAP_AUTH;
2213 printk(KERN_INFO "%s: Pap enabled\n", card->devname);
2214 }
2215 if( ppp_priv_area->chap == WANOPT_YES){
2216 cfg.auth_options |= CHAP_AUTH;
2217 printk(KERN_INFO "%s: Chap enabled\n", card->devname);
2218 }
2219
2220
2221 if (ppp_priv_area->enable_IPX == WANOPT_YES){
2222 printk(KERN_INFO "%s: Enabling IPX Protocol\n",card->devname);
2223 cfg.ipx_options = ENABLE_IPX | ROUTING_PROT_DEFAULT;
2224 }else{
2225 cfg.ipx_options = DISABLE_IPX;
2226 }
2227
2228 switch (card->u.p.ip_mode) {
2229
2230 case WANOPT_PPP_STATIC:
2231
2232 printk(KERN_INFO "%s: PPP IP Mode: STATIC\n",card->devname);
2233 cfg.ip_options = L_AND_R_IP_NO_ASSIG |
2234 ENABLE_IP;
2235 cfg.ip_local = in_dev->ifa_list->ifa_local;
2236 cfg.ip_remote = in_dev->ifa_list->ifa_address;
2237 /* Debugging code used to check that IP addresses
2238 * obtained from the kernel are correct */
2239
2240 NEX_PRINTK(KERN_INFO "Local %u.%u.%u.%u Remote %u.%u.%u.%u Name %s\n",
2241 NIPQUAD(ip_local),NIPQUAD(ip_remote), dev->name);
2242 break;
2243
2244 case WANOPT_PPP_HOST:
2245
2246 printk(KERN_INFO "%s: PPP IP Mode: HOST\n",card->devname);
2247 cfg.ip_options = L_IP_LOCAL_ASSIG |
2248 R_IP_LOCAL_ASSIG |
2249 ENABLE_IP;
2250 cfg.ip_local = in_dev->ifa_list->ifa_local;
2251 cfg.ip_remote = in_dev->ifa_list->ifa_address;
2252 /* Debugging code used to check that IP addresses
2253 * obtained from the kernel are correct */
2254 NEX_PRINTK (KERN_INFO "Local %u.%u.%u.%u Remote %u.%u.%u.%u Name %s\n",
2255 NIPQUAD(ip_local),NIPQUAD(ip_remote), dev->name);
2256
2257 break;
2258
2259 case WANOPT_PPP_PEER:
2260
2261 printk(KERN_INFO "%s: PPP IP Mode: PEER\n",card->devname);
2262 cfg.ip_options = L_IP_REMOTE_ASSIG |
2263 R_IP_REMOTE_ASSIG |
2264 ENABLE_IP;
2265 cfg.ip_local = 0x00;
2266 cfg.ip_remote = 0x00;
2267 break;
2268
2269 default:
2270 printk(KERN_INFO "%s: ERROR: Unsupported PPP Mode Selected\n",
2271 card->devname);
2272 printk(KERN_INFO "%s: PPP IP Modes: STATIC, PEER or HOST\n",
2273 card->devname);
2274 return 1;
2275 }
2276
2277 return ppp_configure(card, &cfg);
2278}
2279
2280/*============================================================================
2281 * Show disconnection cause.
2282 */
2283static void show_disc_cause(sdla_t *card, unsigned cause)
2284{
2285 if (cause & 0x0802)
2286
2287 printk(KERN_INFO "%s: link terminated by peer\n",
2288 card->devname);
2289
2290 else if (cause & 0x0004)
2291
2292 printk(KERN_INFO "%s: link terminated by user\n",
2293 card->devname);
2294
2295 else if (cause & 0x0008)
2296
2297 printk(KERN_INFO "%s: authentication failed\n", card->devname);
2298
2299 else if (cause & 0x0010)
2300
2301 printk(KERN_INFO
2302 "%s: authentication protocol negotiation failed\n",
2303 card->devname);
2304
2305 else if (cause & 0x0020)
2306
2307 printk(KERN_INFO
2308 "%s: peer's request for authentication rejected\n",
2309 card->devname);
2310
2311 else if (cause & 0x0040)
2312
2313 printk(KERN_INFO "%s: MRU option rejected by peer\n",
2314 card->devname);
2315
2316 else if (cause & 0x0080)
2317
2318 printk(KERN_INFO "%s: peer's MRU was too small\n",
2319 card->devname);
2320
2321 else if (cause & 0x0100)
2322
2323 printk(KERN_INFO "%s: failed to negotiate peer's LCP options\n",
2324 card->devname);
2325
2326 else if (cause & 0x0200)
2327
2328 printk(KERN_INFO "%s: failed to negotiate peer's IPCP options\n"
2329 , card->devname);
2330
2331 else if (cause & 0x0400)
2332
2333 printk(KERN_INFO
2334 "%s: failed to negotiate peer's IPXCP options\n",
2335 card->devname);
2336}
2337
2338/*=============================================================================
2339 * Process UDP call of type PTPIPEAB.
2340 */
2341static void process_udp_mgmt_pkt(sdla_t *card, struct net_device *dev,
2342 ppp_private_area_t *ppp_priv_area )
2343{
2344 unsigned char buf2[5];
2345 unsigned char *buf;
2346 unsigned int frames, len;
2347 struct sk_buff *new_skb;
2348 unsigned short data_length, buffer_length, real_len;
2349 unsigned long data_ptr;
2350 int udp_mgmt_req_valid = 1;
2351 ppp_mbox_t *mbox = card->mbox;
2352 struct timeval tv;
2353 int err;
2354 ppp_udp_pkt_t *ppp_udp_pkt = (ppp_udp_pkt_t*)&ppp_priv_area->udp_pkt_data;
2355
2356 memcpy(&buf2, &card->wandev.udp_port, 2 );
2357
2358
2359 if(ppp_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) {
2360
2361 switch(ppp_udp_pkt->cblock.command) {
2362
2363 case PPIPE_GET_IBA_DATA:
2364 case PPP_READ_CONFIG:
2365 case PPP_GET_CONNECTION_INFO:
2366 case PPIPE_ROUTER_UP_TIME:
2367 case PPP_READ_STATISTICS:
2368 case PPP_READ_ERROR_STATS:
2369 case PPP_READ_PACKET_STATS:
2370 case PPP_READ_LCP_STATS:
2371 case PPP_READ_IPCP_STATS:
2372 case PPP_READ_IPXCP_STATS:
2373 case PPP_READ_PAP_STATS:
2374 case PPP_READ_CHAP_STATS:
2375 case PPP_READ_CODE_VERSION:
2376 udp_mgmt_req_valid = 1;
2377 break;
2378
2379 default:
2380 udp_mgmt_req_valid = 0;
2381 break;
2382 }
2383 }
2384
2385 if(!udp_mgmt_req_valid) {
2386
2387 /* set length to 0 */
2388 ppp_udp_pkt->cblock.length = 0x00;
2389
2390 /* set return code */
2391 ppp_udp_pkt->cblock.result = 0xCD;
2392 ++ppp_priv_area->pipe_mgmt_stat.UDP_PIPE_mgmt_direction_err;
2393
2394 if (net_ratelimit()){
2395 printk(KERN_INFO
2396 "%s: Warning, Illegal UDP command attempted from network: %x\n",
2397 card->devname,ppp_udp_pkt->cblock.command);
2398 }
2399 } else {
2400 /* Initialize the trace element */
2401 trace_element_t trace_element;
2402
2403 switch (ppp_udp_pkt->cblock.command){
2404
2405 /* PPIPE_ENABLE_TRACING */
2406 case PPIPE_ENABLE_TRACING:
2407 if (!card->TracingEnabled) {
2408
2409 /* OPERATE_DATALINE_MONITOR */
2410 mbox->cmd.command = PPP_DATALINE_MONITOR;
2411 mbox->cmd.length = 0x01;
2412 mbox->data[0] = ppp_udp_pkt->data[0];
2413 err = sdla_exec(mbox) ?
2414 mbox->cmd.result : CMD_TIMEOUT;
2415
2416 if (err != CMD_OK) {
2417
2418 ppp_error(card, err, mbox);
2419 card->TracingEnabled = 0;
2420
2421 /* set the return code */
2422
2423 ppp_udp_pkt->cblock.result = mbox->cmd.result;
2424 mbox->cmd.length = 0;
2425 break;
2426 }
2427
2428 sdla_peek(&card->hw, 0xC000, &buf2, 2);
2429
2430 ppp_priv_area->curr_trace_addr = 0;
2431 memcpy(&ppp_priv_area->curr_trace_addr, &buf2, 2);
2432 ppp_priv_area->start_trace_addr =
2433 ppp_priv_area->curr_trace_addr;
2434 ppp_priv_area->end_trace_addr =
2435 ppp_priv_area->start_trace_addr + END_OFFSET;
2436
2437 /* MAX_SEND_BUFFER_SIZE - 28 (IP header)
2438 - 32 (ppipemon CBLOCK) */
2439 available_buffer_space = MAX_LGTH_UDP_MGNT_PKT -
2440 sizeof(ip_pkt_t)-
2441 sizeof(udp_pkt_t)-
2442 sizeof(wp_mgmt_t)-
2443 sizeof(cblock_t);
2444 }
2445 ppp_udp_pkt->cblock.result = 0;
2446 mbox->cmd.length = 0;
2447 card->TracingEnabled = 1;
2448 break;
2449
2450 /* PPIPE_DISABLE_TRACING */
2451 case PPIPE_DISABLE_TRACING:
2452
2453 if(card->TracingEnabled) {
2454
2455 /* OPERATE_DATALINE_MONITOR */
2456 mbox->cmd.command = 0x33;
2457 mbox->cmd.length = 1;
2458 mbox->data[0] = 0x00;
2459 err = sdla_exec(mbox) ?
2460 mbox->cmd.result : CMD_TIMEOUT;
2461
2462 }
2463
2464 /*set return code*/
2465 ppp_udp_pkt->cblock.result = 0;
2466 mbox->cmd.length = 0;
2467 card->TracingEnabled = 0;
2468 break;
2469
2470 /* PPIPE_GET_TRACE_INFO */
2471 case PPIPE_GET_TRACE_INFO:
2472
2473 if(!card->TracingEnabled) {
2474 /* set return code */
2475 ppp_udp_pkt->cblock.result = 1;
2476 mbox->cmd.length = 0;
2477 }
2478
2479 buffer_length = 0;
2480
2481 /* frames < 62, where 62 is the number of trace
2482 information elements. There is in total 496
2483 bytes of space and each trace information
2484 element is 8 bytes.
2485 */
2486 for ( frames=0; frames<62; frames++) {
2487
2488 trace_pkt_t *trace_pkt = (trace_pkt_t *)
2489 &ppp_udp_pkt->data[buffer_length];
2490
2491 /* Read the whole trace packet */
2492 sdla_peek(&card->hw, ppp_priv_area->curr_trace_addr,
2493 &trace_element, sizeof(trace_element_t));
2494
2495 /* no data on board so exit */
2496 if( trace_element.opp_flag == 0x00 )
2497 break;
2498
2499 data_ptr = trace_element.trace_data_ptr;
2500
2501 /* See if there is actual data on the trace buffer */
2502 if (data_ptr){
2503 data_length = trace_element.trace_length;
2504 }else{
2505 data_length = 0;
2506 ppp_udp_pkt->data[0] |= 0x02;
2507 }
2508
2509 //FIXME: Do we need this check
2510 if ((available_buffer_space - buffer_length)
2511 < (sizeof(trace_element_t)+1)){
2512
2513 /*indicate we have more frames
2514 * on board and exit
2515 */
2516 ppp_udp_pkt->data[0] |= 0x02;
2517 break;
2518 }
2519
2520 trace_pkt->status = trace_element.trace_type;
2521 trace_pkt->time_stamp = trace_element.trace_time_stamp;
2522 trace_pkt->real_length = trace_element.trace_length;
2523
2524 real_len = trace_element.trace_length;
2525
2526 if(data_ptr == 0){
2527 trace_pkt->data_avail = 0x00;
2528 }else{
2529 /* we can take it next time */
2530 if ((available_buffer_space - buffer_length)<
2531 (real_len + sizeof(trace_pkt_t))){
2532
2533 ppp_udp_pkt->data[0] |= 0x02;
2534 break;
2535 }
2536 trace_pkt->data_avail = 0x01;
2537
2538 /* get the data */
2539 sdla_peek(&card->hw, data_ptr,
2540 &trace_pkt->data,
2541 real_len);
2542 }
2543 /* zero the opp flag to
2544 show we got the frame */
2545 buf2[0] = 0x00;
2546 sdla_poke(&card->hw, ppp_priv_area->curr_trace_addr,
2547 &buf2, 1);
2548
2549 /* now move onto the next
2550 frame */
2551 ppp_priv_area->curr_trace_addr += 8;
2552
2553 /* check if we passed the last address */
2554 if ( ppp_priv_area->curr_trace_addr >=
2555 ppp_priv_area->end_trace_addr){
2556
2557 ppp_priv_area->curr_trace_addr =
2558 ppp_priv_area->start_trace_addr;
2559 }
2560
2561 /* update buffer length and make sure its even */
2562
2563 if ( trace_pkt->data_avail == 0x01 ) {
2564 buffer_length += real_len - 1;
2565 }
2566
2567 /* for the header */
2568 buffer_length += 8;
2569
2570 if( buffer_length & 0x0001 )
2571 buffer_length += 1;
2572 }
2573
2574 /* ok now set the total number of frames passed
2575 in the high 5 bits */
2576 ppp_udp_pkt->data[0] |= (frames << 2);
2577
2578 /* set the data length */
2579 mbox->cmd.length = buffer_length;
2580 ppp_udp_pkt->cblock.length = buffer_length;
2581
2582 /* set return code */
2583 ppp_udp_pkt->cblock.result = 0;
2584 break;
2585
2586 /* PPIPE_GET_IBA_DATA */
2587 case PPIPE_GET_IBA_DATA:
2588
2589 mbox->cmd.length = 0x09;
2590
2591 sdla_peek(&card->hw, 0xF003, &ppp_udp_pkt->data,
2592 mbox->cmd.length);
2593
2594 /* set the length of the data */
2595 ppp_udp_pkt->cblock.length = 0x09;
2596
2597 /* set return code */
2598 ppp_udp_pkt->cblock.result = 0x00;
2599 ppp_udp_pkt->cblock.result = 0;
2600 break;
2601
2602 /* PPIPE_FT1_READ_STATUS */
2603 case PPIPE_FT1_READ_STATUS:
2604 sdla_peek(&card->hw, 0xF020, &ppp_udp_pkt->data[0], 2);
2605 ppp_udp_pkt->cblock.length = mbox->cmd.length = 2;
2606 ppp_udp_pkt->cblock.result = 0;
2607 break;
2608
2609 case PPIPE_FLUSH_DRIVER_STATS:
2610 init_ppp_priv_struct( ppp_priv_area );
2611 init_global_statistics( card );
2612 mbox->cmd.length = 0;
2613 ppp_udp_pkt->cblock.result = 0;
2614 break;
2615
2616
2617 case PPIPE_ROUTER_UP_TIME:
2618
2619 do_gettimeofday( &tv );
2620 ppp_priv_area->router_up_time = tv.tv_sec -
2621 ppp_priv_area->router_start_time;
2622 *(unsigned long *)&ppp_udp_pkt->data = ppp_priv_area->router_up_time;
2623 mbox->cmd.length = 4;
2624 ppp_udp_pkt->cblock.result = 0;
2625 break;
2626
2627 /* PPIPE_DRIVER_STATISTICS */
2628 case PPIPE_DRIVER_STAT_IFSEND:
2629 memcpy(&ppp_udp_pkt->data, &ppp_priv_area->if_send_stat,
2630 sizeof(if_send_stat_t));
2631
2632
2633 ppp_udp_pkt->cblock.result = 0;
2634 ppp_udp_pkt->cblock.length = sizeof(if_send_stat_t);
2635 mbox->cmd.length = sizeof(if_send_stat_t);
2636 break;
2637
2638 case PPIPE_DRIVER_STAT_INTR:
2639 memcpy(&ppp_udp_pkt->data, &card->statistics,
2640 sizeof(global_stats_t));
2641
2642 memcpy(&ppp_udp_pkt->data+sizeof(global_stats_t),
2643 &ppp_priv_area->rx_intr_stat,
2644 sizeof(rx_intr_stat_t));
2645
2646 ppp_udp_pkt->cblock.result = 0;
2647 ppp_udp_pkt->cblock.length = sizeof(global_stats_t)+
2648 sizeof(rx_intr_stat_t);
2649 mbox->cmd.length = ppp_udp_pkt->cblock.length;
2650 break;
2651
2652 case PPIPE_DRIVER_STAT_GEN:
2653 memcpy( &ppp_udp_pkt->data,
2654 &ppp_priv_area->pipe_mgmt_stat,
2655 sizeof(pipe_mgmt_stat_t));
2656
2657 memcpy(&ppp_udp_pkt->data+sizeof(pipe_mgmt_stat_t),
2658 &card->statistics, sizeof(global_stats_t));
2659
2660 ppp_udp_pkt->cblock.result = 0;
2661 ppp_udp_pkt->cblock.length = sizeof(global_stats_t)+
2662 sizeof(rx_intr_stat_t);
2663 mbox->cmd.length = ppp_udp_pkt->cblock.length;
2664 break;
2665
2666
2667 /* FT1 MONITOR STATUS */
2668 case FT1_MONITOR_STATUS_CTRL:
2669
2670 /* Enable FT1 MONITOR STATUS */
2671 if( ppp_udp_pkt->data[0] == 1) {
2672
2673 if( rCount++ != 0 ) {
2674 ppp_udp_pkt->cblock.result = 0;
2675 mbox->cmd.length = 1;
2676 break;
2677 }
2678 }
2679
2680 /* Disable FT1 MONITOR STATUS */
2681 if( ppp_udp_pkt->data[0] == 0) {
2682
2683 if( --rCount != 0) {
2684 ppp_udp_pkt->cblock.result = 0;
2685 mbox->cmd.length = 1;
2686 break;
2687 }
2688 }
2689 goto udp_dflt_cmd;
2690
2691 /* WARNING: FIXME: This should be fixed.
2692 * The FT1 Status Ctrl doesn't have a break
2693 * statment. Thus, no code must be inserted
2694 * HERE: between default and above case statement */
2695
2696 default:
2697udp_dflt_cmd:
2698
2699 /* it's a board command */
2700 mbox->cmd.command = ppp_udp_pkt->cblock.command;
2701 mbox->cmd.length = ppp_udp_pkt->cblock.length;
2702
2703 if(mbox->cmd.length) {
2704 memcpy(&mbox->data,(unsigned char *)ppp_udp_pkt->data,
2705 mbox->cmd.length);
2706 }
2707
2708 /* run the command on the board */
2709 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2710
2711 if (err != CMD_OK) {
2712
2713 ppp_error(card, err, mbox);
2714 ++ppp_priv_area->pipe_mgmt_stat.
2715 UDP_PIPE_mgmt_adptr_cmnd_timeout;
2716 break;
2717 }
2718
2719 ++ppp_priv_area->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_cmnd_OK;
2720
2721 /* copy the result back to our buffer */
2722 memcpy(&ppp_udp_pkt->cblock,mbox, sizeof(cblock_t));
2723
2724 if(mbox->cmd.length) {
2725 memcpy(&ppp_udp_pkt->data,&mbox->data,mbox->cmd.length);
2726 }
2727
2728 } /* end of switch */
2729 } /* end of else */
2730
2731 /* Fill UDP TTL */
2732 ppp_udp_pkt->ip_pkt.ttl = card->wandev.ttl;
2733 len = reply_udp(ppp_priv_area->udp_pkt_data, mbox->cmd.length);
2734
2735 if (ppp_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) {
2736
2737 /* Make sure we are not already sending */
2738 if (!test_bit(SEND_CRIT,&card->wandev.critical)){
2739 ++ppp_priv_area->pipe_mgmt_stat.UDP_PIPE_mgmt_passed_to_adptr;
2740 ppp_send(card,ppp_priv_area->udp_pkt_data,len,ppp_priv_area->protocol);
2741 }
2742
2743 } else {
2744
2745 /* Pass it up the stack
2746 Allocate socket buffer */
2747 if ((new_skb = dev_alloc_skb(len)) != NULL) {
2748
2749 /* copy data into new_skb */
2750
2751 buf = skb_put(new_skb, len);
2752 memcpy(buf,ppp_priv_area->udp_pkt_data, len);
2753
2754 ++ppp_priv_area->pipe_mgmt_stat.UDP_PIPE_mgmt_passed_to_stack;
2755
2756 /* Decapsulate packet and pass it up the protocol
2757 stack */
2758 new_skb->protocol = htons(ETH_P_IP);
2759 new_skb->dev = dev;
2760 new_skb->mac.raw = new_skb->data;
2761 netif_rx(new_skb);
2762 dev->last_rx = jiffies;
2763
2764 } else {
2765
2766 ++ppp_priv_area->pipe_mgmt_stat.UDP_PIPE_mgmt_no_socket;
2767 printk(KERN_INFO "no socket buffers available!\n");
2768 }
2769 }
2770
2771 ppp_priv_area->udp_pkt_lgth = 0;
2772
2773 return;
2774}
2775
2776/*=============================================================================
2777 * Initial the ppp_private_area structure.
2778 */
2779static void init_ppp_priv_struct( ppp_private_area_t *ppp_priv_area )
2780{
2781
2782 memset(&ppp_priv_area->if_send_stat, 0, sizeof(if_send_stat_t));
2783 memset(&ppp_priv_area->rx_intr_stat, 0, sizeof(rx_intr_stat_t));
2784 memset(&ppp_priv_area->pipe_mgmt_stat, 0, sizeof(pipe_mgmt_stat_t));
2785}
2786
2787/*============================================================================
2788 * Initialize Global Statistics
2789 */
2790static void init_global_statistics( sdla_t *card )
2791{
2792 memset(&card->statistics, 0, sizeof(global_stats_t));
2793}
2794
2795/*============================================================================
2796 * Initialize Receive and Transmit Buffers.
2797 */
2798static void init_ppp_tx_rx_buff( sdla_t *card )
2799{
2800 ppp508_buf_info_t* info;
2801
2802 if (card->hw.type == SDLA_S514) {
2803
2804 info = (void*)(card->hw.dpmbase + PPP514_BUF_OFFS);
2805
2806 card->u.p.txbuf_base = (void*)(card->hw.dpmbase +
2807 info->txb_ptr);
2808
2809 card->u.p.txbuf_last = (ppp_buf_ctl_t*)card->u.p.txbuf_base +
2810 (info->txb_num - 1);
2811
2812 card->u.p.rxbuf_base = (void*)(card->hw.dpmbase +
2813 info->rxb_ptr);
2814
2815 card->u.p.rxbuf_last = (ppp_buf_ctl_t*)card->u.p.rxbuf_base +
2816 (info->rxb_num - 1);
2817
2818 } else {
2819
2820 info = (void*)(card->hw.dpmbase + PPP508_BUF_OFFS);
2821
2822 card->u.p.txbuf_base = (void*)(card->hw.dpmbase +
2823 (info->txb_ptr - PPP508_MB_VECT));
2824
2825 card->u.p.txbuf_last = (ppp_buf_ctl_t*)card->u.p.txbuf_base +
2826 (info->txb_num - 1);
2827
2828 card->u.p.rxbuf_base = (void*)(card->hw.dpmbase +
2829 (info->rxb_ptr - PPP508_MB_VECT));
2830
2831 card->u.p.rxbuf_last = (ppp_buf_ctl_t*)card->u.p.rxbuf_base +
2832 (info->rxb_num - 1);
2833 }
2834
2835 card->u.p.txbuf_next = (unsigned long*)&info->txb_nxt;
2836 card->u.p.rxbuf_next = (unsigned long*)&info->rxb1_ptr;
2837
2838 card->u.p.rx_base = info->rxb_base;
2839 card->u.p.rx_top = info->rxb_end;
2840
2841 card->u.p.txbuf = card->u.p.txbuf_base;
2842 card->rxmb = card->u.p.rxbuf_base;
2843
2844}
2845
2846/*=============================================================================
2847 * Read Connection Information (ie for Remote IP address assginment).
2848 * Called when ppp interface connected.
2849 */
2850static int read_info( sdla_t *card )
2851{
2852 struct net_device *dev = card->wandev.dev;
2853 ppp_private_area_t *ppp_priv_area = dev->priv;
2854 int err;
2855
2856 struct ifreq if_info;
2857 struct sockaddr_in *if_data1, *if_data2;
2858 mm_segment_t fs;
2859
2860 /* Set Local and remote addresses */
2861 memset(&if_info, 0, sizeof(if_info));
2862 strcpy(if_info.ifr_name, dev->name);
2863
2864
2865 fs = get_fs();
2866 set_fs(get_ds()); /* get user space block */
2867
2868 /* Change the local and remote ip address of the interface.
2869 * This will also add in the destination route.
2870 */
2871 if_data1 = (struct sockaddr_in *)&if_info.ifr_addr;
2872 if_data1->sin_addr.s_addr = ppp_priv_area->ip_local;
2873 if_data1->sin_family = AF_INET;
2874 err = devinet_ioctl( SIOCSIFADDR, &if_info );
2875 if_data2 = (struct sockaddr_in *)&if_info.ifr_dstaddr;
2876 if_data2->sin_addr.s_addr = ppp_priv_area->ip_remote;
2877 if_data2->sin_family = AF_INET;
2878 err = devinet_ioctl( SIOCSIFDSTADDR, &if_info );
2879
2880 set_fs(fs); /* restore old block */
2881
2882 if (err) {
2883 printk (KERN_INFO "%s: Adding of route failed: %i\n",
2884 card->devname,err);
2885 printk (KERN_INFO "%s: Local : %u.%u.%u.%u\n",
2886 card->devname,NIPQUAD(ppp_priv_area->ip_local));
2887 printk (KERN_INFO "%s: Remote: %u.%u.%u.%u\n",
2888 card->devname,NIPQUAD(ppp_priv_area->ip_remote));
2889 }
2890 return err;
2891}
2892
2893/*=============================================================================
2894 * Remove Dynamic Route.
2895 * Called when ppp interface disconnected.
2896 */
2897
2898static void remove_route( sdla_t *card )
2899{
2900
2901 struct net_device *dev = card->wandev.dev;
2902 long ip_addr;
2903 int err;
2904
2905 mm_segment_t fs;
2906 struct ifreq if_info;
2907 struct sockaddr_in *if_data1;
2908 struct in_device *in_dev = dev->ip_ptr;
2909 struct in_ifaddr *ifa = in_dev->ifa_list;
2910
2911 ip_addr = ifa->ifa_local;
2912
2913 /* Set Local and remote addresses */
2914 memset(&if_info, 0, sizeof(if_info));
2915 strcpy(if_info.ifr_name, dev->name);
2916
2917 fs = get_fs();
2918 set_fs(get_ds()); /* get user space block */
2919
2920 /* Change the local ip address of the interface to 0.
2921 * This will also delete the destination route.
2922 */
2923 if_data1 = (struct sockaddr_in *)&if_info.ifr_addr;
2924 if_data1->sin_addr.s_addr = 0;
2925 if_data1->sin_family = AF_INET;
2926 err = devinet_ioctl( SIOCSIFADDR, &if_info );
2927
2928 set_fs(fs); /* restore old block */
2929
2930
2931 if (err) {
2932 printk (KERN_INFO "%s: Deleting dynamic route failed %d!\n",
2933 card->devname, err);
2934 return;
2935 }else{
2936 printk (KERN_INFO "%s: PPP Deleting dynamic route %u.%u.%u.%u successfuly\n",
2937 card->devname, NIPQUAD(ip_addr));
2938 }
2939 return;
2940}
2941
2942/*=============================================================================
2943 * Perform the Interrupt Test by running the READ_CODE_VERSION command MAX_INTR
2944 * _TEST_COUNTER times.
2945 */
2946static int intr_test( sdla_t *card )
2947{
2948 ppp_mbox_t *mb = card->mbox;
2949 int err,i;
2950
2951 err = ppp_set_intr_mode( card, 0x08 );
2952
2953 if (err == CMD_OK) {
2954
2955 for (i = 0; i < MAX_INTR_TEST_COUNTER; i ++) {
2956 /* Run command READ_CODE_VERSION */
2957 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
2958 mb->cmd.length = 0;
2959 mb->cmd.command = PPP_READ_CODE_VERSION;
2960 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
2961 if (err != CMD_OK)
2962 ppp_error(card, err, mb);
2963 }
2964 }
2965 else return err;
2966
2967 err = ppp_set_intr_mode( card, 0 );
2968 if (err != CMD_OK)
2969 return err;
2970
2971 return 0;
2972}
2973
2974/*==============================================================================
2975 * Determine what type of UDP call it is. DRVSTATS or PTPIPEAB ?
2976 */
2977static int udp_pkt_type( struct sk_buff *skb, sdla_t *card )
2978{
2979 unsigned char *sendpacket;
2980 unsigned char buf2[5];
2981 ppp_udp_pkt_t *ppp_udp_pkt = (ppp_udp_pkt_t *)skb->data;
2982
2983 sendpacket = skb->data;
2984 memcpy(&buf2, &card->wandev.udp_port, 2);
2985
2986 if( ppp_udp_pkt->ip_pkt.ver_inet_hdr_length == 0x45 && /* IP packet */
2987 sendpacket[9] == 0x11 && /* UDP packet */
2988 sendpacket[22] == buf2[1] && /* UDP Port */
2989 sendpacket[23] == buf2[0] &&
2990 sendpacket[36] == 0x01 ) {
2991
2992 if ( sendpacket[28] == 0x50 && /* PTPIPEAB: Signature */
2993 sendpacket[29] == 0x54 &&
2994 sendpacket[30] == 0x50 &&
2995 sendpacket[31] == 0x49 &&
2996 sendpacket[32] == 0x50 &&
2997 sendpacket[33] == 0x45 &&
2998 sendpacket[34] == 0x41 &&
2999 sendpacket[35] == 0x42 ){
3000
3001 return UDP_PTPIPE_TYPE;
3002
3003 } else if(sendpacket[28] == 0x44 && /* DRVSTATS: Signature */
3004 sendpacket[29] == 0x52 &&
3005 sendpacket[30] == 0x56 &&
3006 sendpacket[31] == 0x53 &&
3007 sendpacket[32] == 0x54 &&
3008 sendpacket[33] == 0x41 &&
3009 sendpacket[34] == 0x54 &&
3010 sendpacket[35] == 0x53 ){
3011
3012 return UDP_DRVSTATS_TYPE;
3013
3014 } else
3015 return UDP_INVALID_TYPE;
3016
3017 } else
3018 return UDP_INVALID_TYPE;
3019
3020}
3021
3022/*============================================================================
3023 * Check to see if the packet to be transmitted contains a broadcast or
3024 * multicast source IP address.
3025 */
3026
3027static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
3028 struct sk_buff *skb)
3029{
3030 u32 src_ip_addr;
3031 u32 broadcast_ip_addr = 0;
3032 struct in_device *in_dev;
3033
3034 /* read the IP source address from the outgoing packet */
3035 src_ip_addr = *(u32 *)(skb->data + 12);
3036
3037 /* read the IP broadcast address for the device */
3038 in_dev = dev->ip_ptr;
3039 if(in_dev != NULL) {
3040 struct in_ifaddr *ifa= in_dev->ifa_list;
3041 if(ifa != NULL)
3042 broadcast_ip_addr = ifa->ifa_broadcast;
3043 else
3044 return 0;
3045 }
3046
3047 /* check if the IP Source Address is a Broadcast address */
3048 if((dev->flags & IFF_BROADCAST) && (src_ip_addr == broadcast_ip_addr)) {
3049 printk(KERN_INFO "%s: Broadcast Source Address silently discarded\n",
3050 card->devname);
3051 return 1;
3052 }
3053
3054 /* check if the IP Source Address is a Multicast address */
3055 if((ntohl(src_ip_addr) >= 0xE0000001) &&
3056 (ntohl(src_ip_addr) <= 0xFFFFFFFE)) {
3057 printk(KERN_INFO "%s: Multicast Source Address silently discarded\n",
3058 card->devname);
3059 return 1;
3060 }
3061
3062 return 0;
3063}
3064
3065void s508_lock (sdla_t *card, unsigned long *smp_flags)
3066{
3067 spin_lock_irqsave(&card->wandev.lock, *smp_flags);
3068}
3069
3070void s508_unlock (sdla_t *card, unsigned long *smp_flags)
3071{
3072 spin_unlock_irqrestore(&card->wandev.lock, *smp_flags);
3073}
3074
3075static int read_connection_info (sdla_t *card)
3076{
3077 ppp_mbox_t *mb = card->mbox;
3078 struct net_device *dev = card->wandev.dev;
3079 ppp_private_area_t *ppp_priv_area = dev->priv;
3080 ppp508_connect_info_t *ppp508_connect_info;
3081 int err;
3082
3083 memset(&mb->cmd, 0, sizeof(ppp_cmd_t));
3084 mb->cmd.length = 0;
3085 mb->cmd.command = PPP_GET_CONNECTION_INFO;
3086 err = sdla_exec(mb) ? mb->cmd.result : CMD_TIMEOUT;
3087
3088 if (err != CMD_OK) {
3089 ppp_error(card, err, mb);
3090 ppp_priv_area->ip_remote = 0;
3091 ppp_priv_area->ip_local = 0;
3092 }
3093 else {
3094 ppp508_connect_info = (ppp508_connect_info_t *)mb->data;
3095 ppp_priv_area->ip_remote = ppp508_connect_info->ip_remote;
3096 ppp_priv_area->ip_local = ppp508_connect_info->ip_local;
3097
3098 NEX_PRINTK(KERN_INFO "READ CONNECTION GOT IP ADDRESS %x, %x\n",
3099 ppp_priv_area->ip_remote,
3100 ppp_priv_area->ip_local);
3101 }
3102
3103 return err;
3104}
3105
3106/*===============================================================================
3107 * config_ppp
3108 *
3109 * Configure the ppp protocol and enable communications.
3110 *
3111 * The if_open function binds this function to the poll routine.
3112 * Therefore, this function will run every time the ppp interface
3113 * is brought up.
3114 *
3115 * If the communications are not enabled, proceed to configure
3116 * the card and enable communications.
3117 *
3118 * If the communications are enabled, it means that the interface
3119 * was shutdown by ether the user or driver. In this case, we
3120 * have to check that the IP addresses have not changed. If
3121 * the IP addresses changed, we have to reconfigure the firmware
3122 * and update the changed IP addresses. Otherwise, just exit.
3123 */
3124static int config_ppp (sdla_t *card)
3125{
3126
3127 struct net_device *dev = card->wandev.dev;
3128 ppp_flags_t *flags = card->flags;
3129 ppp_private_area_t *ppp_priv_area = dev->priv;
3130
3131 if (card->u.p.comm_enabled){
3132
3133 if (ppp_priv_area->ip_local_tmp != ppp_priv_area->ip_local ||
3134 ppp_priv_area->ip_remote_tmp != ppp_priv_area->ip_remote){
3135
3136 /* The IP addersses have changed, we must
3137 * stop the communications and reconfigure
3138 * the card. Reason: the firmware must know
3139 * the local and remote IP addresses. */
3140 disable_comm(card);
3141 wanpipe_set_state(card, WAN_DISCONNECTED);
3142 printk(KERN_INFO
3143 "%s: IP addresses changed!\n",
3144 card->devname);
3145 printk(KERN_INFO "%s: Restarting communications ...\n",
3146 card->devname);
3147 }else{
3148 /* IP addresses are the same and the link is up,
3149 * we don't have to do anything here. Therefore, exit */
3150 return 0;
3151 }
3152 }
3153
3154 /* Record the new IP addreses */
3155 ppp_priv_area->ip_local = ppp_priv_area->ip_local_tmp;
3156 ppp_priv_area->ip_remote = ppp_priv_area->ip_remote_tmp;
3157
3158 if (config508(dev, card)){
3159 printk(KERN_INFO "%s: Failed to configure PPP device\n",
3160 card->devname);
3161 return 0;
3162 }
3163
3164 if (ppp_set_intr_mode(card, PPP_INTR_RXRDY|
3165 PPP_INTR_TXRDY|
3166 PPP_INTR_MODEM|
3167 PPP_INTR_DISC |
3168 PPP_INTR_OPEN |
3169 PPP_INTR_DROP_DTR |
3170 PPP_INTR_TIMER)) {
3171
3172 printk(KERN_INFO "%s: Failed to configure board interrupts !\n",
3173 card->devname);
3174 return 0;
3175 }
3176
3177 /* Turn off the transmit and timer interrupt */
3178 flags->imask &= ~(PPP_INTR_TXRDY | PPP_INTR_TIMER) ;
3179
3180
3181 /* If you are not the authenticator and any one of the protocol is
3182 * enabled then we call the set_out_bound_authentication.
3183 */
3184 if ( !card->u.p.authenticator && (ppp_priv_area->pap || ppp_priv_area->chap)) {
3185 if ( ppp_set_outbnd_auth(card, ppp_priv_area) ){
3186 printk(KERN_INFO "%s: Outbound authentication failed !\n",
3187 card->devname);
3188 return 0;
3189 }
3190 }
3191
3192 /* If you are the authenticator and any one of the protocol is enabled
3193 * then we call the set_in_bound_authentication.
3194 */
3195 if (card->u.p.authenticator && (ppp_priv_area->pap || ppp_priv_area->chap)){
3196 if (ppp_set_inbnd_auth(card, ppp_priv_area)){
3197 printk(KERN_INFO "%s: Inbound authentication failed !\n",
3198 card->devname);
3199 return 0;
3200 }
3201 }
3202
3203 /* If we fail to enable communications here it's OK,
3204 * since the DTR timer will cause a disconnected, which
3205 * will retrigger communication in timer_intr() */
3206 if (ppp_comm_enable(card) == CMD_OK) {
3207 wanpipe_set_state(card, WAN_CONNECTING);
3208 init_ppp_tx_rx_buff(card);
3209 }
3210
3211 return 0;
3212}
3213
3214/*============================================================
3215 * ppp_poll
3216 *
3217 * Rationale:
3218 * We cannot manipulate the routing tables, or
3219 * ip addresses withing the interrupt. Therefore
3220 * we must perform such actons outside an interrupt
3221 * at a later time.
3222 *
3223 * Description:
3224 * PPP polling routine, responsible for
3225 * shutting down interfaces upon disconnect
3226 * and adding/removing routes.
3227 *
3228 * Usage:
3229 * This function is executed for each ppp
3230 * interface through a tq_schedule bottom half.
3231 *
3232 * trigger_ppp_poll() function is used to kick
3233 * the ppp_poll routine.
3234 */
3235static void ppp_poll(struct net_device *dev)
3236{
3237 ppp_private_area_t *ppp_priv_area;
3238 sdla_t *card;
3239 u8 check_gateway=0;
3240 ppp_flags_t *flags;
3241
3242 if (!dev || (ppp_priv_area = dev->priv) == NULL)
3243 return;
3244
3245 card = ppp_priv_area->card;
3246 flags = card->flags;
3247
3248 /* Shutdown is in progress, stop what you are
3249 * doing and get out */
3250 if (test_bit(PERI_CRIT,&card->wandev.critical)){
3251 clear_bit(POLL_CRIT,&card->wandev.critical);
3252 return;
3253 }
3254
3255 /* if_open() function has triggered the polling routine
3256 * to determine the configured IP addresses. Once the
3257 * addresses are found, trigger the chdlc configuration */
3258 if (test_bit(0,&ppp_priv_area->config_ppp)){
3259
3260 ppp_priv_area->ip_local_tmp = get_ip_address(dev,WAN_LOCAL_IP);
3261 ppp_priv_area->ip_remote_tmp = get_ip_address(dev,WAN_POINTOPOINT_IP);
3262
3263 if (ppp_priv_area->ip_local_tmp == ppp_priv_area->ip_remote_tmp &&
3264 card->u.p.ip_mode == WANOPT_PPP_HOST){
3265
3266 if (++ppp_priv_area->ip_error > MAX_IP_ERRORS){
3267 printk(KERN_INFO "\n%s: --- WARNING ---\n",
3268 card->devname);
3269 printk(KERN_INFO "%s: The local IP address is the same as the\n",
3270 card->devname);
3271 printk(KERN_INFO "%s: Point-to-Point IP address.\n",
3272 card->devname);
3273 printk(KERN_INFO "%s: --- WARNING ---\n\n",
3274 card->devname);
3275 }else{
3276 clear_bit(POLL_CRIT,&card->wandev.critical);
3277 ppp_priv_area->poll_delay_timer.expires = jiffies+HZ;
3278 add_timer(&ppp_priv_area->poll_delay_timer);
3279 return;
3280 }
3281 }
3282
3283 ppp_priv_area->timer_int_enabled |= TMR_INT_ENABLED_CONFIG;
3284 flags->imask |= PPP_INTR_TIMER;
3285 ppp_priv_area->ip_error=0;
3286
3287 clear_bit(0,&ppp_priv_area->config_ppp);
3288 clear_bit(POLL_CRIT,&card->wandev.critical);
3289 return;
3290 }
3291
3292 /* Dynamic interface implementation, as well as dynamic
3293 * routing. */
3294
3295 switch (card->wandev.state) {
3296
3297 case WAN_DISCONNECTED:
3298
3299 /* If the dynamic interface configuration is on, and interface
3300 * is up, then bring down the netowrk interface */
3301
3302 if (test_bit(DYN_OPT_ON,&ppp_priv_area->interface_down) &&
3303 !test_bit(DEV_DOWN,&ppp_priv_area->interface_down) &&
3304 card->wandev.dev->flags & IFF_UP){
3305
3306 printk(KERN_INFO "%s: Interface %s down.\n",
3307 card->devname,card->wandev.dev->name);
3308 change_dev_flags(card->wandev.dev,
3309 (card->wandev.dev->flags&~IFF_UP));
3310 set_bit(DEV_DOWN,&ppp_priv_area->interface_down);
3311 }else{
3312 /* We need to check if the local IP address is
3313 * zero. If it is, we shouldn't try to remove it.
3314 * For some reason the kernel crashes badly if
3315 * we try to remove the route twice */
3316
3317 if (card->wandev.dev->flags & IFF_UP &&
3318 get_ip_address(card->wandev.dev,WAN_LOCAL_IP) &&
3319 card->u.p.ip_mode == WANOPT_PPP_PEER){
3320
3321 remove_route(card);
3322 }
3323 }
3324 break;
3325
3326 case WAN_CONNECTED:
3327
3328 /* In SMP machine this code can execute before the interface
3329 * comes up. In this case, we must make sure that we do not
3330 * try to bring up the interface before dev_open() is finished */
3331
3332
3333 /* DEV_DOWN will be set only when we bring down the interface
3334 * for the very first time. This way we know that it was us
3335 * that brought the interface down */
3336
3337 if (test_bit(DYN_OPT_ON,&ppp_priv_area->interface_down) &&
3338 test_bit(DEV_DOWN, &ppp_priv_area->interface_down) &&
3339 !(card->wandev.dev->flags & IFF_UP)){
3340
3341 printk(KERN_INFO "%s: Interface %s up.\n",
3342 card->devname,card->wandev.dev->name);
3343
3344 change_dev_flags(card->wandev.dev,(card->wandev.dev->flags|IFF_UP));
3345 clear_bit(DEV_DOWN,&ppp_priv_area->interface_down);
3346 check_gateway=1;
3347 }
3348
3349 if ((card->u.p.ip_mode == WANOPT_PPP_PEER) &&
3350 test_bit(1,&Read_connection_info)) {
3351
3352 process_route(card);
3353 clear_bit(1,&Read_connection_info);
3354 check_gateway=1;
3355 }
3356
3357 if (ppp_priv_area->gateway && check_gateway)
3358 add_gateway(card,dev);
3359
3360 break;
3361 }
3362 clear_bit(POLL_CRIT,&card->wandev.critical);
3363 return;
3364}
3365
3366/*============================================================
3367 * trigger_ppp_poll
3368 *
3369 * Description:
3370 * Add a ppp_poll() task into a tq_scheduler bh handler
3371 * for a specific interface. This will kick
3372 * the ppp_poll() routine at a later time.
3373 *
3374 * Usage:
3375 * Interrupts use this to defer a taks to
3376 * a polling routine.
3377 *
3378 */
3379
3380static void trigger_ppp_poll(struct net_device *dev)
3381{
3382 ppp_private_area_t *ppp_priv_area;
3383 if ((ppp_priv_area=dev->priv) != NULL){
3384
3385 sdla_t *card = ppp_priv_area->card;
3386
3387 if (test_bit(PERI_CRIT,&card->wandev.critical)){
3388 return;
3389 }
3390
3391 if (test_and_set_bit(POLL_CRIT,&card->wandev.critical)){
3392 return;
3393 }
3394
3395 schedule_work(&ppp_priv_area->poll_work);
3396 }
3397 return;
3398}
3399
3400static void ppp_poll_delay (unsigned long dev_ptr)
3401{
3402 struct net_device *dev = (struct net_device *)dev_ptr;
3403 trigger_ppp_poll(dev);
3404}
3405
3406/*============================================================
3407 * detect_and_fix_tx_bug
3408 *
3409 * Description:
3410 * On connect, if the board tx buffer ptr is not the same
3411 * as the driver tx buffer ptr, we found a firmware bug.
3412 * Report the bug to the above layer. To fix the
3413 * error restart communications again.
3414 *
3415 * Usage:
3416 *
3417 */
3418
3419static int detect_and_fix_tx_bug (sdla_t *card)
3420{
3421 if (((unsigned long)card->u.p.txbuf_base&0xFFF) != ((*card->u.p.txbuf_next)&0xFFF)){
3422 NEX_PRINTK(KERN_INFO "Major Error, Fix the bug\n");
3423 return 1;
3424 }
3425 return 0;
3426}
3427
3428MODULE_LICENSE("GPL");
3429
3430/****** End *****************************************************************/
diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c
deleted file mode 100644
index 63f846d6f3a6..000000000000
--- a/drivers/net/wan/sdla_x25.c
+++ /dev/null
@@ -1,5497 +0,0 @@
1/*****************************************************************************
2* sdla_x25.c WANPIPE(tm) Multiprotocol WAN Link Driver. X.25 module.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Apr 03, 2001 Nenad Corbic o Fixed the rx_skb=NULL bug in x25 in rx_intr().
14* Dec 26, 2000 Nenad Corbic o Added a new polling routine, that uses
15* a kernel timer (more efficient).
16* Dec 25, 2000 Nenad Corbic o Updated for 2.4.X kernel
17* Jul 26, 2000 Nenad Corbic o Increased the local packet buffering
18* for API to 4096+header_size.
19* Jul 17, 2000 Nenad Corbic o Fixed the x25 startup bug. Enable
20* communications only after all interfaces
21* come up. HIGH SVC/PVC is used to calculate
22* the number of channels.
23* Enable protocol only after all interfaces
24* are enabled.
25* Jul 10, 2000 Nenad Corbic o Fixed the M_BIT bug.
26* Apr 25, 2000 Nenad Corbic o Pass Modem messages to the API.
27* Disable idle timeout in X25 API.
28* Apr 14, 2000 Nenad Corbic o Fixed: Large LCN number support.
29* Maximum LCN number is 4095.
30* Maximum number of X25 channels is 255.
31* Apr 06, 2000 Nenad Corbic o Added SMP Support.
32* Mar 29, 2000 Nenad Corbic o Added support for S514 PCI Card
33* Mar 23, 2000 Nenad Corbic o Improved task queue, BH handling.
34* Mar 14, 2000 Nenad Corbic o Updated Protocol Violation handling
35* routines. Bug Fix.
36* Mar 10, 2000 Nenad Corbic o Bug Fix: corrupted mbox recovery.
37* Mar 09, 2000 Nenad Corbic o Fixed the auto HDLC bug.
38* Mar 08, 2000 Nenad Corbic o Fixed LAPB HDLC startup problems.
39* Application must bring the link up
40* before tx/rx, and bring the
41* link down on close().
42* Mar 06, 2000 Nenad Corbic o Added an option for logging call setup
43* information.
44* Feb 29, 2000 Nenad Corbic o Added support for LAPB HDLC API
45* Feb 25, 2000 Nenad Corbic o Fixed the modem failure handling.
46* No Modem OOB message will be passed
47* to the user.
48* Feb 21, 2000 Nenad Corbic o Added Xpipemon Debug Support
49* Dec 30, 1999 Nenad Corbic o Socket based X25API
50* Sep 17, 1998 Jaspreet Singh o Updates for 2.2.X kernel
51* Mar 15, 1998 Alan Cox o 2.1.x porting
52* Dec 19, 1997 Jaspreet Singh o Added multi-channel IPX support
53* Nov 27, 1997 Jaspreet Singh o Added protection against enabling of irqs
54* when they are disabled.
55* Nov 17, 1997 Farhan Thawar o Added IPX support
56* o Changed if_send() to now buffer packets when
57* the board is busy
58* o Removed queueing of packets via the polling
59* routing
60* o Changed if_send() critical flags to properly
61* handle race conditions
62* Nov 06, 1997 Farhan Thawar o Added support for SVC timeouts
63* o Changed PVC encapsulation to ETH_P_IP
64* Jul 21, 1997 Jaspreet Singh o Fixed freeing up of buffers using kfree()
65* when packets are received.
66* Mar 11, 1997 Farhan Thawar Version 3.1.1
67* o added support for V35
68* o changed if_send() to return 0 if
69* wandev.critical() is true
70* o free socket buffer in if_send() if
71* returning 0
72* o added support for single '@' address to
73* accept all incoming calls
74* o fixed bug in set_chan_state() to disconnect
75* Jan 15, 1997 Gene Kozin Version 3.1.0
76* o implemented exec() entry point
77* Jan 07, 1997 Gene Kozin Initial version.
78*****************************************************************************/
79
80/*======================================================
81 * Includes
82 *=====================================================*/
83
84#include <linux/module.h>
85#include <linux/kernel.h> /* printk(), and other useful stuff */
86#include <linux/stddef.h> /* offsetof(), etc. */
87#include <linux/errno.h> /* return codes */
88#include <linux/string.h> /* inline memset(), etc. */
89#include <linux/ctype.h>
90#include <linux/slab.h> /* kmalloc(), kfree() */
91#include <linux/wanrouter.h> /* WAN router definitions */
92#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
93#include <linux/workqueue.h>
94#include <linux/jiffies.h> /* time_after() macro */
95#include <asm/byteorder.h> /* htons(), etc. */
96#include <asm/atomic.h>
97#include <linux/delay.h> /* Experimental delay */
98
99#include <asm/uaccess.h>
100
101#include <linux/if.h>
102#include <linux/if_arp.h>
103#include <linux/sdla_x25.h> /* X.25 firmware API definitions */
104#include <linux/if_wanpipe_common.h>
105#include <linux/if_wanpipe.h>
106
107
108/*======================================================
109 * Defines & Macros
110 *=====================================================*/
111
112
113#define CMD_OK 0 /* normal firmware return code */
114#define CMD_TIMEOUT 0xFF /* firmware command timed out */
115#define MAX_CMD_RETRY 10 /* max number of firmware retries */
116
117#define X25_CHAN_MTU 4096 /* unfragmented logical channel MTU */
118#define X25_HRDHDR_SZ 7 /* max encapsulation header size */
119#define X25_CONCT_TMOUT (90*HZ) /* link connection timeout */
120#define X25_RECON_TMOUT (10*HZ) /* link connection timeout */
121#define CONNECT_TIMEOUT (90*HZ) /* link connection timeout */
122#define HOLD_DOWN_TIME (30*HZ) /* link hold down time */
123#define MAX_BH_BUFF 10
124#define M_BIT 0x01
125
126//#define PRINT_DEBUG 1
127#ifdef PRINT_DEBUG
128#define DBG_PRINTK(format, a...) printk(format, ## a)
129#else
130#define DBG_PRINTK(format, a...)
131#endif
132
133#define TMR_INT_ENABLED_POLL_ACTIVE 0x01
134#define TMR_INT_ENABLED_POLL_CONNECT_ON 0x02
135#define TMR_INT_ENABLED_POLL_CONNECT_OFF 0x04
136#define TMR_INT_ENABLED_POLL_DISCONNECT 0x08
137#define TMR_INT_ENABLED_CMD_EXEC 0x10
138#define TMR_INT_ENABLED_UPDATE 0x20
139#define TMR_INT_ENABLED_UDP_PKT 0x40
140
141#define MAX_X25_ADDR_SIZE 16
142#define MAX_X25_DATA_SIZE 129
143#define MAX_X25_FACL_SIZE 110
144
145#define TRY_CMD_AGAIN 2
146#define DELAY_RESULT 1
147#define RETURN_RESULT 0
148
149#define DCD(x) (x & 0x03 ? "HIGH" : "LOW")
150#define CTS(x) (x & 0x05 ? "HIGH" : "LOW")
151
152
153/* Driver will not write log messages about
154 * modem status if defined.*/
155#define MODEM_NOT_LOG 1
156
157/*====================================================
158 * For IPXWAN
159 *===================================================*/
160
161#define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b)))
162
163
164/*====================================================
165 * MEMORY DEBUGGING FUNCTION
166 *====================================================
167
168#define KMEM_SAFETYZONE 8
169
170static void * dbg_kmalloc(unsigned int size, int prio, int line) {
171 int i = 0;
172 void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio);
173 char * c1 = v;
174 c1 += sizeof(unsigned int);
175 *((unsigned int *)v) = size;
176
177 for (i = 0; i < KMEM_SAFETYZONE; i++) {
178 c1[0] = 'D'; c1[1] = 'E'; c1[2] = 'A'; c1[3] = 'D';
179 c1[4] = 'B'; c1[5] = 'E'; c1[6] = 'E'; c1[7] = 'F';
180 c1 += 8;
181 }
182 c1 += size;
183 for (i = 0; i < KMEM_SAFETYZONE; i++) {
184 c1[0] = 'M'; c1[1] = 'U'; c1[2] = 'N'; c1[3] = 'G';
185 c1[4] = 'W'; c1[5] = 'A'; c1[6] = 'L'; c1[7] = 'L';
186 c1 += 8;
187 }
188 v = ((char *)v) + sizeof(unsigned int) + KMEM_SAFETYZONE*8;
189 printk(KERN_INFO "line %d kmalloc(%d,%d) = %p\n",line,size,prio,v);
190 return v;
191}
192static void dbg_kfree(void * v, int line) {
193 unsigned int * sp = (unsigned int *)(((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8));
194 unsigned int size = *sp;
195 char * c1 = ((char *)v) - KMEM_SAFETYZONE*8;
196 int i = 0;
197 for (i = 0; i < KMEM_SAFETYZONE; i++) {
198 if ( c1[0] != 'D' || c1[1] != 'E' || c1[2] != 'A' || c1[3] != 'D'
199 || c1[4] != 'B' || c1[5] != 'E' || c1[6] != 'E' || c1[7] != 'F') {
200 printk(KERN_INFO "kmalloced block at %p has been corrupted (underrun)!\n",v);
201 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
202 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
203 }
204 c1 += 8;
205 }
206 c1 += size;
207 for (i = 0; i < KMEM_SAFETYZONE; i++) {
208 if ( c1[0] != 'M' || c1[1] != 'U' || c1[2] != 'N' || c1[3] != 'G'
209 || c1[4] != 'W' || c1[5] != 'A' || c1[6] != 'L' || c1[7] != 'L'
210 ) {
211 printk(KERN_INFO "kmalloced block at %p has been corrupted (overrun):\n",v);
212 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
213 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
214 }
215 c1 += 8;
216 }
217 printk(KERN_INFO "line %d kfree(%p)\n",line,v);
218 v = ((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8);
219 kfree(v);
220}
221
222#define kmalloc(x,y) dbg_kmalloc(x,y,__LINE__)
223#define kfree(x) dbg_kfree(x,__LINE__)
224
225==============================================================*/
226
227
228
229/*===============================================
230 * Data Structures
231 *===============================================*/
232
233
234/*========================================================
235 * Name: x25_channel
236 *
237 * Purpose: To hold private informaton for each
238 * logical channel.
239 *
240 * Rationale: Per-channel debugging is possible if each
241 * channel has its own private area.
242 *
243 * Assumptions:
244 *
245 * Description: This is an extention of the struct net_device
246 * we create for each network interface to keep
247 * the rest of X.25 channel-specific data.
248 *
249 * Construct: Typedef
250 */
251typedef struct x25_channel
252{
253 wanpipe_common_t common; /* common area for x25api and socket */
254 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
255 char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */
256 unsigned tx_pkt_size;
257 unsigned short protocol; /* ethertype, 0 - multiplexed */
258 char drop_sequence; /* mark sequence for dropping */
259 unsigned long state_tick; /* time of the last state change */
260 unsigned idle_timeout; /* sec, before disconnecting */
261 unsigned long i_timeout_sofar; /* # of sec's we've been idle */
262 unsigned hold_timeout; /* sec, before re-connecting */
263 unsigned long tick_counter; /* counter for transmit time out */
264 char devtint; /* Weather we should dev_tint() */
265 struct sk_buff* rx_skb; /* receive socket buffer */
266 struct sk_buff* tx_skb; /* transmit socket buffer */
267
268 bh_data_t *bh_head; /* Circular buffer for x25api_bh */
269 unsigned long tq_working;
270 volatile int bh_write;
271 volatile int bh_read;
272 atomic_t bh_buff_used;
273
274 sdla_t* card; /* -> owner */
275 struct net_device *dev; /* -> bound devce */
276
277 int ch_idx;
278 unsigned char enable_IPX;
279 unsigned long network_number;
280 struct net_device_stats ifstats; /* interface statistics */
281 unsigned short transmit_length;
282 unsigned short tx_offset;
283 char transmit_buffer[X25_CHAN_MTU+sizeof(x25api_hdr_t)];
284
285 if_send_stat_t if_send_stat;
286 rx_intr_stat_t rx_intr_stat;
287 pipe_mgmt_stat_t pipe_mgmt_stat;
288
289 unsigned long router_start_time; /* Router start time in seconds */
290 unsigned long router_up_time;
291
292} x25_channel_t;
293
294/* FIXME Take this out */
295
296#ifdef NEX_OLD_CALL_INFO
297typedef struct x25_call_info
298{
299 char dest[17]; PACKED;/* ASCIIZ destination address */
300 char src[17]; PACKED;/* ASCIIZ source address */
301 char nuser; PACKED;/* number of user data bytes */
302 unsigned char user[127]; PACKED;/* user data */
303 char nfacil; PACKED;/* number of facilities */
304 struct
305 {
306 unsigned char code; PACKED;
307 unsigned char parm; PACKED;
308 } facil[64]; /* facilities */
309} x25_call_info_t;
310#else
311typedef struct x25_call_info
312{
313 char dest[MAX_X25_ADDR_SIZE] PACKED;/* ASCIIZ destination address */
314 char src[MAX_X25_ADDR_SIZE] PACKED;/* ASCIIZ source address */
315 unsigned char nuser PACKED;
316 unsigned char user[MAX_X25_DATA_SIZE] PACKED;/* user data */
317 unsigned char nfacil PACKED;
318 unsigned char facil[MAX_X25_FACL_SIZE] PACKED;
319 unsigned short lcn PACKED;
320} x25_call_info_t;
321#endif
322
323
324
325/*===============================================
326 * Private Function Prototypes
327 *==============================================*/
328
329
330/*=================================================
331 * WAN link driver entry points. These are
332 * called by the WAN router module.
333 */
334static int update(struct wan_device* wandev);
335static int new_if(struct wan_device* wandev, struct net_device* dev,
336 wanif_conf_t* conf);
337static int del_if(struct wan_device* wandev, struct net_device* dev);
338static void disable_comm (sdla_t* card);
339static void disable_comm_shutdown(sdla_t *card);
340
341
342
343/*=================================================
344 * WANPIPE-specific entry points
345 */
346static int wpx_exec (struct sdla* card, void* u_cmd, void* u_data);
347static void x25api_bh(struct net_device *dev);
348static int x25api_bh_cleanup(struct net_device *dev);
349static int bh_enqueue(struct net_device *dev, struct sk_buff *skb);
350
351
352/*=================================================
353 * Network device interface
354 */
355static int if_init(struct net_device* dev);
356static int if_open(struct net_device* dev);
357static int if_close(struct net_device* dev);
358static int if_header(struct sk_buff* skb, struct net_device* dev,
359 unsigned short type, void* daddr, void* saddr, unsigned len);
360static int if_rebuild_hdr (struct sk_buff* skb);
361static int if_send(struct sk_buff* skb, struct net_device* dev);
362static struct net_device_stats *if_stats(struct net_device* dev);
363
364static void if_tx_timeout(struct net_device *dev);
365
366/*=================================================
367 * Interrupt handlers
368 */
369static void wpx_isr (sdla_t *);
370static void rx_intr (sdla_t *);
371static void tx_intr (sdla_t *);
372static void status_intr (sdla_t *);
373static void event_intr (sdla_t *);
374static void spur_intr (sdla_t *);
375static void timer_intr (sdla_t *);
376
377static int tx_intr_send(sdla_t *card, struct net_device *dev);
378static struct net_device *move_dev_to_next(sdla_t *card,
379 struct net_device *dev);
380
381/*=================================================
382 * Background polling routines
383 */
384static void wpx_poll (sdla_t* card);
385static void poll_disconnected (sdla_t* card);
386static void poll_connecting (sdla_t* card);
387static void poll_active (sdla_t* card);
388static void trigger_x25_poll(sdla_t *card);
389static void x25_timer_routine(unsigned long data);
390
391
392
393/*=================================================
394 * X.25 firmware interface functions
395 */
396static int x25_get_version (sdla_t* card, char* str);
397static int x25_configure (sdla_t* card, TX25Config* conf);
398static int hdlc_configure (sdla_t* card, TX25Config* conf);
399static int set_hdlc_level (sdla_t* card);
400static int x25_get_err_stats (sdla_t* card);
401static int x25_get_stats (sdla_t* card);
402static int x25_set_intr_mode (sdla_t* card, int mode);
403static int x25_close_hdlc (sdla_t* card);
404static int x25_open_hdlc (sdla_t* card);
405static int x25_setup_hdlc (sdla_t* card);
406static int x25_set_dtr (sdla_t* card, int dtr);
407static int x25_get_chan_conf (sdla_t* card, x25_channel_t* chan);
408static int x25_place_call (sdla_t* card, x25_channel_t* chan);
409static int x25_accept_call (sdla_t* card, int lcn, int qdm);
410static int x25_clear_call (sdla_t* card, int lcn, int cause, int diagn);
411static int x25_send (sdla_t* card, int lcn, int qdm, int len, void* buf);
412static int x25_fetch_events (sdla_t* card);
413static int x25_error (sdla_t* card, int err, int cmd, int lcn);
414
415/*=================================================
416 * X.25 asynchronous event handlers
417 */
418static int incoming_call (sdla_t* card, int cmd, int lcn, TX25Mbox* mb);
419static int call_accepted (sdla_t* card, int cmd, int lcn, TX25Mbox* mb);
420static int call_cleared (sdla_t* card, int cmd, int lcn, TX25Mbox* mb);
421static int timeout_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb);
422static int restart_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb);
423
424
425/*=================================================
426 * Miscellaneous functions
427 */
428static int connect (sdla_t* card);
429static int disconnect (sdla_t* card);
430static struct net_device* get_dev_by_lcn(struct wan_device* wandev,
431 unsigned lcn);
432static int chan_connect(struct net_device* dev);
433static int chan_disc(struct net_device* dev);
434static void set_chan_state(struct net_device* dev, int state);
435static int chan_send(struct net_device *dev, void* buff, unsigned data_len,
436 unsigned char tx_intr);
437static unsigned char bps_to_speed_code (unsigned long bps);
438static unsigned int dec_to_uint (unsigned char* str, int len);
439static unsigned int hex_to_uint (unsigned char*, int);
440static void parse_call_info (unsigned char*, x25_call_info_t*);
441static struct net_device *find_channel(sdla_t *card, unsigned lcn);
442static void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn);
443static void setup_for_delayed_transmit(struct net_device *dev,
444 void *buf, unsigned len);
445
446
447/*=================================================
448 * X25 API Functions
449 */
450static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev,
451 struct sk_buff **);
452static void timer_intr_exec(sdla_t *, unsigned char);
453static int execute_delayed_cmd(sdla_t *card, struct net_device *dev,
454 mbox_cmd_t *usr_cmd, char bad_cmd);
455static int api_incoming_call (sdla_t*, TX25Mbox *, int);
456static int alloc_and_init_skb_buf (sdla_t *,struct sk_buff **, int);
457static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev,
458 TX25Mbox* mbox);
459static int clear_confirm_event (sdla_t *, TX25Mbox*);
460static void send_oob_msg (sdla_t *card, struct net_device *dev, TX25Mbox *mbox);
461static int timer_intr_cmd_exec(sdla_t *card);
462static void api_oob_event (sdla_t *card,TX25Mbox *mbox);
463static int check_bad_command(sdla_t *card, struct net_device *dev);
464static int channel_disconnect(sdla_t* card, struct net_device *dev);
465static void hdlc_link_down (sdla_t*);
466
467/*=================================================
468 * XPIPEMON Functions
469 */
470static int process_udp_mgmt_pkt(sdla_t *);
471static int udp_pkt_type( struct sk_buff *, sdla_t*);
472static int reply_udp( unsigned char *, unsigned int);
473static void init_x25_channel_struct( x25_channel_t *);
474static void init_global_statistics( sdla_t *);
475static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t *card,
476 struct net_device *dev,
477 struct sk_buff *skb, int lcn);
478static unsigned short calc_checksum (char *, int);
479
480
481
482/*=================================================
483 * IPX functions
484 */
485static void switch_net_numbers(unsigned char *, unsigned long, unsigned char);
486static int handle_IPXWAN(unsigned char *, char *, unsigned char ,
487 unsigned long , unsigned short );
488
489extern void disable_irq(unsigned int);
490extern void enable_irq(unsigned int);
491
492static void S508_S514_lock(sdla_t *, unsigned long *);
493static void S508_S514_unlock(sdla_t *, unsigned long *);
494
495
496/*=================================================
497 * Global Variables
498 *=================================================*/
499
500
501
502/*=================================================
503 * Public Functions
504 *=================================================*/
505
506
507
508
509/*===================================================================
510 * wpx_init: X.25 Protocol Initialization routine.
511 *
512 * Purpose: To initialize the protocol/firmware.
513 *
514 * Rationale: This function is called by setup() function, in
515 * sdlamain.c, to dynamically setup the x25 protocol.
516 * This is the first protocol specific function, which
517 * executes once on startup.
518 *
519 * Description: This procedure initializes the x25 firmware and
520 * sets up the mailbox, transmit and receive buffer
521 * pointers. It also initializes all debugging structures
522 * and sets up the X25 environment.
523 *
524 * Sets up hardware options defined by user in [wanpipe#]
525 * section of wanpipe#.conf configuration file.
526 *
527 * At this point adapter is completely initialized
528 * and X.25 firmware is running.
529 * o read firmware version (to make sure it's alive)
530 * o configure adapter
531 * o initialize protocol-specific fields of the
532 * adapter data space.
533 *
534 * Called by: setup() function in sdlamain.c
535 *
536 * Assumptions: None
537 *
538 * Warnings: None
539 *
540 * Return: 0 o.k.
541 * < 0 failure.
542 */
543
544int wpx_init (sdla_t* card, wandev_conf_t* conf)
545{
546 union{
547 char str[80];
548 TX25Config cfg;
549 } u;
550
551 /* Verify configuration ID */
552 if (conf->config_id != WANCONFIG_X25){
553 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
554 card->devname, conf->config_id)
555 ;
556 return -EINVAL;
557 }
558
559 /* Initialize protocol-specific fields */
560 card->mbox = (void*)(card->hw.dpmbase + X25_MBOX_OFFS);
561 card->rxmb = (void*)(card->hw.dpmbase + X25_RXMBOX_OFFS);
562 card->flags = (void*)(card->hw.dpmbase + X25_STATUS_OFFS);
563
564 /* Initialize for S514 Card */
565 if(card->hw.type == SDLA_S514) {
566 card->mbox += X25_MB_VECTOR;
567 card->flags += X25_MB_VECTOR;
568 card->rxmb += X25_MB_VECTOR;
569 }
570
571
572 /* Read firmware version. Note that when adapter initializes, it
573 * clears the mailbox, so it may appear that the first command was
574 * executed successfully when in fact it was merely erased. To work
575 * around this, we execute the first command twice.
576 */
577 if (x25_get_version(card, NULL) || x25_get_version(card, u.str))
578 return -EIO;
579
580
581 /* X25 firmware can run ether in X25 or LAPB HDLC mode.
582 * Check the user defined option and configure accordingly */
583 if (conf->u.x25.LAPB_hdlc_only == WANOPT_YES){
584 if (set_hdlc_level(card) != CMD_OK){
585 return -EIO;
586 }else{
587 printk(KERN_INFO "%s: running LAP_B HDLC firmware v%s\n",
588 card->devname, u.str);
589 }
590 card->u.x.LAPB_hdlc = 1;
591 }else{
592 printk(KERN_INFO "%s: running X.25 firmware v%s\n",
593 card->devname, u.str);
594 card->u.x.LAPB_hdlc = 0;
595 }
596
597 /* Configure adapter. Here we set resonable defaults, then parse
598 * device configuration structure and set configuration options.
599 * Most configuration options are verified and corrected (if
600 * necessary) since we can't rely on the adapter to do so.
601 */
602 memset(&u.cfg, 0, sizeof(u.cfg));
603 u.cfg.t1 = 3;
604 u.cfg.n2 = 10;
605 u.cfg.autoHdlc = 1; /* automatic HDLC connection */
606 u.cfg.hdlcWindow = 7;
607 u.cfg.pktWindow = 2;
608 u.cfg.station = 1; /* DTE */
609 u.cfg.options = 0x0090; /* disable D-bit pragmatics */
610 u.cfg.ccittCompat = 1988;
611 u.cfg.t10t20 = 30;
612 u.cfg.t11t21 = 30;
613 u.cfg.t12t22 = 30;
614 u.cfg.t13t23 = 30;
615 u.cfg.t16t26 = 30;
616 u.cfg.t28 = 30;
617 u.cfg.r10r20 = 5;
618 u.cfg.r12r22 = 5;
619 u.cfg.r13r23 = 5;
620 u.cfg.responseOpt = 1; /* RR's after every packet */
621
622 if (card->u.x.LAPB_hdlc){
623 u.cfg.hdlcMTU = 1027;
624 }
625
626 if (conf->u.x25.x25_conf_opt){
627 u.cfg.options = conf->u.x25.x25_conf_opt;
628 }
629
630 if (conf->clocking != WANOPT_EXTERNAL)
631 u.cfg.baudRate = bps_to_speed_code(conf->bps);
632
633 if (conf->station != WANOPT_DTE){
634 u.cfg.station = 0; /* DCE mode */
635 }
636
637 if (conf->interface != WANOPT_RS232 ){
638 u.cfg.hdlcOptions |= 0x80; /* V35 mode */
639 }
640
641 /* adjust MTU */
642 if (!conf->mtu || (conf->mtu >= 1024))
643 card->wandev.mtu = 1024;
644 else if (conf->mtu >= 512)
645 card->wandev.mtu = 512;
646 else if (conf->mtu >= 256)
647 card->wandev.mtu = 256;
648 else if (conf->mtu >= 128)
649 card->wandev.mtu = 128;
650 else
651 card->wandev.mtu = 64;
652
653 u.cfg.defPktSize = u.cfg.pktMTU = card->wandev.mtu;
654
655 if (conf->u.x25.hi_pvc){
656 card->u.x.hi_pvc = min_t(unsigned int, conf->u.x25.hi_pvc, MAX_LCN_NUM);
657 card->u.x.lo_pvc = min_t(unsigned int, conf->u.x25.lo_pvc, card->u.x.hi_pvc);
658 }
659
660 if (conf->u.x25.hi_svc){
661 card->u.x.hi_svc = min_t(unsigned int, conf->u.x25.hi_svc, MAX_LCN_NUM);
662 card->u.x.lo_svc = min_t(unsigned int, conf->u.x25.lo_svc, card->u.x.hi_svc);
663 }
664
665 /* Figure out the total number of channels to configure */
666 card->u.x.num_of_ch = 0;
667 if (card->u.x.hi_svc != 0){
668 card->u.x.num_of_ch = (card->u.x.hi_svc - card->u.x.lo_svc) + 1;
669 }
670 if (card->u.x.hi_pvc != 0){
671 card->u.x.num_of_ch += (card->u.x.hi_pvc - card->u.x.lo_pvc) + 1;
672 }
673
674 if (card->u.x.num_of_ch == 0){
675 printk(KERN_INFO "%s: ERROR, Minimum number of PVC/SVC channels is 1 !\n"
676 "%s: Please set the Lowest/Highest PVC/SVC values !\n",
677 card->devname,card->devname);
678 return -ECHRNG;
679 }
680
681 u.cfg.loPVC = card->u.x.lo_pvc;
682 u.cfg.hiPVC = card->u.x.hi_pvc;
683 u.cfg.loTwoWaySVC = card->u.x.lo_svc;
684 u.cfg.hiTwoWaySVC = card->u.x.hi_svc;
685
686 if (conf->u.x25.hdlc_window)
687 u.cfg.hdlcWindow = min_t(unsigned int, conf->u.x25.hdlc_window, 7);
688 if (conf->u.x25.pkt_window)
689 u.cfg.pktWindow = min_t(unsigned int, conf->u.x25.pkt_window, 7);
690
691 if (conf->u.x25.t1)
692 u.cfg.t1 = min_t(unsigned int, conf->u.x25.t1, 30);
693 if (conf->u.x25.t2)
694 u.cfg.t2 = min_t(unsigned int, conf->u.x25.t2, 29);
695 if (conf->u.x25.t4)
696 u.cfg.t4 = min_t(unsigned int, conf->u.x25.t4, 240);
697 if (conf->u.x25.n2)
698 u.cfg.n2 = min_t(unsigned int, conf->u.x25.n2, 30);
699
700 if (conf->u.x25.t10_t20)
701 u.cfg.t10t20 = min_t(unsigned int, conf->u.x25.t10_t20,255);
702 if (conf->u.x25.t11_t21)
703 u.cfg.t11t21 = min_t(unsigned int, conf->u.x25.t11_t21,255);
704 if (conf->u.x25.t12_t22)
705 u.cfg.t12t22 = min_t(unsigned int, conf->u.x25.t12_t22,255);
706 if (conf->u.x25.t13_t23)
707 u.cfg.t13t23 = min_t(unsigned int, conf->u.x25.t13_t23,255);
708 if (conf->u.x25.t16_t26)
709 u.cfg.t16t26 = min_t(unsigned int, conf->u.x25.t16_t26, 255);
710 if (conf->u.x25.t28)
711 u.cfg.t28 = min_t(unsigned int, conf->u.x25.t28, 255);
712
713 if (conf->u.x25.r10_r20)
714 u.cfg.r10r20 = min_t(unsigned int, conf->u.x25.r10_r20,250);
715 if (conf->u.x25.r12_r22)
716 u.cfg.r12r22 = min_t(unsigned int, conf->u.x25.r12_r22,250);
717 if (conf->u.x25.r13_r23)
718 u.cfg.r13r23 = min_t(unsigned int, conf->u.x25.r13_r23,250);
719
720
721 if (conf->u.x25.ccitt_compat)
722 u.cfg.ccittCompat = conf->u.x25.ccitt_compat;
723
724 /* initialize adapter */
725 if (card->u.x.LAPB_hdlc){
726 if (hdlc_configure(card, &u.cfg) != CMD_OK)
727 return -EIO;
728 }else{
729 if (x25_configure(card, &u.cfg) != CMD_OK)
730 return -EIO;
731 }
732
733 if ((x25_close_hdlc(card) != CMD_OK) || /* close HDLC link */
734 (x25_set_dtr(card, 0) != CMD_OK)) /* drop DTR */
735 return -EIO;
736
737 /* Initialize protocol-specific fields of adapter data space */
738 card->wandev.bps = conf->bps;
739 card->wandev.interface = conf->interface;
740 card->wandev.clocking = conf->clocking;
741 card->wandev.station = conf->station;
742 card->isr = &wpx_isr;
743 card->poll = NULL; //&wpx_poll;
744 card->disable_comm = &disable_comm;
745 card->exec = &wpx_exec;
746 card->wandev.update = &update;
747 card->wandev.new_if = &new_if;
748 card->wandev.del_if = &del_if;
749
750 /* WARNING: This function cannot exit with an error
751 * after the change of state */
752 card->wandev.state = WAN_DISCONNECTED;
753
754 card->wandev.enable_tx_int = 0;
755 card->irq_dis_if_send_count = 0;
756 card->irq_dis_poll_count = 0;
757 card->u.x.tx_dev = NULL;
758 card->u.x.no_dev = 0;
759
760
761 /* Configure for S514 PCI Card */
762 if (card->hw.type == SDLA_S514) {
763 card->u.x.hdlc_buf_status =
764 (volatile unsigned char *)
765 (card->hw.dpmbase + X25_MB_VECTOR+ X25_MISC_HDLC_BITS);
766 }else{
767 card->u.x.hdlc_buf_status =
768 (volatile unsigned char *)(card->hw.dpmbase + X25_MISC_HDLC_BITS);
769 }
770
771 card->u.x.poll_device=NULL;
772 card->wandev.udp_port = conf->udp_port;
773
774 /* Enable or disable call setup logging */
775 if (conf->u.x25.logging == WANOPT_YES){
776 printk(KERN_INFO "%s: Enabling Call Logging.\n",
777 card->devname);
778 card->u.x.logging = 1;
779 }else{
780 card->u.x.logging = 0;
781 }
782
783 /* Enable or disable modem status reporting */
784 if (conf->u.x25.oob_on_modem == WANOPT_YES){
785 printk(KERN_INFO "%s: Enabling OOB on Modem change.\n",
786 card->devname);
787 card->u.x.oob_on_modem = 1;
788 }else{
789 card->u.x.oob_on_modem = 0;
790 }
791
792 init_global_statistics(card);
793
794 INIT_WORK(&card->u.x.x25_poll_work, (void *)wpx_poll, card);
795
796 init_timer(&card->u.x.x25_timer);
797 card->u.x.x25_timer.data = (unsigned long)card;
798 card->u.x.x25_timer.function = x25_timer_routine;
799
800 return 0;
801}
802
803/*=========================================================
804 * WAN Device Driver Entry Points
805 *========================================================*/
806
807/*============================================================
808 * Name: update(), Update device status & statistics.
809 *
810 * Purpose: To provide debugging and statitical
811 * information to the /proc file system.
812 * /proc/net/wanrouter/wanpipe#
813 *
814 * Rationale: The /proc file system is used to collect
815 * information about the kernel and drivers.
816 * Using the /proc file system the user
817 * can see exactly what the sangoma drivers are
818 * doing. And in what state they are in.
819 *
820 * Description: Collect all driver statistical information
821 * and pass it to the top laywer.
822 *
823 * Since we have to execute a debugging command,
824 * to obtain firmware statitics, we trigger a
825 * UPDATE function within the timer interrtup.
826 * We wait until the timer update is complete.
827 * Once complete return the appropriate return
828 * code to indicate that the update was successful.
829 *
830 * Called by: device_stat() in wanmain.c
831 *
832 * Assumptions:
833 *
834 * Warnings: This function will degrade the performance
835 * of the router, since it uses the mailbox.
836 *
837 * Return: 0 OK
838 * <0 Failed (or busy).
839 */
840
841static int update(struct wan_device* wandev)
842{
843 volatile sdla_t* card;
844 TX25Status* status;
845 unsigned long timeout;
846
847 /* sanity checks */
848 if ((wandev == NULL) || (wandev->private == NULL))
849 return -EFAULT;
850
851 if (wandev->state == WAN_UNCONFIGURED)
852 return -ENODEV;
853
854 if (test_bit(SEND_CRIT, (void*)&wandev->critical))
855 return -EAGAIN;
856
857 if (!wandev->dev)
858 return -ENODEV;
859
860 card = wandev->private;
861 status = card->flags;
862
863 card->u.x.timer_int_enabled |= TMR_INT_ENABLED_UPDATE;
864 status->imask |= INTR_ON_TIMER;
865 timeout = jiffies;
866
867 for (;;){
868 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){
869 break;
870 }
871 if (time_after(jiffies, timeout + 1*HZ)){
872 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
873 return -EAGAIN;
874 }
875 }
876 return 0;
877}
878
879
880/*===================================================================
881 * Name: new_if
882 *
883 * Purpose: To allocate and initialize resources for a
884 * new logical channel.
885 *
886 * Rationale: A new channel can be added dynamically via
887 * ioctl call.
888 *
889 * Description: Allocate a private channel structure, x25_channel_t.
890 * Parse the user interface options from wanpipe#.conf
891 * configuration file.
892 * Bind the private are into the network device private
893 * area pointer (dev->priv).
894 * Prepare the network device structure for registration.
895 *
896 * Called by: ROUTER_IFNEW Ioctl call, from wanrouter_ioctl()
897 * (wanmain.c)
898 *
899 * Assumptions: None
900 *
901 * Warnings: None
902 *
903 * Return: 0 Ok
904 * <0 Failed (channel will not be created)
905 */
906static int new_if(struct wan_device* wandev, struct net_device* dev,
907 wanif_conf_t* conf)
908{
909 sdla_t* card = wandev->private;
910 x25_channel_t* chan;
911 int err = 0;
912
913 if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)){
914 printk(KERN_INFO "%s: invalid interface name!\n",
915 card->devname);
916 return -EINVAL;
917 }
918
919 if(card->wandev.new_if_cnt++ > 0 && card->u.x.LAPB_hdlc) {
920 printk(KERN_INFO "%s: Error: Running LAPB HDLC Mode !\n",
921 card->devname);
922 printk(KERN_INFO
923 "%s: Maximum number of network interfaces must be one !\n",
924 card->devname);
925 return -EEXIST;
926 }
927
928 /* allocate and initialize private data */
929 chan = kmalloc(sizeof(x25_channel_t), GFP_ATOMIC);
930 if (chan == NULL){
931 return -ENOMEM;
932 }
933
934 memset(chan, 0, sizeof(x25_channel_t));
935
936 /* Bug Fix: Seg Err on PVC startup
937 * It must be here since bind_lcn_to_dev expects
938 * it bellow */
939 dev->priv = chan;
940
941 strcpy(chan->name, conf->name);
942 chan->card = card;
943 chan->dev = dev;
944 chan->common.sk = NULL;
945 chan->common.func = NULL;
946 chan->common.rw_bind = 0;
947 chan->tx_skb = chan->rx_skb = NULL;
948
949 /* verify media address */
950 if (conf->addr[0] == '@'){ /* SVC */
951 chan->common.svc = 1;
952 strncpy(chan->addr, &conf->addr[1], WAN_ADDRESS_SZ);
953
954 /* Set channel timeouts (default if not specified) */
955 chan->idle_timeout = (conf->idle_timeout) ?
956 conf->idle_timeout : 90;
957 chan->hold_timeout = (conf->hold_timeout) ?
958 conf->hold_timeout : 10;
959
960 }else if (isdigit(conf->addr[0])){ /* PVC */
961 int lcn = dec_to_uint(conf->addr, 0);
962
963 if ((lcn >= card->u.x.lo_pvc) && (lcn <= card->u.x.hi_pvc)){
964 bind_lcn_to_dev (card, dev, lcn);
965 }else{
966 printk(KERN_ERR
967 "%s: PVC %u is out of range on interface %s!\n",
968 wandev->name, lcn, chan->name);
969 err = -EINVAL;
970 }
971 }else{
972 printk(KERN_ERR
973 "%s: invalid media address on interface %s!\n",
974 wandev->name, chan->name);
975 err = -EINVAL;
976 }
977
978 if(strcmp(conf->usedby, "WANPIPE") == 0){
979 printk(KERN_INFO "%s: Running in WANPIPE mode %s\n",
980 wandev->name, chan->name);
981 chan->common.usedby = WANPIPE;
982 chan->protocol = htons(ETH_P_IP);
983
984 }else if(strcmp(conf->usedby, "API") == 0){
985 chan->common.usedby = API;
986 printk(KERN_INFO "%s: Running in API mode %s\n",
987 wandev->name, chan->name);
988 chan->protocol = htons(X25_PROT);
989 }
990
991
992 if (err){
993 kfree(chan);
994 dev->priv = NULL;
995 return err;
996 }
997
998 chan->enable_IPX = conf->enable_IPX;
999
1000 if (chan->enable_IPX)
1001 chan->protocol = htons(ETH_P_IPX);
1002
1003 if (conf->network_number)
1004 chan->network_number = conf->network_number;
1005 else
1006 chan->network_number = 0xDEADBEEF;
1007
1008 /* prepare network device data space for registration */
1009 strcpy(dev->name,chan->name);
1010
1011 dev->init = &if_init;
1012
1013 init_x25_channel_struct(chan);
1014
1015 return 0;
1016}
1017
1018/*===================================================================
1019 * Name: del_if(), Remove a logical channel.
1020 *
1021 * Purpose: To dynamically remove a logical channel.
1022 *
1023 * Rationale: Each logical channel should be dynamically
1024 * removable. This functin is called by an
1025 * IOCTL_IFDEL ioctl call or shutdown().
1026 *
1027 * Description: Do nothing.
1028 *
1029 * Called by: IOCTL_IFDEL : wanrouter_ioctl() from wanmain.c
1030 * shutdown() from sdlamain.c
1031 *
1032 * Assumptions:
1033 *
1034 * Warnings:
1035 *
1036 * Return: 0 Ok. Void function.
1037 */
1038
1039//FIXME Del IF Should be taken out now.
1040
1041static int del_if(struct wan_device* wandev, struct net_device* dev)
1042{
1043 return 0;
1044}
1045
1046
1047/*============================================================
1048 * Name: wpx_exec
1049 *
1050 * Description: Execute adapter interface command.
1051 * This option is currently dissabled.
1052 *===========================================================*/
1053
1054static int wpx_exec (struct sdla* card, void* u_cmd, void* u_data)
1055{
1056 return 0;
1057}
1058
1059/*============================================================
1060 * Name: disable_comm
1061 *
1062 * Description: Disable communications during shutdown.
1063 * Dont check return code because there is
1064 * nothing we can do about it.
1065 *
1066 * Warning: Dev and private areas are gone at this point.
1067 *===========================================================*/
1068
1069static void disable_comm(sdla_t* card)
1070{
1071 disable_comm_shutdown(card);
1072 del_timer(&card->u.x.x25_timer);
1073 return;
1074}
1075
1076
1077/*============================================================
1078 * Network Device Interface
1079 *===========================================================*/
1080
1081/*===================================================================
1082 * Name: if_init(), Netowrk Interface Initialization
1083 *
1084 * Purpose: To initialize a network interface device structure.
1085 *
1086 * Rationale: During network interface startup, the if_init
1087 * is called by the kernel to initialize the
1088 * netowrk device structure. Thus a driver
1089 * can customze a network device.
1090 *
1091 * Description: Initialize the netowrk device call back
1092 * routines. This is where we tell the kernel
1093 * which function to use when it wants to send
1094 * via our interface.
1095 * Furthermore, we initialize the device flags,
1096 * MTU and physical address of the board.
1097 *
1098 * Called by: Kernel (/usr/src/linux/net/core/dev.c)
1099 * (dev->init())
1100 *
1101 * Assumptions: None
1102 *
1103 * Warnings: None
1104 *
1105 * Return: 0 Ok : Void function.
1106 */
1107static int if_init(struct net_device* dev)
1108{
1109 x25_channel_t* chan = dev->priv;
1110 sdla_t* card = chan->card;
1111 struct wan_device* wandev = &card->wandev;
1112
1113 /* Initialize device driver entry points */
1114 dev->open = &if_open;
1115 dev->stop = &if_close;
1116 dev->hard_header = &if_header;
1117 dev->rebuild_header = &if_rebuild_hdr;
1118 dev->hard_start_xmit = &if_send;
1119 dev->get_stats = &if_stats;
1120 dev->tx_timeout = &if_tx_timeout;
1121 dev->watchdog_timeo = TX_TIMEOUT;
1122
1123 /* Initialize media-specific parameters */
1124 dev->type = ARPHRD_PPP; /* ARP h/w type */
1125 dev->flags |= IFF_POINTOPOINT;
1126 dev->flags |= IFF_NOARP;
1127
1128 if (chan->common.usedby == API){
1129 dev->mtu = X25_CHAN_MTU+sizeof(x25api_hdr_t);
1130 }else{
1131 dev->mtu = card->wandev.mtu;
1132 }
1133
1134 dev->hard_header_len = X25_HRDHDR_SZ; /* media header length */
1135 dev->addr_len = 2; /* hardware address length */
1136
1137 if (!chan->common.svc){
1138 *(unsigned short*)dev->dev_addr = htons(chan->common.lcn);
1139 }
1140
1141 /* Initialize hardware parameters (just for reference) */
1142 dev->irq = wandev->irq;
1143 dev->dma = wandev->dma;
1144 dev->base_addr = wandev->ioport;
1145 dev->mem_start = (unsigned long)wandev->maddr;
1146 dev->mem_end = wandev->maddr + wandev->msize - 1;
1147
1148 /* Set transmit buffer queue length */
1149 dev->tx_queue_len = 100;
1150 SET_MODULE_OWNER(dev);
1151
1152 /* FIXME Why are we doing this */
1153 set_chan_state(dev, WAN_DISCONNECTED);
1154 return 0;
1155}
1156
1157
1158/*===================================================================
1159 * Name: if_open(), Open/Bring up the Netowrk Interface
1160 *
1161 * Purpose: To bring up a network interface.
1162 *
1163 * Rationale:
1164 *
1165 * Description: Open network interface.
1166 * o prevent module from unloading by incrementing use count
1167 * o if link is disconnected then initiate connection
1168 *
1169 * Called by: Kernel (/usr/src/linux/net/core/dev.c)
1170 * (dev->open())
1171 *
1172 * Assumptions: None
1173 *
1174 * Warnings: None
1175 *
1176 * Return: 0 Ok
1177 * <0 Failure: Interface will not come up.
1178 */
1179
1180static int if_open(struct net_device* dev)
1181{
1182 x25_channel_t* chan = dev->priv;
1183 sdla_t* card = chan->card;
1184 struct timeval tv;
1185 unsigned long smp_flags;
1186
1187 if (netif_running(dev))
1188 return -EBUSY;
1189
1190 chan->tq_working = 0;
1191
1192 /* Initialize the workqueue */
1193 INIT_WORK(&chan->common.wanpipe_work, (void *)x25api_bh, dev);
1194
1195 /* Allocate and initialize BH circular buffer */
1196 /* Add 1 to MAX_BH_BUFF so we don't have test with (MAX_BH_BUFF-1) */
1197 chan->bh_head = kmalloc((sizeof(bh_data_t)*(MAX_BH_BUFF+1)),GFP_ATOMIC);
1198
1199 if (chan->bh_head == NULL){
1200 printk(KERN_INFO "%s: ERROR, failed to allocate memory ! BH_BUFFERS !\n",
1201 card->devname);
1202
1203 return -ENOBUFS;
1204 }
1205 memset(chan->bh_head,0,(sizeof(bh_data_t)*(MAX_BH_BUFF+1)));
1206 atomic_set(&chan->bh_buff_used, 0);
1207
1208 /* Increment the number of interfaces */
1209 ++card->u.x.no_dev;
1210
1211 wanpipe_open(card);
1212
1213 /* LAPB protocol only uses one interface, thus
1214 * start the protocol after it comes up. */
1215 if (card->u.x.LAPB_hdlc){
1216 if (card->open_cnt == 1){
1217 TX25Status* status = card->flags;
1218 S508_S514_lock(card, &smp_flags);
1219 x25_set_intr_mode(card, INTR_ON_TIMER);
1220 status->imask &= ~INTR_ON_TIMER;
1221 S508_S514_unlock(card, &smp_flags);
1222 }
1223 }else{
1224 /* X25 can have multiple interfaces thus, start the
1225 * protocol once all interfaces are up */
1226
1227 //FIXME: There is a bug here. If interface is
1228 //brought down and up, it will try to enable comm.
1229 if (card->open_cnt == card->u.x.num_of_ch){
1230
1231 S508_S514_lock(card, &smp_flags);
1232 connect(card);
1233 S508_S514_unlock(card, &smp_flags);
1234
1235 mod_timer(&card->u.x.x25_timer, jiffies + HZ);
1236 }
1237 }
1238 /* Device is not up until the we are in connected state */
1239 do_gettimeofday( &tv );
1240 chan->router_start_time = tv.tv_sec;
1241
1242 netif_start_queue(dev);
1243
1244 return 0;
1245}
1246
1247/*===================================================================
1248 * Name: if_close(), Close/Bring down the Netowrk Interface
1249 *
1250 * Purpose: To bring down a network interface.
1251 *
1252 * Rationale:
1253 *
1254 * Description: Close network interface.
1255 * o decrement use module use count
1256 *
1257 * Called by: Kernel (/usr/src/linux/net/core/dev.c)
1258 * (dev->close())
1259 * ifconfig <name> down: will trigger the kernel
1260 * which will call this function.
1261 *
1262 * Assumptions: None
1263 *
1264 * Warnings: None
1265 *
1266 * Return: 0 Ok
1267 * <0 Failure: Interface will not exit properly.
1268 */
1269static int if_close(struct net_device* dev)
1270{
1271 x25_channel_t* chan = dev->priv;
1272 sdla_t* card = chan->card;
1273 unsigned long smp_flags;
1274
1275 netif_stop_queue(dev);
1276
1277 if ((chan->common.state == WAN_CONNECTED) ||
1278 (chan->common.state == WAN_CONNECTING)){
1279 S508_S514_lock(card, &smp_flags);
1280 chan_disc(dev);
1281 S508_S514_unlock(card, &smp_flags);
1282 }
1283
1284 wanpipe_close(card);
1285
1286 S508_S514_lock(card, &smp_flags);
1287 if (chan->bh_head){
1288 int i;
1289 struct sk_buff *skb;
1290
1291 for (i=0; i<(MAX_BH_BUFF+1); i++){
1292 skb = ((bh_data_t *)&chan->bh_head[i])->skb;
1293 if (skb != NULL){
1294 dev_kfree_skb_any(skb);
1295 }
1296 }
1297 kfree(chan->bh_head);
1298 chan->bh_head=NULL;
1299 }
1300 S508_S514_unlock(card, &smp_flags);
1301
1302 /* If this is the last close, disconnect physical link */
1303 if (!card->open_cnt){
1304 S508_S514_lock(card, &smp_flags);
1305 disconnect(card);
1306 x25_set_intr_mode(card, 0);
1307 S508_S514_unlock(card, &smp_flags);
1308 }
1309
1310 /* Decrement the number of interfaces */
1311 --card->u.x.no_dev;
1312 return 0;
1313}
1314
1315/*======================================================================
1316 * Build media header.
1317 * o encapsulate packet according to encapsulation type.
1318 *
1319 * The trick here is to put packet type (Ethertype) into 'protocol'
1320 * field of the socket buffer, so that we don't forget it.
1321 * If encapsulation fails, set skb->protocol to 0 and discard
1322 * packet later.
1323 *
1324 * Return: media header length.
1325 *======================================================================*/
1326
1327static int if_header(struct sk_buff* skb, struct net_device* dev,
1328 unsigned short type, void* daddr, void* saddr,
1329 unsigned len)
1330{
1331 x25_channel_t* chan = dev->priv;
1332 int hdr_len = dev->hard_header_len;
1333
1334 skb->protocol = htons(type);
1335 if (!chan->protocol){
1336 hdr_len = wanrouter_encapsulate(skb, dev, type);
1337 if (hdr_len < 0){
1338 hdr_len = 0;
1339 skb->protocol = htons(0);
1340 }
1341 }
1342 return hdr_len;
1343}
1344
1345/*===============================================================
1346 * Re-build media header.
1347 *
1348 * Return: 1 physical address resolved.
1349 * 0 physical address not resolved
1350 *==============================================================*/
1351
1352static int if_rebuild_hdr (struct sk_buff* skb)
1353{
1354 struct net_device *dev = skb->dev;
1355 x25_channel_t* chan = dev->priv;
1356 sdla_t* card = chan->card;
1357
1358 printk(KERN_INFO "%s: rebuild_header() called for interface %s!\n",
1359 card->devname, dev->name);
1360 return 1;
1361}
1362
1363
1364/*============================================================================
1365 * Handle transmit timeout event from netif watchdog
1366 */
1367static void if_tx_timeout(struct net_device *dev)
1368{
1369 x25_channel_t* chan = dev->priv;
1370 sdla_t *card = chan->card;
1371
1372 /* If our device stays busy for at least 5 seconds then we will
1373 * kick start the device by making dev->tbusy = 0. We expect
1374 * that our device never stays busy more than 5 seconds. So this
1375 * is only used as a last resort.
1376 */
1377
1378 ++chan->if_send_stat.if_send_tbusy_timeout;
1379 printk (KERN_INFO "%s: Transmit timed out on %s\n",
1380 card->devname, dev->name);
1381 netif_wake_queue (dev);
1382}
1383
1384
1385/*=========================================================================
1386 * Send a packet on a network interface.
1387 * o set tbusy flag (marks start of the transmission).
1388 * o check link state. If link is not up, then drop the packet.
1389 * o check channel status. If it's down then initiate a call.
1390 * o pass a packet to corresponding WAN device.
1391 * o free socket buffer
1392 *
1393 * Return: 0 complete (socket buffer must be freed)
1394 * non-0 packet may be re-transmitted (tbusy must be set)
1395 *
1396 * Notes:
1397 * 1. This routine is called either by the protocol stack or by the "net
1398 * bottom half" (with interrupts enabled).
1399 * 2. Setting tbusy flag will inhibit further transmit requests from the
1400 * protocol stack and can be used for flow control with protocol layer.
1401 *
1402 *========================================================================*/
1403
1404static int if_send(struct sk_buff* skb, struct net_device* dev)
1405{
1406 x25_channel_t* chan = dev->priv;
1407 sdla_t* card = chan->card;
1408 TX25Status* status = card->flags;
1409 int udp_type;
1410 unsigned long smp_flags=0;
1411
1412 ++chan->if_send_stat.if_send_entry;
1413
1414 netif_stop_queue(dev);
1415
1416 /* No need to check frame length, since socket code
1417 * will perform the check for us */
1418
1419 chan->tick_counter = jiffies;
1420
1421 /* Critical region starts here */
1422 S508_S514_lock(card, &smp_flags);
1423
1424 if (test_and_set_bit(SEND_CRIT, (void*)&card->wandev.critical)){
1425 printk(KERN_INFO "Hit critical in if_send()! %lx\n",card->wandev.critical);
1426 goto if_send_crit_exit;
1427 }
1428
1429 udp_type = udp_pkt_type(skb, card);
1430
1431 if(udp_type != UDP_INVALID_TYPE) {
1432
1433 if(store_udp_mgmt_pkt(udp_type, UDP_PKT_FRM_STACK, card, dev, skb,
1434 chan->common.lcn)) {
1435
1436 status->imask |= INTR_ON_TIMER;
1437 if (udp_type == UDP_XPIPE_TYPE){
1438 chan->if_send_stat.if_send_PIPE_request++;
1439 }
1440 }
1441 netif_start_queue(dev);
1442 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
1443 S508_S514_unlock(card, &smp_flags);
1444 return 0;
1445 }
1446
1447 if (chan->transmit_length){
1448 //FIXME: This check doesn't make sense any more
1449 if (chan->common.state != WAN_CONNECTED){
1450 chan->transmit_length=0;
1451 atomic_set(&chan->common.driver_busy,0);
1452 }else{
1453 netif_stop_queue(dev);
1454 ++card->u.x.tx_interrupts_pending;
1455 status->imask |= INTR_ON_TX_FRAME;
1456 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
1457 S508_S514_unlock(card, &smp_flags);
1458 return 1;
1459 }
1460 }
1461
1462 if (card->wandev.state != WAN_CONNECTED){
1463 ++chan->ifstats.tx_dropped;
1464 ++card->wandev.stats.tx_dropped;
1465 ++chan->if_send_stat.if_send_wan_disconnected;
1466
1467 }else if ( chan->protocol && (chan->protocol != skb->protocol)){
1468 printk(KERN_INFO
1469 "%s: unsupported Ethertype 0x%04X on interface %s!\n",
1470 chan->name, htons(skb->protocol), dev->name);
1471
1472 printk(KERN_INFO "PROTO %Xn", htons(chan->protocol));
1473 ++chan->ifstats.tx_errors;
1474 ++chan->ifstats.tx_dropped;
1475 ++card->wandev.stats.tx_dropped;
1476 ++chan->if_send_stat.if_send_protocol_error;
1477
1478 }else switch (chan->common.state){
1479
1480 case WAN_DISCONNECTED:
1481 /* Try to establish connection. If succeded, then start
1482 * transmission, else drop a packet.
1483 */
1484 if (chan->common.usedby == API){
1485 ++chan->ifstats.tx_dropped;
1486 ++card->wandev.stats.tx_dropped;
1487 break;
1488 }else{
1489 if (chan_connect(dev) != 0){
1490 ++chan->ifstats.tx_dropped;
1491 ++card->wandev.stats.tx_dropped;
1492 break;
1493 }
1494 }
1495 /* fall through */
1496
1497 case WAN_CONNECTED:
1498 if( skb->protocol == htons(ETH_P_IPX)) {
1499 if(chan->enable_IPX) {
1500 switch_net_numbers( skb->data,
1501 chan->network_number, 0);
1502 } else {
1503 ++card->wandev.stats.tx_dropped;
1504 ++chan->ifstats.tx_dropped;
1505 ++chan->if_send_stat.if_send_protocol_error;
1506 goto if_send_crit_exit;
1507 }
1508 }
1509 /* We never drop here, if cannot send than, copy
1510 * a packet into a transmit buffer
1511 */
1512 chan_send(dev, skb->data, skb->len, 0);
1513 break;
1514
1515 default:
1516 ++chan->ifstats.tx_dropped;
1517 ++card->wandev.stats.tx_dropped;
1518 break;
1519 }
1520
1521
1522if_send_crit_exit:
1523
1524 dev_kfree_skb_any(skb);
1525
1526 netif_start_queue(dev);
1527 clear_bit(SEND_CRIT,(void*)&card->wandev.critical);
1528 S508_S514_unlock(card, &smp_flags);
1529 return 0;
1530}
1531
1532/*============================================================================
1533 * Setup so that a frame can be transmitted on the occurrence of a transmit
1534 * interrupt.
1535 *===========================================================================*/
1536
1537static void setup_for_delayed_transmit(struct net_device* dev, void* buf,
1538 unsigned len)
1539{
1540 x25_channel_t* chan = dev->priv;
1541 sdla_t* card = chan->card;
1542 TX25Status* status = card->flags;
1543
1544 ++chan->if_send_stat.if_send_adptr_bfrs_full;
1545
1546 if(chan->transmit_length) {
1547 printk(KERN_INFO "%s: Error, transmit length set in delayed transmit!\n",
1548 card->devname);
1549 return;
1550 }
1551
1552 if (chan->common.usedby == API){
1553 if (len > X25_CHAN_MTU+sizeof(x25api_hdr_t)) {
1554 ++chan->ifstats.tx_dropped;
1555 ++card->wandev.stats.tx_dropped;
1556 printk(KERN_INFO "%s: Length is too big for delayed transmit\n",
1557 card->devname);
1558 return;
1559 }
1560 }else{
1561 if (len > X25_MAX_DATA) {
1562 ++chan->ifstats.tx_dropped;
1563 ++card->wandev.stats.tx_dropped;
1564 printk(KERN_INFO "%s: Length is too big for delayed transmit\n",
1565 card->devname);
1566 return;
1567 }
1568 }
1569
1570 chan->transmit_length = len;
1571 atomic_set(&chan->common.driver_busy,1);
1572 memcpy(chan->transmit_buffer, buf, len);
1573
1574 ++chan->if_send_stat.if_send_tx_int_enabled;
1575
1576 /* Enable Transmit Interrupt */
1577 ++card->u.x.tx_interrupts_pending;
1578 status->imask |= INTR_ON_TX_FRAME;
1579}
1580
1581
1582/*===============================================================
1583 * net_device_stats
1584 *
1585 * Get ethernet-style interface statistics.
1586 * Return a pointer to struct enet_statistics.
1587 *
1588 *==============================================================*/
1589static struct net_device_stats *if_stats(struct net_device* dev)
1590{
1591 x25_channel_t *chan = dev->priv;
1592
1593 if(chan == NULL)
1594 return NULL;
1595
1596 return &chan->ifstats;
1597}
1598
1599
1600/*
1601 * Interrupt Handlers
1602 */
1603
1604/*
1605 * X.25 Interrupt Service Routine.
1606 */
1607
1608static void wpx_isr (sdla_t* card)
1609{
1610 TX25Status* status = card->flags;
1611
1612 card->in_isr = 1;
1613 ++card->statistics.isr_entry;
1614
1615 if (test_bit(PERI_CRIT,(void*)&card->wandev.critical)){
1616 card->in_isr=0;
1617 status->iflags = 0;
1618 return;
1619 }
1620
1621 if (test_bit(SEND_CRIT, (void*)&card->wandev.critical)){
1622
1623 printk(KERN_INFO "%s: wpx_isr: wandev.critical set to 0x%02lx, int type = 0x%02x\n",
1624 card->devname, card->wandev.critical, status->iflags);
1625 card->in_isr = 0;
1626 status->iflags = 0;
1627 return;
1628 }
1629
1630 /* For all interrupts set the critical flag to CRITICAL_RX_INTR.
1631 * If the if_send routine is called with this flag set it will set
1632 * the enable transmit flag to 1. (for a delayed interrupt)
1633 */
1634 switch (status->iflags){
1635
1636 case RX_INTR_PENDING: /* receive interrupt */
1637 rx_intr(card);
1638 break;
1639
1640 case TX_INTR_PENDING: /* transmit interrupt */
1641 tx_intr(card);
1642 break;
1643
1644 case MODEM_INTR_PENDING: /* modem status interrupt */
1645 status_intr(card);
1646 break;
1647
1648 case X25_ASY_TRANS_INTR_PENDING: /* network event interrupt */
1649 event_intr(card);
1650 break;
1651
1652 case TIMER_INTR_PENDING:
1653 timer_intr(card);
1654 break;
1655
1656 default: /* unwanted interrupt */
1657 spur_intr(card);
1658 }
1659
1660 card->in_isr = 0;
1661 status->iflags = 0; /* clear interrupt condition */
1662}
1663
1664/*
1665 * Receive interrupt handler.
1666 * This routine handles fragmented IP packets using M-bit according to the
1667 * RFC1356.
1668 * o map ligical channel number to network interface.
1669 * o allocate socket buffer or append received packet to the existing one.
1670 * o if M-bit is reset (i.e. it's the last packet in a sequence) then
1671 * decapsulate packet and pass socket buffer to the protocol stack.
1672 *
1673 * Notes:
1674 * 1. When allocating a socket buffer, if M-bit is set then more data is
1675 * coming and we have to allocate buffer for the maximum IP packet size
1676 * expected on this channel.
1677 * 2. If something goes wrong and X.25 packet has to be dropped (e.g. no
1678 * socket buffers available) the whole packet sequence must be discarded.
1679 */
1680
1681static void rx_intr (sdla_t* card)
1682{
1683 TX25Mbox* rxmb = card->rxmb;
1684 unsigned lcn = rxmb->cmd.lcn;
1685 struct net_device* dev = find_channel(card,lcn);
1686 x25_channel_t* chan;
1687 struct sk_buff* skb=NULL;
1688
1689 if (dev == NULL){
1690 /* Invalid channel, discard packet */
1691 printk(KERN_INFO "%s: receiving on orphaned LCN %d!\n",
1692 card->devname, lcn);
1693 return;
1694 }
1695
1696 chan = dev->priv;
1697 chan->i_timeout_sofar = jiffies;
1698
1699
1700 /* Copy the data from the board, into an
1701 * skb buffer
1702 */
1703 if (wanpipe_pull_data_in_skb(card,dev,&skb)){
1704 ++chan->ifstats.rx_dropped;
1705 ++card->wandev.stats.rx_dropped;
1706 ++chan->rx_intr_stat.rx_intr_no_socket;
1707 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
1708 return;
1709 }
1710
1711 dev->last_rx = jiffies; /* timestamp */
1712
1713
1714 /* ------------ API ----------------*/
1715
1716 if (chan->common.usedby == API){
1717
1718 if (bh_enqueue(dev, skb)){
1719 ++chan->ifstats.rx_dropped;
1720 ++card->wandev.stats.rx_dropped;
1721 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
1722 dev_kfree_skb_any(skb);
1723 return;
1724 }
1725
1726 ++chan->ifstats.rx_packets;
1727 chan->ifstats.rx_bytes += skb->len;
1728
1729
1730 chan->rx_skb = NULL;
1731 if (!test_and_set_bit(0, &chan->tq_working)){
1732 wanpipe_queue_work(&chan->common.wanpipe_work);
1733 }
1734 return;
1735 }
1736
1737
1738 /* ------------- WANPIPE -------------------*/
1739
1740 /* set rx_skb to NULL so we won't access it later when kernel already owns it */
1741 chan->rx_skb=NULL;
1742
1743 /* Decapsulate packet, if necessary */
1744 if (!skb->protocol && !wanrouter_type_trans(skb, dev)){
1745 /* can't decapsulate packet */
1746 dev_kfree_skb_any(skb);
1747 ++chan->ifstats.rx_errors;
1748 ++chan->ifstats.rx_dropped;
1749 ++card->wandev.stats.rx_dropped;
1750 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
1751
1752 }else{
1753 if( handle_IPXWAN(skb->data, chan->name,
1754 chan->enable_IPX, chan->network_number,
1755 skb->protocol)){
1756
1757 if( chan->enable_IPX ){
1758 if(chan_send(dev, skb->data, skb->len,0)){
1759 chan->tx_skb = skb;
1760 }else{
1761 dev_kfree_skb_any(skb);
1762 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
1763 }
1764 }else{
1765 /* increment IPX packet dropped statistic */
1766 ++chan->ifstats.rx_dropped;
1767 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
1768 }
1769 }else{
1770 skb->mac.raw = skb->data;
1771 chan->ifstats.rx_bytes += skb->len;
1772 ++chan->ifstats.rx_packets;
1773 ++chan->rx_intr_stat.rx_intr_bfr_passed_to_stack;
1774 netif_rx(skb);
1775 }
1776 }
1777
1778 return;
1779}
1780
1781
1782static int wanpipe_pull_data_in_skb(sdla_t *card, struct net_device *dev,
1783 struct sk_buff **skb)
1784{
1785 void *bufptr;
1786 TX25Mbox* rxmb = card->rxmb;
1787 unsigned len = rxmb->cmd.length; /* packet length */
1788 unsigned qdm = rxmb->cmd.qdm; /* Q,D and M bits */
1789 x25_channel_t *chan = dev->priv;
1790 struct sk_buff *new_skb = *skb;
1791
1792 if (chan->common.usedby == WANPIPE){
1793 if (chan->drop_sequence){
1794 if (!(qdm & 0x01)){
1795 chan->drop_sequence = 0;
1796 }
1797 return 1;
1798 }
1799 new_skb = chan->rx_skb;
1800 }else{
1801 /* Add on the API header to the received
1802 * data
1803 */
1804 len += sizeof(x25api_hdr_t);
1805 }
1806
1807 if (new_skb == NULL){
1808 int bufsize;
1809
1810 if (chan->common.usedby == WANPIPE){
1811 bufsize = (qdm & 0x01) ? dev->mtu : len;
1812 }else{
1813 bufsize = len;
1814 }
1815
1816 /* Allocate new socket buffer */
1817 new_skb = dev_alloc_skb(bufsize + dev->hard_header_len);
1818 if (new_skb == NULL){
1819 printk(KERN_INFO "%s: no socket buffers available!\n",
1820 card->devname);
1821 chan->drop_sequence = 1; /* set flag */
1822 ++chan->ifstats.rx_dropped;
1823 return 1;
1824 }
1825 }
1826
1827 if (skb_tailroom(new_skb) < len){
1828 /* No room for the packet. Call off the whole thing! */
1829 dev_kfree_skb_any(new_skb);
1830 if (chan->common.usedby == WANPIPE){
1831 chan->rx_skb = NULL;
1832 if (qdm & 0x01){
1833 chan->drop_sequence = 1;
1834 }
1835 }
1836
1837 printk(KERN_INFO "%s: unexpectedly long packet sequence "
1838 "on interface %s!\n", card->devname, dev->name);
1839 ++chan->ifstats.rx_length_errors;
1840 return 1;
1841 }
1842
1843 bufptr = skb_put(new_skb,len);
1844
1845
1846 if (chan->common.usedby == API){
1847 /* Fill in the x25api header
1848 */
1849 x25api_t * api_data = (x25api_t*)bufptr;
1850 api_data->hdr.qdm = rxmb->cmd.qdm;
1851 api_data->hdr.cause = rxmb->cmd.cause;
1852 api_data->hdr.diagn = rxmb->cmd.diagn;
1853 api_data->hdr.length = rxmb->cmd.length;
1854 memcpy(api_data->data, rxmb->data, rxmb->cmd.length);
1855 }else{
1856 memcpy(bufptr, rxmb->data, len);
1857 }
1858
1859 new_skb->dev = dev;
1860
1861 if (chan->common.usedby == API){
1862 new_skb->mac.raw = new_skb->data;
1863 new_skb->protocol = htons(X25_PROT);
1864 new_skb->pkt_type = WAN_PACKET_DATA;
1865 }else{
1866 new_skb->protocol = chan->protocol;
1867 chan->rx_skb = new_skb;
1868 }
1869
1870 /* If qdm bit is set, more data is coming
1871 * thus, exit and wait for more data before
1872 * sending the packet up. (Used by router only)
1873 */
1874 if ((qdm & 0x01) && (chan->common.usedby == WANPIPE))
1875 return 1;
1876
1877 *skb = new_skb;
1878
1879 return 0;
1880}
1881
1882/*===============================================================
1883 * tx_intr
1884 *
1885 * Transmit interrupt handler.
1886 * For each dev, check that there is something to send.
1887 * If data available, transmit.
1888 *
1889 *===============================================================*/
1890
1891static void tx_intr (sdla_t* card)
1892{
1893 struct net_device *dev;
1894 TX25Status* status = card->flags;
1895 unsigned char more_to_tx=0;
1896 x25_channel_t *chan=NULL;
1897 int i=0;
1898
1899 if (card->u.x.tx_dev == NULL){
1900 card->u.x.tx_dev = card->wandev.dev;
1901 }
1902
1903 dev = card->u.x.tx_dev;
1904
1905 for (;;){
1906
1907 chan = dev->priv;
1908 if (chan->transmit_length){
1909 /* Device was set to transmit, check if the TX
1910 * buffers are available
1911 */
1912 if (chan->common.state != WAN_CONNECTED){
1913 chan->transmit_length = 0;
1914 atomic_set(&chan->common.driver_busy,0);
1915 chan->tx_offset=0;
1916 if (netif_queue_stopped(dev)){
1917 if (chan->common.usedby == API){
1918 netif_start_queue(dev);
1919 wakeup_sk_bh(dev);
1920 }else{
1921 netif_wake_queue(dev);
1922 }
1923 }
1924 dev = move_dev_to_next(card,dev);
1925 break;
1926 }
1927
1928 if ((status->cflags[chan->ch_idx] & 0x40 || card->u.x.LAPB_hdlc) &&
1929 (*card->u.x.hdlc_buf_status & 0x40) ){
1930 /* Tx buffer available, we can send */
1931
1932 if (tx_intr_send(card, dev)){
1933 more_to_tx=1;
1934 }
1935
1936 /* If more than one interface present, move the
1937 * device pointer to the next interface, so on the
1938 * next TX interrupt we will try sending from it.
1939 */
1940 dev = move_dev_to_next(card,dev);
1941 break;
1942 }else{
1943 /* Tx buffers not available, but device set
1944 * the TX interrupt. Set more_to_tx and try
1945 * to transmit for other devices.
1946 */
1947 more_to_tx=1;
1948 dev = move_dev_to_next(card,dev);
1949 }
1950
1951 }else{
1952 /* This device was not set to transmit,
1953 * go to next
1954 */
1955 dev = move_dev_to_next(card,dev);
1956 }
1957
1958 if (++i == card->u.x.no_dev){
1959 if (!more_to_tx){
1960 DBG_PRINTK(KERN_INFO "%s: Nothing to Send in TX INTR\n",
1961 card->devname);
1962 }
1963 break;
1964 }
1965
1966 } //End of FOR
1967
1968 card->u.x.tx_dev = dev;
1969
1970 if (!more_to_tx){
1971 /* if any other interfaces have transmit interrupts pending, */
1972 /* do not disable the global transmit interrupt */
1973 if (!(--card->u.x.tx_interrupts_pending)){
1974 status->imask &= ~INTR_ON_TX_FRAME;
1975 }
1976 }
1977 return;
1978}
1979
1980/*===============================================================
1981 * move_dev_to_next
1982 *
1983 *
1984 *===============================================================*/
1985
1986
1987struct net_device *move_dev_to_next(sdla_t *card, struct net_device *dev)
1988{
1989 if (card->u.x.no_dev != 1){
1990 if (!*((struct net_device **)dev->priv))
1991 return card->wandev.dev;
1992 else
1993 return *((struct net_device **)dev->priv);
1994 }
1995 return dev;
1996}
1997
1998/*===============================================================
1999 * tx_intr_send
2000 *
2001 *
2002 *===============================================================*/
2003
2004static int tx_intr_send(sdla_t *card, struct net_device *dev)
2005{
2006 x25_channel_t* chan = dev->priv;
2007
2008 if (chan_send (dev,chan->transmit_buffer,chan->transmit_length,1)){
2009
2010 /* Packet was split up due to its size, do not disable
2011 * tx_intr
2012 */
2013 return 1;
2014 }
2015
2016 chan->transmit_length=0;
2017 atomic_set(&chan->common.driver_busy,0);
2018 chan->tx_offset=0;
2019
2020 /* If we are in API mode, wakeup the
2021 * sock BH handler, not the NET_BH */
2022 if (netif_queue_stopped(dev)){
2023 if (chan->common.usedby == API){
2024 netif_start_queue(dev);
2025 wakeup_sk_bh(dev);
2026 }else{
2027 netif_wake_queue(dev);
2028 }
2029 }
2030 return 0;
2031}
2032
2033
2034/*===============================================================
2035 * timer_intr
2036 *
2037 * Timer interrupt handler.
2038 * Check who called the timer interrupt and perform
2039 * action accordingly.
2040 *
2041 *===============================================================*/
2042
2043static void timer_intr (sdla_t *card)
2044{
2045 TX25Status* status = card->flags;
2046
2047 if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_CMD_EXEC){
2048
2049 if (timer_intr_cmd_exec(card) == 0){
2050 card->u.x.timer_int_enabled &=
2051 ~TMR_INT_ENABLED_CMD_EXEC;
2052 }
2053
2054 }else if(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UDP_PKT) {
2055
2056 if ((*card->u.x.hdlc_buf_status & 0x40) &&
2057 card->u.x.udp_type == UDP_XPIPE_TYPE){
2058
2059 if(process_udp_mgmt_pkt(card)) {
2060 card->u.x.timer_int_enabled &=
2061 ~TMR_INT_ENABLED_UDP_PKT;
2062 }
2063 }
2064
2065 }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_ACTIVE) {
2066
2067 struct net_device *dev = card->u.x.poll_device;
2068 x25_channel_t *chan = NULL;
2069
2070 if (!dev){
2071 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_POLL_ACTIVE;
2072 return;
2073 }
2074 chan = dev->priv;
2075
2076 printk(KERN_INFO
2077 "%s: Closing down Idle link %s on LCN %d\n",
2078 card->devname,chan->name,chan->common.lcn);
2079 chan->i_timeout_sofar = jiffies;
2080 chan_disc(dev);
2081 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_POLL_ACTIVE;
2082 card->u.x.poll_device=NULL;
2083
2084 }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_CONNECT_ON) {
2085
2086 wanpipe_set_state(card, WAN_CONNECTED);
2087 if (card->u.x.LAPB_hdlc){
2088 struct net_device *dev = card->wandev.dev;
2089 set_chan_state(dev,WAN_CONNECTED);
2090 send_delayed_cmd_result(card,dev,card->mbox);
2091 }
2092
2093 /* 0x8F enable all interrupts */
2094 x25_set_intr_mode(card, INTR_ON_RX_FRAME|
2095 INTR_ON_TX_FRAME|
2096 INTR_ON_MODEM_STATUS_CHANGE|
2097 //INTR_ON_COMMAND_COMPLETE|
2098 X25_ASY_TRANS_INTR_PENDING |
2099 INTR_ON_TIMER |
2100 DIRECT_RX_INTR_USAGE
2101 );
2102
2103 status->imask &= ~INTR_ON_TX_FRAME; /* mask Tx interrupts */
2104 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_POLL_CONNECT_ON;
2105
2106 }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_CONNECT_OFF) {
2107
2108 //printk(KERN_INFO "Poll connect, Turning OFF\n");
2109 disconnect(card);
2110 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_POLL_CONNECT_OFF;
2111
2112 }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_POLL_DISCONNECT) {
2113
2114 //printk(KERN_INFO "POll disconnect, trying to connect\n");
2115 connect(card);
2116 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_POLL_DISCONNECT;
2117
2118 }else if (card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE){
2119
2120 if (*card->u.x.hdlc_buf_status & 0x40){
2121 x25_get_err_stats(card);
2122 x25_get_stats(card);
2123 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
2124 }
2125 }
2126
2127 if(!card->u.x.timer_int_enabled){
2128 //printk(KERN_INFO "Turning Timer Off \n");
2129 status->imask &= ~INTR_ON_TIMER;
2130 }
2131}
2132
2133/*====================================================================
2134 * Modem status interrupt handler.
2135 *===================================================================*/
2136static void status_intr (sdla_t* card)
2137{
2138
2139 /* Added to avoid Modem status message flooding */
2140 static TX25ModemStatus last_stat;
2141
2142 TX25Mbox* mbox = card->mbox;
2143 TX25ModemStatus *modem_status;
2144 struct net_device *dev;
2145 x25_channel_t *chan;
2146 int err;
2147
2148 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2149 mbox->cmd.command = X25_READ_MODEM_STATUS;
2150 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2151 if (err){
2152 x25_error(card, err, X25_READ_MODEM_STATUS, 0);
2153 }else{
2154
2155 modem_status = (TX25ModemStatus*)mbox->data;
2156
2157 /* Check if the last status was the same
2158 * if it was, do NOT print message again */
2159
2160 if (last_stat.status != modem_status->status){
2161
2162 printk(KERN_INFO "%s: Modem Status Change: DCD=%s, CTS=%s\n",
2163 card->devname,DCD(modem_status->status),CTS(modem_status->status));
2164
2165 last_stat.status = modem_status->status;
2166
2167 if (card->u.x.oob_on_modem){
2168
2169 mbox->cmd.pktType = mbox->cmd.command;
2170 mbox->cmd.result = 0x08;
2171
2172 /* Send a OOB to all connected sockets */
2173 for (dev = card->wandev.dev; dev;
2174 dev = *((struct net_device**)dev->priv)) {
2175 chan=dev->priv;
2176 if (chan->common.usedby == API){
2177 send_oob_msg(card,dev,mbox);
2178 }
2179 }
2180
2181 /* The modem OOB message will probably kill the
2182 * the link. If we don't clear the flag here,
2183 * a deadlock could occur */
2184 if (atomic_read(&card->u.x.command_busy)){
2185 atomic_set(&card->u.x.command_busy,0);
2186 }
2187 }
2188 }
2189 }
2190
2191 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2192 mbox->cmd.command = X25_HDLC_LINK_STATUS;
2193 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2194 if (err){
2195 x25_error(card, err, X25_HDLC_LINK_STATUS, 0);
2196 }
2197
2198}
2199
2200/*====================================================================
2201 * Network event interrupt handler.
2202 *===================================================================*/
2203static void event_intr (sdla_t* card)
2204{
2205 x25_fetch_events(card);
2206}
2207
2208/*====================================================================
2209 * Spurious interrupt handler.
2210 * o print a warning
2211 * o
2212 *====================================================================*/
2213
2214static void spur_intr (sdla_t* card)
2215{
2216 printk(KERN_INFO "%s: spurious interrupt!\n", card->devname);
2217}
2218
2219
2220/*
2221 * Background Polling Routines
2222 */
2223
2224/*====================================================================
2225 * Main polling routine.
2226 * This routine is repeatedly called by the WANPIPE 'thread' to allow for
2227 * time-dependent housekeeping work.
2228 *
2229 * Notes:
2230 * 1. This routine may be called on interrupt context with all interrupts
2231 * enabled. Beware!
2232 *====================================================================*/
2233
2234static void wpx_poll (sdla_t *card)
2235{
2236 if (!card->wandev.dev){
2237 goto wpx_poll_exit;
2238 }
2239
2240 if (card->open_cnt != card->u.x.num_of_ch){
2241 goto wpx_poll_exit;
2242 }
2243
2244 if (test_bit(PERI_CRIT,&card->wandev.critical)){
2245 goto wpx_poll_exit;
2246 }
2247
2248 if (test_bit(SEND_CRIT,&card->wandev.critical)){
2249 goto wpx_poll_exit;
2250 }
2251
2252 switch(card->wandev.state){
2253 case WAN_CONNECTED:
2254 poll_active(card);
2255 break;
2256
2257 case WAN_CONNECTING:
2258 poll_connecting(card);
2259 break;
2260
2261 case WAN_DISCONNECTED:
2262 poll_disconnected(card);
2263 break;
2264 }
2265
2266wpx_poll_exit:
2267 clear_bit(POLL_CRIT,&card->wandev.critical);
2268 return;
2269}
2270
2271static void trigger_x25_poll(sdla_t *card)
2272{
2273 schedule_work(&card->u.x.x25_poll_work);
2274}
2275
2276/*====================================================================
2277 * Handle physical link establishment phase.
2278 * o if connection timed out, disconnect the link.
2279 *===================================================================*/
2280
2281static void poll_connecting (sdla_t* card)
2282{
2283 volatile TX25Status* status = card->flags;
2284
2285 if (status->gflags & X25_HDLC_ABM){
2286
2287 timer_intr_exec (card, TMR_INT_ENABLED_POLL_CONNECT_ON);
2288
2289 }else if ((jiffies - card->state_tick) > CONNECT_TIMEOUT){
2290
2291 timer_intr_exec (card, TMR_INT_ENABLED_POLL_CONNECT_OFF);
2292
2293 }
2294}
2295
2296/*====================================================================
2297 * Handle physical link disconnected phase.
2298 * o if hold-down timeout has expired and there are open interfaces,
2299 * connect link.
2300 *===================================================================*/
2301
2302static void poll_disconnected (sdla_t* card)
2303{
2304 struct net_device *dev;
2305 x25_channel_t *chan;
2306 TX25Status* status = card->flags;
2307
2308 if (!card->u.x.LAPB_hdlc && card->open_cnt &&
2309 ((jiffies - card->state_tick) > HOLD_DOWN_TIME)){
2310 timer_intr_exec(card, TMR_INT_ENABLED_POLL_DISCONNECT);
2311 }
2312
2313
2314 if ((dev=card->wandev.dev) == NULL)
2315 return;
2316
2317 if ((chan=dev->priv) == NULL)
2318 return;
2319
2320 if (chan->common.usedby == API &&
2321 atomic_read(&chan->common.command) &&
2322 card->u.x.LAPB_hdlc){
2323
2324 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_CMD_EXEC))
2325 card->u.x.timer_int_enabled |= TMR_INT_ENABLED_CMD_EXEC;
2326
2327 if (!(status->imask & INTR_ON_TIMER))
2328 status->imask |= INTR_ON_TIMER;
2329 }
2330
2331}
2332
2333/*====================================================================
2334 * Handle active link phase.
2335 * o fetch X.25 asynchronous events.
2336 * o kick off transmission on all interfaces.
2337 *===================================================================*/
2338
2339static void poll_active (sdla_t* card)
2340{
2341 struct net_device* dev;
2342 TX25Status* status = card->flags;
2343
2344 for (dev = card->wandev.dev; dev;
2345 dev = *((struct net_device **)dev->priv)){
2346 x25_channel_t* chan = dev->priv;
2347
2348 /* If SVC has been idle long enough, close virtual circuit */
2349 if ( chan->common.svc &&
2350 chan->common.state == WAN_CONNECTED &&
2351 chan->common.usedby == WANPIPE ){
2352
2353 if( (jiffies - chan->i_timeout_sofar) / HZ > chan->idle_timeout ){
2354 /* Close svc */
2355 card->u.x.poll_device=dev;
2356 timer_intr_exec (card, TMR_INT_ENABLED_POLL_ACTIVE);
2357 }
2358 }
2359
2360#ifdef PRINT_DEBUG
2361 chan->ifstats.tx_compressed = atomic_read(&chan->common.command);
2362 chan->ifstats.tx_errors = chan->common.state;
2363 chan->ifstats.rx_fifo_errors = atomic_read(&card->u.x.command_busy);
2364 ++chan->ifstats.tx_bytes;
2365
2366 chan->ifstats.rx_fifo_errors=atomic_read(&chan->common.disconnect);
2367 chan->ifstats.multicast=atomic_read(&chan->bh_buff_used);
2368 chan->ifstats.rx_length_errors=*card->u.x.hdlc_buf_status;
2369#endif
2370
2371 if (chan->common.usedby == API &&
2372 atomic_read(&chan->common.command) &&
2373 !card->u.x.LAPB_hdlc){
2374
2375 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_CMD_EXEC))
2376 card->u.x.timer_int_enabled |= TMR_INT_ENABLED_CMD_EXEC;
2377
2378 if (!(status->imask & INTR_ON_TIMER))
2379 status->imask |= INTR_ON_TIMER;
2380 }
2381
2382 if ((chan->common.usedby == API) &&
2383 atomic_read(&chan->common.disconnect)){
2384
2385 if (chan->common.state == WAN_DISCONNECTED){
2386 atomic_set(&chan->common.disconnect,0);
2387 return;
2388 }
2389
2390 atomic_set(&chan->common.command,X25_CLEAR_CALL);
2391 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_CMD_EXEC))
2392 card->u.x.timer_int_enabled |= TMR_INT_ENABLED_CMD_EXEC;
2393
2394 if (!(status->imask & INTR_ON_TIMER))
2395 status->imask |= INTR_ON_TIMER;
2396 }
2397 }
2398}
2399
2400static void timer_intr_exec(sdla_t *card, unsigned char TYPE)
2401{
2402 TX25Status* status = card->flags;
2403 card->u.x.timer_int_enabled |= TYPE;
2404 if (!(status->imask & INTR_ON_TIMER))
2405 status->imask |= INTR_ON_TIMER;
2406}
2407
2408
2409/*====================================================================
2410 * SDLA Firmware-Specific Functions
2411 *
2412 * Almost all X.25 commands can unexpetedly fail due to so called 'X.25
2413 * asynchronous events' such as restart, interrupt, incoming call request,
2414 * call clear request, etc. They can't be ignored and have to be delt with
2415 * immediately. To tackle with this problem we execute each interface
2416 * command in a loop until good return code is received or maximum number
2417 * of retries is reached. Each interface command returns non-zero return
2418 * code, an asynchronous event/error handler x25_error() is called.
2419 *====================================================================*/
2420
2421/*====================================================================
2422 * Read X.25 firmware version.
2423 * Put code version as ASCII string in str.
2424 *===================================================================*/
2425
2426static int x25_get_version (sdla_t* card, char* str)
2427{
2428 TX25Mbox* mbox = card->mbox;
2429 int retry = MAX_CMD_RETRY;
2430 int err;
2431
2432 do
2433 {
2434 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2435 mbox->cmd.command = X25_READ_CODE_VERSION;
2436 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2437 } while (err && retry-- &&
2438 x25_error(card, err, X25_READ_CODE_VERSION, 0));
2439
2440 if (!err && str)
2441 {
2442 int len = mbox->cmd.length;
2443
2444 memcpy(str, mbox->data, len);
2445 str[len] = '\0';
2446 }
2447 return err;
2448}
2449
2450/*====================================================================
2451 * Configure adapter.
2452 *===================================================================*/
2453
2454static int x25_configure (sdla_t* card, TX25Config* conf)
2455{
2456 TX25Mbox* mbox = card->mbox;
2457 int retry = MAX_CMD_RETRY;
2458 int err;
2459
2460 do{
2461 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2462 memcpy(mbox->data, (void*)conf, sizeof(TX25Config));
2463 mbox->cmd.length = sizeof(TX25Config);
2464 mbox->cmd.command = X25_SET_CONFIGURATION;
2465 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2466 } while (err && retry-- && x25_error(card, err, X25_SET_CONFIGURATION, 0));
2467 return err;
2468}
2469
2470/*====================================================================
2471 * Configure adapter for HDLC only.
2472 *===================================================================*/
2473
2474static int hdlc_configure (sdla_t* card, TX25Config* conf)
2475{
2476 TX25Mbox* mbox = card->mbox;
2477 int retry = MAX_CMD_RETRY;
2478 int err;
2479
2480 do{
2481 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2482 memcpy(mbox->data, (void*)conf, sizeof(TX25Config));
2483 mbox->cmd.length = sizeof(TX25Config);
2484 mbox->cmd.command = X25_HDLC_SET_CONFIG;
2485 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2486 } while (err && retry-- && x25_error(card, err, X25_SET_CONFIGURATION, 0));
2487
2488 return err;
2489}
2490
2491static int set_hdlc_level (sdla_t* card)
2492{
2493
2494 TX25Mbox* mbox = card->mbox;
2495 int retry = MAX_CMD_RETRY;
2496 int err;
2497
2498 do{
2499 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2500 mbox->cmd.command = SET_PROTOCOL_LEVEL;
2501 mbox->cmd.length = 1;
2502 mbox->data[0] = HDLC_LEVEL; //| DO_HDLC_LEVEL_ERROR_CHECKING;
2503 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2504 } while (err && retry-- && x25_error(card, err, SET_PROTOCOL_LEVEL, 0));
2505
2506 return err;
2507}
2508
2509
2510
2511/*====================================================================
2512 * Get communications error statistics.
2513 *====================================================================*/
2514
2515static int x25_get_err_stats (sdla_t* card)
2516{
2517 TX25Mbox* mbox = card->mbox;
2518 int retry = MAX_CMD_RETRY;
2519 int err;
2520
2521 do
2522 {
2523 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2524 mbox->cmd.command = X25_HDLC_READ_COMM_ERR;
2525 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2526 } while (err && retry-- && x25_error(card, err, X25_HDLC_READ_COMM_ERR, 0));
2527
2528 if (!err)
2529 {
2530 THdlcCommErr* stats = (void*)mbox->data;
2531
2532 card->wandev.stats.rx_over_errors = stats->rxOverrun;
2533 card->wandev.stats.rx_crc_errors = stats->rxBadCrc;
2534 card->wandev.stats.rx_missed_errors = stats->rxAborted;
2535 card->wandev.stats.tx_aborted_errors = stats->txAborted;
2536 }
2537 return err;
2538}
2539
2540/*====================================================================
2541 * Get protocol statistics.
2542 *===================================================================*/
2543
2544static int x25_get_stats (sdla_t* card)
2545{
2546 TX25Mbox* mbox = card->mbox;
2547 int retry = MAX_CMD_RETRY;
2548 int err;
2549
2550 do
2551 {
2552 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2553 mbox->cmd.command = X25_READ_STATISTICS;
2554 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2555 } while (err && retry-- && x25_error(card, err, X25_READ_STATISTICS, 0)) ;
2556
2557 if (!err)
2558 {
2559 TX25Stats* stats = (void*)mbox->data;
2560
2561 card->wandev.stats.rx_packets = stats->rxData;
2562 card->wandev.stats.tx_packets = stats->txData;
2563 }
2564 return err;
2565}
2566
2567/*====================================================================
2568 * Close HDLC link.
2569 *===================================================================*/
2570
2571static int x25_close_hdlc (sdla_t* card)
2572{
2573 TX25Mbox* mbox = card->mbox;
2574 int retry = MAX_CMD_RETRY;
2575 int err;
2576
2577 do
2578 {
2579 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2580 mbox->cmd.command = X25_HDLC_LINK_CLOSE;
2581 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2582 } while (err && retry-- && x25_error(card, err, X25_HDLC_LINK_CLOSE, 0));
2583
2584 return err;
2585}
2586
2587
2588/*====================================================================
2589 * Open HDLC link.
2590 *===================================================================*/
2591
2592static int x25_open_hdlc (sdla_t* card)
2593{
2594 TX25Mbox* mbox = card->mbox;
2595 int retry = MAX_CMD_RETRY;
2596 int err;
2597
2598 do
2599 {
2600 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2601 mbox->cmd.command = X25_HDLC_LINK_OPEN;
2602 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2603 } while (err && retry-- && x25_error(card, err, X25_HDLC_LINK_OPEN, 0));
2604
2605 return err;
2606}
2607
2608/*=====================================================================
2609 * Setup HDLC link.
2610 *====================================================================*/
2611static int x25_setup_hdlc (sdla_t* card)
2612{
2613 TX25Mbox* mbox = card->mbox;
2614 int retry = MAX_CMD_RETRY;
2615 int err;
2616
2617 do
2618 {
2619 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2620 mbox->cmd.command = X25_HDLC_LINK_SETUP;
2621 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2622 } while (err && retry-- && x25_error(card, err, X25_HDLC_LINK_SETUP, 0));
2623
2624 return err;
2625}
2626
2627/*====================================================================
2628 * Set (raise/drop) DTR.
2629 *===================================================================*/
2630
2631static int x25_set_dtr (sdla_t* card, int dtr)
2632{
2633 TX25Mbox* mbox = card->mbox;
2634 int retry = MAX_CMD_RETRY;
2635 int err;
2636
2637 do
2638 {
2639 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2640 mbox->data[0] = 0;
2641 mbox->data[2] = 0;
2642 mbox->data[1] = dtr ? 0x02 : 0x01;
2643 mbox->cmd.length = 3;
2644 mbox->cmd.command = X25_SET_GLOBAL_VARS;
2645 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2646 } while (err && retry-- && x25_error(card, err, X25_SET_GLOBAL_VARS, 0));
2647
2648 return err;
2649}
2650
2651/*====================================================================
2652 * Set interrupt mode.
2653 *===================================================================*/
2654
2655static int x25_set_intr_mode (sdla_t* card, int mode)
2656{
2657 TX25Mbox* mbox = card->mbox;
2658 int retry = MAX_CMD_RETRY;
2659 int err;
2660
2661 do
2662 {
2663 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2664 mbox->data[0] = mode;
2665 if (card->hw.fwid == SFID_X25_508){
2666 mbox->data[1] = card->hw.irq;
2667 mbox->data[2] = 2;
2668 mbox->cmd.length = 3;
2669 }else {
2670 mbox->cmd.length = 1;
2671 }
2672 mbox->cmd.command = X25_SET_INTERRUPT_MODE;
2673 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2674 } while (err && retry-- && x25_error(card, err, X25_SET_INTERRUPT_MODE, 0));
2675
2676 return err;
2677}
2678
2679/*====================================================================
2680 * Read X.25 channel configuration.
2681 *===================================================================*/
2682
2683static int x25_get_chan_conf (sdla_t* card, x25_channel_t* chan)
2684{
2685 TX25Mbox* mbox = card->mbox;
2686 int retry = MAX_CMD_RETRY;
2687 int lcn = chan->common.lcn;
2688 int err;
2689
2690 do{
2691 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2692 mbox->cmd.lcn = lcn;
2693 mbox->cmd.command = X25_READ_CHANNEL_CONFIG;
2694 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2695 } while (err && retry-- && x25_error(card, err, X25_READ_CHANNEL_CONFIG, lcn));
2696
2697 if (!err)
2698 {
2699 TX25Status* status = card->flags;
2700
2701 /* calculate an offset into the array of status bytes */
2702 if (card->u.x.hi_svc <= X25_MAX_CHAN){
2703
2704 chan->ch_idx = lcn - 1;
2705
2706 }else{
2707 int offset;
2708
2709 /* FIX: Apr 14 2000 : Nenad Corbic
2710 * The data field was being compared to 0x1F using
2711 * '&&' instead of '&'.
2712 * This caused X25API to fail for LCNs greater than 255.
2713 */
2714 switch (mbox->data[0] & 0x1F)
2715 {
2716 case 0x01:
2717 offset = status->pvc_map; break;
2718 case 0x03:
2719 offset = status->icc_map; break;
2720 case 0x07:
2721 offset = status->twc_map; break;
2722 case 0x0B:
2723 offset = status->ogc_map; break;
2724 default:
2725 offset = 0;
2726 }
2727 chan->ch_idx = lcn - 1 - offset;
2728 }
2729
2730 /* get actual transmit packet size on this channel */
2731 switch(mbox->data[1] & 0x38)
2732 {
2733 case 0x00:
2734 chan->tx_pkt_size = 16;
2735 break;
2736 case 0x08:
2737 chan->tx_pkt_size = 32;
2738 break;
2739 case 0x10:
2740 chan->tx_pkt_size = 64;
2741 break;
2742 case 0x18:
2743 chan->tx_pkt_size = 128;
2744 break;
2745 case 0x20:
2746 chan->tx_pkt_size = 256;
2747 break;
2748 case 0x28:
2749 chan->tx_pkt_size = 512;
2750 break;
2751 case 0x30:
2752 chan->tx_pkt_size = 1024;
2753 break;
2754 }
2755 if (card->u.x.logging)
2756 printk(KERN_INFO "%s: X.25 packet size on LCN %d is %d.\n",
2757 card->devname, lcn, chan->tx_pkt_size);
2758 }
2759 return err;
2760}
2761
2762/*====================================================================
2763 * Place X.25 call.
2764 *====================================================================*/
2765
2766static int x25_place_call (sdla_t* card, x25_channel_t* chan)
2767{
2768 TX25Mbox* mbox = card->mbox;
2769 int retry = MAX_CMD_RETRY;
2770 int err;
2771 char str[64];
2772
2773
2774 if (chan->protocol == htons(ETH_P_IP)){
2775 sprintf(str, "-d%s -uCC", chan->addr);
2776
2777 }else if (chan->protocol == htons(ETH_P_IPX)){
2778 sprintf(str, "-d%s -u800000008137", chan->addr);
2779
2780 }
2781
2782 do
2783 {
2784 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2785 strcpy(mbox->data, str);
2786 mbox->cmd.length = strlen(str);
2787 mbox->cmd.command = X25_PLACE_CALL;
2788 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2789 } while (err && retry-- && x25_error(card, err, X25_PLACE_CALL, 0));
2790
2791 if (!err){
2792 bind_lcn_to_dev (card, chan->dev, mbox->cmd.lcn);
2793 }
2794 return err;
2795}
2796
2797/*====================================================================
2798 * Accept X.25 call.
2799 *====================================================================*/
2800
2801static int x25_accept_call (sdla_t* card, int lcn, int qdm)
2802{
2803 TX25Mbox* mbox = card->mbox;
2804 int retry = MAX_CMD_RETRY;
2805 int err;
2806
2807 do
2808 {
2809 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2810 mbox->cmd.lcn = lcn;
2811 mbox->cmd.qdm = qdm;
2812 mbox->cmd.command = X25_ACCEPT_CALL;
2813 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2814 } while (err && retry-- && x25_error(card, err, X25_ACCEPT_CALL, lcn));
2815
2816 return err;
2817}
2818
2819/*====================================================================
2820 * Clear X.25 call.
2821 *====================================================================*/
2822
2823static int x25_clear_call (sdla_t* card, int lcn, int cause, int diagn)
2824{
2825 TX25Mbox* mbox = card->mbox;
2826 int retry = MAX_CMD_RETRY;
2827 int err;
2828
2829 do
2830 {
2831 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2832 mbox->cmd.lcn = lcn;
2833 mbox->cmd.cause = cause;
2834 mbox->cmd.diagn = diagn;
2835 mbox->cmd.command = X25_CLEAR_CALL;
2836 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2837 } while (err && retry-- && x25_error(card, err, X25_CLEAR_CALL, lcn));
2838
2839 return err;
2840}
2841
2842/*====================================================================
2843 * Send X.25 data packet.
2844 *====================================================================*/
2845
2846static int x25_send (sdla_t* card, int lcn, int qdm, int len, void* buf)
2847{
2848 TX25Mbox* mbox = card->mbox;
2849 int retry = MAX_CMD_RETRY;
2850 int err;
2851 unsigned char cmd;
2852
2853 if (card->u.x.LAPB_hdlc)
2854 cmd = X25_HDLC_WRITE;
2855 else
2856 cmd = X25_WRITE;
2857
2858 do
2859 {
2860 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2861 memcpy(mbox->data, buf, len);
2862 mbox->cmd.length = len;
2863 mbox->cmd.lcn = lcn;
2864
2865 if (card->u.x.LAPB_hdlc){
2866 mbox->cmd.pf = qdm;
2867 }else{
2868 mbox->cmd.qdm = qdm;
2869 }
2870
2871 mbox->cmd.command = cmd;
2872 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2873 } while (err && retry-- && x25_error(card, err, cmd , lcn));
2874
2875
2876 /* If buffers are busy the return code for LAPB HDLC is
2877 * 1. The above functions are looking for return code
2878 * of X25RES_NOT_READY if busy. */
2879
2880 if (card->u.x.LAPB_hdlc && err == 1){
2881 err = X25RES_NOT_READY;
2882 }
2883
2884 return err;
2885}
2886
2887/*====================================================================
2888 * Fetch X.25 asynchronous events.
2889 *===================================================================*/
2890
2891static int x25_fetch_events (sdla_t* card)
2892{
2893 TX25Status* status = card->flags;
2894 TX25Mbox* mbox = card->mbox;
2895 int err = 0;
2896
2897 if (status->gflags & 0x20)
2898 {
2899 memset(&mbox->cmd, 0, sizeof(TX25Cmd));
2900 mbox->cmd.command = X25_IS_DATA_AVAILABLE;
2901 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
2902 if (err) x25_error(card, err, X25_IS_DATA_AVAILABLE, 0);
2903 }
2904 return err;
2905}
2906
2907/*====================================================================
2908 * X.25 asynchronous event/error handler.
2909 * This routine is called each time interface command returns
2910 * non-zero return code to handle X.25 asynchronous events and
2911 * common errors. Return non-zero to repeat command or zero to
2912 * cancel it.
2913 *
2914 * Notes:
2915 * 1. This function may be called recursively, as handling some of the
2916 * asynchronous events (e.g. call request) requires execution of the
2917 * interface command(s) that, in turn, may also return asynchronous
2918 * events. To avoid re-entrancy problems we copy mailbox to dynamically
2919 * allocated memory before processing events.
2920 *====================================================================*/
2921
2922static int x25_error (sdla_t* card, int err, int cmd, int lcn)
2923{
2924 int retry = 1;
2925 unsigned dlen = ((TX25Mbox*)card->mbox)->cmd.length;
2926 TX25Mbox* mb;
2927
2928 mb = kmalloc(sizeof(TX25Mbox) + dlen, GFP_ATOMIC);
2929 if (mb == NULL)
2930 {
2931 printk(KERN_ERR "%s: x25_error() out of memory!\n",
2932 card->devname);
2933 return 0;
2934 }
2935 memcpy(mb, card->mbox, sizeof(TX25Mbox) + dlen);
2936 switch (err){
2937
2938 case X25RES_ASYNC_PACKET: /* X.25 asynchronous packet was received */
2939
2940 mb->data[dlen] = '\0';
2941
2942 switch (mb->cmd.pktType & 0x7F){
2943
2944 case ASE_CALL_RQST: /* incoming call */
2945 retry = incoming_call(card, cmd, lcn, mb);
2946 break;
2947
2948 case ASE_CALL_ACCEPTED: /* connected */
2949 retry = call_accepted(card, cmd, lcn, mb);
2950 break;
2951
2952 case ASE_CLEAR_RQST: /* call clear request */
2953 retry = call_cleared(card, cmd, lcn, mb);
2954 break;
2955
2956 case ASE_RESET_RQST: /* reset request */
2957 printk(KERN_INFO "%s: X.25 reset request on LCN %d! "
2958 "Cause:0x%02X Diagn:0x%02X\n",
2959 card->devname, mb->cmd.lcn, mb->cmd.cause,
2960 mb->cmd.diagn);
2961 api_oob_event (card,mb);
2962 break;
2963
2964 case ASE_RESTART_RQST: /* restart request */
2965 retry = restart_event(card, cmd, lcn, mb);
2966 break;
2967
2968 case ASE_CLEAR_CONFRM:
2969 if (clear_confirm_event (card,mb))
2970 break;
2971
2972 /* I use the goto statement here so if
2973 * somebody inserts code between the
2974 * case and default, we will not have
2975 * ghost problems */
2976
2977 goto dflt_1;
2978
2979 default:
2980dflt_1:
2981 printk(KERN_INFO "%s: X.25 event 0x%02X on LCN %d! "
2982 "Cause:0x%02X Diagn:0x%02X\n",
2983 card->devname, mb->cmd.pktType,
2984 mb->cmd.lcn, mb->cmd.cause, mb->cmd.diagn);
2985 }
2986 break;
2987
2988 case X25RES_PROTO_VIOLATION: /* X.25 protocol violation indication */
2989
2990 /* Bug Fix: Mar 14 2000
2991 * The Protocol violation error conditions were
2992 * not handled previously */
2993
2994 switch (mb->cmd.pktType & 0x7F){
2995
2996 case PVE_CLEAR_RQST: /* Clear request */
2997 retry = call_cleared(card, cmd, lcn, mb);
2998 break;
2999
3000 case PVE_RESET_RQST: /* Reset request */
3001 printk(KERN_INFO "%s: X.25 reset request on LCN %d! "
3002 "Cause:0x%02X Diagn:0x%02X\n",
3003 card->devname, mb->cmd.lcn, mb->cmd.cause,
3004 mb->cmd.diagn);
3005 api_oob_event (card,mb);
3006 break;
3007
3008 case PVE_RESTART_RQST: /* Restart request */
3009 retry = restart_event(card, cmd, lcn, mb);
3010 break;
3011
3012 default :
3013 printk(KERN_INFO
3014 "%s: X.25 protocol violation on LCN %d! "
3015 "Packet:0x%02X Cause:0x%02X Diagn:0x%02X\n",
3016 card->devname, mb->cmd.lcn,
3017 mb->cmd.pktType & 0x7F, mb->cmd.cause, mb->cmd.diagn);
3018 api_oob_event(card,mb);
3019 }
3020 break;
3021
3022 case 0x42: /* X.25 timeout */
3023 retry = timeout_event(card, cmd, lcn, mb);
3024 break;
3025
3026 case 0x43: /* X.25 retry limit exceeded */
3027 printk(KERN_INFO
3028 "%s: exceeded X.25 retry limit on LCN %d! "
3029 "Packet:0x%02X Diagn:0x%02X\n", card->devname,
3030 mb->cmd.lcn, mb->cmd.pktType, mb->cmd.diagn)
3031 ;
3032 break;
3033
3034 case 0x08: /* modem failure */
3035#ifndef MODEM_NOT_LOG
3036 printk(KERN_INFO "%s: modem failure!\n", card->devname);
3037#endif /* MODEM_NOT_LOG */
3038 api_oob_event(card,mb);
3039 break;
3040
3041 case 0x09: /* N2 retry limit */
3042 printk(KERN_INFO "%s: exceeded HDLC retry limit!\n",
3043 card->devname);
3044 api_oob_event(card,mb);
3045 break;
3046
3047 case 0x06: /* unnumbered frame was received while in ABM */
3048 printk(KERN_INFO "%s: received Unnumbered frame 0x%02X!\n",
3049 card->devname, mb->data[0]);
3050 api_oob_event(card,mb);
3051 break;
3052
3053 case CMD_TIMEOUT:
3054 printk(KERN_ERR "%s: command 0x%02X timed out!\n",
3055 card->devname, cmd)
3056 ;
3057 retry = 0; /* abort command */
3058 break;
3059
3060 case X25RES_NOT_READY:
3061 retry = 1;
3062 break;
3063
3064 case 0x01:
3065 if (card->u.x.LAPB_hdlc)
3066 break;
3067
3068 if (mb->cmd.command == 0x16)
3069 break;
3070 /* I use the goto statement here so if
3071 * somebody inserts code between the
3072 * case and default, we will not have
3073 * ghost problems */
3074 goto dflt_2;
3075
3076 default:
3077dflt_2:
3078 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X! Lcn %i\n",
3079 card->devname, cmd, err, mb->cmd.lcn)
3080 ;
3081 retry = 0; /* abort command */
3082 }
3083 kfree(mb);
3084 return retry;
3085}
3086
3087/*====================================================================
3088 * X.25 Asynchronous Event Handlers
3089 * These functions are called by the x25_error() and should return 0, if
3090 * the command resulting in the asynchronous event must be aborted.
3091 *====================================================================*/
3092
3093
3094
3095/*====================================================================
3096 *Handle X.25 incoming call request.
3097 * RFC 1356 establishes the following rules:
3098 * 1. The first octet in the Call User Data (CUD) field of the call
3099 * request packet contains NLPID identifying protocol encapsulation
3100 * 2. Calls MUST NOT be accepted unless router supports requested
3101 * protocol encapsulation.
3102 * 3. A diagnostic code 249 defined by ISO/IEC 8208 may be used
3103 * when clearing a call because protocol encapsulation is not
3104 * supported.
3105 * 4. If an incoming call is received while a call request is
3106 * pending (i.e. call collision has occurred), the incoming call
3107 * shall be rejected and call request shall be retried.
3108 *====================================================================*/
3109
3110static int incoming_call (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
3111{
3112 struct wan_device* wandev = &card->wandev;
3113 int new_lcn = mb->cmd.lcn;
3114 struct net_device* dev = get_dev_by_lcn(wandev, new_lcn);
3115 x25_channel_t* chan = NULL;
3116 int accept = 0; /* set to '1' if o.k. to accept call */
3117 unsigned int user_data;
3118 x25_call_info_t* info;
3119
3120 /* Make sure there is no call collision */
3121 if (dev != NULL)
3122 {
3123 printk(KERN_INFO
3124 "%s: X.25 incoming call collision on LCN %d!\n",
3125 card->devname, new_lcn);
3126
3127 x25_clear_call(card, new_lcn, 0, 0);
3128 return 1;
3129 }
3130
3131 /* Make sure D bit is not set in call request */
3132//FIXME: THIS IS NOT TURE !!!! TAKE IT OUT
3133// if (mb->cmd.qdm & 0x02)
3134// {
3135// printk(KERN_INFO
3136// "%s: X.25 incoming call on LCN %d with D-bit set!\n",
3137// card->devname, new_lcn);
3138//
3139// x25_clear_call(card, new_lcn, 0, 0);
3140// return 1;
3141// }
3142
3143 /* Parse call request data */
3144 info = kmalloc(sizeof(x25_call_info_t), GFP_ATOMIC);
3145 if (info == NULL)
3146 {
3147 printk(KERN_ERR
3148 "%s: not enough memory to parse X.25 incoming call "
3149 "on LCN %d!\n", card->devname, new_lcn);
3150 x25_clear_call(card, new_lcn, 0, 0);
3151 return 1;
3152 }
3153
3154 parse_call_info(mb->data, info);
3155
3156 if (card->u.x.logging)
3157 printk(KERN_INFO "\n%s: X.25 incoming call on LCN %d!\n",
3158 card->devname, new_lcn);
3159
3160 /* Conver the first two ASCII characters into an
3161 * interger. Used to check the incoming protocol
3162 */
3163 user_data = hex_to_uint(info->user,2);
3164
3165 /* Find available channel */
3166 for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) {
3167 chan = dev->priv;
3168
3169 if (chan->common.usedby == API)
3170 continue;
3171
3172 if (!chan->common.svc || (chan->common.state != WAN_DISCONNECTED))
3173 continue;
3174
3175 if (user_data == NLPID_IP && chan->protocol != htons(ETH_P_IP)){
3176 printk(KERN_INFO "IP packet but configured for IPX : %x, %x\n",
3177 htons(chan->protocol), info->user[0]);
3178 continue;
3179 }
3180
3181 if (user_data == NLPID_SNAP && chan->protocol != htons(ETH_P_IPX)){
3182 printk(KERN_INFO "IPX packet but configured for IP: %x\n",
3183 htons(chan->protocol));
3184 continue;
3185 }
3186 if (strcmp(info->src, chan->addr) == 0)
3187 break;
3188
3189 /* If just an '@' is specified, accept all incoming calls */
3190 if (strcmp(chan->addr, "") == 0)
3191 break;
3192 }
3193
3194 if (dev == NULL){
3195
3196 /* If the call is not for any WANPIPE interfaces
3197 * check to see if there is an API listening queue
3198 * waiting for data. If there is send the packet
3199 * up the stack.
3200 */
3201 if (card->sk != NULL && card->func != NULL){
3202 if (api_incoming_call(card,mb,new_lcn)){
3203 x25_clear_call(card, new_lcn, 0, 0);
3204 }
3205 accept = 0;
3206 }else{
3207 printk(KERN_INFO "%s: no channels available!\n",
3208 card->devname);
3209
3210 x25_clear_call(card, new_lcn, 0, 0);
3211 }
3212
3213 }else if (info->nuser == 0){
3214
3215 printk(KERN_INFO
3216 "%s: no user data in incoming call on LCN %d!\n",
3217 card->devname, new_lcn)
3218 ;
3219 x25_clear_call(card, new_lcn, 0, 0);
3220
3221 }else switch (info->user[0]){
3222
3223 case 0: /* multiplexed */
3224 chan->protocol = htons(0);
3225 accept = 1;
3226 break;
3227
3228 case NLPID_IP: /* IP datagrams */
3229 accept = 1;
3230 break;
3231
3232 case NLPID_SNAP: /* IPX datagrams */
3233 accept = 1;
3234 break;
3235
3236 default:
3237 printk(KERN_INFO
3238 "%s: unsupported NLPID 0x%02X in incoming call "
3239 "on LCN %d!\n", card->devname, info->user[0], new_lcn);
3240 x25_clear_call(card, new_lcn, 0, 249);
3241 }
3242
3243 if (accept && (x25_accept_call(card, new_lcn, 0) == CMD_OK)){
3244
3245 bind_lcn_to_dev (card, chan->dev, new_lcn);
3246
3247 if (x25_get_chan_conf(card, chan) == CMD_OK)
3248 set_chan_state(dev, WAN_CONNECTED);
3249 else
3250 x25_clear_call(card, new_lcn, 0, 0);
3251 }
3252 kfree(info);
3253 return 1;
3254}
3255
3256/*====================================================================
3257 * Handle accepted call.
3258 *====================================================================*/
3259
3260static int call_accepted (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
3261{
3262 unsigned new_lcn = mb->cmd.lcn;
3263 struct net_device* dev = find_channel(card, new_lcn);
3264 x25_channel_t* chan;
3265
3266 if (dev == NULL){
3267 printk(KERN_INFO
3268 "%s: clearing orphaned connection on LCN %d!\n",
3269 card->devname, new_lcn);
3270 x25_clear_call(card, new_lcn, 0, 0);
3271 return 1;
3272 }
3273
3274 if (card->u.x.logging)
3275 printk(KERN_INFO "%s: X.25 call accepted on Dev %s and LCN %d!\n",
3276 card->devname, dev->name, new_lcn);
3277
3278 /* Get channel configuration and notify router */
3279 chan = dev->priv;
3280 if (x25_get_chan_conf(card, chan) != CMD_OK)
3281 {
3282 x25_clear_call(card, new_lcn, 0, 0);
3283 return 1;
3284 }
3285
3286 set_chan_state(dev, WAN_CONNECTED);
3287
3288 if (chan->common.usedby == API){
3289 send_delayed_cmd_result(card,dev,mb);
3290 bind_lcn_to_dev (card, dev, new_lcn);
3291 }
3292
3293 return 1;
3294}
3295
3296/*====================================================================
3297 * Handle cleared call.
3298 *====================================================================*/
3299
3300static int call_cleared (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
3301{
3302 unsigned new_lcn = mb->cmd.lcn;
3303 struct net_device* dev = find_channel(card, new_lcn);
3304 x25_channel_t *chan;
3305 unsigned char old_state;
3306
3307 if (card->u.x.logging){
3308 printk(KERN_INFO "%s: X.25 clear request on LCN %d! Cause:0x%02X "
3309 "Diagn:0x%02X\n",
3310 card->devname, new_lcn, mb->cmd.cause, mb->cmd.diagn);
3311 }
3312
3313 if (dev == NULL){
3314 printk(KERN_INFO "%s: X.25 clear request : No device for clear\n",
3315 card->devname);
3316 return 1;
3317 }
3318
3319 chan=dev->priv;
3320
3321 old_state = chan->common.state;
3322
3323 set_chan_state(dev, WAN_DISCONNECTED);
3324
3325 if (chan->common.usedby == API){
3326
3327 switch (old_state){
3328
3329 case WAN_CONNECTING:
3330 send_delayed_cmd_result(card,dev,mb);
3331 break;
3332 case WAN_CONNECTED:
3333 send_oob_msg(card,dev,mb);
3334 break;
3335 }
3336 }
3337
3338 return ((cmd == X25_WRITE) && (lcn == new_lcn)) ? 0 : 1;
3339}
3340
3341/*====================================================================
3342 * Handle X.25 restart event.
3343 *====================================================================*/
3344
3345static int restart_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
3346{
3347 struct wan_device* wandev = &card->wandev;
3348 struct net_device* dev;
3349 x25_channel_t *chan;
3350 unsigned char old_state;
3351
3352 printk(KERN_INFO
3353 "%s: X.25 restart request! Cause:0x%02X Diagn:0x%02X\n",
3354 card->devname, mb->cmd.cause, mb->cmd.diagn);
3355
3356 /* down all logical channels */
3357 for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv)) {
3358 chan=dev->priv;
3359 old_state = chan->common.state;
3360
3361 set_chan_state(dev, WAN_DISCONNECTED);
3362
3363 if (chan->common.usedby == API){
3364 switch (old_state){
3365
3366 case WAN_CONNECTING:
3367 send_delayed_cmd_result(card,dev,mb);
3368 break;
3369 case WAN_CONNECTED:
3370 send_oob_msg(card,dev,mb);
3371 break;
3372 }
3373 }
3374 }
3375 return (cmd == X25_WRITE) ? 0 : 1;
3376}
3377
3378/*====================================================================
3379 * Handle timeout event.
3380 *====================================================================*/
3381
3382static int timeout_event (sdla_t* card, int cmd, int lcn, TX25Mbox* mb)
3383{
3384 unsigned new_lcn = mb->cmd.lcn;
3385
3386 if (mb->cmd.pktType == 0x05) /* call request time out */
3387 {
3388 struct net_device* dev = find_channel(card,new_lcn);
3389
3390 printk(KERN_INFO "%s: X.25 call timed timeout on LCN %d!\n",
3391 card->devname, new_lcn);
3392
3393 if (dev){
3394 x25_channel_t *chan = dev->priv;
3395 set_chan_state(dev, WAN_DISCONNECTED);
3396
3397 if (chan->common.usedby == API){
3398 send_delayed_cmd_result(card,dev,card->mbox);
3399 }
3400 }
3401 }else{
3402 printk(KERN_INFO "%s: X.25 packet 0x%02X timeout on LCN %d!\n",
3403 card->devname, mb->cmd.pktType, new_lcn);
3404 }
3405 return 1;
3406}
3407
3408/*
3409 * Miscellaneous
3410 */
3411
3412/*====================================================================
3413 * Establish physical connection.
3414 * o open HDLC and raise DTR
3415 *
3416 * Return: 0 connection established
3417 * 1 connection is in progress
3418 * <0 error
3419 *===================================================================*/
3420
3421static int connect (sdla_t* card)
3422{
3423 TX25Status* status = card->flags;
3424
3425 if (x25_open_hdlc(card) || x25_setup_hdlc(card))
3426 return -EIO;
3427
3428 wanpipe_set_state(card, WAN_CONNECTING);
3429
3430 x25_set_intr_mode(card, INTR_ON_TIMER);
3431 status->imask &= ~INTR_ON_TIMER;
3432
3433 return 1;
3434}
3435
3436/*
3437 * Tear down physical connection.
3438 * o close HDLC link
3439 * o drop DTR
3440 *
3441 * Return: 0
3442 * <0 error
3443 */
3444
3445static int disconnect (sdla_t* card)
3446{
3447 wanpipe_set_state(card, WAN_DISCONNECTED);
3448 x25_set_intr_mode(card, INTR_ON_TIMER); /* disable all interrupt except timer */
3449 x25_close_hdlc(card); /* close HDLC link */
3450 x25_set_dtr(card, 0); /* drop DTR */
3451 return 0;
3452}
3453
3454/*
3455 * Find network device by its channel number.
3456 */
3457
3458static struct net_device* get_dev_by_lcn(struct wan_device* wandev,
3459 unsigned lcn)
3460{
3461 struct net_device* dev;
3462
3463 for (dev = wandev->dev; dev; dev = *((struct net_device **)dev->priv))
3464 if (((x25_channel_t*)dev->priv)->common.lcn == lcn)
3465 break;
3466 return dev;
3467}
3468
3469/*
3470 * Initiate connection on the logical channel.
3471 * o for PVC we just get channel configuration
3472 * o for SVCs place an X.25 call
3473 *
3474 * Return: 0 connected
3475 * >0 connection in progress
3476 * <0 failure
3477 */
3478
3479static int chan_connect(struct net_device* dev)
3480{
3481 x25_channel_t* chan = dev->priv;
3482 sdla_t* card = chan->card;
3483
3484 if (chan->common.svc && chan->common.usedby == WANPIPE){
3485 if (!chan->addr[0]){
3486 printk(KERN_INFO "%s: No Destination Address\n",
3487 card->devname);
3488 return -EINVAL; /* no destination address */
3489 }
3490 printk(KERN_INFO "%s: placing X.25 call to %s ...\n",
3491 card->devname, chan->addr);
3492
3493 if (x25_place_call(card, chan) != CMD_OK)
3494 return -EIO;
3495
3496 set_chan_state(dev, WAN_CONNECTING);
3497 return 1;
3498 }else{
3499 if (x25_get_chan_conf(card, chan) != CMD_OK)
3500 return -EIO;
3501
3502 set_chan_state(dev, WAN_CONNECTED);
3503 }
3504 return 0;
3505}
3506
3507/*
3508 * Disconnect logical channel.
3509 * o if SVC then clear X.25 call
3510 */
3511
3512static int chan_disc(struct net_device* dev)
3513{
3514 x25_channel_t* chan = dev->priv;
3515
3516 if (chan->common.svc){
3517 x25_clear_call(chan->card, chan->common.lcn, 0, 0);
3518
3519 /* For API we disconnect on clear
3520 * confirmation.
3521 */
3522 if (chan->common.usedby == API)
3523 return 0;
3524 }
3525
3526 set_chan_state(dev, WAN_DISCONNECTED);
3527
3528 return 0;
3529}
3530
3531/*
3532 * Set logical channel state.
3533 */
3534
3535static void set_chan_state(struct net_device* dev, int state)
3536{
3537 x25_channel_t* chan = dev->priv;
3538 sdla_t* card = chan->card;
3539 unsigned long flags;
3540
3541 save_flags(flags);
3542 cli();
3543 if (chan->common.state != state)
3544 {
3545 switch (state)
3546 {
3547 case WAN_CONNECTED:
3548 if (card->u.x.logging){
3549 printk (KERN_INFO
3550 "%s: interface %s connected, lcn %i !\n",
3551 card->devname, dev->name,chan->common.lcn);
3552 }
3553 *(unsigned short*)dev->dev_addr = htons(chan->common.lcn);
3554 chan->i_timeout_sofar = jiffies;
3555
3556 /* LAPB is PVC Based */
3557 if (card->u.x.LAPB_hdlc)
3558 chan->common.svc=0;
3559 break;
3560
3561 case WAN_CONNECTING:
3562 if (card->u.x.logging){
3563 printk (KERN_INFO
3564 "%s: interface %s connecting, lcn %i ...\n",
3565 card->devname, dev->name, chan->common.lcn);
3566 }
3567 break;
3568
3569 case WAN_DISCONNECTED:
3570 if (card->u.x.logging){
3571 printk (KERN_INFO
3572 "%s: interface %s disconnected, lcn %i !\n",
3573 card->devname, dev->name,chan->common.lcn);
3574 }
3575 atomic_set(&chan->common.disconnect,0);
3576
3577 if (chan->common.svc) {
3578 *(unsigned short*)dev->dev_addr = 0;
3579 card->u.x.svc_to_dev_map[(chan->common.lcn%X25_MAX_CHAN)]=NULL;
3580 chan->common.lcn = 0;
3581 }
3582
3583 if (chan->transmit_length){
3584 chan->transmit_length=0;
3585 atomic_set(&chan->common.driver_busy,0);
3586 chan->tx_offset=0;
3587 if (netif_queue_stopped(dev)){
3588 netif_wake_queue(dev);
3589 }
3590 }
3591 atomic_set(&chan->common.command,0);
3592 break;
3593
3594 case WAN_DISCONNECTING:
3595 if (card->u.x.logging){
3596 printk (KERN_INFO
3597 "\n%s: interface %s disconnecting, lcn %i ...\n",
3598 card->devname, dev->name,chan->common.lcn);
3599 }
3600 atomic_set(&chan->common.disconnect,0);
3601 break;
3602 }
3603 chan->common.state = state;
3604 }
3605 chan->state_tick = jiffies;
3606 restore_flags(flags);
3607}
3608
3609/*
3610 * Send packet on a logical channel.
3611 * When this function is called, tx_skb field of the channel data
3612 * space points to the transmit socket buffer. When transmission
3613 * is complete, release socket buffer and reset 'tbusy' flag.
3614 *
3615 * Return: 0 - transmission complete
3616 * 1 - busy
3617 *
3618 * Notes:
3619 * 1. If packet length is greater than MTU for this channel, we'll fragment
3620 * the packet into 'complete sequence' using M-bit.
3621 * 2. When transmission is complete, an event notification should be issued
3622 * to the router.
3623 */
3624
3625static int chan_send(struct net_device* dev, void* buff, unsigned data_len,
3626 unsigned char tx_intr)
3627{
3628 x25_channel_t* chan = dev->priv;
3629 sdla_t* card = chan->card;
3630 TX25Status* status = card->flags;
3631 unsigned len=0, qdm=0, res=0, orig_len = 0;
3632 void *data;
3633
3634 /* Check to see if channel is ready */
3635 if ((!(status->cflags[chan->ch_idx] & 0x40) && !card->u.x.LAPB_hdlc) ||
3636 !(*card->u.x.hdlc_buf_status & 0x40)){
3637
3638 if (!tx_intr){
3639 setup_for_delayed_transmit (dev, buff, data_len);
3640 return 0;
3641 }else{
3642 /* By returning 0 to tx_intr the packet will be dropped */
3643 ++card->wandev.stats.tx_dropped;
3644 ++chan->ifstats.tx_dropped;
3645 printk(KERN_INFO "%s: ERROR, Tx intr could not send, dropping %s:\n",
3646 card->devname,dev->name);
3647 ++chan->if_send_stat.if_send_bfr_not_passed_to_adptr;
3648 return 0;
3649 }
3650 }
3651
3652 if (chan->common.usedby == API){
3653 /* Remove the API Header */
3654 x25api_hdr_t *api_data = (x25api_hdr_t *)buff;
3655
3656 /* Set the qdm bits from the packet header
3657 * User has the option to set the qdm bits
3658 */
3659 qdm = api_data->qdm;
3660
3661 orig_len = len = data_len - sizeof(x25api_hdr_t);
3662 data = (unsigned char*)buff + sizeof(x25api_hdr_t);
3663 }else{
3664 data = buff;
3665 orig_len = len = data_len;
3666 }
3667
3668 if (tx_intr){
3669 /* We are in tx_intr, minus the tx_offset from
3670 * the total length. The tx_offset part of the
3671 * data has already been sent. Also, move the
3672 * data pointer to proper offset location.
3673 */
3674 len -= chan->tx_offset;
3675 data = (unsigned char*)data + chan->tx_offset;
3676 }
3677
3678 /* Check if the packet length is greater than MTU
3679 * If YES: Cut the len to MTU and set the M bit
3680 */
3681 if (len > chan->tx_pkt_size && !card->u.x.LAPB_hdlc){
3682 len = chan->tx_pkt_size;
3683 qdm |= M_BIT;
3684 }
3685
3686
3687 /* Pass only first three bits of the qdm byte to the send
3688 * routine. In case user sets any other bit which might
3689 * cause errors.
3690 */
3691
3692 switch(x25_send(card, chan->common.lcn, (qdm&0x07), len, data)){
3693 case 0x00: /* success */
3694 chan->i_timeout_sofar = jiffies;
3695
3696 dev->trans_start=jiffies;
3697
3698 if ((qdm & M_BIT) && !card->u.x.LAPB_hdlc){
3699 if (!tx_intr){
3700 /* The M bit was set, which means that part of the
3701 * packet has been sent. Copy the packet into a buffer
3702 * and set the offset to len, so on next tx_inter
3703 * the packet will be sent using the below offset.
3704 */
3705 chan->tx_offset += len;
3706
3707 ++chan->ifstats.tx_packets;
3708 chan->ifstats.tx_bytes += len;
3709
3710 if (chan->tx_offset < orig_len){
3711 setup_for_delayed_transmit (dev, buff, data_len);
3712 }
3713 res=0;
3714 }else{
3715 /* We are already in tx_inter, thus data is already
3716 * in the buffer. Update the offset and wait for
3717 * next tx_intr. We add on to the offset, since data can
3718 * be X number of times larger than max data size.
3719 */
3720 ++chan->ifstats.tx_packets;
3721 chan->ifstats.tx_bytes += len;
3722
3723 ++chan->if_send_stat.if_send_bfr_passed_to_adptr;
3724 chan->tx_offset += len;
3725
3726 /* The user can set the qdm bit as well.
3727 * If the entire packet was sent and qdm is still
3728 * set, than it's the user who has set the M bit. In that,
3729 * case indicate that the packet was send by returning
3730 * 0 and wait for a new packet. Otherwise, wait for next
3731 * tx interrupt to send the rest of the packet */
3732
3733 if (chan->tx_offset < orig_len){
3734 res=1;
3735 }else{
3736 res=0;
3737 }
3738 }
3739 }else{
3740 ++chan->ifstats.tx_packets;
3741 chan->ifstats.tx_bytes += len;
3742 ++chan->if_send_stat.if_send_bfr_passed_to_adptr;
3743 res=0;
3744 }
3745 break;
3746
3747 case 0x33: /* Tx busy */
3748 if (tx_intr){
3749 printk(KERN_INFO "%s: Tx_intr: Big Error dropping packet %s\n",
3750 card->devname,dev->name);
3751 ++chan->ifstats.tx_dropped;
3752 ++card->wandev.stats.tx_dropped;
3753 ++chan->if_send_stat.if_send_bfr_not_passed_to_adptr;
3754 res=0;
3755 }else{
3756 DBG_PRINTK(KERN_INFO
3757 "%s: Send: Big Error should have tx: storring %s\n",
3758 card->devname,dev->name);
3759 setup_for_delayed_transmit (dev, buff, data_len);
3760 res=1;
3761 }
3762 break;
3763
3764 default: /* failure */
3765 ++chan->ifstats.tx_errors;
3766 if (tx_intr){
3767 printk(KERN_INFO "%s: Tx_intr: Failure to send, dropping %s\n",
3768 card->devname,dev->name);
3769 ++chan->ifstats.tx_dropped;
3770 ++card->wandev.stats.tx_dropped;
3771 ++chan->if_send_stat.if_send_bfr_not_passed_to_adptr;
3772 res=0;
3773 }else{
3774 DBG_PRINTK(KERN_INFO "%s: Send: Failure to send !!!, storing %s\n",
3775 card->devname,dev->name);
3776 setup_for_delayed_transmit (dev, buff, data_len);
3777 res=1;
3778 }
3779 break;
3780 }
3781 return res;
3782}
3783
3784
3785/*
3786 * Parse X.25 call request data and fill x25_call_info_t structure.
3787 */
3788
3789static void parse_call_info (unsigned char* str, x25_call_info_t* info)
3790{
3791 memset(info, 0, sizeof(x25_call_info_t));
3792 for (; *str; ++str)
3793 {
3794 int i;
3795 unsigned char ch;
3796
3797 if (*str == '-') switch (str[1]) {
3798
3799 /* Take minus 2 off the maximum size so that
3800 * last byte is 0. This way we can use string
3801 * manipulaton functions on call information.
3802 */
3803
3804 case 'd': /* destination address */
3805 for (i = 0; i < (MAX_X25_ADDR_SIZE-2); ++i){
3806 ch = str[2+i];
3807 if (isspace(ch)) break;
3808 info->dest[i] = ch;
3809 }
3810 break;
3811
3812 case 's': /* source address */
3813 for (i = 0; i < (MAX_X25_ADDR_SIZE-2); ++i){
3814 ch = str[2+i];
3815 if (isspace(ch)) break;
3816 info->src[i] = ch;
3817 }
3818 break;
3819
3820 case 'u': /* user data */
3821 for (i = 0; i < (MAX_X25_DATA_SIZE-2); ++i){
3822 ch = str[2+i];
3823 if (isspace(ch)) break;
3824 info->user[i] = ch;
3825 }
3826 info->nuser = i;
3827 break;
3828
3829 case 'f': /* facilities */
3830 for (i = 0; i < (MAX_X25_FACL_SIZE-2); ++i){
3831 ch = str[2+i];
3832 if (isspace(ch)) break;
3833 info->facil[i] = ch;
3834 }
3835 info->nfacil = i;
3836 break;
3837 }
3838 }
3839}
3840
3841/*
3842 * Convert line speed in bps to a number used by S502 code.
3843 */
3844
3845static unsigned char bps_to_speed_code (unsigned long bps)
3846{
3847 unsigned char number;
3848
3849 if (bps <= 1200) number = 0x01;
3850 else if (bps <= 2400) number = 0x02;
3851 else if (bps <= 4800) number = 0x03;
3852 else if (bps <= 9600) number = 0x04;
3853 else if (bps <= 19200) number = 0x05;
3854 else if (bps <= 38400) number = 0x06;
3855 else if (bps <= 45000) number = 0x07;
3856 else if (bps <= 56000) number = 0x08;
3857 else if (bps <= 64000) number = 0x09;
3858 else if (bps <= 74000) number = 0x0A;
3859 else if (bps <= 112000) number = 0x0B;
3860 else if (bps <= 128000) number = 0x0C;
3861 else number = 0x0D;
3862
3863 return number;
3864}
3865
3866/*
3867 * Convert decimal string to unsigned integer.
3868 * If len != 0 then only 'len' characters of the string are converted.
3869 */
3870
3871static unsigned int dec_to_uint (unsigned char* str, int len)
3872{
3873 unsigned val;
3874
3875 if (!len)
3876 len = strlen(str);
3877
3878 for (val = 0; len && isdigit(*str); ++str, --len)
3879 val = (val * 10) + (*str - (unsigned)'0');
3880
3881 return val;
3882}
3883
3884/*
3885 * Convert hex string to unsigned integer.
3886 * If len != 0 then only 'len' characters of the string are conferted.
3887 */
3888
3889static unsigned int hex_to_uint (unsigned char* str, int len)
3890{
3891 unsigned val, ch;
3892
3893 if (!len)
3894 len = strlen(str);
3895
3896 for (val = 0; len; ++str, --len)
3897 {
3898 ch = *str;
3899 if (isdigit(ch))
3900 val = (val << 4) + (ch - (unsigned)'0');
3901 else if (isxdigit(ch))
3902 val = (val << 4) + ((ch & 0xDF) - (unsigned)'A' + 10);
3903 else break;
3904 }
3905 return val;
3906}
3907
3908
3909static int handle_IPXWAN(unsigned char *sendpacket, char *devname, unsigned char enable_IPX, unsigned long network_number, unsigned short proto)
3910{
3911 int i;
3912
3913 if( proto == ETH_P_IPX) {
3914 /* It's an IPX packet */
3915 if(!enable_IPX) {
3916 /* Return 1 so we don't pass it up the stack. */
3917 return 1;
3918 }
3919 } else {
3920 /* It's not IPX so pass it up the stack.*/
3921 return 0;
3922 }
3923
3924 if( sendpacket[16] == 0x90 &&
3925 sendpacket[17] == 0x04)
3926 {
3927 /* It's IPXWAN */
3928
3929 if( sendpacket[2] == 0x02 &&
3930 sendpacket[34] == 0x00)
3931 {
3932 /* It's a timer request packet */
3933 printk(KERN_INFO "%s: Received IPXWAN Timer Request packet\n",devname);
3934
3935 /* Go through the routing options and answer no to every
3936 * option except Unnumbered RIP/SAP
3937 */
3938 for(i = 41; sendpacket[i] == 0x00; i += 5)
3939 {
3940 /* 0x02 is the option for Unnumbered RIP/SAP */
3941 if( sendpacket[i + 4] != 0x02)
3942 {
3943 sendpacket[i + 1] = 0;
3944 }
3945 }
3946
3947 /* Skip over the extended Node ID option */
3948 if( sendpacket[i] == 0x04 )
3949 {
3950 i += 8;
3951 }
3952
3953 /* We also want to turn off all header compression opt. */
3954 for(; sendpacket[i] == 0x80 ;)
3955 {
3956 sendpacket[i + 1] = 0;
3957 i += (sendpacket[i + 2] << 8) + (sendpacket[i + 3]) + 4;
3958 }
3959
3960 /* Set the packet type to timer response */
3961 sendpacket[34] = 0x01;
3962
3963 printk(KERN_INFO "%s: Sending IPXWAN Timer Response\n",devname);
3964 }
3965 else if( sendpacket[34] == 0x02 )
3966 {
3967 /* This is an information request packet */
3968 printk(KERN_INFO "%s: Received IPXWAN Information Request packet\n",devname);
3969
3970 /* Set the packet type to information response */
3971 sendpacket[34] = 0x03;
3972
3973 /* Set the router name */
3974 sendpacket[51] = 'X';
3975 sendpacket[52] = 'T';
3976 sendpacket[53] = 'P';
3977 sendpacket[54] = 'I';
3978 sendpacket[55] = 'P';
3979 sendpacket[56] = 'E';
3980 sendpacket[57] = '-';
3981 sendpacket[58] = CVHexToAscii(network_number >> 28);
3982 sendpacket[59] = CVHexToAscii((network_number & 0x0F000000)>> 24);
3983 sendpacket[60] = CVHexToAscii((network_number & 0x00F00000)>> 20);
3984 sendpacket[61] = CVHexToAscii((network_number & 0x000F0000)>> 16);
3985 sendpacket[62] = CVHexToAscii((network_number & 0x0000F000)>> 12);
3986 sendpacket[63] = CVHexToAscii((network_number & 0x00000F00)>> 8);
3987 sendpacket[64] = CVHexToAscii((network_number & 0x000000F0)>> 4);
3988 sendpacket[65] = CVHexToAscii(network_number & 0x0000000F);
3989 for(i = 66; i < 99; i+= 1)
3990 {
3991 sendpacket[i] = 0;
3992 }
3993
3994 printk(KERN_INFO "%s: Sending IPXWAN Information Response packet\n",devname);
3995 }
3996 else
3997 {
3998 printk(KERN_INFO "%s: Unknown IPXWAN packet!\n",devname);
3999 return 0;
4000 }
4001
4002 /* Set the WNodeID to our network address */
4003 sendpacket[35] = (unsigned char)(network_number >> 24);
4004 sendpacket[36] = (unsigned char)((network_number & 0x00FF0000) >> 16);
4005 sendpacket[37] = (unsigned char)((network_number & 0x0000FF00) >> 8);
4006 sendpacket[38] = (unsigned char)(network_number & 0x000000FF);
4007
4008 return 1;
4009 } else {
4010 /*If we get here it's an IPX-data packet, so it'll get passed up the stack.
4011 */
4012 /* switch the network numbers */
4013 switch_net_numbers(sendpacket, network_number, 1);
4014 return 0;
4015 }
4016}
4017
4018/*
4019 * If incoming is 0 (outgoing)- if the net numbers is ours make it 0
4020 * if incoming is 1 - if the net number is 0 make it ours
4021 */
4022
4023static void switch_net_numbers(unsigned char *sendpacket, unsigned long network_number, unsigned char incoming)
4024{
4025 unsigned long pnetwork_number;
4026
4027 pnetwork_number = (unsigned long)((sendpacket[6] << 24) +
4028 (sendpacket[7] << 16) + (sendpacket[8] << 8) +
4029 sendpacket[9]);
4030
4031
4032 if (!incoming) {
4033 /*If the destination network number is ours, make it 0 */
4034 if( pnetwork_number == network_number) {
4035 sendpacket[6] = sendpacket[7] = sendpacket[8] =
4036 sendpacket[9] = 0x00;
4037 }
4038 } else {
4039 /* If the incoming network is 0, make it ours */
4040 if( pnetwork_number == 0) {
4041 sendpacket[6] = (unsigned char)(network_number >> 24);
4042 sendpacket[7] = (unsigned char)((network_number &
4043 0x00FF0000) >> 16);
4044 sendpacket[8] = (unsigned char)((network_number &
4045 0x0000FF00) >> 8);
4046 sendpacket[9] = (unsigned char)(network_number &
4047 0x000000FF);
4048 }
4049 }
4050
4051
4052 pnetwork_number = (unsigned long)((sendpacket[18] << 24) +
4053 (sendpacket[19] << 16) + (sendpacket[20] << 8) +
4054 sendpacket[21]);
4055
4056
4057 if( !incoming ) {
4058 /* If the source network is ours, make it 0 */
4059 if( pnetwork_number == network_number) {
4060 sendpacket[18] = sendpacket[19] = sendpacket[20] =
4061 sendpacket[21] = 0x00;
4062 }
4063 } else {
4064 /* If the source network is 0, make it ours */
4065 if( pnetwork_number == 0 ) {
4066 sendpacket[18] = (unsigned char)(network_number >> 24);
4067 sendpacket[19] = (unsigned char)((network_number &
4068 0x00FF0000) >> 16);
4069 sendpacket[20] = (unsigned char)((network_number &
4070 0x0000FF00) >> 8);
4071 sendpacket[21] = (unsigned char)(network_number &
4072 0x000000FF);
4073 }
4074 }
4075} /* switch_net_numbers */
4076
4077
4078
4079
4080/********************* X25API SPECIFIC FUNCTIONS ****************/
4081
4082
4083/*===============================================================
4084 * find_channel
4085 *
4086 * Manages the lcn to device map. It increases performance
4087 * because it eliminates the need to search through the link
4088 * list for a device which is bounded to a specific lcn.
4089 *
4090 *===============================================================*/
4091
4092
4093struct net_device *find_channel(sdla_t *card, unsigned lcn)
4094{
4095 if (card->u.x.LAPB_hdlc){
4096
4097 return card->wandev.dev;
4098
4099 }else{
4100 /* We don't know whether the incoming lcn
4101 * is a PVC or an SVC channel. But we do know that
4102 * the lcn cannot be for both the PVC and the SVC
4103 * channel.
4104
4105 * If the lcn number is greater or equal to 255,
4106 * take the modulo 255 of that number. We only have
4107 * 255 locations, thus higher numbers must be mapped
4108 * to a number between 0 and 245.
4109
4110 * We must separate pvc's and svc's since two don't
4111 * have to be contiguous. Meaning pvc's can start
4112 * from 1 to 10 and svc's can start from 256 to 266.
4113 * But 256%255 is 1, i.e. CONFLICT.
4114 */
4115
4116
4117 /* Highest LCN number must be less or equal to 4096 */
4118 if ((lcn <= MAX_LCN_NUM) && (lcn > 0)){
4119
4120 if (lcn < X25_MAX_CHAN){
4121 if (card->u.x.svc_to_dev_map[lcn])
4122 return card->u.x.svc_to_dev_map[lcn];
4123
4124 if (card->u.x.pvc_to_dev_map[lcn])
4125 return card->u.x.pvc_to_dev_map[lcn];
4126
4127 }else{
4128 int new_lcn = lcn%X25_MAX_CHAN;
4129 if (card->u.x.svc_to_dev_map[new_lcn])
4130 return card->u.x.svc_to_dev_map[new_lcn];
4131
4132 if (card->u.x.pvc_to_dev_map[new_lcn])
4133 return card->u.x.pvc_to_dev_map[new_lcn];
4134 }
4135 }
4136 return NULL;
4137 }
4138}
4139
4140void bind_lcn_to_dev(sdla_t *card, struct net_device *dev, unsigned lcn)
4141{
4142 x25_channel_t *chan = dev->priv;
4143
4144 /* Modulo the lcn number by X25_MAX_CHAN (255)
4145 * because the lcn number can be greater than 255
4146 *
4147 * We need to split svc and pvc since they don't have
4148 * to be contigous.
4149 */
4150
4151 if (chan->common.svc){
4152 card->u.x.svc_to_dev_map[(lcn % X25_MAX_CHAN)] = dev;
4153 }else{
4154 card->u.x.pvc_to_dev_map[(lcn % X25_MAX_CHAN)] = dev;
4155 }
4156 chan->common.lcn = lcn;
4157}
4158
4159
4160
4161/*===============================================================
4162 * x25api_bh
4163 *
4164 *
4165 *==============================================================*/
4166
4167static void x25api_bh(struct net_device* dev)
4168{
4169 x25_channel_t* chan = dev->priv;
4170 sdla_t* card = chan->card;
4171 struct sk_buff *skb;
4172
4173 if (atomic_read(&chan->bh_buff_used) == 0){
4174 printk(KERN_INFO "%s: BH Buffer Empty in BH\n",
4175 card->devname);
4176 clear_bit(0, &chan->tq_working);
4177 return;
4178 }
4179
4180 while (atomic_read(&chan->bh_buff_used)){
4181
4182 /* If the sock is in the process of unlinking the
4183 * driver from the socket, we must get out.
4184 * This never happends but is a sanity check. */
4185 if (test_bit(0,&chan->common.common_critical)){
4186 clear_bit(0, &chan->tq_working);
4187 return;
4188 }
4189
4190 /* If LAPB HDLC, do not drop packets if socket is
4191 * not connected. Let the buffer fill up and
4192 * turn off rx interrupt */
4193 if (card->u.x.LAPB_hdlc){
4194 if (chan->common.sk == NULL || chan->common.func == NULL){
4195 clear_bit(0, &chan->tq_working);
4196 return;
4197 }
4198 }
4199
4200 skb = ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb;
4201
4202 if (skb == NULL){
4203 printk(KERN_INFO "%s: BH Skb empty for read %i\n",
4204 card->devname,chan->bh_read);
4205 }else{
4206
4207 if (chan->common.sk == NULL || chan->common.func == NULL){
4208 printk(KERN_INFO "%s: BH: Socket disconnected, dropping\n",
4209 card->devname);
4210 dev_kfree_skb_any(skb);
4211 x25api_bh_cleanup(dev);
4212 ++chan->ifstats.rx_dropped;
4213 ++chan->rx_intr_stat.rx_intr_bfr_not_passed_to_stack;
4214 continue;
4215 }
4216
4217
4218 if (chan->common.func(skb,dev,chan->common.sk) != 0){
4219 /* Sock full cannot send, queue us for another
4220 * try
4221 */
4222 printk(KERN_INFO "%s: BH: !!! Packet failed to send !!!!! \n",
4223 card->devname);
4224 atomic_set(&chan->common.receive_block,1);
4225 return;
4226 }else{
4227 x25api_bh_cleanup(dev);
4228 ++chan->rx_intr_stat.rx_intr_bfr_passed_to_stack;
4229 }
4230 }
4231 }
4232 clear_bit(0, &chan->tq_working);
4233
4234 return;
4235}
4236
4237/*===============================================================
4238 * x25api_bh_cleanup
4239 *
4240 *
4241 *==============================================================*/
4242
4243static int x25api_bh_cleanup(struct net_device *dev)
4244{
4245 x25_channel_t* chan = dev->priv;
4246 sdla_t *card = chan->card;
4247 TX25Status* status = card->flags;
4248
4249
4250 ((bh_data_t *)&chan->bh_head[chan->bh_read])->skb = NULL;
4251
4252 if (chan->bh_read == MAX_BH_BUFF){
4253 chan->bh_read=0;
4254 }else{
4255 ++chan->bh_read;
4256 }
4257
4258 /* If the Receive interrupt was off, it means
4259 * that we filled up our circular buffer. Check
4260 * that we have space in the buffer. If so
4261 * turn the RX interrupt back on.
4262 */
4263 if (!(status->imask & INTR_ON_RX_FRAME)){
4264 if (atomic_read(&chan->bh_buff_used) < (MAX_BH_BUFF+1)){
4265 printk(KERN_INFO "%s: BH: Turning on the interrupt\n",
4266 card->devname);
4267 status->imask |= INTR_ON_RX_FRAME;
4268 }
4269 }
4270
4271 atomic_dec(&chan->bh_buff_used);
4272 return 0;
4273}
4274
4275
4276/*===============================================================
4277 * bh_enqueue
4278 *
4279 *
4280 *==============================================================*/
4281
4282static int bh_enqueue(struct net_device *dev, struct sk_buff *skb)
4283{
4284 x25_channel_t* chan = dev->priv;
4285 sdla_t *card = chan->card;
4286 TX25Status* status = card->flags;
4287
4288 if (atomic_read(&chan->bh_buff_used) == (MAX_BH_BUFF+1)){
4289 printk(KERN_INFO "%s: Bottom half buffer FULL\n",
4290 card->devname);
4291 return 1;
4292 }
4293
4294 ((bh_data_t *)&chan->bh_head[chan->bh_write])->skb = skb;
4295
4296 if (chan->bh_write == MAX_BH_BUFF){
4297 chan->bh_write=0;
4298 }else{
4299 ++chan->bh_write;
4300 }
4301
4302 atomic_inc(&chan->bh_buff_used);
4303
4304 if (atomic_read(&chan->bh_buff_used) == (MAX_BH_BUFF+1)){
4305 printk(KERN_INFO "%s: Buffer is now full, Turning off RX Intr\n",
4306 card->devname);
4307 status->imask &= ~INTR_ON_RX_FRAME;
4308 }
4309
4310 return 0;
4311}
4312
4313
4314/*===============================================================
4315 * timer_intr_cmd_exec
4316 *
4317 * Called by timer interrupt to execute a command
4318 *===============================================================*/
4319
4320static int timer_intr_cmd_exec (sdla_t* card)
4321{
4322 struct net_device *dev;
4323 unsigned char more_to_exec=0;
4324 volatile x25_channel_t *chan=NULL;
4325 int i=0,bad_cmd=0,err=0;
4326
4327 if (card->u.x.cmd_dev == NULL){
4328 card->u.x.cmd_dev = card->wandev.dev;
4329 }
4330
4331 dev = card->u.x.cmd_dev;
4332
4333 for (;;){
4334
4335 chan = dev->priv;
4336
4337 if (atomic_read(&chan->common.command)){
4338
4339 bad_cmd = check_bad_command(card,dev);
4340
4341 if ((!chan->common.mbox || atomic_read(&chan->common.disconnect)) &&
4342 !bad_cmd){
4343
4344 /* Socket has died or exited, We must bring the
4345 * channel down before anybody else tries to
4346 * use it */
4347 err = channel_disconnect(card,dev);
4348 }else{
4349 err = execute_delayed_cmd(card, dev,
4350 (mbox_cmd_t*)chan->common.mbox,
4351 bad_cmd);
4352 }
4353
4354 switch (err){
4355
4356 case RETURN_RESULT:
4357
4358 /* Return the result to the socket without
4359 * delay. NO_WAIT Command */
4360 atomic_set(&chan->common.command,0);
4361 if (atomic_read(&card->u.x.command_busy))
4362 atomic_set(&card->u.x.command_busy,0);
4363
4364 send_delayed_cmd_result(card,dev,card->mbox);
4365
4366 more_to_exec=0;
4367 break;
4368 case DELAY_RESULT:
4369
4370 /* Wait for the remote to respond, before
4371 * sending the result up to the socket.
4372 * WAIT command */
4373 if (atomic_read(&card->u.x.command_busy))
4374 atomic_set(&card->u.x.command_busy,0);
4375
4376 atomic_set(&chan->common.command,0);
4377 more_to_exec=0;
4378 break;
4379 default:
4380
4381 /* If command could not be executed for
4382 * some reason (i.e return code 0x33 busy)
4383 * set the more_to_exec bit which will
4384 * indicate that this command must be exectued
4385 * again during next timer interrupt
4386 */
4387 more_to_exec=1;
4388 if (atomic_read(&card->u.x.command_busy) == 0)
4389 atomic_set(&card->u.x.command_busy,1);
4390 break;
4391 }
4392
4393 bad_cmd=0;
4394
4395 /* If flags is set, there are no hdlc buffers,
4396 * thus, wait for the next pass and try the
4397 * same command again. Otherwise, start searching
4398 * from next device on the next pass.
4399 */
4400 if (!more_to_exec){
4401 dev = move_dev_to_next(card,dev);
4402 }
4403 break;
4404 }else{
4405 /* This device has nothing to execute,
4406 * go to next.
4407 */
4408 if (atomic_read(&card->u.x.command_busy))
4409 atomic_set(&card->u.x.command_busy,0);
4410 dev = move_dev_to_next(card,dev);
4411 }
4412
4413 if (++i == card->u.x.no_dev){
4414 if (!more_to_exec){
4415 DBG_PRINTK(KERN_INFO "%s: Nothing to execute in Timer\n",
4416 card->devname);
4417 if (atomic_read(&card->u.x.command_busy)){
4418 atomic_set(&card->u.x.command_busy,0);
4419 }
4420 }
4421 break;
4422 }
4423
4424 } //End of FOR
4425
4426 card->u.x.cmd_dev = dev;
4427
4428 if (more_to_exec){
4429 /* If more commands are pending, do not turn off timer
4430 * interrupt */
4431 return 1;
4432 }else{
4433 /* No more commands, turn off timer interrupt */
4434 return 0;
4435 }
4436}
4437
4438/*===============================================================
4439 * execute_delayed_cmd
4440 *
4441 * Execute an API command which was passed down from the
4442 * sock. Sock is very limited in which commands it can
4443 * execute. Wait and No Wait commands are supported.
4444 * Place Call, Clear Call and Reset wait commands, where
4445 * Accept Call is a no_wait command.
4446 *
4447 *===============================================================*/
4448
4449static int execute_delayed_cmd(sdla_t* card, struct net_device *dev,
4450 mbox_cmd_t *usr_cmd, char bad_cmd)
4451{
4452 TX25Mbox* mbox = card->mbox;
4453 int err;
4454 x25_channel_t *chan = dev->priv;
4455 int delay=RETURN_RESULT;
4456
4457 if (!(*card->u.x.hdlc_buf_status & 0x40) && !bad_cmd){
4458 return TRY_CMD_AGAIN;
4459 }
4460
4461 /* This way a command is guaranteed to be executed for
4462 * a specific lcn, the network interface is bound to. */
4463 usr_cmd->cmd.lcn = chan->common.lcn;
4464
4465
4466 /* If channel is pvc, instead of place call
4467 * run x25_channel configuration. If running LAPB HDLC
4468 * enable communications.
4469 */
4470 if ((!chan->common.svc) && (usr_cmd->cmd.command == X25_PLACE_CALL)){
4471
4472 if (card->u.x.LAPB_hdlc){
4473 DBG_PRINTK(KERN_INFO "LAPB: Connecting\n");
4474 connect(card);
4475 set_chan_state(dev,WAN_CONNECTING);
4476 return DELAY_RESULT;
4477 }else{
4478 DBG_PRINTK(KERN_INFO "%s: PVC is CONNECTING\n",card->devname);
4479 if (x25_get_chan_conf(card, chan) == CMD_OK){
4480 set_chan_state(dev, WAN_CONNECTED);
4481 }else{
4482 set_chan_state(dev, WAN_DISCONNECTED);
4483 }
4484 return RETURN_RESULT;
4485 }
4486 }
4487
4488 /* Copy the socket mbox command onto the board */
4489
4490 memcpy(&mbox->cmd, &usr_cmd->cmd, sizeof(TX25Cmd));
4491 if (usr_cmd->cmd.length){
4492 memcpy(mbox->data, usr_cmd->data, usr_cmd->cmd.length);
4493 }
4494
4495 /* Check if command is bad. We need to copy the cmd into
4496 * the buffer regardless since we return the, mbox to
4497 * the user */
4498 if (bad_cmd){
4499 mbox->cmd.result=0x01;
4500 return RETURN_RESULT;
4501 }
4502
4503 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4504
4505 if (err != CMD_OK && err != X25RES_NOT_READY)
4506 x25_error(card, err, usr_cmd->cmd.command, usr_cmd->cmd.lcn);
4507
4508 if (mbox->cmd.result == X25RES_NOT_READY){
4509 return TRY_CMD_AGAIN;
4510 }
4511
4512 switch (mbox->cmd.command){
4513
4514 case X25_PLACE_CALL:
4515
4516 switch (mbox->cmd.result){
4517
4518 case CMD_OK:
4519
4520 /* Check if Place call is a wait command or a
4521 * no wait command */
4522 if (atomic_read(&chan->common.command) & 0x80)
4523 delay=RETURN_RESULT;
4524 else
4525 delay=DELAY_RESULT;
4526
4527
4528 DBG_PRINTK(KERN_INFO "\n%s: PLACE CALL Binding dev %s to lcn %i\n",
4529 card->devname,dev->name, mbox->cmd.lcn);
4530
4531 bind_lcn_to_dev (card, dev, mbox->cmd.lcn);
4532 set_chan_state(dev, WAN_CONNECTING);
4533 break;
4534
4535
4536 default:
4537 delay=RETURN_RESULT;
4538 set_chan_state(dev, WAN_DISCONNECTED);
4539 break;
4540 }
4541 break;
4542
4543 case X25_ACCEPT_CALL:
4544
4545 switch (mbox->cmd.result){
4546
4547 case CMD_OK:
4548
4549 DBG_PRINTK(KERN_INFO "\n%s: ACCEPT Binding dev %s to lcn %i\n",
4550 card->devname,dev->name,mbox->cmd.lcn);
4551
4552 bind_lcn_to_dev (card, dev, mbox->cmd.lcn);
4553
4554 if (x25_get_chan_conf(card, chan) == CMD_OK){
4555
4556 set_chan_state(dev, WAN_CONNECTED);
4557 delay=RETURN_RESULT;
4558
4559 }else{
4560 if (x25_clear_call(card, usr_cmd->cmd.lcn, 0, 0) == CMD_OK){
4561 /* if clear is successful, wait for clear confirm
4562 */
4563 delay=DELAY_RESULT;
4564 }else{
4565 /* Do not change the state here. If we fail
4566 * the accept the return code is send up
4567 *the stack, which will ether retry
4568 * or clear the call
4569 */
4570 DBG_PRINTK(KERN_INFO
4571 "%s: ACCEPT: STATE MAY BE CURRUPTED 2 !!!!!\n",
4572 card->devname);
4573 delay=RETURN_RESULT;
4574 }
4575 }
4576 break;
4577
4578
4579 case X25RES_ASYNC_PACKET:
4580 delay=TRY_CMD_AGAIN;
4581 break;
4582
4583 default:
4584 DBG_PRINTK(KERN_INFO "%s: ACCEPT FAILED\n",card->devname);
4585 if (x25_clear_call(card, usr_cmd->cmd.lcn, 0, 0) == CMD_OK){
4586 delay=DELAY_RESULT;
4587 }else{
4588 /* Do not change the state here. If we fail the accept. The
4589 * return code is send up the stack, which will ether retry
4590 * or clear the call */
4591 DBG_PRINTK(KERN_INFO
4592 "%s: ACCEPT: STATE MAY BE CORRUPTED 1 !!!!!\n",
4593 card->devname);
4594 delay=RETURN_RESULT;
4595 }
4596 }
4597 break;
4598
4599 case X25_CLEAR_CALL:
4600
4601 switch (mbox->cmd.result){
4602
4603 case CMD_OK:
4604 DBG_PRINTK(KERN_INFO
4605 "CALL CLEAR OK: Dev %s Mbox Lcn %i Chan Lcn %i\n",
4606 dev->name,mbox->cmd.lcn,chan->common.lcn);
4607 set_chan_state(dev, WAN_DISCONNECTING);
4608 delay = DELAY_RESULT;
4609 break;
4610
4611 case X25RES_CHANNEL_IN_USE:
4612 case X25RES_ASYNC_PACKET:
4613 delay = TRY_CMD_AGAIN;
4614 break;
4615
4616 case X25RES_LINK_NOT_IN_ABM:
4617 case X25RES_INVAL_LCN:
4618 case X25RES_INVAL_STATE:
4619 set_chan_state(dev, WAN_DISCONNECTED);
4620 delay = RETURN_RESULT;
4621 break;
4622
4623 default:
4624 /* If command did not execute because of user
4625 * fault, do not change the state. This will
4626 * signal the socket that clear command failed.
4627 * User can retry or close the socket.
4628 * When socket gets killed, it will set the
4629 * chan->disconnect which will signal
4630 * driver to clear the call */
4631 printk(KERN_INFO "%s: Clear Command Failed, Rc %x\n",
4632 card->devname,mbox->cmd.command);
4633 delay = RETURN_RESULT;
4634 }
4635 break;
4636 }
4637
4638 return delay;
4639}
4640
4641/*===============================================================
4642 * api_incoming_call
4643 *
4644 * Pass an incoming call request up the listening
4645 * sock. If the API sock is not listening reject the
4646 * call.
4647 *
4648 *===============================================================*/
4649
4650static int api_incoming_call (sdla_t* card, TX25Mbox *mbox, int lcn)
4651{
4652 struct sk_buff *skb;
4653 int len = sizeof(TX25Cmd)+mbox->cmd.length;
4654
4655 if (alloc_and_init_skb_buf(card, &skb, len)){
4656 printk(KERN_INFO "%s: API incoming call, no memory\n",card->devname);
4657 return 1;
4658 }
4659
4660 memcpy(skb_put(skb,len),&mbox->cmd,len);
4661
4662 skb->mac.raw = skb->data;
4663 skb->protocol = htons(X25_PROT);
4664 skb->pkt_type = WAN_PACKET_ASYNC;
4665
4666 if (card->func(skb,card->sk) < 0){
4667 printk(KERN_INFO "%s: MAJOR ERROR: Failed to send up place call \n",card->devname);
4668 dev_kfree_skb_any(skb);
4669 return 1;
4670 }
4671
4672 return 0;
4673}
4674
4675/*===============================================================
4676 * send_delayed_cmd_result
4677 *
4678 * Wait commands like PLEACE CALL or CLEAR CALL must wait
4679 * until the result arrives. This function passes
4680 * the result to a waiting sock.
4681 *
4682 *===============================================================*/
4683static void send_delayed_cmd_result(sdla_t *card, struct net_device *dev,
4684 TX25Mbox* mbox)
4685{
4686 x25_channel_t *chan = dev->priv;
4687 mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox;
4688 struct sk_buff *skb;
4689 int len=sizeof(unsigned char);
4690
4691 atomic_set(&chan->common.command,0);
4692
4693 /* If the sock is in the process of unlinking the
4694 * driver from the socket, we must get out.
4695 * This never happends but is a sanity check. */
4696 if (test_bit(0,&chan->common.common_critical)){
4697 return;
4698 }
4699
4700 if (!usr_cmd || !chan->common.sk || !chan->common.func){
4701 DBG_PRINTK(KERN_INFO "Delay result: Sock not bounded sk: %u, func: %u, mbox: %u\n",
4702 (unsigned int)chan->common.sk,
4703 (unsigned int)chan->common.func,
4704 (unsigned int)usr_cmd);
4705 return;
4706 }
4707
4708 memcpy(&usr_cmd->cmd, &mbox->cmd, sizeof(TX25Cmd));
4709 if (mbox->cmd.length > 0){
4710 memcpy(usr_cmd->data, mbox->data, mbox->cmd.length);
4711 }
4712
4713 if (alloc_and_init_skb_buf(card,&skb,len)){
4714 printk(KERN_INFO "Delay result: No sock buffers\n");
4715 return;
4716 }
4717
4718 memcpy(skb_put(skb,len),&mbox->cmd.command,len);
4719
4720 skb->mac.raw = skb->data;
4721 skb->pkt_type = WAN_PACKET_CMD;
4722
4723 chan->common.func(skb,dev,chan->common.sk);
4724}
4725
4726/*===============================================================
4727 * clear_confirm_event
4728 *
4729 * Pass the clear confirmation event up the sock. The
4730 * API will disconnect only after the clear confirmation
4731 * has been received.
4732 *
4733 * Depending on the state, clear confirmation could
4734 * be an OOB event, or a result of an API command.
4735 *===============================================================*/
4736
4737static int clear_confirm_event (sdla_t *card, TX25Mbox* mb)
4738{
4739 struct net_device *dev;
4740 x25_channel_t *chan;
4741 unsigned char old_state;
4742
4743 dev = find_channel(card,mb->cmd.lcn);
4744 if (!dev){
4745 DBG_PRINTK(KERN_INFO "%s: *** GOT CLEAR BUT NO DEV %i\n",
4746 card->devname,mb->cmd.lcn);
4747 return 0;
4748 }
4749
4750 chan=dev->priv;
4751 DBG_PRINTK(KERN_INFO "%s: GOT CLEAR CONFIRM %s: Mbox lcn %i Chan lcn %i\n",
4752 card->devname, dev->name, mb->cmd.lcn, chan->common.lcn);
4753
4754 /* If not API fall through to default.
4755 * If API, send the result to a waiting
4756 * socket.
4757 */
4758
4759 old_state = chan->common.state;
4760 set_chan_state(dev, WAN_DISCONNECTED);
4761
4762 if (chan->common.usedby == API){
4763 switch (old_state) {
4764
4765 case WAN_DISCONNECTING:
4766 case WAN_CONNECTING:
4767 send_delayed_cmd_result(card,dev,mb);
4768 break;
4769 case WAN_CONNECTED:
4770 send_oob_msg(card,dev,mb);
4771 break;
4772 }
4773 return 1;
4774 }
4775
4776 return 0;
4777}
4778
4779/*===============================================================
4780 * send_oob_msg
4781 *
4782 * Construct an NEM Message and pass it up the connected
4783 * sock. If the sock is not bounded discard the NEM.
4784 *
4785 *===============================================================*/
4786
4787static void send_oob_msg(sdla_t *card, struct net_device *dev, TX25Mbox *mbox)
4788{
4789 x25_channel_t *chan = dev->priv;
4790 mbox_cmd_t *usr_cmd = (mbox_cmd_t *)chan->common.mbox;
4791 struct sk_buff *skb;
4792 int len=sizeof(x25api_hdr_t)+mbox->cmd.length;
4793 x25api_t *api_hdr;
4794
4795 /* If the sock is in the process of unlinking the
4796 * driver from the socket, we must get out.
4797 * This never happends but is a sanity check. */
4798 if (test_bit(0,&chan->common.common_critical)){
4799 return;
4800 }
4801
4802 if (!usr_cmd || !chan->common.sk || !chan->common.func){
4803 DBG_PRINTK(KERN_INFO "OOB MSG: Sock not bounded\n");
4804 return;
4805 }
4806
4807 memcpy(&usr_cmd->cmd, &mbox->cmd, sizeof(TX25Cmd));
4808 if (mbox->cmd.length > 0){
4809 memcpy(usr_cmd->data, mbox->data, mbox->cmd.length);
4810 }
4811
4812 if (alloc_and_init_skb_buf(card,&skb,len)){
4813 printk(KERN_INFO "%s: OOB MSG: No sock buffers\n",card->devname);
4814 return;
4815 }
4816
4817 api_hdr = (x25api_t*)skb_put(skb,len);
4818 api_hdr->hdr.pktType = mbox->cmd.pktType & 0x7F;
4819 api_hdr->hdr.qdm = mbox->cmd.qdm;
4820 api_hdr->hdr.cause = mbox->cmd.cause;
4821 api_hdr->hdr.diagn = mbox->cmd.diagn;
4822 api_hdr->hdr.length = mbox->cmd.length;
4823 api_hdr->hdr.result = mbox->cmd.result;
4824 api_hdr->hdr.lcn = mbox->cmd.lcn;
4825
4826 if (mbox->cmd.length > 0){
4827 memcpy(api_hdr->data,mbox->data,mbox->cmd.length);
4828 }
4829
4830 skb->mac.raw = skb->data;
4831 skb->pkt_type = WAN_PACKET_ERR;
4832
4833 if (chan->common.func(skb,dev,chan->common.sk) < 0){
4834 if (bh_enqueue(dev,skb)){
4835 printk(KERN_INFO "%s: Dropping OOB MSG\n",card->devname);
4836 dev_kfree_skb_any(skb);
4837 }
4838 }
4839
4840 DBG_PRINTK(KERN_INFO "%s: OOB MSG OK, %s, lcn %i\n",
4841 card->devname, dev->name, mbox->cmd.lcn);
4842}
4843
4844/*===============================================================
4845 * alloc_and_init_skb_buf
4846 *
4847 * Allocate and initialize an skb buffer.
4848 *
4849 *===============================================================*/
4850
4851static int alloc_and_init_skb_buf (sdla_t *card, struct sk_buff **skb, int len)
4852{
4853 struct sk_buff *new_skb = *skb;
4854
4855 new_skb = dev_alloc_skb(len + X25_HRDHDR_SZ);
4856 if (new_skb == NULL){
4857 printk(KERN_INFO "%s: no socket buffers available!\n",
4858 card->devname);
4859 return 1;
4860 }
4861
4862 if (skb_tailroom(new_skb) < len){
4863 /* No room for the packet. Call off the whole thing! */
4864 dev_kfree_skb_any(new_skb);
4865 printk(KERN_INFO "%s: Listen: unexpectedly long packet sequence\n"
4866 ,card->devname);
4867 *skb = NULL;
4868 return 1;
4869 }
4870
4871 *skb = new_skb;
4872 return 0;
4873
4874}
4875
4876/*===============================================================
4877 * api_oob_event
4878 *
4879 * Send an OOB event up to the sock
4880 *
4881 *===============================================================*/
4882
4883static void api_oob_event (sdla_t *card,TX25Mbox *mbox)
4884{
4885 struct net_device *dev = find_channel(card, mbox->cmd.lcn);
4886 x25_channel_t *chan;
4887
4888 if (!dev)
4889 return;
4890
4891 chan=dev->priv;
4892
4893 if (chan->common.usedby == API)
4894 send_oob_msg(card,dev,mbox);
4895
4896}
4897
4898
4899
4900
4901static int channel_disconnect(sdla_t* card, struct net_device *dev)
4902{
4903
4904 int err;
4905 x25_channel_t *chan = dev->priv;
4906
4907 DBG_PRINTK(KERN_INFO "%s: TIMER: %s, Device down disconnecting\n",
4908 card->devname,dev->name);
4909
4910 if (chan->common.svc){
4911 err = x25_clear_call(card,chan->common.lcn,0,0);
4912 }else{
4913 /* If channel is PVC or LAPB HDLC, there is no call
4914 * to be cleared, thus drop down to the default
4915 * area
4916 */
4917 err = 1;
4918 }
4919
4920 switch (err){
4921
4922 case X25RES_CHANNEL_IN_USE:
4923 case X25RES_NOT_READY:
4924 err = TRY_CMD_AGAIN;
4925 break;
4926 case CMD_OK:
4927 DBG_PRINTK(KERN_INFO "CALL CLEAR OK: Dev %s Chan Lcn %i\n",
4928 dev->name,chan->common.lcn);
4929
4930 set_chan_state(dev,WAN_DISCONNECTING);
4931 atomic_set(&chan->common.command,0);
4932 err = DELAY_RESULT;
4933 break;
4934 default:
4935 /* If LAPB HDLC protocol, bring the whole link down
4936 * once the application terminates
4937 */
4938
4939 set_chan_state(dev,WAN_DISCONNECTED);
4940
4941 if (card->u.x.LAPB_hdlc){
4942 DBG_PRINTK(KERN_INFO "LAPB: Disconnecting Link\n");
4943 hdlc_link_down (card);
4944 }
4945 atomic_set(&chan->common.command,0);
4946 err = RETURN_RESULT;
4947 break;
4948 }
4949
4950 return err;
4951}
4952
4953static void hdlc_link_down (sdla_t *card)
4954{
4955 TX25Mbox* mbox = card->mbox;
4956 int retry = 5;
4957 int err=0;
4958
4959 do {
4960 memset(mbox,0,sizeof(TX25Mbox));
4961 mbox->cmd.command = X25_HDLC_LINK_DISC;
4962 mbox->cmd.length = 1;
4963 mbox->data[0]=0;
4964 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
4965
4966 } while (err && retry-- && x25_error(card, err, X25_HDLC_LINK_DISC, 0));
4967
4968 if (err)
4969 printk(KERN_INFO "%s: Hdlc Link Down Failed %x\n",card->devname,err);
4970
4971 disconnect (card);
4972
4973}
4974
4975static int check_bad_command(sdla_t* card, struct net_device *dev)
4976{
4977 x25_channel_t *chan = dev->priv;
4978 int bad_cmd = 0;
4979
4980 switch (atomic_read(&chan->common.command)&0x7F){
4981
4982 case X25_PLACE_CALL:
4983 if (chan->common.state != WAN_DISCONNECTED)
4984 bad_cmd=1;
4985 break;
4986 case X25_CLEAR_CALL:
4987 if (chan->common.state == WAN_DISCONNECTED)
4988 bad_cmd=1;
4989 break;
4990 case X25_ACCEPT_CALL:
4991 if (chan->common.state != WAN_CONNECTING)
4992 bad_cmd=1;
4993 break;
4994 case X25_RESET:
4995 if (chan->common.state != WAN_CONNECTED)
4996 bad_cmd=1;
4997 break;
4998 default:
4999 bad_cmd=1;
5000 break;
5001 }
5002
5003 if (bad_cmd){
5004 printk(KERN_INFO "%s: Invalid State, BAD Command %x, dev %s, lcn %i, st %i\n",
5005 card->devname,atomic_read(&chan->common.command),dev->name,
5006 chan->common.lcn, chan->common.state);
5007 }
5008
5009 return bad_cmd;
5010}
5011
5012
5013
5014/*************************** XPIPEMON FUNCTIONS **************************/
5015
5016/*==============================================================================
5017 * Process UDP call of type XPIPE
5018 */
5019
5020static int process_udp_mgmt_pkt(sdla_t *card)
5021{
5022 int c_retry = MAX_CMD_RETRY;
5023 unsigned int len;
5024 struct sk_buff *new_skb;
5025 TX25Mbox *mbox = card->mbox;
5026 int err;
5027 int udp_mgmt_req_valid = 1;
5028 struct net_device *dev;
5029 x25_channel_t *chan;
5030 unsigned short lcn;
5031 struct timeval tv;
5032
5033
5034 x25_udp_pkt_t *x25_udp_pkt;
5035 x25_udp_pkt = (x25_udp_pkt_t *)card->u.x.udp_pkt_data;
5036
5037 dev = card->u.x.udp_dev;
5038 chan = dev->priv;
5039 lcn = chan->common.lcn;
5040
5041 switch(x25_udp_pkt->cblock.command) {
5042
5043 /* XPIPE_ENABLE_TRACE */
5044 case XPIPE_ENABLE_TRACING:
5045
5046 /* XPIPE_GET_TRACE_INFO */
5047 case XPIPE_GET_TRACE_INFO:
5048
5049 /* SET FT1 MODE */
5050 case XPIPE_SET_FT1_MODE:
5051
5052 if(card->u.x.udp_pkt_src == UDP_PKT_FRM_NETWORK) {
5053 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_direction_err;
5054 udp_mgmt_req_valid = 0;
5055 break;
5056 }
5057
5058 /* XPIPE_FT1_READ_STATUS */
5059 case XPIPE_FT1_READ_STATUS:
5060
5061 /* FT1 MONITOR STATUS */
5062 case XPIPE_FT1_STATUS_CTRL:
5063 if(card->hw.fwid != SFID_X25_508) {
5064 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_type_err;
5065 udp_mgmt_req_valid = 0;
5066 break;
5067 }
5068 default:
5069 break;
5070 }
5071
5072 if(!udp_mgmt_req_valid) {
5073 /* set length to 0 */
5074 x25_udp_pkt->cblock.length = 0;
5075 /* set return code */
5076 x25_udp_pkt->cblock.result = (card->hw.fwid != SFID_X25_508) ? 0x1F : 0xCD;
5077
5078 } else {
5079
5080 switch (x25_udp_pkt->cblock.command) {
5081
5082
5083 case XPIPE_FLUSH_DRIVER_STATS:
5084 init_x25_channel_struct(chan);
5085 init_global_statistics(card);
5086 mbox->cmd.length = 0;
5087 break;
5088
5089
5090 case XPIPE_DRIVER_STAT_IFSEND:
5091 memcpy(x25_udp_pkt->data, &chan->if_send_stat, sizeof(if_send_stat_t));
5092 mbox->cmd.length = sizeof(if_send_stat_t);
5093 x25_udp_pkt->cblock.length = mbox->cmd.length;
5094 break;
5095
5096 case XPIPE_DRIVER_STAT_INTR:
5097 memcpy(&x25_udp_pkt->data[0], &card->statistics, sizeof(global_stats_t));
5098 memcpy(&x25_udp_pkt->data[sizeof(global_stats_t)],
5099 &chan->rx_intr_stat, sizeof(rx_intr_stat_t));
5100
5101 mbox->cmd.length = sizeof(global_stats_t) +
5102 sizeof(rx_intr_stat_t);
5103 x25_udp_pkt->cblock.length = mbox->cmd.length;
5104 break;
5105
5106 case XPIPE_DRIVER_STAT_GEN:
5107 memcpy(x25_udp_pkt->data,
5108 &chan->pipe_mgmt_stat.UDP_PIPE_mgmt_kmalloc_err,
5109 sizeof(pipe_mgmt_stat_t));
5110
5111 memcpy(&x25_udp_pkt->data[sizeof(pipe_mgmt_stat_t)],
5112 &card->statistics, sizeof(global_stats_t));
5113
5114 x25_udp_pkt->cblock.result = 0;
5115 x25_udp_pkt->cblock.length = sizeof(global_stats_t)+
5116 sizeof(rx_intr_stat_t);
5117 mbox->cmd.length = x25_udp_pkt->cblock.length;
5118 break;
5119
5120 case XPIPE_ROUTER_UP_TIME:
5121 do_gettimeofday(&tv);
5122 chan->router_up_time = tv.tv_sec - chan->router_start_time;
5123 *(unsigned long *)&x25_udp_pkt->data = chan->router_up_time;
5124 x25_udp_pkt->cblock.length = mbox->cmd.length = 4;
5125 x25_udp_pkt->cblock.result = 0;
5126 break;
5127
5128 default :
5129
5130 do {
5131 memcpy(&mbox->cmd, &x25_udp_pkt->cblock.command, sizeof(TX25Cmd));
5132 if(mbox->cmd.length){
5133 memcpy(&mbox->data,
5134 (char *)x25_udp_pkt->data,
5135 mbox->cmd.length);
5136 }
5137
5138 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
5139 } while (err && c_retry-- && x25_error(card, err, mbox->cmd.command, 0));
5140
5141
5142 if ( err == CMD_OK ||
5143 (err == 1 &&
5144 (mbox->cmd.command == 0x06 ||
5145 mbox->cmd.command == 0x16) ) ){
5146
5147 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_cmnd_OK;
5148 } else {
5149 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_cmnd_timeout;
5150 }
5151
5152 /* copy the result back to our buffer */
5153 memcpy(&x25_udp_pkt->cblock.command, &mbox->cmd, sizeof(TX25Cmd));
5154
5155 if(mbox->cmd.length) {
5156 memcpy(&x25_udp_pkt->data, &mbox->data, mbox->cmd.length);
5157 }
5158 break;
5159
5160 } //switch
5161
5162 }
5163
5164 /* Fill UDP TTL */
5165
5166 x25_udp_pkt->ip_pkt.ttl = card->wandev.ttl;
5167 len = reply_udp(card->u.x.udp_pkt_data, mbox->cmd.length);
5168
5169
5170 if(card->u.x.udp_pkt_src == UDP_PKT_FRM_NETWORK) {
5171
5172 err = x25_send(card, lcn, 0, len, card->u.x.udp_pkt_data);
5173 if (!err)
5174 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_send_passed;
5175 else
5176 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_adptr_send_failed;
5177
5178 } else {
5179
5180 /* Allocate socket buffer */
5181 if((new_skb = dev_alloc_skb(len)) != NULL) {
5182 void *buf;
5183
5184 /* copy data into new_skb */
5185 buf = skb_put(new_skb, len);
5186 memcpy(buf, card->u.x.udp_pkt_data, len);
5187
5188 /* Decapsulate packet and pass it up the protocol
5189 stack */
5190 new_skb->dev = dev;
5191
5192 if (chan->common.usedby == API)
5193 new_skb->protocol = htons(X25_PROT);
5194 else
5195 new_skb->protocol = htons(ETH_P_IP);
5196
5197 new_skb->mac.raw = new_skb->data;
5198
5199 netif_rx(new_skb);
5200 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_passed_to_stack;
5201
5202 } else {
5203 ++chan->pipe_mgmt_stat.UDP_PIPE_mgmt_no_socket;
5204 printk(KERN_INFO
5205 "%s: UDP mgmt cmnd, no socket buffers available!\n",
5206 card->devname);
5207 }
5208 }
5209
5210 card->u.x.udp_pkt_lgth = 0;
5211
5212 return 1;
5213}
5214
5215
5216/*==============================================================================
5217 * Determine what type of UDP call it is. DRVSTATS or XPIPE8ND ?
5218 */
5219static int udp_pkt_type( struct sk_buff *skb, sdla_t* card )
5220{
5221 x25_udp_pkt_t *x25_udp_pkt = (x25_udp_pkt_t *)skb->data;
5222
5223 if((x25_udp_pkt->ip_pkt.protocol == UDPMGMT_UDP_PROTOCOL) &&
5224 (x25_udp_pkt->ip_pkt.ver_inet_hdr_length == 0x45) &&
5225 (x25_udp_pkt->udp_pkt.udp_dst_port == ntohs(card->wandev.udp_port)) &&
5226 (x25_udp_pkt->wp_mgmt.request_reply == UDPMGMT_REQUEST)) {
5227
5228 if(!strncmp(x25_udp_pkt->wp_mgmt.signature,
5229 UDPMGMT_XPIPE_SIGNATURE, 8)){
5230 return UDP_XPIPE_TYPE;
5231 }else{
5232 printk(KERN_INFO "%s: UDP Packet, Failed Signature !\n",
5233 card->devname);
5234 }
5235 }
5236
5237 return UDP_INVALID_TYPE;
5238}
5239
5240
5241/*============================================================================
5242 * Reply to UDP Management system.
5243 * Return nothing.
5244 */
5245static int reply_udp( unsigned char *data, unsigned int mbox_len )
5246{
5247 unsigned short len, udp_length, temp, ip_length;
5248 unsigned long ip_temp;
5249 int even_bound = 0;
5250
5251
5252 x25_udp_pkt_t *x25_udp_pkt = (x25_udp_pkt_t *)data;
5253
5254 /* Set length of packet */
5255 len = sizeof(ip_pkt_t)+
5256 sizeof(udp_pkt_t)+
5257 sizeof(wp_mgmt_t)+
5258 sizeof(cblock_t)+
5259 mbox_len;
5260
5261
5262 /* fill in UDP reply */
5263 x25_udp_pkt->wp_mgmt.request_reply = UDPMGMT_REPLY;
5264
5265 /* fill in UDP length */
5266 udp_length = sizeof(udp_pkt_t)+
5267 sizeof(wp_mgmt_t)+
5268 sizeof(cblock_t)+
5269 mbox_len;
5270
5271
5272 /* put it on an even boundary */
5273 if ( udp_length & 0x0001 ) {
5274 udp_length += 1;
5275 len += 1;
5276 even_bound = 1;
5277 }
5278
5279 temp = (udp_length<<8)|(udp_length>>8);
5280 x25_udp_pkt->udp_pkt.udp_length = temp;
5281
5282 /* swap UDP ports */
5283 temp = x25_udp_pkt->udp_pkt.udp_src_port;
5284 x25_udp_pkt->udp_pkt.udp_src_port =
5285 x25_udp_pkt->udp_pkt.udp_dst_port;
5286 x25_udp_pkt->udp_pkt.udp_dst_port = temp;
5287
5288
5289
5290 /* add UDP pseudo header */
5291 temp = 0x1100;
5292 *((unsigned short *)
5293 (x25_udp_pkt->data+mbox_len+even_bound)) = temp;
5294 temp = (udp_length<<8)|(udp_length>>8);
5295 *((unsigned short *)
5296 (x25_udp_pkt->data+mbox_len+even_bound+2)) = temp;
5297
5298 /* calculate UDP checksum */
5299 x25_udp_pkt->udp_pkt.udp_checksum = 0;
5300
5301 x25_udp_pkt->udp_pkt.udp_checksum =
5302 calc_checksum(&data[UDP_OFFSET], udp_length+UDP_OFFSET);
5303
5304 /* fill in IP length */
5305 ip_length = len;
5306 temp = (ip_length<<8)|(ip_length>>8);
5307 x25_udp_pkt->ip_pkt.total_length = temp;
5308
5309 /* swap IP addresses */
5310 ip_temp = x25_udp_pkt->ip_pkt.ip_src_address;
5311 x25_udp_pkt->ip_pkt.ip_src_address =
5312 x25_udp_pkt->ip_pkt.ip_dst_address;
5313 x25_udp_pkt->ip_pkt.ip_dst_address = ip_temp;
5314
5315
5316 /* fill in IP checksum */
5317 x25_udp_pkt->ip_pkt.hdr_checksum = 0;
5318 x25_udp_pkt->ip_pkt.hdr_checksum = calc_checksum(data, sizeof(ip_pkt_t));
5319
5320 return len;
5321} /* reply_udp */
5322
5323unsigned short calc_checksum (char *data, int len)
5324{
5325 unsigned short temp;
5326 unsigned long sum=0;
5327 int i;
5328
5329 for( i = 0; i <len; i+=2 ) {
5330 memcpy(&temp,&data[i],2);
5331 sum += (unsigned long)temp;
5332 }
5333
5334 while (sum >> 16 ) {
5335 sum = (sum & 0xffffUL) + (sum >> 16);
5336 }
5337
5338 temp = (unsigned short)sum;
5339 temp = ~temp;
5340
5341 if( temp == 0 )
5342 temp = 0xffff;
5343
5344 return temp;
5345}
5346
5347/*=============================================================================
5348 * Store a UDP management packet for later processing.
5349 */
5350
5351static int store_udp_mgmt_pkt(int udp_type, char udp_pkt_src, sdla_t* card,
5352 struct net_device *dev, struct sk_buff *skb,
5353 int lcn)
5354{
5355 int udp_pkt_stored = 0;
5356
5357 if(!card->u.x.udp_pkt_lgth && (skb->len <= MAX_LGTH_UDP_MGNT_PKT)){
5358 card->u.x.udp_pkt_lgth = skb->len;
5359 card->u.x.udp_type = udp_type;
5360 card->u.x.udp_pkt_src = udp_pkt_src;
5361 card->u.x.udp_lcn = lcn;
5362 card->u.x.udp_dev = dev;
5363 memcpy(card->u.x.udp_pkt_data, skb->data, skb->len);
5364 card->u.x.timer_int_enabled |= TMR_INT_ENABLED_UDP_PKT;
5365 udp_pkt_stored = 1;
5366
5367 }else{
5368 printk(KERN_INFO "%s: ERROR: UDP packet not stored for LCN %d\n",
5369 card->devname,lcn);
5370 }
5371
5372 if(udp_pkt_src == UDP_PKT_FRM_STACK){
5373 dev_kfree_skb_any(skb);
5374 }else{
5375 dev_kfree_skb_any(skb);
5376 }
5377
5378 return(udp_pkt_stored);
5379}
5380
5381
5382
5383/*=============================================================================
5384 * Initial the ppp_private_area structure.
5385 */
5386static void init_x25_channel_struct( x25_channel_t *chan )
5387{
5388 memset(&chan->if_send_stat.if_send_entry,0,sizeof(if_send_stat_t));
5389 memset(&chan->rx_intr_stat.rx_intr_no_socket,0,sizeof(rx_intr_stat_t));
5390 memset(&chan->pipe_mgmt_stat.UDP_PIPE_mgmt_kmalloc_err,0,sizeof(pipe_mgmt_stat_t));
5391}
5392
5393/*============================================================================
5394 * Initialize Global Statistics
5395 */
5396static void init_global_statistics( sdla_t *card )
5397{
5398 memset(&card->statistics.isr_entry,0,sizeof(global_stats_t));
5399}
5400
5401
5402/*===============================================================
5403 * SMP Support
5404 * ==============================================================*/
5405
5406static void S508_S514_lock(sdla_t *card, unsigned long *smp_flags)
5407{
5408 spin_lock_irqsave(&card->wandev.lock, *smp_flags);
5409}
5410static void S508_S514_unlock(sdla_t *card, unsigned long *smp_flags)
5411{
5412 spin_unlock_irqrestore(&card->wandev.lock, *smp_flags);
5413}
5414
5415/*===============================================================
5416 * x25_timer_routine
5417 *
5418 * A more efficient polling routine. Each half a second
5419 * queue a polling task. We want to do the polling in a
5420 * task not timer, because timer runs in interrupt time.
5421 *
5422 * FIXME Polling should be rethinked.
5423 *==============================================================*/
5424
5425static void x25_timer_routine(unsigned long data)
5426{
5427 sdla_t *card = (sdla_t*)data;
5428
5429 if (!card->wandev.dev){
5430 printk(KERN_INFO "%s: Stopping the X25 Poll Timer: No Dev.\n",
5431 card->devname);
5432 return;
5433 }
5434
5435 if (card->open_cnt != card->u.x.num_of_ch){
5436 printk(KERN_INFO "%s: Stopping the X25 Poll Timer: Interface down.\n",
5437 card->devname);
5438 return;
5439 }
5440
5441 if (test_bit(PERI_CRIT,&card->wandev.critical)){
5442 printk(KERN_INFO "%s: Stopping the X25 Poll Timer: Shutting down.\n",
5443 card->devname);
5444 return;
5445 }
5446
5447 if (!test_and_set_bit(POLL_CRIT,&card->wandev.critical)){
5448 trigger_x25_poll(card);
5449 }
5450
5451 card->u.x.x25_timer.expires=jiffies+(HZ>>1);
5452 add_timer(&card->u.x.x25_timer);
5453 return;
5454}
5455
5456void disable_comm_shutdown(sdla_t *card)
5457{
5458 TX25Mbox* mbox = card->mbox;
5459 int err;
5460
5461 /* Turn of interrutps */
5462 mbox->data[0] = 0;
5463 if (card->hw.fwid == SFID_X25_508){
5464 mbox->data[1] = card->hw.irq;
5465 mbox->data[2] = 2;
5466 mbox->cmd.length = 3;
5467 }else {
5468 mbox->cmd.length = 1;
5469 }
5470 mbox->cmd.command = X25_SET_INTERRUPT_MODE;
5471 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
5472 if (err)
5473 printk(KERN_INFO "INTERRUPT OFF FAIED %x\n",err);
5474
5475 /* Bring down HDLC */
5476 mbox->cmd.command = X25_HDLC_LINK_CLOSE;
5477 mbox->cmd.length = 0;
5478 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
5479 if (err)
5480 printk(KERN_INFO "LINK CLOSED FAILED %x\n",err);
5481
5482
5483 /* Brind down DTR */
5484 mbox->data[0] = 0;
5485 mbox->data[2] = 0;
5486 mbox->data[1] = 0x01;
5487 mbox->cmd.length = 3;
5488 mbox->cmd.command = X25_SET_GLOBAL_VARS;
5489 err = sdla_exec(mbox) ? mbox->cmd.result : CMD_TIMEOUT;
5490 if (err)
5491 printk(KERN_INFO "DTR DOWN FAILED %x\n",err);
5492
5493}
5494
5495MODULE_LICENSE("GPL");
5496
5497/****** End *****************************************************************/
diff --git a/drivers/net/wan/sdladrv.c b/drivers/net/wan/sdladrv.c
deleted file mode 100644
index 032c0f81928e..000000000000
--- a/drivers/net/wan/sdladrv.c
+++ /dev/null
@@ -1,2314 +0,0 @@
1/*****************************************************************************
2* sdladrv.c SDLA Support Module. Main module.
3*
4* This module is a library of common hardware-specific functions
5* used by all Sangoma drivers.
6*
7* Author: Gideon Hack
8*
9* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
10*
11* This program is free software; you can redistribute it and/or
12* modify it under the terms of the GNU General Public License
13* as published by the Free Software Foundation; either version
14* 2 of the License, or (at your option) any later version.
15* ============================================================================
16* Mar 20, 2001 Nenad Corbic Added the auto_pci_cfg filed, to support
17* the PCISLOT #0.
18* Apr 04, 2000 Nenad Corbic Fixed the auto memory detection code.
19* The memory test at address 0xC8000.
20* Mar 09, 2000 Nenad Corbic Added Gideon's Bug Fix: clear pci
21* interrupt flags on initial load.
22* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
23* Updates for Linux 2.2.X kernels.
24* Sep 17, 1998 Jaspreet Singh Updates for linux 2.2.X kernels
25* Dec 20, 1996 Gene Kozin Version 3.0.0. Complete overhaul.
26* Jul 12, 1996 Gene Kozin Changes for Linux 2.0 compatibility.
27* Jun 12, 1996 Gene Kozin Added support for S503 card.
28* Apr 30, 1996 Gene Kozin SDLA hardware interrupt is acknowledged before
29* calling protocolspecific ISR.
30* Register I/O ports with Linux kernel.
31* Miscellaneous bug fixes.
32* Dec 20, 1995 Gene Kozin Fixed a bug in interrupt routine.
33* Oct 14, 1995 Gene Kozin Initial version.
34*****************************************************************************/
35
36/*****************************************************************************
37 * Notes:
38 * ------
39 * 1. This code is ment to be system-independent (as much as possible). To
40 * achive this, various macros are used to hide system-specific interfaces.
41 * To compile this code, one of the following constants must be defined:
42 *
43 * Platform Define
44 * -------- ------
45 * Linux _LINUX_
46 * SCO Unix _SCO_UNIX_
47 *
48 * 2. Supported adapter types:
49 *
50 * S502A
51 * ES502A (S502E)
52 * S503
53 * S507
54 * S508 (S509)
55 *
56 * 3. S502A Notes:
57 *
58 * There is no separate DPM window enable/disable control in S502A. It
59 * opens immediately after a window number it written to the HMCR
60 * register. To close the window, HMCR has to be written a value
61 * ????1111b (e.g. 0x0F or 0xFF).
62 *
63 * S502A DPM window cannot be located at offset E000 (e.g. 0xAE000).
64 *
65 * There should be a delay of ??? before reading back S502A status
66 * register.
67 *
68 * 4. S502E Notes:
69 *
70 * S502E has a h/w bug: although default IRQ line state is HIGH, enabling
71 * interrupts by setting bit 1 of the control register (BASE) to '1'
72 * causes it to go LOW! Therefore, disabling interrupts by setting that
73 * bit to '0' causes low-to-high transition on IRQ line (ghosty
74 * interrupt). The same occurs when disabling CPU by resetting bit 0 of
75 * CPU control register (BASE+3) - see the next note.
76 *
77 * S502E CPU and DPM control is limited:
78 *
79 * o CPU cannot be stopped independently. Resetting bit 0 of the CPUi
80 * control register (BASE+3) shuts the board down entirely, including
81 * DPM;
82 *
83 * o DPM access cannot be controlled dynamically. Ones CPU is started,
84 * bit 1 of the control register (BASE) is used to enable/disable IRQ,
85 * so that access to shared memory cannot be disabled while CPU is
86 * running.
87 ****************************************************************************/
88
89#define _LINUX_
90
91#if defined(_LINUX_) /****** Linux *******************************/
92
93#include <linux/config.h>
94#include <linux/kernel.h> /* printk(), and other useful stuff */
95#include <linux/stddef.h> /* offsetof(), etc. */
96#include <linux/errno.h> /* return codes */
97#include <linux/string.h> /* inline memset(), etc. */
98#include <linux/module.h> /* support for loadable modules */
99#include <linux/jiffies.h> /* for jiffies, HZ, etc. */
100#include <linux/sdladrv.h> /* API definitions */
101#include <linux/sdlasfm.h> /* SDLA firmware module definitions */
102#include <linux/sdlapci.h> /* SDLA PCI hardware definitions */
103#include <linux/pci.h> /* PCI defines and function prototypes */
104#include <asm/io.h> /* for inb(), outb(), etc. */
105
106#define _INB(port) (inb(port))
107#define _OUTB(port, byte) (outb((byte),(port)))
108#define SYSTEM_TICK jiffies
109
110#include <linux/init.h>
111
112
113#elif defined(_SCO_UNIX_) /****** SCO Unix ****************************/
114
115#if !defined(INKERNEL)
116#error This code MUST be compiled in kernel mode!
117#endif
118#include <sys/sdladrv.h> /* API definitions */
119#include <sys/sdlasfm.h> /* SDLA firmware module definitions */
120#include <sys/inline.h> /* for inb(), outb(), etc. */
121#define _INB(port) (inb(port))
122#define _OUTB(port, byte) (outb((port),(byte)))
123#define SYSTEM_TICK lbolt
124
125#else
126#error Unknown system type!
127#endif
128
129#define MOD_VERSION 3
130#define MOD_RELEASE 0
131
132#define SDLA_IODELAY 100 /* I/O Rd/Wr delay, 10 works for 486DX2-66 */
133#define EXEC_DELAY 20 /* shared memory access delay, mks */
134#define EXEC_TIMEOUT (HZ*2) /* command timeout, in ticks */
135
136/* I/O port address range */
137#define S502A_IORANGE 3
138#define S502E_IORANGE 4
139#define S503_IORANGE 3
140#define S507_IORANGE 4
141#define S508_IORANGE 4
142
143/* Maximum amount of memory */
144#define S502_MAXMEM 0x10000L
145#define S503_MAXMEM 0x10000L
146#define S507_MAXMEM 0x40000L
147#define S508_MAXMEM 0x40000L
148
149/* Minimum amount of memory */
150#define S502_MINMEM 0x8000L
151#define S503_MINMEM 0x8000L
152#define S507_MINMEM 0x20000L
153#define S508_MINMEM 0x20000L
154#define NO_PORT -1
155
156
157
158
159
160/****** Function Prototypes *************************************************/
161
162/* Hardware-specific functions */
163static int sdla_detect (sdlahw_t* hw);
164static int sdla_autodpm (sdlahw_t* hw);
165static int sdla_setdpm (sdlahw_t* hw);
166static int sdla_load (sdlahw_t* hw, sfm_t* sfm, unsigned len);
167static int sdla_init (sdlahw_t* hw);
168static unsigned long sdla_memtest (sdlahw_t* hw);
169static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo);
170static unsigned char make_config_byte (sdlahw_t* hw);
171static int sdla_start (sdlahw_t* hw, unsigned addr);
172
173static int init_s502a (sdlahw_t* hw);
174static int init_s502e (sdlahw_t* hw);
175static int init_s503 (sdlahw_t* hw);
176static int init_s507 (sdlahw_t* hw);
177static int init_s508 (sdlahw_t* hw);
178
179static int detect_s502a (int port);
180static int detect_s502e (int port);
181static int detect_s503 (int port);
182static int detect_s507 (int port);
183static int detect_s508 (int port);
184static int detect_s514 (sdlahw_t* hw);
185static int find_s514_adapter(sdlahw_t* hw, char find_first_S514_card);
186
187/* Miscellaneous functions */
188static void peek_by_4 (unsigned long src, void* buf, unsigned len);
189static void poke_by_4 (unsigned long dest, void* buf, unsigned len);
190static int calibrate_delay (int mks);
191static int get_option_index (unsigned* optlist, unsigned optval);
192static unsigned check_memregion (void* ptr, unsigned len);
193static unsigned test_memregion (void* ptr, unsigned len);
194static unsigned short checksum (unsigned char* buf, unsigned len);
195static int init_pci_slot(sdlahw_t *);
196
197static int pci_probe(sdlahw_t *hw);
198
199/****** Global Data **********************************************************
200 * Note: All data must be explicitly initialized!!!
201 */
202
203static struct pci_device_id sdladrv_pci_tbl[] = {
204 { V3_VENDOR_ID, V3_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, },
205 { } /* Terminating entry */
206};
207MODULE_DEVICE_TABLE(pci, sdladrv_pci_tbl);
208
209MODULE_LICENSE("GPL");
210
211/* private data */
212static char modname[] = "sdladrv";
213static char fullname[] = "SDLA Support Module";
214static char copyright[] = "(c) 1995-1999 Sangoma Technologies Inc.";
215static unsigned exec_idle;
216
217/* Hardware configuration options.
218 * These are arrays of configuration options used by verification routines.
219 * The first element of each array is its size (i.e. number of options).
220 */
221static unsigned s502_port_options[] =
222 { 4, 0x250, 0x300, 0x350, 0x360 }
223;
224static unsigned s503_port_options[] =
225 { 8, 0x250, 0x254, 0x300, 0x304, 0x350, 0x354, 0x360, 0x364 }
226;
227static unsigned s508_port_options[] =
228 { 8, 0x250, 0x270, 0x280, 0x300, 0x350, 0x360, 0x380, 0x390 }
229;
230
231static unsigned s502a_irq_options[] = { 0 };
232static unsigned s502e_irq_options[] = { 4, 2, 3, 5, 7 };
233static unsigned s503_irq_options[] = { 5, 2, 3, 4, 5, 7 };
234static unsigned s508_irq_options[] = { 8, 3, 4, 5, 7, 10, 11, 12, 15 };
235
236static unsigned s502a_dpmbase_options[] =
237{
238 28,
239 0xA0000, 0xA2000, 0xA4000, 0xA6000, 0xA8000, 0xAA000, 0xAC000,
240 0xC0000, 0xC2000, 0xC4000, 0xC6000, 0xC8000, 0xCA000, 0xCC000,
241 0xD0000, 0xD2000, 0xD4000, 0xD6000, 0xD8000, 0xDA000, 0xDC000,
242 0xE0000, 0xE2000, 0xE4000, 0xE6000, 0xE8000, 0xEA000, 0xEC000,
243};
244static unsigned s507_dpmbase_options[] =
245{
246 32,
247 0xA0000, 0xA2000, 0xA4000, 0xA6000, 0xA8000, 0xAA000, 0xAC000, 0xAE000,
248 0xB0000, 0xB2000, 0xB4000, 0xB6000, 0xB8000, 0xBA000, 0xBC000, 0xBE000,
249 0xC0000, 0xC2000, 0xC4000, 0xC6000, 0xC8000, 0xCA000, 0xCC000, 0xCE000,
250 0xE0000, 0xE2000, 0xE4000, 0xE6000, 0xE8000, 0xEA000, 0xEC000, 0xEE000,
251};
252static unsigned s508_dpmbase_options[] = /* incl. S502E and S503 */
253{
254 32,
255 0xA0000, 0xA2000, 0xA4000, 0xA6000, 0xA8000, 0xAA000, 0xAC000, 0xAE000,
256 0xC0000, 0xC2000, 0xC4000, 0xC6000, 0xC8000, 0xCA000, 0xCC000, 0xCE000,
257 0xD0000, 0xD2000, 0xD4000, 0xD6000, 0xD8000, 0xDA000, 0xDC000, 0xDE000,
258 0xE0000, 0xE2000, 0xE4000, 0xE6000, 0xE8000, 0xEA000, 0xEC000, 0xEE000,
259};
260
261/*
262static unsigned s502_dpmsize_options[] = { 2, 0x2000, 0x10000 };
263static unsigned s507_dpmsize_options[] = { 2, 0x2000, 0x4000 };
264static unsigned s508_dpmsize_options[] = { 1, 0x2000 };
265*/
266
267static unsigned s502a_pclk_options[] = { 2, 3600, 7200 };
268static unsigned s502e_pclk_options[] = { 5, 3600, 5000, 7200, 8000, 10000 };
269static unsigned s503_pclk_options[] = { 3, 7200, 8000, 10000 };
270static unsigned s507_pclk_options[] = { 1, 12288 };
271static unsigned s508_pclk_options[] = { 1, 16000 };
272
273/* Host memory control register masks */
274static unsigned char s502a_hmcr[] =
275{
276 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, /* A0000 - AC000 */
277 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, /* C0000 - CC000 */
278 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, /* D0000 - DC000 */
279 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, /* E0000 - EC000 */
280};
281static unsigned char s502e_hmcr[] =
282{
283 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, /* A0000 - AE000 */
284 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, /* C0000 - CE000 */
285 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, /* D0000 - DE000 */
286 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E, /* E0000 - EE000 */
287};
288static unsigned char s507_hmcr[] =
289{
290 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, /* A0000 - AE000 */
291 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, /* B0000 - BE000 */
292 0x80, 0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, /* C0000 - CE000 */
293 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, /* E0000 - EE000 */
294};
295static unsigned char s508_hmcr[] =
296{
297 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* A0000 - AE000 */
298 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* C0000 - CE000 */
299 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* D0000 - DE000 */
300 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, /* E0000 - EE000 */
301};
302
303static unsigned char s507_irqmask[] =
304{
305 0x00, 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0
306};
307
308static int pci_slot_ar[MAX_S514_CARDS];
309
310/******* Kernel Loadable Module Entry Points ********************************/
311
312/*============================================================================
313 * Module 'insert' entry point.
314 * o print announcement
315 * o initialize static data
316 * o calibrate SDLA shared memory access delay.
317 *
318 * Return: 0 Ok
319 * < 0 error.
320 * Context: process
321 */
322
323static int __init sdladrv_init(void)
324{
325 int i=0;
326
327 printk(KERN_INFO "%s v%u.%u %s\n",
328 fullname, MOD_VERSION, MOD_RELEASE, copyright);
329 exec_idle = calibrate_delay(EXEC_DELAY);
330#ifdef WANDEBUG
331 printk(KERN_DEBUG "%s: exec_idle = %d\n", modname, exec_idle);
332#endif
333
334 /* Initialize the PCI Card array, which
335 * will store flags, used to mark
336 * card initialization state */
337 for (i=0; i<MAX_S514_CARDS; i++)
338 pci_slot_ar[i] = 0xFF;
339
340 return 0;
341}
342
343/*============================================================================
344 * Module 'remove' entry point.
345 * o release all remaining system resources
346 */
347static void __exit sdladrv_cleanup(void)
348{
349}
350
351module_init(sdladrv_init);
352module_exit(sdladrv_cleanup);
353
354/******* Kernel APIs ********************************************************/
355
356/*============================================================================
357 * Set up adapter.
358 * o detect adapter type
359 * o verify hardware configuration options
360 * o check for hardware conflicts
361 * o set up adapter shared memory
362 * o test adapter memory
363 * o load firmware
364 * Return: 0 ok.
365 * < 0 error
366 */
367
368EXPORT_SYMBOL(sdla_setup);
369
370int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len)
371{
372 unsigned* irq_opt = NULL; /* IRQ options */
373 unsigned* dpmbase_opt = NULL; /* DPM window base options */
374 unsigned* pclk_opt = NULL; /* CPU clock rate options */
375 int err=0;
376
377 if (sdla_detect(hw)) {
378 if(hw->type != SDLA_S514)
379 printk(KERN_INFO "%s: no SDLA card found at port 0x%X\n",
380 modname, hw->port);
381 return -EINVAL;
382 }
383
384 if(hw->type != SDLA_S514) {
385 printk(KERN_INFO "%s: found S%04u card at port 0x%X.\n",
386 modname, hw->type, hw->port);
387
388 hw->dpmsize = SDLA_WINDOWSIZE;
389 switch (hw->type) {
390 case SDLA_S502A:
391 hw->io_range = S502A_IORANGE;
392 irq_opt = s502a_irq_options;
393 dpmbase_opt = s502a_dpmbase_options;
394 pclk_opt = s502a_pclk_options;
395 break;
396
397 case SDLA_S502E:
398 hw->io_range = S502E_IORANGE;
399 irq_opt = s502e_irq_options;
400 dpmbase_opt = s508_dpmbase_options;
401 pclk_opt = s502e_pclk_options;
402 break;
403
404 case SDLA_S503:
405 hw->io_range = S503_IORANGE;
406 irq_opt = s503_irq_options;
407 dpmbase_opt = s508_dpmbase_options;
408 pclk_opt = s503_pclk_options;
409 break;
410
411 case SDLA_S507:
412 hw->io_range = S507_IORANGE;
413 irq_opt = s508_irq_options;
414 dpmbase_opt = s507_dpmbase_options;
415 pclk_opt = s507_pclk_options;
416 break;
417
418 case SDLA_S508:
419 hw->io_range = S508_IORANGE;
420 irq_opt = s508_irq_options;
421 dpmbase_opt = s508_dpmbase_options;
422 pclk_opt = s508_pclk_options;
423 break;
424 }
425
426 /* Verify IRQ configuration options */
427 if (!get_option_index(irq_opt, hw->irq)) {
428 printk(KERN_INFO "%s: IRQ %d is invalid!\n",
429 modname, hw->irq);
430 return -EINVAL;
431 }
432
433 /* Verify CPU clock rate configuration options */
434 if (hw->pclk == 0)
435 hw->pclk = pclk_opt[1]; /* use default */
436
437 else if (!get_option_index(pclk_opt, hw->pclk)) {
438 printk(KERN_INFO "%s: CPU clock %u is invalid!\n",
439 modname, hw->pclk);
440 return -EINVAL;
441 }
442 printk(KERN_INFO "%s: assuming CPU clock rate of %u kHz.\n",
443 modname, hw->pclk);
444
445 /* Setup adapter dual-port memory window and test memory */
446 if (hw->dpmbase == 0) {
447 err = sdla_autodpm(hw);
448 if (err) {
449 printk(KERN_INFO
450 "%s: can't find available memory region!\n",
451 modname);
452 return err;
453 }
454 }
455 else if (!get_option_index(dpmbase_opt,
456 virt_to_phys(hw->dpmbase))) {
457 printk(KERN_INFO
458 "%s: memory address 0x%lX is invalid!\n",
459 modname, virt_to_phys(hw->dpmbase));
460 return -EINVAL;
461 }
462 else if (sdla_setdpm(hw)) {
463 printk(KERN_INFO
464 "%s: 8K memory region at 0x%lX is not available!\n",
465 modname, virt_to_phys(hw->dpmbase));
466 return -EINVAL;
467 }
468 printk(KERN_INFO
469 "%s: dual-port memory window is set at 0x%lX.\n",
470 modname, virt_to_phys(hw->dpmbase));
471
472
473 /* If we find memory in 0xE**** Memory region,
474 * warn the user to disable the SHADOW RAM.
475 * Since memory corruption can occur if SHADOW is
476 * enabled. This can causes random crashes ! */
477 if (virt_to_phys(hw->dpmbase) >= 0xE0000){
478 printk(KERN_WARNING "\n%s: !!!!!!!! WARNING !!!!!!!!\n",modname);
479 printk(KERN_WARNING "%s: WANPIPE is using 0x%lX memory region !!!\n",
480 modname, virt_to_phys(hw->dpmbase));
481 printk(KERN_WARNING " Please disable the SHADOW RAM, otherwise\n");
482 printk(KERN_WARNING " your system might crash randomly from time to time !\n");
483 printk(KERN_WARNING "%s: !!!!!!!! WARNING !!!!!!!!\n\n",modname);
484 }
485 }
486
487 else {
488 hw->memory = test_memregion((void*)hw->dpmbase,
489 MAX_SIZEOF_S514_MEMORY);
490 if(hw->memory < (256 * 1024)) {
491 printk(KERN_INFO
492 "%s: error in testing S514 memory (0x%lX)\n",
493 modname, hw->memory);
494 sdla_down(hw);
495 return -EINVAL;
496 }
497 }
498
499 printk(KERN_INFO "%s: found %luK bytes of on-board memory\n",
500 modname, hw->memory / 1024);
501
502 /* Load firmware. If loader fails then shut down adapter */
503 err = sdla_load(hw, sfm, len);
504 if (err) sdla_down(hw); /* shutdown adapter */
505
506 return err;
507}
508
509/*============================================================================
510 * Shut down SDLA: disable shared memory access and interrupts, stop CPU, etc.
511 */
512
513EXPORT_SYMBOL(sdla_down);
514
515int sdla_down (sdlahw_t* hw)
516{
517 unsigned port = hw->port;
518 int i;
519 unsigned char CPU_no;
520 u32 int_config, int_status;
521
522 if(!port && (hw->type != SDLA_S514))
523 return -EFAULT;
524
525 switch (hw->type) {
526 case SDLA_S502A:
527 _OUTB(port, 0x08); /* halt CPU */
528 _OUTB(port, 0x08);
529 _OUTB(port, 0x08);
530 hw->regs[0] = 0x08;
531 _OUTB(port + 1, 0xFF); /* close memory window */
532 hw->regs[1] = 0xFF;
533 break;
534
535 case SDLA_S502E:
536 _OUTB(port + 3, 0); /* stop CPU */
537 _OUTB(port, 0); /* reset board */
538 for (i = 0; i < S502E_IORANGE; ++i)
539 hw->regs[i] = 0
540 ;
541 break;
542
543 case SDLA_S503:
544 case SDLA_S507:
545 case SDLA_S508:
546 _OUTB(port, 0); /* reset board logic */
547 hw->regs[0] = 0;
548 break;
549
550 case SDLA_S514:
551 /* halt the adapter */
552 *(char *)hw->vector = S514_CPU_HALT;
553 CPU_no = hw->S514_cpu_no[0];
554
555 /* disable the PCI IRQ and disable memory access */
556 pci_read_config_dword(hw->pci_dev, PCI_INT_CONFIG, &int_config);
557 int_config &= (CPU_no == S514_CPU_A) ? ~PCI_DISABLE_IRQ_CPU_A : ~PCI_DISABLE_IRQ_CPU_B;
558 pci_write_config_dword(hw->pci_dev, PCI_INT_CONFIG, int_config);
559 read_S514_int_stat(hw, &int_status);
560 S514_intack(hw, int_status);
561 if(CPU_no == S514_CPU_A)
562 pci_write_config_dword(hw->pci_dev, PCI_MAP0_DWORD,
563 PCI_CPU_A_MEM_DISABLE);
564 else
565 pci_write_config_dword(hw->pci_dev, PCI_MAP1_DWORD,
566 PCI_CPU_B_MEM_DISABLE);
567
568 /* free up the allocated virtual memory */
569 iounmap((void *)hw->dpmbase);
570 iounmap((void *)hw->vector);
571 break;
572
573
574 default:
575 return -EINVAL;
576 }
577 return 0;
578}
579
580/*============================================================================
581 * Map shared memory window into SDLA address space.
582 */
583
584EXPORT_SYMBOL(sdla_mapmem);
585
586int sdla_mapmem (sdlahw_t* hw, unsigned long addr)
587{
588 unsigned port = hw->port;
589 register int tmp;
590
591 switch (hw->type) {
592 case SDLA_S502A:
593 case SDLA_S502E:
594 if (addr < S502_MAXMEM) { /* verify parameter */
595 tmp = addr >> 13; /* convert to register mask */
596 _OUTB(port + 2, tmp);
597 hw->regs[2] = tmp;
598 }
599 else return -EINVAL;
600 break;
601
602 case SDLA_S503:
603 if (addr < S503_MAXMEM) { /* verify parameter */
604 tmp = (hw->regs[0] & 0x8F) | ((addr >> 9) & 0x70);
605 _OUTB(port, tmp);
606 hw->regs[0] = tmp;
607 }
608 else return -EINVAL;
609 break;
610
611 case SDLA_S507:
612 if (addr < S507_MAXMEM) {
613 if (!(_INB(port) & 0x02))
614 return -EIO;
615 tmp = addr >> 13; /* convert to register mask */
616 _OUTB(port + 2, tmp);
617 hw->regs[2] = tmp;
618 }
619 else return -EINVAL;
620 break;
621
622 case SDLA_S508:
623 if (addr < S508_MAXMEM) {
624 tmp = addr >> 13; /* convert to register mask */
625 _OUTB(port + 2, tmp);
626 hw->regs[2] = tmp;
627 }
628 else return -EINVAL;
629 break;
630
631 case SDLA_S514:
632 return 0;
633
634 default:
635 return -EINVAL;
636 }
637 hw->vector = addr & 0xFFFFE000L;
638 return 0;
639}
640
641/*============================================================================
642 * Enable interrupt generation.
643 */
644
645static int sdla_inten (sdlahw_t* hw)
646{
647 unsigned port = hw->port;
648 int tmp, i;
649
650 switch (hw->type) {
651 case SDLA_S502E:
652 /* Note thar interrupt control operations on S502E are allowed
653 * only if CPU is enabled (bit 0 of status register is set).
654 */
655 if (_INB(port) & 0x01) {
656 _OUTB(port, 0x02); /* bit1 = 1, bit2 = 0 */
657 _OUTB(port, 0x06); /* bit1 = 1, bit2 = 1 */
658 hw->regs[0] = 0x06;
659 }
660 else return -EIO;
661 break;
662
663 case SDLA_S503:
664 tmp = hw->regs[0] | 0x04;
665 _OUTB(port, tmp);
666 hw->regs[0] = tmp; /* update mirror */
667 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
668 if (!(_INB(port) & 0x02)) /* verify */
669 return -EIO;
670 break;
671
672 case SDLA_S508:
673 tmp = hw->regs[0] | 0x10;
674 _OUTB(port, tmp);
675 hw->regs[0] = tmp; /* update mirror */
676 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
677 if (!(_INB(port + 1) & 0x10)) /* verify */
678 return -EIO;
679 break;
680
681 case SDLA_S502A:
682 case SDLA_S507:
683 break;
684
685 case SDLA_S514:
686 break;
687
688 default:
689 return -EINVAL;
690
691 }
692 return 0;
693}
694
695/*============================================================================
696 * Disable interrupt generation.
697 */
698
699#if 0
700int sdla_intde (sdlahw_t* hw)
701{
702 unsigned port = hw->port;
703 int tmp, i;
704
705 switch (hw->type) {
706 case SDLA_S502E:
707 /* Notes:
708 * 1) interrupt control operations are allowed only if CPU is
709 * enabled (bit 0 of status register is set).
710 * 2) disabling interrupts using bit 1 of control register
711 * causes IRQ line go high, therefore we are going to use
712 * 0x04 instead: lower it to inhibit interrupts to PC.
713 */
714 if (_INB(port) & 0x01) {
715 _OUTB(port, hw->regs[0] & ~0x04);
716 hw->regs[0] &= ~0x04;
717 }
718 else return -EIO;
719 break;
720
721 case SDLA_S503:
722 tmp = hw->regs[0] & ~0x04;
723 _OUTB(port, tmp);
724 hw->regs[0] = tmp; /* update mirror */
725 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
726 if (_INB(port) & 0x02) /* verify */
727 return -EIO;
728 break;
729
730 case SDLA_S508:
731 tmp = hw->regs[0] & ~0x10;
732 _OUTB(port, tmp);
733 hw->regs[0] = tmp; /* update mirror */
734 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
735 if (_INB(port) & 0x10) /* verify */
736 return -EIO;
737 break;
738
739 case SDLA_S502A:
740 case SDLA_S507:
741 break;
742
743 default:
744 return -EINVAL;
745 }
746 return 0;
747}
748#endif /* 0 */
749
750/*============================================================================
751 * Acknowledge SDLA hardware interrupt.
752 */
753
754static int sdla_intack (sdlahw_t* hw)
755{
756 unsigned port = hw->port;
757 int tmp;
758
759 switch (hw->type) {
760 case SDLA_S502E:
761 /* To acknoledge hardware interrupt we have to toggle bit 3 of
762 * control register: \_/
763 * Note that interrupt control operations on S502E are allowed
764 * only if CPU is enabled (bit 1 of status register is set).
765 */
766 if (_INB(port) & 0x01) {
767 tmp = hw->regs[0] & ~0x04;
768 _OUTB(port, tmp);
769 tmp |= 0x04;
770 _OUTB(port, tmp);
771 hw->regs[0] = tmp;
772 }
773 else return -EIO;
774 break;
775
776 case SDLA_S503:
777 if (_INB(port) & 0x04) {
778 tmp = hw->regs[0] & ~0x08;
779 _OUTB(port, tmp);
780 tmp |= 0x08;
781 _OUTB(port, tmp);
782 hw->regs[0] = tmp;
783 }
784 break;
785
786 case SDLA_S502A:
787 case SDLA_S507:
788 case SDLA_S508:
789 break;
790
791 default:
792 return -EINVAL;
793 }
794 return 0;
795}
796
797
798/*============================================================================
799 * Acknowledge S514 hardware interrupt.
800 */
801
802EXPORT_SYMBOL(S514_intack);
803
804void S514_intack (sdlahw_t* hw, u32 int_status)
805{
806 pci_write_config_dword(hw->pci_dev, PCI_INT_STATUS, int_status);
807}
808
809
810/*============================================================================
811 * Read the S514 hardware interrupt status.
812 */
813
814EXPORT_SYMBOL(read_S514_int_stat);
815
816void read_S514_int_stat (sdlahw_t* hw, u32* int_status)
817{
818 pci_read_config_dword(hw->pci_dev, PCI_INT_STATUS, int_status);
819}
820
821
822/*============================================================================
823 * Generate an interrupt to adapter's CPU.
824 */
825
826#if 0
827int sdla_intr (sdlahw_t* hw)
828{
829 unsigned port = hw->port;
830
831 switch (hw->type) {
832 case SDLA_S502A:
833 if (!(_INB(port) & 0x40)) {
834 _OUTB(port, 0x10); /* issue NMI to CPU */
835 hw->regs[0] = 0x10;
836 }
837 else return -EIO;
838 break;
839
840 case SDLA_S507:
841 if ((_INB(port) & 0x06) == 0x06) {
842 _OUTB(port + 3, 0);
843 }
844 else return -EIO;
845 break;
846
847 case SDLA_S508:
848 if (_INB(port + 1) & 0x02) {
849 _OUTB(port, 0x08);
850 }
851 else return -EIO;
852 break;
853
854 case SDLA_S502E:
855 case SDLA_S503:
856 default:
857 return -EINVAL;
858 }
859 return 0;
860}
861#endif /* 0 */
862
863/*============================================================================
864 * Execute Adapter Command.
865 * o Set exec flag.
866 * o Busy-wait until flag is reset.
867 * o Return number of loops made, or 0 if command timed out.
868 */
869
870EXPORT_SYMBOL(sdla_exec);
871
872int sdla_exec (void* opflag)
873{
874 volatile unsigned char* flag = opflag;
875 unsigned long tstop;
876 int nloops;
877
878 if(readb(flag) != 0x00) {
879 printk(KERN_INFO
880 "WANPIPE: opp flag set on entry to sdla_exec\n");
881 return 0;
882 }
883
884 writeb(0x01, flag);
885
886 tstop = SYSTEM_TICK + EXEC_TIMEOUT;
887
888 for (nloops = 1; (readb(flag) == 0x01); ++ nloops) {
889 unsigned delay = exec_idle;
890 while (-- delay); /* delay */
891 if (SYSTEM_TICK > tstop) return 0; /* time is up! */
892 }
893 return nloops;
894}
895
896/*============================================================================
897 * Read absolute adapter memory.
898 * Transfer data from adapter's memory to data buffer.
899 *
900 * Note:
901 * Care should be taken when crossing dual-port memory window boundary.
902 * This function is not atomic, so caller must disable interrupt if
903 * interrupt routines are accessing adapter shared memory.
904 */
905
906EXPORT_SYMBOL(sdla_peek);
907
908int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, unsigned len)
909{
910
911 if (addr + len > hw->memory) /* verify arguments */
912 return -EINVAL;
913
914 if(hw->type == SDLA_S514) { /* copy data for the S514 adapter */
915 peek_by_4 ((unsigned long)hw->dpmbase + addr, buf, len);
916 return 0;
917 }
918
919 else { /* copy data for the S508 adapter */
920 unsigned long oldvec = hw->vector;
921 unsigned winsize = hw->dpmsize;
922 unsigned curpos, curlen; /* current offset and block size */
923 unsigned long curvec; /* current DPM window vector */
924 int err = 0;
925
926 while (len && !err) {
927 curpos = addr % winsize; /* current window offset */
928 curvec = addr - curpos; /* current window vector */
929 curlen = (len > (winsize - curpos)) ?
930 (winsize - curpos) : len;
931 /* Relocate window and copy block of data */
932 err = sdla_mapmem(hw, curvec);
933 peek_by_4 ((unsigned long)hw->dpmbase + curpos, buf,
934 curlen);
935 addr += curlen;
936 buf = (char*)buf + curlen;
937 len -= curlen;
938 }
939
940 /* Restore DPM window position */
941 sdla_mapmem(hw, oldvec);
942 return err;
943 }
944}
945
946
947/*============================================================================
948 * Read data from adapter's memory to a data buffer in 4-byte chunks.
949 * Note that we ensure that the SDLA memory address is on a 4-byte boundary
950 * before we begin moving the data in 4-byte chunks.
951*/
952
953static void peek_by_4 (unsigned long src, void* buf, unsigned len)
954{
955
956 /* byte copy data until we get to a 4-byte boundary */
957 while (len && (src & 0x03)) {
958 *(char *)buf ++ = readb(src ++);
959 len --;
960 }
961
962 /* copy data in 4-byte chunks */
963 while (len >= 4) {
964 *(unsigned long *)buf = readl(src);
965 buf += 4;
966 src += 4;
967 len -= 4;
968 }
969
970 /* byte copy any remaining data */
971 while (len) {
972 *(char *)buf ++ = readb(src ++);
973 len --;
974 }
975}
976
977
978/*============================================================================
979 * Write Absolute Adapter Memory.
980 * Transfer data from data buffer to adapter's memory.
981 *
982 * Note:
983 * Care should be taken when crossing dual-port memory window boundary.
984 * This function is not atomic, so caller must disable interrupt if
985 * interrupt routines are accessing adapter shared memory.
986 */
987
988EXPORT_SYMBOL(sdla_poke);
989
990int sdla_poke (sdlahw_t* hw, unsigned long addr, void* buf, unsigned len)
991{
992
993 if (addr + len > hw->memory) /* verify arguments */
994 return -EINVAL;
995
996 if(hw->type == SDLA_S514) { /* copy data for the S514 adapter */
997 poke_by_4 ((unsigned long)hw->dpmbase + addr, buf, len);
998 return 0;
999 }
1000
1001 else { /* copy data for the S508 adapter */
1002 unsigned long oldvec = hw->vector;
1003 unsigned winsize = hw->dpmsize;
1004 unsigned curpos, curlen; /* current offset and block size */
1005 unsigned long curvec; /* current DPM window vector */
1006 int err = 0;
1007
1008 while (len && !err) {
1009 curpos = addr % winsize; /* current window offset */
1010 curvec = addr - curpos; /* current window vector */
1011 curlen = (len > (winsize - curpos)) ?
1012 (winsize - curpos) : len;
1013 /* Relocate window and copy block of data */
1014 sdla_mapmem(hw, curvec);
1015 poke_by_4 ((unsigned long)hw->dpmbase + curpos, buf,
1016 curlen);
1017 addr += curlen;
1018 buf = (char*)buf + curlen;
1019 len -= curlen;
1020 }
1021
1022 /* Restore DPM window position */
1023 sdla_mapmem(hw, oldvec);
1024 return err;
1025 }
1026}
1027
1028
1029/*============================================================================
1030 * Write from a data buffer to adapter's memory in 4-byte chunks.
1031 * Note that we ensure that the SDLA memory address is on a 4-byte boundary
1032 * before we begin moving the data in 4-byte chunks.
1033*/
1034
1035static void poke_by_4 (unsigned long dest, void* buf, unsigned len)
1036{
1037
1038 /* byte copy data until we get to a 4-byte boundary */
1039 while (len && (dest & 0x03)) {
1040 writeb (*(char *)buf ++, dest ++);
1041 len --;
1042 }
1043
1044 /* copy data in 4-byte chunks */
1045 while (len >= 4) {
1046 writel (*(unsigned long *)buf, dest);
1047 dest += 4;
1048 buf += 4;
1049 len -= 4;
1050 }
1051
1052 /* byte copy any remaining data */
1053 while (len) {
1054 writeb (*(char *)buf ++ , dest ++);
1055 len --;
1056 }
1057}
1058
1059
1060#ifdef DONT_COMPIPLE_THIS
1061#endif /* DONT_COMPIPLE_THIS */
1062
1063/****** Hardware-Specific Functions *****************************************/
1064
1065/*============================================================================
1066 * Detect adapter type.
1067 * o if adapter type is specified then call detection routine for that adapter
1068 * type. Otherwise call detection routines for every adapter types until
1069 * adapter is detected.
1070 *
1071 * Notes:
1072 * 1) Detection tests are destructive! Adapter will be left in shutdown state
1073 * after the test.
1074 */
1075static int sdla_detect (sdlahw_t* hw)
1076{
1077 unsigned port = hw->port;
1078 int err = 0;
1079
1080 if (!port && (hw->type != SDLA_S514))
1081 return -EFAULT;
1082
1083 switch (hw->type) {
1084 case SDLA_S502A:
1085 if (!detect_s502a(port)) err = -ENODEV;
1086 break;
1087
1088 case SDLA_S502E:
1089 if (!detect_s502e(port)) err = -ENODEV;
1090 break;
1091
1092 case SDLA_S503:
1093 if (!detect_s503(port)) err = -ENODEV;
1094 break;
1095
1096 case SDLA_S507:
1097 if (!detect_s507(port)) err = -ENODEV;
1098 break;
1099
1100 case SDLA_S508:
1101 if (!detect_s508(port)) err = -ENODEV;
1102 break;
1103
1104 case SDLA_S514:
1105 if (!detect_s514(hw)) err = -ENODEV;
1106 break;
1107
1108 default:
1109 if (detect_s502a(port))
1110 hw->type = SDLA_S502A;
1111 else if (detect_s502e(port))
1112 hw->type = SDLA_S502E;
1113 else if (detect_s503(port))
1114 hw->type = SDLA_S503;
1115 else if (detect_s507(port))
1116 hw->type = SDLA_S507;
1117 else if (detect_s508(port))
1118 hw->type = SDLA_S508;
1119 else err = -ENODEV;
1120 }
1121 return err;
1122}
1123
1124/*============================================================================
1125 * Autoselect memory region.
1126 * o try all available DMP address options from the top down until success.
1127 */
1128static int sdla_autodpm (sdlahw_t* hw)
1129{
1130 int i, err = -EINVAL;
1131 unsigned* opt;
1132
1133 switch (hw->type) {
1134 case SDLA_S502A:
1135 opt = s502a_dpmbase_options;
1136 break;
1137
1138 case SDLA_S502E:
1139 case SDLA_S503:
1140 case SDLA_S508:
1141 opt = s508_dpmbase_options;
1142 break;
1143
1144 case SDLA_S507:
1145 opt = s507_dpmbase_options;
1146 break;
1147
1148 default:
1149 return -EINVAL;
1150 }
1151
1152 /* Start testing from 8th position, address
1153 * 0xC8000 from the 508 address table.
1154 * We don't want to test A**** addresses, since
1155 * they are usually used for Video */
1156 for (i = 8; i <= opt[0] && err; i++) {
1157 hw->dpmbase = phys_to_virt(opt[i]);
1158 err = sdla_setdpm(hw);
1159 }
1160 return err;
1161}
1162
1163/*============================================================================
1164 * Set up adapter dual-port memory window.
1165 * o shut down adapter
1166 * o make sure that no physical memory exists in this region, i.e entire
1167 * region reads 0xFF and is not writable when adapter is shut down.
1168 * o initialize adapter hardware
1169 * o make sure that region is usable with SDLA card, i.e. we can write to it
1170 * when adapter is configured.
1171 */
1172static int sdla_setdpm (sdlahw_t* hw)
1173{
1174 int err;
1175
1176 /* Shut down card and verify memory region */
1177 sdla_down(hw);
1178 if (check_memregion(hw->dpmbase, hw->dpmsize))
1179 return -EINVAL;
1180
1181 /* Initialize adapter and test on-board memory segment by segment.
1182 * If memory size appears to be less than shared memory window size,
1183 * assume that memory region is unusable.
1184 */
1185 err = sdla_init(hw);
1186 if (err) return err;
1187
1188 if (sdla_memtest(hw) < hw->dpmsize) { /* less than window size */
1189 sdla_down(hw);
1190 return -EIO;
1191 }
1192 sdla_mapmem(hw, 0L); /* set window vector at bottom */
1193 return 0;
1194}
1195
1196/*============================================================================
1197 * Load adapter from the memory image of the SDLA firmware module.
1198 * o verify firmware integrity and compatibility
1199 * o start adapter up
1200 */
1201static int sdla_load (sdlahw_t* hw, sfm_t* sfm, unsigned len)
1202{
1203
1204 int i;
1205
1206 /* Verify firmware signature */
1207 if (strcmp(sfm->signature, SFM_SIGNATURE)) {
1208 printk(KERN_INFO "%s: not SDLA firmware!\n",
1209 modname);
1210 return -EINVAL;
1211 }
1212
1213 /* Verify firmware module format version */
1214 if (sfm->version != SFM_VERSION) {
1215 printk(KERN_INFO
1216 "%s: firmware format %u rejected! Expecting %u.\n",
1217 modname, sfm->version, SFM_VERSION);
1218 return -EINVAL;
1219 }
1220
1221 /* Verify firmware module length and checksum */
1222 if ((len - offsetof(sfm_t, image) != sfm->info.codesize) ||
1223 (checksum((void*)&sfm->info,
1224 sizeof(sfm_info_t) + sfm->info.codesize) != sfm->checksum)) {
1225 printk(KERN_INFO "%s: firmware corrupted!\n", modname);
1226 return -EINVAL;
1227 }
1228
1229 /* Announce */
1230 printk(KERN_INFO "%s: loading %s (ID=%u)...\n", modname,
1231 (sfm->descr[0] != '\0') ? sfm->descr : "unknown firmware",
1232 sfm->info.codeid);
1233
1234 if(hw->type == SDLA_S514)
1235 printk(KERN_INFO "%s: loading S514 adapter, CPU %c\n",
1236 modname, hw->S514_cpu_no[0]);
1237
1238 /* Scan through the list of compatible adapters and make sure our
1239 * adapter type is listed.
1240 */
1241 for (i = 0;
1242 (i < SFM_MAX_SDLA) && (sfm->info.adapter[i] != hw->type);
1243 ++i);
1244
1245 if (i == SFM_MAX_SDLA) {
1246 printk(KERN_INFO "%s: firmware is not compatible with S%u!\n",
1247 modname, hw->type);
1248 return -EINVAL;
1249 }
1250
1251
1252 /* Make sure there is enough on-board memory */
1253 if (hw->memory < sfm->info.memsize) {
1254 printk(KERN_INFO
1255 "%s: firmware needs %lu bytes of on-board memory!\n",
1256 modname, sfm->info.memsize);
1257 return -EINVAL;
1258 }
1259
1260 /* Move code onto adapter */
1261 if (sdla_poke(hw, sfm->info.codeoffs, sfm->image, sfm->info.codesize)) {
1262 printk(KERN_INFO "%s: failed to load code segment!\n",
1263 modname);
1264 return -EIO;
1265 }
1266
1267 /* Prepare boot-time configuration data and kick-off CPU */
1268 sdla_bootcfg(hw, &sfm->info);
1269 if (sdla_start(hw, sfm->info.startoffs)) {
1270 printk(KERN_INFO "%s: Damn... Adapter won't start!\n",
1271 modname);
1272 return -EIO;
1273 }
1274
1275 /* position DPM window over the mailbox and enable interrupts */
1276 if (sdla_mapmem(hw, sfm->info.winoffs) || sdla_inten(hw)) {
1277 printk(KERN_INFO "%s: adapter hardware failure!\n",
1278 modname);
1279 return -EIO;
1280 }
1281 hw->fwid = sfm->info.codeid; /* set firmware ID */
1282 return 0;
1283}
1284
1285/*============================================================================
1286 * Initialize SDLA hardware: setup memory window, IRQ, etc.
1287 */
1288static int sdla_init (sdlahw_t* hw)
1289{
1290 int i;
1291
1292 for (i = 0; i < SDLA_MAXIORANGE; ++i)
1293 hw->regs[i] = 0;
1294
1295 switch (hw->type) {
1296 case SDLA_S502A: return init_s502a(hw);
1297 case SDLA_S502E: return init_s502e(hw);
1298 case SDLA_S503: return init_s503(hw);
1299 case SDLA_S507: return init_s507(hw);
1300 case SDLA_S508: return init_s508(hw);
1301 }
1302 return -EINVAL;
1303}
1304
1305/*============================================================================
1306 * Test adapter on-board memory.
1307 * o slide DPM window from the bottom up and test adapter memory segment by
1308 * segment.
1309 * Return adapter memory size.
1310 */
1311static unsigned long sdla_memtest (sdlahw_t* hw)
1312{
1313 unsigned long memsize;
1314 unsigned winsize;
1315
1316 for (memsize = 0, winsize = hw->dpmsize;
1317 !sdla_mapmem(hw, memsize) &&
1318 (test_memregion(hw->dpmbase, winsize) == winsize)
1319 ;
1320 memsize += winsize)
1321 ;
1322 hw->memory = memsize;
1323 return memsize;
1324}
1325
1326/*============================================================================
1327 * Prepare boot-time firmware configuration data.
1328 * o position DPM window
1329 * o initialize configuration data area
1330 */
1331static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo)
1332{
1333 unsigned char* data;
1334
1335 if (!sfminfo->datasize) return 0; /* nothing to do */
1336
1337 if (sdla_mapmem(hw, sfminfo->dataoffs) != 0)
1338 return -EIO;
1339
1340 if(hw->type == SDLA_S514)
1341 data = (void*)(hw->dpmbase + sfminfo->dataoffs);
1342 else
1343 data = (void*)((u8 *)hw->dpmbase +
1344 (sfminfo->dataoffs - hw->vector));
1345
1346 memset_io (data, 0, sfminfo->datasize);
1347
1348 writeb (make_config_byte(hw), &data[0x00]);
1349
1350 switch (sfminfo->codeid) {
1351 case SFID_X25_502:
1352 case SFID_X25_508:
1353 writeb (3, &data[0x01]); /* T1 timer */
1354 writeb (10, &data[0x03]); /* N2 */
1355 writeb (7, &data[0x06]); /* HDLC window size */
1356 writeb (1, &data[0x0B]); /* DTE */
1357 writeb (2, &data[0x0C]); /* X.25 packet window size */
1358 writew (128, &data[0x0D]); /* default X.25 data size */
1359 writew (128, &data[0x0F]); /* maximum X.25 data size */
1360 break;
1361 }
1362 return 0;
1363}
1364
1365/*============================================================================
1366 * Prepare configuration byte identifying adapter type and CPU clock rate.
1367 */
1368static unsigned char make_config_byte (sdlahw_t* hw)
1369{
1370 unsigned char byte = 0;
1371
1372 switch (hw->pclk) {
1373 case 5000: byte = 0x01; break;
1374 case 7200: byte = 0x02; break;
1375 case 8000: byte = 0x03; break;
1376 case 10000: byte = 0x04; break;
1377 case 16000: byte = 0x05; break;
1378 }
1379
1380 switch (hw->type) {
1381 case SDLA_S502E: byte |= 0x80; break;
1382 case SDLA_S503: byte |= 0x40; break;
1383 }
1384 return byte;
1385}
1386
1387/*============================================================================
1388 * Start adapter's CPU.
1389 * o calculate a pointer to adapter's cold boot entry point
1390 * o position DPM window
1391 * o place boot instruction (jp addr) at cold boot entry point
1392 * o start CPU
1393 */
1394static int sdla_start (sdlahw_t* hw, unsigned addr)
1395{
1396 unsigned port = hw->port;
1397 unsigned char *bootp;
1398 int err, tmp, i;
1399
1400 if (!port && (hw->type != SDLA_S514)) return -EFAULT;
1401
1402 switch (hw->type) {
1403 case SDLA_S502A:
1404 bootp = hw->dpmbase;
1405 bootp += 0x66;
1406 break;
1407
1408 case SDLA_S502E:
1409 case SDLA_S503:
1410 case SDLA_S507:
1411 case SDLA_S508:
1412 case SDLA_S514:
1413 bootp = hw->dpmbase;
1414 break;
1415
1416 default:
1417 return -EINVAL;
1418 }
1419
1420 err = sdla_mapmem(hw, 0);
1421 if (err) return err;
1422
1423 writeb (0xC3, bootp); /* Z80: 'jp' opcode */
1424 bootp ++;
1425 writew (addr, bootp);
1426
1427 switch (hw->type) {
1428 case SDLA_S502A:
1429 _OUTB(port, 0x10); /* issue NMI to CPU */
1430 hw->regs[0] = 0x10;
1431 break;
1432
1433 case SDLA_S502E:
1434 _OUTB(port + 3, 0x01); /* start CPU */
1435 hw->regs[3] = 0x01;
1436 for (i = 0; i < SDLA_IODELAY; ++i);
1437 if (_INB(port) & 0x01) { /* verify */
1438 /*
1439 * Enabling CPU changes functionality of the
1440 * control register, so we have to reset its
1441 * mirror.
1442 */
1443 _OUTB(port, 0); /* disable interrupts */
1444 hw->regs[0] = 0;
1445 }
1446 else return -EIO;
1447 break;
1448
1449 case SDLA_S503:
1450 tmp = hw->regs[0] | 0x09; /* set bits 0 and 3 */
1451 _OUTB(port, tmp);
1452 hw->regs[0] = tmp; /* update mirror */
1453 for (i = 0; i < SDLA_IODELAY; ++i);
1454 if (!(_INB(port) & 0x01)) /* verify */
1455 return -EIO;
1456 break;
1457
1458 case SDLA_S507:
1459 tmp = hw->regs[0] | 0x02;
1460 _OUTB(port, tmp);
1461 hw->regs[0] = tmp; /* update mirror */
1462 for (i = 0; i < SDLA_IODELAY; ++i);
1463 if (!(_INB(port) & 0x04)) /* verify */
1464 return -EIO;
1465 break;
1466
1467 case SDLA_S508:
1468 tmp = hw->regs[0] | 0x02;
1469 _OUTB(port, tmp);
1470 hw->regs[0] = tmp; /* update mirror */
1471 for (i = 0; i < SDLA_IODELAY; ++i);
1472 if (!(_INB(port + 1) & 0x02)) /* verify */
1473 return -EIO;
1474 break;
1475
1476 case SDLA_S514:
1477 writeb (S514_CPU_START, hw->vector);
1478 break;
1479
1480 default:
1481 return -EINVAL;
1482 }
1483 return 0;
1484}
1485
1486/*============================================================================
1487 * Initialize S502A adapter.
1488 */
1489static int init_s502a (sdlahw_t* hw)
1490{
1491 unsigned port = hw->port;
1492 int tmp, i;
1493
1494 if (!detect_s502a(port))
1495 return -ENODEV;
1496
1497 hw->regs[0] = 0x08;
1498 hw->regs[1] = 0xFF;
1499
1500 /* Verify configuration options */
1501 i = get_option_index(s502a_dpmbase_options, virt_to_phys(hw->dpmbase));
1502 if (i == 0)
1503 return -EINVAL;
1504
1505 tmp = s502a_hmcr[i - 1];
1506 switch (hw->dpmsize) {
1507 case 0x2000:
1508 tmp |= 0x01;
1509 break;
1510
1511 case 0x10000L:
1512 break;
1513
1514 default:
1515 return -EINVAL;
1516 }
1517
1518 /* Setup dual-port memory window (this also enables memory access) */
1519 _OUTB(port + 1, tmp);
1520 hw->regs[1] = tmp;
1521 hw->regs[0] = 0x08;
1522 return 0;
1523}
1524
1525/*============================================================================
1526 * Initialize S502E adapter.
1527 */
1528static int init_s502e (sdlahw_t* hw)
1529{
1530 unsigned port = hw->port;
1531 int tmp, i;
1532
1533 if (!detect_s502e(port))
1534 return -ENODEV;
1535
1536 /* Verify configuration options */
1537 i = get_option_index(s508_dpmbase_options, virt_to_phys(hw->dpmbase));
1538 if (i == 0)
1539 return -EINVAL;
1540
1541 tmp = s502e_hmcr[i - 1];
1542 switch (hw->dpmsize) {
1543 case 0x2000:
1544 tmp |= 0x01;
1545 break;
1546
1547 case 0x10000L:
1548 break;
1549
1550 default:
1551 return -EINVAL;
1552 }
1553
1554 /* Setup dual-port memory window */
1555 _OUTB(port + 1, tmp);
1556 hw->regs[1] = tmp;
1557
1558 /* Enable memory access */
1559 _OUTB(port, 0x02);
1560 hw->regs[0] = 0x02;
1561 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1562 return (_INB(port) & 0x02) ? 0 : -EIO;
1563}
1564
1565/*============================================================================
1566 * Initialize S503 adapter.
1567 * ---------------------------------------------------------------------------
1568 */
1569static int init_s503 (sdlahw_t* hw)
1570{
1571 unsigned port = hw->port;
1572 int tmp, i;
1573
1574 if (!detect_s503(port))
1575 return -ENODEV;
1576
1577 /* Verify configuration options */
1578 i = get_option_index(s508_dpmbase_options, virt_to_phys(hw->dpmbase));
1579 if (i == 0)
1580 return -EINVAL;
1581
1582 tmp = s502e_hmcr[i - 1];
1583 switch (hw->dpmsize) {
1584 case 0x2000:
1585 tmp |= 0x01;
1586 break;
1587
1588 case 0x10000L:
1589 break;
1590
1591 default:
1592 return -EINVAL;
1593 }
1594
1595 /* Setup dual-port memory window */
1596 _OUTB(port + 1, tmp);
1597 hw->regs[1] = tmp;
1598
1599 /* Enable memory access */
1600 _OUTB(port, 0x02);
1601 hw->regs[0] = 0x02; /* update mirror */
1602 return 0;
1603}
1604
1605/*============================================================================
1606 * Initialize S507 adapter.
1607 */
1608static int init_s507 (sdlahw_t* hw)
1609{
1610 unsigned port = hw->port;
1611 int tmp, i;
1612
1613 if (!detect_s507(port))
1614 return -ENODEV;
1615
1616 /* Verify configuration options */
1617 i = get_option_index(s507_dpmbase_options, virt_to_phys(hw->dpmbase));
1618 if (i == 0)
1619 return -EINVAL;
1620
1621 tmp = s507_hmcr[i - 1];
1622 switch (hw->dpmsize) {
1623 case 0x2000:
1624 tmp |= 0x01;
1625 break;
1626
1627 case 0x10000L:
1628 break;
1629
1630 default:
1631 return -EINVAL;
1632 }
1633
1634 /* Enable adapter's logic */
1635 _OUTB(port, 0x01);
1636 hw->regs[0] = 0x01;
1637 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1638 if (!(_INB(port) & 0x20))
1639 return -EIO;
1640
1641 /* Setup dual-port memory window */
1642 _OUTB(port + 1, tmp);
1643 hw->regs[1] = tmp;
1644
1645 /* Enable memory access */
1646 tmp = hw->regs[0] | 0x04;
1647 if (hw->irq) {
1648 i = get_option_index(s508_irq_options, hw->irq);
1649 if (i) tmp |= s507_irqmask[i - 1];
1650 }
1651 _OUTB(port, tmp);
1652 hw->regs[0] = tmp; /* update mirror */
1653 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1654 return (_INB(port) & 0x08) ? 0 : -EIO;
1655}
1656
1657/*============================================================================
1658 * Initialize S508 adapter.
1659 */
1660static int init_s508 (sdlahw_t* hw)
1661{
1662 unsigned port = hw->port;
1663 int tmp, i;
1664
1665 if (!detect_s508(port))
1666 return -ENODEV;
1667
1668 /* Verify configuration options */
1669 i = get_option_index(s508_dpmbase_options, virt_to_phys(hw->dpmbase));
1670 if (i == 0)
1671 return -EINVAL;
1672
1673 /* Setup memory configuration */
1674 tmp = s508_hmcr[i - 1];
1675 _OUTB(port + 1, tmp);
1676 hw->regs[1] = tmp;
1677
1678 /* Enable memory access */
1679 _OUTB(port, 0x04);
1680 hw->regs[0] = 0x04; /* update mirror */
1681 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1682 return (_INB(port + 1) & 0x04) ? 0 : -EIO;
1683}
1684
1685/*============================================================================
1686 * Detect S502A adapter.
1687 * Following tests are used to detect S502A adapter:
1688 * 1. All registers other than status (BASE) should read 0xFF
1689 * 2. After writing 00001000b to control register, status register should
1690 * read 01000000b.
1691 * 3. After writing 0 to control register, status register should still
1692 * read 01000000b.
1693 * 4. After writing 00000100b to control register, status register should
1694 * read 01000100b.
1695 * Return 1 if detected o.k. or 0 if failed.
1696 * Note: This test is destructive! Adapter will be left in shutdown
1697 * state after the test.
1698 */
1699static int detect_s502a (int port)
1700{
1701 int i, j;
1702
1703 if (!get_option_index(s502_port_options, port))
1704 return 0;
1705
1706 for (j = 1; j < SDLA_MAXIORANGE; ++j) {
1707 if (_INB(port + j) != 0xFF)
1708 return 0;
1709 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1710 }
1711
1712 _OUTB(port, 0x08); /* halt CPU */
1713 _OUTB(port, 0x08);
1714 _OUTB(port, 0x08);
1715 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1716 if (_INB(port) != 0x40)
1717 return 0;
1718 _OUTB(port, 0x00);
1719 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1720 if (_INB(port) != 0x40)
1721 return 0;
1722 _OUTB(port, 0x04);
1723 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1724 if (_INB(port) != 0x44)
1725 return 0;
1726
1727 /* Reset adapter */
1728 _OUTB(port, 0x08);
1729 _OUTB(port, 0x08);
1730 _OUTB(port, 0x08);
1731 _OUTB(port + 1, 0xFF);
1732 return 1;
1733}
1734
1735/*============================================================================
1736 * Detect S502E adapter.
1737 * Following tests are used to verify adapter presence:
1738 * 1. All registers other than status (BASE) should read 0xFF.
1739 * 2. After writing 0 to CPU control register (BASE+3), status register
1740 * (BASE) should read 11111000b.
1741 * 3. After writing 00000100b to port BASE (set bit 2), status register
1742 * (BASE) should read 11111100b.
1743 * Return 1 if detected o.k. or 0 if failed.
1744 * Note: This test is destructive! Adapter will be left in shutdown
1745 * state after the test.
1746 */
1747static int detect_s502e (int port)
1748{
1749 int i, j;
1750
1751 if (!get_option_index(s502_port_options, port))
1752 return 0;
1753 for (j = 1; j < SDLA_MAXIORANGE; ++j) {
1754 if (_INB(port + j) != 0xFF)
1755 return 0;
1756 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1757 }
1758
1759 _OUTB(port + 3, 0); /* CPU control reg. */
1760 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1761 if (_INB(port) != 0xF8) /* read status */
1762 return 0;
1763 _OUTB(port, 0x04); /* set bit 2 */
1764 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1765 if (_INB(port) != 0xFC) /* verify */
1766 return 0;
1767
1768 /* Reset adapter */
1769 _OUTB(port, 0);
1770 return 1;
1771}
1772
1773/*============================================================================
1774 * Detect s503 adapter.
1775 * Following tests are used to verify adapter presence:
1776 * 1. All registers other than status (BASE) should read 0xFF.
1777 * 2. After writing 0 to control register (BASE), status register (BASE)
1778 * should read 11110000b.
1779 * 3. After writing 00000100b (set bit 2) to control register (BASE),
1780 * status register should read 11110010b.
1781 * Return 1 if detected o.k. or 0 if failed.
1782 * Note: This test is destructive! Adapter will be left in shutdown
1783 * state after the test.
1784 */
1785static int detect_s503 (int port)
1786{
1787 int i, j;
1788
1789 if (!get_option_index(s503_port_options, port))
1790 return 0;
1791 for (j = 1; j < SDLA_MAXIORANGE; ++j) {
1792 if (_INB(port + j) != 0xFF)
1793 return 0;
1794 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1795 }
1796
1797 _OUTB(port, 0); /* reset control reg.*/
1798 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1799 if (_INB(port) != 0xF0) /* read status */
1800 return 0;
1801 _OUTB(port, 0x04); /* set bit 2 */
1802 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1803 if (_INB(port) != 0xF2) /* verify */
1804 return 0;
1805
1806 /* Reset adapter */
1807 _OUTB(port, 0);
1808 return 1;
1809}
1810
1811/*============================================================================
1812 * Detect s507 adapter.
1813 * Following tests are used to detect s507 adapter:
1814 * 1. All ports should read the same value.
1815 * 2. After writing 0x00 to control register, status register should read
1816 * ?011000?b.
1817 * 3. After writing 0x01 to control register, status register should read
1818 * ?011001?b.
1819 * Return 1 if detected o.k. or 0 if failed.
1820 * Note: This test is destructive! Adapter will be left in shutdown
1821 * state after the test.
1822 */
1823static int detect_s507 (int port)
1824{
1825 int tmp, i, j;
1826
1827 if (!get_option_index(s508_port_options, port))
1828 return 0;
1829 tmp = _INB(port);
1830 for (j = 1; j < S507_IORANGE; ++j) {
1831 if (_INB(port + j) != tmp)
1832 return 0;
1833 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1834 }
1835
1836 _OUTB(port, 0x00);
1837 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1838 if ((_INB(port) & 0x7E) != 0x30)
1839 return 0;
1840 _OUTB(port, 0x01);
1841 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1842 if ((_INB(port) & 0x7E) != 0x32)
1843 return 0;
1844
1845 /* Reset adapter */
1846 _OUTB(port, 0x00);
1847 return 1;
1848}
1849
1850/*============================================================================
1851 * Detect s508 adapter.
1852 * Following tests are used to detect s508 adapter:
1853 * 1. After writing 0x00 to control register, status register should read
1854 * ??000000b.
1855 * 2. After writing 0x10 to control register, status register should read
1856 * ??010000b
1857 * Return 1 if detected o.k. or 0 if failed.
1858 * Note: This test is destructive! Adapter will be left in shutdown
1859 * state after the test.
1860 */
1861static int detect_s508 (int port)
1862{
1863 int i;
1864
1865 if (!get_option_index(s508_port_options, port))
1866 return 0;
1867 _OUTB(port, 0x00);
1868 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1869 if ((_INB(port + 1) & 0x3F) != 0x00)
1870 return 0;
1871 _OUTB(port, 0x10);
1872 for (i = 0; i < SDLA_IODELAY; ++i); /* delay */
1873 if ((_INB(port + 1) & 0x3F) != 0x10)
1874 return 0;
1875
1876 /* Reset adapter */
1877 _OUTB(port, 0x00);
1878 return 1;
1879}
1880
1881/*============================================================================
1882 * Detect s514 PCI adapter.
1883 * Return 1 if detected o.k. or 0 if failed.
1884 * Note: This test is destructive! Adapter will be left in shutdown
1885 * state after the test.
1886 */
1887static int detect_s514 (sdlahw_t* hw)
1888{
1889 unsigned char CPU_no, slot_no, auto_slot_cfg;
1890 int number_S514_cards = 0;
1891 u32 S514_mem_base_addr = 0;
1892 u32 ut_u32;
1893 struct pci_dev *pci_dev;
1894
1895
1896#ifndef CONFIG_PCI
1897 printk(KERN_INFO "%s: Linux not compiled for PCI usage!\n", modname);
1898 return 0;
1899#endif
1900
1901 /*
1902 The 'setup()' procedure in 'sdlamain.c' passes the CPU number and the
1903 slot number defined in 'router.conf' via the 'port' definition.
1904 */
1905 CPU_no = hw->S514_cpu_no[0];
1906 slot_no = hw->S514_slot_no;
1907 auto_slot_cfg = hw->auto_pci_cfg;
1908
1909 if (auto_slot_cfg){
1910 printk(KERN_INFO "%s: srch... S514 card, CPU %c, Slot=Auto\n",
1911 modname, CPU_no);
1912
1913 }else{
1914 printk(KERN_INFO "%s: srch... S514 card, CPU %c, Slot #%d\n",
1915 modname, CPU_no, slot_no);
1916 }
1917
1918 /* check to see that CPU A or B has been selected in 'router.conf' */
1919 switch(CPU_no) {
1920 case S514_CPU_A:
1921 case S514_CPU_B:
1922 break;
1923
1924 default:
1925 printk(KERN_INFO "%s: S514 CPU definition invalid.\n",
1926 modname);
1927 printk(KERN_INFO "Must be 'A' or 'B'\n");
1928 return 0;
1929 }
1930
1931 number_S514_cards = find_s514_adapter(hw, 0);
1932 if(!number_S514_cards)
1933 return 0;
1934
1935 /* we are using a single S514 adapter with a slot of 0 so re-read the */
1936 /* location of this adapter */
1937 if((number_S514_cards == 1) && auto_slot_cfg) {
1938 number_S514_cards = find_s514_adapter(hw, 1);
1939 if(!number_S514_cards) {
1940 printk(KERN_INFO "%s: Error finding PCI card\n",
1941 modname);
1942 return 0;
1943 }
1944 }
1945
1946 pci_dev = hw->pci_dev;
1947 /* read the physical memory base address */
1948 S514_mem_base_addr = (CPU_no == S514_CPU_A) ?
1949 (pci_dev->resource[1].start) :
1950 (pci_dev->resource[2].start);
1951
1952 printk(KERN_INFO "%s: S514 PCI memory at 0x%X\n",
1953 modname, S514_mem_base_addr);
1954 if(!S514_mem_base_addr) {
1955 if(CPU_no == S514_CPU_B)
1956 printk(KERN_INFO "%s: CPU #B not present on the card\n", modname);
1957 else
1958 printk(KERN_INFO "%s: No PCI memory allocated to card\n", modname);
1959 return 0;
1960 }
1961
1962 /* enable the PCI memory */
1963 pci_read_config_dword(pci_dev,
1964 (CPU_no == S514_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD,
1965 &ut_u32);
1966 pci_write_config_dword(pci_dev,
1967 (CPU_no == S514_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD,
1968 (ut_u32 | PCI_MEMORY_ENABLE));
1969
1970 /* check the IRQ allocated and enable IRQ usage */
1971 if(!(hw->irq = pci_dev->irq)) {
1972 printk(KERN_INFO "%s: IRQ not allocated to S514 adapter\n",
1973 modname);
1974 return 0;
1975 }
1976
1977 /* BUG FIX : Mar 6 2000
1978 * On a initial loading of the card, we must check
1979 * and clear PCI interrupt bits, due to a reset
1980 * problem on some other boards. i.e. An interrupt
1981 * might be pending, even after system bootup,
1982 * in which case, when starting wanrouter the machine
1983 * would crash.
1984 */
1985 if (init_pci_slot(hw))
1986 return 0;
1987
1988 pci_read_config_dword(pci_dev, PCI_INT_CONFIG, &ut_u32);
1989 ut_u32 |= (CPU_no == S514_CPU_A) ?
1990 PCI_ENABLE_IRQ_CPU_A : PCI_ENABLE_IRQ_CPU_B;
1991 pci_write_config_dword(pci_dev, PCI_INT_CONFIG, ut_u32);
1992
1993 printk(KERN_INFO "%s: IRQ %d allocated to the S514 card\n",
1994 modname, hw->irq);
1995
1996 /* map the physical PCI memory to virtual memory */
1997 hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr,
1998 (unsigned long)MAX_SIZEOF_S514_MEMORY);
1999 /* map the physical control register memory to virtual memory */
2000 hw->vector = (unsigned long)ioremap(
2001 (unsigned long)(S514_mem_base_addr + S514_CTRL_REG_BYTE),
2002 (unsigned long)16);
2003
2004 if(!hw->dpmbase || !hw->vector) {
2005 printk(KERN_INFO "%s: PCI virtual memory allocation failed\n",
2006 modname);
2007 return 0;
2008 }
2009
2010 /* halt the adapter */
2011 writeb (S514_CPU_HALT, hw->vector);
2012
2013 return 1;
2014}
2015
2016/*============================================================================
2017 * Find the S514 PCI adapter in the PCI bus.
2018 * Return the number of S514 adapters found (0 if no adapter found).
2019 */
2020static int find_s514_adapter(sdlahw_t* hw, char find_first_S514_card)
2021{
2022 unsigned char slot_no;
2023 int number_S514_cards = 0;
2024 char S514_found_in_slot = 0;
2025 u16 PCI_subsys_vendor;
2026
2027 struct pci_dev *pci_dev = NULL;
2028
2029 slot_no = hw->S514_slot_no;
2030
2031 while ((pci_dev = pci_find_device(V3_VENDOR_ID, V3_DEVICE_ID, pci_dev))
2032 != NULL) {
2033
2034 pci_read_config_word(pci_dev, PCI_SUBSYS_VENDOR_WORD,
2035 &PCI_subsys_vendor);
2036
2037 if(PCI_subsys_vendor != SANGOMA_SUBSYS_VENDOR)
2038 continue;
2039
2040 hw->pci_dev = pci_dev;
2041
2042 if(find_first_S514_card)
2043 return(1);
2044
2045 number_S514_cards ++;
2046
2047 printk(KERN_INFO
2048 "%s: S514 card found, slot #%d (devfn 0x%X)\n",
2049 modname, ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK),
2050 pci_dev->devfn);
2051
2052 if (hw->auto_pci_cfg){
2053 hw->S514_slot_no = ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK);
2054 slot_no = hw->S514_slot_no;
2055
2056 }else if (((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK) == slot_no){
2057 S514_found_in_slot = 1;
2058 break;
2059 }
2060 }
2061
2062 /* if no S514 adapter has been found, then exit */
2063 if (!number_S514_cards) {
2064 printk(KERN_INFO "%s: Error, no S514 adapters found\n", modname);
2065 return 0;
2066 }
2067 /* if more than one S514 card has been found, then the user must have */ /* defined a slot number so that the correct adapter is used */
2068 else if ((number_S514_cards > 1) && hw->auto_pci_cfg) {
2069 printk(KERN_INFO "%s: Error, PCI Slot autodetect Failed! \n"
2070 "%s: More than one S514 adapter found.\n"
2071 "%s: Disable the Autodetect feature and supply\n"
2072 "%s: the PCISLOT numbers for each card.\n",
2073 modname,modname,modname,modname);
2074 return 0;
2075 }
2076 /* if the user has specified a slot number and the S514 adapter has */
2077 /* not been found in that slot, then exit */
2078 else if (!hw->auto_pci_cfg && !S514_found_in_slot) {
2079 printk(KERN_INFO
2080 "%s: Error, S514 card not found in specified slot #%d\n",
2081 modname, slot_no);
2082 return 0;
2083 }
2084
2085 return (number_S514_cards);
2086}
2087
2088
2089
2090/******* Miscellaneous ******************************************************/
2091
2092/*============================================================================
2093 * Calibrate SDLA memory access delay.
2094 * Count number of idle loops made within 1 second and then calculate the
2095 * number of loops that should be made to achive desired delay.
2096 */
2097static int calibrate_delay (int mks)
2098{
2099 unsigned int delay;
2100 unsigned long stop;
2101
2102 for (delay = 0, stop = SYSTEM_TICK + HZ; SYSTEM_TICK < stop; ++delay);
2103 return (delay/(1000000L/mks) + 1);
2104}
2105
2106/*============================================================================
2107 * Get option's index into the options list.
2108 * Return option's index (1 .. N) or zero if option is invalid.
2109 */
2110static int get_option_index (unsigned* optlist, unsigned optval)
2111{
2112 int i;
2113
2114 for (i = 1; i <= optlist[0]; ++i)
2115 if ( optlist[i] == optval)
2116 return i;
2117 return 0;
2118}
2119
2120/*============================================================================
2121 * Check memory region to see if it's available.
2122 * Return: 0 ok.
2123 */
2124static unsigned check_memregion (void* ptr, unsigned len)
2125{
2126 volatile unsigned char* p = ptr;
2127
2128 for (; len && (readb (p) == 0xFF); --len, ++p) {
2129 writeb (0, p); /* attempt to write 0 */
2130 if (readb(p) != 0xFF) { /* still has to read 0xFF */
2131 writeb (0xFF, p);/* restore original value */
2132 break; /* not good */
2133 }
2134 }
2135
2136 return len;
2137}
2138
2139/*============================================================================
2140 * Test memory region.
2141 * Return: size of the region that passed the test.
2142 * Note: Region size must be multiple of 2 !
2143 */
2144static unsigned test_memregion (void* ptr, unsigned len)
2145{
2146 volatile unsigned short* w_ptr;
2147 unsigned len_w = len >> 1; /* region len in words */
2148 unsigned i;
2149
2150 for (i = 0, w_ptr = ptr; i < len_w; ++i, ++w_ptr)
2151 writew (0xAA55, w_ptr);
2152
2153 for (i = 0, w_ptr = ptr; i < len_w; ++i, ++w_ptr)
2154 if (readw (w_ptr) != 0xAA55) {
2155 len_w = i;
2156 break;
2157 }
2158
2159 for (i = 0, w_ptr = ptr; i < len_w; ++i, ++w_ptr)
2160 writew (0x55AA, w_ptr);
2161
2162 for (i = 0, w_ptr = ptr; i < len_w; ++i, ++w_ptr)
2163 if (readw(w_ptr) != 0x55AA) {
2164 len_w = i;
2165 break;
2166 }
2167
2168 for (i = 0, w_ptr = ptr; i < len_w; ++i, ++w_ptr)
2169 writew (0, w_ptr);
2170
2171 return len_w << 1;
2172}
2173
2174/*============================================================================
2175 * Calculate 16-bit CRC using CCITT polynomial.
2176 */
2177static unsigned short checksum (unsigned char* buf, unsigned len)
2178{
2179 unsigned short crc = 0;
2180 unsigned mask, flag;
2181
2182 for (; len; --len, ++buf) {
2183 for (mask = 0x80; mask; mask >>= 1) {
2184 flag = (crc & 0x8000);
2185 crc <<= 1;
2186 crc |= ((*buf & mask) ? 1 : 0);
2187 if (flag) crc ^= 0x1021;
2188 }
2189 }
2190 return crc;
2191}
2192
2193static int init_pci_slot(sdlahw_t *hw)
2194{
2195
2196 u32 int_status;
2197 int volatile found=0;
2198 int i=0;
2199
2200 /* Check if this is a very first load for a specific
2201 * pci card. If it is, clear the interrput bits, and
2202 * set the flag indicating that this card was initialized.
2203 */
2204
2205 for (i=0; (i<MAX_S514_CARDS) && !found; i++){
2206 if (pci_slot_ar[i] == hw->S514_slot_no){
2207 found=1;
2208 break;
2209 }
2210 if (pci_slot_ar[i] == 0xFF){
2211 break;
2212 }
2213 }
2214
2215 if (!found){
2216 read_S514_int_stat(hw,&int_status);
2217 S514_intack(hw,int_status);
2218 if (i == MAX_S514_CARDS){
2219 printk(KERN_INFO "%s: Critical Error !!!\n",modname);
2220 printk(KERN_INFO
2221 "%s: Number of Sangoma PCI cards exceeded maximum limit.\n",
2222 modname);
2223 printk(KERN_INFO "Please contact Sangoma Technologies\n");
2224 return 1;
2225 }
2226 pci_slot_ar[i] = hw->S514_slot_no;
2227 }
2228 return 0;
2229}
2230
2231static int pci_probe(sdlahw_t *hw)
2232{
2233
2234 unsigned char slot_no;
2235 int number_S514_cards = 0;
2236 u16 PCI_subsys_vendor;
2237 u16 PCI_card_type;
2238
2239 struct pci_dev *pci_dev = NULL;
2240 struct pci_bus *bus = NULL;
2241
2242 slot_no = 0;
2243
2244 while ((pci_dev = pci_find_device(V3_VENDOR_ID, V3_DEVICE_ID, pci_dev))
2245 != NULL) {
2246
2247 pci_read_config_word(pci_dev, PCI_SUBSYS_VENDOR_WORD,
2248 &PCI_subsys_vendor);
2249
2250 if(PCI_subsys_vendor != SANGOMA_SUBSYS_VENDOR)
2251 continue;
2252
2253 pci_read_config_word(pci_dev, PCI_CARD_TYPE,
2254 &PCI_card_type);
2255
2256 bus = pci_dev->bus;
2257
2258 /* A dual cpu card can support up to 4 physical connections,
2259 * where a single cpu card can support up to 2 physical
2260 * connections. The FT1 card can only support a single
2261 * connection, however we cannot distinguish between a Single
2262 * CPU card and an FT1 card. */
2263 if (PCI_card_type == S514_DUAL_CPU){
2264 number_S514_cards += 4;
2265 printk(KERN_INFO
2266 "wanpipe: S514-PCI card found, cpu(s) 2, bus #%d, slot #%d, irq #%d\n",
2267 bus->number,((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK),
2268 pci_dev->irq);
2269 }else{
2270 number_S514_cards += 2;
2271 printk(KERN_INFO
2272 "wanpipe: S514-PCI card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n",
2273 bus->number,((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK),
2274 pci_dev->irq);
2275 }
2276 }
2277
2278 return number_S514_cards;
2279
2280}
2281
2282
2283
2284EXPORT_SYMBOL(wanpipe_hw_probe);
2285
2286unsigned wanpipe_hw_probe(void)
2287{
2288 sdlahw_t hw;
2289 unsigned* opt = s508_port_options;
2290 unsigned cardno=0;
2291 int i;
2292
2293 memset(&hw, 0, sizeof(hw));
2294
2295 for (i = 1; i <= opt[0]; i++) {
2296 if (detect_s508(opt[i])){
2297 /* S508 card can support up to two physical links */
2298 cardno+=2;
2299 printk(KERN_INFO "wanpipe: S508-ISA card found, port 0x%x\n",opt[i]);
2300 }
2301 }
2302
2303 #ifdef CONFIG_PCI
2304 hw.S514_slot_no = 0;
2305 cardno += pci_probe(&hw);
2306 #else
2307 printk(KERN_INFO "wanpipe: Warning, Kernel not compiled for PCI support!\n");
2308 printk(KERN_INFO "wanpipe: PCI Hardware Probe Failed!\n");
2309 #endif
2310
2311 return cardno;
2312}
2313
2314/****** End *****************************************************************/
diff --git a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c
deleted file mode 100644
index 7a8b22a7ea31..000000000000
--- a/drivers/net/wan/sdlamain.c
+++ /dev/null
@@ -1,1346 +0,0 @@
1/****************************************************************************
2* sdlamain.c WANPIPE(tm) Multiprotocol WAN Link Driver. Main module.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5* Gideon Hack
6*
7* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Dec 22, 2000 Nenad Corbic Updated for 2.4.X kernels.
15* Removed the polling routine.
16* Nov 13, 2000 Nenad Corbic Added hw probing on module load and dynamic
17* device allocation.
18* Nov 7, 2000 Nenad Corbic Fixed the Multi-Port PPP for kernels
19* 2.2.16 and above.
20* Aug 2, 2000 Nenad Corbic Block the Multi-Port PPP from running on
21* kernels 2.2.16 or greater. The SyncPPP
22* has changed.
23* Jul 25, 2000 Nenad Corbic Updated the Piggiback support for MultPPPP.
24* Jul 13, 2000 Nenad Corbic Added Multi-PPP support.
25* Feb 02, 2000 Nenad Corbic Fixed up piggyback probing and selection.
26* Sep 23, 1999 Nenad Corbic Added support for SMP
27* Sep 13, 1999 Nenad Corbic Each port is treated as a separate device.
28* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
29* Updates for Linux 2.2.X kernels.
30* Sep 17, 1998 Jaspreet Singh Updated for 2.1.121+ kernel
31* Nov 28, 1997 Jaspreet Singh Changed DRV_RELEASE to 1
32* Nov 10, 1997 Jaspreet Singh Changed sti() to restore_flags();
33* Nov 06, 1997 Jaspreet Singh Changed DRV_VERSION to 4 and DRV_RELEASE to 0
34* Oct 20, 1997 Jaspreet Singh Modified sdla_isr routine so that card->in_isr
35* assignments are taken out and placed in the
36* sdla_ppp.c, sdla_fr.c and sdla_x25.c isr
37* routines. Took out 'wandev->tx_int_enabled' and
38* replaced it with 'wandev->enable_tx_int'.
39* May 29, 1997 Jaspreet Singh Flow Control Problem
40* added "wandev->tx_int_enabled=1" line in the
41* init module. This line initializes the flag for
42* preventing Interrupt disabled with device set to
43* busy
44* Jan 15, 1997 Gene Kozin Version 3.1.0
45* o added UDP management stuff
46* Jan 02, 1997 Gene Kozin Initial version.
47*****************************************************************************/
48
49#include <linux/config.h> /* OS configuration options */
50#include <linux/stddef.h> /* offsetof(), etc. */
51#include <linux/errno.h> /* return codes */
52#include <linux/string.h> /* inline memset(), etc. */
53#include <linux/init.h>
54#include <linux/slab.h> /* kmalloc(), kfree() */
55#include <linux/kernel.h> /* printk(), and other useful stuff */
56#include <linux/module.h> /* support for loadable modules */
57#include <linux/ioport.h> /* request_region(), release_region() */
58#include <linux/wanrouter.h> /* WAN router definitions */
59#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
60#include <linux/rcupdate.h>
61
62#include <linux/in.h>
63#include <asm/io.h> /* phys_to_virt() */
64#include <linux/pci.h>
65#include <linux/sdlapci.h>
66#include <linux/if_wanpipe_common.h>
67
68#include <asm/uaccess.h> /* kernel <-> user copy */
69#include <linux/inetdevice.h>
70
71#include <linux/ip.h>
72#include <net/route.h>
73
74#define KMEM_SAFETYZONE 8
75
76
77#ifndef CONFIG_WANPIPE_FR
78 #define wpf_init(a,b) (-EPROTONOSUPPORT)
79#endif
80
81#ifndef CONFIG_WANPIPE_CHDLC
82 #define wpc_init(a,b) (-EPROTONOSUPPORT)
83#endif
84
85#ifndef CONFIG_WANPIPE_X25
86 #define wpx_init(a,b) (-EPROTONOSUPPORT)
87#endif
88
89#ifndef CONFIG_WANPIPE_PPP
90 #define wpp_init(a,b) (-EPROTONOSUPPORT)
91#endif
92
93#ifndef CONFIG_WANPIPE_MULTPPP
94 #define wsppp_init(a,b) (-EPROTONOSUPPORT)
95#endif
96
97
98/***********FOR DEBUGGING PURPOSES*********************************************
99static void * dbg_kmalloc(unsigned int size, int prio, int line) {
100 int i = 0;
101 void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio);
102 char * c1 = v;
103 c1 += sizeof(unsigned int);
104 *((unsigned int *)v) = size;
105
106 for (i = 0; i < KMEM_SAFETYZONE; i++) {
107 c1[0] = 'D'; c1[1] = 'E'; c1[2] = 'A'; c1[3] = 'D';
108 c1[4] = 'B'; c1[5] = 'E'; c1[6] = 'E'; c1[7] = 'F';
109 c1 += 8;
110 }
111 c1 += size;
112 for (i = 0; i < KMEM_SAFETYZONE; i++) {
113 c1[0] = 'M'; c1[1] = 'U'; c1[2] = 'N'; c1[3] = 'G';
114 c1[4] = 'W'; c1[5] = 'A'; c1[6] = 'L'; c1[7] = 'L';
115 c1 += 8;
116 }
117 v = ((char *)v) + sizeof(unsigned int) + KMEM_SAFETYZONE*8;
118 printk(KERN_INFO "line %d kmalloc(%d,%d) = %p\n",line,size,prio,v);
119 return v;
120}
121static void dbg_kfree(void * v, int line) {
122 unsigned int * sp = (unsigned int *)(((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8));
123 unsigned int size = *sp;
124 char * c1 = ((char *)v) - KMEM_SAFETYZONE*8;
125 int i = 0;
126 for (i = 0; i < KMEM_SAFETYZONE; i++) {
127 if ( c1[0] != 'D' || c1[1] != 'E' || c1[2] != 'A' || c1[3] != 'D'
128 || c1[4] != 'B' || c1[5] != 'E' || c1[6] != 'E' || c1[7] != 'F') {
129 printk(KERN_INFO "kmalloced block at %p has been corrupted (underrun)!\n",v);
130 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
131 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
132 }
133 c1 += 8;
134 }
135 c1 += size;
136 for (i = 0; i < KMEM_SAFETYZONE; i++) {
137 if ( c1[0] != 'M' || c1[1] != 'U' || c1[2] != 'N' || c1[3] != 'G'
138 || c1[4] != 'W' || c1[5] != 'A' || c1[6] != 'L' || c1[7] != 'L'
139 ) {
140 printk(KERN_INFO "kmalloced block at %p has been corrupted (overrun):\n",v);
141 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
142 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
143 }
144 c1 += 8;
145 }
146 printk(KERN_INFO "line %d kfree(%p)\n",line,v);
147 v = ((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8);
148 kfree(v);
149}
150
151#define kmalloc(x,y) dbg_kmalloc(x,y,__LINE__)
152#define kfree(x) dbg_kfree(x,__LINE__)
153******************************************************************************/
154
155
156
157/****** Defines & Macros ****************************************************/
158
159#ifdef _DEBUG_
160#define STATIC
161#else
162#define STATIC static
163#endif
164
165#define DRV_VERSION 5 /* version number */
166#define DRV_RELEASE 0 /* release (minor version) number */
167#define MAX_CARDS 16 /* max number of adapters */
168
169#ifndef CONFIG_WANPIPE_CARDS /* configurable option */
170#define CONFIG_WANPIPE_CARDS 1
171#endif
172
173#define CMD_OK 0 /* normal firmware return code */
174#define CMD_TIMEOUT 0xFF /* firmware command timed out */
175#define MAX_CMD_RETRY 10 /* max number of firmware retries */
176/****** Function Prototypes *************************************************/
177
178extern void disable_irq(unsigned int);
179extern void enable_irq(unsigned int);
180
181/* WAN link driver entry points */
182static int setup(struct wan_device* wandev, wandev_conf_t* conf);
183static int shutdown(struct wan_device* wandev);
184static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg);
185
186/* IOCTL handlers */
187static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump);
188static int ioctl_exec (sdla_t* card, sdla_exec_t* u_exec, int);
189
190/* Miscellaneous functions */
191STATIC irqreturn_t sdla_isr (int irq, void* dev_id, struct pt_regs *regs);
192static void release_hw (sdla_t *card);
193
194static int check_s508_conflicts (sdla_t* card,wandev_conf_t* conf, int*);
195static int check_s514_conflicts (sdla_t* card,wandev_conf_t* conf, int*);
196
197
198/****** Global Data **********************************************************
199 * Note: All data must be explicitly initialized!!!
200 */
201
202/* private data */
203static char drvname[] = "wanpipe";
204static char fullname[] = "WANPIPE(tm) Multiprotocol Driver";
205static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc.";
206static int ncards;
207static sdla_t* card_array; /* adapter data space */
208
209/* Wanpipe's own workqueue, used for all API's.
210 * All protocol specific tasks will be inserted
211 * into the "wanpipe_wq" workqueue.
212
213 * The kernel workqueue mechanism will execute
214 * all pending tasks in the "wanpipe_wq" workqueue.
215 */
216
217struct workqueue_struct *wanpipe_wq;
218DECLARE_WORK(wanpipe_work, NULL, NULL);
219
220static int wanpipe_bh_critical;
221
222/******* Kernel Loadable Module Entry Points ********************************/
223
224/*============================================================================
225 * Module 'insert' entry point.
226 * o print announcement
227 * o allocate adapter data space
228 * o initialize static data
229 * o register all cards with WAN router
230 * o calibrate SDLA shared memory access delay.
231 *
232 * Return: 0 Ok
233 * < 0 error.
234 * Context: process
235 */
236
237static int __init wanpipe_init(void)
238{
239 int cnt, err = 0;
240
241 printk(KERN_INFO "%s v%u.%u %s\n",
242 fullname, DRV_VERSION, DRV_RELEASE, copyright);
243
244 wanpipe_wq = create_workqueue("wanpipe_wq");
245 if (!wanpipe_wq)
246 return -ENOMEM;
247
248 /* Probe for wanpipe cards and return the number found */
249 printk(KERN_INFO "wanpipe: Probing for WANPIPE hardware.\n");
250 ncards = wanpipe_hw_probe();
251 if (ncards){
252 printk(KERN_INFO "wanpipe: Allocating maximum %i devices: wanpipe%i - wanpipe%i.\n",ncards,1,ncards);
253 }else{
254 printk(KERN_INFO "wanpipe: No S514/S508 cards found, unloading modules!\n");
255 destroy_workqueue(wanpipe_wq);
256 return -ENODEV;
257 }
258
259 /* Verify number of cards and allocate adapter data space */
260 card_array = kmalloc(sizeof(sdla_t) * ncards, GFP_KERNEL);
261 if (card_array == NULL) {
262 destroy_workqueue(wanpipe_wq);
263 return -ENOMEM;
264 }
265
266 memset(card_array, 0, sizeof(sdla_t) * ncards);
267
268 /* Register adapters with WAN router */
269 for (cnt = 0; cnt < ncards; ++ cnt) {
270 sdla_t* card = &card_array[cnt];
271 struct wan_device* wandev = &card->wandev;
272
273 card->next = NULL;
274 sprintf(card->devname, "%s%d", drvname, cnt + 1);
275 wandev->magic = ROUTER_MAGIC;
276 wandev->name = card->devname;
277 wandev->private = card;
278 wandev->enable_tx_int = 0;
279 wandev->setup = &setup;
280 wandev->shutdown = &shutdown;
281 wandev->ioctl = &ioctl;
282 err = register_wan_device(wandev);
283 if (err) {
284 printk(KERN_INFO
285 "%s: %s registration failed with error %d!\n",
286 drvname, card->devname, err);
287 break;
288 }
289 }
290 if (cnt){
291 ncards = cnt; /* adjust actual number of cards */
292 }else {
293 kfree(card_array);
294 destroy_workqueue(wanpipe_wq);
295 printk(KERN_INFO "IN Init Module: NO Cards registered\n");
296 err = -ENODEV;
297 }
298
299 return err;
300}
301
302/*============================================================================
303 * Module 'remove' entry point.
304 * o unregister all adapters from the WAN router
305 * o release all remaining system resources
306 */
307static void __exit wanpipe_cleanup(void)
308{
309 int i;
310
311 if (!ncards)
312 return;
313
314 for (i = 0; i < ncards; ++i) {
315 sdla_t* card = &card_array[i];
316 unregister_wan_device(card->devname);
317 }
318 destroy_workqueue(wanpipe_wq);
319 kfree(card_array);
320
321 printk(KERN_INFO "\nwanpipe: WANPIPE Modules Unloaded.\n");
322}
323
324module_init(wanpipe_init);
325module_exit(wanpipe_cleanup);
326
327/******* WAN Device Driver Entry Points *************************************/
328
329/*============================================================================
330 * Setup/configure WAN link driver.
331 * o check adapter state
332 * o make sure firmware is present in configuration
333 * o make sure I/O port and IRQ are specified
334 * o make sure I/O region is available
335 * o allocate interrupt vector
336 * o setup SDLA hardware
337 * o call appropriate routine to perform protocol-specific initialization
338 * o mark I/O region as used
339 * o if this is the first active card, then schedule background task
340 *
341 * This function is called when router handles ROUTER_SETUP IOCTL. The
342 * configuration structure is in kernel memory (including extended data, if
343 * any).
344 */
345
346static int setup(struct wan_device* wandev, wandev_conf_t* conf)
347{
348 sdla_t* card;
349 int err = 0;
350 int irq=0;
351
352 /* Sanity checks */
353 if ((wandev == NULL) || (wandev->private == NULL) || (conf == NULL)){
354 printk(KERN_INFO
355 "%s: Failed Sdlamain Setup wandev %u, card %u, conf %u !\n",
356 wandev->name,
357 (unsigned int)wandev,(unsigned int)wandev->private,
358 (unsigned int)conf);
359 return -EFAULT;
360 }
361
362 printk(KERN_INFO "%s: Starting WAN Setup\n", wandev->name);
363
364 card = wandev->private;
365 if (wandev->state != WAN_UNCONFIGURED){
366 printk(KERN_INFO "%s: failed sdlamain setup, busy!\n",
367 wandev->name);
368 return -EBUSY; /* already configured */
369 }
370
371 printk(KERN_INFO "\nProcessing WAN device %s...\n", wandev->name);
372
373 /* Initialize the counters for each wandev
374 * Used for counting number of times new_if and
375 * del_if get called.
376 */
377 wandev->del_if_cnt = 0;
378 wandev->new_if_cnt = 0;
379 wandev->config_id = conf->config_id;
380
381 if (!conf->data_size || (conf->data == NULL)) {
382 printk(KERN_INFO
383 "%s: firmware not found in configuration data!\n",
384 wandev->name);
385 return -EINVAL;
386 }
387
388 /* Check for resource conflicts and setup the
389 * card for piggibacking if necessary */
390 if(!conf->S514_CPU_no[0]) {
391 if ((err=check_s508_conflicts(card,conf,&irq)) != 0){
392 return err;
393 }
394 }else {
395 if ((err=check_s514_conflicts(card,conf,&irq)) != 0){
396 return err;
397 }
398 }
399
400 /* If the current card has already been configured
401 * or it's a piggyback card, do not try to allocate
402 * resources.
403 */
404 if (!card->wandev.piggyback && !card->configured){
405
406 /* Configure hardware, load firmware, etc. */
407 memset(&card->hw, 0, sizeof(sdlahw_t));
408
409 /* for an S514 adapter, pass the CPU number and the slot number read */
410 /* from 'router.conf' to the 'sdla_setup()' function via the 'port' */
411 /* parameter */
412 if (conf->S514_CPU_no[0]){
413
414 card->hw.S514_cpu_no[0] = conf->S514_CPU_no[0];
415 card->hw.S514_slot_no = conf->PCI_slot_no;
416 card->hw.auto_pci_cfg = conf->auto_pci_cfg;
417
418 if (card->hw.auto_pci_cfg == WANOPT_YES){
419 printk(KERN_INFO "%s: Setting CPU to %c and Slot to Auto\n",
420 card->devname, card->hw.S514_cpu_no[0]);
421 }else{
422 printk(KERN_INFO "%s: Setting CPU to %c and Slot to %i\n",
423 card->devname, card->hw.S514_cpu_no[0], card->hw.S514_slot_no);
424 }
425
426 }else{
427 /* 508 Card io port and irq initialization */
428 card->hw.port = conf->ioport;
429 card->hw.irq = (conf->irq == 9) ? 2 : conf->irq;
430 }
431
432
433 /* Compute the virtual address of the card in kernel space */
434 if(conf->maddr){
435 card->hw.dpmbase = phys_to_virt(conf->maddr);
436 }else{
437 card->hw.dpmbase = (void *)conf->maddr;
438 }
439
440 card->hw.dpmsize = SDLA_WINDOWSIZE;
441
442 /* set the adapter type if using an S514 adapter */
443 card->hw.type = (conf->S514_CPU_no[0]) ? SDLA_S514 : conf->hw_opt[0];
444 card->hw.pclk = conf->hw_opt[1];
445
446 err = sdla_setup(&card->hw, conf->data, conf->data_size);
447 if (err){
448 printk(KERN_INFO "%s: Hardware setup Failed %i\n",
449 card->devname,err);
450 return err;
451 }
452
453 if(card->hw.type != SDLA_S514)
454 irq = (conf->irq == 2) ? 9 : conf->irq; /* IRQ2 -> IRQ9 */
455 else
456 irq = card->hw.irq;
457
458 /* request an interrupt vector - note that interrupts may be shared */
459 /* when using the S514 PCI adapter */
460
461 if(request_irq(irq, sdla_isr,
462 (card->hw.type == SDLA_S514) ? SA_SHIRQ : 0,
463 wandev->name, card)){
464
465 printk(KERN_INFO "%s: Can't reserve IRQ %d!\n", wandev->name, irq);
466 return -EINVAL;
467 }
468
469 }else{
470 printk(KERN_INFO "%s: Card Configured %lu or Piggybacking %i!\n",
471 wandev->name,card->configured,card->wandev.piggyback);
472 }
473
474
475 if (!card->configured){
476
477 /* Initialize the Spin lock */
478 printk(KERN_INFO "%s: Initializing for SMP\n",wandev->name);
479
480 /* Piggyback spin lock has already been initialized,
481 * in check_s514/s508_conflicts() */
482 if (!card->wandev.piggyback){
483 spin_lock_init(&card->wandev.lock);
484 }
485
486 /* Intialize WAN device data space */
487 wandev->irq = irq;
488 wandev->dma = 0;
489 if(card->hw.type != SDLA_S514){
490 wandev->ioport = card->hw.port;
491 }else{
492 wandev->S514_cpu_no[0] = card->hw.S514_cpu_no[0];
493 wandev->S514_slot_no = card->hw.S514_slot_no;
494 }
495 wandev->maddr = (unsigned long)card->hw.dpmbase;
496 wandev->msize = card->hw.dpmsize;
497 wandev->hw_opt[0] = card->hw.type;
498 wandev->hw_opt[1] = card->hw.pclk;
499 wandev->hw_opt[2] = card->hw.memory;
500 wandev->hw_opt[3] = card->hw.fwid;
501 }
502
503 /* Protocol-specific initialization */
504 switch (card->hw.fwid) {
505
506 case SFID_X25_502:
507 case SFID_X25_508:
508 printk(KERN_INFO "%s: Starting X.25 Protocol Init.\n",
509 card->devname);
510 err = wpx_init(card, conf);
511 break;
512 case SFID_FR502:
513 case SFID_FR508:
514 printk(KERN_INFO "%s: Starting Frame Relay Protocol Init.\n",
515 card->devname);
516 err = wpf_init(card, conf);
517 break;
518 case SFID_PPP502:
519 case SFID_PPP508:
520 printk(KERN_INFO "%s: Starting PPP Protocol Init.\n",
521 card->devname);
522 err = wpp_init(card, conf);
523 break;
524
525 case SFID_CHDLC508:
526 case SFID_CHDLC514:
527 if (conf->ft1){
528 printk(KERN_INFO "%s: Starting FT1 CSU/DSU Config Driver.\n",
529 card->devname);
530 err = wpft1_init(card, conf);
531 break;
532
533 }else if (conf->config_id == WANCONFIG_MPPP){
534 printk(KERN_INFO "%s: Starting Multi-Port PPP Protocol Init.\n",
535 card->devname);
536 err = wsppp_init(card,conf);
537 break;
538
539 }else{
540 printk(KERN_INFO "%s: Starting CHDLC Protocol Init.\n",
541 card->devname);
542 err = wpc_init(card, conf);
543 break;
544 }
545 default:
546 printk(KERN_INFO "%s: Error, Firmware is not supported %X %X!\n",
547 wandev->name,card->hw.fwid,SFID_CHDLC508);
548 err = -EPROTONOSUPPORT;
549 }
550
551 if (err != 0){
552 if (err == -EPROTONOSUPPORT){
553 printk(KERN_INFO
554 "%s: Error, Protocol selected has not been compiled!\n",
555 card->devname);
556 printk(KERN_INFO
557 "%s: Re-configure the kernel and re-build the modules!\n",
558 card->devname);
559 }
560
561 release_hw(card);
562 wandev->state = WAN_UNCONFIGURED;
563 return err;
564 }
565
566
567 /* Reserve I/O region and schedule background task */
568 if(card->hw.type != SDLA_S514 && !card->wandev.piggyback)
569 if (!request_region(card->hw.port, card->hw.io_range,
570 wandev->name)) {
571 printk(KERN_WARNING "port 0x%04x busy\n", card->hw.port);
572 release_hw(card);
573 wandev->state = WAN_UNCONFIGURED;
574 return -EBUSY;
575 }
576
577 /* Only use the polling routine for the X25 protocol */
578
579 card->wandev.critical=0;
580 return 0;
581}
582
583/*==================================================================
584 * configure_s508_card
585 *
586 * For a S508 adapter, check for a possible configuration error in that
587 * we are loading an adapter in the same IO port as a previously loaded S508
588 * card.
589 */
590
591static int check_s508_conflicts (sdla_t* card,wandev_conf_t* conf, int *irq)
592{
593 unsigned long smp_flags;
594 int i;
595
596 if (conf->ioport <= 0) {
597 printk(KERN_INFO
598 "%s: can't configure without I/O port address!\n",
599 card->wandev.name);
600 return -EINVAL;
601 }
602
603 if (conf->irq <= 0) {
604 printk(KERN_INFO "%s: can't configure without IRQ!\n",
605 card->wandev.name);
606 return -EINVAL;
607 }
608
609 if (test_bit(0,&card->configured))
610 return 0;
611
612
613 /* Check for already loaded card with the same IO port and IRQ
614 * If found, copy its hardware configuration and use its
615 * resources (i.e. piggybacking)
616 */
617
618 for (i = 0; i < ncards; i++) {
619 sdla_t *nxt_card = &card_array[i];
620
621 /* Skip the current card ptr */
622 if (nxt_card == card)
623 continue;
624
625
626 /* Find a card that is already configured with the
627 * same IO Port */
628 if ((nxt_card->hw.type == SDLA_S508) &&
629 (nxt_card->hw.port == conf->ioport) &&
630 (nxt_card->next == NULL)){
631
632 /* We found a card the card that has same configuration
633 * as us. This means, that we must setup this card in
634 * piggibacking mode. However, only CHDLC and MPPP protocol
635 * support this setup */
636
637 if ((conf->config_id == WANCONFIG_CHDLC ||
638 conf->config_id == WANCONFIG_MPPP) &&
639 (nxt_card->wandev.config_id == WANCONFIG_CHDLC ||
640 nxt_card->wandev.config_id == WANCONFIG_MPPP)){
641
642 *irq = nxt_card->hw.irq;
643 memcpy(&card->hw, &nxt_card->hw, sizeof(sdlahw_t));
644
645 /* The master could already be running, we must
646 * set this as a critical area */
647 lock_adapter_irq(&nxt_card->wandev.lock, &smp_flags);
648
649 nxt_card->next = card;
650 card->next = nxt_card;
651
652 card->wandev.piggyback = WANOPT_YES;
653
654 /* We must initialise the piggiback spin lock here
655 * since isr will try to lock card->next if it
656 * exists */
657 spin_lock_init(&card->wandev.lock);
658
659 unlock_adapter_irq(&nxt_card->wandev.lock, &smp_flags);
660 break;
661 }else{
662 /* Trying to run piggibacking with a wrong protocol */
663 printk(KERN_INFO "%s: ERROR: Resource busy, ioport: 0x%x\n"
664 "%s: This protocol doesn't support\n"
665 "%s: multi-port operation!\n",
666 card->devname,nxt_card->hw.port,
667 card->devname,card->devname);
668 return -EEXIST;
669 }
670 }
671 }
672
673
674 /* Make sure I/O port region is available only if we are the
675 * master device. If we are running in piggybacking mode,
676 * we will use the resources of the master card. */
677 if (!card->wandev.piggyback) {
678 struct resource *rr =
679 request_region(conf->ioport, SDLA_MAXIORANGE, "sdlamain");
680 release_region(conf->ioport, SDLA_MAXIORANGE);
681
682 if (!rr) {
683 printk(KERN_INFO
684 "%s: I/O region 0x%X - 0x%X is in use!\n",
685 card->wandev.name, conf->ioport,
686 conf->ioport + SDLA_MAXIORANGE - 1);
687 return -EINVAL;
688 }
689 }
690
691 return 0;
692}
693
694/*==================================================================
695 * configure_s514_card
696 *
697 * For a S514 adapter, check for a possible configuration error in that
698 * we are loading an adapter in the same slot as a previously loaded S514
699 * card.
700 */
701
702
703static int check_s514_conflicts(sdla_t* card,wandev_conf_t* conf, int *irq)
704{
705 unsigned long smp_flags;
706 int i;
707
708 if (test_bit(0,&card->configured))
709 return 0;
710
711
712 /* Check for already loaded card with the same IO port and IRQ
713 * If found, copy its hardware configuration and use its
714 * resources (i.e. piggybacking)
715 */
716
717 for (i = 0; i < ncards; i ++) {
718
719 sdla_t* nxt_card = &card_array[i];
720 if(nxt_card == card)
721 continue;
722
723 if((nxt_card->hw.type == SDLA_S514) &&
724 (nxt_card->hw.S514_slot_no == conf->PCI_slot_no) &&
725 (nxt_card->hw.S514_cpu_no[0] == conf->S514_CPU_no[0])&&
726 (nxt_card->next == NULL)){
727
728
729 if ((conf->config_id == WANCONFIG_CHDLC ||
730 conf->config_id == WANCONFIG_MPPP) &&
731 (nxt_card->wandev.config_id == WANCONFIG_CHDLC ||
732 nxt_card->wandev.config_id == WANCONFIG_MPPP)){
733
734 *irq = nxt_card->hw.irq;
735 memcpy(&card->hw, &nxt_card->hw, sizeof(sdlahw_t));
736
737 /* The master could already be running, we must
738 * set this as a critical area */
739 lock_adapter_irq(&nxt_card->wandev.lock,&smp_flags);
740 nxt_card->next = card;
741 card->next = nxt_card;
742
743 card->wandev.piggyback = WANOPT_YES;
744
745 /* We must initialise the piggiback spin lock here
746 * since isr will try to lock card->next if it
747 * exists */
748 spin_lock_init(&card->wandev.lock);
749
750 unlock_adapter_irq(&nxt_card->wandev.lock,&smp_flags);
751
752 }else{
753 /* Trying to run piggibacking with a wrong protocol */
754 printk(KERN_INFO "%s: ERROR: Resource busy: CPU %c PCISLOT %i\n"
755 "%s: This protocol doesn't support\n"
756 "%s: multi-port operation!\n",
757 card->devname,
758 conf->S514_CPU_no[0],conf->PCI_slot_no,
759 card->devname,card->devname);
760 return -EEXIST;
761 }
762 }
763 }
764
765 return 0;
766}
767
768
769
770/*============================================================================
771 * Shut down WAN link driver.
772 * o shut down adapter hardware
773 * o release system resources.
774 *
775 * This function is called by the router when device is being unregistered or
776 * when it handles ROUTER_DOWN IOCTL.
777 */
778static int shutdown(struct wan_device* wandev)
779{
780 sdla_t *card;
781 int err=0;
782
783 /* sanity checks */
784 if ((wandev == NULL) || (wandev->private == NULL)){
785 return -EFAULT;
786 }
787
788 if (wandev->state == WAN_UNCONFIGURED){
789 return 0;
790 }
791
792 card = wandev->private;
793
794 if (card->tty_opt){
795 if (card->tty_open){
796 printk(KERN_INFO
797 "%s: Shutdown Failed: TTY is still open\n",
798 card->devname);
799 return -EBUSY;
800 }
801 }
802
803 wandev->state = WAN_UNCONFIGURED;
804
805 set_bit(PERI_CRIT,(void*)&wandev->critical);
806
807 /* In case of piggibacking, make sure that
808 * we never try to shutdown both devices at the same
809 * time, because they depend on one another */
810
811 if (card->disable_comm){
812 card->disable_comm(card);
813 }
814
815 /* Release Resources */
816 release_hw(card);
817
818 /* only free the allocated I/O range if not an S514 adapter */
819 if (wandev->hw_opt[0] != SDLA_S514 && !card->configured){
820 release_region(card->hw.port, card->hw.io_range);
821 }
822
823 if (!card->configured){
824 memset(&card->hw, 0, sizeof(sdlahw_t));
825 if (card->next){
826 memset(&card->next->hw, 0, sizeof(sdlahw_t));
827 }
828 }
829
830
831 clear_bit(PERI_CRIT,(void*)&wandev->critical);
832 return err;
833}
834
835static void release_hw (sdla_t *card)
836{
837 sdla_t *nxt_card;
838
839
840 /* Check if next device exists */
841 if (card->next){
842 nxt_card = card->next;
843 /* If next device is down then release resources */
844 if (nxt_card->wandev.state == WAN_UNCONFIGURED){
845 if (card->wandev.piggyback){
846 /* If this device is piggyback then use
847 * information of the master device
848 */
849 printk(KERN_INFO "%s: Piggyback shutting down\n",card->devname);
850 sdla_down(&card->next->hw);
851 free_irq(card->wandev.irq, card->next);
852 card->configured = 0;
853 card->next->configured = 0;
854 card->wandev.piggyback = 0;
855 }else{
856 /* Master device shutting down */
857 printk(KERN_INFO "%s: Master shutting down\n",card->devname);
858 sdla_down(&card->hw);
859 free_irq(card->wandev.irq, card);
860 card->configured = 0;
861 card->next->configured = 0;
862 }
863 }else{
864 printk(KERN_INFO "%s: Device still running %i\n",
865 nxt_card->devname,nxt_card->wandev.state);
866
867 card->configured = 1;
868 }
869 }else{
870 printk(KERN_INFO "%s: Master shutting down\n",card->devname);
871 sdla_down(&card->hw);
872 free_irq(card->wandev.irq, card);
873 card->configured = 0;
874 }
875 return;
876}
877
878
879/*============================================================================
880 * Driver I/O control.
881 * o verify arguments
882 * o perform requested action
883 *
884 * This function is called when router handles one of the reserved user
885 * IOCTLs. Note that 'arg' stil points to user address space.
886 */
887static int ioctl(struct wan_device* wandev, unsigned cmd, unsigned long arg)
888{
889 sdla_t* card;
890 int err;
891
892 /* sanity checks */
893 if ((wandev == NULL) || (wandev->private == NULL))
894 return -EFAULT;
895 if (wandev->state == WAN_UNCONFIGURED)
896 return -ENODEV;
897
898 card = wandev->private;
899
900 if(card->hw.type != SDLA_S514){
901 disable_irq(card->hw.irq);
902 }
903
904 if (test_bit(SEND_CRIT, (void*)&wandev->critical)) {
905 return -EAGAIN;
906 }
907
908 switch (cmd) {
909 case WANPIPE_DUMP:
910 err = ioctl_dump(wandev->private, (void*)arg);
911 break;
912
913 case WANPIPE_EXEC:
914 err = ioctl_exec(wandev->private, (void*)arg, cmd);
915 break;
916 default:
917 err = -EINVAL;
918 }
919
920 return err;
921}
922
923/****** Driver IOCTL Handlers ***********************************************/
924
925/*============================================================================
926 * Dump adapter memory to user buffer.
927 * o verify request structure
928 * o copy request structure to kernel data space
929 * o verify length/offset
930 * o verify user buffer
931 * o copy adapter memory image to user buffer
932 *
933 * Note: when dumping memory, this routine switches curent dual-port memory
934 * vector, so care must be taken to avoid racing conditions.
935 */
936static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump)
937{
938 sdla_dump_t dump;
939 unsigned winsize;
940 unsigned long oldvec; /* DPM window vector */
941 unsigned long smp_flags;
942 int err = 0;
943
944 if(copy_from_user((void*)&dump, (void*)u_dump, sizeof(sdla_dump_t)))
945 return -EFAULT;
946
947 if ((dump.magic != WANPIPE_MAGIC) ||
948 (dump.offset + dump.length > card->hw.memory))
949 return -EINVAL;
950
951 winsize = card->hw.dpmsize;
952
953 if(card->hw.type != SDLA_S514) {
954
955 lock_adapter_irq(&card->wandev.lock, &smp_flags);
956
957 oldvec = card->hw.vector;
958 while (dump.length) {
959 /* current offset */
960 unsigned pos = dump.offset % winsize;
961 /* current vector */
962 unsigned long vec = dump.offset - pos;
963 unsigned len = (dump.length > (winsize - pos)) ?
964 (winsize - pos) : dump.length;
965 /* relocate window */
966 if (sdla_mapmem(&card->hw, vec) != 0) {
967 err = -EIO;
968 break;
969 }
970
971 if(copy_to_user((void *)dump.ptr,
972 (u8 *)card->hw.dpmbase + pos, len)){
973
974 unlock_adapter_irq(&card->wandev.lock, &smp_flags);
975 return -EFAULT;
976 }
977
978 dump.length -= len;
979 dump.offset += len;
980 dump.ptr = (char*)dump.ptr + len;
981 }
982
983 sdla_mapmem(&card->hw, oldvec);/* restore DPM window position */
984 unlock_adapter_irq(&card->wandev.lock, &smp_flags);
985
986 }else {
987
988 if(copy_to_user((void *)dump.ptr,
989 (u8 *)card->hw.dpmbase + dump.offset, dump.length)){
990 return -EFAULT;
991 }
992 }
993
994 return err;
995}
996
997/*============================================================================
998 * Execute adapter firmware command.
999 * o verify request structure
1000 * o copy request structure to kernel data space
1001 * o call protocol-specific 'exec' function
1002 */
1003static int ioctl_exec (sdla_t* card, sdla_exec_t* u_exec, int cmd)
1004{
1005 sdla_exec_t exec;
1006 int err=0;
1007
1008 if (card->exec == NULL && cmd == WANPIPE_EXEC){
1009 return -ENODEV;
1010 }
1011
1012 if(copy_from_user((void*)&exec, (void*)u_exec, sizeof(sdla_exec_t)))
1013 return -EFAULT;
1014
1015 if ((exec.magic != WANPIPE_MAGIC) || (exec.cmd == NULL))
1016 return -EINVAL;
1017
1018 switch (cmd) {
1019 case WANPIPE_EXEC:
1020 err = card->exec(card, exec.cmd, exec.data);
1021 break;
1022 }
1023 return err;
1024}
1025
1026/******* Miscellaneous ******************************************************/
1027
1028/*============================================================================
1029 * SDLA Interrupt Service Routine.
1030 * o acknowledge SDLA hardware interrupt.
1031 * o call protocol-specific interrupt service routine, if any.
1032 */
1033STATIC irqreturn_t sdla_isr (int irq, void* dev_id, struct pt_regs *regs)
1034{
1035#define card ((sdla_t*)dev_id)
1036
1037 if(card->hw.type == SDLA_S514) { /* handle interrrupt on S514 */
1038 u32 int_status;
1039 unsigned char CPU_no = card->hw.S514_cpu_no[0];
1040 unsigned char card_found_for_IRQ;
1041 u8 IRQ_count = 0;
1042
1043 for(;;) {
1044
1045 read_S514_int_stat(&card->hw, &int_status);
1046
1047 /* check if the interrupt is for this device */
1048 if(!((unsigned char)int_status &
1049 (IRQ_CPU_A | IRQ_CPU_B)))
1050 return IRQ_HANDLED;
1051
1052 /* if the IRQ is for both CPUs on the same adapter, */
1053 /* then alter the interrupt status so as to handle */
1054 /* one CPU at a time */
1055 if(((unsigned char)int_status & (IRQ_CPU_A | IRQ_CPU_B))
1056 == (IRQ_CPU_A | IRQ_CPU_B)) {
1057 int_status &= (CPU_no == S514_CPU_A) ?
1058 ~IRQ_CPU_B : ~IRQ_CPU_A;
1059 }
1060
1061 card_found_for_IRQ = 0;
1062
1063 /* check to see that the CPU number for this device */
1064 /* corresponds to the interrupt status read */
1065 switch (CPU_no) {
1066 case S514_CPU_A:
1067 if((unsigned char)int_status &
1068 IRQ_CPU_A)
1069 card_found_for_IRQ = 1;
1070 break;
1071
1072 case S514_CPU_B:
1073 if((unsigned char)int_status &
1074 IRQ_CPU_B)
1075 card_found_for_IRQ = 1;
1076 break;
1077 }
1078
1079 /* exit if the interrupt is for another CPU on the */
1080 /* same IRQ */
1081 if(!card_found_for_IRQ)
1082 return IRQ_HANDLED;
1083
1084 if (!card ||
1085 (card->wandev.state == WAN_UNCONFIGURED && !card->configured)){
1086 printk(KERN_INFO
1087 "Received IRQ %d for CPU #%c\n",
1088 irq, CPU_no);
1089 printk(KERN_INFO
1090 "IRQ for unconfigured adapter\n");
1091 S514_intack(&card->hw, int_status);
1092 return IRQ_HANDLED;
1093 }
1094
1095 if (card->in_isr) {
1096 printk(KERN_INFO
1097 "%s: interrupt re-entrancy on IRQ %d\n",
1098 card->devname, card->wandev.irq);
1099 S514_intack(&card->hw, int_status);
1100 return IRQ_HANDLED;
1101 }
1102
1103 spin_lock(&card->wandev.lock);
1104 if (card->next){
1105 spin_lock(&card->next->wandev.lock);
1106 }
1107
1108 S514_intack(&card->hw, int_status);
1109 if (card->isr)
1110 card->isr(card);
1111
1112 if (card->next){
1113 spin_unlock(&card->next->wandev.lock);
1114 }
1115 spin_unlock(&card->wandev.lock);
1116
1117 /* handle a maximum of two interrupts (one for each */
1118 /* CPU on the adapter) before returning */
1119 if((++ IRQ_count) == 2)
1120 return IRQ_HANDLED;
1121 }
1122 }
1123
1124 else { /* handle interrupt on S508 adapter */
1125
1126 if (!card || ((card->wandev.state == WAN_UNCONFIGURED) && !card->configured))
1127 return IRQ_HANDLED;
1128
1129 if (card->in_isr) {
1130 printk(KERN_INFO
1131 "%s: interrupt re-entrancy on IRQ %d!\n",
1132 card->devname, card->wandev.irq);
1133 return IRQ_HANDLED;
1134 }
1135
1136 spin_lock(&card->wandev.lock);
1137 if (card->next){
1138 spin_lock(&card->next->wandev.lock);
1139 }
1140
1141 sdla_intack(&card->hw);
1142 if (card->isr)
1143 card->isr(card);
1144
1145 if (card->next){
1146 spin_unlock(&card->next->wandev.lock);
1147 }
1148 spin_unlock(&card->wandev.lock);
1149
1150 }
1151 return IRQ_HANDLED;
1152#undef card
1153}
1154
1155/*============================================================================
1156 * This routine is called by the protocol-specific modules when network
1157 * interface is being open. The only reason we need this, is because we
1158 * have to call MOD_INC_USE_COUNT, but cannot include 'module.h' where it's
1159 * defined more than once into the same kernel module.
1160 */
1161void wanpipe_open (sdla_t* card)
1162{
1163 ++card->open_cnt;
1164}
1165
1166/*============================================================================
1167 * This routine is called by the protocol-specific modules when network
1168 * interface is being closed. The only reason we need this, is because we
1169 * have to call MOD_DEC_USE_COUNT, but cannot include 'module.h' where it's
1170 * defined more than once into the same kernel module.
1171 */
1172void wanpipe_close (sdla_t* card)
1173{
1174 --card->open_cnt;
1175}
1176
1177/*============================================================================
1178 * Set WAN device state.
1179 */
1180void wanpipe_set_state (sdla_t* card, int state)
1181{
1182 if (card->wandev.state != state) {
1183 switch (state) {
1184 case WAN_CONNECTED:
1185 printk (KERN_INFO "%s: link connected!\n",
1186 card->devname);
1187 break;
1188
1189 case WAN_CONNECTING:
1190 printk (KERN_INFO "%s: link connecting...\n",
1191 card->devname);
1192 break;
1193
1194 case WAN_DISCONNECTED:
1195 printk (KERN_INFO "%s: link disconnected!\n",
1196 card->devname);
1197 break;
1198 }
1199 card->wandev.state = state;
1200 }
1201 card->state_tick = jiffies;
1202}
1203
1204sdla_t * wanpipe_find_card (char *name)
1205{
1206 int cnt;
1207 for (cnt = 0; cnt < ncards; ++ cnt) {
1208 sdla_t* card = &card_array[cnt];
1209 if (!strcmp(card->devname,name))
1210 return card;
1211 }
1212 return NULL;
1213}
1214
1215sdla_t * wanpipe_find_card_num (int num)
1216{
1217 if (num < 1 || num > ncards)
1218 return NULL;
1219 num--;
1220 return &card_array[num];
1221}
1222
1223/*
1224 * @work_pointer: work_struct to be done;
1225 * should already have PREPARE_WORK() or
1226 * INIT_WORK() done on it by caller;
1227 */
1228void wanpipe_queue_work (struct work_struct *work_pointer)
1229{
1230 if (test_and_set_bit(1, (void*)&wanpipe_bh_critical))
1231 printk(KERN_INFO "CRITICAL IN QUEUING WORK\n");
1232
1233 queue_work(wanpipe_wq, work_pointer);
1234 clear_bit(1,(void*)&wanpipe_bh_critical);
1235}
1236
1237void wakeup_sk_bh(struct net_device *dev)
1238{
1239 wanpipe_common_t *chan = dev->priv;
1240
1241 if (test_bit(0,&chan->common_critical))
1242 return;
1243
1244 if (chan->sk && chan->tx_timer){
1245 chan->tx_timer->expires=jiffies+1;
1246 add_timer(chan->tx_timer);
1247 }
1248}
1249
1250int change_dev_flags(struct net_device *dev, unsigned flags)
1251{
1252 struct ifreq if_info;
1253 mm_segment_t fs = get_fs();
1254 int err;
1255
1256 memset(&if_info, 0, sizeof(if_info));
1257 strcpy(if_info.ifr_name, dev->name);
1258 if_info.ifr_flags = flags;
1259
1260 set_fs(get_ds()); /* get user space block */
1261 err = devinet_ioctl(SIOCSIFFLAGS, &if_info);
1262 set_fs(fs);
1263
1264 return err;
1265}
1266
1267unsigned long get_ip_address(struct net_device *dev, int option)
1268{
1269
1270 struct in_ifaddr *ifaddr;
1271 struct in_device *in_dev;
1272 unsigned long addr = 0;
1273
1274 rcu_read_lock();
1275 if ((in_dev = __in_dev_get_rcu(dev)) == NULL){
1276 goto out;
1277 }
1278
1279 if ((ifaddr = in_dev->ifa_list)== NULL ){
1280 goto out;
1281 }
1282
1283 switch (option){
1284
1285 case WAN_LOCAL_IP:
1286 addr = ifaddr->ifa_local;
1287 break;
1288
1289 case WAN_POINTOPOINT_IP:
1290 addr = ifaddr->ifa_address;
1291 break;
1292
1293 case WAN_NETMASK_IP:
1294 addr = ifaddr->ifa_mask;
1295 break;
1296
1297 case WAN_BROADCAST_IP:
1298 addr = ifaddr->ifa_broadcast;
1299 break;
1300 default:
1301 break;
1302 }
1303
1304out:
1305 rcu_read_unlock();
1306 return addr;
1307}
1308
1309void add_gateway(sdla_t *card, struct net_device *dev)
1310{
1311 mm_segment_t oldfs;
1312 struct rtentry route;
1313 int res;
1314
1315 memset((char*)&route,0,sizeof(struct rtentry));
1316
1317 ((struct sockaddr_in *)
1318 &(route.rt_dst))->sin_addr.s_addr = 0;
1319 ((struct sockaddr_in *)
1320 &(route.rt_dst))->sin_family = AF_INET;
1321
1322 ((struct sockaddr_in *)
1323 &(route.rt_genmask))->sin_addr.s_addr = 0;
1324 ((struct sockaddr_in *)
1325 &(route.rt_genmask)) ->sin_family = AF_INET;
1326
1327
1328 route.rt_flags = 0;
1329 route.rt_dev = dev->name;
1330
1331 oldfs = get_fs();
1332 set_fs(get_ds());
1333 res = ip_rt_ioctl(SIOCADDRT,&route);
1334 set_fs(oldfs);
1335
1336 if (res == 0){
1337 printk(KERN_INFO "%s: Gateway added for %s\n",
1338 card->devname,dev->name);
1339 }
1340
1341 return;
1342}
1343
1344MODULE_LICENSE("GPL");
1345
1346/****** End *********************************************************/
diff --git a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c
deleted file mode 100644
index 812a1183c502..000000000000
--- a/drivers/net/wan/wanpipe_multppp.c
+++ /dev/null
@@ -1,2358 +0,0 @@
1/*****************************************************************************
2* wanpipe_multppp.c Multi-Port PPP driver module.
3*
4* Authors: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Dec 15 2000 Updated for 2.4.X kernel
14* Nov 15 2000 Fixed the SyncPPP support for kernels 2.2.16 and higher.
15* The pppstruct has changed.
16* Jul 13 2000 Using the kernel Syncppp module on top of RAW Wanpipe CHDLC
17* module.
18*****************************************************************************/
19
20#include <linux/module.h>
21#include <linux/kernel.h> /* printk(), and other useful stuff */
22#include <linux/stddef.h> /* offsetof(), etc. */
23#include <linux/errno.h> /* return codes */
24#include <linux/string.h> /* inline memset(), etc. */
25#include <linux/slab.h> /* kmalloc(), kfree() */
26#include <linux/wanrouter.h> /* WAN router definitions */
27#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
28#include <linux/if_arp.h> /* ARPHRD_* defines */
29#include <linux/jiffies.h> /* time_after() macro */
30
31#include <linux/in.h> /* sockaddr_in */
32#include <linux/inet.h>
33#include <linux/if.h>
34#include <asm/byteorder.h> /* htons(), etc. */
35#include <linux/sdlapci.h>
36#include <asm/io.h>
37
38#include <linux/sdla_chdlc.h> /* CHDLC firmware API definitions */
39#include <linux/sdla_asy.h> /* CHDLC (async) API definitions */
40
41#include <linux/if_wanpipe_common.h> /* Socket Driver common area */
42#include <linux/if_wanpipe.h>
43
44
45#include <linux/inetdevice.h>
46#include <asm/uaccess.h>
47
48#include <net/syncppp.h>
49
50
51/****** Defines & Macros ****************************************************/
52
53#ifdef _DEBUG_
54#define STATIC
55#else
56#define STATIC static
57#endif
58
59/* reasons for enabling the timer interrupt on the adapter */
60#define TMR_INT_ENABLED_UDP 0x01
61#define TMR_INT_ENABLED_UPDATE 0x02
62#define TMR_INT_ENABLED_CONFIG 0x04
63
64#define CHDLC_DFLT_DATA_LEN 1500 /* default MTU */
65#define CHDLC_HDR_LEN 1
66
67#define IFF_POINTTOPOINT 0x10
68
69#define CHDLC_API 0x01
70
71#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" )
72#define MAX_BH_BUFF 10
73
74#define CRC_LENGTH 2
75#define PPP_HEADER_LEN 4
76
77/******Data Structures*****************************************************/
78
79/* This structure is placed in the private data area of the device structure.
80 * The card structure used to occupy the private area but now the following
81 * structure will incorporate the card structure along with CHDLC specific data
82 */
83
84typedef struct chdlc_private_area
85{
86 void *if_ptr; /* General Pointer used by SPPP */
87 wanpipe_common_t common;
88 sdla_t *card;
89 int TracingEnabled; /* For enabling Tracing */
90 unsigned long curr_trace_addr; /* Used for Tracing */
91 unsigned long start_trace_addr;
92 unsigned long end_trace_addr;
93 unsigned long base_addr_trace_buffer;
94 unsigned long end_addr_trace_buffer;
95 unsigned short number_trace_elements;
96 unsigned available_buffer_space;
97 unsigned long router_start_time;
98 unsigned char route_status;
99 unsigned char route_removed;
100 unsigned long tick_counter; /* For 5s timeout counter */
101 unsigned long router_up_time;
102 u32 IP_address; /* IP addressing */
103 u32 IP_netmask;
104 unsigned char mc; /* Mulitcast support on/off */
105 unsigned short udp_pkt_lgth; /* udp packet processing */
106 char udp_pkt_src;
107 char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
108 unsigned short timer_int_enabled;
109 char update_comms_stats; /* updating comms stats */
110
111 //FIXME: add driver stats as per frame relay!
112
113} chdlc_private_area_t;
114
115/* Route Status options */
116#define NO_ROUTE 0x00
117#define ADD_ROUTE 0x01
118#define ROUTE_ADDED 0x02
119#define REMOVE_ROUTE 0x03
120
121
122/* variable for keeping track of enabling/disabling FT1 monitor status */
123static int rCount = 0;
124
125/* variable for tracking how many interfaces to open for WANPIPE on the
126 two ports */
127
128extern void disable_irq(unsigned int);
129extern void enable_irq(unsigned int);
130
131/****** Function Prototypes *************************************************/
132/* WAN link driver entry points. These are called by the WAN router module. */
133static int update(struct wan_device* wandev);
134static int new_if(struct wan_device* wandev, struct net_device* dev,
135 wanif_conf_t* conf);
136static int del_if(struct wan_device* wandev, struct net_device* dev);
137
138/* Network device interface */
139static int if_init(struct net_device* dev);
140static int if_open(struct net_device* dev);
141static int if_close(struct net_device* dev);
142static int if_send(struct sk_buff* skb, struct net_device* dev);
143static struct net_device_stats* if_stats(struct net_device* dev);
144
145static void if_tx_timeout(struct net_device *dev);
146
147/* CHDLC Firmware interface functions */
148static int chdlc_configure (sdla_t* card, void* data);
149static int chdlc_comm_enable (sdla_t* card);
150static int chdlc_comm_disable (sdla_t* card);
151static int chdlc_read_version (sdla_t* card, char* str);
152static int chdlc_set_intr_mode (sdla_t* card, unsigned mode);
153static int chdlc_send (sdla_t* card, void* data, unsigned len);
154static int chdlc_read_comm_err_stats (sdla_t* card);
155static int chdlc_read_op_stats (sdla_t* card);
156static int config_chdlc (sdla_t *card);
157
158
159/* Miscellaneous CHDLC Functions */
160static int set_chdlc_config (sdla_t* card);
161static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev);
162static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb);
163static int process_chdlc_exception(sdla_t *card);
164static int process_global_exception(sdla_t *card);
165static int update_comms_stats(sdla_t* card,
166 chdlc_private_area_t* chdlc_priv_area);
167static void port_set_state (sdla_t *card, int);
168
169/* Interrupt handlers */
170static void wsppp_isr (sdla_t* card);
171static void rx_intr (sdla_t* card);
172static void timer_intr(sdla_t *);
173
174/* Miscellaneous functions */
175static int reply_udp( unsigned char *data, unsigned int mbox_len );
176static int intr_test( sdla_t* card);
177static int udp_pkt_type( struct sk_buff *skb , sdla_t* card);
178static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
179 struct sk_buff *skb, struct net_device* dev,
180 chdlc_private_area_t* chdlc_priv_area);
181static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
182 chdlc_private_area_t* chdlc_priv_area);
183static unsigned short calc_checksum (char *, int);
184static void s508_lock (sdla_t *card, unsigned long *smp_flags);
185static void s508_unlock (sdla_t *card, unsigned long *smp_flags);
186static void send_ppp_term_request(struct net_device *dev);
187
188
189static int Intr_test_counter;
190/****** Public Functions ****************************************************/
191
192/*============================================================================
193 * Cisco HDLC protocol initialization routine.
194 *
195 * This routine is called by the main WANPIPE module during setup. At this
196 * point adapter is completely initialized and firmware is running.
197 * o read firmware version (to make sure it's alive)
198 * o configure adapter
199 * o initialize protocol-specific fields of the adapter data space.
200 *
201 * Return: 0 o.k.
202 * < 0 failure.
203 */
204int wsppp_init (sdla_t* card, wandev_conf_t* conf)
205{
206 unsigned char port_num;
207 int err;
208 unsigned long max_permitted_baud = 0;
209 SHARED_MEMORY_INFO_STRUCT *flags;
210
211 union
212 {
213 char str[80];
214 } u;
215 volatile CHDLC_MAILBOX_STRUCT* mb;
216 CHDLC_MAILBOX_STRUCT* mb1;
217 unsigned long timeout;
218
219 /* Verify configuration ID */
220 if (conf->config_id != WANCONFIG_MPPP) {
221 printk(KERN_INFO "%s: invalid configuration ID %u!\n",
222 card->devname, conf->config_id);
223 return -EINVAL;
224 }
225
226 /* Find out which Port to use */
227 if ((conf->comm_port == WANOPT_PRI) || (conf->comm_port == WANOPT_SEC)){
228 if (card->next){
229
230 if (conf->comm_port != card->next->u.c.comm_port){
231 card->u.c.comm_port = conf->comm_port;
232 }else{
233 printk(KERN_ERR "%s: ERROR - %s port used!\n",
234 card->wandev.name, PORT(conf->comm_port));
235 return -EINVAL;
236 }
237 }else{
238 card->u.c.comm_port = conf->comm_port;
239 }
240 }else{
241 printk(KERN_ERR "%s: ERROR - Invalid Port Selected!\n",
242 card->wandev.name);
243 return -EINVAL;
244 }
245
246
247 /* Initialize protocol-specific fields */
248 if(card->hw.type != SDLA_S514){
249
250 if (card->u.c.comm_port == WANOPT_PRI){
251 card->mbox = (void *) card->hw.dpmbase;
252 }else{
253 card->mbox = (void *) card->hw.dpmbase +
254 SEC_BASE_ADDR_MB_STRUCT - PRI_BASE_ADDR_MB_STRUCT;
255 }
256 }else{
257 /* for a S514 adapter, set a pointer to the actual mailbox in the */
258 /* allocated virtual memory area */
259 if (card->u.c.comm_port == WANOPT_PRI){
260 card->mbox = (void *) card->hw.dpmbase + PRI_BASE_ADDR_MB_STRUCT;
261 }else{
262 card->mbox = (void *) card->hw.dpmbase + SEC_BASE_ADDR_MB_STRUCT;
263 }
264 }
265
266 mb = mb1 = card->mbox;
267
268 if (!card->configured){
269
270 /* The board will place an 'I' in the return code to indicate that it is
271 ready to accept commands. We expect this to be completed in less
272 than 1 second. */
273
274 timeout = jiffies + 1 * HZ;
275 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
276 if (time_after(jiffies, timeout)) break;
277
278 if (mb->return_code != 'I') {
279 printk(KERN_INFO
280 "%s: Initialization not completed by adapter\n",
281 card->devname);
282 printk(KERN_INFO "Please contact Sangoma representative.\n");
283 return -EIO;
284 }
285 }
286
287 /* Read firmware version. Note that when adapter initializes, it
288 * clears the mailbox, so it may appear that the first command was
289 * executed successfully when in fact it was merely erased. To work
290 * around this, we execute the first command twice.
291 */
292
293 if (chdlc_read_version(card, u.str))
294 return -EIO;
295
296 printk(KERN_INFO "%s: Running Raw CHDLC firmware v%s\n"
297 "%s: for Multi-Port PPP protocol.\n",
298 card->devname,u.str,card->devname);
299
300 card->isr = &wsppp_isr;
301 card->poll = NULL;
302 card->exec = NULL;
303 card->wandev.update = &update;
304 card->wandev.new_if = &new_if;
305 card->wandev.del_if = &del_if;
306 card->wandev.udp_port = conf->udp_port;
307
308 card->wandev.new_if_cnt = 0;
309
310 /* reset the number of times the 'update()' proc has been called */
311 card->u.c.update_call_count = 0;
312
313 card->wandev.ttl = conf->ttl;
314 card->wandev.interface = conf->interface;
315
316 if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&&
317 card->hw.type != SDLA_S514){
318 printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n",
319 card->devname, PORT(card->u.c.comm_port));
320 return -EIO;
321 }
322
323
324 card->wandev.clocking = conf->clocking;
325
326 port_num = card->u.c.comm_port;
327
328 /* Setup Port Bps */
329
330 if(card->wandev.clocking) {
331 if((port_num == WANOPT_PRI) || card->u.c.receive_only) {
332 /* For Primary Port 0 */
333 max_permitted_baud =
334 (card->hw.type == SDLA_S514) ?
335 PRI_MAX_BAUD_RATE_S514 :
336 PRI_MAX_BAUD_RATE_S508;
337 }
338 else if(port_num == WANOPT_SEC) {
339 /* For Secondary Port 1 */
340 max_permitted_baud =
341 (card->hw.type == SDLA_S514) ?
342 SEC_MAX_BAUD_RATE_S514 :
343 SEC_MAX_BAUD_RATE_S508;
344 }
345
346 if(conf->bps > max_permitted_baud) {
347 conf->bps = max_permitted_baud;
348 printk(KERN_INFO "%s: Baud too high!\n",
349 card->wandev.name);
350 printk(KERN_INFO "%s: Baud rate set to %lu bps\n",
351 card->wandev.name, max_permitted_baud);
352 }
353
354 card->wandev.bps = conf->bps;
355 }else{
356 card->wandev.bps = 0;
357 }
358
359 /* Setup the Port MTU */
360 if((port_num == WANOPT_PRI) || card->u.c.receive_only) {
361
362 /* For Primary Port 0 */
363 card->wandev.mtu =
364 (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
365 min_t(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
366 CHDLC_DFLT_DATA_LEN;
367 } else if(port_num == WANOPT_SEC) {
368 /* For Secondary Port 1 */
369 card->wandev.mtu =
370 (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
371 min_t(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
372 CHDLC_DFLT_DATA_LEN;
373 }
374
375 /* Add on a PPP Header */
376 card->wandev.mtu += PPP_HEADER_LEN;
377
378 /* Set up the interrupt status area */
379 /* Read the CHDLC Configuration and obtain:
380 * Ptr to shared memory infor struct
381 * Use this pointer to calculate the value of card->u.c.flags !
382 */
383 mb1->buffer_length = 0;
384 mb1->command = READ_CHDLC_CONFIGURATION;
385 err = sdla_exec(mb1) ? mb1->return_code : CMD_TIMEOUT;
386 if(err != COMMAND_OK) {
387 clear_bit(1, (void*)&card->wandev.critical);
388
389 if(card->hw.type != SDLA_S514)
390 enable_irq(card->hw.irq);
391
392 chdlc_error(card, err, mb1);
393 return -EIO;
394 }
395
396 if(card->hw.type == SDLA_S514){
397 card->u.c.flags = (void *)(card->hw.dpmbase +
398 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
399 ptr_shared_mem_info_struct));
400 }else{
401 card->u.c.flags = (void *)(card->hw.dpmbase +
402 (((CHDLC_CONFIGURATION_STRUCT *)mb1->data)->
403 ptr_shared_mem_info_struct % SDLA_WINDOWSIZE));
404 }
405
406 flags = card->u.c.flags;
407
408 /* This is for the ports link state */
409 card->wandev.state = WAN_DUALPORT;
410 card->u.c.state = WAN_DISCONNECTED;
411
412
413 if (!card->wandev.piggyback){
414 err = intr_test(card);
415
416 if(err || (Intr_test_counter < MAX_INTR_TEST_COUNTER)) {
417 printk(KERN_ERR "%s: Interrupt test failed (%i)\n",
418 card->devname, Intr_test_counter);
419 printk(KERN_ERR "%s: Please choose another interrupt\n",
420 card->devname);
421 return -EIO;
422 }
423
424 printk(KERN_INFO "%s: Interrupt test passed (%i)\n",
425 card->devname, Intr_test_counter);
426 }
427
428
429 if (chdlc_set_intr_mode(card, APP_INT_ON_TIMER)){
430 printk (KERN_INFO "%s: Failed to set interrupt triggers!\n",
431 card->devname);
432 return -EIO;
433 }
434
435 /* Mask the Timer interrupt */
436 flags->interrupt_info_struct.interrupt_permission &=
437 ~APP_INT_ON_TIMER;
438
439 printk(KERN_INFO "\n");
440
441 return 0;
442}
443
444/******* WAN Device Driver Entry Points *************************************/
445
446/*============================================================================
447 * Update device status & statistics
448 * This procedure is called when updating the PROC file system and returns
449 * various communications statistics. These statistics are accumulated from 3
450 * different locations:
451 * 1) The 'if_stats' recorded for the device.
452 * 2) Communication error statistics on the adapter.
453 * 3) CHDLC operational statistics on the adapter.
454 * The board level statistics are read during a timer interrupt. Note that we
455 * read the error and operational statistics during consecitive timer ticks so
456 * as to minimize the time that we are inside the interrupt handler.
457 *
458 */
459static int update(struct wan_device* wandev)
460{
461 sdla_t* card = wandev->private;
462 struct net_device* dev;
463 volatile chdlc_private_area_t* chdlc_priv_area;
464 SHARED_MEMORY_INFO_STRUCT *flags;
465 unsigned long timeout;
466
467 /* sanity checks */
468 if((wandev == NULL) || (wandev->private == NULL))
469 return -EFAULT;
470
471 if(wandev->state == WAN_UNCONFIGURED)
472 return -ENODEV;
473
474 /* more sanity checks */
475 if(!card->u.c.flags)
476 return -ENODEV;
477
478 if((dev=card->wandev.dev) == NULL)
479 return -ENODEV;
480
481 if((chdlc_priv_area=dev->priv) == NULL)
482 return -ENODEV;
483
484 flags = card->u.c.flags;
485
486 if(chdlc_priv_area->update_comms_stats){
487 return -EAGAIN;
488 }
489
490 /* we will need 2 timer interrupts to complete the */
491 /* reading of the statistics */
492 chdlc_priv_area->update_comms_stats = 2;
493 flags->interrupt_info_struct.interrupt_permission |= APP_INT_ON_TIMER;
494 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE;
495
496 /* wait a maximum of 1 second for the statistics to be updated */
497 timeout = jiffies + 1 * HZ;
498 for(;;) {
499 if(chdlc_priv_area->update_comms_stats == 0)
500 break;
501 if (time_after(jiffies, timeout)){
502 chdlc_priv_area->update_comms_stats = 0;
503 chdlc_priv_area->timer_int_enabled &=
504 ~TMR_INT_ENABLED_UPDATE;
505 return -EAGAIN;
506 }
507 }
508
509 return 0;
510}
511
512
513/*============================================================================
514 * Create new logical channel.
515 * This routine is called by the router when ROUTER_IFNEW IOCTL is being
516 * handled.
517 * o parse media- and hardware-specific configuration
518 * o make sure that a new channel can be created
519 * o allocate resources, if necessary
520 * o prepare network device structure for registaration.
521 *
522 * Return: 0 o.k.
523 * < 0 failure (channel will not be created)
524 */
525static int new_if(struct wan_device* wandev, struct net_device* pdev,
526 wanif_conf_t* conf)
527{
528
529 struct ppp_device *pppdev = (struct ppp_device *)pdev;
530 struct net_device *dev = NULL;
531 struct sppp *sp;
532 sdla_t* card = wandev->private;
533 chdlc_private_area_t* chdlc_priv_area;
534
535 if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)) {
536 printk(KERN_INFO "%s: invalid interface name!\n",
537 card->devname);
538 return -EINVAL;
539 }
540
541 /* allocate and initialize private data */
542 chdlc_priv_area = kmalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
543
544 if(chdlc_priv_area == NULL)
545 return -ENOMEM;
546
547 memset(chdlc_priv_area, 0, sizeof(chdlc_private_area_t));
548
549 chdlc_priv_area->card = card;
550
551 /* initialize data */
552 strcpy(card->u.c.if_name, conf->name);
553
554 if(card->wandev.new_if_cnt > 0) {
555 kfree(chdlc_priv_area);
556 return -EEXIST;
557 }
558
559 card->wandev.new_if_cnt++;
560
561 chdlc_priv_area->TracingEnabled = 0;
562
563 //We don't need this any more
564 chdlc_priv_area->route_status = NO_ROUTE;
565 chdlc_priv_area->route_removed = 0;
566
567 printk(KERN_INFO "%s: Firmware running in HDLC STREAMING Mode\n",
568 wandev->name);
569
570 /* Setup wanpipe as a router (WANPIPE) or as an API */
571 if( strcmp(conf->usedby, "WANPIPE") == 0) {
572 printk(KERN_INFO "%s: Driver running in WANPIPE mode!\n",
573 wandev->name);
574 card->u.c.usedby = WANPIPE;
575 } else {
576 printk(KERN_INFO
577 "%s: API Mode is not supported for SyncPPP!\n",
578 wandev->name);
579 kfree(chdlc_priv_area);
580 return -EINVAL;
581 }
582
583 /* Get Multicast Information */
584 chdlc_priv_area->mc = conf->mc;
585
586
587 chdlc_priv_area->if_ptr = pppdev;
588
589 /* prepare network device data space for registration */
590
591 strcpy(dev->name,card->u.c.if_name);
592
593 /* Attach PPP protocol layer to pppdev
594 * The sppp_attach() will initilize the dev structure
595 * and setup ppp layer protocols.
596 * All we have to do is to bind in:
597 * if_open(), if_close(), if_send() and get_stats() functions.
598 */
599 sppp_attach(pppdev);
600 dev = pppdev->dev;
601 sp = &pppdev->sppp;
602
603 /* Enable PPP Debugging */
604 // FIXME Fix this up somehow
605 //sp->pp_flags |= PP_DEBUG;
606 sp->pp_flags &= ~PP_CISCO;
607
608 dev->init = &if_init;
609 dev->priv = chdlc_priv_area;
610
611 return 0;
612}
613
614
615
616
617/*============================================================================
618 * Delete logical channel.
619 */
620static int del_if(struct wan_device* wandev, struct net_device* dev)
621{
622 chdlc_private_area_t *chdlc_priv_area = dev->priv;
623 sdla_t *card = chdlc_priv_area->card;
624 unsigned long smp_lock;
625
626 /* Detach the PPP layer */
627 printk(KERN_INFO "%s: Detaching SyncPPP Module from %s\n",
628 wandev->name,dev->name);
629
630 lock_adapter_irq(&wandev->lock,&smp_lock);
631
632 sppp_detach(dev);
633 chdlc_priv_area->if_ptr=NULL;
634
635 chdlc_set_intr_mode(card, 0);
636 if (card->u.c.comm_enabled)
637 chdlc_comm_disable(card);
638 unlock_adapter_irq(&wandev->lock,&smp_lock);
639
640 port_set_state(card, WAN_DISCONNECTED);
641
642 return 0;
643}
644
645
646/****** Network Device Interface ********************************************/
647
648/*============================================================================
649 * Initialize Linux network interface.
650 *
651 * This routine is called only once for each interface, during Linux network
652 * interface registration. Returning anything but zero will fail interface
653 * registration.
654 */
655static int if_init(struct net_device* dev)
656{
657 chdlc_private_area_t* chdlc_priv_area = dev->priv;
658 sdla_t* card = chdlc_priv_area->card;
659 struct wan_device* wandev = &card->wandev;
660
661 /* NOTE: Most of the dev initialization was
662 * done in sppp_attach(), called by new_if()
663 * function. All we have to do here is
664 * to link four major routines below.
665 */
666
667 /* Initialize device driver entry points */
668 dev->open = &if_open;
669 dev->stop = &if_close;
670 dev->hard_start_xmit = &if_send;
671 dev->get_stats = &if_stats;
672 dev->tx_timeout = &if_tx_timeout;
673 dev->watchdog_timeo = TX_TIMEOUT;
674
675
676 /* Initialize hardware parameters */
677 dev->irq = wandev->irq;
678 dev->dma = wandev->dma;
679 dev->base_addr = wandev->ioport;
680 dev->mem_start = wandev->maddr;
681 dev->mem_end = wandev->maddr + wandev->msize - 1;
682
683 /* Set transmit buffer queue length
684 * If we over fill this queue the packets will
685 * be droped by the kernel.
686 * sppp_attach() sets this to 10, but
687 * 100 will give us more room at low speeds.
688 */
689 dev->tx_queue_len = 100;
690
691 return 0;
692}
693
694
695/*============================================================================
696 * Handle transmit timeout event from netif watchdog
697 */
698static void if_tx_timeout(struct net_device *dev)
699{
700 chdlc_private_area_t* chan = dev->priv;
701 sdla_t *card = chan->card;
702
703 /* If our device stays busy for at least 5 seconds then we will
704 * kick start the device by making dev->tbusy = 0. We expect
705 * that our device never stays busy more than 5 seconds. So this
706 * is only used as a last resort.
707 */
708
709 ++card->wandev.stats.collisions;
710
711 printk (KERN_INFO "%s: Transmit timed out on %s\n", card->devname,dev->name);
712 netif_wake_queue (dev);
713}
714
715
716/*============================================================================
717 * Open network interface.
718 * o enable communications and interrupts.
719 * o prevent module from unloading by incrementing use count
720 *
721 * Return 0 if O.k. or errno.
722 */
723static int if_open(struct net_device* dev)
724{
725 chdlc_private_area_t* chdlc_priv_area = dev->priv;
726 sdla_t* card = chdlc_priv_area->card;
727 struct timeval tv;
728 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
729
730 /* Only one open per interface is allowed */
731 if (netif_running(dev))
732 return -EBUSY;
733
734 /* Start PPP Layer */
735 if (sppp_open(dev)){
736 return -EIO;
737 }
738
739 do_gettimeofday(&tv);
740 chdlc_priv_area->router_start_time = tv.tv_sec;
741
742 netif_start_queue(dev);
743
744 wanpipe_open(card);
745
746 chdlc_priv_area->timer_int_enabled |= TMR_INT_ENABLED_CONFIG;
747 flags->interrupt_info_struct.interrupt_permission |= APP_INT_ON_TIMER;
748 return 0;
749}
750
751/*============================================================================
752 * Close network interface.
753 * o if this is the last close, then disable communications and interrupts.
754 * o reset flags.
755 */
756static int if_close(struct net_device* dev)
757{
758 chdlc_private_area_t* chdlc_priv_area = dev->priv;
759 sdla_t* card = chdlc_priv_area->card;
760
761 /* Stop the PPP Layer */
762 sppp_close(dev);
763 netif_stop_queue(dev);
764
765 wanpipe_close(card);
766
767 return 0;
768}
769
770/*============================================================================
771 * Send a packet on a network interface.
772 * o set tbusy flag (marks start of the transmission) to block a timer-based
773 * transmit from overlapping.
774 * o check link state. If link is not up, then drop the packet.
775 * o execute adapter send command.
776 * o free socket buffer
777 *
778 * Return: 0 complete (socket buffer must be freed)
779 * non-0 packet may be re-transmitted (tbusy must be set)
780 *
781 * Notes:
782 * 1. This routine is called either by the protocol stack or by the "net
783 * bottom half" (with interrupts enabled).
784 * 2. Setting tbusy flag will inhibit further transmit requests from the
785 * protocol stack and can be used for flow control with protocol layer.
786 */
787static int if_send(struct sk_buff* skb, struct net_device* dev)
788{
789 chdlc_private_area_t *chdlc_priv_area = dev->priv;
790 sdla_t *card = chdlc_priv_area->card;
791 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
792 INTERRUPT_INFORMATION_STRUCT *chdlc_int = &flags->interrupt_info_struct;
793 int udp_type = 0;
794 unsigned long smp_flags;
795 int err=0;
796
797 netif_stop_queue(dev);
798
799
800 if (skb == NULL){
801 /* If we get here, some higher layer thinks we've missed an
802 * tx-done interrupt.
803 */
804 printk(KERN_INFO "%s: Received NULL skb buffer! interface %s got kicked!\n",
805 card->devname, dev->name);
806
807 netif_wake_queue(dev);
808 return 0;
809 }
810
811 if (ntohs(skb->protocol) != htons(PVC_PROT)){
812 /* check the udp packet type */
813
814 udp_type = udp_pkt_type(skb, card);
815 if (udp_type == UDP_CPIPE_TYPE){
816 if(store_udp_mgmt_pkt(UDP_PKT_FRM_STACK, card, skb, dev,
817 chdlc_priv_area)){
818 chdlc_int->interrupt_permission |=
819 APP_INT_ON_TIMER;
820 }
821 netif_start_queue(dev);
822 return 0;
823 }
824 }
825
826 /* Lock the 508 Card: SMP is supported */
827 if(card->hw.type != SDLA_S514){
828 s508_lock(card,&smp_flags);
829 }
830
831 if (test_and_set_bit(SEND_CRIT, (void*)&card->wandev.critical)){
832
833 printk(KERN_INFO "%s: Critical in if_send: %lx\n",
834 card->wandev.name,card->wandev.critical);
835 ++card->wandev.stats.tx_dropped;
836 netif_start_queue(dev);
837 goto if_send_crit_exit;
838 }
839
840 if (card->wandev.state != WAN_CONNECTED){
841 ++card->wandev.stats.tx_dropped;
842 netif_start_queue(dev);
843 goto if_send_crit_exit;
844 }
845
846 if (chdlc_send(card, skb->data, skb->len)){
847 netif_stop_queue(dev);
848
849 }else{
850 ++card->wandev.stats.tx_packets;
851 card->wandev.stats.tx_bytes += skb->len;
852 dev->trans_start = jiffies;
853 netif_start_queue(dev);
854 }
855
856if_send_crit_exit:
857 if (!(err=netif_queue_stopped(dev))){
858 dev_kfree_skb_any(skb);
859 }else{
860 chdlc_priv_area->tick_counter = jiffies;
861 chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
862 }
863
864 clear_bit(SEND_CRIT, (void*)&card->wandev.critical);
865 if(card->hw.type != SDLA_S514){
866 s508_unlock(card,&smp_flags);
867 }
868
869 return err;
870}
871
872
873/*============================================================================
874 * Reply to UDP Management system.
875 * Return length of reply.
876 */
877static int reply_udp( unsigned char *data, unsigned int mbox_len )
878{
879
880 unsigned short len, udp_length, temp, ip_length;
881 unsigned long ip_temp;
882 int even_bound = 0;
883 chdlc_udp_pkt_t *c_udp_pkt = (chdlc_udp_pkt_t *)data;
884
885 /* Set length of packet */
886 len = sizeof(ip_pkt_t)+
887 sizeof(udp_pkt_t)+
888 sizeof(wp_mgmt_t)+
889 sizeof(cblock_t)+
890 sizeof(trace_info_t)+
891 mbox_len;
892
893 /* fill in UDP reply */
894 c_udp_pkt->wp_mgmt.request_reply = UDPMGMT_REPLY;
895
896 /* fill in UDP length */
897 udp_length = sizeof(udp_pkt_t)+
898 sizeof(wp_mgmt_t)+
899 sizeof(cblock_t)+
900 sizeof(trace_info_t)+
901 mbox_len;
902
903 /* put it on an even boundary */
904 if ( udp_length & 0x0001 ) {
905 udp_length += 1;
906 len += 1;
907 even_bound = 1;
908 }
909
910 temp = (udp_length<<8)|(udp_length>>8);
911 c_udp_pkt->udp_pkt.udp_length = temp;
912
913 /* swap UDP ports */
914 temp = c_udp_pkt->udp_pkt.udp_src_port;
915 c_udp_pkt->udp_pkt.udp_src_port =
916 c_udp_pkt->udp_pkt.udp_dst_port;
917 c_udp_pkt->udp_pkt.udp_dst_port = temp;
918
919 /* add UDP pseudo header */
920 temp = 0x1100;
921 *((unsigned short *)(c_udp_pkt->data+mbox_len+even_bound)) = temp;
922 temp = (udp_length<<8)|(udp_length>>8);
923 *((unsigned short *)(c_udp_pkt->data+mbox_len+even_bound+2)) = temp;
924
925
926 /* calculate UDP checksum */
927 c_udp_pkt->udp_pkt.udp_checksum = 0;
928 c_udp_pkt->udp_pkt.udp_checksum = calc_checksum(&data[UDP_OFFSET],udp_length+UDP_OFFSET);
929
930 /* fill in IP length */
931 ip_length = len;
932 temp = (ip_length<<8)|(ip_length>>8);
933 c_udp_pkt->ip_pkt.total_length = temp;
934
935 /* swap IP addresses */
936 ip_temp = c_udp_pkt->ip_pkt.ip_src_address;
937 c_udp_pkt->ip_pkt.ip_src_address = c_udp_pkt->ip_pkt.ip_dst_address;
938 c_udp_pkt->ip_pkt.ip_dst_address = ip_temp;
939
940 /* fill in IP checksum */
941 c_udp_pkt->ip_pkt.hdr_checksum = 0;
942 c_udp_pkt->ip_pkt.hdr_checksum = calc_checksum(data,sizeof(ip_pkt_t));
943
944 return len;
945
946} /* reply_udp */
947
948unsigned short calc_checksum (char *data, int len)
949{
950 unsigned short temp;
951 unsigned long sum=0;
952 int i;
953
954 for( i = 0; i <len; i+=2 ) {
955 memcpy(&temp,&data[i],2);
956 sum += (unsigned long)temp;
957 }
958
959 while (sum >> 16 ) {
960 sum = (sum & 0xffffUL) + (sum >> 16);
961 }
962
963 temp = (unsigned short)sum;
964 temp = ~temp;
965
966 if( temp == 0 )
967 temp = 0xffff;
968
969 return temp;
970}
971
972
973/*============================================================================
974 * Get ethernet-style interface statistics.
975 * Return a pointer to struct enet_statistics.
976 */
977static struct net_device_stats* if_stats(struct net_device* dev)
978{
979 sdla_t *my_card;
980 chdlc_private_area_t* chdlc_priv_area;
981
982 /* Shutdown bug fix. In del_if() we kill
983 * dev->priv pointer. This function, gets
984 * called after del_if(), thus check
985 * if pointer has been deleted */
986 if ((chdlc_priv_area=dev->priv) == NULL)
987 return NULL;
988
989 my_card = chdlc_priv_area->card;
990 return &my_card->wandev.stats;
991}
992
993
994/****** Cisco HDLC Firmware Interface Functions *******************************/
995
996/*============================================================================
997 * Read firmware code version.
998 * Put code version as ASCII string in str.
999 */
1000static int chdlc_read_version (sdla_t* card, char* str)
1001{
1002 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1003 int len;
1004 char err;
1005 mb->buffer_length = 0;
1006 mb->command = READ_CHDLC_CODE_VERSION;
1007 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1008
1009 if(err != COMMAND_OK) {
1010 chdlc_error(card,err,mb);
1011 }
1012 else if (str) { /* is not null */
1013 len = mb->buffer_length;
1014 memcpy(str, mb->data, len);
1015 str[len] = '\0';
1016 }
1017 return (err);
1018}
1019
1020/*-----------------------------------------------------------------------------
1021 * Configure CHDLC firmware.
1022 */
1023static int chdlc_configure (sdla_t* card, void* data)
1024{
1025 int err;
1026 CHDLC_MAILBOX_STRUCT *mailbox = card->mbox;
1027 int data_length = sizeof(CHDLC_CONFIGURATION_STRUCT);
1028
1029 mailbox->buffer_length = data_length;
1030 memcpy(mailbox->data, data, data_length);
1031 mailbox->command = SET_CHDLC_CONFIGURATION;
1032 err = sdla_exec(mailbox) ? mailbox->return_code : CMD_TIMEOUT;
1033
1034 if (err != COMMAND_OK) chdlc_error (card, err, mailbox);
1035
1036 return err;
1037}
1038
1039
1040/*============================================================================
1041 * Set interrupt mode -- HDLC Version.
1042 */
1043
1044static int chdlc_set_intr_mode (sdla_t* card, unsigned mode)
1045{
1046 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1047 CHDLC_INT_TRIGGERS_STRUCT* int_data =
1048 (CHDLC_INT_TRIGGERS_STRUCT *)mb->data;
1049 int err;
1050
1051 int_data->CHDLC_interrupt_triggers = mode;
1052 int_data->IRQ = card->hw.irq;
1053 int_data->interrupt_timer = 1;
1054
1055 mb->buffer_length = sizeof(CHDLC_INT_TRIGGERS_STRUCT);
1056 mb->command = SET_CHDLC_INTERRUPT_TRIGGERS;
1057 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1058 if (err != COMMAND_OK)
1059 chdlc_error (card, err, mb);
1060 return err;
1061}
1062
1063
1064/*============================================================================
1065 * Enable communications.
1066 */
1067
1068static int chdlc_comm_enable (sdla_t* card)
1069{
1070 int err;
1071 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1072
1073 mb->buffer_length = 0;
1074 mb->command = ENABLE_CHDLC_COMMUNICATIONS;
1075 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1076 if (err != COMMAND_OK)
1077 chdlc_error(card, err, mb);
1078 else
1079 card->u.c.comm_enabled=1;
1080
1081 return err;
1082}
1083
1084/*============================================================================
1085 * Disable communications and Drop the Modem lines (DCD and RTS).
1086 */
1087static int chdlc_comm_disable (sdla_t* card)
1088{
1089 int err;
1090 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1091
1092 mb->buffer_length = 0;
1093 mb->command = DISABLE_CHDLC_COMMUNICATIONS;
1094 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1095 if (err != COMMAND_OK)
1096 chdlc_error(card,err,mb);
1097
1098 return err;
1099}
1100
1101/*============================================================================
1102 * Read communication error statistics.
1103 */
1104static int chdlc_read_comm_err_stats (sdla_t* card)
1105{
1106 int err;
1107 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1108
1109 mb->buffer_length = 0;
1110 mb->command = READ_COMMS_ERROR_STATS;
1111 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1112 if (err != COMMAND_OK)
1113 chdlc_error(card,err,mb);
1114 return err;
1115}
1116
1117
1118/*============================================================================
1119 * Read CHDLC operational statistics.
1120 */
1121static int chdlc_read_op_stats (sdla_t* card)
1122{
1123 int err;
1124 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1125
1126 mb->buffer_length = 0;
1127 mb->command = READ_CHDLC_OPERATIONAL_STATS;
1128 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1129 if (err != COMMAND_OK)
1130 chdlc_error(card,err,mb);
1131 return err;
1132}
1133
1134
1135/*============================================================================
1136 * Update communications error and general packet statistics.
1137 */
1138static int update_comms_stats(sdla_t* card,
1139 chdlc_private_area_t* chdlc_priv_area)
1140{
1141 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1142 COMMS_ERROR_STATS_STRUCT* err_stats;
1143 CHDLC_OPERATIONAL_STATS_STRUCT *op_stats;
1144
1145 /* on the first timer interrupt, read the comms error statistics */
1146 if(chdlc_priv_area->update_comms_stats == 2) {
1147 if(chdlc_read_comm_err_stats(card))
1148 return 1;
1149 err_stats = (COMMS_ERROR_STATS_STRUCT *)mb->data;
1150 card->wandev.stats.rx_over_errors =
1151 err_stats->Rx_overrun_err_count;
1152 card->wandev.stats.rx_crc_errors =
1153 err_stats->CRC_err_count;
1154 card->wandev.stats.rx_frame_errors =
1155 err_stats->Rx_abort_count;
1156 card->wandev.stats.rx_fifo_errors =
1157 err_stats->Rx_dis_pri_bfrs_full_count;
1158 card->wandev.stats.rx_missed_errors =
1159 card->wandev.stats.rx_fifo_errors;
1160 card->wandev.stats.tx_aborted_errors =
1161 err_stats->sec_Tx_abort_count;
1162 }
1163
1164 /* on the second timer interrupt, read the operational statistics */
1165 else {
1166 if(chdlc_read_op_stats(card))
1167 return 1;
1168 op_stats = (CHDLC_OPERATIONAL_STATS_STRUCT *)mb->data;
1169 card->wandev.stats.rx_length_errors =
1170 (op_stats->Rx_Data_discard_short_count +
1171 op_stats->Rx_Data_discard_long_count);
1172 }
1173
1174 return 0;
1175}
1176
1177/*============================================================================
1178 * Send packet.
1179 * Return: 0 - o.k.
1180 * 1 - no transmit buffers available
1181 */
1182static int chdlc_send (sdla_t* card, void* data, unsigned len)
1183{
1184 CHDLC_DATA_TX_STATUS_EL_STRUCT *txbuf = card->u.c.txbuf;
1185
1186 if (txbuf->opp_flag)
1187 return 1;
1188
1189 sdla_poke(&card->hw, txbuf->ptr_data_bfr, data, len);
1190
1191 txbuf->frame_length = len;
1192 txbuf->opp_flag = 1; /* start transmission */
1193
1194 /* Update transmit buffer control fields */
1195 card->u.c.txbuf = ++txbuf;
1196
1197 if ((void*)txbuf > card->u.c.txbuf_last)
1198 card->u.c.txbuf = card->u.c.txbuf_base;
1199
1200 return 0;
1201}
1202
1203/****** Firmware Error Handler **********************************************/
1204
1205/*============================================================================
1206 * Firmware error handler.
1207 * This routine is called whenever firmware command returns non-zero
1208 * return code.
1209 *
1210 * Return zero if previous command has to be cancelled.
1211 */
1212static int chdlc_error (sdla_t *card, int err, CHDLC_MAILBOX_STRUCT *mb)
1213{
1214 unsigned cmd = mb->command;
1215
1216 switch (err) {
1217
1218 case CMD_TIMEOUT:
1219 printk(KERN_ERR "%s: command 0x%02X timed out!\n",
1220 card->devname, cmd);
1221 break;
1222
1223 case S514_BOTH_PORTS_SAME_CLK_MODE:
1224 if(cmd == SET_CHDLC_CONFIGURATION) {
1225 printk(KERN_INFO
1226 "%s: Configure both ports for the same clock source\n",
1227 card->devname);
1228 break;
1229 }
1230
1231 default:
1232 printk(KERN_INFO "%s: command 0x%02X returned 0x%02X!\n",
1233 card->devname, cmd, err);
1234 }
1235
1236 return 0;
1237}
1238
1239/****** Interrupt Handlers **************************************************/
1240
1241/*============================================================================
1242 * Cisco HDLC interrupt service routine.
1243 */
1244STATIC void wsppp_isr (sdla_t* card)
1245{
1246 struct net_device* dev;
1247 SHARED_MEMORY_INFO_STRUCT* flags = NULL;
1248 int i;
1249 sdla_t *my_card;
1250
1251
1252 /* Check for which port the interrupt has been generated
1253 * Since Secondary Port is piggybacking on the Primary
1254 * the check must be done here.
1255 */
1256
1257 flags = card->u.c.flags;
1258 if (!flags->interrupt_info_struct.interrupt_type){
1259 /* Check for a second port (piggybacking) */
1260 if((my_card = card->next)){
1261 flags = my_card->u.c.flags;
1262 if (flags->interrupt_info_struct.interrupt_type){
1263 card = my_card;
1264 card->isr(card);
1265 return;
1266 }
1267 }
1268 }
1269
1270 dev = card->wandev.dev;
1271 card->in_isr = 1;
1272 flags = card->u.c.flags;
1273
1274 /* If we get an interrupt with no network device, stop the interrupts
1275 * and issue an error */
1276 if ((!dev || !dev->priv) && flags->interrupt_info_struct.interrupt_type !=
1277 COMMAND_COMPLETE_APP_INT_PEND){
1278 goto isr_done;
1279 }
1280
1281
1282 /* if critical due to peripheral operations
1283 * ie. update() or getstats() then reset the interrupt and
1284 * wait for the board to retrigger.
1285 */
1286 if(test_bit(PERI_CRIT, (void*)&card->wandev.critical)) {
1287 flags->interrupt_info_struct.
1288 interrupt_type = 0;
1289 goto isr_done;
1290 }
1291
1292
1293 /* On a 508 Card, if critical due to if_send
1294 * Major Error !!!
1295 */
1296 if(card->hw.type != SDLA_S514) {
1297 if(test_bit(0, (void*)&card->wandev.critical)) {
1298 printk(KERN_INFO "%s: Critical while in ISR: %lx\n",
1299 card->devname, card->wandev.critical);
1300 goto isr_done;
1301 }
1302 }
1303
1304 switch(flags->interrupt_info_struct.interrupt_type) {
1305
1306 case RX_APP_INT_PEND: /* 0x01: receive interrupt */
1307 rx_intr(card);
1308 break;
1309
1310 case TX_APP_INT_PEND: /* 0x02: transmit interrupt */
1311 flags->interrupt_info_struct.interrupt_permission &=
1312 ~APP_INT_ON_TX_FRAME;
1313
1314 netif_wake_queue(dev);
1315 break;
1316
1317 case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */
1318 ++ Intr_test_counter;
1319 break;
1320
1321 case CHDLC_EXCEP_COND_APP_INT_PEND: /* 0x20 */
1322 process_chdlc_exception(card);
1323 break;
1324
1325 case GLOBAL_EXCEP_COND_APP_INT_PEND:
1326 process_global_exception(card);
1327 break;
1328
1329 case TIMER_APP_INT_PEND:
1330 timer_intr(card);
1331 break;
1332
1333 default:
1334 printk(KERN_INFO "%s: spurious interrupt 0x%02X!\n",
1335 card->devname,
1336 flags->interrupt_info_struct.interrupt_type);
1337 printk(KERN_INFO "Code name: ");
1338 for(i = 0; i < 4; i ++)
1339 printk(KERN_INFO "%c",
1340 flags->global_info_struct.codename[i]);
1341 printk(KERN_INFO "\nCode version: ");
1342 for(i = 0; i < 4; i ++)
1343 printk(KERN_INFO "%c",
1344 flags->global_info_struct.codeversion[i]);
1345 printk(KERN_INFO "\n");
1346 break;
1347 }
1348
1349isr_done:
1350 card->in_isr = 0;
1351 flags->interrupt_info_struct.interrupt_type = 0;
1352}
1353
1354/*============================================================================
1355 * Receive interrupt handler.
1356 */
1357static void rx_intr (sdla_t* card)
1358{
1359 struct net_device *dev;
1360 chdlc_private_area_t *chdlc_priv_area;
1361 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
1362 CHDLC_DATA_RX_STATUS_EL_STRUCT *rxbuf = card->u.c.rxmb;
1363 struct sk_buff *skb;
1364 unsigned len;
1365 unsigned addr = rxbuf->ptr_data_bfr;
1366 void *buf;
1367 int i,udp_type;
1368
1369 if (rxbuf->opp_flag != 0x01) {
1370 printk(KERN_INFO
1371 "%s: corrupted Rx buffer @ 0x%X, flag = 0x%02X!\n",
1372 card->devname, (unsigned)rxbuf, rxbuf->opp_flag);
1373 printk(KERN_INFO "Code name: ");
1374 for(i = 0; i < 4; i ++)
1375 printk(KERN_INFO "%c",
1376 flags->global_info_struct.codename[i]);
1377 printk(KERN_INFO "\nCode version: ");
1378 for(i = 0; i < 4; i ++)
1379 printk(KERN_INFO "%c",
1380 flags->global_info_struct.codeversion[i]);
1381 printk(KERN_INFO "\n");
1382
1383
1384 /* Bug Fix: Mar 6 2000
1385 * If we get a corrupted mailbox, it measn that driver
1386 * is out of sync with the firmware. There is no recovery.
1387 * If we don't turn off all interrupts for this card
1388 * the machine will crash.
1389 */
1390 printk(KERN_INFO "%s: Critical router failure ...!!!\n", card->devname);
1391 printk(KERN_INFO "Please contact Sangoma Technologies !\n");
1392 chdlc_set_intr_mode(card,0);
1393 return;
1394 }
1395
1396 dev = card->wandev.dev;
1397
1398 if (!dev){
1399 goto rx_exit;
1400 }
1401
1402 if (!netif_running(dev)){
1403 goto rx_exit;
1404 }
1405
1406 chdlc_priv_area = dev->priv;
1407
1408 if (rxbuf->error_flag){
1409 goto rx_exit;
1410 }
1411 /* Take off two CRC bytes */
1412
1413 if (rxbuf->frame_length < 7 || rxbuf->frame_length > 1506 ){
1414 goto rx_exit;
1415 }
1416
1417 len = rxbuf->frame_length - CRC_LENGTH;
1418
1419 /* Allocate socket buffer */
1420 skb = dev_alloc_skb(len);
1421
1422 if (skb == NULL) {
1423 if (net_ratelimit()){
1424 printk(KERN_INFO "%s: no socket buffers available!\n",
1425 card->devname);
1426 }
1427 ++card->wandev.stats.rx_dropped;
1428 goto rx_exit;
1429 }
1430
1431 /* Copy data to the socket buffer */
1432 if((addr + len) > card->u.c.rx_top + 1) {
1433 unsigned tmp = card->u.c.rx_top - addr + 1;
1434 buf = skb_put(skb, tmp);
1435 sdla_peek(&card->hw, addr, buf, tmp);
1436 addr = card->u.c.rx_base;
1437 len -= tmp;
1438 }
1439
1440 buf = skb_put(skb, len);
1441 sdla_peek(&card->hw, addr, buf, len);
1442
1443 skb->protocol = htons(ETH_P_WAN_PPP);
1444
1445 card->wandev.stats.rx_packets ++;
1446 card->wandev.stats.rx_bytes += skb->len;
1447 udp_type = udp_pkt_type( skb, card );
1448
1449 if(udp_type == UDP_CPIPE_TYPE) {
1450 if(store_udp_mgmt_pkt(UDP_PKT_FRM_NETWORK,
1451 card, skb, dev, chdlc_priv_area)) {
1452 flags->interrupt_info_struct.
1453 interrupt_permission |=
1454 APP_INT_ON_TIMER;
1455 }
1456 }else{
1457 /* Pass it up the protocol stack */
1458 skb->dev = dev;
1459 skb->mac.raw = skb->data;
1460 netif_rx(skb);
1461 dev->last_rx = jiffies;
1462 }
1463
1464rx_exit:
1465 /* Release buffer element and calculate a pointer to the next one */
1466 rxbuf->opp_flag = 0x00;
1467 card->u.c.rxmb = ++ rxbuf;
1468 if((void*)rxbuf > card->u.c.rxbuf_last){
1469 card->u.c.rxmb = card->u.c.rxbuf_base;
1470 }
1471}
1472
1473/*============================================================================
1474 * Timer interrupt handler.
1475 * The timer interrupt is used for two purposes:
1476 * 1) Processing udp calls from 'cpipemon'.
1477 * 2) Reading board-level statistics for updating the proc file system.
1478 */
1479void timer_intr(sdla_t *card)
1480{
1481 struct net_device* dev;
1482 chdlc_private_area_t* chdlc_priv_area = NULL;
1483 SHARED_MEMORY_INFO_STRUCT* flags = NULL;
1484
1485 dev = card->wandev.dev;
1486 chdlc_priv_area = dev->priv;
1487
1488 if (chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_CONFIG) {
1489 if (!config_chdlc(card)){
1490 chdlc_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_CONFIG;
1491 }
1492 }
1493
1494 /* process a udp call if pending */
1495 if(chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_UDP) {
1496 process_udp_mgmt_pkt(card, dev,
1497 chdlc_priv_area);
1498 chdlc_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_UDP;
1499 }
1500
1501
1502 /* read the communications statistics if required */
1503 if(chdlc_priv_area->timer_int_enabled & TMR_INT_ENABLED_UPDATE) {
1504 update_comms_stats(card, chdlc_priv_area);
1505 if(!(-- chdlc_priv_area->update_comms_stats)) {
1506 chdlc_priv_area->timer_int_enabled &=
1507 ~TMR_INT_ENABLED_UPDATE;
1508 }
1509 }
1510
1511 /* only disable the timer interrupt if there are no udp or statistic */
1512 /* updates pending */
1513 if(!chdlc_priv_area->timer_int_enabled) {
1514 flags = card->u.c.flags;
1515 flags->interrupt_info_struct.interrupt_permission &=
1516 ~APP_INT_ON_TIMER;
1517 }
1518}
1519
1520/*------------------------------------------------------------------------------
1521 Miscellaneous Functions
1522 - set_chdlc_config() used to set configuration options on the board
1523------------------------------------------------------------------------------*/
1524
1525static int set_chdlc_config(sdla_t* card)
1526{
1527
1528 CHDLC_CONFIGURATION_STRUCT cfg;
1529
1530 memset(&cfg, 0, sizeof(CHDLC_CONFIGURATION_STRUCT));
1531
1532 if(card->wandev.clocking)
1533 cfg.baud_rate = card->wandev.bps;
1534
1535 cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ?
1536 INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35;
1537
1538 cfg.modem_config_options = 0;
1539 //API OPTIONS
1540 cfg.CHDLC_API_options = DISCARD_RX_ERROR_FRAMES;
1541 cfg.modem_status_timer = 100;
1542 cfg.CHDLC_protocol_options = HDLC_STREAMING_MODE;
1543 cfg.percent_data_buffer_for_Tx = 50;
1544 cfg.CHDLC_statistics_options = (CHDLC_TX_DATA_BYTE_COUNT_STAT |
1545 CHDLC_RX_DATA_BYTE_COUNT_STAT);
1546 cfg.max_CHDLC_data_field_length = card->wandev.mtu;
1547
1548 cfg.transmit_keepalive_timer = 0;
1549 cfg.receive_keepalive_timer = 0;
1550 cfg.keepalive_error_tolerance = 0;
1551 cfg.SLARP_request_timer = 0;
1552
1553 cfg.IP_address = 0;
1554 cfg.IP_netmask = 0;
1555
1556 return chdlc_configure(card, &cfg);
1557}
1558
1559/*============================================================================
1560 * Process global exception condition
1561 */
1562static int process_global_exception(sdla_t *card)
1563{
1564 CHDLC_MAILBOX_STRUCT* mbox = card->mbox;
1565 int err;
1566
1567 mbox->buffer_length = 0;
1568 mbox->command = READ_GLOBAL_EXCEPTION_CONDITION;
1569 err = sdla_exec(mbox) ? mbox->return_code : CMD_TIMEOUT;
1570
1571 if(err != CMD_TIMEOUT ){
1572
1573 switch(mbox->return_code) {
1574
1575 case EXCEP_MODEM_STATUS_CHANGE:
1576
1577 printk(KERN_INFO "%s: Modem status change\n",
1578 card->devname);
1579
1580 switch(mbox->data[0] & (DCD_HIGH | CTS_HIGH)) {
1581 case (DCD_HIGH):
1582 printk(KERN_INFO "%s: DCD high, CTS low\n",card->devname);
1583 break;
1584 case (CTS_HIGH):
1585 printk(KERN_INFO "%s: DCD low, CTS high\n",card->devname);
1586 break;
1587 case ((DCD_HIGH | CTS_HIGH)):
1588 printk(KERN_INFO "%s: DCD high, CTS high\n",card->devname);
1589 break;
1590 default:
1591 printk(KERN_INFO "%s: DCD low, CTS low\n",card->devname);
1592 break;
1593 }
1594
1595 if (!(mbox->data[0] & DCD_HIGH) || !(mbox->data[0] & DCD_HIGH)){
1596 //printk(KERN_INFO "Sending TERM Request Manually !\n");
1597 send_ppp_term_request(card->wandev.dev);
1598 }
1599 break;
1600
1601 case EXCEP_TRC_DISABLED:
1602 printk(KERN_INFO "%s: Line trace disabled\n",
1603 card->devname);
1604 break;
1605
1606 case EXCEP_IRQ_TIMEOUT:
1607 printk(KERN_INFO "%s: IRQ timeout occurred\n",
1608 card->devname);
1609 break;
1610
1611 default:
1612 printk(KERN_INFO "%s: Global exception %x\n",
1613 card->devname, mbox->return_code);
1614 break;
1615 }
1616 }
1617 return 0;
1618}
1619
1620
1621/*============================================================================
1622 * Process chdlc exception condition
1623 */
1624static int process_chdlc_exception(sdla_t *card)
1625{
1626 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
1627 int err;
1628
1629 mb->buffer_length = 0;
1630 mb->command = READ_CHDLC_EXCEPTION_CONDITION;
1631 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1632 if(err != CMD_TIMEOUT) {
1633
1634 switch (err) {
1635
1636 case EXCEP_LINK_ACTIVE:
1637 port_set_state(card, WAN_CONNECTED);
1638 break;
1639
1640 case EXCEP_LINK_INACTIVE_MODEM:
1641 port_set_state(card, WAN_DISCONNECTED);
1642 break;
1643
1644 case EXCEP_LOOPBACK_CONDITION:
1645 printk(KERN_INFO "%s: Loopback Condition Detected.\n",
1646 card->devname);
1647 break;
1648
1649 case NO_CHDLC_EXCEP_COND_TO_REPORT:
1650 printk(KERN_INFO "%s: No exceptions reported.\n",
1651 card->devname);
1652 break;
1653 default:
1654 printk(KERN_INFO "%s: Exception Condition %x!\n",
1655 card->devname,err);
1656 break;
1657 }
1658
1659 }
1660 return 0;
1661}
1662
1663
1664/*=============================================================================
1665 * Store a UDP management packet for later processing.
1666 */
1667
1668static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
1669 struct sk_buff *skb, struct net_device* dev,
1670 chdlc_private_area_t* chdlc_priv_area )
1671{
1672 int udp_pkt_stored = 0;
1673
1674 if(!chdlc_priv_area->udp_pkt_lgth &&
1675 (skb->len <= MAX_LGTH_UDP_MGNT_PKT)) {
1676 chdlc_priv_area->udp_pkt_lgth = skb->len;
1677 chdlc_priv_area->udp_pkt_src = udp_pkt_src;
1678 memcpy(chdlc_priv_area->udp_pkt_data, skb->data, skb->len);
1679 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UDP;
1680 udp_pkt_stored = 1;
1681 }
1682
1683 if(udp_pkt_src == UDP_PKT_FRM_STACK)
1684 dev_kfree_skb_any(skb);
1685 else
1686 dev_kfree_skb_any(skb);
1687
1688 return(udp_pkt_stored);
1689}
1690
1691
1692/*=============================================================================
1693 * Process UDP management packet.
1694 */
1695
1696static int process_udp_mgmt_pkt(sdla_t* card, struct net_device* dev,
1697 chdlc_private_area_t* chdlc_priv_area )
1698{
1699 unsigned char *buf;
1700 unsigned int frames, len;
1701 struct sk_buff *new_skb;
1702 unsigned short buffer_length, real_len;
1703 unsigned long data_ptr;
1704 unsigned data_length;
1705 int udp_mgmt_req_valid = 1;
1706 CHDLC_MAILBOX_STRUCT *mb = card->mbox;
1707 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
1708 chdlc_udp_pkt_t *chdlc_udp_pkt;
1709 struct timeval tv;
1710 int err;
1711 char ut_char;
1712
1713 chdlc_udp_pkt = (chdlc_udp_pkt_t *) chdlc_priv_area->udp_pkt_data;
1714
1715 if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) {
1716
1717 switch(chdlc_udp_pkt->cblock.command) {
1718 case READ_GLOBAL_STATISTICS:
1719 case READ_MODEM_STATUS:
1720 case READ_CHDLC_LINK_STATUS:
1721 case CPIPE_ROUTER_UP_TIME:
1722 case READ_COMMS_ERROR_STATS:
1723 case READ_CHDLC_OPERATIONAL_STATS:
1724
1725 /* These two commands are executed for
1726 * each request */
1727 case READ_CHDLC_CONFIGURATION:
1728 case READ_CHDLC_CODE_VERSION:
1729 udp_mgmt_req_valid = 1;
1730 break;
1731 default:
1732 udp_mgmt_req_valid = 0;
1733 break;
1734 }
1735 }
1736
1737 if(!udp_mgmt_req_valid) {
1738
1739 /* set length to 0 */
1740 chdlc_udp_pkt->cblock.buffer_length = 0;
1741
1742 /* set return code */
1743 chdlc_udp_pkt->cblock.return_code = 0xCD;
1744
1745 if (net_ratelimit()){
1746 printk(KERN_INFO
1747 "%s: Warning, Illegal UDP command attempted from network: %x\n",
1748 card->devname,chdlc_udp_pkt->cblock.command);
1749 }
1750
1751 } else {
1752 unsigned long trace_status_cfg_addr = 0;
1753 TRACE_STATUS_EL_CFG_STRUCT trace_cfg_struct;
1754 TRACE_STATUS_ELEMENT_STRUCT trace_element_struct;
1755
1756 switch(chdlc_udp_pkt->cblock.command) {
1757
1758 case CPIPE_ENABLE_TRACING:
1759 if (!chdlc_priv_area->TracingEnabled) {
1760
1761 /* OPERATE_DATALINE_MONITOR */
1762
1763 mb->buffer_length = sizeof(LINE_TRACE_CONFIG_STRUCT);
1764 mb->command = SET_TRACE_CONFIGURATION;
1765
1766 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
1767 trace_config = TRACE_ACTIVE;
1768 /* Trace delay mode is not used because it slows
1769 down transfer and results in a standoff situation
1770 when there is a lot of data */
1771
1772 /* Configure the Trace based on user inputs */
1773 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->trace_config |=
1774 chdlc_udp_pkt->data[0];
1775
1776 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
1777 trace_deactivation_timer = 4000;
1778
1779
1780 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1781 if (err != COMMAND_OK) {
1782 chdlc_error(card,err,mb);
1783 card->TracingEnabled = 0;
1784 chdlc_udp_pkt->cblock.return_code = err;
1785 mb->buffer_length = 0;
1786 break;
1787 }
1788
1789 /* Get the base address of the trace element list */
1790 mb->buffer_length = 0;
1791 mb->command = READ_TRACE_CONFIGURATION;
1792 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1793
1794 if (err != COMMAND_OK) {
1795 chdlc_error(card,err,mb);
1796 chdlc_priv_area->TracingEnabled = 0;
1797 chdlc_udp_pkt->cblock.return_code = err;
1798 mb->buffer_length = 0;
1799 break;
1800 }
1801
1802 trace_status_cfg_addr =((LINE_TRACE_CONFIG_STRUCT *)
1803 mb->data) -> ptr_trace_stat_el_cfg_struct;
1804
1805 sdla_peek(&card->hw, trace_status_cfg_addr,
1806 &trace_cfg_struct, sizeof(trace_cfg_struct));
1807
1808 chdlc_priv_area->start_trace_addr = trace_cfg_struct.
1809 base_addr_trace_status_elements;
1810
1811 chdlc_priv_area->number_trace_elements =
1812 trace_cfg_struct.number_trace_status_elements;
1813
1814 chdlc_priv_area->end_trace_addr = (unsigned long)
1815 ((TRACE_STATUS_ELEMENT_STRUCT *)
1816 chdlc_priv_area->start_trace_addr +
1817 (chdlc_priv_area->number_trace_elements - 1));
1818
1819 chdlc_priv_area->base_addr_trace_buffer =
1820 trace_cfg_struct.base_addr_trace_buffer;
1821
1822 chdlc_priv_area->end_addr_trace_buffer =
1823 trace_cfg_struct.end_addr_trace_buffer;
1824
1825 chdlc_priv_area->curr_trace_addr =
1826 trace_cfg_struct.next_trace_element_to_use;
1827
1828 chdlc_priv_area->available_buffer_space = 2000 -
1829 sizeof(ip_pkt_t) -
1830 sizeof(udp_pkt_t) -
1831 sizeof(wp_mgmt_t) -
1832 sizeof(cblock_t) -
1833 sizeof(trace_info_t);
1834 }
1835 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
1836 mb->buffer_length = 0;
1837 chdlc_priv_area->TracingEnabled = 1;
1838 break;
1839
1840
1841 case CPIPE_DISABLE_TRACING:
1842 if (chdlc_priv_area->TracingEnabled) {
1843
1844 /* OPERATE_DATALINE_MONITOR */
1845 mb->buffer_length = sizeof(LINE_TRACE_CONFIG_STRUCT);
1846 mb->command = SET_TRACE_CONFIGURATION;
1847 ((LINE_TRACE_CONFIG_STRUCT *)mb->data)->
1848 trace_config = TRACE_INACTIVE;
1849 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
1850 }
1851
1852 chdlc_priv_area->TracingEnabled = 0;
1853 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
1854 mb->buffer_length = 0;
1855 break;
1856
1857
1858 case CPIPE_GET_TRACE_INFO:
1859
1860 if (!chdlc_priv_area->TracingEnabled) {
1861 chdlc_udp_pkt->cblock.return_code = 1;
1862 mb->buffer_length = 0;
1863 break;
1864 }
1865
1866 chdlc_udp_pkt->trace_info.ismoredata = 0x00;
1867 buffer_length = 0; /* offset of packet already occupied */
1868
1869 for (frames=0; frames < chdlc_priv_area->number_trace_elements; frames++){
1870
1871 trace_pkt_t *trace_pkt = (trace_pkt_t *)
1872 &chdlc_udp_pkt->data[buffer_length];
1873
1874 sdla_peek(&card->hw, chdlc_priv_area->curr_trace_addr,
1875 (unsigned char *)&trace_element_struct,
1876 sizeof(TRACE_STATUS_ELEMENT_STRUCT));
1877
1878 if (trace_element_struct.opp_flag == 0x00) {
1879 break;
1880 }
1881
1882 /* get pointer to real data */
1883 data_ptr = trace_element_struct.ptr_data_bfr;
1884
1885 /* See if there is actual data on the trace buffer */
1886 if (data_ptr){
1887 data_length = trace_element_struct.trace_length;
1888 }else{
1889 data_length = 0;
1890 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
1891 }
1892
1893 if( (chdlc_priv_area->available_buffer_space - buffer_length)
1894 < ( sizeof(trace_pkt_t) + data_length) ) {
1895
1896 /* indicate there are more frames on board & exit */
1897 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
1898 break;
1899 }
1900
1901 trace_pkt->status = trace_element_struct.trace_type;
1902
1903 trace_pkt->time_stamp =
1904 trace_element_struct.trace_time_stamp;
1905
1906 trace_pkt->real_length =
1907 trace_element_struct.trace_length;
1908
1909 /* see if we can fit the frame into the user buffer */
1910 real_len = trace_pkt->real_length;
1911
1912 if (data_ptr == 0) {
1913 trace_pkt->data_avail = 0x00;
1914 } else {
1915 unsigned tmp = 0;
1916
1917 /* get the data from circular buffer
1918 must check for end of buffer */
1919 trace_pkt->data_avail = 0x01;
1920
1921 if ((data_ptr + real_len) >
1922 chdlc_priv_area->end_addr_trace_buffer + 1){
1923
1924 tmp = chdlc_priv_area->end_addr_trace_buffer - data_ptr + 1;
1925 sdla_peek(&card->hw, data_ptr,
1926 trace_pkt->data,tmp);
1927 data_ptr = chdlc_priv_area->base_addr_trace_buffer;
1928 }
1929
1930 sdla_peek(&card->hw, data_ptr,
1931 &trace_pkt->data[tmp], real_len - tmp);
1932 }
1933
1934 /* zero the opp flag to show we got the frame */
1935 ut_char = 0x00;
1936 sdla_poke(&card->hw, chdlc_priv_area->curr_trace_addr, &ut_char, 1);
1937
1938 /* now move onto the next frame */
1939 chdlc_priv_area->curr_trace_addr += sizeof(TRACE_STATUS_ELEMENT_STRUCT);
1940
1941 /* check if we went over the last address */
1942 if ( chdlc_priv_area->curr_trace_addr > chdlc_priv_area->end_trace_addr ) {
1943 chdlc_priv_area->curr_trace_addr = chdlc_priv_area->start_trace_addr;
1944 }
1945
1946 if(trace_pkt->data_avail == 0x01) {
1947 buffer_length += real_len - 1;
1948 }
1949
1950 /* for the header */
1951 buffer_length += sizeof(trace_pkt_t);
1952
1953 } /* For Loop */
1954
1955 if (frames == chdlc_priv_area->number_trace_elements){
1956 chdlc_udp_pkt->trace_info.ismoredata = 0x01;
1957 }
1958 chdlc_udp_pkt->trace_info.num_frames = frames;
1959
1960 mb->buffer_length = buffer_length;
1961 chdlc_udp_pkt->cblock.buffer_length = buffer_length;
1962
1963 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
1964
1965 break;
1966
1967
1968 case CPIPE_FT1_READ_STATUS:
1969 ((unsigned char *)chdlc_udp_pkt->data )[0] =
1970 flags->FT1_info_struct.parallel_port_A_input;
1971
1972 ((unsigned char *)chdlc_udp_pkt->data )[1] =
1973 flags->FT1_info_struct.parallel_port_B_input;
1974
1975 chdlc_udp_pkt->cblock.return_code = COMMAND_OK;
1976 mb->buffer_length = 2;
1977 break;
1978
1979 case CPIPE_ROUTER_UP_TIME:
1980 do_gettimeofday( &tv );
1981 chdlc_priv_area->router_up_time = tv.tv_sec -
1982 chdlc_priv_area->router_start_time;
1983 *(unsigned long *)&chdlc_udp_pkt->data =
1984 chdlc_priv_area->router_up_time;
1985 mb->buffer_length = sizeof(unsigned long);
1986 break;
1987
1988 case FT1_MONITOR_STATUS_CTRL:
1989 /* Enable FT1 MONITOR STATUS */
1990 if ((chdlc_udp_pkt->data[0] & ENABLE_READ_FT1_STATUS) ||
1991 (chdlc_udp_pkt->data[0] & ENABLE_READ_FT1_OP_STATS)) {
1992
1993 if( rCount++ != 0 ) {
1994 chdlc_udp_pkt->cblock.
1995 return_code = COMMAND_OK;
1996 mb->buffer_length = 1;
1997 break;
1998 }
1999 }
2000
2001 /* Disable FT1 MONITOR STATUS */
2002 if( chdlc_udp_pkt->data[0] == 0) {
2003
2004 if( --rCount != 0) {
2005 chdlc_udp_pkt->cblock.
2006 return_code = COMMAND_OK;
2007 mb->buffer_length = 1;
2008 break;
2009 }
2010 }
2011
2012 default:
2013 /* it's a board command */
2014 mb->command = chdlc_udp_pkt->cblock.command;
2015 mb->buffer_length = chdlc_udp_pkt->cblock.buffer_length;
2016 if (mb->buffer_length) {
2017 memcpy(&mb->data, (unsigned char *) chdlc_udp_pkt->
2018 data, mb->buffer_length);
2019 }
2020 /* run the command on the board */
2021 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2022 if (err != COMMAND_OK) {
2023 break;
2024 }
2025
2026 /* copy the result back to our buffer */
2027 memcpy(&chdlc_udp_pkt->cblock, mb, sizeof(cblock_t));
2028
2029 if (mb->buffer_length) {
2030 memcpy(&chdlc_udp_pkt->data, &mb->data,
2031 mb->buffer_length);
2032 }
2033
2034 } /* end of switch */
2035 } /* end of else */
2036
2037 /* Fill UDP TTL */
2038 chdlc_udp_pkt->ip_pkt.ttl = card->wandev.ttl;
2039
2040 len = reply_udp(chdlc_priv_area->udp_pkt_data, mb->buffer_length);
2041
2042 if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) {
2043 if(!chdlc_send(card, chdlc_priv_area->udp_pkt_data, len)) {
2044 ++ card->wandev.stats.tx_packets;
2045 card->wandev.stats.tx_bytes += len;
2046 }
2047 } else {
2048
2049 /* Pass it up the stack
2050 Allocate socket buffer */
2051 if ((new_skb = dev_alloc_skb(len)) != NULL) {
2052 /* copy data into new_skb */
2053
2054 buf = skb_put(new_skb, len);
2055 memcpy(buf, chdlc_priv_area->udp_pkt_data, len);
2056
2057 /* Decapsulate pkt and pass it up the protocol stack */
2058 new_skb->protocol = htons(ETH_P_IP);
2059 new_skb->dev = dev;
2060 new_skb->mac.raw = new_skb->data;
2061
2062 netif_rx(new_skb);
2063 dev->last_rx = jiffies;
2064 } else {
2065
2066 printk(KERN_INFO "%s: no socket buffers available!\n",
2067 card->devname);
2068 }
2069 }
2070
2071 chdlc_priv_area->udp_pkt_lgth = 0;
2072
2073 return 0;
2074}
2075
2076/*============================================================================
2077 * Initialize Receive and Transmit Buffers.
2078 */
2079
2080static void init_chdlc_tx_rx_buff(sdla_t* card, struct net_device *dev)
2081{
2082 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
2083 CHDLC_TX_STATUS_EL_CFG_STRUCT *tx_config;
2084 CHDLC_RX_STATUS_EL_CFG_STRUCT *rx_config;
2085 char err;
2086
2087 mb->buffer_length = 0;
2088 mb->command = READ_CHDLC_CONFIGURATION;
2089 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2090
2091 if(err != COMMAND_OK) {
2092 chdlc_error(card,err,mb);
2093 return;
2094 }
2095
2096 if(card->hw.type == SDLA_S514) {
2097 tx_config = (CHDLC_TX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
2098 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
2099 ptr_CHDLC_Tx_stat_el_cfg_struct));
2100 rx_config = (CHDLC_RX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
2101 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
2102 ptr_CHDLC_Rx_stat_el_cfg_struct));
2103
2104 /* Setup Head and Tails for buffers */
2105 card->u.c.txbuf_base = (void *)(card->hw.dpmbase +
2106 tx_config->base_addr_Tx_status_elements);
2107 card->u.c.txbuf_last =
2108 (CHDLC_DATA_TX_STATUS_EL_STRUCT *)
2109 card->u.c.txbuf_base +
2110 (tx_config->number_Tx_status_elements - 1);
2111
2112 card->u.c.rxbuf_base = (void *)(card->hw.dpmbase +
2113 rx_config->base_addr_Rx_status_elements);
2114 card->u.c.rxbuf_last =
2115 (CHDLC_DATA_RX_STATUS_EL_STRUCT *)
2116 card->u.c.rxbuf_base +
2117 (rx_config->number_Rx_status_elements - 1);
2118
2119 /* Set up next pointer to be used */
2120 card->u.c.txbuf = (void *)(card->hw.dpmbase +
2121 tx_config->next_Tx_status_element_to_use);
2122 card->u.c.rxmb = (void *)(card->hw.dpmbase +
2123 rx_config->next_Rx_status_element_to_use);
2124 }
2125 else {
2126 tx_config = (CHDLC_TX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
2127 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
2128 ptr_CHDLC_Tx_stat_el_cfg_struct % SDLA_WINDOWSIZE));
2129
2130 rx_config = (CHDLC_RX_STATUS_EL_CFG_STRUCT *)(card->hw.dpmbase +
2131 (((CHDLC_CONFIGURATION_STRUCT *)mb->data)->
2132 ptr_CHDLC_Rx_stat_el_cfg_struct % SDLA_WINDOWSIZE));
2133
2134 /* Setup Head and Tails for buffers */
2135 card->u.c.txbuf_base = (void *)(card->hw.dpmbase +
2136 (tx_config->base_addr_Tx_status_elements % SDLA_WINDOWSIZE));
2137 card->u.c.txbuf_last =
2138 (CHDLC_DATA_TX_STATUS_EL_STRUCT *)card->u.c.txbuf_base
2139 + (tx_config->number_Tx_status_elements - 1);
2140 card->u.c.rxbuf_base = (void *)(card->hw.dpmbase +
2141 (rx_config->base_addr_Rx_status_elements % SDLA_WINDOWSIZE));
2142 card->u.c.rxbuf_last =
2143 (CHDLC_DATA_RX_STATUS_EL_STRUCT *)card->u.c.rxbuf_base
2144 + (rx_config->number_Rx_status_elements - 1);
2145
2146 /* Set up next pointer to be used */
2147 card->u.c.txbuf = (void *)(card->hw.dpmbase +
2148 (tx_config->next_Tx_status_element_to_use % SDLA_WINDOWSIZE));
2149 card->u.c.rxmb = (void *)(card->hw.dpmbase +
2150 (rx_config->next_Rx_status_element_to_use % SDLA_WINDOWSIZE));
2151 }
2152
2153 /* Setup Actual Buffer Start and end addresses */
2154 card->u.c.rx_base = rx_config->base_addr_Rx_buffer;
2155 card->u.c.rx_top = rx_config->end_addr_Rx_buffer;
2156
2157}
2158
2159/*=============================================================================
2160 * Perform Interrupt Test by running READ_CHDLC_CODE_VERSION command MAX_INTR
2161 * _TEST_COUNTER times.
2162 */
2163static int intr_test( sdla_t* card)
2164{
2165 CHDLC_MAILBOX_STRUCT* mb = card->mbox;
2166 int err,i;
2167
2168 Intr_test_counter = 0;
2169
2170 /* The critical flag is unset because during initialization (if_open)
2171 * we want the interrupts to be enabled so that when the wpc_isr is
2172 * called it does not exit due to critical flag set.
2173 */
2174
2175 err = chdlc_set_intr_mode(card, APP_INT_ON_COMMAND_COMPLETE);
2176
2177 if (err == CMD_OK) {
2178 for (i = 0; i < MAX_INTR_TEST_COUNTER; i ++) {
2179 mb->buffer_length = 0;
2180 mb->command = READ_CHDLC_CODE_VERSION;
2181 err = sdla_exec(mb) ? mb->return_code : CMD_TIMEOUT;
2182 }
2183 }
2184 else {
2185 return err;
2186 }
2187
2188 err = chdlc_set_intr_mode(card, 0);
2189
2190 if (err != CMD_OK)
2191 return err;
2192
2193 return 0;
2194}
2195
2196/*==============================================================================
2197 * Determine what type of UDP call it is. CPIPEAB ?
2198 */
2199static int udp_pkt_type(struct sk_buff *skb, sdla_t* card)
2200{
2201 chdlc_udp_pkt_t *chdlc_udp_pkt = (chdlc_udp_pkt_t *)skb->data;
2202
2203 if (!strncmp(chdlc_udp_pkt->wp_mgmt.signature,UDPMGMT_SIGNATURE,8) &&
2204 (chdlc_udp_pkt->udp_pkt.udp_dst_port == ntohs(card->wandev.udp_port)) &&
2205 (chdlc_udp_pkt->ip_pkt.protocol == UDPMGMT_UDP_PROTOCOL) &&
2206 (chdlc_udp_pkt->wp_mgmt.request_reply == UDPMGMT_REQUEST)) {
2207 return UDP_CPIPE_TYPE;
2208 }
2209 else return UDP_INVALID_TYPE;
2210}
2211
2212/*============================================================================
2213 * Set PORT state.
2214 */
2215static void port_set_state (sdla_t *card, int state)
2216{
2217 struct net_device *dev = card->wandev.dev;
2218 chdlc_private_area_t *chdlc_priv_area = dev->priv;
2219
2220 if (card->u.c.state != state)
2221 {
2222 switch (state)
2223 {
2224 case WAN_CONNECTED:
2225 printk (KERN_INFO "%s: HDLC link connected!\n",
2226 card->devname);
2227 break;
2228
2229 case WAN_CONNECTING:
2230 printk (KERN_INFO "%s: HDLC link connecting...\n",
2231 card->devname);
2232 break;
2233
2234 case WAN_DISCONNECTED:
2235 printk (KERN_INFO "%s: HDLC link disconnected!\n",
2236 card->devname);
2237 break;
2238 }
2239
2240 card->wandev.state = card->u.c.state = state;
2241 chdlc_priv_area->common.state = state;
2242 }
2243}
2244
2245void s508_lock (sdla_t *card, unsigned long *smp_flags)
2246{
2247 spin_lock_irqsave(&card->wandev.lock, *smp_flags);
2248 if (card->next){
2249 /* It is ok to use spin_lock here, since we
2250 * already turned off interrupts */
2251 spin_lock(&card->next->wandev.lock);
2252 }
2253}
2254
2255void s508_unlock (sdla_t *card, unsigned long *smp_flags)
2256{
2257 if (card->next){
2258 spin_unlock(&card->next->wandev.lock);
2259 }
2260 spin_unlock_irqrestore(&card->wandev.lock, *smp_flags);
2261}
2262
2263
2264
2265/*===========================================================================
2266 * config_chdlc
2267 *
2268 * Configure the chdlc protocol and enable communications.
2269 *
2270 * The if_open() function binds this function to the poll routine.
2271 * Therefore, this function will run every time the chdlc interface
2272 * is brought up. We cannot run this function from the if_open
2273 * because if_open does not have access to the remote IP address.
2274 *
2275 * If the communications are not enabled, proceed to configure
2276 * the card and enable communications.
2277 *
2278 * If the communications are enabled, it means that the interface
2279 * was shutdown by ether the user or driver. In this case, we
2280 * have to check that the IP addresses have not changed. If
2281 * the IP addresses have changed, we have to reconfigure the firmware
2282 * and update the changed IP addresses. Otherwise, just exit.
2283 *
2284 */
2285
2286static int config_chdlc (sdla_t *card)
2287{
2288 struct net_device *dev = card->wandev.dev;
2289 SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
2290
2291 if (card->u.c.comm_enabled){
2292 chdlc_comm_disable(card);
2293 port_set_state(card, WAN_DISCONNECTED);
2294 }
2295
2296 if (set_chdlc_config(card)) {
2297 printk(KERN_INFO "%s: CHDLC Configuration Failed!\n",
2298 card->devname);
2299 return 0;
2300 }
2301 init_chdlc_tx_rx_buff(card, dev);
2302
2303 /* Set interrupt mode and mask */
2304 if (chdlc_set_intr_mode(card, APP_INT_ON_RX_FRAME |
2305 APP_INT_ON_GLOBAL_EXCEP_COND |
2306 APP_INT_ON_TX_FRAME |
2307 APP_INT_ON_CHDLC_EXCEP_COND | APP_INT_ON_TIMER)){
2308 printk (KERN_INFO "%s: Failed to set interrupt triggers!\n",
2309 card->devname);
2310 return 0;
2311 }
2312
2313
2314 /* Mask the Transmit and Timer interrupt */
2315 flags->interrupt_info_struct.interrupt_permission &=
2316 ~(APP_INT_ON_TX_FRAME | APP_INT_ON_TIMER);
2317
2318
2319 if (chdlc_comm_enable(card) != 0) {
2320 printk(KERN_INFO "%s: Failed to enable chdlc communications!\n",
2321 card->devname);
2322 flags->interrupt_info_struct.interrupt_permission = 0;
2323 card->u.c.comm_enabled=0;
2324 chdlc_set_intr_mode(card,0);
2325 return 0;
2326 }
2327
2328 /* Initialize Rx/Tx buffer control fields */
2329 port_set_state(card, WAN_CONNECTING);
2330 return 0;
2331}
2332
2333
2334static void send_ppp_term_request(struct net_device *dev)
2335{
2336 struct sk_buff *new_skb;
2337 unsigned char *buf;
2338
2339 if ((new_skb = dev_alloc_skb(8)) != NULL) {
2340 /* copy data into new_skb */
2341
2342 buf = skb_put(new_skb, 8);
2343 sprintf(buf,"%c%c%c%c%c%c%c%c", 0xFF,0x03,0xC0,0x21,0x05,0x98,0x00,0x07);
2344
2345 /* Decapsulate pkt and pass it up the protocol stack */
2346 new_skb->protocol = htons(ETH_P_WAN_PPP);
2347 new_skb->dev = dev;
2348 new_skb->mac.raw = new_skb->data;
2349
2350 netif_rx(new_skb);
2351 dev->last_rx = jiffies;
2352 }
2353}
2354
2355
2356MODULE_LICENSE("GPL");
2357
2358/****** End ****************************************************************/
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index bad09ebdb50b..e0874cbfefea 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -6,7 +6,7 @@ menu "Wireless LAN (non-hamradio)"
6 depends on NETDEVICES 6 depends on NETDEVICES
7 7
8config NET_RADIO 8config NET_RADIO
9 bool "Wireless LAN drivers (non-hamradio)" 9 bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions"
10 select WIRELESS_EXT 10 select WIRELESS_EXT
11 ---help--- 11 ---help---
12 Support for wireless LANs and everything having to do with radio, 12 Support for wireless LANs and everything having to do with radio,
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 108d9fed8f07..00764ddd74d8 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -3139,6 +3139,7 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3139 } 3139 }
3140 if ( status & EV_LINK ) { 3140 if ( status & EV_LINK ) {
3141 union iwreq_data wrqu; 3141 union iwreq_data wrqu;
3142 int scan_forceloss = 0;
3142 /* The link status has changed, if you want to put a 3143 /* The link status has changed, if you want to put a
3143 monitor hook in, do it here. (Remember that 3144 monitor hook in, do it here. (Remember that
3144 interrupts are still disabled!) 3145 interrupts are still disabled!)
@@ -3157,7 +3158,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3157 code) */ 3158 code) */
3158#define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason 3159#define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason
3159 code) */ 3160 code) */
3160#define ASSOCIATED 0x0400 /* Assocatied */ 3161#define ASSOCIATED 0x0400 /* Associated */
3162#define REASSOCIATED 0x0600 /* Reassociated? Only on firmware >= 5.30.17 */
3161#define RC_RESERVED 0 /* Reserved return code */ 3163#define RC_RESERVED 0 /* Reserved return code */
3162#define RC_NOREASON 1 /* Unspecified reason */ 3164#define RC_NOREASON 1 /* Unspecified reason */
3163#define RC_AUTHINV 2 /* Previous authentication invalid */ 3165#define RC_AUTHINV 2 /* Previous authentication invalid */
@@ -3174,44 +3176,30 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3174 leaving BSS */ 3176 leaving BSS */
3175#define RC_NOAUTH 9 /* Station requesting (Re)Association is not 3177#define RC_NOAUTH 9 /* Station requesting (Re)Association is not
3176 Authenticated with the responding station */ 3178 Authenticated with the responding station */
3177 if (newStatus != ASSOCIATED) { 3179 if (newStatus == FORCELOSS && apriv->scan_timeout > 0)
3178 if (auto_wep && !apriv->expires) { 3180 scan_forceloss = 1;
3179 apriv->expires = RUN_AT(3*HZ); 3181 if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) {
3180 wake_up_interruptible(&apriv->thr_wait);
3181 }
3182 } else {
3183 struct task_struct *task = apriv->task;
3184 if (auto_wep) 3182 if (auto_wep)
3185 apriv->expires = 0; 3183 apriv->expires = 0;
3186 if (task) 3184 if (apriv->task)
3187 wake_up_process (task); 3185 wake_up_process (apriv->task);
3188 set_bit(FLAG_UPDATE_UNI, &apriv->flags); 3186 set_bit(FLAG_UPDATE_UNI, &apriv->flags);
3189 set_bit(FLAG_UPDATE_MULTI, &apriv->flags); 3187 set_bit(FLAG_UPDATE_MULTI, &apriv->flags);
3190 } 3188
3191 /* Question : is ASSOCIATED the only status
3192 * that is valid ? We want to catch handover
3193 * and reassociations as valid status
3194 * Jean II */
3195 if(newStatus == ASSOCIATED) {
3196#if 0
3197 /* FIXME: Grabbing scan results here
3198 * seems to be too early??? Just wait for
3199 * timeout instead. */
3200 if (apriv->scan_timeout > 0) {
3201 set_bit(JOB_SCAN_RESULTS, &apriv->flags);
3202 wake_up_interruptible(&apriv->thr_wait);
3203 }
3204#endif
3205 if (down_trylock(&apriv->sem) != 0) { 3189 if (down_trylock(&apriv->sem) != 0) {
3206 set_bit(JOB_EVENT, &apriv->flags); 3190 set_bit(JOB_EVENT, &apriv->flags);
3207 wake_up_interruptible(&apriv->thr_wait); 3191 wake_up_interruptible(&apriv->thr_wait);
3208 } else 3192 } else
3209 airo_send_event(dev); 3193 airo_send_event(dev);
3210 } else { 3194 } else if (!scan_forceloss) {
3211 memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); 3195 if (auto_wep && !apriv->expires) {
3212 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 3196 apriv->expires = RUN_AT(3*HZ);
3197 wake_up_interruptible(&apriv->thr_wait);
3198 }
3213 3199
3214 /* Send event to user space */ 3200 /* Send event to user space */
3201 memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
3202 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
3215 wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL); 3203 wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL);
3216 } 3204 }
3217 } 3205 }
@@ -7136,10 +7124,10 @@ static int airo_set_scan(struct net_device *dev,
7136 goto out; 7124 goto out;
7137 7125
7138 /* Initiate a scan command */ 7126 /* Initiate a scan command */
7127 ai->scan_timeout = RUN_AT(3*HZ);
7139 memset(&cmd, 0, sizeof(cmd)); 7128 memset(&cmd, 0, sizeof(cmd));
7140 cmd.cmd=CMD_LISTBSS; 7129 cmd.cmd=CMD_LISTBSS;
7141 issuecommand(ai, &cmd, &rsp); 7130 issuecommand(ai, &cmd, &rsp);
7142 ai->scan_timeout = RUN_AT(3*HZ);
7143 wake = 1; 7131 wake = 1;
7144 7132
7145out: 7133out:
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 87afa6878f26..8606c88886fc 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3463,6 +3463,7 @@ static void atmel_command_irq(struct atmel_private *priv)
3463 u8 status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET)); 3463 u8 status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET));
3464 u8 command = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET)); 3464 u8 command = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET));
3465 int fast_scan; 3465 int fast_scan;
3466 union iwreq_data wrqu;
3466 3467
3467 if (status == CMD_STATUS_IDLE || 3468 if (status == CMD_STATUS_IDLE ||
3468 status == CMD_STATUS_IN_PROGRESS) 3469 status == CMD_STATUS_IN_PROGRESS)
@@ -3487,6 +3488,7 @@ static void atmel_command_irq(struct atmel_private *priv)
3487 atmel_scan(priv, 1); 3488 atmel_scan(priv, 1);
3488 } else { 3489 } else {
3489 int bss_index = retrieve_bss(priv); 3490 int bss_index = retrieve_bss(priv);
3491 int notify_scan_complete = 1;
3490 if (bss_index != -1) { 3492 if (bss_index != -1) {
3491 atmel_join_bss(priv, bss_index); 3493 atmel_join_bss(priv, bss_index);
3492 } else if (priv->operating_mode == IW_MODE_ADHOC && 3494 } else if (priv->operating_mode == IW_MODE_ADHOC &&
@@ -3495,8 +3497,14 @@ static void atmel_command_irq(struct atmel_private *priv)
3495 } else { 3497 } else {
3496 priv->fast_scan = !fast_scan; 3498 priv->fast_scan = !fast_scan;
3497 atmel_scan(priv, 1); 3499 atmel_scan(priv, 1);
3500 notify_scan_complete = 0;
3498 } 3501 }
3499 priv->site_survey_state = SITE_SURVEY_COMPLETED; 3502 priv->site_survey_state = SITE_SURVEY_COMPLETED;
3503 if (notify_scan_complete) {
3504 wrqu.data.length = 0;
3505 wrqu.data.flags = 0;
3506 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
3507 }
3500 } 3508 }
3501 break; 3509 break;
3502 3510
@@ -3509,6 +3517,9 @@ static void atmel_command_irq(struct atmel_private *priv)
3509 priv->site_survey_state = SITE_SURVEY_COMPLETED; 3517 priv->site_survey_state = SITE_SURVEY_COMPLETED;
3510 if (priv->station_is_associated) { 3518 if (priv->station_is_associated) {
3511 atmel_enter_state(priv, STATION_STATE_READY); 3519 atmel_enter_state(priv, STATION_STATE_READY);
3520 wrqu.data.length = 0;
3521 wrqu.data.flags = 0;
3522 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
3512 } else { 3523 } else {
3513 atmel_scan(priv, 1); 3524 atmel_scan(priv, 1);
3514 } 3525 }
diff --git a/drivers/net/wireless/bcm43xx/Kconfig b/drivers/net/wireless/bcm43xx/Kconfig
index 418465600a77..25ea4748f0b9 100644
--- a/drivers/net/wireless/bcm43xx/Kconfig
+++ b/drivers/net/wireless/bcm43xx/Kconfig
@@ -17,8 +17,11 @@ config BCM43XX_DEBUG
17 17
18config BCM43XX_DMA 18config BCM43XX_DMA
19 bool 19 bool
20 depends on BCM43XX
21
20config BCM43XX_PIO 22config BCM43XX_PIO
21 bool 23 bool
24 depends on BCM43XX
22 25
23choice 26choice
24 prompt "BCM43xx data transfer mode" 27 prompt "BCM43xx data transfer mode"
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index dcadd295de4f..2e83083935e1 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -15,7 +15,6 @@
15 15
16#include "bcm43xx_debugfs.h" 16#include "bcm43xx_debugfs.h"
17#include "bcm43xx_leds.h" 17#include "bcm43xx_leds.h"
18#include "bcm43xx_sysfs.h"
19 18
20 19
21#define PFX KBUILD_MODNAME ": " 20#define PFX KBUILD_MODNAME ": "
@@ -638,8 +637,6 @@ struct bcm43xx_key {
638}; 637};
639 638
640struct bcm43xx_private { 639struct bcm43xx_private {
641 struct bcm43xx_sysfs sysfs;
642
643 struct ieee80211_device *ieee; 640 struct ieee80211_device *ieee;
644 struct ieee80211softmac_device *softmac; 641 struct ieee80211softmac_device *softmac;
645 642
@@ -772,6 +769,20 @@ struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
772 return ieee80211softmac_priv(dev); 769 return ieee80211softmac_priv(dev);
773} 770}
774 771
772struct device;
773
774static inline
775struct bcm43xx_private * dev_to_bcm(struct device *dev)
776{
777 struct net_device *net_dev;
778 struct bcm43xx_private *bcm;
779
780 net_dev = dev_get_drvdata(dev);
781 bcm = bcm43xx_priv(net_dev);
782
783 return bcm;
784}
785
775 786
776/* Helper function, which returns a boolean. 787/* Helper function, which returns a boolean.
777 * TRUE, if PIO is used; FALSE, if DMA is used. 788 * TRUE, if PIO is used; FALSE, if DMA is used.
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
index d2c3401e9b70..35a4fcb6d923 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -452,12 +452,12 @@ void bcm43xx_printk_dump(const char *data,
452 size_t i; 452 size_t i;
453 char c; 453 char c;
454 454
455 printk(KERN_INFO PFX "Data dump (%s, %u bytes):", 455 printk(KERN_INFO PFX "Data dump (%s, %zd bytes):",
456 description, size); 456 description, size);
457 for (i = 0; i < size; i++) { 457 for (i = 0; i < size; i++) {
458 c = data[i]; 458 c = data[i];
459 if (i % 8 == 0) 459 if (i % 8 == 0)
460 printk("\n" KERN_INFO PFX "0x%08x: 0x%02x, ", i, c & 0xff); 460 printk("\n" KERN_INFO PFX "0x%08zx: 0x%02x, ", i, c & 0xff);
461 else 461 else
462 printk("0x%02x, ", c & 0xff); 462 printk("0x%02x, ", c & 0xff);
463 } 463 }
@@ -472,12 +472,12 @@ void bcm43xx_printk_bitdump(const unsigned char *data,
472 int j; 472 int j;
473 const unsigned char *d; 473 const unsigned char *d;
474 474
475 printk(KERN_INFO PFX "*** Bitdump (%s, %u bytes, %s) ***", 475 printk(KERN_INFO PFX "*** Bitdump (%s, %zd bytes, %s) ***",
476 description, bytes, msb_to_lsb ? "MSB to LSB" : "LSB to MSB"); 476 description, bytes, msb_to_lsb ? "MSB to LSB" : "LSB to MSB");
477 for (i = 0; i < bytes; i++) { 477 for (i = 0; i < bytes; i++) {
478 d = data + i; 478 d = data + i;
479 if (i % 8 == 0) 479 if (i % 8 == 0)
480 printk("\n" KERN_INFO PFX "0x%08x: ", i); 480 printk("\n" KERN_INFO PFX "0x%08zx: ", i);
481 if (msb_to_lsb) { 481 if (msb_to_lsb) {
482 for (j = 7; j >= 0; j--) { 482 for (j = 7; j >= 0; j--) {
483 if (*d & (1 << j)) 483 if (*d & (1 << j))
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index c3681b8f09b4..bbecba02e697 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -196,8 +196,9 @@ static int alloc_ringmemory(struct bcm43xx_dmaring *ring)
196 } 196 }
197 if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) { 197 if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) {
198 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G " 198 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G "
199 "(0x%08x, len: %lu)\n", 199 "(0x%llx, len: %lu)\n",
200 ring->dmabase, BCM43xx_DMA_RINGMEMSIZE); 200 (unsigned long long)ring->dmabase,
201 BCM43xx_DMA_RINGMEMSIZE);
201 dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE, 202 dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE,
202 ring->vbase, ring->dmabase); 203 ring->vbase, ring->dmabase);
203 return -ENOMEM; 204 return -ENOMEM;
@@ -307,8 +308,8 @@ static int setup_rx_descbuffer(struct bcm43xx_dmaring *ring,
307 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); 308 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
308 dev_kfree_skb_any(skb); 309 dev_kfree_skb_any(skb);
309 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G " 310 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G "
310 "(0x%08x, len: %u)\n", 311 "(0x%llx, len: %u)\n",
311 dmaaddr, ring->rx_buffersize); 312 (unsigned long long)dmaaddr, ring->rx_buffersize);
312 return -ENOMEM; 313 return -ENOMEM;
313 } 314 }
314 meta->skb = skb; 315 meta->skb = skb;
@@ -729,8 +730,8 @@ static int dma_tx_fragment(struct bcm43xx_dmaring *ring,
729 if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) { 730 if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) {
730 return_slot(ring, slot); 731 return_slot(ring, slot);
731 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G " 732 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G "
732 "(0x%08x, len: %u)\n", 733 "(0x%llx, len: %u)\n",
733 meta->dmaaddr, skb->len); 734 (unsigned long long)meta->dmaaddr, skb->len);
734 return -ENOMEM; 735 return -ENOMEM;
735 } 736 }
736 737
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index c37371fc9e01..9a06e61df0a2 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -52,6 +52,7 @@
52#include "bcm43xx_wx.h" 52#include "bcm43xx_wx.h"
53#include "bcm43xx_ethtool.h" 53#include "bcm43xx_ethtool.h"
54#include "bcm43xx_xmit.h" 54#include "bcm43xx_xmit.h"
55#include "bcm43xx_sysfs.h"
55 56
56 57
57MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver"); 58MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver");
@@ -3522,6 +3523,7 @@ static inline int bcm43xx_tx(struct bcm43xx_private *bcm,
3522 err = bcm43xx_pio_tx(bcm, txb); 3523 err = bcm43xx_pio_tx(bcm, txb);
3523 else 3524 else
3524 err = bcm43xx_dma_tx(bcm, txb); 3525 err = bcm43xx_dma_tx(bcm, txb);
3526 bcm->net_dev->trans_start = jiffies;
3525 3527
3526 return err; 3528 return err;
3527} 3529}
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index 0a66f43ca0c0..33137165727f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -2151,6 +2151,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
2151 phy->tssi2dbm = NULL; 2151 phy->tssi2dbm = NULL;
2152 printk(KERN_ERR PFX "Could not generate " 2152 printk(KERN_ERR PFX "Could not generate "
2153 "tssi2dBm table\n"); 2153 "tssi2dBm table\n");
2154 kfree(dyn_tssi2dbm);
2154 return -ENODEV; 2155 return -ENODEV;
2155 } 2156 }
2156 phy->tssi2dbm = dyn_tssi2dbm; 2157 phy->tssi2dbm = dyn_tssi2dbm;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_power.c b/drivers/net/wireless/bcm43xx/bcm43xx_power.c
index 3c92b62807c5..6569da3a7a39 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_power.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_power.c
@@ -35,77 +35,101 @@
35#include "bcm43xx_main.h" 35#include "bcm43xx_main.h"
36 36
37 37
38/* Get the Slow Clock Source */
39static int bcm43xx_pctl_get_slowclksrc(struct bcm43xx_private *bcm)
40{
41 u32 tmp;
42 int err;
43
44 assert(bcm->current_core == &bcm->core_chipcommon);
45 if (bcm->current_core->rev < 6) {
46 if (bcm->bustype == BCM43xx_BUSTYPE_PCMCIA ||
47 bcm->bustype == BCM43xx_BUSTYPE_SB)
48 return BCM43xx_PCTL_CLKSRC_XTALOS;
49 if (bcm->bustype == BCM43xx_BUSTYPE_PCI) {
50 err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp);
51 assert(!err);
52 if (tmp & 0x10)
53 return BCM43xx_PCTL_CLKSRC_PCI;
54 return BCM43xx_PCTL_CLKSRC_XTALOS;
55 }
56 }
57 if (bcm->current_core->rev < 10) {
58 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL);
59 tmp &= 0x7;
60 if (tmp == 0)
61 return BCM43xx_PCTL_CLKSRC_LOPWROS;
62 if (tmp == 1)
63 return BCM43xx_PCTL_CLKSRC_XTALOS;
64 if (tmp == 2)
65 return BCM43xx_PCTL_CLKSRC_PCI;
66 }
67
68 return BCM43xx_PCTL_CLKSRC_XTALOS;
69}
70
38/* Get max/min slowclock frequency 71/* Get max/min slowclock frequency
39 * as described in http://bcm-specs.sipsolutions.net/PowerControl 72 * as described in http://bcm-specs.sipsolutions.net/PowerControl
40 */ 73 */
41static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm, 74static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm,
42 int get_max) 75 int get_max)
43{ 76{
44 int limit = 0; 77 int limit;
78 int clocksrc;
45 int divisor; 79 int divisor;
46 int selection;
47 int err;
48 u32 tmp; 80 u32 tmp;
49 struct bcm43xx_coreinfo *old_core;
50 81
51 if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL)) 82 assert(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL);
52 goto out; 83 assert(bcm->current_core == &bcm->core_chipcommon);
53 old_core = bcm->current_core;
54 err = bcm43xx_switch_core(bcm, &bcm->core_chipcommon);
55 if (err)
56 goto out;
57 84
85 clocksrc = bcm43xx_pctl_get_slowclksrc(bcm);
58 if (bcm->current_core->rev < 6) { 86 if (bcm->current_core->rev < 6) {
59 if ((bcm->bustype == BCM43xx_BUSTYPE_PCMCIA) || 87 switch (clocksrc) {
60 (bcm->bustype == BCM43xx_BUSTYPE_SB)) { 88 case BCM43xx_PCTL_CLKSRC_PCI:
61 selection = 1; 89 divisor = 64;
90 break;
91 case BCM43xx_PCTL_CLKSRC_XTALOS:
62 divisor = 32; 92 divisor = 32;
63 } else { 93 break;
64 err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp); 94 default:
65 if (err) { 95 assert(0);
66 printk(KERN_ERR PFX "clockfreqlimit pcicfg read failure\n"); 96 divisor = 1;
67 goto out_switchback;
68 }
69 if (tmp & 0x10) {
70 /* PCI */
71 selection = 2;
72 divisor = 64;
73 } else {
74 /* XTAL */
75 selection = 1;
76 divisor = 32;
77 }
78 } 97 }
79 } else if (bcm->current_core->rev < 10) { 98 } else if (bcm->current_core->rev < 10) {
80 selection = (tmp & 0x07); 99 switch (clocksrc) {
81 if (selection) { 100 case BCM43xx_PCTL_CLKSRC_LOPWROS:
101 divisor = 1;
102 break;
103 case BCM43xx_PCTL_CLKSRC_XTALOS:
104 case BCM43xx_PCTL_CLKSRC_PCI:
82 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); 105 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL);
83 divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); 106 divisor = ((tmp & 0xFFFF0000) >> 16) + 1;
84 } else 107 divisor *= 4;
108 break;
109 default:
110 assert(0);
85 divisor = 1; 111 divisor = 1;
112 }
86 } else { 113 } else {
87 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL); 114 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL);
88 divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); 115 divisor = ((tmp & 0xFFFF0000) >> 16) + 1;
89 selection = 1; 116 divisor *= 4;
90 } 117 }
91 118
92 switch (selection) { 119 switch (clocksrc) {
93 case 0: 120 case BCM43xx_PCTL_CLKSRC_LOPWROS:
94 /* LPO */
95 if (get_max) 121 if (get_max)
96 limit = 43000; 122 limit = 43000;
97 else 123 else
98 limit = 25000; 124 limit = 25000;
99 break; 125 break;
100 case 1: 126 case BCM43xx_PCTL_CLKSRC_XTALOS:
101 /* XTAL */
102 if (get_max) 127 if (get_max)
103 limit = 20200000; 128 limit = 20200000;
104 else 129 else
105 limit = 19800000; 130 limit = 19800000;
106 break; 131 break;
107 case 2: 132 case BCM43xx_PCTL_CLKSRC_PCI:
108 /* PCI */
109 if (get_max) 133 if (get_max)
110 limit = 34000000; 134 limit = 34000000;
111 else 135 else
@@ -113,17 +137,14 @@ static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm,
113 break; 137 break;
114 default: 138 default:
115 assert(0); 139 assert(0);
140 limit = 0;
116 } 141 }
117 limit /= divisor; 142 limit /= divisor;
118 143
119out_switchback:
120 err = bcm43xx_switch_core(bcm, old_core);
121 assert(err == 0);
122
123out:
124 return limit; 144 return limit;
125} 145}
126 146
147
127/* init power control 148/* init power control
128 * as described in http://bcm-specs.sipsolutions.net/PowerControl 149 * as described in http://bcm-specs.sipsolutions.net/PowerControl
129 */ 150 */
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_power.h b/drivers/net/wireless/bcm43xx/bcm43xx_power.h
index 5f63640810bd..c966ab3a5a8c 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_power.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_power.h
@@ -33,6 +33,15 @@
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35 35
36/* Clock sources */
37enum {
38 /* PCI clock */
39 BCM43xx_PCTL_CLKSRC_PCI,
40 /* Crystal slow clock oscillator */
41 BCM43xx_PCTL_CLKSRC_XTALOS,
42 /* Low power oscillator */
43 BCM43xx_PCTL_CLKSRC_LOPWROS,
44};
36 45
37struct bcm43xx_private; 46struct bcm43xx_private;
38 47
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
index c44d890b949b..b438f48e891d 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
@@ -71,14 +71,46 @@ static int get_boolean(const char *buf, size_t count)
71 return -EINVAL; 71 return -EINVAL;
72} 72}
73 73
74static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len)
75{
76 int i, pos = 0;
77
78 for (i = 0; i < BCM43xx_SPROM_SIZE; i++) {
79 pos += snprintf(buf + pos, buf_len - pos - 1,
80 "%04X", swab16(sprom[i]) & 0xFFFF);
81 }
82 pos += snprintf(buf + pos, buf_len - pos - 1, "\n");
83
84 return pos + 1;
85}
86
87static int hex2sprom(u16 *sprom, const char *dump, size_t len)
88{
89 char tmp[5] = { 0 };
90 int cnt = 0;
91 unsigned long parsed;
92
93 if (len < BCM43xx_SPROM_SIZE * sizeof(u16) * 2)
94 return -EINVAL;
95
96 while (cnt < BCM43xx_SPROM_SIZE) {
97 memcpy(tmp, dump, 4);
98 dump += 4;
99 parsed = simple_strtoul(tmp, NULL, 16);
100 sprom[cnt++] = swab16((u16)parsed);
101 }
102
103 return 0;
104}
105
74static ssize_t bcm43xx_attr_sprom_show(struct device *dev, 106static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
75 struct device_attribute *attr, 107 struct device_attribute *attr,
76 char *buf) 108 char *buf)
77{ 109{
78 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); 110 struct bcm43xx_private *bcm = dev_to_bcm(dev);
79 u16 *sprom; 111 u16 *sprom;
80 unsigned long flags; 112 unsigned long flags;
81 int i, err; 113 int err;
82 114
83 if (!capable(CAP_NET_ADMIN)) 115 if (!capable(CAP_NET_ADMIN))
84 return -EPERM; 116 return -EPERM;
@@ -91,55 +123,53 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
91 bcm43xx_lock_mmio(bcm, flags); 123 bcm43xx_lock_mmio(bcm, flags);
92 assert(bcm->initialized); 124 assert(bcm->initialized);
93 err = bcm43xx_sprom_read(bcm, sprom); 125 err = bcm43xx_sprom_read(bcm, sprom);
94 if (!err) { 126 if (!err)
95 for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { 127 err = sprom2hex(sprom, buf, PAGE_SIZE);
96 buf[i * 2] = sprom[i] & 0x00FF;
97 buf[i * 2 + 1] = (sprom[i] & 0xFF00) >> 8;
98 }
99 }
100 bcm43xx_unlock_mmio(bcm, flags); 128 bcm43xx_unlock_mmio(bcm, flags);
101 kfree(sprom); 129 kfree(sprom);
102 130
103 return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16); 131 return err;
104} 132}
105 133
106static ssize_t bcm43xx_attr_sprom_store(struct device *dev, 134static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
107 struct device_attribute *attr, 135 struct device_attribute *attr,
108 const char *buf, size_t count) 136 const char *buf, size_t count)
109{ 137{
110 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); 138 struct bcm43xx_private *bcm = dev_to_bcm(dev);
111 u16 *sprom; 139 u16 *sprom;
112 unsigned long flags; 140 unsigned long flags;
113 int i, err; 141 int err;
114 142
115 if (!capable(CAP_NET_ADMIN)) 143 if (!capable(CAP_NET_ADMIN))
116 return -EPERM; 144 return -EPERM;
117 145
118 if (count != BCM43xx_SPROM_SIZE * sizeof(u16))
119 return -EINVAL;
120 sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom), 146 sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom),
121 GFP_KERNEL); 147 GFP_KERNEL);
122 if (!sprom) 148 if (!sprom)
123 return -ENOMEM; 149 return -ENOMEM;
124 for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { 150 err = hex2sprom(sprom, buf, count);
125 sprom[i] = buf[i * 2] & 0xFF; 151 if (err)
126 sprom[i] |= ((u16)(buf[i * 2 + 1] & 0xFF)) << 8; 152 goto out_kfree;
127 }
128 bcm43xx_lock_mmio(bcm, flags); 153 bcm43xx_lock_mmio(bcm, flags);
129 assert(bcm->initialized); 154 assert(bcm->initialized);
130 err = bcm43xx_sprom_write(bcm, sprom); 155 err = bcm43xx_sprom_write(bcm, sprom);
131 bcm43xx_unlock_mmio(bcm, flags); 156 bcm43xx_unlock_mmio(bcm, flags);
157out_kfree:
132 kfree(sprom); 158 kfree(sprom);
133 159
134 return err ? err : count; 160 return err ? err : count;
135 161
136} 162}
137 163
164static DEVICE_ATTR(sprom, 0600,
165 bcm43xx_attr_sprom_show,
166 bcm43xx_attr_sprom_store);
167
138static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, 168static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
139 struct device_attribute *attr, 169 struct device_attribute *attr,
140 char *buf) 170 char *buf)
141{ 171{
142 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); 172 struct bcm43xx_private *bcm = dev_to_bcm(dev);
143 unsigned long flags; 173 unsigned long flags;
144 int err; 174 int err;
145 ssize_t count = 0; 175 ssize_t count = 0;
@@ -175,7 +205,7 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev,
175 struct device_attribute *attr, 205 struct device_attribute *attr,
176 const char *buf, size_t count) 206 const char *buf, size_t count)
177{ 207{
178 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); 208 struct bcm43xx_private *bcm = dev_to_bcm(dev);
179 unsigned long flags; 209 unsigned long flags;
180 int err; 210 int err;
181 int mode; 211 int mode;
@@ -215,11 +245,15 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev,
215 return err ? err : count; 245 return err ? err : count;
216} 246}
217 247
248static DEVICE_ATTR(interference, 0644,
249 bcm43xx_attr_interfmode_show,
250 bcm43xx_attr_interfmode_store);
251
218static ssize_t bcm43xx_attr_preamble_show(struct device *dev, 252static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
219 struct device_attribute *attr, 253 struct device_attribute *attr,
220 char *buf) 254 char *buf)
221{ 255{
222 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); 256 struct bcm43xx_private *bcm = dev_to_bcm(dev);
223 unsigned long flags; 257 unsigned long flags;
224 int err; 258 int err;
225 ssize_t count; 259 ssize_t count;
@@ -245,7 +279,7 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev,
245 struct device_attribute *attr, 279 struct device_attribute *attr,
246 const char *buf, size_t count) 280 const char *buf, size_t count)
247{ 281{
248 struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); 282 struct bcm43xx_private *bcm = dev_to_bcm(dev);
249 unsigned long flags; 283 unsigned long flags;
250 int err; 284 int err;
251 int value; 285 int value;
@@ -267,56 +301,41 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev,
267 return err ? err : count; 301 return err ? err : count;
268} 302}
269 303
304static DEVICE_ATTR(shortpreamble, 0644,
305 bcm43xx_attr_preamble_show,
306 bcm43xx_attr_preamble_store);
307
270int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) 308int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
271{ 309{
272 struct device *dev = &bcm->pci_dev->dev; 310 struct device *dev = &bcm->pci_dev->dev;
273 struct bcm43xx_sysfs *sysfs = &bcm->sysfs;
274 int err; 311 int err;
275 312
276 assert(bcm->initialized); 313 assert(bcm->initialized);
277 314
278 sysfs->attr_sprom.attr.name = "sprom"; 315 err = device_create_file(dev, &dev_attr_sprom);
279 sysfs->attr_sprom.attr.owner = THIS_MODULE;
280 sysfs->attr_sprom.attr.mode = 0600;
281 sysfs->attr_sprom.show = bcm43xx_attr_sprom_show;
282 sysfs->attr_sprom.store = bcm43xx_attr_sprom_store;
283 err = device_create_file(dev, &sysfs->attr_sprom);
284 if (err) 316 if (err)
285 goto out; 317 goto out;
286 318 err = device_create_file(dev, &dev_attr_interference);
287 sysfs->attr_interfmode.attr.name = "interference";
288 sysfs->attr_interfmode.attr.owner = THIS_MODULE;
289 sysfs->attr_interfmode.attr.mode = 0600;
290 sysfs->attr_interfmode.show = bcm43xx_attr_interfmode_show;
291 sysfs->attr_interfmode.store = bcm43xx_attr_interfmode_store;
292 err = device_create_file(dev, &sysfs->attr_interfmode);
293 if (err) 319 if (err)
294 goto err_remove_sprom; 320 goto err_remove_sprom;
295 321 err = device_create_file(dev, &dev_attr_shortpreamble);
296 sysfs->attr_preamble.attr.name = "shortpreamble";
297 sysfs->attr_preamble.attr.owner = THIS_MODULE;
298 sysfs->attr_preamble.attr.mode = 0600;
299 sysfs->attr_preamble.show = bcm43xx_attr_preamble_show;
300 sysfs->attr_preamble.store = bcm43xx_attr_preamble_store;
301 err = device_create_file(dev, &sysfs->attr_preamble);
302 if (err) 322 if (err)
303 goto err_remove_interfmode; 323 goto err_remove_interfmode;
304 324
305out: 325out:
306 return err; 326 return err;
307err_remove_interfmode: 327err_remove_interfmode:
308 device_remove_file(dev, &sysfs->attr_interfmode); 328 device_remove_file(dev, &dev_attr_interference);
309err_remove_sprom: 329err_remove_sprom:
310 device_remove_file(dev, &sysfs->attr_sprom); 330 device_remove_file(dev, &dev_attr_sprom);
311 goto out; 331 goto out;
312} 332}
313 333
314void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm) 334void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm)
315{ 335{
316 struct device *dev = &bcm->pci_dev->dev; 336 struct device *dev = &bcm->pci_dev->dev;
317 struct bcm43xx_sysfs *sysfs = &bcm->sysfs;
318 337
319 device_remove_file(dev, &sysfs->attr_preamble); 338 device_remove_file(dev, &dev_attr_shortpreamble);
320 device_remove_file(dev, &sysfs->attr_interfmode); 339 device_remove_file(dev, &dev_attr_interference);
321 device_remove_file(dev, &sysfs->attr_sprom); 340 device_remove_file(dev, &dev_attr_sprom);
322} 341}
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h
index 57f14514e3e0..cc701df71e2a 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h
@@ -1,22 +1,6 @@
1#ifndef BCM43xx_SYSFS_H_ 1#ifndef BCM43xx_SYSFS_H_
2#define BCM43xx_SYSFS_H_ 2#define BCM43xx_SYSFS_H_
3 3
4#include <linux/device.h>
5
6
7struct bcm43xx_sysfs {
8 struct device_attribute attr_sprom;
9 struct device_attribute attr_interfmode;
10 struct device_attribute attr_preamble;
11};
12
13#define devattr_to_bcm(attr, attr_name) ({ \
14 struct bcm43xx_sysfs *__s; struct bcm43xx_private *__p; \
15 __s = container_of((attr), struct bcm43xx_sysfs, attr_name); \
16 __p = container_of(__s, struct bcm43xx_private, sysfs); \
17 __p; \
18 })
19
20struct bcm43xx_private; 4struct bcm43xx_private;
21 5
22int bcm43xx_sysfs_register(struct bcm43xx_private *bcm); 6int bcm43xx_sysfs_register(struct bcm43xx_private *bcm);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index 3daee828ef4b..3edbb481a0a0 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -962,22 +962,22 @@ static const struct iw_priv_args bcm43xx_priv_wx_args[] = {
962 { 962 {
963 .cmd = PRIV_WX_SET_SHORTPREAMBLE, 963 .cmd = PRIV_WX_SET_SHORTPREAMBLE,
964 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 964 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
965 .name = "set_shortpreambl", 965 .name = "set_shortpreamb",
966 }, 966 },
967 { 967 {
968 .cmd = PRIV_WX_GET_SHORTPREAMBLE, 968 .cmd = PRIV_WX_GET_SHORTPREAMBLE,
969 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 969 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
970 .name = "get_shortpreambl", 970 .name = "get_shortpreamb",
971 }, 971 },
972 { 972 {
973 .cmd = PRIV_WX_SET_SWENCRYPTION, 973 .cmd = PRIV_WX_SET_SWENCRYPTION,
974 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 974 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
975 .name = "set_swencryption", 975 .name = "set_swencrypt",
976 }, 976 },
977 { 977 {
978 .cmd = PRIV_WX_GET_SWENCRYPTION, 978 .cmd = PRIV_WX_GET_SWENCRYPTION,
979 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 979 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
980 .name = "get_swencryption", 980 .name = "get_swencrypt",
981 }, 981 },
982 { 982 {
983 .cmd = PRIV_WX_SPROM_WRITE, 983 .cmd = PRIV_WX_SPROM_WRITE,
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 8dfdfbd5966c..06523e2a8471 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -390,7 +390,7 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
390 } 390 }
391 } else { 391 } else {
392 struct { 392 struct {
393 __le16 qual, signal, noise; 393 __le16 qual, signal, noise, unused;
394 } __attribute__ ((packed)) cq; 394 } __attribute__ ((packed)) cq;
395 395
396 err = HERMES_READ_RECORD(hw, USER_BAP, 396 err = HERMES_READ_RECORD(hw, USER_BAP,
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index d5890027f8af..48bbf32fd980 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -97,7 +97,7 @@ static struct superio_struct { /* For Super-IO chips autodetection */
97 int io; 97 int io;
98 int irq; 98 int irq;
99 int dma; 99 int dma;
100} superios[NR_SUPERIOS] __devinitdata = { {0,},}; 100} superios[NR_SUPERIOS] = { {0,},};
101 101
102static int user_specified; 102static int user_specified;
103#if defined(CONFIG_PARPORT_PC_SUPERIO) || \ 103#if defined(CONFIG_PARPORT_PC_SUPERIO) || \
@@ -1557,7 +1557,7 @@ static int __devinit get_superio_dma (struct parport *p)
1557 return PARPORT_DMA_NONE; 1557 return PARPORT_DMA_NONE;
1558} 1558}
1559 1559
1560static int __devinit get_superio_irq (struct parport *p) 1560static int get_superio_irq (struct parport *p)
1561{ 1561{
1562 int i=0; 1562 int i=0;
1563 while( (superios[i].io != p->base) && (i<NR_SUPERIOS)) 1563 while( (superios[i].io != p->base) && (i<NR_SUPERIOS))
@@ -1579,7 +1579,7 @@ static int __devinit get_superio_irq (struct parport *p)
1579 * this shall always be the case!) 1579 * this shall always be the case!)
1580 * 1580 *
1581 */ 1581 */
1582static int __devinit parport_SPP_supported(struct parport *pb) 1582static int parport_SPP_supported(struct parport *pb)
1583{ 1583{
1584 unsigned char r, w; 1584 unsigned char r, w;
1585 1585
@@ -1660,7 +1660,7 @@ static int __devinit parport_SPP_supported(struct parport *pb)
1660 * two bits of ECR aren't writable, so we check by writing ECR and 1660 * two bits of ECR aren't writable, so we check by writing ECR and
1661 * reading it back to see if it's what we expect. 1661 * reading it back to see if it's what we expect.
1662 */ 1662 */
1663static int __devinit parport_ECR_present(struct parport *pb) 1663static int parport_ECR_present(struct parport *pb)
1664{ 1664{
1665 struct parport_pc_private *priv = pb->private_data; 1665 struct parport_pc_private *priv = pb->private_data;
1666 unsigned char r = 0xc; 1666 unsigned char r = 0xc;
@@ -1712,7 +1712,7 @@ static int __devinit parport_ECR_present(struct parport *pb)
1712 * be misdetected here is rather academic. 1712 * be misdetected here is rather academic.
1713 */ 1713 */
1714 1714
1715static int __devinit parport_PS2_supported(struct parport *pb) 1715static int parport_PS2_supported(struct parport *pb)
1716{ 1716{
1717 int ok = 0; 1717 int ok = 0;
1718 1718
@@ -1868,7 +1868,7 @@ static int __devinit parport_ECP_supported(struct parport *pb)
1868} 1868}
1869#endif 1869#endif
1870 1870
1871static int __devinit parport_ECPPS2_supported(struct parport *pb) 1871static int parport_ECPPS2_supported(struct parport *pb)
1872{ 1872{
1873 const struct parport_pc_private *priv = pb->private_data; 1873 const struct parport_pc_private *priv = pb->private_data;
1874 int result; 1874 int result;
@@ -1886,7 +1886,7 @@ static int __devinit parport_ECPPS2_supported(struct parport *pb)
1886 1886
1887/* EPP mode detection */ 1887/* EPP mode detection */
1888 1888
1889static int __devinit parport_EPP_supported(struct parport *pb) 1889static int parport_EPP_supported(struct parport *pb)
1890{ 1890{
1891 const struct parport_pc_private *priv = pb->private_data; 1891 const struct parport_pc_private *priv = pb->private_data;
1892 1892
@@ -1931,7 +1931,7 @@ static int __devinit parport_EPP_supported(struct parport *pb)
1931 return 1; 1931 return 1;
1932} 1932}
1933 1933
1934static int __devinit parport_ECPEPP_supported(struct parport *pb) 1934static int parport_ECPEPP_supported(struct parport *pb)
1935{ 1935{
1936 struct parport_pc_private *priv = pb->private_data; 1936 struct parport_pc_private *priv = pb->private_data;
1937 int result; 1937 int result;
@@ -2073,7 +2073,7 @@ static int __devinit irq_probe_SPP(struct parport *pb)
2073 * When ECP is available we can autoprobe for IRQs. 2073 * When ECP is available we can autoprobe for IRQs.
2074 * NOTE: If we can autoprobe it, we can register the IRQ. 2074 * NOTE: If we can autoprobe it, we can register the IRQ.
2075 */ 2075 */
2076static int __devinit parport_irq_probe(struct parport *pb) 2076static int parport_irq_probe(struct parport *pb)
2077{ 2077{
2078 struct parport_pc_private *priv = pb->private_data; 2078 struct parport_pc_private *priv = pb->private_data;
2079 2079
@@ -2779,7 +2779,7 @@ static struct parport_pc_pci {
2779 /* If set, this is called after probing for ports. If 'failed' 2779 /* If set, this is called after probing for ports. If 'failed'
2780 * is non-zero we couldn't use any of the ports. */ 2780 * is non-zero we couldn't use any of the ports. */
2781 void (*postinit_hook) (struct pci_dev *pdev, int failed); 2781 void (*postinit_hook) (struct pci_dev *pdev, int failed);
2782} cards[] __devinitdata = { 2782} cards[] = {
2783 /* siig_1p_10x */ { 1, { { 2, 3 }, } }, 2783 /* siig_1p_10x */ { 1, { { 2, 3 }, } },
2784 /* siig_2p_10x */ { 2, { { 2, 3 }, { 4, 5 }, } }, 2784 /* siig_2p_10x */ { 2, { { 2, 3 }, { 4, 5 }, } },
2785 /* siig_1p_20x */ { 1, { { 0, 1 }, } }, 2785 /* siig_1p_20x */ { 1, { { 0, 1 }, } },
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index d121644646b9..98b83a85c60e 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -100,8 +100,6 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
100 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo }, 100 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
101 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, 101 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
102 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo }, 102 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
103 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
104 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
105 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9845, 103 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9845,
106 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo }, 104 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
107 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855, 105 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 6e79f5675b0d..638004546700 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -360,9 +360,6 @@ static int __init rpaphp_init(void)
360 while ((dn = of_find_node_by_type(dn, "pci"))) 360 while ((dn = of_find_node_by_type(dn, "pci")))
361 rpaphp_add_slot(dn); 361 rpaphp_add_slot(dn);
362 362
363 if (!num_slots)
364 return -ENODEV;
365
366 return 0; 363 return 0;
367} 364}
368 365
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index a77e79c8c82e..2087a397ef16 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -504,6 +504,201 @@ void pci_scan_msi_device(struct pci_dev *dev)
504 nr_reserved_vectors++; 504 nr_reserved_vectors++;
505} 505}
506 506
507#ifdef CONFIG_PM
508int pci_save_msi_state(struct pci_dev *dev)
509{
510 int pos, i = 0;
511 u16 control;
512 struct pci_cap_saved_state *save_state;
513 u32 *cap;
514
515 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
516 if (pos <= 0 || dev->no_msi)
517 return 0;
518
519 pci_read_config_word(dev, msi_control_reg(pos), &control);
520 if (!(control & PCI_MSI_FLAGS_ENABLE))
521 return 0;
522
523 save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u32) * 5,
524 GFP_KERNEL);
525 if (!save_state) {
526 printk(KERN_ERR "Out of memory in pci_save_msi_state\n");
527 return -ENOMEM;
528 }
529 cap = &save_state->data[0];
530
531 pci_read_config_dword(dev, pos, &cap[i++]);
532 control = cap[0] >> 16;
533 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, &cap[i++]);
534 if (control & PCI_MSI_FLAGS_64BIT) {
535 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, &cap[i++]);
536 pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, &cap[i++]);
537 } else
538 pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]);
539 if (control & PCI_MSI_FLAGS_MASKBIT)
540 pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]);
541 disable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
542 save_state->cap_nr = PCI_CAP_ID_MSI;
543 pci_add_saved_cap(dev, save_state);
544 return 0;
545}
546
547void pci_restore_msi_state(struct pci_dev *dev)
548{
549 int i = 0, pos;
550 u16 control;
551 struct pci_cap_saved_state *save_state;
552 u32 *cap;
553
554 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSI);
555 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
556 if (!save_state || pos <= 0)
557 return;
558 cap = &save_state->data[0];
559
560 control = cap[i++] >> 16;
561 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, cap[i++]);
562 if (control & PCI_MSI_FLAGS_64BIT) {
563 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, cap[i++]);
564 pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, cap[i++]);
565 } else
566 pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, cap[i++]);
567 if (control & PCI_MSI_FLAGS_MASKBIT)
568 pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, cap[i++]);
569 pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control);
570 enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
571 pci_remove_saved_cap(save_state);
572 kfree(save_state);
573}
574
575int pci_save_msix_state(struct pci_dev *dev)
576{
577 int pos;
578 u16 control;
579 struct pci_cap_saved_state *save_state;
580
581 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
582 if (pos <= 0 || dev->no_msi)
583 return 0;
584
585 pci_read_config_word(dev, msi_control_reg(pos), &control);
586 if (!(control & PCI_MSIX_FLAGS_ENABLE))
587 return 0;
588 save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u16),
589 GFP_KERNEL);
590 if (!save_state) {
591 printk(KERN_ERR "Out of memory in pci_save_msix_state\n");
592 return -ENOMEM;
593 }
594 *((u16 *)&save_state->data[0]) = control;
595
596 disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
597 save_state->cap_nr = PCI_CAP_ID_MSIX;
598 pci_add_saved_cap(dev, save_state);
599 return 0;
600}
601
602void pci_restore_msix_state(struct pci_dev *dev)
603{
604 u16 save;
605 int pos;
606 int vector, head, tail = 0;
607 void __iomem *base;
608 int j;
609 struct msg_address address;
610 struct msg_data data;
611 struct msi_desc *entry;
612 int temp;
613 struct pci_cap_saved_state *save_state;
614
615 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSIX);
616 if (!save_state)
617 return;
618 save = *((u16 *)&save_state->data[0]);
619 pci_remove_saved_cap(save_state);
620 kfree(save_state);
621
622 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
623 if (pos <= 0)
624 return;
625
626 /* route the table */
627 temp = dev->irq;
628 if (msi_lookup_vector(dev, PCI_CAP_ID_MSIX))
629 return;
630 vector = head = dev->irq;
631 while (head != tail) {
632 entry = msi_desc[vector];
633 base = entry->mask_base;
634 j = entry->msi_attrib.entry_nr;
635
636 msi_address_init(&address);
637 msi_data_init(&data, vector);
638
639 address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK;
640 address.lo_address.value |= entry->msi_attrib.current_cpu <<
641 MSI_TARGET_CPU_SHIFT;
642
643 writel(address.lo_address.value,
644 base + j * PCI_MSIX_ENTRY_SIZE +
645 PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
646 writel(address.hi_address,
647 base + j * PCI_MSIX_ENTRY_SIZE +
648 PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
649 writel(*(u32*)&data,
650 base + j * PCI_MSIX_ENTRY_SIZE +
651 PCI_MSIX_ENTRY_DATA_OFFSET);
652
653 tail = msi_desc[vector]->link.tail;
654 vector = tail;
655 }
656 dev->irq = temp;
657
658 pci_write_config_word(dev, msi_control_reg(pos), save);
659 enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
660}
661#endif
662
663static void msi_register_init(struct pci_dev *dev, struct msi_desc *entry)
664{
665 struct msg_address address;
666 struct msg_data data;
667 int pos, vector = dev->irq;
668 u16 control;
669
670 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
671 pci_read_config_word(dev, msi_control_reg(pos), &control);
672 /* Configure MSI capability structure */
673 msi_address_init(&address);
674 msi_data_init(&data, vector);
675 entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >>
676 MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
677 pci_write_config_dword(dev, msi_lower_address_reg(pos),
678 address.lo_address.value);
679 if (is_64bit_address(control)) {
680 pci_write_config_dword(dev,
681 msi_upper_address_reg(pos), address.hi_address);
682 pci_write_config_word(dev,
683 msi_data_reg(pos, 1), *((u32*)&data));
684 } else
685 pci_write_config_word(dev,
686 msi_data_reg(pos, 0), *((u32*)&data));
687 if (entry->msi_attrib.maskbit) {
688 unsigned int maskbits, temp;
689 /* All MSIs are unmasked by default, Mask them all */
690 pci_read_config_dword(dev,
691 msi_mask_bits_reg(pos, is_64bit_address(control)),
692 &maskbits);
693 temp = (1 << multi_msi_capable(control));
694 temp = ((temp - 1) & ~temp);
695 maskbits |= temp;
696 pci_write_config_dword(dev,
697 msi_mask_bits_reg(pos, is_64bit_address(control)),
698 maskbits);
699 }
700}
701
507/** 702/**
508 * msi_capability_init - configure device's MSI capability structure 703 * msi_capability_init - configure device's MSI capability structure
509 * @dev: pointer to the pci_dev data structure of MSI device function 704 * @dev: pointer to the pci_dev data structure of MSI device function
@@ -516,8 +711,6 @@ void pci_scan_msi_device(struct pci_dev *dev)
516static int msi_capability_init(struct pci_dev *dev) 711static int msi_capability_init(struct pci_dev *dev)
517{ 712{
518 struct msi_desc *entry; 713 struct msi_desc *entry;
519 struct msg_address address;
520 struct msg_data data;
521 int pos, vector; 714 int pos, vector;
522 u16 control; 715 u16 control;
523 716
@@ -549,33 +742,8 @@ static int msi_capability_init(struct pci_dev *dev)
549 /* Replace with MSI handler */ 742 /* Replace with MSI handler */
550 irq_handler_init(PCI_CAP_ID_MSI, vector, entry->msi_attrib.maskbit); 743 irq_handler_init(PCI_CAP_ID_MSI, vector, entry->msi_attrib.maskbit);
551 /* Configure MSI capability structure */ 744 /* Configure MSI capability structure */
552 msi_address_init(&address); 745 msi_register_init(dev, entry);
553 msi_data_init(&data, vector); 746
554 entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >>
555 MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
556 pci_write_config_dword(dev, msi_lower_address_reg(pos),
557 address.lo_address.value);
558 if (is_64bit_address(control)) {
559 pci_write_config_dword(dev,
560 msi_upper_address_reg(pos), address.hi_address);
561 pci_write_config_word(dev,
562 msi_data_reg(pos, 1), *((u32*)&data));
563 } else
564 pci_write_config_word(dev,
565 msi_data_reg(pos, 0), *((u32*)&data));
566 if (entry->msi_attrib.maskbit) {
567 unsigned int maskbits, temp;
568 /* All MSIs are unmasked by default, Mask them all */
569 pci_read_config_dword(dev,
570 msi_mask_bits_reg(pos, is_64bit_address(control)),
571 &maskbits);
572 temp = (1 << multi_msi_capable(control));
573 temp = ((temp - 1) & ~temp);
574 maskbits |= temp;
575 pci_write_config_dword(dev,
576 msi_mask_bits_reg(pos, is_64bit_address(control)),
577 maskbits);
578 }
579 attach_msi_entry(entry, vector); 747 attach_msi_entry(entry, vector);
580 /* Set MSI enabled bits */ 748 /* Set MSI enabled bits */
581 enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); 749 enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
@@ -731,6 +899,7 @@ int pci_enable_msi(struct pci_dev* dev)
731 vector_irq[dev->irq] = -1; 899 vector_irq[dev->irq] = -1;
732 nr_released_vectors--; 900 nr_released_vectors--;
733 spin_unlock_irqrestore(&msi_lock, flags); 901 spin_unlock_irqrestore(&msi_lock, flags);
902 msi_register_init(dev, msi_desc[dev->irq]);
734 enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); 903 enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
735 return 0; 904 return 0;
736 } 905 }
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index f22f69ac6445..1456759936c5 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -271,10 +271,12 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
271 struct pci_driver * drv = pci_dev->driver; 271 struct pci_driver * drv = pci_dev->driver;
272 int i = 0; 272 int i = 0;
273 273
274 if (drv && drv->suspend) 274 if (drv && drv->suspend) {
275 i = drv->suspend(pci_dev, state); 275 i = drv->suspend(pci_dev, state);
276 else 276 suspend_report_result(drv->suspend, i);
277 } else {
277 pci_save_state(pci_dev); 278 pci_save_state(pci_dev);
279 }
278 return i; 280 return i;
279} 281}
280 282
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bea1ad1ad5ba..2329f941a0dc 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -307,9 +307,11 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
307 * Can enter D0 from any state, but if we can only go deeper 307 * Can enter D0 from any state, but if we can only go deeper
308 * to sleep if we're already in a low power state 308 * to sleep if we're already in a low power state
309 */ 309 */
310 if (state != PCI_D0 && dev->current_state > state) 310 if (state != PCI_D0 && dev->current_state > state) {
311 printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n",
312 __FUNCTION__, pci_name(dev), state, dev->current_state);
311 return -EINVAL; 313 return -EINVAL;
312 else if (dev->current_state == state) 314 } else if (dev->current_state == state)
313 return 0; /* we're already there */ 315 return 0; /* we're already there */
314 316
315 /* find PCI PM capability in list */ 317 /* find PCI PM capability in list */
@@ -444,6 +446,10 @@ pci_save_state(struct pci_dev *dev)
444 /* XXX: 100% dword access ok here? */ 446 /* XXX: 100% dword access ok here? */
445 for (i = 0; i < 16; i++) 447 for (i = 0; i < 16; i++)
446 pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]); 448 pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]);
449 if ((i = pci_save_msi_state(dev)) != 0)
450 return i;
451 if ((i = pci_save_msix_state(dev)) != 0)
452 return i;
447 return 0; 453 return 0;
448} 454}
449 455
@@ -458,6 +464,8 @@ pci_restore_state(struct pci_dev *dev)
458 464
459 for (i = 0; i < 16; i++) 465 for (i = 0; i < 16; i++)
460 pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); 466 pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
467 pci_restore_msi_state(dev);
468 pci_restore_msix_state(dev);
461 return 0; 469 return 0;
462} 470}
463 471
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 8f3fb47ea671..30630cbe2fe3 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -55,6 +55,17 @@ void pci_no_msi(void);
55static inline void disable_msi_mode(struct pci_dev *dev, int pos, int type) { } 55static inline void disable_msi_mode(struct pci_dev *dev, int pos, int type) { }
56static inline void pci_no_msi(void) { } 56static inline void pci_no_msi(void) { }
57#endif 57#endif
58#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM)
59int pci_save_msi_state(struct pci_dev *dev);
60int pci_save_msix_state(struct pci_dev *dev);
61void pci_restore_msi_state(struct pci_dev *dev);
62void pci_restore_msix_state(struct pci_dev *dev);
63#else
64static inline int pci_save_msi_state(struct pci_dev *dev) { return 0; }
65static inline int pci_save_msix_state(struct pci_dev *dev) { return 0; }
66static inline void pci_restore_msi_state(struct pci_dev *dev) {}
67static inline void pci_restore_msix_state(struct pci_dev *dev) {}
68#endif
58 69
59extern int pcie_mch_quirk; 70extern int pcie_mch_quirk;
60extern struct device_attribute pci_dev_attrs[]; 71extern struct device_attribute pci_dev_attrs[];
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 4970f47be72c..c42ae2cf8d64 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -592,7 +592,7 @@ static void __init quirk_amd_8131_ioapic(struct pci_dev *dev)
592 pci_write_config_byte( dev, AMD8131_MISC, tmp); 592 pci_write_config_byte( dev, AMD8131_MISC, tmp);
593 } 593 }
594} 594}
595DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_APIC, quirk_amd_8131_ioapic ); 595DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
596 596
597static void __init quirk_svw_msi(struct pci_dev *dev) 597static void __init quirk_svw_msi(struct pci_dev *dev)
598{ 598{
@@ -865,6 +865,35 @@ static void __init quirk_eisa_bridge(struct pci_dev *dev)
865DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_eisa_bridge ); 865DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_eisa_bridge );
866 866
867/* 867/*
868 * On the MSI-K8T-Neo2Fir Board, the internal Soundcard is disabled
869 * when a PCI-Soundcard is added. The BIOS only gives Options
870 * "Disabled" and "AUTO". This Quirk Sets the corresponding
871 * Register-Value to enable the Soundcard.
872 */
873static void __init k8t_sound_hostbridge(struct pci_dev *dev)
874{
875 unsigned char val;
876
877 printk(KERN_INFO "PCI: Quirk-MSI-K8T Soundcard On\n");
878 pci_read_config_byte(dev, 0x50, &val);
879 if (val == 0x88 || val == 0xc8) {
880 pci_write_config_byte(dev, 0x50, val & (~0x40));
881
882 /* Verify the Change for Status output */
883 pci_read_config_byte(dev, 0x50, &val);
884 if (val & 0x40)
885 printk(KERN_INFO "PCI: MSI-K8T soundcard still off\n");
886 else
887 printk(KERN_INFO "PCI: MSI-K8T soundcard on\n");
888 } else {
889 printk(KERN_INFO "PCI: Unexpected Value in PCI-Register: "
890 "no Change!\n");
891 }
892
893}
894DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
895
896/*
868 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge 897 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
869 * is not activated. The myth is that Asus said that they do not want the 898 * is not activated. The myth is that Asus said that they do not want the
870 * users to be irritated by just another PCI Device in the Win98 device 899 * users to be irritated by just another PCI Device in the Win98 device
@@ -921,6 +950,7 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
921 if (dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB) { 950 if (dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB) {
922 switch (dev->subsystem_device) { 951 switch (dev->subsystem_device) {
923 case 0x1882: /* M6V notebook */ 952 case 0x1882: /* M6V notebook */
953 case 0x1977: /* A6VA notebook */
924 asus_hides_smbus = 1; 954 asus_hides_smbus = 1;
925 } 955 }
926 } 956 }
@@ -999,6 +1029,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asu
999DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc ); 1029DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
1000DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc ); 1030DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
1001DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc ); 1031DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc );
1032DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc );
1002 1033
1003static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev) 1034static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
1004{ 1035{
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 67cc5f7d0c90..a4d50940ebeb 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -28,8 +28,6 @@
28#include <asm/arch/gpio.h> 28#include <asm/arch/gpio.h>
29 29
30 30
31#define CF_SIZE 0x30000000 /* CS5+CS6: unavailable */
32
33/* 31/*
34 * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; 32 * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW;
35 * some other bit in {A24,A22..A11} is nREG to flag memory access 33 * some other bit in {A24,A22..A11} is nREG to flag memory access
@@ -76,7 +74,8 @@ static irqreturn_t at91_cf_irq(int irq, void *_cf, struct pt_regs *r)
76 /* kick pccard as needed */ 74 /* kick pccard as needed */
77 if (present != cf->present) { 75 if (present != cf->present) {
78 cf->present = present; 76 cf->present = present;
79 pr_debug("%s: card %s\n", driver_name, present ? "present" : "gone"); 77 pr_debug("%s: card %s\n", driver_name,
78 present ? "present" : "gone");
80 pcmcia_parse_events(&cf->socket, SS_DETECT); 79 pcmcia_parse_events(&cf->socket, SS_DETECT);
81 } 80 }
82 } 81 }
@@ -93,7 +92,7 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
93 92
94 cf = container_of(s, struct at91_cf_socket, socket); 93 cf = container_of(s, struct at91_cf_socket, socket);
95 94
96 /* NOTE: we assume 3VCARD, not XVCARD... */ 95 /* NOTE: CF is always 3VCARD */
97 if (at91_cf_present(cf)) { 96 if (at91_cf_present(cf)) {
98 int rdy = cf->board->irq_pin; /* RDY/nIRQ */ 97 int rdy = cf->board->irq_pin; /* RDY/nIRQ */
99 int vcc = cf->board->vcc_pin; 98 int vcc = cf->board->vcc_pin;
@@ -109,7 +108,8 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
109 return 0; 108 return 0;
110} 109}
111 110
112static int at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) 111static int
112at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s)
113{ 113{
114 struct at91_cf_socket *cf; 114 struct at91_cf_socket *cf;
115 115
@@ -184,7 +184,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
184} 184}
185 185
186/* pcmcia layer maps/unmaps mem regions */ 186/* pcmcia layer maps/unmaps mem regions */
187static int at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) 187static int
188at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map)
188{ 189{
189 struct at91_cf_socket *cf; 190 struct at91_cf_socket *cf;
190 191
@@ -218,12 +219,17 @@ static int __init at91_cf_probe(struct device *dev)
218 struct at91_cf_socket *cf; 219 struct at91_cf_socket *cf;
219 struct at91_cf_data *board = dev->platform_data; 220 struct at91_cf_data *board = dev->platform_data;
220 struct platform_device *pdev = to_platform_device(dev); 221 struct platform_device *pdev = to_platform_device(dev);
222 struct resource *io;
221 unsigned int csa; 223 unsigned int csa;
222 int status; 224 int status;
223 225
224 if (!board || !board->det_pin || !board->rst_pin) 226 if (!board || !board->det_pin || !board->rst_pin)
225 return -ENODEV; 227 return -ENODEV;
226 228
229 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
230 if (!io)
231 return -ENODEV;
232
227 cf = kcalloc(1, sizeof *cf, GFP_KERNEL); 233 cf = kcalloc(1, sizeof *cf, GFP_KERNEL);
228 if (!cf) 234 if (!cf)
229 return -ENOMEM; 235 return -ENOMEM;
@@ -250,10 +256,14 @@ static int __init at91_cf_probe(struct device *dev)
250 * REVISIT: these timings are in terms of MCK cycles, so 256 * REVISIT: these timings are in terms of MCK cycles, so
251 * when MCK changes (cpufreq etc) so must these values... 257 * when MCK changes (cpufreq etc) so must these values...
252 */ 258 */
253 at91_sys_write(AT91_SMC_CSR(4), AT91_SMC_ACSS_STD | AT91_SMC_DBW_16 | AT91_SMC_BAT | AT91_SMC_WSEN 259 at91_sys_write(AT91_SMC_CSR(4),
254 | AT91_SMC_NWS_(32) /* wait states */ 260 AT91_SMC_ACSS_STD
255 | AT91_SMC_RWSETUP_(6) /* setup time */ 261 | AT91_SMC_DBW_16
256 | AT91_SMC_RWHOLD_(4) /* hold time */ 262 | AT91_SMC_BAT
263 | AT91_SMC_WSEN
264 | AT91_SMC_NWS_(32) /* wait states */
265 | AT91_SMC_RWSETUP_(6) /* setup time */
266 | AT91_SMC_RWHOLD_(4) /* hold time */
257 ); 267 );
258 268
259 /* must be a GPIO; ergo must trigger on both edges */ 269 /* must be a GPIO; ergo must trigger on both edges */
@@ -274,8 +284,7 @@ static int __init at91_cf_probe(struct device *dev)
274 if (status < 0) 284 if (status < 0)
275 goto fail0a; 285 goto fail0a;
276 cf->socket.pci_irq = board->irq_pin; 286 cf->socket.pci_irq = board->irq_pin;
277 } 287 } else
278 else
279 cf->socket.pci_irq = NR_IRQS + 1; 288 cf->socket.pci_irq = NR_IRQS + 1;
280 289
281 /* pcmcia layer only remaps "real" memory not iospace */ 290 /* pcmcia layer only remaps "real" memory not iospace */
@@ -284,7 +293,8 @@ static int __init at91_cf_probe(struct device *dev)
284 goto fail1; 293 goto fail1;
285 294
286 /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ 295 /* reserve CS4, CS5, and CS6 regions; but use just CS4 */
287 if (!request_mem_region(AT91_CF_BASE, CF_SIZE, driver_name)) 296 if (!request_mem_region(io->start, io->end + 1 - io->start,
297 driver_name))
288 goto fail1; 298 goto fail1;
289 299
290 pr_info("%s: irqs det #%d, io #%d\n", driver_name, 300 pr_info("%s: irqs det #%d, io #%d\n", driver_name,
@@ -297,7 +307,7 @@ static int __init at91_cf_probe(struct device *dev)
297 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP 307 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
298 | SS_CAP_MEM_ALIGN; 308 | SS_CAP_MEM_ALIGN;
299 cf->socket.map_size = SZ_2K; 309 cf->socket.map_size = SZ_2K;
300 cf->socket.io[0].NumPorts = SZ_2K; 310 cf->socket.io[0].res = io;
301 311
302 status = pcmcia_register_socket(&cf->socket); 312 status = pcmcia_register_socket(&cf->socket);
303 if (status < 0) 313 if (status < 0)
@@ -307,7 +317,7 @@ static int __init at91_cf_probe(struct device *dev)
307 317
308fail2: 318fail2:
309 iounmap((void __iomem *) cf->socket.io_offset); 319 iounmap((void __iomem *) cf->socket.io_offset);
310 release_mem_region(AT91_CF_BASE, CF_SIZE); 320 release_mem_region(io->start, io->end + 1 - io->start);
311fail1: 321fail1:
312 if (board->irq_pin) 322 if (board->irq_pin)
313 free_irq(board->irq_pin, cf); 323 free_irq(board->irq_pin, cf);
@@ -321,14 +331,15 @@ fail0:
321 331
322static int __exit at91_cf_remove(struct device *dev) 332static int __exit at91_cf_remove(struct device *dev)
323{ 333{
324 struct at91_cf_socket *cf = dev_get_drvdata(dev); 334 struct at91_cf_socket *cf = dev_get_drvdata(dev);
325 unsigned int csa; 335 struct resource *io = cf->socket.io[0].res;
336 unsigned int csa;
326 337
327 pcmcia_unregister_socket(&cf->socket); 338 pcmcia_unregister_socket(&cf->socket);
328 free_irq(cf->board->irq_pin, cf); 339 free_irq(cf->board->irq_pin, cf);
329 free_irq(cf->board->det_pin, cf); 340 free_irq(cf->board->det_pin, cf);
330 iounmap((void __iomem *) cf->socket.io_offset); 341 iounmap((void __iomem *) cf->socket.io_offset);
331 release_mem_region(AT91_CF_BASE, CF_SIZE); 342 release_mem_region(io->start, io->end + 1 - io->start);
332 343
333 csa = at91_sys_read(AT91_EBI_CSA); 344 csa = at91_sys_read(AT91_EBI_CSA);
334 at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); 345 at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A);
@@ -342,8 +353,8 @@ static struct device_driver at91_cf_driver = {
342 .bus = &platform_bus_type, 353 .bus = &platform_bus_type,
343 .probe = at91_cf_probe, 354 .probe = at91_cf_probe,
344 .remove = __exit_p(at91_cf_remove), 355 .remove = __exit_p(at91_cf_remove),
345 .suspend = pcmcia_socket_dev_suspend, 356 .suspend = pcmcia_socket_dev_suspend,
346 .resume = pcmcia_socket_dev_resume, 357 .resume = pcmcia_socket_dev_resume,
347}; 358};
348 359
349/*--------------------------------------------------------------------------*/ 360/*--------------------------------------------------------------------------*/
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index fd3647368955..b7b9e149c5b9 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -26,14 +26,6 @@
26#include "soc_common.h" 26#include "soc_common.h"
27 27
28#define NO_KEEP_VS 0x0001 28#define NO_KEEP_VS 0x0001
29
30/* PCMCIA to Scoop linkage
31
32 There is no easy way to link multiple scoop devices into one
33 single entity for the pxa2xx_pcmcia device so this structure
34 is used which is setup by the platform code
35*/
36struct scoop_pcmcia_config *platform_scoop_config;
37#define SCOOP_DEV platform_scoop_config->devs 29#define SCOOP_DEV platform_scoop_config->devs
38 30
39static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt) 31static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index c4256aa32bcb..6fff109bdab6 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -479,7 +479,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
479int pnp_start_dev(struct pnp_dev *dev) 479int pnp_start_dev(struct pnp_dev *dev)
480{ 480{
481 if (!pnp_can_write(dev)) { 481 if (!pnp_can_write(dev)) {
482 pnp_info("Device %s does not supported activation.", dev->dev.bus_id); 482 pnp_info("Device %s does not support activation.", dev->dev.bus_id);
483 return -EINVAL; 483 return -EINVAL;
484 } 484 }
485 485
@@ -503,7 +503,7 @@ int pnp_start_dev(struct pnp_dev *dev)
503int pnp_stop_dev(struct pnp_dev *dev) 503int pnp_stop_dev(struct pnp_dev *dev)
504{ 504{
505 if (!pnp_can_disable(dev)) { 505 if (!pnp_can_disable(dev)) {
506 pnp_info("Device %s does not supported disabling.", dev->dev.bus_id); 506 pnp_info("Device %s does not support disabling.", dev->dev.bus_id);
507 return -EINVAL; 507 return -EINVAL;
508 } 508 }
509 if (dev->protocol->disable(dev)<0) { 509 if (dev->protocol->disable(dev)<0) {
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 929dd8090578..65d090dbef46 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -147,6 +147,16 @@ config RTC_DRV_SA1100
147 To compile this driver as a module, choose M here: the 147 To compile this driver as a module, choose M here: the
148 module will be called rtc-sa1100. 148 module will be called rtc-sa1100.
149 149
150config RTC_DRV_VR41XX
151 tristate "NEC VR41XX"
152 depends on RTC_CLASS && CPU_VR41XX
153 help
154 If you say Y here you will get access to the real time clock
155 built into your NEC VR41XX CPU.
156
157 To compile this driver as a module, choose M here: the
158 module will be called rtc-vr41xx.
159
150config RTC_DRV_TEST 160config RTC_DRV_TEST
151 tristate "Test driver/device" 161 tristate "Test driver/device"
152 depends on RTC_CLASS 162 depends on RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 8d4c7fe88d58..a9ca0f171686 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o
19obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o 19obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o
20obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o 20obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
21obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o 21obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
22obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 8533936d50d8..413c7d54ea10 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -96,6 +96,8 @@ exit_idr:
96 idr_remove(&rtc_idr, id); 96 idr_remove(&rtc_idr, id);
97 97
98exit: 98exit:
99 dev_err(dev, "rtc core: unable to register %s, err = %d\n",
100 name, err);
99 return ERR_PTR(err); 101 return ERR_PTR(err);
100} 102}
101EXPORT_SYMBOL_GPL(rtc_device_register); 103EXPORT_SYMBOL_GPL(rtc_device_register);
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index 358695a416f3..9be81fd4737c 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * An rtc/i2c driver for the Dallas DS1672 2 * An rtc/i2c driver for the Dallas DS1672
3 * Copyright 2005 Alessandro Zummo 3 * Copyright 2005-06 Tower Technologies
4 *
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
4 * 6 *
5 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -11,7 +13,7 @@
11#include <linux/i2c.h> 13#include <linux/i2c.h>
12#include <linux/rtc.h> 14#include <linux/rtc.h>
13 15
14#define DRV_VERSION "0.2" 16#define DRV_VERSION "0.3"
15 17
16/* Addresses to scan: none. This chip cannot be detected. */ 18/* Addresses to scan: none. This chip cannot be detected. */
17static unsigned short normal_i2c[] = { I2C_CLIENT_END }; 19static unsigned short normal_i2c[] = { I2C_CLIENT_END };
@@ -25,6 +27,7 @@ I2C_CLIENT_INSMOD;
25#define DS1672_REG_CONTROL 4 27#define DS1672_REG_CONTROL 4
26#define DS1672_REG_TRICKLE 5 28#define DS1672_REG_TRICKLE 5
27 29
30#define DS1672_REG_CONTROL_EOSC 0x80
28 31
29/* Prototypes */ 32/* Prototypes */
30static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind); 33static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind);
@@ -53,8 +56,7 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
53 56
54 dev_dbg(&client->dev, 57 dev_dbg(&client->dev,
55 "%s: raw read data - counters=%02x,%02x,%02x,%02x\n" 58 "%s: raw read data - counters=%02x,%02x,%02x,%02x\n"
56 __FUNCTION__, 59 __FUNCTION__, buf[0], buf[1], buf[2], buf[3]);
57 buf[0], buf[1], buf[2], buf[3]);
58 60
59 time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; 61 time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
60 62
@@ -62,8 +64,7 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
62 64
63 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " 65 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
64 "mday=%d, mon=%d, year=%d, wday=%d\n", 66 "mday=%d, mon=%d, year=%d, wday=%d\n",
65 __FUNCTION__, 67 __FUNCTION__, tm->tm_sec, tm->tm_min, tm->tm_hour,
66 tm->tm_sec, tm->tm_min, tm->tm_hour,
67 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 68 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
68 69
69 return 0; 70 return 0;
@@ -72,16 +73,17 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
72static int ds1672_set_mmss(struct i2c_client *client, unsigned long secs) 73static int ds1672_set_mmss(struct i2c_client *client, unsigned long secs)
73{ 74{
74 int xfer; 75 int xfer;
75 unsigned char buf[5]; 76 unsigned char buf[6];
76 77
77 buf[0] = DS1672_REG_CNT_BASE; 78 buf[0] = DS1672_REG_CNT_BASE;
78 buf[1] = secs & 0x000000FF; 79 buf[1] = secs & 0x000000FF;
79 buf[2] = (secs & 0x0000FF00) >> 8; 80 buf[2] = (secs & 0x0000FF00) >> 8;
80 buf[3] = (secs & 0x00FF0000) >> 16; 81 buf[3] = (secs & 0x00FF0000) >> 16;
81 buf[4] = (secs & 0xFF000000) >> 24; 82 buf[4] = (secs & 0xFF000000) >> 24;
83 buf[5] = 0; /* set control reg to enable counting */
82 84
83 xfer = i2c_master_send(client, buf, 5); 85 xfer = i2c_master_send(client, buf, 6);
84 if (xfer != 5) { 86 if (xfer != 6) {
85 dev_err(&client->dev, "%s: send: %d\n", __FUNCTION__, xfer); 87 dev_err(&client->dev, "%s: send: %d\n", __FUNCTION__, xfer);
86 return -EIO; 88 return -EIO;
87 } 89 }
@@ -120,6 +122,40 @@ static int ds1672_rtc_set_mmss(struct device *dev, unsigned long secs)
120 return ds1672_set_mmss(to_i2c_client(dev), secs); 122 return ds1672_set_mmss(to_i2c_client(dev), secs);
121} 123}
122 124
125static int ds1672_get_control(struct i2c_client *client, u8 *status)
126{
127 unsigned char addr = DS1672_REG_CONTROL;
128
129 struct i2c_msg msgs[] = {
130 { client->addr, 0, 1, &addr }, /* setup read ptr */
131 { client->addr, I2C_M_RD, 1, status }, /* read control */
132 };
133
134 /* read control register */
135 if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
136 dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
137 return -EIO;
138 }
139
140 return 0;
141}
142
143/* following are the sysfs callback functions */
144static ssize_t show_control(struct device *dev, struct device_attribute *attr, char *buf)
145{
146 struct i2c_client *client = to_i2c_client(dev);
147 u8 control;
148 int err;
149
150 err = ds1672_get_control(client, &control);
151 if (err)
152 return err;
153
154 return sprintf(buf, "%s\n", (control & DS1672_REG_CONTROL_EOSC)
155 ? "disabled" : "enabled");
156}
157static DEVICE_ATTR(control, S_IRUGO, show_control, NULL);
158
123static struct rtc_class_ops ds1672_rtc_ops = { 159static struct rtc_class_ops ds1672_rtc_ops = {
124 .read_time = ds1672_rtc_read_time, 160 .read_time = ds1672_rtc_read_time,
125 .set_time = ds1672_rtc_set_time, 161 .set_time = ds1672_rtc_set_time,
@@ -128,7 +164,6 @@ static struct rtc_class_ops ds1672_rtc_ops = {
128 164
129static int ds1672_attach(struct i2c_adapter *adapter) 165static int ds1672_attach(struct i2c_adapter *adapter)
130{ 166{
131 dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
132 return i2c_probe(adapter, &addr_data, ds1672_probe); 167 return i2c_probe(adapter, &addr_data, ds1672_probe);
133} 168}
134 169
@@ -137,8 +172,6 @@ static int ds1672_detach(struct i2c_client *client)
137 int err; 172 int err;
138 struct rtc_device *rtc = i2c_get_clientdata(client); 173 struct rtc_device *rtc = i2c_get_clientdata(client);
139 174
140 dev_dbg(&client->dev, "%s\n", __FUNCTION__);
141
142 if (rtc) 175 if (rtc)
143 rtc_device_unregister(rtc); 176 rtc_device_unregister(rtc);
144 177
@@ -162,6 +195,7 @@ static struct i2c_driver ds1672_driver = {
162static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind) 195static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind)
163{ 196{
164 int err = 0; 197 int err = 0;
198 u8 control;
165 struct i2c_client *client; 199 struct i2c_client *client;
166 struct rtc_device *rtc; 200 struct rtc_device *rtc;
167 201
@@ -195,13 +229,23 @@ static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind)
195 229
196 if (IS_ERR(rtc)) { 230 if (IS_ERR(rtc)) {
197 err = PTR_ERR(rtc); 231 err = PTR_ERR(rtc);
198 dev_err(&client->dev,
199 "unable to register the class device\n");
200 goto exit_detach; 232 goto exit_detach;
201 } 233 }
202 234
203 i2c_set_clientdata(client, rtc); 235 i2c_set_clientdata(client, rtc);
204 236
237 /* read control register */
238 err = ds1672_get_control(client, &control);
239 if (err)
240 goto exit_detach;
241
242 if (control & DS1672_REG_CONTROL_EOSC)
243 dev_warn(&client->dev, "Oscillator not enabled. "
244 "Set time to enable.\n");
245
246 /* Register sysfs hooks */
247 device_create_file(&client->dev, &dev_attr_control);
248
205 return 0; 249 return 0;
206 250
207exit_detach: 251exit_detach:
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 0dd80ea686a9..e1a1169e4664 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -67,7 +67,6 @@ static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq)
67 67
68 ep93xx_get_swcomp(dev, &preload, &delete); 68 ep93xx_get_swcomp(dev, &preload, &delete);
69 69
70 seq_printf(seq, "24hr\t\t: yes\n");
71 seq_printf(seq, "preload\t\t: %d\n", preload); 70 seq_printf(seq, "preload\t\t: %d\n", preload);
72 seq_printf(seq, "delete\t\t: %d\n", delete); 71 seq_printf(seq, "delete\t\t: %d\n", delete);
73 72
@@ -110,7 +109,6 @@ static int __devinit ep93xx_rtc_probe(struct platform_device *dev)
110 &dev->dev, &ep93xx_rtc_ops, THIS_MODULE); 109 &dev->dev, &ep93xx_rtc_ops, THIS_MODULE);
111 110
112 if (IS_ERR(rtc)) { 111 if (IS_ERR(rtc)) {
113 dev_err(&dev->dev, "unable to register\n");
114 return PTR_ERR(rtc); 112 return PTR_ERR(rtc);
115 } 113 }
116 114
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index db445c872b1b..f6e7ee04f3dc 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -23,7 +23,7 @@
23#define M48T86_REG_SECALRM 0x01 23#define M48T86_REG_SECALRM 0x01
24#define M48T86_REG_MIN 0x02 24#define M48T86_REG_MIN 0x02
25#define M48T86_REG_MINALRM 0x03 25#define M48T86_REG_MINALRM 0x03
26#define M48T86_REG_HOUR 0x04 26#define M48T86_REG_HOUR 0x04
27#define M48T86_REG_HOURALRM 0x05 27#define M48T86_REG_HOURALRM 0x05
28#define M48T86_REG_DOW 0x06 /* 1 = sunday */ 28#define M48T86_REG_DOW 0x06 /* 1 = sunday */
29#define M48T86_REG_DOM 0x07 29#define M48T86_REG_DOM 0x07
@@ -127,9 +127,6 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq)
127 127
128 reg = ops->readb(M48T86_REG_B); 128 reg = ops->readb(M48T86_REG_B);
129 129
130 seq_printf(seq, "24hr\t\t: %s\n",
131 (reg & M48T86_REG_B_H24) ? "yes" : "no");
132
133 seq_printf(seq, "mode\t\t: %s\n", 130 seq_printf(seq, "mode\t\t: %s\n",
134 (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); 131 (reg & M48T86_REG_B_DM) ? "binary" : "bcd");
135 132
@@ -154,10 +151,8 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev)
154 struct rtc_device *rtc = rtc_device_register("m48t86", 151 struct rtc_device *rtc = rtc_device_register("m48t86",
155 &dev->dev, &m48t86_rtc_ops, THIS_MODULE); 152 &dev->dev, &m48t86_rtc_ops, THIS_MODULE);
156 153
157 if (IS_ERR(rtc)) { 154 if (IS_ERR(rtc))
158 dev_err(&dev->dev, "unable to register\n");
159 return PTR_ERR(rtc); 155 return PTR_ERR(rtc);
160 }
161 156
162 platform_set_drvdata(dev, rtc); 157 platform_set_drvdata(dev, rtc);
163 158
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index d857d45bdbe8..ba9a583b7b68 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -227,14 +227,7 @@ static int pcf8563_rtc_set_time(struct device *dev, struct rtc_time *tm)
227 return pcf8563_set_datetime(to_i2c_client(dev), tm); 227 return pcf8563_set_datetime(to_i2c_client(dev), tm);
228} 228}
229 229
230static int pcf8563_rtc_proc(struct device *dev, struct seq_file *seq)
231{
232 seq_printf(seq, "24hr\t\t: yes\n");
233 return 0;
234}
235
236static struct rtc_class_ops pcf8563_rtc_ops = { 230static struct rtc_class_ops pcf8563_rtc_ops = {
237 .proc = pcf8563_rtc_proc,
238 .read_time = pcf8563_rtc_read_time, 231 .read_time = pcf8563_rtc_read_time,
239 .set_time = pcf8563_rtc_set_time, 232 .set_time = pcf8563_rtc_set_time,
240}; 233};
@@ -297,8 +290,6 @@ static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind)
297 290
298 if (IS_ERR(rtc)) { 291 if (IS_ERR(rtc)) {
299 err = PTR_ERR(rtc); 292 err = PTR_ERR(rtc);
300 dev_err(&client->dev,
301 "unable to register the class device\n");
302 goto exit_detach; 293 goto exit_detach;
303 } 294 }
304 295
@@ -321,8 +312,6 @@ static int pcf8563_detach(struct i2c_client *client)
321 int err; 312 int err;
322 struct rtc_device *rtc = i2c_get_clientdata(client); 313 struct rtc_device *rtc = i2c_get_clientdata(client);
323 314
324 dev_dbg(&client->dev, "%s\n", __FUNCTION__);
325
326 if (rtc) 315 if (rtc)
327 rtc_device_unregister(rtc); 316 rtc_device_unregister(rtc);
328 317
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index 90b8a97a0919..cef5f5a3bbf9 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -71,6 +71,8 @@ static int rtc_proc_show(struct seq_file *seq, void *offset)
71 alrm.pending ? "yes" : "no"); 71 alrm.pending ? "yes" : "no");
72 } 72 }
73 73
74 seq_printf(seq, "24hr\t\t: yes\n");
75
74 if (ops->proc) 76 if (ops->proc)
75 ops->proc(class_dev->dev, seq); 77 ops->proc(class_dev->dev, seq);
76 78
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 396c8681f66c..7553d797603f 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -151,9 +151,8 @@ static int rs5c372_rtc_proc(struct device *dev, struct seq_file *seq)
151{ 151{
152 int err, osc, trim; 152 int err, osc, trim;
153 153
154 seq_printf(seq, "24hr\t\t: yes\n"); 154 err = rs5c372_get_trim(to_i2c_client(dev), &osc, &trim);
155 155 if (err == 0) {
156 if ((err = rs5c372_get_trim(to_i2c_client(dev), &osc, &trim)) == 0) {
157 seq_printf(seq, "%d.%03d KHz\n", osc / 1000, osc % 1000); 156 seq_printf(seq, "%d.%03d KHz\n", osc / 1000, osc % 1000);
158 seq_printf(seq, "trim\t: %d\n", trim); 157 seq_printf(seq, "trim\t: %d\n", trim);
159 } 158 }
@@ -170,30 +169,31 @@ static struct rtc_class_ops rs5c372_rtc_ops = {
170static ssize_t rs5c372_sysfs_show_trim(struct device *dev, 169static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
171 struct device_attribute *attr, char *buf) 170 struct device_attribute *attr, char *buf)
172{ 171{
173 int trim; 172 int err, trim;
174 173
175 if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0) 174 err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim);
176 return sprintf(buf, "0x%2x\n", trim); 175 if (err)
176 return err;
177 177
178 return 0; 178 return sprintf(buf, "0x%2x\n", trim);
179} 179}
180static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); 180static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
181 181
182static ssize_t rs5c372_sysfs_show_osc(struct device *dev, 182static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
183 struct device_attribute *attr, char *buf) 183 struct device_attribute *attr, char *buf)
184{ 184{
185 int osc; 185 int err, osc;
186 186
187 if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0) 187 err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL);
188 return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); 188 if (err)
189 return err;
189 190
190 return 0; 191 return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
191} 192}
192static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); 193static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
193 194
194static int rs5c372_attach(struct i2c_adapter *adapter) 195static int rs5c372_attach(struct i2c_adapter *adapter)
195{ 196{
196 dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
197 return i2c_probe(adapter, &addr_data, rs5c372_probe); 197 return i2c_probe(adapter, &addr_data, rs5c372_probe);
198} 198}
199 199
@@ -233,8 +233,6 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind)
233 233
234 if (IS_ERR(rtc)) { 234 if (IS_ERR(rtc)) {
235 err = PTR_ERR(rtc); 235 err = PTR_ERR(rtc);
236 dev_err(&client->dev,
237 "unable to register the class device\n");
238 goto exit_detach; 236 goto exit_detach;
239 } 237 }
240 238
@@ -260,8 +258,6 @@ static int rs5c372_detach(struct i2c_client *client)
260 int err; 258 int err;
261 struct rtc_device *rtc = i2c_get_clientdata(client); 259 struct rtc_device *rtc = i2c_get_clientdata(client);
262 260
263 dev_dbg(&client->dev, "%s\n", __FUNCTION__);
264
265 if (rtc) 261 if (rtc)
266 rtc_device_unregister(rtc); 262 rtc_device_unregister(rtc);
267 263
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 83b2bb480a16..a23ec54989f6 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -160,19 +160,19 @@ static int sa1100_rtc_open(struct device *dev)
160 ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, SA_INTERRUPT, 160 ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, SA_INTERRUPT,
161 "rtc 1Hz", dev); 161 "rtc 1Hz", dev);
162 if (ret) { 162 if (ret) {
163 printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_RTC1Hz); 163 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz);
164 goto fail_ui; 164 goto fail_ui;
165 } 165 }
166 ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, SA_INTERRUPT, 166 ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, SA_INTERRUPT,
167 "rtc Alrm", dev); 167 "rtc Alrm", dev);
168 if (ret) { 168 if (ret) {
169 printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_RTCAlrm); 169 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm);
170 goto fail_ai; 170 goto fail_ai;
171 } 171 }
172 ret = request_irq(IRQ_OST1, timer1_interrupt, SA_INTERRUPT, 172 ret = request_irq(IRQ_OST1, timer1_interrupt, SA_INTERRUPT,
173 "rtc timer", dev); 173 "rtc timer", dev);
174 if (ret) { 174 if (ret) {
175 printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_OST1); 175 dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1);
176 goto fail_pi; 176 goto fail_pi;
177 } 177 }
178 return 0; 178 return 0;
@@ -332,7 +332,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
332 */ 332 */
333 if (RTTR == 0) { 333 if (RTTR == 0) {
334 RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16); 334 RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16);
335 printk(KERN_WARNING "rtc: warning: initializing default clock divider/trim value\n"); 335 dev_warn(&pdev->dev, "warning: initializing default clock divider/trim value\n");
336 /* The current RTC value probably doesn't make sense either */ 336 /* The current RTC value probably doesn't make sense either */
337 RCNR = 0; 337 RCNR = 0;
338 } 338 }
@@ -340,15 +340,11 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
340 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, 340 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops,
341 THIS_MODULE); 341 THIS_MODULE);
342 342
343 if (IS_ERR(rtc)) { 343 if (IS_ERR(rtc))
344 dev_err(&pdev->dev, "Unable to register the RTC device\n");
345 return PTR_ERR(rtc); 344 return PTR_ERR(rtc);
346 }
347 345
348 platform_set_drvdata(pdev, rtc); 346 platform_set_drvdata(pdev, rtc);
349 347
350 dev_info(&pdev->dev, "SA11xx/PXA2xx RTC Registered\n");
351
352 return 0; 348 return 0;
353} 349}
354 350
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 43d107487820..e1f7e8e86daf 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -49,7 +49,6 @@ static int test_rtc_proc(struct device *dev, struct seq_file *seq)
49{ 49{
50 struct platform_device *plat_dev = to_platform_device(dev); 50 struct platform_device *plat_dev = to_platform_device(dev);
51 51
52 seq_printf(seq, "24hr\t\t: yes\n");
53 seq_printf(seq, "test\t\t: yes\n"); 52 seq_printf(seq, "test\t\t: yes\n");
54 seq_printf(seq, "id\t\t: %d\n", plat_dev->id); 53 seq_printf(seq, "id\t\t: %d\n", plat_dev->id);
55 54
@@ -120,8 +119,6 @@ static int test_probe(struct platform_device *plat_dev)
120 &test_rtc_ops, THIS_MODULE); 119 &test_rtc_ops, THIS_MODULE);
121 if (IS_ERR(rtc)) { 120 if (IS_ERR(rtc)) {
122 err = PTR_ERR(rtc); 121 err = PTR_ERR(rtc);
123 dev_err(&plat_dev->dev,
124 "unable to register the class device\n");
125 return err; 122 return err;
126 } 123 }
127 device_create_file(&plat_dev->dev, &dev_attr_irq); 124 device_create_file(&plat_dev->dev, &dev_attr_irq);
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/rtc/rtc-vr41xx.c
index b109d9a502d6..4d49fd501198 100644
--- a/drivers/char/vr41xx_rtc.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Driver for NEC VR4100 series Real Time Clock unit. 2 * Driver for NEC VR4100 series Real Time Clock unit.
3 * 3 *
4 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2003-2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -17,23 +17,18 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <linux/platform_device.h>
21#include <linux/fs.h> 20#include <linux/fs.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/ioport.h> 22#include <linux/ioport.h>
24#include <linux/irq.h> 23#include <linux/irq.h>
25#include <linux/mc146818rtc.h>
26#include <linux/miscdevice.h>
27#include <linux/module.h> 24#include <linux/module.h>
28#include <linux/poll.h> 25#include <linux/platform_device.h>
29#include <linux/rtc.h> 26#include <linux/rtc.h>
30#include <linux/spinlock.h> 27#include <linux/spinlock.h>
31#include <linux/types.h> 28#include <linux/types.h>
32#include <linux/wait.h>
33 29
34#include <asm/div64.h> 30#include <asm/div64.h>
35#include <asm/io.h> 31#include <asm/io.h>
36#include <asm/time.h>
37#include <asm/uaccess.h> 32#include <asm/uaccess.h>
38#include <asm/vr41xx/vr41xx.h> 33#include <asm/vr41xx/vr41xx.h>
39 34
@@ -99,27 +94,11 @@ static void __iomem *rtc2_base;
99 94
100static unsigned long epoch = 1970; /* Jan 1 1970 00:00:00 */ 95static unsigned long epoch = 1970; /* Jan 1 1970 00:00:00 */
101 96
102static spinlock_t rtc_task_lock; 97static spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
103static wait_queue_head_t rtc_wait;
104static unsigned long rtc_irq_data;
105static struct fasync_struct *rtc_async_queue;
106static rtc_task_t *rtc_callback;
107static char rtc_name[] = "RTC"; 98static char rtc_name[] = "RTC";
108static unsigned long periodic_frequency; 99static unsigned long periodic_frequency;
109static unsigned long periodic_count; 100static unsigned long periodic_count;
110 101
111typedef enum {
112 RTC_RELEASE,
113 RTC_OPEN,
114} rtc_status_t;
115
116static rtc_status_t rtc_status;
117
118typedef enum {
119 FUNCTION_RTC_IOCTL,
120 FUNCTION_RTC_CONTROL,
121} rtc_callfrom_t;
122
123struct resource rtc_resource[2] = { 102struct resource rtc_resource[2] = {
124 { .name = rtc_name, 103 { .name = rtc_name,
125 .flags = IORESOURCE_MEM, }, 104 .flags = IORESOURCE_MEM, },
@@ -129,7 +108,9 @@ struct resource rtc_resource[2] = {
129 108
130static inline unsigned long read_elapsed_second(void) 109static inline unsigned long read_elapsed_second(void)
131{ 110{
111
132 unsigned long first_low, first_mid, first_high; 112 unsigned long first_low, first_mid, first_high;
113
133 unsigned long second_low, second_mid, second_high; 114 unsigned long second_low, second_mid, second_high;
134 115
135 do { 116 do {
@@ -156,50 +137,36 @@ static inline void write_elapsed_second(unsigned long sec)
156 spin_unlock_irq(&rtc_lock); 137 spin_unlock_irq(&rtc_lock);
157} 138}
158 139
159static void set_alarm(struct rtc_time *time) 140static void vr41xx_rtc_release(struct device *dev)
160{ 141{
161 unsigned long alarm_sec;
162
163 alarm_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
164 time->tm_hour, time->tm_min, time->tm_sec);
165
166 spin_lock_irq(&rtc_lock);
167
168 rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15));
169 rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1));
170 rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17));
171
172 spin_unlock_irq(&rtc_lock);
173}
174
175static void read_alarm(struct rtc_time *time)
176{
177 unsigned long low, mid, high;
178 142
179 spin_lock_irq(&rtc_lock); 143 spin_lock_irq(&rtc_lock);
180 144
181 low = rtc1_read(ECMPLREG); 145 rtc1_write(ECMPLREG, 0);
182 mid = rtc1_read(ECMPMREG); 146 rtc1_write(ECMPMREG, 0);
183 high = rtc1_read(ECMPHREG); 147 rtc1_write(ECMPHREG, 0);
148 rtc1_write(RTCL1LREG, 0);
149 rtc1_write(RTCL1HREG, 0);
184 150
185 spin_unlock_irq(&rtc_lock); 151 spin_unlock_irq(&rtc_lock);
186 152
187 to_tm((high << 17) | (mid << 1) | (low >> 15), time); 153 disable_irq(ELAPSEDTIME_IRQ);
188 time->tm_year -= 1900; 154 disable_irq(RTCLONG1_IRQ);
189} 155}
190 156
191static void read_time(struct rtc_time *time) 157static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time)
192{ 158{
193 unsigned long epoch_sec, elapsed_sec; 159 unsigned long epoch_sec, elapsed_sec;
194 160
195 epoch_sec = mktime(epoch, 1, 1, 0, 0, 0); 161 epoch_sec = mktime(epoch, 1, 1, 0, 0, 0);
196 elapsed_sec = read_elapsed_second(); 162 elapsed_sec = read_elapsed_second();
197 163
198 to_tm(epoch_sec + elapsed_sec, time); 164 rtc_time_to_tm(epoch_sec + elapsed_sec, time);
199 time->tm_year -= 1900; 165
166 return 0;
200} 167}
201 168
202static void set_time(struct rtc_time *time) 169static int vr41xx_rtc_set_time(struct device *dev, struct rtc_time *time)
203{ 170{
204 unsigned long epoch_sec, current_sec; 171 unsigned long epoch_sec, current_sec;
205 172
@@ -208,73 +175,49 @@ static void set_time(struct rtc_time *time)
208 time->tm_hour, time->tm_min, time->tm_sec); 175 time->tm_hour, time->tm_min, time->tm_sec);
209 176
210 write_elapsed_second(current_sec - epoch_sec); 177 write_elapsed_second(current_sec - epoch_sec);
178
179 return 0;
211} 180}
212 181
213static ssize_t rtc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 182static int vr41xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
214{ 183{
215 DECLARE_WAITQUEUE(wait, current); 184 unsigned long low, mid, high;
216 unsigned long irq_data; 185 struct rtc_time *time = &wkalrm->time;
217 int retval = 0;
218
219 if (count != sizeof(unsigned int) && count != sizeof(unsigned long))
220 return -EINVAL;
221
222 add_wait_queue(&rtc_wait, &wait);
223
224 do {
225 __set_current_state(TASK_INTERRUPTIBLE);
226 186
227 spin_lock_irq(&rtc_lock); 187 spin_lock_irq(&rtc_lock);
228 irq_data = rtc_irq_data;
229 rtc_irq_data = 0;
230 spin_unlock_irq(&rtc_lock);
231 188
232 if (irq_data != 0) 189 low = rtc1_read(ECMPLREG);
233 break; 190 mid = rtc1_read(ECMPMREG);
191 high = rtc1_read(ECMPHREG);
234 192
235 if (file->f_flags & O_NONBLOCK) { 193 spin_unlock_irq(&rtc_lock);
236 retval = -EAGAIN;
237 break;
238 }
239 194
240 if (signal_pending(current)) { 195 rtc_time_to_tm((high << 17) | (mid << 1) | (low >> 15), time);
241 retval = -ERESTARTSYS;
242 break;
243 }
244 } while (1);
245 196
246 if (retval == 0) { 197 return 0;
247 if (count == sizeof(unsigned int)) { 198}
248 retval = put_user(irq_data, (unsigned int __user *)buf);
249 if (retval == 0)
250 retval = sizeof(unsigned int);
251 } else {
252 retval = put_user(irq_data, (unsigned long __user *)buf);
253 if (retval == 0)
254 retval = sizeof(unsigned long);
255 }
256 199
257 } 200static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
201{
202 unsigned long alarm_sec;
203 struct rtc_time *time = &wkalrm->time;
258 204
259 __set_current_state(TASK_RUNNING); 205 alarm_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
260 remove_wait_queue(&rtc_wait, &wait); 206 time->tm_hour, time->tm_min, time->tm_sec);
261 207
262 return retval; 208 spin_lock_irq(&rtc_lock);
263}
264 209
265static unsigned int rtc_poll(struct file *file, struct poll_table_struct *table) 210 rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15));
266{ 211 rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1));
267 poll_wait(file, &rtc_wait, table); 212 rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17));
268 213
269 if (rtc_irq_data != 0) 214 spin_unlock_irq(&rtc_lock);
270 return POLLIN | POLLRDNORM;
271 215
272 return 0; 216 return 0;
273} 217}
274 218
275static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, rtc_callfrom_t from) 219static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
276{ 220{
277 struct rtc_time time;
278 unsigned long count; 221 unsigned long count;
279 222
280 switch (cmd) { 223 switch (cmd) {
@@ -290,33 +233,6 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, rtc_callfrom_t from
290 case RTC_PIE_OFF: 233 case RTC_PIE_OFF:
291 disable_irq(RTCLONG1_IRQ); 234 disable_irq(RTCLONG1_IRQ);
292 break; 235 break;
293 case RTC_ALM_SET:
294 if (copy_from_user(&time, (struct rtc_time __user *)arg,
295 sizeof(struct rtc_time)))
296 return -EFAULT;
297
298 set_alarm(&time);
299 break;
300 case RTC_ALM_READ:
301 memset(&time, 0, sizeof(struct rtc_time));
302 read_alarm(&time);
303 break;
304 case RTC_RD_TIME:
305 memset(&time, 0, sizeof(struct rtc_time));
306 read_time(&time);
307 if (copy_to_user((void __user *)arg, &time, sizeof(struct rtc_time)))
308 return -EFAULT;
309 break;
310 case RTC_SET_TIME:
311 if (capable(CAP_SYS_TIME) == 0)
312 return -EACCES;
313
314 if (copy_from_user(&time, (struct rtc_time __user *)arg,
315 sizeof(struct rtc_time)))
316 return -EFAULT;
317
318 set_time(&time);
319 break;
320 case RTC_IRQP_READ: 236 case RTC_IRQP_READ:
321 return put_user(periodic_frequency, (unsigned long __user *)arg); 237 return put_user(periodic_frequency, (unsigned long __user *)arg);
322 break; 238 break;
@@ -324,8 +240,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, rtc_callfrom_t from
324 if (arg > MAX_PERIODIC_RATE) 240 if (arg > MAX_PERIODIC_RATE)
325 return -EINVAL; 241 return -EINVAL;
326 242
327 if (from == FUNCTION_RTC_IOCTL && arg > MAX_USER_PERIODIC_RATE && 243 if (arg > MAX_USER_PERIODIC_RATE && capable(CAP_SYS_RESOURCE) == 0)
328 capable(CAP_SYS_RESOURCE) == 0)
329 return -EACCES; 244 return -EACCES;
330 245
331 periodic_frequency = arg; 246 periodic_frequency = arg;
@@ -361,205 +276,46 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, rtc_callfrom_t from
361 return 0; 276 return 0;
362} 277}
363 278
364static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
365 unsigned long arg)
366{
367 return rtc_do_ioctl(cmd, arg, FUNCTION_RTC_IOCTL);
368}
369
370static int rtc_open(struct inode *inode, struct file *file)
371{
372 spin_lock_irq(&rtc_lock);
373
374 if (rtc_status == RTC_OPEN) {
375 spin_unlock_irq(&rtc_lock);
376 return -EBUSY;
377 }
378
379 rtc_status = RTC_OPEN;
380 rtc_irq_data = 0;
381
382 spin_unlock_irq(&rtc_lock);
383
384 return 0;
385}
386
387static int rtc_release(struct inode *inode, struct file *file)
388{
389 if (file->f_flags & FASYNC)
390 (void)fasync_helper(-1, file, 0, &rtc_async_queue);
391
392 spin_lock_irq(&rtc_lock);
393
394 rtc1_write(ECMPLREG, 0);
395 rtc1_write(ECMPMREG, 0);
396 rtc1_write(ECMPHREG, 0);
397 rtc1_write(RTCL1LREG, 0);
398 rtc1_write(RTCL1HREG, 0);
399
400 rtc_status = RTC_RELEASE;
401
402 spin_unlock_irq(&rtc_lock);
403
404 disable_irq(ELAPSEDTIME_IRQ);
405 disable_irq(RTCLONG1_IRQ);
406
407 return 0;
408}
409
410static int rtc_fasync(int fd, struct file *file, int on)
411{
412 return fasync_helper(fd, file, on, &rtc_async_queue);
413}
414
415static struct file_operations rtc_fops = {
416 .owner = THIS_MODULE,
417 .llseek = no_llseek,
418 .read = rtc_read,
419 .poll = rtc_poll,
420 .ioctl = rtc_ioctl,
421 .open = rtc_open,
422 .release = rtc_release,
423 .fasync = rtc_fasync,
424};
425
426static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id, struct pt_regs *regs) 279static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id, struct pt_regs *regs)
427{ 280{
428 spin_lock(&rtc_lock); 281 struct platform_device *pdev = (struct platform_device *)dev_id;
429 rtc2_write(RTCINTREG, ELAPSEDTIME_INT); 282 struct rtc_device *rtc = platform_get_drvdata(pdev);
430
431 rtc_irq_data += 0x100;
432 rtc_irq_data &= ~0xff;
433 rtc_irq_data |= RTC_AF;
434 spin_unlock(&rtc_lock);
435 283
436 spin_lock(&rtc_lock); 284 rtc2_write(RTCINTREG, ELAPSEDTIME_INT);
437 if (rtc_callback)
438 rtc_callback->func(rtc_callback->private_data);
439 spin_unlock(&rtc_lock);
440
441 wake_up_interruptible(&rtc_wait);
442 285
443 kill_fasync(&rtc_async_queue, SIGIO, POLL_IN); 286 rtc_update_irq(&rtc->class_dev, 1, RTC_AF);
444 287
445 return IRQ_HANDLED; 288 return IRQ_HANDLED;
446} 289}
447 290
448static irqreturn_t rtclong1_interrupt(int irq, void *dev_id, struct pt_regs *regs) 291static irqreturn_t rtclong1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
449{ 292{
293 struct platform_device *pdev = (struct platform_device *)dev_id;
294 struct rtc_device *rtc = platform_get_drvdata(pdev);
450 unsigned long count = periodic_count; 295 unsigned long count = periodic_count;
451 296
452 spin_lock(&rtc_lock);
453 rtc2_write(RTCINTREG, RTCLONG1_INT); 297 rtc2_write(RTCINTREG, RTCLONG1_INT);
454 298
455 rtc1_write(RTCL1LREG, count); 299 rtc1_write(RTCL1LREG, count);
456 rtc1_write(RTCL1HREG, count >> 16); 300 rtc1_write(RTCL1HREG, count >> 16);
457 301
458 rtc_irq_data += 0x100; 302 rtc_update_irq(&rtc->class_dev, 1, RTC_PF);
459 rtc_irq_data &= ~0xff;
460 rtc_irq_data |= RTC_PF;
461 spin_unlock(&rtc_lock);
462
463 spin_lock(&rtc_task_lock);
464 if (rtc_callback)
465 rtc_callback->func(rtc_callback->private_data);
466 spin_unlock(&rtc_task_lock);
467
468 wake_up_interruptible(&rtc_wait);
469
470 kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
471 303
472 return IRQ_HANDLED; 304 return IRQ_HANDLED;
473} 305}
474 306
475int rtc_register(rtc_task_t *task) 307static struct rtc_class_ops vr41xx_rtc_ops = {
476{ 308 .release = vr41xx_rtc_release,
477 if (task == NULL || task->func == NULL) 309 .ioctl = vr41xx_rtc_ioctl,
478 return -EINVAL; 310 .read_time = vr41xx_rtc_read_time,
479 311 .set_time = vr41xx_rtc_set_time,
480 spin_lock_irq(&rtc_lock); 312 .read_alarm = vr41xx_rtc_read_alarm,
481 if (rtc_status == RTC_OPEN) { 313 .set_alarm = vr41xx_rtc_set_alarm,
482 spin_unlock_irq(&rtc_lock);
483 return -EBUSY;
484 }
485
486 spin_lock(&rtc_task_lock);
487 if (rtc_callback != NULL) {
488 spin_unlock(&rtc_task_lock);
489 spin_unlock_irq(&rtc_task_lock);
490 return -EBUSY;
491 }
492
493 rtc_callback = task;
494 spin_unlock(&rtc_task_lock);
495
496 rtc_status = RTC_OPEN;
497
498 spin_unlock_irq(&rtc_lock);
499
500 return 0;
501}
502
503EXPORT_SYMBOL_GPL(rtc_register);
504
505int rtc_unregister(rtc_task_t *task)
506{
507 spin_lock_irq(&rtc_task_lock);
508 if (task == NULL || rtc_callback != task) {
509 spin_unlock_irq(&rtc_task_lock);
510 return -ENXIO;
511 }
512
513 spin_lock(&rtc_lock);
514
515 rtc1_write(ECMPLREG, 0);
516 rtc1_write(ECMPMREG, 0);
517 rtc1_write(ECMPHREG, 0);
518 rtc1_write(RTCL1LREG, 0);
519 rtc1_write(RTCL1HREG, 0);
520
521 rtc_status = RTC_RELEASE;
522
523 spin_unlock(&rtc_lock);
524
525 rtc_callback = NULL;
526
527 spin_unlock_irq(&rtc_task_lock);
528
529 disable_irq(ELAPSEDTIME_IRQ);
530 disable_irq(RTCLONG1_IRQ);
531
532 return 0;
533}
534
535EXPORT_SYMBOL_GPL(rtc_unregister);
536
537int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
538{
539 int retval = 0;
540
541 spin_lock_irq(&rtc_task_lock);
542
543 if (rtc_callback != task)
544 retval = -ENXIO;
545 else
546 rtc_do_ioctl(cmd, arg, FUNCTION_RTC_CONTROL);
547
548 spin_unlock_irq(&rtc_task_lock);
549
550 return retval;
551}
552
553EXPORT_SYMBOL_GPL(rtc_control);
554
555static struct miscdevice rtc_miscdevice = {
556 .minor = RTC_MINOR,
557 .name = rtc_name,
558 .fops = &rtc_fops,
559}; 314};
560 315
561static int __devinit rtc_probe(struct platform_device *pdev) 316static int __devinit rtc_probe(struct platform_device *pdev)
562{ 317{
318 struct rtc_device *rtc;
563 unsigned int irq; 319 unsigned int irq;
564 int retval; 320 int retval;
565 321
@@ -577,13 +333,13 @@ static int __devinit rtc_probe(struct platform_device *pdev)
577 return -EBUSY; 333 return -EBUSY;
578 } 334 }
579 335
580 retval = misc_register(&rtc_miscdevice); 336 rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE);
581 if (retval < 0) { 337 if (IS_ERR(rtc)) {
582 iounmap(rtc1_base); 338 iounmap(rtc1_base);
583 iounmap(rtc2_base); 339 iounmap(rtc2_base);
584 rtc1_base = NULL; 340 rtc1_base = NULL;
585 rtc2_base = NULL; 341 rtc2_base = NULL;
586 return retval; 342 return PTR_ERR(rtc);
587 } 343 }
588 344
589 spin_lock_irq(&rtc_lock); 345 spin_lock_irq(&rtc_lock);
@@ -594,24 +350,20 @@ static int __devinit rtc_probe(struct platform_device *pdev)
594 rtc1_write(RTCL1LREG, 0); 350 rtc1_write(RTCL1LREG, 0);
595 rtc1_write(RTCL1HREG, 0); 351 rtc1_write(RTCL1HREG, 0);
596 352
597 rtc_status = RTC_RELEASE;
598 rtc_irq_data = 0;
599
600 spin_unlock_irq(&rtc_lock); 353 spin_unlock_irq(&rtc_lock);
601 354
602 init_waitqueue_head(&rtc_wait);
603
604 irq = ELAPSEDTIME_IRQ; 355 irq = ELAPSEDTIME_IRQ;
605 retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT, 356 retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT,
606 "elapsed_time", NULL); 357 "elapsed_time", pdev);
607 if (retval == 0) { 358 if (retval == 0) {
608 irq = RTCLONG1_IRQ; 359 irq = RTCLONG1_IRQ;
609 retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT, 360 retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT,
610 "rtclong1", NULL); 361 "rtclong1", pdev);
611 } 362 }
612 363
613 if (retval < 0) { 364 if (retval < 0) {
614 printk(KERN_ERR "rtc: IRQ%d is busy\n", irq); 365 printk(KERN_ERR "rtc: IRQ%d is busy\n", irq);
366 rtc_device_unregister(rtc);
615 if (irq == RTCLONG1_IRQ) 367 if (irq == RTCLONG1_IRQ)
616 free_irq(ELAPSEDTIME_IRQ, NULL); 368 free_irq(ELAPSEDTIME_IRQ, NULL);
617 iounmap(rtc1_base); 369 iounmap(rtc1_base);
@@ -621,23 +373,25 @@ static int __devinit rtc_probe(struct platform_device *pdev)
621 return retval; 373 return retval;
622 } 374 }
623 375
376 platform_set_drvdata(pdev, rtc);
377
624 disable_irq(ELAPSEDTIME_IRQ); 378 disable_irq(ELAPSEDTIME_IRQ);
625 disable_irq(RTCLONG1_IRQ); 379 disable_irq(RTCLONG1_IRQ);
626 380
627 spin_lock_init(&rtc_task_lock);
628
629 printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n"); 381 printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n");
630 382
631 return 0; 383 return 0;
632} 384}
633 385
634static int __devexit rtc_remove(struct platform_device *dev) 386static int __devexit rtc_remove(struct platform_device *pdev)
635{ 387{
636 int retval; 388 struct rtc_device *rtc;
637 389
638 retval = misc_deregister(&rtc_miscdevice); 390 rtc = platform_get_drvdata(pdev);
639 if (retval < 0) 391 if (rtc != NULL)
640 return retval; 392 rtc_device_unregister(rtc);
393
394 platform_set_drvdata(pdev, NULL);
641 395
642 free_irq(ELAPSEDTIME_IRQ, NULL); 396 free_irq(ELAPSEDTIME_IRQ, NULL);
643 free_irq(RTCLONG1_IRQ, NULL); 397 free_irq(RTCLONG1_IRQ, NULL);
@@ -651,7 +405,7 @@ static int __devexit rtc_remove(struct platform_device *dev)
651 405
652static struct platform_device *rtc_platform_device; 406static struct platform_device *rtc_platform_device;
653 407
654static struct platform_driver rtc_device_driver = { 408static struct platform_driver rtc_platform_driver = {
655 .probe = rtc_probe, 409 .probe = rtc_probe,
656 .remove = __devexit_p(rtc_remove), 410 .remove = __devexit_p(rtc_remove),
657 .driver = { 411 .driver = {
@@ -686,7 +440,7 @@ static int __init vr41xx_rtc_init(void)
686 } 440 }
687 441
688 rtc_platform_device = platform_device_alloc("RTC", -1); 442 rtc_platform_device = platform_device_alloc("RTC", -1);
689 if (!rtc_platform_device) 443 if (rtc_platform_device == NULL)
690 return -ENOMEM; 444 return -ENOMEM;
691 445
692 retval = platform_device_add_resources(rtc_platform_device, 446 retval = platform_device_add_resources(rtc_platform_device,
@@ -700,7 +454,7 @@ static int __init vr41xx_rtc_init(void)
700 return retval; 454 return retval;
701 } 455 }
702 456
703 retval = platform_driver_register(&rtc_device_driver); 457 retval = platform_driver_register(&rtc_platform_driver);
704 if (retval < 0) 458 if (retval < 0)
705 platform_device_unregister(rtc_platform_device); 459 platform_device_unregister(rtc_platform_device);
706 460
@@ -709,7 +463,7 @@ static int __init vr41xx_rtc_init(void)
709 463
710static void __exit vr41xx_rtc_exit(void) 464static void __exit vr41xx_rtc_exit(void)
711{ 465{
712 platform_driver_unregister(&rtc_device_driver); 466 platform_driver_unregister(&rtc_platform_driver);
713 platform_device_unregister(rtc_platform_device); 467 platform_device_unregister(rtc_platform_device);
714} 468}
715 469
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 621d17afc0d9..788b6d1f8f2f 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -19,7 +19,7 @@
19#include <linux/rtc.h> 19#include <linux/rtc.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21 21
22#define DRV_VERSION "1.0.6" 22#define DRV_VERSION "1.0.7"
23 23
24/* Addresses to scan: none. This chip is located at 24/* Addresses to scan: none. This chip is located at
25 * 0x6f and uses a two bytes register addressing. 25 * 0x6f and uses a two bytes register addressing.
@@ -451,8 +451,6 @@ static int x1205_rtc_proc(struct device *dev, struct seq_file *seq)
451{ 451{
452 int err, dtrim, atrim; 452 int err, dtrim, atrim;
453 453
454 seq_printf(seq, "24hr\t\t: yes\n");
455
456 if ((err = x1205_get_dtrim(to_i2c_client(dev), &dtrim)) == 0) 454 if ((err = x1205_get_dtrim(to_i2c_client(dev), &dtrim)) == 0)
457 seq_printf(seq, "digital_trim\t: %d ppm\n", dtrim); 455 seq_printf(seq, "digital_trim\t: %d ppm\n", dtrim);
458 456
@@ -473,30 +471,31 @@ static struct rtc_class_ops x1205_rtc_ops = {
473static ssize_t x1205_sysfs_show_atrim(struct device *dev, 471static ssize_t x1205_sysfs_show_atrim(struct device *dev,
474 struct device_attribute *attr, char *buf) 472 struct device_attribute *attr, char *buf)
475{ 473{
476 int atrim; 474 int err, atrim;
477 475
478 if (x1205_get_atrim(to_i2c_client(dev), &atrim) == 0) 476 err = x1205_get_atrim(to_i2c_client(dev), &atrim);
479 return sprintf(buf, "%d.%02d pF\n", 477 if (err)
480 atrim / 1000, atrim % 1000); 478 return err;
481 return 0; 479
480 return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
482} 481}
483static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL); 482static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);
484 483
485static ssize_t x1205_sysfs_show_dtrim(struct device *dev, 484static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
486 struct device_attribute *attr, char *buf) 485 struct device_attribute *attr, char *buf)
487{ 486{
488 int dtrim; 487 int err, dtrim;
489 488
490 if (x1205_get_dtrim(to_i2c_client(dev), &dtrim) == 0) 489 err = x1205_get_dtrim(to_i2c_client(dev), &dtrim);
491 return sprintf(buf, "%d ppm\n", dtrim); 490 if (err)
491 return err;
492 492
493 return 0; 493 return sprintf(buf, "%d ppm\n", dtrim);
494} 494}
495static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); 495static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL);
496 496
497static int x1205_attach(struct i2c_adapter *adapter) 497static int x1205_attach(struct i2c_adapter *adapter)
498{ 498{
499 dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
500 return i2c_probe(adapter, &addr_data, x1205_probe); 499 return i2c_probe(adapter, &addr_data, x1205_probe);
501} 500}
502 501
@@ -545,8 +544,6 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind)
545 544
546 if (IS_ERR(rtc)) { 545 if (IS_ERR(rtc)) {
547 err = PTR_ERR(rtc); 546 err = PTR_ERR(rtc);
548 dev_err(&client->dev,
549 "unable to register the class device\n");
550 goto exit_detach; 547 goto exit_detach;
551 } 548 }
552 549
@@ -585,8 +582,6 @@ static int x1205_detach(struct i2c_client *client)
585 int err; 582 int err;
586 struct rtc_device *rtc = i2c_get_clientdata(client); 583 struct rtc_device *rtc = i2c_get_clientdata(client);
587 584
588 dev_dbg(&client->dev, "%s\n", __FUNCTION__);
589
590 if (rtc) 585 if (rtc)
591 rtc_device_unregister(rtc); 586 rtc_device_unregister(rtc);
592 587
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 0a9f12c4e911..a3bfebcf31ef 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1257,25 +1257,28 @@ __dasd_start_head(struct dasd_device * device)
1257 if (list_empty(&device->ccw_queue)) 1257 if (list_empty(&device->ccw_queue))
1258 return; 1258 return;
1259 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1259 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1260 /* check FAILFAST */ 1260 if (cqr->status != DASD_CQR_QUEUED)
1261 return;
1262 /* Non-temporary stop condition will trigger fail fast */
1261 if (device->stopped & ~DASD_STOPPED_PENDING && 1263 if (device->stopped & ~DASD_STOPPED_PENDING &&
1262 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && 1264 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) &&
1263 (!dasd_eer_enabled(device))) { 1265 (!dasd_eer_enabled(device))) {
1264 cqr->status = DASD_CQR_FAILED; 1266 cqr->status = DASD_CQR_FAILED;
1265 dasd_schedule_bh(device); 1267 dasd_schedule_bh(device);
1268 return;
1266 } 1269 }
1267 if ((cqr->status == DASD_CQR_QUEUED) && 1270 /* Don't try to start requests if device is stopped */
1268 (!device->stopped)) { 1271 if (device->stopped)
1269 /* try to start the first I/O that can be started */ 1272 return;
1270 rc = device->discipline->start_IO(cqr); 1273
1271 if (rc == 0) 1274 rc = device->discipline->start_IO(cqr);
1272 dasd_set_timer(device, cqr->expires); 1275 if (rc == 0)
1273 else if (rc == -EACCES) { 1276 dasd_set_timer(device, cqr->expires);
1274 dasd_schedule_bh(device); 1277 else if (rc == -EACCES) {
1275 } else 1278 dasd_schedule_bh(device);
1276 /* Hmpf, try again in 1/2 sec */ 1279 } else
1277 dasd_set_timer(device, 50); 1280 /* Hmpf, try again in 1/2 sec */
1278 } 1281 dasd_set_timer(device, 50);
1279} 1282}
1280 1283
1281/* 1284/*
@@ -1968,7 +1971,7 @@ int
1968dasd_generic_set_offline (struct ccw_device *cdev) 1971dasd_generic_set_offline (struct ccw_device *cdev)
1969{ 1972{
1970 struct dasd_device *device; 1973 struct dasd_device *device;
1971 int max_count; 1974 int max_count, open_count;
1972 1975
1973 device = dasd_device_from_cdev(cdev); 1976 device = dasd_device_from_cdev(cdev);
1974 if (IS_ERR(device)) 1977 if (IS_ERR(device))
@@ -1985,10 +1988,16 @@ dasd_generic_set_offline (struct ccw_device *cdev)
1985 * in the other openers. 1988 * in the other openers.
1986 */ 1989 */
1987 max_count = device->bdev ? 0 : -1; 1990 max_count = device->bdev ? 0 : -1;
1988 if (atomic_read(&device->open_count) > max_count) { 1991 open_count = (int) atomic_read(&device->open_count);
1989 printk (KERN_WARNING "Can't offline dasd device with open" 1992 if (open_count > max_count) {
1990 " count = %i.\n", 1993 if (open_count > 0)
1991 atomic_read(&device->open_count)); 1994 printk (KERN_WARNING "Can't offline dasd device with "
1995 "open count = %i.\n",
1996 open_count);
1997 else
1998 printk (KERN_WARNING "%s",
1999 "Can't offline dasd device due to internal "
2000 "use\n");
1992 clear_bit(DASD_FLAG_OFFLINE, &device->flags); 2001 clear_bit(DASD_FLAG_OFFLINE, &device->flags);
1993 dasd_put_device(device); 2002 dasd_put_device(device);
1994 return -EBUSY; 2003 return -EBUSY;
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index 1aa3c261718a..ad23aede356c 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -294,23 +294,40 @@ out_error:
294#endif /* CONFIG_DASD_PROFILE */ 294#endif /* CONFIG_DASD_PROFILE */
295} 295}
296 296
297/*
298 * Create dasd proc-fs entries.
299 * In case creation failed, cleanup and return -ENOENT.
300 */
297int 301int
298dasd_proc_init(void) 302dasd_proc_init(void)
299{ 303{
300 dasd_proc_root_entry = proc_mkdir("dasd", &proc_root); 304 dasd_proc_root_entry = proc_mkdir("dasd", &proc_root);
305 if (!dasd_proc_root_entry)
306 goto out_nodasd;
301 dasd_proc_root_entry->owner = THIS_MODULE; 307 dasd_proc_root_entry->owner = THIS_MODULE;
302 dasd_devices_entry = create_proc_entry("devices", 308 dasd_devices_entry = create_proc_entry("devices",
303 S_IFREG | S_IRUGO | S_IWUSR, 309 S_IFREG | S_IRUGO | S_IWUSR,
304 dasd_proc_root_entry); 310 dasd_proc_root_entry);
311 if (!dasd_devices_entry)
312 goto out_nodevices;
305 dasd_devices_entry->proc_fops = &dasd_devices_file_ops; 313 dasd_devices_entry->proc_fops = &dasd_devices_file_ops;
306 dasd_devices_entry->owner = THIS_MODULE; 314 dasd_devices_entry->owner = THIS_MODULE;
307 dasd_statistics_entry = create_proc_entry("statistics", 315 dasd_statistics_entry = create_proc_entry("statistics",
308 S_IFREG | S_IRUGO | S_IWUSR, 316 S_IFREG | S_IRUGO | S_IWUSR,
309 dasd_proc_root_entry); 317 dasd_proc_root_entry);
318 if (!dasd_statistics_entry)
319 goto out_nostatistics;
310 dasd_statistics_entry->read_proc = dasd_statistics_read; 320 dasd_statistics_entry->read_proc = dasd_statistics_read;
311 dasd_statistics_entry->write_proc = dasd_statistics_write; 321 dasd_statistics_entry->write_proc = dasd_statistics_write;
312 dasd_statistics_entry->owner = THIS_MODULE; 322 dasd_statistics_entry->owner = THIS_MODULE;
313 return 0; 323 return 0;
324
325 out_nostatistics:
326 remove_proc_entry("devices", dasd_proc_root_entry);
327 out_nodevices:
328 remove_proc_entry("dasd", &proc_root);
329 out_nodasd:
330 return -ENOENT;
314} 331}
315 332
316void 333void
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index 6badd8403409..d4d2ff0a9da2 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -54,7 +54,7 @@ kbd_alloc(void) {
54 if (!kbd) 54 if (!kbd)
55 goto out; 55 goto out;
56 kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL); 56 kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL);
57 if (!key_maps) 57 if (!kbd->key_maps)
58 goto out_kbd; 58 goto out_kbd;
59 for (i = 0; i < ARRAY_SIZE(key_maps); i++) { 59 for (i = 0; i < ARRAY_SIZE(key_maps); i++) {
60 if (key_maps[i]) { 60 if (key_maps[i]) {
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 5c65cf3e5cc0..b70d92690242 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -432,8 +432,8 @@ tapeblock_ioctl(
432) { 432) {
433 int rc; 433 int rc;
434 int minor; 434 int minor;
435 struct gendisk *disk = inode->i_bdev->bd_disk; 435 struct gendisk *disk;
436 struct tape_device *device = disk->private_data; 436 struct tape_device *device;
437 437
438 rc = 0; 438 rc = 0;
439 disk = inode->i_bdev->bd_disk; 439 disk = inode->i_bdev->bd_disk;
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 389ee2c0f443..e6e4086d3224 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -210,18 +210,14 @@ tape_state_set(struct tape_device *device, enum tape_state newstate)
210 return; 210 return;
211 } 211 }
212 DBF_EVENT(4, "ts. dev: %x\n", device->first_minor); 212 DBF_EVENT(4, "ts. dev: %x\n", device->first_minor);
213 if (device->tape_state < TO_SIZE && device->tape_state >= 0) 213 DBF_EVENT(4, "old ts:\t\n");
214 str = tape_state_verbose[device->tape_state]; 214 if (device->tape_state < TS_SIZE && device->tape_state >=0 )
215 else
216 str = "UNKNOWN TS";
217 DBF_EVENT(4, "old ts: %s\n", str);
218 if (device->tape_state < TO_SIZE && device->tape_state >=0 )
219 str = tape_state_verbose[device->tape_state]; 215 str = tape_state_verbose[device->tape_state];
220 else 216 else
221 str = "UNKNOWN TS"; 217 str = "UNKNOWN TS";
222 DBF_EVENT(4, "%s\n", str); 218 DBF_EVENT(4, "%s\n", str);
223 DBF_EVENT(4, "new ts:\t\n"); 219 DBF_EVENT(4, "new ts:\t\n");
224 if (newstate < TO_SIZE && newstate >= 0) 220 if (newstate < TS_SIZE && newstate >= 0)
225 str = tape_state_verbose[newstate]; 221 str = tape_state_verbose[newstate];
226 else 222 else
227 str = "UNKNOWN TS"; 223 str = "UNKNOWN TS";
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index cb8e2e672b68..0960bef7b199 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -414,11 +414,11 @@ cio_ignore_proc_init (void)
414 entry = create_proc_entry ("cio_ignore", S_IFREG | S_IRUGO | S_IWUSR, 414 entry = create_proc_entry ("cio_ignore", S_IFREG | S_IRUGO | S_IWUSR,
415 &proc_root); 415 &proc_root);
416 if (!entry) 416 if (!entry)
417 return 0; 417 return -ENOENT;
418 418
419 entry->proc_fops = &cio_ignore_proc_fops; 419 entry->proc_fops = &cio_ignore_proc_fops;
420 420
421 return 1; 421 return 0;
422} 422}
423 423
424__initcall (cio_ignore_proc_init); 424__initcall (cio_ignore_proc_init);
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index cbb86fa5f293..5b20d8c9c025 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -67,7 +67,7 @@ cio_debug_init (void)
67 goto out_unregister; 67 goto out_unregister;
68 debug_register_view (cio_debug_msg_id, &debug_sprintf_view); 68 debug_register_view (cio_debug_msg_id, &debug_sprintf_view);
69 debug_set_level (cio_debug_msg_id, 2); 69 debug_set_level (cio_debug_msg_id, 2);
70 cio_debug_trace_id = debug_register ("cio_trace", 16, 4, 8); 70 cio_debug_trace_id = debug_register ("cio_trace", 16, 4, 16);
71 if (!cio_debug_trace_id) 71 if (!cio_debug_trace_id)
72 goto out_unregister; 72 goto out_unregister;
73 debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view); 73 debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view);
diff --git a/drivers/s390/cio/cio_debug.h b/drivers/s390/cio/cio_debug.h
index 6af8b27d366b..f88844adae1b 100644
--- a/drivers/s390/cio/cio_debug.h
+++ b/drivers/s390/cio/cio_debug.h
@@ -3,6 +3,11 @@
3 3
4#include <asm/debug.h> 4#include <asm/debug.h>
5 5
6/* for use of debug feature */
7extern debug_info_t *cio_debug_msg_id;
8extern debug_info_t *cio_debug_trace_id;
9extern debug_info_t *cio_debug_crw_id;
10
6#define CIO_TRACE_EVENT(imp, txt) do { \ 11#define CIO_TRACE_EVENT(imp, txt) do { \
7 debug_text_event(cio_debug_trace_id, imp, txt); \ 12 debug_text_event(cio_debug_trace_id, imp, txt); \
8 } while (0) 13 } while (0)
@@ -15,18 +20,19 @@
15 debug_sprintf_event(cio_debug_crw_id, imp , ##args); \ 20 debug_sprintf_event(cio_debug_crw_id, imp , ##args); \
16 } while (0) 21 } while (0)
17 22
18#define CIO_HEX_EVENT(imp, args...) do { \ 23static inline void
19 debug_event(cio_debug_trace_id, imp, ##args); \ 24CIO_HEX_EVENT(int level, void *data, int length)
20 } while (0) 25{
26 while (length > 0) {
27 debug_event(cio_debug_trace_id, level, data, length);
28 length -= cio_debug_trace_id->buf_size;
29 data += cio_debug_trace_id->buf_size;
30 }
31}
21 32
22#define CIO_DEBUG(printk_level,event_level,msg...) ({ \ 33#define CIO_DEBUG(printk_level,event_level,msg...) ({ \
23 if (cio_show_msg) printk(printk_level msg); \ 34 if (cio_show_msg) printk(printk_level msg); \
24 CIO_MSG_EVENT (event_level, msg); \ 35 CIO_MSG_EVENT (event_level, msg); \
25}) 36})
26 37
27/* for use of debug feature */
28extern debug_info_t *cio_debug_msg_id;
29extern debug_info_t *cio_debug_trace_id;
30extern debug_info_t *cio_debug_crw_id;
31
32#endif 38#endif
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 0d2b447c50ed..caeb6d246e57 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -65,6 +65,7 @@
65 2.26.02.005 - Fix use_sg == 0 mapping on systems with 4GB or higher. 65 2.26.02.005 - Fix use_sg == 0 mapping on systems with 4GB or higher.
66 2.26.02.006 - Fix 9550SX pchip reset timeout. 66 2.26.02.006 - Fix 9550SX pchip reset timeout.
67 Add big endian support. 67 Add big endian support.
68 2.26.02.007 - Disable local interrupts during kmap/unmap_atomic().
68*/ 69*/
69 70
70#include <linux/module.h> 71#include <linux/module.h>
@@ -88,7 +89,7 @@
88#include "3w-9xxx.h" 89#include "3w-9xxx.h"
89 90
90/* Globals */ 91/* Globals */
91#define TW_DRIVER_VERSION "2.26.02.006" 92#define TW_DRIVER_VERSION "2.26.02.007"
92static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; 93static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
93static unsigned int twa_device_extension_count; 94static unsigned int twa_device_extension_count;
94static int twa_major = -1; 95static int twa_major = -1;
@@ -1942,9 +1943,13 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
1942 } 1943 }
1943 if (tw_dev->srb[request_id]->use_sg == 1) { 1944 if (tw_dev->srb[request_id]->use_sg == 1) {
1944 struct scatterlist *sg = (struct scatterlist *)tw_dev->srb[request_id]->request_buffer; 1945 struct scatterlist *sg = (struct scatterlist *)tw_dev->srb[request_id]->request_buffer;
1945 char *buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; 1946 char *buf;
1947 unsigned long flags = 0;
1948 local_irq_save(flags);
1949 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
1946 memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length); 1950 memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length);
1947 kunmap_atomic(buf - sg->offset, KM_IRQ0); 1951 kunmap_atomic(buf - sg->offset, KM_IRQ0);
1952 local_irq_restore(flags);
1948 } 1953 }
1949 } 1954 }
1950} /* End twa_scsiop_execute_scsi_complete() */ 1955} /* End twa_scsiop_execute_scsi_complete() */
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 25f678d0780b..e8e41e6eb42a 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1508,10 +1508,12 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
1508 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1508 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1509 void *buf; 1509 void *buf;
1510 unsigned int transfer_len; 1510 unsigned int transfer_len;
1511 unsigned long flags = 0;
1511 1512
1512 if (cmd->use_sg) { 1513 if (cmd->use_sg) {
1513 struct scatterlist *sg = 1514 struct scatterlist *sg =
1514 (struct scatterlist *)cmd->request_buffer; 1515 (struct scatterlist *)cmd->request_buffer;
1516 local_irq_save(flags);
1515 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; 1517 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
1516 transfer_len = min(sg->length, len); 1518 transfer_len = min(sg->length, len);
1517 } else { 1519 } else {
@@ -1526,6 +1528,7 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
1526 1528
1527 sg = (struct scatterlist *)cmd->request_buffer; 1529 sg = (struct scatterlist *)cmd->request_buffer;
1528 kunmap_atomic(buf - sg->offset, KM_IRQ0); 1530 kunmap_atomic(buf - sg->offset, KM_IRQ0);
1531 local_irq_restore(flags);
1529 } 1532 }
1530} 1533}
1531 1534
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 4035920ce3d8..3e7302692dbe 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1079,7 +1079,7 @@ config SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
1079 memory using PCI DAC cycles. 1079 memory using PCI DAC cycles.
1080 1080
1081config SCSI_SYM53C8XX_DEFAULT_TAGS 1081config SCSI_SYM53C8XX_DEFAULT_TAGS
1082 int "default tagged command queue depth" 1082 int "Default tagged command queue depth"
1083 depends on SCSI_SYM53C8XX_2 1083 depends on SCSI_SYM53C8XX_2
1084 default "16" 1084 default "16"
1085 help 1085 help
@@ -1090,7 +1090,7 @@ config SCSI_SYM53C8XX_DEFAULT_TAGS
1090 exceed CONFIG_SCSI_SYM53C8XX_MAX_TAGS. 1090 exceed CONFIG_SCSI_SYM53C8XX_MAX_TAGS.
1091 1091
1092config SCSI_SYM53C8XX_MAX_TAGS 1092config SCSI_SYM53C8XX_MAX_TAGS
1093 int "maximum number of queued commands" 1093 int "Maximum number of queued commands"
1094 depends on SCSI_SYM53C8XX_2 1094 depends on SCSI_SYM53C8XX_2
1095 default "64" 1095 default "64"
1096 help 1096 help
@@ -1099,13 +1099,14 @@ config SCSI_SYM53C8XX_MAX_TAGS
1099 possible. The driver supports up to 256 queued commands per device. 1099 possible. The driver supports up to 256 queued commands per device.
1100 This value is used as a compiled-in hard limit. 1100 This value is used as a compiled-in hard limit.
1101 1101
1102config SCSI_SYM53C8XX_IOMAPPED 1102config SCSI_SYM53C8XX_MMIO
1103 bool "use port IO" 1103 bool "Use memory mapped IO"
1104 depends on SCSI_SYM53C8XX_2 1104 depends on SCSI_SYM53C8XX_2
1105 default y
1105 help 1106 help
1106 If you say Y here, the driver will use port IO to access 1107 Memory mapped IO is faster than Port IO. Most people should
1107 the card. This is significantly slower then using memory 1108 answer Y here, but some machines may have problems. If you have
1108 mapped IO. Most people should answer N. 1109 to answer N here, please report the problem to the maintainer.
1109 1110
1110config SCSI_IPR 1111config SCSI_IPR
1111 tristate "IBM Power Linux RAID adapter support" 1112 tristate "IBM Power Linux RAID adapter support"
@@ -1309,15 +1310,6 @@ config SCSI_QLOGIC_FAS
1309 To compile this driver as a module, choose M here: the 1310 To compile this driver as a module, choose M here: the
1310 module will be called qlogicfas. 1311 module will be called qlogicfas.
1311 1312
1312config SCSI_QLOGIC_FC
1313 tristate "Qlogic ISP FC SCSI support"
1314 depends on PCI && SCSI
1315 help
1316 This is a driver for the QLogic ISP2100 SCSI-FCP host adapter.
1317
1318 To compile this driver as a module, choose M here: the
1319 module will be called qlogicfc.
1320
1321config SCSI_QLOGIC_FC_FIRMWARE 1313config SCSI_QLOGIC_FC_FIRMWARE
1322 bool "Include loadable firmware in driver" 1314 bool "Include loadable firmware in driver"
1323 depends on SCSI_QLOGIC_FC 1315 depends on SCSI_QLOGIC_FC
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index e513c3158ad9..81803a16f986 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -78,7 +78,6 @@ obj-$(CONFIG_SCSI_NCR_Q720) += NCR_Q720_mod.o
78obj-$(CONFIG_SCSI_SYM53C416) += sym53c416.o 78obj-$(CONFIG_SCSI_SYM53C416) += sym53c416.o
79obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o 79obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o
80obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o 80obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o
81obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o
82obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o 81obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
83obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ 82obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/
84obj-$(CONFIG_SCSI_LPFC) += lpfc/ 83obj-$(CONFIG_SCSI_LPFC) += lpfc/
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 8df4a0ea3761..642a3b4e5937 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -149,20 +149,20 @@ static int dacmode = -1;
149 149
150static int commit = -1; 150static int commit = -1;
151 151
152module_param(nondasd, int, 0); 152module_param(nondasd, int, S_IRUGO|S_IWUSR);
153MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); 153MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
154module_param(dacmode, int, 0); 154module_param(dacmode, int, S_IRUGO|S_IWUSR);
155MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); 155MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
156module_param(commit, int, 0); 156module_param(commit, int, S_IRUGO|S_IWUSR);
157MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); 157MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on");
158 158
159int numacb = -1; 159int numacb = -1;
160module_param(numacb, int, S_IRUGO|S_IWUSR); 160module_param(numacb, int, S_IRUGO|S_IWUSR);
161MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control blocks (FIB) allocated. Valid\nvalues are 512 and down. Default is to use suggestion from Firmware."); 161MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control blocks (FIB) allocated. Valid values are 512 and down. Default is to use suggestion from Firmware.");
162 162
163int acbsize = -1; 163int acbsize = -1;
164module_param(acbsize, int, S_IRUGO|S_IWUSR); 164module_param(acbsize, int, S_IRUGO|S_IWUSR);
165MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512,\n2048, 4096 and 8192. Default is to use suggestion from Firmware."); 165MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512, 2048, 4096 and 8192. Default is to use suggestion from Firmware.");
166/** 166/**
167 * aac_get_config_status - check the adapter configuration 167 * aac_get_config_status - check the adapter configuration
168 * @common: adapter to query 168 * @common: adapter to query
@@ -387,6 +387,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
387 struct scsi_cmnd * scsicmd; 387 struct scsi_cmnd * scsicmd;
388 388
389 scsicmd = (struct scsi_cmnd *) context; 389 scsicmd = (struct scsi_cmnd *) context;
390 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
390 391
391 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); 392 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
392 if (fibptr == NULL) 393 if (fibptr == NULL)
@@ -453,8 +454,10 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
453 /* 454 /*
454 * Check that the command queued to the controller 455 * Check that the command queued to the controller
455 */ 456 */
456 if (status == -EINPROGRESS) 457 if (status == -EINPROGRESS) {
458 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
457 return 0; 459 return 0;
460 }
458 461
459 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); 462 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);
460 aac_fib_complete(cmd_fibcontext); 463 aac_fib_complete(cmd_fibcontext);
@@ -907,9 +910,10 @@ static void io_callback(void *context, struct fib * fibptr)
907 u32 cid; 910 u32 cid;
908 911
909 scsicmd = (struct scsi_cmnd *) context; 912 scsicmd = (struct scsi_cmnd *) context;
913 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
910 914
911 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 915 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
912 cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); 916 cid = scmd_id(scsicmd);
913 917
914 if (nblank(dprintk(x))) { 918 if (nblank(dprintk(x))) {
915 u64 lba; 919 u64 lba;
@@ -1151,8 +1155,10 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1151 /* 1155 /*
1152 * Check that the command queued to the controller 1156 * Check that the command queued to the controller
1153 */ 1157 */
1154 if (status == -EINPROGRESS) 1158 if (status == -EINPROGRESS) {
1159 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
1155 return 0; 1160 return 0;
1161 }
1156 1162
1157 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); 1163 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status);
1158 /* 1164 /*
@@ -1318,8 +1324,8 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1318 /* 1324 /*
1319 * Check that the command queued to the controller 1325 * Check that the command queued to the controller
1320 */ 1326 */
1321 if (status == -EINPROGRESS) 1327 if (status == -EINPROGRESS) {
1322 { 1328 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
1323 return 0; 1329 return 0;
1324 } 1330 }
1325 1331
@@ -1341,6 +1347,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1341 struct scsi_cmnd *cmd; 1347 struct scsi_cmnd *cmd;
1342 1348
1343 cmd = context; 1349 cmd = context;
1350 cmd->SCp.phase = AAC_OWNER_MIDLEVEL;
1344 1351
1345 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", 1352 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n",
1346 smp_processor_id(), jiffies)); 1353 smp_processor_id(), jiffies));
@@ -1354,7 +1361,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1354 else { 1361 else {
1355 struct scsi_device *sdev = cmd->device; 1362 struct scsi_device *sdev = cmd->device;
1356 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; 1363 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
1357 u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun); 1364 u32 cid = sdev_id(sdev);
1358 printk(KERN_WARNING 1365 printk(KERN_WARNING
1359 "synchronize_callback: synchronize failed, status = %d\n", 1366 "synchronize_callback: synchronize failed, status = %d\n",
1360 le32_to_cpu(synchronizereply->status)); 1367 le32_to_cpu(synchronizereply->status));
@@ -1386,12 +1393,12 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1386 unsigned long flags; 1393 unsigned long flags;
1387 1394
1388 /* 1395 /*
1389 * Wait for all commands to complete to this specific 1396 * Wait for all outstanding queued commands to complete to this
1390 * target (block). 1397 * specific target (block).
1391 */ 1398 */
1392 spin_lock_irqsave(&sdev->list_lock, flags); 1399 spin_lock_irqsave(&sdev->list_lock, flags);
1393 list_for_each_entry(cmd, &sdev->cmd_list, list) 1400 list_for_each_entry(cmd, &sdev->cmd_list, list)
1394 if (cmd != scsicmd && cmd->serial_number != 0) { 1401 if (cmd != scsicmd && cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
1395 ++active; 1402 ++active;
1396 break; 1403 break;
1397 } 1404 }
@@ -1434,8 +1441,10 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1434 /* 1441 /*
1435 * Check that the command queued to the controller 1442 * Check that the command queued to the controller
1436 */ 1443 */
1437 if (status == -EINPROGRESS) 1444 if (status == -EINPROGRESS) {
1445 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
1438 return 0; 1446 return 0;
1447 }
1439 1448
1440 printk(KERN_WARNING 1449 printk(KERN_WARNING
1441 "aac_synchronize: aac_fib_send failed with status: %d.\n", status); 1450 "aac_synchronize: aac_fib_send failed with status: %d.\n", status);
@@ -1458,7 +1467,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1458 struct Scsi_Host *host = scsicmd->device->host; 1467 struct Scsi_Host *host = scsicmd->device->host;
1459 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 1468 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
1460 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; 1469 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
1461 int ret;
1462 1470
1463 /* 1471 /*
1464 * If the bus, id or lun is out of range, return fail 1472 * If the bus, id or lun is out of range, return fail
@@ -1466,13 +1474,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1466 * itself. 1474 * itself.
1467 */ 1475 */
1468 if (scmd_id(scsicmd) != host->this_id) { 1476 if (scmd_id(scsicmd) != host->this_id) {
1469 if ((scsicmd->device->channel == CONTAINER_CHANNEL)) { 1477 if ((scmd_channel(scsicmd) == CONTAINER_CHANNEL)) {
1470 if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ 1478 if((scmd_id(scsicmd) >= dev->maximum_num_containers) ||
1479 (scsicmd->device->lun != 0)) {
1471 scsicmd->result = DID_NO_CONNECT << 16; 1480 scsicmd->result = DID_NO_CONNECT << 16;
1472 scsicmd->scsi_done(scsicmd); 1481 scsicmd->scsi_done(scsicmd);
1473 return 0; 1482 return 0;
1474 } 1483 }
1475 cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); 1484 cid = scmd_id(scsicmd);
1476 1485
1477 /* 1486 /*
1478 * If the target container doesn't exist, it may have 1487 * If the target container doesn't exist, it may have
@@ -1548,7 +1557,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1548 { 1557 {
1549 struct inquiry_data inq_data; 1558 struct inquiry_data inq_data;
1550 1559
1551 dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id)); 1560 dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scmd_id(scsicmd)));
1552 memset(&inq_data, 0, sizeof (struct inquiry_data)); 1561 memset(&inq_data, 0, sizeof (struct inquiry_data));
1553 1562
1554 inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ 1563 inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */
@@ -1598,13 +1607,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1598 cp[11] = 0; 1607 cp[11] = 0;
1599 cp[12] = 0; 1608 cp[12] = 0;
1600 aac_internal_transfer(scsicmd, cp, 0, 1609 aac_internal_transfer(scsicmd, cp, 0,
1601 min((unsigned int)scsicmd->cmnd[13], sizeof(cp))); 1610 min_t(size_t, scsicmd->cmnd[13], sizeof(cp)));
1602 if (sizeof(cp) < scsicmd->cmnd[13]) { 1611 if (sizeof(cp) < scsicmd->cmnd[13]) {
1603 unsigned int len, offset = sizeof(cp); 1612 unsigned int len, offset = sizeof(cp);
1604 1613
1605 memset(cp, 0, offset); 1614 memset(cp, 0, offset);
1606 do { 1615 do {
1607 len = min(scsicmd->cmnd[13]-offset, sizeof(cp)); 1616 len = min_t(size_t, scsicmd->cmnd[13] - offset,
1617 sizeof(cp));
1608 aac_internal_transfer(scsicmd, cp, offset, len); 1618 aac_internal_transfer(scsicmd, cp, offset, len);
1609 } while ((offset += len) < scsicmd->cmnd[13]); 1619 } while ((offset += len) < scsicmd->cmnd[13]);
1610 } 1620 }
@@ -1728,24 +1738,19 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1728 * containers to /dev/sd device names 1738 * containers to /dev/sd device names
1729 */ 1739 */
1730 1740
1731 spin_unlock_irq(host->host_lock);
1732 if (scsicmd->request->rq_disk) 1741 if (scsicmd->request->rq_disk)
1733 strlcpy(fsa_dev_ptr[cid].devname, 1742 strlcpy(fsa_dev_ptr[cid].devname,
1734 scsicmd->request->rq_disk->disk_name, 1743 scsicmd->request->rq_disk->disk_name,
1735 min(sizeof(fsa_dev_ptr[cid].devname), 1744 min(sizeof(fsa_dev_ptr[cid].devname),
1736 sizeof(scsicmd->request->rq_disk->disk_name) + 1)); 1745 sizeof(scsicmd->request->rq_disk->disk_name) + 1));
1737 ret = aac_read(scsicmd, cid); 1746
1738 spin_lock_irq(host->host_lock); 1747 return aac_read(scsicmd, cid);
1739 return ret;
1740 1748
1741 case WRITE_6: 1749 case WRITE_6:
1742 case WRITE_10: 1750 case WRITE_10:
1743 case WRITE_12: 1751 case WRITE_12:
1744 case WRITE_16: 1752 case WRITE_16:
1745 spin_unlock_irq(host->host_lock); 1753 return aac_write(scsicmd, cid);
1746 ret = aac_write(scsicmd, cid);
1747 spin_lock_irq(host->host_lock);
1748 return ret;
1749 1754
1750 case SYNCHRONIZE_CACHE: 1755 case SYNCHRONIZE_CACHE:
1751 /* Issue FIB to tell Firmware to flush it's cache */ 1756 /* Issue FIB to tell Firmware to flush it's cache */
@@ -1778,7 +1783,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
1778 if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk))) 1783 if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
1779 return -EFAULT; 1784 return -EFAULT;
1780 if (qd.cnum == -1) 1785 if (qd.cnum == -1)
1781 qd.cnum = ID_LUN_TO_CONTAINER(qd.id, qd.lun); 1786 qd.cnum = qd.id;
1782 else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) 1787 else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
1783 { 1788 {
1784 if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) 1789 if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
@@ -1890,6 +1895,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1890 struct scsi_cmnd *scsicmd; 1895 struct scsi_cmnd *scsicmd;
1891 1896
1892 scsicmd = (struct scsi_cmnd *) context; 1897 scsicmd = (struct scsi_cmnd *) context;
1898 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
1893 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 1899 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
1894 1900
1895 if (fibptr == NULL) 1901 if (fibptr == NULL)
@@ -2068,14 +2074,13 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2068 u32 timeout; 2074 u32 timeout;
2069 2075
2070 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 2076 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
2071 if (scsicmd->device->id >= dev->maximum_num_physicals || 2077 if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
2072 scsicmd->device->lun > 7) { 2078 scsicmd->device->lun > 7) {
2073 scsicmd->result = DID_NO_CONNECT << 16; 2079 scsicmd->result = DID_NO_CONNECT << 16;
2074 scsicmd->scsi_done(scsicmd); 2080 scsicmd->scsi_done(scsicmd);
2075 return 0; 2081 return 0;
2076 } 2082 }
2077 2083
2078 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
2079 switch(scsicmd->sc_data_direction){ 2084 switch(scsicmd->sc_data_direction){
2080 case DMA_TO_DEVICE: 2085 case DMA_TO_DEVICE:
2081 flag = SRB_DataOut; 2086 flag = SRB_DataOut;
@@ -2103,8 +2108,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2103 2108
2104 srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); 2109 srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
2105 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); 2110 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
2106 srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->device->channel)); 2111 srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scmd_channel(scsicmd)));
2107 srbcmd->id = cpu_to_le32(scsicmd->device->id); 2112 srbcmd->id = cpu_to_le32(scmd_id(scsicmd));
2108 srbcmd->lun = cpu_to_le32(scsicmd->device->lun); 2113 srbcmd->lun = cpu_to_le32(scsicmd->device->lun);
2109 srbcmd->flags = cpu_to_le32(flag); 2114 srbcmd->flags = cpu_to_le32(flag);
2110 timeout = scsicmd->timeout_per_command/HZ; 2115 timeout = scsicmd->timeout_per_command/HZ;
@@ -2161,7 +2166,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2161 /* 2166 /*
2162 * Check that the command queued to the controller 2167 * Check that the command queued to the controller
2163 */ 2168 */
2164 if (status == -EINPROGRESS){ 2169 if (status == -EINPROGRESS) {
2170 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
2165 return 0; 2171 return 0;
2166 } 2172 }
2167 2173
@@ -2192,8 +2198,6 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg)
2192 scsicmd->sc_data_direction); 2198 scsicmd->sc_data_direction);
2193 psg->count = cpu_to_le32(sg_count); 2199 psg->count = cpu_to_le32(sg_count);
2194 2200
2195 byte_count = 0;
2196
2197 for (i = 0; i < sg_count; i++) { 2201 for (i = 0; i < sg_count; i++) {
2198 psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg)); 2202 psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg));
2199 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); 2203 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg));
@@ -2249,18 +2253,17 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p
2249 2253
2250 sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, 2254 sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg,
2251 scsicmd->sc_data_direction); 2255 scsicmd->sc_data_direction);
2252 psg->count = cpu_to_le32(sg_count);
2253
2254 byte_count = 0;
2255 2256
2256 for (i = 0; i < sg_count; i++) { 2257 for (i = 0; i < sg_count; i++) {
2258 int count = sg_dma_len(sg);
2257 addr = sg_dma_address(sg); 2259 addr = sg_dma_address(sg);
2258 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); 2260 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff);
2259 psg->sg[i].addr[1] = cpu_to_le32(addr>>32); 2261 psg->sg[i].addr[1] = cpu_to_le32(addr>>32);
2260 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); 2262 psg->sg[i].count = cpu_to_le32(count);
2261 byte_count += sg_dma_len(sg); 2263 byte_count += count;
2262 sg++; 2264 sg++;
2263 } 2265 }
2266 psg->count = cpu_to_le32(sg_count);
2264 /* hba wants the size to be exact */ 2267 /* hba wants the size to be exact */
2265 if(byte_count > scsicmd->request_bufflen){ 2268 if(byte_count > scsicmd->request_bufflen){
2266 u32 temp = le32_to_cpu(psg->sg[i-1].count) - 2269 u32 temp = le32_to_cpu(psg->sg[i-1].count) -
@@ -2275,16 +2278,15 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p
2275 } 2278 }
2276 } 2279 }
2277 else if(scsicmd->request_bufflen) { 2280 else if(scsicmd->request_bufflen) {
2278 u64 addr; 2281 scsicmd->SCp.dma_handle = pci_map_single(dev->pdev,
2279 addr = pci_map_single(dev->pdev,
2280 scsicmd->request_buffer, 2282 scsicmd->request_buffer,
2281 scsicmd->request_bufflen, 2283 scsicmd->request_bufflen,
2282 scsicmd->sc_data_direction); 2284 scsicmd->sc_data_direction);
2285 addr = scsicmd->SCp.dma_handle;
2283 psg->count = cpu_to_le32(1); 2286 psg->count = cpu_to_le32(1);
2284 psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); 2287 psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff);
2285 psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); 2288 psg->sg[0].addr[1] = cpu_to_le32(addr >> 32);
2286 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); 2289 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
2287 scsicmd->SCp.dma_handle = addr;
2288 byte_count = scsicmd->request_bufflen; 2290 byte_count = scsicmd->request_bufflen;
2289 } 2291 }
2290 return byte_count; 2292 return byte_count;
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9ce7002bd070..f773b0dcfc95 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -10,6 +10,10 @@
10 * D E F I N E S 10 * D E F I N E S
11 *----------------------------------------------------------------------------*/ 11 *----------------------------------------------------------------------------*/
12 12
13#ifndef AAC_DRIVER_BUILD
14# define AAC_DRIVER_BUILD 2409
15# define AAC_DRIVER_BRANCH "-mh1"
16#endif
13#define MAXIMUM_NUM_CONTAINERS 32 17#define MAXIMUM_NUM_CONTAINERS 32
14 18
15#define AAC_NUM_MGT_FIB 8 19#define AAC_NUM_MGT_FIB 8
@@ -25,7 +29,6 @@
25 * These macros convert from physical channels to virtual channels 29 * These macros convert from physical channels to virtual channels
26 */ 30 */
27#define CONTAINER_CHANNEL (0) 31#define CONTAINER_CHANNEL (0)
28#define ID_LUN_TO_CONTAINER(id, lun) (id)
29#define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL) 32#define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL)
30#define CONTAINER_TO_ID(cont) (cont) 33#define CONTAINER_TO_ID(cont) (cont)
31#define CONTAINER_TO_LUN(cont) (0) 34#define CONTAINER_TO_LUN(cont) (0)
@@ -789,6 +792,7 @@ struct fsa_dev_info {
789 u64 size; 792 u64 size;
790 u32 type; 793 u32 type;
791 u32 config_waiting_on; 794 u32 config_waiting_on;
795 unsigned long config_waiting_stamp;
792 u16 queue_depth; 796 u16 queue_depth;
793 u8 config_needed; 797 u8 config_needed;
794 u8 valid; 798 u8 valid;
@@ -1771,6 +1775,11 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
1771} 1775}
1772 1776
1773struct scsi_cmnd; 1777struct scsi_cmnd;
1778/* SCp.phase values */
1779#define AAC_OWNER_MIDLEVEL 0x101
1780#define AAC_OWNER_LOWLEVEL 0x102
1781#define AAC_OWNER_ERROR_HANDLER 0x103
1782#define AAC_OWNER_FIRMWARE 0x106
1774 1783
1775const char *aac_driverinfo(struct Scsi_Host *); 1784const char *aac_driverinfo(struct Scsi_Host *);
1776struct fib *aac_fib_alloc(struct aac_dev *dev); 1785struct fib *aac_fib_alloc(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 47fefca72695..9f75144e5247 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -38,6 +38,8 @@
38#include <linux/completion.h> 38#include <linux/completion.h>
39#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <linux/delay.h>
42#include <linux/kthread.h>
41#include <asm/semaphore.h> 43#include <asm/semaphore.h>
42#include <asm/uaccess.h> 44#include <asm/uaccess.h>
43 45
@@ -293,6 +295,16 @@ return_fib:
293 status = 0; 295 status = 0;
294 } else { 296 } else {
295 spin_unlock_irqrestore(&dev->fib_lock, flags); 297 spin_unlock_irqrestore(&dev->fib_lock, flags);
298 /* If someone killed the AIF aacraid thread, restart it */
299 status = !dev->aif_thread;
300 if (status && dev->queues && dev->fsa_dev) {
301 /* Be paranoid, be very paranoid! */
302 kthread_stop(dev->thread);
303 ssleep(1);
304 dev->aif_thread = 0;
305 dev->thread = kthread_run(aac_command_thread, dev, dev->name);
306 ssleep(1);
307 }
296 if (f.wait) { 308 if (f.wait) {
297 if(down_interruptible(&fibctx->wait_sem) < 0) { 309 if(down_interruptible(&fibctx->wait_sem) < 0) {
298 status = -EINTR; 310 status = -EINTR;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index c7f80ec7abde..9f9f4aae23c0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -767,9 +767,9 @@ void aac_printf(struct aac_dev *dev, u32 val)
767 if (cp[length] != 0) 767 if (cp[length] != 0)
768 cp[length] = 0; 768 cp[length] = 0;
769 if (level == LOG_AAC_HIGH_ERROR) 769 if (level == LOG_AAC_HIGH_ERROR)
770 printk(KERN_WARNING "aacraid:%s", cp); 770 printk(KERN_WARNING "%s:%s", dev->name, cp);
771 else 771 else
772 printk(KERN_INFO "aacraid:%s", cp); 772 printk(KERN_INFO "%s:%s", dev->name, cp);
773 } 773 }
774 memset(cp, 0, 256); 774 memset(cp, 0, 256);
775} 775}
@@ -784,6 +784,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
784 * dispatches it to the appropriate routine for handling. 784 * dispatches it to the appropriate routine for handling.
785 */ 785 */
786 786
787#define AIF_SNIFF_TIMEOUT (30*HZ)
787static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) 788static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
788{ 789{
789 struct hw_fib * hw_fib = fibptr->hw_fib; 790 struct hw_fib * hw_fib = fibptr->hw_fib;
@@ -837,6 +838,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
837 if (device) { 838 if (device) {
838 dev->fsa_dev[container].config_needed = CHANGE; 839 dev->fsa_dev[container].config_needed = CHANGE;
839 dev->fsa_dev[container].config_waiting_on = AifEnConfigChange; 840 dev->fsa_dev[container].config_waiting_on = AifEnConfigChange;
841 dev->fsa_dev[container].config_waiting_stamp = jiffies;
840 scsi_device_put(device); 842 scsi_device_put(device);
841 } 843 }
842 } 844 }
@@ -849,13 +851,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
849 if (container != (u32)-1) { 851 if (container != (u32)-1) {
850 if (container >= dev->maximum_num_containers) 852 if (container >= dev->maximum_num_containers)
851 break; 853 break;
852 if (dev->fsa_dev[container].config_waiting_on == 854 if ((dev->fsa_dev[container].config_waiting_on ==
853 le32_to_cpu(*(u32 *)aifcmd->data)) 855 le32_to_cpu(*(u32 *)aifcmd->data)) &&
856 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
854 dev->fsa_dev[container].config_waiting_on = 0; 857 dev->fsa_dev[container].config_waiting_on = 0;
855 } else for (container = 0; 858 } else for (container = 0;
856 container < dev->maximum_num_containers; ++container) { 859 container < dev->maximum_num_containers; ++container) {
857 if (dev->fsa_dev[container].config_waiting_on == 860 if ((dev->fsa_dev[container].config_waiting_on ==
858 le32_to_cpu(*(u32 *)aifcmd->data)) 861 le32_to_cpu(*(u32 *)aifcmd->data)) &&
862 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
859 dev->fsa_dev[container].config_waiting_on = 0; 863 dev->fsa_dev[container].config_waiting_on = 0;
860 } 864 }
861 break; 865 break;
@@ -872,6 +876,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
872 dev->fsa_dev[container].config_needed = ADD; 876 dev->fsa_dev[container].config_needed = ADD;
873 dev->fsa_dev[container].config_waiting_on = 877 dev->fsa_dev[container].config_waiting_on =
874 AifEnConfigChange; 878 AifEnConfigChange;
879 dev->fsa_dev[container].config_waiting_stamp = jiffies;
875 break; 880 break;
876 881
877 /* 882 /*
@@ -884,6 +889,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
884 dev->fsa_dev[container].config_needed = DELETE; 889 dev->fsa_dev[container].config_needed = DELETE;
885 dev->fsa_dev[container].config_waiting_on = 890 dev->fsa_dev[container].config_waiting_on =
886 AifEnConfigChange; 891 AifEnConfigChange;
892 dev->fsa_dev[container].config_waiting_stamp = jiffies;
887 break; 893 break;
888 894
889 /* 895 /*
@@ -894,11 +900,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
894 container = le32_to_cpu(((u32 *)aifcmd->data)[1]); 900 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
895 if (container >= dev->maximum_num_containers) 901 if (container >= dev->maximum_num_containers)
896 break; 902 break;
897 if (dev->fsa_dev[container].config_waiting_on) 903 if (dev->fsa_dev[container].config_waiting_on &&
904 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
898 break; 905 break;
899 dev->fsa_dev[container].config_needed = CHANGE; 906 dev->fsa_dev[container].config_needed = CHANGE;
900 dev->fsa_dev[container].config_waiting_on = 907 dev->fsa_dev[container].config_waiting_on =
901 AifEnConfigChange; 908 AifEnConfigChange;
909 dev->fsa_dev[container].config_waiting_stamp = jiffies;
902 break; 910 break;
903 911
904 case AifEnConfigChange: 912 case AifEnConfigChange:
@@ -913,13 +921,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
913 if (container != (u32)-1) { 921 if (container != (u32)-1) {
914 if (container >= dev->maximum_num_containers) 922 if (container >= dev->maximum_num_containers)
915 break; 923 break;
916 if (dev->fsa_dev[container].config_waiting_on == 924 if ((dev->fsa_dev[container].config_waiting_on ==
917 le32_to_cpu(*(u32 *)aifcmd->data)) 925 le32_to_cpu(*(u32 *)aifcmd->data)) &&
926 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
918 dev->fsa_dev[container].config_waiting_on = 0; 927 dev->fsa_dev[container].config_waiting_on = 0;
919 } else for (container = 0; 928 } else for (container = 0;
920 container < dev->maximum_num_containers; ++container) { 929 container < dev->maximum_num_containers; ++container) {
921 if (dev->fsa_dev[container].config_waiting_on == 930 if ((dev->fsa_dev[container].config_waiting_on ==
922 le32_to_cpu(*(u32 *)aifcmd->data)) 931 le32_to_cpu(*(u32 *)aifcmd->data)) &&
932 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
923 dev->fsa_dev[container].config_waiting_on = 0; 933 dev->fsa_dev[container].config_waiting_on = 0;
924 } 934 }
925 break; 935 break;
@@ -946,6 +956,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
946 dev->fsa_dev[container].config_waiting_on = 956 dev->fsa_dev[container].config_waiting_on =
947 AifEnContainerChange; 957 AifEnContainerChange;
948 dev->fsa_dev[container].config_needed = ADD; 958 dev->fsa_dev[container].config_needed = ADD;
959 dev->fsa_dev[container].config_waiting_stamp =
960 jiffies;
949 } 961 }
950 } 962 }
951 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) 963 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
@@ -961,6 +973,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
961 dev->fsa_dev[container].config_waiting_on = 973 dev->fsa_dev[container].config_waiting_on =
962 AifEnContainerChange; 974 AifEnContainerChange;
963 dev->fsa_dev[container].config_needed = DELETE; 975 dev->fsa_dev[container].config_needed = DELETE;
976 dev->fsa_dev[container].config_waiting_stamp =
977 jiffies;
964 } 978 }
965 } 979 }
966 break; 980 break;
@@ -969,8 +983,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
969 device_config_needed = NOTHING; 983 device_config_needed = NOTHING;
970 for (container = 0; container < dev->maximum_num_containers; 984 for (container = 0; container < dev->maximum_num_containers;
971 ++container) { 985 ++container) {
972 if ((dev->fsa_dev[container].config_waiting_on == 0) 986 if ((dev->fsa_dev[container].config_waiting_on == 0) &&
973 && (dev->fsa_dev[container].config_needed != NOTHING)) { 987 (dev->fsa_dev[container].config_needed != NOTHING) &&
988 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) {
974 device_config_needed = 989 device_config_needed =
975 dev->fsa_dev[container].config_needed; 990 dev->fsa_dev[container].config_needed;
976 dev->fsa_dev[container].config_needed = NOTHING; 991 dev->fsa_dev[container].config_needed = NOTHING;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 720330778648..6ef89c99dd12 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -27,12 +27,6 @@
27 * Abstract: Linux Driver entry module for Adaptec RAID Array Controller 27 * Abstract: Linux Driver entry module for Adaptec RAID Array Controller
28 */ 28 */
29 29
30#define AAC_DRIVER_VERSION "1.1-4"
31#ifndef AAC_DRIVER_BRANCH
32#define AAC_DRIVER_BRANCH ""
33#endif
34#define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__
35#define AAC_DRIVERNAME "aacraid"
36 30
37#include <linux/compat.h> 31#include <linux/compat.h>
38#include <linux/blkdev.h> 32#include <linux/blkdev.h>
@@ -62,6 +56,13 @@
62 56
63#include "aacraid.h" 57#include "aacraid.h"
64 58
59#define AAC_DRIVER_VERSION "1.1-5"
60#ifndef AAC_DRIVER_BRANCH
61#define AAC_DRIVER_BRANCH ""
62#endif
63#define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__
64#define AAC_DRIVERNAME "aacraid"
65
65#ifdef AAC_DRIVER_BUILD 66#ifdef AAC_DRIVER_BUILD
66#define _str(x) #x 67#define _str(x) #x
67#define str(x) _str(x) 68#define str(x) _str(x)
@@ -73,7 +74,7 @@
73MODULE_AUTHOR("Red Hat Inc and Adaptec"); 74MODULE_AUTHOR("Red Hat Inc and Adaptec");
74MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " 75MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, "
75 "Adaptec Advanced Raid Products, " 76 "Adaptec Advanced Raid Products, "
76 "and HP NetRAID-4M SCSI driver"); 77 "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver");
77MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
78MODULE_VERSION(AAC_DRIVER_FULL_VERSION); 79MODULE_VERSION(AAC_DRIVER_FULL_VERSION);
79 80
@@ -243,6 +244,7 @@ static struct aac_driver_ident aac_drivers[] = {
243static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 244static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
244{ 245{
245 cmd->scsi_done = done; 246 cmd->scsi_done = done;
247 cmd->SCp.phase = AAC_OWNER_LOWLEVEL;
246 return (aac_scsi_cmd(cmd) ? FAILED : 0); 248 return (aac_scsi_cmd(cmd) ? FAILED : 0);
247} 249}
248 250
@@ -471,7 +473,8 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
471 __shost_for_each_device(dev, host) { 473 __shost_for_each_device(dev, host) {
472 spin_lock_irqsave(&dev->list_lock, flags); 474 spin_lock_irqsave(&dev->list_lock, flags);
473 list_for_each_entry(command, &dev->cmd_list, list) { 475 list_for_each_entry(command, &dev->cmd_list, list) {
474 if (command->serial_number) { 476 if ((command != cmd) &&
477 (command->SCp.phase == AAC_OWNER_FIRMWARE)) {
475 active++; 478 active++;
476 break; 479 break;
477 } 480 }
@@ -569,12 +572,12 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
569 572
570 f = compat_alloc_user_space(sizeof(*f)); 573 f = compat_alloc_user_space(sizeof(*f));
571 ret = 0; 574 ret = 0;
572 if (clear_user(f, sizeof(*f) != sizeof(*f))) 575 if (clear_user(f, sizeof(*f)) != sizeof(*f))
573 ret = -EFAULT; 576 ret = -EFAULT;
574 if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) 577 if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32)))
575 ret = -EFAULT; 578 ret = -EFAULT;
576 if (!ret) 579 if (!ret)
577 ret = aac_do_ioctl(dev, cmd, (void __user *)arg); 580 ret = aac_do_ioctl(dev, cmd, f);
578 break; 581 break;
579 } 582 }
580 583
@@ -687,6 +690,18 @@ static ssize_t aac_show_serial_number(struct class_device *class_dev,
687 return len; 690 return len;
688} 691}
689 692
693static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf)
694{
695 return snprintf(buf, PAGE_SIZE, "%d\n",
696 class_to_shost(class_dev)->max_channel);
697}
698
699static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf)
700{
701 return snprintf(buf, PAGE_SIZE, "%d\n",
702 class_to_shost(class_dev)->max_id);
703}
704
690 705
691static struct class_device_attribute aac_model = { 706static struct class_device_attribute aac_model = {
692 .attr = { 707 .attr = {
@@ -730,6 +745,20 @@ static struct class_device_attribute aac_serial_number = {
730 }, 745 },
731 .show = aac_show_serial_number, 746 .show = aac_show_serial_number,
732}; 747};
748static struct class_device_attribute aac_max_channel = {
749 .attr = {
750 .name = "max_channel",
751 .mode = S_IRUGO,
752 },
753 .show = aac_show_max_channel,
754};
755static struct class_device_attribute aac_max_id = {
756 .attr = {
757 .name = "max_id",
758 .mode = S_IRUGO,
759 },
760 .show = aac_show_max_id,
761};
733 762
734static struct class_device_attribute *aac_attrs[] = { 763static struct class_device_attribute *aac_attrs[] = {
735 &aac_model, 764 &aac_model,
@@ -738,6 +767,8 @@ static struct class_device_attribute *aac_attrs[] = {
738 &aac_monitor_version, 767 &aac_monitor_version,
739 &aac_bios_version, 768 &aac_bios_version,
740 &aac_serial_number, 769 &aac_serial_number,
770 &aac_max_channel,
771 &aac_max_id,
741 NULL 772 NULL
742}; 773};
743 774
@@ -775,6 +806,7 @@ static struct scsi_host_template aac_driver_template = {
775 .cmd_per_lun = AAC_NUM_IO_FIB, 806 .cmd_per_lun = AAC_NUM_IO_FIB,
776#endif 807#endif
777 .use_clustering = ENABLE_CLUSTERING, 808 .use_clustering = ENABLE_CLUSTERING,
809 .emulated = 1,
778}; 810};
779 811
780 812
@@ -798,10 +830,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
798 error = pci_enable_device(pdev); 830 error = pci_enable_device(pdev);
799 if (error) 831 if (error)
800 goto out; 832 goto out;
833 error = -ENODEV;
801 834
802 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || 835 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
803 pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) 836 pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))
804 goto out; 837 goto out_disable_pdev;
805 /* 838 /*
806 * If the quirk31 bit is set, the adapter needs adapter 839 * If the quirk31 bit is set, the adapter needs adapter
807 * to driver communication memory to be allocated below 2gig 840 * to driver communication memory to be allocated below 2gig
@@ -809,7 +842,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
809 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) 842 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
810 if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || 843 if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) ||
811 pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) 844 pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK))
812 goto out; 845 goto out_disable_pdev;
813 846
814 pci_set_master(pdev); 847 pci_set_master(pdev);
815 848
@@ -904,9 +937,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
904 * physical channels are address by their actual physical number+1 937 * physical channels are address by their actual physical number+1
905 */ 938 */
906 if (aac->nondasd_support == 1) 939 if (aac->nondasd_support == 1)
907 shost->max_channel = aac->maximum_num_channels + 1; 940 shost->max_channel = aac->maximum_num_channels;
908 else 941 else
909 shost->max_channel = 1; 942 shost->max_channel = 0;
910 943
911 aac_get_config_status(aac); 944 aac_get_config_status(aac);
912 aac_get_containers(aac); 945 aac_get_containers(aac);
@@ -1020,7 +1053,8 @@ static int __init aac_init(void)
1020 1053
1021static void __exit aac_exit(void) 1054static void __exit aac_exit(void)
1022{ 1055{
1023 unregister_chrdev(aac_cfg_major, "aac"); 1056 if (aac_cfg_major > -1)
1057 unregister_chrdev(aac_cfg_major, "aac");
1024 pci_unregister_driver(&aac_pci_driver); 1058 pci_unregister_driver(&aac_pci_driver);
1025} 1059}
1026 1060
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index e9b775d6bec9..7a23e027eb78 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -183,7 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 schedule_timeout_uninterruptible(1); 186 msleep(1);
187 } 187 }
188 if (ok != 1) { 188 if (ok != 1) {
189 /* 189 /*
@@ -343,7 +343,7 @@ static int aac_rkt_check_health(struct aac_dev *dev)
343 NULL, NULL, NULL, NULL, NULL); 343 NULL, NULL, NULL, NULL, NULL);
344 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), 344 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
345 post, paddr); 345 post, paddr);
346 if ((buffer[0] == '0') && (buffer[1] == 'x')) { 346 if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) {
347 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); 347 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
348 ret <<= 4; 348 ret <<= 4;
349 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); 349 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 6998bc877dd6..729b9eb268c2 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -183,7 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 schedule_timeout_uninterruptible(1); 186 msleep(1);
187 } 187 }
188 if (ok != 1) { 188 if (ok != 1) {
189 /* 189 /*
@@ -342,7 +342,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
342 NULL, NULL, NULL, NULL, NULL); 342 NULL, NULL, NULL, NULL, NULL);
343 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), 343 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
344 post, paddr); 344 post, paddr);
345 if ((buffer[0] == '0') && (buffer[1] == 'x')) { 345 if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) {
346 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); 346 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
347 ret <<= 4; 347 ret <<= 4;
348 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); 348 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 466f05cfbf0c..a53454908205 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -189,7 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command,
189 ok = 1; 189 ok = 1;
190 break; 190 break;
191 } 191 }
192 schedule_timeout_uninterruptible(1); 192 msleep(1);
193 } 193 }
194 194
195 if (ok != 1) 195 if (ok != 1)
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 1bd82c4e52a0..b4f8fb1d628b 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -207,7 +207,6 @@ static struct scsi_host_template ahci_sht = {
207 .name = DRV_NAME, 207 .name = DRV_NAME,
208 .ioctl = ata_scsi_ioctl, 208 .ioctl = ata_scsi_ioctl,
209 .queuecommand = ata_scsi_queuecmd, 209 .queuecommand = ata_scsi_queuecmd,
210 .eh_strategy_handler = ata_scsi_error,
211 .can_queue = ATA_DEF_QUEUE, 210 .can_queue = ATA_DEF_QUEUE,
212 .this_id = ATA_SHT_THIS_ID, 211 .this_id = ATA_SHT_THIS_ID,
213 .sg_tablesize = AHCI_MAX_SG, 212 .sg_tablesize = AHCI_MAX_SG,
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index 1d11f7e77564..bb5166da4358 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -372,7 +372,7 @@ typedef enum {
372 AHD_CURRENT_SENSING = 0x40000, 372 AHD_CURRENT_SENSING = 0x40000,
373 AHD_SCB_CONFIG_USED = 0x80000,/* No SEEPROM but SCB had info. */ 373 AHD_SCB_CONFIG_USED = 0x80000,/* No SEEPROM but SCB had info. */
374 AHD_HP_BOARD = 0x100000, 374 AHD_HP_BOARD = 0x100000,
375 AHD_RESET_POLL_ACTIVE = 0x200000, 375 AHD_BUS_RESET_ACTIVE = 0x200000,
376 AHD_UPDATE_PEND_CMDS = 0x400000, 376 AHD_UPDATE_PEND_CMDS = 0x400000,
377 AHD_RUNNING_QOUTFIFO = 0x800000, 377 AHD_RUNNING_QOUTFIFO = 0x800000,
378 AHD_HAD_FIRST_SEL = 0x1000000 378 AHD_HAD_FIRST_SEL = 0x1000000
@@ -589,7 +589,7 @@ typedef enum {
589 SCB_PACKETIZED = 0x00800, 589 SCB_PACKETIZED = 0x00800,
590 SCB_EXPECT_PPR_BUSFREE = 0x01000, 590 SCB_EXPECT_PPR_BUSFREE = 0x01000,
591 SCB_PKT_SENSE = 0x02000, 591 SCB_PKT_SENSE = 0x02000,
592 SCB_CMDPHASE_ABORT = 0x04000, 592 SCB_EXTERNAL_RESET = 0x04000,/* Device was reset externally */
593 SCB_ON_COL_LIST = 0x08000, 593 SCB_ON_COL_LIST = 0x08000,
594 SCB_SILENT = 0x10000 /* 594 SCB_SILENT = 0x10000 /*
595 * Be quiet about transmission type 595 * Be quiet about transmission type
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 326a62226235..08771f6f6859 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -207,7 +207,6 @@ static void ahd_add_scb_to_free_list(struct ahd_softc *ahd,
207static u_int ahd_rem_wscb(struct ahd_softc *ahd, u_int scbid, 207static u_int ahd_rem_wscb(struct ahd_softc *ahd, u_int scbid,
208 u_int prev, u_int next, u_int tid); 208 u_int prev, u_int next, u_int tid);
209static void ahd_reset_current_bus(struct ahd_softc *ahd); 209static void ahd_reset_current_bus(struct ahd_softc *ahd);
210static ahd_callback_t ahd_reset_poll;
211static ahd_callback_t ahd_stat_timer; 210static ahd_callback_t ahd_stat_timer;
212#ifdef AHD_DUMP_SEQ 211#ifdef AHD_DUMP_SEQ
213static void ahd_dumpseq(struct ahd_softc *ahd); 212static void ahd_dumpseq(struct ahd_softc *ahd);
@@ -1054,12 +1053,10 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
1054 * If a target takes us into the command phase 1053 * If a target takes us into the command phase
1055 * assume that it has been externally reset and 1054 * assume that it has been externally reset and
1056 * has thus lost our previous packetized negotiation 1055 * has thus lost our previous packetized negotiation
1057 * agreement. Since we have not sent an identify 1056 * agreement.
1058 * message and may not have fully qualified the 1057 * Revert to async/narrow transfers until we
1059 * connection, we change our command to TUR, assert 1058 * can renegotiate with the device and notify
1060 * ATN and ABORT the task when we go to message in 1059 * the OSM about the reset.
1061 * phase. The OSM will see the REQUEUE_REQUEST
1062 * status and retry the command.
1063 */ 1060 */
1064 scbid = ahd_get_scbptr(ahd); 1061 scbid = ahd_get_scbptr(ahd);
1065 scb = ahd_lookup_scb(ahd, scbid); 1062 scb = ahd_lookup_scb(ahd, scbid);
@@ -1086,31 +1083,15 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
1086 ahd_set_syncrate(ahd, &devinfo, /*period*/0, 1083 ahd_set_syncrate(ahd, &devinfo, /*period*/0,
1087 /*offset*/0, /*ppr_options*/0, 1084 /*offset*/0, /*ppr_options*/0,
1088 AHD_TRANS_ACTIVE, /*paused*/TRUE); 1085 AHD_TRANS_ACTIVE, /*paused*/TRUE);
1089 ahd_outb(ahd, SCB_CDB_STORE, 0); 1086 scb->flags |= SCB_EXTERNAL_RESET;
1090 ahd_outb(ahd, SCB_CDB_STORE+1, 0);
1091 ahd_outb(ahd, SCB_CDB_STORE+2, 0);
1092 ahd_outb(ahd, SCB_CDB_STORE+3, 0);
1093 ahd_outb(ahd, SCB_CDB_STORE+4, 0);
1094 ahd_outb(ahd, SCB_CDB_STORE+5, 0);
1095 ahd_outb(ahd, SCB_CDB_LEN, 6);
1096 scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE);
1097 scb->hscb->control |= MK_MESSAGE;
1098 ahd_outb(ahd, SCB_CONTROL, scb->hscb->control);
1099 ahd_outb(ahd, MSG_OUT, HOST_MSG);
1100 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
1101 /*
1102 * The lun is 0, regardless of the SCB's lun
1103 * as we have not sent an identify message.
1104 */
1105 ahd_outb(ahd, SAVED_LUN, 0);
1106 ahd_outb(ahd, SEQ_FLAGS, 0);
1107 ahd_assert_atn(ahd);
1108 scb->flags &= ~SCB_PACKETIZED;
1109 scb->flags |= SCB_ABORT|SCB_CMDPHASE_ABORT;
1110 ahd_freeze_devq(ahd, scb); 1087 ahd_freeze_devq(ahd, scb);
1111 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); 1088 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
1112 ahd_freeze_scb(scb); 1089 ahd_freeze_scb(scb);
1113 1090
1091 /* Notify XPT */
1092 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1093 CAM_LUN_WILDCARD, AC_SENT_BDR, NULL);
1094
1114 /* 1095 /*
1115 * Allow the sequencer to continue with 1096 * Allow the sequencer to continue with
1116 * non-pack processing. 1097 * non-pack processing.
@@ -1534,6 +1515,18 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
1534 lqistat1 = ahd_inb(ahd, LQISTAT1); 1515 lqistat1 = ahd_inb(ahd, LQISTAT1);
1535 lqostat0 = ahd_inb(ahd, LQOSTAT0); 1516 lqostat0 = ahd_inb(ahd, LQOSTAT0);
1536 busfreetime = ahd_inb(ahd, SSTAT2) & BUSFREETIME; 1517 busfreetime = ahd_inb(ahd, SSTAT2) & BUSFREETIME;
1518
1519 /*
1520 * Ignore external resets after a bus reset.
1521 */
1522 if (((status & SCSIRSTI) != 0) && (ahd->flags & AHD_BUS_RESET_ACTIVE))
1523 return;
1524
1525 /*
1526 * Clear bus reset flag
1527 */
1528 ahd->flags &= ~AHD_BUS_RESET_ACTIVE;
1529
1537 if ((status0 & (SELDI|SELDO)) != 0) { 1530 if ((status0 & (SELDI|SELDO)) != 0) {
1538 u_int simode0; 1531 u_int simode0;
1539 1532
@@ -2207,22 +2200,6 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2207 if (sent_msg == MSG_ABORT_TAG) 2200 if (sent_msg == MSG_ABORT_TAG)
2208 tag = SCB_GET_TAG(scb); 2201 tag = SCB_GET_TAG(scb);
2209 2202
2210 if ((scb->flags & SCB_CMDPHASE_ABORT) != 0) {
2211 /*
2212 * This abort is in response to an
2213 * unexpected switch to command phase
2214 * for a packetized connection. Since
2215 * the identify message was never sent,
2216 * "saved lun" is 0. We really want to
2217 * abort only the SCB that encountered
2218 * this error, which could have a different
2219 * lun. The SCB will be retried so the OS
2220 * will see the UA after renegotiating to
2221 * packetized.
2222 */
2223 tag = SCB_GET_TAG(scb);
2224 saved_lun = scb->hscb->lun;
2225 }
2226 found = ahd_abort_scbs(ahd, target, 'A', saved_lun, 2203 found = ahd_abort_scbs(ahd, target, 'A', saved_lun,
2227 tag, ROLE_INITIATOR, 2204 tag, ROLE_INITIATOR,
2228 CAM_REQ_ABORTED); 2205 CAM_REQ_ABORTED);
@@ -7847,6 +7824,17 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7847 int found; 7824 int found;
7848 u_int fifo; 7825 u_int fifo;
7849 u_int next_fifo; 7826 u_int next_fifo;
7827 uint8_t scsiseq;
7828
7829 /*
7830 * Check if the last bus reset is cleared
7831 */
7832 if (ahd->flags & AHD_BUS_RESET_ACTIVE) {
7833 printf("%s: bus reset still active\n",
7834 ahd_name(ahd));
7835 return 0;
7836 }
7837 ahd->flags |= AHD_BUS_RESET_ACTIVE;
7850 7838
7851 ahd->pending_device = NULL; 7839 ahd->pending_device = NULL;
7852 7840
@@ -7860,6 +7848,12 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7860 /* Make sure the sequencer is in a safe location. */ 7848 /* Make sure the sequencer is in a safe location. */
7861 ahd_clear_critical_section(ahd); 7849 ahd_clear_critical_section(ahd);
7862 7850
7851 /*
7852 * Run our command complete fifos to ensure that we perform
7853 * completion processing on any commands that 'completed'
7854 * before the reset occurred.
7855 */
7856 ahd_run_qoutfifo(ahd);
7863#ifdef AHD_TARGET_MODE 7857#ifdef AHD_TARGET_MODE
7864 if ((ahd->flags & AHD_TARGETROLE) != 0) { 7858 if ((ahd->flags & AHD_TARGETROLE) != 0) {
7865 ahd_run_tqinfifo(ahd, /*paused*/TRUE); 7859 ahd_run_tqinfifo(ahd, /*paused*/TRUE);
@@ -7924,30 +7918,14 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7924 ahd_clear_fifo(ahd, 1); 7918 ahd_clear_fifo(ahd, 1);
7925 7919
7926 /* 7920 /*
7927 * Revert to async/narrow transfers until we renegotiate. 7921 * Reenable selections
7928 */ 7922 */
7929 max_scsiid = (ahd->features & AHD_WIDE) ? 15 : 7; 7923 ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST);
7930 for (target = 0; target <= max_scsiid; target++) { 7924 scsiseq = ahd_inb(ahd, SCSISEQ_TEMPLATE);
7931 7925 ahd_outb(ahd, SCSISEQ1, scsiseq & (ENSELI|ENRSELI|ENAUTOATNP));
7932 if (ahd->enabled_targets[target] == NULL)
7933 continue;
7934 for (initiator = 0; initiator <= max_scsiid; initiator++) {
7935 struct ahd_devinfo devinfo;
7936
7937 ahd_compile_devinfo(&devinfo, target, initiator,
7938 CAM_LUN_WILDCARD,
7939 'A', ROLE_UNKNOWN);
7940 ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
7941 AHD_TRANS_CUR, /*paused*/TRUE);
7942 ahd_set_syncrate(ahd, &devinfo, /*period*/0,
7943 /*offset*/0, /*ppr_options*/0,
7944 AHD_TRANS_CUR, /*paused*/TRUE);
7945 }
7946 }
7947 7926
7948#ifdef AHD_TARGET_MODE
7949 max_scsiid = (ahd->features & AHD_WIDE) ? 15 : 7; 7927 max_scsiid = (ahd->features & AHD_WIDE) ? 15 : 7;
7950 7928#ifdef AHD_TARGET_MODE
7951 /* 7929 /*
7952 * Send an immediate notify ccb to all target more peripheral 7930 * Send an immediate notify ccb to all target more peripheral
7953 * drivers affected by this action. 7931 * drivers affected by this action.
@@ -7975,51 +7953,31 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7975 /* Notify the XPT that a bus reset occurred */ 7953 /* Notify the XPT that a bus reset occurred */
7976 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD, 7954 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD,
7977 CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); 7955 CAM_LUN_WILDCARD, AC_BUS_RESET, NULL);
7978 ahd_restart(ahd); 7956
7979 /* 7957 /*
7980 * Freeze the SIMQ until our poller can determine that 7958 * Revert to async/narrow transfers until we renegotiate.
7981 * the bus reset has really gone away. We set the initial
7982 * timer to 0 to have the check performed as soon as possible
7983 * from the timer context.
7984 */ 7959 */
7985 if ((ahd->flags & AHD_RESET_POLL_ACTIVE) == 0) { 7960 for (target = 0; target <= max_scsiid; target++) {
7986 ahd->flags |= AHD_RESET_POLL_ACTIVE;
7987 ahd_freeze_simq(ahd);
7988 ahd_timer_reset(&ahd->reset_timer, 0, ahd_reset_poll, ahd);
7989 }
7990 return (found);
7991}
7992 7961
7962 if (ahd->enabled_targets[target] == NULL)
7963 continue;
7964 for (initiator = 0; initiator <= max_scsiid; initiator++) {
7965 struct ahd_devinfo devinfo;
7993 7966
7994#define AHD_RESET_POLL_US 1000 7967 ahd_compile_devinfo(&devinfo, target, initiator,
7995static void 7968 CAM_LUN_WILDCARD,
7996ahd_reset_poll(void *arg) 7969 'A', ROLE_UNKNOWN);
7997{ 7970 ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
7998 struct ahd_softc *ahd = arg; 7971 AHD_TRANS_CUR, /*paused*/TRUE);
7999 u_int scsiseq1; 7972 ahd_set_syncrate(ahd, &devinfo, /*period*/0,
8000 u_long s; 7973 /*offset*/0, /*ppr_options*/0,
8001 7974 AHD_TRANS_CUR, /*paused*/TRUE);
8002 ahd_lock(ahd, &s); 7975 }
8003 ahd_pause(ahd);
8004 ahd_update_modes(ahd);
8005 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
8006 ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI);
8007 if ((ahd_inb(ahd, SSTAT1) & SCSIRSTI) != 0) {
8008 ahd_timer_reset(&ahd->reset_timer, AHD_RESET_POLL_US,
8009 ahd_reset_poll, ahd);
8010 ahd_unpause(ahd);
8011 ahd_unlock(ahd, &s);
8012 return;
8013 } 7976 }
8014 7977
8015 /* Reset is now low. Complete chip reinitialization. */ 7978 ahd_restart(ahd);
8016 ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST); 7979
8017 scsiseq1 = ahd_inb(ahd, SCSISEQ_TEMPLATE); 7980 return (found);
8018 ahd_outb(ahd, SCSISEQ1, scsiseq1 & (ENSELI|ENRSELI|ENAUTOATNP));
8019 ahd_unpause(ahd);
8020 ahd->flags &= ~AHD_RESET_POLL_ACTIVE;
8021 ahd_unlock(ahd, &s);
8022 ahd_release_simq(ahd);
8023} 7981}
8024 7982
8025/**************************** Statistics Processing ***************************/ 7983/**************************** Statistics Processing ***************************/
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index bcced0a417e6..66e4a47bb9ee 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -782,6 +782,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd)
782{ 782{
783 struct ahd_softc *ahd; 783 struct ahd_softc *ahd;
784 int found; 784 int found;
785 unsigned long flags;
785 786
786 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; 787 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
787#ifdef AHD_DEBUG 788#ifdef AHD_DEBUG
@@ -789,8 +790,11 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd)
789 printf("%s: Bus reset called for cmd %p\n", 790 printf("%s: Bus reset called for cmd %p\n",
790 ahd_name(ahd), cmd); 791 ahd_name(ahd), cmd);
791#endif 792#endif
793 ahd_lock(ahd, &flags);
794
792 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A', 795 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
793 /*initiate reset*/TRUE); 796 /*initiate reset*/TRUE);
797 ahd_unlock(ahd, &flags);
794 798
795 if (bootverbose) 799 if (bootverbose)
796 printf("%s: SCSI bus reset delivered. " 800 printf("%s: SCSI bus reset delivered. "
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 24e71b555172..6dc88149f9f1 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -209,7 +209,6 @@ static struct scsi_host_template piix_sht = {
209 .name = DRV_NAME, 209 .name = DRV_NAME,
210 .ioctl = ata_scsi_ioctl, 210 .ioctl = ata_scsi_ioctl,
211 .queuecommand = ata_scsi_queuecmd, 211 .queuecommand = ata_scsi_queuecmd,
212 .eh_strategy_handler = ata_scsi_error,
213 .can_queue = ATA_DEF_QUEUE, 212 .can_queue = ATA_DEF_QUEUE,
214 .this_id = ATA_SHT_THIS_ID, 213 .this_id = ATA_SHT_THIS_ID,
215 .sg_tablesize = LIBATA_MAX_PRD, 214 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index ef57f253031c..dfcb96f3e60c 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -294,18 +294,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
294 if (sht->unchecked_isa_dma && privsize) 294 if (sht->unchecked_isa_dma && privsize)
295 gfp_mask |= __GFP_DMA; 295 gfp_mask |= __GFP_DMA;
296 296
297 /* Check to see if this host has any error handling facilities */
298 if (!sht->eh_strategy_handler && !sht->eh_abort_handler &&
299 !sht->eh_device_reset_handler && !sht->eh_bus_reset_handler &&
300 !sht->eh_host_reset_handler) {
301 printk(KERN_ERR "ERROR: SCSI host `%s' has no error handling\n"
302 "ERROR: This is not a safe way to run your "
303 "SCSI host\n"
304 "ERROR: The error handling must be added to "
305 "this driver\n", sht->proc_name);
306 dump_stack();
307 }
308
309 shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask); 297 shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);
310 if (!shost) 298 if (!shost)
311 return NULL; 299 return NULL;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index eaefeddb2b4a..0a8ad37ae899 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -168,7 +168,7 @@ static void release_event_pool(struct event_pool *pool,
168 ++in_use; 168 ++in_use;
169 if (pool->events[i].ext_list) { 169 if (pool->events[i].ext_list) {
170 dma_free_coherent(hostdata->dev, 170 dma_free_coherent(hostdata->dev,
171 SG_ALL * sizeof(struct memory_descriptor), 171 SG_ALL * sizeof(struct srp_direct_buf),
172 pool->events[i].ext_list, 172 pool->events[i].ext_list,
173 pool->events[i].ext_list_token); 173 pool->events[i].ext_list_token);
174 } 174 }
@@ -284,40 +284,37 @@ static void set_srp_direction(struct scsi_cmnd *cmd,
284 struct srp_cmd *srp_cmd, 284 struct srp_cmd *srp_cmd,
285 int numbuf) 285 int numbuf)
286{ 286{
287 u8 fmt;
288
287 if (numbuf == 0) 289 if (numbuf == 0)
288 return; 290 return;
289 291
290 if (numbuf == 1) { 292 if (numbuf == 1)
293 fmt = SRP_DATA_DESC_DIRECT;
294 else {
295 fmt = SRP_DATA_DESC_INDIRECT;
296 numbuf = min(numbuf, MAX_INDIRECT_BUFS);
297
291 if (cmd->sc_data_direction == DMA_TO_DEVICE) 298 if (cmd->sc_data_direction == DMA_TO_DEVICE)
292 srp_cmd->data_out_format = SRP_DIRECT_BUFFER; 299 srp_cmd->data_out_desc_cnt = numbuf;
293 else 300 else
294 srp_cmd->data_in_format = SRP_DIRECT_BUFFER; 301 srp_cmd->data_in_desc_cnt = numbuf;
295 } else {
296 if (cmd->sc_data_direction == DMA_TO_DEVICE) {
297 srp_cmd->data_out_format = SRP_INDIRECT_BUFFER;
298 srp_cmd->data_out_count =
299 numbuf < MAX_INDIRECT_BUFS ?
300 numbuf: MAX_INDIRECT_BUFS;
301 } else {
302 srp_cmd->data_in_format = SRP_INDIRECT_BUFFER;
303 srp_cmd->data_in_count =
304 numbuf < MAX_INDIRECT_BUFS ?
305 numbuf: MAX_INDIRECT_BUFS;
306 }
307 } 302 }
303
304 if (cmd->sc_data_direction == DMA_TO_DEVICE)
305 srp_cmd->buf_fmt = fmt << 4;
306 else
307 srp_cmd->buf_fmt = fmt;
308} 308}
309 309
310static void unmap_sg_list(int num_entries, 310static void unmap_sg_list(int num_entries,
311 struct device *dev, 311 struct device *dev,
312 struct memory_descriptor *md) 312 struct srp_direct_buf *md)
313{ 313{
314 int i; 314 int i;
315 315
316 for (i = 0; i < num_entries; ++i) { 316 for (i = 0; i < num_entries; ++i)
317 dma_unmap_single(dev, 317 dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
318 md[i].virtual_address,
319 md[i].length, DMA_BIDIRECTIONAL);
320 }
321} 318}
322 319
323/** 320/**
@@ -330,23 +327,26 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
330 struct srp_event_struct *evt_struct, 327 struct srp_event_struct *evt_struct,
331 struct device *dev) 328 struct device *dev)
332{ 329{
333 if ((cmd->data_out_format == SRP_NO_BUFFER) && 330 u8 out_fmt, in_fmt;
334 (cmd->data_in_format == SRP_NO_BUFFER)) 331
332 out_fmt = cmd->buf_fmt >> 4;
333 in_fmt = cmd->buf_fmt & ((1U << 4) - 1);
334
335 if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
335 return; 336 return;
336 else if ((cmd->data_out_format == SRP_DIRECT_BUFFER) || 337 else if (out_fmt == SRP_DATA_DESC_DIRECT ||
337 (cmd->data_in_format == SRP_DIRECT_BUFFER)) { 338 in_fmt == SRP_DATA_DESC_DIRECT) {
338 struct memory_descriptor *data = 339 struct srp_direct_buf *data =
339 (struct memory_descriptor *)cmd->additional_data; 340 (struct srp_direct_buf *) cmd->add_data;
340 dma_unmap_single(dev, data->virtual_address, data->length, 341 dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
341 DMA_BIDIRECTIONAL);
342 } else { 342 } else {
343 struct indirect_descriptor *indirect = 343 struct srp_indirect_buf *indirect =
344 (struct indirect_descriptor *)cmd->additional_data; 344 (struct srp_indirect_buf *) cmd->add_data;
345 int num_mapped = indirect->head.length / 345 int num_mapped = indirect->table_desc.len /
346 sizeof(indirect->list[0]); 346 sizeof(struct srp_direct_buf);
347 347
348 if (num_mapped <= MAX_INDIRECT_BUFS) { 348 if (num_mapped <= MAX_INDIRECT_BUFS) {
349 unmap_sg_list(num_mapped, dev, &indirect->list[0]); 349 unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]);
350 return; 350 return;
351 } 351 }
352 352
@@ -356,17 +356,17 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
356 356
357static int map_sg_list(int num_entries, 357static int map_sg_list(int num_entries,
358 struct scatterlist *sg, 358 struct scatterlist *sg,
359 struct memory_descriptor *md) 359 struct srp_direct_buf *md)
360{ 360{
361 int i; 361 int i;
362 u64 total_length = 0; 362 u64 total_length = 0;
363 363
364 for (i = 0; i < num_entries; ++i) { 364 for (i = 0; i < num_entries; ++i) {
365 struct memory_descriptor *descr = md + i; 365 struct srp_direct_buf *descr = md + i;
366 struct scatterlist *sg_entry = &sg[i]; 366 struct scatterlist *sg_entry = &sg[i];
367 descr->virtual_address = sg_dma_address(sg_entry); 367 descr->va = sg_dma_address(sg_entry);
368 descr->length = sg_dma_len(sg_entry); 368 descr->len = sg_dma_len(sg_entry);
369 descr->memory_handle = 0; 369 descr->key = 0;
370 total_length += sg_dma_len(sg_entry); 370 total_length += sg_dma_len(sg_entry);
371 } 371 }
372 return total_length; 372 return total_length;
@@ -389,10 +389,10 @@ static int map_sg_data(struct scsi_cmnd *cmd,
389 int sg_mapped; 389 int sg_mapped;
390 u64 total_length = 0; 390 u64 total_length = 0;
391 struct scatterlist *sg = cmd->request_buffer; 391 struct scatterlist *sg = cmd->request_buffer;
392 struct memory_descriptor *data = 392 struct srp_direct_buf *data =
393 (struct memory_descriptor *)srp_cmd->additional_data; 393 (struct srp_direct_buf *) srp_cmd->add_data;
394 struct indirect_descriptor *indirect = 394 struct srp_indirect_buf *indirect =
395 (struct indirect_descriptor *)data; 395 (struct srp_indirect_buf *) data;
396 396
397 sg_mapped = dma_map_sg(dev, sg, cmd->use_sg, DMA_BIDIRECTIONAL); 397 sg_mapped = dma_map_sg(dev, sg, cmd->use_sg, DMA_BIDIRECTIONAL);
398 398
@@ -403,9 +403,9 @@ static int map_sg_data(struct scsi_cmnd *cmd,
403 403
404 /* special case; we can use a single direct descriptor */ 404 /* special case; we can use a single direct descriptor */
405 if (sg_mapped == 1) { 405 if (sg_mapped == 1) {
406 data->virtual_address = sg_dma_address(&sg[0]); 406 data->va = sg_dma_address(&sg[0]);
407 data->length = sg_dma_len(&sg[0]); 407 data->len = sg_dma_len(&sg[0]);
408 data->memory_handle = 0; 408 data->key = 0;
409 return 1; 409 return 1;
410 } 410 }
411 411
@@ -416,25 +416,26 @@ static int map_sg_data(struct scsi_cmnd *cmd,
416 return 0; 416 return 0;
417 } 417 }
418 418
419 indirect->head.virtual_address = 0; 419 indirect->table_desc.va = 0;
420 indirect->head.length = sg_mapped * sizeof(indirect->list[0]); 420 indirect->table_desc.len = sg_mapped * sizeof(struct srp_direct_buf);
421 indirect->head.memory_handle = 0; 421 indirect->table_desc.key = 0;
422 422
423 if (sg_mapped <= MAX_INDIRECT_BUFS) { 423 if (sg_mapped <= MAX_INDIRECT_BUFS) {
424 total_length = map_sg_list(sg_mapped, sg, &indirect->list[0]); 424 total_length = map_sg_list(sg_mapped, sg,
425 indirect->total_length = total_length; 425 &indirect->desc_list[0]);
426 indirect->len = total_length;
426 return 1; 427 return 1;
427 } 428 }
428 429
429 /* get indirect table */ 430 /* get indirect table */
430 if (!evt_struct->ext_list) { 431 if (!evt_struct->ext_list) {
431 evt_struct->ext_list =(struct memory_descriptor*) 432 evt_struct->ext_list = (struct srp_direct_buf *)
432 dma_alloc_coherent(dev, 433 dma_alloc_coherent(dev,
433 SG_ALL * sizeof(struct memory_descriptor), 434 SG_ALL * sizeof(struct srp_direct_buf),
434 &evt_struct->ext_list_token, 0); 435 &evt_struct->ext_list_token, 0);
435 if (!evt_struct->ext_list) { 436 if (!evt_struct->ext_list) {
436 printk(KERN_ERR 437 printk(KERN_ERR
437 "ibmvscsi: Can't allocate memory for indirect table\n"); 438 "ibmvscsi: Can't allocate memory for indirect table\n");
438 return 0; 439 return 0;
439 440
440 } 441 }
@@ -442,11 +443,11 @@ static int map_sg_data(struct scsi_cmnd *cmd,
442 443
443 total_length = map_sg_list(sg_mapped, sg, evt_struct->ext_list); 444 total_length = map_sg_list(sg_mapped, sg, evt_struct->ext_list);
444 445
445 indirect->total_length = total_length; 446 indirect->len = total_length;
446 indirect->head.virtual_address = evt_struct->ext_list_token; 447 indirect->table_desc.va = evt_struct->ext_list_token;
447 indirect->head.length = sg_mapped * sizeof(indirect->list[0]); 448 indirect->table_desc.len = sg_mapped * sizeof(indirect->desc_list[0]);
448 memcpy(indirect->list, evt_struct->ext_list, 449 memcpy(indirect->desc_list, evt_struct->ext_list,
449 MAX_INDIRECT_BUFS * sizeof(struct memory_descriptor)); 450 MAX_INDIRECT_BUFS * sizeof(struct srp_direct_buf));
450 451
451 return 1; 452 return 1;
452} 453}
@@ -463,20 +464,20 @@ static int map_sg_data(struct scsi_cmnd *cmd,
463static int map_single_data(struct scsi_cmnd *cmd, 464static int map_single_data(struct scsi_cmnd *cmd,
464 struct srp_cmd *srp_cmd, struct device *dev) 465 struct srp_cmd *srp_cmd, struct device *dev)
465{ 466{
466 struct memory_descriptor *data = 467 struct srp_direct_buf *data =
467 (struct memory_descriptor *)srp_cmd->additional_data; 468 (struct srp_direct_buf *) srp_cmd->add_data;
468 469
469 data->virtual_address = 470 data->va =
470 dma_map_single(dev, cmd->request_buffer, 471 dma_map_single(dev, cmd->request_buffer,
471 cmd->request_bufflen, 472 cmd->request_bufflen,
472 DMA_BIDIRECTIONAL); 473 DMA_BIDIRECTIONAL);
473 if (dma_mapping_error(data->virtual_address)) { 474 if (dma_mapping_error(data->va)) {
474 printk(KERN_ERR 475 printk(KERN_ERR
475 "ibmvscsi: Unable to map request_buffer for command!\n"); 476 "ibmvscsi: Unable to map request_buffer for command!\n");
476 return 0; 477 return 0;
477 } 478 }
478 data->length = cmd->request_bufflen; 479 data->len = cmd->request_bufflen;
479 data->memory_handle = 0; 480 data->key = 0;
480 481
481 set_srp_direction(cmd, srp_cmd, 1); 482 set_srp_direction(cmd, srp_cmd, 1);
482 483
@@ -548,7 +549,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
548 549
549 /* Copy the IU into the transfer area */ 550 /* Copy the IU into the transfer area */
550 *evt_struct->xfer_iu = evt_struct->iu; 551 *evt_struct->xfer_iu = evt_struct->iu;
551 evt_struct->xfer_iu->srp.generic.tag = (u64)evt_struct; 552 evt_struct->xfer_iu->srp.rsp.tag = (u64)evt_struct;
552 553
553 /* Add this to the sent list. We need to do this 554 /* Add this to the sent list. We need to do this
554 * before we actually send 555 * before we actually send
@@ -586,27 +587,27 @@ static void handle_cmd_rsp(struct srp_event_struct *evt_struct)
586 struct srp_rsp *rsp = &evt_struct->xfer_iu->srp.rsp; 587 struct srp_rsp *rsp = &evt_struct->xfer_iu->srp.rsp;
587 struct scsi_cmnd *cmnd = evt_struct->cmnd; 588 struct scsi_cmnd *cmnd = evt_struct->cmnd;
588 589
589 if (unlikely(rsp->type != SRP_RSP_TYPE)) { 590 if (unlikely(rsp->opcode != SRP_RSP)) {
590 if (printk_ratelimit()) 591 if (printk_ratelimit())
591 printk(KERN_WARNING 592 printk(KERN_WARNING
592 "ibmvscsi: bad SRP RSP type %d\n", 593 "ibmvscsi: bad SRP RSP type %d\n",
593 rsp->type); 594 rsp->opcode);
594 } 595 }
595 596
596 if (cmnd) { 597 if (cmnd) {
597 cmnd->result = rsp->status; 598 cmnd->result = rsp->status;
598 if (((cmnd->result >> 1) & 0x1f) == CHECK_CONDITION) 599 if (((cmnd->result >> 1) & 0x1f) == CHECK_CONDITION)
599 memcpy(cmnd->sense_buffer, 600 memcpy(cmnd->sense_buffer,
600 rsp->sense_and_response_data, 601 rsp->data,
601 rsp->sense_data_list_length); 602 rsp->sense_data_len);
602 unmap_cmd_data(&evt_struct->iu.srp.cmd, 603 unmap_cmd_data(&evt_struct->iu.srp.cmd,
603 evt_struct, 604 evt_struct,
604 evt_struct->hostdata->dev); 605 evt_struct->hostdata->dev);
605 606
606 if (rsp->doover) 607 if (rsp->flags & SRP_RSP_FLAG_DOOVER)
607 cmnd->resid = rsp->data_out_residual_count; 608 cmnd->resid = rsp->data_out_res_cnt;
608 else if (rsp->diover) 609 else if (rsp->flags & SRP_RSP_FLAG_DIOVER)
609 cmnd->resid = rsp->data_in_residual_count; 610 cmnd->resid = rsp->data_in_res_cnt;
610 } 611 }
611 612
612 if (evt_struct->cmnd_done) 613 if (evt_struct->cmnd_done)
@@ -633,10 +634,11 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
633{ 634{
634 struct srp_cmd *srp_cmd; 635 struct srp_cmd *srp_cmd;
635 struct srp_event_struct *evt_struct; 636 struct srp_event_struct *evt_struct;
636 struct indirect_descriptor *indirect; 637 struct srp_indirect_buf *indirect;
637 struct ibmvscsi_host_data *hostdata = 638 struct ibmvscsi_host_data *hostdata =
638 (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata; 639 (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata;
639 u16 lun = lun_from_dev(cmnd->device); 640 u16 lun = lun_from_dev(cmnd->device);
641 u8 out_fmt, in_fmt;
640 642
641 evt_struct = get_event_struct(&hostdata->pool); 643 evt_struct = get_event_struct(&hostdata->pool);
642 if (!evt_struct) 644 if (!evt_struct)
@@ -644,8 +646,8 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
644 646
645 /* Set up the actual SRP IU */ 647 /* Set up the actual SRP IU */
646 srp_cmd = &evt_struct->iu.srp.cmd; 648 srp_cmd = &evt_struct->iu.srp.cmd;
647 memset(srp_cmd, 0x00, sizeof(*srp_cmd)); 649 memset(srp_cmd, 0x00, SRP_MAX_IU_LEN);
648 srp_cmd->type = SRP_CMD_TYPE; 650 srp_cmd->opcode = SRP_CMD;
649 memcpy(srp_cmd->cdb, cmnd->cmnd, sizeof(cmnd->cmnd)); 651 memcpy(srp_cmd->cdb, cmnd->cmnd, sizeof(cmnd->cmnd));
650 srp_cmd->lun = ((u64) lun) << 48; 652 srp_cmd->lun = ((u64) lun) << 48;
651 653
@@ -664,13 +666,15 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
664 evt_struct->cmnd_done = done; 666 evt_struct->cmnd_done = done;
665 667
666 /* Fix up dma address of the buffer itself */ 668 /* Fix up dma address of the buffer itself */
667 indirect = (struct indirect_descriptor *)srp_cmd->additional_data; 669 indirect = (struct srp_indirect_buf *) srp_cmd->add_data;
668 if (((srp_cmd->data_out_format == SRP_INDIRECT_BUFFER) || 670 out_fmt = srp_cmd->buf_fmt >> 4;
669 (srp_cmd->data_in_format == SRP_INDIRECT_BUFFER)) && 671 in_fmt = srp_cmd->buf_fmt & ((1U << 4) - 1);
670 (indirect->head.virtual_address == 0)) { 672 if ((in_fmt == SRP_DATA_DESC_INDIRECT ||
671 indirect->head.virtual_address = evt_struct->crq.IU_data_ptr + 673 out_fmt == SRP_DATA_DESC_INDIRECT) &&
672 offsetof(struct srp_cmd, additional_data) + 674 indirect->table_desc.va == 0) {
673 offsetof(struct indirect_descriptor, list); 675 indirect->table_desc.va = evt_struct->crq.IU_data_ptr +
676 offsetof(struct srp_cmd, add_data) +
677 offsetof(struct srp_indirect_buf, desc_list);
674 } 678 }
675 679
676 return ibmvscsi_send_srp_event(evt_struct, hostdata); 680 return ibmvscsi_send_srp_event(evt_struct, hostdata);
@@ -780,10 +784,10 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
780static void login_rsp(struct srp_event_struct *evt_struct) 784static void login_rsp(struct srp_event_struct *evt_struct)
781{ 785{
782 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; 786 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
783 switch (evt_struct->xfer_iu->srp.generic.type) { 787 switch (evt_struct->xfer_iu->srp.login_rsp.opcode) {
784 case SRP_LOGIN_RSP_TYPE: /* it worked! */ 788 case SRP_LOGIN_RSP: /* it worked! */
785 break; 789 break;
786 case SRP_LOGIN_REJ_TYPE: /* refused! */ 790 case SRP_LOGIN_REJ: /* refused! */
787 printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REJ reason %u\n", 791 printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REJ reason %u\n",
788 evt_struct->xfer_iu->srp.login_rej.reason); 792 evt_struct->xfer_iu->srp.login_rej.reason);
789 /* Login failed. */ 793 /* Login failed. */
@@ -792,7 +796,7 @@ static void login_rsp(struct srp_event_struct *evt_struct)
792 default: 796 default:
793 printk(KERN_ERR 797 printk(KERN_ERR
794 "ibmvscsi: Invalid login response typecode 0x%02x!\n", 798 "ibmvscsi: Invalid login response typecode 0x%02x!\n",
795 evt_struct->xfer_iu->srp.generic.type); 799 evt_struct->xfer_iu->srp.login_rsp.opcode);
796 /* Login failed. */ 800 /* Login failed. */
797 atomic_set(&hostdata->request_limit, -1); 801 atomic_set(&hostdata->request_limit, -1);
798 return; 802 return;
@@ -800,17 +804,17 @@ static void login_rsp(struct srp_event_struct *evt_struct)
800 804
801 printk(KERN_INFO "ibmvscsi: SRP_LOGIN succeeded\n"); 805 printk(KERN_INFO "ibmvscsi: SRP_LOGIN succeeded\n");
802 806
803 if (evt_struct->xfer_iu->srp.login_rsp.request_limit_delta > 807 if (evt_struct->xfer_iu->srp.login_rsp.req_lim_delta >
804 (max_requests - 2)) 808 (max_requests - 2))
805 evt_struct->xfer_iu->srp.login_rsp.request_limit_delta = 809 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta =
806 max_requests - 2; 810 max_requests - 2;
807 811
808 /* Now we know what the real request-limit is */ 812 /* Now we know what the real request-limit is */
809 atomic_set(&hostdata->request_limit, 813 atomic_set(&hostdata->request_limit,
810 evt_struct->xfer_iu->srp.login_rsp.request_limit_delta); 814 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta);
811 815
812 hostdata->host->can_queue = 816 hostdata->host->can_queue =
813 evt_struct->xfer_iu->srp.login_rsp.request_limit_delta - 2; 817 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta - 2;
814 818
815 if (hostdata->host->can_queue < 1) { 819 if (hostdata->host->can_queue < 1) {
816 printk(KERN_ERR "ibmvscsi: Invalid request_limit_delta\n"); 820 printk(KERN_ERR "ibmvscsi: Invalid request_limit_delta\n");
@@ -849,18 +853,19 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
849 853
850 login = &evt_struct->iu.srp.login_req; 854 login = &evt_struct->iu.srp.login_req;
851 memset(login, 0x00, sizeof(struct srp_login_req)); 855 memset(login, 0x00, sizeof(struct srp_login_req));
852 login->type = SRP_LOGIN_REQ_TYPE; 856 login->opcode = SRP_LOGIN_REQ;
853 login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu); 857 login->req_it_iu_len = sizeof(union srp_iu);
854 login->required_buffer_formats = 0x0006; 858 login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT;
855 859
860 spin_lock_irqsave(hostdata->host->host_lock, flags);
856 /* Start out with a request limit of 1, since this is negotiated in 861 /* Start out with a request limit of 1, since this is negotiated in
857 * the login request we are just sending 862 * the login request we are just sending
858 */ 863 */
859 atomic_set(&hostdata->request_limit, 1); 864 atomic_set(&hostdata->request_limit, 1);
860 865
861 spin_lock_irqsave(hostdata->host->host_lock, flags);
862 rc = ibmvscsi_send_srp_event(evt_struct, hostdata); 866 rc = ibmvscsi_send_srp_event(evt_struct, hostdata);
863 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 867 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
868 printk("ibmvscsic: sent SRP login\n");
864 return rc; 869 return rc;
865}; 870};
866 871
@@ -928,13 +933,13 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
928 933
929 /* Set up an abort SRP command */ 934 /* Set up an abort SRP command */
930 memset(tsk_mgmt, 0x00, sizeof(*tsk_mgmt)); 935 memset(tsk_mgmt, 0x00, sizeof(*tsk_mgmt));
931 tsk_mgmt->type = SRP_TSK_MGMT_TYPE; 936 tsk_mgmt->opcode = SRP_TSK_MGMT;
932 tsk_mgmt->lun = ((u64) lun) << 48; 937 tsk_mgmt->lun = ((u64) lun) << 48;
933 tsk_mgmt->task_mgmt_flags = 0x01; /* ABORT TASK */ 938 tsk_mgmt->tsk_mgmt_func = SRP_TSK_ABORT_TASK;
934 tsk_mgmt->managed_task_tag = (u64) found_evt; 939 tsk_mgmt->task_tag = (u64) found_evt;
935 940
936 printk(KERN_INFO "ibmvscsi: aborting command. lun 0x%lx, tag 0x%lx\n", 941 printk(KERN_INFO "ibmvscsi: aborting command. lun 0x%lx, tag 0x%lx\n",
937 tsk_mgmt->lun, tsk_mgmt->managed_task_tag); 942 tsk_mgmt->lun, tsk_mgmt->task_tag);
938 943
939 evt->sync_srp = &srp_rsp; 944 evt->sync_srp = &srp_rsp;
940 init_completion(&evt->comp); 945 init_completion(&evt->comp);
@@ -948,25 +953,25 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
948 wait_for_completion(&evt->comp); 953 wait_for_completion(&evt->comp);
949 954
950 /* make sure we got a good response */ 955 /* make sure we got a good response */
951 if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) { 956 if (unlikely(srp_rsp.srp.rsp.opcode != SRP_RSP)) {
952 if (printk_ratelimit()) 957 if (printk_ratelimit())
953 printk(KERN_WARNING 958 printk(KERN_WARNING
954 "ibmvscsi: abort bad SRP RSP type %d\n", 959 "ibmvscsi: abort bad SRP RSP type %d\n",
955 srp_rsp.srp.generic.type); 960 srp_rsp.srp.rsp.opcode);
956 return FAILED; 961 return FAILED;
957 } 962 }
958 963
959 if (srp_rsp.srp.rsp.rspvalid) 964 if (srp_rsp.srp.rsp.flags & SRP_RSP_FLAG_RSPVALID)
960 rsp_rc = *((int *)srp_rsp.srp.rsp.sense_and_response_data); 965 rsp_rc = *((int *)srp_rsp.srp.rsp.data);
961 else 966 else
962 rsp_rc = srp_rsp.srp.rsp.status; 967 rsp_rc = srp_rsp.srp.rsp.status;
963 968
964 if (rsp_rc) { 969 if (rsp_rc) {
965 if (printk_ratelimit()) 970 if (printk_ratelimit())
966 printk(KERN_WARNING 971 printk(KERN_WARNING
967 "ibmvscsi: abort code %d for task tag 0x%lx\n", 972 "ibmvscsi: abort code %d for task tag 0x%lx\n",
968 rsp_rc, 973 rsp_rc,
969 tsk_mgmt->managed_task_tag); 974 tsk_mgmt->task_tag);
970 return FAILED; 975 return FAILED;
971 } 976 }
972 977
@@ -987,13 +992,13 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
987 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 992 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
988 printk(KERN_INFO 993 printk(KERN_INFO
989 "ibmvscsi: aborted task tag 0x%lx completed\n", 994 "ibmvscsi: aborted task tag 0x%lx completed\n",
990 tsk_mgmt->managed_task_tag); 995 tsk_mgmt->task_tag);
991 return SUCCESS; 996 return SUCCESS;
992 } 997 }
993 998
994 printk(KERN_INFO 999 printk(KERN_INFO
995 "ibmvscsi: successfully aborted task tag 0x%lx\n", 1000 "ibmvscsi: successfully aborted task tag 0x%lx\n",
996 tsk_mgmt->managed_task_tag); 1001 tsk_mgmt->task_tag);
997 1002
998 cmd->result = (DID_ABORT << 16); 1003 cmd->result = (DID_ABORT << 16);
999 list_del(&found_evt->list); 1004 list_del(&found_evt->list);
@@ -1040,9 +1045,9 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1040 1045
1041 /* Set up a lun reset SRP command */ 1046 /* Set up a lun reset SRP command */
1042 memset(tsk_mgmt, 0x00, sizeof(*tsk_mgmt)); 1047 memset(tsk_mgmt, 0x00, sizeof(*tsk_mgmt));
1043 tsk_mgmt->type = SRP_TSK_MGMT_TYPE; 1048 tsk_mgmt->opcode = SRP_TSK_MGMT;
1044 tsk_mgmt->lun = ((u64) lun) << 48; 1049 tsk_mgmt->lun = ((u64) lun) << 48;
1045 tsk_mgmt->task_mgmt_flags = 0x08; /* LUN RESET */ 1050 tsk_mgmt->tsk_mgmt_func = SRP_TSK_LUN_RESET;
1046 1051
1047 printk(KERN_INFO "ibmvscsi: resetting device. lun 0x%lx\n", 1052 printk(KERN_INFO "ibmvscsi: resetting device. lun 0x%lx\n",
1048 tsk_mgmt->lun); 1053 tsk_mgmt->lun);
@@ -1059,16 +1064,16 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1059 wait_for_completion(&evt->comp); 1064 wait_for_completion(&evt->comp);
1060 1065
1061 /* make sure we got a good response */ 1066 /* make sure we got a good response */
1062 if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) { 1067 if (unlikely(srp_rsp.srp.rsp.opcode != SRP_RSP)) {
1063 if (printk_ratelimit()) 1068 if (printk_ratelimit())
1064 printk(KERN_WARNING 1069 printk(KERN_WARNING
1065 "ibmvscsi: reset bad SRP RSP type %d\n", 1070 "ibmvscsi: reset bad SRP RSP type %d\n",
1066 srp_rsp.srp.generic.type); 1071 srp_rsp.srp.rsp.opcode);
1067 return FAILED; 1072 return FAILED;
1068 } 1073 }
1069 1074
1070 if (srp_rsp.srp.rsp.rspvalid) 1075 if (srp_rsp.srp.rsp.flags & SRP_RSP_FLAG_RSPVALID)
1071 rsp_rc = *((int *)srp_rsp.srp.rsp.sense_and_response_data); 1076 rsp_rc = *((int *)srp_rsp.srp.rsp.data);
1072 else 1077 else
1073 rsp_rc = srp_rsp.srp.rsp.status; 1078 rsp_rc = srp_rsp.srp.rsp.status;
1074 1079
@@ -1076,8 +1081,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1076 if (printk_ratelimit()) 1081 if (printk_ratelimit())
1077 printk(KERN_WARNING 1082 printk(KERN_WARNING
1078 "ibmvscsi: reset code %d for task tag 0x%lx\n", 1083 "ibmvscsi: reset code %d for task tag 0x%lx\n",
1079 rsp_rc, 1084 rsp_rc, tsk_mgmt->task_tag);
1080 tsk_mgmt->managed_task_tag);
1081 return FAILED; 1085 return FAILED;
1082 } 1086 }
1083 1087
@@ -1179,6 +1183,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
1179 /* We need to re-setup the interpartition connection */ 1183 /* We need to re-setup the interpartition connection */
1180 printk(KERN_INFO 1184 printk(KERN_INFO
1181 "ibmvscsi: Re-enabling adapter!\n"); 1185 "ibmvscsi: Re-enabling adapter!\n");
1186 atomic_set(&hostdata->request_limit, -1);
1182 purge_requests(hostdata, DID_REQUEUE); 1187 purge_requests(hostdata, DID_REQUEUE);
1183 if (ibmvscsi_reenable_crq_queue(&hostdata->queue, 1188 if (ibmvscsi_reenable_crq_queue(&hostdata->queue,
1184 hostdata) == 0) 1189 hostdata) == 0)
@@ -1226,7 +1231,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
1226 } 1231 }
1227 1232
1228 if (crq->format == VIOSRP_SRP_FORMAT) 1233 if (crq->format == VIOSRP_SRP_FORMAT)
1229 atomic_add(evt_struct->xfer_iu->srp.rsp.request_limit_delta, 1234 atomic_add(evt_struct->xfer_iu->srp.rsp.req_lim_delta,
1230 &hostdata->request_limit); 1235 &hostdata->request_limit);
1231 1236
1232 if (evt_struct->done) 1237 if (evt_struct->done)
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 4550d71e4744..5c6d93582929 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -68,7 +68,7 @@ struct srp_event_struct {
68 void (*cmnd_done) (struct scsi_cmnd *); 68 void (*cmnd_done) (struct scsi_cmnd *);
69 struct completion comp; 69 struct completion comp;
70 union viosrp_iu *sync_srp; 70 union viosrp_iu *sync_srp;
71 struct memory_descriptor *ext_list; 71 struct srp_direct_buf *ext_list;
72 dma_addr_t ext_list_token; 72 dma_addr_t ext_list_token;
73}; 73};
74 74
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 892e8ed63091..1a9992bdfef8 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -34,7 +34,6 @@
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include "ibmvscsi.h" 36#include "ibmvscsi.h"
37#include "srp.h"
38 37
39static char partition_name[97] = "UNKNOWN"; 38static char partition_name[97] = "UNKNOWN";
40static unsigned int partition_number = -1; 39static unsigned int partition_number = -1;
diff --git a/drivers/scsi/ibmvscsi/srp.h b/drivers/scsi/ibmvscsi/srp.h
deleted file mode 100644
index 7d8e4c4accb9..000000000000
--- a/drivers/scsi/ibmvscsi/srp.h
+++ /dev/null
@@ -1,227 +0,0 @@
1/*****************************************************************************/
2/* srp.h -- SCSI RDMA Protocol definitions */
3/* */
4/* Written By: Colin Devilbis, IBM Corporation */
5/* */
6/* Copyright (C) 2003 IBM Corporation */
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/* This file contains structures and definitions for the SCSI RDMA Protocol */
24/* (SRP) as defined in the T10 standard available at www.t10.org. This */
25/* file was based on the 16a version of the standard */
26/* */
27/*****************************************************************************/
28#ifndef SRP_H
29#define SRP_H
30
31#define SRP_VERSION "16.a"
32
33#define PACKED __attribute__((packed))
34
35enum srp_types {
36 SRP_LOGIN_REQ_TYPE = 0x00,
37 SRP_LOGIN_RSP_TYPE = 0xC0,
38 SRP_LOGIN_REJ_TYPE = 0xC2,
39 SRP_I_LOGOUT_TYPE = 0x03,
40 SRP_T_LOGOUT_TYPE = 0x80,
41 SRP_TSK_MGMT_TYPE = 0x01,
42 SRP_CMD_TYPE = 0x02,
43 SRP_RSP_TYPE = 0xC1,
44 SRP_CRED_REQ_TYPE = 0x81,
45 SRP_CRED_RSP_TYPE = 0x41,
46 SRP_AER_REQ_TYPE = 0x82,
47 SRP_AER_RSP_TYPE = 0x42
48};
49
50enum srp_descriptor_formats {
51 SRP_NO_BUFFER = 0x00,
52 SRP_DIRECT_BUFFER = 0x01,
53 SRP_INDIRECT_BUFFER = 0x02
54};
55
56struct memory_descriptor {
57 u64 virtual_address;
58 u32 memory_handle;
59 u32 length;
60};
61
62struct indirect_descriptor {
63 struct memory_descriptor head;
64 u32 total_length;
65 struct memory_descriptor list[1] PACKED;
66};
67
68struct srp_generic {
69 u8 type;
70 u8 reserved1[7];
71 u64 tag;
72};
73
74struct srp_login_req {
75 u8 type;
76 u8 reserved1[7];
77 u64 tag;
78 u32 max_requested_initiator_to_target_iulen;
79 u32 reserved2;
80 u16 required_buffer_formats;
81 u8 reserved3:6;
82 u8 multi_channel_action:2;
83 u8 reserved4;
84 u32 reserved5;
85 u8 initiator_port_identifier[16];
86 u8 target_port_identifier[16];
87};
88
89struct srp_login_rsp {
90 u8 type;
91 u8 reserved1[3];
92 u32 request_limit_delta;
93 u64 tag;
94 u32 max_initiator_to_target_iulen;
95 u32 max_target_to_initiator_iulen;
96 u16 supported_buffer_formats;
97 u8 reserved2:6;
98 u8 multi_channel_result:2;
99 u8 reserved3;
100 u8 reserved4[24];
101};
102
103struct srp_login_rej {
104 u8 type;
105 u8 reserved1[3];
106 u32 reason;
107 u64 tag;
108 u64 reserved2;
109 u16 supported_buffer_formats;
110 u8 reserved3[6];
111};
112
113struct srp_i_logout {
114 u8 type;
115 u8 reserved1[7];
116 u64 tag;
117};
118
119struct srp_t_logout {
120 u8 type;
121 u8 reserved1[3];
122 u32 reason;
123 u64 tag;
124};
125
126struct srp_tsk_mgmt {
127 u8 type;
128 u8 reserved1[7];
129 u64 tag;
130 u32 reserved2;
131 u64 lun PACKED;
132 u8 reserved3;
133 u8 reserved4;
134 u8 task_mgmt_flags;
135 u8 reserved5;
136 u64 managed_task_tag;
137 u64 reserved6;
138};
139
140struct srp_cmd {
141 u8 type;
142 u32 reserved1 PACKED;
143 u8 data_out_format:4;
144 u8 data_in_format:4;
145 u8 data_out_count;
146 u8 data_in_count;
147 u64 tag;
148 u32 reserved2;
149 u64 lun PACKED;
150 u8 reserved3;
151 u8 reserved4:5;
152 u8 task_attribute:3;
153 u8 reserved5;
154 u8 additional_cdb_len;
155 u8 cdb[16];
156 u8 additional_data[0x100 - 0x30];
157};
158
159struct srp_rsp {
160 u8 type;
161 u8 reserved1[3];
162 u32 request_limit_delta;
163 u64 tag;
164 u16 reserved2;
165 u8 reserved3:2;
166 u8 diunder:1;
167 u8 diover:1;
168 u8 dounder:1;
169 u8 doover:1;
170 u8 snsvalid:1;
171 u8 rspvalid:1;
172 u8 status;
173 u32 data_in_residual_count;
174 u32 data_out_residual_count;
175 u32 sense_data_list_length;
176 u32 response_data_list_length;
177 u8 sense_and_response_data[18];
178};
179
180struct srp_cred_req {
181 u8 type;
182 u8 reserved1[3];
183 u32 request_limit_delta;
184 u64 tag;
185};
186
187struct srp_cred_rsp {
188 u8 type;
189 u8 reserved1[7];
190 u64 tag;
191};
192
193struct srp_aer_req {
194 u8 type;
195 u8 reserved1[3];
196 u32 request_limit_delta;
197 u64 tag;
198 u32 reserved2;
199 u64 lun;
200 u32 sense_data_list_length;
201 u32 reserved3;
202 u8 sense_data[20];
203};
204
205struct srp_aer_rsp {
206 u8 type;
207 u8 reserved1[7];
208 u64 tag;
209};
210
211union srp_iu {
212 struct srp_generic generic;
213 struct srp_login_req login_req;
214 struct srp_login_rsp login_rsp;
215 struct srp_login_rej login_rej;
216 struct srp_i_logout i_logout;
217 struct srp_t_logout t_logout;
218 struct srp_tsk_mgmt tsk_mgmt;
219 struct srp_cmd cmd;
220 struct srp_rsp rsp;
221 struct srp_cred_req cred_req;
222 struct srp_cred_rsp cred_rsp;
223 struct srp_aer_req aer_req;
224 struct srp_aer_rsp aer_rsp;
225};
226
227#endif
diff --git a/drivers/scsi/ibmvscsi/viosrp.h b/drivers/scsi/ibmvscsi/viosrp.h
index 6a6bba8a2f34..90f1a61283ad 100644
--- a/drivers/scsi/ibmvscsi/viosrp.h
+++ b/drivers/scsi/ibmvscsi/viosrp.h
@@ -33,7 +33,22 @@
33/*****************************************************************************/ 33/*****************************************************************************/
34#ifndef VIOSRP_H 34#ifndef VIOSRP_H
35#define VIOSRP_H 35#define VIOSRP_H
36#include "srp.h" 36#include <scsi/srp.h>
37
38#define SRP_VERSION "16.a"
39#define SRP_MAX_IU_LEN 256
40
41union srp_iu {
42 struct srp_login_req login_req;
43 struct srp_login_rsp login_rsp;
44 struct srp_login_rej login_rej;
45 struct srp_i_logout i_logout;
46 struct srp_t_logout t_logout;
47 struct srp_tsk_mgmt tsk_mgmt;
48 struct srp_cmd cmd;
49 struct srp_rsp rsp;
50 u8 reserved[SRP_MAX_IU_LEN];
51};
37 52
38enum viosrp_crq_formats { 53enum viosrp_crq_formats {
39 VIOSRP_SRP_FORMAT = 0x01, 54 VIOSRP_SRP_FORMAT = 0x01,
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5890e5f92d82..8b80e59c8c52 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -164,29 +164,6 @@ MODULE_PARM_DESC(auto_create, "Auto-create single device RAID 0 arrays when init
164MODULE_LICENSE("GPL"); 164MODULE_LICENSE("GPL");
165MODULE_VERSION(IPR_DRIVER_VERSION); 165MODULE_VERSION(IPR_DRIVER_VERSION);
166 166
167static const char *ipr_gpdd_dev_end_states[] = {
168 "Command complete",
169 "Terminated by host",
170 "Terminated by device reset",
171 "Terminated by bus reset",
172 "Unknown",
173 "Command not started"
174};
175
176static const char *ipr_gpdd_dev_bus_phases[] = {
177 "Bus free",
178 "Arbitration",
179 "Selection",
180 "Message out",
181 "Command",
182 "Message in",
183 "Data out",
184 "Data in",
185 "Status",
186 "Reselection",
187 "Unknown"
188};
189
190/* A constant array of IOASCs/URCs/Error Messages */ 167/* A constant array of IOASCs/URCs/Error Messages */
191static const 168static const
192struct ipr_error_table_t ipr_error_table[] = { 169struct ipr_error_table_t ipr_error_table[] = {
@@ -869,8 +846,8 @@ static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg,
869 846
870 if (hostrcb->hcam.notify_type == IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY) { 847 if (hostrcb->hcam.notify_type == IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY) {
871 if (res->sdev) { 848 if (res->sdev) {
872 res->sdev->hostdata = NULL;
873 res->del_from_ml = 1; 849 res->del_from_ml = 1;
850 res->cfgte.res_handle = IPR_INVALID_RES_HANDLE;
874 if (ioa_cfg->allow_ml_add_del) 851 if (ioa_cfg->allow_ml_add_del)
875 schedule_work(&ioa_cfg->work_q); 852 schedule_work(&ioa_cfg->work_q);
876 } else 853 } else
@@ -1356,8 +1333,8 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
1356 return; 1333 return;
1357 1334
1358 if (ipr_is_device(&hostrcb->hcam.u.error.failing_dev_res_addr)) { 1335 if (ipr_is_device(&hostrcb->hcam.u.error.failing_dev_res_addr)) {
1359 ipr_res_err(ioa_cfg, hostrcb->hcam.u.error.failing_dev_res_addr, 1336 ipr_ra_err(ioa_cfg, hostrcb->hcam.u.error.failing_dev_res_addr,
1360 "%s\n", ipr_error_table[error_index].error); 1337 "%s\n", ipr_error_table[error_index].error);
1361 } else { 1338 } else {
1362 dev_err(&ioa_cfg->pdev->dev, "%s\n", 1339 dev_err(&ioa_cfg->pdev->dev, "%s\n",
1363 ipr_error_table[error_index].error); 1340 ipr_error_table[error_index].error);
@@ -2107,7 +2084,6 @@ restart:
2107 did_work = 1; 2084 did_work = 1;
2108 sdev = res->sdev; 2085 sdev = res->sdev;
2109 if (!scsi_device_get(sdev)) { 2086 if (!scsi_device_get(sdev)) {
2110 res->sdev = NULL;
2111 list_move_tail(&res->queue, &ioa_cfg->free_res_q); 2087 list_move_tail(&res->queue, &ioa_cfg->free_res_q);
2112 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 2088 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2113 scsi_remove_device(sdev); 2089 scsi_remove_device(sdev);
@@ -2124,6 +2100,7 @@ restart:
2124 bus = res->cfgte.res_addr.bus; 2100 bus = res->cfgte.res_addr.bus;
2125 target = res->cfgte.res_addr.target; 2101 target = res->cfgte.res_addr.target;
2126 lun = res->cfgte.res_addr.lun; 2102 lun = res->cfgte.res_addr.lun;
2103 res->add_to_ml = 0;
2127 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 2104 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2128 scsi_add_device(ioa_cfg->host, bus, target, lun); 2105 scsi_add_device(ioa_cfg->host, bus, target, lun);
2129 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); 2106 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
@@ -3214,7 +3191,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
3214 sdev->timeout = IPR_VSET_RW_TIMEOUT; 3191 sdev->timeout = IPR_VSET_RW_TIMEOUT;
3215 blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); 3192 blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
3216 } 3193 }
3217 if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data)) 3194 if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res))
3218 sdev->allow_restart = 1; 3195 sdev->allow_restart = 1;
3219 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 3196 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
3220 } 3197 }
@@ -3304,6 +3281,44 @@ static int ipr_eh_host_reset(struct scsi_cmnd * cmd)
3304} 3281}
3305 3282
3306/** 3283/**
3284 * ipr_device_reset - Reset the device
3285 * @ioa_cfg: ioa config struct
3286 * @res: resource entry struct
3287 *
3288 * This function issues a device reset to the affected device.
3289 * If the device is a SCSI device, a LUN reset will be sent
3290 * to the device first. If that does not work, a target reset
3291 * will be sent.
3292 *
3293 * Return value:
3294 * 0 on success / non-zero on failure
3295 **/
3296static int ipr_device_reset(struct ipr_ioa_cfg *ioa_cfg,
3297 struct ipr_resource_entry *res)
3298{
3299 struct ipr_cmnd *ipr_cmd;
3300 struct ipr_ioarcb *ioarcb;
3301 struct ipr_cmd_pkt *cmd_pkt;
3302 u32 ioasc;
3303
3304 ENTER;
3305 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
3306 ioarcb = &ipr_cmd->ioarcb;
3307 cmd_pkt = &ioarcb->cmd_pkt;
3308
3309 ioarcb->res_handle = res->cfgte.res_handle;
3310 cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
3311 cmd_pkt->cdb[0] = IPR_RESET_DEVICE;
3312
3313 ipr_send_blocking_cmd(ipr_cmd, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT);
3314 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
3315 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
3316
3317 LEAVE;
3318 return (IPR_IOASC_SENSE_KEY(ioasc) ? -EIO : 0);
3319}
3320
3321/**
3307 * ipr_eh_dev_reset - Reset the device 3322 * ipr_eh_dev_reset - Reset the device
3308 * @scsi_cmd: scsi command struct 3323 * @scsi_cmd: scsi command struct
3309 * 3324 *
@@ -3319,8 +3334,7 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
3319 struct ipr_cmnd *ipr_cmd; 3334 struct ipr_cmnd *ipr_cmd;
3320 struct ipr_ioa_cfg *ioa_cfg; 3335 struct ipr_ioa_cfg *ioa_cfg;
3321 struct ipr_resource_entry *res; 3336 struct ipr_resource_entry *res;
3322 struct ipr_cmd_pkt *cmd_pkt; 3337 int rc;
3323 u32 ioasc;
3324 3338
3325 ENTER; 3339 ENTER;
3326 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; 3340 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
@@ -3347,25 +3361,12 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
3347 } 3361 }
3348 3362
3349 res->resetting_device = 1; 3363 res->resetting_device = 1;
3350 3364 scmd_printk(KERN_ERR, scsi_cmd, "Resetting device\n");
3351 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); 3365 rc = ipr_device_reset(ioa_cfg, res);
3352
3353 ipr_cmd->ioarcb.res_handle = res->cfgte.res_handle;
3354 cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt;
3355 cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
3356 cmd_pkt->cdb[0] = IPR_RESET_DEVICE;
3357
3358 ipr_sdev_err(scsi_cmd->device, "Resetting device\n");
3359 ipr_send_blocking_cmd(ipr_cmd, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT);
3360
3361 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
3362
3363 res->resetting_device = 0; 3366 res->resetting_device = 0;
3364 3367
3365 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
3366
3367 LEAVE; 3368 LEAVE;
3368 return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS); 3369 return (rc ? FAILED : SUCCESS);
3369} 3370}
3370 3371
3371static int ipr_eh_dev_reset(struct scsi_cmnd * cmd) 3372static int ipr_eh_dev_reset(struct scsi_cmnd * cmd)
@@ -3440,7 +3441,7 @@ static void ipr_abort_timeout(struct ipr_cmnd *ipr_cmd)
3440 return; 3441 return;
3441 } 3442 }
3442 3443
3443 ipr_sdev_err(ipr_cmd->u.sdev, "Abort timed out. Resetting bus\n"); 3444 sdev_printk(KERN_ERR, ipr_cmd->u.sdev, "Abort timed out. Resetting bus.\n");
3444 reset_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); 3445 reset_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
3445 ipr_cmd->sibling = reset_cmd; 3446 ipr_cmd->sibling = reset_cmd;
3446 reset_cmd->sibling = ipr_cmd; 3447 reset_cmd->sibling = ipr_cmd;
@@ -3504,7 +3505,8 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
3504 cmd_pkt->cdb[0] = IPR_CANCEL_ALL_REQUESTS; 3505 cmd_pkt->cdb[0] = IPR_CANCEL_ALL_REQUESTS;
3505 ipr_cmd->u.sdev = scsi_cmd->device; 3506 ipr_cmd->u.sdev = scsi_cmd->device;
3506 3507
3507 ipr_sdev_err(scsi_cmd->device, "Aborting command: %02X\n", scsi_cmd->cmnd[0]); 3508 scmd_printk(KERN_ERR, scsi_cmd, "Aborting command: %02X\n",
3509 scsi_cmd->cmnd[0]);
3508 ipr_send_blocking_cmd(ipr_cmd, ipr_abort_timeout, IPR_CANCEL_ALL_TIMEOUT); 3510 ipr_send_blocking_cmd(ipr_cmd, ipr_abort_timeout, IPR_CANCEL_ALL_TIMEOUT);
3509 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); 3511 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
3510 3512
@@ -3815,8 +3817,8 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
3815 3817
3816 if (IPR_IOASC_SENSE_KEY(ioasc) > 0) { 3818 if (IPR_IOASC_SENSE_KEY(ioasc) > 0) {
3817 scsi_cmd->result |= (DID_ERROR << 16); 3819 scsi_cmd->result |= (DID_ERROR << 16);
3818 ipr_sdev_err(scsi_cmd->device, 3820 scmd_printk(KERN_ERR, scsi_cmd,
3819 "Request Sense failed with IOASC: 0x%08X\n", ioasc); 3821 "Request Sense failed with IOASC: 0x%08X\n", ioasc);
3820 } else { 3822 } else {
3821 memcpy(scsi_cmd->sense_buffer, ipr_cmd->sense_buffer, 3823 memcpy(scsi_cmd->sense_buffer, ipr_cmd->sense_buffer,
3822 SCSI_SENSE_BUFFERSIZE); 3824 SCSI_SENSE_BUFFERSIZE);
@@ -3938,6 +3940,7 @@ static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
3938 * ipr_dump_ioasa - Dump contents of IOASA 3940 * ipr_dump_ioasa - Dump contents of IOASA
3939 * @ioa_cfg: ioa config struct 3941 * @ioa_cfg: ioa config struct
3940 * @ipr_cmd: ipr command struct 3942 * @ipr_cmd: ipr command struct
3943 * @res: resource entry struct
3941 * 3944 *
3942 * This function is invoked by the interrupt handler when ops 3945 * This function is invoked by the interrupt handler when ops
3943 * fail. It will log the IOASA if appropriate. Only called 3946 * fail. It will log the IOASA if appropriate. Only called
@@ -3947,7 +3950,7 @@ static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
3947 * none 3950 * none
3948 **/ 3951 **/
3949static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg, 3952static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
3950 struct ipr_cmnd *ipr_cmd) 3953 struct ipr_cmnd *ipr_cmd, struct ipr_resource_entry *res)
3951{ 3954{
3952 int i; 3955 int i;
3953 u16 data_len; 3956 u16 data_len;
@@ -3975,16 +3978,7 @@ static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
3975 return; 3978 return;
3976 } 3979 }
3977 3980
3978 ipr_sdev_err(ipr_cmd->scsi_cmd->device, "%s\n", 3981 ipr_res_err(ioa_cfg, res, "%s\n", ipr_error_table[error_index].error);
3979 ipr_error_table[error_index].error);
3980
3981 if ((ioasa->u.gpdd.end_state <= ARRAY_SIZE(ipr_gpdd_dev_end_states)) &&
3982 (ioasa->u.gpdd.bus_phase <= ARRAY_SIZE(ipr_gpdd_dev_bus_phases))) {
3983 ipr_sdev_err(ipr_cmd->scsi_cmd->device,
3984 "Device End state: %s Phase: %s\n",
3985 ipr_gpdd_dev_end_states[ioasa->u.gpdd.end_state],
3986 ipr_gpdd_dev_bus_phases[ioasa->u.gpdd.bus_phase]);
3987 }
3988 3982
3989 if (sizeof(struct ipr_ioasa) < be16_to_cpu(ioasa->ret_stat_len)) 3983 if (sizeof(struct ipr_ioasa) < be16_to_cpu(ioasa->ret_stat_len))
3990 data_len = sizeof(struct ipr_ioasa); 3984 data_len = sizeof(struct ipr_ioasa);
@@ -4141,7 +4135,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
4141 } 4135 }
4142 4136
4143 if (ipr_is_gscsi(res)) 4137 if (ipr_is_gscsi(res))
4144 ipr_dump_ioasa(ioa_cfg, ipr_cmd); 4138 ipr_dump_ioasa(ioa_cfg, ipr_cmd, res);
4145 else 4139 else
4146 ipr_gen_sense(ipr_cmd); 4140 ipr_gen_sense(ipr_cmd);
4147 4141
@@ -4540,7 +4534,7 @@ static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
4540 ipr_cmd->job_step = ipr_ioa_reset_done; 4534 ipr_cmd->job_step = ipr_ioa_reset_done;
4541 4535
4542 list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) { 4536 list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) {
4543 if (!IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data)) 4537 if (!ipr_is_scsi_disk(res))
4544 continue; 4538 continue;
4545 4539
4546 ipr_cmd->u.res = res; 4540 ipr_cmd->u.res = res;
@@ -4980,7 +4974,7 @@ static int ipr_init_res_table(struct ipr_cmnd *ipr_cmd)
4980 list_for_each_entry_safe(res, temp, &old_res, queue) { 4974 list_for_each_entry_safe(res, temp, &old_res, queue) {
4981 if (res->sdev) { 4975 if (res->sdev) {
4982 res->del_from_ml = 1; 4976 res->del_from_ml = 1;
4983 res->sdev->hostdata = NULL; 4977 res->cfgte.res_handle = IPR_INVALID_RES_HANDLE;
4984 list_move_tail(&res->queue, &ioa_cfg->used_res_q); 4978 list_move_tail(&res->queue, &ioa_cfg->used_res_q);
4985 } else { 4979 } else {
4986 list_move_tail(&res->queue, &ioa_cfg->free_res_q); 4980 list_move_tail(&res->queue, &ioa_cfg->free_res_q);
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index fd360bfe56dd..1ad24df69d70 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -36,8 +36,8 @@
36/* 36/*
37 * Literals 37 * Literals
38 */ 38 */
39#define IPR_DRIVER_VERSION "2.1.2" 39#define IPR_DRIVER_VERSION "2.1.3"
40#define IPR_DRIVER_DATE "(February 8, 2006)" 40#define IPR_DRIVER_DATE "(March 29, 2006)"
41 41
42/* 42/*
43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -133,6 +133,7 @@
133#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8)) 133#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8))
134 134
135#define IPR_IOA_RES_HANDLE 0xffffffff 135#define IPR_IOA_RES_HANDLE 0xffffffff
136#define IPR_INVALID_RES_HANDLE 0
136#define IPR_IOA_RES_ADDR 0x00ffffff 137#define IPR_IOA_RES_ADDR 0x00ffffff
137 138
138/* 139/*
@@ -1191,30 +1192,17 @@ struct ipr_ucode_image_header {
1191 */ 1192 */
1192#define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__) 1193#define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__)
1193#define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__) 1194#define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)
1194#define ipr_crit(...) printk(KERN_CRIT IPR_NAME ": "__VA_ARGS__)
1195#define ipr_warn(...) printk(KERN_WARNING IPR_NAME": "__VA_ARGS__)
1196#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)) 1195#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))
1197 1196
1198#define ipr_sdev_printk(level, sdev, fmt, args...) \ 1197#define ipr_ra_printk(level, ioa_cfg, ra, fmt, ...) \
1199 sdev_printk(level, sdev, fmt, ## args) 1198 printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, (ioa_cfg)->host->host_no, \
1199 (ra).bus, (ra).target, (ra).lun, ##__VA_ARGS__)
1200 1200
1201#define ipr_sdev_err(sdev, fmt, ...) \ 1201#define ipr_ra_err(ioa_cfg, ra, fmt, ...) \
1202 ipr_sdev_printk(KERN_ERR, sdev, fmt, ##__VA_ARGS__) 1202 ipr_ra_printk(KERN_ERR, ioa_cfg, ra, fmt, ##__VA_ARGS__)
1203
1204#define ipr_sdev_info(sdev, fmt, ...) \
1205 ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__)
1206
1207#define ipr_sdev_dbg(sdev, fmt, ...) \
1208 IPR_DBG_CMD(ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__))
1209
1210#define ipr_res_printk(level, ioa_cfg, res, fmt, ...) \
1211 printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, ioa_cfg->host->host_no, \
1212 res.bus, res.target, res.lun, ##__VA_ARGS__)
1213 1203
1214#define ipr_res_err(ioa_cfg, res, fmt, ...) \ 1204#define ipr_res_err(ioa_cfg, res, fmt, ...) \
1215 ipr_res_printk(KERN_ERR, ioa_cfg, res, fmt, ##__VA_ARGS__) 1205 ipr_ra_err(ioa_cfg, (res)->cfgte.res_addr, fmt, ##__VA_ARGS__)
1216#define ipr_res_dbg(ioa_cfg, res, fmt, ...) \
1217 IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__))
1218 1206
1219#define ipr_phys_res_err(ioa_cfg, res, fmt, ...) \ 1207#define ipr_phys_res_err(ioa_cfg, res, fmt, ...) \
1220{ \ 1208{ \
@@ -1304,6 +1292,22 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
1304} 1292}
1305 1293
1306/** 1294/**
1295 * ipr_is_scsi_disk - Determine if a resource is a SCSI disk
1296 * @res: resource entry struct
1297 *
1298 * Return value:
1299 * 1 if SCSI disk / 0 if not SCSI disk
1300 **/
1301static inline int ipr_is_scsi_disk(struct ipr_resource_entry *res)
1302{
1303 if (ipr_is_af_dasd_device(res) ||
1304 (ipr_is_gscsi(res) && IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data)))
1305 return 1;
1306 else
1307 return 0;
1308}
1309
1310/**
1307 * ipr_is_naca_model - Determine if a resource is using NACA queueing model 1311 * ipr_is_naca_model - Determine if a resource is using NACA queueing model
1308 * @res: resource entry struct 1312 * @res: resource entry struct
1309 * 1313 *
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index e63c1ff1e102..bd147207f25d 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4938,7 +4938,6 @@ EXPORT_SYMBOL_GPL(ata_busy_sleep);
4938EXPORT_SYMBOL_GPL(ata_port_queue_task); 4938EXPORT_SYMBOL_GPL(ata_port_queue_task);
4939EXPORT_SYMBOL_GPL(ata_scsi_ioctl); 4939EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
4940EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 4940EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
4941EXPORT_SYMBOL_GPL(ata_scsi_error);
4942EXPORT_SYMBOL_GPL(ata_scsi_slave_config); 4941EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
4943EXPORT_SYMBOL_GPL(ata_scsi_release); 4942EXPORT_SYMBOL_GPL(ata_scsi_release);
4944EXPORT_SYMBOL_GPL(ata_host_intr); 4943EXPORT_SYMBOL_GPL(ata_host_intr);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 53f5b0d9161c..a0289ec3e283 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -53,6 +53,7 @@
53typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd); 53typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
54static struct ata_device * 54static struct ata_device *
55ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev); 55ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
56static void ata_scsi_error(struct Scsi_Host *host);
56enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd); 57enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd);
57 58
58#define RW_RECOVERY_MPAGE 0x1 59#define RW_RECOVERY_MPAGE 0x1
@@ -99,6 +100,7 @@ static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {
99 * It just needs the eh_timed_out hook. 100 * It just needs the eh_timed_out hook.
100 */ 101 */
101struct scsi_transport_template ata_scsi_transport_template = { 102struct scsi_transport_template ata_scsi_transport_template = {
103 .eh_strategy_handler = ata_scsi_error,
102 .eh_timed_out = ata_scsi_timed_out, 104 .eh_timed_out = ata_scsi_timed_out,
103}; 105};
104 106
@@ -772,12 +774,9 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
772 * 774 *
773 * LOCKING: 775 * LOCKING:
774 * Inherited from SCSI layer (none, can sleep) 776 * Inherited from SCSI layer (none, can sleep)
775 *
776 * RETURNS:
777 * Zero.
778 */ 777 */
779 778
780int ata_scsi_error(struct Scsi_Host *host) 779static void ata_scsi_error(struct Scsi_Host *host)
781{ 780{
782 struct ata_port *ap; 781 struct ata_port *ap;
783 unsigned long flags; 782 unsigned long flags;
@@ -805,7 +804,6 @@ int ata_scsi_error(struct Scsi_Host *host)
805 spin_unlock_irqrestore(&ap->host_set->lock, flags); 804 spin_unlock_irqrestore(&ap->host_set->lock, flags);
806 805
807 DPRINTK("EXIT\n"); 806 DPRINTK("EXIT\n");
808 return 0;
809} 807}
810 808
811static void ata_eh_scsidone(struct scsi_cmnd *scmd) 809static void ata_eh_scsidone(struct scsi_cmnd *scmd)
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 1c755b14521a..bac8cbae06fe 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -60,7 +60,6 @@ extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
60extern struct scsi_transport_template ata_scsi_transport_template; 60extern struct scsi_transport_template ata_scsi_transport_template;
61 61
62extern void ata_scsi_scan_host(struct ata_port *ap); 62extern void ata_scsi_scan_host(struct ata_port *ap);
63extern int ata_scsi_error(struct Scsi_Host *host);
64extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 63extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
65 unsigned int buflen); 64 unsigned int buflen);
66 65
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 3c85c4b66e19..5cda16cfacb0 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -143,7 +143,6 @@ static struct scsi_host_template adma_ata_sht = {
143 .name = DRV_NAME, 143 .name = DRV_NAME,
144 .ioctl = ata_scsi_ioctl, 144 .ioctl = ata_scsi_ioctl,
145 .queuecommand = ata_scsi_queuecmd, 145 .queuecommand = ata_scsi_queuecmd,
146 .eh_strategy_handler = ata_scsi_error,
147 .can_queue = ATA_DEF_QUEUE, 146 .can_queue = ATA_DEF_QUEUE,
148 .this_id = ATA_SHT_THIS_ID, 147 .this_id = ATA_SHT_THIS_ID,
149 .sg_tablesize = LIBATA_MAX_PRD, 148 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
deleted file mode 100644
index 52b224a5d6fd..000000000000
--- a/drivers/scsi/qlogicfc.c
+++ /dev/null
@@ -1,2228 +0,0 @@
1/*
2 * QLogic ISP2x00 SCSI-FCP
3 * Written by Erik H. Moe, ehm@cris.com
4 * Copyright 1995, Erik H. Moe
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16
17/* Renamed and updated to 1.3.x by Michael Griffith <grif@cs.ucr.edu> */
18
19/* This is a version of the isp1020 driver which was modified by
20 * Chris Loveland <cwl@iol.unh.edu> to support the isp2100 and isp2200
21 *
22 * Big endian support and dynamic DMA mapping added
23 * by Jakub Jelinek <jakub@redhat.com>.
24 *
25 * Conversion to final pci64 DMA interfaces
26 * by David S. Miller <davem@redhat.com>.
27 */
28
29/*
30 * $Date: 1995/09/22 02:23:15 $
31 * $Revision: 0.5 $
32 *
33 * $Log: isp1020.c,v $
34 * Revision 0.5 1995/09/22 02:23:15 root
35 * do auto request sense
36 *
37 * Revision 0.4 1995/08/07 04:44:33 root
38 * supply firmware with driver.
39 * numerous bug fixes/general cleanup of code.
40 *
41 * Revision 0.3 1995/07/16 16:15:39 root
42 * added reset/abort code.
43 *
44 * Revision 0.2 1995/06/29 03:14:19 root
45 * fixed biosparam.
46 * added queue protocol.
47 *
48 * Revision 0.1 1995/06/25 01:55:45 root
49 * Initial release.
50 *
51 */
52
53#include <linux/blkdev.h>
54#include <linux/kernel.h>
55#include <linux/string.h>
56#include <linux/ioport.h>
57#include <linux/sched.h>
58#include <linux/types.h>
59#include <linux/pci.h>
60#include <linux/delay.h>
61#include <linux/unistd.h>
62#include <linux/spinlock.h>
63#include <linux/interrupt.h>
64#include <linux/dma-mapping.h>
65#include <linux/jiffies.h>
66#include <asm/io.h>
67#include <asm/irq.h>
68#include "scsi.h"
69#include <scsi/scsi_host.h>
70
71#define pci64_dma_hi32(a) ((u32) (0xffffffff & (((u64)(a))>>32)))
72#define pci64_dma_lo32(a) ((u32) (0xffffffff & (((u64)(a)))))
73#define pci64_dma_build(hi,lo) \
74 ((dma_addr_t)(((u64)(lo))|(((u64)(hi))<<32)))
75
76/*
77 * With the qlogic interface, every queue slot can hold a SCSI
78 * command with up to 2 scatter/gather entries. If we need more
79 * than 2 entries, continuation entries can be used that hold
80 * another 5 entries each. Unlike for other drivers, this means
81 * that the maximum number of scatter/gather entries we can
82 * support at any given time is a function of the number of queue
83 * slots available. That is, host->can_queue and host->sg_tablesize
84 * are dynamic and _not_ independent. This all works fine because
85 * requests are queued serially and the scatter/gather limit is
86 * determined for each queue request anew.
87 */
88
89#define DATASEGS_PER_COMMAND 2
90#define DATASEGS_PER_CONT 5
91
92#define QLOGICFC_REQ_QUEUE_LEN 255 /* must be power of two - 1 */
93#define QLOGICFC_MAX_SG(ql) (DATASEGS_PER_COMMAND + (((ql) > 0) ? DATASEGS_PER_CONT*((ql) - 1) : 0))
94#define QLOGICFC_CMD_PER_LUN 8
95
96/* Configuration section **************************************************** */
97
98/* Set the following macro to 1 to reload the ISP2x00's firmware. This is
99 version 1.17.30 of the isp2100's firmware and version 2.00.40 of the
100 isp2200's firmware.
101*/
102
103#define USE_NVRAM_DEFAULTS 1
104
105#define ISP2x00_PORTDB 1
106
107/* Set the following to 1 to include fabric support, fabric support is
108 * currently not as well tested as the other aspects of the driver */
109
110#define ISP2x00_FABRIC 1
111
112/* Macros used for debugging */
113#define DEBUG_ISP2x00 0
114#define DEBUG_ISP2x00_INT 0
115#define DEBUG_ISP2x00_INTR 0
116#define DEBUG_ISP2x00_SETUP 0
117#define DEBUG_ISP2x00_FABRIC 0
118#define TRACE_ISP 0
119
120
121#define DEFAULT_LOOP_COUNT 1000000000
122
123#define ISP_TIMEOUT (2*HZ)
124/* End Configuration section ************************************************ */
125
126#include <linux/module.h>
127
128#if TRACE_ISP
129
130#define TRACE_BUF_LEN (32*1024)
131
132struct {
133 u_long next;
134 struct {
135 u_long time;
136 u_int index;
137 u_int addr;
138 u_char *name;
139 } buf[TRACE_BUF_LEN];
140} trace;
141
142#define TRACE(w, i, a) \
143{ \
144 unsigned long flags; \
145 \
146 save_flags(flags); \
147 cli(); \
148 trace.buf[trace.next].name = (w); \
149 trace.buf[trace.next].time = jiffies; \
150 trace.buf[trace.next].index = (i); \
151 trace.buf[trace.next].addr = (long) (a); \
152 trace.next = (trace.next + 1) & (TRACE_BUF_LEN - 1); \
153 restore_flags(flags); \
154}
155
156#else
157#define TRACE(w, i, a)
158#endif
159
160#if DEBUG_ISP2x00_FABRIC
161#define DEBUG_FABRIC(x) x
162#else
163#define DEBUG_FABRIC(x)
164#endif /* DEBUG_ISP2x00_FABRIC */
165
166
167#if DEBUG_ISP2x00
168#define ENTER(x) printk("isp2x00 : entering %s()\n", x);
169#define LEAVE(x) printk("isp2x00 : leaving %s()\n", x);
170#define DEBUG(x) x
171#else
172#define ENTER(x)
173#define LEAVE(x)
174#define DEBUG(x)
175#endif /* DEBUG_ISP2x00 */
176
177#if DEBUG_ISP2x00_INTR
178#define ENTER_INTR(x) printk("isp2x00 : entering %s()\n", x);
179#define LEAVE_INTR(x) printk("isp2x00 : leaving %s()\n", x);
180#define DEBUG_INTR(x) x
181#else
182#define ENTER_INTR(x)
183#define LEAVE_INTR(x)
184#define DEBUG_INTR(x)
185#endif /* DEBUG ISP2x00_INTR */
186
187
188#define ISP2100_REV_ID1 1
189#define ISP2100_REV_ID3 3
190#define ISP2200_REV_ID5 5
191
192/* host configuration and control registers */
193#define HOST_HCCR 0xc0 /* host command and control */
194
195/* pci bus interface registers */
196#define FLASH_BIOS_ADDR 0x00
197#define FLASH_BIOS_DATA 0x02
198#define ISP_CTRL_STATUS 0x06 /* configuration register #1 */
199#define PCI_INTER_CTL 0x08 /* pci interrupt control */
200#define PCI_INTER_STS 0x0a /* pci interrupt status */
201#define PCI_SEMAPHORE 0x0c /* pci semaphore */
202#define PCI_NVRAM 0x0e /* pci nvram interface */
203
204/* mailbox registers */
205#define MBOX0 0x10 /* mailbox 0 */
206#define MBOX1 0x12 /* mailbox 1 */
207#define MBOX2 0x14 /* mailbox 2 */
208#define MBOX3 0x16 /* mailbox 3 */
209#define MBOX4 0x18 /* mailbox 4 */
210#define MBOX5 0x1a /* mailbox 5 */
211#define MBOX6 0x1c /* mailbox 6 */
212#define MBOX7 0x1e /* mailbox 7 */
213
214/* mailbox command complete status codes */
215#define MBOX_COMMAND_COMPLETE 0x4000
216#define INVALID_COMMAND 0x4001
217#define HOST_INTERFACE_ERROR 0x4002
218#define TEST_FAILED 0x4003
219#define COMMAND_ERROR 0x4005
220#define COMMAND_PARAM_ERROR 0x4006
221#define PORT_ID_USED 0x4007
222#define LOOP_ID_USED 0x4008
223#define ALL_IDS_USED 0x4009
224
225/* async event status codes */
226#define RESET_DETECTED 0x8001
227#define SYSTEM_ERROR 0x8002
228#define REQUEST_TRANSFER_ERROR 0x8003
229#define RESPONSE_TRANSFER_ERROR 0x8004
230#define REQUEST_QUEUE_WAKEUP 0x8005
231#define LIP_OCCURRED 0x8010
232#define LOOP_UP 0x8011
233#define LOOP_DOWN 0x8012
234#define LIP_RECEIVED 0x8013
235#define PORT_DB_CHANGED 0x8014
236#define CHANGE_NOTIFICATION 0x8015
237#define SCSI_COMMAND_COMPLETE 0x8020
238#define POINT_TO_POINT_UP 0x8030
239#define CONNECTION_MODE 0x8036
240
241struct Entry_header {
242 u_char entry_type;
243 u_char entry_cnt;
244 u_char sys_def_1;
245 u_char flags;
246};
247
248/* entry header type commands */
249#define ENTRY_COMMAND 0x19
250#define ENTRY_CONTINUATION 0x0a
251
252#define ENTRY_STATUS 0x03
253#define ENTRY_MARKER 0x04
254
255
256/* entry header flag definitions */
257#define EFLAG_BUSY 2
258#define EFLAG_BAD_HEADER 4
259#define EFLAG_BAD_PAYLOAD 8
260
261struct dataseg {
262 u_int d_base;
263 u_int d_base_hi;
264 u_int d_count;
265};
266
267struct Command_Entry {
268 struct Entry_header hdr;
269 u_int handle;
270 u_char target_lun;
271 u_char target_id;
272 u_short expanded_lun;
273 u_short control_flags;
274 u_short rsvd2;
275 u_short time_out;
276 u_short segment_cnt;
277 u_char cdb[16];
278 u_int total_byte_cnt;
279 struct dataseg dataseg[DATASEGS_PER_COMMAND];
280};
281
282/* command entry control flag definitions */
283#define CFLAG_NODISC 0x01
284#define CFLAG_HEAD_TAG 0x02
285#define CFLAG_ORDERED_TAG 0x04
286#define CFLAG_SIMPLE_TAG 0x08
287#define CFLAG_TAR_RTN 0x10
288#define CFLAG_READ 0x20
289#define CFLAG_WRITE 0x40
290
291struct Continuation_Entry {
292 struct Entry_header hdr;
293 struct dataseg dataseg[DATASEGS_PER_CONT];
294};
295
296struct Marker_Entry {
297 struct Entry_header hdr;
298 u_int reserved;
299 u_char target_lun;
300 u_char target_id;
301 u_char modifier;
302 u_char expanded_lun;
303 u_char rsvds[52];
304};
305
306/* marker entry modifier definitions */
307#define SYNC_DEVICE 0
308#define SYNC_TARGET 1
309#define SYNC_ALL 2
310
311struct Status_Entry {
312 struct Entry_header hdr;
313 u_int handle;
314 u_short scsi_status;
315 u_short completion_status;
316 u_short state_flags;
317 u_short status_flags;
318 u_short res_info_len;
319 u_short req_sense_len;
320 u_int residual;
321 u_char res_info[8];
322 u_char req_sense_data[32];
323};
324
325/* status entry completion status definitions */
326#define CS_COMPLETE 0x0000
327#define CS_DMA_ERROR 0x0002
328#define CS_RESET_OCCURRED 0x0004
329#define CS_ABORTED 0x0005
330#define CS_TIMEOUT 0x0006
331#define CS_DATA_OVERRUN 0x0007
332#define CS_DATA_UNDERRUN 0x0015
333#define CS_QUEUE_FULL 0x001c
334#define CS_PORT_UNAVAILABLE 0x0028
335#define CS_PORT_LOGGED_OUT 0x0029
336#define CS_PORT_CONFIG_CHANGED 0x002a
337
338/* status entry state flag definitions */
339#define SF_SENT_CDB 0x0400
340#define SF_TRANSFERRED_DATA 0x0800
341#define SF_GOT_STATUS 0x1000
342
343/* status entry status flag definitions */
344#define STF_BUS_RESET 0x0008
345#define STF_DEVICE_RESET 0x0010
346#define STF_ABORTED 0x0020
347#define STF_TIMEOUT 0x0040
348
349/* interrupt control commands */
350#define ISP_EN_INT 0x8000
351#define ISP_EN_RISC 0x0008
352
353/* host control commands */
354#define HCCR_NOP 0x0000
355#define HCCR_RESET 0x1000
356#define HCCR_PAUSE 0x2000
357#define HCCR_RELEASE 0x3000
358#define HCCR_SINGLE_STEP 0x4000
359#define HCCR_SET_HOST_INTR 0x5000
360#define HCCR_CLEAR_HOST_INTR 0x6000
361#define HCCR_CLEAR_RISC_INTR 0x7000
362#define HCCR_BP_ENABLE 0x8000
363#define HCCR_BIOS_DISABLE 0x9000
364#define HCCR_TEST_MODE 0xf000
365
366#define RISC_BUSY 0x0004
367
368/* mailbox commands */
369#define MBOX_NO_OP 0x0000
370#define MBOX_LOAD_RAM 0x0001
371#define MBOX_EXEC_FIRMWARE 0x0002
372#define MBOX_DUMP_RAM 0x0003
373#define MBOX_WRITE_RAM_WORD 0x0004
374#define MBOX_READ_RAM_WORD 0x0005
375#define MBOX_MAILBOX_REG_TEST 0x0006
376#define MBOX_VERIFY_CHECKSUM 0x0007
377#define MBOX_ABOUT_FIRMWARE 0x0008
378#define MBOX_LOAD_RISC_RAM 0x0009
379#define MBOX_DUMP_RISC_RAM 0x000a
380#define MBOX_CHECK_FIRMWARE 0x000e
381#define MBOX_INIT_REQ_QUEUE 0x0010
382#define MBOX_INIT_RES_QUEUE 0x0011
383#define MBOX_EXECUTE_IOCB 0x0012
384#define MBOX_WAKE_UP 0x0013
385#define MBOX_STOP_FIRMWARE 0x0014
386#define MBOX_ABORT_IOCB 0x0015
387#define MBOX_ABORT_DEVICE 0x0016
388#define MBOX_ABORT_TARGET 0x0017
389#define MBOX_BUS_RESET 0x0018
390#define MBOX_STOP_QUEUE 0x0019
391#define MBOX_START_QUEUE 0x001a
392#define MBOX_SINGLE_STEP_QUEUE 0x001b
393#define MBOX_ABORT_QUEUE 0x001c
394#define MBOX_GET_DEV_QUEUE_STATUS 0x001d
395#define MBOX_GET_FIRMWARE_STATUS 0x001f
396#define MBOX_GET_INIT_SCSI_ID 0x0020
397#define MBOX_GET_RETRY_COUNT 0x0022
398#define MBOX_GET_TARGET_PARAMS 0x0028
399#define MBOX_GET_DEV_QUEUE_PARAMS 0x0029
400#define MBOX_SET_RETRY_COUNT 0x0032
401#define MBOX_SET_TARGET_PARAMS 0x0038
402#define MBOX_SET_DEV_QUEUE_PARAMS 0x0039
403#define MBOX_EXECUTE_IOCB64 0x0054
404#define MBOX_INIT_FIRMWARE 0x0060
405#define MBOX_GET_INIT_CB 0x0061
406#define MBOX_INIT_LIP 0x0062
407#define MBOX_GET_POS_MAP 0x0063
408#define MBOX_GET_PORT_DB 0x0064
409#define MBOX_CLEAR_ACA 0x0065
410#define MBOX_TARGET_RESET 0x0066
411#define MBOX_CLEAR_TASK_SET 0x0067
412#define MBOX_ABORT_TASK_SET 0x0068
413#define MBOX_GET_FIRMWARE_STATE 0x0069
414#define MBOX_GET_PORT_NAME 0x006a
415#define MBOX_SEND_SNS 0x006e
416#define MBOX_PORT_LOGIN 0x006f
417#define MBOX_SEND_CHANGE_REQUEST 0x0070
418#define MBOX_PORT_LOGOUT 0x0071
419
420/*
421 * Firmware if needed (note this is a hack, it belongs in a separate
422 * module.
423 */
424
425#ifdef CONFIG_SCSI_QLOGIC_FC_FIRMWARE
426#include "qlogicfc_asm.c"
427#else
428static unsigned short risc_code_addr01 = 0x1000 ;
429#endif
430
431/* Each element in mbox_param is an 8 bit bitmap where each bit indicates
432 if that mbox should be copied as input. For example 0x2 would mean
433 only copy mbox1. */
434
435static const u_char mbox_param[] =
436{
437 0x01, /* MBOX_NO_OP */
438 0x1f, /* MBOX_LOAD_RAM */
439 0x03, /* MBOX_EXEC_FIRMWARE */
440 0x1f, /* MBOX_DUMP_RAM */
441 0x07, /* MBOX_WRITE_RAM_WORD */
442 0x03, /* MBOX_READ_RAM_WORD */
443 0xff, /* MBOX_MAILBOX_REG_TEST */
444 0x03, /* MBOX_VERIFY_CHECKSUM */
445 0x01, /* MBOX_ABOUT_FIRMWARE */
446 0xff, /* MBOX_LOAD_RISC_RAM */
447 0xff, /* MBOX_DUMP_RISC_RAM */
448 0x00, /* 0x000b */
449 0x00, /* 0x000c */
450 0x00, /* 0x000d */
451 0x01, /* MBOX_CHECK_FIRMWARE */
452 0x00, /* 0x000f */
453 0x1f, /* MBOX_INIT_REQ_QUEUE */
454 0x2f, /* MBOX_INIT_RES_QUEUE */
455 0x0f, /* MBOX_EXECUTE_IOCB */
456 0x03, /* MBOX_WAKE_UP */
457 0x01, /* MBOX_STOP_FIRMWARE */
458 0x0f, /* MBOX_ABORT_IOCB */
459 0x03, /* MBOX_ABORT_DEVICE */
460 0x07, /* MBOX_ABORT_TARGET */
461 0x03, /* MBOX_BUS_RESET */
462 0x03, /* MBOX_STOP_QUEUE */
463 0x03, /* MBOX_START_QUEUE */
464 0x03, /* MBOX_SINGLE_STEP_QUEUE */
465 0x03, /* MBOX_ABORT_QUEUE */
466 0x03, /* MBOX_GET_DEV_QUEUE_STATUS */
467 0x00, /* 0x001e */
468 0x01, /* MBOX_GET_FIRMWARE_STATUS */
469 0x01, /* MBOX_GET_INIT_SCSI_ID */
470 0x00, /* 0x0021 */
471 0x01, /* MBOX_GET_RETRY_COUNT */
472 0x00, /* 0x0023 */
473 0x00, /* 0x0024 */
474 0x00, /* 0x0025 */
475 0x00, /* 0x0026 */
476 0x00, /* 0x0027 */
477 0x03, /* MBOX_GET_TARGET_PARAMS */
478 0x03, /* MBOX_GET_DEV_QUEUE_PARAMS */
479 0x00, /* 0x002a */
480 0x00, /* 0x002b */
481 0x00, /* 0x002c */
482 0x00, /* 0x002d */
483 0x00, /* 0x002e */
484 0x00, /* 0x002f */
485 0x00, /* 0x0030 */
486 0x00, /* 0x0031 */
487 0x07, /* MBOX_SET_RETRY_COUNT */
488 0x00, /* 0x0033 */
489 0x00, /* 0x0034 */
490 0x00, /* 0x0035 */
491 0x00, /* 0x0036 */
492 0x00, /* 0x0037 */
493 0x0f, /* MBOX_SET_TARGET_PARAMS */
494 0x0f, /* MBOX_SET_DEV_QUEUE_PARAMS */
495 0x00, /* 0x003a */
496 0x00, /* 0x003b */
497 0x00, /* 0x003c */
498 0x00, /* 0x003d */
499 0x00, /* 0x003e */
500 0x00, /* 0x003f */
501 0x00, /* 0x0040 */
502 0x00, /* 0x0041 */
503 0x00, /* 0x0042 */
504 0x00, /* 0x0043 */
505 0x00, /* 0x0044 */
506 0x00, /* 0x0045 */
507 0x00, /* 0x0046 */
508 0x00, /* 0x0047 */
509 0x00, /* 0x0048 */
510 0x00, /* 0x0049 */
511 0x00, /* 0x004a */
512 0x00, /* 0x004b */
513 0x00, /* 0x004c */
514 0x00, /* 0x004d */
515 0x00, /* 0x004e */
516 0x00, /* 0x004f */
517 0x00, /* 0x0050 */
518 0x00, /* 0x0051 */
519 0x00, /* 0x0052 */
520 0x00, /* 0x0053 */
521 0xcf, /* MBOX_EXECUTE_IOCB64 */
522 0x00, /* 0x0055 */
523 0x00, /* 0x0056 */
524 0x00, /* 0x0057 */
525 0x00, /* 0x0058 */
526 0x00, /* 0x0059 */
527 0x00, /* 0x005a */
528 0x00, /* 0x005b */
529 0x00, /* 0x005c */
530 0x00, /* 0x005d */
531 0x00, /* 0x005e */
532 0x00, /* 0x005f */
533 0xff, /* MBOX_INIT_FIRMWARE */
534 0xcd, /* MBOX_GET_INIT_CB */
535 0x01, /* MBOX_INIT_LIP */
536 0xcd, /* MBOX_GET_POS_MAP */
537 0xcf, /* MBOX_GET_PORT_DB */
538 0x03, /* MBOX_CLEAR_ACA */
539 0x03, /* MBOX_TARGET_RESET */
540 0x03, /* MBOX_CLEAR_TASK_SET */
541 0x03, /* MBOX_ABORT_TASK_SET */
542 0x01, /* MBOX_GET_FIRMWARE_STATE */
543 0x03, /* MBOX_GET_PORT_NAME */
544 0x00, /* 0x006b */
545 0x00, /* 0x006c */
546 0x00, /* 0x006d */
547 0xcf, /* MBOX_SEND_SNS */
548 0x0f, /* MBOX_PORT_LOGIN */
549 0x03, /* MBOX_SEND_CHANGE_REQUEST */
550 0x03, /* MBOX_PORT_LOGOUT */
551};
552
553#define MAX_MBOX_COMMAND (sizeof(mbox_param)/sizeof(u_short))
554
555
556struct id_name_map {
557 u64 wwn;
558 u_char loop_id;
559};
560
561struct sns_cb {
562 u_short len;
563 u_short res1;
564 u_int response_low;
565 u_int response_high;
566 u_short sub_len;
567 u_short res2;
568 u_char data[44];
569};
570
571/* address of instance of this struct is passed to adapter to initialize things
572 */
573struct init_cb {
574 u_char version;
575 u_char reseverd1[1];
576 u_short firm_opts;
577 u_short max_frame_len;
578 u_short max_iocb;
579 u_short exec_throttle;
580 u_char retry_cnt;
581 u_char retry_delay;
582 u_short node_name[4];
583 u_short hard_addr;
584 u_char reserved2[10];
585 u_short req_queue_out;
586 u_short res_queue_in;
587 u_short req_queue_len;
588 u_short res_queue_len;
589 u_int req_queue_addr_lo;
590 u_int req_queue_addr_high;
591 u_int res_queue_addr_lo;
592 u_int res_queue_addr_high;
593 /* the rest of this structure only applies to the isp2200 */
594 u_short lun_enables;
595 u_char cmd_resource_cnt;
596 u_char notify_resource_cnt;
597 u_short timeout;
598 u_short reserved3;
599 u_short add_firm_opts;
600 u_char res_accum_timer;
601 u_char irq_delay_timer;
602 u_short special_options;
603 u_short reserved4[13];
604};
605
606/*
607 * The result queue can be quite a bit smaller since continuation entries
608 * do not show up there:
609 */
610#define RES_QUEUE_LEN ((QLOGICFC_REQ_QUEUE_LEN + 1) / 8 - 1)
611#define QUEUE_ENTRY_LEN 64
612
613#if ISP2x00_FABRIC
614#define QLOGICFC_MAX_ID 0xff
615#else
616#define QLOGICFC_MAX_ID 0x7d
617#endif
618
619#define QLOGICFC_MAX_LUN 128
620#define QLOGICFC_MAX_LOOP_ID 0x7d
621
622/* the following connection options only apply to the 2200. i have only
623 * had success with LOOP_ONLY and P2P_ONLY.
624 */
625
626#define LOOP_ONLY 0
627#define P2P_ONLY 1
628#define LOOP_PREFERED 2
629#define P2P_PREFERED 3
630
631#define CONNECTION_PREFERENCE LOOP_ONLY
632
633/* adapter_state values */
634#define AS_FIRMWARE_DEAD -1
635#define AS_LOOP_DOWN 0
636#define AS_LOOP_GOOD 1
637#define AS_REDO_FABRIC_PORTDB 2
638#define AS_REDO_LOOP_PORTDB 4
639
640#define RES_SIZE ((RES_QUEUE_LEN + 1)*QUEUE_ENTRY_LEN)
641#define REQ_SIZE ((QLOGICFC_REQ_QUEUE_LEN + 1)*QUEUE_ENTRY_LEN)
642
643struct isp2x00_hostdata {
644 u_char revision;
645 struct pci_dev *pci_dev;
646 /* result and request queues (shared with isp2x00): */
647 u_int req_in_ptr; /* index of next request slot */
648 u_int res_out_ptr; /* index of next result slot */
649
650 /* this is here so the queues are nicely aligned */
651 long send_marker; /* do we need to send a marker? */
652
653 char * res;
654 char * req;
655 struct init_cb control_block;
656 int adapter_state;
657 unsigned long int tag_ages[QLOGICFC_MAX_ID + 1];
658 Scsi_Cmnd *handle_ptrs[QLOGICFC_REQ_QUEUE_LEN + 1];
659 unsigned long handle_serials[QLOGICFC_REQ_QUEUE_LEN + 1];
660 struct id_name_map port_db[QLOGICFC_MAX_ID + 1];
661 u_char mbox_done;
662 u64 wwn;
663 u_int port_id;
664 u_char queued;
665 u_char host_id;
666 struct timer_list explore_timer;
667 struct id_name_map tempmap[QLOGICFC_MAX_ID + 1];
668};
669
670
671/* queue length's _must_ be power of two: */
672#define QUEUE_DEPTH(in, out, ql) ((in - out) & (ql))
673#define REQ_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, \
674 QLOGICFC_REQ_QUEUE_LEN)
675#define RES_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, RES_QUEUE_LEN)
676
677static void isp2x00_enable_irqs(struct Scsi_Host *);
678static void isp2x00_disable_irqs(struct Scsi_Host *);
679static int isp2x00_init(struct Scsi_Host *);
680static int isp2x00_reset_hardware(struct Scsi_Host *);
681static int isp2x00_mbox_command(struct Scsi_Host *, u_short[]);
682static int isp2x00_return_status(Scsi_Cmnd *, struct Status_Entry *);
683static void isp2x00_intr_handler(int, void *, struct pt_regs *);
684static irqreturn_t do_isp2x00_intr_handler(int, void *, struct pt_regs *);
685static int isp2x00_make_portdb(struct Scsi_Host *);
686
687#if ISP2x00_FABRIC
688static int isp2x00_init_fabric(struct Scsi_Host *, struct id_name_map *, int);
689#endif
690
691#if USE_NVRAM_DEFAULTS
692static int isp2x00_get_nvram_defaults(struct Scsi_Host *, struct init_cb *);
693static u_short isp2x00_read_nvram_word(struct Scsi_Host *, u_short);
694#endif
695
696#if DEBUG_ISP2x00
697static void isp2x00_print_scsi_cmd(Scsi_Cmnd *);
698#endif
699
700#if DEBUG_ISP2x00_INTR
701static void isp2x00_print_status_entry(struct Status_Entry *);
702#endif
703
704static inline void isp2x00_enable_irqs(struct Scsi_Host *host)
705{
706 outw(ISP_EN_INT | ISP_EN_RISC, host->io_port + PCI_INTER_CTL);
707}
708
709
710static inline void isp2x00_disable_irqs(struct Scsi_Host *host)
711{
712 outw(0x0, host->io_port + PCI_INTER_CTL);
713}
714
715
716static int isp2x00_detect(struct scsi_host_template * tmpt)
717{
718 int hosts = 0;
719 unsigned long wait_time;
720 struct Scsi_Host *host = NULL;
721 struct isp2x00_hostdata *hostdata;
722 struct pci_dev *pdev;
723 unsigned short device_ids[2];
724 dma_addr_t busaddr;
725 int i;
726
727
728 ENTER("isp2x00_detect");
729
730 device_ids[0] = PCI_DEVICE_ID_QLOGIC_ISP2100;
731 device_ids[1] = PCI_DEVICE_ID_QLOGIC_ISP2200;
732
733 tmpt->proc_name = "isp2x00";
734
735 for (i=0; i<2; i++){
736 pdev = NULL;
737 while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, device_ids[i], pdev))) {
738 if (pci_enable_device(pdev))
739 continue;
740
741 /* Try to configure DMA attributes. */
742 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
743 pci_set_dma_mask(pdev, DMA_32BIT_MASK))
744 continue;
745
746 host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata));
747 if (!host) {
748 printk("qlogicfc%d : could not register host.\n", hosts);
749 continue;
750 }
751 host->max_id = QLOGICFC_MAX_ID + 1;
752 host->max_lun = QLOGICFC_MAX_LUN;
753 hostdata = (struct isp2x00_hostdata *) host->hostdata;
754
755 memset(hostdata, 0, sizeof(struct isp2x00_hostdata));
756 hostdata->pci_dev = pdev;
757 hostdata->res = pci_alloc_consistent(pdev, RES_SIZE + REQ_SIZE, &busaddr);
758
759 if (!hostdata->res){
760 printk("qlogicfc%d : could not allocate memory for request and response queue.\n", hosts);
761 scsi_unregister(host);
762 continue;
763 }
764 hostdata->req = hostdata->res + (RES_QUEUE_LEN + 1)*QUEUE_ENTRY_LEN;
765 hostdata->queued = 0;
766 /* set up the control block */
767 hostdata->control_block.version = 0x1;
768 hostdata->control_block.firm_opts = cpu_to_le16(0x800e);
769 hostdata->control_block.max_frame_len = cpu_to_le16(2048);
770 hostdata->control_block.max_iocb = cpu_to_le16(QLOGICFC_REQ_QUEUE_LEN);
771 hostdata->control_block.exec_throttle = cpu_to_le16(QLOGICFC_CMD_PER_LUN);
772 hostdata->control_block.retry_delay = 5;
773 hostdata->control_block.retry_cnt = 1;
774 hostdata->control_block.node_name[0] = cpu_to_le16(0x0020);
775 hostdata->control_block.node_name[1] = cpu_to_le16(0xE000);
776 hostdata->control_block.node_name[2] = cpu_to_le16(0x008B);
777 hostdata->control_block.node_name[3] = cpu_to_le16(0x0000);
778 hostdata->control_block.hard_addr = cpu_to_le16(0x0003);
779 hostdata->control_block.req_queue_len = cpu_to_le16(QLOGICFC_REQ_QUEUE_LEN + 1);
780 hostdata->control_block.res_queue_len = cpu_to_le16(RES_QUEUE_LEN + 1);
781 hostdata->control_block.res_queue_addr_lo = cpu_to_le32(pci64_dma_lo32(busaddr));
782 hostdata->control_block.res_queue_addr_high = cpu_to_le32(pci64_dma_hi32(busaddr));
783 hostdata->control_block.req_queue_addr_lo = cpu_to_le32(pci64_dma_lo32(busaddr + RES_SIZE));
784 hostdata->control_block.req_queue_addr_high = cpu_to_le32(pci64_dma_hi32(busaddr + RES_SIZE));
785
786
787 hostdata->control_block.add_firm_opts |= cpu_to_le16(CONNECTION_PREFERENCE<<4);
788 hostdata->adapter_state = AS_LOOP_DOWN;
789 hostdata->explore_timer.data = 1;
790 hostdata->host_id = hosts;
791
792 if (isp2x00_init(host) || isp2x00_reset_hardware(host)) {
793 pci_free_consistent (pdev, RES_SIZE + REQ_SIZE, hostdata->res, busaddr);
794 scsi_unregister(host);
795 continue;
796 }
797 host->this_id = 0;
798
799 if (request_irq(host->irq, do_isp2x00_intr_handler, SA_INTERRUPT | SA_SHIRQ, "qlogicfc", host)) {
800 printk("qlogicfc%d : interrupt %d already in use\n",
801 hostdata->host_id, host->irq);
802 pci_free_consistent (pdev, RES_SIZE + REQ_SIZE, hostdata->res, busaddr);
803 scsi_unregister(host);
804 continue;
805 }
806 if (!request_region(host->io_port, 0xff, "qlogicfc")) {
807 printk("qlogicfc%d : i/o region 0x%lx-0x%lx already "
808 "in use\n",
809 hostdata->host_id, host->io_port, host->io_port + 0xff);
810 free_irq(host->irq, host);
811 pci_free_consistent (pdev, RES_SIZE + REQ_SIZE, hostdata->res, busaddr);
812 scsi_unregister(host);
813 continue;
814 }
815
816 outw(0x0, host->io_port + PCI_SEMAPHORE);
817 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
818 isp2x00_enable_irqs(host);
819 /* wait for the loop to come up */
820 for (wait_time = jiffies + 10 * HZ; time_before(jiffies, wait_time) && hostdata->adapter_state == AS_LOOP_DOWN;) {
821 barrier();
822 cpu_relax();
823 }
824 if (hostdata->adapter_state == AS_LOOP_DOWN) {
825 printk("qlogicfc%d : link is not up\n", hostdata->host_id);
826 }
827 hosts++;
828 hostdata->explore_timer.data = 0;
829 }
830 }
831
832
833 /* this busy loop should not be needed but the isp2x00 seems to need
834 some time before recognizing it is attached to a fabric */
835
836#if ISP2x00_FABRIC
837 if (hosts) {
838 for (wait_time = jiffies + 5 * HZ; time_before(jiffies, wait_time);) {
839 barrier();
840 cpu_relax();
841 }
842 }
843#endif
844
845 LEAVE("isp2x00_detect");
846
847 return hosts;
848}
849
850
851static int isp2x00_make_portdb(struct Scsi_Host *host)
852{
853
854 short param[8];
855 int i, j;
856 struct isp2x00_hostdata *hostdata;
857
858 isp2x00_disable_irqs(host);
859
860 hostdata = (struct isp2x00_hostdata *) host->hostdata;
861 memset(hostdata->tempmap, 0, sizeof(hostdata->tempmap));
862
863#if ISP2x00_FABRIC
864 for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
865 param[0] = MBOX_PORT_LOGOUT;
866 param[1] = i << 8;
867 param[2] = 0;
868 param[3] = 0;
869
870 isp2x00_mbox_command(host, param);
871
872 if (param[0] != MBOX_COMMAND_COMPLETE) {
873
874 DEBUG_FABRIC(printk("qlogicfc%d : logout failed %x %x\n", hostdata->host_id, i, param[0]));
875 }
876 }
877#endif
878
879
880 param[0] = MBOX_GET_INIT_SCSI_ID;
881
882 isp2x00_mbox_command(host, param);
883
884 if (param[0] == MBOX_COMMAND_COMPLETE) {
885 hostdata->port_id = ((u_int) param[3]) << 16;
886 hostdata->port_id |= param[2];
887 hostdata->tempmap[0].loop_id = param[1];
888 hostdata->tempmap[0].wwn = hostdata->wwn;
889 }
890 else {
891 printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id);
892 }
893
894 for (i = 0; i <=QLOGICFC_MAX_ID; i++)
895 hostdata->tempmap[i].loop_id = hostdata->tempmap[0].loop_id;
896
897 for (i = 0, j = 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
898 param[0] = MBOX_GET_PORT_NAME;
899 param[1] = (i << 8) & 0xff00;
900
901 isp2x00_mbox_command(host, param);
902
903 if (param[0] == MBOX_COMMAND_COMPLETE) {
904 hostdata->tempmap[j].loop_id = i;
905 hostdata->tempmap[j].wwn = ((u64) (param[2] & 0xff)) << 56;
906 hostdata->tempmap[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
907 hostdata->tempmap[j].wwn |= ((u64) (param[3] & 0xff)) << 40;
908 hostdata->tempmap[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
909 hostdata->tempmap[j].wwn |= ((u64) (param[6] & 0xff)) << 24;
910 hostdata->tempmap[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
911 hostdata->tempmap[j].wwn |= ((u64) (param[7] & 0xff)) << 8;
912 hostdata->tempmap[j].wwn |= ((u64) ((param[7] >> 8) & 0xff));
913
914 j++;
915
916 }
917 }
918
919
920#if ISP2x00_FABRIC
921 isp2x00_init_fabric(host, hostdata->tempmap, j);
922#endif
923
924 for (i = 0; i <= QLOGICFC_MAX_ID; i++) {
925 if (hostdata->tempmap[i].wwn != hostdata->port_db[i].wwn) {
926 for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
927 if (hostdata->tempmap[j].wwn == hostdata->port_db[i].wwn) {
928 hostdata->port_db[i].loop_id = hostdata->tempmap[j].loop_id;
929 break;
930 }
931 }
932 if (j == QLOGICFC_MAX_ID + 1)
933 hostdata->port_db[i].loop_id = hostdata->tempmap[0].loop_id;
934
935 for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
936 if (hostdata->port_db[j].wwn == hostdata->tempmap[i].wwn || !hostdata->port_db[j].wwn) {
937 break;
938 }
939 }
940 if (j == QLOGICFC_MAX_ID + 1)
941 printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id);
942 if (!hostdata->port_db[j].wwn) {
943 hostdata->port_db[j].loop_id = hostdata->tempmap[i].loop_id;
944 hostdata->port_db[j].wwn = hostdata->tempmap[i].wwn;
945 }
946 } else
947 hostdata->port_db[i].loop_id = hostdata->tempmap[i].loop_id;
948
949 }
950
951 isp2x00_enable_irqs(host);
952
953 return 0;
954}
955
956
957#if ISP2x00_FABRIC
958
959#define FABRIC_PORT 0x7e
960#define FABRIC_CONTROLLER 0x7f
961#define FABRIC_SNS 0x80
962
963int isp2x00_init_fabric(struct Scsi_Host *host, struct id_name_map *port_db, int cur_scsi_id)
964{
965
966 u_short param[8];
967 u64 wwn;
968 int done = 0;
969 u_short loop_id = 0x81;
970 u_short scsi_id = cur_scsi_id;
971 u_int port_id;
972 struct sns_cb *req;
973 u_char *sns_response;
974 dma_addr_t busaddr;
975 struct isp2x00_hostdata *hostdata;
976
977 hostdata = (struct isp2x00_hostdata *) host->hostdata;
978
979 DEBUG_FABRIC(printk("qlogicfc%d : Checking for a fabric.\n", hostdata->host_id));
980 param[0] = MBOX_GET_PORT_NAME;
981 param[1] = (u16)FABRIC_PORT << 8;
982
983 isp2x00_mbox_command(host, param);
984
985 if (param[0] != MBOX_COMMAND_COMPLETE) {
986 DEBUG_FABRIC(printk("qlogicfc%d : fabric check result %x\n", hostdata->host_id, param[0]));
987 return 0;
988 }
989 printk("qlogicfc%d : Fabric found.\n", hostdata->host_id);
990
991 req = (struct sns_cb *)pci_alloc_consistent(hostdata->pci_dev, sizeof(*req) + 608, &busaddr);
992
993 if (!req){
994 printk("qlogicfc%d : Could not allocate DMA resources for fabric initialization\n", hostdata->host_id);
995 return 0;
996 }
997 sns_response = (u_char *)(req + 1);
998
999 if (hostdata->adapter_state & AS_REDO_LOOP_PORTDB){
1000 memset(req, 0, sizeof(*req));
1001
1002 req->len = cpu_to_le16(8);
1003 req->response_low = cpu_to_le32(pci64_dma_lo32(busaddr + sizeof(*req)));
1004 req->response_high = cpu_to_le32(pci64_dma_hi32(busaddr + sizeof(*req)));
1005 req->sub_len = cpu_to_le16(22);
1006 req->data[0] = 0x17;
1007 req->data[1] = 0x02;
1008 req->data[8] = (u_char) (hostdata->port_id & 0xff);
1009 req->data[9] = (u_char) (hostdata->port_id >> 8 & 0xff);
1010 req->data[10] = (u_char) (hostdata->port_id >> 16 & 0xff);
1011 req->data[13] = 0x01;
1012 param[0] = MBOX_SEND_SNS;
1013 param[1] = 30;
1014 param[2] = pci64_dma_lo32(busaddr) >> 16;
1015 param[3] = pci64_dma_lo32(busaddr);
1016 param[6] = pci64_dma_hi32(busaddr) >> 16;
1017 param[7] = pci64_dma_hi32(busaddr);
1018
1019 isp2x00_mbox_command(host, param);
1020
1021 if (param[0] != MBOX_COMMAND_COMPLETE)
1022 printk("qlogicfc%d : error sending RFC-4\n", hostdata->host_id);
1023 }
1024
1025 port_id = hostdata->port_id;
1026 while (!done) {
1027 memset(req, 0, sizeof(*req));
1028
1029 req->len = cpu_to_le16(304);
1030 req->response_low = cpu_to_le32(pci64_dma_lo32(busaddr + sizeof(*req)));
1031 req->response_high = cpu_to_le32(pci64_dma_hi32(busaddr + sizeof(*req)));
1032 req->sub_len = cpu_to_le16(6);
1033 req->data[0] = 0x00;
1034 req->data[1] = 0x01;
1035 req->data[8] = (u_char) (port_id & 0xff);
1036 req->data[9] = (u_char) (port_id >> 8 & 0xff);
1037 req->data[10] = (u_char) (port_id >> 16 & 0xff);
1038
1039 param[0] = MBOX_SEND_SNS;
1040 param[1] = 14;
1041 param[2] = pci64_dma_lo32(busaddr) >> 16;
1042 param[3] = pci64_dma_lo32(busaddr);
1043 param[6] = pci64_dma_hi32(busaddr) >> 16;
1044 param[7] = pci64_dma_hi32(busaddr);
1045
1046 isp2x00_mbox_command(host, param);
1047
1048 if (param[0] == MBOX_COMMAND_COMPLETE) {
1049 DEBUG_FABRIC(printk("qlogicfc%d : found node %02x%02x%02x%02x%02x%02x%02x%02x ", hostdata->host_id, sns_response[20], sns_response[21], sns_response[22], sns_response[23], sns_response[24], sns_response[25], sns_response[26], sns_response[27]));
1050 DEBUG_FABRIC(printk(" port id: %02x%02x%02x\n", sns_response[17], sns_response[18], sns_response[19]));
1051 port_id = ((u_int) sns_response[17]) << 16;
1052 port_id |= ((u_int) sns_response[18]) << 8;
1053 port_id |= ((u_int) sns_response[19]);
1054 wwn = ((u64) sns_response[20]) << 56;
1055 wwn |= ((u64) sns_response[21]) << 48;
1056 wwn |= ((u64) sns_response[22]) << 40;
1057 wwn |= ((u64) sns_response[23]) << 32;
1058 wwn |= ((u64) sns_response[24]) << 24;
1059 wwn |= ((u64) sns_response[25]) << 16;
1060 wwn |= ((u64) sns_response[26]) << 8;
1061 wwn |= ((u64) sns_response[27]);
1062 if (hostdata->port_id >> 8 != port_id >> 8) {
1063 DEBUG_FABRIC(printk("qlogicfc%d : adding a fabric port: %x\n", hostdata->host_id, port_id));
1064 param[0] = MBOX_PORT_LOGIN;
1065 param[1] = loop_id << 8;
1066 param[2] = (u_short) (port_id >> 16);
1067 param[3] = (u_short) (port_id);
1068
1069 isp2x00_mbox_command(host, param);
1070
1071 if (param[0] == MBOX_COMMAND_COMPLETE) {
1072 port_db[scsi_id].wwn = wwn;
1073 port_db[scsi_id].loop_id = loop_id;
1074 loop_id++;
1075 scsi_id++;
1076 } else {
1077 printk("qlogicfc%d : Error performing port login %x\n", hostdata->host_id, param[0]);
1078 DEBUG_FABRIC(printk("qlogicfc%d : loop_id: %x\n", hostdata->host_id, loop_id));
1079 param[0] = MBOX_PORT_LOGOUT;
1080 param[1] = loop_id << 8;
1081 param[2] = 0;
1082 param[3] = 0;
1083
1084 isp2x00_mbox_command(host, param);
1085
1086 }
1087
1088 }
1089 if (hostdata->port_id == port_id)
1090 done = 1;
1091 } else {
1092 printk("qlogicfc%d : Get All Next failed %x.\n", hostdata->host_id, param[0]);
1093 pci_free_consistent(hostdata->pci_dev, sizeof(*req) + 608, req, busaddr);
1094 return 0;
1095 }
1096 }
1097
1098 pci_free_consistent(hostdata->pci_dev, sizeof(*req) + 608, req, busaddr);
1099 return 1;
1100}
1101
1102#endif /* ISP2x00_FABRIC */
1103
1104
1105static int isp2x00_release(struct Scsi_Host *host)
1106{
1107 struct isp2x00_hostdata *hostdata;
1108 dma_addr_t busaddr;
1109
1110 ENTER("isp2x00_release");
1111
1112 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1113
1114 outw(0x0, host->io_port + PCI_INTER_CTL);
1115 free_irq(host->irq, host);
1116
1117 release_region(host->io_port, 0xff);
1118
1119 busaddr = pci64_dma_build(le32_to_cpu(hostdata->control_block.res_queue_addr_high),
1120 le32_to_cpu(hostdata->control_block.res_queue_addr_lo));
1121 pci_free_consistent(hostdata->pci_dev, RES_SIZE + REQ_SIZE, hostdata->res, busaddr);
1122
1123 LEAVE("isp2x00_release");
1124
1125 return 0;
1126}
1127
1128
1129static const char *isp2x00_info(struct Scsi_Host *host)
1130{
1131 static char buf[80];
1132 struct isp2x00_hostdata *hostdata;
1133 ENTER("isp2x00_info");
1134
1135 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1136 sprintf(buf,
1137 "QLogic ISP%04x SCSI on PCI bus %02x device %02x irq %d base 0x%lx",
1138 hostdata->pci_dev->device, hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
1139 host->io_port);
1140
1141
1142 LEAVE("isp2x00_info");
1143
1144 return buf;
1145}
1146
1147
1148/*
1149 * The middle SCSI layer ensures that queuecommand never gets invoked
1150 * concurrently with itself or the interrupt handler (though the
1151 * interrupt handler may call this routine as part of
1152 * request-completion handling).
1153 */
1154static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1155{
1156 int i, sg_count, n, num_free;
1157 u_int in_ptr, out_ptr;
1158 struct dataseg *ds;
1159 struct scatterlist *sg;
1160 struct Command_Entry *cmd;
1161 struct Continuation_Entry *cont;
1162 struct Scsi_Host *host;
1163 struct isp2x00_hostdata *hostdata;
1164
1165 ENTER("isp2x00_queuecommand");
1166
1167 host = Cmnd->device->host;
1168 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1169 Cmnd->scsi_done = done;
1170
1171 DEBUG(isp2x00_print_scsi_cmd(Cmnd));
1172
1173 if (hostdata->adapter_state & AS_REDO_FABRIC_PORTDB || hostdata->adapter_state & AS_REDO_LOOP_PORTDB) {
1174 isp2x00_make_portdb(host);
1175 hostdata->adapter_state = AS_LOOP_GOOD;
1176 printk("qlogicfc%d : Port Database\n", hostdata->host_id);
1177 for (i = 0; hostdata->port_db[i].wwn != 0; i++) {
1178 printk("wwn: %08x%08x scsi_id: %x loop_id: ", (u_int) (hostdata->port_db[i].wwn >> 32), (u_int) hostdata->port_db[i].wwn, i);
1179 if (hostdata->port_db[i].loop_id != hostdata->port_db[0].loop_id || i == 0)
1180 printk("%x", hostdata->port_db[i].loop_id);
1181 else
1182 printk("Not Available");
1183 printk("\n");
1184 }
1185 }
1186 if (hostdata->adapter_state == AS_FIRMWARE_DEAD) {
1187 printk("qlogicfc%d : The firmware is dead, just return.\n", hostdata->host_id);
1188 host->max_id = 0;
1189 return 0;
1190 }
1191
1192 out_ptr = inw(host->io_port + MBOX4);
1193 in_ptr = hostdata->req_in_ptr;
1194
1195 DEBUG(printk("qlogicfc%d : request queue depth %d\n", hostdata->host_id,
1196 REQ_QUEUE_DEPTH(in_ptr, out_ptr)));
1197
1198 cmd = (struct Command_Entry *) &hostdata->req[in_ptr*QUEUE_ENTRY_LEN];
1199 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1200 if (in_ptr == out_ptr) {
1201 DEBUG(printk("qlogicfc%d : request queue overflow\n", hostdata->host_id));
1202 return 1;
1203 }
1204 if (hostdata->send_marker) {
1205 struct Marker_Entry *marker;
1206
1207 TRACE("queue marker", in_ptr, 0);
1208
1209 DEBUG(printk("qlogicfc%d : adding marker entry\n", hostdata->host_id));
1210 marker = (struct Marker_Entry *) cmd;
1211 memset(marker, 0, sizeof(struct Marker_Entry));
1212
1213 marker->hdr.entry_type = ENTRY_MARKER;
1214 marker->hdr.entry_cnt = 1;
1215 marker->modifier = SYNC_ALL;
1216
1217 hostdata->send_marker = 0;
1218
1219 if (((in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN) == out_ptr) {
1220 outw(in_ptr, host->io_port + MBOX4);
1221 hostdata->req_in_ptr = in_ptr;
1222 DEBUG(printk("qlogicfc%d : request queue overflow\n", hostdata->host_id));
1223 return 1;
1224 }
1225 cmd = (struct Command_Entry *) &hostdata->req[in_ptr*QUEUE_ENTRY_LEN];
1226 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1227 }
1228 TRACE("queue command", in_ptr, Cmnd);
1229
1230 memset(cmd, 0, sizeof(struct Command_Entry));
1231
1232 /* find a free handle mapping slot */
1233 for (i = in_ptr; i != (in_ptr - 1) && hostdata->handle_ptrs[i]; i = ((i + 1) % (QLOGICFC_REQ_QUEUE_LEN + 1)));
1234
1235 if (!hostdata->handle_ptrs[i]) {
1236 cmd->handle = cpu_to_le32(i);
1237 hostdata->handle_ptrs[i] = Cmnd;
1238 hostdata->handle_serials[i] = Cmnd->serial_number;
1239 } else {
1240 printk("qlogicfc%d : no handle slots, this should not happen.\n", hostdata->host_id);
1241 printk("hostdata->queued is %x, in_ptr: %x\n", hostdata->queued, in_ptr);
1242 for (i = 0; i <= QLOGICFC_REQ_QUEUE_LEN; i++){
1243 if (!hostdata->handle_ptrs[i]){
1244 printk("slot %d has %p\n", i, hostdata->handle_ptrs[i]);
1245 }
1246 }
1247 return 1;
1248 }
1249
1250 cmd->hdr.entry_type = ENTRY_COMMAND;
1251 cmd->hdr.entry_cnt = 1;
1252 cmd->target_lun = Cmnd->device->lun;
1253 cmd->expanded_lun = cpu_to_le16(Cmnd->device->lun);
1254#if ISP2x00_PORTDB
1255 cmd->target_id = hostdata->port_db[Cmnd->device->id].loop_id;
1256#else
1257 cmd->target_id = Cmnd->target;
1258#endif
1259 cmd->total_byte_cnt = cpu_to_le32(Cmnd->request_bufflen);
1260 cmd->time_out = 0;
1261 memcpy(cmd->cdb, Cmnd->cmnd, Cmnd->cmd_len);
1262
1263 if (Cmnd->use_sg) {
1264 sg = (struct scatterlist *) Cmnd->request_buffer;
1265 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg, Cmnd->sc_data_direction);
1266 cmd->segment_cnt = cpu_to_le16(sg_count);
1267 ds = cmd->dataseg;
1268 /* fill in first two sg entries: */
1269 n = sg_count;
1270 if (n > DATASEGS_PER_COMMAND)
1271 n = DATASEGS_PER_COMMAND;
1272
1273 for (i = 0; i < n; i++) {
1274 ds[i].d_base = cpu_to_le32(pci64_dma_lo32(sg_dma_address(sg)));
1275 ds[i].d_base_hi = cpu_to_le32(pci64_dma_hi32(sg_dma_address(sg)));
1276 ds[i].d_count = cpu_to_le32(sg_dma_len(sg));
1277 ++sg;
1278 }
1279 sg_count -= DATASEGS_PER_COMMAND;
1280
1281 while (sg_count > 0) {
1282 ++cmd->hdr.entry_cnt;
1283 cont = (struct Continuation_Entry *)
1284 &hostdata->req[in_ptr*QUEUE_ENTRY_LEN];
1285 memset(cont, 0, sizeof(struct Continuation_Entry));
1286 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1287 if (in_ptr == out_ptr) {
1288 DEBUG(printk("qlogicfc%d : unexpected request queue overflow\n", hostdata->host_id));
1289 return 1;
1290 }
1291 TRACE("queue continuation", in_ptr, 0);
1292 cont->hdr.entry_type = ENTRY_CONTINUATION;
1293 ds = cont->dataseg;
1294 n = sg_count;
1295 if (n > DATASEGS_PER_CONT)
1296 n = DATASEGS_PER_CONT;
1297 for (i = 0; i < n; ++i) {
1298 ds[i].d_base = cpu_to_le32(pci64_dma_lo32(sg_dma_address(sg)));
1299 ds[i].d_base_hi = cpu_to_le32(pci64_dma_hi32(sg_dma_address(sg)));
1300 ds[i].d_count = cpu_to_le32(sg_dma_len(sg));
1301 ++sg;
1302 }
1303 sg_count -= n;
1304 }
1305 } else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE) {
1306 struct page *page = virt_to_page(Cmnd->request_buffer);
1307 unsigned long offset = offset_in_page(Cmnd->request_buffer);
1308 dma_addr_t busaddr = pci_map_page(hostdata->pci_dev,
1309 page, offset,
1310 Cmnd->request_bufflen,
1311 Cmnd->sc_data_direction);
1312 Cmnd->SCp.dma_handle = busaddr;
1313
1314 cmd->dataseg[0].d_base = cpu_to_le32(pci64_dma_lo32(busaddr));
1315 cmd->dataseg[0].d_base_hi = cpu_to_le32(pci64_dma_hi32(busaddr));
1316 cmd->dataseg[0].d_count = cpu_to_le32(Cmnd->request_bufflen);
1317 cmd->segment_cnt = cpu_to_le16(1);
1318 } else {
1319 cmd->dataseg[0].d_base = 0;
1320 cmd->dataseg[0].d_base_hi = 0;
1321 cmd->segment_cnt = cpu_to_le16(1); /* Shouldn't this be 0? */
1322 }
1323
1324 if (Cmnd->sc_data_direction == DMA_TO_DEVICE)
1325 cmd->control_flags = cpu_to_le16(CFLAG_WRITE);
1326 else
1327 cmd->control_flags = cpu_to_le16(CFLAG_READ);
1328
1329 if (Cmnd->device->tagged_supported) {
1330 if (time_after(jiffies, hostdata->tag_ages[Cmnd->device->id] + (2 * ISP_TIMEOUT))) {
1331 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
1332 hostdata->tag_ages[Cmnd->device->id] = jiffies;
1333 } else
1334 switch (Cmnd->tag) {
1335 case HEAD_OF_QUEUE_TAG:
1336 cmd->control_flags |= cpu_to_le16(CFLAG_HEAD_TAG);
1337 break;
1338 case ORDERED_QUEUE_TAG:
1339 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
1340 break;
1341 default:
1342 cmd->control_flags |= cpu_to_le16(CFLAG_SIMPLE_TAG);
1343 break;
1344 }
1345 }
1346 /*
1347 * TEST_UNIT_READY commands from scsi_scan will fail due to "overlapped
1348 * commands attempted" unless we setup at least a simple queue (midlayer
1349 * will embelish this once it can do an INQUIRY command to the device)
1350 */
1351 else
1352 cmd->control_flags |= cpu_to_le16(CFLAG_SIMPLE_TAG);
1353 outw(in_ptr, host->io_port + MBOX4);
1354 hostdata->req_in_ptr = in_ptr;
1355
1356 hostdata->queued++;
1357
1358 num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
1359 num_free = (num_free > 2) ? num_free - 2 : 0;
1360 host->can_queue = host->host_busy + num_free;
1361 if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
1362 host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
1363 host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
1364
1365 LEAVE("isp2x00_queuecommand");
1366
1367 return 0;
1368}
1369
1370
1371/* we have received an event, such as a lip or an RSCN, which may mean that
1372 * our port database is incorrect so the port database must be recreated.
1373 */
1374static void redo_port_db(unsigned long arg)
1375{
1376
1377 struct Scsi_Host * host = (struct Scsi_Host *) arg;
1378 struct isp2x00_hostdata * hostdata;
1379 unsigned long flags;
1380 int i;
1381
1382 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1383 hostdata->explore_timer.data = 0;
1384 del_timer(&hostdata->explore_timer);
1385
1386 spin_lock_irqsave(host->host_lock, flags);
1387
1388 if (hostdata->adapter_state & AS_REDO_FABRIC_PORTDB || hostdata->adapter_state & AS_REDO_LOOP_PORTDB) {
1389 isp2x00_make_portdb(host);
1390 printk("qlogicfc%d : Port Database\n", hostdata->host_id);
1391 for (i = 0; hostdata->port_db[i].wwn != 0; i++) {
1392 printk("wwn: %08x%08x scsi_id: %x loop_id: ", (u_int) (hostdata->port_db[i].wwn >> 32), (u_int) hostdata->port_db[i].wwn, i);
1393 if (hostdata->port_db[i].loop_id != hostdata->port_db[0].loop_id || i == 0)
1394 printk("%x", hostdata->port_db[i].loop_id);
1395 else
1396 printk("Not Available");
1397 printk("\n");
1398 }
1399
1400 for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++){
1401 if (hostdata->handle_ptrs[i] && (hostdata->port_db[hostdata->handle_ptrs[i]->device->id].loop_id > QLOGICFC_MAX_LOOP_ID || hostdata->adapter_state & AS_REDO_LOOP_PORTDB)){
1402 if (hostdata->port_db[hostdata->handle_ptrs[i]->device->id].loop_id != hostdata->port_db[0].loop_id){
1403 Scsi_Cmnd *Cmnd = hostdata->handle_ptrs[i];
1404
1405 if (Cmnd->use_sg)
1406 pci_unmap_sg(hostdata->pci_dev,
1407 (struct scatterlist *)Cmnd->buffer,
1408 Cmnd->use_sg,
1409 Cmnd->sc_data_direction);
1410 else if (Cmnd->request_bufflen &&
1411 Cmnd->sc_data_direction != PCI_DMA_NONE) {
1412 pci_unmap_page(hostdata->pci_dev,
1413 Cmnd->SCp.dma_handle,
1414 Cmnd->request_bufflen,
1415 Cmnd->sc_data_direction);
1416 }
1417
1418 hostdata->handle_ptrs[i]->result = DID_SOFT_ERROR << 16;
1419
1420 if (hostdata->handle_ptrs[i]->scsi_done){
1421 (*hostdata->handle_ptrs[i]->scsi_done) (hostdata->handle_ptrs[i]);
1422 }
1423 else printk("qlogicfc%d : done is null?\n", hostdata->host_id);
1424 hostdata->handle_ptrs[i] = NULL;
1425 hostdata->handle_serials[i] = 0;
1426 }
1427 }
1428 }
1429
1430 hostdata->adapter_state = AS_LOOP_GOOD;
1431 }
1432
1433 spin_unlock_irqrestore(host->host_lock, flags);
1434
1435}
1436
1437#define ASYNC_EVENT_INTERRUPT 0x01
1438
1439irqreturn_t do_isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1440{
1441 struct Scsi_Host *host = dev_id;
1442 unsigned long flags;
1443
1444 spin_lock_irqsave(host->host_lock, flags);
1445 isp2x00_intr_handler(irq, dev_id, regs);
1446 spin_unlock_irqrestore(host->host_lock, flags);
1447
1448 return IRQ_HANDLED;
1449}
1450
1451void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1452{
1453 Scsi_Cmnd *Cmnd;
1454 struct Status_Entry *sts;
1455 struct Scsi_Host *host = dev_id;
1456 struct isp2x00_hostdata *hostdata;
1457 u_int in_ptr, out_ptr, handle, num_free;
1458 u_short status;
1459
1460 ENTER_INTR("isp2x00_intr_handler");
1461
1462 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1463
1464 DEBUG_INTR(printk("qlogicfc%d : interrupt on line %d\n", hostdata->host_id, irq));
1465
1466 if (!(inw(host->io_port + PCI_INTER_STS) & 0x08)) {
1467 /* spurious interrupts can happen legally */
1468 DEBUG_INTR(printk("qlogicfc%d : got spurious interrupt\n", hostdata->host_id));
1469 return;
1470 }
1471 in_ptr = inw(host->io_port + MBOX5);
1472 out_ptr = hostdata->res_out_ptr;
1473
1474 if ((inw(host->io_port + PCI_SEMAPHORE) & ASYNC_EVENT_INTERRUPT)) {
1475 status = inw(host->io_port + MBOX0);
1476
1477 DEBUG_INTR(printk("qlogicfc%d : mbox completion status: %x\n",
1478 hostdata->host_id, status));
1479
1480 switch (status) {
1481 case LOOP_UP:
1482 case POINT_TO_POINT_UP:
1483 printk("qlogicfc%d : Link is Up\n", hostdata->host_id);
1484 hostdata->adapter_state = AS_REDO_FABRIC_PORTDB | AS_REDO_LOOP_PORTDB;
1485 break;
1486 case LOOP_DOWN:
1487 printk("qlogicfc%d : Link is Down\n", hostdata->host_id);
1488 hostdata->adapter_state = AS_LOOP_DOWN;
1489 break;
1490 case CONNECTION_MODE:
1491 printk("received CONNECTION_MODE irq %x\n", inw(host->io_port + MBOX1));
1492 break;
1493 case CHANGE_NOTIFICATION:
1494 printk("qlogicfc%d : RSCN Received\n", hostdata->host_id);
1495 if (hostdata->adapter_state == AS_LOOP_GOOD)
1496 hostdata->adapter_state = AS_REDO_FABRIC_PORTDB;
1497 break;
1498 case LIP_OCCURRED:
1499 case LIP_RECEIVED:
1500 printk("qlogicfc%d : Loop Reinitialized\n", hostdata->host_id);
1501 if (hostdata->adapter_state == AS_LOOP_GOOD)
1502 hostdata->adapter_state = AS_REDO_LOOP_PORTDB;
1503 break;
1504 case SYSTEM_ERROR:
1505 printk("qlogicfc%d : The firmware just choked.\n", hostdata->host_id);
1506 hostdata->adapter_state = AS_FIRMWARE_DEAD;
1507 break;
1508 case SCSI_COMMAND_COMPLETE:
1509 handle = inw(host->io_port + MBOX1) | (inw(host->io_port + MBOX2) << 16);
1510 Cmnd = hostdata->handle_ptrs[handle];
1511 hostdata->handle_ptrs[handle] = NULL;
1512 hostdata->handle_serials[handle] = 0;
1513 hostdata->queued--;
1514 if (Cmnd != NULL) {
1515 if (Cmnd->use_sg)
1516 pci_unmap_sg(hostdata->pci_dev,
1517 (struct scatterlist *)Cmnd->buffer,
1518 Cmnd->use_sg,
1519 Cmnd->sc_data_direction);
1520 else if (Cmnd->request_bufflen &&
1521 Cmnd->sc_data_direction != PCI_DMA_NONE)
1522 pci_unmap_page(hostdata->pci_dev,
1523 Cmnd->SCp.dma_handle,
1524 Cmnd->request_bufflen,
1525 Cmnd->sc_data_direction);
1526 Cmnd->result = 0x0;
1527 (*Cmnd->scsi_done) (Cmnd);
1528 } else
1529 printk("qlogicfc%d.c : got a null value out of handle_ptrs, this sucks\n", hostdata->host_id);
1530 break;
1531 case MBOX_COMMAND_COMPLETE:
1532 case INVALID_COMMAND:
1533 case HOST_INTERFACE_ERROR:
1534 case TEST_FAILED:
1535 case COMMAND_ERROR:
1536 case COMMAND_PARAM_ERROR:
1537 case PORT_ID_USED:
1538 case LOOP_ID_USED:
1539 case ALL_IDS_USED:
1540 hostdata->mbox_done = 1;
1541 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
1542 return;
1543 default:
1544 printk("qlogicfc%d : got an unknown status? %x\n", hostdata->host_id, status);
1545 }
1546 if ((hostdata->adapter_state & AS_REDO_LOOP_PORTDB || hostdata->adapter_state & AS_REDO_FABRIC_PORTDB) && hostdata->explore_timer.data == 0){
1547 hostdata->explore_timer.function = redo_port_db;
1548 hostdata->explore_timer.data = (unsigned long)host;
1549 hostdata->explore_timer.expires = jiffies + (HZ/4);
1550 init_timer(&hostdata->explore_timer);
1551 add_timer(&hostdata->explore_timer);
1552 }
1553 outw(0x0, host->io_port + PCI_SEMAPHORE);
1554 } else {
1555 DEBUG_INTR(printk("qlogicfc%d : response queue update\n", hostdata->host_id));
1556 DEBUG_INTR(printk("qlogicfc%d : response queue depth %d\n", hostdata->host_id, RES_QUEUE_DEPTH(in_ptr, out_ptr)));
1557
1558 while (out_ptr != in_ptr) {
1559 unsigned le_hand;
1560 sts = (struct Status_Entry *) &hostdata->res[out_ptr*QUEUE_ENTRY_LEN];
1561 out_ptr = (out_ptr + 1) & RES_QUEUE_LEN;
1562
1563 TRACE("done", out_ptr, Cmnd);
1564 DEBUG_INTR(isp2x00_print_status_entry(sts));
1565 le_hand = le32_to_cpu(sts->handle);
1566 if (sts->hdr.entry_type == ENTRY_STATUS && (Cmnd = hostdata->handle_ptrs[le_hand])) {
1567 Cmnd->result = isp2x00_return_status(Cmnd, sts);
1568 hostdata->queued--;
1569
1570 if (Cmnd->use_sg)
1571 pci_unmap_sg(hostdata->pci_dev,
1572 (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg,
1573 Cmnd->sc_data_direction);
1574 else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE)
1575 pci_unmap_page(hostdata->pci_dev,
1576 Cmnd->SCp.dma_handle,
1577 Cmnd->request_bufflen,
1578 Cmnd->sc_data_direction);
1579
1580 /*
1581 * if any of the following are true we do not
1582 * call scsi_done. if the status is CS_ABORTED
1583 * we don't have to call done because the upper
1584 * level should already know its aborted.
1585 */
1586 if (hostdata->handle_serials[le_hand] != Cmnd->serial_number
1587 || le16_to_cpu(sts->completion_status) == CS_ABORTED){
1588 hostdata->handle_serials[le_hand] = 0;
1589 hostdata->handle_ptrs[le_hand] = NULL;
1590 outw(out_ptr, host->io_port + MBOX5);
1591 continue;
1592 }
1593 /*
1594 * if we get back an error indicating the port
1595 * is not there or if the link is down and
1596 * this is a device that used to be there
1597 * allow the command to timeout.
1598 * the device may well be back in a couple of
1599 * seconds.
1600 */
1601 if ((hostdata->adapter_state == AS_LOOP_DOWN || sts->completion_status == cpu_to_le16(CS_PORT_UNAVAILABLE) || sts->completion_status == cpu_to_le16(CS_PORT_LOGGED_OUT) || sts->completion_status == cpu_to_le16(CS_PORT_CONFIG_CHANGED)) && hostdata->port_db[Cmnd->device->id].wwn){
1602 outw(out_ptr, host->io_port + MBOX5);
1603 continue;
1604 }
1605 } else {
1606 outw(out_ptr, host->io_port + MBOX5);
1607 continue;
1608 }
1609
1610 hostdata->handle_ptrs[le_hand] = NULL;
1611
1612 if (sts->completion_status == cpu_to_le16(CS_RESET_OCCURRED)
1613 || (sts->status_flags & cpu_to_le16(STF_BUS_RESET)))
1614 hostdata->send_marker = 1;
1615
1616 if (le16_to_cpu(sts->scsi_status) & 0x0200)
1617 memcpy(Cmnd->sense_buffer, sts->req_sense_data,
1618 sizeof(Cmnd->sense_buffer));
1619
1620 outw(out_ptr, host->io_port + MBOX5);
1621
1622 if (Cmnd->scsi_done != NULL) {
1623 (*Cmnd->scsi_done) (Cmnd);
1624 } else
1625 printk("qlogicfc%d : Ouch, scsi done is NULL\n", hostdata->host_id);
1626 }
1627 hostdata->res_out_ptr = out_ptr;
1628 }
1629
1630
1631 out_ptr = inw(host->io_port + MBOX4);
1632 in_ptr = hostdata->req_in_ptr;
1633
1634 num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
1635 num_free = (num_free > 2) ? num_free - 2 : 0;
1636 host->can_queue = host->host_busy + num_free;
1637 if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
1638 host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
1639 host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
1640
1641 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
1642 LEAVE_INTR("isp2x00_intr_handler");
1643}
1644
1645
1646static int isp2x00_return_status(Scsi_Cmnd *Cmnd, struct Status_Entry *sts)
1647{
1648 int host_status = DID_ERROR;
1649#if DEBUG_ISP2x00_INTR
1650 static char *reason[] =
1651 {
1652 "DID_OK",
1653 "DID_NO_CONNECT",
1654 "DID_BUS_BUSY",
1655 "DID_TIME_OUT",
1656 "DID_BAD_TARGET",
1657 "DID_ABORT",
1658 "DID_PARITY",
1659 "DID_ERROR",
1660 "DID_RESET",
1661 "DID_BAD_INTR"
1662 };
1663#endif /* DEBUG_ISP2x00_INTR */
1664
1665 ENTER("isp2x00_return_status");
1666
1667 DEBUG(printk("qlogicfc : completion status = 0x%04x\n",
1668 le16_to_cpu(sts->completion_status)));
1669
1670 switch (le16_to_cpu(sts->completion_status)) {
1671 case CS_COMPLETE:
1672 host_status = DID_OK;
1673 break;
1674 case CS_DMA_ERROR:
1675 host_status = DID_ERROR;
1676 break;
1677 case CS_RESET_OCCURRED:
1678 host_status = DID_RESET;
1679 break;
1680 case CS_ABORTED:
1681 host_status = DID_ABORT;
1682 break;
1683 case CS_TIMEOUT:
1684 host_status = DID_TIME_OUT;
1685 break;
1686 case CS_DATA_OVERRUN:
1687 host_status = DID_ERROR;
1688 break;
1689 case CS_DATA_UNDERRUN:
1690 if (Cmnd->underflow <= (Cmnd->request_bufflen - le32_to_cpu(sts->residual)))
1691 host_status = DID_OK;
1692 else
1693 host_status = DID_ERROR;
1694 break;
1695 case CS_PORT_UNAVAILABLE:
1696 case CS_PORT_LOGGED_OUT:
1697 case CS_PORT_CONFIG_CHANGED:
1698 host_status = DID_BAD_TARGET;
1699 break;
1700 case CS_QUEUE_FULL:
1701 host_status = DID_ERROR;
1702 break;
1703 default:
1704 printk("qlogicfc : unknown completion status 0x%04x\n",
1705 le16_to_cpu(sts->completion_status));
1706 host_status = DID_ERROR;
1707 break;
1708 }
1709
1710 DEBUG_INTR(printk("qlogicfc : host status (%s) scsi status %x\n",
1711 reason[host_status], le16_to_cpu(sts->scsi_status)));
1712
1713 LEAVE("isp2x00_return_status");
1714
1715 return (le16_to_cpu(sts->scsi_status) & STATUS_MASK) | (host_status << 16);
1716}
1717
1718
1719static int isp2x00_abort(Scsi_Cmnd * Cmnd)
1720{
1721 u_short param[8];
1722 int i;
1723 struct Scsi_Host *host;
1724 struct isp2x00_hostdata *hostdata;
1725 int return_status = SUCCESS;
1726
1727 ENTER("isp2x00_abort");
1728
1729 host = Cmnd->device->host;
1730 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1731
1732 for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++)
1733 if (hostdata->handle_ptrs[i] == Cmnd)
1734 break;
1735
1736 if (i == QLOGICFC_REQ_QUEUE_LEN){
1737 return SUCCESS;
1738 }
1739
1740 isp2x00_disable_irqs(host);
1741
1742 param[0] = MBOX_ABORT_IOCB;
1743#if ISP2x00_PORTDB
1744 param[1] = (((u_short) hostdata->port_db[Cmnd->device->id].loop_id) << 8) | Cmnd->device->lun;
1745#else
1746 param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
1747#endif
1748 param[2] = i & 0xffff;
1749 param[3] = i >> 16;
1750
1751 isp2x00_mbox_command(host, param);
1752
1753 if (param[0] != MBOX_COMMAND_COMPLETE) {
1754 printk("qlogicfc%d : scsi abort failure: %x\n", hostdata->host_id, param[0]);
1755 if (param[0] == 0x4005)
1756 Cmnd->result = DID_ERROR << 16;
1757 if (param[0] == 0x4006)
1758 Cmnd->result = DID_BAD_TARGET << 16;
1759 return_status = FAILED;
1760 }
1761
1762 if (return_status != SUCCESS){
1763 param[0] = MBOX_GET_FIRMWARE_STATE;
1764 isp2x00_mbox_command(host, param);
1765 printk("qlogicfc%d : abort failed\n", hostdata->host_id);
1766 printk("qlogicfc%d : firmware status is %x %x\n", hostdata->host_id, param[0], param[1]);
1767 }
1768
1769 isp2x00_enable_irqs(host);
1770
1771 LEAVE("isp2x00_abort");
1772
1773 return return_status;
1774}
1775
1776
1777static int isp2x00_biosparam(struct scsi_device *sdev, struct block_device *n,
1778 sector_t capacity, int ip[])
1779{
1780 int size = capacity;
1781
1782 ENTER("isp2x00_biosparam");
1783
1784 ip[0] = 64;
1785 ip[1] = 32;
1786 ip[2] = size >> 11;
1787 if (ip[2] > 1024) {
1788 ip[0] = 255;
1789 ip[1] = 63;
1790 ip[2] = size / (ip[0] * ip[1]);
1791 }
1792 LEAVE("isp2x00_biosparam");
1793
1794 return 0;
1795}
1796
1797static int isp2x00_reset_hardware(struct Scsi_Host *host)
1798{
1799 u_short param[8];
1800 struct isp2x00_hostdata *hostdata;
1801 int loop_count;
1802 dma_addr_t busaddr;
1803
1804 ENTER("isp2x00_reset_hardware");
1805
1806 hostdata = (struct isp2x00_hostdata *) host->hostdata;
1807
1808 /*
1809 * This cannot be right - PCI writes are posted
1810 * (apparently this is hardware design flaw not software ?)
1811 */
1812
1813 outw(0x01, host->io_port + ISP_CTRL_STATUS);
1814 udelay(100);
1815 outw(HCCR_RESET, host->io_port + HOST_HCCR);
1816 udelay(100);
1817 outw(HCCR_RELEASE, host->io_port + HOST_HCCR);
1818 outw(HCCR_BIOS_DISABLE, host->io_port + HOST_HCCR);
1819
1820 loop_count = DEFAULT_LOOP_COUNT;
1821 while (--loop_count && inw(host->io_port + HOST_HCCR) == RISC_BUSY) {
1822 barrier();
1823 cpu_relax();
1824 }
1825 if (!loop_count)
1826 printk("qlogicfc%d : reset_hardware loop timeout\n", hostdata->host_id);
1827
1828
1829
1830#if DEBUG_ISP2x00
1831 printk("qlogicfc%d : mbox 0 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX0));
1832 printk("qlogicfc%d : mbox 1 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX1));
1833 printk("qlogicfc%d : mbox 2 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX2));
1834 printk("qlogicfc%d : mbox 3 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX3));
1835 printk("qlogicfc%d : mbox 4 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX4));
1836 printk("qlogicfc%d : mbox 5 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX5));
1837 printk("qlogicfc%d : mbox 6 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX6));
1838 printk("qlogicfc%d : mbox 7 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX7));
1839#endif /* DEBUG_ISP2x00 */
1840
1841 DEBUG(printk("qlogicfc%d : verifying checksum\n", hostdata->host_id));
1842
1843#if defined(CONFIG_SCSI_QLOGIC_FC_FIRMWARE)
1844 {
1845 int i;
1846 unsigned short * risc_code = NULL;
1847 unsigned short risc_code_len = 0;
1848 if (hostdata->pci_dev->device == PCI_DEVICE_ID_QLOGIC_ISP2100){
1849 risc_code = risc_code2100;
1850 risc_code_len = risc_code_length2100;
1851 }
1852 else if (hostdata->pci_dev->device == PCI_DEVICE_ID_QLOGIC_ISP2200){
1853 risc_code = risc_code2200;
1854 risc_code_len = risc_code_length2200;
1855 }
1856
1857 for (i = 0; i < risc_code_len; i++) {
1858 param[0] = MBOX_WRITE_RAM_WORD;
1859 param[1] = risc_code_addr01 + i;
1860 param[2] = risc_code[i];
1861
1862 isp2x00_mbox_command(host, param);
1863
1864 if (param[0] != MBOX_COMMAND_COMPLETE) {
1865 printk("qlogicfc%d : firmware load failure\n", hostdata->host_id);
1866 return 1;
1867 }
1868 }
1869 }
1870#endif /* RELOAD_FIRMWARE */
1871
1872 param[0] = MBOX_VERIFY_CHECKSUM;
1873 param[1] = risc_code_addr01;
1874
1875 isp2x00_mbox_command(host, param);
1876
1877 if (param[0] != MBOX_COMMAND_COMPLETE) {
1878 printk("qlogicfc%d : ram checksum failure\n", hostdata->host_id);
1879 return 1;
1880 }
1881 DEBUG(printk("qlogicfc%d : executing firmware\n", hostdata->host_id));
1882
1883 param[0] = MBOX_EXEC_FIRMWARE;
1884 param[1] = risc_code_addr01;
1885
1886 isp2x00_mbox_command(host, param);
1887
1888 param[0] = MBOX_ABOUT_FIRMWARE;
1889
1890 isp2x00_mbox_command(host, param);
1891
1892 if (param[0] != MBOX_COMMAND_COMPLETE) {
1893 printk("qlogicfc%d : about firmware failure\n", hostdata->host_id);
1894 return 1;
1895 }
1896 DEBUG(printk("qlogicfc%d : firmware major revision %d\n", hostdata->host_id, param[1]));
1897 DEBUG(printk("qlogicfc%d : firmware minor revision %d\n", hostdata->host_id, param[2]));
1898
1899#ifdef USE_NVRAM_DEFAULTS
1900
1901 if (isp2x00_get_nvram_defaults(host, &hostdata->control_block) != 0) {
1902 printk("qlogicfc%d : Could not read from NVRAM\n", hostdata->host_id);
1903 }
1904#endif
1905
1906 hostdata->wwn = (u64) (cpu_to_le16(hostdata->control_block.node_name[0])) << 56;
1907 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[0]) & 0xff00) << 48;
1908 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[1]) & 0xff00) << 24;
1909 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[1]) & 0x00ff) << 48;
1910 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[2]) & 0x00ff) << 24;
1911 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[2]) & 0xff00) << 8;
1912 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[3]) & 0x00ff) << 8;
1913 hostdata->wwn |= (u64) (cpu_to_le16(hostdata->control_block.node_name[3]) & 0xff00) >> 8;
1914
1915 /* FIXME: If the DMA transfer goes one way only, this should use
1916 * PCI_DMA_TODEVICE and below as well.
1917 */
1918 busaddr = pci_map_page(hostdata->pci_dev,
1919 virt_to_page(&hostdata->control_block),
1920 offset_in_page(&hostdata->control_block),
1921 sizeof(hostdata->control_block),
1922 PCI_DMA_BIDIRECTIONAL);
1923
1924 param[0] = MBOX_INIT_FIRMWARE;
1925 param[2] = (u_short) (pci64_dma_lo32(busaddr) >> 16);
1926 param[3] = (u_short) (pci64_dma_lo32(busaddr) & 0xffff);
1927 param[4] = 0;
1928 param[5] = 0;
1929 param[6] = (u_short) (pci64_dma_hi32(busaddr) >> 16);
1930 param[7] = (u_short) (pci64_dma_hi32(busaddr) & 0xffff);
1931 isp2x00_mbox_command(host, param);
1932 if (param[0] != MBOX_COMMAND_COMPLETE) {
1933 printk("qlogicfc%d.c: Ouch 0x%04x\n", hostdata->host_id, param[0]);
1934 pci_unmap_page(hostdata->pci_dev, busaddr,
1935 sizeof(hostdata->control_block),
1936 PCI_DMA_BIDIRECTIONAL);
1937 return 1;
1938 }
1939 param[0] = MBOX_GET_FIRMWARE_STATE;
1940 isp2x00_mbox_command(host, param);
1941 if (param[0] != MBOX_COMMAND_COMPLETE) {
1942 printk("qlogicfc%d.c: 0x%04x\n", hostdata->host_id, param[0]);
1943 pci_unmap_page(hostdata->pci_dev, busaddr,
1944 sizeof(hostdata->control_block),
1945 PCI_DMA_BIDIRECTIONAL);
1946 return 1;
1947 }
1948
1949 pci_unmap_page(hostdata->pci_dev, busaddr,
1950 sizeof(hostdata->control_block),
1951 PCI_DMA_BIDIRECTIONAL);
1952 LEAVE("isp2x00_reset_hardware");
1953
1954 return 0;
1955}
1956
1957#ifdef USE_NVRAM_DEFAULTS
1958
1959static int isp2x00_get_nvram_defaults(struct Scsi_Host *host, struct init_cb *control_block)
1960{
1961
1962 u_short value;
1963 if (isp2x00_read_nvram_word(host, 0) != 0x5349)
1964 return 1;
1965
1966 value = isp2x00_read_nvram_word(host, 8);
1967 control_block->node_name[0] = cpu_to_le16(isp2x00_read_nvram_word(host, 9));
1968 control_block->node_name[1] = cpu_to_le16(isp2x00_read_nvram_word(host, 10));
1969 control_block->node_name[2] = cpu_to_le16(isp2x00_read_nvram_word(host, 11));
1970 control_block->node_name[3] = cpu_to_le16(isp2x00_read_nvram_word(host, 12));
1971 control_block->hard_addr = cpu_to_le16(isp2x00_read_nvram_word(host, 13));
1972
1973 return 0;
1974
1975}
1976
1977#endif
1978
1979static int isp2x00_init(struct Scsi_Host *sh)
1980{
1981 u_long io_base;
1982 struct isp2x00_hostdata *hostdata;
1983 u_char revision;
1984 u_int irq;
1985 u_short command;
1986 struct pci_dev *pdev;
1987
1988
1989 ENTER("isp2x00_init");
1990
1991 hostdata = (struct isp2x00_hostdata *) sh->hostdata;
1992 pdev = hostdata->pci_dev;
1993
1994 if (pci_read_config_word(pdev, PCI_COMMAND, &command)
1995 || pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision)) {
1996 printk("qlogicfc%d : error reading PCI configuration\n", hostdata->host_id);
1997 return 1;
1998 }
1999 io_base = pci_resource_start(pdev, 0);
2000 irq = pdev->irq;
2001
2002
2003 if (pdev->vendor != PCI_VENDOR_ID_QLOGIC) {
2004 printk("qlogicfc%d : 0x%04x is not QLogic vendor ID\n", hostdata->host_id,
2005 pdev->vendor);
2006 return 1;
2007 }
2008 if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2100 && pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2200) {
2009 printk("qlogicfc%d : 0x%04x does not match ISP2100 or ISP2200 device id\n", hostdata->host_id,
2010 pdev->device);
2011 return 1;
2012 }
2013 if (!(command & PCI_COMMAND_IO) ||
2014 !(pdev->resource[0].flags & IORESOURCE_IO)) {
2015 printk("qlogicfc%d : i/o mapping is disabled\n", hostdata->host_id);
2016 return 1;
2017 }
2018
2019 pci_set_master(pdev);
2020 if (revision != ISP2100_REV_ID1 && revision != ISP2100_REV_ID3 && revision != ISP2200_REV_ID5)
2021 printk("qlogicfc%d : new isp2x00 revision ID (%d)\n", hostdata->host_id, revision);
2022
2023
2024 hostdata->revision = revision;
2025
2026 sh->irq = irq;
2027 sh->io_port = io_base;
2028
2029 LEAVE("isp2x00_init");
2030
2031 return 0;
2032}
2033
2034#if USE_NVRAM_DEFAULTS
2035
2036#define NVRAM_DELAY() udelay(10) /* 10 microsecond delay */
2037
2038
2039u_short isp2x00_read_nvram_word(struct Scsi_Host * host, u_short byte)
2040{
2041 int i;
2042 u_short value, output, input;
2043
2044 outw(0x2, host->io_port + PCI_NVRAM);
2045 NVRAM_DELAY();
2046 outw(0x3, host->io_port + PCI_NVRAM);
2047 NVRAM_DELAY();
2048
2049 byte &= 0xff;
2050 byte |= 0x0600;
2051 for (i = 10; i >= 0; i--) {
2052 output = ((byte >> i) & 0x1) ? 0x4 : 0x0;
2053 outw(output | 0x2, host->io_port + PCI_NVRAM);
2054 NVRAM_DELAY();
2055 outw(output | 0x3, host->io_port + PCI_NVRAM);
2056 NVRAM_DELAY();
2057 outw(output | 0x2, host->io_port + PCI_NVRAM);
2058 NVRAM_DELAY();
2059 }
2060
2061 for (i = 0xf, value = 0; i >= 0; i--) {
2062 value <<= 1;
2063 outw(0x3, host->io_port + PCI_NVRAM);
2064 NVRAM_DELAY();
2065 input = inw(host->io_port + PCI_NVRAM);
2066 NVRAM_DELAY();
2067 outw(0x2, host->io_port + PCI_NVRAM);
2068 NVRAM_DELAY();
2069 if (input & 0x8)
2070 value |= 1;
2071 }
2072
2073 outw(0x0, host->io_port + PCI_NVRAM);
2074 NVRAM_DELAY();
2075
2076 return value;
2077}
2078
2079
2080#endif /* USE_NVRAM_DEFAULTS */
2081
2082
2083
2084/*
2085 * currently, this is only called during initialization or abort/reset,
2086 * at which times interrupts are disabled, so polling is OK, I guess...
2087 */
2088static int isp2x00_mbox_command(struct Scsi_Host *host, u_short param[])
2089{
2090 int loop_count;
2091 struct isp2x00_hostdata *hostdata = (struct isp2x00_hostdata *) host->hostdata;
2092
2093 if (mbox_param[param[0]] == 0 || hostdata->adapter_state == AS_FIRMWARE_DEAD)
2094 return 1;
2095
2096 loop_count = DEFAULT_LOOP_COUNT;
2097 while (--loop_count && inw(host->io_port + HOST_HCCR) & 0x0080) {
2098 barrier();
2099 cpu_relax();
2100 }
2101 if (!loop_count) {
2102 printk("qlogicfc%d : mbox_command loop timeout #1\n", hostdata->host_id);
2103 param[0] = 0x4006;
2104 hostdata->adapter_state = AS_FIRMWARE_DEAD;
2105 return 1;
2106 }
2107 hostdata->mbox_done = 0;
2108
2109 if (mbox_param[param[0]] == 0)
2110 printk("qlogicfc%d : invalid mbox command\n", hostdata->host_id);
2111
2112 if (mbox_param[param[0]] & 0x80)
2113 outw(param[7], host->io_port + MBOX7);
2114 if (mbox_param[param[0]] & 0x40)
2115 outw(param[6], host->io_port + MBOX6);
2116 if (mbox_param[param[0]] & 0x20)
2117 outw(param[5], host->io_port + MBOX5);
2118 if (mbox_param[param[0]] & 0x10)
2119 outw(param[4], host->io_port + MBOX4);
2120 if (mbox_param[param[0]] & 0x08)
2121 outw(param[3], host->io_port + MBOX3);
2122 if (mbox_param[param[0]] & 0x04)
2123 outw(param[2], host->io_port + MBOX2);
2124 if (mbox_param[param[0]] & 0x02)
2125 outw(param[1], host->io_port + MBOX1);
2126 if (mbox_param[param[0]] & 0x01)
2127 outw(param[0], host->io_port + MBOX0);
2128
2129
2130 outw(HCCR_SET_HOST_INTR, host->io_port + HOST_HCCR);
2131
2132 while (1) {
2133 loop_count = DEFAULT_LOOP_COUNT;
2134 while (--loop_count && !(inw(host->io_port + PCI_INTER_STS) & 0x08)) {
2135 barrier();
2136 cpu_relax();
2137 }
2138
2139 if (!loop_count) {
2140 hostdata->adapter_state = AS_FIRMWARE_DEAD;
2141 printk("qlogicfc%d : mbox_command loop timeout #2\n", hostdata->host_id);
2142 break;
2143 }
2144 isp2x00_intr_handler(host->irq, host, NULL);
2145
2146 if (hostdata->mbox_done == 1)
2147 break;
2148
2149 }
2150
2151 loop_count = DEFAULT_LOOP_COUNT;
2152 while (--loop_count && inw(host->io_port + MBOX0) == 0x04) {
2153 barrier();
2154 cpu_relax();
2155 }
2156 if (!loop_count)
2157 printk("qlogicfc%d : mbox_command loop timeout #3\n", hostdata->host_id);
2158
2159 param[7] = inw(host->io_port + MBOX7);
2160 param[6] = inw(host->io_port + MBOX6);
2161 param[5] = inw(host->io_port + MBOX5);
2162 param[4] = inw(host->io_port + MBOX4);
2163 param[3] = inw(host->io_port + MBOX3);
2164 param[2] = inw(host->io_port + MBOX2);
2165 param[1] = inw(host->io_port + MBOX1);
2166 param[0] = inw(host->io_port + MBOX0);
2167
2168
2169 outw(0x0, host->io_port + PCI_SEMAPHORE);
2170
2171 if (inw(host->io_port + HOST_HCCR) & 0x0080) {
2172 hostdata->adapter_state = AS_FIRMWARE_DEAD;
2173 printk("qlogicfc%d : mbox op is still pending\n", hostdata->host_id);
2174 }
2175 return 0;
2176}
2177
2178#if DEBUG_ISP2x00_INTR
2179
2180void isp2x00_print_status_entry(struct Status_Entry *status)
2181{
2182 printk("qlogicfc : entry count = 0x%02x, type = 0x%02x, flags = 0x%02x\n",
2183 status->hdr.entry_cnt, status->hdr.entry_type, status->hdr.flags);
2184 printk("qlogicfc : scsi status = 0x%04x, completion status = 0x%04x\n",
2185 le16_to_cpu(status->scsi_status), le16_to_cpu(status->completion_status));
2186 printk("qlogicfc : state flags = 0x%04x, status flags = 0x%04x\n",
2187 le16_to_cpu(status->state_flags), le16_to_cpu(status->status_flags));
2188 printk("qlogicfc : response info length = 0x%04x, request sense length = 0x%04x\n",
2189 le16_to_cpu(status->res_info_len), le16_to_cpu(status->req_sense_len));
2190 printk("qlogicfc : residual transfer length = 0x%08x, response = 0x%02x\n", le32_to_cpu(status->residual), status->res_info[3]);
2191
2192}
2193
2194#endif /* DEBUG_ISP2x00_INTR */
2195
2196
2197#if DEBUG_ISP2x00
2198
2199void isp2x00_print_scsi_cmd(Scsi_Cmnd * cmd)
2200{
2201 int i;
2202
2203 printk("qlogicfc : target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n",
2204 cmd->target, cmd->lun, cmd->cmd_len);
2205 printk("qlogicfc : command = ");
2206 for (i = 0; i < cmd->cmd_len; i++)
2207 printk("0x%02x ", cmd->cmnd[i]);
2208 printk("\n");
2209}
2210
2211#endif /* DEBUG_ISP2x00 */
2212
2213MODULE_LICENSE("GPL");
2214
2215static struct scsi_host_template driver_template = {
2216 .detect = isp2x00_detect,
2217 .release = isp2x00_release,
2218 .info = isp2x00_info,
2219 .queuecommand = isp2x00_queuecommand,
2220 .eh_abort_handler = isp2x00_abort,
2221 .bios_param = isp2x00_biosparam,
2222 .can_queue = QLOGICFC_REQ_QUEUE_LEN,
2223 .this_id = -1,
2224 .sg_tablesize = QLOGICFC_MAX_SG(QLOGICFC_REQ_QUEUE_LEN),
2225 .cmd_per_lun = QLOGICFC_CMD_PER_LUN,
2226 .use_clustering = ENABLE_CLUSTERING,
2227};
2228#include "scsi_module.c"
diff --git a/drivers/scsi/qlogicfc_asm.c b/drivers/scsi/qlogicfc_asm.c
deleted file mode 100644
index b1d45102d388..000000000000
--- a/drivers/scsi/qlogicfc_asm.c
+++ /dev/null
@@ -1,9751 +0,0 @@
1/************************************************************************
2 * *
3 * --- ISP2100 Fabric Initiator/Target Firmware --- *
4 * with expanded LUN addressing *
5 * and FcTape (FCP-2) support *
6 * *
7 * *
8 ************************************************************************
9 Copyright (C) 2000 and 2001 Qlogic Corporation
10 (www.qlogic.com)
11
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16************************************************************************/
17
18/*
19 * Firmware Version 1.19.16 (10:36 Nov 02, 2000)
20 */
21
22static unsigned short risc_code_addr01 = 0x1000 ;
23
24static unsigned short risc_code_length2100 = 0x9260;
25static unsigned short risc_code2100[] = {
26 0x0078, 0x102d, 0x0000, 0x9260, 0x0000, 0x0001, 0x0013, 0x0010,
27 0x0017, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2031, 0x3939,
28 0x3920, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
29 0x5449, 0x4f4e, 0x2049, 0x5350, 0x3231, 0x3030, 0x2046, 0x6972,
30 0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
31 0x312e, 0x3139, 0x2020, 0x2020, 0x2400, 0x2091, 0x2000, 0x20c1,
32 0x0021, 0x2039, 0xffff, 0x2019, 0xaaaa, 0x2760, 0x2069, 0x7fff,
33 0x20c1, 0x0020, 0x2c2c, 0x2d34, 0x2762, 0x236a, 0x2c24, 0x2d04,
34 0x266a, 0x2562, 0xa406, 0x00c0, 0x1052, 0x20c1, 0x0021, 0x2c2c,
35 0x2362, 0x2c04, 0x2562, 0xa306, 0x0040, 0x1052, 0x20c1, 0x0020,
36 0x2039, 0x8fff, 0x20a1, 0xaa00, 0x2708, 0x810d, 0x810d, 0x810d,
37 0x810d, 0xa18c, 0x000f, 0x2001, 0x000a, 0xa112, 0xa00e, 0x21a8,
38 0x41a4, 0x3400, 0x8211, 0x00c0, 0x105f, 0x2708, 0x3400, 0xa102,
39 0x0040, 0x106f, 0x0048, 0x106f, 0x20a8, 0xa00e, 0x41a4, 0x20a1,
40 0xa260, 0x2009, 0x0000, 0x20a9, 0x07a0, 0x41a4, 0x3400, 0x20c9,
41 0xa7ff, 0x2059, 0x0000, 0x2b78, 0x7823, 0x0004, 0x2089, 0x255d,
42 0x2051, 0xa300, 0x2a70, 0x775e, 0xa786, 0x8fff, 0x0040, 0x1092,
43 0x705b, 0xca00, 0x7057, 0xc9f1, 0x7063, 0x0200, 0x7067, 0x0200,
44 0x0078, 0x109a, 0x7057, 0xba01, 0x7063, 0x0100, 0x7067, 0x0100,
45 0x705b, 0xba00, 0x1078, 0x12df, 0x1078, 0x13c0, 0x1078, 0x1569,
46 0x1078, 0x1ca4, 0x1078, 0x4229, 0x1078, 0x74cf, 0x1078, 0x134b,
47 0x1078, 0x2a3f, 0x1078, 0x4da2, 0x1078, 0x48b2, 0x1078, 0x57df,
48 0x1078, 0x21f7, 0x1078, 0x5abf, 0x1078, 0x5369, 0x1078, 0x210d,
49 0x1078, 0x21d4, 0x2091, 0x3009, 0x7823, 0x0000, 0x0090, 0x10cf,
50 0x7820, 0xa086, 0x0002, 0x00c0, 0x10cf, 0x7823, 0x4000, 0x0068,
51 0x10c7, 0x781b, 0x0001, 0x2091, 0x5000, 0x2091, 0x4080, 0x2a70,
52 0x7003, 0x0000, 0x2001, 0x017f, 0x2003, 0x0000, 0x2a70, 0x7000,
53 0xa08e, 0x0003, 0x00c0, 0x10ef, 0x1078, 0x35bc, 0x1078, 0x2a67,
54 0x1078, 0x4df2, 0x1078, 0x4a75, 0x2009, 0x0100, 0x2104, 0xa082,
55 0x0002, 0x0048, 0x10f3, 0x1078, 0x57fb, 0x0078, 0x10d6, 0x1079,
56 0x10f7, 0x0078, 0x10dc, 0x1078, 0x6fa9, 0x0078, 0x10eb, 0x1101,
57 0x1102, 0x11be, 0x10ff, 0x1246, 0x12dc, 0x12dd, 0x12de, 0x1078,
58 0x1328, 0x007c, 0x127e, 0x0f7e, 0x2091, 0x8000, 0x7000, 0xa086,
59 0x0001, 0x00c0, 0x1198, 0x1078, 0x3a43, 0x2079, 0x0100, 0x7844,
60 0xa005, 0x00c0, 0x1198, 0x2011, 0x4129, 0x1078, 0x58d4, 0x1078,
61 0x1ab1, 0x780f, 0x00ff, 0x7840, 0xa084, 0xfffb, 0x7842, 0x2011,
62 0x8010, 0x73c0, 0x1078, 0x3579, 0x2001, 0xffff, 0x1078, 0x5975,
63 0x7238, 0xc284, 0x723a, 0x2001, 0xa30c, 0x2014, 0xc2ac, 0x2202,
64 0x1078, 0x6db5, 0x2011, 0x0004, 0x1078, 0x8a59, 0x1078, 0x47ce,
65 0x1078, 0x4211, 0x0040, 0x1144, 0x7083, 0x0001, 0x70bb, 0x0000,
66 0x1078, 0x3bf5, 0x0078, 0x1198, 0x1078, 0x4897, 0x0040, 0x114d,
67 0x7a0c, 0xc2b4, 0x7a0e, 0x0078, 0x1159, 0x1078, 0x8ddf, 0x70c8,
68 0xd09c, 0x00c0, 0x1159, 0x7094, 0xa005, 0x0040, 0x1159, 0x1078,
69 0x41f5, 0x70d3, 0x0000, 0x70cf, 0x0000, 0x72c8, 0x2079, 0xa351,
70 0x7804, 0xd0ac, 0x0040, 0x1165, 0xc295, 0x72ca, 0xa296, 0x0004,
71 0x0040, 0x1186, 0x2011, 0x0001, 0x1078, 0x8a59, 0x708f, 0x0000,
72 0x7093, 0xffff, 0x7003, 0x0002, 0x0f7f, 0x1078, 0x260d, 0x2011,
73 0x0005, 0x1078, 0x6ef2, 0x1078, 0x6109, 0x0c7e, 0x2061, 0x0100,
74 0x60e3, 0x0008, 0x0c7f, 0x127f, 0x0078, 0x119a, 0x708f, 0x0000,
75 0x7093, 0xffff, 0x7003, 0x0002, 0x2011, 0x0005, 0x1078, 0x6ef2,
76 0x1078, 0x6109, 0x0c7e, 0x2061, 0x0100, 0x60e3, 0x0008, 0x0c7f,
77 0x0f7f, 0x127f, 0x007c, 0x0c7e, 0x20a9, 0x0082, 0x2009, 0x007e,
78 0x017e, 0x027e, 0x037e, 0x2110, 0x027e, 0x2019, 0x0029, 0x1078,
79 0x71e0, 0x027f, 0x1078, 0xa190, 0x037f, 0x027f, 0x017f, 0x1078,
80 0x2921, 0x8108, 0x00f0, 0x11a0, 0x0c7f, 0x706b, 0x0000, 0x706c,
81 0xa084, 0x00ff, 0x706e, 0x7097, 0x0000, 0x007c, 0x127e, 0x2091,
82 0x8000, 0x7000, 0xa086, 0x0002, 0x00c0, 0x1244, 0x7090, 0xa086,
83 0xffff, 0x0040, 0x11d1, 0x1078, 0x260d, 0x1078, 0x6109, 0x0078,
84 0x1244, 0x70c8, 0xd09c, 0x0040, 0x11fd, 0xd084, 0x0040, 0x11fd,
85 0x0f7e, 0x2079, 0x0100, 0x790c, 0xc1b5, 0x790e, 0x0f7f, 0xd08c,
86 0x0040, 0x11fd, 0x70cc, 0xa086, 0xffff, 0x0040, 0x11f9, 0x1078,
87 0x278a, 0x1078, 0x6109, 0x70c8, 0xd094, 0x00c0, 0x1244, 0x2011,
88 0x0001, 0x2019, 0x0000, 0x1078, 0x27c2, 0x1078, 0x6109, 0x0078,
89 0x1244, 0x70d0, 0xa005, 0x00c0, 0x1244, 0x708c, 0xa005, 0x00c0,
90 0x1244, 0x1078, 0x4897, 0x00c0, 0x1244, 0x2001, 0xa352, 0x2004,
91 0xd0ac, 0x0040, 0x1227, 0x157e, 0x0c7e, 0x20a9, 0x007f, 0x2009,
92 0x0000, 0x017e, 0x1078, 0x4501, 0x00c0, 0x121a, 0x6000, 0xd0ec,
93 0x00c0, 0x1222, 0x017f, 0x8108, 0x00f0, 0x1211, 0x0c7f, 0x157f,
94 0x0078, 0x1227, 0x017f, 0x0c7f, 0x157f, 0x0078, 0x1244, 0x7003,
95 0x0003, 0x7093, 0xffff, 0x2001, 0x0000, 0x1078, 0x2480, 0x1078,
96 0x35f7, 0x2001, 0xa5ac, 0x2004, 0xa086, 0x0005, 0x00c0, 0x123c,
97 0x2011, 0x0000, 0x1078, 0x6ef2, 0x2011, 0x0000, 0x1078, 0x6efc,
98 0x1078, 0x6109, 0x1078, 0x61d3, 0x127f, 0x007c, 0x017e, 0x0f7e,
99 0x127e, 0x2091, 0x8000, 0x2079, 0x0100, 0x2009, 0x00f7, 0x1078,
100 0x41de, 0x7940, 0xa18c, 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0040,
101 0x125b, 0x7827, 0x0040, 0xd19c, 0x0040, 0x1260, 0x7827, 0x0008,
102 0x007e, 0x037e, 0x157e, 0xa006, 0x1078, 0x5975, 0x7900, 0xa18a,
103 0x0003, 0x0050, 0x1289, 0x7954, 0xd1ac, 0x00c0, 0x1289, 0x2009,
104 0x00f8, 0x1078, 0x41de, 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9,
105 0x09c4, 0x7820, 0xd09c, 0x00c0, 0x1281, 0x7824, 0xd0ac, 0x00c0,
106 0x12ca, 0x00f0, 0x1279, 0x2001, 0x0001, 0x1078, 0x2480, 0x0078,
107 0x12d5, 0x7853, 0x0000, 0x782f, 0x0020, 0x20a9, 0x0050, 0x00e0,
108 0x128f, 0x2091, 0x6000, 0x00f0, 0x128f, 0x7853, 0x0400, 0x782f,
109 0x0000, 0x2009, 0x00f8, 0x1078, 0x41de, 0x20a9, 0x000e, 0x0005,
110 0x00f0, 0x129f, 0x7853, 0x1400, 0x7843, 0x0090, 0x7843, 0x0010,
111 0x2019, 0x61a8, 0x7854, 0x0005, 0x0005, 0xd08c, 0x0040, 0x12b4,
112 0x7824, 0xd0ac, 0x00c0, 0x12ca, 0x8319, 0x00c0, 0x12aa, 0x2009,
113 0xa331, 0x2104, 0x8000, 0x200a, 0xa084, 0xfff0, 0x0040, 0x12c4,
114 0x200b, 0x0000, 0x1078, 0x251e, 0x2001, 0x0001, 0x1078, 0x2480,
115 0x0078, 0x12d3, 0x2001, 0xa331, 0x2003, 0x0000, 0x7828, 0xc09d,
116 0x782a, 0x7827, 0x0048, 0x7853, 0x0400, 0x157f, 0x037f, 0x007f,
117 0x127f, 0x0f7f, 0x017f, 0x007c, 0x007c, 0x007c, 0x007c, 0x2a70,
118 0x2009, 0x0100, 0x2104, 0xa082, 0x0002, 0x0048, 0x12eb, 0x704f,
119 0xffff, 0x0078, 0x12ed, 0x704f, 0x0000, 0x7053, 0xffff, 0x706b,
120 0x0000, 0x706f, 0x0000, 0x1078, 0x8ddf, 0x2061, 0xa58c, 0x6003,
121 0x0909, 0x6007, 0x0000, 0x600b, 0x8800, 0x600f, 0x0200, 0x6013,
122 0x00ff, 0x6017, 0x0003, 0x601b, 0x0000, 0x601f, 0x07d0, 0x2061,
123 0xa594, 0x6003, 0x8000, 0x6007, 0x0000, 0x600b, 0x0000, 0x600f,
124 0x0200, 0x6013, 0x00ff, 0x6017, 0x0000, 0x601b, 0x0001, 0x601f,
125 0x0000, 0x2061, 0xa5a3, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b,
126 0x4943, 0x600f, 0x2020, 0x2001, 0xa325, 0x2003, 0x0000, 0x007c,
127 0x2091, 0x8000, 0x0068, 0x132a, 0x007e, 0x017e, 0x2079, 0x0000,
128 0x7818, 0xd084, 0x00c0, 0x1330, 0x017f, 0x792e, 0x007f, 0x782a,
129 0x007f, 0x7826, 0x3900, 0x783a, 0x7823, 0x8002, 0x781b, 0x0001,
130 0x2091, 0x5000, 0x2091, 0x4080, 0x2079, 0xa300, 0x7803, 0x0005,
131 0x0078, 0x1348, 0x007c, 0x2071, 0xa300, 0x7158, 0x712e, 0x2021,
132 0x0001, 0xa190, 0x002d, 0xa298, 0x002d, 0x0048, 0x1361, 0x705c,
133 0xa302, 0x00c8, 0x1361, 0x220a, 0x2208, 0x2310, 0x8420, 0x0078,
134 0x1353, 0x200b, 0x0000, 0x74a6, 0x74aa, 0x007c, 0x0e7e, 0x127e,
135 0x2091, 0x8000, 0x2071, 0xa300, 0x70a8, 0xa0ea, 0x0010, 0x00c8,
136 0x1374, 0xa06e, 0x0078, 0x137e, 0x8001, 0x70aa, 0x702c, 0x2068,
137 0x2d04, 0x702e, 0x206b, 0x0000, 0x6807, 0x0000, 0x127f, 0x0e7f,
138 0x007c, 0x0e7e, 0x2071, 0xa300, 0x127e, 0x2091, 0x8000, 0x70a8,
139 0x8001, 0x00c8, 0x138e, 0xa06e, 0x0078, 0x1397, 0x70aa, 0x702c,
140 0x2068, 0x2d04, 0x702e, 0x206b, 0x0000, 0x6807, 0x0000, 0x127f,
141 0x0e7f, 0x007c, 0x0e7e, 0x127e, 0x2091, 0x8000, 0x2071, 0xa300,
142 0x702c, 0x206a, 0x2d00, 0x702e, 0x70a8, 0x8000, 0x70aa, 0x127f,
143 0x0e7f, 0x007c, 0x8dff, 0x0040, 0x13b6, 0x6804, 0x6807, 0x0000,
144 0x007e, 0x1078, 0x139a, 0x0d7f, 0x0078, 0x13aa, 0x007c, 0x0e7e,
145 0x2071, 0xa300, 0x70a8, 0xa08a, 0x0010, 0xa00d, 0x0e7f, 0x007c,
146 0x0e7e, 0x2071, 0xa5d0, 0x7007, 0x0000, 0x701b, 0x0000, 0x701f,
147 0x0000, 0x2071, 0x0000, 0x7010, 0xa085, 0x8004, 0x7012, 0x0e7f,
148 0x007c, 0x0e7e, 0x2270, 0x700b, 0x0000, 0x2071, 0xa5d0, 0x7018,
149 0xa088, 0xa5d9, 0x220a, 0x8000, 0xa084, 0x0007, 0x701a, 0x7004,
150 0xa005, 0x00c0, 0x13e9, 0x0f7e, 0x2079, 0x0010, 0x1078, 0x13fa,
151 0x0f7f, 0x0e7f, 0x007c, 0x0e7e, 0x2071, 0xa5d0, 0x7004, 0xa005,
152 0x00c0, 0x13f8, 0x0f7e, 0x2079, 0x0010, 0x1078, 0x13fa, 0x0f7f,
153 0x0e7f, 0x007c, 0x7000, 0x0079, 0x13fd, 0x1401, 0x146b, 0x1488,
154 0x1488, 0x7018, 0x711c, 0xa106, 0x00c0, 0x1409, 0x7007, 0x0000,
155 0x007c, 0x0d7e, 0xa180, 0xa5d9, 0x2004, 0x700a, 0x2068, 0x8108,
156 0xa18c, 0x0007, 0x711e, 0x7803, 0x0026, 0x6824, 0x7832, 0x6828,
157 0x7836, 0x682c, 0x783a, 0x6830, 0x783e, 0x6810, 0x700e, 0x680c,
158 0x7016, 0x6804, 0x0d7f, 0xd084, 0x0040, 0x142b, 0x7007, 0x0001,
159 0x1078, 0x1430, 0x007c, 0x7007, 0x0002, 0x1078, 0x1446, 0x007c,
160 0x017e, 0x027e, 0x710c, 0x2011, 0x0040, 0xa182, 0x0040, 0x00c8,
161 0x143b, 0x2110, 0xa006, 0x700e, 0x7212, 0x8203, 0x7822, 0x7803,
162 0x0020, 0x7803, 0x0041, 0x027f, 0x017f, 0x007c, 0x017e, 0x027e,
163 0x137e, 0x147e, 0x157e, 0x7014, 0x2098, 0x20a1, 0x0014, 0x7803,
164 0x0026, 0x710c, 0x2011, 0x0040, 0xa182, 0x0040, 0x00c8, 0x145a,
165 0x2110, 0xa006, 0x700e, 0x22a8, 0x53a6, 0x8203, 0x7822, 0x7803,
166 0x0020, 0x3300, 0x7016, 0x7803, 0x0001, 0x157f, 0x147f, 0x137f,
167 0x027f, 0x017f, 0x007c, 0x137e, 0x147e, 0x157e, 0x2099, 0xa3f9,
168 0x20a1, 0x0018, 0x20a9, 0x0008, 0x53a3, 0x7803, 0x0020, 0x127e,
169 0x2091, 0x8000, 0x7803, 0x0041, 0x7007, 0x0003, 0x7000, 0xc084,
170 0x7002, 0x700b, 0xa3f4, 0x127f, 0x157f, 0x147f, 0x137f, 0x007c,
171 0x137e, 0x147e, 0x157e, 0x2001, 0xa428, 0x209c, 0x20a1, 0x0014,
172 0x7803, 0x0026, 0x2001, 0xa429, 0x20ac, 0x53a6, 0x2099, 0xa42a,
173 0x20a1, 0x0018, 0x20a9, 0x0008, 0x53a3, 0x7803, 0x0020, 0x127e,
174 0x2091, 0x8000, 0x7803, 0x0001, 0x7007, 0x0004, 0x7000, 0xc08c,
175 0x7002, 0x700b, 0xa425, 0x127f, 0x157f, 0x147f, 0x137f, 0x007c,
176 0x017e, 0x0e7e, 0x2071, 0xa5d0, 0x0f7e, 0x2079, 0x0010, 0x7904,
177 0x7803, 0x0002, 0xd1fc, 0x0040, 0x14c2, 0xa18c, 0x0700, 0x7004,
178 0x1079, 0x14c6, 0x0f7f, 0x0e7f, 0x017f, 0x007c, 0x13fa, 0x14ce,
179 0x14fb, 0x1523, 0x1556, 0x14cc, 0x0078, 0x14cc, 0xa18c, 0x0700,
180 0x00c0, 0x14f4, 0x137e, 0x147e, 0x157e, 0x7014, 0x20a0, 0x2099,
181 0x0014, 0x7803, 0x0040, 0x7010, 0x20a8, 0x53a5, 0x3400, 0x7016,
182 0x157f, 0x147f, 0x137f, 0x700c, 0xa005, 0x0040, 0x1510, 0x1078,
183 0x1430, 0x007c, 0x7008, 0xa080, 0x0002, 0x2003, 0x0100, 0x7007,
184 0x0000, 0x1078, 0x13fa, 0x007c, 0x7008, 0xa080, 0x0002, 0x2003,
185 0x0200, 0x0078, 0x14ef, 0xa18c, 0x0700, 0x00c0, 0x1506, 0x700c,
186 0xa005, 0x0040, 0x1510, 0x1078, 0x1446, 0x007c, 0x7008, 0xa080,
187 0x0002, 0x2003, 0x0200, 0x7007, 0x0000, 0x1078, 0x13fa, 0x007c,
188 0x0d7e, 0x7008, 0x2068, 0x7830, 0x6826, 0x7834, 0x682a, 0x7838,
189 0x682e, 0x783c, 0x6832, 0x680b, 0x0100, 0x0d7f, 0x7007, 0x0000,
190 0x1078, 0x13fa, 0x007c, 0xa18c, 0x0700, 0x00c0, 0x1550, 0x137e,
191 0x147e, 0x157e, 0x2001, 0xa3f7, 0x2004, 0xa080, 0x000d, 0x20a0,
192 0x2099, 0x0014, 0x7803, 0x0040, 0x20a9, 0x0020, 0x53a5, 0x2001,
193 0xa3f9, 0x2004, 0xd0bc, 0x0040, 0x1546, 0x2001, 0xa402, 0x2004,
194 0xa080, 0x000d, 0x20a0, 0x20a9, 0x0020, 0x53a5, 0x157f, 0x147f,
195 0x137f, 0x7007, 0x0000, 0x1078, 0x4e9b, 0x1078, 0x13fa, 0x007c,
196 0x2011, 0x8003, 0x1078, 0x3579, 0x0078, 0x1554, 0xa18c, 0x0700,
197 0x00c0, 0x1563, 0x2001, 0xa427, 0x2003, 0x0100, 0x7007, 0x0000,
198 0x1078, 0x13fa, 0x007c, 0x2011, 0x8004, 0x1078, 0x3579, 0x0078,
199 0x1567, 0x127e, 0x2091, 0x2100, 0x2079, 0x0030, 0x2071, 0xa5e1,
200 0x7803, 0x0004, 0x7003, 0x0000, 0x700f, 0xa5e7, 0x7013, 0xa5e7,
201 0x780f, 0x0076, 0x7803, 0x0004, 0x127f, 0x007c, 0x6934, 0xa184,
202 0x0007, 0x0079, 0x1583, 0x158b, 0x15d1, 0x158b, 0x158b, 0x158b,
203 0x15b6, 0x159a, 0x158f, 0xa085, 0x0001, 0x0078, 0x15eb, 0x684c,
204 0xd0bc, 0x0040, 0x158b, 0x6860, 0x682e, 0x685c, 0x682a, 0x6858,
205 0x0078, 0x15d9, 0xa18c, 0x00ff, 0xa186, 0x001e, 0x00c0, 0x158b,
206 0x684c, 0xd0bc, 0x0040, 0x158b, 0x6860, 0x682e, 0x685c, 0x682a,
207 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f, 0xa080,
208 0x2015, 0x2004, 0x6832, 0x6858, 0x0078, 0x15e1, 0xa18c, 0x00ff,
209 0xa186, 0x0015, 0x00c0, 0x158b, 0x684c, 0xd0ac, 0x0040, 0x158b,
210 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f, 0xa080,
211 0x2015, 0x2004, 0x6832, 0xa006, 0x682e, 0x682a, 0x6858, 0x0078,
212 0x15e1, 0x684c, 0xd0ac, 0x0040, 0x158b, 0xa006, 0x682e, 0x682a,
213 0x6858, 0xa18c, 0x000f, 0xa188, 0x2015, 0x210c, 0x6932, 0x2d08,
214 0x691a, 0x6826, 0x684c, 0xc0dd, 0x684e, 0xa006, 0x680a, 0x697c,
215 0x6912, 0x6980, 0x6916, 0x007c, 0x20e1, 0x0007, 0x20e1, 0x2000,
216 0x2001, 0x020a, 0x2004, 0x82ff, 0x0040, 0x160e, 0xa280, 0x0004,
217 0x0d7e, 0x206c, 0x684c, 0xd0dc, 0x00c0, 0x160a, 0x1078, 0x157e,
218 0x0040, 0x160a, 0x0d7f, 0xa280, 0x0000, 0x2003, 0x0002, 0xa016,
219 0x0078, 0x160e, 0x6808, 0x8000, 0x680a, 0x0d7f, 0x127e, 0x047e,
220 0x037e, 0x027e, 0x2091, 0x2100, 0x027f, 0x037f, 0x047f, 0x7000,
221 0xa005, 0x00c0, 0x1622, 0x7206, 0x2001, 0x1643, 0x007e, 0x2260,
222 0x0078, 0x17be, 0x710c, 0x220a, 0x8108, 0x230a, 0x8108, 0x240a,
223 0x8108, 0xa182, 0xa602, 0x0048, 0x162f, 0x2009, 0xa5e7, 0x710e,
224 0x7010, 0xa102, 0xa082, 0x0009, 0x0040, 0x163a, 0xa080, 0x001b,
225 0x00c0, 0x163d, 0x2009, 0x0138, 0x200a, 0x7000, 0xa005, 0x00c0,
226 0x1643, 0x1078, 0x179f, 0x127f, 0x007c, 0x127e, 0x027e, 0x037e,
227 0x0c7e, 0x007e, 0x2091, 0x2100, 0x007f, 0x047f, 0x037f, 0x027f,
228 0x0d7e, 0x0c7e, 0x2460, 0x6110, 0x2168, 0x6a62, 0x6b5e, 0xa005,
229 0x0040, 0x16cf, 0x6808, 0xa005, 0x0040, 0x173c, 0x7000, 0xa005,
230 0x00c0, 0x1664, 0x0078, 0x16c4, 0x700c, 0x7110, 0xa106, 0x00c0,
231 0x1745, 0x7004, 0xa406, 0x00c0, 0x16c4, 0x2001, 0x0005, 0x2004,
232 0xd08c, 0x0040, 0x1681, 0x047e, 0x1078, 0x18e2, 0x047f, 0x2460,
233 0x6010, 0xa080, 0x0002, 0x2004, 0xa005, 0x0040, 0x173c, 0x0078,
234 0x165e, 0x2001, 0x0207, 0x2004, 0xd09c, 0x00c0, 0x166d, 0x7804,
235 0xa084, 0x6000, 0x0040, 0x1692, 0xa086, 0x6000, 0x0040, 0x1692,
236 0x0078, 0x166d, 0x7100, 0xa186, 0x0002, 0x00c0, 0x16b2, 0x0e7e,
237 0x2b68, 0x6818, 0x2060, 0x1078, 0x1fea, 0x2804, 0xac70, 0x6034,
238 0xd09c, 0x00c0, 0x16a7, 0x7108, 0x720c, 0x0078, 0x16a9, 0x7110,
239 0x7214, 0x6810, 0xa100, 0x6812, 0x6814, 0xa201, 0x6816, 0x0e7f,
240 0x0078, 0x16b6, 0xa186, 0x0001, 0x00c0, 0x16be, 0x7820, 0x6910,
241 0xa100, 0x6812, 0x7824, 0x6914, 0xa101, 0x6816, 0x7803, 0x0004,
242 0x7003, 0x0000, 0x7004, 0x2060, 0x6100, 0xa18e, 0x0004, 0x00c0,
243 0x1745, 0x2009, 0x0048, 0x1078, 0x756c, 0x0078, 0x1745, 0x6808,
244 0xa005, 0x0040, 0x173c, 0x7000, 0xa005, 0x00c0, 0x16d9, 0x0078,
245 0x173c, 0x700c, 0x7110, 0xa106, 0x00c0, 0x16e2, 0x7004, 0xa406,
246 0x00c0, 0x173c, 0x2001, 0x0005, 0x2004, 0xd08c, 0x0040, 0x16f6,
247 0x047e, 0x1078, 0x18e2, 0x047f, 0x2460, 0x6010, 0xa080, 0x0002,
248 0x2004, 0xa005, 0x0040, 0x173c, 0x0078, 0x16d3, 0x2001, 0x0207,
249 0x2004, 0xd09c, 0x00c0, 0x16e2, 0x2001, 0x0005, 0x2004, 0xd08c,
250 0x00c0, 0x16e8, 0x7804, 0xa084, 0x6000, 0x0040, 0x170d, 0xa086,
251 0x6000, 0x0040, 0x170d, 0x0078, 0x16e2, 0x7007, 0x0000, 0xa016,
252 0x2218, 0x7000, 0xa08e, 0x0001, 0x0040, 0x172e, 0xa08e, 0x0002,
253 0x00c0, 0x173c, 0x0c7e, 0x0e7e, 0x6818, 0x2060, 0x1078, 0x1fea,
254 0x2804, 0xac70, 0x6034, 0xd09c, 0x00c0, 0x172a, 0x7308, 0x720c,
255 0x0078, 0x172c, 0x7310, 0x7214, 0x0e7f, 0x0c7f, 0x7820, 0xa318,
256 0x7824, 0xa211, 0x6810, 0xa300, 0x6812, 0x6814, 0xa201, 0x6816,
257 0x7803, 0x0004, 0x7003, 0x0000, 0x6100, 0xa18e, 0x0004, 0x00c0,
258 0x1745, 0x2009, 0x0048, 0x1078, 0x756c, 0x0c7f, 0x0d7f, 0x127f,
259 0x007c, 0x0f7e, 0x0e7e, 0x027e, 0x037e, 0x047e, 0x1078, 0x1af7,
260 0x027e, 0x2071, 0xa5e1, 0x7000, 0xa086, 0x0000, 0x0040, 0x1790,
261 0x7004, 0xac06, 0x00c0, 0x1781, 0x2079, 0x0030, 0x7000, 0xa086,
262 0x0003, 0x0040, 0x1781, 0x7804, 0xd0fc, 0x00c0, 0x177d, 0x2001,
263 0x0207, 0x2004, 0xd09c, 0x00c0, 0x1763, 0x7803, 0x0004, 0x7804,
264 0xd0ac, 0x00c0, 0x176f, 0x7803, 0x0002, 0x7803, 0x0009, 0x7003,
265 0x0003, 0x7007, 0x0000, 0x0078, 0x1781, 0x1078, 0x18e2, 0x0078,
266 0x1753, 0x157e, 0x20a9, 0x0009, 0x2009, 0xa5e7, 0x2104, 0xac06,
267 0x00c0, 0x178b, 0x200a, 0xa188, 0x0003, 0x00f0, 0x1786, 0x157f,
268 0x027f, 0x2001, 0x015d, 0x201c, 0x831a, 0x2302, 0x2001, 0x0138,
269 0x2202, 0x047f, 0x037f, 0x027f, 0x0e7f, 0x0f7f, 0x007c, 0x700c,
270 0x7110, 0xa106, 0x00c0, 0x17a7, 0x7003, 0x0000, 0x007c, 0x2104,
271 0x7006, 0x2060, 0x8108, 0x211c, 0x8108, 0x2124, 0x8108, 0xa182,
272 0xa602, 0x0048, 0x17b5, 0x2009, 0xa5e7, 0x7112, 0x700c, 0xa106,
273 0x00c0, 0x17be, 0x2001, 0x0138, 0x2003, 0x0008, 0x8cff, 0x00c0,
274 0x17c5, 0x1078, 0x1b22, 0x0078, 0x1823, 0x6010, 0x2068, 0x2d58,
275 0x6828, 0xa406, 0x00c0, 0x17d0, 0x682c, 0xa306, 0x0040, 0x17fe,
276 0x601c, 0xa086, 0x0008, 0x0040, 0x17fe, 0x6024, 0xd0f4, 0x00c0,
277 0x17fa, 0xd0d4, 0x0040, 0x17f6, 0x6038, 0xa402, 0x6034, 0xa303,
278 0x0040, 0x17e4, 0x00c8, 0x17f6, 0x643a, 0x6336, 0x6c2a, 0x6b2e,
279 0x047e, 0x037e, 0x2400, 0x6c7c, 0xa402, 0x6812, 0x2300, 0x6b80,
280 0xa303, 0x6816, 0x037f, 0x047f, 0x0078, 0x17fa, 0x1078, 0x8d8e,
281 0x0040, 0x17c1, 0x1078, 0x2035, 0x00c0, 0x17c1, 0x0c7e, 0x7004,
282 0x2060, 0x6024, 0xc0d4, 0x6026, 0x0c7f, 0x684c, 0xd0f4, 0x0040,
283 0x180f, 0x6817, 0xffff, 0x6813, 0xffff, 0x0078, 0x17c1, 0x6824,
284 0x2050, 0x6818, 0x2060, 0x6830, 0x2040, 0x6034, 0xa0cc, 0x000f,
285 0x2009, 0x0011, 0x1078, 0x1824, 0x0040, 0x1822, 0x2009, 0x0001,
286 0x1078, 0x1824, 0x2d58, 0x007c, 0x8aff, 0x0040, 0x18bb, 0xa03e,
287 0x2730, 0x6850, 0xd0fc, 0x00c0, 0x1846, 0xd0f4, 0x00c0, 0x1856,
288 0x0d7e, 0x2804, 0xac68, 0x2900, 0x0079, 0x1836, 0x189d, 0x185d,
289 0x185d, 0x189d, 0x189d, 0x1895, 0x189d, 0x185d, 0x189d, 0x1863,
290 0x1863, 0x189d, 0x189d, 0x189d, 0x188c, 0x1863, 0xc0fc, 0x6852,
291 0x6b6c, 0x6a70, 0x6d1c, 0x6c20, 0x0d7e, 0xd99c, 0x0040, 0x18a0,
292 0x2804, 0xac68, 0x6f08, 0x6e0c, 0x0078, 0x18a0, 0xc0f4, 0x6852,
293 0x6b6c, 0x6a70, 0x0d7e, 0x0078, 0x18a7, 0x6b08, 0x6a0c, 0x6d00,
294 0x6c04, 0x0078, 0x18a0, 0x7b0c, 0xd3bc, 0x0040, 0x1884, 0x7004,
295 0x0e7e, 0x2070, 0x701c, 0x0e7f, 0xa086, 0x0008, 0x00c0, 0x1884,
296 0x7b08, 0xa39c, 0x0fff, 0x2d20, 0x0d7f, 0x0d7e, 0x6a14, 0x82ff,
297 0x00c0, 0x187f, 0x6810, 0xa302, 0x0048, 0x187f, 0x6b10, 0x2011,
298 0x0000, 0x2468, 0x0078, 0x1886, 0x6b10, 0x6a14, 0x6d00, 0x6c04,
299 0x6f08, 0x6e0c, 0x0078, 0x18a0, 0x0d7f, 0x0d7e, 0x6834, 0xa084,
300 0x00ff, 0xa086, 0x001e, 0x00c0, 0x189d, 0x0d7f, 0x1078, 0x1fd1,
301 0x00c0, 0x1824, 0xa00e, 0x0078, 0x18bb, 0x0d7f, 0x1078, 0x1328,
302 0x7b22, 0x7a26, 0x7d32, 0x7c36, 0x7f3a, 0x7e3e, 0x7902, 0x7000,
303 0x8000, 0x7002, 0x0d7f, 0x6828, 0xa300, 0x682a, 0x682c, 0xa201,
304 0x682e, 0x2300, 0x6b10, 0xa302, 0x6812, 0x2200, 0x6a14, 0xa203,
305 0x6816, 0x1078, 0x1fd1, 0x007c, 0x1078, 0x1328, 0x1078, 0x1c52,
306 0x7004, 0x2060, 0x0d7e, 0x6010, 0x2068, 0x7003, 0x0000, 0x1078,
307 0x1ac6, 0x1078, 0x8a44, 0x0040, 0x18db, 0x6808, 0x8001, 0x680a,
308 0x697c, 0x6912, 0x6980, 0x6916, 0x682b, 0xffff, 0x682f, 0xffff,
309 0x6850, 0xc0bd, 0x6852, 0x0d7f, 0x1078, 0x8758, 0x0078, 0x1aad,
310 0x1078, 0x1328, 0x127e, 0x2091, 0x2100, 0x007e, 0x017e, 0x2b68,
311 0x6818, 0x2060, 0x7904, 0x7803, 0x0002, 0xa184, 0x0700, 0x00c0,
312 0x18be, 0xa184, 0x0003, 0xa086, 0x0003, 0x0040, 0x18e0, 0x7000,
313 0x0079, 0x18fa, 0x1902, 0x1904, 0x1a06, 0x1a84, 0x1a9b, 0x1902,
314 0x1902, 0x1902, 0x1078, 0x1328, 0x8001, 0x7002, 0xa184, 0x0880,
315 0x00c0, 0x1919, 0x8aff, 0x0040, 0x199b, 0x2009, 0x0001, 0x1078,
316 0x1824, 0x0040, 0x1aad, 0x2009, 0x0001, 0x1078, 0x1824, 0x0078,
317 0x1aad, 0x7803, 0x0004, 0x7003, 0x0000, 0xd1bc, 0x00c0, 0x1979,
318 0x027e, 0x037e, 0x7808, 0xd0ec, 0x00c0, 0x1930, 0x7c20, 0x7d24,
319 0x7e30, 0x7f34, 0x7803, 0x0009, 0x7003, 0x0004, 0x0078, 0x1932,
320 0x1078, 0x1b9f, 0x6b28, 0x6a2c, 0x2400, 0x686e, 0xa31a, 0x2500,
321 0x6872, 0xa213, 0x6b2a, 0x6a2e, 0x0c7e, 0x7004, 0x2060, 0x6024,
322 0xd0f4, 0x00c0, 0x1945, 0x633a, 0x6236, 0x0c7f, 0x2400, 0x6910,
323 0xa100, 0x6812, 0x2500, 0x6914, 0xa101, 0x6816, 0x037f, 0x027f,
324 0x2600, 0x681e, 0x2700, 0x6822, 0x1078, 0x1fea, 0x2a00, 0x6826,
325 0x2c00, 0x681a, 0x2800, 0x6832, 0x6850, 0xc0fd, 0x6852, 0x6808,
326 0x8001, 0x680a, 0x00c0, 0x196e, 0x684c, 0xd0e4, 0x0040, 0x196e,
327 0x7004, 0x2060, 0x2009, 0x0048, 0x1078, 0x756c, 0x7000, 0xa086,
328 0x0004, 0x0040, 0x1aad, 0x7003, 0x0000, 0x1078, 0x179f, 0x0078,
329 0x1aad, 0x057e, 0x7d0c, 0xd5bc, 0x00c0, 0x1980, 0x1078, 0xa20c,
330 0x057f, 0x1078, 0x1ac6, 0x0f7e, 0x7004, 0x2078, 0x1078, 0x4893,
331 0x0040, 0x198d, 0x7824, 0xc0f5, 0x7826, 0x0f7f, 0x682b, 0xffff,
332 0x682f, 0xffff, 0x6808, 0x8001, 0x680a, 0x697c, 0x6912, 0x6980,
333 0x6916, 0x0078, 0x1aad, 0x7004, 0x0c7e, 0x2060, 0x6024, 0x0c7f,
334 0xd0f4, 0x0040, 0x19a8, 0x6808, 0x8001, 0x680a, 0x0078, 0x1aad,
335 0x684c, 0xc0f5, 0x684e, 0x7814, 0xa005, 0x00c0, 0x19c0, 0x7003,
336 0x0000, 0x6808, 0x8001, 0x680a, 0x00c0, 0x19bc, 0x7004, 0x2060,
337 0x2009, 0x0048, 0x1078, 0x756c, 0x1078, 0x179f, 0x0078, 0x1aad,
338 0x7814, 0x6910, 0xa102, 0x6812, 0x6914, 0xa183, 0x0000, 0x6816,
339 0x7814, 0x7908, 0xa18c, 0x0fff, 0xa188, 0x0007, 0x8114, 0x8214,
340 0x8214, 0xa10a, 0x8104, 0x8004, 0x8004, 0xa20a, 0x810b, 0x810b,
341 0x810b, 0x1078, 0x1b4d, 0x7803, 0x0004, 0x780f, 0xffff, 0x7803,
342 0x0001, 0x7804, 0xd0fc, 0x0040, 0x19e1, 0x7803, 0x0002, 0x7803,
343 0x0004, 0x780f, 0x0076, 0x7004, 0x7007, 0x0000, 0x2060, 0x2009,
344 0x0048, 0x1078, 0x756c, 0x1078, 0x1b81, 0x0040, 0x19bc, 0x7908,
345 0xd1ec, 0x00c0, 0x19ff, 0x2009, 0x0009, 0x0078, 0x1a01, 0x2009,
346 0x0019, 0x7902, 0x7003, 0x0003, 0x0078, 0x1aad, 0x8001, 0x7002,
347 0xd194, 0x0040, 0x1a18, 0x7804, 0xd0fc, 0x00c0, 0x18ea, 0x8aff,
348 0x0040, 0x1aad, 0x2009, 0x0001, 0x1078, 0x1824, 0x0078, 0x1aad,
349 0xa184, 0x0880, 0x00c0, 0x1a25, 0x8aff, 0x0040, 0x1aad, 0x2009,
350 0x0001, 0x1078, 0x1824, 0x0078, 0x1aad, 0x7803, 0x0004, 0x7003,
351 0x0000, 0xd1bc, 0x00c0, 0x1a65, 0x027e, 0x037e, 0x7808, 0xd0ec,
352 0x00c0, 0x1a38, 0x7803, 0x0009, 0x7003, 0x0004, 0x0078, 0x1a3a,
353 0x1078, 0x1b9f, 0x6b28, 0x6a2c, 0x1078, 0x1fea, 0x0d7e, 0x0f7e,
354 0x2d78, 0x2804, 0xac68, 0x6034, 0xd09c, 0x00c0, 0x1a55, 0x6808,
355 0x2008, 0xa31a, 0x680c, 0xa213, 0x7810, 0xa100, 0x7812, 0x690c,
356 0x7814, 0xa101, 0x7816, 0x0078, 0x1a61, 0x6810, 0x2008, 0xa31a,
357 0x6814, 0xa213, 0x7810, 0xa100, 0x7812, 0x6914, 0x7814, 0xa101,
358 0x7816, 0x0f7f, 0x0d7f, 0x0078, 0x1934, 0x057e, 0x7d0c, 0x1078,
359 0xa20c, 0x057f, 0x1078, 0x1ac6, 0x0f7e, 0x7004, 0x2078, 0x1078,
360 0x4893, 0x0040, 0x1a76, 0x7824, 0xc0f5, 0x7826, 0x0f7f, 0x682b,
361 0xffff, 0x682f, 0xffff, 0x6808, 0x8001, 0x680a, 0x697c, 0x6912,
362 0x6980, 0x6916, 0x0078, 0x1aad, 0x7803, 0x0004, 0x7003, 0x0000,
363 0x7004, 0xa00d, 0x0040, 0x1a97, 0x6808, 0x8001, 0x680a, 0x00c0,
364 0x1a97, 0x7004, 0x2060, 0x2009, 0x0048, 0x1078, 0x756c, 0x1078,
365 0x179f, 0x0078, 0x1aad, 0x7803, 0x0004, 0x7003, 0x0000, 0x7004,
366 0x2060, 0x6010, 0xa005, 0x0040, 0x1a97, 0x2068, 0x6808, 0x8000,
367 0x680a, 0x6c28, 0x6b2c, 0x1078, 0x17be, 0x017f, 0x007f, 0x127f,
368 0x007c, 0x127e, 0x2091, 0x2100, 0x7000, 0xa086, 0x0003, 0x00c0,
369 0x1ac4, 0x700c, 0x7110, 0xa106, 0x0040, 0x1ac4, 0x20e1, 0x9028,
370 0x700f, 0xa5e7, 0x7013, 0xa5e7, 0x127f, 0x007c, 0x0c7e, 0x1078,
371 0x1af7, 0x20e1, 0x9028, 0x700c, 0x7110, 0xa106, 0x0040, 0x1aed,
372 0x2104, 0xa005, 0x0040, 0x1ada, 0x2060, 0x6010, 0x2060, 0x6008,
373 0x8001, 0x600a, 0xa188, 0x0003, 0xa182, 0xa602, 0x0048, 0x1ae2,
374 0x2009, 0xa5e7, 0x7112, 0x700c, 0xa106, 0x00c0, 0x1acb, 0x2001,
375 0x0138, 0x2003, 0x0008, 0x0078, 0x1acb, 0x2001, 0x015d, 0x200c,
376 0x810a, 0x2102, 0x2001, 0x0138, 0x2202, 0x0c7f, 0x007c, 0x2001,
377 0x0138, 0x2014, 0x2003, 0x0000, 0x2021, 0xb015, 0x2001, 0x0141,
378 0x201c, 0xd3dc, 0x00c0, 0x1b14, 0x2001, 0x0109, 0x201c, 0xa39c,
379 0x0048, 0x00c0, 0x1b14, 0x2001, 0x0111, 0x201c, 0x83ff, 0x00c0,
380 0x1b14, 0x8421, 0x00c0, 0x1afe, 0x007c, 0x2011, 0x0201, 0x2009,
381 0x003c, 0x2204, 0xa005, 0x00c0, 0x1b21, 0x8109, 0x00c0, 0x1b19,
382 0x007c, 0x007c, 0x1078, 0x1b15, 0x0040, 0x1b4a, 0x7908, 0xd1ec,
383 0x00c0, 0x1b3a, 0x1078, 0x1b81, 0x0040, 0x1b3a, 0x7803, 0x0009,
384 0x7904, 0xd1fc, 0x0040, 0x1b30, 0x7803, 0x0006, 0x1078, 0x1b15,
385 0x0040, 0x1b4a, 0x780c, 0xd0a4, 0x00c0, 0x1b4a, 0x7007, 0x0000,
386 0x1078, 0x1b81, 0x0040, 0x1b4c, 0x7803, 0x0019, 0x7003, 0x0003,
387 0x0078, 0x1b4c, 0x1078, 0x1ac6, 0x007c, 0x0e7e, 0x2071, 0x0200,
388 0x7808, 0xa084, 0xf000, 0xa10d, 0x1078, 0x1af7, 0x2019, 0x5000,
389 0x8319, 0x0040, 0x1b6b, 0x2001, 0xa602, 0x2004, 0xa086, 0x0000,
390 0x0040, 0x1b6b, 0x2001, 0x0021, 0xd0fc, 0x0040, 0x1b58, 0x1078,
391 0x1e5d, 0x0078, 0x1b56, 0x20e1, 0x7000, 0x7324, 0x7420, 0x7028,
392 0x7028, 0x7426, 0x7037, 0x0001, 0x810f, 0x712e, 0x702f, 0x0100,
393 0x7037, 0x0008, 0x7326, 0x7422, 0x2001, 0x0138, 0x2202, 0x0e7f,
394 0x007c, 0x7908, 0xa18c, 0x0fff, 0xa182, 0x0009, 0x0048, 0x1b8c,
395 0xa085, 0x0001, 0x0078, 0x1b9e, 0x2001, 0x020a, 0x81ff, 0x0040,
396 0x1b97, 0x20e1, 0x6000, 0x200c, 0x200c, 0x200c, 0x200c, 0x20e1,
397 0x7000, 0x200c, 0x200c, 0x7003, 0x0000, 0xa006, 0x007c, 0x7c20,
398 0x7d24, 0x7e30, 0x7f34, 0x700c, 0x7110, 0xa106, 0x0040, 0x1c24,
399 0x7004, 0x017e, 0x210c, 0xa106, 0x017f, 0x0040, 0x1c24, 0x0d7e,
400 0x0c7e, 0x216c, 0x2d00, 0xa005, 0x0040, 0x1c22, 0x6824, 0xd0d4,
401 0x00c0, 0x1c22, 0x6810, 0x2068, 0x6850, 0xd0fc, 0x0040, 0x1bec,
402 0x8108, 0x2104, 0x6b2c, 0xa306, 0x00c0, 0x1c22, 0x8108, 0x2104,
403 0x6a28, 0xa206, 0x00c0, 0x1c22, 0x6850, 0xc0fc, 0xc0f5, 0x6852,
404 0x686c, 0x7822, 0x6870, 0x7826, 0x681c, 0x7832, 0x6820, 0x7836,
405 0x6818, 0x2060, 0x6034, 0xd09c, 0x0040, 0x1be7, 0x6830, 0x2004,
406 0xac68, 0x6808, 0x783a, 0x680c, 0x783e, 0x0078, 0x1c20, 0xa006,
407 0x783a, 0x783e, 0x0078, 0x1c20, 0x8108, 0x2104, 0xa005, 0x00c0,
408 0x1c22, 0x8108, 0x2104, 0xa005, 0x00c0, 0x1c22, 0x6850, 0xc0f5,
409 0x6852, 0x6830, 0x2004, 0x6918, 0xa160, 0xa180, 0x000d, 0x2004,
410 0xd09c, 0x00c0, 0x1c12, 0x6008, 0x7822, 0x686e, 0x600c, 0x7826,
411 0x6872, 0x6000, 0x7832, 0x6004, 0x7836, 0xa006, 0x783a, 0x783e,
412 0x0078, 0x1c20, 0x6010, 0x7822, 0x686e, 0x6014, 0x7826, 0x6872,
413 0x6000, 0x7832, 0x6004, 0x7836, 0x6008, 0x783a, 0x600c, 0x783e,
414 0x7803, 0x0011, 0x0c7f, 0x0d7f, 0x007c, 0x0f7e, 0x0e7e, 0x017e,
415 0x027e, 0x2071, 0xa5e1, 0x2079, 0x0030, 0x2011, 0x0050, 0x7000,
416 0xa086, 0x0000, 0x0040, 0x1c4d, 0x8211, 0x0040, 0x1c4b, 0x2001,
417 0x0005, 0x2004, 0xd08c, 0x0040, 0x1c34, 0x7904, 0xa18c, 0x0780,
418 0x017e, 0x1078, 0x18e2, 0x017f, 0x81ff, 0x00c0, 0x1c4b, 0x2011,
419 0x0050, 0x0078, 0x1c2f, 0xa085, 0x0001, 0x027f, 0x017f, 0x0e7f,
420 0x0f7f, 0x007c, 0x7803, 0x0004, 0x2009, 0x0064, 0x7804, 0xd0ac,
421 0x0040, 0x1ca3, 0x8109, 0x00c0, 0x1c56, 0x2009, 0x0100, 0x210c,
422 0xa18a, 0x0003, 0x1048, 0x1328, 0x1078, 0x1f75, 0x0e7e, 0x0f7e,
423 0x2071, 0xa5d0, 0x2079, 0x0010, 0x7004, 0xa086, 0x0000, 0x0040,
424 0x1c9b, 0x7800, 0x007e, 0x7820, 0x007e, 0x7830, 0x007e, 0x7834,
425 0x007e, 0x7838, 0x007e, 0x783c, 0x007e, 0x7803, 0x0004, 0x7823,
426 0x0000, 0x0005, 0x0005, 0x2079, 0x0030, 0x7804, 0xd0ac, 0x10c0,
427 0x1328, 0x2079, 0x0010, 0x007f, 0x783e, 0x007f, 0x783a, 0x007f,
428 0x7836, 0x007f, 0x7832, 0x007f, 0x7822, 0x007f, 0x7802, 0x0f7f,
429 0x0e7f, 0x0078, 0x1ca1, 0x0f7f, 0x0e7f, 0x7804, 0xd0ac, 0x10c0,
430 0x1328, 0x1078, 0x61d3, 0x007c, 0x0e7e, 0x2071, 0xa602, 0x7003,
431 0x0000, 0x0e7f, 0x007c, 0x0d7e, 0xa280, 0x0004, 0x206c, 0x694c,
432 0xd1dc, 0x00c0, 0x1d26, 0x6934, 0xa184, 0x0007, 0x0079, 0x1cb8,
433 0x1cc0, 0x1d11, 0x1cc0, 0x1cc0, 0x1cc0, 0x1cf6, 0x1cd3, 0x1cc2,
434 0x1078, 0x1328, 0x684c, 0xd0b4, 0x0040, 0x1e34, 0x6860, 0x682e,
435 0x6816, 0x685c, 0x682a, 0x6812, 0x687c, 0x680a, 0x6880, 0x680e,
436 0x6958, 0x0078, 0x1d19, 0x6834, 0xa084, 0x00ff, 0xa086, 0x001e,
437 0x00c0, 0x1cc0, 0x684c, 0xd0b4, 0x0040, 0x1e34, 0x6860, 0x682e,
438 0x6816, 0x685c, 0x682a, 0x6812, 0x687c, 0x680a, 0x6880, 0x680e,
439 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f, 0xa080,
440 0x2015, 0x2004, 0x6832, 0x6958, 0x0078, 0x1d22, 0xa18c, 0x00ff,
441 0xa186, 0x0015, 0x00c0, 0x1d26, 0x684c, 0xd0b4, 0x0040, 0x1e34,
442 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f, 0xa080,
443 0x2015, 0x2004, 0x6832, 0x6958, 0xa006, 0x682e, 0x682a, 0x0078,
444 0x1d22, 0x684c, 0xd0b4, 0x0040, 0x18bc, 0x6958, 0xa006, 0x682e,
445 0x682a, 0x2d00, 0x681a, 0x6834, 0xa084, 0x000f, 0xa080, 0x2015,
446 0x2004, 0x6832, 0x6926, 0x684c, 0xc0dd, 0x684e, 0x0d7f, 0x007c,
447 0x0f7e, 0x2079, 0x0020, 0x7804, 0xd0fc, 0x10c0, 0x1e5d, 0x0e7e,
448 0x0d7e, 0x2071, 0xa602, 0x7000, 0xa005, 0x00c0, 0x1dab, 0x0c7e,
449 0x7206, 0xa280, 0x0004, 0x205c, 0x7004, 0x2068, 0x7803, 0x0004,
450 0x6818, 0x0d7e, 0x2068, 0x686c, 0x7812, 0x6890, 0x0f7e, 0x20e1,
451 0x9040, 0x2079, 0x0200, 0x781a, 0x2079, 0x0100, 0x8004, 0x78d6,
452 0x0f7f, 0x0d7f, 0x2b68, 0x6824, 0x2050, 0x6818, 0x2060, 0x6830,
453 0x2040, 0x6034, 0xa0cc, 0x000f, 0x6908, 0x2001, 0x04fd, 0x2004,
454 0xa086, 0x0007, 0x0040, 0x1d6d, 0xa184, 0x0007, 0x0040, 0x1d6d,
455 0x017e, 0x2009, 0x0008, 0xa102, 0x017f, 0xa108, 0x791a, 0x7116,
456 0x701e, 0x680c, 0xa081, 0x0000, 0x781e, 0x701a, 0xa006, 0x700e,
457 0x7012, 0x7004, 0x692c, 0x6814, 0xa106, 0x00c0, 0x1d84, 0x6928,
458 0x6810, 0xa106, 0x0040, 0x1d91, 0x037e, 0x047e, 0x6b14, 0x6c10,
459 0x1078, 0x2035, 0x047f, 0x037f, 0x0040, 0x1d91, 0x0c7f, 0x0078,
460 0x1dab, 0x8aff, 0x00c0, 0x1d99, 0x0c7f, 0xa085, 0x0001, 0x0078,
461 0x1dab, 0x127e, 0x2091, 0x8000, 0x2079, 0x0020, 0x2009, 0x0001,
462 0x1078, 0x1daf, 0x0040, 0x1da8, 0x2009, 0x0001, 0x1078, 0x1daf,
463 0x127f, 0x0c7f, 0xa006, 0x0d7f, 0x0e7f, 0x0f7f, 0x007c, 0x077e,
464 0x067e, 0x057e, 0x047e, 0x037e, 0x027e, 0x8aff, 0x0040, 0x1e2d,
465 0x700c, 0x7214, 0xa23a, 0x7010, 0x7218, 0xa203, 0x0048, 0x1e2c,
466 0xa705, 0x0040, 0x1e2c, 0xa03e, 0x2730, 0x6850, 0xd0fc, 0x00c0,
467 0x1ddf, 0x0d7e, 0x2804, 0xac68, 0x2900, 0x0079, 0x1dcf, 0x1e0e,
468 0x1def, 0x1def, 0x1e0e, 0x1e0e, 0x1e06, 0x1e0e, 0x1def, 0x1e0e,
469 0x1df5, 0x1df5, 0x1e0e, 0x1e0e, 0x1e0e, 0x1dfd, 0x1df5, 0xc0fc,
470 0x6852, 0x6b6c, 0x6a70, 0x6d1c, 0x6c20, 0xd99c, 0x0040, 0x1e12,
471 0x0d7e, 0x2804, 0xac68, 0x6f08, 0x6e0c, 0x0078, 0x1e11, 0x6b08,
472 0x6a0c, 0x6d00, 0x6c04, 0x0078, 0x1e11, 0x6b10, 0x6a14, 0x6d00,
473 0x6c04, 0x6f08, 0x6e0c, 0x0078, 0x1e11, 0x0d7f, 0x0d7e, 0x6834,
474 0xa084, 0x00ff, 0xa086, 0x001e, 0x00c0, 0x1e0e, 0x0d7f, 0x1078,
475 0x1fd1, 0x00c0, 0x1db5, 0xa00e, 0x0078, 0x1e2d, 0x0d7f, 0x1078,
476 0x1328, 0x0d7f, 0x7b22, 0x7a26, 0x7d32, 0x7c36, 0x7f3a, 0x7e3e,
477 0x7902, 0x7000, 0x8000, 0x7002, 0x6828, 0xa300, 0x682a, 0x682c,
478 0xa201, 0x682e, 0x700c, 0xa300, 0x700e, 0x7010, 0xa201, 0x7012,
479 0x1078, 0x1fd1, 0x0078, 0x1e2d, 0xa006, 0x027f, 0x037f, 0x047f,
480 0x057f, 0x067f, 0x077f, 0x007c, 0x1078, 0x1328, 0x027e, 0x2001,
481 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803, 0x0004, 0x7003,
482 0x0000, 0x7004, 0x2060, 0x0d7e, 0x6010, 0x2068, 0x1078, 0x8a44,
483 0x0040, 0x1e4d, 0x6850, 0xc0bd, 0x6852, 0x0d7f, 0x1078, 0x8758,
484 0x20e1, 0x9040, 0x1078, 0x719a, 0x2011, 0x0000, 0x1078, 0x6efc,
485 0x1078, 0x61d3, 0x027f, 0x0078, 0x1f29, 0x127e, 0x2091, 0x2200,
486 0x007e, 0x017e, 0x0f7e, 0x0e7e, 0x0d7e, 0x0c7e, 0x2079, 0x0020,
487 0x2071, 0xa602, 0x2b68, 0x6818, 0x2060, 0x7904, 0x7803, 0x0002,
488 0xa184, 0x0700, 0x00c0, 0x1e36, 0x7000, 0x0079, 0x1e77, 0x1f29,
489 0x1e7b, 0x1ef6, 0x1f27, 0x8001, 0x7002, 0xd19c, 0x00c0, 0x1e8f,
490 0x8aff, 0x0040, 0x1eae, 0x2009, 0x0001, 0x1078, 0x1daf, 0x0040,
491 0x1f29, 0x2009, 0x0001, 0x1078, 0x1daf, 0x0078, 0x1f29, 0x7803,
492 0x0004, 0xd194, 0x0040, 0x1e9f, 0x6850, 0xc0fc, 0x6852, 0x8aff,
493 0x00c0, 0x1ea4, 0x684c, 0xc0f5, 0x684e, 0x0078, 0x1ea4, 0x1078,
494 0x1fea, 0x6850, 0xc0fd, 0x6852, 0x2a00, 0x6826, 0x2c00, 0x681a,
495 0x2800, 0x6832, 0x7003, 0x0000, 0x0078, 0x1f29, 0x711c, 0x81ff,
496 0x0040, 0x1ec4, 0x7918, 0x7922, 0x7827, 0x0000, 0x7803, 0x0001,
497 0x7000, 0x8000, 0x7002, 0x700c, 0xa100, 0x700e, 0x7010, 0xa081,
498 0x0000, 0x7012, 0x0078, 0x1f29, 0x0f7e, 0x027e, 0x781c, 0x007e,
499 0x7818, 0x007e, 0x2079, 0x0100, 0x7a14, 0xa284, 0x0004, 0xa085,
500 0x0012, 0x7816, 0x037e, 0x2019, 0x1000, 0x8319, 0x1040, 0x1328,
501 0x7820, 0xd0bc, 0x00c0, 0x1ed5, 0x037f, 0x79c8, 0x007f, 0xa102,
502 0x017f, 0x007e, 0x017e, 0x79c4, 0x007f, 0xa103, 0x78c6, 0x007f,
503 0x78ca, 0xa284, 0x0004, 0xa085, 0x0012, 0x7816, 0x027f, 0x0f7f,
504 0x7803, 0x0008, 0x7003, 0x0000, 0x0078, 0x1f29, 0x8001, 0x7002,
505 0xd194, 0x0040, 0x1f0b, 0x7804, 0xd0fc, 0x00c0, 0x1e6d, 0xd19c,
506 0x00c0, 0x1f25, 0x8aff, 0x0040, 0x1f29, 0x2009, 0x0001, 0x1078,
507 0x1daf, 0x0078, 0x1f29, 0x027e, 0x037e, 0x6b28, 0x6a2c, 0x1078,
508 0x1fea, 0x0d7e, 0x2804, 0xac68, 0x6034, 0xd09c, 0x00c0, 0x1f1e,
509 0x6808, 0xa31a, 0x680c, 0xa213, 0x0078, 0x1f22, 0x6810, 0xa31a,
510 0x6814, 0xa213, 0x0d7f, 0x0078, 0x1e9f, 0x0078, 0x1e9f, 0x1078,
511 0x1328, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f, 0x017f, 0x007f, 0x127f,
512 0x007c, 0x0f7e, 0x0e7e, 0x2071, 0xa602, 0x7000, 0xa086, 0x0000,
513 0x0040, 0x1f72, 0x2079, 0x0020, 0x017e, 0x2009, 0x0207, 0x210c,
514 0xd194, 0x0040, 0x1f4f, 0x2009, 0x020c, 0x210c, 0xa184, 0x0003,
515 0x0040, 0x1f4f, 0x20e1, 0x9040, 0x2001, 0x020c, 0x2102, 0x2009,
516 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0xa106, 0x00c0, 0x1f5a,
517 0x20e1, 0x9040, 0x7804, 0xd0fc, 0x0040, 0x1f3d, 0x1078, 0x1e5d,
518 0x7000, 0xa086, 0x0000, 0x00c0, 0x1f3d, 0x017f, 0x7803, 0x0004,
519 0x7804, 0xd0ac, 0x00c0, 0x1f68, 0x20e1, 0x9040, 0x7803, 0x0002,
520 0x7003, 0x0000, 0x0e7f, 0x0f7f, 0x007c, 0x027e, 0x0c7e, 0x0d7e,
521 0x0e7e, 0x0f7e, 0x2071, 0xa602, 0x2079, 0x0020, 0x7000, 0xa086,
522 0x0000, 0x0040, 0x1fae, 0x7004, 0x2060, 0x6010, 0x2068, 0x1078,
523 0x8a44, 0x0040, 0x1f98, 0x6850, 0xc0b5, 0x6852, 0x680c, 0x7a1c,
524 0xa206, 0x00c0, 0x1f98, 0x6808, 0x7a18, 0xa206, 0x0040, 0x1fb4,
525 0x2001, 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803, 0x0004,
526 0x7003, 0x0000, 0x7004, 0x2060, 0x1078, 0x8758, 0x20e1, 0x9040,
527 0x1078, 0x719a, 0x2011, 0x0000, 0x1078, 0x6efc, 0x0f7f, 0x0e7f,
528 0x0d7f, 0x0c7f, 0x027f, 0x007c, 0x6810, 0x6a14, 0xa205, 0x00c0,
529 0x1f98, 0x684c, 0xc0dc, 0x684e, 0x2c10, 0x1078, 0x1cab, 0x2001,
530 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803, 0x0004, 0x7003,
531 0x0000, 0x2069, 0xa5ab, 0x6833, 0x0000, 0x683f, 0x0000, 0x0078,
532 0x1fae, 0x8840, 0x2804, 0xa005, 0x00c0, 0x1fe5, 0x6004, 0xa005,
533 0x0040, 0x1fe7, 0x681a, 0x2060, 0x6034, 0xa084, 0x000f, 0xa080,
534 0x2015, 0x2044, 0x88ff, 0x1040, 0x1328, 0x8a51, 0x007c, 0x2051,
535 0x0000, 0x007c, 0x8a50, 0x8841, 0x2804, 0xa005, 0x00c0, 0x2004,
536 0x2c00, 0xad06, 0x0040, 0x1ff9, 0x6000, 0xa005, 0x00c0, 0x1ff9,
537 0x2d00, 0x2060, 0x681a, 0x6034, 0xa084, 0x000f, 0xa080, 0x2025,
538 0x2044, 0x88ff, 0x1040, 0x1328, 0x007c, 0x0000, 0x0011, 0x0015,
539 0x0019, 0x001d, 0x0021, 0x0025, 0x0029, 0x0000, 0x000f, 0x0015,
540 0x001b, 0x0021, 0x0027, 0x0000, 0x0000, 0x0000, 0x200a, 0x2006,
541 0x0000, 0x0000, 0x2014, 0x0000, 0x200a, 0x0000, 0x2011, 0x200e,
542 0x0000, 0x0000, 0x0000, 0x2014, 0x2011, 0x0000, 0x200c, 0x200c,
543 0x0000, 0x0000, 0x2014, 0x0000, 0x200c, 0x0000, 0x2012, 0x2012,
544 0x0000, 0x0000, 0x0000, 0x2014, 0x2012, 0x0a7e, 0x097e, 0x087e,
545 0x6b2e, 0x6c2a, 0x6858, 0xa055, 0x0040, 0x20d8, 0x2d60, 0x6034,
546 0xa0cc, 0x000f, 0xa9c0, 0x2015, 0xa986, 0x0007, 0x0040, 0x2050,
547 0xa986, 0x000e, 0x0040, 0x2050, 0xa986, 0x000f, 0x00c0, 0x2054,
548 0x605c, 0xa422, 0x6060, 0xa31a, 0x2804, 0xa045, 0x00c0, 0x2062,
549 0x0050, 0x205c, 0x0078, 0x20d8, 0x6004, 0xa065, 0x0040, 0x20d8,
550 0x0078, 0x203f, 0x2804, 0xa005, 0x0040, 0x2080, 0xac68, 0xd99c,
551 0x00c0, 0x2070, 0x6808, 0xa422, 0x680c, 0xa31b, 0x0078, 0x2074,
552 0x6810, 0xa422, 0x6814, 0xa31b, 0x0048, 0x209f, 0x2300, 0xa405,
553 0x0040, 0x2086, 0x8a51, 0x0040, 0x20d8, 0x8840, 0x0078, 0x2062,
554 0x6004, 0xa065, 0x0040, 0x20d8, 0x0078, 0x203f, 0x8a51, 0x0040,
555 0x20d8, 0x8840, 0x2804, 0xa005, 0x00c0, 0x2099, 0x6004, 0xa065,
556 0x0040, 0x20d8, 0x6034, 0xa0cc, 0x000f, 0xa9c0, 0x2015, 0x2804,
557 0x2040, 0x2b68, 0x6850, 0xc0fc, 0x6852, 0x0078, 0x20cc, 0x8422,
558 0x8420, 0x831a, 0xa399, 0x0000, 0x0d7e, 0x2b68, 0x6c6e, 0x6b72,
559 0x0d7f, 0xd99c, 0x00c0, 0x20ba, 0x6908, 0x2400, 0xa122, 0x690c,
560 0x2300, 0xa11b, 0x1048, 0x1328, 0x6800, 0xa420, 0x6804, 0xa319,
561 0x0078, 0x20c6, 0x6910, 0x2400, 0xa122, 0x6914, 0x2300, 0xa11b,
562 0x1048, 0x1328, 0x6800, 0xa420, 0x6804, 0xa319, 0x2b68, 0x6c1e,
563 0x6b22, 0x6850, 0xc0fd, 0x6852, 0x2c00, 0x681a, 0x2800, 0x6832,
564 0x2a00, 0x6826, 0x007f, 0x007f, 0x007f, 0xa006, 0x0078, 0x20dd,
565 0x087f, 0x097f, 0x0a7f, 0xa085, 0x0001, 0x007c, 0x2001, 0x0005,
566 0x2004, 0xa084, 0x0007, 0x0079, 0x20e5, 0x20ed, 0x20ee, 0x20f1,
567 0x20f4, 0x20f9, 0x20fc, 0x2101, 0x2106, 0x007c, 0x1078, 0x1e5d,
568 0x007c, 0x1078, 0x18e2, 0x007c, 0x1078, 0x18e2, 0x1078, 0x1e5d,
569 0x007c, 0x1078, 0x14b0, 0x007c, 0x1078, 0x1e5d, 0x1078, 0x14b0,
570 0x007c, 0x1078, 0x18e2, 0x1078, 0x14b0, 0x007c, 0x1078, 0x18e2,
571 0x1078, 0x1e5d, 0x1078, 0x14b0, 0x007c, 0x127e, 0x2091, 0x2300,
572 0x2079, 0x0200, 0x2071, 0xa880, 0x2069, 0xa300, 0x2009, 0x0004,
573 0x7912, 0x7817, 0x0004, 0x1078, 0x24b5, 0x781b, 0x0002, 0x20e1,
574 0x8700, 0x127f, 0x007c, 0x127e, 0x2091, 0x2300, 0x781c, 0xa084,
575 0x0007, 0x0079, 0x212b, 0x214f, 0x2133, 0x2137, 0x213b, 0x2141,
576 0x2145, 0x2149, 0x214d, 0x1078, 0x5372, 0x0078, 0x214f, 0x1078,
577 0x53b3, 0x0078, 0x214f, 0x1078, 0x5372, 0x1078, 0x53b3, 0x0078,
578 0x214f, 0x1078, 0x2151, 0x0078, 0x214f, 0x1078, 0x2151, 0x0078,
579 0x214f, 0x1078, 0x2151, 0x0078, 0x214f, 0x1078, 0x2151, 0x127f,
580 0x007c, 0x007e, 0x017e, 0x027e, 0x7930, 0xa184, 0x0003, 0x0040,
581 0x215d, 0x20e1, 0x9040, 0x0078, 0x2186, 0xa184, 0x0030, 0x0040,
582 0x216e, 0x6a00, 0xa286, 0x0003, 0x00c0, 0x2168, 0x0078, 0x216a,
583 0x1078, 0x4171, 0x20e1, 0x9010, 0x0078, 0x2186, 0xa184, 0x00c0,
584 0x0040, 0x2180, 0x0e7e, 0x037e, 0x047e, 0x057e, 0x2071, 0xa5e1,
585 0x1078, 0x1ac6, 0x057f, 0x047f, 0x037f, 0x0e7f, 0x0078, 0x2186,
586 0xa184, 0x0300, 0x0040, 0x2186, 0x20e1, 0x9020, 0x7932, 0x027f,
587 0x017f, 0x007f, 0x007c, 0x017e, 0x0e7e, 0x0f7e, 0x2071, 0xa300,
588 0x7128, 0x2001, 0xa58f, 0x2102, 0x2001, 0xa597, 0x2102, 0xa182,
589 0x0211, 0x00c8, 0x219f, 0x2009, 0x0008, 0x0078, 0x21c9, 0xa182,
590 0x0259, 0x00c8, 0x21a7, 0x2009, 0x0007, 0x0078, 0x21c9, 0xa182,
591 0x02c1, 0x00c8, 0x21af, 0x2009, 0x0006, 0x0078, 0x21c9, 0xa182,
592 0x0349, 0x00c8, 0x21b7, 0x2009, 0x0005, 0x0078, 0x21c9, 0xa182,
593 0x0421, 0x00c8, 0x21bf, 0x2009, 0x0004, 0x0078, 0x21c9, 0xa182,
594 0x0581, 0x00c8, 0x21c7, 0x2009, 0x0003, 0x0078, 0x21c9, 0x2009,
595 0x0002, 0x2079, 0x0200, 0x7912, 0x7817, 0x0004, 0x1078, 0x24b5,
596 0x0f7f, 0x0e7f, 0x017f, 0x007c, 0x127e, 0x2091, 0x2200, 0x2061,
597 0x0100, 0x2071, 0xa300, 0x6024, 0x6026, 0x6053, 0x0030, 0x6033,
598 0x00ef, 0x60e7, 0x0000, 0x60eb, 0x00ef, 0x60e3, 0x0008, 0x604b,
599 0xf7f7, 0x6043, 0x0000, 0x602f, 0x0080, 0x602f, 0x0000, 0x6007,
600 0x0eaf, 0x600f, 0x00ff, 0x602b, 0x002f, 0x127f, 0x007c, 0x2001,
601 0xa32f, 0x2003, 0x0000, 0x2001, 0xa32e, 0x2003, 0x0001, 0x007c,
602 0x127e, 0x2091, 0x2200, 0x007e, 0x017e, 0x027e, 0x6124, 0xa184,
603 0x002c, 0x00c0, 0x220f, 0xa184, 0x0007, 0x0079, 0x2215, 0xa195,
604 0x0004, 0xa284, 0x0007, 0x0079, 0x2215, 0x2241, 0x221d, 0x2221,
605 0x2225, 0x222b, 0x222f, 0x2235, 0x223b, 0x1078, 0x5ad2, 0x0078,
606 0x2241, 0x1078, 0x5bc1, 0x0078, 0x2241, 0x1078, 0x5bc1, 0x1078,
607 0x5ad2, 0x0078, 0x2241, 0x1078, 0x2246, 0x0078, 0x2241, 0x1078,
608 0x5ad2, 0x1078, 0x2246, 0x0078, 0x2241, 0x1078, 0x5bc1, 0x1078,
609 0x2246, 0x0078, 0x2241, 0x1078, 0x5bc1, 0x1078, 0x5ad2, 0x1078,
610 0x2246, 0x027f, 0x017f, 0x007f, 0x127f, 0x007c, 0x6124, 0xd1ac,
611 0x0040, 0x2342, 0x017e, 0x047e, 0x0c7e, 0x644c, 0xa486, 0xf0f0,
612 0x00c0, 0x2259, 0x2061, 0x0100, 0x644a, 0x6043, 0x0090, 0x6043,
613 0x0010, 0x74c2, 0xa48c, 0xff00, 0x7034, 0xd084, 0x0040, 0x2271,
614 0xa186, 0xf800, 0x00c0, 0x2271, 0x7038, 0xd084, 0x00c0, 0x2271,
615 0xc085, 0x703a, 0x037e, 0x2418, 0x2011, 0x8016, 0x1078, 0x3579,
616 0x037f, 0xa196, 0xff00, 0x0040, 0x22b3, 0x6030, 0xa084, 0x00ff,
617 0x810f, 0xa116, 0x0040, 0x22b3, 0x7130, 0xd184, 0x00c0, 0x22b3,
618 0x2011, 0xa352, 0x2214, 0xd2ec, 0x0040, 0x228e, 0xc18d, 0x7132,
619 0x2011, 0xa352, 0x2214, 0xd2ac, 0x00c0, 0x22b3, 0x6240, 0xa294,
620 0x0010, 0x0040, 0x229a, 0x6248, 0xa294, 0xff00, 0xa296, 0xff00,
621 0x0040, 0x22b3, 0x7030, 0xd08c, 0x0040, 0x2305, 0x7034, 0xd08c,
622 0x00c0, 0x22aa, 0x2001, 0xa30c, 0x200c, 0xd1ac, 0x00c0, 0x2305,
623 0xc1ad, 0x2102, 0x037e, 0x73c0, 0x2011, 0x8013, 0x1078, 0x3579,
624 0x037f, 0x0078, 0x2305, 0x7034, 0xd08c, 0x00c0, 0x22bf, 0x2001,
625 0xa30c, 0x200c, 0xd1ac, 0x00c0, 0x2305, 0xc1ad, 0x2102, 0x037e,
626 0x73c0, 0x2011, 0x8013, 0x1078, 0x3579, 0x037f, 0x7130, 0xc185,
627 0x7132, 0x2011, 0xa352, 0x220c, 0xd1a4, 0x0040, 0x22e9, 0x017e,
628 0x2009, 0x0001, 0x2011, 0x0100, 0x1078, 0x5a6d, 0x2019, 0x000e,
629 0x1078, 0x9e3b, 0xa484, 0x00ff, 0xa080, 0x293f, 0x200c, 0xa18c,
630 0xff00, 0x810f, 0x8127, 0xa006, 0x2009, 0x000e, 0x1078, 0x9ec0,
631 0x017f, 0xd1ac, 0x00c0, 0x22f6, 0x017e, 0x2009, 0x0000, 0x2019,
632 0x0004, 0x1078, 0x27e2, 0x017f, 0x0078, 0x2305, 0x157e, 0x20a9,
633 0x007f, 0x2009, 0x0000, 0x1078, 0x4501, 0x00c0, 0x2301, 0x1078,
634 0x4235, 0x8108, 0x00f0, 0x22fb, 0x157f, 0x0c7f, 0x047f, 0x0f7e,
635 0x2079, 0xa5be, 0x783c, 0xa086, 0x0000, 0x0040, 0x2317, 0x6027,
636 0x0004, 0x783f, 0x0000, 0x2079, 0x0140, 0x7803, 0x0000, 0x0f7f,
637 0x2011, 0x0003, 0x1078, 0x6ef2, 0x2011, 0x0002, 0x1078, 0x6efc,
638 0x1078, 0x6dda, 0x1078, 0x595a, 0x037e, 0x2019, 0x0000, 0x1078,
639 0x6e6c, 0x037f, 0x60e3, 0x0000, 0x017f, 0x2001, 0xa300, 0x2014,
640 0xa296, 0x0004, 0x00c0, 0x233a, 0xd19c, 0x00c0, 0x233a, 0x6228,
641 0xc29d, 0x622a, 0x2003, 0x0001, 0x2001, 0xa321, 0x2003, 0x0000,
642 0x6027, 0x0020, 0xd194, 0x0040, 0x2426, 0x0f7e, 0x2079, 0xa5be,
643 0x783c, 0xa086, 0x0001, 0x00c0, 0x2366, 0x017e, 0x6027, 0x0004,
644 0x783f, 0x0000, 0x2079, 0x0140, 0x7803, 0x1000, 0x7803, 0x0000,
645 0x2079, 0xa5ab, 0x7807, 0x0000, 0x7833, 0x0000, 0x1078, 0x6109,
646 0x1078, 0x61d3, 0x017f, 0x0f7f, 0x0078, 0x2426, 0x0f7f, 0x017e,
647 0x3900, 0xa082, 0xa6cd, 0x00c8, 0x2371, 0x017e, 0x1078, 0x728a,
648 0x017f, 0x6220, 0xd2b4, 0x0040, 0x23dc, 0x1078, 0x595a, 0x1078,
649 0x6c41, 0x6027, 0x0004, 0x0f7e, 0x2019, 0xa5b4, 0x2304, 0xa07d,
650 0x0040, 0x23b2, 0x7804, 0xa086, 0x0032, 0x00c0, 0x23b2, 0x0d7e,
651 0x0c7e, 0x0e7e, 0x2069, 0x0140, 0x618c, 0x6288, 0x7818, 0x608e,
652 0x7808, 0x608a, 0x6043, 0x0002, 0x2001, 0x0003, 0x8001, 0x00c0,
653 0x2396, 0x6043, 0x0000, 0x6803, 0x1000, 0x6803, 0x0000, 0x618e,
654 0x628a, 0x1078, 0x6010, 0x1078, 0x6109, 0x7810, 0x2070, 0x7037,
655 0x0103, 0x2f60, 0x1078, 0x753d, 0x0e7f, 0x0c7f, 0x0d7f, 0x0f7f,
656 0x017f, 0x007c, 0x0f7f, 0x0d7e, 0x2069, 0x0140, 0x6804, 0xa084,
657 0x4000, 0x0040, 0x23bf, 0x6803, 0x1000, 0x6803, 0x0000, 0x0d7f,
658 0x0c7e, 0x2061, 0xa5ab, 0x6028, 0xa09a, 0x00c8, 0x00c8, 0x23cf,
659 0x8000, 0x602a, 0x0c7f, 0x1078, 0x6c33, 0x0078, 0x2425, 0x2019,
660 0xa5b4, 0x2304, 0xa065, 0x0040, 0x23d9, 0x2009, 0x0027, 0x1078,
661 0x756c, 0x0c7f, 0x0078, 0x2425, 0xd2bc, 0x0040, 0x2425, 0x1078,
662 0x5967, 0x6017, 0x0010, 0x6027, 0x0004, 0x0d7e, 0x2069, 0x0140,
663 0x6804, 0xa084, 0x4000, 0x0040, 0x23f1, 0x6803, 0x1000, 0x6803,
664 0x0000, 0x0d7f, 0x0c7e, 0x2061, 0xa5ab, 0x6044, 0xa09a, 0x00c8,
665 0x00c8, 0x2414, 0x8000, 0x6046, 0x603c, 0x0c7f, 0xa005, 0x0040,
666 0x2425, 0x2009, 0x07d0, 0x1078, 0x595f, 0xa080, 0x0007, 0x2004,
667 0xa086, 0x0006, 0x00c0, 0x2410, 0x6017, 0x0012, 0x0078, 0x2425,
668 0x6017, 0x0016, 0x0078, 0x2425, 0x037e, 0x2019, 0x0001, 0x1078,
669 0x6e6c, 0x037f, 0x2019, 0xa5ba, 0x2304, 0xa065, 0x0040, 0x2424,
670 0x2009, 0x004f, 0x1078, 0x756c, 0x0c7f, 0x017f, 0xd19c, 0x0040,
671 0x247c, 0x7034, 0xd0ac, 0x00c0, 0x2457, 0x017e, 0x157e, 0x6027,
672 0x0008, 0x602f, 0x0020, 0x20a9, 0x000a, 0x00f0, 0x2435, 0x602f,
673 0x0000, 0x6150, 0xa185, 0x1400, 0x6052, 0x20a9, 0x0320, 0x00e0,
674 0x243f, 0x2091, 0x6000, 0x6020, 0xd09c, 0x00c0, 0x244e, 0x157f,
675 0x6152, 0x017f, 0x6027, 0x0008, 0x0078, 0x247c, 0x1078, 0x250d,
676 0x00f0, 0x243f, 0x157f, 0x6152, 0x017f, 0x6027, 0x0008, 0x017e,
677 0x6028, 0xc09c, 0x602a, 0x2011, 0x0003, 0x1078, 0x6ef2, 0x2011,
678 0x0002, 0x1078, 0x6efc, 0x1078, 0x6dda, 0x1078, 0x595a, 0x037e,
679 0x2019, 0x0000, 0x1078, 0x6e6c, 0x037f, 0x60e3, 0x0000, 0x1078,
680 0xa22a, 0x1078, 0xa248, 0x2001, 0xa300, 0x2003, 0x0004, 0x6027,
681 0x0008, 0x1078, 0x1246, 0x017f, 0xa18c, 0xffd0, 0x6126, 0x007c,
682 0x007e, 0x017e, 0x027e, 0x0e7e, 0x0f7e, 0x127e, 0x2091, 0x8000,
683 0x2071, 0xa300, 0x71b8, 0x70ba, 0xa116, 0x0040, 0x24ae, 0x81ff,
684 0x0040, 0x2498, 0x2011, 0x8011, 0x1078, 0x3579, 0x0078, 0x24ae,
685 0x2011, 0x8012, 0x1078, 0x3579, 0x2001, 0xa371, 0x2004, 0xd0fc,
686 0x00c0, 0x24ae, 0x037e, 0x0c7e, 0x2061, 0x0100, 0x2019, 0x0028,
687 0x2009, 0x0000, 0x1078, 0x27e2, 0x0c7f, 0x037f, 0x127f, 0x0f7f,
688 0x0e7f, 0x027f, 0x017f, 0x007f, 0x007c, 0x0c7e, 0x0f7e, 0x007e,
689 0x027e, 0x2061, 0x0100, 0xa190, 0x24d1, 0x2204, 0x60f2, 0x2011,
690 0x24de, 0x6000, 0xa082, 0x0003, 0x00c8, 0x24ca, 0x2001, 0x00ff,
691 0x0078, 0x24cb, 0x2204, 0x60ee, 0x027f, 0x007f, 0x0f7f, 0x0c7f,
692 0x007c, 0x0840, 0x0840, 0x0840, 0x0580, 0x0420, 0x0348, 0x02c0,
693 0x0258, 0x0210, 0x01a8, 0x01a8, 0x01a8, 0x01a8, 0x0140, 0x00f8,
694 0x00d0, 0x00b0, 0x00a0, 0x2028, 0xa18c, 0x00ff, 0x2130, 0xa094,
695 0xff00, 0x00c0, 0x24ee, 0x81ff, 0x0040, 0x24f2, 0x1078, 0x5623,
696 0x0078, 0x24f9, 0xa080, 0x293f, 0x200c, 0xa18c, 0xff00, 0x810f,
697 0xa006, 0x007c, 0xa080, 0x293f, 0x200c, 0xa18c, 0x00ff, 0x007c,
698 0x0c7e, 0x2061, 0xa300, 0x6030, 0x0040, 0x2509, 0xc09d, 0x0078,
699 0x250a, 0xc09c, 0x6032, 0x0c7f, 0x007c, 0x007e, 0x157e, 0x0f7e,
700 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854, 0xd08c, 0x00c0, 0x251a,
701 0x00f0, 0x2514, 0x0f7f, 0x157f, 0x007f, 0x007c, 0x0c7e, 0x007e,
702 0x2061, 0x0100, 0x6030, 0x007e, 0x6048, 0x007e, 0x60e4, 0x007e,
703 0x60e8, 0x007e, 0x6050, 0x007e, 0x60f0, 0x007e, 0x60ec, 0x007e,
704 0x600c, 0x007e, 0x6004, 0x007e, 0x6028, 0x007e, 0x60e0, 0x007e,
705 0x602f, 0x0100, 0x602f, 0x0000, 0x0005, 0x0005, 0x0005, 0x0005,
706 0x602f, 0x0040, 0x602f, 0x0000, 0x007f, 0x60e2, 0x007f, 0x602a,
707 0x007f, 0x6006, 0x007f, 0x600e, 0x007f, 0x60ee, 0x007f, 0x60f2,
708 0x007f, 0x6052, 0x007f, 0x60ea, 0x007f, 0x60e6, 0x007f, 0x604a,
709 0x007f, 0x6032, 0x007f, 0x0c7f, 0x007c, 0x257d, 0x2581, 0x2585,
710 0x258b, 0x2591, 0x2597, 0x259d, 0x25a5, 0x25ad, 0x25b3, 0x25b9,
711 0x25c1, 0x25c9, 0x25d1, 0x25d9, 0x25e3, 0x25ed, 0x25ed, 0x25ed,
712 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x25ed,
713 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x25ed, 0x107e, 0x007e, 0x0078,
714 0x2606, 0x107e, 0x007e, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078,
715 0x2200, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078, 0x2200, 0x0078,
716 0x2606, 0x107e, 0x007e, 0x1078, 0x20de, 0x0078, 0x2606, 0x107e,
717 0x007e, 0x1078, 0x20de, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078,
718 0x2200, 0x1078, 0x20de, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078,
719 0x2200, 0x1078, 0x20de, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078,
720 0x2123, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078, 0x2123, 0x0078,
721 0x2606, 0x107e, 0x007e, 0x1078, 0x2200, 0x1078, 0x2123, 0x0078,
722 0x2606, 0x107e, 0x007e, 0x1078, 0x2200, 0x1078, 0x2123, 0x0078,
723 0x2606, 0x107e, 0x007e, 0x1078, 0x20de, 0x1078, 0x2123, 0x0078,
724 0x2606, 0x107e, 0x007e, 0x1078, 0x20de, 0x1078, 0x2123, 0x0078,
725 0x2606, 0x107e, 0x007e, 0x1078, 0x2200, 0x1078, 0x20de, 0x1078,
726 0x2123, 0x0078, 0x2606, 0x107e, 0x007e, 0x1078, 0x2200, 0x1078,
727 0x20de, 0x1078, 0x2123, 0x0078, 0x2606, 0x0005, 0x0078, 0x25ed,
728 0xb084, 0x003c, 0x8004, 0x8004, 0x0079, 0x25f6, 0x2606, 0x2583,
729 0x2587, 0x258d, 0x2593, 0x2599, 0x259f, 0x25a7, 0x25af, 0x25b5,
730 0x25bb, 0x25c3, 0x25cb, 0x25d3, 0x25db, 0x25e5, 0x0008, 0x25f0,
731 0x007f, 0x107f, 0x2091, 0x8001, 0x007c, 0x0c7e, 0x027e, 0x047e,
732 0x2021, 0x0000, 0x1078, 0x4897, 0x00c0, 0x2705, 0x70c8, 0xd09c,
733 0x0040, 0x2624, 0xd084, 0x00c0, 0x2624, 0xd0bc, 0x00c0, 0x2705,
734 0x1078, 0x2709, 0x0078, 0x2705, 0xd094, 0x0040, 0x262b, 0x7093,
735 0xffff, 0x0078, 0x2705, 0x2001, 0x010c, 0x203c, 0x7280, 0xd284,
736 0x0040, 0x2694, 0xd28c, 0x00c0, 0x2694, 0x037e, 0x7390, 0xa38e,
737 0xffff, 0x0040, 0x263e, 0x83ff, 0x00c0, 0x2640, 0x2019, 0x0001,
738 0x8314, 0xa2e0, 0xa9c0, 0x2c04, 0xa38c, 0x0001, 0x0040, 0x264d,
739 0xa084, 0xff00, 0x8007, 0x0078, 0x264f, 0xa084, 0x00ff, 0xa70e,
740 0x0040, 0x2689, 0xa08e, 0x0000, 0x0040, 0x2689, 0xa08e, 0x00ff,
741 0x00c0, 0x2666, 0x7230, 0xd284, 0x00c0, 0x268f, 0x7280, 0xc28d,
742 0x7282, 0x7093, 0xffff, 0x037f, 0x0078, 0x2694, 0x2009, 0x0000,
743 0x1078, 0x24e3, 0x1078, 0x4499, 0x00c0, 0x268c, 0x6004, 0xa084,
744 0x00ff, 0xa086, 0x0006, 0x00c0, 0x2683, 0x7030, 0xd08c, 0x0040,
745 0x267d, 0x6000, 0xd0bc, 0x0040, 0x2683, 0x1078, 0x271f, 0x0040,
746 0x268c, 0x0078, 0x2689, 0x1078, 0x2857, 0x1078, 0x274c, 0x0040,
747 0x268c, 0x8318, 0x0078, 0x2640, 0x7392, 0x0078, 0x2691, 0x7093,
748 0xffff, 0x037f, 0x0078, 0x2705, 0xa780, 0x293f, 0x203c, 0xa7bc,
749 0xff00, 0x873f, 0x2041, 0x007e, 0x7090, 0xa096, 0xffff, 0x00c0,
750 0x26a6, 0x2009, 0x0000, 0x28a8, 0x0078, 0x26b2, 0xa812, 0x0048,
751 0x26ae, 0x2008, 0xa802, 0x20a8, 0x0078, 0x26b2, 0x7093, 0xffff,
752 0x0078, 0x2705, 0x2700, 0x157e, 0x017e, 0xa106, 0x0040, 0x26f9,
753 0xc484, 0x1078, 0x4501, 0x0040, 0x26c3, 0x1078, 0x4499, 0x00c0,
754 0x2702, 0x0078, 0x26c4, 0xc485, 0x6004, 0xa084, 0x00ff, 0xa086,
755 0x0006, 0x00c0, 0x26d3, 0x7030, 0xd08c, 0x0040, 0x26f1, 0x6000,
756 0xd0bc, 0x00c0, 0x26f1, 0x7280, 0xd28c, 0x0040, 0x26e9, 0x6004,
757 0xa084, 0x00ff, 0xa082, 0x0006, 0x0048, 0x26f9, 0xd484, 0x00c0,
758 0x26e5, 0x1078, 0x44bc, 0x0078, 0x26e7, 0x1078, 0x2921, 0x0078,
759 0x26f9, 0x1078, 0x2857, 0x1078, 0x274c, 0x0040, 0x2702, 0x0078,
760 0x26f9, 0x1078, 0x28ec, 0x0040, 0x26f9, 0x1078, 0x271f, 0x0040,
761 0x2702, 0x017f, 0x8108, 0x157f, 0x00f0, 0x26b2, 0x7093, 0xffff,
762 0x0078, 0x2705, 0x017f, 0x157f, 0x7192, 0x047f, 0x027f, 0x0c7f,
763 0x007c, 0x0c7e, 0x017e, 0x7093, 0x0000, 0x2009, 0x007e, 0x1078,
764 0x4499, 0x00c0, 0x271c, 0x1078, 0x2857, 0x1078, 0x274c, 0x0040,
765 0x271c, 0x70c8, 0xc0bd, 0x70ca, 0x017f, 0x0c7f, 0x007c, 0x017e,
766 0x077e, 0x0d7e, 0x0c7e, 0x2c68, 0x2001, 0xa356, 0x2004, 0xa084,
767 0x00ff, 0x6842, 0x1078, 0x74d7, 0x0040, 0x2747, 0x2d00, 0x601a,
768 0x601f, 0x0001, 0x2001, 0x0000, 0x1078, 0x442b, 0x2001, 0x0000,
769 0x1078, 0x443f, 0x127e, 0x2091, 0x8000, 0x708c, 0x8000, 0x708e,
770 0x127f, 0x2009, 0x0004, 0x1078, 0x756c, 0xa085, 0x0001, 0x0c7f,
771 0x0d7f, 0x077f, 0x017f, 0x007c, 0x017e, 0x077e, 0x0d7e, 0x0c7e,
772 0x2c68, 0x2001, 0xa356, 0x2004, 0xa084, 0x00ff, 0x6842, 0x1078,
773 0x74d7, 0x0040, 0x2785, 0x2d00, 0x601a, 0x6800, 0xc0c4, 0x6802,
774 0x68a0, 0xa086, 0x007e, 0x0040, 0x276e, 0x6804, 0xa084, 0x00ff,
775 0xa086, 0x0006, 0x00c0, 0x276e, 0x1078, 0x2813, 0x601f, 0x0001,
776 0x2001, 0x0000, 0x1078, 0x442b, 0x2001, 0x0002, 0x1078, 0x443f,
777 0x127e, 0x2091, 0x8000, 0x708c, 0x8000, 0x708e, 0x127f, 0x2009,
778 0x0002, 0x1078, 0x756c, 0xa085, 0x0001, 0x0c7f, 0x0d7f, 0x077f,
779 0x017f, 0x007c, 0x0c7e, 0x027e, 0x2009, 0x0080, 0x1078, 0x4499,
780 0x00c0, 0x2798, 0x1078, 0x279b, 0x0040, 0x2798, 0x70cf, 0xffff,
781 0x027f, 0x0c7f, 0x007c, 0x017e, 0x077e, 0x0d7e, 0x0c7e, 0x2c68,
782 0x1078, 0x74d7, 0x0040, 0x27bd, 0x2d00, 0x601a, 0x601f, 0x0001,
783 0x2001, 0x0000, 0x1078, 0x442b, 0x2001, 0x0002, 0x1078, 0x443f,
784 0x127e, 0x2091, 0x8000, 0x70d0, 0x8000, 0x70d2, 0x127f, 0x2009,
785 0x0002, 0x1078, 0x756c, 0xa085, 0x0001, 0x0c7f, 0x0d7f, 0x077f,
786 0x017f, 0x007c, 0x0c7e, 0x0d7e, 0x127e, 0x2091, 0x8000, 0x2009,
787 0x007f, 0x1078, 0x4499, 0x00c0, 0x27de, 0x2c68, 0x1078, 0x74d7,
788 0x0040, 0x27de, 0x2d00, 0x601a, 0x6312, 0x601f, 0x0001, 0x620a,
789 0x2009, 0x0022, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f, 0x0d7f,
790 0x0c7f, 0x007c, 0x0e7e, 0x0c7e, 0x067e, 0x037e, 0x027e, 0x1078,
791 0x5d60, 0x1078, 0x5d02, 0x1078, 0x7ddf, 0x2130, 0x81ff, 0x0040,
792 0x27f7, 0x20a9, 0x007e, 0x2009, 0x0000, 0x0078, 0x27fb, 0x20a9,
793 0x007f, 0x2009, 0x0000, 0x017e, 0x1078, 0x4501, 0x00c0, 0x2804,
794 0x1078, 0x471b, 0x1078, 0x4235, 0x017f, 0x8108, 0x00f0, 0x27fb,
795 0x86ff, 0x00c0, 0x280d, 0x1078, 0x119b, 0x027f, 0x037f, 0x067f,
796 0x0c7f, 0x0e7f, 0x007c, 0x0e7e, 0x0c7e, 0x037e, 0x027e, 0x017e,
797 0x6218, 0x2270, 0x72a0, 0x027e, 0x2019, 0x0029, 0x1078, 0x5d53,
798 0x077e, 0x2039, 0x0000, 0x1078, 0x5c78, 0x2c08, 0x1078, 0x9c38,
799 0x077f, 0x017f, 0x2e60, 0x1078, 0x471b, 0x6210, 0x6314, 0x1078,
800 0x4235, 0x6212, 0x6316, 0x017f, 0x027f, 0x037f, 0x0c7f, 0x0e7f,
801 0x007c, 0x0e7e, 0x007e, 0x6018, 0xa080, 0x0028, 0x2004, 0xd0bc,
802 0x00c0, 0x284d, 0x2071, 0xa300, 0x708c, 0xa005, 0x0040, 0x284a,
803 0x8001, 0x708e, 0x007f, 0x0e7f, 0x007c, 0x2071, 0xa300, 0x70d0,
804 0xa005, 0x0040, 0x284a, 0x8001, 0x70d2, 0x0078, 0x284a, 0x6000,
805 0xc08c, 0x6002, 0x007c, 0x0f7e, 0x0e7e, 0x0c7e, 0x037e, 0x027e,
806 0x017e, 0x157e, 0x2178, 0x81ff, 0x00c0, 0x286a, 0x20a9, 0x0001,
807 0x0078, 0x2885, 0x2001, 0xa352, 0x2004, 0xd0c4, 0x0040, 0x2881,
808 0xd0a4, 0x0040, 0x2881, 0x047e, 0x6018, 0xa080, 0x0028, 0x2024,
809 0xa4a4, 0x00ff, 0x8427, 0xa006, 0x2009, 0x002d, 0x1078, 0x9ec0,
810 0x047f, 0x20a9, 0x00ff, 0x2011, 0x0000, 0x027e, 0xa28e, 0x007e,
811 0x0040, 0x28c9, 0xa28e, 0x007f, 0x0040, 0x28c9, 0xa28e, 0x0080,
812 0x0040, 0x28c9, 0xa288, 0xa434, 0x210c, 0x81ff, 0x0040, 0x28c9,
813 0x8fff, 0x1040, 0x28d5, 0x0c7e, 0x2160, 0x2001, 0x0001, 0x1078,
814 0x48a2, 0x0c7f, 0x2019, 0x0029, 0x1078, 0x5d53, 0x077e, 0x2039,
815 0x0000, 0x1078, 0x5c78, 0x0c7e, 0x027e, 0x2160, 0x6204, 0xa294,
816 0x00ff, 0xa286, 0x0006, 0x00c0, 0x28b9, 0x6007, 0x0404, 0x0078,
817 0x28be, 0x2001, 0x0004, 0x8007, 0xa215, 0x6206, 0x027f, 0x0c7f,
818 0x017e, 0x2c08, 0x1078, 0x9c38, 0x017f, 0x077f, 0x2160, 0x1078,
819 0x471b, 0x027f, 0x8210, 0x00f0, 0x2885, 0x157f, 0x017f, 0x027f,
820 0x037f, 0x0c7f, 0x0e7f, 0x0f7f, 0x007c, 0x047e, 0x027e, 0x017e,
821 0x2001, 0xa352, 0x2004, 0xd0c4, 0x0040, 0x28e8, 0xd0a4, 0x0040,
822 0x28e8, 0xa006, 0x2220, 0x8427, 0x2009, 0x0029, 0x1078, 0x9ec0,
823 0x017f, 0x027f, 0x047f, 0x007c, 0x017e, 0x027e, 0x037e, 0x0c7e,
824 0x7280, 0x82ff, 0x0040, 0x291a, 0xa290, 0xa352, 0x2214, 0xd2ac,
825 0x00c0, 0x291a, 0x2100, 0x1078, 0x24fa, 0x81ff, 0x0040, 0x291c,
826 0x2019, 0x0001, 0x8314, 0xa2e0, 0xa9c0, 0x2c04, 0xd384, 0x0040,
827 0x290e, 0xa084, 0xff00, 0x8007, 0x0078, 0x2910, 0xa084, 0x00ff,
828 0xa116, 0x0040, 0x291c, 0xa096, 0x00ff, 0x0040, 0x291a, 0x8318,
829 0x0078, 0x2902, 0xa085, 0x0001, 0x0c7f, 0x037f, 0x027f, 0x017f,
830 0x007c, 0x017e, 0x0c7e, 0x127e, 0x2091, 0x8000, 0xa180, 0xa434,
831 0x2004, 0xa065, 0x0040, 0x293b, 0x017e, 0x0c7e, 0x1078, 0x8ec0,
832 0x017f, 0x1040, 0x1328, 0x611a, 0x1078, 0x2813, 0x1078, 0x753d,
833 0x017f, 0x1078, 0x44bc, 0x127f, 0x0c7f, 0x017f, 0x007c, 0x7eef,
834 0x7de8, 0x7ce4, 0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9,
835 0x80d6, 0x80d5, 0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd,
836 0x80cc, 0x80cb, 0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3,
837 0x80bc, 0x80ba, 0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2,
838 0x80b1, 0x80ae, 0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7,
839 0x6da6, 0x6ca5, 0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098,
840 0x6797, 0x6690, 0x658f, 0x6488, 0x6384, 0x6282, 0x8081, 0x8080,
841 0x617c, 0x607a, 0x8079, 0x5f76, 0x8075, 0x8074, 0x8073, 0x8072,
842 0x8071, 0x806e, 0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067,
843 0x5a66, 0x5965, 0x5863, 0x575c, 0x565a, 0x5559, 0x8056, 0x8055,
844 0x5454, 0x5353, 0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b,
845 0x4e4a, 0x4d49, 0x8047, 0x4c46, 0x8045, 0x8043, 0x803c, 0x803a,
846 0x8039, 0x8036, 0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831, 0x802e,
847 0x472d, 0x462c, 0x452b, 0x442a, 0x4329, 0x4227, 0x8026, 0x8025,
848 0x4123, 0x401f, 0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010,
849 0x3b0f, 0x3a08, 0x8004, 0x3902, 0x8001, 0x8000, 0x8000, 0x3800,
850 0x3700, 0x3600, 0x8000, 0x3500, 0x8000, 0x8000, 0x8000, 0x3400,
851 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3300, 0x3200,
852 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3100, 0x3000,
853 0x8000, 0x8000, 0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000,
854 0x8000, 0x8000, 0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800, 0x8000,
855 0x2700, 0x2600, 0x2500, 0x2400, 0x2300, 0x2200, 0x8000, 0x8000,
856 0x2100, 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000,
857 0x1b00, 0x1a00, 0x8000, 0x1900, 0x8000, 0x8000, 0x8000, 0x8000,
858 0x8000, 0x8000, 0x1800, 0x8000, 0x1700, 0x1600, 0x1500, 0x8000,
859 0x1400, 0x1300, 0x1200, 0x1100, 0x1000, 0x0f00, 0x8000, 0x8000,
860 0x0e00, 0x0d00, 0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000,
861 0x0800, 0x0700, 0x8000, 0x0600, 0x8000, 0x8000, 0x8000, 0x0500,
862 0x0400, 0x0300, 0x8000, 0x0200, 0x8000, 0x8000, 0x8000, 0x0100,
863 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x8000,
864 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
865 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x2071,
866 0xa381, 0x7003, 0x0002, 0xa006, 0x7012, 0x7016, 0x703a, 0x703e,
867 0x7033, 0xa391, 0x7037, 0xa391, 0x7007, 0x0001, 0x2061, 0xa3d1,
868 0x6003, 0x0002, 0x007c, 0x0090, 0x2a66, 0x0068, 0x2a66, 0x2071,
869 0xa381, 0x2b78, 0x7818, 0xd084, 0x00c0, 0x2a66, 0x2a60, 0x7820,
870 0xa08e, 0x0069, 0x00c0, 0x2b56, 0x0079, 0x2aea, 0x007c, 0x2071,
871 0xa381, 0x7004, 0x0079, 0x2a6c, 0x2a70, 0x2a71, 0x2a7b, 0x2a8d,
872 0x007c, 0x0090, 0x2a7a, 0x0068, 0x2a7a, 0x2b78, 0x7818, 0xd084,
873 0x0040, 0x2a99, 0x007c, 0x2b78, 0x2061, 0xa3d1, 0x6008, 0xa08e,
874 0x0100, 0x0040, 0x2a88, 0xa086, 0x0200, 0x0040, 0x2b4e, 0x007c,
875 0x7014, 0x2068, 0x2a60, 0x7018, 0x007a, 0x7010, 0x2068, 0x6834,
876 0xa086, 0x0103, 0x0040, 0x2a95, 0x007c, 0x2a60, 0x2b78, 0x7018,
877 0x007a, 0x2a60, 0x7820, 0xa08a, 0x0040, 0x00c8, 0x2aa2, 0x61b8,
878 0x0079, 0x2aaa, 0x2100, 0xa08a, 0x003f, 0x00c8, 0x2b4a, 0x61b8,
879 0x0079, 0x2aea, 0x2b2c, 0x2b5e, 0x2b66, 0x2b6a, 0x2b72, 0x2b78,
880 0x2b7c, 0x2b88, 0x2b8c, 0x2b96, 0x2b9a, 0x2b4a, 0x2b4a, 0x2b4a,
881 0x2b9e, 0x2b4a, 0x2bae, 0x2bc5, 0x2bdc, 0x2c58, 0x2c5d, 0x2c8a,
882 0x2ce4, 0x2cf5, 0x2d13, 0x2d54, 0x2d5e, 0x2d6b, 0x2d7e, 0x2d9d,
883 0x2da6, 0x2de3, 0x2de9, 0x2b4a, 0x2e05, 0x2b4a, 0x2b4a, 0x2b4a,
884 0x2b4a, 0x2b4a, 0x2e0c, 0x2e16, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a,
885 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2e1e, 0x2b4a, 0x2b4a, 0x2b4a,
886 0x2b4a, 0x2b4a, 0x2e30, 0x2e47, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a,
887 0x2b4a, 0x2b4a, 0x2e59, 0x2eb0, 0x2f0e, 0x2f1f, 0x2b4a, 0x2b4a,
888 0x2b4a, 0x38f1, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a,
889 0x2b4a, 0x2b4a, 0x2b96, 0x2b9a, 0x2f36, 0x2b4a, 0x2f43, 0x397d,
890 0x39da, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a,
891 0x2b4a, 0x2b4a, 0x2f90, 0x30c5, 0x30e1, 0x30ed, 0x3150, 0x31a9,
892 0x31b4, 0x31f3, 0x3202, 0x3211, 0x3214, 0x2f47, 0x3238, 0x3284,
893 0x3291, 0x33a2, 0x34cd, 0x34f7, 0x3604, 0x3614, 0x3621, 0x365b,
894 0x372a, 0x2b4a, 0x2b4a, 0x2b4a, 0x2b4a, 0x3792, 0x37ae, 0x3828,
895 0x38e2, 0x713c, 0x0078, 0x2b2c, 0x2021, 0x4000, 0x1078, 0x3553,
896 0x127e, 0x2091, 0x8000, 0x0068, 0x2b39, 0x7818, 0xd084, 0x0040,
897 0x2b3c, 0x127f, 0x0078, 0x2b30, 0x7c22, 0x7926, 0x7a2a, 0x7b2e,
898 0x781b, 0x0001, 0x2091, 0x4080, 0x7007, 0x0001, 0x2091, 0x5000,
899 0x127f, 0x007c, 0x2021, 0x4001, 0x0078, 0x2b2e, 0x2021, 0x4002,
900 0x0078, 0x2b2e, 0x2021, 0x4003, 0x0078, 0x2b2e, 0x2021, 0x4005,
901 0x0078, 0x2b2e, 0x2021, 0x4006, 0x0078, 0x2b2e, 0xa02e, 0x2520,
902 0x7b28, 0x7a2c, 0x7824, 0x7930, 0x0078, 0x3562, 0x7823, 0x0004,
903 0x7824, 0x007a, 0xa02e, 0x2520, 0x7b28, 0x7a2c, 0x7824, 0x7930,
904 0x0078, 0x3566, 0x7924, 0x7828, 0x2114, 0x200a, 0x0078, 0x2b2c,
905 0x7924, 0x2114, 0x0078, 0x2b2c, 0x2099, 0x0009, 0x20a1, 0x0009,
906 0x20a9, 0x0007, 0x53a3, 0x7924, 0x7a28, 0x7b2c, 0x0078, 0x2b2c,
907 0x7824, 0x2060, 0x0078, 0x2ba0, 0x2009, 0x0001, 0x2011, 0x0013,
908 0x2019, 0x0010, 0x783b, 0x0017, 0x0078, 0x2b2c, 0x7d38, 0x7c3c,
909 0x0078, 0x2b60, 0x7d38, 0x7c3c, 0x0078, 0x2b6c, 0x2061, 0x1000,
910 0x610c, 0xa006, 0x2c14, 0xa200, 0x8c60, 0x8109, 0x00c0, 0x2ba2,
911 0x2010, 0xa005, 0x0040, 0x2b2c, 0x0078, 0x2b52, 0x2069, 0xa351,
912 0x7824, 0x7930, 0xa11a, 0x00c8, 0x2b5a, 0x8019, 0x0040, 0x2b5a,
913 0x684a, 0x6942, 0x782c, 0x6852, 0x7828, 0x6856, 0xa006, 0x685a,
914 0x685e, 0x1078, 0x4dbd, 0x0078, 0x2b2c, 0x2069, 0xa351, 0x7824,
915 0x7934, 0xa11a, 0x00c8, 0x2b5a, 0x8019, 0x0040, 0x2b5a, 0x684e,
916 0x6946, 0x782c, 0x6862, 0x7828, 0x6866, 0xa006, 0x686a, 0x686e,
917 0x1078, 0x494d, 0x0078, 0x2b2c, 0xa02e, 0x2520, 0x81ff, 0x00c0,
918 0x2b56, 0x7924, 0x7b28, 0x7a2c, 0x20a9, 0x0005, 0x20a1, 0xa388,
919 0x41a1, 0x1078, 0x3518, 0x0040, 0x2b56, 0x2009, 0x0020, 0x1078,
920 0x3562, 0x701b, 0x2bf4, 0x007c, 0x6834, 0x2008, 0xa084, 0x00ff,
921 0xa096, 0x0011, 0x0040, 0x2c00, 0xa096, 0x0019, 0x00c0, 0x2b56,
922 0x810f, 0xa18c, 0x00ff, 0x0040, 0x2b56, 0x710e, 0x700c, 0x8001,
923 0x0040, 0x2c31, 0x700e, 0x1078, 0x3518, 0x0040, 0x2b56, 0x2009,
924 0x0020, 0x2061, 0xa3d1, 0x6224, 0x6328, 0x642c, 0x6530, 0xa290,
925 0x0040, 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9, 0x0000, 0x1078,
926 0x3562, 0x701b, 0x2c24, 0x007c, 0x6834, 0xa084, 0x00ff, 0xa096,
927 0x0002, 0x0040, 0x2c2f, 0xa096, 0x000a, 0x00c0, 0x2b56, 0x0078,
928 0x2c06, 0x7010, 0x2068, 0x6838, 0xc0fd, 0x683a, 0x1078, 0x436e,
929 0x00c0, 0x2c3f, 0x7007, 0x0003, 0x701b, 0x2c41, 0x007c, 0x1078,
930 0x4a60, 0x127e, 0x2091, 0x8000, 0x20a9, 0x0005, 0x2099, 0xa388,
931 0x530a, 0x2100, 0xa210, 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9,
932 0x0000, 0xad80, 0x000d, 0x2009, 0x0020, 0x127f, 0x0078, 0x3566,
933 0x61a0, 0x7824, 0x60a2, 0x0078, 0x2b2c, 0x2091, 0x8000, 0x7823,
934 0x4000, 0x7827, 0x4953, 0x782b, 0x5020, 0x782f, 0x2020, 0x2009,
935 0x017f, 0x2104, 0x7832, 0x3f00, 0x7836, 0x2061, 0x0100, 0x6200,
936 0x2061, 0x0200, 0x603c, 0x8007, 0xa205, 0x783a, 0x2009, 0x04fd,
937 0x2104, 0x783e, 0x781b, 0x0001, 0x2091, 0x5000, 0x2091, 0x4080,
938 0x2071, 0x0010, 0x20c1, 0x00f0, 0xa08a, 0x0003, 0x00c8, 0x0427,
939 0x0078, 0x0423, 0x81ff, 0x00c0, 0x2b56, 0x7924, 0x810f, 0xa18c,
940 0x00ff, 0x1078, 0x4501, 0x00c0, 0x2b5a, 0x7e38, 0xa684, 0x3fff,
941 0xa082, 0x4000, 0x0048, 0x2c9e, 0x0078, 0x2b5a, 0x7c28, 0x7d2c,
942 0x1078, 0x46d6, 0xd28c, 0x00c0, 0x2ca9, 0x1078, 0x466a, 0x0078,
943 0x2cab, 0x1078, 0x46a4, 0x00c0, 0x2cd5, 0x2061, 0xaa00, 0x127e,
944 0x2091, 0x8000, 0x6000, 0xa086, 0x0000, 0x0040, 0x2cc3, 0x6010,
945 0xa06d, 0x0040, 0x2cc3, 0x683c, 0xa406, 0x00c0, 0x2cc3, 0x6840,
946 0xa506, 0x0040, 0x2cce, 0x127f, 0xace0, 0x0010, 0x2001, 0xa315,
947 0x2004, 0xac02, 0x00c8, 0x2b56, 0x0078, 0x2caf, 0x1078, 0x8758,
948 0x127f, 0x0040, 0x2b56, 0x0078, 0x2b2c, 0xa00e, 0x2001, 0x0005,
949 0x1078, 0x4a60, 0x127e, 0x2091, 0x8000, 0x1078, 0x8cc0, 0x1078,
950 0x4982, 0x127f, 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56, 0x1078,
951 0x3530, 0x0040, 0x2b5a, 0x1078, 0x45a7, 0x0040, 0x2b56, 0x1078,
952 0x46e4, 0x0040, 0x2b56, 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56,
953 0x1078, 0x3542, 0x0040, 0x2b5a, 0x1078, 0x475f, 0x0040, 0x2b56,
954 0x2019, 0x0005, 0x1078, 0x4705, 0x0040, 0x2b56, 0x7828, 0xa08a,
955 0x1000, 0x00c8, 0x2b5a, 0x8003, 0x800b, 0x810b, 0xa108, 0x1078,
956 0x58e1, 0x0078, 0x2b2c, 0x127e, 0x2091, 0x8000, 0x81ff, 0x0040,
957 0x2d1d, 0x2009, 0x0001, 0x0078, 0x2d4e, 0x2029, 0x00ff, 0x644c,
958 0x2400, 0xa506, 0x0040, 0x2d48, 0x2508, 0x1078, 0x4501, 0x00c0,
959 0x2d48, 0x1078, 0x475f, 0x00c0, 0x2d33, 0x2009, 0x0002, 0x62a8,
960 0x2518, 0x0078, 0x2d4e, 0x2019, 0x0004, 0x1078, 0x4705, 0x00c0,
961 0x2d3d, 0x2009, 0x0006, 0x0078, 0x2d4e, 0x7824, 0xa08a, 0x1000,
962 0x00c8, 0x2d51, 0x8003, 0x800b, 0x810b, 0xa108, 0x1078, 0x58e1,
963 0x8529, 0x00c8, 0x2d20, 0x127f, 0x0078, 0x2b2c, 0x127f, 0x0078,
964 0x2b56, 0x127f, 0x0078, 0x2b5a, 0x1078, 0x3530, 0x0040, 0x2b5a,
965 0x1078, 0x461b, 0x1078, 0x46d6, 0x0078, 0x2b2c, 0x81ff, 0x00c0,
966 0x2b56, 0x1078, 0x3530, 0x0040, 0x2b5a, 0x1078, 0x460a, 0x1078,
967 0x46d6, 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x3530,
968 0x0040, 0x2b5a, 0x1078, 0x46a7, 0x0040, 0x2b56, 0x1078, 0x43c1,
969 0x1078, 0x4663, 0x1078, 0x46d6, 0x0078, 0x2b2c, 0x1078, 0x3530,
970 0x0040, 0x2b5a, 0x1078, 0x45a7, 0x0040, 0x2b56, 0x62a0, 0x2019,
971 0x0005, 0x0c7e, 0x1078, 0x471b, 0x0c7f, 0x1078, 0x5d53, 0x077e,
972 0x2039, 0x0000, 0x1078, 0x5c78, 0x2009, 0x0000, 0x1078, 0x9c38,
973 0x077f, 0x1078, 0x46d6, 0x0078, 0x2b2c, 0x1078, 0x3530, 0x0040,
974 0x2b5a, 0x1078, 0x46d6, 0x2208, 0x0078, 0x2b2c, 0x157e, 0x0d7e,
975 0x0e7e, 0x2069, 0xa413, 0x6810, 0x6914, 0xa10a, 0x00c8, 0x2db2,
976 0x2009, 0x0000, 0x6816, 0x2011, 0x0000, 0x2019, 0x0000, 0x20a9,
977 0x00ff, 0x2069, 0xa434, 0x2d04, 0xa075, 0x0040, 0x2dc7, 0x704c,
978 0x1078, 0x2dd1, 0xa210, 0x7080, 0x1078, 0x2dd1, 0xa318, 0x8d68,
979 0x00f0, 0x2dbb, 0x2300, 0xa218, 0x0e7f, 0x0d7f, 0x157f, 0x0078,
980 0x2b2c, 0x0f7e, 0x017e, 0xa07d, 0x0040, 0x2de0, 0x2001, 0x0000,
981 0x8000, 0x2f0c, 0x81ff, 0x0040, 0x2de0, 0x2178, 0x0078, 0x2dd8,
982 0x017f, 0x0f7f, 0x007c, 0x2069, 0xa413, 0x6910, 0x62a4, 0x0078,
983 0x2b2c, 0x81ff, 0x00c0, 0x2b56, 0x614c, 0xa190, 0x293f, 0x2214,
984 0xa294, 0x00ff, 0x606c, 0xa084, 0xff00, 0xa215, 0x6368, 0x67c8,
985 0xd79c, 0x0040, 0x2dff, 0x2031, 0x0001, 0x0078, 0x2e01, 0x2031,
986 0x0000, 0x7e3a, 0x7f3e, 0x0078, 0x2b2c, 0x613c, 0x6240, 0x2019,
987 0xa5a0, 0x231c, 0x0078, 0x2b2c, 0x127e, 0x2091, 0x8000, 0x6134,
988 0xa006, 0x2010, 0x2018, 0x127f, 0x0078, 0x2b2c, 0x1078, 0x3542,
989 0x0040, 0x2b5a, 0x6244, 0x6338, 0x0078, 0x2b2c, 0x613c, 0x6240,
990 0x7824, 0x603e, 0x7b28, 0x6342, 0x2069, 0xa351, 0x831f, 0xa305,
991 0x6816, 0x782c, 0x2069, 0xa5a0, 0x2d1c, 0x206a, 0x0078, 0x2b2c,
992 0x017e, 0x127e, 0x2091, 0x8000, 0x7824, 0x6036, 0xd094, 0x0040,
993 0x2e43, 0x7828, 0xa085, 0x0001, 0x2009, 0xa5a9, 0x200a, 0x2001,
994 0xffff, 0x1078, 0x5975, 0x127f, 0x017f, 0x0078, 0x2b2c, 0x1078,
995 0x3542, 0x0040, 0x2b5a, 0x7828, 0xa00d, 0x0040, 0x2b5a, 0x782c,
996 0xa005, 0x0040, 0x2b5a, 0x6244, 0x6146, 0x6338, 0x603a, 0x0078,
997 0x2b2c, 0x2001, 0xa300, 0x2004, 0xa086, 0x0003, 0x00c0, 0x2b56,
998 0x0c7e, 0x2061, 0x0100, 0x7924, 0x810f, 0xa18c, 0x00ff, 0xa196,
999 0x00ff, 0x00c0, 0x2e70, 0x6030, 0xa085, 0xff00, 0x0078, 0x2e7f,
1000 0xa182, 0x007f, 0x00c8, 0x2ea9, 0xa188, 0x293f, 0x210c, 0xa18c,
1001 0x00ff, 0x6030, 0xa116, 0x0040, 0x2ea9, 0x810f, 0xa105, 0x127e,
1002 0x2091, 0x8000, 0x007e, 0x1078, 0x74d7, 0x007f, 0x0040, 0x2ea5,
1003 0x601a, 0x600b, 0xbc09, 0x601f, 0x0001, 0x1078, 0x3518, 0x0040,
1004 0x2eac, 0x6837, 0x0000, 0x7007, 0x0003, 0x6833, 0x0000, 0x6838,
1005 0xc0fd, 0x683a, 0x701b, 0x2f07, 0x2d00, 0x6012, 0x2009, 0x0032,
1006 0x1078, 0x756c, 0x127f, 0x0c7f, 0x007c, 0x127f, 0x0c7f, 0x0078,
1007 0x2b56, 0x0c7f, 0x0078, 0x2b5a, 0x1078, 0x753d, 0x0078, 0x2ea5,
1008 0x2001, 0xa300, 0x2004, 0xa086, 0x0003, 0x00c0, 0x2b56, 0x0c7e,
1009 0x2061, 0x0100, 0x7924, 0x810f, 0xa18c, 0x00ff, 0xa196, 0x00ff,
1010 0x00c0, 0x2ec7, 0x6030, 0xa085, 0xff00, 0x0078, 0x2ed6, 0xa182,
1011 0x007f, 0x00c8, 0x2f00, 0xa188, 0x293f, 0x210c, 0xa18c, 0x00ff,
1012 0x6030, 0xa116, 0x0040, 0x2f00, 0x810f, 0xa105, 0x127e, 0x2091,
1013 0x8000, 0x007e, 0x1078, 0x74d7, 0x007f, 0x0040, 0x2efc, 0x601a,
1014 0x600b, 0xbc05, 0x601f, 0x0001, 0x1078, 0x3518, 0x0040, 0x2f03,
1015 0x6837, 0x0000, 0x7007, 0x0003, 0x6833, 0x0000, 0x6838, 0xc0fd,
1016 0x683a, 0x701b, 0x2f07, 0x2d00, 0x6012, 0x2009, 0x0032, 0x1078,
1017 0x756c, 0x127f, 0x0c7f, 0x007c, 0x127f, 0x0c7f, 0x0078, 0x2b56,
1018 0x0c7f, 0x0078, 0x2b5a, 0x1078, 0x753d, 0x0078, 0x2efc, 0x6830,
1019 0xa086, 0x0100, 0x0040, 0x2b56, 0x0078, 0x2b2c, 0x2061, 0xa62d,
1020 0x127e, 0x2091, 0x8000, 0x6000, 0xd084, 0x0040, 0x2f1c, 0x6104,
1021 0x6208, 0x127f, 0x0078, 0x2b2c, 0x127f, 0x0078, 0x2b5a, 0x81ff,
1022 0x00c0, 0x2b56, 0x127e, 0x2091, 0x8000, 0x6244, 0x6060, 0xa202,
1023 0x0048, 0x2f33, 0xa085, 0x0001, 0x1078, 0x2500, 0x1078, 0x3bf5,
1024 0x127f, 0x0078, 0x2b2c, 0x127f, 0x0078, 0x2b5a, 0x127e, 0x2091,
1025 0x8000, 0x20a9, 0x0011, 0x2001, 0xa340, 0x20a0, 0xa006, 0x40a4,
1026 0x127f, 0x0078, 0x2b2c, 0x7d38, 0x7c3c, 0x0078, 0x2bde, 0x7824,
1027 0xa09c, 0x00ff, 0xa39a, 0x0003, 0x00c8, 0x2b56, 0x624c, 0xa084,
1028 0xff00, 0x8007, 0xa206, 0x00c0, 0x2f5f, 0x2001, 0xa340, 0x2009,
1029 0x000c, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0078, 0x3566, 0x81ff,
1030 0x00c0, 0x2b56, 0x1078, 0x3542, 0x0040, 0x2b5a, 0x6004, 0xa084,
1031 0x00ff, 0xa086, 0x0006, 0x00c0, 0x2b56, 0x0c7e, 0x1078, 0x3518,
1032 0x0c7f, 0x0040, 0x2b56, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a,
1033 0x1078, 0x8b85, 0x0040, 0x2b56, 0x7007, 0x0003, 0x701b, 0x2f81,
1034 0x007c, 0x6830, 0xa086, 0x0100, 0x0040, 0x2b56, 0xad80, 0x000e,
1035 0x2009, 0x000c, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0078, 0x3566,
1036 0x1078, 0x3518, 0x0040, 0x2b56, 0x1078, 0x421a, 0x2009, 0x001c,
1037 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x1078, 0x3562, 0x701b, 0x2fa1,
1038 0x007c, 0xade8, 0x000d, 0x6800, 0xa005, 0x0040, 0x2b5a, 0x6804,
1039 0xd0ac, 0x0040, 0x2fae, 0xd0a4, 0x0040, 0x2b5a, 0xd094, 0x0040,
1040 0x2fb9, 0x0c7e, 0x2061, 0x0100, 0x6104, 0xa18c, 0xffdf, 0x6106,
1041 0x0c7f, 0xd08c, 0x0040, 0x2fc4, 0x0c7e, 0x2061, 0x0100, 0x6104,
1042 0xa18d, 0x0010, 0x6106, 0x0c7f, 0x2009, 0x0100, 0x210c, 0xa18a,
1043 0x0002, 0x0048, 0x2fd9, 0xd084, 0x0040, 0x2fd9, 0x6a28, 0xa28a,
1044 0x007f, 0x00c8, 0x2b5a, 0xa288, 0x293f, 0x210c, 0xa18c, 0x00ff,
1045 0x6152, 0xd0dc, 0x0040, 0x2fe2, 0x6828, 0xa08a, 0x007f, 0x00c8,
1046 0x2b5a, 0x604e, 0x6808, 0xa08a, 0x0100, 0x0048, 0x2b5a, 0xa08a,
1047 0x0841, 0x00c8, 0x2b5a, 0xa084, 0x0007, 0x00c0, 0x2b5a, 0x680c,
1048 0xa005, 0x0040, 0x2b5a, 0x6810, 0xa005, 0x0040, 0x2b5a, 0x6848,
1049 0x6940, 0xa10a, 0x00c8, 0x2b5a, 0x8001, 0x0040, 0x2b5a, 0x684c,
1050 0x6944, 0xa10a, 0x00c8, 0x2b5a, 0x8001, 0x0040, 0x2b5a, 0x6804,
1051 0xd0fc, 0x0040, 0x3038, 0x1078, 0x3518, 0x0040, 0x2b56, 0x2009,
1052 0x0014, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0xa290, 0x0038, 0xa399,
1053 0x0000, 0x1078, 0x3562, 0x701b, 0x301e, 0x007c, 0xade8, 0x000d,
1054 0x20a9, 0x0014, 0x2d98, 0x2069, 0xa36d, 0x2da0, 0x53a3, 0x7010,
1055 0xa0e8, 0x000d, 0x2001, 0xa371, 0x200c, 0xd1e4, 0x0040, 0x3038,
1056 0x0c7e, 0x2061, 0x0100, 0x6004, 0xa085, 0x0b00, 0x6006, 0x0c7f,
1057 0x20a9, 0x001c, 0x2d98, 0x2069, 0xa351, 0x2da0, 0x53a3, 0x6814,
1058 0xa08c, 0x00ff, 0x613e, 0x8007, 0xa084, 0x00ff, 0x6042, 0x1078,
1059 0x4dbd, 0x1078, 0x48dd, 0x1078, 0x494d, 0x6000, 0xa086, 0x0000,
1060 0x00c0, 0x30c3, 0x6808, 0x602a, 0x1078, 0x218b, 0x6818, 0x691c,
1061 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a,
1062 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0040, 0x3070, 0x6830, 0x6934,
1063 0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0078, 0x3072,
1064 0xa084, 0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x1078, 0x59a8,
1065 0x6904, 0xd1fc, 0x0040, 0x30a5, 0x0c7e, 0x2009, 0x0000, 0x20a9,
1066 0x0001, 0x6b70, 0xd384, 0x0040, 0x30a2, 0x0078, 0x308c, 0x839d,
1067 0x00c8, 0x30a2, 0x3508, 0x8109, 0x1078, 0x5364, 0x6878, 0x6016,
1068 0x6874, 0x2008, 0xa084, 0xff00, 0x8007, 0x600a, 0xa184, 0x00ff,
1069 0x6006, 0x8108, 0x00c0, 0x30a0, 0x6003, 0x0003, 0x0078, 0x30a2,
1070 0x6003, 0x0001, 0x00f0, 0x3087, 0x0c7f, 0x0c7e, 0x2061, 0x0100,
1071 0x602f, 0x0040, 0x602f, 0x0000, 0x0c7f, 0x1078, 0x3784, 0x0040,
1072 0x30b3, 0x1078, 0x2500, 0x60bc, 0xa005, 0x0040, 0x30bf, 0x6003,
1073 0x0001, 0x2091, 0x301d, 0x1078, 0x4171, 0x0078, 0x30c3, 0x6003,
1074 0x0004, 0x2091, 0x301d, 0x0078, 0x2b2c, 0x6000, 0xa086, 0x0000,
1075 0x0040, 0x2b56, 0x2069, 0xa351, 0x7830, 0x6842, 0x7834, 0x6846,
1076 0x6804, 0xd0fc, 0x0040, 0x30d8, 0x2009, 0x0030, 0x0078, 0x30da,
1077 0x2009, 0x001c, 0x2d00, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0078,
1078 0x3566, 0xa006, 0x1078, 0x2500, 0x81ff, 0x00c0, 0x2b56, 0x1078,
1079 0x421a, 0x1078, 0x4171, 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56,
1080 0x6180, 0x81ff, 0x0040, 0x3107, 0x703f, 0x0000, 0x2001, 0xa9c0,
1081 0x2009, 0x0040, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x127e, 0x2091,
1082 0x8000, 0x1078, 0x3566, 0x701b, 0x2b29, 0x127f, 0x007c, 0x703f,
1083 0x0001, 0x0d7e, 0x2069, 0xa9c0, 0x20a9, 0x0040, 0x20a1, 0xa9c0,
1084 0x2019, 0xffff, 0x43a4, 0x654c, 0xa588, 0x293f, 0x210c, 0xa18c,
1085 0x00ff, 0x216a, 0xa00e, 0x2011, 0x0002, 0x2100, 0xa506, 0x0040,
1086 0x3139, 0x1078, 0x4501, 0x00c0, 0x3139, 0x6014, 0x821c, 0x0048,
1087 0x3131, 0xa398, 0xa9c0, 0xa085, 0xff00, 0x8007, 0x201a, 0x0078,
1088 0x3138, 0xa398, 0xa9c0, 0x2324, 0xa4a4, 0xff00, 0xa405, 0x201a,
1089 0x8210, 0x8108, 0xa182, 0x0080, 0x00c8, 0x3140, 0x0078, 0x311d,
1090 0x8201, 0x8007, 0x2d0c, 0xa105, 0x206a, 0x0d7f, 0x20a9, 0x0040,
1091 0x20a1, 0xa9c0, 0x2099, 0xa9c0, 0x1078, 0x41be, 0x0078, 0x30f6,
1092 0x1078, 0x3542, 0x0040, 0x2b5a, 0x0c7e, 0x1078, 0x3518, 0x0c7f,
1093 0x00c0, 0x315e, 0x2009, 0x0002, 0x0078, 0x2b56, 0x2001, 0xa352,
1094 0x2004, 0xd0b4, 0x0040, 0x3185, 0x6000, 0xd08c, 0x00c0, 0x3185,
1095 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x00c0, 0x3185, 0x6837,
1096 0x0000, 0x6838, 0xc0fd, 0x683a, 0x1078, 0x8bd9, 0x00c0, 0x317c,
1097 0x2009, 0x0003, 0x0078, 0x2b56, 0x7007, 0x0003, 0x701b, 0x3181,
1098 0x007c, 0x1078, 0x3542, 0x0040, 0x2b5a, 0x20a9, 0x002b, 0x2c98,
1099 0xade8, 0x0002, 0x2da0, 0x53a3, 0x20a9, 0x0004, 0xac80, 0x0006,
1100 0x2098, 0xad80, 0x0006, 0x20a0, 0x1078, 0x41be, 0x20a9, 0x0004,
1101 0xac80, 0x000a, 0x2098, 0xad80, 0x000a, 0x20a0, 0x1078, 0x41be,
1102 0x2d00, 0x2009, 0x002b, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0078,
1103 0x3566, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x3530, 0x0040, 0x2b5a,
1104 0x1078, 0x46ef, 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56, 0x7828,
1105 0xa08a, 0x1000, 0x00c8, 0x2b5a, 0x1078, 0x3542, 0x0040, 0x2b5a,
1106 0x1078, 0x475f, 0x0040, 0x2b56, 0x2019, 0x0004, 0x1078, 0x4705,
1107 0x7924, 0x810f, 0x7a28, 0x1078, 0x31cf, 0x0078, 0x2b2c, 0xa186,
1108 0x00ff, 0x0040, 0x31d7, 0x1078, 0x31e7, 0x0078, 0x31e6, 0x2029,
1109 0x007e, 0x2061, 0xa300, 0x644c, 0x2400, 0xa506, 0x0040, 0x31e3,
1110 0x2508, 0x1078, 0x31e7, 0x8529, 0x00c8, 0x31dc, 0x007c, 0x1078,
1111 0x4501, 0x00c0, 0x31f2, 0x2200, 0x8003, 0x800b, 0x810b, 0xa108,
1112 0x1078, 0x58e1, 0x007c, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x3530,
1113 0x0040, 0x2b5a, 0x1078, 0x45a7, 0x0040, 0x2b56, 0x1078, 0x46fa,
1114 0x0078, 0x2b2c, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x3530, 0x0040,
1115 0x2b5a, 0x1078, 0x45a7, 0x0040, 0x2b56, 0x1078, 0x46e4, 0x0078,
1116 0x2b2c, 0x6100, 0x0078, 0x2b2c, 0x1078, 0x3542, 0x0040, 0x2b5a,
1117 0x2001, 0xa300, 0x2004, 0xa086, 0x0003, 0x00c0, 0x2b56, 0x0d7e,
1118 0xace8, 0x000a, 0x7924, 0xd184, 0x0040, 0x3228, 0xace8, 0x0006,
1119 0x680c, 0x8007, 0x783e, 0x6808, 0x8007, 0x783a, 0x6b04, 0x831f,
1120 0x6a00, 0x8217, 0x0d7f, 0x6100, 0xa18c, 0x0200, 0x0078, 0x2b2c,
1121 0xa006, 0x1078, 0x2500, 0x7824, 0xa084, 0x00ff, 0xa086, 0x00ff,
1122 0x0040, 0x3245, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x421a, 0x7828,
1123 0xa08a, 0x1000, 0x00c8, 0x2b5a, 0x7924, 0xa18c, 0xff00, 0x810f,
1124 0xa186, 0x00ff, 0x0040, 0x325b, 0xa182, 0x007f, 0x00c8, 0x2b5a,
1125 0x2100, 0x1078, 0x24fa, 0x027e, 0x0c7e, 0x127e, 0x2091, 0x8000,
1126 0x2061, 0xa5be, 0x601b, 0x0000, 0x601f, 0x0000, 0x2061, 0x0100,
1127 0x6030, 0xa084, 0x00ff, 0x810f, 0xa105, 0x604a, 0x6043, 0x0090,
1128 0x6043, 0x0010, 0x2009, 0x002d, 0x2011, 0x4196, 0x1078, 0x596c,
1129 0x7924, 0xa18c, 0xff00, 0x810f, 0x7a28, 0x1078, 0x31cf, 0x127f,
1130 0x0c7f, 0x027f, 0x0078, 0x2b2c, 0x7924, 0xa18c, 0xff00, 0x810f,
1131 0x0c7e, 0x1078, 0x4499, 0x2c08, 0x0c7f, 0x00c0, 0x2b5a, 0x0078,
1132 0x2b2c, 0x81ff, 0x0040, 0x3298, 0x2009, 0x0001, 0x0078, 0x2b56,
1133 0x60c8, 0xd09c, 0x00c0, 0x32a0, 0x2009, 0x0005, 0x0078, 0x2b56,
1134 0x1078, 0x3518, 0x00c0, 0x32a8, 0x2009, 0x0002, 0x0078, 0x2b56,
1135 0x7924, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x1078, 0x3562, 0x701b,
1136 0x32b2, 0x007c, 0x2009, 0x0080, 0x1078, 0x4501, 0x00c0, 0x32bf,
1137 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x0040, 0x32c3, 0x2021,
1138 0x400a, 0x0078, 0x2b2e, 0x0d7e, 0xade8, 0x000d, 0x6900, 0x6a08,
1139 0x6b0c, 0x6c10, 0x6d14, 0x6e18, 0x6820, 0xa0be, 0x0100, 0x0040,
1140 0x3336, 0xa0be, 0x0112, 0x0040, 0x3336, 0xa0be, 0x0113, 0x0040,
1141 0x3336, 0xa0be, 0x0114, 0x0040, 0x3336, 0xa0be, 0x0117, 0x0040,
1142 0x3336, 0xa0be, 0x011a, 0x0040, 0x3336, 0xa0be, 0x0121, 0x0040,
1143 0x332c, 0xa0be, 0x0131, 0x0040, 0x332c, 0xa0be, 0x0171, 0x0040,
1144 0x3336, 0xa0be, 0x0173, 0x0040, 0x3336, 0xa0be, 0x01a1, 0x00c0,
1145 0x32fe, 0x6830, 0x8007, 0x6832, 0x0078, 0x333c, 0xa0be, 0x0212,
1146 0x0040, 0x3332, 0xa0be, 0x0213, 0x0040, 0x3332, 0xa0be, 0x0214,
1147 0x0040, 0x3324, 0xa0be, 0x0217, 0x0040, 0x331e, 0xa0be, 0x021a,
1148 0x00c0, 0x3317, 0x6838, 0x8007, 0x683a, 0x0078, 0x3336, 0xa0be,
1149 0x0300, 0x0040, 0x3336, 0x0d7f, 0x0078, 0x2b5a, 0xad80, 0x0010,
1150 0x20a9, 0x0007, 0x1078, 0x337e, 0xad80, 0x000e, 0x20a9, 0x0001,
1151 0x1078, 0x337e, 0x0078, 0x3336, 0xad80, 0x000c, 0x1078, 0x338c,
1152 0x0078, 0x333c, 0xad80, 0x000e, 0x1078, 0x338c, 0xad80, 0x000c,
1153 0x20a9, 0x0001, 0x1078, 0x337e, 0x0c7e, 0x1078, 0x3518, 0x0040,
1154 0x336f, 0x6838, 0xc0fd, 0x683a, 0x6837, 0x0119, 0x6853, 0x0000,
1155 0x684f, 0x0020, 0x685b, 0x0001, 0x810b, 0x697e, 0x6883, 0x0000,
1156 0x6a86, 0x6b8a, 0x6c8e, 0x6d92, 0x6996, 0x689b, 0x0000, 0x0c7f,
1157 0x0d7f, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x6823, 0x0000,
1158 0x6804, 0x2068, 0x1078, 0x8ba1, 0x00c0, 0x336a, 0x2009, 0x0003,
1159 0x0078, 0x2b56, 0x7007, 0x0003, 0x701b, 0x3375, 0x007c, 0x0c7f,
1160 0x0d7f, 0x2009, 0x0002, 0x0078, 0x2b56, 0x6820, 0xa086, 0x8001,
1161 0x00c0, 0x2b2c, 0x2009, 0x0004, 0x0078, 0x2b56, 0x017e, 0x2008,
1162 0x2044, 0x8000, 0x204c, 0x8000, 0x290a, 0x8108, 0x280a, 0x8108,
1163 0x00f0, 0x3380, 0x017f, 0x007c, 0x017e, 0x0a7e, 0x0b7e, 0x2008,
1164 0x2044, 0x8000, 0x204c, 0x8000, 0x2054, 0x8000, 0x205c, 0x2b0a,
1165 0x8108, 0x2a0a, 0x8108, 0x290a, 0x8108, 0x280a, 0x0b7f, 0x0a7f,
1166 0x017f, 0x007c, 0x81ff, 0x0040, 0x33a9, 0x2009, 0x0001, 0x0078,
1167 0x2b56, 0x7924, 0x2140, 0xa18c, 0xff00, 0x810f, 0xa182, 0x0080,
1168 0x0048, 0x2b5a, 0xa182, 0x00ff, 0x00c8, 0x2b5a, 0x7a2c, 0x7b28,
1169 0x6068, 0xa306, 0x00c0, 0x33c4, 0x606c, 0xa24e, 0x0040, 0x2b5a,
1170 0xa9cc, 0xff00, 0x0040, 0x2b5a, 0x0c7e, 0x1078, 0x346d, 0x2c68,
1171 0x0c7f, 0x0040, 0x33fc, 0xa0c6, 0x4000, 0x00c0, 0x33e2, 0x0c7e,
1172 0x007e, 0x2d60, 0x2009, 0x0000, 0x1078, 0x47cb, 0x00c0, 0x33d9,
1173 0xc185, 0x6000, 0xd0bc, 0x0040, 0x33de, 0xc18d, 0x007f, 0x0c7f,
1174 0x0078, 0x33f9, 0xa0c6, 0x4007, 0x00c0, 0x33e9, 0x2408, 0x0078,
1175 0x33f9, 0xa0c6, 0x4008, 0x00c0, 0x33f1, 0x2708, 0x2610, 0x0078,
1176 0x33f9, 0xa0c6, 0x4009, 0x00c0, 0x33f7, 0x0078, 0x33f9, 0x2001,
1177 0x4006, 0x2020, 0x0078, 0x2b2e, 0x2d00, 0x7022, 0x017e, 0x0b7e,
1178 0x0c7e, 0x0e7e, 0x2c70, 0x1078, 0x74d7, 0x0040, 0x3442, 0x2d00,
1179 0x601a, 0x2001, 0xa356, 0x2004, 0xa084, 0x00ff, 0x6842, 0x2e58,
1180 0x0e7f, 0x0e7e, 0x0c7e, 0x1078, 0x3518, 0x0c7f, 0x2b70, 0x00c0,
1181 0x3423, 0x1078, 0x753d, 0x0e7f, 0x0c7f, 0x0b7f, 0x017f, 0x2009,
1182 0x0002, 0x0078, 0x2b56, 0x6837, 0x0000, 0x2d00, 0x6012, 0x6833,
1183 0x0000, 0x6838, 0xc0fd, 0x683a, 0x127e, 0x2091, 0x8000, 0x1078,
1184 0x2813, 0x127f, 0x601f, 0x0001, 0x2001, 0x0000, 0x1078, 0x442b,
1185 0x2001, 0x0002, 0x1078, 0x443f, 0x2009, 0x0002, 0x1078, 0x756c,
1186 0xa085, 0x0001, 0x0e7f, 0x0c7f, 0x0b7f, 0x017f, 0x00c0, 0x344c,
1187 0x2009, 0x0003, 0x0078, 0x2b56, 0x7007, 0x0003, 0x701b, 0x3451,
1188 0x007c, 0x6830, 0xa086, 0x0100, 0x7020, 0x2060, 0x00c0, 0x345f,
1189 0x2009, 0x0004, 0x6204, 0xa294, 0x00ff, 0x0078, 0x2b56, 0x2009,
1190 0x0000, 0x1078, 0x47cb, 0x00c0, 0x3466, 0xc185, 0x6000, 0xd0bc,
1191 0x0040, 0x346b, 0xc18d, 0x0078, 0x2b2c, 0x0e7e, 0x0d7e, 0x2029,
1192 0x0000, 0x2021, 0x0080, 0x20a9, 0x007f, 0x2071, 0xa4b4, 0x2e04,
1193 0xa005, 0x00c0, 0x3482, 0x2100, 0xa406, 0x00c0, 0x34b3, 0x2428,
1194 0x0078, 0x34b3, 0x2068, 0x6f10, 0x2700, 0xa306, 0x00c0, 0x34a4,
1195 0x6e14, 0x2600, 0xa206, 0x00c0, 0x34a4, 0x2400, 0xa106, 0x00c0,
1196 0x34a0, 0x2d60, 0xd884, 0x0040, 0x34c8, 0x6004, 0xa084, 0x00ff,
1197 0xa086, 0x0006, 0x00c0, 0x34c8, 0x2001, 0x4000, 0x0078, 0x34c9,
1198 0x2001, 0x4007, 0x0078, 0x34c9, 0x2400, 0xa106, 0x00c0, 0x34b3,
1199 0x6e14, 0x87ff, 0x00c0, 0x34af, 0x86ff, 0x0040, 0x347f, 0x2001,
1200 0x4008, 0x0078, 0x34c9, 0x8420, 0x8e70, 0x00f0, 0x3477, 0x85ff,
1201 0x00c0, 0x34c2, 0x2001, 0x4009, 0x0078, 0x34c9, 0x2001, 0x0001,
1202 0x0078, 0x34c9, 0x1078, 0x4499, 0x00c0, 0x34be, 0x6312, 0x6216,
1203 0xa006, 0xa005, 0x0d7f, 0x0e7f, 0x007c, 0x81ff, 0x00c0, 0x2b56,
1204 0x1078, 0x3518, 0x0040, 0x2b56, 0x6837, 0x0000, 0x6838, 0xc0fd,
1205 0x683a, 0x7824, 0xa005, 0x0040, 0x2b5a, 0xa096, 0x00ff, 0x0040,
1206 0x34e5, 0xa092, 0x0004, 0x00c8, 0x2b5a, 0x2010, 0x2d18, 0x1078,
1207 0x27c2, 0x0040, 0x2b56, 0x7007, 0x0003, 0x701b, 0x34f0, 0x007c,
1208 0x6830, 0xa086, 0x0100, 0x0040, 0x2b56, 0x0078, 0x2b2c, 0x7924,
1209 0xa18c, 0xff00, 0x810f, 0xa182, 0x0080, 0x0048, 0x2b5a, 0xa182,
1210 0x00ff, 0x00c8, 0x2b5a, 0x127e, 0x2091, 0x8000, 0x1078, 0x8a89,
1211 0x00c0, 0x3515, 0xa190, 0xa434, 0x2204, 0xa065, 0x0040, 0x3515,
1212 0x1078, 0x4235, 0x127f, 0x0078, 0x2b2c, 0x127f, 0x0078, 0x2b56,
1213 0x1078, 0x1381, 0x0040, 0x352f, 0xa006, 0x6802, 0x7010, 0xa005,
1214 0x00c0, 0x3527, 0x2d00, 0x7012, 0x7016, 0x0078, 0x352d, 0x7014,
1215 0x6802, 0x2060, 0x2d00, 0x6006, 0x7016, 0xad80, 0x000d, 0x007c,
1216 0x7924, 0x810f, 0xa18c, 0x00ff, 0x1078, 0x4501, 0x00c0, 0x353f,
1217 0x7e28, 0xa684, 0x3fff, 0xa082, 0x4000, 0x0048, 0x3540, 0xa066,
1218 0x8cff, 0x007c, 0x7e24, 0x860f, 0xa18c, 0x00ff, 0x1078, 0x4501,
1219 0x00c0, 0x3550, 0xa6b4, 0x00ff, 0xa682, 0x4000, 0x0048, 0x3551,
1220 0xa066, 0x8cff, 0x007c, 0x017e, 0x7110, 0x81ff, 0x0040, 0x355e,
1221 0x2168, 0x6904, 0x1078, 0x139a, 0x0078, 0x3555, 0x7112, 0x7116,
1222 0x017f, 0x007c, 0x2031, 0x0001, 0x0078, 0x3568, 0x2031, 0x0000,
1223 0x2061, 0xa3d1, 0x6606, 0x6112, 0x600e, 0x6226, 0x632a, 0x642e,
1224 0x6532, 0x2c10, 0x1078, 0x13d1, 0x7007, 0x0002, 0x701b, 0x2b2c,
1225 0x007c, 0x0f7e, 0x127e, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001,
1226 0xa38f, 0x2004, 0xa005, 0x00c0, 0x3594, 0x0068, 0x3594, 0x7818,
1227 0xd084, 0x00c0, 0x3594, 0x7a22, 0x7b26, 0x7c2a, 0x781b, 0x0001,
1228 0x2091, 0x4080, 0x0078, 0x35b9, 0x017e, 0x0c7e, 0x0e7e, 0x2071,
1229 0xa381, 0x7138, 0xa182, 0x0008, 0x0048, 0x35a2, 0x7030, 0x2060,
1230 0x0078, 0x35b3, 0x7030, 0xa0e0, 0x0008, 0xac82, 0xa3d1, 0x0048,
1231 0x35ab, 0x2061, 0xa391, 0x2c00, 0x7032, 0x81ff, 0x00c0, 0x35b1,
1232 0x7036, 0x8108, 0x713a, 0x2262, 0x6306, 0x640a, 0x0e7f, 0x0c7f,
1233 0x017f, 0x127f, 0x0f7f, 0x007c, 0x0e7e, 0x2071, 0xa381, 0x7038,
1234 0xa005, 0x0040, 0x35f5, 0x127e, 0x2091, 0x8000, 0x0068, 0x35f4,
1235 0x0f7e, 0x2079, 0x0000, 0x7818, 0xd084, 0x00c0, 0x35f3, 0x0c7e,
1236 0x7034, 0x2060, 0x2c04, 0x7822, 0x6004, 0x7826, 0x6008, 0x782a,
1237 0x781b, 0x0001, 0x2091, 0x4080, 0x7038, 0x8001, 0x703a, 0xa005,
1238 0x00c0, 0x35e9, 0x7033, 0xa391, 0x7037, 0xa391, 0x0c7f, 0x0078,
1239 0x35f3, 0xac80, 0x0008, 0xa0fa, 0xa3d1, 0x0048, 0x35f1, 0x2001,
1240 0xa391, 0x7036, 0x0c7f, 0x0f7f, 0x127f, 0x0e7f, 0x007c, 0x027e,
1241 0x2001, 0xa352, 0x2004, 0xd0c4, 0x0040, 0x3602, 0x2011, 0x8014,
1242 0x1078, 0x3579, 0x027f, 0x007c, 0x81ff, 0x00c0, 0x2b56, 0x127e,
1243 0x2091, 0x8000, 0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x1078,
1244 0x4171, 0x127f, 0x0078, 0x2b2c, 0x7824, 0x2008, 0xa18c, 0xfffd,
1245 0x00c0, 0x361f, 0x61d4, 0xa10d, 0x61d6, 0x0078, 0x2b2c, 0x0078,
1246 0x2b5a, 0x81ff, 0x00c0, 0x2b56, 0x6000, 0xa086, 0x0003, 0x00c0,
1247 0x2b56, 0x2001, 0xa352, 0x2004, 0xd0ac, 0x00c0, 0x2b56, 0x1078,
1248 0x3542, 0x0040, 0x2b5a, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006,
1249 0x00c0, 0x363e, 0x7828, 0xa005, 0x0040, 0x2b2c, 0x0c7e, 0x1078,
1250 0x3518, 0x0c7f, 0x0040, 0x2b56, 0x6837, 0x0000, 0x6833, 0x0000,
1251 0x6838, 0xc0fd, 0x683a, 0x1078, 0x8c4d, 0x0040, 0x2b56, 0x7007,
1252 0x0003, 0x701b, 0x3654, 0x007c, 0x6830, 0xa086, 0x0100, 0x0040,
1253 0x2b56, 0x0078, 0x2b2c, 0x2001, 0xa300, 0x2004, 0xa086, 0x0003,
1254 0x00c0, 0x2b56, 0x7f24, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x1078,
1255 0x3518, 0x0040, 0x2b56, 0x2009, 0x0000, 0x2031, 0x0000, 0x7023,
1256 0x0000, 0x702f, 0x0000, 0xad80, 0x0005, 0x7026, 0x20a0, 0x1078,
1257 0x4501, 0x00c0, 0x36d8, 0x6004, 0xa0c4, 0x00ff, 0xa8c6, 0x0006,
1258 0x0040, 0x3688, 0xa0c4, 0xff00, 0xa8c6, 0x0600, 0x00c0, 0x36d8,
1259 0x2001, 0xa352, 0x2004, 0xd0ac, 0x00c0, 0x3695, 0x1078, 0x47cb,
1260 0x00c0, 0x3695, 0xd79c, 0x0040, 0x36d8, 0xd794, 0x00c0, 0x369b,
1261 0xd784, 0x0040, 0x36a7, 0xac80, 0x0006, 0x2098, 0x3400, 0x20a9,
1262 0x0004, 0x53a3, 0x1078, 0x338c, 0xd794, 0x0040, 0x36b0, 0xac80,
1263 0x000a, 0x2098, 0x3400, 0x20a9, 0x0004, 0x53a3, 0x1078, 0x338c,
1264 0x21a2, 0xd794, 0x0040, 0x36d0, 0xac80, 0x0000, 0x2098, 0x94a0,
1265 0x20a9, 0x0002, 0x53a3, 0xac80, 0x0003, 0x20a6, 0x94a0, 0xac80,
1266 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002, 0x53a3, 0x1078, 0x337e,
1267 0xac80, 0x0026, 0x2098, 0x20a9, 0x0002, 0x53a3, 0x0078, 0x36d1,
1268 0x94a0, 0xd794, 0x0040, 0x36d6, 0xa6b0, 0x000b, 0xa6b0, 0x0005,
1269 0x8108, 0xd78c, 0x0040, 0x36e2, 0xa186, 0x0100, 0x0040, 0x36f3,
1270 0x0078, 0x36e6, 0xa186, 0x007e, 0x0040, 0x36f3, 0xd794, 0x0040,
1271 0x36ed, 0xa686, 0x0020, 0x0078, 0x36ef, 0xa686, 0x0028, 0x0040,
1272 0x36fc, 0x0078, 0x3677, 0x86ff, 0x00c0, 0x36fa, 0x7120, 0x810b,
1273 0x0078, 0x2b2c, 0x702f, 0x0001, 0x711e, 0x7020, 0xa600, 0x7022,
1274 0x772a, 0x2061, 0xa3d1, 0x6007, 0x0000, 0x6612, 0x7024, 0x600e,
1275 0x6226, 0x632a, 0x642e, 0x6532, 0x2c10, 0x1078, 0x13d1, 0x7007,
1276 0x0002, 0x701b, 0x3714, 0x007c, 0x702c, 0xa005, 0x00c0, 0x3726,
1277 0x711c, 0x7024, 0x20a0, 0x7728, 0x2031, 0x0000, 0x2061, 0xa3d1,
1278 0x6224, 0x6328, 0x642c, 0x6530, 0x0078, 0x3677, 0x7120, 0x810b,
1279 0x0078, 0x2b2c, 0x2029, 0x007e, 0x7924, 0x7a28, 0x7b2c, 0x7c38,
1280 0xa184, 0xff00, 0x8007, 0xa0e2, 0x0020, 0x0048, 0x2b5a, 0xa502,
1281 0x0048, 0x2b5a, 0xa184, 0x00ff, 0xa0e2, 0x0020, 0x0048, 0x2b5a,
1282 0xa502, 0x0048, 0x2b5a, 0xa284, 0xff00, 0x8007, 0xa0e2, 0x0020,
1283 0x0048, 0x2b5a, 0xa502, 0x0048, 0x2b5a, 0xa284, 0x00ff, 0xa0e2,
1284 0x0020, 0x0048, 0x2b5a, 0xa502, 0x0048, 0x2b5a, 0xa384, 0xff00,
1285 0x8007, 0xa0e2, 0x0020, 0x0048, 0x2b5a, 0xa502, 0x0048, 0x2b5a,
1286 0xa384, 0x00ff, 0xa0e2, 0x0020, 0x0048, 0x2b5a, 0xa502, 0x0048,
1287 0x2b5a, 0xa484, 0xff00, 0x8007, 0xa0e2, 0x0020, 0x0048, 0x2b5a,
1288 0xa502, 0x0048, 0x2b5a, 0xa484, 0x00ff, 0xa0e2, 0x0020, 0x0048,
1289 0x2b5a, 0xa502, 0x0048, 0x2b5a, 0x2061, 0xa5a3, 0x6102, 0x6206,
1290 0x630a, 0x640e, 0x0078, 0x2b2c, 0x007e, 0x2001, 0xa352, 0x2004,
1291 0xd0cc, 0x007f, 0x007c, 0x007e, 0x2001, 0xa371, 0x2004, 0xd0bc,
1292 0x007f, 0x007c, 0x6160, 0x7a24, 0x6300, 0x82ff, 0x00c0, 0x379b,
1293 0x7926, 0x0078, 0x2b2c, 0x83ff, 0x00c0, 0x2b5a, 0x2001, 0xfff0,
1294 0xa200, 0x00c8, 0x2b5a, 0x2019, 0xffff, 0x6064, 0xa302, 0xa200,
1295 0x0048, 0x2b5a, 0x7926, 0x6262, 0x0078, 0x2b2c, 0x2001, 0xa300,
1296 0x2004, 0xa086, 0x0003, 0x00c0, 0x2b56, 0x7c28, 0x7d24, 0x7e38,
1297 0x7f2c, 0x1078, 0x3518, 0x0040, 0x2b56, 0x2009, 0x0000, 0x2019,
1298 0x0000, 0x7023, 0x0000, 0x702f, 0x0000, 0xad80, 0x0003, 0x7026,
1299 0x20a0, 0xa1e0, 0xa434, 0x2c64, 0x8cff, 0x0040, 0x37e8, 0x6004,
1300 0xa084, 0x00ff, 0xa086, 0x0006, 0x0040, 0x37dd, 0x6004, 0xa084,
1301 0xff00, 0xa086, 0x0600, 0x00c0, 0x37e8, 0x6014, 0x20a2, 0x94a0,
1302 0x6010, 0x8007, 0xa105, 0x8007, 0x20a2, 0x94a0, 0xa398, 0x0002,
1303 0x8108, 0xa182, 0x00ff, 0x0040, 0x37f3, 0xa386, 0x002a, 0x0040,
1304 0x37fc, 0x0078, 0x37c9, 0x83ff, 0x00c0, 0x37fa, 0x7120, 0x810c,
1305 0x0078, 0x2b2c, 0x702f, 0x0001, 0x711e, 0x7020, 0xa300, 0x7022,
1306 0x2061, 0xa3d1, 0x6007, 0x0000, 0x6312, 0x7024, 0x600e, 0x6426,
1307 0x652a, 0x662e, 0x6732, 0x2c10, 0x1078, 0x13d1, 0x7007, 0x0002,
1308 0x701b, 0x3813, 0x007c, 0x702c, 0xa005, 0x00c0, 0x3824, 0x711c,
1309 0x7024, 0x20a0, 0x2019, 0x0000, 0x2061, 0xa3d1, 0x6424, 0x6528,
1310 0x662c, 0x6730, 0x0078, 0x37c9, 0x7120, 0x810c, 0x0078, 0x2b2c,
1311 0x81ff, 0x00c0, 0x2b56, 0x60c8, 0xd09c, 0x0040, 0x2b56, 0x1078,
1312 0x3518, 0x0040, 0x2b56, 0x7924, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38,
1313 0x1078, 0x3562, 0x701b, 0x383d, 0x007c, 0x0d7e, 0xade8, 0x000d,
1314 0x6828, 0xa0be, 0x7000, 0x0040, 0x3850, 0xa0be, 0x7100, 0x0040,
1315 0x3850, 0xa0be, 0x7200, 0x0040, 0x3850, 0x0d7f, 0x0078, 0x2b5a,
1316 0x6820, 0x6924, 0x1078, 0x24e3, 0x00c0, 0x387b, 0x1078, 0x4499,
1317 0x00c0, 0x387b, 0x7122, 0x6612, 0x6516, 0x6e18, 0x0c7e, 0x1078,
1318 0x3518, 0x0040, 0x387b, 0x1078, 0x3518, 0x0040, 0x387b, 0x0c7f,
1319 0x0d7f, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x6823, 0x0000,
1320 0x6804, 0x2068, 0x1078, 0x8bbd, 0x0040, 0x2b56, 0x7007, 0x0003,
1321 0x701b, 0x387e, 0x007c, 0x0d7f, 0x0078, 0x2b56, 0x7120, 0x1078,
1322 0x2921, 0x6820, 0xa086, 0x8001, 0x0040, 0x2b56, 0x2d00, 0x701e,
1323 0x6804, 0xa080, 0x0002, 0x007e, 0x20a9, 0x002a, 0x2098, 0x20a0,
1324 0x1078, 0x41be, 0x007f, 0xade8, 0x000d, 0x6a08, 0x6b0c, 0x6c10,
1325 0x6d14, 0x2061, 0xa3d1, 0x6007, 0x0000, 0x6e00, 0x6f28, 0xa7c6,
1326 0x7000, 0x00c0, 0x38a5, 0x0078, 0x38a9, 0xa7c6, 0x7100, 0x00c0,
1327 0x38b1, 0xa6c2, 0x0004, 0x0048, 0x2b5a, 0x2009, 0x0004, 0x0078,
1328 0x3566, 0xa7c6, 0x7200, 0x00c0, 0x2b5a, 0xa6c2, 0x0054, 0x0048,
1329 0x2b5a, 0x600e, 0x6013, 0x002a, 0x6226, 0x632a, 0x642e, 0x6532,
1330 0x2c10, 0x1078, 0x13d1, 0x7007, 0x0002, 0x701b, 0x38c8, 0x007c,
1331 0x701c, 0x2068, 0x6804, 0xa080, 0x0001, 0x2004, 0xa080, 0x0002,
1332 0x007e, 0x20a9, 0x002a, 0x2098, 0x20a0, 0x1078, 0x41be, 0x007f,
1333 0x2009, 0x002a, 0x2061, 0xa3d1, 0x6224, 0x6328, 0x642c, 0x6530,
1334 0x0078, 0x3566, 0x81ff, 0x00c0, 0x2b56, 0x1078, 0x3530, 0x0040,
1335 0x2b5a, 0x1078, 0x45a7, 0x0040, 0x2b56, 0x1078, 0x4710, 0x0078,
1336 0x2b2c, 0x7824, 0xd084, 0x0040, 0x3150, 0x1078, 0x3542, 0x0040,
1337 0x2b5a, 0x0c7e, 0x1078, 0x3518, 0x0c7f, 0x00c0, 0x3903, 0x2009,
1338 0x0002, 0x0078, 0x2b56, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006,
1339 0x0040, 0x3910, 0xa08e, 0x0004, 0x0040, 0x3910, 0xa08e, 0x0005,
1340 0x00c0, 0x3934, 0x2001, 0xa352, 0x2004, 0xd0b4, 0x0040, 0x3185,
1341 0x6000, 0xd08c, 0x00c0, 0x3185, 0x6837, 0x0000, 0x6838, 0xc0fd,
1342 0x683a, 0x1078, 0x8bd9, 0x00c0, 0x3929, 0x2009, 0x0003, 0x0078,
1343 0x2b56, 0x7007, 0x0003, 0x701b, 0x392e, 0x007c, 0x1078, 0x3542,
1344 0x0040, 0x2b5a, 0x0078, 0x3185, 0x2009, 0xa32e, 0x210c, 0x81ff,
1345 0x0040, 0x393e, 0x2009, 0x0001, 0x0078, 0x2b56, 0x2001, 0xa300,
1346 0x2004, 0xa086, 0x0003, 0x0040, 0x3949, 0x2009, 0x0007, 0x0078,
1347 0x2b56, 0x2001, 0xa352, 0x2004, 0xd0ac, 0x0040, 0x3953, 0x2009,
1348 0x0008, 0x0078, 0x2b56, 0x609c, 0xd0a4, 0x00c0, 0x395a, 0xd0ac,
1349 0x00c0, 0x3185, 0x6837, 0x0000, 0x6833, 0x0000, 0x6838, 0xc0fd,
1350 0x683a, 0x1078, 0x8c4d, 0x00c0, 0x3969, 0x2009, 0x0003, 0x0078,
1351 0x2b56, 0x7007, 0x0003, 0x701b, 0x396e, 0x007c, 0x6830, 0xa086,
1352 0x0100, 0x00c0, 0x3977, 0x2009, 0x0004, 0x0078, 0x2b56, 0x1078,
1353 0x3542, 0x0040, 0x2b5a, 0x0078, 0x3912, 0x81ff, 0x2009, 0x0001,
1354 0x00c0, 0x2b56, 0x6000, 0xa086, 0x0003, 0x2009, 0x0007, 0x00c0,
1355 0x2b56, 0x2001, 0xa352, 0x2004, 0xd0ac, 0x2009, 0x0008, 0x00c0,
1356 0x2b56, 0x1078, 0x3542, 0x0040, 0x2b5a, 0x6004, 0xa084, 0x00ff,
1357 0xa086, 0x0006, 0x2009, 0x0009, 0x00c0, 0x2b56, 0x0c7e, 0x1078,
1358 0x3518, 0x0c7f, 0x2009, 0x0002, 0x0040, 0x2b56, 0x6837, 0x0000,
1359 0x6833, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x7928, 0xa194, 0xff00,
1360 0xa18c, 0x00ff, 0xa006, 0x82ff, 0x00c0, 0x39bc, 0xc0ed, 0x6952,
1361 0x792c, 0x6956, 0x0078, 0x39c5, 0xa28e, 0x0100, 0x00c0, 0x2b5a,
1362 0xc0e5, 0x6853, 0x0000, 0x6857, 0x0000, 0x683e, 0x1078, 0x8df6,
1363 0x2009, 0x0003, 0x0040, 0x2b56, 0x7007, 0x0003, 0x701b, 0x39d1,
1364 0x007c, 0x6830, 0xa086, 0x0100, 0x2009, 0x0004, 0x0040, 0x2b56,
1365 0x0078, 0x2b2c, 0x81ff, 0x2009, 0x0001, 0x00c0, 0x2b56, 0x6000,
1366 0xa086, 0x0003, 0x2009, 0x0007, 0x00c0, 0x2b56, 0x1078, 0x3542,
1367 0x0040, 0x2b5a, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x2009,
1368 0x0009, 0x00c0, 0x2b56, 0x0c7e, 0x1078, 0x3518, 0x0c7f, 0x2009,
1369 0x0002, 0x0040, 0x2b56, 0xad80, 0x000f, 0x2009, 0x0008, 0x7a2c,
1370 0x7b28, 0x7c3c, 0x7d38, 0x1078, 0x3562, 0x701b, 0x3a08, 0x007c,
1371 0x0d7e, 0xade8, 0x000f, 0x6800, 0xa086, 0x0500, 0x00c0, 0x3a1b,
1372 0x6804, 0xa005, 0x00c0, 0x3a1b, 0x6808, 0xa084, 0xff00, 0x00c0,
1373 0x3a1b, 0x0078, 0x3a1e, 0x0d7f, 0x00c0, 0x2b5a, 0x0d7f, 0x6837,
1374 0x0000, 0x6833, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x0c7e, 0x1078,
1375 0x3542, 0x00c0, 0x3a2e, 0x0c7f, 0x0078, 0x2b5a, 0x1078, 0x8e52,
1376 0x2009, 0x0003, 0x0c7f, 0x0040, 0x2b56, 0x7007, 0x0003, 0x701b,
1377 0x3a3a, 0x007c, 0x6830, 0xa086, 0x0100, 0x2009, 0x0004, 0x0040,
1378 0x2b56, 0x0078, 0x2b2c, 0x127e, 0x0c7e, 0x0e7e, 0x2061, 0x0100,
1379 0x2071, 0xa300, 0x6044, 0xd0a4, 0x00c0, 0x3a6c, 0xd084, 0x0040,
1380 0x3a55, 0x1078, 0x3bcc, 0x0078, 0x3a68, 0xd08c, 0x0040, 0x3a5c,
1381 0x1078, 0x3ae3, 0x0078, 0x3a68, 0xd094, 0x0040, 0x3a63, 0x1078,
1382 0x3ab7, 0x0078, 0x3a68, 0xd09c, 0x0040, 0x3a68, 0x1078, 0x3a76,
1383 0x0e7f, 0x0c7f, 0x127f, 0x007c, 0x017e, 0x6128, 0xd19c, 0x00c0,
1384 0x3a73, 0xc19d, 0x612a, 0x017f, 0x0078, 0x3a68, 0x624c, 0xa286,
1385 0xf0f0, 0x00c0, 0x3a87, 0x6048, 0xa086, 0xf0f0, 0x0040, 0x3a87,
1386 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0078, 0x3ab6, 0xa294,
1387 0xff00, 0xa296, 0xf700, 0x0040, 0x3a9c, 0x7134, 0xd1a4, 0x00c0,
1388 0x3a9c, 0x6240, 0xa294, 0x0010, 0x0040, 0x3a9c, 0x2009, 0x00f7,
1389 0x1078, 0x41de, 0x0078, 0x3ab6, 0x6043, 0x0040, 0x6043, 0x0000,
1390 0x7073, 0x0000, 0x708b, 0x0001, 0x70af, 0x0000, 0x70cb, 0x0000,
1391 0x2009, 0xa9c0, 0x200b, 0x0000, 0x7083, 0x0000, 0x7077, 0x000f,
1392 0x2009, 0x000f, 0x2011, 0x4122, 0x1078, 0x596c, 0x007c, 0x157e,
1393 0x7074, 0xa005, 0x00c0, 0x3ae1, 0x2011, 0x4122, 0x1078, 0x58d4,
1394 0x6040, 0xa094, 0x0010, 0xa285, 0x0020, 0x6042, 0x20a9, 0x00c8,
1395 0x6044, 0xd08c, 0x00c0, 0x3ada, 0x00f0, 0x3ac8, 0x6242, 0x7087,
1396 0x0000, 0x6040, 0xa094, 0x0010, 0xa285, 0x0080, 0x6042, 0x6242,
1397 0x0078, 0x3ae1, 0x6242, 0x7087, 0x0000, 0x707b, 0x0000, 0x0078,
1398 0x3ae1, 0x157f, 0x007c, 0x7078, 0xa08a, 0x0003, 0x00c8, 0x3aec,
1399 0x1079, 0x3aef, 0x0078, 0x3aee, 0x1078, 0x1328, 0x007c, 0x3af2,
1400 0x3b41, 0x3bcb, 0x0f7e, 0x707b, 0x0001, 0x20e1, 0xa000, 0x20e1,
1401 0x8700, 0x1078, 0x218b, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2079,
1402 0xa800, 0x207b, 0x2200, 0x7807, 0x00ef, 0x780b, 0x0000, 0x780f,
1403 0x00ef, 0x7813, 0x0138, 0x7817, 0x0000, 0x781b, 0x0000, 0x781f,
1404 0x0000, 0x7823, 0xffff, 0x7827, 0xffff, 0x782b, 0x0000, 0x782f,
1405 0x0000, 0x2079, 0xa80c, 0x207b, 0x1101, 0x7807, 0x0000, 0x2099,
1406 0xa305, 0x20a1, 0xa80e, 0x20a9, 0x0004, 0x53a3, 0x2079, 0xa812,
1407 0x207b, 0x0000, 0x7807, 0x0000, 0x2099, 0xa800, 0x20a1, 0x020b,
1408 0x20a9, 0x0014, 0x53a6, 0x60c3, 0x000c, 0x600f, 0x0000, 0x1078,
1409 0x4158, 0x0f7f, 0x707f, 0x0000, 0x6043, 0x0008, 0x6043, 0x0000,
1410 0x007c, 0x0d7e, 0x707c, 0x707f, 0x0000, 0xa025, 0x0040, 0x3bb5,
1411 0x6020, 0xd0b4, 0x00c0, 0x3bb3, 0x7188, 0x81ff, 0x0040, 0x3ba2,
1412 0xa486, 0x000c, 0x00c0, 0x3bad, 0xa480, 0x0018, 0x8004, 0x20a8,
1413 0x2011, 0xa880, 0x2019, 0xa800, 0x220c, 0x2304, 0xa106, 0x00c0,
1414 0x3b79, 0x8210, 0x8318, 0x00f0, 0x3b5c, 0x6043, 0x0004, 0x608b,
1415 0xbc94, 0x608f, 0xf0f0, 0x6043, 0x0006, 0x707b, 0x0002, 0x7087,
1416 0x0002, 0x2009, 0x07d0, 0x2011, 0x4129, 0x1078, 0x596c, 0x0078,
1417 0x3bb3, 0x2069, 0xa880, 0x6930, 0xa18e, 0x1101, 0x00c0, 0x3bad,
1418 0x6834, 0xa005, 0x00c0, 0x3bad, 0x6900, 0xa18c, 0x00ff, 0x00c0,
1419 0x3b8d, 0x6804, 0xa005, 0x0040, 0x3ba2, 0x2011, 0xa88e, 0x2019,
1420 0xa305, 0x20a9, 0x0004, 0x220c, 0x2304, 0xa102, 0x0048, 0x3ba0,
1421 0x00c0, 0x3bad, 0x8210, 0x8318, 0x00f0, 0x3b93, 0x0078, 0x3bad,
1422 0x708b, 0x0000, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099, 0xa880,
1423 0x20a1, 0x020b, 0x20a9, 0x0014, 0x53a6, 0x6043, 0x0008, 0x6043,
1424 0x0000, 0x0078, 0x3bb5, 0x0d7f, 0x007c, 0x6020, 0xd0b4, 0x00c0,
1425 0x3bb3, 0x60c3, 0x000c, 0x2011, 0xa5b5, 0x2013, 0x0000, 0x707f,
1426 0x0000, 0x20e1, 0x9080, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x1078,
1427 0x6c38, 0x0078, 0x3bb3, 0x007c, 0x7084, 0xa08a, 0x001d, 0x00c8,
1428 0x3bd5, 0x1079, 0x3bd8, 0x0078, 0x3bd7, 0x1078, 0x1328, 0x007c,
1429 0x3c02, 0x3c11, 0x3c40, 0x3c59, 0x3c85, 0x3cb1, 0x3cdd, 0x3d13,
1430 0x3d3f, 0x3d67, 0x3daa, 0x3dd4, 0x3df6, 0x3e0c, 0x3e32, 0x3e45,
1431 0x3e4e, 0x3e7e, 0x3eaa, 0x3ed6, 0x3f02, 0x3f38, 0x3f7d, 0x3fac,
1432 0x3fce, 0x4010, 0x4036, 0x404f, 0x4050, 0x0c7e, 0x2061, 0xa300,
1433 0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0xa084, 0xfff9, 0x6006,
1434 0x0c7f, 0x007c, 0x608b, 0xbc94, 0x608f, 0xf0f0, 0x6043, 0x0002,
1435 0x7087, 0x0001, 0x2009, 0x07d0, 0x2011, 0x4129, 0x1078, 0x596c,
1436 0x007c, 0x0f7e, 0x707c, 0xa086, 0x0014, 0x00c0, 0x3c3e, 0x6043,
1437 0x0000, 0x6020, 0xd0b4, 0x00c0, 0x3c3e, 0x2079, 0xa880, 0x7a30,
1438 0xa296, 0x1102, 0x00c0, 0x3c3c, 0x7834, 0xa005, 0x00c0, 0x3c3c,
1439 0x7a38, 0xd2fc, 0x0040, 0x3c32, 0x70ac, 0xa005, 0x00c0, 0x3c32,
1440 0x70af, 0x0001, 0x2011, 0x4129, 0x1078, 0x58d4, 0x7087, 0x0010,
1441 0x1078, 0x3e4e, 0x0078, 0x3c3e, 0x1078, 0x4171, 0x0f7f, 0x007c,
1442 0x7087, 0x0003, 0x6043, 0x0004, 0x2011, 0x4129, 0x1078, 0x58d4,
1443 0x1078, 0x41c6, 0x20a3, 0x1102, 0x20a3, 0x0000, 0x20a9, 0x000a,
1444 0x20a3, 0x0000, 0x00f0, 0x3c50, 0x60c3, 0x0014, 0x1078, 0x4158,
1445 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040, 0x3c83, 0x2011, 0x4129,
1446 0x1078, 0x58d4, 0xa086, 0x0014, 0x00c0, 0x3c81, 0x2079, 0xa880,
1447 0x7a30, 0xa296, 0x1102, 0x00c0, 0x3c81, 0x7834, 0xa005, 0x00c0,
1448 0x3c81, 0x7a38, 0xd2fc, 0x0040, 0x3c7b, 0x70ac, 0xa005, 0x00c0,
1449 0x3c7b, 0x70af, 0x0001, 0x7087, 0x0004, 0x1078, 0x3c85, 0x0078,
1450 0x3c83, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087, 0x0005, 0x1078,
1451 0x41c6, 0x20a3, 0x1103, 0x20a3, 0x0000, 0x3430, 0x2011, 0xa88e,
1452 0x1078, 0x4211, 0x00c0, 0x3ca3, 0x7070, 0xa005, 0x00c0, 0x3ca3,
1453 0x714c, 0xa186, 0xffff, 0x0040, 0x3ca3, 0x1078, 0x40ea, 0x0040,
1454 0x3ca3, 0x1078, 0x41f5, 0x20a9, 0x0008, 0x2298, 0x26a0, 0x53a6,
1455 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x1078, 0x4158,
1456 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040, 0x3cdb, 0x2011, 0x4129,
1457 0x1078, 0x58d4, 0xa086, 0x0014, 0x00c0, 0x3cd9, 0x2079, 0xa880,
1458 0x7a30, 0xa296, 0x1103, 0x00c0, 0x3cd9, 0x7834, 0xa005, 0x00c0,
1459 0x3cd9, 0x7a38, 0xd2fc, 0x0040, 0x3cd3, 0x70ac, 0xa005, 0x00c0,
1460 0x3cd3, 0x70af, 0x0001, 0x7087, 0x0006, 0x1078, 0x3cdd, 0x0078,
1461 0x3cdb, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087, 0x0007, 0x1078,
1462 0x41c6, 0x20a3, 0x1104, 0x20a3, 0x0000, 0x3430, 0x2011, 0xa88e,
1463 0x1078, 0x4211, 0x00c0, 0x3d05, 0x7070, 0xa005, 0x00c0, 0x3d05,
1464 0x7150, 0xa186, 0xffff, 0x0040, 0x3d05, 0xa180, 0x293f, 0x200c,
1465 0xa18c, 0xff00, 0x810f, 0x1078, 0x40ea, 0x0040, 0x3d05, 0x1078,
1466 0x378b, 0x0040, 0x3d05, 0x1078, 0x2500, 0x20a9, 0x0008, 0x2298,
1467 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014,
1468 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040, 0x3d3d,
1469 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086, 0x0014, 0x00c0, 0x3d3b,
1470 0x2079, 0xa880, 0x7a30, 0xa296, 0x1104, 0x00c0, 0x3d3b, 0x7834,
1471 0xa005, 0x00c0, 0x3d3b, 0x7a38, 0xd2fc, 0x0040, 0x3d35, 0x70ac,
1472 0xa005, 0x00c0, 0x3d35, 0x70af, 0x0001, 0x7087, 0x0008, 0x1078,
1473 0x3d3f, 0x0078, 0x3d3d, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087,
1474 0x0009, 0x1078, 0x41c6, 0x20a3, 0x1105, 0x20a3, 0x0100, 0x3430,
1475 0x1078, 0x4211, 0x00c0, 0x3d58, 0x7070, 0xa005, 0x00c0, 0x3d58,
1476 0x1078, 0x4051, 0x00c0, 0x3d62, 0xa085, 0x0001, 0x1078, 0x2500,
1477 0x20a9, 0x0008, 0x2099, 0xa88e, 0x26a0, 0x53a6, 0x20a3, 0x0000,
1478 0x20a3, 0x0000, 0x60c3, 0x0014, 0x1078, 0x4158, 0x007c, 0x0f7e,
1479 0x707c, 0xa005, 0x0040, 0x3da8, 0x2011, 0x4129, 0x1078, 0x58d4,
1480 0xa086, 0x0014, 0x00c0, 0x3da6, 0x2079, 0xa880, 0x7a30, 0xa296,
1481 0x1105, 0x00c0, 0x3da6, 0x7834, 0x2011, 0x0100, 0xa21e, 0x00c0,
1482 0x3d91, 0x7a38, 0xd2fc, 0x0040, 0x3d8b, 0x70ac, 0xa005, 0x00c0,
1483 0x3d8b, 0x70af, 0x0001, 0x7087, 0x000a, 0x1078, 0x3daa, 0x0078,
1484 0x3da8, 0xa005, 0x00c0, 0x3da6, 0x7a38, 0xd2fc, 0x0040, 0x3d9e,
1485 0x70ac, 0xa005, 0x00c0, 0x3d9e, 0x70af, 0x0001, 0x7083, 0x0000,
1486 0x7087, 0x000e, 0x1078, 0x3e32, 0x0078, 0x3da8, 0x1078, 0x4171,
1487 0x0f7f, 0x007c, 0x7087, 0x000b, 0x2011, 0xa80e, 0x22a0, 0x20a9,
1488 0x0040, 0x2019, 0xffff, 0x43a4, 0x20a9, 0x0002, 0x2009, 0x0000,
1489 0x41a4, 0x1078, 0x41c6, 0x20a3, 0x1106, 0x20a3, 0x0000, 0x1078,
1490 0x4211, 0x0040, 0x3dc7, 0x2013, 0x0000, 0x0078, 0x3dcb, 0x6030,
1491 0xa085, 0x0100, 0x2012, 0x2298, 0x20a9, 0x0042, 0x53a6, 0x60c3,
1492 0x0084, 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040,
1493 0x3df4, 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086, 0x0084, 0x00c0,
1494 0x3df2, 0x2079, 0xa880, 0x7a30, 0xa296, 0x1106, 0x00c0, 0x3df2,
1495 0x7834, 0xa005, 0x00c0, 0x3df2, 0x7087, 0x000c, 0x1078, 0x3df6,
1496 0x0078, 0x3df4, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087, 0x000d,
1497 0x1078, 0x41c6, 0x20a3, 0x1107, 0x20a3, 0x0000, 0x2099, 0xa88e,
1498 0x20a9, 0x0040, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3,
1499 0x0084, 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040,
1500 0x3e30, 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086, 0x0084, 0x00c0,
1501 0x3e2e, 0x2079, 0xa880, 0x7a30, 0xa296, 0x1107, 0x00c0, 0x3e2e,
1502 0x7834, 0xa005, 0x00c0, 0x3e2e, 0x7083, 0x0001, 0x1078, 0x41b8,
1503 0x7087, 0x000e, 0x1078, 0x3e32, 0x0078, 0x3e30, 0x1078, 0x4171,
1504 0x0f7f, 0x007c, 0x7087, 0x000f, 0x707f, 0x0000, 0x608b, 0xbc85,
1505 0x608f, 0xb5b5, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0,
1506 0x2011, 0x4129, 0x1078, 0x58c7, 0x007c, 0x707c, 0xa005, 0x0040,
1507 0x3e4d, 0x2011, 0x4129, 0x1078, 0x58d4, 0x007c, 0x7087, 0x0011,
1508 0x1078, 0x4211, 0x00c0, 0x3e67, 0x7168, 0x81ff, 0x0040, 0x3e67,
1509 0x2009, 0x0000, 0x706c, 0xa084, 0x00ff, 0x1078, 0x24e3, 0xa186,
1510 0x0080, 0x0040, 0x3e67, 0x2011, 0xa88e, 0x1078, 0x40ea, 0x20e1,
1511 0x9080, 0x20e1, 0x4000, 0x2099, 0xa880, 0x20a1, 0x020b, 0x747c,
1512 0xa480, 0x0018, 0xa080, 0x0007, 0xa084, 0x03f8, 0x8004, 0x20a8,
1513 0x53a6, 0x60c3, 0x0014, 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c,
1514 0xa005, 0x0040, 0x3ea8, 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086,
1515 0x0014, 0x00c0, 0x3ea6, 0x2079, 0xa880, 0x7a30, 0xa296, 0x1103,
1516 0x00c0, 0x3ea6, 0x7834, 0xa005, 0x00c0, 0x3ea6, 0x7a38, 0xd2fc,
1517 0x0040, 0x3ea0, 0x70ac, 0xa005, 0x00c0, 0x3ea0, 0x70af, 0x0001,
1518 0x7087, 0x0012, 0x1078, 0x3eaa, 0x0078, 0x3ea8, 0x1078, 0x4171,
1519 0x0f7f, 0x007c, 0x7087, 0x0013, 0x1078, 0x41d2, 0x20a3, 0x1103,
1520 0x20a3, 0x0000, 0x3430, 0x2011, 0xa88e, 0x1078, 0x4211, 0x00c0,
1521 0x3ec8, 0x7070, 0xa005, 0x00c0, 0x3ec8, 0x714c, 0xa186, 0xffff,
1522 0x0040, 0x3ec8, 0x1078, 0x40ea, 0x0040, 0x3ec8, 0x1078, 0x41f5,
1523 0x20a9, 0x0008, 0x2298, 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3,
1524 0x0000, 0x60c3, 0x0014, 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c,
1525 0xa005, 0x0040, 0x3f00, 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086,
1526 0x0014, 0x00c0, 0x3efe, 0x2079, 0xa880, 0x7a30, 0xa296, 0x1104,
1527 0x00c0, 0x3efe, 0x7834, 0xa005, 0x00c0, 0x3efe, 0x7a38, 0xd2fc,
1528 0x0040, 0x3ef8, 0x70ac, 0xa005, 0x00c0, 0x3ef8, 0x70af, 0x0001,
1529 0x7087, 0x0014, 0x1078, 0x3f02, 0x0078, 0x3f00, 0x1078, 0x4171,
1530 0x0f7f, 0x007c, 0x7087, 0x0015, 0x1078, 0x41d2, 0x20a3, 0x1104,
1531 0x20a3, 0x0000, 0x3430, 0x2011, 0xa88e, 0x1078, 0x4211, 0x00c0,
1532 0x3f2a, 0x7070, 0xa005, 0x00c0, 0x3f2a, 0x7150, 0xa186, 0xffff,
1533 0x0040, 0x3f2a, 0xa180, 0x293f, 0x200c, 0xa18c, 0xff00, 0x810f,
1534 0x1078, 0x40ea, 0x0040, 0x3f2a, 0x1078, 0x378b, 0x0040, 0x3f2a,
1535 0x1078, 0x2500, 0x20a9, 0x0008, 0x2298, 0x26a0, 0x53a6, 0x20a3,
1536 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x1078, 0x4158, 0x007c,
1537 0x0f7e, 0x707c, 0xa005, 0x0040, 0x3f7b, 0x2011, 0x4129, 0x1078,
1538 0x58d4, 0xa086, 0x0014, 0x00c0, 0x3f79, 0x2079, 0xa880, 0x7a30,
1539 0xa296, 0x1105, 0x00c0, 0x3f79, 0x7834, 0x2011, 0x0100, 0xa21e,
1540 0x00c0, 0x3f5e, 0x7a38, 0xd2fc, 0x0040, 0x3f5c, 0x70ac, 0xa005,
1541 0x00c0, 0x3f5c, 0x70af, 0x0001, 0x0078, 0x3f6d, 0xa005, 0x00c0,
1542 0x3f79, 0x7a38, 0xd2fc, 0x0040, 0x3f6b, 0x70ac, 0xa005, 0x00c0,
1543 0x3f6b, 0x70af, 0x0001, 0x7083, 0x0000, 0x7a38, 0xd2f4, 0x0040,
1544 0x3f73, 0x70cb, 0x0008, 0x7087, 0x0016, 0x1078, 0x3f7d, 0x0078,
1545 0x3f7b, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x20e1, 0x9080, 0x20e1,
1546 0x4000, 0x2099, 0xa880, 0x20a1, 0x020b, 0x20a9, 0x000e, 0x53a6,
1547 0x3430, 0x2011, 0xa88e, 0x7087, 0x0017, 0x1078, 0x4211, 0x00c0,
1548 0x3f9d, 0x7070, 0xa005, 0x00c0, 0x3f9d, 0x1078, 0x4051, 0x00c0,
1549 0x3fa7, 0xa085, 0x0001, 0x1078, 0x2500, 0x20a9, 0x0008, 0x2099,
1550 0xa88e, 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3,
1551 0x0014, 0x1078, 0x4158, 0x007c, 0x0f7e, 0x707c, 0xa005, 0x0040,
1552 0x3fcc, 0x2011, 0x4129, 0x1078, 0x58d4, 0xa086, 0x0084, 0x00c0,
1553 0x3fca, 0x2079, 0xa880, 0x7a30, 0xa296, 0x1106, 0x00c0, 0x3fca,
1554 0x7834, 0xa005, 0x00c0, 0x3fca, 0x7087, 0x0018, 0x1078, 0x3fce,
1555 0x0078, 0x3fcc, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087, 0x0019,
1556 0x1078, 0x41d2, 0x20a3, 0x1106, 0x20a3, 0x0000, 0x3430, 0x2099,
1557 0xa88e, 0x2039, 0xa80e, 0x27a0, 0x20a9, 0x0040, 0x53a3, 0x1078,
1558 0x4211, 0x00c0, 0x4002, 0x2728, 0x2514, 0x8207, 0xa084, 0x00ff,
1559 0x8000, 0x2018, 0xa294, 0x00ff, 0x8007, 0xa205, 0x202a, 0x6030,
1560 0x2310, 0x8214, 0xa2a0, 0xa80e, 0x2414, 0xa38c, 0x0001, 0x0040,
1561 0x3ffd, 0xa294, 0xff00, 0x0078, 0x4000, 0xa294, 0x00ff, 0x8007,
1562 0xa215, 0x2222, 0x2798, 0x26a0, 0x20a9, 0x0040, 0x53a6, 0x20a3,
1563 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0084, 0x1078, 0x4158, 0x007c,
1564 0x0f7e, 0x707c, 0xa005, 0x0040, 0x4034, 0x2011, 0x4129, 0x1078,
1565 0x58d4, 0xa086, 0x0084, 0x00c0, 0x4032, 0x2079, 0xa880, 0x7a30,
1566 0xa296, 0x1107, 0x00c0, 0x4032, 0x7834, 0xa005, 0x00c0, 0x4032,
1567 0x7083, 0x0001, 0x1078, 0x41b8, 0x7087, 0x001a, 0x1078, 0x4036,
1568 0x0078, 0x4034, 0x1078, 0x4171, 0x0f7f, 0x007c, 0x7087, 0x001b,
1569 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099, 0xa880, 0x20a1, 0x020b,
1570 0x747c, 0xa480, 0x0018, 0xa080, 0x0007, 0xa084, 0x03f8, 0x8004,
1571 0x20a8, 0x53a6, 0x60c3, 0x0084, 0x1078, 0x4158, 0x007c, 0x007c,
1572 0x007c, 0x087e, 0x097e, 0x2029, 0xa352, 0x252c, 0x20a9, 0x0008,
1573 0x2041, 0xa80e, 0x28a0, 0x2099, 0xa88e, 0x53a3, 0x20a9, 0x0008,
1574 0x2011, 0x0007, 0xd5d4, 0x0040, 0x4067, 0x2011, 0x0000, 0x2800,
1575 0xa200, 0x200c, 0xa1a6, 0xffff, 0x00c0, 0x4079, 0xd5d4, 0x0040,
1576 0x4074, 0x8210, 0x0078, 0x4075, 0x8211, 0x00f0, 0x4067, 0x0078,
1577 0x40e1, 0x82ff, 0x00c0, 0x408b, 0xd5d4, 0x0040, 0x4085, 0xa1a6,
1578 0x3fff, 0x0040, 0x4071, 0x0078, 0x4089, 0xa1a6, 0x3fff, 0x0040,
1579 0x40e1, 0xa18d, 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4,
1580 0x0040, 0x4094, 0x2019, 0x0010, 0x2120, 0xd5d4, 0x0040, 0x409b,
1581 0x8423, 0x0078, 0x409c, 0x8424, 0x00c8, 0x40a9, 0xd5d4, 0x0040,
1582 0x40a4, 0x8319, 0x0078, 0x40a5, 0x8318, 0x00f0, 0x4095, 0x0078,
1583 0x40e1, 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x00f0, 0x40ad,
1584 0x2328, 0x8529, 0xa2be, 0x0007, 0x0040, 0x40c1, 0x007e, 0x2039,
1585 0x0007, 0x2200, 0xa73a, 0x007f, 0x27a8, 0xa5a8, 0x0010, 0x00f0,
1586 0x40bd, 0x754e, 0xa5c8, 0x293f, 0x292c, 0xa5ac, 0x00ff, 0x6532,
1587 0x60e7, 0x0000, 0x65ea, 0x706b, 0x0000, 0x756e, 0x2018, 0x2304,
1588 0xa405, 0x201a, 0x7073, 0x0001, 0x26a0, 0x2898, 0x20a9, 0x0008,
1589 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0xa085, 0x0001, 0x0078,
1590 0x40e7, 0xa006, 0x0078, 0x40e7, 0xa006, 0x1078, 0x1328, 0x097f,
1591 0x087f, 0x007c, 0x2118, 0x2021, 0x0000, 0x2001, 0x0007, 0xa39a,
1592 0x0010, 0x0048, 0x40f7, 0x8420, 0x8001, 0x0078, 0x40ef, 0x2118,
1593 0x84ff, 0x0040, 0x4100, 0xa39a, 0x0010, 0x8421, 0x00c0, 0x40fb,
1594 0x2021, 0x0001, 0x83ff, 0x0040, 0x4109, 0x8423, 0x8319, 0x00c0,
1595 0x4105, 0xa238, 0x2704, 0xa42c, 0x00c0, 0x4121, 0xa405, 0x203a,
1596 0x714e, 0xa1a0, 0x293f, 0x242c, 0xa5ac, 0x00ff, 0x6532, 0x60e7,
1597 0x0000, 0x65ea, 0x706b, 0x0000, 0x756e, 0x7073, 0x0001, 0xa084,
1598 0x0000, 0x007c, 0x0e7e, 0x2071, 0xa300, 0x7077, 0x0000, 0x0e7f,
1599 0x007c, 0x0e7e, 0x0f7e, 0x2001, 0x0002, 0x1078, 0x5975, 0x2079,
1600 0x0100, 0x2071, 0x0140, 0x1078, 0x6c41, 0x7004, 0xa084, 0x4000,
1601 0x0040, 0x413e, 0x7003, 0x1000, 0x7003, 0x0000, 0x127e, 0x2091,
1602 0x8000, 0x2071, 0xa321, 0x2073, 0x0000, 0x7840, 0x027e, 0x017e,
1603 0x2009, 0x00f7, 0x1078, 0x41de, 0x017f, 0xa094, 0x0010, 0xa285,
1604 0x0080, 0x7842, 0x7a42, 0x027f, 0x127f, 0x0f7f, 0x0e7f, 0x007c,
1605 0x127e, 0x2091, 0x8000, 0x2011, 0xa5b5, 0x2013, 0x0000, 0x707f,
1606 0x0000, 0x127f, 0x20e1, 0x9080, 0x60a3, 0x0056, 0x60a7, 0x9575,
1607 0x1078, 0x6c38, 0x2009, 0x07d0, 0x2011, 0x4129, 0x1078, 0x596c,
1608 0x007c, 0x017e, 0x027e, 0x0c7e, 0x127e, 0x2091, 0x8000, 0x2009,
1609 0x00f7, 0x1078, 0x41de, 0x2061, 0xa5be, 0x601b, 0x0000, 0x601f,
1610 0x0000, 0x2061, 0xa300, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043,
1611 0x0090, 0x6043, 0x0010, 0x2009, 0x002d, 0x2011, 0x4196, 0x1078,
1612 0x58c7, 0x127f, 0x0c7f, 0x027f, 0x017f, 0x007c, 0x0e7e, 0x007e,
1613 0x127e, 0x2091, 0x8000, 0x2001, 0x0001, 0x1078, 0x5975, 0x2071,
1614 0x0100, 0x1078, 0x6c41, 0x2071, 0x0140, 0x7004, 0xa084, 0x4000,
1615 0x0040, 0x41ae, 0x7003, 0x1000, 0x7003, 0x0000, 0x2001, 0x0001,
1616 0x1078, 0x2480, 0x1078, 0x4171, 0x127f, 0x007f, 0x0e7f, 0x007c,
1617 0x20a9, 0x0040, 0x20a1, 0xa9c0, 0x2099, 0xa88e, 0x3304, 0x8007,
1618 0x20a2, 0x9398, 0x94a0, 0x00f0, 0x41be, 0x007c, 0x20e1, 0x9080,
1619 0x20e1, 0x4000, 0x2099, 0xa800, 0x20a1, 0x020b, 0x20a9, 0x000c,
1620 0x53a6, 0x007c, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099, 0xa880,
1621 0x20a1, 0x020b, 0x20a9, 0x000c, 0x53a6, 0x007c, 0x0c7e, 0x007e,
1622 0x2061, 0x0100, 0x810f, 0x2001, 0xa32e, 0x2004, 0xa005, 0x00c0,
1623 0x41ef, 0x6030, 0xa084, 0x00ff, 0xa105, 0x0078, 0x41f1, 0xa185,
1624 0x00f7, 0x604a, 0x007f, 0x0c7f, 0x007c, 0x017e, 0x047e, 0x2001,
1625 0xa352, 0x2004, 0xd0a4, 0x0040, 0x4208, 0xa006, 0x2020, 0x2009,
1626 0x002a, 0x1078, 0x9ec0, 0x2001, 0xa30c, 0x200c, 0xc195, 0x2102,
1627 0x2019, 0x002a, 0x2009, 0x0000, 0x1078, 0x27e2, 0x047f, 0x017f,
1628 0x007c, 0x007e, 0x2001, 0xa30c, 0x2004, 0xd09c, 0x0040, 0x4218,
1629 0x007f, 0x007c, 0x007e, 0x017e, 0x127e, 0x2091, 0x8000, 0x2001,
1630 0x0101, 0x200c, 0xa18d, 0x0006, 0x2102, 0x127f, 0x017f, 0x007f,
1631 0x007c, 0x157e, 0x20a9, 0x00ff, 0x2009, 0xa434, 0xa006, 0x200a,
1632 0x8108, 0x00f0, 0x422f, 0x157f, 0x007c, 0x0d7e, 0x037e, 0x157e,
1633 0x137e, 0x147e, 0x2069, 0xa351, 0xa006, 0x6002, 0x6007, 0x0707,
1634 0x600a, 0x600e, 0x6012, 0xa198, 0x293f, 0x231c, 0xa39c, 0x00ff,
1635 0x6316, 0x20a9, 0x0004, 0xac98, 0x0006, 0x23a0, 0x40a4, 0x20a9,
1636 0x0004, 0xac98, 0x000a, 0x23a0, 0x40a4, 0x603e, 0x6042, 0x604e,
1637 0x6052, 0x6056, 0x605a, 0x605e, 0x6062, 0x6066, 0x606a, 0x606e,
1638 0x6072, 0x6076, 0x607a, 0x607e, 0x6082, 0x6086, 0x608a, 0x608e,
1639 0x6092, 0x6096, 0x609a, 0x609e, 0x60ae, 0x61a2, 0x0d7e, 0x60a4,
1640 0xa06d, 0x0040, 0x4275, 0x1078, 0x139a, 0x60a7, 0x0000, 0x60a8,
1641 0xa06d, 0x0040, 0x427d, 0x1078, 0x139a, 0x60ab, 0x0000, 0x0d7f,
1642 0xa006, 0x604a, 0x6810, 0x603a, 0x680c, 0x6046, 0x6814, 0xa084,
1643 0x00ff, 0x6042, 0x147f, 0x137f, 0x157f, 0x037f, 0x0d7f, 0x007c,
1644 0x127e, 0x2091, 0x8000, 0x6944, 0x6e48, 0xa684, 0x3fff, 0xa082,
1645 0x4000, 0x00c8, 0x4361, 0xa18c, 0xff00, 0x810f, 0xa182, 0x00ff,
1646 0x00c8, 0x4367, 0x2001, 0xa30c, 0x2004, 0xa084, 0x0003, 0x0040,
1647 0x42c2, 0x2001, 0xa30c, 0x2004, 0xd084, 0x00c0, 0x4342, 0xa188,
1648 0xa434, 0x2104, 0xa065, 0x0040, 0x4342, 0x6004, 0xa084, 0x00ff,
1649 0xa08e, 0x0006, 0x00c0, 0x4342, 0x6000, 0xd0c4, 0x0040, 0x4342,
1650 0x0078, 0x42cf, 0xa188, 0xa434, 0x2104, 0xa065, 0x0040, 0x4326,
1651 0x6004, 0xa084, 0x00ff, 0xa08e, 0x0006, 0x00c0, 0x432c, 0x60a4,
1652 0xa00d, 0x0040, 0x42d7, 0x1078, 0x4749, 0x0040, 0x4320, 0x60a8,
1653 0xa00d, 0x0040, 0x42f1, 0x1078, 0x479a, 0x00c0, 0x42f1, 0x694c,
1654 0xd1fc, 0x00c0, 0x42e7, 0x1078, 0x441c, 0x0078, 0x431b, 0x1078,
1655 0x43d6, 0x694c, 0xd1ec, 0x00c0, 0x431b, 0x1078, 0x460a, 0x0078,
1656 0x431b, 0x694c, 0xa184, 0xa000, 0x0040, 0x430b, 0xd1ec, 0x0040,
1657 0x4304, 0xd1fc, 0x0040, 0x4300, 0x1078, 0x461b, 0x0078, 0x4307,
1658 0x1078, 0x461b, 0x0078, 0x430b, 0xd1fc, 0x0040, 0x430b, 0x1078,
1659 0x43d6, 0x0078, 0x431b, 0x6050, 0xa00d, 0x0040, 0x4316, 0x2d00,
1660 0x200a, 0x6803, 0x0000, 0x6052, 0x0078, 0x431b, 0x2d00, 0x6052,
1661 0x604e, 0x6803, 0x0000, 0x1078, 0x5c17, 0xa006, 0x127f, 0x007c,
1662 0x2001, 0x0005, 0x2009, 0x0000, 0x0078, 0x436b, 0x2001, 0x0028,
1663 0x2009, 0x0000, 0x0078, 0x436b, 0xa082, 0x0006, 0x00c8, 0x4342,
1664 0x60a0, 0xd0bc, 0x00c0, 0x433e, 0x6100, 0xd1fc, 0x0040, 0x42cf,
1665 0x2001, 0x0029, 0x2009, 0x1000, 0x0078, 0x436b, 0x2001, 0x0028,
1666 0x0078, 0x435d, 0x2009, 0xa30c, 0x210c, 0xd18c, 0x0040, 0x434c,
1667 0x2001, 0x0004, 0x0078, 0x435d, 0xd184, 0x0040, 0x4353, 0x2001,
1668 0x0004, 0x0078, 0x435d, 0x2001, 0x0029, 0x6100, 0xd1fc, 0x0040,
1669 0x435d, 0x2009, 0x1000, 0x0078, 0x436b, 0x2009, 0x0000, 0x0078,
1670 0x436b, 0x2001, 0x0029, 0x2009, 0x0000, 0x0078, 0x436b, 0x2001,
1671 0x0029, 0x2009, 0x0000, 0xa005, 0x127f, 0x007c, 0x6944, 0x6e48,
1672 0xa684, 0x3fff, 0xa082, 0x4000, 0x00c8, 0x43bb, 0xa18c, 0xff00,
1673 0x810f, 0xa182, 0x00ff, 0x00c8, 0x43a1, 0xa188, 0xa434, 0x2104,
1674 0xa065, 0x0040, 0x43a1, 0x6004, 0xa084, 0x00ff, 0xa08e, 0x0006,
1675 0x00c0, 0x43a7, 0x684c, 0xd0ec, 0x0040, 0x4394, 0x1078, 0x461b,
1676 0x1078, 0x43d6, 0x0078, 0x439c, 0x1078, 0x43d6, 0x684c, 0xd0fc,
1677 0x0040, 0x439c, 0x1078, 0x460a, 0x1078, 0x4663, 0xa006, 0x0078,
1678 0x43bf, 0x2001, 0x0028, 0x2009, 0x0000, 0x0078, 0x43bf, 0xa082,
1679 0x0006, 0x00c8, 0x43b5, 0x6100, 0xd1fc, 0x0040, 0x438a, 0x2001,
1680 0x0029, 0x2009, 0x1000, 0x0078, 0x43bf, 0x2001, 0x0029, 0x2009,
1681 0x0000, 0x0078, 0x43bf, 0x2001, 0x0029, 0x2009, 0x0000, 0xa005,
1682 0x007c, 0x127e, 0x2091, 0x8000, 0x6050, 0xa00d, 0x0040, 0x43cf,
1683 0x2d00, 0x200a, 0x6803, 0x0000, 0x6052, 0x127f, 0x007c, 0x2d00,
1684 0x6052, 0x604e, 0x6803, 0x0000, 0x0078, 0x43cd, 0x127e, 0x2091,
1685 0x8000, 0x604c, 0xa005, 0x0040, 0x43ec, 0x0e7e, 0x2071, 0xa5ab,
1686 0x7004, 0xa086, 0x0002, 0x0040, 0x43f3, 0x0e7f, 0x604c, 0x6802,
1687 0x2d00, 0x604e, 0x127f, 0x007c, 0x2d00, 0x6052, 0x604e, 0x6803,
1688 0x0000, 0x0078, 0x43ea, 0x701c, 0xac06, 0x00c0, 0x43e5, 0x604c,
1689 0x2070, 0x7000, 0x6802, 0x2d00, 0x7002, 0x0e7f, 0x127f, 0x007c,
1690 0x127e, 0x2091, 0x8000, 0x604c, 0xa06d, 0x0040, 0x440e, 0x6800,
1691 0xa005, 0x00c0, 0x440c, 0x6052, 0x604e, 0xad05, 0x127f, 0x007c,
1692 0x604c, 0xa06d, 0x0040, 0x441b, 0x6800, 0xa005, 0x00c0, 0x4419,
1693 0x6052, 0x604e, 0xad05, 0x007c, 0x6803, 0x0000, 0x6084, 0xa00d,
1694 0x0040, 0x4426, 0x2d00, 0x200a, 0x6086, 0x007c, 0x2d00, 0x6086,
1695 0x6082, 0x0078, 0x4425, 0x127e, 0x0c7e, 0x027e, 0x2091, 0x8000,
1696 0x6218, 0x2260, 0x6200, 0xa005, 0x0040, 0x4439, 0xc285, 0x0078,
1697 0x443a, 0xc284, 0x6202, 0x027f, 0x0c7f, 0x127f, 0x007c, 0x127e,
1698 0x0c7e, 0x2091, 0x8000, 0x6218, 0x2260, 0x6204, 0x007e, 0xa086,
1699 0x0006, 0x00c0, 0x445e, 0x609c, 0xd0ac, 0x0040, 0x445e, 0x2001,
1700 0xa352, 0x2004, 0xd0a4, 0x0040, 0x445e, 0xa284, 0xff00, 0x8007,
1701 0xa086, 0x0007, 0x00c0, 0x445e, 0x2011, 0x0600, 0x007f, 0xa294,
1702 0xff00, 0xa215, 0x6206, 0x007e, 0xa086, 0x0006, 0x00c0, 0x446e,
1703 0x6290, 0x82ff, 0x00c0, 0x446e, 0x1078, 0x1328, 0x007f, 0x0c7f,
1704 0x127f, 0x007c, 0x127e, 0x0c7e, 0x2091, 0x8000, 0x6218, 0x2260,
1705 0x6204, 0x007e, 0xa086, 0x0006, 0x00c0, 0x4490, 0x609c, 0xd0a4,
1706 0x0040, 0x4490, 0x2001, 0xa352, 0x2004, 0xd0ac, 0x00c0, 0x4490,
1707 0xa284, 0x00ff, 0xa086, 0x0007, 0x00c0, 0x4490, 0x2011, 0x0006,
1708 0x007f, 0xa294, 0x00ff, 0x8007, 0xa215, 0x6206, 0x0c7f, 0x127f,
1709 0x007c, 0x027e, 0xa182, 0x00ff, 0x0048, 0x44a2, 0xa085, 0x0001,
1710 0x0078, 0x44ba, 0xa190, 0xa434, 0x2204, 0xa065, 0x00c0, 0x44b9,
1711 0x017e, 0x0d7e, 0x1078, 0x1366, 0x2d60, 0x0d7f, 0x017f, 0x0040,
1712 0x449e, 0x2c00, 0x2012, 0x60a7, 0x0000, 0x60ab, 0x0000, 0x1078,
1713 0x4235, 0xa006, 0x027f, 0x007c, 0x127e, 0x2091, 0x8000, 0x027e,
1714 0xa182, 0x00ff, 0x0048, 0x44c8, 0xa085, 0x0001, 0x0078, 0x44fe,
1715 0x0d7e, 0xa190, 0xa434, 0x2204, 0xa06d, 0x0040, 0x44fc, 0x2013,
1716 0x0000, 0x0d7e, 0x0c7e, 0x2d60, 0x60a4, 0xa06d, 0x0040, 0x44da,
1717 0x1078, 0x139a, 0x60a8, 0xa06d, 0x0040, 0x44e0, 0x1078, 0x139a,
1718 0x0c7f, 0x0d7f, 0x0d7e, 0x0c7e, 0x68ac, 0x2060, 0x8cff, 0x0040,
1719 0x44f8, 0x600c, 0x007e, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040,
1720 0x44f3, 0x1078, 0x13aa, 0x1078, 0x753d, 0x0c7f, 0x0078, 0x44e6,
1721 0x0c7f, 0x0d7f, 0x1078, 0x139a, 0x0d7f, 0xa006, 0x027f, 0x127f,
1722 0x007c, 0x017e, 0xa182, 0x00ff, 0x0048, 0x450a, 0xa085, 0x0001,
1723 0x0078, 0x4511, 0xa188, 0xa434, 0x2104, 0xa065, 0x0040, 0x4506,
1724 0xa006, 0x017f, 0x007c, 0x0d7e, 0x157e, 0x137e, 0x147e, 0x600b,
1725 0x0000, 0x600f, 0x0000, 0x6000, 0xc08c, 0x6002, 0x2069, 0xa88e,
1726 0x6808, 0x605e, 0x6810, 0x6062, 0x6138, 0xa10a, 0x0048, 0x4529,
1727 0x603a, 0x6814, 0x6066, 0x2099, 0xa896, 0xac88, 0x000a, 0x21a0,
1728 0x20a9, 0x0004, 0x53a3, 0x2099, 0xa89a, 0xac88, 0x0006, 0x21a0,
1729 0x20a9, 0x0004, 0x53a3, 0x2069, 0xa8ae, 0x6808, 0x606a, 0x690c,
1730 0x616e, 0x6810, 0x6072, 0x6818, 0x6076, 0xa182, 0x0211, 0x00c8,
1731 0x454d, 0x2009, 0x0008, 0x0078, 0x4577, 0xa182, 0x0259, 0x00c8,
1732 0x4555, 0x2009, 0x0007, 0x0078, 0x4577, 0xa182, 0x02c1, 0x00c8,
1733 0x455d, 0x2009, 0x0006, 0x0078, 0x4577, 0xa182, 0x0349, 0x00c8,
1734 0x4565, 0x2009, 0x0005, 0x0078, 0x4577, 0xa182, 0x0421, 0x00c8,
1735 0x456d, 0x2009, 0x0004, 0x0078, 0x4577, 0xa182, 0x0581, 0x00c8,
1736 0x4575, 0x2009, 0x0003, 0x0078, 0x4577, 0x2009, 0x0002, 0x6192,
1737 0x147f, 0x137f, 0x157f, 0x0d7f, 0x007c, 0x017e, 0x027e, 0x0e7e,
1738 0x2071, 0xa88d, 0x2e04, 0x6896, 0x2071, 0xa88e, 0x7004, 0x689a,
1739 0x701c, 0x689e, 0x6a00, 0x2009, 0xa371, 0x210c, 0xd0bc, 0x0040,
1740 0x4597, 0xd1ec, 0x0040, 0x4597, 0xc2ad, 0x0078, 0x4598, 0xc2ac,
1741 0xd0c4, 0x0040, 0x45a1, 0xd1e4, 0x0040, 0x45a1, 0xc2bd, 0x0078,
1742 0x45a2, 0xc2bc, 0x6a02, 0x0e7f, 0x027f, 0x017f, 0x007c, 0x0d7e,
1743 0x127e, 0x2091, 0x8000, 0x60a4, 0xa06d, 0x0040, 0x45cb, 0x6900,
1744 0x81ff, 0x00c0, 0x45df, 0x6a04, 0xa282, 0x0010, 0x00c8, 0x45e4,
1745 0xad88, 0x0004, 0x20a9, 0x0010, 0x2104, 0xa086, 0xffff, 0x0040,
1746 0x45c6, 0x8108, 0x00f0, 0x45bc, 0x1078, 0x1328, 0x260a, 0x8210,
1747 0x6a06, 0x0078, 0x45df, 0x1078, 0x1381, 0x0040, 0x45e4, 0x2d00,
1748 0x60a6, 0x6803, 0x0000, 0xad88, 0x0004, 0x20a9, 0x0010, 0x200b,
1749 0xffff, 0x8108, 0x00f0, 0x45d7, 0x6807, 0x0001, 0x6e12, 0xa085,
1750 0x0001, 0x127f, 0x0d7f, 0x007c, 0xa006, 0x0078, 0x45e1, 0x127e,
1751 0x2091, 0x8000, 0x0d7e, 0x60a4, 0xa00d, 0x0040, 0x4607, 0x2168,
1752 0x6800, 0xa005, 0x00c0, 0x4603, 0x1078, 0x4749, 0x00c0, 0x4607,
1753 0x200b, 0xffff, 0x6804, 0xa08a, 0x0002, 0x0048, 0x4603, 0x8001,
1754 0x6806, 0x0078, 0x4607, 0x1078, 0x139a, 0x60a7, 0x0000, 0x0d7f,
1755 0x127f, 0x007c, 0x127e, 0x2091, 0x8000, 0x1078, 0x47af, 0x0078,
1756 0x4613, 0x1078, 0x43c1, 0x1078, 0x46a7, 0x00c0, 0x4611, 0x1078,
1757 0x4663, 0x127f, 0x007c, 0x0d7e, 0x127e, 0x2091, 0x8000, 0x60a8,
1758 0xa06d, 0x0040, 0x463f, 0x6950, 0x81ff, 0x00c0, 0x4653, 0x6a54,
1759 0xa282, 0x0010, 0x00c8, 0x4660, 0xad88, 0x0018, 0x20a9, 0x0010,
1760 0x2104, 0xa086, 0xffff, 0x0040, 0x463a, 0x8108, 0x00f0, 0x4630,
1761 0x1078, 0x1328, 0x260a, 0x8210, 0x6a56, 0x0078, 0x4653, 0x1078,
1762 0x1381, 0x0040, 0x4660, 0x2d00, 0x60aa, 0x6853, 0x0000, 0xad88,
1763 0x0018, 0x20a9, 0x0010, 0x200b, 0xffff, 0x8108, 0x00f0, 0x464b,
1764 0x6857, 0x0001, 0x6e62, 0x0078, 0x4657, 0x1078, 0x441c, 0x1078,
1765 0x466d, 0x00c0, 0x4655, 0xa085, 0x0001, 0x127f, 0x0d7f, 0x007c,
1766 0xa006, 0x0078, 0x465d, 0x127e, 0x2091, 0x8000, 0x1078, 0x5c17,
1767 0x127f, 0x007c, 0xa01e, 0x0078, 0x466f, 0x2019, 0x0001, 0xa00e,
1768 0x127e, 0x2091, 0x8000, 0x604c, 0x2068, 0x6000, 0xd0dc, 0x00c0,
1769 0x468d, 0x8dff, 0x0040, 0x46a2, 0x83ff, 0x0040, 0x4685, 0x6848,
1770 0xa606, 0x0040, 0x4692, 0x0078, 0x468d, 0x683c, 0xa406, 0x00c0,
1771 0x468d, 0x6840, 0xa506, 0x0040, 0x4692, 0x2d08, 0x6800, 0x2068,
1772 0x0078, 0x4679, 0x6a00, 0x604c, 0xad06, 0x00c0, 0x469a, 0x624e,
1773 0x0078, 0x469d, 0xa180, 0x0000, 0x2202, 0x82ff, 0x00c0, 0x46a2,
1774 0x6152, 0x8dff, 0x127f, 0x007c, 0xa01e, 0x0078, 0x46a9, 0x2019,
1775 0x0001, 0xa00e, 0x6080, 0x2068, 0x8dff, 0x0040, 0x46d5, 0x83ff,
1776 0x0040, 0x46b8, 0x6848, 0xa606, 0x0040, 0x46c5, 0x0078, 0x46c0,
1777 0x683c, 0xa406, 0x00c0, 0x46c0, 0x6840, 0xa506, 0x0040, 0x46c5,
1778 0x2d08, 0x6800, 0x2068, 0x0078, 0x46ac, 0x6a00, 0x6080, 0xad06,
1779 0x00c0, 0x46cd, 0x6282, 0x0078, 0x46d0, 0xa180, 0x0000, 0x2202,
1780 0x82ff, 0x00c0, 0x46d5, 0x6186, 0x8dff, 0x007c, 0xa016, 0x1078,
1781 0x4742, 0x00c0, 0x46dd, 0x2011, 0x0001, 0x1078, 0x4793, 0x00c0,
1782 0x46e3, 0xa295, 0x0002, 0x007c, 0x1078, 0x47cb, 0x0040, 0x46ec,
1783 0x1078, 0x8b12, 0x0078, 0x46ee, 0xa085, 0x0001, 0x007c, 0x1078,
1784 0x47cb, 0x0040, 0x46f7, 0x1078, 0x8aaa, 0x0078, 0x46f9, 0xa085,
1785 0x0001, 0x007c, 0x1078, 0x47cb, 0x0040, 0x4702, 0x1078, 0x8af4,
1786 0x0078, 0x4704, 0xa085, 0x0001, 0x007c, 0x1078, 0x47cb, 0x0040,
1787 0x470d, 0x1078, 0x8ac6, 0x0078, 0x470f, 0xa085, 0x0001, 0x007c,
1788 0x1078, 0x47cb, 0x0040, 0x4718, 0x1078, 0x8b30, 0x0078, 0x471a,
1789 0xa085, 0x0001, 0x007c, 0x127e, 0x007e, 0x0d7e, 0x2091, 0x8000,
1790 0x6080, 0xa06d, 0x0040, 0x473a, 0x6800, 0x007e, 0x6837, 0x0103,
1791 0x6b4a, 0x6847, 0x0000, 0x1078, 0x8cb8, 0x007e, 0x6000, 0xd0fc,
1792 0x0040, 0x4734, 0x1078, 0xa18c, 0x007f, 0x1078, 0x4982, 0x007f,
1793 0x0078, 0x4721, 0x6083, 0x0000, 0x6087, 0x0000, 0x0d7f, 0x007f,
1794 0x127f, 0x007c, 0x60a4, 0xa00d, 0x00c0, 0x4749, 0xa085, 0x0001,
1795 0x007c, 0x0e7e, 0x2170, 0x7000, 0xa005, 0x00c0, 0x475c, 0x20a9,
1796 0x0010, 0xae88, 0x0004, 0x2104, 0xa606, 0x0040, 0x475c, 0x8108,
1797 0x00f0, 0x4753, 0xa085, 0x0001, 0xa006, 0x0e7f, 0x007c, 0x0d7e,
1798 0x127e, 0x2091, 0x8000, 0x60a4, 0xa06d, 0x00c0, 0x476d, 0x1078,
1799 0x1381, 0x0040, 0x477f, 0x2d00, 0x60a6, 0x6803, 0x0001, 0x6807,
1800 0x0000, 0xad88, 0x0004, 0x20a9, 0x0010, 0x200b, 0xffff, 0x8108,
1801 0x00f0, 0x4775, 0xa085, 0x0001, 0x127f, 0x0d7f, 0x007c, 0xa006,
1802 0x0078, 0x477c, 0x0d7e, 0x127e, 0x2091, 0x8000, 0x60a4, 0xa06d,
1803 0x0040, 0x4790, 0x60a7, 0x0000, 0x1078, 0x139a, 0xa085, 0x0001,
1804 0x127f, 0x0d7f, 0x007c, 0x60a8, 0xa00d, 0x00c0, 0x479a, 0xa085,
1805 0x0001, 0x007c, 0x0e7e, 0x2170, 0x7050, 0xa005, 0x00c0, 0x47ad,
1806 0x20a9, 0x0010, 0xae88, 0x0018, 0x2104, 0xa606, 0x0040, 0x47ad,
1807 0x8108, 0x00f0, 0x47a4, 0xa085, 0x0001, 0x0e7f, 0x007c, 0x127e,
1808 0x2091, 0x8000, 0x1078, 0x4793, 0x00c0, 0x47c9, 0x200b, 0xffff,
1809 0x0d7e, 0x60a8, 0x2068, 0x6854, 0xa08a, 0x0002, 0x0048, 0x47c4,
1810 0x8001, 0x6856, 0x0078, 0x47c8, 0x1078, 0x139a, 0x60ab, 0x0000,
1811 0x0d7f, 0x127f, 0x007c, 0x609c, 0xd0a4, 0x007c, 0x0f7e, 0x71ac,
1812 0x81ff, 0x00c0, 0x47e9, 0x71c8, 0xd19c, 0x0040, 0x47e9, 0x2001,
1813 0x007e, 0xa080, 0xa434, 0x2004, 0xa07d, 0x0040, 0x47e9, 0x7804,
1814 0xa084, 0x00ff, 0xa086, 0x0006, 0x00c0, 0x47e9, 0x7800, 0xc0ed,
1815 0x7802, 0x2079, 0xa351, 0x7804, 0xd0a4, 0x0040, 0x480f, 0x157e,
1816 0x0c7e, 0x20a9, 0x007f, 0x2009, 0x0000, 0x017e, 0x1078, 0x4501,
1817 0x00c0, 0x4809, 0x6004, 0xa084, 0xff00, 0x8007, 0xa096, 0x0004,
1818 0x0040, 0x4806, 0xa086, 0x0006, 0x00c0, 0x4809, 0x6000, 0xc0ed,
1819 0x6002, 0x017f, 0x8108, 0x00f0, 0x47f5, 0x0c7f, 0x157f, 0x1078,
1820 0x4897, 0x0040, 0x4818, 0x2001, 0xa59f, 0x200c, 0x0078, 0x4820,
1821 0x2079, 0xa351, 0x7804, 0xd0a4, 0x0040, 0x4824, 0x2009, 0x07d0,
1822 0x2011, 0x4826, 0x1078, 0x596c, 0x0f7f, 0x007c, 0x2011, 0x4826,
1823 0x1078, 0x58d4, 0x1078, 0x4897, 0x0040, 0x484e, 0x2001, 0xa4b2,
1824 0x2004, 0xa080, 0x0000, 0x200c, 0xc1ec, 0x2102, 0x2001, 0xa352,
1825 0x2004, 0xd0a4, 0x0040, 0x4842, 0x2009, 0x07d0, 0x2011, 0x4826,
1826 0x1078, 0x596c, 0x0e7e, 0x2071, 0xa300, 0x706b, 0x0000, 0x706f,
1827 0x0000, 0x1078, 0x260d, 0x0e7f, 0x0078, 0x4886, 0x157e, 0x0c7e,
1828 0x20a9, 0x007f, 0x2009, 0x0000, 0x017e, 0x1078, 0x4501, 0x00c0,
1829 0x4880, 0x6000, 0xd0ec, 0x0040, 0x4880, 0x047e, 0x62a0, 0xa294,
1830 0x00ff, 0x8227, 0xa006, 0x2009, 0x0029, 0x1078, 0x9ec0, 0x6000,
1831 0xc0e5, 0xc0ec, 0x6002, 0x6004, 0xa084, 0x00ff, 0xa085, 0x0700,
1832 0x6006, 0x2019, 0x0029, 0x1078, 0x5d53, 0x077e, 0x2039, 0x0000,
1833 0x1078, 0x5c78, 0x2009, 0x0000, 0x1078, 0x9c38, 0x077f, 0x047f,
1834 0x017f, 0x8108, 0x00f0, 0x4854, 0x0c7f, 0x157f, 0x007c, 0x0c7e,
1835 0x6018, 0x2060, 0x6000, 0xc0ec, 0x6002, 0x0c7f, 0x007c, 0x7818,
1836 0x2004, 0xd0ac, 0x007c, 0x7818, 0x2004, 0xd0bc, 0x007c, 0x0f7e,
1837 0x2001, 0xa4b2, 0x2004, 0xa07d, 0x0040, 0x48a0, 0x7800, 0xd0ec,
1838 0x0f7f, 0x007c, 0x127e, 0x027e, 0x2091, 0x8000, 0x6200, 0xa005,
1839 0x0040, 0x48ad, 0xc2fd, 0x0078, 0x48ae, 0xc2fc, 0x6202, 0x027f,
1840 0x127f, 0x007c, 0x2071, 0xa413, 0x7003, 0x0001, 0x7007, 0x0000,
1841 0x7013, 0x0000, 0x7017, 0x0000, 0x701b, 0x0000, 0x701f, 0x0000,
1842 0x700b, 0x0000, 0x704b, 0x0001, 0x704f, 0x0000, 0x705b, 0x0020,
1843 0x705f, 0x0040, 0x707f, 0x0000, 0x2071, 0xa57c, 0x7003, 0xa413,
1844 0x7007, 0x0000, 0x700b, 0x0000, 0x700f, 0xa55c, 0x7013, 0x0020,
1845 0x7017, 0x0040, 0x7037, 0x0000, 0x007c, 0x017e, 0x0e7e, 0x2071,
1846 0xa534, 0xa00e, 0x7186, 0x718a, 0x7097, 0x0001, 0x2001, 0xa352,
1847 0x2004, 0xd0fc, 0x00c0, 0x48f7, 0x2001, 0xa352, 0x2004, 0xa00e,
1848 0xd09c, 0x0040, 0x48f4, 0x8108, 0x7102, 0x0078, 0x494a, 0x2001,
1849 0xa371, 0x200c, 0xa184, 0x000f, 0x2009, 0xa372, 0x210c, 0x0079,
1850 0x4901, 0x48ec, 0x4922, 0x492a, 0x4935, 0x493b, 0x48ec, 0x48ec,
1851 0x48ec, 0x4911, 0x48ec, 0x48ec, 0x48ec, 0x48ec, 0x48ec, 0x48ec,
1852 0x48ec, 0x7003, 0x0004, 0x137e, 0x147e, 0x157e, 0x2099, 0xa375,
1853 0x20a1, 0xa585, 0x20a9, 0x0004, 0x53a3, 0x157f, 0x147f, 0x137f,
1854 0x0078, 0x494a, 0x708f, 0x0005, 0x7007, 0x0122, 0x2001, 0x0002,
1855 0x0078, 0x4930, 0x708f, 0x0002, 0x7007, 0x0121, 0x2001, 0x0003,
1856 0x7002, 0x7097, 0x0001, 0x0078, 0x4947, 0x7007, 0x0122, 0x2001,
1857 0x0002, 0x0078, 0x493f, 0x7007, 0x0121, 0x2001, 0x0003, 0x7002,
1858 0xa006, 0x7096, 0x708e, 0xa184, 0xff00, 0x8007, 0x709a, 0xa184,
1859 0x00ff, 0x7092, 0x0e7f, 0x017f, 0x007c, 0x0e7e, 0x2071, 0xa413,
1860 0x684c, 0xa005, 0x00c0, 0x495b, 0x7028, 0xc085, 0x702a, 0xa085,
1861 0x0001, 0x0078, 0x4980, 0x6a60, 0x7236, 0x6b64, 0x733a, 0x6868,
1862 0x703e, 0x7076, 0x686c, 0x7042, 0x707a, 0x684c, 0x702e, 0x6844,
1863 0x7032, 0x2009, 0x000d, 0x200a, 0x700b, 0x0000, 0x8007, 0x8006,
1864 0x8006, 0xa08c, 0x003f, 0xa084, 0xffc0, 0xa210, 0x2100, 0xa319,
1865 0x726e, 0x7372, 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0xa006,
1866 0x0e7f, 0x007c, 0x0e7e, 0x027e, 0x6838, 0xd0fc, 0x00c0, 0x49d8,
1867 0x6804, 0xa00d, 0x0040, 0x499e, 0x0d7e, 0x2071, 0xa300, 0xa016,
1868 0x702c, 0x2168, 0x6904, 0x206a, 0x8210, 0x2d00, 0x81ff, 0x00c0,
1869 0x4991, 0x702e, 0x70a8, 0xa200, 0x70aa, 0x0d7f, 0x2071, 0xa413,
1870 0x701c, 0xa005, 0x00c0, 0x49ea, 0x0068, 0x49e8, 0x2071, 0xa534,
1871 0x7200, 0x82ff, 0x0040, 0x49e8, 0x6934, 0xa186, 0x0103, 0x00c0,
1872 0x49fb, 0x6948, 0x6844, 0xa105, 0x00c0, 0x49db, 0x2009, 0x8020,
1873 0x2200, 0x0079, 0x49bb, 0x49e8, 0x49c0, 0x4a18, 0x4a26, 0x49e8,
1874 0x2071, 0x0000, 0x7018, 0xd084, 0x00c0, 0x49e8, 0x7122, 0x683c,
1875 0x7026, 0x6840, 0x702a, 0x701b, 0x0001, 0x2091, 0x4080, 0x2071,
1876 0xa300, 0x702c, 0x206a, 0x2d00, 0x702e, 0x70a8, 0x8000, 0x70aa,
1877 0x027f, 0x0e7f, 0x007c, 0x6844, 0xa086, 0x0100, 0x00c0, 0x49e8,
1878 0x6868, 0xa005, 0x00c0, 0x49e8, 0x2009, 0x8020, 0x0078, 0x49b8,
1879 0x2071, 0xa413, 0x2d08, 0x206b, 0x0000, 0x7010, 0x8000, 0x7012,
1880 0x7018, 0xa06d, 0x711a, 0x0040, 0x49f8, 0x6902, 0x0078, 0x49f9,
1881 0x711e, 0x0078, 0x49d8, 0xa18c, 0x00ff, 0xa186, 0x0017, 0x0040,
1882 0x4a09, 0xa186, 0x001e, 0x0040, 0x4a09, 0xa18e, 0x001f, 0x00c0,
1883 0x49e8, 0x684c, 0xd0cc, 0x0040, 0x49e8, 0x6850, 0xa084, 0x00ff,
1884 0xa086, 0x0001, 0x00c0, 0x49e8, 0x2009, 0x8021, 0x0078, 0x49b8,
1885 0x7084, 0x8008, 0xa092, 0x001e, 0x00c8, 0x49e8, 0x7186, 0xae90,
1886 0x0003, 0xa210, 0x683c, 0x2012, 0x0078, 0x4a36, 0x7084, 0x8008,
1887 0xa092, 0x000f, 0x00c8, 0x49e8, 0x7186, 0xae90, 0x0003, 0x8003,
1888 0xa210, 0x683c, 0x2012, 0x8210, 0x6840, 0x2012, 0x7088, 0xa10a,
1889 0x0048, 0x49cf, 0x718c, 0x7084, 0xa10a, 0x0048, 0x49cf, 0x2071,
1890 0x0000, 0x7018, 0xd084, 0x00c0, 0x49cf, 0x2071, 0xa534, 0x7000,
1891 0xa086, 0x0002, 0x00c0, 0x4a56, 0x1078, 0x4cd2, 0x2071, 0x0000,
1892 0x701b, 0x0001, 0x2091, 0x4080, 0x0078, 0x49cf, 0x1078, 0x4cfd,
1893 0x2071, 0x0000, 0x701b, 0x0001, 0x2091, 0x4080, 0x0078, 0x49cf,
1894 0x007e, 0x684c, 0x007e, 0x6837, 0x0103, 0x20a9, 0x001c, 0xad80,
1895 0x0011, 0x20a0, 0x2001, 0x0000, 0x40a4, 0x007f, 0xa084, 0x00ff,
1896 0x684e, 0x007f, 0x684a, 0x6952, 0x007c, 0x2071, 0xa413, 0x7004,
1897 0x0079, 0x4a7a, 0x4a84, 0x4a95, 0x4ca3, 0x4ca4, 0x4ccb, 0x4cd1,
1898 0x4a85, 0x4c91, 0x4c32, 0x4cb4, 0x007c, 0x127e, 0x2091, 0x8000,
1899 0x0068, 0x4a94, 0x2009, 0x000d, 0x7030, 0x200a, 0x2091, 0x4080,
1900 0x7007, 0x0001, 0x700b, 0x0000, 0x127f, 0x2069, 0xa5be, 0x6844,
1901 0xa005, 0x0050, 0x4abd, 0x00c0, 0x4abd, 0x127e, 0x2091, 0x8000,
1902 0x2069, 0x0000, 0x6934, 0x2001, 0xa41f, 0x2004, 0xa10a, 0x0040,
1903 0x4ab8, 0x0068, 0x4abc, 0x2069, 0x0000, 0x6818, 0xd084, 0x00c0,
1904 0x4abc, 0x2009, 0x8040, 0x6922, 0x681b, 0x0001, 0x2091, 0x4080,
1905 0x2069, 0xa5be, 0x6847, 0xffff, 0x127f, 0x2069, 0xa300, 0x6844,
1906 0x6960, 0xa102, 0x2069, 0xa534, 0x688a, 0x6984, 0x701c, 0xa06d,
1907 0x0040, 0x4acf, 0x81ff, 0x0040, 0x4b17, 0x0078, 0x4ae5, 0x81ff,
1908 0x0040, 0x4be9, 0x2071, 0xa534, 0x7184, 0x7088, 0xa10a, 0x00c8,
1909 0x4ae5, 0x7190, 0x2071, 0xa5be, 0x7040, 0xa005, 0x0040, 0x4ae5,
1910 0x00d0, 0x4be9, 0x7142, 0x0078, 0x4be9, 0x2071, 0xa534, 0x718c,
1911 0x127e, 0x2091, 0x8000, 0x7084, 0xa10a, 0x0048, 0x4c06, 0x0068,
1912 0x4b9b, 0x2071, 0x0000, 0x7018, 0xd084, 0x00c0, 0x4b9b, 0x2001,
1913 0xffff, 0x2071, 0xa5be, 0x7042, 0x2071, 0xa534, 0x7000, 0xa086,
1914 0x0002, 0x00c0, 0x4b0d, 0x1078, 0x4cd2, 0x2071, 0x0000, 0x701b,
1915 0x0001, 0x2091, 0x4080, 0x0078, 0x4b9b, 0x1078, 0x4cfd, 0x2071,
1916 0x0000, 0x701b, 0x0001, 0x2091, 0x4080, 0x0078, 0x4b9b, 0x2071,
1917 0xa534, 0x7000, 0xa005, 0x0040, 0x4bc8, 0x6934, 0xa186, 0x0103,
1918 0x00c0, 0x4b9e, 0x684c, 0xd0bc, 0x00c0, 0x4bc8, 0x6948, 0x6844,
1919 0xa105, 0x00c0, 0x4bbb, 0x2009, 0x8020, 0x2071, 0xa534, 0x7000,
1920 0x0079, 0x4b32, 0x4bc8, 0x4b80, 0x4b58, 0x4b6a, 0x4b37, 0x137e,
1921 0x147e, 0x157e, 0x2099, 0xa375, 0x20a1, 0xa585, 0x20a9, 0x0004,
1922 0x53a3, 0x157f, 0x147f, 0x137f, 0x2071, 0xa57c, 0xad80, 0x000f,
1923 0x700e, 0x7013, 0x0002, 0x7007, 0x0002, 0x700b, 0x0000, 0x2e10,
1924 0x1078, 0x13d1, 0x2071, 0xa413, 0x7007, 0x0009, 0x0078, 0x4be9,
1925 0x7084, 0x8008, 0xa092, 0x001e, 0x00c8, 0x4be9, 0xae90, 0x0003,
1926 0xa210, 0x683c, 0x2012, 0x7186, 0x2071, 0xa413, 0x1078, 0x4d5b,
1927 0x0078, 0x4be9, 0x7084, 0x8008, 0xa092, 0x000f, 0x00c8, 0x4be9,
1928 0xae90, 0x0003, 0x8003, 0xa210, 0x683c, 0x2012, 0x8210, 0x6840,
1929 0x2012, 0x7186, 0x2071, 0xa413, 0x1078, 0x4d5b, 0x0078, 0x4be9,
1930 0x127e, 0x2091, 0x8000, 0x0068, 0x4b9b, 0x2071, 0x0000, 0x7018,
1931 0xd084, 0x00c0, 0x4b9b, 0x7122, 0x683c, 0x7026, 0x6840, 0x702a,
1932 0x701b, 0x0001, 0x2091, 0x4080, 0x127f, 0x2071, 0xa413, 0x1078,
1933 0x4d5b, 0x0078, 0x4be9, 0x127f, 0x0078, 0x4be9, 0xa18c, 0x00ff,
1934 0xa186, 0x0017, 0x0040, 0x4bac, 0xa186, 0x001e, 0x0040, 0x4bac,
1935 0xa18e, 0x001f, 0x00c0, 0x4bc8, 0x684c, 0xd0cc, 0x0040, 0x4bc8,
1936 0x6850, 0xa084, 0x00ff, 0xa086, 0x0001, 0x00c0, 0x4bc8, 0x2009,
1937 0x8021, 0x0078, 0x4b2d, 0x6844, 0xa086, 0x0100, 0x00c0, 0x4bc8,
1938 0x6868, 0xa005, 0x00c0, 0x4bc8, 0x2009, 0x8020, 0x0078, 0x4b2d,
1939 0x2071, 0xa413, 0x1078, 0x4d6f, 0x0040, 0x4be9, 0x2071, 0xa413,
1940 0x700f, 0x0001, 0x6934, 0xa184, 0x00ff, 0xa086, 0x0003, 0x00c0,
1941 0x4be0, 0x810f, 0xa18c, 0x00ff, 0x8101, 0x0040, 0x4be0, 0x710e,
1942 0x7007, 0x0003, 0x1078, 0x4d8f, 0x7050, 0xa086, 0x0100, 0x0040,
1943 0x4ca4, 0x127e, 0x2091, 0x8000, 0x2071, 0xa413, 0x7008, 0xa086,
1944 0x0001, 0x00c0, 0x4c04, 0x0068, 0x4c04, 0x2009, 0x000d, 0x7030,
1945 0x200a, 0x2091, 0x4080, 0x700b, 0x0000, 0x7004, 0xa086, 0x0006,
1946 0x00c0, 0x4c04, 0x7007, 0x0001, 0x127f, 0x007c, 0x2071, 0xa413,
1947 0x1078, 0x4d6f, 0x0040, 0x4c2f, 0x2071, 0xa534, 0x7084, 0x700a,
1948 0x20a9, 0x0020, 0x2099, 0xa535, 0x20a1, 0xa55c, 0x53a3, 0x7087,
1949 0x0000, 0x2071, 0xa413, 0x2069, 0xa57c, 0x706c, 0x6826, 0x7070,
1950 0x682a, 0x7074, 0x682e, 0x7078, 0x6832, 0x2d10, 0x1078, 0x13d1,
1951 0x7007, 0x0008, 0x2001, 0xffff, 0x2071, 0xa5be, 0x7042, 0x127f,
1952 0x0078, 0x4be9, 0x2069, 0xa57c, 0x6808, 0xa08e, 0x0000, 0x0040,
1953 0x4c90, 0xa08e, 0x0200, 0x0040, 0x4c8e, 0xa08e, 0x0100, 0x00c0,
1954 0x4c90, 0x127e, 0x2091, 0x8000, 0x0068, 0x4c8b, 0x2069, 0x0000,
1955 0x6818, 0xd084, 0x00c0, 0x4c8b, 0x702c, 0x7130, 0x8108, 0xa102,
1956 0x0048, 0x4c59, 0xa00e, 0x7034, 0x706e, 0x7038, 0x7072, 0x0078,
1957 0x4c63, 0x706c, 0xa080, 0x0040, 0x706e, 0x00c8, 0x4c63, 0x7070,
1958 0xa081, 0x0000, 0x7072, 0x7132, 0x6936, 0x700b, 0x0000, 0x2001,
1959 0xa559, 0x2004, 0xa005, 0x00c0, 0x4c82, 0x6934, 0x2069, 0xa534,
1960 0x689c, 0x699e, 0x2069, 0xa5be, 0xa102, 0x00c0, 0x4c7b, 0x6844,
1961 0xa005, 0x00d0, 0x4c89, 0x2001, 0xa55a, 0x200c, 0x810d, 0x6946,
1962 0x0078, 0x4c89, 0x2009, 0x8040, 0x6922, 0x681b, 0x0001, 0x2091,
1963 0x4080, 0x7007, 0x0001, 0x127f, 0x0078, 0x4c90, 0x7007, 0x0005,
1964 0x007c, 0x701c, 0xa06d, 0x0040, 0x4ca2, 0x1078, 0x4d6f, 0x0040,
1965 0x4ca2, 0x7007, 0x0003, 0x1078, 0x4d8f, 0x7050, 0xa086, 0x0100,
1966 0x0040, 0x4ca4, 0x007c, 0x007c, 0x7050, 0xa09e, 0x0100, 0x00c0,
1967 0x4cad, 0x7007, 0x0004, 0x0078, 0x4ccb, 0xa086, 0x0200, 0x00c0,
1968 0x4cb3, 0x7007, 0x0005, 0x007c, 0x2001, 0xa57e, 0x2004, 0xa08e,
1969 0x0100, 0x00c0, 0x4cc0, 0x7007, 0x0001, 0x1078, 0x4d5b, 0x007c,
1970 0xa08e, 0x0000, 0x0040, 0x4cbf, 0xa08e, 0x0200, 0x00c0, 0x4cbf,
1971 0x7007, 0x0005, 0x007c, 0x1078, 0x4d25, 0x7006, 0x1078, 0x4d5b,
1972 0x007c, 0x007c, 0x0e7e, 0x157e, 0x2071, 0xa534, 0x7184, 0x81ff,
1973 0x0040, 0x4cfa, 0xa006, 0x7086, 0xae80, 0x0003, 0x2071, 0x0000,
1974 0x21a8, 0x2014, 0x7226, 0x8000, 0x0070, 0x4cf7, 0x2014, 0x722a,
1975 0x8000, 0x0070, 0x4cf7, 0x2014, 0x722e, 0x8000, 0x0070, 0x4cf7,
1976 0x2014, 0x723a, 0x8000, 0x0070, 0x4cf7, 0x2014, 0x723e, 0xa180,
1977 0x8030, 0x7022, 0x157f, 0x0e7f, 0x007c, 0x0e7e, 0x157e, 0x2071,
1978 0xa534, 0x7184, 0x81ff, 0x0040, 0x4d22, 0xa006, 0x7086, 0xae80,
1979 0x0003, 0x2071, 0x0000, 0x21a8, 0x2014, 0x7226, 0x8000, 0x2014,
1980 0x722a, 0x8000, 0x0070, 0x4d1b, 0x2014, 0x723a, 0x8000, 0x2014,
1981 0x723e, 0x0078, 0x4d1f, 0x2001, 0x8020, 0x0078, 0x4d21, 0x2001,
1982 0x8042, 0x7022, 0x157f, 0x0e7f, 0x007c, 0x702c, 0x7130, 0x8108,
1983 0xa102, 0x0048, 0x4d32, 0xa00e, 0x7034, 0x706e, 0x7038, 0x7072,
1984 0x0078, 0x4d3c, 0x706c, 0xa080, 0x0040, 0x706e, 0x00c8, 0x4d3c,
1985 0x7070, 0xa081, 0x0000, 0x7072, 0x7132, 0x700c, 0x8001, 0x700e,
1986 0x00c0, 0x4d52, 0x127e, 0x2091, 0x8000, 0x0068, 0x4d55, 0x2001,
1987 0x000d, 0x2102, 0x2091, 0x4080, 0x2001, 0x0001, 0x700b, 0x0000,
1988 0x127f, 0x007c, 0x2001, 0x0007, 0x007c, 0x2001, 0x0006, 0x700b,
1989 0x0001, 0x127f, 0x007c, 0x701c, 0xa06d, 0x0040, 0x4d6e, 0x127e,
1990 0x2091, 0x8000, 0x7010, 0x8001, 0x7012, 0x2d04, 0x701e, 0xa005,
1991 0x00c0, 0x4d6b, 0x701a, 0x127f, 0x1078, 0x139a, 0x007c, 0x2019,
1992 0x000d, 0x2304, 0x230c, 0xa10e, 0x0040, 0x4d7e, 0x2304, 0x230c,
1993 0xa10e, 0x0040, 0x4d7e, 0xa006, 0x0078, 0x4d8e, 0x732c, 0x8319,
1994 0x7130, 0xa102, 0x00c0, 0x4d88, 0x2300, 0xa005, 0x0078, 0x4d8e,
1995 0x0048, 0x4d8d, 0xa302, 0x0078, 0x4d8e, 0x8002, 0x007c, 0x2d00,
1996 0x7026, 0xa080, 0x000d, 0x7056, 0x7053, 0x0000, 0x127e, 0x2091,
1997 0x8000, 0x2009, 0xa5d0, 0x2104, 0xc08d, 0x200a, 0x127f, 0x1078,
1998 0x13eb, 0x007c, 0x2071, 0xa3e1, 0x7003, 0x0000, 0x7007, 0x0000,
1999 0x700f, 0x0000, 0x702b, 0x0001, 0x704f, 0x0000, 0x7053, 0x0001,
2000 0x705f, 0x0020, 0x7063, 0x0040, 0x7083, 0x0000, 0x708b, 0x0000,
2001 0x708f, 0x0001, 0x70bf, 0x0000, 0x007c, 0x0e7e, 0x2071, 0xa3e1,
2002 0x6848, 0xa005, 0x00c0, 0x4dcb, 0x7028, 0xc085, 0x702a, 0xa085,
2003 0x0001, 0x0078, 0x4df0, 0x6a50, 0x7236, 0x6b54, 0x733a, 0x6858,
2004 0x703e, 0x707a, 0x685c, 0x7042, 0x707e, 0x6848, 0x702e, 0x6840,
2005 0x7032, 0x2009, 0x000c, 0x200a, 0x8007, 0x8006, 0x8006, 0xa08c,
2006 0x003f, 0xa084, 0xffc0, 0xa210, 0x2100, 0xa319, 0x7272, 0x7376,
2007 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0x700f, 0x0000, 0xa006,
2008 0x0e7f, 0x007c, 0x2b78, 0x2071, 0xa3e1, 0x7004, 0x1079, 0x4e50,
2009 0x700c, 0x0079, 0x4dfb, 0x4e00, 0x4df5, 0x4df5, 0x4df5, 0x4df5,
2010 0x007c, 0x700c, 0x0079, 0x4e04, 0x4e09, 0x4e4e, 0x4e4e, 0x4e4f,
2011 0x4e4f, 0x7830, 0x7930, 0xa106, 0x0040, 0x4e13, 0x7830, 0x7930,
2012 0xa106, 0x00c0, 0x4e39, 0x7030, 0xa10a, 0x0040, 0x4e39, 0x00c8,
2013 0x4e1b, 0x712c, 0xa10a, 0xa18a, 0x0002, 0x00c8, 0x4e3a, 0x1078,
2014 0x1366, 0x0040, 0x4e39, 0x2d00, 0x705a, 0x7063, 0x0040, 0x2001,
2015 0x0003, 0x7057, 0x0000, 0x127e, 0x007e, 0x2091, 0x8000, 0x2009,
2016 0xa5d0, 0x2104, 0xc085, 0x200a, 0x007f, 0x700e, 0x127f, 0x1078,
2017 0x13eb, 0x007c, 0x1078, 0x1366, 0x0040, 0x4e39, 0x2d00, 0x705a,
2018 0x1078, 0x1366, 0x00c0, 0x4e46, 0x0078, 0x4e25, 0x2d00, 0x7086,
2019 0x7063, 0x0080, 0x2001, 0x0004, 0x0078, 0x4e29, 0x007c, 0x007c,
2020 0x4e61, 0x4e62, 0x4e99, 0x4e9a, 0x4e4e, 0x4ed0, 0x4ed5, 0x4f0c,
2021 0x4f0d, 0x4f28, 0x4f29, 0x4f2a, 0x4f2b, 0x4f2c, 0x4f2d, 0x4fad,
2022 0x4fd7, 0x007c, 0x700c, 0x0079, 0x4e65, 0x4e6a, 0x4e6d, 0x4e7d,
2023 0x4e98, 0x4e98, 0x1078, 0x4e01, 0x007c, 0x127e, 0x8001, 0x700e,
2024 0x7058, 0x007e, 0x1078, 0x5348, 0x0040, 0x4e7a, 0x2091, 0x8000,
2025 0x1078, 0x4e01, 0x0d7f, 0x0078, 0x4e86, 0x127e, 0x8001, 0x700e,
2026 0x1078, 0x5348, 0x7058, 0x2068, 0x7084, 0x705a, 0x6803, 0x0000,
2027 0x6807, 0x0000, 0x6834, 0xa084, 0x00ff, 0xa08a, 0x0020, 0x00c8,
2028 0x4e95, 0x1079, 0x4eb0, 0x127f, 0x007c, 0x127f, 0x1078, 0x4f2e,
2029 0x007c, 0x007c, 0x007c, 0x0e7e, 0x2071, 0xa3e1, 0x700c, 0x0079,
2030 0x4ea1, 0x4ea6, 0x4ea6, 0x4ea6, 0x4ea8, 0x4eac, 0x0e7f, 0x007c,
2031 0x700f, 0x0001, 0x0078, 0x4eae, 0x700f, 0x0002, 0x0e7f, 0x007c,
2032 0x4f2e, 0x4f2e, 0x4f4a, 0x4f2e, 0x5080, 0x4f2e, 0x4f2e, 0x4f2e,
2033 0x4f2e, 0x4f2e, 0x4f4a, 0x50ca, 0x5117, 0x5170, 0x5186, 0x4f2e,
2034 0x4f2e, 0x4f66, 0x4f4a, 0x4f2e, 0x4f2e, 0x4f87, 0x5245, 0x5263,
2035 0x4f2e, 0x4f66, 0x4f2e, 0x4f2e, 0x4f2e, 0x4f2e, 0x4f7c, 0x5263,
2036 0x7020, 0x2068, 0x1078, 0x139a, 0x007c, 0x700c, 0x0079, 0x4ed8,
2037 0x4edd, 0x4ee0, 0x4ef0, 0x4f0b, 0x4f0b, 0x1078, 0x4e01, 0x007c,
2038 0x127e, 0x8001, 0x700e, 0x7058, 0x007e, 0x1078, 0x5348, 0x0040,
2039 0x4eed, 0x2091, 0x8000, 0x1078, 0x4e01, 0x0d7f, 0x0078, 0x4ef9,
2040 0x127e, 0x8001, 0x700e, 0x1078, 0x5348, 0x7058, 0x2068, 0x7084,
2041 0x705a, 0x6803, 0x0000, 0x6807, 0x0000, 0x6834, 0xa084, 0x00ff,
2042 0xa08a, 0x001a, 0x00c8, 0x4f08, 0x1079, 0x4f0e, 0x127f, 0x007c,
2043 0x127f, 0x1078, 0x4f2e, 0x007c, 0x007c, 0x007c, 0x4f2e, 0x4f4a,
2044 0x506a, 0x4f2e, 0x4f4a, 0x4f2e, 0x4f4a, 0x4f4a, 0x4f2e, 0x4f4a,
2045 0x506a, 0x4f4a, 0x4f4a, 0x4f4a, 0x4f4a, 0x4f4a, 0x4f2e, 0x4f4a,
2046 0x506a, 0x4f2e, 0x4f2e, 0x4f4a, 0x4f2e, 0x4f2e, 0x4f2e, 0x4f4a,
2047 0x007c, 0x007c, 0x007c, 0x007c, 0x007c, 0x007c, 0x7007, 0x0001,
2048 0x6838, 0xa084, 0x00ff, 0xc0d5, 0x683a, 0x127e, 0x2091, 0x8000,
2049 0x1078, 0x4982, 0x127f, 0x007c, 0x7007, 0x0001, 0x6838, 0xa084,
2050 0x00ff, 0xc0e5, 0x683a, 0x127e, 0x2091, 0x8000, 0x1078, 0x4982,
2051 0x127f, 0x007c, 0x7007, 0x0001, 0x6838, 0xa084, 0x00ff, 0xc0ed,
2052 0x683a, 0x127e, 0x2091, 0x8000, 0x1078, 0x4982, 0x127f, 0x007c,
2053 0x7007, 0x0001, 0x6838, 0xa084, 0x00ff, 0xc0dd, 0x683a, 0x127e,
2054 0x2091, 0x8000, 0x1078, 0x4982, 0x127f, 0x007c, 0x6834, 0x8007,
2055 0xa084, 0x00ff, 0x0040, 0x4f3c, 0x8001, 0x00c0, 0x4f73, 0x7007,
2056 0x0001, 0x0078, 0x5049, 0x7007, 0x0006, 0x7012, 0x2d00, 0x7016,
2057 0x701a, 0x704b, 0x5049, 0x007c, 0x684c, 0xa084, 0x00c0, 0xa086,
2058 0x00c0, 0x00c0, 0x4f87, 0x7007, 0x0001, 0x0078, 0x5280, 0x2d00,
2059 0x7016, 0x701a, 0x20a9, 0x0004, 0xa080, 0x0024, 0x2098, 0x20a1,
2060 0xa40c, 0x53a3, 0x6858, 0x7012, 0xa082, 0x0401, 0x00c8, 0x4f58,
2061 0x6884, 0xa08a, 0x0002, 0x00c8, 0x4f58, 0x82ff, 0x00c0, 0x4fa9,
2062 0x6888, 0x698c, 0xa105, 0x0040, 0x4fa9, 0x2001, 0x5019, 0x0078,
2063 0x4fac, 0xa280, 0x500f, 0x2004, 0x70c6, 0x7010, 0xa015, 0x0040,
2064 0x4ff7, 0x1078, 0x1366, 0x00c0, 0x4fb8, 0x7007, 0x000f, 0x007c,
2065 0x2d00, 0x7022, 0x70c4, 0x2060, 0x6000, 0x6836, 0x6004, 0xad00,
2066 0x7096, 0x6008, 0xa20a, 0x00c8, 0x4fc7, 0xa00e, 0x2200, 0x7112,
2067 0x620c, 0x8003, 0x800b, 0xa296, 0x0004, 0x0040, 0x4fd0, 0xa108,
2068 0x719a, 0x810b, 0x719e, 0xae90, 0x0022, 0x1078, 0x13d1, 0x7090,
2069 0xa08e, 0x0100, 0x0040, 0x4feb, 0xa086, 0x0200, 0x0040, 0x4fe3,
2070 0x7007, 0x0010, 0x007c, 0x7020, 0x2068, 0x1078, 0x139a, 0x7014,
2071 0x2068, 0x0078, 0x4f58, 0x7020, 0x2068, 0x7018, 0x6802, 0x6807,
2072 0x0000, 0x2d08, 0x2068, 0x6906, 0x711a, 0x0078, 0x4fad, 0x7014,
2073 0x2068, 0x7007, 0x0001, 0x6884, 0xa005, 0x00c0, 0x5006, 0x6888,
2074 0x698c, 0xa105, 0x0040, 0x5006, 0x1078, 0x501d, 0x6834, 0xa084,
2075 0x00ff, 0xa086, 0x001e, 0x0040, 0x5280, 0x0078, 0x5049, 0x5011,
2076 0x5015, 0x0002, 0x0011, 0x0007, 0x0004, 0x000a, 0x000f, 0x0005,
2077 0x0006, 0x000a, 0x0011, 0x0005, 0x0004, 0x0f7e, 0x0e7e, 0x0c7e,
2078 0x077e, 0x067e, 0x6f88, 0x6e8c, 0x6804, 0x2060, 0xacf0, 0x0021,
2079 0xacf8, 0x0027, 0x2009, 0x0005, 0x700c, 0x7816, 0x7008, 0x7812,
2080 0x7004, 0x7806, 0x7000, 0x7802, 0x7e0e, 0x7f0a, 0x8109, 0x0040,
2081 0x503f, 0xaef2, 0x0004, 0xaffa, 0x0006, 0x0078, 0x502c, 0x6004,
2082 0xa065, 0x00c0, 0x5026, 0x067f, 0x077f, 0x0c7f, 0x0e7f, 0x0f7f,
2083 0x007c, 0x2009, 0xa32e, 0x210c, 0x81ff, 0x00c0, 0x5064, 0x6838,
2084 0xa084, 0x00ff, 0x683a, 0x1078, 0x4290, 0x00c0, 0x5058, 0x007c,
2085 0x1078, 0x4a60, 0x127e, 0x2091, 0x8000, 0x1078, 0x8cb8, 0x1078,
2086 0x4982, 0x127f, 0x0078, 0x5057, 0x2001, 0x0028, 0x2009, 0x0000,
2087 0x0078, 0x5058, 0x7018, 0x6802, 0x2d08, 0x2068, 0x6906, 0x711a,
2088 0x7010, 0x8001, 0x7012, 0x0040, 0x5079, 0x7007, 0x0006, 0x0078,
2089 0x507f, 0x7014, 0x2068, 0x7007, 0x0001, 0x7048, 0x107a, 0x007c,
2090 0x7007, 0x0001, 0x6944, 0x810f, 0xa18c, 0x00ff, 0x6848, 0xa084,
2091 0x00ff, 0x20a9, 0x0001, 0xa096, 0x0001, 0x0040, 0x50a9, 0x2009,
2092 0x0000, 0x20a9, 0x00ff, 0xa096, 0x0002, 0x0040, 0x50a9, 0xa005,
2093 0x00c0, 0x50bc, 0x6944, 0x810f, 0xa18c, 0x00ff, 0x1078, 0x4501,
2094 0x00c0, 0x50bc, 0x067e, 0x6e50, 0x1078, 0x45e7, 0x067f, 0x0078,
2095 0x50bc, 0x047e, 0x2011, 0xa30c, 0x2224, 0xc484, 0xc48c, 0x2412,
2096 0x047f, 0x0c7e, 0x1078, 0x4501, 0x00c0, 0x50b8, 0x1078, 0x4782,
2097 0x8108, 0x00f0, 0x50b2, 0x0c7f, 0x684c, 0xd084, 0x00c0, 0x50c3,
2098 0x1078, 0x139a, 0x007c, 0x127e, 0x2091, 0x8000, 0x1078, 0x4982,
2099 0x127f, 0x007c, 0x127e, 0x2091, 0x8000, 0x7007, 0x0001, 0x2001,
2100 0xa352, 0x2004, 0xd0a4, 0x0040, 0x510e, 0x2061, 0xa62d, 0x6100,
2101 0xd184, 0x0040, 0x50ee, 0x6858, 0xa084, 0x00ff, 0x00c0, 0x5111,
2102 0x6000, 0xd084, 0x0040, 0x510e, 0x6004, 0xa005, 0x00c0, 0x5114,
2103 0x6003, 0x0000, 0x600b, 0x0000, 0x0078, 0x510b, 0x2011, 0x0001,
2104 0x6860, 0xa005, 0x00c0, 0x50f6, 0x2001, 0x001e, 0x8000, 0x6016,
2105 0x6858, 0xa084, 0x00ff, 0x0040, 0x510e, 0x6006, 0x6858, 0x8007,
2106 0xa084, 0x00ff, 0x0040, 0x510e, 0x600a, 0x6858, 0x8000, 0x00c0,
2107 0x510a, 0xc28d, 0x6202, 0x127f, 0x0078, 0x5337, 0x127f, 0x0078,
2108 0x532f, 0x127f, 0x0078, 0x5327, 0x127f, 0x0078, 0x532b, 0x127e,
2109 0x2091, 0x8000, 0x7007, 0x0001, 0x2001, 0xa352, 0x2004, 0xd0a4,
2110 0x0040, 0x516d, 0x2061, 0xa62d, 0x6000, 0xd084, 0x0040, 0x516d,
2111 0x6204, 0x6308, 0xd08c, 0x00c0, 0x515f, 0x6c48, 0xa484, 0x0003,
2112 0x0040, 0x5145, 0x6958, 0xa18c, 0x00ff, 0x8001, 0x00c0, 0x513e,
2113 0x2100, 0xa210, 0x0048, 0x516a, 0x0078, 0x5145, 0x8001, 0x00c0,
2114 0x516a, 0x2100, 0xa212, 0x0048, 0x516a, 0xa484, 0x000c, 0x0040,
2115 0x515f, 0x6958, 0x810f, 0xa18c, 0x00ff, 0xa082, 0x0004, 0x00c0,
2116 0x5157, 0x2100, 0xa318, 0x0048, 0x516a, 0x0078, 0x515f, 0xa082,
2117 0x0004, 0x00c0, 0x516a, 0x2100, 0xa31a, 0x0048, 0x516a, 0x6860,
2118 0xa005, 0x0040, 0x5165, 0x8000, 0x6016, 0x6206, 0x630a, 0x127f,
2119 0x0078, 0x5337, 0x127f, 0x0078, 0x5333, 0x127f, 0x0078, 0x532f,
2120 0x127e, 0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0xa62d, 0x6300,
2121 0xd38c, 0x00c0, 0x5180, 0x6308, 0x8318, 0x0048, 0x5183, 0x630a,
2122 0x127f, 0x0078, 0x5345, 0x127f, 0x0078, 0x5333, 0x127e, 0x0c7e,
2123 0x2091, 0x8000, 0x7007, 0x0001, 0x684c, 0xd0ac, 0x0040, 0x519a,
2124 0x0c7e, 0x2061, 0xa62d, 0x6000, 0xa084, 0xfcff, 0x6002, 0x0c7f,
2125 0x0078, 0x51c9, 0x6858, 0xa005, 0x0040, 0x51e0, 0x685c, 0xa065,
2126 0x0040, 0x51dc, 0x2001, 0xa32e, 0x2004, 0xa005, 0x0040, 0x51ac,
2127 0x1078, 0x8c01, 0x0078, 0x51ba, 0x6013, 0x0400, 0x6037, 0x0000,
2128 0x694c, 0xd1a4, 0x0040, 0x51b6, 0x6950, 0x6136, 0x2009, 0x0041,
2129 0x1078, 0x756c, 0x6958, 0xa18c, 0xff00, 0xa186, 0x2000, 0x00c0,
2130 0x51c9, 0x027e, 0x2009, 0x0000, 0x2011, 0xfdff, 0x1078, 0x5a6d,
2131 0x027f, 0x684c, 0xd0c4, 0x0040, 0x51d8, 0x2061, 0xa62d, 0x6000,
2132 0xd08c, 0x00c0, 0x51d8, 0x6008, 0x8000, 0x0048, 0x51dc, 0x600a,
2133 0x0c7f, 0x127f, 0x0078, 0x5337, 0x0c7f, 0x127f, 0x0078, 0x532f,
2134 0x6954, 0xa186, 0x0045, 0x0040, 0x5213, 0xa186, 0x002a, 0x00c0,
2135 0x51f0, 0x2001, 0xa30c, 0x200c, 0xc194, 0x2102, 0x0078, 0x51c9,
2136 0xa186, 0x0020, 0x0040, 0x5209, 0xa186, 0x0029, 0x0040, 0x51fc,
2137 0xa186, 0x002d, 0x00c0, 0x51dc, 0x6944, 0xa18c, 0xff00, 0x810f,
2138 0x1078, 0x4501, 0x00c0, 0x51c9, 0x6000, 0xc0e4, 0x6002, 0x0078,
2139 0x51c9, 0x685c, 0xa065, 0x0040, 0x51dc, 0x2001, 0xa5a1, 0x2004,
2140 0x6016, 0x0078, 0x51c9, 0x685c, 0xa065, 0x0040, 0x51dc, 0x0e7e,
2141 0x6860, 0xa075, 0x2001, 0xa32e, 0x2004, 0xa005, 0x0040, 0x522b,
2142 0x1078, 0x8c01, 0x8eff, 0x0040, 0x5228, 0x2e60, 0x1078, 0x8c01,
2143 0x0e7f, 0x0078, 0x51c9, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60,
2144 0x6007, 0x003a, 0x6870, 0xa005, 0x0040, 0x523c, 0x6007, 0x003b,
2145 0x6874, 0x602a, 0x6878, 0x6012, 0x6003, 0x0001, 0x1078, 0x5bf8,
2146 0x1078, 0x6109, 0x0e7f, 0x0078, 0x51c9, 0x2061, 0xa62d, 0x6000,
2147 0xd084, 0x0040, 0x525f, 0xd08c, 0x00c0, 0x5345, 0x2091, 0x8000,
2148 0x6204, 0x8210, 0x0048, 0x5259, 0x6206, 0x2091, 0x8001, 0x0078,
2149 0x5345, 0x2091, 0x8001, 0x6853, 0x0016, 0x0078, 0x533e, 0x6853,
2150 0x0007, 0x0078, 0x533e, 0x6834, 0x8007, 0xa084, 0x00ff, 0x00c0,
2151 0x526d, 0x1078, 0x4f3c, 0x0078, 0x527f, 0x2030, 0x8001, 0x00c0,
2152 0x5277, 0x7007, 0x0001, 0x1078, 0x5280, 0x0078, 0x527f, 0x7007,
2153 0x0006, 0x7012, 0x2d00, 0x7016, 0x701a, 0x704b, 0x5280, 0x007c,
2154 0x0e7e, 0x127e, 0x2091, 0x8000, 0x2009, 0xa32e, 0x210c, 0x81ff,
2155 0x00c0, 0x530b, 0x2009, 0xa30c, 0x210c, 0xd194, 0x00c0, 0x5315,
2156 0x6848, 0x2070, 0xae82, 0xaa00, 0x0048, 0x52fb, 0x2001, 0xa315,
2157 0x2004, 0xae02, 0x00c8, 0x52fb, 0x2061, 0xa62d, 0x6100, 0xa184,
2158 0x0301, 0xa086, 0x0001, 0x00c0, 0x52de, 0x711c, 0xa186, 0x0006,
2159 0x00c0, 0x52e6, 0x7018, 0xa005, 0x0040, 0x530b, 0x2004, 0xd0e4,
2160 0x00c0, 0x530f, 0x7024, 0xd0dc, 0x00c0, 0x5319, 0x6853, 0x0000,
2161 0x6803, 0x0000, 0x2d08, 0x7010, 0xa005, 0x00c0, 0x52ca, 0x7112,
2162 0x684c, 0xd0f4, 0x00c0, 0x531d, 0x2e60, 0x1078, 0x59b6, 0x127f,
2163 0x0e7f, 0x007c, 0x2068, 0x6800, 0xa005, 0x00c0, 0x52ca, 0x6902,
2164 0x2168, 0x684c, 0xd0f4, 0x00c0, 0x531d, 0x127f, 0x0e7f, 0x007c,
2165 0x127f, 0x0e7f, 0x6853, 0x0006, 0x0078, 0x533e, 0xd184, 0x0040,
2166 0x52d8, 0xd1c4, 0x00c0, 0x52ff, 0x0078, 0x5303, 0x6944, 0xa18c,
2167 0xff00, 0x810f, 0x1078, 0x4501, 0x00c0, 0x530f, 0x6000, 0xd0e4,
2168 0x00c0, 0x530f, 0x711c, 0xa186, 0x0007, 0x00c0, 0x52fb, 0x6853,
2169 0x0002, 0x0078, 0x5311, 0x6853, 0x0008, 0x0078, 0x5311, 0x6853,
2170 0x000e, 0x0078, 0x5311, 0x6853, 0x0017, 0x0078, 0x5311, 0x6853,
2171 0x0035, 0x0078, 0x5311, 0x6853, 0x0028, 0x0078, 0x5311, 0x6853,
2172 0x0029, 0x127f, 0x0e7f, 0x0078, 0x533e, 0x6853, 0x002a, 0x0078,
2173 0x5311, 0x6853, 0x0045, 0x0078, 0x5311, 0x2e60, 0x2019, 0x0002,
2174 0x6017, 0x0014, 0x1078, 0x9a6a, 0x127f, 0x0e7f, 0x007c, 0x2009,
2175 0x003e, 0x0078, 0x5339, 0x2009, 0x0004, 0x0078, 0x5339, 0x2009,
2176 0x0006, 0x0078, 0x5339, 0x2009, 0x0016, 0x0078, 0x5339, 0x2009,
2177 0x0001, 0x6854, 0xa084, 0xff00, 0xa105, 0x6856, 0x2091, 0x8000,
2178 0x1078, 0x4982, 0x2091, 0x8001, 0x007c, 0x1078, 0x139a, 0x007c,
2179 0x702c, 0x7130, 0x8108, 0xa102, 0x0048, 0x5355, 0xa00e, 0x7034,
2180 0x7072, 0x7038, 0x7076, 0x0078, 0x5361, 0x7070, 0xa080, 0x0040,
2181 0x7072, 0x00c8, 0x5361, 0x7074, 0xa081, 0x0000, 0x7076, 0xa085,
2182 0x0001, 0x7932, 0x7132, 0x007c, 0x0d7e, 0x1078, 0x59ad, 0x0d7f,
2183 0x007c, 0x0d7e, 0x2011, 0x0004, 0x2204, 0xa085, 0x8002, 0x2012,
2184 0x0d7f, 0x007c, 0x20e1, 0x0002, 0x3d08, 0x20e1, 0x2000, 0x3d00,
2185 0xa084, 0x7000, 0x0040, 0x5380, 0xa086, 0x1000, 0x00c0, 0x53ac,
2186 0x20e1, 0x0000, 0x3d00, 0xa094, 0xff00, 0x8217, 0xa084, 0xf000,
2187 0xa086, 0x3000, 0x00c0, 0x5390, 0x1078, 0x5570, 0x0078, 0x53a7,
2188 0x20e1, 0x0004, 0x3d60, 0xd1bc, 0x00c0, 0x5397, 0x3e60, 0xac84,
2189 0x000f, 0x00c0, 0x53ac, 0xac82, 0xaa00, 0x0048, 0x53ac, 0x6854,
2190 0xac02, 0x00c8, 0x53ac, 0x2009, 0x0047, 0x1078, 0x756c, 0x7a1c,
2191 0xd284, 0x00c0, 0x5372, 0x007c, 0xa016, 0x1078, 0x15ec, 0x0078,
2192 0x53a7, 0x0078, 0x53ac, 0x781c, 0xd08c, 0x0040, 0x53db, 0x157e,
2193 0x137e, 0x147e, 0x20e1, 0x3000, 0x3d20, 0x3e28, 0xa584, 0x0076,
2194 0x00c0, 0x53f1, 0xa484, 0x7000, 0xa086, 0x1000, 0x00c0, 0x53e0,
2195 0x1078, 0x540c, 0x0040, 0x53f1, 0x20e1, 0x3000, 0x7828, 0x7828,
2196 0x1078, 0x542a, 0x147f, 0x137f, 0x157f, 0x2009, 0xa5b3, 0x2104,
2197 0xa005, 0x00c0, 0x53dc, 0x007c, 0x1078, 0x6109, 0x0078, 0x53db,
2198 0xa484, 0x7000, 0x00c0, 0x53f1, 0x1078, 0x540c, 0x0040, 0x5403,
2199 0x7000, 0xa084, 0xff00, 0xa086, 0x8100, 0x0040, 0x53cc, 0x0078,
2200 0x5403, 0x1078, 0xa1ee, 0xd5a4, 0x0040, 0x53ff, 0x1078, 0x1af7,
2201 0x20e1, 0x9010, 0x2001, 0x0138, 0x2202, 0x0078, 0x5407, 0x1078,
2202 0x540c, 0x687f, 0x0000, 0x20e1, 0x3000, 0x7828, 0x7828, 0x147f,
2203 0x137f, 0x157f, 0x0078, 0x53db, 0xa484, 0x01ff, 0x687e, 0xa005,
2204 0x0040, 0x541e, 0xa080, 0x001f, 0xa084, 0x03f8, 0x80ac, 0x20e1,
2205 0x1000, 0x2ea0, 0x2099, 0x020a, 0x53a5, 0x007c, 0x20a9, 0x000c,
2206 0x20e1, 0x1000, 0x2ea0, 0x2099, 0x020a, 0x53a5, 0xa085, 0x0001,
2207 0x0078, 0x541d, 0x7000, 0xa084, 0xff00, 0xa08c, 0xf000, 0x8007,
2208 0xa196, 0x0000, 0x00c0, 0x5437, 0x0078, 0x567c, 0x007c, 0xa196,
2209 0x2000, 0x00c0, 0x5448, 0x6900, 0xa18e, 0x0001, 0x00c0, 0x5444,
2210 0x1078, 0x3a43, 0x0078, 0x5436, 0x1078, 0x5450, 0x0078, 0x5436,
2211 0xa196, 0x8000, 0x00c0, 0x5436, 0x1078, 0x570c, 0x0078, 0x5436,
2212 0x0c7e, 0x7110, 0xa18c, 0xff00, 0x810f, 0xa196, 0x0001, 0x0040,
2213 0x545d, 0xa196, 0x0023, 0x00c0, 0x5568, 0xa08e, 0x0023, 0x00c0,
2214 0x5492, 0x1078, 0x57b2, 0x0040, 0x5568, 0x7124, 0x610a, 0x7030,
2215 0xa08e, 0x0200, 0x00c0, 0x5476, 0x7034, 0xa005, 0x00c0, 0x5568,
2216 0x2009, 0x0015, 0x1078, 0x756c, 0x0078, 0x5568, 0xa08e, 0x0214,
2217 0x0040, 0x547e, 0xa08e, 0x0210, 0x00c0, 0x5484, 0x2009, 0x0015,
2218 0x1078, 0x756c, 0x0078, 0x5568, 0xa08e, 0x0100, 0x00c0, 0x5568,
2219 0x7034, 0xa005, 0x00c0, 0x5568, 0x2009, 0x0016, 0x1078, 0x756c,
2220 0x0078, 0x5568, 0xa08e, 0x0022, 0x00c0, 0x5568, 0x7030, 0xa08e,
2221 0x0300, 0x00c0, 0x54a3, 0x7034, 0xa005, 0x00c0, 0x5568, 0x2009,
2222 0x0017, 0x0078, 0x5534, 0xa08e, 0x0500, 0x00c0, 0x54af, 0x7034,
2223 0xa005, 0x00c0, 0x5568, 0x2009, 0x0018, 0x0078, 0x5534, 0xa08e,
2224 0x2010, 0x00c0, 0x54b7, 0x2009, 0x0019, 0x0078, 0x5534, 0xa08e,
2225 0x2110, 0x00c0, 0x54bf, 0x2009, 0x001a, 0x0078, 0x5534, 0xa08e,
2226 0x5200, 0x00c0, 0x54cb, 0x7034, 0xa005, 0x00c0, 0x5568, 0x2009,
2227 0x001b, 0x0078, 0x5534, 0xa08e, 0x5000, 0x00c0, 0x54d7, 0x7034,
2228 0xa005, 0x00c0, 0x5568, 0x2009, 0x001c, 0x0078, 0x5534, 0xa08e,
2229 0x1300, 0x00c0, 0x54df, 0x2009, 0x0034, 0x0078, 0x5534, 0xa08e,
2230 0x1200, 0x00c0, 0x54eb, 0x7034, 0xa005, 0x00c0, 0x5568, 0x2009,
2231 0x0024, 0x0078, 0x5534, 0xa08c, 0xff00, 0xa18e, 0x2400, 0x00c0,
2232 0x54f5, 0x2009, 0x002d, 0x0078, 0x5534, 0xa08c, 0xff00, 0xa18e,
2233 0x5300, 0x00c0, 0x54ff, 0x2009, 0x002a, 0x0078, 0x5534, 0xa08e,
2234 0x0f00, 0x00c0, 0x5507, 0x2009, 0x0020, 0x0078, 0x5534, 0xa08e,
2235 0x5300, 0x00c0, 0x550d, 0x0078, 0x552a, 0xa08e, 0x6104, 0x00c0,
2236 0x552a, 0x2011, 0xa88d, 0x8208, 0x2204, 0xa082, 0x0004, 0x20a8,
2237 0x95ac, 0x95ac, 0x2011, 0x8015, 0x211c, 0x8108, 0x047e, 0x2124,
2238 0x1078, 0x3579, 0x047f, 0x8108, 0x00f0, 0x551a, 0x2009, 0x0023,
2239 0x0078, 0x5534, 0xa08e, 0x6000, 0x00c0, 0x5532, 0x2009, 0x003f,
2240 0x0078, 0x5534, 0x2009, 0x001d, 0x017e, 0x2011, 0xa883, 0x2204,
2241 0x8211, 0x220c, 0x1078, 0x24e3, 0x00c0, 0x556a, 0x1078, 0x4499,
2242 0x00c0, 0x556a, 0x6612, 0x6516, 0x86ff, 0x0040, 0x555a, 0x017f,
2243 0x017e, 0xa186, 0x0017, 0x00c0, 0x555a, 0x6868, 0xa606, 0x00c0,
2244 0x555a, 0x686c, 0xa506, 0xa084, 0xff00, 0x00c0, 0x555a, 0x6000,
2245 0xc0f5, 0x6002, 0x0c7e, 0x1078, 0x74d7, 0x0040, 0x556d, 0x017f,
2246 0x611a, 0x601f, 0x0004, 0x7120, 0x610a, 0x017f, 0x1078, 0x756c,
2247 0x0c7f, 0x007c, 0x017f, 0x0078, 0x5568, 0x0c7f, 0x0078, 0x556a,
2248 0x0c7e, 0x1078, 0x55d4, 0x00c0, 0x55d2, 0xa184, 0xff00, 0x8007,
2249 0xa086, 0x0008, 0x00c0, 0x55d2, 0xa28e, 0x0033, 0x00c0, 0x55a3,
2250 0x1078, 0x57b2, 0x0040, 0x55d2, 0x7124, 0x610a, 0x7030, 0xa08e,
2251 0x0200, 0x00c0, 0x5595, 0x7034, 0xa005, 0x00c0, 0x55d2, 0x2009,
2252 0x0015, 0x1078, 0x756c, 0x0078, 0x55d2, 0xa08e, 0x0100, 0x00c0,
2253 0x55d2, 0x7034, 0xa005, 0x00c0, 0x55d2, 0x2009, 0x0016, 0x1078,
2254 0x756c, 0x0078, 0x55d2, 0xa28e, 0x0032, 0x00c0, 0x55d2, 0x7030,
2255 0xa08e, 0x1400, 0x00c0, 0x55d2, 0x2009, 0x0038, 0x017e, 0x2011,
2256 0xa883, 0x2204, 0x8211, 0x220c, 0x1078, 0x24e3, 0x00c0, 0x55d1,
2257 0x1078, 0x4499, 0x00c0, 0x55d1, 0x6612, 0x6516, 0x0c7e, 0x1078,
2258 0x74d7, 0x0040, 0x55d0, 0x017f, 0x611a, 0x601f, 0x0004, 0x7120,
2259 0x610a, 0x017f, 0x1078, 0x756c, 0x1078, 0x6109, 0x0078, 0x55d2,
2260 0x0c7f, 0x017f, 0x0c7f, 0x007c, 0x0f7e, 0x0d7e, 0x027e, 0x017e,
2261 0x137e, 0x147e, 0x157e, 0x3c00, 0x007e, 0x2079, 0x0030, 0x2069,
2262 0x0200, 0x1078, 0x1c25, 0x00c0, 0x5615, 0x1078, 0x1b15, 0x0040,
2263 0x561f, 0x7908, 0xa18c, 0x1fff, 0xa182, 0x0011, 0x00c8, 0x561f,
2264 0x20a9, 0x000c, 0x20e1, 0x0000, 0x2ea0, 0x2099, 0x020a, 0x53a5,
2265 0x20e1, 0x2000, 0x2001, 0x020a, 0x2004, 0x7a0c, 0x7808, 0xa080,
2266 0x0007, 0xa084, 0x1ff8, 0xa08a, 0x0140, 0x10c8, 0x1328, 0x80ac,
2267 0x20e1, 0x6000, 0x2099, 0x020a, 0x53a5, 0x20e1, 0x7000, 0x6828,
2268 0x6828, 0x7803, 0x0004, 0xa294, 0x0070, 0x007f, 0x20e0, 0x157f,
2269 0x147f, 0x137f, 0x017f, 0x027f, 0x0d7f, 0x0f7f, 0x007c, 0xa085,
2270 0x0001, 0x0078, 0x5615, 0x047e, 0x0e7e, 0x0d7e, 0x2028, 0x2130,
2271 0xa696, 0x00ff, 0x00c0, 0x5644, 0xa596, 0xfffd, 0x00c0, 0x5634,
2272 0x2009, 0x007f, 0x0078, 0x5677, 0xa596, 0xfffe, 0x00c0, 0x563c,
2273 0x2009, 0x007e, 0x0078, 0x5677, 0xa596, 0xfffc, 0x00c0, 0x5644,
2274 0x2009, 0x0080, 0x0078, 0x5677, 0x2011, 0x0000, 0x2021, 0x0081,
2275 0x20a9, 0x007e, 0x2071, 0xa4b5, 0x2e1c, 0x83ff, 0x00c0, 0x5656,
2276 0x82ff, 0x00c0, 0x566b, 0x2410, 0x0078, 0x566b, 0x2368, 0x6f10,
2277 0x007e, 0x2100, 0xa706, 0x007f, 0x6b14, 0x00c0, 0x5665, 0xa346,
2278 0x00c0, 0x5665, 0x2408, 0x0078, 0x5677, 0x87ff, 0x00c0, 0x566b,
2279 0x83ff, 0x0040, 0x5650, 0x8420, 0x8e70, 0x00f0, 0x564c, 0x82ff,
2280 0x00c0, 0x5676, 0xa085, 0x0001, 0x0078, 0x5678, 0x2208, 0xa006,
2281 0x0d7f, 0x0e7f, 0x047f, 0x007c, 0xa084, 0x0007, 0x0079, 0x5681,
2282 0x007c, 0x5689, 0x5689, 0x5689, 0x57c8, 0x5689, 0x568a, 0x56a3,
2283 0x56f3, 0x007c, 0x7110, 0xd1bc, 0x0040, 0x56a2, 0x7120, 0x2160,
2284 0xac8c, 0x000f, 0x00c0, 0x56a2, 0xac8a, 0xaa00, 0x0048, 0x56a2,
2285 0x6854, 0xac02, 0x00c8, 0x56a2, 0x7124, 0x610a, 0x2009, 0x0046,
2286 0x1078, 0x756c, 0x007c, 0x0c7e, 0x7110, 0xd1bc, 0x00c0, 0x56f1,
2287 0x2011, 0xa883, 0x2204, 0x8211, 0x220c, 0x1078, 0x24e3, 0x00c0,
2288 0x56f1, 0x1078, 0x4499, 0x00c0, 0x56f1, 0x6612, 0x6516, 0x6000,
2289 0xd0ec, 0x00c0, 0x56f1, 0x6204, 0xa294, 0xff00, 0x8217, 0xa286,
2290 0x0006, 0x00c0, 0x56d6, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040,
2291 0x56f1, 0x611a, 0x601f, 0x0006, 0x7120, 0x610a, 0x7130, 0x6122,
2292 0x2009, 0x0044, 0x1078, 0x756c, 0x0078, 0x56f1, 0x0c7e, 0x1078,
2293 0x74d7, 0x017f, 0x0040, 0x56f1, 0x611a, 0x601f, 0x0004, 0x7120,
2294 0x610a, 0xa286, 0x0004, 0x00c0, 0x56e9, 0x6007, 0x0005, 0x0078,
2295 0x56eb, 0x6007, 0x0001, 0x6003, 0x0001, 0x1078, 0x5c45, 0x1078,
2296 0x6109, 0x0c7f, 0x007c, 0x7110, 0xd1bc, 0x0040, 0x570b, 0x7020,
2297 0x2060, 0xac84, 0x000f, 0x00c0, 0x570b, 0xac82, 0xaa00, 0x0048,
2298 0x570b, 0x6854, 0xac02, 0x00c8, 0x570b, 0x7124, 0x610a, 0x2009,
2299 0x0045, 0x1078, 0x756c, 0x007c, 0x7110, 0xa18c, 0xff00, 0x810f,
2300 0xa18e, 0x0000, 0x00c0, 0x571c, 0xa084, 0x000f, 0xa08a, 0x0006,
2301 0x00c8, 0x571c, 0x1079, 0x571d, 0x007c, 0x5723, 0x5724, 0x5723,
2302 0x5723, 0x5794, 0x57a3, 0x007c, 0x7110, 0xd1bc, 0x0040, 0x572c,
2303 0x702c, 0xd084, 0x0040, 0x5793, 0x700c, 0x7108, 0x1078, 0x24e3,
2304 0x00c0, 0x5793, 0x1078, 0x4499, 0x00c0, 0x5793, 0x6612, 0x6516,
2305 0x6204, 0x7110, 0xd1bc, 0x0040, 0x575e, 0xa28c, 0x00ff, 0xa186,
2306 0x0004, 0x0040, 0x5747, 0xa186, 0x0006, 0x00c0, 0x5784, 0x0c7e,
2307 0x1078, 0x57b2, 0x0c7f, 0x0040, 0x5793, 0x0c7e, 0x1078, 0x74d7,
2308 0x017f, 0x0040, 0x5793, 0x611a, 0x601f, 0x0002, 0x7120, 0x610a,
2309 0x2009, 0x0088, 0x1078, 0x756c, 0x0078, 0x5793, 0xa28c, 0x00ff,
2310 0xa186, 0x0006, 0x0040, 0x5773, 0xa186, 0x0004, 0x0040, 0x5773,
2311 0xa294, 0xff00, 0x8217, 0xa286, 0x0004, 0x0040, 0x5773, 0xa286,
2312 0x0006, 0x00c0, 0x5784, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040,
2313 0x5793, 0x611a, 0x601f, 0x0005, 0x7120, 0x610a, 0x2009, 0x0088,
2314 0x1078, 0x756c, 0x0078, 0x5793, 0x0c7e, 0x1078, 0x74d7, 0x017f,
2315 0x0040, 0x5793, 0x611a, 0x601f, 0x0004, 0x7120, 0x610a, 0x2009,
2316 0x0001, 0x1078, 0x756c, 0x007c, 0x7110, 0xd1bc, 0x0040, 0x57a2,
2317 0x1078, 0x57b2, 0x0040, 0x57a2, 0x7124, 0x610a, 0x2009, 0x0089,
2318 0x1078, 0x756c, 0x007c, 0x7110, 0xd1bc, 0x0040, 0x57b1, 0x1078,
2319 0x57b2, 0x0040, 0x57b1, 0x7124, 0x610a, 0x2009, 0x008a, 0x1078,
2320 0x756c, 0x007c, 0x7020, 0x2060, 0xac84, 0x000f, 0x00c0, 0x57c5,
2321 0xac82, 0xaa00, 0x0048, 0x57c5, 0x2001, 0xa315, 0x2004, 0xac02,
2322 0x00c8, 0x57c5, 0xa085, 0x0001, 0x007c, 0xa006, 0x0078, 0x57c4,
2323 0x7110, 0xd1bc, 0x00c0, 0x57de, 0x7024, 0x2060, 0xac84, 0x000f,
2324 0x00c0, 0x57de, 0xac82, 0xaa00, 0x0048, 0x57de, 0x6854, 0xac02,
2325 0x00c8, 0x57de, 0x2009, 0x0051, 0x1078, 0x756c, 0x007c, 0x2071,
2326 0xa5be, 0x7003, 0x0003, 0x700f, 0x0361, 0xa006, 0x701a, 0x7012,
2327 0x7017, 0xaa00, 0x7007, 0x0000, 0x7026, 0x702b, 0x6c4e, 0x7032,
2328 0x7037, 0x6ca0, 0x703b, 0x0002, 0x703f, 0x0000, 0x7043, 0xffff,
2329 0x7047, 0xffff, 0x007c, 0x2071, 0xa5be, 0x00e0, 0x58c1, 0x2091,
2330 0x6000, 0x700c, 0x8001, 0x700e, 0x00c0, 0x5873, 0x700f, 0x0361,
2331 0x7007, 0x0001, 0x127e, 0x2091, 0x8000, 0x7138, 0x8109, 0x713a,
2332 0x00c0, 0x5871, 0x703b, 0x0002, 0x2009, 0x0100, 0x2104, 0xa082,
2333 0x0003, 0x00c8, 0x5871, 0x703c, 0xa086, 0x0001, 0x00c0, 0x584e,
2334 0x0d7e, 0x2069, 0x0140, 0x6804, 0xa084, 0x4000, 0x0040, 0x582c,
2335 0x6803, 0x1000, 0x0078, 0x5833, 0x6804, 0xa084, 0x1000, 0x0040,
2336 0x5833, 0x6803, 0x0100, 0x6803, 0x0000, 0x703f, 0x0000, 0x2069,
2337 0xa5ab, 0x6804, 0xa082, 0x0006, 0x00c0, 0x5840, 0x6807, 0x0000,
2338 0x6830, 0xa082, 0x0003, 0x00c0, 0x5847, 0x6833, 0x0000, 0x1078,
2339 0x6109, 0x1078, 0x61d3, 0x0d7f, 0x0078, 0x5871, 0x0d7e, 0x2069,
2340 0xa300, 0x6944, 0x6860, 0xa102, 0x00c8, 0x5870, 0x2069, 0xa5ab,
2341 0x6804, 0xa086, 0x0000, 0x00c0, 0x5870, 0x6830, 0xa086, 0x0000,
2342 0x00c0, 0x5870, 0x703f, 0x0001, 0x6807, 0x0006, 0x6833, 0x0003,
2343 0x2069, 0x0100, 0x6830, 0x689e, 0x2069, 0x0140, 0x6803, 0x0600,
2344 0x0d7f, 0x0078, 0x5876, 0x127e, 0x2091, 0x8000, 0x7024, 0xa00d,
2345 0x0040, 0x588e, 0x7020, 0x8001, 0x7022, 0x00c0, 0x588e, 0x7023,
2346 0x0009, 0x8109, 0x7126, 0xa186, 0x03e8, 0x00c0, 0x5889, 0x7028,
2347 0x107a, 0x81ff, 0x00c0, 0x588e, 0x7028, 0x107a, 0x7030, 0xa00d,
2348 0x0040, 0x589f, 0x702c, 0x8001, 0x702e, 0x00c0, 0x589f, 0x702f,
2349 0x0009, 0x8109, 0x7132, 0x00c0, 0x589f, 0x7034, 0x107a, 0x7040,
2350 0xa005, 0x0040, 0x58a7, 0x0050, 0x58a7, 0x8001, 0x7042, 0x7044,
2351 0xa005, 0x0040, 0x58af, 0x0050, 0x58af, 0x8001, 0x7046, 0x7018,
2352 0xa00d, 0x0040, 0x58c0, 0x7008, 0x8001, 0x700a, 0x00c0, 0x58c0,
2353 0x700b, 0x0009, 0x8109, 0x711a, 0x00c0, 0x58c0, 0x701c, 0x107a,
2354 0x127f, 0x7004, 0x0079, 0x58c4, 0x58eb, 0x58ec, 0x5908, 0x0e7e,
2355 0x2071, 0xa5be, 0x7018, 0xa005, 0x00c0, 0x58d2, 0x711a, 0x721e,
2356 0x700b, 0x0009, 0x0e7f, 0x007c, 0x0e7e, 0x007e, 0x2071, 0xa5be,
2357 0x701c, 0xa206, 0x00c0, 0x58de, 0x701a, 0x701e, 0x007f, 0x0e7f,
2358 0x007c, 0x0e7e, 0x2071, 0xa5be, 0x6088, 0xa102, 0x0048, 0x58e9,
2359 0x618a, 0x0e7f, 0x007c, 0x007c, 0x7110, 0x1078, 0x4501, 0x00c0,
2360 0x58fe, 0x6088, 0x8001, 0x0048, 0x58fe, 0x608a, 0x00c0, 0x58fe,
2361 0x127e, 0x2091, 0x8000, 0x1078, 0x6109, 0x127f, 0x8108, 0xa182,
2362 0x00ff, 0x0048, 0x5906, 0xa00e, 0x7007, 0x0002, 0x7112, 0x007c,
2363 0x7014, 0x2060, 0x127e, 0x2091, 0x8000, 0x603c, 0xa005, 0x0040,
2364 0x5917, 0x8001, 0x603e, 0x00c0, 0x5917, 0x1078, 0x8cd7, 0x6014,
2365 0xa005, 0x0040, 0x5941, 0x8001, 0x6016, 0x00c0, 0x5941, 0x611c,
2366 0xa186, 0x0003, 0x0040, 0x5928, 0xa186, 0x0006, 0x00c0, 0x593f,
2367 0x6010, 0x2068, 0x6854, 0xa08a, 0x199a, 0x0048, 0x593f, 0xa082,
2368 0x1999, 0x6856, 0xa08a, 0x199a, 0x0048, 0x5938, 0x2001, 0x1999,
2369 0x8003, 0x800b, 0x810b, 0xa108, 0x6116, 0x0078, 0x5941, 0x1078,
2370 0x8810, 0x127f, 0xac88, 0x0010, 0x7116, 0x2001, 0xca00, 0xa102,
2371 0x0048, 0x594e, 0x7017, 0xaa00, 0x7007, 0x0000, 0x007c, 0x0e7e,
2372 0x2071, 0xa5be, 0x7027, 0x07d0, 0x7023, 0x0009, 0x703b, 0x0002,
2373 0x0e7f, 0x007c, 0x2001, 0xa5c7, 0x2003, 0x0000, 0x007c, 0x0e7e,
2374 0x2071, 0xa5be, 0x7132, 0x702f, 0x0009, 0x0e7f, 0x007c, 0x2011,
2375 0xa5ca, 0x2013, 0x0000, 0x007c, 0x0e7e, 0x2071, 0xa5be, 0x711a,
2376 0x721e, 0x700b, 0x0009, 0x0e7f, 0x007c, 0x027e, 0x0e7e, 0x0f7e,
2377 0x2079, 0xa300, 0x7a34, 0xd294, 0x0040, 0x59a4, 0x2071, 0xa5aa,
2378 0x2e14, 0xa0fe, 0x0000, 0x0040, 0x5991, 0xa0fe, 0x0001, 0x0040,
2379 0x5995, 0xa0fe, 0x0002, 0x00c0, 0x59a0, 0xa292, 0x0085, 0x0078,
2380 0x5997, 0xa292, 0x0005, 0x0078, 0x5997, 0xa292, 0x0002, 0x2272,
2381 0x0040, 0x599c, 0x00c8, 0x59a4, 0x2011, 0x8037, 0x1078, 0x3579,
2382 0x2011, 0xa5a9, 0x2204, 0x2072, 0x0f7f, 0x0e7f, 0x027f, 0x007c,
2383 0x0c7e, 0x2061, 0xa62d, 0x0c7f, 0x007c, 0xa184, 0x000f, 0x8003,
2384 0x8003, 0x8003, 0xa080, 0xa62d, 0x2060, 0x007c, 0x6854, 0xa08a,
2385 0x199a, 0x0048, 0x59bd, 0x2001, 0x1999, 0xa005, 0x00c0, 0x59cc,
2386 0x0c7e, 0x2061, 0xa62d, 0x6014, 0x0c7f, 0xa005, 0x00c0, 0x59d1,
2387 0x2001, 0x001e, 0x0078, 0x59d1, 0xa08e, 0xffff, 0x00c0, 0x59d1,
2388 0xa006, 0x8003, 0x800b, 0x810b, 0xa108, 0x6116, 0x684c, 0xa08c,
2389 0x00c0, 0xa18e, 0x00c0, 0x0040, 0x5a24, 0xd0b4, 0x00c0, 0x59e8,
2390 0xd0bc, 0x00c0, 0x5a14, 0x2009, 0x0006, 0x1078, 0x5a43, 0x007c,
2391 0xd0fc, 0x0040, 0x59f3, 0xa084, 0x0003, 0x0040, 0x59f3, 0xa086,
2392 0x0003, 0x00c0, 0x5a3c, 0x6024, 0xd0d4, 0x0040, 0x59fd, 0xc0d4,
2393 0x6026, 0x6860, 0x602a, 0x685c, 0x602e, 0x2009, 0xa373, 0x2104,
2394 0xd084, 0x0040, 0x5a0f, 0x6118, 0xa188, 0x0027, 0x2104, 0xd08c,
2395 0x00c0, 0x5a0f, 0x2009, 0x0042, 0x1078, 0x756c, 0x007c, 0x2009,
2396 0x0043, 0x1078, 0x756c, 0x007c, 0xd0fc, 0x0040, 0x5a1f, 0xa084,
2397 0x0003, 0x0040, 0x5a1f, 0xa086, 0x0003, 0x00c0, 0x5a3c, 0x2009,
2398 0x0042, 0x1078, 0x756c, 0x007c, 0xd0fc, 0x0040, 0x5a32, 0xa084,
2399 0x0003, 0xa08e, 0x0002, 0x0040, 0x5a36, 0x2009, 0x0041, 0x1078,
2400 0x756c, 0x007c, 0x1078, 0x5a41, 0x0078, 0x5a31, 0x2009, 0x0043,
2401 0x1078, 0x756c, 0x0078, 0x5a31, 0x2009, 0x0004, 0x1078, 0x5a43,
2402 0x007c, 0x2009, 0x0001, 0x0d7e, 0x6010, 0xa0ec, 0xf000, 0x0040,
2403 0x5a6b, 0x2068, 0x6952, 0x6800, 0x6012, 0xa186, 0x0001, 0x00c0,
2404 0x5a65, 0x694c, 0xa18c, 0x8100, 0xa18e, 0x8100, 0x00c0, 0x5a65,
2405 0x0c7e, 0x2061, 0xa62d, 0x6200, 0xd28c, 0x00c0, 0x5a64, 0x6204,
2406 0x8210, 0x0048, 0x5a64, 0x6206, 0x0c7f, 0x1078, 0x4982, 0x6010,
2407 0xa06d, 0x10c0, 0x59b6, 0x0d7f, 0x007c, 0x157e, 0x0c7e, 0x2061,
2408 0xa62d, 0x6000, 0x81ff, 0x0040, 0x5a78, 0xa205, 0x0078, 0x5a79,
2409 0xa204, 0x6002, 0x0c7f, 0x157f, 0x007c, 0x6800, 0xd08c, 0x00c0,
2410 0x5a89, 0x6808, 0xa005, 0x0040, 0x5a89, 0x8001, 0x680a, 0xa085,
2411 0x0001, 0x007c, 0x20a9, 0x0010, 0xa006, 0x8004, 0x8086, 0x818e,
2412 0x00c8, 0x5a93, 0xa200, 0x00f0, 0x5a8e, 0x8086, 0x818e, 0x007c,
2413 0x157e, 0x20a9, 0x0010, 0xa005, 0x0040, 0x5ab9, 0xa11a, 0x00c8,
2414 0x5ab9, 0x8213, 0x818d, 0x0048, 0x5aac, 0xa11a, 0x00c8, 0x5aad,
2415 0x00f0, 0x5aa1, 0x0078, 0x5ab1, 0xa11a, 0x2308, 0x8210, 0x00f0,
2416 0x5aa1, 0x007e, 0x3200, 0xa084, 0xf7ff, 0x2080, 0x007f, 0x157f,
2417 0x007c, 0x007e, 0x3200, 0xa085, 0x0800, 0x0078, 0x5ab5, 0x127e,
2418 0x2091, 0x2200, 0x2079, 0xa5ab, 0x127f, 0x0d7e, 0x2069, 0xa5ab,
2419 0x6803, 0x0005, 0x2069, 0x0004, 0x2d04, 0xa085, 0x8001, 0x206a,
2420 0x0d7f, 0x007c, 0x0c7e, 0x6027, 0x0001, 0x7804, 0xa084, 0x0007,
2421 0x0079, 0x5ada, 0x5ae4, 0x5b09, 0x5b64, 0x5aea, 0x5b09, 0x5ae4,
2422 0x5ae2, 0x5ae2, 0x1078, 0x1328, 0x1078, 0x595a, 0x1078, 0x6109,
2423 0x0c7f, 0x007c, 0x62c0, 0x82ff, 0x00c0, 0x5af0, 0x0c7f, 0x007c,
2424 0x2011, 0x4129, 0x1078, 0x58d4, 0x7828, 0xa092, 0x00c8, 0x00c8,
2425 0x5aff, 0x8000, 0x782a, 0x1078, 0x4168, 0x0078, 0x5aee, 0x1078,
2426 0x4129, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b, 0x0000, 0x0078,
2427 0x5aee, 0x1078, 0x595a, 0x3c00, 0x007e, 0x2011, 0x0209, 0x20e1,
2428 0x4000, 0x2214, 0x007f, 0x20e0, 0x82ff, 0x0040, 0x5b27, 0x62c0,
2429 0x82ff, 0x00c0, 0x5b27, 0x782b, 0x0000, 0x7824, 0xa065, 0x1040,
2430 0x1328, 0x2009, 0x0013, 0x1078, 0x756c, 0x0c7f, 0x007c, 0x3900,
2431 0xa082, 0xa6cd, 0x00c8, 0x5b2e, 0x1078, 0x728a, 0x0c7e, 0x7824,
2432 0xa065, 0x1040, 0x1328, 0x7804, 0xa086, 0x0004, 0x0040, 0x5ba9,
2433 0x7828, 0xa092, 0x2710, 0x00c8, 0x5b44, 0x8000, 0x782a, 0x0c7f,
2434 0x1078, 0x6c33, 0x0078, 0x5b25, 0x6104, 0xa186, 0x0003, 0x00c0,
2435 0x5b5b, 0x0e7e, 0x2071, 0xa300, 0x70d4, 0x0e7f, 0xd08c, 0x0040,
2436 0x5b5b, 0x0c7e, 0x0e7e, 0x2061, 0x0100, 0x2071, 0xa300, 0x1078,
2437 0x4171, 0x0e7f, 0x0c7f, 0x1078, 0xa241, 0x2009, 0x0014, 0x1078,
2438 0x756c, 0x0c7f, 0x0078, 0x5b25, 0x2001, 0xa5c7, 0x2003, 0x0000,
2439 0x62c0, 0x82ff, 0x00c0, 0x5b78, 0x782b, 0x0000, 0x7824, 0xa065,
2440 0x1040, 0x1328, 0x2009, 0x0013, 0x1078, 0x75c3, 0x0c7f, 0x007c,
2441 0x0c7e, 0x0d7e, 0x3900, 0xa082, 0xa6cd, 0x00c8, 0x5b81, 0x1078,
2442 0x728a, 0x7824, 0xa005, 0x1040, 0x1328, 0x781c, 0xa06d, 0x1040,
2443 0x1328, 0x6800, 0xc0dc, 0x6802, 0x7924, 0x2160, 0x1078, 0x753d,
2444 0x693c, 0x81ff, 0x1040, 0x1328, 0x8109, 0x693e, 0x6854, 0xa015,
2445 0x0040, 0x5b9d, 0x7a1e, 0x0078, 0x5b9f, 0x7918, 0x791e, 0x7807,
2446 0x0000, 0x7827, 0x0000, 0x0d7f, 0x0c7f, 0x1078, 0x6109, 0x0078,
2447 0x5b76, 0x6104, 0xa186, 0x0002, 0x0040, 0x5bb4, 0xa186, 0x0004,
2448 0x0040, 0x5bb4, 0x0078, 0x5b38, 0x7808, 0xac06, 0x0040, 0x5b38,
2449 0x1078, 0x6010, 0x1078, 0x5c45, 0x0c7f, 0x1078, 0x6109, 0x0078,
2450 0x5b25, 0x0c7e, 0x6027, 0x0002, 0x62c8, 0x82ff, 0x00c0, 0x5bdb,
2451 0x62c4, 0x82ff, 0x00c0, 0x5bdb, 0x793c, 0xa1e5, 0x0000, 0x0040,
2452 0x5bd5, 0x2009, 0x0049, 0x1078, 0x756c, 0x2011, 0xa5ca, 0x2013,
2453 0x0000, 0x0c7f, 0x007c, 0x3908, 0xa192, 0xa6cd, 0x00c8, 0x5be2,
2454 0x1078, 0x728a, 0x6017, 0x0010, 0x793c, 0x81ff, 0x0040, 0x5bd5,
2455 0x793c, 0xa188, 0x0007, 0x210c, 0xa18e, 0x0006, 0x00c0, 0x5bf4,
2456 0x6017, 0x0012, 0x0078, 0x5bd9, 0x6017, 0x0016, 0x0078, 0x5bd9,
2457 0x007e, 0x017e, 0x0c7e, 0x127e, 0x2091, 0x8000, 0x600f, 0x0000,
2458 0x2c08, 0x2061, 0xa5ab, 0x6020, 0x8000, 0x6022, 0x6010, 0xa005,
2459 0x0040, 0x5c13, 0xa080, 0x0003, 0x2102, 0x6112, 0x127f, 0x0c7f,
2460 0x017f, 0x007f, 0x007c, 0x6116, 0x6112, 0x0078, 0x5c0e, 0x0d7e,
2461 0x2069, 0xa5ab, 0x6000, 0xd0d4, 0x0040, 0x5c2c, 0x6820, 0x8000,
2462 0x6822, 0xa086, 0x0001, 0x00c0, 0x5c27, 0x2c00, 0x681e, 0x6804,
2463 0xa084, 0x0007, 0x0079, 0x6111, 0xc0d5, 0x6002, 0x6818, 0xa005,
2464 0x0040, 0x5c3e, 0x6056, 0x605b, 0x0000, 0x007e, 0x2c00, 0x681a,
2465 0x0d7f, 0x685a, 0x2069, 0xa5ab, 0x0078, 0x5c1e, 0x6056, 0x605a,
2466 0x2c00, 0x681a, 0x681e, 0x0078, 0x5c1e, 0x007e, 0x017e, 0x0c7e,
2467 0x127e, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08, 0x2061, 0xa5ab,
2468 0x6020, 0x8000, 0x6022, 0x6008, 0xa005, 0x0040, 0x5c60, 0xa080,
2469 0x0003, 0x2102, 0x610a, 0x127f, 0x0c7f, 0x017f, 0x007f, 0x007c,
2470 0x610e, 0x610a, 0x0078, 0x5c5b, 0x0c7e, 0x600f, 0x0000, 0x2c08,
2471 0x2061, 0xa5ab, 0x6034, 0xa005, 0x0040, 0x5c74, 0xa080, 0x0003,
2472 0x2102, 0x6136, 0x0c7f, 0x007c, 0x613a, 0x6136, 0x0078, 0x5c72,
2473 0x0f7e, 0x0e7e, 0x0d7e, 0x0c7e, 0x067e, 0x027e, 0x017e, 0x007e,
2474 0x127e, 0x2071, 0xa5ab, 0x7638, 0x2660, 0x2678, 0x2091, 0x8000,
2475 0x8cff, 0x0040, 0x5ced, 0x6018, 0xa080, 0x0028, 0x2004, 0xa206,
2476 0x00c0, 0x5ce8, 0x87ff, 0x0040, 0x5c99, 0x6020, 0xa106, 0x00c0,
2477 0x5ce8, 0x703c, 0xac06, 0x00c0, 0x5cab, 0x037e, 0x2019, 0x0001,
2478 0x1078, 0x6e6c, 0x7033, 0x0000, 0x703f, 0x0000, 0x7043, 0x0000,
2479 0x7047, 0x0000, 0x037f, 0x7038, 0xac36, 0x00c0, 0x5cb1, 0x660c,
2480 0x763a, 0x7034, 0xac36, 0x00c0, 0x5cbf, 0x2c00, 0xaf36, 0x0040,
2481 0x5cbd, 0x2f00, 0x7036, 0x0078, 0x5cbf, 0x7037, 0x0000, 0x660c,
2482 0x067e, 0x2c00, 0xaf06, 0x0040, 0x5cc8, 0x7e0e, 0x0078, 0x5cc9,
2483 0x2678, 0x600f, 0x0000, 0x1078, 0x8a44, 0x0040, 0x5ce3, 0x6010,
2484 0x2068, 0x601c, 0xa086, 0x0003, 0x00c0, 0x5cf7, 0x6837, 0x0103,
2485 0x6b4a, 0x6847, 0x0000, 0x1078, 0x8cb8, 0x1078, 0xa181, 0x1078,
2486 0x4982, 0x1078, 0x8bf4, 0x1078, 0x8c01, 0x0c7f, 0x0078, 0x5c88,
2487 0x2c78, 0x600c, 0x2060, 0x0078, 0x5c88, 0x127f, 0x007f, 0x017f,
2488 0x027f, 0x067f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f, 0x007c, 0x601c,
2489 0xa086, 0x0006, 0x00c0, 0x5cd6, 0x1078, 0xa181, 0x1078, 0x9e70,
2490 0x0078, 0x5ce3, 0x007e, 0x067e, 0x0c7e, 0x0d7e, 0x0f7e, 0x2031,
2491 0x0000, 0x127e, 0x2091, 0x8000, 0x2079, 0xa5ab, 0x7838, 0xa065,
2492 0x0040, 0x5d41, 0x600c, 0x007e, 0x600f, 0x0000, 0x783c, 0xac06,
2493 0x00c0, 0x5d28, 0x037e, 0x2019, 0x0001, 0x1078, 0x6e6c, 0x7833,
2494 0x0000, 0x783f, 0x0000, 0x7843, 0x0000, 0x7847, 0x0000, 0x037f,
2495 0x1078, 0x8a44, 0x0040, 0x5d3c, 0x6010, 0x2068, 0x601c, 0xa086,
2496 0x0003, 0x00c0, 0x5d4a, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000,
2497 0x1078, 0x4982, 0x1078, 0x8bf4, 0x1078, 0x8c01, 0x007f, 0x0078,
2498 0x5d0f, 0x7e3a, 0x7e36, 0x127f, 0x0f7f, 0x0d7f, 0x0c7f, 0x067f,
2499 0x007f, 0x007c, 0x601c, 0xa086, 0x0006, 0x00c0, 0x5d33, 0x1078,
2500 0x9e70, 0x0078, 0x5d3c, 0x017e, 0x027e, 0x087e, 0x2041, 0x0000,
2501 0x1078, 0x5d6d, 0x1078, 0x5e21, 0x087f, 0x027f, 0x017f, 0x007c,
2502 0x0f7e, 0x127e, 0x2079, 0xa5ab, 0x2091, 0x8000, 0x1078, 0x5ebc,
2503 0x1078, 0x5f32, 0x127f, 0x0f7f, 0x007c, 0x0f7e, 0x0e7e, 0x0d7e,
2504 0x0c7e, 0x067e, 0x017e, 0x007e, 0x127e, 0x2091, 0x8000, 0x2071,
2505 0xa5ab, 0x7614, 0x2660, 0x2678, 0x8cff, 0x0040, 0x5e01, 0x6018,
2506 0xa080, 0x0028, 0x2004, 0xa206, 0x00c0, 0x5dfc, 0x88ff, 0x0040,
2507 0x5d8d, 0x6020, 0xa106, 0x00c0, 0x5dfc, 0x7024, 0xac06, 0x00c0,
2508 0x5dbd, 0x2069, 0x0100, 0x68c0, 0xa005, 0x0040, 0x5db8, 0x1078,
2509 0x595a, 0x1078, 0x6c41, 0x68c3, 0x0000, 0x1078, 0x7188, 0x7027,
2510 0x0000, 0x037e, 0x2069, 0x0140, 0x6b04, 0xa384, 0x1000, 0x0040,
2511 0x5dad, 0x6803, 0x0100, 0x6803, 0x0000, 0x2069, 0x0100, 0x6824,
2512 0xd084, 0x0040, 0x5db5, 0x6827, 0x0001, 0x037f, 0x0078, 0x5dbd,
2513 0x6003, 0x0009, 0x630a, 0x0078, 0x5dfc, 0x7014, 0xac36, 0x00c0,
2514 0x5dc3, 0x660c, 0x7616, 0x7010, 0xac36, 0x00c0, 0x5dd1, 0x2c00,
2515 0xaf36, 0x0040, 0x5dcf, 0x2f00, 0x7012, 0x0078, 0x5dd1, 0x7013,
2516 0x0000, 0x660c, 0x067e, 0x2c00, 0xaf06, 0x0040, 0x5dda, 0x7e0e,
2517 0x0078, 0x5ddb, 0x2678, 0x600f, 0x0000, 0x6010, 0x2068, 0x1078,
2518 0x8a44, 0x0040, 0x5df5, 0x601c, 0xa086, 0x0003, 0x00c0, 0x5e0a,
2519 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x1078, 0x8cb8, 0x1078,
2520 0xa181, 0x1078, 0x4982, 0x1078, 0x8bf4, 0x1078, 0x8c01, 0x1078,
2521 0x7045, 0x0c7f, 0x0078, 0x5d7c, 0x2c78, 0x600c, 0x2060, 0x0078,
2522 0x5d7c, 0x127f, 0x007f, 0x017f, 0x067f, 0x0c7f, 0x0d7f, 0x0e7f,
2523 0x0f7f, 0x007c, 0x601c, 0xa086, 0x0006, 0x00c0, 0x5e15, 0x1078,
2524 0xa181, 0x1078, 0x9e70, 0x0078, 0x5df5, 0x601c, 0xa086, 0x0002,
2525 0x00c0, 0x5df5, 0x6004, 0xa086, 0x0085, 0x0040, 0x5de8, 0x0078,
2526 0x5df5, 0x0c7e, 0x007e, 0x127e, 0x2091, 0x8000, 0xa280, 0xa434,
2527 0x2004, 0xa065, 0x0040, 0x5eb8, 0x0f7e, 0x0e7e, 0x0d7e, 0x067e,
2528 0x2071, 0xa5ab, 0x6654, 0x7018, 0xac06, 0x00c0, 0x5e38, 0x761a,
2529 0x701c, 0xac06, 0x00c0, 0x5e44, 0x86ff, 0x00c0, 0x5e43, 0x7018,
2530 0x701e, 0x0078, 0x5e44, 0x761e, 0x6058, 0xa07d, 0x0040, 0x5e49,
2531 0x7e56, 0xa6ed, 0x0000, 0x0040, 0x5e4f, 0x2f00, 0x685a, 0x6057,
2532 0x0000, 0x605b, 0x0000, 0x6000, 0xc0d4, 0xc0dc, 0x6002, 0x1078,
2533 0x4410, 0x0040, 0x5eb4, 0x7624, 0x86ff, 0x0040, 0x5ea2, 0xa680,
2534 0x0004, 0x2004, 0xad06, 0x00c0, 0x5ea2, 0x0d7e, 0x2069, 0x0100,
2535 0x68c0, 0xa005, 0x0040, 0x5e99, 0x1078, 0x595a, 0x1078, 0x6c41,
2536 0x68c3, 0x0000, 0x1078, 0x7188, 0x7027, 0x0000, 0x037e, 0x2069,
2537 0x0140, 0x6b04, 0xa384, 0x1000, 0x0040, 0x5e82, 0x6803, 0x0100,
2538 0x6803, 0x0000, 0x2069, 0x0100, 0x6824, 0xd084, 0x0040, 0x5e8a,
2539 0x6827, 0x0001, 0x037f, 0x0d7f, 0x0c7e, 0x603c, 0xa005, 0x0040,
2540 0x5e93, 0x8001, 0x603e, 0x2660, 0x1078, 0x8c01, 0x0c7f, 0x0078,
2541 0x5ea2, 0x0d7f, 0x0c7e, 0x2660, 0x6003, 0x0009, 0x630a, 0x0c7f,
2542 0x0078, 0x5e57, 0x8dff, 0x0040, 0x5eb0, 0x6837, 0x0103, 0x6b4a,
2543 0x6847, 0x0000, 0x1078, 0x8cb8, 0x1078, 0xa181, 0x1078, 0x4982,
2544 0x1078, 0x7045, 0x0078, 0x5e57, 0x067f, 0x0d7f, 0x0e7f, 0x0f7f,
2545 0x127f, 0x007f, 0x0c7f, 0x007c, 0x007e, 0x067e, 0x0c7e, 0x0d7e,
2546 0x2031, 0x0000, 0x7814, 0xa065, 0x0040, 0x5f16, 0x600c, 0x007e,
2547 0x600f, 0x0000, 0x7824, 0xac06, 0x00c0, 0x5efb, 0x2069, 0x0100,
2548 0x68c0, 0xa005, 0x0040, 0x5ef5, 0x1078, 0x595a, 0x1078, 0x6c41,
2549 0x68c3, 0x0000, 0x1078, 0x7188, 0x7827, 0x0000, 0x037e, 0x2069,
2550 0x0140, 0x6b04, 0xa384, 0x1000, 0x0040, 0x5eea, 0x6803, 0x0100,
2551 0x6803, 0x0000, 0x2069, 0x0100, 0x6824, 0xd084, 0x0040, 0x5ef2,
2552 0x6827, 0x0001, 0x037f, 0x0078, 0x5efb, 0x6003, 0x0009, 0x630a,
2553 0x2c30, 0x0078, 0x5f13, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040,
2554 0x5f0f, 0x601c, 0xa086, 0x0003, 0x00c0, 0x5f1d, 0x6837, 0x0103,
2555 0x6b4a, 0x6847, 0x0000, 0x1078, 0x4982, 0x1078, 0x8bf4, 0x1078,
2556 0x8c01, 0x1078, 0x7045, 0x007f, 0x0078, 0x5ec3, 0x7e16, 0x7e12,
2557 0x0d7f, 0x0c7f, 0x067f, 0x007f, 0x007c, 0x601c, 0xa086, 0x0006,
2558 0x00c0, 0x5f26, 0x1078, 0x9e70, 0x0078, 0x5f0f, 0x601c, 0xa086,
2559 0x0002, 0x00c0, 0x5f0f, 0x6004, 0xa086, 0x0085, 0x0040, 0x5f06,
2560 0x0078, 0x5f0f, 0x007e, 0x067e, 0x0c7e, 0x0d7e, 0x7818, 0xa065,
2561 0x0040, 0x5fa0, 0x6054, 0x007e, 0x6057, 0x0000, 0x605b, 0x0000,
2562 0x6000, 0xc0d4, 0xc0dc, 0x6002, 0x1078, 0x4410, 0x0040, 0x5f9d,
2563 0x7e24, 0x86ff, 0x0040, 0x5f8f, 0xa680, 0x0004, 0x2004, 0xad06,
2564 0x00c0, 0x5f8f, 0x0d7e, 0x2069, 0x0100, 0x68c0, 0xa005, 0x0040,
2565 0x5f86, 0x1078, 0x595a, 0x1078, 0x6c41, 0x68c3, 0x0000, 0x1078,
2566 0x7188, 0x7827, 0x0000, 0x037e, 0x2069, 0x0140, 0x6b04, 0xa384,
2567 0x1000, 0x0040, 0x5f6f, 0x6803, 0x0100, 0x6803, 0x0000, 0x2069,
2568 0x0100, 0x6824, 0xd084, 0x0040, 0x5f77, 0x6827, 0x0001, 0x037f,
2569 0x0d7f, 0x0c7e, 0x603c, 0xa005, 0x0040, 0x5f80, 0x8001, 0x603e,
2570 0x2660, 0x1078, 0x8c01, 0x0c7f, 0x0078, 0x5f8f, 0x0d7f, 0x0c7e,
2571 0x2660, 0x6003, 0x0009, 0x630a, 0x0c7f, 0x0078, 0x5f44, 0x8dff,
2572 0x0040, 0x5f99, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x1078,
2573 0x4982, 0x1078, 0x7045, 0x0078, 0x5f44, 0x007f, 0x0078, 0x5f37,
2574 0x781e, 0x781a, 0x0d7f, 0x0c7f, 0x067f, 0x007f, 0x007c, 0x0e7e,
2575 0x0d7e, 0x067e, 0x6000, 0xd0dc, 0x0040, 0x5fc4, 0x604c, 0xa06d,
2576 0x0040, 0x5fc4, 0x6848, 0xa606, 0x00c0, 0x5fc4, 0x2071, 0xa5ab,
2577 0x7024, 0xa035, 0x0040, 0x5fc4, 0xa080, 0x0004, 0x2004, 0xad06,
2578 0x00c0, 0x5fc4, 0x1078, 0x5fc8, 0x067f, 0x0d7f, 0x0e7f, 0x007c,
2579 0x0f7e, 0x2079, 0x0100, 0x78c0, 0xa005, 0x00c0, 0x5fd7, 0x0c7e,
2580 0x2660, 0x6003, 0x0009, 0x630a, 0x0c7f, 0x0078, 0x600e, 0x1078,
2581 0x6c41, 0x78c3, 0x0000, 0x1078, 0x7188, 0x7027, 0x0000, 0x037e,
2582 0x2079, 0x0140, 0x7b04, 0xa384, 0x1000, 0x0040, 0x5feb, 0x7803,
2583 0x0100, 0x7803, 0x0000, 0x2079, 0x0100, 0x7824, 0xd084, 0x0040,
2584 0x5ff3, 0x7827, 0x0001, 0x1078, 0x7188, 0x037f, 0x1078, 0x4410,
2585 0x0c7e, 0x603c, 0xa005, 0x0040, 0x5fff, 0x8001, 0x603e, 0x2660,
2586 0x1078, 0x753d, 0x0c7f, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000,
2587 0x1078, 0x8cb8, 0x1078, 0x4982, 0x1078, 0x7045, 0x0f7f, 0x007c,
2588 0x0e7e, 0x0c7e, 0x2071, 0xa5ab, 0x7004, 0xa084, 0x0007, 0x0079,
2589 0x6019, 0x6023, 0x6026, 0x603f, 0x605b, 0x60a0, 0x6023, 0x6023,
2590 0x6021, 0x1078, 0x1328, 0x0c7f, 0x0e7f, 0x007c, 0x7024, 0xa065,
2591 0x0040, 0x6034, 0x7020, 0x8001, 0x7022, 0x600c, 0xa015, 0x0040,
2592 0x603b, 0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000,
2593 0x0c7f, 0x0e7f, 0x007c, 0x7216, 0x7212, 0x0078, 0x6034, 0x6018,
2594 0x2060, 0x1078, 0x4410, 0x6000, 0xc0dc, 0x6002, 0x7020, 0x8001,
2595 0x7022, 0x0040, 0x6050, 0x6054, 0xa015, 0x0040, 0x6057, 0x721e,
2596 0x7007, 0x0000, 0x7027, 0x0000, 0x0c7f, 0x0e7f, 0x007c, 0x7218,
2597 0x721e, 0x0078, 0x6050, 0x7024, 0xa065, 0x0040, 0x609d, 0x700c,
2598 0xac06, 0x00c0, 0x6072, 0x1078, 0x7045, 0x600c, 0xa015, 0x0040,
2599 0x606e, 0x720e, 0x600f, 0x0000, 0x0078, 0x609b, 0x720e, 0x720a,
2600 0x0078, 0x609b, 0x7014, 0xac06, 0x00c0, 0x6085, 0x1078, 0x7045,
2601 0x600c, 0xa015, 0x0040, 0x6081, 0x7216, 0x600f, 0x0000, 0x0078,
2602 0x609b, 0x7216, 0x7212, 0x0078, 0x609b, 0x6018, 0x2060, 0x1078,
2603 0x4410, 0x6000, 0xc0dc, 0x6002, 0x1078, 0x7045, 0x701c, 0xa065,
2604 0x0040, 0x609b, 0x6054, 0xa015, 0x0040, 0x6099, 0x721e, 0x0078,
2605 0x609b, 0x7218, 0x721e, 0x7027, 0x0000, 0x0c7f, 0x0e7f, 0x007c,
2606 0x7024, 0xa065, 0x0040, 0x60ad, 0x1078, 0x7045, 0x600c, 0xa015,
2607 0x0040, 0x60b4, 0x720e, 0x600f, 0x0000, 0x1078, 0x7188, 0x7027,
2608 0x0000, 0x0c7f, 0x0e7f, 0x007c, 0x720e, 0x720a, 0x0078, 0x60ad,
2609 0x0d7e, 0x2069, 0xa5ab, 0x6830, 0xa084, 0x0003, 0x0079, 0x60c0,
2610 0x60c6, 0x60c8, 0x60ee, 0x60c6, 0x1078, 0x1328, 0x0d7f, 0x007c,
2611 0x0c7e, 0x6840, 0xa086, 0x0001, 0x0040, 0x60e4, 0x683c, 0xa065,
2612 0x0040, 0x60d9, 0x600c, 0xa015, 0x0040, 0x60e0, 0x6a3a, 0x600f,
2613 0x0000, 0x6833, 0x0000, 0x683f, 0x0000, 0x0c7f, 0x0d7f, 0x007c,
2614 0x683a, 0x6836, 0x0078, 0x60d9, 0x6843, 0x0000, 0x6838, 0xa065,
2615 0x0040, 0x60d9, 0x6003, 0x0003, 0x0078, 0x60d9, 0x0c7e, 0x6843,
2616 0x0000, 0x6847, 0x0000, 0x683c, 0xa065, 0x0040, 0x6106, 0x600c,
2617 0xa015, 0x0040, 0x6102, 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000,
2618 0x0078, 0x6106, 0x683f, 0x0000, 0x683a, 0x6836, 0x0c7f, 0x0d7f,
2619 0x007c, 0x0d7e, 0x2069, 0xa5ab, 0x6804, 0xa084, 0x0007, 0x0079,
2620 0x6111, 0x611b, 0x61c2, 0x61c2, 0x61c2, 0x61c2, 0x61c4, 0x61c2,
2621 0x6119, 0x1078, 0x1328, 0x6820, 0xa005, 0x00c0, 0x6121, 0x0d7f,
2622 0x007c, 0x0c7e, 0x680c, 0xa065, 0x0040, 0x6130, 0x6807, 0x0004,
2623 0x6826, 0x682b, 0x0000, 0x1078, 0x620a, 0x0c7f, 0x0d7f, 0x007c,
2624 0x6814, 0xa065, 0x0040, 0x613e, 0x6807, 0x0001, 0x6826, 0x682b,
2625 0x0000, 0x1078, 0x620a, 0x0c7f, 0x0d7f, 0x007c, 0x0e7e, 0x037e,
2626 0x6a1c, 0xa2f5, 0x0000, 0x0040, 0x61bd, 0x704c, 0xa00d, 0x0040,
2627 0x614d, 0x7088, 0xa005, 0x0040, 0x6165, 0x7054, 0xa075, 0x0040,
2628 0x6156, 0xa20e, 0x0040, 0x61bd, 0x0078, 0x615b, 0x6818, 0xa20e,
2629 0x0040, 0x61bd, 0x2070, 0x704c, 0xa00d, 0x0040, 0x614d, 0x7088,
2630 0xa005, 0x00c0, 0x614d, 0x2e00, 0x681e, 0x733c, 0x7038, 0xa302,
2631 0x00c8, 0x614d, 0x1078, 0x750c, 0x0040, 0x61bd, 0x8318, 0x733e,
2632 0x6112, 0x2e10, 0x621a, 0xa180, 0x0014, 0x2004, 0xa084, 0x00ff,
2633 0x6032, 0xa180, 0x0014, 0x2003, 0x0000, 0xa180, 0x0015, 0x2004,
2634 0xa08a, 0x199a, 0x0048, 0x6186, 0x2001, 0x1999, 0x8003, 0x801b,
2635 0x831b, 0xa318, 0x6316, 0x037f, 0x0f7e, 0x2c78, 0x71a0, 0xd1bc,
2636 0x0040, 0x619f, 0x7100, 0xd1f4, 0x0040, 0x619b, 0x7114, 0xa18c,
2637 0x00ff, 0x0078, 0x61a4, 0x2009, 0x0000, 0x0078, 0x61a4, 0xa1e0,
2638 0x293f, 0x2c0c, 0xa18c, 0x00ff, 0x2061, 0x0100, 0x619a, 0x1078,
2639 0x679b, 0x7300, 0xc3dd, 0x7302, 0x6807, 0x0002, 0x2f18, 0x6b26,
2640 0x682b, 0x0000, 0x781f, 0x0003, 0x7803, 0x0001, 0x7807, 0x0040,
2641 0x0f7f, 0x0e7f, 0x0c7f, 0x0d7f, 0x007c, 0x037f, 0x0e7f, 0x0c7f,
2642 0x0078, 0x61bb, 0x0d7f, 0x007c, 0x0c7e, 0x680c, 0xa065, 0x0040,
2643 0x61d0, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000, 0x1078, 0x620a,
2644 0x0c7f, 0x0d7f, 0x007c, 0x0f7e, 0x0d7e, 0x2069, 0xa5ab, 0x6830,
2645 0xa086, 0x0000, 0x00c0, 0x61f1, 0x6838, 0xa07d, 0x0040, 0x61f1,
2646 0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x127e, 0x0f7e, 0x2091,
2647 0x2200, 0x027f, 0x1078, 0x1d28, 0x00c0, 0x61f4, 0x127f, 0x1078,
2648 0x6ae5, 0x0d7f, 0x0f7f, 0x007c, 0x127f, 0x6843, 0x0000, 0x7803,
2649 0x0002, 0x780c, 0xa015, 0x0040, 0x6206, 0x6a3a, 0x780f, 0x0000,
2650 0x6833, 0x0000, 0x683f, 0x0000, 0x0078, 0x61f1, 0x683a, 0x6836,
2651 0x0078, 0x6200, 0x601c, 0xa084, 0x000f, 0x1079, 0x6210, 0x007c,
2652 0x6219, 0x621e, 0x663f, 0x6758, 0x621e, 0x663f, 0x6758, 0x6219,
2653 0x621e, 0x1078, 0x6010, 0x1078, 0x6109, 0x007c, 0x157e, 0x137e,
2654 0x147e, 0x0c7e, 0x0f7e, 0x6004, 0xa08a, 0x0044, 0x10c8, 0x1328,
2655 0x6118, 0x2178, 0x79a0, 0xd1bc, 0x0040, 0x623b, 0x7900, 0xd1f4,
2656 0x0040, 0x6237, 0x7914, 0xa18c, 0x00ff, 0x0078, 0x6240, 0x2009,
2657 0x0000, 0x0078, 0x6240, 0xa1f8, 0x293f, 0x2f0c, 0xa18c, 0x00ff,
2658 0x2c78, 0x2061, 0x0100, 0x619a, 0xa08a, 0x0040, 0x00c8, 0x6292,
2659 0x1079, 0x6250, 0x0f7f, 0x0c7f, 0x147f, 0x137f, 0x157f, 0x007c,
2660 0x62f8, 0x6340, 0x6368, 0x6403, 0x6433, 0x643b, 0x6462, 0x6473,
2661 0x6484, 0x648c, 0x64a4, 0x648c, 0x650f, 0x6473, 0x6530, 0x6538,
2662 0x6484, 0x6538, 0x6549, 0x6290, 0x6290, 0x6290, 0x6290, 0x6290,
2663 0x6290, 0x6290, 0x6290, 0x6290, 0x6290, 0x6290, 0x6d05, 0x6d2a,
2664 0x6d3f, 0x6d62, 0x6d83, 0x6462, 0x6290, 0x6462, 0x648c, 0x6290,
2665 0x6368, 0x6403, 0x6290, 0x72ac, 0x648c, 0x6290, 0x72cc, 0x648c,
2666 0x6290, 0x6290, 0x62f3, 0x62a1, 0x6290, 0x72f1, 0x7368, 0x7450,
2667 0x6290, 0x7461, 0x645c, 0x747d, 0x6290, 0x6d98, 0x6290, 0x6290,
2668 0x1078, 0x1328, 0x2100, 0x1079, 0x629b, 0x0f7f, 0x0c7f, 0x147f,
2669 0x137f, 0x157f, 0x007c, 0x629f, 0x629f, 0x629f, 0x62d5, 0x1078,
2670 0x1328, 0x0d7e, 0x20a1, 0x020b, 0x1078, 0x6567, 0x7810, 0x2068,
2671 0x20a3, 0x2414, 0x20a3, 0x0018, 0x20a3, 0x0800, 0x683c, 0x20a2,
2672 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000,
2673 0x6850, 0x20a2, 0x6854, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000,
2674 0x60c3, 0x0018, 0x1078, 0x6c2d, 0x0d7f, 0x007c, 0x0d7e, 0x7818,
2675 0x2068, 0x68a0, 0xa082, 0x007e, 0x0048, 0x62d2, 0xa085, 0x0001,
2676 0x0d7f, 0x007c, 0xa006, 0x0078, 0x62d0, 0x0d7e, 0x20a1, 0x020b,
2677 0x1078, 0x6567, 0x20a3, 0x0500, 0x20a3, 0x0000, 0x7810, 0xa0e8,
2678 0x000f, 0x6808, 0x20a2, 0x680c, 0x20a2, 0x6810, 0x20a2, 0x6814,
2679 0x20a2, 0x6818, 0x20a2, 0x681c, 0x20a2, 0x60c3, 0x0010, 0x1078,
2680 0x6c2d, 0x0d7f, 0x007c, 0x6030, 0x609a, 0x1078, 0x6c2d, 0x007c,
2681 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3, 0x5200, 0x20a3, 0x0000,
2682 0x0d7e, 0x2069, 0xa351, 0x6804, 0xd084, 0x0040, 0x6312, 0x6828,
2683 0x20a3, 0x0000, 0x017e, 0x1078, 0x24fa, 0x21a2, 0x017f, 0x0d7f,
2684 0x0078, 0x6317, 0x0d7f, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a9,
2685 0x0004, 0x2099, 0xa305, 0x53a6, 0x20a9, 0x0004, 0x2099, 0xa301,
2686 0x53a6, 0x7818, 0xa080, 0x0028, 0x2004, 0xa082, 0x007f, 0x0048,
2687 0x6331, 0x2001, 0xa31a, 0x20a6, 0x2001, 0xa31b, 0x20a6, 0x0078,
2688 0x6337, 0x20a3, 0x0000, 0x6030, 0xa084, 0x00ff, 0x20a2, 0x20a3,
2689 0x0000, 0x20a3, 0x0000, 0x60c3, 0x001c, 0x1078, 0x6c2d, 0x007c,
2690 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3, 0x0500, 0x20a3, 0x0000,
2691 0x7818, 0xa080, 0x0028, 0x2004, 0xa082, 0x007f, 0x0048, 0x6358,
2692 0x2001, 0xa31a, 0x20a6, 0x2001, 0xa31b, 0x20a6, 0x0078, 0x635e,
2693 0x20a3, 0x0000, 0x6030, 0xa084, 0x00ff, 0x20a2, 0x20a9, 0x0004,
2694 0x2099, 0xa305, 0x53a6, 0x60c3, 0x0010, 0x1078, 0x6c2d, 0x007c,
2695 0x20a1, 0x020b, 0x1078, 0x6567, 0x0c7e, 0x7818, 0x2060, 0x2001,
2696 0x0000, 0x1078, 0x48a2, 0x0c7f, 0x7818, 0xa080, 0x0028, 0x2004,
2697 0xa086, 0x007e, 0x00c0, 0x6383, 0x20a3, 0x0400, 0x620c, 0xc2b4,
2698 0x620e, 0x0078, 0x6385, 0x20a3, 0x0300, 0x20a3, 0x0000, 0x7818,
2699 0xa080, 0x0028, 0x2004, 0xa086, 0x007e, 0x00c0, 0x63d2, 0x2099,
2700 0xa58c, 0x33a6, 0x9398, 0x33a6, 0x9398, 0x3304, 0xa084, 0x3fff,
2701 0x20a2, 0x9398, 0x33a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
2702 0x0000, 0x20a3, 0x0000, 0x20a9, 0x0004, 0x2099, 0xa305, 0x53a6,
2703 0x20a9, 0x0004, 0x2099, 0xa301, 0x53a6, 0x20a9, 0x0010, 0x20a3,
2704 0x0000, 0x00f0, 0x63af, 0x2099, 0xa594, 0x3304, 0xc0dd, 0x20a2,
2705 0x2001, 0xa371, 0x2004, 0xd0e4, 0x0040, 0x63ca, 0x20a3, 0x0000,
2706 0x20a3, 0x0000, 0x9398, 0x9398, 0x9398, 0x33a6, 0x20a9, 0x0004,
2707 0x0078, 0x63cc, 0x20a9, 0x0007, 0x20a3, 0x0000, 0x00f0, 0x63cc,
2708 0x0078, 0x63f2, 0x2099, 0xa58c, 0x20a9, 0x0008, 0x53a6, 0x20a9,
2709 0x0004, 0x2099, 0xa305, 0x53a6, 0x20a9, 0x0004, 0x2099, 0xa301,
2710 0x53a6, 0x20a9, 0x0008, 0x20a3, 0x0000, 0x00f0, 0x63e3, 0x20a9,
2711 0x0008, 0x20a3, 0x0000, 0x00f0, 0x63e9, 0x2099, 0xa594, 0x20a9,
2712 0x0008, 0x53a6, 0x20a9, 0x0008, 0x20a3, 0x0000, 0x00f0, 0x63f4,
2713 0x20a9, 0x000a, 0x20a3, 0x0000, 0x00f0, 0x63fa, 0x60c3, 0x0074,
2714 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3,
2715 0x2010, 0x20a3, 0x0014, 0x20a3, 0x0800, 0x20a3, 0x2000, 0xa006,
2716 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x0f7e, 0x2079, 0xa351,
2717 0x7904, 0x0f7f, 0xd1ac, 0x00c0, 0x641f, 0xa085, 0x0020, 0xd1a4,
2718 0x0040, 0x6424, 0xa085, 0x0010, 0xa085, 0x0002, 0x0d7e, 0x0078,
2719 0x64ed, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014,
2720 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3,
2721 0x5000, 0x0078, 0x6385, 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3,
2722 0x2110, 0x20a3, 0x0014, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
2723 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
2724 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3,
2725 0x0014, 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078, 0x65ef,
2726 0x0078, 0x6466, 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0200,
2727 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0004,
2728 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3,
2729 0x0100, 0x20a3, 0x0000, 0x20a3, 0x0003, 0x20a3, 0x2a00, 0x60c3,
2730 0x0008, 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078, 0x65f8,
2731 0x20a3, 0x0200, 0x0078, 0x6385, 0x20a1, 0x020b, 0x1078, 0x65f8,
2732 0x20a3, 0x0100, 0x20a3, 0x0000, 0x7828, 0xa005, 0x0040, 0x649b,
2733 0x20a2, 0x0078, 0x649d, 0x20a3, 0x0003, 0x7810, 0x20a2, 0x60c3,
2734 0x0008, 0x1078, 0x6c2d, 0x007c, 0x0d7e, 0x20a1, 0x020b, 0x1078,
2735 0x65f8, 0x20a3, 0x0210, 0x20a3, 0x0014, 0x20a3, 0x0800, 0x7818,
2736 0x2068, 0x6894, 0xa086, 0x0014, 0x00c0, 0x64ca, 0x6998, 0xa184,
2737 0xc000, 0x00c0, 0x64c6, 0xd1ec, 0x0040, 0x64c2, 0x20a3, 0x2100,
2738 0x0078, 0x64cc, 0x20a3, 0x0100, 0x0078, 0x64cc, 0x20a3, 0x0400,
2739 0x0078, 0x64cc, 0x20a3, 0x0700, 0xa006, 0x20a2, 0x20a2, 0x20a2,
2740 0x20a2, 0x20a2, 0x0f7e, 0x2079, 0xa351, 0x7904, 0x0f7f, 0xd1ac,
2741 0x00c0, 0x64dc, 0xa085, 0x0020, 0xd1a4, 0x0040, 0x64e1, 0xa085,
2742 0x0010, 0x2009, 0xa373, 0x210c, 0xd184, 0x0040, 0x64eb, 0x699c,
2743 0xd18c, 0x0040, 0x64ed, 0xa085, 0x0002, 0x027e, 0x2009, 0xa371,
2744 0x210c, 0xd1e4, 0x0040, 0x64fb, 0xc0c5, 0xa094, 0x0030, 0xa296,
2745 0x0010, 0x0040, 0x6505, 0xd1ec, 0x0040, 0x6505, 0xa094, 0x0030,
2746 0xa296, 0x0010, 0x0040, 0x6505, 0xc0bd, 0x027f, 0x20a2, 0x20a2,
2747 0x20a2, 0x60c3, 0x0014, 0x1078, 0x6c2d, 0x0d7f, 0x007c, 0x20a1,
2748 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0210, 0x20a3, 0x0014, 0x20a3,
2749 0x0000, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
2750 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
2751 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x1078, 0x6c2d, 0x007c,
2752 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0200, 0x0078, 0x62fe,
2753 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0100, 0x20a3, 0x0000,
2754 0x20a3, 0x0003, 0x20a3, 0x2a00, 0x60c3, 0x0008, 0x1078, 0x6c2d,
2755 0x007c, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x20a1, 0x020b, 0x1078,
2756 0x65f8, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0x000b, 0x20a3,
2757 0x0000, 0x60c3, 0x0008, 0x1078, 0x6c2d, 0x007c, 0x027e, 0x037e,
2758 0x047e, 0x2019, 0x3200, 0x2021, 0x0800, 0x0078, 0x656e, 0x027e,
2759 0x037e, 0x047e, 0x2019, 0x2200, 0x2021, 0x0100, 0x20e1, 0x9080,
2760 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2014, 0xa286, 0x007e,
2761 0x00c0, 0x6581, 0xa385, 0x00ff, 0x20a2, 0x20a3, 0xfffe, 0x0078,
2762 0x65b6, 0xa286, 0x007f, 0x00c0, 0x658d, 0x0d7e, 0xa385, 0x00ff,
2763 0x20a2, 0x20a3, 0xfffd, 0x0078, 0x65a4, 0xd2bc, 0x0040, 0x65ac,
2764 0xa286, 0x0080, 0x0d7e, 0x00c0, 0x659c, 0xa385, 0x00ff, 0x20a2,
2765 0x20a3, 0xfffc, 0x0078, 0x65a4, 0xa2e8, 0xa434, 0x2d6c, 0x6810,
2766 0xa305, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68,
2767 0x2da6, 0x0d7f, 0x0078, 0x65ba, 0x0d7e, 0xa2e8, 0xa434, 0x2d6c,
2768 0x6810, 0xa305, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000,
2769 0x6230, 0x22a2, 0xa485, 0x0029, 0x20a2, 0x047f, 0x037f, 0x20a3,
2770 0x0000, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000, 0x2fa2, 0x20a3,
2771 0xffff, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x027f, 0x007c, 0x027e,
2772 0x20e1, 0x9080, 0x20e1, 0x4000, 0x20a3, 0x02ff, 0x2011, 0xfffc,
2773 0x22a2, 0x0d7e, 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6, 0x0d7f,
2774 0x20a3, 0x2029, 0x20a3, 0x0000, 0x0078, 0x65c1, 0x20a3, 0x0100,
2775 0x20a3, 0x0000, 0x20a3, 0xfc02, 0x20a3, 0x0000, 0x007c, 0x027e,
2776 0x037e, 0x047e, 0x2019, 0x3300, 0x2021, 0x0800, 0x0078, 0x65ff,
2777 0x027e, 0x037e, 0x047e, 0x2019, 0x2300, 0x2021, 0x0100, 0x20e1,
2778 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2004, 0xa092,
2779 0x007e, 0x0048, 0x661c, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810,
2780 0xa305, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68,
2781 0x2da6, 0x0d7f, 0x0078, 0x662a, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c,
2782 0x6810, 0xa305, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000,
2783 0x6230, 0x22a2, 0xa485, 0x0098, 0x20a2, 0x20a3, 0x0000, 0x047f,
2784 0x037f, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000, 0x7a08, 0x22a2,
2785 0x2fa2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x027f, 0x007c, 0x0c7e,
2786 0x0f7e, 0x6004, 0xa08a, 0x0085, 0x1048, 0x1328, 0xa08a, 0x008c,
2787 0x10c8, 0x1328, 0x6118, 0x2178, 0x79a0, 0xd1bc, 0x0040, 0x665d,
2788 0x7900, 0xd1f4, 0x0040, 0x6659, 0x7914, 0xa18c, 0x00ff, 0x0078,
2789 0x6662, 0x2009, 0x0000, 0x0078, 0x6662, 0xa1f8, 0x293f, 0x2f0c,
2790 0xa18c, 0x00ff, 0x2c78, 0x2061, 0x0100, 0x619a, 0xa082, 0x0085,
2791 0x1079, 0x666d, 0x0f7f, 0x0c7f, 0x007c, 0x6676, 0x6681, 0x669c,
2792 0x6674, 0x6674, 0x6674, 0x6676, 0x1078, 0x1328, 0x147e, 0x20a1,
2793 0x020b, 0x1078, 0x66af, 0x60c3, 0x0000, 0x1078, 0x6c2d, 0x147f,
2794 0x007c, 0x147e, 0x20a1, 0x020b, 0x1078, 0x66e3, 0x20a3, 0x0000,
2795 0x20a3, 0x0000, 0x7808, 0x20a2, 0x7810, 0x20a2, 0x20a3, 0x0000,
2796 0x20a3, 0xffff, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x000c,
2797 0x1078, 0x6c2d, 0x147f, 0x007c, 0x147e, 0x20a1, 0x020b, 0x1078,
2798 0x6724, 0x20a3, 0x0003, 0x20a3, 0x0300, 0x20a3, 0x0000, 0x20a3,
2799 0x0000, 0x60c3, 0x0004, 0x1078, 0x6c2d, 0x147f, 0x007c, 0x027e,
2800 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2004,
2801 0xa092, 0x007e, 0x0048, 0x66ce, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c,
2802 0x6810, 0xa085, 0x8100, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a,
2803 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x66dd, 0x0d7e, 0xa0e8,
2804 0xa434, 0x2d6c, 0x6810, 0xa085, 0x8100, 0x20a2, 0x6814, 0x20a2,
2805 0x0d7f, 0x20a3, 0x0000, 0x6230, 0x22a2, 0x20a3, 0x0009, 0x20a3,
2806 0x0000, 0x0078, 0x65c1, 0x027e, 0x20e1, 0x9080, 0x20e1, 0x4000,
2807 0x7818, 0xa080, 0x0028, 0x2004, 0xa092, 0x007e, 0x0048, 0x6702,
2808 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x8400, 0x20a2,
2809 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6, 0x0d7f,
2810 0x0078, 0x6711, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085,
2811 0x8400, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000, 0x6230,
2812 0x22a2, 0x20a3, 0x0099, 0x20a3, 0x0000, 0x1078, 0x6c1c, 0x22a2,
2813 0x20a3, 0x0000, 0x7a08, 0x22a2, 0x7a10, 0x22a2, 0x20a3, 0x0000,
2814 0x20a3, 0x0000, 0x027f, 0x007c, 0x027e, 0x20e1, 0x9080, 0x20e1,
2815 0x4000, 0x7818, 0xa080, 0x0028, 0x2004, 0xa092, 0x007e, 0x0048,
2816 0x6743, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x8500,
2817 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6,
2818 0x0d7f, 0x0078, 0x6752, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810,
2819 0xa085, 0x8500, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000,
2820 0x6230, 0x22a2, 0x20a3, 0x0099, 0x20a3, 0x0000, 0x0078, 0x6715,
2821 0x0c7e, 0x0f7e, 0x2c78, 0x7804, 0xa08a, 0x0040, 0x1048, 0x1328,
2822 0xa08a, 0x0053, 0x10c8, 0x1328, 0x7918, 0x2160, 0x61a0, 0xd1bc,
2823 0x0040, 0x6777, 0x6100, 0xd1f4, 0x0040, 0x6773, 0x6114, 0xa18c,
2824 0x00ff, 0x0078, 0x677c, 0x2009, 0x0000, 0x0078, 0x677c, 0xa1e0,
2825 0x293f, 0x2c0c, 0xa18c, 0x00ff, 0x2061, 0x0100, 0x619a, 0xa082,
2826 0x0040, 0x1079, 0x6786, 0x0f7f, 0x0c7f, 0x007c, 0x679b, 0x68a9,
2827 0x684a, 0x6a59, 0x6799, 0x6799, 0x6799, 0x6799, 0x6799, 0x6799,
2828 0x6799, 0x6f5e, 0x6f6f, 0x6f80, 0x6f91, 0x6799, 0x748e, 0x6799,
2829 0x6f4d, 0x1078, 0x1328, 0x0d7e, 0x157e, 0x147e, 0x780b, 0xffff,
2830 0x20a1, 0x020b, 0x1078, 0x6806, 0x7910, 0x2168, 0x6948, 0x7922,
2831 0x21a2, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x694c, 0xa184, 0x000f,
2832 0x00c0, 0x67b6, 0x2001, 0x0005, 0x0078, 0x67c0, 0xd184, 0x0040,
2833 0x67bd, 0x2001, 0x0004, 0x0078, 0x67c0, 0xa084, 0x0006, 0x8004,
2834 0x017e, 0x2008, 0x7830, 0xa084, 0x00ff, 0x8007, 0xa105, 0x017f,
2835 0x20a2, 0xd1ac, 0x0040, 0x67d0, 0x20a3, 0x0002, 0x0078, 0x67dc,
2836 0xd1b4, 0x0040, 0x67d7, 0x20a3, 0x0001, 0x0078, 0x67dc, 0x20a3,
2837 0x0000, 0x2230, 0x0078, 0x67de, 0x6a80, 0x6e7c, 0x20a9, 0x0008,
2838 0xad80, 0x0017, 0x200c, 0x810f, 0x21a2, 0x8000, 0x00f0, 0x67e2,
2839 0x22a2, 0x26a2, 0x60c3, 0x0020, 0x20e1, 0x9080, 0x6014, 0xa084,
2840 0x0004, 0xa085, 0x0009, 0x6016, 0x2001, 0xa5c7, 0x2003, 0x07d0,
2841 0x2001, 0xa5c6, 0x2003, 0x0009, 0x2001, 0xa5cc, 0x2003, 0x0002,
2842 0x1078, 0x157e, 0x147f, 0x157f, 0x0d7f, 0x007c, 0x20e1, 0x9080,
2843 0x20e1, 0x4000, 0x7a18, 0xa280, 0x0023, 0x2014, 0x8210, 0xa294,
2844 0x00ff, 0x2202, 0x8217, 0x7818, 0xa080, 0x0028, 0x2004, 0xd0bc,
2845 0x0040, 0x682c, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085,
2846 0x0600, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68,
2847 0x2da6, 0x0d7f, 0x0078, 0x683b, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c,
2848 0x6810, 0xa085, 0x0600, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3,
2849 0x0000, 0x6130, 0x21a2, 0x20a3, 0x0829, 0x20a3, 0x0000, 0x22a2,
2850 0x20a3, 0x0000, 0x2fa2, 0x20a3, 0xffff, 0x20a3, 0x0000, 0x20a3,
2851 0x0000, 0x007c, 0x0d7e, 0x157e, 0x137e, 0x147e, 0x20a1, 0x020b,
2852 0x1078, 0x686a, 0x7810, 0x2068, 0x6860, 0x20a2, 0x685c, 0x20a2,
2853 0x6880, 0x20a2, 0x687c, 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2,
2854 0x20a2, 0x60c3, 0x000c, 0x1078, 0x6c2d, 0x147f, 0x137f, 0x157f,
2855 0x0d7f, 0x007c, 0x027e, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818,
2856 0xa080, 0x0028, 0x2004, 0xd0bc, 0x0040, 0x6888, 0x0d7e, 0xa0e8,
2857 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0500, 0x20a2, 0x6814, 0x20a2,
2858 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x6897,
2859 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0500, 0x20a2,
2860 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000, 0x6230, 0x22a2, 0x20a3,
2861 0x0889, 0x20a3, 0x0000, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000,
2862 0x7a08, 0x22a2, 0x2fa2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x027f,
2863 0x007c, 0x0d7e, 0x157e, 0x137e, 0x147e, 0x7810, 0xa06d, 0x1078,
2864 0x488f, 0x0040, 0x68bd, 0x684c, 0xa084, 0x2020, 0xa086, 0x2020,
2865 0x00c0, 0x68bd, 0x7824, 0xc0cd, 0x7826, 0x20a1, 0x020b, 0x1078,
2866 0x6a12, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x7810,
2867 0xa084, 0xf000, 0x00c0, 0x68d4, 0x7810, 0xa084, 0x0700, 0x8007,
2868 0x1079, 0x68dc, 0x0078, 0x68d7, 0xa006, 0x1079, 0x68dc, 0x147f,
2869 0x137f, 0x157f, 0x0d7f, 0x007c, 0x68e6, 0x697e, 0x6989, 0x69b3,
2870 0x69c7, 0x69e3, 0x69ee, 0x68e4, 0x1078, 0x1328, 0x017e, 0x037e,
2871 0x694c, 0xa18c, 0x0003, 0x0040, 0x68f1, 0xa186, 0x0003, 0x00c0,
2872 0x6900, 0x6b78, 0x7824, 0xd0cc, 0x0040, 0x68f7, 0xc3e5, 0x23a2,
2873 0x6868, 0x20a2, 0x6864, 0x20a2, 0x037f, 0x017f, 0x0078, 0x69be,
2874 0xa186, 0x0001, 0x10c0, 0x1328, 0x6b78, 0x7824, 0xd0cc, 0x0040,
2875 0x690a, 0xc3e5, 0x23a2, 0x6868, 0x20a2, 0x6864, 0x20a2, 0x22a2,
2876 0x6874, 0x20a2, 0x22a2, 0x687c, 0x20a2, 0x2009, 0x0018, 0xa384,
2877 0x0300, 0x0040, 0x6978, 0xd3c4, 0x0040, 0x6920, 0x687c, 0xa108,
2878 0xd3cc, 0x0040, 0x6925, 0x6874, 0xa108, 0x157e, 0x20a9, 0x000d,
2879 0xad80, 0x0020, 0x201c, 0x831f, 0x23a2, 0x8000, 0x00f0, 0x692a,
2880 0x157f, 0x22a2, 0x22a2, 0x22a2, 0xa184, 0x0003, 0x0040, 0x6978,
2881 0x20a1, 0x020b, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x007e, 0x7818,
2882 0xa080, 0x0028, 0x2004, 0xd0bc, 0x0040, 0x6958, 0x0d7e, 0xa0e8,
2883 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2, 0x6814, 0x20a2,
2884 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x6967,
2885 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2,
2886 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000, 0x6230, 0x22a2, 0x007f,
2887 0x7b24, 0xd3cc, 0x0040, 0x6970, 0x20a3, 0x0889, 0x0078, 0x6972,
2888 0x20a3, 0x0898, 0x20a2, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000,
2889 0x61c2, 0x037f, 0x017f, 0x1078, 0x6c2d, 0x007c, 0x2011, 0x0008,
2890 0x7824, 0xd0cc, 0x0040, 0x6985, 0xc2e5, 0x22a2, 0xa016, 0x0078,
2891 0x69bc, 0x2011, 0x0302, 0x7824, 0xd0cc, 0x0040, 0x6990, 0xc2e5,
2892 0x22a2, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x20a3, 0x0012, 0x22a2,
2893 0x20a3, 0x0008, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x20a3, 0x7000,
2894 0x20a3, 0x0500, 0x22a2, 0x20a3, 0x000a, 0x22a2, 0x22a2, 0x20a3,
2895 0x2500, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x60c3, 0x0032,
2896 0x1078, 0x6c2d, 0x007c, 0x2011, 0x0028, 0x7824, 0xd0cc, 0x0040,
2897 0x69ba, 0xc2e5, 0x22a2, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x22a2,
2898 0x22a2, 0x22a2, 0x60c3, 0x0018, 0x1078, 0x6c2d, 0x007c, 0x2011,
2899 0x0100, 0x7824, 0xd0cc, 0x0040, 0x69ce, 0xc2e5, 0x22a2, 0xa016,
2900 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x20a3, 0x0008, 0x22a2,
2901 0x7834, 0xa084, 0x00ff, 0x20a2, 0x22a2, 0x22a2, 0x60c3, 0x0020,
2902 0x1078, 0x6c2d, 0x007c, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0040,
2903 0x69ea, 0xc2e5, 0x22a2, 0xa016, 0x0078, 0x69bc, 0x037e, 0x7b10,
2904 0xa384, 0xff00, 0x7812, 0xa384, 0x00ff, 0x8001, 0x00c0, 0x6a01,
2905 0x7824, 0xd0cc, 0x0040, 0x69fd, 0xc2e5, 0x22a2, 0x037f, 0x0078,
2906 0x69bc, 0x047e, 0x2021, 0x0800, 0x007e, 0x7824, 0xd0cc, 0x007f,
2907 0x0040, 0x6a0b, 0xc4e5, 0x24a2, 0x047f, 0x22a2, 0x20a2, 0x037f,
2908 0x0078, 0x69be, 0x027e, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818,
2909 0xa080, 0x0028, 0x2004, 0xd0bc, 0x0040, 0x6a30, 0x0d7e, 0xa0e8,
2910 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2, 0x6814, 0x20a2,
2911 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x6a3f,
2912 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2,
2913 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000, 0x6230, 0x22a2, 0x7824,
2914 0xd0cc, 0x0040, 0x6a47, 0x20a3, 0x0889, 0x0078, 0x6a49, 0x20a3,
2915 0x0898, 0x20a3, 0x0000, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000,
2916 0x7a08, 0x22a2, 0x2fa2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x027f,
2917 0x007c, 0x0d7e, 0x157e, 0x137e, 0x147e, 0x017e, 0x037e, 0x7810,
2918 0xa084, 0x0700, 0x8007, 0x1079, 0x6a6c, 0x037f, 0x017f, 0x147f,
2919 0x137f, 0x157f, 0x0d7f, 0x007c, 0x6a74, 0x6a74, 0x6a76, 0x6a74,
2920 0x6a74, 0x6a74, 0x6a9b, 0x6a74, 0x1078, 0x1328, 0x7910, 0xa18c,
2921 0xf8ff, 0xa18d, 0x0600, 0x7912, 0x20a1, 0x020b, 0x2009, 0x0003,
2922 0x1078, 0x6aa5, 0x0d7e, 0x2069, 0xa351, 0x6804, 0xd0bc, 0x0040,
2923 0x6a90, 0x682c, 0xa084, 0x00ff, 0x8007, 0x20a2, 0x0078, 0x6a92,
2924 0x20a3, 0x3f00, 0x0d7f, 0x22a2, 0x22a2, 0x22a2, 0x60c3, 0x0001,
2925 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x2009, 0x0003, 0x1078,
2926 0x6aa5, 0x20a3, 0x7f00, 0x0078, 0x6a93, 0x027e, 0x20e1, 0x9080,
2927 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2004, 0xd0bc, 0x0040,
2928 0x6ac3, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810, 0xa085, 0x0100,
2929 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a, 0x2da6, 0x8d68, 0x2da6,
2930 0x0d7f, 0x0078, 0x6ad2, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c, 0x6810,
2931 0xa085, 0x0100, 0x20a2, 0x6814, 0x20a2, 0x0d7f, 0x20a3, 0x0000,
2932 0x6230, 0x22a2, 0x20a3, 0x0888, 0xa18d, 0x0008, 0x21a2, 0x1078,
2933 0x6c1c, 0x22a2, 0x20a3, 0x0000, 0x7a08, 0x22a2, 0x2fa2, 0x20a3,
2934 0x0000, 0x20a3, 0x0000, 0x027f, 0x007c, 0x0e7e, 0x0d7e, 0x0c7e,
2935 0x057e, 0x047e, 0x037e, 0x2061, 0x0100, 0x2071, 0xa300, 0x6130,
2936 0x7818, 0x2068, 0x68a0, 0x2028, 0xd0bc, 0x00c0, 0x6afc, 0x6910,
2937 0x6a14, 0x6430, 0x0078, 0x6b00, 0x6910, 0x6a14, 0x7368, 0x746c,
2938 0x781c, 0xa086, 0x0006, 0x0040, 0x6b5f, 0xd5bc, 0x0040, 0x6b10,
2939 0xa185, 0x0100, 0x6062, 0x6266, 0x636a, 0x646e, 0x0078, 0x6b17,
2940 0xa185, 0x0100, 0x6062, 0x6266, 0x606b, 0x0000, 0x646e, 0x6073,
2941 0x0809, 0x6077, 0x0008, 0x688c, 0x8000, 0xa084, 0x00ff, 0x688e,
2942 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086,
2943 0x7810, 0x2070, 0x7014, 0x608a, 0x7010, 0x608e, 0x700c, 0x60c6,
2944 0x7008, 0x60ca, 0x686c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5,
2945 0x60d7, 0x0000, 0xa582, 0x0080, 0x0048, 0x6b49, 0x6a00, 0xd2f4,
2946 0x0040, 0x6b47, 0x6a14, 0xa294, 0x00ff, 0x0078, 0x6b49, 0x2011,
2947 0x0000, 0x629e, 0x6017, 0x0016, 0x2009, 0x07d0, 0x60c4, 0xa084,
2948 0xfff0, 0xa005, 0x0040, 0x6b56, 0x2009, 0x1b58, 0x1078, 0x595f,
2949 0x037f, 0x047f, 0x057f, 0x0c7f, 0x0d7f, 0x0e7f, 0x007c, 0x7810,
2950 0x2070, 0x704c, 0xa084, 0x0003, 0xa086, 0x0002, 0x0040, 0x6bb7,
2951 0xd5bc, 0x0040, 0x6b73, 0xa185, 0x0100, 0x6062, 0x6266, 0x636a,
2952 0x646e, 0x0078, 0x6b7a, 0xa185, 0x0100, 0x6062, 0x6266, 0x606b,
2953 0x0000, 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0x688c, 0x8000,
2954 0xa084, 0x00ff, 0x688e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00,
2955 0x6086, 0x7808, 0x6082, 0x7060, 0x608a, 0x705c, 0x608e, 0x7080,
2956 0x60c6, 0x707c, 0x60ca, 0x707c, 0x792c, 0xa108, 0x792e, 0x7080,
2957 0x7928, 0xa109, 0x792a, 0x686c, 0x60ce, 0x60ab, 0x0036, 0x60af,
2958 0x95d5, 0x60d7, 0x0000, 0xa582, 0x0080, 0x0048, 0x6bb2, 0x6a00,
2959 0xd2f4, 0x0040, 0x6bb0, 0x6a14, 0xa294, 0x00ff, 0x0078, 0x6bb2,
2960 0x2011, 0x0000, 0x629e, 0x6017, 0x0012, 0x0078, 0x6b4c, 0xd5bc,
2961 0x0040, 0x6bc2, 0xa185, 0x0700, 0x6062, 0x6266, 0x636a, 0x646e,
2962 0x0078, 0x6bc9, 0xa185, 0x0700, 0x6062, 0x6266, 0x606b, 0x0000,
2963 0x646e, 0x1078, 0x488f, 0x0040, 0x6bdf, 0x0d7e, 0x7810, 0xa06d,
2964 0x684c, 0x0d7f, 0xa084, 0x2020, 0xa086, 0x2020, 0x00c0, 0x6bdf,
2965 0x7824, 0xc0cd, 0x7826, 0x6073, 0x0889, 0x0078, 0x6be1, 0x6073,
2966 0x0898, 0x6077, 0x0000, 0x688c, 0x8000, 0xa084, 0x00ff, 0x688e,
2967 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086, 0x7808, 0x6082,
2968 0x7014, 0x608a, 0x7010, 0x608e, 0x700c, 0x60c6, 0x7008, 0x60ca,
2969 0x686c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000,
2970 0xa582, 0x0080, 0x0048, 0x6c0f, 0x6a00, 0xd2f4, 0x0040, 0x6c0d,
2971 0x6a14, 0xa294, 0x00ff, 0x0078, 0x6c0f, 0x2011, 0x0000, 0x629e,
2972 0x7824, 0xd0cc, 0x0040, 0x6c18, 0x6017, 0x0016, 0x0078, 0x6b4c,
2973 0x6017, 0x0012, 0x0078, 0x6b4c, 0x7a18, 0xa280, 0x0023, 0x2014,
2974 0x8210, 0xa294, 0x00ff, 0x2202, 0x8217, 0x007c, 0x0d7e, 0x2069,
2975 0xa5ab, 0x6843, 0x0001, 0x0d7f, 0x007c, 0x20e1, 0x9080, 0x60a3,
2976 0x0056, 0x60a7, 0x9575, 0x1078, 0x6c38, 0x1078, 0x594f, 0x007c,
2977 0x007e, 0x6014, 0xa084, 0x0004, 0xa085, 0x0009, 0x6016, 0x007f,
2978 0x007c, 0x007e, 0x0c7e, 0x2061, 0x0100, 0x6014, 0xa084, 0x0004,
2979 0xa085, 0x0008, 0x6016, 0x0c7f, 0x007f, 0x007c, 0x0c7e, 0x0d7e,
2980 0x017e, 0x027e, 0x2061, 0x0100, 0x2069, 0x0140, 0x6904, 0xa194,
2981 0x4000, 0x0040, 0x6c89, 0x1078, 0x6c41, 0x6803, 0x1000, 0x6803,
2982 0x0000, 0x0c7e, 0x2061, 0xa5ab, 0x6128, 0xa192, 0x00c8, 0x00c8,
2983 0x6c76, 0x8108, 0x612a, 0x6124, 0x0c7f, 0x81ff, 0x0040, 0x6c84,
2984 0x1078, 0x594f, 0x1078, 0x6c38, 0x0078, 0x6c84, 0x6124, 0xa1e5,
2985 0x0000, 0x0040, 0x6c81, 0x1078, 0xa241, 0x2009, 0x0014, 0x1078,
2986 0x756c, 0x0c7f, 0x0078, 0x6c84, 0x027f, 0x017f, 0x0d7f, 0x0c7f,
2987 0x007c, 0x2001, 0xa5c7, 0x2004, 0xa005, 0x00c0, 0x6c84, 0x0c7e,
2988 0x2061, 0xa5ab, 0x6128, 0xa192, 0x0003, 0x00c8, 0x6c76, 0x8108,
2989 0x612a, 0x0c7f, 0x1078, 0x594f, 0x1078, 0x4171, 0x0078, 0x6c84,
2990 0x0c7e, 0x0d7e, 0x0e7e, 0x017e, 0x027e, 0x1078, 0x5967, 0x2071,
2991 0xa5ab, 0x713c, 0x81ff, 0x0040, 0x6cca, 0x2061, 0x0100, 0x2069,
2992 0x0140, 0x6904, 0xa194, 0x4000, 0x0040, 0x6cd0, 0x6803, 0x1000,
2993 0x6803, 0x0000, 0x037e, 0x2019, 0x0001, 0x1078, 0x6e6c, 0x037f,
2994 0x713c, 0x2160, 0x1078, 0xa241, 0x2009, 0x004a, 0x1078, 0x756c,
2995 0x0078, 0x6cca, 0x027f, 0x017f, 0x0e7f, 0x0d7f, 0x0c7f, 0x007c,
2996 0x0078, 0x6cba, 0x0e7e, 0x0d7e, 0x0c7e, 0x067e, 0x057e, 0x047e,
2997 0x007e, 0x127e, 0x2091, 0x8000, 0x6018, 0x2068, 0x6ca0, 0x2071,
2998 0xa5ab, 0x7018, 0x2068, 0x8dff, 0x0040, 0x6cfc, 0x68a0, 0xa406,
2999 0x0040, 0x6cee, 0x6854, 0x2068, 0x0078, 0x6ce3, 0x6010, 0x2060,
3000 0x643c, 0x6540, 0x6e48, 0x2d60, 0x1078, 0x466a, 0x0040, 0x6cfc,
3001 0x1078, 0x7045, 0xa085, 0x0001, 0x127f, 0x007f, 0x047f, 0x057f,
3002 0x067f, 0x0c7f, 0x0d7f, 0x0e7f, 0x007c, 0x20a1, 0x020b, 0x1078,
3003 0x6567, 0x20a3, 0x1200, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x781c,
3004 0xa086, 0x0004, 0x00c0, 0x6d17, 0x6098, 0x0078, 0x6d18, 0x6030,
3005 0x20a2, 0x7834, 0x20a2, 0x7838, 0x20a2, 0x20a9, 0x0010, 0xa006,
3006 0x20a2, 0x00f0, 0x6d20, 0x20a2, 0x20a2, 0x60c3, 0x002c, 0x1078,
3007 0x6c2d, 0x007c, 0x157e, 0x147e, 0x20a1, 0x020b, 0x1078, 0x6567,
3008 0x20a3, 0x0f00, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x7808, 0x20a2,
3009 0x60c3, 0x0008, 0x1078, 0x6c2d, 0x147f, 0x157f, 0x007c, 0x157e,
3010 0x147e, 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0200, 0x20a3,
3011 0x0000, 0x20a9, 0x0006, 0x2011, 0xa340, 0x2019, 0xa341, 0x23a6,
3012 0x22a6, 0xa398, 0x0002, 0xa290, 0x0002, 0x00f0, 0x6d4f, 0x20a3,
3013 0x0000, 0x20a3, 0x0000, 0x60c3, 0x001c, 0x1078, 0x6c2d, 0x147f,
3014 0x157f, 0x007c, 0x157e, 0x147e, 0x017e, 0x027e, 0x20a1, 0x020b,
3015 0x1078, 0x65cf, 0x1078, 0x65e6, 0x7810, 0xa080, 0x0000, 0x2004,
3016 0xa080, 0x0015, 0x2098, 0x7808, 0xa088, 0x0002, 0x21a8, 0x53a6,
3017 0xa080, 0x0004, 0x8003, 0x60c2, 0x1078, 0x6c2d, 0x027f, 0x017f,
3018 0x147f, 0x157f, 0x007c, 0x157e, 0x147e, 0x20a1, 0x020b, 0x1078,
3019 0x6567, 0x20a3, 0x6200, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x7808,
3020 0x20a2, 0x60c3, 0x0008, 0x1078, 0x6c2d, 0x147f, 0x157f, 0x007c,
3021 0x157e, 0x147e, 0x017e, 0x027e, 0x20a1, 0x020b, 0x1078, 0x6567,
3022 0x7810, 0xa080, 0x0000, 0x2004, 0xa080, 0x0017, 0x2098, 0x7808,
3023 0xa088, 0x0002, 0x21a8, 0x53a6, 0x8003, 0x60c2, 0x1078, 0x6c2d,
3024 0x027f, 0x017f, 0x147f, 0x157f, 0x007c, 0x0e7e, 0x0c7e, 0x007e,
3025 0x127e, 0x2091, 0x8000, 0x2071, 0xa5ab, 0x700c, 0x2060, 0x8cff,
3026 0x0040, 0x6dd1, 0x1078, 0x8c3b, 0x00c0, 0x6dc8, 0x1078, 0x7a05,
3027 0x600c, 0x007e, 0x1078, 0x753d, 0x1078, 0x7045, 0x0c7f, 0x0078,
3028 0x6dbf, 0x700f, 0x0000, 0x700b, 0x0000, 0x127f, 0x007f, 0x0c7f,
3029 0x0e7f, 0x007c, 0x127e, 0x157e, 0x0f7e, 0x0e7e, 0x0d7e, 0x0c7e,
3030 0x027e, 0x017e, 0x007e, 0x2091, 0x8000, 0x2069, 0x0100, 0x2079,
3031 0x0140, 0x2071, 0xa5ab, 0x7024, 0x2060, 0x8cff, 0x0040, 0x6e2a,
3032 0x1078, 0x6c41, 0x68c3, 0x0000, 0x1078, 0x595a, 0x2009, 0x0013,
3033 0x1078, 0x756c, 0x20a9, 0x01f4, 0x6824, 0xd094, 0x0040, 0x6e0d,
3034 0x6827, 0x0004, 0x7804, 0xa084, 0x4000, 0x0040, 0x6e1f, 0x7803,
3035 0x1000, 0x7803, 0x0000, 0x0078, 0x6e1f, 0xd084, 0x0040, 0x6e14,
3036 0x6827, 0x0001, 0x0078, 0x6e16, 0x00f0, 0x6dfc, 0x7804, 0xa084,
3037 0x1000, 0x0040, 0x6e1f, 0x7803, 0x0100, 0x7803, 0x0000, 0x6824,
3038 0x007f, 0x017f, 0x027f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f, 0x157f,
3039 0x127f, 0x007c, 0x2001, 0xa300, 0x2004, 0xa096, 0x0001, 0x0040,
3040 0x6e62, 0xa096, 0x0004, 0x0040, 0x6e62, 0x6817, 0x0008, 0x68c3,
3041 0x0000, 0x2011, 0x4129, 0x1078, 0x58d4, 0x20a9, 0x01f4, 0x6824,
3042 0xd094, 0x0040, 0x6e50, 0x6827, 0x0004, 0x7804, 0xa084, 0x4000,
3043 0x0040, 0x6e62, 0x7803, 0x1000, 0x7803, 0x0000, 0x0078, 0x6e62,
3044 0xd084, 0x0040, 0x6e57, 0x6827, 0x0001, 0x0078, 0x6e59, 0x00f0,
3045 0x6e3f, 0x7804, 0xa084, 0x1000, 0x0040, 0x6e62, 0x7803, 0x0100,
3046 0x7803, 0x0000, 0x007f, 0x017f, 0x027f, 0x0c7f, 0x0d7f, 0x0e7f,
3047 0x0f7f, 0x157f, 0x127f, 0x007c, 0x127e, 0x157e, 0x0f7e, 0x0e7e,
3048 0x0d7e, 0x0c7e, 0x027e, 0x017e, 0x007e, 0x2091, 0x8000, 0x2069,
3049 0x0100, 0x2079, 0x0140, 0x2071, 0xa5ab, 0x703c, 0x2060, 0x8cff,
3050 0x0040, 0x6ee8, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x00c0,
3051 0x6e86, 0x68c7, 0x0000, 0x68cb, 0x0008, 0x1078, 0x5967, 0x1078,
3052 0x1f31, 0x047e, 0x057e, 0x2009, 0x017f, 0x212c, 0x200b, 0x00a5,
3053 0x2021, 0x0169, 0x2404, 0xa084, 0x000f, 0xa086, 0x0004, 0x00c0,
3054 0x6eb7, 0x68c7, 0x0000, 0x68cb, 0x0008, 0x0e7e, 0x0f7e, 0x2079,
3055 0x0020, 0x2071, 0xa602, 0x6814, 0xa084, 0x0004, 0xa085, 0x0012,
3056 0x6816, 0x7803, 0x0008, 0x7003, 0x0000, 0x0f7f, 0x0e7f, 0x250a,
3057 0x057f, 0x047f, 0xa39d, 0x0000, 0x00c0, 0x6ec2, 0x2009, 0x0049,
3058 0x1078, 0x756c, 0x20a9, 0x03e8, 0x6824, 0xd094, 0x0040, 0x6ed5,
3059 0x6827, 0x0004, 0x7804, 0xa084, 0x4000, 0x0040, 0x6ee7, 0x7803,
3060 0x1000, 0x7803, 0x0000, 0x0078, 0x6ee7, 0xd08c, 0x0040, 0x6edc,
3061 0x6827, 0x0002, 0x0078, 0x6ede, 0x00f0, 0x6ec4, 0x7804, 0xa084,
3062 0x1000, 0x0040, 0x6ee7, 0x7803, 0x0100, 0x7803, 0x0000, 0x6824,
3063 0x007f, 0x017f, 0x027f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f, 0x157f,
3064 0x127f, 0x007c, 0x0d7e, 0x127e, 0x2091, 0x8000, 0x2069, 0xa5ab,
3065 0x6a06, 0x127f, 0x0d7f, 0x007c, 0x0d7e, 0x127e, 0x2091, 0x8000,
3066 0x2069, 0xa5ab, 0x6a32, 0x127f, 0x0d7f, 0x007c, 0x0f7e, 0x0e7e,
3067 0x0c7e, 0x067e, 0x007e, 0x127e, 0x2071, 0xa5ab, 0x7614, 0x2660,
3068 0x2678, 0x2091, 0x8000, 0x8cff, 0x0040, 0x6f46, 0x601c, 0xa206,
3069 0x00c0, 0x6f41, 0x7014, 0xac36, 0x00c0, 0x6f20, 0x660c, 0x7616,
3070 0x7010, 0xac36, 0x00c0, 0x6f2e, 0x2c00, 0xaf36, 0x0040, 0x6f2c,
3071 0x2f00, 0x7012, 0x0078, 0x6f2e, 0x7013, 0x0000, 0x660c, 0x067e,
3072 0x2c00, 0xaf06, 0x0040, 0x6f37, 0x7e0e, 0x0078, 0x6f38, 0x2678,
3073 0x600f, 0x0000, 0x1078, 0x8c01, 0x1078, 0x7045, 0x0c7f, 0x0078,
3074 0x6f13, 0x2c78, 0x600c, 0x2060, 0x0078, 0x6f13, 0x127f, 0x007f,
3075 0x067f, 0x0c7f, 0x0e7f, 0x0f7f, 0x007c, 0x157e, 0x147e, 0x20a1,
3076 0x020b, 0x1078, 0x6806, 0x7810, 0x20a2, 0xa006, 0x20a2, 0x20a2,
3077 0x20a2, 0x20a2, 0x20a3, 0x1000, 0x0078, 0x6fa0, 0x157e, 0x147e,
3078 0x20a1, 0x020b, 0x1078, 0x6806, 0x7810, 0x20a2, 0xa006, 0x20a2,
3079 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x4000, 0x0078, 0x6fa0, 0x157e,
3080 0x147e, 0x20a1, 0x020b, 0x1078, 0x6806, 0x7810, 0x20a2, 0xa006,
3081 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x2000, 0x0078, 0x6fa0,
3082 0x157e, 0x147e, 0x20a1, 0x020b, 0x1078, 0x6806, 0x7810, 0x20a2,
3083 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x0400, 0x0078,
3084 0x6fa0, 0x157e, 0x147e, 0x20a1, 0x020b, 0x1078, 0x6806, 0x7810,
3085 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x0200,
3086 0x1078, 0x7050, 0x60c3, 0x0020, 0x1078, 0x6c2d, 0x147f, 0x157f,
3087 0x007c, 0x127e, 0x0c7e, 0x2091, 0x8000, 0x2061, 0x0100, 0x6120,
3088 0xd1b4, 0x00c0, 0x6fb8, 0xd1bc, 0x00c0, 0x7002, 0x0078, 0x7042,
3089 0x2009, 0x017f, 0x200b, 0x00a1, 0x157e, 0x007e, 0x0d7e, 0x2069,
3090 0x0140, 0x20a9, 0x001e, 0x2009, 0x0169, 0x6804, 0xa084, 0x4000,
3091 0x0040, 0x6ff9, 0x6020, 0xd0b4, 0x0040, 0x6ff9, 0x6024, 0xd094,
3092 0x00c0, 0x6ff9, 0x2104, 0xa084, 0x000f, 0xa086, 0x0004, 0x00c0,
3093 0x6ff9, 0x00f0, 0x6fc5, 0x027e, 0x6198, 0xa18c, 0x00ff, 0x8107,
3094 0x6130, 0xa18c, 0x00ff, 0xa10d, 0x6088, 0x628c, 0x618e, 0x608b,
3095 0xbc91, 0x6043, 0x0001, 0x6043, 0x0000, 0x608a, 0x628e, 0x6024,
3096 0xd094, 0x00c0, 0x6ff8, 0x6a04, 0xa294, 0x4000, 0x00c0, 0x6fef,
3097 0x027f, 0x0d7f, 0x007f, 0x157f, 0x2009, 0x017f, 0x200b, 0x0000,
3098 0x0078, 0x7042, 0x2009, 0x017f, 0x200b, 0x00a1, 0x157e, 0x007e,
3099 0x0d7e, 0x2069, 0x0140, 0x20a9, 0x001e, 0x2009, 0x0169, 0x6804,
3100 0xa084, 0x4000, 0x0040, 0x703b, 0x6020, 0xd0bc, 0x0040, 0x703b,
3101 0x2104, 0xa084, 0x000f, 0xa086, 0x0004, 0x00c0, 0x703b, 0x00f0,
3102 0x700f, 0x027e, 0x6164, 0xa18c, 0x00ff, 0x8107, 0x6130, 0xa18c,
3103 0x00ff, 0xa10d, 0x6088, 0x628c, 0x608b, 0xbc91, 0x618e, 0x6043,
3104 0x0001, 0x6043, 0x0000, 0x608a, 0x628e, 0x6a04, 0xa294, 0x4000,
3105 0x00c0, 0x7035, 0x027f, 0x0d7f, 0x007f, 0x157f, 0x2009, 0x017f,
3106 0x200b, 0x0000, 0x0c7f, 0x127f, 0x007c, 0x0e7e, 0x2071, 0xa5ab,
3107 0x7020, 0xa005, 0x0040, 0x704e, 0x8001, 0x7022, 0x0e7f, 0x007c,
3108 0x20a9, 0x0008, 0x20a2, 0x00f0, 0x7052, 0x20a2, 0x20a2, 0x007c,
3109 0x0f7e, 0x0e7e, 0x0d7e, 0x0c7e, 0x077e, 0x067e, 0x007e, 0x127e,
3110 0x2091, 0x8000, 0x2071, 0xa5ab, 0x7614, 0x2660, 0x2678, 0x2039,
3111 0x0001, 0x87ff, 0x0040, 0x70f4, 0x8cff, 0x0040, 0x70f4, 0x601c,
3112 0xa086, 0x0006, 0x00c0, 0x70ef, 0x88ff, 0x0040, 0x707f, 0x2800,
3113 0xac06, 0x00c0, 0x70ef, 0x2039, 0x0000, 0x0078, 0x708a, 0x6018,
3114 0xa206, 0x00c0, 0x70ef, 0x85ff, 0x0040, 0x708a, 0x6020, 0xa106,
3115 0x00c0, 0x70ef, 0x7024, 0xac06, 0x00c0, 0x70ba, 0x2069, 0x0100,
3116 0x68c0, 0xa005, 0x0040, 0x70b5, 0x1078, 0x595a, 0x6817, 0x0008,
3117 0x68c3, 0x0000, 0x1078, 0x7188, 0x7027, 0x0000, 0x037e, 0x2069,
3118 0x0140, 0x6b04, 0xa384, 0x1000, 0x0040, 0x70aa, 0x6803, 0x0100,
3119 0x6803, 0x0000, 0x2069, 0x0100, 0x6824, 0xd084, 0x0040, 0x70b2,
3120 0x6827, 0x0001, 0x037f, 0x0078, 0x70ba, 0x6003, 0x0009, 0x630a,
3121 0x0078, 0x70ef, 0x7014, 0xac36, 0x00c0, 0x70c0, 0x660c, 0x7616,
3122 0x7010, 0xac36, 0x00c0, 0x70ce, 0x2c00, 0xaf36, 0x0040, 0x70cc,
3123 0x2f00, 0x7012, 0x0078, 0x70ce, 0x7013, 0x0000, 0x660c, 0x067e,
3124 0x2c00, 0xaf06, 0x0040, 0x70d7, 0x7e0e, 0x0078, 0x70d8, 0x2678,
3125 0x89ff, 0x00c0, 0x70e7, 0x600f, 0x0000, 0x6010, 0x2068, 0x1078,
3126 0x8a44, 0x0040, 0x70e5, 0x1078, 0x9e70, 0x1078, 0x8c01, 0x1078,
3127 0x7045, 0x88ff, 0x00c0, 0x70fe, 0x0c7f, 0x0078, 0x7069, 0x2c78,
3128 0x600c, 0x2060, 0x0078, 0x7069, 0xa006, 0x127f, 0x007f, 0x067f,
3129 0x077f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f, 0x007c, 0x6017, 0x0000,
3130 0x0c7f, 0xa8c5, 0x0001, 0x0078, 0x70f5, 0x0f7e, 0x0e7e, 0x0d7e,
3131 0x0c7e, 0x067e, 0x027e, 0x007e, 0x127e, 0x2091, 0x8000, 0x2071,
3132 0xa5ab, 0x7638, 0x2660, 0x2678, 0x8cff, 0x0040, 0x7177, 0x601c,
3133 0xa086, 0x0006, 0x00c0, 0x7172, 0x87ff, 0x0040, 0x7125, 0x2700,
3134 0xac06, 0x00c0, 0x7172, 0x0078, 0x7130, 0x6018, 0xa206, 0x00c0,
3135 0x7172, 0x85ff, 0x0040, 0x7130, 0x6020, 0xa106, 0x00c0, 0x7172,
3136 0x703c, 0xac06, 0x00c0, 0x7142, 0x037e, 0x2019, 0x0001, 0x1078,
3137 0x6e6c, 0x7033, 0x0000, 0x703f, 0x0000, 0x7043, 0x0000, 0x7047,
3138 0x0000, 0x037f, 0x7038, 0xac36, 0x00c0, 0x7148, 0x660c, 0x763a,
3139 0x7034, 0xac36, 0x00c0, 0x7156, 0x2c00, 0xaf36, 0x0040, 0x7154,
3140 0x2f00, 0x7036, 0x0078, 0x7156, 0x7037, 0x0000, 0x660c, 0x067e,
3141 0x2c00, 0xaf06, 0x0040, 0x715f, 0x7e0e, 0x0078, 0x7160, 0x2678,
3142 0x600f, 0x0000, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x716a,
3143 0x1078, 0x9e70, 0x1078, 0x8c01, 0x87ff, 0x00c0, 0x7181, 0x0c7f,
3144 0x0078, 0x7114, 0x2c78, 0x600c, 0x2060, 0x0078, 0x7114, 0xa006,
3145 0x127f, 0x007f, 0x027f, 0x067f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f,
3146 0x007c, 0x6017, 0x0000, 0x0c7f, 0xa7bd, 0x0001, 0x0078, 0x7178,
3147 0x0e7e, 0x2071, 0xa5ab, 0x2001, 0xa300, 0x2004, 0xa086, 0x0002,
3148 0x00c0, 0x7196, 0x7007, 0x0005, 0x0078, 0x7198, 0x7007, 0x0000,
3149 0x0e7f, 0x007c, 0x0f7e, 0x0e7e, 0x0c7e, 0x067e, 0x027e, 0x007e,
3150 0x127e, 0x2091, 0x8000, 0x2071, 0xa5ab, 0x2c10, 0x7638, 0x2660,
3151 0x2678, 0x8cff, 0x0040, 0x71d8, 0x2200, 0xac06, 0x00c0, 0x71d3,
3152 0x7038, 0xac36, 0x00c0, 0x71b6, 0x660c, 0x763a, 0x7034, 0xac36,
3153 0x00c0, 0x71c4, 0x2c00, 0xaf36, 0x0040, 0x71c2, 0x2f00, 0x7036,
3154 0x0078, 0x71c4, 0x7037, 0x0000, 0x660c, 0x2c00, 0xaf06, 0x0040,
3155 0x71cc, 0x7e0e, 0x0078, 0x71cd, 0x2678, 0x600f, 0x0000, 0xa085,
3156 0x0001, 0x0078, 0x71d8, 0x2c78, 0x600c, 0x2060, 0x0078, 0x71a9,
3157 0x127f, 0x007f, 0x027f, 0x067f, 0x0c7f, 0x0e7f, 0x0f7f, 0x007c,
3158 0x0f7e, 0x0e7e, 0x0d7e, 0x0c7e, 0x067e, 0x007e, 0x127e, 0x2091,
3159 0x8000, 0x2071, 0xa5ab, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0040,
3160 0x7279, 0x6018, 0xa080, 0x0028, 0x2004, 0xa206, 0x00c0, 0x7274,
3161 0x7024, 0xac06, 0x00c0, 0x721f, 0x2069, 0x0100, 0x68c0, 0xa005,
3162 0x0040, 0x724d, 0x1078, 0x6c41, 0x68c3, 0x0000, 0x1078, 0x7188,
3163 0x7027, 0x0000, 0x037e, 0x2069, 0x0140, 0x6b04, 0xa384, 0x1000,
3164 0x0040, 0x7216, 0x6803, 0x0100, 0x6803, 0x0000, 0x2069, 0x0100,
3165 0x6824, 0xd084, 0x0040, 0x721e, 0x6827, 0x0001, 0x037f, 0x700c,
3166 0xac36, 0x00c0, 0x7225, 0x660c, 0x760e, 0x7008, 0xac36, 0x00c0,
3167 0x7233, 0x2c00, 0xaf36, 0x0040, 0x7231, 0x2f00, 0x700a, 0x0078,
3168 0x7233, 0x700b, 0x0000, 0x660c, 0x067e, 0x2c00, 0xaf06, 0x0040,
3169 0x723c, 0x7e0e, 0x0078, 0x723d, 0x2678, 0x600f, 0x0000, 0x1078,
3170 0x8c27, 0x00c0, 0x7251, 0x1078, 0x2839, 0x1078, 0x8c3b, 0x00c0,
3171 0x726d, 0x1078, 0x7a05, 0x0078, 0x726d, 0x1078, 0x7188, 0x0078,
3172 0x721f, 0x1078, 0x8c3b, 0x00c0, 0x7259, 0x1078, 0x7a05, 0x0078,
3173 0x726d, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x726d, 0x601c,
3174 0xa086, 0x0003, 0x00c0, 0x7281, 0x6837, 0x0103, 0x6b4a, 0x6847,
3175 0x0000, 0x1078, 0x4982, 0x1078, 0x8bf4, 0x1078, 0x8c01, 0x1078,
3176 0x7045, 0x0c7f, 0x0078, 0x71ee, 0x2c78, 0x600c, 0x2060, 0x0078,
3177 0x71ee, 0x127f, 0x007f, 0x067f, 0x0c7f, 0x0d7f, 0x0e7f, 0x0f7f,
3178 0x007c, 0x601c, 0xa086, 0x0006, 0x00c0, 0x726d, 0x1078, 0x9e70,
3179 0x0078, 0x726d, 0x037e, 0x157e, 0x137e, 0x147e, 0x3908, 0xa006,
3180 0xa190, 0x0020, 0x221c, 0xa39e, 0x260c, 0x00c0, 0x729b, 0x8210,
3181 0x8000, 0x0078, 0x7292, 0xa005, 0x0040, 0x72a7, 0x20a9, 0x0020,
3182 0x2198, 0x8211, 0xa282, 0x0020, 0x20c8, 0x20a0, 0x53a3, 0x147f,
3183 0x137f, 0x157f, 0x037f, 0x007c, 0x0d7e, 0x20a1, 0x020b, 0x1078,
3184 0x65f8, 0x20a3, 0x0200, 0x20a3, 0x0014, 0x60c3, 0x0014, 0x20a3,
3185 0x0000, 0x20a3, 0x0000, 0x2099, 0xa5a3, 0x20a9, 0x0004, 0x53a6,
3186 0x20a3, 0x0004, 0x20a3, 0x7878, 0x20a3, 0x0000, 0x20a3, 0x0000,
3187 0x1078, 0x6c2d, 0x0d7f, 0x007c, 0x20a1, 0x020b, 0x1078, 0x65f8,
3188 0x20a3, 0x0214, 0x20a3, 0x0018, 0x20a3, 0x0800, 0x7810, 0xa084,
3189 0xff00, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000,
3190 0x20a3, 0x0000, 0x7810, 0xa084, 0x00ff, 0x20a2, 0x7828, 0x20a2,
3191 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0018, 0x1078, 0x6c2d,
3192 0x007c, 0x0d7e, 0x017e, 0x2f68, 0x2009, 0x0035, 0x1078, 0x8ef5,
3193 0x00c0, 0x7361, 0x20a1, 0x020b, 0x1078, 0x6567, 0x20a3, 0x1300,
3194 0x20a3, 0x0000, 0x7828, 0x2068, 0x681c, 0xa086, 0x0003, 0x0040,
3195 0x733d, 0x7818, 0xa080, 0x0028, 0x2014, 0xa286, 0x007e, 0x00c0,
3196 0x7317, 0x20a3, 0x00ff, 0x20a3, 0xfffe, 0x0078, 0x7352, 0xa286,
3197 0x007f, 0x00c0, 0x7321, 0x20a3, 0x00ff, 0x20a3, 0xfffd, 0x0078,
3198 0x7352, 0xd2bc, 0x0040, 0x7337, 0xa286, 0x0080, 0x00c0, 0x732e,
3199 0x20a3, 0x00ff, 0x20a3, 0xfffc, 0x0078, 0x7352, 0xa2e8, 0xa434,
3200 0x2d6c, 0x6810, 0x20a2, 0x6814, 0x20a2, 0x0078, 0x7352, 0x20a3,
3201 0x0000, 0x6098, 0x20a2, 0x0078, 0x7352, 0x7818, 0xa080, 0x0028,
3202 0x2004, 0xa082, 0x007e, 0x0048, 0x734e, 0x0d7e, 0x2069, 0xa31a,
3203 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x7352, 0x20a3, 0x0000,
3204 0x6030, 0x20a2, 0x7834, 0x20a2, 0x7838, 0x20a2, 0x20a3, 0x0000,
3205 0x20a3, 0x0000, 0x60c3, 0x000c, 0x1078, 0x6c2d, 0x017f, 0x0d7f,
3206 0x007c, 0x7817, 0x0001, 0x7803, 0x0006, 0x017f, 0x0d7f, 0x007c,
3207 0x0d7e, 0x027e, 0x7928, 0x2168, 0x691c, 0xa186, 0x0006, 0x0040,
3208 0x738a, 0xa186, 0x0003, 0x0040, 0x73e5, 0xa186, 0x0005, 0x0040,
3209 0x73c8, 0xa186, 0x0004, 0x0040, 0x73b8, 0xa186, 0x0008, 0x0040,
3210 0x73d2, 0x7807, 0x0037, 0x7813, 0x1700, 0x1078, 0x7450, 0x027f,
3211 0x0d7f, 0x007c, 0x1078, 0x740d, 0x2009, 0x4000, 0x6800, 0x0079,
3212 0x7391, 0x73a4, 0x73b2, 0x73a6, 0x73b2, 0x73ad, 0x73a4, 0x73a4,
3213 0x73b2, 0x73b2, 0x73b2, 0x73b2, 0x73a4, 0x73a4, 0x73a4, 0x73a4,
3214 0x73a4, 0x73b2, 0x73a4, 0x73b2, 0x1078, 0x1328, 0x6824, 0xd0e4,
3215 0x0040, 0x73ad, 0xd0cc, 0x0040, 0x73b0, 0xa00e, 0x0078, 0x73b2,
3216 0x2009, 0x2000, 0x6828, 0x20a2, 0x682c, 0x20a2, 0x0078, 0x7403,
3217 0x1078, 0x740d, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x2009, 0x4000,
3218 0x6a00, 0xa286, 0x0002, 0x00c0, 0x73c6, 0xa00e, 0x0078, 0x7403,
3219 0x1078, 0x740d, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x2009, 0x4000,
3220 0x0078, 0x7403, 0x1078, 0x740d, 0x20a3, 0x0000, 0x20a3, 0x0000,
3221 0x2009, 0x4000, 0xa286, 0x0005, 0x0040, 0x73e2, 0xa286, 0x0002,
3222 0x00c0, 0x73e3, 0xa00e, 0x0078, 0x7403, 0x1078, 0x740d, 0x6810,
3223 0x2068, 0x697c, 0x6810, 0xa112, 0x6980, 0x6814, 0xa103, 0x20a2,
3224 0x22a2, 0x7928, 0xa180, 0x0000, 0x2004, 0xa08e, 0x0002, 0x0040,
3225 0x7401, 0xa08e, 0x0004, 0x0040, 0x7401, 0x2009, 0x4000, 0x0078,
3226 0x7403, 0x2009, 0x0000, 0x21a2, 0x20a3, 0x0000, 0x60c3, 0x0018,
3227 0x1078, 0x6c2d, 0x027f, 0x0d7f, 0x007c, 0x037e, 0x047e, 0x057e,
3228 0x067e, 0x20a1, 0x020b, 0x1078, 0x65f8, 0xa006, 0x20a3, 0x0200,
3229 0x20a2, 0x7934, 0x21a2, 0x7938, 0x21a2, 0x7818, 0xa080, 0x0028,
3230 0x2004, 0xa092, 0x007e, 0x0048, 0x7433, 0x0d7e, 0x2069, 0xa31a,
3231 0x2d2c, 0x8d68, 0x2d34, 0xa0e8, 0xa434, 0x2d6c, 0x6b10, 0x6c14,
3232 0x0d7f, 0x0078, 0x7439, 0x2019, 0x0000, 0x6498, 0x2029, 0x0000,
3233 0x6630, 0x7828, 0xa080, 0x0007, 0x2004, 0xa086, 0x0003, 0x00c0,
3234 0x7447, 0x25a2, 0x26a2, 0x23a2, 0x24a2, 0x0078, 0x744b, 0x23a2,
3235 0x24a2, 0x25a2, 0x26a2, 0x067f, 0x057f, 0x047f, 0x037f, 0x007c,
3236 0x20a1, 0x020b, 0x1078, 0x65f8, 0x20a3, 0x0100, 0x20a3, 0x0000,
3237 0x20a3, 0x0009, 0x7810, 0x20a2, 0x60c3, 0x0008, 0x1078, 0x6c2d,
3238 0x007c, 0x20a1, 0x020b, 0x1078, 0x655e, 0x20a3, 0x1400, 0x20a3,
3239 0x0000, 0x7834, 0x20a2, 0x7838, 0x20a2, 0x7828, 0x20a2, 0x782c,
3240 0x20a2, 0x7830, 0xa084, 0x00ff, 0x8007, 0x20a2, 0x20a3, 0x0000,
3241 0x60c3, 0x0010, 0x1078, 0x6c2d, 0x007c, 0x20a1, 0x020b, 0x1078,
3242 0x65ef, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x7828, 0x20a2, 0x7810,
3243 0x20a2, 0x60c3, 0x0008, 0x1078, 0x6c2d, 0x007c, 0x147e, 0x20a1,
3244 0x020b, 0x1078, 0x7499, 0x60c3, 0x0000, 0x1078, 0x6c2d, 0x147f,
3245 0x007c, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028,
3246 0x2004, 0xd0bc, 0x0040, 0x74b6, 0x0d7e, 0xa0e8, 0xa434, 0x2d6c,
3247 0x6810, 0xa085, 0x0300, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xa31a,
3248 0x2da6, 0x8d68, 0x2da6, 0x0d7f, 0x0078, 0x74be, 0x20a3, 0x0300,
3249 0x6298, 0x22a2, 0x20a3, 0x0000, 0x6230, 0x22a2, 0x20a3, 0x0819,
3250 0x20a3, 0x0000, 0x1078, 0x6c1c, 0x22a2, 0x20a3, 0x0000, 0x2fa2,
3251 0x7a08, 0x22a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x007c, 0x2061,
3252 0xaa00, 0x2a70, 0x7060, 0x7046, 0x704b, 0xaa00, 0x007c, 0x0e7e,
3253 0x127e, 0x2071, 0xa300, 0x2091, 0x8000, 0x7544, 0xa582, 0x0010,
3254 0x0048, 0x7509, 0x7048, 0x2060, 0x6000, 0xa086, 0x0000, 0x0040,
3255 0x74f5, 0xace0, 0x0010, 0x7054, 0xac02, 0x00c8, 0x74f1, 0x0078,
3256 0x74e4, 0x2061, 0xaa00, 0x0078, 0x74e4, 0x6003, 0x0008, 0x8529,
3257 0x7546, 0xaca8, 0x0010, 0x7054, 0xa502, 0x00c8, 0x7505, 0x754a,
3258 0xa085, 0x0001, 0x127f, 0x0e7f, 0x007c, 0x704b, 0xaa00, 0x0078,
3259 0x7500, 0xa006, 0x0078, 0x7502, 0x0e7e, 0x2071, 0xa300, 0x7544,
3260 0xa582, 0x0010, 0x0048, 0x753a, 0x7048, 0x2060, 0x6000, 0xa086,
3261 0x0000, 0x0040, 0x7527, 0xace0, 0x0010, 0x7054, 0xac02, 0x00c8,
3262 0x7523, 0x0078, 0x7516, 0x2061, 0xaa00, 0x0078, 0x7516, 0x6003,
3263 0x0008, 0x8529, 0x7546, 0xaca8, 0x0010, 0x7054, 0xa502, 0x00c8,
3264 0x7536, 0x754a, 0xa085, 0x0001, 0x0e7f, 0x007c, 0x704b, 0xaa00,
3265 0x0078, 0x7532, 0xa006, 0x0078, 0x7534, 0xac82, 0xaa00, 0x1048,
3266 0x1328, 0x2001, 0xa315, 0x2004, 0xac02, 0x10c8, 0x1328, 0xa006,
3267 0x6006, 0x600a, 0x600e, 0x6012, 0x6016, 0x601a, 0x601f, 0x0000,
3268 0x6003, 0x0000, 0x6022, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036,
3269 0x603a, 0x603e, 0x2061, 0xa300, 0x6044, 0x8000, 0x6046, 0xa086,
3270 0x0001, 0x0040, 0x7564, 0x007c, 0x127e, 0x2091, 0x8000, 0x1078,
3271 0x6109, 0x127f, 0x0078, 0x7563, 0x601c, 0xa084, 0x000f, 0x0079,
3272 0x7571, 0x757a, 0x758b, 0x75a7, 0x75c3, 0x8f2d, 0x8f49, 0x8f65,
3273 0x757a, 0x758b, 0xa186, 0x0013, 0x00c0, 0x7583, 0x1078, 0x6010,
3274 0x1078, 0x6109, 0x007c, 0xa18e, 0x0047, 0x00c0, 0x758a, 0xa016,
3275 0x1078, 0x15ec, 0x007c, 0x067e, 0x6000, 0xa0b2, 0x0010, 0x10c8,
3276 0x1328, 0x1079, 0x7595, 0x067f, 0x007c, 0x75a5, 0x7891, 0x7a34,
3277 0x75a5, 0x7ab8, 0x75df, 0x75a5, 0x75a5, 0x7823, 0x7e6d, 0x75a5,
3278 0x75a5, 0x75a5, 0x75a5, 0x75a5, 0x75a5, 0x1078, 0x1328, 0x067e,
3279 0x6000, 0xa0b2, 0x0010, 0x10c8, 0x1328, 0x1079, 0x75b1, 0x067f,
3280 0x007c, 0x75c1, 0x8522, 0x75c1, 0x75c1, 0x75c1, 0x75c1, 0x75c1,
3281 0x75c1, 0x84c5, 0x86a8, 0x75c1, 0x8552, 0x85d8, 0x8552, 0x85d8,
3282 0x75c1, 0x1078, 0x1328, 0x067e, 0x6000, 0xa0b2, 0x0010, 0x10c8,
3283 0x1328, 0x1079, 0x75cd, 0x067f, 0x007c, 0x75dd, 0x7eb4, 0x7f81,
3284 0x80c6, 0x8242, 0x75dd, 0x75dd, 0x75dd, 0x7e8d, 0x846d, 0x8471,
3285 0x75dd, 0x75dd, 0x75dd, 0x75dd, 0x84a1, 0x1078, 0x1328, 0xa1b6,
3286 0x0015, 0x00c0, 0x75e7, 0x1078, 0x753d, 0x0078, 0x75ed, 0xa1b6,
3287 0x0016, 0x10c0, 0x1328, 0x1078, 0x753d, 0x007c, 0x20a9, 0x000e,
3288 0x2e98, 0x6010, 0x20a0, 0x53a3, 0x20a9, 0x0006, 0x3310, 0x3420,
3289 0x9398, 0x94a0, 0x3318, 0x3428, 0x222e, 0x2326, 0xa290, 0x0002,
3290 0xa5a8, 0x0002, 0xa398, 0x0002, 0xa4a0, 0x0002, 0x00f0, 0x75fc,
3291 0x0e7e, 0x1078, 0x8a44, 0x0040, 0x7613, 0x6010, 0x2070, 0x7007,
3292 0x0000, 0x7037, 0x0103, 0x0e7f, 0x1078, 0x753d, 0x007c, 0x0d7e,
3293 0x037e, 0x7330, 0xa386, 0x0200, 0x00c0, 0x7624, 0x6018, 0x2068,
3294 0x6813, 0x00ff, 0x6817, 0xfffd, 0x6010, 0xa005, 0x0040, 0x762e,
3295 0x2068, 0x6807, 0x0000, 0x6837, 0x0103, 0x6b32, 0x1078, 0x753d,
3296 0x037f, 0x0d7f, 0x007c, 0x017e, 0x20a9, 0x002a, 0xae80, 0x000c,
3297 0x2098, 0x6010, 0xa080, 0x0002, 0x20a0, 0x53a3, 0x20a9, 0x002a,
3298 0x6010, 0xa080, 0x0001, 0x2004, 0xa080, 0x0002, 0x20a0, 0x53a3,
3299 0x0e7e, 0x6010, 0x2004, 0x2070, 0x7037, 0x0103, 0x0e7f, 0x1078,
3300 0x753d, 0x017f, 0x007c, 0x0e7e, 0x0d7e, 0x603f, 0x0000, 0x2c68,
3301 0x017e, 0x2009, 0x0035, 0x1078, 0x8ef5, 0x017f, 0x00c0, 0x766f,
3302 0x027e, 0x6228, 0x2268, 0x027f, 0x2071, 0xa88c, 0x6b1c, 0xa386,
3303 0x0003, 0x0040, 0x7673, 0xa386, 0x0006, 0x0040, 0x7677, 0x1078,
3304 0x753d, 0x0078, 0x7679, 0x1078, 0x767c, 0x0078, 0x7679, 0x1078,
3305 0x771e, 0x0d7f, 0x0e7f, 0x007c, 0x0f7e, 0x6810, 0x2078, 0xa186,
3306 0x0015, 0x0040, 0x7705, 0xa18e, 0x0016, 0x00c0, 0x771c, 0x700c,
3307 0xa084, 0xff00, 0xa086, 0x1700, 0x00c0, 0x76e0, 0x8fff, 0x0040,
3308 0x771a, 0x6808, 0xa086, 0xffff, 0x00c0, 0x7709, 0x784c, 0xa084,
3309 0x0060, 0xa086, 0x0020, 0x00c0, 0x76a7, 0x797c, 0x7810, 0xa106,
3310 0x00c0, 0x7709, 0x7980, 0x7814, 0xa106, 0x00c0, 0x7709, 0x1078,
3311 0x8bf4, 0x6830, 0x7852, 0x784c, 0xc0dc, 0xc0f4, 0xc0d4, 0x784e,
3312 0x027e, 0xa00e, 0x6a14, 0x2001, 0x000a, 0x1078, 0x5a98, 0x7854,
3313 0xa20a, 0x0048, 0x76bc, 0x8011, 0x7a56, 0x82ff, 0x027f, 0x00c0,
3314 0x76c8, 0x0c7e, 0x2d60, 0x1078, 0x8832, 0x0c7f, 0x0078, 0x771a,
3315 0x0c7e, 0x0d7e, 0x2f68, 0x6838, 0xd0fc, 0x00c0, 0x76d3, 0x1078,
3316 0x4290, 0x0078, 0x76d5, 0x1078, 0x436e, 0x0d7f, 0x0c7f, 0x00c0,
3317 0x7709, 0x0c7e, 0x2d60, 0x1078, 0x753d, 0x0c7f, 0x0078, 0x771a,
3318 0x7008, 0xa086, 0x000b, 0x00c0, 0x76fa, 0x6018, 0x200c, 0xc1bc,
3319 0x2102, 0x0c7e, 0x2d60, 0x7853, 0x0003, 0x6007, 0x0085, 0x6003,
3320 0x000b, 0x601f, 0x0002, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0c7f,
3321 0x0078, 0x771a, 0x700c, 0xa086, 0x2a00, 0x00c0, 0x7709, 0x2001,
3322 0xa5a2, 0x2004, 0x683e, 0x0078, 0x771a, 0x1078, 0x7739, 0x0078,
3323 0x771c, 0x8fff, 0x1040, 0x1328, 0x0c7e, 0x0d7e, 0x2d60, 0x2f68,
3324 0x684b, 0x0003, 0x1078, 0x8726, 0x1078, 0x8bf4, 0x1078, 0x8c01,
3325 0x0d7f, 0x0c7f, 0x1078, 0x753d, 0x0f7f, 0x007c, 0xa186, 0x0015,
3326 0x00c0, 0x7728, 0x2001, 0xa5a2, 0x2004, 0x683e, 0x0078, 0x7736,
3327 0xa18e, 0x0016, 0x00c0, 0x7738, 0x0c7e, 0x2d00, 0x2060, 0x1078,
3328 0xa134, 0x1078, 0x5a41, 0x1078, 0x753d, 0x0c7f, 0x1078, 0x753d,
3329 0x007c, 0x027e, 0x037e, 0x047e, 0x7228, 0x7c80, 0x7b7c, 0xd2f4,
3330 0x0040, 0x7748, 0x2001, 0xa5a2, 0x2004, 0x683e, 0x0078, 0x77ac,
3331 0x0c7e, 0x2d60, 0x1078, 0x874a, 0x0c7f, 0x6804, 0xa086, 0x0050,
3332 0x00c0, 0x7760, 0x0c7e, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007,
3333 0x0050, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0c7f, 0x0078, 0x77ac,
3334 0x6800, 0xa086, 0x000f, 0x0040, 0x7782, 0x8fff, 0x1040, 0x1328,
3335 0x6824, 0xd0dc, 0x00c0, 0x7782, 0x6800, 0xa086, 0x0004, 0x00c0,
3336 0x7787, 0x784c, 0xd0ac, 0x0040, 0x7787, 0x784c, 0xc0dc, 0xc0f4,
3337 0x784e, 0x7850, 0xc0f4, 0xc0fc, 0x7852, 0x2001, 0x0001, 0x682e,
3338 0x0078, 0x77a6, 0x2001, 0x0007, 0x682e, 0x0078, 0x77a6, 0x784c,
3339 0xd0b4, 0x00c0, 0x7794, 0xd0ac, 0x0040, 0x7782, 0x784c, 0xd0f4,
3340 0x00c0, 0x7782, 0x0078, 0x7775, 0xd2ec, 0x00c0, 0x7782, 0x7024,
3341 0xa306, 0x00c0, 0x779f, 0x7020, 0xa406, 0x0040, 0x7782, 0x7020,
3342 0x6836, 0x7024, 0x683a, 0x2001, 0x0005, 0x682e, 0x1078, 0x8d2b,
3343 0x1078, 0x6109, 0x0078, 0x77ae, 0x1078, 0x753d, 0x047f, 0x037f,
3344 0x027f, 0x007c, 0x0e7e, 0x0d7e, 0x027e, 0x6034, 0x2068, 0x6a1c,
3345 0xa286, 0x0007, 0x0040, 0x7806, 0xa286, 0x0002, 0x0040, 0x7806,
3346 0xa286, 0x0000, 0x0040, 0x7806, 0x6808, 0x6338, 0xa306, 0x00c0,
3347 0x7806, 0x2071, 0xa88c, 0xa186, 0x0015, 0x0040, 0x7800, 0xa18e,
3348 0x0016, 0x00c0, 0x77e8, 0x6030, 0xa084, 0x00ff, 0xa086, 0x0001,
3349 0x00c0, 0x77e8, 0x700c, 0xa086, 0x2a00, 0x00c0, 0x77e8, 0x6034,
3350 0xa080, 0x0009, 0x200c, 0xc1dd, 0xc1f5, 0x2102, 0x0078, 0x7800,
3351 0x0c7e, 0x6034, 0x2060, 0x6010, 0x2068, 0x1078, 0x8a44, 0x1040,
3352 0x1328, 0x6853, 0x0003, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f,
3353 0x0002, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0c7f, 0x0078, 0x7806,
3354 0x6034, 0x2068, 0x2001, 0xa5a2, 0x2004, 0x683e, 0x1078, 0x753d,
3355 0x027f, 0x0d7f, 0x0e7f, 0x007c, 0x0d7e, 0x20a9, 0x000e, 0x2e98,
3356 0x6010, 0x20a0, 0x53a3, 0xa1b6, 0x0015, 0x00c0, 0x7820, 0x6018,
3357 0x2068, 0x7038, 0x680a, 0x703c, 0x680e, 0x6800, 0xc08d, 0x6802,
3358 0x0d7f, 0x0078, 0x7608, 0x2100, 0xa1b2, 0x0044, 0x10c8, 0x1328,
3359 0xa1b2, 0x0040, 0x00c8, 0x7888, 0x0079, 0x782e, 0x787c, 0x7870,
3360 0x787c, 0x787c, 0x787c, 0x787c, 0x786e, 0x786e, 0x786e, 0x786e,
3361 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e,
3362 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e,
3363 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x787c, 0x786e, 0x787c,
3364 0x787c, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x787c, 0x786e,
3365 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e,
3366 0x787c, 0x787c, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e, 0x786e,
3367 0x786e, 0x786e, 0x786e, 0x787c, 0x786e, 0x786e, 0x1078, 0x1328,
3368 0x6003, 0x0001, 0x6106, 0x1078, 0x5c45, 0x127e, 0x2091, 0x8000,
3369 0x1078, 0x6109, 0x127f, 0x007c, 0x6003, 0x0001, 0x6106, 0x1078,
3370 0x5c45, 0x127e, 0x2091, 0x8000, 0x1078, 0x6109, 0x127f, 0x007c,
3371 0x2600, 0x0079, 0x788b, 0x788f, 0x788f, 0x788f, 0x787c, 0x1078,
3372 0x1328, 0x6004, 0xa0b2, 0x0044, 0x10c8, 0x1328, 0xa1b6, 0x0013,
3373 0x00c0, 0x78a1, 0xa0b2, 0x0040, 0x00c8, 0x79fb, 0x2008, 0x0079,
3374 0x7941, 0xa1b6, 0x0027, 0x00c0, 0x78fe, 0x1078, 0x6010, 0x6004,
3375 0x1078, 0x8c27, 0x0040, 0x78be, 0x1078, 0x8c3b, 0x0040, 0x78f6,
3376 0xa08e, 0x0021, 0x0040, 0x78fa, 0xa08e, 0x0022, 0x0040, 0x78f6,
3377 0xa08e, 0x003d, 0x0040, 0x78fa, 0x0078, 0x78f1, 0x1078, 0x2839,
3378 0x2001, 0x0007, 0x1078, 0x443f, 0x6018, 0xa080, 0x0028, 0x200c,
3379 0x1078, 0x7a05, 0xa186, 0x007e, 0x00c0, 0x78d3, 0x2001, 0xa332,
3380 0x2014, 0xc285, 0x2202, 0x017e, 0x027e, 0x037e, 0x2110, 0x2019,
3381 0x0028, 0x1078, 0x5d53, 0x077e, 0x2039, 0x0000, 0x1078, 0x5c78,
3382 0x0c7e, 0x6018, 0xa065, 0x0040, 0x78e7, 0x1078, 0x471b, 0x0c7f,
3383 0x2c08, 0x1078, 0x9c38, 0x077f, 0x037f, 0x027f, 0x017f, 0x1078,
3384 0x44bc, 0x1078, 0x753d, 0x1078, 0x6109, 0x007c, 0x1078, 0x7a05,
3385 0x0078, 0x78f1, 0x1078, 0x7a28, 0x0078, 0x78f1, 0xa186, 0x0014,
3386 0x00c0, 0x78f5, 0x1078, 0x6010, 0x1078, 0x2813, 0x1078, 0x8c27,
3387 0x00c0, 0x791d, 0x1078, 0x2839, 0x6018, 0xa080, 0x0028, 0x200c,
3388 0x1078, 0x7a05, 0xa186, 0x007e, 0x00c0, 0x791b, 0x2001, 0xa332,
3389 0x200c, 0xc185, 0x2102, 0x0078, 0x78f1, 0x1078, 0x8c3b, 0x00c0,
3390 0x7925, 0x1078, 0x7a05, 0x0078, 0x78f1, 0x6004, 0xa08e, 0x0032,
3391 0x00c0, 0x7936, 0x0e7e, 0x0f7e, 0x2071, 0xa381, 0x2079, 0x0000,
3392 0x1078, 0x2b56, 0x0f7f, 0x0e7f, 0x0078, 0x78f1, 0x6004, 0xa08e,
3393 0x0021, 0x0040, 0x7921, 0xa08e, 0x0022, 0x1040, 0x7a05, 0x0078,
3394 0x78f1, 0x7983, 0x7985, 0x7989, 0x798d, 0x7991, 0x7995, 0x7981,
3395 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981,
3396 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981,
3397 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981, 0x7999,
3398 0x79ab, 0x7981, 0x79ad, 0x79ab, 0x7981, 0x7981, 0x7981, 0x7981,
3399 0x7981, 0x79ab, 0x79ab, 0x7981, 0x7981, 0x7981, 0x7981, 0x7981,
3400 0x7981, 0x7981, 0x7981, 0x79de, 0x79ab, 0x7981, 0x79a5, 0x7981,
3401 0x7981, 0x7981, 0x79a7, 0x7981, 0x7981, 0x7981, 0x79ab, 0x7981,
3402 0x7981, 0x1078, 0x1328, 0x0078, 0x79ab, 0x2001, 0x000b, 0x0078,
3403 0x79b8, 0x2001, 0x0003, 0x0078, 0x79b8, 0x2001, 0x0005, 0x0078,
3404 0x79b8, 0x2001, 0x0001, 0x0078, 0x79b8, 0x2001, 0x0009, 0x0078,
3405 0x79b8, 0x1078, 0x6010, 0x6003, 0x0005, 0x2001, 0xa5a2, 0x2004,
3406 0x603e, 0x1078, 0x6109, 0x0078, 0x79b7, 0x0078, 0x79ab, 0x0078,
3407 0x79ab, 0x1078, 0x443f, 0x0078, 0x79f0, 0x1078, 0x6010, 0x6003,
3408 0x0004, 0x2001, 0xa5a0, 0x2004, 0x6016, 0x1078, 0x6109, 0x007c,
3409 0x1078, 0x443f, 0x1078, 0x6010, 0x2001, 0xa5a2, 0x2004, 0x603e,
3410 0x6003, 0x0002, 0x037e, 0x2019, 0xa35c, 0x2304, 0xa084, 0xff00,
3411 0x00c0, 0x79cf, 0x2019, 0xa5a0, 0x231c, 0x0078, 0x79d8, 0x8007,
3412 0xa09a, 0x0004, 0x0048, 0x79ca, 0x8003, 0x801b, 0x831b, 0xa318,
3413 0x6316, 0x037f, 0x1078, 0x6109, 0x0078, 0x79b7, 0x0e7e, 0x0f7e,
3414 0x2071, 0xa381, 0x2079, 0x0000, 0x1078, 0x2b56, 0x0f7f, 0x0e7f,
3415 0x1078, 0x6010, 0x1078, 0x753d, 0x1078, 0x6109, 0x0078, 0x79b7,
3416 0x1078, 0x6010, 0x6003, 0x0002, 0x2001, 0xa5a0, 0x2004, 0x6016,
3417 0x1078, 0x6109, 0x007c, 0x2600, 0x2008, 0x0079, 0x79ff, 0x7a03,
3418 0x7a03, 0x7a03, 0x79f0, 0x1078, 0x1328, 0x0e7e, 0x1078, 0x8a44,
3419 0x0040, 0x7a21, 0x6010, 0x2070, 0x7038, 0xd0fc, 0x0040, 0x7a21,
3420 0x7007, 0x0000, 0x017e, 0x6004, 0xa08e, 0x0021, 0x0040, 0x7a23,
3421 0xa08e, 0x003d, 0x0040, 0x7a23, 0x017f, 0x7037, 0x0103, 0x7033,
3422 0x0100, 0x0e7f, 0x007c, 0x017f, 0x1078, 0x7a28, 0x0078, 0x7a21,
3423 0x0e7e, 0xacf0, 0x0004, 0x2e74, 0x7000, 0x2070, 0x7037, 0x0103,
3424 0x7023, 0x8001, 0x0e7f, 0x007c, 0x0d7e, 0x6618, 0x2668, 0x6804,
3425 0xa084, 0x00ff, 0x0d7f, 0xa0b2, 0x000c, 0x10c8, 0x1328, 0x6604,
3426 0xa6b6, 0x0043, 0x00c0, 0x7a48, 0x1078, 0x8e6d, 0x0078, 0x7aa7,
3427 0x6604, 0xa6b6, 0x0033, 0x00c0, 0x7a51, 0x1078, 0x8e11, 0x0078,
3428 0x7aa7, 0x6604, 0xa6b6, 0x0028, 0x00c0, 0x7a5a, 0x1078, 0x8c6a,
3429 0x0078, 0x7aa7, 0x6604, 0xa6b6, 0x0029, 0x00c0, 0x7a63, 0x1078,
3430 0x8c84, 0x0078, 0x7aa7, 0x6604, 0xa6b6, 0x001f, 0x00c0, 0x7a6c,
3431 0x1078, 0x75ee, 0x0078, 0x7aa7, 0x6604, 0xa6b6, 0x0000, 0x00c0,
3432 0x7a75, 0x1078, 0x780c, 0x0078, 0x7aa7, 0x6604, 0xa6b6, 0x0022,
3433 0x00c0, 0x7a7e, 0x1078, 0x7617, 0x0078, 0x7aa7, 0x6604, 0xa6b6,
3434 0x0035, 0x00c0, 0x7a87, 0x1078, 0x7653, 0x0078, 0x7aa7, 0x6604,
3435 0xa6b6, 0x0039, 0x00c0, 0x7a90, 0x1078, 0x77b2, 0x0078, 0x7aa7,
3436 0x6604, 0xa6b6, 0x003d, 0x00c0, 0x7a99, 0x1078, 0x7633, 0x0078,
3437 0x7aa7, 0xa1b6, 0x0015, 0x00c0, 0x7aa1, 0x1079, 0x7aac, 0x0078,
3438 0x7aa7, 0xa1b6, 0x0016, 0x00c0, 0x7aa8, 0x1079, 0x7bfd, 0x007c,
3439 0x1078, 0x7583, 0x0078, 0x7aa7, 0x7ad0, 0x7ad3, 0x7ad0, 0x7b1e,
3440 0x7ad0, 0x7b91, 0x7c09, 0x7ad0, 0x7ad0, 0x7bd5, 0x7ad0, 0x7beb,
3441 0xa1b6, 0x0048, 0x0040, 0x7ac4, 0x20e1, 0x0005, 0x3d18, 0x3e20,
3442 0x2c10, 0x1078, 0x15ec, 0x007c, 0x0e7e, 0xacf0, 0x0004, 0x2e74,
3443 0x7000, 0x2070, 0x7037, 0x0103, 0x0e7f, 0x1078, 0x753d, 0x007c,
3444 0x0005, 0x0005, 0x007c, 0x0e7e, 0x2071, 0xa300, 0x707c, 0xa086,
3445 0x0074, 0x00c0, 0x7b07, 0x1078, 0x9c0c, 0x00c0, 0x7af9, 0x0d7e,
3446 0x6018, 0x2068, 0x7030, 0xd08c, 0x0040, 0x7aec, 0x6800, 0xd0bc,
3447 0x0040, 0x7aec, 0xc0c5, 0x6802, 0x1078, 0x7b0b, 0x0d7f, 0x2001,
3448 0x0006, 0x1078, 0x443f, 0x1078, 0x2839, 0x1078, 0x753d, 0x0078,
3449 0x7b09, 0x2001, 0x000a, 0x1078, 0x443f, 0x1078, 0x2839, 0x6003,
3450 0x0001, 0x6007, 0x0001, 0x1078, 0x5c45, 0x0078, 0x7b09, 0x1078,
3451 0x7b81, 0x0e7f, 0x007c, 0x6800, 0xd084, 0x0040, 0x7b1d, 0x2001,
3452 0x0000, 0x1078, 0x442b, 0x2069, 0xa351, 0x6804, 0xd0a4, 0x0040,
3453 0x7b1d, 0x2001, 0x0006, 0x1078, 0x4472, 0x007c, 0x0d7e, 0x2011,
3454 0xa31f, 0x2204, 0xa086, 0x0074, 0x00c0, 0x7b7d, 0x6018, 0x2068,
3455 0x6aa0, 0xa286, 0x007e, 0x00c0, 0x7b31, 0x1078, 0x7d17, 0x0078,
3456 0x7b7f, 0x1078, 0x7d0d, 0x6018, 0x2068, 0xa080, 0x0028, 0x2014,
3457 0xa286, 0x0080, 0x00c0, 0x7b55, 0x6813, 0x00ff, 0x6817, 0xfffc,
3458 0x6010, 0xa005, 0x0040, 0x7b4b, 0x2068, 0x6807, 0x0000, 0x6837,
3459 0x0103, 0x6833, 0x0200, 0x2001, 0x0006, 0x1078, 0x443f, 0x1078,
3460 0x2839, 0x1078, 0x753d, 0x0078, 0x7b7f, 0x0e7e, 0x2071, 0xa332,
3461 0x2e04, 0xd09c, 0x0040, 0x7b70, 0x2071, 0xa880, 0x7108, 0x720c,
3462 0xa18c, 0x00ff, 0x00c0, 0x7b68, 0xa284, 0xff00, 0x0040, 0x7b70,
3463 0x6018, 0x2070, 0x70a0, 0xd0bc, 0x00c0, 0x7b70, 0x7112, 0x7216,
3464 0x0e7f, 0x2001, 0x0004, 0x1078, 0x443f, 0x6003, 0x0001, 0x6007,
3465 0x0003, 0x1078, 0x5c45, 0x0078, 0x7b7f, 0x1078, 0x7b81, 0x0d7f,
3466 0x007c, 0x2001, 0xa300, 0x2004, 0xa086, 0x0003, 0x0040, 0x7b8c,
3467 0x2001, 0x0007, 0x1078, 0x443f, 0x1078, 0x2839, 0x1078, 0x753d,
3468 0x007c, 0x0e7e, 0x2071, 0xa300, 0x707c, 0xa086, 0x0014, 0x00c0,
3469 0x7bcf, 0x7000, 0xa086, 0x0003, 0x00c0, 0x7ba4, 0x6010, 0xa005,
3470 0x00c0, 0x7ba4, 0x1078, 0x35f7, 0x0d7e, 0x6018, 0x2068, 0x1078,
3471 0x457d, 0x1078, 0x7b0b, 0x0d7f, 0x1078, 0x7dba, 0x00c0, 0x7bcf,
3472 0x0d7e, 0x6018, 0x2068, 0x6890, 0x0d7f, 0xa005, 0x0040, 0x7bcf,
3473 0x2001, 0x0006, 0x1078, 0x443f, 0x0e7e, 0x6010, 0xa005, 0x0040,
3474 0x7bc8, 0x2070, 0x7007, 0x0000, 0x7037, 0x0103, 0x7033, 0x0200,
3475 0x0e7f, 0x1078, 0x2839, 0x1078, 0x753d, 0x0078, 0x7bd3, 0x1078,
3476 0x7a05, 0x1078, 0x7b81, 0x0e7f, 0x007c, 0x2011, 0xa31f, 0x2204,
3477 0xa086, 0x0014, 0x00c0, 0x7be8, 0x2001, 0x0002, 0x1078, 0x443f,
3478 0x6003, 0x0001, 0x6007, 0x0001, 0x1078, 0x5c45, 0x0078, 0x7bea,
3479 0x1078, 0x7b81, 0x007c, 0x2011, 0xa31f, 0x2204, 0xa086, 0x0004,
3480 0x00c0, 0x7bfa, 0x2001, 0x0007, 0x1078, 0x443f, 0x1078, 0x753d,
3481 0x0078, 0x7bfc, 0x1078, 0x7b81, 0x007c, 0x7ad0, 0x7c11, 0x7ad0,
3482 0x7c4e, 0x7ad0, 0x7cc0, 0x7c09, 0x7ad0, 0x7ad0, 0x7cd5, 0x7ad0,
3483 0x7ce8, 0x6604, 0xa6b6, 0x001e, 0x00c0, 0x7c10, 0x1078, 0x753d,
3484 0x007c, 0x0d7e, 0x0c7e, 0x1078, 0x7cfb, 0x00c0, 0x7c27, 0x2001,
3485 0x0000, 0x1078, 0x442b, 0x2001, 0x0002, 0x1078, 0x443f, 0x6003,
3486 0x0001, 0x6007, 0x0002, 0x1078, 0x5c45, 0x0078, 0x7c4b, 0x2009,
3487 0xa88e, 0x2104, 0xa086, 0x0009, 0x00c0, 0x7c3c, 0x6018, 0x2068,
3488 0x6840, 0xa084, 0x00ff, 0xa005, 0x0040, 0x7c49, 0x8001, 0x6842,
3489 0x6017, 0x000a, 0x0078, 0x7c4b, 0x2009, 0xa88f, 0x2104, 0xa084,
3490 0xff00, 0xa086, 0x1900, 0x00c0, 0x7c49, 0x1078, 0x753d, 0x0078,
3491 0x7c4b, 0x1078, 0x7b81, 0x0c7f, 0x0d7f, 0x007c, 0x1078, 0x7d0a,
3492 0x00c0, 0x7c62, 0x2001, 0x0000, 0x1078, 0x442b, 0x2001, 0x0002,
3493 0x1078, 0x443f, 0x6003, 0x0001, 0x6007, 0x0002, 0x1078, 0x5c45,
3494 0x0078, 0x7c8e, 0x1078, 0x7a05, 0x2009, 0xa88e, 0x2134, 0xa6b4,
3495 0x00ff, 0xa686, 0x0005, 0x0040, 0x7c8f, 0xa686, 0x000b, 0x0040,
3496 0x7c8c, 0x2009, 0xa88f, 0x2104, 0xa084, 0xff00, 0x00c0, 0x7c7c,
3497 0xa686, 0x0009, 0x0040, 0x7c8f, 0xa086, 0x1900, 0x00c0, 0x7c8c,
3498 0xa686, 0x0009, 0x0040, 0x7c8f, 0x2001, 0x0004, 0x1078, 0x443f,
3499 0x1078, 0x753d, 0x0078, 0x7c8e, 0x1078, 0x7b81, 0x007c, 0x0d7e,
3500 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x7c9d, 0x6838, 0xd0fc,
3501 0x0040, 0x7c9d, 0x0d7f, 0x0078, 0x7c8c, 0x6018, 0x2068, 0x6840,
3502 0xa084, 0x00ff, 0xa005, 0x0040, 0x7cae, 0x8001, 0x6842, 0x6017,
3503 0x000a, 0x6007, 0x0016, 0x0d7f, 0x0078, 0x7c8e, 0x68a0, 0xa086,
3504 0x007e, 0x00c0, 0x7cbb, 0x0e7e, 0x2071, 0xa300, 0x1078, 0x41f5,
3505 0x0e7f, 0x0078, 0x7cbd, 0x1078, 0x2813, 0x0d7f, 0x0078, 0x7c8c,
3506 0x1078, 0x7d0a, 0x00c0, 0x7cd0, 0x2001, 0x0004, 0x1078, 0x443f,
3507 0x6003, 0x0001, 0x6007, 0x0003, 0x1078, 0x5c45, 0x0078, 0x7cd4,
3508 0x1078, 0x7a05, 0x1078, 0x7b81, 0x007c, 0x1078, 0x7d0a, 0x00c0,
3509 0x7ce5, 0x2001, 0x0008, 0x1078, 0x443f, 0x6003, 0x0001, 0x6007,
3510 0x0005, 0x1078, 0x5c45, 0x0078, 0x7ce7, 0x1078, 0x7b81, 0x007c,
3511 0x1078, 0x7d0a, 0x00c0, 0x7cf8, 0x2001, 0x000a, 0x1078, 0x443f,
3512 0x6003, 0x0001, 0x6007, 0x0001, 0x1078, 0x5c45, 0x0078, 0x7cfa,
3513 0x1078, 0x7b81, 0x007c, 0x2009, 0xa88e, 0x2104, 0xa086, 0x0003,
3514 0x00c0, 0x7d09, 0x2009, 0xa88f, 0x2104, 0xa084, 0xff00, 0xa086,
3515 0x2a00, 0x007c, 0xa085, 0x0001, 0x007c, 0x0c7e, 0x017e, 0xac88,
3516 0x0006, 0x2164, 0x1078, 0x4513, 0x017f, 0x0c7f, 0x007c, 0x0f7e,
3517 0x0e7e, 0x0d7e, 0x037e, 0x017e, 0x6018, 0x2068, 0x2071, 0xa332,
3518 0x2e04, 0xa085, 0x0003, 0x2072, 0x1078, 0x7d8b, 0x0040, 0x7d50,
3519 0x2001, 0xa352, 0x2004, 0xd0a4, 0x0040, 0x7d39, 0xa006, 0x2020,
3520 0x2009, 0x002a, 0x1078, 0x9ec0, 0x2001, 0xa30c, 0x200c, 0xc195,
3521 0x2102, 0x2019, 0x002a, 0x2009, 0x0001, 0x1078, 0x27e2, 0x2071,
3522 0xa300, 0x1078, 0x260d, 0x0c7e, 0x157e, 0x20a9, 0x0081, 0x2009,
3523 0x007f, 0x1078, 0x2921, 0x8108, 0x00f0, 0x7d49, 0x157f, 0x0c7f,
3524 0x1078, 0x7d0d, 0x6813, 0x00ff, 0x6817, 0xfffe, 0x2071, 0xa880,
3525 0x2079, 0x0100, 0x2e04, 0xa084, 0x00ff, 0x2069, 0xa31a, 0x206a,
3526 0x78e6, 0x007e, 0x8e70, 0x2e04, 0x2069, 0xa31b, 0x206a, 0x78ea,
3527 0xa084, 0xff00, 0x017f, 0xa105, 0x2009, 0xa325, 0x200a, 0x2069,
3528 0xa88e, 0x2071, 0xa59c, 0x6810, 0x2072, 0x6814, 0x7006, 0x6818,
3529 0x700a, 0x681c, 0x700e, 0x1078, 0x8da9, 0x2001, 0x0006, 0x1078,
3530 0x443f, 0x1078, 0x2839, 0x1078, 0x753d, 0x017f, 0x037f, 0x0d7f,
3531 0x0e7f, 0x0f7f, 0x007c, 0x027e, 0x037e, 0x0e7e, 0x157e, 0x2019,
3532 0xa325, 0x231c, 0x83ff, 0x0040, 0x7db5, 0x2071, 0xa880, 0x2e14,
3533 0xa294, 0x00ff, 0x7004, 0xa084, 0xff00, 0xa205, 0xa306, 0x00c0,
3534 0x7db5, 0x2011, 0xa896, 0xad98, 0x000a, 0x20a9, 0x0004, 0x1078,
3535 0x7e55, 0x00c0, 0x7db5, 0x2011, 0xa89a, 0xad98, 0x0006, 0x20a9,
3536 0x0004, 0x1078, 0x7e55, 0x00c0, 0x7db5, 0x157f, 0x0e7f, 0x037f,
3537 0x027f, 0x007c, 0x0e7e, 0x2071, 0xa88c, 0x7004, 0xa086, 0x0014,
3538 0x00c0, 0x7ddd, 0x7008, 0xa086, 0x0800, 0x00c0, 0x7ddd, 0x700c,
3539 0xd0ec, 0x0040, 0x7ddb, 0xa084, 0x0f00, 0xa086, 0x0100, 0x00c0,
3540 0x7ddb, 0x7024, 0xd0a4, 0x00c0, 0x7dd8, 0xd0ac, 0x0040, 0x7ddb,
3541 0xa006, 0x0078, 0x7ddd, 0xa085, 0x0001, 0x0e7f, 0x007c, 0x0e7e,
3542 0x0d7e, 0x0c7e, 0x077e, 0x057e, 0x047e, 0x027e, 0x007e, 0x127e,
3543 0x2091, 0x8000, 0x2029, 0xa5b4, 0x252c, 0x2021, 0xa5ba, 0x2424,
3544 0x2061, 0xaa00, 0x2071, 0xa300, 0x7244, 0x7060, 0xa202, 0x00c8,
3545 0x7e43, 0x1078, 0x9ee5, 0x0040, 0x7e3b, 0x671c, 0xa786, 0x0001,
3546 0x0040, 0x7e3b, 0xa786, 0x0007, 0x0040, 0x7e3b, 0x2500, 0xac06,
3547 0x0040, 0x7e3b, 0x2400, 0xac06, 0x0040, 0x7e3b, 0x0c7e, 0x6000,
3548 0xa086, 0x0004, 0x00c0, 0x7e16, 0x1078, 0x1749, 0xa786, 0x0008,
3549 0x00c0, 0x7e25, 0x1078, 0x8c3b, 0x00c0, 0x7e25, 0x0c7f, 0x1078,
3550 0x7a05, 0x1078, 0x8c01, 0x0078, 0x7e3b, 0x6010, 0x2068, 0x1078,
3551 0x8a44, 0x0040, 0x7e38, 0xa786, 0x0003, 0x00c0, 0x7e4d, 0x6837,
3552 0x0103, 0x6b4a, 0x6847, 0x0000, 0x1078, 0x4982, 0x1078, 0x8bf4,
3553 0x1078, 0x8c01, 0x0c7f, 0xace0, 0x0010, 0x7054, 0xac02, 0x00c8,
3554 0x7e43, 0x0078, 0x7df4, 0x127f, 0x007f, 0x027f, 0x047f, 0x057f,
3555 0x077f, 0x0c7f, 0x0d7f, 0x0e7f, 0x007c, 0xa786, 0x0006, 0x00c0,
3556 0x7e2f, 0x1078, 0x9e70, 0x0078, 0x7e38, 0x220c, 0x2304, 0xa106,
3557 0x00c0, 0x7e60, 0x8210, 0x8318, 0x00f0, 0x7e55, 0xa006, 0x007c,
3558 0x2304, 0xa102, 0x0048, 0x7e68, 0x2001, 0x0001, 0x0078, 0x7e6a,
3559 0x2001, 0x0000, 0xa18d, 0x0001, 0x007c, 0x6004, 0xa08a, 0x0044,
3560 0x10c8, 0x1328, 0x1078, 0x8c27, 0x0040, 0x7e7c, 0x1078, 0x8c3b,
3561 0x0040, 0x7e89, 0x0078, 0x7e82, 0x1078, 0x2839, 0x1078, 0x8c3b,
3562 0x0040, 0x7e89, 0x1078, 0x6010, 0x1078, 0x753d, 0x1078, 0x6109,
3563 0x007c, 0x1078, 0x7a05, 0x0078, 0x7e82, 0xa182, 0x0040, 0x0079,
3564 0x7e91, 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea4,
3565 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea6, 0x7ea6, 0x7ea6, 0x7ea6,
3566 0x7ea4, 0x7ea4, 0x7ea4, 0x7ea6, 0x1078, 0x1328, 0x600b, 0xffff,
3567 0x6003, 0x0001, 0x6106, 0x1078, 0x5bf8, 0x127e, 0x2091, 0x8000,
3568 0x1078, 0x6109, 0x127f, 0x007c, 0xa186, 0x0013, 0x00c0, 0x7ebd,
3569 0x6004, 0xa082, 0x0040, 0x0079, 0x7f48, 0xa186, 0x0027, 0x00c0,
3570 0x7edf, 0x1078, 0x6010, 0x1078, 0x2813, 0x0d7e, 0x6110, 0x2168,
3571 0x1078, 0x8a44, 0x0040, 0x7ed9, 0x6837, 0x0103, 0x684b, 0x0029,
3572 0x6847, 0x0000, 0x694c, 0xc1c5, 0x694e, 0x1078, 0x4982, 0x1078,
3573 0x8bf4, 0x0d7f, 0x1078, 0x753d, 0x1078, 0x6109, 0x007c, 0xa186,
3574 0x0014, 0x00c0, 0x7ee8, 0x6004, 0xa082, 0x0040, 0x0079, 0x7f10,
3575 0xa186, 0x0046, 0x0040, 0x7ef4, 0xa186, 0x0045, 0x0040, 0x7ef4,
3576 0xa186, 0x0047, 0x10c0, 0x1328, 0x2001, 0x0109, 0x2004, 0xd084,
3577 0x0040, 0x7f0d, 0x127e, 0x2091, 0x2200, 0x007e, 0x017e, 0x027e,
3578 0x1078, 0x5ad2, 0x027f, 0x017f, 0x007f, 0x127f, 0x6000, 0xa086,
3579 0x0002, 0x00c0, 0x7f0d, 0x0078, 0x7f81, 0x1078, 0x7583, 0x007c,
3580 0x7f25, 0x7f23, 0x7f23, 0x7f23, 0x7f23, 0x7f23, 0x7f23, 0x7f23,
3581 0x7f23, 0x7f23, 0x7f23, 0x7f41, 0x7f41, 0x7f41, 0x7f41, 0x7f23,
3582 0x7f41, 0x7f23, 0x7f41, 0x1078, 0x1328, 0x1078, 0x6010, 0x0d7e,
3583 0x6110, 0x2168, 0x1078, 0x8a44, 0x0040, 0x7f3b, 0x6837, 0x0103,
3584 0x684b, 0x0006, 0x6847, 0x0000, 0x6850, 0xc0ec, 0x6852, 0x1078,
3585 0x4982, 0x1078, 0x8bf4, 0x0d7f, 0x1078, 0x753d, 0x1078, 0x6109,
3586 0x007c, 0x1078, 0x6010, 0x1078, 0x753d, 0x1078, 0x6109, 0x007c,
3587 0x7f5d, 0x7f5b, 0x7f5b, 0x7f5b, 0x7f5b, 0x7f5b, 0x7f5b, 0x7f5b,
3588 0x7f5b, 0x7f5b, 0x7f5b, 0x7f6f, 0x7f6f, 0x7f6f, 0x7f6f, 0x7f5b,
3589 0x7f7a, 0x7f5b, 0x7f6f, 0x1078, 0x1328, 0x1078, 0x6010, 0x2001,
3590 0xa5a2, 0x2004, 0x603e, 0x6003, 0x0002, 0x1078, 0x6109, 0x6010,
3591 0xa088, 0x0013, 0x2104, 0xa085, 0x0400, 0x200a, 0x007c, 0x1078,
3592 0x6010, 0x2001, 0xa5a2, 0x2004, 0x603e, 0x6003, 0x000f, 0x1078,
3593 0x6109, 0x007c, 0x1078, 0x6010, 0x1078, 0x753d, 0x1078, 0x6109,
3594 0x007c, 0xa182, 0x0040, 0x0079, 0x7f85, 0x7f98, 0x7f98, 0x7f98,
3595 0x7f98, 0x7f98, 0x7f9a, 0x8095, 0x80b7, 0x7f98, 0x7f98, 0x7f98,
3596 0x7f98, 0x7f98, 0x7f98, 0x7f98, 0x7f98, 0x7f98, 0x7f98, 0x7f98,
3597 0x1078, 0x1328, 0x0e7e, 0x0d7e, 0x603f, 0x0000, 0x2071, 0xa880,
3598 0x7124, 0x610a, 0x2071, 0xa88c, 0x6110, 0x2168, 0x7614, 0xa6b4,
3599 0x0fff, 0x86ff, 0x0040, 0x8058, 0xa68c, 0x0c00, 0x0040, 0x7fd1,
3600 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f, 0x0040, 0x7fcd, 0x684c,
3601 0xd0ac, 0x0040, 0x7fcd, 0x6024, 0xd0dc, 0x00c0, 0x7fcd, 0x6850,
3602 0xd0bc, 0x00c0, 0x7fcd, 0x7318, 0x6814, 0xa306, 0x00c0, 0x806f,
3603 0x731c, 0x6810, 0xa306, 0x00c0, 0x806f, 0x7318, 0x6b62, 0x731c,
3604 0x6b5e, 0xa68c, 0x00ff, 0xa186, 0x0002, 0x0040, 0x8004, 0xa186,
3605 0x0028, 0x00c0, 0x7fe1, 0x1078, 0x8c15, 0x684b, 0x001c, 0x0078,
3606 0x8006, 0xd6dc, 0x0040, 0x7ffd, 0x684b, 0x0015, 0x684c, 0xd0ac,
3607 0x0040, 0x7ffb, 0x6914, 0x6a10, 0x2100, 0xa205, 0x0040, 0x7ffb,
3608 0x7018, 0xa106, 0x00c0, 0x7ff8, 0x701c, 0xa206, 0x0040, 0x7ffb,
3609 0x6962, 0x6a5e, 0xc6dc, 0x0078, 0x8006, 0xd6d4, 0x0040, 0x8004,
3610 0x684b, 0x0007, 0x0078, 0x8006, 0x684b, 0x0000, 0x6837, 0x0103,
3611 0x6e46, 0xa01e, 0xd6c4, 0x0040, 0x802f, 0xa686, 0x0100, 0x00c0,
3612 0x801a, 0x2001, 0xa899, 0x2004, 0xa005, 0x00c0, 0x801a, 0xc6c4,
3613 0x0078, 0x7fa9, 0x7328, 0x732c, 0x6b56, 0x83ff, 0x0040, 0x802f,
3614 0xa38a, 0x0009, 0x0048, 0x8026, 0x2019, 0x0008, 0x037e, 0x2308,
3615 0x2019, 0xa898, 0xad90, 0x0019, 0x1078, 0x8739, 0x037f, 0xd6cc,
3616 0x0040, 0x8085, 0x7124, 0x695a, 0x81ff, 0x0040, 0x8085, 0xa192,
3617 0x0021, 0x00c8, 0x8046, 0x2071, 0xa898, 0x831c, 0x2300, 0xae18,
3618 0xad90, 0x001d, 0x1078, 0x8739, 0x0078, 0x8085, 0x6838, 0xd0fc,
3619 0x0040, 0x804f, 0x2009, 0x0020, 0x695a, 0x0078, 0x803b, 0x0f7e,
3620 0x2d78, 0x1078, 0x86d1, 0x0f7f, 0x1078, 0x8726, 0x0078, 0x8087,
3621 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f, 0x0040, 0x8075, 0x684c,
3622 0xd0ac, 0x0040, 0x8075, 0x6024, 0xd0dc, 0x00c0, 0x8075, 0x6850,
3623 0xd0bc, 0x00c0, 0x8075, 0x684c, 0xd0f4, 0x00c0, 0x8075, 0x1078,
3624 0x8cfa, 0x0d7f, 0x0e7f, 0x0078, 0x8094, 0x684b, 0x0000, 0x6837,
3625 0x0103, 0x6e46, 0x684c, 0xd0ac, 0x0040, 0x8085, 0x6810, 0x6914,
3626 0xa115, 0x0040, 0x8085, 0x1078, 0x8233, 0x1078, 0x4982, 0x6218,
3627 0x2268, 0x6a3c, 0x8211, 0x6a3e, 0x1078, 0x8cc4, 0x0d7f, 0x0e7f,
3628 0x00c0, 0x8094, 0x1078, 0x753d, 0x007c, 0x0f7e, 0x6003, 0x0003,
3629 0x2079, 0xa88c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x6010, 0x2078,
3630 0x784c, 0xd0ac, 0x0040, 0x80a8, 0x6003, 0x0002, 0x0f7f, 0x007c,
3631 0x7c12, 0x7b16, 0x7e0a, 0x7d0e, 0x0f7f, 0x603f, 0x0000, 0x2c10,
3632 0x1078, 0x1cab, 0x1078, 0x5c64, 0x1078, 0x61d3, 0x007c, 0x2001,
3633 0xa5a2, 0x2004, 0x603e, 0x6003, 0x0004, 0x6110, 0x20e1, 0x0005,
3634 0x3d18, 0x3e20, 0x2c10, 0x1078, 0x15ec, 0x007c, 0xa182, 0x0040,
3635 0x0079, 0x80ca, 0x80dd, 0x80dd, 0x80dd, 0x80dd, 0x80dd, 0x80df,
3636 0x8182, 0x80dd, 0x80dd, 0x8198, 0x8209, 0x80dd, 0x80dd, 0x80dd,
3637 0x80dd, 0x8218, 0x80dd, 0x80dd, 0x80dd, 0x1078, 0x1328, 0x077e,
3638 0x0f7e, 0x0e7e, 0x0d7e, 0x2071, 0xa88c, 0x6110, 0x2178, 0x7614,
3639 0xa6b4, 0x0fff, 0x7e46, 0x7f4c, 0xc7e5, 0x7f4e, 0x6218, 0x2268,
3640 0x6a3c, 0x8211, 0x6a3e, 0x86ff, 0x0040, 0x817d, 0xa694, 0xff00,
3641 0xa284, 0x0c00, 0x0040, 0x8100, 0x7018, 0x7862, 0x701c, 0x785e,
3642 0xa284, 0x0300, 0x0040, 0x817d, 0x1078, 0x1381, 0x1040, 0x1328,
3643 0x2d00, 0x784a, 0x7f4c, 0xc7cd, 0x7f4e, 0x6837, 0x0103, 0x7838,
3644 0x683a, 0x783c, 0x683e, 0x7840, 0x6842, 0x6e46, 0xa68c, 0x0c00,
3645 0x0040, 0x811e, 0x7318, 0x6b62, 0x731c, 0x6b5e, 0xa68c, 0x00ff,
3646 0xa186, 0x0002, 0x0040, 0x813a, 0xa186, 0x0028, 0x00c0, 0x812c,
3647 0x684b, 0x001c, 0x0078, 0x813c, 0xd6dc, 0x0040, 0x8133, 0x684b,
3648 0x0015, 0x0078, 0x813c, 0xd6d4, 0x0040, 0x813a, 0x684b, 0x0007,
3649 0x0078, 0x813c, 0x684b, 0x0000, 0x6f4e, 0x7850, 0x6852, 0x7854,
3650 0x6856, 0xa01e, 0xd6c4, 0x0040, 0x815a, 0x7328, 0x732c, 0x6b56,
3651 0x83ff, 0x0040, 0x815a, 0xa38a, 0x0009, 0x0048, 0x8151, 0x2019,
3652 0x0008, 0x037e, 0x2308, 0x2019, 0xa898, 0xad90, 0x0019, 0x1078,
3653 0x8739, 0x037f, 0xd6cc, 0x0040, 0x817d, 0x7124, 0x695a, 0x81ff,
3654 0x0040, 0x817d, 0xa192, 0x0021, 0x00c8, 0x8171, 0x2071, 0xa898,
3655 0x831c, 0x2300, 0xae18, 0xad90, 0x001d, 0x1078, 0x8739, 0x0078,
3656 0x817d, 0x7838, 0xd0fc, 0x0040, 0x817a, 0x2009, 0x0020, 0x695a,
3657 0x0078, 0x8166, 0x2d78, 0x1078, 0x86d1, 0x0d7f, 0x0e7f, 0x0f7f,
3658 0x077f, 0x007c, 0x0f7e, 0x6003, 0x0003, 0x2079, 0xa88c, 0x7c04,
3659 0x7b00, 0x7e0c, 0x7d08, 0x6010, 0x2078, 0x7c12, 0x7b16, 0x7e0a,
3660 0x7d0e, 0x0f7f, 0x2c10, 0x1078, 0x1cab, 0x1078, 0x6c26, 0x007c,
3661 0x0d7e, 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f, 0x0040, 0x81a4,
3662 0x2001, 0xa5a2, 0x2004, 0x603e, 0x6003, 0x0002, 0x1078, 0x60b8,
3663 0x1078, 0x61d3, 0x6110, 0x2168, 0x694c, 0xd1e4, 0x0040, 0x8207,
3664 0xd1cc, 0x0040, 0x81de, 0x6948, 0x6838, 0xd0fc, 0x0040, 0x81d6,
3665 0x017e, 0x684c, 0x007e, 0x6850, 0x007e, 0xad90, 0x000d, 0xa198,
3666 0x000d, 0x2009, 0x0020, 0x157e, 0x21a8, 0x2304, 0x2012, 0x8318,
3667 0x8210, 0x00f0, 0x81c5, 0x157f, 0x007f, 0x6852, 0x007f, 0x684e,
3668 0x017f, 0x2168, 0x1078, 0x13aa, 0x0078, 0x8201, 0x017e, 0x1078,
3669 0x13aa, 0x0d7f, 0x1078, 0x8726, 0x0078, 0x8201, 0x6837, 0x0103,
3670 0x6944, 0xa184, 0x00ff, 0xa0b6, 0x0002, 0x0040, 0x81fd, 0xa086,
3671 0x0028, 0x00c0, 0x81ef, 0x684b, 0x001c, 0x0078, 0x81ff, 0xd1dc,
3672 0x0040, 0x81f6, 0x684b, 0x0015, 0x0078, 0x81ff, 0xd1d4, 0x0040,
3673 0x81fd, 0x684b, 0x0007, 0x0078, 0x81ff, 0x684b, 0x0000, 0x1078,
3674 0x4982, 0x1078, 0x8cc4, 0x00c0, 0x8207, 0x1078, 0x753d, 0x0d7f,
3675 0x007c, 0x2019, 0x0001, 0x1078, 0x6e6c, 0x6003, 0x0002, 0x2001,
3676 0xa5a2, 0x2004, 0x603e, 0x1078, 0x60b8, 0x1078, 0x61d3, 0x007c,
3677 0x1078, 0x60b8, 0x1078, 0x2813, 0x0d7e, 0x6110, 0x2168, 0x1078,
3678 0x8a44, 0x0040, 0x822d, 0x6837, 0x0103, 0x684b, 0x0029, 0x6847,
3679 0x0000, 0x1078, 0x4982, 0x1078, 0x8bf4, 0x0d7f, 0x1078, 0x753d,
3680 0x1078, 0x61d3, 0x007c, 0x684b, 0x0015, 0xd1fc, 0x0040, 0x823f,
3681 0x684b, 0x0007, 0x8002, 0x8000, 0x810a, 0xa189, 0x0000, 0x6962,
3682 0x685e, 0x007c, 0xa182, 0x0040, 0x0079, 0x8246, 0x8259, 0x8259,
3683 0x8259, 0x8259, 0x8259, 0x825b, 0x8259, 0x8333, 0x833f, 0x8259,
3684 0x8259, 0x8259, 0x8259, 0x8259, 0x8259, 0x8259, 0x8259, 0x8259,
3685 0x8259, 0x1078, 0x1328, 0x077e, 0x0f7e, 0x0e7e, 0x0d7e, 0x2071,
3686 0xa88c, 0x6110, 0x2178, 0x7614, 0xa6b4, 0x0fff, 0x0f7e, 0x2c78,
3687 0x1078, 0x4893, 0x0f7f, 0x0040, 0x827e, 0xa684, 0x00ff, 0x00c0,
3688 0x827e, 0x6024, 0xd0f4, 0x00c0, 0x827a, 0x7808, 0xa086, 0x0000,
3689 0x00c0, 0x827e, 0x1078, 0x8cfa, 0x0078, 0x832e, 0x7e46, 0x7f4c,
3690 0xc7e5, 0x7f4e, 0x6218, 0x2268, 0x6a3c, 0x8211, 0x6a3e, 0x86ff,
3691 0x0040, 0x8323, 0xa694, 0xff00, 0xa284, 0x0c00, 0x0040, 0x8294,
3692 0x7018, 0x7862, 0x701c, 0x785e, 0xa284, 0x0300, 0x0040, 0x8320,
3693 0xa686, 0x0100, 0x00c0, 0x82a6, 0x2001, 0xa899, 0x2004, 0xa005,
3694 0x00c0, 0x82a6, 0xc6c4, 0x7e46, 0x0078, 0x8287, 0x1078, 0x1381,
3695 0x1040, 0x1328, 0x2d00, 0x784a, 0x7f4c, 0xa7bd, 0x0200, 0x7f4e,
3696 0x6837, 0x0103, 0x7838, 0x683a, 0x783c, 0x683e, 0x7840, 0x6842,
3697 0x6e46, 0xa68c, 0x0c00, 0x0040, 0x82c1, 0x7318, 0x6b62, 0x731c,
3698 0x6b5e, 0xa68c, 0x00ff, 0xa186, 0x0002, 0x0040, 0x82dd, 0xa186,
3699 0x0028, 0x00c0, 0x82cf, 0x684b, 0x001c, 0x0078, 0x82df, 0xd6dc,
3700 0x0040, 0x82d6, 0x684b, 0x0015, 0x0078, 0x82df, 0xd6d4, 0x0040,
3701 0x82dd, 0x684b, 0x0007, 0x0078, 0x82df, 0x684b, 0x0000, 0x6f4e,
3702 0x7850, 0x6852, 0x7854, 0x6856, 0xa01e, 0xd6c4, 0x0040, 0x82fd,
3703 0x7328, 0x732c, 0x6b56, 0x83ff, 0x0040, 0x82fd, 0xa38a, 0x0009,
3704 0x0048, 0x82f4, 0x2019, 0x0008, 0x037e, 0x2308, 0x2019, 0xa898,
3705 0xad90, 0x0019, 0x1078, 0x8739, 0x037f, 0xd6cc, 0x0040, 0x8320,
3706 0x7124, 0x695a, 0x81ff, 0x0040, 0x8320, 0xa192, 0x0021, 0x00c8,
3707 0x8314, 0x2071, 0xa898, 0x831c, 0x2300, 0xae18, 0xad90, 0x001d,
3708 0x1078, 0x8739, 0x0078, 0x8320, 0x7838, 0xd0fc, 0x0040, 0x831d,
3709 0x2009, 0x0020, 0x695a, 0x0078, 0x8309, 0x2d78, 0x1078, 0x86d1,
3710 0xd6dc, 0x00c0, 0x8326, 0xa006, 0x0078, 0x832c, 0x2001, 0x0001,
3711 0x2071, 0xa88c, 0x7218, 0x731c, 0x1078, 0x1645, 0x0d7f, 0x0e7f,
3712 0x0f7f, 0x077f, 0x007c, 0x2001, 0xa5a2, 0x2004, 0x603e, 0x20e1,
3713 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x1078, 0x15ec, 0x007c, 0x2001,
3714 0xa5a2, 0x2004, 0x603e, 0x0d7e, 0x6003, 0x0002, 0x6110, 0x2168,
3715 0x694c, 0xd1e4, 0x0040, 0x846b, 0x603f, 0x0000, 0x0f7e, 0x2c78,
3716 0x1078, 0x4893, 0x0f7f, 0x0040, 0x8385, 0x6814, 0x6910, 0xa115,
3717 0x0040, 0x8385, 0x6a60, 0xa206, 0x00c0, 0x8362, 0x685c, 0xa106,
3718 0x0040, 0x8385, 0x684c, 0xc0e4, 0x684e, 0x6847, 0x0000, 0x6863,
3719 0x0000, 0x685f, 0x0000, 0x6024, 0xd0f4, 0x00c0, 0x837a, 0x697c,
3720 0x6810, 0xa102, 0x603a, 0x6980, 0x6814, 0xa103, 0x6036, 0x6024,
3721 0xc0f5, 0x6026, 0x0d7e, 0x6018, 0x2068, 0x683c, 0x8000, 0x683e,
3722 0x0d7f, 0x1078, 0x8cfa, 0x0078, 0x846b, 0x694c, 0xd1cc, 0x0040,
3723 0x8430, 0x6948, 0x6838, 0xd0fc, 0x0040, 0x83ea, 0x017e, 0x684c,
3724 0x007e, 0x6850, 0x007e, 0x0f7e, 0x2178, 0x7944, 0xa184, 0x00ff,
3725 0xa0b6, 0x0002, 0x0040, 0x83bf, 0xa086, 0x0028, 0x00c0, 0x83a6,
3726 0x684b, 0x001c, 0x784b, 0x001c, 0x0078, 0x83ca, 0xd1dc, 0x0040,
3727 0x83b6, 0x684b, 0x0015, 0x784b, 0x0015, 0x1078, 0x8ea5, 0x0040,
3728 0x83b4, 0x7944, 0xc1dc, 0x7946, 0x0078, 0x83ca, 0xd1d4, 0x0040,
3729 0x83bf, 0x684b, 0x0007, 0x784b, 0x0007, 0x0078, 0x83ca, 0x684c,
3730 0xd0ac, 0x0040, 0x83ca, 0x6810, 0x6914, 0xa115, 0x0040, 0x83ca,
3731 0x1078, 0x8233, 0x6848, 0x784a, 0x6860, 0x7862, 0x685c, 0x785e,
3732 0xad90, 0x000d, 0xaf98, 0x000d, 0x2009, 0x0020, 0x157e, 0x21a8,
3733 0x2304, 0x2012, 0x8318, 0x8210, 0x00f0, 0x83d8, 0x157f, 0x0f7f,
3734 0x007f, 0x6852, 0x007f, 0x684e, 0x017f, 0x2168, 0x1078, 0x13aa,
3735 0x0078, 0x8465, 0x017e, 0x0f7e, 0x2178, 0x7944, 0xa184, 0x00ff,
3736 0xa0b6, 0x0002, 0x0040, 0x8417, 0xa086, 0x0028, 0x00c0, 0x83fe,
3737 0x684b, 0x001c, 0x784b, 0x001c, 0x0078, 0x8422, 0xd1dc, 0x0040,
3738 0x840e, 0x684b, 0x0015, 0x784b, 0x0015, 0x1078, 0x8ea5, 0x0040,
3739 0x840c, 0x7944, 0xc1dc, 0x7946, 0x0078, 0x8422, 0xd1d4, 0x0040,
3740 0x8417, 0x684b, 0x0007, 0x784b, 0x0007, 0x0078, 0x8422, 0x684c,
3741 0xd0ac, 0x0040, 0x8422, 0x6810, 0x6914, 0xa115, 0x0040, 0x8422,
3742 0x1078, 0x8233, 0x6860, 0x7862, 0x685c, 0x785e, 0x684c, 0x784e,
3743 0x0f7f, 0x1078, 0x13aa, 0x0d7f, 0x1078, 0x8726, 0x0078, 0x8465,
3744 0x6837, 0x0103, 0x6944, 0xa184, 0x00ff, 0xa0b6, 0x0002, 0x0040,
3745 0x8456, 0xa086, 0x0028, 0x00c0, 0x8441, 0x684b, 0x001c, 0x0078,
3746 0x8463, 0xd1dc, 0x0040, 0x844f, 0x684b, 0x0015, 0x1078, 0x8ea5,
3747 0x0040, 0x844d, 0x6944, 0xc1dc, 0x6946, 0x0078, 0x8463, 0xd1d4,
3748 0x0040, 0x8456, 0x684b, 0x0007, 0x0078, 0x8463, 0x684b, 0x0000,
3749 0x684c, 0xd0ac, 0x0040, 0x8463, 0x6810, 0x6914, 0xa115, 0x0040,
3750 0x8463, 0x1078, 0x8233, 0x1078, 0x4982, 0x1078, 0x8cc4, 0x00c0,
3751 0x846b, 0x1078, 0x753d, 0x0d7f, 0x007c, 0x1078, 0x6010, 0x0078,
3752 0x8473, 0x1078, 0x60b8, 0x1078, 0x8a44, 0x0040, 0x8492, 0x0d7e,
3753 0x6110, 0x2168, 0x6837, 0x0103, 0x2009, 0xa30c, 0x210c, 0xd18c,
3754 0x00c0, 0x849d, 0xd184, 0x00c0, 0x8499, 0x6108, 0x694a, 0xa18e,
3755 0x0029, 0x00c0, 0x848d, 0x1078, 0xa181, 0x6847, 0x0000, 0x1078,
3756 0x4982, 0x0d7f, 0x1078, 0x753d, 0x1078, 0x6109, 0x1078, 0x61d3,
3757 0x007c, 0x684b, 0x0004, 0x0078, 0x848d, 0x684b, 0x0004, 0x0078,
3758 0x848d, 0xa182, 0x0040, 0x0079, 0x84a5, 0x84b8, 0x84b8, 0x84b8,
3759 0x84b8, 0x84b8, 0x84ba, 0x84b8, 0x84bd, 0x84b8, 0x84b8, 0x84b8,
3760 0x84b8, 0x84b8, 0x84b8, 0x84b8, 0x84b8, 0x84b8, 0x84b8, 0x84b8,
3761 0x1078, 0x1328, 0x1078, 0x753d, 0x007c, 0x007e, 0x027e, 0xa016,
3762 0x1078, 0x15ec, 0x027f, 0x007f, 0x007c, 0xa182, 0x0085, 0x0079,
3763 0x84c9, 0x84d2, 0x84d0, 0x84d0, 0x84de, 0x84d0, 0x84d0, 0x84d0,
3764 0x1078, 0x1328, 0x6003, 0x0001, 0x6106, 0x1078, 0x5bf8, 0x127e,
3765 0x2091, 0x8000, 0x1078, 0x6109, 0x127f, 0x007c, 0x027e, 0x057e,
3766 0x0d7e, 0x0e7e, 0x2071, 0xa880, 0x7224, 0x6212, 0x7220, 0x1078,
3767 0x8a30, 0x0040, 0x8503, 0x2268, 0x6800, 0xa086, 0x0000, 0x0040,
3768 0x8503, 0x6018, 0x6d18, 0xa52e, 0x00c0, 0x8503, 0x0c7e, 0x2d60,
3769 0x1078, 0x874a, 0x0c7f, 0x0040, 0x8503, 0x6803, 0x0002, 0x6007,
3770 0x0086, 0x0078, 0x8505, 0x6007, 0x0087, 0x6003, 0x0001, 0x1078,
3771 0x5bf8, 0x1078, 0x6109, 0x0f7e, 0x2278, 0x1078, 0x4893, 0x0f7f,
3772 0x0040, 0x851d, 0x6824, 0xd0ec, 0x0040, 0x851d, 0x0c7e, 0x2260,
3773 0x603f, 0x0000, 0x1078, 0x8cfa, 0x0c7f, 0x0e7f, 0x0d7f, 0x057f,
3774 0x027f, 0x007c, 0xa186, 0x0013, 0x00c0, 0x8533, 0x6004, 0xa08a,
3775 0x0085, 0x1048, 0x1328, 0xa08a, 0x008c, 0x10c8, 0x1328, 0xa082,
3776 0x0085, 0x0079, 0x8542, 0xa186, 0x0027, 0x0040, 0x853b, 0xa186,
3777 0x0014, 0x10c0, 0x1328, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078,
3778 0x6109, 0x007c, 0x8549, 0x854b, 0x854b, 0x8549, 0x8549, 0x8549,
3779 0x8549, 0x1078, 0x1328, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078,
3780 0x6109, 0x007c, 0xa186, 0x0013, 0x00c0, 0x855c, 0x6004, 0xa082,
3781 0x0085, 0x2008, 0x0078, 0x8597, 0xa186, 0x0027, 0x00c0, 0x857f,
3782 0x1078, 0x6010, 0x1078, 0x2813, 0x0d7e, 0x6010, 0x2068, 0x1078,
3783 0x8a44, 0x0040, 0x8575, 0x6837, 0x0103, 0x6847, 0x0000, 0x684b,
3784 0x0029, 0x1078, 0x4982, 0x1078, 0x8bf4, 0x0d7f, 0x1078, 0x753d,
3785 0x1078, 0x6109, 0x007c, 0x1078, 0x7583, 0x0078, 0x857a, 0xa186,
3786 0x0014, 0x00c0, 0x857b, 0x1078, 0x6010, 0x0d7e, 0x6010, 0x2068,
3787 0x1078, 0x8a44, 0x0040, 0x8575, 0x6837, 0x0103, 0x6847, 0x0000,
3788 0x684b, 0x0006, 0x6850, 0xc0ec, 0x6852, 0x0078, 0x8571, 0x0079,
3789 0x8599, 0x85a2, 0x85a0, 0x85a0, 0x85a0, 0x85a0, 0x85a0, 0x85bd,
3790 0x1078, 0x1328, 0x1078, 0x6010, 0x6030, 0xa08c, 0xff00, 0x810f,
3791 0xa186, 0x0039, 0x0040, 0x85b0, 0xa186, 0x0035, 0x00c0, 0x85b4,
3792 0x2001, 0xa5a0, 0x0078, 0x85b6, 0x2001, 0xa5a1, 0x2004, 0x6016,
3793 0x6003, 0x000c, 0x1078, 0x6109, 0x007c, 0x1078, 0x6010, 0x6030,
3794 0xa08c, 0xff00, 0x810f, 0xa186, 0x0039, 0x0040, 0x85cb, 0xa186,
3795 0x0035, 0x00c0, 0x85cf, 0x2001, 0xa5a0, 0x0078, 0x85d1, 0x2001,
3796 0xa5a1, 0x2004, 0x6016, 0x6003, 0x000e, 0x1078, 0x6109, 0x007c,
3797 0xa182, 0x008c, 0x00c8, 0x85e2, 0xa182, 0x0085, 0x0048, 0x85e2,
3798 0x0079, 0x85e5, 0x1078, 0x7583, 0x007c, 0x85ec, 0x85ec, 0x85ec,
3799 0x85ec, 0x85ee, 0x8643, 0x85ec, 0x1078, 0x1328, 0x0f7e, 0x2c78,
3800 0x1078, 0x4893, 0x0f7f, 0x0040, 0x8601, 0x6030, 0xa08c, 0xff00,
3801 0x810f, 0xa186, 0x0039, 0x0040, 0x865a, 0xa186, 0x0035, 0x0040,
3802 0x865a, 0x0d7e, 0x1078, 0x8bf4, 0x1078, 0x8a44, 0x0040, 0x8625,
3803 0x6010, 0x2068, 0x6837, 0x0103, 0x6850, 0xd0b4, 0x0040, 0x8616,
3804 0x684b, 0x0006, 0xc0ec, 0x6852, 0x0078, 0x8621, 0xd0bc, 0x0040,
3805 0x861d, 0x684b, 0x0002, 0x0078, 0x8621, 0x684b, 0x0005, 0x1078,
3806 0x8cc0, 0x6847, 0x0000, 0x1078, 0x4982, 0x2c68, 0x1078, 0x74d7,
3807 0x0040, 0x863e, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0xa88e,
3808 0x210c, 0x6136, 0x2009, 0xa88f, 0x210c, 0x613a, 0x6918, 0x611a,
3809 0x6920, 0x6122, 0x601f, 0x0001, 0x1078, 0x5bf8, 0x2d60, 0x1078,
3810 0x753d, 0x0d7f, 0x007c, 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f,
3811 0x0040, 0x8680, 0x6030, 0xa08c, 0xff00, 0x810f, 0xa186, 0x0035,
3812 0x0040, 0x865a, 0xa186, 0x001e, 0x0040, 0x865a, 0xa186, 0x0039,
3813 0x00c0, 0x8680, 0x0d7e, 0x2c68, 0x1078, 0x8ef5, 0x00c0, 0x86a4,
3814 0x1078, 0x74d7, 0x0040, 0x867d, 0x6106, 0x6003, 0x0001, 0x601f,
3815 0x0001, 0x6918, 0x611a, 0x6928, 0x612a, 0x692c, 0x612e, 0x6930,
3816 0xa18c, 0x00ff, 0x6132, 0x6934, 0x6136, 0x6938, 0x613a, 0x6920,
3817 0x6122, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x2d60, 0x0078, 0x86a4,
3818 0x0d7e, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x86a4, 0x6837,
3819 0x0103, 0x6850, 0xd0b4, 0x0040, 0x8693, 0xc0ec, 0x6852, 0x684b,
3820 0x0006, 0x0078, 0x869e, 0xd0bc, 0x0040, 0x869a, 0x684b, 0x0002,
3821 0x0078, 0x869e, 0x684b, 0x0005, 0x1078, 0x8cc0, 0x6847, 0x0000,
3822 0x1078, 0x4982, 0x1078, 0x8bf4, 0x0d7f, 0x1078, 0x753d, 0x007c,
3823 0x017e, 0x0d7e, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x86b8,
3824 0x6837, 0x0103, 0x684b, 0x0028, 0x6847, 0x0000, 0x1078, 0x4982,
3825 0x0d7f, 0x017f, 0xa186, 0x0013, 0x0040, 0x86ca, 0xa186, 0x0014,
3826 0x0040, 0x86ca, 0xa186, 0x0027, 0x0040, 0x86ca, 0x1078, 0x7583,
3827 0x0078, 0x86d0, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078, 0x6109,
3828 0x007c, 0x057e, 0x067e, 0x0d7e, 0x0f7e, 0x2029, 0x0001, 0xa182,
3829 0x0101, 0x00c8, 0x86dd, 0x0078, 0x86df, 0x2009, 0x0100, 0x2130,
3830 0x2069, 0xa898, 0x831c, 0x2300, 0xad18, 0x2009, 0x0020, 0xaf90,
3831 0x001d, 0x1078, 0x8739, 0xa6b2, 0x0020, 0x7804, 0xa06d, 0x0040,
3832 0x86f3, 0x1078, 0x13aa, 0x1078, 0x1381, 0x0040, 0x871d, 0x8528,
3833 0x6837, 0x0110, 0x683b, 0x0000, 0x2d20, 0x7c06, 0xa68a, 0x003d,
3834 0x00c8, 0x8709, 0x2608, 0xad90, 0x000f, 0x1078, 0x8739, 0x0078,
3835 0x871d, 0xa6b2, 0x003c, 0x2009, 0x003c, 0x2d78, 0xad90, 0x000f,
3836 0x1078, 0x8739, 0x0078, 0x86f3, 0x0f7f, 0x852f, 0xa5ad, 0x0003,
3837 0x7d36, 0xa5ac, 0x0000, 0x0078, 0x8722, 0x0f7f, 0x852f, 0xa5ad,
3838 0x0003, 0x7d36, 0x0d7f, 0x067f, 0x057f, 0x007c, 0x0f7e, 0x8dff,
3839 0x0040, 0x8737, 0x6804, 0xa07d, 0x0040, 0x8735, 0x6807, 0x0000,
3840 0x1078, 0x4982, 0x2f68, 0x0078, 0x872a, 0x1078, 0x4982, 0x0f7f,
3841 0x007c, 0x157e, 0xa184, 0x0001, 0x0040, 0x873f, 0x8108, 0x810c,
3842 0x21a8, 0x2304, 0x8007, 0x2012, 0x8318, 0x8210, 0x00f0, 0x8741,
3843 0x157f, 0x007c, 0x067e, 0x127e, 0x2091, 0x8000, 0x2031, 0x0001,
3844 0x601c, 0xa084, 0x000f, 0x1079, 0x8766, 0x127f, 0x067f, 0x007c,
3845 0x127e, 0x2091, 0x8000, 0x067e, 0x2031, 0x0000, 0x601c, 0xa084,
3846 0x000f, 0x1079, 0x8766, 0x067f, 0x127f, 0x007c, 0x8780, 0x876e,
3847 0x877b, 0x879c, 0x876e, 0x877b, 0x879c, 0x877b, 0x1078, 0x1328,
3848 0x037e, 0x2019, 0x0010, 0x1078, 0x9a6a, 0x601f, 0x0006, 0x6003,
3849 0x0007, 0x037f, 0x007c, 0xa006, 0x007c, 0xa085, 0x0001, 0x007c,
3850 0x0d7e, 0x86ff, 0x00c0, 0x8797, 0x6010, 0x2068, 0x1078, 0x8a44,
3851 0x0040, 0x8799, 0xa00e, 0x2001, 0x0005, 0x1078, 0x4a60, 0x1078,
3852 0x8cc0, 0x1078, 0x4982, 0x1078, 0x753d, 0xa085, 0x0001, 0x0d7f,
3853 0x007c, 0xa006, 0x0078, 0x8797, 0x6000, 0xa08a, 0x0010, 0x10c8,
3854 0x1328, 0x1079, 0x87a4, 0x007c, 0x87b4, 0x87d4, 0x87b6, 0x87f7,
3855 0x87d0, 0x87b4, 0x877b, 0x8780, 0x8780, 0x877b, 0x877b, 0x877b,
3856 0x877b, 0x877b, 0x877b, 0x877b, 0x1078, 0x1328, 0x86ff, 0x00c0,
3857 0x87cd, 0x0d7e, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x87c2,
3858 0x1078, 0x8cc0, 0x0d7f, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f,
3859 0x0002, 0x1078, 0x5bf8, 0x1078, 0x6109, 0xa085, 0x0001, 0x007c,
3860 0x1078, 0x1749, 0x0078, 0x87b6, 0x0e7e, 0x2071, 0xa5ab, 0x7024,
3861 0xac06, 0x00c0, 0x87dd, 0x1078, 0x6dda, 0x601c, 0xa084, 0x000f,
3862 0xa086, 0x0006, 0x00c0, 0x87ef, 0x087e, 0x097e, 0x2049, 0x0001,
3863 0x2c40, 0x1078, 0x7058, 0x097f, 0x087f, 0x0078, 0x87f1, 0x1078,
3864 0x6cd2, 0x0e7f, 0x00c0, 0x87b6, 0x1078, 0x877b, 0x007c, 0x037e,
3865 0x0e7e, 0x2071, 0xa5ab, 0x703c, 0xac06, 0x00c0, 0x8807, 0x2019,
3866 0x0000, 0x1078, 0x6e6c, 0x0e7f, 0x037f, 0x0078, 0x87b6, 0x1078,
3867 0x719a, 0x0e7f, 0x037f, 0x00c0, 0x87b6, 0x1078, 0x877b, 0x007c,
3868 0x0c7e, 0x601c, 0xa084, 0x000f, 0x1079, 0x8818, 0x0c7f, 0x007c,
3869 0x8827, 0x8895, 0x89cd, 0x8832, 0x8c01, 0x8827, 0x9a5b, 0x753d,
3870 0x8895, 0x1078, 0x8c3b, 0x00c0, 0x8827, 0x1078, 0x7a05, 0x007c,
3871 0x1078, 0x6010, 0x1078, 0x6109, 0x1078, 0x753d, 0x007c, 0x6017,
3872 0x0001, 0x007c, 0x6010, 0xa080, 0x0019, 0x2c02, 0x6000, 0xa08a,
3873 0x0010, 0x10c8, 0x1328, 0x1079, 0x883e, 0x007c, 0x884e, 0x8850,
3874 0x8872, 0x8884, 0x8891, 0x884e, 0x8827, 0x8827, 0x8827, 0x8884,
3875 0x8884, 0x884e, 0x884e, 0x884e, 0x884e, 0x888e, 0x1078, 0x1328,
3876 0x0e7e, 0x6010, 0x2070, 0x7050, 0xc0b5, 0x7052, 0x2071, 0xa5ab,
3877 0x7024, 0xac06, 0x0040, 0x886e, 0x1078, 0x6cd2, 0x6007, 0x0085,
3878 0x6003, 0x000b, 0x601f, 0x0002, 0x2001, 0xa5a1, 0x2004, 0x6016,
3879 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0e7f, 0x007c, 0x6017, 0x0001,
3880 0x0078, 0x886c, 0x0d7e, 0x6010, 0x2068, 0x6850, 0xc0b5, 0x6852,
3881 0x0d7f, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x1078,
3882 0x5bf8, 0x1078, 0x6109, 0x007c, 0x0d7e, 0x6017, 0x0001, 0x6010,
3883 0x2068, 0x6850, 0xc0b5, 0x6852, 0x0d7f, 0x007c, 0x1078, 0x753d,
3884 0x007c, 0x1078, 0x1749, 0x0078, 0x8872, 0x6000, 0xa08a, 0x0010,
3885 0x10c8, 0x1328, 0x1079, 0x889d, 0x007c, 0x88ad, 0x882f, 0x88af,
3886 0x88ad, 0x88af, 0x88af, 0x8828, 0x88ad, 0x8821, 0x8821, 0x88ad,
3887 0x88ad, 0x88ad, 0x88ad, 0x88ad, 0x88ad, 0x1078, 0x1328, 0x0d7e,
3888 0x6018, 0x2068, 0x6804, 0xa084, 0x00ff, 0x0d7f, 0xa08a, 0x000c,
3889 0x10c8, 0x1328, 0x1079, 0x88bd, 0x007c, 0x88c9, 0x8971, 0x88cb,
3890 0x890b, 0x88cb, 0x890b, 0x88cb, 0x88d8, 0x88c9, 0x890b, 0x88c9,
3891 0x88f5, 0x1078, 0x1328, 0x6004, 0xa08e, 0x0016, 0x0040, 0x8906,
3892 0xa08e, 0x0004, 0x0040, 0x8906, 0xa08e, 0x0002, 0x0040, 0x8906,
3893 0x6004, 0x1078, 0x8c3b, 0x0040, 0x898c, 0xa08e, 0x0021, 0x0040,
3894 0x8990, 0xa08e, 0x0022, 0x0040, 0x898c, 0xa08e, 0x003d, 0x0040,
3895 0x8990, 0xa08e, 0x0039, 0x0040, 0x8994, 0xa08e, 0x0035, 0x0040,
3896 0x8994, 0xa08e, 0x001e, 0x0040, 0x8908, 0xa08e, 0x0001, 0x00c0,
3897 0x8904, 0x0d7e, 0x6018, 0x2068, 0x6804, 0xa084, 0x00ff, 0x0d7f,
3898 0xa086, 0x0006, 0x0040, 0x8906, 0x1078, 0x2813, 0x1078, 0x7a05,
3899 0x1078, 0x8c01, 0x007c, 0x0c7e, 0x0d7e, 0x6104, 0xa186, 0x0016,
3900 0x0040, 0x8961, 0xa186, 0x0002, 0x00c0, 0x8934, 0x6018, 0x2068,
3901 0x68a0, 0xd0bc, 0x00c0, 0x89b8, 0x6840, 0xa084, 0x00ff, 0xa005,
3902 0x0040, 0x8934, 0x8001, 0x6842, 0x6013, 0x0000, 0x601f, 0x0007,
3903 0x6017, 0x0398, 0x1078, 0x74d7, 0x0040, 0x8934, 0x2d00, 0x601a,
3904 0x601f, 0x0001, 0x0078, 0x8961, 0x0d7f, 0x0c7f, 0x6004, 0xa08e,
3905 0x0002, 0x00c0, 0x8952, 0x6018, 0xa080, 0x0028, 0x2004, 0xa086,
3906 0x007e, 0x00c0, 0x8952, 0x2009, 0xa332, 0x2104, 0xc085, 0x200a,
3907 0x0e7e, 0x2071, 0xa300, 0x1078, 0x41f5, 0x0e7f, 0x1078, 0x7a05,
3908 0x0078, 0x8956, 0x1078, 0x7a05, 0x1078, 0x2813, 0x0e7e, 0x127e,
3909 0x2091, 0x8000, 0x1078, 0x2839, 0x127f, 0x0e7f, 0x1078, 0x8c01,
3910 0x007c, 0x2001, 0x0002, 0x1078, 0x443f, 0x6003, 0x0001, 0x6007,
3911 0x0002, 0x1078, 0x5c45, 0x1078, 0x6109, 0x0d7f, 0x0c7f, 0x0078,
3912 0x8960, 0x0c7e, 0x0d7e, 0x6104, 0xa186, 0x0016, 0x0040, 0x8961,
3913 0x6018, 0x2068, 0x6840, 0xa084, 0x00ff, 0xa005, 0x0040, 0x8934,
3914 0x8001, 0x6842, 0x6003, 0x0001, 0x1078, 0x5c45, 0x1078, 0x6109,
3915 0x0d7f, 0x0c7f, 0x0078, 0x8960, 0x1078, 0x7a05, 0x0078, 0x8908,
3916 0x1078, 0x7a28, 0x0078, 0x8908, 0x0d7e, 0x2c68, 0x6104, 0x1078,
3917 0x8ef5, 0x0d7f, 0x0040, 0x89a0, 0x1078, 0x753d, 0x0078, 0x89b7,
3918 0x6004, 0x8007, 0x6130, 0xa18c, 0x00ff, 0xa105, 0x6032, 0x6007,
3919 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x6038, 0x600a, 0x2001,
3920 0xa5a1, 0x2004, 0x6016, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x007c,
3921 0x0d7f, 0x0c7f, 0x1078, 0x7a05, 0x1078, 0x2813, 0x0e7e, 0x127e,
3922 0x2091, 0x8000, 0x1078, 0x2839, 0x6013, 0x0000, 0x601f, 0x0007,
3923 0x6017, 0x0398, 0x127f, 0x0e7f, 0x007c, 0x6000, 0xa08a, 0x0010,
3924 0x10c8, 0x1328, 0x1079, 0x89d5, 0x007c, 0x89e5, 0x89e5, 0x89e5,
3925 0x89e5, 0x89e5, 0x89e5, 0x89e5, 0x89e5, 0x89e5, 0x8827, 0x89e5,
3926 0x882f, 0x89e7, 0x882f, 0x89f5, 0x89e5, 0x1078, 0x1328, 0x6004,
3927 0xa086, 0x008b, 0x0040, 0x89f5, 0x6007, 0x008b, 0x6003, 0x000d,
3928 0x1078, 0x5bf8, 0x1078, 0x6109, 0x007c, 0x1078, 0x8bf4, 0x1078,
3929 0x8a44, 0x0040, 0x8a2d, 0x1078, 0x2813, 0x0d7e, 0x1078, 0x8a44,
3930 0x0040, 0x8a0f, 0x6010, 0x2068, 0x6837, 0x0103, 0x684b, 0x0006,
3931 0x6847, 0x0000, 0x6850, 0xc0ed, 0x6852, 0x1078, 0x4982, 0x2c68,
3932 0x1078, 0x74d7, 0x0040, 0x8a1d, 0x6818, 0x601a, 0x0c7e, 0x2d60,
3933 0x1078, 0x8c01, 0x0c7f, 0x0078, 0x8a1e, 0x2d60, 0x0d7f, 0x6013,
3934 0x0000, 0x601f, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x1078,
3935 0x5c45, 0x1078, 0x6109, 0x0078, 0x8a2f, 0x1078, 0x8c01, 0x007c,
3936 0xa284, 0x000f, 0x00c0, 0x8a41, 0xa282, 0xaa00, 0x0048, 0x8a41,
3937 0x2001, 0xa315, 0x2004, 0xa202, 0x00c8, 0x8a41, 0xa085, 0x0001,
3938 0x007c, 0xa006, 0x0078, 0x8a40, 0x027e, 0x0e7e, 0x2071, 0xa300,
3939 0x6210, 0x7058, 0xa202, 0x0048, 0x8a56, 0x705c, 0xa202, 0x00c8,
3940 0x8a56, 0xa085, 0x0001, 0x0e7f, 0x027f, 0x007c, 0xa006, 0x0078,
3941 0x8a53, 0x0e7e, 0x0c7e, 0x037e, 0x007e, 0x127e, 0x2091, 0x8000,
3942 0x2061, 0xaa00, 0x2071, 0xa300, 0x7344, 0x7060, 0xa302, 0x00c8,
3943 0x8a83, 0x601c, 0xa206, 0x00c0, 0x8a7b, 0x1078, 0x8d66, 0x0040,
3944 0x8a7b, 0x1078, 0x8c3b, 0x00c0, 0x8a77, 0x1078, 0x7a05, 0x0c7e,
3945 0x1078, 0x753d, 0x0c7f, 0xace0, 0x0010, 0x7054, 0xac02, 0x00c8,
3946 0x8a83, 0x0078, 0x8a64, 0x127f, 0x007f, 0x037f, 0x0c7f, 0x0e7f,
3947 0x007c, 0x0e7e, 0x0c7e, 0x017e, 0xa188, 0xa434, 0x210c, 0x81ff,
3948 0x0040, 0x8aa1, 0x2061, 0xaa00, 0x2071, 0xa300, 0x017e, 0x1078,
3949 0x74d7, 0x017f, 0x0040, 0x8aa4, 0x611a, 0x1078, 0x2813, 0x1078,
3950 0x753d, 0xa006, 0x0078, 0x8aa6, 0xa085, 0x0001, 0x017f, 0x0c7f,
3951 0x0e7f, 0x007c, 0x0c7e, 0x057e, 0x127e, 0x2091, 0x8000, 0x0c7e,
3952 0x1078, 0x74d7, 0x057f, 0x0040, 0x8ac3, 0x6612, 0x651a, 0x601f,
3953 0x0003, 0x2009, 0x004b, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f,
3954 0x057f, 0x0c7f, 0x007c, 0xa006, 0x0078, 0x8abf, 0x0c7e, 0x057e,
3955 0x127e, 0x2091, 0x8000, 0x62a0, 0x0c7e, 0x1078, 0x74d7, 0x057f,
3956 0x0040, 0x8af1, 0x6013, 0x0000, 0x651a, 0x601f, 0x0003, 0x0c7e,
3957 0x2560, 0x1078, 0x471b, 0x0c7f, 0x1078, 0x5d53, 0x077e, 0x2039,
3958 0x0000, 0x1078, 0x5c78, 0x2c08, 0x1078, 0x9c38, 0x077f, 0x2009,
3959 0x004c, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f, 0x057f, 0x0c7f,
3960 0x007c, 0xa006, 0x0078, 0x8aed, 0x0f7e, 0x0c7e, 0x047e, 0x0c7e,
3961 0x1078, 0x74d7, 0x2c78, 0x0c7f, 0x0040, 0x8b0e, 0x7e12, 0x2c00,
3962 0x781a, 0x781f, 0x0003, 0x2021, 0x0005, 0x1078, 0x8b4e, 0x2f60,
3963 0x2009, 0x004d, 0x1078, 0x756c, 0xa085, 0x0001, 0x047f, 0x0c7f,
3964 0x0f7f, 0x007c, 0x0f7e, 0x0c7e, 0x047e, 0x0c7e, 0x1078, 0x74d7,
3965 0x2c78, 0x0c7f, 0x0040, 0x8b2c, 0x7e12, 0x2c00, 0x781a, 0x781f,
3966 0x0003, 0x2021, 0x0005, 0x1078, 0x8b4e, 0x2f60, 0x2009, 0x004e,
3967 0x1078, 0x756c, 0xa085, 0x0001, 0x047f, 0x0c7f, 0x0f7f, 0x007c,
3968 0x0f7e, 0x0c7e, 0x047e, 0x0c7e, 0x1078, 0x74d7, 0x2c78, 0x0c7f,
3969 0x0040, 0x8b4a, 0x7e12, 0x2c00, 0x781a, 0x781f, 0x0003, 0x2021,
3970 0x0004, 0x1078, 0x8b4e, 0x2f60, 0x2009, 0x0052, 0x1078, 0x756c,
3971 0xa085, 0x0001, 0x047f, 0x0c7f, 0x0f7f, 0x007c, 0x097e, 0x077e,
3972 0x127e, 0x2091, 0x8000, 0x1078, 0x46a7, 0x0040, 0x8b5b, 0x2001,
3973 0x8b53, 0x0078, 0x8b61, 0x1078, 0x466d, 0x0040, 0x8b6a, 0x2001,
3974 0x8b5b, 0x007e, 0xa00e, 0x2400, 0x1078, 0x4a60, 0x1078, 0x4982,
3975 0x007f, 0x007a, 0x2418, 0x1078, 0x5fa7, 0x62a0, 0x087e, 0x2041,
3976 0x0001, 0x2039, 0x0001, 0x2608, 0x1078, 0x5d6d, 0x087f, 0x1078,
3977 0x5c78, 0x2f08, 0x2648, 0x1078, 0x9c38, 0x613c, 0x81ff, 0x1040,
3978 0x5e21, 0x127f, 0x077f, 0x097f, 0x007c, 0x0c7e, 0x127e, 0x2091,
3979 0x8000, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040, 0x8b9e, 0x660a,
3980 0x611a, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009, 0x001f, 0x1078,
3981 0x756c, 0xa085, 0x0001, 0x127f, 0x0c7f, 0x007c, 0xa006, 0x0078,
3982 0x8b9b, 0x0c7e, 0x127e, 0x2091, 0x8000, 0x0c7e, 0x1078, 0x74d7,
3983 0x017f, 0x0040, 0x8bba, 0x660a, 0x611a, 0x601f, 0x0008, 0x2d00,
3984 0x6012, 0x2009, 0x0021, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f,
3985 0x0c7f, 0x007c, 0xa006, 0x0078, 0x8bb7, 0x0c7e, 0x127e, 0x2091,
3986 0x8000, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040, 0x8bd6, 0x660a,
3987 0x611a, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009, 0x003d, 0x1078,
3988 0x756c, 0xa085, 0x0001, 0x127f, 0x0c7f, 0x007c, 0xa006, 0x0078,
3989 0x8bd3, 0x0c7e, 0x127e, 0x2091, 0x8000, 0x0c7e, 0x1078, 0x74d7,
3990 0x017f, 0x0040, 0x8bf1, 0x611a, 0x601f, 0x0001, 0x2d00, 0x6012,
3991 0x2009, 0x0000, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f, 0x0c7f,
3992 0x007c, 0xa006, 0x0078, 0x8bee, 0x027e, 0x0d7e, 0x6218, 0x2268,
3993 0x6a3c, 0x82ff, 0x0040, 0x8bfe, 0x8211, 0x6a3e, 0x0d7f, 0x027f,
3994 0x007c, 0x007e, 0x6000, 0xa086, 0x0000, 0x0040, 0x8c13, 0x6013,
3995 0x0000, 0x601f, 0x0007, 0x2001, 0xa5a1, 0x2004, 0x6016, 0x1078,
3996 0xa134, 0x603f, 0x0000, 0x007f, 0x007c, 0x067e, 0x0c7e, 0x0d7e,
3997 0x2031, 0xa352, 0x2634, 0xd6e4, 0x0040, 0x8c23, 0x6618, 0x2660,
3998 0x6e48, 0x1078, 0x461b, 0x0d7f, 0x0c7f, 0x067f, 0x007c, 0x007e,
3999 0x017e, 0x6004, 0xa08e, 0x0002, 0x0040, 0x8c38, 0xa08e, 0x0003,
4000 0x0040, 0x8c38, 0xa08e, 0x0004, 0x0040, 0x8c38, 0xa085, 0x0001,
4001 0x017f, 0x007f, 0x007c, 0x007e, 0x0d7e, 0x6010, 0xa06d, 0x0040,
4002 0x8c48, 0x6838, 0xd0fc, 0x0040, 0x8c48, 0xa006, 0x0078, 0x8c4a,
4003 0xa085, 0x0001, 0x0d7f, 0x007f, 0x007c, 0x0c7e, 0x127e, 0x2091,
4004 0x8000, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040, 0x8c67, 0x611a,
4005 0x601f, 0x0001, 0x2d00, 0x6012, 0x1078, 0x2813, 0x2009, 0x0028,
4006 0x1078, 0x756c, 0xa085, 0x0001, 0x127f, 0x0c7f, 0x007c, 0xa006,
4007 0x0078, 0x8c64, 0xa186, 0x0015, 0x00c0, 0x8c7f, 0x2011, 0xa31f,
4008 0x2204, 0xa086, 0x0074, 0x00c0, 0x8c7f, 0x1078, 0x7d0d, 0x6003,
4009 0x0001, 0x6007, 0x0029, 0x1078, 0x5c45, 0x0078, 0x8c83, 0x1078,
4010 0x7a05, 0x1078, 0x753d, 0x007c, 0xa186, 0x0016, 0x00c0, 0x8c8e,
4011 0x2001, 0x0004, 0x1078, 0x443f, 0x0078, 0x8caf, 0xa186, 0x0015,
4012 0x00c0, 0x8cb3, 0x2011, 0xa31f, 0x2204, 0xa086, 0x0014, 0x00c0,
4013 0x8cb3, 0x0d7e, 0x6018, 0x2068, 0x1078, 0x457d, 0x0d7f, 0x1078,
4014 0x7dba, 0x00c0, 0x8cb3, 0x0d7e, 0x6018, 0x2068, 0x6890, 0x0d7f,
4015 0xa005, 0x0040, 0x8cb3, 0x2001, 0x0006, 0x1078, 0x443f, 0x1078,
4016 0x7608, 0x0078, 0x8cb7, 0x1078, 0x7a05, 0x1078, 0x753d, 0x007c,
4017 0x6848, 0xa086, 0x0005, 0x00c0, 0x8cbf, 0x1078, 0x8cc0, 0x007c,
4018 0x6850, 0xc0ad, 0x6852, 0x007c, 0x0e7e, 0x2071, 0xa88c, 0x7014,
4019 0xd0e4, 0x0040, 0x8cd5, 0x6013, 0x0000, 0x6003, 0x0001, 0x6007,
4020 0x0050, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0e7f, 0x007c, 0x0c7e,
4021 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f, 0x0040, 0x8ce4, 0x601c,
4022 0xa084, 0x000f, 0x1079, 0x8ce6, 0x0c7f, 0x007c, 0x8827, 0x8cf1,
4023 0x8cf4, 0x8cf7, 0x9f00, 0x9f1c, 0x9f1f, 0x8827, 0x8827, 0x1078,
4024 0x1328, 0x0005, 0x0005, 0x007c, 0x0005, 0x0005, 0x007c, 0x1078,
4025 0x8cfa, 0x007c, 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0040, 0x8d29,
4026 0x1078, 0x74d7, 0x00c0, 0x8d0a, 0x2001, 0xa5a2, 0x2004, 0x783e,
4027 0x0078, 0x8d29, 0x7818, 0x601a, 0x781c, 0xa086, 0x0003, 0x0040,
4028 0x8d17, 0x7808, 0x6036, 0x2f00, 0x603a, 0x0078, 0x8d1b, 0x7808,
4029 0x603a, 0x2f00, 0x6036, 0x602a, 0x601f, 0x0001, 0x6007, 0x0035,
4030 0x6003, 0x0001, 0x7920, 0x6122, 0x1078, 0x5bf8, 0x1078, 0x6109,
4031 0x2f60, 0x0f7f, 0x007c, 0x017e, 0x0f7e, 0x682c, 0x6032, 0xa08e,
4032 0x0001, 0x0040, 0x8d3c, 0xa086, 0x0005, 0x0040, 0x8d40, 0xa006,
4033 0x602a, 0x602e, 0x0078, 0x8d51, 0x6824, 0xc0f4, 0xc0d5, 0x6826,
4034 0x6810, 0x2078, 0x787c, 0x6938, 0xa102, 0x7880, 0x6934, 0xa103,
4035 0x00c8, 0x8d37, 0x6834, 0x602a, 0x6838, 0xa084, 0xfffc, 0x683a,
4036 0x602e, 0x2d00, 0x6036, 0x6808, 0x603a, 0x6918, 0x611a, 0x6920,
4037 0x6122, 0x601f, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001, 0x1078,
4038 0x5bf8, 0x6803, 0x0002, 0x0f7f, 0x017f, 0x007c, 0x007e, 0x017e,
4039 0x6004, 0xa08e, 0x0034, 0x0040, 0x8d8b, 0xa08e, 0x0035, 0x0040,
4040 0x8d8b, 0xa08e, 0x0036, 0x0040, 0x8d8b, 0xa08e, 0x0037, 0x0040,
4041 0x8d8b, 0xa08e, 0x0038, 0x0040, 0x8d8b, 0xa08e, 0x0039, 0x0040,
4042 0x8d8b, 0xa08e, 0x003a, 0x0040, 0x8d8b, 0xa08e, 0x003b, 0x0040,
4043 0x8d8b, 0xa085, 0x0001, 0x017f, 0x007f, 0x007c, 0x0f7e, 0x2c78,
4044 0x1078, 0x4893, 0x00c0, 0x8d98, 0xa085, 0x0001, 0x0078, 0x8da7,
4045 0x6024, 0xd0f4, 0x00c0, 0x8da6, 0xc0f5, 0x6026, 0x6010, 0x2078,
4046 0x7828, 0x603a, 0x782c, 0x6036, 0x1078, 0x1749, 0xa006, 0x0f7f,
4047 0x007c, 0x007e, 0x017e, 0x027e, 0x037e, 0x0e7e, 0x2001, 0xa59c,
4048 0x200c, 0x8000, 0x2014, 0x2001, 0x0032, 0x1078, 0x5a98, 0x2001,
4049 0xa5a0, 0x82ff, 0x00c0, 0x8dbe, 0x2011, 0x0002, 0x2202, 0x2001,
4050 0xa59e, 0x200c, 0x8000, 0x2014, 0x2071, 0xa58c, 0x711a, 0x721e,
4051 0x2001, 0x0064, 0x1078, 0x5a98, 0x2001, 0xa5a1, 0x82ff, 0x00c0,
4052 0x8dd3, 0x2011, 0x0002, 0x2202, 0x2009, 0xa5a2, 0xa280, 0x000a,
4053 0x200a, 0x0e7f, 0x037f, 0x027f, 0x017f, 0x007f, 0x007c, 0x007e,
4054 0x0e7e, 0x2001, 0xa5a0, 0x2003, 0x0028, 0x2001, 0xa5a1, 0x2003,
4055 0x0014, 0x2071, 0xa58c, 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001,
4056 0xa5a2, 0x2003, 0x001e, 0x0e7f, 0x007f, 0x007c, 0x0c7e, 0x127e,
4057 0x2091, 0x8000, 0x0c7e, 0x1078, 0x74d7, 0x017f, 0x0040, 0x8e0e,
4058 0x611a, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009, 0x0033, 0x1078,
4059 0x756c, 0xa085, 0x0001, 0x127f, 0x0c7f, 0x007c, 0xa006, 0x0078,
4060 0x8e0b, 0x0d7e, 0x0e7e, 0x0f7e, 0x2071, 0xa300, 0xa186, 0x0015,
4061 0x00c0, 0x8e40, 0x707c, 0xa086, 0x0018, 0x00c0, 0x8e40, 0x6010,
4062 0x2068, 0x6a3c, 0xd2e4, 0x00c0, 0x8e34, 0x2c78, 0x1078, 0x62c6,
4063 0x0040, 0x8e48, 0x7068, 0x6a50, 0xa206, 0x00c0, 0x8e3c, 0x706c,
4064 0x6a54, 0xa206, 0x00c0, 0x8e3c, 0x6218, 0xa290, 0x0028, 0x2214,
4065 0x2009, 0x0000, 0x1078, 0x285b, 0x1078, 0x7608, 0x0078, 0x8e44,
4066 0x1078, 0x7a05, 0x1078, 0x753d, 0x0f7f, 0x0e7f, 0x0d7f, 0x007c,
4067 0x704c, 0xa080, 0x293f, 0x2004, 0x6a54, 0xa206, 0x0040, 0x8e34,
4068 0x0078, 0x8e3c, 0x0c7e, 0x127e, 0x2091, 0x8000, 0x0c7e, 0x1078,
4069 0x74d7, 0x017f, 0x0040, 0x8e6a, 0x611a, 0x601f, 0x0001, 0x2d00,
4070 0x6012, 0x2009, 0x0043, 0x1078, 0x756c, 0xa085, 0x0001, 0x127f,
4071 0x0c7f, 0x007c, 0xa006, 0x0078, 0x8e67, 0x0d7e, 0x0e7e, 0x0f7e,
4072 0x2071, 0xa300, 0xa186, 0x0015, 0x00c0, 0x8e93, 0x707c, 0xa086,
4073 0x0004, 0x00c0, 0x8e93, 0x6010, 0xa0e8, 0x000f, 0x2c78, 0x1078,
4074 0x62c6, 0x0040, 0x8e9b, 0x7068, 0x6a08, 0xa206, 0x00c0, 0x8e8f,
4075 0x706c, 0x6a0c, 0xa206, 0x00c0, 0x8e8f, 0x1078, 0x2813, 0x1078,
4076 0x7608, 0x0078, 0x8e97, 0x1078, 0x7a05, 0x1078, 0x753d, 0x0f7f,
4077 0x0e7f, 0x0d7f, 0x007c, 0x704c, 0xa080, 0x293f, 0x2004, 0x6a0c,
4078 0xa206, 0x0040, 0x8e8d, 0x0078, 0x8e8f, 0x017e, 0x027e, 0x684c,
4079 0xd0ac, 0x0040, 0x8ebd, 0x6914, 0x6a10, 0x2100, 0xa205, 0x0040,
4080 0x8ebd, 0x6860, 0xa106, 0x00c0, 0x8eb9, 0x685c, 0xa206, 0x0040,
4081 0x8ebd, 0x6962, 0x6a5e, 0xa085, 0x0001, 0x027f, 0x017f, 0x007c,
4082 0x0e7e, 0x127e, 0x2071, 0xa300, 0x2091, 0x8000, 0x7544, 0xa582,
4083 0x0001, 0x0048, 0x8ef2, 0x7048, 0x2060, 0x6000, 0xa086, 0x0000,
4084 0x0040, 0x8ede, 0xace0, 0x0010, 0x7054, 0xac02, 0x00c8, 0x8eda,
4085 0x0078, 0x8ecd, 0x2061, 0xaa00, 0x0078, 0x8ecd, 0x6003, 0x0008,
4086 0x8529, 0x7546, 0xaca8, 0x0010, 0x7054, 0xa502, 0x00c8, 0x8eee,
4087 0x754a, 0xa085, 0x0001, 0x127f, 0x0e7f, 0x007c, 0x704b, 0xaa00,
4088 0x0078, 0x8ee9, 0xa006, 0x0078, 0x8eeb, 0x0c7e, 0x027e, 0x017e,
4089 0xa186, 0x0035, 0x0040, 0x8eff, 0x6a34, 0x0078, 0x8f00, 0x6a28,
4090 0x1078, 0x8a30, 0x0040, 0x8f29, 0x2260, 0x611c, 0xa186, 0x0003,
4091 0x0040, 0x8f0e, 0xa186, 0x0006, 0x00c0, 0x8f25, 0x6834, 0xa206,
4092 0x0040, 0x8f1d, 0x6838, 0xa206, 0x00c0, 0x8f25, 0x6108, 0x6834,
4093 0xa106, 0x00c0, 0x8f25, 0x0078, 0x8f22, 0x6008, 0x6938, 0xa106,
4094 0x00c0, 0x8f25, 0x6018, 0x6918, 0xa106, 0x017f, 0x027f, 0x0c7f,
4095 0x007c, 0xa085, 0x0001, 0x0078, 0x8f25, 0x067e, 0x6000, 0xa0b2,
4096 0x0010, 0x10c8, 0x1328, 0x1079, 0x8f37, 0x067f, 0x007c, 0x8f47,
4097 0x93bb, 0x94d3, 0x8f47, 0x8f47, 0x8f47, 0x8f47, 0x8f47, 0x8f81,
4098 0x955e, 0x8f47, 0x8f47, 0x8f47, 0x8f47, 0x8f47, 0x8f47, 0x1078,
4099 0x1328, 0x067e, 0x6000, 0xa0b2, 0x0010, 0x10c8, 0x1328, 0x1079,
4100 0x8f53, 0x067f, 0x007c, 0x8f63, 0x99f6, 0x8f63, 0x8f63, 0x8f63,
4101 0x8f63, 0x8f63, 0x8f63, 0x99b4, 0x9a44, 0x8f63, 0xa053, 0xa087,
4102 0xa053, 0xa087, 0x8f63, 0x1078, 0x1328, 0x067e, 0x6000, 0xa0b2,
4103 0x0010, 0x10c8, 0x1328, 0x1079, 0x8f6f, 0x067f, 0x007c, 0x8f7f,
4104 0x969f, 0x976a, 0x9798, 0x9813, 0x8f7f, 0x9919, 0x98c1, 0x956a,
4105 0x9988, 0x999e, 0x8f7f, 0x8f7f, 0x8f7f, 0x8f7f, 0x8f7f, 0x1078,
4106 0x1328, 0xa1b2, 0x0044, 0x10c8, 0x1328, 0x2100, 0x0079, 0x8f88,
4107 0x8fc8, 0x919a, 0x8fc8, 0x8fc8, 0x8fc8, 0x91a2, 0x8fc8, 0x8fc8,
4108 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8,
4109 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fca,
4110 0x902d, 0x9038, 0x9081, 0x909c, 0x911b, 0x918b, 0x8fc8, 0x8fc8,
4111 0x91a6, 0x8fc8, 0x8fc8, 0x91b5, 0x91bc, 0x8fc8, 0x8fc8, 0x8fc8,
4112 0x8fc8, 0x8fc8, 0x91ea, 0x8fc8, 0x8fc8, 0x91f5, 0x8fc8, 0x8fc8,
4113 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x920a, 0x8fc8, 0x8fc8, 0x8fc8,
4114 0x9291, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x9305,
4115 0x1078, 0x1328, 0x1078, 0x4897, 0x00c0, 0x8fd7, 0x2001, 0xa332,
4116 0x2004, 0xa084, 0x0009, 0xa086, 0x0008, 0x00c0, 0x8fdf, 0x6007,
4117 0x0009, 0x602b, 0x0009, 0x6013, 0x0000, 0x0078, 0x9195, 0x1078,
4118 0x4887, 0x0e7e, 0x0c7e, 0x037e, 0x027e, 0x017e, 0x6218, 0x2270,
4119 0x72a0, 0x027e, 0x2019, 0x0029, 0x1078, 0x5d53, 0x077e, 0x2039,
4120 0x0000, 0x1078, 0x5c78, 0x2c08, 0x1078, 0x9c38, 0x077f, 0x017f,
4121 0x2e60, 0x1078, 0x471b, 0x017f, 0x027f, 0x037f, 0x0c7f, 0x0e7f,
4122 0x6618, 0x0c7e, 0x2660, 0x1078, 0x4513, 0x0c7f, 0xa6b0, 0x0001,
4123 0x2634, 0xa684, 0x00ff, 0xa082, 0x0006, 0x0048, 0x901f, 0x1078,
4124 0x9b6c, 0x00c0, 0x907b, 0x1078, 0x9afd, 0x00c0, 0x901b, 0x6007,
4125 0x0008, 0x0078, 0x9195, 0x6007, 0x0009, 0x0078, 0x9195, 0x1078,
4126 0x9d45, 0x0040, 0x9029, 0x1078, 0x9b6c, 0x0040, 0x9013, 0x0078,
4127 0x907b, 0x6013, 0x1900, 0x0078, 0x901b, 0x6106, 0x1078, 0x9aa8,
4128 0x6007, 0x0006, 0x0078, 0x9195, 0x6007, 0x0007, 0x0078, 0x9195,
4129 0x1078, 0xa0bf, 0x00c0, 0x9340, 0x0d7e, 0x6618, 0x2668, 0x6e04,
4130 0xa6b4, 0xff00, 0x8637, 0xa686, 0x0006, 0x0040, 0x905d, 0xa686,
4131 0x0004, 0x0040, 0x905d, 0x6e04, 0xa6b4, 0x00ff, 0xa686, 0x0006,
4132 0x0040, 0x905d, 0xa686, 0x0004, 0x0040, 0x905d, 0xa686, 0x0005,
4133 0x0040, 0x905d, 0x0d7f, 0x0078, 0x907b, 0x1078, 0x9bd2, 0x00c0,
4134 0x9076, 0xa686, 0x0006, 0x00c0, 0x906f, 0x027e, 0x6218, 0xa290,
4135 0x0028, 0x2214, 0x2009, 0x0000, 0x1078, 0x285b, 0x027f, 0x1078,
4136 0x457d, 0x6007, 0x000a, 0x0d7f, 0x0078, 0x9195, 0x6007, 0x000b,
4137 0x0d7f, 0x0078, 0x9195, 0x1078, 0x2813, 0x6007, 0x0001, 0x0078,
4138 0x9195, 0x1078, 0xa0bf, 0x00c0, 0x9340, 0x6618, 0x0d7e, 0x2668,
4139 0x6e04, 0x0d7f, 0xa686, 0x0707, 0x0040, 0x907b, 0x027e, 0x6218,
4140 0xa290, 0x0028, 0x2214, 0x2009, 0x0000, 0x1078, 0x285b, 0x027f,
4141 0x6007, 0x000c, 0x0078, 0x9195, 0x1078, 0x4897, 0x00c0, 0x90a9,
4142 0x2001, 0xa332, 0x2004, 0xa084, 0x0009, 0xa086, 0x0008, 0x00c0,
4143 0x90b1, 0x6007, 0x0009, 0x602b, 0x0009, 0x6013, 0x0000, 0x0078,
4144 0x9195, 0x1078, 0x4887, 0x6618, 0xa6b0, 0x0001, 0x2634, 0xa684,
4145 0x00ff, 0xa082, 0x0006, 0x0048, 0x90f5, 0xa6b4, 0xff00, 0x8637,
4146 0xa686, 0x0004, 0x0040, 0x90c8, 0xa686, 0x0006, 0x00c0, 0x907b,
4147 0x1078, 0x9be1, 0x00c0, 0x90d0, 0x6007, 0x000e, 0x0078, 0x9195,
4148 0x047e, 0x6418, 0xa4a0, 0x0028, 0x2424, 0xa4a4, 0x00ff, 0x8427,
4149 0x047e, 0x1078, 0x2813, 0x047f, 0x017e, 0xa006, 0x2009, 0xa352,
4150 0x210c, 0xd1a4, 0x0040, 0x90ef, 0x2009, 0x0029, 0x1078, 0x9ec0,
4151 0x6018, 0x0d7e, 0x2068, 0x6800, 0xc0e5, 0x6802, 0x0d7f, 0x017f,
4152 0x047f, 0x6007, 0x0001, 0x0078, 0x9195, 0x2001, 0x0001, 0x1078,
4153 0x442b, 0x157e, 0x017e, 0x027e, 0x037e, 0x20a9, 0x0004, 0x2019,
4154 0xa305, 0x2011, 0xa890, 0x1078, 0x7e55, 0x037f, 0x027f, 0x017f,
4155 0x157f, 0xa005, 0x0040, 0x9115, 0xa6b4, 0xff00, 0x8637, 0xa686,
4156 0x0006, 0x0040, 0x90c8, 0x0078, 0x907b, 0x6013, 0x1900, 0x6007,
4157 0x0009, 0x0078, 0x9195, 0x1078, 0x4897, 0x00c0, 0x9128, 0x2001,
4158 0xa332, 0x2004, 0xa084, 0x0009, 0xa086, 0x0008, 0x00c0, 0x9130,
4159 0x6007, 0x0009, 0x602b, 0x0009, 0x6013, 0x0000, 0x0078, 0x9195,
4160 0x1078, 0x4887, 0x6618, 0xa6b0, 0x0001, 0x2634, 0xa684, 0x00ff,
4161 0xa082, 0x0006, 0x0048, 0x9178, 0xa6b4, 0xff00, 0x8637, 0xa686,
4162 0x0004, 0x0040, 0x9147, 0xa686, 0x0006, 0x00c0, 0x907b, 0x1078,
4163 0x9c0c, 0x00c0, 0x9153, 0x1078, 0x9afd, 0x00c0, 0x9153, 0x6007,
4164 0x0010, 0x0078, 0x9195, 0x047e, 0x6418, 0xa4a0, 0x0028, 0x2424,
4165 0xa4a4, 0x00ff, 0x8427, 0x047e, 0x1078, 0x2813, 0x047f, 0x017e,
4166 0xa006, 0x2009, 0xa352, 0x210c, 0xd1a4, 0x0040, 0x9172, 0x2009,
4167 0x0029, 0x1078, 0x9ec0, 0x6018, 0x0d7e, 0x2068, 0x6800, 0xc0e5,
4168 0x6802, 0x0d7f, 0x017f, 0x047f, 0x6007, 0x0001, 0x0078, 0x9195,
4169 0x1078, 0x9d45, 0x0040, 0x9185, 0xa6b4, 0xff00, 0x8637, 0xa686,
4170 0x0006, 0x0040, 0x9147, 0x0078, 0x907b, 0x6013, 0x1900, 0x6007,
4171 0x0009, 0x0078, 0x9195, 0x1078, 0xa0bf, 0x00c0, 0x9340, 0x1078,
4172 0x9343, 0x00c0, 0x907b, 0x6007, 0x0012, 0x6003, 0x0001, 0x1078,
4173 0x5c45, 0x007c, 0x6007, 0x0001, 0x6003, 0x0001, 0x1078, 0x5c45,
4174 0x0078, 0x9199, 0x6007, 0x0005, 0x0078, 0x919c, 0x1078, 0xa0bf,
4175 0x00c0, 0x9340, 0x1078, 0x9343, 0x00c0, 0x907b, 0x6007, 0x0020,
4176 0x6003, 0x0001, 0x1078, 0x5c45, 0x007c, 0x6007, 0x0023, 0x6003,
4177 0x0001, 0x1078, 0x5c45, 0x007c, 0x1078, 0xa0bf, 0x00c0, 0x9340,
4178 0x1078, 0x9343, 0x00c0, 0x907b, 0x017e, 0x027e, 0x2011, 0xa890,
4179 0x2214, 0x2c08, 0x1078, 0x9e8c, 0x00c0, 0x91de, 0x2160, 0x6007,
4180 0x0026, 0x6013, 0x1700, 0x2011, 0xa889, 0x2214, 0xa296, 0xffff,
4181 0x00c0, 0x91e3, 0x6007, 0x0025, 0x0078, 0x91e3, 0x1078, 0x753d,
4182 0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x1078, 0x5c45, 0x027f,
4183 0x017f, 0x007c, 0x6106, 0x1078, 0x9363, 0x6007, 0x002b, 0x0078,
4184 0x9195, 0x6007, 0x002c, 0x0078, 0x9195, 0x1078, 0xa0bf, 0x00c0,
4185 0x9340, 0x1078, 0x9343, 0x00c0, 0x907b, 0x6106, 0x1078, 0x9368,
4186 0x00c0, 0x9206, 0x6007, 0x002e, 0x0078, 0x9195, 0x6007, 0x002f,
4187 0x0078, 0x9195, 0x0e7e, 0x0d7e, 0x0c7e, 0x6018, 0xa080, 0x0001,
4188 0x200c, 0xa184, 0x00ff, 0xa086, 0x0006, 0x0040, 0x9223, 0xa184,
4189 0xff00, 0x8007, 0xa086, 0x0006, 0x0040, 0x9223, 0x0c7f, 0x0d7f,
4190 0x0e7f, 0x0078, 0x919a, 0x2001, 0xa371, 0x2004, 0xd0e4, 0x0040,
4191 0x928d, 0x2071, 0xa88c, 0x7010, 0x6036, 0x7014, 0x603a, 0x7108,
4192 0x720c, 0x2001, 0xa352, 0x2004, 0xd0a4, 0x0040, 0x9241, 0x6018,
4193 0x2068, 0x6810, 0xa106, 0x00c0, 0x9241, 0x6814, 0xa206, 0x0040,
4194 0x9265, 0x2001, 0xa352, 0x2004, 0xd0ac, 0x00c0, 0x9281, 0x2069,
4195 0xa300, 0x686c, 0xa206, 0x00c0, 0x9281, 0x6868, 0xa106, 0x00c0,
4196 0x9281, 0x7210, 0x1078, 0x8a30, 0x0040, 0x9287, 0x1078, 0x9f31,
4197 0x0040, 0x9287, 0x622a, 0x6007, 0x0036, 0x6003, 0x0001, 0x1078,
4198 0x5bf8, 0x0c7f, 0x0d7f, 0x0e7f, 0x007c, 0x7214, 0xa286, 0xffff,
4199 0x0040, 0x9277, 0x1078, 0x8a30, 0x0040, 0x9287, 0xa280, 0x0002,
4200 0x2004, 0x7110, 0xa106, 0x00c0, 0x9287, 0x0078, 0x9252, 0x7210,
4201 0x2c08, 0x1078, 0x9e8c, 0x2c10, 0x2160, 0x0040, 0x9287, 0x0078,
4202 0x9252, 0x6007, 0x0037, 0x6013, 0x1500, 0x0078, 0x925d, 0x6007,
4203 0x0037, 0x6013, 0x1700, 0x0078, 0x925d, 0x6007, 0x0012, 0x0078,
4204 0x925d, 0x6018, 0xa080, 0x0001, 0x2004, 0xa084, 0xff00, 0x8007,
4205 0xa086, 0x0006, 0x00c0, 0x919a, 0x0e7e, 0x0d7e, 0x0c7e, 0x2001,
4206 0xa371, 0x2004, 0xd0e4, 0x0040, 0x92fd, 0x2069, 0xa300, 0x2071,
4207 0xa88c, 0x7008, 0x6036, 0x720c, 0x623a, 0xa286, 0xffff, 0x00c0,
4208 0x92ba, 0x7208, 0x0c7e, 0x2c08, 0x1078, 0x9e8c, 0x2c10, 0x0c7f,
4209 0x0040, 0x92f1, 0x1078, 0x8a30, 0x0040, 0x92f1, 0x0c7e, 0x027e,
4210 0x2260, 0x1078, 0x874a, 0x027f, 0x0c7f, 0x7118, 0xa18c, 0xff00,
4211 0x810f, 0xa186, 0x0001, 0x0040, 0x92db, 0xa186, 0x0005, 0x0040,
4212 0x92d5, 0xa186, 0x0007, 0x00c0, 0x92e5, 0xa280, 0x0004, 0x2004,
4213 0xa005, 0x0040, 0x92e5, 0x057e, 0x7510, 0x7614, 0x1078, 0x9f46,
4214 0x057f, 0x0c7f, 0x0d7f, 0x0e7f, 0x007c, 0x6007, 0x003b, 0x602b,
4215 0x0009, 0x6013, 0x2a00, 0x6003, 0x0001, 0x1078, 0x5bf8, 0x0078,
4216 0x92e1, 0x6007, 0x003b, 0x602b, 0x0009, 0x6013, 0x1700, 0x6003,
4217 0x0001, 0x1078, 0x5bf8, 0x0078, 0x92e1, 0x6007, 0x003b, 0x602b,
4218 0x000b, 0x6013, 0x0000, 0x0078, 0x925d, 0x0e7e, 0x027e, 0x1078,
4219 0x4897, 0x0040, 0x933a, 0x1078, 0x4887, 0x1078, 0xa148, 0x00c0,
4220 0x9338, 0x2071, 0xa300, 0x70c8, 0xc085, 0x70ca, 0x0f7e, 0x2079,
4221 0x0100, 0x7294, 0xa284, 0x00ff, 0x706a, 0x78e6, 0xa284, 0xff00,
4222 0x726c, 0xa205, 0x706e, 0x78ea, 0x0f7f, 0x70d3, 0x0000, 0x2001,
4223 0xa352, 0x2004, 0xd0a4, 0x0040, 0x9331, 0x2011, 0xa5c4, 0x2013,
4224 0x07d0, 0xd0ac, 0x00c0, 0x933a, 0x1078, 0x260d, 0x0078, 0x933a,
4225 0x1078, 0xa178, 0x027f, 0x0e7f, 0x1078, 0x753d, 0x0078, 0x9199,
4226 0x1078, 0x753d, 0x007c, 0x0d7e, 0x067e, 0x6618, 0x2668, 0x6e04,
4227 0xa6b4, 0xff00, 0x8637, 0xa686, 0x0006, 0x0040, 0x9360, 0xa686,
4228 0x0004, 0x0040, 0x9360, 0x6e04, 0xa6b4, 0x00ff, 0xa686, 0x0006,
4229 0x0040, 0x9360, 0xa686, 0x0004, 0x0040, 0x9360, 0xa085, 0x0001,
4230 0x067f, 0x0d7f, 0x007c, 0x0d7e, 0x1078, 0x9397, 0x0d7f, 0x007c,
4231 0x0d7e, 0x1078, 0x93a6, 0x00c0, 0x9390, 0x680c, 0xa08c, 0xff00,
4232 0x6820, 0xa084, 0x00ff, 0xa115, 0x6212, 0x6824, 0x602a, 0xd1e4,
4233 0x0040, 0x937e, 0x2009, 0x0001, 0x0078, 0x938c, 0xd1ec, 0x0040,
4234 0x9390, 0x6920, 0xa18c, 0x00ff, 0x6824, 0x1078, 0x24e3, 0x00c0,
4235 0x9390, 0x2110, 0x2009, 0x0000, 0x1078, 0x285b, 0x0078, 0x9394,
4236 0xa085, 0x0001, 0x0078, 0x9395, 0xa006, 0x0d7f, 0x007c, 0x2069,
4237 0xa88d, 0x6800, 0xa082, 0x0010, 0x00c8, 0x93a4, 0x6013, 0x0000,
4238 0xa085, 0x0001, 0x0078, 0x93a5, 0xa006, 0x007c, 0x6013, 0x0000,
4239 0x2069, 0xa88c, 0x6808, 0xa084, 0xff00, 0xa086, 0x0800, 0x00c0,
4240 0x93ba, 0x6800, 0xa084, 0x00ff, 0xa08e, 0x0014, 0x0040, 0x93ba,
4241 0xa08e, 0x0010, 0x007c, 0x6004, 0xa0b2, 0x0044, 0x10c8, 0x1328,
4242 0xa1b6, 0x0013, 0x00c0, 0x93c7, 0x2008, 0x0079, 0x93da, 0xa1b6,
4243 0x0027, 0x0040, 0x93cf, 0xa1b6, 0x0014, 0x10c0, 0x1328, 0x2001,
4244 0x0007, 0x1078, 0x4472, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078,
4245 0x6109, 0x007c, 0x941a, 0x941c, 0x941a, 0x941a, 0x941a, 0x941c,
4246 0x9424, 0x94ae, 0x9471, 0x94ae, 0x9485, 0x94ae, 0x9424, 0x94ae,
4247 0x94a6, 0x94ae, 0x94a6, 0x94ae, 0x94ae, 0x941a, 0x941a, 0x941a,
4248 0x941a, 0x941a, 0x941a, 0x941a, 0x941a, 0x941a, 0x941a, 0x941a,
4249 0x941c, 0x941a, 0x94ae, 0x941a, 0x941a, 0x94ae, 0x941a, 0x94ae,
4250 0x94ae, 0x941a, 0x941a, 0x941a, 0x941a, 0x94ae, 0x94ae, 0x941a,
4251 0x94ae, 0x94ae, 0x941a, 0x941a, 0x941a, 0x941a, 0x941a, 0x941c,
4252 0x94ae, 0x94ae, 0x941a, 0x941a, 0x94ae, 0x94ae, 0x941a, 0x941a,
4253 0x941a, 0x941a, 0x1078, 0x1328, 0x1078, 0x6010, 0x6003, 0x0002,
4254 0x1078, 0x6109, 0x0078, 0x94b4, 0x0f7e, 0x2079, 0xa351, 0x7804,
4255 0x0f7f, 0xd0ac, 0x00c0, 0x94ae, 0x2001, 0x0000, 0x1078, 0x442b,
4256 0x6018, 0xa080, 0x0004, 0x2004, 0xa086, 0x00ff, 0x0040, 0x94ae,
4257 0x0c7e, 0x6018, 0x2060, 0x6000, 0xd0f4, 0x00c0, 0x9448, 0x6010,
4258 0xa005, 0x0040, 0x9448, 0x0c7f, 0x1078, 0x35f7, 0x0078, 0x94ae,
4259 0x0c7f, 0x2001, 0xa300, 0x2004, 0xa086, 0x0002, 0x00c0, 0x9457,
4260 0x0f7e, 0x2079, 0xa300, 0x788c, 0x8000, 0x788e, 0x0f7f, 0x2001,
4261 0x0002, 0x1078, 0x443f, 0x1078, 0x6010, 0x601f, 0x0001, 0x6003,
4262 0x0001, 0x6007, 0x0002, 0x1078, 0x5c45, 0x1078, 0x6109, 0x0c7e,
4263 0x6118, 0x2160, 0x2009, 0x0001, 0x1078, 0x58e1, 0x0c7f, 0x0078,
4264 0x94b4, 0x6618, 0x0d7e, 0x2668, 0x6e04, 0x0d7f, 0xa6b4, 0xff00,
4265 0x8637, 0xa686, 0x0006, 0x0040, 0x94ae, 0xa686, 0x0004, 0x0040,
4266 0x94ae, 0x2001, 0x0004, 0x0078, 0x94ac, 0x2001, 0xa300, 0x2004,
4267 0xa086, 0x0003, 0x00c0, 0x948e, 0x1078, 0x35f7, 0x2001, 0x0006,
4268 0x1078, 0x94b5, 0x6618, 0x0d7e, 0x2668, 0x6e04, 0x0d7f, 0xa6b4,
4269 0xff00, 0x8637, 0xa686, 0x0006, 0x0040, 0x94ae, 0x2001, 0x0006,
4270 0x0078, 0x94ac, 0x2001, 0x0004, 0x0078, 0x94ac, 0x2001, 0x0006,
4271 0x1078, 0x94b5, 0x0078, 0x94ae, 0x1078, 0x4472, 0x1078, 0x6010,
4272 0x1078, 0x753d, 0x1078, 0x6109, 0x007c, 0x017e, 0x0d7e, 0x6118,
4273 0x2168, 0x6900, 0xd184, 0x0040, 0x94d0, 0x6104, 0xa18e, 0x000a,
4274 0x00c0, 0x94c8, 0x699c, 0xd1a4, 0x00c0, 0x94c8, 0x2001, 0x0007,
4275 0x1078, 0x443f, 0x2001, 0x0000, 0x1078, 0x442b, 0x1078, 0x2839,
4276 0x0d7f, 0x017f, 0x007c, 0x0d7e, 0x6618, 0x2668, 0x6804, 0xa084,
4277 0xff00, 0x8007, 0x0d7f, 0xa0b2, 0x000c, 0x10c8, 0x1328, 0xa1b6,
4278 0x0015, 0x00c0, 0x94e7, 0x1079, 0x94ee, 0x0078, 0x94ed, 0xa1b6,
4279 0x0016, 0x10c0, 0x1328, 0x1079, 0x94fa, 0x007c, 0x7ad0, 0x7ad0,
4280 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x9547, 0x9506, 0x7ad0, 0x7ad0,
4281 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0,
4282 0x9547, 0x954f, 0x7ad0, 0x7ad0, 0x7ad0, 0x7ad0, 0x0f7e, 0x2079,
4283 0xa351, 0x7804, 0xd0ac, 0x00c0, 0x952d, 0x6018, 0xa07d, 0x0040,
4284 0x952d, 0x7800, 0xd0f4, 0x00c0, 0x9519, 0x7810, 0xa005, 0x00c0,
4285 0x952d, 0x2001, 0x0000, 0x1078, 0x442b, 0x2001, 0x0002, 0x1078,
4286 0x443f, 0x601f, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x1078,
4287 0x5c45, 0x1078, 0x6109, 0x0078, 0x9545, 0x2011, 0xa883, 0x2204,
4288 0x8211, 0x220c, 0x1078, 0x24e3, 0x00c0, 0x9545, 0x0c7e, 0x1078,
4289 0x4501, 0x0040, 0x9540, 0x0c7f, 0x1078, 0x753d, 0x0078, 0x9545,
4290 0x1078, 0x4235, 0x0c7f, 0x1078, 0x753d, 0x0f7f, 0x007c, 0x6604,
4291 0xa6b6, 0x001e, 0x00c0, 0x954e, 0x1078, 0x753d, 0x007c, 0x1078,
4292 0x7d0a, 0x00c0, 0x955b, 0x6003, 0x0001, 0x6007, 0x0001, 0x1078,
4293 0x5c45, 0x0078, 0x955d, 0x1078, 0x753d, 0x007c, 0x6004, 0xa08a,
4294 0x0044, 0x10c8, 0x1328, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078,
4295 0x6109, 0x007c, 0xa182, 0x0040, 0x0079, 0x956e, 0x9581, 0x9581,
4296 0x9581, 0x9581, 0x9583, 0x9581, 0x9581, 0x9581, 0x9581, 0x9581,
4297 0x9581, 0x9581, 0x9581, 0x9581, 0x9581, 0x9581, 0x9581, 0x9581,
4298 0x9581, 0x1078, 0x1328, 0x0d7e, 0x0e7e, 0x0f7e, 0x157e, 0x047e,
4299 0x027e, 0x6218, 0xa280, 0x002b, 0x2004, 0xa005, 0x0040, 0x9594,
4300 0x2021, 0x0000, 0x1078, 0xa111, 0x6106, 0x2071, 0xa880, 0x7444,
4301 0xa4a4, 0xff00, 0x0040, 0x95eb, 0xa486, 0x2000, 0x00c0, 0x95a6,
4302 0x2009, 0x0001, 0x2011, 0x0200, 0x1078, 0x5a6d, 0x1078, 0x1381,
4303 0x1040, 0x1328, 0x6003, 0x0007, 0x2d00, 0x6837, 0x010d, 0x6803,
4304 0x0000, 0x683b, 0x0000, 0x6c5a, 0x2c00, 0x685e, 0x6008, 0x68b2,
4305 0x6018, 0x2078, 0x78a0, 0x8007, 0x7130, 0x694a, 0x017e, 0xa084,
4306 0xff00, 0x6846, 0x684f, 0x0000, 0x6857, 0x0036, 0x1078, 0x4982,
4307 0x017f, 0xa486, 0x2000, 0x00c0, 0x95d3, 0x2019, 0x0017, 0x1078,
4308 0x9e3b, 0x0078, 0x9645, 0xa486, 0x0400, 0x00c0, 0x95dd, 0x2019,
4309 0x0002, 0x1078, 0x9dec, 0x0078, 0x9645, 0xa486, 0x0200, 0x00c0,
4310 0x95e3, 0x1078, 0x9dd1, 0xa486, 0x1000, 0x00c0, 0x95e9, 0x1078,
4311 0x9e20, 0x0078, 0x9645, 0x2069, 0xa62d, 0x6a00, 0xd284, 0x0040,
4312 0x969b, 0xa284, 0x0300, 0x00c0, 0x9693, 0x6804, 0xa005, 0x0040,
4313 0x9683, 0x2d78, 0x6003, 0x0007, 0x1078, 0x1366, 0x0040, 0x964c,
4314 0x7800, 0xd08c, 0x00c0, 0x9607, 0x7804, 0x8001, 0x7806, 0x6013,
4315 0x0000, 0x6803, 0x0000, 0x6837, 0x0116, 0x683b, 0x0000, 0x6008,
4316 0x68b2, 0x2c00, 0x684a, 0x6018, 0x2078, 0x78a0, 0x8007, 0x7130,
4317 0x6986, 0x6846, 0x6853, 0x003d, 0x7244, 0xa294, 0x0003, 0xa286,
4318 0x0002, 0x00c0, 0x9627, 0x684f, 0x0040, 0x0078, 0x9631, 0xa286,
4319 0x0001, 0x00c0, 0x962f, 0x684f, 0x0080, 0x0078, 0x9631, 0x684f,
4320 0x0000, 0x20a9, 0x000a, 0x2001, 0xa890, 0xad90, 0x0015, 0x200c,
4321 0x810f, 0x2112, 0x8000, 0x8210, 0x00f0, 0x9637, 0x200c, 0x6982,
4322 0x8000, 0x200c, 0x697e, 0x1078, 0x4982, 0x027f, 0x047f, 0x157f,
4323 0x0f7f, 0x0e7f, 0x0d7f, 0x007c, 0x6013, 0x0100, 0x6003, 0x0001,
4324 0x6007, 0x0041, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0078, 0x9645,
4325 0x2069, 0xa892, 0x2d04, 0xa084, 0xff00, 0xa086, 0x1200, 0x00c0,
4326 0x9677, 0x2069, 0xa880, 0x686c, 0xa084, 0x00ff, 0x017e, 0x6110,
4327 0xa18c, 0x0700, 0xa10d, 0x6112, 0x017f, 0x6003, 0x0001, 0x6007,
4328 0x0043, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0078, 0x9645, 0x6013,
4329 0x0200, 0x6003, 0x0001, 0x6007, 0x0041, 0x1078, 0x5bf8, 0x1078,
4330 0x6109, 0x0078, 0x9645, 0x6013, 0x0300, 0x0078, 0x9689, 0x6013,
4331 0x0100, 0x6003, 0x0001, 0x6007, 0x0041, 0x1078, 0x5bf8, 0x1078,
4332 0x6109, 0x0078, 0x9645, 0x6013, 0x0500, 0x0078, 0x9689, 0x6013,
4333 0x0600, 0x0078, 0x9658, 0x6013, 0x0200, 0x0078, 0x9658, 0xa186,
4334 0x0013, 0x00c0, 0x96b1, 0x6004, 0xa08a, 0x0040, 0x1048, 0x1328,
4335 0xa08a, 0x0053, 0x10c8, 0x1328, 0xa082, 0x0040, 0x2008, 0x0079,
4336 0x9725, 0xa186, 0x0051, 0x0040, 0x96be, 0xa186, 0x0047, 0x00c0,
4337 0x96d7, 0x6004, 0xa086, 0x0041, 0x0040, 0x96e5, 0x2001, 0x0109,
4338 0x2004, 0xd084, 0x0040, 0x96e5, 0x127e, 0x2091, 0x2200, 0x007e,
4339 0x017e, 0x027e, 0x1078, 0x5ad2, 0x027f, 0x017f, 0x007f, 0x127f,
4340 0x6000, 0xa086, 0x0002, 0x00c0, 0x96e5, 0x0078, 0x976a, 0xa186,
4341 0x0027, 0x0040, 0x96df, 0xa186, 0x0014, 0x10c0, 0x1328, 0x6004,
4342 0xa082, 0x0040, 0x2008, 0x0079, 0x96e8, 0x1078, 0x7583, 0x007c,
4343 0x96fb, 0x96fd, 0x96fd, 0x96fb, 0x96fb, 0x96fb, 0x96fb, 0x96fb,
4344 0x96fb, 0x96fb, 0x96fb, 0x96fb, 0x96fb, 0x96fb, 0x96fb, 0x96fb,
4345 0x96fb, 0x96fb, 0x96fb, 0x1078, 0x1328, 0x1078, 0x6010, 0x1078,
4346 0x6109, 0x037e, 0x0d7e, 0x6010, 0xa06d, 0x0040, 0x9722, 0xad84,
4347 0xf000, 0x0040, 0x9722, 0x6003, 0x0002, 0x6018, 0x2004, 0xd0bc,
4348 0x00c0, 0x9722, 0x2019, 0x0004, 0x1078, 0x9e70, 0x6013, 0x0000,
4349 0x6014, 0xa005, 0x00c0, 0x9720, 0x2001, 0xa5a1, 0x2004, 0x6016,
4350 0x6003, 0x0007, 0x0d7f, 0x037f, 0x007c, 0x9738, 0x9757, 0x9741,
4351 0x9764, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738,
4352 0x9738, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738, 0x9738,
4353 0x1078, 0x1328, 0x6010, 0xa088, 0x0013, 0x2104, 0xa085, 0x0400,
4354 0x200a, 0x1078, 0x6010, 0x6010, 0xa080, 0x0013, 0x2004, 0xd0b4,
4355 0x0040, 0x9752, 0x6003, 0x0007, 0x2009, 0x0043, 0x1078, 0x756c,
4356 0x0078, 0x9754, 0x6003, 0x0002, 0x1078, 0x6109, 0x007c, 0x1078,
4357 0x6010, 0x1078, 0xa0c6, 0x00c0, 0x9761, 0x1078, 0x5a41, 0x1078,
4358 0x753d, 0x1078, 0x6109, 0x007c, 0x1078, 0x6010, 0x2009, 0x0041,
4359 0x0078, 0x98c1, 0xa182, 0x0040, 0x0079, 0x976e, 0x9781, 0x9783,
4360 0x9781, 0x9781, 0x9781, 0x9781, 0x9781, 0x9784, 0x9781, 0x9781,
4361 0x9781, 0x9781, 0x9781, 0x9781, 0x9781, 0x9781, 0x9781, 0x978f,
4362 0x9781, 0x1078, 0x1328, 0x007c, 0x6003, 0x0004, 0x6110, 0x20e1,
4363 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x1078, 0x15ec, 0x007c, 0x0d7e,
4364 0x1078, 0x5a41, 0x0d7f, 0x1078, 0xa134, 0x1078, 0x753d, 0x007c,
4365 0xa182, 0x0040, 0x0079, 0x979c, 0x97af, 0x97af, 0x97af, 0x97af,
4366 0x97af, 0x97af, 0x97af, 0x97b1, 0x97af, 0x97b4, 0x97df, 0x97af,
4367 0x97af, 0x97af, 0x97af, 0x97df, 0x97af, 0x97af, 0x97af, 0x1078,
4368 0x1328, 0x1078, 0x7583, 0x007c, 0x1078, 0x60b8, 0x1078, 0x61d3,
4369 0x6010, 0x0d7e, 0x2068, 0x684c, 0xd0fc, 0x0040, 0x97ca, 0xa08c,
4370 0x0003, 0xa18e, 0x0002, 0x0040, 0x97d2, 0x2009, 0x0041, 0x0d7f,
4371 0x0078, 0x98c1, 0x6003, 0x0007, 0x6017, 0x0000, 0x1078, 0x5a41,
4372 0x0d7f, 0x007c, 0x1078, 0xa0c6, 0x0040, 0x97d8, 0x0d7f, 0x007c,
4373 0x1078, 0x5a41, 0x1078, 0x753d, 0x0d7f, 0x0078, 0x97d1, 0x037e,
4374 0x1078, 0x60b8, 0x1078, 0x61d3, 0x6010, 0x0d7e, 0x2068, 0x6018,
4375 0x2004, 0xd0bc, 0x0040, 0x97ff, 0x684c, 0xa084, 0x0003, 0xa086,
4376 0x0002, 0x0040, 0x97fb, 0x687c, 0x632c, 0xa31a, 0x632e, 0x6880,
4377 0x6328, 0xa31b, 0x632a, 0x6003, 0x0002, 0x0078, 0x9810, 0x2019,
4378 0x0004, 0x1078, 0x9e70, 0x6014, 0xa005, 0x00c0, 0x980c, 0x2001,
4379 0xa5a1, 0x2004, 0x8003, 0x6016, 0x6013, 0x0000, 0x6003, 0x0007,
4380 0x0d7f, 0x037f, 0x007c, 0xa186, 0x0013, 0x00c0, 0x9821, 0x6004,
4381 0xa086, 0x0042, 0x10c0, 0x1328, 0x1078, 0x6010, 0x1078, 0x6109,
4382 0x007c, 0xa186, 0x0027, 0x0040, 0x9829, 0xa186, 0x0014, 0x00c0,
4383 0x9839, 0x6004, 0xa086, 0x0042, 0x10c0, 0x1328, 0x2001, 0x0007,
4384 0x1078, 0x4472, 0x1078, 0x6010, 0x1078, 0x8c01, 0x1078, 0x6109,
4385 0x007c, 0xa182, 0x0040, 0x0079, 0x983d, 0x9850, 0x9850, 0x9850,
4386 0x9850, 0x9850, 0x9850, 0x9850, 0x9852, 0x985e, 0x9850, 0x9850,
4387 0x9850, 0x9850, 0x9850, 0x9850, 0x9850, 0x9850, 0x9850, 0x9850,
4388 0x1078, 0x1328, 0x037e, 0x047e, 0x20e1, 0x0005, 0x3d18, 0x3e20,
4389 0x2c10, 0x1078, 0x15ec, 0x047f, 0x037f, 0x007c, 0x6010, 0x0d7e,
4390 0x2068, 0x6810, 0x6a14, 0x6118, 0x210c, 0xd1bc, 0x0040, 0x987d,
4391 0x6124, 0xd1f4, 0x00c0, 0x987d, 0x007e, 0x047e, 0x057e, 0x6c7c,
4392 0xa422, 0x6d80, 0x2200, 0xa52b, 0x602c, 0xa420, 0x642e, 0x6028,
4393 0xa529, 0x652a, 0x057f, 0x047f, 0x007f, 0xa20d, 0x00c0, 0x9891,
4394 0x684c, 0xd0fc, 0x0040, 0x9889, 0x2009, 0x0041, 0x0d7f, 0x0078,
4395 0x98c1, 0x6003, 0x0007, 0x6017, 0x0000, 0x1078, 0x5a41, 0x0d7f,
4396 0x007c, 0x007e, 0x0f7e, 0x2c78, 0x1078, 0x4893, 0x0f7f, 0x007f,
4397 0x0040, 0x989e, 0x6003, 0x0002, 0x0d7f, 0x007c, 0x2009, 0xa30d,
4398 0x210c, 0xd19c, 0x0040, 0x98a8, 0x6003, 0x0007, 0x0078, 0x98aa,
4399 0x6003, 0x0006, 0x1078, 0x98b0, 0x1078, 0x5a43, 0x0d7f, 0x007c,
4400 0xd2fc, 0x0040, 0x98bc, 0x8002, 0x8000, 0x8212, 0xa291, 0x0000,
4401 0x2009, 0x0009, 0x0078, 0x98be, 0x2009, 0x0015, 0x6a6a, 0x6866,
4402 0x007c, 0xa182, 0x0040, 0x0048, 0x98c7, 0x0079, 0x98d4, 0xa186,
4403 0x0013, 0x0040, 0x98cf, 0xa186, 0x0014, 0x10c0, 0x1328, 0x6024,
4404 0xd0dc, 0x1040, 0x1328, 0x007c, 0x98e7, 0x98ee, 0x98fa, 0x9906,
4405 0x98e7, 0x98e7, 0x98e7, 0x9915, 0x98e7, 0x98e9, 0x98e9, 0x98e7,
4406 0x98e7, 0x98e7, 0x98e7, 0x98e7, 0x98e7, 0x98e7, 0x98e7, 0x1078,
4407 0x1328, 0x6024, 0xd0dc, 0x1040, 0x1328, 0x007c, 0x6003, 0x0001,
4408 0x6106, 0x1078, 0x5bf8, 0x127e, 0x2091, 0x8000, 0x1078, 0x6109,
4409 0x127f, 0x007c, 0x6003, 0x0001, 0x6106, 0x1078, 0x5bf8, 0x127e,
4410 0x2091, 0x8000, 0x1078, 0x6109, 0x127f, 0x007c, 0x6003, 0x0003,
4411 0x6106, 0x2c10, 0x1078, 0x1cab, 0x127e, 0x2091, 0x8000, 0x1078,
4412 0x5c64, 0x1078, 0x61d3, 0x127f, 0x007c, 0xa016, 0x1078, 0x15ec,
4413 0x007c, 0x127e, 0x2091, 0x8000, 0x037e, 0x0d7e, 0xa182, 0x0040,
4414 0x1079, 0x9926, 0x0d7f, 0x037f, 0x127f, 0x007c, 0x9936, 0x9938,
4415 0x994d, 0x996c, 0x9936, 0x9936, 0x9936, 0x9984, 0x9936, 0x9936,
4416 0x9936, 0x9936, 0x9936, 0x9936, 0x9936, 0x9936, 0x1078, 0x1328,
4417 0x6010, 0x2068, 0x684c, 0xd0fc, 0x0040, 0x9962, 0xa09c, 0x0003,
4418 0xa39e, 0x0003, 0x0040, 0x9962, 0x6003, 0x0001, 0x6106, 0x1078,
4419 0x5bf8, 0x1078, 0x6109, 0x0078, 0x9987, 0x6010, 0x2068, 0x684c,
4420 0xd0fc, 0x0040, 0x9962, 0xa09c, 0x0003, 0xa39e, 0x0003, 0x0040,
4421 0x9962, 0x6003, 0x0001, 0x6106, 0x1078, 0x5bf8, 0x1078, 0x6109,
4422 0x0078, 0x9987, 0x6013, 0x0000, 0x6017, 0x0000, 0x2019, 0x0004,
4423 0x1078, 0x9e70, 0x0078, 0x9987, 0x6010, 0x2068, 0x684c, 0xd0fc,
4424 0x0040, 0x9962, 0xa09c, 0x0003, 0xa39e, 0x0003, 0x0040, 0x9962,
4425 0x6003, 0x0003, 0x6106, 0x2c10, 0x1078, 0x1cab, 0x1078, 0x5c64,
4426 0x1078, 0x61d3, 0x0078, 0x9987, 0xa016, 0x1078, 0x15ec, 0x007c,
4427 0x1078, 0x6010, 0x6110, 0x81ff, 0x0040, 0x9999, 0x0d7e, 0x2168,
4428 0x1078, 0xa181, 0x037e, 0x2019, 0x0029, 0x1078, 0x9e70, 0x037f,
4429 0x0d7f, 0x1078, 0x8c01, 0x1078, 0x6109, 0x007c, 0x1078, 0x60b8,
4430 0x6110, 0x81ff, 0x0040, 0x99af, 0x0d7e, 0x2168, 0x1078, 0xa181,
4431 0x037e, 0x2019, 0x0029, 0x1078, 0x9e70, 0x037f, 0x0d7f, 0x1078,
4432 0x8c01, 0x1078, 0x61d3, 0x007c, 0xa182, 0x0085, 0x0079, 0x99b8,
4433 0x99c1, 0x99bf, 0x99bf, 0x99cd, 0x99bf, 0x99bf, 0x99bf, 0x1078,
4434 0x1328, 0x6003, 0x000b, 0x6106, 0x1078, 0x5bf8, 0x127e, 0x2091,
4435 0x8000, 0x1078, 0x6109, 0x127f, 0x007c, 0x027e, 0x0e7e, 0x1078,
4436 0xa0bf, 0x0040, 0x99d7, 0x1078, 0x753d, 0x0078, 0x99f3, 0x2071,
4437 0xa880, 0x7224, 0x6212, 0x7220, 0x1078, 0x9d10, 0x0040, 0x99e4,
4438 0x6007, 0x0086, 0x0078, 0x99ed, 0x6007, 0x0087, 0x7224, 0xa296,
4439 0xffff, 0x00c0, 0x99ed, 0x6007, 0x0086, 0x6003, 0x0001, 0x1078,
4440 0x5bf8, 0x1078, 0x6109, 0x0e7f, 0x027f, 0x007c, 0xa186, 0x0013,
4441 0x00c0, 0x9a07, 0x6004, 0xa08a, 0x0085, 0x1048, 0x1328, 0xa08a,
4442 0x008c, 0x10c8, 0x1328, 0xa082, 0x0085, 0x0079, 0x9a1e, 0xa186,
4443 0x0027, 0x0040, 0x9a13, 0xa186, 0x0014, 0x0040, 0x9a13, 0x1078,
4444 0x7583, 0x0078, 0x9a1d, 0x2001, 0x0007, 0x1078, 0x4472, 0x1078,
4445 0x6010, 0x1078, 0x8c01, 0x1078, 0x6109, 0x007c, 0x9a25, 0x9a27,
4446 0x9a27, 0x9a25, 0x9a25, 0x9a25, 0x9a25, 0x1078, 0x1328, 0x1078,
4447 0x6010, 0x1078, 0x8c01, 0x1078, 0x6109, 0x007c, 0xa182, 0x0085,
4448 0x1048, 0x1328, 0xa182, 0x008c, 0x10c8, 0x1328, 0xa182, 0x0085,
4449 0x0079, 0x9a3a, 0x9a41, 0x9a41, 0x9a41, 0x9a43, 0x9a41, 0x9a41,
4450 0x9a41, 0x1078, 0x1328, 0x007c, 0xa186, 0x0013, 0x0040, 0x9a54,
4451 0xa186, 0x0014, 0x0040, 0x9a54, 0xa186, 0x0027, 0x0040, 0x9a54,
4452 0x1078, 0x7583, 0x0078, 0x9a5a, 0x1078, 0x6010, 0x1078, 0x8c01,
4453 0x1078, 0x6109, 0x007c, 0x037e, 0x1078, 0xa134, 0x603f, 0x0000,
4454 0x2019, 0x000b, 0x1078, 0x9a6a, 0x601f, 0x0006, 0x6003, 0x0007,
4455 0x037f, 0x007c, 0x127e, 0x037e, 0x2091, 0x8000, 0x087e, 0x2c40,
4456 0x097e, 0x2049, 0x0000, 0x1078, 0x7058, 0x097f, 0x087f, 0x00c0,
4457 0x9aa5, 0x077e, 0x2c38, 0x1078, 0x7105, 0x077f, 0x00c0, 0x9aa5,
4458 0x6000, 0xa086, 0x0000, 0x0040, 0x9aa5, 0x601c, 0xa086, 0x0007,
4459 0x0040, 0x9aa5, 0x0d7e, 0x6000, 0xa086, 0x0004, 0x00c0, 0x9a96,
4460 0x1078, 0xa134, 0x601f, 0x0007, 0x1078, 0x1749, 0x6010, 0x2068,
4461 0x1078, 0x8a44, 0x0040, 0x9a9e, 0x1078, 0x9e70, 0x0d7f, 0x6013,
4462 0x0000, 0x1078, 0xa134, 0x601f, 0x0007, 0x037f, 0x127f, 0x007c,
4463 0x0f7e, 0x0c7e, 0x037e, 0x157e, 0x2079, 0xa880, 0x7938, 0x783c,
4464 0x1078, 0x24e3, 0x00c0, 0x9af6, 0x017e, 0x0c7e, 0x1078, 0x4501,
4465 0x00c0, 0x9af6, 0x2011, 0xa890, 0xac98, 0x000a, 0x20a9, 0x0004,
4466 0x1078, 0x7e55, 0x00c0, 0x9af6, 0x017f, 0x027f, 0x027e, 0x017e,
4467 0x2019, 0x0029, 0x1078, 0x71e0, 0x1078, 0x5d53, 0x077e, 0x2039,
4468 0x0000, 0x1078, 0x5c78, 0x077f, 0x017f, 0x077e, 0x2039, 0x0000,
4469 0x1078, 0x9c38, 0x077f, 0x1078, 0x471b, 0x027e, 0x6204, 0xa294,
4470 0xff00, 0x8217, 0xa286, 0x0006, 0x0040, 0x9aea, 0xa286, 0x0004,
4471 0x00c0, 0x9aed, 0x62a0, 0x1078, 0x28d5, 0x027f, 0x017f, 0x1078,
4472 0x4235, 0x6612, 0x6516, 0xa006, 0x0078, 0x9af8, 0x0c7f, 0x017f,
4473 0x157f, 0x037f, 0x0c7f, 0x0f7f, 0x007c, 0x0c7e, 0x0d7e, 0x0e7e,
4474 0x017e, 0x2009, 0xa31f, 0x2104, 0xa086, 0x0074, 0x00c0, 0x9b60,
4475 0x2069, 0xa88e, 0x690c, 0xa182, 0x0100, 0x0048, 0x9b50, 0x6908,
4476 0xa184, 0x8000, 0x0040, 0x9b5c, 0x6018, 0x2070, 0x7010, 0xa084,
4477 0x00ff, 0x0040, 0x9b1f, 0x7000, 0xd0f4, 0x0040, 0x9b23, 0xa184,
4478 0x0800, 0x0040, 0x9b5c, 0x6910, 0xa18a, 0x0001, 0x0048, 0x9b54,
4479 0x6914, 0x2069, 0xa8ae, 0x6904, 0x81ff, 0x00c0, 0x9b48, 0x690c,
4480 0xa182, 0x0100, 0x0048, 0x9b50, 0x6908, 0x81ff, 0x00c0, 0x9b4c,
4481 0x6910, 0xa18a, 0x0001, 0x0048, 0x9b54, 0x6918, 0xa18a, 0x0001,
4482 0x0048, 0x9b5c, 0x0078, 0x9b66, 0x6013, 0x0100, 0x0078, 0x9b62,
4483 0x6013, 0x0300, 0x0078, 0x9b62, 0x6013, 0x0500, 0x0078, 0x9b62,
4484 0x6013, 0x0700, 0x0078, 0x9b62, 0x6013, 0x0900, 0x0078, 0x9b62,
4485 0x6013, 0x0b00, 0x0078, 0x9b62, 0x6013, 0x0f00, 0x0078, 0x9b62,
4486 0x6013, 0x2d00, 0xa085, 0x0001, 0x0078, 0x9b67, 0xa006, 0x017f,
4487 0x0e7f, 0x0d7f, 0x0c7f, 0x007c, 0x0c7e, 0x0d7e, 0x027e, 0x037e,
4488 0x157e, 0x6218, 0x2268, 0x6b04, 0xa394, 0x00ff, 0xa286, 0x0006,
4489 0x0040, 0x9b90, 0xa286, 0x0004, 0x0040, 0x9b90, 0xa394, 0xff00,
4490 0x8217, 0xa286, 0x0006, 0x0040, 0x9b90, 0xa286, 0x0004, 0x0040,
4491 0x9b90, 0x0c7e, 0x2d60, 0x1078, 0x4513, 0x0c7f, 0x0078, 0x9bcb,
4492 0x2011, 0xa896, 0xad98, 0x000a, 0x20a9, 0x0004, 0x1078, 0x7e55,
4493 0x00c0, 0x9bcc, 0x2011, 0xa89a, 0xad98, 0x0006, 0x20a9, 0x0004,
4494 0x1078, 0x7e55, 0x00c0, 0x9bcc, 0x047e, 0x017e, 0x6aa0, 0xa294,
4495 0x00ff, 0x8227, 0xa006, 0x2009, 0xa352, 0x210c, 0xd1a4, 0x0040,
4496 0x9bb8, 0x2009, 0x0029, 0x1078, 0x9ec0, 0x6800, 0xc0e5, 0x6802,
4497 0x2019, 0x0029, 0x1078, 0x5d53, 0x077e, 0x2039, 0x0000, 0x1078,
4498 0x5c78, 0x2c08, 0x1078, 0x9c38, 0x077f, 0x2001, 0x0007, 0x1078,
4499 0x4472, 0x017f, 0x047f, 0xa006, 0x157f, 0x037f, 0x027f, 0x0d7f,
4500 0x0c7f, 0x007c, 0x0d7e, 0x2069, 0xa88e, 0x6800, 0xa086, 0x0800,
4501 0x0040, 0x9bde, 0x6013, 0x0000, 0x0078, 0x9bdf, 0xa006, 0x0d7f,
4502 0x007c, 0x0c7e, 0x0f7e, 0x017e, 0x027e, 0x037e, 0x157e, 0x2079,
4503 0xa88c, 0x7930, 0x7834, 0x1078, 0x24e3, 0x00c0, 0x9c05, 0x1078,
4504 0x4501, 0x00c0, 0x9c05, 0x2011, 0xa890, 0xac98, 0x000a, 0x20a9,
4505 0x0004, 0x1078, 0x7e55, 0x00c0, 0x9c05, 0x2011, 0xa894, 0xac98,
4506 0x0006, 0x20a9, 0x0004, 0x1078, 0x7e55, 0x157f, 0x037f, 0x027f,
4507 0x017f, 0x0f7f, 0x0c7f, 0x007c, 0x0c7e, 0x007e, 0x017e, 0x027e,
4508 0x037e, 0x157e, 0x2011, 0xa883, 0x2204, 0x8211, 0x220c, 0x1078,
4509 0x24e3, 0x00c0, 0x9c31, 0x1078, 0x4501, 0x00c0, 0x9c31, 0x2011,
4510 0xa896, 0xac98, 0x000a, 0x20a9, 0x0004, 0x1078, 0x7e55, 0x00c0,
4511 0x9c31, 0x2011, 0xa89a, 0xac98, 0x0006, 0x20a9, 0x0004, 0x1078,
4512 0x7e55, 0x157f, 0x037f, 0x027f, 0x017f, 0x007f, 0x0c7f, 0x007c,
4513 0x0e7e, 0x0c7e, 0x087e, 0x077e, 0x067e, 0x057e, 0x047e, 0x027e,
4514 0x127e, 0x2091, 0x8000, 0x2740, 0x2029, 0xa5b4, 0x252c, 0x2021,
4515 0xa5ba, 0x2424, 0x2061, 0xaa00, 0x2071, 0xa300, 0x7644, 0x7060,
4516 0x81ff, 0x0040, 0x9c59, 0x8001, 0xa602, 0x00c8, 0x9cc3, 0x0078,
4517 0x9c5c, 0xa606, 0x0040, 0x9cc3, 0x2100, 0xac06, 0x0040, 0x9cb9,
4518 0x1078, 0x9ee5, 0x0040, 0x9cb9, 0x671c, 0xa786, 0x0001, 0x0040,
4519 0x9cde, 0xa786, 0x0004, 0x0040, 0x9cde, 0xa786, 0x0007, 0x0040,
4520 0x9cb9, 0x2500, 0xac06, 0x0040, 0x9cb9, 0x2400, 0xac06, 0x0040,
4521 0x9cb9, 0x1078, 0x9ef9, 0x00c0, 0x9cb9, 0x88ff, 0x0040, 0x9c84,
4522 0x6020, 0xa906, 0x00c0, 0x9cb9, 0x0d7e, 0x6000, 0xa086, 0x0004,
4523 0x00c0, 0x9c8e, 0x017e, 0x1078, 0x1749, 0x017f, 0xa786, 0x0008,
4524 0x00c0, 0x9c9d, 0x1078, 0x8c3b, 0x00c0, 0x9c9d, 0x1078, 0x7a05,
4525 0x0d7f, 0x1078, 0x8c01, 0x0078, 0x9cb9, 0x6010, 0x2068, 0x1078,
4526 0x8a44, 0x0040, 0x9cb6, 0xa786, 0x0003, 0x00c0, 0x9ccd, 0x6837,
4527 0x0103, 0x6b4a, 0x6847, 0x0000, 0x1078, 0xa181, 0x017e, 0x1078,
4528 0x8cb8, 0x1078, 0x4982, 0x017f, 0x1078, 0x8bf4, 0x0d7f, 0x1078,
4529 0x8c01, 0xace0, 0x0010, 0x2001, 0xa315, 0x2004, 0xac02, 0x00c8,
4530 0x9cc3, 0x0078, 0x9c4c, 0x127f, 0x027f, 0x047f, 0x057f, 0x067f,
4531 0x077f, 0x087f, 0x0c7f, 0x0e7f, 0x007c, 0xa786, 0x0006, 0x00c0,
4532 0x9ca7, 0xa386, 0x0005, 0x0040, 0x9cdb, 0x1078, 0xa181, 0x1078,
4533 0x9e70, 0x0078, 0x9cb6, 0x0d7f, 0x0078, 0x9cb9, 0x1078, 0x9ef9,
4534 0x00c0, 0x9cb9, 0x81ff, 0x0040, 0x9cb9, 0xa180, 0x0001, 0x2004,
4535 0xa086, 0x0018, 0x0040, 0x9cf3, 0xa180, 0x0001, 0x2004, 0xa086,
4536 0x002d, 0x00c0, 0x9cb9, 0x6000, 0xa086, 0x0002, 0x00c0, 0x9cb9,
4537 0x1078, 0x8c27, 0x0040, 0x9d04, 0x1078, 0x8c3b, 0x00c0, 0x9cb9,
4538 0x1078, 0x7a05, 0x0078, 0x9d0c, 0x1078, 0x2839, 0x1078, 0x8c3b,
4539 0x00c0, 0x9d0c, 0x1078, 0x7a05, 0x1078, 0x8c01, 0x0078, 0x9cb9,
4540 0x0c7e, 0x0e7e, 0x017e, 0x2c08, 0x2170, 0x1078, 0x9e8c, 0x017f,
4541 0x0040, 0x9d1f, 0x601c, 0xa084, 0x000f, 0x1079, 0x9d22, 0x0e7f,
4542 0x0c7f, 0x007c, 0x9d2a, 0x9d2a, 0x9d2a, 0x9d2a, 0x9d2a, 0x9d2a,
4543 0x9d2c, 0x9d2a, 0xa006, 0x007c, 0x047e, 0x017e, 0x7018, 0xa080,
4544 0x0028, 0x2024, 0xa4a4, 0x00ff, 0x8427, 0x2c00, 0x2009, 0x0020,
4545 0x1078, 0x9ec0, 0x017f, 0x047f, 0x037e, 0x2019, 0x0002, 0x1078,
4546 0x9a6a, 0x037f, 0xa085, 0x0001, 0x007c, 0x2001, 0x0001, 0x1078,
4547 0x442b, 0x157e, 0x017e, 0x027e, 0x037e, 0x20a9, 0x0004, 0x2019,
4548 0xa305, 0x2011, 0xa896, 0x1078, 0x7e55, 0x037f, 0x027f, 0x017f,
4549 0x157f, 0xa005, 0x007c, 0x0f7e, 0x0e7e, 0x0c7e, 0x087e, 0x077e,
4550 0x067e, 0x027e, 0x127e, 0x2091, 0x8000, 0x2740, 0x2061, 0xaa00,
4551 0x2079, 0x0001, 0x8fff, 0x0040, 0x9dc3, 0x2071, 0xa300, 0x7644,
4552 0x7060, 0x8001, 0xa602, 0x00c8, 0x9dc3, 0x88ff, 0x0040, 0x9d7e,
4553 0x2800, 0xac06, 0x00c0, 0x9db9, 0x2079, 0x0000, 0x1078, 0x9ee5,
4554 0x0040, 0x9db9, 0x2400, 0xac06, 0x0040, 0x9db9, 0x671c, 0xa786,
4555 0x0006, 0x00c0, 0x9db9, 0xa786, 0x0007, 0x0040, 0x9db9, 0x88ff,
4556 0x00c0, 0x9d9d, 0x6018, 0xa206, 0x00c0, 0x9db9, 0x85ff, 0x0040,
4557 0x9d9d, 0x6020, 0xa106, 0x00c0, 0x9db9, 0x0d7e, 0x6000, 0xa086,
4558 0x0004, 0x00c0, 0x9da9, 0x1078, 0xa134, 0x601f, 0x0007, 0x1078,
4559 0x1749, 0x6010, 0x2068, 0x1078, 0x8a44, 0x0040, 0x9db3, 0x047e,
4560 0x1078, 0x9e70, 0x047f, 0x0d7f, 0x1078, 0x8c01, 0x88ff, 0x00c0,
4561 0x9dcd, 0xace0, 0x0010, 0x2001, 0xa315, 0x2004, 0xac02, 0x00c8,
4562 0x9dc3, 0x0078, 0x9d6a, 0xa006, 0x127f, 0x027f, 0x067f, 0x077f,
4563 0x087f, 0x0c7f, 0x0e7f, 0x0f7f, 0x007c, 0xa8c5, 0x0001, 0x0078,
4564 0x9dc4, 0x077e, 0x057e, 0x087e, 0x2041, 0x0000, 0x2029, 0x0001,
4565 0x2c20, 0x2019, 0x0002, 0x6218, 0x097e, 0x2049, 0x0000, 0x1078,
4566 0x7058, 0x097f, 0x087f, 0x2039, 0x0000, 0x1078, 0x7105, 0x1078,
4567 0x9d5b, 0x057f, 0x077f, 0x007c, 0x027e, 0x047e, 0x057e, 0x077e,
4568 0x0c7e, 0x157e, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x2009, 0x0000,
4569 0x017e, 0x037e, 0x1078, 0x4501, 0x00c0, 0x9e14, 0x2c10, 0x057e,
4570 0x087e, 0x2041, 0x0000, 0x2508, 0x2029, 0x0001, 0x097e, 0x2049,
4571 0x0000, 0x1078, 0x7058, 0x097f, 0x087f, 0x2039, 0x0000, 0x1078,
4572 0x7105, 0x1078, 0x9d5b, 0x057f, 0x037f, 0x017f, 0x8108, 0x00f0,
4573 0x9df8, 0x157f, 0x0c7f, 0x077f, 0x057f, 0x047f, 0x027f, 0x007c,
4574 0x077e, 0x057e, 0x6218, 0x087e, 0x2041, 0x0000, 0x2029, 0x0001,
4575 0x2019, 0x0048, 0x097e, 0x2049, 0x0000, 0x1078, 0x7058, 0x097f,
4576 0x087f, 0x2039, 0x0000, 0x1078, 0x7105, 0x2c20, 0x1078, 0x9d5b,
4577 0x057f, 0x077f, 0x007c, 0x027e, 0x047e, 0x057e, 0x077e, 0x0c7e,
4578 0x157e, 0x2c20, 0x20a9, 0x007f, 0x2009, 0x0000, 0x017e, 0x037e,
4579 0x1078, 0x4501, 0x00c0, 0x9e64, 0x2c10, 0x087e, 0x2041, 0x0000,
4580 0x2828, 0x047e, 0x2021, 0x0001, 0x1078, 0xa111, 0x047f, 0x097e,
4581 0x2049, 0x0000, 0x1078, 0x7058, 0x097f, 0x087f, 0x2039, 0x0000,
4582 0x1078, 0x7105, 0x1078, 0x9d5b, 0x037f, 0x017f, 0x8108, 0x00f0,
4583 0x9e46, 0x157f, 0x0c7f, 0x077f, 0x057f, 0x047f, 0x027f, 0x007c,
4584 0x017e, 0x0f7e, 0xad82, 0xca00, 0x0048, 0x9e89, 0xad82, 0xffff,
4585 0x00c8, 0x9e89, 0x6800, 0xa07d, 0x0040, 0x9e86, 0x6803, 0x0000,
4586 0x6b52, 0x1078, 0x4982, 0x2f68, 0x0078, 0x9e7a, 0x6b52, 0x1078,
4587 0x4982, 0x0f7f, 0x017f, 0x007c, 0x0e7e, 0x047e, 0x037e, 0x2061,
4588 0xaa00, 0x2071, 0xa300, 0x7444, 0x7060, 0x8001, 0xa402, 0x00c8,
4589 0x9ebb, 0x2100, 0xac06, 0x0040, 0x9ead, 0x6000, 0xa086, 0x0000,
4590 0x0040, 0x9ead, 0x6008, 0xa206, 0x00c0, 0x9ead, 0x6018, 0xa1a0,
4591 0x0006, 0x2424, 0xa406, 0x0040, 0x9eb7, 0xace0, 0x0010, 0x2001,
4592 0xa315, 0x2004, 0xac02, 0x00c8, 0x9ebb, 0x0078, 0x9e91, 0xa085,
4593 0x0001, 0x0078, 0x9ebc, 0xa006, 0x037f, 0x047f, 0x0e7f, 0x007c,
4594 0x0d7e, 0x007e, 0x1078, 0x1381, 0x007f, 0x1040, 0x1328, 0x6837,
4595 0x010d, 0x685e, 0x027e, 0x2010, 0x1078, 0x8a30, 0x2001, 0x0000,
4596 0x0040, 0x9ed6, 0x2200, 0xa080, 0x0008, 0x2004, 0x027f, 0x684a,
4597 0x6956, 0x6c46, 0x684f, 0x0000, 0xa006, 0x68b2, 0x6802, 0x683a,
4598 0x685a, 0x1078, 0x4982, 0x0d7f, 0x007c, 0x6700, 0xa786, 0x0000,
4599 0x0040, 0x9ef8, 0xa786, 0x0001, 0x0040, 0x9ef8, 0xa786, 0x000a,
4600 0x0040, 0x9ef8, 0xa786, 0x0009, 0x0040, 0x9ef8, 0xa085, 0x0001,
4601 0x007c, 0x0e7e, 0x6018, 0x2070, 0x70a0, 0xa206, 0x0e7f, 0x007c,
4602 0x017e, 0x6004, 0xa08e, 0x001e, 0x00c0, 0x9f1a, 0x8007, 0x6130,
4603 0xa18c, 0x00ff, 0xa105, 0x6032, 0x6007, 0x0085, 0x6003, 0x000b,
4604 0x601f, 0x0005, 0x2001, 0xa5a1, 0x2004, 0x6016, 0x1078, 0x5bf8,
4605 0x1078, 0x6109, 0x017f, 0x007c, 0x0005, 0x0005, 0x007c, 0x6024,
4606 0xd0e4, 0x0040, 0x9f30, 0xd0cc, 0x0040, 0x9f2a, 0x1078, 0x8cfa,
4607 0x0078, 0x9f30, 0x1078, 0xa134, 0x1078, 0x5a41, 0x1078, 0x753d,
4608 0x007c, 0xa280, 0x0007, 0x2004, 0xa084, 0x000f, 0x0079, 0x9f38,
4609 0x9f41, 0x9f41, 0x9f41, 0x9f43, 0x9f41, 0x9f43, 0x9f43, 0x9f41,
4610 0x9f43, 0xa006, 0x007c, 0xa085, 0x0001, 0x007c, 0xa280, 0x0007,
4611 0x2004, 0xa084, 0x000f, 0x0079, 0x9f4d, 0x9f56, 0x9f56, 0x9f56,
4612 0x9f56, 0x9f56, 0x9f56, 0x9f61, 0x9f56, 0x9f56, 0x6007, 0x003b,
4613 0x602b, 0x0009, 0x6013, 0x2a00, 0x6003, 0x0001, 0x1078, 0x5bf8,
4614 0x007c, 0x0c7e, 0x2260, 0x1078, 0xa134, 0x603f, 0x0000, 0x6024,
4615 0xc0f4, 0xc0cc, 0x6026, 0x0c7f, 0x0d7e, 0x2268, 0xa186, 0x0007,
4616 0x00c0, 0x9fc2, 0x6810, 0xa005, 0x0040, 0x9f7f, 0xa080, 0x0013,
4617 0x2004, 0xd0fc, 0x00c0, 0x9f7f, 0x0d7f, 0x0078, 0x9f56, 0x6007,
4618 0x003a, 0x6003, 0x0001, 0x1078, 0x5bf8, 0x1078, 0x6109, 0x0c7e,
4619 0x2d60, 0x6100, 0xa186, 0x0002, 0x00c0, 0xa050, 0x6010, 0xa005,
4620 0x00c0, 0x9f99, 0x6000, 0xa086, 0x0007, 0x10c0, 0x1328, 0x0078,
4621 0xa050, 0xa08c, 0xf000, 0x00c0, 0x9fa5, 0x0078, 0x9fa5, 0x2068,
4622 0x6800, 0xa005, 0x00c0, 0x9f9f, 0x2d00, 0xa080, 0x0013, 0x2004,
4623 0xa084, 0x0003, 0xa086, 0x0002, 0x00c0, 0x9fbe, 0x6010, 0x2068,
4624 0x684c, 0xc0dc, 0xc0f4, 0x684e, 0x6850, 0xc0f4, 0xc0fc, 0x6852,
4625 0x2009, 0x0043, 0x1078, 0x98c1, 0x0078, 0xa050, 0x2009, 0x0041,
4626 0x0078, 0xa04a, 0xa186, 0x0005, 0x00c0, 0xa009, 0x6810, 0xa080,
4627 0x0013, 0x2004, 0xd0bc, 0x00c0, 0x9fd0, 0x0d7f, 0x0078, 0x9f56,
4628 0xd0b4, 0x0040, 0x9fd8, 0xd0fc, 0x1040, 0x1328, 0x0078, 0x9f72,
4629 0x6007, 0x003a, 0x6003, 0x0001, 0x1078, 0x5bf8, 0x1078, 0x6109,
4630 0x0c7e, 0x2d60, 0x6100, 0xa186, 0x0002, 0x0040, 0x9feb, 0xa186,
4631 0x0004, 0x00c0, 0xa050, 0x2071, 0xa5e1, 0x7000, 0xa086, 0x0003,
4632 0x00c0, 0x9ff8, 0x7004, 0xac06, 0x00c0, 0x9ff8, 0x7003, 0x0000,
4633 0x6810, 0xa080, 0x0013, 0x200c, 0xc1f4, 0xc1dc, 0x2102, 0x8000,
4634 0x200c, 0xc1f4, 0xc1fc, 0xc1bc, 0x2102, 0x2009, 0x0042, 0x0078,
4635 0xa04a, 0x037e, 0x0d7e, 0x0d7e, 0x1078, 0x1381, 0x037f, 0x1040,
4636 0x1328, 0x6837, 0x010d, 0x6803, 0x0000, 0x683b, 0x0000, 0x685b,
4637 0x0000, 0x6b5e, 0x6857, 0x0045, 0x2c00, 0x6862, 0x6034, 0x6872,
4638 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6018, 0xa080, 0x0028, 0x2004,
4639 0xa084, 0x00ff, 0x8007, 0x6320, 0x6b4a, 0x6846, 0x684f, 0x0000,
4640 0x6d6a, 0x6e66, 0x686f, 0x0001, 0x1078, 0x4982, 0x2019, 0x0045,
4641 0x6008, 0x2068, 0x1078, 0x9a6a, 0x2d00, 0x600a, 0x601f, 0x0006,
4642 0x6003, 0x0007, 0x6017, 0x0000, 0x603f, 0x0000, 0x0d7f, 0x037f,
4643 0x0078, 0xa051, 0x603f, 0x0000, 0x6003, 0x0007, 0x1078, 0x98c1,
4644 0x0c7f, 0x0d7f, 0x007c, 0xa186, 0x0013, 0x00c0, 0xa05d, 0x6004,
4645 0xa082, 0x0085, 0x2008, 0x0079, 0xa077, 0xa186, 0x0027, 0x00c0,
4646 0xa070, 0x1078, 0x6010, 0x037e, 0x0d7e, 0x6010, 0x2068, 0x2019,
4647 0x0004, 0x1078, 0x9e70, 0x0d7f, 0x037f, 0x1078, 0x6109, 0x007c,
4648 0xa186, 0x0014, 0x0040, 0xa061, 0x1078, 0x7583, 0x007c, 0xa080,
4649 0xa07e, 0xa07e, 0xa07e, 0xa07e, 0xa07e, 0xa080, 0x1078, 0x1328,
4650 0x1078, 0x6010, 0x6003, 0x000c, 0x1078, 0x6109, 0x007c, 0xa182,
4651 0x008c, 0x00c8, 0xa091, 0xa182, 0x0085, 0x0048, 0xa091, 0x0079,
4652 0xa094, 0x1078, 0x7583, 0x007c, 0xa09b, 0xa09b, 0xa09b, 0xa09b,
4653 0xa09d, 0xa0bc, 0xa09b, 0x1078, 0x1328, 0x0d7e, 0x2c68, 0x1078,
4654 0x74d7, 0x0040, 0xa0b7, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009,
4655 0xa88e, 0x210c, 0x6136, 0x2009, 0xa88f, 0x210c, 0x613a, 0x600b,
4656 0xffff, 0x6918, 0x611a, 0x601f, 0x0004, 0x1078, 0x5bf8, 0x2d60,
4657 0x1078, 0x753d, 0x0d7f, 0x007c, 0x1078, 0x753d, 0x007c, 0x0e7e,
4658 0x6018, 0x2070, 0x7000, 0xd0ec, 0x0e7f, 0x007c, 0x6010, 0xa080,
4659 0x0013, 0x200c, 0xd1ec, 0x0040, 0xa110, 0x2001, 0xa371, 0x2004,
4660 0xd0ec, 0x0040, 0xa110, 0x6003, 0x0002, 0x6024, 0xc0e5, 0x6026,
4661 0xd1ac, 0x0040, 0xa0ee, 0x0f7e, 0x2c78, 0x1078, 0x488f, 0x0f7f,
4662 0x0040, 0xa0ee, 0x2001, 0xa5a2, 0x2004, 0x603e, 0x2009, 0xa371,
4663 0x210c, 0xd1f4, 0x00c0, 0xa10e, 0x0078, 0xa100, 0x2009, 0xa371,
4664 0x210c, 0xd1f4, 0x0040, 0xa0fa, 0x6024, 0xc0e4, 0x6026, 0xa006,
4665 0x0078, 0xa110, 0x2001, 0xa5a2, 0x200c, 0x8103, 0xa100, 0x603e,
4666 0x6018, 0xa088, 0x002b, 0x2104, 0xa005, 0x0040, 0xa10b, 0xa088,
4667 0x0003, 0x0078, 0xa103, 0x2c0a, 0x600f, 0x0000, 0xa085, 0x0001,
4668 0x007c, 0x017e, 0x0c7e, 0x0e7e, 0x6120, 0xa2f0, 0x002b, 0x2e04,
4669 0x2060, 0x8cff, 0x0040, 0xa130, 0x84ff, 0x00c0, 0xa123, 0x6020,
4670 0xa106, 0x00c0, 0xa12b, 0x600c, 0x2072, 0x1078, 0x5a41, 0x1078,
4671 0x753d, 0x0078, 0xa12d, 0xacf0, 0x0003, 0x2e64, 0x0078, 0xa119,
4672 0x0e7f, 0x0c7f, 0x017f, 0x007c, 0x0d7e, 0x6018, 0xa0e8, 0x002b,
4673 0x2d04, 0xa005, 0x0040, 0xa146, 0xac06, 0x0040, 0xa144, 0x2d04,
4674 0xa0e8, 0x0003, 0x0078, 0xa138, 0x600c, 0x206a, 0x0d7f, 0x007c,
4675 0x027e, 0x037e, 0x157e, 0x2011, 0xa325, 0x2204, 0xa084, 0x00ff,
4676 0x2019, 0xa88e, 0x2334, 0xa636, 0x00c0, 0xa174, 0x8318, 0x2334,
4677 0x2204, 0xa084, 0xff00, 0xa636, 0x00c0, 0xa174, 0x2011, 0xa890,
4678 0x6018, 0xa098, 0x000a, 0x20a9, 0x0004, 0x1078, 0x7e55, 0x00c0,
4679 0xa174, 0x2011, 0xa894, 0x6018, 0xa098, 0x0006, 0x20a9, 0x0004,
4680 0x1078, 0x7e55, 0x00c0, 0xa174, 0x157f, 0x037f, 0x027f, 0x007c,
4681 0x0e7e, 0x2071, 0xa300, 0x1078, 0x41f5, 0x1078, 0x260d, 0x0e7f,
4682 0x007c, 0x0e7e, 0x6018, 0x2070, 0x7000, 0xd0fc, 0x0040, 0xa18a,
4683 0x1078, 0xa18c, 0x0e7f, 0x007c, 0x6850, 0xc0e5, 0x6852, 0x007c,
4684 0x0e7e, 0x0c7e, 0x077e, 0x067e, 0x057e, 0x047e, 0x027e, 0x017e,
4685 0x127e, 0x2091, 0x8000, 0x2029, 0xa5b4, 0x252c, 0x2021, 0xa5ba,
4686 0x2424, 0x2061, 0xaa00, 0x2071, 0xa300, 0x7644, 0x7060, 0xa606,
4687 0x0040, 0xa1e4, 0x671c, 0xa786, 0x0001, 0x0040, 0xa1b3, 0xa786,
4688 0x0008, 0x00c0, 0xa1da, 0x2500, 0xac06, 0x0040, 0xa1da, 0x2400,
4689 0xac06, 0x0040, 0xa1da, 0x1078, 0x9ee5, 0x0040, 0xa1da, 0x1078,
4690 0x9ef9, 0x00c0, 0xa1da, 0x6000, 0xa086, 0x0004, 0x00c0, 0xa1cc,
4691 0x017e, 0x1078, 0x1749, 0x017f, 0x1078, 0x8c27, 0x00c0, 0xa1d2,
4692 0x1078, 0x2839, 0x1078, 0x8c3b, 0x00c0, 0xa1d8, 0x1078, 0x7a05,
4693 0x1078, 0x8c01, 0xace0, 0x0010, 0x2001, 0xa315, 0x2004, 0xac02,
4694 0x00c8, 0xa1e4, 0x0078, 0xa1a3, 0x127f, 0x017f, 0x027f, 0x047f,
4695 0x057f, 0x067f, 0x077f, 0x0c7f, 0x0e7f, 0x007c, 0x127e, 0x007e,
4696 0x0e7e, 0x2091, 0x8000, 0x2071, 0xa340, 0xd5a4, 0x0040, 0xa1fb,
4697 0x7034, 0x8000, 0x7036, 0xd5b4, 0x0040, 0xa201, 0x7030, 0x8000,
4698 0x7032, 0xd5ac, 0x0040, 0xa208, 0x2071, 0xa34a, 0x1078, 0xa237,
4699 0x0e7f, 0x007f, 0x127f, 0x007c, 0x127e, 0x007e, 0x0e7e, 0x2091,
4700 0x8000, 0x2071, 0xa340, 0xd5a4, 0x0040, 0xa219, 0x7034, 0x8000,
4701 0x7036, 0xd5b4, 0x0040, 0xa21f, 0x7030, 0x8000, 0x7032, 0xd5ac,
4702 0x0040, 0xa226, 0x2071, 0xa34a, 0x1078, 0xa237, 0x0e7f, 0x007f,
4703 0x127f, 0x007c, 0x127e, 0x007e, 0x0e7e, 0x2091, 0x8000, 0x2071,
4704 0xa342, 0x1078, 0xa237, 0x0e7f, 0x007f, 0x127f, 0x007c, 0x2e04,
4705 0x8000, 0x2072, 0x00c8, 0xa240, 0x8e70, 0x2e04, 0x8000, 0x2072,
4706 0x007c, 0x0e7e, 0x2071, 0xa340, 0x1078, 0xa237, 0x0e7f, 0x007c,
4707 0x0e7e, 0x2071, 0xa344, 0x1078, 0xa237, 0x0e7f, 0x007c, 0x0001,
4708 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100,
4709 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x6286
4710};
4711
4712/************************************************************************
4713 * *
4714 * --- ISP2200 Initiator/Target Firmware --- *
4715 * with Fabric (Public Loop), Point-point, and *
4716 * expanded LUN addressing for FCTAPE *
4717 * *
4718 ************************************************************************
4719 Copyright (C) 2000 and 2100 Qlogic Corporation
4720 (www.qlogic.com)
4721
4722 This program is distributed in the hope that it will be useful, but
4723 WITHOUT ANY WARRANTY; without even the implied warranty of
4724 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4725 General Public License for more details.
4726************************************************************************/
4727
4728/*
4729 * Firmware Version 2.01.27 (11:07 Dec 18, 2000)
4730 */
4731
4732static unsigned short risc_code_length2200 = 0x9cbf;
4733static unsigned short risc_code2200[] = {
4734 0x0470, 0x0000, 0x0000, 0x9cbf, 0x0000, 0x0002, 0x0001, 0x001b,
4735 0x0017, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2031, 0x3939,
4736 0x3920, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
4737 0x5449, 0x4f4e, 0x2049, 0x5350, 0x3232, 0x3030, 0x2046, 0x6972,
4738 0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
4739 0x322e, 0x3031, 0x2e32, 0x3720, 0x2020, 0x2020, 0x2400, 0x20c1,
4740 0x0005, 0x2001, 0x017f, 0x2003, 0x0000, 0x20c9, 0xb1ff, 0x2091,
4741 0x2000, 0x2059, 0x0000, 0x2b78, 0x7823, 0x0004, 0x2089, 0x27b5,
4742 0x2051, 0xad00, 0x2a70, 0x2029, 0xe400, 0x2031, 0xffff, 0x2039,
4743 0xe3e9, 0x2021, 0x0200, 0x0804, 0x1449, 0x20a1, 0xacbf, 0xa00e,
4744 0x20a9, 0x0741, 0x41a4, 0x3400, 0x755e, 0x7662, 0x775a, 0x7466,
4745 0x746a, 0x20a1, 0xb400, 0x7160, 0x810d, 0x810d, 0x810d, 0x810d,
4746 0xa18c, 0x000f, 0x2001, 0x000b, 0xa112, 0xa00e, 0x21a8, 0x41a4,
4747 0x3400, 0x8211, 0x1dd8, 0x7160, 0x3400, 0xa102, 0x0120, 0x0218,
4748 0x20a8, 0xa00e, 0x41a4, 0x3800, 0xd08c, 0x01d8, 0x2009, 0xad00,
4749 0x810d, 0x810d, 0x810d, 0x810d, 0xa18c, 0x000f, 0x2001, 0x0001,
4750 0xa112, 0x20a1, 0x1000, 0xa00e, 0x21a8, 0x41a4, 0x8211, 0x1de0,
4751 0x2009, 0xad00, 0x3400, 0xa102, 0x0120, 0x0218, 0x20a8, 0xa00e,
4752 0x41a4, 0x080c, 0x13fc, 0x080c, 0x1613, 0x080c, 0x17ac, 0x080c,
4753 0x1e67, 0x080c, 0x492e, 0x080c, 0x801a, 0x080c, 0x159c, 0x080c,
4754 0x2ce6, 0x080c, 0x5a01, 0x080c, 0x5045, 0x080c, 0x6487, 0x080c,
4755 0x236a, 0x080c, 0x6686, 0x080c, 0x5fae, 0x080c, 0x226b, 0x080c,
4756 0x2338, 0x2091, 0x3009, 0x7823, 0x0000, 0x1004, 0x10c5, 0x7820,
4757 0xa086, 0x0002, 0x1150, 0x7823, 0x4000, 0x0e04, 0x10bd, 0x781b,
4758 0x0001, 0x2091, 0x5000, 0x2091, 0x4080, 0x2a70, 0x7003, 0x0000,
4759 0x2a70, 0x7000, 0xa08e, 0x0003, 0x1158, 0x080c, 0x3c98, 0x080c,
4760 0x2d0d, 0x080c, 0x5a4f, 0x080c, 0x51f4, 0x080c, 0x64a2, 0x0c80,
4761 0x000b, 0x0c98, 0x10e4, 0x10e5, 0x1203, 0x10e2, 0x12cc, 0x13f9,
4762 0x13fa, 0x13fb, 0x080c, 0x14f6, 0x0005, 0x0126, 0x00f6, 0x2091,
4763 0x8000, 0x7000, 0xa086, 0x0001, 0x1904, 0x11d1, 0x080c, 0x1569,
4764 0x080c, 0x574f, 0x0150, 0x080c, 0x5775, 0x1580, 0x2079, 0x0100,
4765 0x7828, 0xa085, 0x1800, 0x782a, 0x0448, 0x080c, 0x569a, 0x7000,
4766 0xa086, 0x0001, 0x1904, 0x11d1, 0x7088, 0xa086, 0x0028, 0x1904,
4767 0x11d1, 0x2079, 0x0100, 0x7827, 0xffff, 0x7a28, 0xa295, 0x1e2f,
4768 0x7a2a, 0x2011, 0x566e, 0x080c, 0x650d, 0x2011, 0x567b, 0x080c,
4769 0x650d, 0x2011, 0x481b, 0x080c, 0x650d, 0x2011, 0x8030, 0x2019,
4770 0x0000, 0x7087, 0x0000, 0x080c, 0x1d0f, 0x00e8, 0x080c, 0x41d1,
4771 0x2079, 0x0100, 0x7844, 0xa005, 0x1904, 0x11d1, 0x2011, 0x481b,
4772 0x080c, 0x650d, 0x2011, 0x567b, 0x080c, 0x650d, 0x080c, 0x1d0f,
4773 0x2001, 0xaf8c, 0x2004, 0x780e, 0x7840, 0xa084, 0xfffb, 0x7842,
4774 0x2011, 0x8010, 0x73c8, 0x080c, 0x3c5c, 0x7238, 0xc284, 0x723a,
4775 0x2001, 0xad0c, 0x200c, 0xc1ac, 0x2102, 0x080c, 0x79bd, 0x2011,
4776 0x0004, 0x080c, 0x959c, 0x080c, 0x4f71, 0x080c, 0x574f, 0x0158,
4777 0x080c, 0x4917, 0x0140, 0x7087, 0x0001, 0x70c3, 0x0000, 0x080c,
4778 0x436e, 0x0804, 0x11d1, 0x080c, 0x502d, 0x0120, 0x7a0c, 0xc2b4,
4779 0x7a0e, 0x0050, 0x080c, 0x9937, 0x70d0, 0xd09c, 0x1128, 0x709c,
4780 0xa005, 0x0110, 0x080c, 0x48f5, 0x70db, 0x0000, 0x70d7, 0x0000,
4781 0x72d0, 0x080c, 0x574f, 0x1178, 0x2011, 0x0000, 0x0016, 0x080c,
4782 0x2744, 0x2019, 0xaf8e, 0x211a, 0x001e, 0x704f, 0xffff, 0x7053,
4783 0x00ef, 0x7073, 0x0000, 0x2079, 0xad51, 0x7804, 0xd0ac, 0x0108,
4784 0xc295, 0x72d2, 0x080c, 0x574f, 0x0118, 0xa296, 0x0004, 0x0508,
4785 0x2011, 0x0001, 0x080c, 0x959c, 0x7097, 0x0000, 0x709b, 0xffff,
4786 0x7003, 0x0002, 0x00fe, 0x080c, 0x28fa, 0x2011, 0x0005, 0x080c,
4787 0x7adf, 0x080c, 0x6c50, 0x080c, 0x574f, 0x0148, 0x00c6, 0x2061,
4788 0x0100, 0x0016, 0x080c, 0x2744, 0x61e2, 0x001e, 0x00ce, 0x012e,
4789 0x00d0, 0x7097, 0x0000, 0x709b, 0xffff, 0x7003, 0x0002, 0x2011,
4790 0x0005, 0x080c, 0x7adf, 0x080c, 0x6c50, 0x080c, 0x574f, 0x0148,
4791 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x2744, 0x61e2, 0x001e,
4792 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6, 0x080c, 0x574f, 0x1118,
4793 0x20a9, 0x0100, 0x0010, 0x20a9, 0x0082, 0x080c, 0x574f, 0x1118,
4794 0x2009, 0x0000, 0x0010, 0x2009, 0x007e, 0x0016, 0x0026, 0x0036,
4795 0x2110, 0x0026, 0x2019, 0x0029, 0x080c, 0x7cf4, 0x002e, 0x080c,
4796 0xac07, 0x003e, 0x002e, 0x001e, 0x080c, 0x2bc9, 0x8108, 0x1f04,
4797 0x11e5, 0x00ce, 0x706f, 0x0000, 0x7070, 0xa084, 0x00ff, 0x7072,
4798 0x709f, 0x0000, 0x0005, 0x0126, 0x2091, 0x8000, 0x7000, 0xa086,
4799 0x0002, 0x1904, 0x12ca, 0x7098, 0xa086, 0xffff, 0x0130, 0x080c,
4800 0x28fa, 0x080c, 0x6c50, 0x0804, 0x12ca, 0x70d0, 0xd0ac, 0x1110,
4801 0xd09c, 0x0540, 0xd084, 0x0530, 0x0006, 0x0016, 0x2001, 0x0103,
4802 0x2009, 0xaf8c, 0x210c, 0x2102, 0x001e, 0x000e, 0xd08c, 0x01d0,
4803 0x70d4, 0xa086, 0xffff, 0x0190, 0x080c, 0x2a56, 0x080c, 0x6c50,
4804 0x70d0, 0xd094, 0x1904, 0x12ca, 0x2011, 0x0001, 0x2019, 0x0000,
4805 0x080c, 0x2a8c, 0x080c, 0x6c50, 0x0804, 0x12ca, 0x70d8, 0xa005,
4806 0x1904, 0x12ca, 0x7094, 0xa005, 0x1904, 0x12ca, 0x70d0, 0xd0a4,
4807 0x0118, 0xd0b4, 0x0904, 0x12ca, 0x080c, 0x502d, 0x1904, 0x12ca,
4808 0x2001, 0xad52, 0x2004, 0xd0ac, 0x01c8, 0x0156, 0x00c6, 0x20a9,
4809 0x007f, 0x2009, 0x0000, 0x0016, 0x080c, 0x4cdc, 0x1118, 0x6000,
4810 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04, 0x125b, 0x00ce, 0x015e,
4811 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804, 0x12ca, 0x0006, 0x0016,
4812 0x2001, 0x0103, 0x2009, 0xaf8c, 0x210c, 0x2102, 0x001e, 0x000e,
4813 0xa006, 0x2009, 0x0700, 0x20a9, 0x0002, 0x20a1, 0xafb5, 0x40a1,
4814 0x706c, 0x8007, 0x7170, 0x810f, 0x20a9, 0x0002, 0x40a1, 0x2009,
4815 0x0000, 0x080c, 0x14dc, 0x2001, 0x0000, 0x810f, 0x20a9, 0x0002,
4816 0x40a1, 0xa006, 0x2009, 0x0200, 0x20a9, 0x0002, 0x20a1, 0xafc5,
4817 0x40a1, 0x7030, 0xc08c, 0x7032, 0x7003, 0x0003, 0x709b, 0xffff,
4818 0x080c, 0x1562, 0xa006, 0x080c, 0x261e, 0x080c, 0x3cce, 0x00f6,
4819 0x2079, 0x0100, 0x080c, 0x5775, 0x0150, 0x080c, 0x574f, 0x7828,
4820 0x0118, 0xa084, 0xe1ff, 0x0010, 0xa084, 0xffdf, 0x782a, 0x00fe,
4821 0x2001, 0xafc8, 0x2004, 0xa086, 0x0005, 0x1120, 0x2011, 0x0000,
4822 0x080c, 0x7adf, 0x2011, 0x0000, 0x080c, 0x7ae9, 0x080c, 0x6c50,
4823 0x080c, 0x6d0d, 0x012e, 0x0005, 0x0016, 0x0046, 0x00f6, 0x0126,
4824 0x2091, 0x8000, 0x2079, 0x0100, 0x2009, 0xad33, 0x2104, 0xa005,
4825 0x1110, 0x080c, 0x2770, 0x2009, 0x00f7, 0x080c, 0x48de, 0x7940,
4826 0xa18c, 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0110, 0x7827, 0x0040,
4827 0xd19c, 0x0110, 0x7827, 0x0008, 0x0006, 0x0036, 0x0156, 0x7954,
4828 0xd1ac, 0x1904, 0x133a, 0x080c, 0x5761, 0x0158, 0x080c, 0x5775,
4829 0x1128, 0x2001, 0xaf9d, 0x2003, 0x0000, 0x0070, 0x080c, 0x5757,
4830 0x0dc0, 0x2001, 0xaf9d, 0x2003, 0xaaaa, 0x2001, 0xaf9e, 0x2003,
4831 0x0001, 0x080c, 0x569a, 0x0058, 0x080c, 0x574f, 0x0140, 0x2009,
4832 0x00f8, 0x080c, 0x48de, 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9,
4833 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x574f, 0x0138, 0x7824,
4834 0xd0ac, 0x1904, 0x13e0, 0x1f04, 0x1319, 0x0070, 0x7824, 0x080c,
4835 0x576b, 0x0118, 0xd0ac, 0x1904, 0x13e0, 0xa084, 0x1800, 0x0d98,
4836 0x7003, 0x0001, 0x0804, 0x13e0, 0x2001, 0x0001, 0x080c, 0x261e,
4837 0x0804, 0x13ef, 0x7850, 0xa084, 0x0180, 0x7852, 0x782f, 0x0020,
4838 0x20a9, 0x0046, 0x1d04, 0x1342, 0x2091, 0x6000, 0x1f04, 0x1342,
4839 0x7850, 0xa084, 0x0180, 0xa085, 0x0400, 0x7852, 0x782f, 0x0000,
4840 0x080c, 0x5761, 0x0158, 0x080c, 0x5775, 0x1128, 0x2001, 0xaf9d,
4841 0x2003, 0x0000, 0x0070, 0x080c, 0x5757, 0x0dc0, 0x2001, 0xaf9d,
4842 0x2003, 0xaaaa, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x080c, 0x569a,
4843 0x0020, 0x2009, 0x00f8, 0x080c, 0x48de, 0x20a9, 0x000e, 0xe000,
4844 0x1f04, 0x136f, 0x7850, 0xa084, 0x0180, 0xa085, 0x1400, 0x7852,
4845 0x080c, 0x574f, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021,
4846 0xe678, 0x2019, 0xea60, 0x7820, 0xd09c, 0x1558, 0x080c, 0x574f,
4847 0x05b8, 0x7824, 0xd0ac, 0x1904, 0x13e0, 0x080c, 0x5775, 0x1508,
4848 0x0046, 0x2021, 0x0190, 0x8421, 0x1df0, 0x004e, 0x8421, 0x11c8,
4849 0x7827, 0x0048, 0x20a9, 0x01f4, 0x1d04, 0x139c, 0x2091, 0x6000,
4850 0x1f04, 0x139c, 0x7824, 0xa084, 0x0068, 0x15a8, 0x2001, 0xaf9d,
4851 0x2003, 0xaaaa, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x7003, 0x0001,
4852 0x0478, 0x8319, 0x1980, 0x2009, 0xad33, 0x2104, 0x8000, 0x200a,
4853 0xa084, 0xfff0, 0x0120, 0x200b, 0x0000, 0x080c, 0x2770, 0x00d8,
4854 0x080c, 0x5761, 0x1140, 0xa4a2, 0x0064, 0x1128, 0x080c, 0x5726,
4855 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, 0xe000, 0xe000, 0x7824,
4856 0x080c, 0x576b, 0x0110, 0xd0ac, 0x1158, 0xa084, 0x1800, 0x09c8,
4857 0x7003, 0x0001, 0x0028, 0x2001, 0x0001, 0x080c, 0x261e, 0x0048,
4858 0x2001, 0xad33, 0x2003, 0x0000, 0x7827, 0x0048, 0x7828, 0xc09d,
4859 0x782a, 0x7850, 0xa084, 0x0180, 0xa085, 0x0400, 0x7852, 0x015e,
4860 0x003e, 0x000e, 0x080c, 0x1539, 0x012e, 0x00fe, 0x004e, 0x001e,
4861 0x0005, 0x0005, 0x0005, 0x0005, 0x2a70, 0x2001, 0xaf9d, 0x2003,
4862 0x0000, 0x7087, 0x0000, 0x2009, 0x0100, 0x2104, 0xa082, 0x0002,
4863 0x0218, 0x704f, 0xffff, 0x0010, 0x704f, 0x0000, 0x7057, 0xffff,
4864 0x706f, 0x0000, 0x7073, 0x0000, 0x080c, 0x9937, 0x2061, 0xaf8d,
4865 0x6003, 0x0909, 0x6007, 0x0000, 0x600b, 0x8800, 0x600f, 0x0200,
4866 0x6013, 0x00ff, 0x6017, 0x0003, 0x601b, 0x0000, 0x601f, 0x07d0,
4867 0x2061, 0xaf95, 0x6003, 0x8000, 0x6007, 0x0000, 0x600b, 0x0000,
4868 0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x0000, 0x601b, 0x0001,
4869 0x601f, 0x0000, 0x2061, 0xafa6, 0x6003, 0x514c, 0x6007, 0x4f47,
4870 0x600b, 0x4943, 0x600f, 0x2020, 0x2001, 0xad27, 0x2003, 0x0000,
4871 0x0005, 0x04a0, 0x2011, 0x0000, 0x81ff, 0x0570, 0xa186, 0x0001,
4872 0x1148, 0x2031, 0x8fff, 0x2039, 0xcc01, 0x2021, 0x0100, 0x2029,
4873 0xcc00, 0x00e8, 0xa186, 0x0002, 0x1118, 0x2011, 0x0000, 0x00b8,
4874 0xa186, 0x0005, 0x1118, 0x2011, 0x0001, 0x0088, 0xa186, 0x0009,
4875 0x1118, 0x2011, 0x0002, 0x0058, 0xa186, 0x000a, 0x1118, 0x2011,
4876 0x0002, 0x0028, 0xa186, 0x0055, 0x1110, 0x2011, 0x0003, 0x3800,
4877 0xa084, 0xfffc, 0xa205, 0x20c0, 0x0804, 0x104d, 0xa00e, 0x2011,
4878 0x0003, 0x2019, 0x1485, 0x0804, 0x14d6, 0x2019, 0xaaaa, 0x2061,
4879 0xffff, 0x2c14, 0x2362, 0xe000, 0xe000, 0x2c04, 0xa306, 0x2262,
4880 0x1110, 0xc1b5, 0xc1a5, 0x2011, 0x0000, 0x2019, 0x1498, 0x04f0,
4881 0x2019, 0xaaaa, 0x2061, 0xffff, 0x2c14, 0x2362, 0xe000, 0xe000,
4882 0x2c1c, 0x2061, 0x7fff, 0xe000, 0xe000, 0x2c04, 0x2061, 0xffff,
4883 0x2262, 0xa306, 0x0110, 0xc18d, 0x0008, 0xc185, 0x2011, 0x0002,
4884 0x2019, 0x14b3, 0x0418, 0x2061, 0xffff, 0x2019, 0xaaaa, 0x2c14,
4885 0x2362, 0xe000, 0xe000, 0x2c04, 0x2262, 0xa306, 0x1180, 0x2c14,
4886 0x2362, 0xe000, 0xe000, 0x2c1c, 0x2061, 0x7fff, 0x2c04, 0x2061,
4887 0xffff, 0x2262, 0xa306, 0x1110, 0xc195, 0x0008, 0xc19d, 0x2011,
4888 0x0001, 0x2019, 0x14d4, 0x0010, 0x0804, 0x144a, 0x3800, 0xa084,
4889 0xfffc, 0xa205, 0x20c0, 0x0837, 0x2011, 0x0000, 0x080c, 0x4cdc,
4890 0x1178, 0x6004, 0xa0c4, 0x00ff, 0xa8c6, 0x0006, 0x0128, 0xa0c4,
4891 0xff00, 0xa8c6, 0x0600, 0x1120, 0xa186, 0x0080, 0x0108, 0x8210,
4892 0x8108, 0xa186, 0x0100, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
4893 0x0e04, 0x14f8, 0x0006, 0x0016, 0x2079, 0x0000, 0x7818, 0xd084,
4894 0x1de8, 0x001e, 0x792e, 0x000e, 0x782a, 0x000e, 0x7826, 0x3900,
4895 0x783a, 0x7823, 0x8002, 0x781b, 0x0001, 0x2091, 0x5000, 0x0126,
4896 0x0156, 0x0146, 0x20a9, 0x0010, 0x20a1, 0xb0c8, 0x2091, 0x2000,
4897 0x40a1, 0x20a9, 0x0010, 0x2091, 0x2200, 0x40a1, 0x20a9, 0x0010,
4898 0x2091, 0x2400, 0x40a1, 0x20a9, 0x0010, 0x2091, 0x2600, 0x40a1,
4899 0x20a9, 0x0010, 0x2091, 0x2800, 0x40a1, 0x014e, 0x015e, 0x012e,
4900 0x2079, 0xad00, 0x7803, 0x0005, 0x2091, 0x4080, 0x04c9, 0x0cf8,
4901 0x0005, 0x0006, 0x080c, 0x1584, 0x1518, 0x00f6, 0x2079, 0xad23,
4902 0x2f04, 0x8000, 0x207a, 0xa082, 0x000f, 0x0258, 0xa006, 0x207a,
4903 0x2079, 0xad25, 0x2f04, 0xa084, 0x0001, 0xa086, 0x0001, 0x207a,
4904 0x0070, 0x2079, 0xad25, 0x2f7c, 0x8fff, 0x1128, 0x2001, 0x0c03,
4905 0x2003, 0x0040, 0x0020, 0x2001, 0x0c03, 0x2003, 0x00c0, 0x00fe,
4906 0x000e, 0x0005, 0x0409, 0x1120, 0x2001, 0x0c03, 0x2003, 0x0080,
4907 0x0005, 0x00d1, 0x1120, 0x2001, 0x0c03, 0x2003, 0x0040, 0x0005,
4908 0x0006, 0x0091, 0x1178, 0x2001, 0x0c03, 0x2003, 0x0040, 0x2009,
4909 0x0fff, 0x00a1, 0x2001, 0x0c03, 0x2003, 0x0080, 0x2009, 0x0fff,
4910 0x0069, 0x0c88, 0x000e, 0x0005, 0x00c6, 0x2061, 0x0c00, 0x2c04,
4911 0xa084, 0x00ff, 0xa086, 0x00aa, 0x00ce, 0x0005, 0x0156, 0x0126,
4912 0xa18c, 0x0fff, 0x21a8, 0x1d04, 0x1593, 0x2091, 0x6000, 0x1f04,
4913 0x1593, 0x012e, 0x015e, 0x0005, 0x2071, 0xad00, 0x715c, 0x712e,
4914 0x2021, 0x0001, 0xa190, 0x0030, 0xa298, 0x0030, 0x0240, 0x7060,
4915 0xa302, 0x1228, 0x220a, 0x2208, 0x2310, 0x8420, 0x0ca8, 0x3800,
4916 0xd08c, 0x0148, 0x7060, 0xa086, 0xad00, 0x0128, 0x7063, 0xad00,
4917 0x2011, 0x1000, 0x0c48, 0x200b, 0x0000, 0x74ae, 0x74b2, 0x0005,
4918 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0xad00, 0x70b0, 0xa0ea,
4919 0x0010, 0x0268, 0x8001, 0x70b2, 0x702c, 0x2068, 0x2d04, 0x702e,
4920 0x206b, 0x0000, 0x6807, 0x0000, 0x012e, 0x00ee, 0x0005, 0xa06e,
4921 0x0cd8, 0x00e6, 0x2071, 0xad00, 0x0126, 0x2091, 0x8000, 0x70b0,
4922 0x8001, 0x0260, 0x70b2, 0x702c, 0x2068, 0x2d04, 0x702e, 0x206b,
4923 0x0000, 0x6807, 0x0000, 0x012e, 0x00ee, 0x0005, 0xa06e, 0x0cd8,
4924 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0xad00, 0x702c, 0x206a,
4925 0x2d00, 0x702e, 0x70b0, 0x8000, 0x70b2, 0x012e, 0x00ee, 0x0005,
4926 0x8dff, 0x0138, 0x6804, 0x6807, 0x0000, 0x0006, 0x0c49, 0x00de,
4927 0x0cb8, 0x0005, 0x00e6, 0x2071, 0xad00, 0x70b0, 0xa08a, 0x0010,
4928 0xa00d, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xafec, 0x7007, 0x0000,
4929 0x701b, 0x0000, 0x701f, 0x0000, 0x2071, 0x0000, 0x7010, 0xa085,
4930 0x8004, 0x7012, 0x00ee, 0x0005, 0x00e6, 0x2270, 0x700b, 0x0000,
4931 0x2071, 0xafec, 0x7018, 0xa088, 0xaff5, 0x220a, 0x8000, 0xa084,
4932 0x0007, 0x701a, 0x7004, 0xa005, 0x1128, 0x00f6, 0x2079, 0x0010,
4933 0x0081, 0x00fe, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xafec, 0x7004,
4934 0xa005, 0x1128, 0x00f6, 0x2079, 0x0010, 0x0019, 0x00fe, 0x00ee,
4935 0x0005, 0x7000, 0x0002, 0x164f, 0x16b3, 0x16d0, 0x16d0, 0x7018,
4936 0x711c, 0xa106, 0x1118, 0x7007, 0x0000, 0x0005, 0x00d6, 0xa180,
4937 0xaff5, 0x2004, 0x700a, 0x2068, 0x8108, 0xa18c, 0x0007, 0x711e,
4938 0x7803, 0x0026, 0x6824, 0x7832, 0x6828, 0x7836, 0x682c, 0x783a,
4939 0x6830, 0x783e, 0x6810, 0x700e, 0x680c, 0x7016, 0x6804, 0x00de,
4940 0xd084, 0x0120, 0x7007, 0x0001, 0x0029, 0x0005, 0x7007, 0x0002,
4941 0x00b1, 0x0005, 0x0016, 0x0026, 0x710c, 0x2011, 0x0040, 0xa182,
4942 0x0040, 0x1210, 0x2110, 0xa006, 0x700e, 0x7212, 0x8203, 0x7822,
4943 0x7803, 0x0020, 0x7803, 0x0041, 0x002e, 0x001e, 0x0005, 0x0016,
4944 0x0026, 0x0136, 0x0146, 0x0156, 0x7014, 0x2098, 0x20a1, 0x0014,
4945 0x7803, 0x0026, 0x710c, 0x2011, 0x0040, 0xa182, 0x0040, 0x1210,
4946 0x2110, 0xa006, 0x700e, 0x22a8, 0x53a6, 0x8203, 0x7822, 0x7803,
4947 0x0020, 0x3300, 0x7016, 0x7803, 0x0001, 0x015e, 0x014e, 0x013e,
4948 0x002e, 0x001e, 0x0005, 0x0136, 0x0146, 0x0156, 0x2099, 0xadf9,
4949 0x20a1, 0x0018, 0x20a9, 0x0008, 0x53a3, 0x7803, 0x0020, 0x0126,
4950 0x2091, 0x8000, 0x7803, 0x0041, 0x7007, 0x0003, 0x7000, 0xc084,
4951 0x7002, 0x700b, 0xadf4, 0x012e, 0x015e, 0x014e, 0x013e, 0x0005,
4952 0x0136, 0x0146, 0x0156, 0x2001, 0xae28, 0x209c, 0x20a1, 0x0014,
4953 0x7803, 0x0026, 0x2001, 0xae29, 0x20ac, 0x53a6, 0x2099, 0xae2a,
4954 0x20a1, 0x0018, 0x20a9, 0x0008, 0x53a3, 0x7803, 0x0020, 0x0126,
4955 0x2091, 0x8000, 0x7803, 0x0001, 0x7007, 0x0004, 0x7000, 0xc08c,
4956 0x7002, 0x700b, 0xae25, 0x012e, 0x015e, 0x014e, 0x013e, 0x0005,
4957 0x0016, 0x00e6, 0x2071, 0xafec, 0x00f6, 0x2079, 0x0010, 0x7904,
4958 0x7803, 0x0002, 0xd1fc, 0x0120, 0xa18c, 0x0700, 0x7004, 0x0023,
4959 0x00fe, 0x00ee, 0x001e, 0x0005, 0x1649, 0x1713, 0x1741, 0x176b,
4960 0x179b, 0x1712, 0x0cf8, 0xa18c, 0x0700, 0x1528, 0x0136, 0x0146,
4961 0x0156, 0x7014, 0x20a0, 0x2099, 0x0014, 0x7803, 0x0040, 0x7010,
4962 0x20a8, 0x53a5, 0x3400, 0x7016, 0x015e, 0x014e, 0x013e, 0x700c,
4963 0xa005, 0x0570, 0x7830, 0x7832, 0x7834, 0x7836, 0x080c, 0x167a,
4964 0x0005, 0x7008, 0xa080, 0x0002, 0x2003, 0x0100, 0x7007, 0x0000,
4965 0x080c, 0x1649, 0x0005, 0x7008, 0xa080, 0x0002, 0x2003, 0x0200,
4966 0x0ca8, 0xa18c, 0x0700, 0x1150, 0x700c, 0xa005, 0x0188, 0x7830,
4967 0x7832, 0x7834, 0x7836, 0x080c, 0x168f, 0x0005, 0x7008, 0xa080,
4968 0x0002, 0x2003, 0x0200, 0x7007, 0x0000, 0x080c, 0x1649, 0x0005,
4969 0x00d6, 0x7008, 0x2068, 0x7830, 0x6826, 0x7834, 0x682a, 0x7838,
4970 0x682e, 0x783c, 0x6832, 0x680b, 0x0100, 0x00de, 0x7007, 0x0000,
4971 0x080c, 0x1649, 0x0005, 0xa18c, 0x0700, 0x1540, 0x0136, 0x0146,
4972 0x0156, 0x2001, 0xadf7, 0x2004, 0xa080, 0x000d, 0x20a0, 0x2099,
4973 0x0014, 0x7803, 0x0040, 0x20a9, 0x0020, 0x53a5, 0x2001, 0xadf9,
4974 0x2004, 0xd0bc, 0x0148, 0x2001, 0xae02, 0x2004, 0xa080, 0x000d,
4975 0x20a0, 0x20a9, 0x0020, 0x53a5, 0x015e, 0x014e, 0x013e, 0x7007,
4976 0x0000, 0x080c, 0x5ae6, 0x080c, 0x1649, 0x0005, 0x2011, 0x8003,
4977 0x080c, 0x3c5c, 0x0cf8, 0xa18c, 0x0700, 0x1148, 0x2001, 0xae27,
4978 0x2003, 0x0100, 0x7007, 0x0000, 0x080c, 0x1649, 0x0005, 0x2011,
4979 0x8004, 0x080c, 0x3c5c, 0x0cf8, 0x0126, 0x2091, 0x2200, 0x2079,
4980 0x0030, 0x2071, 0xaffd, 0x7003, 0x0000, 0x700f, 0xb003, 0x7013,
4981 0xb003, 0x780f, 0x00f6, 0x7803, 0x0004, 0x012e, 0x0005, 0x6934,
4982 0xa184, 0x0007, 0x0002, 0x17cb, 0x1809, 0x17cb, 0x17cb, 0x17cb,
4983 0x17f1, 0x17d8, 0x17cf, 0xa085, 0x0001, 0x0804, 0x1823, 0x684c,
4984 0xd0bc, 0x0dc8, 0x6860, 0x682e, 0x685c, 0x682a, 0x6858, 0x04c8,
4985 0xa18c, 0x00ff, 0xa186, 0x001e, 0x1d70, 0x684c, 0xd0bc, 0x0d58,
4986 0x6860, 0x682e, 0x685c, 0x682a, 0x6804, 0x681a, 0xa080, 0x000d,
4987 0x2004, 0xa084, 0x000f, 0xa080, 0x2186, 0x2005, 0x6832, 0x6858,
4988 0x0440, 0xa18c, 0x00ff, 0xa186, 0x0015, 0x19a8, 0x684c, 0xd0ac,
4989 0x0990, 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f,
4990 0xa080, 0x2186, 0x2005, 0x6832, 0xa006, 0x682e, 0x682a, 0x6858,
4991 0x0080, 0x684c, 0xd0ac, 0x0904, 0x17cb, 0xa006, 0x682e, 0x682a,
4992 0x6858, 0xa18c, 0x000f, 0xa188, 0x2186, 0x210d, 0x6932, 0x2d08,
4993 0x691a, 0x6826, 0x684c, 0xc0dd, 0x684e, 0xa006, 0x680a, 0x697c,
4994 0x6912, 0x6980, 0x6916, 0x0005, 0x20e1, 0x0007, 0x20e1, 0x2000,
4995 0x2001, 0x020a, 0x2004, 0x82ff, 0x01a8, 0xa280, 0x0004, 0x00d6,
4996 0x206c, 0x684c, 0xd0dc, 0x1150, 0x080c, 0x17bf, 0x0138, 0x00de,
4997 0xa280, 0x0000, 0x2003, 0x0002, 0xa016, 0x0020, 0x6808, 0x8000,
4998 0x680a, 0x00de, 0x0126, 0x0046, 0x0036, 0x0026, 0x2091, 0x2200,
4999 0x002e, 0x003e, 0x004e, 0x7000, 0xa005, 0x01d0, 0x710c, 0x220a,
5000 0x8108, 0x230a, 0x8108, 0x240a, 0x8108, 0xa182, 0xb01e, 0x0210,
5001 0x2009, 0xb003, 0x710e, 0x7010, 0xa102, 0xa082, 0x0009, 0x0118,
5002 0xa080, 0x001b, 0x1118, 0x2009, 0x0138, 0x200a, 0x012e, 0x0005,
5003 0x7206, 0x2001, 0x1866, 0x0006, 0x2260, 0x0804, 0x197a, 0x0126,
5004 0x0026, 0x0036, 0x00c6, 0x0006, 0x2091, 0x2200, 0x000e, 0x004e,
5005 0x003e, 0x002e, 0x00d6, 0x00c6, 0x2460, 0x6110, 0x2168, 0x6a62,
5006 0x6b5e, 0xa005, 0x0904, 0x18c8, 0x6808, 0xa005, 0x0904, 0x18ff,
5007 0x7000, 0xa005, 0x1108, 0x0488, 0x700c, 0x7110, 0xa106, 0x1904,
5008 0x1907, 0x7004, 0xa406, 0x1548, 0x2001, 0x0005, 0x2004, 0xd08c,
5009 0x0168, 0x0046, 0x080c, 0x1a6c, 0x004e, 0x2460, 0x6010, 0xa080,
5010 0x0002, 0x2004, 0xa005, 0x0904, 0x18ff, 0x0c10, 0x2001, 0x0207,
5011 0x2004, 0xd09c, 0x1d48, 0x7804, 0xa084, 0x6000, 0x0120, 0xa086,
5012 0x6000, 0x0108, 0x0c08, 0x7818, 0x6812, 0x781c, 0x6816, 0x7803,
5013 0x0004, 0x7003, 0x0000, 0x7004, 0x2060, 0x6100, 0xa18e, 0x0004,
5014 0x1904, 0x1907, 0x2009, 0x0048, 0x080c, 0x80a7, 0x0804, 0x1907,
5015 0x6808, 0xa005, 0x05a0, 0x7000, 0xa005, 0x0588, 0x700c, 0x7110,
5016 0xa106, 0x1118, 0x7004, 0xa406, 0x1550, 0x2001, 0x0005, 0x2004,
5017 0xd08c, 0x0160, 0x0046, 0x080c, 0x1a6c, 0x004e, 0x2460, 0x6010,
5018 0xa080, 0x0002, 0x2004, 0xa005, 0x01d0, 0x0c28, 0x2001, 0x0207,
5019 0x2004, 0xd09c, 0x1d50, 0x2001, 0x0005, 0x2004, 0xd08c, 0x1d50,
5020 0x7804, 0xa084, 0x6000, 0x0118, 0xa086, 0x6000, 0x19f0, 0x7818,
5021 0x6812, 0x781c, 0x6816, 0x7803, 0x0004, 0x7003, 0x0000, 0x6100,
5022 0xa18e, 0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0x80a7, 0x00ce,
5023 0x00de, 0x012e, 0x0005, 0x00f6, 0x00e6, 0x0026, 0x0036, 0x0046,
5024 0x0056, 0x080c, 0x1d86, 0x0026, 0x0056, 0x2071, 0xaffd, 0x7000,
5025 0xa086, 0x0000, 0x0580, 0x7004, 0xac06, 0x11f8, 0x2079, 0x0030,
5026 0x7000, 0xa086, 0x0003, 0x01c8, 0x7804, 0xd0fc, 0x1198, 0x2001,
5027 0x0207, 0x2004, 0xd09c, 0x1dc0, 0x7803, 0x0004, 0x7804, 0xd0ac,
5028 0x1de8, 0x7803, 0x0002, 0x7803, 0x0009, 0x7003, 0x0003, 0x7007,
5029 0x0000, 0x0018, 0x080c, 0x1a6c, 0x08d0, 0x0156, 0x20a9, 0x0009,
5030 0x2009, 0xb003, 0x2104, 0xac06, 0x1108, 0x200a, 0xa188, 0x0003,
5031 0x1f04, 0x1942, 0x015e, 0x005e, 0x002e, 0x2001, 0x015d, 0x201c,
5032 0x831a, 0x2302, 0x2001, 0x0160, 0x2502, 0x2001, 0x0138, 0x2202,
5033 0x005e, 0x004e, 0x003e, 0x002e, 0x00ee, 0x00fe, 0x0005, 0x700c,
5034 0x7110, 0xa106, 0x0904, 0x19dd, 0x2104, 0x7006, 0x2060, 0x8108,
5035 0x211c, 0x8108, 0x2124, 0x8108, 0xa182, 0xb01e, 0x0210, 0x2009,
5036 0xb003, 0x7112, 0x700c, 0xa106, 0x1128, 0x080c, 0x2744, 0x2001,
5037 0x0138, 0x2102, 0x8cff, 0x0588, 0x6010, 0x2068, 0x2d58, 0x6828,
5038 0xa406, 0x1580, 0x682c, 0xa306, 0x1568, 0x7004, 0x2060, 0x6020,
5039 0xc0d4, 0x6022, 0x684c, 0xd0f4, 0x0128, 0x6817, 0xffff, 0x6813,
5040 0xffff, 0x00d8, 0x6850, 0xd0f4, 0x1130, 0x7803, 0x0004, 0x6810,
5041 0x781a, 0x6814, 0x781e, 0x6824, 0x2050, 0x6818, 0x2060, 0x6830,
5042 0x2040, 0x6034, 0xa0cc, 0x000f, 0x2009, 0x0011, 0x04c9, 0x0118,
5043 0x2009, 0x0001, 0x04a9, 0x2d58, 0x0005, 0x080c, 0x1ced, 0x0904,
5044 0x195f, 0x0cd0, 0x6020, 0xd0d4, 0x01b8, 0x6038, 0xa402, 0x6034,
5045 0xa303, 0x0108, 0x1288, 0x643a, 0x6336, 0x6c2a, 0x6b2e, 0x0046,
5046 0x0036, 0x2400, 0x6c7c, 0xa402, 0x6812, 0x2300, 0x6b80, 0xa303,
5047 0x6816, 0x003e, 0x004e, 0x0018, 0x080c, 0x98cb, 0x09f0, 0x601c,
5048 0xa08e, 0x0008, 0x0904, 0x1985, 0xa08e, 0x000a, 0x0904, 0x1985,
5049 0x080c, 0x21a6, 0x1990, 0x0804, 0x1985, 0x7003, 0x0000, 0x0005,
5050 0x8aff, 0x0904, 0x1a46, 0xa03e, 0x2730, 0x6850, 0xd0fc, 0x11b8,
5051 0xd0f4, 0x1528, 0x00d6, 0x2805, 0xac68, 0x2900, 0x0002, 0x1a30,
5052 0x1a15, 0x1a15, 0x1a30, 0x1a30, 0x1a29, 0x1a30, 0x1a15, 0x1a30,
5053 0x1a1a, 0x1a1a, 0x1a30, 0x1a30, 0x1a30, 0x1a21, 0x1a1a, 0x7803,
5054 0x0004, 0xc0fc, 0x6852, 0x6b6c, 0x6a70, 0x6d1c, 0x6c20, 0x00d6,
5055 0xd99c, 0x0548, 0x2805, 0xac68, 0x6f08, 0x6e0c, 0x0420, 0xc0f4,
5056 0x6852, 0x6b6c, 0x6a70, 0x00d6, 0x0428, 0x6b08, 0x6a0c, 0x6d00,
5057 0x6c04, 0x00c8, 0x6b10, 0x6a14, 0x6d00, 0x6c04, 0x6f08, 0x6e0c,
5058 0x0090, 0x00de, 0x00d6, 0x6834, 0xa084, 0x00ff, 0xa086, 0x001e,
5059 0x1138, 0x00de, 0x080c, 0x2148, 0x1904, 0x19e0, 0xa00e, 0x00b0,
5060 0x00de, 0x080c, 0x14f6, 0x7b22, 0x7a26, 0x7d32, 0x7c36, 0x7f3a,
5061 0x7e3e, 0x7902, 0x7000, 0x8000, 0x7002, 0x00de, 0x6828, 0xa300,
5062 0x682a, 0x682c, 0xa201, 0x682e, 0x080c, 0x2148, 0x0005, 0x080c,
5063 0x14f6, 0x080c, 0x1e1a, 0x7004, 0x2060, 0x00d6, 0x6010, 0x2068,
5064 0x7003, 0x0000, 0x080c, 0x1d22, 0x080c, 0x9596, 0x0170, 0x6808,
5065 0x8001, 0x680a, 0x697c, 0x6912, 0x6980, 0x6916, 0x682b, 0xffff,
5066 0x682f, 0xffff, 0x6850, 0xc0bd, 0x6852, 0x00de, 0x080c, 0x929c,
5067 0x0804, 0x1c5e, 0x080c, 0x14f6, 0x0126, 0x2091, 0x2200, 0x0006,
5068 0x0016, 0x2b68, 0x6818, 0x2060, 0x7904, 0x7803, 0x0002, 0xa184,
5069 0x0700, 0x1978, 0xa184, 0x0003, 0xa086, 0x0003, 0x0d58, 0x7000,
5070 0x0002, 0x1a89, 0x1a8f, 0x1b92, 0x1c39, 0x1c4d, 0x1a89, 0x1a89,
5071 0x1a89, 0x7804, 0xd09c, 0x1904, 0x1c5e, 0x080c, 0x14f6, 0x8001,
5072 0x7002, 0xa184, 0x0880, 0x1190, 0xd19c, 0x1904, 0x1b20, 0x8aff,
5073 0x0904, 0x1b20, 0x2009, 0x0001, 0x080c, 0x19e0, 0x0904, 0x1c5e,
5074 0x2009, 0x0001, 0x080c, 0x19e0, 0x0804, 0x1c5e, 0x7803, 0x0004,
5075 0x7003, 0x0000, 0xd1bc, 0x1904, 0x1b00, 0x0026, 0x0036, 0x7c20,
5076 0x7d24, 0x7e30, 0x7f34, 0x7818, 0x6812, 0x781c, 0x6816, 0x2001,
5077 0x0201, 0x2004, 0xa005, 0x0140, 0x7808, 0xd0ec, 0x1128, 0x7803,
5078 0x0009, 0x7003, 0x0004, 0x0010, 0x080c, 0x1c62, 0x6b28, 0x6a2c,
5079 0x2400, 0x686e, 0xa31a, 0x2500, 0x6872, 0xa213, 0x6b2a, 0x6a2e,
5080 0x00c6, 0x7004, 0x2060, 0x6020, 0xd0f4, 0x1110, 0x633a, 0x6236,
5081 0x00ce, 0x003e, 0x002e, 0x6e1e, 0x6f22, 0x080c, 0x215e, 0x2a00,
5082 0x6826, 0x2c00, 0x681a, 0x2800, 0x6832, 0x6850, 0xc0fd, 0x6852,
5083 0x6808, 0x8001, 0x680a, 0x1148, 0x684c, 0xd0e4, 0x0130, 0x7004,
5084 0x2060, 0x2009, 0x0048, 0x080c, 0x80a7, 0x7000, 0xa086, 0x0004,
5085 0x0904, 0x1c5e, 0x7003, 0x0000, 0x080c, 0x195f, 0x0804, 0x1c5e,
5086 0x0056, 0x7d0c, 0xd5bc, 0x1110, 0x080c, 0xac73, 0x005e, 0x080c,
5087 0x1d22, 0x00f6, 0x7004, 0x2078, 0x080c, 0x5029, 0x0118, 0x7820,
5088 0xc0f5, 0x7822, 0x00fe, 0x682b, 0xffff, 0x682f, 0xffff, 0x6808,
5089 0x8001, 0x680a, 0x697c, 0x791a, 0x6980, 0x791e, 0x0804, 0x1c5e,
5090 0x7004, 0x00c6, 0x2060, 0x6020, 0x00ce, 0xd0f4, 0x0128, 0x6808,
5091 0x8001, 0x680a, 0x0804, 0x1c5e, 0x7818, 0x6812, 0x7a1c, 0x6a16,
5092 0xd19c, 0x0160, 0xa205, 0x0150, 0x7004, 0xa080, 0x0007, 0x2004,
5093 0xa084, 0xfffd, 0xa086, 0x0008, 0x1904, 0x1aa6, 0x684c, 0xc0f5,
5094 0x684e, 0x7814, 0xa005, 0x1180, 0x7003, 0x0000, 0x6808, 0x8001,
5095 0x680a, 0x1130, 0x7004, 0x2060, 0x2009, 0x0048, 0x080c, 0x80a7,
5096 0x080c, 0x195f, 0x0804, 0x1c5e, 0x7818, 0x6812, 0x781c, 0x6816,
5097 0x7814, 0x7908, 0xa18c, 0x0fff, 0xa188, 0x0007, 0x8114, 0x8214,
5098 0x8214, 0xa10a, 0x8104, 0x8004, 0x8004, 0xa20a, 0x810b, 0x810b,
5099 0x810b, 0x080c, 0x1da5, 0x7803, 0x0004, 0x780f, 0xffff, 0x7803,
5100 0x0001, 0x7804, 0xd0fc, 0x0de8, 0x7803, 0x0002, 0x7803, 0x0004,
5101 0x780f, 0x00f6, 0x7004, 0x7007, 0x0000, 0x2060, 0x2009, 0x0048,
5102 0x080c, 0x80a7, 0x080c, 0x1dd7, 0x0958, 0x7908, 0xd1ec, 0x1118,
5103 0x2009, 0x0009, 0x0010, 0x2009, 0x0019, 0x7902, 0x7003, 0x0003,
5104 0x0804, 0x1c5e, 0x8001, 0x7002, 0xd194, 0x01a8, 0x7804, 0xd0fc,
5105 0x1904, 0x1c2c, 0xd09c, 0x0130, 0x7804, 0xd0fc, 0x1904, 0x1a74,
5106 0xd09c, 0x11a8, 0x8aff, 0x0904, 0x1c5e, 0x2009, 0x0001, 0x080c,
5107 0x19e0, 0x0804, 0x1c5e, 0xa184, 0x0888, 0x1148, 0x8aff, 0x0904,
5108 0x1c5e, 0x2009, 0x0001, 0x080c, 0x19e0, 0x0804, 0x1c5e, 0x7818,
5109 0x6812, 0x7a1c, 0x6a16, 0xa205, 0x0904, 0x1b3e, 0x7803, 0x0004,
5110 0x7003, 0x0000, 0xd1bc, 0x1904, 0x1c0f, 0x6834, 0xa084, 0x00ff,
5111 0xa086, 0x0029, 0x1118, 0xd19c, 0x1904, 0x1b3e, 0x0026, 0x0036,
5112 0x7c20, 0x7d24, 0x7e30, 0x7f34, 0x7818, 0x6812, 0x781c, 0x6816,
5113 0x2001, 0x0201, 0x2004, 0xa005, 0x0140, 0x7808, 0xd0ec, 0x1128,
5114 0x7803, 0x0009, 0x7003, 0x0004, 0x0020, 0x0016, 0x080c, 0x1c62,
5115 0x001e, 0x6b28, 0x6a2c, 0x080c, 0x215e, 0x00d6, 0x2805, 0xac68,
5116 0x6034, 0xd09c, 0x1128, 0x6808, 0xa31a, 0x680c, 0xa213, 0x0020,
5117 0x6810, 0xa31a, 0x6814, 0xa213, 0x00de, 0xd194, 0x0904, 0x1ac8,
5118 0x2a00, 0x6826, 0x2c00, 0x681a, 0x2800, 0x6832, 0x6808, 0x8001,
5119 0x680a, 0x6b2a, 0x6a2e, 0x003e, 0x002e, 0x0804, 0x1b50, 0x0056,
5120 0x7d0c, 0x080c, 0xac73, 0x005e, 0x080c, 0x1d22, 0x00f6, 0x7004,
5121 0x2078, 0x080c, 0x5029, 0x0118, 0x7820, 0xc0f5, 0x7822, 0x00fe,
5122 0x682b, 0xffff, 0x682f, 0xffff, 0x6808, 0x8001, 0x680a, 0x697c,
5123 0x791a, 0x6980, 0x791e, 0x0490, 0x7804, 0xd09c, 0x0904, 0x1a74,
5124 0x7c20, 0x7824, 0xa405, 0x1904, 0x1a74, 0x7803, 0x0002, 0x0804,
5125 0x1bb7, 0x7803, 0x0004, 0x7003, 0x0000, 0x7004, 0xa00d, 0x0150,
5126 0x6808, 0x8001, 0x680a, 0x1130, 0x7004, 0x2060, 0x2009, 0x0048,
5127 0x080c, 0x80a7, 0x080c, 0x195f, 0x0088, 0x7803, 0x0004, 0x7003,
5128 0x0000, 0x7004, 0x2060, 0x6010, 0xa005, 0x0da0, 0x2068, 0x6808,
5129 0x8000, 0x680a, 0x6c28, 0x6b2c, 0x080c, 0x197a, 0x001e, 0x000e,
5130 0x012e, 0x0005, 0x700c, 0x7110, 0xa106, 0x0904, 0x1ce1, 0x7004,
5131 0x0016, 0x210c, 0xa106, 0x001e, 0x0904, 0x1ce1, 0x00d6, 0x00c6,
5132 0x216c, 0x2d00, 0xa005, 0x0904, 0x1cdf, 0x6820, 0xd0d4, 0x1904,
5133 0x1cdf, 0x6810, 0x2068, 0x6850, 0xd0fc, 0x0558, 0x8108, 0x2104,
5134 0x6b2c, 0xa306, 0x1904, 0x1cdf, 0x8108, 0x2104, 0x6a28, 0xa206,
5135 0x1904, 0x1cdf, 0x6850, 0xc0fc, 0xc0f5, 0x6852, 0x686c, 0x7822,
5136 0x6870, 0x7826, 0x681c, 0x7832, 0x6820, 0x7836, 0x6818, 0x2060,
5137 0x6034, 0xd09c, 0x0150, 0x6830, 0x2005, 0x00d6, 0xac68, 0x6808,
5138 0x783a, 0x680c, 0x783e, 0x00de, 0x04a0, 0xa006, 0x783a, 0x783e,
5139 0x0480, 0x8108, 0x2104, 0xa005, 0x1590, 0x8108, 0x2104, 0xa005,
5140 0x1570, 0x6850, 0xc0f5, 0x6852, 0x6830, 0x2005, 0x6918, 0xa160,
5141 0xa180, 0x000d, 0x2004, 0xd09c, 0x1170, 0x6008, 0x7822, 0x686e,
5142 0x600c, 0x7826, 0x6872, 0x6000, 0x7832, 0x6004, 0x7836, 0xa006,
5143 0x783a, 0x783e, 0x0070, 0x6010, 0x7822, 0x686e, 0x6014, 0x7826,
5144 0x6872, 0x6000, 0x7832, 0x6004, 0x7836, 0x6008, 0x783a, 0x600c,
5145 0x783e, 0x6810, 0x781a, 0x6814, 0x781e, 0x7803, 0x0011, 0x00ce,
5146 0x00de, 0x0005, 0x2011, 0x0201, 0x2009, 0x003c, 0x2204, 0xa005,
5147 0x1118, 0x8109, 0x1dd8, 0x0005, 0x0005, 0x0ca1, 0x01e0, 0x7908,
5148 0xd1ec, 0x1160, 0x080c, 0x1dd7, 0x0148, 0x7803, 0x0009, 0x7904,
5149 0xd1fc, 0x0de8, 0x7803, 0x0006, 0x0c29, 0x0168, 0x780c, 0xd0a4,
5150 0x1150, 0x7007, 0x0000, 0x080c, 0x1dd7, 0x0140, 0x7803, 0x0019,
5151 0x7003, 0x0003, 0x0018, 0x00b1, 0xa085, 0x0001, 0x0005, 0x0126,
5152 0x2091, 0x2200, 0x7000, 0xa086, 0x0003, 0x1150, 0x700c, 0x7110,
5153 0xa106, 0x0130, 0x20e1, 0x9028, 0x700f, 0xb003, 0x7013, 0xb003,
5154 0x012e, 0x0005, 0x00c6, 0x080c, 0x574f, 0x1550, 0x2001, 0x0160,
5155 0x2003, 0x0000, 0x2001, 0x0138, 0x2003, 0x0000, 0x2011, 0x00c8,
5156 0xe000, 0xe000, 0x8211, 0x1de0, 0x080c, 0x1d7e, 0x700c, 0x7110,
5157 0xa106, 0x0190, 0x2104, 0xa005, 0x0130, 0x2060, 0x6010, 0x2060,
5158 0x6008, 0x8001, 0x600a, 0xa188, 0x0003, 0xa182, 0xb01e, 0x0210,
5159 0x2009, 0xb003, 0x7112, 0x0c50, 0x080c, 0x57d1, 0x00ce, 0x0005,
5160 0x04a9, 0x20e1, 0x9028, 0x700c, 0x7110, 0xa106, 0x01d0, 0x2104,
5161 0xa005, 0x0130, 0x2060, 0x6010, 0x2060, 0x6008, 0x8001, 0x600a,
5162 0xa188, 0x0003, 0xa182, 0xb01e, 0x0210, 0x2009, 0xb003, 0x7112,
5163 0x700c, 0xa106, 0x1d40, 0x080c, 0x2744, 0x2001, 0x0138, 0x2102,
5164 0x0c10, 0x2001, 0x015d, 0x200c, 0x810a, 0x2102, 0x2001, 0x0160,
5165 0x2502, 0x2001, 0x0138, 0x2202, 0x00ce, 0x0005, 0x20e1, 0x9028,
5166 0x2001, 0x015d, 0x200c, 0x810a, 0x2102, 0x0005, 0x2001, 0x0138,
5167 0x2014, 0x2003, 0x0000, 0x2001, 0x0160, 0x202c, 0x2003, 0x0000,
5168 0x2021, 0xb015, 0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001,
5169 0x0109, 0x201c, 0xa39c, 0x0048, 0x1138, 0x2001, 0x0111, 0x201c,
5170 0x83ff, 0x1110, 0x8421, 0x1d70, 0x0005, 0x00e6, 0x2071, 0x0200,
5171 0x7808, 0xa084, 0xf000, 0xa10d, 0x08c9, 0x2019, 0x5000, 0x8319,
5172 0x0168, 0x2001, 0xb01e, 0x2004, 0xa086, 0x0000, 0x0138, 0x2001,
5173 0x0021, 0xd0fc, 0x0da0, 0x080c, 0x1ff4, 0x0c78, 0x20e1, 0x7000,
5174 0x7324, 0x7420, 0x7028, 0x7028, 0x7426, 0x7037, 0x0001, 0x810f,
5175 0x712e, 0x702f, 0x0100, 0x7037, 0x0008, 0x7326, 0x7422, 0x2001,
5176 0x0160, 0x2502, 0x2001, 0x0138, 0x2202, 0x00ee, 0x0005, 0x7908,
5177 0xa18c, 0x0fff, 0xa182, 0x0009, 0x0218, 0xa085, 0x0001, 0x0088,
5178 0x2001, 0x020a, 0x81ff, 0x0130, 0x20e1, 0x6000, 0x200c, 0x200c,
5179 0x200c, 0x200c, 0x20e1, 0x7000, 0x200c, 0x200c, 0x7003, 0x0000,
5180 0xa006, 0x0005, 0x00f6, 0x00e6, 0x0016, 0x0026, 0x2071, 0xaffd,
5181 0x2079, 0x0030, 0x2011, 0x0050, 0x7000, 0xa086, 0x0000, 0x01a8,
5182 0x8211, 0x0188, 0x2001, 0x0005, 0x2004, 0xd08c, 0x0dc8, 0x7904,
5183 0xa18c, 0x0780, 0x0016, 0x080c, 0x1a6c, 0x001e, 0x81ff, 0x1118,
5184 0x2011, 0x0050, 0x0c48, 0xa085, 0x0001, 0x002e, 0x001e, 0x00ee,
5185 0x00fe, 0x0005, 0x7803, 0x0004, 0x2009, 0x0064, 0x7804, 0xd0ac,
5186 0x0904, 0x1e66, 0x8109, 0x1dd0, 0x2009, 0x0100, 0x210c, 0xa18a,
5187 0x0003, 0x0a0c, 0x14f6, 0x080c, 0x20f2, 0x00e6, 0x00f6, 0x2071,
5188 0xafec, 0x2079, 0x0010, 0x7004, 0xa086, 0x0000, 0x0538, 0x7800,
5189 0x0006, 0x7820, 0x0006, 0x7830, 0x0006, 0x7834, 0x0006, 0x7838,
5190 0x0006, 0x783c, 0x0006, 0x7803, 0x0004, 0xe000, 0xe000, 0x2079,
5191 0x0030, 0x7804, 0xd0ac, 0x190c, 0x14f6, 0x2079, 0x0010, 0x000e,
5192 0x783e, 0x000e, 0x783a, 0x000e, 0x7836, 0x000e, 0x7832, 0x000e,
5193 0x7822, 0x000e, 0x7802, 0x00fe, 0x00ee, 0x0030, 0x00fe, 0x00ee,
5194 0x7804, 0xd0ac, 0x190c, 0x14f6, 0x080c, 0x6d0d, 0x0005, 0x00e6,
5195 0x2071, 0xb01e, 0x7003, 0x0000, 0x00ee, 0x0005, 0x00d6, 0xa280,
5196 0x0004, 0x206c, 0x694c, 0xd1dc, 0x1904, 0x1ee4, 0x6934, 0xa184,
5197 0x0007, 0x0002, 0x1e82, 0x1ecf, 0x1e82, 0x1e82, 0x1e82, 0x1eb6,
5198 0x1e95, 0x1e84, 0x080c, 0x14f6, 0x684c, 0xd0b4, 0x0904, 0x1fcc,
5199 0x6860, 0x682e, 0x6816, 0x685c, 0x682a, 0x6812, 0x687c, 0x680a,
5200 0x6880, 0x680e, 0x6958, 0x0804, 0x1ed7, 0x6834, 0xa084, 0x00ff,
5201 0xa086, 0x001e, 0x1d38, 0x684c, 0xd0b4, 0x0904, 0x1fcc, 0x6860,
5202 0x682e, 0x6816, 0x685c, 0x682a, 0x6812, 0x687c, 0x680a, 0x6880,
5203 0x680e, 0x6804, 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f,
5204 0xa080, 0x2186, 0x2005, 0x6832, 0x6958, 0x0450, 0xa18c, 0x00ff,
5205 0xa186, 0x0015, 0x1548, 0x684c, 0xd0b4, 0x0904, 0x1fcc, 0x6804,
5206 0x681a, 0xa080, 0x000d, 0x2004, 0xa084, 0x000f, 0xa080, 0x2186,
5207 0x2005, 0x6832, 0x6958, 0xa006, 0x682e, 0x682a, 0x0088, 0x684c,
5208 0xd0b4, 0x0904, 0x1a47, 0x6958, 0xa006, 0x682e, 0x682a, 0x2d00,
5209 0x681a, 0x6834, 0xa084, 0x000f, 0xa080, 0x2186, 0x2005, 0x6832,
5210 0x6926, 0x684c, 0xc0dd, 0x684e, 0x00de, 0x0005, 0x00f6, 0x2079,
5211 0x0020, 0x7804, 0xd0fc, 0x190c, 0x1ff4, 0x00e6, 0x00d6, 0x2071,
5212 0xb01e, 0x7000, 0xa005, 0x1904, 0x1f4c, 0x00c6, 0x7206, 0xa280,
5213 0x0004, 0x205c, 0x7004, 0x2068, 0x7803, 0x0004, 0x6818, 0x00d6,
5214 0x2068, 0x686c, 0x7812, 0x6890, 0x00f6, 0x20e1, 0x9040, 0x2079,
5215 0x0200, 0x781a, 0x2079, 0x0100, 0x8004, 0x78d6, 0x00fe, 0x00de,
5216 0x2b68, 0x6824, 0x2050, 0x6818, 0x2060, 0x6830, 0x2040, 0x6034,
5217 0xa0cc, 0x000f, 0x6908, 0x791a, 0x7116, 0x680c, 0x781e, 0x701a,
5218 0xa006, 0x700e, 0x7012, 0x7004, 0x692c, 0x6814, 0xa106, 0x1120,
5219 0x6928, 0x6810, 0xa106, 0x0158, 0x0036, 0x0046, 0x6b14, 0x6c10,
5220 0x080c, 0x21a6, 0x004e, 0x003e, 0x0110, 0x00ce, 0x00a8, 0x8aff,
5221 0x1120, 0x00ce, 0xa085, 0x0001, 0x0078, 0x0126, 0x2091, 0x8000,
5222 0x2079, 0x0020, 0x2009, 0x0001, 0x0059, 0x0118, 0x2009, 0x0001,
5223 0x0039, 0x012e, 0x00ce, 0xa006, 0x00de, 0x00ee, 0x00fe, 0x0005,
5224 0x0076, 0x0066, 0x0056, 0x0046, 0x0036, 0x0026, 0x8aff, 0x0904,
5225 0x1fc5, 0x700c, 0x7214, 0xa23a, 0x7010, 0x7218, 0xa203, 0x0a04,
5226 0x1fc4, 0xa705, 0x0904, 0x1fc4, 0xa03e, 0x2730, 0x6850, 0xd0fc,
5227 0x11a8, 0x00d6, 0x2805, 0xac68, 0x2900, 0x0002, 0x1fa7, 0x1f8c,
5228 0x1f8c, 0x1fa7, 0x1fa7, 0x1fa0, 0x1fa7, 0x1f8c, 0x1fa7, 0x1f91,
5229 0x1f91, 0x1fa7, 0x1fa7, 0x1fa7, 0x1f98, 0x1f91, 0xc0fc, 0x6852,
5230 0x6b6c, 0x6a70, 0x6d1c, 0x6c20, 0xd99c, 0x0528, 0x00d6, 0x2805,
5231 0xac68, 0x6f08, 0x6e0c, 0x00f0, 0x6b08, 0x6a0c, 0x6d00, 0x6c04,
5232 0x00c8, 0x6b10, 0x6a14, 0x6d00, 0x6c04, 0x6f08, 0x6e0c, 0x0090,
5233 0x00de, 0x00d6, 0x6834, 0xa084, 0x00ff, 0xa086, 0x001e, 0x1138,
5234 0x00de, 0x080c, 0x2148, 0x1904, 0x1f56, 0xa00e, 0x00f0, 0x00de,
5235 0x080c, 0x14f6, 0x00de, 0x7b22, 0x7a26, 0x7d32, 0x7c36, 0x7f3a,
5236 0x7e3e, 0x7902, 0x7000, 0x8000, 0x7002, 0x6828, 0xa300, 0x682a,
5237 0x682c, 0xa201, 0x682e, 0x700c, 0xa300, 0x700e, 0x7010, 0xa201,
5238 0x7012, 0x080c, 0x2148, 0x0008, 0xa006, 0x002e, 0x003e, 0x004e,
5239 0x005e, 0x006e, 0x007e, 0x0005, 0x080c, 0x14f6, 0x0026, 0x2001,
5240 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803, 0x0004, 0x7003,
5241 0x0000, 0x7004, 0x2060, 0x00d6, 0x6010, 0x2068, 0x080c, 0x9596,
5242 0x0118, 0x6850, 0xc0bd, 0x6852, 0x00de, 0x080c, 0x929c, 0x20e1,
5243 0x9040, 0x080c, 0x7cb8, 0x2011, 0x0000, 0x080c, 0x7ae9, 0x080c,
5244 0x6d0d, 0x002e, 0x0804, 0x20ad, 0x0126, 0x2091, 0x2400, 0x0006,
5245 0x0016, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x2079, 0x0020, 0x2071,
5246 0xb01e, 0x2b68, 0x6818, 0x2060, 0x7904, 0x7803, 0x0002, 0xa184,
5247 0x0700, 0x1920, 0x7000, 0x0002, 0x20ad, 0x2010, 0x2080, 0x20ab,
5248 0x8001, 0x7002, 0xd19c, 0x1170, 0x8aff, 0x05d0, 0x2009, 0x0001,
5249 0x080c, 0x1f50, 0x0904, 0x20ad, 0x2009, 0x0001, 0x080c, 0x1f50,
5250 0x0804, 0x20ad, 0x7803, 0x0004, 0xd194, 0x0148, 0x6850, 0xc0fc,
5251 0x6852, 0x8aff, 0x11d8, 0x684c, 0xc0f5, 0x684e, 0x00b8, 0x0026,
5252 0x0036, 0x6b28, 0x6a2c, 0x7820, 0x686e, 0xa31a, 0x7824, 0x6872,
5253 0xa213, 0x7830, 0x681e, 0x7834, 0x6822, 0x6b2a, 0x6a2e, 0x003e,
5254 0x002e, 0x080c, 0x215e, 0x6850, 0xc0fd, 0x6852, 0x2a00, 0x6826,
5255 0x2c00, 0x681a, 0x2800, 0x6832, 0x7003, 0x0000, 0x0804, 0x20ad,
5256 0x00f6, 0x0026, 0x781c, 0x0006, 0x7818, 0x0006, 0x2079, 0x0100,
5257 0x7a14, 0xa284, 0x0184, 0xa085, 0x0012, 0x7816, 0x0036, 0x2019,
5258 0x1000, 0x8319, 0x090c, 0x14f6, 0x7820, 0xd0bc, 0x1dd0, 0x003e,
5259 0x79c8, 0x000e, 0xa102, 0x001e, 0x0006, 0x0016, 0x79c4, 0x000e,
5260 0xa103, 0x78c6, 0x000e, 0x78ca, 0xa284, 0x0184, 0xa085, 0x0012,
5261 0x7816, 0x002e, 0x00fe, 0x7803, 0x0008, 0x7003, 0x0000, 0x0468,
5262 0x8001, 0x7002, 0xd194, 0x0168, 0x7804, 0xd0fc, 0x1904, 0x2004,
5263 0xd19c, 0x11f8, 0x8aff, 0x0508, 0x2009, 0x0001, 0x080c, 0x1f50,
5264 0x00e0, 0x0026, 0x0036, 0x6b28, 0x6a2c, 0x080c, 0x215e, 0x00d6,
5265 0x2805, 0xac68, 0x6034, 0xd09c, 0x1128, 0x6808, 0xa31a, 0x680c,
5266 0xa213, 0x0020, 0x6810, 0xa31a, 0x6814, 0xa213, 0x00de, 0x0804,
5267 0x2033, 0x0804, 0x202f, 0x080c, 0x14f6, 0x00ce, 0x00de, 0x00ee,
5268 0x00fe, 0x001e, 0x000e, 0x012e, 0x0005, 0x00f6, 0x00e6, 0x2071,
5269 0xb01e, 0x7000, 0xa086, 0x0000, 0x0590, 0x2079, 0x0020, 0x0016,
5270 0x2009, 0x0207, 0x210c, 0xd194, 0x0158, 0x2009, 0x020c, 0x210c,
5271 0xa184, 0x0003, 0x0128, 0x20e1, 0x9040, 0x2001, 0x020c, 0x2102,
5272 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0xa106, 0x1110,
5273 0x20e1, 0x9040, 0x7804, 0xd0fc, 0x0d18, 0x080c, 0x1ff4, 0x7000,
5274 0xa086, 0x0000, 0x19e8, 0x001e, 0x7803, 0x0004, 0x7804, 0xd0ac,
5275 0x1de8, 0x20e1, 0x9040, 0x7803, 0x0002, 0x7003, 0x0000, 0x00ee,
5276 0x00fe, 0x0005, 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2071,
5277 0xb01e, 0x2079, 0x0020, 0x7000, 0xa086, 0x0000, 0x0540, 0x7004,
5278 0x2060, 0x6010, 0x2068, 0x080c, 0x9596, 0x0158, 0x6850, 0xc0b5,
5279 0x6852, 0x680c, 0x7a1c, 0xa206, 0x1120, 0x6808, 0x7a18, 0xa206,
5280 0x01e0, 0x2001, 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803,
5281 0x0004, 0x7003, 0x0000, 0x7004, 0x2060, 0x080c, 0x929c, 0x20e1,
5282 0x9040, 0x080c, 0x7cb8, 0x2011, 0x0000, 0x080c, 0x7ae9, 0x00fe,
5283 0x00ee, 0x00de, 0x00ce, 0x002e, 0x0005, 0x6810, 0x6a14, 0xa205,
5284 0x1d00, 0x684c, 0xc0dc, 0x684e, 0x2c10, 0x080c, 0x1e6e, 0x2001,
5285 0x0105, 0x2003, 0x0010, 0x20e1, 0x9040, 0x7803, 0x0004, 0x7003,
5286 0x0000, 0x2069, 0xafc7, 0x6833, 0x0000, 0x683f, 0x0000, 0x08f8,
5287 0x8840, 0x2805, 0xa005, 0x1170, 0x6004, 0xa005, 0x0168, 0x681a,
5288 0x2060, 0x6034, 0xa084, 0x000f, 0xa080, 0x2186, 0x2045, 0x88ff,
5289 0x090c, 0x14f6, 0x8a51, 0x0005, 0x2050, 0x0005, 0x8a50, 0x8841,
5290 0x2805, 0xa005, 0x1190, 0x2c00, 0xad06, 0x0120, 0x6000, 0xa005,
5291 0x1108, 0x2d00, 0x2060, 0x681a, 0x6034, 0xa084, 0x000f, 0xa080,
5292 0x2196, 0x2045, 0x88ff, 0x090c, 0x14f6, 0x0005, 0x0000, 0x0011,
5293 0x0015, 0x0019, 0x001d, 0x0021, 0x0025, 0x0029, 0x0000, 0x000f,
5294 0x0015, 0x001b, 0x0021, 0x0027, 0x0000, 0x0000, 0x0000, 0x217b,
5295 0x2177, 0x0000, 0x0000, 0x2185, 0x0000, 0x217b, 0x0000, 0x2182,
5296 0x217f, 0x0000, 0x0000, 0x0000, 0x2185, 0x2182, 0x0000, 0x217d,
5297 0x217d, 0x0000, 0x0000, 0x2185, 0x0000, 0x217d, 0x0000, 0x2183,
5298 0x2183, 0x0000, 0x0000, 0x0000, 0x2185, 0x2183, 0x00a6, 0x0096,
5299 0x0086, 0x6b2e, 0x6c2a, 0x6858, 0xa055, 0x0904, 0x2237, 0x2d60,
5300 0x6034, 0xa0cc, 0x000f, 0xa9c0, 0x2186, 0xa986, 0x0007, 0x0130,
5301 0xa986, 0x000e, 0x0118, 0xa986, 0x000f, 0x1120, 0x605c, 0xa422,
5302 0x6060, 0xa31a, 0x2805, 0xa045, 0x1140, 0x0310, 0x0804, 0x2237,
5303 0x6004, 0xa065, 0x0904, 0x2237, 0x0c18, 0x2805, 0xa005, 0x01a8,
5304 0xac68, 0xd99c, 0x1128, 0x6808, 0xa422, 0x680c, 0xa31b, 0x0020,
5305 0x6810, 0xa422, 0x6814, 0xa31b, 0x0620, 0x2300, 0xa405, 0x0150,
5306 0x8a51, 0x0904, 0x2237, 0x8840, 0x0c40, 0x6004, 0xa065, 0x0904,
5307 0x2237, 0x0830, 0x8a51, 0x0904, 0x2237, 0x8840, 0x2805, 0xa005,
5308 0x1158, 0x6004, 0xa065, 0x0904, 0x2237, 0x6034, 0xa0cc, 0x000f,
5309 0xa9c0, 0x2186, 0x2805, 0x2040, 0x2b68, 0x6850, 0xc0fc, 0x6852,
5310 0x0458, 0x8422, 0x8420, 0x831a, 0xa399, 0x0000, 0x00d6, 0x2b68,
5311 0x6c6e, 0x6b72, 0x00de, 0xd99c, 0x1168, 0x6908, 0x2400, 0xa122,
5312 0x690c, 0x2300, 0xa11b, 0x0a0c, 0x14f6, 0x6800, 0xa420, 0x6804,
5313 0xa319, 0x0060, 0x6910, 0x2400, 0xa122, 0x6914, 0x2300, 0xa11b,
5314 0x0a0c, 0x14f6, 0x6800, 0xa420, 0x6804, 0xa319, 0x2b68, 0x6c1e,
5315 0x6b22, 0x6850, 0xc0fd, 0x6852, 0x2c00, 0x681a, 0x2800, 0x6832,
5316 0x2a00, 0x6826, 0x000e, 0x000e, 0x000e, 0xa006, 0x0028, 0x008e,
5317 0x009e, 0x00ae, 0xa085, 0x0001, 0x0005, 0x2001, 0x0005, 0x2004,
5318 0xa084, 0x0007, 0x0002, 0x224b, 0x224c, 0x224f, 0x2252, 0x2257,
5319 0x225a, 0x225f, 0x2264, 0x0005, 0x080c, 0x1ff4, 0x0005, 0x080c,
5320 0x1a6c, 0x0005, 0x080c, 0x1a6c, 0x080c, 0x1ff4, 0x0005, 0x080c,
5321 0x16f8, 0x0005, 0x080c, 0x1ff4, 0x080c, 0x16f8, 0x0005, 0x080c,
5322 0x1a6c, 0x080c, 0x16f8, 0x0005, 0x080c, 0x1a6c, 0x080c, 0x1ff4,
5323 0x080c, 0x16f8, 0x0005, 0x0126, 0x2091, 0x2600, 0x2079, 0x0200,
5324 0x2071, 0xb280, 0x2069, 0xad00, 0x2009, 0x0004, 0x7912, 0x7817,
5325 0x0004, 0x080c, 0x2651, 0x781b, 0x0002, 0x20e1, 0x9080, 0x20e1,
5326 0x4000, 0x20a9, 0x0080, 0x782f, 0x0000, 0x1f04, 0x2283, 0x20e1,
5327 0x9080, 0x783b, 0x001f, 0x20e1, 0x8700, 0x012e, 0x0005, 0x0126,
5328 0x2091, 0x2600, 0x781c, 0xd0a4, 0x190c, 0x2335, 0xa084, 0x0007,
5329 0x0002, 0x22b3, 0x22a1, 0x22a4, 0x22a7, 0x22ac, 0x22ae, 0x22b0,
5330 0x22b2, 0x080c, 0x5fb7, 0x0078, 0x080c, 0x5ff0, 0x0060, 0x080c,
5331 0x5fb7, 0x080c, 0x5ff0, 0x0038, 0x0041, 0x0028, 0x0031, 0x0018,
5332 0x0021, 0x0008, 0x0011, 0x012e, 0x0005, 0x0006, 0x0016, 0x0026,
5333 0x7930, 0xa184, 0x0003, 0x0118, 0x20e1, 0x9040, 0x04a0, 0xa184,
5334 0x0030, 0x01e0, 0x6a00, 0xa286, 0x0003, 0x1108, 0x00a0, 0x080c,
5335 0x574f, 0x1178, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x2001, 0xad00,
5336 0x2003, 0x0001, 0xa085, 0x0001, 0x080c, 0x5793, 0x080c, 0x569a,
5337 0x0010, 0x080c, 0x485e, 0x20e1, 0x9010, 0x00a8, 0xa184, 0x00c0,
5338 0x0168, 0x00e6, 0x0036, 0x0046, 0x0056, 0x2071, 0xaffd, 0x080c,
5339 0x1d22, 0x005e, 0x004e, 0x003e, 0x00ee, 0x0028, 0xa184, 0x0300,
5340 0x0110, 0x20e1, 0x9020, 0x7932, 0x002e, 0x001e, 0x000e, 0x0005,
5341 0x0016, 0x00e6, 0x00f6, 0x2071, 0xad00, 0x7128, 0x2001, 0xaf90,
5342 0x2102, 0x2001, 0xaf98, 0x2102, 0xa182, 0x0211, 0x1218, 0x2009,
5343 0x0008, 0x0400, 0xa182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0,
5344 0xa182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0xa182, 0x0349,
5345 0x1218, 0x2009, 0x0005, 0x0070, 0xa182, 0x0421, 0x1218, 0x2009,
5346 0x0004, 0x0040, 0xa182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010,
5347 0x2009, 0x0002, 0x2079, 0x0200, 0x7912, 0x7817, 0x0004, 0x080c,
5348 0x2651, 0x00fe, 0x00ee, 0x001e, 0x0005, 0x7938, 0x080c, 0x14f6,
5349 0x0126, 0x2091, 0x2800, 0x2061, 0x0100, 0x2071, 0xad00, 0x6024,
5350 0x6026, 0x6053, 0x0030, 0x080c, 0x2690, 0x6050, 0xa084, 0xfe7f,
5351 0x6052, 0x2009, 0x00ef, 0x6132, 0x6136, 0x080c, 0x26a0, 0x60e7,
5352 0x0000, 0x61ea, 0x60e3, 0x0008, 0x604b, 0xf7f7, 0x6043, 0x0000,
5353 0x602f, 0x0080, 0x602f, 0x0000, 0x6007, 0x0e9f, 0x601b, 0x001e,
5354 0x600f, 0x00ff, 0x2001, 0xaf8c, 0x2003, 0x00ff, 0x602b, 0x002f,
5355 0x012e, 0x0005, 0x2001, 0xad31, 0x2003, 0x0000, 0x2001, 0xad30,
5356 0x2003, 0x0001, 0x0005, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016,
5357 0x0026, 0x6124, 0xa184, 0x1e2c, 0x1118, 0xa184, 0x0007, 0x002a,
5358 0xa195, 0x0004, 0xa284, 0x0007, 0x0002, 0x23a7, 0x238d, 0x2390,
5359 0x2393, 0x2398, 0x239a, 0x239e, 0x23a2, 0x080c, 0x6699, 0x00b8,
5360 0x080c, 0x6774, 0x00a0, 0x080c, 0x6774, 0x080c, 0x6699, 0x0078,
5361 0x0099, 0x0068, 0x080c, 0x6699, 0x0079, 0x0048, 0x080c, 0x6774,
5362 0x0059, 0x0028, 0x080c, 0x6774, 0x080c, 0x6699, 0x0029, 0x002e,
5363 0x001e, 0x000e, 0x012e, 0x0005, 0x6124, 0xd19c, 0x1904, 0x25bf,
5364 0x080c, 0x574f, 0x0578, 0x7000, 0xa086, 0x0003, 0x0198, 0x6024,
5365 0xa084, 0x1800, 0x0178, 0x080c, 0x5775, 0x0118, 0x080c, 0x5761,
5366 0x1148, 0x6027, 0x0020, 0x6043, 0x0000, 0x2001, 0xaf9d, 0x2003,
5367 0xaaaa, 0x0458, 0x080c, 0x5775, 0x15d0, 0x6024, 0xa084, 0x1800,
5368 0x1108, 0x04a8, 0x2001, 0xaf9d, 0x2003, 0xaaaa, 0x2001, 0xaf9e,
5369 0x2003, 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0x080c, 0x569a,
5370 0x0804, 0x25bf, 0xd1ac, 0x1518, 0x6024, 0xd0dc, 0x1170, 0xd0e4,
5371 0x1188, 0xd0d4, 0x11a0, 0xd0cc, 0x0130, 0x7088, 0xa086, 0x0028,
5372 0x1110, 0x080c, 0x58da, 0x0804, 0x25bf, 0x2001, 0xaf9e, 0x2003,
5373 0x0000, 0x0048, 0x2001, 0xaf9e, 0x2003, 0x0002, 0x0020, 0x080c,
5374 0x584d, 0x0804, 0x25bf, 0x080c, 0x597a, 0x0804, 0x25bf, 0xd1ac,
5375 0x0904, 0x2507, 0x080c, 0x574f, 0x11d8, 0x6027, 0x0020, 0x0006,
5376 0x0026, 0x0036, 0x080c, 0x576b, 0x1170, 0x2001, 0xaf9e, 0x2003,
5377 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0x080c, 0x569a, 0x003e,
5378 0x002e, 0x000e, 0x0005, 0x003e, 0x002e, 0x000e, 0x080c, 0x5726,
5379 0x0016, 0x0046, 0x00c6, 0x644c, 0xa486, 0xf0f0, 0x1138, 0x2061,
5380 0x0100, 0x644a, 0x6043, 0x0090, 0x6043, 0x0010, 0x74ca, 0xa48c,
5381 0xff00, 0x7034, 0xd084, 0x0178, 0xa186, 0xf800, 0x1160, 0x7038,
5382 0xd084, 0x1148, 0xc085, 0x703a, 0x0036, 0x2418, 0x2011, 0x8016,
5383 0x080c, 0x3c5c, 0x003e, 0xa196, 0xff00, 0x05b8, 0x7050, 0xa084,
5384 0x00ff, 0x810f, 0xa116, 0x0588, 0x7130, 0xd184, 0x1570, 0x2011,
5385 0xad52, 0x2214, 0xd2ec, 0x0138, 0xc18d, 0x7132, 0x2011, 0xad52,
5386 0x2214, 0xd2ac, 0x1510, 0x6240, 0xa294, 0x0010, 0x0130, 0x6248,
5387 0xa294, 0xff00, 0xa296, 0xff00, 0x01c0, 0x7030, 0xd08c, 0x0904,
5388 0x24d2, 0x7034, 0xd08c, 0x1140, 0x2001, 0xad0c, 0x200c, 0xd1ac,
5389 0x1904, 0x24d2, 0xc1ad, 0x2102, 0x0036, 0x73c8, 0x2011, 0x8013,
5390 0x080c, 0x3c5c, 0x003e, 0x0804, 0x24d2, 0x7034, 0xd08c, 0x1140,
5391 0x2001, 0xad0c, 0x200c, 0xd1ac, 0x1904, 0x24d2, 0xc1ad, 0x2102,
5392 0x0036, 0x73c8, 0x2011, 0x8013, 0x080c, 0x3c5c, 0x003e, 0x7130,
5393 0xc185, 0x7132, 0x2011, 0xad52, 0x220c, 0xd1a4, 0x01d0, 0x0016,
5394 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x663f, 0x2019, 0x000e,
5395 0x080c, 0xa8eb, 0xa484, 0x00ff, 0xa080, 0x2be6, 0x200d, 0xa18c,
5396 0xff00, 0x810f, 0x8127, 0xa006, 0x2009, 0x000e, 0x080c, 0xa96c,
5397 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0000, 0x2019, 0x0004,
5398 0x080c, 0x2aac, 0x001e, 0x0070, 0x0156, 0x20a9, 0x007f, 0x2009,
5399 0x0000, 0x080c, 0x4cdc, 0x1110, 0x080c, 0x493a, 0x8108, 0x1f04,
5400 0x24c9, 0x015e, 0x00ce, 0x004e, 0x2011, 0x0003, 0x080c, 0x7adf,
5401 0x2011, 0x0002, 0x080c, 0x7ae9, 0x080c, 0x79e1, 0x080c, 0x6581,
5402 0x0036, 0x2019, 0x0000, 0x080c, 0x7a64, 0x003e, 0x60e3, 0x0000,
5403 0x001e, 0x2001, 0xad00, 0x2014, 0xa296, 0x0004, 0x1128, 0xd19c,
5404 0x1118, 0x6228, 0xc29d, 0x622a, 0x2003, 0x0001, 0x2001, 0xad22,
5405 0x2003, 0x0000, 0x6027, 0x0020, 0x080c, 0x5775, 0x1140, 0x0016,
5406 0x2009, 0x07d0, 0x2011, 0x567b, 0x080c, 0x6593, 0x001e, 0xd194,
5407 0x0904, 0x25bf, 0x0016, 0x6220, 0xd2b4, 0x0904, 0x2570, 0x080c,
5408 0x6581, 0x080c, 0x7834, 0x6027, 0x0004, 0x00f6, 0x2019, 0xafd0,
5409 0x2304, 0xa07d, 0x0570, 0x7804, 0xa086, 0x0032, 0x1550, 0x00d6,
5410 0x00c6, 0x00e6, 0x2069, 0x0140, 0x618c, 0x6288, 0x7818, 0x608e,
5411 0x7808, 0x608a, 0x6043, 0x0002, 0x2001, 0x0003, 0x8001, 0x1df0,
5412 0x6043, 0x0000, 0x6803, 0x1000, 0x6803, 0x0000, 0x618e, 0x628a,
5413 0x080c, 0x6b73, 0x080c, 0x6c50, 0x7810, 0x2070, 0x7037, 0x0103,
5414 0x2f60, 0x080c, 0x8078, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e,
5415 0x0005, 0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804, 0xa084, 0x4000,
5416 0x0120, 0x6803, 0x1000, 0x6803, 0x0000, 0x00de, 0x00c6, 0x2061,
5417 0xafc7, 0x6028, 0xa09a, 0x00c8, 0x1238, 0x8000, 0x602a, 0x00ce,
5418 0x080c, 0x7827, 0x0804, 0x25be, 0x2019, 0xafd0, 0x2304, 0xa065,
5419 0x0120, 0x2009, 0x0027, 0x080c, 0x80a7, 0x00ce, 0x0804, 0x25be,
5420 0xd2bc, 0x0904, 0x25be, 0x080c, 0x658e, 0x6014, 0xa084, 0x0184,
5421 0xa085, 0x0010, 0x6016, 0x6027, 0x0004, 0x00d6, 0x2069, 0x0140,
5422 0x6804, 0xa084, 0x4000, 0x0120, 0x6803, 0x1000, 0x6803, 0x0000,
5423 0x00de, 0x00c6, 0x2061, 0xafc7, 0x6044, 0xa09a, 0x00c8, 0x12f0,
5424 0x8000, 0x6046, 0x603c, 0x00ce, 0xa005, 0x0540, 0x2009, 0x07d0,
5425 0x080c, 0x6586, 0xa080, 0x0007, 0x2004, 0xa086, 0x0006, 0x1138,
5426 0x6114, 0xa18c, 0x0184, 0xa18d, 0x0012, 0x6116, 0x00b8, 0x6114,
5427 0xa18c, 0x0184, 0xa18d, 0x0016, 0x6116, 0x0080, 0x0036, 0x2019,
5428 0x0001, 0x080c, 0x7a64, 0x003e, 0x2019, 0xafd6, 0x2304, 0xa065,
5429 0x0120, 0x2009, 0x004f, 0x080c, 0x80a7, 0x00ce, 0x001e, 0xd19c,
5430 0x0904, 0x261a, 0x7034, 0xd0ac, 0x1560, 0x0016, 0x0156, 0x6027,
5431 0x0008, 0x602f, 0x0020, 0x20a9, 0x0006, 0x1d04, 0x25cd, 0x2091,
5432 0x6000, 0x1f04, 0x25cd, 0x602f, 0x0000, 0x6150, 0xa185, 0x1400,
5433 0x6052, 0x20a9, 0x0366, 0x1d04, 0x25db, 0x2091, 0x6000, 0x6020,
5434 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e, 0x6027, 0x0008, 0x0490,
5435 0x080c, 0x2760, 0x1f04, 0x25db, 0x015e, 0x6152, 0x001e, 0x6027,
5436 0x0008, 0x0016, 0x6028, 0xc09c, 0x602a, 0x2011, 0x0003, 0x080c,
5437 0x7adf, 0x2011, 0x0002, 0x080c, 0x7ae9, 0x080c, 0x79e1, 0x080c,
5438 0x6581, 0x0036, 0x2019, 0x0000, 0x080c, 0x7a64, 0x003e, 0x60e3,
5439 0x0000, 0x080c, 0xac8d, 0x080c, 0xaca8, 0xa085, 0x0001, 0x080c,
5440 0x5793, 0x2001, 0xad00, 0x2003, 0x0004, 0x6027, 0x0008, 0x080c,
5441 0x12cc, 0x001e, 0xa18c, 0xffd0, 0x6126, 0x0005, 0x0006, 0x0016,
5442 0x0026, 0x00e6, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2071, 0xad00,
5443 0x71c0, 0x70c2, 0xa116, 0x01f0, 0x81ff, 0x0128, 0x2011, 0x8011,
5444 0x080c, 0x3c5c, 0x00b8, 0x2011, 0x8012, 0x080c, 0x3c5c, 0x2001,
5445 0xad71, 0x2004, 0xd0fc, 0x1170, 0x0036, 0x00c6, 0x080c, 0x26eb,
5446 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0000, 0x080c, 0x2aac,
5447 0x00ce, 0x003e, 0x012e, 0x00fe, 0x00ee, 0x002e, 0x001e, 0x000e,
5448 0x0005, 0x00c6, 0x00f6, 0x0006, 0x0026, 0x2061, 0x0100, 0xa190,
5449 0x2664, 0x2205, 0x60f2, 0x2011, 0x2671, 0x2205, 0x60ee, 0x002e,
5450 0x000e, 0x00fe, 0x00ce, 0x0005, 0x0840, 0x0840, 0x0840, 0x0580,
5451 0x0420, 0x0348, 0x02c0, 0x0258, 0x0210, 0x01a8, 0x01a8, 0x01a8,
5452 0x01a8, 0x0140, 0x00f8, 0x00d0, 0x00b0, 0x00a0, 0x2028, 0xa18c,
5453 0x00ff, 0x2130, 0xa094, 0xff00, 0x1110, 0x81ff, 0x0118, 0x080c,
5454 0x6278, 0x0038, 0xa080, 0x2be6, 0x200d, 0xa18c, 0xff00, 0x810f,
5455 0xa006, 0x0005, 0xa080, 0x2be6, 0x200d, 0xa18c, 0x00ff, 0x0005,
5456 0x00d6, 0x2069, 0x0140, 0x2001, 0xad14, 0x2003, 0x00ef, 0x20a9,
5457 0x0010, 0xa006, 0x6852, 0x6856, 0x1f04, 0x269b, 0x00de, 0x0005,
5458 0x0006, 0x00d6, 0x0026, 0x2069, 0x0140, 0x2001, 0xad14, 0x2102,
5459 0x8114, 0x8214, 0x8214, 0x8214, 0x20a9, 0x0010, 0x6853, 0x0000,
5460 0xa006, 0x82ff, 0x1128, 0xa184, 0x000f, 0xa080, 0xacae, 0x2005,
5461 0x6856, 0x8211, 0x1f04, 0x26b0, 0x002e, 0x00de, 0x000e, 0x0005,
5462 0x00c6, 0x2061, 0xad00, 0x6030, 0x0110, 0xc09d, 0x0008, 0xc09c,
5463 0x6032, 0x00ce, 0x0005, 0x0156, 0x00d6, 0x0026, 0x0016, 0x0006,
5464 0x2069, 0x0140, 0x6980, 0xa116, 0x0180, 0xa112, 0x1230, 0x8212,
5465 0x8210, 0x22a8, 0x2001, 0x0402, 0x0018, 0x22a8, 0x2001, 0x0404,
5466 0x680e, 0x1f04, 0x26e0, 0x680f, 0x0000, 0x000e, 0x001e, 0x002e,
5467 0x00de, 0x015e, 0x0005, 0x2001, 0xad52, 0x2004, 0xd0c4, 0x0150,
5468 0xd0a4, 0x0140, 0xa006, 0x0046, 0x2020, 0x2009, 0x002e, 0x080c,
5469 0xa96c, 0x004e, 0x0005, 0x00f6, 0x0016, 0x0026, 0x2079, 0x0140,
5470 0x78c4, 0xd0dc, 0x0548, 0xa084, 0x0700, 0xa08e, 0x0300, 0x1520,
5471 0x2011, 0x0000, 0x2009, 0x0002, 0x2300, 0xa080, 0x0020, 0x2018,
5472 0x2300, 0x080c, 0x6665, 0x2011, 0x0030, 0x2200, 0x8007, 0xa085,
5473 0x004c, 0x78c2, 0x2009, 0x0204, 0x210c, 0x2200, 0xa100, 0x2009,
5474 0x0138, 0x200a, 0x080c, 0x574f, 0x1118, 0x2009, 0xaf8e, 0x200a,
5475 0x002e, 0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126,
5476 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c,
5477 0x8000, 0x2014, 0xa184, 0x0003, 0x0110, 0x0804, 0x1a6a, 0x002e,
5478 0x001e, 0x000e, 0x012e, 0x0005, 0x0006, 0x2001, 0x0100, 0x2004,
5479 0xa082, 0x0005, 0x000e, 0x0268, 0x2001, 0x0170, 0x200c, 0xa18c,
5480 0x00ff, 0xa18e, 0x004c, 0x1128, 0x200c, 0xa18c, 0xff00, 0x810f,
5481 0x0010, 0x2009, 0x0000, 0x2001, 0x0204, 0x2004, 0xa108, 0x0005,
5482 0x0006, 0x0156, 0x00f6, 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854,
5483 0xd08c, 0x1110, 0x1f04, 0x2767, 0x00fe, 0x015e, 0x000e, 0x0005,
5484 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100, 0x6030, 0x0006, 0x6048,
5485 0x0006, 0x60e4, 0x0006, 0x60e8, 0x0006, 0x6050, 0x0006, 0x60f0,
5486 0x0006, 0x60ec, 0x0006, 0x600c, 0x0006, 0x6004, 0x0006, 0x6028,
5487 0x0006, 0x60e0, 0x0006, 0x602f, 0x0100, 0x602f, 0x0000, 0xe000,
5488 0xe000, 0xe000, 0xe000, 0x602f, 0x0040, 0x602f, 0x0000, 0x000e,
5489 0x60e2, 0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e,
5490 0x60ee, 0x000e, 0x60f2, 0x000e, 0x6052, 0x000e, 0x60ea, 0x000e,
5491 0x60e6, 0x000e, 0x604a, 0x000e, 0x6032, 0x6036, 0x2008, 0x080c,
5492 0x26a0, 0x000e, 0x00ce, 0x001e, 0x0005, 0x2845, 0x2849, 0x284d,
5493 0x2853, 0x2859, 0x285f, 0x2865, 0x286d, 0x2875, 0x287b, 0x2881,
5494 0x2889, 0x2891, 0x2899, 0x28a1, 0x28ab, 0x28b5, 0x28b5, 0x28b5,
5495 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5496 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5497 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5498 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5499 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5500 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b7, 0x28b7, 0x28bc,
5501 0x28bc, 0x28c3, 0x28c3, 0x28ca, 0x28ca, 0x28d3, 0x28d3, 0x28da,
5502 0x28da, 0x28e3, 0x28e3, 0x28ec, 0x28ec, 0x28b5, 0x28b5, 0x28b5,
5503 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5504 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5505 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5506 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5507 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5508 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5509 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5,
5510 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x28b5, 0x0106, 0x0006, 0x0804,
5511 0x28f7, 0x0106, 0x0006, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c,
5512 0x2373, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c, 0x2373, 0x0804,
5513 0x28f7, 0x0106, 0x0006, 0x080c, 0x223d, 0x0804, 0x28f7, 0x0106,
5514 0x0006, 0x080c, 0x223d, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c,
5515 0x2373, 0x080c, 0x223d, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c,
5516 0x2373, 0x080c, 0x223d, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c,
5517 0x228f, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c, 0x228f, 0x0804,
5518 0x28f7, 0x0106, 0x0006, 0x080c, 0x2373, 0x080c, 0x228f, 0x0804,
5519 0x28f7, 0x0106, 0x0006, 0x080c, 0x2373, 0x080c, 0x228f, 0x0804,
5520 0x28f7, 0x0106, 0x0006, 0x080c, 0x223d, 0x080c, 0x228f, 0x0804,
5521 0x28f7, 0x0106, 0x0006, 0x080c, 0x223d, 0x080c, 0x228f, 0x0804,
5522 0x28f7, 0x0106, 0x0006, 0x080c, 0x2373, 0x080c, 0x223d, 0x080c,
5523 0x228f, 0x0804, 0x28f7, 0x0106, 0x0006, 0x080c, 0x2373, 0x080c,
5524 0x223d, 0x080c, 0x228f, 0x0804, 0x28f7, 0xe000, 0x0cf0, 0x0106,
5525 0x0006, 0x080c, 0x272f, 0x04d8, 0x0106, 0x0006, 0x080c, 0x272f,
5526 0x080c, 0x2373, 0x04a0, 0x0106, 0x0006, 0x080c, 0x272f, 0x080c,
5527 0x223d, 0x0468, 0x0106, 0x0006, 0x080c, 0x272f, 0x080c, 0x2373,
5528 0x080c, 0x223d, 0x0420, 0x0106, 0x0006, 0x080c, 0x272f, 0x080c,
5529 0x228f, 0x00e8, 0x0106, 0x0006, 0x080c, 0x272f, 0x080c, 0x2373,
5530 0x080c, 0x228f, 0x00a0, 0x0106, 0x0006, 0x080c, 0x272f, 0x080c,
5531 0x223d, 0x080c, 0x228f, 0x0058, 0x0106, 0x0006, 0x080c, 0x272f,
5532 0x080c, 0x2373, 0x080c, 0x223d, 0x080c, 0x228f, 0x0000, 0x000e,
5533 0x010e, 0x000d, 0x00c6, 0x0026, 0x0046, 0x2021, 0x0000, 0x080c,
5534 0x502d, 0x1904, 0x29d4, 0x72d0, 0x2001, 0xaf9d, 0x2004, 0xa005,
5535 0x1110, 0xd29c, 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904, 0x29d4,
5536 0x080c, 0x29d8, 0x0804, 0x29d4, 0x080c, 0x574f, 0x1120, 0x709b,
5537 0xffff, 0x0804, 0x29d4, 0xd294, 0x0120, 0x709b, 0xffff, 0x0804,
5538 0x29d4, 0x2001, 0xad14, 0x203c, 0x7284, 0xd284, 0x0904, 0x2976,
5539 0xd28c, 0x1904, 0x2976, 0x0036, 0x7398, 0xa38e, 0xffff, 0x1110,
5540 0x2019, 0x0001, 0x8314, 0xa2e0, 0xb3c0, 0x2c04, 0xa38c, 0x0001,
5541 0x0120, 0xa084, 0xff00, 0x8007, 0x0010, 0xa084, 0x00ff, 0xa70e,
5542 0x0560, 0xa08e, 0x0000, 0x0548, 0xa08e, 0x00ff, 0x1150, 0x7230,
5543 0xd284, 0x1538, 0x7284, 0xc28d, 0x7286, 0x709b, 0xffff, 0x003e,
5544 0x0428, 0x2009, 0x0000, 0x080c, 0x2676, 0x080c, 0x4c80, 0x11b8,
5545 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x1150, 0x7030, 0xd08c,
5546 0x0118, 0x6000, 0xd0bc, 0x0120, 0x080c, 0x29eb, 0x0140, 0x0028,
5547 0x080c, 0x2b1a, 0x080c, 0x2a19, 0x0110, 0x8318, 0x0818, 0x739a,
5548 0x0010, 0x709b, 0xffff, 0x003e, 0x0804, 0x29d4, 0xa780, 0x2be6,
5549 0x203d, 0xa7bc, 0xff00, 0x873f, 0x2041, 0x007e, 0x7098, 0xa096,
5550 0xffff, 0x1120, 0x2009, 0x0000, 0x28a8, 0x0050, 0xa812, 0x0220,
5551 0x2008, 0xa802, 0x20a8, 0x0020, 0x709b, 0xffff, 0x0804, 0x29d4,
5552 0x2700, 0x0156, 0x0016, 0xa106, 0x05a0, 0xc484, 0x080c, 0x4cdc,
5553 0x0120, 0x080c, 0x4c80, 0x15a8, 0x0008, 0xc485, 0x6004, 0xa084,
5554 0x00ff, 0xa086, 0x0006, 0x1130, 0x7030, 0xd08c, 0x01e8, 0x6000,
5555 0xd0bc, 0x11d0, 0x7284, 0xd28c, 0x0188, 0x6004, 0xa084, 0x00ff,
5556 0xa082, 0x0006, 0x02b0, 0xd484, 0x1118, 0x080c, 0x4c9f, 0x0028,
5557 0x080c, 0x2b9c, 0x0170, 0x080c, 0x2bc9, 0x0058, 0x080c, 0x2b1a,
5558 0x080c, 0x2a19, 0x0170, 0x0028, 0x080c, 0x2b9c, 0x0110, 0x0419,
5559 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04, 0x2990, 0x709b, 0xffff,
5560 0x0018, 0x001e, 0x015e, 0x719a, 0x004e, 0x002e, 0x00ce, 0x0005,
5561 0x00c6, 0x0016, 0x709b, 0x0000, 0x2009, 0x007e, 0x080c, 0x4c80,
5562 0x1138, 0x080c, 0x2b1a, 0x04a9, 0x0118, 0x70d0, 0xc0bd, 0x70d2,
5563 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2c68,
5564 0x2001, 0xad56, 0x2004, 0xa084, 0x00ff, 0x6842, 0x080c, 0x9807,
5565 0x01d8, 0x2d00, 0x601a, 0x080c, 0x9956, 0x601f, 0x0001, 0x2001,
5566 0x0000, 0x080c, 0x4c1e, 0x2001, 0x0000, 0x080c, 0x4c30, 0x0126,
5567 0x2091, 0x8000, 0x7094, 0x8000, 0x7096, 0x012e, 0x2009, 0x0004,
5568 0x080c, 0x80a7, 0xa085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e,
5569 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2c68, 0x2001, 0xad56,
5570 0x2004, 0xa084, 0x00ff, 0x6842, 0x080c, 0x9807, 0x0550, 0x2d00,
5571 0x601a, 0x6800, 0xc0c4, 0x6802, 0x68a0, 0xa086, 0x007e, 0x0140,
5572 0x6804, 0xa084, 0x00ff, 0xa086, 0x0006, 0x1110, 0x080c, 0x2ad9,
5573 0x080c, 0x9956, 0x601f, 0x0001, 0x2001, 0x0000, 0x080c, 0x4c1e,
5574 0x2001, 0x0002, 0x080c, 0x4c30, 0x0126, 0x2091, 0x8000, 0x7094,
5575 0x8000, 0x7096, 0x012e, 0x2009, 0x0002, 0x080c, 0x80a7, 0xa085,
5576 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x0026,
5577 0x2009, 0x0080, 0x080c, 0x4c80, 0x1120, 0x0031, 0x0110, 0x70d7,
5578 0xffff, 0x002e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
5579 0x2c68, 0x080c, 0x8022, 0x01d8, 0x2d00, 0x601a, 0x080c, 0x9956,
5580 0x601f, 0x0001, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x2001, 0x0002,
5581 0x080c, 0x4c30, 0x0126, 0x2091, 0x8000, 0x70d8, 0x8000, 0x70da,
5582 0x012e, 0x2009, 0x0002, 0x080c, 0x80a7, 0xa085, 0x0001, 0x00ce,
5583 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126, 0x2091,
5584 0x8000, 0x2009, 0x007f, 0x080c, 0x4c80, 0x1190, 0x2c68, 0x080c,
5585 0x8022, 0x0170, 0x2d00, 0x601a, 0x6312, 0x601f, 0x0001, 0x620a,
5586 0x080c, 0x9956, 0x2009, 0x0022, 0x080c, 0x80a7, 0xa085, 0x0001,
5587 0x012e, 0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036,
5588 0x0026, 0x080c, 0x68f3, 0x080c, 0x689d, 0x080c, 0x8a15, 0x2130,
5589 0x81ff, 0x0128, 0x20a9, 0x007e, 0x2009, 0x0000, 0x0020, 0x20a9,
5590 0x007f, 0x2009, 0x0000, 0x0016, 0x080c, 0x4cdc, 0x1120, 0x080c,
5591 0x4ecf, 0x080c, 0x493a, 0x001e, 0x8108, 0x1f04, 0x2ac3, 0x86ff,
5592 0x1110, 0x080c, 0x11d4, 0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee,
5593 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6218, 0x2270,
5594 0x72a0, 0x0026, 0x2019, 0x0029, 0x080c, 0x68e7, 0x0076, 0x2039,
5595 0x0000, 0x080c, 0x681d, 0x2c08, 0x080c, 0xa712, 0x007e, 0x001e,
5596 0x2e60, 0x080c, 0x4ecf, 0x6210, 0x6314, 0x080c, 0x493a, 0x6212,
5597 0x6316, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6,
5598 0x0006, 0x6018, 0xa080, 0x0028, 0x2004, 0xa086, 0x0080, 0x0150,
5599 0x2071, 0xad00, 0x7094, 0xa005, 0x0110, 0x8001, 0x7096, 0x000e,
5600 0x00ee, 0x0005, 0x2071, 0xad00, 0x70d8, 0xa005, 0x0dc0, 0x8001,
5601 0x70da, 0x0ca8, 0x6000, 0xc08c, 0x6002, 0x0005, 0x00f6, 0x00e6,
5602 0x00c6, 0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x81ff, 0x1118,
5603 0x20a9, 0x0001, 0x0098, 0x2001, 0xad52, 0x2004, 0xd0c4, 0x0150,
5604 0xd0a4, 0x0140, 0xa006, 0x0046, 0x2020, 0x2009, 0x002d, 0x080c,
5605 0xa96c, 0x004e, 0x20a9, 0x00ff, 0x2011, 0x0000, 0x0026, 0xa28e,
5606 0x007e, 0x05c8, 0xa28e, 0x007f, 0x05b0, 0xa28e, 0x0080, 0x0598,
5607 0xa288, 0xae34, 0x210c, 0x81ff, 0x0570, 0x8fff, 0x05c1, 0x00c6,
5608 0x2160, 0x2001, 0x0001, 0x080c, 0x5037, 0x00ce, 0x2019, 0x0029,
5609 0x080c, 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c, 0x681d, 0x00c6,
5610 0x0026, 0x2160, 0x6204, 0xa294, 0x00ff, 0xa286, 0x0006, 0x1118,
5611 0x6007, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007, 0xa215, 0x6206,
5612 0x002e, 0x00ce, 0x0016, 0x2c08, 0x080c, 0xa712, 0x001e, 0x007e,
5613 0x2160, 0x080c, 0x4ecf, 0x002e, 0x8210, 0x1f04, 0x2b3e, 0x015e,
5614 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046,
5615 0x0026, 0x0016, 0x2001, 0xad52, 0x2004, 0xd0c4, 0x0148, 0xd0a4,
5616 0x0138, 0xa006, 0x2220, 0x8427, 0x2009, 0x0029, 0x080c, 0xa96c,
5617 0x001e, 0x002e, 0x004e, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6,
5618 0x7284, 0x82ff, 0x01f8, 0x2011, 0xad52, 0x2214, 0xd2ac, 0x11d0,
5619 0x2100, 0x080c, 0x268a, 0x81ff, 0x01b8, 0x2019, 0x0001, 0x8314,
5620 0xa2e0, 0xb3c0, 0x2c04, 0xd384, 0x0120, 0xa084, 0xff00, 0x8007,
5621 0x0010, 0xa084, 0x00ff, 0xa116, 0x0138, 0xa096, 0x00ff, 0x0110,
5622 0x8318, 0x0c68, 0xa085, 0x0001, 0x00ce, 0x003e, 0x002e, 0x001e,
5623 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0xa180, 0xae34,
5624 0x2004, 0xa065, 0x0178, 0x0016, 0x00c6, 0x080c, 0x9807, 0x001e,
5625 0x090c, 0x14f6, 0x611a, 0x080c, 0x2ad9, 0x080c, 0x8078, 0x001e,
5626 0x080c, 0x4c9f, 0x012e, 0x00ce, 0x001e, 0x0005, 0x7eef, 0x7de8,
5627 0x7ce4, 0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6,
5628 0x80d5, 0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc,
5629 0x80cb, 0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc,
5630 0x80ba, 0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1,
5631 0x80ae, 0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6,
5632 0x6ca5, 0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797,
5633 0x6690, 0x658f, 0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c,
5634 0x607a, 0x8079, 0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071,
5635 0x806e, 0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66,
5636 0x5965, 0x5863, 0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454,
5637 0x5353, 0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a,
5638 0x4d49, 0x8047, 0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039,
5639 0x8036, 0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d,
5640 0x462c, 0x452b, 0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123,
5641 0x401f, 0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f,
5642 0x3a08, 0x8004, 0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700,
5643 0x3600, 0x8000, 0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000,
5644 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000,
5645 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000,
5646 0x8000, 0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000,
5647 0x8000, 0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700,
5648 0x2600, 0x2500, 0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100,
5649 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00,
5650 0x1a00, 0x8000, 0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
5651 0x8000, 0x1800, 0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400,
5652 0x1300, 0x1200, 0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00,
5653 0x0d00, 0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800,
5654 0x0700, 0x8000, 0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400,
5655 0x0300, 0x8000, 0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000,
5656 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000,
5657 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
5658 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0xad81,
5659 0x7003, 0x0002, 0xa006, 0x7012, 0x7016, 0x703a, 0x703e, 0x7033,
5660 0xad91, 0x7037, 0xad91, 0x7007, 0x0001, 0x2061, 0xadd1, 0x6003,
5661 0x0002, 0x0005, 0x1004, 0x2d0c, 0x0e04, 0x2d0c, 0x2071, 0xad81,
5662 0x2b78, 0x7818, 0xd084, 0x1140, 0x2a60, 0x7820, 0xa08e, 0x0069,
5663 0x1904, 0x2df1, 0x0804, 0x2d8a, 0x0005, 0x2071, 0xad81, 0x7004,
5664 0x0002, 0x2d15, 0x2d16, 0x2d1f, 0x2d30, 0x0005, 0x1004, 0x2d1e,
5665 0x0e04, 0x2d1e, 0x2b78, 0x7818, 0xd084, 0x01e8, 0x0005, 0x2b78,
5666 0x2061, 0xadd1, 0x6008, 0xa08e, 0x0100, 0x0128, 0xa086, 0x0200,
5667 0x0904, 0x2deb, 0x0005, 0x7014, 0x2068, 0x2a60, 0x7018, 0x0807,
5668 0x7010, 0x2068, 0x6834, 0xa086, 0x0103, 0x0108, 0x0005, 0x2a60,
5669 0x2b78, 0x7018, 0x0807, 0x2a60, 0x7820, 0xa08a, 0x0040, 0x1210,
5670 0x61c0, 0x0042, 0x2100, 0xa08a, 0x003f, 0x1a04, 0x2de8, 0x61c0,
5671 0x0804, 0x2d8a, 0x2dcc, 0x2df7, 0x2dff, 0x2e03, 0x2e0b, 0x2e11,
5672 0x2e15, 0x2e21, 0x2e24, 0x2e2e, 0x2e31, 0x2de8, 0x2de8, 0x2de8,
5673 0x2e34, 0x2de8, 0x2e43, 0x2e5a, 0x2e71, 0x2ee8, 0x2eed, 0x2f16,
5674 0x2f67, 0x2f78, 0x2f96, 0x2fcd, 0x2fd7, 0x2fe4, 0x2ff7, 0x3018,
5675 0x3021, 0x3057, 0x305d, 0x2de8, 0x3086, 0x2de8, 0x2de8, 0x2de8,
5676 0x2de8, 0x2de8, 0x308d, 0x3097, 0x2de8, 0x2de8, 0x2de8, 0x2de8,
5677 0x2de8, 0x2de8, 0x2de8, 0x2de8, 0x309f, 0x2de8, 0x2de8, 0x2de8,
5678 0x2de8, 0x2de8, 0x30b1, 0x30b9, 0x2de8, 0x2de8, 0x2de8, 0x2de8,
5679 0x2de8, 0x2de8, 0x0002, 0x30cb, 0x311f, 0x317a, 0x318a, 0x2de8,
5680 0x31a4, 0x35cb, 0x3fbb, 0x2de8, 0x2de8, 0x2de8, 0x2de8, 0x2de8,
5681 0x2de8, 0x2de8, 0x2de8, 0x2e2e, 0x2e31, 0x35cd, 0x2de8, 0x35da,
5682 0x403c, 0x4097, 0x40fb, 0x2de8, 0x415a, 0x4180, 0x419f, 0x2de8,
5683 0x2de8, 0x2de8, 0x2de8, 0x35de, 0x376b, 0x3785, 0x37a3, 0x3804,
5684 0x3858, 0x3863, 0x389a, 0x38a9, 0x38b8, 0x38bb, 0x38de, 0x3928,
5685 0x398e, 0x399b, 0x3a9c, 0x3bb3, 0x3bdc, 0x3cda, 0x3cfc, 0x3d08,
5686 0x3d41, 0x3e05, 0x2de8, 0x2de8, 0x2de8, 0x2de8, 0x3e6d, 0x3e88,
5687 0x3efa, 0x3fac, 0x713c, 0x0000, 0x2021, 0x4000, 0x080c, 0x3c39,
5688 0x0126, 0x2091, 0x8000, 0x0e04, 0x2dd8, 0x7818, 0xd084, 0x0110,
5689 0x012e, 0x0cb0, 0x7c22, 0x7926, 0x7a2a, 0x7b2e, 0x781b, 0x0001,
5690 0x2091, 0x4080, 0x7007, 0x0001, 0x2091, 0x5000, 0x012e, 0x0005,
5691 0x2021, 0x4001, 0x0c18, 0x2021, 0x4002, 0x0c00, 0x2021, 0x4003,
5692 0x08e8, 0x2021, 0x4005, 0x08d0, 0x2021, 0x4006, 0x08b8, 0xa02e,
5693 0x2520, 0x7b28, 0x7a2c, 0x7824, 0x7930, 0x0804, 0x3c46, 0x7823,
5694 0x0004, 0x7824, 0x0807, 0xa02e, 0x2520, 0x7b28, 0x7a2c, 0x7824,
5695 0x7930, 0x0804, 0x3c49, 0x7924, 0x7828, 0x2114, 0x200a, 0x0804,
5696 0x2dcc, 0x7924, 0x2114, 0x0804, 0x2dcc, 0x2099, 0x0009, 0x20a1,
5697 0x0009, 0x20a9, 0x0007, 0x53a3, 0x7924, 0x7a28, 0x7b2c, 0x0804,
5698 0x2dcc, 0x7824, 0x2060, 0x0090, 0x2009, 0x0002, 0x2011, 0x0001,
5699 0x2019, 0x001b, 0x783b, 0x0017, 0x0804, 0x2dcc, 0x7d38, 0x7c3c,
5700 0x0840, 0x7d38, 0x7c3c, 0x0888, 0x2061, 0x1000, 0xe10c, 0xa006,
5701 0x2c15, 0xa200, 0x8c60, 0x8109, 0x1dd8, 0x2010, 0xa005, 0x0904,
5702 0x2dcc, 0x0804, 0x2dee, 0x2069, 0xad51, 0x7824, 0x7930, 0xa11a,
5703 0x1a04, 0x2df4, 0x8019, 0x0904, 0x2df4, 0x684a, 0x6942, 0x782c,
5704 0x6852, 0x7828, 0x6856, 0xa006, 0x685a, 0x685e, 0x080c, 0x5a1c,
5705 0x0804, 0x2dcc, 0x2069, 0xad51, 0x7824, 0x7934, 0xa11a, 0x1a04,
5706 0x2df4, 0x8019, 0x0904, 0x2df4, 0x684e, 0x6946, 0x782c, 0x6862,
5707 0x7828, 0x6866, 0xa006, 0x686a, 0x686e, 0x080c, 0x50d9, 0x0804,
5708 0x2dcc, 0xa02e, 0x2520, 0x81ff, 0x1904, 0x2df1, 0x7924, 0x7b28,
5709 0x7a2c, 0x20a9, 0x0005, 0x20a1, 0xad88, 0x41a1, 0x080c, 0x3c05,
5710 0x0904, 0x2df1, 0x2009, 0x0020, 0x080c, 0x3c46, 0x701b, 0x2e89,
5711 0x0005, 0x6834, 0x2008, 0xa084, 0x00ff, 0xa096, 0x0011, 0x0120,
5712 0xa096, 0x0019, 0x1904, 0x2df1, 0x810f, 0xa18c, 0x00ff, 0x0904,
5713 0x2df1, 0x710e, 0x700c, 0x8001, 0x0528, 0x700e, 0x080c, 0x3c05,
5714 0x0904, 0x2df1, 0x2009, 0x0020, 0x2061, 0xadd1, 0x6224, 0x6328,
5715 0x642c, 0x6530, 0xa290, 0x0040, 0xa399, 0x0000, 0xa4a1, 0x0000,
5716 0xa5a9, 0x0000, 0x080c, 0x3c46, 0x701b, 0x2eb7, 0x0005, 0x6834,
5717 0xa084, 0x00ff, 0xa096, 0x0002, 0x0120, 0xa096, 0x000a, 0x1904,
5718 0x2df1, 0x08c0, 0x7010, 0x2068, 0x6838, 0xc0fd, 0x683a, 0x080c,
5719 0x4b7c, 0x1128, 0x7007, 0x0003, 0x701b, 0x2ed1, 0x0005, 0x080c,
5720 0x51df, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0005, 0x2099, 0xad88,
5721 0x530a, 0x2100, 0xa210, 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9,
5722 0x0000, 0xad80, 0x000d, 0x2009, 0x0020, 0x012e, 0x0804, 0x3c49,
5723 0x61a8, 0x7824, 0x60aa, 0x0804, 0x2dcc, 0x2091, 0x8000, 0x7823,
5724 0x4000, 0x7827, 0x4953, 0x782b, 0x5020, 0x782f, 0x2020, 0x2009,
5725 0x017f, 0x2104, 0x7832, 0x3f00, 0x7836, 0x2061, 0x0100, 0x6200,
5726 0x2061, 0x0200, 0x603c, 0x8007, 0xa205, 0x783a, 0x2009, 0x04fd,
5727 0x2104, 0x783e, 0x781b, 0x0001, 0x2091, 0x5000, 0x2091, 0x4080,
5728 0x2071, 0x0010, 0x20c1, 0x00f0, 0x0804, 0x0427, 0x81ff, 0x1904,
5729 0x2df1, 0x7924, 0x810f, 0xa18c, 0x00ff, 0x080c, 0x4cdc, 0x1904,
5730 0x2df4, 0x7e38, 0xa684, 0x3fff, 0xa082, 0x4000, 0x0210, 0x0804,
5731 0x2df4, 0x7c28, 0x7d2c, 0x080c, 0x4e96, 0xd28c, 0x1118, 0x080c,
5732 0x4e41, 0x0010, 0x080c, 0x4e6f, 0x1518, 0x2061, 0xb400, 0x0126,
5733 0x2091, 0x8000, 0x6000, 0xa086, 0x0000, 0x0148, 0x6010, 0xa06d,
5734 0x0130, 0x683c, 0xa406, 0x1118, 0x6840, 0xa506, 0x0150, 0x012e,
5735 0xace0, 0x0018, 0x2001, 0xad16, 0x2004, 0xac02, 0x1a04, 0x2df1,
5736 0x0c30, 0x080c, 0x929c, 0x012e, 0x0904, 0x2df1, 0x0804, 0x2dcc,
5737 0xa00e, 0x2001, 0x0005, 0x080c, 0x51df, 0x0126, 0x2091, 0x8000,
5738 0x080c, 0x9803, 0x080c, 0x510c, 0x012e, 0x0804, 0x2dcc, 0x81ff,
5739 0x1904, 0x2df1, 0x080c, 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4d96,
5740 0x0904, 0x2df1, 0x080c, 0x4ea2, 0x0904, 0x2df1, 0x0804, 0x2dcc,
5741 0x81ff, 0x1904, 0x2df1, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x080c,
5742 0x4f0d, 0x0904, 0x2df1, 0x2019, 0x0005, 0x080c, 0x4ebd, 0x0904,
5743 0x2df1, 0x7828, 0xa08a, 0x1000, 0x1a04, 0x2df4, 0x8003, 0x800b,
5744 0x810b, 0xa108, 0x080c, 0x6519, 0x0804, 0x2dcc, 0x0126, 0x2091,
5745 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0448, 0x2029, 0x00ff,
5746 0x644c, 0x2400, 0xa506, 0x01f0, 0x2508, 0x080c, 0x4cdc, 0x11d0,
5747 0x080c, 0x4f0d, 0x1128, 0x2009, 0x0002, 0x62b0, 0x2518, 0x00b8,
5748 0x2019, 0x0004, 0x080c, 0x4ebd, 0x1118, 0x2009, 0x0006, 0x0078,
5749 0x7824, 0xa08a, 0x1000, 0x1270, 0x8003, 0x800b, 0x810b, 0xa108,
5750 0x080c, 0x6519, 0x8529, 0x1ae8, 0x012e, 0x0804, 0x2dcc, 0x012e,
5751 0x0804, 0x2df1, 0x012e, 0x0804, 0x2df4, 0x080c, 0x3c1a, 0x0904,
5752 0x2df4, 0x080c, 0x4dfc, 0x080c, 0x4e96, 0x0804, 0x2dcc, 0x81ff,
5753 0x1904, 0x2df1, 0x080c, 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4ded,
5754 0x080c, 0x4e96, 0x0804, 0x2dcc, 0x81ff, 0x1904, 0x2df1, 0x080c,
5755 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4e71, 0x0904, 0x2df1, 0x080c,
5756 0x4bc0, 0x080c, 0x4e3a, 0x080c, 0x4e96, 0x0804, 0x2dcc, 0x080c,
5757 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4d96, 0x0904, 0x2df1, 0x62a0,
5758 0x2019, 0x0005, 0x00c6, 0x080c, 0x4ecf, 0x2061, 0x0000, 0x080c,
5759 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c, 0x681d, 0x2009, 0x0000,
5760 0x080c, 0xa712, 0x007e, 0x00ce, 0x080c, 0x4e96, 0x0804, 0x2dcc,
5761 0x080c, 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4e96, 0x2208, 0x0804,
5762 0x2dcc, 0x0156, 0x00d6, 0x00e6, 0x2069, 0xae13, 0x6810, 0x6914,
5763 0xa10a, 0x1210, 0x2009, 0x0000, 0x6816, 0x2011, 0x0000, 0x2019,
5764 0x0000, 0x20a9, 0x007e, 0x2069, 0xae34, 0x2d04, 0xa075, 0x0130,
5765 0x704c, 0x0071, 0xa210, 0x7080, 0x0059, 0xa318, 0x8d68, 0x1f04,
5766 0x3035, 0x2300, 0xa218, 0x00ee, 0x00de, 0x015e, 0x0804, 0x2dcc,
5767 0x00f6, 0x0016, 0xa07d, 0x0140, 0x2001, 0x0000, 0x8000, 0x2f0c,
5768 0x81ff, 0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069,
5769 0xae13, 0x6910, 0x62ac, 0x0804, 0x2dcc, 0x81ff, 0x1904, 0x2df1,
5770 0x614c, 0xa190, 0x2be6, 0x2215, 0xa294, 0x00ff, 0x636c, 0x83ff,
5771 0x0108, 0x6270, 0x67d0, 0xd79c, 0x0118, 0x2031, 0x0001, 0x0090,
5772 0xd7ac, 0x0118, 0x2031, 0x0003, 0x0068, 0xd7a4, 0x0118, 0x2031,
5773 0x0002, 0x0040, 0x080c, 0x574f, 0x1118, 0x2031, 0x0004, 0x0010,
5774 0x2031, 0x0000, 0x7e3a, 0x7f3e, 0x0804, 0x2dcc, 0x613c, 0x6240,
5775 0x2019, 0xafa3, 0x231c, 0x0804, 0x2dcc, 0x0126, 0x2091, 0x8000,
5776 0x6134, 0xa006, 0x2010, 0x2018, 0x012e, 0x0804, 0x2dcc, 0x080c,
5777 0x3c2a, 0x0904, 0x2df4, 0x6244, 0x6338, 0x0804, 0x2dcc, 0x613c,
5778 0x6240, 0x7824, 0x603e, 0x7b28, 0x6342, 0x2069, 0xad51, 0x831f,
5779 0xa305, 0x6816, 0x782c, 0x2069, 0xafa3, 0x2d1c, 0x206a, 0x0804,
5780 0x2dcc, 0x0126, 0x2091, 0x8000, 0x7824, 0x6036, 0x012e, 0x0804,
5781 0x2dcc, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x7828, 0xa00d, 0x0904,
5782 0x2df4, 0x782c, 0xa005, 0x0904, 0x2df4, 0x6244, 0x6146, 0x6338,
5783 0x603a, 0x0804, 0x2dcc, 0x2001, 0xad00, 0x2004, 0xa086, 0x0003,
5784 0x1904, 0x2df1, 0x00c6, 0x2061, 0x0100, 0x7924, 0x810f, 0xa18c,
5785 0x00ff, 0xa196, 0x00ff, 0x1130, 0x2001, 0xad14, 0x2004, 0xa085,
5786 0xff00, 0x0078, 0xa182, 0x007f, 0x16a0, 0xa188, 0x2be6, 0x210d,
5787 0xa18c, 0x00ff, 0x2001, 0xad14, 0x2004, 0xa116, 0x0550, 0x810f,
5788 0xa105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0x8022, 0x000e,
5789 0x01e0, 0x601a, 0x600b, 0xbc09, 0x601f, 0x0001, 0x080c, 0x3c05,
5790 0x01d8, 0x6837, 0x0000, 0x7007, 0x0003, 0x6833, 0x0000, 0x6838,
5791 0xc0fd, 0x683a, 0x701b, 0x3173, 0x2d00, 0x6012, 0x2009, 0x0032,
5792 0x080c, 0x80a7, 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804,
5793 0x2df1, 0x00ce, 0x0804, 0x2df4, 0x080c, 0x8078, 0x0cb0, 0x2001,
5794 0xad00, 0x2004, 0xa086, 0x0003, 0x1904, 0x2df1, 0x00c6, 0x2061,
5795 0x0100, 0x7924, 0x810f, 0xa18c, 0x00ff, 0xa196, 0x00ff, 0x1130,
5796 0x2001, 0xad14, 0x2004, 0xa085, 0xff00, 0x0078, 0xa182, 0x007f,
5797 0x16a0, 0xa188, 0x2be6, 0x210d, 0xa18c, 0x00ff, 0x2001, 0xad14,
5798 0x2004, 0xa116, 0x0550, 0x810f, 0xa105, 0x0126, 0x2091, 0x8000,
5799 0x0006, 0x080c, 0x8022, 0x000e, 0x01e0, 0x601a, 0x600b, 0xbc05,
5800 0x601f, 0x0001, 0x080c, 0x3c05, 0x01d8, 0x6837, 0x0000, 0x7007,
5801 0x0003, 0x6833, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x701b, 0x3173,
5802 0x2d00, 0x6012, 0x2009, 0x0032, 0x080c, 0x80a7, 0x012e, 0x00ce,
5803 0x0005, 0x012e, 0x00ce, 0x0804, 0x2df1, 0x00ce, 0x0804, 0x2df4,
5804 0x080c, 0x8078, 0x0cb0, 0x6830, 0xa086, 0x0100, 0x0904, 0x2df1,
5805 0x0804, 0x2dcc, 0x2061, 0xb048, 0x0126, 0x2091, 0x8000, 0x6000,
5806 0xd084, 0x0128, 0x6104, 0x6208, 0x012e, 0x0804, 0x2dcc, 0x012e,
5807 0x0804, 0x2df4, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x574f, 0x0904,
5808 0x2df1, 0x0126, 0x2091, 0x8000, 0x6244, 0x6064, 0xa202, 0x0248,
5809 0xa085, 0x0001, 0x080c, 0x26c0, 0x080c, 0x436e, 0x012e, 0x0804,
5810 0x2dcc, 0x012e, 0x0804, 0x2df4, 0x0126, 0x2091, 0x8000, 0x7824,
5811 0xa084, 0x0007, 0x0002, 0x31b6, 0x31bf, 0x31c6, 0x31b3, 0x31b3,
5812 0x31b3, 0x31b3, 0x31b3, 0x012e, 0x0804, 0x2df4, 0x2009, 0x0114,
5813 0x2104, 0xa085, 0x0800, 0x200a, 0x080c, 0x332f, 0x0070, 0x2009,
5814 0x010b, 0x200b, 0x0010, 0x080c, 0x332f, 0x0038, 0x81ff, 0x0128,
5815 0x012e, 0x2021, 0x400b, 0x0804, 0x2dce, 0x0086, 0x0096, 0x00a6,
5816 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2009, 0x0101, 0x210c,
5817 0x0016, 0x2001, 0x0138, 0x200c, 0x2003, 0x0001, 0x0016, 0x2001,
5818 0x007a, 0x2034, 0x2001, 0x007b, 0x202c, 0xa006, 0x2048, 0x2050,
5819 0x2058, 0x080c, 0x3570, 0x080c, 0x34da, 0xa03e, 0x2720, 0x00f6,
5820 0x00e6, 0x00c6, 0x2d60, 0x2071, 0xb01e, 0x2079, 0x0020, 0x00d6,
5821 0x2069, 0x0000, 0x6824, 0xd0b4, 0x0140, 0x2001, 0x007d, 0x2004,
5822 0x783e, 0x2001, 0x007c, 0x2004, 0x783a, 0x00de, 0x2011, 0x0001,
5823 0x080c, 0x3486, 0x080c, 0x3486, 0x00ce, 0x00ee, 0x00fe, 0x080c,
5824 0x33d5, 0x080c, 0x34ae, 0x080c, 0x342b, 0x080c, 0x3394, 0x080c,
5825 0x33c5, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd094, 0x0530, 0x7814,
5826 0xa084, 0x0184, 0xa085, 0x0010, 0x7816, 0x2079, 0x0140, 0x080c,
5827 0x330d, 0x1110, 0x00fe, 0x0430, 0x7804, 0xd0dc, 0x0dc0, 0x2079,
5828 0x0100, 0x7827, 0x0086, 0x7814, 0xa084, 0x0184, 0xa085, 0x0032,
5829 0x7816, 0x080c, 0x330d, 0x1110, 0x00fe, 0x00a0, 0x7824, 0xd0bc,
5830 0x0dc0, 0x7827, 0x0080, 0xa026, 0x7c16, 0x7824, 0xd0ac, 0x0130,
5831 0x8b58, 0x080c, 0x3317, 0x00fe, 0x0804, 0x32d7, 0x00fe, 0x080c,
5832 0x330d, 0x1150, 0x8948, 0x2001, 0x007a, 0x2602, 0x2001, 0x007b,
5833 0x2502, 0x080c, 0x3317, 0x0088, 0x87ff, 0x0140, 0x2001, 0x0201,
5834 0x2004, 0xa005, 0x1904, 0x3211, 0x8739, 0x0038, 0x2001, 0xaffd,
5835 0x2004, 0xa086, 0x0000, 0x1904, 0x3211, 0x2001, 0x0033, 0x2003,
5836 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0xa605, 0x0904, 0x32d7,
5837 0x7824, 0xd0bc, 0x0128, 0x2900, 0xaa05, 0xab05, 0x1904, 0x32d7,
5838 0x6033, 0x000d, 0x2001, 0x0030, 0x2003, 0x0004, 0x7824, 0xd0ac,
5839 0x1148, 0x2001, 0xaffd, 0x2003, 0x0003, 0x2001, 0x0030, 0x2003,
5840 0x0009, 0x0040, 0x6027, 0x0001, 0x2001, 0x0075, 0x2004, 0xa005,
5841 0x0108, 0x6026, 0x2c00, 0x601a, 0x20e1, 0x9040, 0x2d00, 0x681a,
5842 0x6833, 0x000d, 0x7824, 0xd0a4, 0x1180, 0x6827, 0x0000, 0x00c6,
5843 0x20a9, 0x0004, 0x2061, 0x0020, 0x6003, 0x0008, 0x2001, 0x0203,
5844 0x2004, 0x1f04, 0x32ac, 0x00ce, 0x0040, 0x6827, 0x0001, 0x2001,
5845 0x0074, 0x2004, 0xa005, 0x0108, 0x6826, 0x00f6, 0x00c6, 0x2079,
5846 0x0100, 0x2061, 0x0020, 0x7827, 0x0002, 0x2001, 0x0072, 0x2004,
5847 0xa084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x0073, 0x2004, 0x601e,
5848 0x78c6, 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x31ef, 0x2061,
5849 0x0100, 0x6027, 0x0002, 0x001e, 0x61e2, 0x001e, 0x6106, 0x7824,
5850 0xa084, 0x0003, 0xa086, 0x0002, 0x0188, 0x20e1, 0x9028, 0x6050,
5851 0xa084, 0xf7ef, 0x6052, 0x602f, 0x0000, 0x602c, 0xc0ac, 0x602e,
5852 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010, 0x2908, 0x2a10,
5853 0x2b18, 0x2b00, 0xaa05, 0xa905, 0x00fe, 0x00ee, 0x00de, 0x00ce,
5854 0x00be, 0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x2dcc,
5855 0x012e, 0x2021, 0x400c, 0x0804, 0x2dce, 0xa085, 0x0001, 0x1d04,
5856 0x3316, 0x2091, 0x6000, 0x8420, 0xa486, 0x0064, 0x0005, 0x2001,
5857 0x0105, 0x2003, 0x0010, 0x2001, 0x0030, 0x2003, 0x0004, 0x2001,
5858 0x0020, 0x2003, 0x0004, 0x2001, 0xaffd, 0x2003, 0x0000, 0x2001,
5859 0xb01e, 0x2003, 0x0000, 0x20e1, 0xf000, 0xa026, 0x0005, 0x00f6,
5860 0x2079, 0x0100, 0x2001, 0xad14, 0x200c, 0x7932, 0x7936, 0x080c,
5861 0x26a0, 0x7850, 0xa084, 0x0980, 0xa085, 0x0030, 0x7852, 0x2019,
5862 0x01f4, 0x8319, 0x1df0, 0xa084, 0x0980, 0x7852, 0x782c, 0xc0ad,
5863 0x782e, 0x20a9, 0x0046, 0x1d04, 0x334b, 0x2091, 0x6000, 0x1f04,
5864 0x334b, 0x7850, 0xa085, 0x0400, 0x7852, 0x2001, 0x0009, 0x2004,
5865 0xa084, 0x0003, 0xa086, 0x0001, 0x1118, 0x782c, 0xc0ac, 0x782e,
5866 0x784b, 0xf7f7, 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9, 0x000e,
5867 0xe000, 0x1f04, 0x3368, 0x7850, 0xa085, 0x1400, 0x7852, 0x2019,
5868 0x61a8, 0x7854, 0xe000, 0xe000, 0xd08c, 0x1110, 0x8319, 0x1dc8,
5869 0x7827, 0x0048, 0x7850, 0xa085, 0x0400, 0x7852, 0x7843, 0x0040,
5870 0x2019, 0x01f4, 0xe000, 0xe000, 0x8319, 0x1de0, 0x2001, 0x0140,
5871 0x2003, 0x0100, 0x7827, 0x0020, 0x7843, 0x0000, 0x2003, 0x0000,
5872 0x7827, 0x0048, 0x00fe, 0x0005, 0x7824, 0xd0ac, 0x11c8, 0x00f6,
5873 0x00e6, 0x2071, 0xaffd, 0x2079, 0x0030, 0x2001, 0x0201, 0x2004,
5874 0xa005, 0x0160, 0x7000, 0xa086, 0x0000, 0x1140, 0x0051, 0xd0bc,
5875 0x0108, 0x8738, 0x7003, 0x0003, 0x7803, 0x0019, 0x00ee, 0x00fe,
5876 0x0005, 0x780c, 0xa08c, 0x0070, 0x0178, 0x2009, 0x007a, 0x260a,
5877 0x2009, 0x007b, 0x250a, 0xd0b4, 0x0108, 0x8a50, 0xd0ac, 0x0108,
5878 0x8948, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200,
5879 0x781c, 0xd084, 0x0140, 0x20e1, 0x0007, 0x20e1, 0x2000, 0x2001,
5880 0x020a, 0x2004, 0x0ca8, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100,
5881 0x2009, 0xad14, 0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e,
5882 0x706b, 0x0000, 0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0xa080,
5883 0x0100, 0x707a, 0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0xa006,
5884 0x708a, 0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5,
5885 0x7027, 0x0080, 0x7014, 0xa084, 0x0184, 0xa085, 0x0032, 0x7016,
5886 0x080c, 0x34ae, 0x080c, 0x330d, 0x1110, 0x8421, 0x0028, 0x7024,
5887 0xd0bc, 0x0db0, 0x7027, 0x0080, 0x00f6, 0x00e6, 0x2071, 0xaffd,
5888 0x2079, 0x0030, 0x00d6, 0x2069, 0x0000, 0x6824, 0xd0b4, 0x0120,
5889 0x683c, 0x783e, 0x6838, 0x783a, 0x00de, 0x2011, 0x0011, 0x080c,
5890 0x3486, 0x2011, 0x0001, 0x080c, 0x3486, 0x00ee, 0x00fe, 0x7017,
5891 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0xaffd, 0x2079,
5892 0x0030, 0x7904, 0xd1fc, 0x0904, 0x3483, 0x7803, 0x0002, 0xa026,
5893 0xd19c, 0x1904, 0x347f, 0x7000, 0x0002, 0x3483, 0x3441, 0x3465,
5894 0x347f, 0xd1bc, 0x1150, 0xd1dc, 0x1150, 0x8001, 0x7002, 0x2011,
5895 0x0001, 0x04e1, 0x05c0, 0x04d1, 0x04b0, 0x780f, 0x0000, 0x7820,
5896 0x7924, 0x7803, 0x0004, 0x7822, 0x7926, 0x2001, 0x0201, 0x200c,
5897 0x81ff, 0x0de8, 0x080c, 0x33b1, 0x2009, 0x0001, 0x7808, 0xd0ec,
5898 0x0110, 0x2009, 0x0011, 0x7902, 0x00f0, 0x8001, 0x7002, 0xa184,
5899 0x0880, 0x1138, 0x7804, 0xd0fc, 0x1940, 0x2011, 0x0001, 0x00b1,
5900 0x0090, 0x6030, 0xa092, 0x0004, 0xa086, 0x0009, 0x1120, 0x6000,
5901 0x601a, 0x2011, 0x0025, 0x6232, 0xd1dc, 0x1988, 0x0870, 0x7803,
5902 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x6024, 0xa005,
5903 0x0520, 0x8001, 0x6026, 0x6018, 0x6130, 0xa140, 0x2804, 0x7832,
5904 0x8840, 0x2804, 0x7836, 0x8840, 0x2804, 0x7822, 0x8840, 0x2804,
5905 0x7826, 0x8840, 0x7a02, 0x7000, 0x8000, 0x7002, 0x6018, 0xa802,
5906 0xa08a, 0x0029, 0x1138, 0x6018, 0xa080, 0x0001, 0x2004, 0x601a,
5907 0x2001, 0x000d, 0x6032, 0xa085, 0x0001, 0x0005, 0x00f6, 0x00e6,
5908 0x00c6, 0x2071, 0xb01e, 0x2079, 0x0020, 0x7904, 0xd1fc, 0x01f0,
5909 0x7803, 0x0002, 0x2d60, 0xa026, 0x7000, 0x0002, 0x34d6, 0x34c1,
5910 0x34cd, 0x8001, 0x7002, 0xd19c, 0x1188, 0x2011, 0x0001, 0x080c,
5911 0x3486, 0x0160, 0x080c, 0x3486, 0x0048, 0x8001, 0x7002, 0x7804,
5912 0xd0fc, 0x1d30, 0x2011, 0x0001, 0x080c, 0x3486, 0x00ce, 0x00ee,
5913 0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200, 0x601b,
5914 0x0004, 0x2061, 0x0100, 0x60cf, 0x0400, 0x6004, 0xc0ac, 0xa085,
5915 0x0200, 0x6006, 0x2001, 0x0074, 0x2004, 0xa005, 0x01f8, 0x2038,
5916 0x2001, 0x0076, 0x2024, 0x2001, 0x0077, 0x201c, 0x080c, 0x3c05,
5917 0x6833, 0x000d, 0x6f26, 0x2d00, 0x681a, 0xa78a, 0x0007, 0x0220,
5918 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0xa03e, 0x6818, 0xa080,
5919 0x000d, 0x04a1, 0x1d90, 0x2d00, 0x681a, 0x0088, 0x080c, 0x3c05,
5920 0x6833, 0x000d, 0x2070, 0x6827, 0x0001, 0x2d00, 0x681a, 0x2001,
5921 0x0076, 0x2004, 0x2072, 0x2001, 0x0077, 0x2004, 0x7006, 0x2061,
5922 0x0020, 0x2079, 0x0100, 0x6013, 0x0400, 0x20e1, 0x9040, 0x2001,
5923 0x0072, 0x2004, 0xa084, 0xfff8, 0x700a, 0x601a, 0x0006, 0x2001,
5924 0x0073, 0x2004, 0x700e, 0x601e, 0x78c6, 0x000e, 0x78ca, 0xa006,
5925 0x603a, 0x603e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x2071,
5926 0x0010, 0x20a0, 0x2099, 0x0014, 0x7003, 0x0026, 0x7432, 0x7336,
5927 0xa006, 0x703a, 0x703e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7122,
5928 0x7003, 0x0041, 0x7004, 0xd0fc, 0x0de8, 0x7003, 0x0002, 0x7003,
5929 0x0040, 0x53a5, 0x7430, 0x7334, 0x87ff, 0x0180, 0x00c6, 0x00d6,
5930 0x2d60, 0x00c6, 0x080c, 0x3c05, 0x00ce, 0x6018, 0x2070, 0x2d00,
5931 0x7006, 0x601a, 0x00de, 0x00ce, 0xa085, 0x0001, 0x00ee, 0x0005,
5932 0x00e6, 0x2001, 0x0075, 0x2004, 0xa005, 0x0508, 0x2038, 0x2001,
5933 0x0078, 0x2024, 0x2001, 0x0079, 0x201c, 0x080c, 0x3c05, 0x2d60,
5934 0x6833, 0x000d, 0x6f26, 0x2d00, 0x681a, 0xa78a, 0x0007, 0x0220,
5935 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0xa03e, 0x6818, 0xa080,
5936 0x000d, 0x080c, 0x353e, 0x1d88, 0x2d00, 0x681a, 0x00e0, 0x080c,
5937 0x3c05, 0x2d60, 0x6033, 0x000d, 0x2070, 0x6027, 0x0001, 0x2c00,
5938 0x601a, 0x2001, 0x0078, 0x2004, 0x2072, 0x2001, 0x0079, 0x2004,
5939 0x7006, 0x2001, 0x0072, 0x2004, 0xa084, 0xfff8, 0x700a, 0x2001,
5940 0x0073, 0x2004, 0x700e, 0x2001, 0x0030, 0x2003, 0x0004, 0x7824,
5941 0xd0ac, 0x1178, 0x2001, 0x0101, 0x200c, 0xc1ed, 0x2102, 0x6027,
5942 0x0000, 0x2001, 0xaffd, 0x2003, 0x0003, 0x2001, 0x0030, 0x2003,
5943 0x0009, 0x00ee, 0x0005, 0x0804, 0x2dcc, 0x0126, 0x2091, 0x8000,
5944 0x20a9, 0x0011, 0x2001, 0xad40, 0x20a0, 0xa006, 0x40a4, 0x012e,
5945 0x0804, 0x2dcc, 0x7d38, 0x7c3c, 0x0804, 0x2e73, 0x080c, 0x3c05,
5946 0x0904, 0x2df1, 0x080c, 0x574f, 0x0110, 0x080c, 0x491f, 0x2009,
5947 0x001c, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x080c, 0x3c46, 0x701b,
5948 0x35f2, 0x0005, 0xade8, 0x000d, 0x6800, 0xa005, 0x0904, 0x2df4,
5949 0x6804, 0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x2df4, 0xd094, 0x00c6,
5950 0x2061, 0x0100, 0x6104, 0x0138, 0x6200, 0xa292, 0x0005, 0x0218,
5951 0xa18c, 0xffdf, 0x0010, 0xa18d, 0x0020, 0x6106, 0x00ce, 0xd08c,
5952 0x00c6, 0x2061, 0x0100, 0x6104, 0x0118, 0xa18d, 0x0010, 0x0010,
5953 0xa18c, 0xffef, 0x6106, 0x00ce, 0x2009, 0x0100, 0x210c, 0xa18a,
5954 0x0002, 0x0268, 0xd084, 0x0158, 0x6a28, 0xa28a, 0x007f, 0x1a04,
5955 0x2df4, 0xa288, 0x2be6, 0x210d, 0xa18c, 0x00ff, 0x6156, 0xd0dc,
5956 0x0130, 0x6828, 0xa08a, 0x007f, 0x1a04, 0x2df4, 0x604e, 0x6808,
5957 0xa08a, 0x0100, 0x0a04, 0x2df4, 0xa08a, 0x0841, 0x1a04, 0x2df4,
5958 0xa084, 0x0007, 0x1904, 0x2df4, 0x680c, 0xa005, 0x0904, 0x2df4,
5959 0x6810, 0xa005, 0x0904, 0x2df4, 0x6848, 0x6940, 0xa10a, 0x1a04,
5960 0x2df4, 0x8001, 0x0904, 0x2df4, 0x684c, 0x6944, 0xa10a, 0x1a04,
5961 0x2df4, 0x8001, 0x0904, 0x2df4, 0x6804, 0xd0fc, 0x0560, 0x080c,
5962 0x3c05, 0x0904, 0x2df1, 0x2009, 0x0014, 0x7a2c, 0x7b28, 0x7c3c,
5963 0x7d38, 0xa290, 0x0038, 0xa399, 0x0000, 0x080c, 0x3c46, 0x701b,
5964 0x3672, 0x0005, 0xade8, 0x000d, 0x20a9, 0x0014, 0x2d98, 0x2069,
5965 0xad6d, 0x2da0, 0x53a3, 0x7010, 0xa0e8, 0x000d, 0x2001, 0xad71,
5966 0x200c, 0xd1e4, 0x0140, 0x00c6, 0x2061, 0x0100, 0x6004, 0xa085,
5967 0x0b00, 0x6006, 0x00ce, 0x20a9, 0x001c, 0x2d98, 0x2069, 0xad51,
5968 0x2da0, 0x53a3, 0x6814, 0xa08c, 0x00ff, 0x613e, 0x8007, 0xa084,
5969 0x00ff, 0x6042, 0x080c, 0x5a1c, 0x080c, 0x5070, 0x080c, 0x50d9,
5970 0x6000, 0xa086, 0x0000, 0x1904, 0x3755, 0x6808, 0x602a, 0x080c,
5971 0x22f8, 0x0006, 0x2001, 0x0100, 0x2004, 0xa082, 0x0005, 0x000e,
5972 0x0268, 0x2009, 0x0170, 0x200b, 0x0080, 0xe000, 0xe000, 0x200b,
5973 0x0000, 0x0036, 0x6b08, 0x080c, 0x26fb, 0x003e, 0x6818, 0x691c,
5974 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a,
5975 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38,
5976 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0xa084, 0xf0ff,
5977 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f,
5978 0x20a9, 0x0004, 0x20a1, 0xafad, 0x40a1, 0x080c, 0x659c, 0x6904,
5979 0xd1fc, 0x0520, 0x00c6, 0x2009, 0x0000, 0x20a9, 0x0001, 0x6b70,
5980 0xd384, 0x01c8, 0x0020, 0x839d, 0x12b0, 0x3508, 0x8109, 0x080c,
5981 0x5fa9, 0x6878, 0x6016, 0x6874, 0x2008, 0xa084, 0xff00, 0x8007,
5982 0x600a, 0xa184, 0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003,
5983 0x0010, 0x6003, 0x0001, 0x1f04, 0x36f3, 0x00ce, 0x2069, 0xad51,
5984 0x2001, 0xaf9d, 0x6a80, 0xa294, 0x0030, 0xa28e, 0x0000, 0x0170,
5985 0xa28e, 0x0010, 0x0118, 0xa28e, 0x0020, 0x0140, 0x2003, 0xaaaa,
5986 0x080c, 0x2744, 0x2001, 0xaf8e, 0x2102, 0x0008, 0x2102, 0x00c6,
5987 0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c,
5988 0x574f, 0x0128, 0x080c, 0x3e5f, 0x0110, 0x080c, 0x26c0, 0x60c4,
5989 0xa005, 0x01b0, 0x6003, 0x0001, 0x2009, 0x373f, 0x00c0, 0x080c,
5990 0x574f, 0x1158, 0x2011, 0x566e, 0x080c, 0x650d, 0x2001, 0xaf9e,
5991 0x2003, 0x0000, 0x080c, 0x569a, 0x0040, 0x080c, 0x485e, 0x0028,
5992 0x6003, 0x0004, 0x2009, 0x3755, 0x0010, 0x0804, 0x2dcc, 0x2001,
5993 0x0100, 0x2004, 0xa082, 0x0005, 0x0258, 0x2001, 0x0170, 0x2004,
5994 0xa084, 0x00ff, 0xa086, 0x004c, 0x1118, 0x2091, 0x309d, 0x0817,
5995 0x2091, 0x301d, 0x0817, 0x6000, 0xa086, 0x0000, 0x0904, 0x2df1,
5996 0x2069, 0xad51, 0x7830, 0x6842, 0x7834, 0x6846, 0x6804, 0xd0fc,
5997 0x0118, 0x2009, 0x0030, 0x0010, 0x2009, 0x001c, 0x2d00, 0x7a2c,
5998 0x7b28, 0x7c3c, 0x7d38, 0x0804, 0x3c49, 0xa006, 0x080c, 0x26c0,
5999 0x81ff, 0x1904, 0x2df1, 0x080c, 0x574f, 0x1178, 0x2001, 0xaf9e,
6000 0x2003, 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0xa085, 0x0001,
6001 0x080c, 0x5793, 0x080c, 0x569a, 0x0020, 0x080c, 0x491f, 0x080c,
6002 0x485e, 0x0804, 0x2dcc, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x574f,
6003 0x1110, 0x0804, 0x2df1, 0x6184, 0x81ff, 0x0198, 0x703f, 0x0000,
6004 0x2001, 0xb3c0, 0x2009, 0x0040, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38,
6005 0x0126, 0x2091, 0x8000, 0x080c, 0x3c49, 0x701b, 0x2dca, 0x012e,
6006 0x0005, 0x703f, 0x0001, 0x00d6, 0x2069, 0xb3c0, 0x20a9, 0x0040,
6007 0x20a1, 0xb3c0, 0x2019, 0xffff, 0x43a4, 0x654c, 0xa588, 0x2be6,
6008 0x210d, 0xa18c, 0x00ff, 0x216a, 0xa00e, 0x2011, 0x0002, 0x2100,
6009 0xa506, 0x01a8, 0x080c, 0x4cdc, 0x1190, 0x6014, 0x821c, 0x0238,
6010 0xa398, 0xb3c0, 0xa085, 0xff00, 0x8007, 0x201a, 0x0038, 0xa398,
6011 0xb3c0, 0x2324, 0xa4a4, 0xff00, 0xa405, 0x201a, 0x8210, 0x8108,
6012 0xa182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007, 0x2d0c, 0xa105,
6013 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0xb3c0, 0x2099, 0xb3c0,
6014 0x080c, 0x48be, 0x0804, 0x37b0, 0x080c, 0x3c2a, 0x0904, 0x2df4,
6015 0x00c6, 0x080c, 0x3c05, 0x00ce, 0x1120, 0x2009, 0x0002, 0x0804,
6016 0x2df1, 0x2001, 0xad52, 0x2004, 0xd0b4, 0x01f0, 0x6000, 0xd08c,
6017 0x11d8, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x11a8, 0x6837,
6018 0x0000, 0x6838, 0xc0fd, 0x683a, 0x080c, 0x970b, 0x1120, 0x2009,
6019 0x0003, 0x0804, 0x2df1, 0x7007, 0x0003, 0x701b, 0x3830, 0x0005,
6020 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x20a9, 0x002b, 0x2c98, 0xade8,
6021 0x0002, 0x2da0, 0x53a3, 0x20a9, 0x0004, 0xac80, 0x0006, 0x2098,
6022 0xad80, 0x0006, 0x20a0, 0x080c, 0x48be, 0x20a9, 0x0004, 0xac80,
6023 0x000a, 0x2098, 0xad80, 0x000a, 0x20a0, 0x080c, 0x48be, 0x2d00,
6024 0x2009, 0x002b, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0804, 0x3c49,
6025 0x81ff, 0x1904, 0x2df1, 0x080c, 0x3c1a, 0x0904, 0x2df4, 0x080c,
6026 0x4eab, 0x0804, 0x2dcc, 0x81ff, 0x1904, 0x2df1, 0x7828, 0xa08a,
6027 0x1000, 0x1a04, 0x2df4, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x080c,
6028 0x4f0d, 0x0904, 0x2df1, 0x2019, 0x0004, 0x080c, 0x4ebd, 0x7924,
6029 0x810f, 0x7a28, 0x0011, 0x0804, 0x2dcc, 0xa186, 0x00ff, 0x0110,
6030 0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0xad00, 0x644c, 0x2400,
6031 0xa506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c,
6032 0x4cdc, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0xa108, 0x080c,
6033 0x6519, 0x0005, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x3c1a, 0x0904,
6034 0x2df4, 0x080c, 0x4d96, 0x0904, 0x2df1, 0x080c, 0x4eb4, 0x0804,
6035 0x2dcc, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x3c1a, 0x0904, 0x2df4,
6036 0x080c, 0x4d96, 0x0904, 0x2df1, 0x080c, 0x4ea2, 0x0804, 0x2dcc,
6037 0x6100, 0x0804, 0x2dcc, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x2001,
6038 0xad00, 0x2004, 0xa086, 0x0003, 0x1904, 0x2df1, 0x00d6, 0xace8,
6039 0x000a, 0x7924, 0xd184, 0x0110, 0xace8, 0x0006, 0x680c, 0x8007,
6040 0x783e, 0x6808, 0x8007, 0x783a, 0x6b04, 0x831f, 0x6a00, 0x8217,
6041 0x00de, 0x6100, 0xa18c, 0x0200, 0x0804, 0x2dcc, 0x7824, 0xa09c,
6042 0x00ff, 0xa39a, 0x0003, 0x1a04, 0x2df1, 0x624c, 0xa294, 0x00ff,
6043 0xa084, 0xff00, 0x8007, 0xa206, 0x1150, 0x2001, 0xad40, 0x2009,
6044 0x000c, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0804, 0x3c49, 0x81ff,
6045 0x1904, 0x2df1, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x6004, 0xa084,
6046 0x00ff, 0xa086, 0x0006, 0x1904, 0x2df1, 0x00c6, 0x080c, 0x3c05,
6047 0x00ce, 0x0904, 0x2df1, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a,
6048 0x080c, 0x96b7, 0x0904, 0x2df1, 0x7007, 0x0003, 0x701b, 0x3919,
6049 0x0005, 0x6830, 0xa086, 0x0100, 0x0904, 0x2df1, 0xad80, 0x000e,
6050 0x2009, 0x000c, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0804, 0x3c49,
6051 0xa006, 0x080c, 0x26c0, 0x7824, 0xa084, 0x00ff, 0xa086, 0x00ff,
6052 0x0118, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x574f, 0x0110, 0x080c,
6053 0x491f, 0x7828, 0xa08a, 0x1000, 0x1a04, 0x2df4, 0x7924, 0xa18c,
6054 0xff00, 0x810f, 0xa186, 0x00ff, 0x0138, 0xa182, 0x007f, 0x1a04,
6055 0x2df4, 0x2100, 0x080c, 0x268a, 0x0026, 0x00c6, 0x0126, 0x2091,
6056 0x8000, 0x2061, 0xafda, 0x601b, 0x0000, 0x601f, 0x0000, 0x080c,
6057 0x574f, 0x1178, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x2001, 0xad00,
6058 0x2003, 0x0001, 0xa085, 0x0001, 0x080c, 0x5793, 0x080c, 0x569a,
6059 0x00a0, 0x2061, 0x0100, 0x2001, 0xad14, 0x2004, 0xa084, 0x00ff,
6060 0x810f, 0xa105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
6061 0x002d, 0x2011, 0x4883, 0x080c, 0x6593, 0x7924, 0xa18c, 0xff00,
6062 0x810f, 0x080c, 0x574f, 0x1110, 0x2009, 0x00ff, 0x7a28, 0x080c,
6063 0x387d, 0x012e, 0x00ce, 0x002e, 0x0804, 0x2dcc, 0x7924, 0xa18c,
6064 0xff00, 0x810f, 0x00c6, 0x080c, 0x4c80, 0x2c08, 0x00ce, 0x1904,
6065 0x2df4, 0x0804, 0x2dcc, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
6066 0x2df1, 0x60d0, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005,
6067 0x0804, 0x2df1, 0x080c, 0x3c05, 0x1120, 0x2009, 0x0002, 0x0804,
6068 0x2df1, 0x7924, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x080c, 0x3c46,
6069 0x701b, 0x39bb, 0x0005, 0x2009, 0x0080, 0x080c, 0x4cdc, 0x1130,
6070 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x0120, 0x2021, 0x400a,
6071 0x0804, 0x2dce, 0x00d6, 0xade8, 0x000d, 0x6900, 0x6a08, 0x6b0c,
6072 0x6c10, 0x6d14, 0x6e18, 0x6820, 0xa0be, 0x0100, 0x0904, 0x3a32,
6073 0xa0be, 0x0112, 0x0904, 0x3a32, 0xa0be, 0x0113, 0x0904, 0x3a32,
6074 0xa0be, 0x0114, 0x0904, 0x3a32, 0xa0be, 0x0117, 0x0904, 0x3a32,
6075 0xa0be, 0x011a, 0x0904, 0x3a32, 0xa0be, 0x011c, 0x0904, 0x3a32,
6076 0xa0be, 0x0121, 0x05b0, 0xa0be, 0x0131, 0x0598, 0xa0be, 0x0171,
6077 0x05c8, 0xa0be, 0x0173, 0x05b0, 0xa0be, 0x01a1, 0x1120, 0x6830,
6078 0x8007, 0x6832, 0x04a8, 0xa0be, 0x0212, 0x0540, 0xa0be, 0x0213,
6079 0x0528, 0xa0be, 0x0214, 0x01b0, 0xa0be, 0x0217, 0x0168, 0xa0be,
6080 0x021a, 0x1120, 0x6838, 0x8007, 0x683a, 0x00e0, 0xa0be, 0x0300,
6081 0x01c8, 0x00de, 0x0804, 0x2df4, 0xad80, 0x0010, 0x20a9, 0x0007,
6082 0x080c, 0x3a78, 0xad80, 0x000e, 0x20a9, 0x0001, 0x080c, 0x3a78,
6083 0x0048, 0xad80, 0x000c, 0x080c, 0x3a86, 0x0050, 0xad80, 0x000e,
6084 0x080c, 0x3a86, 0xad80, 0x000c, 0x20a9, 0x0001, 0x080c, 0x3a78,
6085 0x00c6, 0x080c, 0x3c05, 0x0568, 0x6838, 0xc0fd, 0x683a, 0x6837,
6086 0x0119, 0x6853, 0x0000, 0x684f, 0x0020, 0x685b, 0x0001, 0x810b,
6087 0x697e, 0x6883, 0x0000, 0x6a86, 0x6b8a, 0x6c8e, 0x6d92, 0x6996,
6088 0x689b, 0x0000, 0x00ce, 0x00de, 0x6837, 0x0000, 0x6838, 0xc0fd,
6089 0x683a, 0x6823, 0x0000, 0x6804, 0x2068, 0x080c, 0x96d3, 0x1120,
6090 0x2009, 0x0003, 0x0804, 0x2df1, 0x7007, 0x0003, 0x701b, 0x3a6f,
6091 0x0005, 0x00ce, 0x00de, 0x2009, 0x0002, 0x0804, 0x2df1, 0x6820,
6092 0xa086, 0x8001, 0x1904, 0x2dcc, 0x2009, 0x0004, 0x0804, 0x2df1,
6093 0x0016, 0x2008, 0x2044, 0x8000, 0x204c, 0x8000, 0x290a, 0x8108,
6094 0x280a, 0x8108, 0x1f04, 0x3a7a, 0x001e, 0x0005, 0x0016, 0x00a6,
6095 0x00b6, 0x2008, 0x2044, 0x8000, 0x204c, 0x8000, 0x2054, 0x8000,
6096 0x205c, 0x2b0a, 0x8108, 0x2a0a, 0x8108, 0x290a, 0x8108, 0x280a,
6097 0x00be, 0x00ae, 0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
6098 0x0804, 0x2df1, 0x7924, 0x2140, 0xa18c, 0xff00, 0x810f, 0x60d0,
6099 0xd0ac, 0x1120, 0xa182, 0x0080, 0x0a04, 0x2df4, 0xa182, 0x00ff,
6100 0x1a04, 0x2df4, 0x7a2c, 0x7b28, 0x606c, 0xa306, 0x1140, 0x6070,
6101 0xa24e, 0x0904, 0x2df4, 0xa9cc, 0xff00, 0x0904, 0x2df4, 0x00c6,
6102 0x080c, 0x3b58, 0x2c68, 0x00ce, 0x0538, 0xa0c6, 0x4000, 0x1180,
6103 0x00c6, 0x0006, 0x2d60, 0x2009, 0x0000, 0x080c, 0x4f6e, 0x1108,
6104 0xc185, 0x6000, 0xd0bc, 0x0108, 0xc18d, 0x000e, 0x00ce, 0x0088,
6105 0xa0c6, 0x4007, 0x1110, 0x2408, 0x0060, 0xa0c6, 0x4008, 0x1118,
6106 0x2708, 0x2610, 0x0030, 0xa0c6, 0x4009, 0x1108, 0x0010, 0x2001,
6107 0x4006, 0x2020, 0x0804, 0x2dce, 0x2d00, 0x7022, 0x0016, 0x00b6,
6108 0x00c6, 0x00e6, 0x2c70, 0x080c, 0x8022, 0x05d8, 0x2d00, 0x601a,
6109 0x080c, 0x9956, 0x2e58, 0x00ee, 0x00e6, 0x00c6, 0x080c, 0x3c05,
6110 0x00ce, 0x2b70, 0x1150, 0x080c, 0x8078, 0x00ee, 0x00ce, 0x00be,
6111 0x001e, 0x2009, 0x0002, 0x0804, 0x2df1, 0x6837, 0x0000, 0x683b,
6112 0x0000, 0x2d00, 0x6012, 0x6833, 0x0000, 0x6838, 0xc0fd, 0xd88c,
6113 0x0108, 0xc0f5, 0x683a, 0x0126, 0x2091, 0x8000, 0x080c, 0x2ad9,
6114 0x012e, 0x601f, 0x0001, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x2001,
6115 0x0002, 0x080c, 0x4c30, 0x2009, 0x0002, 0x080c, 0x80a7, 0xa085,
6116 0x0001, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x1120, 0x2009, 0x0003,
6117 0x0804, 0x2df1, 0x7007, 0x0003, 0x701b, 0x3b3f, 0x0005, 0x6830,
6118 0xa086, 0x0100, 0x7020, 0x2060, 0x1138, 0x2009, 0x0004, 0x6204,
6119 0xa294, 0x00ff, 0x0804, 0x2df1, 0x2009, 0x0000, 0x080c, 0x4f6e,
6120 0x1108, 0xc185, 0x6000, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x2dcc,
6121 0x00e6, 0x00d6, 0x2029, 0x0000, 0x2001, 0xad34, 0x2004, 0xd0ac,
6122 0x0138, 0x2021, 0x0000, 0x20a9, 0x00ff, 0x2071, 0xae34, 0x0030,
6123 0x2021, 0x0080, 0x20a9, 0x007f, 0x2071, 0xaeb4, 0x2e04, 0xa005,
6124 0x1130, 0x2100, 0xa406, 0x1548, 0x2428, 0xc5fd, 0x0430, 0x2068,
6125 0x6f10, 0x2700, 0xa306, 0x11b0, 0x6e14, 0x2600, 0xa206, 0x1190,
6126 0x2400, 0xa106, 0x1160, 0x2d60, 0xd884, 0x0540, 0x6004, 0xa084,
6127 0x00ff, 0xa086, 0x0006, 0x1510, 0x2001, 0x4000, 0x0400, 0x2001,
6128 0x4007, 0x00e8, 0x2400, 0xa106, 0x1140, 0x6e14, 0x87ff, 0x1110,
6129 0x86ff, 0x09d0, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04,
6130 0x3b6e, 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001,
6131 0x0030, 0x080c, 0x4c80, 0x1dd0, 0x6312, 0x6216, 0xa006, 0xa005,
6132 0x00de, 0x00ee, 0x0005, 0x81ff, 0x1904, 0x2df1, 0x080c, 0x3c05,
6133 0x0904, 0x2df1, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x7824,
6134 0xa005, 0x0904, 0x2df4, 0xa096, 0x00ff, 0x0120, 0xa092, 0x0004,
6135 0x1a04, 0x2df4, 0x2010, 0x2d18, 0x080c, 0x2a8c, 0x0904, 0x2df1,
6136 0x7007, 0x0003, 0x701b, 0x3bd5, 0x0005, 0x6830, 0xa086, 0x0100,
6137 0x0904, 0x2df1, 0x0804, 0x2dcc, 0x7924, 0xa18c, 0xff00, 0x810f,
6138 0x60d0, 0xd0ac, 0x1120, 0xa182, 0x0080, 0x0a04, 0x2df4, 0xa182,
6139 0x00ff, 0x1a04, 0x2df4, 0x0126, 0x2091, 0x8000, 0x080c, 0x95c6,
6140 0x1188, 0xa190, 0xae34, 0x2204, 0xa065, 0x0160, 0x080c, 0x493a,
6141 0x2001, 0xad34, 0x2004, 0xd0ac, 0x0110, 0x6017, 0x0000, 0x012e,
6142 0x0804, 0x2dcc, 0x012e, 0x0804, 0x2df1, 0x080c, 0x15d9, 0x0188,
6143 0xa006, 0x6802, 0x7010, 0xa005, 0x1120, 0x2d00, 0x7012, 0x7016,
6144 0x0030, 0x7014, 0x6802, 0x2060, 0x2d00, 0x6006, 0x7016, 0xad80,
6145 0x000d, 0x0005, 0x7924, 0x810f, 0xa18c, 0x00ff, 0x080c, 0x4cdc,
6146 0x1130, 0x7e28, 0xa684, 0x3fff, 0xa082, 0x4000, 0x0208, 0xa066,
6147 0x8cff, 0x0005, 0x7e24, 0x860f, 0xa18c, 0x00ff, 0x080c, 0x4cdc,
6148 0x1128, 0xa6b4, 0x00ff, 0xa682, 0x4000, 0x0208, 0xa066, 0x8cff,
6149 0x0005, 0x0016, 0x7110, 0x81ff, 0x0128, 0x2168, 0x6904, 0x080c,
6150 0x15f0, 0x0cc8, 0x7112, 0x7116, 0x001e, 0x0005, 0x2031, 0x0001,
6151 0x0010, 0x2031, 0x0000, 0x2061, 0xadd1, 0x6606, 0x6112, 0x600e,
6152 0x6226, 0x632a, 0x642e, 0x6532, 0x2c10, 0x080c, 0x1624, 0x7007,
6153 0x0002, 0x701b, 0x2dcc, 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000,
6154 0x2079, 0x0000, 0x2001, 0xad8f, 0x2004, 0xa005, 0x1168, 0x0e04,
6155 0x3c74, 0x7818, 0xd084, 0x1140, 0x7a22, 0x7b26, 0x7c2a, 0x781b,
6156 0x0001, 0x2091, 0x4080, 0x0408, 0x0016, 0x00c6, 0x00e6, 0x2071,
6157 0xad81, 0x7138, 0xa182, 0x0010, 0x0218, 0x7030, 0x2060, 0x0078,
6158 0x7030, 0xa0e0, 0x0004, 0xac82, 0xadd1, 0x0210, 0x2061, 0xad91,
6159 0x2c00, 0x7032, 0x81ff, 0x1108, 0x7036, 0x8108, 0x713a, 0x2262,
6160 0x6306, 0x640a, 0x00ee, 0x00ce, 0x001e, 0x012e, 0x00fe, 0x0005,
6161 0x00e6, 0x2071, 0xad81, 0x7038, 0xa005, 0x0570, 0x0126, 0x2091,
6162 0x8000, 0x0e04, 0x3ccb, 0x00f6, 0x2079, 0x0000, 0x7818, 0xd084,
6163 0x1508, 0x00c6, 0x7034, 0x2060, 0x2c04, 0x7822, 0x6004, 0x7826,
6164 0x6008, 0x782a, 0x781b, 0x0001, 0x2091, 0x4080, 0x7038, 0x8001,
6165 0x703a, 0xa005, 0x1130, 0x7033, 0xad91, 0x7037, 0xad91, 0x00ce,
6166 0x0048, 0xac80, 0x0004, 0xa0fa, 0xadd1, 0x0210, 0x2001, 0xad91,
6167 0x7036, 0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005, 0x0026, 0x2001,
6168 0xad52, 0x2004, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x3c5c,
6169 0x002e, 0x0005, 0x81ff, 0x1904, 0x2df1, 0x0126, 0x2091, 0x8000,
6170 0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x574f, 0x1178,
6171 0x2001, 0xaf9e, 0x2003, 0x0001, 0x2001, 0xad00, 0x2003, 0x0001,
6172 0xa085, 0x0001, 0x080c, 0x5793, 0x080c, 0x569a, 0x0010, 0x080c,
6173 0x485e, 0x012e, 0x0804, 0x2dcc, 0x7824, 0x2008, 0xa18c, 0xfffd,
6174 0x1128, 0x61dc, 0xa10d, 0x61de, 0x0804, 0x2dcc, 0x0804, 0x2df4,
6175 0x81ff, 0x1904, 0x2df1, 0x6000, 0xa086, 0x0003, 0x1904, 0x2df1,
6176 0x2001, 0xad52, 0x2004, 0xd0ac, 0x1904, 0x2df1, 0x080c, 0x3c2a,
6177 0x0904, 0x2df4, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x1120,
6178 0x7828, 0xa005, 0x0904, 0x2dcc, 0x00c6, 0x080c, 0x3c05, 0x00ce,
6179 0x0904, 0x2df1, 0x6837, 0x0000, 0x6833, 0x0000, 0x6838, 0xc0fd,
6180 0x683a, 0x080c, 0x979c, 0x0904, 0x2df1, 0x7007, 0x0003, 0x701b,
6181 0x3d3a, 0x0005, 0x6830, 0xa086, 0x0100, 0x0904, 0x2df1, 0x0804,
6182 0x2dcc, 0x2001, 0xad00, 0x2004, 0xa086, 0x0003, 0x1904, 0x2df1,
6183 0x7f24, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x080c, 0x3c05, 0x0904,
6184 0x2df1, 0x2009, 0x0000, 0x2031, 0x0000, 0x7023, 0x0000, 0x702f,
6185 0x0000, 0xad80, 0x0005, 0x7026, 0x20a0, 0x080c, 0x4cdc, 0x1904,
6186 0x3db4, 0x6004, 0xa0c4, 0x00ff, 0xa8c6, 0x0006, 0x0130, 0xa0c4,
6187 0xff00, 0xa8c6, 0x0600, 0x1904, 0x3db4, 0x2001, 0xad52, 0x2004,
6188 0xd0ac, 0x1128, 0x080c, 0x4f6e, 0x1110, 0xd79c, 0x05e8, 0xd794,
6189 0x1110, 0xd784, 0x0158, 0xac80, 0x0006, 0x2098, 0x3400, 0x20a9,
6190 0x0004, 0x53a3, 0x080c, 0x3a86, 0xd794, 0x0148, 0xac80, 0x000a,
6191 0x2098, 0x3400, 0x20a9, 0x0004, 0x53a3, 0x080c, 0x3a86, 0x21a2,
6192 0xd794, 0x01d8, 0xac80, 0x0000, 0x2098, 0x94a0, 0x20a9, 0x0002,
6193 0x53a3, 0xac80, 0x0003, 0x20a6, 0x94a0, 0xac80, 0x0004, 0x2098,
6194 0x3400, 0x20a9, 0x0002, 0x53a3, 0x080c, 0x3a78, 0xac80, 0x0026,
6195 0x2098, 0x20a9, 0x0002, 0x53a3, 0x0008, 0x94a0, 0xd794, 0x0110,
6196 0xa6b0, 0x000b, 0xa6b0, 0x0005, 0x8108, 0x2001, 0xad34, 0x2004,
6197 0xd0ac, 0x0118, 0xa186, 0x0100, 0x0040, 0xd78c, 0x0120, 0xa186,
6198 0x0100, 0x0170, 0x0018, 0xa186, 0x007e, 0x0150, 0xd794, 0x0118,
6199 0xa686, 0x0020, 0x0010, 0xa686, 0x0028, 0x0150, 0x0804, 0x3d5d,
6200 0x86ff, 0x1120, 0x7120, 0x810b, 0x0804, 0x2dcc, 0x702f, 0x0001,
6201 0x711e, 0x7020, 0xa600, 0x7022, 0x772a, 0x2061, 0xadd1, 0x6007,
6202 0x0000, 0x6612, 0x7024, 0x600e, 0x6226, 0x632a, 0x642e, 0x6532,
6203 0x2c10, 0x080c, 0x1624, 0x7007, 0x0002, 0x701b, 0x3df0, 0x0005,
6204 0x702c, 0xa005, 0x1170, 0x711c, 0x7024, 0x20a0, 0x7728, 0x2031,
6205 0x0000, 0x2061, 0xadd1, 0x6224, 0x6328, 0x642c, 0x6530, 0x0804,
6206 0x3d5d, 0x7120, 0x810b, 0x0804, 0x2dcc, 0x2029, 0x007e, 0x7924,
6207 0x7a28, 0x7b2c, 0x7c38, 0xa184, 0xff00, 0x8007, 0xa0e2, 0x0020,
6208 0x0a04, 0x2df4, 0xa502, 0x0a04, 0x2df4, 0xa184, 0x00ff, 0xa0e2,
6209 0x0020, 0x0a04, 0x2df4, 0xa502, 0x0a04, 0x2df4, 0xa284, 0xff00,
6210 0x8007, 0xa0e2, 0x0020, 0x0a04, 0x2df4, 0xa502, 0x0a04, 0x2df4,
6211 0xa284, 0x00ff, 0xa0e2, 0x0020, 0x0a04, 0x2df4, 0xa502, 0x0a04,
6212 0x2df4, 0xa384, 0xff00, 0x8007, 0xa0e2, 0x0020, 0x0a04, 0x2df4,
6213 0xa502, 0x0a04, 0x2df4, 0xa384, 0x00ff, 0xa0e2, 0x0020, 0x0a04,
6214 0x2df4, 0xa502, 0x0a04, 0x2df4, 0xa484, 0xff00, 0x8007, 0xa0e2,
6215 0x0020, 0x0a04, 0x2df4, 0xa502, 0x0a04, 0x2df4, 0xa484, 0x00ff,
6216 0xa0e2, 0x0020, 0x0a04, 0x2df4, 0xa502, 0x0a04, 0x2df4, 0x2061,
6217 0xafa6, 0x6102, 0x6206, 0x630a, 0x640e, 0x0804, 0x2dcc, 0x0006,
6218 0x2001, 0xad52, 0x2004, 0xd0cc, 0x000e, 0x0005, 0x0006, 0x2001,
6219 0xad71, 0x2004, 0xd0bc, 0x000e, 0x0005, 0x6164, 0x7a24, 0x6300,
6220 0x82ff, 0x1118, 0x7926, 0x0804, 0x2dcc, 0x83ff, 0x1904, 0x2df4,
6221 0x2001, 0xfff0, 0xa200, 0x1a04, 0x2df4, 0x2019, 0xffff, 0x6068,
6222 0xa302, 0xa200, 0x0a04, 0x2df4, 0x7926, 0x6266, 0x0804, 0x2dcc,
6223 0x2001, 0xad00, 0x2004, 0xa086, 0x0003, 0x1904, 0x2df1, 0x7c28,
6224 0x7d24, 0x7e38, 0x7f2c, 0x080c, 0x3c05, 0x0904, 0x2df1, 0x2009,
6225 0x0000, 0x2019, 0x0000, 0x7023, 0x0000, 0x702f, 0x0000, 0xad80,
6226 0x0003, 0x7026, 0x20a0, 0xa1e0, 0xae34, 0x2c64, 0x8cff, 0x01b8,
6227 0x6004, 0xa084, 0x00ff, 0xa086, 0x0006, 0x0130, 0x6004, 0xa084,
6228 0xff00, 0xa086, 0x0600, 0x1158, 0x6014, 0x20a2, 0x94a0, 0x6010,
6229 0x8007, 0xa105, 0x8007, 0x20a2, 0x94a0, 0xa398, 0x0002, 0x8108,
6230 0xa182, 0x00ff, 0x0120, 0xa386, 0x002a, 0x0148, 0x08e0, 0x83ff,
6231 0x1120, 0x7120, 0x810c, 0x0804, 0x2dcc, 0x702f, 0x0001, 0x711e,
6232 0x7020, 0xa300, 0x7022, 0x2061, 0xadd1, 0x6007, 0x0000, 0x6312,
6233 0x7024, 0x600e, 0x6426, 0x652a, 0x662e, 0x6732, 0x2c10, 0x080c,
6234 0x1624, 0x7007, 0x0002, 0x701b, 0x3ee6, 0x0005, 0x702c, 0xa005,
6235 0x1168, 0x711c, 0x7024, 0x20a0, 0x2019, 0x0000, 0x2061, 0xadd1,
6236 0x6424, 0x6528, 0x662c, 0x6730, 0x0804, 0x3ea3, 0x7120, 0x810c,
6237 0x0804, 0x2dcc, 0x81ff, 0x1904, 0x2df1, 0x60d0, 0xd0ac, 0x1118,
6238 0xd09c, 0x0904, 0x2df1, 0x080c, 0x3c05, 0x0904, 0x2df1, 0x7924,
6239 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x080c, 0x3c46, 0x701b, 0x3f11,
6240 0x0005, 0x00d6, 0xade8, 0x000d, 0x6828, 0xa0be, 0x7000, 0x0148,
6241 0xa0be, 0x7100, 0x0130, 0xa0be, 0x7200, 0x0118, 0x00de, 0x0804,
6242 0x2df4, 0x6820, 0x6924, 0x080c, 0x2676, 0x1510, 0x080c, 0x4c80,
6243 0x11f8, 0x7122, 0x6612, 0x6516, 0x6e18, 0x00c6, 0x080c, 0x3c05,
6244 0x01b8, 0x080c, 0x3c05, 0x01a0, 0x00ce, 0x00de, 0x6837, 0x0000,
6245 0x6838, 0xc0fd, 0x683a, 0x6823, 0x0000, 0x6804, 0x2068, 0x080c,
6246 0x96ef, 0x0904, 0x2df1, 0x7007, 0x0003, 0x701b, 0x3f4b, 0x0005,
6247 0x00de, 0x0804, 0x2df1, 0x7120, 0x080c, 0x2bc9, 0x6820, 0xa086,
6248 0x8001, 0x0904, 0x2df1, 0x2d00, 0x701e, 0x6804, 0xa080, 0x0002,
6249 0x0006, 0x20a9, 0x002a, 0x2098, 0x20a0, 0x080c, 0x48be, 0x000e,
6250 0xade8, 0x000d, 0x6a08, 0x6b0c, 0x6c10, 0x6d14, 0x2061, 0xadd1,
6251 0x6007, 0x0000, 0x6e00, 0x6f28, 0xa7c6, 0x7000, 0x1108, 0x0018,
6252 0xa7c6, 0x7100, 0x1140, 0xa6c2, 0x0004, 0x0a04, 0x2df4, 0x2009,
6253 0x0004, 0x0804, 0x3c49, 0xa7c6, 0x7200, 0x1904, 0x2df4, 0xa6c2,
6254 0x0054, 0x0a04, 0x2df4, 0x600e, 0x6013, 0x002a, 0x6226, 0x632a,
6255 0x642e, 0x6532, 0x2c10, 0x080c, 0x1624, 0x7007, 0x0002, 0x701b,
6256 0x3f92, 0x0005, 0x701c, 0x2068, 0x6804, 0xa080, 0x0001, 0x2004,
6257 0xa080, 0x0002, 0x0006, 0x20a9, 0x002a, 0x2098, 0x20a0, 0x080c,
6258 0x48be, 0x000e, 0x2009, 0x002a, 0x2061, 0xadd1, 0x6224, 0x6328,
6259 0x642c, 0x6530, 0x0804, 0x3c49, 0x81ff, 0x1904, 0x2df1, 0x080c,
6260 0x3c1a, 0x0904, 0x2df4, 0x080c, 0x4d96, 0x0904, 0x2df1, 0x080c,
6261 0x4ec6, 0x0804, 0x2dcc, 0x7824, 0xd084, 0x0904, 0x3804, 0x080c,
6262 0x3c2a, 0x0904, 0x2df4, 0x00c6, 0x080c, 0x3c05, 0x00ce, 0x1120,
6263 0x2009, 0x0002, 0x0804, 0x2df1, 0x6004, 0xa084, 0x00ff, 0xa086,
6264 0x0006, 0x0128, 0xa08e, 0x0004, 0x0110, 0xa08e, 0x0005, 0x1508,
6265 0x2001, 0xad52, 0x2004, 0xd0b4, 0x0904, 0x3834, 0x6000, 0xd08c,
6266 0x1904, 0x3834, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x080c,
6267 0x970b, 0x1120, 0x2009, 0x0003, 0x0804, 0x2df1, 0x7007, 0x0003,
6268 0x701b, 0x3ff3, 0x0005, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x0804,
6269 0x3834, 0x2009, 0xad30, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001,
6270 0x0804, 0x2df1, 0x2001, 0xad00, 0x2004, 0xa086, 0x0003, 0x0120,
6271 0x2009, 0x0007, 0x0804, 0x2df1, 0x2001, 0xad52, 0x2004, 0xd0ac,
6272 0x0120, 0x2009, 0x0008, 0x0804, 0x2df1, 0x609c, 0xd0a4, 0x1118,
6273 0xd0ac, 0x1904, 0x3834, 0x6837, 0x0000, 0x6833, 0x0000, 0x6838,
6274 0xc0fd, 0x683a, 0x080c, 0x979c, 0x1120, 0x2009, 0x0003, 0x0804,
6275 0x2df1, 0x7007, 0x0003, 0x701b, 0x402e, 0x0005, 0x6830, 0xa086,
6276 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x2df1, 0x080c, 0x3c2a,
6277 0x0904, 0x2df4, 0x0804, 0x3fd8, 0x81ff, 0x2009, 0x0001, 0x1904,
6278 0x2df1, 0x6000, 0xa086, 0x0003, 0x2009, 0x0007, 0x1904, 0x2df1,
6279 0x2001, 0xad52, 0x2004, 0xd0ac, 0x2009, 0x0008, 0x1904, 0x2df1,
6280 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x6004, 0xa084, 0x00ff, 0xa086,
6281 0x0006, 0x2009, 0x0009, 0x1904, 0x2df1, 0x00c6, 0x080c, 0x3c05,
6282 0x00ce, 0x2009, 0x0002, 0x0904, 0x2df1, 0x6837, 0x0000, 0x6833,
6283 0x0000, 0x6838, 0xc0fd, 0x683a, 0x7928, 0xa194, 0xff00, 0xa18c,
6284 0x00ff, 0xa006, 0x82ff, 0x1128, 0xc0ed, 0x6952, 0x792c, 0x6956,
6285 0x0048, 0xa28e, 0x0100, 0x1904, 0x2df4, 0xc0e5, 0x6853, 0x0000,
6286 0x6857, 0x0000, 0x683e, 0x080c, 0x9957, 0x2009, 0x0003, 0x0904,
6287 0x2df1, 0x7007, 0x0003, 0x701b, 0x408e, 0x0005, 0x6830, 0xa086,
6288 0x0100, 0x2009, 0x0004, 0x0904, 0x2df1, 0x0804, 0x2dcc, 0x81ff,
6289 0x2009, 0x0001, 0x1904, 0x2df1, 0x6000, 0xa086, 0x0003, 0x2009,
6290 0x0007, 0x1904, 0x2df1, 0x080c, 0x3c2a, 0x0904, 0x2df4, 0x6004,
6291 0xa084, 0x00ff, 0xa086, 0x0006, 0x2009, 0x0009, 0x1904, 0x2df1,
6292 0x00c6, 0x080c, 0x3c05, 0x00ce, 0x2009, 0x0002, 0x0904, 0x2df1,
6293 0xad80, 0x000f, 0x2009, 0x0008, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38,
6294 0x080c, 0x3c46, 0x701b, 0x40c5, 0x0005, 0x00d6, 0xade8, 0x000f,
6295 0x6800, 0xa086, 0x0500, 0x1140, 0x6804, 0xa005, 0x1128, 0x6808,
6296 0xa084, 0xff00, 0x1108, 0x0018, 0x00de, 0x1904, 0x2df4, 0x00de,
6297 0x6837, 0x0000, 0x6833, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x00c6,
6298 0x080c, 0x3c2a, 0x1118, 0x00ce, 0x0804, 0x2df4, 0x080c, 0x99a6,
6299 0x2009, 0x0003, 0x00ce, 0x0904, 0x2df1, 0x7007, 0x0003, 0x701b,
6300 0x40f2, 0x0005, 0x6830, 0xa086, 0x0100, 0x2009, 0x0004, 0x0904,
6301 0x2df1, 0x0804, 0x2dcc, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
6302 0x2df1, 0x6000, 0xa086, 0x0003, 0x0120, 0x2009, 0x0007, 0x0804,
6303 0x2df1, 0x7e24, 0x860f, 0xa18c, 0x00ff, 0xa6b4, 0x00ff, 0x080c,
6304 0x4cdc, 0x1904, 0x2df4, 0xa186, 0x007f, 0x0150, 0x6004, 0xa084,
6305 0x00ff, 0xa086, 0x0006, 0x0120, 0x2009, 0x0009, 0x0804, 0x2df1,
6306 0x00c6, 0x080c, 0x3c05, 0x00ce, 0x1120, 0x2009, 0x0002, 0x0804,
6307 0x2df1, 0x6837, 0x0000, 0x6838, 0xc0fd, 0x683a, 0x080c, 0x9726,
6308 0x1120, 0x2009, 0x0003, 0x0804, 0x2df1, 0x7007, 0x0003, 0x701b,
6309 0x413a, 0x0005, 0x6808, 0x8007, 0xa086, 0x0100, 0x1120, 0x2009,
6310 0x0004, 0x0804, 0x2df1, 0x68b0, 0x6836, 0x6810, 0x8007, 0xa084,
6311 0x00ff, 0x808e, 0x6814, 0x8007, 0xa084, 0x00ff, 0x8086, 0xa080,
6312 0x0002, 0xa108, 0xad80, 0x0004, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38,
6313 0x0804, 0x3c49, 0x080c, 0x3c05, 0x1120, 0x2009, 0x0002, 0x0804,
6314 0x2df1, 0x7924, 0xa194, 0xff00, 0xa18c, 0x00ff, 0x8217, 0x82ff,
6315 0x0110, 0x0804, 0x2df4, 0x2009, 0x001a, 0x7a2c, 0x7b28, 0x7c3c,
6316 0x7d38, 0x080c, 0x3c46, 0x701b, 0x4176, 0x0005, 0xad80, 0x000d,
6317 0x2098, 0x20a9, 0x001a, 0x20a1, 0xafad, 0x53a3, 0x0804, 0x2dcc,
6318 0x080c, 0x3c05, 0x1120, 0x2009, 0x0002, 0x0804, 0x2df1, 0x7924,
6319 0xa194, 0xff00, 0xa18c, 0x00ff, 0x8217, 0x82ff, 0x0110, 0x0804,
6320 0x2df4, 0x2099, 0xafad, 0x20a0, 0x20a9, 0x001a, 0x53a3, 0x2009,
6321 0x001a, 0x7a2c, 0x7b28, 0x7c3c, 0x7d38, 0x0804, 0x3c49, 0x7824,
6322 0xa08a, 0x1000, 0x1a04, 0x2df4, 0x0126, 0x2091, 0x8000, 0x8003,
6323 0x800b, 0x810b, 0xa108, 0x00c6, 0x2061, 0xafda, 0x6142, 0x00ce,
6324 0x012e, 0x0804, 0x2dcc, 0x00c6, 0x080c, 0x574f, 0x1188, 0x2001,
6325 0xaf9e, 0x2003, 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0xa085,
6326 0x0001, 0x080c, 0x5793, 0x080c, 0x569a, 0x080c, 0x14f6, 0x0038,
6327 0x2061, 0xad00, 0x6030, 0xc09d, 0x6032, 0x080c, 0x485e, 0x00ce,
6328 0x0005, 0x0126, 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0xad00,
6329 0x6044, 0xd0a4, 0x11b0, 0xd084, 0x0118, 0x080c, 0x4348, 0x0068,
6330 0xd08c, 0x0118, 0x080c, 0x4269, 0x0040, 0xd094, 0x0118, 0x080c,
6331 0x423a, 0x0018, 0xd09c, 0x0108, 0x0061, 0x00ee, 0x00ce, 0x012e,
6332 0x0005, 0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e,
6333 0x0ca0, 0x624c, 0xa286, 0xf0f0, 0x1150, 0x6048, 0xa086, 0xf0f0,
6334 0x0130, 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0xa294,
6335 0xff00, 0xa296, 0xf700, 0x0178, 0x7134, 0xd1a4, 0x1160, 0x6240,
6336 0xa295, 0x0100, 0x6242, 0xa294, 0x0010, 0x0128, 0x2009, 0x00f7,
6337 0x080c, 0x48de, 0x00f0, 0x6040, 0xa084, 0x0010, 0xa085, 0x0040,
6338 0x6042, 0x6043, 0x0000, 0x7077, 0x0000, 0x7093, 0x0001, 0x70b7,
6339 0x0000, 0x70d3, 0x0000, 0x2009, 0xb3c0, 0x200b, 0x0000, 0x7087,
6340 0x0000, 0x707b, 0x000a, 0x2009, 0x000a, 0x2011, 0x4814, 0x080c,
6341 0x6593, 0x0005, 0x0156, 0x2001, 0xad73, 0x2004, 0xd08c, 0x0110,
6342 0x704f, 0xffff, 0x7078, 0xa005, 0x1510, 0x2011, 0x4814, 0x080c,
6343 0x650d, 0x6040, 0xa094, 0x0010, 0xa285, 0x0020, 0x6042, 0x20a9,
6344 0x00c8, 0x6044, 0xd08c, 0x1168, 0x1f04, 0x4251, 0x6242, 0x708b,
6345 0x0000, 0x6040, 0xa094, 0x0010, 0xa285, 0x0080, 0x6042, 0x6242,
6346 0x0030, 0x6242, 0x708b, 0x0000, 0x707f, 0x0000, 0x0000, 0x015e,
6347 0x0005, 0x707c, 0xa08a, 0x0003, 0x1210, 0x0023, 0x0010, 0x080c,
6348 0x14f6, 0x0005, 0x4275, 0x42c5, 0x4347, 0x00f6, 0x707f, 0x0001,
6349 0x20e1, 0xa000, 0xe000, 0x20e1, 0x8700, 0x080c, 0x22f8, 0x20e1,
6350 0x9080, 0x20e1, 0x4000, 0x2079, 0xb200, 0x207b, 0x2200, 0x7807,
6351 0x00ef, 0x780b, 0x0000, 0x780f, 0x00ef, 0x7813, 0x0138, 0x7817,
6352 0x0000, 0x781b, 0x0000, 0x781f, 0x0000, 0x7823, 0xffff, 0x7827,
6353 0xffff, 0x782b, 0x0000, 0x782f, 0x0000, 0x2079, 0xb20c, 0x207b,
6354 0x1101, 0x7807, 0x0000, 0x2099, 0xad05, 0x20a1, 0xb20e, 0x20a9,
6355 0x0004, 0x53a3, 0x2079, 0xb212, 0x207b, 0x0000, 0x7807, 0x0000,
6356 0x2099, 0xb200, 0x20a1, 0x020b, 0x20a9, 0x0014, 0x53a6, 0x60c3,
6357 0x000c, 0x600f, 0x0000, 0x080c, 0x4845, 0x00fe, 0x7083, 0x0000,
6358 0x6043, 0x0008, 0x6043, 0x0000, 0x0005, 0x00d6, 0x7080, 0x7083,
6359 0x0000, 0xa025, 0x0904, 0x432f, 0x6020, 0xd0b4, 0x1904, 0x432d,
6360 0x7190, 0x81ff, 0x0904, 0x431d, 0xa486, 0x000c, 0x1904, 0x4328,
6361 0xa480, 0x0018, 0x8004, 0x20a8, 0x2011, 0xb280, 0x2019, 0xb200,
6362 0x220c, 0x2304, 0xa106, 0x11b8, 0x8210, 0x8318, 0x1f04, 0x42e0,
6363 0x6043, 0x0004, 0x608b, 0xbc94, 0x608f, 0xf0f0, 0x6043, 0x0006,
6364 0x707f, 0x0002, 0x708b, 0x0002, 0x2009, 0x07d0, 0x2011, 0x481b,
6365 0x080c, 0x6593, 0x0490, 0x2069, 0xb280, 0x6930, 0xa18e, 0x1101,
6366 0x1538, 0x6834, 0xa005, 0x1520, 0x6900, 0xa18c, 0x00ff, 0x1118,
6367 0x6804, 0xa005, 0x0190, 0x2011, 0xb28e, 0x2019, 0xad05, 0x20a9,
6368 0x0004, 0x220c, 0x2304, 0xa102, 0x0230, 0x1190, 0x8210, 0x8318,
6369 0x1f04, 0x4311, 0x0068, 0x7093, 0x0000, 0x20e1, 0x9080, 0x20e1,
6370 0x4000, 0x2099, 0xb280, 0x20a1, 0x020b, 0x20a9, 0x0014, 0x53a6,
6371 0x6043, 0x0008, 0x6043, 0x0000, 0x0010, 0x00de, 0x0005, 0x6040,
6372 0xa085, 0x0100, 0x6042, 0x6020, 0xd0b4, 0x1db8, 0x60c3, 0x000c,
6373 0x2011, 0xafd1, 0x2013, 0x0000, 0x7083, 0x0000, 0x20e1, 0x9080,
6374 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x782b, 0x0c30, 0x0005,
6375 0x7088, 0xa08a, 0x001d, 0x1210, 0x0023, 0x0010, 0x080c, 0x14f6,
6376 0x0005, 0x437b, 0x438a, 0x43b2, 0x43cb, 0x43ef, 0x4417, 0x443b,
6377 0x446c, 0x4490, 0x44b8, 0x44ef, 0x4517, 0x4533, 0x4549, 0x4569,
6378 0x457c, 0x4584, 0x45b1, 0x45d5, 0x45fd, 0x4621, 0x4652, 0x468f,
6379 0x46be, 0x46da, 0x4719, 0x4739, 0x4752, 0x4753, 0x00c6, 0x2061,
6380 0xad00, 0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0xa084, 0xfff9,
6381 0x6006, 0x00ce, 0x0005, 0x608b, 0xbc94, 0x608f, 0xf0f0, 0x6043,
6382 0x0002, 0x708b, 0x0001, 0x2009, 0x07d0, 0x2011, 0x481b, 0x080c,
6383 0x6593, 0x0005, 0x00f6, 0x7080, 0xa086, 0x0014, 0x1508, 0x6043,
6384 0x0000, 0x6020, 0xd0b4, 0x11e0, 0x2079, 0xb280, 0x7a30, 0xa296,
6385 0x1102, 0x11a0, 0x7834, 0xa005, 0x1188, 0x7a38, 0xd2fc, 0x0128,
6386 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001, 0x2011, 0x481b, 0x080c,
6387 0x650d, 0x708b, 0x0010, 0x080c, 0x4584, 0x0010, 0x080c, 0x485e,
6388 0x00fe, 0x0005, 0x708b, 0x0003, 0x6043, 0x0004, 0x2011, 0x481b,
6389 0x080c, 0x650d, 0x080c, 0x48c6, 0x20a3, 0x1102, 0x20a3, 0x0000,
6390 0x20a9, 0x000a, 0x20a3, 0x0000, 0x1f04, 0x43c2, 0x60c3, 0x0014,
6391 0x080c, 0x4845, 0x0005, 0x00f6, 0x7080, 0xa005, 0x01f0, 0x2011,
6392 0x481b, 0x080c, 0x650d, 0xa086, 0x0014, 0x11a8, 0x2079, 0xb280,
6393 0x7a30, 0xa296, 0x1102, 0x1178, 0x7834, 0xa005, 0x1160, 0x7a38,
6394 0xd2fc, 0x0128, 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001, 0x708b,
6395 0x0004, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe, 0x0005, 0x708b,
6396 0x0005, 0x080c, 0x48c6, 0x20a3, 0x1103, 0x20a3, 0x0000, 0x3430,
6397 0x2011, 0xb28e, 0x080c, 0x4917, 0x1160, 0x7074, 0xa005, 0x1148,
6398 0x714c, 0xa186, 0xffff, 0x0128, 0x080c, 0x47df, 0x0110, 0x080c,
6399 0x48f5, 0x20a9, 0x0008, 0x2298, 0x26a0, 0x53a6, 0x20a3, 0x0000,
6400 0x20a3, 0x0000, 0x60c3, 0x0014, 0x080c, 0x4845, 0x0005, 0x00f6,
6401 0x7080, 0xa005, 0x01f0, 0x2011, 0x481b, 0x080c, 0x650d, 0xa086,
6402 0x0014, 0x11a8, 0x2079, 0xb280, 0x7a30, 0xa296, 0x1103, 0x1178,
6403 0x7834, 0xa005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70b4, 0xa005,
6404 0x1110, 0x70b7, 0x0001, 0x708b, 0x0006, 0x0029, 0x0010, 0x080c,
6405 0x485e, 0x00fe, 0x0005, 0x708b, 0x0007, 0x080c, 0x48c6, 0x20a3,
6406 0x1104, 0x20a3, 0x0000, 0x3430, 0x2011, 0xb28e, 0x080c, 0x4917,
6407 0x11a8, 0x7074, 0xa005, 0x1190, 0x7154, 0xa186, 0xffff, 0x0170,
6408 0xa180, 0x2be6, 0x200d, 0xa18c, 0xff00, 0x810f, 0x080c, 0x47df,
6409 0x0128, 0x080c, 0x3e66, 0x0110, 0x080c, 0x26c0, 0x20a9, 0x0008,
6410 0x2298, 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3,
6411 0x0014, 0x080c, 0x4845, 0x0005, 0x00f6, 0x7080, 0xa005, 0x01f0,
6412 0x2011, 0x481b, 0x080c, 0x650d, 0xa086, 0x0014, 0x11a8, 0x2079,
6413 0xb280, 0x7a30, 0xa296, 0x1104, 0x1178, 0x7834, 0xa005, 0x1160,
6414 0x7a38, 0xd2fc, 0x0128, 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001,
6415 0x708b, 0x0008, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe, 0x0005,
6416 0x708b, 0x0009, 0x080c, 0x48c6, 0x20a3, 0x1105, 0x20a3, 0x0100,
6417 0x3430, 0x080c, 0x4917, 0x1150, 0x7074, 0xa005, 0x1138, 0x080c,
6418 0x4754, 0x1170, 0xa085, 0x0001, 0x080c, 0x26c0, 0x20a9, 0x0008,
6419 0x2099, 0xb28e, 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000,
6420 0x60c3, 0x0014, 0x080c, 0x4845, 0x0010, 0x080c, 0x436e, 0x0005,
6421 0x00f6, 0x7080, 0xa005, 0x0588, 0x2011, 0x481b, 0x080c, 0x650d,
6422 0xa086, 0x0014, 0x1540, 0x2079, 0xb280, 0x7a30, 0xa296, 0x1105,
6423 0x1510, 0x7834, 0x2011, 0x0100, 0xa21e, 0x1160, 0x7a38, 0xd2fc,
6424 0x0128, 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001, 0x708b, 0x000a,
6425 0x00b1, 0x0098, 0xa005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70b4,
6426 0xa005, 0x1110, 0x70b7, 0x0001, 0x7087, 0x0000, 0x708b, 0x000e,
6427 0x080c, 0x4569, 0x0010, 0x080c, 0x485e, 0x00fe, 0x0005, 0x708b,
6428 0x000b, 0x2011, 0xb20e, 0x22a0, 0x20a9, 0x0040, 0x2019, 0xffff,
6429 0x43a4, 0x20a9, 0x0002, 0x2009, 0x0000, 0x41a4, 0x080c, 0x48c6,
6430 0x20a3, 0x1106, 0x20a3, 0x0000, 0x080c, 0x4917, 0x0118, 0x2013,
6431 0x0000, 0x0020, 0x7050, 0xa085, 0x0100, 0x2012, 0x2298, 0x20a9,
6432 0x0042, 0x53a6, 0x60c3, 0x0084, 0x080c, 0x4845, 0x0005, 0x00f6,
6433 0x7080, 0xa005, 0x01b0, 0x2011, 0x481b, 0x080c, 0x650d, 0xa086,
6434 0x0084, 0x1168, 0x2079, 0xb280, 0x7a30, 0xa296, 0x1106, 0x1138,
6435 0x7834, 0xa005, 0x1120, 0x708b, 0x000c, 0x0029, 0x0010, 0x080c,
6436 0x485e, 0x00fe, 0x0005, 0x708b, 0x000d, 0x080c, 0x48c6, 0x20a3,
6437 0x1107, 0x20a3, 0x0000, 0x2099, 0xb28e, 0x20a9, 0x0040, 0x53a6,
6438 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0084, 0x080c, 0x4845,
6439 0x0005, 0x00f6, 0x7080, 0xa005, 0x01d0, 0x2011, 0x481b, 0x080c,
6440 0x650d, 0xa086, 0x0084, 0x1188, 0x2079, 0xb280, 0x7a30, 0xa296,
6441 0x1107, 0x1158, 0x7834, 0xa005, 0x1140, 0x7087, 0x0001, 0x080c,
6442 0x48b8, 0x708b, 0x000e, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe,
6443 0x0005, 0x708b, 0x000f, 0x7083, 0x0000, 0x608b, 0xbc85, 0x608f,
6444 0xb5b5, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0, 0x2011,
6445 0x481b, 0x080c, 0x6501, 0x0005, 0x7080, 0xa005, 0x0120, 0x2011,
6446 0x481b, 0x080c, 0x650d, 0x0005, 0x708b, 0x0011, 0x080c, 0x4917,
6447 0x1188, 0x716c, 0x81ff, 0x0170, 0x2009, 0x0000, 0x7070, 0xa084,
6448 0x00ff, 0x080c, 0x2676, 0xa186, 0x0080, 0x0120, 0x2011, 0xb28e,
6449 0x080c, 0x47df, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099, 0xb280,
6450 0x20a1, 0x020b, 0x7480, 0xa480, 0x0018, 0xa080, 0x0007, 0xa084,
6451 0x03f8, 0x8004, 0x20a8, 0x53a6, 0x60c3, 0x0014, 0x080c, 0x4845,
6452 0x0005, 0x00f6, 0x7080, 0xa005, 0x01f0, 0x2011, 0x481b, 0x080c,
6453 0x650d, 0xa086, 0x0014, 0x11a8, 0x2079, 0xb280, 0x7a30, 0xa296,
6454 0x1103, 0x1178, 0x7834, 0xa005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
6455 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001, 0x708b, 0x0012, 0x0029,
6456 0x0010, 0x080c, 0x485e, 0x00fe, 0x0005, 0x708b, 0x0013, 0x080c,
6457 0x48d2, 0x20a3, 0x1103, 0x20a3, 0x0000, 0x3430, 0x2011, 0xb28e,
6458 0x080c, 0x4917, 0x1160, 0x7074, 0xa005, 0x1148, 0x714c, 0xa186,
6459 0xffff, 0x0128, 0x080c, 0x47df, 0x0110, 0x080c, 0x48f5, 0x20a9,
6460 0x0008, 0x2298, 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000,
6461 0x60c3, 0x0014, 0x080c, 0x4845, 0x0005, 0x00f6, 0x7080, 0xa005,
6462 0x01f0, 0x2011, 0x481b, 0x080c, 0x650d, 0xa086, 0x0014, 0x11a8,
6463 0x2079, 0xb280, 0x7a30, 0xa296, 0x1104, 0x1178, 0x7834, 0xa005,
6464 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70b4, 0xa005, 0x1110, 0x70b7,
6465 0x0001, 0x708b, 0x0014, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe,
6466 0x0005, 0x708b, 0x0015, 0x080c, 0x48d2, 0x20a3, 0x1104, 0x20a3,
6467 0x0000, 0x3430, 0x2011, 0xb28e, 0x080c, 0x4917, 0x11a8, 0x7074,
6468 0xa005, 0x1190, 0x7154, 0xa186, 0xffff, 0x0170, 0xa180, 0x2be6,
6469 0x200d, 0xa18c, 0xff00, 0x810f, 0x080c, 0x47df, 0x0128, 0x080c,
6470 0x3e66, 0x0110, 0x080c, 0x26c0, 0x20a9, 0x0008, 0x2298, 0x26a0,
6471 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x080c,
6472 0x4845, 0x0005, 0x00f6, 0x7080, 0xa005, 0x05b8, 0x2011, 0x481b,
6473 0x080c, 0x650d, 0xa086, 0x0014, 0x1570, 0x2079, 0xb280, 0x7a30,
6474 0xa296, 0x1105, 0x1540, 0x7834, 0x2011, 0x0100, 0xa21e, 0x1148,
6475 0x7a38, 0xd2fc, 0x0128, 0x70b4, 0xa005, 0x1110, 0x70b7, 0x0001,
6476 0x0060, 0xa005, 0x11c0, 0x7a38, 0xd2fc, 0x0128, 0x70b4, 0xa005,
6477 0x1110, 0x70b7, 0x0001, 0x7087, 0x0000, 0x7a38, 0xd2f4, 0x0138,
6478 0x2001, 0xad73, 0x2004, 0xd0a4, 0x1110, 0x70d3, 0x0008, 0x708b,
6479 0x0016, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe, 0x0005, 0x20e1,
6480 0x9080, 0x20e1, 0x4000, 0x2099, 0xb280, 0x20a1, 0x020b, 0x20a9,
6481 0x000e, 0x53a6, 0x3430, 0x2011, 0xb28e, 0x708b, 0x0017, 0x080c,
6482 0x4917, 0x1150, 0x7074, 0xa005, 0x1138, 0x080c, 0x4754, 0x1170,
6483 0xa085, 0x0001, 0x080c, 0x26c0, 0x20a9, 0x0008, 0x2099, 0xb28e,
6484 0x26a0, 0x53a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014,
6485 0x080c, 0x4845, 0x0010, 0x080c, 0x436e, 0x0005, 0x00f6, 0x7080,
6486 0xa005, 0x01b0, 0x2011, 0x481b, 0x080c, 0x650d, 0xa086, 0x0084,
6487 0x1168, 0x2079, 0xb280, 0x7a30, 0xa296, 0x1106, 0x1138, 0x7834,
6488 0xa005, 0x1120, 0x708b, 0x0018, 0x0029, 0x0010, 0x080c, 0x485e,
6489 0x00fe, 0x0005, 0x708b, 0x0019, 0x080c, 0x48d2, 0x20a3, 0x1106,
6490 0x20a3, 0x0000, 0x3430, 0x2099, 0xb28e, 0x2039, 0xb20e, 0x27a0,
6491 0x20a9, 0x0040, 0x53a3, 0x080c, 0x4917, 0x11e8, 0x2728, 0x2514,
6492 0x8207, 0xa084, 0x00ff, 0x8000, 0x2018, 0xa294, 0x00ff, 0x8007,
6493 0xa205, 0x202a, 0x7050, 0x2310, 0x8214, 0xa2a0, 0xb20e, 0x2414,
6494 0xa38c, 0x0001, 0x0118, 0xa294, 0xff00, 0x0018, 0xa294, 0x00ff,
6495 0x8007, 0xa215, 0x2222, 0x2798, 0x26a0, 0x20a9, 0x0040, 0x53a6,
6496 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0084, 0x080c, 0x4845,
6497 0x0005, 0x00f6, 0x7080, 0xa005, 0x01d0, 0x2011, 0x481b, 0x080c,
6498 0x650d, 0xa086, 0x0084, 0x1188, 0x2079, 0xb280, 0x7a30, 0xa296,
6499 0x1107, 0x1158, 0x7834, 0xa005, 0x1140, 0x7087, 0x0001, 0x080c,
6500 0x48b8, 0x708b, 0x001a, 0x0029, 0x0010, 0x080c, 0x485e, 0x00fe,
6501 0x0005, 0x708b, 0x001b, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099,
6502 0xb280, 0x20a1, 0x020b, 0x7480, 0xa480, 0x0018, 0xa080, 0x0007,
6503 0xa084, 0x03f8, 0x8004, 0x20a8, 0x53a6, 0x60c3, 0x0084, 0x080c,
6504 0x4845, 0x0005, 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0xad52,
6505 0x252c, 0x20a9, 0x0008, 0x2041, 0xb20e, 0x28a0, 0x2099, 0xb28e,
6506 0x53a3, 0x20a9, 0x0008, 0x2011, 0x0007, 0xd5d4, 0x0110, 0x2011,
6507 0x0000, 0x2800, 0xa200, 0x200c, 0xa1a6, 0xffff, 0x1148, 0xd5d4,
6508 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04, 0x4769, 0x0804, 0x47d7,
6509 0x82ff, 0x1160, 0xd5d4, 0x0120, 0xa1a6, 0x3fff, 0x0d90, 0x0020,
6510 0xa1a6, 0x3fff, 0x0904, 0x47d7, 0xa18d, 0xc000, 0x20a9, 0x0010,
6511 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010, 0x2120, 0xd5d4,
6512 0x0110, 0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4, 0x0110, 0x8319,
6513 0x0008, 0x8318, 0x1f04, 0x478f, 0x04d0, 0x23a8, 0x2021, 0x0001,
6514 0x8426, 0x8425, 0x1f04, 0x47a1, 0x2328, 0x8529, 0xa2be, 0x0007,
6515 0x0158, 0x0006, 0x2039, 0x0007, 0x2200, 0xa73a, 0x000e, 0x27a8,
6516 0xa5a8, 0x0010, 0x1f04, 0x47b0, 0x754e, 0xa5c8, 0x2be6, 0x292d,
6517 0xa5ac, 0x00ff, 0x7572, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c,
6518 0x26a0, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018, 0x2304, 0xa405,
6519 0x201a, 0x7077, 0x0001, 0x26a0, 0x2898, 0x20a9, 0x0008, 0x53a6,
6520 0x20a3, 0x0000, 0x20a3, 0x0000, 0xa085, 0x0001, 0x0028, 0xa006,
6521 0x0018, 0xa006, 0x080c, 0x14f6, 0x009e, 0x008e, 0x0005, 0x2118,
6522 0x2021, 0x0000, 0x2001, 0x0007, 0xa39a, 0x0010, 0x0218, 0x8420,
6523 0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120, 0xa39a, 0x0010, 0x8421,
6524 0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8,
6525 0xa238, 0x2704, 0xa42c, 0x11b8, 0xa405, 0x203a, 0x714e, 0xa1a0,
6526 0x2be6, 0x242d, 0xa5ac, 0x00ff, 0x7572, 0x6532, 0x6536, 0x0016,
6527 0x2508, 0x080c, 0x26a0, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7077,
6528 0x0001, 0xa084, 0x0000, 0x0005, 0x00e6, 0x2071, 0xad00, 0x707b,
6529 0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071,
6530 0x0140, 0x080c, 0x7834, 0x7004, 0xa084, 0x4000, 0x0120, 0x7003,
6531 0x1000, 0x7003, 0x0000, 0x0126, 0x2091, 0x8000, 0x2071, 0xad22,
6532 0x2073, 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c,
6533 0x48de, 0x001e, 0xa094, 0x0010, 0xa285, 0x0080, 0x7842, 0x7a42,
6534 0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
6535 0x2011, 0xafd1, 0x2013, 0x0000, 0x7083, 0x0000, 0x012e, 0x20e1,
6536 0x9080, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x782b, 0x2009,
6537 0x07d0, 0x2011, 0x481b, 0x080c, 0x6593, 0x0005, 0x0016, 0x0026,
6538 0x00c6, 0x0126, 0x2091, 0x8000, 0x2009, 0x00f7, 0x080c, 0x48de,
6539 0x2061, 0xafda, 0x601b, 0x0000, 0x601f, 0x0000, 0x2061, 0xad00,
6540 0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010,
6541 0x2009, 0x002d, 0x2011, 0x4883, 0x080c, 0x6501, 0x012e, 0x00ce,
6542 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000,
6543 0x2071, 0x0100, 0x080c, 0x7834, 0x2071, 0x0140, 0x7004, 0xa084,
6544 0x4000, 0x0120, 0x7003, 0x1000, 0x7003, 0x0000, 0x080c, 0x5757,
6545 0x01a8, 0x080c, 0x5775, 0x1190, 0x2001, 0xaf9d, 0x2003, 0xaaaa,
6546 0x0016, 0x080c, 0x2744, 0x2001, 0xaf8e, 0x2102, 0x001e, 0x2001,
6547 0xaf9e, 0x2003, 0x0000, 0x080c, 0x569a, 0x0030, 0x2001, 0x0001,
6548 0x080c, 0x261e, 0x080c, 0x485e, 0x012e, 0x000e, 0x00ee, 0x0005,
6549 0x20a9, 0x0040, 0x20a1, 0xb3c0, 0x2099, 0xb28e, 0x3304, 0x8007,
6550 0x20a2, 0x9398, 0x94a0, 0x1f04, 0x48be, 0x0005, 0x20e1, 0x9080,
6551 0x20e1, 0x4000, 0x2099, 0xb200, 0x20a1, 0x020b, 0x20a9, 0x000c,
6552 0x53a6, 0x0005, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x2099, 0xb280,
6553 0x20a1, 0x020b, 0x20a9, 0x000c, 0x53a6, 0x0005, 0x00c6, 0x0006,
6554 0x2061, 0x0100, 0x810f, 0x2001, 0xad30, 0x2004, 0xa005, 0x1138,
6555 0x2001, 0xad14, 0x2004, 0xa084, 0x00ff, 0xa105, 0x0010, 0xa185,
6556 0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x2001,
6557 0xad52, 0x2004, 0xd0a4, 0x0158, 0xa006, 0x2020, 0x2009, 0x002a,
6558 0x080c, 0xa96c, 0x2001, 0xad0c, 0x200c, 0xc195, 0x2102, 0x2019,
6559 0x002a, 0x2009, 0x0000, 0x080c, 0x2aac, 0x004e, 0x001e, 0x0005,
6560 0x080c, 0x485e, 0x708b, 0x0000, 0x7083, 0x0000, 0x0005, 0x0006,
6561 0x2001, 0xad0c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006,
6562 0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0xa18d,
6563 0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x0156, 0x20a9,
6564 0x00ff, 0x2009, 0xae34, 0xa006, 0x200a, 0x8108, 0x1f04, 0x4934,
6565 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146, 0x2069,
6566 0xad51, 0xa006, 0x6002, 0x6007, 0x0707, 0x600a, 0x600e, 0x6012,
6567 0xa198, 0x2be6, 0x231d, 0xa39c, 0x00ff, 0x6316, 0x20a9, 0x0004,
6568 0xac98, 0x0006, 0x23a0, 0x40a4, 0x20a9, 0x0004, 0xac98, 0x000a,
6569 0x23a0, 0x40a4, 0x603e, 0x6042, 0x604e, 0x6052, 0x6056, 0x605a,
6570 0x605e, 0x6062, 0x6066, 0x606a, 0x606e, 0x6072, 0x6076, 0x607a,
6571 0x607e, 0x6082, 0x6086, 0x608a, 0x608e, 0x6092, 0x6096, 0x609a,
6572 0x609e, 0x60ae, 0x61a2, 0x00d6, 0x60a4, 0xa06d, 0x0110, 0x080c,
6573 0x15f0, 0x60a7, 0x0000, 0x60a8, 0xa06d, 0x0110, 0x080c, 0x15f0,
6574 0x60ab, 0x0000, 0x00de, 0xa006, 0x604a, 0x6810, 0x603a, 0x680c,
6575 0x6046, 0x6814, 0xa084, 0x00ff, 0x6042, 0x014e, 0x013e, 0x015e,
6576 0x003e, 0x00de, 0x0005, 0x0126, 0x2091, 0x8000, 0x6944, 0x6e48,
6577 0xa684, 0x3fff, 0xa082, 0x4000, 0x1a04, 0x4a49, 0xa18c, 0xff00,
6578 0x810f, 0xa182, 0x00ff, 0x1a04, 0x4a4e, 0x2001, 0xad0c, 0x2004,
6579 0xa084, 0x0003, 0x01c0, 0x2001, 0xad0c, 0x2004, 0xd084, 0x1904,
6580 0x4a31, 0xa188, 0xae34, 0x2104, 0xa065, 0x0904, 0x4a31, 0x6004,
6581 0xa084, 0x00ff, 0xa08e, 0x0006, 0x1904, 0x4a31, 0x6000, 0xd0c4,
6582 0x0904, 0x4a31, 0x0068, 0xa188, 0xae34, 0x2104, 0xa065, 0x0904,
6583 0x4a15, 0x6004, 0xa084, 0x00ff, 0xa08e, 0x0006, 0x1904, 0x4a1a,
6584 0x60a4, 0xa00d, 0x0118, 0x080c, 0x4ef9, 0x05d0, 0x60a8, 0xa00d,
6585 0x0188, 0x080c, 0x4f43, 0x1170, 0x694c, 0xd1fc, 0x1118, 0x080c,
6586 0x4c11, 0x0448, 0x080c, 0x4bd3, 0x694c, 0xd1ec, 0x1520, 0x080c,
6587 0x4ded, 0x0408, 0x694c, 0xa184, 0xa000, 0x0178, 0xd1ec, 0x0140,
6588 0xd1fc, 0x0118, 0x080c, 0x4dfc, 0x0028, 0x080c, 0x4dfc, 0x0028,
6589 0xd1fc, 0x0118, 0x080c, 0x4bd3, 0x0070, 0x6050, 0xa00d, 0x0130,
6590 0x2d00, 0x200a, 0x6803, 0x0000, 0x6052, 0x0028, 0x2d00, 0x6052,
6591 0x604e, 0x6803, 0x0000, 0x080c, 0x67c5, 0xa006, 0x012e, 0x0005,
6592 0x2001, 0x0005, 0x2009, 0x0000, 0x04e8, 0x2001, 0x0028, 0x2009,
6593 0x0000, 0x04c0, 0xa082, 0x0006, 0x12a0, 0x2001, 0xad34, 0x2004,
6594 0xd0ac, 0x1160, 0x60a0, 0xd0bc, 0x1148, 0x6100, 0xd1fc, 0x0904,
6595 0x49d0, 0x2001, 0x0029, 0x2009, 0x1000, 0x0420, 0x2001, 0x0028,
6596 0x00a8, 0x2009, 0xad0c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
6597 0x0068, 0xd184, 0x0118, 0x2001, 0x0004, 0x0040, 0x2001, 0x0029,
6598 0x6100, 0xd1fc, 0x0118, 0x2009, 0x1000, 0x0060, 0x2009, 0x0000,
6599 0x0048, 0x2001, 0x0029, 0x2009, 0x0000, 0x0020, 0x2001, 0x0029,
6600 0x2009, 0x0000, 0xa005, 0x012e, 0x0005, 0x00e6, 0x0126, 0x2091,
6601 0x8000, 0x6844, 0x8007, 0xa084, 0x00ff, 0x2008, 0xa182, 0x00ff,
6602 0x1a04, 0x4aa8, 0xa188, 0xae34, 0x2104, 0xa065, 0x01c0, 0x6004,
6603 0xa084, 0x00ff, 0xa08e, 0x0006, 0x11a8, 0x2c70, 0x080c, 0x8022,
6604 0x05e8, 0x2e00, 0x601a, 0x2d00, 0x6012, 0x600b, 0xffff, 0x601f,
6605 0x000a, 0x2009, 0x0003, 0x080c, 0x80a7, 0xa006, 0x0460, 0x2001,
6606 0x0028, 0x0440, 0xa082, 0x0006, 0x1298, 0x2001, 0xad34, 0x2004,
6607 0xd0ac, 0x1158, 0x60a0, 0xd0bc, 0x1140, 0x6100, 0xd1fc, 0x09e8,
6608 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090,
6609 0x2009, 0xad0c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050,
6610 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010,
6611 0x2001, 0x0029, 0xa005, 0x012e, 0x00ee, 0x0005, 0x2001, 0x002c,
6612 0x0cc8, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2011, 0x0000,
6613 0x2079, 0xad00, 0x6944, 0xa18c, 0xff00, 0x810f, 0xa182, 0x00ff,
6614 0x1a04, 0x4b77, 0x2001, 0xad0c, 0x2004, 0xa084, 0x0003, 0x1904,
6615 0x4b65, 0x080c, 0x4cdc, 0x1180, 0x6004, 0xa084, 0x00ff, 0xa082,
6616 0x0006, 0x1250, 0x2001, 0xad34, 0x2004, 0xd0ac, 0x1904, 0x4b60,
6617 0x60a0, 0xd0bc, 0x1904, 0x4b60, 0x6864, 0xa0c6, 0x006f, 0x0118,
6618 0x2008, 0x0804, 0x4b28, 0x6968, 0x2140, 0xa18c, 0xff00, 0x810f,
6619 0x78d0, 0xd0ac, 0x1118, 0xa182, 0x0080, 0x06d0, 0xa182, 0x00ff,
6620 0x16b8, 0x6a70, 0x6b6c, 0x786c, 0xa306, 0x1160, 0x7870, 0xa24e,
6621 0x1118, 0x2208, 0x2310, 0x0460, 0xa9cc, 0xff00, 0x1118, 0x2208,
6622 0x2310, 0x0430, 0x080c, 0x3b58, 0x2c70, 0x0550, 0x2009, 0x0000,
6623 0x2011, 0x0000, 0xa0c6, 0x4000, 0x1160, 0x0006, 0x2e60, 0x080c,
6624 0x4f6e, 0x1108, 0xc185, 0x7000, 0xd0bc, 0x0108, 0xc18d, 0x000e,
6625 0x0088, 0xa0c6, 0x4007, 0x1110, 0x2408, 0x0060, 0xa0c6, 0x4008,
6626 0x1118, 0x2708, 0x2610, 0x0030, 0xa0c6, 0x4009, 0x1108, 0x0010,
6627 0x2001, 0x4006, 0x6866, 0x696a, 0x6a6e, 0x2001, 0x0030, 0x0458,
6628 0x080c, 0x8022, 0x1138, 0x2001, 0x4005, 0x2009, 0x0003, 0x2011,
6629 0x0000, 0x0c80, 0x2e00, 0x601a, 0x080c, 0x9956, 0x2d00, 0x6012,
6630 0x601f, 0x0001, 0xa006, 0xd88c, 0x0110, 0x2001, 0x4000, 0x683a,
6631 0x0126, 0x2091, 0x8000, 0x080c, 0x2ad9, 0x012e, 0x2001, 0x0000,
6632 0x080c, 0x4c1e, 0x2001, 0x0002, 0x080c, 0x4c30, 0x2009, 0x0002,
6633 0x080c, 0x80a7, 0xa006, 0xa005, 0x012e, 0x00ee, 0x00fe, 0x0005,
6634 0x2001, 0x0028, 0x2009, 0x0000, 0x0cb0, 0x2009, 0xad0c, 0x210c,
6635 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
6636 0x0004, 0x0010, 0x2001, 0x0029, 0x2009, 0x0000, 0x0c20, 0x2001,
6637 0x0029, 0x2009, 0x0000, 0x08f8, 0x6944, 0x6e48, 0xa684, 0x3fff,
6638 0xa082, 0x4000, 0x16b8, 0xa18c, 0xff00, 0x810f, 0xa182, 0x00ff,
6639 0x12e0, 0xa188, 0xae34, 0x2104, 0xa065, 0x01b8, 0x6004, 0xa084,
6640 0x00ff, 0xa08e, 0x0006, 0x11b0, 0x684c, 0xd0ec, 0x0120, 0x080c,
6641 0x4dfc, 0x04c9, 0x0030, 0x04b9, 0x684c, 0xd0fc, 0x0110, 0x080c,
6642 0x4ded, 0x080c, 0x4e3a, 0xa006, 0x00c8, 0x2001, 0x0028, 0x2009,
6643 0x0000, 0x00a0, 0xa082, 0x0006, 0x1240, 0x6100, 0xd1fc, 0x0d20,
6644 0x2001, 0x0029, 0x2009, 0x1000, 0x0048, 0x2001, 0x0029, 0x2009,
6645 0x0000, 0x0020, 0x2001, 0x0029, 0x2009, 0x0000, 0xa005, 0x0005,
6646 0x0126, 0x2091, 0x8000, 0x6050, 0xa00d, 0x0138, 0x2d00, 0x200a,
6647 0x6803, 0x0000, 0x6052, 0x012e, 0x0005, 0x2d00, 0x6052, 0x604e,
6648 0x6803, 0x0000, 0x0cc0, 0x0126, 0x2091, 0x8000, 0x604c, 0xa005,
6649 0x0170, 0x00e6, 0x2071, 0xafc7, 0x7004, 0xa086, 0x0002, 0x0168,
6650 0x00ee, 0x604c, 0x6802, 0x2d00, 0x604e, 0x012e, 0x0005, 0x2d00,
6651 0x6052, 0x604e, 0x6803, 0x0000, 0x0cc0, 0x701c, 0xac06, 0x1d80,
6652 0x604c, 0x2070, 0x7000, 0x6802, 0x2d00, 0x7002, 0x00ee, 0x012e,
6653 0x0005, 0x0126, 0x2091, 0x8000, 0x604c, 0xa06d, 0x0130, 0x6800,
6654 0xa005, 0x1108, 0x6052, 0x604e, 0xad05, 0x012e, 0x0005, 0x604c,
6655 0xa06d, 0x0130, 0x6800, 0xa005, 0x1108, 0x6052, 0x604e, 0xad05,
6656 0x0005, 0x6803, 0x0000, 0x6084, 0xa00d, 0x0120, 0x2d00, 0x200a,
6657 0x6086, 0x0005, 0x2d00, 0x6086, 0x6082, 0x0cd8, 0x0126, 0x00c6,
6658 0x0026, 0x2091, 0x8000, 0x6218, 0x2260, 0x6200, 0xa005, 0x0110,
6659 0xc285, 0x0008, 0xc284, 0x6202, 0x002e, 0x00ce, 0x012e, 0x0005,
6660 0x0126, 0x00c6, 0x2091, 0x8000, 0x6218, 0x2260, 0x6204, 0x0006,
6661 0xa086, 0x0006, 0x1180, 0x609c, 0xd0ac, 0x0168, 0x2001, 0xad52,
6662 0x2004, 0xd0a4, 0x0140, 0xa284, 0xff00, 0x8007, 0xa086, 0x0007,
6663 0x1110, 0x2011, 0x0600, 0x000e, 0xa294, 0xff00, 0xa215, 0x6206,
6664 0x0006, 0xa086, 0x0006, 0x1128, 0x6290, 0x82ff, 0x1110, 0x080c,
6665 0x14f6, 0x000e, 0x00ce, 0x012e, 0x0005, 0x0126, 0x00c6, 0x2091,
6666 0x8000, 0x6218, 0x2260, 0x6204, 0x0006, 0xa086, 0x0006, 0x1178,
6667 0x609c, 0xd0a4, 0x0160, 0x2001, 0xad52, 0x2004, 0xd0ac, 0x1138,
6668 0xa284, 0x00ff, 0xa086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e,
6669 0xa294, 0x00ff, 0x8007, 0xa215, 0x6206, 0x00ce, 0x012e, 0x0005,
6670 0x0026, 0xa182, 0x00ff, 0x0218, 0xa085, 0x0001, 0x00b0, 0xa190,
6671 0xae34, 0x2204, 0xa065, 0x1180, 0x0016, 0x00d6, 0x080c, 0x15c0,
6672 0x2d60, 0x00de, 0x001e, 0x0d80, 0x2c00, 0x2012, 0x60a7, 0x0000,
6673 0x60ab, 0x0000, 0x080c, 0x493a, 0xa006, 0x002e, 0x0005, 0x0126,
6674 0x2091, 0x8000, 0x0026, 0xa182, 0x00ff, 0x0218, 0xa085, 0x0001,
6675 0x0480, 0x00d6, 0xa190, 0xae34, 0x2204, 0xa06d, 0x0540, 0x2013,
6676 0x0000, 0x00d6, 0x00c6, 0x2d60, 0x60a4, 0xa06d, 0x0110, 0x080c,
6677 0x15f0, 0x60a8, 0xa06d, 0x0110, 0x080c, 0x15f0, 0x00ce, 0x00de,
6678 0x00d6, 0x00c6, 0x68ac, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006,
6679 0x6010, 0x2068, 0x080c, 0x9596, 0x0110, 0x080c, 0x1600, 0x080c,
6680 0x8078, 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x080c, 0x15f0, 0x00de,
6681 0xa006, 0x002e, 0x012e, 0x0005, 0x0016, 0xa182, 0x00ff, 0x0218,
6682 0xa085, 0x0001, 0x0030, 0xa188, 0xae34, 0x2104, 0xa065, 0x0dc0,
6683 0xa006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146, 0x600b,
6684 0x0000, 0x600f, 0x0000, 0x6000, 0xc08c, 0x6002, 0x080c, 0x574f,
6685 0x1538, 0x60a0, 0xa086, 0x007e, 0x2069, 0xb290, 0x0130, 0x2001,
6686 0xad34, 0x2004, 0xd0ac, 0x11e0, 0x0098, 0x2d04, 0xd0e4, 0x01c0,
6687 0x00d6, 0x2069, 0xb28e, 0x00c6, 0x2061, 0xaf9f, 0x6810, 0x2062,
6688 0x6814, 0x6006, 0x6818, 0x600a, 0x681c, 0x600e, 0x00ce, 0x00de,
6689 0x8d69, 0x2d04, 0x2069, 0x0140, 0x6886, 0x2069, 0xad00, 0x68a2,
6690 0x2069, 0xb28e, 0x6808, 0x605e, 0x6810, 0x6062, 0x6138, 0xa10a,
6691 0x0208, 0x603a, 0x6814, 0x6066, 0x2099, 0xb296, 0xac88, 0x000a,
6692 0x21a0, 0x20a9, 0x0004, 0x53a3, 0x2099, 0xb29a, 0xac88, 0x0006,
6693 0x21a0, 0x20a9, 0x0004, 0x53a3, 0x2069, 0xb2ae, 0x6808, 0x606a,
6694 0x690c, 0x616e, 0x6810, 0x6072, 0x6818, 0x6076, 0xa182, 0x0211,
6695 0x1218, 0x2009, 0x0008, 0x0400, 0xa182, 0x0259, 0x1218, 0x2009,
6696 0x0007, 0x00d0, 0xa182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0,
6697 0xa182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0xa182, 0x0421,
6698 0x1218, 0x2009, 0x0004, 0x0040, 0xa182, 0x0581, 0x1218, 0x2009,
6699 0x0003, 0x0010, 0x2009, 0x0002, 0x6192, 0x014e, 0x013e, 0x015e,
6700 0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0xb28d, 0x2e04,
6701 0x6896, 0x2071, 0xb28e, 0x7004, 0x689a, 0x701c, 0x689e, 0x6a00,
6702 0x2009, 0xad71, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad,
6703 0x0008, 0xc2ac, 0xd0c4, 0x0120, 0xd1e4, 0x0110, 0xc2bd, 0x0008,
6704 0xc2bc, 0x6a02, 0x00ee, 0x002e, 0x001e, 0x0005, 0x00d6, 0x0126,
6705 0x2091, 0x8000, 0x60a4, 0xa06d, 0x01c0, 0x6900, 0x81ff, 0x1540,
6706 0x6a04, 0xa282, 0x0010, 0x1648, 0xad88, 0x0004, 0x20a9, 0x0010,
6707 0x2104, 0xa086, 0xffff, 0x0128, 0x8108, 0x1f04, 0x4da8, 0x080c,
6708 0x14f6, 0x260a, 0x8210, 0x6a06, 0x0098, 0x080c, 0x15d9, 0x01a8,
6709 0x2d00, 0x60a6, 0x6803, 0x0000, 0xad88, 0x0004, 0x20a9, 0x0010,
6710 0x200b, 0xffff, 0x8108, 0x1f04, 0x4dc0, 0x6807, 0x0001, 0x6e12,
6711 0xa085, 0x0001, 0x012e, 0x00de, 0x0005, 0xa006, 0x0cd8, 0x0126,
6712 0x2091, 0x8000, 0x00d6, 0x60a4, 0xa00d, 0x01a0, 0x2168, 0x6800,
6713 0xa005, 0x1160, 0x080c, 0x4ef9, 0x1168, 0x200b, 0xffff, 0x6804,
6714 0xa08a, 0x0002, 0x0218, 0x8001, 0x6806, 0x0020, 0x080c, 0x15f0,
6715 0x60a7, 0x0000, 0x00de, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
6716 0x080c, 0x4f56, 0x0010, 0x080c, 0x4bc0, 0x080c, 0x4e71, 0x1dd8,
6717 0x080c, 0x4e3a, 0x012e, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000,
6718 0x60a8, 0xa06d, 0x01c0, 0x6950, 0x81ff, 0x1540, 0x6a54, 0xa282,
6719 0x0010, 0x1670, 0xad88, 0x0018, 0x20a9, 0x0010, 0x2104, 0xa086,
6720 0xffff, 0x0128, 0x8108, 0x1f04, 0x4e0e, 0x080c, 0x14f6, 0x260a,
6721 0x8210, 0x6a56, 0x0098, 0x080c, 0x15d9, 0x01d0, 0x2d00, 0x60aa,
6722 0x6853, 0x0000, 0xad88, 0x0018, 0x20a9, 0x0010, 0x200b, 0xffff,
6723 0x8108, 0x1f04, 0x4e26, 0x6857, 0x0001, 0x6e62, 0x0010, 0x080c,
6724 0x4c11, 0x0089, 0x1de0, 0xa085, 0x0001, 0x012e, 0x00de, 0x0005,
6725 0xa006, 0x0cd8, 0x0126, 0x2091, 0x8000, 0x080c, 0x67c5, 0x012e,
6726 0x0005, 0xa01e, 0x0010, 0x2019, 0x0001, 0xa00e, 0x0126, 0x2091,
6727 0x8000, 0x604c, 0x2068, 0x6000, 0xd0dc, 0x1170, 0x8dff, 0x01e8,
6728 0x83ff, 0x0120, 0x6848, 0xa606, 0x0158, 0x0030, 0x683c, 0xa406,
6729 0x1118, 0x6840, 0xa506, 0x0120, 0x2d08, 0x6800, 0x2068, 0x0c70,
6730 0x6a00, 0x604c, 0xad06, 0x1110, 0x624e, 0x0018, 0xa180, 0x0000,
6731 0x2202, 0x82ff, 0x1110, 0x6152, 0x8dff, 0x012e, 0x0005, 0xa01e,
6732 0x0010, 0x2019, 0x0001, 0xa00e, 0x6080, 0x2068, 0x8dff, 0x01e8,
6733 0x83ff, 0x0120, 0x6848, 0xa606, 0x0158, 0x0030, 0x683c, 0xa406,
6734 0x1118, 0x6840, 0xa506, 0x0120, 0x2d08, 0x6800, 0x2068, 0x0c70,
6735 0x6a00, 0x6080, 0xad06, 0x1110, 0x6282, 0x0018, 0xa180, 0x0000,
6736 0x2202, 0x82ff, 0x1110, 0x6186, 0x8dff, 0x0005, 0xa016, 0x080c,
6737 0x4ef3, 0x1110, 0x2011, 0x0001, 0x080c, 0x4f3d, 0x1110, 0xa295,
6738 0x0002, 0x0005, 0x080c, 0x4f6e, 0x0118, 0x080c, 0x964b, 0x0010,
6739 0xa085, 0x0001, 0x0005, 0x080c, 0x4f6e, 0x0118, 0x080c, 0x95e4,
6740 0x0010, 0xa085, 0x0001, 0x0005, 0x080c, 0x4f6e, 0x0118, 0x080c,
6741 0x962e, 0x0010, 0xa085, 0x0001, 0x0005, 0x080c, 0x4f6e, 0x0118,
6742 0x080c, 0x9600, 0x0010, 0xa085, 0x0001, 0x0005, 0x080c, 0x4f6e,
6743 0x0118, 0x080c, 0x9667, 0x0010, 0xa085, 0x0001, 0x0005, 0x0126,
6744 0x0006, 0x00d6, 0x2091, 0x8000, 0x6080, 0xa06d, 0x01a0, 0x6800,
6745 0x0006, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x97fd,
6746 0x0006, 0x6000, 0xd0fc, 0x0110, 0x080c, 0xac03, 0x000e, 0x080c,
6747 0x510c, 0x000e, 0x0c50, 0x6083, 0x0000, 0x6087, 0x0000, 0x00de,
6748 0x000e, 0x012e, 0x0005, 0x60a4, 0xa00d, 0x1118, 0xa085, 0x0001,
6749 0x0005, 0x00e6, 0x2170, 0x7000, 0xa005, 0x1160, 0x20a9, 0x0010,
6750 0xae88, 0x0004, 0x2104, 0xa606, 0x0128, 0x8108, 0x1f04, 0x4f02,
6751 0xa085, 0x0001, 0xa006, 0x00ee, 0x0005, 0x00d6, 0x0126, 0x2091,
6752 0x8000, 0x60a4, 0xa06d, 0x1128, 0x080c, 0x15d9, 0x01a0, 0x2d00,
6753 0x60a6, 0x6803, 0x0001, 0x6807, 0x0000, 0xad88, 0x0004, 0x20a9,
6754 0x0010, 0x200b, 0xffff, 0x8108, 0x1f04, 0x4f21, 0xa085, 0x0001,
6755 0x012e, 0x00de, 0x0005, 0xa006, 0x0cd8, 0x00d6, 0x0126, 0x2091,
6756 0x8000, 0x60a4, 0xa06d, 0x0130, 0x60a7, 0x0000, 0x080c, 0x15f0,
6757 0xa085, 0x0001, 0x012e, 0x00de, 0x0005, 0x60a8, 0xa00d, 0x1118,
6758 0xa085, 0x0001, 0x0005, 0x00e6, 0x2170, 0x7050, 0xa005, 0x1160,
6759 0x20a9, 0x0010, 0xae88, 0x0018, 0x2104, 0xa606, 0x0128, 0x8108,
6760 0x1f04, 0x4f4c, 0xa085, 0x0001, 0x00ee, 0x0005, 0x0126, 0x2091,
6761 0x8000, 0x0c19, 0x1188, 0x200b, 0xffff, 0x00d6, 0x60a8, 0x2068,
6762 0x6854, 0xa08a, 0x0002, 0x0218, 0x8001, 0x6856, 0x0020, 0x080c,
6763 0x15f0, 0x60ab, 0x0000, 0x00de, 0x012e, 0x0005, 0x609c, 0xd0a4,
6764 0x0005, 0x00f6, 0x080c, 0x574f, 0x01b0, 0x71b4, 0x81ff, 0x1198,
6765 0x71d0, 0xd19c, 0x0180, 0x2001, 0x007e, 0xa080, 0xae34, 0x2004,
6766 0xa07d, 0x0148, 0x7804, 0xa084, 0x00ff, 0xa086, 0x0006, 0x1118,
6767 0x7800, 0xc0ed, 0x7802, 0x2079, 0xad51, 0x7804, 0xd0a4, 0x01e8,
6768 0x0156, 0x00c6, 0x20a9, 0x007f, 0x2009, 0x0000, 0x0016, 0x080c,
6769 0x4cdc, 0x1168, 0x6004, 0xa084, 0xff00, 0x8007, 0xa096, 0x0004,
6770 0x0118, 0xa086, 0x0006, 0x1118, 0x6000, 0xc0ed, 0x6002, 0x001e,
6771 0x8108, 0x1f04, 0x4f96, 0x00ce, 0x015e, 0x080c, 0x502d, 0x0120,
6772 0x2001, 0xafa2, 0x200c, 0x0038, 0x2079, 0xad51, 0x7804, 0xd0a4,
6773 0x0130, 0x2009, 0x07d0, 0x2011, 0x4fc1, 0x080c, 0x6593, 0x00fe,
6774 0x0005, 0x2011, 0x4fc1, 0x080c, 0x650d, 0x080c, 0x502d, 0x01f0,
6775 0x2001, 0xaeb2, 0x2004, 0xa080, 0x0000, 0x200c, 0xc1ec, 0x2102,
6776 0x2001, 0xad52, 0x2004, 0xd0a4, 0x0130, 0x2009, 0x07d0, 0x2011,
6777 0x4fc1, 0x080c, 0x6593, 0x00e6, 0x2071, 0xad00, 0x706f, 0x0000,
6778 0x7073, 0x0000, 0x080c, 0x28fa, 0x00ee, 0x04b0, 0x0156, 0x00c6,
6779 0x20a9, 0x007f, 0x2009, 0x0000, 0x0016, 0x080c, 0x4cdc, 0x1530,
6780 0x6000, 0xd0ec, 0x0518, 0x0046, 0x62a0, 0xa294, 0x00ff, 0x8227,
6781 0xa006, 0x2009, 0x0029, 0x080c, 0xa96c, 0x6000, 0xc0e5, 0xc0ec,
6782 0x6002, 0x6004, 0xa084, 0x00ff, 0xa085, 0x0700, 0x6006, 0x2019,
6783 0x0029, 0x080c, 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c, 0x681d,
6784 0x2009, 0x0000, 0x080c, 0xa712, 0x007e, 0x004e, 0x001e, 0x8108,
6785 0x1f04, 0x4fec, 0x00ce, 0x015e, 0x0005, 0x00c6, 0x6018, 0x2060,
6786 0x6000, 0xc0ec, 0x6002, 0x00ce, 0x0005, 0x7818, 0x2004, 0xd0ac,
6787 0x0005, 0x7818, 0x2004, 0xd0bc, 0x0005, 0x00f6, 0x2001, 0xaeb2,
6788 0x2004, 0xa07d, 0x0110, 0x7800, 0xd0ec, 0x00fe, 0x0005, 0x0126,
6789 0x0026, 0x2091, 0x8000, 0x6200, 0xa005, 0x0110, 0xc2fd, 0x0008,
6790 0xc2fc, 0x6202, 0x002e, 0x012e, 0x0005, 0x2071, 0xae13, 0x7003,
6791 0x0001, 0x7007, 0x0000, 0x7013, 0x0000, 0x7017, 0x0000, 0x701b,
6792 0x0000, 0x701f, 0x0000, 0x700b, 0x0000, 0x704b, 0x0001, 0x704f,
6793 0x0000, 0x705b, 0x0020, 0x705f, 0x0040, 0x707f, 0x0000, 0x2071,
6794 0xaf7c, 0x7003, 0xae13, 0x7007, 0x0000, 0x700b, 0x0000, 0x700f,
6795 0xaf5c, 0x7013, 0x0020, 0x7017, 0x0040, 0x7037, 0x0000, 0x0005,
6796 0x0016, 0x00e6, 0x2071, 0xaf34, 0xa00e, 0x7186, 0x718a, 0x7097,
6797 0x0001, 0x2001, 0xad52, 0x2004, 0xd0fc, 0x1150, 0x2001, 0xad52,
6798 0x2004, 0xa00e, 0xd09c, 0x0108, 0x8108, 0x7102, 0x0804, 0x50d6,
6799 0x2001, 0xad71, 0x200c, 0xa184, 0x000f, 0x2009, 0xad72, 0x210c,
6800 0x0002, 0x507e, 0x50b1, 0x50b8, 0x50c2, 0x50c7, 0x507e, 0x507e,
6801 0x507e, 0x50a1, 0x507e, 0x507e, 0x507e, 0x507e, 0x507e, 0x507e,
6802 0x507e, 0x7003, 0x0004, 0x0136, 0x0146, 0x0156, 0x2099, 0xad75,
6803 0x20a1, 0xaf85, 0x20a9, 0x0004, 0x53a3, 0x015e, 0x014e, 0x013e,
6804 0x0428, 0x708f, 0x0005, 0x7007, 0x0122, 0x2001, 0x0002, 0x0030,
6805 0x708f, 0x0002, 0x7007, 0x0121, 0x2001, 0x0003, 0x7002, 0x7097,
6806 0x0001, 0x0088, 0x7007, 0x0122, 0x2001, 0x0002, 0x0020, 0x7007,
6807 0x0121, 0x2001, 0x0003, 0x7002, 0xa006, 0x7096, 0x708e, 0xa184,
6808 0xff00, 0x8007, 0x709a, 0xa184, 0x00ff, 0x7092, 0x00ee, 0x001e,
6809 0x0005, 0x00e6, 0x2071, 0xae13, 0x684c, 0xa005, 0x1130, 0x7028,
6810 0xc085, 0x702a, 0xa085, 0x0001, 0x0428, 0x6a60, 0x7236, 0x6b64,
6811 0x733a, 0x6868, 0x703e, 0x7076, 0x686c, 0x7042, 0x707a, 0x684c,
6812 0x702e, 0x6844, 0x7032, 0x2009, 0x000d, 0x200a, 0x700b, 0x0000,
6813 0x8007, 0x8006, 0x8006, 0xa08c, 0x003f, 0xa084, 0xffc0, 0xa210,
6814 0x2100, 0xa319, 0x726e, 0x7372, 0x7028, 0xc084, 0x702a, 0x7007,
6815 0x0001, 0xa006, 0x00ee, 0x0005, 0x0156, 0x00e6, 0x0026, 0x6838,
6816 0xd0fc, 0x1904, 0x5165, 0x6804, 0xa00d, 0x0188, 0x00d6, 0x2071,
6817 0xad00, 0xa016, 0x702c, 0x2168, 0x6904, 0x206a, 0x8210, 0x2d00,
6818 0x81ff, 0x1dc8, 0x702e, 0x70b0, 0xa200, 0x70b2, 0x00de, 0x2071,
6819 0xae13, 0x701c, 0xa005, 0x1904, 0x5175, 0x20a9, 0x0032, 0x0f04,
6820 0x5173, 0x0e04, 0x512f, 0x2071, 0xaf34, 0x7200, 0x82ff, 0x05d8,
6821 0x6934, 0xa186, 0x0103, 0x1904, 0x5183, 0x6948, 0x6844, 0xa105,
6822 0x1540, 0x2009, 0x8020, 0x2200, 0x0002, 0x5173, 0x514a, 0x519b,
6823 0x51a7, 0x5173, 0x2071, 0x0000, 0x20a9, 0x0032, 0x0f04, 0x5173,
6824 0x7018, 0xd084, 0x1dd8, 0x7122, 0x683c, 0x7026, 0x6840, 0x702a,
6825 0x701b, 0x0001, 0x2091, 0x4080, 0x2071, 0xad00, 0x702c, 0x206a,
6826 0x2d00, 0x702e, 0x70b0, 0x8000, 0x70b2, 0x002e, 0x00ee, 0x015e,
6827 0x0005, 0x6844, 0xa086, 0x0100, 0x1130, 0x6868, 0xa005, 0x1118,
6828 0x2009, 0x8020, 0x0880, 0x2071, 0xae13, 0x2d08, 0x206b, 0x0000,
6829 0x7010, 0x8000, 0x7012, 0x7018, 0xa06d, 0x711a, 0x0110, 0x6902,
6830 0x0008, 0x711e, 0x0c10, 0xa18c, 0x00ff, 0xa186, 0x0017, 0x0130,
6831 0xa186, 0x001e, 0x0118, 0xa18e, 0x001f, 0x1d28, 0x684c, 0xd0cc,
6832 0x0d10, 0x6850, 0xa084, 0x00ff, 0xa086, 0x0001, 0x19e0, 0x2009,
6833 0x8021, 0x0804, 0x5143, 0x7084, 0x8008, 0xa092, 0x001e, 0x1a98,
6834 0x7186, 0xae90, 0x0003, 0xa210, 0x683c, 0x2012, 0x0078, 0x7084,
6835 0x8008, 0xa092, 0x000f, 0x1a38, 0x7186, 0xae90, 0x0003, 0x8003,
6836 0xa210, 0x683c, 0x2012, 0x8210, 0x6840, 0x2012, 0x7088, 0xa10a,
6837 0x0a04, 0x515c, 0x718c, 0x7084, 0xa10a, 0x0a04, 0x515c, 0x2071,
6838 0x0000, 0x7018, 0xd084, 0x1904, 0x515c, 0x2071, 0xaf34, 0x7000,
6839 0xa086, 0x0002, 0x1150, 0x080c, 0x5426, 0x2071, 0x0000, 0x701b,
6840 0x0001, 0x2091, 0x4080, 0x0804, 0x515c, 0x080c, 0x5450, 0x2071,
6841 0x0000, 0x701b, 0x0001, 0x2091, 0x4080, 0x0804, 0x515c, 0x0006,
6842 0x684c, 0x0006, 0x6837, 0x0103, 0x20a9, 0x001c, 0xad80, 0x0011,
6843 0x20a0, 0x2001, 0x0000, 0x40a4, 0x000e, 0xa084, 0x00ff, 0x684e,
6844 0x000e, 0x684a, 0x6952, 0x0005, 0x2071, 0xae13, 0x7004, 0x0002,
6845 0x5202, 0x5213, 0x5411, 0x5412, 0x541f, 0x5425, 0x5203, 0x5402,
6846 0x5398, 0x53ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x5212,
6847 0x2009, 0x000d, 0x7030, 0x200a, 0x2091, 0x4080, 0x7007, 0x0001,
6848 0x700b, 0x0000, 0x012e, 0x2069, 0xafda, 0x683c, 0xa005, 0x03f8,
6849 0x11f0, 0x0126, 0x2091, 0x8000, 0x2069, 0x0000, 0x6934, 0x2001,
6850 0xae1f, 0x2004, 0xa10a, 0x0170, 0x0e04, 0x5236, 0x2069, 0x0000,
6851 0x6818, 0xd084, 0x1158, 0x2009, 0x8040, 0x6922, 0x681b, 0x0001,
6852 0x2091, 0x4080, 0x2069, 0xafda, 0x683f, 0xffff, 0x012e, 0x2069,
6853 0xad00, 0x6844, 0x6964, 0xa102, 0x2069, 0xaf34, 0x688a, 0x6984,
6854 0x701c, 0xa06d, 0x0120, 0x81ff, 0x0904, 0x528c, 0x00a0, 0x81ff,
6855 0x0904, 0x5352, 0x2071, 0xaf34, 0x7184, 0x7088, 0xa10a, 0x1258,
6856 0x7190, 0x2071, 0xafda, 0x7038, 0xa005, 0x0128, 0x1b04, 0x5352,
6857 0x713a, 0x0804, 0x5352, 0x2071, 0xaf34, 0x718c, 0x0126, 0x2091,
6858 0x8000, 0x7084, 0xa10a, 0x0a04, 0x536d, 0x0e04, 0x530e, 0x2071,
6859 0x0000, 0x7018, 0xd084, 0x1904, 0x530e, 0x2001, 0xffff, 0x2071,
6860 0xafda, 0x703a, 0x2071, 0xaf34, 0x7000, 0xa086, 0x0002, 0x1150,
6861 0x080c, 0x5426, 0x2071, 0x0000, 0x701b, 0x0001, 0x2091, 0x4080,
6862 0x0804, 0x530e, 0x080c, 0x5450, 0x2071, 0x0000, 0x701b, 0x0001,
6863 0x2091, 0x4080, 0x0804, 0x530e, 0x2071, 0xaf34, 0x7000, 0xa005,
6864 0x0904, 0x5334, 0x6934, 0xa186, 0x0103, 0x1904, 0x5311, 0x684c,
6865 0xd0bc, 0x1904, 0x5334, 0x6948, 0x6844, 0xa105, 0x1904, 0x5329,
6866 0x2009, 0x8020, 0x2071, 0xaf34, 0x7000, 0x0002, 0x5334, 0x52f4,
6867 0x52cc, 0x52de, 0x52ab, 0x0136, 0x0146, 0x0156, 0x2099, 0xad75,
6868 0x20a1, 0xaf85, 0x20a9, 0x0004, 0x53a3, 0x015e, 0x014e, 0x013e,
6869 0x2071, 0xaf7c, 0xad80, 0x000f, 0x700e, 0x7013, 0x0002, 0x7007,
6870 0x0002, 0x700b, 0x0000, 0x2e10, 0x080c, 0x1624, 0x2071, 0xae13,
6871 0x7007, 0x0009, 0x0804, 0x5352, 0x7084, 0x8008, 0xa092, 0x001e,
6872 0x1a04, 0x5352, 0xae90, 0x0003, 0xa210, 0x683c, 0x2012, 0x7186,
6873 0x2071, 0xae13, 0x080c, 0x54a7, 0x0804, 0x5352, 0x7084, 0x8008,
6874 0xa092, 0x000f, 0x1a04, 0x5352, 0xae90, 0x0003, 0x8003, 0xa210,
6875 0x683c, 0x2012, 0x8210, 0x6840, 0x2012, 0x7186, 0x2071, 0xae13,
6876 0x080c, 0x54a7, 0x0804, 0x5352, 0x0126, 0x2091, 0x8000, 0x0e04,
6877 0x530e, 0x2071, 0x0000, 0x7018, 0xd084, 0x1180, 0x7122, 0x683c,
6878 0x7026, 0x6840, 0x702a, 0x701b, 0x0001, 0x2091, 0x4080, 0x012e,
6879 0x2071, 0xae13, 0x080c, 0x54a7, 0x0804, 0x5352, 0x012e, 0x0804,
6880 0x5352, 0xa18c, 0x00ff, 0xa186, 0x0017, 0x0130, 0xa186, 0x001e,
6881 0x0118, 0xa18e, 0x001f, 0x11c0, 0x684c, 0xd0cc, 0x01a8, 0x6850,
6882 0xa084, 0x00ff, 0xa086, 0x0001, 0x1178, 0x2009, 0x8021, 0x0804,
6883 0x52a2, 0x6844, 0xa086, 0x0100, 0x1138, 0x6868, 0xa005, 0x1120,
6884 0x2009, 0x8020, 0x0804, 0x52a2, 0x2071, 0xae13, 0x080c, 0x54b9,
6885 0x01c8, 0x2071, 0xae13, 0x700f, 0x0001, 0x6934, 0xa184, 0x00ff,
6886 0xa086, 0x0003, 0x1130, 0x810f, 0xa18c, 0x00ff, 0x8101, 0x0108,
6887 0x710e, 0x7007, 0x0003, 0x080c, 0x54d2, 0x7050, 0xa086, 0x0100,
6888 0x0904, 0x5412, 0x0126, 0x2091, 0x8000, 0x2071, 0xae13, 0x7008,
6889 0xa086, 0x0001, 0x1180, 0x0e04, 0x536b, 0x2009, 0x000d, 0x7030,
6890 0x200a, 0x2091, 0x4080, 0x700b, 0x0000, 0x7004, 0xa086, 0x0006,
6891 0x1110, 0x7007, 0x0001, 0x012e, 0x0005, 0x2071, 0xae13, 0x080c,
6892 0x54b9, 0x0518, 0x2071, 0xaf34, 0x7084, 0x700a, 0x20a9, 0x0020,
6893 0x2099, 0xaf35, 0x20a1, 0xaf5c, 0x53a3, 0x7087, 0x0000, 0x2071,
6894 0xae13, 0x2069, 0xaf7c, 0x706c, 0x6826, 0x7070, 0x682a, 0x7074,
6895 0x682e, 0x7078, 0x6832, 0x2d10, 0x080c, 0x1624, 0x7007, 0x0008,
6896 0x2001, 0xffff, 0x2071, 0xafda, 0x703a, 0x012e, 0x0804, 0x5352,
6897 0x2069, 0xaf7c, 0x6808, 0xa08e, 0x0000, 0x0904, 0x53ed, 0xa08e,
6898 0x0200, 0x0904, 0x53eb, 0xa08e, 0x0100, 0x1904, 0x53ed, 0x0126,
6899 0x2091, 0x8000, 0x0e04, 0x53e9, 0x2069, 0x0000, 0x6818, 0xd084,
6900 0x15c0, 0x702c, 0x7130, 0x8108, 0xa102, 0x0230, 0xa00e, 0x7034,
6901 0x706e, 0x7038, 0x7072, 0x0048, 0x706c, 0xa080, 0x0040, 0x706e,
6902 0x1220, 0x7070, 0xa081, 0x0000, 0x7072, 0x7132, 0x6936, 0x700b,
6903 0x0000, 0x2001, 0xaf59, 0x2004, 0xa005, 0x1190, 0x6934, 0x2069,
6904 0xaf34, 0x689c, 0x699e, 0x2069, 0xafda, 0xa102, 0x1118, 0x683c,
6905 0xa005, 0x1368, 0x2001, 0xaf5a, 0x200c, 0x810d, 0x693e, 0x0038,
6906 0x2009, 0x8040, 0x6922, 0x681b, 0x0001, 0x2091, 0x4080, 0x7007,
6907 0x0001, 0x012e, 0x0010, 0x7007, 0x0005, 0x0005, 0x2001, 0xaf7e,
6908 0x2004, 0xa08e, 0x0100, 0x1128, 0x7007, 0x0001, 0x080c, 0x54a7,
6909 0x0005, 0xa08e, 0x0000, 0x0de0, 0xa08e, 0x0200, 0x1dc8, 0x7007,
6910 0x0005, 0x0005, 0x701c, 0xa06d, 0x0158, 0x080c, 0x54b9, 0x0140,
6911 0x7007, 0x0003, 0x080c, 0x54d2, 0x7050, 0xa086, 0x0100, 0x0110,
6912 0x0005, 0x0005, 0x7050, 0xa09e, 0x0100, 0x1118, 0x7007, 0x0004,
6913 0x0030, 0xa086, 0x0200, 0x1110, 0x7007, 0x0005, 0x0005, 0x080c,
6914 0x5475, 0x7006, 0x080c, 0x54a7, 0x0005, 0x0005, 0x00e6, 0x0156,
6915 0x2071, 0xaf34, 0x7184, 0x81ff, 0x0500, 0xa006, 0x7086, 0xae80,
6916 0x0003, 0x2071, 0x0000, 0x21a8, 0x2014, 0x7226, 0x8000, 0x0f04,
6917 0x544a, 0x2014, 0x722a, 0x8000, 0x0f04, 0x544a, 0x2014, 0x722e,
6918 0x8000, 0x0f04, 0x544a, 0x2014, 0x723a, 0x8000, 0x0f04, 0x544a,
6919 0x2014, 0x723e, 0xa180, 0x8030, 0x7022, 0x015e, 0x00ee, 0x0005,
6920 0x00e6, 0x0156, 0x2071, 0xaf34, 0x7184, 0x81ff, 0x01d8, 0xa006,
6921 0x7086, 0xae80, 0x0003, 0x2071, 0x0000, 0x21a8, 0x2014, 0x7226,
6922 0x8000, 0x2014, 0x722a, 0x8000, 0x0f04, 0x546c, 0x2014, 0x723a,
6923 0x8000, 0x2014, 0x723e, 0x0018, 0x2001, 0x8020, 0x0010, 0x2001,
6924 0x8042, 0x7022, 0x015e, 0x00ee, 0x0005, 0x702c, 0x7130, 0x8108,
6925 0xa102, 0x0230, 0xa00e, 0x7034, 0x706e, 0x7038, 0x7072, 0x0048,
6926 0x706c, 0xa080, 0x0040, 0x706e, 0x1220, 0x7070, 0xa081, 0x0000,
6927 0x7072, 0x7132, 0x700c, 0x8001, 0x700e, 0x1180, 0x0126, 0x2091,
6928 0x8000, 0x0e04, 0x54a1, 0x2001, 0x000d, 0x2102, 0x2091, 0x4080,
6929 0x2001, 0x0001, 0x700b, 0x0000, 0x012e, 0x0005, 0x2001, 0x0007,
6930 0x0005, 0x2001, 0x0006, 0x700b, 0x0001, 0x012e, 0x0005, 0x701c,
6931 0xa06d, 0x0170, 0x0126, 0x2091, 0x8000, 0x7010, 0x8001, 0x7012,
6932 0x2d04, 0x701e, 0xa005, 0x1108, 0x701a, 0x012e, 0x080c, 0x15f0,
6933 0x0005, 0x2019, 0x000d, 0x2304, 0x230c, 0xa10e, 0x0130, 0x2304,
6934 0x230c, 0xa10e, 0x0110, 0xa006, 0x0060, 0x732c, 0x8319, 0x7130,
6935 0xa102, 0x1118, 0x2300, 0xa005, 0x0020, 0x0210, 0xa302, 0x0008,
6936 0x8002, 0x0005, 0x2d00, 0x7026, 0xa080, 0x000d, 0x7056, 0x7053,
6937 0x0000, 0x0126, 0x2091, 0x8000, 0x2009, 0xafec, 0x2104, 0xc08d,
6938 0x200a, 0x012e, 0x080c, 0x163c, 0x0005, 0x7088, 0xa08a, 0x0029,
6939 0x1220, 0xa082, 0x001d, 0x0033, 0x0010, 0x080c, 0x14f6, 0x6027,
6940 0x1e00, 0x0005, 0x55c1, 0x555b, 0x5571, 0x5595, 0x55b4, 0x55e6,
6941 0x55f8, 0x5571, 0x55d2, 0x54ff, 0x552d, 0x54fe, 0x0005, 0x00d6,
6942 0x2069, 0x0200, 0x6804, 0xa005, 0x1180, 0x6808, 0xa005, 0x1518,
6943 0x708b, 0x0028, 0x2069, 0xafac, 0x2d04, 0x7002, 0x080c, 0x584d,
6944 0x6028, 0xa085, 0x0600, 0x602a, 0x00b0, 0x708b, 0x0028, 0x2069,
6945 0xafac, 0x2d04, 0x7002, 0x6028, 0xa085, 0x0600, 0x602a, 0x00e6,
6946 0x0036, 0x0046, 0x0056, 0x2071, 0xaffd, 0x080c, 0x1d22, 0x005e,
6947 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200,
6948 0x6804, 0xa005, 0x1180, 0x6808, 0xa005, 0x1518, 0x708b, 0x0028,
6949 0x2069, 0xafac, 0x2d04, 0x7002, 0x080c, 0x58da, 0x6028, 0xa085,
6950 0x0600, 0x602a, 0x00b0, 0x708b, 0x0028, 0x2069, 0xafac, 0x2d04,
6951 0x7002, 0x6028, 0xa085, 0x0600, 0x602a, 0x00e6, 0x0036, 0x0046,
6952 0x0056, 0x2071, 0xaffd, 0x080c, 0x1d22, 0x005e, 0x004e, 0x003e,
6953 0x00ee, 0x00de, 0x0005, 0x6803, 0x0090, 0x6124, 0xd1e4, 0x1180,
6954 0x080c, 0x5663, 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1cc, 0x0140,
6955 0x708b, 0x0020, 0x0028, 0x708b, 0x001d, 0x0010, 0x708b, 0x001f,
6956 0x0005, 0x6803, 0x0088, 0x6124, 0xd1cc, 0x11c8, 0xd1dc, 0x11a0,
6957 0xd1e4, 0x1178, 0xa184, 0x1e00, 0x11b8, 0x60e3, 0x0001, 0x600c,
6958 0xc0b4, 0x600e, 0x080c, 0x577f, 0x6803, 0x0080, 0x708b, 0x0028,
6959 0x0058, 0x708b, 0x001e, 0x0040, 0x708b, 0x001d, 0x0028, 0x708b,
6960 0x0020, 0x0010, 0x708b, 0x001f, 0x0005, 0x60e3, 0x0001, 0x600c,
6961 0xc0b4, 0x600e, 0x080c, 0x577f, 0x6803, 0x0080, 0x6124, 0xd1d4,
6962 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0xa184, 0x1e00, 0x1158,
6963 0x708b, 0x0028, 0x0040, 0x708b, 0x001e, 0x0028, 0x708b, 0x001d,
6964 0x0010, 0x708b, 0x001f, 0x0005, 0x6803, 0x00a0, 0x6124, 0xd1dc,
6965 0x1128, 0xd1e4, 0x0128, 0x708b, 0x001e, 0x0010, 0x708b, 0x001d,
6966 0x0005, 0x080c, 0x568d, 0x6124, 0xd1dc, 0x1158, 0x080c, 0x5663,
6967 0xd1d4, 0x1128, 0xd1e4, 0x0128, 0x708b, 0x001e, 0x0010, 0x708b,
6968 0x001f, 0x0005, 0x6803, 0x00a0, 0x6124, 0xd1d4, 0x1160, 0xd1cc,
6969 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x708b, 0x001e, 0x0028,
6970 0x708b, 0x001d, 0x0010, 0x708b, 0x0021, 0x0005, 0x080c, 0x568d,
6971 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x708b,
6972 0x001e, 0x0028, 0x708b, 0x001d, 0x0010, 0x708b, 0x001f, 0x0005,
6973 0x6803, 0x0090, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150, 0xd1dc,
6974 0x1128, 0xd1e4, 0x0158, 0x708b, 0x001e, 0x0040, 0x708b, 0x001d,
6975 0x0028, 0x708b, 0x0020, 0x0010, 0x708b, 0x001f, 0x0005, 0x0016,
6976 0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069, 0x0140,
6977 0x2071, 0xad00, 0x2091, 0x8000, 0x080c, 0x574f, 0x11e8, 0x2001,
6978 0xad0c, 0x200c, 0xd1b4, 0x01c0, 0xc1b4, 0x2102, 0x6027, 0x0200,
6979 0xe000, 0xe000, 0x6024, 0xd0cc, 0x0158, 0x6803, 0x00a0, 0x2001,
6980 0xaf9e, 0x2003, 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0x0428,
6981 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x576b, 0x0150, 0x080c,
6982 0x5761, 0x1138, 0x2001, 0x0001, 0x080c, 0x261e, 0x080c, 0x5726,
6983 0x00a0, 0x080c, 0x568a, 0x0178, 0x2001, 0x0001, 0x080c, 0x261e,
6984 0x7088, 0xa086, 0x001e, 0x0120, 0x7088, 0xa086, 0x0022, 0x1118,
6985 0x708b, 0x0025, 0x0010, 0x708b, 0x0021, 0x012e, 0x00ee, 0x00de,
6986 0x00ce, 0x001e, 0x0005, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011,
6987 0x566e, 0x080c, 0x6501, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6,
6988 0x0016, 0x080c, 0x7834, 0x2071, 0xad00, 0x080c, 0x560f, 0x001e,
6989 0x00fe, 0x00ee, 0x0005, 0x2001, 0xad00, 0x2004, 0xa086, 0x0004,
6990 0x0140, 0x2001, 0xaf9d, 0x2003, 0xaaaa, 0x2001, 0xaf9e, 0x2003,
6991 0x0000, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6803, 0x00c0, 0x0156,
6992 0x20a9, 0x002d, 0x1d04, 0x5692, 0x2091, 0x6000, 0x1f04, 0x5692,
6993 0x015e, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
6994 0x0140, 0x2071, 0xad00, 0x2001, 0xaf9e, 0x200c, 0xa186, 0x0000,
6995 0x0158, 0xa186, 0x0001, 0x0158, 0xa186, 0x0002, 0x0158, 0xa186,
6996 0x0003, 0x0158, 0x0804, 0x5714, 0x708b, 0x0022, 0x0040, 0x708b,
6997 0x0021, 0x0028, 0x708b, 0x0023, 0x0020, 0x708b, 0x0024, 0x6043,
6998 0x0000, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c,
6999 0x26cb, 0x0026, 0x2011, 0x0003, 0x080c, 0x7adf, 0x2011, 0x0002,
7000 0x080c, 0x7ae9, 0x002e, 0x7000, 0xa08e, 0x0004, 0x0118, 0x602b,
7001 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091, 0x8000,
7002 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0118, 0x012e, 0x015e, 0x04d0,
7003 0x6800, 0xa084, 0x00a0, 0xc0bd, 0x6802, 0x6904, 0xd1d4, 0x1130,
7004 0x6803, 0x0100, 0x1f04, 0x56e2, 0x080c, 0x57a0, 0x012e, 0x015e,
7005 0x080c, 0x5761, 0x01a8, 0x6044, 0xa005, 0x0168, 0x6050, 0x0006,
7006 0xa085, 0x0020, 0x6052, 0x080c, 0x57a0, 0xa006, 0x8001, 0x1df0,
7007 0x000e, 0x6052, 0x0028, 0x6804, 0xd0d4, 0x1110, 0x080c, 0x57a0,
7008 0x2001, 0xaf9e, 0x2003, 0x0004, 0x080c, 0x54e5, 0x080c, 0x5761,
7009 0x0148, 0x6804, 0xd0d4, 0x1130, 0xd0dc, 0x1100, 0x2001, 0xaf9e,
7010 0x2003, 0x0000, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6,
7011 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0xad00, 0x2001,
7012 0xaf9d, 0x2003, 0x0000, 0x2001, 0xaf8e, 0x2003, 0x0000, 0x708b,
7013 0x0000, 0x60e3, 0x0000, 0x6887, 0x0000, 0x2001, 0x0000, 0x080c,
7014 0x26cb, 0x6803, 0x0000, 0x6043, 0x0090, 0x6043, 0x0010, 0x6027,
7015 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006,
7016 0x2001, 0xaf9d, 0x2004, 0xa086, 0xaaaa, 0x000e, 0x0005, 0x0006,
7017 0x2001, 0xad71, 0x2004, 0xa084, 0x0030, 0xa086, 0x0000, 0x000e,
7018 0x0005, 0x0006, 0x2001, 0xad71, 0x2004, 0xa084, 0x0030, 0xa086,
7019 0x0030, 0x000e, 0x0005, 0x0006, 0x2001, 0xad71, 0x2004, 0xa084,
7020 0x0030, 0xa086, 0x0010, 0x000e, 0x0005, 0x0006, 0x2001, 0xad71,
7021 0x2004, 0xa084, 0x0030, 0xa086, 0x0020, 0x000e, 0x0005, 0x2001,
7022 0xad0c, 0x2004, 0xd0a4, 0x0170, 0x080c, 0x26eb, 0x0036, 0x0016,
7023 0x2009, 0x0000, 0x2019, 0x0028, 0x080c, 0x2aac, 0x001e, 0x003e,
7024 0xa006, 0x0009, 0x0005, 0x00e6, 0x2071, 0xad0c, 0x2e04, 0x0118,
7025 0xa085, 0x0010, 0x0010, 0xa084, 0xffef, 0x2072, 0x00ee, 0x0005,
7026 0x6050, 0x0006, 0x60f0, 0x0006, 0x60ec, 0x0006, 0x600c, 0x0006,
7027 0x6004, 0x0006, 0x6028, 0x0006, 0x602f, 0x0100, 0x602f, 0x0000,
7028 0x602f, 0x0040, 0x602f, 0x0000, 0x000e, 0x602a, 0x000e, 0x6006,
7029 0x000e, 0x600e, 0x000e, 0x60ee, 0x000e, 0x60f2, 0x60e3, 0x0000,
7030 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x26cb, 0x6800, 0xa084,
7031 0x00a0, 0xc0bd, 0x6802, 0x6803, 0x00a0, 0x000e, 0x6052, 0x6050,
7032 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
7033 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0xad00, 0x6020, 0xa084,
7034 0x0080, 0x0138, 0x2001, 0xad0c, 0x200c, 0xc1bd, 0x2102, 0x0804,
7035 0x5845, 0x2001, 0xad0c, 0x200c, 0xc1bc, 0x2102, 0x6028, 0xa084,
7036 0xe1ff, 0x602a, 0x6027, 0x0200, 0x6803, 0x0090, 0x20a9, 0x0384,
7037 0x6024, 0xd0cc, 0x1518, 0x1d04, 0x57f8, 0x2091, 0x6000, 0x1f04,
7038 0x57f8, 0x2011, 0x0003, 0x080c, 0x7adf, 0x2011, 0x0002, 0x080c,
7039 0x7ae9, 0x080c, 0x79e1, 0x080c, 0x6581, 0x2019, 0x0000, 0x080c,
7040 0x7a64, 0x6803, 0x00a0, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x2001,
7041 0xad00, 0x2003, 0x0001, 0xa085, 0x0001, 0x0438, 0x60e3, 0x0000,
7042 0x2001, 0xaf8e, 0x2004, 0x080c, 0x26cb, 0x60e2, 0x6803, 0x0080,
7043 0x20a9, 0x0384, 0x6027, 0x1e00, 0x2009, 0x1e00, 0xe000, 0x6024,
7044 0xa10c, 0x0138, 0x1d04, 0x582a, 0x2091, 0x6000, 0x1f04, 0x582a,
7045 0x0840, 0x6028, 0xa085, 0x1e00, 0x602a, 0x70a0, 0xa005, 0x1118,
7046 0x6887, 0x0001, 0x0008, 0x6886, 0xa006, 0x00ee, 0x00de, 0x00ce,
7047 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
7048 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0xad00,
7049 0x2069, 0x0140, 0x6020, 0xa084, 0x00c0, 0x0120, 0x6884, 0xa005,
7050 0x1904, 0x58a1, 0x6803, 0x0088, 0x60e3, 0x0000, 0x6887, 0x0000,
7051 0x2001, 0x0000, 0x080c, 0x26cb, 0x2069, 0x0200, 0x6804, 0xa005,
7052 0x1118, 0x6808, 0xa005, 0x01c0, 0x6028, 0xa084, 0xfbff, 0x602a,
7053 0x6027, 0x0400, 0x2069, 0xafac, 0x7000, 0x206a, 0x708b, 0x0026,
7054 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x5884, 0x2091, 0x6000,
7055 0x1f04, 0x5884, 0x0804, 0x58d2, 0x2069, 0x0140, 0x20a9, 0x0384,
7056 0x6027, 0x1e00, 0x2009, 0x1e00, 0xe000, 0x6024, 0xa10c, 0x0530,
7057 0xa084, 0x1a00, 0x1518, 0x1d04, 0x5890, 0x2091, 0x6000, 0x1f04,
7058 0x5890, 0x2011, 0x0003, 0x080c, 0x7adf, 0x2011, 0x0002, 0x080c,
7059 0x7ae9, 0x080c, 0x79e1, 0x080c, 0x6581, 0x2019, 0x0000, 0x080c,
7060 0x7a64, 0x6803, 0x00a0, 0x2001, 0xaf9e, 0x2003, 0x0001, 0x2001,
7061 0xad00, 0x2003, 0x0001, 0xa085, 0x0001, 0x00a0, 0x6803, 0x0080,
7062 0x2069, 0x0140, 0x60e3, 0x0000, 0x70a0, 0xa005, 0x1118, 0x6887,
7063 0x0001, 0x0008, 0x6886, 0x2001, 0xaf8e, 0x2004, 0x080c, 0x26cb,
7064 0x60e2, 0xa006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
7065 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
7066 0x00e6, 0x2061, 0x0100, 0x2071, 0xad00, 0x6020, 0xa084, 0x00c0,
7067 0x01f0, 0x2011, 0x0003, 0x080c, 0x7adf, 0x2011, 0x0002, 0x080c,
7068 0x7ae9, 0x080c, 0x79e1, 0x080c, 0x6581, 0x2019, 0x0000, 0x080c,
7069 0x7a64, 0x2069, 0x0140, 0x6803, 0x00a0, 0x2001, 0xaf9e, 0x2003,
7070 0x0001, 0x2001, 0xad00, 0x2003, 0x0001, 0x0804, 0x5972, 0x2001,
7071 0xad0c, 0x200c, 0xd1b4, 0x1150, 0xc1b5, 0x2102, 0x080c, 0x5663,
7072 0x2069, 0x0140, 0x6803, 0x0080, 0x60e3, 0x0000, 0x2069, 0x0200,
7073 0x6804, 0xa005, 0x1118, 0x6808, 0xa005, 0x01b8, 0x6028, 0xa084,
7074 0xfdff, 0x602a, 0x6027, 0x0200, 0x2069, 0xafac, 0x7000, 0x206a,
7075 0x708b, 0x0027, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x592e,
7076 0x2091, 0x6000, 0x1f04, 0x592e, 0x04e8, 0x6027, 0x1e00, 0x2009,
7077 0x1e00, 0xe000, 0x6024, 0xa10c, 0x01c8, 0xa084, 0x1c00, 0x11b0,
7078 0x1d04, 0x5935, 0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c,
7079 0x64a2, 0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071,
7080 0xafda, 0x7018, 0x00ee, 0xa005, 0x1d00, 0x01e0, 0x0026, 0x2011,
7081 0x566e, 0x080c, 0x650d, 0x002e, 0x2069, 0x0140, 0x60e3, 0x0000,
7082 0x70a0, 0xa005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001,
7083 0xaf8e, 0x2004, 0x080c, 0x26cb, 0x60e2, 0x2001, 0xad0c, 0x200c,
7084 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
7085 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6,
7086 0x00e6, 0x2061, 0x0100, 0x2071, 0xad00, 0x7130, 0xd184, 0x1180,
7087 0x2011, 0xad52, 0x2214, 0xd2ec, 0x0138, 0xc18d, 0x7132, 0x2011,
7088 0xad52, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c, 0x0904, 0x59df,
7089 0x7130, 0xc185, 0x7132, 0x2011, 0xad52, 0x220c, 0xd1a4, 0x0530,
7090 0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x663f, 0x2019,
7091 0x000e, 0x080c, 0xa8eb, 0x0156, 0x20a9, 0x007f, 0x2009, 0x0000,
7092 0xa186, 0x007e, 0x0170, 0xa186, 0x0080, 0x0158, 0x080c, 0x4cdc,
7093 0x1140, 0x8127, 0xa006, 0x0016, 0x2009, 0x000e, 0x080c, 0xa96c,
7094 0x001e, 0x8108, 0x1f04, 0x59b0, 0x015e, 0x001e, 0xd1ac, 0x1148,
7095 0x0016, 0x2009, 0x0000, 0x2019, 0x0004, 0x080c, 0x2aac, 0x001e,
7096 0x0070, 0x0156, 0x20a9, 0x007f, 0x2009, 0x0000, 0x080c, 0x4cdc,
7097 0x1110, 0x080c, 0x493a, 0x8108, 0x1f04, 0x59d6, 0x015e, 0x2011,
7098 0x0003, 0x080c, 0x7adf, 0x2011, 0x0002, 0x080c, 0x7ae9, 0x080c,
7099 0x79e1, 0x080c, 0x6581, 0x0036, 0x2019, 0x0000, 0x080c, 0x7a64,
7100 0x003e, 0x60e3, 0x0000, 0x2001, 0xad00, 0x2003, 0x0001, 0x080c,
7101 0x569a, 0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e, 0x001e, 0x015e,
7102 0x0005, 0x2071, 0xade1, 0x7003, 0x0000, 0x7007, 0x0000, 0x700f,
7103 0x0000, 0x702b, 0x0001, 0x704f, 0x0000, 0x7053, 0x0001, 0x705f,
7104 0x0020, 0x7063, 0x0040, 0x7083, 0x0000, 0x708b, 0x0000, 0x708f,
7105 0x0001, 0x70bf, 0x0000, 0x0005, 0x00e6, 0x2071, 0xade1, 0x6848,
7106 0xa005, 0x1130, 0x7028, 0xc085, 0x702a, 0xa085, 0x0001, 0x0428,
7107 0x6a50, 0x7236, 0x6b54, 0x733a, 0x6858, 0x703e, 0x707a, 0x685c,
7108 0x7042, 0x707e, 0x6848, 0x702e, 0x6840, 0x7032, 0x2009, 0x000c,
7109 0x200a, 0x8007, 0x8006, 0x8006, 0xa08c, 0x003f, 0xa084, 0xffc0,
7110 0xa210, 0x2100, 0xa319, 0x7272, 0x7376, 0x7028, 0xc084, 0x702a,
7111 0x7007, 0x0001, 0x700f, 0x0000, 0xa006, 0x00ee, 0x0005, 0x2b78,
7112 0x2071, 0xade1, 0x7004, 0x0043, 0x700c, 0x0002, 0x5a5b, 0x5a52,
7113 0x5a52, 0x5a52, 0x5a52, 0x0005, 0x5ab1, 0x5ab2, 0x5ae4, 0x5ae5,
7114 0x5aaf, 0x5b33, 0x5b38, 0x5b69, 0x5b6a, 0x5b85, 0x5b86, 0x5b87,
7115 0x5b88, 0x5b89, 0x5b8a, 0x5c40, 0x5c67, 0x700c, 0x0002, 0x5a74,
7116 0x5aaf, 0x5aaf, 0x5ab0, 0x5ab0, 0x7830, 0x7930, 0xa106, 0x0120,
7117 0x7830, 0x7930, 0xa106, 0x1510, 0x7030, 0xa10a, 0x01f8, 0x1210,
7118 0x712c, 0xa10a, 0xa18a, 0x0002, 0x12d0, 0x080c, 0x15c0, 0x01b0,
7119 0x2d00, 0x705a, 0x7063, 0x0040, 0x2001, 0x0003, 0x7057, 0x0000,
7120 0x0126, 0x0006, 0x2091, 0x8000, 0x2009, 0xafec, 0x2104, 0xc085,
7121 0x200a, 0x000e, 0x700e, 0x012e, 0x080c, 0x163c, 0x0005, 0x080c,
7122 0x15c0, 0x0de0, 0x2d00, 0x705a, 0x080c, 0x15c0, 0x1108, 0x0c10,
7123 0x2d00, 0x7086, 0x7063, 0x0080, 0x2001, 0x0004, 0x08f8, 0x0005,
7124 0x0005, 0x0005, 0x700c, 0x0002, 0x5ab9, 0x5abc, 0x5aca, 0x5ae3,
7125 0x5ae3, 0x080c, 0x5a6d, 0x0005, 0x0126, 0x8001, 0x700e, 0x7058,
7126 0x0006, 0x080c, 0x5f90, 0x0120, 0x2091, 0x8000, 0x080c, 0x5a6d,
7127 0x00de, 0x0048, 0x0126, 0x8001, 0x700e, 0x080c, 0x5f90, 0x7058,
7128 0x2068, 0x7084, 0x705a, 0x6803, 0x0000, 0x6807, 0x0000, 0x6834,
7129 0xa084, 0x00ff, 0xa08a, 0x003a, 0x1218, 0x00db, 0x012e, 0x0005,
7130 0x012e, 0x080c, 0x5b8b, 0x0005, 0x0005, 0x0005, 0x00e6, 0x2071,
7131 0xade1, 0x700c, 0x0002, 0x5af0, 0x5af0, 0x5af0, 0x5af2, 0x5af5,
7132 0x00ee, 0x0005, 0x700f, 0x0001, 0x0010, 0x700f, 0x0002, 0x00ee,
7133 0x0005, 0x5b8b, 0x5b8b, 0x5ba7, 0x5b8b, 0x5d22, 0x5b8b, 0x5b8b,
7134 0x5b8b, 0x5b8b, 0x5b8b, 0x5ba7, 0x5d64, 0x5da7, 0x5df0, 0x5e04,
7135 0x5b8b, 0x5b8b, 0x5bc3, 0x5ba7, 0x5b8b, 0x5b8b, 0x5c1d, 0x5ead,
7136 0x5ec8, 0x5b8b, 0x5bc3, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5c13,
7137 0x5ec8, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b,
7138 0x5b8b, 0x5b8b, 0x5bd7, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b,
7139 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b, 0x5b8b,
7140 0x5b8b, 0x5b8b, 0x5bec, 0x7020, 0x2068, 0x080c, 0x15f0, 0x0005,
7141 0x700c, 0x0002, 0x5b3f, 0x5b42, 0x5b50, 0x5b68, 0x5b68, 0x080c,
7142 0x5a6d, 0x0005, 0x0126, 0x8001, 0x700e, 0x7058, 0x0006, 0x080c,
7143 0x5f90, 0x0120, 0x2091, 0x8000, 0x080c, 0x5a6d, 0x00de, 0x0048,
7144 0x0126, 0x8001, 0x700e, 0x080c, 0x5f90, 0x7058, 0x2068, 0x7084,
7145 0x705a, 0x6803, 0x0000, 0x6807, 0x0000, 0x6834, 0xa084, 0x00ff,
7146 0xa08a, 0x001a, 0x1218, 0x003b, 0x012e, 0x0005, 0x012e, 0x0419,
7147 0x0005, 0x0005, 0x0005, 0x5b8b, 0x5ba7, 0x5d0e, 0x5b8b, 0x5ba7,
7148 0x5b8b, 0x5ba7, 0x5ba7, 0x5b8b, 0x5ba7, 0x5d0e, 0x5ba7, 0x5ba7,
7149 0x5ba7, 0x5ba7, 0x5ba7, 0x5b8b, 0x5ba7, 0x5d0e, 0x5b8b, 0x5b8b,
7150 0x5ba7, 0x5b8b, 0x5b8b, 0x5b8b, 0x5ba7, 0x0005, 0x0005, 0x0005,
7151 0x0005, 0x0005, 0x0005, 0x7007, 0x0001, 0x6838, 0xa084, 0x00ff,
7152 0xc0d5, 0x683a, 0x0126, 0x2091, 0x8000, 0x080c, 0x510c, 0x012e,
7153 0x0005, 0x7007, 0x0001, 0x6838, 0xa084, 0x00ff, 0xc0e5, 0x683a,
7154 0x0126, 0x2091, 0x8000, 0x080c, 0x510c, 0x012e, 0x0005, 0x7007,
7155 0x0001, 0x6838, 0xa084, 0x00ff, 0xc0ed, 0x683a, 0x0126, 0x2091,
7156 0x8000, 0x080c, 0x510c, 0x012e, 0x0005, 0x7007, 0x0001, 0x6838,
7157 0xa084, 0x00ff, 0xc0dd, 0x683a, 0x0126, 0x2091, 0x8000, 0x080c,
7158 0x510c, 0x012e, 0x0005, 0x6834, 0x8007, 0xa084, 0x00ff, 0x0988,
7159 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x5cd0, 0x7007, 0x0006,
7160 0x7012, 0x2d00, 0x7016, 0x701a, 0x704b, 0x5cd0, 0x0005, 0x6834,
7161 0x8007, 0xa084, 0x00ff, 0x0904, 0x5b99, 0x8001, 0x1120, 0x7007,
7162 0x0001, 0x0804, 0x5ced, 0x7007, 0x0006, 0x7012, 0x2d00, 0x7016,
7163 0x701a, 0x704b, 0x5ced, 0x0005, 0x6834, 0x8007, 0xa084, 0x00ff,
7164 0xa086, 0x0001, 0x1904, 0x5b99, 0x7007, 0x0001, 0x2009, 0xad30,
7165 0x210c, 0x81ff, 0x11a8, 0x6838, 0xa084, 0x00ff, 0x683a, 0x6853,
7166 0x0000, 0x080c, 0x4ab1, 0x1108, 0x0005, 0x0126, 0x2091, 0x8000,
7167 0x6837, 0x0139, 0x684a, 0x6952, 0x080c, 0x510c, 0x012e, 0x0ca0,
7168 0x2001, 0x0028, 0x0c90, 0x684c, 0xa084, 0x00c0, 0xa086, 0x00c0,
7169 0x1120, 0x7007, 0x0001, 0x0804, 0x5ee0, 0x2d00, 0x7016, 0x701a,
7170 0x20a9, 0x0004, 0xa080, 0x0024, 0x2098, 0x20a1, 0xae0c, 0x53a3,
7171 0x6858, 0x7012, 0xa082, 0x0401, 0x1a04, 0x5bb5, 0x6a84, 0xa28a,
7172 0x0002, 0x1a04, 0x5bb5, 0x82ff, 0x1138, 0x6888, 0x698c, 0xa105,
7173 0x0118, 0x2001, 0x5ca3, 0x0018, 0xa280, 0x5c99, 0x2005, 0x70c6,
7174 0x7010, 0xa015, 0x0904, 0x5c85, 0x080c, 0x15c0, 0x1118, 0x7007,
7175 0x000f, 0x0005, 0x2d00, 0x7022, 0x70c4, 0x2060, 0x2c05, 0x6836,
7176 0xe004, 0xad00, 0x7096, 0xe008, 0xa20a, 0x1210, 0xa00e, 0x2200,
7177 0x7112, 0xe20c, 0x8003, 0x800b, 0xa296, 0x0004, 0x0108, 0xa108,
7178 0x719a, 0x810b, 0x719e, 0xae90, 0x0022, 0x080c, 0x1624, 0x7090,
7179 0xa08e, 0x0100, 0x0170, 0xa086, 0x0200, 0x0118, 0x7007, 0x0010,
7180 0x0005, 0x7020, 0x2068, 0x080c, 0x15f0, 0x7014, 0x2068, 0x0804,
7181 0x5bb5, 0x7020, 0x2068, 0x7018, 0x6802, 0x6807, 0x0000, 0x2d08,
7182 0x2068, 0x6906, 0x711a, 0x0804, 0x5c40, 0x7014, 0x2068, 0x7007,
7183 0x0001, 0x6884, 0xa005, 0x1128, 0x6888, 0x698c, 0xa105, 0x0108,
7184 0x00b1, 0x6834, 0xa084, 0x00ff, 0xa086, 0x001e, 0x0904, 0x5ee0,
7185 0x04b8, 0x5c9b, 0x5c9f, 0x0002, 0x0011, 0x0007, 0x0004, 0x000a,
7186 0x000f, 0x0005, 0x0006, 0x000a, 0x0011, 0x0005, 0x0004, 0x00f6,
7187 0x00e6, 0x00c6, 0x0076, 0x0066, 0x6f88, 0x6e8c, 0x6804, 0x2060,
7188 0xacf0, 0x0021, 0xacf8, 0x0027, 0x2009, 0x0005, 0x700c, 0x7816,
7189 0x7008, 0x7812, 0x7004, 0x7806, 0x7000, 0x7802, 0x7e0e, 0x7f0a,
7190 0x8109, 0x0128, 0xaef2, 0x0004, 0xaffa, 0x0006, 0x0c78, 0x6004,
7191 0xa065, 0x1d30, 0x006e, 0x007e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
7192 0x2009, 0xad30, 0x210c, 0x81ff, 0x1198, 0x6838, 0xa084, 0x00ff,
7193 0x683a, 0x080c, 0x4993, 0x1108, 0x0005, 0x080c, 0x51df, 0x0126,
7194 0x2091, 0x8000, 0x080c, 0x97fd, 0x080c, 0x510c, 0x012e, 0x0ca0,
7195 0x2001, 0x0028, 0x2009, 0x0000, 0x0c80, 0x2009, 0xad30, 0x210c,
7196 0x81ff, 0x11b0, 0x6858, 0xa005, 0x01b0, 0x6838, 0xa084, 0x00ff,
7197 0x683a, 0x6853, 0x0000, 0x080c, 0x4a55, 0x1108, 0x0005, 0x0126,
7198 0x2091, 0x8000, 0x080c, 0x51df, 0x080c, 0x510c, 0x012e, 0x0cb0,
7199 0x2001, 0x0028, 0x0ca0, 0x2001, 0x0000, 0x0c88, 0x7018, 0x6802,
7200 0x2d08, 0x2068, 0x6906, 0x711a, 0x7010, 0x8001, 0x7012, 0x0118,
7201 0x7007, 0x0006, 0x0030, 0x7014, 0x2068, 0x7007, 0x0001, 0x7048,
7202 0x080f, 0x0005, 0x7007, 0x0001, 0x6944, 0x810f, 0xa18c, 0x00ff,
7203 0x6848, 0xa084, 0x00ff, 0x20a9, 0x0001, 0xa096, 0x0001, 0x01b0,
7204 0x2009, 0x0000, 0x20a9, 0x00ff, 0xa096, 0x0002, 0x0178, 0xa005,
7205 0x11f0, 0x6944, 0x810f, 0xa18c, 0x00ff, 0x080c, 0x4cdc, 0x11b8,
7206 0x0066, 0x6e50, 0x080c, 0x4dcf, 0x006e, 0x0088, 0x0046, 0x2011,
7207 0xad0c, 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x4cdc,
7208 0x1110, 0x080c, 0x4f2d, 0x8108, 0x1f04, 0x5d4e, 0x00ce, 0x684c,
7209 0xd084, 0x1118, 0x080c, 0x15f0, 0x0005, 0x0126, 0x2091, 0x8000,
7210 0x080c, 0x510c, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007,
7211 0x0001, 0x2001, 0xad52, 0x2004, 0xd0a4, 0x0580, 0x2061, 0xb048,
7212 0x6100, 0xd184, 0x0178, 0x6858, 0xa084, 0x00ff, 0x1550, 0x6000,
7213 0xd084, 0x0520, 0x6004, 0xa005, 0x1538, 0x6003, 0x0000, 0x600b,
7214 0x0000, 0x00c8, 0x2011, 0x0001, 0x6860, 0xa005, 0x1110, 0x2001,
7215 0x001e, 0x8000, 0x6016, 0x6858, 0xa084, 0x00ff, 0x0178, 0x6006,
7216 0x6858, 0x8007, 0xa084, 0x00ff, 0x0148, 0x600a, 0x6858, 0x8000,
7217 0x1108, 0xc28d, 0x6202, 0x012e, 0x0804, 0x5f7f, 0x012e, 0x0804,
7218 0x5f79, 0x012e, 0x0804, 0x5f73, 0x012e, 0x0804, 0x5f76, 0x0126,
7219 0x2091, 0x8000, 0x7007, 0x0001, 0x2001, 0xad52, 0x2004, 0xd0a4,
7220 0x05e0, 0x2061, 0xb048, 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308,
7221 0xd08c, 0x1530, 0x6c48, 0xa484, 0x0003, 0x0170, 0x6958, 0xa18c,
7222 0x00ff, 0x8001, 0x1120, 0x2100, 0xa210, 0x0620, 0x0028, 0x8001,
7223 0x1508, 0x2100, 0xa212, 0x02f0, 0xa484, 0x000c, 0x0188, 0x6958,
7224 0x810f, 0xa18c, 0x00ff, 0xa082, 0x0004, 0x1120, 0x2100, 0xa318,
7225 0x0288, 0x0030, 0xa082, 0x0004, 0x1168, 0x2100, 0xa31a, 0x0250,
7226 0x6860, 0xa005, 0x0110, 0x8000, 0x6016, 0x6206, 0x630a, 0x012e,
7227 0x0804, 0x5f7f, 0x012e, 0x0804, 0x5f7c, 0x012e, 0x0804, 0x5f79,
7228 0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0xb048, 0x6300,
7229 0xd38c, 0x1120, 0x6308, 0x8318, 0x0220, 0x630a, 0x012e, 0x0804,
7230 0x5f8d, 0x012e, 0x0804, 0x5f7c, 0x0126, 0x00c6, 0x2091, 0x8000,
7231 0x7007, 0x0001, 0x684c, 0xd0ac, 0x0148, 0x00c6, 0x2061, 0xb048,
7232 0x6000, 0xa084, 0xfcff, 0x6002, 0x00ce, 0x0448, 0x6858, 0xa005,
7233 0x05d0, 0x685c, 0xa065, 0x0598, 0x2001, 0xad30, 0x2004, 0xa005,
7234 0x0118, 0x080c, 0x974e, 0x0068, 0x6013, 0x0400, 0x6057, 0x0000,
7235 0x694c, 0xd1a4, 0x0110, 0x6950, 0x6156, 0x2009, 0x0041, 0x080c,
7236 0x80a7, 0x6958, 0xa18c, 0xff00, 0xa186, 0x2000, 0x1140, 0x0026,
7237 0x2009, 0x0000, 0x2011, 0xfdff, 0x080c, 0x663f, 0x002e, 0x684c,
7238 0xd0c4, 0x0148, 0x2061, 0xb048, 0x6000, 0xd08c, 0x1120, 0x6008,
7239 0x8000, 0x0208, 0x600a, 0x00ce, 0x012e, 0x0804, 0x5f7f, 0x00ce,
7240 0x012e, 0x0804, 0x5f79, 0x6954, 0xa186, 0x002e, 0x0d40, 0xa186,
7241 0x002d, 0x0d28, 0xa186, 0x0045, 0x0510, 0xa186, 0x002a, 0x1130,
7242 0x2001, 0xad0c, 0x200c, 0xc194, 0x2102, 0x08c8, 0xa186, 0x0020,
7243 0x0170, 0xa186, 0x0029, 0x1d18, 0x6944, 0xa18c, 0xff00, 0x810f,
7244 0x080c, 0x4cdc, 0x1960, 0x6000, 0xc0e4, 0x6002, 0x0840, 0x685c,
7245 0xa065, 0x09a8, 0x2001, 0xafa3, 0x2004, 0x6016, 0x0800, 0x685c,
7246 0xa065, 0x0968, 0x00e6, 0x6860, 0xa075, 0x2001, 0xad30, 0x2004,
7247 0xa005, 0x0150, 0x080c, 0x974e, 0x8eff, 0x0118, 0x2e60, 0x080c,
7248 0x974e, 0x00ee, 0x0804, 0x5e3f, 0x6020, 0xc0dc, 0xc0d5, 0x6022,
7249 0x2e60, 0x6007, 0x003a, 0x6870, 0xa005, 0x0130, 0x6007, 0x003b,
7250 0x6874, 0x602a, 0x6878, 0x6012, 0x6003, 0x0001, 0x080c, 0x67a8,
7251 0x080c, 0x6c50, 0x00ee, 0x0804, 0x5e3f, 0x2061, 0xb048, 0x6000,
7252 0xd084, 0x0190, 0xd08c, 0x1904, 0x5f8d, 0x0126, 0x2091, 0x8000,
7253 0x6204, 0x8210, 0x0220, 0x6206, 0x012e, 0x0804, 0x5f8d, 0x012e,
7254 0x6853, 0x0016, 0x0804, 0x5f86, 0x6853, 0x0007, 0x0804, 0x5f86,
7255 0x6834, 0x8007, 0xa084, 0x00ff, 0x1118, 0x080c, 0x5b99, 0x0078,
7256 0x2030, 0x8001, 0x1120, 0x7007, 0x0001, 0x0051, 0x0040, 0x7007,
7257 0x0006, 0x7012, 0x2d00, 0x7016, 0x701a, 0x704b, 0x5ee0, 0x0005,
7258 0x00e6, 0x0126, 0x2091, 0x8000, 0x2009, 0xad30, 0x210c, 0x81ff,
7259 0x1904, 0x5f5b, 0x2009, 0xad0c, 0x210c, 0xd194, 0x1904, 0x5f63,
7260 0x6848, 0x2070, 0xae82, 0xb400, 0x0a04, 0x5f4f, 0x2001, 0xad16,
7261 0x2004, 0xae02, 0x1a04, 0x5f4f, 0x2061, 0xb048, 0x6100, 0xa184,
7262 0x0301, 0xa086, 0x0001, 0x15a8, 0x711c, 0xa186, 0x0006, 0x15b0,
7263 0x7018, 0xa005, 0x0904, 0x5f5b, 0x2004, 0xd0e4, 0x1904, 0x5f5e,
7264 0x7020, 0xd0dc, 0x1904, 0x5f66, 0x6853, 0x0000, 0x6803, 0x0000,
7265 0x2d08, 0x7010, 0xa005, 0x1158, 0x7112, 0x684c, 0xd0f4, 0x1904,
7266 0x5f69, 0x2e60, 0x080c, 0x65aa, 0x012e, 0x00ee, 0x0005, 0x2068,
7267 0x6800, 0xa005, 0x1de0, 0x6902, 0x2168, 0x684c, 0xd0f4, 0x15c8,
7268 0x012e, 0x00ee, 0x0005, 0x012e, 0x00ee, 0x6853, 0x0006, 0x0804,
7269 0x5f86, 0xd184, 0x0dc0, 0xd1c4, 0x11a8, 0x00b8, 0x6944, 0xa18c,
7270 0xff00, 0x810f, 0x080c, 0x4cdc, 0x11c8, 0x6000, 0xd0e4, 0x11b0,
7271 0x711c, 0xa186, 0x0007, 0x1118, 0x6853, 0x0002, 0x0088, 0x6853,
7272 0x0008, 0x0070, 0x6853, 0x000e, 0x0058, 0x6853, 0x0017, 0x0040,
7273 0x6853, 0x0035, 0x0028, 0x6853, 0x0028, 0x0010, 0x6853, 0x0029,
7274 0x012e, 0x00ee, 0x0418, 0x6853, 0x002a, 0x0cd0, 0x6853, 0x0045,
7275 0x0cb8, 0x2e60, 0x2019, 0x0002, 0x6017, 0x0014, 0x080c, 0xa566,
7276 0x012e, 0x00ee, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004,
7277 0x0040, 0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009,
7278 0x0001, 0x6854, 0xa084, 0xff00, 0xa105, 0x6856, 0x0126, 0x2091,
7279 0x8000, 0x080c, 0x510c, 0x012e, 0x0005, 0x080c, 0x15f0, 0x0005,
7280 0x702c, 0x7130, 0x8108, 0xa102, 0x0230, 0xa00e, 0x7034, 0x7072,
7281 0x7038, 0x7076, 0x0058, 0x7070, 0xa080, 0x0040, 0x7072, 0x1230,
7282 0x7074, 0xa081, 0x0000, 0x7076, 0xa085, 0x0001, 0x7932, 0x7132,
7283 0x0005, 0x00d6, 0x080c, 0x65a1, 0x00de, 0x0005, 0x00d6, 0x2011,
7284 0x0004, 0x2204, 0xa085, 0x8002, 0x2012, 0x00de, 0x0005, 0x20e1,
7285 0x0002, 0x3d08, 0x20e1, 0x2000, 0x3d00, 0xa084, 0x7000, 0x0118,
7286 0xa086, 0x1000, 0x1540, 0x20e1, 0x0000, 0x3d00, 0xa094, 0xff00,
7287 0x8217, 0xa084, 0xf000, 0xa086, 0x3000, 0x1118, 0x080c, 0x61c6,
7288 0x00b0, 0x20e1, 0x0004, 0x3d60, 0xd1bc, 0x1108, 0x3e60, 0xac84,
7289 0x0007, 0x1188, 0xac82, 0xb400, 0x0270, 0x6858, 0xac02, 0x1258,
7290 0x6120, 0xd1f4, 0x1160, 0x2009, 0x0047, 0x080c, 0x80a7, 0x7a1c,
7291 0xd284, 0x1968, 0x0005, 0xa016, 0x080c, 0x1824, 0x0cc0, 0x0cd8,
7292 0x781c, 0xd08c, 0x0500, 0x0156, 0x0136, 0x0146, 0x20e1, 0x3000,
7293 0x3d20, 0x3e28, 0xa584, 0x0076, 0x1530, 0xa484, 0x7000, 0xa086,
7294 0x1000, 0x11a8, 0x080c, 0x604e, 0x01f0, 0x20e1, 0x3000, 0x7828,
7295 0x7828, 0x080c, 0x606a, 0x014e, 0x013e, 0x015e, 0x2009, 0xafcf,
7296 0x2104, 0xa005, 0x1108, 0x0005, 0x080c, 0x6c50, 0x0ce0, 0xa484,
7297 0x7000, 0x1518, 0x0499, 0x01b8, 0x7000, 0xa084, 0xff00, 0xa086,
7298 0x8100, 0x0d18, 0x0080, 0xd5a4, 0x0158, 0x080c, 0x1d86, 0x20e1,
7299 0x9010, 0x2001, 0x0160, 0x2502, 0x2001, 0x0138, 0x2202, 0x0048,
7300 0x00e9, 0x6883, 0x0000, 0x080c, 0xac59, 0x20e1, 0x3000, 0x7828,
7301 0x7828, 0x014e, 0x013e, 0x015e, 0x08b0, 0x0081, 0x1130, 0x7000,
7302 0xa084, 0xff00, 0xa086, 0x8100, 0x1d70, 0x080c, 0xac59, 0x20e1,
7303 0x3000, 0x7828, 0x7828, 0x080c, 0x642d, 0x0c58, 0xa484, 0x01ff,
7304 0x6882, 0xa005, 0x0160, 0xa080, 0x001f, 0xa084, 0x03f8, 0x80ac,
7305 0x20e1, 0x1000, 0x2ea0, 0x2099, 0x020a, 0x53a5, 0x0005, 0x20a9,
7306 0x000c, 0x20e1, 0x1000, 0x2ea0, 0x2099, 0x020a, 0x53a5, 0xa085,
7307 0x0001, 0x0ca0, 0x7000, 0xa084, 0xff00, 0xa08c, 0xf000, 0x8007,
7308 0xa196, 0x0000, 0x1118, 0x0804, 0x62cf, 0x0005, 0xa196, 0x2000,
7309 0x1148, 0x6900, 0xa18e, 0x0001, 0x1118, 0x080c, 0x41d1, 0x0ca8,
7310 0x0039, 0x0c98, 0xa196, 0x8000, 0x1d80, 0x080c, 0x6372, 0x0c68,
7311 0x00c6, 0x6a80, 0x82ff, 0x0904, 0x61c0, 0x7110, 0xa18c, 0xff00,
7312 0x810f, 0xa196, 0x0001, 0x0120, 0xa196, 0x0023, 0x1904, 0x61c0,
7313 0xa08e, 0x0023, 0x1570, 0x080c, 0x6408, 0x0904, 0x61c0, 0x7124,
7314 0x610a, 0x7030, 0xa08e, 0x0200, 0x1150, 0x7034, 0xa005, 0x1904,
7315 0x61c0, 0x2009, 0x0015, 0x080c, 0x80a7, 0x0804, 0x61c0, 0xa08e,
7316 0x0214, 0x0118, 0xa08e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c,
7317 0x80a7, 0x0804, 0x61c0, 0xa08e, 0x0100, 0x1904, 0x61c0, 0x7034,
7318 0xa005, 0x1904, 0x61c0, 0x2009, 0x0016, 0x080c, 0x80a7, 0x0804,
7319 0x61c0, 0xa08e, 0x0022, 0x1904, 0x61c0, 0x7030, 0xa08e, 0x0300,
7320 0x1580, 0x68d0, 0xd0a4, 0x0528, 0xc0b5, 0x68d2, 0x7100, 0xa18c,
7321 0x00ff, 0x696e, 0x7004, 0x6872, 0x00f6, 0x2079, 0x0100, 0x79e6,
7322 0x78ea, 0x0006, 0xa084, 0x00ff, 0x0016, 0x2008, 0x080c, 0x26a0,
7323 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x2676, 0x694e,
7324 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0xad00, 0x70a2,
7325 0x00ee, 0x7034, 0xa005, 0x1904, 0x61c0, 0x2009, 0x0017, 0x0804,
7326 0x6193, 0xa08e, 0x0400, 0x1158, 0x7034, 0xa005, 0x1904, 0x61c0,
7327 0x68d0, 0xc0a5, 0x68d2, 0x2009, 0x0030, 0x0804, 0x6193, 0xa08e,
7328 0x0500, 0x1140, 0x7034, 0xa005, 0x1904, 0x61c0, 0x2009, 0x0018,
7329 0x0804, 0x6193, 0xa08e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804,
7330 0x6193, 0xa08e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x6193,
7331 0xa08e, 0x5200, 0x1140, 0x7034, 0xa005, 0x1904, 0x61c0, 0x2009,
7332 0x001b, 0x0804, 0x6193, 0xa08e, 0x5000, 0x1140, 0x7034, 0xa005,
7333 0x1904, 0x61c0, 0x2009, 0x001c, 0x0804, 0x6193, 0xa08e, 0x1300,
7334 0x1120, 0x2009, 0x0034, 0x0804, 0x6193, 0xa08e, 0x1200, 0x1140,
7335 0x7034, 0xa005, 0x1904, 0x61c0, 0x2009, 0x0024, 0x0804, 0x6193,
7336 0xa08c, 0xff00, 0xa18e, 0x2400, 0x1118, 0x2009, 0x002d, 0x04d8,
7337 0xa08c, 0xff00, 0xa18e, 0x5300, 0x1118, 0x2009, 0x002a, 0x0498,
7338 0xa08e, 0x0f00, 0x1118, 0x2009, 0x0020, 0x0468, 0xa08e, 0x5300,
7339 0x1108, 0x00d8, 0xa08e, 0x6104, 0x11c0, 0x2011, 0xb28d, 0x8208,
7340 0x2204, 0xa082, 0x0004, 0x20a8, 0x95ac, 0x95ac, 0x2011, 0x8015,
7341 0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x3c5c, 0x004e, 0x8108,
7342 0x1f04, 0x6176, 0x2009, 0x0023, 0x0070, 0xa08e, 0x6000, 0x1118,
7343 0x2009, 0x003f, 0x0040, 0xa08e, 0x7800, 0x1118, 0x2009, 0x0045,
7344 0x0010, 0x2009, 0x001d, 0x0016, 0x2011, 0xb283, 0x2204, 0x8211,
7345 0x220c, 0x080c, 0x2676, 0x1530, 0x080c, 0x4c80, 0x1518, 0x6612,
7346 0x6516, 0x86ff, 0x0180, 0x001e, 0x0016, 0xa186, 0x0017, 0x1158,
7347 0x686c, 0xa606, 0x1140, 0x6870, 0xa506, 0xa084, 0xff00, 0x1118,
7348 0x6000, 0xc0f5, 0x6002, 0x00c6, 0x080c, 0x8022, 0x0168, 0x001e,
7349 0x611a, 0x601f, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c, 0x80a7,
7350 0x00ce, 0x0005, 0x001e, 0x0ce0, 0x00ce, 0x0ce0, 0x00c6, 0x0046,
7351 0x080c, 0x6221, 0x1904, 0x621e, 0xa184, 0xff00, 0x8007, 0xa086,
7352 0x0008, 0x1904, 0x621e, 0xa28e, 0x0033, 0x11e8, 0x080c, 0x6408,
7353 0x0904, 0x621e, 0x7124, 0x610a, 0x7030, 0xa08e, 0x0200, 0x1140,
7354 0x7034, 0xa005, 0x15d8, 0x2009, 0x0015, 0x080c, 0x80a7, 0x04b0,
7355 0xa08e, 0x0100, 0x1598, 0x7034, 0xa005, 0x1580, 0x2009, 0x0016,
7356 0x080c, 0x80a7, 0x0458, 0xa28e, 0x0032, 0x1540, 0x7030, 0xa08e,
7357 0x1400, 0x1520, 0x2009, 0x0038, 0x0016, 0x2011, 0xb283, 0x2204,
7358 0x8211, 0x220c, 0x080c, 0x2676, 0x11c0, 0x080c, 0x4c80, 0x11a8,
7359 0x6612, 0x6516, 0x00c6, 0x080c, 0x8022, 0x0170, 0x001e, 0x611a,
7360 0x080c, 0x9956, 0x601f, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c,
7361 0x80a7, 0x080c, 0x6c50, 0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce,
7362 0x0005, 0x00f6, 0x00d6, 0x0026, 0x0016, 0x0136, 0x0146, 0x0156,
7363 0x3c00, 0x0006, 0x2079, 0x0030, 0x2069, 0x0200, 0x080c, 0x1df2,
7364 0x1590, 0x080c, 0x1ce2, 0x05c8, 0x04d9, 0x1130, 0x7908, 0xa18c,
7365 0x1fff, 0xa182, 0x0011, 0x1688, 0x20a9, 0x000c, 0x20e1, 0x0000,
7366 0x2ea0, 0x2099, 0x020a, 0x53a5, 0x20e1, 0x2000, 0x2001, 0x020a,
7367 0x2004, 0x7a0c, 0x7808, 0xa080, 0x0007, 0xa084, 0x1ff8, 0x0401,
7368 0x1120, 0xa08a, 0x0140, 0x1a0c, 0x14f6, 0x80ac, 0x20e1, 0x6000,
7369 0x2099, 0x020a, 0x53a5, 0x20e1, 0x7000, 0x6828, 0x6828, 0x7803,
7370 0x0004, 0xa294, 0x0070, 0x000e, 0x20e0, 0x015e, 0x014e, 0x013e,
7371 0x001e, 0x002e, 0x00de, 0x00fe, 0x0005, 0xa085, 0x0001, 0x0c98,
7372 0x0006, 0x2001, 0x0111, 0x2004, 0xa084, 0x0003, 0x000e, 0x0005,
7373 0x0046, 0x00e6, 0x00d6, 0x2028, 0x2130, 0xa696, 0x00ff, 0x1198,
7374 0xa596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804, 0x62ca, 0xa596,
7375 0xfffe, 0x1118, 0x2009, 0x007e, 0x04e8, 0xa596, 0xfffc, 0x1118,
7376 0x2009, 0x0080, 0x04b8, 0x2011, 0x0000, 0x2019, 0xad34, 0x231c,
7377 0xd3ac, 0x0138, 0x2021, 0x0000, 0x20a9, 0x00ff, 0x2071, 0xae34,
7378 0x0030, 0x2021, 0x0081, 0x20a9, 0x007e, 0x2071, 0xaeb5, 0x2e1c,
7379 0x83ff, 0x1128, 0x82ff, 0x1198, 0x2410, 0xc2fd, 0x0080, 0x2368,
7380 0x6f10, 0x0006, 0x2100, 0xa706, 0x000e, 0x6b14, 0x1120, 0xa346,
7381 0x1110, 0x2408, 0x0078, 0x87ff, 0x1110, 0x83ff, 0x0d58, 0x8420,
7382 0x8e70, 0x1f04, 0x62a7, 0x82ff, 0x1118, 0xa085, 0x0001, 0x0018,
7383 0xc2fc, 0x2208, 0xa006, 0x00de, 0x00ee, 0x004e, 0x0005, 0xa084,
7384 0x0007, 0x000a, 0x0005, 0x62db, 0x62db, 0x62db, 0x641a, 0x62db,
7385 0x62dc, 0x62f1, 0x635d, 0x0005, 0x7110, 0xd1bc, 0x0188, 0x7120,
7386 0x2160, 0xac8c, 0x0007, 0x1160, 0xac8a, 0xb400, 0x0248, 0x6858,
7387 0xac02, 0x1230, 0x7124, 0x610a, 0x2009, 0x0046, 0x080c, 0x80a7,
7388 0x0005, 0x00c6, 0x7110, 0xd1bc, 0x1904, 0x6344, 0x2011, 0xb283,
7389 0x2204, 0x8211, 0x220c, 0x080c, 0x2676, 0x1904, 0x6344, 0x080c,
7390 0x4c80, 0x1904, 0x6344, 0x6612, 0x6516, 0x6000, 0xd0ec, 0x15e0,
7391 0x6204, 0xa294, 0xff00, 0x8217, 0xa286, 0x0006, 0x0160, 0x080c,
7392 0x574f, 0x11d0, 0x6204, 0xa294, 0x00ff, 0xa286, 0x0006, 0x11a0,
7393 0xa295, 0x0600, 0x6206, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0530,
7394 0x611a, 0x601f, 0x0006, 0x7120, 0x610a, 0x7130, 0x6152, 0x2009,
7395 0x0044, 0x080c, 0x80a7, 0x00c0, 0x00c6, 0x080c, 0x8022, 0x001e,
7396 0x0198, 0x611a, 0x601f, 0x0004, 0x7120, 0x610a, 0xa286, 0x0004,
7397 0x1118, 0x6007, 0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001,
7398 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00ce, 0x0005, 0x00c6, 0x080c,
7399 0x9807, 0x001e, 0x0dc8, 0x611a, 0x601f, 0x0006, 0x7120, 0x610a,
7400 0x7130, 0x6152, 0x6013, 0x0300, 0x6003, 0x0001, 0x6007, 0x0041,
7401 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0c38, 0x7110, 0xd1bc, 0x0188,
7402 0x7020, 0x2060, 0xac84, 0x0007, 0x1160, 0xac82, 0xb400, 0x0248,
7403 0x6858, 0xac02, 0x1230, 0x7124, 0x610a, 0x2009, 0x0045, 0x080c,
7404 0x80a7, 0x0005, 0x7110, 0xa18c, 0xff00, 0x810f, 0xa18e, 0x0000,
7405 0x1130, 0xa084, 0x000f, 0xa08a, 0x0006, 0x1208, 0x000b, 0x0005,
7406 0x6386, 0x6387, 0x6386, 0x6386, 0x63f0, 0x63fc, 0x0005, 0x7110,
7407 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x63ef, 0x700c, 0x7108,
7408 0x080c, 0x2676, 0x1904, 0x63ef, 0x080c, 0x4c80, 0x1904, 0x63ef,
7409 0x6612, 0x6516, 0x6204, 0x7110, 0xd1bc, 0x01f8, 0xa28c, 0x00ff,
7410 0xa186, 0x0004, 0x0118, 0xa186, 0x0006, 0x15c8, 0x00c6, 0x080c,
7411 0x6408, 0x00ce, 0x0904, 0x63ef, 0x00c6, 0x080c, 0x8022, 0x001e,
7412 0x05f0, 0x611a, 0x080c, 0x9956, 0x601f, 0x0002, 0x7120, 0x610a,
7413 0x2009, 0x0088, 0x080c, 0x80a7, 0x0490, 0xa28c, 0x00ff, 0xa186,
7414 0x0006, 0x0160, 0xa186, 0x0004, 0x0148, 0xa294, 0xff00, 0x8217,
7415 0xa286, 0x0004, 0x0118, 0xa286, 0x0006, 0x1188, 0x00c6, 0x080c,
7416 0x8022, 0x001e, 0x01e0, 0x611a, 0x080c, 0x9956, 0x601f, 0x0005,
7417 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0x80a7, 0x0080, 0x00c6,
7418 0x080c, 0x8022, 0x001e, 0x0158, 0x611a, 0x080c, 0x9956, 0x601f,
7419 0x0004, 0x7120, 0x610a, 0x2009, 0x0001, 0x080c, 0x80a7, 0x0005,
7420 0x7110, 0xd1bc, 0x0140, 0x00a1, 0x0130, 0x7124, 0x610a, 0x2009,
7421 0x0089, 0x080c, 0x80a7, 0x0005, 0x7110, 0xd1bc, 0x0140, 0x0041,
7422 0x0130, 0x7124, 0x610a, 0x2009, 0x008a, 0x080c, 0x80a7, 0x0005,
7423 0x7020, 0x2060, 0xac84, 0x0007, 0x1158, 0xac82, 0xb400, 0x0240,
7424 0x2001, 0xad16, 0x2004, 0xac02, 0x1218, 0xa085, 0x0001, 0x0005,
7425 0xa006, 0x0ce8, 0x7110, 0xd1bc, 0x1178, 0x7024, 0x2060, 0xac84,
7426 0x0007, 0x1150, 0xac82, 0xb400, 0x0238, 0x6858, 0xac02, 0x1220,
7427 0x2009, 0x0051, 0x080c, 0x80a7, 0x0005, 0x2031, 0x0105, 0x0069,
7428 0x0005, 0x2031, 0x0206, 0x0049, 0x0005, 0x2031, 0x0207, 0x0029,
7429 0x0005, 0x2031, 0x0213, 0x0009, 0x0005, 0x00c6, 0x00d6, 0x00f6,
7430 0x7000, 0xa084, 0xf000, 0xa086, 0xc000, 0x05b0, 0x080c, 0x8022,
7431 0x0598, 0x0066, 0x00c6, 0x0046, 0x2011, 0xb283, 0x2204, 0x8211,
7432 0x220c, 0x080c, 0x2676, 0x1580, 0x080c, 0x4c80, 0x1568, 0x6612,
7433 0x6516, 0x2c00, 0x004e, 0x00ce, 0x601a, 0x080c, 0x9956, 0x080c,
7434 0x15d9, 0x01f0, 0x2d00, 0x6056, 0x6803, 0x0000, 0x6837, 0x0000,
7435 0x6c3a, 0xadf8, 0x000f, 0x20a9, 0x000e, 0x2fa0, 0x2e98, 0x53a3,
7436 0x006e, 0x6612, 0x6007, 0x003e, 0x601f, 0x0001, 0x6003, 0x0001,
7437 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00fe, 0x00de, 0x00ce, 0x0005,
7438 0x080c, 0x8078, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x2071,
7439 0xafda, 0x7003, 0x0003, 0x700f, 0x0361, 0xa006, 0x701a, 0x7012,
7440 0x7017, 0xb400, 0x7007, 0x0000, 0x7026, 0x702b, 0x7841, 0x7032,
7441 0x7037, 0x789d, 0x703b, 0xffff, 0x703f, 0xffff, 0x7042, 0x7047,
7442 0x41b3, 0x0005, 0x2071, 0xafda, 0x1d04, 0x64fc, 0x2091, 0x6000,
7443 0x700c, 0x8001, 0x700e, 0x1180, 0x700f, 0x0361, 0x7007, 0x0001,
7444 0x0126, 0x2091, 0x8000, 0x7040, 0xa00d, 0x0148, 0x8109, 0x7142,
7445 0x1130, 0x7044, 0x080f, 0x0018, 0x0126, 0x2091, 0x8000, 0x7024,
7446 0xa00d, 0x0188, 0x7020, 0x8001, 0x7022, 0x1168, 0x7023, 0x0009,
7447 0x8109, 0x7126, 0xa186, 0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff,
7448 0x1110, 0x7028, 0x080f, 0x7030, 0xa00d, 0x0158, 0x702c, 0x8001,
7449 0x702e, 0x1138, 0x702f, 0x0009, 0x8109, 0x7132, 0x1110, 0x7034,
7450 0x080f, 0x7038, 0xa005, 0x0118, 0x0310, 0x8001, 0x703a, 0x703c,
7451 0xa005, 0x0118, 0x0310, 0x8001, 0x703e, 0x7018, 0xa00d, 0x0158,
7452 0x7008, 0x8001, 0x700a, 0x1138, 0x700b, 0x0009, 0x8109, 0x711a,
7453 0x1110, 0x701c, 0x080f, 0x012e, 0x7004, 0x0002, 0x6522, 0x6523,
7454 0x653b, 0x00e6, 0x2071, 0xafda, 0x7018, 0xa005, 0x1120, 0x711a,
7455 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071,
7456 0xafda, 0x701c, 0xa206, 0x1110, 0x701a, 0x701e, 0x000e, 0x00ee,
7457 0x0005, 0x00e6, 0x2071, 0xafda, 0x6088, 0xa102, 0x0208, 0x618a,
7458 0x00ee, 0x0005, 0x0005, 0x7110, 0x080c, 0x4cdc, 0x1158, 0x6088,
7459 0x8001, 0x0240, 0x608a, 0x1130, 0x0126, 0x2091, 0x8000, 0x080c,
7460 0x6c50, 0x012e, 0x8108, 0xa182, 0x00ff, 0x0218, 0xa00e, 0x7007,
7461 0x0002, 0x7112, 0x0005, 0x7014, 0x2060, 0x0126, 0x2091, 0x8000,
7462 0x603c, 0xa005, 0x0128, 0x8001, 0x603e, 0x1110, 0x080c, 0x9846,
7463 0x6014, 0xa005, 0x0500, 0x8001, 0x6016, 0x11e8, 0x611c, 0xa186,
7464 0x0003, 0x0118, 0xa186, 0x0006, 0x11a0, 0x6010, 0x2068, 0x6854,
7465 0xa08a, 0x199a, 0x0270, 0xa082, 0x1999, 0x6856, 0xa08a, 0x199a,
7466 0x0210, 0x2001, 0x1999, 0x8003, 0x800b, 0x810b, 0xa108, 0x6116,
7467 0x0010, 0x080c, 0x9350, 0x012e, 0xac88, 0x0018, 0x7116, 0x2001,
7468 0xe400, 0xa102, 0x0220, 0x7017, 0xb400, 0x7007, 0x0000, 0x0005,
7469 0x00e6, 0x2071, 0xafda, 0x7027, 0x07d0, 0x7023, 0x0009, 0x00ee,
7470 0x0005, 0x2001, 0xafe3, 0x2003, 0x0000, 0x0005, 0x00e6, 0x2071,
7471 0xafda, 0x7132, 0x702f, 0x0009, 0x00ee, 0x0005, 0x2011, 0xafe6,
7472 0x2013, 0x0000, 0x0005, 0x00e6, 0x2071, 0xafda, 0x711a, 0x721e,
7473 0x700b, 0x0009, 0x00ee, 0x0005, 0x00c6, 0x2061, 0xb048, 0x00ce,
7474 0x0005, 0xa184, 0x000f, 0x8003, 0x8003, 0x8003, 0xa080, 0xb048,
7475 0x2060, 0x0005, 0x6854, 0xa08a, 0x199a, 0x0210, 0x2001, 0x1999,
7476 0xa005, 0x1150, 0x00c6, 0x2061, 0xb048, 0x6014, 0x00ce, 0xa005,
7477 0x1138, 0x2001, 0x001e, 0x0020, 0xa08e, 0xffff, 0x1108, 0xa006,
7478 0x8003, 0x800b, 0x810b, 0xa108, 0x6116, 0x684c, 0xa08c, 0x00c0,
7479 0xa18e, 0x00c0, 0x05b0, 0xd0b4, 0x1138, 0xd0bc, 0x1528, 0x2009,
7480 0x0006, 0x080c, 0x661a, 0x0005, 0xd0fc, 0x0130, 0xa084, 0x0003,
7481 0x0118, 0xa086, 0x0003, 0x15c0, 0x6020, 0xd0d4, 0x0130, 0xc0d4,
7482 0x6022, 0x6860, 0x602a, 0x685c, 0x602e, 0x2009, 0xad73, 0x2104,
7483 0xd084, 0x0128, 0x2009, 0x0042, 0x080c, 0x80a7, 0x0005, 0x2009,
7484 0x0043, 0x080c, 0x80a7, 0x0005, 0xd0fc, 0x0130, 0xa084, 0x0003,
7485 0x0118, 0xa086, 0x0003, 0x11c0, 0x2009, 0x0042, 0x080c, 0x80a7,
7486 0x0005, 0xd0fc, 0x0150, 0xa084, 0x0003, 0xa08e, 0x0002, 0x0138,
7487 0x2009, 0x0041, 0x080c, 0x80a7, 0x0005, 0x0051, 0x0ce8, 0x2009,
7488 0x0043, 0x080c, 0x80a7, 0x0cc0, 0x2009, 0x0004, 0x0019, 0x0005,
7489 0x2009, 0x0001, 0x00d6, 0x6010, 0xa0ec, 0xf000, 0x01f0, 0x2068,
7490 0x6952, 0x6800, 0x6012, 0xa186, 0x0001, 0x1188, 0x694c, 0xa18c,
7491 0x8100, 0xa18e, 0x8100, 0x1158, 0x00c6, 0x2061, 0xb048, 0x6200,
7492 0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce, 0x080c,
7493 0x510c, 0x6010, 0xa06d, 0x190c, 0x65aa, 0x00de, 0x0005, 0x0156,
7494 0x00c6, 0x2061, 0xb048, 0x6000, 0x81ff, 0x0110, 0xa205, 0x0008,
7495 0xa204, 0x6002, 0x00ce, 0x015e, 0x0005, 0x6800, 0xd08c, 0x1138,
7496 0x6808, 0xa005, 0x0120, 0x8001, 0x680a, 0xa085, 0x0001, 0x0005,
7497 0x20a9, 0x0010, 0xa006, 0x8004, 0x8086, 0x818e, 0x1208, 0xa200,
7498 0x1f04, 0x665c, 0x8086, 0x818e, 0x0005, 0x0156, 0x20a9, 0x0010,
7499 0xa005, 0x01b8, 0xa11a, 0x12a8, 0x8213, 0x818d, 0x0228, 0xa11a,
7500 0x1220, 0x1f04, 0x666c, 0x0028, 0xa11a, 0x2308, 0x8210, 0x1f04,
7501 0x666c, 0x0006, 0x3200, 0xa084, 0xefff, 0x2080, 0x000e, 0x015e,
7502 0x0005, 0x0006, 0x3200, 0xa085, 0x1000, 0x0cb8, 0x0126, 0x2091,
7503 0x2800, 0x2079, 0xafc7, 0x012e, 0x00d6, 0x2069, 0xafc7, 0x6803,
7504 0x0005, 0x2069, 0x0004, 0x2d04, 0xa085, 0x8001, 0x206a, 0x00de,
7505 0x0005, 0x00c6, 0x6027, 0x0001, 0x7804, 0xa084, 0x0007, 0x0002,
7506 0x66aa, 0x66cb, 0x671e, 0x66b0, 0x66cb, 0x66aa, 0x66a8, 0x66a8,
7507 0x080c, 0x14f6, 0x080c, 0x6581, 0x080c, 0x6c50, 0x00ce, 0x0005,
7508 0x62c0, 0x82ff, 0x1110, 0x00ce, 0x0005, 0x2011, 0x481b, 0x080c,
7509 0x650d, 0x7828, 0xa092, 0x00c8, 0x1228, 0x8000, 0x782a, 0x080c,
7510 0x4855, 0x0c88, 0x080c, 0x481b, 0x7807, 0x0003, 0x7827, 0x0000,
7511 0x782b, 0x0000, 0x0c40, 0x080c, 0x6581, 0x3c00, 0x0006, 0x2011,
7512 0x0209, 0x20e1, 0x4000, 0x2214, 0x000e, 0x20e0, 0x82ff, 0x0178,
7513 0x62c0, 0x82ff, 0x1160, 0x782b, 0x0000, 0x7824, 0xa065, 0x090c,
7514 0x14f6, 0x2009, 0x0013, 0x080c, 0x80a7, 0x00ce, 0x0005, 0x3900,
7515 0xa082, 0xb0e8, 0x1210, 0x080c, 0x7d8d, 0x00c6, 0x7824, 0xa065,
7516 0x090c, 0x14f6, 0x7804, 0xa086, 0x0004, 0x0904, 0x675e, 0x7828,
7517 0xa092, 0x2710, 0x1230, 0x8000, 0x782a, 0x00ce, 0x080c, 0x7827,
7518 0x0c20, 0x6104, 0xa186, 0x0003, 0x1188, 0x00e6, 0x2071, 0xad00,
7519 0x70dc, 0x00ee, 0xd08c, 0x0150, 0x00c6, 0x00e6, 0x2061, 0x0100,
7520 0x2071, 0xad00, 0x080c, 0x485e, 0x00ee, 0x00ce, 0x080c, 0xaca2,
7521 0x2009, 0x0014, 0x080c, 0x80a7, 0x00ce, 0x0838, 0x2001, 0xafe3,
7522 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160, 0x782b, 0x0000, 0x7824,
7523 0xa065, 0x090c, 0x14f6, 0x2009, 0x0013, 0x080c, 0x80fb, 0x00ce,
7524 0x0005, 0x00c6, 0x00d6, 0x3900, 0xa082, 0xb0e8, 0x1210, 0x080c,
7525 0x7d8d, 0x7824, 0xa005, 0x090c, 0x14f6, 0x781c, 0xa06d, 0x090c,
7526 0x14f6, 0x6800, 0xc0dc, 0x6802, 0x7924, 0x2160, 0x080c, 0x8078,
7527 0x693c, 0x81ff, 0x090c, 0x14f6, 0x8109, 0x693e, 0x6854, 0xa015,
7528 0x0110, 0x7a1e, 0x0010, 0x7918, 0x791e, 0x7807, 0x0000, 0x7827,
7529 0x0000, 0x00de, 0x00ce, 0x080c, 0x6c50, 0x0888, 0x6104, 0xa186,
7530 0x0002, 0x0128, 0xa186, 0x0004, 0x0110, 0x0804, 0x66f7, 0x7808,
7531 0xac06, 0x0904, 0x66f7, 0x080c, 0x6b73, 0x080c, 0x67ee, 0x00ce,
7532 0x080c, 0x6c50, 0x0804, 0x66e5, 0x00c6, 0x6027, 0x0002, 0x62c8,
7533 0x60c4, 0xa205, 0x1178, 0x793c, 0xa1e5, 0x0000, 0x0130, 0x2009,
7534 0x0049, 0x080c, 0x80a7, 0x00ce, 0x0005, 0x2011, 0xafe6, 0x2013,
7535 0x0000, 0x0cc8, 0x3908, 0xa192, 0xb0e8, 0x1210, 0x080c, 0x7d8d,
7536 0x793c, 0x81ff, 0x0d90, 0x793c, 0xa188, 0x0007, 0x210c, 0xa18e,
7537 0x0006, 0x1138, 0x6014, 0xa084, 0x0184, 0xa085, 0x0012, 0x6016,
7538 0x0c10, 0x6014, 0xa084, 0x0184, 0xa085, 0x0016, 0x6016, 0x08d8,
7539 0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000,
7540 0x2c08, 0x2061, 0xafc7, 0x6020, 0x8000, 0x6022, 0x6010, 0xa005,
7541 0x0148, 0xa080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce, 0x001e,
7542 0x000e, 0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069, 0xafc7,
7543 0x6000, 0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0xa086, 0x0001,
7544 0x1110, 0x2c00, 0x681e, 0x6804, 0xa084, 0x0007, 0x0804, 0x6c56,
7545 0xc0d5, 0x6002, 0x6818, 0xa005, 0x0158, 0x6056, 0x605b, 0x0000,
7546 0x0006, 0x2c00, 0x681a, 0x00de, 0x685a, 0x2069, 0xafc7, 0x0c18,
7547 0x6056, 0x605a, 0x2c00, 0x681a, 0x681e, 0x08e8, 0x0006, 0x0016,
7548 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08, 0x2061,
7549 0xafc7, 0x6020, 0x8000, 0x6022, 0x6008, 0xa005, 0x0148, 0xa080,
7550 0x0003, 0x2102, 0x610a, 0x012e, 0x00ce, 0x001e, 0x000e, 0x0005,
7551 0x610e, 0x610a, 0x0cc0, 0x00c6, 0x600f, 0x0000, 0x2c08, 0x2061,
7552 0xafc7, 0x6034, 0xa005, 0x0130, 0xa080, 0x0003, 0x2102, 0x6136,
7553 0x00ce, 0x0005, 0x613a, 0x6136, 0x0cd8, 0x00f6, 0x00e6, 0x00d6,
7554 0x00c6, 0x0076, 0x0066, 0x0026, 0x0016, 0x0006, 0x0126, 0x2071,
7555 0xafc7, 0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904,
7556 0x6889, 0x6018, 0xa080, 0x0028, 0x2004, 0xa206, 0x1904, 0x6884,
7557 0x87ff, 0x0120, 0x6050, 0xa106, 0x1904, 0x6884, 0x703c, 0xac06,
7558 0x1170, 0x0036, 0x2019, 0x0001, 0x080c, 0x7a64, 0x7033, 0x0000,
7559 0x703f, 0x0000, 0x7043, 0x0000, 0x7047, 0x0000, 0x003e, 0x7038,
7560 0xac36, 0x1110, 0x660c, 0x763a, 0x7034, 0xac36, 0x1140, 0x2c00,
7561 0xaf36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c,
7562 0x0066, 0x2c00, 0xaf06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
7563 0x0000, 0x080c, 0x9596, 0x0198, 0x6010, 0x2068, 0x601c, 0xa086,
7564 0x0003, 0x1510, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c,
7565 0x97fd, 0x080c, 0xabfa, 0x080c, 0x510c, 0x080c, 0x9742, 0x080c,
7566 0x974e, 0x00ce, 0x0804, 0x682e, 0x2c78, 0x600c, 0x2060, 0x0804,
7567 0x682e, 0x012e, 0x000e, 0x001e, 0x002e, 0x006e, 0x007e, 0x00ce,
7568 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601c, 0xa086, 0x0006, 0x19d0,
7569 0x080c, 0xabfa, 0x080c, 0xa91f, 0x0c10, 0x0006, 0x0066, 0x00c6,
7570 0x00d6, 0x00f6, 0x2031, 0x0000, 0x0126, 0x2091, 0x8000, 0x2079,
7571 0xafc7, 0x7838, 0xa065, 0x0558, 0x600c, 0x0006, 0x600f, 0x0000,
7572 0x783c, 0xac06, 0x1170, 0x0036, 0x2019, 0x0001, 0x080c, 0x7a64,
7573 0x7833, 0x0000, 0x783f, 0x0000, 0x7843, 0x0000, 0x7847, 0x0000,
7574 0x003e, 0x080c, 0x9596, 0x0178, 0x6010, 0x2068, 0x601c, 0xa086,
7575 0x0003, 0x11b0, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c,
7576 0x510c, 0x080c, 0x9742, 0x080c, 0x974e, 0x000e, 0x0898, 0x7e3a,
7577 0x7e36, 0x012e, 0x00fe, 0x00de, 0x00ce, 0x006e, 0x000e, 0x0005,
7578 0x601c, 0xa086, 0x0006, 0x1d30, 0x080c, 0xa91f, 0x0c60, 0x0016,
7579 0x0026, 0x0086, 0x2041, 0x0000, 0x0099, 0x080c, 0x69a9, 0x008e,
7580 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126, 0x2079, 0xafc7, 0x2091,
7581 0x8000, 0x080c, 0x6a36, 0x080c, 0x6aa8, 0x012e, 0x00fe, 0x0005,
7582 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006, 0x0126,
7583 0x2091, 0x8000, 0x2071, 0xafc7, 0x7614, 0x2660, 0x2678, 0x8cff,
7584 0x0904, 0x6985, 0x6018, 0xa080, 0x0028, 0x2004, 0xa206, 0x1904,
7585 0x6980, 0x88ff, 0x0120, 0x6050, 0xa106, 0x1904, 0x6980, 0x7024,
7586 0xac06, 0x1538, 0x2069, 0x0100, 0x68c0, 0xa005, 0x01f0, 0x080c,
7587 0x6581, 0x080c, 0x7834, 0x68c3, 0x0000, 0x080c, 0x7ca8, 0x7027,
7588 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0xa384, 0x1000, 0x0120,
7589 0x6803, 0x0100, 0x6803, 0x0000, 0x2069, 0x0100, 0x6824, 0xd084,
7590 0x0110, 0x6827, 0x0001, 0x003e, 0x0020, 0x6003, 0x0009, 0x630a,
7591 0x04b8, 0x7014, 0xac36, 0x1110, 0x660c, 0x7616, 0x7010, 0xac36,
7592 0x1140, 0x2c00, 0xaf36, 0x0118, 0x2f00, 0x7012, 0x0010, 0x7013,
7593 0x0000, 0x660c, 0x0066, 0x2c00, 0xaf06, 0x0110, 0x7e0e, 0x0008,
7594 0x2678, 0x600f, 0x0000, 0x6010, 0x2068, 0x080c, 0x9596, 0x0188,
7595 0x601c, 0xa086, 0x0003, 0x1510, 0x6837, 0x0103, 0x6b4a, 0x6847,
7596 0x0000, 0x080c, 0x97fd, 0x080c, 0xabfa, 0x080c, 0x510c, 0x080c,
7597 0x9742, 0x080c, 0x974e, 0x080c, 0x7b88, 0x00ce, 0x0804, 0x690f,
7598 0x2c78, 0x600c, 0x2060, 0x0804, 0x690f, 0x012e, 0x000e, 0x001e,
7599 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601c, 0xa086,
7600 0x0006, 0x1128, 0x080c, 0xabfa, 0x080c, 0xa91f, 0x0c10, 0x601c,
7601 0xa086, 0x0002, 0x1128, 0x6004, 0xa086, 0x0085, 0x0968, 0x08c8,
7602 0x601c, 0xa086, 0x0005, 0x19a8, 0x6004, 0xa086, 0x0085, 0x0d50,
7603 0x0880, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0xa280, 0xae34,
7604 0x2004, 0xa065, 0x0904, 0x6a32, 0x00f6, 0x00e6, 0x00d6, 0x0066,
7605 0x2071, 0xafc7, 0x6654, 0x7018, 0xac06, 0x1108, 0x761a, 0x701c,
7606 0xac06, 0x1130, 0x86ff, 0x1118, 0x7018, 0x701e, 0x0008, 0x761e,
7607 0x6058, 0xa07d, 0x0108, 0x7e56, 0xa6ed, 0x0000, 0x0110, 0x2f00,
7608 0x685a, 0x6057, 0x0000, 0x605b, 0x0000, 0x6000, 0xc0d4, 0xc0dc,
7609 0x6002, 0x080c, 0x4c07, 0x0904, 0x6a2e, 0x7624, 0x86ff, 0x05e8,
7610 0xa680, 0x0004, 0x2004, 0xad06, 0x15c0, 0x00d6, 0x2069, 0x0100,
7611 0x68c0, 0xa005, 0x0548, 0x080c, 0x6581, 0x080c, 0x7834, 0x68c3,
7612 0x0000, 0x080c, 0x7ca8, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
7613 0x6b04, 0xa384, 0x1000, 0x0120, 0x6803, 0x0100, 0x6803, 0x0000,
7614 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
7615 0x00de, 0x00c6, 0x603c, 0xa005, 0x0110, 0x8001, 0x603e, 0x2660,
7616 0x080c, 0x974e, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660, 0x6003,
7617 0x0009, 0x630a, 0x00ce, 0x0804, 0x69d9, 0x8dff, 0x0158, 0x6837,
7618 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x97fd, 0x080c, 0xabfa,
7619 0x080c, 0x510c, 0x080c, 0x7b88, 0x0804, 0x69d9, 0x006e, 0x00de,
7620 0x00ee, 0x00fe, 0x012e, 0x000e, 0x00ce, 0x0005, 0x0006, 0x0066,
7621 0x00c6, 0x00d6, 0x2031, 0x0000, 0x7814, 0xa065, 0x0904, 0x6a88,
7622 0x600c, 0x0006, 0x600f, 0x0000, 0x7824, 0xac06, 0x1540, 0x2069,
7623 0x0100, 0x68c0, 0xa005, 0x01f0, 0x080c, 0x6581, 0x080c, 0x7834,
7624 0x68c3, 0x0000, 0x080c, 0x7ca8, 0x7827, 0x0000, 0x0036, 0x2069,
7625 0x0140, 0x6b04, 0xa384, 0x1000, 0x0120, 0x6803, 0x0100, 0x6803,
7626 0x0000, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
7627 0x003e, 0x0028, 0x6003, 0x0009, 0x630a, 0x2c30, 0x00b0, 0x6010,
7628 0x2068, 0x080c, 0x9596, 0x0168, 0x601c, 0xa086, 0x0003, 0x11b8,
7629 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x510c, 0x080c,
7630 0x9742, 0x080c, 0x974e, 0x080c, 0x7b88, 0x000e, 0x0804, 0x6a3d,
7631 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e, 0x000e, 0x0005, 0x601c,
7632 0xa086, 0x0006, 0x1118, 0x080c, 0xa91f, 0x0c58, 0x601c, 0xa086,
7633 0x0002, 0x1128, 0x6004, 0xa086, 0x0085, 0x09d0, 0x0c10, 0x601c,
7634 0xa086, 0x0005, 0x19f0, 0x6004, 0xa086, 0x0085, 0x0d60, 0x08c8,
7635 0x0006, 0x0066, 0x00c6, 0x00d6, 0x7818, 0xa065, 0x0904, 0x6b0e,
7636 0x6054, 0x0006, 0x6057, 0x0000, 0x605b, 0x0000, 0x6000, 0xc0d4,
7637 0xc0dc, 0x6002, 0x080c, 0x4c07, 0x0904, 0x6b0b, 0x7e24, 0x86ff,
7638 0x05e8, 0xa680, 0x0004, 0x2004, 0xad06, 0x15c0, 0x00d6, 0x2069,
7639 0x0100, 0x68c0, 0xa005, 0x0548, 0x080c, 0x6581, 0x080c, 0x7834,
7640 0x68c3, 0x0000, 0x080c, 0x7ca8, 0x7827, 0x0000, 0x0036, 0x2069,
7641 0x0140, 0x6b04, 0xa384, 0x1000, 0x0120, 0x6803, 0x0100, 0x6803,
7642 0x0000, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
7643 0x003e, 0x00de, 0x00c6, 0x603c, 0xa005, 0x0110, 0x8001, 0x603e,
7644 0x2660, 0x080c, 0x974e, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660,
7645 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x6aba, 0x8dff, 0x0138,
7646 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x510c, 0x080c,
7647 0x7b88, 0x0804, 0x6aba, 0x000e, 0x0804, 0x6aad, 0x781e, 0x781a,
7648 0x00de, 0x00ce, 0x006e, 0x000e, 0x0005, 0x00e6, 0x00d6, 0x0066,
7649 0x6000, 0xd0dc, 0x0188, 0x604c, 0xa06d, 0x0170, 0x6848, 0xa606,
7650 0x1158, 0x2071, 0xafc7, 0x7024, 0xa035, 0x0130, 0xa080, 0x0004,
7651 0x2004, 0xad06, 0x1108, 0x0021, 0x006e, 0x00de, 0x00ee, 0x0005,
7652 0x00f6, 0x2079, 0x0100, 0x78c0, 0xa005, 0x1138, 0x00c6, 0x2660,
7653 0x6003, 0x0009, 0x630a, 0x00ce, 0x04a0, 0x080c, 0x7834, 0x78c3,
7654 0x0000, 0x080c, 0x7ca8, 0x7027, 0x0000, 0x0036, 0x2079, 0x0140,
7655 0x7b04, 0xa384, 0x1000, 0x0120, 0x7803, 0x0100, 0x7803, 0x0000,
7656 0x2079, 0x0100, 0x7824, 0xd084, 0x0110, 0x7827, 0x0001, 0x080c,
7657 0x7ca8, 0x003e, 0x080c, 0x4c07, 0x00c6, 0x603c, 0xa005, 0x0110,
7658 0x8001, 0x603e, 0x2660, 0x080c, 0x8078, 0x00ce, 0x6837, 0x0103,
7659 0x6b4a, 0x6847, 0x0000, 0x080c, 0x97fd, 0x080c, 0x510c, 0x080c,
7660 0x7b88, 0x00fe, 0x0005, 0x00e6, 0x00c6, 0x2071, 0xafc7, 0x7004,
7661 0xa084, 0x0007, 0x0002, 0x6b85, 0x6b88, 0x6b9e, 0x6bb7, 0x6bf0,
7662 0x6b85, 0x6b83, 0x6b83, 0x080c, 0x14f6, 0x00ce, 0x00ee, 0x0005,
7663 0x7024, 0xa065, 0x0148, 0x7020, 0x8001, 0x7022, 0x600c, 0xa015,
7664 0x0150, 0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000,
7665 0x00ce, 0x00ee, 0x0005, 0x7216, 0x7212, 0x0cb0, 0x6018, 0x2060,
7666 0x080c, 0x4c07, 0x6000, 0xc0dc, 0x6002, 0x7020, 0x8001, 0x7022,
7667 0x0120, 0x6054, 0xa015, 0x0140, 0x721e, 0x7007, 0x0000, 0x7027,
7668 0x0000, 0x00ce, 0x00ee, 0x0005, 0x7218, 0x721e, 0x0cb0, 0x7024,
7669 0xa065, 0x0598, 0x700c, 0xac06, 0x1160, 0x080c, 0x7b88, 0x600c,
7670 0xa015, 0x0120, 0x720e, 0x600f, 0x0000, 0x0428, 0x720e, 0x720a,
7671 0x0410, 0x7014, 0xac06, 0x1160, 0x080c, 0x7b88, 0x600c, 0xa015,
7672 0x0120, 0x7216, 0x600f, 0x0000, 0x00b0, 0x7216, 0x7212, 0x0098,
7673 0x6018, 0x2060, 0x080c, 0x4c07, 0x6000, 0xc0dc, 0x6002, 0x080c,
7674 0x7b88, 0x701c, 0xa065, 0x0138, 0x6054, 0xa015, 0x0110, 0x721e,
7675 0x0010, 0x7218, 0x721e, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x0005,
7676 0x7024, 0xa065, 0x0140, 0x080c, 0x7b88, 0x600c, 0xa015, 0x0150,
7677 0x720e, 0x600f, 0x0000, 0x080c, 0x7ca8, 0x7027, 0x0000, 0x00ce,
7678 0x00ee, 0x0005, 0x720e, 0x720a, 0x0cb0, 0x00d6, 0x2069, 0xafc7,
7679 0x6830, 0xa084, 0x0003, 0x0002, 0x6c12, 0x6c14, 0x6c38, 0x6c10,
7680 0x080c, 0x14f6, 0x00de, 0x0005, 0x00c6, 0x6840, 0xa086, 0x0001,
7681 0x01b8, 0x683c, 0xa065, 0x0130, 0x600c, 0xa015, 0x0170, 0x6a3a,
7682 0x600f, 0x0000, 0x6833, 0x0000, 0x683f, 0x0000, 0x2011, 0xafe6,
7683 0x2013, 0x0000, 0x00ce, 0x00de, 0x0005, 0x683a, 0x6836, 0x0c90,
7684 0x6843, 0x0000, 0x6838, 0xa065, 0x0d68, 0x6003, 0x0003, 0x0c50,
7685 0x00c6, 0x6843, 0x0000, 0x6847, 0x0000, 0x683c, 0xa065, 0x0168,
7686 0x600c, 0xa015, 0x0130, 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000,
7687 0x0020, 0x683f, 0x0000, 0x683a, 0x6836, 0x00ce, 0x00de, 0x0005,
7688 0x00d6, 0x2069, 0xafc7, 0x6804, 0xa084, 0x0007, 0x0002, 0x6c61,
7689 0x6cfd, 0x6cfd, 0x6cfd, 0x6cfd, 0x6cff, 0x6c5f, 0x6c5f, 0x080c,
7690 0x14f6, 0x6820, 0xa005, 0x1110, 0x00de, 0x0005, 0x00c6, 0x680c,
7691 0xa065, 0x0150, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000, 0x080c,
7692 0x6d49, 0x00ce, 0x00de, 0x0005, 0x6814, 0xa065, 0x0150, 0x6807,
7693 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x6d49, 0x00ce, 0x00de,
7694 0x0005, 0x00e6, 0x0036, 0x6a1c, 0xa2f5, 0x0000, 0x0904, 0x6cf9,
7695 0x704c, 0xa00d, 0x0118, 0x7088, 0xa005, 0x01a0, 0x7054, 0xa075,
7696 0x0120, 0xa20e, 0x0904, 0x6cf9, 0x0028, 0x6818, 0xa20e, 0x0904,
7697 0x6cf9, 0x2070, 0x704c, 0xa00d, 0x0d88, 0x7088, 0xa005, 0x1d70,
7698 0x2e00, 0x681e, 0x733c, 0x7038, 0xa302, 0x1e40, 0x080c, 0x804f,
7699 0x0904, 0x6cf9, 0x8318, 0x733e, 0x6112, 0x2e10, 0x621a, 0xa180,
7700 0x0014, 0x2004, 0xa084, 0x00ff, 0x605a, 0xa180, 0x0014, 0x2003,
7701 0x0000, 0xa180, 0x0015, 0x2004, 0xa08a, 0x199a, 0x0210, 0x2001,
7702 0x1999, 0x8003, 0x801b, 0x831b, 0xa318, 0x6316, 0x003e, 0x00f6,
7703 0x2c78, 0x71a0, 0x2001, 0xad34, 0x2004, 0xd0ac, 0x1110, 0xd1bc,
7704 0x0150, 0x7100, 0xd1f4, 0x0120, 0x7114, 0xa18c, 0x00ff, 0x0040,
7705 0x2009, 0x0000, 0x0028, 0xa1e0, 0x2be6, 0x2c0d, 0xa18c, 0x00ff,
7706 0x2061, 0x0100, 0x619a, 0x080c, 0x736f, 0x7300, 0xc3dd, 0x7302,
7707 0x6807, 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x781f, 0x0003,
7708 0x7803, 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00ce, 0x00de,
7709 0x0005, 0x003e, 0x00ee, 0x00ce, 0x0cd0, 0x00de, 0x0005, 0x00c6,
7710 0x680c, 0xa065, 0x0138, 0x6807, 0x0004, 0x6826, 0x682b, 0x0000,
7711 0x080c, 0x6d49, 0x00ce, 0x00de, 0x0005, 0x00f6, 0x00d6, 0x2069,
7712 0xafc7, 0x6830, 0xa086, 0x0000, 0x11c0, 0x2001, 0xad0c, 0x200c,
7713 0xd1bc, 0x1550, 0x6838, 0xa07d, 0x0180, 0x6833, 0x0001, 0x683e,
7714 0x6847, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c,
7715 0x1ee6, 0x1130, 0x012e, 0x080c, 0x76a5, 0x00de, 0x00fe, 0x0005,
7716 0x012e, 0xe000, 0x6843, 0x0000, 0x7803, 0x0002, 0x780c, 0xa015,
7717 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000, 0x683f, 0x0000,
7718 0x0c60, 0x683a, 0x6836, 0x0cc0, 0xc1bc, 0x2102, 0x080c, 0x57d1,
7719 0x0888, 0x601c, 0xa084, 0x000f, 0x000b, 0x0005, 0x6d57, 0x6d5c,
7720 0x7210, 0x732c, 0x6d5c, 0x7210, 0x732c, 0x6d57, 0x6d5c, 0x080c,
7721 0x6b73, 0x080c, 0x6c50, 0x0005, 0x0156, 0x0136, 0x0146, 0x00c6,
7722 0x00f6, 0x6004, 0xa08a, 0x0080, 0x1a0c, 0x14f6, 0x6118, 0x2178,
7723 0x79a0, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110, 0xd1bc, 0x0150,
7724 0x7900, 0xd1f4, 0x0120, 0x7914, 0xa18c, 0x00ff, 0x0040, 0x2009,
7725 0x0000, 0x0028, 0xa1f8, 0x2be6, 0x2f0d, 0xa18c, 0x00ff, 0x2c78,
7726 0x2061, 0x0100, 0x619a, 0xa08a, 0x0040, 0x1a04, 0x6dd0, 0x0033,
7727 0x00fe, 0x00ce, 0x014e, 0x013e, 0x015e, 0x0005, 0x6e7c, 0x6ec7,
7728 0x6ef4, 0x6fc1, 0x6fef, 0x6ff7, 0x701d, 0x702e, 0x703f, 0x7047,
7729 0x705d, 0x7047, 0x70b7, 0x702e, 0x70d8, 0x70e0, 0x703f, 0x70e0,
7730 0x70f1, 0x6dce, 0x6dce, 0x6dce, 0x6dce, 0x6dce, 0x6dce, 0x6dce,
7731 0x6dce, 0x6dce, 0x6dce, 0x6dce, 0x790d, 0x7932, 0x7947, 0x796a,
7732 0x798b, 0x701d, 0x6dce, 0x701d, 0x7047, 0x6dce, 0x6ef4, 0x6fc1,
7733 0x6dce, 0x7daa, 0x7047, 0x6dce, 0x7dca, 0x7047, 0x6dce, 0x703f,
7734 0x6e75, 0x6de0, 0x6dce, 0x7def, 0x7e64, 0x7f3b, 0x6dce, 0x7f4c,
7735 0x7018, 0x7f68, 0x6dce, 0x79a0, 0x7fc3, 0x6dce, 0x080c, 0x14f6,
7736 0x2100, 0x0033, 0x00fe, 0x00ce, 0x014e, 0x013e, 0x015e, 0x0005,
7737 0x6dde, 0x6dde, 0x6dde, 0x6e14, 0x6e32, 0x6e48, 0x080c, 0x14f6,
7738 0x00d6, 0x20a1, 0x020b, 0x080c, 0x710e, 0x7810, 0x2068, 0x20a3,
7739 0x2414, 0x20a3, 0x0018, 0x20a3, 0x0800, 0x683c, 0x20a2, 0x20a3,
7740 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x6850,
7741 0x20a2, 0x6854, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3,
7742 0x0018, 0x080c, 0x7821, 0x00de, 0x0005, 0x00d6, 0x7818, 0x2068,
7743 0x68a0, 0x2069, 0xad00, 0x6ad0, 0xd2ac, 0x1110, 0xd0bc, 0x0110,
7744 0xa085, 0x0001, 0x00de, 0x0005, 0x00d6, 0x20a1, 0x020b, 0x080c,
7745 0x710e, 0x20a3, 0x0500, 0x20a3, 0x0000, 0x7810, 0xa0e8, 0x000f,
7746 0x6808, 0x20a2, 0x680c, 0x20a2, 0x6810, 0x20a2, 0x6814, 0x20a2,
7747 0x6818, 0x20a2, 0x681c, 0x20a2, 0x60c3, 0x0010, 0x080c, 0x7821,
7748 0x00de, 0x0005, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x710e,
7749 0x20a3, 0x7800, 0x20a3, 0x0000, 0x7808, 0x8007, 0x20a2, 0x20a3,
7750 0x0000, 0x60c3, 0x0008, 0x080c, 0x7821, 0x014e, 0x015e, 0x0005,
7751 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0200,
7752 0x20a3, 0x0000, 0x20a3, 0xdf10, 0x20a3, 0x0034, 0x2099, 0xad05,
7753 0x20a9, 0x0004, 0x53a6, 0x2099, 0xad01, 0x20a9, 0x0004, 0x53a6,
7754 0x2099, 0xafad, 0x20a9, 0x001a, 0x3304, 0x8007, 0x20a2, 0x9398,
7755 0x1f04, 0x6e64, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x004c,
7756 0x080c, 0x7821, 0x014e, 0x015e, 0x0005, 0x2001, 0xad14, 0x2004,
7757 0x609a, 0x080c, 0x7821, 0x0005, 0x20a1, 0x020b, 0x080c, 0x710e,
7758 0x20a3, 0x5200, 0x20a3, 0x0000, 0x00d6, 0x2069, 0xad51, 0x6804,
7759 0xd084, 0x0150, 0x6828, 0x20a3, 0x0000, 0x0016, 0x080c, 0x268a,
7760 0x21a2, 0x001e, 0x00de, 0x0028, 0x00de, 0x20a3, 0x0000, 0x20a3,
7761 0x0000, 0x20a9, 0x0004, 0x2099, 0xad05, 0x53a6, 0x20a9, 0x0004,
7762 0x2099, 0xad01, 0x53a6, 0x2001, 0xad34, 0x2004, 0xd0ac, 0x1138,
7763 0x7818, 0xa080, 0x0028, 0x2004, 0xa082, 0x007f, 0x0238, 0x2001,
7764 0xad1b, 0x20a6, 0x2001, 0xad1c, 0x20a6, 0x0040, 0x20a3, 0x0000,
7765 0x2001, 0xad14, 0x2004, 0xa084, 0x00ff, 0x20a2, 0x20a3, 0x0000,
7766 0x20a3, 0x0000, 0x60c3, 0x001c, 0x080c, 0x7821, 0x0005, 0x20a1,
7767 0x020b, 0x080c, 0x710e, 0x20a3, 0x0500, 0x20a3, 0x0000, 0x2001,
7768 0xad34, 0x2004, 0xd0ac, 0x1138, 0x7818, 0xa080, 0x0028, 0x2004,
7769 0xa082, 0x007f, 0x0238, 0x2001, 0xad1b, 0x20a6, 0x2001, 0xad1c,
7770 0x20a6, 0x0040, 0x20a3, 0x0000, 0x2001, 0xad14, 0x2004, 0xa084,
7771 0x00ff, 0x20a2, 0x20a9, 0x0004, 0x2099, 0xad05, 0x53a6, 0x60c3,
7772 0x0010, 0x080c, 0x7821, 0x0005, 0x20a1, 0x020b, 0x080c, 0x710e,
7773 0x00c6, 0x7818, 0x2060, 0x2001, 0x0000, 0x080c, 0x5037, 0x00ce,
7774 0x7818, 0xa080, 0x0028, 0x2004, 0xa086, 0x007e, 0x1130, 0x20a3,
7775 0x0400, 0x620c, 0xc2b4, 0x620e, 0x0010, 0x20a3, 0x0300, 0x20a3,
7776 0x0000, 0x7818, 0xa080, 0x0028, 0x2004, 0xa086, 0x007e, 0x1904,
7777 0x6f83, 0x2001, 0xad34, 0x2004, 0xd0a4, 0x01c8, 0x2099, 0xaf8d,
7778 0x33a6, 0x9398, 0x20a3, 0x0000, 0x9398, 0x3304, 0xa084, 0x2000,
7779 0x20a2, 0x9398, 0x33a6, 0x9398, 0x20a3, 0x0000, 0x9398, 0x2001,
7780 0x2710, 0x20a2, 0x9398, 0x33a6, 0x9398, 0x33a6, 0x00d0, 0x2099,
7781 0xaf8d, 0x33a6, 0x9398, 0x33a6, 0x9398, 0x3304, 0x080c, 0x574f,
7782 0x1118, 0xa084, 0x37ff, 0x0010, 0xa084, 0x3fff, 0x20a2, 0x9398,
7783 0x33a6, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7784 0x0000, 0x20a9, 0x0004, 0x2099, 0xad05, 0x53a6, 0x20a9, 0x0004,
7785 0x2099, 0xad01, 0x53a6, 0x20a9, 0x0008, 0x20a3, 0x0000, 0x1f04,
7786 0x6f5d, 0x20a9, 0x0008, 0x20a3, 0x0000, 0x1f04, 0x6f63, 0x2099,
7787 0xaf95, 0x3304, 0xc0dd, 0x20a2, 0x2001, 0xad71, 0x2004, 0xd0e4,
7788 0x0158, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x9398, 0x9398, 0x9398,
7789 0x33a6, 0x20a9, 0x0004, 0x0010, 0x20a9, 0x0007, 0x20a3, 0x0000,
7790 0x1f04, 0x6f7e, 0x0468, 0x2001, 0xad34, 0x2004, 0xd0a4, 0x0140,
7791 0x2001, 0xaf8e, 0x2004, 0x60e3, 0x0000, 0x080c, 0x26cb, 0x60e2,
7792 0x2099, 0xaf8d, 0x20a9, 0x0008, 0x53a6, 0x20a9, 0x0004, 0x2099,
7793 0xad05, 0x53a6, 0x20a9, 0x0004, 0x2099, 0xad01, 0x53a6, 0x20a9,
7794 0x0008, 0x20a3, 0x0000, 0x1f04, 0x6fa1, 0x20a9, 0x0008, 0x20a3,
7795 0x0000, 0x1f04, 0x6fa7, 0x2099, 0xaf95, 0x20a9, 0x0008, 0x53a6,
7796 0x20a9, 0x0008, 0x20a3, 0x0000, 0x1f04, 0x6fb2, 0x20a9, 0x000a,
7797 0x20a3, 0x0000, 0x1f04, 0x6fb8, 0x60c3, 0x0074, 0x080c, 0x7821,
7798 0x0005, 0x20a1, 0x020b, 0x080c, 0x710e, 0x20a3, 0x2010, 0x20a3,
7799 0x0014, 0x20a3, 0x0800, 0x20a3, 0x2000, 0xa006, 0x20a2, 0x20a2,
7800 0x20a2, 0x20a2, 0x20a2, 0x00f6, 0x2079, 0xad51, 0x7904, 0x00fe,
7801 0xd1ac, 0x1110, 0xa085, 0x0020, 0xd1a4, 0x0110, 0xa085, 0x0010,
7802 0xa085, 0x0002, 0x00d6, 0x0804, 0x7099, 0x20a2, 0x20a3, 0x0000,
7803 0x20a3, 0x0000, 0x60c3, 0x0014, 0x080c, 0x7821, 0x0005, 0x20a1,
7804 0x020b, 0x080c, 0x710e, 0x20a3, 0x5000, 0x0804, 0x6f0f, 0x20a1,
7805 0x020b, 0x080c, 0x710e, 0x20a3, 0x2110, 0x20a3, 0x0014, 0x20a3,
7806 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7807 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7808 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x080c, 0x7821, 0x0005,
7809 0x20a1, 0x020b, 0x080c, 0x71a2, 0x0020, 0x20a1, 0x020b, 0x080c,
7810 0x71aa, 0x20a3, 0x0200, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7811 0x0000, 0x60c3, 0x0004, 0x080c, 0x7821, 0x0005, 0x20a1, 0x020b,
7812 0x080c, 0x71aa, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0x0003,
7813 0x20a3, 0x2a00, 0x60c3, 0x0008, 0x080c, 0x7821, 0x0005, 0x20a1,
7814 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0200, 0x0804, 0x6f0f, 0x20a1,
7815 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x7828,
7816 0xa005, 0x0110, 0x20a2, 0x0010, 0x20a3, 0x0003, 0x7810, 0x20a2,
7817 0x60c3, 0x0008, 0x080c, 0x7821, 0x0005, 0x00d6, 0x20a1, 0x020b,
7818 0x080c, 0x71aa, 0x20a3, 0x0210, 0x20a3, 0x0014, 0x20a3, 0x0800,
7819 0x7818, 0x2068, 0x6894, 0xa086, 0x0014, 0x1178, 0x6998, 0xa184,
7820 0xc000, 0x1140, 0xd1ec, 0x0118, 0x20a3, 0x2100, 0x0040, 0x20a3,
7821 0x0100, 0x0028, 0x20a3, 0x0400, 0x0010, 0x20a3, 0x0700, 0xa006,
7822 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x00f6, 0x2079, 0xad51,
7823 0x7904, 0x00fe, 0xd1ac, 0x1110, 0xa085, 0x0020, 0xd1a4, 0x0110,
7824 0xa085, 0x0010, 0x2009, 0xad73, 0x210c, 0xd184, 0x1110, 0xa085,
7825 0x0002, 0x0026, 0x2009, 0xad71, 0x210c, 0xd1e4, 0x0130, 0xc0c5,
7826 0xa094, 0x0030, 0xa296, 0x0010, 0x0140, 0xd1ec, 0x0130, 0xa094,
7827 0x0030, 0xa296, 0x0010, 0x0108, 0xc0bd, 0x002e, 0x20a2, 0x20a2,
7828 0x20a2, 0x60c3, 0x0014, 0x080c, 0x7821, 0x00de, 0x0005, 0x20a1,
7829 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0210, 0x20a3, 0x0014, 0x20a3,
7830 0x0000, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7831 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3,
7832 0x0000, 0x20a3, 0x0000, 0x60c3, 0x0014, 0x080c, 0x7821, 0x0005,
7833 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0200, 0x0804, 0x6e82,
7834 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0100, 0x20a3, 0x0000,
7835 0x20a3, 0x0003, 0x20a3, 0x2a00, 0x60c3, 0x0008, 0x080c, 0x7821,
7836 0x0005, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x20a1, 0x020b, 0x080c,
7837 0x71aa, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0x000b, 0x20a3,
7838 0x0000, 0x60c3, 0x0008, 0x080c, 0x7821, 0x0005, 0x0026, 0x0036,
7839 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0038, 0x0026, 0x0036,
7840 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x20e1, 0x9080, 0x20e1,
7841 0x4000, 0x7818, 0xa080, 0x0028, 0x2014, 0xa286, 0x007e, 0x11a0,
7842 0xa385, 0x00ff, 0x20a2, 0x20a3, 0xfffe, 0x20a3, 0x0000, 0x2011,
7843 0xad14, 0x2214, 0x2001, 0xaf9d, 0x2004, 0xa005, 0x0118, 0x2011,
7844 0xad1c, 0x2214, 0x22a2, 0x04d0, 0xa286, 0x007f, 0x1138, 0x00d6,
7845 0xa385, 0x00ff, 0x20a2, 0x20a3, 0xfffd, 0x00c8, 0x2001, 0xad34,
7846 0x2004, 0xd0ac, 0x1110, 0xd2bc, 0x01c8, 0xa286, 0x0080, 0x00d6,
7847 0x1130, 0xa385, 0x00ff, 0x20a2, 0x20a3, 0xfffc, 0x0040, 0xa2e8,
7848 0xae34, 0x2d6c, 0x6810, 0xa305, 0x20a2, 0x6814, 0x20a2, 0x2069,
7849 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de, 0x0080, 0x00d6, 0xa2e8,
7850 0xae34, 0x2d6c, 0x6810, 0xa305, 0x20a2, 0x6814, 0x20a2, 0x00de,
7851 0x20a3, 0x0000, 0x2011, 0xad14, 0x2214, 0x22a2, 0xa485, 0x0029,
7852 0x20a2, 0x004e, 0x003e, 0x20a3, 0x0000, 0x080c, 0x7810, 0x22a2,
7853 0x20a3, 0x0000, 0x2fa2, 0x20a3, 0xffff, 0x20a3, 0x0000, 0x20a3,
7854 0x0000, 0x002e, 0x0005, 0x0026, 0x20e1, 0x9080, 0x20e1, 0x4000,
7855 0x20a3, 0x02ff, 0x2011, 0xfffc, 0x22a2, 0x00d6, 0x2069, 0xad1b,
7856 0x2da6, 0x8d68, 0x2da6, 0x00de, 0x20a3, 0x2029, 0x20a3, 0x0000,
7857 0x08e0, 0x20a3, 0x0100, 0x20a3, 0x0000, 0x20a3, 0xfc02, 0x20a3,
7858 0x0000, 0x0005, 0x0026, 0x0036, 0x0046, 0x2019, 0x3300, 0x2021,
7859 0x0800, 0x0038, 0x0026, 0x0036, 0x0046, 0x2019, 0x2300, 0x2021,
7860 0x0100, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028,
7861 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1118, 0xa092, 0x007e,
7862 0x02d8, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa305, 0x20a2,
7863 0x6814, 0x20a2, 0x6810, 0xa005, 0x1140, 0x6814, 0xa005, 0x1128,
7864 0x20a3, 0x00ff, 0x20a3, 0xfffe, 0x0028, 0x2069, 0xad1b, 0x2da6,
7865 0x8d68, 0x2da6, 0x00de, 0x0080, 0x00d6, 0xa0e8, 0xae34, 0x2d6c,
7866 0x6810, 0xa305, 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000,
7867 0x2011, 0xad14, 0x2214, 0x22a2, 0xa485, 0x0098, 0x20a2, 0x20a3,
7868 0x0000, 0x004e, 0x003e, 0x080c, 0x7810, 0x22a2, 0x20a3, 0x0000,
7869 0x7a08, 0x22a2, 0x2fa2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x002e,
7870 0x0005, 0x080c, 0x7810, 0x22a2, 0x20a3, 0x0000, 0x7a08, 0x22a2,
7871 0x7810, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x002e, 0x0005,
7872 0x00c6, 0x00f6, 0x6004, 0xa08a, 0x0085, 0x0a0c, 0x14f6, 0xa08a,
7873 0x008c, 0x1a0c, 0x14f6, 0x6118, 0x2178, 0x79a0, 0x2011, 0xad34,
7874 0x2214, 0xd2ac, 0x1110, 0xd1bc, 0x0150, 0x7900, 0xd1f4, 0x0120,
7875 0x7914, 0xa18c, 0x00ff, 0x0040, 0x2009, 0x0000, 0x0028, 0xa1f8,
7876 0x2be6, 0x2f0d, 0xa18c, 0x00ff, 0x2c78, 0x2061, 0x0100, 0x619a,
7877 0xa082, 0x0085, 0x001b, 0x00fe, 0x00ce, 0x0005, 0x7247, 0x7251,
7878 0x726c, 0x7245, 0x7245, 0x7245, 0x7247, 0x080c, 0x14f6, 0x0146,
7879 0x20a1, 0x020b, 0x04a1, 0x60c3, 0x0000, 0x080c, 0x7821, 0x014e,
7880 0x0005, 0x0146, 0x20a1, 0x020b, 0x080c, 0x72b8, 0x20a3, 0x0000,
7881 0x20a3, 0x0000, 0x7808, 0x20a2, 0x7810, 0x20a2, 0x20a3, 0x0000,
7882 0x20a3, 0xffff, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x000c,
7883 0x080c, 0x7821, 0x014e, 0x0005, 0x0146, 0x20a1, 0x020b, 0x080c,
7884 0x72f2, 0x20a3, 0x0003, 0x20a3, 0x0300, 0x20a3, 0x0000, 0x20a3,
7885 0x0000, 0x60c3, 0x0004, 0x080c, 0x7821, 0x014e, 0x0005, 0x0026,
7886 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2004,
7887 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1118, 0xa092, 0x007e, 0x0288,
7888 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x8100, 0x20a2,
7889 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de,
7890 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x8100,
7891 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011, 0xad14,
7892 0x2214, 0x22a2, 0x20a3, 0x0009, 0x20a3, 0x0000, 0x0804, 0x7175,
7893 0x0026, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028,
7894 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1118, 0xa092, 0x007e,
7895 0x0288, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x8400,
7896 0x20a2, 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6,
7897 0x00de, 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085,
7898 0x8400, 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011,
7899 0xad14, 0x2214, 0x22a2, 0x2001, 0x0099, 0x20a2, 0x20a3, 0x0000,
7900 0x0804, 0x7201, 0x0026, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818,
7901 0xa080, 0x0028, 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1118,
7902 0xa092, 0x007e, 0x0288, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810,
7903 0xa085, 0x8500, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6,
7904 0x8d68, 0x2da6, 0x00de, 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c,
7905 0x6810, 0xa085, 0x8500, 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3,
7906 0x0000, 0x2011, 0xad14, 0x2214, 0x22a2, 0x2001, 0x0099, 0x20a2,
7907 0x20a3, 0x0000, 0x0804, 0x7201, 0x00c6, 0x00f6, 0x2c78, 0x7804,
7908 0xa08a, 0x0040, 0x0a0c, 0x14f6, 0xa08a, 0x0053, 0x1a0c, 0x14f6,
7909 0x7918, 0x2160, 0x61a0, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110,
7910 0xd1bc, 0x0150, 0x6100, 0xd1f4, 0x0120, 0x6114, 0xa18c, 0x00ff,
7911 0x0040, 0x2009, 0x0000, 0x0028, 0xa1e0, 0x2be6, 0x2c0d, 0xa18c,
7912 0x00ff, 0x2061, 0x0100, 0x619a, 0xa082, 0x0040, 0x001b, 0x00fe,
7913 0x00ce, 0x0005, 0x736f, 0x747b, 0x7418, 0x761a, 0x736d, 0x736d,
7914 0x736d, 0x736d, 0x736d, 0x736d, 0x736d, 0x7b41, 0x7b51, 0x7b61,
7915 0x7b71, 0x736d, 0x7f79, 0x736d, 0x7b30, 0x080c, 0x14f6, 0x00d6,
7916 0x0156, 0x0146, 0x780b, 0xffff, 0x20a1, 0x020b, 0x080c, 0x73cf,
7917 0x7910, 0x2168, 0x6948, 0x7952, 0x21a2, 0xa016, 0x22a2, 0x22a2,
7918 0x22a2, 0x694c, 0xa184, 0x000f, 0x1118, 0x2001, 0x0005, 0x0040,
7919 0xd184, 0x0118, 0x2001, 0x0004, 0x0018, 0xa084, 0x0006, 0x8004,
7920 0x0016, 0x2008, 0x7858, 0xa084, 0x00ff, 0x8007, 0xa105, 0x001e,
7921 0x20a2, 0xd1ac, 0x0118, 0x20a3, 0x0002, 0x0048, 0xd1b4, 0x0118,
7922 0x20a3, 0x0001, 0x0020, 0x20a3, 0x0000, 0x2230, 0x0010, 0x6a80,
7923 0x6e7c, 0x20a9, 0x0008, 0x0136, 0xad88, 0x0017, 0x2198, 0x20a1,
7924 0x021b, 0x53a6, 0x013e, 0x20a1, 0x020b, 0x22a2, 0x26a2, 0x60c3,
7925 0x0020, 0x20e1, 0x9080, 0x6014, 0xa084, 0x0004, 0xa085, 0x0009,
7926 0x6016, 0x2001, 0xafe3, 0x2003, 0x07d0, 0x2001, 0xafe2, 0x2003,
7927 0x0009, 0x080c, 0x17bf, 0x014e, 0x015e, 0x00de, 0x0005, 0x20e1,
7928 0x9080, 0x20e1, 0x4000, 0x7a18, 0xa280, 0x0023, 0x2014, 0x8210,
7929 0xa294, 0x00ff, 0x2202, 0x8217, 0x7818, 0xa080, 0x0028, 0x2004,
7930 0x2019, 0xad34, 0x231c, 0xd3ac, 0x1110, 0xd0bc, 0x0188, 0x00d6,
7931 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0600, 0x20a2, 0x6814,
7932 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de, 0x0088,
7933 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0600, 0x20a2,
7934 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2009, 0xad14, 0x210c,
7935 0x21a2, 0x20a3, 0x0829, 0x20a3, 0x0000, 0x22a2, 0x20a3, 0x0000,
7936 0x2fa2, 0x20a3, 0xffff, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x0005,
7937 0x00d6, 0x0156, 0x0136, 0x0146, 0x20a1, 0x020b, 0x00c1, 0x7810,
7938 0x2068, 0x6860, 0x20a2, 0x685c, 0x20a2, 0x6880, 0x20a2, 0x687c,
7939 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x60c3, 0x000c,
7940 0x080c, 0x7821, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005, 0x0026,
7941 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028, 0x2004,
7942 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110, 0xd0bc, 0x0188, 0x00d6,
7943 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0500, 0x20a2, 0x6814,
7944 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de, 0x0088,
7945 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0500, 0x20a2,
7946 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011, 0xad14, 0x2214,
7947 0x22a2, 0x20a3, 0x0889, 0x20a3, 0x0000, 0x080c, 0x7810, 0x22a2,
7948 0x20a3, 0x0000, 0x7a08, 0x22a2, 0x2fa2, 0x20a3, 0x0000, 0x20a3,
7949 0x0000, 0x002e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146, 0x7810,
7950 0xa06d, 0x080c, 0x5025, 0x0148, 0x684c, 0xa084, 0x2020, 0xa086,
7951 0x2020, 0x1118, 0x7820, 0xc0cd, 0x7822, 0x20a1, 0x020b, 0x080c,
7952 0x75d0, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x7810,
7953 0xa084, 0xf000, 0x1130, 0x7810, 0xa084, 0x0700, 0x8007, 0x0043,
7954 0x0010, 0xa006, 0x002b, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005,
7955 0x74b2, 0x7547, 0x7550, 0x7579, 0x758c, 0x75a7, 0x75b0, 0x74b0,
7956 0x080c, 0x14f6, 0x0016, 0x0036, 0x694c, 0xa18c, 0x0003, 0x0118,
7957 0xa186, 0x0003, 0x1170, 0x6b78, 0x7820, 0xd0cc, 0x0108, 0xc3e5,
7958 0x23a2, 0x6868, 0x20a2, 0x6864, 0x20a2, 0x003e, 0x001e, 0x0804,
7959 0x7583, 0xa186, 0x0001, 0x190c, 0x14f6, 0x6b78, 0x7820, 0xd0cc,
7960 0x0108, 0xc3e5, 0x23a2, 0x6868, 0x20a2, 0x6864, 0x20a2, 0x22a2,
7961 0x6874, 0x20a2, 0x22a2, 0x687c, 0x20a2, 0x2009, 0x0018, 0xa384,
7962 0x0300, 0x0904, 0x7541, 0xd3c4, 0x0110, 0x687c, 0xa108, 0xd3cc,
7963 0x0110, 0x6874, 0xa108, 0x0156, 0x20a9, 0x000d, 0xad80, 0x0020,
7964 0x201c, 0x831f, 0x23a2, 0x8000, 0x1f04, 0x74f0, 0x015e, 0x22a2,
7965 0x22a2, 0x22a2, 0xa184, 0x0003, 0x0904, 0x7541, 0x20a1, 0x020b,
7966 0x20e1, 0x9080, 0x20e1, 0x4000, 0x0006, 0x7818, 0xa080, 0x0028,
7967 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110, 0xd0bc, 0x0188,
7968 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2,
7969 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de,
7970 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0700,
7971 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011, 0xad14,
7972 0x2214, 0x22a2, 0x000e, 0x7b20, 0xd3cc, 0x0118, 0x20a3, 0x0889,
7973 0x0010, 0x20a3, 0x0898, 0x20a2, 0x080c, 0x7810, 0x22a2, 0x20a3,
7974 0x0000, 0x61c2, 0x003e, 0x001e, 0x080c, 0x7821, 0x0005, 0x2011,
7975 0x0008, 0x7820, 0xd0cc, 0x0108, 0xc2e5, 0x22a2, 0xa016, 0x0488,
7976 0x2011, 0x0302, 0x7820, 0xd0cc, 0x0108, 0xc2e5, 0x22a2, 0xa016,
7977 0x22a2, 0x22a2, 0x22a2, 0x20a3, 0x0012, 0x22a2, 0x20a3, 0x0008,
7978 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x20a3, 0x7000, 0x20a3, 0x0500,
7979 0x22a2, 0x20a3, 0x000a, 0x22a2, 0x22a2, 0x20a3, 0x2500, 0x22a2,
7980 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x60c3, 0x0032, 0x080c, 0x7821,
7981 0x0005, 0x2011, 0x0028, 0x7820, 0xd0cc, 0x0108, 0xc2e5, 0x22a2,
7982 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x22a2, 0x60c3,
7983 0x0018, 0x080c, 0x7821, 0x0005, 0x2011, 0x0100, 0x7820, 0xd0cc,
7984 0x0108, 0xc2e5, 0x22a2, 0xa016, 0x22a2, 0x22a2, 0x22a2, 0x22a2,
7985 0x22a2, 0x20a3, 0x0008, 0x22a2, 0x7854, 0xa084, 0x00ff, 0x20a2,
7986 0x22a2, 0x22a2, 0x60c3, 0x0020, 0x080c, 0x7821, 0x0005, 0x2011,
7987 0x0008, 0x7820, 0xd0cc, 0x0108, 0xc2e5, 0x22a2, 0xa016, 0x0888,
7988 0x0036, 0x7b10, 0xa384, 0xff00, 0x7812, 0xa384, 0x00ff, 0x8001,
7989 0x1138, 0x7820, 0xd0cc, 0x0108, 0xc2e5, 0x22a2, 0x003e, 0x0808,
7990 0x0046, 0x2021, 0x0800, 0x0006, 0x7820, 0xd0cc, 0x000e, 0x0108,
7991 0xc4e5, 0x24a2, 0x004e, 0x22a2, 0x20a2, 0x003e, 0x0804, 0x7583,
7992 0x0026, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028,
7993 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110, 0xd0bc, 0x0188,
7994 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0700, 0x20a2,
7995 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de,
7996 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0700,
7997 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011, 0xad14,
7998 0x2214, 0x22a2, 0x7820, 0xd0cc, 0x0118, 0x20a3, 0x0889, 0x0010,
7999 0x20a3, 0x0898, 0x20a3, 0x0000, 0x080c, 0x7810, 0x22a2, 0x20a3,
8000 0x0000, 0x7a08, 0x22a2, 0x2fa2, 0x20a3, 0x0000, 0x20a3, 0x0000,
8001 0x002e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146, 0x0016, 0x0036,
8002 0x7810, 0xa084, 0x0700, 0x8007, 0x003b, 0x003e, 0x001e, 0x014e,
8003 0x013e, 0x015e, 0x00de, 0x0005, 0x7634, 0x7634, 0x7636, 0x7634,
8004 0x7634, 0x7634, 0x7658, 0x7634, 0x080c, 0x14f6, 0x7910, 0xa18c,
8005 0xf8ff, 0xa18d, 0x0600, 0x7912, 0x20a1, 0x020b, 0x2009, 0x0003,
8006 0x00f9, 0x00d6, 0x2069, 0xad51, 0x6804, 0xd0bc, 0x0130, 0x682c,
8007 0xa084, 0x00ff, 0x8007, 0x20a2, 0x0010, 0x20a3, 0x3f00, 0x00de,
8008 0x22a2, 0x22a2, 0x22a2, 0x60c3, 0x0001, 0x080c, 0x7821, 0x0005,
8009 0x20a1, 0x020b, 0x2009, 0x0003, 0x0019, 0x20a3, 0x7f00, 0x0c80,
8010 0x0026, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818, 0xa080, 0x0028,
8011 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110, 0xd0bc, 0x0188,
8012 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0100, 0x20a2,
8013 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6, 0x00de,
8014 0x0088, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085, 0x0100,
8015 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000, 0x2011, 0xad14,
8016 0x2214, 0x22a2, 0x20a3, 0x0888, 0xa18d, 0x0008, 0x21a2, 0x080c,
8017 0x7810, 0x22a2, 0x20a3, 0x0000, 0x7a08, 0x22a2, 0x2fa2, 0x20a3,
8018 0x0000, 0x20a3, 0x0000, 0x002e, 0x0005, 0x00e6, 0x00d6, 0x00c6,
8019 0x0056, 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0xad00, 0x7150,
8020 0x7818, 0x2068, 0x68a0, 0x2028, 0x76d0, 0xd6ac, 0x1130, 0xd0bc,
8021 0x1120, 0x6910, 0x6a14, 0x7450, 0x0020, 0x6910, 0x6a14, 0x736c,
8022 0x7470, 0x781c, 0xa0be, 0x0006, 0x0904, 0x775b, 0xa0be, 0x000a,
8023 0x15e8, 0xa185, 0x0200, 0x6062, 0x6266, 0x636a, 0x646e, 0x6073,
8024 0x2029, 0x6077, 0x0000, 0x688c, 0x8000, 0xa084, 0x00ff, 0x688e,
8025 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086,
8026 0x7810, 0x2070, 0x7014, 0x608a, 0x7010, 0x608e, 0x700c, 0x60c6,
8027 0x7008, 0x60ca, 0x686c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
8028 0x609f, 0x0000, 0x080c, 0x8014, 0x2009, 0x07d0, 0x60c4, 0xa084,
8029 0xfff0, 0xa005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x6586, 0x003e,
8030 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x70d0, 0xd0ac,
8031 0x1110, 0xd5bc, 0x0138, 0xa185, 0x0100, 0x6062, 0x6266, 0x636a,
8032 0x646e, 0x0038, 0xa185, 0x0100, 0x6062, 0x6266, 0x606b, 0x0000,
8033 0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x688c, 0x8000, 0xa084,
8034 0x00ff, 0x688e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082,
8035 0x7808, 0x6086, 0x7810, 0x2070, 0x7014, 0x608a, 0x7010, 0x608e,
8036 0x700c, 0x60c6, 0x7008, 0x60ca, 0x686c, 0x60ce, 0x60af, 0x95d5,
8037 0x60d7, 0x0000, 0xa582, 0x0080, 0x0248, 0x6a00, 0xd2f4, 0x0120,
8038 0x6a14, 0xa294, 0x00ff, 0x0010, 0x2011, 0x0000, 0x629e, 0x080c,
8039 0x8014, 0x2009, 0x07d0, 0x60c4, 0xa084, 0xfff0, 0xa005, 0x0110,
8040 0x2009, 0x1b58, 0x080c, 0x6586, 0x003e, 0x004e, 0x005e, 0x00ce,
8041 0x00de, 0x00ee, 0x0005, 0x7810, 0x2070, 0x704c, 0xa084, 0x0003,
8042 0xa086, 0x0002, 0x0904, 0x77b1, 0x2001, 0xad34, 0x2004, 0xd0ac,
8043 0x1110, 0xd5bc, 0x0138, 0xa185, 0x0100, 0x6062, 0x6266, 0x636a,
8044 0x646e, 0x0038, 0xa185, 0x0100, 0x6062, 0x6266, 0x606b, 0x0000,
8045 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0x688c, 0x8000, 0xa084,
8046 0x00ff, 0x688e, 0x8007, 0x607a, 0x7834, 0x607e, 0x2f00, 0x6086,
8047 0x7808, 0x6082, 0x7060, 0x608a, 0x705c, 0x608e, 0x7080, 0x60c6,
8048 0x707c, 0x60ca, 0x707c, 0x792c, 0xa108, 0x792e, 0x7080, 0x7928,
8049 0xa109, 0x792a, 0x686c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
8050 0xa582, 0x0080, 0x0248, 0x6a00, 0xd2f4, 0x0120, 0x6a14, 0xa294,
8051 0x00ff, 0x0010, 0x2011, 0x0000, 0x629e, 0x080c, 0x8011, 0x0804,
8052 0x7749, 0x2001, 0xad34, 0x2004, 0xd0ac, 0x1110, 0xd5bc, 0x0138,
8053 0xa185, 0x0700, 0x6062, 0x6266, 0x636a, 0x646e, 0x0038, 0xa185,
8054 0x0700, 0x6062, 0x6266, 0x606b, 0x0000, 0x646e, 0x080c, 0x5025,
8055 0x0180, 0x00d6, 0x7810, 0xa06d, 0x684c, 0x00de, 0xa084, 0x2020,
8056 0xa086, 0x2020, 0x1130, 0x7820, 0xc0cd, 0x7822, 0x6073, 0x0889,
8057 0x0010, 0x6073, 0x0898, 0x6077, 0x0000, 0x688c, 0x8000, 0xa084,
8058 0x00ff, 0x688e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086,
8059 0x7808, 0x6082, 0x7014, 0x608a, 0x7010, 0x608e, 0x700c, 0x60c6,
8060 0x7008, 0x60ca, 0x686c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
8061 0xa582, 0x0080, 0x0248, 0x6a00, 0xd2f4, 0x0120, 0x6a14, 0xa294,
8062 0x00ff, 0x0010, 0x2011, 0x0000, 0x629e, 0x7820, 0xd0cc, 0x0120,
8063 0x080c, 0x8014, 0x0804, 0x7749, 0x080c, 0x8011, 0x0804, 0x7749,
8064 0x7a18, 0xa280, 0x0023, 0x2014, 0x8210, 0xa294, 0x00ff, 0x2202,
8065 0x8217, 0x0005, 0x00d6, 0x2069, 0xafc7, 0x6843, 0x0001, 0x00de,
8066 0x0005, 0x20e1, 0x9080, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x0019,
8067 0x080c, 0x6578, 0x0005, 0x0006, 0x6014, 0xa084, 0x0004, 0xa085,
8068 0x0009, 0x6016, 0x000e, 0x0005, 0x0006, 0x00c6, 0x2061, 0x0100,
8069 0x6014, 0xa084, 0x0004, 0xa085, 0x0008, 0x6016, 0x00ce, 0x000e,
8070 0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069,
8071 0x0140, 0x080c, 0x574f, 0x1178, 0x2001, 0xafe3, 0x2004, 0xa005,
8072 0x1598, 0x080c, 0x57d1, 0x1118, 0x080c, 0x6578, 0x0468, 0x00c6,
8073 0x2061, 0xafc7, 0x00d8, 0x6904, 0xa194, 0x4000, 0x0550, 0x08a1,
8074 0x6803, 0x1000, 0x6803, 0x0000, 0x00c6, 0x2061, 0xafc7, 0x6128,
8075 0xa192, 0x00c8, 0x1258, 0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff,
8076 0x0198, 0x080c, 0x6578, 0x080c, 0x782b, 0x0070, 0x6124, 0xa1e5,
8077 0x0000, 0x0140, 0x080c, 0xaca2, 0x2009, 0x0014, 0x080c, 0x80a7,
8078 0x080c, 0x6581, 0x00ce, 0x0000, 0x002e, 0x001e, 0x00de, 0x00ce,
8079 0x0005, 0x2001, 0xafe3, 0x2004, 0xa005, 0x1db0, 0x00c6, 0x2061,
8080 0xafc7, 0x6128, 0xa192, 0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce,
8081 0x080c, 0x6578, 0x080c, 0x485e, 0x0c38, 0x00c6, 0x00d6, 0x00e6,
8082 0x0016, 0x0026, 0x080c, 0x658e, 0x2071, 0xafc7, 0x713c, 0x81ff,
8083 0x0570, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x574f, 0x1188,
8084 0x0036, 0x2019, 0x0001, 0x080c, 0x7a64, 0x003e, 0x713c, 0x2160,
8085 0x080c, 0xaca2, 0x2009, 0x004a, 0x080c, 0x80a7, 0x080c, 0x57d1,
8086 0x00b0, 0x6904, 0xa194, 0x4000, 0x01c0, 0x6803, 0x1000, 0x6803,
8087 0x0000, 0x0036, 0x2019, 0x0001, 0x080c, 0x7a64, 0x003e, 0x713c,
8088 0x2160, 0x080c, 0xaca2, 0x2009, 0x004a, 0x080c, 0x80a7, 0x002e,
8089 0x001e, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0c58, 0x00e6, 0x00d6,
8090 0x00c6, 0x0066, 0x0056, 0x0046, 0x0006, 0x0126, 0x2091, 0x8000,
8091 0x6018, 0x2068, 0x6ca0, 0x2071, 0xafc7, 0x7018, 0x2068, 0x8dff,
8092 0x0198, 0x68a0, 0xa406, 0x0118, 0x6854, 0x2068, 0x0cc0, 0x6010,
8093 0x2060, 0x643c, 0x6540, 0x6e48, 0x2d60, 0x080c, 0x4e41, 0x0120,
8094 0x080c, 0x7b88, 0xa085, 0x0001, 0x012e, 0x000e, 0x004e, 0x005e,
8095 0x006e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x20a1, 0x020b, 0x080c,
8096 0x710e, 0x20a3, 0x1200, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x781c,
8097 0xa086, 0x0004, 0x1110, 0x6098, 0x0018, 0x2001, 0xad14, 0x2004,
8098 0x20a2, 0x7834, 0x20a2, 0x7838, 0x20a2, 0x20a9, 0x0010, 0xa006,
8099 0x20a2, 0x1f04, 0x7928, 0x20a2, 0x20a2, 0x60c3, 0x002c, 0x080c,
8100 0x7821, 0x0005, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x710e,
8101 0x20a3, 0x0f00, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x7808, 0x20a2,
8102 0x60c3, 0x0008, 0x080c, 0x7821, 0x014e, 0x015e, 0x0005, 0x0156,
8103 0x0146, 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0200, 0x20a3,
8104 0x0000, 0x20a9, 0x0006, 0x2011, 0xad40, 0x2019, 0xad41, 0x23a6,
8105 0x22a6, 0xa398, 0x0002, 0xa290, 0x0002, 0x1f04, 0x7957, 0x20a3,
8106 0x0000, 0x20a3, 0x0000, 0x60c3, 0x001c, 0x080c, 0x7821, 0x014e,
8107 0x015e, 0x0005, 0x0156, 0x0146, 0x0016, 0x0026, 0x20a1, 0x020b,
8108 0x080c, 0x7183, 0x080c, 0x7199, 0x7810, 0xa080, 0x0000, 0x2004,
8109 0xa080, 0x0015, 0x2098, 0x7808, 0xa088, 0x0002, 0x21a8, 0x53a6,
8110 0xa080, 0x0004, 0x8003, 0x60c2, 0x080c, 0x7821, 0x002e, 0x001e,
8111 0x014e, 0x015e, 0x0005, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c,
8112 0x710e, 0x20a3, 0x6200, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x7808,
8113 0x20a2, 0x60c3, 0x0008, 0x080c, 0x7821, 0x014e, 0x015e, 0x0005,
8114 0x0156, 0x0146, 0x0016, 0x0026, 0x20a1, 0x020b, 0x080c, 0x710e,
8115 0x7810, 0xa080, 0x0000, 0x2004, 0xa080, 0x0017, 0x2098, 0x7808,
8116 0xa088, 0x0002, 0x21a8, 0x53a6, 0x8003, 0x60c2, 0x080c, 0x7821,
8117 0x002e, 0x001e, 0x014e, 0x015e, 0x0005, 0x00e6, 0x00c6, 0x0006,
8118 0x0126, 0x2091, 0x8000, 0x2071, 0xafc7, 0x700c, 0x2060, 0x8cff,
8119 0x0178, 0x080c, 0x9789, 0x1110, 0x080c, 0x85f3, 0x600c, 0x0006,
8120 0x080c, 0x994e, 0x080c, 0x8078, 0x080c, 0x7b88, 0x00ce, 0x0c78,
8121 0x700f, 0x0000, 0x700b, 0x0000, 0x012e, 0x000e, 0x00ce, 0x00ee,
8122 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0026,
8123 0x0016, 0x0006, 0x2091, 0x8000, 0x2069, 0x0100, 0x2079, 0x0140,
8124 0x2071, 0xafc7, 0x7024, 0x2060, 0x8cff, 0x05a0, 0x080c, 0x7834,
8125 0x68c3, 0x0000, 0x080c, 0x6581, 0x2009, 0x0013, 0x080c, 0x80a7,
8126 0x20a9, 0x01f4, 0x6824, 0xd094, 0x0158, 0x6827, 0x0004, 0x7804,
8127 0xa084, 0x4000, 0x01a0, 0x7803, 0x1000, 0x7803, 0x0000, 0x0078,
8128 0xd084, 0x0118, 0x6827, 0x0001, 0x0010, 0x1f04, 0x7a02, 0x7804,
8129 0xa084, 0x1000, 0x0120, 0x7803, 0x0100, 0x7803, 0x0000, 0x6824,
8130 0x000e, 0x001e, 0x002e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e,
8131 0x012e, 0x0005, 0x2001, 0xad00, 0x2004, 0xa096, 0x0001, 0x0550,
8132 0xa096, 0x0004, 0x0538, 0x6817, 0x0008, 0x68c3, 0x0000, 0x2011,
8133 0x481b, 0x080c, 0x650d, 0x20a9, 0x01f4, 0x6824, 0xd094, 0x0158,
8134 0x6827, 0x0004, 0x7804, 0xa084, 0x4000, 0x01a0, 0x7803, 0x1000,
8135 0x7803, 0x0000, 0x0078, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010,
8136 0x1f04, 0x7a3d, 0x7804, 0xa084, 0x1000, 0x0120, 0x7803, 0x0100,
8137 0x7803, 0x0000, 0x000e, 0x001e, 0x002e, 0x00ce, 0x00de, 0x00ee,
8138 0x00fe, 0x015e, 0x012e, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6,
8139 0x00d6, 0x00c6, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2069,
8140 0x0100, 0x2079, 0x0140, 0x2071, 0xafc7, 0x703c, 0x2060, 0x8cff,
8141 0x0904, 0x7ad5, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0,
8142 0x68c7, 0x0000, 0x68cb, 0x0008, 0x080c, 0x658e, 0x080c, 0x20b5,
8143 0x0046, 0x2009, 0x017f, 0x200b, 0x00a5, 0x2021, 0x0169, 0x2404,
8144 0xa084, 0x000f, 0xa086, 0x0004, 0x11b0, 0x68c7, 0x0000, 0x68cb,
8145 0x0008, 0x00e6, 0x00f6, 0x2079, 0x0020, 0x2071, 0xb01e, 0x6814,
8146 0xa084, 0x0184, 0xa085, 0x0012, 0x6816, 0x7803, 0x0008, 0x7003,
8147 0x0000, 0x00fe, 0x00ee, 0x200b, 0x0000, 0x004e, 0xa39d, 0x0000,
8148 0x1120, 0x2009, 0x0049, 0x080c, 0x80a7, 0x20a9, 0x03e8, 0x6824,
8149 0xd094, 0x0158, 0x6827, 0x0004, 0x7804, 0xa084, 0x4000, 0x01a0,
8150 0x7803, 0x1000, 0x7803, 0x0000, 0x0078, 0xd08c, 0x0118, 0x6827,
8151 0x0002, 0x0010, 0x1f04, 0x7ab7, 0x7804, 0xa084, 0x1000, 0x0120,
8152 0x7803, 0x0100, 0x7803, 0x0000, 0x6824, 0x000e, 0x001e, 0x002e,
8153 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x00d6,
8154 0x0126, 0x2091, 0x8000, 0x2069, 0xafc7, 0x6a06, 0x012e, 0x00de,
8155 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0xafc7, 0x6a32,
8156 0x012e, 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0006,
8157 0x0126, 0x2071, 0xafc7, 0x7614, 0x2660, 0x2678, 0x2091, 0x8000,
8158 0x8cff, 0x0538, 0x601c, 0xa206, 0x1500, 0x7014, 0xac36, 0x1110,
8159 0x660c, 0x7616, 0x7010, 0xac36, 0x1140, 0x2c00, 0xaf36, 0x0118,
8160 0x2f00, 0x7012, 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00,
8161 0xaf06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c,
8162 0x974e, 0x080c, 0x7b88, 0x00ce, 0x08d8, 0x2c78, 0x600c, 0x2060,
8163 0x08b8, 0x012e, 0x000e, 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
8164 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x73cf, 0x7810, 0x20a2,
8165 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x1000, 0x0804,
8166 0x7b80, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x73cf, 0x7810,
8167 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x4000,
8168 0x0478, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x73cf, 0x7810,
8169 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x2000,
8170 0x00f8, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x73cf, 0x7810,
8171 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x0400,
8172 0x0078, 0x0156, 0x0146, 0x20a1, 0x020b, 0x080c, 0x73cf, 0x7810,
8173 0x20a2, 0xa006, 0x20a2, 0x20a2, 0x20a2, 0x20a2, 0x20a3, 0x0200,
8174 0x0089, 0x60c3, 0x0020, 0x080c, 0x7821, 0x014e, 0x015e, 0x0005,
8175 0x00e6, 0x2071, 0xafc7, 0x7020, 0xa005, 0x0110, 0x8001, 0x7022,
8176 0x00ee, 0x0005, 0x20a9, 0x0008, 0x20a2, 0x1f04, 0x7b94, 0x20a2,
8177 0x20a2, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066,
8178 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0xafc7, 0x7614, 0x2660,
8179 0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0x7c24, 0x8cff, 0x0904,
8180 0x7c24, 0x601c, 0xa086, 0x0006, 0x1904, 0x7c1f, 0x88ff, 0x0138,
8181 0x2800, 0xac06, 0x1904, 0x7c1f, 0x2039, 0x0000, 0x0050, 0x6018,
8182 0xa206, 0x1904, 0x7c1f, 0x85ff, 0x0120, 0x6050, 0xa106, 0x1904,
8183 0x7c1f, 0x7024, 0xac06, 0x1538, 0x2069, 0x0100, 0x68c0, 0xa005,
8184 0x01f0, 0x080c, 0x6581, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c,
8185 0x7ca8, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0xa384,
8186 0x1000, 0x0120, 0x6803, 0x0100, 0x6803, 0x0000, 0x2069, 0x0100,
8187 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0020, 0x6003,
8188 0x0009, 0x630a, 0x0460, 0x7014, 0xac36, 0x1110, 0x660c, 0x7616,
8189 0x7010, 0xac36, 0x1140, 0x2c00, 0xaf36, 0x0118, 0x2f00, 0x7012,
8190 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0xaf06, 0x0110,
8191 0x7e0e, 0x0008, 0x2678, 0x89ff, 0x1158, 0x600f, 0x0000, 0x6010,
8192 0x2068, 0x080c, 0x9596, 0x0110, 0x080c, 0xa91f, 0x080c, 0x974e,
8193 0x080c, 0x7b88, 0x88ff, 0x1190, 0x00ce, 0x0804, 0x7bab, 0x2c78,
8194 0x600c, 0x2060, 0x0804, 0x7bab, 0xa006, 0x012e, 0x000e, 0x006e,
8195 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6017, 0x0000,
8196 0x00ce, 0xa8c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
8197 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0xafc7,
8198 0x7638, 0x2660, 0x2678, 0x8cff, 0x0904, 0x7c98, 0x601c, 0xa086,
8199 0x0006, 0x1904, 0x7c93, 0x87ff, 0x0128, 0x2700, 0xac06, 0x1904,
8200 0x7c93, 0x0040, 0x6018, 0xa206, 0x15f0, 0x85ff, 0x0118, 0x6050,
8201 0xa106, 0x15c8, 0x703c, 0xac06, 0x1170, 0x0036, 0x2019, 0x0001,
8202 0x080c, 0x7a64, 0x7033, 0x0000, 0x703f, 0x0000, 0x7043, 0x0000,
8203 0x7047, 0x0000, 0x003e, 0x7038, 0xac36, 0x1110, 0x660c, 0x763a,
8204 0x7034, 0xac36, 0x1140, 0x2c00, 0xaf36, 0x0118, 0x2f00, 0x7036,
8205 0x0010, 0x7037, 0x0000, 0x660c, 0x0066, 0x2c00, 0xaf06, 0x0110,
8206 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6010, 0x2068, 0x080c,
8207 0x9596, 0x0110, 0x080c, 0xa91f, 0x080c, 0x974e, 0x87ff, 0x1190,
8208 0x00ce, 0x0804, 0x7c43, 0x2c78, 0x600c, 0x2060, 0x0804, 0x7c43,
8209 0xa006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee,
8210 0x00fe, 0x0005, 0x6017, 0x0000, 0x00ce, 0xa7bd, 0x0001, 0x0c88,
8211 0x00e6, 0x2071, 0xafc7, 0x2001, 0xad00, 0x2004, 0xa086, 0x0002,
8212 0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000, 0x00ee, 0x0005,
8213 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
8214 0x8000, 0x2071, 0xafc7, 0x2c10, 0x7638, 0x2660, 0x2678, 0x8cff,
8215 0x0518, 0x2200, 0xac06, 0x11e0, 0x7038, 0xac36, 0x1110, 0x660c,
8216 0x763a, 0x7034, 0xac36, 0x1140, 0x2c00, 0xaf36, 0x0118, 0x2f00,
8217 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x2c00, 0xaf06, 0x0110,
8218 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0xa085, 0x0001, 0x0020,
8219 0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e, 0x002e, 0x006e,
8220 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
8221 0x0066, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0xafc7, 0x760c,
8222 0x2660, 0x2678, 0x8cff, 0x0904, 0x7d7e, 0x6018, 0xa080, 0x0028,
8223 0x2004, 0xa206, 0x1904, 0x7d79, 0x7024, 0xac06, 0x1508, 0x2069,
8224 0x0100, 0x68c0, 0xa005, 0x0904, 0x7d55, 0x080c, 0x7834, 0x68c3,
8225 0x0000, 0x080c, 0x7ca8, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
8226 0x6b04, 0xa384, 0x1000, 0x0120, 0x6803, 0x0100, 0x6803, 0x0000,
8227 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
8228 0x700c, 0xac36, 0x1110, 0x660c, 0x760e, 0x7008, 0xac36, 0x1140,
8229 0x2c00, 0xaf36, 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000,
8230 0x660c, 0x0066, 0x2c00, 0xaf06, 0x0110, 0x7e0e, 0x0008, 0x2678,
8231 0x600f, 0x0000, 0x080c, 0x9778, 0x1158, 0x080c, 0x2aff, 0x080c,
8232 0x9789, 0x11f0, 0x080c, 0x85f3, 0x00d8, 0x080c, 0x7ca8, 0x08c0,
8233 0x080c, 0x9789, 0x1118, 0x080c, 0x85f3, 0x0090, 0x6010, 0x2068,
8234 0x080c, 0x9596, 0x0168, 0x601c, 0xa086, 0x0003, 0x11f8, 0x6837,
8235 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x510c, 0x080c, 0x9742,
8236 0x080c, 0x994e, 0x080c, 0x974e, 0x080c, 0x7b88, 0x00ce, 0x0804,
8237 0x7d02, 0x2c78, 0x600c, 0x2060, 0x0804, 0x7d02, 0x012e, 0x000e,
8238 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601c, 0xa086,
8239 0x0006, 0x1d30, 0x080c, 0xa91f, 0x0c18, 0x0036, 0x0156, 0x0136,
8240 0x0146, 0x3908, 0xa006, 0xa190, 0x0020, 0x221c, 0xa39e, 0x28f9,
8241 0x1118, 0x8210, 0x8000, 0x0cc8, 0xa005, 0x0138, 0x20a9, 0x0020,
8242 0x2198, 0xa110, 0x22a0, 0x22c8, 0x53a3, 0x014e, 0x013e, 0x015e,
8243 0x003e, 0x0005, 0x00d6, 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3,
8244 0x0200, 0x20a3, 0x0014, 0x60c3, 0x0014, 0x20a3, 0x0000, 0x20a3,
8245 0x0000, 0x2099, 0xafa6, 0x20a9, 0x0004, 0x53a6, 0x20a3, 0x0004,
8246 0x20a3, 0x7878, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x080c, 0x7821,
8247 0x00de, 0x0005, 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3, 0x0214,
8248 0x20a3, 0x0018, 0x20a3, 0x0800, 0x7810, 0xa084, 0xff00, 0x20a2,
8249 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x20a3, 0x0000,
8250 0x7810, 0xa084, 0x00ff, 0x20a2, 0x7828, 0x20a2, 0x20a3, 0x0000,
8251 0x20a3, 0x0000, 0x60c3, 0x0018, 0x080c, 0x7821, 0x0005, 0x00d6,
8252 0x0016, 0x2f68, 0x2009, 0x0035, 0x080c, 0x9a34, 0x1904, 0x7e5d,
8253 0x20a1, 0x020b, 0x080c, 0x710e, 0x20a3, 0x1300, 0x20a3, 0x0000,
8254 0x7828, 0x2068, 0x681c, 0xa086, 0x0003, 0x0580, 0x7818, 0xa080,
8255 0x0028, 0x2014, 0x2001, 0xad34, 0x2004, 0xd0ac, 0x11d0, 0xa286,
8256 0x007e, 0x1128, 0x20a3, 0x00ff, 0x20a3, 0xfffe, 0x04b8, 0xa286,
8257 0x007f, 0x1128, 0x20a3, 0x00ff, 0x20a3, 0xfffd, 0x0478, 0xd2bc,
8258 0x0180, 0xa286, 0x0080, 0x1128, 0x20a3, 0x00ff, 0x20a3, 0xfffc,
8259 0x0428, 0xa2e8, 0xae34, 0x2d6c, 0x6810, 0x20a2, 0x6814, 0x20a2,
8260 0x00e8, 0x20a3, 0x0000, 0x6098, 0x20a2, 0x00c0, 0x2001, 0xad34,
8261 0x2004, 0xd0ac, 0x1138, 0x7818, 0xa080, 0x0028, 0x2004, 0xa082,
8262 0x007e, 0x0240, 0x00d6, 0x2069, 0xad1b, 0x2da6, 0x8d68, 0x2da6,
8263 0x00de, 0x0020, 0x20a3, 0x0000, 0x6034, 0x20a2, 0x7834, 0x20a2,
8264 0x7838, 0x20a2, 0x20a3, 0x0000, 0x20a3, 0x0000, 0x60c3, 0x000c,
8265 0x080c, 0x7821, 0x001e, 0x00de, 0x0005, 0x7817, 0x0001, 0x7803,
8266 0x0006, 0x001e, 0x00de, 0x0005, 0x00d6, 0x0026, 0x7928, 0x2168,
8267 0x691c, 0xa186, 0x0006, 0x01c0, 0xa186, 0x0003, 0x0904, 0x7ed3,
8268 0xa186, 0x0005, 0x0904, 0x7ebc, 0xa186, 0x0004, 0x05b8, 0xa186,
8269 0x0008, 0x0904, 0x7ec4, 0x7807, 0x0037, 0x7813, 0x1700, 0x080c,
8270 0x7f3b, 0x002e, 0x00de, 0x0005, 0x080c, 0x7ef7, 0x2009, 0x4000,
8271 0x6800, 0x0002, 0x7e9d, 0x7ea8, 0x7e9f, 0x7ea8, 0x7ea4, 0x7e9d,
8272 0x7e9d, 0x7ea8, 0x7ea8, 0x7ea8, 0x7ea8, 0x7e9d, 0x7e9d, 0x7e9d,
8273 0x7e9d, 0x7e9d, 0x7ea8, 0x7e9d, 0x7ea8, 0x080c, 0x14f6, 0x6820,
8274 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0xa00e, 0x0010, 0x2009, 0x2000,
8275 0x6828, 0x20a2, 0x682c, 0x20a2, 0x0804, 0x7eed, 0x080c, 0x7ef7,
8276 0x20a3, 0x0000, 0x20a3, 0x0000, 0x2009, 0x4000, 0x6a00, 0xa286,
8277 0x0002, 0x1108, 0xa00e, 0x0488, 0x04d1, 0x20a3, 0x0000, 0x20a3,
8278 0x0000, 0x2009, 0x4000, 0x0448, 0x0491, 0x20a3, 0x0000, 0x20a3,
8279 0x0000, 0x2009, 0x4000, 0xa286, 0x0005, 0x0118, 0xa286, 0x0002,
8280 0x1108, 0xa00e, 0x00d0, 0x0419, 0x6810, 0x2068, 0x697c, 0x6810,
8281 0xa112, 0x6980, 0x6814, 0xa103, 0x20a2, 0x22a2, 0x7928, 0xa180,
8282 0x0000, 0x2004, 0xa08e, 0x0002, 0x0130, 0xa08e, 0x0004, 0x0118,
8283 0x2009, 0x4000, 0x0010, 0x2009, 0x0000, 0x21a2, 0x20a3, 0x0000,
8284 0x60c3, 0x0018, 0x080c, 0x7821, 0x002e, 0x00de, 0x0005, 0x0036,
8285 0x0046, 0x0056, 0x0066, 0x20a1, 0x020b, 0x080c, 0x71aa, 0xa006,
8286 0x20a3, 0x0200, 0x20a2, 0x7934, 0x21a2, 0x7938, 0x21a2, 0x7818,
8287 0xa080, 0x0028, 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1118,
8288 0xa092, 0x007e, 0x0268, 0x00d6, 0x2069, 0xad1b, 0x2d2c, 0x8d68,
8289 0x2d34, 0xa0e8, 0xae34, 0x2d6c, 0x6b10, 0x6c14, 0x00de, 0x0030,
8290 0x2019, 0x0000, 0x6498, 0x2029, 0x0000, 0x6634, 0x7828, 0xa080,
8291 0x0007, 0x2004, 0xa086, 0x0003, 0x1128, 0x25a2, 0x26a2, 0x23a2,
8292 0x24a2, 0x0020, 0x23a2, 0x24a2, 0x25a2, 0x26a2, 0x006e, 0x005e,
8293 0x004e, 0x003e, 0x0005, 0x20a1, 0x020b, 0x080c, 0x71aa, 0x20a3,
8294 0x0100, 0x20a3, 0x0000, 0x20a3, 0x0009, 0x7810, 0x20a2, 0x60c3,
8295 0x0008, 0x080c, 0x7821, 0x0005, 0x20a1, 0x020b, 0x080c, 0x7106,
8296 0x20a3, 0x1400, 0x20a3, 0x0000, 0x7834, 0x20a2, 0x7838, 0x20a2,
8297 0x7828, 0x20a2, 0x782c, 0x20a2, 0x7830, 0xa084, 0x00ff, 0x8007,
8298 0x20a2, 0x20a3, 0x0000, 0x60c3, 0x0010, 0x080c, 0x7821, 0x0005,
8299 0x20a1, 0x020b, 0x080c, 0x71a2, 0x20a3, 0x0100, 0x20a3, 0x0000,
8300 0x7828, 0x20a2, 0x7810, 0x20a2, 0x60c3, 0x0008, 0x080c, 0x7821,
8301 0x0005, 0x0146, 0x20a1, 0x020b, 0x0031, 0x60c3, 0x0000, 0x080c,
8302 0x7821, 0x014e, 0x0005, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7818,
8303 0xa080, 0x0028, 0x2004, 0x2011, 0xad34, 0x2214, 0xd2ac, 0x1110,
8304 0xd0bc, 0x0188, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810, 0xa085,
8305 0x0300, 0x20a2, 0x6814, 0x20a2, 0x2069, 0xad1b, 0x2da6, 0x8d68,
8306 0x2da6, 0x00de, 0x0078, 0x00d6, 0xa0e8, 0xae34, 0x2d6c, 0x6810,
8307 0xa085, 0x0300, 0x20a2, 0x6814, 0x20a2, 0x00de, 0x20a3, 0x0000,
8308 0x6234, 0x22a2, 0x20a3, 0x0819, 0x20a3, 0x0000, 0x080c, 0x7810,
8309 0x22a2, 0x20a3, 0x0000, 0x2fa2, 0x7a08, 0x22a2, 0x20a3, 0x0000,
8310 0x20a3, 0x0000, 0x0005, 0x20a1, 0x020b, 0x0079, 0x7910, 0x21a2,
8311 0x20a3, 0x0000, 0x60c3, 0x0000, 0x20e1, 0x9080, 0x60a7, 0x9575,
8312 0x080c, 0x782b, 0x080c, 0x6578, 0x0005, 0x0156, 0x0136, 0x0036,
8313 0x00d6, 0x00e6, 0x20e1, 0x9080, 0x20e1, 0x4000, 0x7854, 0x2068,
8314 0xadf0, 0x000f, 0x7210, 0xa296, 0x00c0, 0xa294, 0xfffd, 0x7212,
8315 0x7214, 0xa294, 0x0300, 0x7216, 0x7100, 0xa194, 0x00ff, 0x7308,
8316 0xa384, 0x00ff, 0xa08d, 0xc200, 0x7102, 0xa384, 0xff00, 0xa215,
8317 0x720a, 0x7004, 0x720c, 0x700e, 0x7206, 0x20a9, 0x000a, 0x2e98,
8318 0x53a6, 0x60a3, 0x0035, 0x6a38, 0xa294, 0x7000, 0xa286, 0x3000,
8319 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x003e, 0x013e, 0x015e,
8320 0x0005, 0x2009, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036,
8321 0x6116, 0x0005, 0x2061, 0xb400, 0x2a70, 0x7064, 0x7046, 0x704b,
8322 0xb400, 0x0005, 0x00e6, 0x0126, 0x2071, 0xad00, 0x2091, 0x8000,
8323 0x7544, 0xa582, 0x0010, 0x0608, 0x7048, 0x2060, 0x6000, 0xa086,
8324 0x0000, 0x0148, 0xace0, 0x0018, 0x7058, 0xac02, 0x1208, 0x0cb0,
8325 0x2061, 0xb400, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7546, 0xaca8,
8326 0x0018, 0x7058, 0xa502, 0x1230, 0x754a, 0xa085, 0x0001, 0x012e,
8327 0x00ee, 0x0005, 0x704b, 0xb400, 0x0cc0, 0xa006, 0x0cc0, 0x00e6,
8328 0x2071, 0xad00, 0x7544, 0xa582, 0x0010, 0x0600, 0x7048, 0x2060,
8329 0x6000, 0xa086, 0x0000, 0x0148, 0xace0, 0x0018, 0x7058, 0xac02,
8330 0x1208, 0x0cb0, 0x2061, 0xb400, 0x0c98, 0x6003, 0x0008, 0x8529,
8331 0x7546, 0xaca8, 0x0018, 0x7058, 0xa502, 0x1228, 0x754a, 0xa085,
8332 0x0001, 0x00ee, 0x0005, 0x704b, 0xb400, 0x0cc8, 0xa006, 0x0cc8,
8333 0xac82, 0xb400, 0x0a0c, 0x14f6, 0x2001, 0xad16, 0x2004, 0xac02,
8334 0x1a0c, 0x14f6, 0xa006, 0x6006, 0x600a, 0x600e, 0x6012, 0x6016,
8335 0x601a, 0x601f, 0x0000, 0x6003, 0x0000, 0x6052, 0x6056, 0x6022,
8336 0x6026, 0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e, 0x2061,
8337 0xad00, 0x6044, 0x8000, 0x6046, 0xa086, 0x0001, 0x0108, 0x0005,
8338 0x0126, 0x2091, 0x8000, 0x080c, 0x6c50, 0x012e, 0x0cc0, 0x601c,
8339 0xa084, 0x000f, 0x0002, 0x80b6, 0x80c5, 0x80e0, 0x80fb, 0x9a61,
8340 0x9a7c, 0x9a97, 0x80b6, 0x80c5, 0x80b6, 0x8116, 0xa186, 0x0013,
8341 0x1128, 0x080c, 0x6b73, 0x080c, 0x6c50, 0x0005, 0xa18e, 0x0047,
8342 0x1118, 0xa016, 0x080c, 0x1824, 0x0005, 0x0066, 0x6000, 0xa0b2,
8343 0x0010, 0x1a0c, 0x14f6, 0x0013, 0x006e, 0x0005, 0x80de, 0x8478,
8344 0x862d, 0x80de, 0x86a2, 0x81cf, 0x80de, 0x80de, 0x840a, 0x8a91,
8345 0x80de, 0x80de, 0x80de, 0x80de, 0x80de, 0x80de, 0x080c, 0x14f6,
8346 0x0066, 0x6000, 0xa0b2, 0x0010, 0x1a0c, 0x14f6, 0x0013, 0x006e,
8347 0x0005, 0x80f9, 0x909a, 0x80f9, 0x80f9, 0x80f9, 0x80f9, 0x80f9,
8348 0x80f9, 0x9045, 0x9200, 0x80f9, 0x90c7, 0x913e, 0x90c7, 0x913e,
8349 0x80f9, 0x080c, 0x14f6, 0x0066, 0x6000, 0xa0b2, 0x0010, 0x1a0c,
8350 0x14f6, 0x0013, 0x006e, 0x0005, 0x8114, 0x8ad2, 0x8b98, 0x8cb8,
8351 0x8e12, 0x8114, 0x8114, 0x8114, 0x8aac, 0x8ff5, 0x8ff8, 0x8114,
8352 0x8114, 0x8114, 0x8114, 0x9022, 0x080c, 0x14f6, 0x0066, 0x6000,
8353 0xa0b2, 0x0010, 0x1a0c, 0x14f6, 0x0013, 0x006e, 0x0005, 0x812f,
8354 0x812f, 0x812f, 0x8152, 0x81a5, 0x812f, 0x812f, 0x812f, 0x8131,
8355 0x812f, 0x812f, 0x812f, 0x812f, 0x812f, 0x812f, 0x812f, 0x080c,
8356 0x14f6, 0xa186, 0x0003, 0x190c, 0x14f6, 0x00d6, 0x6003, 0x0003,
8357 0x6106, 0x6010, 0x2068, 0x684f, 0x0040, 0x687c, 0x680a, 0x6880,
8358 0x680e, 0x6813, 0x0000, 0x6817, 0x0000, 0x00de, 0x2c10, 0x080c,
8359 0x1e6e, 0x080c, 0x680b, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d0d,
8360 0x012e, 0x0005, 0xa182, 0x0047, 0x0002, 0x815e, 0x815e, 0x8160,
8361 0x817f, 0x815e, 0x815e, 0x815e, 0x815e, 0x8191, 0x080c, 0x14f6,
8362 0x00d6, 0x0016, 0x080c, 0x6c05, 0x080c, 0x6d0d, 0x6003, 0x0004,
8363 0x6110, 0x2168, 0x6854, 0x8003, 0x800b, 0x810b, 0xa108, 0x6116,
8364 0x684f, 0x0020, 0x685c, 0x685a, 0x6874, 0x687e, 0x6878, 0x6882,
8365 0x6897, 0x0000, 0x689b, 0x0000, 0x001e, 0x00de, 0x0005, 0x080c,
8366 0x6c05, 0x00d6, 0x6110, 0x2168, 0x080c, 0x9596, 0x0120, 0x684b,
8367 0x0006, 0x080c, 0x510c, 0x00de, 0x080c, 0x8078, 0x080c, 0x6d0d,
8368 0x0005, 0x080c, 0x6c05, 0x080c, 0x2ad9, 0x00d6, 0x6110, 0x2168,
8369 0x080c, 0x9596, 0x0120, 0x684b, 0x0029, 0x080c, 0x510c, 0x00de,
8370 0x080c, 0x8078, 0x080c, 0x6d0d, 0x0005, 0xa182, 0x0047, 0x0002,
8371 0x81b3, 0x81c2, 0x81b1, 0x81b1, 0x81b1, 0x81b1, 0x81b1, 0x81b1,
8372 0x81b1, 0x080c, 0x14f6, 0x00d6, 0x6010, 0x2068, 0x684c, 0xc0f4,
8373 0x684e, 0x00de, 0x20e1, 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x080c,
8374 0x1824, 0x0005, 0x00d6, 0x6110, 0x2168, 0x684b, 0x0000, 0x6853,
8375 0x0000, 0x080c, 0x510c, 0x00de, 0x080c, 0x8078, 0x0005, 0xa1b6,
8376 0x0015, 0x1118, 0x080c, 0x8078, 0x0030, 0xa1b6, 0x0016, 0x190c,
8377 0x14f6, 0x080c, 0x8078, 0x0005, 0x20a9, 0x000e, 0x2e98, 0x6010,
8378 0x20a0, 0x53a3, 0x20a9, 0x0006, 0x3310, 0x3420, 0x9398, 0x94a0,
8379 0x3318, 0x3428, 0x222e, 0x2326, 0xa290, 0x0002, 0xa5a8, 0x0002,
8380 0xa398, 0x0002, 0xa4a0, 0x0002, 0x1f04, 0x81ea, 0x00e6, 0x080c,
8381 0x9596, 0x0130, 0x6010, 0x2070, 0x7007, 0x0000, 0x7037, 0x0103,
8382 0x00ee, 0x080c, 0x8078, 0x0005, 0x00d6, 0x0036, 0x7330, 0xa386,
8383 0x0200, 0x1130, 0x6018, 0x2068, 0x6813, 0x00ff, 0x6817, 0xfffd,
8384 0x6010, 0xa005, 0x0130, 0x2068, 0x6807, 0x0000, 0x6837, 0x0103,
8385 0x6b32, 0x080c, 0x8078, 0x003e, 0x00de, 0x0005, 0x0016, 0x20a9,
8386 0x002a, 0xae80, 0x000c, 0x2098, 0x6010, 0xa080, 0x0002, 0x20a0,
8387 0x53a3, 0x20a9, 0x002a, 0x6010, 0xa080, 0x0001, 0x2004, 0xa080,
8388 0x0002, 0x20a0, 0x53a3, 0x00e6, 0x6010, 0x2004, 0x2070, 0x7037,
8389 0x0103, 0x00ee, 0x080c, 0x8078, 0x001e, 0x0005, 0x0016, 0x2009,
8390 0x0000, 0x7030, 0xa086, 0x0100, 0x0140, 0x7038, 0xa084, 0x00ff,
8391 0x808e, 0x703c, 0xa084, 0x00ff, 0x8086, 0xa080, 0x0004, 0xa108,
8392 0x21a8, 0xae80, 0x000c, 0x2098, 0x6010, 0xa080, 0x0002, 0x20a0,
8393 0x080c, 0x48be, 0x00e6, 0x080c, 0x9596, 0x0140, 0x6010, 0x2070,
8394 0x7007, 0x0000, 0x7034, 0x70b2, 0x7037, 0x0103, 0x00ee, 0x080c,
8395 0x8078, 0x001e, 0x0005, 0x00e6, 0x00d6, 0x603f, 0x0000, 0x2c68,
8396 0x0016, 0x2009, 0x0035, 0x080c, 0x9a34, 0x001e, 0x1168, 0x0026,
8397 0x6228, 0x2268, 0x002e, 0x2071, 0xb28c, 0x6b1c, 0xa386, 0x0003,
8398 0x0130, 0xa386, 0x0006, 0x0128, 0x080c, 0x8078, 0x0020, 0x0031,
8399 0x0010, 0x080c, 0x8323, 0x00de, 0x00ee, 0x0005, 0x00f6, 0x6810,
8400 0x2078, 0xa186, 0x0015, 0x0904, 0x830c, 0xa18e, 0x0016, 0x1904,
8401 0x8321, 0x700c, 0xa084, 0xff00, 0xa086, 0x1700, 0x1904, 0x82eb,
8402 0x8fff, 0x0904, 0x831f, 0x6808, 0xa086, 0xffff, 0x1904, 0x830e,
8403 0x784c, 0xa084, 0x0060, 0xa086, 0x0020, 0x1150, 0x797c, 0x7810,
8404 0xa106, 0x1904, 0x830e, 0x7980, 0x7814, 0xa106, 0x1904, 0x830e,
8405 0x080c, 0x9742, 0x6858, 0x7852, 0x784c, 0xc0dc, 0xc0f4, 0xc0d4,
8406 0x784e, 0x0026, 0xa00e, 0x6a14, 0x2001, 0x000a, 0x080c, 0x6665,
8407 0x7854, 0xa20a, 0x0208, 0x8011, 0x7a56, 0x82ff, 0x002e, 0x1138,
8408 0x00c6, 0x2d60, 0x080c, 0x9374, 0x00ce, 0x0804, 0x831f, 0x00c6,
8409 0x00d6, 0x2f68, 0x6838, 0xd0fc, 0x1118, 0x080c, 0x4993, 0x0010,
8410 0x080c, 0x4b7c, 0x00de, 0x00ce, 0x1548, 0x00c6, 0x2d60, 0x080c,
8411 0x8078, 0x00ce, 0x04a0, 0x7008, 0xa086, 0x000b, 0x11a0, 0x6018,
8412 0x200c, 0xc1bc, 0x2102, 0x00c6, 0x2d60, 0x7853, 0x0003, 0x6007,
8413 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x080c, 0x67a8, 0x080c,
8414 0x6c50, 0x00ce, 0x00e0, 0x700c, 0xa086, 0x2a00, 0x1138, 0x2001,
8415 0xafa5, 0x2004, 0x683e, 0x0098, 0x0471, 0x0098, 0x8fff, 0x090c,
8416 0x14f6, 0x00c6, 0x00d6, 0x2d60, 0x2f68, 0x684b, 0x0003, 0x080c,
8417 0x926f, 0x080c, 0x9742, 0x080c, 0x974e, 0x00de, 0x00ce, 0x080c,
8418 0x8078, 0x00fe, 0x0005, 0xa186, 0x0015, 0x1128, 0x2001, 0xafa5,
8419 0x2004, 0x683e, 0x0068, 0xa18e, 0x0016, 0x1160, 0x00c6, 0x2d00,
8420 0x2060, 0x080c, 0xabb4, 0x080c, 0x6618, 0x080c, 0x8078, 0x00ce,
8421 0x080c, 0x8078, 0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0x7c80,
8422 0x7b7c, 0xd2f4, 0x0130, 0x2001, 0xafa5, 0x2004, 0x683e, 0x0804,
8423 0x839d, 0x00c6, 0x2d60, 0x080c, 0x928f, 0x00ce, 0x6804, 0xa086,
8424 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007,
8425 0x0050, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x00ce, 0x04f0, 0x6800,
8426 0xa086, 0x000f, 0x01c8, 0x8fff, 0x090c, 0x14f6, 0x6820, 0xd0dc,
8427 0x1198, 0x6800, 0xa086, 0x0004, 0x1198, 0x784c, 0xd0ac, 0x0180,
8428 0x784c, 0xc0dc, 0xc0f4, 0x784e, 0x7850, 0xc0f4, 0xc0fc, 0x7852,
8429 0x2001, 0x0001, 0x682e, 0x00e0, 0x2001, 0x0007, 0x682e, 0x00c0,
8430 0x784c, 0xd0b4, 0x1130, 0xd0ac, 0x0db8, 0x784c, 0xd0f4, 0x1da0,
8431 0x0c38, 0xd2ec, 0x1d88, 0x7024, 0xa306, 0x1118, 0x7020, 0xa406,
8432 0x0d58, 0x7020, 0x6836, 0x7024, 0x683a, 0x2001, 0x0005, 0x682e,
8433 0x080c, 0x9894, 0x080c, 0x6c50, 0x0010, 0x080c, 0x8078, 0x004e,
8434 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x6034, 0x2068,
8435 0x6a1c, 0xa286, 0x0007, 0x0904, 0x83ee, 0xa286, 0x0002, 0x05f0,
8436 0xa286, 0x0000, 0x05d8, 0x6808, 0x6338, 0xa306, 0x15b8, 0x2071,
8437 0xb28c, 0xa186, 0x0015, 0x0560, 0xa18e, 0x0016, 0x1190, 0x6030,
8438 0xa084, 0x00ff, 0xa086, 0x0001, 0x1160, 0x700c, 0xa086, 0x2a00,
8439 0x1140, 0x6034, 0xa080, 0x0008, 0x200c, 0xc1dd, 0xc1f5, 0x2102,
8440 0x00b8, 0x00c6, 0x6034, 0x2060, 0x6010, 0x2068, 0x080c, 0x9596,
8441 0x090c, 0x14f6, 0x6853, 0x0003, 0x6007, 0x0085, 0x6003, 0x000b,
8442 0x601f, 0x0002, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x00ce, 0x0030,
8443 0x6034, 0x2070, 0x2001, 0xafa5, 0x2004, 0x703e, 0x080c, 0x8078,
8444 0x002e, 0x00de, 0x00ee, 0x0005, 0x00d6, 0x20a9, 0x000e, 0x2e98,
8445 0x6010, 0x20a0, 0x53a3, 0xa1b6, 0x0015, 0x1148, 0x6018, 0x2068,
8446 0x7038, 0x680a, 0x703c, 0x680e, 0x6800, 0xc08d, 0x6802, 0x00de,
8447 0x0804, 0x81f6, 0x2100, 0xa1b2, 0x0080, 0x1a0c, 0x14f6, 0xa1b2,
8448 0x0040, 0x1a04, 0x846e, 0x0002, 0x8462, 0x8456, 0x8462, 0x8462,
8449 0x8462, 0x8462, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454,
8450 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454,
8451 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454,
8452 0x8454, 0x8454, 0x8454, 0x8462, 0x8454, 0x8462, 0x8462, 0x8454,
8453 0x8454, 0x8454, 0x8454, 0x8454, 0x8462, 0x8454, 0x8454, 0x8454,
8454 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8462, 0x8462,
8455 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454, 0x8454,
8456 0x8454, 0x8462, 0x8454, 0x8454, 0x080c, 0x14f6, 0x6003, 0x0001,
8457 0x6106, 0x080c, 0x67ee, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c50,
8458 0x012e, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x67ee, 0x0126,
8459 0x2091, 0x8000, 0x080c, 0x6c50, 0x012e, 0x0005, 0x2600, 0x0002,
8460 0x8462, 0x8476, 0x8476, 0x8462, 0x8462, 0x8476, 0x080c, 0x14f6,
8461 0x6004, 0xa0b2, 0x0080, 0x1a0c, 0x14f6, 0xa1b6, 0x0013, 0x0904,
8462 0x8518, 0xa1b6, 0x0027, 0x1904, 0x84de, 0x080c, 0x6b73, 0x6004,
8463 0x080c, 0x9778, 0x0188, 0x080c, 0x9789, 0x0904, 0x84d8, 0xa08e,
8464 0x0021, 0x0904, 0x84db, 0xa08e, 0x0022, 0x0904, 0x84d8, 0xa08e,
8465 0x003d, 0x0904, 0x84db, 0x04a8, 0x080c, 0x2aff, 0x2001, 0x0007,
8466 0x080c, 0x4c30, 0x6018, 0xa080, 0x0028, 0x200c, 0x080c, 0x85f3,
8467 0xa186, 0x007e, 0x1148, 0x2001, 0xad34, 0x2014, 0xc285, 0x080c,
8468 0x574f, 0x1108, 0xc2ad, 0x2202, 0x0016, 0x0026, 0x0036, 0x2110,
8469 0x2019, 0x0028, 0x080c, 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c,
8470 0x681d, 0x00c6, 0x6018, 0xa065, 0x0110, 0x080c, 0x4ecf, 0x00ce,
8471 0x2c08, 0x080c, 0xa712, 0x007e, 0x003e, 0x002e, 0x001e, 0x080c,
8472 0x4c9f, 0x080c, 0x994e, 0x080c, 0x8078, 0x080c, 0x6c50, 0x0005,
8473 0x080c, 0x85f3, 0x0cb0, 0x080c, 0x8621, 0x0c98, 0xa186, 0x0014,
8474 0x1db0, 0x080c, 0x6b73, 0x080c, 0x2ad9, 0x080c, 0x9778, 0x1188,
8475 0x080c, 0x2aff, 0x6018, 0xa080, 0x0028, 0x200c, 0x080c, 0x85f3,
8476 0xa186, 0x007e, 0x1128, 0x2001, 0xad34, 0x200c, 0xc185, 0x2102,
8477 0x08c0, 0x080c, 0x9789, 0x1118, 0x080c, 0x85f3, 0x0890, 0x6004,
8478 0xa08e, 0x0032, 0x1158, 0x00e6, 0x00f6, 0x2071, 0xad81, 0x2079,
8479 0x0000, 0x080c, 0x2df1, 0x00fe, 0x00ee, 0x0818, 0x6004, 0xa08e,
8480 0x0021, 0x0d50, 0xa08e, 0x0022, 0x090c, 0x85f3, 0x0804, 0x84d1,
8481 0xa0b2, 0x0040, 0x1a04, 0x85db, 0x2008, 0x0002, 0x8560, 0x8561,
8482 0x8564, 0x8567, 0x856a, 0x856d, 0x855e, 0x855e, 0x855e, 0x855e,
8483 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e,
8484 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e,
8485 0x855e, 0x855e, 0x855e, 0x855e, 0x8570, 0x857f, 0x855e, 0x8581,
8486 0x857f, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x857f, 0x857f,
8487 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e, 0x855e,
8488 0x85bb, 0x857f, 0x855e, 0x857b, 0x855e, 0x855e, 0x855e, 0x857c,
8489 0x855e, 0x855e, 0x855e, 0x857f, 0x85b2, 0x855e, 0x080c, 0x14f6,
8490 0x00f0, 0x2001, 0x000b, 0x0460, 0x2001, 0x0003, 0x0448, 0x2001,
8491 0x0005, 0x0430, 0x2001, 0x0001, 0x0418, 0x2001, 0x0009, 0x0400,
8492 0x080c, 0x6b73, 0x6003, 0x0005, 0x2001, 0xafa5, 0x2004, 0x603e,
8493 0x080c, 0x6c50, 0x00a0, 0x0018, 0x0010, 0x080c, 0x4c30, 0x0804,
8494 0x85cc, 0x080c, 0x6b73, 0x2001, 0xafa3, 0x2004, 0x6016, 0x2001,
8495 0xafa5, 0x2004, 0x603e, 0x6003, 0x0004, 0x080c, 0x6c50, 0x0005,
8496 0x080c, 0x4c30, 0x080c, 0x6b73, 0x6003, 0x0002, 0x2001, 0xafa5,
8497 0x2004, 0x603e, 0x0036, 0x2019, 0xad5c, 0x2304, 0xa084, 0xff00,
8498 0x1120, 0x2001, 0xafa3, 0x201c, 0x0040, 0x8007, 0xa09a, 0x0004,
8499 0x0ec0, 0x8003, 0x801b, 0x831b, 0xa318, 0x6316, 0x003e, 0x080c,
8500 0x6c50, 0x08e8, 0x080c, 0x6b73, 0x080c, 0x994e, 0x080c, 0x8078,
8501 0x080c, 0x6c50, 0x08a0, 0x00e6, 0x00f6, 0x2071, 0xad81, 0x2079,
8502 0x0000, 0x080c, 0x2df1, 0x00fe, 0x00ee, 0x080c, 0x6b73, 0x080c,
8503 0x8078, 0x080c, 0x6c50, 0x0818, 0x080c, 0x6b73, 0x2001, 0xafa5,
8504 0x2004, 0x603e, 0x6003, 0x0002, 0x2001, 0xafa3, 0x2004, 0x6016,
8505 0x080c, 0x6c50, 0x0005, 0x2600, 0x2008, 0x0002, 0x85e6, 0x85e4,
8506 0x85e4, 0x85cc, 0x85cc, 0x85e4, 0x080c, 0x14f6, 0x080c, 0x6b73,
8507 0x00d6, 0x6010, 0x2068, 0x080c, 0x15f0, 0x00de, 0x080c, 0x8078,
8508 0x080c, 0x6c50, 0x0005, 0x00e6, 0x0026, 0x0016, 0x080c, 0x9596,
8509 0x0508, 0x6010, 0x2070, 0x7034, 0xa086, 0x0139, 0x1148, 0x2001,
8510 0x0030, 0x2009, 0x0000, 0x2011, 0x4005, 0x080c, 0x9a05, 0x0090,
8511 0x7038, 0xd0fc, 0x0178, 0x7007, 0x0000, 0x0016, 0x6004, 0xa08e,
8512 0x0021, 0x0160, 0xa08e, 0x003d, 0x0148, 0x001e, 0x7037, 0x0103,
8513 0x7033, 0x0100, 0x001e, 0x002e, 0x00ee, 0x0005, 0x001e, 0x0009,
8514 0x0cc8, 0x00e6, 0xacf0, 0x0004, 0x2e74, 0x7000, 0x2070, 0x7037,
8515 0x0103, 0x7023, 0x8001, 0x00ee, 0x0005, 0x00d6, 0x6618, 0x2668,
8516 0x6804, 0xa084, 0x00ff, 0x00de, 0xa0b2, 0x000c, 0x1a0c, 0x14f6,
8517 0x6604, 0xa6b6, 0x0043, 0x1120, 0x080c, 0x99c1, 0x0804, 0x8692,
8518 0x6604, 0xa6b6, 0x0033, 0x1120, 0x080c, 0x9971, 0x0804, 0x8692,
8519 0x6604, 0xa6b6, 0x0028, 0x1120, 0x080c, 0x97b9, 0x0804, 0x8692,
8520 0x6604, 0xa6b6, 0x0029, 0x1118, 0x080c, 0x97d0, 0x04d8, 0x6604,
8521 0xa6b6, 0x001f, 0x1118, 0x080c, 0x81dc, 0x04a0, 0x6604, 0xa6b6,
8522 0x0000, 0x1118, 0x080c, 0x83f4, 0x0468, 0x6604, 0xa6b6, 0x0022,
8523 0x1118, 0x080c, 0x8204, 0x0430, 0x6604, 0xa6b6, 0x0035, 0x1118,
8524 0x080c, 0x826b, 0x00f8, 0x6604, 0xa6b6, 0x0039, 0x1118, 0x080c,
8525 0x83a3, 0x00c0, 0x6604, 0xa6b6, 0x003d, 0x1118, 0x080c, 0x821e,
8526 0x0088, 0x6604, 0xa6b6, 0x0044, 0x1118, 0x080c, 0x823e, 0x0050,
8527 0xa1b6, 0x0015, 0x1110, 0x0053, 0x0028, 0xa1b6, 0x0016, 0x1118,
8528 0x0804, 0x883f, 0x0005, 0x080c, 0x80be, 0x0ce0, 0x86b9, 0x86bc,
8529 0x86b9, 0x86fe, 0x86b9, 0x87cc, 0x884d, 0x86b9, 0x86b9, 0x881b,
8530 0x86b9, 0x882f, 0xa1b6, 0x0048, 0x0140, 0x20e1, 0x0005, 0x3d18,
8531 0x3e20, 0x2c10, 0x080c, 0x1824, 0x0005, 0x00e6, 0xacf0, 0x0004,
8532 0x2e74, 0x7000, 0x2070, 0x7037, 0x0103, 0x00ee, 0x080c, 0x8078,
8533 0x0005, 0xe000, 0xe000, 0x0005, 0x00e6, 0x2071, 0xad00, 0x7080,
8534 0xa086, 0x0074, 0x1530, 0x080c, 0xa6e9, 0x11b0, 0x00d6, 0x6018,
8535 0x2068, 0x7030, 0xd08c, 0x0128, 0x6800, 0xd0bc, 0x0110, 0xc0c5,
8536 0x6802, 0x00d9, 0x00de, 0x2001, 0x0006, 0x080c, 0x4c30, 0x080c,
8537 0x2aff, 0x080c, 0x8078, 0x0078, 0x2001, 0x000a, 0x080c, 0x4c30,
8538 0x080c, 0x2aff, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x67ee,
8539 0x0010, 0x080c, 0x87bd, 0x00ee, 0x0005, 0x6800, 0xd084, 0x0168,
8540 0x2001, 0x0000, 0x080c, 0x4c1e, 0x2069, 0xad51, 0x6804, 0xd0a4,
8541 0x0120, 0x2001, 0x0006, 0x080c, 0x4c5d, 0x0005, 0x00d6, 0x2011,
8542 0xad20, 0x2204, 0xa086, 0x0074, 0x1904, 0x87ba, 0x6018, 0x2068,
8543 0x6aa0, 0xa286, 0x007e, 0x1120, 0x080c, 0x894d, 0x0804, 0x875e,
8544 0x080c, 0x8943, 0x6018, 0x2068, 0xa080, 0x0028, 0x2014, 0xa286,
8545 0x0080, 0x11c0, 0x6813, 0x00ff, 0x6817, 0xfffc, 0x6010, 0xa005,
8546 0x0138, 0x2068, 0x6807, 0x0000, 0x6837, 0x0103, 0x6833, 0x0200,
8547 0x2001, 0x0006, 0x080c, 0x4c30, 0x080c, 0x2aff, 0x080c, 0x8078,
8548 0x0804, 0x87bb, 0x00e6, 0x2071, 0xad34, 0x2e04, 0xd09c, 0x0188,
8549 0x2071, 0xb280, 0x7108, 0x720c, 0xa18c, 0x00ff, 0x1118, 0xa284,
8550 0xff00, 0x0138, 0x6018, 0x2070, 0x70a0, 0xd0bc, 0x1110, 0x7112,
8551 0x7216, 0x00ee, 0x6010, 0xa005, 0x0128, 0x2068, 0x6838, 0xd0f4,
8552 0x0108, 0x0880, 0x2001, 0x0004, 0x080c, 0x4c30, 0x6003, 0x0001,
8553 0x6007, 0x0003, 0x080c, 0x67ee, 0x0804, 0x87bb, 0x685c, 0xd0e4,
8554 0x01d0, 0x080c, 0x9903, 0x080c, 0x574f, 0x0110, 0xd0dc, 0x1900,
8555 0x2011, 0xad34, 0x2204, 0xc0ad, 0x2012, 0x2001, 0xaf8e, 0x2004,
8556 0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x26cb, 0x78e2,
8557 0x00fe, 0x0804, 0x8728, 0x080c, 0x9937, 0x2011, 0xad34, 0x2204,
8558 0xc0a5, 0x2012, 0x0006, 0x080c, 0xa801, 0x000e, 0x1904, 0x8728,
8559 0xc0b5, 0x2012, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x00c6, 0x2009,
8560 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x7932, 0x7936, 0x00fe,
8561 0x080c, 0x26a0, 0x00f6, 0x2079, 0xad00, 0x7972, 0x2100, 0x2009,
8562 0x0000, 0x080c, 0x2676, 0x794e, 0x00fe, 0x8108, 0x080c, 0x4c80,
8563 0x2c00, 0x00ce, 0x1904, 0x8728, 0x601a, 0x2001, 0x0002, 0x080c,
8564 0x4c30, 0x601f, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
8565 0x67ee, 0x0008, 0x0011, 0x00de, 0x0005, 0x2001, 0xad00, 0x2004,
8566 0xa086, 0x0003, 0x0120, 0x2001, 0x0007, 0x080c, 0x4c30, 0x080c,
8567 0x2aff, 0x080c, 0x8078, 0x0005, 0x00e6, 0x0026, 0x0016, 0x2071,
8568 0xad00, 0x7080, 0xa086, 0x0014, 0x15f0, 0x7000, 0xa086, 0x0003,
8569 0x1128, 0x6010, 0xa005, 0x1110, 0x080c, 0x3cce, 0x00d6, 0x6018,
8570 0x2068, 0x080c, 0x4d72, 0x080c, 0x86ed, 0x00de, 0x080c, 0x89f7,
8571 0x1550, 0x00d6, 0x6018, 0x2068, 0x6890, 0x00de, 0xa005, 0x0518,
8572 0x2001, 0x0006, 0x080c, 0x4c30, 0x00e6, 0x6010, 0xa075, 0x01a8,
8573 0x7034, 0xa084, 0x00ff, 0xa086, 0x0039, 0x1148, 0x2001, 0x0000,
8574 0x2009, 0x0000, 0x2011, 0x4000, 0x080c, 0x9a05, 0x0030, 0x7007,
8575 0x0000, 0x7037, 0x0103, 0x7033, 0x0200, 0x00ee, 0x080c, 0x2aff,
8576 0x080c, 0x8078, 0x0020, 0x080c, 0x85f3, 0x080c, 0x87bd, 0x001e,
8577 0x002e, 0x00ee, 0x0005, 0x2011, 0xad20, 0x2204, 0xa086, 0x0014,
8578 0x1158, 0x2001, 0x0002, 0x080c, 0x4c30, 0x6003, 0x0001, 0x6007,
8579 0x0001, 0x080c, 0x67ee, 0x0010, 0x080c, 0x87bd, 0x0005, 0x2011,
8580 0xad20, 0x2204, 0xa086, 0x0004, 0x1138, 0x2001, 0x0007, 0x080c,
8581 0x4c30, 0x080c, 0x8078, 0x0010, 0x080c, 0x87bd, 0x0005, 0x000b,
8582 0x0005, 0x86b9, 0x8854, 0x86b9, 0x888a, 0x86b9, 0x88ff, 0x884d,
8583 0x86b9, 0x86b9, 0x8912, 0x86b9, 0x8922, 0x6604, 0xa6b6, 0x001e,
8584 0x1110, 0x080c, 0x8078, 0x0005, 0x00d6, 0x00c6, 0x080c, 0x8932,
8585 0x1178, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x2001, 0x0002, 0x080c,
8586 0x4c30, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x67ee, 0x00f8,
8587 0x2009, 0xb28e, 0x2104, 0xa086, 0x0009, 0x1160, 0x6018, 0x2068,
8588 0x6840, 0xa084, 0x00ff, 0xa005, 0x0180, 0x8001, 0x6842, 0x6017,
8589 0x000a, 0x0068, 0x2009, 0xb28f, 0x2104, 0xa084, 0xff00, 0xa086,
8590 0x1900, 0x1118, 0x080c, 0x8078, 0x0010, 0x080c, 0x87bd, 0x00ce,
8591 0x00de, 0x0005, 0x080c, 0x8940, 0x00d6, 0x2069, 0xaf9d, 0x2d04,
8592 0xa005, 0x0168, 0x6018, 0x2068, 0x68a0, 0xa086, 0x007e, 0x1138,
8593 0x2069, 0xad1c, 0x2d04, 0x8000, 0x206a, 0x00de, 0x0010, 0x00de,
8594 0x0078, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x2001, 0x0002, 0x080c,
8595 0x4c30, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x67ee, 0x0428,
8596 0x080c, 0x85f3, 0x2009, 0xb28e, 0x2134, 0xa6b4, 0x00ff, 0xa686,
8597 0x0005, 0x01e0, 0xa686, 0x000b, 0x01b0, 0x2009, 0xb28f, 0x2104,
8598 0xa084, 0xff00, 0x1118, 0xa686, 0x0009, 0x0180, 0xa086, 0x1900,
8599 0x1150, 0xa686, 0x0009, 0x0150, 0x2001, 0x0004, 0x080c, 0x4c30,
8600 0x080c, 0x8078, 0x0010, 0x080c, 0x87bd, 0x0005, 0x00d6, 0x6010,
8601 0x2068, 0x080c, 0x9596, 0x0128, 0x6838, 0xd0fc, 0x0110, 0x00de,
8602 0x0c90, 0x6018, 0x2068, 0x6840, 0xa084, 0x00ff, 0xa005, 0x0140,
8603 0x8001, 0x6842, 0x6017, 0x000a, 0x6007, 0x0016, 0x00de, 0x0c28,
8604 0x68a0, 0xa086, 0x007e, 0x1138, 0x00e6, 0x2071, 0xad00, 0x080c,
8605 0x48f5, 0x00ee, 0x0010, 0x080c, 0x2ad9, 0x00de, 0x08a0, 0x080c,
8606 0x8940, 0x1158, 0x2001, 0x0004, 0x080c, 0x4c30, 0x6003, 0x0001,
8607 0x6007, 0x0003, 0x080c, 0x67ee, 0x0020, 0x080c, 0x85f3, 0x080c,
8608 0x87bd, 0x0005, 0x0469, 0x1158, 0x2001, 0x0008, 0x080c, 0x4c30,
8609 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x67ee, 0x0010, 0x080c,
8610 0x87bd, 0x0005, 0x00e9, 0x1158, 0x2001, 0x000a, 0x080c, 0x4c30,
8611 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x67ee, 0x0010, 0x080c,
8612 0x87bd, 0x0005, 0x2009, 0xb28e, 0x2104, 0xa086, 0x0003, 0x1138,
8613 0x2009, 0xb28f, 0x2104, 0xa084, 0xff00, 0xa086, 0x2a00, 0x0005,
8614 0xa085, 0x0001, 0x0005, 0x00c6, 0x0016, 0xac88, 0x0006, 0x2164,
8615 0x080c, 0x4ceb, 0x001e, 0x00ce, 0x0005, 0x00f6, 0x00e6, 0x00d6,
8616 0x0036, 0x0016, 0x6018, 0x2068, 0x2071, 0xad34, 0x2e04, 0xa085,
8617 0x0003, 0x2072, 0x080c, 0x89cc, 0x0538, 0x2001, 0xad52, 0x2004,
8618 0xd0a4, 0x0158, 0xa006, 0x2020, 0x2009, 0x002a, 0x080c, 0xa96c,
8619 0x2001, 0xad0c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x2009,
8620 0x0001, 0x080c, 0x2aac, 0x2071, 0xad00, 0x080c, 0x28fa, 0x00c6,
8621 0x0156, 0x20a9, 0x0081, 0x2009, 0x007f, 0x080c, 0x2bc9, 0x8108,
8622 0x1f04, 0x897d, 0x015e, 0x00ce, 0x080c, 0x8943, 0x6813, 0x00ff,
8623 0x6817, 0xfffe, 0x2071, 0xb280, 0x2079, 0x0100, 0x2e04, 0xa084,
8624 0x00ff, 0x2069, 0xad1b, 0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04,
8625 0x2069, 0xad1c, 0x206a, 0x78ea, 0x7832, 0x7836, 0x2010, 0xa084,
8626 0xff00, 0x001e, 0xa105, 0x2009, 0xad27, 0x200a, 0x2200, 0xa084,
8627 0x00ff, 0x2008, 0x080c, 0x26a0, 0x080c, 0x574f, 0x0170, 0x2069,
8628 0xb28e, 0x2071, 0xaf9f, 0x6810, 0x2072, 0x6814, 0x7006, 0x6818,
8629 0x700a, 0x681c, 0x700e, 0x080c, 0x9903, 0x0040, 0x2001, 0x0006,
8630 0x080c, 0x4c30, 0x080c, 0x2aff, 0x080c, 0x8078, 0x001e, 0x003e,
8631 0x00de, 0x00ee, 0x00fe, 0x0005, 0x0026, 0x0036, 0x00e6, 0x0156,
8632 0x2019, 0xad27, 0x231c, 0x83ff, 0x01e8, 0x2071, 0xb280, 0x2e14,
8633 0xa294, 0x00ff, 0x7004, 0xa084, 0xff00, 0xa205, 0xa306, 0x1190,
8634 0x2011, 0xb296, 0xad98, 0x000a, 0x20a9, 0x0004, 0x080c, 0x8a7c,
8635 0x1148, 0x2011, 0xb29a, 0xad98, 0x0006, 0x20a9, 0x0004, 0x080c,
8636 0x8a7c, 0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x0005, 0x00e6,
8637 0x2071, 0xb28c, 0x7004, 0xa086, 0x0014, 0x11a8, 0x7008, 0xa086,
8638 0x0800, 0x1188, 0x700c, 0xd0ec, 0x0160, 0xa084, 0x0f00, 0xa086,
8639 0x0100, 0x1138, 0x7024, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0xa006,
8640 0x0010, 0xa085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x00d6, 0x00c6,
8641 0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
8642 0x2029, 0xafd0, 0x252c, 0x2021, 0xafd6, 0x2424, 0x2061, 0xb400,
8643 0x2071, 0xad00, 0x7244, 0x7064, 0xa202, 0x16f0, 0x080c, 0xa990,
8644 0x05a0, 0x671c, 0xa786, 0x0001, 0x0580, 0xa786, 0x0007, 0x0568,
8645 0x2500, 0xac06, 0x0550, 0x2400, 0xac06, 0x0538, 0x00c6, 0x6000,
8646 0xa086, 0x0004, 0x1110, 0x080c, 0x190b, 0xa786, 0x0008, 0x1148,
8647 0x080c, 0x9789, 0x1130, 0x00ce, 0x080c, 0x85f3, 0x080c, 0x974e,
8648 0x00a0, 0x6010, 0x2068, 0x080c, 0x9596, 0x0160, 0xa786, 0x0003,
8649 0x11e8, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000, 0x080c, 0x510c,
8650 0x080c, 0x9742, 0x080c, 0x974e, 0x00ce, 0xace0, 0x0018, 0x7058,
8651 0xac02, 0x1210, 0x0804, 0x8a2a, 0x012e, 0x000e, 0x002e, 0x004e,
8652 0x005e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0xa786, 0x0006,
8653 0x1d00, 0x080c, 0xa91f, 0x0c30, 0x220c, 0x2304, 0xa106, 0x1130,
8654 0x8210, 0x8318, 0x1f04, 0x8a7c, 0xa006, 0x0005, 0x2304, 0xa102,
8655 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0xa18d, 0x0001,
8656 0x0005, 0x6004, 0xa08a, 0x0080, 0x1a0c, 0x14f6, 0x080c, 0x9778,
8657 0x0120, 0x080c, 0x9789, 0x0168, 0x0028, 0x080c, 0x2aff, 0x080c,
8658 0x9789, 0x0138, 0x080c, 0x6b73, 0x080c, 0x8078, 0x080c, 0x6c50,
8659 0x0005, 0x080c, 0x85f3, 0x0cb0, 0xa182, 0x0040, 0x0002, 0x8ac2,
8660 0x8ac2, 0x8ac2, 0x8ac2, 0x8ac2, 0x8ac2, 0x8ac2, 0x8ac2, 0x8ac2,
8661 0x8ac2, 0x8ac2, 0x8ac4, 0x8ac4, 0x8ac4, 0x8ac4, 0x8ac2, 0x8ac2,
8662 0x8ac2, 0x8ac4, 0x080c, 0x14f6, 0x600b, 0xffff, 0x6003, 0x0001,
8663 0x6106, 0x080c, 0x67a8, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c50,
8664 0x012e, 0x0005, 0xa186, 0x0013, 0x1128, 0x6004, 0xa082, 0x0040,
8665 0x0804, 0x8b5e, 0xa186, 0x0027, 0x11e8, 0x080c, 0x6b73, 0x080c,
8666 0x2ad9, 0x00d6, 0x6110, 0x2168, 0x080c, 0x9596, 0x0168, 0x6837,
8667 0x0103, 0x684b, 0x0029, 0x6847, 0x0000, 0x694c, 0xc1c5, 0x694e,
8668 0x080c, 0x510c, 0x080c, 0x9742, 0x00de, 0x080c, 0x8078, 0x080c,
8669 0x6c50, 0x0005, 0xa186, 0x0014, 0x1120, 0x6004, 0xa082, 0x0040,
8670 0x0428, 0xa186, 0x0046, 0x0138, 0xa186, 0x0045, 0x0120, 0xa186,
8671 0x0047, 0x190c, 0x14f6, 0x2001, 0x0109, 0x2004, 0xd084, 0x0198,
8672 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x6699,
8673 0x002e, 0x001e, 0x000e, 0x012e, 0xe000, 0x6000, 0xa086, 0x0002,
8674 0x1110, 0x0804, 0x8b98, 0x080c, 0x80be, 0x0005, 0x0002, 0x8b3c,
8675 0x8b3a, 0x8b3a, 0x8b3a, 0x8b3a, 0x8b3a, 0x8b3a, 0x8b3a, 0x8b3a,
8676 0x8b3a, 0x8b3a, 0x8b57, 0x8b57, 0x8b57, 0x8b57, 0x8b3a, 0x8b57,
8677 0x8b3a, 0x8b57, 0x080c, 0x14f6, 0x080c, 0x6b73, 0x00d6, 0x6110,
8678 0x2168, 0x080c, 0x9596, 0x0168, 0x6837, 0x0103, 0x684b, 0x0006,
8679 0x6847, 0x0000, 0x6850, 0xc0ec, 0x6852, 0x080c, 0x510c, 0x080c,
8680 0x9742, 0x00de, 0x080c, 0x8078, 0x080c, 0x6c50, 0x0005, 0x080c,
8681 0x6b73, 0x080c, 0x8078, 0x080c, 0x6c50, 0x0005, 0x0002, 0x8b74,
8682 0x8b72, 0x8b72, 0x8b72, 0x8b72, 0x8b72, 0x8b72, 0x8b72, 0x8b72,
8683 0x8b72, 0x8b72, 0x8b86, 0x8b86, 0x8b86, 0x8b86, 0x8b72, 0x8b91,
8684 0x8b72, 0x8b86, 0x080c, 0x14f6, 0x080c, 0x6b73, 0x2001, 0xafa5,
8685 0x2004, 0x603e, 0x6003, 0x0002, 0x080c, 0x6c50, 0x6010, 0xa088,
8686 0x0013, 0x2104, 0xa085, 0x0400, 0x200a, 0x0005, 0x080c, 0x6b73,
8687 0x2001, 0xafa5, 0x2004, 0x603e, 0x6003, 0x000f, 0x080c, 0x6c50,
8688 0x0005, 0x080c, 0x6b73, 0x080c, 0x8078, 0x080c, 0x6c50, 0x0005,
8689 0xa182, 0x0040, 0x0002, 0x8bae, 0x8bae, 0x8bae, 0x8bae, 0x8bae,
8690 0x8bb0, 0x8c88, 0x8ca9, 0x8bae, 0x8bae, 0x8bae, 0x8bae, 0x8bae,
8691 0x8bae, 0x8bae, 0x8bae, 0x8bae, 0x8bae, 0x8bae, 0x080c, 0x14f6,
8692 0x00e6, 0x00d6, 0x603f, 0x0000, 0x2071, 0xb280, 0x7124, 0x610a,
8693 0x2071, 0xb28c, 0x6110, 0x2168, 0x7614, 0xa6b4, 0x0fff, 0x86ff,
8694 0x0904, 0x8c54, 0xa68c, 0x0c00, 0x01e8, 0x00f6, 0x2c78, 0x080c,
8695 0x5029, 0x00fe, 0x0198, 0x684c, 0xd0ac, 0x0180, 0x6020, 0xd0dc,
8696 0x1168, 0x6850, 0xd0bc, 0x1150, 0x7318, 0x6814, 0xa306, 0x1904,
8697 0x8c66, 0x731c, 0x6810, 0xa306, 0x1904, 0x8c66, 0x7318, 0x6b62,
8698 0x731c, 0x6b5e, 0xa68c, 0x00ff, 0xa186, 0x0002, 0x0518, 0xa186,
8699 0x0028, 0x1128, 0x080c, 0x9767, 0x684b, 0x001c, 0x00e8, 0xd6dc,
8700 0x01a0, 0x684b, 0x0015, 0x684c, 0xd0ac, 0x0170, 0x6914, 0x6a10,
8701 0x2100, 0xa205, 0x0148, 0x7018, 0xa106, 0x1118, 0x701c, 0xa206,
8702 0x0118, 0x6962, 0x6a5e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0x684b,
8703 0x0007, 0x0010, 0x684b, 0x0000, 0x6837, 0x0103, 0x6e46, 0xa01e,
8704 0xd6c4, 0x01f0, 0xa686, 0x0100, 0x1140, 0x2001, 0xb299, 0x2004,
8705 0xa005, 0x1118, 0xc6c4, 0x0804, 0x8bbf, 0x7328, 0x732c, 0x6b56,
8706 0x83ff, 0x0170, 0xa38a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036,
8707 0x2308, 0x2019, 0xb298, 0xad90, 0x0019, 0x080c, 0x927f, 0x003e,
8708 0xd6cc, 0x0904, 0x8c79, 0x7124, 0x695a, 0x81ff, 0x0904, 0x8c79,
8709 0xa192, 0x0021, 0x1250, 0x2071, 0xb298, 0x831c, 0x2300, 0xae18,
8710 0xad90, 0x001d, 0x080c, 0x927f, 0x04a0, 0x6838, 0xd0fc, 0x0120,
8711 0x2009, 0x0020, 0x695a, 0x0c78, 0x00f6, 0x2d78, 0x080c, 0x9224,
8712 0x00fe, 0x080c, 0x926f, 0x0438, 0x00f6, 0x2c78, 0x080c, 0x5029,
8713 0x00fe, 0x0188, 0x684c, 0xd0ac, 0x0170, 0x6020, 0xd0dc, 0x1158,
8714 0x6850, 0xd0bc, 0x1140, 0x684c, 0xd0f4, 0x1128, 0x080c, 0x9866,
8715 0x00de, 0x00ee, 0x00e0, 0x684b, 0x0000, 0x6837, 0x0103, 0x6e46,
8716 0x684c, 0xd0ac, 0x0130, 0x6810, 0x6914, 0xa115, 0x0110, 0x080c,
8717 0x8e04, 0x080c, 0x510c, 0x6218, 0x2268, 0x6a3c, 0x8211, 0x6a3e,
8718 0x080c, 0x9834, 0x00de, 0x00ee, 0x1110, 0x080c, 0x8078, 0x0005,
8719 0x00f6, 0x6003, 0x0003, 0x2079, 0xb28c, 0x7c04, 0x7b00, 0x7e0c,
8720 0x7d08, 0x6010, 0x2078, 0x784c, 0xd0ac, 0x0120, 0x6003, 0x0002,
8721 0x00fe, 0x0005, 0x7c12, 0x7b16, 0x7e0a, 0x7d0e, 0x00fe, 0x603f,
8722 0x0000, 0x2c10, 0x080c, 0x1e6e, 0x080c, 0x680b, 0x080c, 0x6d0d,
8723 0x0005, 0x2001, 0xafa5, 0x2004, 0x603e, 0x6003, 0x0004, 0x6110,
8724 0x20e1, 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x080c, 0x1824, 0x0005,
8725 0xa182, 0x0040, 0x0002, 0x8cce, 0x8cce, 0x8cce, 0x8cce, 0x8cce,
8726 0x8cd0, 0x8d61, 0x8cce, 0x8cce, 0x8d77, 0x8ddb, 0x8cce, 0x8cce,
8727 0x8cce, 0x8cce, 0x8dea, 0x8cce, 0x8cce, 0x8cce, 0x080c, 0x14f6,
8728 0x0076, 0x00f6, 0x00e6, 0x00d6, 0x2071, 0xb28c, 0x6110, 0x2178,
8729 0x7614, 0xa6b4, 0x0fff, 0x7e46, 0x7f4c, 0xc7e5, 0x7f4e, 0x6218,
8730 0x2268, 0x6a3c, 0x8211, 0x6a3e, 0x86ff, 0x0904, 0x8d5c, 0xa694,
8731 0xff00, 0xa284, 0x0c00, 0x0120, 0x7018, 0x7862, 0x701c, 0x785e,
8732 0xa284, 0x0300, 0x0904, 0x8d5c, 0x080c, 0x15d9, 0x090c, 0x14f6,
8733 0x2d00, 0x784a, 0x7f4c, 0xc7cd, 0x7f4e, 0x6837, 0x0103, 0x7838,
8734 0x683a, 0x783c, 0x683e, 0x7840, 0x6842, 0x6e46, 0xa68c, 0x0c00,
8735 0x0120, 0x7318, 0x6b62, 0x731c, 0x6b5e, 0xa68c, 0x00ff, 0xa186,
8736 0x0002, 0x0180, 0xa186, 0x0028, 0x1118, 0x684b, 0x001c, 0x0060,
8737 0xd6dc, 0x0118, 0x684b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0x684b,
8738 0x0007, 0x0010, 0x684b, 0x0000, 0x6f4e, 0x7850, 0x6852, 0x7854,
8739 0x6856, 0xa01e, 0xd6c4, 0x0198, 0x7328, 0x732c, 0x6b56, 0x83ff,
8740 0x0170, 0xa38a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308,
8741 0x2019, 0xb298, 0xad90, 0x0019, 0x080c, 0x927f, 0x003e, 0xd6cc,
8742 0x01d8, 0x7124, 0x695a, 0x81ff, 0x01b8, 0xa192, 0x0021, 0x1250,
8743 0x2071, 0xb298, 0x831c, 0x2300, 0xae18, 0xad90, 0x001d, 0x080c,
8744 0x927f, 0x0050, 0x7838, 0xd0fc, 0x0120, 0x2009, 0x0020, 0x695a,
8745 0x0c78, 0x2d78, 0x080c, 0x9224, 0x00de, 0x00ee, 0x00fe, 0x007e,
8746 0x0005, 0x00f6, 0x6003, 0x0003, 0x2079, 0xb28c, 0x7c04, 0x7b00,
8747 0x7e0c, 0x7d08, 0x6010, 0x2078, 0x7c12, 0x7b16, 0x7e0a, 0x7d0e,
8748 0x00fe, 0x2c10, 0x080c, 0x1e6e, 0x080c, 0x781a, 0x0005, 0x00d6,
8749 0x00f6, 0x2c78, 0x080c, 0x5029, 0x00fe, 0x0120, 0x2001, 0xafa5,
8750 0x2004, 0x603e, 0x6003, 0x0002, 0x080c, 0x6c05, 0x080c, 0x6d0d,
8751 0x6110, 0x2168, 0x694c, 0xd1e4, 0x0904, 0x8dd9, 0xd1cc, 0x0540,
8752 0x6948, 0x6838, 0xd0fc, 0x01e8, 0x0016, 0x684c, 0x0006, 0x6850,
8753 0x0006, 0xad90, 0x000d, 0xa198, 0x000d, 0x2009, 0x0020, 0x0156,
8754 0x21a8, 0x2304, 0x2012, 0x8318, 0x8210, 0x1f04, 0x8da1, 0x015e,
8755 0x000e, 0x6852, 0x000e, 0x684e, 0x001e, 0x2168, 0x080c, 0x1600,
8756 0x0418, 0x0016, 0x080c, 0x1600, 0x00de, 0x080c, 0x926f, 0x00e0,
8757 0x6837, 0x0103, 0x6944, 0xa184, 0x00ff, 0xa0b6, 0x0002, 0x0180,
8758 0xa086, 0x0028, 0x1118, 0x684b, 0x001c, 0x0060, 0xd1dc, 0x0118,
8759 0x684b, 0x0015, 0x0038, 0xd1d4, 0x0118, 0x684b, 0x0007, 0x0010,
8760 0x684b, 0x0000, 0x080c, 0x510c, 0x080c, 0x9834, 0x1110, 0x080c,
8761 0x8078, 0x00de, 0x0005, 0x2019, 0x0001, 0x080c, 0x7a64, 0x6003,
8762 0x0002, 0x2001, 0xafa5, 0x2004, 0x603e, 0x080c, 0x6c05, 0x080c,
8763 0x6d0d, 0x0005, 0x080c, 0x6c05, 0x080c, 0x2ad9, 0x00d6, 0x6110,
8764 0x2168, 0x080c, 0x9596, 0x0150, 0x6837, 0x0103, 0x684b, 0x0029,
8765 0x6847, 0x0000, 0x080c, 0x510c, 0x080c, 0x9742, 0x00de, 0x080c,
8766 0x8078, 0x080c, 0x6d0d, 0x0005, 0x684b, 0x0015, 0xd1fc, 0x0138,
8767 0x684b, 0x0007, 0x8002, 0x8000, 0x810a, 0xa189, 0x0000, 0x6962,
8768 0x685e, 0x0005, 0xa182, 0x0040, 0x0002, 0x8e28, 0x8e28, 0x8e28,
8769 0x8e28, 0x8e28, 0x8e2a, 0x8e28, 0x8ee3, 0x8eef, 0x8e28, 0x8e28,
8770 0x8e28, 0x8e28, 0x8e28, 0x8e28, 0x8e28, 0x8e28, 0x8e28, 0x8e28,
8771 0x080c, 0x14f6, 0x0076, 0x00f6, 0x00e6, 0x00d6, 0x2071, 0xb28c,
8772 0x6110, 0x2178, 0x7614, 0xa6b4, 0x0fff, 0x00f6, 0x2c78, 0x080c,
8773 0x5029, 0x00fe, 0x0150, 0xa684, 0x00ff, 0x1138, 0x6020, 0xd0f4,
8774 0x0120, 0x080c, 0x9866, 0x0804, 0x8ede, 0x7e46, 0x7f4c, 0xc7e5,
8775 0x7f4e, 0x6218, 0x2268, 0x6a3c, 0x8211, 0x6a3e, 0x86ff, 0x0904,
8776 0x8ed4, 0xa694, 0xff00, 0xa284, 0x0c00, 0x0120, 0x7018, 0x7862,
8777 0x701c, 0x785e, 0xa284, 0x0300, 0x0904, 0x8ed2, 0xa686, 0x0100,
8778 0x1140, 0x2001, 0xb299, 0x2004, 0xa005, 0x1118, 0xc6c4, 0x7e46,
8779 0x0c28, 0x080c, 0x15d9, 0x090c, 0x14f6, 0x2d00, 0x784a, 0x7f4c,
8780 0xa7bd, 0x0200, 0x7f4e, 0x6837, 0x0103, 0x7838, 0x683a, 0x783c,
8781 0x683e, 0x7840, 0x6842, 0x6e46, 0xa68c, 0x0c00, 0x0120, 0x7318,
8782 0x6b62, 0x731c, 0x6b5e, 0xa68c, 0x00ff, 0xa186, 0x0002, 0x0180,
8783 0xa186, 0x0028, 0x1118, 0x684b, 0x001c, 0x0060, 0xd6dc, 0x0118,
8784 0x684b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0x684b, 0x0007, 0x0010,
8785 0x684b, 0x0000, 0x6f4e, 0x7850, 0x6852, 0x7854, 0x6856, 0xa01e,
8786 0xd6c4, 0x0198, 0x7328, 0x732c, 0x6b56, 0x83ff, 0x0170, 0xa38a,
8787 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0xb298,
8788 0xad90, 0x0019, 0x080c, 0x927f, 0x003e, 0xd6cc, 0x01d8, 0x7124,
8789 0x695a, 0x81ff, 0x01b8, 0xa192, 0x0021, 0x1250, 0x2071, 0xb298,
8790 0x831c, 0x2300, 0xae18, 0xad90, 0x001d, 0x080c, 0x927f, 0x0050,
8791 0x7838, 0xd0fc, 0x0120, 0x2009, 0x0020, 0x695a, 0x0c78, 0x2d78,
8792 0x080c, 0x9224, 0xd6dc, 0x1110, 0xa006, 0x0030, 0x2001, 0x0001,
8793 0x2071, 0xb28c, 0x7218, 0x731c, 0x080c, 0x186f, 0x00de, 0x00ee,
8794 0x00fe, 0x007e, 0x0005, 0x2001, 0xafa5, 0x2004, 0x603e, 0x20e1,
8795 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x080c, 0x1824, 0x0005, 0x2001,
8796 0xafa5, 0x2004, 0x603e, 0x00d6, 0x6003, 0x0002, 0x6110, 0x2168,
8797 0x694c, 0xd1e4, 0x0904, 0x8ff3, 0x603f, 0x0000, 0x00f6, 0x2c78,
8798 0x080c, 0x5029, 0x00fe, 0x0548, 0x6814, 0x6910, 0xa115, 0x0528,
8799 0x6a60, 0xa206, 0x1118, 0x685c, 0xa106, 0x01f8, 0x684c, 0xc0e4,
8800 0x684e, 0x6847, 0x0000, 0x6863, 0x0000, 0x685f, 0x0000, 0x697c,
8801 0x6810, 0xa102, 0x603a, 0x6980, 0x6814, 0xa103, 0x6036, 0x6020,
8802 0xc0f5, 0x6022, 0x00d6, 0x6018, 0x2068, 0x683c, 0x8000, 0x683e,
8803 0x00de, 0x080c, 0x9866, 0x0804, 0x8ff3, 0x694c, 0xd1cc, 0x0904,
8804 0x8fc3, 0x6948, 0x6838, 0xd0fc, 0x0904, 0x8f88, 0x0016, 0x684c,
8805 0x0006, 0x6850, 0x0006, 0x00f6, 0x2178, 0x7944, 0xa184, 0x00ff,
8806 0xa0b6, 0x0002, 0x01e0, 0xa086, 0x0028, 0x1128, 0x684b, 0x001c,
8807 0x784b, 0x001c, 0x00e8, 0xd1dc, 0x0158, 0x684b, 0x0015, 0x784b,
8808 0x0015, 0x080c, 0x99ee, 0x0118, 0x7944, 0xc1dc, 0x7946, 0x0080,
8809 0xd1d4, 0x0128, 0x684b, 0x0007, 0x784b, 0x0007, 0x0048, 0x684c,
8810 0xd0ac, 0x0130, 0x6810, 0x6914, 0xa115, 0x0110, 0x080c, 0x8e04,
8811 0x6848, 0x784a, 0x6860, 0x7862, 0x685c, 0x785e, 0xad90, 0x000d,
8812 0xaf98, 0x000d, 0x2009, 0x0020, 0x0156, 0x21a8, 0x2304, 0x2012,
8813 0x8318, 0x8210, 0x1f04, 0x8f76, 0x015e, 0x00fe, 0x000e, 0x6852,
8814 0x000e, 0x684e, 0x001e, 0x2168, 0x080c, 0x1600, 0x0804, 0x8fee,
8815 0x0016, 0x00f6, 0x2178, 0x7944, 0xa184, 0x00ff, 0xa0b6, 0x0002,
8816 0x01e0, 0xa086, 0x0028, 0x1128, 0x684b, 0x001c, 0x784b, 0x001c,
8817 0x00e8, 0xd1dc, 0x0158, 0x684b, 0x0015, 0x784b, 0x0015, 0x080c,
8818 0x99ee, 0x0118, 0x7944, 0xc1dc, 0x7946, 0x0080, 0xd1d4, 0x0128,
8819 0x684b, 0x0007, 0x784b, 0x0007, 0x0048, 0x684c, 0xd0ac, 0x0130,
8820 0x6810, 0x6914, 0xa115, 0x0110, 0x080c, 0x8e04, 0x6860, 0x7862,
8821 0x685c, 0x785e, 0x684c, 0x784e, 0x00fe, 0x080c, 0x1600, 0x00de,
8822 0x080c, 0x926f, 0x0458, 0x6837, 0x0103, 0x6944, 0xa184, 0x00ff,
8823 0xa0b6, 0x0002, 0x01b0, 0xa086, 0x0028, 0x1118, 0x684b, 0x001c,
8824 0x00d8, 0xd1dc, 0x0148, 0x684b, 0x0015, 0x080c, 0x99ee, 0x0118,
8825 0x6944, 0xc1dc, 0x6946, 0x0080, 0xd1d4, 0x0118, 0x684b, 0x0007,
8826 0x0058, 0x684b, 0x0000, 0x684c, 0xd0ac, 0x0130, 0x6810, 0x6914,
8827 0xa115, 0x0110, 0x080c, 0x8e04, 0x080c, 0x510c, 0x080c, 0x9834,
8828 0x1110, 0x080c, 0x8078, 0x00de, 0x0005, 0x080c, 0x6b73, 0x0010,
8829 0x080c, 0x6c05, 0x080c, 0x9596, 0x01c0, 0x00d6, 0x6110, 0x2168,
8830 0x6837, 0x0103, 0x2009, 0xad0c, 0x210c, 0xd18c, 0x11c0, 0xd184,
8831 0x1198, 0x6108, 0x694a, 0xa18e, 0x0029, 0x1110, 0x080c, 0xabfa,
8832 0x6847, 0x0000, 0x080c, 0x510c, 0x00de, 0x080c, 0x8078, 0x080c,
8833 0x6c50, 0x080c, 0x6d0d, 0x0005, 0x684b, 0x0004, 0x0c88, 0x684b,
8834 0x0004, 0x0c70, 0xa182, 0x0040, 0x0002, 0x9038, 0x9038, 0x9038,
8835 0x9038, 0x9038, 0x903a, 0x9038, 0x903d, 0x9038, 0x9038, 0x9038,
8836 0x9038, 0x9038, 0x9038, 0x9038, 0x9038, 0x9038, 0x9038, 0x9038,
8837 0x080c, 0x14f6, 0x080c, 0x8078, 0x0005, 0x0006, 0x0026, 0xa016,
8838 0x080c, 0x1824, 0x002e, 0x000e, 0x0005, 0xa182, 0x0085, 0x0002,
8839 0x9051, 0x904f, 0x904f, 0x905d, 0x904f, 0x904f, 0x904f, 0x080c,
8840 0x14f6, 0x6003, 0x0001, 0x6106, 0x080c, 0x67a8, 0x0126, 0x2091,
8841 0x8000, 0x080c, 0x6c50, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6,
8842 0x00e6, 0x2071, 0xb280, 0x7224, 0x6212, 0x7220, 0x080c, 0x9586,
8843 0x01a0, 0x2268, 0x6800, 0xa086, 0x0000, 0x0178, 0x6018, 0x6d18,
8844 0xa52e, 0x1158, 0x00c6, 0x2d60, 0x080c, 0x928f, 0x00ce, 0x0128,
8845 0x6803, 0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087, 0x6003,
8846 0x0001, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x00f6, 0x2278, 0x080c,
8847 0x5029, 0x00fe, 0x0150, 0x6820, 0xd0ec, 0x0138, 0x00c6, 0x2260,
8848 0x603f, 0x0000, 0x080c, 0x9866, 0x00ce, 0x00ee, 0x00de, 0x005e,
8849 0x002e, 0x0005, 0xa186, 0x0013, 0x1160, 0x6004, 0xa08a, 0x0085,
8850 0x0a0c, 0x14f6, 0xa08a, 0x008c, 0x1a0c, 0x14f6, 0xa082, 0x0085,
8851 0x0072, 0xa186, 0x0027, 0x0120, 0xa186, 0x0014, 0x190c, 0x14f6,
8852 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005, 0x90be,
8853 0x90c0, 0x90c0, 0x90be, 0x90be, 0x90be, 0x90be, 0x080c, 0x14f6,
8854 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005, 0xa186,
8855 0x0013, 0x1128, 0x6004, 0xa082, 0x0085, 0x2008, 0x04a8, 0xa186,
8856 0x0027, 0x11e8, 0x080c, 0x6b73, 0x080c, 0x2ad9, 0x00d6, 0x6010,
8857 0x2068, 0x080c, 0x9596, 0x0150, 0x6837, 0x0103, 0x6847, 0x0000,
8858 0x684b, 0x0029, 0x080c, 0x510c, 0x080c, 0x9742, 0x00de, 0x080c,
8859 0x8078, 0x080c, 0x6c50, 0x0005, 0x080c, 0x80be, 0x0ce0, 0xa186,
8860 0x0014, 0x1dd0, 0x080c, 0x6b73, 0x00d6, 0x6010, 0x2068, 0x080c,
8861 0x9596, 0x0d60, 0x6837, 0x0103, 0x6847, 0x0000, 0x684b, 0x0006,
8862 0x6850, 0xc0ec, 0x6852, 0x08f0, 0x0002, 0x910e, 0x910c, 0x910c,
8863 0x910c, 0x910c, 0x910c, 0x9126, 0x080c, 0x14f6, 0x080c, 0x6b73,
8864 0x6030, 0xa08c, 0xff00, 0x810f, 0xa186, 0x0039, 0x0118, 0xa186,
8865 0x0035, 0x1118, 0x2001, 0xafa3, 0x0010, 0x2001, 0xafa4, 0x2004,
8866 0x6016, 0x6003, 0x000c, 0x080c, 0x6c50, 0x0005, 0x080c, 0x6b73,
8867 0x6030, 0xa08c, 0xff00, 0x810f, 0xa186, 0x0039, 0x0118, 0xa186,
8868 0x0035, 0x1118, 0x2001, 0xafa3, 0x0010, 0x2001, 0xafa4, 0x2004,
8869 0x6016, 0x6003, 0x000e, 0x080c, 0x6c50, 0x0005, 0xa182, 0x008c,
8870 0x1220, 0xa182, 0x0085, 0x0208, 0x001a, 0x080c, 0x80be, 0x0005,
8871 0x914f, 0x914f, 0x914f, 0x914f, 0x9151, 0x91a4, 0x914f, 0x080c,
8872 0x14f6, 0x00d6, 0x00f6, 0x2c78, 0x080c, 0x5029, 0x00fe, 0x0168,
8873 0x6030, 0xa08c, 0xff00, 0x810f, 0xa186, 0x0039, 0x0118, 0xa186,
8874 0x0035, 0x1118, 0x00de, 0x0804, 0x91b7, 0x080c, 0x9742, 0x080c,
8875 0x9596, 0x01c8, 0x6010, 0x2068, 0x6837, 0x0103, 0x6850, 0xd0b4,
8876 0x0128, 0x684b, 0x0006, 0xc0ec, 0x6852, 0x0048, 0xd0bc, 0x0118,
8877 0x684b, 0x0002, 0x0020, 0x684b, 0x0005, 0x080c, 0x9803, 0x6847,
8878 0x0000, 0x080c, 0x510c, 0x2c68, 0x080c, 0x8022, 0x01c0, 0x6003,
8879 0x0001, 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0xb28e, 0x210c,
8880 0x6136, 0x2009, 0xb28f, 0x210c, 0x613a, 0x6918, 0x611a, 0x080c,
8881 0x9956, 0x6950, 0x6152, 0x601f, 0x0001, 0x080c, 0x67a8, 0x2d60,
8882 0x080c, 0x8078, 0x00de, 0x0005, 0x00f6, 0x2c78, 0x080c, 0x5029,
8883 0x00fe, 0x0598, 0x6030, 0xa08c, 0xff00, 0x810f, 0xa186, 0x0035,
8884 0x0130, 0xa186, 0x001e, 0x0118, 0xa186, 0x0039, 0x1530, 0x00d6,
8885 0x2c68, 0x080c, 0x9a34, 0x1904, 0x91fc, 0x080c, 0x8022, 0x01d8,
8886 0x6106, 0x6003, 0x0001, 0x601f, 0x0001, 0x6918, 0x611a, 0x6928,
8887 0x612a, 0x692c, 0x612e, 0x6930, 0xa18c, 0x00ff, 0x6132, 0x6934,
8888 0x6136, 0x6938, 0x613a, 0x6950, 0x6152, 0x080c, 0x9956, 0x080c,
8889 0x67a8, 0x080c, 0x6c50, 0x2d60, 0x00f8, 0x00d6, 0x6010, 0x2068,
8890 0x080c, 0x9596, 0x01c8, 0x6837, 0x0103, 0x6850, 0xd0b4, 0x0128,
8891 0xc0ec, 0x6852, 0x684b, 0x0006, 0x0048, 0xd0bc, 0x0118, 0x684b,
8892 0x0002, 0x0020, 0x684b, 0x0005, 0x080c, 0x9803, 0x6847, 0x0000,
8893 0x080c, 0x510c, 0x080c, 0x9742, 0x00de, 0x080c, 0x8078, 0x0005,
8894 0x0016, 0x00d6, 0x6010, 0x2068, 0x080c, 0x9596, 0x0140, 0x6837,
8895 0x0103, 0x684b, 0x0028, 0x6847, 0x0000, 0x080c, 0x510c, 0x00de,
8896 0x001e, 0xa186, 0x0013, 0x0148, 0xa186, 0x0014, 0x0130, 0xa186,
8897 0x0027, 0x0118, 0x080c, 0x80be, 0x0030, 0x080c, 0x6b73, 0x080c,
8898 0x974e, 0x080c, 0x6c50, 0x0005, 0x0056, 0x0066, 0x00d6, 0x00f6,
8899 0x2029, 0x0001, 0xa182, 0x0101, 0x1208, 0x0010, 0x2009, 0x0100,
8900 0x2130, 0x2069, 0xb298, 0x831c, 0x2300, 0xad18, 0x2009, 0x0020,
8901 0xaf90, 0x001d, 0x080c, 0x927f, 0xa6b2, 0x0020, 0x7804, 0xa06d,
8902 0x0110, 0x080c, 0x1600, 0x080c, 0x15d9, 0x0500, 0x8528, 0x6837,
8903 0x0110, 0x683b, 0x0000, 0x2d20, 0x7c06, 0xa68a, 0x003d, 0x1228,
8904 0x2608, 0xad90, 0x000f, 0x0459, 0x0088, 0xa6b2, 0x003c, 0x2009,
8905 0x003c, 0x2d78, 0xad90, 0x000f, 0x0411, 0x0c28, 0x00fe, 0x852f,
8906 0xa5ad, 0x0003, 0x7d36, 0xa5ac, 0x0000, 0x0028, 0x00fe, 0x852f,
8907 0xa5ad, 0x0003, 0x7d36, 0x00de, 0x006e, 0x005e, 0x0005, 0x00f6,
8908 0x8dff, 0x0158, 0x6804, 0xa07d, 0x0130, 0x6807, 0x0000, 0x080c,
8909 0x510c, 0x2f68, 0x0cb8, 0x080c, 0x510c, 0x00fe, 0x0005, 0x0156,
8910 0xa184, 0x0001, 0x0108, 0x8108, 0x810c, 0x21a8, 0x2304, 0x8007,
8911 0x2012, 0x8318, 0x8210, 0x1f04, 0x9286, 0x015e, 0x0005, 0x0066,
8912 0x0126, 0x2091, 0x8000, 0x2031, 0x0001, 0x601c, 0xa084, 0x000f,
8913 0x0083, 0x012e, 0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066,
8914 0x2031, 0x0000, 0x601c, 0xa084, 0x000f, 0x001b, 0x006e, 0x012e,
8915 0x0005, 0x92c3, 0x92c3, 0x92be, 0x92e5, 0x92b1, 0x92be, 0x92e5,
8916 0x92be, 0x080c, 0x14f6, 0x0036, 0x2019, 0x0010, 0x080c, 0xa566,
8917 0x601f, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0xa006, 0x0005,
8918 0xa085, 0x0001, 0x0005, 0x00d6, 0x86ff, 0x11d8, 0x6010, 0x2068,
8919 0x080c, 0x9596, 0x01c0, 0x6834, 0xa086, 0x0139, 0x1128, 0x684b,
8920 0x0005, 0x6853, 0x0000, 0x0028, 0xa00e, 0x2001, 0x0005, 0x080c,
8921 0x51df, 0x080c, 0x9803, 0x080c, 0x510c, 0x080c, 0x8078, 0xa085,
8922 0x0001, 0x00de, 0x0005, 0xa006, 0x0ce0, 0x6000, 0xa08a, 0x0010,
8923 0x1a0c, 0x14f6, 0x000b, 0x0005, 0x92fc, 0x9319, 0x92fe, 0x9338,
8924 0x9316, 0x92fc, 0x92be, 0x92c3, 0x92c3, 0x92be, 0x92be, 0x92be,
8925 0x92be, 0x92be, 0x92be, 0x92be, 0x080c, 0x14f6, 0x86ff, 0x1198,
8926 0x00d6, 0x6010, 0x2068, 0x080c, 0x9596, 0x0110, 0x080c, 0x9803,
8927 0x00de, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x080c,
8928 0x67a8, 0x080c, 0x6c50, 0xa085, 0x0001, 0x0005, 0x080c, 0x190b,
8929 0x0c28, 0x00e6, 0x2071, 0xafc7, 0x7024, 0xac06, 0x1110, 0x080c,
8930 0x79e1, 0x601c, 0xa084, 0x000f, 0xa086, 0x0006, 0x1150, 0x0086,
8931 0x0096, 0x2049, 0x0001, 0x2c40, 0x080c, 0x7b9a, 0x009e, 0x008e,
8932 0x0010, 0x080c, 0x78de, 0x00ee, 0x1948, 0x080c, 0x92be, 0x0005,
8933 0x0036, 0x00e6, 0x2071, 0xafc7, 0x703c, 0xac06, 0x1140, 0x2019,
8934 0x0000, 0x080c, 0x7a64, 0x00ee, 0x003e, 0x0804, 0x92fe, 0x080c,
8935 0x7cb8, 0x00ee, 0x003e, 0x1904, 0x92fe, 0x080c, 0x92be, 0x0005,
8936 0x00c6, 0x601c, 0xa084, 0x000f, 0x0013, 0x00ce, 0x0005, 0x9369,
8937 0x93d3, 0x9501, 0x9374, 0x974e, 0x9369, 0xa558, 0x8078, 0x93d3,
8938 0x9362, 0x955f, 0x080c, 0x14f6, 0x080c, 0x9789, 0x1110, 0x080c,
8939 0x85f3, 0x0005, 0x080c, 0x6b73, 0x080c, 0x6c50, 0x080c, 0x8078,
8940 0x0005, 0x6017, 0x0001, 0x0005, 0x6010, 0xa080, 0x0019, 0x2c02,
8941 0x6000, 0xa08a, 0x0010, 0x1a0c, 0x14f6, 0x000b, 0x0005, 0x938f,
8942 0x9391, 0x93b1, 0x93c3, 0x93d0, 0x938f, 0x9369, 0x9369, 0x9369,
8943 0x93c3, 0x93c3, 0x938f, 0x938f, 0x938f, 0x938f, 0x93cd, 0x080c,
8944 0x14f6, 0x00e6, 0x6010, 0x2070, 0x7050, 0xc0b5, 0x7052, 0x2071,
8945 0xafc7, 0x7024, 0xac06, 0x0190, 0x080c, 0x78de, 0x6007, 0x0085,
8946 0x6003, 0x000b, 0x601f, 0x0002, 0x2001, 0xafa4, 0x2004, 0x6016,
8947 0x080c, 0x67a8, 0x080c, 0x6c50, 0x00ee, 0x0005, 0x6017, 0x0001,
8948 0x0cd8, 0x00d6, 0x6010, 0x2068, 0x6850, 0xc0b5, 0x6852, 0x00de,
8949 0x6007, 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x080c, 0x67a8,
8950 0x080c, 0x6c50, 0x0005, 0x00d6, 0x6017, 0x0001, 0x6010, 0x2068,
8951 0x6850, 0xc0b5, 0x6852, 0x00de, 0x0005, 0x080c, 0x8078, 0x0005,
8952 0x080c, 0x190b, 0x08f0, 0x6000, 0xa08a, 0x0010, 0x1a0c, 0x14f6,
8953 0x000b, 0x0005, 0x93ea, 0x9371, 0x93ec, 0x93ea, 0x93ec, 0x93ec,
8954 0x936a, 0x93ea, 0x9364, 0x9364, 0x93ea, 0x93ea, 0x93ea, 0x93ea,
8955 0x93ea, 0x93ea, 0x080c, 0x14f6, 0x00d6, 0x6018, 0x2068, 0x6804,
8956 0xa084, 0x00ff, 0x00de, 0xa08a, 0x000c, 0x1a0c, 0x14f6, 0x000b,
8957 0x0005, 0x9405, 0x94a7, 0x9407, 0x9441, 0x9407, 0x9441, 0x9407,
8958 0x9411, 0x9405, 0x9441, 0x9405, 0x942d, 0x080c, 0x14f6, 0x6004,
8959 0xa08e, 0x0016, 0x0588, 0xa08e, 0x0004, 0x0570, 0xa08e, 0x0002,
8960 0x0558, 0x6004, 0x080c, 0x9789, 0x0904, 0x94c0, 0xa08e, 0x0021,
8961 0x0904, 0x94c4, 0xa08e, 0x0022, 0x0904, 0x94c0, 0xa08e, 0x003d,
8962 0x0904, 0x94c4, 0xa08e, 0x0039, 0x0904, 0x94c8, 0xa08e, 0x0035,
8963 0x0904, 0x94c8, 0xa08e, 0x001e, 0x0188, 0xa08e, 0x0001, 0x1150,
8964 0x00d6, 0x6018, 0x2068, 0x6804, 0xa084, 0x00ff, 0x00de, 0xa086,
8965 0x0006, 0x0110, 0x080c, 0x2ad9, 0x080c, 0x85f3, 0x080c, 0x974e,
8966 0x0005, 0x00c6, 0x00d6, 0x6104, 0xa186, 0x0016, 0x0904, 0x9498,
8967 0xa186, 0x0002, 0x1518, 0x6018, 0x2068, 0x2001, 0xad34, 0x2004,
8968 0xd0ac, 0x1904, 0x94ea, 0x68a0, 0xd0bc, 0x1904, 0x94ea, 0x6840,
8969 0xa084, 0x00ff, 0xa005, 0x0190, 0x8001, 0x6842, 0x6013, 0x0000,
8970 0x601f, 0x0007, 0x6017, 0x0398, 0x603f, 0x0000, 0x080c, 0x8022,
8971 0x0128, 0x2d00, 0x601a, 0x601f, 0x0001, 0x0450, 0x00de, 0x00ce,
8972 0x6004, 0xa08e, 0x0002, 0x11a8, 0x6018, 0xa080, 0x0028, 0x2004,
8973 0xa086, 0x007e, 0x1170, 0x2009, 0xad34, 0x2104, 0xc085, 0x200a,
8974 0x00e6, 0x2071, 0xad00, 0x080c, 0x48f5, 0x00ee, 0x080c, 0x85f3,
8975 0x0020, 0x080c, 0x85f3, 0x080c, 0x2ad9, 0x00e6, 0x0126, 0x2091,
8976 0x8000, 0x080c, 0x2aff, 0x012e, 0x00ee, 0x080c, 0x974e, 0x0005,
8977 0x2001, 0x0002, 0x080c, 0x4c30, 0x6003, 0x0001, 0x6007, 0x0002,
8978 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00de, 0x00ce, 0x0c80, 0x00c6,
8979 0x00d6, 0x6104, 0xa186, 0x0016, 0x0d58, 0x6018, 0x2068, 0x6840,
8980 0xa084, 0x00ff, 0xa005, 0x0904, 0x946e, 0x8001, 0x6842, 0x6003,
8981 0x0001, 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00de, 0x00ce, 0x08b8,
8982 0x080c, 0x85f3, 0x0804, 0x943e, 0x080c, 0x8621, 0x0804, 0x943e,
8983 0x00d6, 0x2c68, 0x6104, 0x080c, 0x9a34, 0x00de, 0x0118, 0x080c,
8984 0x8078, 0x00b8, 0x6004, 0x8007, 0x6130, 0xa18c, 0x00ff, 0xa105,
8985 0x6032, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f, 0x0002, 0x6038,
8986 0x600a, 0x2001, 0xafa4, 0x2004, 0x6016, 0x080c, 0x67a8, 0x080c,
8987 0x6c50, 0x0005, 0x00de, 0x00ce, 0x080c, 0x85f3, 0x080c, 0x2ad9,
8988 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x2aff, 0x6013, 0x0000,
8989 0x601f, 0x0007, 0x6017, 0x0398, 0x603f, 0x0000, 0x012e, 0x00ee,
8990 0x0005, 0x6000, 0xa08a, 0x0010, 0x1a0c, 0x14f6, 0x000b, 0x0005,
8991 0x9518, 0x9518, 0x9518, 0x9518, 0x9518, 0x9518, 0x9518, 0x9518,
8992 0x9518, 0x9369, 0x9518, 0x9371, 0x951a, 0x9371, 0x9527, 0x9518,
8993 0x080c, 0x14f6, 0x6004, 0xa086, 0x008b, 0x0148, 0x6007, 0x008b,
8994 0x6003, 0x000d, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0005, 0x080c,
8995 0x9742, 0x080c, 0x9596, 0x0580, 0x080c, 0x2ad9, 0x00d6, 0x080c,
8996 0x9596, 0x0168, 0x6010, 0x2068, 0x6837, 0x0103, 0x684b, 0x0006,
8997 0x6847, 0x0000, 0x6850, 0xc0ed, 0x6852, 0x080c, 0x510c, 0x2c68,
8998 0x080c, 0x8022, 0x0150, 0x6818, 0x601a, 0x080c, 0x9956, 0x00c6,
8999 0x2d60, 0x080c, 0x974e, 0x00ce, 0x0008, 0x2d60, 0x00de, 0x6013,
9000 0x0000, 0x601f, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
9001 0x67ee, 0x080c, 0x6c50, 0x0010, 0x080c, 0x974e, 0x0005, 0x6000,
9002 0xa08a, 0x0010, 0x1a0c, 0x14f6, 0x000b, 0x0005, 0x9576, 0x9576,
9003 0x9576, 0x9578, 0x9579, 0x9576, 0x9576, 0x9576, 0x9576, 0x9576,
9004 0x9576, 0x9576, 0x9576, 0x9576, 0x9576, 0x9576, 0x080c, 0x14f6,
9005 0x0005, 0x080c, 0x7cb8, 0x190c, 0x14f6, 0x6110, 0x2168, 0x684b,
9006 0x0006, 0x080c, 0x510c, 0x080c, 0x8078, 0x0005, 0xa284, 0x0007,
9007 0x1158, 0xa282, 0xb400, 0x0240, 0x2001, 0xad16, 0x2004, 0xa202,
9008 0x1218, 0xa085, 0x0001, 0x0005, 0xa006, 0x0ce8, 0x0026, 0x6210,
9009 0xa294, 0xf000, 0x002e, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006,
9010 0x0126, 0x2091, 0x8000, 0x2061, 0xb400, 0x2071, 0xad00, 0x7344,
9011 0x7064, 0xa302, 0x12a8, 0x601c, 0xa206, 0x1160, 0x080c, 0x98e3,
9012 0x0148, 0x080c, 0x9789, 0x1110, 0x080c, 0x85f3, 0x00c6, 0x080c,
9013 0x8078, 0x00ce, 0xace0, 0x0018, 0x7058, 0xac02, 0x1208, 0x0c38,
9014 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6,
9015 0x0016, 0xa188, 0xae34, 0x210c, 0x81ff, 0x0170, 0x2061, 0xb400,
9016 0x2071, 0xad00, 0x0016, 0x080c, 0x8022, 0x001e, 0x0138, 0x611a,
9017 0x080c, 0x2ad9, 0x080c, 0x8078, 0xa006, 0x0010, 0xa085, 0x0001,
9018 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0056, 0x0126, 0x2091,
9019 0x8000, 0x00c6, 0x080c, 0x8022, 0x005e, 0x0180, 0x6612, 0x651a,
9020 0x080c, 0x9956, 0x601f, 0x0003, 0x2009, 0x004b, 0x080c, 0x80a7,
9021 0xa085, 0x0001, 0x012e, 0x005e, 0x00ce, 0x0005, 0xa006, 0x0cd0,
9022 0x00c6, 0x0056, 0x0126, 0x2091, 0x8000, 0x62a0, 0x00c6, 0x080c,
9023 0x8022, 0x005e, 0x0508, 0x6013, 0x0000, 0x651a, 0x080c, 0x9956,
9024 0x601f, 0x0003, 0x00c6, 0x2560, 0x080c, 0x4ecf, 0x00ce, 0x080c,
9025 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c, 0x681d, 0x2c08, 0x080c,
9026 0xa712, 0x007e, 0x2009, 0x004c, 0x080c, 0x80a7, 0xa085, 0x0001,
9027 0x012e, 0x005e, 0x00ce, 0x0005, 0xa006, 0x0cd0, 0x00f6, 0x00c6,
9028 0x0046, 0x00c6, 0x080c, 0x8022, 0x2c78, 0x00ce, 0x0180, 0x7e12,
9029 0x2c00, 0x781a, 0x781f, 0x0003, 0x2021, 0x0005, 0x080c, 0x9683,
9030 0x2f60, 0x2009, 0x004d, 0x080c, 0x80a7, 0xa085, 0x0001, 0x004e,
9031 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046, 0x00c6, 0x080c,
9032 0x8022, 0x2c78, 0x00ce, 0x0178, 0x7e12, 0x2c00, 0x781a, 0x781f,
9033 0x0003, 0x2021, 0x0005, 0x0439, 0x2f60, 0x2009, 0x004e, 0x080c,
9034 0x80a7, 0xa085, 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6,
9035 0x00c6, 0x0046, 0x00c6, 0x080c, 0x8022, 0x2c78, 0x00ce, 0x0178,
9036 0x7e12, 0x2c00, 0x781a, 0x781f, 0x0003, 0x2021, 0x0004, 0x0059,
9037 0x2f60, 0x2009, 0x0052, 0x080c, 0x80a7, 0xa085, 0x0001, 0x004e,
9038 0x00ce, 0x00fe, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000,
9039 0x080c, 0x4e71, 0x0118, 0x2001, 0x9688, 0x0028, 0x080c, 0x4e43,
9040 0x0158, 0x2001, 0x968e, 0x0006, 0xa00e, 0x2400, 0x080c, 0x51df,
9041 0x080c, 0x510c, 0x000e, 0x0807, 0x2418, 0x080c, 0x6b15, 0x62a0,
9042 0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c, 0x6900,
9043 0x008e, 0x080c, 0x681d, 0x2f08, 0x2648, 0x080c, 0xa712, 0x613c,
9044 0x81ff, 0x090c, 0x69a9, 0x012e, 0x007e, 0x009e, 0x0005, 0x00c6,
9045 0x0126, 0x2091, 0x8000, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0188,
9046 0x660a, 0x611a, 0x080c, 0x9956, 0x601f, 0x0001, 0x2d00, 0x6012,
9047 0x2009, 0x001f, 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce,
9048 0x0005, 0xa006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x00c6,
9049 0x080c, 0x8022, 0x001e, 0x0188, 0x660a, 0x611a, 0x080c, 0x9956,
9050 0x601f, 0x0008, 0x2d00, 0x6012, 0x2009, 0x0021, 0x080c, 0x80a7,
9051 0xa085, 0x0001, 0x012e, 0x00ce, 0x0005, 0xa006, 0x0cd8, 0x00c6,
9052 0x0126, 0x2091, 0x8000, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0188,
9053 0x660a, 0x611a, 0x080c, 0x9956, 0x601f, 0x0001, 0x2d00, 0x6012,
9054 0x2009, 0x003d, 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce,
9055 0x0005, 0xa006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x00c6,
9056 0x080c, 0x9807, 0x001e, 0x0180, 0x611a, 0x080c, 0x9956, 0x601f,
9057 0x0001, 0x2d00, 0x6012, 0x2009, 0x0000, 0x080c, 0x80a7, 0xa085,
9058 0x0001, 0x012e, 0x00ce, 0x0005, 0xa006, 0x0cd8, 0x00c6, 0x0126,
9059 0x2091, 0x8000, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0188, 0x660a,
9060 0x611a, 0x080c, 0x9956, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009,
9061 0x0044, 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce, 0x0005,
9062 0xa006, 0x0cd8, 0x0026, 0x00d6, 0x6218, 0x2268, 0x6a3c, 0x82ff,
9063 0x0110, 0x8211, 0x6a3e, 0x00de, 0x002e, 0x0005, 0x0006, 0x6000,
9064 0xa086, 0x0000, 0x0190, 0x6013, 0x0000, 0x601f, 0x0007, 0x2001,
9065 0xafa3, 0x2004, 0x0006, 0xa082, 0x0051, 0x000e, 0x0208, 0x8004,
9066 0x6016, 0x080c, 0xabb4, 0x603f, 0x0000, 0x000e, 0x0005, 0x0066,
9067 0x00c6, 0x00d6, 0x2031, 0xad52, 0x2634, 0xd6e4, 0x0128, 0x6618,
9068 0x2660, 0x6e48, 0x080c, 0x4dfc, 0x00de, 0x00ce, 0x006e, 0x0005,
9069 0x0006, 0x0016, 0x6004, 0xa08e, 0x0002, 0x0140, 0xa08e, 0x0003,
9070 0x0128, 0xa08e, 0x0004, 0x0110, 0xa085, 0x0001, 0x001e, 0x000e,
9071 0x0005, 0x0006, 0x00d6, 0x6010, 0xa06d, 0x0148, 0x6834, 0xa086,
9072 0x0139, 0x0138, 0x6838, 0xd0fc, 0x0110, 0xa006, 0x0010, 0xa085,
9073 0x0001, 0x00de, 0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
9074 0x00c6, 0x080c, 0x8022, 0x001e, 0x0190, 0x611a, 0x080c, 0x9956,
9075 0x601f, 0x0001, 0x2d00, 0x6012, 0x080c, 0x2ad9, 0x2009, 0x0028,
9076 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce, 0x0005, 0xa006,
9077 0x0cd8, 0xa186, 0x0015, 0x1178, 0x2011, 0xad20, 0x2204, 0xa086,
9078 0x0074, 0x1148, 0x080c, 0x8943, 0x6003, 0x0001, 0x6007, 0x0029,
9079 0x080c, 0x67ee, 0x0020, 0x080c, 0x85f3, 0x080c, 0x8078, 0x0005,
9080 0xa186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x4c30, 0x00e8,
9081 0xa186, 0x0015, 0x11e8, 0x2011, 0xad20, 0x2204, 0xa086, 0x0014,
9082 0x11b8, 0x00d6, 0x6018, 0x2068, 0x080c, 0x4d72, 0x00de, 0x080c,
9083 0x89f7, 0x1170, 0x00d6, 0x6018, 0x2068, 0x6890, 0x00de, 0xa005,
9084 0x0138, 0x2001, 0x0006, 0x080c, 0x4c30, 0x080c, 0x81f6, 0x0020,
9085 0x080c, 0x85f3, 0x080c, 0x8078, 0x0005, 0x6848, 0xa086, 0x0005,
9086 0x1108, 0x0009, 0x0005, 0x6850, 0xc0ad, 0x6852, 0x0005, 0x00e6,
9087 0x0126, 0x2071, 0xad00, 0x2091, 0x8000, 0x7544, 0xa582, 0x0001,
9088 0x0608, 0x7048, 0x2060, 0x6000, 0xa086, 0x0000, 0x0148, 0xace0,
9089 0x0018, 0x7058, 0xac02, 0x1208, 0x0cb0, 0x2061, 0xb400, 0x0c98,
9090 0x6003, 0x0008, 0x8529, 0x7546, 0xaca8, 0x0018, 0x7058, 0xa502,
9091 0x1230, 0x754a, 0xa085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x704b,
9092 0xb400, 0x0cc0, 0xa006, 0x0cc0, 0x00e6, 0x2071, 0xb28c, 0x7014,
9093 0xd0e4, 0x0150, 0x6013, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050,
9094 0x080c, 0x67a8, 0x080c, 0x6c50, 0x00ee, 0x0005, 0x00c6, 0x00f6,
9095 0x2c78, 0x080c, 0x5029, 0x00fe, 0x0120, 0x601c, 0xa084, 0x000f,
9096 0x0013, 0x00ce, 0x0005, 0x9369, 0x985e, 0x9861, 0x9864, 0xa9a7,
9097 0xa9c2, 0xa9c5, 0x9369, 0x9369, 0x080c, 0x14f6, 0xe000, 0xe000,
9098 0x0005, 0xe000, 0xe000, 0x0005, 0x0009, 0x0005, 0x00f6, 0x2c78,
9099 0x080c, 0x5029, 0x0538, 0x080c, 0x8022, 0x1128, 0x2001, 0xafa5,
9100 0x2004, 0x783e, 0x00f8, 0x7818, 0x601a, 0x080c, 0x9956, 0x781c,
9101 0xa086, 0x0003, 0x0128, 0x7808, 0x6036, 0x2f00, 0x603a, 0x0020,
9102 0x7808, 0x603a, 0x2f00, 0x6036, 0x602a, 0x601f, 0x0001, 0x6007,
9103 0x0035, 0x6003, 0x0001, 0x7950, 0x6152, 0x080c, 0x67a8, 0x080c,
9104 0x6c50, 0x2f60, 0x00fe, 0x0005, 0x0016, 0x00f6, 0x682c, 0x6032,
9105 0xa08e, 0x0001, 0x0138, 0xa086, 0x0005, 0x0140, 0xa006, 0x602a,
9106 0x602e, 0x00a0, 0x6820, 0xc0f4, 0xc0d5, 0x6822, 0x6810, 0x2078,
9107 0x787c, 0x6938, 0xa102, 0x7880, 0x6934, 0xa103, 0x1e78, 0x6834,
9108 0x602a, 0x6838, 0xa084, 0xfffc, 0x683a, 0x602e, 0x2d00, 0x6036,
9109 0x6808, 0x603a, 0x6918, 0x611a, 0x6950, 0x6152, 0x601f, 0x0001,
9110 0x6007, 0x0039, 0x6003, 0x0001, 0x080c, 0x67a8, 0x6803, 0x0002,
9111 0x00fe, 0x001e, 0x0005, 0x00f6, 0x2c78, 0x080c, 0x5029, 0x1118,
9112 0xa085, 0x0001, 0x0070, 0x6020, 0xd0f4, 0x1150, 0xc0f5, 0x6022,
9113 0x6010, 0x2078, 0x7828, 0x603a, 0x782c, 0x6036, 0x080c, 0x190b,
9114 0xa006, 0x00fe, 0x0005, 0x0006, 0x0016, 0x6004, 0xa08e, 0x0034,
9115 0x01b8, 0xa08e, 0x0035, 0x01a0, 0xa08e, 0x0036, 0x0188, 0xa08e,
9116 0x0037, 0x0170, 0xa08e, 0x0038, 0x0158, 0xa08e, 0x0039, 0x0140,
9117 0xa08e, 0x003a, 0x0128, 0xa08e, 0x003b, 0x0110, 0xa085, 0x0001,
9118 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00e6,
9119 0x2001, 0xaf9f, 0x200c, 0x8000, 0x2014, 0x2001, 0x0032, 0x080c,
9120 0x6665, 0x2001, 0xafa3, 0x82ff, 0x1110, 0x2011, 0x0002, 0x2202,
9121 0x2001, 0xafa1, 0x200c, 0x8000, 0x2014, 0x2071, 0xaf8d, 0x711a,
9122 0x721e, 0x2001, 0x0064, 0x080c, 0x6665, 0x2001, 0xafa4, 0x82ff,
9123 0x1110, 0x2011, 0x0002, 0x2202, 0x2009, 0xafa5, 0xa280, 0x000a,
9124 0x200a, 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006,
9125 0x00e6, 0x2001, 0xafa3, 0x2003, 0x0028, 0x2001, 0xafa4, 0x2003,
9126 0x0014, 0x2071, 0xaf8d, 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001,
9127 0xafa5, 0x2003, 0x001e, 0x00ee, 0x000e, 0x0005, 0x00d6, 0x6054,
9128 0xa06d, 0x0110, 0x080c, 0x15f0, 0x00de, 0x0005, 0x0005, 0x00c6,
9129 0x0126, 0x2091, 0x8000, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0178,
9130 0x611a, 0x0ca1, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009, 0x0033,
9131 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce, 0x0005, 0xa006,
9132 0x0cd8, 0x00d6, 0x00e6, 0x00f6, 0x2071, 0xad00, 0xa186, 0x0015,
9133 0x1500, 0x7080, 0xa086, 0x0018, 0x11e0, 0x6010, 0x2068, 0x6a3c,
9134 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x6e05, 0x01d8, 0x706c, 0x6a50,
9135 0xa206, 0x1160, 0x7070, 0x6a54, 0xa206, 0x1140, 0x6218, 0xa290,
9136 0x0028, 0x2214, 0x2009, 0x0000, 0x080c, 0x2b1e, 0x080c, 0x81f6,
9137 0x0020, 0x080c, 0x85f3, 0x080c, 0x8078, 0x00fe, 0x00ee, 0x00de,
9138 0x0005, 0x7050, 0x6a54, 0xa206, 0x0d48, 0x0c80, 0x00c6, 0x0126,
9139 0x2091, 0x8000, 0x00c6, 0x080c, 0x8022, 0x001e, 0x0180, 0x611a,
9140 0x080c, 0x9956, 0x601f, 0x0001, 0x2d00, 0x6012, 0x2009, 0x0043,
9141 0x080c, 0x80a7, 0xa085, 0x0001, 0x012e, 0x00ce, 0x0005, 0xa006,
9142 0x0cd8, 0x00d6, 0x00e6, 0x00f6, 0x2071, 0xad00, 0xa186, 0x0015,
9143 0x11c0, 0x7080, 0xa086, 0x0004, 0x11a0, 0x6010, 0xa0e8, 0x000f,
9144 0x2c78, 0x080c, 0x6e05, 0x01a8, 0x706c, 0x6a08, 0xa206, 0x1130,
9145 0x7070, 0x6a0c, 0xa206, 0x1110, 0x080c, 0x2ad9, 0x080c, 0x81f6,
9146 0x0020, 0x080c, 0x85f3, 0x080c, 0x8078, 0x00fe, 0x00ee, 0x00de,
9147 0x0005, 0x7050, 0x6a0c, 0xa206, 0x0d78, 0x0c80, 0x0016, 0x0026,
9148 0x684c, 0xd0ac, 0x0178, 0x6914, 0x6a10, 0x2100, 0xa205, 0x0150,
9149 0x6860, 0xa106, 0x1118, 0x685c, 0xa206, 0x0120, 0x6962, 0x6a5e,
9150 0xa085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00d6, 0x0036, 0x6310,
9151 0x2368, 0x684a, 0x6952, 0xa29e, 0x4000, 0x1188, 0x00c6, 0x6318,
9152 0x2360, 0x2009, 0x0000, 0x080c, 0x4f6e, 0x1108, 0xc185, 0x6000,
9153 0xd0bc, 0x0108, 0xc18d, 0x6a66, 0x696a, 0x00ce, 0x0080, 0x6a66,
9154 0x3918, 0xa398, 0x0006, 0x231c, 0x686b, 0x0004, 0x6b72, 0x00c6,
9155 0x6318, 0x2360, 0x6004, 0xa084, 0x00ff, 0x686e, 0x00ce, 0x080c,
9156 0x510c, 0x003e, 0x00de, 0x0005, 0x00c6, 0x0026, 0x0016, 0xa186,
9157 0x0035, 0x0110, 0x6a34, 0x0008, 0x6a28, 0x080c, 0x9586, 0x01f0,
9158 0x2260, 0x611c, 0xa186, 0x0003, 0x0118, 0xa186, 0x0006, 0x1190,
9159 0x6834, 0xa206, 0x0140, 0x6838, 0xa206, 0x1160, 0x6108, 0x6834,
9160 0xa106, 0x1140, 0x0020, 0x6008, 0x6938, 0xa106, 0x1118, 0x6018,
9161 0x6918, 0xa106, 0x001e, 0x002e, 0x00ce, 0x0005, 0xa085, 0x0001,
9162 0x0cc8, 0x0066, 0x6000, 0xa0b2, 0x0010, 0x1a0c, 0x14f6, 0x0013,
9163 0x006e, 0x0005, 0x9a7a, 0x9eff, 0xa027, 0x9a7a, 0x9a7a, 0x9a7a,
9164 0x9a7a, 0x9a7a, 0x9ab2, 0xa0a3, 0x9a7a, 0x9a7a, 0x9a7a, 0x9a7a,
9165 0x9a7a, 0x9a7a, 0x080c, 0x14f6, 0x0066, 0x6000, 0xa0b2, 0x0010,
9166 0x1a0c, 0x14f6, 0x0013, 0x006e, 0x0005, 0x9a95, 0xa4fd, 0x9a95,
9167 0x9a95, 0x9a95, 0x9a95, 0x9a95, 0x9a95, 0xa4c1, 0xa545, 0x9a95,
9168 0xaaea, 0xab1a, 0xaaea, 0xab1a, 0x9a95, 0x080c, 0x14f6, 0x0066,
9169 0x6000, 0xa0b2, 0x0010, 0x1a0c, 0x14f6, 0x0013, 0x006e, 0x0005,
9170 0x9ab0, 0xa1d8, 0xa295, 0xa2c2, 0xa346, 0x9ab0, 0xa433, 0xa3de,
9171 0xa0af, 0xa497, 0xa4ac, 0x9ab0, 0x9ab0, 0x9ab0, 0x9ab0, 0x9ab0,
9172 0x080c, 0x14f6, 0xa1b2, 0x0080, 0x1a0c, 0x14f6, 0x2100, 0xa1b2,
9173 0x0040, 0x1a04, 0x9e79, 0x0002, 0x9afc, 0x9cab, 0x9afc, 0x9afc,
9174 0x9afc, 0x9cb2, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc,
9175 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc,
9176 0x9afc, 0x9afc, 0x9afc, 0x9afe, 0x9b5a, 0x9b65, 0x9ba6, 0x9bc0,
9177 0x9c3e, 0x9c9c, 0x9afc, 0x9afc, 0x9cb5, 0x9afc, 0x9afc, 0x9cc4,
9178 0x9ccb, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9afc, 0x9d42, 0x9afc,
9179 0x9afc, 0x9d4d, 0x9afc, 0x9afc, 0x9d18, 0x9afc, 0x9afc, 0x9afc,
9180 0x9d61, 0x9afc, 0x9afc, 0x9afc, 0x9dd5, 0x9afc, 0x9afc, 0x9afc,
9181 0x9afc, 0x9afc, 0x9afc, 0x9e40, 0x080c, 0x14f6, 0x080c, 0x502d,
9182 0x1140, 0x2001, 0xad34, 0x2004, 0xa084, 0x0009, 0xa086, 0x0008,
9183 0x1140, 0x6007, 0x0009, 0x602b, 0x0009, 0x6013, 0x0000, 0x0804,
9184 0x9ca6, 0x080c, 0x501d, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016,
9185 0x6218, 0x2270, 0x72a0, 0x0026, 0x2019, 0x0029, 0x080c, 0x68e7,
9186 0x0076, 0x2039, 0x0000, 0x080c, 0x681d, 0x2c08, 0x080c, 0xa712,
9187 0x007e, 0x001e, 0x2e60, 0x080c, 0x4ecf, 0x001e, 0x002e, 0x003e,
9188 0x00ce, 0x00ee, 0x6618, 0x00c6, 0x2660, 0x080c, 0x4ceb, 0x00ce,
9189 0xa6b0, 0x0001, 0x2634, 0xa684, 0x00ff, 0xa082, 0x0006, 0x0278,
9190 0x080c, 0xa656, 0x1904, 0x9ba0, 0x080c, 0xa5f6, 0x1120, 0x6007,
9191 0x0008, 0x0804, 0x9ca6, 0x6007, 0x0009, 0x0804, 0x9ca6, 0x080c,
9192 0xa801, 0x0128, 0x080c, 0xa656, 0x0d78, 0x0804, 0x9ba0, 0x6013,
9193 0x1900, 0x0c88, 0x6106, 0x080c, 0xa5a6, 0x6007, 0x0006, 0x0804,
9194 0x9ca6, 0x6007, 0x0007, 0x0804, 0x9ca6, 0x080c, 0xab4e, 0x1904,
9195 0x9e76, 0x00d6, 0x6618, 0x2668, 0x6e04, 0xa6b4, 0xff00, 0x8637,
9196 0xa686, 0x0006, 0x0188, 0xa686, 0x0004, 0x0170, 0x6e04, 0xa6b4,
9197 0x00ff, 0xa686, 0x0006, 0x0140, 0xa686, 0x0004, 0x0128, 0xa686,
9198 0x0005, 0x0110, 0x00de, 0x00e0, 0x080c, 0xa6b4, 0x11a0, 0xa686,
9199 0x0006, 0x1150, 0x0026, 0x6218, 0xa290, 0x0028, 0x2214, 0x2009,
9200 0x0000, 0x080c, 0x2b1e, 0x002e, 0x080c, 0x4d72, 0x6007, 0x000a,
9201 0x00de, 0x0804, 0x9ca6, 0x6007, 0x000b, 0x00de, 0x0804, 0x9ca6,
9202 0x080c, 0x2ad9, 0x6007, 0x0001, 0x0804, 0x9ca6, 0x080c, 0xab4e,
9203 0x1904, 0x9e76, 0x6618, 0x00d6, 0x2668, 0x6e04, 0x00de, 0xa686,
9204 0x0707, 0x0d70, 0x0026, 0x6218, 0xa290, 0x0028, 0x2214, 0x2009,
9205 0x0000, 0x080c, 0x2b1e, 0x002e, 0x6007, 0x000c, 0x0804, 0x9ca6,
9206 0x080c, 0x502d, 0x1140, 0x2001, 0xad34, 0x2004, 0xa084, 0x0009,
9207 0xa086, 0x0008, 0x1110, 0x0804, 0x9b09, 0x080c, 0x501d, 0x6618,
9208 0xa6b0, 0x0001, 0x2634, 0xa684, 0x00ff, 0xa082, 0x0006, 0x06e8,
9209 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x4c5d, 0x002e, 0x0050,
9210 0xa6b4, 0xff00, 0x8637, 0xa686, 0x0004, 0x0120, 0xa686, 0x0006,
9211 0x1904, 0x9ba0, 0x080c, 0xa6c1, 0x1120, 0x6007, 0x000e, 0x0804,
9212 0x9ca6, 0x0046, 0x6418, 0xa4a0, 0x0028, 0x2424, 0xa4a4, 0x00ff,
9213 0x8427, 0x0046, 0x080c, 0x2ad9, 0x004e, 0x0016, 0xa006, 0x2009,
9214 0xad52, 0x210c, 0xd1a4, 0x0158, 0x2009, 0x0029, 0x080c, 0xa96c,
9215 0x6018, 0x00d6, 0x2068, 0x6800, 0xc0e5, 0x6802, 0x00de, 0x001e,
9216 0x004e, 0x6007, 0x0001, 0x0804, 0x9ca6, 0x2001, 0x0001, 0x080c,
9217 0x4c1e, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
9218 0xad05, 0x2011, 0xb290, 0x080c, 0x8a7c, 0x003e, 0x002e, 0x001e,
9219 0x015e, 0xa005, 0x0168, 0xa6b4, 0xff00, 0x8637, 0xa682, 0x0004,
9220 0x0a04, 0x9ba0, 0xa682, 0x0007, 0x0a04, 0x9bea, 0x0804, 0x9ba0,
9221 0x6013, 0x1900, 0x6007, 0x0009, 0x0804, 0x9ca6, 0x080c, 0x502d,
9222 0x1140, 0x2001, 0xad34, 0x2004, 0xa084, 0x0009, 0xa086, 0x0008,
9223 0x1110, 0x0804, 0x9b09, 0x080c, 0x501d, 0x6618, 0xa6b0, 0x0001,
9224 0x2634, 0xa684, 0x00ff, 0xa082, 0x0006, 0x06b0, 0xa6b4, 0xff00,
9225 0x8637, 0xa686, 0x0004, 0x0120, 0xa686, 0x0006, 0x1904, 0x9ba0,
9226 0x080c, 0xa6e9, 0x1130, 0x080c, 0xa5f6, 0x1118, 0x6007, 0x0010,
9227 0x04e8, 0x0046, 0x6418, 0xa4a0, 0x0028, 0x2424, 0xa4a4, 0x00ff,
9228 0x8427, 0x0046, 0x080c, 0x2ad9, 0x004e, 0x0016, 0xa006, 0x2009,
9229 0xad52, 0x210c, 0xd1a4, 0x0158, 0x2009, 0x0029, 0x080c, 0xa96c,
9230 0x6018, 0x00d6, 0x2068, 0x6800, 0xc0e5, 0x6802, 0x00de, 0x001e,
9231 0x004e, 0x6007, 0x0001, 0x00d0, 0x080c, 0xa801, 0x0140, 0xa6b4,
9232 0xff00, 0x8637, 0xa686, 0x0006, 0x0958, 0x0804, 0x9ba0, 0x6013,
9233 0x1900, 0x6007, 0x0009, 0x0050, 0x080c, 0xab4e, 0x1904, 0x9e76,
9234 0x080c, 0x9e98, 0x1904, 0x9ba0, 0x6007, 0x0012, 0x6003, 0x0001,
9235 0x080c, 0x67ee, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
9236 0x67ee, 0x0cc0, 0x6007, 0x0005, 0x0cc0, 0x080c, 0xab4e, 0x1904,
9237 0x9e76, 0x080c, 0x9e98, 0x1904, 0x9ba0, 0x6007, 0x0020, 0x6003,
9238 0x0001, 0x080c, 0x67ee, 0x0005, 0x6007, 0x0023, 0x6003, 0x0001,
9239 0x080c, 0x67ee, 0x0005, 0x080c, 0xab4e, 0x1904, 0x9e76, 0x080c,
9240 0x9e98, 0x1904, 0x9ba0, 0x0016, 0x0026, 0x2011, 0xb291, 0x2214,
9241 0xa286, 0xffff, 0x0190, 0x2c08, 0x080c, 0x9586, 0x01d8, 0x2260,
9242 0x2011, 0xb290, 0x2214, 0x6008, 0xa206, 0x11a0, 0x6018, 0xa190,
9243 0x0006, 0x2214, 0xa206, 0x01e0, 0x0068, 0x2011, 0xb290, 0x2214,
9244 0x2c08, 0x080c, 0xa940, 0x11a0, 0x2011, 0xb291, 0x2214, 0xa286,
9245 0xffff, 0x01a0, 0x2160, 0x6007, 0x0026, 0x6013, 0x1700, 0x2011,
9246 0xb289, 0x2214, 0xa296, 0xffff, 0x1160, 0x6007, 0x0025, 0x0048,
9247 0x601c, 0xa086, 0x0007, 0x1d70, 0x080c, 0x8078, 0x2160, 0x6007,
9248 0x0025, 0x6003, 0x0001, 0x080c, 0x67ee, 0x002e, 0x001e, 0x0005,
9249 0x2001, 0x0001, 0x080c, 0x4c1e, 0x0156, 0x0016, 0x0026, 0x0036,
9250 0x20a9, 0x0004, 0x2019, 0xad05, 0x2011, 0xb296, 0x080c, 0x8a7c,
9251 0x003e, 0x002e, 0x001e, 0x015e, 0x0120, 0x6007, 0x0031, 0x0804,
9252 0x9ca6, 0x080c, 0x87bd, 0x080c, 0x574f, 0x1158, 0x0006, 0x0026,
9253 0x0036, 0x080c, 0x576b, 0x0110, 0x080c, 0x5726, 0x003e, 0x002e,
9254 0x000e, 0x0005, 0x6106, 0x080c, 0x9eb4, 0x6007, 0x002b, 0x0804,
9255 0x9ca6, 0x6007, 0x002c, 0x0804, 0x9ca6, 0x080c, 0xab4e, 0x1904,
9256 0x9e76, 0x080c, 0x9e98, 0x1904, 0x9ba0, 0x6106, 0x080c, 0x9eb8,
9257 0x1120, 0x6007, 0x002e, 0x0804, 0x9ca6, 0x6007, 0x002f, 0x0804,
9258 0x9ca6, 0x00e6, 0x00d6, 0x00c6, 0x6018, 0xa080, 0x0001, 0x200c,
9259 0xa184, 0x00ff, 0xa086, 0x0006, 0x0158, 0xa184, 0xff00, 0x8007,
9260 0xa086, 0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804, 0x9cab,
9261 0x2001, 0xad71, 0x2004, 0xd0e4, 0x0904, 0x9dd2, 0x2071, 0xb28c,
9262 0x7010, 0x6036, 0x7014, 0x603a, 0x7108, 0x720c, 0x2001, 0xad52,
9263 0x2004, 0xd0a4, 0x0140, 0x6018, 0x2068, 0x6810, 0xa106, 0x1118,
9264 0x6814, 0xa206, 0x01f8, 0x2001, 0xad52, 0x2004, 0xd0ac, 0x1580,
9265 0x2069, 0xad00, 0x6870, 0xa206, 0x1558, 0x686c, 0xa106, 0x1540,
9266 0x7210, 0x080c, 0x9586, 0x0548, 0x080c, 0xa9d4, 0x0530, 0x622a,
9267 0x6007, 0x0036, 0x6003, 0x0001, 0x080c, 0x67a8, 0x00ce, 0x00de,
9268 0x00ee, 0x0005, 0x7214, 0xa286, 0xffff, 0x0150, 0x080c, 0x9586,
9269 0x01a0, 0xa280, 0x0002, 0x2004, 0x7110, 0xa106, 0x1170, 0x0c08,
9270 0x7210, 0x2c08, 0x080c, 0xa940, 0x2c10, 0x2160, 0x0130, 0x08c8,
9271 0x6007, 0x0037, 0x6013, 0x1500, 0x08e8, 0x6007, 0x0037, 0x6013,
9272 0x1700, 0x08c0, 0x6007, 0x0012, 0x08a8, 0x6018, 0xa080, 0x0001,
9273 0x2004, 0xa084, 0xff00, 0x8007, 0xa086, 0x0006, 0x1904, 0x9cab,
9274 0x00e6, 0x00d6, 0x00c6, 0x2001, 0xad71, 0x2004, 0xd0e4, 0x0904,
9275 0x9e38, 0x2069, 0xad00, 0x2071, 0xb28c, 0x7008, 0x6036, 0x720c,
9276 0x623a, 0xa286, 0xffff, 0x1140, 0x7208, 0x00c6, 0x2c08, 0x080c,
9277 0xa940, 0x2c10, 0x00ce, 0x0588, 0x080c, 0x9586, 0x0570, 0x00c6,
9278 0x0026, 0x2260, 0x080c, 0x928f, 0x002e, 0x00ce, 0x7118, 0xa18c,
9279 0xff00, 0x810f, 0xa186, 0x0001, 0x0158, 0xa186, 0x0005, 0x0118,
9280 0xa186, 0x0007, 0x1178, 0xa280, 0x0004, 0x2004, 0xa005, 0x0150,
9281 0x0056, 0x7510, 0x7614, 0x080c, 0xa9eb, 0x005e, 0x00ce, 0x00de,
9282 0x00ee, 0x0005, 0x6007, 0x003b, 0x602b, 0x0009, 0x6013, 0x2a00,
9283 0x6003, 0x0001, 0x080c, 0x67a8, 0x0c88, 0x6007, 0x003b, 0x602b,
9284 0x0009, 0x6013, 0x1700, 0x6003, 0x0001, 0x080c, 0x67a8, 0x0c30,
9285 0x6007, 0x003b, 0x602b, 0x000b, 0x6013, 0x0000, 0x0804, 0x9daa,
9286 0x00e6, 0x0026, 0x080c, 0x502d, 0x0558, 0x080c, 0x501d, 0x080c,
9287 0xabc5, 0x1520, 0x2071, 0xad00, 0x70d0, 0xc085, 0x70d2, 0x00f6,
9288 0x2079, 0x0100, 0x729c, 0xa284, 0x00ff, 0x706e, 0x78e6, 0xa284,
9289 0xff00, 0x7270, 0xa205, 0x7072, 0x78ea, 0x00fe, 0x70db, 0x0000,
9290 0x2001, 0xad52, 0x2004, 0xd0a4, 0x0120, 0x2011, 0xafe0, 0x2013,
9291 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x28fa, 0x0010, 0x080c, 0xabf1,
9292 0x002e, 0x00ee, 0x080c, 0x8078, 0x0804, 0x9caa, 0x080c, 0x8078,
9293 0x0005, 0x2600, 0x0002, 0x9e81, 0x9e81, 0x9e81, 0x9e81, 0x9e81,
9294 0x9e83, 0x080c, 0x14f6, 0x080c, 0xab4e, 0x1d80, 0x0089, 0x1138,
9295 0x6007, 0x0045, 0x6003, 0x0001, 0x080c, 0x67ee, 0x0005, 0x080c,
9296 0x2ad9, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x67ee, 0x0005,
9297 0x00d6, 0x0066, 0x6618, 0x2668, 0x6e04, 0xa6b4, 0xff00, 0x8637,
9298 0xa686, 0x0006, 0x0170, 0xa686, 0x0004, 0x0158, 0x6e04, 0xa6b4,
9299 0x00ff, 0xa686, 0x0006, 0x0128, 0xa686, 0x0004, 0x0110, 0xa085,
9300 0x0001, 0x006e, 0x00de, 0x0005, 0x00d6, 0x0449, 0x00de, 0x0005,
9301 0x00d6, 0x0491, 0x11f0, 0x680c, 0xa08c, 0xff00, 0x6820, 0xa084,
9302 0x00ff, 0xa115, 0x6212, 0x6824, 0x602a, 0xd1e4, 0x0118, 0x2009,
9303 0x0001, 0x0060, 0xd1ec, 0x0168, 0x6920, 0xa18c, 0x00ff, 0x6824,
9304 0x080c, 0x2676, 0x1130, 0x2110, 0x2009, 0x0000, 0x080c, 0x2b1e,
9305 0x0018, 0xa085, 0x0001, 0x0008, 0xa006, 0x00de, 0x0005, 0x2069,
9306 0xb28d, 0x6800, 0xa082, 0x0010, 0x1228, 0x6013, 0x0000, 0xa085,
9307 0x0001, 0x0008, 0xa006, 0x0005, 0x6013, 0x0000, 0x2069, 0xb28c,
9308 0x6808, 0xa084, 0xff00, 0xa086, 0x0800, 0x1140, 0x6800, 0xa084,
9309 0x00ff, 0xa08e, 0x0014, 0x0110, 0xa08e, 0x0010, 0x0005, 0x6004,
9310 0xa0b2, 0x0080, 0x1a0c, 0x14f6, 0xa1b6, 0x0013, 0x1130, 0x2008,
9311 0xa1b2, 0x0040, 0x1a04, 0x9ffb, 0x0092, 0xa1b6, 0x0027, 0x0120,
9312 0xa1b6, 0x0014, 0x190c, 0x14f6, 0x2001, 0x0007, 0x080c, 0x4c5d,
9313 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005, 0x9f5f,
9314 0x9f61, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f61, 0x9f6f, 0x9ff4, 0x9fbf,
9315 0x9ff4, 0x9fd0, 0x9ff4, 0x9f6f, 0x9ff4, 0x9fec, 0x9ff4, 0x9fec,
9316 0x9ff4, 0x9ff4, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f,
9317 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f61, 0x9f5f, 0x9ff4,
9318 0x9f5f, 0x9f5f, 0x9ff4, 0x9f5f, 0x9ff1, 0x9ff4, 0x9f5f, 0x9f5f,
9319 0x9f5f, 0x9f5f, 0x9ff4, 0x9ff4, 0x9f5f, 0x9ff4, 0x9ff4, 0x9f5f,
9320 0x9f69, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x9ff0, 0x9ff4, 0x9f5f,
9321 0x9f5f, 0x9ff4, 0x9ff4, 0x9f5f, 0x9f5f, 0x9f5f, 0x9f5f, 0x080c,
9322 0x14f6, 0x080c, 0x6b73, 0x6003, 0x0002, 0x080c, 0x6c50, 0x0804,
9323 0x9ffa, 0x2001, 0x0000, 0x080c, 0x4c1e, 0x0804, 0x9ff4, 0x00f6,
9324 0x2079, 0xad51, 0x7804, 0x00fe, 0xd0ac, 0x1904, 0x9ff4, 0x2001,
9325 0x0000, 0x080c, 0x4c1e, 0x6018, 0xa080, 0x0004, 0x2004, 0xa086,
9326 0x00ff, 0x1140, 0x00f6, 0x2079, 0xad00, 0x7894, 0x8000, 0x7896,
9327 0x00fe, 0x00e0, 0x00c6, 0x6018, 0x2060, 0x6000, 0xd0f4, 0x1140,
9328 0x6010, 0xa005, 0x0128, 0x00ce, 0x080c, 0x3cce, 0x0804, 0x9ff4,
9329 0x00ce, 0x2001, 0xad00, 0x2004, 0xa086, 0x0002, 0x1138, 0x00f6,
9330 0x2079, 0xad00, 0x7894, 0x8000, 0x7896, 0x00fe, 0x2001, 0x0002,
9331 0x080c, 0x4c30, 0x080c, 0x6b73, 0x601f, 0x0001, 0x6003, 0x0001,
9332 0x6007, 0x0002, 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00c6, 0x6118,
9333 0x2160, 0x2009, 0x0001, 0x080c, 0x6519, 0x00ce, 0x04d8, 0x6618,
9334 0x00d6, 0x2668, 0x6e04, 0x00de, 0xa6b4, 0xff00, 0x8637, 0xa686,
9335 0x0006, 0x0550, 0xa686, 0x0004, 0x0538, 0x2001, 0x0004, 0x0410,
9336 0x2001, 0xad00, 0x2004, 0xa086, 0x0003, 0x1110, 0x080c, 0x3cce,
9337 0x2001, 0x0006, 0x0489, 0x6618, 0x00d6, 0x2668, 0x6e04, 0x00de,
9338 0xa6b4, 0xff00, 0x8637, 0xa686, 0x0006, 0x0170, 0x2001, 0x0006,
9339 0x0048, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x00e9, 0x0020,
9340 0x0018, 0x0010, 0x080c, 0x4c5d, 0x080c, 0x6b73, 0x080c, 0x8078,
9341 0x080c, 0x6c50, 0x0005, 0x2600, 0x0002, 0xa003, 0xa003, 0xa003,
9342 0xa003, 0xa003, 0xa005, 0x080c, 0x14f6, 0x080c, 0x6b73, 0x080c,
9343 0x8078, 0x080c, 0x6c50, 0x0005, 0x0016, 0x00d6, 0x6118, 0x2168,
9344 0x6900, 0xd184, 0x0188, 0x6104, 0xa18e, 0x000a, 0x1128, 0x699c,
9345 0xd1a4, 0x1110, 0x2001, 0x0007, 0x080c, 0x4c30, 0x2001, 0x0000,
9346 0x080c, 0x4c1e, 0x080c, 0x2aff, 0x00de, 0x001e, 0x0005, 0x00d6,
9347 0x6618, 0x2668, 0x6804, 0xa084, 0xff00, 0x8007, 0x00de, 0xa0b2,
9348 0x000c, 0x1a0c, 0x14f6, 0xa1b6, 0x0015, 0x1110, 0x003b, 0x0028,
9349 0xa1b6, 0x0016, 0x190c, 0x14f6, 0x006b, 0x0005, 0x86b9, 0x86b9,
9350 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0xa08f, 0xa056, 0x86b9, 0x86b9,
9351 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0x86b9,
9352 0xa08f, 0xa096, 0x86b9, 0x86b9, 0x86b9, 0x86b9, 0x00f6, 0x2079,
9353 0xad51, 0x7804, 0xd0ac, 0x11e0, 0x6018, 0xa07d, 0x01c8, 0x7800,
9354 0xd0f4, 0x1118, 0x7810, 0xa005, 0x1198, 0x2001, 0x0000, 0x080c,
9355 0x4c1e, 0x2001, 0x0002, 0x080c, 0x4c30, 0x601f, 0x0001, 0x6003,
9356 0x0001, 0x6007, 0x0002, 0x080c, 0x67ee, 0x080c, 0x6c50, 0x00a8,
9357 0x2011, 0xb283, 0x2204, 0x8211, 0x220c, 0x080c, 0x2676, 0x1168,
9358 0x00c6, 0x080c, 0x4cdc, 0x0120, 0x00ce, 0x080c, 0x8078, 0x0028,
9359 0x080c, 0x493a, 0x00ce, 0x080c, 0x8078, 0x00fe, 0x0005, 0x6604,
9360 0xa6b6, 0x001e, 0x1110, 0x080c, 0x8078, 0x0005, 0x080c, 0x8940,
9361 0x1138, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x67ee, 0x0010,
9362 0x080c, 0x8078, 0x0005, 0x6004, 0xa08a, 0x0080, 0x1a0c, 0x14f6,
9363 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005, 0xa182,
9364 0x0040, 0x0002, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c7, 0xa0c5,
9365 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5,
9366 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0xa0c5, 0x080c, 0x14f6, 0x00d6,
9367 0x00e6, 0x00f6, 0x0156, 0x0046, 0x0026, 0x6218, 0xa280, 0x002b,
9368 0x2004, 0xa005, 0x0120, 0x2021, 0x0000, 0x080c, 0xab96, 0x6106,
9369 0x2071, 0xb280, 0x7444, 0xa4a4, 0xff00, 0x0904, 0xa129, 0xa486,
9370 0x2000, 0x1130, 0x2009, 0x0001, 0x2011, 0x0200, 0x080c, 0x663f,
9371 0x080c, 0x15d9, 0x090c, 0x14f6, 0x6003, 0x0007, 0x2d00, 0x6837,
9372 0x010d, 0x6803, 0x0000, 0x683b, 0x0000, 0x6c5a, 0x2c00, 0x685e,
9373 0x6008, 0x68b2, 0x6018, 0x2078, 0x78a0, 0x8007, 0x7130, 0x694a,
9374 0x0016, 0xa084, 0xff00, 0x6846, 0x684f, 0x0000, 0x6857, 0x0036,
9375 0x080c, 0x510c, 0x001e, 0xa486, 0x2000, 0x1130, 0x2019, 0x0017,
9376 0x080c, 0xa8eb, 0x0804, 0xa186, 0xa486, 0x0400, 0x1130, 0x2019,
9377 0x0002, 0x080c, 0xa89d, 0x0804, 0xa186, 0xa486, 0x0200, 0x1110,
9378 0x080c, 0xa882, 0xa486, 0x1000, 0x1110, 0x080c, 0xa8d0, 0x0804,
9379 0xa186, 0x2069, 0xb048, 0x6a00, 0xd284, 0x0904, 0xa1d5, 0xa284,
9380 0x0300, 0x1904, 0xa1cf, 0x6804, 0xa005, 0x0904, 0xa1c0, 0x2d78,
9381 0x6003, 0x0007, 0x080c, 0x15c0, 0x0904, 0xa18d, 0x7800, 0xd08c,
9382 0x1118, 0x7804, 0x8001, 0x7806, 0x6013, 0x0000, 0x6803, 0x0000,
9383 0x6837, 0x0116, 0x683b, 0x0000, 0x6008, 0x68b2, 0x2c00, 0x684a,
9384 0x6018, 0x2078, 0x78a0, 0x8007, 0x7130, 0x6986, 0x6846, 0x7928,
9385 0x698a, 0x792c, 0x698e, 0x7930, 0x6992, 0x7934, 0x6996, 0x6853,
9386 0x003d, 0x7244, 0xa294, 0x0003, 0xa286, 0x0002, 0x1118, 0x684f,
9387 0x0040, 0x0040, 0xa286, 0x0001, 0x1118, 0x684f, 0x0080, 0x0010,
9388 0x684f, 0x0000, 0x20a9, 0x000a, 0x2001, 0xb290, 0xad90, 0x0015,
9389 0x200c, 0x810f, 0x2112, 0x8000, 0x8210, 0x1f04, 0xa178, 0x200c,
9390 0x6982, 0x8000, 0x200c, 0x697e, 0x080c, 0x510c, 0x002e, 0x004e,
9391 0x015e, 0x00fe, 0x00ee, 0x00de, 0x0005, 0x6013, 0x0100, 0x6003,
9392 0x0001, 0x6007, 0x0041, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0c70,
9393 0x2069, 0xb292, 0x2d04, 0xa084, 0xff00, 0xa086, 0x1200, 0x11a8,
9394 0x2069, 0xb280, 0x686c, 0xa084, 0x00ff, 0x0016, 0x6110, 0xa18c,
9395 0x0700, 0xa10d, 0x6112, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043,
9396 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0888, 0x6013, 0x0200, 0x6003,
9397 0x0001, 0x6007, 0x0041, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0830,
9398 0x6013, 0x0300, 0x0010, 0x6013, 0x0100, 0x6003, 0x0001, 0x6007,
9399 0x0041, 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0804, 0xa186, 0x6013,
9400 0x0500, 0x0c98, 0x6013, 0x0600, 0x0818, 0x6013, 0x0200, 0x0800,
9401 0xa186, 0x0013, 0x1170, 0x6004, 0xa08a, 0x0040, 0x0a0c, 0x14f6,
9402 0xa08a, 0x0053, 0x1a0c, 0x14f6, 0xa082, 0x0040, 0x2008, 0x0804,
9403 0xa252, 0xa186, 0x0051, 0x0138, 0xa186, 0x0047, 0x11d8, 0x6004,
9404 0xa086, 0x0041, 0x0518, 0x2001, 0x0109, 0x2004, 0xd084, 0x01f0,
9405 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x6699,
9406 0x002e, 0x001e, 0x000e, 0x012e, 0x6000, 0xa086, 0x0002, 0x1170,
9407 0x0804, 0xa295, 0xa186, 0x0027, 0x0120, 0xa186, 0x0014, 0x190c,
9408 0x14f6, 0x6004, 0xa082, 0x0040, 0x2008, 0x001a, 0x080c, 0x80be,
9409 0x0005, 0xa22c, 0xa22e, 0xa22e, 0xa22c, 0xa22c, 0xa22c, 0xa22c,
9410 0xa22c, 0xa22c, 0xa22c, 0xa22c, 0xa22c, 0xa22c, 0xa22c, 0xa22c,
9411 0xa22c, 0xa22c, 0xa22c, 0xa22c, 0x080c, 0x14f6, 0x080c, 0x6b73,
9412 0x080c, 0x6c50, 0x0036, 0x00d6, 0x6010, 0xa06d, 0x01c0, 0xad84,
9413 0xf000, 0x01a8, 0x6003, 0x0002, 0x6018, 0x2004, 0xd0bc, 0x1178,
9414 0x2019, 0x0004, 0x080c, 0xa91f, 0x6013, 0x0000, 0x6014, 0xa005,
9415 0x1120, 0x2001, 0xafa4, 0x2004, 0x6016, 0x6003, 0x0007, 0x00de,
9416 0x003e, 0x0005, 0x0002, 0xa266, 0xa283, 0xa26f, 0xa28f, 0xa266,
9417 0xa266, 0xa266, 0xa266, 0xa266, 0xa266, 0xa266, 0xa266, 0xa266,
9418 0xa266, 0xa266, 0xa266, 0xa266, 0xa266, 0xa266, 0x080c, 0x14f6,
9419 0x6010, 0xa088, 0x0013, 0x2104, 0xa085, 0x0400, 0x200a, 0x080c,
9420 0x6b73, 0x6010, 0xa080, 0x0013, 0x2004, 0xd0b4, 0x0138, 0x6003,
9421 0x0007, 0x2009, 0x0043, 0x080c, 0x80a7, 0x0010, 0x6003, 0x0002,
9422 0x080c, 0x6c50, 0x0005, 0x080c, 0x6b73, 0x080c, 0xab55, 0x1120,
9423 0x080c, 0x6618, 0x080c, 0x8078, 0x080c, 0x6c50, 0x0005, 0x080c,
9424 0x6b73, 0x2009, 0x0041, 0x0804, 0xa3de, 0xa182, 0x0040, 0x0002,
9425 0xa2ab, 0xa2ad, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ae,
9426 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab, 0xa2ab,
9427 0xa2ab, 0xa2b9, 0xa2ab, 0x080c, 0x14f6, 0x0005, 0x6003, 0x0004,
9428 0x6110, 0x20e1, 0x0005, 0x3d18, 0x3e20, 0x2c10, 0x080c, 0x1824,
9429 0x0005, 0x00d6, 0x080c, 0x6618, 0x00de, 0x080c, 0xabb4, 0x080c,
9430 0x8078, 0x0005, 0xa182, 0x0040, 0x0002, 0xa2d8, 0xa2d8, 0xa2d8,
9431 0xa2d8, 0xa2d8, 0xa2d8, 0xa2d8, 0xa2da, 0xa2d8, 0xa2dd, 0xa316,
9432 0xa2d8, 0xa2d8, 0xa2d8, 0xa2d8, 0xa316, 0xa2d8, 0xa2d8, 0xa2d8,
9433 0x080c, 0x14f6, 0x080c, 0x80be, 0x0005, 0x2001, 0xad71, 0x2004,
9434 0xd0e4, 0x0158, 0x2001, 0x0100, 0x2004, 0xa082, 0x0005, 0x0228,
9435 0x2001, 0x011f, 0x2004, 0x6036, 0x0010, 0x6037, 0x0000, 0x080c,
9436 0x6c05, 0x080c, 0x6d0d, 0x6010, 0x00d6, 0x2068, 0x684c, 0xd0fc,
9437 0x0150, 0xa08c, 0x0003, 0xa18e, 0x0002, 0x0168, 0x2009, 0x0041,
9438 0x00de, 0x0804, 0xa3de, 0x6003, 0x0007, 0x6017, 0x0000, 0x080c,
9439 0x6618, 0x00de, 0x0005, 0x080c, 0xab55, 0x0110, 0x00de, 0x0005,
9440 0x080c, 0x6618, 0x080c, 0x8078, 0x00de, 0x0ca0, 0x0036, 0x080c,
9441 0x6c05, 0x080c, 0x6d0d, 0x6010, 0x00d6, 0x2068, 0x6018, 0x2004,
9442 0xd0bc, 0x0188, 0x684c, 0xa084, 0x0003, 0xa086, 0x0002, 0x0140,
9443 0x687c, 0x632c, 0xa31a, 0x632e, 0x6880, 0x6328, 0xa31b, 0x632a,
9444 0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xa91f, 0x6014,
9445 0xa005, 0x1128, 0x2001, 0xafa4, 0x2004, 0x8003, 0x6016, 0x6013,
9446 0x0000, 0x6003, 0x0007, 0x00de, 0x003e, 0x0005, 0xa186, 0x0013,
9447 0x1150, 0x6004, 0xa086, 0x0042, 0x190c, 0x14f6, 0x080c, 0x6b73,
9448 0x080c, 0x6c50, 0x0005, 0xa186, 0x0027, 0x0118, 0xa186, 0x0014,
9449 0x1180, 0x6004, 0xa086, 0x0042, 0x190c, 0x14f6, 0x2001, 0x0007,
9450 0x080c, 0x4c5d, 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50,
9451 0x0005, 0xa182, 0x0040, 0x0002, 0xa37f, 0xa37f, 0xa37f, 0xa37f,
9452 0xa37f, 0xa37f, 0xa37f, 0xa381, 0xa38d, 0xa37f, 0xa37f, 0xa37f,
9453 0xa37f, 0xa37f, 0xa37f, 0xa37f, 0xa37f, 0xa37f, 0xa37f, 0x080c,
9454 0x14f6, 0x0036, 0x0046, 0x20e1, 0x0005, 0x3d18, 0x3e20, 0x2c10,
9455 0x080c, 0x1824, 0x004e, 0x003e, 0x0005, 0x6010, 0x00d6, 0x2068,
9456 0x6810, 0x6a14, 0x0006, 0x0046, 0x0056, 0x6c7c, 0xa422, 0x6d80,
9457 0x2200, 0xa52b, 0x602c, 0xa420, 0x642e, 0x6028, 0xa529, 0x652a,
9458 0x005e, 0x004e, 0x000e, 0xa20d, 0x1178, 0x684c, 0xd0fc, 0x0120,
9459 0x2009, 0x0041, 0x00de, 0x0490, 0x6003, 0x0007, 0x6017, 0x0000,
9460 0x080c, 0x6618, 0x00de, 0x0005, 0x0006, 0x00f6, 0x2c78, 0x080c,
9461 0x5029, 0x00fe, 0x000e, 0x0120, 0x6003, 0x0002, 0x00de, 0x0005,
9462 0x2009, 0xad0d, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010,
9463 0x6003, 0x0006, 0x0021, 0x080c, 0x661a, 0x00de, 0x0005, 0xd2fc,
9464 0x0140, 0x8002, 0x8000, 0x8212, 0xa291, 0x0000, 0x2009, 0x0009,
9465 0x0010, 0x2009, 0x0015, 0x6a6a, 0x6866, 0x0005, 0xa182, 0x0040,
9466 0x0208, 0x0062, 0xa186, 0x0013, 0x0120, 0xa186, 0x0014, 0x190c,
9467 0x14f6, 0x6020, 0xd0dc, 0x090c, 0x14f6, 0x0005, 0xa401, 0xa408,
9468 0xa414, 0xa420, 0xa401, 0xa401, 0xa401, 0xa42f, 0xa401, 0xa403,
9469 0xa403, 0xa401, 0xa401, 0xa401, 0xa401, 0xa403, 0xa401, 0xa403,
9470 0xa401, 0x080c, 0x14f6, 0x6020, 0xd0dc, 0x090c, 0x14f6, 0x0005,
9471 0x6003, 0x0001, 0x6106, 0x080c, 0x67a8, 0x0126, 0x2091, 0x8000,
9472 0x080c, 0x6c50, 0x012e, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c,
9473 0x67a8, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c50, 0x012e, 0x0005,
9474 0x6003, 0x0003, 0x6106, 0x2c10, 0x080c, 0x1e6e, 0x0126, 0x2091,
9475 0x8000, 0x080c, 0x680b, 0x080c, 0x6d0d, 0x012e, 0x0005, 0xa016,
9476 0x080c, 0x1824, 0x0005, 0x0126, 0x2091, 0x8000, 0x0036, 0x00d6,
9477 0xa182, 0x0040, 0x0023, 0x00de, 0x003e, 0x012e, 0x0005, 0xa44f,
9478 0xa451, 0xa463, 0xa47e, 0xa44f, 0xa44f, 0xa44f, 0xa493, 0xa44f,
9479 0xa44f, 0xa44f, 0xa44f, 0xa44f, 0xa44f, 0xa44f, 0xa44f, 0x080c,
9480 0x14f6, 0x6010, 0x2068, 0x684c, 0xd0fc, 0x01f8, 0xa09c, 0x0003,
9481 0xa39e, 0x0003, 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c, 0x67a8,
9482 0x080c, 0x6c50, 0x0498, 0x6010, 0x2068, 0x684c, 0xd0fc, 0x0168,
9483 0xa09c, 0x0003, 0xa39e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106,
9484 0x080c, 0x67a8, 0x080c, 0x6c50, 0x0408, 0x6013, 0x0000, 0x6017,
9485 0x0000, 0x2019, 0x0004, 0x080c, 0xa91f, 0x00c0, 0x6010, 0x2068,
9486 0x684c, 0xd0fc, 0x0d90, 0xa09c, 0x0003, 0xa39e, 0x0003, 0x0d68,
9487 0x6003, 0x0003, 0x6106, 0x2c10, 0x080c, 0x1e6e, 0x080c, 0x680b,
9488 0x080c, 0x6d0d, 0x0018, 0xa016, 0x080c, 0x1824, 0x0005, 0x080c,
9489 0x6b73, 0x6110, 0x81ff, 0x0158, 0x00d6, 0x2168, 0x080c, 0xabfa,
9490 0x0036, 0x2019, 0x0029, 0x080c, 0xa91f, 0x003e, 0x00de, 0x080c,
9491 0x974e, 0x080c, 0x6c50, 0x0005, 0x080c, 0x6c05, 0x6110, 0x81ff,
9492 0x0158, 0x00d6, 0x2168, 0x080c, 0xabfa, 0x0036, 0x2019, 0x0029,
9493 0x080c, 0xa91f, 0x003e, 0x00de, 0x080c, 0x974e, 0x080c, 0x6d0d,
9494 0x0005, 0xa182, 0x0085, 0x0002, 0xa4cd, 0xa4cb, 0xa4cb, 0xa4d9,
9495 0xa4cb, 0xa4cb, 0xa4cb, 0x080c, 0x14f6, 0x6003, 0x000b, 0x6106,
9496 0x080c, 0x67a8, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c50, 0x012e,
9497 0x0005, 0x0026, 0x00e6, 0x080c, 0xab4e, 0x0118, 0x080c, 0x8078,
9498 0x00c8, 0x2071, 0xb280, 0x7224, 0x6212, 0x7220, 0x080c, 0xa7ce,
9499 0x0118, 0x6007, 0x0086, 0x0040, 0x6007, 0x0087, 0x7224, 0xa296,
9500 0xffff, 0x1110, 0x6007, 0x0086, 0x6003, 0x0001, 0x080c, 0x67a8,
9501 0x080c, 0x6c50, 0x00ee, 0x002e, 0x0005, 0xa186, 0x0013, 0x1160,
9502 0x6004, 0xa08a, 0x0085, 0x0a0c, 0x14f6, 0xa08a, 0x008c, 0x1a0c,
9503 0x14f6, 0xa082, 0x0085, 0x00a2, 0xa186, 0x0027, 0x0130, 0xa186,
9504 0x0014, 0x0118, 0x080c, 0x80be, 0x0050, 0x2001, 0x0007, 0x080c,
9505 0x4c5d, 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005,
9506 0xa527, 0xa529, 0xa529, 0xa527, 0xa527, 0xa527, 0xa527, 0x080c,
9507 0x14f6, 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005,
9508 0xa182, 0x0085, 0x0a0c, 0x14f6, 0xa182, 0x008c, 0x1a0c, 0x14f6,
9509 0xa182, 0x0085, 0x0002, 0xa542, 0xa542, 0xa542, 0xa544, 0xa542,
9510 0xa542, 0xa542, 0x080c, 0x14f6, 0x0005, 0xa186, 0x0013, 0x0148,
9511 0xa186, 0x0014, 0x0130, 0xa186, 0x0027, 0x0118, 0x080c, 0x80be,
9512 0x0030, 0x080c, 0x6b73, 0x080c, 0x974e, 0x080c, 0x6c50, 0x0005,
9513 0x0036, 0x080c, 0xabb4, 0x603f, 0x0000, 0x2019, 0x000b, 0x0031,
9514 0x601f, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x0126, 0x0036,
9515 0x2091, 0x8000, 0x0086, 0x2c40, 0x0096, 0x2049, 0x0000, 0x080c,
9516 0x7b9a, 0x009e, 0x008e, 0x1578, 0x0076, 0x2c38, 0x080c, 0x7c34,
9517 0x007e, 0x1548, 0x6000, 0xa086, 0x0000, 0x0528, 0x601c, 0xa086,
9518 0x0007, 0x0508, 0x00d6, 0x6000, 0xa086, 0x0004, 0x1150, 0x080c,
9519 0xabb4, 0x601f, 0x0007, 0x2001, 0xafa3, 0x2004, 0x6016, 0x080c,
9520 0x190b, 0x6010, 0x2068, 0x080c, 0x9596, 0x0110, 0x080c, 0xa91f,
9521 0x00de, 0x6013, 0x0000, 0x080c, 0xabb4, 0x601f, 0x0007, 0x2001,
9522 0xafa3, 0x2004, 0x6016, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6,
9523 0x0036, 0x0156, 0x2079, 0xb280, 0x7938, 0x783c, 0x080c, 0x2676,
9524 0x1904, 0xa5f1, 0x0016, 0x00c6, 0x080c, 0x4cdc, 0x15c0, 0x2011,
9525 0xb290, 0xac98, 0x000a, 0x20a9, 0x0004, 0x080c, 0x8a7c, 0x1578,
9526 0x001e, 0x002e, 0x0026, 0x0016, 0x2019, 0x0029, 0x080c, 0x7cf4,
9527 0x080c, 0x68e7, 0x0076, 0x2039, 0x0000, 0x080c, 0x681d, 0x007e,
9528 0x001e, 0x0076, 0x2039, 0x0000, 0x080c, 0xa712, 0x007e, 0x080c,
9529 0x4ecf, 0x0026, 0x6204, 0xa294, 0xff00, 0x8217, 0xa286, 0x0006,
9530 0x0118, 0xa286, 0x0004, 0x1118, 0x62a0, 0x080c, 0x2b87, 0x002e,
9531 0x001e, 0x080c, 0x493a, 0x6612, 0x6516, 0xa006, 0x0010, 0x00ce,
9532 0x001e, 0x015e, 0x003e, 0x00ce, 0x00fe, 0x0005, 0x00c6, 0x00d6,
9533 0x00e6, 0x0016, 0x2009, 0xad20, 0x2104, 0xa086, 0x0074, 0x1904,
9534 0xa64b, 0x2069, 0xb28e, 0x690c, 0xa182, 0x0100, 0x06c0, 0x6908,
9535 0xa184, 0x8000, 0x05e8, 0x2001, 0xaf9d, 0x2004, 0xa005, 0x1160,
9536 0x6018, 0x2070, 0x7010, 0xa084, 0x00ff, 0x0118, 0x7000, 0xd0f4,
9537 0x0118, 0xa184, 0x0800, 0x0560, 0x6910, 0xa18a, 0x0001, 0x0610,
9538 0x6914, 0x2069, 0xb2ae, 0x6904, 0x81ff, 0x1198, 0x690c, 0xa182,
9539 0x0100, 0x02a8, 0x6908, 0x81ff, 0x1178, 0x6910, 0xa18a, 0x0001,
9540 0x0288, 0x6918, 0xa18a, 0x0001, 0x0298, 0x00d0, 0x6013, 0x0100,
9541 0x00a0, 0x6013, 0x0300, 0x0088, 0x6013, 0x0500, 0x0070, 0x6013,
9542 0x0700, 0x0058, 0x6013, 0x0900, 0x0040, 0x6013, 0x0b00, 0x0028,
9543 0x6013, 0x0f00, 0x0010, 0x6013, 0x2d00, 0xa085, 0x0001, 0x0008,
9544 0xa006, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6,
9545 0x0026, 0x0036, 0x0156, 0x6218, 0x2268, 0x6b04, 0xa394, 0x00ff,
9546 0xa286, 0x0006, 0x0190, 0xa286, 0x0004, 0x0178, 0xa394, 0xff00,
9547 0x8217, 0xa286, 0x0006, 0x0148, 0xa286, 0x0004, 0x0130, 0x00c6,
9548 0x2d60, 0x080c, 0x4ceb, 0x00ce, 0x04c0, 0x2011, 0xb296, 0xad98,
9549 0x000a, 0x20a9, 0x0004, 0x080c, 0x8a7c, 0x1580, 0x2011, 0xb29a,
9550 0xad98, 0x0006, 0x20a9, 0x0004, 0x080c, 0x8a7c, 0x1538, 0x0046,
9551 0x0016, 0x6aa0, 0xa294, 0x00ff, 0x8227, 0xa006, 0x2009, 0xad52,
9552 0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c, 0xa96c, 0x6800,
9553 0xc0e5, 0x6802, 0x2019, 0x0029, 0x080c, 0x68e7, 0x0076, 0x2039,
9554 0x0000, 0x080c, 0x681d, 0x2c08, 0x080c, 0xa712, 0x007e, 0x2001,
9555 0x0007, 0x080c, 0x4c5d, 0x001e, 0x004e, 0xa006, 0x015e, 0x003e,
9556 0x002e, 0x00de, 0x00ce, 0x0005, 0x00d6, 0x2069, 0xb28e, 0x6800,
9557 0xa086, 0x0800, 0x0118, 0x6013, 0x0000, 0x0008, 0xa006, 0x00de,
9558 0x0005, 0x00c6, 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079,
9559 0xb28c, 0x7930, 0x7834, 0x080c, 0x2676, 0x11a0, 0x080c, 0x4cdc,
9560 0x1188, 0x2011, 0xb290, 0xac98, 0x000a, 0x20a9, 0x0004, 0x080c,
9561 0x8a7c, 0x1140, 0x2011, 0xb294, 0xac98, 0x0006, 0x20a9, 0x0004,
9562 0x080c, 0x8a7c, 0x015e, 0x003e, 0x002e, 0x001e, 0x00fe, 0x00ce,
9563 0x0005, 0x00c6, 0x0006, 0x0016, 0x0026, 0x0036, 0x0156, 0x2011,
9564 0xb283, 0x2204, 0x8211, 0x220c, 0x080c, 0x2676, 0x11a0, 0x080c,
9565 0x4cdc, 0x1188, 0x2011, 0xb296, 0xac98, 0x000a, 0x20a9, 0x0004,
9566 0x080c, 0x8a7c, 0x1140, 0x2011, 0xb29a, 0xac98, 0x0006, 0x20a9,
9567 0x0004, 0x080c, 0x8a7c, 0x015e, 0x003e, 0x002e, 0x001e, 0x000e,
9568 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x0056,
9569 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x2740, 0x2029, 0xafd0,
9570 0x252c, 0x2021, 0xafd6, 0x2424, 0x2061, 0xb400, 0x2071, 0xad00,
9571 0x7644, 0x7064, 0x81ff, 0x0128, 0x8001, 0xa602, 0x1a04, 0xa78e,
9572 0x0018, 0xa606, 0x0904, 0xa78e, 0x2100, 0xac06, 0x0904, 0xa785,
9573 0x080c, 0xa990, 0x0904, 0xa785, 0x671c, 0xa786, 0x0001, 0x0904,
9574 0xa7a5, 0xa786, 0x0004, 0x0904, 0xa7a5, 0xa786, 0x0007, 0x05e8,
9575 0x2500, 0xac06, 0x05d0, 0x2400, 0xac06, 0x05b8, 0x080c, 0xa9a0,
9576 0x15a0, 0x88ff, 0x0118, 0x6050, 0xa906, 0x1578, 0x00d6, 0x6000,
9577 0xa086, 0x0004, 0x1120, 0x0016, 0x080c, 0x190b, 0x001e, 0xa786,
9578 0x0008, 0x1148, 0x080c, 0x9789, 0x1130, 0x080c, 0x85f3, 0x00de,
9579 0x080c, 0x974e, 0x00d0, 0x6010, 0x2068, 0x080c, 0x9596, 0x0190,
9580 0xa786, 0x0003, 0x1528, 0x6837, 0x0103, 0x6b4a, 0x6847, 0x0000,
9581 0x080c, 0xabfa, 0x0016, 0x080c, 0x97fd, 0x080c, 0x510c, 0x001e,
9582 0x080c, 0x9742, 0x00de, 0x080c, 0x974e, 0xace0, 0x0018, 0x2001,
9583 0xad16, 0x2004, 0xac02, 0x1210, 0x0804, 0xa726, 0x012e, 0x002e,
9584 0x004e, 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005,
9585 0xa786, 0x0006, 0x19c0, 0xa386, 0x0005, 0x0128, 0x080c, 0xabfa,
9586 0x080c, 0xa91f, 0x08f8, 0x00de, 0x0c00, 0x080c, 0xa9a0, 0x19e8,
9587 0x81ff, 0x09d8, 0xa180, 0x0001, 0x2004, 0xa086, 0x0018, 0x0130,
9588 0xa180, 0x0001, 0x2004, 0xa086, 0x002d, 0x1978, 0x6000, 0xa086,
9589 0x0002, 0x1958, 0x080c, 0x9778, 0x0130, 0x080c, 0x9789, 0x1928,
9590 0x080c, 0x85f3, 0x0038, 0x080c, 0x2aff, 0x080c, 0x9789, 0x1110,
9591 0x080c, 0x85f3, 0x080c, 0x974e, 0x0804, 0xa785, 0x00c6, 0x00e6,
9592 0x0016, 0x2c08, 0x2170, 0x080c, 0xa940, 0x001e, 0x0120, 0x601c,
9593 0xa084, 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005, 0xa7e6, 0xa7e6,
9594 0xa7e6, 0xa7e6, 0xa7e6, 0xa7e6, 0xa7e8, 0xa7e6, 0xa006, 0x0005,
9595 0x0046, 0x0016, 0x7018, 0xa080, 0x0028, 0x2024, 0xa4a4, 0x00ff,
9596 0x8427, 0x2c00, 0x2009, 0x0020, 0x080c, 0xa96c, 0x001e, 0x004e,
9597 0x0036, 0x2019, 0x0002, 0x080c, 0xa566, 0x003e, 0xa085, 0x0001,
9598 0x0005, 0x2001, 0x0001, 0x080c, 0x4c1e, 0x0156, 0x0016, 0x0026,
9599 0x0036, 0x20a9, 0x0004, 0x2019, 0xad05, 0x2011, 0xb296, 0x080c,
9600 0x8a7c, 0x003e, 0x002e, 0x001e, 0x015e, 0xa005, 0x0005, 0x00f6,
9601 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x0026, 0x0126, 0x2091,
9602 0x8000, 0x2740, 0x2061, 0xb400, 0x2079, 0x0001, 0x8fff, 0x0904,
9603 0xa875, 0x2071, 0xad00, 0x7644, 0x7064, 0x8001, 0xa602, 0x1a04,
9604 0xa875, 0x88ff, 0x0128, 0x2800, 0xac06, 0x15b0, 0x2079, 0x0000,
9605 0x080c, 0xa990, 0x0588, 0x2400, 0xac06, 0x0570, 0x671c, 0xa786,
9606 0x0006, 0x1550, 0xa786, 0x0007, 0x0538, 0x88ff, 0x1140, 0x6018,
9607 0xa206, 0x1510, 0x85ff, 0x0118, 0x6050, 0xa106, 0x11e8, 0x00d6,
9608 0x6000, 0xa086, 0x0004, 0x1150, 0x080c, 0xabb4, 0x601f, 0x0007,
9609 0x2001, 0xafa3, 0x2004, 0x6016, 0x080c, 0x190b, 0x6010, 0x2068,
9610 0x080c, 0x9596, 0x0120, 0x0046, 0x080c, 0xa91f, 0x004e, 0x00de,
9611 0x080c, 0x974e, 0x88ff, 0x1198, 0xace0, 0x0018, 0x2001, 0xad16,
9612 0x2004, 0xac02, 0x1210, 0x0804, 0xa826, 0xa006, 0x012e, 0x002e,
9613 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0xa8c5,
9614 0x0001, 0x0ca0, 0x0076, 0x0056, 0x0086, 0x2041, 0x0000, 0x2029,
9615 0x0001, 0x2c20, 0x2019, 0x0002, 0x6218, 0x0096, 0x2049, 0x0000,
9616 0x080c, 0x7b9a, 0x009e, 0x008e, 0x2039, 0x0000, 0x080c, 0x7c34,
9617 0x080c, 0xa817, 0x005e, 0x007e, 0x0005, 0x0026, 0x0046, 0x0056,
9618 0x0076, 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x2009,
9619 0x0000, 0x0016, 0x0036, 0x080c, 0x4cdc, 0x11b0, 0x2c10, 0x0056,
9620 0x0086, 0x2041, 0x0000, 0x2508, 0x2029, 0x0001, 0x0096, 0x2049,
9621 0x0000, 0x080c, 0x7b9a, 0x009e, 0x008e, 0x2039, 0x0000, 0x080c,
9622 0x7c34, 0x080c, 0xa817, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04,
9623 0xa8a9, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x002e, 0x0005,
9624 0x0076, 0x0056, 0x6218, 0x0086, 0x2041, 0x0000, 0x2029, 0x0001,
9625 0x2019, 0x0048, 0x0096, 0x2049, 0x0000, 0x080c, 0x7b9a, 0x009e,
9626 0x008e, 0x2039, 0x0000, 0x080c, 0x7c34, 0x2c20, 0x080c, 0xa817,
9627 0x005e, 0x007e, 0x0005, 0x0026, 0x0046, 0x0056, 0x0076, 0x00c6,
9628 0x0156, 0x2c20, 0x20a9, 0x007f, 0x2009, 0x0000, 0x0016, 0x0036,
9629 0x080c, 0x4cdc, 0x11c0, 0x2c10, 0x0086, 0x2041, 0x0000, 0x2828,
9630 0x0046, 0x2021, 0x0001, 0x080c, 0xab96, 0x004e, 0x0096, 0x2049,
9631 0x0000, 0x080c, 0x7b9a, 0x009e, 0x008e, 0x2039, 0x0000, 0x080c,
9632 0x7c34, 0x080c, 0xa817, 0x003e, 0x001e, 0x8108, 0x1f04, 0xa8f6,
9633 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x002e, 0x0005, 0x0016,
9634 0x00f6, 0x3800, 0xd08c, 0x0130, 0xad82, 0x1000, 0x02b0, 0xad82,
9635 0xad00, 0x0230, 0xad82, 0xe400, 0x0280, 0xad82, 0xffff, 0x1268,
9636 0x6800, 0xa07d, 0x0138, 0x6803, 0x0000, 0x6b52, 0x080c, 0x510c,
9637 0x2f68, 0x0cb0, 0x6b52, 0x080c, 0x510c, 0x00fe, 0x001e, 0x0005,
9638 0x00e6, 0x0046, 0x0036, 0x2061, 0xb400, 0x2071, 0xad00, 0x7444,
9639 0x7064, 0x8001, 0xa402, 0x12d8, 0x2100, 0xac06, 0x0168, 0x6000,
9640 0xa086, 0x0000, 0x0148, 0x6008, 0xa206, 0x1130, 0x6018, 0xa1a0,
9641 0x0006, 0x2424, 0xa406, 0x0140, 0xace0, 0x0018, 0x2001, 0xad16,
9642 0x2004, 0xac02, 0x1220, 0x0c08, 0xa085, 0x0001, 0x0008, 0xa006,
9643 0x003e, 0x004e, 0x00ee, 0x0005, 0x00d6, 0x0006, 0x080c, 0x15d9,
9644 0x000e, 0x090c, 0x14f6, 0x6837, 0x010d, 0x685e, 0x0026, 0x2010,
9645 0x080c, 0x9586, 0x2001, 0x0000, 0x0120, 0x2200, 0xa080, 0x0014,
9646 0x2004, 0x002e, 0x684a, 0x6956, 0x6c46, 0x684f, 0x0000, 0xa006,
9647 0x68b2, 0x6802, 0x683a, 0x685a, 0x080c, 0x510c, 0x00de, 0x0005,
9648 0x6700, 0xa786, 0x0000, 0x0158, 0xa786, 0x0001, 0x0140, 0xa786,
9649 0x000a, 0x0128, 0xa786, 0x0009, 0x0110, 0xa085, 0x0001, 0x0005,
9650 0x00e6, 0x6018, 0x2070, 0x70a0, 0xa206, 0x00ee, 0x0005, 0x0016,
9651 0x6004, 0xa08e, 0x001e, 0x11a0, 0x8007, 0x6130, 0xa18c, 0x00ff,
9652 0xa105, 0x6032, 0x6007, 0x0085, 0x6003, 0x000b, 0x601f, 0x0005,
9653 0x2001, 0xafa4, 0x2004, 0x6016, 0x080c, 0x67a8, 0x080c, 0x6c50,
9654 0x001e, 0x0005, 0xe000, 0xe000, 0x0005, 0x6020, 0xd0e4, 0x0158,
9655 0xd0cc, 0x0118, 0x080c, 0x9866, 0x0030, 0x080c, 0xabb4, 0x080c,
9656 0x6618, 0x080c, 0x8078, 0x0005, 0xa280, 0x0007, 0x2004, 0xa084,
9657 0x000f, 0x0002, 0xa9e3, 0xa9e3, 0xa9e3, 0xa9e8, 0xa9e3, 0xa9e5,
9658 0xa9e5, 0xa9e3, 0xa9e5, 0xa006, 0x0005, 0x00c6, 0x2260, 0x00ce,
9659 0xa085, 0x0001, 0x0005, 0xa280, 0x0007, 0x2004, 0xa084, 0x000f,
9660 0x0002, 0xa9fa, 0xa9fa, 0xa9fa, 0xa9fa, 0xa9fa, 0xa9fa, 0xaa05,
9661 0xa9fa, 0xa9fa, 0x6007, 0x003b, 0x602b, 0x0009, 0x6013, 0x2a00,
9662 0x6003, 0x0001, 0x080c, 0x67a8, 0x0005, 0x00c6, 0x2260, 0x080c,
9663 0xabb4, 0x603f, 0x0000, 0x6020, 0xc0f4, 0xc0cc, 0x6022, 0x6037,
9664 0x0000, 0x00ce, 0x00d6, 0x2268, 0xa186, 0x0007, 0x1904, 0xaa60,
9665 0x6810, 0xa005, 0x0138, 0xa080, 0x0013, 0x2004, 0xd0fc, 0x1110,
9666 0x00de, 0x08c0, 0x6007, 0x003a, 0x6003, 0x0001, 0x080c, 0x67a8,
9667 0x080c, 0x6c50, 0x00c6, 0x2d60, 0x6100, 0xa186, 0x0002, 0x1904,
9668 0xaae7, 0x6010, 0xa005, 0x1138, 0x6000, 0xa086, 0x0007, 0x190c,
9669 0x14f6, 0x0804, 0xaae7, 0xa08c, 0xf000, 0x1130, 0x0028, 0x2068,
9670 0x6800, 0xa005, 0x1de0, 0x2d00, 0xa080, 0x0013, 0x2004, 0xa084,
9671 0x0003, 0xa086, 0x0002, 0x1180, 0x6010, 0x2068, 0x684c, 0xc0dc,
9672 0xc0f4, 0x684e, 0x6850, 0xc0f4, 0xc0fc, 0x6852, 0x2009, 0x0043,
9673 0x080c, 0xa3de, 0x0804, 0xaae7, 0x2009, 0x0041, 0x0804, 0xaae1,
9674 0xa186, 0x0005, 0x15f0, 0x6810, 0xa080, 0x0013, 0x2004, 0xd0bc,
9675 0x1118, 0x00de, 0x0804, 0xa9fa, 0xd0b4, 0x0128, 0xd0fc, 0x090c,
9676 0x14f6, 0x0804, 0xaa18, 0x6007, 0x003a, 0x6003, 0x0001, 0x080c,
9677 0x67a8, 0x080c, 0x6c50, 0x00c6, 0x2d60, 0x6100, 0xa186, 0x0002,
9678 0x0120, 0xa186, 0x0004, 0x1904, 0xaae7, 0x2071, 0xaffd, 0x7000,
9679 0xa086, 0x0003, 0x1128, 0x7004, 0xac06, 0x1110, 0x7003, 0x0000,
9680 0x6810, 0xa080, 0x0013, 0x200c, 0xc1f4, 0xc1dc, 0x2102, 0x8000,
9681 0x200c, 0xc1f4, 0xc1fc, 0xc1bc, 0x2102, 0x2009, 0x0042, 0x0804,
9682 0xaae1, 0x0036, 0x00d6, 0x00d6, 0x080c, 0x15d9, 0x003e, 0x090c,
9683 0x14f6, 0x6837, 0x010d, 0x6803, 0x0000, 0x683b, 0x0000, 0x685b,
9684 0x0000, 0x6b5e, 0x6857, 0x0045, 0x2c00, 0x6862, 0x6034, 0x6872,
9685 0x2360, 0x6020, 0xc0dd, 0x6022, 0x6018, 0xa080, 0x0028, 0x2004,
9686 0xa084, 0x00ff, 0x8007, 0x6350, 0x6b4a, 0x6846, 0x684f, 0x0000,
9687 0x6d6a, 0x6e66, 0x686f, 0x0001, 0x080c, 0x510c, 0x2019, 0x0045,
9688 0x6008, 0x2068, 0x080c, 0xa566, 0x2d00, 0x600a, 0x601f, 0x0006,
9689 0x6003, 0x0007, 0x6017, 0x0000, 0x603f, 0x0000, 0x00de, 0x003e,
9690 0x0038, 0x603f, 0x0000, 0x6003, 0x0007, 0x080c, 0xa3de, 0x00ce,
9691 0x00de, 0x0005, 0xa186, 0x0013, 0x1128, 0x6004, 0xa082, 0x0085,
9692 0x2008, 0x00c2, 0xa186, 0x0027, 0x1178, 0x080c, 0x6b73, 0x0036,
9693 0x00d6, 0x6010, 0x2068, 0x2019, 0x0004, 0x080c, 0xa91f, 0x00de,
9694 0x003e, 0x080c, 0x6c50, 0x0005, 0xa186, 0x0014, 0x0d70, 0x080c,
9695 0x80be, 0x0005, 0xab13, 0xab11, 0xab11, 0xab11, 0xab11, 0xab11,
9696 0xab13, 0x080c, 0x14f6, 0x080c, 0x6b73, 0x6003, 0x000c, 0x080c,
9697 0x6c50, 0x0005, 0xa182, 0x008c, 0x1220, 0xa182, 0x0085, 0x0208,
9698 0x001a, 0x080c, 0x80be, 0x0005, 0xab2b, 0xab2b, 0xab2b, 0xab2b,
9699 0xab2d, 0xab4b, 0xab2b, 0x080c, 0x14f6, 0x00d6, 0x2c68, 0x080c,
9700 0x8022, 0x01a0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0xb28e,
9701 0x210c, 0x6136, 0x2009, 0xb28f, 0x210c, 0x613a, 0x600b, 0xffff,
9702 0x6918, 0x611a, 0x601f, 0x0004, 0x080c, 0x67a8, 0x2d60, 0x080c,
9703 0x8078, 0x00de, 0x0005, 0x080c, 0x8078, 0x0005, 0x00e6, 0x6018,
9704 0x2070, 0x7000, 0xd0ec, 0x00ee, 0x0005, 0x6010, 0xa080, 0x0013,
9705 0x200c, 0xd1ec, 0x05d0, 0x2001, 0xad71, 0x2004, 0xd0ec, 0x05a8,
9706 0x6003, 0x0002, 0x6020, 0xc0e5, 0x6022, 0xd1ac, 0x0180, 0x00f6,
9707 0x2c78, 0x080c, 0x5025, 0x00fe, 0x0150, 0x2001, 0xafa5, 0x2004,
9708 0x603e, 0x2009, 0xad71, 0x210c, 0xd1f4, 0x11e8, 0x0080, 0x2009,
9709 0xad71, 0x210c, 0xd1f4, 0x0128, 0x6020, 0xc0e4, 0x6022, 0xa006,
9710 0x00a0, 0x2001, 0xafa5, 0x200c, 0x8103, 0xa100, 0x603e, 0x6018,
9711 0xa088, 0x002b, 0x2104, 0xa005, 0x0118, 0xa088, 0x0003, 0x0cd0,
9712 0x2c0a, 0x600f, 0x0000, 0xa085, 0x0001, 0x0005, 0x0016, 0x00c6,
9713 0x00e6, 0x6150, 0xa2f0, 0x002b, 0x2e04, 0x2060, 0x8cff, 0x0180,
9714 0x84ff, 0x1118, 0x6050, 0xa106, 0x1138, 0x600c, 0x2072, 0x080c,
9715 0x6618, 0x080c, 0x8078, 0x0010, 0xacf0, 0x0003, 0x2e64, 0x0c70,
9716 0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6, 0x6018, 0xa0e8, 0x002b,
9717 0x2d04, 0xa005, 0x0140, 0xac06, 0x0120, 0x2d04, 0xa0e8, 0x0003,
9718 0x0cb8, 0x600c, 0x206a, 0x00de, 0x0005, 0x0026, 0x0036, 0x0156,
9719 0x2011, 0xad27, 0x2204, 0xa084, 0x00ff, 0x2019, 0xb28e, 0x2334,
9720 0xa636, 0x11d8, 0x8318, 0x2334, 0x2204, 0xa084, 0xff00, 0xa636,
9721 0x11a0, 0x2011, 0xb290, 0x6018, 0xa098, 0x000a, 0x20a9, 0x0004,
9722 0x080c, 0x8a7c, 0x1150, 0x2011, 0xb294, 0x6018, 0xa098, 0x0006,
9723 0x20a9, 0x0004, 0x080c, 0x8a7c, 0x1100, 0x015e, 0x003e, 0x002e,
9724 0x0005, 0x00e6, 0x2071, 0xad00, 0x080c, 0x48f5, 0x080c, 0x28fa,
9725 0x00ee, 0x0005, 0x00e6, 0x6018, 0x2070, 0x7000, 0xd0fc, 0x0108,
9726 0x0011, 0x00ee, 0x0005, 0x6850, 0xc0e5, 0x6852, 0x0005, 0x00e6,
9727 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126,
9728 0x2091, 0x8000, 0x2029, 0xafd0, 0x252c, 0x2021, 0xafd6, 0x2424,
9729 0x2061, 0xb400, 0x2071, 0xad00, 0x7644, 0x7064, 0xa606, 0x0578,
9730 0x671c, 0xa786, 0x0001, 0x0118, 0xa786, 0x0008, 0x1500, 0x2500,
9731 0xac06, 0x01e8, 0x2400, 0xac06, 0x01d0, 0x080c, 0xa990, 0x01b8,
9732 0x080c, 0xa9a0, 0x11a0, 0x6000, 0xa086, 0x0004, 0x1120, 0x0016,
9733 0x080c, 0x190b, 0x001e, 0x080c, 0x9778, 0x1110, 0x080c, 0x2aff,
9734 0x080c, 0x9789, 0x1110, 0x080c, 0x85f3, 0x080c, 0x974e, 0xace0,
9735 0x0018, 0x2001, 0xad16, 0x2004, 0xac02, 0x1208, 0x0858, 0x012e,
9736 0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00ee,
9737 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xad40,
9738 0xd5a4, 0x0118, 0x7034, 0x8000, 0x7036, 0xd5b4, 0x0118, 0x7030,
9739 0x8000, 0x7032, 0xd5ac, 0x0118, 0x2071, 0xad4a, 0x0451, 0x00ee,
9740 0x000e, 0x012e, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000,
9741 0x2071, 0xad40, 0xd5a4, 0x0118, 0x7034, 0x8000, 0x7036, 0xd5b4,
9742 0x0118, 0x7030, 0x8000, 0x7032, 0xd5ac, 0x0118, 0x2071, 0xad4a,
9743 0x0081, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0126, 0x0006, 0x00e6,
9744 0x2091, 0x8000, 0x2071, 0xad42, 0x0021, 0x00ee, 0x000e, 0x012e,
9745 0x0005, 0x2e04, 0x8000, 0x2072, 0x1220, 0x8e70, 0x2e04, 0x8000,
9746 0x2072, 0x0005, 0x00e6, 0x2071, 0xad40, 0x0c99, 0x00ee, 0x0005,
9747 0x00e6, 0x2071, 0xad44, 0x0c69, 0x00ee, 0x0005, 0x0001, 0x0002,
9748 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,
9749 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x8529
9750};
9751
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index fa901fd65085..d5fdcb9a8842 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -378,7 +378,6 @@ static struct scsi_host_template mv_sht = {
378 .name = DRV_NAME, 378 .name = DRV_NAME,
379 .ioctl = ata_scsi_ioctl, 379 .ioctl = ata_scsi_ioctl,
380 .queuecommand = ata_scsi_queuecmd, 380 .queuecommand = ata_scsi_queuecmd,
381 .eh_strategy_handler = ata_scsi_error,
382 .can_queue = MV_USE_Q_DEPTH, 381 .can_queue = MV_USE_Q_DEPTH,
383 .this_id = ATA_SHT_THIS_ID, 382 .this_id = ATA_SHT_THIS_ID,
384 .sg_tablesize = MV_MAX_SG_CT / 2, 383 .sg_tablesize = MV_MAX_SG_CT / 2,
@@ -748,7 +747,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
748 mv_dump_mem(mmio_base+0xf00, 0x4); 747 mv_dump_mem(mmio_base+0xf00, 0x4);
749 mv_dump_mem(mmio_base+0x1d00, 0x6c); 748 mv_dump_mem(mmio_base+0x1d00, 0x6c);
750 for (hc = start_hc; hc < start_hc + num_hcs; hc++) { 749 for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
751 hc_base = mv_hc_base(mmio_base, port >> MV_PORT_HC_SHIFT); 750 hc_base = mv_hc_base(mmio_base, hc);
752 DPRINTK("HC regs (HC %i):\n", hc); 751 DPRINTK("HC regs (HC %i):\n", hc);
753 mv_dump_mem(hc_base, 0x1c); 752 mv_dump_mem(hc_base, 0x1c);
754 } 753 }
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index f77bf183dfab..9f553081b5e8 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -201,7 +201,6 @@ static struct scsi_host_template nv_sht = {
201 .name = DRV_NAME, 201 .name = DRV_NAME,
202 .ioctl = ata_scsi_ioctl, 202 .ioctl = ata_scsi_ioctl,
203 .queuecommand = ata_scsi_queuecmd, 203 .queuecommand = ata_scsi_queuecmd,
204 .eh_strategy_handler = ata_scsi_error,
205 .can_queue = ATA_DEF_QUEUE, 204 .can_queue = ATA_DEF_QUEUE,
206 .this_id = ATA_SHT_THIS_ID, 205 .this_id = ATA_SHT_THIS_ID,
207 .sg_tablesize = LIBATA_MAX_PRD, 206 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index cc928c68a479..7eb67a6bdc64 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -111,7 +111,6 @@ static struct scsi_host_template pdc_ata_sht = {
111 .name = DRV_NAME, 111 .name = DRV_NAME,
112 .ioctl = ata_scsi_ioctl, 112 .ioctl = ata_scsi_ioctl,
113 .queuecommand = ata_scsi_queuecmd, 113 .queuecommand = ata_scsi_queuecmd,
114 .eh_strategy_handler = ata_scsi_error,
115 .can_queue = ATA_DEF_QUEUE, 114 .can_queue = ATA_DEF_QUEUE,
116 .this_id = ATA_SHT_THIS_ID, 115 .this_id = ATA_SHT_THIS_ID,
117 .sg_tablesize = LIBATA_MAX_PRD, 116 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 9ffe1ef0d205..886f3447dd48 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -132,7 +132,6 @@ static struct scsi_host_template qs_ata_sht = {
132 .name = DRV_NAME, 132 .name = DRV_NAME,
133 .ioctl = ata_scsi_ioctl, 133 .ioctl = ata_scsi_ioctl,
134 .queuecommand = ata_scsi_queuecmd, 134 .queuecommand = ata_scsi_queuecmd,
135 .eh_strategy_handler = ata_scsi_error,
136 .can_queue = ATA_DEF_QUEUE, 135 .can_queue = ATA_DEF_QUEUE,
137 .this_id = ATA_SHT_THIS_ID, 136 .this_id = ATA_SHT_THIS_ID,
138 .sg_tablesize = QS_MAX_PRD, 137 .sg_tablesize = QS_MAX_PRD,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 18c296c56899..106627299d55 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -146,7 +146,6 @@ static struct scsi_host_template sil_sht = {
146 .name = DRV_NAME, 146 .name = DRV_NAME,
147 .ioctl = ata_scsi_ioctl, 147 .ioctl = ata_scsi_ioctl,
148 .queuecommand = ata_scsi_queuecmd, 148 .queuecommand = ata_scsi_queuecmd,
149 .eh_strategy_handler = ata_scsi_error,
150 .can_queue = ATA_DEF_QUEUE, 149 .can_queue = ATA_DEF_QUEUE,
151 .this_id = ATA_SHT_THIS_ID, 150 .this_id = ATA_SHT_THIS_ID,
152 .sg_tablesize = LIBATA_MAX_PRD, 151 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 068c98a4111b..f7264fd611c2 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -281,7 +281,6 @@ static struct scsi_host_template sil24_sht = {
281 .name = DRV_NAME, 281 .name = DRV_NAME,
282 .ioctl = ata_scsi_ioctl, 282 .ioctl = ata_scsi_ioctl,
283 .queuecommand = ata_scsi_queuecmd, 283 .queuecommand = ata_scsi_queuecmd,
284 .eh_strategy_handler = ata_scsi_error,
285 .can_queue = ATA_DEF_QUEUE, 284 .can_queue = ATA_DEF_QUEUE,
286 .this_id = ATA_SHT_THIS_ID, 285 .this_id = ATA_SHT_THIS_ID,
287 .sg_tablesize = LIBATA_MAX_PRD, 286 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index acc8439dea23..728530df2e07 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -87,7 +87,6 @@ static struct scsi_host_template sis_sht = {
87 .name = DRV_NAME, 87 .name = DRV_NAME,
88 .ioctl = ata_scsi_ioctl, 88 .ioctl = ata_scsi_ioctl,
89 .queuecommand = ata_scsi_queuecmd, 89 .queuecommand = ata_scsi_queuecmd,
90 .eh_strategy_handler = ata_scsi_error,
91 .can_queue = ATA_DEF_QUEUE, 90 .can_queue = ATA_DEF_QUEUE,
92 .this_id = ATA_SHT_THIS_ID, 91 .this_id = ATA_SHT_THIS_ID,
93 .sg_tablesize = ATA_MAX_PRD, 92 .sg_tablesize = ATA_MAX_PRD,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index 724f0ed6a52d..53b0d5c0a61f 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -290,7 +290,6 @@ static struct scsi_host_template k2_sata_sht = {
290 .name = DRV_NAME, 290 .name = DRV_NAME,
291 .ioctl = ata_scsi_ioctl, 291 .ioctl = ata_scsi_ioctl,
292 .queuecommand = ata_scsi_queuecmd, 292 .queuecommand = ata_scsi_queuecmd,
293 .eh_strategy_handler = ata_scsi_error,
294 .can_queue = ATA_DEF_QUEUE, 293 .can_queue = ATA_DEF_QUEUE,
295 .this_id = ATA_SHT_THIS_ID, 294 .this_id = ATA_SHT_THIS_ID,
296 .sg_tablesize = LIBATA_MAX_PRD, 295 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index ae70f60c7c0d..4139ad4b1df0 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -182,7 +182,6 @@ static struct scsi_host_template pdc_sata_sht = {
182 .name = DRV_NAME, 182 .name = DRV_NAME,
183 .ioctl = ata_scsi_ioctl, 183 .ioctl = ata_scsi_ioctl,
184 .queuecommand = ata_scsi_queuecmd, 184 .queuecommand = ata_scsi_queuecmd,
185 .eh_strategy_handler = ata_scsi_error,
186 .can_queue = ATA_DEF_QUEUE, 185 .can_queue = ATA_DEF_QUEUE,
187 .this_id = ATA_SHT_THIS_ID, 186 .this_id = ATA_SHT_THIS_ID,
188 .sg_tablesize = LIBATA_MAX_PRD, 187 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 7ac5a5f5a905..38b52bd3fa3f 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -81,7 +81,6 @@ static struct scsi_host_template uli_sht = {
81 .name = DRV_NAME, 81 .name = DRV_NAME,
82 .ioctl = ata_scsi_ioctl, 82 .ioctl = ata_scsi_ioctl,
83 .queuecommand = ata_scsi_queuecmd, 83 .queuecommand = ata_scsi_queuecmd,
84 .eh_strategy_handler = ata_scsi_error,
85 .can_queue = ATA_DEF_QUEUE, 84 .can_queue = ATA_DEF_QUEUE,
86 .this_id = ATA_SHT_THIS_ID, 85 .this_id = ATA_SHT_THIS_ID,
87 .sg_tablesize = LIBATA_MAX_PRD, 86 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 791bf652ba63..9e7ae4e0db32 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -94,7 +94,6 @@ static struct scsi_host_template svia_sht = {
94 .name = DRV_NAME, 94 .name = DRV_NAME,
95 .ioctl = ata_scsi_ioctl, 95 .ioctl = ata_scsi_ioctl,
96 .queuecommand = ata_scsi_queuecmd, 96 .queuecommand = ata_scsi_queuecmd,
97 .eh_strategy_handler = ata_scsi_error,
98 .can_queue = ATA_DEF_QUEUE, 97 .can_queue = ATA_DEF_QUEUE,
99 .this_id = ATA_SHT_THIS_ID, 98 .this_id = ATA_SHT_THIS_ID,
100 .sg_tablesize = LIBATA_MAX_PRD, 99 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 836bbbb26ff2..8a29ce340b47 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -263,7 +263,6 @@ static struct scsi_host_template vsc_sata_sht = {
263 .name = DRV_NAME, 263 .name = DRV_NAME,
264 .ioctl = ata_scsi_ioctl, 264 .ioctl = ata_scsi_ioctl,
265 .queuecommand = ata_scsi_queuecmd, 265 .queuecommand = ata_scsi_queuecmd,
266 .eh_strategy_handler = ata_scsi_error,
267 .can_queue = ATA_DEF_QUEUE, 266 .can_queue = ATA_DEF_QUEUE,
268 .this_id = ATA_SHT_THIS_ID, 267 .this_id = ATA_SHT_THIS_ID,
269 .sg_tablesize = LIBATA_MAX_PRD, 268 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 6913b0623167..73994e2ac2cb 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -565,7 +565,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
565 /* 565 /*
566 * If SCSI-2 or lower, store the LUN value in cmnd. 566 * If SCSI-2 or lower, store the LUN value in cmnd.
567 */ 567 */
568 if (cmd->device->scsi_level <= SCSI_2) { 568 if (cmd->device->scsi_level <= SCSI_2 &&
569 cmd->device->scsi_level != SCSI_UNKNOWN) {
569 cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) | 570 cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
570 (cmd->device->lun << 5 & 0xe0); 571 (cmd->device->lun << 5 & 0xe0);
571 } 572 }
@@ -1243,7 +1244,7 @@ static int __init init_scsi(void)
1243 if (error) 1244 if (error)
1244 goto cleanup_sysctl; 1245 goto cleanup_sysctl;
1245 1246
1246 for_each_cpu(i) 1247 for_each_possible_cpu(i)
1247 INIT_LIST_HEAD(&per_cpu(scsi_done_q, i)); 1248 INIT_LIST_HEAD(&per_cpu(scsi_done_q, i));
1248 1249
1249 printk(KERN_NOTICE "SCSI subsystem initialized\n"); 1250 printk(KERN_NOTICE "SCSI subsystem initialized\n");
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 84c3937ae8fb..c750d3399a97 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -132,7 +132,9 @@ static struct {
132 {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */ 132 {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */
133 {"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */ 133 {"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */
134 {"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */ 134 {"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */
135 {"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN}, 135 {"COMPAQ", "ARRAY CONTROLLER", NULL, BLIST_SPARSELUN | BLIST_LARGELUN |
136 BLIST_MAX_512 | BLIST_REPORTLUN2}, /* Compaq RA4x00 */
137 {"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN | BLIST_MAX_512}, /* Compaq RA4x00 */
136 {"COMPAQ", "CR3500", NULL, BLIST_FORCELUN}, 138 {"COMPAQ", "CR3500", NULL, BLIST_FORCELUN},
137 {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, 139 {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
138 {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, 140 {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 5f0fdfb2618c..1c75646f9689 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1537,8 +1537,8 @@ int scsi_error_handler(void *data)
1537 * what we need to do to get it up and online again (if we can). 1537 * what we need to do to get it up and online again (if we can).
1538 * If we fail, we end up taking the thing offline. 1538 * If we fail, we end up taking the thing offline.
1539 */ 1539 */
1540 if (shost->hostt->eh_strategy_handler) 1540 if (shost->transportt->eh_strategy_handler)
1541 shost->hostt->eh_strategy_handler(shost); 1541 shost->transportt->eh_strategy_handler(shost);
1542 else 1542 else
1543 scsi_unjam_host(shost); 1543 scsi_unjam_host(shost);
1544 1544
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 36e930066649..a89aff61d3d8 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -158,180 +158,6 @@ int scsi_set_medium_removal(struct scsi_device *sdev, char state)
158EXPORT_SYMBOL(scsi_set_medium_removal); 158EXPORT_SYMBOL(scsi_set_medium_removal);
159 159
160/* 160/*
161 * This interface is deprecated - users should use the scsi generic (sg)
162 * interface instead, as this is a more flexible approach to performing
163 * generic SCSI commands on a device.
164 *
165 * The structure that we are passed should look like:
166 *
167 * struct sdata {
168 * unsigned int inlen; [i] Length of data to be written to device
169 * unsigned int outlen; [i] Length of data to be read from device
170 * unsigned char cmd[x]; [i] SCSI command (6 <= x <= 12).
171 * [o] Data read from device starts here.
172 * [o] On error, sense buffer starts here.
173 * unsigned char wdata[y]; [i] Data written to device starts here.
174 * };
175 * Notes:
176 * - The SCSI command length is determined by examining the 1st byte
177 * of the given command. There is no way to override this.
178 * - Data transfers are limited to PAGE_SIZE (4K on i386, 8K on alpha).
179 * - The length (x + y) must be at least OMAX_SB_LEN bytes long to
180 * accommodate the sense buffer when an error occurs.
181 * The sense buffer is truncated to OMAX_SB_LEN (16) bytes so that
182 * old code will not be surprised.
183 * - If a Unix error occurs (e.g. ENOMEM) then the user will receive
184 * a negative return and the Unix error code in 'errno'.
185 * If the SCSI command succeeds then 0 is returned.
186 * Positive numbers returned are the compacted SCSI error codes (4
187 * bytes in one int) where the lowest byte is the SCSI status.
188 * See the drivers/scsi/scsi.h file for more information on this.
189 *
190 */
191#define OMAX_SB_LEN 16 /* Old sense buffer length */
192
193int scsi_ioctl_send_command(struct scsi_device *sdev,
194 struct scsi_ioctl_command __user *sic)
195{
196 char *buf;
197 unsigned char cmd[MAX_COMMAND_SIZE];
198 unsigned char sense[SCSI_SENSE_BUFFERSIZE];
199 char __user *cmd_in;
200 unsigned char opcode;
201 unsigned int inlen, outlen, cmdlen;
202 unsigned int needed, buf_needed;
203 int timeout, retries, result;
204 int data_direction;
205 gfp_t gfp_mask = GFP_KERNEL;
206
207 if (!sic)
208 return -EINVAL;
209
210 if (sdev->host->unchecked_isa_dma)
211 gfp_mask |= GFP_DMA;
212
213 /*
214 * Verify that we can read at least this much.
215 */
216 if (!access_ok(VERIFY_READ, sic, sizeof(Scsi_Ioctl_Command)))
217 return -EFAULT;
218
219 if(__get_user(inlen, &sic->inlen))
220 return -EFAULT;
221
222 if(__get_user(outlen, &sic->outlen))
223 return -EFAULT;
224
225 /*
226 * We do not transfer more than MAX_BUF with this interface.
227 * If the user needs to transfer more data than this, they
228 * should use scsi_generics (sg) instead.
229 */
230 if (inlen > MAX_BUF)
231 return -EINVAL;
232 if (outlen > MAX_BUF)
233 return -EINVAL;
234
235 cmd_in = sic->data;
236 if(get_user(opcode, cmd_in))
237 return -EFAULT;
238
239 needed = buf_needed = (inlen > outlen ? inlen : outlen);
240 if (buf_needed) {
241 buf_needed = (buf_needed + 511) & ~511;
242 if (buf_needed > MAX_BUF)
243 buf_needed = MAX_BUF;
244 buf = kzalloc(buf_needed, gfp_mask);
245 if (!buf)
246 return -ENOMEM;
247 if (inlen == 0) {
248 data_direction = DMA_FROM_DEVICE;
249 } else if (outlen == 0 ) {
250 data_direction = DMA_TO_DEVICE;
251 } else {
252 /*
253 * Can this ever happen?
254 */
255 data_direction = DMA_BIDIRECTIONAL;
256 }
257
258 } else {
259 buf = NULL;
260 data_direction = DMA_NONE;
261 }
262
263 /*
264 * Obtain the command from the user's address space.
265 */
266 cmdlen = COMMAND_SIZE(opcode);
267
268 result = -EFAULT;
269
270 if (!access_ok(VERIFY_READ, cmd_in, cmdlen + inlen))
271 goto error;
272
273 if(__copy_from_user(cmd, cmd_in, cmdlen))
274 goto error;
275
276 /*
277 * Obtain the data to be sent to the device (if any).
278 */
279
280 if(inlen && copy_from_user(buf, cmd_in + cmdlen, inlen))
281 goto error;
282
283 switch (opcode) {
284 case SEND_DIAGNOSTIC:
285 case FORMAT_UNIT:
286 timeout = FORMAT_UNIT_TIMEOUT;
287 retries = 1;
288 break;
289 case START_STOP:
290 timeout = START_STOP_TIMEOUT;
291 retries = NORMAL_RETRIES;
292 break;
293 case MOVE_MEDIUM:
294 timeout = MOVE_MEDIUM_TIMEOUT;
295 retries = NORMAL_RETRIES;
296 break;
297 case READ_ELEMENT_STATUS:
298 timeout = READ_ELEMENT_STATUS_TIMEOUT;
299 retries = NORMAL_RETRIES;
300 break;
301 case READ_DEFECT_DATA:
302 timeout = READ_DEFECT_DATA_TIMEOUT;
303 retries = 1;
304 break;
305 default:
306 timeout = IOCTL_NORMAL_TIMEOUT;
307 retries = NORMAL_RETRIES;
308 break;
309 }
310
311 result = scsi_execute(sdev, cmd, data_direction, buf, needed,
312 sense, timeout, retries, 0);
313
314 /*
315 * If there was an error condition, pass the info back to the user.
316 */
317 if (result) {
318 int sb_len = sizeof(*sense);
319
320 sb_len = (sb_len > OMAX_SB_LEN) ? OMAX_SB_LEN : sb_len;
321 if (copy_to_user(cmd_in, sense, sb_len))
322 result = -EFAULT;
323 } else {
324 if (outlen && copy_to_user(cmd_in, buf, outlen))
325 result = -EFAULT;
326 }
327
328error:
329 kfree(buf);
330 return result;
331}
332EXPORT_SYMBOL(scsi_ioctl_send_command);
333
334/*
335 * The scsi_ioctl_get_pci() function places into arg the value 161 * The scsi_ioctl_get_pci() function places into arg the value
336 * pci_dev::slot_name (8 characters) for the PCI device (if any). 162 * pci_dev::slot_name (8 characters) for the PCI device (if any).
337 * Returns: 0 on success 163 * Returns: 0 on success
@@ -409,7 +235,7 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
409 case SCSI_IOCTL_SEND_COMMAND: 235 case SCSI_IOCTL_SEND_COMMAND:
410 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 236 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
411 return -EACCES; 237 return -EACCES;
412 return scsi_ioctl_send_command(sdev, arg); 238 return sg_scsi_ioctl(NULL, sdev->request_queue, NULL, arg);
413 case SCSI_IOCTL_DOORLOCK: 239 case SCSI_IOCTL_DOORLOCK:
414 return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); 240 return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT);
415 case SCSI_IOCTL_DOORUNLOCK: 241 case SCSI_IOCTL_DOORUNLOCK:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8f010a314a3d..7b0f9a3810d2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1479,6 +1479,8 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
1479static void scsi_kill_request(struct request *req, request_queue_t *q) 1479static void scsi_kill_request(struct request *req, request_queue_t *q)
1480{ 1480{
1481 struct scsi_cmnd *cmd = req->special; 1481 struct scsi_cmnd *cmd = req->special;
1482 struct scsi_device *sdev = cmd->device;
1483 struct Scsi_Host *shost = sdev->host;
1482 1484
1483 blkdev_dequeue_request(req); 1485 blkdev_dequeue_request(req);
1484 1486
@@ -1491,6 +1493,19 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
1491 scsi_init_cmd_errh(cmd); 1493 scsi_init_cmd_errh(cmd);
1492 cmd->result = DID_NO_CONNECT << 16; 1494 cmd->result = DID_NO_CONNECT << 16;
1493 atomic_inc(&cmd->device->iorequest_cnt); 1495 atomic_inc(&cmd->device->iorequest_cnt);
1496
1497 /*
1498 * SCSI request completion path will do scsi_device_unbusy(),
1499 * bump busy counts. To bump the counters, we need to dance
1500 * with the locks as normal issue path does.
1501 */
1502 sdev->device_busy++;
1503 spin_unlock(sdev->request_queue->queue_lock);
1504 spin_lock(shost->host_lock);
1505 shost->host_busy++;
1506 spin_unlock(shost->host_lock);
1507 spin_lock(sdev->request_queue->queue_lock);
1508
1494 __scsi_done(cmd); 1509 __scsi_done(cmd);
1495} 1510}
1496 1511
diff --git a/drivers/scsi/scsi_sas_internal.h b/drivers/scsi/scsi_sas_internal.h
new file mode 100644
index 000000000000..d76e6e3d8ca5
--- /dev/null
+++ b/drivers/scsi/scsi_sas_internal.h
@@ -0,0 +1,38 @@
1#ifndef _SCSI_SAS_INTERNAL_H
2#define _SCSI_SAS_INTERNAL_H
3
4#define SAS_HOST_ATTRS 0
5#define SAS_PORT_ATTRS 17
6#define SAS_RPORT_ATTRS 7
7#define SAS_END_DEV_ATTRS 3
8#define SAS_EXPANDER_ATTRS 7
9
10struct sas_internal {
11 struct scsi_transport_template t;
12 struct sas_function_template *f;
13 struct sas_domain_function_template *dft;
14
15 struct class_device_attribute private_host_attrs[SAS_HOST_ATTRS];
16 struct class_device_attribute private_phy_attrs[SAS_PORT_ATTRS];
17 struct class_device_attribute private_rphy_attrs[SAS_RPORT_ATTRS];
18 struct class_device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS];
19 struct class_device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS];
20
21 struct transport_container phy_attr_cont;
22 struct transport_container rphy_attr_cont;
23 struct transport_container end_dev_attr_cont;
24 struct transport_container expander_attr_cont;
25
26 /*
27 * The array of null terminated pointers to attributes
28 * needed by scsi_sysfs.c
29 */
30 struct class_device_attribute *host_attrs[SAS_HOST_ATTRS + 1];
31 struct class_device_attribute *phy_attrs[SAS_PORT_ATTRS + 1];
32 struct class_device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1];
33 struct class_device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1];
34 struct class_device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1];
35};
36#define to_sas_internal(tmpl) container_of(tmpl, struct sas_internal, t)
37
38#endif
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f14945996ede..1a5474bd11a1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -673,6 +673,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
673 case TYPE_MEDIUM_CHANGER: 673 case TYPE_MEDIUM_CHANGER:
674 case TYPE_ENCLOSURE: 674 case TYPE_ENCLOSURE:
675 case TYPE_COMM: 675 case TYPE_COMM:
676 case TYPE_RAID:
676 case TYPE_RBC: 677 case TYPE_RBC:
677 sdev->writeable = 1; 678 sdev->writeable = 1;
678 break; 679 break;
@@ -738,6 +739,13 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
738 sdev->select_no_atn = 1; 739 sdev->select_no_atn = 1;
739 740
740 /* 741 /*
742 * Maximum 512 sector transfer length
743 * broken RA4x00 Compaq Disk Array
744 */
745 if (*bflags & BLIST_MAX_512)
746 blk_queue_max_sectors(sdev->request_queue, 512);
747
748 /*
741 * Some devices may not want to have a start command automatically 749 * Some devices may not want to have a start command automatically
742 * issued when a device is added. 750 * issued when a device is added.
743 */ 751 */
@@ -1123,10 +1131,13 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1123 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does 1131 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
1124 * support more than 8 LUNs. 1132 * support more than 8 LUNs.
1125 */ 1133 */
1126 if ((bflags & BLIST_NOREPORTLUN) || 1134 if (bflags & BLIST_NOREPORTLUN)
1127 starget->scsi_level < SCSI_2 || 1135 return 1;
1128 (starget->scsi_level < SCSI_3 && 1136 if (starget->scsi_level < SCSI_2 &&
1129 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) ) 1137 starget->scsi_level != SCSI_UNKNOWN)
1138 return 1;
1139 if (starget->scsi_level < SCSI_3 &&
1140 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
1130 return 1; 1141 return 1;
1131 if (bflags & BLIST_NOLUN) 1142 if (bflags & BLIST_NOLUN)
1132 return 0; 1143 return 0;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 8db656214b5c..95c5478dcdfd 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -34,6 +34,8 @@
34#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
35#include "scsi_priv.h" 35#include "scsi_priv.h"
36 36
37static int fc_queue_work(struct Scsi_Host *, struct work_struct *);
38
37/* 39/*
38 * Redefine so that we can have same named attributes in the 40 * Redefine so that we can have same named attributes in the
39 * sdev/starget/host objects. 41 * sdev/starget/host objects.
@@ -213,10 +215,8 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names)
213#define FC_MGMTSRVR_PORTID 0x00000a 215#define FC_MGMTSRVR_PORTID 0x00000a
214 216
215 217
216static void fc_shost_remove_rports(void *data);
217static void fc_timeout_deleted_rport(void *data); 218static void fc_timeout_deleted_rport(void *data);
218static void fc_scsi_scan_rport(void *data); 219static void fc_scsi_scan_rport(void *data);
219static void fc_rport_terminate(struct fc_rport *rport);
220 220
221/* 221/*
222 * Attribute counts pre object type... 222 * Attribute counts pre object type...
@@ -288,42 +288,58 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
288 struct class_device *cdev) 288 struct class_device *cdev)
289{ 289{
290 struct Scsi_Host *shost = dev_to_shost(dev); 290 struct Scsi_Host *shost = dev_to_shost(dev);
291 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
291 292
292 /* 293 /*
293 * Set default values easily detected by the midlayer as 294 * Set default values easily detected by the midlayer as
294 * failure cases. The scsi lldd is responsible for initializing 295 * failure cases. The scsi lldd is responsible for initializing
295 * all transport attributes to valid values per host. 296 * all transport attributes to valid values per host.
296 */ 297 */
297 fc_host_node_name(shost) = -1; 298 fc_host->node_name = -1;
298 fc_host_port_name(shost) = -1; 299 fc_host->port_name = -1;
299 fc_host_permanent_port_name(shost) = -1; 300 fc_host->permanent_port_name = -1;
300 fc_host_supported_classes(shost) = FC_COS_UNSPECIFIED; 301 fc_host->supported_classes = FC_COS_UNSPECIFIED;
301 memset(fc_host_supported_fc4s(shost), 0, 302 memset(fc_host->supported_fc4s, 0,
302 sizeof(fc_host_supported_fc4s(shost))); 303 sizeof(fc_host->supported_fc4s));
303 memset(fc_host_symbolic_name(shost), 0, 304 memset(fc_host->symbolic_name, 0,
304 sizeof(fc_host_symbolic_name(shost))); 305 sizeof(fc_host->symbolic_name));
305 fc_host_supported_speeds(shost) = FC_PORTSPEED_UNKNOWN; 306 fc_host->supported_speeds = FC_PORTSPEED_UNKNOWN;
306 fc_host_maxframe_size(shost) = -1; 307 fc_host->maxframe_size = -1;
307 memset(fc_host_serial_number(shost), 0, 308 memset(fc_host->serial_number, 0,
308 sizeof(fc_host_serial_number(shost))); 309 sizeof(fc_host->serial_number));
309 310
310 fc_host_port_id(shost) = -1; 311 fc_host->port_id = -1;
311 fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN; 312 fc_host->port_type = FC_PORTTYPE_UNKNOWN;
312 fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; 313 fc_host->port_state = FC_PORTSTATE_UNKNOWN;
313 memset(fc_host_active_fc4s(shost), 0, 314 memset(fc_host->active_fc4s, 0,
314 sizeof(fc_host_active_fc4s(shost))); 315 sizeof(fc_host->active_fc4s));
315 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 316 fc_host->speed = FC_PORTSPEED_UNKNOWN;
316 fc_host_fabric_name(shost) = -1; 317 fc_host->fabric_name = -1;
317 318
318 fc_host_tgtid_bind_type(shost) = FC_TGTID_BIND_BY_WWPN; 319 fc_host->tgtid_bind_type = FC_TGTID_BIND_BY_WWPN;
319 320
320 INIT_LIST_HEAD(&fc_host_rports(shost)); 321 INIT_LIST_HEAD(&fc_host->rports);
321 INIT_LIST_HEAD(&fc_host_rport_bindings(shost)); 322 INIT_LIST_HEAD(&fc_host->rport_bindings);
322 fc_host_next_rport_number(shost) = 0; 323 fc_host->next_rport_number = 0;
323 fc_host_next_target_id(shost) = 0; 324 fc_host->next_target_id = 0;
324 325
325 fc_host_flags(shost) = 0; 326 snprintf(fc_host->work_q_name, KOBJ_NAME_LEN, "fc_wq_%d",
326 INIT_WORK(&fc_host_rport_del_work(shost), fc_shost_remove_rports, shost); 327 shost->host_no);
328 fc_host->work_q = create_singlethread_workqueue(
329 fc_host->work_q_name);
330 if (!fc_host->work_q)
331 return -ENOMEM;
332
333 snprintf(fc_host->devloss_work_q_name, KOBJ_NAME_LEN, "fc_dl_%d",
334 shost->host_no);
335 fc_host->devloss_work_q = create_singlethread_workqueue(
336 fc_host->devloss_work_q_name);
337 if (!fc_host->devloss_work_q) {
338 destroy_workqueue(fc_host->work_q);
339 fc_host->work_q = NULL;
340 return -ENOMEM;
341 }
342
327 return 0; 343 return 0;
328} 344}
329 345
@@ -879,9 +895,9 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
879 while (!list_empty(&fc_host_rport_bindings(shost))) { 895 while (!list_empty(&fc_host_rport_bindings(shost))) {
880 get_list_head_entry(rport, 896 get_list_head_entry(rport,
881 &fc_host_rport_bindings(shost), peers); 897 &fc_host_rport_bindings(shost), peers);
882 spin_unlock_irqrestore(shost->host_lock, flags); 898 list_del(&rport->peers);
883 fc_rport_terminate(rport); 899 rport->port_state = FC_PORTSTATE_DELETED;
884 spin_lock_irqsave(shost->host_lock, flags); 900 fc_queue_work(shost, &rport->rport_delete_work);
885 } 901 }
886 spin_unlock_irqrestore(shost->host_lock, flags); 902 spin_unlock_irqrestore(shost->host_lock, flags);
887 } 903 }
@@ -1262,6 +1278,90 @@ void fc_release_transport(struct scsi_transport_template *t)
1262} 1278}
1263EXPORT_SYMBOL(fc_release_transport); 1279EXPORT_SYMBOL(fc_release_transport);
1264 1280
1281/**
1282 * fc_queue_work - Queue work to the fc_host workqueue.
1283 * @shost: Pointer to Scsi_Host bound to fc_host.
1284 * @work: Work to queue for execution.
1285 *
1286 * Return value:
1287 * 0 on success / != 0 for error
1288 **/
1289static int
1290fc_queue_work(struct Scsi_Host *shost, struct work_struct *work)
1291{
1292 if (unlikely(!fc_host_work_q(shost))) {
1293 printk(KERN_ERR
1294 "ERROR: FC host '%s' attempted to queue work, "
1295 "when no workqueue created.\n", shost->hostt->name);
1296 dump_stack();
1297
1298 return -EINVAL;
1299 }
1300
1301 return queue_work(fc_host_work_q(shost), work);
1302}
1303
1304/**
1305 * fc_flush_work - Flush a fc_host's workqueue.
1306 * @shost: Pointer to Scsi_Host bound to fc_host.
1307 **/
1308static void
1309fc_flush_work(struct Scsi_Host *shost)
1310{
1311 if (!fc_host_work_q(shost)) {
1312 printk(KERN_ERR
1313 "ERROR: FC host '%s' attempted to flush work, "
1314 "when no workqueue created.\n", shost->hostt->name);
1315 dump_stack();
1316 return;
1317 }
1318
1319 flush_workqueue(fc_host_work_q(shost));
1320}
1321
1322/**
1323 * fc_queue_devloss_work - Schedule work for the fc_host devloss workqueue.
1324 * @shost: Pointer to Scsi_Host bound to fc_host.
1325 * @work: Work to queue for execution.
1326 * @delay: jiffies to delay the work queuing
1327 *
1328 * Return value:
1329 * 0 on success / != 0 for error
1330 **/
1331static int
1332fc_queue_devloss_work(struct Scsi_Host *shost, struct work_struct *work,
1333 unsigned long delay)
1334{
1335 if (unlikely(!fc_host_devloss_work_q(shost))) {
1336 printk(KERN_ERR
1337 "ERROR: FC host '%s' attempted to queue work, "
1338 "when no workqueue created.\n", shost->hostt->name);
1339 dump_stack();
1340
1341 return -EINVAL;
1342 }
1343
1344 return queue_delayed_work(fc_host_devloss_work_q(shost), work, delay);
1345}
1346
1347/**
1348 * fc_flush_devloss - Flush a fc_host's devloss workqueue.
1349 * @shost: Pointer to Scsi_Host bound to fc_host.
1350 **/
1351static void
1352fc_flush_devloss(struct Scsi_Host *shost)
1353{
1354 if (!fc_host_devloss_work_q(shost)) {
1355 printk(KERN_ERR
1356 "ERROR: FC host '%s' attempted to flush work, "
1357 "when no workqueue created.\n", shost->hostt->name);
1358 dump_stack();
1359 return;
1360 }
1361
1362 flush_workqueue(fc_host_devloss_work_q(shost));
1363}
1364
1265 1365
1266/** 1366/**
1267 * fc_remove_host - called to terminate any fc_transport-related elements 1367 * fc_remove_host - called to terminate any fc_transport-related elements
@@ -1283,36 +1383,103 @@ void
1283fc_remove_host(struct Scsi_Host *shost) 1383fc_remove_host(struct Scsi_Host *shost)
1284{ 1384{
1285 struct fc_rport *rport, *next_rport; 1385 struct fc_rport *rport, *next_rport;
1386 struct workqueue_struct *work_q;
1387 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1286 1388
1287 /* Remove any remote ports */ 1389 /* Remove any remote ports */
1288 list_for_each_entry_safe(rport, next_rport, 1390 list_for_each_entry_safe(rport, next_rport,
1289 &fc_host_rports(shost), peers) 1391 &fc_host->rports, peers) {
1290 fc_rport_terminate(rport); 1392 list_del(&rport->peers);
1393 rport->port_state = FC_PORTSTATE_DELETED;
1394 fc_queue_work(shost, &rport->rport_delete_work);
1395 }
1396
1291 list_for_each_entry_safe(rport, next_rport, 1397 list_for_each_entry_safe(rport, next_rport,
1292 &fc_host_rport_bindings(shost), peers) 1398 &fc_host->rport_bindings, peers) {
1293 fc_rport_terminate(rport); 1399 list_del(&rport->peers);
1400 rport->port_state = FC_PORTSTATE_DELETED;
1401 fc_queue_work(shost, &rport->rport_delete_work);
1402 }
1403
1404 /* flush all scan work items */
1405 scsi_flush_work(shost);
1406
1407 /* flush all stgt delete, and rport delete work items, then kill it */
1408 if (fc_host->work_q) {
1409 work_q = fc_host->work_q;
1410 fc_host->work_q = NULL;
1411 destroy_workqueue(work_q);
1412 }
1413
1414 /* flush all devloss work items, then kill it */
1415 if (fc_host->devloss_work_q) {
1416 work_q = fc_host->devloss_work_q;
1417 fc_host->devloss_work_q = NULL;
1418 destroy_workqueue(work_q);
1419 }
1294} 1420}
1295EXPORT_SYMBOL(fc_remove_host); 1421EXPORT_SYMBOL(fc_remove_host);
1296 1422
1297/* 1423
1298 * fc_rport_tgt_remove - Removes the scsi target on the remote port 1424/**
1299 * @rport: The remote port to be operated on 1425 * fc_starget_delete - called to delete the scsi decendents of an rport
1300 */ 1426 * (target and all sdevs)
1427 *
1428 * @data: remote port to be operated on.
1429 **/
1301static void 1430static void
1302fc_rport_tgt_remove(struct fc_rport *rport) 1431fc_starget_delete(void *data)
1303{ 1432{
1433 struct fc_rport *rport = (struct fc_rport *)data;
1304 struct Scsi_Host *shost = rport_to_shost(rport); 1434 struct Scsi_Host *shost = rport_to_shost(rport);
1435 unsigned long flags;
1305 1436
1306 scsi_target_unblock(&rport->dev); 1437 scsi_target_unblock(&rport->dev);
1307 1438
1308 /* Stop anything on the workq */ 1439 spin_lock_irqsave(shost->host_lock, flags);
1309 if (!cancel_delayed_work(&rport->dev_loss_work)) 1440 if (rport->flags & FC_RPORT_DEVLOSS_PENDING) {
1310 flush_scheduled_work(); 1441 spin_unlock_irqrestore(shost->host_lock, flags);
1311 scsi_flush_work(shost); 1442 if (!cancel_delayed_work(&rport->dev_loss_work))
1443 fc_flush_devloss(shost);
1444 spin_lock_irqsave(shost->host_lock, flags);
1445 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
1446 }
1447 spin_unlock_irqrestore(shost->host_lock, flags);
1312 1448
1313 scsi_remove_target(&rport->dev); 1449 scsi_remove_target(&rport->dev);
1314} 1450}
1315 1451
1452
1453/**
1454 * fc_rport_final_delete - finish rport termination and delete it.
1455 *
1456 * @data: remote port to be deleted.
1457 **/
1458static void
1459fc_rport_final_delete(void *data)
1460{
1461 struct fc_rport *rport = (struct fc_rport *)data;
1462 struct device *dev = &rport->dev;
1463 struct Scsi_Host *shost = rport_to_shost(rport);
1464
1465 /* Delete SCSI target and sdevs */
1466 if (rport->scsi_target_id != -1)
1467 fc_starget_delete(data);
1468
1469 /*
1470 * if a scan is pending, flush the SCSI Host work_q so that
1471 * that we can reclaim the rport scan work element.
1472 */
1473 if (rport->flags & FC_RPORT_SCAN_PENDING)
1474 scsi_flush_work(shost);
1475
1476 transport_remove_device(dev);
1477 device_del(dev);
1478 transport_destroy_device(dev);
1479 put_device(&shost->shost_gendev);
1480}
1481
1482
1316/** 1483/**
1317 * fc_rport_create - allocates and creates a remote FC port. 1484 * fc_rport_create - allocates and creates a remote FC port.
1318 * @shost: scsi host the remote port is connected to. 1485 * @shost: scsi host the remote port is connected to.
@@ -1330,8 +1497,7 @@ struct fc_rport *
1330fc_rport_create(struct Scsi_Host *shost, int channel, 1497fc_rport_create(struct Scsi_Host *shost, int channel,
1331 struct fc_rport_identifiers *ids) 1498 struct fc_rport_identifiers *ids)
1332{ 1499{
1333 struct fc_host_attrs *fc_host = 1500 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1334 (struct fc_host_attrs *)shost->shost_data;
1335 struct fc_internal *fci = to_fc_internal(shost->transportt); 1501 struct fc_internal *fci = to_fc_internal(shost->transportt);
1336 struct fc_rport *rport; 1502 struct fc_rport *rport;
1337 struct device *dev; 1503 struct device *dev;
@@ -1360,6 +1526,8 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
1360 1526
1361 INIT_WORK(&rport->dev_loss_work, fc_timeout_deleted_rport, rport); 1527 INIT_WORK(&rport->dev_loss_work, fc_timeout_deleted_rport, rport);
1362 INIT_WORK(&rport->scan_work, fc_scsi_scan_rport, rport); 1528 INIT_WORK(&rport->scan_work, fc_scsi_scan_rport, rport);
1529 INIT_WORK(&rport->stgt_delete_work, fc_starget_delete, rport);
1530 INIT_WORK(&rport->rport_delete_work, fc_rport_final_delete, rport);
1363 1531
1364 spin_lock_irqsave(shost->host_lock, flags); 1532 spin_lock_irqsave(shost->host_lock, flags);
1365 1533
@@ -1368,7 +1536,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
1368 rport->scsi_target_id = fc_host->next_target_id++; 1536 rport->scsi_target_id = fc_host->next_target_id++;
1369 else 1537 else
1370 rport->scsi_target_id = -1; 1538 rport->scsi_target_id = -1;
1371 list_add_tail(&rport->peers, &fc_host_rports(shost)); 1539 list_add_tail(&rport->peers, &fc_host->rports);
1372 get_device(&shost->shost_gendev); 1540 get_device(&shost->shost_gendev);
1373 1541
1374 spin_unlock_irqrestore(shost->host_lock, flags); 1542 spin_unlock_irqrestore(shost->host_lock, flags);
@@ -1389,9 +1557,11 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
1389 transport_add_device(dev); 1557 transport_add_device(dev);
1390 transport_configure_device(dev); 1558 transport_configure_device(dev);
1391 1559
1392 if (rport->roles & FC_RPORT_ROLE_FCP_TARGET) 1560 if (rport->roles & FC_RPORT_ROLE_FCP_TARGET) {
1393 /* initiate a scan of the target */ 1561 /* initiate a scan of the target */
1562 rport->flags |= FC_RPORT_SCAN_PENDING;
1394 scsi_queue_work(shost, &rport->scan_work); 1563 scsi_queue_work(shost, &rport->scan_work);
1564 }
1395 1565
1396 return rport; 1566 return rport;
1397 1567
@@ -1451,10 +1621,14 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1451 struct fc_rport_identifiers *ids) 1621 struct fc_rport_identifiers *ids)
1452{ 1622{
1453 struct fc_internal *fci = to_fc_internal(shost->transportt); 1623 struct fc_internal *fci = to_fc_internal(shost->transportt);
1624 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1454 struct fc_rport *rport; 1625 struct fc_rport *rport;
1455 unsigned long flags; 1626 unsigned long flags;
1456 int match = 0; 1627 int match = 0;
1457 1628
1629 /* ensure any stgt delete functions are done */
1630 fc_flush_work(shost);
1631
1458 /* 1632 /*
1459 * Search the list of "active" rports, for an rport that has been 1633 * Search the list of "active" rports, for an rport that has been
1460 * deleted, but we've held off the real delete while the target 1634 * deleted, but we've held off the real delete while the target
@@ -1462,12 +1636,12 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1462 */ 1636 */
1463 spin_lock_irqsave(shost->host_lock, flags); 1637 spin_lock_irqsave(shost->host_lock, flags);
1464 1638
1465 list_for_each_entry(rport, &fc_host_rports(shost), peers) { 1639 list_for_each_entry(rport, &fc_host->rports, peers) {
1466 1640
1467 if ((rport->port_state == FC_PORTSTATE_BLOCKED) && 1641 if ((rport->port_state == FC_PORTSTATE_BLOCKED) &&
1468 (rport->channel == channel)) { 1642 (rport->channel == channel)) {
1469 1643
1470 switch (fc_host_tgtid_bind_type(shost)) { 1644 switch (fc_host->tgtid_bind_type) {
1471 case FC_TGTID_BIND_BY_WWPN: 1645 case FC_TGTID_BIND_BY_WWPN:
1472 case FC_TGTID_BIND_NONE: 1646 case FC_TGTID_BIND_NONE:
1473 if (rport->port_name == ids->port_name) 1647 if (rport->port_name == ids->port_name)
@@ -1521,27 +1695,34 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1521 * transaction. 1695 * transaction.
1522 */ 1696 */
1523 if (!cancel_delayed_work(work)) 1697 if (!cancel_delayed_work(work))
1524 flush_scheduled_work(); 1698 fc_flush_devloss(shost);
1699
1700 spin_lock_irqsave(shost->host_lock, flags);
1701
1702 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
1525 1703
1526 /* initiate a scan of the target */ 1704 /* initiate a scan of the target */
1705 rport->flags |= FC_RPORT_SCAN_PENDING;
1527 scsi_queue_work(shost, &rport->scan_work); 1706 scsi_queue_work(shost, &rport->scan_work);
1528 1707
1708 spin_unlock_irqrestore(shost->host_lock, flags);
1709
1529 return rport; 1710 return rport;
1530 } 1711 }
1531 } 1712 }
1532 } 1713 }
1533 1714
1534 /* Search the bindings array */ 1715 /* Search the bindings array */
1535 if (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE) { 1716 if (fc_host->tgtid_bind_type != FC_TGTID_BIND_NONE) {
1536 1717
1537 /* search for a matching consistent binding */ 1718 /* search for a matching consistent binding */
1538 1719
1539 list_for_each_entry(rport, &fc_host_rport_bindings(shost), 1720 list_for_each_entry(rport, &fc_host->rport_bindings,
1540 peers) { 1721 peers) {
1541 if (rport->channel != channel) 1722 if (rport->channel != channel)
1542 continue; 1723 continue;
1543 1724
1544 switch (fc_host_tgtid_bind_type(shost)) { 1725 switch (fc_host->tgtid_bind_type) {
1545 case FC_TGTID_BIND_BY_WWPN: 1726 case FC_TGTID_BIND_BY_WWPN:
1546 if (rport->port_name == ids->port_name) 1727 if (rport->port_name == ids->port_name)
1547 match = 1; 1728 match = 1;
@@ -1559,8 +1740,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1559 } 1740 }
1560 1741
1561 if (match) { 1742 if (match) {
1562 list_move_tail(&rport->peers, 1743 list_move_tail(&rport->peers, &fc_host->rports);
1563 &fc_host_rports(shost));
1564 break; 1744 break;
1565 } 1745 }
1566 } 1746 }
@@ -1574,15 +1754,17 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1574 rport->roles = ids->roles; 1754 rport->roles = ids->roles;
1575 rport->port_state = FC_PORTSTATE_ONLINE; 1755 rport->port_state = FC_PORTSTATE_ONLINE;
1576 1756
1577 spin_unlock_irqrestore(shost->host_lock, flags);
1578
1579 if (fci->f->dd_fcrport_size) 1757 if (fci->f->dd_fcrport_size)
1580 memset(rport->dd_data, 0, 1758 memset(rport->dd_data, 0,
1581 fci->f->dd_fcrport_size); 1759 fci->f->dd_fcrport_size);
1582 1760
1583 if (rport->roles & FC_RPORT_ROLE_FCP_TARGET) 1761 if (rport->roles & FC_RPORT_ROLE_FCP_TARGET) {
1584 /* initiate a scan of the target */ 1762 /* initiate a scan of the target */
1763 rport->flags |= FC_RPORT_SCAN_PENDING;
1585 scsi_queue_work(shost, &rport->scan_work); 1764 scsi_queue_work(shost, &rport->scan_work);
1765 }
1766
1767 spin_unlock_irqrestore(shost->host_lock, flags);
1586 1768
1587 return rport; 1769 return rport;
1588 } 1770 }
@@ -1597,30 +1779,6 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1597} 1779}
1598EXPORT_SYMBOL(fc_remote_port_add); 1780EXPORT_SYMBOL(fc_remote_port_add);
1599 1781
1600/*
1601 * fc_rport_terminate - this routine tears down and deallocates a remote port.
1602 * @rport: The remote port to be terminated
1603 *
1604 * Notes:
1605 * This routine assumes no locks are held on entry.
1606 */
1607static void
1608fc_rport_terminate(struct fc_rport *rport)
1609{
1610 struct Scsi_Host *shost = rport_to_shost(rport);
1611 struct device *dev = &rport->dev;
1612 unsigned long flags;
1613
1614 fc_rport_tgt_remove(rport);
1615
1616 transport_remove_device(dev);
1617 device_del(dev);
1618 transport_destroy_device(dev);
1619 spin_lock_irqsave(shost->host_lock, flags);
1620 list_del(&rport->peers);
1621 spin_unlock_irqrestore(shost->host_lock, flags);
1622 put_device(&shost->shost_gendev);
1623}
1624 1782
1625/** 1783/**
1626 * fc_remote_port_delete - notifies the fc transport that a remote 1784 * fc_remote_port_delete - notifies the fc transport that a remote
@@ -1675,20 +1833,39 @@ fc_rport_terminate(struct fc_rport *rport)
1675void 1833void
1676fc_remote_port_delete(struct fc_rport *rport) 1834fc_remote_port_delete(struct fc_rport *rport)
1677{ 1835{
1836 struct Scsi_Host *shost = rport_to_shost(rport);
1678 int timeout = rport->dev_loss_tmo; 1837 int timeout = rport->dev_loss_tmo;
1838 unsigned long flags;
1839
1840 /*
1841 * No need to flush the fc_host work_q's, as all adds are synchronous.
1842 *
1843 * We do need to reclaim the rport scan work element, so eventually
1844 * (in fc_rport_final_delete()) we'll flush the scsi host work_q if
1845 * there's still a scan pending.
1846 */
1847
1848 spin_lock_irqsave(shost->host_lock, flags);
1679 1849
1680 /* If no scsi target id mapping, delete it */ 1850 /* If no scsi target id mapping, delete it */
1681 if (rport->scsi_target_id == -1) { 1851 if (rport->scsi_target_id == -1) {
1682 fc_rport_terminate(rport); 1852 list_del(&rport->peers);
1853 rport->port_state = FC_PORTSTATE_DELETED;
1854 fc_queue_work(shost, &rport->rport_delete_work);
1855 spin_unlock_irqrestore(shost->host_lock, flags);
1683 return; 1856 return;
1684 } 1857 }
1685 1858
1859 rport->port_state = FC_PORTSTATE_BLOCKED;
1860
1861 rport->flags |= FC_RPORT_DEVLOSS_PENDING;
1862
1863 spin_unlock_irqrestore(shost->host_lock, flags);
1864
1686 scsi_target_block(&rport->dev); 1865 scsi_target_block(&rport->dev);
1687 1866
1688 /* cap the length the devices can be blocked until they are deleted */ 1867 /* cap the length the devices can be blocked until they are deleted */
1689 schedule_delayed_work(&rport->dev_loss_work, timeout * HZ); 1868 fc_queue_devloss_work(shost, &rport->dev_loss_work, timeout * HZ);
1690
1691 rport->port_state = FC_PORTSTATE_BLOCKED;
1692} 1869}
1693EXPORT_SYMBOL(fc_remote_port_delete); 1870EXPORT_SYMBOL(fc_remote_port_delete);
1694 1871
@@ -1716,8 +1893,7 @@ void
1716fc_remote_port_rolechg(struct fc_rport *rport, u32 roles) 1893fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
1717{ 1894{
1718 struct Scsi_Host *shost = rport_to_shost(rport); 1895 struct Scsi_Host *shost = rport_to_shost(rport);
1719 struct fc_host_attrs *fc_host = 1896 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1720 (struct fc_host_attrs *)shost->shost_data;
1721 unsigned long flags; 1897 unsigned long flags;
1722 int create = 0; 1898 int create = 0;
1723 1899
@@ -1729,10 +1905,11 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
1729 } else if (!(rport->roles & FC_RPORT_ROLE_FCP_TARGET)) 1905 } else if (!(rport->roles & FC_RPORT_ROLE_FCP_TARGET))
1730 create = 1; 1906 create = 1;
1731 } 1907 }
1732 spin_unlock_irqrestore(shost->host_lock, flags);
1733 1908
1734 rport->roles = roles; 1909 rport->roles = roles;
1735 1910
1911 spin_unlock_irqrestore(shost->host_lock, flags);
1912
1736 if (create) { 1913 if (create) {
1737 /* 1914 /*
1738 * There may have been a delete timer running on the 1915 * There may have been a delete timer running on the
@@ -1747,10 +1924,20 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
1747 * transaction. 1924 * transaction.
1748 */ 1925 */
1749 if (!cancel_delayed_work(&rport->dev_loss_work)) 1926 if (!cancel_delayed_work(&rport->dev_loss_work))
1750 flush_scheduled_work(); 1927 fc_flush_devloss(shost);
1928
1929 spin_lock_irqsave(shost->host_lock, flags);
1930 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
1931 spin_unlock_irqrestore(shost->host_lock, flags);
1932
1933 /* ensure any stgt delete functions are done */
1934 fc_flush_work(shost);
1751 1935
1752 /* initiate a scan of the target */ 1936 /* initiate a scan of the target */
1937 spin_lock_irqsave(shost->host_lock, flags);
1938 rport->flags |= FC_RPORT_SCAN_PENDING;
1753 scsi_queue_work(shost, &rport->scan_work); 1939 scsi_queue_work(shost, &rport->scan_work);
1940 spin_unlock_irqrestore(shost->host_lock, flags);
1754 } 1941 }
1755} 1942}
1756EXPORT_SYMBOL(fc_remote_port_rolechg); 1943EXPORT_SYMBOL(fc_remote_port_rolechg);
@@ -1767,22 +1954,24 @@ fc_timeout_deleted_rport(void *data)
1767{ 1954{
1768 struct fc_rport *rport = (struct fc_rport *)data; 1955 struct fc_rport *rport = (struct fc_rport *)data;
1769 struct Scsi_Host *shost = rport_to_shost(rport); 1956 struct Scsi_Host *shost = rport_to_shost(rport);
1957 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1770 unsigned long flags; 1958 unsigned long flags;
1771 1959
1772 spin_lock_irqsave(shost->host_lock, flags); 1960 spin_lock_irqsave(shost->host_lock, flags);
1773 1961
1962 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
1963
1774 /* 1964 /*
1775 * If the port is ONLINE, then it came back, but was no longer an 1965 * If the port is ONLINE, then it came back. Validate it's still an
1776 * FCP target. Thus we need to tear down the scsi_target on it. 1966 * FCP target. If not, tear down the scsi_target on it.
1777 */ 1967 */
1778 if (rport->port_state == FC_PORTSTATE_ONLINE) { 1968 if ((rport->port_state == FC_PORTSTATE_ONLINE) &&
1779 spin_unlock_irqrestore(shost->host_lock, flags); 1969 !(rport->roles & FC_RPORT_ROLE_FCP_TARGET)) {
1780
1781 dev_printk(KERN_ERR, &rport->dev, 1970 dev_printk(KERN_ERR, &rport->dev,
1782 "blocked FC remote port time out: removing target\n"); 1971 "blocked FC remote port time out: no longer"
1783 1972 " a FCP target, removing starget\n");
1784 fc_rport_tgt_remove(rport); 1973 fc_queue_work(shost, &rport->stgt_delete_work);
1785 1974 spin_unlock_irqrestore(shost->host_lock, flags);
1786 return; 1975 return;
1787 } 1976 }
1788 1977
@@ -1793,11 +1982,13 @@ fc_timeout_deleted_rport(void *data)
1793 return; 1982 return;
1794 } 1983 }
1795 1984
1796 if (fc_host_tgtid_bind_type(shost) == FC_TGTID_BIND_NONE) { 1985 if (fc_host->tgtid_bind_type == FC_TGTID_BIND_NONE) {
1797 spin_unlock_irqrestore(shost->host_lock, flags); 1986 list_del(&rport->peers);
1987 rport->port_state = FC_PORTSTATE_DELETED;
1798 dev_printk(KERN_ERR, &rport->dev, 1988 dev_printk(KERN_ERR, &rport->dev,
1799 "blocked FC remote port time out: removing target\n"); 1989 "blocked FC remote port time out: removing target\n");
1800 fc_rport_terminate(rport); 1990 fc_queue_work(shost, &rport->rport_delete_work);
1991 spin_unlock_irqrestore(shost->host_lock, flags);
1801 return; 1992 return;
1802 } 1993 }
1803 1994
@@ -1805,7 +1996,7 @@ fc_timeout_deleted_rport(void *data)
1805 "blocked FC remote port time out: removing target and " 1996 "blocked FC remote port time out: removing target and "
1806 "saving binding\n"); 1997 "saving binding\n");
1807 1998
1808 list_move_tail(&rport->peers, &fc_host_rport_bindings(shost)); 1999 list_move_tail(&rport->peers, &fc_host->rport_bindings);
1809 2000
1810 /* 2001 /*
1811 * Note: We do not remove or clear the hostdata area. This allows 2002 * Note: We do not remove or clear the hostdata area. This allows
@@ -1819,10 +2010,10 @@ fc_timeout_deleted_rport(void *data)
1819 rport->maxframe_size = -1; 2010 rport->maxframe_size = -1;
1820 rport->supported_classes = FC_COS_UNSPECIFIED; 2011 rport->supported_classes = FC_COS_UNSPECIFIED;
1821 rport->roles = FC_RPORT_ROLE_UNKNOWN; 2012 rport->roles = FC_RPORT_ROLE_UNKNOWN;
1822 rport->port_state = FC_PORTSTATE_DELETED; 2013 rport->port_state = FC_PORTSTATE_NOTPRESENT;
1823 2014
1824 /* remove the identifiers that aren't used in the consisting binding */ 2015 /* remove the identifiers that aren't used in the consisting binding */
1825 switch (fc_host_tgtid_bind_type(shost)) { 2016 switch (fc_host->tgtid_bind_type) {
1826 case FC_TGTID_BIND_BY_WWPN: 2017 case FC_TGTID_BIND_BY_WWPN:
1827 rport->node_name = -1; 2018 rport->node_name = -1;
1828 rport->port_id = -1; 2019 rport->port_id = -1;
@@ -1843,17 +2034,8 @@ fc_timeout_deleted_rport(void *data)
1843 * As this only occurs if the remote port (scsi target) 2034 * As this only occurs if the remote port (scsi target)
1844 * went away and didn't come back - we'll remove 2035 * went away and didn't come back - we'll remove
1845 * all attached scsi devices. 2036 * all attached scsi devices.
1846 *
1847 * We'll schedule the shost work item to perform the actual removal
1848 * to avoid recursion in the different flush calls if we perform
1849 * the removal in each target - and there are lots of targets
1850 * whose timeouts fire at the same time.
1851 */ 2037 */
1852 2038 fc_queue_work(shost, &rport->stgt_delete_work);
1853 if ( !(fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED)) {
1854 fc_host_flags(shost) |= FC_SHOST_RPORT_DEL_SCHEDULED;
1855 scsi_queue_work(shost, &fc_host_rport_del_work(shost));
1856 }
1857 2039
1858 spin_unlock_irqrestore(shost->host_lock, flags); 2040 spin_unlock_irqrestore(shost->host_lock, flags);
1859} 2041}
@@ -1870,44 +2052,18 @@ static void
1870fc_scsi_scan_rport(void *data) 2052fc_scsi_scan_rport(void *data)
1871{ 2053{
1872 struct fc_rport *rport = (struct fc_rport *)data; 2054 struct fc_rport *rport = (struct fc_rport *)data;
1873 2055 struct Scsi_Host *shost = rport_to_shost(rport);
1874 scsi_target_unblock(&rport->dev);
1875 scsi_scan_target(&rport->dev, rport->channel, rport->scsi_target_id,
1876 SCAN_WILD_CARD, 1);
1877}
1878
1879
1880/**
1881 * fc_shost_remove_rports - called to remove all rports that are marked
1882 * as in a deleted (not connected) state.
1883 *
1884 * @data: shost whose rports are to be looked at
1885 **/
1886static void
1887fc_shost_remove_rports(void *data)
1888{
1889 struct Scsi_Host *shost = (struct Scsi_Host *)data;
1890 struct fc_rport *rport, *next_rport;
1891 unsigned long flags; 2056 unsigned long flags;
1892 2057
1893 spin_lock_irqsave(shost->host_lock, flags); 2058 if ((rport->port_state == FC_PORTSTATE_ONLINE) &&
1894 while (fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED) { 2059 (rport->roles & FC_RPORT_ROLE_FCP_TARGET)) {
1895 2060 scsi_target_unblock(&rport->dev);
1896 fc_host_flags(shost) &= ~FC_SHOST_RPORT_DEL_SCHEDULED; 2061 scsi_scan_target(&rport->dev, rport->channel,
1897 2062 rport->scsi_target_id, SCAN_WILD_CARD, 1);
1898restart_search:
1899 list_for_each_entry_safe(rport, next_rport,
1900 &fc_host_rport_bindings(shost), peers) {
1901 if (rport->port_state == FC_PORTSTATE_DELETED) {
1902 rport->port_state = FC_PORTSTATE_NOTPRESENT;
1903 spin_unlock_irqrestore(shost->host_lock, flags);
1904 fc_rport_tgt_remove(rport);
1905 spin_lock_irqsave(shost->host_lock, flags);
1906 goto restart_search;
1907 }
1908 }
1909
1910 } 2063 }
2064
2065 spin_lock_irqsave(shost->host_lock, flags);
2066 rport->flags &= ~FC_RPORT_SCAN_PENDING;
1911 spin_unlock_irqrestore(shost->host_lock, flags); 2067 spin_unlock_irqrestore(shost->host_lock, flags);
1912} 2068}
1913 2069
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 134c44c8538a..8b6d65e21bae 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -35,40 +35,7 @@
35#include <scsi/scsi_transport.h> 35#include <scsi/scsi_transport.h>
36#include <scsi/scsi_transport_sas.h> 36#include <scsi/scsi_transport_sas.h>
37 37
38 38#include "scsi_sas_internal.h"
39#define SAS_HOST_ATTRS 0
40#define SAS_PORT_ATTRS 17
41#define SAS_RPORT_ATTRS 7
42#define SAS_END_DEV_ATTRS 3
43#define SAS_EXPANDER_ATTRS 7
44
45struct sas_internal {
46 struct scsi_transport_template t;
47 struct sas_function_template *f;
48
49 struct class_device_attribute private_host_attrs[SAS_HOST_ATTRS];
50 struct class_device_attribute private_phy_attrs[SAS_PORT_ATTRS];
51 struct class_device_attribute private_rphy_attrs[SAS_RPORT_ATTRS];
52 struct class_device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS];
53 struct class_device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS];
54
55 struct transport_container phy_attr_cont;
56 struct transport_container rphy_attr_cont;
57 struct transport_container end_dev_attr_cont;
58 struct transport_container expander_attr_cont;
59
60 /*
61 * The array of null terminated pointers to attributes
62 * needed by scsi_sysfs.c
63 */
64 struct class_device_attribute *host_attrs[SAS_HOST_ATTRS + 1];
65 struct class_device_attribute *phy_attrs[SAS_PORT_ATTRS + 1];
66 struct class_device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1];
67 struct class_device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1];
68 struct class_device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1];
69};
70#define to_sas_internal(tmpl) container_of(tmpl, struct sas_internal, t)
71
72struct sas_host_attrs { 39struct sas_host_attrs {
73 struct list_head rphy_list; 40 struct list_head rphy_list;
74 struct mutex lock; 41 struct mutex lock;
@@ -406,8 +373,6 @@ struct sas_phy *sas_phy_alloc(struct device *parent, int number)
406 if (!phy) 373 if (!phy)
407 return NULL; 374 return NULL;
408 375
409 get_device(parent);
410
411 phy->number = number; 376 phy->number = number;
412 377
413 device_initialize(&phy->dev); 378 device_initialize(&phy->dev);
@@ -459,10 +424,7 @@ EXPORT_SYMBOL(sas_phy_add);
459void sas_phy_free(struct sas_phy *phy) 424void sas_phy_free(struct sas_phy *phy)
460{ 425{
461 transport_destroy_device(&phy->dev); 426 transport_destroy_device(&phy->dev);
462 put_device(phy->dev.parent); 427 put_device(&phy->dev);
463 put_device(phy->dev.parent);
464 put_device(phy->dev.parent);
465 kfree(phy);
466} 428}
467EXPORT_SYMBOL(sas_phy_free); 429EXPORT_SYMBOL(sas_phy_free);
468 430
@@ -484,7 +446,7 @@ sas_phy_delete(struct sas_phy *phy)
484 transport_remove_device(dev); 446 transport_remove_device(dev);
485 device_del(dev); 447 device_del(dev);
486 transport_destroy_device(dev); 448 transport_destroy_device(dev);
487 put_device(dev->parent); 449 put_device(dev);
488} 450}
489EXPORT_SYMBOL(sas_phy_delete); 451EXPORT_SYMBOL(sas_phy_delete);
490 452
@@ -800,7 +762,6 @@ struct sas_rphy *sas_end_device_alloc(struct sas_phy *parent)
800 762
801 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); 763 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
802 if (!rdev) { 764 if (!rdev) {
803 put_device(&parent->dev);
804 return NULL; 765 return NULL;
805 } 766 }
806 767
@@ -836,7 +797,6 @@ struct sas_rphy *sas_expander_alloc(struct sas_phy *parent,
836 797
837 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); 798 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
838 if (!rdev) { 799 if (!rdev) {
839 put_device(&parent->dev);
840 return NULL; 800 return NULL;
841 } 801 }
842 802
@@ -885,6 +845,8 @@ int sas_rphy_add(struct sas_rphy *rphy)
885 (identify->target_port_protocols & 845 (identify->target_port_protocols &
886 (SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA))) 846 (SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA)))
887 rphy->scsi_target_id = sas_host->next_target_id++; 847 rphy->scsi_target_id = sas_host->next_target_id++;
848 else if (identify->device_type == SAS_END_DEVICE)
849 rphy->scsi_target_id = -1;
888 mutex_unlock(&sas_host->lock); 850 mutex_unlock(&sas_host->lock);
889 851
890 if (identify->device_type == SAS_END_DEVICE && 852 if (identify->device_type == SAS_END_DEVICE &&
@@ -910,6 +872,7 @@ EXPORT_SYMBOL(sas_rphy_add);
910 */ 872 */
911void sas_rphy_free(struct sas_rphy *rphy) 873void sas_rphy_free(struct sas_rphy *rphy)
912{ 874{
875 struct device *dev = &rphy->dev;
913 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); 876 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent);
914 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); 877 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
915 878
@@ -917,21 +880,9 @@ void sas_rphy_free(struct sas_rphy *rphy)
917 list_del(&rphy->list); 880 list_del(&rphy->list);
918 mutex_unlock(&sas_host->lock); 881 mutex_unlock(&sas_host->lock);
919 882
920 transport_destroy_device(&rphy->dev); 883 transport_destroy_device(dev);
921 put_device(rphy->dev.parent);
922 put_device(rphy->dev.parent);
923 put_device(rphy->dev.parent);
924 if (rphy->identify.device_type == SAS_END_DEVICE) {
925 struct sas_end_device *edev = rphy_to_end_device(rphy);
926
927 kfree(edev);
928 } else {
929 /* must be expander */
930 struct sas_expander_device *edev =
931 rphy_to_expander_device(rphy);
932 884
933 kfree(edev); 885 put_device(dev);
934 }
935} 886}
936EXPORT_SYMBOL(sas_rphy_free); 887EXPORT_SYMBOL(sas_rphy_free);
937 888
@@ -971,7 +922,7 @@ sas_rphy_delete(struct sas_rphy *rphy)
971 922
972 parent->rphy = NULL; 923 parent->rphy = NULL;
973 924
974 put_device(&parent->dev); 925 put_device(dev);
975} 926}
976EXPORT_SYMBOL(sas_rphy_delete); 927EXPORT_SYMBOL(sas_rphy_delete);
977 928
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 7405d0df95db..b098942445ec 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
748 /* 748 /*
749 * most likely out of mem, but could also be a bad map 749 * most likely out of mem, but could also be a bad map
750 */ 750 */
751 sg_finish_rem_req(srp);
751 return -ENOMEM; 752 return -ENOMEM;
752 } else 753 } else
753 return 0; 754 return 0;
@@ -1044,7 +1045,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
1044 if (!sg_allow_access(opcode, sdp->device->type)) 1045 if (!sg_allow_access(opcode, sdp->device->type))
1045 return -EPERM; 1046 return -EPERM;
1046 } 1047 }
1047 return scsi_ioctl_send_command(sdp->device, p); 1048 return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p);
1048 case SG_SET_DEBUG: 1049 case SG_SET_DEBUG:
1049 result = get_user(val, ip); 1050 result = get_user(val, ip);
1050 if (result) 1051 if (result)
@@ -1798,8 +1799,10 @@ sg_build_direct(Sg_request * srp, Sg_fd * sfp, int dxfer_len)
1798 res = st_map_user_pages(schp->buffer, mx_sc_elems, 1799 res = st_map_user_pages(schp->buffer, mx_sc_elems,
1799 (unsigned long)hp->dxferp, dxfer_len, 1800 (unsigned long)hp->dxferp, dxfer_len,
1800 (SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0); 1801 (SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0);
1801 if (res <= 0) 1802 if (res <= 0) {
1803 sg_remove_scat(schp);
1802 return 1; 1804 return 1;
1805 }
1803 schp->k_use_sg = res; 1806 schp->k_use_sg = res;
1804 schp->dio_in_use = 1; 1807 schp->dio_in_use = 1;
1805 hp->info |= SG_INFO_DIRECT_IO; 1808 hp->info |= SG_INFO_DIRECT_IO;
diff --git a/drivers/scsi/sym53c8xx_2/sym_defs.h b/drivers/scsi/sym53c8xx_2/sym_defs.h
index 3659dd7b9d76..defccc477d1e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_defs.h
+++ b/drivers/scsi/sym53c8xx_2/sym_defs.h
@@ -40,7 +40,7 @@
40#ifndef SYM_DEFS_H 40#ifndef SYM_DEFS_H
41#define SYM_DEFS_H 41#define SYM_DEFS_H
42 42
43#define SYM_VERSION "2.2.2" 43#define SYM_VERSION "2.2.3"
44#define SYM_DRIVER_NAME "sym-" SYM_VERSION 44#define SYM_DRIVER_NAME "sym-" SYM_VERSION
45 45
46/* 46/*
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 1fffd2b3c654..9c83b4d39a26 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,66 +134,17 @@ static void sym2_setup_params(void)
134 } 134 }
135} 135}
136 136
137/*
138 * We used to try to deal with 64-bit BARs here, but don't any more.
139 * There are many parts of this driver which would need to be modified
140 * to handle a 64-bit base address, including scripts. I'm uncomfortable
141 * with making those changes when I have no way of testing it, so I'm
142 * just going to disable it.
143 *
144 * Note that some machines (eg HP rx8620 and Superdome) have bus addresses
145 * below 4GB and physical addresses above 4GB. These will continue to work.
146 */
147static int __devinit
148pci_get_base_address(struct pci_dev *pdev, int index, unsigned long *basep)
149{
150 u32 tmp;
151 unsigned long base;
152#define PCI_BAR_OFFSET(index) (PCI_BASE_ADDRESS_0 + (index<<2))
153
154 pci_read_config_dword(pdev, PCI_BAR_OFFSET(index++), &tmp);
155 base = tmp;
156 if ((tmp & 0x7) == PCI_BASE_ADDRESS_MEM_TYPE_64) {
157 pci_read_config_dword(pdev, PCI_BAR_OFFSET(index++), &tmp);
158 if (tmp > 0) {
159 dev_err(&pdev->dev,
160 "BAR %d is 64-bit, disabling\n", index - 1);
161 base = 0;
162 }
163 }
164
165 if ((base & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
166 base &= PCI_BASE_ADDRESS_IO_MASK;
167 } else {
168 base &= PCI_BASE_ADDRESS_MEM_MASK;
169 }
170
171 *basep = base;
172 return index;
173#undef PCI_BAR_OFFSET
174}
175
176static struct scsi_transport_template *sym2_transport_template = NULL; 137static struct scsi_transport_template *sym2_transport_template = NULL;
177 138
178/* 139/*
179 * Used by the eh thread to wait for command completion.
180 * It is allocated on the eh thread stack.
181 */
182struct sym_eh_wait {
183 struct completion done;
184 struct timer_list timer;
185 void (*old_done)(struct scsi_cmnd *);
186 int to_do;
187 int timed_out;
188};
189
190/*
191 * Driver private area in the SCSI command structure. 140 * Driver private area in the SCSI command structure.
192 */ 141 */
193struct sym_ucmd { /* Override the SCSI pointer structure */ 142struct sym_ucmd { /* Override the SCSI pointer structure */
194 dma_addr_t data_mapping; 143 dma_addr_t data_mapping;
195 u_char data_mapped; 144 unsigned char data_mapped;
196 struct sym_eh_wait *eh_wait; 145 unsigned char to_do; /* For error handling */
146 void (*old_done)(struct scsi_cmnd *); /* For error handling */
147 struct completion *eh_done; /* For error handling */
197}; 148};
198 149
199#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)(&(cmd)->SCp)) 150#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)(&(cmd)->SCp))
@@ -514,8 +465,6 @@ static inline int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struc
514 */ 465 */
515int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) 466int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
516{ 467{
517 struct sym_tcb *tp = &np->target[cp->target];
518 struct sym_lcb *lp = sym_lp(tp, cp->lun);
519 u32 lastp, goalp; 468 u32 lastp, goalp;
520 int dir; 469 int dir;
521 470
@@ -596,7 +545,7 @@ int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct s
596 /* 545 /*
597 * activate this job. 546 * activate this job.
598 */ 547 */
599 sym_start_next_ccbs(np, lp, 2); 548 sym_put_start_queue(np, cp);
600 return 0; 549 return 0;
601 550
602out_abort: 551out_abort:
@@ -751,80 +700,54 @@ static void sym53c8xx_timer(unsigned long npref)
751 * What we will do regarding the involved SCSI command. 700 * What we will do regarding the involved SCSI command.
752 */ 701 */
753#define SYM_EH_DO_IGNORE 0 702#define SYM_EH_DO_IGNORE 0
754#define SYM_EH_DO_COMPLETE 1
755#define SYM_EH_DO_WAIT 2 703#define SYM_EH_DO_WAIT 2
756 704
757/* 705/*
758 * Our general completion handler. 706 * scsi_done() alias when error recovery is in progress.
759 */ 707 */
760static void __sym_eh_done(struct scsi_cmnd *cmd, int timed_out) 708static void sym_eh_done(struct scsi_cmnd *cmd)
761{ 709{
762 struct sym_eh_wait *ep = SYM_UCMD_PTR(cmd)->eh_wait; 710 struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
763 if (!ep) 711 BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd));
764 return;
765
766 /* Try to avoid a race here (not 100% safe) */
767 if (!timed_out) {
768 ep->timed_out = 0;
769 if (ep->to_do == SYM_EH_DO_WAIT && !del_timer(&ep->timer))
770 return;
771 }
772 712
773 /* Revert everything */ 713 cmd->scsi_done = ucmd->old_done;
774 SYM_UCMD_PTR(cmd)->eh_wait = NULL;
775 cmd->scsi_done = ep->old_done;
776 714
777 /* Wake up the eh thread if it wants to sleep */ 715 if (ucmd->to_do == SYM_EH_DO_WAIT)
778 if (ep->to_do == SYM_EH_DO_WAIT) 716 complete(ucmd->eh_done);
779 complete(&ep->done);
780} 717}
781 718
782/* 719/*
783 * scsi_done() alias when error recovery is in progress.
784 */
785static void sym_eh_done(struct scsi_cmnd *cmd) { __sym_eh_done(cmd, 0); }
786
787/*
788 * Some timeout handler to avoid waiting too long.
789 */
790static void sym_eh_timeout(u_long p) { __sym_eh_done((struct scsi_cmnd *)p, 1); }
791
792/*
793 * Generic method for our eh processing. 720 * Generic method for our eh processing.
794 * The 'op' argument tells what we have to do. 721 * The 'op' argument tells what we have to do.
795 */ 722 */
796static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd) 723static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
797{ 724{
798 struct sym_hcb *np = SYM_SOFTC_PTR(cmd); 725 struct sym_hcb *np = SYM_SOFTC_PTR(cmd);
726 struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
727 struct Scsi_Host *host = cmd->device->host;
799 SYM_QUEHEAD *qp; 728 SYM_QUEHEAD *qp;
800 int to_do = SYM_EH_DO_IGNORE; 729 int to_do = SYM_EH_DO_IGNORE;
801 int sts = -1; 730 int sts = -1;
802 struct sym_eh_wait eh, *ep = &eh; 731 struct completion eh_done;
803 732
804 dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); 733 dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
805 734
735 spin_lock_irq(host->host_lock);
806 /* This one is queued in some place -> to wait for completion */ 736 /* This one is queued in some place -> to wait for completion */
807 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { 737 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
808 struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); 738 struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
809 if (cp->cmd == cmd) { 739 if (cp->cmd == cmd) {
810 to_do = SYM_EH_DO_WAIT; 740 to_do = SYM_EH_DO_WAIT;
811 goto prepare; 741 break;
812 } 742 }
813 } 743 }
814 744
815prepare: 745 if (to_do == SYM_EH_DO_WAIT) {
816 /* Prepare stuff to either ignore, complete or wait for completion */ 746 init_completion(&eh_done);
817 switch(to_do) { 747 ucmd->old_done = cmd->scsi_done;
818 default: 748 ucmd->eh_done = &eh_done;
819 case SYM_EH_DO_IGNORE: 749 wmb();
820 break;
821 case SYM_EH_DO_WAIT:
822 init_completion(&ep->done);
823 /* fall through */
824 case SYM_EH_DO_COMPLETE:
825 ep->old_done = cmd->scsi_done;
826 cmd->scsi_done = sym_eh_done; 750 cmd->scsi_done = sym_eh_done;
827 SYM_UCMD_PTR(cmd)->eh_wait = ep;
828 } 751 }
829 752
830 /* Try to proceed the operation we have been asked for */ 753 /* Try to proceed the operation we have been asked for */
@@ -851,29 +774,19 @@ prepare:
851 774
852 /* On error, restore everything and cross fingers :) */ 775 /* On error, restore everything and cross fingers :) */
853 if (sts) { 776 if (sts) {
854 SYM_UCMD_PTR(cmd)->eh_wait = NULL; 777 cmd->scsi_done = ucmd->old_done;
855 cmd->scsi_done = ep->old_done;
856 to_do = SYM_EH_DO_IGNORE; 778 to_do = SYM_EH_DO_IGNORE;
857 } 779 }
858 780
859 ep->to_do = to_do; 781 ucmd->to_do = to_do;
860 /* Complete the command with locks held as required by the driver */ 782 spin_unlock_irq(host->host_lock);
861 if (to_do == SYM_EH_DO_COMPLETE)
862 sym_xpt_done2(np, cmd, DID_ABORT);
863 783
864 /* Wait for completion with locks released, as required by kernel */
865 if (to_do == SYM_EH_DO_WAIT) { 784 if (to_do == SYM_EH_DO_WAIT) {
866 init_timer(&ep->timer); 785 if (!wait_for_completion_timeout(&eh_done, 5*HZ)) {
867 ep->timer.expires = jiffies + (5*HZ); 786 ucmd->to_do = SYM_EH_DO_IGNORE;
868 ep->timer.function = sym_eh_timeout; 787 wmb();
869 ep->timer.data = (u_long)cmd;
870 ep->timed_out = 1; /* Be pessimistic for once :) */
871 add_timer(&ep->timer);
872 spin_unlock_irq(np->s.host->host_lock);
873 wait_for_completion(&ep->done);
874 spin_lock_irq(np->s.host->host_lock);
875 if (ep->timed_out)
876 sts = -2; 788 sts = -2;
789 }
877 } 790 }
878 dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname, 791 dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname,
879 sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed"); 792 sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed");
@@ -886,46 +799,22 @@ prepare:
886 */ 799 */
887static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd) 800static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd)
888{ 801{
889 int rc; 802 return sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd);
890
891 spin_lock_irq(cmd->device->host->host_lock);
892 rc = sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd);
893 spin_unlock_irq(cmd->device->host->host_lock);
894
895 return rc;
896} 803}
897 804
898static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) 805static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)
899{ 806{
900 int rc; 807 return sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd);
901
902 spin_lock_irq(cmd->device->host->host_lock);
903 rc = sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd);
904 spin_unlock_irq(cmd->device->host->host_lock);
905
906 return rc;
907} 808}
908 809
909static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) 810static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)
910{ 811{
911 int rc; 812 return sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd);
912
913 spin_lock_irq(cmd->device->host->host_lock);
914 rc = sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd);
915 spin_unlock_irq(cmd->device->host->host_lock);
916
917 return rc;
918} 813}
919 814
920static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) 815static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd)
921{ 816{
922 int rc; 817 return sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd);
923
924 spin_lock_irq(cmd->device->host->host_lock);
925 rc = sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd);
926 spin_unlock_irq(cmd->device->host->host_lock);
927
928 return rc;
929} 818}
930 819
931/* 820/*
@@ -944,15 +833,12 @@ static void sym_tune_dev_queuing(struct sym_tcb *tp, int lun, u_short reqtags)
944 if (reqtags > lp->s.scdev_depth) 833 if (reqtags > lp->s.scdev_depth)
945 reqtags = lp->s.scdev_depth; 834 reqtags = lp->s.scdev_depth;
946 835
947 lp->started_limit = reqtags ? reqtags : 2;
948 lp->started_max = 1;
949 lp->s.reqtags = reqtags; 836 lp->s.reqtags = reqtags;
950 837
951 if (reqtags != oldtags) { 838 if (reqtags != oldtags) {
952 dev_info(&tp->starget->dev, 839 dev_info(&tp->starget->dev,
953 "tagged command queuing %s, command queue depth %d.\n", 840 "tagged command queuing %s, command queue depth %d.\n",
954 lp->s.reqtags ? "enabled" : "disabled", 841 lp->s.reqtags ? "enabled" : "disabled", reqtags);
955 lp->started_limit);
956 } 842 }
957} 843}
958 844
@@ -1866,15 +1752,25 @@ static int __devinit sym_set_workarounds(struct sym_device *device)
1866static void __devinit 1752static void __devinit
1867sym_init_device(struct pci_dev *pdev, struct sym_device *device) 1753sym_init_device(struct pci_dev *pdev, struct sym_device *device)
1868{ 1754{
1869 int i; 1755 int i = 2;
1756 struct pci_bus_region bus_addr;
1870 1757
1871 device->host_id = SYM_SETUP_HOST_ID; 1758 device->host_id = SYM_SETUP_HOST_ID;
1872 device->pdev = pdev; 1759 device->pdev = pdev;
1873 1760
1874 i = pci_get_base_address(pdev, 1, &device->mmio_base); 1761 pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[1]);
1875 pci_get_base_address(pdev, i, &device->ram_base); 1762 device->mmio_base = bus_addr.start;
1763
1764 /*
1765 * If the BAR is 64-bit, resource 2 will be occupied by the
1766 * upper 32 bits
1767 */
1768 if (!pdev->resource[i].flags)
1769 i++;
1770 pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[i]);
1771 device->ram_base = bus_addr.start;
1876 1772
1877#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED 1773#ifdef CONFIG_SCSI_SYM53C8XX_MMIO
1878 if (device->mmio_base) 1774 if (device->mmio_base)
1879 device->s.ioaddr = pci_iomap(pdev, 1, 1775 device->s.ioaddr = pci_iomap(pdev, 1,
1880 pci_resource_len(pdev, 1)); 1776 pci_resource_len(pdev, 1));
@@ -1978,7 +1874,8 @@ static struct scsi_host_template sym2_template = {
1978 .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler, 1874 .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler,
1979 .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, 1875 .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler,
1980 .this_id = 7, 1876 .this_id = 7,
1981 .use_clustering = DISABLE_CLUSTERING, 1877 .use_clustering = ENABLE_CLUSTERING,
1878 .max_sectors = 0xFFFF,
1982#ifdef SYM_LINUX_PROC_INFO_SUPPORT 1879#ifdef SYM_LINUX_PROC_INFO_SUPPORT
1983 .proc_info = sym53c8xx_proc_info, 1880 .proc_info = sym53c8xx_proc_info,
1984 .proc_name = NAME53C8XX, 1881 .proc_name = NAME53C8XX,
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h
index cc92d0c70cd7..a446cda3f64c 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -68,7 +68,7 @@
68 */ 68 */
69#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2) 69#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2)
70 70
71#define SYM_OPT_HANDLE_DEVICE_QUEUEING 71#undef SYM_OPT_HANDLE_DEVICE_QUEUEING
72#define SYM_OPT_LIMIT_COMMAND_REORDERING 72#define SYM_OPT_LIMIT_COMMAND_REORDERING
73 73
74/* 74/*
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 60850cbe3a85..a671bdc07450 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -72,7 +72,10 @@ static void sym_printl_hex(u_char *p, int n)
72 72
73static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) 73static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg)
74{ 74{
75 sym_print_addr(cp->cmd, "%s: ", label); 75 if (label)
76 sym_print_addr(cp->cmd, "%s: ", label);
77 else
78 sym_print_addr(cp->cmd, "");
76 79
77 spi_print_msg(msg); 80 spi_print_msg(msg);
78 printf("\n"); 81 printf("\n");
@@ -472,7 +475,7 @@ static int sym_getpciclock (struct sym_hcb *np)
472 * calculations more simple. 475 * calculations more simple.
473 */ 476 */
474#define _5M 5000000 477#define _5M 5000000
475static u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; 478static const u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M};
476 479
477/* 480/*
478 * Get clock factor and sync divisor for a given 481 * Get clock factor and sync divisor for a given
@@ -645,6 +648,37 @@ static void sym_save_initial_setting (struct sym_hcb *np)
645} 648}
646 649
647/* 650/*
651 * Set SCSI BUS mode.
652 * - LVD capable chips (895/895A/896/1010) report the current BUS mode
653 * through the STEST4 IO register.
654 * - For previous generation chips (825/825A/875), the user has to tell us
655 * how to check against HVD, since a 100% safe algorithm is not possible.
656 */
657static void sym_set_bus_mode(struct sym_hcb *np, struct sym_nvram *nvram)
658{
659 if (np->scsi_mode)
660 return;
661
662 np->scsi_mode = SMODE_SE;
663 if (np->features & (FE_ULTRA2|FE_ULTRA3))
664 np->scsi_mode = (np->sv_stest4 & SMODE);
665 else if (np->features & FE_DIFF) {
666 if (SYM_SETUP_SCSI_DIFF == 1) {
667 if (np->sv_scntl3) {
668 if (np->sv_stest2 & 0x20)
669 np->scsi_mode = SMODE_HVD;
670 } else if (nvram->type == SYM_SYMBIOS_NVRAM) {
671 if (!(INB(np, nc_gpreg) & 0x08))
672 np->scsi_mode = SMODE_HVD;
673 }
674 } else if (SYM_SETUP_SCSI_DIFF == 2)
675 np->scsi_mode = SMODE_HVD;
676 }
677 if (np->scsi_mode == SMODE_HVD)
678 np->rv_stest2 |= 0x20;
679}
680
681/*
648 * Prepare io register values used by sym_start_up() 682 * Prepare io register values used by sym_start_up()
649 * according to selected and supported features. 683 * according to selected and supported features.
650 */ 684 */
@@ -654,10 +688,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
654 u32 period; 688 u32 period;
655 int i; 689 int i;
656 690
657 /* 691 np->maxwide = (np->features & FE_WIDE) ? 1 : 0;
658 * Wide ?
659 */
660 np->maxwide = (np->features & FE_WIDE)? 1 : 0;
661 692
662 /* 693 /*
663 * Guess the frequency of the chip's clock. 694 * Guess the frequency of the chip's clock.
@@ -838,6 +869,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
838 * Get parity checking, host ID and verbose mode from NVRAM 869 * Get parity checking, host ID and verbose mode from NVRAM
839 */ 870 */
840 np->myaddr = 255; 871 np->myaddr = 255;
872 np->scsi_mode = 0;
841 sym_nvram_setup_host(shost, np, nvram); 873 sym_nvram_setup_host(shost, np, nvram);
842 874
843 /* 875 /*
@@ -854,33 +886,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
854 */ 886 */
855 sym_init_burst(np, burst_max); 887 sym_init_burst(np, burst_max);
856 888
857 /* 889 sym_set_bus_mode(np, nvram);
858 * Set SCSI BUS mode.
859 * - LVD capable chips (895/895A/896/1010) report the
860 * current BUS mode through the STEST4 IO register.
861 * - For previous generation chips (825/825A/875),
862 * user has to tell us how to check against HVD,
863 * since a 100% safe algorithm is not possible.
864 */
865 np->scsi_mode = SMODE_SE;
866 if (np->features & (FE_ULTRA2|FE_ULTRA3))
867 np->scsi_mode = (np->sv_stest4 & SMODE);
868 else if (np->features & FE_DIFF) {
869 if (SYM_SETUP_SCSI_DIFF == 1) {
870 if (np->sv_scntl3) {
871 if (np->sv_stest2 & 0x20)
872 np->scsi_mode = SMODE_HVD;
873 }
874 else if (nvram->type == SYM_SYMBIOS_NVRAM) {
875 if (!(INB(np, nc_gpreg) & 0x08))
876 np->scsi_mode = SMODE_HVD;
877 }
878 }
879 else if (SYM_SETUP_SCSI_DIFF == 2)
880 np->scsi_mode = SMODE_HVD;
881 }
882 if (np->scsi_mode == SMODE_HVD)
883 np->rv_stest2 |= 0x20;
884 890
885 /* 891 /*
886 * Set LED support from SCRIPTS. 892 * Set LED support from SCRIPTS.
@@ -973,8 +979,8 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
973 * 979 *
974 * Has to be called with interrupts disabled. 980 * Has to be called with interrupts disabled.
975 */ 981 */
976#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED 982#ifdef CONFIG_SCSI_SYM53C8XX_MMIO
977static int sym_regtest (struct sym_hcb *np) 983static int sym_regtest(struct sym_hcb *np)
978{ 984{
979 register volatile u32 data; 985 register volatile u32 data;
980 /* 986 /*
@@ -992,20 +998,25 @@ static int sym_regtest (struct sym_hcb *np)
992#endif 998#endif
993 printf ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n", 999 printf ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n",
994 (unsigned) data); 1000 (unsigned) data);
995 return (0x10); 1001 return 0x10;
996 } 1002 }
997 return (0); 1003 return 0;
1004}
1005#else
1006static inline int sym_regtest(struct sym_hcb *np)
1007{
1008 return 0;
998} 1009}
999#endif 1010#endif
1000 1011
1001static int sym_snooptest (struct sym_hcb *np) 1012static int sym_snooptest(struct sym_hcb *np)
1002{ 1013{
1003 u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; 1014 u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat;
1004 int i, err=0; 1015 int i, err;
1005#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED 1016
1006 err |= sym_regtest (np); 1017 err = sym_regtest(np);
1007 if (err) return (err); 1018 if (err)
1008#endif 1019 return err;
1009restart_test: 1020restart_test:
1010 /* 1021 /*
1011 * Enable Master Parity Checking as we intend 1022 * Enable Master Parity Checking as we intend
@@ -1094,7 +1105,7 @@ restart_test:
1094 err |= 4; 1105 err |= 4;
1095 } 1106 }
1096 1107
1097 return (err); 1108 return err;
1098} 1109}
1099 1110
1100/* 1111/*
@@ -1464,7 +1475,7 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1464/* 1475/*
1465 * Insert a job into the start queue. 1476 * Insert a job into the start queue.
1466 */ 1477 */
1467static void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) 1478void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp)
1468{ 1479{
1469 u_short qidx; 1480 u_short qidx;
1470 1481
@@ -4481,7 +4492,7 @@ static void sym_int_sir (struct sym_hcb *np)
4481 switch (np->msgin [2]) { 4492 switch (np->msgin [2]) {
4482 case M_X_MODIFY_DP: 4493 case M_X_MODIFY_DP:
4483 if (DEBUG_FLAGS & DEBUG_POINTER) 4494 if (DEBUG_FLAGS & DEBUG_POINTER)
4484 sym_print_msg(cp,"modify DP",np->msgin); 4495 sym_print_msg(cp, NULL, np->msgin);
4485 tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + 4496 tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) +
4486 (np->msgin[5]<<8) + (np->msgin[6]); 4497 (np->msgin[5]<<8) + (np->msgin[6]);
4487 sym_modify_dp(np, tp, cp, tmp); 4498 sym_modify_dp(np, tp, cp, tmp);
@@ -4508,7 +4519,7 @@ static void sym_int_sir (struct sym_hcb *np)
4508 */ 4519 */
4509 case M_IGN_RESIDUE: 4520 case M_IGN_RESIDUE:
4510 if (DEBUG_FLAGS & DEBUG_POINTER) 4521 if (DEBUG_FLAGS & DEBUG_POINTER)
4511 sym_print_msg(cp,"ign wide residue", np->msgin); 4522 sym_print_msg(cp, NULL, np->msgin);
4512 if (cp->host_flags & HF_SENSE) 4523 if (cp->host_flags & HF_SENSE)
4513 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); 4524 OUTL_DSP(np, SCRIPTA_BA(np, clrack));
4514 else 4525 else
@@ -4597,7 +4608,8 @@ struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char t
4597 * Debugging purpose. 4608 * Debugging purpose.
4598 */ 4609 */
4599#ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING 4610#ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING
4600 assert(lp->busy_itl == 0); 4611 if (lp->busy_itl != 0)
4612 goto out_free;
4601#endif 4613#endif
4602 /* 4614 /*
4603 * Allocate resources for tags if not yet. 4615 * Allocate resources for tags if not yet.
@@ -4642,7 +4654,8 @@ struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char t
4642 * Debugging purpose. 4654 * Debugging purpose.
4643 */ 4655 */
4644#ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING 4656#ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING
4645 assert(lp->busy_itl == 0 && lp->busy_itlq == 0); 4657 if (lp->busy_itl != 0 || lp->busy_itlq != 0)
4658 goto out_free;
4646#endif 4659#endif
4647 /* 4660 /*
4648 * Count this nexus for this LUN. 4661 * Count this nexus for this LUN.
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index 2456090bb241..79ab6a177039 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -1049,6 +1049,8 @@ int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int);
1049struct sym_chip *sym_lookup_chip_table(u_short device_id, u_char revision); 1049struct sym_chip *sym_lookup_chip_table(u_short device_id, u_char revision);
1050#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING 1050#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
1051void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn); 1051void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn);
1052#else
1053void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp);
1052#endif 1054#endif
1053void sym_start_up(struct sym_hcb *np, int reason); 1055void sym_start_up(struct sym_hcb *np, int reason);
1054void sym_interrupt(struct sym_hcb *np); 1056void sym_interrupt(struct sym_hcb *np);
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index e9c10c0a30fc..321a40f33b50 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -1057,7 +1057,6 @@ static void m32r_sio_console_write(struct console *co, const char *s,
1057{ 1057{
1058 struct uart_sio_port *up = &m32r_sio_ports[co->index]; 1058 struct uart_sio_port *up = &m32r_sio_ports[co->index];
1059 unsigned int ier; 1059 unsigned int ier;
1060 int i;
1061 1060
1062 /* 1061 /*
1063 * First save the UER then disable the interrupts 1062 * First save the UER then disable the interrupts
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index 93449a1a0065..0b49ff78efc1 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -11,6 +11,7 @@
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/dma-mapping.h>
14#include <linux/interrupt.h> 15#include <linux/interrupt.h>
15#include <linux/spinlock.h> 16#include <linux/spinlock.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
@@ -619,9 +620,9 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
619 pci_set_master(pdev); 620 pci_set_master(pdev);
620 621
621#ifdef USE_64BIT_DMA 622#ifdef USE_64BIT_DMA
622 ret = pci_set_dma_mask(pdev, 0xffffffffffffffffULL); 623 ret = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
623 if (!ret) { 624 if (!ret) {
624 ret = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL); 625 ret = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
625 if (ret < 0) { 626 if (ret < 0) {
626 printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " 627 printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA "
627 "for consistent allocations\n", 628 "for consistent allocations\n",
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 830d2c982670..b38990adf1cd 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -68,7 +68,7 @@
68 68
69#include "usbatm.h" 69#include "usbatm.h"
70 70
71#define EAGLEUSBVERSION "ueagle 1.2" 71#define EAGLEUSBVERSION "ueagle 1.3"
72 72
73 73
74/* 74/*
@@ -243,7 +243,7 @@ enum {
243#define BULK_TIMEOUT 300 243#define BULK_TIMEOUT 300
244#define CTRL_TIMEOUT 1000 244#define CTRL_TIMEOUT 1000
245 245
246#define ACK_TIMEOUT msecs_to_jiffies(1500) 246#define ACK_TIMEOUT msecs_to_jiffies(3000)
247 247
248#define UEA_INTR_IFACE_NO 0 248#define UEA_INTR_IFACE_NO 0
249#define UEA_US_IFACE_NO 1 249#define UEA_US_IFACE_NO 1
@@ -314,6 +314,10 @@ struct cmv {
314 ((d) & 0xff) << 16 | \ 314 ((d) & 0xff) << 16 | \
315 ((a) & 0xff) << 8 | \ 315 ((a) & 0xff) << 8 | \
316 ((b) & 0xff)) 316 ((b) & 0xff))
317#define GETSA1(a) ((a >> 8) & 0xff)
318#define GETSA2(a) (a & 0xff)
319#define GETSA3(a) ((a >> 24) & 0xff)
320#define GETSA4(a) ((a >> 16) & 0xff)
317 321
318#define SA_CNTL MAKESA('C', 'N', 'T', 'L') 322#define SA_CNTL MAKESA('C', 'N', 'T', 'L')
319#define SA_DIAG MAKESA('D', 'I', 'A', 'G') 323#define SA_DIAG MAKESA('D', 'I', 'A', 'G')
@@ -728,11 +732,12 @@ bad2:
728 uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i); 732 uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i);
729 return; 733 return;
730bad1: 734bad1:
731 uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n",pageno); 735 uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno);
732} 736}
733 737
734static inline void wake_up_cmv_ack(struct uea_softc *sc) 738static inline void wake_up_cmv_ack(struct uea_softc *sc)
735{ 739{
740 BUG_ON(sc->cmv_ack);
736 sc->cmv_ack = 1; 741 sc->cmv_ack = 1;
737 wake_up(&sc->cmv_ack_wait); 742 wake_up(&sc->cmv_ack_wait);
738} 743}
@@ -743,6 +748,9 @@ static inline int wait_cmv_ack(struct uea_softc *sc)
743 sc->cmv_ack, ACK_TIMEOUT); 748 sc->cmv_ack, ACK_TIMEOUT);
744 sc->cmv_ack = 0; 749 sc->cmv_ack = 0;
745 750
751 uea_dbg(INS_TO_USBDEV(sc), "wait_event_timeout : %d ms\n",
752 jiffies_to_msecs(ret));
753
746 if (ret < 0) 754 if (ret < 0)
747 return ret; 755 return ret;
748 756
@@ -791,6 +799,12 @@ static int uea_cmv(struct uea_softc *sc,
791 struct cmv cmv; 799 struct cmv cmv;
792 int ret; 800 int ret;
793 801
802 uea_enters(INS_TO_USBDEV(sc));
803 uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Address : %c%c%c%c, "
804 "offset : 0x%04x, data : 0x%08x\n",
805 FUNCTION_TYPE(function), FUNCTION_SUBTYPE(function),
806 GETSA1(address), GETSA2(address), GETSA3(address),
807 GETSA4(address), offset, data);
794 /* we send a request, but we expect a reply */ 808 /* we send a request, but we expect a reply */
795 sc->cmv_function = function | 0x2; 809 sc->cmv_function = function | 0x2;
796 sc->cmv_idx++; 810 sc->cmv_idx++;
@@ -808,7 +822,9 @@ static int uea_cmv(struct uea_softc *sc,
808 ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv); 822 ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv);
809 if (ret < 0) 823 if (ret < 0)
810 return ret; 824 return ret;
811 return wait_cmv_ack(sc); 825 ret = wait_cmv_ack(sc);
826 uea_leaves(INS_TO_USBDEV(sc));
827 return ret;
812} 828}
813 829
814static inline int uea_read_cmv(struct uea_softc *sc, 830static inline int uea_read_cmv(struct uea_softc *sc,
@@ -922,7 +938,7 @@ static int uea_stat(struct uea_softc *sc)
922 * we check the status again in order to detect the failure earlier 938 * we check the status again in order to detect the failure earlier
923 */ 939 */
924 if (sc->stats.phy.flags) { 940 if (sc->stats.phy.flags) {
925 uea_dbg(INS_TO_USBDEV(sc), "Stat flag = %d\n", 941 uea_dbg(INS_TO_USBDEV(sc), "Stat flag = 0x%x\n",
926 sc->stats.phy.flags); 942 sc->stats.phy.flags);
927 return 0; 943 return 0;
928 } 944 }
@@ -1063,7 +1079,13 @@ static int uea_start_reset(struct uea_softc *sc)
1063 uea_enters(INS_TO_USBDEV(sc)); 1079 uea_enters(INS_TO_USBDEV(sc));
1064 uea_info(INS_TO_USBDEV(sc), "(re)booting started\n"); 1080 uea_info(INS_TO_USBDEV(sc), "(re)booting started\n");
1065 1081
1082 /* mask interrupt */
1066 sc->booting = 1; 1083 sc->booting = 1;
1084 /* We need to set this here because, a ack timeout could have occured,
1085 * but before we start the reboot, the ack occurs and set this to 1.
1086 * So we will failed to wait Ready CMV.
1087 */
1088 sc->cmv_ack = 0;
1067 UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST); 1089 UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST);
1068 1090
1069 /* reset statistics */ 1091 /* reset statistics */
@@ -1089,6 +1111,7 @@ static int uea_start_reset(struct uea_softc *sc)
1089 1111
1090 msleep(1000); 1112 msleep(1000);
1091 sc->cmv_function = MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY); 1113 sc->cmv_function = MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY);
1114 /* demask interrupt */
1092 sc->booting = 0; 1115 sc->booting = 0;
1093 1116
1094 /* start loading DSP */ 1117 /* start loading DSP */
@@ -1101,6 +1124,8 @@ static int uea_start_reset(struct uea_softc *sc)
1101 if (ret < 0) 1124 if (ret < 0)
1102 return ret; 1125 return ret;
1103 1126
1127 uea_vdbg(INS_TO_USBDEV(sc), "Ready CMV received\n");
1128
1104 /* Enter in R-IDLE (cmv) until instructed otherwise */ 1129 /* Enter in R-IDLE (cmv) until instructed otherwise */
1105 ret = uea_write_cmv(sc, SA_CNTL, 0, 1); 1130 ret = uea_write_cmv(sc, SA_CNTL, 0, 1);
1106 if (ret < 0) 1131 if (ret < 0)
@@ -1121,6 +1146,7 @@ static int uea_start_reset(struct uea_softc *sc)
1121 } 1146 }
1122 /* Enter in R-ACT-REQ */ 1147 /* Enter in R-ACT-REQ */
1123 ret = uea_write_cmv(sc, SA_CNTL, 0, 2); 1148 ret = uea_write_cmv(sc, SA_CNTL, 0, 2);
1149 uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n");
1124out: 1150out:
1125 release_firmware(cmvs_fw); 1151 release_firmware(cmvs_fw);
1126 sc->reset = 0; 1152 sc->reset = 0;
@@ -1235,6 +1261,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
1235 1261
1236 if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) { 1262 if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) {
1237 wake_up_cmv_ack(sc); 1263 wake_up_cmv_ack(sc);
1264 uea_leaves(INS_TO_USBDEV(sc));
1238 return; 1265 return;
1239 } 1266 }
1240 1267
@@ -1249,6 +1276,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
1249 sc->data = sc->data << 16 | sc->data >> 16; 1276 sc->data = sc->data << 16 | sc->data >> 16;
1250 1277
1251 wake_up_cmv_ack(sc); 1278 wake_up_cmv_ack(sc);
1279 uea_leaves(INS_TO_USBDEV(sc));
1252 return; 1280 return;
1253 1281
1254bad2: 1282bad2:
@@ -1256,12 +1284,14 @@ bad2:
1256 "Function : %d, Subfunction : %d\n", 1284 "Function : %d, Subfunction : %d\n",
1257 FUNCTION_TYPE(cmv->bFunction), 1285 FUNCTION_TYPE(cmv->bFunction),
1258 FUNCTION_SUBTYPE(cmv->bFunction)); 1286 FUNCTION_SUBTYPE(cmv->bFunction));
1287 uea_leaves(INS_TO_USBDEV(sc));
1259 return; 1288 return;
1260 1289
1261bad1: 1290bad1:
1262 uea_err(INS_TO_USBDEV(sc), "invalid cmv received, " 1291 uea_err(INS_TO_USBDEV(sc), "invalid cmv received, "
1263 "wPreamble %d, bDirection %d\n", 1292 "wPreamble %d, bDirection %d\n",
1264 le16_to_cpu(cmv->wPreamble), cmv->bDirection); 1293 le16_to_cpu(cmv->wPreamble), cmv->bDirection);
1294 uea_leaves(INS_TO_USBDEV(sc));
1265} 1295}
1266 1296
1267/* 1297/*
@@ -1346,7 +1376,7 @@ static int uea_boot(struct uea_softc *sc)
1346 if (ret < 0) { 1376 if (ret < 0) {
1347 uea_err(INS_TO_USBDEV(sc), 1377 uea_err(INS_TO_USBDEV(sc),
1348 "urb submition failed with error %d\n", ret); 1378 "urb submition failed with error %d\n", ret);
1349 goto err1; 1379 goto err;
1350 } 1380 }
1351 1381
1352 sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); 1382 sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm");
@@ -1360,10 +1390,10 @@ static int uea_boot(struct uea_softc *sc)
1360 1390
1361err2: 1391err2:
1362 usb_kill_urb(sc->urb_int); 1392 usb_kill_urb(sc->urb_int);
1363err1:
1364 kfree(intr);
1365err: 1393err:
1366 usb_free_urb(sc->urb_int); 1394 usb_free_urb(sc->urb_int);
1395 sc->urb_int = NULL;
1396 kfree(intr);
1367 uea_leaves(INS_TO_USBDEV(sc)); 1397 uea_leaves(INS_TO_USBDEV(sc));
1368 return -ENOMEM; 1398 return -ENOMEM;
1369} 1399}
@@ -1508,7 +1538,7 @@ static ssize_t read_##name(struct device *dev, \
1508 int ret = -ENODEV; \ 1538 int ret = -ENODEV; \
1509 struct uea_softc *sc; \ 1539 struct uea_softc *sc; \
1510 \ 1540 \
1511 mutex_lock(&uea_mutex); \ 1541 mutex_lock(&uea_mutex); \
1512 sc = dev_to_uea(dev); \ 1542 sc = dev_to_uea(dev); \
1513 if (!sc) \ 1543 if (!sc) \
1514 goto out; \ 1544 goto out; \
@@ -1516,7 +1546,7 @@ static ssize_t read_##name(struct device *dev, \
1516 if (reset) \ 1546 if (reset) \
1517 sc->stats.phy.name = 0; \ 1547 sc->stats.phy.name = 0; \
1518out: \ 1548out: \
1519 mutex_unlock(&uea_mutex); \ 1549 mutex_unlock(&uea_mutex); \
1520 return ret; \ 1550 return ret; \
1521} \ 1551} \
1522 \ 1552 \
@@ -1643,7 +1673,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1643 1673
1644 sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL); 1674 sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL);
1645 if (!sc) { 1675 if (!sc) {
1646 uea_err(INS_TO_USBDEV(sc), "uea_init: not enough memory !\n"); 1676 uea_err(usb, "uea_init: not enough memory !\n");
1647 return -ENOMEM; 1677 return -ENOMEM;
1648 } 1678 }
1649 1679
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index ff03184da403..a08787e253aa 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -99,4 +99,11 @@ config USB_OTG_WHITELIST
99 normal Linux-USB hosts do (other than the warning), and is 99 normal Linux-USB hosts do (other than the warning), and is
100 convenient for many stages of product development. 100 convenient for many stages of product development.
101 101
102config USB_OTG_BLACKLIST_HUB
103 bool "Disable external hubs"
104 depends on USB_OTG
105 help
106 If you say Y here, then Linux will refuse to enumerate
107 external hubs. OTG hosts are allowed to reduce hardware
108 and software costs by not supporting external hubs.
102 109
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 0d2193b69235..66b78404ab34 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -213,11 +213,9 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
213 213
214 if (hcd->driver->suspend) { 214 if (hcd->driver->suspend) {
215 retval = hcd->driver->suspend(hcd, message); 215 retval = hcd->driver->suspend(hcd, message);
216 if (retval) { 216 suspend_report_result(hcd->driver->suspend, retval);
217 dev_dbg (&dev->dev, "PCI pre-suspend fail, %d\n", 217 if (retval)
218 retval);
219 goto done; 218 goto done;
220 }
221 } 219 }
222 synchronize_irq(dev->irq); 220 synchronize_irq(dev->irq);
223 221
@@ -263,6 +261,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
263 * some device state (e.g. as part of clock reinit). 261 * some device state (e.g. as part of clock reinit).
264 */ 262 */
265 retval = pci_set_power_state (dev, PCI_D3hot); 263 retval = pci_set_power_state (dev, PCI_D3hot);
264 suspend_report_result(pci_set_power_state, retval);
266 if (retval == 0) { 265 if (retval == 0) {
267 int wake = device_can_wakeup(&hcd->self.root_hub->dev); 266 int wake = device_can_wakeup(&hcd->self.root_hub->dev);
268 267
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8e65f7a237e4..0c87f73f2933 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -836,6 +836,13 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
836 desc = intf->cur_altsetting; 836 desc = intf->cur_altsetting;
837 hdev = interface_to_usbdev(intf); 837 hdev = interface_to_usbdev(intf);
838 838
839#ifdef CONFIG_USB_OTG_BLACKLIST_HUB
840 if (hdev->parent) {
841 dev_warn(&intf->dev, "ignoring external hub\n");
842 return -ENODEV;
843 }
844#endif
845
839 /* Some hubs have a subclass of 1, which AFAICT according to the */ 846 /* Some hubs have a subclass of 1, which AFAICT according to the */
840 /* specs is not defined, but it works */ 847 /* specs is not defined, but it works */
841 if ((desc->desc.bInterfaceSubClass != 0) && 848 if ((desc->desc.bInterfaceSubClass != 0) &&
@@ -1022,7 +1029,6 @@ void usb_set_device_state(struct usb_device *udev,
1022 recursively_mark_NOTATTACHED(udev); 1029 recursively_mark_NOTATTACHED(udev);
1023 spin_unlock_irqrestore(&device_state_lock, flags); 1030 spin_unlock_irqrestore(&device_state_lock, flags);
1024} 1031}
1025EXPORT_SYMBOL(usb_set_device_state);
1026 1032
1027 1033
1028#ifdef CONFIG_PM 1034#ifdef CONFIG_PM
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index d7352aa73b5e..b7fdc1cd134a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1194,7 +1194,6 @@ EXPORT_SYMBOL(usb_disabled);
1194EXPORT_SYMBOL_GPL(usb_get_intf); 1194EXPORT_SYMBOL_GPL(usb_get_intf);
1195EXPORT_SYMBOL_GPL(usb_put_intf); 1195EXPORT_SYMBOL_GPL(usb_put_intf);
1196 1196
1197EXPORT_SYMBOL(usb_alloc_dev);
1198EXPORT_SYMBOL(usb_put_dev); 1197EXPORT_SYMBOL(usb_put_dev);
1199EXPORT_SYMBOL(usb_get_dev); 1198EXPORT_SYMBOL(usb_get_dev);
1200EXPORT_SYMBOL(usb_hub_tt_clear_buffer); 1199EXPORT_SYMBOL(usb_hub_tt_clear_buffer);
@@ -1208,7 +1207,6 @@ EXPORT_SYMBOL(usb_ifnum_to_if);
1208EXPORT_SYMBOL(usb_altnum_to_altsetting); 1207EXPORT_SYMBOL(usb_altnum_to_altsetting);
1209 1208
1210EXPORT_SYMBOL(usb_reset_device); 1209EXPORT_SYMBOL(usb_reset_device);
1211EXPORT_SYMBOL(usb_disconnect);
1212 1210
1213EXPORT_SYMBOL(__usb_get_extra_descriptor); 1211EXPORT_SYMBOL(__usb_get_extra_descriptor);
1214 1212
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index d80f71877d68..363b2ad74ae6 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -69,11 +69,11 @@ choice
69 often need board-specific hooks. 69 often need board-specific hooks.
70 70
71config USB_GADGET_NET2280 71config USB_GADGET_NET2280
72 boolean "NetChip 2280" 72 boolean "NetChip 228x"
73 depends on PCI 73 depends on PCI
74 select USB_GADGET_DUALSPEED 74 select USB_GADGET_DUALSPEED
75 help 75 help
76 NetChip 2280 is a PCI based USB peripheral controller which 76 NetChip 2280 / 2282 is a PCI based USB peripheral controller which
77 supports both full and high speed USB 2.0 data transfers. 77 supports both full and high speed USB 2.0 data transfers.
78 78
79 It has six configurable endpoints, as well as endpoint zero 79 It has six configurable endpoints, as well as endpoint zero
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 865858cfd1c2..b8d0b7825bf3 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1709,7 +1709,7 @@ static int __devexit at91udc_remove(struct platform_device *dev)
1709} 1709}
1710 1710
1711#ifdef CONFIG_PM 1711#ifdef CONFIG_PM
1712static int at91udc_suspend(struct platform_device *dev, u32 state, u32 level) 1712static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg)
1713{ 1713{
1714 struct at91_udc *udc = platform_get_drvdata(dev); 1714 struct at91_udc *udc = platform_get_drvdata(dev);
1715 1715
@@ -1731,7 +1731,7 @@ static int at91udc_suspend(struct platform_device *dev, u32 state, u32 level)
1731 return 0; 1731 return 0;
1732} 1732}
1733 1733
1734static int at91udc_resume(struct platform_device *dev, u32 level) 1734static int at91udc_resume(struct platform_device *dev)
1735{ 1735{
1736 struct at91_udc *udc = platform_get_drvdata(dev); 1736 struct at91_udc *udc = platform_get_drvdata(dev);
1737 1737
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index c3d8e5c5bf28..9c4422ac9de4 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2338,6 +2338,9 @@ autoconf_fail:
2338 hs_subset_descriptors(); 2338 hs_subset_descriptors();
2339 } 2339 }
2340 2340
2341 device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
2342 usb_gadget_set_selfpowered (gadget);
2343
2341 /* For now RNDIS is always a second config */ 2344 /* For now RNDIS is always a second config */
2342 if (rndis) 2345 if (rndis)
2343 device_desc.bNumConfigurations = 2; 2346 device_desc.bNumConfigurations = 2;
@@ -2361,9 +2364,6 @@ autoconf_fail:
2361#endif 2364#endif
2362#endif /* DUALSPEED */ 2365#endif /* DUALSPEED */
2363 2366
2364 device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
2365 usb_gadget_set_selfpowered (gadget);
2366
2367 if (gadget->is_otg) { 2367 if (gadget->is_otg) {
2368 otg_descriptor.bmAttributes |= USB_OTG_HNP, 2368 otg_descriptor.bmAttributes |= USB_OTG_HNP,
2369 eth_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; 2369 eth_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index cf3be299e353..6f887478b148 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -71,6 +71,12 @@
71 * requirement amounts to two 16K buffers, size configurable by a parameter. 71 * requirement amounts to two 16K buffers, size configurable by a parameter.
72 * Support is included for both full-speed and high-speed operation. 72 * Support is included for both full-speed and high-speed operation.
73 * 73 *
74 * Note that the driver is slightly non-portable in that it assumes a
75 * single memory/DMA buffer will be useable for bulk-in, bulk-out, and
76 * interrupt-in endpoints. With most device controllers this isn't an
77 * issue, but there may be some with hardware restrictions that prevent
78 * a buffer from being used by more than one endpoint.
79 *
74 * Module options: 80 * Module options:
75 * 81 *
76 * file=filename[,filename...] 82 * file=filename[,filename...]
@@ -108,6 +114,14 @@
108 * setting are not allowed when the medium is loaded. 114 * setting are not allowed when the medium is loaded.
109 * 115 *
110 * This gadget driver is heavily based on "Gadget Zero" by David Brownell. 116 * This gadget driver is heavily based on "Gadget Zero" by David Brownell.
117 * The driver's SCSI command interface was based on the "Information
118 * technology - Small Computer System Interface - 2" document from
119 * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at
120 * <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception
121 * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the
122 * "Universal Serial Bus Mass Storage Class UFI Command Specification"
123 * document, Revision 1.0, December 14, 1998, available at
124 * <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>.
111 */ 125 */
112 126
113 127
@@ -334,11 +348,9 @@ MODULE_LICENSE("Dual BSD/GPL");
334 348
335#define MAX_LUNS 8 349#define MAX_LUNS 8
336 350
337 /* Arggh! There should be a module_param_array_named macro! */
338static char *file[MAX_LUNS];
339static int ro[MAX_LUNS];
340
341static struct { 351static struct {
352 char *file[MAX_LUNS];
353 int ro[MAX_LUNS];
342 int num_filenames; 354 int num_filenames;
343 int num_ros; 355 int num_ros;
344 unsigned int nluns; 356 unsigned int nluns;
@@ -370,10 +382,11 @@ static struct {
370 }; 382 };
371 383
372 384
373module_param_array(file, charp, &mod_data.num_filenames, S_IRUGO); 385module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames,
386 S_IRUGO);
374MODULE_PARM_DESC(file, "names of backing files or devices"); 387MODULE_PARM_DESC(file, "names of backing files or devices");
375 388
376module_param_array(ro, bool, &mod_data.num_ros, S_IRUGO); 389module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO);
377MODULE_PARM_DESC(ro, "true to force read-only"); 390MODULE_PARM_DESC(ro, "true to force read-only");
378 391
379module_param_named(luns, mod_data.nluns, uint, S_IRUGO); 392module_param_named(luns, mod_data.nluns, uint, S_IRUGO);
@@ -1795,6 +1808,7 @@ static int do_write(struct fsg_dev *fsg)
1795 * the bulk-out maxpacket size */ 1808 * the bulk-out maxpacket size */
1796 bh->outreq->length = bh->bulk_out_intended_length = 1809 bh->outreq->length = bh->bulk_out_intended_length =
1797 amount; 1810 amount;
1811 bh->outreq->short_not_ok = 1;
1798 start_transfer(fsg, fsg->bulk_out, bh->outreq, 1812 start_transfer(fsg, fsg->bulk_out, bh->outreq,
1799 &bh->outreq_busy, &bh->state); 1813 &bh->outreq_busy, &bh->state);
1800 fsg->next_buffhd_to_fill = bh->next; 1814 fsg->next_buffhd_to_fill = bh->next;
@@ -2398,6 +2412,7 @@ static int throw_away_data(struct fsg_dev *fsg)
2398 * the bulk-out maxpacket size */ 2412 * the bulk-out maxpacket size */
2399 bh->outreq->length = bh->bulk_out_intended_length = 2413 bh->outreq->length = bh->bulk_out_intended_length =
2400 amount; 2414 amount;
2415 bh->outreq->short_not_ok = 1;
2401 start_transfer(fsg, fsg->bulk_out, bh->outreq, 2416 start_transfer(fsg, fsg->bulk_out, bh->outreq,
2402 &bh->outreq_busy, &bh->state); 2417 &bh->outreq_busy, &bh->state);
2403 fsg->next_buffhd_to_fill = bh->next; 2418 fsg->next_buffhd_to_fill = bh->next;
@@ -3029,6 +3044,7 @@ static int get_next_command(struct fsg_dev *fsg)
3029 3044
3030 /* Queue a request to read a Bulk-only CBW */ 3045 /* Queue a request to read a Bulk-only CBW */
3031 set_bulk_out_req_length(fsg, bh, USB_BULK_CB_WRAP_LEN); 3046 set_bulk_out_req_length(fsg, bh, USB_BULK_CB_WRAP_LEN);
3047 bh->outreq->short_not_ok = 1;
3032 start_transfer(fsg, fsg->bulk_out, bh->outreq, 3048 start_transfer(fsg, fsg->bulk_out, bh->outreq,
3033 &bh->outreq_busy, &bh->state); 3049 &bh->outreq_busy, &bh->state);
3034 3050
@@ -3859,7 +3875,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3859 3875
3860 for (i = 0; i < fsg->nluns; ++i) { 3876 for (i = 0; i < fsg->nluns; ++i) {
3861 curlun = &fsg->luns[i]; 3877 curlun = &fsg->luns[i];
3862 curlun->ro = ro[i]; 3878 curlun->ro = mod_data.ro[i];
3863 curlun->dev.parent = &gadget->dev; 3879 curlun->dev.parent = &gadget->dev;
3864 curlun->dev.driver = &fsg_driver.driver; 3880 curlun->dev.driver = &fsg_driver.driver;
3865 dev_set_drvdata(&curlun->dev, fsg); 3881 dev_set_drvdata(&curlun->dev, fsg);
@@ -3876,8 +3892,9 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3876 kref_get(&fsg->ref); 3892 kref_get(&fsg->ref);
3877 } 3893 }
3878 3894
3879 if (file[i] && *file[i]) { 3895 if (mod_data.file[i] && *mod_data.file[i]) {
3880 if ((rc = open_backing_file(curlun, file[i])) != 0) 3896 if ((rc = open_backing_file(curlun,
3897 mod_data.file[i])) != 0)
3881 goto out; 3898 goto out;
3882 } else if (!mod_data.removable) { 3899 } else if (!mod_data.removable) {
3883 ERROR(fsg, "no file given for LUN%d\n", i); 3900 ERROR(fsg, "no file given for LUN%d\n", i);
@@ -3953,6 +3970,9 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3953 for (i = 0; i < NUM_BUFFERS; ++i) { 3970 for (i = 0; i < NUM_BUFFERS; ++i) {
3954 struct fsg_buffhd *bh = &fsg->buffhds[i]; 3971 struct fsg_buffhd *bh = &fsg->buffhds[i];
3955 3972
3973 /* Allocate for the bulk-in endpoint. We assume that
3974 * the buffer will also work with the bulk-out (and
3975 * interrupt-in) endpoint. */
3956 bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, 3976 bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen,
3957 &bh->dma, GFP_KERNEL); 3977 &bh->dma, GFP_KERNEL);
3958 if (!bh->buf) 3978 if (!bh->buf)
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
index c4081407171f..aa80f0910720 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -100,9 +100,9 @@
100#define gadget_is_musbhsfc(g) 0 100#define gadget_is_musbhsfc(g) 0
101#endif 101#endif
102 102
103/* Mentor high speed "dual role" controller, peripheral mode */ 103/* Mentor high speed "dual role" controller, in peripheral role */
104#ifdef CONFIG_USB_GADGET_MUSBHDRC 104#ifdef CONFIG_USB_GADGET_MUSB_HDRC
105#define gadget_is_musbhdrc(g) !strcmp("musbhdrc_udc", (g)->name) 105#define gadget_is_musbhdrc(g) !strcmp("musb_hdrc", (g)->name)
106#else 106#else
107#define gadget_is_musbhdrc(g) 0 107#define gadget_is_musbhdrc(g) 0
108#endif 108#endif
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 3f618ce6998d..42b457030b03 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
810 if (value == 0) 810 if (value == 0)
811 data->state = STATE_EP_ENABLED; 811 data->state = STATE_EP_ENABLED;
812 break; 812 break;
813#ifdef HIGHSPEED 813#ifdef CONFIG_USB_GADGET_DUALSPEED
814 case USB_SPEED_HIGH: 814 case USB_SPEED_HIGH:
815 /* fails if caller didn't provide that descriptor... */ 815 /* fails if caller didn't provide that descriptor... */
816 value = usb_ep_enable (ep, &data->hs_desc); 816 value = usb_ep_enable (ep, &data->hs_desc);
@@ -982,7 +982,7 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
982 /* assume that was SET_CONFIGURATION */ 982 /* assume that was SET_CONFIGURATION */
983 if (dev->current_config) { 983 if (dev->current_config) {
984 unsigned power; 984 unsigned power;
985#ifdef HIGHSPEED 985#ifdef CONFIG_USB_GADGET_DUALSPEED
986 if (dev->gadget->speed == USB_SPEED_HIGH) 986 if (dev->gadget->speed == USB_SPEED_HIGH)
987 power = dev->hs_config->bMaxPower; 987 power = dev->hs_config->bMaxPower;
988 else 988 else
@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_operations = {
1262 * Unrecognized ep0 requests may be handled in user space. 1262 * Unrecognized ep0 requests may be handled in user space.
1263 */ 1263 */
1264 1264
1265#ifdef HIGHSPEED 1265#ifdef CONFIG_USB_GADGET_DUALSPEED
1266static void make_qualifier (struct dev_data *dev) 1266static void make_qualifier (struct dev_data *dev)
1267{ 1267{
1268 struct usb_qualifier_descriptor qual; 1268 struct usb_qualifier_descriptor qual;
@@ -1291,7 +1291,7 @@ static int
1291config_buf (struct dev_data *dev, u8 type, unsigned index) 1291config_buf (struct dev_data *dev, u8 type, unsigned index)
1292{ 1292{
1293 int len; 1293 int len;
1294#ifdef HIGHSPEED 1294#ifdef CONFIG_USB_GADGET_DUALSPEED
1295 int hs; 1295 int hs;
1296#endif 1296#endif
1297 1297
@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 type, unsigned index)
1299 if (index > 0) 1299 if (index > 0)
1300 return -EINVAL; 1300 return -EINVAL;
1301 1301
1302#ifdef HIGHSPEED 1302#ifdef CONFIG_USB_GADGET_DUALSPEED
1303 hs = (dev->gadget->speed == USB_SPEED_HIGH); 1303 hs = (dev->gadget->speed == USB_SPEED_HIGH);
1304 if (type == USB_DT_OTHER_SPEED_CONFIG) 1304 if (type == USB_DT_OTHER_SPEED_CONFIG)
1305 hs = !hs; 1305 hs = !hs;
@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1335 dev->state = STATE_CONNECTED; 1335 dev->state = STATE_CONNECTED;
1336 dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; 1336 dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
1337 1337
1338#ifdef HIGHSPEED 1338#ifdef CONFIG_USB_GADGET_DUALSPEED
1339 if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { 1339 if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
1340 ERROR (dev, "no high speed config??\n"); 1340 ERROR (dev, "no high speed config??\n");
1341 return -EINVAL; 1341 return -EINVAL;
1342 } 1342 }
1343#endif /* HIGHSPEED */ 1343#endif /* CONFIG_USB_GADGET_DUALSPEED */
1344 1344
1345 INFO (dev, "connected\n"); 1345 INFO (dev, "connected\n");
1346 event = next_event (dev, GADGETFS_CONNECT); 1346 event = next_event (dev, GADGETFS_CONNECT);
@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1352 /* ... down_trylock (&data->lock) ... */ 1352 /* ... down_trylock (&data->lock) ... */
1353 if (data->state != STATE_EP_DEFER_ENABLE) 1353 if (data->state != STATE_EP_DEFER_ENABLE)
1354 continue; 1354 continue;
1355#ifdef HIGHSPEED 1355#ifdef CONFIG_USB_GADGET_DUALSPEED
1356 if (gadget->speed == USB_SPEED_HIGH) 1356 if (gadget->speed == USB_SPEED_HIGH)
1357 value = usb_ep_enable (ep, &data->hs_desc); 1357 value = usb_ep_enable (ep, &data->hs_desc);
1358 else 1358 else
1359#endif /* HIGHSPEED */ 1359#endif /* CONFIG_USB_GADGET_DUALSPEED */
1360 value = usb_ep_enable (ep, &data->desc); 1360 value = usb_ep_enable (ep, &data->desc);
1361 if (value) { 1361 if (value) {
1362 ERROR (dev, "deferred %s enable --> %d\n", 1362 ERROR (dev, "deferred %s enable --> %d\n",
@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1391 value = min (w_length, (u16) sizeof *dev->dev); 1391 value = min (w_length, (u16) sizeof *dev->dev);
1392 req->buf = dev->dev; 1392 req->buf = dev->dev;
1393 break; 1393 break;
1394#ifdef HIGHSPEED 1394#ifdef CONFIG_USB_GADGET_DUALSPEED
1395 case USB_DT_DEVICE_QUALIFIER: 1395 case USB_DT_DEVICE_QUALIFIER:
1396 if (!dev->hs_config) 1396 if (!dev->hs_config)
1397 break; 1397 break;
@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1428 // user mode expected to disable endpoints 1428 // user mode expected to disable endpoints
1429 } else { 1429 } else {
1430 u8 config, power; 1430 u8 config, power;
1431#ifdef HIGHSPEED 1431#ifdef CONFIG_USB_GADGET_DUALSPEED
1432 if (gadget->speed == USB_SPEED_HIGH) { 1432 if (gadget->speed == USB_SPEED_HIGH) {
1433 config = dev->hs_config->bConfigurationValue; 1433 config = dev->hs_config->bConfigurationValue;
1434 power = dev->hs_config->bMaxPower; 1434 power = dev->hs_config->bMaxPower;
@@ -1728,7 +1728,7 @@ gadgetfs_suspend (struct usb_gadget *gadget)
1728} 1728}
1729 1729
1730static struct usb_gadget_driver gadgetfs_driver = { 1730static struct usb_gadget_driver gadgetfs_driver = {
1731#ifdef HIGHSPEED 1731#ifdef CONFIG_USB_GADGET_DUALSPEED
1732 .speed = USB_SPEED_HIGH, 1732 .speed = USB_SPEED_HIGH,
1733#else 1733#else
1734 .speed = USB_SPEED_FULL, 1734 .speed = USB_SPEED_FULL,
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index fb73dc100535..6a4b93ad1082 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -26,6 +26,8 @@
26 * Copyright (C) 2003 David Brownell 26 * Copyright (C) 2003 David Brownell
27 * Copyright (C) 2003-2005 PLX Technology, Inc. 27 * Copyright (C) 2003-2005 PLX Technology, Inc.
28 * 28 *
29 * Modified Seth Levy 2005 PLX Technology, Inc. to provide compatibility with 2282 chip
30 *
29 * This program is free software; you can redistribute it and/or modify 31 * This program is free software; you can redistribute it and/or modify
30 * it under the terms of the GNU General Public License as published by 32 * it under the terms of the GNU General Public License as published by
31 * the Free Software Foundation; either version 2 of the License, or 33 * the Free Software Foundation; either version 2 of the License, or
@@ -71,8 +73,8 @@
71#include <asm/unaligned.h> 73#include <asm/unaligned.h>
72 74
73 75
74#define DRIVER_DESC "PLX NET2280 USB Peripheral Controller" 76#define DRIVER_DESC "PLX NET228x USB Peripheral Controller"
75#define DRIVER_VERSION "2005 Feb 03" 77#define DRIVER_VERSION "2005 Sept 27"
76 78
77#define DMA_ADDR_INVALID (~(dma_addr_t)0) 79#define DMA_ADDR_INVALID (~(dma_addr_t)0)
78#define EP_DONTUSE 13 /* nonzero */ 80#define EP_DONTUSE 13 /* nonzero */
@@ -118,7 +120,7 @@ module_param (fifo_mode, ushort, 0644);
118/* enable_suspend -- When enabled, the driver will respond to 120/* enable_suspend -- When enabled, the driver will respond to
119 * USB suspend requests by powering down the NET2280. Otherwise, 121 * USB suspend requests by powering down the NET2280. Otherwise,
120 * USB suspend requests will be ignored. This is acceptible for 122 * USB suspend requests will be ignored. This is acceptible for
121 * self-powered devices, and helps avoid some quirks. 123 * self-powered devices
122 */ 124 */
123static int enable_suspend = 0; 125static int enable_suspend = 0;
124 126
@@ -223,6 +225,11 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
223 ep->is_in = (tmp & USB_DIR_IN) != 0; 225 ep->is_in = (tmp & USB_DIR_IN) != 0;
224 if (!ep->is_in) 226 if (!ep->is_in)
225 writel ((1 << SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp); 227 writel ((1 << SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp);
228 else if (dev->pdev->device != 0x2280) {
229 /* Added for 2282, Don't use nak packets on an in endpoint, this was ignored on 2280 */
230 writel ((1 << CLEAR_NAK_OUT_PACKETS)
231 | (1 << CLEAR_NAK_OUT_PACKETS_MODE), &ep->regs->ep_rsp);
232 }
226 233
227 writel (tmp, &ep->regs->ep_cfg); 234 writel (tmp, &ep->regs->ep_cfg);
228 235
@@ -232,8 +239,9 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
232 writel (tmp, &dev->regs->pciirqenb0); 239 writel (tmp, &dev->regs->pciirqenb0);
233 240
234 tmp = (1 << DATA_PACKET_RECEIVED_INTERRUPT_ENABLE) 241 tmp = (1 << DATA_PACKET_RECEIVED_INTERRUPT_ENABLE)
235 | (1 << DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE) 242 | (1 << DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE);
236 | readl (&ep->regs->ep_irqenb); 243 if (dev->pdev->device == 0x2280)
244 tmp |= readl (&ep->regs->ep_irqenb);
237 writel (tmp, &ep->regs->ep_irqenb); 245 writel (tmp, &ep->regs->ep_irqenb);
238 } else { /* dma, per-request */ 246 } else { /* dma, per-request */
239 tmp = (1 << (8 + ep->num)); /* completion */ 247 tmp = (1 << (8 + ep->num)); /* completion */
@@ -314,10 +322,18 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)
314 /* init to our chosen defaults, notably so that we NAK OUT 322 /* init to our chosen defaults, notably so that we NAK OUT
315 * packets until the driver queues a read (+note erratum 0112) 323 * packets until the driver queues a read (+note erratum 0112)
316 */ 324 */
317 tmp = (1 << SET_NAK_OUT_PACKETS_MODE) 325 if (!ep->is_in || ep->dev->pdev->device == 0x2280) {
326 tmp = (1 << SET_NAK_OUT_PACKETS_MODE)
318 | (1 << SET_NAK_OUT_PACKETS) 327 | (1 << SET_NAK_OUT_PACKETS)
319 | (1 << CLEAR_EP_HIDE_STATUS_PHASE) 328 | (1 << CLEAR_EP_HIDE_STATUS_PHASE)
320 | (1 << CLEAR_INTERRUPT_MODE); 329 | (1 << CLEAR_INTERRUPT_MODE);
330 } else {
331 /* added for 2282 */
332 tmp = (1 << CLEAR_NAK_OUT_PACKETS_MODE)
333 | (1 << CLEAR_NAK_OUT_PACKETS)
334 | (1 << CLEAR_EP_HIDE_STATUS_PHASE)
335 | (1 << CLEAR_INTERRUPT_MODE);
336 }
321 337
322 if (ep->num != 0) { 338 if (ep->num != 0) {
323 tmp |= (1 << CLEAR_ENDPOINT_TOGGLE) 339 tmp |= (1 << CLEAR_ENDPOINT_TOGGLE)
@@ -326,14 +342,18 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)
326 writel (tmp, &ep->regs->ep_rsp); 342 writel (tmp, &ep->regs->ep_rsp);
327 343
328 /* scrub most status bits, and flush any fifo state */ 344 /* scrub most status bits, and flush any fifo state */
329 writel ( (1 << TIMEOUT) 345 if (ep->dev->pdev->device == 0x2280)
346 tmp = (1 << FIFO_OVERFLOW)
347 | (1 << FIFO_UNDERFLOW);
348 else
349 tmp = 0;
350
351 writel (tmp | (1 << TIMEOUT)
330 | (1 << USB_STALL_SENT) 352 | (1 << USB_STALL_SENT)
331 | (1 << USB_IN_NAK_SENT) 353 | (1 << USB_IN_NAK_SENT)
332 | (1 << USB_IN_ACK_RCVD) 354 | (1 << USB_IN_ACK_RCVD)
333 | (1 << USB_OUT_PING_NAK_SENT) 355 | (1 << USB_OUT_PING_NAK_SENT)
334 | (1 << USB_OUT_ACK_SENT) 356 | (1 << USB_OUT_ACK_SENT)
335 | (1 << FIFO_OVERFLOW)
336 | (1 << FIFO_UNDERFLOW)
337 | (1 << FIFO_FLUSH) 357 | (1 << FIFO_FLUSH)
338 | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) 358 | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT)
339 | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) 359 | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT)
@@ -718,7 +738,7 @@ fill_dma_desc (struct net2280_ep *ep, struct net2280_request *req, int valid)
718 */ 738 */
719 if (ep->is_in) 739 if (ep->is_in)
720 dmacount |= (1 << DMA_DIRECTION); 740 dmacount |= (1 << DMA_DIRECTION);
721 else if ((dmacount % ep->ep.maxpacket) != 0) 741 if ((!ep->is_in && (dmacount % ep->ep.maxpacket) != 0) || ep->dev->pdev->device != 0x2280)
722 dmacount |= (1 << END_OF_CHAIN); 742 dmacount |= (1 << END_OF_CHAIN);
723 743
724 req->valid = valid; 744 req->valid = valid;
@@ -760,9 +780,12 @@ static inline void stop_dma (struct net2280_dma_regs __iomem *dma)
760static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma) 780static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma)
761{ 781{
762 struct net2280_dma_regs __iomem *dma = ep->dma; 782 struct net2280_dma_regs __iomem *dma = ep->dma;
783 unsigned int tmp = (1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION);
763 784
764 writel ((1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION), 785 if (ep->dev->pdev->device != 0x2280)
765 &dma->dmacount); 786 tmp |= (1 << END_OF_CHAIN);
787
788 writel (tmp, &dma->dmacount);
766 writel (readl (&dma->dmastat), &dma->dmastat); 789 writel (readl (&dma->dmastat), &dma->dmastat);
767 790
768 writel (td_dma, &dma->dmadesc); 791 writel (td_dma, &dma->dmadesc);
@@ -2110,7 +2133,11 @@ static void handle_ep_small (struct net2280_ep *ep)
2110 VDEBUG (ep->dev, "%s ack ep_stat %08x, req %p\n", 2133 VDEBUG (ep->dev, "%s ack ep_stat %08x, req %p\n",
2111 ep->ep.name, t, req ? &req->req : 0); 2134 ep->ep.name, t, req ? &req->req : 0);
2112#endif 2135#endif
2113 writel (t & ~(1 << NAK_OUT_PACKETS), &ep->regs->ep_stat); 2136 if (!ep->is_in || ep->dev->pdev->device == 0x2280)
2137 writel (t & ~(1 << NAK_OUT_PACKETS), &ep->regs->ep_stat);
2138 else
2139 /* Added for 2282 */
2140 writel (t, &ep->regs->ep_stat);
2114 2141
2115 /* for ep0, monitor token irqs to catch data stage length errors 2142 /* for ep0, monitor token irqs to catch data stage length errors
2116 * and to synchronize on status. 2143 * and to synchronize on status.
@@ -2214,7 +2241,8 @@ static void handle_ep_small (struct net2280_ep *ep)
2214 if (likely (req)) { 2241 if (likely (req)) {
2215 req->td->dmacount = 0; 2242 req->td->dmacount = 0;
2216 t = readl (&ep->regs->ep_avail); 2243 t = readl (&ep->regs->ep_avail);
2217 dma_done (ep, req, count, t); 2244 dma_done (ep, req, count,
2245 (ep->out_overflow || t) ? -EOVERFLOW : 0);
2218 } 2246 }
2219 2247
2220 /* also flush to prevent erratum 0106 trouble */ 2248 /* also flush to prevent erratum 0106 trouble */
@@ -2337,7 +2365,7 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
2337 u32 raw [2]; 2365 u32 raw [2];
2338 struct usb_ctrlrequest r; 2366 struct usb_ctrlrequest r;
2339 } u; 2367 } u;
2340 int tmp = 0; 2368 int tmp;
2341 struct net2280_request *req; 2369 struct net2280_request *req;
2342 2370
2343 if (dev->gadget.speed == USB_SPEED_UNKNOWN) { 2371 if (dev->gadget.speed == USB_SPEED_UNKNOWN) {
@@ -2364,14 +2392,19 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
2364 } 2392 }
2365 ep->stopped = 0; 2393 ep->stopped = 0;
2366 dev->protocol_stall = 0; 2394 dev->protocol_stall = 0;
2367 writel ( (1 << TIMEOUT) 2395
2396 if (ep->dev->pdev->device == 0x2280)
2397 tmp = (1 << FIFO_OVERFLOW)
2398 | (1 << FIFO_UNDERFLOW);
2399 else
2400 tmp = 0;
2401
2402 writel (tmp | (1 << TIMEOUT)
2368 | (1 << USB_STALL_SENT) 2403 | (1 << USB_STALL_SENT)
2369 | (1 << USB_IN_NAK_SENT) 2404 | (1 << USB_IN_NAK_SENT)
2370 | (1 << USB_IN_ACK_RCVD) 2405 | (1 << USB_IN_ACK_RCVD)
2371 | (1 << USB_OUT_PING_NAK_SENT) 2406 | (1 << USB_OUT_PING_NAK_SENT)
2372 | (1 << USB_OUT_ACK_SENT) 2407 | (1 << USB_OUT_ACK_SENT)
2373 | (1 << FIFO_OVERFLOW)
2374 | (1 << FIFO_UNDERFLOW)
2375 | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) 2408 | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT)
2376 | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) 2409 | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT)
2377 | (1 << DATA_PACKET_RECEIVED_INTERRUPT) 2410 | (1 << DATA_PACKET_RECEIVED_INTERRUPT)
@@ -2385,6 +2418,8 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
2385 cpu_to_le32s (&u.raw [0]); 2418 cpu_to_le32s (&u.raw [0]);
2386 cpu_to_le32s (&u.raw [1]); 2419 cpu_to_le32s (&u.raw [1]);
2387 2420
2421 tmp = 0;
2422
2388#define w_value le16_to_cpup (&u.r.wValue) 2423#define w_value le16_to_cpup (&u.r.wValue)
2389#define w_index le16_to_cpup (&u.r.wIndex) 2424#define w_index le16_to_cpup (&u.r.wIndex)
2390#define w_length le16_to_cpup (&u.r.wLength) 2425#define w_length le16_to_cpup (&u.r.wLength)
@@ -2594,10 +2629,17 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat)
2594 writel (stat, &dev->regs->irqstat1); 2629 writel (stat, &dev->regs->irqstat1);
2595 2630
2596 /* some status we can just ignore */ 2631 /* some status we can just ignore */
2597 stat &= ~((1 << CONTROL_STATUS_INTERRUPT) 2632 if (dev->pdev->device == 0x2280)
2598 | (1 << SUSPEND_REQUEST_INTERRUPT) 2633 stat &= ~((1 << CONTROL_STATUS_INTERRUPT)
2599 | (1 << RESUME_INTERRUPT) 2634 | (1 << SUSPEND_REQUEST_INTERRUPT)
2600 | (1 << SOF_INTERRUPT)); 2635 | (1 << RESUME_INTERRUPT)
2636 | (1 << SOF_INTERRUPT));
2637 else
2638 stat &= ~((1 << CONTROL_STATUS_INTERRUPT)
2639 | (1 << RESUME_INTERRUPT)
2640 | (1 << SOF_DOWN_INTERRUPT)
2641 | (1 << SOF_INTERRUPT));
2642
2601 if (!stat) 2643 if (!stat)
2602 return; 2644 return;
2603 // DEBUG (dev, "irqstat1 %08x\n", stat); 2645 // DEBUG (dev, "irqstat1 %08x\n", stat);
@@ -2939,6 +2981,13 @@ static struct pci_device_id pci_ids [] = { {
2939 .device = 0x2280, 2981 .device = 0x2280,
2940 .subvendor = PCI_ANY_ID, 2982 .subvendor = PCI_ANY_ID,
2941 .subdevice = PCI_ANY_ID, 2983 .subdevice = PCI_ANY_ID,
2984}, {
2985 .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
2986 .class_mask = ~0,
2987 .vendor = 0x17cc,
2988 .device = 0x2282,
2989 .subvendor = PCI_ANY_ID,
2990 .subdevice = PCI_ANY_ID,
2942 2991
2943}, { /* end: all zeroes */ } 2992}, { /* end: all zeroes */ }
2944}; 2993};
diff --git a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h
index fff4509cf340..957d6df34015 100644
--- a/drivers/usb/gadget/net2280.h
+++ b/drivers/usb/gadget/net2280.h
@@ -22,420 +22,7 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25/*-------------------------------------------------------------------------*/ 25#include <linux/usb/net2280.h>
26
27/* NET2280 MEMORY MAPPED REGISTERS
28 *
29 * The register layout came from the chip documentation, and the bit
30 * number definitions were extracted from chip specification.
31 *
32 * Use the shift operator ('<<') to build bit masks, with readl/writel
33 * to access the registers through PCI.
34 */
35
36/* main registers, BAR0 + 0x0000 */
37struct net2280_regs {
38 // offset 0x0000
39 u32 devinit;
40#define LOCAL_CLOCK_FREQUENCY 8
41#define FORCE_PCI_RESET 7
42#define PCI_ID 6
43#define PCI_ENABLE 5
44#define FIFO_SOFT_RESET 4
45#define CFG_SOFT_RESET 3
46#define PCI_SOFT_RESET 2
47#define USB_SOFT_RESET 1
48#define M8051_RESET 0
49 u32 eectl;
50#define EEPROM_ADDRESS_WIDTH 23
51#define EEPROM_CHIP_SELECT_ACTIVE 22
52#define EEPROM_PRESENT 21
53#define EEPROM_VALID 20
54#define EEPROM_BUSY 19
55#define EEPROM_CHIP_SELECT_ENABLE 18
56#define EEPROM_BYTE_READ_START 17
57#define EEPROM_BYTE_WRITE_START 16
58#define EEPROM_READ_DATA 8
59#define EEPROM_WRITE_DATA 0
60 u32 eeclkfreq;
61 u32 _unused0;
62 // offset 0x0010
63
64 u32 pciirqenb0; /* interrupt PCI master ... */
65#define SETUP_PACKET_INTERRUPT_ENABLE 7
66#define ENDPOINT_F_INTERRUPT_ENABLE 6
67#define ENDPOINT_E_INTERRUPT_ENABLE 5
68#define ENDPOINT_D_INTERRUPT_ENABLE 4
69#define ENDPOINT_C_INTERRUPT_ENABLE 3
70#define ENDPOINT_B_INTERRUPT_ENABLE 2
71#define ENDPOINT_A_INTERRUPT_ENABLE 1
72#define ENDPOINT_0_INTERRUPT_ENABLE 0
73 u32 pciirqenb1;
74#define PCI_INTERRUPT_ENABLE 31
75#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
76#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
77#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
78#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
79#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
80#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18
81#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
82#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
83#define GPIO_INTERRUPT_ENABLE 13
84#define DMA_D_INTERRUPT_ENABLE 12
85#define DMA_C_INTERRUPT_ENABLE 11
86#define DMA_B_INTERRUPT_ENABLE 10
87#define DMA_A_INTERRUPT_ENABLE 9
88#define EEPROM_DONE_INTERRUPT_ENABLE 8
89#define VBUS_INTERRUPT_ENABLE 7
90#define CONTROL_STATUS_INTERRUPT_ENABLE 6
91#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
92#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
93#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
94#define RESUME_INTERRUPT_ENABLE 1
95#define SOF_INTERRUPT_ENABLE 0
96 u32 cpu_irqenb0; /* ... or onboard 8051 */
97#define SETUP_PACKET_INTERRUPT_ENABLE 7
98#define ENDPOINT_F_INTERRUPT_ENABLE 6
99#define ENDPOINT_E_INTERRUPT_ENABLE 5
100#define ENDPOINT_D_INTERRUPT_ENABLE 4
101#define ENDPOINT_C_INTERRUPT_ENABLE 3
102#define ENDPOINT_B_INTERRUPT_ENABLE 2
103#define ENDPOINT_A_INTERRUPT_ENABLE 1
104#define ENDPOINT_0_INTERRUPT_ENABLE 0
105 u32 cpu_irqenb1;
106#define CPU_INTERRUPT_ENABLE 31
107#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
108#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
109#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
110#define PCI_INTA_INTERRUPT_ENABLE 24
111#define PCI_PME_INTERRUPT_ENABLE 23
112#define PCI_SERR_INTERRUPT_ENABLE 22
113#define PCI_PERR_INTERRUPT_ENABLE 21
114#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
115#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
116#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
117#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
118#define GPIO_INTERRUPT_ENABLE 13
119#define DMA_D_INTERRUPT_ENABLE 12
120#define DMA_C_INTERRUPT_ENABLE 11
121#define DMA_B_INTERRUPT_ENABLE 10
122#define DMA_A_INTERRUPT_ENABLE 9
123#define EEPROM_DONE_INTERRUPT_ENABLE 8
124#define VBUS_INTERRUPT_ENABLE 7
125#define CONTROL_STATUS_INTERRUPT_ENABLE 6
126#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
127#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
128#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
129#define RESUME_INTERRUPT_ENABLE 1
130#define SOF_INTERRUPT_ENABLE 0
131
132 // offset 0x0020
133 u32 _unused1;
134 u32 usbirqenb1;
135#define USB_INTERRUPT_ENABLE 31
136#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
137#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
138#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
139#define PCI_INTA_INTERRUPT_ENABLE 24
140#define PCI_PME_INTERRUPT_ENABLE 23
141#define PCI_SERR_INTERRUPT_ENABLE 22
142#define PCI_PERR_INTERRUPT_ENABLE 21
143#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
144#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
145#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
146#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
147#define GPIO_INTERRUPT_ENABLE 13
148#define DMA_D_INTERRUPT_ENABLE 12
149#define DMA_C_INTERRUPT_ENABLE 11
150#define DMA_B_INTERRUPT_ENABLE 10
151#define DMA_A_INTERRUPT_ENABLE 9
152#define EEPROM_DONE_INTERRUPT_ENABLE 8
153#define VBUS_INTERRUPT_ENABLE 7
154#define CONTROL_STATUS_INTERRUPT_ENABLE 6
155#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
156#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
157#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
158#define RESUME_INTERRUPT_ENABLE 1
159#define SOF_INTERRUPT_ENABLE 0
160 u32 irqstat0;
161#define INTA_ASSERTED 12
162#define SETUP_PACKET_INTERRUPT 7
163#define ENDPOINT_F_INTERRUPT 6
164#define ENDPOINT_E_INTERRUPT 5
165#define ENDPOINT_D_INTERRUPT 4
166#define ENDPOINT_C_INTERRUPT 3
167#define ENDPOINT_B_INTERRUPT 2
168#define ENDPOINT_A_INTERRUPT 1
169#define ENDPOINT_0_INTERRUPT 0
170 u32 irqstat1;
171#define POWER_STATE_CHANGE_INTERRUPT 27
172#define PCI_ARBITER_TIMEOUT_INTERRUPT 26
173#define PCI_PARITY_ERROR_INTERRUPT 25
174#define PCI_INTA_INTERRUPT 24
175#define PCI_PME_INTERRUPT 23
176#define PCI_SERR_INTERRUPT 22
177#define PCI_PERR_INTERRUPT 21
178#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20
179#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19
180#define PCI_RETRY_ABORT_INTERRUPT 17
181#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16
182#define GPIO_INTERRUPT 13
183#define DMA_D_INTERRUPT 12
184#define DMA_C_INTERRUPT 11
185#define DMA_B_INTERRUPT 10
186#define DMA_A_INTERRUPT 9
187#define EEPROM_DONE_INTERRUPT 8
188#define VBUS_INTERRUPT 7
189#define CONTROL_STATUS_INTERRUPT 6
190#define ROOT_PORT_RESET_INTERRUPT 4
191#define SUSPEND_REQUEST_INTERRUPT 3
192#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
193#define RESUME_INTERRUPT 1
194#define SOF_INTERRUPT 0
195 // offset 0x0030
196 u32 idxaddr;
197 u32 idxdata;
198 u32 fifoctl;
199#define PCI_BASE2_RANGE 16
200#define IGNORE_FIFO_AVAILABILITY 3
201#define PCI_BASE2_SELECT 2
202#define FIFO_CONFIGURATION_SELECT 0
203 u32 _unused2;
204 // offset 0x0040
205 u32 memaddr;
206#define START 28
207#define DIRECTION 27
208#define FIFO_DIAGNOSTIC_SELECT 24
209#define MEMORY_ADDRESS 0
210 u32 memdata0;
211 u32 memdata1;
212 u32 _unused3;
213 // offset 0x0050
214 u32 gpioctl;
215#define GPIO3_LED_SELECT 12
216#define GPIO3_INTERRUPT_ENABLE 11
217#define GPIO2_INTERRUPT_ENABLE 10
218#define GPIO1_INTERRUPT_ENABLE 9
219#define GPIO0_INTERRUPT_ENABLE 8
220#define GPIO3_OUTPUT_ENABLE 7
221#define GPIO2_OUTPUT_ENABLE 6
222#define GPIO1_OUTPUT_ENABLE 5
223#define GPIO0_OUTPUT_ENABLE 4
224#define GPIO3_DATA 3
225#define GPIO2_DATA 2
226#define GPIO1_DATA 1
227#define GPIO0_DATA 0
228 u32 gpiostat;
229#define GPIO3_INTERRUPT 3
230#define GPIO2_INTERRUPT 2
231#define GPIO1_INTERRUPT 1
232#define GPIO0_INTERRUPT 0
233} __attribute__ ((packed));
234
235/* usb control, BAR0 + 0x0080 */
236struct net2280_usb_regs {
237 // offset 0x0080
238 u32 stdrsp;
239#define STALL_UNSUPPORTED_REQUESTS 31
240#define SET_TEST_MODE 16
241#define GET_OTHER_SPEED_CONFIGURATION 15
242#define GET_DEVICE_QUALIFIER 14
243#define SET_ADDRESS 13
244#define ENDPOINT_SET_CLEAR_HALT 12
245#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11
246#define GET_STRING_DESCRIPTOR_2 10
247#define GET_STRING_DESCRIPTOR_1 9
248#define GET_STRING_DESCRIPTOR_0 8
249#define GET_SET_INTERFACE 6
250#define GET_SET_CONFIGURATION 5
251#define GET_CONFIGURATION_DESCRIPTOR 4
252#define GET_DEVICE_DESCRIPTOR 3
253#define GET_ENDPOINT_STATUS 2
254#define GET_INTERFACE_STATUS 1
255#define GET_DEVICE_STATUS 0
256 u32 prodvendid;
257#define PRODUCT_ID 16
258#define VENDOR_ID 0
259 u32 relnum;
260 u32 usbctl;
261#define SERIAL_NUMBER_INDEX 16
262#define PRODUCT_ID_STRING_ENABLE 13
263#define VENDOR_ID_STRING_ENABLE 12
264#define USB_ROOT_PORT_WAKEUP_ENABLE 11
265#define VBUS_PIN 10
266#define TIMED_DISCONNECT 9
267#define SUSPEND_IMMEDIATELY 7
268#define SELF_POWERED_USB_DEVICE 6
269#define REMOTE_WAKEUP_SUPPORT 5
270#define PME_POLARITY 4
271#define USB_DETECT_ENABLE 3
272#define PME_WAKEUP_ENABLE 2
273#define DEVICE_REMOTE_WAKEUP_ENABLE 1
274#define SELF_POWERED_STATUS 0
275 // offset 0x0090
276 u32 usbstat;
277#define HIGH_SPEED 7
278#define FULL_SPEED 6
279#define GENERATE_RESUME 5
280#define GENERATE_DEVICE_REMOTE_WAKEUP 4
281 u32 xcvrdiag;
282#define FORCE_HIGH_SPEED_MODE 31
283#define FORCE_FULL_SPEED_MODE 30
284#define USB_TEST_MODE 24
285#define LINE_STATE 16
286#define TRANSCEIVER_OPERATION_MODE 2
287#define TRANSCEIVER_SELECT 1
288#define TERMINATION_SELECT 0
289 u32 setup0123;
290 u32 setup4567;
291 // offset 0x0090
292 u32 _unused0;
293 u32 ouraddr;
294#define FORCE_IMMEDIATE 7
295#define OUR_USB_ADDRESS 0
296 u32 ourconfig;
297} __attribute__ ((packed));
298
299/* pci control, BAR0 + 0x0100 */
300struct net2280_pci_regs {
301 // offset 0x0100
302 u32 pcimstctl;
303#define PCI_ARBITER_PARK_SELECT 13
304#define PCI_MULTI LEVEL_ARBITER 12
305#define PCI_RETRY_ABORT_ENABLE 11
306#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10
307#define DMA_READ_MULTIPLE_ENABLE 9
308#define DMA_READ_LINE_ENABLE 8
309#define PCI_MASTER_COMMAND_SELECT 6
310#define MEM_READ_OR_WRITE 0
311#define IO_READ_OR_WRITE 1
312#define CFG_READ_OR_WRITE 2
313#define PCI_MASTER_START 5
314#define PCI_MASTER_READ_WRITE 4
315#define PCI_MASTER_WRITE 0
316#define PCI_MASTER_READ 1
317#define PCI_MASTER_BYTE_WRITE_ENABLES 0
318 u32 pcimstaddr;
319 u32 pcimstdata;
320 u32 pcimststat;
321#define PCI_ARBITER_CLEAR 2
322#define PCI_EXTERNAL_ARBITER 1
323#define PCI_HOST_MODE 0
324} __attribute__ ((packed));
325
326/* dma control, BAR0 + 0x0180 ... array of four structs like this,
327 * for channels 0..3. see also struct net2280_dma: descriptor
328 * that can be loaded into some of these registers.
329 */
330struct net2280_dma_regs { /* [11.7] */
331 // offset 0x0180, 0x01a0, 0x01c0, 0x01e0,
332 u32 dmactl;
333#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
334#define DMA_CLEAR_COUNT_ENABLE 21
335#define DESCRIPTOR_POLLING_RATE 19
336#define POLL_CONTINUOUS 0
337#define POLL_1_USEC 1
338#define POLL_100_USEC 2
339#define POLL_1_MSEC 3
340#define DMA_VALID_BIT_POLLING_ENABLE 18
341#define DMA_VALID_BIT_ENABLE 17
342#define DMA_SCATTER_GATHER_ENABLE 16
343#define DMA_OUT_AUTO_START_ENABLE 4
344#define DMA_PREEMPT_ENABLE 3
345#define DMA_FIFO_VALIDATE 2
346#define DMA_ENABLE 1
347#define DMA_ADDRESS_HOLD 0
348 u32 dmastat;
349#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25
350#define DMA_TRANSACTION_DONE_INTERRUPT 24
351#define DMA_ABORT 1
352#define DMA_START 0
353 u32 _unused0 [2];
354 // offset 0x0190, 0x01b0, 0x01d0, 0x01f0,
355 u32 dmacount;
356#define VALID_BIT 31
357#define DMA_DIRECTION 30
358#define DMA_DONE_INTERRUPT_ENABLE 29
359#define END_OF_CHAIN 28
360#define DMA_BYTE_COUNT_MASK ((1<<24)-1)
361#define DMA_BYTE_COUNT 0
362 u32 dmaaddr;
363 u32 dmadesc;
364 u32 _unused1;
365} __attribute__ ((packed));
366
367/* dedicated endpoint registers, BAR0 + 0x0200 */
368
369struct net2280_dep_regs { /* [11.8] */
370 // offset 0x0200, 0x0210, 0x220, 0x230, 0x240
371 u32 dep_cfg;
372 // offset 0x0204, 0x0214, 0x224, 0x234, 0x244
373 u32 dep_rsp;
374 u32 _unused [2];
375} __attribute__ ((packed));
376
377/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
378 * like this, for ep0 then the configurable endpoints A..F
379 * ep0 reserved for control; E and F have only 64 bytes of fifo
380 */
381struct net2280_ep_regs { /* [11.9] */
382 // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0
383 u32 ep_cfg;
384#define ENDPOINT_BYTE_COUNT 16
385#define ENDPOINT_ENABLE 10
386#define ENDPOINT_TYPE 8
387#define ENDPOINT_DIRECTION 7
388#define ENDPOINT_NUMBER 0
389 u32 ep_rsp;
390#define SET_NAK_OUT_PACKETS 15
391#define SET_EP_HIDE_STATUS_PHASE 14
392#define SET_EP_FORCE_CRC_ERROR 13
393#define SET_INTERRUPT_MODE 12
394#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11
395#define SET_NAK_OUT_PACKETS_MODE 10
396#define SET_ENDPOINT_TOGGLE 9
397#define SET_ENDPOINT_HALT 8
398#define CLEAR_NAK_OUT_PACKETS 7
399#define CLEAR_EP_HIDE_STATUS_PHASE 6
400#define CLEAR_EP_FORCE_CRC_ERROR 5
401#define CLEAR_INTERRUPT_MODE 4
402#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3
403#define CLEAR_NAK_OUT_PACKETS_MODE 2
404#define CLEAR_ENDPOINT_TOGGLE 1
405#define CLEAR_ENDPOINT_HALT 0
406 u32 ep_irqenb;
407#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6
408#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5
409#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3
410#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2
411#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1
412#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0
413 u32 ep_stat;
414#define FIFO_VALID_COUNT 24
415#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22
416#define TIMEOUT 21
417#define USB_STALL_SENT 20
418#define USB_IN_NAK_SENT 19
419#define USB_IN_ACK_RCVD 18
420#define USB_OUT_PING_NAK_SENT 17
421#define USB_OUT_ACK_SENT 16
422#define FIFO_OVERFLOW 13
423#define FIFO_UNDERFLOW 12
424#define FIFO_FULL 11
425#define FIFO_EMPTY 10
426#define FIFO_FLUSH 9
427#define SHORT_PACKET_OUT_DONE_INTERRUPT 6
428#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5
429#define NAK_OUT_PACKETS 4
430#define DATA_PACKET_RECEIVED_INTERRUPT 3
431#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
432#define DATA_OUT_PING_TOKEN_INTERRUPT 1
433#define DATA_IN_TOKEN_INTERRUPT 0
434 // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0
435 u32 ep_avail;
436 u32 ep_data;
437 u32 _unused0 [2];
438} __attribute__ ((packed));
439 26
440/*-------------------------------------------------------------------------*/ 27/*-------------------------------------------------------------------------*/
441 28
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 51424f66a765..68e3d8f5da89 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -572,9 +572,10 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req)
572 switch (status) { 572 switch (status) {
573 573
574 case 0: /* normal completion? */ 574 case 0: /* normal completion? */
575 if (ep == dev->out_ep) 575 if (ep == dev->out_ep) {
576 check_read_data (dev, ep, req); 576 check_read_data (dev, ep, req);
577 else 577 memset (req->buf, 0x55, req->length);
578 } else
578 reinit_write_data (dev, ep, req); 579 reinit_write_data (dev, ep, req);
579 break; 580 break;
580 581
@@ -626,6 +627,8 @@ source_sink_start_ep (struct usb_ep *ep, gfp_t gfp_flags)
626 627
627 if (strcmp (ep->name, EP_IN_NAME) == 0) 628 if (strcmp (ep->name, EP_IN_NAME) == 0)
628 reinit_write_data (ep->driver_data, ep, req); 629 reinit_write_data (ep->driver_data, ep, req);
630 else
631 memset (req->buf, 0x55, req->length);
629 632
630 status = usb_ep_queue (ep, req, gfp_flags); 633 status = usb_ep_queue (ep, req, gfp_flags);
631 if (status) { 634 if (status) {
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 980030d684d5..6b7350b52419 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -20,7 +20,7 @@
20#include <asm/arch/board.h> 20#include <asm/arch/board.h>
21 21
22#ifndef CONFIG_ARCH_AT91RM9200 22#ifndef CONFIG_ARCH_AT91RM9200
23#error "This file is AT91RM9200 bus glue. CONFIG_ARCH_AT91RM9200 must be defined." 23#error "CONFIG_ARCH_AT91RM9200 must be defined."
24#endif 24#endif
25 25
26/* interface and function clocks */ 26/* interface and function clocks */
@@ -84,8 +84,6 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
84 * Allocates basic resources for this USB host controller, and 84 * Allocates basic resources for this USB host controller, and
85 * then invokes the start() method for the HCD associated with it 85 * then invokes the start() method for the HCD associated with it
86 * through the hotplug entry's driver_data. 86 * through the hotplug entry's driver_data.
87 *
88 * Store this function in the HCD's struct pci_driver as probe().
89 */ 87 */
90int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) 88int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev)
91{ 89{
@@ -148,7 +146,6 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
148} 146}
149 147
150 148
151/* may be called without controller electrically present */
152/* may be called with controller, bus, and devices active */ 149/* may be called with controller, bus, and devices active */
153 150
154/** 151/**
@@ -166,11 +163,11 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde
166 usb_remove_hcd(hcd); 163 usb_remove_hcd(hcd);
167 at91_stop_hc(pdev); 164 at91_stop_hc(pdev);
168 iounmap(hcd->regs); 165 iounmap(hcd->regs);
169 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 166 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
170 167
171 clk_put(fclk); 168 clk_put(fclk);
172 clk_put(iclk); 169 clk_put(iclk);
173 fclk = iclk = NULL; 170 fclk = iclk = NULL;
174 171
175 dev_set_drvdata(&pdev->dev, NULL); 172 dev_set_drvdata(&pdev->dev, NULL);
176 return 0; 173 return 0;
@@ -235,8 +232,8 @@ static const struct hc_driver ohci_at91_hc_driver = {
235 .hub_control = ohci_hub_control, 232 .hub_control = ohci_hub_control,
236 233
237#ifdef CONFIG_PM 234#ifdef CONFIG_PM
238 .hub_suspend = ohci_hub_suspend, 235 .bus_suspend = ohci_bus_suspend,
239 .hub_resume = ohci_hub_resume, 236 .bus_resume = ohci_bus_resume,
240#endif 237#endif
241 .start_port_reset = ohci_start_port_reset, 238 .start_port_reset = ohci_start_port_reset,
242}; 239};
@@ -254,21 +251,21 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *dev)
254} 251}
255 252
256#ifdef CONFIG_PM 253#ifdef CONFIG_PM
257static int ohci_hcd_at91_drv_suspend(struct platform_device *dev, u32 state, u32 level)
258{
259 printk("%s(%s:%d): not implemented yet\n",
260 __func__, __FILE__, __LINE__);
261 254
255/* REVISIT suspend/resume look "too" simple here */
256
257static int
258ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg)
259{
262 clk_disable(fclk); 260 clk_disable(fclk);
261 clk_disable(iclk);
263 262
264 return 0; 263 return 0;
265} 264}
266 265
267static int ohci_hcd_at91_drv_resume(struct platform_device *dev, u32 state) 266static int ohci_hcd_at91_drv_resume(struct platform_device *dev)
268{ 267{
269 printk("%s(%s:%d): not implemented yet\n", 268 clk_enable(iclk);
270 __func__, __FILE__, __LINE__);
271
272 clk_enable(fclk); 269 clk_enable(fclk);
273 270
274 return 0; 271 return 0;
@@ -278,6 +275,8 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev, u32 state)
278#define ohci_hcd_at91_drv_resume NULL 275#define ohci_hcd_at91_drv_resume NULL
279#endif 276#endif
280 277
278MODULE_ALIAS("at91rm9200-ohci");
279
281static struct platform_driver ohci_hcd_at91_driver = { 280static struct platform_driver ohci_hcd_at91_driver = {
282 .probe = ohci_hcd_at91_drv_probe, 281 .probe = ohci_hcd_at91_drv_probe,
283 .remove = ohci_hcd_at91_drv_remove, 282 .remove = ohci_hcd_at91_drv_remove,
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 682bf2215660..1da5de573a6f 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -30,6 +30,7 @@
30/* clock device associated with the hcd */ 30/* clock device associated with the hcd */
31 31
32static struct clk *clk; 32static struct clk *clk;
33static struct clk *usb_clk;
33 34
34/* forward definitions */ 35/* forward definitions */
35 36
@@ -37,7 +38,7 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);
37 38
38/* conversion functions */ 39/* conversion functions */
39 40
40struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) 41static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
41{ 42{
42 return hcd->self.controller->platform_data; 43 return hcd->self.controller->platform_data;
43} 44}
@@ -47,6 +48,10 @@ static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
47 struct s3c2410_hcd_info *info = dev->dev.platform_data; 48 struct s3c2410_hcd_info *info = dev->dev.platform_data;
48 49
49 dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); 50 dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
51
52 clk_enable(usb_clk);
53 mdelay(2); /* let the bus clock stabilise */
54
50 clk_enable(clk); 55 clk_enable(clk);
51 56
52 if (info != NULL) { 57 if (info != NULL) {
@@ -75,6 +80,7 @@ static void s3c2410_stop_hc(struct platform_device *dev)
75 } 80 }
76 81
77 clk_disable(clk); 82 clk_disable(clk);
83 clk_disable(usb_clk);
78} 84}
79 85
80/* ohci_s3c2410_hub_status_data 86/* ohci_s3c2410_hub_status_data
@@ -316,7 +322,8 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
316 * 322 *
317*/ 323*/
318 324
319void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) 325static void
326usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
320{ 327{
321 usb_remove_hcd(hcd); 328 usb_remove_hcd(hcd);
322 s3c2410_stop_hc(dev); 329 s3c2410_stop_hc(dev);
@@ -334,8 +341,8 @@ void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
334 * through the hotplug entry's driver_data. 341 * through the hotplug entry's driver_data.
335 * 342 *
336 */ 343 */
337int usb_hcd_s3c2410_probe (const struct hc_driver *driver, 344static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
338 struct platform_device *dev) 345 struct platform_device *dev)
339{ 346{
340 struct usb_hcd *hcd = NULL; 347 struct usb_hcd *hcd = NULL;
341 int retval; 348 int retval;
@@ -353,14 +360,21 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
353 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 360 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
354 dev_err(&dev->dev, "request_mem_region failed"); 361 dev_err(&dev->dev, "request_mem_region failed");
355 retval = -EBUSY; 362 retval = -EBUSY;
356 goto err0; 363 goto err_put;
357 } 364 }
358 365
359 clk = clk_get(NULL, "usb-host"); 366 clk = clk_get(&dev->dev, "usb-host");
360 if (IS_ERR(clk)) { 367 if (IS_ERR(clk)) {
361 dev_err(&dev->dev, "cannot get usb-host clock\n"); 368 dev_err(&dev->dev, "cannot get usb-host clock\n");
362 retval = -ENOENT; 369 retval = -ENOENT;
363 goto err1; 370 goto err_mem;
371 }
372
373 usb_clk = clk_get(&dev->dev, "upll");
374 if (IS_ERR(usb_clk)) {
375 dev_err(&dev->dev, "cannot get usb-host clock\n");
376 retval = -ENOENT;
377 goto err_clk;
364 } 378 }
365 379
366 s3c2410_start_hc(dev, hcd); 380 s3c2410_start_hc(dev, hcd);
@@ -369,26 +383,29 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
369 if (!hcd->regs) { 383 if (!hcd->regs) {
370 dev_err(&dev->dev, "ioremap failed\n"); 384 dev_err(&dev->dev, "ioremap failed\n");
371 retval = -ENOMEM; 385 retval = -ENOMEM;
372 goto err2; 386 goto err_ioremap;
373 } 387 }
374 388
375 ohci_hcd_init(hcd_to_ohci(hcd)); 389 ohci_hcd_init(hcd_to_ohci(hcd));
376 390
377 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); 391 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
378 if (retval != 0) 392 if (retval != 0)
379 goto err2; 393 goto err_ioremap;
380 394
381 return 0; 395 return 0;
382 396
383 err2: 397 err_ioremap:
384 s3c2410_stop_hc(dev); 398 s3c2410_stop_hc(dev);
385 iounmap(hcd->regs); 399 iounmap(hcd->regs);
400 clk_put(usb_clk);
401
402 err_clk:
386 clk_put(clk); 403 clk_put(clk);
387 404
388 err1: 405 err_mem:
389 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 406 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
390 407
391 err0: 408 err_put:
392 usb_put_hcd(hcd); 409 usb_put_hcd(hcd);
393 return retval; 410 return retval;
394} 411}
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 9e81c26313f9..1045f846fbe2 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/acpi.h> 17#include <linux/acpi.h>
18#include "pci-quirks.h"
18 19
19 20
20#define UHCI_USBLEGSUP 0xc0 /* legacy support */ 21#define UHCI_USBLEGSUP 0xc0 /* legacy support */
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
new file mode 100644
index 000000000000..1564edfff6fe
--- /dev/null
+++ b/drivers/usb/host/pci-quirks.h
@@ -0,0 +1,7 @@
1#ifndef __LINUX_USB_PCI_QUIRKS_H
2#define __LINUX_USB_PCI_QUIRKS_H
3
4void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
5int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
6
7#endif /* __LINUX_USB_PCI_QUIRKS_H */
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4edb8330c440..c0c4db78b590 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -50,6 +50,7 @@
50 50
51#include "../core/hcd.h" 51#include "../core/hcd.h"
52#include "uhci-hcd.h" 52#include "uhci-hcd.h"
53#include "pci-quirks.h"
53 54
54/* 55/*
55 * Version Information 56 * Version Information
@@ -100,9 +101,6 @@ static void uhci_get_current_frame_number(struct uhci_hcd *uhci);
100#include "uhci-q.c" 101#include "uhci-q.c"
101#include "uhci-hub.c" 102#include "uhci-hub.c"
102 103
103extern void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
104extern int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
105
106/* 104/*
107 * Finish up a host controller reset and update the recorded state. 105 * Finish up a host controller reset and update the recorded state.
108 */ 106 */
@@ -117,8 +115,7 @@ static void finish_reset(struct uhci_hcd *uhci)
117 for (port = 0; port < uhci->rh_numports; ++port) 115 for (port = 0; port < uhci->rh_numports; ++port)
118 outw(0, uhci->io_addr + USBPORTSC1 + (port * 2)); 116 outw(0, uhci->io_addr + USBPORTSC1 + (port * 2));
119 117
120 uhci->port_c_suspend = uhci->suspended_ports = 118 uhci->port_c_suspend = uhci->resuming_ports = 0;
121 uhci->resuming_ports = 0;
122 uhci->rh_state = UHCI_RH_RESET; 119 uhci->rh_state = UHCI_RH_RESET;
123 uhci->is_stopped = UHCI_IS_STOPPED; 120 uhci->is_stopped = UHCI_IS_STOPPED;
124 uhci_to_hcd(uhci)->state = HC_STATE_HALT; 121 uhci_to_hcd(uhci)->state = HC_STATE_HALT;
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 4a69c7eb09bd..d5c8f4d92823 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -415,7 +415,6 @@ struct uhci_hcd {
415 415
416 /* Support for port suspend/resume/reset */ 416 /* Support for port suspend/resume/reset */
417 unsigned long port_c_suspend; /* Bit-arrays of ports */ 417 unsigned long port_c_suspend; /* Bit-arrays of ports */
418 unsigned long suspended_ports;
419 unsigned long resuming_ports; 418 unsigned long resuming_ports;
420 unsigned long ports_timeout; /* Time to stop signalling */ 419 unsigned long ports_timeout; /* Time to stop signalling */
421 420
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 152971d16769..c8451d9578f1 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -85,11 +85,10 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
85{ 85{
86 int status; 86 int status;
87 87
88 if (test_bit(port, &uhci->suspended_ports)) { 88 if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
89 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); 89 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
90 clear_bit(port, &uhci->suspended_ports); 90 if (test_bit(port, &uhci->resuming_ports))
91 clear_bit(port, &uhci->resuming_ports); 91 set_bit(port, &uhci->port_c_suspend);
92 set_bit(port, &uhci->port_c_suspend);
93 92
94 /* The controller won't actually turn off the RD bit until 93 /* The controller won't actually turn off the RD bit until
95 * it has had a chance to send a low-speed EOP sequence, 94 * it has had a chance to send a low-speed EOP sequence,
@@ -97,6 +96,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
97 * slightly longer for good luck. */ 96 * slightly longer for good luck. */
98 udelay(4); 97 udelay(4);
99 } 98 }
99 clear_bit(port, &uhci->resuming_ports);
100} 100}
101 101
102/* Wait for the UHCI controller in HP's iLO2 server management chip. 102/* Wait for the UHCI controller in HP's iLO2 server management chip.
@@ -265,8 +265,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
265 wPortChange |= USB_PORT_STAT_C_SUSPEND; 265 wPortChange |= USB_PORT_STAT_C_SUSPEND;
266 lstatus |= 1; 266 lstatus |= 1;
267 } 267 }
268 if (test_bit(port, &uhci->suspended_ports))
269 lstatus |= 2;
270 if (test_bit(port, &uhci->resuming_ports)) 268 if (test_bit(port, &uhci->resuming_ports))
271 lstatus |= 4; 269 lstatus |= 4;
272 270
@@ -309,7 +307,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
309 307
310 switch (wValue) { 308 switch (wValue) {
311 case USB_PORT_FEAT_SUSPEND: 309 case USB_PORT_FEAT_SUSPEND:
312 set_bit(port, &uhci->suspended_ports);
313 SET_RH_PORTSTAT(USBPORTSC_SUSP); 310 SET_RH_PORTSTAT(USBPORTSC_SUSP);
314 OK(0); 311 OK(0);
315 case USB_PORT_FEAT_RESET: 312 case USB_PORT_FEAT_RESET:
@@ -343,8 +340,11 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
343 CLR_RH_PORTSTAT(USBPORTSC_PEC); 340 CLR_RH_PORTSTAT(USBPORTSC_PEC);
344 OK(0); 341 OK(0);
345 case USB_PORT_FEAT_SUSPEND: 342 case USB_PORT_FEAT_SUSPEND:
346 if (test_bit(port, &uhci->suspended_ports) && 343 if (!(inw(port_addr) & USBPORTSC_SUSP)) {
347 !test_and_set_bit(port, 344
345 /* Make certain the port isn't suspended */
346 uhci_finish_suspend(uhci, port, port_addr);
347 } else if (!test_and_set_bit(port,
348 &uhci->resuming_ports)) { 348 &uhci->resuming_ports)) {
349 SET_RH_PORTSTAT(USBPORTSC_RD); 349 SET_RH_PORTSTAT(USBPORTSC_RD);
350 350
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
index 5246b35301de..650103bc9618 100644
--- a/drivers/usb/input/Kconfig
+++ b/drivers/usb/input/Kconfig
@@ -200,45 +200,41 @@ config USB_POWERMATE
200 To compile this driver as a module, choose M here: the 200 To compile this driver as a module, choose M here: the
201 module will be called powermate. 201 module will be called powermate.
202 202
203config USB_MTOUCH 203config USB_TOUCHSCREEN
204 tristate "MicroTouch USB Touchscreen Driver" 204 tristate "USB Touchscreen Driver"
205 depends on USB && INPUT 205 depends on USB && INPUT
206 ---help--- 206 ---help---
207 Say Y here if you want to use a MicroTouch (Now 3M) USB 207 USB Touchscreen driver for:
208 Touchscreen controller. 208 - eGalax Touchkit USB
209 - PanJit TouchSet USB
210 - 3M MicroTouch USB
211 - ITM
209 212
210 See <file:Documentation/usb/mtouch.txt> for additional information. 213 Have a look at <http://linux.chapter7.ch/touchkit/> for
211 214 a usage description and the required user-space stuff.
212 To compile this driver as a module, choose M here: the
213 module will be called mtouchusb.
214
215config USB_ITMTOUCH
216 tristate "ITM Touch USB Touchscreen Driver"
217 depends on USB && INPUT
218 ---help---
219 Say Y here if you want to use a ITM Touch USB
220 Touchscreen controller.
221
222 This touchscreen is used in LG 1510SF monitors.
223 215
224 To compile this driver as a module, choose M here: the 216 To compile this driver as a module, choose M here: the
225 module will be called itmtouch. 217 module will be called usbtouchscreen.
226 218
227config USB_EGALAX 219config USB_TOUCHSCREEN_EGALAX
228 tristate "eGalax TouchKit USB Touchscreen Driver" 220 default y
229 depends on USB && INPUT 221 bool "eGalax device support" if EMBEDDED
230 ---help--- 222 depends on USB_TOUCHSCREEN
231 Say Y here if you want to use a eGalax TouchKit USB
232 Touchscreen controller.
233 223
234 The driver has been tested on a Xenarc 700TSV monitor 224config USB_TOUCHSCREEN_PANJIT
235 with eGalax touchscreen. 225 default y
226 bool "PanJit device support" if EMBEDDED
227 depends on USB_TOUCHSCREEN
236 228
237 Have a look at <http://linux.chapter7.ch/touchkit/> for 229config USB_TOUCHSCREEN_3M
238 a usage description and the required user-space stuff. 230 default y
231 bool "3M/Microtouch device support" if EMBEDDED
232 depends on USB_TOUCHSCREEN
239 233
240 To compile this driver as a module, choose M here: the 234config USB_TOUCHSCREEN_ITM
241 module will be called touchkitusb. 235 default y
236 bool "ITM device support" if EMBEDDED
237 depends on USB_TOUCHSCREEN
242 238
243config USB_YEALINK 239config USB_YEALINK
244 tristate "Yealink usb-p1k voip phone" 240 tristate "Yealink usb-p1k voip phone"
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
index d512d9f488fe..764114529c56 100644
--- a/drivers/usb/input/Makefile
+++ b/drivers/usb/input/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_USB_MOUSE) += usbmouse.o
37obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o 37obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o
38obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o 38obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o
39obj-$(CONFIG_USB_EGALAX) += touchkitusb.o 39obj-$(CONFIG_USB_EGALAX) += touchkitusb.o
40obj-$(CONFIG_USB_TOUCHSCREEN) += usbtouchscreen.o
40obj-$(CONFIG_USB_POWERMATE) += powermate.o 41obj-$(CONFIG_USB_POWERMATE) += powermate.o
41obj-$(CONFIG_USB_WACOM) += wacom.o 42obj-$(CONFIG_USB_WACOM) += wacom.o
42obj-$(CONFIG_USB_ACECAD) += acecad.o 43obj-$(CONFIG_USB_ACECAD) += acecad.o
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index d4bf1701046b..f419bd82ab7f 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1372,6 +1372,11 @@ void hid_close(struct hid_device *hid)
1372 usb_kill_urb(hid->urbin); 1372 usb_kill_urb(hid->urbin);
1373} 1373}
1374 1374
1375#define USB_VENDOR_ID_PANJIT 0x134c
1376
1377#define USB_VENDOR_ID_SILVERCREST 0x062a
1378#define USB_DEVICE_ID_SILVERCREST_KB 0x0201
1379
1375/* 1380/*
1376 * Initialize all reports 1381 * Initialize all reports
1377 */ 1382 */
@@ -1655,9 +1660,12 @@ static const struct hid_blacklist {
1655 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, 1660 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE },
1656 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, 1661 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE },
1657 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, 1662 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE },
1663 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 3, HID_QUIRK_IGNORE },
1664 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 4, HID_QUIRK_IGNORE },
1658 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, 1665 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE },
1659 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, 1666 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE },
1660 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, 1667 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE },
1668 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF + 3, HID_QUIRK_IGNORE },
1661 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 1669 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
1662 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 1670 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
1663 1671
@@ -1675,6 +1683,7 @@ static const struct hid_blacklist {
1675 { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, 1683 { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET },
1676 { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, 1684 { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
1677 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 1685 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
1686 { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET },
1678 1687
1679 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, 1688 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE },
1680 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, 1689 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 },
@@ -1701,6 +1710,11 @@ static const struct hid_blacklist {
1701 { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, 1710 { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
1702 { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, 1711 { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
1703 1712
1713 { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE },
1714 { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE },
1715 { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE },
1716 { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE },
1717
1704 { 0, 0 } 1718 { 0, 0 }
1705}; 1719};
1706 1720
diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c
index 72e698658b53..d5c91ee67991 100644
--- a/drivers/usb/input/hid-ff.c
+++ b/drivers/usb/input/hid-ff.c
@@ -34,12 +34,6 @@
34 34
35#include "hid.h" 35#include "hid.h"
36 36
37/* Drivers' initializing functions */
38extern int hid_lgff_init(struct hid_device* hid);
39extern int hid_lg3d_init(struct hid_device* hid);
40extern int hid_pid_init(struct hid_device* hid);
41extern int hid_tmff_init(struct hid_device* hid);
42
43/* 37/*
44 * This table contains pointers to initializers. To add support for new 38 * This table contains pointers to initializers. To add support for new
45 * devices, you need to add the USB vendor and product ids here. 39 * devices, you need to add the USB vendor and product ids here.
diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
index 4e1b784fe527..9c62837b5b89 100644
--- a/drivers/usb/input/hid.h
+++ b/drivers/usb/input/hid.h
@@ -533,3 +533,8 @@ static inline int hid_ff_event(struct hid_device *hid, struct input_dev *input,
533 return hid->ff_event(hid, input, type, code, value); 533 return hid->ff_event(hid, input, type, code, value);
534 return -ENOSYS; 534 return -ENOSYS;
535} 535}
536
537int hid_lgff_init(struct hid_device* hid);
538int hid_tmff_init(struct hid_device* hid);
539int hid_pid_init(struct hid_device* hid);
540
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c
index b4a051b549d1..3d911976f378 100644
--- a/drivers/usb/input/keyspan_remote.c
+++ b/drivers/usb/input/keyspan_remote.c
@@ -297,6 +297,8 @@ static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs)
297 remote->data.bits_left -= 6; 297 remote->data.bits_left -= 6;
298 } else { 298 } else {
299 err("%s - Error in message, invalid toggle.\n", __FUNCTION__); 299 err("%s - Error in message, invalid toggle.\n", __FUNCTION__);
300 remote->stage = 0;
301 return;
300 } 302 }
301 303
302 keyspan_load_tester(remote, 5); 304 keyspan_load_tester(remote, 5);
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c
new file mode 100644
index 000000000000..e9a07c1e905b
--- /dev/null
+++ b/drivers/usb/input/usbtouchscreen.c
@@ -0,0 +1,605 @@
1/******************************************************************************
2 * usbtouchscreen.c
3 * Driver for USB Touchscreens, supporting those devices:
4 * - eGalax Touchkit
5 * - 3M/Microtouch
6 * - ITM
7 * - PanJit TouchSet
8 *
9 * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch>
10 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 * Driver is based on touchkitusb.c
27 * - ITM parts are from itmtouch.c
28 * - 3M parts are from mtouchusb.c
29 * - PanJit parts are from an unmerged driver by Lanslott Gish
30 *
31 *****************************************************************************/
32
33//#define DEBUG
34
35#include <linux/config.h>
36#include <linux/kernel.h>
37#include <linux/slab.h>
38#include <linux/input.h>
39#include <linux/module.h>
40#include <linux/init.h>
41#include <linux/usb.h>
42#include <linux/usb_input.h>
43
44
45#define DRIVER_VERSION "v0.3"
46#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
47#define DRIVER_DESC "USB Touchscreen Driver"
48
49static int swap_xy;
50module_param(swap_xy, bool, 0644);
51MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
52
53/* device specifc data/functions */
54struct usbtouch_usb;
55struct usbtouch_device_info {
56 int min_xc, max_xc;
57 int min_yc, max_yc;
58 int min_press, max_press;
59 int rept_size;
60 int flags;
61
62 void (*process_pkt) (struct usbtouch_usb *usbtouch, struct pt_regs *regs, unsigned char *pkt, int len);
63 int (*read_data) (unsigned char *pkt, int *x, int *y, int *touch, int *press);
64 int (*init) (struct usbtouch_usb *usbtouch);
65};
66
67#define USBTOUCH_FLG_BUFFER 0x01
68
69
70/* a usbtouch device */
71struct usbtouch_usb {
72 unsigned char *data;
73 dma_addr_t data_dma;
74 unsigned char *buffer;
75 int buf_len;
76 struct urb *irq;
77 struct usb_device *udev;
78 struct input_dev *input;
79 struct usbtouch_device_info *type;
80 char name[128];
81 char phys[64];
82};
83
84static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
85 struct pt_regs *regs, unsigned char *pkt, int len);
86
87/* device types */
88enum {
89 DEVTPYE_DUMMY = -1,
90 DEVTYPE_EGALAX,
91 DEVTYPE_PANJIT,
92 DEVTYPE_3M,
93 DEVTYPE_ITM,
94};
95
96static struct usb_device_id usbtouch_devices[] = {
97#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
98 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
99 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
100 {USB_DEVICE(0x0eef, 0x0001), .driver_info = DEVTYPE_EGALAX},
101 {USB_DEVICE(0x0eef, 0x0002), .driver_info = DEVTYPE_EGALAX},
102#endif
103
104#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
105 {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
106 {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
107 {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
108 {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
109#endif
110
111#ifdef CONFIG_USB_TOUCHSCREEN_3M
112 {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
113#endif
114
115#ifdef CONFIG_USB_TOUCHSCREEN_ITM
116 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
117#endif
118
119 {}
120};
121
122
123/*****************************************************************************
124 * eGalax part
125 */
126
127#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
128
129#define EGALAX_PKT_TYPE_MASK 0xFE
130#define EGALAX_PKT_TYPE_REPT 0x80
131#define EGALAX_PKT_TYPE_DIAG 0x0A
132
133static int egalax_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press)
134{
135 if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
136 return 0;
137
138 *x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F);
139 *y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F);
140 *touch = pkt[0] & 0x01;
141
142 return 1;
143
144}
145
146static int egalax_get_pkt_len(unsigned char *buf)
147{
148 switch (buf[0] & EGALAX_PKT_TYPE_MASK) {
149 case EGALAX_PKT_TYPE_REPT:
150 return 5;
151
152 case EGALAX_PKT_TYPE_DIAG:
153 return buf[1] + 2;
154 }
155
156 return 0;
157}
158
159static void egalax_process(struct usbtouch_usb *usbtouch, struct pt_regs *regs,
160 unsigned char *pkt, int len)
161{
162 unsigned char *buffer;
163 int pkt_len, buf_len, pos;
164
165 /* if the buffer contains data, append */
166 if (unlikely(usbtouch->buf_len)) {
167 int tmp;
168
169 /* if only 1 byte in buffer, add another one to get length */
170 if (usbtouch->buf_len == 1)
171 usbtouch->buffer[1] = pkt[0];
172
173 pkt_len = egalax_get_pkt_len(usbtouch->buffer);
174
175 /* unknown packet: drop everything */
176 if (!pkt_len)
177 return;
178
179 /* append, process */
180 tmp = pkt_len - usbtouch->buf_len;
181 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp);
182 usbtouch_process_pkt(usbtouch, regs, usbtouch->buffer, pkt_len);
183
184 buffer = pkt + tmp;
185 buf_len = len - tmp;
186 } else {
187 buffer = pkt;
188 buf_len = len;
189 }
190
191 /* only one byte left in buffer */
192 if (unlikely(buf_len == 1)) {
193 usbtouch->buffer[0] = buffer[0];
194 usbtouch->buf_len = 1;
195 return;
196 }
197
198 /* loop over the buffer */
199 pos = 0;
200 while (pos < buf_len) {
201 /* get packet len */
202 pkt_len = egalax_get_pkt_len(buffer + pos);
203
204 /* unknown packet: drop everything */
205 if (unlikely(!pkt_len))
206 return;
207
208 /* full packet: process */
209 if (likely(pkt_len <= buf_len)) {
210 usbtouch_process_pkt(usbtouch, regs, buffer + pos, pkt_len);
211 } else {
212 /* incomplete packet: save in buffer */
213 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos);
214 usbtouch->buf_len = buf_len - pos;
215 }
216 pos += pkt_len;
217 }
218}
219#endif
220
221
222/*****************************************************************************
223 * PanJit Part
224 */
225#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
226static int panjit_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press)
227{
228 *x = ((pkt[2] & 0x0F) << 8) | pkt[1];
229 *y = ((pkt[4] & 0x0F) << 8) | pkt[3];
230 *touch = pkt[0] & 0x01;
231
232 return 1;
233}
234#endif
235
236
237/*****************************************************************************
238 * 3M/Microtouch Part
239 */
240#ifdef CONFIG_USB_TOUCHSCREEN_3M
241
242#define MTOUCHUSB_ASYNC_REPORT 1
243#define MTOUCHUSB_RESET 7
244#define MTOUCHUSB_REQ_CTRLLR_ID 10
245
246static int mtouch_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press)
247{
248 *x = (pkt[8] << 8) | pkt[7];
249 *y = (pkt[10] << 8) | pkt[9];
250 *touch = (pkt[2] & 0x40) ? 1 : 0;
251
252 return 1;
253}
254
255static int mtouch_init(struct usbtouch_usb *usbtouch)
256{
257 int ret;
258
259 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
260 MTOUCHUSB_RESET,
261 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
262 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
263 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
264 __FUNCTION__, ret);
265 if (ret < 0)
266 return ret;
267
268 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
269 MTOUCHUSB_ASYNC_REPORT,
270 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
271 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
272 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
273 __FUNCTION__, ret);
274 if (ret < 0)
275 return ret;
276
277 return 0;
278}
279#endif
280
281
282/*****************************************************************************
283 * ITM Part
284 */
285#ifdef CONFIG_USB_TOUCHSCREEN_ITM
286static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press)
287{
288 *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
289 *x = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
290 *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F);
291 *touch = ~pkt[7] & 0x20;
292
293 return 1;
294}
295#endif
296
297
298/*****************************************************************************
299 * the different device descriptors
300 */
301static struct usbtouch_device_info usbtouch_dev_info[] = {
302#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
303 [DEVTYPE_EGALAX] = {
304 .min_xc = 0x0,
305 .max_xc = 0x07ff,
306 .min_yc = 0x0,
307 .max_yc = 0x07ff,
308 .rept_size = 16,
309 .flags = USBTOUCH_FLG_BUFFER,
310 .process_pkt = egalax_process,
311 .read_data = egalax_read_data,
312 },
313#endif
314
315#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
316 [DEVTYPE_PANJIT] = {
317 .min_xc = 0x0,
318 .max_xc = 0x0fff,
319 .min_yc = 0x0,
320 .max_yc = 0x0fff,
321 .rept_size = 8,
322 .read_data = panjit_read_data,
323 },
324#endif
325
326#ifdef CONFIG_USB_TOUCHSCREEN_3M
327 [DEVTYPE_3M] = {
328 .min_xc = 0x0,
329 .max_xc = 0x4000,
330 .min_yc = 0x0,
331 .max_yc = 0x4000,
332 .rept_size = 11,
333 .read_data = mtouch_read_data,
334 .init = mtouch_init,
335 },
336#endif
337
338#ifdef CONFIG_USB_TOUCHSCREEN_ITM
339 [DEVTYPE_ITM] = {
340 .min_xc = 0x0,
341 .max_xc = 0x0fff,
342 .min_yc = 0x0,
343 .max_yc = 0x0fff,
344 .max_press = 0xff,
345 .rept_size = 8,
346 .read_data = itm_read_data,
347 },
348#endif
349};
350
351
352/*****************************************************************************
353 * Generic Part
354 */
355static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
356 struct pt_regs *regs, unsigned char *pkt, int len)
357{
358 int x, y, touch, press;
359 struct usbtouch_device_info *type = usbtouch->type;
360
361 if (!type->read_data(pkt, &x, &y, &touch, &press))
362 return;
363
364 input_regs(usbtouch->input, regs);
365 input_report_key(usbtouch->input, BTN_TOUCH, touch);
366
367 if (swap_xy) {
368 input_report_abs(usbtouch->input, ABS_X, y);
369 input_report_abs(usbtouch->input, ABS_Y, x);
370 } else {
371 input_report_abs(usbtouch->input, ABS_X, x);
372 input_report_abs(usbtouch->input, ABS_Y, y);
373 }
374 if (type->max_press)
375 input_report_abs(usbtouch->input, ABS_PRESSURE, press);
376 input_sync(usbtouch->input);
377}
378
379
380static void usbtouch_irq(struct urb *urb, struct pt_regs *regs)
381{
382 struct usbtouch_usb *usbtouch = urb->context;
383 int retval;
384
385 switch (urb->status) {
386 case 0:
387 /* success */
388 break;
389 case -ETIMEDOUT:
390 /* this urb is timing out */
391 dbg("%s - urb timed out - was the device unplugged?",
392 __FUNCTION__);
393 return;
394 case -ECONNRESET:
395 case -ENOENT:
396 case -ESHUTDOWN:
397 /* this urb is terminated, clean up */
398 dbg("%s - urb shutting down with status: %d",
399 __FUNCTION__, urb->status);
400 return;
401 default:
402 dbg("%s - nonzero urb status received: %d",
403 __FUNCTION__, urb->status);
404 goto exit;
405 }
406
407 usbtouch->type->process_pkt(usbtouch, regs, usbtouch->data, urb->actual_length);
408
409exit:
410 retval = usb_submit_urb(urb, GFP_ATOMIC);
411 if (retval)
412 err("%s - usb_submit_urb failed with result: %d",
413 __FUNCTION__, retval);
414}
415
416static int usbtouch_open(struct input_dev *input)
417{
418 struct usbtouch_usb *usbtouch = input->private;
419
420 usbtouch->irq->dev = usbtouch->udev;
421
422 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
423 return -EIO;
424
425 return 0;
426}
427
428static void usbtouch_close(struct input_dev *input)
429{
430 struct usbtouch_usb *usbtouch = input->private;
431
432 usb_kill_urb(usbtouch->irq);
433}
434
435
436static void usbtouch_free_buffers(struct usb_device *udev,
437 struct usbtouch_usb *usbtouch)
438{
439 if (usbtouch->data)
440 usb_buffer_free(udev, usbtouch->type->rept_size,
441 usbtouch->data, usbtouch->data_dma);
442 kfree(usbtouch->buffer);
443}
444
445
446static int usbtouch_probe(struct usb_interface *intf,
447 const struct usb_device_id *id)
448{
449 struct usbtouch_usb *usbtouch;
450 struct input_dev *input_dev;
451 struct usb_host_interface *interface;
452 struct usb_endpoint_descriptor *endpoint;
453 struct usb_device *udev = interface_to_usbdev(intf);
454 struct usbtouch_device_info *type;
455 int err;
456
457 interface = intf->cur_altsetting;
458 endpoint = &interface->endpoint[0].desc;
459
460 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
461 input_dev = input_allocate_device();
462 if (!usbtouch || !input_dev)
463 goto out_free;
464
465 type = &usbtouch_dev_info[id->driver_info];
466 usbtouch->type = type;
467 if (!type->process_pkt)
468 type->process_pkt = usbtouch_process_pkt;
469
470 usbtouch->data = usb_buffer_alloc(udev, type->rept_size,
471 SLAB_KERNEL, &usbtouch->data_dma);
472 if (!usbtouch->data)
473 goto out_free;
474
475 if (type->flags & USBTOUCH_FLG_BUFFER) {
476 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
477 if (!usbtouch->buffer)
478 goto out_free_buffers;
479 }
480
481 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL);
482 if (!usbtouch->irq) {
483 dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__);
484 goto out_free_buffers;
485 }
486
487 usbtouch->udev = udev;
488 usbtouch->input = input_dev;
489
490 if (udev->manufacturer)
491 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name));
492
493 if (udev->product) {
494 if (udev->manufacturer)
495 strlcat(usbtouch->name, " ", sizeof(usbtouch->name));
496 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name));
497 }
498
499 if (!strlen(usbtouch->name))
500 snprintf(usbtouch->name, sizeof(usbtouch->name),
501 "USB Touchscreen %04x:%04x",
502 le16_to_cpu(udev->descriptor.idVendor),
503 le16_to_cpu(udev->descriptor.idProduct));
504
505 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys));
506 strlcpy(usbtouch->phys, "/input0", sizeof(usbtouch->phys));
507
508 input_dev->name = usbtouch->name;
509 input_dev->phys = usbtouch->phys;
510 usb_to_input_id(udev, &input_dev->id);
511 input_dev->cdev.dev = &intf->dev;
512 input_dev->private = usbtouch;
513 input_dev->open = usbtouch_open;
514 input_dev->close = usbtouch_close;
515
516 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
517 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
518 input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0);
519 input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0);
520 if (type->max_press)
521 input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
522 type->max_press, 0, 0);
523
524 usb_fill_int_urb(usbtouch->irq, usbtouch->udev,
525 usb_rcvintpipe(usbtouch->udev, 0x81),
526 usbtouch->data, type->rept_size,
527 usbtouch_irq, usbtouch, endpoint->bInterval);
528
529 usbtouch->irq->transfer_dma = usbtouch->data_dma;
530 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
531
532 /* device specific init */
533 if (type->init) {
534 err = type->init(usbtouch);
535 if (err) {
536 dbg("%s - type->init() failed, err: %d", __FUNCTION__, err);
537 goto out_free_buffers;
538 }
539 }
540
541 err = input_register_device(usbtouch->input);
542 if (err) {
543 dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err);
544 goto out_free_buffers;
545 }
546
547 usb_set_intfdata(intf, usbtouch);
548
549 return 0;
550
551out_free_buffers:
552 usbtouch_free_buffers(udev, usbtouch);
553out_free:
554 input_free_device(input_dev);
555 kfree(usbtouch);
556 return -ENOMEM;
557}
558
559static void usbtouch_disconnect(struct usb_interface *intf)
560{
561 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
562
563 dbg("%s - called", __FUNCTION__);
564
565 if (!usbtouch)
566 return;
567
568 dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
569 usb_set_intfdata(intf, NULL);
570 usb_kill_urb(usbtouch->irq);
571 input_unregister_device(usbtouch->input);
572 usb_free_urb(usbtouch->irq);
573 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
574 kfree(usbtouch);
575}
576
577MODULE_DEVICE_TABLE(usb, usbtouch_devices);
578
579static struct usb_driver usbtouch_driver = {
580 .name = "usbtouchscreen",
581 .probe = usbtouch_probe,
582 .disconnect = usbtouch_disconnect,
583 .id_table = usbtouch_devices,
584};
585
586static int __init usbtouch_init(void)
587{
588 return usb_register(&usbtouch_driver);
589}
590
591static void __exit usbtouch_cleanup(void)
592{
593 usb_deregister(&usbtouch_driver);
594}
595
596module_init(usbtouch_init);
597module_exit(usbtouch_cleanup);
598
599MODULE_AUTHOR(DRIVER_AUTHOR);
600MODULE_DESCRIPTION(DRIVER_DESC);
601MODULE_LICENSE("GPL");
602
603MODULE_ALIAS("touchkitusb");
604MODULE_ALIAS("itmtouch");
605MODULE_ALIAS("mtouchusb");
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index d3e15df9e815..cf84c6096f29 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -9,7 +9,7 @@
9 * Copyright (c) 2000 Daniel Egger <egger@suse.de> 9 * Copyright (c) 2000 Daniel Egger <egger@suse.de>
10 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> 10 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
11 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> 11 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be>
12 * Copyright (c) 2002-2005 Ping Cheng <pingc@wacom.com> 12 * Copyright (c) 2002-2006 Ping Cheng <pingc@wacom.com>
13 * 13 *
14 * ChangeLog: 14 * ChangeLog:
15 * v0.1 (vp) - Initial release 15 * v0.1 (vp) - Initial release
@@ -56,6 +56,8 @@
56 * - Merged wacom_intuos3_irq into wacom_intuos_irq 56 * - Merged wacom_intuos3_irq into wacom_intuos_irq
57 * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc. 57 * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc.
58 * - Report Device IDs 58 * - Report Device IDs
59 * v1.45 (pc) - Added support for DTF 521, Intuos3 12x12 and 12x19
60 * - Minor data report fix
59 */ 61 */
60 62
61/* 63/*
@@ -78,7 +80,7 @@
78/* 80/*
79 * Version Information 81 * Version Information
80 */ 82 */
81#define DRIVER_VERSION "v1.44" 83#define DRIVER_VERSION "v1.45"
82#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" 84#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
83#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" 85#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
84#define DRIVER_LICENSE "GPL" 86#define DRIVER_LICENSE "GPL"
@@ -99,6 +101,8 @@ enum {
99 PL, 101 PL,
100 INTUOS, 102 INTUOS,
101 INTUOS3, 103 INTUOS3,
104 INTUOS312,
105 INTUOS319,
102 CINTIQ, 106 CINTIQ,
103 MAX_TYPE 107 MAX_TYPE
104}; 108};
@@ -127,7 +131,19 @@ struct wacom {
127 char phys[32]; 131 char phys[32];
128}; 132};
129 133
134#define USB_REQ_GET_REPORT 0x01
130#define USB_REQ_SET_REPORT 0x09 135#define USB_REQ_SET_REPORT 0x09
136
137static int usb_get_report(struct usb_interface *intf, unsigned char type,
138 unsigned char id, void *buf, int size)
139{
140 return usb_control_msg(interface_to_usbdev(intf),
141 usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
142 USB_REQ_GET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
143 (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber,
144 buf, size, 100);
145}
146
131static int usb_set_report(struct usb_interface *intf, unsigned char type, 147static int usb_set_report(struct usb_interface *intf, unsigned char type,
132 unsigned char id, void *buf, int size) 148 unsigned char id, void *buf, int size)
133{ 149{
@@ -206,7 +222,8 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
206 wacom->tool[1] = BTN_TOOL_PEN; 222 wacom->tool[1] = BTN_TOOL_PEN;
207 id = STYLUS_DEVICE_ID; 223 id = STYLUS_DEVICE_ID;
208 } 224 }
209 input_report_key(dev, wacom->tool[1], id); /* report in proximity for tool */ 225 input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */
226 input_report_abs(dev, ABS_MISC, id); /* report tool id */
210 input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 227 input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
211 input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 228 input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
212 input_report_abs(dev, ABS_PRESSURE, pressure); 229 input_report_abs(dev, ABS_PRESSURE, pressure);
@@ -239,7 +256,7 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs)
239 struct wacom *wacom = urb->context; 256 struct wacom *wacom = urb->context;
240 unsigned char *data = wacom->data; 257 unsigned char *data = wacom->data;
241 struct input_dev *dev = wacom->dev; 258 struct input_dev *dev = wacom->dev;
242 int retval; 259 int retval, id;
243 260
244 switch (urb->status) { 261 switch (urb->status) {
245 case 0: 262 case 0:
@@ -263,12 +280,15 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs)
263 280
264 input_regs(dev, regs); 281 input_regs(dev, regs);
265 if (data[1] & 0x04) { 282 if (data[1] & 0x04) {
266 input_report_key(dev, BTN_TOOL_RUBBER, (data[1] & 0x20) ? ERASER_DEVICE_ID : 0); 283 input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20);
267 input_report_key(dev, BTN_TOUCH, data[1] & 0x08); 284 input_report_key(dev, BTN_TOUCH, data[1] & 0x08);
285 id = ERASER_DEVICE_ID;
268 } else { 286 } else {
269 input_report_key(dev, BTN_TOOL_PEN, (data[1] & 0x20) ? STYLUS_DEVICE_ID : 0); 287 input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20);
270 input_report_key(dev, BTN_TOUCH, data[1] & 0x01); 288 input_report_key(dev, BTN_TOUCH, data[1] & 0x01);
289 id = STYLUS_DEVICE_ID;
271 } 290 }
291 input_report_abs(dev, ABS_MISC, id); /* report tool id */
272 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); 292 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2]));
273 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4])); 293 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4]));
274 input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); 294 input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6]));
@@ -312,7 +332,8 @@ static void wacom_penpartner_irq(struct urb *urb, struct pt_regs *regs)
312 } 332 }
313 333
314 input_regs(dev, regs); 334 input_regs(dev, regs);
315 input_report_key(dev, BTN_TOOL_PEN, STYLUS_DEVICE_ID); 335 input_report_key(dev, BTN_TOOL_PEN, 1);
336 input_report_abs(dev, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
316 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); 337 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1]));
317 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); 338 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3]));
318 input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); 339 input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127);
@@ -350,6 +371,8 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
350 goto exit; 371 goto exit;
351 } 372 }
352 373
374 if (data[0] == 99) return; /* for Volito tablets */
375
353 if (data[0] != 2) { 376 if (data[0] != 2) {
354 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 377 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
355 goto exit; 378 goto exit;
@@ -374,10 +397,10 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
374 case 2: /* Mouse with wheel */ 397 case 2: /* Mouse with wheel */
375 input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); 398 input_report_key(dev, BTN_MIDDLE, data[1] & 0x04);
376 if (wacom->features->type == WACOM_G4) { 399 if (wacom->features->type == WACOM_G4) {
377 rw = data[7] & 0x04 ? -(data[7] & 0x03) : (data[7] & 0x03); 400 rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
378 input_report_rel(dev, REL_WHEEL, rw); 401 input_report_rel(dev, REL_WHEEL, -rw);
379 } else 402 } else
380 input_report_rel(dev, REL_WHEEL, (signed char) data[6]); 403 input_report_rel(dev, REL_WHEEL, -(signed char) data[6]);
381 /* fall through */ 404 /* fall through */
382 405
383 case 3: /* Mouse without wheel */ 406 case 3: /* Mouse without wheel */
@@ -406,39 +429,27 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
406 } 429 }
407 } 430 }
408 431
409 input_report_key(dev, wacom->tool[0], (data[1] & 0x10) ? id : 0); 432 if (data[1] & 0x10)
433 input_report_abs(dev, ABS_MISC, id); /* report tool id */
434 else
435 input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
436 input_report_key(dev, wacom->tool[0], data[1] & 0x10);
410 input_sync(dev); 437 input_sync(dev);
411 438
412 /* send pad data */ 439 /* send pad data */
413 if (wacom->features->type == WACOM_G4) { 440 if (wacom->features->type == WACOM_G4) {
414 /* fist time sending pad data */ 441 if ((wacom->serial[1] & 0xc0) != (data[7] & 0xf8)) {
415 if (wacom->tool[1] != BTN_TOOL_FINGER) { 442 wacom->id[1] = 1;
416 wacom->id[1] = 0; 443 wacom->serial[1] = (data[7] & 0xf8);
417 wacom->serial[1] = (data[7] & 0x38) >> 2;
418 }
419 if (data[7] & 0xf8) {
420 input_report_key(dev, BTN_0, (data[7] & 0x40)); 444 input_report_key(dev, BTN_0, (data[7] & 0x40));
421 input_report_key(dev, BTN_4, (data[7] & 0x80)); 445 input_report_key(dev, BTN_4, (data[7] & 0x80));
422 if (((data[7] & 0x38) >> 2) == (wacom->serial[1] & 0x0e)) 446 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
423 /* alter REL_WHEEL value so X apps can get it */
424 wacom->serial[1] += (wacom->serial[1] & 0x01) ? -1 : 1;
425 else
426 wacom->serial[1] = (data[7] & 0x38 ) >> 2;
427
428 /* don't alter the value when there is no wheel event */
429 if (wacom->serial[1] == 1)
430 wacom->serial[1] = 0;
431 rw = wacom->serial[1];
432 rw = (rw & 0x08) ? -(rw & 0x07) : (rw & 0x07);
433 input_report_rel(dev, REL_WHEEL, rw); 447 input_report_rel(dev, REL_WHEEL, rw);
434 wacom->tool[1] = BTN_TOOL_FINGER; 448 input_report_key(dev, BTN_TOOL_FINGER, 0xf0);
435 wacom->id[1] = data[7] & 0xf8;
436 input_report_key(dev, wacom->tool[1], 0xf0);
437 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); 449 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
438 } else if (wacom->id[1]) { 450 } else if (wacom->id[1]) {
439 wacom->id[1] = 0; 451 wacom->id[1] = 0;
440 wacom->serial[1] = 0; 452 input_report_key(dev, BTN_TOOL_FINGER, 0);
441 input_report_key(dev, wacom->tool[1], 0);
442 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); 453 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
443 } 454 }
444 input_sync(dev); 455 input_sync(dev);
@@ -516,21 +527,31 @@ static int wacom_intuos_inout(struct urb *urb)
516 default: /* Unknown tool */ 527 default: /* Unknown tool */
517 wacom->tool[idx] = BTN_TOOL_PEN; 528 wacom->tool[idx] = BTN_TOOL_PEN;
518 } 529 }
519 input_report_key(dev, wacom->tool[idx], wacom->id[idx]); 530 if(!((wacom->tool[idx] == BTN_TOOL_LENS) &&
520 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 531 ((wacom->features->type == INTUOS312)
521 input_sync(dev); 532 || (wacom->features->type == INTUOS319)))) {
533 input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */
534 input_report_key(dev, wacom->tool[idx], 1);
535 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
536 input_sync(dev);
537 }
522 return 1; 538 return 1;
523 } 539 }
524 540
525 /* Exit report */ 541 /* Exit report */
526 if ((data[1] & 0xfe) == 0x80) { 542 if ((data[1] & 0xfe) == 0x80) {
527 input_report_key(dev, wacom->tool[idx], 0); 543 input_report_key(dev, wacom->tool[idx], 0);
544 input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
528 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 545 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
529 input_sync(dev); 546 input_sync(dev);
530 return 1; 547 return 1;
531 } 548 }
532 549
533 return 0; 550 if((wacom->tool[idx] == BTN_TOOL_LENS) && ((wacom->features->type == INTUOS312)
551 || (wacom->features->type == INTUOS319)))
552 return 1;
553 else
554 return 0;
534} 555}
535 556
536static void wacom_intuos_general(struct urb *urb) 557static void wacom_intuos_general(struct urb *urb)
@@ -600,10 +621,9 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
600 /* pad packets. Works as a second tool and is always in prox */ 621 /* pad packets. Works as a second tool and is always in prox */
601 if (data[0] == 12) { 622 if (data[0] == 12) {
602 /* initiate the pad as a device */ 623 /* initiate the pad as a device */
603 if (wacom->tool[1] != BTN_TOOL_FINGER) { 624 if (wacom->tool[1] != BTN_TOOL_FINGER)
604 wacom->tool[1] = BTN_TOOL_FINGER; 625 wacom->tool[1] = BTN_TOOL_FINGER;
605 input_report_key(dev, wacom->tool[1], 1); 626
606 }
607 input_report_key(dev, BTN_0, (data[5] & 0x01)); 627 input_report_key(dev, BTN_0, (data[5] & 0x01));
608 input_report_key(dev, BTN_1, (data[5] & 0x02)); 628 input_report_key(dev, BTN_1, (data[5] & 0x02));
609 input_report_key(dev, BTN_2, (data[5] & 0x04)); 629 input_report_key(dev, BTN_2, (data[5] & 0x04));
@@ -614,6 +634,11 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
614 input_report_key(dev, BTN_7, (data[6] & 0x08)); 634 input_report_key(dev, BTN_7, (data[6] & 0x08));
615 input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); 635 input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
616 input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); 636 input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
637
638 if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2])
639 input_report_key(dev, wacom->tool[1], 1);
640 else
641 input_report_key(dev, wacom->tool[1], 0);
617 input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff); 642 input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff);
618 input_sync(dev); 643 input_sync(dev);
619 goto exit; 644 goto exit;
@@ -676,8 +701,8 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
676 input_report_key(dev, BTN_LEFT, data[8] & 0x04); 701 input_report_key(dev, BTN_LEFT, data[8] & 0x04);
677 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); 702 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
678 input_report_key(dev, BTN_RIGHT, data[8] & 0x10); 703 input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
679 input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1) 704 input_report_rel(dev, REL_WHEEL, (data[8] & 0x01)
680 - (data[8] & 0x01)); 705 - ((data[8] & 0x02) >> 1));
681 706
682 /* I3 2D mouse side buttons */ 707 /* I3 2D mouse side buttons */
683 if (wacom->features->type == INTUOS3) { 708 if (wacom->features->type == INTUOS3) {
@@ -695,7 +720,8 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
695 } 720 }
696 } 721 }
697 722
698 input_report_key(dev, wacom->tool[idx], wacom->id[idx]); 723 input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */
724 input_report_key(dev, wacom->tool[idx], 1);
699 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 725 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
700 input_sync(dev); 726 input_sync(dev);
701 727
@@ -733,7 +759,8 @@ static struct wacom_features wacom_features[] = {
733 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, 759 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq },
734 { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq }, 760 { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq },
735 { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, 761 { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq },
736 { "Wacom PL710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq }, 762 { "Wacom DTU710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq },
763 { "Wacom DTF521", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq },
737 { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq }, 764 { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq },
738 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, 765 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq },
739 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, 766 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq },
@@ -744,6 +771,8 @@ static struct wacom_features wacom_features[] = {
744 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, 771 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq },
745 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, 772 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq },
746 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, 773 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq },
774 { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS312, wacom_intuos_irq },
775 { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS319, wacom_intuos_irq },
747 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq }, 776 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq },
748 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, 777 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq },
749 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, 778 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq },
@@ -779,6 +808,7 @@ static struct usb_device_id wacom_ids[] = {
779 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, 808 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) },
780 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, 809 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) },
781 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, 810 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) },
811 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC3) },
782 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, 812 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) },
783 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, 813 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) },
784 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, 814 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) },
@@ -788,6 +818,8 @@ static struct usb_device_id wacom_ids[] = {
788 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, 818 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) },
789 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, 819 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) },
790 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, 820 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) },
821 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) },
822 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) },
791 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, 823 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) },
792 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, 824 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
793 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, 825 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
@@ -820,7 +852,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
820 struct usb_endpoint_descriptor *endpoint; 852 struct usb_endpoint_descriptor *endpoint;
821 struct wacom *wacom; 853 struct wacom *wacom;
822 struct input_dev *input_dev; 854 struct input_dev *input_dev;
823 char rep_data[2] = {0x02, 0x02}; 855 char rep_data[2], limit = 0;
824 856
825 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); 857 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
826 input_dev = input_allocate_device(); 858 input_dev = input_allocate_device();
@@ -857,6 +889,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
857 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0); 889 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0);
858 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); 890 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0);
859 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); 891 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0);
892 input_dev->absbit[LONG(ABS_MISC)] |= BIT(ABS_MISC);
860 893
861 switch (wacom->features->type) { 894 switch (wacom->features->type) {
862 case WACOM_G4: 895 case WACOM_G4:
@@ -875,6 +908,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
875 break; 908 break;
876 909
877 case INTUOS3: 910 case INTUOS3:
911 case INTUOS312:
912 case INTUOS319:
878 case CINTIQ: 913 case CINTIQ:
879 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); 914 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
880 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); 915 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
@@ -916,10 +951,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
916 951
917 input_register_device(wacom->dev); 952 input_register_device(wacom->dev);
918 953
919 /* ask the tablet to report tablet data */ 954 /* Ask the tablet to report tablet data. Repeat until it succeeds */
920 usb_set_report(intf, 3, 2, rep_data, 2); 955 do {
921 /* repeat once (not sure why the first call often fails) */ 956 rep_data[0] = 2;
922 usb_set_report(intf, 3, 2, rep_data, 2); 957 rep_data[1] = 2;
958 usb_set_report(intf, 3, 2, rep_data, 2);
959 usb_get_report(intf, 3, 2, rep_data, 2);
960 } while (rep_data[1] != 2 && limit++ < 5);
923 961
924 usb_set_intfdata(intf, wacom); 962 usb_set_intfdata(intf, wacom);
925 return 0; 963 return 0;
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 9d59b901841c..ccc5e8238bd8 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -381,6 +381,7 @@ alloc_sglist (int nents, int max, int vary)
381 381
382 for (i = 0; i < nents; i++) { 382 for (i = 0; i < nents; i++) {
383 char *buf; 383 char *buf;
384 unsigned j;
384 385
385 buf = kzalloc (size, SLAB_KERNEL); 386 buf = kzalloc (size, SLAB_KERNEL);
386 if (!buf) { 387 if (!buf) {
@@ -391,6 +392,16 @@ alloc_sglist (int nents, int max, int vary)
391 /* kmalloc pages are always physically contiguous! */ 392 /* kmalloc pages are always physically contiguous! */
392 sg_init_one(&sg[i], buf, size); 393 sg_init_one(&sg[i], buf, size);
393 394
395 switch (pattern) {
396 case 0:
397 /* already zeroed */
398 break;
399 case 1:
400 for (j = 0; j < size; j++)
401 *buf++ = (u8) (j % 63);
402 break;
403 }
404
394 if (vary) { 405 if (vary) {
395 size += vary; 406 size += vary;
396 size %= max; 407 size %= max;
@@ -425,6 +436,8 @@ static int perform_sglist (
425 usb_sg_wait (req); 436 usb_sg_wait (req);
426 retval = req->status; 437 retval = req->status;
427 438
439 /* FIXME check resulting data pattern */
440
428 /* FIXME if endpoint halted, clear halt (and log) */ 441 /* FIXME if endpoint halted, clear halt (and log) */
429 } 442 }
430 443
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index 3094970615cb..12b599a0b539 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -37,7 +37,6 @@
37 37
38#include "usbnet.h" 38#include "usbnet.h"
39 39
40
41/* ASIX AX8817X based USB 2.0 Ethernet Devices */ 40/* ASIX AX8817X based USB 2.0 Ethernet Devices */
42 41
43#define AX_CMD_SET_SW_MII 0x06 42#define AX_CMD_SET_SW_MII 0x06
@@ -109,7 +108,7 @@
109#define AX_EEPROM_MAGIC 0xdeadbeef 108#define AX_EEPROM_MAGIC 0xdeadbeef
110 109
111/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ 110/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
112struct ax8817x_data { 111struct asix_data {
113 u8 multi_filter[AX_MCAST_FILTER_SIZE]; 112 u8 multi_filter[AX_MCAST_FILTER_SIZE];
114}; 113};
115 114
@@ -121,7 +120,7 @@ struct ax88172_int_data {
121 u16 res3; 120 u16 res3;
122} __attribute__ ((packed)); 121} __attribute__ ((packed));
123 122
124static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 123static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
125 u16 size, void *data) 124 u16 size, void *data)
126{ 125{
127 return usb_control_msg( 126 return usb_control_msg(
@@ -136,7 +135,7 @@ static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
136 USB_CTRL_GET_TIMEOUT); 135 USB_CTRL_GET_TIMEOUT);
137} 136}
138 137
139static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 138static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
140 u16 size, void *data) 139 u16 size, void *data)
141{ 140{
142 return usb_control_msg( 141 return usb_control_msg(
@@ -151,19 +150,80 @@ static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
151 USB_CTRL_SET_TIMEOUT); 150 USB_CTRL_SET_TIMEOUT);
152} 151}
153 152
154static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs) 153static void asix_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
155{ 154{
156 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; 155 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
157 156
158 if (urb->status < 0) 157 if (urb->status < 0)
159 printk(KERN_DEBUG "ax8817x_async_cmd_callback() failed with %d", 158 printk(KERN_DEBUG "asix_async_cmd_callback() failed with %d",
160 urb->status); 159 urb->status);
161 160
162 kfree(req); 161 kfree(req);
163 usb_free_urb(urb); 162 usb_free_urb(urb);
164} 163}
165 164
166static void ax8817x_status(struct usbnet *dev, struct urb *urb) 165static inline int asix_set_sw_mii(struct usbnet *dev)
166{
167 int ret;
168 ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL);
169 if (ret < 0)
170 devdbg(dev, "Failed to enable software MII access");
171 return ret;
172}
173
174static inline int asix_set_hw_mii(struct usbnet *dev)
175{
176 int ret;
177 ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL);
178 if (ret < 0)
179 devdbg(dev, "Failed to enable hardware MII access");
180 return ret;
181}
182
183static inline int asix_get_phyid(struct usbnet *dev)
184{
185 int ret = 0;
186 void *buf;
187
188 buf = kmalloc(2, GFP_KERNEL);
189 if (!buf)
190 goto out1;
191
192 if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
193 0, 0, 2, buf)) < 2) {
194 devdbg(dev, "Error reading PHYID register: %02x", ret);
195 goto out2;
196 }
197 ret = *((u8 *)buf + 1);
198out2:
199 kfree(buf);
200out1:
201 return ret;
202}
203
204static int asix_sw_reset(struct usbnet *dev, u8 flags)
205{
206 int ret;
207
208 ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL);
209 if (ret < 0)
210 devdbg(dev,"Failed to send software reset: %02x", ret);
211
212 return ret;
213}
214
215static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
216{
217 int ret;
218
219 ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL);
220 if (ret < 0)
221 devdbg(dev, "Failed to write RX_CTL mode: %02x", ret);
222
223 return ret;
224}
225
226static void asix_status(struct usbnet *dev, struct urb *urb)
167{ 227{
168 struct ax88172_int_data *event; 228 struct ax88172_int_data *event;
169 int link; 229 int link;
@@ -179,12 +239,12 @@ static void ax8817x_status(struct usbnet *dev, struct urb *urb)
179 usbnet_defer_kevent (dev, EVENT_LINK_RESET ); 239 usbnet_defer_kevent (dev, EVENT_LINK_RESET );
180 } else 240 } else
181 netif_carrier_off(dev->net); 241 netif_carrier_off(dev->net);
182 devdbg(dev, "ax8817x - Link Status is: %d", link); 242 devdbg(dev, "Link Status is: %d", link);
183 } 243 }
184} 244}
185 245
186static void 246static void
187ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, 247asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
188 u16 size, void *data) 248 u16 size, void *data)
189{ 249{
190 struct usb_ctrlrequest *req; 250 struct usb_ctrlrequest *req;
@@ -211,7 +271,7 @@ ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
211 usb_fill_control_urb(urb, dev->udev, 271 usb_fill_control_urb(urb, dev->udev,
212 usb_sndctrlpipe(dev->udev, 0), 272 usb_sndctrlpipe(dev->udev, 0),
213 (void *)req, data, size, 273 (void *)req, data, size,
214 ax8817x_async_cmd_callback, req); 274 asix_async_cmd_callback, req);
215 275
216 if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 276 if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
217 deverr(dev, "Error submitting the control message: status=%d", 277 deverr(dev, "Error submitting the control message: status=%d",
@@ -221,10 +281,10 @@ ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
221 } 281 }
222} 282}
223 283
224static void ax8817x_set_multicast(struct net_device *net) 284static void asix_set_multicast(struct net_device *net)
225{ 285{
226 struct usbnet *dev = netdev_priv(net); 286 struct usbnet *dev = netdev_priv(net);
227 struct ax8817x_data *data = (struct ax8817x_data *)&dev->data; 287 struct asix_data *data = (struct asix_data *)&dev->data;
228 u8 rx_ctl = 0x8c; 288 u8 rx_ctl = 0x8c;
229 289
230 if (net->flags & IFF_PROMISC) { 290 if (net->flags & IFF_PROMISC) {
@@ -255,53 +315,51 @@ static void ax8817x_set_multicast(struct net_device *net)
255 mc_list = mc_list->next; 315 mc_list = mc_list->next;
256 } 316 }
257 317
258 ax8817x_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, 318 asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
259 AX_MCAST_FILTER_SIZE, data->multi_filter); 319 AX_MCAST_FILTER_SIZE, data->multi_filter);
260 320
261 rx_ctl |= 0x10; 321 rx_ctl |= 0x10;
262 } 322 }
263 323
264 ax8817x_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL); 324 asix_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL);
265} 325}
266 326
267static int ax8817x_mdio_read(struct net_device *netdev, int phy_id, int loc) 327static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
268{ 328{
269 struct usbnet *dev = netdev_priv(netdev); 329 struct usbnet *dev = netdev_priv(netdev);
270 u16 res; 330 u16 res;
271 u8 buf[1];
272 331
273 ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); 332 asix_set_sw_mii(dev);
274 ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, 333 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
275 (__u16)loc, 2, (u16 *)&res); 334 (__u16)loc, 2, (u16 *)&res);
276 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); 335 asix_set_hw_mii(dev);
277 336
278 return res & 0xffff; 337 return res & 0xffff;
279} 338}
280 339
281/* same as above, but converts resulting value to cpu byte order */ 340/* same as above, but converts resulting value to cpu byte order */
282static int ax8817x_mdio_read_le(struct net_device *netdev, int phy_id, int loc) 341static int asix_mdio_read_le(struct net_device *netdev, int phy_id, int loc)
283{ 342{
284 return le16_to_cpu(ax8817x_mdio_read(netdev,phy_id, loc)); 343 return le16_to_cpu(asix_mdio_read(netdev,phy_id, loc));
285} 344}
286 345
287static void 346static void
288ax8817x_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) 347asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
289{ 348{
290 struct usbnet *dev = netdev_priv(netdev); 349 struct usbnet *dev = netdev_priv(netdev);
291 u16 res = val; 350 u16 res = val;
292 u8 buf[1];
293 351
294 ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); 352 asix_set_sw_mii(dev);
295 ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, 353 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
296 (__u16)loc, 2, (u16 *)&res); 354 (__u16)loc, 2, (u16 *)&res);
297 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); 355 asix_set_hw_mii(dev);
298} 356}
299 357
300/* same as above, but converts new value to le16 byte order before writing */ 358/* same as above, but converts new value to le16 byte order before writing */
301static void 359static void
302ax8817x_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val) 360asix_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val)
303{ 361{
304 ax8817x_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) ); 362 asix_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) );
305} 363}
306 364
307static int ax88172_link_reset(struct usbnet *dev) 365static int ax88172_link_reset(struct usbnet *dev)
@@ -312,23 +370,23 @@ static int ax88172_link_reset(struct usbnet *dev)
312 u8 mode; 370 u8 mode;
313 371
314 mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN; 372 mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN;
315 lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); 373 lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA);
316 adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); 374 adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE);
317 res = mii_nway_result(lpa|adv); 375 res = mii_nway_result(lpa|adv);
318 if (res & LPA_DUPLEX) 376 if (res & LPA_DUPLEX)
319 mode |= AX_MEDIUM_FULL_DUPLEX; 377 mode |= AX_MEDIUM_FULL_DUPLEX;
320 ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); 378 asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
321 379
322 return 0; 380 return 0;
323} 381}
324 382
325static void 383static void
326ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) 384asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
327{ 385{
328 struct usbnet *dev = netdev_priv(net); 386 struct usbnet *dev = netdev_priv(net);
329 u8 opt; 387 u8 opt;
330 388
331 if (ax8817x_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) { 389 if (asix_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) {
332 wolinfo->supported = 0; 390 wolinfo->supported = 0;
333 wolinfo->wolopts = 0; 391 wolinfo->wolopts = 0;
334 return; 392 return;
@@ -344,7 +402,7 @@ ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
344} 402}
345 403
346static int 404static int
347ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) 405asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
348{ 406{
349 struct usbnet *dev = netdev_priv(net); 407 struct usbnet *dev = netdev_priv(net);
350 u8 opt = 0; 408 u8 opt = 0;
@@ -357,19 +415,19 @@ ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
357 if (opt != 0) 415 if (opt != 0)
358 opt |= AX_MONITOR_MODE; 416 opt |= AX_MONITOR_MODE;
359 417
360 if (ax8817x_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, 418 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
361 opt, 0, 0, &buf) < 0) 419 opt, 0, 0, &buf) < 0)
362 return -EINVAL; 420 return -EINVAL;
363 421
364 return 0; 422 return 0;
365} 423}
366 424
367static int ax8817x_get_eeprom_len(struct net_device *net) 425static int asix_get_eeprom_len(struct net_device *net)
368{ 426{
369 return AX_EEPROM_LEN; 427 return AX_EEPROM_LEN;
370} 428}
371 429
372static int ax8817x_get_eeprom(struct net_device *net, 430static int asix_get_eeprom(struct net_device *net,
373 struct ethtool_eeprom *eeprom, u8 *data) 431 struct ethtool_eeprom *eeprom, u8 *data)
374{ 432{
375 struct usbnet *dev = netdev_priv(net); 433 struct usbnet *dev = netdev_priv(net);
@@ -386,14 +444,14 @@ static int ax8817x_get_eeprom(struct net_device *net,
386 444
387 /* ax8817x returns 2 bytes from eeprom on read */ 445 /* ax8817x returns 2 bytes from eeprom on read */
388 for (i=0; i < eeprom->len / 2; i++) { 446 for (i=0; i < eeprom->len / 2; i++) {
389 if (ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, 447 if (asix_read_cmd(dev, AX_CMD_READ_EEPROM,
390 eeprom->offset + i, 0, 2, &ebuf[i]) < 0) 448 eeprom->offset + i, 0, 2, &ebuf[i]) < 0)
391 return -EINVAL; 449 return -EINVAL;
392 } 450 }
393 return 0; 451 return 0;
394} 452}
395 453
396static void ax8817x_get_drvinfo (struct net_device *net, 454static void asix_get_drvinfo (struct net_device *net,
397 struct ethtool_drvinfo *info) 455 struct ethtool_drvinfo *info)
398{ 456{
399 /* Inherit standard device info */ 457 /* Inherit standard device info */
@@ -401,14 +459,14 @@ static void ax8817x_get_drvinfo (struct net_device *net,
401 info->eedump_len = 0x3e; 459 info->eedump_len = 0x3e;
402} 460}
403 461
404static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd) 462static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
405{ 463{
406 struct usbnet *dev = netdev_priv(net); 464 struct usbnet *dev = netdev_priv(net);
407 465
408 return mii_ethtool_gset(&dev->mii,cmd); 466 return mii_ethtool_gset(&dev->mii,cmd);
409} 467}
410 468
411static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) 469static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
412{ 470{
413 struct usbnet *dev = netdev_priv(net); 471 struct usbnet *dev = netdev_priv(net);
414 472
@@ -418,27 +476,27 @@ static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
418/* We need to override some ethtool_ops so we require our 476/* We need to override some ethtool_ops so we require our
419 own structure so we don't interfere with other usbnet 477 own structure so we don't interfere with other usbnet
420 devices that may be connected at the same time. */ 478 devices that may be connected at the same time. */
421static struct ethtool_ops ax8817x_ethtool_ops = { 479static struct ethtool_ops ax88172_ethtool_ops = {
422 .get_drvinfo = ax8817x_get_drvinfo, 480 .get_drvinfo = asix_get_drvinfo,
423 .get_link = ethtool_op_get_link, 481 .get_link = ethtool_op_get_link,
424 .get_msglevel = usbnet_get_msglevel, 482 .get_msglevel = usbnet_get_msglevel,
425 .set_msglevel = usbnet_set_msglevel, 483 .set_msglevel = usbnet_set_msglevel,
426 .get_wol = ax8817x_get_wol, 484 .get_wol = asix_get_wol,
427 .set_wol = ax8817x_set_wol, 485 .set_wol = asix_set_wol,
428 .get_eeprom_len = ax8817x_get_eeprom_len, 486 .get_eeprom_len = asix_get_eeprom_len,
429 .get_eeprom = ax8817x_get_eeprom, 487 .get_eeprom = asix_get_eeprom,
430 .get_settings = ax8817x_get_settings, 488 .get_settings = asix_get_settings,
431 .set_settings = ax8817x_set_settings, 489 .set_settings = asix_set_settings,
432}; 490};
433 491
434static int ax8817x_ioctl (struct net_device *net, struct ifreq *rq, int cmd) 492static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
435{ 493{
436 struct usbnet *dev = netdev_priv(net); 494 struct usbnet *dev = netdev_priv(net);
437 495
438 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); 496 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
439} 497}
440 498
441static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) 499static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
442{ 500{
443 int ret = 0; 501 int ret = 0;
444 void *buf; 502 void *buf;
@@ -455,55 +513,39 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
455 513
456 /* Toggle the GPIOs in a manufacturer/model specific way */ 514 /* Toggle the GPIOs in a manufacturer/model specific way */
457 for (i = 2; i >= 0; i--) { 515 for (i = 2; i >= 0; i--) {
458 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, 516 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
459 (gpio_bits >> (i * 8)) & 0xff, 0, 0, 517 (gpio_bits >> (i * 8)) & 0xff, 0, 0,
460 buf)) < 0) 518 buf)) < 0)
461 goto out2; 519 goto out2;
462 msleep(5); 520 msleep(5);
463 } 521 }
464 522
465 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 523 if ((ret = asix_write_rx_ctl(dev,0x80)) < 0)
466 0x80, 0, 0, buf)) < 0) {
467 dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret);
468 goto out2; 524 goto out2;
469 }
470 525
471 /* Get the MAC address */ 526 /* Get the MAC address */
472 memset(buf, 0, ETH_ALEN); 527 memset(buf, 0, ETH_ALEN);
473 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, 528 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
474 0, 0, 6, buf)) < 0) { 529 0, 0, 6, buf)) < 0) {
475 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 530 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
476 goto out2; 531 goto out2;
477 } 532 }
478 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 533 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
479 534
480 /* Get the PHY id */
481 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID,
482 0, 0, 2, buf)) < 0) {
483 dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret);
484 goto out2;
485 } else if (ret < 2) {
486 /* this should always return 2 bytes */
487 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x",
488 ret);
489 ret = -EIO;
490 goto out2;
491 }
492
493 /* Initialize MII structure */ 535 /* Initialize MII structure */
494 dev->mii.dev = dev->net; 536 dev->mii.dev = dev->net;
495 dev->mii.mdio_read = ax8817x_mdio_read; 537 dev->mii.mdio_read = asix_mdio_read;
496 dev->mii.mdio_write = ax8817x_mdio_write; 538 dev->mii.mdio_write = asix_mdio_write;
497 dev->mii.phy_id_mask = 0x3f; 539 dev->mii.phy_id_mask = 0x3f;
498 dev->mii.reg_num_mask = 0x1f; 540 dev->mii.reg_num_mask = 0x1f;
499 dev->mii.phy_id = *((u8 *)buf + 1); 541 dev->mii.phy_id = asix_get_phyid(dev);
500 dev->net->do_ioctl = ax8817x_ioctl; 542 dev->net->do_ioctl = asix_ioctl;
501 543
502 dev->net->set_multicast_list = ax8817x_set_multicast; 544 dev->net->set_multicast_list = asix_set_multicast;
503 dev->net->ethtool_ops = &ax8817x_ethtool_ops; 545 dev->net->ethtool_ops = &ax88172_ethtool_ops;
504 546
505 ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); 547 asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
506 ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, 548 asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE,
507 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); 549 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
508 mii_nway_restart(&dev->mii); 550 mii_nway_restart(&dev->mii);
509 551
@@ -515,16 +557,16 @@ out1:
515} 557}
516 558
517static struct ethtool_ops ax88772_ethtool_ops = { 559static struct ethtool_ops ax88772_ethtool_ops = {
518 .get_drvinfo = ax8817x_get_drvinfo, 560 .get_drvinfo = asix_get_drvinfo,
519 .get_link = ethtool_op_get_link, 561 .get_link = ethtool_op_get_link,
520 .get_msglevel = usbnet_get_msglevel, 562 .get_msglevel = usbnet_get_msglevel,
521 .set_msglevel = usbnet_set_msglevel, 563 .set_msglevel = usbnet_set_msglevel,
522 .get_wol = ax8817x_get_wol, 564 .get_wol = asix_get_wol,
523 .set_wol = ax8817x_set_wol, 565 .set_wol = asix_set_wol,
524 .get_eeprom_len = ax8817x_get_eeprom_len, 566 .get_eeprom_len = asix_get_eeprom_len,
525 .get_eeprom = ax8817x_get_eeprom, 567 .get_eeprom = asix_get_eeprom,
526 .get_settings = ax8817x_get_settings, 568 .get_settings = asix_get_settings,
527 .set_settings = ax8817x_set_settings, 569 .set_settings = asix_set_settings,
528}; 570};
529 571
530static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) 572static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
@@ -541,62 +583,45 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
541 goto out1; 583 goto out1;
542 } 584 }
543 585
544 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, 586 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
545 0x00B0, 0, 0, buf)) < 0) 587 0x00B0, 0, 0, buf)) < 0)
546 goto out2; 588 goto out2;
547 589
548 msleep(5); 590 msleep(5);
549 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 591 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
550 0x0001, 0, 0, buf)) < 0) { 592 0x0001, 0, 0, buf)) < 0) {
551 dbg("Select PHY #1 failed: %d", ret); 593 dbg("Select PHY #1 failed: %d", ret);
552 goto out2; 594 goto out2;
553 } 595 }
554 596
555 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, 597 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD)) < 0)
556 0, 0, buf)) < 0) {
557 dbg("Failed to power down internal PHY: %d", ret);
558 goto out2; 598 goto out2;
559 }
560 599
561 msleep(150); 600 msleep(150);
562 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, 601 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0)
563 0, 0, buf)) < 0) {
564 dbg("Failed to perform software reset: %d", ret);
565 goto out2; 602 goto out2;
566 }
567 603
568 msleep(150); 604 msleep(150);
569 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, 605 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
570 AX_SWRESET_IPRL | AX_SWRESET_PRL,
571 0, 0, buf)) < 0) {
572 dbg("Failed to set Internal/External PHY reset control: %d",
573 ret);
574 goto out2; 606 goto out2;
575 }
576 607
577 msleep(150); 608 msleep(150);
578 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 609 if ((ret = asix_write_rx_ctl(dev, 0x00)) < 0)
579 0x0000, 0, 0, buf)) < 0) {
580 dbg("Failed to reset RX_CTL: %d", ret);
581 goto out2; 610 goto out2;
582 }
583 611
584 /* Get the MAC address */ 612 /* Get the MAC address */
585 memset(buf, 0, ETH_ALEN); 613 memset(buf, 0, ETH_ALEN);
586 if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, 614 if ((ret = asix_read_cmd(dev, AX88772_CMD_READ_NODE_ID,
587 0, 0, ETH_ALEN, buf)) < 0) { 615 0, 0, ETH_ALEN, buf)) < 0) {
588 dbg("Failed to read MAC address: %d", ret); 616 dbg("Failed to read MAC address: %d", ret);
589 goto out2; 617 goto out2;
590 } 618 }
591 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 619 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
592 620
593 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 621 if ((ret = asix_set_sw_mii(dev)) < 0)
594 0, 0, 0, buf)) < 0) {
595 dbg("Enabling software MII failed: %d", ret);
596 goto out2; 622 goto out2;
597 }
598 623
599 if (((ret = ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, 624 if (((ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG,
600 0x0010, 2, 2, buf)) < 0) 625 0x0010, 2, 2, buf)) < 0)
601 || (*((u16 *)buf) != 0x003b)) { 626 || (*((u16 *)buf) != 0x003b)) {
602 dbg("Read PHY register 2 must be 0x3b00: %d", ret); 627 dbg("Read PHY register 2 must be 0x3b00: %d", ret);
@@ -605,74 +630,49 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
605 630
606 /* Initialize MII structure */ 631 /* Initialize MII structure */
607 dev->mii.dev = dev->net; 632 dev->mii.dev = dev->net;
608 dev->mii.mdio_read = ax8817x_mdio_read; 633 dev->mii.mdio_read = asix_mdio_read;
609 dev->mii.mdio_write = ax8817x_mdio_write; 634 dev->mii.mdio_write = asix_mdio_write;
610 dev->mii.phy_id_mask = 0xff; 635 dev->mii.phy_id_mask = 0xff;
611 dev->mii.reg_num_mask = 0xff; 636 dev->mii.reg_num_mask = 0xff;
612 dev->net->do_ioctl = ax8817x_ioctl; 637 dev->net->do_ioctl = asix_ioctl;
638 dev->mii.phy_id = asix_get_phyid(dev);
613 639
614 /* Get the PHY id */ 640 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
615 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID,
616 0, 0, 2, buf)) < 0) {
617 dbg("Error reading PHY ID: %02x", ret);
618 goto out2; 641 goto out2;
619 } else if (ret < 2) {
620 /* this should always return 2 bytes */
621 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x",
622 ret);
623 ret = -EIO;
624 goto out2;
625 }
626 dev->mii.phy_id = *((u8 *)buf + 1);
627 642
628 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL,
629 0, 0, buf)) < 0) {
630 dbg("Set external PHY reset pin level: %d", ret);
631 goto out2;
632 }
633 msleep(150); 643 msleep(150);
634 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, 644
635 AX_SWRESET_IPRL | AX_SWRESET_PRL, 645 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
636 0, 0, buf)) < 0) {
637 dbg("Set Internal/External PHY reset control: %d", ret);
638 goto out2; 646 goto out2;
639 }
640 msleep(150);
641 647
648 msleep(150);
642 649
643 dev->net->set_multicast_list = ax8817x_set_multicast; 650 dev->net->set_multicast_list = asix_set_multicast;
644 dev->net->ethtool_ops = &ax88772_ethtool_ops; 651 dev->net->ethtool_ops = &ax88772_ethtool_ops;
645 652
646 ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); 653 asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
647 ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, 654 asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE,
648 ADVERTISE_ALL | ADVERTISE_CSMA); 655 ADVERTISE_ALL | ADVERTISE_CSMA);
649 mii_nway_restart(&dev->mii); 656 mii_nway_restart(&dev->mii);
650 657
651 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, 658 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE,
652 AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) { 659 AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) {
653 dbg("Write medium mode register: %d", ret); 660 dbg("Write medium mode register: %d", ret);
654 goto out2; 661 goto out2;
655 } 662 }
656 663
657 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, 664 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
658 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 665 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
659 AX88772_IPG2_DEFAULT, 0, buf)) < 0) { 666 AX88772_IPG2_DEFAULT, 0, buf)) < 0) {
660 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 667 dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
661 goto out2; 668 goto out2;
662 } 669 }
663 if ((ret = 670 if ((ret = asix_set_hw_mii(dev)) < 0)
664 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) {
665 dbg("Failed to set hardware MII: %02x", ret);
666 goto out2; 671 goto out2;
667 }
668 672
669 /* Set RX_CTL to default values with 2k buffer, and enable cactus */ 673 /* Set RX_CTL to default values with 2k buffer, and enable cactus */
670 if ((ret = 674 if ((ret = asix_write_rx_ctl(dev, 0x0088)) < 0)
671 ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0,
672 buf)) < 0) {
673 dbg("Reset RX_CTL failed: %d", ret);
674 goto out2; 675 goto out2;
675 }
676 676
677 kfree(buf); 677 kfree(buf);
678 678
@@ -794,23 +794,23 @@ static int ax88772_link_reset(struct usbnet *dev)
794 u16 mode; 794 u16 mode;
795 795
796 mode = AX88772_MEDIUM_DEFAULT; 796 mode = AX88772_MEDIUM_DEFAULT;
797 lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); 797 lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA);
798 adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); 798 adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE);
799 res = mii_nway_result(lpa|adv); 799 res = mii_nway_result(lpa|adv);
800 800
801 if ((res & LPA_DUPLEX) == 0) 801 if ((res & LPA_DUPLEX) == 0)
802 mode &= ~AX88772_MEDIUM_FULL_DUPLEX; 802 mode &= ~AX88772_MEDIUM_FULL_DUPLEX;
803 if ((res & LPA_100) == 0) 803 if ((res & LPA_100) == 0)
804 mode &= ~AX88772_MEDIUM_100MB; 804 mode &= ~AX88772_MEDIUM_100MB;
805 ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); 805 asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
806 806
807 return 0; 807 return 0;
808} 808}
809 809
810static const struct driver_info ax8817x_info = { 810static const struct driver_info ax8817x_info = {
811 .description = "ASIX AX8817x USB 2.0 Ethernet", 811 .description = "ASIX AX8817x USB 2.0 Ethernet",
812 .bind = ax8817x_bind, 812 .bind = ax88172_bind,
813 .status = ax8817x_status, 813 .status = asix_status,
814 .link_reset = ax88172_link_reset, 814 .link_reset = ax88172_link_reset,
815 .reset = ax88172_link_reset, 815 .reset = ax88172_link_reset,
816 .flags = FLAG_ETHER, 816 .flags = FLAG_ETHER,
@@ -819,8 +819,8 @@ static const struct driver_info ax8817x_info = {
819 819
820static const struct driver_info dlink_dub_e100_info = { 820static const struct driver_info dlink_dub_e100_info = {
821 .description = "DLink DUB-E100 USB Ethernet", 821 .description = "DLink DUB-E100 USB Ethernet",
822 .bind = ax8817x_bind, 822 .bind = ax88172_bind,
823 .status = ax8817x_status, 823 .status = asix_status,
824 .link_reset = ax88172_link_reset, 824 .link_reset = ax88172_link_reset,
825 .reset = ax88172_link_reset, 825 .reset = ax88172_link_reset,
826 .flags = FLAG_ETHER, 826 .flags = FLAG_ETHER,
@@ -829,8 +829,8 @@ static const struct driver_info dlink_dub_e100_info = {
829 829
830static const struct driver_info netgear_fa120_info = { 830static const struct driver_info netgear_fa120_info = {
831 .description = "Netgear FA-120 USB Ethernet", 831 .description = "Netgear FA-120 USB Ethernet",
832 .bind = ax8817x_bind, 832 .bind = ax88172_bind,
833 .status = ax8817x_status, 833 .status = asix_status,
834 .link_reset = ax88172_link_reset, 834 .link_reset = ax88172_link_reset,
835 .reset = ax88172_link_reset, 835 .reset = ax88172_link_reset,
836 .flags = FLAG_ETHER, 836 .flags = FLAG_ETHER,
@@ -839,8 +839,8 @@ static const struct driver_info netgear_fa120_info = {
839 839
840static const struct driver_info hawking_uf200_info = { 840static const struct driver_info hawking_uf200_info = {
841 .description = "Hawking UF200 USB Ethernet", 841 .description = "Hawking UF200 USB Ethernet",
842 .bind = ax8817x_bind, 842 .bind = ax88172_bind,
843 .status = ax8817x_status, 843 .status = asix_status,
844 .link_reset = ax88172_link_reset, 844 .link_reset = ax88172_link_reset,
845 .reset = ax88172_link_reset, 845 .reset = ax88172_link_reset,
846 .flags = FLAG_ETHER, 846 .flags = FLAG_ETHER,
@@ -850,13 +850,12 @@ static const struct driver_info hawking_uf200_info = {
850static const struct driver_info ax88772_info = { 850static const struct driver_info ax88772_info = {
851 .description = "ASIX AX88772 USB 2.0 Ethernet", 851 .description = "ASIX AX88772 USB 2.0 Ethernet",
852 .bind = ax88772_bind, 852 .bind = ax88772_bind,
853 .status = ax8817x_status, 853 .status = asix_status,
854 .link_reset = ax88772_link_reset, 854 .link_reset = ax88772_link_reset,
855 .reset = ax88772_link_reset, 855 .reset = ax88772_link_reset,
856 .flags = FLAG_ETHER | FLAG_FRAMING_AX, 856 .flags = FLAG_ETHER | FLAG_FRAMING_AX,
857 .rx_fixup = ax88772_rx_fixup, 857 .rx_fixup = ax88772_rx_fixup,
858 .tx_fixup = ax88772_tx_fixup, 858 .tx_fixup = ax88772_tx_fixup,
859 .data = 0x00130103,
860}; 859};
861 860
862static const struct usb_device_id products [] = { 861static const struct usb_device_id products [] = {
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 5b6675684567..2deb4c01539e 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -262,7 +262,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
262 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb, 262 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
263 usb_sndctrlpipe(pegasus->usb, 0), 263 usb_sndctrlpipe(pegasus->usb, 0),
264 (char *) &pegasus->dr, 264 (char *) &pegasus->dr,
265 &tmp, 1, ctrl_callback, pegasus); 265 tmp, 1, ctrl_callback, pegasus);
266 266
267 add_wait_queue(&pegasus->ctrl_wait, &wait); 267 add_wait_queue(&pegasus->ctrl_wait, &wait);
268 set_current_state(TASK_UNINTERRUPTIBLE); 268 set_current_state(TASK_UNINTERRUPTIBLE);
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c
index 49991ac1bf3b..94ddfe16fdda 100644
--- a/drivers/usb/net/rndis_host.c
+++ b/drivers/usb/net/rndis_host.c
@@ -39,6 +39,20 @@
39 * RNDIS is NDIS remoted over USB. It's a MSFT variant of CDC ACM ... of 39 * RNDIS is NDIS remoted over USB. It's a MSFT variant of CDC ACM ... of
40 * course ACM was intended for modems, not Ethernet links! USB's standard 40 * course ACM was intended for modems, not Ethernet links! USB's standard
41 * for Ethernet links is "CDC Ethernet", which is significantly simpler. 41 * for Ethernet links is "CDC Ethernet", which is significantly simpler.
42 *
43 * NOTE that Microsoft's "RNDIS 1.0" specification is incomplete. Issues
44 * include:
45 * - Power management in particular relies on information that's scattered
46 * through other documentation, and which is incomplete or incorrect even
47 * there.
48 * - There are various undocumented protocol requirements, such as the
49 * need to send unused garbage in control-OUT messages.
50 * - In some cases, MS-Windows will emit undocumented requests; this
51 * matters more to peripheral implementations than host ones.
52 *
53 * For these reasons and others, ** USE OF RNDIS IS STRONGLY DISCOURAGED ** in
54 * favor of such non-proprietary alternatives as CDC Ethernet or the newer (and
55 * currently rare) "Ethernet Emulation Model" (EEM).
42 */ 56 */
43 57
44/* 58/*
@@ -72,17 +86,17 @@ struct rndis_msg_hdr {
72 */ 86 */
73#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ 87#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */
74#define RNDIS_MSG_INIT ccpu2(0x00000002) 88#define RNDIS_MSG_INIT ccpu2(0x00000002)
75#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) 89#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
76#define RNDIS_MSG_HALT ccpu2(0x00000003) 90#define RNDIS_MSG_HALT ccpu2(0x00000003)
77#define RNDIS_MSG_QUERY ccpu2(0x00000004) 91#define RNDIS_MSG_QUERY ccpu2(0x00000004)
78#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) 92#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
79#define RNDIS_MSG_SET ccpu2(0x00000005) 93#define RNDIS_MSG_SET ccpu2(0x00000005)
80#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) 94#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
81#define RNDIS_MSG_RESET ccpu2(0x00000006) 95#define RNDIS_MSG_RESET ccpu2(0x00000006)
82#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) 96#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
83#define RNDIS_MSG_INDICATE ccpu2(0x00000007) 97#define RNDIS_MSG_INDICATE ccpu2(0x00000007)
84#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) 98#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008)
85#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 99#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
86 100
87/* codes for "status" field of completion messages */ 101/* codes for "status" field of completion messages */
88#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) 102#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000)
@@ -596,13 +610,13 @@ static struct usb_driver rndis_driver = {
596 610
597static int __init rndis_init(void) 611static int __init rndis_init(void)
598{ 612{
599 return usb_register(&rndis_driver); 613 return usb_register(&rndis_driver);
600} 614}
601module_init(rndis_init); 615module_init(rndis_init);
602 616
603static void __exit rndis_exit(void) 617static void __exit rndis_exit(void)
604{ 618{
605 usb_deregister(&rndis_driver); 619 usb_deregister(&rndis_driver);
606} 620}
607module_exit(rndis_exit); 621module_exit(rndis_exit);
608 622
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 5a8a2c91c2b2..f96b73f54bf1 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -158,6 +158,15 @@ config USB_SERIAL_FTDI_SIO
158 To compile this driver as a module, choose M here: the 158 To compile this driver as a module, choose M here: the
159 module will be called ftdi_sio. 159 module will be called ftdi_sio.
160 160
161config USB_SERIAL_FUNSOFT
162 tristate "USB Fundamental Software Dongle Driver"
163 depends on USB_SERIAL
164 ---help---
165 Say Y here if you want to use the Fundamental Software dongle.
166
167 To compile this driver as a module, choose M here: the
168 module will be called funsoft.
169
161config USB_SERIAL_VISOR 170config USB_SERIAL_VISOR
162 tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver" 171 tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver"
163 depends on USB_SERIAL 172 depends on USB_SERIAL
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index f7fe4172efed..93c21245b1af 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_SERIAL_EDGEPORT) += io_edgeport.o
22obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o 22obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o
23obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o 23obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o
24obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o 24obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o
25obj-$(CONFIG_USB_SERIAL_FUNSOFT) += funsoft.o
25obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o 26obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o
26obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o 27obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o
27obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o 28obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 167f8ec56131..8023bb7279b1 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -54,7 +54,7 @@ static struct console usbcons;
54 * serial.c code, except that the specifier is "ttyUSB" instead 54 * serial.c code, except that the specifier is "ttyUSB" instead
55 * of "ttyS". 55 * of "ttyS".
56 */ 56 */
57static int __init usb_console_setup(struct console *co, char *options) 57static int usb_console_setup(struct console *co, char *options)
58{ 58{
59 struct usbcons_info *info = &usbcons_info; 59 struct usbcons_info *info = &usbcons_info;
60 int baud = 9600; 60 int baud = 9600;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index f3af81b4dd29..f5851db67f5b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -489,10 +489,12 @@ static struct usb_device_id id_table_combined [] = {
489 { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, 489 { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) },
490 { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, 490 { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) },
491 { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, 491 { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) },
492 { USB_DEVICE(FTDI_VID, FTDI_ECLO_COM_1WIRE_PID) },
492 { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, 493 { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) },
493 { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, 494 { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) },
494 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 495 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
495 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, 496 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) },
497 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
496 { }, /* Optional parameter entry */ 498 { }, /* Optional parameter entry */
497 { } /* Terminating entry */ 499 { } /* Terminating entry */
498}; 500};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 8da773c2744d..2155f0e4a378 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -399,6 +399,21 @@
399#define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */ 399#define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */
400#define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */ 400#define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */
401 401
402/*
403 * Eclo (http://www.eclo.pt/) product IDs.
404 * PID 0xEA90 submitted by Martin Grill.
405 */
406#define FTDI_ECLO_COM_1WIRE_PID 0xEA90 /* COM to 1-Wire USB adaptor */
407
408/*
409 * Papouch products (http://www.papouch.com/)
410 * Submitted by Folkert van Heusden
411 */
412
413#define PAPOUCH_VID 0x5050 /* Vendor ID */
414#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
415
416
402/* Commands */ 417/* Commands */
403#define FTDI_SIO_RESET 0 /* Reset the port */ 418#define FTDI_SIO_RESET 0 /* Reset the port */
404#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 419#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
new file mode 100644
index 000000000000..803721b97e2e
--- /dev/null
+++ b/drivers/usb/serial/funsoft.c
@@ -0,0 +1,65 @@
1/*
2 * Funsoft Serial USB driver
3 *
4 * Copyright (C) 2006 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/tty.h>
14#include <linux/module.h>
15#include <linux/usb.h>
16#include "usb-serial.h"
17
18static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0x1404, 0xcddc) },
20 { },
21};
22MODULE_DEVICE_TABLE(usb, id_table);
23
24static struct usb_driver funsoft_driver = {
25 .name = "funsoft",
26 .probe = usb_serial_probe,
27 .disconnect = usb_serial_disconnect,
28 .id_table = id_table,
29 .no_dynamic_id = 1,
30};
31
32static struct usb_serial_driver funsoft_device = {
33 .driver = {
34 .owner = THIS_MODULE,
35 .name = "funsoft",
36 },
37 .id_table = id_table,
38 .num_interrupt_in = NUM_DONT_CARE,
39 .num_bulk_in = NUM_DONT_CARE,
40 .num_bulk_out = NUM_DONT_CARE,
41 .num_ports = 1,
42};
43
44static int __init funsoft_init(void)
45{
46 int retval;
47
48 retval = usb_serial_register(&funsoft_device);
49 if (retval)
50 return retval;
51 retval = usb_register(&funsoft_driver);
52 if (retval)
53 usb_serial_deregister(&funsoft_device);
54 return retval;
55}
56
57static void __exit funsoft_exit(void)
58{
59 usb_deregister(&funsoft_driver);
60 usb_serial_deregister(&funsoft_device);
61}
62
63module_init(funsoft_init);
64module_exit(funsoft_exit);
65MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 495db5755df9..5cf2b80add7a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -28,6 +28,7 @@
28 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard 28 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard
29 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes 29 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes
30 wants to send >2000 bytes. 30 wants to send >2000 bytes.
31 2006-04-10 v0.4.2 fixed two array overrun errors :-/
31 32
32 Work sponsored by: Sigos GmbH, Germany <info@sigos.de> 33 Work sponsored by: Sigos GmbH, Germany <info@sigos.de>
33 34
@@ -582,14 +583,14 @@ static void option_setup_urbs(struct usb_serial *serial)
582 portdata = usb_get_serial_port_data(port); 583 portdata = usb_get_serial_port_data(port);
583 584
584 /* Do indat endpoints first */ 585 /* Do indat endpoints first */
585 for (j = 0; j <= N_IN_URB; ++j) { 586 for (j = 0; j < N_IN_URB; ++j) {
586 portdata->in_urbs[j] = option_setup_urb (serial, 587 portdata->in_urbs[j] = option_setup_urb (serial,
587 port->bulk_in_endpointAddress, USB_DIR_IN, port, 588 port->bulk_in_endpointAddress, USB_DIR_IN, port,
588 portdata->in_buffer[j], IN_BUFLEN, option_indat_callback); 589 portdata->in_buffer[j], IN_BUFLEN, option_indat_callback);
589 } 590 }
590 591
591 /* outdat endpoints */ 592 /* outdat endpoints */
592 for (j = 0; j <= N_OUT_URB; ++j) { 593 for (j = 0; j < N_OUT_URB; ++j) {
593 portdata->out_urbs[j] = option_setup_urb (serial, 594 portdata->out_urbs[j] = option_setup_urb (serial,
594 port->bulk_out_endpointAddress, USB_DIR_OUT, port, 595 port->bulk_out_endpointAddress, USB_DIR_OUT, port,
595 portdata->out_buffer[j], OUT_BUFLEN, option_outdat_callback); 596 portdata->out_buffer[j], OUT_BUFLEN, option_outdat_callback);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index b3014fda645c..ccf746b27d4e 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -78,6 +78,7 @@ static struct usb_device_id id_table [] = {
78 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, 78 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) },
79 { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, 79 { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) },
80 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, 80 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) },
81 { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) },
81 { } /* Terminating entry */ 82 { } /* Terminating entry */
82}; 83};
83 84
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 77901d143979..09f379b19e98 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -79,3 +79,7 @@
79/* USB GSM cable from Speed Dragon Multimedia, Ltd */ 79/* USB GSM cable from Speed Dragon Multimedia, Ltd */
80#define SPEEDDRAGON_VENDOR_ID 0x0e55 80#define SPEEDDRAGON_VENDOR_ID 0x0e55
81#define SPEEDDRAGON_PRODUCT_ID 0x110b 81#define SPEEDDRAGON_PRODUCT_ID 0x110b
82
83/* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */
84#define OTI_VENDOR_ID 0x0ea0
85#define OTI_PRODUCT_ID 0x6858
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 097f4e8488fe..071f86a59c08 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -27,10 +27,10 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/mutex.h>
30#include <linux/list.h> 31#include <linux/list.h>
31#include <linux/smp_lock.h> 32#include <linux/smp_lock.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/semaphore.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include "usb-serial.h" 35#include "usb-serial.h"
36#include "pl2303.h" 36#include "pl2303.h"
@@ -192,7 +192,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
192 if (!port) 192 if (!port)
193 return -ENODEV; 193 return -ENODEV;
194 194
195 if (down_interruptible(&port->sem)) 195 if (mutex_lock_interruptible(&port->mutex))
196 return -ERESTARTSYS; 196 return -ERESTARTSYS;
197 197
198 ++port->open_count; 198 ++port->open_count;
@@ -219,7 +219,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
219 goto bailout_module_put; 219 goto bailout_module_put;
220 } 220 }
221 221
222 up(&port->sem); 222 mutex_unlock(&port->mutex);
223 return 0; 223 return 0;
224 224
225bailout_module_put: 225bailout_module_put:
@@ -227,7 +227,7 @@ bailout_module_put:
227bailout_kref_put: 227bailout_kref_put:
228 kref_put(&serial->kref, destroy_serial); 228 kref_put(&serial->kref, destroy_serial);
229 port->open_count = 0; 229 port->open_count = 0;
230 up(&port->sem); 230 mutex_unlock(&port->mutex);
231 return retval; 231 return retval;
232} 232}
233 233
@@ -240,10 +240,10 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
240 240
241 dbg("%s - port %d", __FUNCTION__, port->number); 241 dbg("%s - port %d", __FUNCTION__, port->number);
242 242
243 down(&port->sem); 243 mutex_lock(&port->mutex);
244 244
245 if (port->open_count == 0) { 245 if (port->open_count == 0) {
246 up(&port->sem); 246 mutex_unlock(&port->mutex);
247 return; 247 return;
248 } 248 }
249 249
@@ -262,7 +262,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
262 module_put(port->serial->type->driver.owner); 262 module_put(port->serial->type->driver.owner);
263 } 263 }
264 264
265 up(&port->sem); 265 mutex_unlock(&port->mutex);
266 kref_put(&port->serial->kref, destroy_serial); 266 kref_put(&port->serial->kref, destroy_serial);
267} 267}
268 268
@@ -783,7 +783,7 @@ int usb_serial_probe(struct usb_interface *interface,
783 port->number = i + serial->minor; 783 port->number = i + serial->minor;
784 port->serial = serial; 784 port->serial = serial;
785 spin_lock_init(&port->lock); 785 spin_lock_init(&port->lock);
786 sema_init(&port->sem, 1); 786 mutex_init(&port->mutex);
787 INIT_WORK(&port->work, usb_serial_port_softint, port); 787 INIT_WORK(&port->work, usb_serial_port_softint, port);
788 serial->port[i] = port; 788 serial->port[i] = port;
789 } 789 }
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
index d7d27c3385b3..dc89d8710460 100644
--- a/drivers/usb/serial/usb-serial.h
+++ b/drivers/usb/serial/usb-serial.h
@@ -16,7 +16,7 @@
16 16
17#include <linux/config.h> 17#include <linux/config.h>
18#include <linux/kref.h> 18#include <linux/kref.h>
19#include <asm/semaphore.h> 19#include <linux/mutex.h>
20 20
21#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 21#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
22#define SERIAL_TTY_MINORS 255 /* loads of devices :) */ 22#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
@@ -31,7 +31,7 @@
31 * @serial: pointer back to the struct usb_serial owner of this port. 31 * @serial: pointer back to the struct usb_serial owner of this port.
32 * @tty: pointer to the corresponding tty for this port. 32 * @tty: pointer to the corresponding tty for this port.
33 * @lock: spinlock to grab when updating portions of this structure. 33 * @lock: spinlock to grab when updating portions of this structure.
34 * @sem: semaphore used to synchronize serial_open() and serial_close() 34 * @mutex: mutex used to synchronize serial_open() and serial_close()
35 * access for this port. 35 * access for this port.
36 * @number: the number of the port (the minor number). 36 * @number: the number of the port (the minor number).
37 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 37 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
@@ -63,7 +63,7 @@ struct usb_serial_port {
63 struct usb_serial * serial; 63 struct usb_serial * serial;
64 struct tty_struct * tty; 64 struct tty_struct * tty;
65 spinlock_t lock; 65 spinlock_t lock;
66 struct semaphore sem; 66 struct mutex mutex;
67 unsigned char number; 67 unsigned char number;
68 68
69 unsigned char * interrupt_in_buffer; 69 unsigned char * interrupt_in_buffer;
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 92be101feba7..be9eec225743 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -48,7 +48,8 @@ config USB_STORAGE_FREECOM
48 48
49config USB_STORAGE_ISD200 49config USB_STORAGE_ISD200
50 bool "ISD-200 USB/ATA Bridge support" 50 bool "ISD-200 USB/ATA Bridge support"
51 depends on USB_STORAGE && BLK_DEV_IDE 51 depends on USB_STORAGE
52 depends on BLK_DEV_IDE=y || BLK_DEV_IDE=USB_STORAGE
52 ---help--- 53 ---help---
53 Say Y here if you want to use USB Mass Store devices based 54 Say Y here if you want to use USB Mass Store devices based
54 on the In-Systems Design ISD-200 USB/ATA bridge. 55 on the In-Systems Design ISD-200 USB/ATA bridge.
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index f87c0171f4ec..9060e7137441 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -961,7 +961,7 @@ config FB_ATY128
961 961
962config FB_ATY 962config FB_ATY
963 tristate "ATI Mach64 display support" if PCI || ATARI 963 tristate "ATI Mach64 display support" if PCI || ATARI
964 depends on FB 964 depends on FB && !SPARC32
965 select FB_CFB_FILLRECT 965 select FB_CFB_FILLRECT
966 select FB_CFB_COPYAREA 966 select FB_CFB_COPYAREA
967 select FB_CFB_IMAGEBLIT 967 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index b39e72d5413b..d9d7d3c4cae2 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3400,7 +3400,7 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev, const struct pci_devi
3400 struct atyfb_par *par; 3400 struct atyfb_par *par;
3401 int i, rc = -ENOMEM; 3401 int i, rc = -ENOMEM;
3402 3402
3403 for (i = ARRAY_SIZE(aty_chips); i >= 0; i--) 3403 for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--)
3404 if (pdev->device == aty_chips[i].pci_id) 3404 if (pdev->device == aty_chips[i].pci_id)
3405 break; 3405 break;
3406 3406
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 9a6b5b39b88e..387a18a47ac2 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2265,7 +2265,7 @@ static struct bin_attribute edid2_attr = {
2265}; 2265};
2266 2266
2267 2267
2268static int radeonfb_pci_register (struct pci_dev *pdev, 2268static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
2269 const struct pci_device_id *ent) 2269 const struct pci_device_id *ent)
2270{ 2270{
2271 struct fb_info *info; 2271 struct fb_info *info;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 944855b3e4af..372aa1776827 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -435,6 +435,11 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
435 depth = info->var.green.length; 435 depth = info->var.green.length;
436 } 436 }
437 437
438 if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR) {
439 /* assume console colormap */
440 depth = 4;
441 }
442
438 if (depth >= 8) { 443 if (depth >= 8) {
439 switch (info->fix.visual) { 444 switch (info->fix.visual) {
440 case FB_VISUAL_TRUECOLOR: 445 case FB_VISUAL_TRUECOLOR:
@@ -669,13 +674,19 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
669 total_size = info->fix.smem_len; 674 total_size = info->fix.smem_len;
670 675
671 if (p > total_size) 676 if (p > total_size)
672 return 0; 677 return -EFBIG;
673 678
674 if (count >= total_size) 679 if (count > total_size) {
680 err = -EFBIG;
675 count = total_size; 681 count = total_size;
682 }
683
684 if (count + p > total_size) {
685 if (!err)
686 err = -ENOSPC;
676 687
677 if (count + p > total_size)
678 count = total_size - p; 688 count = total_size - p;
689 }
679 690
680 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, 691 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
681 GFP_KERNEL); 692 GFP_KERNEL);
@@ -717,7 +728,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
717 728
718 kfree(buffer); 729 kfree(buffer);
719 730
720 return (err) ? err : cnt; 731 return (cnt) ? cnt : err;
721} 732}
722 733
723#ifdef CONFIG_KMOD 734#ifdef CONFIG_KMOD
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 5fe197943deb..4e963930b50a 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -73,8 +73,8 @@ static char *mode __devinitdata = NULL;
73 * these flags allow the user to specify that requests for +ve sync 73 * these flags allow the user to specify that requests for +ve sync
74 * should be silently turned in -ve sync. 74 * should be silently turned in -ve sync.
75 */ 75 */
76static int lowhsync __devinitdata = 0; 76static int lowhsync;
77static int lowvsync __devinitdata = 0; 77static int lowvsync;
78 78
79/* 79/*
80 * The hardware state of the graphics card that isn't part of the 80 * The hardware state of the graphics card that isn't part of the
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 10e6b3aab9ea..0da624e6524f 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -73,7 +73,7 @@
73/* --------------------------------------------------------------------- */ 73/* --------------------------------------------------------------------- */
74 74
75 75
76static char *mode_option __initdata = NULL; 76static char *mode_option __devinitdata = NULL;
77 77
78#ifdef MODULE 78#ifdef MODULE
79 79
@@ -1545,7 +1545,7 @@ static int __devinit savage_map_mmio (struct fb_info *info)
1545 return 0; 1545 return 0;
1546} 1546}
1547 1547
1548static void __devinit savage_unmap_mmio (struct fb_info *info) 1548static void savage_unmap_mmio (struct fb_info *info)
1549{ 1549{
1550 struct savagefb_par *par = info->par; 1550 struct savagefb_par *par = info->par;
1551 DBG ("savage_unmap_mmio"); 1551 DBG ("savage_unmap_mmio");
@@ -1597,7 +1597,7 @@ static int __devinit savage_map_video (struct fb_info *info,
1597 return 0; 1597 return 0;
1598} 1598}
1599 1599
1600static void __devinit savage_unmap_video (struct fb_info *info) 1600static void savage_unmap_video (struct fb_info *info)
1601{ 1601{
1602 struct savagefb_par *par = info->par; 1602 struct savagefb_par *par = info->par;
1603 1603
@@ -1614,7 +1614,7 @@ static void __devinit savage_unmap_video (struct fb_info *info)
1614 } 1614 }
1615} 1615}
1616 1616
1617static int __devinit savage_init_hw (struct savagefb_par *par) 1617static int savage_init_hw (struct savagefb_par *par)
1618{ 1618{
1619 unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp; 1619 unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp;
1620 1620
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 8982e540214c..b0b9acfdd430 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -57,7 +57,7 @@ static unsigned short *pmi_base = NULL;
57static void (*pmi_start)(void); 57static void (*pmi_start)(void);
58static void (*pmi_pal)(void); 58static void (*pmi_pal)(void);
59static int depth; 59static int depth;
60 60static int vga_compat;
61/* --------------------------------------------------------------------- */ 61/* --------------------------------------------------------------------- */
62 62
63static int vesafb_pan_display(struct fb_var_screeninfo *var, 63static int vesafb_pan_display(struct fb_var_screeninfo *var,
@@ -83,9 +83,10 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var,
83static void vesa_setpalette(int regno, unsigned red, unsigned green, 83static void vesa_setpalette(int regno, unsigned red, unsigned green,
84 unsigned blue) 84 unsigned blue)
85{ 85{
86 int shift = 16 - depth;
87
86#ifdef __i386__ 88#ifdef __i386__
87 struct { u_char blue, green, red, pad; } entry; 89 struct { u_char blue, green, red, pad; } entry;
88 int shift = 16 - depth;
89 90
90 if (pmi_setpal) { 91 if (pmi_setpal) {
91 entry.red = red >> shift; 92 entry.red = red >> shift;
@@ -101,14 +102,20 @@ static void vesa_setpalette(int regno, unsigned red, unsigned green,
101 "d" (regno), /* EDX */ 102 "d" (regno), /* EDX */
102 "D" (&entry), /* EDI */ 103 "D" (&entry), /* EDI */
103 "S" (&pmi_pal)); /* ESI */ 104 "S" (&pmi_pal)); /* ESI */
104 } else { 105 return;
105 /* without protected mode interface, try VGA registers... */ 106 }
107#endif
108
109/*
110 * without protected mode interface and if VGA compatible,
111 * try VGA registers...
112 */
113 if (vga_compat) {
106 outb_p(regno, dac_reg); 114 outb_p(regno, dac_reg);
107 outb_p(red >> shift, dac_val); 115 outb_p(red >> shift, dac_val);
108 outb_p(green >> shift, dac_val); 116 outb_p(green >> shift, dac_val);
109 outb_p(blue >> shift, dac_val); 117 outb_p(blue >> shift, dac_val);
110 } 118 }
111#endif
112} 119}
113 120
114static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, 121static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
@@ -214,6 +221,7 @@ static int __init vesafb_probe(struct platform_device *dev)
214 if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) 221 if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB)
215 return -ENODEV; 222 return -ENODEV;
216 223
224 vga_compat = (screen_info.capabilities & 2) ? 0 : 1;
217 vesafb_fix.smem_start = screen_info.lfb_base; 225 vesafb_fix.smem_start = screen_info.lfb_base;
218 vesafb_defined.bits_per_pixel = screen_info.lfb_depth; 226 vesafb_defined.bits_per_pixel = screen_info.lfb_depth;
219 if (15 == vesafb_defined.bits_per_pixel) 227 if (15 == vesafb_defined.bits_per_pixel)
@@ -318,6 +326,12 @@ static int __init vesafb_probe(struct platform_device *dev)
318 } 326 }
319 } 327 }
320 328
329 if (vesafb_defined.bits_per_pixel == 8 && !pmi_setpal && !vga_compat) {
330 printk(KERN_WARNING "vesafb: hardware palette is unchangeable,\n"
331 " colors may be incorrect\n");
332 vesafb_fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
333 }
334
321 vesafb_defined.xres_virtual = vesafb_defined.xres; 335 vesafb_defined.xres_virtual = vesafb_defined.xres;
322 vesafb_defined.yres_virtual = vesafb_fix.smem_len / vesafb_fix.line_length; 336 vesafb_defined.yres_virtual = vesafb_fix.smem_len / vesafb_fix.line_length;
323 if (ypan && vesafb_defined.yres_virtual > vesafb_defined.yres) { 337 if (ypan && vesafb_defined.yres_virtual > vesafb_defined.yres) {
@@ -354,7 +368,8 @@ static int __init vesafb_probe(struct platform_device *dev)
354 printk(KERN_INFO "vesafb: %s: " 368 printk(KERN_INFO "vesafb: %s: "
355 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n", 369 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
356 (vesafb_defined.bits_per_pixel > 8) ? 370 (vesafb_defined.bits_per_pixel > 8) ?
357 "Truecolor" : "Pseudocolor", 371 "Truecolor" : (vga_compat || pmi_setpal) ?
372 "Pseudocolor" : "Static Pseudocolor",
358 screen_info.rsvd_size, 373 screen_info.rsvd_size,
359 screen_info.red_size, 374 screen_info.red_size,
360 screen_info.green_size, 375 screen_info.green_size,
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index b0a0ae509c00..61c599b4a1e3 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -127,12 +127,13 @@ static struct super_block *v9fs_get_sb(struct file_system_type
127 127
128 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { 128 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
129 dprintk(DEBUG_ERROR, "problem initiating session\n"); 129 dprintk(DEBUG_ERROR, "problem initiating session\n");
130 kfree(v9ses); 130 sb = ERR_PTR(newfid);
131 return ERR_PTR(newfid); 131 goto out_free_session;
132 } 132 }
133 133
134 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 134 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
135 135 if (IS_ERR(sb))
136 goto out_close_session;
136 v9fs_fill_super(sb, v9ses, flags); 137 v9fs_fill_super(sb, v9ses, flags);
137 138
138 inode = v9fs_get_inode(sb, S_IFDIR | mode); 139 inode = v9fs_get_inode(sb, S_IFDIR | mode);
@@ -185,6 +186,12 @@ static struct super_block *v9fs_get_sb(struct file_system_type
185 186
186 return sb; 187 return sb;
187 188
189out_close_session:
190 v9fs_session_close(v9ses);
191out_free_session:
192 kfree(v9ses);
193 return sb;
194
188put_back_sb: 195put_back_sb:
189 /* deactivate_super calls v9fs_kill_super which will frees the rest */ 196 /* deactivate_super calls v9fs_kill_super which will frees the rest */
190 up_write(&sb->s_umount); 197 up_write(&sb->s_umount);
diff --git a/fs/Kconfig b/fs/Kconfig
index 62ee097776f0..563a59e5e694 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -800,6 +800,7 @@ config PROC_KCORE
800config PROC_VMCORE 800config PROC_VMCORE
801 bool "/proc/vmcore support (EXPERIMENTAL)" 801 bool "/proc/vmcore support (EXPERIMENTAL)"
802 depends on PROC_FS && EXPERIMENTAL && CRASH_DUMP 802 depends on PROC_FS && EXPERIMENTAL && CRASH_DUMP
803 default y
803 help 804 help
804 Exports the dump image of crashed kernel in ELF format. 805 Exports the dump image of crashed kernel in ELF format.
805 806
@@ -842,6 +843,12 @@ config TMPFS
842config HUGETLBFS 843config HUGETLBFS
843 bool "HugeTLB file system support" 844 bool "HugeTLB file system support"
844 depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN 845 depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
846 help
847 hugetlbfs is a filesystem backing for HugeTLB pages, based on
848 ramfs. For architectures that support it, say Y here and read
849 <file:Documentation/vm/hugetlbpage.txt> for details.
850
851 If unsure, say N.
845 852
846config HUGETLB_PAGE 853config HUGETLB_PAGE
847 def_bool HUGETLBFS 854 def_bool HUGETLBFS
@@ -862,7 +869,7 @@ config RAMFS
862 869
863config CONFIGFS_FS 870config CONFIGFS_FS
864 tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)" 871 tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)"
865 depends on EXPERIMENTAL 872 depends on SYSFS && EXPERIMENTAL
866 help 873 help
867 configfs is a ram-based filesystem that provides the converse 874 configfs is a ram-based filesystem that provides the converse
868 of sysfs's functionality. Where sysfs is a filesystem-based 875 of sysfs's functionality. Where sysfs is a filesystem-based
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 8ed9b06a9828..5638c8f9362f 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -504,7 +504,7 @@ static int populate_groups(struct config_group *group)
504 int ret = 0; 504 int ret = 0;
505 int i; 505 int i;
506 506
507 if (group && group->default_groups) { 507 if (group->default_groups) {
508 /* FYI, we're faking mkdir here 508 /* FYI, we're faking mkdir here
509 * I'm not sure we need this semaphore, as we're called 509 * I'm not sure we need this semaphore, as we're called
510 * from our parent's mkdir. That holds our parent's 510 * from our parent's mkdir. That holds our parent's
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 242fe1a66ce5..1b4491cdd115 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -599,7 +599,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
599 switch (op) { 599 switch (op) {
600 case EPOLL_CTL_ADD: 600 case EPOLL_CTL_ADD:
601 if (!epi) { 601 if (!epi) {
602 epds.events |= POLLERR | POLLHUP | POLLRDHUP; 602 epds.events |= POLLERR | POLLHUP;
603 603
604 error = ep_insert(ep, &epds, tfile, fd); 604 error = ep_insert(ep, &epds, tfile, fd);
605 } else 605 } else
@@ -613,7 +613,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
613 break; 613 break;
614 case EPOLL_CTL_MOD: 614 case EPOLL_CTL_MOD:
615 if (epi) { 615 if (epi) {
616 epds.events |= POLLERR | POLLHUP | POLLRDHUP; 616 epds.events |= POLLERR | POLLHUP;
617 error = ep_modify(ep, epi, &epds); 617 error = ep_modify(ep, epi, &epds);
618 } else 618 } else
619 error = -ENOENT; 619 error = -ENOENT;
diff --git a/fs/exec.c b/fs/exec.c
index 0291a68a3626..3a79d97ac234 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -665,9 +665,7 @@ static int de_thread(struct task_struct *tsk)
665 * and to assume its PID: 665 * and to assume its PID:
666 */ 666 */
667 if (!thread_group_leader(current)) { 667 if (!thread_group_leader(current)) {
668 struct task_struct *parent;
669 struct dentry *proc_dentry1, *proc_dentry2; 668 struct dentry *proc_dentry1, *proc_dentry2;
670 unsigned long ptrace;
671 669
672 /* 670 /*
673 * Wait for the thread group leader to be a zombie. 671 * Wait for the thread group leader to be a zombie.
@@ -678,6 +676,18 @@ static int de_thread(struct task_struct *tsk)
678 while (leader->exit_state != EXIT_ZOMBIE) 676 while (leader->exit_state != EXIT_ZOMBIE)
679 yield(); 677 yield();
680 678
679 /*
680 * The only record we have of the real-time age of a
681 * process, regardless of execs it's done, is start_time.
682 * All the past CPU time is accumulated in signal_struct
683 * from sister threads now dead. But in this non-leader
684 * exec, nothing survives from the original leader thread,
685 * whose birth marks the true age of this process now.
686 * When we take on its identity by switching to its PID, we
687 * also take its birthdate (always earlier than our own).
688 */
689 current->start_time = leader->start_time;
690
681 spin_lock(&leader->proc_lock); 691 spin_lock(&leader->proc_lock);
682 spin_lock(&current->proc_lock); 692 spin_lock(&current->proc_lock);
683 proc_dentry1 = proc_pid_unhash(current); 693 proc_dentry1 = proc_pid_unhash(current);
@@ -692,22 +702,6 @@ static int de_thread(struct task_struct *tsk)
692 * two threads with a switched PID, and release 702 * two threads with a switched PID, and release
693 * the former thread group leader: 703 * the former thread group leader:
694 */ 704 */
695 ptrace = leader->ptrace;
696 parent = leader->parent;
697 if (unlikely(ptrace) && unlikely(parent == current)) {
698 /*
699 * Joker was ptracing his own group leader,
700 * and now he wants to be his own parent!
701 * We can't have that.
702 */
703 ptrace = 0;
704 }
705
706 ptrace_unlink(current);
707 ptrace_unlink(leader);
708 remove_parent(current);
709 remove_parent(leader);
710
711 705
712 /* Become a process group leader with the old leader's pid. 706 /* Become a process group leader with the old leader's pid.
713 * Note: The old leader also uses thispid until release_task 707 * Note: The old leader also uses thispid until release_task
@@ -718,19 +712,15 @@ static int de_thread(struct task_struct *tsk)
718 attach_pid(current, PIDTYPE_PID, current->pid); 712 attach_pid(current, PIDTYPE_PID, current->pid);
719 attach_pid(current, PIDTYPE_PGID, current->signal->pgrp); 713 attach_pid(current, PIDTYPE_PGID, current->signal->pgrp);
720 attach_pid(current, PIDTYPE_SID, current->signal->session); 714 attach_pid(current, PIDTYPE_SID, current->signal->session);
721 list_add_tail(&current->tasks, &init_task.tasks); 715 list_add_tail_rcu(&current->tasks, &init_task.tasks);
722 716
723 current->parent = current->real_parent = leader->real_parent;
724 leader->parent = leader->real_parent = child_reaper;
725 current->group_leader = current; 717 current->group_leader = current;
726 leader->group_leader = leader; 718 leader->group_leader = current;
727 719
728 add_parent(current); 720 /* Reduce leader to a thread */
729 add_parent(leader); 721 detach_pid(leader, PIDTYPE_PGID);
730 if (ptrace) { 722 detach_pid(leader, PIDTYPE_SID);
731 current->ptrace = ptrace; 723 list_del_init(&leader->tasks);
732 __ptrace_link(current, parent);
733 }
734 724
735 current->exit_signal = SIGCHLD; 725 current->exit_signal = SIGCHLD;
736 726
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 1041dab6de2f..c5ffa8523968 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -767,6 +767,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
767 if (input->group != sbi->s_groups_count) { 767 if (input->group != sbi->s_groups_count) {
768 ext3_warning(sb, __FUNCTION__, 768 ext3_warning(sb, __FUNCTION__,
769 "multiple resizers run on filesystem!"); 769 "multiple resizers run on filesystem!");
770 unlock_super(sb);
770 err = -EBUSY; 771 err = -EBUSY;
771 goto exit_journal; 772 goto exit_journal;
772 } 773 }
@@ -974,6 +975,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
974 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { 975 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) {
975 ext3_warning(sb, __FUNCTION__, 976 ext3_warning(sb, __FUNCTION__,
976 "multiple resizers run on filesystem!"); 977 "multiple resizers run on filesystem!");
978 unlock_super(sb);
977 err = -EBUSY; 979 err = -EBUSY;
978 goto exit_put; 980 goto exit_put;
979 } 981 }
diff --git a/fs/fifo.c b/fs/fifo.c
index 889f722ee36d..49035b174b48 100644
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -15,30 +15,35 @@
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/pipe_fs_i.h> 16#include <linux/pipe_fs_i.h>
17 17
18static void wait_for_partner(struct inode* inode, unsigned int* cnt) 18static void wait_for_partner(struct inode* inode, unsigned int *cnt)
19{ 19{
20 int cur = *cnt; 20 int cur = *cnt;
21 while(cur == *cnt) { 21
22 pipe_wait(inode); 22 while (cur == *cnt) {
23 if(signal_pending(current)) 23 pipe_wait(inode->i_pipe);
24 if (signal_pending(current))
24 break; 25 break;
25 } 26 }
26} 27}
27 28
28static void wake_up_partner(struct inode* inode) 29static void wake_up_partner(struct inode* inode)
29{ 30{
30 wake_up_interruptible(PIPE_WAIT(*inode)); 31 wake_up_interruptible(&inode->i_pipe->wait);
31} 32}
32 33
33static int fifo_open(struct inode *inode, struct file *filp) 34static int fifo_open(struct inode *inode, struct file *filp)
34{ 35{
36 struct pipe_inode_info *pipe;
35 int ret; 37 int ret;
36 38
37 mutex_lock(PIPE_MUTEX(*inode)); 39 mutex_lock(&inode->i_mutex);
38 if (!inode->i_pipe) { 40 pipe = inode->i_pipe;
41 if (!pipe) {
39 ret = -ENOMEM; 42 ret = -ENOMEM;
40 if(!pipe_new(inode)) 43 pipe = alloc_pipe_info(inode);
44 if (!pipe)
41 goto err_nocleanup; 45 goto err_nocleanup;
46 inode->i_pipe = pipe;
42 } 47 }
43 filp->f_version = 0; 48 filp->f_version = 0;
44 49
@@ -53,18 +58,18 @@ static int fifo_open(struct inode *inode, struct file *filp)
53 * opened, even when there is no process writing the FIFO. 58 * opened, even when there is no process writing the FIFO.
54 */ 59 */
55 filp->f_op = &read_fifo_fops; 60 filp->f_op = &read_fifo_fops;
56 PIPE_RCOUNTER(*inode)++; 61 pipe->r_counter++;
57 if (PIPE_READERS(*inode)++ == 0) 62 if (pipe->readers++ == 0)
58 wake_up_partner(inode); 63 wake_up_partner(inode);
59 64
60 if (!PIPE_WRITERS(*inode)) { 65 if (!pipe->writers) {
61 if ((filp->f_flags & O_NONBLOCK)) { 66 if ((filp->f_flags & O_NONBLOCK)) {
62 /* suppress POLLHUP until we have 67 /* suppress POLLHUP until we have
63 * seen a writer */ 68 * seen a writer */
64 filp->f_version = PIPE_WCOUNTER(*inode); 69 filp->f_version = pipe->w_counter;
65 } else 70 } else
66 { 71 {
67 wait_for_partner(inode, &PIPE_WCOUNTER(*inode)); 72 wait_for_partner(inode, &pipe->w_counter);
68 if(signal_pending(current)) 73 if(signal_pending(current))
69 goto err_rd; 74 goto err_rd;
70 } 75 }
@@ -78,16 +83,16 @@ static int fifo_open(struct inode *inode, struct file *filp)
78 * errno=ENXIO when there is no process reading the FIFO. 83 * errno=ENXIO when there is no process reading the FIFO.
79 */ 84 */
80 ret = -ENXIO; 85 ret = -ENXIO;
81 if ((filp->f_flags & O_NONBLOCK) && !PIPE_READERS(*inode)) 86 if ((filp->f_flags & O_NONBLOCK) && !pipe->readers)
82 goto err; 87 goto err;
83 88
84 filp->f_op = &write_fifo_fops; 89 filp->f_op = &write_fifo_fops;
85 PIPE_WCOUNTER(*inode)++; 90 pipe->w_counter++;
86 if (!PIPE_WRITERS(*inode)++) 91 if (!pipe->writers++)
87 wake_up_partner(inode); 92 wake_up_partner(inode);
88 93
89 if (!PIPE_READERS(*inode)) { 94 if (!pipe->readers) {
90 wait_for_partner(inode, &PIPE_RCOUNTER(*inode)); 95 wait_for_partner(inode, &pipe->r_counter);
91 if (signal_pending(current)) 96 if (signal_pending(current))
92 goto err_wr; 97 goto err_wr;
93 } 98 }
@@ -102,11 +107,11 @@ static int fifo_open(struct inode *inode, struct file *filp)
102 */ 107 */
103 filp->f_op = &rdwr_fifo_fops; 108 filp->f_op = &rdwr_fifo_fops;
104 109
105 PIPE_READERS(*inode)++; 110 pipe->readers++;
106 PIPE_WRITERS(*inode)++; 111 pipe->writers++;
107 PIPE_RCOUNTER(*inode)++; 112 pipe->r_counter++;
108 PIPE_WCOUNTER(*inode)++; 113 pipe->w_counter++;
109 if (PIPE_READERS(*inode) == 1 || PIPE_WRITERS(*inode) == 1) 114 if (pipe->readers == 1 || pipe->writers == 1)
110 wake_up_partner(inode); 115 wake_up_partner(inode);
111 break; 116 break;
112 117
@@ -116,27 +121,27 @@ static int fifo_open(struct inode *inode, struct file *filp)
116 } 121 }
117 122
118 /* Ok! */ 123 /* Ok! */
119 mutex_unlock(PIPE_MUTEX(*inode)); 124 mutex_unlock(&inode->i_mutex);
120 return 0; 125 return 0;
121 126
122err_rd: 127err_rd:
123 if (!--PIPE_READERS(*inode)) 128 if (!--pipe->readers)
124 wake_up_interruptible(PIPE_WAIT(*inode)); 129 wake_up_interruptible(&pipe->wait);
125 ret = -ERESTARTSYS; 130 ret = -ERESTARTSYS;
126 goto err; 131 goto err;
127 132
128err_wr: 133err_wr:
129 if (!--PIPE_WRITERS(*inode)) 134 if (!--pipe->writers)
130 wake_up_interruptible(PIPE_WAIT(*inode)); 135 wake_up_interruptible(&pipe->wait);
131 ret = -ERESTARTSYS; 136 ret = -ERESTARTSYS;
132 goto err; 137 goto err;
133 138
134err: 139err:
135 if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) 140 if (!pipe->readers && !pipe->writers)
136 free_pipe_info(inode); 141 free_pipe_info(inode);
137 142
138err_nocleanup: 143err_nocleanup:
139 mutex_unlock(PIPE_MUTEX(*inode)); 144 mutex_unlock(&inode->i_mutex);
140 return ret; 145 return ret;
141} 146}
142 147
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 23d1f52eb1b8..cc750c68fe70 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -23,13 +23,11 @@ static kmem_cache_t *fuse_req_cachep;
23 23
24static struct fuse_conn *fuse_get_conn(struct file *file) 24static struct fuse_conn *fuse_get_conn(struct file *file)
25{ 25{
26 struct fuse_conn *fc; 26 /*
27 spin_lock(&fuse_lock); 27 * Lockless access is OK, because file->private data is set
28 fc = file->private_data; 28 * once during mount and is valid until the file is released.
29 if (fc && !fc->connected) 29 */
30 fc = NULL; 30 return file->private_data;
31 spin_unlock(&fuse_lock);
32 return fc;
33} 31}
34 32
35static void fuse_request_init(struct fuse_req *req) 33static void fuse_request_init(struct fuse_req *req)
@@ -74,10 +72,8 @@ static void restore_sigs(sigset_t *oldset)
74 */ 72 */
75void fuse_reset_request(struct fuse_req *req) 73void fuse_reset_request(struct fuse_req *req)
76{ 74{
77 int preallocated = req->preallocated;
78 BUG_ON(atomic_read(&req->count) != 1); 75 BUG_ON(atomic_read(&req->count) != 1);
79 fuse_request_init(req); 76 fuse_request_init(req);
80 req->preallocated = preallocated;
81} 77}
82 78
83static void __fuse_get_request(struct fuse_req *req) 79static void __fuse_get_request(struct fuse_req *req)
@@ -92,80 +88,54 @@ static void __fuse_put_request(struct fuse_req *req)
92 atomic_dec(&req->count); 88 atomic_dec(&req->count);
93} 89}
94 90
95static struct fuse_req *do_get_request(struct fuse_conn *fc) 91struct fuse_req *fuse_get_req(struct fuse_conn *fc)
96{ 92{
97 struct fuse_req *req; 93 struct fuse_req *req;
98
99 spin_lock(&fuse_lock);
100 BUG_ON(list_empty(&fc->unused_list));
101 req = list_entry(fc->unused_list.next, struct fuse_req, list);
102 list_del_init(&req->list);
103 spin_unlock(&fuse_lock);
104 fuse_request_init(req);
105 req->preallocated = 1;
106 req->in.h.uid = current->fsuid;
107 req->in.h.gid = current->fsgid;
108 req->in.h.pid = current->pid;
109 return req;
110}
111
112/* This can return NULL, but only in case it's interrupted by a SIGKILL */
113struct fuse_req *fuse_get_request(struct fuse_conn *fc)
114{
115 int intr;
116 sigset_t oldset; 94 sigset_t oldset;
95 int intr;
96 int err;
117 97
118 atomic_inc(&fc->num_waiting); 98 atomic_inc(&fc->num_waiting);
119 block_sigs(&oldset); 99 block_sigs(&oldset);
120 intr = down_interruptible(&fc->outstanding_sem); 100 intr = wait_event_interruptible(fc->blocked_waitq, !fc->blocked);
121 restore_sigs(&oldset); 101 restore_sigs(&oldset);
122 if (intr) { 102 err = -EINTR;
123 atomic_dec(&fc->num_waiting); 103 if (intr)
124 return NULL; 104 goto out;
125 }
126 return do_get_request(fc);
127}
128 105
129/* Must be called with fuse_lock held */ 106 req = fuse_request_alloc();
130static void fuse_putback_request(struct fuse_conn *fc, struct fuse_req *req) 107 err = -ENOMEM;
131{ 108 if (!req)
132 if (req->preallocated) { 109 goto out;
133 atomic_dec(&fc->num_waiting);
134 list_add(&req->list, &fc->unused_list);
135 } else
136 fuse_request_free(req);
137 110
138 /* If we are in debt decrease that first */ 111 req->in.h.uid = current->fsuid;
139 if (fc->outstanding_debt) 112 req->in.h.gid = current->fsgid;
140 fc->outstanding_debt--; 113 req->in.h.pid = current->pid;
141 else 114 req->waiting = 1;
142 up(&fc->outstanding_sem); 115 return req;
116
117 out:
118 atomic_dec(&fc->num_waiting);
119 return ERR_PTR(err);
143} 120}
144 121
145void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) 122void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
146{ 123{
147 if (atomic_dec_and_test(&req->count)) { 124 if (atomic_dec_and_test(&req->count)) {
148 spin_lock(&fuse_lock); 125 if (req->waiting)
149 fuse_putback_request(fc, req); 126 atomic_dec(&fc->num_waiting);
150 spin_unlock(&fuse_lock); 127 fuse_request_free(req);
151 } 128 }
152} 129}
153 130
154static void fuse_put_request_locked(struct fuse_conn *fc, struct fuse_req *req) 131void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req)
155{
156 if (atomic_dec_and_test(&req->count))
157 fuse_putback_request(fc, req);
158}
159
160void fuse_release_background(struct fuse_req *req)
161{ 132{
162 iput(req->inode); 133 list_del_init(&req->bg_entry);
163 iput(req->inode2); 134 if (fc->num_background == FUSE_MAX_BACKGROUND) {
164 if (req->file) 135 fc->blocked = 0;
165 fput(req->file); 136 wake_up_all(&fc->blocked_waitq);
166 spin_lock(&fuse_lock); 137 }
167 list_del(&req->bg_entry); 138 fc->num_background--;
168 spin_unlock(&fuse_lock);
169} 139}
170 140
171/* 141/*
@@ -184,28 +154,38 @@ void fuse_release_background(struct fuse_req *req)
184 * interrupted and put in the background, it will return with an error 154 * interrupted and put in the background, it will return with an error
185 * and hence never be reset and reused. 155 * and hence never be reset and reused.
186 * 156 *
187 * Called with fuse_lock, unlocks it 157 * Called with fc->lock, unlocks it
188 */ 158 */
189static void request_end(struct fuse_conn *fc, struct fuse_req *req) 159static void request_end(struct fuse_conn *fc, struct fuse_req *req)
190{ 160{
191 list_del(&req->list); 161 list_del(&req->list);
192 req->state = FUSE_REQ_FINISHED; 162 req->state = FUSE_REQ_FINISHED;
193 if (!req->background) { 163 if (!req->background) {
164 spin_unlock(&fc->lock);
194 wake_up(&req->waitq); 165 wake_up(&req->waitq);
195 fuse_put_request_locked(fc, req); 166 fuse_put_request(fc, req);
196 spin_unlock(&fuse_lock);
197 } else { 167 } else {
168 struct inode *inode = req->inode;
169 struct inode *inode2 = req->inode2;
170 struct file *file = req->file;
198 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; 171 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
199 req->end = NULL; 172 req->end = NULL;
200 spin_unlock(&fuse_lock); 173 req->inode = NULL;
201 down_read(&fc->sbput_sem); 174 req->inode2 = NULL;
202 if (fc->mounted) 175 req->file = NULL;
203 fuse_release_background(req); 176 if (!list_empty(&req->bg_entry))
204 up_read(&fc->sbput_sem); 177 fuse_remove_background(fc, req);
178 spin_unlock(&fc->lock);
179
205 if (end) 180 if (end)
206 end(fc, req); 181 end(fc, req);
207 else 182 else
208 fuse_put_request(fc, req); 183 fuse_put_request(fc, req);
184
185 if (file)
186 fput(file);
187 iput(inode);
188 iput(inode2);
209 } 189 }
210} 190}
211 191
@@ -242,6 +222,9 @@ static void background_request(struct fuse_conn *fc, struct fuse_req *req)
242{ 222{
243 req->background = 1; 223 req->background = 1;
244 list_add(&req->bg_entry, &fc->background); 224 list_add(&req->bg_entry, &fc->background);
225 fc->num_background++;
226 if (fc->num_background == FUSE_MAX_BACKGROUND)
227 fc->blocked = 1;
245 if (req->inode) 228 if (req->inode)
246 req->inode = igrab(req->inode); 229 req->inode = igrab(req->inode);
247 if (req->inode2) 230 if (req->inode2)
@@ -250,16 +233,16 @@ static void background_request(struct fuse_conn *fc, struct fuse_req *req)
250 get_file(req->file); 233 get_file(req->file);
251} 234}
252 235
253/* Called with fuse_lock held. Releases, and then reacquires it. */ 236/* Called with fc->lock held. Releases, and then reacquires it. */
254static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) 237static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
255{ 238{
256 sigset_t oldset; 239 sigset_t oldset;
257 240
258 spin_unlock(&fuse_lock); 241 spin_unlock(&fc->lock);
259 block_sigs(&oldset); 242 block_sigs(&oldset);
260 wait_event_interruptible(req->waitq, req->state == FUSE_REQ_FINISHED); 243 wait_event_interruptible(req->waitq, req->state == FUSE_REQ_FINISHED);
261 restore_sigs(&oldset); 244 restore_sigs(&oldset);
262 spin_lock(&fuse_lock); 245 spin_lock(&fc->lock);
263 if (req->state == FUSE_REQ_FINISHED && !req->interrupted) 246 if (req->state == FUSE_REQ_FINISHED && !req->interrupted)
264 return; 247 return;
265 248
@@ -273,9 +256,9 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
273 locked state, there mustn't be any filesystem 256 locked state, there mustn't be any filesystem
274 operation (e.g. page fault), since that could lead 257 operation (e.g. page fault), since that could lead
275 to deadlock */ 258 to deadlock */
276 spin_unlock(&fuse_lock); 259 spin_unlock(&fc->lock);
277 wait_event(req->waitq, !req->locked); 260 wait_event(req->waitq, !req->locked);
278 spin_lock(&fuse_lock); 261 spin_lock(&fc->lock);
279 } 262 }
280 if (req->state == FUSE_REQ_PENDING) { 263 if (req->state == FUSE_REQ_PENDING) {
281 list_del(&req->list); 264 list_del(&req->list);
@@ -304,19 +287,14 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
304 req->in.h.unique = fc->reqctr; 287 req->in.h.unique = fc->reqctr;
305 req->in.h.len = sizeof(struct fuse_in_header) + 288 req->in.h.len = sizeof(struct fuse_in_header) +
306 len_args(req->in.numargs, (struct fuse_arg *) req->in.args); 289 len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
307 if (!req->preallocated) {
308 /* If request is not preallocated (either FORGET or
309 RELEASE), then still decrease outstanding_sem, so
310 user can't open infinite number of files while not
311 processing the RELEASE requests. However for
312 efficiency do it without blocking, so if down()
313 would block, just increase the debt instead */
314 if (down_trylock(&fc->outstanding_sem))
315 fc->outstanding_debt++;
316 }
317 list_add_tail(&req->list, &fc->pending); 290 list_add_tail(&req->list, &fc->pending);
318 req->state = FUSE_REQ_PENDING; 291 req->state = FUSE_REQ_PENDING;
292 if (!req->waiting) {
293 req->waiting = 1;
294 atomic_inc(&fc->num_waiting);
295 }
319 wake_up(&fc->waitq); 296 wake_up(&fc->waitq);
297 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
320} 298}
321 299
322/* 300/*
@@ -325,7 +303,7 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
325void request_send(struct fuse_conn *fc, struct fuse_req *req) 303void request_send(struct fuse_conn *fc, struct fuse_req *req)
326{ 304{
327 req->isreply = 1; 305 req->isreply = 1;
328 spin_lock(&fuse_lock); 306 spin_lock(&fc->lock);
329 if (!fc->connected) 307 if (!fc->connected)
330 req->out.h.error = -ENOTCONN; 308 req->out.h.error = -ENOTCONN;
331 else if (fc->conn_error) 309 else if (fc->conn_error)
@@ -338,15 +316,16 @@ void request_send(struct fuse_conn *fc, struct fuse_req *req)
338 316
339 request_wait_answer(fc, req); 317 request_wait_answer(fc, req);
340 } 318 }
341 spin_unlock(&fuse_lock); 319 spin_unlock(&fc->lock);
342} 320}
343 321
344static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req) 322static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
345{ 323{
346 spin_lock(&fuse_lock); 324 spin_lock(&fc->lock);
325 background_request(fc, req);
347 if (fc->connected) { 326 if (fc->connected) {
348 queue_request(fc, req); 327 queue_request(fc, req);
349 spin_unlock(&fuse_lock); 328 spin_unlock(&fc->lock);
350 } else { 329 } else {
351 req->out.h.error = -ENOTCONN; 330 req->out.h.error = -ENOTCONN;
352 request_end(fc, req); 331 request_end(fc, req);
@@ -362,9 +341,6 @@ void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req)
362void request_send_background(struct fuse_conn *fc, struct fuse_req *req) 341void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
363{ 342{
364 req->isreply = 1; 343 req->isreply = 1;
365 spin_lock(&fuse_lock);
366 background_request(fc, req);
367 spin_unlock(&fuse_lock);
368 request_send_nowait(fc, req); 344 request_send_nowait(fc, req);
369} 345}
370 346
@@ -373,16 +349,16 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
373 * anything that could cause a page-fault. If the request was already 349 * anything that could cause a page-fault. If the request was already
374 * interrupted bail out. 350 * interrupted bail out.
375 */ 351 */
376static int lock_request(struct fuse_req *req) 352static int lock_request(struct fuse_conn *fc, struct fuse_req *req)
377{ 353{
378 int err = 0; 354 int err = 0;
379 if (req) { 355 if (req) {
380 spin_lock(&fuse_lock); 356 spin_lock(&fc->lock);
381 if (req->interrupted) 357 if (req->interrupted)
382 err = -ENOENT; 358 err = -ENOENT;
383 else 359 else
384 req->locked = 1; 360 req->locked = 1;
385 spin_unlock(&fuse_lock); 361 spin_unlock(&fc->lock);
386 } 362 }
387 return err; 363 return err;
388} 364}
@@ -392,18 +368,19 @@ static int lock_request(struct fuse_req *req)
392 * requester thread is currently waiting for it to be unlocked, so 368 * requester thread is currently waiting for it to be unlocked, so
393 * wake it up. 369 * wake it up.
394 */ 370 */
395static void unlock_request(struct fuse_req *req) 371static void unlock_request(struct fuse_conn *fc, struct fuse_req *req)
396{ 372{
397 if (req) { 373 if (req) {
398 spin_lock(&fuse_lock); 374 spin_lock(&fc->lock);
399 req->locked = 0; 375 req->locked = 0;
400 if (req->interrupted) 376 if (req->interrupted)
401 wake_up(&req->waitq); 377 wake_up(&req->waitq);
402 spin_unlock(&fuse_lock); 378 spin_unlock(&fc->lock);
403 } 379 }
404} 380}
405 381
406struct fuse_copy_state { 382struct fuse_copy_state {
383 struct fuse_conn *fc;
407 int write; 384 int write;
408 struct fuse_req *req; 385 struct fuse_req *req;
409 const struct iovec *iov; 386 const struct iovec *iov;
@@ -416,11 +393,12 @@ struct fuse_copy_state {
416 unsigned len; 393 unsigned len;
417}; 394};
418 395
419static void fuse_copy_init(struct fuse_copy_state *cs, int write, 396static void fuse_copy_init(struct fuse_copy_state *cs, struct fuse_conn *fc,
420 struct fuse_req *req, const struct iovec *iov, 397 int write, struct fuse_req *req,
421 unsigned long nr_segs) 398 const struct iovec *iov, unsigned long nr_segs)
422{ 399{
423 memset(cs, 0, sizeof(*cs)); 400 memset(cs, 0, sizeof(*cs));
401 cs->fc = fc;
424 cs->write = write; 402 cs->write = write;
425 cs->req = req; 403 cs->req = req;
426 cs->iov = iov; 404 cs->iov = iov;
@@ -450,7 +428,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
450 unsigned long offset; 428 unsigned long offset;
451 int err; 429 int err;
452 430
453 unlock_request(cs->req); 431 unlock_request(cs->fc, cs->req);
454 fuse_copy_finish(cs); 432 fuse_copy_finish(cs);
455 if (!cs->seglen) { 433 if (!cs->seglen) {
456 BUG_ON(!cs->nr_segs); 434 BUG_ON(!cs->nr_segs);
@@ -473,7 +451,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
473 cs->seglen -= cs->len; 451 cs->seglen -= cs->len;
474 cs->addr += cs->len; 452 cs->addr += cs->len;
475 453
476 return lock_request(cs->req); 454 return lock_request(cs->fc, cs->req);
477} 455}
478 456
479/* Do as much copy to/from userspace buffer as we can */ 457/* Do as much copy to/from userspace buffer as we can */
@@ -585,9 +563,9 @@ static void request_wait(struct fuse_conn *fc)
585 if (signal_pending(current)) 563 if (signal_pending(current))
586 break; 564 break;
587 565
588 spin_unlock(&fuse_lock); 566 spin_unlock(&fc->lock);
589 schedule(); 567 schedule();
590 spin_lock(&fuse_lock); 568 spin_lock(&fc->lock);
591 } 569 }
592 set_current_state(TASK_RUNNING); 570 set_current_state(TASK_RUNNING);
593 remove_wait_queue(&fc->waitq, &wait); 571 remove_wait_queue(&fc->waitq, &wait);
@@ -606,18 +584,21 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
606 unsigned long nr_segs, loff_t *off) 584 unsigned long nr_segs, loff_t *off)
607{ 585{
608 int err; 586 int err;
609 struct fuse_conn *fc;
610 struct fuse_req *req; 587 struct fuse_req *req;
611 struct fuse_in *in; 588 struct fuse_in *in;
612 struct fuse_copy_state cs; 589 struct fuse_copy_state cs;
613 unsigned reqsize; 590 unsigned reqsize;
591 struct fuse_conn *fc = fuse_get_conn(file);
592 if (!fc)
593 return -EPERM;
614 594
615 restart: 595 restart:
616 spin_lock(&fuse_lock); 596 spin_lock(&fc->lock);
617 fc = file->private_data; 597 err = -EAGAIN;
618 err = -EPERM; 598 if ((file->f_flags & O_NONBLOCK) && fc->connected &&
619 if (!fc) 599 list_empty(&fc->pending))
620 goto err_unlock; 600 goto err_unlock;
601
621 request_wait(fc); 602 request_wait(fc);
622 err = -ENODEV; 603 err = -ENODEV;
623 if (!fc->connected) 604 if (!fc->connected)
@@ -641,14 +622,14 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
641 request_end(fc, req); 622 request_end(fc, req);
642 goto restart; 623 goto restart;
643 } 624 }
644 spin_unlock(&fuse_lock); 625 spin_unlock(&fc->lock);
645 fuse_copy_init(&cs, 1, req, iov, nr_segs); 626 fuse_copy_init(&cs, fc, 1, req, iov, nr_segs);
646 err = fuse_copy_one(&cs, &in->h, sizeof(in->h)); 627 err = fuse_copy_one(&cs, &in->h, sizeof(in->h));
647 if (!err) 628 if (!err)
648 err = fuse_copy_args(&cs, in->numargs, in->argpages, 629 err = fuse_copy_args(&cs, in->numargs, in->argpages,
649 (struct fuse_arg *) in->args, 0); 630 (struct fuse_arg *) in->args, 0);
650 fuse_copy_finish(&cs); 631 fuse_copy_finish(&cs);
651 spin_lock(&fuse_lock); 632 spin_lock(&fc->lock);
652 req->locked = 0; 633 req->locked = 0;
653 if (!err && req->interrupted) 634 if (!err && req->interrupted)
654 err = -ENOENT; 635 err = -ENOENT;
@@ -663,12 +644,12 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
663 else { 644 else {
664 req->state = FUSE_REQ_SENT; 645 req->state = FUSE_REQ_SENT;
665 list_move_tail(&req->list, &fc->processing); 646 list_move_tail(&req->list, &fc->processing);
666 spin_unlock(&fuse_lock); 647 spin_unlock(&fc->lock);
667 } 648 }
668 return reqsize; 649 return reqsize;
669 650
670 err_unlock: 651 err_unlock:
671 spin_unlock(&fuse_lock); 652 spin_unlock(&fc->lock);
672 return err; 653 return err;
673} 654}
674 655
@@ -735,9 +716,9 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
735 struct fuse_copy_state cs; 716 struct fuse_copy_state cs;
736 struct fuse_conn *fc = fuse_get_conn(file); 717 struct fuse_conn *fc = fuse_get_conn(file);
737 if (!fc) 718 if (!fc)
738 return -ENODEV; 719 return -EPERM;
739 720
740 fuse_copy_init(&cs, 0, NULL, iov, nr_segs); 721 fuse_copy_init(&cs, fc, 0, NULL, iov, nr_segs);
741 if (nbytes < sizeof(struct fuse_out_header)) 722 if (nbytes < sizeof(struct fuse_out_header))
742 return -EINVAL; 723 return -EINVAL;
743 724
@@ -749,7 +730,7 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
749 oh.len != nbytes) 730 oh.len != nbytes)
750 goto err_finish; 731 goto err_finish;
751 732
752 spin_lock(&fuse_lock); 733 spin_lock(&fc->lock);
753 err = -ENOENT; 734 err = -ENOENT;
754 if (!fc->connected) 735 if (!fc->connected)
755 goto err_unlock; 736 goto err_unlock;
@@ -760,9 +741,9 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
760 goto err_unlock; 741 goto err_unlock;
761 742
762 if (req->interrupted) { 743 if (req->interrupted) {
763 spin_unlock(&fuse_lock); 744 spin_unlock(&fc->lock);
764 fuse_copy_finish(&cs); 745 fuse_copy_finish(&cs);
765 spin_lock(&fuse_lock); 746 spin_lock(&fc->lock);
766 request_end(fc, req); 747 request_end(fc, req);
767 return -ENOENT; 748 return -ENOENT;
768 } 749 }
@@ -770,12 +751,12 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
770 req->out.h = oh; 751 req->out.h = oh;
771 req->locked = 1; 752 req->locked = 1;
772 cs.req = req; 753 cs.req = req;
773 spin_unlock(&fuse_lock); 754 spin_unlock(&fc->lock);
774 755
775 err = copy_out_args(&cs, &req->out, nbytes); 756 err = copy_out_args(&cs, &req->out, nbytes);
776 fuse_copy_finish(&cs); 757 fuse_copy_finish(&cs);
777 758
778 spin_lock(&fuse_lock); 759 spin_lock(&fc->lock);
779 req->locked = 0; 760 req->locked = 0;
780 if (!err) { 761 if (!err) {
781 if (req->interrupted) 762 if (req->interrupted)
@@ -787,7 +768,7 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
787 return err ? err : nbytes; 768 return err ? err : nbytes;
788 769
789 err_unlock: 770 err_unlock:
790 spin_unlock(&fuse_lock); 771 spin_unlock(&fc->lock);
791 err_finish: 772 err_finish:
792 fuse_copy_finish(&cs); 773 fuse_copy_finish(&cs);
793 return err; 774 return err;
@@ -804,18 +785,19 @@ static ssize_t fuse_dev_write(struct file *file, const char __user *buf,
804 785
805static unsigned fuse_dev_poll(struct file *file, poll_table *wait) 786static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
806{ 787{
807 struct fuse_conn *fc = fuse_get_conn(file);
808 unsigned mask = POLLOUT | POLLWRNORM; 788 unsigned mask = POLLOUT | POLLWRNORM;
809 789 struct fuse_conn *fc = fuse_get_conn(file);
810 if (!fc) 790 if (!fc)
811 return -ENODEV; 791 return POLLERR;
812 792
813 poll_wait(file, &fc->waitq, wait); 793 poll_wait(file, &fc->waitq, wait);
814 794
815 spin_lock(&fuse_lock); 795 spin_lock(&fc->lock);
816 if (!list_empty(&fc->pending)) 796 if (!fc->connected)
817 mask |= POLLIN | POLLRDNORM; 797 mask = POLLERR;
818 spin_unlock(&fuse_lock); 798 else if (!list_empty(&fc->pending))
799 mask |= POLLIN | POLLRDNORM;
800 spin_unlock(&fc->lock);
819 801
820 return mask; 802 return mask;
821} 803}
@@ -823,7 +805,7 @@ static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
823/* 805/*
824 * Abort all requests on the given list (pending or processing) 806 * Abort all requests on the given list (pending or processing)
825 * 807 *
826 * This function releases and reacquires fuse_lock 808 * This function releases and reacquires fc->lock
827 */ 809 */
828static void end_requests(struct fuse_conn *fc, struct list_head *head) 810static void end_requests(struct fuse_conn *fc, struct list_head *head)
829{ 811{
@@ -832,7 +814,7 @@ static void end_requests(struct fuse_conn *fc, struct list_head *head)
832 req = list_entry(head->next, struct fuse_req, list); 814 req = list_entry(head->next, struct fuse_req, list);
833 req->out.h.error = -ECONNABORTED; 815 req->out.h.error = -ECONNABORTED;
834 request_end(fc, req); 816 request_end(fc, req);
835 spin_lock(&fuse_lock); 817 spin_lock(&fc->lock);
836 } 818 }
837} 819}
838 820
@@ -863,10 +845,10 @@ static void end_io_requests(struct fuse_conn *fc)
863 req->end = NULL; 845 req->end = NULL;
864 /* The end function will consume this reference */ 846 /* The end function will consume this reference */
865 __fuse_get_request(req); 847 __fuse_get_request(req);
866 spin_unlock(&fuse_lock); 848 spin_unlock(&fc->lock);
867 wait_event(req->waitq, !req->locked); 849 wait_event(req->waitq, !req->locked);
868 end(fc, req); 850 end(fc, req);
869 spin_lock(&fuse_lock); 851 spin_lock(&fc->lock);
870 } 852 }
871 } 853 }
872} 854}
@@ -893,35 +875,44 @@ static void end_io_requests(struct fuse_conn *fc)
893 */ 875 */
894void fuse_abort_conn(struct fuse_conn *fc) 876void fuse_abort_conn(struct fuse_conn *fc)
895{ 877{
896 spin_lock(&fuse_lock); 878 spin_lock(&fc->lock);
897 if (fc->connected) { 879 if (fc->connected) {
898 fc->connected = 0; 880 fc->connected = 0;
899 end_io_requests(fc); 881 end_io_requests(fc);
900 end_requests(fc, &fc->pending); 882 end_requests(fc, &fc->pending);
901 end_requests(fc, &fc->processing); 883 end_requests(fc, &fc->processing);
902 wake_up_all(&fc->waitq); 884 wake_up_all(&fc->waitq);
885 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
903 } 886 }
904 spin_unlock(&fuse_lock); 887 spin_unlock(&fc->lock);
905} 888}
906 889
907static int fuse_dev_release(struct inode *inode, struct file *file) 890static int fuse_dev_release(struct inode *inode, struct file *file)
908{ 891{
909 struct fuse_conn *fc; 892 struct fuse_conn *fc = fuse_get_conn(file);
910
911 spin_lock(&fuse_lock);
912 fc = file->private_data;
913 if (fc) { 893 if (fc) {
894 spin_lock(&fc->lock);
914 fc->connected = 0; 895 fc->connected = 0;
915 end_requests(fc, &fc->pending); 896 end_requests(fc, &fc->pending);
916 end_requests(fc, &fc->processing); 897 end_requests(fc, &fc->processing);
917 } 898 spin_unlock(&fc->lock);
918 spin_unlock(&fuse_lock); 899 fasync_helper(-1, file, 0, &fc->fasync);
919 if (fc)
920 kobject_put(&fc->kobj); 900 kobject_put(&fc->kobj);
901 }
921 902
922 return 0; 903 return 0;
923} 904}
924 905
906static int fuse_dev_fasync(int fd, struct file *file, int on)
907{
908 struct fuse_conn *fc = fuse_get_conn(file);
909 if (!fc)
910 return -EPERM;
911
912 /* No locking - fasync_helper does its own locking */
913 return fasync_helper(fd, file, on, &fc->fasync);
914}
915
925const struct file_operations fuse_dev_operations = { 916const struct file_operations fuse_dev_operations = {
926 .owner = THIS_MODULE, 917 .owner = THIS_MODULE,
927 .llseek = no_llseek, 918 .llseek = no_llseek,
@@ -931,6 +922,7 @@ const struct file_operations fuse_dev_operations = {
931 .writev = fuse_dev_writev, 922 .writev = fuse_dev_writev,
932 .poll = fuse_dev_poll, 923 .poll = fuse_dev_poll,
933 .release = fuse_dev_release, 924 .release = fuse_dev_release,
925 .fasync = fuse_dev_fasync,
934}; 926};
935 927
936static struct miscdevice fuse_miscdevice = { 928static struct miscdevice fuse_miscdevice = {
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 256355b80256..8d7546e832e8 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -117,8 +117,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
117 return 0; 117 return 0;
118 118
119 fc = get_fuse_conn(inode); 119 fc = get_fuse_conn(inode);
120 req = fuse_get_request(fc); 120 req = fuse_get_req(fc);
121 if (!req) 121 if (IS_ERR(req))
122 return 0; 122 return 0;
123 123
124 fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg); 124 fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg);
@@ -188,9 +188,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
188 if (entry->d_name.len > FUSE_NAME_MAX) 188 if (entry->d_name.len > FUSE_NAME_MAX)
189 return ERR_PTR(-ENAMETOOLONG); 189 return ERR_PTR(-ENAMETOOLONG);
190 190
191 req = fuse_get_request(fc); 191 req = fuse_get_req(fc);
192 if (!req) 192 if (IS_ERR(req))
193 return ERR_PTR(-EINTR); 193 return ERR_PTR(PTR_ERR(req));
194 194
195 fuse_lookup_init(req, dir, entry, &outarg); 195 fuse_lookup_init(req, dir, entry, &outarg);
196 request_send(fc, req); 196 request_send(fc, req);
@@ -244,15 +244,14 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
244 struct file *file; 244 struct file *file;
245 int flags = nd->intent.open.flags - 1; 245 int flags = nd->intent.open.flags - 1;
246 246
247 err = -ENOSYS;
248 if (fc->no_create) 247 if (fc->no_create)
249 goto out; 248 return -ENOSYS;
250 249
251 err = -EINTR; 250 req = fuse_get_req(fc);
252 req = fuse_get_request(fc); 251 if (IS_ERR(req))
253 if (!req) 252 return PTR_ERR(req);
254 goto out;
255 253
254 err = -ENOMEM;
256 ff = fuse_file_alloc(); 255 ff = fuse_file_alloc();
257 if (!ff) 256 if (!ff)
258 goto out_put_request; 257 goto out_put_request;
@@ -314,7 +313,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
314 fuse_file_free(ff); 313 fuse_file_free(ff);
315 out_put_request: 314 out_put_request:
316 fuse_put_request(fc, req); 315 fuse_put_request(fc, req);
317 out:
318 return err; 316 return err;
319} 317}
320 318
@@ -375,9 +373,9 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode,
375{ 373{
376 struct fuse_mknod_in inarg; 374 struct fuse_mknod_in inarg;
377 struct fuse_conn *fc = get_fuse_conn(dir); 375 struct fuse_conn *fc = get_fuse_conn(dir);
378 struct fuse_req *req = fuse_get_request(fc); 376 struct fuse_req *req = fuse_get_req(fc);
379 if (!req) 377 if (IS_ERR(req))
380 return -EINTR; 378 return PTR_ERR(req);
381 379
382 memset(&inarg, 0, sizeof(inarg)); 380 memset(&inarg, 0, sizeof(inarg));
383 inarg.mode = mode; 381 inarg.mode = mode;
@@ -407,9 +405,9 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
407{ 405{
408 struct fuse_mkdir_in inarg; 406 struct fuse_mkdir_in inarg;
409 struct fuse_conn *fc = get_fuse_conn(dir); 407 struct fuse_conn *fc = get_fuse_conn(dir);
410 struct fuse_req *req = fuse_get_request(fc); 408 struct fuse_req *req = fuse_get_req(fc);
411 if (!req) 409 if (IS_ERR(req))
412 return -EINTR; 410 return PTR_ERR(req);
413 411
414 memset(&inarg, 0, sizeof(inarg)); 412 memset(&inarg, 0, sizeof(inarg));
415 inarg.mode = mode; 413 inarg.mode = mode;
@@ -427,9 +425,9 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
427{ 425{
428 struct fuse_conn *fc = get_fuse_conn(dir); 426 struct fuse_conn *fc = get_fuse_conn(dir);
429 unsigned len = strlen(link) + 1; 427 unsigned len = strlen(link) + 1;
430 struct fuse_req *req = fuse_get_request(fc); 428 struct fuse_req *req = fuse_get_req(fc);
431 if (!req) 429 if (IS_ERR(req))
432 return -EINTR; 430 return PTR_ERR(req);
433 431
434 req->in.h.opcode = FUSE_SYMLINK; 432 req->in.h.opcode = FUSE_SYMLINK;
435 req->in.numargs = 2; 433 req->in.numargs = 2;
@@ -444,9 +442,9 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
444{ 442{
445 int err; 443 int err;
446 struct fuse_conn *fc = get_fuse_conn(dir); 444 struct fuse_conn *fc = get_fuse_conn(dir);
447 struct fuse_req *req = fuse_get_request(fc); 445 struct fuse_req *req = fuse_get_req(fc);
448 if (!req) 446 if (IS_ERR(req))
449 return -EINTR; 447 return PTR_ERR(req);
450 448
451 req->in.h.opcode = FUSE_UNLINK; 449 req->in.h.opcode = FUSE_UNLINK;
452 req->in.h.nodeid = get_node_id(dir); 450 req->in.h.nodeid = get_node_id(dir);
@@ -476,9 +474,9 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
476{ 474{
477 int err; 475 int err;
478 struct fuse_conn *fc = get_fuse_conn(dir); 476 struct fuse_conn *fc = get_fuse_conn(dir);
479 struct fuse_req *req = fuse_get_request(fc); 477 struct fuse_req *req = fuse_get_req(fc);
480 if (!req) 478 if (IS_ERR(req))
481 return -EINTR; 479 return PTR_ERR(req);
482 480
483 req->in.h.opcode = FUSE_RMDIR; 481 req->in.h.opcode = FUSE_RMDIR;
484 req->in.h.nodeid = get_node_id(dir); 482 req->in.h.nodeid = get_node_id(dir);
@@ -504,9 +502,9 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent,
504 int err; 502 int err;
505 struct fuse_rename_in inarg; 503 struct fuse_rename_in inarg;
506 struct fuse_conn *fc = get_fuse_conn(olddir); 504 struct fuse_conn *fc = get_fuse_conn(olddir);
507 struct fuse_req *req = fuse_get_request(fc); 505 struct fuse_req *req = fuse_get_req(fc);
508 if (!req) 506 if (IS_ERR(req))
509 return -EINTR; 507 return PTR_ERR(req);
510 508
511 memset(&inarg, 0, sizeof(inarg)); 509 memset(&inarg, 0, sizeof(inarg));
512 inarg.newdir = get_node_id(newdir); 510 inarg.newdir = get_node_id(newdir);
@@ -553,9 +551,9 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
553 struct fuse_link_in inarg; 551 struct fuse_link_in inarg;
554 struct inode *inode = entry->d_inode; 552 struct inode *inode = entry->d_inode;
555 struct fuse_conn *fc = get_fuse_conn(inode); 553 struct fuse_conn *fc = get_fuse_conn(inode);
556 struct fuse_req *req = fuse_get_request(fc); 554 struct fuse_req *req = fuse_get_req(fc);
557 if (!req) 555 if (IS_ERR(req))
558 return -EINTR; 556 return PTR_ERR(req);
559 557
560 memset(&inarg, 0, sizeof(inarg)); 558 memset(&inarg, 0, sizeof(inarg));
561 inarg.oldnodeid = get_node_id(inode); 559 inarg.oldnodeid = get_node_id(inode);
@@ -583,9 +581,9 @@ int fuse_do_getattr(struct inode *inode)
583 int err; 581 int err;
584 struct fuse_attr_out arg; 582 struct fuse_attr_out arg;
585 struct fuse_conn *fc = get_fuse_conn(inode); 583 struct fuse_conn *fc = get_fuse_conn(inode);
586 struct fuse_req *req = fuse_get_request(fc); 584 struct fuse_req *req = fuse_get_req(fc);
587 if (!req) 585 if (IS_ERR(req))
588 return -EINTR; 586 return PTR_ERR(req);
589 587
590 req->in.h.opcode = FUSE_GETATTR; 588 req->in.h.opcode = FUSE_GETATTR;
591 req->in.h.nodeid = get_node_id(inode); 589 req->in.h.nodeid = get_node_id(inode);
@@ -673,9 +671,9 @@ static int fuse_access(struct inode *inode, int mask)
673 if (fc->no_access) 671 if (fc->no_access)
674 return 0; 672 return 0;
675 673
676 req = fuse_get_request(fc); 674 req = fuse_get_req(fc);
677 if (!req) 675 if (IS_ERR(req))
678 return -EINTR; 676 return PTR_ERR(req);
679 677
680 memset(&inarg, 0, sizeof(inarg)); 678 memset(&inarg, 0, sizeof(inarg));
681 inarg.mask = mask; 679 inarg.mask = mask;
@@ -780,9 +778,9 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
780 if (is_bad_inode(inode)) 778 if (is_bad_inode(inode))
781 return -EIO; 779 return -EIO;
782 780
783 req = fuse_get_request(fc); 781 req = fuse_get_req(fc);
784 if (!req) 782 if (IS_ERR(req))
785 return -EINTR; 783 return PTR_ERR(req);
786 784
787 page = alloc_page(GFP_KERNEL); 785 page = alloc_page(GFP_KERNEL);
788 if (!page) { 786 if (!page) {
@@ -809,11 +807,11 @@ static char *read_link(struct dentry *dentry)
809{ 807{
810 struct inode *inode = dentry->d_inode; 808 struct inode *inode = dentry->d_inode;
811 struct fuse_conn *fc = get_fuse_conn(inode); 809 struct fuse_conn *fc = get_fuse_conn(inode);
812 struct fuse_req *req = fuse_get_request(fc); 810 struct fuse_req *req = fuse_get_req(fc);
813 char *link; 811 char *link;
814 812
815 if (!req) 813 if (IS_ERR(req))
816 return ERR_PTR(-EINTR); 814 return ERR_PTR(PTR_ERR(req));
817 815
818 link = (char *) __get_free_page(GFP_KERNEL); 816 link = (char *) __get_free_page(GFP_KERNEL);
819 if (!link) { 817 if (!link) {
@@ -933,9 +931,9 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
933 } 931 }
934 } 932 }
935 933
936 req = fuse_get_request(fc); 934 req = fuse_get_req(fc);
937 if (!req) 935 if (IS_ERR(req))
938 return -EINTR; 936 return PTR_ERR(req);
939 937
940 memset(&inarg, 0, sizeof(inarg)); 938 memset(&inarg, 0, sizeof(inarg));
941 iattr_to_fattr(attr, &inarg); 939 iattr_to_fattr(attr, &inarg);
@@ -995,9 +993,9 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
995 if (fc->no_setxattr) 993 if (fc->no_setxattr)
996 return -EOPNOTSUPP; 994 return -EOPNOTSUPP;
997 995
998 req = fuse_get_request(fc); 996 req = fuse_get_req(fc);
999 if (!req) 997 if (IS_ERR(req))
1000 return -EINTR; 998 return PTR_ERR(req);
1001 999
1002 memset(&inarg, 0, sizeof(inarg)); 1000 memset(&inarg, 0, sizeof(inarg));
1003 inarg.size = size; 1001 inarg.size = size;
@@ -1035,9 +1033,9 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
1035 if (fc->no_getxattr) 1033 if (fc->no_getxattr)
1036 return -EOPNOTSUPP; 1034 return -EOPNOTSUPP;
1037 1035
1038 req = fuse_get_request(fc); 1036 req = fuse_get_req(fc);
1039 if (!req) 1037 if (IS_ERR(req))
1040 return -EINTR; 1038 return PTR_ERR(req);
1041 1039
1042 memset(&inarg, 0, sizeof(inarg)); 1040 memset(&inarg, 0, sizeof(inarg));
1043 inarg.size = size; 1041 inarg.size = size;
@@ -1085,9 +1083,9 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1085 if (fc->no_listxattr) 1083 if (fc->no_listxattr)
1086 return -EOPNOTSUPP; 1084 return -EOPNOTSUPP;
1087 1085
1088 req = fuse_get_request(fc); 1086 req = fuse_get_req(fc);
1089 if (!req) 1087 if (IS_ERR(req))
1090 return -EINTR; 1088 return PTR_ERR(req);
1091 1089
1092 memset(&inarg, 0, sizeof(inarg)); 1090 memset(&inarg, 0, sizeof(inarg));
1093 inarg.size = size; 1091 inarg.size = size;
@@ -1131,9 +1129,9 @@ static int fuse_removexattr(struct dentry *entry, const char *name)
1131 if (fc->no_removexattr) 1129 if (fc->no_removexattr)
1132 return -EOPNOTSUPP; 1130 return -EOPNOTSUPP;
1133 1131
1134 req = fuse_get_request(fc); 1132 req = fuse_get_req(fc);
1135 if (!req) 1133 if (IS_ERR(req))
1136 return -EINTR; 1134 return PTR_ERR(req);
1137 1135
1138 req->in.h.opcode = FUSE_REMOVEXATTR; 1136 req->in.h.opcode = FUSE_REMOVEXATTR;
1139 req->in.h.nodeid = get_node_id(inode); 1137 req->in.h.nodeid = get_node_id(inode);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 975f2697e866..fc342cf7c2cc 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -22,9 +22,9 @@ static int fuse_send_open(struct inode *inode, struct file *file, int isdir,
22 struct fuse_req *req; 22 struct fuse_req *req;
23 int err; 23 int err;
24 24
25 req = fuse_get_request(fc); 25 req = fuse_get_req(fc);
26 if (!req) 26 if (IS_ERR(req))
27 return -EINTR; 27 return PTR_ERR(req);
28 28
29 memset(&inarg, 0, sizeof(inarg)); 29 memset(&inarg, 0, sizeof(inarg));
30 inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); 30 inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
@@ -184,9 +184,9 @@ static int fuse_flush(struct file *file)
184 if (fc->no_flush) 184 if (fc->no_flush)
185 return 0; 185 return 0;
186 186
187 req = fuse_get_request(fc); 187 req = fuse_get_req(fc);
188 if (!req) 188 if (IS_ERR(req))
189 return -EINTR; 189 return PTR_ERR(req);
190 190
191 memset(&inarg, 0, sizeof(inarg)); 191 memset(&inarg, 0, sizeof(inarg));
192 inarg.fh = ff->fh; 192 inarg.fh = ff->fh;
@@ -223,9 +223,9 @@ int fuse_fsync_common(struct file *file, struct dentry *de, int datasync,
223 if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) 223 if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
224 return 0; 224 return 0;
225 225
226 req = fuse_get_request(fc); 226 req = fuse_get_req(fc);
227 if (!req) 227 if (IS_ERR(req))
228 return -EINTR; 228 return PTR_ERR(req);
229 229
230 memset(&inarg, 0, sizeof(inarg)); 230 memset(&inarg, 0, sizeof(inarg));
231 inarg.fh = ff->fh; 231 inarg.fh = ff->fh;
@@ -297,9 +297,9 @@ static int fuse_readpage(struct file *file, struct page *page)
297 if (is_bad_inode(inode)) 297 if (is_bad_inode(inode))
298 goto out; 298 goto out;
299 299
300 err = -EINTR; 300 req = fuse_get_req(fc);
301 req = fuse_get_request(fc); 301 err = PTR_ERR(req);
302 if (!req) 302 if (IS_ERR(req))
303 goto out; 303 goto out;
304 304
305 req->out.page_zeroing = 1; 305 req->out.page_zeroing = 1;
@@ -368,10 +368,10 @@ static int fuse_readpages_fill(void *_data, struct page *page)
368 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read || 368 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
369 req->pages[req->num_pages - 1]->index + 1 != page->index)) { 369 req->pages[req->num_pages - 1]->index + 1 != page->index)) {
370 fuse_send_readpages(req, data->file, inode); 370 fuse_send_readpages(req, data->file, inode);
371 data->req = req = fuse_get_request(fc); 371 data->req = req = fuse_get_req(fc);
372 if (!req) { 372 if (IS_ERR(req)) {
373 unlock_page(page); 373 unlock_page(page);
374 return -EINTR; 374 return PTR_ERR(req);
375 } 375 }
376 } 376 }
377 req->pages[req->num_pages] = page; 377 req->pages[req->num_pages] = page;
@@ -392,13 +392,17 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
392 392
393 data.file = file; 393 data.file = file;
394 data.inode = inode; 394 data.inode = inode;
395 data.req = fuse_get_request(fc); 395 data.req = fuse_get_req(fc);
396 if (!data.req) 396 if (IS_ERR(data.req))
397 return -EINTR; 397 return PTR_ERR(data.req);
398 398
399 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); 399 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
400 if (!err) 400 if (!err) {
401 fuse_send_readpages(data.req, file, inode); 401 if (data.req->num_pages)
402 fuse_send_readpages(data.req, file, inode);
403 else
404 fuse_put_request(fc, data.req);
405 }
402 return err; 406 return err;
403} 407}
404 408
@@ -451,9 +455,9 @@ static int fuse_commit_write(struct file *file, struct page *page,
451 if (is_bad_inode(inode)) 455 if (is_bad_inode(inode))
452 return -EIO; 456 return -EIO;
453 457
454 req = fuse_get_request(fc); 458 req = fuse_get_req(fc);
455 if (!req) 459 if (IS_ERR(req))
456 return -EINTR; 460 return PTR_ERR(req);
457 461
458 req->num_pages = 1; 462 req->num_pages = 1;
459 req->pages[0] = page; 463 req->pages[0] = page;
@@ -528,9 +532,9 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
528 if (is_bad_inode(inode)) 532 if (is_bad_inode(inode))
529 return -EIO; 533 return -EIO;
530 534
531 req = fuse_get_request(fc); 535 req = fuse_get_req(fc);
532 if (!req) 536 if (IS_ERR(req))
533 return -EINTR; 537 return PTR_ERR(req);
534 538
535 while (count) { 539 while (count) {
536 size_t nres; 540 size_t nres;
@@ -561,8 +565,12 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
561 buf += nres; 565 buf += nres;
562 if (nres != nbytes) 566 if (nres != nbytes)
563 break; 567 break;
564 if (count) 568 if (count) {
565 fuse_reset_request(req); 569 fuse_put_request(fc, req);
570 req = fuse_get_req(fc);
571 if (IS_ERR(req))
572 break;
573 }
566 } 574 }
567 fuse_put_request(fc, req); 575 fuse_put_request(fc, req);
568 if (res > 0) { 576 if (res > 0) {
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index a16a04fcf41e..59661c481d9d 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -18,8 +18,8 @@
18/** Max number of pages that can be used in a single read request */ 18/** Max number of pages that can be used in a single read request */
19#define FUSE_MAX_PAGES_PER_REQ 32 19#define FUSE_MAX_PAGES_PER_REQ 32
20 20
21/** If more requests are outstanding, then the operation will block */ 21/** Maximum number of outstanding background requests */
22#define FUSE_MAX_OUTSTANDING 10 22#define FUSE_MAX_BACKGROUND 10
23 23
24/** It could be as large as PATH_MAX, but would that have any uses? */ 24/** It could be as large as PATH_MAX, but would that have any uses? */
25#define FUSE_NAME_MAX 1024 25#define FUSE_NAME_MAX 1024
@@ -131,8 +131,8 @@ struct fuse_conn;
131 * A request to the client 131 * A request to the client
132 */ 132 */
133struct fuse_req { 133struct fuse_req {
134 /** This can be on either unused_list, pending processing or 134 /** This can be on either pending processing or io lists in
135 io lists in fuse_conn */ 135 fuse_conn */
136 struct list_head list; 136 struct list_head list;
137 137
138 /** Entry on the background list */ 138 /** Entry on the background list */
@@ -144,15 +144,12 @@ struct fuse_req {
144 /* 144 /*
145 * The following bitfields are either set once before the 145 * The following bitfields are either set once before the
146 * request is queued or setting/clearing them is protected by 146 * request is queued or setting/clearing them is protected by
147 * fuse_lock 147 * fuse_conn->lock
148 */ 148 */
149 149
150 /** True if the request has reply */ 150 /** True if the request has reply */
151 unsigned isreply:1; 151 unsigned isreply:1;
152 152
153 /** The request is preallocated */
154 unsigned preallocated:1;
155
156 /** The request was interrupted */ 153 /** The request was interrupted */
157 unsigned interrupted:1; 154 unsigned interrupted:1;
158 155
@@ -162,6 +159,9 @@ struct fuse_req {
162 /** Data is being copied to/from the request */ 159 /** Data is being copied to/from the request */
163 unsigned locked:1; 160 unsigned locked:1;
164 161
162 /** Request is counted as "waiting" */
163 unsigned waiting:1;
164
165 /** State of the request */ 165 /** State of the request */
166 enum fuse_req_state state; 166 enum fuse_req_state state;
167 167
@@ -213,6 +213,9 @@ struct fuse_req {
213 * unmounted. 213 * unmounted.
214 */ 214 */
215struct fuse_conn { 215struct fuse_conn {
216 /** Lock protecting accessess to members of this structure */
217 spinlock_t lock;
218
216 /** The user id for this mount */ 219 /** The user id for this mount */
217 uid_t user_id; 220 uid_t user_id;
218 221
@@ -244,25 +247,20 @@ struct fuse_conn {
244 interrupted request) */ 247 interrupted request) */
245 struct list_head background; 248 struct list_head background;
246 249
247 /** Controls the maximum number of outstanding requests */ 250 /** Number of requests currently in the background */
248 struct semaphore outstanding_sem; 251 unsigned num_background;
249 252
250 /** This counts the number of outstanding requests if 253 /** Flag indicating if connection is blocked. This will be
251 outstanding_sem would go negative */ 254 the case before the INIT reply is received, and if there
252 unsigned outstanding_debt; 255 are too many outstading backgrounds requests */
256 int blocked;
253 257
254 /** RW semaphore for exclusion with fuse_put_super() */ 258 /** waitq for blocked connection */
255 struct rw_semaphore sbput_sem; 259 wait_queue_head_t blocked_waitq;
256
257 /** The list of unused requests */
258 struct list_head unused_list;
259 260
260 /** The next unique request id */ 261 /** The next unique request id */
261 u64 reqctr; 262 u64 reqctr;
262 263
263 /** Mount is active */
264 unsigned mounted;
265
266 /** Connection established, cleared on umount, connection 264 /** Connection established, cleared on umount, connection
267 abort and device release */ 265 abort and device release */
268 unsigned connected; 266 unsigned connected;
@@ -318,6 +316,9 @@ struct fuse_conn {
318 316
319 /** kobject */ 317 /** kobject */
320 struct kobject kobj; 318 struct kobject kobj;
319
320 /** O_ASYNC requests */
321 struct fasync_struct *fasync;
321}; 322};
322 323
323static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) 324static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
@@ -349,21 +350,6 @@ static inline u64 get_node_id(struct inode *inode)
349extern const struct file_operations fuse_dev_operations; 350extern const struct file_operations fuse_dev_operations;
350 351
351/** 352/**
352 * This is the single global spinlock which protects FUSE's structures
353 *
354 * The following data is protected by this lock:
355 *
356 * - the private_data field of the device file
357 * - the s_fs_info field of the super block
358 * - unused_list, pending, processing lists in fuse_conn
359 * - background list in fuse_conn
360 * - the unique request ID counter reqctr in fuse_conn
361 * - the sb (super_block) field in fuse_conn
362 * - the file (device file) field in fuse_conn
363 */
364extern spinlock_t fuse_lock;
365
366/**
367 * Get a filled in inode 353 * Get a filled in inode
368 */ 354 */
369struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, 355struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
@@ -461,11 +447,11 @@ void fuse_reset_request(struct fuse_req *req);
461/** 447/**
462 * Reserve a preallocated request 448 * Reserve a preallocated request
463 */ 449 */
464struct fuse_req *fuse_get_request(struct fuse_conn *fc); 450struct fuse_req *fuse_get_req(struct fuse_conn *fc);
465 451
466/** 452/**
467 * Decrement reference count of a request. If count goes to zero put 453 * Decrement reference count of a request. If count goes to zero free
468 * on unused list (preallocated) or free request (not preallocated). 454 * the request.
469 */ 455 */
470void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); 456void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
471 457
@@ -485,11 +471,11 @@ void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req);
485void request_send_background(struct fuse_conn *fc, struct fuse_req *req); 471void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
486 472
487/** 473/**
488 * Release inodes and file associated with background request 474 * Remove request from the the background list
489 */ 475 */
490void fuse_release_background(struct fuse_req *req); 476void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req);
491 477
492/* Abort all requests */ 478/** Abort all requests */
493void fuse_abort_conn(struct fuse_conn *fc); 479void fuse_abort_conn(struct fuse_conn *fc);
494 480
495/** 481/**
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 879e6fba9480..43a6fc0db8a7 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -22,7 +22,6 @@ MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
22MODULE_DESCRIPTION("Filesystem in Userspace"); 22MODULE_DESCRIPTION("Filesystem in Userspace");
23MODULE_LICENSE("GPL"); 23MODULE_LICENSE("GPL");
24 24
25spinlock_t fuse_lock;
26static kmem_cache_t *fuse_inode_cachep; 25static kmem_cache_t *fuse_inode_cachep;
27static struct subsystem connections_subsys; 26static struct subsystem connections_subsys;
28 27
@@ -205,17 +204,28 @@ static void fuse_put_super(struct super_block *sb)
205{ 204{
206 struct fuse_conn *fc = get_fuse_conn_super(sb); 205 struct fuse_conn *fc = get_fuse_conn_super(sb);
207 206
208 down_write(&fc->sbput_sem); 207 spin_lock(&fc->lock);
209 while (!list_empty(&fc->background))
210 fuse_release_background(list_entry(fc->background.next,
211 struct fuse_req, bg_entry));
212
213 spin_lock(&fuse_lock);
214 fc->mounted = 0;
215 fc->connected = 0; 208 fc->connected = 0;
216 spin_unlock(&fuse_lock); 209 while (!list_empty(&fc->background)) {
217 up_write(&fc->sbput_sem); 210 struct fuse_req *req = list_entry(fc->background.next,
211 struct fuse_req, bg_entry);
212 struct inode *inode = req->inode;
213 struct inode *inode2 = req->inode2;
214
215 /* File would hold a reference to vfsmount */
216 BUG_ON(req->file);
217 req->inode = NULL;
218 req->inode2 = NULL;
219 fuse_remove_background(fc, req);
220
221 spin_unlock(&fc->lock);
222 iput(inode);
223 iput(inode2);
224 spin_lock(&fc->lock);
225 }
226 spin_unlock(&fc->lock);
218 /* Flush all readers on this fs */ 227 /* Flush all readers on this fs */
228 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
219 wake_up_all(&fc->waitq); 229 wake_up_all(&fc->waitq);
220 kobject_del(&fc->kobj); 230 kobject_del(&fc->kobj);
221 kobject_put(&fc->kobj); 231 kobject_put(&fc->kobj);
@@ -242,9 +252,9 @@ static int fuse_statfs(struct super_block *sb, struct kstatfs *buf)
242 struct fuse_statfs_out outarg; 252 struct fuse_statfs_out outarg;
243 int err; 253 int err;
244 254
245 req = fuse_get_request(fc); 255 req = fuse_get_req(fc);
246 if (!req) 256 if (IS_ERR(req))
247 return -EINTR; 257 return PTR_ERR(req);
248 258
249 memset(&outarg, 0, sizeof(outarg)); 259 memset(&outarg, 0, sizeof(outarg));
250 req->in.numargs = 0; 260 req->in.numargs = 0;
@@ -369,15 +379,7 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
369 379
370static void fuse_conn_release(struct kobject *kobj) 380static void fuse_conn_release(struct kobject *kobj)
371{ 381{
372 struct fuse_conn *fc = get_fuse_conn_kobj(kobj); 382 kfree(get_fuse_conn_kobj(kobj));
373
374 while (!list_empty(&fc->unused_list)) {
375 struct fuse_req *req;
376 req = list_entry(fc->unused_list.next, struct fuse_req, list);
377 list_del(&req->list);
378 fuse_request_free(req);
379 }
380 kfree(fc);
381} 383}
382 384
383static struct fuse_conn *new_conn(void) 385static struct fuse_conn *new_conn(void)
@@ -386,64 +388,24 @@ static struct fuse_conn *new_conn(void)
386 388
387 fc = kzalloc(sizeof(*fc), GFP_KERNEL); 389 fc = kzalloc(sizeof(*fc), GFP_KERNEL);
388 if (fc) { 390 if (fc) {
389 int i; 391 spin_lock_init(&fc->lock);
390 init_waitqueue_head(&fc->waitq); 392 init_waitqueue_head(&fc->waitq);
393 init_waitqueue_head(&fc->blocked_waitq);
391 INIT_LIST_HEAD(&fc->pending); 394 INIT_LIST_HEAD(&fc->pending);
392 INIT_LIST_HEAD(&fc->processing); 395 INIT_LIST_HEAD(&fc->processing);
393 INIT_LIST_HEAD(&fc->io); 396 INIT_LIST_HEAD(&fc->io);
394 INIT_LIST_HEAD(&fc->unused_list);
395 INIT_LIST_HEAD(&fc->background); 397 INIT_LIST_HEAD(&fc->background);
396 sema_init(&fc->outstanding_sem, 1); /* One for INIT */
397 init_rwsem(&fc->sbput_sem);
398 kobj_set_kset_s(fc, connections_subsys); 398 kobj_set_kset_s(fc, connections_subsys);
399 kobject_init(&fc->kobj); 399 kobject_init(&fc->kobj);
400 atomic_set(&fc->num_waiting, 0); 400 atomic_set(&fc->num_waiting, 0);
401 for (i = 0; i < FUSE_MAX_OUTSTANDING; i++) {
402 struct fuse_req *req = fuse_request_alloc();
403 if (!req) {
404 kobject_put(&fc->kobj);
405 return NULL;
406 }
407 list_add(&req->list, &fc->unused_list);
408 }
409 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 401 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
410 fc->bdi.unplug_io_fn = default_unplug_io_fn; 402 fc->bdi.unplug_io_fn = default_unplug_io_fn;
411 fc->reqctr = 0; 403 fc->reqctr = 0;
404 fc->blocked = 1;
412 } 405 }
413 return fc; 406 return fc;
414} 407}
415 408
416static struct fuse_conn *get_conn(struct file *file, struct super_block *sb)
417{
418 struct fuse_conn *fc;
419 int err;
420
421 err = -EINVAL;
422 if (file->f_op != &fuse_dev_operations)
423 goto out_err;
424
425 err = -ENOMEM;
426 fc = new_conn();
427 if (!fc)
428 goto out_err;
429
430 spin_lock(&fuse_lock);
431 err = -EINVAL;
432 if (file->private_data)
433 goto out_unlock;
434
435 kobject_get(&fc->kobj);
436 file->private_data = fc;
437 spin_unlock(&fuse_lock);
438 return fc;
439
440 out_unlock:
441 spin_unlock(&fuse_lock);
442 kobject_put(&fc->kobj);
443 out_err:
444 return ERR_PTR(err);
445}
446
447static struct inode *get_root_inode(struct super_block *sb, unsigned mode) 409static struct inode *get_root_inode(struct super_block *sb, unsigned mode)
448{ 410{
449 struct fuse_attr attr; 411 struct fuse_attr attr;
@@ -467,7 +429,6 @@ static struct super_operations fuse_super_operations = {
467 429
468static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) 430static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
469{ 431{
470 int i;
471 struct fuse_init_out *arg = &req->misc.init_out; 432 struct fuse_init_out *arg = &req->misc.init_out;
472 433
473 if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION) 434 if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION)
@@ -486,22 +447,13 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
486 fc->minor = arg->minor; 447 fc->minor = arg->minor;
487 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write; 448 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
488 } 449 }
489
490 /* After INIT reply is received other requests can go
491 out. So do (FUSE_MAX_OUTSTANDING - 1) number of
492 up()s on outstanding_sem. The last up() is done in
493 fuse_putback_request() */
494 for (i = 1; i < FUSE_MAX_OUTSTANDING; i++)
495 up(&fc->outstanding_sem);
496
497 fuse_put_request(fc, req); 450 fuse_put_request(fc, req);
451 fc->blocked = 0;
452 wake_up_all(&fc->blocked_waitq);
498} 453}
499 454
500static void fuse_send_init(struct fuse_conn *fc) 455static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
501{ 456{
502 /* This is called from fuse_read_super() so there's guaranteed
503 to be exactly one request available */
504 struct fuse_req *req = fuse_get_request(fc);
505 struct fuse_init_in *arg = &req->misc.init_in; 457 struct fuse_init_in *arg = &req->misc.init_in;
506 458
507 arg->major = FUSE_KERNEL_VERSION; 459 arg->major = FUSE_KERNEL_VERSION;
@@ -525,12 +477,9 @@ static void fuse_send_init(struct fuse_conn *fc)
525 477
526static unsigned long long conn_id(void) 478static unsigned long long conn_id(void)
527{ 479{
480 /* BKL is held for ->get_sb() */
528 static unsigned long long ctr = 1; 481 static unsigned long long ctr = 1;
529 unsigned long long val; 482 return ctr++;
530 spin_lock(&fuse_lock);
531 val = ctr++;
532 spin_unlock(&fuse_lock);
533 return val;
534} 483}
535 484
536static int fuse_fill_super(struct super_block *sb, void *data, int silent) 485static int fuse_fill_super(struct super_block *sb, void *data, int silent)
@@ -540,6 +489,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
540 struct fuse_mount_data d; 489 struct fuse_mount_data d;
541 struct file *file; 490 struct file *file;
542 struct dentry *root_dentry; 491 struct dentry *root_dentry;
492 struct fuse_req *init_req;
543 int err; 493 int err;
544 494
545 if (!parse_fuse_opt((char *) data, &d)) 495 if (!parse_fuse_opt((char *) data, &d))
@@ -555,10 +505,17 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
555 if (!file) 505 if (!file)
556 return -EINVAL; 506 return -EINVAL;
557 507
558 fc = get_conn(file, sb); 508 if (file->f_op != &fuse_dev_operations)
559 fput(file); 509 return -EINVAL;
560 if (IS_ERR(fc)) 510
561 return PTR_ERR(fc); 511 /* Setting file->private_data can't race with other mount()
512 instances, since BKL is held for ->get_sb() */
513 if (file->private_data)
514 return -EINVAL;
515
516 fc = new_conn();
517 if (!fc)
518 return -ENOMEM;
562 519
563 fc->flags = d.flags; 520 fc->flags = d.flags;
564 fc->user_id = d.user_id; 521 fc->user_id = d.user_id;
@@ -579,27 +536,39 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
579 goto err; 536 goto err;
580 } 537 }
581 538
539 init_req = fuse_request_alloc();
540 if (!init_req)
541 goto err_put_root;
542
582 err = kobject_set_name(&fc->kobj, "%llu", conn_id()); 543 err = kobject_set_name(&fc->kobj, "%llu", conn_id());
583 if (err) 544 if (err)
584 goto err_put_root; 545 goto err_free_req;
585 546
586 err = kobject_add(&fc->kobj); 547 err = kobject_add(&fc->kobj);
587 if (err) 548 if (err)
588 goto err_put_root; 549 goto err_free_req;
589 550
590 sb->s_root = root_dentry; 551 sb->s_root = root_dentry;
591 spin_lock(&fuse_lock);
592 fc->mounted = 1;
593 fc->connected = 1; 552 fc->connected = 1;
594 spin_unlock(&fuse_lock); 553 kobject_get(&fc->kobj);
554 file->private_data = fc;
555 /*
556 * atomic_dec_and_test() in fput() provides the necessary
557 * memory barrier for file->private_data to be visible on all
558 * CPUs after this
559 */
560 fput(file);
595 561
596 fuse_send_init(fc); 562 fuse_send_init(fc, init_req);
597 563
598 return 0; 564 return 0;
599 565
566 err_free_req:
567 fuse_request_free(init_req);
600 err_put_root: 568 err_put_root:
601 dput(root_dentry); 569 dput(root_dentry);
602 err: 570 err:
571 fput(file);
603 kobject_put(&fc->kobj); 572 kobject_put(&fc->kobj);
604 return err; 573 return err;
605} 574}
@@ -753,7 +722,6 @@ static int __init fuse_init(void)
753 printk("fuse init (API version %i.%i)\n", 722 printk("fuse init (API version %i.%i)\n",
754 FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION); 723 FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);
755 724
756 spin_lock_init(&fuse_lock);
757 res = fuse_fs_init(); 725 res = fuse_fs_init();
758 if (res) 726 if (res)
759 goto err; 727 goto err;
diff --git a/fs/inotify.c b/fs/inotify.c
index 367c487c014b..1f50302849c5 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -538,7 +538,7 @@ void inotify_d_instantiate(struct dentry *entry, struct inode *inode)
538 WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); 538 WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
539 spin_lock(&entry->d_lock); 539 spin_lock(&entry->d_lock);
540 parent = entry->d_parent; 540 parent = entry->d_parent;
541 if (inotify_inode_watched(parent->d_inode)) 541 if (parent->d_inode && inotify_inode_watched(parent->d_inode))
542 entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; 542 entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
543 spin_unlock(&entry->d_lock); 543 spin_unlock(&entry->d_lock);
544} 544}
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index d2b66bad7d50..3ef739120dff 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -650,7 +650,7 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
650 svc_wake_up(block->b_daemon); 650 svc_wake_up(block->b_daemon);
651} 651}
652 652
653void nlmsvc_grant_release(void *data) 653static void nlmsvc_grant_release(void *data)
654{ 654{
655 struct nlm_rqst *call = data; 655 struct nlm_rqst *call = data;
656 656
diff --git a/fs/locks.c b/fs/locks.c
index dda83d6cd48b..efad798824dc 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2230,7 +2230,12 @@ void steal_locks(fl_owner_t from)
2230 2230
2231 lock_kernel(); 2231 lock_kernel();
2232 j = 0; 2232 j = 0;
2233 rcu_read_lock(); 2233
2234 /*
2235 * We are not taking a ref to the file structures, so
2236 * we need to acquire ->file_lock.
2237 */
2238 spin_lock(&files->file_lock);
2234 fdt = files_fdtable(files); 2239 fdt = files_fdtable(files);
2235 for (;;) { 2240 for (;;) {
2236 unsigned long set; 2241 unsigned long set;
@@ -2248,7 +2253,7 @@ void steal_locks(fl_owner_t from)
2248 set >>= 1; 2253 set >>= 1;
2249 } 2254 }
2250 } 2255 }
2251 rcu_read_unlock(); 2256 spin_unlock(&files->file_lock);
2252 unlock_kernel(); 2257 unlock_kernel();
2253} 2258}
2254EXPORT_SYMBOL(steal_locks); 2259EXPORT_SYMBOL(steal_locks);
diff --git a/fs/namespace.c b/fs/namespace.c
index bf478addb852..2c5f1f80bdc2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -899,11 +899,13 @@ static int do_change_type(struct nameidata *nd, int flag)
899/* 899/*
900 * do loopback mount. 900 * do loopback mount.
901 */ 901 */
902static int do_loopback(struct nameidata *nd, char *old_name, int recurse) 902static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags, int mnt_flags)
903{ 903{
904 struct nameidata old_nd; 904 struct nameidata old_nd;
905 struct vfsmount *mnt = NULL; 905 struct vfsmount *mnt = NULL;
906 int recurse = flags & MS_REC;
906 int err = mount_is_safe(nd); 907 int err = mount_is_safe(nd);
908
907 if (err) 909 if (err)
908 return err; 910 return err;
909 if (!old_name || !*old_name) 911 if (!old_name || !*old_name)
@@ -937,6 +939,7 @@ static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
937 spin_unlock(&vfsmount_lock); 939 spin_unlock(&vfsmount_lock);
938 release_mounts(&umount_list); 940 release_mounts(&umount_list);
939 } 941 }
942 mnt->mnt_flags = mnt_flags;
940 943
941out: 944out:
942 up_write(&namespace_sem); 945 up_write(&namespace_sem);
@@ -1350,7 +1353,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1350 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, 1353 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
1351 data_page); 1354 data_page);
1352 else if (flags & MS_BIND) 1355 else if (flags & MS_BIND)
1353 retval = do_loopback(&nd, dev_name, flags & MS_REC); 1356 retval = do_loopback(&nd, dev_name, flags, mnt_flags);
1354 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) 1357 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
1355 retval = do_change_type(&nd, flags); 1358 retval = do_change_type(&nd, flags);
1356 else if (flags & MS_MOVE) 1359 else if (flags & MS_MOVE)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a23f34894167..cae74dd4c7f5 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -128,15 +128,14 @@ struct inode_operations nfs4_dir_inode_operations = {
128static int 128static int
129nfs_opendir(struct inode *inode, struct file *filp) 129nfs_opendir(struct inode *inode, struct file *filp)
130{ 130{
131 int res = 0; 131 int res;
132 132
133 dfprintk(VFS, "NFS: opendir(%s/%ld)\n", 133 dfprintk(VFS, "NFS: opendir(%s/%ld)\n",
134 inode->i_sb->s_id, inode->i_ino); 134 inode->i_sb->s_id, inode->i_ino);
135 135
136 lock_kernel(); 136 lock_kernel();
137 /* Call generic open code in order to cache credentials */ 137 /* Call generic open code in order to cache credentials */
138 if (!res) 138 res = nfs_open(inode, filp);
139 res = nfs_open(inode, filp);
140 unlock_kernel(); 139 unlock_kernel();
141 return res; 140 return res;
142} 141}
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 0f583cb16ddb..3c72b0c07283 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -112,10 +112,9 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
112 */ 112 */
113ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) 113ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
114{ 114{
115 struct dentry *dentry = iocb->ki_filp->f_dentry;
116
117 dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", 115 dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
118 dentry->d_name.name, (long long) pos, nr_segs); 116 iocb->ki_filp->f_dentry->d_name.name,
117 (long long) pos, nr_segs);
119 118
120 return -EINVAL; 119 return -EINVAL;
121} 120}
@@ -468,7 +467,6 @@ static const struct rpc_call_ops nfs_commit_direct_ops = {
468static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) 467static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
469{ 468{
470 struct nfs_write_data *data = dreq->commit_data; 469 struct nfs_write_data *data = dreq->commit_data;
471 struct rpc_task *task = &data->task;
472 470
473 data->inode = dreq->inode; 471 data->inode = dreq->inode;
474 data->cred = dreq->ctx->cred; 472 data->cred = dreq->ctx->cred;
@@ -489,7 +487,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
489 /* Note: task.tk_ops->rpc_release will free dreq->commit_data */ 487 /* Note: task.tk_ops->rpc_release will free dreq->commit_data */
490 dreq->commit_data = NULL; 488 dreq->commit_data = NULL;
491 489
492 dprintk("NFS: %5u initiated commit call\n", task->tk_pid); 490 dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
493 491
494 lock_kernel(); 492 lock_kernel();
495 rpc_execute(&data->task); 493 rpc_execute(&data->task);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index f1df2c8d9259..fade02c15e6e 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -534,10 +534,9 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
534 */ 534 */
535static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) 535static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
536{ 536{
537 struct inode * inode = filp->f_mapping->host;
538
539 dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n", 537 dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n",
540 inode->i_sb->s_id, inode->i_ino, 538 filp->f_dentry->d_inode->i_sb->s_id,
539 filp->f_dentry->d_inode->i_ino,
541 fl->fl_type, fl->fl_flags); 540 fl->fl_type, fl->fl_flags);
542 541
543 /* 542 /*
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 2f7656b911b6..d0b991a92327 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -700,12 +700,9 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
700 /* 700 /*
701 * Display superblock I/O counters 701 * Display superblock I/O counters
702 */ 702 */
703 for (cpu = 0; cpu < NR_CPUS; cpu++) { 703 for_each_possible_cpu(cpu) {
704 struct nfs_iostats *stats; 704 struct nfs_iostats *stats;
705 705
706 if (!cpu_possible(cpu))
707 continue;
708
709 preempt_disable(); 706 preempt_disable();
710 stats = per_cpu_ptr(nfss->io_stats, cpu); 707 stats = per_cpu_ptr(nfss->io_stats, cpu);
711 708
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 47ece1dd3c67..d86c0db7b1e8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1218,7 +1218,7 @@ out:
1218 return status; 1218 return status;
1219} 1219}
1220 1220
1221static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state) 1221static int nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state)
1222{ 1222{
1223 struct file *filp; 1223 struct file *filp;
1224 1224
@@ -1227,8 +1227,10 @@ static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, st
1227 struct nfs_open_context *ctx; 1227 struct nfs_open_context *ctx;
1228 ctx = (struct nfs_open_context *)filp->private_data; 1228 ctx = (struct nfs_open_context *)filp->private_data;
1229 ctx->state = state; 1229 ctx->state = state;
1230 } else 1230 return 0;
1231 nfs4_close_state(state, nd->intent.open.flags); 1231 }
1232 nfs4_close_state(state, nd->intent.open.flags);
1233 return PTR_ERR(filp);
1232} 1234}
1233 1235
1234struct dentry * 1236struct dentry *
@@ -1835,7 +1837,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1835 nfs_setattr_update_inode(state->inode, sattr); 1837 nfs_setattr_update_inode(state->inode, sattr);
1836 } 1838 }
1837 if (status == 0 && nd != NULL && (nd->flags & LOOKUP_OPEN)) 1839 if (status == 0 && nd != NULL && (nd->flags & LOOKUP_OPEN))
1838 nfs4_intent_set_file(nd, dentry, state); 1840 status = nfs4_intent_set_file(nd, dentry, state);
1839 else 1841 else
1840 nfs4_close_state(state, flags); 1842 nfs4_close_state(state, flags);
1841out: 1843out:
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index cfe9ce881613..6e92b0fe5323 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -14,46 +14,46 @@
14 14
15int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) 15int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
16{ 16{
17 struct svc_cred *cred = &rqstp->rq_cred; 17 struct svc_cred cred = rqstp->rq_cred;
18 int i; 18 int i;
19 int ret; 19 int ret;
20 20
21 if (exp->ex_flags & NFSEXP_ALLSQUASH) { 21 if (exp->ex_flags & NFSEXP_ALLSQUASH) {
22 cred->cr_uid = exp->ex_anon_uid; 22 cred.cr_uid = exp->ex_anon_uid;
23 cred->cr_gid = exp->ex_anon_gid; 23 cred.cr_gid = exp->ex_anon_gid;
24 put_group_info(cred->cr_group_info); 24 cred.cr_group_info = groups_alloc(0);
25 cred->cr_group_info = groups_alloc(0);
26 } else if (exp->ex_flags & NFSEXP_ROOTSQUASH) { 25 } else if (exp->ex_flags & NFSEXP_ROOTSQUASH) {
27 struct group_info *gi; 26 struct group_info *gi;
28 if (!cred->cr_uid) 27 if (!cred.cr_uid)
29 cred->cr_uid = exp->ex_anon_uid; 28 cred.cr_uid = exp->ex_anon_uid;
30 if (!cred->cr_gid) 29 if (!cred.cr_gid)
31 cred->cr_gid = exp->ex_anon_gid; 30 cred.cr_gid = exp->ex_anon_gid;
32 gi = groups_alloc(cred->cr_group_info->ngroups); 31 gi = groups_alloc(cred.cr_group_info->ngroups);
33 if (gi) 32 if (gi)
34 for (i = 0; i < cred->cr_group_info->ngroups; i++) { 33 for (i = 0; i < cred.cr_group_info->ngroups; i++) {
35 if (!GROUP_AT(cred->cr_group_info, i)) 34 if (!GROUP_AT(cred.cr_group_info, i))
36 GROUP_AT(gi, i) = exp->ex_anon_gid; 35 GROUP_AT(gi, i) = exp->ex_anon_gid;
37 else 36 else
38 GROUP_AT(gi, i) = GROUP_AT(cred->cr_group_info, i); 37 GROUP_AT(gi, i) = GROUP_AT(cred.cr_group_info, i);
39 } 38 }
40 put_group_info(cred->cr_group_info); 39 cred.cr_group_info = gi;
41 cred->cr_group_info = gi; 40 } else
42 } 41 get_group_info(cred.cr_group_info);
43 42
44 if (cred->cr_uid != (uid_t) -1) 43 if (cred.cr_uid != (uid_t) -1)
45 current->fsuid = cred->cr_uid; 44 current->fsuid = cred.cr_uid;
46 else 45 else
47 current->fsuid = exp->ex_anon_uid; 46 current->fsuid = exp->ex_anon_uid;
48 if (cred->cr_gid != (gid_t) -1) 47 if (cred.cr_gid != (gid_t) -1)
49 current->fsgid = cred->cr_gid; 48 current->fsgid = cred.cr_gid;
50 else 49 else
51 current->fsgid = exp->ex_anon_gid; 50 current->fsgid = exp->ex_anon_gid;
52 51
53 if (!cred->cr_group_info) 52 if (!cred.cr_group_info)
54 return -ENOMEM; 53 return -ENOMEM;
55 ret = set_current_groups(cred->cr_group_info); 54 ret = set_current_groups(cred.cr_group_info);
56 if ((cred->cr_uid)) { 55 put_group_info(cred.cr_group_info);
56 if ((cred.cr_uid)) {
57 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK; 57 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK;
58 } else { 58 } else {
59 cap_t(current->cap_effective) |= (CAP_NFSD_MASK & 59 cap_t(current->cap_effective) |= (CAP_NFSD_MASK &
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index c340be0a3f59..4e0578121d9a 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -422,7 +422,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
422 if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) 422 if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
423 goto out; 423 goto out;
424 err = path_lookup(buf, 0, &nd); 424 err = path_lookup(buf, 0, &nd);
425 if (err) goto out; 425 if (err) goto out_no_path;
426 426
427 exp.h.flags = 0; 427 exp.h.flags = 0;
428 exp.ex_client = dom; 428 exp.ex_client = dom;
@@ -475,6 +475,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
475 out: 475 out:
476 if (nd.dentry) 476 if (nd.dentry)
477 path_release(&nd); 477 path_release(&nd);
478 out_no_path:
478 if (dom) 479 if (dom)
479 auth_domain_put(dom); 480 auth_domain_put(dom);
480 kfree(buf); 481 kfree(buf);
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 6d2dfed1de08..f61142afea44 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -682,7 +682,7 @@ static struct svc_procedure nfsd_procedures3[22] = {
682 PROC(lookup, dirop, dirop, fhandle2, RC_NOCACHE, ST+FH+pAT+pAT), 682 PROC(lookup, dirop, dirop, fhandle2, RC_NOCACHE, ST+FH+pAT+pAT),
683 PROC(access, access, access, fhandle, RC_NOCACHE, ST+pAT+1), 683 PROC(access, access, access, fhandle, RC_NOCACHE, ST+pAT+1),
684 PROC(readlink, readlink, readlink, fhandle, RC_NOCACHE, ST+pAT+1+NFS3_MAXPATHLEN/4), 684 PROC(readlink, readlink, readlink, fhandle, RC_NOCACHE, ST+pAT+1+NFS3_MAXPATHLEN/4),
685 PROC(read, read, read, fhandle, RC_NOCACHE, ST+pAT+4+NFSSVC_MAXBLKSIZE), 685 PROC(read, read, read, fhandle, RC_NOCACHE, ST+pAT+4+NFSSVC_MAXBLKSIZE/4),
686 PROC(write, write, write, fhandle, RC_REPLBUFF, ST+WC+4), 686 PROC(write, write, write, fhandle, RC_REPLBUFF, ST+WC+4),
687 PROC(create, create, create, fhandle2, RC_REPLBUFF, ST+(1+FH+pAT)+WC), 687 PROC(create, create, create, fhandle2, RC_REPLBUFF, ST+(1+FH+pAT)+WC),
688 PROC(mkdir, mkdir, create, fhandle2, RC_REPLBUFF, ST+(1+FH+pAT)+WC), 688 PROC(mkdir, mkdir, create, fhandle2, RC_REPLBUFF, ST+(1+FH+pAT)+WC),
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 7391f4aabedb..edb107e61b91 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -710,9 +710,9 @@ calculate_posix_ace_count(struct nfs4_acl *n4acl)
710 /* Also, the remaining entries are for named users and 710 /* Also, the remaining entries are for named users and
711 * groups, and come in threes (mask, allow, deny): */ 711 * groups, and come in threes (mask, allow, deny): */
712 if (n4acl->naces < 7) 712 if (n4acl->naces < 7)
713 return -1; 713 return -EINVAL;
714 if ((n4acl->naces - 7) % 3) 714 if ((n4acl->naces - 7) % 3)
715 return -1; 715 return -EINVAL;
716 return 4 + (n4acl->naces - 7)/3; 716 return 4 + (n4acl->naces - 7)/3;
717 } 717 }
718} 718}
@@ -790,7 +790,7 @@ nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl)
790 continue; 790 continue;
791 791
792 error = nfs4_acl_add_ace(dacl, ace->type, ace->flag, 792 error = nfs4_acl_add_ace(dacl, ace->type, ace->flag,
793 ace->access_mask, ace->whotype, ace->who) == -1; 793 ace->access_mask, ace->whotype, ace->who);
794 if (error < 0) 794 if (error < 0)
795 goto out; 795 goto out;
796 796
@@ -866,7 +866,7 @@ nfs4_acl_add_ace(struct nfs4_acl *acl, u32 type, u32 flag, u32 access_mask,
866 struct nfs4_ace *ace; 866 struct nfs4_ace *ace;
867 867
868 if ((ace = kmalloc(sizeof(*ace), GFP_KERNEL)) == NULL) 868 if ((ace = kmalloc(sizeof(*ace), GFP_KERNEL)) == NULL)
869 return -1; 869 return -ENOMEM;
870 870
871 ace->type = type; 871 ace->type = type;
872 ace->flag = flag; 872 ace->flag = flag;
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index c872bd07fc10..dbaf3f93f328 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -441,8 +441,9 @@ nfsd4_probe_callback(struct nfs4_client *clp)
441 goto out_clnt; 441 goto out_clnt;
442 } 442 }
443 443
444 /* the task holds a reference to the nfs4_client struct */
445 cb->cb_client = clnt; 444 cb->cb_client = clnt;
445
446 /* the task holds a reference to the nfs4_client struct */
446 atomic_inc(&clp->cl_count); 447 atomic_inc(&clp->cl_count);
447 448
448 msg.rpc_cred = nfsd4_lookupcred(clp,0); 449 msg.rpc_cred = nfsd4_lookupcred(clp,0);
@@ -460,13 +461,12 @@ nfsd4_probe_callback(struct nfs4_client *clp)
460out_rpciod: 461out_rpciod:
461 atomic_dec(&clp->cl_count); 462 atomic_dec(&clp->cl_count);
462 rpciod_down(); 463 rpciod_down();
464 cb->cb_client = NULL;
463out_clnt: 465out_clnt:
464 rpc_shutdown_client(clnt); 466 rpc_shutdown_client(clnt);
465 goto out_err;
466out_err: 467out_err:
467 dprintk("NFSD: warning: no callback path to client %.*s\n", 468 dprintk("NFSD: warning: no callback path to client %.*s\n",
468 (int)clp->cl_name.len, clp->cl_name.data); 469 (int)clp->cl_name.len, clp->cl_name.data);
469 cb->cb_client = NULL;
470} 470}
471 471
472static void 472static void
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 6d63f1d9e5f5..b0e095ea0c03 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -288,8 +288,6 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
288 fh_put(current_fh); 288 fh_put(current_fh);
289 status = exp_pseudoroot(rqstp->rq_client, current_fh, 289 status = exp_pseudoroot(rqstp->rq_client, current_fh,
290 &rqstp->rq_chandle); 290 &rqstp->rq_chandle);
291 if (!status)
292 status = nfserrno(nfsd_setuser(rqstp, current_fh->fh_export));
293 return status; 291 return status;
294} 292}
295 293
@@ -975,7 +973,7 @@ struct nfsd4_voidargs { int dummy; };
975 */ 973 */
976static struct svc_procedure nfsd_procedures4[2] = { 974static struct svc_procedure nfsd_procedures4[2] = {
977 PROC(null, void, void, void, RC_NOCACHE, 1), 975 PROC(null, void, void, void, RC_NOCACHE, 1),
978 PROC(compound, compound, compound, compound, RC_NOCACHE, NFSD_BUFSIZE) 976 PROC(compound, compound, compound, compound, RC_NOCACHE, NFSD_BUFSIZE/4)
979}; 977};
980 978
981struct svc_version nfsd_version4 = { 979struct svc_version nfsd_version4 = {
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 47ec112b266c..96c7578cbe1e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -147,6 +147,42 @@ get_nfs4_file(struct nfs4_file *fi)
147 kref_get(&fi->fi_ref); 147 kref_get(&fi->fi_ref);
148} 148}
149 149
150static int num_delegations;
151
152/*
153 * Open owner state (share locks)
154 */
155
156/* hash tables for nfs4_stateowner */
157#define OWNER_HASH_BITS 8
158#define OWNER_HASH_SIZE (1 << OWNER_HASH_BITS)
159#define OWNER_HASH_MASK (OWNER_HASH_SIZE - 1)
160
161#define ownerid_hashval(id) \
162 ((id) & OWNER_HASH_MASK)
163#define ownerstr_hashval(clientid, ownername) \
164 (((clientid) + opaque_hashval((ownername.data), (ownername.len))) & OWNER_HASH_MASK)
165
166static struct list_head ownerid_hashtbl[OWNER_HASH_SIZE];
167static struct list_head ownerstr_hashtbl[OWNER_HASH_SIZE];
168
169/* hash table for nfs4_file */
170#define FILE_HASH_BITS 8
171#define FILE_HASH_SIZE (1 << FILE_HASH_BITS)
172#define FILE_HASH_MASK (FILE_HASH_SIZE - 1)
173/* hash table for (open)nfs4_stateid */
174#define STATEID_HASH_BITS 10
175#define STATEID_HASH_SIZE (1 << STATEID_HASH_BITS)
176#define STATEID_HASH_MASK (STATEID_HASH_SIZE - 1)
177
178#define file_hashval(x) \
179 hash_ptr(x, FILE_HASH_BITS)
180#define stateid_hashval(owner_id, file_id) \
181 (((owner_id) + (file_id)) & STATEID_HASH_MASK)
182
183static struct list_head file_hashtbl[FILE_HASH_SIZE];
184static struct list_head stateid_hashtbl[STATEID_HASH_SIZE];
185
150static struct nfs4_delegation * 186static struct nfs4_delegation *
151alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_fh *current_fh, u32 type) 187alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_fh *current_fh, u32 type)
152{ 188{
@@ -155,9 +191,12 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
155 struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback; 191 struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback;
156 192
157 dprintk("NFSD alloc_init_deleg\n"); 193 dprintk("NFSD alloc_init_deleg\n");
194 if (num_delegations > STATEID_HASH_SIZE * 4)
195 return NULL;
158 dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL); 196 dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL);
159 if (dp == NULL) 197 if (dp == NULL)
160 return dp; 198 return dp;
199 num_delegations++;
161 INIT_LIST_HEAD(&dp->dl_perfile); 200 INIT_LIST_HEAD(&dp->dl_perfile);
162 INIT_LIST_HEAD(&dp->dl_perclnt); 201 INIT_LIST_HEAD(&dp->dl_perclnt);
163 INIT_LIST_HEAD(&dp->dl_recall_lru); 202 INIT_LIST_HEAD(&dp->dl_recall_lru);
@@ -192,6 +231,7 @@ nfs4_put_delegation(struct nfs4_delegation *dp)
192 dprintk("NFSD: freeing dp %p\n",dp); 231 dprintk("NFSD: freeing dp %p\n",dp);
193 put_nfs4_file(dp->dl_file); 232 put_nfs4_file(dp->dl_file);
194 kmem_cache_free(deleg_slab, dp); 233 kmem_cache_free(deleg_slab, dp);
234 num_delegations--;
195 } 235 }
196} 236}
197 237
@@ -330,22 +370,29 @@ put_nfs4_client(struct nfs4_client *clp)
330} 370}
331 371
332static void 372static void
373shutdown_callback_client(struct nfs4_client *clp)
374{
375 struct rpc_clnt *clnt = clp->cl_callback.cb_client;
376
377 /* shutdown rpc client, ending any outstanding recall rpcs */
378 if (clnt) {
379 clp->cl_callback.cb_client = NULL;
380 rpc_shutdown_client(clnt);
381 rpciod_down();
382 }
383}
384
385static void
333expire_client(struct nfs4_client *clp) 386expire_client(struct nfs4_client *clp)
334{ 387{
335 struct nfs4_stateowner *sop; 388 struct nfs4_stateowner *sop;
336 struct nfs4_delegation *dp; 389 struct nfs4_delegation *dp;
337 struct nfs4_callback *cb = &clp->cl_callback;
338 struct rpc_clnt *clnt = clp->cl_callback.cb_client;
339 struct list_head reaplist; 390 struct list_head reaplist;
340 391
341 dprintk("NFSD: expire_client cl_count %d\n", 392 dprintk("NFSD: expire_client cl_count %d\n",
342 atomic_read(&clp->cl_count)); 393 atomic_read(&clp->cl_count));
343 394
344 /* shutdown rpc client, ending any outstanding recall rpcs */ 395 shutdown_callback_client(clp);
345 if (atomic_read(&cb->cb_set) == 1 && clnt) {
346 rpc_shutdown_client(clnt);
347 clnt = clp->cl_callback.cb_client = NULL;
348 }
349 396
350 INIT_LIST_HEAD(&reaplist); 397 INIT_LIST_HEAD(&reaplist);
351 spin_lock(&recall_lock); 398 spin_lock(&recall_lock);
@@ -936,40 +983,6 @@ out:
936 return status; 983 return status;
937} 984}
938 985
939/*
940 * Open owner state (share locks)
941 */
942
943/* hash tables for nfs4_stateowner */
944#define OWNER_HASH_BITS 8
945#define OWNER_HASH_SIZE (1 << OWNER_HASH_BITS)
946#define OWNER_HASH_MASK (OWNER_HASH_SIZE - 1)
947
948#define ownerid_hashval(id) \
949 ((id) & OWNER_HASH_MASK)
950#define ownerstr_hashval(clientid, ownername) \
951 (((clientid) + opaque_hashval((ownername.data), (ownername.len))) & OWNER_HASH_MASK)
952
953static struct list_head ownerid_hashtbl[OWNER_HASH_SIZE];
954static struct list_head ownerstr_hashtbl[OWNER_HASH_SIZE];
955
956/* hash table for nfs4_file */
957#define FILE_HASH_BITS 8
958#define FILE_HASH_SIZE (1 << FILE_HASH_BITS)
959#define FILE_HASH_MASK (FILE_HASH_SIZE - 1)
960/* hash table for (open)nfs4_stateid */
961#define STATEID_HASH_BITS 10
962#define STATEID_HASH_SIZE (1 << STATEID_HASH_BITS)
963#define STATEID_HASH_MASK (STATEID_HASH_SIZE - 1)
964
965#define file_hashval(x) \
966 hash_ptr(x, FILE_HASH_BITS)
967#define stateid_hashval(owner_id, file_id) \
968 (((owner_id) + (file_id)) & STATEID_HASH_MASK)
969
970static struct list_head file_hashtbl[FILE_HASH_SIZE];
971static struct list_head stateid_hashtbl[STATEID_HASH_SIZE];
972
973/* OPEN Share state helper functions */ 986/* OPEN Share state helper functions */
974static inline struct nfs4_file * 987static inline struct nfs4_file *
975alloc_init_file(struct inode *ino) 988alloc_init_file(struct inode *ino)
@@ -1186,8 +1199,7 @@ move_to_close_lru(struct nfs4_stateowner *sop)
1186{ 1199{
1187 dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop); 1200 dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop);
1188 1201
1189 unhash_stateowner(sop); 1202 list_move_tail(&sop->so_close_lru, &close_lru);
1190 list_add_tail(&sop->so_close_lru, &close_lru);
1191 sop->so_time = get_seconds(); 1203 sop->so_time = get_seconds();
1192} 1204}
1193 1205
@@ -1916,8 +1928,7 @@ nfs4_laundromat(void)
1916 } 1928 }
1917 dprintk("NFSD: purging unused open stateowner (so_id %d)\n", 1929 dprintk("NFSD: purging unused open stateowner (so_id %d)\n",
1918 sop->so_id); 1930 sop->so_id);
1919 list_del(&sop->so_close_lru); 1931 release_stateowner(sop);
1920 nfs4_put_stateowner(sop);
1921 } 1932 }
1922 if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT) 1933 if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT)
1923 clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT; 1934 clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT;
@@ -2495,36 +2506,27 @@ nfs4_transform_lock_offset(struct file_lock *lock)
2495 lock->fl_end = OFFSET_MAX; 2506 lock->fl_end = OFFSET_MAX;
2496} 2507}
2497 2508
2498static int 2509/* Hack!: For now, we're defining this just so we can use a pointer to it
2499nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval) 2510 * as a unique cookie to identify our (NFSv4's) posix locks. */
2500{ 2511static struct lock_manager_operations nfsd_posix_mng_ops = {
2501 struct nfs4_stateowner *local = NULL; 2512};
2502 int status = 0;
2503
2504 if (hashval >= LOCK_HASH_SIZE)
2505 goto out;
2506 list_for_each_entry(local, &lock_ownerid_hashtbl[hashval], so_idhash) {
2507 if (local == sop) {
2508 status = 1;
2509 goto out;
2510 }
2511 }
2512out:
2513 return status;
2514}
2515
2516 2513
2517static inline void 2514static inline void
2518nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny) 2515nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny)
2519{ 2516{
2520 struct nfs4_stateowner *sop = (struct nfs4_stateowner *) fl->fl_owner; 2517 struct nfs4_stateowner *sop;
2521 unsigned int hval = lockownerid_hashval(sop->so_id); 2518 unsigned int hval;
2522 2519
2523 deny->ld_sop = NULL; 2520 if (fl->fl_lmops == &nfsd_posix_mng_ops) {
2524 if (nfs4_verify_lock_stateowner(sop, hval)) { 2521 sop = (struct nfs4_stateowner *) fl->fl_owner;
2522 hval = lockownerid_hashval(sop->so_id);
2525 kref_get(&sop->so_ref); 2523 kref_get(&sop->so_ref);
2526 deny->ld_sop = sop; 2524 deny->ld_sop = sop;
2527 deny->ld_clientid = sop->so_client->cl_clientid; 2525 deny->ld_clientid = sop->so_client->cl_clientid;
2526 } else {
2527 deny->ld_sop = NULL;
2528 deny->ld_clientid.cl_boot = 0;
2529 deny->ld_clientid.cl_id = 0;
2528 } 2530 }
2529 deny->ld_start = fl->fl_start; 2531 deny->ld_start = fl->fl_start;
2530 deny->ld_length = ~(u64)0; 2532 deny->ld_length = ~(u64)0;
@@ -2736,6 +2738,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2736 file_lock.fl_pid = current->tgid; 2738 file_lock.fl_pid = current->tgid;
2737 file_lock.fl_file = filp; 2739 file_lock.fl_file = filp;
2738 file_lock.fl_flags = FL_POSIX; 2740 file_lock.fl_flags = FL_POSIX;
2741 file_lock.fl_lmops = &nfsd_posix_mng_ops;
2739 2742
2740 file_lock.fl_start = lock->lk_offset; 2743 file_lock.fl_start = lock->lk_offset;
2741 if ((lock->lk_length == ~(u64)0) || 2744 if ((lock->lk_length == ~(u64)0) ||
@@ -2841,6 +2844,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2841 file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner; 2844 file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner;
2842 file_lock.fl_pid = current->tgid; 2845 file_lock.fl_pid = current->tgid;
2843 file_lock.fl_flags = FL_POSIX; 2846 file_lock.fl_flags = FL_POSIX;
2847 file_lock.fl_lmops = &nfsd_posix_mng_ops;
2844 2848
2845 file_lock.fl_start = lockt->lt_offset; 2849 file_lock.fl_start = lockt->lt_offset;
2846 if ((lockt->lt_length == ~(u64)0) || LOFF_OVERFLOW(lockt->lt_offset, lockt->lt_length)) 2850 if ((lockt->lt_length == ~(u64)0) || LOFF_OVERFLOW(lockt->lt_offset, lockt->lt_length))
@@ -2900,6 +2904,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2900 file_lock.fl_pid = current->tgid; 2904 file_lock.fl_pid = current->tgid;
2901 file_lock.fl_file = filp; 2905 file_lock.fl_file = filp;
2902 file_lock.fl_flags = FL_POSIX; 2906 file_lock.fl_flags = FL_POSIX;
2907 file_lock.fl_lmops = &nfsd_posix_mng_ops;
2903 file_lock.fl_start = locku->lu_offset; 2908 file_lock.fl_start = locku->lu_offset;
2904 2909
2905 if ((locku->lu_length == ~(u64)0) || LOFF_OVERFLOW(locku->lu_offset, locku->lu_length)) 2910 if ((locku->lu_length == ~(u64)0) || LOFF_OVERFLOW(locku->lu_offset, locku->lu_length))
@@ -3211,15 +3216,8 @@ __nfs4_state_shutdown(void)
3211 int i; 3216 int i;
3212 struct nfs4_client *clp = NULL; 3217 struct nfs4_client *clp = NULL;
3213 struct nfs4_delegation *dp = NULL; 3218 struct nfs4_delegation *dp = NULL;
3214 struct nfs4_stateowner *sop = NULL;
3215 struct list_head *pos, *next, reaplist; 3219 struct list_head *pos, *next, reaplist;
3216 3220
3217 list_for_each_safe(pos, next, &close_lru) {
3218 sop = list_entry(pos, struct nfs4_stateowner, so_close_lru);
3219 list_del(&sop->so_close_lru);
3220 nfs4_put_stateowner(sop);
3221 }
3222
3223 for (i = 0; i < CLIENT_HASH_SIZE; i++) { 3221 for (i = 0; i < CLIENT_HASH_SIZE; i++) {
3224 while (!list_empty(&conf_id_hashtbl[i])) { 3222 while (!list_empty(&conf_id_hashtbl[i])) {
3225 clp = list_entry(conf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); 3223 clp = list_entry(conf_id_hashtbl[i].next, struct nfs4_client, cl_idhash);
@@ -3244,8 +3242,6 @@ __nfs4_state_shutdown(void)
3244 } 3242 }
3245 3243
3246 cancel_delayed_work(&laundromat_work); 3244 cancel_delayed_work(&laundromat_work);
3247 flush_workqueue(laundry_wq);
3248 destroy_workqueue(laundry_wq);
3249 nfsd4_shutdown_recdir(); 3245 nfsd4_shutdown_recdir();
3250 nfs4_init = 0; 3246 nfs4_init = 0;
3251} 3247}
@@ -3253,6 +3249,8 @@ __nfs4_state_shutdown(void)
3253void 3249void
3254nfs4_state_shutdown(void) 3250nfs4_state_shutdown(void)
3255{ 3251{
3252 cancel_rearming_delayed_workqueue(laundry_wq, &laundromat_work);
3253 destroy_workqueue(laundry_wq);
3256 nfs4_lock_state(); 3254 nfs4_lock_state();
3257 nfs4_release_reclaim(); 3255 nfs4_release_reclaim();
3258 __nfs4_state_shutdown(); 3256 __nfs4_state_shutdown();
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 03857fd81126..de3998f15f10 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -299,11 +299,10 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
299 buf, dummy32, &ace.who); 299 buf, dummy32, &ace.who);
300 if (status) 300 if (status)
301 goto out_nfserr; 301 goto out_nfserr;
302 if (nfs4_acl_add_ace(*acl, ace.type, ace.flag, 302 status = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
303 ace.access_mask, ace.whotype, ace.who) != 0) { 303 ace.access_mask, ace.whotype, ace.who);
304 status = -ENOMEM; 304 if (status)
305 goto out_nfserr; 305 goto out_nfserr;
306 }
307 } 306 }
308 } else 307 } else
309 *acl = NULL; 308 *acl = NULL;
@@ -2085,27 +2084,20 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
2085 WRITE32(eof); 2084 WRITE32(eof);
2086 WRITE32(maxcount); 2085 WRITE32(maxcount);
2087 ADJUST_ARGS(); 2086 ADJUST_ARGS();
2088 resp->xbuf->head[0].iov_len = ((char*)resp->p) - (char*)resp->xbuf->head[0].iov_base; 2087 resp->xbuf->head[0].iov_len = (char*)p
2089 2088 - (char*)resp->xbuf->head[0].iov_base;
2090 resp->xbuf->page_len = maxcount; 2089 resp->xbuf->page_len = maxcount;
2091 2090
2092 /* read zero bytes -> don't set up tail */ 2091 /* Use rest of head for padding and remaining ops: */
2093 if(!maxcount) 2092 resp->rqstp->rq_restailpage = 0;
2094 return 0; 2093 resp->xbuf->tail[0].iov_base = p;
2095
2096 /* set up page for remaining responses */
2097 svc_take_page(resp->rqstp);
2098 resp->xbuf->tail[0].iov_base =
2099 page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2100 resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
2101 resp->xbuf->tail[0].iov_len = 0; 2094 resp->xbuf->tail[0].iov_len = 0;
2102 resp->p = resp->xbuf->tail[0].iov_base;
2103 resp->end = resp->p + PAGE_SIZE/4;
2104
2105 if (maxcount&3) { 2095 if (maxcount&3) {
2106 *(resp->p)++ = 0; 2096 RESERVE_SPACE(4);
2097 WRITE32(0);
2107 resp->xbuf->tail[0].iov_base += maxcount&3; 2098 resp->xbuf->tail[0].iov_base += maxcount&3;
2108 resp->xbuf->tail[0].iov_len = 4 - (maxcount&3); 2099 resp->xbuf->tail[0].iov_len = 4 - (maxcount&3);
2100 ADJUST_ARGS();
2109 } 2101 }
2110 return 0; 2102 return 0;
2111} 2103}
@@ -2142,21 +2134,20 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2142 2134
2143 WRITE32(maxcount); 2135 WRITE32(maxcount);
2144 ADJUST_ARGS(); 2136 ADJUST_ARGS();
2145 resp->xbuf->head[0].iov_len = ((char*)resp->p) - (char*)resp->xbuf->head[0].iov_base; 2137 resp->xbuf->head[0].iov_len = (char*)p
2138 - (char*)resp->xbuf->head[0].iov_base;
2139 resp->xbuf->page_len = maxcount;
2146 2140
2147 svc_take_page(resp->rqstp); 2141 /* Use rest of head for padding and remaining ops: */
2148 resp->xbuf->tail[0].iov_base = 2142 resp->rqstp->rq_restailpage = 0;
2149 page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]); 2143 resp->xbuf->tail[0].iov_base = p;
2150 resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
2151 resp->xbuf->tail[0].iov_len = 0; 2144 resp->xbuf->tail[0].iov_len = 0;
2152 resp->p = resp->xbuf->tail[0].iov_base;
2153 resp->end = resp->p + PAGE_SIZE/4;
2154
2155 resp->xbuf->page_len = maxcount;
2156 if (maxcount&3) { 2145 if (maxcount&3) {
2157 *(resp->p)++ = 0; 2146 RESERVE_SPACE(4);
2147 WRITE32(0);
2158 resp->xbuf->tail[0].iov_base += maxcount&3; 2148 resp->xbuf->tail[0].iov_base += maxcount&3;
2159 resp->xbuf->tail[0].iov_len = 4 - (maxcount&3); 2149 resp->xbuf->tail[0].iov_len = 4 - (maxcount&3);
2150 ADJUST_ARGS();
2160 } 2151 }
2161 return 0; 2152 return 0;
2162} 2153}
@@ -2166,7 +2157,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
2166{ 2157{
2167 int maxcount; 2158 int maxcount;
2168 loff_t offset; 2159 loff_t offset;
2169 u32 *page, *savep; 2160 u32 *page, *savep, *tailbase;
2170 ENCODE_HEAD; 2161 ENCODE_HEAD;
2171 2162
2172 if (nfserr) 2163 if (nfserr)
@@ -2182,6 +2173,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
2182 WRITE32(0); 2173 WRITE32(0);
2183 ADJUST_ARGS(); 2174 ADJUST_ARGS();
2184 resp->xbuf->head[0].iov_len = ((char*)resp->p) - (char*)resp->xbuf->head[0].iov_base; 2175 resp->xbuf->head[0].iov_len = ((char*)resp->p) - (char*)resp->xbuf->head[0].iov_base;
2176 tailbase = p;
2185 2177
2186 maxcount = PAGE_SIZE; 2178 maxcount = PAGE_SIZE;
2187 if (maxcount > readdir->rd_maxcount) 2179 if (maxcount > readdir->rd_maxcount)
@@ -2226,14 +2218,12 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
2226 *p++ = htonl(readdir->common.err == nfserr_eof); 2218 *p++ = htonl(readdir->common.err == nfserr_eof);
2227 resp->xbuf->page_len = ((char*)p) - (char*)page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]); 2219 resp->xbuf->page_len = ((char*)p) - (char*)page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2228 2220
2229 /* allocate a page for the tail */ 2221 /* Use rest of head for padding and remaining ops: */
2230 svc_take_page(resp->rqstp); 2222 resp->rqstp->rq_restailpage = 0;
2231 resp->xbuf->tail[0].iov_base = 2223 resp->xbuf->tail[0].iov_base = tailbase;
2232 page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2233 resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
2234 resp->xbuf->tail[0].iov_len = 0; 2224 resp->xbuf->tail[0].iov_len = 0;
2235 resp->p = resp->xbuf->tail[0].iov_base; 2225 resp->p = resp->xbuf->tail[0].iov_base;
2236 resp->end = resp->p + PAGE_SIZE/4; 2226 resp->end = resp->p + (PAGE_SIZE - resp->xbuf->head[0].iov_len)/4;
2237 2227
2238 return 0; 2228 return 0;
2239err_no_verf: 2229err_no_verf:
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 3e6b75cd90fd..06cd0db0f32b 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -553,7 +553,7 @@ static struct svc_procedure nfsd_procedures2[18] = {
553 PROC(none, void, void, none, RC_NOCACHE, ST), 553 PROC(none, void, void, none, RC_NOCACHE, ST),
554 PROC(lookup, diropargs, diropres, fhandle, RC_NOCACHE, ST+FH+AT), 554 PROC(lookup, diropargs, diropres, fhandle, RC_NOCACHE, ST+FH+AT),
555 PROC(readlink, readlinkargs, readlinkres, none, RC_NOCACHE, ST+1+NFS_MAXPATHLEN/4), 555 PROC(readlink, readlinkargs, readlinkres, none, RC_NOCACHE, ST+1+NFS_MAXPATHLEN/4),
556 PROC(read, readargs, readres, fhandle, RC_NOCACHE, ST+AT+1+NFSSVC_MAXBLKSIZE), 556 PROC(read, readargs, readres, fhandle, RC_NOCACHE, ST+AT+1+NFSSVC_MAXBLKSIZE/4),
557 PROC(none, void, void, none, RC_NOCACHE, ST), 557 PROC(none, void, void, none, RC_NOCACHE, ST),
558 PROC(write, writeargs, attrstat, fhandle, RC_REPLBUFF, ST+AT), 558 PROC(write, writeargs, attrstat, fhandle, RC_REPLBUFF, ST+AT),
559 PROC(create, createargs, diropres, fhandle, RC_REPLBUFF, ST+FH+AT), 559 PROC(create, createargs, diropres, fhandle, RC_REPLBUFF, ST+FH+AT),
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 31018333dc38..6aa92d0e6876 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -371,7 +371,6 @@ out_nfserr:
371static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) 371static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
372{ 372{
373 ssize_t buflen; 373 ssize_t buflen;
374 int error;
375 374
376 buflen = vfs_getxattr(dentry, key, NULL, 0); 375 buflen = vfs_getxattr(dentry, key, NULL, 0);
377 if (buflen <= 0) 376 if (buflen <= 0)
@@ -381,10 +380,7 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
381 if (!*buf) 380 if (!*buf)
382 return -ENOMEM; 381 return -ENOMEM;
383 382
384 error = vfs_getxattr(dentry, key, *buf, buflen); 383 return vfs_getxattr(dentry, key, *buf, buflen);
385 if (error < 0)
386 return error;
387 return buflen;
388} 384}
389#endif 385#endif
390 386
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index bff0f0d06867..21f38accd039 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -153,6 +153,7 @@ struct o2hb_region {
153struct o2hb_bio_wait_ctxt { 153struct o2hb_bio_wait_ctxt {
154 atomic_t wc_num_reqs; 154 atomic_t wc_num_reqs;
155 struct completion wc_io_complete; 155 struct completion wc_io_complete;
156 int wc_error;
156}; 157};
157 158
158static void o2hb_write_timeout(void *arg) 159static void o2hb_write_timeout(void *arg)
@@ -186,6 +187,7 @@ static inline void o2hb_bio_wait_init(struct o2hb_bio_wait_ctxt *wc,
186{ 187{
187 atomic_set(&wc->wc_num_reqs, num_ios); 188 atomic_set(&wc->wc_num_reqs, num_ios);
188 init_completion(&wc->wc_io_complete); 189 init_completion(&wc->wc_io_complete);
190 wc->wc_error = 0;
189} 191}
190 192
191/* Used in error paths too */ 193/* Used in error paths too */
@@ -218,8 +220,10 @@ static int o2hb_bio_end_io(struct bio *bio,
218{ 220{
219 struct o2hb_bio_wait_ctxt *wc = bio->bi_private; 221 struct o2hb_bio_wait_ctxt *wc = bio->bi_private;
220 222
221 if (error) 223 if (error) {
222 mlog(ML_ERROR, "IO Error %d\n", error); 224 mlog(ML_ERROR, "IO Error %d\n", error);
225 wc->wc_error = error;
226 }
223 227
224 if (bio->bi_size) 228 if (bio->bi_size)
225 return 1; 229 return 1;
@@ -390,6 +394,8 @@ static int o2hb_read_slots(struct o2hb_region *reg,
390 394
391bail_and_wait: 395bail_and_wait:
392 o2hb_wait_on_io(reg, &wc); 396 o2hb_wait_on_io(reg, &wc);
397 if (wc.wc_error && !status)
398 status = wc.wc_error;
393 399
394 if (bios) { 400 if (bios) {
395 for(i = 0; i < num_bios; i++) 401 for(i = 0; i < num_bios; i++)
@@ -790,20 +796,24 @@ static int o2hb_highest_node(unsigned long *nodes,
790 return highest; 796 return highest;
791} 797}
792 798
793static void o2hb_do_disk_heartbeat(struct o2hb_region *reg) 799static int o2hb_do_disk_heartbeat(struct o2hb_region *reg)
794{ 800{
795 int i, ret, highest_node, change = 0; 801 int i, ret, highest_node, change = 0;
796 unsigned long configured_nodes[BITS_TO_LONGS(O2NM_MAX_NODES)]; 802 unsigned long configured_nodes[BITS_TO_LONGS(O2NM_MAX_NODES)];
797 struct bio *write_bio; 803 struct bio *write_bio;
798 struct o2hb_bio_wait_ctxt write_wc; 804 struct o2hb_bio_wait_ctxt write_wc;
799 805
800 if (o2nm_configured_node_map(configured_nodes, sizeof(configured_nodes))) 806 ret = o2nm_configured_node_map(configured_nodes,
801 return; 807 sizeof(configured_nodes));
808 if (ret) {
809 mlog_errno(ret);
810 return ret;
811 }
802 812
803 highest_node = o2hb_highest_node(configured_nodes, O2NM_MAX_NODES); 813 highest_node = o2hb_highest_node(configured_nodes, O2NM_MAX_NODES);
804 if (highest_node >= O2NM_MAX_NODES) { 814 if (highest_node >= O2NM_MAX_NODES) {
805 mlog(ML_NOTICE, "ocfs2_heartbeat: no configured nodes found!\n"); 815 mlog(ML_NOTICE, "ocfs2_heartbeat: no configured nodes found!\n");
806 return; 816 return -EINVAL;
807 } 817 }
808 818
809 /* No sense in reading the slots of nodes that don't exist 819 /* No sense in reading the slots of nodes that don't exist
@@ -813,7 +823,7 @@ static void o2hb_do_disk_heartbeat(struct o2hb_region *reg)
813 ret = o2hb_read_slots(reg, highest_node + 1); 823 ret = o2hb_read_slots(reg, highest_node + 1);
814 if (ret < 0) { 824 if (ret < 0) {
815 mlog_errno(ret); 825 mlog_errno(ret);
816 return; 826 return ret;
817 } 827 }
818 828
819 /* With an up to date view of the slots, we can check that no 829 /* With an up to date view of the slots, we can check that no
@@ -831,7 +841,7 @@ static void o2hb_do_disk_heartbeat(struct o2hb_region *reg)
831 ret = o2hb_issue_node_write(reg, &write_bio, &write_wc); 841 ret = o2hb_issue_node_write(reg, &write_bio, &write_wc);
832 if (ret < 0) { 842 if (ret < 0) {
833 mlog_errno(ret); 843 mlog_errno(ret);
834 return; 844 return ret;
835 } 845 }
836 846
837 i = -1; 847 i = -1;
@@ -847,6 +857,15 @@ static void o2hb_do_disk_heartbeat(struct o2hb_region *reg)
847 */ 857 */
848 o2hb_wait_on_io(reg, &write_wc); 858 o2hb_wait_on_io(reg, &write_wc);
849 bio_put(write_bio); 859 bio_put(write_bio);
860 if (write_wc.wc_error) {
861 /* Do not re-arm the write timeout on I/O error - we
862 * can't be sure that the new block ever made it to
863 * disk */
864 mlog(ML_ERROR, "Write error %d on device \"%s\"\n",
865 write_wc.wc_error, reg->hr_dev_name);
866 return write_wc.wc_error;
867 }
868
850 o2hb_arm_write_timeout(reg); 869 o2hb_arm_write_timeout(reg);
851 870
852 /* let the person who launched us know when things are steady */ 871 /* let the person who launched us know when things are steady */
@@ -854,6 +873,8 @@ static void o2hb_do_disk_heartbeat(struct o2hb_region *reg)
854 if (atomic_dec_and_test(&reg->hr_steady_iterations)) 873 if (atomic_dec_and_test(&reg->hr_steady_iterations))
855 wake_up(&o2hb_steady_queue); 874 wake_up(&o2hb_steady_queue);
856 } 875 }
876
877 return 0;
857} 878}
858 879
859/* Subtract b from a, storing the result in a. a *must* have a larger 880/* Subtract b from a, storing the result in a. a *must* have a larger
@@ -913,7 +934,10 @@ static int o2hb_thread(void *data)
913 * likely to time itself out. */ 934 * likely to time itself out. */
914 do_gettimeofday(&before_hb); 935 do_gettimeofday(&before_hb);
915 936
916 o2hb_do_disk_heartbeat(reg); 937 i = 0;
938 do {
939 ret = o2hb_do_disk_heartbeat(reg);
940 } while (ret && ++i < 2);
917 941
918 do_gettimeofday(&after_hb); 942 do_gettimeofday(&after_hb);
919 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); 943 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb);
diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c
index c3764f4744ee..74ca4e5f9765 100644
--- a/fs/ocfs2/dlm/userdlm.c
+++ b/fs/ocfs2/dlm/userdlm.c
@@ -139,6 +139,10 @@ static void user_ast(void *opaque)
139 return; 139 return;
140 } 140 }
141 141
142 mlog_bug_on_msg(lockres->l_requested == LKM_IVMODE,
143 "Lockres %s, requested ivmode. flags 0x%x\n",
144 lockres->l_name, lockres->l_flags);
145
142 /* we're downconverting. */ 146 /* we're downconverting. */
143 if (lockres->l_requested < lockres->l_level) { 147 if (lockres->l_requested < lockres->l_level) {
144 if (lockres->l_requested <= 148 if (lockres->l_requested <=
@@ -229,23 +233,42 @@ static void user_unlock_ast(void *opaque, enum dlm_status status)
229 233
230 mlog(0, "UNLOCK AST called on lock %s\n", lockres->l_name); 234 mlog(0, "UNLOCK AST called on lock %s\n", lockres->l_name);
231 235
232 if (status != DLM_NORMAL) 236 if (status != DLM_NORMAL && status != DLM_CANCELGRANT)
233 mlog(ML_ERROR, "Dlm returns status %d\n", status); 237 mlog(ML_ERROR, "Dlm returns status %d\n", status);
234 238
235 spin_lock(&lockres->l_lock); 239 spin_lock(&lockres->l_lock);
236 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) 240 /* The teardown flag gets set early during the unlock process,
241 * so test the cancel flag to make sure that this ast isn't
242 * for a concurrent cancel. */
243 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN
244 && !(lockres->l_flags & USER_LOCK_IN_CANCEL)) {
237 lockres->l_level = LKM_IVMODE; 245 lockres->l_level = LKM_IVMODE;
238 else { 246 } else if (status == DLM_CANCELGRANT) {
247 mlog(0, "Lock %s, cancel fails, flags 0x%x\n",
248 lockres->l_name, lockres->l_flags);
249 /* We tried to cancel a convert request, but it was
250 * already granted. Don't clear the busy flag - the
251 * ast should've done this already. */
252 BUG_ON(!(lockres->l_flags & USER_LOCK_IN_CANCEL));
253 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
254 goto out_noclear;
255 } else {
256 BUG_ON(!(lockres->l_flags & USER_LOCK_IN_CANCEL));
257 /* Cancel succeeded, we want to re-queue */
258 mlog(0, "Lock %s, cancel succeeds, flags 0x%x\n",
259 lockres->l_name, lockres->l_flags);
239 lockres->l_requested = LKM_IVMODE; /* cancel an 260 lockres->l_requested = LKM_IVMODE; /* cancel an
240 * upconvert 261 * upconvert
241 * request. */ 262 * request. */
242 lockres->l_flags &= ~USER_LOCK_IN_CANCEL; 263 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
243 /* we want the unblock thread to look at it again 264 /* we want the unblock thread to look at it again
244 * now. */ 265 * now. */
245 __user_dlm_queue_lockres(lockres); 266 if (lockres->l_flags & USER_LOCK_BLOCKED)
267 __user_dlm_queue_lockres(lockres);
246 } 268 }
247 269
248 lockres->l_flags &= ~USER_LOCK_BUSY; 270 lockres->l_flags &= ~USER_LOCK_BUSY;
271out_noclear:
249 spin_unlock(&lockres->l_lock); 272 spin_unlock(&lockres->l_lock);
250 273
251 wake_up(&lockres->l_event); 274 wake_up(&lockres->l_event);
@@ -268,13 +291,26 @@ static void user_dlm_unblock_lock(void *opaque)
268 291
269 spin_lock(&lockres->l_lock); 292 spin_lock(&lockres->l_lock);
270 293
271 BUG_ON(!(lockres->l_flags & USER_LOCK_BLOCKED)); 294 mlog_bug_on_msg(!(lockres->l_flags & USER_LOCK_QUEUED),
272 BUG_ON(!(lockres->l_flags & USER_LOCK_QUEUED)); 295 "Lockres %s, flags 0x%x\n",
296 lockres->l_name, lockres->l_flags);
273 297
274 /* notice that we don't clear USER_LOCK_BLOCKED here. That's 298 /* notice that we don't clear USER_LOCK_BLOCKED here. If it's
275 * for user_ast to do. */ 299 * set, we want user_ast clear it. */
276 lockres->l_flags &= ~USER_LOCK_QUEUED; 300 lockres->l_flags &= ~USER_LOCK_QUEUED;
277 301
302 /* It's valid to get here and no longer be blocked - if we get
303 * several basts in a row, we might be queued by the first
304 * one, the unblock thread might run and clear the queued
305 * flag, and finally we might get another bast which re-queues
306 * us before our ast for the downconvert is called. */
307 if (!(lockres->l_flags & USER_LOCK_BLOCKED)) {
308 mlog(0, "Lockres %s, flags 0x%x: queued but not blocking\n",
309 lockres->l_name, lockres->l_flags);
310 spin_unlock(&lockres->l_lock);
311 goto drop_ref;
312 }
313
278 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) { 314 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) {
279 mlog(0, "lock is in teardown so we do nothing\n"); 315 mlog(0, "lock is in teardown so we do nothing\n");
280 spin_unlock(&lockres->l_lock); 316 spin_unlock(&lockres->l_lock);
@@ -282,7 +318,9 @@ static void user_dlm_unblock_lock(void *opaque)
282 } 318 }
283 319
284 if (lockres->l_flags & USER_LOCK_BUSY) { 320 if (lockres->l_flags & USER_LOCK_BUSY) {
285 mlog(0, "BUSY flag detected...\n"); 321 mlog(0, "Cancel lock %s, flags 0x%x\n",
322 lockres->l_name, lockres->l_flags);
323
286 if (lockres->l_flags & USER_LOCK_IN_CANCEL) { 324 if (lockres->l_flags & USER_LOCK_IN_CANCEL) {
287 spin_unlock(&lockres->l_lock); 325 spin_unlock(&lockres->l_lock);
288 goto drop_ref; 326 goto drop_ref;
@@ -296,14 +334,7 @@ static void user_dlm_unblock_lock(void *opaque)
296 LKM_CANCEL, 334 LKM_CANCEL,
297 user_unlock_ast, 335 user_unlock_ast,
298 lockres); 336 lockres);
299 if (status == DLM_CANCELGRANT) { 337 if (status != DLM_NORMAL)
300 /* If we got this, then the ast was fired
301 * before we could cancel. We cleanup our
302 * state, and restart the function. */
303 spin_lock(&lockres->l_lock);
304 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
305 spin_unlock(&lockres->l_lock);
306 } else if (status != DLM_NORMAL)
307 user_log_dlm_error("dlmunlock", status, lockres); 338 user_log_dlm_error("dlmunlock", status, lockres);
308 goto drop_ref; 339 goto drop_ref;
309 } 340 }
@@ -581,6 +612,14 @@ int user_dlm_destroy_lock(struct user_lock_res *lockres)
581 mlog(0, "asked to destroy %s\n", lockres->l_name); 612 mlog(0, "asked to destroy %s\n", lockres->l_name);
582 613
583 spin_lock(&lockres->l_lock); 614 spin_lock(&lockres->l_lock);
615 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) {
616 mlog(0, "Lock is already torn down\n");
617 spin_unlock(&lockres->l_lock);
618 return 0;
619 }
620
621 lockres->l_flags |= USER_LOCK_IN_TEARDOWN;
622
584 while (lockres->l_flags & USER_LOCK_BUSY) { 623 while (lockres->l_flags & USER_LOCK_BUSY) {
585 spin_unlock(&lockres->l_lock); 624 spin_unlock(&lockres->l_lock);
586 625
@@ -606,7 +645,6 @@ int user_dlm_destroy_lock(struct user_lock_res *lockres)
606 645
607 lockres->l_flags &= ~USER_LOCK_ATTACHED; 646 lockres->l_flags &= ~USER_LOCK_ATTACHED;
608 lockres->l_flags |= USER_LOCK_BUSY; 647 lockres->l_flags |= USER_LOCK_BUSY;
609 lockres->l_flags |= USER_LOCK_IN_TEARDOWN;
610 spin_unlock(&lockres->l_lock); 648 spin_unlock(&lockres->l_lock);
611 649
612 mlog(0, "unlocking lockres %s\n", lockres->l_name); 650 mlog(0, "unlocking lockres %s\n", lockres->l_name);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 34e903a6a46b..581eb451a41a 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -260,6 +260,17 @@ static int ocfs2_truncate_file(struct inode *inode,
260 if (new_i_size == le64_to_cpu(fe->i_size)) 260 if (new_i_size == le64_to_cpu(fe->i_size))
261 goto bail; 261 goto bail;
262 262
263 /* This forces other nodes to sync and drop their pages. Do
264 * this even if we have a truncate without allocation change -
265 * ocfs2 cluster sizes can be much greater than page size, so
266 * we have to truncate them anyway. */
267 status = ocfs2_data_lock(inode, 1);
268 if (status < 0) {
269 mlog_errno(status);
270 goto bail;
271 }
272 ocfs2_data_unlock(inode, 1);
273
263 if (le32_to_cpu(fe->i_clusters) == 274 if (le32_to_cpu(fe->i_clusters) ==
264 ocfs2_clusters_for_bytes(osb->sb, new_i_size)) { 275 ocfs2_clusters_for_bytes(osb->sb, new_i_size)) {
265 mlog(0, "fe->i_clusters = %u, so we do a simple truncate\n", 276 mlog(0, "fe->i_clusters = %u, so we do a simple truncate\n",
@@ -272,14 +283,6 @@ static int ocfs2_truncate_file(struct inode *inode,
272 goto bail; 283 goto bail;
273 } 284 }
274 285
275 /* This forces other nodes to sync and drop their pages */
276 status = ocfs2_data_lock(inode, 1);
277 if (status < 0) {
278 mlog_errno(status);
279 goto bail;
280 }
281 ocfs2_data_unlock(inode, 1);
282
283 /* alright, we're going to need to do a full blown alloc size 286 /* alright, we're going to need to do a full blown alloc size
284 * change. Orphan the inode so that recovery can complete the 287 * change. Orphan the inode so that recovery can complete the
285 * truncate if necessary. This does the task of marking 288 * truncate if necessary. This does the task of marking
diff --git a/fs/open.c b/fs/open.c
index c32c89d6d8db..53ec28c36777 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -331,7 +331,10 @@ out:
331 331
332asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 332asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
333{ 333{
334 return do_sys_ftruncate(fd, length, 1); 334 long ret = do_sys_ftruncate(fd, length, 1);
335 /* avoid REGPARM breakage on x86: */
336 prevent_tail_call(ret);
337 return ret;
335} 338}
336 339
337/* LFS versions of truncate are only needed on 32 bit machines */ 340/* LFS versions of truncate are only needed on 32 bit machines */
@@ -343,7 +346,10 @@ asmlinkage long sys_truncate64(const char __user * path, loff_t length)
343 346
344asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 347asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
345{ 348{
346 return do_sys_ftruncate(fd, length, 0); 349 long ret = do_sys_ftruncate(fd, length, 0);
350 /* avoid REGPARM breakage on x86: */
351 prevent_tail_call(ret);
352 return ret;
347} 353}
348#endif 354#endif
349 355
@@ -1093,20 +1099,30 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
1093 1099
1094asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1100asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1095{ 1101{
1102 long ret;
1103
1096 if (force_o_largefile()) 1104 if (force_o_largefile())
1097 flags |= O_LARGEFILE; 1105 flags |= O_LARGEFILE;
1098 1106
1099 return do_sys_open(AT_FDCWD, filename, flags, mode); 1107 ret = do_sys_open(AT_FDCWD, filename, flags, mode);
1108 /* avoid REGPARM breakage on x86: */
1109 prevent_tail_call(ret);
1110 return ret;
1100} 1111}
1101EXPORT_SYMBOL_GPL(sys_open); 1112EXPORT_SYMBOL_GPL(sys_open);
1102 1113
1103asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1114asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1104 int mode) 1115 int mode)
1105{ 1116{
1117 long ret;
1118
1106 if (force_o_largefile()) 1119 if (force_o_largefile())
1107 flags |= O_LARGEFILE; 1120 flags |= O_LARGEFILE;
1108 1121
1109 return do_sys_open(dfd, filename, flags, mode); 1122 ret = do_sys_open(dfd, filename, flags, mode);
1123 /* avoid REGPARM breakage on x86: */
1124 prevent_tail_call(ret);
1125 return ret;
1110} 1126}
1111EXPORT_SYMBOL_GPL(sys_openat); 1127EXPORT_SYMBOL_GPL(sys_openat);
1112 1128
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index af0cb4b9e784..45ae7dd3c650 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -331,7 +331,9 @@ void delete_partition(struct gendisk *disk, int part)
331 devfs_remove("%s/part%d", disk->devfs_name, part); 331 devfs_remove("%s/part%d", disk->devfs_name, part);
332 if (p->holder_dir) 332 if (p->holder_dir)
333 kobject_unregister(p->holder_dir); 333 kobject_unregister(p->holder_dir);
334 kobject_unregister(&p->kobj); 334 kobject_uevent(&p->kobj, KOBJ_REMOVE);
335 kobject_del(&p->kobj);
336 kobject_put(&p->kobj);
335} 337}
336 338
337void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) 339void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
@@ -357,7 +359,10 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
357 snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part); 359 snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part);
358 p->kobj.parent = &disk->kobj; 360 p->kobj.parent = &disk->kobj;
359 p->kobj.ktype = &ktype_part; 361 p->kobj.ktype = &ktype_part;
360 kobject_register(&p->kobj); 362 kobject_init(&p->kobj);
363 kobject_add(&p->kobj);
364 if (!disk->part_uevent_suppress)
365 kobject_uevent(&p->kobj, KOBJ_ADD);
361 partition_sysfs_add_subdir(p); 366 partition_sysfs_add_subdir(p);
362 disk->part[part-1] = p; 367 disk->part[part-1] = p;
363} 368}
@@ -367,6 +372,7 @@ static char *make_block_name(struct gendisk *disk)
367 char *name; 372 char *name;
368 static char *block_str = "block:"; 373 static char *block_str = "block:";
369 int size; 374 int size;
375 char *s;
370 376
371 size = strlen(block_str) + strlen(disk->disk_name) + 1; 377 size = strlen(block_str) + strlen(disk->disk_name) + 1;
372 name = kmalloc(size, GFP_KERNEL); 378 name = kmalloc(size, GFP_KERNEL);
@@ -374,6 +380,10 @@ static char *make_block_name(struct gendisk *disk)
374 return NULL; 380 return NULL;
375 strcpy(name, block_str); 381 strcpy(name, block_str);
376 strcat(name, disk->disk_name); 382 strcat(name, disk->disk_name);
383 /* ewww... some of these buggers have / in name... */
384 s = strchr(name, '/');
385 if (s)
386 *s = '!';
377 return name; 387 return name;
378} 388}
379 389
@@ -395,6 +405,8 @@ void register_disk(struct gendisk *disk)
395{ 405{
396 struct block_device *bdev; 406 struct block_device *bdev;
397 char *s; 407 char *s;
408 int i;
409 struct hd_struct *p;
398 int err; 410 int err;
399 411
400 strlcpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN); 412 strlcpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN);
@@ -406,13 +418,12 @@ void register_disk(struct gendisk *disk)
406 return; 418 return;
407 disk_sysfs_symlinks(disk); 419 disk_sysfs_symlinks(disk);
408 disk_sysfs_add_subdirs(disk); 420 disk_sysfs_add_subdirs(disk);
409 kobject_uevent(&disk->kobj, KOBJ_ADD);
410 421
411 /* No minors to use for partitions */ 422 /* No minors to use for partitions */
412 if (disk->minors == 1) { 423 if (disk->minors == 1) {
413 if (disk->devfs_name[0] != '\0') 424 if (disk->devfs_name[0] != '\0')
414 devfs_add_disk(disk); 425 devfs_add_disk(disk);
415 return; 426 goto exit;
416 } 427 }
417 428
418 /* always add handle for the whole disk */ 429 /* always add handle for the whole disk */
@@ -420,16 +431,32 @@ void register_disk(struct gendisk *disk)
420 431
421 /* No such device (e.g., media were just removed) */ 432 /* No such device (e.g., media were just removed) */
422 if (!get_capacity(disk)) 433 if (!get_capacity(disk))
423 return; 434 goto exit;
424 435
425 bdev = bdget_disk(disk, 0); 436 bdev = bdget_disk(disk, 0);
426 if (!bdev) 437 if (!bdev)
427 return; 438 goto exit;
428 439
440 /* scan partition table, but suppress uevents */
429 bdev->bd_invalidated = 1; 441 bdev->bd_invalidated = 1;
430 if (blkdev_get(bdev, FMODE_READ, 0) < 0) 442 disk->part_uevent_suppress = 1;
431 return; 443 err = blkdev_get(bdev, FMODE_READ, 0);
444 disk->part_uevent_suppress = 0;
445 if (err < 0)
446 goto exit;
432 blkdev_put(bdev); 447 blkdev_put(bdev);
448
449exit:
450 /* announce disk after possible partitions are already created */
451 kobject_uevent(&disk->kobj, KOBJ_ADD);
452
453 /* announce possible partitions */
454 for (i = 1; i < disk->minors; i++) {
455 p = disk->part[i-1];
456 if (!p || !p->nr_sects)
457 continue;
458 kobject_uevent(&p->kobj, KOBJ_ADD);
459 }
433} 460}
434 461
435int rescan_partitions(struct gendisk *disk, struct block_device *bdev) 462int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
diff --git a/fs/pipe.c b/fs/pipe.c
index 795df987cd38..7fefb10db8d9 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38/* Drop the inode semaphore and wait for a pipe event, atomically */ 38/* Drop the inode semaphore and wait for a pipe event, atomically */
39void pipe_wait(struct inode * inode) 39void pipe_wait(struct pipe_inode_info *pipe)
40{ 40{
41 DEFINE_WAIT(wait); 41 DEFINE_WAIT(wait);
42 42
@@ -44,11 +44,14 @@ void pipe_wait(struct inode * inode)
44 * Pipes are system-local resources, so sleeping on them 44 * Pipes are system-local resources, so sleeping on them
45 * is considered a noninteractive wait: 45 * is considered a noninteractive wait:
46 */ 46 */
47 prepare_to_wait(PIPE_WAIT(*inode), &wait, TASK_INTERRUPTIBLE|TASK_NONINTERACTIVE); 47 prepare_to_wait(&pipe->wait, &wait,
48 mutex_unlock(PIPE_MUTEX(*inode)); 48 TASK_INTERRUPTIBLE | TASK_NONINTERACTIVE);
49 if (pipe->inode)
50 mutex_unlock(&pipe->inode->i_mutex);
49 schedule(); 51 schedule();
50 finish_wait(PIPE_WAIT(*inode), &wait); 52 finish_wait(&pipe->wait, &wait);
51 mutex_lock(PIPE_MUTEX(*inode)); 53 if (pipe->inode)
54 mutex_lock(&pipe->inode->i_mutex);
52} 55}
53 56
54static int 57static int
@@ -91,7 +94,8 @@ pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len)
91 return 0; 94 return 0;
92} 95}
93 96
94static void anon_pipe_buf_release(struct pipe_inode_info *info, struct pipe_buffer *buf) 97static void anon_pipe_buf_release(struct pipe_inode_info *pipe,
98 struct pipe_buffer *buf)
95{ 99{
96 struct page *page = buf->page; 100 struct page *page = buf->page;
97 101
@@ -100,42 +104,46 @@ static void anon_pipe_buf_release(struct pipe_inode_info *info, struct pipe_buff
100 /* 104 /*
101 * If nobody else uses this page, and we don't already have a 105 * If nobody else uses this page, and we don't already have a
102 * temporary page, let's keep track of it as a one-deep 106 * temporary page, let's keep track of it as a one-deep
103 * allocation cache 107 * allocation cache. (Otherwise just release our reference to it)
104 */ 108 */
105 if (page_count(page) == 1 && !info->tmp_page) { 109 if (page_count(page) == 1 && !pipe->tmp_page)
106 info->tmp_page = page; 110 pipe->tmp_page = page;
107 return; 111 else
108 } 112 page_cache_release(page);
109
110 /*
111 * Otherwise just release our reference to it
112 */
113 page_cache_release(page);
114} 113}
115 114
116static void *anon_pipe_buf_map(struct file *file, struct pipe_inode_info *info, struct pipe_buffer *buf) 115static void * anon_pipe_buf_map(struct file *file, struct pipe_inode_info *pipe,
116 struct pipe_buffer *buf)
117{ 117{
118 return kmap(buf->page); 118 return kmap(buf->page);
119} 119}
120 120
121static void anon_pipe_buf_unmap(struct pipe_inode_info *info, struct pipe_buffer *buf) 121static void anon_pipe_buf_unmap(struct pipe_inode_info *pipe,
122 struct pipe_buffer *buf)
122{ 123{
123 kunmap(buf->page); 124 kunmap(buf->page);
124} 125}
125 126
126static int anon_pipe_buf_steal(struct pipe_inode_info *info, 127static int anon_pipe_buf_steal(struct pipe_inode_info *pipe,
127 struct pipe_buffer *buf) 128 struct pipe_buffer *buf)
128{ 129{
129 buf->flags |= PIPE_BUF_FLAG_STOLEN; 130 buf->flags |= PIPE_BUF_FLAG_STOLEN;
130 return 0; 131 return 0;
131} 132}
132 133
134static void anon_pipe_buf_get(struct pipe_inode_info *info,
135 struct pipe_buffer *buf)
136{
137 page_cache_get(buf->page);
138}
139
133static struct pipe_buf_operations anon_pipe_buf_ops = { 140static struct pipe_buf_operations anon_pipe_buf_ops = {
134 .can_merge = 1, 141 .can_merge = 1,
135 .map = anon_pipe_buf_map, 142 .map = anon_pipe_buf_map,
136 .unmap = anon_pipe_buf_unmap, 143 .unmap = anon_pipe_buf_unmap,
137 .release = anon_pipe_buf_release, 144 .release = anon_pipe_buf_release,
138 .steal = anon_pipe_buf_steal, 145 .steal = anon_pipe_buf_steal,
146 .get = anon_pipe_buf_get,
139}; 147};
140 148
141static ssize_t 149static ssize_t
@@ -143,7 +151,7 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
143 unsigned long nr_segs, loff_t *ppos) 151 unsigned long nr_segs, loff_t *ppos)
144{ 152{
145 struct inode *inode = filp->f_dentry->d_inode; 153 struct inode *inode = filp->f_dentry->d_inode;
146 struct pipe_inode_info *info; 154 struct pipe_inode_info *pipe;
147 int do_wakeup; 155 int do_wakeup;
148 ssize_t ret; 156 ssize_t ret;
149 struct iovec *iov = (struct iovec *)_iov; 157 struct iovec *iov = (struct iovec *)_iov;
@@ -156,13 +164,13 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
156 164
157 do_wakeup = 0; 165 do_wakeup = 0;
158 ret = 0; 166 ret = 0;
159 mutex_lock(PIPE_MUTEX(*inode)); 167 mutex_lock(&inode->i_mutex);
160 info = inode->i_pipe; 168 pipe = inode->i_pipe;
161 for (;;) { 169 for (;;) {
162 int bufs = info->nrbufs; 170 int bufs = pipe->nrbufs;
163 if (bufs) { 171 if (bufs) {
164 int curbuf = info->curbuf; 172 int curbuf = pipe->curbuf;
165 struct pipe_buffer *buf = info->bufs + curbuf; 173 struct pipe_buffer *buf = pipe->bufs + curbuf;
166 struct pipe_buf_operations *ops = buf->ops; 174 struct pipe_buf_operations *ops = buf->ops;
167 void *addr; 175 void *addr;
168 size_t chars = buf->len; 176 size_t chars = buf->len;
@@ -171,16 +179,17 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
171 if (chars > total_len) 179 if (chars > total_len)
172 chars = total_len; 180 chars = total_len;
173 181
174 addr = ops->map(filp, info, buf); 182 addr = ops->map(filp, pipe, buf);
175 if (IS_ERR(addr)) { 183 if (IS_ERR(addr)) {
176 if (!ret) 184 if (!ret)
177 ret = PTR_ERR(addr); 185 ret = PTR_ERR(addr);
178 break; 186 break;
179 } 187 }
180 error = pipe_iov_copy_to_user(iov, addr + buf->offset, chars); 188 error = pipe_iov_copy_to_user(iov, addr + buf->offset, chars);
181 ops->unmap(info, buf); 189 ops->unmap(pipe, buf);
182 if (unlikely(error)) { 190 if (unlikely(error)) {
183 if (!ret) ret = -EFAULT; 191 if (!ret)
192 ret = -EFAULT;
184 break; 193 break;
185 } 194 }
186 ret += chars; 195 ret += chars;
@@ -188,10 +197,10 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
188 buf->len -= chars; 197 buf->len -= chars;
189 if (!buf->len) { 198 if (!buf->len) {
190 buf->ops = NULL; 199 buf->ops = NULL;
191 ops->release(info, buf); 200 ops->release(pipe, buf);
192 curbuf = (curbuf + 1) & (PIPE_BUFFERS-1); 201 curbuf = (curbuf + 1) & (PIPE_BUFFERS-1);
193 info->curbuf = curbuf; 202 pipe->curbuf = curbuf;
194 info->nrbufs = --bufs; 203 pipe->nrbufs = --bufs;
195 do_wakeup = 1; 204 do_wakeup = 1;
196 } 205 }
197 total_len -= chars; 206 total_len -= chars;
@@ -200,9 +209,9 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
200 } 209 }
201 if (bufs) /* More to do? */ 210 if (bufs) /* More to do? */
202 continue; 211 continue;
203 if (!PIPE_WRITERS(*inode)) 212 if (!pipe->writers)
204 break; 213 break;
205 if (!PIPE_WAITING_WRITERS(*inode)) { 214 if (!pipe->waiting_writers) {
206 /* syscall merging: Usually we must not sleep 215 /* syscall merging: Usually we must not sleep
207 * if O_NONBLOCK is set, or if we got some data. 216 * if O_NONBLOCK is set, or if we got some data.
208 * But if a writer sleeps in kernel space, then 217 * But if a writer sleeps in kernel space, then
@@ -216,20 +225,22 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
216 } 225 }
217 } 226 }
218 if (signal_pending(current)) { 227 if (signal_pending(current)) {
219 if (!ret) ret = -ERESTARTSYS; 228 if (!ret)
229 ret = -ERESTARTSYS;
220 break; 230 break;
221 } 231 }
222 if (do_wakeup) { 232 if (do_wakeup) {
223 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 233 wake_up_interruptible_sync(&pipe->wait);
224 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT); 234 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
225 } 235 }
226 pipe_wait(inode); 236 pipe_wait(pipe);
227 } 237 }
228 mutex_unlock(PIPE_MUTEX(*inode)); 238 mutex_unlock(&inode->i_mutex);
229 /* Signal writers asynchronously that there is more room. */ 239
240 /* Signal writers asynchronously that there is more room. */
230 if (do_wakeup) { 241 if (do_wakeup) {
231 wake_up_interruptible(PIPE_WAIT(*inode)); 242 wake_up_interruptible(&pipe->wait);
232 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT); 243 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
233 } 244 }
234 if (ret > 0) 245 if (ret > 0)
235 file_accessed(filp); 246 file_accessed(filp);
@@ -240,6 +251,7 @@ static ssize_t
240pipe_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) 251pipe_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
241{ 252{
242 struct iovec iov = { .iov_base = buf, .iov_len = count }; 253 struct iovec iov = { .iov_base = buf, .iov_len = count };
254
243 return pipe_readv(filp, &iov, 1, ppos); 255 return pipe_readv(filp, &iov, 1, ppos);
244} 256}
245 257
@@ -248,7 +260,7 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
248 unsigned long nr_segs, loff_t *ppos) 260 unsigned long nr_segs, loff_t *ppos)
249{ 261{
250 struct inode *inode = filp->f_dentry->d_inode; 262 struct inode *inode = filp->f_dentry->d_inode;
251 struct pipe_inode_info *info; 263 struct pipe_inode_info *pipe;
252 ssize_t ret; 264 ssize_t ret;
253 int do_wakeup; 265 int do_wakeup;
254 struct iovec *iov = (struct iovec *)_iov; 266 struct iovec *iov = (struct iovec *)_iov;
@@ -262,10 +274,10 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
262 274
263 do_wakeup = 0; 275 do_wakeup = 0;
264 ret = 0; 276 ret = 0;
265 mutex_lock(PIPE_MUTEX(*inode)); 277 mutex_lock(&inode->i_mutex);
266 info = inode->i_pipe; 278 pipe = inode->i_pipe;
267 279
268 if (!PIPE_READERS(*inode)) { 280 if (!pipe->readers) {
269 send_sig(SIGPIPE, current, 0); 281 send_sig(SIGPIPE, current, 0);
270 ret = -EPIPE; 282 ret = -EPIPE;
271 goto out; 283 goto out;
@@ -273,23 +285,25 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
273 285
274 /* We try to merge small writes */ 286 /* We try to merge small writes */
275 chars = total_len & (PAGE_SIZE-1); /* size of the last buffer */ 287 chars = total_len & (PAGE_SIZE-1); /* size of the last buffer */
276 if (info->nrbufs && chars != 0) { 288 if (pipe->nrbufs && chars != 0) {
277 int lastbuf = (info->curbuf + info->nrbufs - 1) & (PIPE_BUFFERS-1); 289 int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) &
278 struct pipe_buffer *buf = info->bufs + lastbuf; 290 (PIPE_BUFFERS-1);
291 struct pipe_buffer *buf = pipe->bufs + lastbuf;
279 struct pipe_buf_operations *ops = buf->ops; 292 struct pipe_buf_operations *ops = buf->ops;
280 int offset = buf->offset + buf->len; 293 int offset = buf->offset + buf->len;
294
281 if (ops->can_merge && offset + chars <= PAGE_SIZE) { 295 if (ops->can_merge && offset + chars <= PAGE_SIZE) {
282 void *addr; 296 void *addr;
283 int error; 297 int error;
284 298
285 addr = ops->map(filp, info, buf); 299 addr = ops->map(filp, pipe, buf);
286 if (IS_ERR(addr)) { 300 if (IS_ERR(addr)) {
287 error = PTR_ERR(addr); 301 error = PTR_ERR(addr);
288 goto out; 302 goto out;
289 } 303 }
290 error = pipe_iov_copy_from_user(offset + addr, iov, 304 error = pipe_iov_copy_from_user(offset + addr, iov,
291 chars); 305 chars);
292 ops->unmap(info, buf); 306 ops->unmap(pipe, buf);
293 ret = error; 307 ret = error;
294 do_wakeup = 1; 308 do_wakeup = 1;
295 if (error) 309 if (error)
@@ -304,16 +318,18 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
304 318
305 for (;;) { 319 for (;;) {
306 int bufs; 320 int bufs;
307 if (!PIPE_READERS(*inode)) { 321
322 if (!pipe->readers) {
308 send_sig(SIGPIPE, current, 0); 323 send_sig(SIGPIPE, current, 0);
309 if (!ret) ret = -EPIPE; 324 if (!ret)
325 ret = -EPIPE;
310 break; 326 break;
311 } 327 }
312 bufs = info->nrbufs; 328 bufs = pipe->nrbufs;
313 if (bufs < PIPE_BUFFERS) { 329 if (bufs < PIPE_BUFFERS) {
314 int newbuf = (info->curbuf + bufs) & (PIPE_BUFFERS-1); 330 int newbuf = (pipe->curbuf + bufs) & (PIPE_BUFFERS-1);
315 struct pipe_buffer *buf = info->bufs + newbuf; 331 struct pipe_buffer *buf = pipe->bufs + newbuf;
316 struct page *page = info->tmp_page; 332 struct page *page = pipe->tmp_page;
317 int error; 333 int error;
318 334
319 if (!page) { 335 if (!page) {
@@ -322,9 +338,9 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
322 ret = ret ? : -ENOMEM; 338 ret = ret ? : -ENOMEM;
323 break; 339 break;
324 } 340 }
325 info->tmp_page = page; 341 pipe->tmp_page = page;
326 } 342 }
327 /* Always wakeup, even if the copy fails. Otherwise 343 /* Always wake up, even if the copy fails. Otherwise
328 * we lock up (O_NONBLOCK-)readers that sleep due to 344 * we lock up (O_NONBLOCK-)readers that sleep due to
329 * syscall merging. 345 * syscall merging.
330 * FIXME! Is this really true? 346 * FIXME! Is this really true?
@@ -337,7 +353,8 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
337 error = pipe_iov_copy_from_user(kmap(page), iov, chars); 353 error = pipe_iov_copy_from_user(kmap(page), iov, chars);
338 kunmap(page); 354 kunmap(page);
339 if (unlikely(error)) { 355 if (unlikely(error)) {
340 if (!ret) ret = -EFAULT; 356 if (!ret)
357 ret = -EFAULT;
341 break; 358 break;
342 } 359 }
343 ret += chars; 360 ret += chars;
@@ -347,8 +364,8 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
347 buf->ops = &anon_pipe_buf_ops; 364 buf->ops = &anon_pipe_buf_ops;
348 buf->offset = 0; 365 buf->offset = 0;
349 buf->len = chars; 366 buf->len = chars;
350 info->nrbufs = ++bufs; 367 pipe->nrbufs = ++bufs;
351 info->tmp_page = NULL; 368 pipe->tmp_page = NULL;
352 369
353 total_len -= chars; 370 total_len -= chars;
354 if (!total_len) 371 if (!total_len)
@@ -357,27 +374,29 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
357 if (bufs < PIPE_BUFFERS) 374 if (bufs < PIPE_BUFFERS)
358 continue; 375 continue;
359 if (filp->f_flags & O_NONBLOCK) { 376 if (filp->f_flags & O_NONBLOCK) {
360 if (!ret) ret = -EAGAIN; 377 if (!ret)
378 ret = -EAGAIN;
361 break; 379 break;
362 } 380 }
363 if (signal_pending(current)) { 381 if (signal_pending(current)) {
364 if (!ret) ret = -ERESTARTSYS; 382 if (!ret)
383 ret = -ERESTARTSYS;
365 break; 384 break;
366 } 385 }
367 if (do_wakeup) { 386 if (do_wakeup) {
368 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 387 wake_up_interruptible_sync(&pipe->wait);
369 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); 388 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
370 do_wakeup = 0; 389 do_wakeup = 0;
371 } 390 }
372 PIPE_WAITING_WRITERS(*inode)++; 391 pipe->waiting_writers++;
373 pipe_wait(inode); 392 pipe_wait(pipe);
374 PIPE_WAITING_WRITERS(*inode)--; 393 pipe->waiting_writers--;
375 } 394 }
376out: 395out:
377 mutex_unlock(PIPE_MUTEX(*inode)); 396 mutex_unlock(&inode->i_mutex);
378 if (do_wakeup) { 397 if (do_wakeup) {
379 wake_up_interruptible(PIPE_WAIT(*inode)); 398 wake_up_interruptible(&pipe->wait);
380 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); 399 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
381 } 400 }
382 if (ret > 0) 401 if (ret > 0)
383 file_update_time(filp); 402 file_update_time(filp);
@@ -389,6 +408,7 @@ pipe_write(struct file *filp, const char __user *buf,
389 size_t count, loff_t *ppos) 408 size_t count, loff_t *ppos)
390{ 409{
391 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; 410 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count };
411
392 return pipe_writev(filp, &iov, 1, ppos); 412 return pipe_writev(filp, &iov, 1, ppos);
393} 413}
394 414
@@ -399,7 +419,8 @@ bad_pipe_r(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
399} 419}
400 420
401static ssize_t 421static ssize_t
402bad_pipe_w(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) 422bad_pipe_w(struct file *filp, const char __user *buf, size_t count,
423 loff_t *ppos)
403{ 424{
404 return -EBADF; 425 return -EBADF;
405} 426}
@@ -409,21 +430,22 @@ pipe_ioctl(struct inode *pino, struct file *filp,
409 unsigned int cmd, unsigned long arg) 430 unsigned int cmd, unsigned long arg)
410{ 431{
411 struct inode *inode = filp->f_dentry->d_inode; 432 struct inode *inode = filp->f_dentry->d_inode;
412 struct pipe_inode_info *info; 433 struct pipe_inode_info *pipe;
413 int count, buf, nrbufs; 434 int count, buf, nrbufs;
414 435
415 switch (cmd) { 436 switch (cmd) {
416 case FIONREAD: 437 case FIONREAD:
417 mutex_lock(PIPE_MUTEX(*inode)); 438 mutex_lock(&inode->i_mutex);
418 info = inode->i_pipe; 439 pipe = inode->i_pipe;
419 count = 0; 440 count = 0;
420 buf = info->curbuf; 441 buf = pipe->curbuf;
421 nrbufs = info->nrbufs; 442 nrbufs = pipe->nrbufs;
422 while (--nrbufs >= 0) { 443 while (--nrbufs >= 0) {
423 count += info->bufs[buf].len; 444 count += pipe->bufs[buf].len;
424 buf = (buf+1) & (PIPE_BUFFERS-1); 445 buf = (buf+1) & (PIPE_BUFFERS-1);
425 } 446 }
426 mutex_unlock(PIPE_MUTEX(*inode)); 447 mutex_unlock(&inode->i_mutex);
448
427 return put_user(count, (int __user *)arg); 449 return put_user(count, (int __user *)arg);
428 default: 450 default:
429 return -EINVAL; 451 return -EINVAL;
@@ -436,17 +458,17 @@ pipe_poll(struct file *filp, poll_table *wait)
436{ 458{
437 unsigned int mask; 459 unsigned int mask;
438 struct inode *inode = filp->f_dentry->d_inode; 460 struct inode *inode = filp->f_dentry->d_inode;
439 struct pipe_inode_info *info = inode->i_pipe; 461 struct pipe_inode_info *pipe = inode->i_pipe;
440 int nrbufs; 462 int nrbufs;
441 463
442 poll_wait(filp, PIPE_WAIT(*inode), wait); 464 poll_wait(filp, &pipe->wait, wait);
443 465
444 /* Reading only -- no need for acquiring the semaphore. */ 466 /* Reading only -- no need for acquiring the semaphore. */
445 nrbufs = info->nrbufs; 467 nrbufs = pipe->nrbufs;
446 mask = 0; 468 mask = 0;
447 if (filp->f_mode & FMODE_READ) { 469 if (filp->f_mode & FMODE_READ) {
448 mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0; 470 mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0;
449 if (!PIPE_WRITERS(*inode) && filp->f_version != PIPE_WCOUNTER(*inode)) 471 if (!pipe->writers && filp->f_version != pipe->w_counter)
450 mask |= POLLHUP; 472 mask |= POLLHUP;
451 } 473 }
452 474
@@ -456,7 +478,7 @@ pipe_poll(struct file *filp, poll_table *wait)
456 * Most Unices do not set POLLERR for FIFOs but on Linux they 478 * Most Unices do not set POLLERR for FIFOs but on Linux they
457 * behave exactly like pipes for poll(). 479 * behave exactly like pipes for poll().
458 */ 480 */
459 if (!PIPE_READERS(*inode)) 481 if (!pipe->readers)
460 mask |= POLLERR; 482 mask |= POLLERR;
461 } 483 }
462 484
@@ -466,17 +488,21 @@ pipe_poll(struct file *filp, poll_table *wait)
466static int 488static int
467pipe_release(struct inode *inode, int decr, int decw) 489pipe_release(struct inode *inode, int decr, int decw)
468{ 490{
469 mutex_lock(PIPE_MUTEX(*inode)); 491 struct pipe_inode_info *pipe;
470 PIPE_READERS(*inode) -= decr; 492
471 PIPE_WRITERS(*inode) -= decw; 493 mutex_lock(&inode->i_mutex);
472 if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) { 494 pipe = inode->i_pipe;
495 pipe->readers -= decr;
496 pipe->writers -= decw;
497
498 if (!pipe->readers && !pipe->writers) {
473 free_pipe_info(inode); 499 free_pipe_info(inode);
474 } else { 500 } else {
475 wake_up_interruptible(PIPE_WAIT(*inode)); 501 wake_up_interruptible(&pipe->wait);
476 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); 502 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
477 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT); 503 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
478 } 504 }
479 mutex_unlock(PIPE_MUTEX(*inode)); 505 mutex_unlock(&inode->i_mutex);
480 506
481 return 0; 507 return 0;
482} 508}
@@ -487,9 +513,9 @@ pipe_read_fasync(int fd, struct file *filp, int on)
487 struct inode *inode = filp->f_dentry->d_inode; 513 struct inode *inode = filp->f_dentry->d_inode;
488 int retval; 514 int retval;
489 515
490 mutex_lock(PIPE_MUTEX(*inode)); 516 mutex_lock(&inode->i_mutex);
491 retval = fasync_helper(fd, filp, on, PIPE_FASYNC_READERS(*inode)); 517 retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_readers);
492 mutex_unlock(PIPE_MUTEX(*inode)); 518 mutex_unlock(&inode->i_mutex);
493 519
494 if (retval < 0) 520 if (retval < 0)
495 return retval; 521 return retval;
@@ -504,9 +530,9 @@ pipe_write_fasync(int fd, struct file *filp, int on)
504 struct inode *inode = filp->f_dentry->d_inode; 530 struct inode *inode = filp->f_dentry->d_inode;
505 int retval; 531 int retval;
506 532
507 mutex_lock(PIPE_MUTEX(*inode)); 533 mutex_lock(&inode->i_mutex);
508 retval = fasync_helper(fd, filp, on, PIPE_FASYNC_WRITERS(*inode)); 534 retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_writers);
509 mutex_unlock(PIPE_MUTEX(*inode)); 535 mutex_unlock(&inode->i_mutex);
510 536
511 if (retval < 0) 537 if (retval < 0)
512 return retval; 538 return retval;
@@ -519,16 +545,17 @@ static int
519pipe_rdwr_fasync(int fd, struct file *filp, int on) 545pipe_rdwr_fasync(int fd, struct file *filp, int on)
520{ 546{
521 struct inode *inode = filp->f_dentry->d_inode; 547 struct inode *inode = filp->f_dentry->d_inode;
548 struct pipe_inode_info *pipe = inode->i_pipe;
522 int retval; 549 int retval;
523 550
524 mutex_lock(PIPE_MUTEX(*inode)); 551 mutex_lock(&inode->i_mutex);
525 552
526 retval = fasync_helper(fd, filp, on, PIPE_FASYNC_READERS(*inode)); 553 retval = fasync_helper(fd, filp, on, &pipe->fasync_readers);
527 554
528 if (retval >= 0) 555 if (retval >= 0)
529 retval = fasync_helper(fd, filp, on, PIPE_FASYNC_WRITERS(*inode)); 556 retval = fasync_helper(fd, filp, on, &pipe->fasync_writers);
530 557
531 mutex_unlock(PIPE_MUTEX(*inode)); 558 mutex_unlock(&inode->i_mutex);
532 559
533 if (retval < 0) 560 if (retval < 0)
534 return retval; 561 return retval;
@@ -567,9 +594,9 @@ pipe_read_open(struct inode *inode, struct file *filp)
567{ 594{
568 /* We could have perhaps used atomic_t, but this and friends 595 /* We could have perhaps used atomic_t, but this and friends
569 below are the only places. So it doesn't seem worthwhile. */ 596 below are the only places. So it doesn't seem worthwhile. */
570 mutex_lock(PIPE_MUTEX(*inode)); 597 mutex_lock(&inode->i_mutex);
571 PIPE_READERS(*inode)++; 598 inode->i_pipe->readers++;
572 mutex_unlock(PIPE_MUTEX(*inode)); 599 mutex_unlock(&inode->i_mutex);
573 600
574 return 0; 601 return 0;
575} 602}
@@ -577,9 +604,9 @@ pipe_read_open(struct inode *inode, struct file *filp)
577static int 604static int
578pipe_write_open(struct inode *inode, struct file *filp) 605pipe_write_open(struct inode *inode, struct file *filp)
579{ 606{
580 mutex_lock(PIPE_MUTEX(*inode)); 607 mutex_lock(&inode->i_mutex);
581 PIPE_WRITERS(*inode)++; 608 inode->i_pipe->writers++;
582 mutex_unlock(PIPE_MUTEX(*inode)); 609 mutex_unlock(&inode->i_mutex);
583 610
584 return 0; 611 return 0;
585} 612}
@@ -587,12 +614,12 @@ pipe_write_open(struct inode *inode, struct file *filp)
587static int 614static int
588pipe_rdwr_open(struct inode *inode, struct file *filp) 615pipe_rdwr_open(struct inode *inode, struct file *filp)
589{ 616{
590 mutex_lock(PIPE_MUTEX(*inode)); 617 mutex_lock(&inode->i_mutex);
591 if (filp->f_mode & FMODE_READ) 618 if (filp->f_mode & FMODE_READ)
592 PIPE_READERS(*inode)++; 619 inode->i_pipe->readers++;
593 if (filp->f_mode & FMODE_WRITE) 620 if (filp->f_mode & FMODE_WRITE)
594 PIPE_WRITERS(*inode)++; 621 inode->i_pipe->writers++;
595 mutex_unlock(PIPE_MUTEX(*inode)); 622 mutex_unlock(&inode->i_mutex);
596 623
597 return 0; 624 return 0;
598} 625}
@@ -675,37 +702,38 @@ static struct file_operations rdwr_pipe_fops = {
675 .fasync = pipe_rdwr_fasync, 702 .fasync = pipe_rdwr_fasync,
676}; 703};
677 704
678void free_pipe_info(struct inode *inode) 705struct pipe_inode_info * alloc_pipe_info(struct inode *inode)
706{
707 struct pipe_inode_info *pipe;
708
709 pipe = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
710 if (pipe) {
711 init_waitqueue_head(&pipe->wait);
712 pipe->r_counter = pipe->w_counter = 1;
713 pipe->inode = inode;
714 }
715
716 return pipe;
717}
718
719void __free_pipe_info(struct pipe_inode_info *pipe)
679{ 720{
680 int i; 721 int i;
681 struct pipe_inode_info *info = inode->i_pipe;
682 722
683 inode->i_pipe = NULL;
684 for (i = 0; i < PIPE_BUFFERS; i++) { 723 for (i = 0; i < PIPE_BUFFERS; i++) {
685 struct pipe_buffer *buf = info->bufs + i; 724 struct pipe_buffer *buf = pipe->bufs + i;
686 if (buf->ops) 725 if (buf->ops)
687 buf->ops->release(info, buf); 726 buf->ops->release(pipe, buf);
688 } 727 }
689 if (info->tmp_page) 728 if (pipe->tmp_page)
690 __free_page(info->tmp_page); 729 __free_page(pipe->tmp_page);
691 kfree(info); 730 kfree(pipe);
692} 731}
693 732
694struct inode* pipe_new(struct inode* inode) 733void free_pipe_info(struct inode *inode)
695{ 734{
696 struct pipe_inode_info *info; 735 __free_pipe_info(inode->i_pipe);
697 736 inode->i_pipe = NULL;
698 info = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
699 if (!info)
700 goto fail_page;
701 inode->i_pipe = info;
702
703 init_waitqueue_head(PIPE_WAIT(*inode));
704 PIPE_RCOUNTER(*inode) = PIPE_WCOUNTER(*inode) = 1;
705
706 return inode;
707fail_page:
708 return NULL;
709} 737}
710 738
711static struct vfsmount *pipe_mnt __read_mostly; 739static struct vfsmount *pipe_mnt __read_mostly;
@@ -713,6 +741,7 @@ static int pipefs_delete_dentry(struct dentry *dentry)
713{ 741{
714 return 1; 742 return 1;
715} 743}
744
716static struct dentry_operations pipefs_dentry_operations = { 745static struct dentry_operations pipefs_dentry_operations = {
717 .d_delete = pipefs_delete_dentry, 746 .d_delete = pipefs_delete_dentry,
718}; 747};
@@ -720,13 +749,17 @@ static struct dentry_operations pipefs_dentry_operations = {
720static struct inode * get_pipe_inode(void) 749static struct inode * get_pipe_inode(void)
721{ 750{
722 struct inode *inode = new_inode(pipe_mnt->mnt_sb); 751 struct inode *inode = new_inode(pipe_mnt->mnt_sb);
752 struct pipe_inode_info *pipe;
723 753
724 if (!inode) 754 if (!inode)
725 goto fail_inode; 755 goto fail_inode;
726 756
727 if(!pipe_new(inode)) 757 pipe = alloc_pipe_info(inode);
758 if (!pipe)
728 goto fail_iput; 759 goto fail_iput;
729 PIPE_READERS(*inode) = PIPE_WRITERS(*inode) = 1; 760 inode->i_pipe = pipe;
761
762 pipe->readers = pipe->writers = 1;
730 inode->i_fop = &rdwr_pipe_fops; 763 inode->i_fop = &rdwr_pipe_fops;
731 764
732 /* 765 /*
@@ -741,10 +774,12 @@ static struct inode * get_pipe_inode(void)
741 inode->i_gid = current->fsgid; 774 inode->i_gid = current->fsgid;
742 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 775 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
743 inode->i_blksize = PAGE_SIZE; 776 inode->i_blksize = PAGE_SIZE;
777
744 return inode; 778 return inode;
745 779
746fail_iput: 780fail_iput:
747 iput(inode); 781 iput(inode);
782
748fail_inode: 783fail_inode:
749 return NULL; 784 return NULL;
750} 785}
@@ -757,7 +792,7 @@ int do_pipe(int *fd)
757 struct inode * inode; 792 struct inode * inode;
758 struct file *f1, *f2; 793 struct file *f1, *f2;
759 int error; 794 int error;
760 int i,j; 795 int i, j;
761 796
762 error = -ENFILE; 797 error = -ENFILE;
763 f1 = get_empty_filp(); 798 f1 = get_empty_filp();
@@ -790,6 +825,7 @@ int do_pipe(int *fd)
790 dentry = d_alloc(pipe_mnt->mnt_sb->s_root, &this); 825 dentry = d_alloc(pipe_mnt->mnt_sb->s_root, &this);
791 if (!dentry) 826 if (!dentry)
792 goto close_f12_inode_i_j; 827 goto close_f12_inode_i_j;
828
793 dentry->d_op = &pipefs_dentry_operations; 829 dentry->d_op = &pipefs_dentry_operations;
794 d_add(dentry, inode); 830 d_add(dentry, inode);
795 f1->f_vfsmnt = f2->f_vfsmnt = mntget(mntget(pipe_mnt)); 831 f1->f_vfsmnt = f2->f_vfsmnt = mntget(mntget(pipe_mnt));
@@ -813,6 +849,7 @@ int do_pipe(int *fd)
813 fd_install(j, f2); 849 fd_install(j, f2);
814 fd[0] = i; 850 fd[0] = i;
815 fd[1] = j; 851 fd[1] = j;
852
816 return 0; 853 return 0;
817 854
818close_f12_inode_i_j: 855close_f12_inode_i_j:
@@ -837,8 +874,9 @@ no_files:
837 * d_name - pipe: will go nicely and kill the special-casing in procfs. 874 * d_name - pipe: will go nicely and kill the special-casing in procfs.
838 */ 875 */
839 876
840static struct super_block *pipefs_get_sb(struct file_system_type *fs_type, 877static struct super_block *
841 int flags, const char *dev_name, void *data) 878pipefs_get_sb(struct file_system_type *fs_type, int flags,
879 const char *dev_name, void *data)
842{ 880{
843 return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC); 881 return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC);
844} 882}
@@ -852,6 +890,7 @@ static struct file_system_type pipe_fs_type = {
852static int __init init_pipe_fs(void) 890static int __init init_pipe_fs(void)
853{ 891{
854 int err = register_filesystem(&pipe_fs_type); 892 int err = register_filesystem(&pipe_fs_type);
893
855 if (!err) { 894 if (!err) {
856 pipe_mnt = kern_mount(&pipe_fs_type); 895 pipe_mnt = kern_mount(&pipe_fs_type);
857 if (IS_ERR(pipe_mnt)) { 896 if (IS_ERR(pipe_mnt)) {
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a3a3eecef689..6cc77dc3f3ff 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -297,16 +297,20 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm
297 297
298 files = get_files_struct(task); 298 files = get_files_struct(task);
299 if (files) { 299 if (files) {
300 rcu_read_lock(); 300 /*
301 * We are not taking a ref to the file structure, so we must
302 * hold ->file_lock.
303 */
304 spin_lock(&files->file_lock);
301 file = fcheck_files(files, fd); 305 file = fcheck_files(files, fd);
302 if (file) { 306 if (file) {
303 *mnt = mntget(file->f_vfsmnt); 307 *mnt = mntget(file->f_vfsmnt);
304 *dentry = dget(file->f_dentry); 308 *dentry = dget(file->f_dentry);
305 rcu_read_unlock(); 309 spin_unlock(&files->file_lock);
306 put_files_struct(files); 310 put_files_struct(files);
307 return 0; 311 return 0;
308 } 312 }
309 rcu_read_unlock(); 313 spin_unlock(&files->file_lock);
310 put_files_struct(files); 314 put_files_struct(files);
311 } 315 }
312 return -ENOENT; 316 return -ENOENT;
@@ -1523,7 +1527,12 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry,
1523 if (!files) 1527 if (!files)
1524 goto out_unlock; 1528 goto out_unlock;
1525 inode->i_mode = S_IFLNK; 1529 inode->i_mode = S_IFLNK;
1526 rcu_read_lock(); 1530
1531 /*
1532 * We are not taking a ref to the file structure, so we must
1533 * hold ->file_lock.
1534 */
1535 spin_lock(&files->file_lock);
1527 file = fcheck_files(files, fd); 1536 file = fcheck_files(files, fd);
1528 if (!file) 1537 if (!file)
1529 goto out_unlock2; 1538 goto out_unlock2;
@@ -1531,7 +1540,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry,
1531 inode->i_mode |= S_IRUSR | S_IXUSR; 1540 inode->i_mode |= S_IRUSR | S_IXUSR;
1532 if (file->f_mode & 2) 1541 if (file->f_mode & 2)
1533 inode->i_mode |= S_IWUSR | S_IXUSR; 1542 inode->i_mode |= S_IWUSR | S_IXUSR;
1534 rcu_read_unlock(); 1543 spin_unlock(&files->file_lock);
1535 put_files_struct(files); 1544 put_files_struct(files);
1536 inode->i_op = &proc_pid_link_inode_operations; 1545 inode->i_op = &proc_pid_link_inode_operations;
1537 inode->i_size = 64; 1546 inode->i_size = 64;
@@ -1541,7 +1550,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry,
1541 return NULL; 1550 return NULL;
1542 1551
1543out_unlock2: 1552out_unlock2:
1544 rcu_read_unlock(); 1553 spin_unlock(&files->file_lock);
1545 put_files_struct(files); 1554 put_files_struct(files);
1546out_unlock: 1555out_unlock:
1547 iput(inode); 1556 iput(inode);
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 7efa73d44c9a..20d4b2237fce 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -103,8 +103,8 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
103 size_t buflen, loff_t *fpos) 103 size_t buflen, loff_t *fpos)
104{ 104{
105 ssize_t acc = 0, tmp; 105 ssize_t acc = 0, tmp;
106 size_t tsz, nr_bytes; 106 size_t tsz;
107 u64 start; 107 u64 start, nr_bytes;
108 struct vmcore *curr_m = NULL; 108 struct vmcore *curr_m = NULL;
109 109
110 if (buflen == 0 || *fpos >= vmcore_size) 110 if (buflen == 0 || *fpos >= vmcore_size)
diff --git a/fs/read_write.c b/fs/read_write.c
index 6256ca81a718..5bc0e9234f9d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -202,7 +202,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
202 goto Einval; 202 goto Einval;
203 203
204 inode = file->f_dentry->d_inode; 204 inode = file->f_dentry->d_inode;
205 if (inode->i_flock && MANDATORY_LOCK(inode)) { 205 if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
206 int retval = locks_mandatory_area( 206 int retval = locks_mandatory_area(
207 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, 207 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
208 inode, file, pos, count); 208 inode, file, pos, count);
diff --git a/fs/select.c b/fs/select.c
index 071660fa7b01..a8109baa5e46 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -310,8 +310,9 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
310 fd_set __user *exp, s64 *timeout) 310 fd_set __user *exp, s64 *timeout)
311{ 311{
312 fd_set_bits fds; 312 fd_set_bits fds;
313 char *bits; 313 void *bits;
314 int ret, size, max_fdset; 314 int ret, max_fdset;
315 unsigned int size;
315 struct fdtable *fdt; 316 struct fdtable *fdt;
316 /* Allocate small arguments on the stack to save memory and be faster */ 317 /* Allocate small arguments on the stack to save memory and be faster */
317 long stack_fds[SELECT_STACK_ALLOC/sizeof(long)]; 318 long stack_fds[SELECT_STACK_ALLOC/sizeof(long)];
@@ -333,20 +334,21 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
333 * since we used fdset we need to allocate memory in units of 334 * since we used fdset we need to allocate memory in units of
334 * long-words. 335 * long-words.
335 */ 336 */
336 ret = -ENOMEM;
337 size = FDS_BYTES(n); 337 size = FDS_BYTES(n);
338 if (6*size < SELECT_STACK_ALLOC) 338 bits = stack_fds;
339 bits = stack_fds; 339 if (size > sizeof(stack_fds) / 6) {
340 else 340 /* Not enough space in on-stack array; must use kmalloc */
341 ret = -ENOMEM;
341 bits = kmalloc(6 * size, GFP_KERNEL); 342 bits = kmalloc(6 * size, GFP_KERNEL);
342 if (!bits) 343 if (!bits)
343 goto out_nofds; 344 goto out_nofds;
344 fds.in = (unsigned long *) bits; 345 }
345 fds.out = (unsigned long *) (bits + size); 346 fds.in = bits;
346 fds.ex = (unsigned long *) (bits + 2*size); 347 fds.out = bits + size;
347 fds.res_in = (unsigned long *) (bits + 3*size); 348 fds.ex = bits + 2*size;
348 fds.res_out = (unsigned long *) (bits + 4*size); 349 fds.res_in = bits + 3*size;
349 fds.res_ex = (unsigned long *) (bits + 5*size); 350 fds.res_out = bits + 4*size;
351 fds.res_ex = bits + 5*size;
350 352
351 if ((ret = get_fd_set(n, inp, fds.in)) || 353 if ((ret = get_fd_set(n, inp, fds.in)) ||
352 (ret = get_fd_set(n, outp, fds.out)) || 354 (ret = get_fd_set(n, outp, fds.out)) ||
diff --git a/fs/splice.c b/fs/splice.c
index bfa42a277bb8..0559e7577a04 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -9,11 +9,12 @@
9 * that transfers data buffers to or from a pipe buffer. 9 * that transfers data buffers to or from a pipe buffer.
10 * 10 *
11 * Named by Larry McVoy, original implementation from Linus, extended by 11 * Named by Larry McVoy, original implementation from Linus, extended by
12 * Jens to support splicing to files and fixing the initial implementation 12 * Jens to support splicing to files, network, direct splicing, etc and
13 * bugs. 13 * fixing lots of bugs.
14 * 14 *
15 * Copyright (C) 2005 Jens Axboe <axboe@suse.de> 15 * Copyright (C) 2005-2006 Jens Axboe <axboe@suse.de>
16 * Copyright (C) 2005 Linus Torvalds <torvalds@osdl.org> 16 * Copyright (C) 2005-2006 Linus Torvalds <torvalds@osdl.org>
17 * Copyright (C) 2006 Ingo Molnar <mingo@elte.hu>
17 * 18 *
18 */ 19 */
19#include <linux/fs.h> 20#include <linux/fs.h>
@@ -49,7 +50,8 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *info,
49 struct page *page = buf->page; 50 struct page *page = buf->page;
50 struct address_space *mapping = page_mapping(page); 51 struct address_space *mapping = page_mapping(page);
51 52
52 WARN_ON(!PageLocked(page)); 53 lock_page(page);
54
53 WARN_ON(!PageUptodate(page)); 55 WARN_ON(!PageUptodate(page));
54 56
55 /* 57 /*
@@ -64,8 +66,10 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *info,
64 if (PagePrivate(page)) 66 if (PagePrivate(page))
65 try_to_release_page(page, mapping_gfp_mask(mapping)); 67 try_to_release_page(page, mapping_gfp_mask(mapping));
66 68
67 if (!remove_mapping(mapping, page)) 69 if (!remove_mapping(mapping, page)) {
70 unlock_page(page);
68 return 1; 71 return 1;
72 }
69 73
70 buf->flags |= PIPE_BUF_FLAG_STOLEN | PIPE_BUF_FLAG_LRU; 74 buf->flags |= PIPE_BUF_FLAG_STOLEN | PIPE_BUF_FLAG_LRU;
71 return 0; 75 return 0;
@@ -84,69 +88,89 @@ static void *page_cache_pipe_buf_map(struct file *file,
84 struct pipe_buffer *buf) 88 struct pipe_buffer *buf)
85{ 89{
86 struct page *page = buf->page; 90 struct page *page = buf->page;
87 91 int err;
88 lock_page(page);
89 92
90 if (!PageUptodate(page)) { 93 if (!PageUptodate(page)) {
91 unlock_page(page); 94 lock_page(page);
92 return ERR_PTR(-EIO);
93 }
94 95
95 if (!page->mapping) { 96 /*
97 * Page got truncated/unhashed. This will cause a 0-byte
98 * splice, if this is the first page.
99 */
100 if (!page->mapping) {
101 err = -ENODATA;
102 goto error;
103 }
104
105 /*
106 * Uh oh, read-error from disk.
107 */
108 if (!PageUptodate(page)) {
109 err = -EIO;
110 goto error;
111 }
112
113 /*
114 * Page is ok afterall, fall through to mapping.
115 */
96 unlock_page(page); 116 unlock_page(page);
97 return ERR_PTR(-ENODATA);
98 } 117 }
99 118
100 return kmap(buf->page); 119 return kmap(page);
120error:
121 unlock_page(page);
122 return ERR_PTR(err);
101} 123}
102 124
103static void page_cache_pipe_buf_unmap(struct pipe_inode_info *info, 125static void page_cache_pipe_buf_unmap(struct pipe_inode_info *info,
104 struct pipe_buffer *buf) 126 struct pipe_buffer *buf)
105{ 127{
106 unlock_page(buf->page);
107 kunmap(buf->page); 128 kunmap(buf->page);
108} 129}
109 130
131static void page_cache_pipe_buf_get(struct pipe_inode_info *info,
132 struct pipe_buffer *buf)
133{
134 page_cache_get(buf->page);
135}
136
110static struct pipe_buf_operations page_cache_pipe_buf_ops = { 137static struct pipe_buf_operations page_cache_pipe_buf_ops = {
111 .can_merge = 0, 138 .can_merge = 0,
112 .map = page_cache_pipe_buf_map, 139 .map = page_cache_pipe_buf_map,
113 .unmap = page_cache_pipe_buf_unmap, 140 .unmap = page_cache_pipe_buf_unmap,
114 .release = page_cache_pipe_buf_release, 141 .release = page_cache_pipe_buf_release,
115 .steal = page_cache_pipe_buf_steal, 142 .steal = page_cache_pipe_buf_steal,
143 .get = page_cache_pipe_buf_get,
116}; 144};
117 145
118/* 146/*
119 * Pipe output worker. This sets up our pipe format with the page cache 147 * Pipe output worker. This sets up our pipe format with the page cache
120 * pipe buffer operations. Otherwise very similar to the regular pipe_writev(). 148 * pipe buffer operations. Otherwise very similar to the regular pipe_writev().
121 */ 149 */
122static ssize_t move_to_pipe(struct inode *inode, struct page **pages, 150static ssize_t move_to_pipe(struct pipe_inode_info *pipe, struct page **pages,
123 int nr_pages, unsigned long offset, 151 int nr_pages, unsigned long len,
124 unsigned long len, unsigned int flags) 152 unsigned int offset, unsigned int flags)
125{ 153{
126 struct pipe_inode_info *info;
127 int ret, do_wakeup, i; 154 int ret, do_wakeup, i;
128 155
129 ret = 0; 156 ret = 0;
130 do_wakeup = 0; 157 do_wakeup = 0;
131 i = 0; 158 i = 0;
132 159
133 mutex_lock(PIPE_MUTEX(*inode)); 160 if (pipe->inode)
161 mutex_lock(&pipe->inode->i_mutex);
134 162
135 info = inode->i_pipe;
136 for (;;) { 163 for (;;) {
137 int bufs; 164 if (!pipe->readers) {
138
139 if (!PIPE_READERS(*inode)) {
140 send_sig(SIGPIPE, current, 0); 165 send_sig(SIGPIPE, current, 0);
141 if (!ret) 166 if (!ret)
142 ret = -EPIPE; 167 ret = -EPIPE;
143 break; 168 break;
144 } 169 }
145 170
146 bufs = info->nrbufs; 171 if (pipe->nrbufs < PIPE_BUFFERS) {
147 if (bufs < PIPE_BUFFERS) { 172 int newbuf = (pipe->curbuf + pipe->nrbufs) & (PIPE_BUFFERS - 1);
148 int newbuf = (info->curbuf + bufs) & (PIPE_BUFFERS - 1); 173 struct pipe_buffer *buf = pipe->bufs + newbuf;
149 struct pipe_buffer *buf = info->bufs + newbuf;
150 struct page *page = pages[i++]; 174 struct page *page = pages[i++];
151 unsigned long this_len; 175 unsigned long this_len;
152 176
@@ -158,8 +182,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
158 buf->offset = offset; 182 buf->offset = offset;
159 buf->len = this_len; 183 buf->len = this_len;
160 buf->ops = &page_cache_pipe_buf_ops; 184 buf->ops = &page_cache_pipe_buf_ops;
161 info->nrbufs = ++bufs; 185 pipe->nrbufs++;
162 do_wakeup = 1; 186 if (pipe->inode)
187 do_wakeup = 1;
163 188
164 ret += this_len; 189 ret += this_len;
165 len -= this_len; 190 len -= this_len;
@@ -168,7 +193,7 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
168 break; 193 break;
169 if (!len) 194 if (!len)
170 break; 195 break;
171 if (bufs < PIPE_BUFFERS) 196 if (pipe->nrbufs < PIPE_BUFFERS)
172 continue; 197 continue;
173 198
174 break; 199 break;
@@ -187,22 +212,26 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
187 } 212 }
188 213
189 if (do_wakeup) { 214 if (do_wakeup) {
190 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 215 smp_mb();
191 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, 216 if (waitqueue_active(&pipe->wait))
192 POLL_IN); 217 wake_up_interruptible_sync(&pipe->wait);
218 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
193 do_wakeup = 0; 219 do_wakeup = 0;
194 } 220 }
195 221
196 PIPE_WAITING_WRITERS(*inode)++; 222 pipe->waiting_writers++;
197 pipe_wait(inode); 223 pipe_wait(pipe);
198 PIPE_WAITING_WRITERS(*inode)--; 224 pipe->waiting_writers--;
199 } 225 }
200 226
201 mutex_unlock(PIPE_MUTEX(*inode)); 227 if (pipe->inode)
228 mutex_unlock(&pipe->inode->i_mutex);
202 229
203 if (do_wakeup) { 230 if (do_wakeup) {
204 wake_up_interruptible(PIPE_WAIT(*inode)); 231 smp_mb();
205 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); 232 if (waitqueue_active(&pipe->wait))
233 wake_up_interruptible(&pipe->wait);
234 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
206 } 235 }
207 236
208 while (i < nr_pages) 237 while (i < nr_pages)
@@ -211,96 +240,155 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
211 return ret; 240 return ret;
212} 241}
213 242
214static int __generic_file_splice_read(struct file *in, struct inode *pipe, 243static int
215 size_t len, unsigned int flags) 244__generic_file_splice_read(struct file *in, loff_t *ppos,
245 struct pipe_inode_info *pipe, size_t len,
246 unsigned int flags)
216{ 247{
217 struct address_space *mapping = in->f_mapping; 248 struct address_space *mapping = in->f_mapping;
218 unsigned int offset, nr_pages; 249 unsigned int loff, offset, nr_pages;
219 struct page *pages[PIPE_BUFFERS], *shadow[PIPE_BUFFERS]; 250 struct page *pages[PIPE_BUFFERS];
220 struct page *page; 251 struct page *page;
221 pgoff_t index, pidx; 252 pgoff_t index, end_index;
222 int i, j; 253 loff_t isize;
254 size_t bytes;
255 int i, error;
223 256
224 index = in->f_pos >> PAGE_CACHE_SHIFT; 257 index = *ppos >> PAGE_CACHE_SHIFT;
225 offset = in->f_pos & ~PAGE_CACHE_MASK; 258 loff = offset = *ppos & ~PAGE_CACHE_MASK;
226 nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 259 nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
227 260
228 if (nr_pages > PIPE_BUFFERS) 261 if (nr_pages > PIPE_BUFFERS)
229 nr_pages = PIPE_BUFFERS; 262 nr_pages = PIPE_BUFFERS;
230 263
231 /* 264 /*
232 * initiate read-ahead on this page range 265 * Initiate read-ahead on this page range. however, don't call into
266 * read-ahead if this is a non-zero offset (we are likely doing small
267 * chunk splice and the page is already there) for a single page.
233 */ 268 */
234 do_page_cache_readahead(mapping, in, index, nr_pages); 269 if (!offset || nr_pages > 1)
270 do_page_cache_readahead(mapping, in, index, nr_pages);
235 271
236 /* 272 /*
237 * Get as many pages from the page cache as possible.. 273 * Now fill in the holes:
238 * Start IO on the page cache entries we create (we
239 * can assume that any pre-existing ones we find have
240 * already had IO started on them).
241 */ 274 */
242 i = find_get_pages(mapping, index, nr_pages, pages); 275 error = 0;
276 bytes = 0;
277 for (i = 0; i < nr_pages; i++, index++) {
278 unsigned int this_len;
243 279
244 /* 280 if (!len)
245 * common case - we found all pages and they are contiguous, 281 break;
246 * kick them off
247 */
248 if (i && (pages[i - 1]->index == index + i - 1))
249 goto splice_them;
250 282
251 /* 283 /*
252 * fill shadow[] with pages at the right locations, so we only 284 * this_len is the max we'll use from this page
253 * have to fill holes 285 */
254 */ 286 this_len = min(len, PAGE_CACHE_SIZE - loff);
255 memset(shadow, 0, nr_pages * sizeof(struct page *)); 287find_page:
256 for (j = 0; j < i; j++) 288 /*
257 shadow[pages[j]->index - index] = pages[j]; 289 * lookup the page for this index
290 */
291 page = find_get_page(mapping, index);
292 if (!page) {
293 /*
294 * page didn't exist, allocate one
295 */
296 page = page_cache_alloc_cold(mapping);
297 if (!page)
298 break;
258 299
259 /* 300 error = add_to_page_cache_lru(page, mapping, index,
260 * now fill in the holes 301 mapping_gfp_mask(mapping));
261 */ 302 if (unlikely(error)) {
262 for (i = 0, pidx = index; i < nr_pages; pidx++, i++) { 303 page_cache_release(page);
263 int error; 304 break;
305 }
264 306
265 if (shadow[i]) 307 goto readpage;
266 continue; 308 }
267 309
268 /* 310 /*
269 * no page there, look one up / create it 311 * If the page isn't uptodate, we may need to start io on it
270 */ 312 */
271 page = find_or_create_page(mapping, pidx, 313 if (!PageUptodate(page)) {
272 mapping_gfp_mask(mapping)); 314 /*
273 if (!page) 315 * If in nonblock mode then dont block on waiting
274 break; 316 * for an in-flight io page
317 */
318 if (flags & SPLICE_F_NONBLOCK)
319 break;
320
321 lock_page(page);
322
323 /*
324 * page was truncated, stop here. if this isn't the
325 * first page, we'll just complete what we already
326 * added
327 */
328 if (!page->mapping) {
329 unlock_page(page);
330 page_cache_release(page);
331 break;
332 }
333 /*
334 * page was already under io and is now done, great
335 */
336 if (PageUptodate(page)) {
337 unlock_page(page);
338 goto fill_it;
339 }
275 340
276 if (PageUptodate(page)) 341readpage:
277 unlock_page(page); 342 /*
278 else { 343 * need to read in the page
344 */
279 error = mapping->a_ops->readpage(in, page); 345 error = mapping->a_ops->readpage(in, page);
280 346
281 if (unlikely(error)) { 347 if (unlikely(error)) {
282 page_cache_release(page); 348 page_cache_release(page);
349 if (error == AOP_TRUNCATED_PAGE)
350 goto find_page;
283 break; 351 break;
284 } 352 }
285 }
286 shadow[i] = page;
287 }
288 353
289 if (!i) { 354 /*
290 for (i = 0; i < nr_pages; i++) { 355 * i_size must be checked after ->readpage().
291 if (shadow[i]) 356 */
292 page_cache_release(shadow[i]); 357 isize = i_size_read(mapping->host);
358 end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
359 if (unlikely(!isize || index > end_index)) {
360 page_cache_release(page);
361 break;
362 }
363
364 /*
365 * if this is the last page, see if we need to shrink
366 * the length and stop
367 */
368 if (end_index == index) {
369 loff = PAGE_CACHE_SIZE - (isize & ~PAGE_CACHE_MASK);
370 if (bytes + loff > isize) {
371 page_cache_release(page);
372 break;
373 }
374 /*
375 * force quit after adding this page
376 */
377 nr_pages = i;
378 this_len = min(this_len, loff);
379 }
293 } 380 }
294 return 0; 381fill_it:
382 pages[i] = page;
383 bytes += this_len;
384 len -= this_len;
385 loff = 0;
295 } 386 }
296 387
297 memcpy(pages, shadow, i * sizeof(struct page *)); 388 if (i)
389 return move_to_pipe(pipe, pages, i, bytes, offset, flags);
298 390
299 /* 391 return error;
300 * Now we splice them into the pipe..
301 */
302splice_them:
303 return move_to_pipe(pipe, pages, i, offset, len, flags);
304} 392}
305 393
306/** 394/**
@@ -311,30 +399,34 @@ splice_them:
311 * @flags: splice modifier flags 399 * @flags: splice modifier flags
312 * 400 *
313 * Will read pages from given file and fill them into a pipe. 401 * Will read pages from given file and fill them into a pipe.
314 *
315 */ 402 */
316ssize_t generic_file_splice_read(struct file *in, struct inode *pipe, 403ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
317 size_t len, unsigned int flags) 404 struct pipe_inode_info *pipe, size_t len,
405 unsigned int flags)
318{ 406{
319 ssize_t spliced; 407 ssize_t spliced;
320 int ret; 408 int ret;
321 409
322 ret = 0; 410 ret = 0;
323 spliced = 0; 411 spliced = 0;
412
324 while (len) { 413 while (len) {
325 ret = __generic_file_splice_read(in, pipe, len, flags); 414 ret = __generic_file_splice_read(in, ppos, pipe, len, flags);
326 415
327 if (ret <= 0) 416 if (ret < 0)
328 break; 417 break;
418 else if (!ret) {
419 if (spliced)
420 break;
421 if (flags & SPLICE_F_NONBLOCK) {
422 ret = -EAGAIN;
423 break;
424 }
425 }
329 426
330 in->f_pos += ret; 427 *ppos += ret;
331 len -= ret; 428 len -= ret;
332 spliced += ret; 429 spliced += ret;
333
334 if (!(flags & SPLICE_F_NONBLOCK))
335 continue;
336 ret = -EAGAIN;
337 break;
338 } 430 }
339 431
340 if (spliced) 432 if (spliced)
@@ -360,10 +452,10 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
360 int more; 452 int more;
361 453
362 /* 454 /*
363 * sub-optimal, but we are limited by the pipe ->map. we don't 455 * Sub-optimal, but we are limited by the pipe ->map. We don't
364 * need a kmap'ed buffer here, we just want to make sure we 456 * need a kmap'ed buffer here, we just want to make sure we
365 * have the page pinned if the pipe page originates from the 457 * have the page pinned if the pipe page originates from the
366 * page cache 458 * page cache.
367 */ 459 */
368 ptr = buf->ops->map(file, info, buf); 460 ptr = buf->ops->map(file, info, buf);
369 if (IS_ERR(ptr)) 461 if (IS_ERR(ptr))
@@ -414,7 +506,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
414 int ret; 506 int ret;
415 507
416 /* 508 /*
417 * after this, page will be locked and unmapped 509 * make sure the data in this buffer is uptodate
418 */ 510 */
419 src = buf->ops->map(file, info, buf); 511 src = buf->ops->map(file, info, buf);
420 if (IS_ERR(src)) 512 if (IS_ERR(src))
@@ -424,12 +516,13 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
424 offset = sd->pos & ~PAGE_CACHE_MASK; 516 offset = sd->pos & ~PAGE_CACHE_MASK;
425 517
426 /* 518 /*
427 * reuse buf page, if SPLICE_F_MOVE is set 519 * Reuse buf page, if SPLICE_F_MOVE is set.
428 */ 520 */
429 if (sd->flags & SPLICE_F_MOVE) { 521 if (sd->flags & SPLICE_F_MOVE) {
430 /* 522 /*
431 * If steal succeeds, buf->page is now pruned from the vm 523 * If steal succeeds, buf->page is now pruned from the vm
432 * side (LRU and page cache) and we can reuse it. 524 * side (LRU and page cache) and we can reuse it. The page
525 * will also be looked on successful return.
433 */ 526 */
434 if (buf->ops->steal(info, buf)) 527 if (buf->ops->steal(info, buf))
435 goto find_page; 528 goto find_page;
@@ -442,15 +535,27 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
442 lru_cache_add(page); 535 lru_cache_add(page);
443 } else { 536 } else {
444find_page: 537find_page:
445 ret = -ENOMEM; 538 page = find_lock_page(mapping, index);
446 page = find_or_create_page(mapping, index, gfp_mask); 539 if (!page) {
447 if (!page) 540 ret = -ENOMEM;
448 goto out; 541 page = page_cache_alloc_cold(mapping);
542 if (unlikely(!page))
543 goto out_nomem;
544
545 /*
546 * This will also lock the page
547 */
548 ret = add_to_page_cache_lru(page, mapping, index,
549 gfp_mask);
550 if (unlikely(ret))
551 goto out;
552 }
449 553
450 /* 554 /*
451 * If the page is uptodate, it is also locked. If it isn't 555 * We get here with the page locked. If the page is also
452 * uptodate, we can mark it uptodate if we are filling the 556 * uptodate, we don't need to do more. If it isn't, we
453 * full page. Otherwise we need to read it in first... 557 * may need to bring it in if we are not going to overwrite
558 * the full page.
454 */ 559 */
455 if (!PageUptodate(page)) { 560 if (!PageUptodate(page)) {
456 if (sd->len < PAGE_CACHE_SIZE) { 561 if (sd->len < PAGE_CACHE_SIZE) {
@@ -462,7 +567,7 @@ find_page:
462 567
463 if (!PageUptodate(page)) { 568 if (!PageUptodate(page)) {
464 /* 569 /*
465 * page got invalidated, repeat 570 * Page got invalidated, repeat.
466 */ 571 */
467 if (!page->mapping) { 572 if (!page->mapping) {
468 unlock_page(page); 573 unlock_page(page);
@@ -472,10 +577,8 @@ find_page:
472 ret = -EIO; 577 ret = -EIO;
473 goto out; 578 goto out;
474 } 579 }
475 } else { 580 } else
476 WARN_ON(!PageLocked(page));
477 SetPageUptodate(page); 581 SetPageUptodate(page);
478 }
479 } 582 }
480 } 583 }
481 584
@@ -501,12 +604,14 @@ find_page:
501 } else if (ret) 604 } else if (ret)
502 goto out; 605 goto out;
503 606
607 mark_page_accessed(page);
504 balance_dirty_pages_ratelimited(mapping); 608 balance_dirty_pages_ratelimited(mapping);
505out: 609out:
506 if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) { 610 if (!(buf->flags & PIPE_BUF_FLAG_STOLEN))
507 page_cache_release(page); 611 page_cache_release(page);
508 unlock_page(page); 612
509 } 613 unlock_page(page);
614out_nomem:
510 buf->ops->unmap(info, buf); 615 buf->ops->unmap(info, buf);
511 return ret; 616 return ret;
512} 617}
@@ -519,11 +624,10 @@ typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
519 * key here is the 'actor' worker passed in that actually moves the data 624 * key here is the 'actor' worker passed in that actually moves the data
520 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above. 625 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.
521 */ 626 */
522static ssize_t move_from_pipe(struct inode *inode, struct file *out, 627static ssize_t move_from_pipe(struct pipe_inode_info *pipe, struct file *out,
523 size_t len, unsigned int flags, 628 loff_t *ppos, size_t len, unsigned int flags,
524 splice_actor *actor) 629 splice_actor *actor)
525{ 630{
526 struct pipe_inode_info *info;
527 int ret, do_wakeup, err; 631 int ret, do_wakeup, err;
528 struct splice_desc sd; 632 struct splice_desc sd;
529 633
@@ -533,24 +637,21 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
533 sd.total_len = len; 637 sd.total_len = len;
534 sd.flags = flags; 638 sd.flags = flags;
535 sd.file = out; 639 sd.file = out;
536 sd.pos = out->f_pos; 640 sd.pos = *ppos;
537 641
538 mutex_lock(PIPE_MUTEX(*inode)); 642 if (pipe->inode)
643 mutex_lock(&pipe->inode->i_mutex);
539 644
540 info = inode->i_pipe;
541 for (;;) { 645 for (;;) {
542 int bufs = info->nrbufs; 646 if (pipe->nrbufs) {
543 647 struct pipe_buffer *buf = pipe->bufs + pipe->curbuf;
544 if (bufs) {
545 int curbuf = info->curbuf;
546 struct pipe_buffer *buf = info->bufs + curbuf;
547 struct pipe_buf_operations *ops = buf->ops; 648 struct pipe_buf_operations *ops = buf->ops;
548 649
549 sd.len = buf->len; 650 sd.len = buf->len;
550 if (sd.len > sd.total_len) 651 if (sd.len > sd.total_len)
551 sd.len = sd.total_len; 652 sd.len = sd.total_len;
552 653
553 err = actor(info, buf, &sd); 654 err = actor(pipe, buf, &sd);
554 if (err) { 655 if (err) {
555 if (!ret && err != -ENODATA) 656 if (!ret && err != -ENODATA)
556 ret = err; 657 ret = err;
@@ -561,13 +662,14 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
561 ret += sd.len; 662 ret += sd.len;
562 buf->offset += sd.len; 663 buf->offset += sd.len;
563 buf->len -= sd.len; 664 buf->len -= sd.len;
665
564 if (!buf->len) { 666 if (!buf->len) {
565 buf->ops = NULL; 667 buf->ops = NULL;
566 ops->release(info, buf); 668 ops->release(pipe, buf);
567 curbuf = (curbuf + 1) & (PIPE_BUFFERS - 1); 669 pipe->curbuf = (pipe->curbuf + 1) & (PIPE_BUFFERS - 1);
568 info->curbuf = curbuf; 670 pipe->nrbufs--;
569 info->nrbufs = --bufs; 671 if (pipe->inode)
570 do_wakeup = 1; 672 do_wakeup = 1;
571 } 673 }
572 674
573 sd.pos += sd.len; 675 sd.pos += sd.len;
@@ -576,11 +678,11 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
576 break; 678 break;
577 } 679 }
578 680
579 if (bufs) 681 if (pipe->nrbufs)
580 continue; 682 continue;
581 if (!PIPE_WRITERS(*inode)) 683 if (!pipe->writers)
582 break; 684 break;
583 if (!PIPE_WAITING_WRITERS(*inode)) { 685 if (!pipe->waiting_writers) {
584 if (ret) 686 if (ret)
585 break; 687 break;
586 } 688 }
@@ -598,31 +700,32 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
598 } 700 }
599 701
600 if (do_wakeup) { 702 if (do_wakeup) {
601 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 703 smp_mb();
602 kill_fasync(PIPE_FASYNC_WRITERS(*inode),SIGIO,POLL_OUT); 704 if (waitqueue_active(&pipe->wait))
705 wake_up_interruptible_sync(&pipe->wait);
706 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
603 do_wakeup = 0; 707 do_wakeup = 0;
604 } 708 }
605 709
606 pipe_wait(inode); 710 pipe_wait(pipe);
607 } 711 }
608 712
609 mutex_unlock(PIPE_MUTEX(*inode)); 713 if (pipe->inode)
714 mutex_unlock(&pipe->inode->i_mutex);
610 715
611 if (do_wakeup) { 716 if (do_wakeup) {
612 wake_up_interruptible(PIPE_WAIT(*inode)); 717 smp_mb();
613 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT); 718 if (waitqueue_active(&pipe->wait))
719 wake_up_interruptible(&pipe->wait);
720 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
614 } 721 }
615 722
616 mutex_lock(&out->f_mapping->host->i_mutex);
617 out->f_pos = sd.pos;
618 mutex_unlock(&out->f_mapping->host->i_mutex);
619 return ret; 723 return ret;
620
621} 724}
622 725
623/** 726/**
624 * generic_file_splice_write - splice data from a pipe to a file 727 * generic_file_splice_write - splice data from a pipe to a file
625 * @inode: pipe inode 728 * @pipe: pipe info
626 * @out: file to write to 729 * @out: file to write to
627 * @len: number of bytes to splice 730 * @len: number of bytes to splice
628 * @flags: splice modifier flags 731 * @flags: splice modifier flags
@@ -631,27 +734,34 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
631 * the given pipe inode to the given file. 734 * the given pipe inode to the given file.
632 * 735 *
633 */ 736 */
634ssize_t generic_file_splice_write(struct inode *inode, struct file *out, 737ssize_t
635 size_t len, unsigned int flags) 738generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
739 loff_t *ppos, size_t len, unsigned int flags)
636{ 740{
637 struct address_space *mapping = out->f_mapping; 741 struct address_space *mapping = out->f_mapping;
638 ssize_t ret = move_from_pipe(inode, out, len, flags, pipe_to_file); 742 ssize_t ret;
639 743
640 /* 744 ret = move_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
641 * if file or inode is SYNC and we actually wrote some data, sync it 745 if (ret > 0) {
642 */
643 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host))
644 && ret > 0) {
645 struct inode *inode = mapping->host; 746 struct inode *inode = mapping->host;
646 int err;
647 747
648 mutex_lock(&inode->i_mutex); 748 *ppos += ret;
649 err = generic_osync_inode(mapping->host, mapping, 749
650 OSYNC_METADATA|OSYNC_DATA); 750 /*
651 mutex_unlock(&inode->i_mutex); 751 * If file or inode is SYNC and we actually wrote some data,
752 * sync it.
753 */
754 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) {
755 int err;
756
757 mutex_lock(&inode->i_mutex);
758 err = generic_osync_inode(inode, mapping,
759 OSYNC_METADATA|OSYNC_DATA);
760 mutex_unlock(&inode->i_mutex);
652 761
653 if (err) 762 if (err)
654 ret = err; 763 ret = err;
764 }
655 } 765 }
656 766
657 return ret; 767 return ret;
@@ -670,10 +780,10 @@ EXPORT_SYMBOL(generic_file_splice_write);
670 * is involved. 780 * is involved.
671 * 781 *
672 */ 782 */
673ssize_t generic_splice_sendpage(struct inode *inode, struct file *out, 783ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, struct file *out,
674 size_t len, unsigned int flags) 784 loff_t *ppos, size_t len, unsigned int flags)
675{ 785{
676 return move_from_pipe(inode, out, len, flags, pipe_to_sendpage); 786 return move_from_pipe(pipe, out, ppos, len, flags, pipe_to_sendpage);
677} 787}
678 788
679EXPORT_SYMBOL(generic_splice_sendpage); 789EXPORT_SYMBOL(generic_splice_sendpage);
@@ -681,77 +791,228 @@ EXPORT_SYMBOL(generic_splice_sendpage);
681/* 791/*
682 * Attempt to initiate a splice from pipe to file. 792 * Attempt to initiate a splice from pipe to file.
683 */ 793 */
684static long do_splice_from(struct inode *pipe, struct file *out, size_t len, 794static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
685 unsigned int flags) 795 loff_t *ppos, size_t len, unsigned int flags)
686{ 796{
687 loff_t pos;
688 int ret; 797 int ret;
689 798
690 if (!out->f_op || !out->f_op->splice_write) 799 if (unlikely(!out->f_op || !out->f_op->splice_write))
691 return -EINVAL; 800 return -EINVAL;
692 801
693 if (!(out->f_mode & FMODE_WRITE)) 802 if (unlikely(!(out->f_mode & FMODE_WRITE)))
694 return -EBADF; 803 return -EBADF;
695 804
696 pos = out->f_pos; 805 ret = rw_verify_area(WRITE, out, ppos, len);
697 ret = rw_verify_area(WRITE, out, &pos, len);
698 if (unlikely(ret < 0)) 806 if (unlikely(ret < 0))
699 return ret; 807 return ret;
700 808
701 return out->f_op->splice_write(pipe, out, len, flags); 809 return out->f_op->splice_write(pipe, out, ppos, len, flags);
702} 810}
703 811
704/* 812/*
705 * Attempt to initiate a splice from a file to a pipe. 813 * Attempt to initiate a splice from a file to a pipe.
706 */ 814 */
707static long do_splice_to(struct file *in, struct inode *pipe, size_t len, 815static long do_splice_to(struct file *in, loff_t *ppos,
816 struct pipe_inode_info *pipe, size_t len,
708 unsigned int flags) 817 unsigned int flags)
709{ 818{
710 loff_t pos, isize, left; 819 loff_t isize, left;
711 int ret; 820 int ret;
712 821
713 if (!in->f_op || !in->f_op->splice_read) 822 if (unlikely(!in->f_op || !in->f_op->splice_read))
714 return -EINVAL; 823 return -EINVAL;
715 824
716 if (!(in->f_mode & FMODE_READ)) 825 if (unlikely(!(in->f_mode & FMODE_READ)))
717 return -EBADF; 826 return -EBADF;
718 827
719 pos = in->f_pos; 828 ret = rw_verify_area(READ, in, ppos, len);
720 ret = rw_verify_area(READ, in, &pos, len);
721 if (unlikely(ret < 0)) 829 if (unlikely(ret < 0))
722 return ret; 830 return ret;
723 831
724 isize = i_size_read(in->f_mapping->host); 832 isize = i_size_read(in->f_mapping->host);
725 if (unlikely(in->f_pos >= isize)) 833 if (unlikely(*ppos >= isize))
726 return 0; 834 return 0;
727 835
728 left = isize - in->f_pos; 836 left = isize - *ppos;
729 if (left < len) 837 if (unlikely(left < len))
730 len = left; 838 len = left;
731 839
732 return in->f_op->splice_read(in, pipe, len, flags); 840 return in->f_op->splice_read(in, ppos, pipe, len, flags);
841}
842
843long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
844 size_t len, unsigned int flags)
845{
846 struct pipe_inode_info *pipe;
847 long ret, bytes;
848 loff_t out_off;
849 umode_t i_mode;
850 int i;
851
852 /*
853 * We require the input being a regular file, as we don't want to
854 * randomly drop data for eg socket -> socket splicing. Use the
855 * piped splicing for that!
856 */
857 i_mode = in->f_dentry->d_inode->i_mode;
858 if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
859 return -EINVAL;
860
861 /*
862 * neither in nor out is a pipe, setup an internal pipe attached to
863 * 'out' and transfer the wanted data from 'in' to 'out' through that
864 */
865 pipe = current->splice_pipe;
866 if (unlikely(!pipe)) {
867 pipe = alloc_pipe_info(NULL);
868 if (!pipe)
869 return -ENOMEM;
870
871 /*
872 * We don't have an immediate reader, but we'll read the stuff
873 * out of the pipe right after the move_to_pipe(). So set
874 * PIPE_READERS appropriately.
875 */
876 pipe->readers = 1;
877
878 current->splice_pipe = pipe;
879 }
880
881 /*
882 * Do the splice.
883 */
884 ret = 0;
885 bytes = 0;
886 out_off = 0;
887
888 while (len) {
889 size_t read_len, max_read_len;
890
891 /*
892 * Do at most PIPE_BUFFERS pages worth of transfer:
893 */
894 max_read_len = min(len, (size_t)(PIPE_BUFFERS*PAGE_SIZE));
895
896 ret = do_splice_to(in, ppos, pipe, max_read_len, flags);
897 if (unlikely(ret < 0))
898 goto out_release;
899
900 read_len = ret;
901
902 /*
903 * NOTE: nonblocking mode only applies to the input. We
904 * must not do the output in nonblocking mode as then we
905 * could get stuck data in the internal pipe:
906 */
907 ret = do_splice_from(pipe, out, &out_off, read_len,
908 flags & ~SPLICE_F_NONBLOCK);
909 if (unlikely(ret < 0))
910 goto out_release;
911
912 bytes += ret;
913 len -= ret;
914
915 /*
916 * In nonblocking mode, if we got back a short read then
917 * that was due to either an IO error or due to the
918 * pagecache entry not being there. In the IO error case
919 * the _next_ splice attempt will produce a clean IO error
920 * return value (not a short read), so in both cases it's
921 * correct to break out of the loop here:
922 */
923 if ((flags & SPLICE_F_NONBLOCK) && (read_len < max_read_len))
924 break;
925 }
926
927 pipe->nrbufs = pipe->curbuf = 0;
928
929 return bytes;
930
931out_release:
932 /*
933 * If we did an incomplete transfer we must release
934 * the pipe buffers in question:
935 */
936 for (i = 0; i < PIPE_BUFFERS; i++) {
937 struct pipe_buffer *buf = pipe->bufs + i;
938
939 if (buf->ops) {
940 buf->ops->release(pipe, buf);
941 buf->ops = NULL;
942 }
943 }
944 pipe->nrbufs = pipe->curbuf = 0;
945
946 /*
947 * If we transferred some data, return the number of bytes:
948 */
949 if (bytes > 0)
950 return bytes;
951
952 return ret;
733} 953}
734 954
955EXPORT_SYMBOL(do_splice_direct);
956
735/* 957/*
736 * Determine where to splice to/from. 958 * Determine where to splice to/from.
737 */ 959 */
738static long do_splice(struct file *in, struct file *out, size_t len, 960static long do_splice(struct file *in, loff_t __user *off_in,
739 unsigned int flags) 961 struct file *out, loff_t __user *off_out,
962 size_t len, unsigned int flags)
740{ 963{
741 struct inode *pipe; 964 struct pipe_inode_info *pipe;
965 loff_t offset, *off;
966 long ret;
967
968 pipe = in->f_dentry->d_inode->i_pipe;
969 if (pipe) {
970 if (off_in)
971 return -ESPIPE;
972 if (off_out) {
973 if (out->f_op->llseek == no_llseek)
974 return -EINVAL;
975 if (copy_from_user(&offset, off_out, sizeof(loff_t)))
976 return -EFAULT;
977 off = &offset;
978 } else
979 off = &out->f_pos;
980
981 ret = do_splice_from(pipe, out, off, len, flags);
982
983 if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
984 ret = -EFAULT;
742 985
743 pipe = in->f_dentry->d_inode; 986 return ret;
744 if (pipe->i_pipe) 987 }
745 return do_splice_from(pipe, out, len, flags); 988
989 pipe = out->f_dentry->d_inode->i_pipe;
990 if (pipe) {
991 if (off_out)
992 return -ESPIPE;
993 if (off_in) {
994 if (in->f_op->llseek == no_llseek)
995 return -EINVAL;
996 if (copy_from_user(&offset, off_in, sizeof(loff_t)))
997 return -EFAULT;
998 off = &offset;
999 } else
1000 off = &in->f_pos;
746 1001
747 pipe = out->f_dentry->d_inode; 1002 ret = do_splice_to(in, off, pipe, len, flags);
748 if (pipe->i_pipe) 1003
749 return do_splice_to(in, pipe, len, flags); 1004 if (off_in && copy_to_user(off_in, off, sizeof(loff_t)))
1005 ret = -EFAULT;
1006
1007 return ret;
1008 }
750 1009
751 return -EINVAL; 1010 return -EINVAL;
752} 1011}
753 1012
754asmlinkage long sys_splice(int fdin, int fdout, size_t len, unsigned int flags) 1013asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
1014 int fd_out, loff_t __user *off_out,
1015 size_t len, unsigned int flags)
755{ 1016{
756 long error; 1017 long error;
757 struct file *in, *out; 1018 struct file *in, *out;
@@ -761,13 +1022,15 @@ asmlinkage long sys_splice(int fdin, int fdout, size_t len, unsigned int flags)
761 return 0; 1022 return 0;
762 1023
763 error = -EBADF; 1024 error = -EBADF;
764 in = fget_light(fdin, &fput_in); 1025 in = fget_light(fd_in, &fput_in);
765 if (in) { 1026 if (in) {
766 if (in->f_mode & FMODE_READ) { 1027 if (in->f_mode & FMODE_READ) {
767 out = fget_light(fdout, &fput_out); 1028 out = fget_light(fd_out, &fput_out);
768 if (out) { 1029 if (out) {
769 if (out->f_mode & FMODE_WRITE) 1030 if (out->f_mode & FMODE_WRITE)
770 error = do_splice(in, out, len, flags); 1031 error = do_splice(in, off_in,
1032 out, off_out,
1033 len, flags);
771 fput_light(out, fput_out); 1034 fput_light(out, fput_out);
772 } 1035 }
773 } 1036 }
@@ -777,3 +1040,192 @@ asmlinkage long sys_splice(int fdin, int fdout, size_t len, unsigned int flags)
777 1040
778 return error; 1041 return error;
779} 1042}
1043
1044/*
1045 * Link contents of ipipe to opipe.
1046 */
1047static int link_pipe(struct pipe_inode_info *ipipe,
1048 struct pipe_inode_info *opipe,
1049 size_t len, unsigned int flags)
1050{
1051 struct pipe_buffer *ibuf, *obuf;
1052 int ret, do_wakeup, i, ipipe_first;
1053
1054 ret = do_wakeup = ipipe_first = 0;
1055
1056 /*
1057 * Potential ABBA deadlock, work around it by ordering lock
1058 * grabbing by inode address. Otherwise two different processes
1059 * could deadlock (one doing tee from A -> B, the other from B -> A).
1060 */
1061 if (ipipe->inode < opipe->inode) {
1062 ipipe_first = 1;
1063 mutex_lock(&ipipe->inode->i_mutex);
1064 mutex_lock(&opipe->inode->i_mutex);
1065 } else {
1066 mutex_lock(&opipe->inode->i_mutex);
1067 mutex_lock(&ipipe->inode->i_mutex);
1068 }
1069
1070 for (i = 0;; i++) {
1071 if (!opipe->readers) {
1072 send_sig(SIGPIPE, current, 0);
1073 if (!ret)
1074 ret = -EPIPE;
1075 break;
1076 }
1077 if (ipipe->nrbufs - i) {
1078 ibuf = ipipe->bufs + ((ipipe->curbuf + i) & (PIPE_BUFFERS - 1));
1079
1080 /*
1081 * If we have room, fill this buffer
1082 */
1083 if (opipe->nrbufs < PIPE_BUFFERS) {
1084 int nbuf = (opipe->curbuf + opipe->nrbufs) & (PIPE_BUFFERS - 1);
1085
1086 /*
1087 * Get a reference to this pipe buffer,
1088 * so we can copy the contents over.
1089 */
1090 ibuf->ops->get(ipipe, ibuf);
1091
1092 obuf = opipe->bufs + nbuf;
1093 *obuf = *ibuf;
1094
1095 if (obuf->len > len)
1096 obuf->len = len;
1097
1098 opipe->nrbufs++;
1099 do_wakeup = 1;
1100 ret += obuf->len;
1101 len -= obuf->len;
1102
1103 if (!len)
1104 break;
1105 if (opipe->nrbufs < PIPE_BUFFERS)
1106 continue;
1107 }
1108
1109 /*
1110 * We have input available, but no output room.
1111 * If we already copied data, return that. If we
1112 * need to drop the opipe lock, it must be ordered
1113 * last to avoid deadlocks.
1114 */
1115 if ((flags & SPLICE_F_NONBLOCK) || !ipipe_first) {
1116 if (!ret)
1117 ret = -EAGAIN;
1118 break;
1119 }
1120 if (signal_pending(current)) {
1121 if (!ret)
1122 ret = -ERESTARTSYS;
1123 break;
1124 }
1125 if (do_wakeup) {
1126 smp_mb();
1127 if (waitqueue_active(&opipe->wait))
1128 wake_up_interruptible(&opipe->wait);
1129 kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN);
1130 do_wakeup = 0;
1131 }
1132
1133 opipe->waiting_writers++;
1134 pipe_wait(opipe);
1135 opipe->waiting_writers--;
1136 continue;
1137 }
1138
1139 /*
1140 * No input buffers, do the usual checks for available
1141 * writers and blocking and wait if necessary
1142 */
1143 if (!ipipe->writers)
1144 break;
1145 if (!ipipe->waiting_writers) {
1146 if (ret)
1147 break;
1148 }
1149 /*
1150 * pipe_wait() drops the ipipe mutex. To avoid deadlocks
1151 * with another process, we can only safely do that if
1152 * the ipipe lock is ordered last.
1153 */
1154 if ((flags & SPLICE_F_NONBLOCK) || ipipe_first) {
1155 if (!ret)
1156 ret = -EAGAIN;
1157 break;
1158 }
1159 if (signal_pending(current)) {
1160 if (!ret)
1161 ret = -ERESTARTSYS;
1162 break;
1163 }
1164
1165 if (waitqueue_active(&ipipe->wait))
1166 wake_up_interruptible_sync(&ipipe->wait);
1167 kill_fasync(&ipipe->fasync_writers, SIGIO, POLL_OUT);
1168
1169 pipe_wait(ipipe);
1170 }
1171
1172 mutex_unlock(&ipipe->inode->i_mutex);
1173 mutex_unlock(&opipe->inode->i_mutex);
1174
1175 if (do_wakeup) {
1176 smp_mb();
1177 if (waitqueue_active(&opipe->wait))
1178 wake_up_interruptible(&opipe->wait);
1179 kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN);
1180 }
1181
1182 return ret;
1183}
1184
1185/*
1186 * This is a tee(1) implementation that works on pipes. It doesn't copy
1187 * any data, it simply references the 'in' pages on the 'out' pipe.
1188 * The 'flags' used are the SPLICE_F_* variants, currently the only
1189 * applicable one is SPLICE_F_NONBLOCK.
1190 */
1191static long do_tee(struct file *in, struct file *out, size_t len,
1192 unsigned int flags)
1193{
1194 struct pipe_inode_info *ipipe = in->f_dentry->d_inode->i_pipe;
1195 struct pipe_inode_info *opipe = out->f_dentry->d_inode->i_pipe;
1196
1197 /*
1198 * Link ipipe to the two output pipes, consuming as we go along.
1199 */
1200 if (ipipe && opipe)
1201 return link_pipe(ipipe, opipe, len, flags);
1202
1203 return -EINVAL;
1204}
1205
1206asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags)
1207{
1208 struct file *in;
1209 int error, fput_in;
1210
1211 if (unlikely(!len))
1212 return 0;
1213
1214 error = -EBADF;
1215 in = fget_light(fdin, &fput_in);
1216 if (in) {
1217 if (in->f_mode & FMODE_READ) {
1218 int fput_out;
1219 struct file *out = fget_light(fdout, &fput_out);
1220
1221 if (out) {
1222 if (out->f_mode & FMODE_WRITE)
1223 error = do_tee(in, out, len, flags);
1224 fput_light(out, fput_out);
1225 }
1226 }
1227 fput_light(in, fput_in);
1228 }
1229
1230 return error;
1231}
diff --git a/fs/sync.c b/fs/sync.c
index 8616006d2094..aab5ffe77e9f 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -61,7 +61,7 @@
61 * will be available after a crash. 61 * will be available after a crash.
62 */ 62 */
63asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 63asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
64 int flags) 64 unsigned int flags)
65{ 65{
66 int ret; 66 int ret;
67 struct file *file; 67 struct file *file;
@@ -126,7 +126,7 @@ out:
126 * `endbyte' is inclusive 126 * `endbyte' is inclusive
127 */ 127 */
128int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, 128int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
129 int flags) 129 unsigned int flags)
130{ 130{
131 int ret; 131 int ret;
132 struct address_space *mapping; 132 struct address_space *mapping;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 6cfdc9a87772..610b5bdbe75b 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -43,6 +43,7 @@ static struct sysfs_dirent * sysfs_new_dirent(struct sysfs_dirent * parent_sd,
43 43
44 memset(sd, 0, sizeof(*sd)); 44 memset(sd, 0, sizeof(*sd));
45 atomic_set(&sd->s_count, 1); 45 atomic_set(&sd->s_count, 1);
46 atomic_set(&sd->s_event, 0);
46 INIT_LIST_HEAD(&sd->s_children); 47 INIT_LIST_HEAD(&sd->s_children);
47 list_add(&sd->s_sibling, &parent_sd->s_children); 48 list_add(&sd->s_sibling, &parent_sd->s_children);
48 sd->s_element = element; 49 sd->s_element = element;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index f1cb1ddde511..cf3786625bfa 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -6,6 +6,7 @@
6#include <linux/fsnotify.h> 6#include <linux/fsnotify.h>
7#include <linux/kobject.h> 7#include <linux/kobject.h>
8#include <linux/namei.h> 8#include <linux/namei.h>
9#include <linux/poll.h>
9#include <asm/uaccess.h> 10#include <asm/uaccess.h>
10#include <asm/semaphore.h> 11#include <asm/semaphore.h>
11 12
@@ -57,6 +58,7 @@ struct sysfs_buffer {
57 struct sysfs_ops * ops; 58 struct sysfs_ops * ops;
58 struct semaphore sem; 59 struct semaphore sem;
59 int needs_read_fill; 60 int needs_read_fill;
61 int event;
60}; 62};
61 63
62 64
@@ -72,6 +74,7 @@ struct sysfs_buffer {
72 */ 74 */
73static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) 75static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer)
74{ 76{
77 struct sysfs_dirent * sd = dentry->d_fsdata;
75 struct attribute * attr = to_attr(dentry); 78 struct attribute * attr = to_attr(dentry);
76 struct kobject * kobj = to_kobj(dentry->d_parent); 79 struct kobject * kobj = to_kobj(dentry->d_parent);
77 struct sysfs_ops * ops = buffer->ops; 80 struct sysfs_ops * ops = buffer->ops;
@@ -83,6 +86,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
83 if (!buffer->page) 86 if (!buffer->page)
84 return -ENOMEM; 87 return -ENOMEM;
85 88
89 buffer->event = atomic_read(&sd->s_event);
86 count = ops->show(kobj,attr,buffer->page); 90 count = ops->show(kobj,attr,buffer->page);
87 buffer->needs_read_fill = 0; 91 buffer->needs_read_fill = 0;
88 BUG_ON(count > (ssize_t)PAGE_SIZE); 92 BUG_ON(count > (ssize_t)PAGE_SIZE);
@@ -348,12 +352,84 @@ static int sysfs_release(struct inode * inode, struct file * filp)
348 return 0; 352 return 0;
349} 353}
350 354
355/* Sysfs attribute files are pollable. The idea is that you read
356 * the content and then you use 'poll' or 'select' to wait for
357 * the content to change. When the content changes (assuming the
358 * manager for the kobject supports notification), poll will
359 * return POLLERR|POLLPRI, and select will return the fd whether
360 * it is waiting for read, write, or exceptions.
361 * Once poll/select indicates that the value has changed, you
362 * need to close and re-open the file, as simply seeking and reading
363 * again will not get new data, or reset the state of 'poll'.
364 * Reminder: this only works for attributes which actively support
365 * it, and it is not possible to test an attribute from userspace
366 * to see if it supports poll (Nether 'poll' or 'select' return
367 * an appropriate error code). When in doubt, set a suitable timeout value.
368 */
369static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
370{
371 struct sysfs_buffer * buffer = filp->private_data;
372 struct kobject * kobj = to_kobj(filp->f_dentry->d_parent);
373 struct sysfs_dirent * sd = filp->f_dentry->d_fsdata;
374 int res = 0;
375
376 poll_wait(filp, &kobj->poll, wait);
377
378 if (buffer->event != atomic_read(&sd->s_event)) {
379 res = POLLERR|POLLPRI;
380 buffer->needs_read_fill = 1;
381 }
382
383 return res;
384}
385
386
387static struct dentry *step_down(struct dentry *dir, const char * name)
388{
389 struct dentry * de;
390
391 if (dir == NULL || dir->d_inode == NULL)
392 return NULL;
393
394 mutex_lock(&dir->d_inode->i_mutex);
395 de = lookup_one_len(name, dir, strlen(name));
396 mutex_unlock(&dir->d_inode->i_mutex);
397 dput(dir);
398 if (IS_ERR(de))
399 return NULL;
400 if (de->d_inode == NULL) {
401 dput(de);
402 return NULL;
403 }
404 return de;
405}
406
407void sysfs_notify(struct kobject * k, char *dir, char *attr)
408{
409 struct dentry *de = k->dentry;
410 if (de)
411 dget(de);
412 if (de && dir)
413 de = step_down(de, dir);
414 if (de && attr)
415 de = step_down(de, attr);
416 if (de) {
417 struct sysfs_dirent * sd = de->d_fsdata;
418 if (sd)
419 atomic_inc(&sd->s_event);
420 wake_up_interruptible(&k->poll);
421 dput(de);
422 }
423}
424EXPORT_SYMBOL_GPL(sysfs_notify);
425
351const struct file_operations sysfs_file_operations = { 426const struct file_operations sysfs_file_operations = {
352 .read = sysfs_read_file, 427 .read = sysfs_read_file,
353 .write = sysfs_write_file, 428 .write = sysfs_write_file,
354 .llseek = generic_file_llseek, 429 .llseek = generic_file_llseek,
355 .open = sysfs_open_file, 430 .open = sysfs_open_file,
356 .release = sysfs_release, 431 .release = sysfs_release,
432 .poll = sysfs_poll,
357}; 433};
358 434
359 435
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 32958a7c50e9..3651ffb5ec09 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -11,6 +11,7 @@ extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *,
11 11
12extern int sysfs_add_file(struct dentry *, const struct attribute *, int); 12extern int sysfs_add_file(struct dentry *, const struct attribute *, int);
13extern void sysfs_hash_and_remove(struct dentry * dir, const char * name); 13extern void sysfs_hash_and_remove(struct dentry * dir, const char * name);
14extern struct sysfs_dirent *sysfs_find(struct sysfs_dirent *dir, const char * name);
14 15
15extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **); 16extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **);
16extern void sysfs_remove_subdir(struct dentry *); 17extern void sysfs_remove_subdir(struct dentry *);
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 6cbbd165c60d..4d191ef39b67 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -870,12 +870,14 @@ xfs_page_state_convert(
870 pgoff_t end_index, last_index, tlast; 870 pgoff_t end_index, last_index, tlast;
871 ssize_t size, len; 871 ssize_t size, len;
872 int flags, err, iomap_valid = 0, uptodate = 1; 872 int flags, err, iomap_valid = 0, uptodate = 1;
873 int page_dirty, count = 0, trylock_flag = 0; 873 int page_dirty, count = 0;
874 int trylock = 0;
874 int all_bh = unmapped; 875 int all_bh = unmapped;
875 876
876 /* wait for other IO threads? */ 877 if (startio) {
877 if (startio && (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)) 878 if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
878 trylock_flag |= BMAPI_TRYLOCK; 879 trylock |= BMAPI_TRYLOCK;
880 }
879 881
880 /* Is this page beyond the end of the file? */ 882 /* Is this page beyond the end of the file? */
881 offset = i_size_read(inode); 883 offset = i_size_read(inode);
@@ -956,15 +958,13 @@ xfs_page_state_convert(
956 958
957 if (buffer_unwritten(bh)) { 959 if (buffer_unwritten(bh)) {
958 type = IOMAP_UNWRITTEN; 960 type = IOMAP_UNWRITTEN;
959 flags = BMAPI_WRITE|BMAPI_IGNSTATE; 961 flags = BMAPI_WRITE | BMAPI_IGNSTATE;
960 } else if (buffer_delay(bh)) { 962 } else if (buffer_delay(bh)) {
961 type = IOMAP_DELAY; 963 type = IOMAP_DELAY;
962 flags = BMAPI_ALLOCATE; 964 flags = BMAPI_ALLOCATE | trylock;
963 if (!startio)
964 flags |= trylock_flag;
965 } else { 965 } else {
966 type = IOMAP_NEW; 966 type = IOMAP_NEW;
967 flags = BMAPI_WRITE|BMAPI_MMAP; 967 flags = BMAPI_WRITE | BMAPI_MMAP;
968 } 968 }
969 969
970 if (!iomap_valid) { 970 if (!iomap_valid) {
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 9fb0312665ca..26fed0756f01 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -182,7 +182,7 @@ free_address(
182{ 182{
183 a_list_t *aentry; 183 a_list_t *aentry;
184 184
185 aentry = kmalloc(sizeof(a_list_t), GFP_ATOMIC & ~__GFP_HIGH); 185 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
186 if (likely(aentry)) { 186 if (likely(aentry)) {
187 spin_lock(&as_lock); 187 spin_lock(&as_lock);
188 aentry->next = as_free_head; 188 aentry->next = as_free_head;
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index ae4c4754ed31..c847416f6d10 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -252,56 +252,60 @@ xfs_file_sendfile_invis(
252STATIC ssize_t 252STATIC ssize_t
253xfs_file_splice_read( 253xfs_file_splice_read(
254 struct file *infilp, 254 struct file *infilp,
255 struct inode *pipe, 255 loff_t *ppos,
256 struct pipe_inode_info *pipe,
256 size_t len, 257 size_t len,
257 unsigned int flags) 258 unsigned int flags)
258{ 259{
259 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); 260 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
260 ssize_t rval; 261 ssize_t rval;
261 262
262 VOP_SPLICE_READ(vp, infilp, pipe, len, flags, 0, NULL, rval); 263 VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval);
263 return rval; 264 return rval;
264} 265}
265 266
266STATIC ssize_t 267STATIC ssize_t
267xfs_file_splice_read_invis( 268xfs_file_splice_read_invis(
268 struct file *infilp, 269 struct file *infilp,
269 struct inode *pipe, 270 loff_t *ppos,
271 struct pipe_inode_info *pipe,
270 size_t len, 272 size_t len,
271 unsigned int flags) 273 unsigned int flags)
272{ 274{
273 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); 275 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
274 ssize_t rval; 276 ssize_t rval;
275 277
276 VOP_SPLICE_READ(vp, infilp, pipe, len, flags, IO_INVIS, NULL, rval); 278 VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval);
277 return rval; 279 return rval;
278} 280}
279 281
280STATIC ssize_t 282STATIC ssize_t
281xfs_file_splice_write( 283xfs_file_splice_write(
282 struct inode *pipe, 284 struct pipe_inode_info *pipe,
283 struct file *outfilp, 285 struct file *outfilp,
286 loff_t *ppos,
284 size_t len, 287 size_t len,
285 unsigned int flags) 288 unsigned int flags)
286{ 289{
287 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); 290 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
288 ssize_t rval; 291 ssize_t rval;
289 292
290 VOP_SPLICE_WRITE(vp, pipe, outfilp, len, flags, 0, NULL, rval); 293 VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval);
291 return rval; 294 return rval;
292} 295}
293 296
294STATIC ssize_t 297STATIC ssize_t
295xfs_file_splice_write_invis( 298xfs_file_splice_write_invis(
296 struct inode *pipe, 299 struct pipe_inode_info *pipe,
297 struct file *outfilp, 300 struct file *outfilp,
301 loff_t *ppos,
298 size_t len, 302 size_t len,
299 unsigned int flags) 303 unsigned int flags)
300{ 304{
301 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); 305 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
302 ssize_t rval; 306 ssize_t rval;
303 307
304 VOP_SPLICE_WRITE(vp, pipe, outfilp, len, flags, IO_INVIS, NULL, rval); 308 VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval);
305 return rval; 309 return rval;
306} 310}
307 311
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 149237304fb6..2e2e275c786f 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -673,8 +673,7 @@ xfs_vn_setattr(
673 if (ia_valid & ATTR_ATIME) { 673 if (ia_valid & ATTR_ATIME) {
674 vattr.va_mask |= XFS_AT_ATIME; 674 vattr.va_mask |= XFS_AT_ATIME;
675 vattr.va_atime = attr->ia_atime; 675 vattr.va_atime = attr->ia_atime;
676 if (ia_valid & ATTR_ATIME_SET) 676 inode->i_atime = attr->ia_atime;
677 inode->i_atime = attr->ia_atime;
678 } 677 }
679 if (ia_valid & ATTR_MTIME) { 678 if (ia_valid & ATTR_MTIME) {
680 vattr.va_mask |= XFS_AT_MTIME; 679 vattr.va_mask |= XFS_AT_MTIME;
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 90cd314acbaa..67efe3308980 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -338,7 +338,8 @@ ssize_t
338xfs_splice_read( 338xfs_splice_read(
339 bhv_desc_t *bdp, 339 bhv_desc_t *bdp,
340 struct file *infilp, 340 struct file *infilp,
341 struct inode *pipe, 341 loff_t *ppos,
342 struct pipe_inode_info *pipe,
342 size_t count, 343 size_t count,
343 int flags, 344 int flags,
344 int ioflags, 345 int ioflags,
@@ -360,7 +361,7 @@ xfs_splice_read(
360 int error; 361 int error;
361 362
362 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), 363 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
363 infilp->f_pos, count, 364 *ppos, count,
364 FILP_DELAY_FLAG(infilp), &locktype); 365 FILP_DELAY_FLAG(infilp), &locktype);
365 if (error) { 366 if (error) {
366 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 367 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -368,8 +369,8 @@ xfs_splice_read(
368 } 369 }
369 } 370 }
370 xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, &ip->i_iocore, 371 xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, &ip->i_iocore,
371 pipe, count, infilp->f_pos, ioflags); 372 pipe, count, *ppos, ioflags);
372 ret = generic_file_splice_read(infilp, pipe, count, flags); 373 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
373 if (ret > 0) 374 if (ret > 0)
374 XFS_STATS_ADD(xs_read_bytes, ret); 375 XFS_STATS_ADD(xs_read_bytes, ret);
375 376
@@ -380,8 +381,9 @@ xfs_splice_read(
380ssize_t 381ssize_t
381xfs_splice_write( 382xfs_splice_write(
382 bhv_desc_t *bdp, 383 bhv_desc_t *bdp,
383 struct inode *pipe, 384 struct pipe_inode_info *pipe,
384 struct file *outfilp, 385 struct file *outfilp,
386 loff_t *ppos,
385 size_t count, 387 size_t count,
386 int flags, 388 int flags,
387 int ioflags, 389 int ioflags,
@@ -403,7 +405,7 @@ xfs_splice_write(
403 int error; 405 int error;
404 406
405 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp), 407 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp),
406 outfilp->f_pos, count, 408 *ppos, count,
407 FILP_DELAY_FLAG(outfilp), &locktype); 409 FILP_DELAY_FLAG(outfilp), &locktype);
408 if (error) { 410 if (error) {
409 xfs_iunlock(ip, XFS_IOLOCK_EXCL); 411 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -411,8 +413,8 @@ xfs_splice_write(
411 } 413 }
412 } 414 }
413 xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, &ip->i_iocore, 415 xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, &ip->i_iocore,
414 pipe, count, outfilp->f_pos, ioflags); 416 pipe, count, *ppos, ioflags);
415 ret = generic_file_splice_write(pipe, outfilp, count, flags); 417 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags);
416 if (ret > 0) 418 if (ret > 0)
417 XFS_STATS_ADD(xs_write_bytes, ret); 419 XFS_STATS_ADD(xs_write_bytes, ret);
418 420
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index eaa5659713fb..8f4539952350 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -93,11 +93,11 @@ extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
93extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *, 93extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
94 loff_t *, int, size_t, read_actor_t, 94 loff_t *, int, size_t, read_actor_t,
95 void *, struct cred *); 95 void *, struct cred *);
96extern ssize_t xfs_splice_read(struct bhv_desc *, struct file *, 96extern ssize_t xfs_splice_read(struct bhv_desc *, struct file *, loff_t *,
97 struct inode *, size_t, int, int, 97 struct pipe_inode_info *, size_t, int, int,
98 struct cred *); 98 struct cred *);
99extern ssize_t xfs_splice_write(struct bhv_desc *, struct inode *, 99extern ssize_t xfs_splice_write(struct bhv_desc *, struct pipe_inode_info *,
100 struct file *, size_t, int, int, 100 struct file *, loff_t *, size_t, int, int,
101 struct cred *); 101 struct cred *);
102 102
103#endif /* __XFS_LRW_H__ */ 103#endif /* __XFS_LRW_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 6f1c79a28f8b..2a8e16c22353 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -173,11 +173,11 @@ typedef ssize_t (*vop_write_t)(bhv_desc_t *, struct kiocb *,
173typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *, 173typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *,
174 loff_t *, int, size_t, read_actor_t, 174 loff_t *, int, size_t, read_actor_t,
175 void *, struct cred *); 175 void *, struct cred *);
176typedef ssize_t (*vop_splice_read_t)(bhv_desc_t *, struct file *, 176typedef ssize_t (*vop_splice_read_t)(bhv_desc_t *, struct file *, loff_t *,
177 struct inode *, size_t, int, int, 177 struct pipe_inode_info *, size_t, int, int,
178 struct cred *); 178 struct cred *);
179typedef ssize_t (*vop_splice_write_t)(bhv_desc_t *, struct inode *, 179typedef ssize_t (*vop_splice_write_t)(bhv_desc_t *, struct pipe_inode_info *,
180 struct file *, size_t, int, int, 180 struct file *, loff_t *, size_t, int, int,
181 struct cred *); 181 struct cred *);
182typedef int (*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *, 182typedef int (*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *,
183 int, unsigned int, void __user *); 183 int, unsigned int, void __user *);
@@ -284,10 +284,10 @@ typedef struct vnodeops {
284 rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr) 284 rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr)
285#define VOP_SENDFILE(vp,f,off,ioflags,cnt,act,targ,cr,rv) \ 285#define VOP_SENDFILE(vp,f,off,ioflags,cnt,act,targ,cr,rv) \
286 rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,off,ioflags,cnt,act,targ,cr) 286 rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,off,ioflags,cnt,act,targ,cr)
287#define VOP_SPLICE_READ(vp,f,pipe,cnt,fl,iofl,cr,rv) \ 287#define VOP_SPLICE_READ(vp,f,o,pipe,cnt,fl,iofl,cr,rv) \
288 rv = _VOP_(vop_splice_read, vp)((vp)->v_fbhv,f,pipe,cnt,fl,iofl,cr) 288 rv = _VOP_(vop_splice_read, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr)
289#define VOP_SPLICE_WRITE(vp,f,pipe,cnt,fl,iofl,cr,rv) \ 289#define VOP_SPLICE_WRITE(vp,f,o,pipe,cnt,fl,iofl,cr,rv) \
290 rv = _VOP_(vop_splice_write, vp)((vp)->v_fbhv,f,pipe,cnt,fl,iofl,cr) 290 rv = _VOP_(vop_splice_write, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr)
291#define VOP_BMAP(vp,of,sz,rw,b,n,rv) \ 291#define VOP_BMAP(vp,of,sz,rw,b,n,rv) \
292 rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n) 292 rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n)
293#define VOP_OPEN(vp, cr, rv) \ 293#define VOP_OPEN(vp, cr, rv) \
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 4eeb856183b1..deddbd03c166 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -158,9 +158,10 @@ xfs_ialloc_ag_alloc(
158 */ 158 */
159 agi = XFS_BUF_TO_AGI(agbp); 159 agi = XFS_BUF_TO_AGI(agbp);
160 newino = be32_to_cpu(agi->agi_newino); 160 newino = be32_to_cpu(agi->agi_newino);
161 if(likely(newino != NULLAGINO)) { 161 args.agbno = XFS_AGINO_TO_AGBNO(args.mp, newino) +
162 args.agbno = XFS_AGINO_TO_AGBNO(args.mp, newino) + 162 XFS_IALLOC_BLOCKS(args.mp);
163 XFS_IALLOC_BLOCKS(args.mp); 163 if (likely(newino != NULLAGINO &&
164 (args.agbno < be32_to_cpu(agi->agi_length)))) {
164 args.fsbno = XFS_AGB_TO_FSB(args.mp, 165 args.fsbno = XFS_AGB_TO_FSB(args.mp,
165 be32_to_cpu(agi->agi_seqno), args.agbno); 166 be32_to_cpu(agi->agi_seqno), args.agbno);
166 args.type = XFS_ALLOCTYPE_THIS_BNO; 167 args.type = XFS_ALLOCTYPE_THIS_BNO;
@@ -182,8 +183,8 @@ xfs_ialloc_ag_alloc(
182 * Set the alignment for the allocation. 183 * Set the alignment for the allocation.
183 * If stripe alignment is turned on then align at stripe unit 184 * If stripe alignment is turned on then align at stripe unit
184 * boundary. 185 * boundary.
185 * If the cluster size is smaller than a filesystem block 186 * If the cluster size is smaller than a filesystem block
186 * then we're doing I/O for inodes in filesystem block size 187 * then we're doing I/O for inodes in filesystem block size
187 * pieces, so don't need alignment anyway. 188 * pieces, so don't need alignment anyway.
188 */ 189 */
189 isaligned = 0; 190 isaligned = 0;
@@ -192,7 +193,7 @@ xfs_ialloc_ag_alloc(
192 args.alignment = args.mp->m_dalign; 193 args.alignment = args.mp->m_dalign;
193 isaligned = 1; 194 isaligned = 1;
194 } else if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) && 195 } else if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) &&
195 args.mp->m_sb.sb_inoalignmt >= 196 args.mp->m_sb.sb_inoalignmt >=
196 XFS_B_TO_FSBT(args.mp, 197 XFS_B_TO_FSBT(args.mp,
197 XFS_INODE_CLUSTER_SIZE(args.mp))) 198 XFS_INODE_CLUSTER_SIZE(args.mp)))
198 args.alignment = args.mp->m_sb.sb_inoalignmt; 199 args.alignment = args.mp->m_sb.sb_inoalignmt;
@@ -220,7 +221,7 @@ xfs_ialloc_ag_alloc(
220 if ((error = xfs_alloc_vextent(&args))) 221 if ((error = xfs_alloc_vextent(&args)))
221 return error; 222 return error;
222 } 223 }
223 224
224 /* 225 /*
225 * If stripe alignment is turned on, then try again with cluster 226 * If stripe alignment is turned on, then try again with cluster
226 * alignment. 227 * alignment.
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index bb33113eef9f..b53854325266 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -421,7 +421,10 @@ finish_inode:
421 ip->i_chash = chlnew; 421 ip->i_chash = chlnew;
422 chlnew->chl_ip = ip; 422 chlnew->chl_ip = ip;
423 chlnew->chl_blkno = ip->i_blkno; 423 chlnew->chl_blkno = ip->i_blkno;
424 if (ch->ch_list)
425 ch->ch_list->chl_prev = chlnew;
424 chlnew->chl_next = ch->ch_list; 426 chlnew->chl_next = ch->ch_list;
427 chlnew->chl_prev = NULL;
425 ch->ch_list = chlnew; 428 ch->ch_list = chlnew;
426 chlnew = NULL; 429 chlnew = NULL;
427 } 430 }
@@ -723,23 +726,15 @@ xfs_iextract(
723 ASSERT(ip->i_cnext == ip && ip->i_cprev == ip); 726 ASSERT(ip->i_cnext == ip && ip->i_cprev == ip);
724 ASSERT(ip->i_chash != NULL); 727 ASSERT(ip->i_chash != NULL);
725 chm=NULL; 728 chm=NULL;
726 for (chl = ch->ch_list; chl != NULL; chl = chl->chl_next) { 729 chl = ip->i_chash;
727 if (chl->chl_blkno == ip->i_blkno) { 730 if (chl->chl_prev)
728 if (chm == NULL) { 731 chl->chl_prev->chl_next = chl->chl_next;
729 /* first item on the list */ 732 else
730 ch->ch_list = chl->chl_next; 733 ch->ch_list = chl->chl_next;
731 } else { 734 if (chl->chl_next)
732 chm->chl_next = chl->chl_next; 735 chl->chl_next->chl_prev = chl->chl_prev;
733 } 736 kmem_zone_free(xfs_chashlist_zone, chl);
734 kmem_zone_free(xfs_chashlist_zone, chl); 737 } else {
735 break;
736 } else {
737 ASSERT(chl->chl_ip != ip);
738 chm = chl;
739 }
740 }
741 ASSERT_ALWAYS(chl != NULL);
742 } else {
743 /* delete one inode from a non-empty list */ 738 /* delete one inode from a non-empty list */
744 iq = ip->i_cnext; 739 iq = ip->i_cnext;
745 iq->i_cprev = ip->i_cprev; 740 iq->i_cprev = ip->i_cprev;
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 48146bdc6bdd..94b60dd03801 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2732,16 +2732,29 @@ xfs_iunpin(
2732 ASSERT(atomic_read(&ip->i_pincount) > 0); 2732 ASSERT(atomic_read(&ip->i_pincount) > 0);
2733 2733
2734 if (atomic_dec_and_test(&ip->i_pincount)) { 2734 if (atomic_dec_and_test(&ip->i_pincount)) {
2735 vnode_t *vp = XFS_ITOV_NULL(ip); 2735 /*
2736 * If the inode is currently being reclaimed, the
2737 * linux inode _and_ the xfs vnode may have been
2738 * freed so we cannot reference either of them safely.
2739 * Hence we should not try to do anything to them
2740 * if the xfs inode is currently in the reclaim
2741 * path.
2742 *
2743 * However, we still need to issue the unpin wakeup
2744 * call as the inode reclaim may be blocked waiting for
2745 * the inode to become unpinned.
2746 */
2747 if (!(ip->i_flags & (XFS_IRECLAIM|XFS_IRECLAIMABLE))) {
2748 vnode_t *vp = XFS_ITOV_NULL(ip);
2736 2749
2737 /* make sync come back and flush this inode */ 2750 /* make sync come back and flush this inode */
2738 if (vp) { 2751 if (vp) {
2739 struct inode *inode = vn_to_inode(vp); 2752 struct inode *inode = vn_to_inode(vp);
2740 2753
2741 if (!(inode->i_state & I_NEW)) 2754 if (!(inode->i_state & I_NEW))
2742 mark_inode_dirty_sync(inode); 2755 mark_inode_dirty_sync(inode);
2756 }
2743 } 2757 }
2744
2745 wake_up(&ip->i_ipin_wait); 2758 wake_up(&ip->i_ipin_wait);
2746 } 2759 }
2747} 2760}
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 39ef9c36ea55..3b544db1790b 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -189,6 +189,7 @@ typedef struct xfs_ihash {
189 */ 189 */
190typedef struct xfs_chashlist { 190typedef struct xfs_chashlist {
191 struct xfs_chashlist *chl_next; 191 struct xfs_chashlist *chl_next;
192 struct xfs_chashlist *chl_prev;
192 struct xfs_inode *chl_ip; 193 struct xfs_inode *chl_ip;
193 xfs_daddr_t chl_blkno; /* starting block number of 194 xfs_daddr_t chl_blkno; /* starting block number of
194 * the cluster */ 195 * the cluster */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 049fabb7f7e0..c0b1c2906880 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -270,7 +270,7 @@ xfs_mount_validate_sb(
270 (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) || 270 (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) ||
271 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || 271 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) ||
272 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || 272 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) ||
273 (sbp->sb_imax_pct > 100 || sbp->sb_imax_pct < 1))) { 273 (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) {
274 xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed"); 274 xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed");
275 return XFS_ERROR(EFSCORRUPTED); 275 return XFS_ERROR(EFSCORRUPTED);
276 } 276 }
diff --git a/include/asm-alpha/numnodes.h b/include/asm-alpha/numnodes.h
deleted file mode 100644
index cd425827e4f3..000000000000
--- a/include/asm-alpha/numnodes.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 128 Nodes - Marvel */
5#define NODES_SHIFT 7
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-arm/arch-cl7500/hardware.h b/include/asm-arm/arch-cl7500/hardware.h
index 2339b764f69f..1adfd18e6154 100644
--- a/include/asm-arm/arch-cl7500/hardware.h
+++ b/include/asm-arm/arch-cl7500/hardware.h
@@ -53,16 +53,12 @@
53#define SCREEN_END 0xdfc00000 53#define SCREEN_END 0xdfc00000
54#define SCREEN_BASE 0xdf800000 54#define SCREEN_BASE 0xdf800000
55 55
56#define FLUSH_BASE 0xdf000000
57
58#define VIDC_BASE (void __iomem *)0xe0400000 56#define VIDC_BASE (void __iomem *)0xe0400000
59#define IOMD_BASE IOMEM(0xe0200000) 57#define IOMD_BASE IOMEM(0xe0200000)
60#define IOC_BASE IOMEM(0xe0200000) 58#define IOC_BASE IOMEM(0xe0200000)
61#define FLOPPYDMA_BASE IOMEM(0xe002a000) 59#define FLOPPYDMA_BASE IOMEM(0xe002a000)
62#define PCIO_BASE IOMEM(0xe0010000) 60#define PCIO_BASE IOMEM(0xe0010000)
63 61
64#define FLUSH_BASE_PHYS 0x00000000 /* ROM */
65
66#define vidc_writel(val) __raw_writel(val, VIDC_BASE) 62#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
67 63
68/* in/out bias for the ISA slot region */ 64/* in/out bias for the ISA slot region */
diff --git a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h
index 34f40a6cec30..3178140e24ca 100644
--- a/include/asm-arm/arch-cl7500/memory.h
+++ b/include/asm-arm/arch-cl7500/memory.h
@@ -26,4 +26,10 @@
26#define __virt_to_bus(x) __virt_to_phys(x) 26#define __virt_to_bus(x) __virt_to_phys(x)
27#define __bus_to_virt(x) __phys_to_virt(x) 27#define __bus_to_virt(x) __phys_to_virt(x)
28 28
29/*
30 * Cache flushing area - ROM
31 */
32#define FLUSH_BASE_PHYS 0x00000000
33#define FLUSH_BASE 0xdf000000
34
29#endif 35#endif
diff --git a/include/asm-arm/arch-ebsa110/debug-macro.S b/include/asm-arm/arch-ebsa110/debug-macro.S
index f61cadabe0ec..9213bfe4831d 100644
--- a/include/asm-arm/arch-ebsa110/debug-macro.S
+++ b/include/asm-arm/arch-ebsa110/debug-macro.S
@@ -18,4 +18,4 @@
18 18
19#define UART_SHIFT 2 19#define UART_SHIFT 2
20#define FLOW_CONTROL 20#define FLOW_CONTROL
21#include <asm/hardware/debug-8250.h> 21#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h
index 4e41c2358f4e..3ce864def41e 100644
--- a/include/asm-arm/arch-ebsa110/hardware.h
+++ b/include/asm-arm/arch-ebsa110/hardware.h
@@ -57,9 +57,6 @@
57/* 57/*
58 * RAM definitions 58 * RAM definitions
59 */ 59 */
60#define FLUSH_BASE_PHYS 0x40000000
61#define FLUSH_BASE 0xdf000000
62
63#define UNCACHEABLE_ADDR 0xff000000 /* IRQ_STAT */ 60#define UNCACHEABLE_ADDR 0xff000000 /* IRQ_STAT */
64 61
65#endif 62#endif
diff --git a/include/asm-arm/arch-ebsa110/memory.h b/include/asm-arm/arch-ebsa110/memory.h
index 02f144520c10..c7c500e176d0 100644
--- a/include/asm-arm/arch-ebsa110/memory.h
+++ b/include/asm-arm/arch-ebsa110/memory.h
@@ -28,4 +28,10 @@
28#define __virt_to_bus(x) (x) 28#define __virt_to_bus(x) (x)
29#define __bus_to_virt(x) (x) 29#define __bus_to_virt(x) (x)
30 30
31/*
32 * Cache flushing area - SRAM
33 */
34#define FLUSH_BASE_PHYS 0x40000000
35#define FLUSH_BASE 0xdf000000
36
31#endif 37#endif
diff --git a/include/asm-arm/arch-ebsa110/uncompress.h b/include/asm-arm/arch-ebsa110/uncompress.h
index 66b19c7fd908..ae5b775eb0b7 100644
--- a/include/asm-arm/arch-ebsa110/uncompress.h
+++ b/include/asm-arm/arch-ebsa110/uncompress.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/serial_reg.h> 11#include <linux/serial_reg.h>
12 12
13#define SERIAL_BASE ((unsigned char *)0xfe000be0) 13#define SERIAL_BASE ((unsigned char *)0xf0000be0)
14 14
15/* 15/*
16 * This does not append a newline 16 * This does not append a newline
diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h
index 2ef2200f108c..ec51fe92483b 100644
--- a/include/asm-arm/arch-ebsa285/hardware.h
+++ b/include/asm-arm/arch-ebsa285/hardware.h
@@ -48,9 +48,6 @@
48#define PCICFG0_SIZE 0x01000000 48#define PCICFG0_SIZE 0x01000000
49#define PCICFG0_BASE 0xfa000000 49#define PCICFG0_BASE 0xfa000000
50 50
51#define FLUSH_SIZE 0x00100000
52#define FLUSH_BASE 0xf9000000
53
54#define PCIMEM_SIZE 0x01000000 51#define PCIMEM_SIZE 0x01000000
55#define PCIMEM_BASE 0xf0000000 52#define PCIMEM_BASE 0xf0000000
56 53
@@ -61,9 +58,6 @@
61#define PCIMEM_SIZE 0x80000000 58#define PCIMEM_SIZE 0x80000000
62#define PCIMEM_BASE 0x80000000 59#define PCIMEM_BASE 0x80000000
63 60
64#define FLUSH_SIZE 0x00100000
65#define FLUSH_BASE 0x7e000000
66
67#define WFLUSH_SIZE 0x01000000 61#define WFLUSH_SIZE 0x01000000
68#define WFLUSH_BASE 0x7d000000 62#define WFLUSH_BASE 0x7d000000
69 63
@@ -94,7 +88,6 @@
94#define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) 88#define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5))
95#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) 89#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6))
96 90
97#define FLUSH_BASE_PHYS 0x50000000
98#define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108) 91#define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108)
99 92
100 93
diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h
index 09e335cd687d..99181ffc7e27 100644
--- a/include/asm-arm/arch-ebsa285/memory.h
+++ b/include/asm-arm/arch-ebsa285/memory.h
@@ -49,12 +49,22 @@ extern unsigned long __bus_to_virt(unsigned long);
49#define TASK_SIZE UL(0xbf000000) 49#define TASK_SIZE UL(0xbf000000)
50#define PAGE_OFFSET UL(0xc0000000) 50#define PAGE_OFFSET UL(0xc0000000)
51 51
52/*
53 * Cache flushing area.
54 */
55#define FLUSH_BASE 0xf9000000
56
52#elif defined(CONFIG_ARCH_CO285) 57#elif defined(CONFIG_ARCH_CO285)
53 58
54/* Task size and page offset at 1.5GB */ 59/* Task size and page offset at 1.5GB */
55#define TASK_SIZE UL(0x5f000000) 60#define TASK_SIZE UL(0x5f000000)
56#define PAGE_OFFSET UL(0x60000000) 61#define PAGE_OFFSET UL(0x60000000)
57 62
63/*
64 * Cache flushing area.
65 */
66#define FLUSH_BASE 0x7e000000
67
58#else 68#else
59 69
60#error "Undefined footbridge architecture" 70#error "Undefined footbridge architecture"
@@ -72,4 +82,6 @@ extern unsigned long __bus_to_virt(unsigned long);
72 */ 82 */
73#define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3) 83#define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
74 84
85#define FLUSH_BASE_PHYS 0x50000000
86
75#endif 87#endif
diff --git a/include/asm-arm/arch-ixp23xx/debug-macro.S b/include/asm-arm/arch-ixp23xx/debug-macro.S
index eb99fd69fd24..2b25e640247d 100644
--- a/include/asm-arm/arch-ixp23xx/debug-macro.S
+++ b/include/asm-arm/arch-ixp23xx/debug-macro.S
@@ -17,6 +17,9 @@
17 tst \rx, #1 @ mmu enabled? 17 tst \rx, #1 @ mmu enabled?
18 ldreq \rx, =IXP23XX_PERIPHERAL_PHYS @ physical 18 ldreq \rx, =IXP23XX_PERIPHERAL_PHYS @ physical
19 ldrne \rx, =IXP23XX_PERIPHERAL_VIRT @ virtual 19 ldrne \rx, =IXP23XX_PERIPHERAL_VIRT @ virtual
20#ifdef __ARMEB__
21 orr \rx, \rx, #0x00000003
22#endif
20 .endm 23 .endm
21 24
22#define UART_SHIFT 2 25#define UART_SHIFT 2
diff --git a/include/asm-arm/arch-l7200/hardware.h b/include/asm-arm/arch-l7200/hardware.h
index b755079befab..2ab43f3a4a8d 100644
--- a/include/asm-arm/arch-l7200/hardware.h
+++ b/include/asm-arm/arch-l7200/hardware.h
@@ -52,9 +52,6 @@
52#define ISA_SIZE 0x20000000 52#define ISA_SIZE 0x20000000
53#define ISA_BASE 0xe0000000 53#define ISA_BASE 0xe0000000
54 54
55#define FLUSH_BASE_PHYS 0x40000000 /* ROM */
56#define FLUSH_BASE 0xdf000000
57
58#define PCIO_BASE IO_BASE 55#define PCIO_BASE IO_BASE
59 56
60#endif 57#endif
diff --git a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h
index 9e50a171f78a..402df637e740 100644
--- a/include/asm-arm/arch-l7200/memory.h
+++ b/include/asm-arm/arch-l7200/memory.h
@@ -20,4 +20,10 @@
20#define __virt_to_bus(x) __virt_to_phys(x) 20#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x) 21#define __bus_to_virt(x) __phys_to_virt(x)
22 22
23/*
24 * Cache flushing area - ROM
25 */
26#define FLUSH_BASE_PHYS 0x40000000
27#define FLUSH_BASE 0xdf000000
28
23#endif 29#endif
diff --git a/include/asm-arm/arch-lh7a40x/memory.h b/include/asm-arm/arch-lh7a40x/memory.h
index c92bcb837629..9f1a58cbf407 100644
--- a/include/asm-arm/arch-lh7a40x/memory.h
+++ b/include/asm-arm/arch-lh7a40x/memory.h
@@ -31,8 +31,6 @@
31 31
32#ifdef CONFIG_DISCONTIGMEM 32#ifdef CONFIG_DISCONTIGMEM
33 33
34#define NODES_SHIFT 4 /* Up to 16 nodes */
35
36/* 34/*
37 * Given a kernel address, find the home node of the underlying memory. 35 * Given a kernel address, find the home node of the underlying memory.
38 */ 36 */
diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h
index 9d7f87375aa7..7480f4e8d974 100644
--- a/include/asm-arm/arch-rpc/hardware.h
+++ b/include/asm-arm/arch-rpc/hardware.h
@@ -46,7 +46,6 @@
46#define SCREEN_END 0xdfc00000 46#define SCREEN_END 0xdfc00000
47#define SCREEN_BASE 0xdf800000 47#define SCREEN_BASE 0xdf800000
48 48
49#define FLUSH_BASE 0xdf000000
50#define UNCACHEABLE_ADDR 0xdf010000 49#define UNCACHEABLE_ADDR 0xdf010000
51 50
52/* 51/*
@@ -59,8 +58,6 @@
59#define PCIO_BASE IOMEM(0xe0010000) 58#define PCIO_BASE IOMEM(0xe0010000)
60#define FLOPPYDMA_BASE IOMEM(0xe002a000) 59#define FLOPPYDMA_BASE IOMEM(0xe002a000)
61 60
62#define FLUSH_BASE_PHYS 0x00000000 /* ROM */
63
64#define vidc_writel(val) __raw_writel(val, VIDC_BASE) 61#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
65 62
66#define IO_EC_EASI_BASE 0x81400000 63#define IO_EC_EASI_BASE 0x81400000
diff --git a/include/asm-arm/arch-rpc/memory.h b/include/asm-arm/arch-rpc/memory.h
index 0592cb3f0c74..303c424ce673 100644
--- a/include/asm-arm/arch-rpc/memory.h
+++ b/include/asm-arm/arch-rpc/memory.h
@@ -30,4 +30,10 @@
30#define __virt_to_bus(x) __virt_to_phys(x) 30#define __virt_to_bus(x) __virt_to_phys(x)
31#define __bus_to_virt(x) __phys_to_virt(x) 31#define __bus_to_virt(x) __phys_to_virt(x)
32 32
33/*
34 * Cache flushing area - ROM
35 */
36#define FLUSH_BASE_PHYS 0x00000000
37#define FLUSH_BASE 0xdf000000
38
33#endif 39#endif
diff --git a/include/asm-arm/arch-s3c2410/leds-gpio.h b/include/asm-arm/arch-s3c2410/leds-gpio.h
new file mode 100644
index 000000000000..f07ed040622b
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/leds-gpio.h
@@ -0,0 +1,28 @@
1/* linux/include/asm-arm/arch-s3c2410/leds-gpio.h
2 *
3 * (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX - LEDs GPIO connector
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_LEDSGPIO_H
15#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h"
16
17#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
18#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
19
20struct s3c24xx_led_platdata {
21 unsigned int gpio;
22 unsigned int flags;
23
24 char *name;
25 char *def_trigger;
26};
27
28#endif /* __ASM_ARCH_LEDSGPIO_H */
diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h
index 28711aaa4968..ee008a5484f3 100644
--- a/include/asm-arm/arch-sa1100/hardware.h
+++ b/include/asm-arm/arch-sa1100/hardware.h
@@ -14,10 +14,6 @@
14 14
15#include <linux/config.h> 15#include <linux/config.h>
16 16
17/* Flushing areas */
18#define FLUSH_BASE_PHYS 0xe0000000 /* SA1100 zero bank */
19#define FLUSH_BASE 0xf5000000
20#define FLUSH_BASE_MINICACHE 0xf5800000
21#define UNCACHEABLE_ADDR 0xfa050000 17#define UNCACHEABLE_ADDR 0xfa050000
22 18
23 19
diff --git a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h
index 018a9f0e3986..a29fac1387ca 100644
--- a/include/asm-arm/arch-sa1100/memory.h
+++ b/include/asm-arm/arch-sa1100/memory.h
@@ -91,4 +91,11 @@ void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
91 91
92#endif 92#endif
93 93
94/*
95 * Cache flushing area - SA1100 zero bank
96 */
97#define FLUSH_BASE_PHYS 0xe0000000
98#define FLUSH_BASE 0xf5000000
99#define FLUSH_BASE_MINICACHE 0xf5100000
100
94#endif 101#endif
diff --git a/include/asm-arm/arch-shark/hardware.h b/include/asm-arm/arch-shark/hardware.h
index 4d35f8c154c3..ecba45260898 100644
--- a/include/asm-arm/arch-shark/hardware.h
+++ b/include/asm-arm/arch-shark/hardware.h
@@ -17,11 +17,6 @@
17 */ 17 */
18#define IO_BASE 0xe0000000 18#define IO_BASE 0xe0000000
19 19
20/*
21 * RAM definitions
22 */
23#define FLUSH_BASE_PHYS 0x80000000
24
25#else 20#else
26 21
27#define IO_BASE 0 22#define IO_BASE 0
@@ -33,7 +28,6 @@
33#define ROMCARD_SIZE 0x08000000 28#define ROMCARD_SIZE 0x08000000
34#define ROMCARD_START 0x10000000 29#define ROMCARD_START 0x10000000
35 30
36#define FLUSH_BASE 0xdf000000
37#define PCIO_BASE 0xe0000000 31#define PCIO_BASE 0xe0000000
38 32
39 33
diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h
index 95a29b4bc5d0..6968d6103ea0 100644
--- a/include/asm-arm/arch-shark/memory.h
+++ b/include/asm-arm/arch-shark/memory.h
@@ -39,4 +39,10 @@ static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsig
39#define __virt_to_bus(x) __virt_to_phys(x) 39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x) 40#define __bus_to_virt(x) __phys_to_virt(x)
41 41
42/*
43 * Cache flushing area
44 */
45#define FLUSH_BASE_PHYS 0x80000000
46#define FLUSH_BASE 0xdf000000
47
42#endif 48#endif
diff --git a/include/asm-arm/fpstate.h b/include/asm-arm/fpstate.h
index 6246bf83627d..52bae088a185 100644
--- a/include/asm-arm/fpstate.h
+++ b/include/asm-arm/fpstate.h
@@ -26,7 +26,9 @@
26 26
27struct vfp_hard_struct { 27struct vfp_hard_struct {
28 __u64 fpregs[16]; 28 __u64 fpregs[16];
29#if __LINUX_ARM_ARCH__ < 6
29 __u32 fpmx_state; 30 __u32 fpmx_state;
31#endif
30 __u32 fpexc; 32 __u32 fpexc;
31 __u32 fpscr; 33 __u32 fpscr;
32 /* 34 /*
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index 2b3cf69b3ed9..209289407595 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -172,10 +172,10 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
172 * virt_addr_valid(k) indicates whether a virtual address is valid 172 * virt_addr_valid(k) indicates whether a virtual address is valid
173 */ 173 */
174#ifndef CONFIG_DISCONTIGMEM 174#ifndef CONFIG_DISCONTIGMEM
175#define ARCH_PFN_OFFSET (PHYS_PFN_OFFSET) 175#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
176#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) 176#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
177 177
178#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) 178#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
179#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) 179#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
180 180
181#define PHYS_TO_NID(addr) (0) 181#define PHYS_TO_NID(addr) (0)
@@ -187,8 +187,8 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
187 * around in memory. 187 * around in memory.
188 */ 188 */
189#include <linux/numa.h> 189#include <linux/numa.h>
190#define arch_pfn_to_nid(pfn) (PFN_TO_NID(pfn)) 190#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
191#define arch_local_page_offset(pfn, nid) (LOCAL_MAP_NR((pfn) << PAGE_OFFSET)) 191#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
192 192
193#define pfn_valid(pfn) \ 193#define pfn_valid(pfn) \
194 ({ \ 194 ({ \
diff --git a/include/asm-arm/numnodes.h b/include/asm-arm/numnodes.h
deleted file mode 100644
index 8df36818ebc9..000000000000
--- a/include/asm-arm/numnodes.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * linux/include/asm-arm/numnodes.h
3 *
4 * Copyright (C) 2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/* This declaration for the size of the NUMA (CONFIG_DISCONTIGMEM)
12 * memory node table is the default.
13 *
14 * A good place to override this value is include/asm/arch/memory.h.
15 */
16
17#ifndef __ASM_ARM_NUMNODES_H
18#define __ASM_ARM_NUMNODES_H
19
20#include <asm/memory.h>
21
22#ifndef NODES_SHIFT
23# define NODES_SHIFT 2 /* Normally, Max 4 Nodes */
24#endif
25
26#endif
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 65ac305c2d45..ee8dfea549bc 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -360,6 +360,24 @@
360#define __ARM_NR_usr32 (__ARM_NR_BASE+4) 360#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
361#define __ARM_NR_set_tls (__ARM_NR_BASE+5) 361#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
362 362
363/*
364 * The following syscalls are obsolete and no longer available for EABI.
365 */
366#if defined(__ARM_EABI__)
367#undef __NR_time
368#undef __NR_umount
369#undef __NR_stime
370#undef __NR_alarm
371#undef __NR_utime
372#undef __NR_getrlimit
373#undef __NR_select
374#undef __NR_readdir
375#undef __NR_mmap
376#undef __NR_socketcall
377#undef __NR_syscall
378#undef __NR_ipc
379#endif
380
363#define __sys2(x) #x 381#define __sys2(x) #x
364#define __sys1(x) __sys2(x) 382#define __sys1(x) __sys2(x)
365 383
diff --git a/include/asm-arm/vfpmacros.h b/include/asm-arm/vfpmacros.h
index 15bd6e74c9cf..27fe028b4e72 100644
--- a/include/asm-arm/vfpmacros.h
+++ b/include/asm-arm/vfpmacros.h
@@ -16,10 +16,18 @@
16 16
17 @ read all the working registers back into the VFP 17 @ read all the working registers back into the VFP
18 .macro VFPFLDMIA, base 18 .macro VFPFLDMIA, base
19#if __LINUX_ARM_ARCH__ < 6
19 LDC p11, cr0, [\base],#33*4 @ FLDMIAX \base!, {d0-d15} 20 LDC p11, cr0, [\base],#33*4 @ FLDMIAX \base!, {d0-d15}
21#else
22 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
23#endif
20 .endm 24 .endm
21 25
22 @ write all the working registers out of the VFP 26 @ write all the working registers out of the VFP
23 .macro VFPFSTMIA, base 27 .macro VFPFSTMIA, base
28#if __LINUX_ARM_ARCH__ < 6
24 STC p11, cr0, [\base],#33*4 @ FSTMIAX \base!, {d0-d15} 29 STC p11, cr0, [\base],#33*4 @ FSTMIAX \base!, {d0-d15}
30#else
31 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
32#endif
25 .endm 33 .endm
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index 1d63c2aa8ec2..b1c593b6dbff 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int); 10extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int);
11#define prepare_to_switch() do { } while(0)
12#define switch_to(prev,next,last) last = resume(prev,next, \ 11#define switch_to(prev,next,last) last = resume(prev,next, \
13 (int)&((struct task_struct *)0)->thread) 12 (int)&((struct task_struct *)0)->thread)
14 13
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 2627bbdf8a11..bb2dfe480213 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -288,7 +288,7 @@
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#define __NR_sys_kexec_load 283 291#define __NR_kexec_load 283
292#define __NR_waitid 284 292#define __NR_waitid 284
293/* #define __NR_sys_setaltroot 285 */ 293/* #define __NR_sys_setaltroot 285 */
294#define __NR_add_key 286 294#define __NR_add_key 286
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index f72ff0c4dc0b..1734ed91bcdc 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -18,8 +18,6 @@
18 18
19struct thread_struct; 19struct thread_struct;
20 20
21#define prepare_to_switch() do { } while(0)
22
23/* 21/*
24 * switch_to(prev, next) should switch from task `prev' to `next' 22 * switch_to(prev, next) should switch from task `prev' to `next'
25 * `prev' will never be the same as `next'. 23 * `prev' will never be the same as `next'.
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 322531caa484..2662a3e12dc4 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -289,7 +289,7 @@
289#define __NR_mq_timedreceive (__NR_mq_open+3) 289#define __NR_mq_timedreceive (__NR_mq_open+3)
290#define __NR_mq_notify (__NR_mq_open+4) 290#define __NR_mq_notify (__NR_mq_open+4)
291#define __NR_mq_getsetattr (__NR_mq_open+5) 291#define __NR_mq_getsetattr (__NR_mq_open+5)
292#define __NR_sys_kexec_load 283 292#define __NR_kexec_load 283
293#define __NR_waitid 284 293#define __NR_waitid 284
294/* #define __NR_sys_setaltroot 285 */ 294/* #define __NR_sys_setaltroot 285 */
295#define __NR_add_key 286 295#define __NR_add_key 286
diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h
index dfe96c7121cf..8e81cf665e75 100644
--- a/include/asm-h8300/system.h
+++ b/include/asm-h8300/system.h
@@ -4,8 +4,6 @@
4#include <linux/config.h> /* get configuration macros */ 4#include <linux/config.h> /* get configuration macros */
5#include <linux/linkage.h> 5#include <linux/linkage.h>
6 6
7#define prepare_to_switch() do { } while(0)
8
9/* 7/*
10 * switch_to(n) should switch tasks to task ptr, first checking that 8 * switch_to(n) should switch tasks to task ptr, first checking that
11 * ptr isn't the current task, in which case it does nothing. This 9 * ptr isn't the current task, in which case it does nothing. This
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
index 56a4a5686c88..adb05159379b 100644
--- a/include/asm-h8300/unistd.h
+++ b/include/asm-h8300/unistd.h
@@ -285,7 +285,7 @@
285#define __NR_mq_timedreceive (__NR_mq_open+3) 285#define __NR_mq_timedreceive (__NR_mq_open+3)
286#define __NR_mq_notify (__NR_mq_open+4) 286#define __NR_mq_notify (__NR_mq_open+4)
287#define __NR_mq_getsetattr (__NR_mq_open+5) 287#define __NR_mq_getsetattr (__NR_mq_open+5)
288#define __NR_sys_kexec_load 283 288#define __NR_kexec_load 283
289#define __NR_waitid 284 289#define __NR_waitid 284
290/* #define __NR_sys_setaltroot 285 */ 290/* #define __NR_sys_setaltroot 285 */
291#define __NR_add_key 286 291#define __NR_add_key 286
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index ff9ac8d19eb2..288233fd77d7 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -139,6 +139,8 @@ void switch_ipi_to_APIC_timer(void *cpumask);
139 139
140extern int timer_over_8254; 140extern int timer_over_8254;
141 141
142extern int modern_apic(void);
143
142#else /* !CONFIG_X86_LOCAL_APIC */ 144#else /* !CONFIG_X86_LOCAL_APIC */
143static inline void lapic_shutdown(void) { } 145static inline void lapic_shutdown(void) { }
144 146
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index 22d80ece95cb..4ddce5296a78 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -183,6 +183,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
183{ 183{
184 int __i; 184 int __i;
185#ifdef CONFIG_M386 185#ifdef CONFIG_M386
186 unsigned long flags;
186 if(unlikely(boot_cpu_data.x86==3)) 187 if(unlikely(boot_cpu_data.x86==3))
187 goto no_xadd; 188 goto no_xadd;
188#endif 189#endif
@@ -196,10 +197,10 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
196 197
197#ifdef CONFIG_M386 198#ifdef CONFIG_M386
198no_xadd: /* Legacy 386 processor */ 199no_xadd: /* Legacy 386 processor */
199 local_irq_disable(); 200 local_irq_save(flags);
200 __i = atomic_read(v); 201 __i = atomic_read(v);
201 atomic_set(v, i + __i); 202 atomic_set(v, i + __i);
202 local_irq_enable(); 203 local_irq_restore(flags);
203 return i + __i; 204 return i + __i;
204#endif 205#endif
205} 206}
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 5c0b5876b931..b44bfc6239cb 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -71,6 +71,7 @@
71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */ 71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */
72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ 72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ 73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
74#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */
74 75
75/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 76/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
76#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 77#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index edf65be21a92..ca82acb8cb1f 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -35,6 +35,10 @@ struct e820map {
35}; 35};
36 36
37extern struct e820map e820; 37extern struct e820map e820;
38
39extern int e820_all_mapped(unsigned long start, unsigned long end,
40 unsigned type);
41
38#endif/*!__ASSEMBLY__*/ 42#endif/*!__ASSEMBLY__*/
39 43
40#endif/*__E820_HEADER*/ 44#endif/*__E820_HEADER*/
diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
index 16ef9f996e3f..7f1a8a6ee32f 100644
--- a/include/asm-i386/hpet.h
+++ b/include/asm-i386/hpet.h
@@ -89,6 +89,7 @@
89 * then 32 bit HPET counter wrapsaround in less than 0.5 sec. 89 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
90 */ 90 */
91#define HPET_MIN_PERIOD (100000UL) 91#define HPET_MIN_PERIOD (100000UL)
92#define HPET_TICK_RATE (HZ * 100000UL)
92 93
93extern unsigned long hpet_tick; /* hpet clks count per tick */ 94extern unsigned long hpet_tick; /* hpet clks count per tick */
94extern unsigned long hpet_address; /* hpet memory map physical address */ 95extern unsigned long hpet_address; /* hpet memory map physical address */
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index 152d0baa576a..7b1f01191e70 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kernel_stat.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
17#include <asm/sigcontext.h> 18#include <asm/sigcontext.h>
18#include <asm/user.h> 19#include <asm/user.h>
@@ -38,17 +39,38 @@ extern void init_fpu(struct task_struct *);
38extern void kernel_fpu_begin(void); 39extern void kernel_fpu_begin(void);
39#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0) 40#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
40 41
42/* We need a safe address that is cheap to find and that is already
43 in L1 during context switch. The best choices are unfortunately
44 different for UP and SMP */
45#ifdef CONFIG_SMP
46#define safe_address (__per_cpu_offset[0])
47#else
48#define safe_address (kstat_cpu(0).cpustat.user)
49#endif
50
41/* 51/*
42 * These must be called with preempt disabled 52 * These must be called with preempt disabled
43 */ 53 */
44static inline void __save_init_fpu( struct task_struct *tsk ) 54static inline void __save_init_fpu( struct task_struct *tsk )
45{ 55{
56 /* Use more nops than strictly needed in case the compiler
57 varies code */
46 alternative_input( 58 alternative_input(
47 "fnsave %1 ; fwait ;" GENERIC_NOP2, 59 "fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4,
48 "fxsave %1 ; fnclex", 60 "fxsave %[fx]\n"
61 "bt $7,%[fsw] ; jc 1f ; fnclex\n1:",
49 X86_FEATURE_FXSR, 62 X86_FEATURE_FXSR,
50 "m" (tsk->thread.i387.fxsave) 63 [fx] "m" (tsk->thread.i387.fxsave),
51 :"memory"); 64 [fsw] "m" (tsk->thread.i387.fxsave.swd) : "memory");
65 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
66 is pending. Clear the x87 state here by setting it to fixed
67 values. __per_cpu_offset[0] is a random variable that should be in L1 */
68 alternative_input(
69 GENERIC_NOP8 GENERIC_NOP2,
70 "emms\n\t" /* clear stack tags */
71 "fildl %[addr]", /* set F?P to defined value */
72 X86_FEATURE_FXSAVE_LEAK,
73 [addr] "m" (safe_address));
52 task_thread_info(tsk)->status &= ~TS_USEDFPU; 74 task_thread_info(tsk)->status &= ~TS_USEDFPU;
53} 75}
54 76
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index 62113d3bfdc2..770bf6da8c3d 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -18,7 +18,6 @@ extern void find_smp_config (void);
18extern void get_smp_config (void); 18extern void get_smp_config (void);
19extern int nr_ioapics; 19extern int nr_ioapics;
20extern int apic_version [MAX_APICS]; 20extern int apic_version [MAX_APICS];
21extern int mp_bus_id_to_type [MAX_MP_BUSSES];
22extern int mp_irq_entries; 21extern int mp_irq_entries;
23extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; 22extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
24extern int mpc_default_type; 23extern int mpc_default_type;
diff --git a/include/asm-i386/numnodes.h b/include/asm-i386/numnodes.h
deleted file mode 100644
index a61f38c8176f..000000000000
--- a/include/asm-i386/numnodes.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4#include <linux/config.h>
5
6#ifdef CONFIG_X86_NUMAQ
7
8/* Max 16 Nodes */
9#define NODES_SHIFT 4
10
11#elif defined(CONFIG_ACPI_SRAT)
12
13/* Max 8 Nodes */
14#define NODES_SHIFT 3
15
16#endif /* CONFIG_X86_NUMAQ */
17
18#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 2e7f3e257fdd..d81d6cfc1bb4 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -288,7 +288,7 @@
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#define __NR_sys_kexec_load 283 291#define __NR_kexec_load 283
292#define __NR_waitid 284 292#define __NR_waitid 284
293/* #define __NR_sys_setaltroot 285 */ 293/* #define __NR_sys_setaltroot 285 */
294#define __NR_add_key 286 294#define __NR_add_key 286
@@ -318,10 +318,11 @@
318#define __NR_unshare 310 318#define __NR_unshare 310
319#define __NR_set_robust_list 311 319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312 320#define __NR_get_robust_list 312
321#define __NR_sys_splice 313 321#define __NR_splice 313
322#define __NR_sys_sync_file_range 314 322#define __NR_sync_file_range 314
323#define __NR_tee 315
323 324
324#define NR_syscalls 315 325#define NR_syscalls 316
325 326
326/* 327/*
327 * user-visible error numbers are in the range -1 - -128: see 328 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-ia64/acpi-ext.h b/include/asm-ia64/acpi-ext.h
index 56d2ddc97b30..734d137dda6e 100644
--- a/include/asm-ia64/acpi-ext.h
+++ b/include/asm-ia64/acpi-ext.h
@@ -1,12 +1,15 @@
1/* 1/*
2 * ia64/platform/hp/common/hp_acpi.h 2 * (c) Copyright 2003, 2006 Hewlett-Packard Development Company, L.P.
3 * Alex Williamson <alex.williamson@hp.com>
4 * Bjorn Helgaas <bjorn.helgaas@hp.com>
3 * 5 *
4 * Copyright (C) 2003 Hewlett-Packard 6 * This program is free software; you can redistribute it and/or modify
5 * Copyright (C) Alex Williamson 7 * it under the terms of the GNU General Public License version 2 as
6 * Copyright (C) Bjorn Helgaas 8 * published by the Free Software Foundation.
7 * 9 *
8 * Vendor specific extensions to ACPI. 10 * Vendor specific extensions to ACPI.
9 */ 11 */
12
10#ifndef _ASM_IA64_ACPI_EXT_H 13#ifndef _ASM_IA64_ACPI_EXT_H
11#define _ASM_IA64_ACPI_EXT_H 14#define _ASM_IA64_ACPI_EXT_H
12 15
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h
index 218c458ab60c..c195a9ad1255 100644
--- a/include/asm-ia64/kdebug.h
+++ b/include/asm-ia64/kdebug.h
@@ -58,6 +58,8 @@ enum die_val {
58 DIE_MCA_RENDZVOUS_ENTER, 58 DIE_MCA_RENDZVOUS_ENTER,
59 DIE_MCA_RENDZVOUS_PROCESS, 59 DIE_MCA_RENDZVOUS_PROCESS,
60 DIE_MCA_RENDZVOUS_LEAVE, 60 DIE_MCA_RENDZVOUS_LEAVE,
61 DIE_MCA_NEW_TIMEOUT,
62 DIE_INIT_ENTER,
61 DIE_INIT_MONARCH_ENTER, 63 DIE_INIT_MONARCH_ENTER,
62 DIE_INIT_MONARCH_PROCESS, 64 DIE_INIT_MONARCH_PROCESS,
63 DIE_INIT_MONARCH_LEAVE, 65 DIE_INIT_MONARCH_LEAVE,
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index bfbbb8da79c7..9c5389b7e623 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -148,6 +148,11 @@ extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *)
148extern void ia64_unreg_MCA_extension(void); 148extern void ia64_unreg_MCA_extension(void);
149extern u64 ia64_get_rnat(u64 *); 149extern u64 ia64_get_rnat(u64 *);
150 150
151struct ia64_mca_notify_die {
152 struct ia64_sal_os_state *sos;
153 int *monarch_cpu;
154};
155
151#else /* __ASSEMBLY__ */ 156#else /* __ASSEMBLY__ */
152 157
153#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */ 158#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */
diff --git a/include/asm-ia64/mutex.h b/include/asm-ia64/mutex.h
index 5a3224f6af38..bed73a643a56 100644
--- a/include/asm-ia64/mutex.h
+++ b/include/asm-ia64/mutex.h
@@ -84,7 +84,7 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
84static inline int 84static inline int
85__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) 85__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
86{ 86{
87 if (likely(cmpxchg_acq(count, 1, 0)) == 1) 87 if (cmpxchg_acq(count, 1, 0) == 1)
88 return 1; 88 return 1;
89 return 0; 89 return 0;
90} 90}
diff --git a/include/asm-ia64/numnodes.h b/include/asm-ia64/numnodes.h
deleted file mode 100644
index e9d356f549d9..000000000000
--- a/include/asm-ia64/numnodes.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4#ifdef CONFIG_IA64_DIG
5/* Max 8 Nodes */
6# define NODES_SHIFT 3
7#elif defined(CONFIG_IA64_HP_ZX1) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB)
8/* Max 32 Nodes */
9# define NODES_SHIFT 5
10#elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
11# if CONFIG_IA64_NR_NODES == 256
12# define NODES_SHIFT 8
13# elif CONFIG_IA64_NR_NODES <= 512
14# define NODES_SHIFT 9
15# elif CONFIG_IA64_NR_NODES <= 1024
16# define NODES_SHIFT 10
17# endif
18#endif
19
20#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 36070c1014d8..a40ebec6aeeb 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -286,12 +286,16 @@
286/* 1294, 1295 reserved for pselect/ppoll */ 286/* 1294, 1295 reserved for pselect/ppoll */
287#define __NR_unshare 1296 287#define __NR_unshare 1296
288#define __NR_splice 1297 288#define __NR_splice 1297
289#define __NR_set_robust_list 1298
290#define __NR_get_robust_list 1299
291#define __NR_sync_file_range 1300
292#define __NR_tee 1301
289 293
290#ifdef __KERNEL__ 294#ifdef __KERNEL__
291 295
292#include <linux/config.h> 296#include <linux/config.h>
293 297
294#define NR_syscalls 274 /* length of syscall table */ 298#define NR_syscalls 278 /* length of syscall table */
295 299
296#define __ARCH_WANT_SYS_RT_SIGACTION 300#define __ARCH_WANT_SYS_RT_SIGACTION
297 301
diff --git a/include/asm-ia64/vga.h b/include/asm-ia64/vga.h
index bc3349ffc505..091177cda223 100644
--- a/include/asm-ia64/vga.h
+++ b/include/asm-ia64/vga.h
@@ -17,7 +17,7 @@
17extern unsigned long vga_console_iobase; 17extern unsigned long vga_console_iobase;
18extern unsigned long vga_console_membase; 18extern unsigned long vga_console_membase;
19 19
20#define VGA_MAP_MEM(x) ((unsigned long) ioremap(vga_console_membase + (x), 0)) 20#define VGA_MAP_MEM(x) ((unsigned long) ioremap_nocache(vga_console_membase + (x), 0))
21 21
22#define vga_readb(x) (*(x)) 22#define vga_readb(x) (*(x))
23#define vga_writeb(x,y) (*(y) = (x)) 23#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h
index b7f4d8aaeb46..1a1aa17edd33 100644
--- a/include/asm-m32r/assembler.h
+++ b/include/asm-m32r/assembler.h
@@ -109,6 +109,9 @@
109 push r13 109 push r13
110 mvfachi r13 110 mvfachi r13
111 push r13 111 push r13
112 ldi r13, #0
113 push r13 ; dummy push acc1h
114 push r13 ; dummy push acc1l
112#else 115#else
113#error unknown isa configuration 116#error unknown isa configuration
114#endif 117#endif
@@ -156,6 +159,8 @@
156 pop r13 159 pop r13
157 mvtaclo r13, a1 160 mvtaclo r13, a1
158#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) 161#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
162 pop r13 ; dummy pop acc1h
163 pop r13 ; dummy pop acc1l
159 pop r13 164 pop r13
160 mvtachi r13 165 mvtachi r13
161 pop r13 166 pop r13
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
index 1d3c25d61bcb..031369a7afc8 100644
--- a/include/asm-m32r/mappi3/mappi3_pld.h
+++ b/include/asm-m32r/mappi3/mappi3_pld.h
@@ -53,16 +53,14 @@
53/* Power Control of MMC and CF */ 53/* Power Control of MMC and CF */
54#define PLD_CPCR __reg16(PLD_BASE + 0x14000) 54#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
55 55
56 56/* ICU */
57/*==== ICU ====*/ 57#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */
58#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ 58#define M32R_IRQ_I2C (28) /* I2C-BUS */
59#define M32R_IRQ_I2C (28) /* I2C-BUS */ 59#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */
60#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ 60#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert & Eject */
61#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ 61#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */
62#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ 62#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */
63#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ 63#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
64#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
65
66 64
67#if 0 65#if 0
68/* LED Control 66/* LED Control
@@ -97,7 +95,6 @@
97#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) 95#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
98#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) 96#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
99 97
100
101#if 0 98#if 0
102/* RTC */ 99/* RTC */
103#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) 100#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
@@ -140,4 +137,7 @@
140 137
141#endif 138#endif
142 139
140/* Reset Control */
141#define PLD_REBOOT __reg16(PLD_BASE + 0x38000)
142
143#endif /* _MAPPI3_PLD.H */ 143#endif /* _MAPPI3_PLD.H */
diff --git a/include/asm-m32r/numnodes.h b/include/asm-m32r/numnodes.h
deleted file mode 100644
index 479a39d49f83..000000000000
--- a/include/asm-m32r/numnodes.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_NUMNODES_H_
2#define _ASM_NUMNODES_H_
3
4#include <linux/config.h>
5
6#ifdef CONFIG_DISCONTIGMEM
7
8#if defined(CONFIG_CHIP_M32700)
9#define NODES_SHIFT 1 /* Max 2 Nodes */
10#endif /* CONFIG_CHIP_M32700 */
11
12#endif /* CONFIG_DISCONTIGMEM */
13
14#endif /* _ASM_NUMNODES_H_ */
15
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h
index 0d058b2d844e..53c792452dfc 100644
--- a/include/asm-m32r/ptrace.h
+++ b/include/asm-m32r/ptrace.h
@@ -43,6 +43,14 @@
43#define PT_ACC1L 18 43#define PT_ACC1L 18
44#define PT_ACCH PT_ACC0H 44#define PT_ACCH PT_ACC0H
45#define PT_ACCL PT_ACC0L 45#define PT_ACCL PT_ACC0L
46#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
47#define PT_ACCH 15
48#define PT_ACCL 16
49#define PT_DUMMY_ACC1H 17
50#define PT_DUMMY_ACC1L 18
51#else
52#error unknown isa conifiguration
53#endif
46#define PT_PSW 19 54#define PT_PSW 19
47#define PT_BPC 20 55#define PT_BPC 20
48#define PT_BBPSW 21 56#define PT_BBPSW 21
@@ -52,21 +60,6 @@
52#define PT_LR 25 60#define PT_LR 25
53#define PT_SPI 26 61#define PT_SPI 26
54#define PT_ORIGR0 27 62#define PT_ORIGR0 27
55#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
56#define PT_ACCH 15
57#define PT_ACCL 16
58#define PT_PSW 17
59#define PT_BPC 18
60#define PT_BBPSW 19
61#define PT_BBPC 20
62#define PT_SPU 21
63#define PT_FP 22
64#define PT_LR 23
65#define PT_SPI 24
66#define PT_ORIGR0 25
67#else
68#error unknown isa conifiguration
69#endif
70 63
71/* virtual pt_reg entry for gdb */ 64/* virtual pt_reg entry for gdb */
72#define PT_PC 30 65#define PT_PC 30
@@ -121,6 +114,8 @@ struct pt_regs {
121#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) 114#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
122 unsigned long acch; 115 unsigned long acch;
123 unsigned long accl; 116 unsigned long accl;
117 unsigned long dummy_acc1h;
118 unsigned long dummy_acc1l;
124#else 119#else
125#error unknown isa configuration 120#error unknown isa configuration
126#endif 121#endif
diff --git a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h
index bf447c52a0a1..81750edc8916 100644
--- a/include/asm-m32r/semaphore.h
+++ b/include/asm-m32r/semaphore.h
@@ -9,7 +9,7 @@
9 * SMP- and interrupt-safe semaphores.. 9 * SMP- and interrupt-safe semaphores..
10 * 10 *
11 * Copyright (C) 1996 Linus Torvalds 11 * Copyright (C) 1996 Linus Torvalds
12 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 12 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
13 */ 13 */
14 14
15#include <linux/config.h> 15#include <linux/config.h>
@@ -77,27 +77,8 @@ asmlinkage void __up(struct semaphore * sem);
77 */ 77 */
78static inline void down(struct semaphore * sem) 78static inline void down(struct semaphore * sem)
79{ 79{
80 unsigned long flags;
81 long count;
82
83 might_sleep(); 80 might_sleep();
84 local_irq_save(flags); 81 if (unlikely(atomic_dec_return(&sem->count) < 0))
85 __asm__ __volatile__ (
86 "# down \n\t"
87 DCACHE_CLEAR("%0", "r4", "%1")
88 M32R_LOCK" %0, @%1; \n\t"
89 "addi %0, #-1; \n\t"
90 M32R_UNLOCK" %0, @%1; \n\t"
91 : "=&r" (count)
92 : "r" (&sem->count)
93 : "memory"
94#ifdef CONFIG_CHIP_M32700_TS1
95 , "r4"
96#endif /* CONFIG_CHIP_M32700_TS1 */
97 );
98 local_irq_restore(flags);
99
100 if (unlikely(count < 0))
101 __down(sem); 82 __down(sem);
102} 83}
103 84
@@ -107,28 +88,10 @@ static inline void down(struct semaphore * sem)
107 */ 88 */
108static inline int down_interruptible(struct semaphore * sem) 89static inline int down_interruptible(struct semaphore * sem)
109{ 90{
110 unsigned long flags;
111 long count;
112 int result = 0; 91 int result = 0;
113 92
114 might_sleep(); 93 might_sleep();
115 local_irq_save(flags); 94 if (unlikely(atomic_dec_return(&sem->count) < 0))
116 __asm__ __volatile__ (
117 "# down_interruptible \n\t"
118 DCACHE_CLEAR("%0", "r4", "%1")
119 M32R_LOCK" %0, @%1; \n\t"
120 "addi %0, #-1; \n\t"
121 M32R_UNLOCK" %0, @%1; \n\t"
122 : "=&r" (count)
123 : "r" (&sem->count)
124 : "memory"
125#ifdef CONFIG_CHIP_M32700_TS1
126 , "r4"
127#endif /* CONFIG_CHIP_M32700_TS1 */
128 );
129 local_irq_restore(flags);
130
131 if (unlikely(count < 0))
132 result = __down_interruptible(sem); 95 result = __down_interruptible(sem);
133 96
134 return result; 97 return result;
@@ -174,26 +137,7 @@ static inline int down_trylock(struct semaphore * sem)
174 */ 137 */
175static inline void up(struct semaphore * sem) 138static inline void up(struct semaphore * sem)
176{ 139{
177 unsigned long flags; 140 if (unlikely(atomic_inc_return(&sem->count) <= 0))
178 long count;
179
180 local_irq_save(flags);
181 __asm__ __volatile__ (
182 "# up \n\t"
183 DCACHE_CLEAR("%0", "r4", "%1")
184 M32R_LOCK" %0, @%1; \n\t"
185 "addi %0, #1; \n\t"
186 M32R_UNLOCK" %0, @%1; \n\t"
187 : "=&r" (count)
188 : "r" (&sem->count)
189 : "memory"
190#ifdef CONFIG_CHIP_M32700_TS1
191 , "r4"
192#endif /* CONFIG_CHIP_M32700_TS1 */
193 );
194 local_irq_restore(flags);
195
196 if (unlikely(count <= 0))
197 __up(sem); 141 __up(sem);
198} 142}
199 143
diff --git a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h
index c233e2def2a3..942b8a30937d 100644
--- a/include/asm-m32r/sigcontext.h
+++ b/include/asm-m32r/sigcontext.h
@@ -32,6 +32,8 @@ struct sigcontext {
32#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) 32#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
33 unsigned long sc_acch; 33 unsigned long sc_acch;
34 unsigned long sc_accl; 34 unsigned long sc_accl;
35 unsigned long sc_dummy_acc1h;
36 unsigned long sc_dummy_acc1l;
35#else 37#else
36#error unknown isa configuration 38#error unknown isa configuration
37#endif 39#endif
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h
index 7885b7df84a2..1184293e5712 100644
--- a/include/asm-m32r/smp.h
+++ b/include/asm-m32r/smp.h
@@ -67,7 +67,8 @@ extern volatile int cpu_2_physid[NR_CPUS];
67#define raw_smp_processor_id() (current_thread_info()->cpu) 67#define raw_smp_processor_id() (current_thread_info()->cpu)
68 68
69extern cpumask_t cpu_callout_map; 69extern cpumask_t cpu_callout_map;
70#define cpu_possible_map cpu_callout_map 70extern cpumask_t cpu_possible_map;
71extern cpumask_t cpu_present_map;
71 72
72static __inline__ int hard_smp_processor_id(void) 73static __inline__ int hard_smp_processor_id(void)
73{ 74{
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index d6a2c613be68..e55013f378e5 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -6,8 +6,8 @@
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details. 7 * for more details.
8 * 8 *
9 * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto 9 * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
10 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 10 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
11 */ 11 */
12 12
13#include <linux/config.h> 13#include <linux/config.h>
@@ -19,53 +19,28 @@
19 * switch_to(prev, next) should switch from task `prev' to `next' 19 * switch_to(prev, next) should switch from task `prev' to `next'
20 * `prev' will never be the same as `next'. 20 * `prev' will never be the same as `next'.
21 * 21 *
22 * `next' and `prev' should be struct task_struct, but it isn't always defined 22 * `next' and `prev' should be task_t, but it isn't always defined
23 */ 23 */
24 24
25#ifndef CONFIG_SMP
26#define prepare_to_switch() do { } while(0)
27#endif /* not CONFIG_SMP */
28
29#define switch_to(prev, next, last) do { \ 25#define switch_to(prev, next, last) do { \
30 register unsigned long arg0 __asm__ ("r0") = (unsigned long)prev; \
31 register unsigned long arg1 __asm__ ("r1") = (unsigned long)next; \
32 register unsigned long *oldsp __asm__ ("r2") = &(prev->thread.sp); \
33 register unsigned long *newsp __asm__ ("r3") = &(next->thread.sp); \
34 register unsigned long *oldlr __asm__ ("r4") = &(prev->thread.lr); \
35 register unsigned long *newlr __asm__ ("r5") = &(next->thread.lr); \
36 register struct task_struct *__last __asm__ ("r6"); \
37 __asm__ __volatile__ ( \ 26 __asm__ __volatile__ ( \
38 "st r8, @-r15 \n\t" \ 27 " seth lr, #high(1f) \n" \
39 "st r9, @-r15 \n\t" \ 28 " or3 lr, lr, #low(1f) \n" \
40 "st r10, @-r15 \n\t" \ 29 " st lr, @%4 ; store old LR \n" \
41 "st r11, @-r15 \n\t" \ 30 " ld lr, @%5 ; load new LR \n" \
42 "st r12, @-r15 \n\t" \ 31 " st sp, @%2 ; store old SP \n" \
43 "st r13, @-r15 \n\t" \ 32 " ld sp, @%3 ; load new SP \n" \
44 "st r14, @-r15 \n\t" \ 33 " push %1 ; store `prev' on new stack \n" \
45 "seth r14, #high(1f) \n\t" \ 34 " jmp lr \n" \
46 "or3 r14, r14, #low(1f) \n\t" \ 35 " .fillinsn \n" \
47 "st r14, @r4 ; store old LR \n\t" \ 36 "1: \n" \
48 "st r15, @r2 ; store old SP \n\t" \ 37 " pop %0 ; restore `__last' from new stack \n" \
49 "ld r15, @r3 ; load new SP \n\t" \ 38 : "=r" (last) \
50 "st r0, @-r15 ; store 'prev' onto new stack \n\t" \ 39 : "0" (prev), \
51 "ld r14, @r5 ; load new LR \n\t" \ 40 "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \
52 "jmp r14 \n\t" \ 41 "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \
53 ".fillinsn \n " \ 42 : "memory", "lr" \
54 "1: \n\t" \
55 "ld r6, @r15+ ; load 'prev' from new stack \n\t" \
56 "ld r14, @r15+ \n\t" \
57 "ld r13, @r15+ \n\t" \
58 "ld r12, @r15+ \n\t" \
59 "ld r11, @r15+ \n\t" \
60 "ld r10, @r15+ \n\t" \
61 "ld r9, @r15+ \n\t" \
62 "ld r8, @r15+ \n\t" \
63 : "=&r" (__last) \
64 : "r" (arg0), "r" (arg1), "r" (oldsp), "r" (newsp), \
65 "r" (oldlr), "r" (newlr) \
66 : "memory" \
67 ); \ 43 ); \
68 last = __last; \
69} while(0) 44} while(0)
70 45
71/* 46/*
@@ -171,8 +146,8 @@ extern void __xchg_called_with_bad_pointer(void);
171#define DCACHE_CLEAR(reg0, reg1, addr) 146#define DCACHE_CLEAR(reg0, reg1, addr)
172#endif /* CONFIG_CHIP_M32700_TS1 */ 147#endif /* CONFIG_CHIP_M32700_TS1 */
173 148
174static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, 149static inline unsigned long
175 int size) 150__xchg(unsigned long x, volatile void * ptr, int size)
176{ 151{
177 unsigned long flags; 152 unsigned long flags;
178 unsigned long tmp = 0; 153 unsigned long tmp = 0;
@@ -224,7 +199,7 @@ static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr,
224 199
225#define __HAVE_ARCH_CMPXCHG 1 200#define __HAVE_ARCH_CMPXCHG 1
226 201
227static __inline__ unsigned long 202static inline unsigned long
228__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) 203__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
229{ 204{
230 unsigned long flags; 205 unsigned long flags;
@@ -258,7 +233,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
258 if something tries to do an invalid cmpxchg(). */ 233 if something tries to do an invalid cmpxchg(). */
259extern void __cmpxchg_called_with_bad_pointer(void); 234extern void __cmpxchg_called_with_bad_pointer(void);
260 235
261static __inline__ unsigned long 236static inline unsigned long
262__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 237__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
263{ 238{
264 switch (size) { 239 switch (size) {
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
index e8ae61956a51..819cc28a94f7 100644
--- a/include/asm-m32r/uaccess.h
+++ b/include/asm-m32r/uaccess.h
@@ -5,17 +5,9 @@
5 * linux/include/asm-m32r/uaccess.h 5 * linux/include/asm-m32r/uaccess.h
6 * 6 *
7 * M32R version. 7 * M32R version.
8 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 8 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
9 */ 9 */
10 10
11#undef UACCESS_DEBUG
12
13#ifdef UACCESS_DEBUG
14#define UAPRINTK(args...) printk(args)
15#else
16#define UAPRINTK(args...)
17#endif /* UACCESS_DEBUG */
18
19/* 11/*
20 * User space memory access functions 12 * User space memory access functions
21 */ 13 */
@@ -38,27 +30,29 @@
38#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
39 31
40#ifdef CONFIG_MMU 32#ifdef CONFIG_MMU
33
41#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) 34#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
42#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) 35#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
43#else
44#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
45#define USER_DS MAKE_MM_SEG(0xFFFFFFFF)
46#endif /* CONFIG_MMU */
47
48#define get_ds() (KERNEL_DS) 36#define get_ds() (KERNEL_DS)
49#ifdef CONFIG_MMU
50#define get_fs() (current_thread_info()->addr_limit) 37#define get_fs() (current_thread_info()->addr_limit)
51#define set_fs(x) (current_thread_info()->addr_limit = (x)) 38#define set_fs(x) (current_thread_info()->addr_limit = (x))
52#else 39
40#else /* not CONFIG_MMU */
41
42#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
43#define USER_DS MAKE_MM_SEG(0xFFFFFFFF)
44#define get_ds() (KERNEL_DS)
45
53static inline mm_segment_t get_fs(void) 46static inline mm_segment_t get_fs(void)
54{ 47{
55 return USER_DS; 48 return USER_DS;
56} 49}
57 50
58static inline void set_fs(mm_segment_t s) 51static inline void set_fs(mm_segment_t s)
59{ 52{
60} 53}
61#endif /* CONFIG_MMU */ 54
55#endif /* not CONFIG_MMU */
62 56
63#define segment_eq(a,b) ((a).seg == (b).seg) 57#define segment_eq(a,b) ((a).seg == (b).seg)
64 58
@@ -83,9 +77,9 @@ static inline void set_fs(mm_segment_t s)
83 " subx %0, %0\n" \ 77 " subx %0, %0\n" \
84 " cmpu %4, %1\n" \ 78 " cmpu %4, %1\n" \
85 " subx %0, %5\n" \ 79 " subx %0, %5\n" \
86 : "=&r"(flag), "=r"(sum) \ 80 : "=&r" (flag), "=r" (sum) \
87 : "1"(addr), "r"((int)(size)), \ 81 : "1" (addr), "r" ((int)(size)), \
88 "r"(current_thread_info()->addr_limit.seg), "r"(0) \ 82 "r" (current_thread_info()->addr_limit.seg), "r" (0) \
89 : "cbit" ); \ 83 : "cbit" ); \
90 flag; }) 84 flag; })
91 85
@@ -113,10 +107,10 @@ static inline void set_fs(mm_segment_t s)
113#else 107#else
114static inline int access_ok(int type, const void *addr, unsigned long size) 108static inline int access_ok(int type, const void *addr, unsigned long size)
115{ 109{
116 extern unsigned long memory_start, memory_end; 110 extern unsigned long memory_start, memory_end;
117 unsigned long val = (unsigned long)addr; 111 unsigned long val = (unsigned long)addr;
118 112
119 return ((val >= memory_start) && ((val + size) < memory_end)); 113 return ((val >= memory_start) && ((val + size) < memory_end));
120} 114}
121#endif /* CONFIG_MMU */ 115#endif /* CONFIG_MMU */
122 116
@@ -155,39 +149,6 @@ extern int fixup_exception(struct pt_regs *regs);
155 * accesses to the same area of user memory). 149 * accesses to the same area of user memory).
156 */ 150 */
157 151
158extern void __get_user_1(void);
159extern void __get_user_2(void);
160extern void __get_user_4(void);
161
162#ifndef MODULE
163#define __get_user_x(size,ret,x,ptr) \
164 __asm__ __volatile__( \
165 " mv r0, %0\n" \
166 " mv r1, %1\n" \
167 " bl __get_user_" #size "\n" \
168 " mv %0, r0\n" \
169 " mv %1, r1\n" \
170 : "=r"(ret), "=r"(x) \
171 : "0"(ptr) \
172 : "r0", "r1", "r14" )
173#else /* MODULE */
174/*
175 * Use "jl" instead of "bl" for MODULE
176 */
177#define __get_user_x(size,ret,x,ptr) \
178 __asm__ __volatile__( \
179 " mv r0, %0\n" \
180 " mv r1, %1\n" \
181 " seth lr, #high(__get_user_" #size ")\n" \
182 " or3 lr, lr, #low(__get_user_" #size ")\n" \
183 " jl lr\n" \
184 " mv %0, r0\n" \
185 " mv %1, r1\n" \
186 : "=r"(ret), "=r"(x) \
187 : "0"(ptr) \
188 : "r0", "r1", "r14" )
189#endif
190
191/* Careful: we have to cast the result to the type of the pointer for sign 152/* Careful: we have to cast the result to the type of the pointer for sign
192 reasons */ 153 reasons */
193/** 154/**
@@ -208,20 +169,7 @@ extern void __get_user_4(void);
208 * On error, the variable @x is set to zero. 169 * On error, the variable @x is set to zero.
209 */ 170 */
210#define get_user(x,ptr) \ 171#define get_user(x,ptr) \
211({ int __ret_gu; \ 172 __get_user_check((x),(ptr),sizeof(*(ptr)))
212 unsigned long __val_gu; \
213 __chk_user_ptr(ptr); \
214 switch(sizeof (*(ptr))) { \
215 case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \
216 case 2: __get_user_x(2,__ret_gu,__val_gu,ptr); break; \
217 case 4: __get_user_x(4,__ret_gu,__val_gu,ptr); break; \
218 default: __get_user_x(X,__ret_gu,__val_gu,ptr); break; \
219 } \
220 (x) = (__typeof__(*(ptr)))__val_gu; \
221 __ret_gu; \
222})
223
224extern void __put_user_bad(void);
225 173
226/** 174/**
227 * put_user: - Write a simple value into user space. 175 * put_user: - Write a simple value into user space.
@@ -240,8 +188,7 @@ extern void __put_user_bad(void);
240 * Returns zero on success, or -EFAULT on error. 188 * Returns zero on success, or -EFAULT on error.
241 */ 189 */
242#define put_user(x,ptr) \ 190#define put_user(x,ptr) \
243 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) 191 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
244
245 192
246/** 193/**
247 * __get_user: - Get a simple variable from user space, with less checking. 194 * __get_user: - Get a simple variable from user space, with less checking.
@@ -264,8 +211,64 @@ extern void __put_user_bad(void);
264 * On error, the variable @x is set to zero. 211 * On error, the variable @x is set to zero.
265 */ 212 */
266#define __get_user(x,ptr) \ 213#define __get_user(x,ptr) \
267 __get_user_nocheck((x),(ptr),sizeof(*(ptr))) 214 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
268 215
216#define __get_user_nocheck(x,ptr,size) \
217({ \
218 long __gu_err = 0; \
219 unsigned long __gu_val; \
220 might_sleep(); \
221 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
222 (x) = (__typeof__(*(ptr)))__gu_val; \
223 __gu_err; \
224})
225
226#define __get_user_check(x,ptr,size) \
227({ \
228 long __gu_err = -EFAULT; \
229 unsigned long __gu_val = 0; \
230 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
231 might_sleep(); \
232 if (access_ok(VERIFY_READ,__gu_addr,size)) \
233 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \
234 (x) = (__typeof__(*(ptr)))__gu_val; \
235 __gu_err; \
236})
237
238extern long __get_user_bad(void);
239
240#define __get_user_size(x,ptr,size,retval) \
241do { \
242 retval = 0; \
243 __chk_user_ptr(ptr); \
244 switch (size) { \
245 case 1: __get_user_asm(x,ptr,retval,"ub"); break; \
246 case 2: __get_user_asm(x,ptr,retval,"uh"); break; \
247 case 4: __get_user_asm(x,ptr,retval,""); break; \
248 default: (x) = __get_user_bad(); \
249 } \
250} while (0)
251
252#define __get_user_asm(x, addr, err, itype) \
253 __asm__ __volatile__( \
254 " .fillinsn\n" \
255 "1: ld"itype" %1,@%2\n" \
256 " .fillinsn\n" \
257 "2:\n" \
258 ".section .fixup,\"ax\"\n" \
259 " .balign 4\n" \
260 "3: ldi %0,%3\n" \
261 " seth r14,#high(2b)\n" \
262 " or3 r14,r14,#low(2b)\n" \
263 " jmp r14\n" \
264 ".previous\n" \
265 ".section __ex_table,\"a\"\n" \
266 " .balign 4\n" \
267 " .long 1b,3b\n" \
268 ".previous" \
269 : "=&r" (err), "=&r" (x) \
270 : "r" (addr), "i" (-EFAULT), "0" (err) \
271 : "r14", "memory")
269 272
270/** 273/**
271 * __put_user: - Write a simple value into user space, with less checking. 274 * __put_user: - Write a simple value into user space, with less checking.
@@ -287,11 +290,13 @@ extern void __put_user_bad(void);
287 * Returns zero on success, or -EFAULT on error. 290 * Returns zero on success, or -EFAULT on error.
288 */ 291 */
289#define __put_user(x,ptr) \ 292#define __put_user(x,ptr) \
290 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) 293 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
294
291 295
292#define __put_user_nocheck(x,ptr,size) \ 296#define __put_user_nocheck(x,ptr,size) \
293({ \ 297({ \
294 long __pu_err; \ 298 long __pu_err; \
299 might_sleep(); \
295 __put_user_size((x),(ptr),(size),__pu_err); \ 300 __put_user_size((x),(ptr),(size),__pu_err); \
296 __pu_err; \ 301 __pu_err; \
297}) 302})
@@ -308,28 +313,28 @@ extern void __put_user_bad(void);
308}) 313})
309 314
310#if defined(__LITTLE_ENDIAN__) 315#if defined(__LITTLE_ENDIAN__)
311#define __put_user_u64(x, addr, err) \ 316#define __put_user_u64(x, addr, err) \
312 __asm__ __volatile__( \ 317 __asm__ __volatile__( \
313 " .fillinsn\n" \ 318 " .fillinsn\n" \
314 "1: st %L1,@%2\n" \ 319 "1: st %L1,@%2\n" \
315 " .fillinsn\n" \ 320 " .fillinsn\n" \
316 "2: st %H1,@(4,%2)\n" \ 321 "2: st %H1,@(4,%2)\n" \
317 " .fillinsn\n" \ 322 " .fillinsn\n" \
318 "3:\n" \ 323 "3:\n" \
319 ".section .fixup,\"ax\"\n" \ 324 ".section .fixup,\"ax\"\n" \
320 " .balign 4\n" \ 325 " .balign 4\n" \
321 "4: ldi %0,%3\n" \ 326 "4: ldi %0,%3\n" \
322 " seth r14,#high(3b)\n" \ 327 " seth r14,#high(3b)\n" \
323 " or3 r14,r14,#low(3b)\n" \ 328 " or3 r14,r14,#low(3b)\n" \
324 " jmp r14\n" \ 329 " jmp r14\n" \
325 ".previous\n" \ 330 ".previous\n" \
326 ".section __ex_table,\"a\"\n" \ 331 ".section __ex_table,\"a\"\n" \
327 " .balign 4\n" \ 332 " .balign 4\n" \
328 " .long 1b,4b\n" \ 333 " .long 1b,4b\n" \
329 " .long 2b,4b\n" \ 334 " .long 2b,4b\n" \
330 ".previous" \ 335 ".previous" \
331 : "=&r"(err) \ 336 : "=&r" (err) \
332 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 337 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
333 : "r14", "memory") 338 : "r14", "memory")
334 339
335#elif defined(__BIG_ENDIAN__) 340#elif defined(__BIG_ENDIAN__)
@@ -353,13 +358,15 @@ extern void __put_user_bad(void);
353 " .long 1b,4b\n" \ 358 " .long 1b,4b\n" \
354 " .long 2b,4b\n" \ 359 " .long 2b,4b\n" \
355 ".previous" \ 360 ".previous" \
356 : "=&r"(err) \ 361 : "=&r" (err) \
357 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 362 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
358 : "r14", "memory") 363 : "r14", "memory")
359#else 364#else
360#error no endian defined 365#error no endian defined
361#endif 366#endif
362 367
368extern void __put_user_bad(void);
369
363#define __put_user_size(x,ptr,size,retval) \ 370#define __put_user_size(x,ptr,size,retval) \
364do { \ 371do { \
365 retval = 0; \ 372 retval = 0; \
@@ -398,52 +405,8 @@ struct __large_struct { unsigned long buf[100]; };
398 " .balign 4\n" \ 405 " .balign 4\n" \
399 " .long 1b,3b\n" \ 406 " .long 1b,3b\n" \
400 ".previous" \ 407 ".previous" \
401 : "=&r"(err) \ 408 : "=&r" (err) \
402 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 409 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
403 : "r14", "memory")
404
405#define __get_user_nocheck(x,ptr,size) \
406({ \
407 long __gu_err; \
408 unsigned long __gu_val; \
409 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
410 (x) = (__typeof__(*(ptr)))__gu_val; \
411 __gu_err; \
412})
413
414extern long __get_user_bad(void);
415
416#define __get_user_size(x,ptr,size,retval) \
417do { \
418 retval = 0; \
419 __chk_user_ptr(ptr); \
420 switch (size) { \
421 case 1: __get_user_asm(x,ptr,retval,"ub"); break; \
422 case 2: __get_user_asm(x,ptr,retval,"uh"); break; \
423 case 4: __get_user_asm(x,ptr,retval,""); break; \
424 default: (x) = __get_user_bad(); \
425 } \
426} while (0)
427
428#define __get_user_asm(x, addr, err, itype) \
429 __asm__ __volatile__( \
430 " .fillinsn\n" \
431 "1: ld"itype" %1,@%2\n" \
432 " .fillinsn\n" \
433 "2:\n" \
434 ".section .fixup,\"ax\"\n" \
435 " .balign 4\n" \
436 "3: ldi %0,%3\n" \
437 " seth r14,#high(2b)\n" \
438 " or3 r14,r14,#low(2b)\n" \
439 " jmp r14\n" \
440 ".previous\n" \
441 ".section __ex_table,\"a\"\n" \
442 " .balign 4\n" \
443 " .long 1b,3b\n" \
444 ".previous" \
445 : "=&r"(err), "=&r"(x) \
446 : "r"(addr), "i"(-EFAULT), "0"(err) \
447 : "r14", "memory") 410 : "r14", "memory")
448 411
449/* 412/*
@@ -453,7 +416,6 @@ do { \
453 * anything, so this is accurate. 416 * anything, so this is accurate.
454 */ 417 */
455 418
456
457/* 419/*
458 * Copy To/From Userspace 420 * Copy To/From Userspace
459 */ 421 */
@@ -511,8 +473,9 @@ do { \
511 " .long 2b,9b\n" \ 473 " .long 2b,9b\n" \
512 " .long 3b,9b\n" \ 474 " .long 3b,9b\n" \
513 ".previous\n" \ 475 ".previous\n" \
514 : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ 476 : "=&r" (__dst), "=&r" (__src), "=&r" (size), \
515 : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ 477 "=&r" (__c) \
478 : "0" (to), "1" (from), "2" (size), "3" (size / 4) \
516 : "r14", "memory"); \ 479 : "r14", "memory"); \
517} while (0) 480} while (0)
518 481
@@ -573,8 +536,9 @@ do { \
573 " .long 2b,7b\n" \ 536 " .long 2b,7b\n" \
574 " .long 3b,7b\n" \ 537 " .long 3b,7b\n" \
575 ".previous\n" \ 538 ".previous\n" \
576 : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ 539 : "=&r" (__dst), "=&r" (__src), "=&r" (size), \
577 : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ 540 "=&r" (__c) \
541 : "0" (to), "1" (from), "2" (size), "3" (size / 4) \
578 : "r14", "memory"); \ 542 : "r14", "memory"); \
579} while (0) 543} while (0)
580 544
@@ -676,7 +640,7 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
676#define copy_from_user(to,from,n) \ 640#define copy_from_user(to,from,n) \
677({ \ 641({ \
678 might_sleep(); \ 642 might_sleep(); \
679__generic_copy_from_user((to),(from),(n)); \ 643 __generic_copy_from_user((to),(from),(n)); \
680}) 644})
681 645
682long __must_check strncpy_from_user(char *dst, const char __user *src, 646long __must_check strncpy_from_user(char *dst, const char __user *src,
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index 39be87ca2a5a..be0eb014c3b0 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -292,7 +292,7 @@
292#define __NR_mq_timedreceive (__NR_mq_open+3) 292#define __NR_mq_timedreceive (__NR_mq_open+3)
293#define __NR_mq_notify (__NR_mq_open+4) 293#define __NR_mq_notify (__NR_mq_open+4)
294#define __NR_mq_getsetattr (__NR_mq_open+5) 294#define __NR_mq_getsetattr (__NR_mq_open+5)
295#define __NR_sys_kexec_load 283 295#define __NR_kexec_load 283
296#define __NR_waitid 284 296#define __NR_waitid 284
297 297
298#define NR_syscalls 285 298#define NR_syscalls 285
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
index 30b18ea6cb11..f54aa147ec19 100644
--- a/include/asm-mips/asmmacro.h
+++ b/include/asm-mips/asmmacro.h
@@ -17,7 +17,26 @@
17#ifdef CONFIG_64BIT 17#ifdef CONFIG_64BIT
18#include <asm/asmmacro-64.h> 18#include <asm/asmmacro-64.h>
19#endif 19#endif
20#ifdef CONFIG_MIPS_MT_SMTC
21#include <asm/mipsmtregs.h>
22#endif
20 23
24#ifdef CONFIG_MIPS_MT_SMTC
25 .macro local_irq_enable reg=t0
26 mfc0 \reg, CP0_TCSTATUS
27 ori \reg, \reg, TCSTATUS_IXMT
28 xori \reg, \reg, TCSTATUS_IXMT
29 mtc0 \reg, CP0_TCSTATUS
30 ehb
31 .endm
32
33 .macro local_irq_disable reg=t0
34 mfc0 \reg, CP0_TCSTATUS
35 ori \reg, \reg, TCSTATUS_IXMT
36 mtc0 \reg, CP0_TCSTATUS
37 ehb
38 .endm
39#else
21 .macro local_irq_enable reg=t0 40 .macro local_irq_enable reg=t0
22 mfc0 \reg, CP0_STATUS 41 mfc0 \reg, CP0_STATUS
23 ori \reg, \reg, 1 42 ori \reg, \reg, 1
@@ -32,6 +51,7 @@
32 mtc0 \reg, CP0_STATUS 51 mtc0 \reg, CP0_STATUS
33 irq_disable_hazard 52 irq_disable_hazard
34 .endm 53 .endm
54#endif /* CONFIG_MIPS_MT_SMTC */
35 55
36#ifdef CONFIG_CPU_SB1 56#ifdef CONFIG_CPU_SB1
37 .macro fpu_enable_hazard 57 .macro fpu_enable_hazard
@@ -48,4 +68,31 @@
48 .endm 68 .endm
49#endif 69#endif
50 70
71/*
72 * Temporary until all gas have MT ASE support
73 */
74 .macro DMT reg=0
75 .word (0x41600bc1 | (\reg << 16))
76 .endm
77
78 .macro EMT reg=0
79 .word (0x41600be1 | (\reg << 16))
80 .endm
81
82 .macro DVPE reg=0
83 .word (0x41600001 | (\reg << 16))
84 .endm
85
86 .macro EVPE reg=0
87 .word (0x41600021 | (\reg << 16))
88 .endm
89
90 .macro MFTR rt=0, rd=0, u=0, sel=0
91 .word (0x41000000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel))
92 .endm
93
94 .macro MTTR rt=0, rd=0, u=0, sel=0
95 .word (0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel))
96 .endm
97
51#endif /* _ASM_ASMMACRO_H */ 98#endif /* _ASM_ASMMACRO_H */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index aeae9fabf4a9..47bc8f6c20d2 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -74,6 +74,7 @@ static inline void copy_from_user_page(struct vm_area_struct *vma,
74 74
75extern void (*flush_cache_sigtramp)(unsigned long addr); 75extern void (*flush_cache_sigtramp)(unsigned long addr);
76extern void (*flush_icache_all)(void); 76extern void (*flush_icache_all)(void);
77extern void (*local_flush_data_cache_page)(void * addr);
77extern void (*flush_data_cache_page)(unsigned long addr); 78extern void (*flush_data_cache_page)(unsigned long addr);
78 79
79/* 80/*
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 3f2b6d9ac45e..254e11ed247b 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -40,7 +40,7 @@
40#define cpu_has_sb1_cache (cpu_data[0].options & MIPS_CPU_SB1_CACHE) 40#define cpu_has_sb1_cache (cpu_data[0].options & MIPS_CPU_SB1_CACHE)
41#endif 41#endif
42#ifndef cpu_has_fpu 42#ifndef cpu_has_fpu
43#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU) 43#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
44#endif 44#endif
45#ifndef cpu_has_32fpr 45#ifndef cpu_has_32fpr
46#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) 46#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index 140be1c67da7..6572ac703662 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -73,6 +73,16 @@ struct cpuinfo_mips {
73 struct cache_desc dcache; /* Primary D or combined I/D cache */ 73 struct cache_desc dcache; /* Primary D or combined I/D cache */
74 struct cache_desc scache; /* Secondary cache */ 74 struct cache_desc scache; /* Secondary cache */
75 struct cache_desc tcache; /* Tertiary/split secondary cache */ 75 struct cache_desc tcache; /* Tertiary/split secondary cache */
76#if defined(CONFIG_MIPS_MT_SMTC)
77 /*
78 * In the MIPS MT "SMTC" model, each TC is considered
79 * to be a "CPU" for the purposes of scheduling, but
80 * exception resources, ASID spaces, etc, are common
81 * to all TCs within the same VPE.
82 */
83 int vpe_id; /* Virtual Processor number */
84 int tc_id; /* Thread Context number */
85#endif /* CONFIG_MIPS_MT */
76 void *data; /* Additional data */ 86 void *data; /* Additional data */
77} __attribute__((aligned(SMP_CACHE_BYTES))); 87} __attribute__((aligned(SMP_CACHE_BYTES)));
78 88
diff --git a/include/asm-mips/ds1742.h b/include/asm-mips/ds1742.h
new file mode 100644
index 000000000000..c2f2c32da637
--- /dev/null
+++ b/include/asm-mips/ds1742.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef _ASM_DS1742_H
9#define _ASM_DS1742_H
10
11#include <ds1742.h>
12
13#endif /* _ASM_DS1742_H */
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index 851f013adad3..bdc9de2df1ef 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -119,8 +119,49 @@
119#define SHT_MIPS_CONFLICT 0x70000002 119#define SHT_MIPS_CONFLICT 0x70000002
120#define SHT_MIPS_GPTAB 0x70000003 120#define SHT_MIPS_GPTAB 0x70000003
121#define SHT_MIPS_UCODE 0x70000004 121#define SHT_MIPS_UCODE 0x70000004
122 122#define SHT_MIPS_DEBUG 0x70000005
123#define SHF_MIPS_GPREL 0x10000000 123#define SHT_MIPS_REGINFO 0x70000006
124#define SHT_MIPS_PACKAGE 0x70000007
125#define SHT_MIPS_PACKSYM 0x70000008
126#define SHT_MIPS_RELD 0x70000009
127#define SHT_MIPS_IFACE 0x7000000b
128#define SHT_MIPS_CONTENT 0x7000000c
129#define SHT_MIPS_OPTIONS 0x7000000d
130#define SHT_MIPS_SHDR 0x70000010
131#define SHT_MIPS_FDESC 0x70000011
132#define SHT_MIPS_EXTSYM 0x70000012
133#define SHT_MIPS_DENSE 0x70000013
134#define SHT_MIPS_PDESC 0x70000014
135#define SHT_MIPS_LOCSYM 0x70000015
136#define SHT_MIPS_AUXSYM 0x70000016
137#define SHT_MIPS_OPTSYM 0x70000017
138#define SHT_MIPS_LOCSTR 0x70000018
139#define SHT_MIPS_LINE 0x70000019
140#define SHT_MIPS_RFDESC 0x7000001a
141#define SHT_MIPS_DELTASYM 0x7000001b
142#define SHT_MIPS_DELTAINST 0x7000001c
143#define SHT_MIPS_DELTACLASS 0x7000001d
144#define SHT_MIPS_DWARF 0x7000001e
145#define SHT_MIPS_DELTADECL 0x7000001f
146#define SHT_MIPS_SYMBOL_LIB 0x70000020
147#define SHT_MIPS_EVENTS 0x70000021
148#define SHT_MIPS_TRANSLATE 0x70000022
149#define SHT_MIPS_PIXIE 0x70000023
150#define SHT_MIPS_XLATE 0x70000024
151#define SHT_MIPS_XLATE_DEBUG 0x70000025
152#define SHT_MIPS_WHIRL 0x70000026
153#define SHT_MIPS_EH_REGION 0x70000027
154#define SHT_MIPS_XLATE_OLD 0x70000028
155#define SHT_MIPS_PDR_EXCEPTION 0x70000029
156
157#define SHF_MIPS_GPREL 0x10000000
158#define SHF_MIPS_MERGE 0x20000000
159#define SHF_MIPS_ADDR 0x40000000
160#define SHF_MIPS_STRING 0x80000000
161#define SHF_MIPS_NOSTRIP 0x08000000
162#define SHF_MIPS_LOCAL 0x04000000
163#define SHF_MIPS_NAMES 0x02000000
164#define SHF_MIPS_NODUPES 0x01000000
124 165
125#ifndef ELF_ARCH 166#ifndef ELF_ARCH
126/* ELF register definitions */ 167/* ELF register definitions */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 9c828b1f8218..b0f50015e252 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -21,6 +21,10 @@
21#include <asm/processor.h> 21#include <asm/processor.h>
22#include <asm/current.h> 22#include <asm/current.h>
23 23
24#ifdef CONFIG_MIPS_MT_FPAFF
25#include <asm/mips_mt.h>
26#endif
27
24struct sigcontext; 28struct sigcontext;
25struct sigcontext32; 29struct sigcontext32;
26 30
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index feb29a793888..dadc05188db7 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -284,6 +284,8 @@ do { \
284#define instruction_hazard() do { } while (0) 284#define instruction_hazard() do { } while (0)
285#endif 285#endif
286 286
287extern void mips_ihb(void);
288
287#endif /* __ASSEMBLY__ */ 289#endif /* __ASSEMBLY__ */
288 290
289#endif /* _ASM_HAZARDS_H */ 291#endif /* _ASM_HAZARDS_H */
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index 774348734fa0..4bb9c06f4410 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -19,7 +19,12 @@ __asm__ (
19 " .set push \n" 19 " .set push \n"
20 " .set reorder \n" 20 " .set reorder \n"
21 " .set noat \n" 21 " .set noat \n"
22#ifdef CONFIG_CPU_MIPSR2 22#ifdef CONFIG_MIPS_MT_SMTC
23 " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
24 " ori $1, 0x400 \n"
25 " xori $1, 0x400 \n"
26 " mtc0 $1, $2, 1 \n"
27#elif defined(CONFIG_CPU_MIPSR2)
23 " ei \n" 28 " ei \n"
24#else 29#else
25 " mfc0 $1,$12 \n" 30 " mfc0 $1,$12 \n"
@@ -62,7 +67,12 @@ __asm__ (
62 " .macro local_irq_disable\n" 67 " .macro local_irq_disable\n"
63 " .set push \n" 68 " .set push \n"
64 " .set noat \n" 69 " .set noat \n"
65#ifdef CONFIG_CPU_MIPSR2 70#ifdef CONFIG_MIPS_MT_SMTC
71 " mfc0 $1, $2, 1 \n"
72 " ori $1, 0x400 \n"
73 " .set noreorder \n"
74 " mtc0 $1, $2, 1 \n"
75#elif defined(CONFIG_CPU_MIPSR2)
66 " di \n" 76 " di \n"
67#else 77#else
68 " mfc0 $1,$12 \n" 78 " mfc0 $1,$12 \n"
@@ -88,7 +98,11 @@ __asm__ (
88 " .macro local_save_flags flags \n" 98 " .macro local_save_flags flags \n"
89 " .set push \n" 99 " .set push \n"
90 " .set reorder \n" 100 " .set reorder \n"
101#ifdef CONFIG_MIPS_MT_SMTC
102 " mfc0 \\flags, $2, 1 \n"
103#else
91 " mfc0 \\flags, $12 \n" 104 " mfc0 \\flags, $12 \n"
105#endif
92 " .set pop \n" 106 " .set pop \n"
93 " .endm \n"); 107 " .endm \n");
94 108
@@ -102,7 +116,13 @@ __asm__ (
102 " .set push \n" 116 " .set push \n"
103 " .set reorder \n" 117 " .set reorder \n"
104 " .set noat \n" 118 " .set noat \n"
105#ifdef CONFIG_CPU_MIPSR2 119#ifdef CONFIG_MIPS_MT_SMTC
120 " mfc0 \\result, $2, 1 \n"
121 " ori $1, \\result, 0x400 \n"
122 " .set noreorder \n"
123 " mtc0 $1, $2, 1 \n"
124 " andi \\result, \\result, 0x400 \n"
125#elif defined(CONFIG_CPU_MIPSR2)
106 " di \\result \n" 126 " di \\result \n"
107 " andi \\result, 1 \n" 127 " andi \\result, 1 \n"
108#else 128#else
@@ -128,7 +148,14 @@ __asm__ (
128 " .set push \n" 148 " .set push \n"
129 " .set noreorder \n" 149 " .set noreorder \n"
130 " .set noat \n" 150 " .set noat \n"
131#if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU) 151#ifdef CONFIG_MIPS_MT_SMTC
152 "mfc0 $1, $2, 1 \n"
153 "andi \\flags, 0x400 \n"
154 "ori $1, 0x400 \n"
155 "xori $1, 0x400 \n"
156 "or \\flags, $1 \n"
157 "mtc0 \\flags, $2, 1 \n"
158#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
132 /* 159 /*
133 * Slow, but doesn't suffer from a relativly unlikely race 160 * Slow, but doesn't suffer from a relativly unlikely race
134 * condition we're having since days 1. 161 * condition we're having since days 1.
@@ -167,11 +194,29 @@ do { \
167 : "memory"); \ 194 : "memory"); \
168} while(0) 195} while(0)
169 196
170#define irqs_disabled() \ 197static inline int irqs_disabled(void)
171({ \ 198{
172 unsigned long flags; \ 199#ifdef CONFIG_MIPS_MT_SMTC
173 local_save_flags(flags); \ 200 /*
174 !(flags & 1); \ 201 * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU
175}) 202 */
203 unsigned long __result;
204
205 __asm__ __volatile__(
206 " .set noreorder \n"
207 " mfc0 %0, $2, 1 \n"
208 " andi %0, 0x400 \n"
209 " slt %0, $0, %0 \n"
210 " .set reorder \n"
211 : "=r" (__result));
212
213 return __result;
214#else
215 unsigned long flags;
216 local_save_flags(flags);
217
218 return !(flags & 1);
219#endif
220}
176 221
177#endif /* _ASM_INTERRUPT_H */ 222#endif /* _ASM_INTERRUPT_H */
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 8a342ccb34a8..dde677f02bc0 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -11,6 +11,9 @@
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14
15#include <asm/mipsmtregs.h>
16
14#include <irq.h> 17#include <irq.h>
15 18
16#ifdef CONFIG_I8259 19#ifdef CONFIG_I8259
@@ -26,6 +29,23 @@ struct pt_regs;
26 29
27extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs); 30extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs);
28 31
32#ifdef CONFIG_MIPS_MT_SMTC
33/*
34 * Clear interrupt mask handling "backstop" if irq_hwmask
35 * entry so indicates. This implies that the ack() or end()
36 * functions will take over re-enabling the low-level mask.
37 * Otherwise it will be done on return from exception.
38 */
39#define __DO_IRQ_SMTC_HOOK() \
40do { \
41 if (irq_hwmask[irq] & 0x0000ff00) \
42 write_c0_tccontext(read_c0_tccontext() & \
43 ~(irq_hwmask[irq] & 0x0000ff00)); \
44} while (0)
45#else
46#define __DO_IRQ_SMTC_HOOK() do { } while (0)
47#endif
48
29#ifdef CONFIG_PREEMPT 49#ifdef CONFIG_PREEMPT
30 50
31/* 51/*
@@ -39,6 +59,7 @@ extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs);
39#define do_IRQ(irq, regs) \ 59#define do_IRQ(irq, regs) \
40do { \ 60do { \
41 irq_enter(); \ 61 irq_enter(); \
62 __DO_IRQ_SMTC_HOOK(); \
42 __do_IRQ((irq), (regs)); \ 63 __do_IRQ((irq), (regs)); \
43 irq_exit(); \ 64 irq_exit(); \
44} while (0) 65} while (0)
@@ -46,5 +67,14 @@ do { \
46#endif 67#endif
47 68
48extern void arch_init_irq(void); 69extern void arch_init_irq(void);
70extern void spurious_interrupt(struct pt_regs *regs);
71
72#ifdef CONFIG_MIPS_MT_SMTC
73struct irqaction;
74
75extern unsigned long irq_hwmask[];
76extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
77 unsigned long hwmask);
78#endif /* CONFIG_MIPS_MT_SMTC */
49 79
50#endif /* _ASM_IRQ_H */ 80#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/kspd.h b/include/asm-mips/kspd.h
new file mode 100644
index 000000000000..4e9e724c8935
--- /dev/null
+++ b/include/asm-mips/kspd.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_KSPD_H
20#define _ASM_KSPD_H
21
22struct kspd_notifications {
23 void (*kspd_sp_exit)(int sp_id);
24
25 struct list_head list;
26};
27
28#ifdef CONFIG_MIPS_APSP_KSPD
29extern void kspd_notify(struct kspd_notifications *notify);
30#else
31static inline void kspd_notify(struct kspd_notifications *notify)
32{
33}
34#endif
35
36#endif
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index 550979a9ea9d..e3315359500a 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -104,65 +104,107 @@ static __inline__ unsigned long ide_default_io_base(int index)
104#endif 104#endif
105 105
106/* MIPS port and memory-mapped I/O string operations. */ 106/* MIPS port and memory-mapped I/O string operations. */
107static inline void __ide_flush_prologue(void)
108{
109#ifdef CONFIG_SMP
110 if (cpu_has_dc_aliases)
111 preempt_disable();
112#endif
113}
114
115static inline void __ide_flush_epilogue(void)
116{
117#ifdef CONFIG_SMP
118 if (cpu_has_dc_aliases)
119 preempt_enable();
120#endif
121}
107 122
108static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size) 123static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)
109{ 124{
110 if (cpu_has_dc_aliases) { 125 if (cpu_has_dc_aliases) {
111 unsigned long end = addr + size; 126 unsigned long end = addr + size;
112 for (; addr < end; addr += PAGE_SIZE) 127
113 flush_dcache_page(virt_to_page(addr)); 128 while (addr < end) {
129 local_flush_data_cache_page((void *)addr);
130 addr += PAGE_SIZE;
131 }
114 } 132 }
115} 133}
116 134
135/*
136 * insw() and gang might be called with interrupts disabled, so we can't
137 * send IPIs for flushing due to the potencial of deadlocks, see the comment
138 * above smp_call_function() in arch/mips/kernel/smp.c. We work around the
139 * problem by disabling preemption so we know we actually perform the flush
140 * on the processor that actually has the lines to be flushed which hopefully
141 * is even better for performance anyway.
142 */
117static inline void __ide_insw(unsigned long port, void *addr, 143static inline void __ide_insw(unsigned long port, void *addr,
118 unsigned int count) 144 unsigned int count)
119{ 145{
146 __ide_flush_prologue();
120 insw(port, addr, count); 147 insw(port, addr, count);
121 __ide_flush_dcache_range((unsigned long)addr, count * 2); 148 __ide_flush_dcache_range((unsigned long)addr, count * 2);
149 __ide_flush_epilogue();
122} 150}
123 151
124static inline void __ide_insl(unsigned long port, void *addr, unsigned int count) 152static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
125{ 153{
154 __ide_flush_prologue();
126 insl(port, addr, count); 155 insl(port, addr, count);
127 __ide_flush_dcache_range((unsigned long)addr, count * 4); 156 __ide_flush_dcache_range((unsigned long)addr, count * 4);
157 __ide_flush_epilogue();
128} 158}
129 159
130static inline void __ide_outsw(unsigned long port, const void *addr, 160static inline void __ide_outsw(unsigned long port, const void *addr,
131 unsigned long count) 161 unsigned long count)
132{ 162{
163 __ide_flush_prologue();
133 outsw(port, addr, count); 164 outsw(port, addr, count);
134 __ide_flush_dcache_range((unsigned long)addr, count * 2); 165 __ide_flush_dcache_range((unsigned long)addr, count * 2);
166 __ide_flush_epilogue();
135} 167}
136 168
137static inline void __ide_outsl(unsigned long port, const void *addr, 169static inline void __ide_outsl(unsigned long port, const void *addr,
138 unsigned long count) 170 unsigned long count)
139{ 171{
172 __ide_flush_prologue();
140 outsl(port, addr, count); 173 outsl(port, addr, count);
141 __ide_flush_dcache_range((unsigned long)addr, count * 4); 174 __ide_flush_dcache_range((unsigned long)addr, count * 4);
175 __ide_flush_epilogue();
142} 176}
143 177
144static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count) 178static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
145{ 179{
180 __ide_flush_prologue();
146 readsw(port, addr, count); 181 readsw(port, addr, count);
147 __ide_flush_dcache_range((unsigned long)addr, count * 2); 182 __ide_flush_dcache_range((unsigned long)addr, count * 2);
183 __ide_flush_epilogue();
148} 184}
149 185
150static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count) 186static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
151{ 187{
188 __ide_flush_prologue();
152 readsl(port, addr, count); 189 readsl(port, addr, count);
153 __ide_flush_dcache_range((unsigned long)addr, count * 4); 190 __ide_flush_dcache_range((unsigned long)addr, count * 4);
191 __ide_flush_epilogue();
154} 192}
155 193
156static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count) 194static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
157{ 195{
196 __ide_flush_prologue();
158 writesw(port, addr, count); 197 writesw(port, addr, count);
159 __ide_flush_dcache_range((unsigned long)addr, count * 2); 198 __ide_flush_dcache_range((unsigned long)addr, count * 2);
199 __ide_flush_epilogue();
160} 200}
161 201
162static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count) 202static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
163{ 203{
204 __ide_flush_prologue();
164 writesl(port, addr, count); 205 writesl(port, addr, count);
165 __ide_flush_dcache_range((unsigned long)addr, count * 4); 206 __ide_flush_dcache_range((unsigned long)addr, count * 4);
207 __ide_flush_epilogue();
166} 208}
167 209
168/* ide_insw calls insw, not __ide_insw. Why? */ 210/* ide_insw calls insw, not __ide_insw. Why? */
diff --git a/include/asm-mips/mach-jmr3927/ds1742.h b/include/asm-mips/mach-jmr3927/ds1742.h
index cff6192d4bdb..8a8fef6d07fa 100644
--- a/include/asm-mips/mach-jmr3927/ds1742.h
+++ b/include/asm-mips/mach-jmr3927/ds1742.h
@@ -3,14 +3,14 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003 by Ralf Baechle 6 * Copyright (C) 2003, 06 by Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_JMR3927_DS1742_H 8#ifndef __ASM_MACH_JMR3927_DS1742_H
9#define __ASM_MACH_JMR3927_DS1742_H 9#define __ASM_MACH_JMR3927_DS1742_H
10 10
11#include <asm/jmr3927/jmr3927.h> 11#include <asm/jmr3927/jmr3927.h>
12 12
13#define rtc_read(reg) (jmr3927_nvram_in(addr)) 13#define rtc_read(reg) (jmr3927_nvram_in(reg))
14#define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg))) 14#define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg)))
15 15
16#endif /* __ASM_MACH_JMR3927_DS1742_H */ 16#endif /* __ASM_MACH_JMR3927_DS1742_H */
diff --git a/include/asm-mips/mach-mips/param.h b/include/asm-mips/mach-mips/param.h
new file mode 100644
index 000000000000..805ef6d27d3c
--- /dev/null
+++ b/include/asm-mips/mach-mips/param.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_MIPS_PARAM_H
9#define __ASM_MACH_MIPS_PARAM_H
10
11#define HZ 100 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_MIPS_PARAM_H */
diff --git a/include/asm-mips/marvell.h b/include/asm-mips/marvell.h
index 9225b3397a4f..6bb2125bb053 100644
--- a/include/asm-mips/marvell.h
+++ b/include/asm-mips/marvell.h
@@ -53,4 +53,6 @@ struct mv_pci_controller {
53 unsigned long config_vreg; 53 unsigned long config_vreg;
54}; 54};
55 55
56extern void ll_mv64340_irq(struct pt_regs *regs);
57
56#endif /* __ASM_MIPS_MARVELL_H */ 58#endif /* __ASM_MIPS_MARVELL_H */
diff --git a/include/asm-mips/mips-boards/atlas.h b/include/asm-mips/mips-boards/atlas.h
index 0998151fb3a1..a8ae12d120ee 100644
--- a/include/asm-mips/mips-boards/atlas.h
+++ b/include/asm-mips/mips-boards/atlas.h
@@ -33,13 +33,29 @@
33#define ATLAS_RTC_ADR_REG 0x1f000800 33#define ATLAS_RTC_ADR_REG 0x1f000800
34#define ATLAS_RTC_DAT_REG 0x1f000808 34#define ATLAS_RTC_DAT_REG 0x1f000808
35 35
36
37/* 36/*
38 * Atlas interrupt controller register base. 37 * Atlas interrupt controller register base.
39 */ 38 */
40#define ATLAS_ICTRL_REGS_BASE 0x1f000000 39#define ATLAS_ICTRL_REGS_BASE 0x1f000000
41 40
42/* 41/*
42 * Atlas registers are memory mapped on 64-bit aligned boundaries and
43 * only word access are allowed.
44 */
45struct atlas_ictrl_regs {
46 volatile unsigned int intraw;
47 int dummy1;
48 volatile unsigned int intseten;
49 int dummy2;
50 volatile unsigned int intrsten;
51 int dummy3;
52 volatile unsigned int intenable;
53 int dummy4;
54 volatile unsigned int intstatus;
55 int dummy5;
56};
57
58/*
43 * Atlas UART register base. 59 * Atlas UART register base.
44 */ 60 */
45#define ATLAS_UART_REGS_BASE 0x1f000900 61#define ATLAS_UART_REGS_BASE 0x1f000900
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
index bba35c183d08..fd7ebc54fa90 100644
--- a/include/asm-mips/mips-boards/atlasint.h
+++ b/include/asm-mips/mips-boards/atlasint.h
@@ -62,23 +62,4 @@
62#define ATLASINT_RES31 (ATLASINT_BASE+31) 62#define ATLASINT_RES31 (ATLASINT_BASE+31)
63#define ATLASINT_END (ATLASINT_BASE+31) 63#define ATLASINT_END (ATLASINT_BASE+31)
64 64
65/*
66 * Atlas registers are memory mapped on 64-bit aligned boundaries and
67 * only word access are allowed.
68 */
69struct atlas_ictrl_regs {
70 volatile unsigned int intraw;
71 int dummy1;
72 volatile unsigned int intseten;
73 int dummy2;
74 volatile unsigned int intrsten;
75 int dummy3;
76 volatile unsigned int intenable;
77 int dummy4;
78 volatile unsigned int intstatus;
79 int dummy5;
80};
81
82extern void atlasint_init(void);
83
84#endif /* !(_MIPS_ATLASINT_H) */ 65#endif /* !(_MIPS_ATLASINT_H) */
diff --git a/include/asm-mips/mips_mt.h b/include/asm-mips/mips_mt.h
new file mode 100644
index 000000000000..c31a312b9783
--- /dev/null
+++ b/include/asm-mips/mips_mt.h
@@ -0,0 +1,15 @@
1/*
2 * Definitions and decalrations for MIPS MT support
3 * that are common between SMTC, VSMP, and/or AP/SP
4 * kernel models.
5 */
6#ifndef __ASM_MIPS_MT_H
7#define __ASM_MIPS_MT_H
8
9extern cpumask_t mt_fpu_cpumask;
10extern unsigned long mt_fpemul_threshold;
11
12extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
13extern void mips_mt_set_cpuoptions(void);
14
15#endif /* __ASM_MIPS_MT_H */
diff --git a/include/asm-mips/mipsmtregs.h b/include/asm-mips/mipsmtregs.h
index a669c0702c66..f637ce70758f 100644
--- a/include/asm-mips/mipsmtregs.h
+++ b/include/asm-mips/mipsmtregs.h
@@ -165,7 +165,7 @@
165 165
166#ifndef __ASSEMBLY__ 166#ifndef __ASSEMBLY__
167 167
168extern void mips_mt_regdump(void); 168extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
169 169
170static inline unsigned int dvpe(void) 170static inline unsigned int dvpe(void)
171{ 171{
@@ -234,7 +234,7 @@ static inline void __raw_emt(void)
234 __asm__ __volatile__( 234 __asm__ __volatile__(
235 " .set noreorder \n" 235 " .set noreorder \n"
236 " .set mips32r2 \n" 236 " .set mips32r2 \n"
237 " emt \n" 237 " .word 0x41600be1 # emt \n"
238 " ehb \n" 238 " ehb \n"
239 " .set mips0 \n" 239 " .set mips0 \n"
240 " .set reorder"); 240 " .set reorder");
@@ -282,8 +282,11 @@ static inline void ehb(void)
282 \ 282 \
283 __asm__ __volatile__( \ 283 __asm__ __volatile__( \
284 " .set push \n" \ 284 " .set push \n" \
285 " .set noat \n" \
285 " .set mips32r2 \n" \ 286 " .set mips32r2 \n" \
286 " mftgpr %0," #rt " \n" \ 287 " # mftgpr $1," #rt " \n" \
288 " .word 0x41000820 | (" #rt " << 16) \n" \
289 " move %0, $1 \n" \
287 " .set pop \n" \ 290 " .set pop \n" \
288 : "=r" (__res)); \ 291 : "=r" (__res)); \
289 \ 292 \
@@ -295,9 +298,7 @@ static inline void ehb(void)
295 unsigned long __res; \ 298 unsigned long __res; \
296 \ 299 \
297 __asm__ __volatile__( \ 300 __asm__ __volatile__( \
298 ".set noat\n\t" \ 301 " mftr %0, " #rt ", " #u ", " #sel " \n" \
299 "mftr\t%0, " #rt ", " #u ", " #sel "\n\t" \
300 ".set at\n\t" \
301 : "=r" (__res)); \ 302 : "=r" (__res)); \
302 \ 303 \
303 __res; \ 304 __res; \
@@ -364,6 +365,9 @@ do { \
364#define read_vpe_c0_ebase() mftc0(15,1) 365#define read_vpe_c0_ebase() mftc0(15,1)
365#define write_vpe_c0_ebase(val) mttc0(15, 1, val) 366#define write_vpe_c0_ebase(val) mttc0(15, 1, val)
366#define write_vpe_c0_compare(val) mttc0(11, 0, val) 367#define write_vpe_c0_compare(val) mttc0(11, 0, val)
368#define read_vpe_c0_badvaddr() mftc0(8, 0)
369#define read_vpe_c0_epc() mftc0(14, 0)
370#define write_vpe_c0_epc(val) mttc0(14, 0, val)
367 371
368 372
369/* TC */ 373/* TC */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 035ba0a9b0df..a2ef579f6b1a 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -836,6 +836,9 @@ do { \
836#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */ 836#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
837#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val) 837#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
838 838
839#define read_c0_badvaddr() __read_ulong_c0_register($8, 0)
840#define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
841
839#define read_c0_count() __read_32bit_c0_register($9, 0) 842#define read_c0_count() __read_32bit_c0_register($9, 0)
840#define write_c0_count(val) __write_32bit_c0_register($9, 0, val) 843#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
841 844
@@ -858,7 +861,19 @@ do { \
858#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val) 861#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
859 862
860#define read_c0_status() __read_32bit_c0_register($12, 0) 863#define read_c0_status() __read_32bit_c0_register($12, 0)
864#ifdef CONFIG_MIPS_MT_SMTC
865#define write_c0_status(val) \
866do { \
867 __write_32bit_c0_register($12, 0, val); \
868 __ehb(); \
869} while (0)
870#else
871/*
872 * Legacy non-SMTC code, which may be hazardous
873 * but which might not support EHB
874 */
861#define write_c0_status(val) __write_32bit_c0_register($12, 0, val) 875#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
876#endif /* CONFIG_MIPS_MT_SMTC */
862 877
863#define read_c0_cause() __read_32bit_c0_register($13, 0) 878#define read_c0_cause() __read_32bit_c0_register($13, 0)
864#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val) 879#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
@@ -1001,6 +1016,9 @@ do { \
1001#define read_c0_taglo() __read_32bit_c0_register($28, 0) 1016#define read_c0_taglo() __read_32bit_c0_register($28, 0)
1002#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val) 1017#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
1003 1018
1019#define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
1020#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
1021
1004#define read_c0_taghi() __read_32bit_c0_register($29, 0) 1022#define read_c0_taghi() __read_32bit_c0_register($29, 0)
1005#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val) 1023#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
1006 1024
@@ -1354,15 +1372,119 @@ static inline void tlb_write_random(void)
1354/* 1372/*
1355 * Manipulate bits in a c0 register. 1373 * Manipulate bits in a c0 register.
1356 */ 1374 */
1375#ifndef CONFIG_MIPS_MT_SMTC
1376/*
1377 * SMTC Linux requires shutting-down microthread scheduling
1378 * during CP0 register read-modify-write sequences.
1379 */
1380#define __BUILD_SET_C0(name) \
1381static inline unsigned int \
1382set_c0_##name(unsigned int set) \
1383{ \
1384 unsigned int res; \
1385 \
1386 res = read_c0_##name(); \
1387 res |= set; \
1388 write_c0_##name(res); \
1389 \
1390 return res; \
1391} \
1392 \
1393static inline unsigned int \
1394clear_c0_##name(unsigned int clear) \
1395{ \
1396 unsigned int res; \
1397 \
1398 res = read_c0_##name(); \
1399 res &= ~clear; \
1400 write_c0_##name(res); \
1401 \
1402 return res; \
1403} \
1404 \
1405static inline unsigned int \
1406change_c0_##name(unsigned int change, unsigned int new) \
1407{ \
1408 unsigned int res; \
1409 \
1410 res = read_c0_##name(); \
1411 res &= ~change; \
1412 res |= (new & change); \
1413 write_c0_##name(res); \
1414 \
1415 return res; \
1416}
1417
1418#else /* SMTC versions that manage MT scheduling */
1419
1420#include <asm/interrupt.h>
1421
1422/*
1423 * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with
1424 * header file recursion.
1425 */
1426static inline unsigned int __dmt(void)
1427{
1428 int res;
1429
1430 __asm__ __volatile__(
1431 " .set push \n"
1432 " .set mips32r2 \n"
1433 " .set noat \n"
1434 " .word 0x41610BC1 # dmt $1 \n"
1435 " ehb \n"
1436 " move %0, $1 \n"
1437 " .set pop \n"
1438 : "=r" (res));
1439
1440 instruction_hazard();
1441
1442 return res;
1443}
1444
1445#define __VPECONTROL_TE_SHIFT 15
1446#define __VPECONTROL_TE (1UL << __VPECONTROL_TE_SHIFT)
1447
1448#define __EMT_ENABLE __VPECONTROL_TE
1449
1450static inline void __emt(unsigned int previous)
1451{
1452 if ((previous & __EMT_ENABLE))
1453 __asm__ __volatile__(
1454 " .set noreorder \n"
1455 " .set mips32r2 \n"
1456 " .word 0x41600be1 # emt \n"
1457 " ehb \n"
1458 " .set mips0 \n"
1459 " .set reorder \n");
1460}
1461
1462static inline void __ehb(void)
1463{
1464 __asm__ __volatile__(
1465 " ehb \n");
1466}
1467
1468/*
1469 * Note that local_irq_save/restore affect TC-specific IXMT state,
1470 * not Status.IE as in non-SMTC kernel.
1471 */
1472
1357#define __BUILD_SET_C0(name) \ 1473#define __BUILD_SET_C0(name) \
1358static inline unsigned int \ 1474static inline unsigned int \
1359set_c0_##name(unsigned int set) \ 1475set_c0_##name(unsigned int set) \
1360{ \ 1476{ \
1361 unsigned int res; \ 1477 unsigned int res; \
1478 unsigned int omt; \
1479 unsigned int flags; \
1362 \ 1480 \
1481 local_irq_save(flags); \
1482 omt = __dmt(); \
1363 res = read_c0_##name(); \ 1483 res = read_c0_##name(); \
1364 res |= set; \ 1484 res |= set; \
1365 write_c0_##name(res); \ 1485 write_c0_##name(res); \
1486 __emt(omt); \
1487 local_irq_restore(flags); \
1366 \ 1488 \
1367 return res; \ 1489 return res; \
1368} \ 1490} \
@@ -1371,10 +1493,16 @@ static inline unsigned int \
1371clear_c0_##name(unsigned int clear) \ 1493clear_c0_##name(unsigned int clear) \
1372{ \ 1494{ \
1373 unsigned int res; \ 1495 unsigned int res; \
1496 unsigned int omt; \
1497 unsigned int flags; \
1374 \ 1498 \
1499 local_irq_save(flags); \
1500 omt = __dmt(); \
1375 res = read_c0_##name(); \ 1501 res = read_c0_##name(); \
1376 res &= ~clear; \ 1502 res &= ~clear; \
1377 write_c0_##name(res); \ 1503 write_c0_##name(res); \
1504 __emt(omt); \
1505 local_irq_restore(flags); \
1378 \ 1506 \
1379 return res; \ 1507 return res; \
1380} \ 1508} \
@@ -1383,14 +1511,22 @@ static inline unsigned int \
1383change_c0_##name(unsigned int change, unsigned int new) \ 1511change_c0_##name(unsigned int change, unsigned int new) \
1384{ \ 1512{ \
1385 unsigned int res; \ 1513 unsigned int res; \
1514 unsigned int omt; \
1515 unsigned int flags; \
1386 \ 1516 \
1517 local_irq_save(flags); \
1518 \
1519 omt = __dmt(); \
1387 res = read_c0_##name(); \ 1520 res = read_c0_##name(); \
1388 res &= ~change; \ 1521 res &= ~change; \
1389 res |= (new & change); \ 1522 res |= (new & change); \
1390 write_c0_##name(res); \ 1523 write_c0_##name(res); \
1524 __emt(omt); \
1525 local_irq_restore(flags); \
1391 \ 1526 \
1392 return res; \ 1527 return res; \
1393} 1528}
1529#endif
1394 1530
1395__BUILD_SET_C0(status) 1531__BUILD_SET_C0(status)
1396__BUILD_SET_C0(cause) 1532__BUILD_SET_C0(cause)
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 61cf22588137..6e09f4c87211 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -17,6 +17,10 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20#ifdef CONFIG_MIPS_MT_SMTC
21#include <asm/mipsmtregs.h>
22#include <asm/smtc.h>
23#endif /* SMTC */
20 24
21/* 25/*
22 * For the fast tlb miss handlers, we keep a per cpu array of pointers 26 * For the fast tlb miss handlers, we keep a per cpu array of pointers
@@ -54,6 +58,14 @@ extern unsigned long pgd_current[];
54#define ASID_INC 0x1 58#define ASID_INC 0x1
55#define ASID_MASK 0xfff 59#define ASID_MASK 0xfff
56 60
61/* SMTC/34K debug hack - but maybe we'll keep it */
62#elif defined(CONFIG_MIPS_MT_SMTC)
63
64#define ASID_INC 0x1
65extern unsigned long smtc_asid_mask;
66#define ASID_MASK (smtc_asid_mask)
67#define HW_ASID_MASK 0xff
68/* End SMTC/34K debug hack */
57#else /* FIXME: not correct for R6000 */ 69#else /* FIXME: not correct for R6000 */
58 70
59#define ASID_INC 0x1 71#define ASID_INC 0x1
@@ -76,6 +88,8 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
76#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1))) 88#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
77#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1) 89#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
78 90
91#ifndef CONFIG_MIPS_MT_SMTC
92/* Normal, classic MIPS get_new_mmu_context */
79static inline void 93static inline void
80get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) 94get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
81{ 95{
@@ -91,6 +105,12 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
91 cpu_context(cpu, mm) = asid_cache(cpu) = asid; 105 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
92} 106}
93 107
108#else /* CONFIG_MIPS_MT_SMTC */
109
110#define get_new_mmu_context(mm,cpu) smtc_get_new_mmu_context((mm),(cpu))
111
112#endif /* CONFIG_MIPS_MT_SMTC */
113
94/* 114/*
95 * Initialize the context related info for a new mm_struct 115 * Initialize the context related info for a new mm_struct
96 * instance. 116 * instance.
@@ -111,14 +131,46 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
111{ 131{
112 unsigned int cpu = smp_processor_id(); 132 unsigned int cpu = smp_processor_id();
113 unsigned long flags; 133 unsigned long flags;
114 134#ifdef CONFIG_MIPS_MT_SMTC
135 unsigned long oldasid;
136 unsigned long mtflags;
137 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
115 local_irq_save(flags); 138 local_irq_save(flags);
139 mtflags = dvpe();
140#else /* Not SMTC */
141 local_irq_save(flags);
142#endif /* CONFIG_MIPS_MT_SMTC */
116 143
117 /* Check if our ASID is of an older version and thus invalid */ 144 /* Check if our ASID is of an older version and thus invalid */
118 if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK) 145 if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK)
119 get_new_mmu_context(next, cpu); 146 get_new_mmu_context(next, cpu);
120 147#ifdef CONFIG_MIPS_MT_SMTC
148 /*
149 * If the EntryHi ASID being replaced happens to be
150 * the value flagged at ASID recycling time as having
151 * an extended life, clear the bit showing it being
152 * in use by this "CPU", and if that's the last bit,
153 * free up the ASID value for use and flush any old
154 * instances of it from the TLB.
155 */
156 oldasid = (read_c0_entryhi() & ASID_MASK);
157 if(smtc_live_asid[mytlb][oldasid]) {
158 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
159 if(smtc_live_asid[mytlb][oldasid] == 0)
160 smtc_flush_tlb_asid(oldasid);
161 }
162 /*
163 * Tread softly on EntryHi, and so long as we support
164 * having ASID_MASK smaller than the hardware maximum,
165 * make sure no "soft" bits become "hard"...
166 */
167 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK)
168 | (cpu_context(cpu, next) & ASID_MASK));
169 ehb(); /* Make sure it propagates to TCStatus */
170 evpe(mtflags);
171#else
121 write_c0_entryhi(cpu_context(cpu, next)); 172 write_c0_entryhi(cpu_context(cpu, next));
173#endif /* CONFIG_MIPS_MT_SMTC */
122 TLBMISS_HANDLER_SETUP_PGD(next->pgd); 174 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
123 175
124 /* 176 /*
@@ -151,12 +203,34 @@ activate_mm(struct mm_struct *prev, struct mm_struct *next)
151 unsigned long flags; 203 unsigned long flags;
152 unsigned int cpu = smp_processor_id(); 204 unsigned int cpu = smp_processor_id();
153 205
206#ifdef CONFIG_MIPS_MT_SMTC
207 unsigned long oldasid;
208 unsigned long mtflags;
209 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
210#endif /* CONFIG_MIPS_MT_SMTC */
211
154 local_irq_save(flags); 212 local_irq_save(flags);
155 213
156 /* Unconditionally get a new ASID. */ 214 /* Unconditionally get a new ASID. */
157 get_new_mmu_context(next, cpu); 215 get_new_mmu_context(next, cpu);
158 216
217#ifdef CONFIG_MIPS_MT_SMTC
218 /* See comments for similar code above */
219 mtflags = dvpe();
220 oldasid = read_c0_entryhi() & ASID_MASK;
221 if(smtc_live_asid[mytlb][oldasid]) {
222 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
223 if(smtc_live_asid[mytlb][oldasid] == 0)
224 smtc_flush_tlb_asid(oldasid);
225 }
226 /* See comments for similar code above */
227 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) |
228 (cpu_context(cpu, next) & ASID_MASK));
229 ehb(); /* Make sure it propagates to TCStatus */
230 evpe(mtflags);
231#else
159 write_c0_entryhi(cpu_context(cpu, next)); 232 write_c0_entryhi(cpu_context(cpu, next));
233#endif /* CONFIG_MIPS_MT_SMTC */
160 TLBMISS_HANDLER_SETUP_PGD(next->pgd); 234 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
161 235
162 /* mark mmu ownership change */ 236 /* mark mmu ownership change */
@@ -174,17 +248,49 @@ static inline void
174drop_mmu_context(struct mm_struct *mm, unsigned cpu) 248drop_mmu_context(struct mm_struct *mm, unsigned cpu)
175{ 249{
176 unsigned long flags; 250 unsigned long flags;
251#ifdef CONFIG_MIPS_MT_SMTC
252 unsigned long oldasid;
253 /* Can't use spinlock because called from TLB flush within DVPE */
254 unsigned int prevvpe;
255 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
256#endif /* CONFIG_MIPS_MT_SMTC */
177 257
178 local_irq_save(flags); 258 local_irq_save(flags);
179 259
180 if (cpu_isset(cpu, mm->cpu_vm_mask)) { 260 if (cpu_isset(cpu, mm->cpu_vm_mask)) {
181 get_new_mmu_context(mm, cpu); 261 get_new_mmu_context(mm, cpu);
262#ifdef CONFIG_MIPS_MT_SMTC
263 /* See comments for similar code above */
264 prevvpe = dvpe();
265 oldasid = (read_c0_entryhi() & ASID_MASK);
266 if(smtc_live_asid[mytlb][oldasid]) {
267 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
268 if(smtc_live_asid[mytlb][oldasid] == 0)
269 smtc_flush_tlb_asid(oldasid);
270 }
271 /* See comments for similar code above */
272 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK)
273 | cpu_asid(cpu, mm));
274 ehb(); /* Make sure it propagates to TCStatus */
275 evpe(prevvpe);
276#else /* not CONFIG_MIPS_MT_SMTC */
182 write_c0_entryhi(cpu_asid(cpu, mm)); 277 write_c0_entryhi(cpu_asid(cpu, mm));
278#endif /* CONFIG_MIPS_MT_SMTC */
183 } else { 279 } else {
184 /* will get a new context next time */ 280 /* will get a new context next time */
281#ifndef CONFIG_MIPS_MT_SMTC
185 cpu_context(cpu, mm) = 0; 282 cpu_context(cpu, mm) = 0;
283#else /* SMTC */
284 int i;
285
286 /* SMTC shares the TLB (and ASIDs) across VPEs */
287 for (i = 0; i < num_online_cpus(); i++) {
288 if((smtc_status & SMTC_TLB_SHARED)
289 || (cpu_data[i].vpe_id == cpu_data[cpu].vpe_id))
290 cpu_context(i, mm) = 0;
291 }
292#endif /* CONFIG_MIPS_MT_SMTC */
186 } 293 }
187
188 local_irq_restore(flags); 294 local_irq_restore(flags);
189} 295}
190 296
diff --git a/include/asm-mips/numnodes.h b/include/asm-mips/numnodes.h
deleted file mode 100644
index 4f00c16ceeb0..000000000000
--- a/include/asm-mips/numnodes.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 128 Nodes */
5#define NODES_SHIFT 6
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 39d2bd50fece..0fb75f0762e0 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -12,6 +12,7 @@
12#define _ASM_PROCESSOR_H 12#define _ASM_PROCESSOR_H
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/cpumask.h>
15#include <linux/threads.h> 16#include <linux/threads.h>
16 17
17#include <asm/cachectl.h> 18#include <asm/cachectl.h>
@@ -107,6 +108,10 @@ struct mips_dsp_state {
107 108
108#define INIT_DSP {{0,},} 109#define INIT_DSP {{0,},}
109 110
111#define INIT_CPUMASK { \
112 {0,} \
113}
114
110typedef struct { 115typedef struct {
111 unsigned long seg; 116 unsigned long seg;
112} mm_segment_t; 117} mm_segment_t;
@@ -129,6 +134,12 @@ struct thread_struct {
129 134
130 /* Saved fpu/fpu emulator stuff. */ 135 /* Saved fpu/fpu emulator stuff. */
131 union mips_fpu_union fpu; 136 union mips_fpu_union fpu;
137#ifdef CONFIG_MIPS_MT_FPAFF
138 /* Emulated instruction count */
139 unsigned long emulated_fp;
140 /* Saved per-thread scheduler affinity mask */
141 cpumask_t user_cpus_allowed;
142#endif /* CONFIG_MIPS_MT_FPAFF */
132 143
133 /* Saved state of the DSP ASE, if available. */ 144 /* Saved state of the DSP ASE, if available. */
134 struct mips_dsp_state dsp; 145 struct mips_dsp_state dsp;
@@ -142,6 +153,7 @@ struct thread_struct {
142#define MF_LOGADE 2 /* Log address errors to syslog */ 153#define MF_LOGADE 2 /* Log address errors to syslog */
143#define MF_32BIT_REGS 4 /* also implies 16/32 fprs */ 154#define MF_32BIT_REGS 4 /* also implies 16/32 fprs */
144#define MF_32BIT_ADDR 8 /* 32-bit address space (o32/n32) */ 155#define MF_32BIT_ADDR 8 /* 32-bit address space (o32/n32) */
156#define MF_FPUBOUND 0x10 /* thread bound to FPU-full CPU set */
145 unsigned long mflags; 157 unsigned long mflags;
146 unsigned long irix_trampoline; /* Wheee... */ 158 unsigned long irix_trampoline; /* Wheee... */
147 unsigned long irix_oldctx; 159 unsigned long irix_oldctx;
@@ -153,6 +165,12 @@ struct thread_struct {
153#define MF_N32 MF_32BIT_ADDR 165#define MF_N32 MF_32BIT_ADDR
154#define MF_N64 0 166#define MF_N64 0
155 167
168#ifdef CONFIG_MIPS_MT_FPAFF
169#define FPAFF_INIT 0, INIT_CPUMASK,
170#else
171#define FPAFF_INIT
172#endif /* CONFIG_MIPS_MT_FPAFF */
173
156#define INIT_THREAD { \ 174#define INIT_THREAD { \
157 /* \ 175 /* \
158 * saved main processor registers \ 176 * saved main processor registers \
@@ -168,6 +186,10 @@ struct thread_struct {
168 */ \ 186 */ \
169 INIT_FPU, \ 187 INIT_FPU, \
170 /* \ 188 /* \
189 * fpu affinity state (null if not FPAFF) \
190 */ \
191 FPAFF_INIT \
192 /* \
171 * saved dsp/dsp emulator stuff \ 193 * saved dsp/dsp emulator stuff \
172 */ \ 194 */ \
173 INIT_DSP, \ 195 INIT_DSP, \
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 95c5839ac465..fa9d8713c12a 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -45,6 +45,10 @@ struct pt_regs {
45 unsigned long cp0_badvaddr; 45 unsigned long cp0_badvaddr;
46 unsigned long cp0_cause; 46 unsigned long cp0_cause;
47 unsigned long cp0_epc; 47 unsigned long cp0_epc;
48#ifdef CONFIG_MIPS_MT_SMTC
49 unsigned long cp0_tcstatus;
50 unsigned long smtc_pad;
51#endif /* CONFIG_MIPS_MT_SMTC */
48}; 52};
49 53
50/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 54/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index 90c374700977..3c8e3c8d1a9a 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -15,6 +15,7 @@
15#include <asm/asm.h> 15#include <asm/asm.h>
16#include <asm/cacheops.h> 16#include <asm/cacheops.h>
17#include <asm/cpu-features.h> 17#include <asm/cpu-features.h>
18#include <asm/mipsmtregs.h>
18 19
19/* 20/*
20 * This macro return a properly sign-extended address suitable as base address 21 * This macro return a properly sign-extended address suitable as base address
@@ -37,16 +38,120 @@
37 " cache %0, %1 \n" \ 38 " cache %0, %1 \n" \
38 " .set pop \n" \ 39 " .set pop \n" \
39 : \ 40 : \
40 : "i" (op), "m" (*(unsigned char *)(addr))) 41 : "i" (op), "R" (*(unsigned char *)(addr)))
42
43#ifdef CONFIG_MIPS_MT
44/*
45 * Temporary hacks for SMTC debug. Optionally force single-threaded
46 * execution during I-cache flushes.
47 */
48
49#define PROTECT_CACHE_FLUSHES 1
50
51#ifdef PROTECT_CACHE_FLUSHES
52
53extern int mt_protiflush;
54extern int mt_protdflush;
55extern void mt_cflush_lockdown(void);
56extern void mt_cflush_release(void);
57
58#define BEGIN_MT_IPROT \
59 unsigned long flags = 0; \
60 unsigned long mtflags = 0; \
61 if(mt_protiflush) { \
62 local_irq_save(flags); \
63 ehb(); \
64 mtflags = dvpe(); \
65 mt_cflush_lockdown(); \
66 }
67
68#define END_MT_IPROT \
69 if(mt_protiflush) { \
70 mt_cflush_release(); \
71 evpe(mtflags); \
72 local_irq_restore(flags); \
73 }
74
75#define BEGIN_MT_DPROT \
76 unsigned long flags = 0; \
77 unsigned long mtflags = 0; \
78 if(mt_protdflush) { \
79 local_irq_save(flags); \
80 ehb(); \
81 mtflags = dvpe(); \
82 mt_cflush_lockdown(); \
83 }
84
85#define END_MT_DPROT \
86 if(mt_protdflush) { \
87 mt_cflush_release(); \
88 evpe(mtflags); \
89 local_irq_restore(flags); \
90 }
91
92#else
93
94#define BEGIN_MT_IPROT
95#define BEGIN_MT_DPROT
96#define END_MT_IPROT
97#define END_MT_DPROT
98
99#endif /* PROTECT_CACHE_FLUSHES */
100
101#define __iflush_prologue \
102 unsigned long redundance; \
103 extern int mt_n_iflushes; \
104 BEGIN_MT_IPROT \
105 for (redundance = 0; redundance < mt_n_iflushes; redundance++) {
106
107#define __iflush_epilogue \
108 END_MT_IPROT \
109 }
110
111#define __dflush_prologue \
112 unsigned long redundance; \
113 extern int mt_n_dflushes; \
114 BEGIN_MT_DPROT \
115 for (redundance = 0; redundance < mt_n_dflushes; redundance++) {
116
117#define __dflush_epilogue \
118 END_MT_DPROT \
119 }
120
121#define __inv_dflush_prologue __dflush_prologue
122#define __inv_dflush_epilogue __dflush_epilogue
123#define __sflush_prologue {
124#define __sflush_epilogue }
125#define __inv_sflush_prologue __sflush_prologue
126#define __inv_sflush_epilogue __sflush_epilogue
127
128#else /* CONFIG_MIPS_MT */
129
130#define __iflush_prologue {
131#define __iflush_epilogue }
132#define __dflush_prologue {
133#define __dflush_epilogue }
134#define __inv_dflush_prologue {
135#define __inv_dflush_epilogue }
136#define __sflush_prologue {
137#define __sflush_epilogue }
138#define __inv_sflush_prologue {
139#define __inv_sflush_epilogue }
140
141#endif /* CONFIG_MIPS_MT */
41 142
42static inline void flush_icache_line_indexed(unsigned long addr) 143static inline void flush_icache_line_indexed(unsigned long addr)
43{ 144{
145 __iflush_prologue
44 cache_op(Index_Invalidate_I, addr); 146 cache_op(Index_Invalidate_I, addr);
147 __iflush_epilogue
45} 148}
46 149
47static inline void flush_dcache_line_indexed(unsigned long addr) 150static inline void flush_dcache_line_indexed(unsigned long addr)
48{ 151{
152 __dflush_prologue
49 cache_op(Index_Writeback_Inv_D, addr); 153 cache_op(Index_Writeback_Inv_D, addr);
154 __dflush_epilogue
50} 155}
51 156
52static inline void flush_scache_line_indexed(unsigned long addr) 157static inline void flush_scache_line_indexed(unsigned long addr)
@@ -56,17 +161,23 @@ static inline void flush_scache_line_indexed(unsigned long addr)
56 161
57static inline void flush_icache_line(unsigned long addr) 162static inline void flush_icache_line(unsigned long addr)
58{ 163{
164 __iflush_prologue
59 cache_op(Hit_Invalidate_I, addr); 165 cache_op(Hit_Invalidate_I, addr);
166 __iflush_epilogue
60} 167}
61 168
62static inline void flush_dcache_line(unsigned long addr) 169static inline void flush_dcache_line(unsigned long addr)
63{ 170{
171 __dflush_prologue
64 cache_op(Hit_Writeback_Inv_D, addr); 172 cache_op(Hit_Writeback_Inv_D, addr);
173 __dflush_epilogue
65} 174}
66 175
67static inline void invalidate_dcache_line(unsigned long addr) 176static inline void invalidate_dcache_line(unsigned long addr)
68{ 177{
178 __dflush_prologue
69 cache_op(Hit_Invalidate_D, addr); 179 cache_op(Hit_Invalidate_D, addr);
180 __dflush_epilogue
70} 181}
71 182
72static inline void invalidate_scache_line(unsigned long addr) 183static inline void invalidate_scache_line(unsigned long addr)
@@ -239,9 +350,13 @@ static inline void blast_##pfx##cache##lsize(void) \
239 current_cpu_data.desc.waybit; \ 350 current_cpu_data.desc.waybit; \
240 unsigned long ws, addr; \ 351 unsigned long ws, addr; \
241 \ 352 \
353 __##pfx##flush_prologue \
354 \
242 for (ws = 0; ws < ws_end; ws += ws_inc) \ 355 for (ws = 0; ws < ws_end; ws += ws_inc) \
243 for (addr = start; addr < end; addr += lsize * 32) \ 356 for (addr = start; addr < end; addr += lsize * 32) \
244 cache##lsize##_unroll32(addr|ws,indexop); \ 357 cache##lsize##_unroll32(addr|ws,indexop); \
358 \
359 __##pfx##flush_epilogue \
245} \ 360} \
246 \ 361 \
247static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \ 362static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
@@ -249,10 +364,14 @@ static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
249 unsigned long start = page; \ 364 unsigned long start = page; \
250 unsigned long end = page + PAGE_SIZE; \ 365 unsigned long end = page + PAGE_SIZE; \
251 \ 366 \
367 __##pfx##flush_prologue \
368 \
252 do { \ 369 do { \
253 cache##lsize##_unroll32(start,hitop); \ 370 cache##lsize##_unroll32(start,hitop); \
254 start += lsize * 32; \ 371 start += lsize * 32; \
255 } while (start < end); \ 372 } while (start < end); \
373 \
374 __##pfx##flush_epilogue \
256} \ 375} \
257 \ 376 \
258static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \ 377static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
@@ -265,9 +384,13 @@ static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page)
265 current_cpu_data.desc.waybit; \ 384 current_cpu_data.desc.waybit; \
266 unsigned long ws, addr; \ 385 unsigned long ws, addr; \
267 \ 386 \
387 __##pfx##flush_prologue \
388 \
268 for (ws = 0; ws < ws_end; ws += ws_inc) \ 389 for (ws = 0; ws < ws_end; ws += ws_inc) \
269 for (addr = start; addr < end; addr += lsize * 32) \ 390 for (addr = start; addr < end; addr += lsize * 32) \
270 cache##lsize##_unroll32(addr|ws,indexop); \ 391 cache##lsize##_unroll32(addr|ws,indexop); \
392 \
393 __##pfx##flush_epilogue \
271} 394}
272 395
273__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16) 396__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16)
@@ -288,12 +411,17 @@ static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
288 unsigned long lsize = cpu_##desc##_line_size(); \ 411 unsigned long lsize = cpu_##desc##_line_size(); \
289 unsigned long addr = start & ~(lsize - 1); \ 412 unsigned long addr = start & ~(lsize - 1); \
290 unsigned long aend = (end - 1) & ~(lsize - 1); \ 413 unsigned long aend = (end - 1) & ~(lsize - 1); \
414 \
415 __##pfx##flush_prologue \
416 \
291 while (1) { \ 417 while (1) { \
292 prot##cache_op(hitop, addr); \ 418 prot##cache_op(hitop, addr); \
293 if (addr == aend) \ 419 if (addr == aend) \
294 break; \ 420 break; \
295 addr += lsize; \ 421 addr += lsize; \
296 } \ 422 } \
423 \
424 __##pfx##flush_epilogue \
297} 425}
298 426
299__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_) 427__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_)
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index a2abc4572b63..82ad401c7dca 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -32,7 +32,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
32{ 32{
33 unsigned long nowtime; 33 unsigned long nowtime;
34 34
35 nowtime = rtc_get_time(); 35 nowtime = rtc_mips_get_time();
36 to_tm(nowtime, time); 36 to_tm(nowtime, time);
37 time->tm_year -= 1900; 37 time->tm_year -= 1900;
38 38
@@ -47,7 +47,7 @@ static inline int set_rtc_time(struct rtc_time *time)
47 nowtime = mktime(time->tm_year+1900, time->tm_mon+1, 47 nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
48 time->tm_mday, time->tm_hour, time->tm_min, 48 time->tm_mday, time->tm_hour, time->tm_min,
49 time->tm_sec); 49 time->tm_sec);
50 ret = rtc_set_time(nowtime); 50 ret = rtc_mips_set_time(nowtime);
51 51
52 return ret; 52 return ret;
53} 53}
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 1298c3fdf6c9..76cd51c6be39 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -3,32 +3,46 @@
3 * 3 *
4 */ 4 */
5 5
6#ifndef _RTLX_H 6#ifndef __ASM_RTLX_H
7#define _RTLX_H_ 7#define __ASM_RTLX_H_
8 8
9#define LX_NODE_BASE 10 9#define LX_NODE_BASE 10
10 10
11#define MIPSCPU_INT_BASE 16 11#define MIPSCPU_INT_BASE 16
12#define MIPS_CPU_RTLX_IRQ 0 12#define MIPS_CPU_RTLX_IRQ 0
13 13
14#define RTLX_VERSION 1 14#define RTLX_VERSION 2
15#define RTLX_xID 0x12345600 15#define RTLX_xID 0x12345600
16#define RTLX_ID (RTLX_xID | RTLX_VERSION) 16#define RTLX_ID (RTLX_xID | RTLX_VERSION)
17#define RTLX_CHANNELS 8 17#define RTLX_CHANNELS 8
18 18
19#define RTLX_BUFFER_SIZE 1024 19#define RTLX_CHANNEL_STDIO 0
20#define RTLX_CHANNEL_DBG 1
21#define RTLX_CHANNEL_SYSIO 2
20 22
21/* 23extern int rtlx_open(int index, int can_sleep);
22 * lx_state bits 24extern int rtlx_release(int index);
23 */ 25extern ssize_t rtlx_read(int index, void *buff, size_t count, int user);
24#define RTLX_STATE_OPENED 1UL 26extern ssize_t rtlx_write(int index, void *buffer, size_t count, int user);
27extern unsigned int rtlx_read_poll(int index, int can_sleep);
28extern unsigned int rtlx_write_poll(int index);
29
30enum rtlx_state {
31 RTLX_STATE_UNUSED,
32 RTLX_STATE_INITIALISED,
33 RTLX_STATE_REMOTE_READY,
34 RTLX_STATE_OPENED
35};
36
37#define RTLX_BUFFER_SIZE 1024
25 38
26/* each channel supports read and write. 39/* each channel supports read and write.
27 linux (vpe0) reads lx_buffer and writes rt_buffer 40 linux (vpe0) reads lx_buffer and writes rt_buffer
28 SP (vpe1) reads rt_buffer and writes lx_buffer 41 SP (vpe1) reads rt_buffer and writes lx_buffer
29*/ 42*/
30struct rtlx_channel { 43struct rtlx_channel {
31 unsigned long lx_state; 44 enum rtlx_state rt_state;
45 enum rtlx_state lx_state;
32 46
33 int buffer_size; 47 int buffer_size;
34 48
@@ -38,15 +52,13 @@ struct rtlx_channel {
38 52
39 int lx_write, lx_read; 53 int lx_write, lx_read;
40 char *lx_buffer; 54 char *lx_buffer;
41
42 void *queues;
43
44}; 55};
45 56
46struct rtlx_info { 57struct rtlx_info {
47 unsigned long id; 58 unsigned long id;
59 enum rtlx_state state;
48 60
49 struct rtlx_channel channel[RTLX_CHANNELS]; 61 struct rtlx_channel channel[RTLX_CHANNELS];
50}; 62};
51 63
52#endif /* _RTLX_H_ */ 64#endif /* __ASM_RTLX_H_ */
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index 7b2366412203..7196ceb0e948 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -77,15 +77,15 @@
77#include <asm/it8712.h> 77#include <asm/it8712.h>
78#define ITE_SERIAL_PORT_DEFNS \ 78#define ITE_SERIAL_PORT_DEFNS \
79 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \ 79 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
80 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 80 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
81 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \ 81 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
82 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 82 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
83 /* Smart Card Reader 0 */ \ 83 /* Smart Card Reader 0 */ \
84 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \ 84 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
85 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 85 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
86 /* Smart Card Reader 1 */ \ 86 /* Smart Card Reader 1 */ \
87 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \ 87 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
88 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, 88 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
89#else 89#else
90#define ITE_SERIAL_PORT_DEFNS 90#define ITE_SERIAL_PORT_DEFNS
91#endif 91#endif
@@ -95,10 +95,10 @@
95#include <asm/it8172/it8172_int.h> 95#include <asm/it8172/it8172_int.h>
96#define IVR_SERIAL_PORT_DEFNS \ 96#define IVR_SERIAL_PORT_DEFNS \
97 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \ 97 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
98 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 98 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
99 /* Smart Card Reader 1 */ \ 99 /* Smart Card Reader 1 */ \
100 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \ 100 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
101 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, 101 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
102#else 102#else
103#define IVR_SERIAL_PORT_DEFNS 103#define IVR_SERIAL_PORT_DEFNS
104#endif 104#endif
diff --git a/include/asm-mips/smtc.h b/include/asm-mips/smtc.h
new file mode 100644
index 000000000000..e1941d1b8726
--- /dev/null
+++ b/include/asm-mips/smtc.h
@@ -0,0 +1,55 @@
1#ifndef _ASM_SMTC_MT_H
2#define _ASM_SMTC_MT_H
3
4/*
5 * Definitions for SMTC multitasking on MIPS MT cores
6 */
7
8#include <asm/mips_mt.h>
9
10/*
11 * System-wide SMTC status information
12 */
13
14extern unsigned int smtc_status;
15
16#define SMTC_TLB_SHARED 0x00000001
17#define SMTC_MTC_ACTIVE 0x00000002
18
19/*
20 * TLB/ASID Management information
21 */
22
23#define MAX_SMTC_TLBS 2
24#define MAX_SMTC_ASIDS 256
25#if NR_CPUS <= 8
26typedef char asiduse;
27#else
28#if NR_CPUS <= 16
29typedef short asiduse;
30#else
31typedef long asiduse;
32#endif
33#endif
34
35extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
36
37void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
38
39void smtc_flush_tlb_asid(unsigned long asid);
40extern int mipsmt_build_cpu_map(int startslot);
41extern void mipsmt_prepare_cpus(void);
42extern void smtc_smp_finish(void);
43extern void smtc_boot_secondary(int cpu, struct task_struct *t);
44
45/*
46 * Sharing the TLB between multiple VPEs means that the
47 * "random" index selection function is not allowed to
48 * select the current value of the Index register. To
49 * avoid additional TLB pressure, the Index registers
50 * are "parked" with an non-Valid value.
51 */
52
53#define PARKED_INDEX ((unsigned int)0x80000000)
54
55#endif /* _ASM_SMTC_MT_H */
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
new file mode 100644
index 000000000000..f22c3e2f993a
--- /dev/null
+++ b/include/asm-mips/smtc_ipi.h
@@ -0,0 +1,118 @@
1/*
2 * Definitions used in MIPS MT SMTC "Interprocessor Interrupt" code.
3 */
4#ifndef __ASM_SMTC_IPI_H
5#define __ASM_SMTC_IPI_H
6
7//#define SMTC_IPI_DEBUG
8
9#ifdef SMTC_IPI_DEBUG
10#include <asm/mipsregs.h>
11#include <asm/mipsmtregs.h>
12#endif /* SMTC_IPI_DEBUG */
13
14/*
15 * An IPI "message"
16 */
17
18struct smtc_ipi {
19 struct smtc_ipi *flink;
20 int type;
21 void *arg;
22 int dest;
23#ifdef SMTC_IPI_DEBUG
24 int sender;
25 long stamp;
26#endif /* SMTC_IPI_DEBUG */
27};
28
29/*
30 * Defined IPI Types
31 */
32
33#define LINUX_SMP_IPI 1
34#define SMTC_CLOCK_TICK 2
35
36/*
37 * A queue of IPI messages
38 */
39
40struct smtc_ipi_q {
41 struct smtc_ipi *head;
42 spinlock_t lock;
43 struct smtc_ipi *tail;
44 int depth;
45};
46
47extern struct smtc_ipi_q IPIQ[NR_CPUS];
48extern struct smtc_ipi_q freeIPIq;
49
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51{
52 long flags;
53
54 spin_lock_irqsave(&q->lock, flags);
55 if (q->head == NULL)
56 q->head = q->tail = p;
57 else
58 q->tail->flink = p;
59 p->flink = NULL;
60 q->tail = p;
61 q->depth++;
62#ifdef SMTC_IPI_DEBUG
63 p->sender = read_c0_tcbind();
64 p->stamp = read_c0_count();
65#endif /* SMTC_IPI_DEBUG */
66 spin_unlock_irqrestore(&q->lock, flags);
67}
68
69static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
70{
71 struct smtc_ipi *p;
72 long flags;
73
74 spin_lock_irqsave(&q->lock, flags);
75 if (q->head == NULL)
76 p = NULL;
77 else {
78 p = q->head;
79 q->head = q->head->flink;
80 q->depth--;
81 /* Arguably unnecessary, but leaves queue cleaner */
82 if (q->head == NULL)
83 q->tail = NULL;
84 }
85 spin_unlock_irqrestore(&q->lock, flags);
86 return p;
87}
88
89static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
90{
91 long flags;
92
93 spin_lock_irqsave(&q->lock, flags);
94 if (q->head == NULL) {
95 q->head = q->tail = p;
96 p->flink = NULL;
97 } else {
98 p->flink = q->head;
99 q->head = p;
100 }
101 q->depth++;
102 spin_unlock_irqrestore(&q->lock, flags);
103}
104
105static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
106{
107 long flags;
108 int retval;
109
110 spin_lock_irqsave(&q->lock, flags);
111 retval = q->depth;
112 spin_unlock_irqrestore(&q->lock, flags);
113 return retval;
114}
115
116extern void smtc_send_ipi(int cpu, int type, unsigned int action);
117
118#endif /* __ASM_SMTC_IPI_H */
diff --git a/include/asm-mips/smtc_proc.h b/include/asm-mips/smtc_proc.h
new file mode 100644
index 000000000000..25da651f1f5f
--- /dev/null
+++ b/include/asm-mips/smtc_proc.h
@@ -0,0 +1,23 @@
1/*
2 * Definitions for SMTC /proc entries
3 * Copyright(C) 2005 MIPS Technologies Inc.
4 */
5#ifndef __ASM_SMTC_PROC_H
6#define __ASM_SMTC_PROC_H
7
8/*
9 * per-"CPU" statistics
10 */
11
12struct smtc_cpu_proc {
13 unsigned long timerints;
14 unsigned long selfipis;
15};
16
17extern struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
18
19/* Count of number of recoveries of "stolen" FPU access rights on 34K */
20
21extern atomic_t smtc_fpu_recoveries;
22
23#endif /* __ASM_SMTC_PROC_H */
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 2acf3e844f00..c4856a874965 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -14,9 +14,14 @@
14#include <linux/threads.h> 14#include <linux/threads.h>
15 15
16#include <asm/asm.h> 16#include <asm/asm.h>
17#include <asm/asmmacro.h>
17#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
18#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
19 20
21#ifdef CONFIG_MIPS_MT_SMTC
22#include <asm/mipsmtregs.h>
23#endif /* CONFIG_MIPS_MT_SMTC */
24
20 .macro SAVE_AT 25 .macro SAVE_AT
21 .set push 26 .set push
22 .set noat 27 .set noat
@@ -57,13 +62,30 @@
57#ifdef CONFIG_SMP 62#ifdef CONFIG_SMP
58 .macro get_saved_sp /* SMP variation */ 63 .macro get_saved_sp /* SMP variation */
59#ifdef CONFIG_32BIT 64#ifdef CONFIG_32BIT
65#ifdef CONFIG_MIPS_MT_SMTC
66 .set mips32
67 mfc0 k0, CP0_TCBIND;
68 .set mips0
69 lui k1, %hi(kernelsp)
70 srl k0, k0, 19
71 /* No need to shift down and up to clear bits 0-1 */
72#else
60 mfc0 k0, CP0_CONTEXT 73 mfc0 k0, CP0_CONTEXT
61 lui k1, %hi(kernelsp) 74 lui k1, %hi(kernelsp)
62 srl k0, k0, 23 75 srl k0, k0, 23
76#endif
63 addu k1, k0 77 addu k1, k0
64 LONG_L k1, %lo(kernelsp)(k1) 78 LONG_L k1, %lo(kernelsp)(k1)
65#endif 79#endif
66#ifdef CONFIG_64BIT 80#ifdef CONFIG_64BIT
81#ifdef CONFIG_MIPS_MT_SMTC
82 .set mips64
83 mfc0 k0, CP0_TCBIND;
84 .set mips0
85 lui k0, %highest(kernelsp)
86 dsrl k1, 19
87 /* No need to shift down and up to clear bits 0-2 */
88#else
67 MFC0 k1, CP0_CONTEXT 89 MFC0 k1, CP0_CONTEXT
68 lui k0, %highest(kernelsp) 90 lui k0, %highest(kernelsp)
69 dsrl k1, 23 91 dsrl k1, 23
@@ -71,20 +93,31 @@
71 dsll k0, k0, 16 93 dsll k0, k0, 16
72 daddiu k0, %hi(kernelsp) 94 daddiu k0, %hi(kernelsp)
73 dsll k0, k0, 16 95 dsll k0, k0, 16
96#endif /* CONFIG_MIPS_MT_SMTC */
74 daddu k1, k1, k0 97 daddu k1, k1, k0
75 LONG_L k1, %lo(kernelsp)(k1) 98 LONG_L k1, %lo(kernelsp)(k1)
76#endif 99#endif /* CONFIG_64BIT */
77 .endm 100 .endm
78 101
79 .macro set_saved_sp stackp temp temp2 102 .macro set_saved_sp stackp temp temp2
80#ifdef CONFIG_32BIT 103#ifdef CONFIG_32BIT
104#ifdef CONFIG_MIPS_MT_SMTC
105 mfc0 \temp, CP0_TCBIND
106 srl \temp, 19
107#else
81 mfc0 \temp, CP0_CONTEXT 108 mfc0 \temp, CP0_CONTEXT
82 srl \temp, 23 109 srl \temp, 23
83#endif 110#endif
111#endif
84#ifdef CONFIG_64BIT 112#ifdef CONFIG_64BIT
113#ifdef CONFIG_MIPS_MT_SMTC
114 mfc0 \temp, CP0_TCBIND
115 dsrl \temp, 19
116#else
85 MFC0 \temp, CP0_CONTEXT 117 MFC0 \temp, CP0_CONTEXT
86 dsrl \temp, 23 118 dsrl \temp, 23
87#endif 119#endif
120#endif
88 LONG_S \stackp, kernelsp(\temp) 121 LONG_S \stackp, kernelsp(\temp)
89 .endm 122 .endm
90#else 123#else
@@ -122,10 +155,25 @@
122 PTR_SUBU sp, k1, PT_SIZE 155 PTR_SUBU sp, k1, PT_SIZE
123 LONG_S k0, PT_R29(sp) 156 LONG_S k0, PT_R29(sp)
124 LONG_S $3, PT_R3(sp) 157 LONG_S $3, PT_R3(sp)
158 /*
159 * You might think that you don't need to save $0,
160 * but the FPU emulator and gdb remote debug stub
161 * need it to operate correctly
162 */
125 LONG_S $0, PT_R0(sp) 163 LONG_S $0, PT_R0(sp)
126 mfc0 v1, CP0_STATUS 164 mfc0 v1, CP0_STATUS
127 LONG_S $2, PT_R2(sp) 165 LONG_S $2, PT_R2(sp)
128 LONG_S v1, PT_STATUS(sp) 166 LONG_S v1, PT_STATUS(sp)
167#ifdef CONFIG_MIPS_MT_SMTC
168 /*
169 * Ideally, these instructions would be shuffled in
170 * to cover the pipeline delay.
171 */
172 .set mips32
173 mfc0 v1, CP0_TCSTATUS
174 .set mips0
175 LONG_S v1, PT_TCSTATUS(sp)
176#endif /* CONFIG_MIPS_MT_SMTC */
129 LONG_S $4, PT_R4(sp) 177 LONG_S $4, PT_R4(sp)
130 mfc0 v1, CP0_CAUSE 178 mfc0 v1, CP0_CAUSE
131 LONG_S $5, PT_R5(sp) 179 LONG_S $5, PT_R5(sp)
@@ -234,14 +282,36 @@
234 .endm 282 .endm
235 283
236#else 284#else
285/*
286 * For SMTC kernel, global IE should be left set, and interrupts
287 * controlled exclusively via IXMT.
288 */
237 289
290#ifdef CONFIG_MIPS_MT_SMTC
291#define STATMASK 0x1e
292#else
293#define STATMASK 0x1f
294#endif
238 .macro RESTORE_SOME 295 .macro RESTORE_SOME
239 .set push 296 .set push
240 .set reorder 297 .set reorder
241 .set noat 298 .set noat
299#ifdef CONFIG_MIPS_MT_SMTC
300 .set mips32r2
301 /*
302 * This may not really be necessary if ints are already
303 * inhibited here.
304 */
305 mfc0 v0, CP0_TCSTATUS
306 ori v0, TCSTATUS_IXMT
307 mtc0 v0, CP0_TCSTATUS
308 ehb
309 DMT 5 # dmt a1
310 jal mips_ihb
311#endif /* CONFIG_MIPS_MT_SMTC */
242 mfc0 a0, CP0_STATUS 312 mfc0 a0, CP0_STATUS
243 ori a0, 0x1f 313 ori a0, STATMASK
244 xori a0, 0x1f 314 xori a0, STATMASK
245 mtc0 a0, CP0_STATUS 315 mtc0 a0, CP0_STATUS
246 li v1, 0xff00 316 li v1, 0xff00
247 and a0, v1 317 and a0, v1
@@ -250,6 +320,26 @@
250 and v0, v1 320 and v0, v1
251 or v0, a0 321 or v0, a0
252 mtc0 v0, CP0_STATUS 322 mtc0 v0, CP0_STATUS
323#ifdef CONFIG_MIPS_MT_SMTC
324/*
325 * Only after EXL/ERL have been restored to status can we
326 * restore TCStatus.IXMT.
327 */
328 LONG_L v1, PT_TCSTATUS(sp)
329 ehb
330 mfc0 v0, CP0_TCSTATUS
331 andi v1, TCSTATUS_IXMT
332 /* We know that TCStatua.IXMT should be set from above */
333 xori v0, v0, TCSTATUS_IXMT
334 or v0, v0, v1
335 mtc0 v0, CP0_TCSTATUS
336 ehb
337 andi a1, a1, VPECONTROL_TE
338 beqz a1, 1f
339 emt
3401:
341 .set mips0
342#endif /* CONFIG_MIPS_MT_SMTC */
253 LONG_L v1, PT_EPC(sp) 343 LONG_L v1, PT_EPC(sp)
254 MTC0 v1, CP0_EPC 344 MTC0 v1, CP0_EPC
255 LONG_L $31, PT_R31(sp) 345 LONG_L $31, PT_R31(sp)
@@ -302,11 +392,33 @@
302 * Set cp0 enable bit as sign that we're running on the kernel stack 392 * Set cp0 enable bit as sign that we're running on the kernel stack
303 */ 393 */
304 .macro CLI 394 .macro CLI
395#if !defined(CONFIG_MIPS_MT_SMTC)
305 mfc0 t0, CP0_STATUS 396 mfc0 t0, CP0_STATUS
306 li t1, ST0_CU0 | 0x1f 397 li t1, ST0_CU0 | 0x1f
307 or t0, t1 398 or t0, t1
308 xori t0, 0x1f 399 xori t0, 0x1f
309 mtc0 t0, CP0_STATUS 400 mtc0 t0, CP0_STATUS
401#else /* CONFIG_MIPS_MT_SMTC */
402 /*
403 * For SMTC, we need to set privilege
404 * and disable interrupts only for the
405 * current TC, using the TCStatus register.
406 */
407 mfc0 t0,CP0_TCSTATUS
408 /* Fortunately CU 0 is in the same place in both registers */
409 /* Set TCU0, TMX, TKSU (for later inversion) and IXMT */
410 li t1, ST0_CU0 | 0x08001c00
411 or t0,t1
412 /* Clear TKSU, leave IXMT */
413 xori t0, 0x00001800
414 mtc0 t0, CP0_TCSTATUS
415 ehb
416 /* We need to leave the global IE bit set, but clear EXL...*/
417 mfc0 t0, CP0_STATUS
418 ori t0, ST0_EXL | ST0_ERL
419 xori t0, ST0_EXL | ST0_ERL
420 mtc0 t0, CP0_STATUS
421#endif /* CONFIG_MIPS_MT_SMTC */
310 irq_disable_hazard 422 irq_disable_hazard
311 .endm 423 .endm
312 424
@@ -315,11 +427,35 @@
315 * Set cp0 enable bit as sign that we're running on the kernel stack 427 * Set cp0 enable bit as sign that we're running on the kernel stack
316 */ 428 */
317 .macro STI 429 .macro STI
430#if !defined(CONFIG_MIPS_MT_SMTC)
318 mfc0 t0, CP0_STATUS 431 mfc0 t0, CP0_STATUS
319 li t1, ST0_CU0 | 0x1f 432 li t1, ST0_CU0 | 0x1f
320 or t0, t1 433 or t0, t1
321 xori t0, 0x1e 434 xori t0, 0x1e
322 mtc0 t0, CP0_STATUS 435 mtc0 t0, CP0_STATUS
436#else /* CONFIG_MIPS_MT_SMTC */
437 /*
438 * For SMTC, we need to set privilege
439 * and enable interrupts only for the
440 * current TC, using the TCStatus register.
441 */
442 ehb
443 mfc0 t0,CP0_TCSTATUS
444 /* Fortunately CU 0 is in the same place in both registers */
445 /* Set TCU0, TKSU (for later inversion) and IXMT */
446 li t1, ST0_CU0 | 0x08001c00
447 or t0,t1
448 /* Clear TKSU *and* IXMT */
449 xori t0, 0x00001c00
450 mtc0 t0, CP0_TCSTATUS
451 ehb
452 /* We need to leave the global IE bit set, but clear EXL...*/
453 mfc0 t0, CP0_STATUS
454 ori t0, ST0_EXL
455 xori t0, ST0_EXL
456 mtc0 t0, CP0_STATUS
457 /* irq_enable_hazard below should expand to EHB for 24K/34K cpus */
458#endif /* CONFIG_MIPS_MT_SMTC */
323 irq_enable_hazard 459 irq_enable_hazard
324 .endm 460 .endm
325 461
@@ -328,11 +464,56 @@
328 * Set cp0 enable bit as sign that we're running on the kernel stack 464 * Set cp0 enable bit as sign that we're running on the kernel stack
329 */ 465 */
330 .macro KMODE 466 .macro KMODE
467#ifdef CONFIG_MIPS_MT_SMTC
468 /*
469 * This gets baroque in SMTC. We want to
470 * protect the non-atomic clearing of EXL
471 * with DMT/EMT, but we don't want to take
472 * an interrupt while DMT is still in effect.
473 */
474
475 /* KMODE gets invoked from both reorder and noreorder code */
476 .set push
477 .set mips32r2
478 .set noreorder
479 mfc0 v0, CP0_TCSTATUS
480 andi v1, v0, TCSTATUS_IXMT
481 ori v0, TCSTATUS_IXMT
482 mtc0 v0, CP0_TCSTATUS
483 ehb
484 DMT 2 # dmt v0
485 /*
486 * We don't know a priori if ra is "live"
487 */
488 move t0, ra
489 jal mips_ihb
490 nop /* delay slot */
491 move ra, t0
492#endif /* CONFIG_MIPS_MT_SMTC */
331 mfc0 t0, CP0_STATUS 493 mfc0 t0, CP0_STATUS
332 li t1, ST0_CU0 | 0x1e 494 li t1, ST0_CU0 | 0x1e
333 or t0, t1 495 or t0, t1
334 xori t0, 0x1e 496 xori t0, 0x1e
335 mtc0 t0, CP0_STATUS 497 mtc0 t0, CP0_STATUS
498#ifdef CONFIG_MIPS_MT_SMTC
499 ehb
500 andi v0, v0, VPECONTROL_TE
501 beqz v0, 2f
502 nop /* delay slot */
503 emt
5042:
505 mfc0 v0, CP0_TCSTATUS
506 /* Clear IXMT, then OR in previous value */
507 ori v0, TCSTATUS_IXMT
508 xori v0, TCSTATUS_IXMT
509 or v0, v1, v0
510 mtc0 v0, CP0_TCSTATUS
511 /*
512 * irq_disable_hazard below should expand to EHB
513 * on 24K/34K CPUS
514 */
515 .set pop
516#endif /* CONFIG_MIPS_MT_SMTC */
336 irq_disable_hazard 517 irq_disable_hazard
337 .endm 518 .endm
338 519
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 4097fac5ac3c..261f71d16a07 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -155,6 +155,37 @@ extern asmlinkage void *resume(void *last, void *next, void *next_ti);
155 155
156struct task_struct; 156struct task_struct;
157 157
158#ifdef CONFIG_MIPS_MT_FPAFF
159
160/*
161 * Handle the scheduler resume end of FPU affinity management. We do this
162 * inline to try to keep the overhead down. If we have been forced to run on
163 * a "CPU" with an FPU because of a previous high level of FP computation,
164 * but did not actually use the FPU during the most recent time-slice (CU1
165 * isn't set), we undo the restriction on cpus_allowed.
166 *
167 * We're not calling set_cpus_allowed() here, because we have no need to
168 * force prompt migration - we're already switching the current CPU to a
169 * different thread.
170 */
171
172#define switch_to(prev,next,last) \
173do { \
174 if (cpu_has_fpu && \
175 (prev->thread.mflags & MF_FPUBOUND) && \
176 (!(KSTK_STATUS(prev) & ST0_CU1))) { \
177 prev->thread.mflags &= ~MF_FPUBOUND; \
178 prev->cpus_allowed = prev->thread.user_cpus_allowed; \
179 } \
180 if (cpu_has_dsp) \
181 __save_dsp(prev); \
182 next->thread.emulated_fp = 0; \
183 (last) = resume(prev, next, next->thread_info); \
184 if (cpu_has_dsp) \
185 __restore_dsp(current); \
186} while(0)
187
188#else
158#define switch_to(prev,next,last) \ 189#define switch_to(prev,next,last) \
159do { \ 190do { \
160 if (cpu_has_dsp) \ 191 if (cpu_has_dsp) \
@@ -163,6 +194,7 @@ do { \
163 if (cpu_has_dsp) \ 194 if (cpu_has_dsp) \
164 __restore_dsp(current); \ 195 __restore_dsp(current); \
165} while(0) 196} while(0)
197#endif
166 198
167/* 199/*
168 * On SMP systems, when the scheduler does migration-cost autodetection, 200 * On SMP systems, when the scheduler does migration-cost autodetection,
@@ -440,8 +472,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
440extern void set_handler (unsigned long offset, void *addr, unsigned long len); 472extern void set_handler (unsigned long offset, void *addr, unsigned long len);
441extern void set_uncached_handler (unsigned long offset, void *addr, unsigned long len); 473extern void set_uncached_handler (unsigned long offset, void *addr, unsigned long len);
442extern void *set_vi_handler (int n, void *addr); 474extern void *set_vi_handler (int n, void *addr);
443extern void *set_vi_srs_handler (int n, void *addr, int regset);
444extern void *set_except_vector(int n, void *addr); 475extern void *set_except_vector(int n, void *addr);
476extern unsigned long ebase;
445extern void per_cpu_trap_init(void); 477extern void per_cpu_trap_init(void);
446 478
447extern NORET_TYPE void die(const char *, struct pt_regs *); 479extern NORET_TYPE void die(const char *, struct pt_regs *);
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index b5c78a4a0192..1068fe9a0a58 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -324,16 +324,18 @@
324#define __NR_pselect6 (__NR_Linux + 301) 324#define __NR_pselect6 (__NR_Linux + 301)
325#define __NR_ppoll (__NR_Linux + 302) 325#define __NR_ppoll (__NR_Linux + 302)
326#define __NR_unshare (__NR_Linux + 303) 326#define __NR_unshare (__NR_Linux + 303)
327#define __NR_splice (__NR_Linux + 304)
328#define __NR_sync_file_range (__NR_Linux + 305)
327 329
328/* 330/*
329 * Offset of the last Linux o32 flavoured syscall 331 * Offset of the last Linux o32 flavoured syscall
330 */ 332 */
331#define __NR_Linux_syscalls 303 333#define __NR_Linux_syscalls 305
332 334
333#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 335#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
334 336
335#define __NR_O32_Linux 4000 337#define __NR_O32_Linux 4000
336#define __NR_O32_Linux_syscalls 303 338#define __NR_O32_Linux_syscalls 305
337 339
338#if _MIPS_SIM == _MIPS_SIM_ABI64 340#if _MIPS_SIM == _MIPS_SIM_ABI64
339 341
@@ -604,16 +606,18 @@
604#define __NR_pselect6 (__NR_Linux + 260) 606#define __NR_pselect6 (__NR_Linux + 260)
605#define __NR_ppoll (__NR_Linux + 261) 607#define __NR_ppoll (__NR_Linux + 261)
606#define __NR_unshare (__NR_Linux + 262) 608#define __NR_unshare (__NR_Linux + 262)
609#define __NR_splice (__NR_Linux + 263)
610#define __NR_sync_file_range (__NR_Linux + 264)
607 611
608/* 612/*
609 * Offset of the last Linux 64-bit flavoured syscall 613 * Offset of the last Linux 64-bit flavoured syscall
610 */ 614 */
611#define __NR_Linux_syscalls 262 615#define __NR_Linux_syscalls 264
612 616
613#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 617#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
614 618
615#define __NR_64_Linux 5000 619#define __NR_64_Linux 5000
616#define __NR_64_Linux_syscalls 262 620#define __NR_64_Linux_syscalls 264
617 621
618#if _MIPS_SIM == _MIPS_SIM_NABI32 622#if _MIPS_SIM == _MIPS_SIM_NABI32
619 623
@@ -888,16 +892,18 @@
888#define __NR_pselect6 (__NR_Linux + 264) 892#define __NR_pselect6 (__NR_Linux + 264)
889#define __NR_ppoll (__NR_Linux + 265) 893#define __NR_ppoll (__NR_Linux + 265)
890#define __NR_unshare (__NR_Linux + 266) 894#define __NR_unshare (__NR_Linux + 266)
895#define __NR_splice (__NR_Linux + 267)
896#define __NR_sync_file_range (__NR_Linux + 268)
891 897
892/* 898/*
893 * Offset of the last N32 flavoured syscall 899 * Offset of the last N32 flavoured syscall
894 */ 900 */
895#define __NR_Linux_syscalls 266 901#define __NR_Linux_syscalls 268
896 902
897#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 903#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
898 904
899#define __NR_N32_Linux 6000 905#define __NR_N32_Linux 6000
900#define __NR_N32_Linux_syscalls 266 906#define __NR_N32_Linux_syscalls 268
901 907
902#ifndef __ASSEMBLY__ 908#ifndef __ASSEMBLY__
903 909
diff --git a/include/asm-mips/vpe.h b/include/asm-mips/vpe.h
new file mode 100644
index 000000000000..c6e1b961537d
--- /dev/null
+++ b/include/asm-mips/vpe.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_VPE_H
20#define _ASM_VPE_H
21
22struct vpe_notifications {
23 void (*start)(int vpe);
24 void (*stop)(int vpe);
25
26 struct list_head list;
27};
28
29
30extern int vpe_notify(int index, struct vpe_notifications *notify);
31
32extern void *vpe_get_shared(int index);
33extern int vpe_getuid(int index);
34extern int vpe_getgid(int index);
35extern char *vpe_getcwd(int index);
36
37#endif /* _ASM_VPE_H */
diff --git a/include/asm-parisc/numnodes.h b/include/asm-parisc/numnodes.h
deleted file mode 100644
index 6c67651efd1c..000000000000
--- a/include/asm-parisc/numnodes.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 8 Nodes */
5#define NODES_SHIFT 3
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 51f87d9993b6..7bc6d73b2823 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -54,6 +54,13 @@
54 */ 54 */
55extern unsigned int virt_irq_to_real_map[NR_IRQS]; 55extern unsigned int virt_irq_to_real_map[NR_IRQS];
56 56
57/* The maximum virtual IRQ number that we support. This
58 * can be set by the platform and will be reduced by the
59 * value of __irq_offset_value. It defaults to and is
60 * capped by (NR_IRQS - 1).
61 */
62extern unsigned int virt_irq_max;
63
57/* Create a mapping for a real_irq if it doesn't already exist. 64/* Create a mapping for a real_irq if it doesn't already exist.
58 * Return the virtual irq as a convenience. 65 * Return the virtual irq as a convenience.
59 */ 66 */
diff --git a/include/asm-powerpc/numnodes.h b/include/asm-powerpc/numnodes.h
deleted file mode 100644
index e138edae09dd..000000000000
--- a/include/asm-powerpc/numnodes.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _ASM_POWERPC_MAX_NUMNODES_H
2#define _ASM_POWERPC_MAX_NUMNODES_H
3#ifdef __KERNEL__
4
5/* Max 16 Nodes */
6#define NODES_SHIFT 4
7
8#endif /* __KERNEL__ */
9#endif /* _ASM_POWERPC_MAX_NUMNODES_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index ffc7462d77ba..88b553c6b26c 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -37,6 +37,8 @@ struct thread_info {
37 int preempt_count; /* 0 => preemptable, 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */ 38 <0 => BUG */
39 struct restart_block restart_block; 39 struct restart_block restart_block;
40 unsigned long local_flags; /* private flags for thread */
41
40 /* low level flags - has atomic operations done on it */ 42 /* low level flags - has atomic operations done on it */
41 unsigned long flags ____cacheline_aligned_in_smp; 43 unsigned long flags ____cacheline_aligned_in_smp;
42}; 44};
@@ -143,6 +145,12 @@ static inline struct thread_info *current_thread_info(void)
143 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK) 145 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
144#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 146#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
145 147
148/* Bits in local_flags */
149/* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
150#define TLF_NAPPING 0 /* idle thread enabled NAP mode */
151
152#define _TLF_NAPPING (1 << TLF_NAPPING)
153
146#endif /* __KERNEL__ */ 154#endif /* __KERNEL__ */
147 155
148#endif /* _ASM_POWERPC_THREAD_INFO_H */ 156#endif /* _ASM_POWERPC_THREAD_INFO_H */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 536ba0873052..c612f1a62772 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -302,8 +302,9 @@
302#define __NR_ppoll 281 302#define __NR_ppoll 281
303#define __NR_unshare 282 303#define __NR_unshare 282
304#define __NR_splice 283 304#define __NR_splice 283
305#define __NR_tee 284
305 306
306#define __NR_syscalls 284 307#define __NR_syscalls 285
307 308
308#ifdef __KERNEL__ 309#ifdef __KERNEL__
309#define __NR__exit __NR_exit 310#define __NR__exit __NR_exit
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index de1d9926aa60..399bf02894dd 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -1,6 +1,8 @@
1#ifndef __ARCH_S390_ATOMIC__ 1#ifndef __ARCH_S390_ATOMIC__
2#define __ARCH_S390_ATOMIC__ 2#define __ARCH_S390_ATOMIC__
3 3
4#include <linux/compiler.h>
5
4/* 6/*
5 * include/asm-s390/atomic.h 7 * include/asm-s390/atomic.h
6 * 8 *
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h
index 4cbc336e4d60..15fd2eda6c90 100644
--- a/include/asm-s390/ebcdic.h
+++ b/include/asm-s390/ebcdic.h
@@ -14,12 +14,12 @@
14#include <types.h> 14#include <types.h>
15#endif 15#endif
16 16
17extern __u8 _ascebc_500[]; /* ASCII -> EBCDIC 500 conversion table */ 17extern __u8 _ascebc_500[256]; /* ASCII -> EBCDIC 500 conversion table */
18extern __u8 _ebcasc_500[]; /* EBCDIC 500 -> ASCII conversion table */ 18extern __u8 _ebcasc_500[256]; /* EBCDIC 500 -> ASCII conversion table */
19extern __u8 _ascebc[]; /* ASCII -> EBCDIC conversion table */ 19extern __u8 _ascebc[256]; /* ASCII -> EBCDIC conversion table */
20extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */ 20extern __u8 _ebcasc[256]; /* EBCDIC -> ASCII conversion table */
21extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ 21extern __u8 _ebc_tolower[256]; /* EBCDIC -> lowercase */
22extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ 22extern __u8 _ebc_toupper[256]; /* EBCDIC -> uppercase */
23 23
24static inline void 24static inline void
25codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) 25codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
diff --git a/include/asm-sh/numnodes.h b/include/asm-sh/numnodes.h
deleted file mode 100644
index f73e85b72ecb..000000000000
--- a/include/asm-sh/numnodes.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 2 Nodes */
5#define NODES_SHIFT 1
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index f2c8e14d1fd9..05520cebda12 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -290,7 +290,7 @@
290#define __NR_mq_timedreceive (__NR_mq_open+3) 290#define __NR_mq_timedreceive (__NR_mq_open+3)
291#define __NR_mq_notify (__NR_mq_open+4) 291#define __NR_mq_notify (__NR_mq_open+4)
292#define __NR_mq_getsetattr (__NR_mq_open+5) 292#define __NR_mq_getsetattr (__NR_mq_open+5)
293#define __NR_sys_kexec_load 283 293#define __NR_kexec_load 283
294#define __NR_waitid 284 294#define __NR_waitid 284
295#define __NR_add_key 285 295#define __NR_add_key 285
296#define __NR_request_key 286 296#define __NR_request_key 286
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index 2a1cfa404ea4..1f8f394ae371 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -333,7 +333,7 @@
333#define __NR_mq_timedreceive (__NR_mq_open+3) 333#define __NR_mq_timedreceive (__NR_mq_open+3)
334#define __NR_mq_notify (__NR_mq_open+4) 334#define __NR_mq_notify (__NR_mq_open+4)
335#define __NR_mq_getsetattr (__NR_mq_open+5) 335#define __NR_mq_getsetattr (__NR_mq_open+5)
336#define __NR_sys_kexec_load 311 336#define __NR_kexec_load 311
337#define __NR_waitid 312 337#define __NR_waitid 312
338#define __NR_add_key 313 338#define __NR_add_key 313
339#define __NR_request_key 314 339#define __NR_request_key 314
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 264f0ebeaedc..45feff893b8e 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -248,7 +248,7 @@
248#define __NR_setfsgid 229 /* Linux Specific */ 248#define __NR_setfsgid 229 /* Linux Specific */
249#define __NR__newselect 230 /* Linux Specific */ 249#define __NR__newselect 230 /* Linux Specific */
250#define __NR_time 231 /* Linux Specific */ 250#define __NR_time 231 /* Linux Specific */
251#define __NR_sys_splice 232 /* Linux Specific */ 251#define __NR_splice 232 /* Linux Specific */
252#define __NR_stime 233 /* Linux Specific */ 252#define __NR_stime 233 /* Linux Specific */
253#define __NR_statfs64 234 /* Linux Specific */ 253#define __NR_statfs64 234 /* Linux Specific */
254#define __NR_fstatfs64 235 /* Linux Specific */ 254#define __NR_fstatfs64 235 /* Linux Specific */
@@ -296,7 +296,7 @@
296#define __NR_mq_notify 277 296#define __NR_mq_notify 277
297#define __NR_mq_getsetattr 278 297#define __NR_mq_getsetattr 278
298#define __NR_waitid 279 298#define __NR_waitid 279
299#define __NR_sys_setaltroot 280 299#define __NR_tee 280
300#define __NR_add_key 281 300#define __NR_add_key 281
301#define __NR_request_key 282 301#define __NR_request_key 282
302#define __NR_keyctl 283 302#define __NR_keyctl 283
diff --git a/include/asm-sparc/vga.h b/include/asm-sparc/vga.h
new file mode 100644
index 000000000000..c69d5b2ba19a
--- /dev/null
+++ b/include/asm-sparc/vga.h
@@ -0,0 +1,33 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6
7#ifndef _LINUX_ASM_VGA_H_
8#define _LINUX_ASM_VGA_H_
9
10#include <asm/types.h>
11
12#define VT_BUF_HAVE_RW
13
14#undef scr_writew
15#undef scr_readw
16
17static inline void scr_writew(u16 val, u16 *addr)
18{
19 BUG_ON((long) addr >= 0);
20
21 *addr = val;
22}
23
24static inline u16 scr_readw(const u16 *addr)
25{
26 BUG_ON((long) addr >= 0);
27
28 return *addr;
29}
30
31#define VGA_MAP_MEM(x,s) (x)
32
33#endif
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index 82032e159a76..baef13b58952 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -26,7 +26,7 @@ register unsigned long __local_per_cpu_offset asm("g5");
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for_each_cpu(__i) \ 29 for_each_possible_cpu(__i) \
30 memcpy((pcpudst)+__per_cpu_offset(__i), \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 (src), (size)); \ 31 (src), (size)); \
32} while (0) 32} while (0)
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index d0544b4f47b7..597f6923a46e 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -250,7 +250,7 @@
250#ifdef __KERNEL__ 250#ifdef __KERNEL__
251#define __NR_time 231 /* Linux sparc32 */ 251#define __NR_time 231 /* Linux sparc32 */
252#endif 252#endif
253#define __NR_sys_splice 232 /* Linux Specific */ 253#define __NR_splice 232 /* Linux Specific */
254#define __NR_stime 233 /* Linux Specific */ 254#define __NR_stime 233 /* Linux Specific */
255#define __NR_statfs64 234 /* Linux Specific */ 255#define __NR_statfs64 234 /* Linux Specific */
256#define __NR_fstatfs64 235 /* Linux Specific */ 256#define __NR_fstatfs64 235 /* Linux Specific */
@@ -298,7 +298,7 @@
298#define __NR_mq_notify 277 298#define __NR_mq_notify 277
299#define __NR_mq_getsetattr 278 299#define __NR_mq_getsetattr 278
300#define __NR_waitid 279 300#define __NR_waitid 279
301/*#define __NR_sys_setaltroot 280 available (was setaltroot) */ 301#define __NR_tee 280
302#define __NR_add_key 281 302#define __NR_add_key 281
303#define __NR_request_key 282 303#define __NR_request_key 282
304#define __NR_keyctl 283 304#define __NR_keyctl 283
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h
index 30656c962d74..6e2528bb0083 100644
--- a/include/asm-um/ptrace-i386.h
+++ b/include/asm-um/ptrace-i386.h
@@ -56,6 +56,9 @@ extern int do_get_thread_area_tt(struct user_desc *info);
56extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to); 56extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to);
57extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); 57extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to);
58 58
59extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to);
60extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to);
61
59static inline int do_get_thread_area(struct user_desc *info) 62static inline int do_get_thread_area(struct user_desc *info)
60{ 63{
61 return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info); 64 return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info);
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h
index 107decbd6e6c..7091af4b7866 100644
--- a/include/asm-v850/system.h
+++ b/include/asm-v850/system.h
@@ -18,8 +18,6 @@
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19 19
20 20
21#define prepare_to_switch() do { } while (0)
22
23/* 21/*
24 * switch_to(n) should switch tasks to task ptr, first checking that 22 * switch_to(n) should switch tasks to task ptr, first checking that
25 * ptr isn't the current task, in which case it does nothing. 23 * ptr isn't the current task, in which case it does nothing.
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index c8043a16152e..f8dff1c67538 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -20,8 +20,8 @@
20 __attribute__((__section__(".data.page_aligned"))) 20 __attribute__((__section__(".data.page_aligned")))
21#endif 21#endif
22 22
23#define __read_mostly __attribute__((__section__(".data.read_mostly")))
24
25#endif 23#endif
26 24
25#define __read_mostly __attribute__((__section__(".data.read_mostly")))
26
27#endif 27#endif
diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h
index 76bb6193ae91..662964b74e34 100644
--- a/include/asm-x86_64/cpufeature.h
+++ b/include/asm-x86_64/cpufeature.h
@@ -64,6 +64,7 @@
64#define X86_FEATURE_REP_GOOD (3*32+ 4) /* rep microcode works well on this CPU */ 64#define X86_FEATURE_REP_GOOD (3*32+ 4) /* rep microcode works well on this CPU */
65#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ 65#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
66#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */ 66#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */
67#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */
67 68
68/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 69/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
69#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 70#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index 8dcc32665240..93b51df51687 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -47,7 +47,8 @@ extern void contig_e820_setup(void);
47extern unsigned long e820_end_of_ram(void); 47extern unsigned long e820_end_of_ram(void);
48extern void e820_reserve_resources(void); 48extern void e820_reserve_resources(void);
49extern void e820_print_map(char *who); 49extern void e820_print_map(char *who);
50extern int e820_mapped(unsigned long start, unsigned long end, unsigned type); 50extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
51extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
51 52
52extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end); 53extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
53extern void e820_setup_gap(void); 54extern void e820_setup_gap(void);
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h
index 08b75c15269a..18ff7ee9e774 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -51,6 +51,8 @@
51 51
52#define HPET_TN_ROUTE_SHIFT 9 52#define HPET_TN_ROUTE_SHIFT 9
53 53
54#define HPET_TICK_RATE (HZ * 100000UL)
55
54extern int is_hpet_enabled(void); 56extern int is_hpet_enabled(void);
55extern int hpet_rtc_timer_init(void); 57extern int hpet_rtc_timer_init(void);
56extern int oem_force_hpet_timer(void); 58extern int oem_force_hpet_timer(void);
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
index 876eb9a2fe78..cba8a3b0cded 100644
--- a/include/asm-x86_64/i387.h
+++ b/include/asm-x86_64/i387.h
@@ -72,6 +72,23 @@ extern int set_fpregs(struct task_struct *tsk,
72#define set_fpu_swd(t,val) ((t)->thread.i387.fxsave.swd = (val)) 72#define set_fpu_swd(t,val) ((t)->thread.i387.fxsave.swd = (val))
73#define set_fpu_fxsr_twd(t,val) ((t)->thread.i387.fxsave.twd = (val)) 73#define set_fpu_fxsr_twd(t,val) ((t)->thread.i387.fxsave.twd = (val))
74 74
75#define X87_FSW_ES (1 << 7) /* Exception Summary */
76
77/* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
78 is pending. Clear the x87 state here by setting it to fixed
79 values. The kernel data segment can be sometimes 0 and sometimes
80 new user value. Both should be ok.
81 Use the PDA as safe address because it should be already in L1. */
82static inline void clear_fpu_state(struct i387_fxsave_struct *fx)
83{
84 if (unlikely(fx->swd & X87_FSW_ES))
85 asm volatile("fnclex");
86 alternative_input(ASM_NOP8 ASM_NOP2,
87 " emms\n" /* clear stack tags */
88 " fildl %%gs:0", /* load to clear state */
89 X86_FEATURE_FXSAVE_LEAK);
90}
91
75static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) 92static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
76{ 93{
77 int err; 94 int err;
@@ -119,6 +136,7 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
119#endif 136#endif
120 if (unlikely(err)) 137 if (unlikely(err))
121 __clear_user(fx, sizeof(struct i387_fxsave_struct)); 138 __clear_user(fx, sizeof(struct i387_fxsave_struct));
139 /* No need to clear here because the caller clears USED_MATH */
122 return err; 140 return err;
123} 141}
124 142
@@ -149,7 +167,7 @@ static inline void __fxsave_clear(struct task_struct *tsk)
149 "i" (offsetof(__typeof__(*tsk), 167 "i" (offsetof(__typeof__(*tsk),
150 thread.i387.fxsave))); 168 thread.i387.fxsave)));
151#endif 169#endif
152 __asm__ __volatile__("fnclex"); 170 clear_fpu_state(&tsk->thread.i387.fxsave);
153} 171}
154 172
155static inline void kernel_fpu_begin(void) 173static inline void kernel_fpu_begin(void)
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index eeb2bcd635de..b4f4b172b15a 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -317,6 +317,4 @@
317#define __NR_ia32_ppoll 309 317#define __NR_ia32_ppoll 309
318#define __NR_ia32_unshare 310 318#define __NR_ia32_unshare 310
319 319
320#define IA32_NR_syscalls 315 /* must be > than biggest syscall! */
321
322#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 320#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index cafdfb37f0d8..a05da8a50bfd 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -177,7 +177,7 @@ static inline __u16 __readw(const volatile void __iomem *addr)
177{ 177{
178 return *(__force volatile __u16 *)addr; 178 return *(__force volatile __u16 *)addr;
179} 179}
180static inline __u32 __readl(const volatile void __iomem *addr) 180static __always_inline __u32 __readl(const volatile void __iomem *addr)
181{ 181{
182 return *(__force volatile __u32 *)addr; 182 return *(__force volatile __u32 *)addr;
183} 183}
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 5d298b799a9f..7229785094e3 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -70,6 +70,9 @@ struct mce_log {
70#define MCE_THRESHOLD_BASE MCE_EXTENDED_BANK + 1 /* MCE_AMD */ 70#define MCE_THRESHOLD_BASE MCE_EXTENDED_BANK + 1 /* MCE_AMD */
71#define MCE_THRESHOLD_DRAM_ECC MCE_THRESHOLD_BASE + 4 71#define MCE_THRESHOLD_DRAM_ECC MCE_THRESHOLD_BASE + 4
72 72
73#ifdef __KERNEL__
74#include <asm/atomic.h>
75
73void mce_log(struct mce *m); 76void mce_log(struct mce *m);
74#ifdef CONFIG_X86_MCE_INTEL 77#ifdef CONFIG_X86_MCE_INTEL
75void mce_intel_feature_init(struct cpuinfo_x86 *c); 78void mce_intel_feature_init(struct cpuinfo_x86 *c);
@@ -87,4 +90,8 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c)
87} 90}
88#endif 91#endif
89 92
93extern atomic_t mce_entry;
94
95#endif
96
90#endif 97#endif
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 6b18cd8f293d..6944e7122df5 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -12,7 +12,8 @@
12 12
13#include <asm/smp.h> 13#include <asm/smp.h>
14 14
15#define NODEMAPSIZE 0xfff 15/* Should really switch to dynamic allocation at some point */
16#define NODEMAPSIZE 0x4fff
16 17
17/* Simple perfect hash to map physical addresses to node numbers */ 18/* Simple perfect hash to map physical addresses to node numbers */
18struct memnode { 19struct memnode {
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index f6cbb4cbb5a3..1cc92fe02503 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -2,7 +2,6 @@
2#define _ASM_X8664_NUMA_H 1 2#define _ASM_X8664_NUMA_H 1
3 3
4#include <linux/nodemask.h> 4#include <linux/nodemask.h>
5#include <asm/numnodes.h>
6 5
7struct bootnode { 6struct bootnode {
8 u64 start,end; 7 u64 start,end;
@@ -18,6 +17,8 @@ extern void numa_init_array(void);
18extern int numa_off; 17extern int numa_off;
19 18
20extern void numa_set_node(int cpu, int node); 19extern void numa_set_node(int cpu, int node);
20extern void srat_reserve_add_area(int nodeid);
21extern int hotadd_percent;
21 22
22extern unsigned char apicid_to_node[256]; 23extern unsigned char apicid_to_node[256];
23#ifdef CONFIG_NUMA 24#ifdef CONFIG_NUMA
diff --git a/include/asm-x86_64/numnodes.h b/include/asm-x86_64/numnodes.h
deleted file mode 100644
index 32be16b8ae96..000000000000
--- a/include/asm-x86_64/numnodes.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_X8664_NUMNODES_H
2#define _ASM_X8664_NUMNODES_H 1
3
4#include <linux/config.h>
5
6#ifdef CONFIG_NUMA
7#define NODES_SHIFT 6
8#else
9#define NODES_SHIFT 0
10#endif
11
12#endif
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 4405b4adeaba..7f33aaf9f7b1 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -26,7 +26,7 @@
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for_each_cpu(__i) \ 29 for_each_possible_cpu(__i) \
30 memcpy((pcpudst)+__per_cpu_offset(__i), \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 (src), (size)); \ 31 (src), (size)); \
32} while (0) 32} while (0)
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index f18443fcdf04..b9e5320b7625 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -33,7 +33,7 @@ static __always_inline cycles_t get_cycles_sync(void)
33 unsigned eax; 33 unsigned eax;
34 /* Don't do an additional sync on CPUs where we know 34 /* Don't do an additional sync on CPUs where we know
35 RDTSC is already synchronous. */ 35 RDTSC is already synchronous. */
36 alternative_io(ASM_NOP2, "cpuid", X86_FEATURE_SYNC_RDTSC, 36 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
37 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); 37 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
38 rdtscll(ret); 38 rdtscll(ret);
39 return ret; 39 return ret;
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index f21ff2c1e960..98c36eae567c 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -611,8 +611,12 @@ __SYSCALL(__NR_set_robust_list, sys_set_robust_list)
611__SYSCALL(__NR_get_robust_list, sys_get_robust_list) 611__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
612#define __NR_splice 275 612#define __NR_splice 275
613__SYSCALL(__NR_splice, sys_splice) 613__SYSCALL(__NR_splice, sys_splice)
614#define __NR_tee 276
615__SYSCALL(__NR_tee, sys_tee)
616#define __NR_sync_file_range 277
617__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
614 618
615#define __NR_syscall_max __NR_splice 619#define __NR_syscall_max __NR_sync_file_range
616 620
617#ifndef __NO_STUBS 621#ifndef __NO_STUBS
618 622
diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h
index 10c443435c11..3b89a772d0a0 100644
--- a/include/asm-xtensa/ioctls.h
+++ b/include/asm-xtensa/ioctls.h
@@ -107,6 +107,6 @@
107#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ 107#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */
108 108
109#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ 109#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
110#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* read serial port inline interrupt counts */ 110#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
111 111
112#endif /* _XTENSA_IOCTLS_H */ 112#endif /* _XTENSA_IOCTLS_H */
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index 9284867f1cb9..b29f7ae6a08a 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -111,8 +111,6 @@ extern void *_switch_to(void *last, void *next);
111 111
112#endif /* __ASSEMBLY__ */ 112#endif /* __ASSEMBLY__ */
113 113
114#define prepare_to_switch() do { } while(0)
115
116#define switch_to(prev,next,last) \ 114#define switch_to(prev,next,last) \
117do { \ 115do { \
118 clear_cpenable(); \ 116 clear_cpenable(); \
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d0cac8b58de7..59e1259b1c40 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -17,6 +17,8 @@
17 17
18#include <asm/scatterlist.h> 18#include <asm/scatterlist.h>
19 19
20struct scsi_ioctl_command;
21
20struct request_queue; 22struct request_queue;
21typedef struct request_queue request_queue_t; 23typedef struct request_queue request_queue_t;
22struct elevator_queue; 24struct elevator_queue;
@@ -611,6 +613,8 @@ extern void blk_plug_device(request_queue_t *);
611extern int blk_remove_plug(request_queue_t *); 613extern int blk_remove_plug(request_queue_t *);
612extern void blk_recount_segments(request_queue_t *, struct bio *); 614extern void blk_recount_segments(request_queue_t *, struct bio *);
613extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 615extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
616extern int sg_scsi_ioctl(struct file *, struct request_queue *,
617 struct gendisk *, struct scsi_ioctl_command __user *);
614extern void blk_start_queue(request_queue_t *q); 618extern void blk_start_queue(request_queue_t *q);
615extern void blk_stop_queue(request_queue_t *q); 619extern void blk_stop_queue(request_queue_t *q);
616extern void blk_sync_queue(struct request_queue *q); 620extern void blk_sync_queue(struct request_queue *q);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index de3eb8d8ae26..da2d107fe2cf 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -45,6 +45,7 @@ extern unsigned long __init bootmem_bootmap_pages (unsigned long);
45extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 45extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
46extern void __init free_bootmem (unsigned long addr, unsigned long size); 46extern void __init free_bootmem (unsigned long addr, unsigned long size);
47extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); 47extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
48extern void * __init __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal);
48extern void * __init __alloc_bootmem_low(unsigned long size, 49extern void * __init __alloc_bootmem_low(unsigned long size,
49 unsigned long align, 50 unsigned long align,
50 unsigned long goal); 51 unsigned long goal);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 9b4751aecc23..ff61817082fa 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -21,7 +21,7 @@ enum dma_data_direction {
21#define DMA_30BIT_MASK 0x000000003fffffffULL 21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL 22#define DMA_29BIT_MASK 0x000000001fffffffULL
23#define DMA_28BIT_MASK 0x000000000fffffffULL 23#define DMA_28BIT_MASK 0x000000000fffffffULL
24#define DMA_24BIT_MASK 0x0000000000ffffffULL 24#define DMA_24BIT_MASK 0x0000000000ffffffULL
25 25
26#include <asm/dma-mapping.h> 26#include <asm/dma-mapping.h>
27 27
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 16be62041bfe..ff56c0bec43c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -762,7 +762,7 @@ extern int fcntl_getlease(struct file *filp);
762#define SYNC_FILE_RANGE_WRITE 2 762#define SYNC_FILE_RANGE_WRITE 2
763#define SYNC_FILE_RANGE_WAIT_AFTER 4 763#define SYNC_FILE_RANGE_WAIT_AFTER 4
764extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, 764extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
765 int flags); 765 unsigned int flags);
766 766
767/* fs/locks.c */ 767/* fs/locks.c */
768extern void locks_init_lock(struct file_lock *); 768extern void locks_init_lock(struct file_lock *);
@@ -1039,8 +1039,8 @@ struct file_operations {
1039 int (*check_flags)(int); 1039 int (*check_flags)(int);
1040 int (*dir_notify)(struct file *filp, unsigned long arg); 1040 int (*dir_notify)(struct file *filp, unsigned long arg);
1041 int (*flock) (struct file *, int, struct file_lock *); 1041 int (*flock) (struct file *, int, struct file_lock *);
1042 ssize_t (*splice_write)(struct inode *, struct file *, size_t, unsigned int); 1042 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1043 ssize_t (*splice_read)(struct file *, struct inode *, size_t, unsigned int); 1043 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1044}; 1044};
1045 1045
1046struct inode_operations { 1046struct inode_operations {
@@ -1614,8 +1614,17 @@ extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor
1614extern void do_generic_mapping_read(struct address_space *mapping, 1614extern void do_generic_mapping_read(struct address_space *mapping,
1615 struct file_ra_state *, struct file *, 1615 struct file_ra_state *, struct file *,
1616 loff_t *, read_descriptor_t *, read_actor_t); 1616 loff_t *, read_descriptor_t *, read_actor_t);
1617extern ssize_t generic_file_splice_read(struct file *, struct inode *, size_t, unsigned int); 1617
1618extern ssize_t generic_file_splice_write(struct inode *, struct file *, size_t, unsigned int); 1618/* fs/splice.c */
1619extern ssize_t generic_file_splice_read(struct file *, loff_t *,
1620 struct pipe_inode_info *, size_t, unsigned int);
1621extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
1622 struct file *, loff_t *, size_t, unsigned int);
1623extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
1624 struct file *out, loff_t *, size_t len, unsigned int flags);
1625extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
1626 size_t len, unsigned int flags);
1627
1619extern void 1628extern void
1620file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1629file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1621extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, 1630extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 10a27f29d692..2ef845b35175 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -105,6 +105,7 @@ struct gendisk {
105 * disks that can't be partitioned. */ 105 * disks that can't be partitioned. */
106 char disk_name[32]; /* name of major driver */ 106 char disk_name[32]; /* name of major driver */
107 struct hd_struct **part; /* [indexed by minor] */ 107 struct hd_struct **part; /* [indexed by minor] */
108 int part_uevent_suppress;
108 struct block_device_operations *fops; 109 struct block_device_operations *fops;
109 struct request_queue *queue; 110 struct request_queue *queue;
110 void *private_data; 111 void *private_data;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7851e6b520cf..3ac452945a7d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,6 +57,8 @@ struct vm_area_struct;
57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
58 __GFP_NOMEMALLOC|__GFP_HARDWALL) 58 __GFP_NOMEMALLOC|__GFP_HARDWALL)
59 59
60/* This equals 0, but use constants in case they ever change */
61#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
60/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ 62/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
61#define GFP_ATOMIC (__GFP_HIGH) 63#define GFP_ATOMIC (__GFP_HIGH)
62#define GFP_NOIO (__GFP_WAIT) 64#define GFP_NOIO (__GFP_WAIT)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 8d2db412ba9c..a8bef1d1371c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1220,7 +1220,6 @@ typedef struct ide_pci_enablebit_s {
1220enum { 1220enum {
1221 /* Uses ISA control ports not PCI ones. */ 1221 /* Uses ISA control ports not PCI ones. */
1222 IDEPCI_FLAG_ISA_PORTS = (1 << 0), 1222 IDEPCI_FLAG_ISA_PORTS = (1 << 0),
1223 IDEPCI_FLAG_FORCE_PDC = (1 << 1),
1224}; 1223};
1225 1224
1226typedef struct ide_pci_device_s { 1225typedef struct ide_pci_device_s {
diff --git a/include/linux/init.h b/include/linux/init.h
index ed0ac7c39fdc..93dcbe1abb4c 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -245,7 +245,8 @@ void __init parse_early_param(void);
245#define __cpuexitdata __exitdata 245#define __cpuexitdata __exitdata
246#endif 246#endif
247 247
248#ifdef CONFIG_MEMORY_HOTPLUG 248#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
249 || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
249#define __meminit 250#define __meminit
250#define __meminitdata 251#define __meminitdata
251#define __memexit 252#define __memexit
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 99905e180532..043376920f51 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -36,6 +36,8 @@
36/* LATCH is used in the interval timer and ftape setup. */ 36/* LATCH is used in the interval timer and ftape setup. */
37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
38 38
39#define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)
40
39/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can 41/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can
40 * improve accuracy by shifting LSH bits, hence calculating: 42 * improve accuracy by shifting LSH bits, hence calculating:
41 * (NOM << LSH) / DEN 43 * (NOM << LSH) / DEN
@@ -51,9 +53,13 @@
51/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
52#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
53 55
56#define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))
57
54/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ 58/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */
55#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) 59#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
56 60
61#define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))
62
57/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
58#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
59 65
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index c73ed0b05591..2ae50277f581 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -177,7 +177,7 @@ static inline void console_verbose(void)
177 177
178extern void bust_spinlocks(int yes); 178extern void bust_spinlocks(int yes);
179extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 179extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
180extern __deprecated_for_modules int panic_timeout; 180extern int panic_timeout;
181extern int panic_on_oops; 181extern int panic_on_oops;
182extern int tainted; 182extern int tainted;
183extern const char *print_tainted(void); 183extern const char *print_tainted(void);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 4cb1214ec290..dcd0623be892 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -24,6 +24,7 @@
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/wait.h>
27#include <asm/atomic.h> 28#include <asm/atomic.h>
28 29
29#define KOBJ_NAME_LEN 20 30#define KOBJ_NAME_LEN 20
@@ -56,6 +57,7 @@ struct kobject {
56 struct kset * kset; 57 struct kset * kset;
57 struct kobj_type * ktype; 58 struct kobj_type * ktype;
58 struct dentry * dentry; 59 struct dentry * dentry;
60 wait_queue_head_t poll;
59}; 61};
60 62
61extern int kobject_set_name(struct kobject *, const char *, ...) 63extern int kobject_set_name(struct kobject *, const char *, ...)
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 4617e75903b0..dc23c7c639f3 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -19,39 +19,38 @@ struct class_device;
19 */ 19 */
20 20
21enum led_brightness { 21enum led_brightness {
22 LED_OFF = 0, 22 LED_OFF = 0,
23 LED_HALF = 127, 23 LED_HALF = 127,
24 LED_FULL = 255, 24 LED_FULL = 255,
25}; 25};
26 26
27struct led_classdev { 27struct led_classdev {
28 const char *name; 28 const char *name;
29 int brightness; 29 int brightness;
30 int flags; 30 int flags;
31#define LED_SUSPENDED (1 << 0)
32 31
33 /* A function to set the brightness of the led */ 32#define LED_SUSPENDED (1 << 0)
34 void (*brightness_set)(struct led_classdev *led_cdev,
35 enum led_brightness brightness);
36 33
37 struct class_device *class_dev; 34 /* Set LED brightness level */
38 /* LED Device linked list */ 35 void (*brightness_set)(struct led_classdev *led_cdev,
39 struct list_head node; 36 enum led_brightness brightness);
37
38 struct class_device *class_dev;
39 struct list_head node; /* LED Device list */
40 char *default_trigger; /* Trigger to use */
40 41
41 /* Trigger data */
42 char *default_trigger;
43#ifdef CONFIG_LEDS_TRIGGERS 42#ifdef CONFIG_LEDS_TRIGGERS
44 rwlock_t trigger_lock;
45 /* Protects the trigger data below */ 43 /* Protects the trigger data below */
44 rwlock_t trigger_lock;
46 45
47 struct led_trigger *trigger; 46 struct led_trigger *trigger;
48 struct list_head trig_list; 47 struct list_head trig_list;
49 void *trigger_data; 48 void *trigger_data;
50#endif 49#endif
51}; 50};
52 51
53extern int led_classdev_register(struct device *parent, 52extern int led_classdev_register(struct device *parent,
54 struct led_classdev *led_cdev); 53 struct led_classdev *led_cdev);
55extern void led_classdev_unregister(struct led_classdev *led_cdev); 54extern void led_classdev_unregister(struct led_classdev *led_cdev);
56extern void led_classdev_suspend(struct led_classdev *led_cdev); 55extern void led_classdev_suspend(struct led_classdev *led_cdev);
57extern void led_classdev_resume(struct led_classdev *led_cdev); 56extern void led_classdev_resume(struct led_classdev *led_cdev);
@@ -65,16 +64,16 @@ extern void led_classdev_resume(struct led_classdev *led_cdev);
65 64
66struct led_trigger { 65struct led_trigger {
67 /* Trigger Properties */ 66 /* Trigger Properties */
68 const char *name; 67 const char *name;
69 void (*activate)(struct led_classdev *led_cdev); 68 void (*activate)(struct led_classdev *led_cdev);
70 void (*deactivate)(struct led_classdev *led_cdev); 69 void (*deactivate)(struct led_classdev *led_cdev);
71 70
72 /* LEDs under control by this trigger (for simple triggers) */ 71 /* LEDs under control by this trigger (for simple triggers) */
73 rwlock_t leddev_list_lock; 72 rwlock_t leddev_list_lock;
74 struct list_head led_cdevs; 73 struct list_head led_cdevs;
75 74
76 /* Link to next registered trigger */ 75 /* Link to next registered trigger */
77 struct list_head next_trig; 76 struct list_head next_trig;
78}; 77};
79 78
80/* Registration functions for complex triggers */ 79/* Registration functions for complex triggers */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0d61357604d5..b80d2e7fa6d2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -523,7 +523,6 @@ extern void ata_host_set_remove(struct ata_host_set *host_set);
523extern int ata_scsi_detect(struct scsi_host_template *sht); 523extern int ata_scsi_detect(struct scsi_host_template *sht);
524extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 524extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
525extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 525extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
526extern int ata_scsi_error(struct Scsi_Host *host);
527extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); 526extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
528extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); 527extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
529extern int ata_scsi_release(struct Scsi_Host *host); 528extern int ata_scsi_release(struct Scsi_Host *host);
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 968b1aa3732c..911206386171 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -58,8 +58,6 @@ extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
58/* need some defines for these for archs that don't support it */ 58/* need some defines for these for archs that don't support it */
59extern void online_page(struct page *page); 59extern void online_page(struct page *page);
60/* VM interface that may be used by firmware interface */ 60/* VM interface that may be used by firmware interface */
61extern int add_memory(u64 start, u64 size);
62extern int remove_memory(u64 start, u64 size);
63extern int online_pages(unsigned long, unsigned long); 61extern int online_pages(unsigned long, unsigned long);
64 62
65/* reasonably generic interface to expand the physical pages in a zone */ 63/* reasonably generic interface to expand the physical pages in a zone */
@@ -92,11 +90,6 @@ static inline int mhp_notimplemented(const char *func)
92 return -ENOSYS; 90 return -ENOSYS;
93} 91}
94 92
95static inline int __add_pages(struct zone *zone, unsigned long start_pfn,
96 unsigned long nr_pages)
97{
98 return mhp_notimplemented(__FUNCTION__);
99}
100#endif /* ! CONFIG_MEMORY_HOTPLUG */ 93#endif /* ! CONFIG_MEMORY_HOTPLUG */
101static inline int __remove_pages(struct zone *zone, unsigned long start_pfn, 94static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
102 unsigned long nr_pages) 95 unsigned long nr_pages)
@@ -105,4 +98,8 @@ static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
105 dump_stack(); 98 dump_stack();
106 return -ENOSYS; 99 return -ENOSYS;
107} 100}
101
102extern int add_memory(u64 start, u64 size);
103extern int remove_memory(u64 start, u64 size);
104
108#endif /* __LINUX_MEMORY_HOTPLUG_H */ 105#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6aa016f1d3ae..1154684209a4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -229,10 +229,9 @@ struct page {
229 unsigned long private; /* Mapping-private opaque data: 229 unsigned long private; /* Mapping-private opaque data:
230 * usually used for buffer_heads 230 * usually used for buffer_heads
231 * if PagePrivate set; used for 231 * if PagePrivate set; used for
232 * swp_entry_t if PageSwapCache. 232 * swp_entry_t if PageSwapCache;
233 * When page is free, this
234 * indicates order in the buddy 233 * indicates order in the buddy
235 * system. 234 * system if PG_buddy is set.
236 */ 235 */
237 struct address_space *mapping; /* If low bit clear, points to 236 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL. 237 * inode address_space, or NULL.
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index 955d3069d727..edfa012fad3a 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -13,7 +13,7 @@
13#ifndef __ASM_MV643XX_H 13#ifndef __ASM_MV643XX_H
14#define __ASM_MV643XX_H 14#define __ASM_MV643XX_H
15 15
16#ifdef __MIPS__ 16#ifdef __mips__
17#include <asm/addrspace.h> 17#include <asm/addrspace.h>
18#include <asm/marvell.h> 18#include <asm/marvell.h>
19#endif 19#endif
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 412e52ca9720..b31a9bca9361 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -110,6 +110,8 @@ struct nf_info
110/* Function to register/unregister hook points. */ 110/* Function to register/unregister hook points. */
111int nf_register_hook(struct nf_hook_ops *reg); 111int nf_register_hook(struct nf_hook_ops *reg);
112void nf_unregister_hook(struct nf_hook_ops *reg); 112void nf_unregister_hook(struct nf_hook_ops *reg);
113int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
114void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
113 115
114/* Functions to register get/setsockopt ranges (non-inclusive). You 116/* Functions to register get/setsockopt ranges (non-inclusive). You
115 need to check permissions yourself! */ 117 need to check permissions yourself! */
@@ -281,16 +283,42 @@ extern void nf_invalidate_cache(int pf);
281 Returns true or false. */ 283 Returns true or false. */
282extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 284extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
283 285
284struct nf_queue_rerouter { 286struct nf_afinfo {
285 void (*save)(const struct sk_buff *skb, struct nf_info *info); 287 unsigned short family;
286 int (*reroute)(struct sk_buff **skb, const struct nf_info *info); 288 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook,
287 int rer_size; 289 unsigned int dataoff, u_int8_t protocol);
290 void (*saveroute)(const struct sk_buff *skb,
291 struct nf_info *info);
292 int (*reroute)(struct sk_buff **skb,
293 const struct nf_info *info);
294 int route_key_size;
288}; 295};
289 296
290#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info)) 297extern struct nf_afinfo *nf_afinfo[];
298static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
299{
300 return rcu_dereference(nf_afinfo[family]);
301}
302
303static inline unsigned int
304nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
305 u_int8_t protocol, unsigned short family)
306{
307 struct nf_afinfo *afinfo;
308 unsigned int csum = 0;
309
310 rcu_read_lock();
311 afinfo = nf_get_afinfo(family);
312 if (afinfo)
313 csum = afinfo->checksum(skb, hook, dataoff, protocol);
314 rcu_read_unlock();
315 return csum;
316}
291 317
292extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer); 318extern int nf_register_afinfo(struct nf_afinfo *afinfo);
293extern int nf_unregister_queue_rerouter(int pf); 319extern void nf_unregister_afinfo(struct nf_afinfo *afinfo);
320
321#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
294 322
295#include <net/flow.h> 323#include <net/flow.h>
296extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 324extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 43c09d790b83..85301c5e8d24 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -80,6 +80,8 @@ enum nf_ip_hook_priorities {
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81extern int ip_route_me_harder(struct sk_buff **pskb); 81extern int ip_route_me_harder(struct sk_buff **pskb);
82extern int ip_xfrm_me_harder(struct sk_buff **pskb); 82extern int ip_xfrm_me_harder(struct sk_buff **pskb);
83extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
84 unsigned int dataoff, u_int8_t protocol);
83#endif /*__KERNEL__*/ 85#endif /*__KERNEL__*/
84 86
85#endif /*__LINUX_IP_NETFILTER_H*/ 87#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index 0987cea53840..eace86bd2adb 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -3,6 +3,8 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h>
7
6#define RAS_PORT 1719 8#define RAS_PORT 1719
7#define Q931_PORT 1720 9#define Q931_PORT 1720
8#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */ 10#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
@@ -25,6 +27,56 @@ struct ip_ct_h323_master {
25 }; 27 };
26}; 28};
27 29
30struct ip_conntrack_expect;
31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 u_int32_t * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
37 struct ip_conntrack_expect *this);
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr,
41 u_int32_t ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff,
44 TransportAddress * addr,
45 u_int32_t ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned char **data,
50 TransportAddress * addr, int count);
51extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
52 struct ip_conntrack * ct,
53 enum ip_conntrack_info ctinfo,
54 unsigned char **data,
55 TransportAddress * addr, int count);
56extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
57 struct ip_conntrack * ct,
58 enum ip_conntrack_info ctinfo,
59 unsigned char **data, int dataoff,
60 H245_TransportAddress * addr,
61 u_int16_t port, u_int16_t rtp_port,
62 struct ip_conntrack_expect * rtp_exp,
63 struct ip_conntrack_expect * rtcp_exp);
64extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
65 enum ip_conntrack_info ctinfo,
66 unsigned char **data, int dataoff,
67 H245_TransportAddress * addr, u_int16_t port,
68 struct ip_conntrack_expect * exp);
69extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp);
74extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
75 enum ip_conntrack_info ctinfo,
76 unsigned char **data, TransportAddress * addr,
77 int idx, u_int16_t port,
78 struct ip_conntrack_expect * exp);
79
28#endif 80#endif
29 81
30#endif 82#endif
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
index 0bd828081c0c..0bd828081c0c 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_types.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
index cc98f7aa5abe..cc98f7aa5abe 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323_types.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 14f2bd010884..52a7b9e76428 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -73,6 +73,9 @@ enum nf_ip6_hook_priorities {
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
76extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
77 unsigned int dataoff, u_int8_t protocol);
78
76extern int ipv6_netfilter_init(void); 79extern int ipv6_netfilter_init(void);
77extern void ipv6_netfilter_fini(void); 80extern void ipv6_netfilter_fini(void);
78#else /* CONFIG_NETFILTER */ 81#else /* CONFIG_NETFILTER */
diff --git a/include/linux/numa.h b/include/linux/numa.h
index f0c539bd3cfc..e481feb1bfd8 100644
--- a/include/linux/numa.h
+++ b/include/linux/numa.h
@@ -3,11 +3,9 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifndef CONFIG_FLATMEM 6#ifdef CONFIG_NODES_SHIFT
7#include <asm/numnodes.h> 7#define NODES_SHIFT CONFIG_NODES_SHIFT
8#endif 8#else
9
10#ifndef NODES_SHIFT
11#define NODES_SHIFT 0 9#define NODES_SHIFT 0
12#endif 10#endif
13 11
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9ea629c02a4b..d276a4e2f825 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -48,8 +48,20 @@
48 48
49/* 49/*
50 * Don't use the *_dontuse flags. Use the macros. Otherwise you'll break 50 * Don't use the *_dontuse flags. Use the macros. Otherwise you'll break
51 * locked- and dirty-page accounting. The top eight bits of page->flags are 51 * locked- and dirty-page accounting.
52 * used for page->zone, so putting flag bits there doesn't work. 52 *
53 * The page flags field is split into two parts, the main flags area
54 * which extends from the low bits upwards, and the fields area which
55 * extends from the high bits downwards.
56 *
57 * | FIELD | ... | FLAGS |
58 * N-1 ^ 0
59 * (N-FLAGS_RESERVED)
60 *
61 * The fields area is reserved for fields mapping zone, node and SPARSEMEM
62 * section. The boundry between these two areas is defined by
63 * FLAGS_RESERVED which defines the width of the fields section
64 * (see linux/mmzone.h). New flags must _not_ overlap with this area.
53 */ 65 */
54#define PG_locked 0 /* Page is locked. Don't touch. */ 66#define PG_locked 0 /* Page is locked. Don't touch. */
55#define PG_error 1 67#define PG_error 1
@@ -74,7 +86,9 @@
74#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 86#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
75#define PG_reclaim 17 /* To be reclaimed asap */ 87#define PG_reclaim 17 /* To be reclaimed asap */
76#define PG_nosave_free 18 /* Free, should not be written */ 88#define PG_nosave_free 18 /* Free, should not be written */
77#define PG_uncached 19 /* Page has been mapped as uncached */ 89#define PG_buddy 19 /* Page is free, on buddy lists */
90
91#define PG_uncached 20 /* Page has been mapped as uncached */
78 92
79/* 93/*
80 * Global page accounting. One instance per CPU. Only unsigned longs are 94 * Global page accounting. One instance per CPU. Only unsigned longs are
@@ -317,6 +331,10 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
317#define SetPageNosaveFree(page) set_bit(PG_nosave_free, &(page)->flags) 331#define SetPageNosaveFree(page) set_bit(PG_nosave_free, &(page)->flags)
318#define ClearPageNosaveFree(page) clear_bit(PG_nosave_free, &(page)->flags) 332#define ClearPageNosaveFree(page) clear_bit(PG_nosave_free, &(page)->flags)
319 333
334#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags)
335#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags)
336#define __ClearPageBuddy(page) __clear_bit(PG_buddy, &(page)->flags)
337
320#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags) 338#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags)
321#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags) 339#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
322#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags) 340#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0aad5a378e95..3a6a4e37a482 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -97,7 +97,13 @@ enum pci_channel_state {
97 97
98typedef unsigned short __bitwise pci_bus_flags_t; 98typedef unsigned short __bitwise pci_bus_flags_t;
99enum pci_bus_flags { 99enum pci_bus_flags {
100 PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1, 100 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
101};
102
103struct pci_cap_saved_state {
104 struct hlist_node next;
105 char cap_nr;
106 u32 data[0];
101}; 107};
102 108
103/* 109/*
@@ -159,6 +165,7 @@ struct pci_dev {
159 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 165 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
160 166
161 u32 saved_config_space[16]; /* config space saved at suspend time */ 167 u32 saved_config_space[16]; /* config space saved at suspend time */
168 struct hlist_head saved_cap_space;
162 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 169 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
163 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 170 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
164 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 171 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
@@ -169,6 +176,30 @@ struct pci_dev {
169#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 176#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
170#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 177#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
171 178
179static inline struct pci_cap_saved_state *pci_find_saved_cap(
180 struct pci_dev *pci_dev,char cap)
181{
182 struct pci_cap_saved_state *tmp;
183 struct hlist_node *pos;
184
185 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
186 if (tmp->cap_nr == cap)
187 return tmp;
188 }
189 return NULL;
190}
191
192static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
193 struct pci_cap_saved_state *new_cap)
194{
195 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
196}
197
198static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
199{
200 hlist_del(&cap->next);
201}
202
172/* 203/*
173 * For PCI devices, the region numbers are assigned this way: 204 * For PCI devices, the region numbers are assigned this way:
174 * 205 *
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 870fe38378b1..d6fe048376ab 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -356,6 +356,10 @@
356#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e 356#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e
357#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 357#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376
358#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 358#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
359#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a
360#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380
361#define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381
362#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
359 363
360#define PCI_VENDOR_ID_VLSI 0x1004 364#define PCI_VENDOR_ID_VLSI 0x1004
361#define PCI_DEVICE_ID_VLSI_82C592 0x0005 365#define PCI_DEVICE_ID_VLSI_82C592 0x0005
@@ -497,7 +501,8 @@
497#define PCI_DEVICE_ID_AMD_8111_SMBUS 0x746b 501#define PCI_DEVICE_ID_AMD_8111_SMBUS 0x746b
498#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d 502#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
499#define PCI_DEVICE_ID_AMD_8151_0 0x7454 503#define PCI_DEVICE_ID_AMD_8151_0 0x7454
500#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 504#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
505#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
501#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 506#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
502#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 507#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
503#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 508#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ec384958d509..ef7f33c0be19 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -21,6 +21,7 @@ struct pipe_buf_operations {
21 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *); 21 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *);
22 void (*release)(struct pipe_inode_info *, struct pipe_buffer *); 22 void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
23 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); 23 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
24 void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
24}; 25};
25 26
26struct pipe_inode_info { 27struct pipe_inode_info {
@@ -36,27 +37,19 @@ struct pipe_inode_info {
36 unsigned int w_counter; 37 unsigned int w_counter;
37 struct fasync_struct *fasync_readers; 38 struct fasync_struct *fasync_readers;
38 struct fasync_struct *fasync_writers; 39 struct fasync_struct *fasync_writers;
40 struct inode *inode;
39}; 41};
40 42
41/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual 43/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
42 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ 44 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
43#define PIPE_SIZE PAGE_SIZE 45#define PIPE_SIZE PAGE_SIZE
44 46
45#define PIPE_MUTEX(inode) (&(inode).i_mutex)
46#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
47#define PIPE_READERS(inode) ((inode).i_pipe->readers)
48#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
49#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers)
50#define PIPE_RCOUNTER(inode) ((inode).i_pipe->r_counter)
51#define PIPE_WCOUNTER(inode) ((inode).i_pipe->w_counter)
52#define PIPE_FASYNC_READERS(inode) (&((inode).i_pipe->fasync_readers))
53#define PIPE_FASYNC_WRITERS(inode) (&((inode).i_pipe->fasync_writers))
54
55/* Drop the inode semaphore and wait for a pipe event, atomically */ 47/* Drop the inode semaphore and wait for a pipe event, atomically */
56void pipe_wait(struct inode * inode); 48void pipe_wait(struct pipe_inode_info *pipe);
57 49
58struct inode* pipe_new(struct inode* inode); 50struct pipe_inode_info * alloc_pipe_info(struct inode * inode);
59void free_pipe_info(struct inode* inode); 51void free_pipe_info(struct inode * inode);
52void __free_pipe_info(struct pipe_inode_info *);
60 53
61/* 54/*
62 * splice is tied to pipes as a transport (at least for now), so we'll just 55 * splice is tied to pipes as a transport (at least for now), so we'll just
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 6df2585c0169..66be58902b17 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -199,6 +199,12 @@ extern int device_suspend(pm_message_t state);
199 199
200extern int dpm_runtime_suspend(struct device *, pm_message_t); 200extern int dpm_runtime_suspend(struct device *, pm_message_t);
201extern void dpm_runtime_resume(struct device *); 201extern void dpm_runtime_resume(struct device *);
202extern void __suspend_report_result(const char *function, void *fn, int ret);
203
204#define suspend_report_result(fn, ret) \
205 do { \
206 __suspend_report_result(__FUNCTION__, fn, ret); \
207 } while (0)
202 208
203#else /* !CONFIG_PM */ 209#else /* !CONFIG_PM */
204 210
@@ -219,6 +225,8 @@ static inline void dpm_runtime_resume(struct device * dev)
219{ 225{
220} 226}
221 227
228#define suspend_report_result(fn, ret) do { } while (0)
229
222#endif 230#endif
223 231
224/* changes to device_may_wakeup take effect on the next pm state change. 232/* changes to device_may_wakeup take effect on the next pm state change.
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
index 1252b45face1..008932d73c35 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -16,11 +16,6 @@ struct pm_dev __deprecated *
16pm_register(pm_dev_t type, unsigned long id, pm_callback callback); 16pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
17 17
18/* 18/*
19 * Unregister a device with power management
20 */
21void __deprecated pm_unregister(struct pm_dev *dev);
22
23/*
24 * Unregister all devices with matching callback 19 * Unregister all devices with matching callback
25 */ 20 */
26void __deprecated pm_unregister_all(pm_callback callback); 21void __deprecated pm_unregister_all(pm_callback callback);
@@ -41,8 +36,6 @@ static inline struct pm_dev *pm_register(pm_dev_t type,
41 return NULL; 36 return NULL;
42} 37}
43 38
44static inline void pm_unregister(struct pm_dev *dev) {}
45
46static inline void pm_unregister_all(pm_callback callback) {} 39static inline void pm_unregister_all(pm_callback callback) {}
47 40
48static inline int pm_send_all(pm_request_t rqst, void *data) 41static inline int pm_send_all(pm_request_t rqst, void *data)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 135871df9911..4b47a0253425 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -79,7 +79,7 @@ struct kcore_list {
79struct vmcore { 79struct vmcore {
80 struct list_head list; 80 struct list_head list;
81 unsigned long long paddr; 81 unsigned long long paddr;
82 unsigned long size; 82 unsigned long long size;
83 loff_t offset; 83 loff_t offset;
84}; 84};
85 85
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 774e1acfb8c4..f1fbae7e390e 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -227,8 +227,8 @@ struct mdp_superblock_1 {
227 */ 227 */
228 228
229 /* These are only valid with feature bit '4' */ 229 /* These are only valid with feature bit '4' */
230 __u64 reshape_position; /* next address in array-space for reshape */
231 __u32 new_level; /* new level we are reshaping to */ 230 __u32 new_level; /* new level we are reshaping to */
231 __u64 reshape_position; /* next address in array-space for reshape */
232 __u32 delta_disks; /* change in number of raid_disks */ 232 __u32 delta_disks; /* change in number of raid_disks */
233 __u32 new_layout; /* new layout */ 233 __u32 new_layout; /* new layout */
234 __u32 new_chunk; /* new chunk size (bytes) */ 234 __u32 new_chunk; /* new chunk size (bytes) */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 541f4828f5e7..29b7d4f87d20 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -684,6 +684,7 @@ static inline void prefetch_stack(struct task_struct *t) { }
684 684
685struct audit_context; /* See audit.c */ 685struct audit_context; /* See audit.c */
686struct mempolicy; 686struct mempolicy;
687struct pipe_inode_info;
687 688
688enum sleep_type { 689enum sleep_type {
689 SLEEP_NORMAL, 690 SLEEP_NORMAL,
@@ -882,6 +883,11 @@ struct task_struct {
882 883
883 atomic_t fs_excl; /* holding fs exclusive resources */ 884 atomic_t fs_excl; /* holding fs exclusive resources */
884 struct rcu_head rcu; 885 struct rcu_head rcu;
886
887 /*
888 * cache last used pipe for splice
889 */
890 struct pipe_inode_info *splice_pipe;
885}; 891};
886 892
887static inline pid_t process_group(struct task_struct *tsk) 893static inline pid_t process_group(struct task_struct *tsk)
@@ -905,7 +911,6 @@ static inline int pid_alive(struct task_struct *p)
905extern void free_task(struct task_struct *tsk); 911extern void free_task(struct task_struct *tsk);
906#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 912#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
907 913
908extern void __put_task_struct_cb(struct rcu_head *rhp);
909extern void __put_task_struct(struct task_struct *t); 914extern void __put_task_struct(struct task_struct *t);
910 915
911static inline void put_task_struct(struct task_struct *t) 916static inline void put_task_struct(struct task_struct *t)
@@ -1187,8 +1192,7 @@ extern void wait_task_inactive(task_t * p);
1187#define remove_parent(p) list_del_init(&(p)->sibling) 1192#define remove_parent(p) list_del_init(&(p)->sibling)
1188#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) 1193#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
1189 1194
1190#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) 1195#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
1191#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
1192 1196
1193#define for_each_process(p) \ 1197#define for_each_process(p) \
1194 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 1198 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
@@ -1203,9 +1207,10 @@ extern void wait_task_inactive(task_t * p);
1203#define while_each_thread(g, t) \ 1207#define while_each_thread(g, t) \
1204 while ((t = next_thread(t)) != g) 1208 while ((t = next_thread(t)) != g)
1205 1209
1206#define thread_group_leader(p) (p->pid == p->tgid) 1210/* de_thread depends on thread_group_leader not being a pid based check */
1211#define thread_group_leader(p) (p == p->group_leader)
1207 1212
1208static inline task_t *next_thread(task_t *p) 1213static inline task_t *next_thread(const task_t *p)
1209{ 1214{
1210 return list_entry(rcu_dereference(p->thread_group.next), 1215 return list_entry(rcu_dereference(p->thread_group.next),
1211 task_t, thread_group); 1216 task_t, thread_group);
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 6336987dae62..2925e66a6732 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -41,7 +41,8 @@ struct screen_info {
41 u16 vesapm_off; /* 0x30 */ 41 u16 vesapm_off; /* 0x30 */
42 u16 pages; /* 0x32 */ 42 u16 pages; /* 0x32 */
43 u16 vesa_attributes; /* 0x34 */ 43 u16 vesa_attributes; /* 0x34 */
44 /* 0x36 -- 0x3f reserved for future expansion */ 44 u32 capabilities; /* 0x36 */
45 /* 0x3a -- 0x3f reserved for future expansion */
45}; 46};
46 47
47extern struct screen_info screen_info; 48extern struct screen_info screen_info;
diff --git a/include/linux/sdla_asy.h b/include/linux/sdla_asy.h
deleted file mode 100644
index f62242537c86..000000000000
--- a/include/linux/sdla_asy.h
+++ /dev/null
@@ -1,226 +0,0 @@
1/*****************************************************************************
2* sdla_asy.h Header file for the Sangoma S508/S514 asynchronous code API
3*
4* Author: Gideon Hack
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13*
14* Jan 28, 2000 Gideon Hack Initial Version
15*
16*****************************************************************************/
17
18
19#ifndef _WANPIPE_ASYNC_H
20#define _WANPIPE_ASYNC_H
21
22/* ----------------------------------------------------------------------------
23 * Interface commands
24 * --------------------------------------------------------------------------*/
25
26#define SET_ASY_CONFIGURATION 0xE2 /* set the asychronous operational configuration */
27#define READ_ASY_CONFIGURATION 0xE3 /* read the current asychronous operational configuration */
28#define ENABLE_ASY_COMMUNICATIONS 0xE4 /* enable asychronous communications */
29#define DISABLE_ASY_COMMUNICATIONS 0xE5 /* disable asychronous communications */
30#define READ_ASY_OPERATIONAL_STATS 0xE7 /* retrieve the asychronous operational statistics */
31#define FLUSH_ASY_OPERATIONAL_STATS 0xE8 /* flush the asychronous operational statistics */
32#define TRANSMIT_ASY_BREAK_SIGNAL 0xEC /* transmit an asychronous break signal */
33
34
35
36/* ----------------------------------------------------------------------------
37 * Return codes from interface commands
38 * --------------------------------------------------------------------------*/
39
40#define COMMAND_INVALID_FOR_PORT 0x50 /* the command is invalid for the selected port */
41#define DISABLE_ASY_COMMS_BEFORE_CFG 0xE1 /* communications must be disabled before setting the configuration */
42#define ASY_COMMS_ENABLED 0xE1 /* communications are currently enabled */
43#define ASY_COMMS_DISABLED 0xE1 /* communications are currently disabled */
44#define ASY_CFG_BEFORE_COMMS_ENABLED 0xE2 /* perform a SET_ASY_CONFIGURATION before enabling comms */
45#define LGTH_ASY_CFG_DATA_INVALID 0xE2 /* the length of the passed configuration data is invalid */
46#define INVALID_ASY_CFG_DATA 0xE3 /* the passed configuration data is invalid */
47#define ASY_BREAK_SIGNAL_BUSY 0xEC /* a break signal is being transmitted */
48
49
50
51/* ----------------------------------------------------------------------------
52 * Constants for the SET_ASY_CONFIGURATION/READ_ASY_CONFIGURATION command
53 * --------------------------------------------------------------------------*/
54
55/* the asynchronous configuration structure */
56typedef struct {
57 unsigned long baud_rate PACKED; /* the baud rate */
58 unsigned short line_config_options PACKED; /* line configuration options */
59 unsigned short modem_config_options PACKED; /* modem configuration options */
60 unsigned short asy_API_options PACKED; /* asynchronous API options */
61 unsigned short asy_protocol_options PACKED; /* asynchronous protocol options */
62 unsigned short Tx_bits_per_char PACKED; /* number of bits per tx character */
63 unsigned short Rx_bits_per_char PACKED; /* number of bits per received character */
64 unsigned short stop_bits PACKED; /* number of stop bits per character */
65 unsigned short parity PACKED; /* parity definition */
66 unsigned short break_timer PACKED; /* the break signal timer */
67 unsigned short asy_Rx_inter_char_timer PACKED; /* the receive inter-character timer */
68 unsigned short asy_Rx_complete_length PACKED; /* the receive 'buffer complete' length */
69 unsigned short XON_char PACKED; /* the XON character */
70 unsigned short XOFF_char PACKED; /* the XOFF character */
71 unsigned short asy_statistics_options PACKED; /* async operational stat options */
72 unsigned long ptr_shared_mem_info_struct PACKED;/* ptr to the shared memory area information structure */
73 unsigned long ptr_asy_Tx_stat_el_cfg_struct PACKED;/* ptr to the transmit status element configuration structure */
74 unsigned long ptr_asy_Rx_stat_el_cfg_struct PACKED;/* ptr to the receive status element configuration structure */
75} ASY_CONFIGURATION_STRUCT;
76
77/* permitted minimum and maximum values for setting the asynchronous configuration */
78#define MIN_ASY_BAUD_RATE 50 /* maximum baud rate */
79#define MAX_ASY_BAUD_RATE 250000 /* minimum baud rate */
80#define MIN_ASY_BITS_PER_CHAR 5 /* minimum number of bits per character */
81#define MAX_ASY_BITS_PER_CHAR 8 /* maximum number of bits per character */
82#define MIN_BREAK_TMR_VAL 0 /* minimum break signal timer */
83#define MAX_BREAK_TMR_VAL 5000 /* maximum break signal timer */
84#define MIN_ASY_RX_INTER_CHAR_TMR 0 /* minimum receive inter-character timer */
85#define MAX_ASY_RX_INTER_CHAR_TMR 30000 /* maximum receive inter-character timer */
86#define MIN_ASY_RX_CPLT_LENGTH 0 /* minimum receive 'length complete' value */
87#define MAX_ASY_RX_CPLT_LENGTH 2000 /* maximum receive 'length complete' value */
88
89/* bit settings for the 'asy_API_options' */
90#define ASY_RX_DATA_TRANSPARENT 0x0001 /* do not strip parity and unused bits from received characters */
91
92/* bit settings for the 'asy_protocol_options' */
93#define ASY_RTS_HS_FOR_RX 0x0001 /* RTS handshaking is used for reception control */
94#define ASY_XON_XOFF_HS_FOR_RX 0x0002 /* XON/XOFF handshaking is used for reception control */
95#define ASY_XON_XOFF_HS_FOR_TX 0x0004 /* XON/XOFF handshaking is used for transmission control */
96#define ASY_DCD_HS_FOR_TX 0x0008 /* DCD handshaking is used for transmission control */
97#define ASY_CTS_HS_FOR_TX 0x0020 /* CTS handshaking is used for transmission control */
98
99/* bit settings for the 'stop_bits' definition */
100#define ONE_STOP_BIT 1 /* representation for 1 stop bit */
101#define TWO_STOP_BITS 2 /* representation for 2 stop bits */
102#define ONE_AND_A_HALF_STOP_BITS 3 /* representation for 1.5 stop bits */
103
104/* bit settings for the 'parity' definition */
105#define NO_PARITY 0 /* representation for no parity */
106#define ODD_PARITY 1 /* representation for odd parity */
107#define EVEN_PARITY 2 /* representation for even parity */
108
109
110
111/* ----------------------------------------------------------------------------
112 * Constants for the READ_COMMS_ERROR_STATS command (asynchronous mode)
113 * --------------------------------------------------------------------------*/
114
115/* the communications error statistics structure */
116typedef struct {
117 unsigned short Rx_overrun_err_count PACKED; /* receiver overrun error count */
118 unsigned short Rx_parity_err_count PACKED; /* parity errors received count */
119 unsigned short Rx_framing_err_count PACKED; /* framing errors received count */
120 unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later use */
121 unsigned short comms_err_stat_reserved_2 PACKED;/* reserved for later use */
122 unsigned short comms_err_stat_reserved_3 PACKED;/* reserved for later use */
123 unsigned short comms_err_stat_reserved_4 PACKED;/* reserved for later use */
124 unsigned short comms_err_stat_reserved_5 PACKED;/* reserved for later use */
125 unsigned short DCD_state_change_count PACKED; /* DCD state change count */
126 unsigned short CTS_state_change_count PACKED; /* CTS state change count */
127} ASY_COMMS_ERROR_STATS_STRUCT;
128
129
130
131/* ----------------------------------------------------------------------------
132 * Constants for the READ_ASY_OPERATIONAL_STATS command
133 * --------------------------------------------------------------------------*/
134
135/* the asynchronous operational statistics structure */
136typedef struct {
137
138 /* Data transmission statistics */
139 unsigned long Data_blocks_Tx_count PACKED;/* number of blocks transmitted */
140 unsigned long Data_bytes_Tx_count PACKED;/* number of bytes transmitted */
141 unsigned long Data_Tx_throughput PACKED;/* transmit throughput */
142 unsigned long no_ms_for_Data_Tx_thruput_comp PACKED;/* millisecond time used for the Tx throughput computation */
143 unsigned long Tx_Data_discard_lgth_err_count PACKED;/* number of Data blocks discarded (length error) */
144 unsigned long reserved_Data_frm_Tx_stat1 PACKED;/* reserved for later use */
145 unsigned long reserved_Data_frm_Tx_stat2 PACKED;/* reserved for later use */
146 unsigned long reserved_Data_frm_Tx_stat3 PACKED;/* reserved for later use */
147
148 /* Data reception statistics */
149 unsigned long Data_blocks_Rx_count PACKED;/* number of blocks received */
150 unsigned long Data_bytes_Rx_count PACKED;/* number of bytes received */
151 unsigned long Data_Rx_throughput PACKED;/* receive throughput */
152 unsigned long no_ms_for_Data_Rx_thruput_comp PACKED;/* millisecond time used for the Rx throughput computation */
153 unsigned long Rx_Data_bytes_discard_count PACKED;/* received Data bytes discarded */
154 unsigned long reserved_Data_frm_Rx_stat1 PACKED;/* reserved for later use */
155
156 /* handshaking protocol statistics */
157 unsigned short XON_chars_Tx_count PACKED; /* number of XON characters transmitted */
158 unsigned short XOFF_chars_Tx_count PACKED; /* number of XOFF characters transmitted */
159 unsigned short XON_chars_Rx_count PACKED; /* number of XON characters received */
160 unsigned short XOFF_chars_Rx_count PACKED; /* number of XOFF characters received */
161 unsigned short Tx_halt_modem_low_count PACKED; /* number of times Tx halted (modem line low) */
162 unsigned short Rx_halt_RTS_low_count PACKED; /* number of times Rx halted by setting RTS low */
163 unsigned long reserved_handshaking_stat1 PACKED;/* reserved for later use */
164
165 /* break statistics */
166 unsigned short break_Tx_count PACKED; /* number of break sequences transmitted */
167 unsigned short break_Rx_count PACKED; /* number of break sequences received */
168 unsigned long reserved_break_stat1 PACKED;/* reserved for later use */
169
170 /* miscellaneous statistics */
171 unsigned long reserved_misc_stat1 PACKED; /* reserved for later use */
172 unsigned long reserved_misc_stat2 PACKED; /* reserved for later use */
173
174} ASY_OPERATIONAL_STATS_STRUCT;
175
176
177
178/* ----------------------------------------------------------------------------
179 * Constants for Data transmission
180 * --------------------------------------------------------------------------*/
181
182/* the Data block transmit status element configuration structure */
183typedef struct {
184 unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
185 unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
186 unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
187} ASY_TX_STATUS_EL_CFG_STRUCT;
188
189
190/* the Data block transmit status element structure */
191typedef struct {
192 unsigned char opp_flag PACKED; /* opp flag */
193 unsigned short data_length PACKED; /* length of the block to be transmitted */
194 unsigned char reserved_1 PACKED; /* reserved for internal use */
195 unsigned long reserved_2 PACKED; /* reserved for internal use */
196 unsigned long reserved_3 PACKED; /* reserved for internal use */
197 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
198} ASY_DATA_TX_STATUS_EL_STRUCT;
199
200
201
202/* ----------------------------------------------------------------------------
203 * Constants for Data reception
204 * --------------------------------------------------------------------------*/
205
206/* the Data block receive status element configuration structure */
207typedef struct {
208 unsigned short number_Rx_status_elements PACKED;/* number of receive status elements */
209 unsigned long base_addr_Rx_status_elements PACKED;/* base address of the receive element list */
210 unsigned long next_Rx_status_element_to_use PACKED;/* pointer to the next receive element to be used */
211 unsigned long base_addr_Rx_buffer PACKED;/* base address of the receive data buffer */
212 unsigned long end_addr_Rx_buffer PACKED;/* end address of the receive data buffer */
213} ASY_RX_STATUS_EL_CFG_STRUCT;
214
215/* the Data block receive status element structure */
216typedef struct {
217 unsigned char opp_flag PACKED; /* opp flag */
218 unsigned short data_length PACKED; /* length of the received data block */
219 unsigned char reserved_1 PACKED; /* reserved for internal use */
220 unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
221 unsigned short data_buffered PACKED; /* the number of data bytes still buffered */
222 unsigned long reserved_2 PACKED; /* reserved for internal use */
223 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
224} ASY_DATA_RX_STATUS_EL_STRUCT;
225
226#endif
diff --git a/include/linux/sdla_chdlc.h b/include/linux/sdla_chdlc.h
deleted file mode 100644
index d2e35a299034..000000000000
--- a/include/linux/sdla_chdlc.h
+++ /dev/null
@@ -1,813 +0,0 @@
1/*************************************************************************
2 sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions
3
4 Author: Gideon Hack
5 Nenad Corbic <ncorbic@sangoma.com>
6
7 Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the term of the GNU General Public License
11 as published by the Free Software Foundation; either version
12 2 of the License, or (at your option) any later version.
13
14===========================================================================
15 Oct 04, 1999 Nenad Corbic Updated API support
16 Jun 02, 1999 Gideon Hack Changes for S514 usage.
17 Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC.
18 Jun 11, 1998 David Fong Initial version.
19===========================================================================
20
21 Organization
22 - Compatibility notes
23 - Constants defining the shared memory control block (mailbox)
24 - Interface commands
25 - Return code from interface commands
26 - Constants for the commands (structures for casting data)
27 - UDP Management constants and structures
28
29*************************************************************************/
30
31#ifndef _SDLA_CHDLC_H
32# define _SDLC_CHDLC_H
33
34/*------------------------------------------------------------------------
35 Notes:
36
37 All structres defined in this file are byte-aligned.
38
39 Compiler Platform
40 ------------------------
41 GNU C Linux
42
43------------------------------------------------------------------------*/
44
45#ifndef PACKED
46#define PACKED __attribute__((packed))
47#endif /* PACKED */
48
49
50/* ----------------------------------------------------------------------------
51 * Constants defining the shared memory control block (mailbox)
52 * --------------------------------------------------------------------------*/
53
54#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */
55#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */
56#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */
57#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
58
59
60#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */
61#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */
62
63typedef struct {
64 unsigned char opp_flag PACKED; /* the opp flag */
65 unsigned char command PACKED; /* the user command */
66 unsigned short buffer_length PACKED; /* the data length */
67 unsigned char return_code PACKED; /* the return code */
68 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
69 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */
70} CHDLC_MAILBOX_STRUCT;
71
72typedef struct {
73 pid_t pid_num PACKED;
74 CHDLC_MAILBOX_STRUCT cmdarea PACKED;
75
76} CMDBLOCK_STRUCT;
77
78
79
80
81/* ----------------------------------------------------------------------------
82 * Interface commands
83 * --------------------------------------------------------------------------*/
84
85/* global interface commands */
86#define READ_GLOBAL_EXCEPTION_CONDITION 0x01
87#define SET_GLOBAL_CONFIGURATION 0x02
88#define READ_GLOBAL_CONFIGURATION 0x03
89#define READ_GLOBAL_STATISTICS 0x04
90#define FLUSH_GLOBAL_STATISTICS 0x05
91#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */
92#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */
93#define READ_COMMS_ERROR_STATS 0x08
94#define FLUSH_COMMS_ERROR_STATS 0x09
95#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */
96#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */
97#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
98#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
99#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */
100#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */
101#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */
102#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */
103#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */
104#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */
105
106#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */
107#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module */
108
109/* CHDLC-level interface commands */
110#define READ_CHDLC_CODE_VERSION 0x20
111#define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */
112#define SET_CHDLC_CONFIGURATION 0x22
113#define READ_CHDLC_CONFIGURATION 0x23
114#define ENABLE_CHDLC_COMMUNICATIONS 0x24
115#define DISABLE_CHDLC_COMMUNICATIONS 0x25
116#define READ_CHDLC_LINK_STATUS 0x26
117#define READ_CHDLC_OPERATIONAL_STATS 0x27
118#define FLUSH_CHDLC_OPERATIONAL_STATS 0x28
119#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30 /* set application interrupt triggers */
120#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31 /* read application interrupt trigger configuration */
121
122/* Special UDP drivers management commands */
123#define CPIPE_ENABLE_TRACING 0x50
124#define CPIPE_DISABLE_TRACING 0x51
125#define CPIPE_GET_TRACE_INFO 0x52
126#define CPIPE_GET_IBA_DATA 0x53
127#define CPIPE_FT1_READ_STATUS 0x54
128#define CPIPE_DRIVER_STAT_IFSEND 0x55
129#define CPIPE_DRIVER_STAT_INTR 0x56
130#define CPIPE_DRIVER_STAT_GEN 0x57
131#define CPIPE_FLUSH_DRIVER_STATS 0x58
132#define CPIPE_ROUTER_UP_TIME 0x59
133
134/* Driver specific commands for API */
135#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
136#define TRACE_ALL 0x00
137#define TRACE_PROT 0x01
138#define TRACE_DATA 0x02
139
140#define DISCARD_RX_ERROR_FRAMES 0x0001
141
142/* ----------------------------------------------------------------------------
143 * Return codes from interface commands
144 * --------------------------------------------------------------------------*/
145
146#define COMMAND_OK 0x00
147
148/* return codes from global interface commands */
149#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */
150#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
151#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
152#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
153#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
154#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
155#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */
156#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */
157#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */
158#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */
159#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */
160#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode */
161
162/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
163#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
164#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */
165#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout */
166
167/* return codes from CHDLC-level interface commands */
168#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */
169#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */
170#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */
171#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */
172#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */
173#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */
174#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */
175#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
176#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */
177#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */
178#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
179#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */
180#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */
181#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */
182#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */
183#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid */
184
185/* return codes from command READ_CHDLC_EXCEPTION_CONDITION */
186#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */
187#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */
188#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */
189#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */
190#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred */
191
192
193/* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */
194#define LINK_DISCONNECTED 0x21
195#define NO_TX_BFRS_AVAIL 0x24
196
197
198/* ----------------------------------------------------------------------------
199 * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
200 * --------------------------------------------------------------------------*/
201
202/* the global configuration structure */
203typedef struct {
204 unsigned short adapter_config_options PACKED; /* adapter config options */
205 unsigned short app_IRQ_timeout PACKED; /* application IRQ timeout */
206 unsigned long adapter_operating_frequency PACKED; /* adapter operating frequency */
207} GLOBAL_CONFIGURATION_STRUCT;
208
209/* settings for the 'app_IRQ_timeout' */
210#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
211
212
213
214/* ----------------------------------------------------------------------------
215 * Constants for the READ_GLOBAL_STATISTICS command
216 * --------------------------------------------------------------------------*/
217
218/* the global statistics structure */
219typedef struct {
220 unsigned short app_IRQ_timeout_count PACKED;
221} GLOBAL_STATS_STRUCT;
222
223
224
225/* ----------------------------------------------------------------------------
226 * Constants for the READ_COMMS_ERROR_STATS command
227 * --------------------------------------------------------------------------*/
228
229/* the communications error statistics structure */
230typedef struct {
231 unsigned short Rx_overrun_err_count PACKED;
232 unsigned short CRC_err_count PACKED; /* receiver CRC error count */
233 unsigned short Rx_abort_count PACKED; /* abort frames recvd count */
234 unsigned short Rx_dis_pri_bfrs_full_count PACKED;/* receiver disabled */
235 unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later */
236 unsigned short sec_Tx_abort_msd_Tx_int_count PACKED; /* secondary - abort frames transmitted count (missed Tx interrupt) */
237 unsigned short missed_Tx_und_int_count PACKED; /* missed tx underrun interrupt count */
238 unsigned short sec_Tx_abort_count PACKED; /*secondary-abort frames tx count */
239 unsigned short DCD_state_change_count PACKED; /* DCD state change */
240 unsigned short CTS_state_change_count PACKED; /* CTS state change */
241} COMMS_ERROR_STATS_STRUCT;
242
243
244
245/* ----------------------------------------------------------------------------
246 * Constants used for line tracing
247 * --------------------------------------------------------------------------*/
248
249/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */
250typedef struct {
251 unsigned char trace_config PACKED; /* trace configuration */
252 unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */
253 unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */
254} LINE_TRACE_CONFIG_STRUCT;
255
256/* 'trace_config' bit settings */
257#define TRACE_INACTIVE 0x00 /* trace is inactive */
258#define TRACE_ACTIVE 0x01 /* trace is active */
259#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */
260#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */
261#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */
262#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames */
263
264/* the line trace status element configuration structure */
265typedef struct {
266 unsigned short number_trace_status_elements PACKED; /* number of line trace elements */
267 unsigned long base_addr_trace_status_elements PACKED; /* base address of the trace element list */
268 unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */
269 unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */
270 unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */
271} TRACE_STATUS_EL_CFG_STRUCT;
272
273/* the line trace status element structure */
274typedef struct {
275 unsigned char opp_flag PACKED; /* opp flag */
276 unsigned short trace_length PACKED; /* trace length */
277 unsigned char trace_type PACKED; /* trace type */
278 unsigned short trace_time_stamp PACKED; /* time stamp */
279 unsigned short trace_reserved_1 PACKED; /* reserved for later use */
280 unsigned long trace_reserved_2 PACKED; /* reserved for later use */
281 unsigned long ptr_data_bfr PACKED; /* ptr to the trace data buffer */
282} TRACE_STATUS_ELEMENT_STRUCT;
283
284/* "trace_type" bit settings */
285#define TRACE_INCOMING 0x00
286#define TRACE_OUTGOINGING 0x01
287#define TRACE_INCOMING_ABORTED 0x10
288#define TRACE_INCOMING_CRC_ERROR 0x20
289#define TRACE_INCOMING_OVERRUN_ERROR 0x40
290
291
292
293/* the line trace statistics structure */
294typedef struct {
295 unsigned long frames_traced_count PACKED; /* number of frames traced */
296 unsigned long trc_frms_not_recorded_count PACKED; /* number of trace frames discarded */
297} LINE_TRACE_STATS_STRUCT;
298
299
300/* ----------------------------------------------------------------------------
301 * Constants for the FT1_MONITOR_STATUS_CTRL command
302 * --------------------------------------------------------------------------*/
303
304#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */
305#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */
306#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */
307#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */
308
309
310
311
312/* ----------------------------------------------------------------------------
313 * Constants for the SET_CHDLC_CONFIGURATION command
314 * --------------------------------------------------------------------------*/
315
316/* the CHDLC configuration structure */
317typedef struct {
318 unsigned long baud_rate PACKED; /* the baud rate */
319 unsigned short line_config_options PACKED; /* line configuration options */
320 unsigned short modem_config_options PACKED; /* modem configration options */
321 unsigned short modem_status_timer PACKED; /* timer for monitoring modem status changes */
322 unsigned short CHDLC_API_options PACKED; /* CHDLC API options */
323 unsigned short CHDLC_protocol_options PACKED; /* CHDLC protocol options */
324 unsigned short percent_data_buffer_for_Tx PACKED; /* percentage data buffering used for Tx */
325 unsigned short CHDLC_statistics_options PACKED; /* CHDLC operational statistics options */
326 unsigned short max_CHDLC_data_field_length PACKED; /* the maximum length of the CHDLC Data field */
327 unsigned short transmit_keepalive_timer PACKED; /* the transmit keepalive timer */
328 unsigned short receive_keepalive_timer PACKED; /* the receive keepalive timer */
329 unsigned short keepalive_error_tolerance PACKED; /* the receive keepalive error tolerance */
330 unsigned short SLARP_request_timer PACKED; /* the SLARP request timer */
331 unsigned long IP_address PACKED; /* the IP address */
332 unsigned long IP_netmask PACKED; /* the IP netmask */
333 unsigned long ptr_shared_mem_info_struct PACKED; /* a pointer to the shared memory area information structure */
334 unsigned long ptr_CHDLC_Tx_stat_el_cfg_struct PACKED; /* a pointer to the transmit status element configuration structure */
335 unsigned long ptr_CHDLC_Rx_stat_el_cfg_struct PACKED; /* a pointer to the receive status element configuration structure */
336} CHDLC_CONFIGURATION_STRUCT;
337
338/* settings for the 'line_config_options' */
339#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */
340#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */
341
342/* settings for the 'modem_config_options' */
343
344#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001
345/* don't automatically raise DTR and RTS when performing an
346 ENABLE_CHDLC_COMMUNICATIONS command */
347
348#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002
349/* don't report changes in modem status to the application */
350
351
352/* bit settings for the 'CHDLC_protocol_options' byte */
353
354#define IGNORE_DCD_FOR_LINK_STAT 0x0001
355/* ignore DCD in determining the CHDLC link status */
356
357#define IGNORE_CTS_FOR_LINK_STAT 0x0002
358/* ignore CTS in determining the CHDLC link status */
359
360#define IGNORE_KPALV_FOR_LINK_STAT 0x0004
361/* ignore keepalive frames in determining the CHDLC link status */
362
363#define SINGLE_TX_BUFFER 0x4000
364/* configure a single transmit buffer */
365
366#define HDLC_STREAMING_MODE 0x8000
367
368/* settings for the 'CHDLC_statistics_options' */
369
370#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001
371/* record the number of Data bytes transmitted */
372
373#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002
374/* record the number of Data bytes received */
375
376#define CHDLC_TX_THROUGHPUT_STAT 0x0004
377/* compute the Data frame transmit throughput */
378
379#define CHDLC_RX_THROUGHPUT_STAT 0x0008
380/* compute the Data frame receive throughput */
381
382
383/* permitted minimum and maximum values for setting the CHDLC configuration */
384#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */
385#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */
386#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */
387#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */
388
389#define MIN_MODEM_TIMER 0 /* minimum modem status timer */
390#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */
391
392#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */
393
394#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */
395#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */
396#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */
397
398#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */
399#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */
400#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */
401
402#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */
403#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */
404#define DEFAULT_KPALV_ERR_TOL 3 /* default value */
405
406#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */
407#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */
408#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */
409
410
411
412/* ----------------------------------------------------------------------------
413 * Constants for the READ_CHDLC_LINK_STATUS command
414 * --------------------------------------------------------------------------*/
415
416/* the CHDLC status structure */
417typedef struct {
418 unsigned char CHDLC_link_status PACKED; /* CHDLC link status */
419 unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */
420 unsigned char receiver_status PACKED; /* enabled/disabled */
421 unsigned char SLARP_state PACKED; /* internal SLARP state */
422} CHDLC_LINK_STATUS_STRUCT;
423
424/* settings for the 'CHDLC_link_status' variable */
425#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */
426#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */
427
428
429
430/* ----------------------------------------------------------------------------
431 * Constants for the READ_CHDLC_OPERATIONAL_STATS command
432 * --------------------------------------------------------------------------*/
433
434/* the CHDLC operational statistics structure */
435typedef struct {
436
437 /* Data frame transmission statistics */
438 unsigned long Data_frames_Tx_count PACKED; /* # of frames transmitted */
439 unsigned long Data_bytes_Tx_count PACKED; /* # of bytes transmitted */
440 unsigned long Data_Tx_throughput PACKED; /* transmit throughput */
441 unsigned long no_ms_for_Data_Tx_thruput_comp PACKED; /* millisecond time used for the Tx throughput computation */
442 unsigned long Tx_Data_discard_lgth_err_count PACKED; /* number of Data frames discarded (length error) */
443 unsigned long reserved_Data_frm_Tx_stat1 PACKED; /* reserved for later */
444 unsigned long reserved_Data_frm_Tx_stat2 PACKED; /* reserved for later */
445 unsigned long reserved_Data_frm_Tx_stat3 PACKED; /* reserved for later */
446
447 /* Data frame reception statistics */
448 unsigned long Data_frames_Rx_count PACKED; /* number of frames received */
449 unsigned long Data_bytes_Rx_count PACKED; /* number of bytes received */
450 unsigned long Data_Rx_throughput PACKED; /* receive throughput */
451 unsigned long no_ms_for_Data_Rx_thruput_comp PACKED; /* millisecond time used for the Rx throughput computation */
452 unsigned long Rx_Data_discard_short_count PACKED; /* received Data frames discarded (too short) */
453 unsigned long Rx_Data_discard_long_count PACKED; /* received Data frames discarded (too long) */
454 unsigned long Rx_Data_discard_inactive_count PACKED; /* received Data frames discarded (link inactive) */
455 unsigned long reserved_Data_frm_Rx_stat1 PACKED; /* reserved for later */
456
457 /* SLARP frame transmission/reception statistics */
458 unsigned long CHDLC_SLARP_REQ_Tx_count PACKED; /* number of SLARP Request frames transmitted */
459 unsigned long CHDLC_SLARP_REQ_Rx_count PACKED; /* number of SLARP Request frames received */
460 unsigned long CHDLC_SLARP_REPLY_Tx_count PACKED; /* number of SLARP Reply frames transmitted */
461 unsigned long CHDLC_SLARP_REPLY_Rx_count PACKED; /* number of SLARP Reply frames received */
462 unsigned long CHDLC_SLARP_KPALV_Tx_count PACKED; /* number of SLARP keepalive frames transmitted */
463 unsigned long CHDLC_SLARP_KPALV_Rx_count PACKED; /* number of SLARP keepalive frames received */
464 unsigned long reserved_SLARP_stat1 PACKED; /* reserved for later */
465 unsigned long reserved_SLARP_stat2 PACKED; /* reserved for later */
466
467 /* CDP frame transmission/reception statistics */
468 unsigned long CHDLC_CDP_Tx_count PACKED; /* number of CDP frames transmitted */
469 unsigned long CHDLC_CDP_Rx_count PACKED; /* number of CDP frames received */
470 unsigned long reserved_CDP_stat1 PACKED; /* reserved for later */
471 unsigned long reserved_CDP_stat2 PACKED; /* reserved for later */
472 unsigned long reserved_CDP_stat3 PACKED; /* reserved for later */
473 unsigned long reserved_CDP_stat4 PACKED; /* reserved for later */
474 unsigned long reserved_CDP_stat5 PACKED; /* reserved for later */
475 unsigned long reserved_CDP_stat6 PACKED; /* reserved for later */
476
477 /* Incoming frames with a format error statistics */
478 unsigned short Rx_frm_incomp_CHDLC_hdr_count PACKED; /* frames received of with incomplete Cisco HDLC header */
479 unsigned short Rx_frms_too_long_count PACKED; /* frames received of excessive length count */
480 unsigned short Rx_invalid_CHDLC_addr_count PACKED; /* frames received with an invalid CHDLC address count */
481 unsigned short Rx_invalid_CHDLC_ctrl_count PACKED; /* frames received with an invalid CHDLC control field count */
482 unsigned short Rx_invalid_CHDLC_type_count PACKED; /* frames received of an invalid CHDLC frame type count */
483 unsigned short Rx_SLARP_invalid_code_count PACKED; /* SLARP frame received with an invalid packet code */
484 unsigned short Rx_SLARP_Reply_bad_IP_addr PACKED; /* SLARP Reply received - bad IP address */
485 unsigned short Rx_SLARP_Reply_bad_netmask PACKED; /* SLARP Reply received - bad netmask */
486 unsigned long reserved_frm_format_err1 PACKED; /* reserved for later */
487 unsigned long reserved_frm_format_err2 PACKED; /* reserved for later */
488 unsigned long reserved_frm_format_err3 PACKED; /* reserved for later */
489 unsigned long reserved_frm_format_err4 PACKED; /* reserved for later */
490
491 /* CHDLC timeout/retry statistics */
492 unsigned short SLARP_Rx_keepalive_TO_count PACKED; /* timeout count for incoming SLARP frames */
493 unsigned short SLARP_Request_TO_count PACKED; /* timeout count for SLARP Request frames */
494 unsigned long To_retry_reserved_stat1 PACKED; /* reserved for later */
495 unsigned long To_retry_reserved_stat2 PACKED; /* reserved for later */
496 unsigned long To_retry_reserved_stat3 PACKED; /* reserved for later */
497
498 /* CHDLC link active/inactive and loopback statistics */
499 unsigned short link_active_count PACKED; /* number of times that the link went active */
500 unsigned short link_inactive_modem_count PACKED; /* number of times that the link went inactive (modem failure) */
501 unsigned short link_inactive_keepalive_count PACKED; /* number of times that the link went inactive (keepalive failure) */
502 unsigned short link_looped_count PACKED; /* link looped count */
503 unsigned long link_status_reserved_stat1 PACKED; /* reserved for later use */
504 unsigned long link_status_reserved_stat2 PACKED; /* reserved for later use */
505
506 /* miscellaneous statistics */
507 unsigned long reserved_misc_stat1 PACKED; /* reserved for later */
508 unsigned long reserved_misc_stat2 PACKED; /* reserved for later */
509 unsigned long reserved_misc_stat3 PACKED; /* reserved for later */
510 unsigned long reserved_misc_stat4 PACKED; /* reserved for later */
511
512} CHDLC_OPERATIONAL_STATS_STRUCT;
513
514
515
516/* ----------------------------------------------------------------------------
517 * Constants for using application interrupts
518 * --------------------------------------------------------------------------*/
519
520/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */
521typedef struct {
522 unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */
523 unsigned char IRQ PACKED; /* IRQ to be used */
524 unsigned short interrupt_timer PACKED; /* interrupt timer */
525 unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */
526} CHDLC_INT_TRIGGERS_STRUCT;
527
528/* 'CHDLC_interrupt_triggers' bit settings */
529#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */
530#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */
531#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
532#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
533#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
534#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */
535#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
536
537/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
538#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
539#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
540#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
541#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
542#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
543#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
544#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */
545#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */
546
547
548/* modem status changes */
549#define DCD_HIGH 0x08
550#define CTS_HIGH 0x20
551
552
553/* ----------------------------------------------------------------------------
554 * Constants for Data frame transmission
555 * --------------------------------------------------------------------------*/
556
557/* the Data frame transmit status element configuration structure */
558typedef struct {
559 unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
560 unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
561 unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
562} CHDLC_TX_STATUS_EL_CFG_STRUCT;
563
564/* the Data frame transmit status element structure */
565typedef struct {
566 unsigned char opp_flag PACKED; /* opp flag */
567 unsigned short frame_length PACKED; /* length of the frame to be transmitted */
568 unsigned char reserved_1 PACKED; /* reserved for internal use */
569 unsigned long reserved_2 PACKED; /* reserved for internal use */
570 unsigned long reserved_3 PACKED; /* reserved for internal use */
571 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
572} CHDLC_DATA_TX_STATUS_EL_STRUCT;
573
574
575
576/* ----------------------------------------------------------------------------
577 * Constants for Data frame reception
578 * --------------------------------------------------------------------------*/
579
580/* the Data frame receive status element configuration structure */
581typedef struct {
582 unsigned short number_Rx_status_elements PACKED; /* number of receive status elements */
583 unsigned long base_addr_Rx_status_elements PACKED; /* base address of the receive element list */
584 unsigned long next_Rx_status_element_to_use PACKED; /* pointer to the next receive element to be used */
585 unsigned long base_addr_Rx_buffer PACKED; /* base address of the receive data buffer */
586 unsigned long end_addr_Rx_buffer PACKED; /* end address of the receive data buffer */
587} CHDLC_RX_STATUS_EL_CFG_STRUCT;
588
589/* the Data frame receive status element structure */
590typedef struct {
591 unsigned char opp_flag PACKED; /* opp flag */
592 unsigned short frame_length PACKED; /* length of the received frame */
593 unsigned char error_flag PACKED; /* frame errors (HDLC_STREAMING_MODE)*/
594 unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
595 unsigned long reserved_1 PACKED; /* reserved for internal use */
596 unsigned short reserved_2 PACKED; /* reserved for internal use */
597 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
598} CHDLC_DATA_RX_STATUS_EL_STRUCT;
599
600
601
602/* ----------------------------------------------------------------------------
603 * Constants defining the shared memory information area
604 * --------------------------------------------------------------------------*/
605
606/* the global information structure */
607typedef struct {
608 unsigned char global_status PACKED; /* global status */
609 unsigned char modem_status PACKED; /* current modem status */
610 unsigned char global_excep_conditions PACKED; /* global exception conditions */
611 unsigned char glob_info_reserved[5] PACKED; /* reserved */
612 unsigned char codename[4] PACKED; /* Firmware name */
613 unsigned char codeversion[4] PACKED; /* Firmware version */
614} GLOBAL_INFORMATION_STRUCT;
615
616/* the CHDLC information structure */
617typedef struct {
618 unsigned char CHDLC_status PACKED; /* CHDLC status */
619 unsigned char CHDLC_excep_conditions PACKED; /* CHDLC exception conditions */
620 unsigned char CHDLC_info_reserved[14] PACKED; /* reserved */
621} CHDLC_INFORMATION_STRUCT;
622
623/* the interrupt information structure */
624typedef struct {
625 unsigned char interrupt_type PACKED; /* type of interrupt triggered */
626 unsigned char interrupt_permission PACKED; /* interrupt permission mask */
627 unsigned char int_info_reserved[14] PACKED; /* reserved */
628} INTERRUPT_INFORMATION_STRUCT;
629
630/* the S508/FT1 information structure */
631typedef struct {
632 unsigned char parallel_port_A_input PACKED; /* input - parallel port A */
633 unsigned char parallel_port_B_input PACKED; /* input - parallel port B */
634 unsigned char FT1_info_reserved[14] PACKED; /* reserved */
635} FT1_INFORMATION_STRUCT;
636
637/* the shared memory area information structure */
638typedef struct {
639 GLOBAL_INFORMATION_STRUCT global_info_struct PACKED; /* the global information structure */
640 CHDLC_INFORMATION_STRUCT CHDLC_info_struct PACKED; /* the CHDLC information structure */
641 INTERRUPT_INFORMATION_STRUCT interrupt_info_struct PACKED; /* the interrupt information structure */
642 FT1_INFORMATION_STRUCT FT1_info_struct PACKED; /* the S508/FT1 information structure */
643} SHARED_MEMORY_INFO_STRUCT;
644
645/* ----------------------------------------------------------------------------
646 * UDP Management constants and structures
647 * --------------------------------------------------------------------------*/
648
649/* The embedded control block for UDP mgmt
650 This is essentially a mailbox structure, without the large data field */
651
652typedef struct {
653 unsigned char opp_flag PACKED; /* the opp flag */
654 unsigned char command PACKED; /* the user command */
655 unsigned short buffer_length PACKED; /* the data length */
656 unsigned char return_code PACKED; /* the return code */
657 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
658} cblock_t;
659
660
661/* UDP management packet layout (data area of ip packet) */
662/*
663typedef struct {
664 unsigned char signature[8] PACKED;
665 unsigned char request_reply PACKED;
666 unsigned char id PACKED;
667 unsigned char reserved[6] PACKED;
668 cblock_t cblock PACKED;
669 unsigned char num_frames PACKED;
670 unsigned char ismoredata PACKED;
671 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
672} udp_management_packet_t;
673
674*/
675
676typedef struct {
677 unsigned char num_frames PACKED;
678 unsigned char ismoredata PACKED;
679} trace_info_t;
680
681typedef struct {
682 ip_pkt_t ip_pkt PACKED;
683 udp_pkt_t udp_pkt PACKED;
684 wp_mgmt_t wp_mgmt PACKED;
685 cblock_t cblock PACKED;
686 trace_info_t trace_info PACKED;
687 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
688} chdlc_udp_pkt_t;
689
690typedef struct ft1_exec_cmd{
691 unsigned char command PACKED; /* the user command */
692 unsigned short buffer_length PACKED; /* the data length */
693 unsigned char return_code PACKED; /* the return code */
694 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED;
695} ft1_exec_cmd_t;
696
697typedef struct {
698 unsigned char opp_flag PACKED;
699 ft1_exec_cmd_t cmd PACKED;
700 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
701} ft1_exec_t;
702
703#define UDPMGMT_SIGNATURE "CTPIPEAB"
704
705
706/* UDP/IP packet (for UDP management) layout */
707/*
708typedef struct {
709 unsigned char reserved[2] PACKED;
710 unsigned short ip_length PACKED;
711 unsigned char reserved2[4] PACKED;
712 unsigned char ip_ttl PACKED;
713 unsigned char ip_protocol PACKED;
714 unsigned short ip_checksum PACKED;
715 unsigned long ip_src_address PACKED;
716 unsigned long ip_dst_address PACKED;
717 unsigned short udp_src_port PACKED;
718 unsigned short udp_dst_port PACKED;
719 unsigned short udp_length PACKED;
720 unsigned short udp_checksum PACKED;
721 udp_management_packet_t um_packet PACKED;
722} ip_packet_t;
723*/
724
725/* valid ip_protocol for UDP management */
726#define UDPMGMT_UDP_PROTOCOL 0x11
727
728
729typedef struct {
730 unsigned char status PACKED;
731 unsigned char data_avail PACKED;
732 unsigned short real_length PACKED;
733 unsigned short time_stamp PACKED;
734 unsigned char data[1] PACKED;
735} trace_pkt_t;
736
737typedef struct {
738 unsigned char error_flag PACKED;
739 unsigned short time_stamp PACKED;
740 unsigned char reserved[13] PACKED;
741} api_rx_hdr_t;
742
743typedef struct {
744 api_rx_hdr_t api_rx_hdr PACKED;
745 void * data PACKED;
746} api_rx_element_t;
747
748typedef struct {
749 unsigned char attr PACKED;
750 unsigned char reserved[15] PACKED;
751} api_tx_hdr_t;
752
753typedef struct {
754 api_tx_hdr_t api_tx_hdr PACKED;
755 void * data PACKED;
756} api_tx_element_t;
757
758/* ----------------------------------------------------------------------------
759 * Constants for the SET_FT1_CONFIGURATION/READ_FT1_CONFIGURATION command
760 * --------------------------------------------------------------------------*/
761
762/* the FT1 configuration structure */
763typedef struct {
764 unsigned short framing_mode;
765 unsigned short encoding_mode;
766 unsigned short line_build_out;
767 unsigned short channel_base;
768 unsigned short baud_rate_kbps; /* the baud rate (in kbps) */
769 unsigned short clock_mode;
770} ft1_config_t;
771
772/* settings for the 'framing_mode' */
773#define ESF_FRAMING 0x00 /* ESF framing */
774#define D4_FRAMING 0x01 /* D4 framing */
775
776/* settings for the 'encoding_mode' */
777#define B8ZS_ENCODING 0x00 /* B8ZS encoding */
778#define AMI_ENCODING 0x01 /* AMI encoding */
779
780/* settings for the 'line_build_out' */
781#define LN_BLD_CSU_0dB_DSX1_0_to_133 0x00 /* set build out to CSU (0db) or DSX-1 (0-133ft) */
782#define LN_BLD_DSX1_133_to_266 0x01 /* set build out DSX-1 (133-266ft) */
783#define LN_BLD_DSX1_266_to_399 0x02 /* set build out DSX-1 (266-399ft) */
784#define LN_BLD_DSX1_399_to_533 0x03 /* set build out DSX-1 (399-533ft) */
785#define LN_BLD_DSX1_533_to_655 0x04 /* set build out DSX-1 (533-655ft) */
786#define LN_BLD_CSU_NEG_7dB 0x05 /* set build out to CSU (-7.5db) */
787#define LN_BLD_CSU_NEG_15dB 0x06 /* set build out to CSU (-15db) */
788#define LN_BLD_CSU_NEG_22dB 0x07 /* set build out to CSU (-22.5db) */
789
790/* settings for the 'channel_base' */
791#define MIN_CHANNEL_BASE_VALUE 1 /* the minimum permitted channel base value */
792#define MAX_CHANNEL_BASE_VALUE 24 /* the maximum permitted channel base value */
793
794/* settings for the 'baud_rate_kbps' */
795#define MIN_BAUD_RATE_KBPS 0 /* the minimum permitted baud rate (kbps) */
796#define MAX_BAUD_RATE_KBPS 1536 /* the maximum permitted baud rate (kbps) */
797#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF /* the baud rate used to trigger an automatic FT1 configuration */
798
799/* settings for the 'clock_mode' */
800#define CLOCK_MODE_NORMAL 0x00 /* clock mode set to normal (slave) */
801#define CLOCK_MODE_MASTER 0x01 /* clock mode set to master */
802
803
804#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF
805#define AUTO_FT1_CONFIG_NOT_COMPLETE 0x08
806#define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C
807#define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D
808
809
810#ifdef _MSC_
811# pragma pack()
812#endif
813#endif /* _SDLA_CHDLC_H */
diff --git a/include/linux/sdla_ppp.h b/include/linux/sdla_ppp.h
deleted file mode 100644
index 6f3923179c29..000000000000
--- a/include/linux/sdla_ppp.h
+++ /dev/null
@@ -1,575 +0,0 @@
1/*****************************************************************************
2* sdla_ppp.h Sangoma PPP firmware API definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 1995-1997 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Feb 24, 2000 Nenad Corbic v2.1.2
14* Jan 06, 1997 Gene Kozin v2.0
15* Apr 11, 1996 Gene Kozin Initial version.
16*****************************************************************************/
17#ifndef _SDLA_PPP_H
18#define _SDLA_PPP_H
19
20/*----------------------------------------------------------------------------
21 * Notes:
22 * ------
23 * 1. All structures defined in this file are byte-alined.
24 *
25 * Compiler Platform
26 * -------- --------
27 * GNU C Linux
28 */
29
30#ifndef PACKED
31# define PACKED __attribute__((packed))
32#endif /* PACKED */
33
34/* Adapter memory layout and important constants */
35#define PPP508_MB_VECT 0xE000 /* mailbox window vector */
36#define PPP508_MB_OFFS 0 /* mailbox offset */
37#define PPP508_FLG_OFFS 0x1000 /* status flags offset */
38#define PPP508_BUF_OFFS 0x1100 /* buffer info block offset */
39#define PPP514_MB_OFFS 0xE000 /* mailbox offset */
40#define PPP514_FLG_OFFS 0xF000 /* status flags offset */
41#define PPP514_BUF_OFFS 0xF100 /* buffer info block offset */
42
43#define PPP_MAX_DATA 1008 /* command block data buffer length */
44
45/****** Data Structures *****************************************************/
46
47/*----------------------------------------------------------------------------
48 * PPP Command Block.
49 */
50typedef struct ppp_cmd{
51 unsigned char command PACKED; /* command code */
52 unsigned short length PACKED; /* length of data buffer */
53 unsigned char result PACKED; /* return code */
54 unsigned char rsrv[11] PACKED; /* reserved for future use */
55} ppp_cmd_t;
56
57typedef struct cblock{
58 unsigned char opp_flag PACKED;
59 unsigned char command PACKED; /* command code */
60 unsigned short length PACKED; /* length of data buffer */
61 unsigned char result PACKED; /* return code */
62 unsigned char rsrv[11] PACKED; /* reserved for future use */
63} cblock_t;
64
65typedef struct ppp_udp_pkt{
66 ip_pkt_t ip_pkt PACKED;
67 udp_pkt_t udp_pkt PACKED;
68 wp_mgmt_t wp_mgmt PACKED;
69 cblock_t cblock PACKED;
70 unsigned char data[MAX_LGTH_UDP_MGNT_PKT] PACKED;
71} ppp_udp_pkt_t;
72
73typedef struct {
74 unsigned char status PACKED;
75 unsigned char data_avail PACKED;
76 unsigned short real_length PACKED;
77 unsigned short time_stamp PACKED;
78 unsigned char data[1] PACKED;
79} trace_pkt_t;
80
81
82typedef struct {
83 unsigned char opp_flag PACKED;
84 unsigned char trace_type PACKED;
85 unsigned short trace_length PACKED;
86 unsigned short trace_data_ptr PACKED;
87 unsigned short trace_time_stamp PACKED;
88} trace_element_t;
89
90/* 'command' field defines */
91#define PPP_READ_CODE_VERSION 0x10 /* configuration commands */
92#define PPP_SET_CONFIG 0x05
93#define PPP_READ_CONFIG 0x06
94#define PPP_SET_INTR_FLAGS 0x20
95#define PPP_READ_INTR_FLAGS 0x21
96#define PPP_SET_INBOUND_AUTH 0x30
97#define PPP_SET_OUTBOUND_AUTH 0x31
98#define PPP_GET_CONNECTION_INFO 0x32
99
100#define PPP_COMM_ENABLE 0x03 /* operational commands */
101#define PPP_COMM_DISABLE 0x04
102#define PPP_SEND_SIGN_FRAME 0x23
103#define PPP_READ_SIGN_RESPONSE 0x24
104#define PPP_DATALINE_MONITOR 0x33
105
106#define PPP_READ_STATISTICS 0x07 /* statistics commands */
107#define PPP_FLUSH_STATISTICS 0x08
108#define PPP_READ_ERROR_STATS 0x09
109#define PPP_FLUSH_ERROR_STATS 0x0A
110#define PPP_READ_PACKET_STATS 0x12
111#define PPP_FLUSH_PACKET_STATS 0x13
112#define PPP_READ_LCP_STATS 0x14
113#define PPP_FLUSH_LCP_STATS 0x15
114#define PPP_READ_LPBK_STATS 0x16
115#define PPP_FLUSH_LPBK_STATS 0x17
116#define PPP_READ_IPCP_STATS 0x18
117#define PPP_FLUSH_IPCP_STATS 0x19
118#define PPP_READ_IPXCP_STATS 0x1A
119#define PPP_FLUSH_IPXCP_STATS 0x1B
120#define PPP_READ_PAP_STATS 0x1C
121#define PPP_FLUSH_PAP_STATS 0x1D
122#define PPP_READ_CHAP_STATS 0x1E
123#define PPP_FLUSH_CHAP_STATS 0x1F
124
125/* 'result' field defines */
126#define PPPRES_OK 0x00 /* command executed successfully */
127#define PPPRES_INVALID_STATE 0x09 /* invalid command in this context */
128
129/*----------------------------------------------------------------------------
130 * PPP Mailbox.
131 * This structure is located at offset PPP???_MB_OFFS into PPP???_MB_VECT
132 */
133typedef struct ppp_mbox
134{
135 unsigned char flag PACKED; /* 00h: command execution flag */
136 ppp_cmd_t cmd PACKED; /* 01h: command block */
137 unsigned char data[1] PACKED; /* 10h: variable length data buffer */
138} ppp_mbox_t;
139
140/*----------------------------------------------------------------------------
141 * PPP Status Flags.
142 * This structure is located at offset PPP???_FLG_OFFS into
143 * PPP???_MB_VECT.
144 */
145typedef struct ppp_flags
146{
147 unsigned char iflag PACKED; /* 00: interrupt flag */
148 unsigned char imask PACKED; /* 01: interrupt mask */
149 unsigned char resrv PACKED;
150 unsigned char mstatus PACKED; /* 03: modem status */
151 unsigned char lcp_state PACKED; /* 04: LCP state */
152 unsigned char ppp_phase PACKED; /* 05: PPP phase */
153 unsigned char ip_state PACKED; /* 06: IPCP state */
154 unsigned char ipx_state PACKED; /* 07: IPXCP state */
155 unsigned char pap_state PACKED; /* 08: PAP state */
156 unsigned char chap_state PACKED; /* 09: CHAP state */
157 unsigned short disc_cause PACKED; /* 0A: disconnection cause */
158} ppp_flags_t;
159
160/* 'iflag' defines */
161#define PPP_INTR_RXRDY 0x01 /* Rx ready */
162#define PPP_INTR_TXRDY 0x02 /* Tx ready */
163#define PPP_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
164#define PPP_INTR_CMD 0x08 /* interface command completed */
165#define PPP_INTR_DISC 0x10 /* data link disconnected */
166#define PPP_INTR_OPEN 0x20 /* data link open */
167#define PPP_INTR_DROP_DTR 0x40 /* DTR drop timeout expired */
168#define PPP_INTR_TIMER 0x80 /* timer interrupt */
169
170
171/* 'mstatus' defines */
172#define PPP_MDM_DCD 0x08 /* mdm_status: DCD */
173#define PPP_MDM_CTS 0x20 /* mdm_status: CTS */
174
175/* 'disc_cause' defines */
176#define PPP_LOCAL_TERMINATION 0x0001 /* Local Request by PPP termination phase */
177#define PPP_DCD_CTS_DROP 0x0002 /* DCD and/or CTS dropped. Link down */
178#define PPP_REMOTE_TERMINATION 0x0800 /* Remote Request by PPP termination phase */
179
180/* 'misc_config_bits' defines */
181#define DONT_RE_TX_ABORTED_I_FRAMES 0x01
182#define TX_FRM_BYTE_COUNT_STATS 0x02
183#define RX_FRM_BYTE_COUNT_STATS 0x04
184#define TIME_STAMP_IN_RX_FRAMES 0x08
185#define NON_STD_ADPTR_FREQ 0x10
186#define INTERFACE_LEVEL_RS232 0x20
187#define AUTO_LINK_RECOVERY 0x100
188#define DONT_TERMINATE_LNK_MAX_CONFIG 0x200
189
190/* 'authentication options' defines */
191#define NO_AUTHENTICATION 0x00
192#define INBOUND_AUTH 0x80
193#define PAP_AUTH 0x01
194#define CHAP_AUTH 0x02
195
196/* 'ip options' defines */
197#define L_AND_R_IP_NO_ASSIG 0x00
198#define L_IP_LOCAL_ASSIG 0x01
199#define L_IP_REMOTE_ASSIG 0x02
200#define R_IP_LOCAL_ASSIG 0x04
201#define R_IP_REMOTE_ASSIG 0x08
202#define ENABLE_IP 0x80
203
204/* 'ipx options' defines */
205#define ROUTING_PROT_DEFAULT 0x20
206#define ENABLE_IPX 0x80
207#define DISABLE_IPX 0x00
208
209/*----------------------------------------------------------------------------
210 * PPP Buffer Info.
211 * This structure is located at offset PPP508_BUF_OFFS into
212 * PPP508_MB_VECT.
213 */
214typedef struct ppp508_buf_info
215{
216 unsigned short txb_num PACKED; /* 00: number of transmit buffers */
217 unsigned long txb_ptr PACKED; /* 02: pointer to the buffer ctl. */
218 unsigned long txb_nxt PACKED;
219 unsigned char rsrv1[22] PACKED;
220 unsigned short rxb_num PACKED; /* 20: number of receive buffers */
221 unsigned long rxb_ptr PACKED; /* 22: pointer to the buffer ctl. */
222 unsigned long rxb1_ptr PACKED; /* 26: pointer to the first buf.ctl. */
223 unsigned long rxb_base PACKED; /* 2A: pointer to the buffer base */
224 unsigned char rsrv2[2] PACKED;
225 unsigned long rxb_end PACKED; /* 30: pointer to the buffer end */
226} ppp508_buf_info_t;
227
228/*----------------------------------------------------------------------------
229 * Transmit/Receive Buffer Control Block.
230 */
231typedef struct ppp_buf_ctl
232{
233 unsigned char flag PACKED; /* 00: 'buffer ready' flag */
234 unsigned short length PACKED; /* 01: length of data */
235 unsigned char reserved1[1] PACKED; /* 03: */
236 unsigned char proto PACKED; /* 04: protocol */
237 unsigned short timestamp PACKED; /* 05: time stamp (Rx only) */
238 unsigned char reserved2[5] PACKED; /* 07: */
239 union
240 {
241 unsigned short o_p[2]; /* 1C: buffer offset & page (S502) */
242 unsigned long ptr; /* 1C: buffer pointer (S508) */
243 } buf PACKED;
244} ppp_buf_ctl_t;
245
246/*----------------------------------------------------------------------------
247 * S508 Adapter Configuration Block (passed to the PPP_SET_CONFIG command).
248 */
249typedef struct ppp508_conf
250{
251 unsigned long line_speed PACKED; /* 00: baud rate, bps */
252 unsigned short txbuf_percent PACKED; /* 04: % of Tx buffer */
253 unsigned short conf_flags PACKED; /* 06: configuration bits */
254 unsigned short mtu_local PACKED; /* 08: local MTU */
255 unsigned short mtu_remote PACKED; /* 0A: remote MTU */
256 unsigned short restart_tmr PACKED; /* 0C: restart timer */
257 unsigned short auth_rsrt_tmr PACKED; /* 0E: authentication timer */
258 unsigned short auth_wait_tmr PACKED; /* 10: authentication timer */
259 unsigned short mdm_fail_tmr PACKED; /* 12: modem failure timer */
260 unsigned short dtr_drop_tmr PACKED; /* 14: DTR drop timer */
261 unsigned short connect_tmout PACKED; /* 16: connection timeout */
262 unsigned short conf_retry PACKED; /* 18: max. retry */
263 unsigned short term_retry PACKED; /* 1A: max. retry */
264 unsigned short fail_retry PACKED; /* 1C: max. retry */
265 unsigned short auth_retry PACKED; /* 1E: max. retry */
266 unsigned char auth_options PACKED; /* 20: authentication opt. */
267 unsigned char ip_options PACKED; /* 21: IP options */
268 unsigned long ip_local PACKED; /* 22: local IP address */
269 unsigned long ip_remote PACKED; /* 26: remote IP address */
270 unsigned char ipx_options PACKED; /* 2A: IPX options */
271 unsigned char ipx_netno[4] PACKED; /* 2B: IPX net number */
272 unsigned char ipx_local[6] PACKED; /* 2F: local IPX node number*/
273 unsigned char ipx_remote[6] PACKED; /* 35: remote IPX node num.*/
274 unsigned char ipx_router[48] PACKED; /* 3B: IPX router name*/
275 unsigned long alt_cpu_clock PACKED; /* 6B: */
276} ppp508_conf_t;
277
278/*----------------------------------------------------------------------------
279 * S508 Adapter Read Connection Information Block
280 * Returned by the PPP_GET_CONNECTION_INFO command
281 */
282typedef struct ppp508_connect_info
283{
284 unsigned short mru PACKED; /* 00-01 Remote Max Rec' Unit */
285 unsigned char ip_options PACKED; /* 02: Negotiated ip options */
286 unsigned long ip_local PACKED; /* 03-06: local IP address */
287 unsigned long ip_remote PACKED; /* 07-0A: remote IP address */
288 unsigned char ipx_options PACKED; /* 0B: Negotiated ipx options */
289 unsigned char ipx_netno[4] PACKED; /* 0C-0F: IPX net number */
290 unsigned char ipx_local[6] PACKED; /* 10-1F: local IPX node # */
291 unsigned char ipx_remote[6] PACKED; /* 16-1B: remote IPX node # */
292 unsigned char ipx_router[48] PACKED; /* 1C-4B: IPX router name */
293 unsigned char auth_status PACKED; /* 4C: Authentication Status */
294 unsigned char inbd_auth_peerID[1] PACKED; /* 4D: variable length inbound authenticated peer ID */
295} ppp508_connect_info_t;
296
297/* 'line_speed' field */
298#define PPP_BITRATE_1200 0x01
299#define PPP_BITRATE_2400 0x02
300#define PPP_BITRATE_4800 0x03
301#define PPP_BITRATE_9600 0x04
302#define PPP_BITRATE_19200 0x05
303#define PPP_BITRATE_38400 0x06
304#define PPP_BITRATE_45000 0x07
305#define PPP_BITRATE_56000 0x08
306#define PPP_BITRATE_64000 0x09
307#define PPP_BITRATE_74000 0x0A
308#define PPP_BITRATE_112000 0x0B
309#define PPP_BITRATE_128000 0x0C
310#define PPP_BITRATE_156000 0x0D
311
312/* Defines for the 'conf_flags' field */
313#define PPP_IGNORE_TX_ABORT 0x01 /* don't re-transmit aborted frames */
314#define PPP_ENABLE_TX_STATS 0x02 /* enable Tx statistics */
315#define PPP_ENABLE_RX_STATS 0x04 /* enable Rx statistics */
316#define PPP_ENABLE_TIMESTAMP 0x08 /* enable timestamp */
317
318/* 'ip_options' defines */
319#define PPP_LOCAL_IP_LOCAL 0x01
320#define PPP_LOCAL_IP_REMOTE 0x02
321#define PPP_REMOTE_IP_LOCAL 0x04
322#define PPP_REMOTE_IP_REMOTE 0x08
323
324/* 'ipx_options' defines */
325#define PPP_REMOTE_IPX_NETNO 0x01
326#define PPP_REMOTE_IPX_LOCAL 0x02
327#define PPP_REMOTE_IPX_REMOTE 0x04
328#define PPP_IPX_ROUTE_RIP_SAP 0x08
329#define PPP_IPX_ROUTE_NLSP 0x10
330#define PPP_IPX_ROUTE_DEFAULT 0x20
331#define PPP_IPX_CONF_COMPLETE 0x40
332#define PPP_IPX_ENABLE 0x80
333
334/*----------------------------------------------------------------------------
335 * S508 Adapter Configuration Block (returned by the PPP_READ_CONFIG command).
336 */
337typedef struct ppp508_get_conf
338{
339 unsigned long bps PACKED; /* 00: baud rate, bps */
340 ppp508_conf_t conf PACKED; /* 04: requested config. */
341 unsigned short txb_num PACKED; /* 6F: number of Tx buffers */
342 unsigned short rxb_num PACKED; /* 71: number of Rx buffers */
343} ppp508_get_conf_t;
344
345/*----------------------------------------------------------------------------
346 * S508 Operational Statistics (returned by the PPP_READ_STATISTIC command).
347 */
348typedef struct ppp508_stats
349{
350 unsigned short reserved1 PACKED; /* 00: */
351 unsigned short rx_bad_len PACKED; /* 02: */
352 unsigned short reserved2 PACKED; /* 04: */
353 unsigned long tx_frames PACKED; /* 06: */
354 unsigned long tx_bytes PACKED; /* 0A: */
355 unsigned long rx_frames PACKED; /* 0E: */
356 unsigned long rx_bytes PACKED; /* 12: */
357} ppp508_stats_t;
358
359/*----------------------------------------------------------------------------
360 * Adapter Error Statistics (returned by the PPP_READ_ERROR_STATS command).
361 */
362typedef struct ppp_err_stats
363{
364 unsigned char rx_overrun PACKED; /* 00: Rx overrun errors */
365 unsigned char rx_bad_crc PACKED; /* 01: Rx CRC errors */
366 unsigned char rx_abort PACKED; /* 02: Rx aborted frames */
367 unsigned char rx_lost PACKED; /* 03: Rx frames lost */
368 unsigned char tx_abort PACKED; /* 04: Tx aborted frames */
369 unsigned char tx_underrun PACKED; /* 05: Tx underrun errors */
370 unsigned char tx_missed_intr PACKED; /* 06: Tx underruns missed */
371 unsigned char reserved PACKED; /* 07: Tx underruns missed */
372 unsigned char dcd_trans PACKED; /* 08: DCD transitions */
373 unsigned char cts_trans PACKED; /* 09: CTS transitions */
374} ppp_err_stats_t;
375
376/*----------------------------------------------------------------------------
377 * Packet Statistics (returned by the PPP_READ_PACKET_STATS command).
378 */
379typedef struct ppp_pkt_stats
380{
381 unsigned short rx_bad_header PACKED; /* 00: */
382 unsigned short rx_prot_unknwn PACKED; /* 02: */
383 unsigned short rx_too_large PACKED; /* 04: */
384 unsigned short rx_lcp PACKED; /* 06: */
385 unsigned short tx_lcp PACKED; /* 08: */
386 unsigned short rx_ipcp PACKED; /* 0A: */
387 unsigned short tx_ipcp PACKED; /* 0C: */
388 unsigned short rx_ipxcp PACKED; /* 0E: */
389 unsigned short tx_ipxcp PACKED; /* 10: */
390 unsigned short rx_pap PACKED; /* 12: */
391 unsigned short tx_pap PACKED; /* 14: */
392 unsigned short rx_chap PACKED; /* 16: */
393 unsigned short tx_chap PACKED; /* 18: */
394 unsigned short rx_lqr PACKED; /* 1A: */
395 unsigned short tx_lqr PACKED; /* 1C: */
396 unsigned short rx_ip PACKED; /* 1E: */
397 unsigned short tx_ip PACKED; /* 20: */
398 unsigned short rx_ipx PACKED; /* 22: */
399 unsigned short tx_ipx PACKED; /* 24: */
400} ppp_pkt_stats_t;
401
402/*----------------------------------------------------------------------------
403 * LCP Statistics (returned by the PPP_READ_LCP_STATS command).
404 */
405typedef struct ppp_lcp_stats
406{
407 unsigned short rx_unknown PACKED; /* 00: unknown LCP type */
408 unsigned short rx_conf_rqst PACKED; /* 02: Configure-Request */
409 unsigned short rx_conf_ack PACKED; /* 04: Configure-Ack */
410 unsigned short rx_conf_nak PACKED; /* 06: Configure-Nak */
411 unsigned short rx_conf_rej PACKED; /* 08: Configure-Reject */
412 unsigned short rx_term_rqst PACKED; /* 0A: Terminate-Request */
413 unsigned short rx_term_ack PACKED; /* 0C: Terminate-Ack */
414 unsigned short rx_code_rej PACKED; /* 0E: Code-Reject */
415 unsigned short rx_proto_rej PACKED; /* 10: Protocol-Reject */
416 unsigned short rx_echo_rqst PACKED; /* 12: Echo-Request */
417 unsigned short rx_echo_reply PACKED; /* 14: Echo-Reply */
418 unsigned short rx_disc_rqst PACKED; /* 16: Discard-Request */
419 unsigned short tx_conf_rqst PACKED; /* 18: Configure-Request */
420 unsigned short tx_conf_ack PACKED; /* 1A: Configure-Ack */
421 unsigned short tx_conf_nak PACKED; /* 1C: Configure-Nak */
422 unsigned short tx_conf_rej PACKED; /* 1E: Configure-Reject */
423 unsigned short tx_term_rqst PACKED; /* 20: Terminate-Request */
424 unsigned short tx_term_ack PACKED; /* 22: Terminate-Ack */
425 unsigned short tx_code_rej PACKED; /* 24: Code-Reject */
426 unsigned short tx_proto_rej PACKED; /* 26: Protocol-Reject */
427 unsigned short tx_echo_rqst PACKED; /* 28: Echo-Request */
428 unsigned short tx_echo_reply PACKED; /* 2A: Echo-Reply */
429 unsigned short tx_disc_rqst PACKED; /* 2E: Discard-Request */
430 unsigned short rx_too_large PACKED; /* 30: packets too large */
431 unsigned short rx_ack_inval PACKED; /* 32: invalid Conf-Ack */
432 unsigned short rx_rej_inval PACKED; /* 34: invalid Conf-Reject */
433 unsigned short rx_rej_badid PACKED; /* 36: Conf-Reject w/bad ID */
434} ppp_lcp_stats_t;
435
436/*----------------------------------------------------------------------------
437 * Loopback Error Statistics (returned by the PPP_READ_LPBK_STATS command).
438 */
439typedef struct ppp_lpbk_stats
440{
441 unsigned short conf_magic PACKED; /* 00: */
442 unsigned short loc_echo_rqst PACKED; /* 02: */
443 unsigned short rem_echo_rqst PACKED; /* 04: */
444 unsigned short loc_echo_reply PACKED; /* 06: */
445 unsigned short rem_echo_reply PACKED; /* 08: */
446 unsigned short loc_disc_rqst PACKED; /* 0A: */
447 unsigned short rem_disc_rqst PACKED; /* 0C: */
448 unsigned short echo_tx_collsn PACKED; /* 0E: */
449 unsigned short echo_rx_collsn PACKED; /* 10: */
450} ppp_lpbk_stats_t;
451
452/*----------------------------------------------------------------------------
453 * Protocol Statistics (returned by the PPP_READ_IPCP_STATS and
454 * PPP_READ_IPXCP_STATS commands).
455 */
456typedef struct ppp_prot_stats
457{
458 unsigned short rx_unknown PACKED; /* 00: unknown type */
459 unsigned short rx_conf_rqst PACKED; /* 02: Configure-Request */
460 unsigned short rx_conf_ack PACKED; /* 04: Configure-Ack */
461 unsigned short rx_conf_nak PACKED; /* 06: Configure-Nak */
462 unsigned short rx_conf_rej PACKED; /* 08: Configure-Reject */
463 unsigned short rx_term_rqst PACKED; /* 0A: Terminate-Request */
464 unsigned short rx_term_ack PACKED; /* 0C: Terminate-Ack */
465 unsigned short rx_code_rej PACKED; /* 0E: Code-Reject */
466 unsigned short reserved PACKED; /* 10: */
467 unsigned short tx_conf_rqst PACKED; /* 12: Configure-Request */
468 unsigned short tx_conf_ack PACKED; /* 14: Configure-Ack */
469 unsigned short tx_conf_nak PACKED; /* 16: Configure-Nak */
470 unsigned short tx_conf_rej PACKED; /* 18: Configure-Reject */
471 unsigned short tx_term_rqst PACKED; /* 1A: Terminate-Request */
472 unsigned short tx_term_ack PACKED; /* 1C: Terminate-Ack */
473 unsigned short tx_code_rej PACKED; /* 1E: Code-Reject */
474 unsigned short rx_too_large PACKED; /* 20: packets too large */
475 unsigned short rx_ack_inval PACKED; /* 22: invalid Conf-Ack */
476 unsigned short rx_rej_inval PACKED; /* 24: invalid Conf-Reject */
477 unsigned short rx_rej_badid PACKED; /* 26: Conf-Reject w/bad ID */
478} ppp_prot_stats_t;
479
480/*----------------------------------------------------------------------------
481 * PAP Statistics (returned by the PPP_READ_PAP_STATS command).
482 */
483typedef struct ppp_pap_stats
484{
485 unsigned short rx_unknown PACKED; /* 00: unknown type */
486 unsigned short rx_auth_rqst PACKED; /* 02: Authenticate-Request */
487 unsigned short rx_auth_ack PACKED; /* 04: Authenticate-Ack */
488 unsigned short rx_auth_nak PACKED; /* 06: Authenticate-Nak */
489 unsigned short reserved PACKED; /* 08: */
490 unsigned short tx_auth_rqst PACKED; /* 0A: Authenticate-Request */
491 unsigned short tx_auth_ack PACKED; /* 0C: Authenticate-Ack */
492 unsigned short tx_auth_nak PACKED; /* 0E: Authenticate-Nak */
493 unsigned short rx_too_large PACKED; /* 10: packets too large */
494 unsigned short rx_bad_peerid PACKED; /* 12: invalid peer ID */
495 unsigned short rx_bad_passwd PACKED; /* 14: invalid password */
496} ppp_pap_stats_t;
497
498/*----------------------------------------------------------------------------
499 * CHAP Statistics (returned by the PPP_READ_CHAP_STATS command).
500 */
501typedef struct ppp_chap_stats
502{
503 unsigned short rx_unknown PACKED; /* 00: unknown type */
504 unsigned short rx_challenge PACKED; /* 02: Authenticate-Request */
505 unsigned short rx_response PACKED; /* 04: Authenticate-Ack */
506 unsigned short rx_success PACKED; /* 06: Authenticate-Nak */
507 unsigned short rx_failure PACKED; /* 08: Authenticate-Nak */
508 unsigned short reserved PACKED; /* 0A: */
509 unsigned short tx_challenge PACKED; /* 0C: Authenticate-Request */
510 unsigned short tx_response PACKED; /* 0E: Authenticate-Ack */
511 unsigned short tx_success PACKED; /* 10: Authenticate-Nak */
512 unsigned short tx_failure PACKED; /* 12: Authenticate-Nak */
513 unsigned short rx_too_large PACKED; /* 14: packets too large */
514 unsigned short rx_bad_peerid PACKED; /* 16: invalid peer ID */
515 unsigned short rx_bad_passwd PACKED; /* 18: invalid password */
516 unsigned short rx_bad_md5 PACKED; /* 1A: invalid MD5 format */
517 unsigned short rx_bad_resp PACKED; /* 1C: invalid response */
518} ppp_chap_stats_t;
519
520/*----------------------------------------------------------------------------
521 * Connection Information (returned by the PPP_GET_CONNECTION_INFO command).
522 */
523typedef struct ppp_conn_info
524{
525 unsigned short remote_mru PACKED; /* 00: */
526 unsigned char ip_options PACKED; /* 02: */
527 unsigned char ip_local[4] PACKED; /* 03: */
528 unsigned char ip_remote[4] PACKED; /* 07: */
529 unsigned char ipx_options PACKED; /* 0B: */
530 unsigned char ipx_network[4] PACKED; /* 0C: */
531 unsigned char ipx_local[6] PACKED; /* 10: */
532 unsigned char ipx_remote[6] PACKED; /* 16: */
533 unsigned char ipx_router[48] PACKED; /* 1C: */
534 unsigned char auth_status PACKED; /* 4C: */
535 unsigned char peer_id[0] PACKED; /* 4D: */
536} ppp_conn_info_t;
537
538/* Data structure for SET_TRIGGER_INTR command
539 */
540
541typedef struct ppp_intr_info{
542 unsigned char i_enable PACKED; /* 0 Interrupt enable bits */
543 unsigned char irq PACKED; /* 1 Irq number */
544 unsigned short timer_len PACKED; /* 2 Timer delay */
545} ppp_intr_info_t;
546
547
548#define FT1_MONITOR_STATUS_CTRL 0x80
549#define SET_FT1_MODE 0x81
550
551
552
553/* Special UDP drivers management commands */
554#define PPIPE_ENABLE_TRACING 0x20
555#define PPIPE_DISABLE_TRACING 0x21
556#define PPIPE_GET_TRACE_INFO 0x22
557#define PPIPE_GET_IBA_DATA 0x23
558#define PPIPE_KILL_BOARD 0x24
559#define PPIPE_FT1_READ_STATUS 0x25
560#define PPIPE_DRIVER_STAT_IFSEND 0x26
561#define PPIPE_DRIVER_STAT_INTR 0x27
562#define PPIPE_DRIVER_STAT_GEN 0x28
563#define PPIPE_FLUSH_DRIVER_STATS 0x29
564#define PPIPE_ROUTER_UP_TIME 0x30
565
566#define DISABLE_TRACING 0x00
567#define TRACE_SIGNALLING_FRAMES 0x01
568#define TRACE_DATA_FRAMES 0x02
569
570
571
572#ifdef _MSC_
573# pragma pack()
574#endif
575#endif /* _SDLA_PPP_H */
diff --git a/include/linux/sdla_x25.h b/include/linux/sdla_x25.h
deleted file mode 100644
index 57db980e27ad..000000000000
--- a/include/linux/sdla_x25.h
+++ /dev/null
@@ -1,772 +0,0 @@
1/*****************************************************************************
2* sdla_x25.h Sangoma X.25 firmware API definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Feb 28, 2000 Nenad Corbic Updated for socket based x25api
14* Dec 13, 1996 Gene Kozin Initial version
15*****************************************************************************/
16#ifndef _SDLA_X25_H
17#define _SDLA_X25_H
18
19/*----------------------------------------------------------------------------
20 * Notes:
21 * ------
22 * 1. All structures defined in this file are byte-alined.
23 * Compiler Platform
24 * -------- --------
25 * GNU C Linux
26 *
27 */
28
29#ifndef PACKED
30# define PACKED __attribute__((packed))
31#endif /* PACKED */
32
33/****** CONSTANTS DEFINITIONS ***********************************************/
34
35#define X25_MAX_CHAN 255 /* max number of open X.25 circuits */
36#define X25_MAX_DATA 1024 /* max length of X.25 data buffer */
37/*
38 * X.25 shared memory layout.
39 */
40#define X25_MBOX_OFFS 0x16B0 /* general mailbox block */
41#define X25_RXMBOX_OFFS 0x1AD0 /* receive mailbox */
42#define X25_STATUS_OFFS 0x1EF0 /* X.25 status structure */
43#define X25_MB_VECTOR 0xE000 /* S514 mailbox window vecotr */
44#define X25_MISC_HDLC_BITS 0x1F00 /*X.25 miscallaneous HDLC bits */
45
46/* code levels */
47#define HDLC_LEVEL 0x01
48#define X25_LEVEL 0x02
49#define X25_AND_HDLC_LEVEL 0x03
50#define DO_HDLC_LEVEL_ERROR_CHECKING 0x04
51
52/****** DATA STRUCTURES *****************************************************/
53
54/*----------------------------------------------------------------------------
55 * X.25 Command Block.
56 */
57typedef struct X25Cmd
58{
59 unsigned char command PACKED; /* command code */
60 unsigned short length PACKED; /* transfer data length */
61 unsigned char result PACKED; /* return code */
62 unsigned char pf PACKED; /* P/F bit */
63 unsigned short lcn PACKED; /* logical channel */
64 unsigned char qdm PACKED; /* Q/D/M bits */
65 unsigned char cause PACKED; /* cause field */
66 unsigned char diagn PACKED; /* diagnostics */
67 unsigned char pktType PACKED; /* packet type */
68 unsigned char resrv[4] PACKED; /* reserved */
69} TX25Cmd;
70
71/*
72 * Defines for the 'command' field.
73 */
74/*----- General commands --------------*/
75#define X25_SET_GLOBAL_VARS 0x0B /* set global variables */
76#define X25_READ_MODEM_STATUS 0x0C /* read modem status */
77#define X25_READ_CODE_VERSION 0x15 /* read firmware version number */
78#define X25_TRACE_CONFIGURE 0x14 /* configure trace facility */
79#define X25_READ_TRACE_DATA 0x16 /* read trace data */
80#define X25_SET_INTERRUPT_MODE 0x17 /* set interrupt generation mode */
81#define X25_READ_INTERRUPT_MODE 0x18 /* read interrupt generation mode */
82/*----- HDLC-level commands -----------*/
83#define X25_HDLC_LINK_CONFIGURE 0x01 /* configure HDLC link level */
84#define X25_HDLC_LINK_OPEN 0x02 /* open HDLC link */
85#define X25_HDLC_LINK_CLOSE 0x03 /* close HDLC link */
86#define X25_HDLC_LINK_SETUP 0x04 /* set up HDLC link */
87#define X25_HDLC_LINK_DISC 0x05 /* disconnect DHLC link */
88#define X25_HDLC_LINK_STATUS 0x06 /* read DHLC link status */
89#define X25_HDLC_READ_STATS 0x07 /* read operational statistics */
90#define X25_HDLC_FLUSH_STATS 0x08 /* flush operational statistics */
91#define X25_HDLC_READ_COMM_ERR 0x09 /* read error statistics */
92#define X25_HDLC_FLUSH_COMM_ERR 0x0A /* flush error statistics */
93#define X25_HDLC_FLUSH_BUFFERS 0x0D /* flush HDLC-level data buffers */
94#define X25_HDLC_SPRVS_CNT_STAT 0x0F /* read surervisory count status */
95#define X25_HDLC_SEND_UI_FRAME 0x10 /* send unnumbered information frame */
96#define X25_HDLC_WRITE 0x11 /* send HDLC information frame */
97#define X25_HDLC_READ 0x21 /* read HDLC information frame */
98#define X25_HDLC_READ_CONFIG 0x12 /* read HDLC configuration */
99#define X25_HDLC_SET_CONFIG 0x13 /* set HDLC configuration */
100#define SET_PROTOCOL_LEVEL 0x1F /* set protocol level */
101/*----- X.25-level commands -----------*/
102#define X25_READ 0x22 /* read X.25 packet */
103#define X25_WRITE 0x23 /* send X.25 packet */
104#define X25_PLACE_CALL 0x30 /* place a call on SVC */
105#define X25_ACCEPT_CALL 0x31 /* accept incomming call */
106#define X25_CLEAR_CALL 0x32 /* clear call */
107#define X25_CLEAR_CONFRM 0x33 /* send clear confirmation packet */
108#define X25_RESET 0x34 /* send reset request packet */
109#define X25_RESET_CONFRM 0x35 /* send reset confirmation packet */
110#define X25_RESTART 0x36 /* send restart request packet */
111#define X25_RESTART_CONFRM 0x37 /* send restart confirmation packet */
112#define X25_INTERRUPT 0x38 /* send interrupt request packet */
113#define X25_INTERRUPT_CONFRM 0x39 /* send interrupt confirmation pkt */
114#define X25_REGISTRATION_RQST 0x3A /* send registration request packet */
115#define X25_REGISTRATION_CONFRM 0x3B /* send registration confirmation */
116#define X25_IS_DATA_AVAILABLE 0x40 /* querry receive queue */
117#define X25_INCOMMING_CALL_CTL 0x41 /* select incomming call options */
118#define X25_CONFIGURE_PVC 0x42 /* configure PVC */
119#define X25_GET_ACTIVE_CHANNELS 0x43 /* get a list of active circuits */
120#define X25_READ_CHANNEL_CONFIG 0x44 /* read virt. circuit configuration */
121#define X25_FLUSH_DATA_BUFFERS 0x45 /* flush X.25-level data buffers */
122#define X25_READ_HISTORY_TABLE 0x46 /* read asynchronous event log */
123#define X25_HISTORY_TABLE_CTL 0x47 /* control asynchronous event log */
124#define X25_GET_TX_D_BIT_STATUS 0x48 /* is packet with D-bit acknowleged */
125#define X25_READ_STATISTICS 0x49 /* read X.25-level statistics */
126#define X25_FLUSH_STATISTICS 0x4A /* flush X.25-level statistics */
127#define X25_READ_CONFIGURATION 0x50 /* read HDLC & X.25 configuration */
128#define X25_SET_CONFIGURATION 0x51 /* set HDLC & X.25 configuration */
129
130/*
131 * Defines for the 'result' field.
132 */
133/*----- General results ---------------*/
134#define X25RES_OK 0x00
135#define X25RES_ERROR 0x01
136#define X25RES_LINK_NOT_IN_ABM 0x02 /* link is not in ABM mode */
137#define X25RES_LINK_CLOSED 0x03
138#define X25RES_INVAL_LENGTH 0x04
139#define X25RES_INVAL_CMD 0x05
140#define X25RES_UNNUMBERED_FRAME 0x06 /* unnunbered frame received */
141#define X25RES_FRM_REJECT_MODE 0x07 /* link is in Frame Reject mode */
142#define X25RES_MODEM_FAILURE 0x08 /* DCD and/or CTS dropped */
143#define X25RES_N2_RETRY_LIMIT 0x09 /* N2 retry limit has been exceeded */
144#define X25RES_INVAL_LCN 0x30 /* invalid logical channel number */
145#define X25RES_INVAL_STATE 0x31 /* channel is not in data xfer mode */
146#define X25RES_INVAL_DATA_LEN 0x32 /* invalid data length */
147#define X25RES_NOT_READY 0x33 /* no data available / buffers full */
148#define X25RES_NETWORK_DOWN 0x34
149#define X25RES_CHANNEL_IN_USE 0x35 /* there is data queued on this LCN */
150#define X25RES_REGST_NOT_SUPPRT 0x36 /* registration not supported */
151#define X25RES_INVAL_FORMAT 0x37 /* invalid packet format */
152#define X25RES_D_BIT_NOT_SUPPRT 0x38 /* D-bit pragmatics not supported */
153#define X25RES_FACIL_NOT_SUPPRT 0x39 /* Call facility not supported */
154#define X25RES_INVAL_CALL_ARG 0x3A /* errorneous call arguments */
155#define X25RES_INVAL_CALL_DATA 0x3B /* errorneous call user data */
156#define X25RES_ASYNC_PACKET 0x40 /* asynchronous packet received */
157#define X25RES_PROTO_VIOLATION 0x41 /* protocol violation occurred */
158#define X25RES_PKT_TIMEOUT 0x42 /* X.25 packet time out */
159#define X25RES_PKT_RETRY_LIMIT 0x43 /* X.25 packet retry limit exceeded */
160/*----- Command-dependent results -----*/
161#define X25RES_LINK_DISC 0x00 /* HDLC_LINK_STATUS */
162#define X25RES_LINK_IN_ABM 0x01 /* HDLC_LINK_STATUS */
163#define X25RES_NO_DATA 0x01 /* HDLC_READ/READ_TRACE_DATA*/
164#define X25RES_TRACE_INACTIVE 0x02 /* READ_TRACE_DATA */
165#define X25RES_LINK_IS_OPEN 0x01 /* HDLC_LINK_OPEN */
166#define X25RES_LINK_IS_DISC 0x02 /* HDLC_LINK_DISC */
167#define X25RES_LINK_IS_CLOSED 0x03 /* HDLC_LINK_CLOSE */
168#define X25RES_INVAL_PARAM 0x31 /* INCOMMING_CALL_CTL */
169#define X25RES_INVAL_CONFIG 0x35 /* REGISTR_RQST/CONFRM */
170
171/*
172 * Defines for the 'qdm_bits' field.
173 */
174#define X25CMD_Q_BIT_MASK 0x04
175#define X25CMD_D_BIT_MASK 0x02
176#define X25CMD_M_BIT_MASK 0x01
177
178/*
179 * Defines for the 'pkt_type' field.
180 */
181/*----- Asynchronous events ------*/
182#define ASE_CLEAR_RQST 0x02
183#define ASE_RESET_RQST 0x04
184#define ASE_RESTART_RQST 0x08
185#define ASE_INTERRUPT 0x10
186#define ASE_DTE_REGISTR_RQST 0x20
187#define ASE_CALL_RQST 0x30
188#define ASE_CALL_ACCEPTED 0x31
189#define ASE_CLEAR_CONFRM 0x32
190#define ASE_RESET_CONFRM 0x33
191#define ASE_RESTART_CONFRM 0x34
192#define ASE_INTERRUPT_CONFRM 0x35
193#define ASE_DCE_REGISTR_CONFRM 0x36
194#define ASE_DIAGNOSTIC 0x37
195#define ASE_CALL_AUTO_CLEAR 0x38
196#define AUTO_RESPONSE_FLAG 0x80
197/*----- Time-Out events ----------*/
198#define TOE_RESTART_RQST 0x03
199#define TOE_CALL_RQST 0x05
200#define TOE_CLEAR_RQST 0x08
201#define TOE_RESET_RQST 0x0A
202/*----- Protocol Violation events */
203#define PVE_CLEAR_RQST 0x32
204#define PVE_RESET_RQST 0x33
205#define PVE_RESTART_RQST 0x34
206#define PVE_DIAGNOSTIC 0x37
207
208#define INTR_ON_RX_FRAME 0x01
209#define INTR_ON_TX_FRAME 0x02
210#define INTR_ON_MODEM_STATUS_CHANGE 0x04
211#define INTR_ON_COMMAND_COMPLETE 0x08
212#define INTR_ON_X25_ASY_TRANSACTION 0x10
213#define INTR_ON_TIMER 0x40
214#define DIRECT_RX_INTR_USAGE 0x80
215
216#define NO_INTR_PENDING 0x00
217#define RX_INTR_PENDING 0x01
218#define TX_INTR_PENDING 0x02
219#define MODEM_INTR_PENDING 0x04
220#define COMMAND_COMPLETE_INTR_PENDING 0x08
221#define X25_ASY_TRANS_INTR_PENDING 0x10
222#define TIMER_INTR_PENDING 0x40
223
224/*----------------------------------------------------------------------------
225 * X.25 Mailbox.
226 * This structure is located at offsets X25_MBOX_OFFS and X25_RXMBOX_OFFS
227 * into shared memory window.
228 */
229typedef struct X25Mbox
230{
231 unsigned char opflag PACKED; /* 00h: execution flag */
232 TX25Cmd cmd PACKED; /* 01h: command block */
233 unsigned char data[1] PACKED; /* 10h: data buffer */
234} TX25Mbox;
235
236/*----------------------------------------------------------------------------
237 * X.25 Time Stamp Structure.
238 */
239typedef struct X25TimeStamp
240{
241 unsigned char month PACKED;
242 unsigned char date PACKED;
243 unsigned char sec PACKED;
244 unsigned char min PACKED;
245 unsigned char hour PACKED;
246} TX25TimeStamp;
247
248/*----------------------------------------------------------------------------
249 * X.25 Status Block.
250 * This structure is located at offset X25_STATUS_OFF into shared memory
251 * window.
252 */
253typedef struct X25Status
254{
255 unsigned short pvc_map PACKED; /* 00h: PVC map */
256 unsigned short icc_map PACKED; /* 02h: Incomming Chan. map */
257 unsigned short twc_map PACKED; /* 04h: Two-way Cnan. map */
258 unsigned short ogc_map PACKED; /* 06h: Outgoing Chan. map */
259 TX25TimeStamp tstamp PACKED; /* 08h: timestamp (BCD) */
260 unsigned char iflags PACKED; /* 0Dh: interrupt flags */
261 unsigned char imask PACKED; /* 0Eh: interrupt mask */
262 unsigned char resrv PACKED; /* 0Eh: */
263 unsigned char gflags PACKED; /* 10h: misc. HDLC/X25 flags */
264 unsigned char cflags[X25_MAX_CHAN] PACKED; /* channel status bytes */
265} TX25Status;
266
267/*
268 * Bitmasks for the 'iflags' field.
269 */
270#define X25_RX_INTR 0x01 /* receive interrupt */
271#define X25_TX_INTR 0x02 /* transmit interrupt */
272#define X25_MODEM_INTR 0x04 /* modem status interrupt (CTS/DCD) */
273#define X25_EVENT_INTR 0x10 /* asyncronous event encountered */
274#define X25_CMD_INTR 0x08 /* interface command complete */
275
276/*
277 * Bitmasks for the 'gflags' field.
278 */
279#define X25_HDLC_ABM 0x01 /* HDLC is in ABM mode */
280#define X25_RX_READY 0x02 /* X.25 data available */
281#define X25_TRACE_READY 0x08 /* trace data available */
282#define X25_EVENT_IND 0x20 /* asynchronous event indicator */
283#define X25_TX_READY 0x40 /* space is available in Tx buf.*/
284
285/*
286 * Bitmasks for the 'cflags' field.
287 */
288#define X25_XFER_MODE 0x80 /* channel is in data transfer mode */
289#define X25_TXWIN_OPEN 0x40 /* transmit window open */
290#define X25_RXBUF_MASK 0x3F /* number of data buffers available */
291
292/*****************************************************************************
293 * Following definitions structurize contents of the TX25Mbox.data field for
294 * different X.25 interface commands.
295 ****************************************************************************/
296
297/* ---------------------------------------------------------------------------
298 * X25_SET_GLOBAL_VARS Command.
299 */
300typedef struct X25GlobalVars
301{
302 unsigned char resrv PACKED; /* 00h: reserved */
303 unsigned char dtrCtl PACKED; /* 01h: DTR control code */
304 unsigned char resErr PACKED; /* 01h: '1' - reset modem error */
305} TX25GlobalVars;
306
307/*
308 * Defines for the 'dtrCtl' field.
309 */
310#define X25_RAISE_DTR 0x01
311#define X25_DROP_DTR 0x02
312
313/* ---------------------------------------------------------------------------
314 * X25_READ_MODEM_STATUS Command.
315 */
316typedef struct X25ModemStatus
317{
318 unsigned char status PACKED; /* 00h: modem status */
319} TX25ModemStatus;
320
321/*
322 * Defines for the 'status' field.
323 */
324#define X25_CTS_MASK 0x20
325#define X25_DCD_MASK 0x08
326
327/* ---------------------------------------------------------------------------
328 * X25_HDLC_LINK_STATUS Command.
329 */
330typedef struct X25LinkStatus
331{
332 unsigned char txQueued PACKED; /* 00h: queued Tx I-frames*/
333 unsigned char rxQueued PACKED; /* 01h: queued Rx I-frames*/
334 unsigned char station PACKED; /* 02h: DTE/DCE config. */
335 unsigned char reserved PACKED; /* 03h: reserved */
336 unsigned char sfTally PACKED; /* 04h: supervisory frame tally */
337} TX25LinkStatus;
338
339/*
340 * Defines for the 'station' field.
341 */
342#define X25_STATION_DTE 0x01 /* station configured as DTE */
343#define X25_STATION_DCE 0x02 /* station configured as DCE */
344
345/* ---------------------------------------------------------------------------
346 * X25_HDLC_READ_STATS Command.
347 */
348typedef struct HdlcStats
349{ /* a number of ... */
350 unsigned short rxIFrames PACKED; /* 00h: ready Rx I-frames */
351 unsigned short rxNoseq PACKED; /* 02h: frms out-of-sequence */
352 unsigned short rxNodata PACKED; /* 04h: I-frms without data */
353 unsigned short rxDiscarded PACKED; /* 06h: discarded frames */
354 unsigned short rxTooLong PACKED; /* 08h: frames too long */
355 unsigned short rxBadAddr PACKED; /* 0Ah: frms with inval.addr*/
356 unsigned short txAcked PACKED; /* 0Ch: acknowledged I-frms */
357 unsigned short txRetransm PACKED; /* 0Eh: re-transmit. I-frms */
358 unsigned short t1Timeout PACKED; /* 10h: T1 timeouts */
359 unsigned short rxSABM PACKED; /* 12h: received SABM frames */
360 unsigned short rxDISC PACKED; /* 14h: received DISC frames */
361 unsigned short rxDM PACKED; /* 16h: received DM frames */
362 unsigned short rxFRMR PACKED; /* 18h: FRMR frames received */
363 unsigned short txSABM PACKED; /* 1Ah: transm. SABM frames*/
364 unsigned short txDISC PACKED; /* 1Ch: transm. DISC frames*/
365 unsigned short txDM PACKED; /* 1Eh: transm. DM frames */
366 unsigned short txFRMR PACKED; /* 20h: transm. FRMR frames*/
367} THdlcStats;
368
369/* ---------------------------------------------------------------------------
370 * X25_HDLC_READ_COMM_ERR Command.
371 */
372typedef struct HdlcCommErr
373{ /* a number of ... */
374 unsigned char rxOverrun PACKED; /* 00h: Rx overrun errors */
375 unsigned char rxBadCrc PACKED; /* 01h: Rx CRC errors */
376 unsigned char rxAborted PACKED; /* 02h: Rx aborted frames */
377 unsigned char rxDropped PACKED; /* 03h: frames lost */
378 unsigned char txAborted PACKED; /* 04h: Tx aborted frames */
379 unsigned char txUnderrun PACKED; /* 05h: Tx underrun errors */
380 unsigned char txMissIntr PACKED; /* 06h: missed underrun ints */
381 unsigned char reserved PACKED; /* 07h: reserved */
382 unsigned char droppedDCD PACKED; /* 08h: times DCD dropped */
383 unsigned char droppedCTS PACKED; /* 09h: times CTS dropped */
384} THdlcCommErr;
385
386/* ---------------------------------------------------------------------------
387 * X25_SET_CONFIGURATION & X25_READ_CONFIGURATION Commands.
388 */
389typedef struct X25Config
390{
391unsigned char baudRate PACKED; /* 00h: */
392 unsigned char t1 PACKED; /* 01h: */
393 unsigned char t2 PACKED; /* 02h: */
394 unsigned char n2 PACKED; /* 03h: */
395 unsigned short hdlcMTU PACKED; /* 04h: */
396 unsigned char hdlcWindow PACKED; /* 06h: */
397 unsigned char t4 PACKED; /* 07h: */
398 unsigned char autoModem PACKED; /* 08h: */
399 unsigned char autoHdlc PACKED; /* 09h: */
400 unsigned char hdlcOptions PACKED; /* 0Ah: */
401 unsigned char station PACKED; /* 0Bh: */
402 unsigned char pktWindow PACKED; /* 0Ch: */
403 unsigned short defPktSize PACKED; /* 0Dh: */
404 unsigned short pktMTU PACKED; /* 0Fh: */
405 unsigned short loPVC PACKED; /* 11h: */
406 unsigned short hiPVC PACKED; /* 13h: */
407 unsigned short loIncommingSVC PACKED; /* 15h: */
408 unsigned short hiIncommingSVC PACKED; /* 17h: */
409 unsigned short loTwoWaySVC PACKED; /* 19h: */
410 unsigned short hiTwoWaySVC PACKED; /* 1Bh: */
411 unsigned short loOutgoingSVC PACKED; /* 1Dh: */
412 unsigned short hiOutgoingSVC PACKED; /* 1Fh: */
413 unsigned short options PACKED; /* 21h: */
414 unsigned char responseOpt PACKED; /* 23h: */
415 unsigned short facil1 PACKED; /* 24h: */
416 unsigned short facil2 PACKED; /* 26h: */
417 unsigned short ccittFacil PACKED; /* 28h: */
418 unsigned short otherFacil PACKED; /* 2Ah: */
419 unsigned short ccittCompat PACKED; /* 2Ch: */
420 unsigned char t10t20 PACKED; /* 2Eh: */
421 unsigned char t11t21 PACKED; /* 2Fh: */
422 unsigned char t12t22 PACKED; /* 30h: */
423 unsigned char t13t23 PACKED; /* 31h: */
424 unsigned char t16t26 PACKED; /* 32H: */
425 unsigned char t28 PACKED; /* 33h: */
426 unsigned char r10r20 PACKED; /* 34h: */
427 unsigned char r12r22 PACKED; /* 35h: */
428 unsigned char r13r23 PACKED; /* 36h: */
429} TX25Config;
430
431/* ---------------------------------------------------------------------------
432 * X25_READ_CHANNEL_CONFIG Command.
433 */
434typedef struct X25ChanAlloc /*----- Channel allocation -*/
435{
436 unsigned short loPVC PACKED; /* 00h: lowest PVC number */
437 unsigned short hiPVC PACKED; /* 02h: highest PVC number */
438 unsigned short loIncommingSVC PACKED; /* 04h: lowest incoming SVC */
439 unsigned short hiIncommingSVC PACKED; /* 06h: highest incoming SVC */
440 unsigned short loTwoWaySVC PACKED; /* 08h: lowest two-way SVC */
441 unsigned short hiTwoWaySVC PACKED; /* 0Ah: highest two-way SVC */
442 unsigned short loOutgoingSVC PACKED; /* 0Ch: lowest outgoing SVC */
443 unsigned short hiOutgoingSVC PACKED; /* 0Eh: highest outgoing SVC */
444} TX25ChanAlloc;
445
446typedef struct X25ChanCfg /*------ Channel configuration -----*/
447{
448 unsigned char type PACKED; /* 00h: channel type */
449 unsigned char txConf PACKED; /* 01h: Tx packet and window sizes */
450 unsigned char rxConf PACKED; /* 01h: Rx packet and window sizes */
451} TX25ChanCfg;
452
453/*
454 * Defines for the 'type' field.
455 */
456#define X25_PVC 0x01 /* PVC */
457#define X25_SVC_IN 0x03 /* Incoming SVC */
458#define X25_SVC_TWOWAY 0x07 /* Two-way SVC */
459#define X25_SVC_OUT 0x0B /* Outgoing SVC */
460
461/*----------------------------------------------------------------------------
462 * X25_READ_STATISTICS Command.
463 */
464typedef struct X25Stats
465{ /* number of packets Tx/Rx'ed */
466 unsigned short txRestartRqst PACKED; /* 00h: Restart Request */
467 unsigned short rxRestartRqst PACKED; /* 02h: Restart Request */
468 unsigned short txRestartConf PACKED; /* 04h: Restart Confirmation */
469 unsigned short rxRestartConf PACKED; /* 06h: Restart Confirmation */
470 unsigned short txResetRqst PACKED; /* 08h: Reset Request */
471 unsigned short rxResetRqst PACKED; /* 0Ah: Reset Request */
472 unsigned short txResetConf PACKED; /* 0Ch: Reset Confirmation */
473 unsigned short rxResetConf PACKED; /* 0Eh: Reset Confirmation */
474 unsigned short txCallRequest PACKED; /* 10h: Call Request */
475 unsigned short rxCallRequest PACKED; /* 12h: Call Request */
476 unsigned short txCallAccept PACKED; /* 14h: Call Accept */
477 unsigned short rxCallAccept PACKED; /* 16h: Call Accept */
478 unsigned short txClearRqst PACKED; /* 18h: Clear Request */
479 unsigned short rxClearRqst PACKED; /* 1Ah: Clear Request */
480 unsigned short txClearConf PACKED; /* 1Ch: Clear Confirmation */
481 unsigned short rxClearConf PACKED; /* 1Eh: Clear Confirmation */
482 unsigned short txDiagnostic PACKED; /* 20h: Diagnostic */
483 unsigned short rxDiagnostic PACKED; /* 22h: Diagnostic */
484 unsigned short txRegRqst PACKED; /* 24h: Registration Request */
485 unsigned short rxRegRqst PACKED; /* 26h: Registration Request */
486 unsigned short txRegConf PACKED; /* 28h: Registration Confirm.*/
487 unsigned short rxRegConf PACKED; /* 2Ah: Registration Confirm.*/
488 unsigned short txInterrupt PACKED; /* 2Ch: Interrupt */
489 unsigned short rxInterrupt PACKED; /* 2Eh: Interrupt */
490 unsigned short txIntrConf PACKED; /* 30h: Interrupt Confirm. */
491 unsigned short rxIntrConf PACKED; /* 32h: Interrupt Confirm. */
492 unsigned short txData PACKED; /* 34h: Data */
493 unsigned short rxData PACKED; /* 36h: Data */
494 unsigned short txRR PACKED; /* 38h: RR */
495 unsigned short rxRR PACKED; /* 3Ah: RR */
496 unsigned short txRNR PACKED; /* 3Ch: RNR */
497 unsigned short rxRNR PACKED; /* 3Eh: RNR */
498} TX25Stats;
499
500/*----------------------------------------------------------------------------
501 * X25_READ_HISTORY_TABLE Command.
502 */
503typedef struct X25EventLog
504{
505 unsigned char type PACKED; /* 00h: transaction type */
506 unsigned short lcn PACKED; /* 01h: logical channel num */
507 unsigned char packet PACKED; /* 03h: async packet type */
508 unsigned char cause PACKED; /* 04h: X.25 cause field */
509 unsigned char diag PACKED; /* 05h: X.25 diag field */
510 TX25TimeStamp ts PACKED; /* 06h: time stamp */
511} TX25EventLog;
512
513/*
514 * Defines for the 'type' field.
515 */
516#define X25LOG_INCOMMING 0x00
517#define X25LOG_APPLICATION 0x01
518#define X25LOG_AUTOMATIC 0x02
519#define X25LOG_ERROR 0x04
520#define X25LOG_TIMEOUT 0x08
521#define X25LOG_RECOVERY 0x10
522
523/*
524 * Defines for the 'packet' field.
525 */
526#define X25LOG_CALL_RQST 0x0B
527#define X25LOG_CALL_ACCEPTED 0x0F
528#define X25LOG_CLEAR_RQST 0x13
529#define X25LOG_CLEAR_CONFRM 0x17
530#define X25LOG_RESET_RQST 0x1B
531#define X25LOG_RESET_CONFRM 0x1F
532#define X25LOG_RESTART_RQST 0xFB
533#define X25LOG_RESTART_COMFRM 0xFF
534#define X25LOG_DIAGNOSTIC 0xF1
535#define X25LOG_DTE_REG_RQST 0xF3
536#define X25LOG_DTE_REG_COMFRM 0xF7
537
538/* ---------------------------------------------------------------------------
539 * X25_TRACE_CONFIGURE Command.
540 */
541typedef struct X25TraceCfg
542{
543 unsigned char flags PACKED; /* 00h: trace configuration flags */
544 unsigned char timeout PACKED; /* 01h: timeout for trace delay mode*/
545} TX25TraceCfg;
546
547/*
548 * Defines for the 'flags' field.
549 */
550#define X25_TRC_ENABLE 0x01 /* bit0: '1' - trace enabled */
551#define X25_TRC_TIMESTAMP 0x02 /* bit1: '1' - time stamping enabled*/
552#define X25_TRC_DELAY 0x04 /* bit2: '1' - trace delay enabled */
553#define X25_TRC_DATA 0x08 /* bit3: '1' - trace data packets */
554#define X25_TRC_SUPERVISORY 0x10 /* bit4: '1' - trace suprvisory pkts*/
555#define X25_TRC_ASYNCHRONOUS 0x20 /* bit5: '1' - trace asynch. packets*/
556#define X25_TRC_HDLC 0x40 /* bit6: '1' - trace all packets */
557#define X25_TRC_READ 0x80 /* bit7: '1' - get current config. */
558
559/* ---------------------------------------------------------------------------
560 * X25_READ_TRACE_DATA Command.
561 */
562typedef struct X25Trace /*----- Trace data structure -------*/
563{
564 unsigned short length PACKED; /* 00h: trace data length */
565 unsigned char type PACKED; /* 02h: trace type */
566 unsigned char lost_cnt PACKED; /* 03h: N of traces lost */
567 TX25TimeStamp tstamp PACKED; /* 04h: mon/date/sec/min/hour */
568 unsigned short millisec PACKED; /* 09h: ms time stamp */
569 unsigned char data[0] PACKED; /* 0Bh: traced frame */
570} TX25Trace;
571
572/*
573 * Defines for the 'type' field.
574 */
575#define X25_TRC_TYPE_MASK 0x0F /* bits 0..3: trace type */
576#define X25_TRC_TYPE_RX_FRAME 0x00 /* received frame trace */
577#define X25_TRC_TYPE_TX_FRAME 0x01 /* transmitted frame */
578#define X25_TRC_TYPE_ERR_FRAME 0x02 /* error frame */
579
580#define X25_TRC_ERROR_MASK 0xF0 /* bits 4..7: error code */
581#define X25_TRCERR_RX_ABORT 0x10 /* receive abort error */
582#define X25_TRCERR_RX_BADCRC 0x20 /* receive CRC error */
583#define X25_TRCERR_RX_OVERRUN 0x30 /* receiver overrun error */
584#define X25_TRCERR_RX_TOO_LONG 0x40 /* excessive frame length error */
585#define X25_TRCERR_TX_ABORT 0x70 /* aborted frame transmittion error */
586#define X25_TRCERR_TX_UNDERRUN 0x80 /* transmit underrun error */
587
588/*****************************************************************************
589 * Following definitions describe HDLC frame and X.25 packet formats.
590 ****************************************************************************/
591
592typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/
593{
594 unsigned char addr PACKED; /* address field */
595 unsigned char cntl PACKED; /* control field */
596 unsigned char data[0] PACKED;
597} THDLCFrame;
598
599typedef struct X25Pkt /*----- X.25 Paket Format ----------*/
600{
601 unsigned char lcn_hi PACKED; /* 4 MSB of Logical Channel Number */
602 unsigned char lcn_lo PACKED; /* 8 LSB of Logical Channel Number */
603 unsigned char type PACKED;
604 unsigned char data[0] PACKED;
605} TX25Pkt;
606
607/*
608 * Defines for the 'lcn_hi' field.
609 */
610#define X25_Q_BIT_MASK 0x80 /* Data Qualifier Bit mask */
611#define X25_D_BIT_MASK 0x40 /* Delivery Confirmation Bit mask */
612#define X25_M_BITS_MASK 0x30 /* Modulo Bits mask */
613#define X25_LCN_MSB_MASK 0x0F /* LCN most significant bits mask */
614
615/*
616 * Defines for the 'type' field.
617 */
618#define X25PKT_DATA 0x01 /* Data packet mask */
619#define X25PKT_SUPERVISORY 0x02 /* Supervisory packet mask */
620#define X25PKT_CALL_RQST 0x0B /* Call Request/Incoming */
621#define X25PKT_CALL_ACCEPTED 0x0F /* Call Accepted/Connected */
622#define X25PKT_CLEAR_RQST 0x13 /* Clear Request/Indication */
623#define X25PKT_CLEAR_CONFRM 0x17 /* Clear Confirmation */
624#define X25PKT_RESET_RQST 0x1B /* Reset Request/Indication */
625#define X25PKT_RESET_CONFRM 0x1F /* Reset Confirmation */
626#define X25PKT_RESTART_RQST 0xFB /* Restart Request/Indication */
627#define X25PKT_RESTART_CONFRM 0xFF /* Restart Confirmation */
628#define X25PKT_INTERRUPT 0x23 /* Interrupt */
629#define X25PKT_INTERRUPT_CONFRM 0x27 /* Interrupt Confirmation */
630#define X25PKT_DIAGNOSTIC 0xF1 /* Diagnostic */
631#define X25PKT_REGISTR_RQST 0xF3 /* Registration Request */
632#define X25PKT_REGISTR_CONFRM 0xF7 /* Registration Confirmation */
633#define X25PKT_RR_MASKED 0x01 /* Receive Ready packet after masking */
634#define X25PKT_RNR_MASKED 0x05 /* Receive Not Ready after masking */
635
636
637typedef struct {
638 TX25Cmd cmd PACKED;
639 char data[X25_MAX_DATA] PACKED;
640} mbox_cmd_t;
641
642
643typedef struct {
644 unsigned char qdm PACKED; /* Q/D/M bits */
645 unsigned char cause PACKED; /* cause field */
646 unsigned char diagn PACKED; /* diagnostics */
647 unsigned char pktType PACKED;
648 unsigned short length PACKED;
649 unsigned char result PACKED;
650 unsigned short lcn PACKED;
651 char reserved[7] PACKED;
652}x25api_hdr_t;
653
654
655typedef struct {
656 x25api_hdr_t hdr PACKED;
657 char data[X25_MAX_DATA] PACKED;
658}x25api_t;
659
660
661/*
662 * XPIPEMON Definitions
663 */
664
665/* valid ip_protocol for UDP management */
666#define UDPMGMT_UDP_PROTOCOL 0x11
667#define UDPMGMT_XPIPE_SIGNATURE "XLINK8ND"
668#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
669
670/* values for request/reply byte */
671#define UDPMGMT_REQUEST 0x01
672#define UDPMGMT_REPLY 0x02
673#define UDP_OFFSET 12
674
675
676typedef struct {
677 unsigned char opp_flag PACKED; /* the opp flag */
678 unsigned char command PACKED; /* command code */
679 unsigned short length PACKED; /* transfer data length */
680 unsigned char result PACKED; /* return code */
681 unsigned char pf PACKED; /* P/F bit */
682 unsigned short lcn PACKED; /* logical channel */
683 unsigned char qdm PACKED; /* Q/D/M bits */
684 unsigned char cause PACKED; /* cause field */
685 unsigned char diagn PACKED; /* diagnostics */
686 unsigned char pktType PACKED; /* packet type */
687 unsigned char resrv[4] PACKED; /* reserved */
688} cblock_t;
689
690typedef struct {
691 ip_pkt_t ip_pkt PACKED;
692 udp_pkt_t udp_pkt PACKED;
693 wp_mgmt_t wp_mgmt PACKED;
694 cblock_t cblock PACKED;
695 unsigned char data[4080] PACKED;
696} x25_udp_pkt_t;
697
698
699typedef struct read_hdlc_stat {
700 unsigned short inf_frames_rx_ok PACKED;
701 unsigned short inf_frames_rx_out_of_seq PACKED;
702 unsigned short inf_frames_rx_no_data PACKED;
703 unsigned short inf_frames_rx_dropped PACKED;
704 unsigned short inf_frames_rx_data_too_long PACKED;
705 unsigned short inf_frames_rx_invalid_addr PACKED;
706 unsigned short inf_frames_tx_ok PACKED;
707 unsigned short inf_frames_tx_retransmit PACKED;
708 unsigned short T1_timeouts PACKED;
709 unsigned short SABM_frames_rx PACKED;
710 unsigned short DISC_frames_rx PACKED;
711 unsigned short DM_frames_rx PACKED;
712 unsigned short FRMR_frames_rx PACKED;
713 unsigned short SABM_frames_tx PACKED;
714 unsigned short DISC_frames_tx PACKED;
715 unsigned short DM_frames_tx PACKED;
716 unsigned short FRMR_frames_tx PACKED;
717} read_hdlc_stat_t;
718
719typedef struct read_comms_err_stats{
720 unsigned char overrun_err_rx PACKED;
721 unsigned char CRC_err PACKED;
722 unsigned char abort_frames_rx PACKED;
723 unsigned char frames_dropped_buf_full PACKED;
724 unsigned char abort_frames_tx PACKED;
725 unsigned char transmit_underruns PACKED;
726 unsigned char missed_tx_underruns_intr PACKED;
727 unsigned char reserved PACKED;
728 unsigned char DCD_drop PACKED;
729 unsigned char CTS_drop PACKED;
730} read_comms_err_stats_t;
731
732typedef struct trace_data {
733 unsigned short length PACKED;
734 unsigned char type PACKED;
735 unsigned char trace_dropped PACKED;
736 unsigned char reserved[5] PACKED;
737 unsigned short timestamp PACKED;
738 unsigned char data PACKED;
739} trace_data_t;
740
741enum {UDP_XPIPE_TYPE};
742
743#define XPIPE_ENABLE_TRACING 0x14
744#define XPIPE_DISABLE_TRACING 0x14
745#define XPIPE_GET_TRACE_INFO 0x16
746#define XPIPE_FT1_READ_STATUS 0x74
747#define XPIPE_DRIVER_STAT_IFSEND 0x75
748#define XPIPE_DRIVER_STAT_INTR 0x76
749#define XPIPE_DRIVER_STAT_GEN 0x77
750#define XPIPE_FLUSH_DRIVER_STATS 0x78
751#define XPIPE_ROUTER_UP_TIME 0x79
752#define XPIPE_SET_FT1_MODE 0x81
753#define XPIPE_FT1_STATUS_CTRL 0x80
754
755
756/* error messages */
757#define NO_BUFFS_OR_CLOSED_WIN 0x33
758#define DATA_LENGTH_TOO_BIG 0x32
759#define NO_DATA_AVAILABLE 0x33
760#define Z80_TIMEOUT_ERROR 0x0a
761#define NO_BUFFS 0x08
762
763
764/* Trace options */
765#define TRACE_DEFAULT 0x03
766#define TRACE_SUPERVISOR_FRMS 0x10
767#define TRACE_ASYNC_FRMS 0x20
768#define TRACE_ALL_HDLC_FRMS 0x40
769#define TRACE_DATA_FRMS 0x08
770
771
772#endif /* _SDLA_X25_H */
diff --git a/include/linux/sdladrv.h b/include/linux/sdladrv.h
deleted file mode 100644
index c85e103d5e7b..000000000000
--- a/include/linux/sdladrv.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*****************************************************************************
2* sdladrv.h SDLA Support Module. Kernel API Definitions.
3*
4* Author: Gideon Hack
5*
6* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Jun 02, 1999 Gideon Hack Added support for the S514 PCI adapter.
14* Dec 11, 1996 Gene Kozin Complete overhaul.
15* Oct 17, 1996 Gene Kozin Minor bug fixes.
16* Jun 12, 1996 Gene Kozin Added support for S503 card.
17* Dec 06, 1995 Gene Kozin Initial version.
18*****************************************************************************/
19#ifndef _SDLADRV_H
20#define _SDLADRV_H
21
22
23#define SDLA_MAXIORANGE 4 /* maximum I/O port range */
24#define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */
25/****** Data Structures *****************************************************/
26
27/*----------------------------------------------------------------------------
28 * Adapter hardware configuration. Pointer to this structure is passed to all
29 * APIs.
30 */
31typedef struct sdlahw
32{
33 unsigned type; /* adapter type */
34 unsigned fwid; /* firmware ID */
35 unsigned port; /* adapter I/O port base */
36 int irq; /* interrupt request level */
37 char S514_cpu_no[1]; /* PCI CPU Number */
38 unsigned char S514_slot_no; /* PCI Slot Number */
39 char auto_pci_cfg; /* Autodetect PCI Slot */
40 struct pci_dev *pci_dev; /* PCI device */
41 void * dpmbase; /* dual-port memory base */
42 unsigned dpmsize; /* dual-port memory size */
43 unsigned pclk; /* CPU clock rate, kHz */
44 unsigned long memory; /* memory size */
45 unsigned long vector; /* local offset of the DPM window */
46 unsigned io_range; /* I/O port range */
47 unsigned char regs[SDLA_MAXIORANGE]; /* was written to registers */
48 unsigned reserved[5];
49} sdlahw_t;
50
51/****** Function Prototypes *************************************************/
52
53extern int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len);
54extern int sdla_down (sdlahw_t* hw);
55extern void S514_intack (sdlahw_t* hw, u32 int_status);
56extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status);
57extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr);
58extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf,
59 unsigned len);
60extern int sdla_poke (sdlahw_t* hw, unsigned long addr, void* buf,
61 unsigned len);
62extern int sdla_exec (void* opflag);
63
64extern unsigned wanpipe_hw_probe(void);
65
66#endif /* _SDLADRV_H */
diff --git a/include/linux/sdlapci.h b/include/linux/sdlapci.h
deleted file mode 100644
index 6f7c904f188d..000000000000
--- a/include/linux/sdlapci.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*****************************************************************************
2* sdlapci.h WANPIPE(tm) Multiprotocol WAN Link Driver.
3* Definitions for the SDLA PCI adapter.
4*
5* Author: Gideon Hack <ghack@sangoma.com>
6*
7* Copyright: (c) 1999-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Jun 02, 1999 Gideon Hack Initial version.
15*****************************************************************************/
16#ifndef _SDLAPCI_H
17#define _SDLAPCI_H
18
19/****** Defines *************************************************************/
20
21/* Definitions for identifying and finding S514 PCI adapters */
22#define V3_VENDOR_ID 0x11B0 /* V3 vendor ID number */
23#define V3_DEVICE_ID 0x0002 /* V3 device ID number */
24#define SANGOMA_SUBSYS_VENDOR 0x4753 /* ID for Sangoma */
25#define PCI_DEV_SLOT_MASK 0x1F /* mask for slot numbering */
26#define PCI_IRQ_NOT_ALLOCATED 0xFF /* interrupt line for no IRQ */
27
28/* Local PCI register offsets */
29#define PCI_VENDOR_ID_WORD 0x00 /* vendor ID */
30#define PCI_IO_BASE_DWORD 0x10 /* IO base */
31#define PCI_MEM_BASE0_DWORD 0x14 /* memory base - apperture 0 */
32#define PCI_MEM_BASE1_DWORD 0x18 /* memory base - apperture 1 */
33#define PCI_SUBSYS_VENDOR_WORD 0x2C /* subsystem vendor ID */
34#define PCI_INT_LINE_BYTE 0x3C /* interrupt line */
35#define PCI_INT_PIN_BYTE 0x3D /* interrupt pin */
36#define PCI_MAP0_DWORD 0x40 /* PCI to local bus address 0 */
37#define PCI_MAP1_DWORD 0x44 /* PCI to local bus address 1 */
38#define PCI_INT_STATUS 0x48 /* interrupt status */
39#define PCI_INT_CONFIG 0x4C /* interrupt configuration */
40
41/* Local PCI register usage */
42#define PCI_MEMORY_ENABLE 0x00000003 /* enable PCI memory */
43#define PCI_CPU_A_MEM_DISABLE 0x00000002 /* disable CPU A memory */
44#define PCI_CPU_B_MEM_DISABLE 0x00100002 /* disable CPU B memory */
45#define PCI_ENABLE_IRQ_CPU_A 0x005A0004 /* enable IRQ for CPU A */
46#define PCI_ENABLE_IRQ_CPU_B 0x005A0008 /* enable IRQ for CPU B */
47#define PCI_DISABLE_IRQ_CPU_A 0x00000004 /* disable IRQ for CPU A */
48#define PCI_DISABLE_IRQ_CPU_B 0x00000008 /* disable IRQ for CPU B */
49
50/* Setting for the Interrupt Status register */
51#define IRQ_CPU_A 0x04 /* IRQ for CPU A */
52#define IRQ_CPU_B 0x08 /* IRQ for CPU B */
53
54/* The maximum size of the S514 memory */
55#define MAX_SIZEOF_S514_MEMORY (256 * 1024)
56
57/* S514 control register offsets within the memory address space */
58#define S514_CTRL_REG_BYTE 0x80000
59
60/* S514 adapter control bytes */
61#define S514_CPU_HALT 0x00
62#define S514_CPU_START 0x01
63
64/* The maximum number of S514 adapters supported */
65#define MAX_S514_CARDS 20
66
67#define PCI_CARD_TYPE 0x2E
68#define S514_DUAL_CPU 0x12
69#define S514_SINGLE_CPU 0x11
70
71#endif /* _SDLAPCI_H */
72
diff --git a/include/linux/sdlasfm.h b/include/linux/sdlasfm.h
deleted file mode 100644
index 94aaa8ada667..000000000000
--- a/include/linux/sdlasfm.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*****************************************************************************
2* sdlasfm.h WANPIPE(tm) Multiprotocol WAN Link Driver.
3* Definitions for the SDLA Firmware Module (SFM).
4*
5* Author: Gideon Hack
6*
7* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
15* Dec 11, 1996 Gene Kozin Cosmetic changes
16* Apr 16, 1996 Gene Kozin Changed adapter & firmware IDs. Version 2
17* Dec 15, 1995 Gene Kozin Structures chaned
18* Nov 09, 1995 Gene Kozin Initial version.
19*****************************************************************************/
20#ifndef _SDLASFM_H
21#define _SDLASFM_H
22
23/****** Defines *************************************************************/
24
25#define SFM_VERSION 2
26#define SFM_SIGNATURE "SFM - Sangoma SDLA Firmware Module"
27
28/* min/max */
29#define SFM_IMAGE_SIZE 0x8000 /* max size of SDLA code image file */
30#define SFM_DESCR_LEN 256 /* max length of description string */
31#define SFM_MAX_SDLA 16 /* max number of compatible adapters */
32
33/* Adapter types */
34#define SDLA_S502A 5020
35#define SDLA_S502E 5021
36#define SDLA_S503 5030
37#define SDLA_S508 5080
38#define SDLA_S507 5070
39#define SDLA_S509 5090
40#define SDLA_S514 5140
41
42/* S514 PCI adapter CPU numbers */
43#define S514_CPU_A 'A'
44#define S514_CPU_B 'B'
45
46
47/* Firmware identification numbers:
48 * 0 .. 999 Test & Diagnostics
49 * 1000 .. 1999 Streaming HDLC
50 * 2000 .. 2999 Bisync
51 * 3000 .. 3999 SDLC
52 * 4000 .. 4999 HDLC
53 * 5000 .. 5999 X.25
54 * 6000 .. 6999 Frame Relay
55 * 7000 .. 7999 PPP
56 * 8000 .. 8999 Cisco HDLC
57 */
58#define SFID_CALIB502 200
59#define SFID_STRM502 1200
60#define SFID_STRM508 1800
61#define SFID_BSC502 2200
62#define SFID_SDLC502 3200
63#define SFID_HDLC502 4200
64#define SFID_HDLC508 4800
65#define SFID_X25_502 5200
66#define SFID_X25_508 5800
67#define SFID_FR502 6200
68#define SFID_FR508 6800
69#define SFID_PPP502 7200
70#define SFID_PPP508 7800
71#define SFID_PPP514 7140
72#define SFID_CHDLC508 8800
73#define SFID_CHDLC514 8140
74
75/****** Data Types **********************************************************/
76
77typedef struct sfm_info /* firmware module information */
78{
79 unsigned short codeid; /* firmware ID */
80 unsigned short version; /* firmaware version number */
81 unsigned short adapter[SFM_MAX_SDLA]; /* compatible adapter types */
82 unsigned long memsize; /* minimum memory size */
83 unsigned short reserved[2]; /* reserved */
84 unsigned short startoffs; /* entry point offset */
85 unsigned short winoffs; /* dual-port memory window offset */
86 unsigned short codeoffs; /* code load offset */
87 unsigned short codesize; /* code size */
88 unsigned short dataoffs; /* configuration data load offset */
89 unsigned short datasize; /* configuration data size */
90} sfm_info_t;
91
92typedef struct sfm /* SDLA firmware file structire */
93{
94 char signature[80]; /* SFM file signature */
95 unsigned short version; /* file format version */
96 unsigned short checksum; /* info + image */
97 unsigned short reserved[6]; /* reserved */
98 char descr[SFM_DESCR_LEN]; /* description string */
99 sfm_info_t info; /* firmware module info */
100 unsigned char image[1]; /* code image (variable size) */
101} sfm_t;
102
103#endif /* _SDLASFM_H */
104
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index fca9b0fb5b4e..5a095572881d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -73,7 +73,7 @@ static inline int write_tryseqlock(seqlock_t *sl)
73} 73}
74 74
75/* Start of read calculation -- fetch last complete writer token */ 75/* Start of read calculation -- fetch last complete writer token */
76static inline unsigned read_seqbegin(const seqlock_t *sl) 76static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
77{ 77{
78 unsigned ret = sl->sequence; 78 unsigned ret = sl->sequence;
79 smp_rmb(); 79 smp_rmb();
@@ -88,7 +88,7 @@ static inline unsigned read_seqbegin(const seqlock_t *sl)
88 * 88 *
89 * Using xor saves one conditional branch. 89 * Using xor saves one conditional branch.
90 */ 90 */
91static inline int read_seqretry(const seqlock_t *sl, unsigned iv) 91static __always_inline int read_seqretry(const seqlock_t *sl, unsigned iv)
92{ 92{
93 smp_rmb(); 93 smp_rmb();
94 return (iv & 1) | (sl->sequence ^ iv); 94 return (iv & 1) | (sl->sequence ^ iv);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c4619a428d9b..f8f234708b98 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -344,6 +344,13 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
344 void *here); 344 void *here);
345extern void skb_under_panic(struct sk_buff *skb, int len, 345extern void skb_under_panic(struct sk_buff *skb, int len,
346 void *here); 346 void *here);
347extern void skb_truesize_bug(struct sk_buff *skb);
348
349static inline void skb_truesize_check(struct sk_buff *skb)
350{
351 if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len))
352 skb_truesize_bug(skb);
353}
347 354
348extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 355extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
349 int getfrag(void *from, char *to, int offset, 356 int getfrag(void *from, char *to, int offset,
diff --git a/include/linux/string.h b/include/linux/string.h
index dee221429ad0..c61306da8c52 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -13,11 +13,6 @@
13extern "C" { 13extern "C" {
14#endif 14#endif
15 15
16extern char * strpbrk(const char *,const char *);
17extern char * strsep(char **,const char *);
18extern __kernel_size_t strspn(const char *,const char *);
19extern __kernel_size_t strcspn(const char *,const char *);
20
21extern char *strndup_user(const char __user *, long); 16extern char *strndup_user(const char __user *, long);
22 17
23/* 18/*
@@ -70,6 +65,18 @@ extern __kernel_size_t strlen(const char *);
70#ifndef __HAVE_ARCH_STRNLEN 65#ifndef __HAVE_ARCH_STRNLEN
71extern __kernel_size_t strnlen(const char *,__kernel_size_t); 66extern __kernel_size_t strnlen(const char *,__kernel_size_t);
72#endif 67#endif
68#ifndef __HAVE_ARCH_STRPBRK
69extern char * strpbrk(const char *,const char *);
70#endif
71#ifndef __HAVE_ARCH_STRSEP
72extern char * strsep(char **,const char *);
73#endif
74#ifndef __HAVE_ARCH_STRSPN
75extern __kernel_size_t strspn(const char *,const char *);
76#endif
77#ifndef __HAVE_ARCH_STRCSPN
78extern __kernel_size_t strcspn(const char *,const char *);
79#endif
73 80
74#ifndef __HAVE_ARCH_MEMSET 81#ifndef __HAVE_ARCH_MEMSET
75extern void * memset(void *,int,__kernel_size_t); 82extern void * memset(void *,int,__kernel_size_t);
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 8f96e9dc369a..77f78e56c481 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -69,9 +69,21 @@ struct rpc_clnt;
69/* 69/*
70 * EXPORTed functions for managing rpc_iostats structures 70 * EXPORTed functions for managing rpc_iostats structures
71 */ 71 */
72
73#ifdef CONFIG_PROC_FS
74
72struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); 75struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
73void rpc_count_iostats(struct rpc_task *); 76void rpc_count_iostats(struct rpc_task *);
74void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); 77void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
75void rpc_free_iostats(struct rpc_iostats *); 78void rpc_free_iostats(struct rpc_iostats *);
76 79
80#else /* CONFIG_PROC_FS */
81
82static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
83static inline void rpc_count_iostats(struct rpc_task *task) {}
84static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
85static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
86
87#endif /* CONFIG_PROC_FS */
88
77#endif /* _LINUX_SUNRPC_METRICS_H */ 89#endif /* _LINUX_SUNRPC_METRICS_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 50cab2a09f28..503564384545 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -197,15 +197,16 @@ svc_take_res_page(struct svc_rqst *rqstp)
197 return rqstp->rq_respages[rqstp->rq_resused++]; 197 return rqstp->rq_respages[rqstp->rq_resused++];
198} 198}
199 199
200static inline int svc_take_page(struct svc_rqst *rqstp) 200static inline void svc_take_page(struct svc_rqst *rqstp)
201{ 201{
202 if (rqstp->rq_arghi <= rqstp->rq_argused) 202 if (rqstp->rq_arghi <= rqstp->rq_argused) {
203 return -ENOMEM; 203 WARN_ON(1);
204 return;
205 }
204 rqstp->rq_arghi--; 206 rqstp->rq_arghi--;
205 rqstp->rq_respages[rqstp->rq_resused] = 207 rqstp->rq_respages[rqstp->rq_resused] =
206 rqstp->rq_argpages[rqstp->rq_arghi]; 208 rqstp->rq_argpages[rqstp->rq_arghi];
207 rqstp->rq_resused++; 209 rqstp->rq_resused++;
208 return 0;
209} 210}
210 211
211static inline void svc_pushback_allpages(struct svc_rqst *rqstp) 212static inline void svc_pushback_allpages(struct svc_rqst *rqstp)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 7eebbab7160b..e8bbe8118de8 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -53,6 +53,7 @@ struct rpc_timeout {
53 53
54struct rpc_task; 54struct rpc_task;
55struct rpc_xprt; 55struct rpc_xprt;
56struct seq_file;
56 57
57/* 58/*
58 * This describes a complete RPC request 59 * This describes a complete RPC request
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 54eac8a39a4c..5b1fdf1cff4f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -155,6 +155,7 @@ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *
155/* linux/mm/page_alloc.c */ 155/* linux/mm/page_alloc.c */
156extern unsigned long totalram_pages; 156extern unsigned long totalram_pages;
157extern unsigned long totalhigh_pages; 157extern unsigned long totalhigh_pages;
158extern unsigned long totalreserve_pages;
158extern long nr_swap_pages; 159extern long nr_swap_pages;
159extern unsigned int nr_free_pages(void); 160extern unsigned int nr_free_pages(void);
160extern unsigned int nr_free_pages_pgdat(pg_data_t *pgdat); 161extern unsigned int nr_free_pages_pgdat(pg_data_t *pgdat);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 5717147596b6..d3ebc0e68b2b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -569,9 +569,14 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
570 int flags, int mode); 570 int flags, int mode);
571asmlinkage long sys_unshare(unsigned long unshare_flags); 571asmlinkage long sys_unshare(unsigned long unshare_flags);
572asmlinkage long sys_splice(int fdin, int fdout, size_t len, 572
573 unsigned int flags); 573asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
574 int fd_out, loff_t __user *off_out,
575 size_t len, unsigned int flags);
576
577asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
578
574asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 579asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
575 int flags); 580 unsigned int flags);
576 581
577#endif 582#endif
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 392da5a6dacb..1ea5d3cda6ae 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -74,6 +74,7 @@ struct sysfs_dirent {
74 umode_t s_mode; 74 umode_t s_mode;
75 struct dentry * s_dentry; 75 struct dentry * s_dentry;
76 struct iattr * s_iattr; 76 struct iattr * s_iattr;
77 atomic_t s_event;
77}; 78};
78 79
79#define SYSFS_ROOT 0x0001 80#define SYSFS_ROOT 0x0001
@@ -117,6 +118,7 @@ int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
117 118
118int sysfs_create_group(struct kobject *, const struct attribute_group *); 119int sysfs_create_group(struct kobject *, const struct attribute_group *);
119void sysfs_remove_group(struct kobject *, const struct attribute_group *); 120void sysfs_remove_group(struct kobject *, const struct attribute_group *);
121void sysfs_notify(struct kobject * k, char *dir, char *attr);
120 122
121#else /* CONFIG_SYSFS */ 123#else /* CONFIG_SYSFS */
122 124
@@ -185,6 +187,10 @@ static inline void sysfs_remove_group(struct kobject * k, const struct attribute
185 ; 187 ;
186} 188}
187 189
190static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
191{
192}
193
188#endif /* CONFIG_SYSFS */ 194#endif /* CONFIG_SYSFS */
189 195
190#endif /* _SYSFS_H_ */ 196#endif /* _SYSFS_H_ */
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 0976a163b459..31548303ee37 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -6,9 +6,10 @@ extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *c
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); 6extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9void tty_schedule_flip(struct tty_struct *tty);
9 10
10static inline int tty_insert_flip_char(struct tty_struct *tty, 11static inline int tty_insert_flip_char(struct tty_struct *tty,
11 unsigned char ch, char flag) 12 unsigned char ch, char flag)
12{ 13{
13 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->buf.tail;
14 if (tb && tb->active && tb->used < tb->size) { 15 if (tb && tb->active && tb->used < tb->size) {
@@ -19,26 +20,4 @@ static inline int tty_insert_flip_char(struct tty_struct *tty,
19 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 20 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
20} 21}
21 22
22static inline void tty_schedule_flip(struct tty_struct *tty)
23{
24 unsigned long flags;
25 spin_lock_irqsave(&tty->buf.lock, flags);
26 if (tty->buf.tail != NULL) {
27 tty->buf.tail->active = 0;
28 tty->buf.tail->commit = tty->buf.tail->used;
29 }
30 spin_unlock_irqrestore(&tty->buf.lock, flags);
31 schedule_delayed_work(&tty->buf.work, 1);
32}
33
34#undef _INLINE_
35
36
37#endif /* _LINUX_TTY_FLIP_H */ 23#endif /* _LINUX_TTY_FLIP_H */
38
39
40
41
42
43
44
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
new file mode 100644
index 000000000000..c602f884f182
--- /dev/null
+++ b/include/linux/usb/net2280.h
@@ -0,0 +1,444 @@
1/*
2 * NetChip 2280 high/full speed USB device controller.
3 * Unlike many such controllers, this one talks PCI.
4 */
5#ifndef __LINUX_USB_NET2280_H
6#define __LINUX_USB_NET2280_H
7
8/*
9 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
10 * Copyright (C) 2003 David Brownell
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27/*-------------------------------------------------------------------------*/
28
29/* NET2280 MEMORY MAPPED REGISTERS
30 *
31 * The register layout came from the chip documentation, and the bit
32 * number definitions were extracted from chip specification.
33 *
34 * Use the shift operator ('<<') to build bit masks, with readl/writel
35 * to access the registers through PCI.
36 */
37
38/* main registers, BAR0 + 0x0000 */
39struct net2280_regs {
40 // offset 0x0000
41 u32 devinit;
42#define LOCAL_CLOCK_FREQUENCY 8
43#define FORCE_PCI_RESET 7
44#define PCI_ID 6
45#define PCI_ENABLE 5
46#define FIFO_SOFT_RESET 4
47#define CFG_SOFT_RESET 3
48#define PCI_SOFT_RESET 2
49#define USB_SOFT_RESET 1
50#define M8051_RESET 0
51 u32 eectl;
52#define EEPROM_ADDRESS_WIDTH 23
53#define EEPROM_CHIP_SELECT_ACTIVE 22
54#define EEPROM_PRESENT 21
55#define EEPROM_VALID 20
56#define EEPROM_BUSY 19
57#define EEPROM_CHIP_SELECT_ENABLE 18
58#define EEPROM_BYTE_READ_START 17
59#define EEPROM_BYTE_WRITE_START 16
60#define EEPROM_READ_DATA 8
61#define EEPROM_WRITE_DATA 0
62 u32 eeclkfreq;
63 u32 _unused0;
64 // offset 0x0010
65
66 u32 pciirqenb0; /* interrupt PCI master ... */
67#define SETUP_PACKET_INTERRUPT_ENABLE 7
68#define ENDPOINT_F_INTERRUPT_ENABLE 6
69#define ENDPOINT_E_INTERRUPT_ENABLE 5
70#define ENDPOINT_D_INTERRUPT_ENABLE 4
71#define ENDPOINT_C_INTERRUPT_ENABLE 3
72#define ENDPOINT_B_INTERRUPT_ENABLE 2
73#define ENDPOINT_A_INTERRUPT_ENABLE 1
74#define ENDPOINT_0_INTERRUPT_ENABLE 0
75 u32 pciirqenb1;
76#define PCI_INTERRUPT_ENABLE 31
77#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
78#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
79#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
80#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
81#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
82#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18
83#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
84#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
85#define GPIO_INTERRUPT_ENABLE 13
86#define DMA_D_INTERRUPT_ENABLE 12
87#define DMA_C_INTERRUPT_ENABLE 11
88#define DMA_B_INTERRUPT_ENABLE 10
89#define DMA_A_INTERRUPT_ENABLE 9
90#define EEPROM_DONE_INTERRUPT_ENABLE 8
91#define VBUS_INTERRUPT_ENABLE 7
92#define CONTROL_STATUS_INTERRUPT_ENABLE 6
93#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
94#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
95#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
96#define RESUME_INTERRUPT_ENABLE 1
97#define SOF_INTERRUPT_ENABLE 0
98 u32 cpu_irqenb0; /* ... or onboard 8051 */
99#define SETUP_PACKET_INTERRUPT_ENABLE 7
100#define ENDPOINT_F_INTERRUPT_ENABLE 6
101#define ENDPOINT_E_INTERRUPT_ENABLE 5
102#define ENDPOINT_D_INTERRUPT_ENABLE 4
103#define ENDPOINT_C_INTERRUPT_ENABLE 3
104#define ENDPOINT_B_INTERRUPT_ENABLE 2
105#define ENDPOINT_A_INTERRUPT_ENABLE 1
106#define ENDPOINT_0_INTERRUPT_ENABLE 0
107 u32 cpu_irqenb1;
108#define CPU_INTERRUPT_ENABLE 31
109#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
110#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
111#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
112#define PCI_INTA_INTERRUPT_ENABLE 24
113#define PCI_PME_INTERRUPT_ENABLE 23
114#define PCI_SERR_INTERRUPT_ENABLE 22
115#define PCI_PERR_INTERRUPT_ENABLE 21
116#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
117#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
118#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
119#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
120#define GPIO_INTERRUPT_ENABLE 13
121#define DMA_D_INTERRUPT_ENABLE 12
122#define DMA_C_INTERRUPT_ENABLE 11
123#define DMA_B_INTERRUPT_ENABLE 10
124#define DMA_A_INTERRUPT_ENABLE 9
125#define EEPROM_DONE_INTERRUPT_ENABLE 8
126#define VBUS_INTERRUPT_ENABLE 7
127#define CONTROL_STATUS_INTERRUPT_ENABLE 6
128#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
129#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
130#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
131#define RESUME_INTERRUPT_ENABLE 1
132#define SOF_INTERRUPT_ENABLE 0
133
134 // offset 0x0020
135 u32 _unused1;
136 u32 usbirqenb1;
137#define USB_INTERRUPT_ENABLE 31
138#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
139#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
140#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
141#define PCI_INTA_INTERRUPT_ENABLE 24
142#define PCI_PME_INTERRUPT_ENABLE 23
143#define PCI_SERR_INTERRUPT_ENABLE 22
144#define PCI_PERR_INTERRUPT_ENABLE 21
145#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
146#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
147#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
148#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
149#define GPIO_INTERRUPT_ENABLE 13
150#define DMA_D_INTERRUPT_ENABLE 12
151#define DMA_C_INTERRUPT_ENABLE 11
152#define DMA_B_INTERRUPT_ENABLE 10
153#define DMA_A_INTERRUPT_ENABLE 9
154#define EEPROM_DONE_INTERRUPT_ENABLE 8
155#define VBUS_INTERRUPT_ENABLE 7
156#define CONTROL_STATUS_INTERRUPT_ENABLE 6
157#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
158#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
159#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
160#define RESUME_INTERRUPT_ENABLE 1
161#define SOF_INTERRUPT_ENABLE 0
162 u32 irqstat0;
163#define INTA_ASSERTED 12
164#define SETUP_PACKET_INTERRUPT 7
165#define ENDPOINT_F_INTERRUPT 6
166#define ENDPOINT_E_INTERRUPT 5
167#define ENDPOINT_D_INTERRUPT 4
168#define ENDPOINT_C_INTERRUPT 3
169#define ENDPOINT_B_INTERRUPT 2
170#define ENDPOINT_A_INTERRUPT 1
171#define ENDPOINT_0_INTERRUPT 0
172 u32 irqstat1;
173#define POWER_STATE_CHANGE_INTERRUPT 27
174#define PCI_ARBITER_TIMEOUT_INTERRUPT 26
175#define PCI_PARITY_ERROR_INTERRUPT 25
176#define PCI_INTA_INTERRUPT 24
177#define PCI_PME_INTERRUPT 23
178#define PCI_SERR_INTERRUPT 22
179#define PCI_PERR_INTERRUPT 21
180#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20
181#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19
182#define PCI_RETRY_ABORT_INTERRUPT 17
183#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16
184#define SOF_DOWN_INTERRUPT 14
185#define GPIO_INTERRUPT 13
186#define DMA_D_INTERRUPT 12
187#define DMA_C_INTERRUPT 11
188#define DMA_B_INTERRUPT 10
189#define DMA_A_INTERRUPT 9
190#define EEPROM_DONE_INTERRUPT 8
191#define VBUS_INTERRUPT 7
192#define CONTROL_STATUS_INTERRUPT 6
193#define ROOT_PORT_RESET_INTERRUPT 4
194#define SUSPEND_REQUEST_INTERRUPT 3
195#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
196#define RESUME_INTERRUPT 1
197#define SOF_INTERRUPT 0
198 // offset 0x0030
199 u32 idxaddr;
200 u32 idxdata;
201 u32 fifoctl;
202#define PCI_BASE2_RANGE 16
203#define IGNORE_FIFO_AVAILABILITY 3
204#define PCI_BASE2_SELECT 2
205#define FIFO_CONFIGURATION_SELECT 0
206 u32 _unused2;
207 // offset 0x0040
208 u32 memaddr;
209#define START 28
210#define DIRECTION 27
211#define FIFO_DIAGNOSTIC_SELECT 24
212#define MEMORY_ADDRESS 0
213 u32 memdata0;
214 u32 memdata1;
215 u32 _unused3;
216 // offset 0x0050
217 u32 gpioctl;
218#define GPIO3_LED_SELECT 12
219#define GPIO3_INTERRUPT_ENABLE 11
220#define GPIO2_INTERRUPT_ENABLE 10
221#define GPIO1_INTERRUPT_ENABLE 9
222#define GPIO0_INTERRUPT_ENABLE 8
223#define GPIO3_OUTPUT_ENABLE 7
224#define GPIO2_OUTPUT_ENABLE 6
225#define GPIO1_OUTPUT_ENABLE 5
226#define GPIO0_OUTPUT_ENABLE 4
227#define GPIO3_DATA 3
228#define GPIO2_DATA 2
229#define GPIO1_DATA 1
230#define GPIO0_DATA 0
231 u32 gpiostat;
232#define GPIO3_INTERRUPT 3
233#define GPIO2_INTERRUPT 2
234#define GPIO1_INTERRUPT 1
235#define GPIO0_INTERRUPT 0
236} __attribute__ ((packed));
237
238/* usb control, BAR0 + 0x0080 */
239struct net2280_usb_regs {
240 // offset 0x0080
241 u32 stdrsp;
242#define STALL_UNSUPPORTED_REQUESTS 31
243#define SET_TEST_MODE 16
244#define GET_OTHER_SPEED_CONFIGURATION 15
245#define GET_DEVICE_QUALIFIER 14
246#define SET_ADDRESS 13
247#define ENDPOINT_SET_CLEAR_HALT 12
248#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11
249#define GET_STRING_DESCRIPTOR_2 10
250#define GET_STRING_DESCRIPTOR_1 9
251#define GET_STRING_DESCRIPTOR_0 8
252#define GET_SET_INTERFACE 6
253#define GET_SET_CONFIGURATION 5
254#define GET_CONFIGURATION_DESCRIPTOR 4
255#define GET_DEVICE_DESCRIPTOR 3
256#define GET_ENDPOINT_STATUS 2
257#define GET_INTERFACE_STATUS 1
258#define GET_DEVICE_STATUS 0
259 u32 prodvendid;
260#define PRODUCT_ID 16
261#define VENDOR_ID 0
262 u32 relnum;
263 u32 usbctl;
264#define SERIAL_NUMBER_INDEX 16
265#define PRODUCT_ID_STRING_ENABLE 13
266#define VENDOR_ID_STRING_ENABLE 12
267#define USB_ROOT_PORT_WAKEUP_ENABLE 11
268#define VBUS_PIN 10
269#define TIMED_DISCONNECT 9
270#define SUSPEND_IMMEDIATELY 7
271#define SELF_POWERED_USB_DEVICE 6
272#define REMOTE_WAKEUP_SUPPORT 5
273#define PME_POLARITY 4
274#define USB_DETECT_ENABLE 3
275#define PME_WAKEUP_ENABLE 2
276#define DEVICE_REMOTE_WAKEUP_ENABLE 1
277#define SELF_POWERED_STATUS 0
278 // offset 0x0090
279 u32 usbstat;
280#define HIGH_SPEED 7
281#define FULL_SPEED 6
282#define GENERATE_RESUME 5
283#define GENERATE_DEVICE_REMOTE_WAKEUP 4
284 u32 xcvrdiag;
285#define FORCE_HIGH_SPEED_MODE 31
286#define FORCE_FULL_SPEED_MODE 30
287#define USB_TEST_MODE 24
288#define LINE_STATE 16
289#define TRANSCEIVER_OPERATION_MODE 2
290#define TRANSCEIVER_SELECT 1
291#define TERMINATION_SELECT 0
292 u32 setup0123;
293 u32 setup4567;
294 // offset 0x0090
295 u32 _unused0;
296 u32 ouraddr;
297#define FORCE_IMMEDIATE 7
298#define OUR_USB_ADDRESS 0
299 u32 ourconfig;
300} __attribute__ ((packed));
301
302/* pci control, BAR0 + 0x0100 */
303struct net2280_pci_regs {
304 // offset 0x0100
305 u32 pcimstctl;
306#define PCI_ARBITER_PARK_SELECT 13
307#define PCI_MULTI LEVEL_ARBITER 12
308#define PCI_RETRY_ABORT_ENABLE 11
309#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10
310#define DMA_READ_MULTIPLE_ENABLE 9
311#define DMA_READ_LINE_ENABLE 8
312#define PCI_MASTER_COMMAND_SELECT 6
313#define MEM_READ_OR_WRITE 0
314#define IO_READ_OR_WRITE 1
315#define CFG_READ_OR_WRITE 2
316#define PCI_MASTER_START 5
317#define PCI_MASTER_READ_WRITE 4
318#define PCI_MASTER_WRITE 0
319#define PCI_MASTER_READ 1
320#define PCI_MASTER_BYTE_WRITE_ENABLES 0
321 u32 pcimstaddr;
322 u32 pcimstdata;
323 u32 pcimststat;
324#define PCI_ARBITER_CLEAR 2
325#define PCI_EXTERNAL_ARBITER 1
326#define PCI_HOST_MODE 0
327} __attribute__ ((packed));
328
329/* dma control, BAR0 + 0x0180 ... array of four structs like this,
330 * for channels 0..3. see also struct net2280_dma: descriptor
331 * that can be loaded into some of these registers.
332 */
333struct net2280_dma_regs { /* [11.7] */
334 // offset 0x0180, 0x01a0, 0x01c0, 0x01e0,
335 u32 dmactl;
336#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
337#define DMA_CLEAR_COUNT_ENABLE 21
338#define DESCRIPTOR_POLLING_RATE 19
339#define POLL_CONTINUOUS 0
340#define POLL_1_USEC 1
341#define POLL_100_USEC 2
342#define POLL_1_MSEC 3
343#define DMA_VALID_BIT_POLLING_ENABLE 18
344#define DMA_VALID_BIT_ENABLE 17
345#define DMA_SCATTER_GATHER_ENABLE 16
346#define DMA_OUT_AUTO_START_ENABLE 4
347#define DMA_PREEMPT_ENABLE 3
348#define DMA_FIFO_VALIDATE 2
349#define DMA_ENABLE 1
350#define DMA_ADDRESS_HOLD 0
351 u32 dmastat;
352#define DMA_ABORT_DONE_INTERRUPT 27
353#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25
354#define DMA_TRANSACTION_DONE_INTERRUPT 24
355#define DMA_ABORT 1
356#define DMA_START 0
357 u32 _unused0 [2];
358 // offset 0x0190, 0x01b0, 0x01d0, 0x01f0,
359 u32 dmacount;
360#define VALID_BIT 31
361#define DMA_DIRECTION 30
362#define DMA_DONE_INTERRUPT_ENABLE 29
363#define END_OF_CHAIN 28
364#define DMA_BYTE_COUNT_MASK ((1<<24)-1)
365#define DMA_BYTE_COUNT 0
366 u32 dmaaddr;
367 u32 dmadesc;
368 u32 _unused1;
369} __attribute__ ((packed));
370
371/* dedicated endpoint registers, BAR0 + 0x0200 */
372
373struct net2280_dep_regs { /* [11.8] */
374 // offset 0x0200, 0x0210, 0x220, 0x230, 0x240
375 u32 dep_cfg;
376 // offset 0x0204, 0x0214, 0x224, 0x234, 0x244
377 u32 dep_rsp;
378 u32 _unused [2];
379} __attribute__ ((packed));
380
381/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
382 * like this, for ep0 then the configurable endpoints A..F
383 * ep0 reserved for control; E and F have only 64 bytes of fifo
384 */
385struct net2280_ep_regs { /* [11.9] */
386 // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0
387 u32 ep_cfg;
388#define ENDPOINT_BYTE_COUNT 16
389#define ENDPOINT_ENABLE 10
390#define ENDPOINT_TYPE 8
391#define ENDPOINT_DIRECTION 7
392#define ENDPOINT_NUMBER 0
393 u32 ep_rsp;
394#define SET_NAK_OUT_PACKETS 15
395#define SET_EP_HIDE_STATUS_PHASE 14
396#define SET_EP_FORCE_CRC_ERROR 13
397#define SET_INTERRUPT_MODE 12
398#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11
399#define SET_NAK_OUT_PACKETS_MODE 10
400#define SET_ENDPOINT_TOGGLE 9
401#define SET_ENDPOINT_HALT 8
402#define CLEAR_NAK_OUT_PACKETS 7
403#define CLEAR_EP_HIDE_STATUS_PHASE 6
404#define CLEAR_EP_FORCE_CRC_ERROR 5
405#define CLEAR_INTERRUPT_MODE 4
406#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3
407#define CLEAR_NAK_OUT_PACKETS_MODE 2
408#define CLEAR_ENDPOINT_TOGGLE 1
409#define CLEAR_ENDPOINT_HALT 0
410 u32 ep_irqenb;
411#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6
412#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5
413#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3
414#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2
415#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1
416#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0
417 u32 ep_stat;
418#define FIFO_VALID_COUNT 24
419#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22
420#define TIMEOUT 21
421#define USB_STALL_SENT 20
422#define USB_IN_NAK_SENT 19
423#define USB_IN_ACK_RCVD 18
424#define USB_OUT_PING_NAK_SENT 17
425#define USB_OUT_ACK_SENT 16
426#define FIFO_OVERFLOW 13
427#define FIFO_UNDERFLOW 12
428#define FIFO_FULL 11
429#define FIFO_EMPTY 10
430#define FIFO_FLUSH 9
431#define SHORT_PACKET_OUT_DONE_INTERRUPT 6
432#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5
433#define NAK_OUT_PACKETS 4
434#define DATA_PACKET_RECEIVED_INTERRUPT 3
435#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
436#define DATA_OUT_PING_TOKEN_INTERRUPT 1
437#define DATA_IN_TOKEN_INTERRUPT 0
438 // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0
439 u32 ep_avail;
440 u32 ep_data;
441 u32 _unused0 [2];
442} __attribute__ ((packed));
443
444#endif /* __LINUX_USB_NET2280_H */
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index fadc535e2925..dc7c621e4647 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -12,6 +12,11 @@
12#else 12#else
13#define MODULE_VERMAGIC_PREEMPT "" 13#define MODULE_VERMAGIC_PREEMPT ""
14#endif 14#endif
15#ifdef CONFIG_MODULE_UNLOAD
16#define MODULE_VERMAGIC_MODULE_UNLOAD "mod_unload "
17#else
18#define MODULE_VERMAGIC_MODULE_UNLOAD ""
19#endif
15#ifndef MODULE_ARCH_VERMAGIC 20#ifndef MODULE_ARCH_VERMAGIC
16#define MODULE_ARCH_VERMAGIC "" 21#define MODULE_ARCH_VERMAGIC ""
17#endif 22#endif
@@ -19,5 +24,5 @@
19#define VERMAGIC_STRING \ 24#define VERMAGIC_STRING \
20 UTS_RELEASE " " \ 25 UTS_RELEASE " " \
21 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
22 MODULE_ARCH_VERMAGIC \ 27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \
23 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 28 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h
deleted file mode 100644
index dae9860091dd..000000000000
--- a/include/linux/wanpipe.h
+++ /dev/null
@@ -1,483 +0,0 @@
1/*****************************************************************************
2* wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver.
3* User-level API definitions.
4*
5* Author: Nenad Corbic <ncorbic@sangoma.com>
6* Gideon Hack
7*
8* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
9*
10* This program is free software; you can redistribute it and/or
11* modify it under the terms of the GNU General Public License
12* as published by the Free Software Foundation; either version
13* 2 of the License, or (at your option) any later version.
14* ============================================================================
15* Nov 3, 2000 Nenad Corbic Added config_id to sdla_t structure.
16* Used to determine the protocol running.
17* Jul 13, 2000 Nenad Corbic Added SyncPPP Support
18* Feb 24, 2000 Nenad Corbic Added support for x25api driver
19* Oct 04, 1999 Nenad Corbic New CHDLC and FRAME RELAY code, SMP support
20* Jun 02, 1999 Gideon Hack Added 'update_call_count' for Cisco HDLC
21* support
22* Jun 26, 1998 David Fong Added 'ip_mode' in sdla_t.u.p for dynamic IP
23* routing mode configuration
24* Jun 12, 1998 David Fong Added Cisco HDLC union member in sdla_t
25* Dec 08, 1997 Jaspreet Singh Added 'authenticator' in union of 'sdla_t'
26* Nov 26, 1997 Jaspreet Singh Added 'load_sharing' structure. Also added
27* 'devs_struct','dev_to_devtint_next' to 'sdla_t'
28* Nov 24, 1997 Jaspreet Singh Added 'irq_dis_if_send_count',
29* 'irq_dis_poll_count' to 'sdla_t'.
30* Nov 06, 1997 Jaspreet Singh Added a define called 'INTR_TEST_MODE'
31* Oct 20, 1997 Jaspreet Singh Added 'buff_intr_mode_unbusy' and
32* 'dlci_intr_mode_unbusy' to 'sdla_t'
33* Oct 18, 1997 Jaspreet Singh Added structure to maintain global driver
34* statistics.
35* Jan 15, 1997 Gene Kozin Version 3.1.0
36* o added UDP management stuff
37* Jan 02, 1997 Gene Kozin Version 3.0.0
38*****************************************************************************/
39#ifndef _WANPIPE_H
40#define _WANPIPE_H
41
42#include <linux/wanrouter.h>
43
44/* Defines */
45
46#ifndef PACKED
47#define PACKED __attribute__((packed))
48#endif
49
50#define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */
51
52/* IOCTL numbers (up to 16) */
53#define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */
54#define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */
55
56#define TRACE_ALL 0x00
57#define TRACE_PROT 0x01
58#define TRACE_DATA 0x02
59
60/* values for request/reply byte */
61#define UDPMGMT_REQUEST 0x01
62#define UDPMGMT_REPLY 0x02
63#define UDP_OFFSET 12
64
65#define MAX_CMD_BUFF 10
66#define MAX_X25_LCN 255 /* Maximum number of x25 channels */
67#define MAX_LCN_NUM 4095 /* Maximum lcn number */
68#define MAX_FT1_RETRY 100
69
70#ifndef AF_WANPIPE
71 #define AF_WANPIPE 25
72 #ifndef PF_WANPIPE
73 #define PF_WANPIPE AF_WANPIPE
74 #endif
75#endif
76
77
78#define TX_TIMEOUT 5*HZ
79
80/* General Critical Flags */
81#define SEND_CRIT 0x00
82#define PERI_CRIT 0x01
83
84/* Chdlc and PPP polling critical flag */
85#define POLL_CRIT 0x03
86
87/* Frame Relay Tx IRQ send critical flag */
88#define SEND_TXIRQ_CRIT 0x02
89
90/* Frame Relay ARP critical flag */
91#define ARP_CRIT 0x03
92
93/* Bit maps for dynamic interface configuration
94 * DYN_OPT_ON : turns this option on/off
95 * DEV_DOWN : device was shutdown by the driver not
96 * by user
97 */
98#define DYN_OPT_ON 0x00
99#define DEV_DOWN 0x01
100
101/*
102 * Data structures for IOCTL calls.
103 */
104
105typedef struct sdla_dump /* WANPIPE_DUMP */
106{
107 unsigned long magic; /* for verification */
108 unsigned long offset; /* absolute adapter memory address */
109 unsigned long length; /* block length */
110 void* ptr; /* -> buffer */
111} sdla_dump_t;
112
113typedef struct sdla_exec /* WANPIPE_EXEC */
114{
115 unsigned long magic; /* for verification */
116 void* cmd; /* -> command structure */
117 void* data; /* -> data buffer */
118} sdla_exec_t;
119
120/* UDP management stuff */
121
122typedef struct wum_header
123{
124 unsigned char signature[8]; /* 00h: signature */
125 unsigned char type; /* 08h: request/reply */
126 unsigned char command; /* 09h: commnand */
127 unsigned char reserved[6]; /* 0Ah: reserved */
128} wum_header_t;
129
130/*************************************************************************
131 Data Structure for global statistics
132*************************************************************************/
133
134typedef struct global_stats
135{
136 unsigned long isr_entry;
137 unsigned long isr_already_critical;
138 unsigned long isr_rx;
139 unsigned long isr_tx;
140 unsigned long isr_intr_test;
141 unsigned long isr_spurious;
142 unsigned long isr_enable_tx_int;
143 unsigned long rx_intr_corrupt_rx_bfr;
144 unsigned long rx_intr_on_orphaned_DLCI;
145 unsigned long rx_intr_dev_not_started;
146 unsigned long tx_intr_dev_not_started;
147 unsigned long poll_entry;
148 unsigned long poll_already_critical;
149 unsigned long poll_processed;
150 unsigned long poll_tbusy_bad_status;
151 unsigned long poll_host_disable_irq;
152 unsigned long poll_host_enable_irq;
153
154} global_stats_t;
155
156
157typedef struct{
158 unsigned short udp_src_port PACKED;
159 unsigned short udp_dst_port PACKED;
160 unsigned short udp_length PACKED;
161 unsigned short udp_checksum PACKED;
162} udp_pkt_t;
163
164
165typedef struct {
166 unsigned char ver_inet_hdr_length PACKED;
167 unsigned char service_type PACKED;
168 unsigned short total_length PACKED;
169 unsigned short identifier PACKED;
170 unsigned short flags_frag_offset PACKED;
171 unsigned char ttl PACKED;
172 unsigned char protocol PACKED;
173 unsigned short hdr_checksum PACKED;
174 unsigned long ip_src_address PACKED;
175 unsigned long ip_dst_address PACKED;
176} ip_pkt_t;
177
178
179typedef struct {
180 unsigned char signature[8] PACKED;
181 unsigned char request_reply PACKED;
182 unsigned char id PACKED;
183 unsigned char reserved[6] PACKED;
184} wp_mgmt_t;
185
186/*************************************************************************
187 Data Structure for if_send statistics
188*************************************************************************/
189typedef struct if_send_stat{
190 unsigned long if_send_entry;
191 unsigned long if_send_skb_null;
192 unsigned long if_send_broadcast;
193 unsigned long if_send_multicast;
194 unsigned long if_send_critical_ISR;
195 unsigned long if_send_critical_non_ISR;
196 unsigned long if_send_tbusy;
197 unsigned long if_send_tbusy_timeout;
198 unsigned long if_send_PIPE_request;
199 unsigned long if_send_wan_disconnected;
200 unsigned long if_send_dlci_disconnected;
201 unsigned long if_send_no_bfrs;
202 unsigned long if_send_adptr_bfrs_full;
203 unsigned long if_send_bfr_passed_to_adptr;
204 unsigned long if_send_protocol_error;
205 unsigned long if_send_bfr_not_passed_to_adptr;
206 unsigned long if_send_tx_int_enabled;
207 unsigned long if_send_consec_send_fail;
208} if_send_stat_t;
209
210typedef struct rx_intr_stat{
211 unsigned long rx_intr_no_socket;
212 unsigned long rx_intr_dev_not_started;
213 unsigned long rx_intr_PIPE_request;
214 unsigned long rx_intr_bfr_not_passed_to_stack;
215 unsigned long rx_intr_bfr_passed_to_stack;
216} rx_intr_stat_t;
217
218typedef struct pipe_mgmt_stat{
219 unsigned long UDP_PIPE_mgmt_kmalloc_err;
220 unsigned long UDP_PIPE_mgmt_direction_err;
221 unsigned long UDP_PIPE_mgmt_adptr_type_err;
222 unsigned long UDP_PIPE_mgmt_adptr_cmnd_OK;
223 unsigned long UDP_PIPE_mgmt_adptr_cmnd_timeout;
224 unsigned long UDP_PIPE_mgmt_adptr_send_passed;
225 unsigned long UDP_PIPE_mgmt_adptr_send_failed;
226 unsigned long UDP_PIPE_mgmt_not_passed_to_stack;
227 unsigned long UDP_PIPE_mgmt_passed_to_stack;
228 unsigned long UDP_PIPE_mgmt_no_socket;
229 unsigned long UDP_PIPE_mgmt_passed_to_adptr;
230} pipe_mgmt_stat_t;
231
232
233typedef struct {
234 struct sk_buff *skb;
235} bh_data_t, cmd_data_t;
236
237#define MAX_LGTH_UDP_MGNT_PKT 2000
238
239
240/* This is used for interrupt testing */
241#define INTR_TEST_MODE 0x02
242
243#define WUM_SIGNATURE_L 0x50495046
244#define WUM_SIGNATURE_H 0x444E3845
245
246#define WUM_KILL 0x50
247#define WUM_EXEC 0x51
248
249#define WANPIPE 0x00
250#define API 0x01
251#define BRIDGE 0x02
252#define BRIDGE_NODE 0x03
253
254#ifdef __KERNEL__
255/****** Kernel Interface ****************************************************/
256
257#include <linux/sdladrv.h> /* SDLA support module API definitions */
258#include <linux/sdlasfm.h> /* SDLA firmware module definitions */
259#include <linux/workqueue.h>
260#include <linux/serial.h>
261#include <linux/serialP.h>
262#include <linux/serial_reg.h>
263#include <asm/serial.h>
264#include <linux/tty.h>
265#include <linux/tty_driver.h>
266#include <linux/tty_flip.h>
267
268/****** Data Structures *****************************************************/
269
270/* Adapter Data Space.
271 * This structure is needed because we handle multiple cards, otherwise
272 * static data would do it.
273 */
274typedef struct sdla
275{
276 char devname[WAN_DRVNAME_SZ+1]; /* card name */
277 sdlahw_t hw; /* hardware configuration */
278 struct wan_device wandev; /* WAN device data space */
279
280 unsigned open_cnt; /* number of open interfaces */
281 unsigned long state_tick; /* link state timestamp */
282 unsigned intr_mode; /* Type of Interrupt Mode */
283 char in_isr; /* interrupt-in-service flag */
284 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
285 char dlci_int_mode_unbusy; /* flag for carrying out dev_tint */
286 long configured; /* flag for previous configurations */
287
288 unsigned short irq_dis_if_send_count; /* Disabling irqs in if_send*/
289 unsigned short irq_dis_poll_count; /* Disabling irqs in poll routine*/
290 unsigned short force_enable_irq;
291 char TracingEnabled; /* flag for enabling trace */
292 global_stats_t statistics; /* global statistics */
293 void* mbox; /* -> mailbox */
294 void* rxmb; /* -> receive mailbox */
295 void* flags; /* -> adapter status flags */
296 void (*isr)(struct sdla* card); /* interrupt service routine */
297 void (*poll)(struct sdla* card); /* polling routine */
298 int (*exec)(struct sdla* card, void* u_cmd, void* u_data);
299 /* Used by the listen() system call */
300 /* Wanpipe Socket Interface */
301 int (*func) (struct sk_buff *, struct sock *);
302 struct sock *sk;
303
304 /* Shutdown function */
305 void (*disable_comm) (struct sdla *card);
306
307 /* Secondary Port Device: Piggibacking */
308 struct sdla *next;
309
310 /* TTY driver variables */
311 unsigned char tty_opt;
312 struct tty_struct *tty;
313 unsigned int tty_minor;
314 unsigned int tty_open;
315 unsigned char *tty_buf;
316 unsigned char *tty_rx;
317 struct work_struct tty_work;
318
319 union
320 {
321 struct
322 { /****** X.25 specific data **********/
323 u32 lo_pvc;
324 u32 hi_pvc;
325 u32 lo_svc;
326 u32 hi_svc;
327 struct net_device *svc_to_dev_map[MAX_X25_LCN];
328 struct net_device *pvc_to_dev_map[MAX_X25_LCN];
329 struct net_device *tx_dev;
330 struct net_device *cmd_dev;
331 u32 no_dev;
332 volatile u8 *hdlc_buf_status;
333 u32 tx_interrupts_pending;
334 u16 timer_int_enabled;
335 struct net_device *poll_device;
336 atomic_t command_busy;
337
338 u16 udp_pkt_lgth;
339 u32 udp_type;
340 u8 udp_pkt_src;
341 u32 udp_lcn;
342 struct net_device *udp_dev;
343 s8 udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
344
345 u8 LAPB_hdlc; /* Option to turn off X25 and run only LAPB */
346 u8 logging; /* Option to log call messages */
347 u8 oob_on_modem; /* Option to send modem status to the api */
348 u16 num_of_ch; /* Number of channels configured by the user */
349
350 struct work_struct x25_poll_work;
351 struct timer_list x25_timer;
352 } x;
353 struct
354 { /****** frame relay specific data ***/
355 void* rxmb_base; /* -> first Rx buffer */
356 void* rxmb_last; /* -> last Rx buffer */
357 unsigned rx_base; /* S508 receive buffer base */
358 unsigned rx_top; /* S508 receive buffer end */
359 unsigned short node_dlci[100];
360 unsigned short dlci_num;
361 struct net_device *dlci_to_dev_map[991 + 1];
362 unsigned tx_interrupts_pending;
363 unsigned short timer_int_enabled;
364 unsigned short udp_pkt_lgth;
365 int udp_type;
366 char udp_pkt_src;
367 unsigned udp_dlci;
368 char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
369 void* trc_el_base; /* first trace element */
370 void* trc_el_last; /* last trace element */
371 void *curr_trc_el; /* current trace element */
372 unsigned short trc_bfr_space; /* trace buffer space */
373 unsigned char update_comms_stats;
374 struct net_device *arp_dev;
375 spinlock_t if_send_lock;
376 } f;
377 struct /****** PPP-specific data ***********/
378 {
379 char if_name[WAN_IFNAME_SZ+1]; /* interface name */
380 void* txbuf; /* -> current Tx buffer */
381 void* txbuf_base; /* -> first Tx buffer */
382 void* txbuf_last; /* -> last Tx buffer */
383 void* rxbuf_base; /* -> first Rx buffer */
384 void* rxbuf_last; /* -> last Rx buffer */
385 unsigned rx_base; /* S508 receive buffer base */
386 unsigned rx_top; /* S508 receive buffer end */
387 char ip_mode; /* STATIC/HOST/PEER IP Mode */
388 char authenticator; /* Authenticator for PAP/CHAP */
389 unsigned char comm_enabled; /* Is comm enabled or not */
390 unsigned char peer_route; /* Process Peer Route */
391 unsigned long *txbuf_next; /* Next Tx buffer to use */
392 unsigned long *rxbuf_next; /* Next Rx buffer to use */
393 } p;
394 struct /* Cisco HDLC-specific data */
395 {
396 char if_name[WAN_IFNAME_SZ+1]; /* interface name */
397 unsigned char comm_port;/* Communication Port O or 1 */
398 unsigned char usedby; /* Used by WANPIPE or API */
399 void* rxmb; /* Receive mail box */
400 void* flags; /* flags */
401 void* tx_status; /* Tx status element */
402 void* rx_status; /* Rx status element */
403 void* txbuf; /* -> current Tx buffer */
404 void* txbuf_base; /* -> first Tx buffer */
405 void* txbuf_last; /* -> last Tx buffer */
406 void* rxbuf_base; /* -> first Rx buffer */
407 void* rxbuf_last; /* -> last Rx buffer */
408 unsigned rx_base; /* S508 receive buffer base */
409 unsigned rx_top; /* S508 receive buffer end */
410 unsigned char receive_only; /* high speed receivers */
411 unsigned short protocol_options;
412 unsigned short kpalv_tx; /* Tx kpalv timer */
413 unsigned short kpalv_rx; /* Rx kpalv timer */
414 unsigned short kpalv_err; /* Error tolerance */
415 unsigned short slarp_timer; /* SLARP req timer */
416 unsigned state; /* state of the link */
417 unsigned char api_status;
418 unsigned char update_call_count;
419 unsigned short api_options; /* for async config */
420 unsigned char async_mode;
421 unsigned short tx_bits_per_char;
422 unsigned short rx_bits_per_char;
423 unsigned short stop_bits;
424 unsigned short parity;
425 unsigned short break_timer;
426 unsigned short inter_char_timer;
427 unsigned short rx_complete_length;
428 unsigned short xon_char;
429 unsigned short xoff_char;
430 unsigned char comm_enabled; /* Is comm enabled or not */
431 unsigned char backup;
432 } c;
433 struct
434 {
435 void* tx_status; /* Tx status element */
436 void* rx_status; /* Rx status element */
437 void* trace_status; /* Trace status element */
438 void* txbuf; /* -> current Tx buffer */
439 void* txbuf_base; /* -> first Tx buffer */
440 void* txbuf_last; /* -> last Tx buffer */
441 void* rxbuf_base; /* -> first Rx buffer */
442 void* rxbuf_last; /* -> last Rx buffer */
443 void* tracebuf; /* -> current Trace buffer */
444 void* tracebuf_base; /* -> current Trace buffer */
445 void* tracebuf_last; /* -> current Trace buffer */
446 unsigned rx_base; /* receive buffer base */
447 unsigned rx_end; /* receive buffer end */
448 unsigned trace_base; /* trace buffer base */
449 unsigned trace_end; /* trace buffer end */
450
451 } h;
452 } u;
453} sdla_t;
454
455/****** Public Functions ****************************************************/
456
457void wanpipe_open (sdla_t* card); /* wpmain.c */
458void wanpipe_close (sdla_t* card); /* wpmain.c */
459void wanpipe_set_state (sdla_t* card, int state); /* wpmain.c */
460
461int wpx_init (sdla_t* card, wandev_conf_t* conf); /* wpx.c */
462int wpf_init (sdla_t* card, wandev_conf_t* conf); /* wpf.c */
463int wpp_init (sdla_t* card, wandev_conf_t* conf); /* wpp.c */
464int wpc_init (sdla_t* card, wandev_conf_t* conf); /* Cisco HDLC */
465int bsc_init (sdla_t* card, wandev_conf_t* conf); /* BSC streaming */
466int hdlc_init(sdla_t* card, wandev_conf_t* conf); /* HDLC support */
467int wpft1_init (sdla_t* card, wandev_conf_t* conf); /* FT1 Config support */
468int wsppp_init (sdla_t* card, wandev_conf_t* conf); /* Sync PPP on top of RAW CHDLC */
469
470extern sdla_t * wanpipe_find_card(char *);
471extern sdla_t * wanpipe_find_card_num (int);
472
473extern void wanpipe_queue_work (struct work_struct *);
474extern void wanpipe_mark_bh (void);
475extern void wakeup_sk_bh(struct net_device *dev);
476extern int change_dev_flags(struct net_device *dev, unsigned flags);
477extern unsigned long get_ip_address(struct net_device *dev, int option);
478extern void add_gateway(sdla_t *card, struct net_device *dev);
479
480
481#endif /* __KERNEL__ */
482#endif /* _WANPIPE_H */
483
diff --git a/include/net/arp.h b/include/net/arp.h
index a13e30c35f42..643bded9f557 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -10,8 +10,6 @@
10extern struct neigh_table arp_tbl; 10extern struct neigh_table arp_tbl;
11 11
12extern void arp_init(void); 12extern void arp_init(void);
13extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
14 struct packet_type *pt, struct net_device *orig_dev);
15extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 13extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
16extern int arp_ioctl(unsigned int cmd, void __user *arg); 14extern int arp_ioctl(unsigned int cmd, void __user *arg);
17extern void arp_send(int type, int ptype, u32 dest_ip, 15extern void arp_send(int type, int ptype, u32 dest_ip,
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index b971d8c82bdd..6b3693f05ca0 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -267,8 +267,9 @@ extern void ieee80211softmac_stop(struct net_device *dev);
267#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 267#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5
268#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 268#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6
269#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 269#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
270#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8
270/* keep this updated! */ 271/* keep this updated! */
271#define IEEE80211SOFTMAC_EVENT_LAST 7 272#define IEEE80211SOFTMAC_EVENT_LAST 8
272/* 273/*
273 * If you want to be notified of certain events, you can call 274 * If you want to be notified of certain events, you can call
274 * ieee80211softmac_notify[_atomic] with 275 * ieee80211softmac_notify[_atomic] with
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 25f708ff020e..59f0c83d55a2 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,31 +48,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
48 return inet6_ehashfn(laddr, lport, faddr, fport); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
49} 49}
50 50
51static inline void __inet6_hash(struct inet_hashinfo *hashinfo, 51extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
52 struct sock *sk)
53{
54 struct hlist_head *list;
55 rwlock_t *lock;
56
57 BUG_TRAP(sk_unhashed(sk));
58
59 if (sk->sk_state == TCP_LISTEN) {
60 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
61 lock = &hashinfo->lhash_lock;
62 inet_listen_wlock(hashinfo);
63 } else {
64 unsigned int hash;
65 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
66 hash &= (hashinfo->ehash_size - 1);
67 list = &hashinfo->ehash[hash].chain;
68 lock = &hashinfo->ehash[hash].lock;
69 write_lock(lock);
70 }
71
72 __sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock(lock);
75}
76 52
77/* 53/*
78 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 54 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -80,52 +56,12 @@ static inline void __inet6_hash(struct inet_hashinfo *hashinfo,
80 * 56 *
81 * The sockhash lock must be held as a reader here. 57 * The sockhash lock must be held as a reader here.
82 */ 58 */
83static inline struct sock * 59extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
84 __inet6_lookup_established(struct inet_hashinfo *hashinfo,
85 const struct in6_addr *saddr, 60 const struct in6_addr *saddr,
86 const u16 sport, 61 const u16 sport,
87 const struct in6_addr *daddr, 62 const struct in6_addr *daddr,
88 const u16 hnum, 63 const u16 hnum,
89 const int dif) 64 const int dif);
90{
91 struct sock *sk;
92 const struct hlist_node *node;
93 const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
94 /* Optimize here for direct hit, only listening connections can
95 * have wildcards anyways.
96 */
97 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
98 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
99
100 prefetch(head->chain.first);
101 read_lock(&head->lock);
102 sk_for_each(sk, node, &head->chain) {
103 /* For IPV6 do the cheaper port and family tests first. */
104 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif))
105 goto hit; /* You sunk my battleship! */
106 }
107 /* Must check for a TIME_WAIT'er before going to listener hash. */
108 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
109 const struct inet_timewait_sock *tw = inet_twsk(sk);
110
111 if(*((__u32 *)&(tw->tw_dport)) == ports &&
112 sk->sk_family == PF_INET6) {
113 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
114
115 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
116 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
117 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
118 goto hit;
119 }
120 }
121 read_unlock(&head->lock);
122 return NULL;
123
124hit:
125 sock_hold(sk);
126 read_unlock(&head->lock);
127 return sk;
128}
129 65
130extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 66extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
131 const struct in6_addr *daddr, 67 const struct in6_addr *daddr,
diff --git a/include/net/ip.h b/include/net/ip.h
index 8fe6156ca9b0..3d2e5ca62a5a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -95,6 +95,7 @@ extern int ip_local_deliver(struct sk_buff *skb);
95extern int ip_mr_input(struct sk_buff *skb); 95extern int ip_mr_input(struct sk_buff *skb);
96extern int ip_output(struct sk_buff *skb); 96extern int ip_output(struct sk_buff *skb);
97extern int ip_mc_output(struct sk_buff *skb); 97extern int ip_mc_output(struct sk_buff *skb);
98extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
98extern int ip_do_nat(struct sk_buff *skb); 99extern int ip_do_nat(struct sk_buff *skb);
99extern void ip_send_check(struct iphdr *ip); 100extern void ip_send_check(struct iphdr *ip);
100extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 101extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6d6f0634ae41..4abedb8eaece 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -230,7 +230,7 @@ extern int ip6_ra_control(struct sock *sk, int sel,
230 void (*destructor)(struct sock *)); 230 void (*destructor)(struct sock *));
231 231
232 232
233extern int ipv6_parse_hopopts(struct sk_buff *skb, int); 233extern int ipv6_parse_hopopts(struct sk_buff *skb);
234 234
235extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 235extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
236extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 236extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
diff --git a/include/net/sock.h b/include/net/sock.h
index af2b0544586e..ff8b0dad7b0f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -454,6 +454,7 @@ static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk)
454 454
455static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) 455static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb)
456{ 456{
457 skb_truesize_check(skb);
457 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 458 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
458 sk->sk_wmem_queued -= skb->truesize; 459 sk->sk_wmem_queued -= skb->truesize;
459 sk->sk_forward_alloc += skb->truesize; 460 sk->sk_forward_alloc += skb->truesize;
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1a318374faef..1d10c879f7e2 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -8,6 +8,7 @@
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9{ 9{
10 skb->mac.raw = skb->data; 10 skb->mac.raw = skb->data;
11 skb->dev = dev;
11 skb->pkt_type = PACKET_HOST; 12 skb->pkt_type = PACKET_HOST;
12 13
13 return htons(ETH_P_X25); 14 return htons(ETH_P_X25);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0d5529c382e8..afa508d92c93 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -143,6 +143,11 @@ struct xfrm_state
143 /* Replay detection state at the time we sent the last notification */ 143 /* Replay detection state at the time we sent the last notification */
144 struct xfrm_replay_state preplay; 144 struct xfrm_replay_state preplay;
145 145
146 /* internal flag that only holds state for delayed aevent at the
147 * moment
148 */
149 u32 xflags;
150
146 /* Replay detection notification settings */ 151 /* Replay detection notification settings */
147 u32 replay_maxage; 152 u32 replay_maxage;
148 u32 replay_maxdiff; 153 u32 replay_maxdiff;
@@ -168,6 +173,9 @@ struct xfrm_state
168 void *data; 173 void *data;
169}; 174};
170 175
176/* xflags - make enum if more show up */
177#define XFRM_TIME_DEFER 1
178
171enum { 179enum {
172 XFRM_STATE_VOID, 180 XFRM_STATE_VOID,
173 XFRM_STATE_ACQ, 181 XFRM_STATE_ACQ,
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index f404fe21cc21..ad63c215efe5 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -91,34 +91,6 @@ enum ib_sa_selector {
91 IB_SA_BEST = 3 91 IB_SA_BEST = 3
92}; 92};
93 93
94enum ib_sa_rate {
95 IB_SA_RATE_2_5_GBPS = 2,
96 IB_SA_RATE_5_GBPS = 5,
97 IB_SA_RATE_10_GBPS = 3,
98 IB_SA_RATE_20_GBPS = 6,
99 IB_SA_RATE_30_GBPS = 4,
100 IB_SA_RATE_40_GBPS = 7,
101 IB_SA_RATE_60_GBPS = 8,
102 IB_SA_RATE_80_GBPS = 9,
103 IB_SA_RATE_120_GBPS = 10
104};
105
106static inline int ib_sa_rate_enum_to_int(enum ib_sa_rate rate)
107{
108 switch (rate) {
109 case IB_SA_RATE_2_5_GBPS: return 1;
110 case IB_SA_RATE_5_GBPS: return 2;
111 case IB_SA_RATE_10_GBPS: return 4;
112 case IB_SA_RATE_20_GBPS: return 8;
113 case IB_SA_RATE_30_GBPS: return 12;
114 case IB_SA_RATE_40_GBPS: return 16;
115 case IB_SA_RATE_60_GBPS: return 24;
116 case IB_SA_RATE_80_GBPS: return 32;
117 case IB_SA_RATE_120_GBPS: return 48;
118 default: return -1;
119 }
120}
121
122/* 94/*
123 * Structures for SA records are named "struct ib_sa_xxx_rec." No 95 * Structures for SA records are named "struct ib_sa_xxx_rec." No
124 * attempt is made to pack structures to match the physical layout of 96 * attempt is made to pack structures to match the physical layout of
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c1ad6273ac6c..6bbf1b364400 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -314,6 +314,34 @@ enum ib_ah_flags {
314 IB_AH_GRH = 1 314 IB_AH_GRH = 1
315}; 315};
316 316
317enum ib_rate {
318 IB_RATE_PORT_CURRENT = 0,
319 IB_RATE_2_5_GBPS = 2,
320 IB_RATE_5_GBPS = 5,
321 IB_RATE_10_GBPS = 3,
322 IB_RATE_20_GBPS = 6,
323 IB_RATE_30_GBPS = 4,
324 IB_RATE_40_GBPS = 7,
325 IB_RATE_60_GBPS = 8,
326 IB_RATE_80_GBPS = 9,
327 IB_RATE_120_GBPS = 10
328};
329
330/**
331 * ib_rate_to_mult - Convert the IB rate enum to a multiple of the
332 * base rate of 2.5 Gbit/sec. For example, IB_RATE_5_GBPS will be
333 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec.
334 * @rate: rate to convert.
335 */
336int ib_rate_to_mult(enum ib_rate rate) __attribute_const__;
337
338/**
339 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
340 * enum.
341 * @mult: multiple to convert.
342 */
343enum ib_rate mult_to_ib_rate(int mult) __attribute_const__;
344
317struct ib_ah_attr { 345struct ib_ah_attr {
318 struct ib_global_route grh; 346 struct ib_global_route grh;
319 u16 dlid; 347 u16 dlid;
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 174101b2069b..d31b16d25a09 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -28,4 +28,5 @@
28#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */ 28#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */
29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */ 29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */
30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */ 30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */
31#endif 32#endif
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index dc6862d09e53..de6ce541a046 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -140,7 +140,6 @@ struct scsi_host_template {
140 * 140 *
141 * Status: REQUIRED (at least one of them) 141 * Status: REQUIRED (at least one of them)
142 */ 142 */
143 int (* eh_strategy_handler)(struct Scsi_Host *);
144 int (* eh_abort_handler)(struct scsi_cmnd *); 143 int (* eh_abort_handler)(struct scsi_cmnd *);
145 int (* eh_device_reset_handler)(struct scsi_cmnd *); 144 int (* eh_device_reset_handler)(struct scsi_cmnd *);
146 int (* eh_bus_reset_handler)(struct scsi_cmnd *); 145 int (* eh_bus_reset_handler)(struct scsi_cmnd *);
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index d4be4d92d586..edb9525386da 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -41,8 +41,6 @@ typedef struct scsi_fctargaddress {
41} Scsi_FCTargAddress; 41} Scsi_FCTargAddress;
42 42
43extern int scsi_ioctl(struct scsi_device *, int, void __user *); 43extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44extern int scsi_ioctl_send_command(struct scsi_device *,
45 struct scsi_ioctl_command __user *);
46extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
47 void __user *arg, struct file *filp); 45 void __user *arg, struct file *filp);
48 46
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index b3657f111937..cca1d4926d2a 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -50,6 +50,11 @@ struct scsi_transport_template {
50 unsigned int create_work_queue : 1; 50 unsigned int create_work_queue : 1;
51 51
52 /* 52 /*
53 * Allows a transport to override the default error handler.
54 */
55 void (* eh_strategy_handler)(struct Scsi_Host *);
56
57 /*
53 * This is an optional routine that allows the transport to become 58 * This is an optional routine that allows the transport to become
54 * involved when a scsi io timer fires. The return value tells the 59 * involved when a scsi io timer fires. The return value tells the
55 * timer routine how to finish the io timeout handling: 60 * timer routine how to finish the io timeout handling:
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index cf3fec8be1e3..5626225bd3ae 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -202,12 +202,19 @@ struct fc_rport { /* aka fc_starget_attrs */
202 /* internal data */ 202 /* internal data */
203 unsigned int channel; 203 unsigned int channel;
204 u32 number; 204 u32 number;
205 u8 flags;
205 struct list_head peers; 206 struct list_head peers;
206 struct device dev; 207 struct device dev;
207 struct work_struct dev_loss_work; 208 struct work_struct dev_loss_work;
208 struct work_struct scan_work; 209 struct work_struct scan_work;
210 struct work_struct stgt_delete_work;
211 struct work_struct rport_delete_work;
209} __attribute__((aligned(sizeof(unsigned long)))); 212} __attribute__((aligned(sizeof(unsigned long))));
210 213
214/* bit field values for struct fc_rport "flags" field: */
215#define FC_RPORT_DEVLOSS_PENDING 0x01
216#define FC_RPORT_SCAN_PENDING 0x02
217
211#define dev_to_rport(d) \ 218#define dev_to_rport(d) \
212 container_of(d, struct fc_rport, dev) 219 container_of(d, struct fc_rport, dev)
213#define transport_class_to_rport(classdev) \ 220#define transport_class_to_rport(classdev) \
@@ -327,13 +334,16 @@ struct fc_host_attrs {
327 struct list_head rport_bindings; 334 struct list_head rport_bindings;
328 u32 next_rport_number; 335 u32 next_rport_number;
329 u32 next_target_id; 336 u32 next_target_id;
330 u8 flags;
331 struct work_struct rport_del_work;
332};
333 337
334/* values for struct fc_host_attrs "flags" field: */ 338 /* work queues for rport state manipulation */
335#define FC_SHOST_RPORT_DEL_SCHEDULED 0x01 339 char work_q_name[KOBJ_NAME_LEN];
340 struct workqueue_struct *work_q;
341 char devloss_work_q_name[KOBJ_NAME_LEN];
342 struct workqueue_struct *devloss_work_q;
343};
336 344
345#define shost_to_fc_host(x) \
346 ((struct fc_host_attrs *)(x)->shost_data)
337 347
338#define fc_host_node_name(x) \ 348#define fc_host_node_name(x) \
339 (((struct fc_host_attrs *)(x)->shost_data)->node_name) 349 (((struct fc_host_attrs *)(x)->shost_data)->node_name)
@@ -375,10 +385,14 @@ struct fc_host_attrs {
375 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number) 385 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number)
376#define fc_host_next_target_id(x) \ 386#define fc_host_next_target_id(x) \
377 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id) 387 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id)
378#define fc_host_flags(x) \ 388#define fc_host_work_q_name(x) \
379 (((struct fc_host_attrs *)(x)->shost_data)->flags) 389 (((struct fc_host_attrs *)(x)->shost_data)->work_q_name)
380#define fc_host_rport_del_work(x) \ 390#define fc_host_work_q(x) \
381 (((struct fc_host_attrs *)(x)->shost_data)->rport_del_work) 391 (((struct fc_host_attrs *)(x)->shost_data)->work_q)
392#define fc_host_devloss_work_q_name(x) \
393 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
394#define fc_host_devloss_work_q(x) \
395 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
382 396
383 397
384/* The functions by which the transport class and the driver communicate */ 398/* The functions by which the transport class and the driver communicate */
@@ -461,10 +475,15 @@ fc_remote_port_chkready(struct fc_rport *rport)
461 475
462 switch (rport->port_state) { 476 switch (rport->port_state) {
463 case FC_PORTSTATE_ONLINE: 477 case FC_PORTSTATE_ONLINE:
464 result = 0; 478 if (rport->roles & FC_RPORT_ROLE_FCP_TARGET)
479 result = 0;
480 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)
481 result = DID_IMM_RETRY << 16;
482 else
483 result = DID_NO_CONNECT << 16;
465 break; 484 break;
466 case FC_PORTSTATE_BLOCKED: 485 case FC_PORTSTATE_BLOCKED:
467 result = DID_BUS_BUSY << 16; 486 result = DID_IMM_RETRY << 16;
468 break; 487 break;
469 default: 488 default:
470 result = DID_NO_CONNECT << 16; 489 result = DID_NO_CONNECT << 16;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 66b1f08b42b9..df70e7592ab5 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -367,7 +367,7 @@ struct snd_pcm_substream {
367 struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ 367 struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
368 struct snd_pcm_group *group; /* pointer to current group */ 368 struct snd_pcm_group *group; /* pointer to current group */
369 /* -- assigned files -- */ 369 /* -- assigned files -- */
370 struct snd_pcm_file *file; 370 void *file;
371 struct file *ffile; 371 struct file *ffile;
372 void (*pcm_release)(struct snd_pcm_substream *); 372 void (*pcm_release)(struct snd_pcm_substream *);
373#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 373#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
@@ -898,7 +898,6 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
898const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); 898const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
899int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 899int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
900snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 900snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
901const char *snd_pcm_format_name(snd_pcm_format_t format);
902 901
903void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); 902void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
904void snd_pcm_set_sync(struct snd_pcm_substream *substream); 903void snd_pcm_set_sync(struct snd_pcm_substream *substream);
diff --git a/ipc/shm.c b/ipc/shm.c
index 6b0c9af5bbf7..1c2faf62bc73 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -162,6 +162,8 @@ static int shm_mmap(struct file * file, struct vm_area_struct * vma)
162 ret = shmem_mmap(file, vma); 162 ret = shmem_mmap(file, vma);
163 if (ret == 0) { 163 if (ret == 0) {
164 vma->vm_ops = &shm_vm_ops; 164 vma->vm_ops = &shm_vm_ops;
165 if (!(vma->vm_flags & VM_WRITE))
166 vma->vm_flags &= ~VM_MAYWRITE;
165 shm_inc(file->f_dentry->d_inode->i_ino); 167 shm_inc(file->f_dentry->d_inode->i_ino);
166 } 168 }
167 169
diff --git a/ipc/util.c b/ipc/util.c
index 5e785a29e1e6..b3dcfad3b4f7 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -183,8 +183,7 @@ static int grow_ary(struct ipc_ids* ids, int newsize)
183 if(new == NULL) 183 if(new == NULL)
184 return size; 184 return size;
185 new->size = newsize; 185 new->size = newsize;
186 memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size + 186 memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
187 sizeof(struct ipc_id_ary));
188 for(i=size;i<newsize;i++) { 187 for(i=size;i<newsize;i++) {
189 new->p[i] = NULL; 188 new->p[i] = NULL;
190 } 189 }
diff --git a/kernel/exit.c b/kernel/exit.c
index 6c2eeb8f6390..f86434d7b3d1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -34,6 +34,7 @@
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/futex.h> 35#include <linux/futex.h>
36#include <linux/compat.h> 36#include <linux/compat.h>
37#include <linux/pipe_fs_i.h>
37 38
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39#include <asm/unistd.h> 40#include <asm/unistd.h>
@@ -55,7 +56,7 @@ static void __unhash_process(struct task_struct *p)
55 detach_pid(p, PIDTYPE_PGID); 56 detach_pid(p, PIDTYPE_PGID);
56 detach_pid(p, PIDTYPE_SID); 57 detach_pid(p, PIDTYPE_SID);
57 58
58 list_del_init(&p->tasks); 59 list_del_rcu(&p->tasks);
59 __get_cpu_var(process_counts)--; 60 __get_cpu_var(process_counts)--;
60 } 61 }
61 list_del_rcu(&p->thread_group); 62 list_del_rcu(&p->thread_group);
@@ -941,6 +942,9 @@ fastcall NORET_TYPE void do_exit(long code)
941 if (tsk->io_context) 942 if (tsk->io_context)
942 exit_io_context(); 943 exit_io_context();
943 944
945 if (tsk->splice_pipe)
946 __free_pipe_info(tsk->splice_pipe);
947
944 /* PF_DEAD causes final put_task_struct after we schedule. */ 948 /* PF_DEAD causes final put_task_struct after we schedule. */
945 preempt_disable(); 949 preempt_disable();
946 BUG_ON(tsk->flags & PF_DEAD); 950 BUG_ON(tsk->flags & PF_DEAD);
diff --git a/kernel/fork.c b/kernel/fork.c
index 3384eb89cb1c..d2fa57d480d4 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -124,12 +124,6 @@ void __put_task_struct(struct task_struct *tsk)
124 free_task(tsk); 124 free_task(tsk);
125} 125}
126 126
127void __put_task_struct_cb(struct rcu_head *rhp)
128{
129 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
130 __put_task_struct(tsk);
131}
132
133void __init fork_init(unsigned long mempages) 127void __init fork_init(unsigned long mempages)
134{ 128{
135#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 129#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
@@ -186,6 +180,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
186 atomic_set(&tsk->usage,2); 180 atomic_set(&tsk->usage,2);
187 atomic_set(&tsk->fs_excl, 0); 181 atomic_set(&tsk->fs_excl, 0);
188 tsk->btrace_seq = 0; 182 tsk->btrace_seq = 0;
183 tsk->splice_pipe = NULL;
189 return tsk; 184 return tsk;
190} 185}
191 186
@@ -1210,7 +1205,7 @@ static task_t *copy_process(unsigned long clone_flags,
1210 attach_pid(p, PIDTYPE_PGID, process_group(p)); 1205 attach_pid(p, PIDTYPE_PGID, process_group(p));
1211 attach_pid(p, PIDTYPE_SID, p->signal->session); 1206 attach_pid(p, PIDTYPE_SID, p->signal->session);
1212 1207
1213 list_add_tail(&p->tasks, &init_task.tasks); 1208 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1214 __get_cpu_var(process_counts)++; 1209 __get_cpu_var(process_counts)++;
1215 } 1210 }
1216 attach_pid(p, PIDTYPE_PID, p->pid); 1211 attach_pid(p, PIDTYPE_PID, p->pid);
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index f181ff4dd32e..d2a7296c8251 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -501,6 +501,7 @@ int hrtimer_cancel(struct hrtimer *timer)
501 501
502 if (ret >= 0) 502 if (ret >= 0)
503 return ret; 503 return ret;
504 cpu_relax();
504 } 505 }
505} 506}
506 507
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile
index 2b33f852be3e..9f77f50d8143 100644
--- a/kernel/irq/Makefile
+++ b/kernel/irq/Makefile
@@ -1,4 +1,5 @@
1 1
2obj-y := handle.o manage.o spurious.o migration.o 2obj-y := handle.o manage.o spurious.o
3obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o 3obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
4obj-$(CONFIG_PROC_FS) += proc.o 4obj-$(CONFIG_PROC_FS) += proc.o
5obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index 52a8655fa080..134f9f2e0e39 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -1,6 +1,5 @@
1#include <linux/irq.h>
2 1
3#if defined(CONFIG_GENERIC_PENDING_IRQ) 2#include <linux/irq.h>
4 3
5void set_pending_irq(unsigned int irq, cpumask_t mask) 4void set_pending_irq(unsigned int irq, cpumask_t mask)
6{ 5{
@@ -61,5 +60,3 @@ void move_native_irq(int irq)
61 } 60 }
62 cpus_clear(pending_irq_cpumask[irq]); 61 cpus_clear(pending_irq_cpumask[irq]);
63} 62}
64
65#endif
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1156eb0977d0..1fbf466a29aa 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -585,6 +585,9 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
585 int i; 585 int i;
586 586
587 rp->kp.pre_handler = pre_handler_kretprobe; 587 rp->kp.pre_handler = pre_handler_kretprobe;
588 rp->kp.post_handler = NULL;
589 rp->kp.fault_handler = NULL;
590 rp->kp.break_handler = NULL;
588 591
589 /* Pre-allocate memory for max kretprobe instances */ 592 /* Pre-allocate memory for max kretprobe instances */
590 if (rp->maxactive <= 0) { 593 if (rp->maxactive <= 0) {
diff --git a/kernel/panic.c b/kernel/panic.c
index f895c7c01d5b..cc2a4c9c36ac 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -27,7 +27,6 @@ static int pause_on_oops_flag;
27static DEFINE_SPINLOCK(pause_on_oops_lock); 27static DEFINE_SPINLOCK(pause_on_oops_lock);
28 28
29int panic_timeout; 29int panic_timeout;
30EXPORT_SYMBOL(panic_timeout);
31 30
32ATOMIC_NOTIFIER_HEAD(panic_notifier_list); 31ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
33 32
diff --git a/kernel/power/pm.c b/kernel/power/pm.c
index 0f6908cce1dd..84063ac8fcfc 100644
--- a/kernel/power/pm.c
+++ b/kernel/power/pm.c
@@ -75,25 +75,6 @@ struct pm_dev *pm_register(pm_dev_t type,
75 return dev; 75 return dev;
76} 76}
77 77
78/**
79 * pm_unregister - unregister a device with power management
80 * @dev: device to unregister
81 *
82 * Remove a device from the power management notification lists. The
83 * dev passed must be a handle previously returned by pm_register.
84 */
85
86void pm_unregister(struct pm_dev *dev)
87{
88 if (dev) {
89 mutex_lock(&pm_devs_lock);
90 list_del(&dev->entry);
91 mutex_unlock(&pm_devs_lock);
92
93 kfree(dev);
94 }
95}
96
97static void __pm_unregister(struct pm_dev *dev) 78static void __pm_unregister(struct pm_dev *dev)
98{ 79{
99 if (dev) { 80 if (dev) {
@@ -258,7 +239,6 @@ int pm_send_all(pm_request_t rqst, void *data)
258} 239}
259 240
260EXPORT_SYMBOL(pm_register); 241EXPORT_SYMBOL(pm_register);
261EXPORT_SYMBOL(pm_unregister);
262EXPORT_SYMBOL(pm_unregister_all); 242EXPORT_SYMBOL(pm_unregister_all);
263EXPORT_SYMBOL(pm_send_all); 243EXPORT_SYMBOL(pm_send_all);
264EXPORT_SYMBOL(pm_active); 244EXPORT_SYMBOL(pm_active);
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index c5863d02c89e..3eeedbb13b78 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -240,14 +240,15 @@ static void copy_data_pages(struct pbe *pblist)
240 * free_pagedir - free pages allocated with alloc_pagedir() 240 * free_pagedir - free pages allocated with alloc_pagedir()
241 */ 241 */
242 242
243static void free_pagedir(struct pbe *pblist) 243static void free_pagedir(struct pbe *pblist, int clear_nosave_free)
244{ 244{
245 struct pbe *pbe; 245 struct pbe *pbe;
246 246
247 while (pblist) { 247 while (pblist) {
248 pbe = (pblist + PB_PAGE_SKIP)->next; 248 pbe = (pblist + PB_PAGE_SKIP)->next;
249 ClearPageNosave(virt_to_page(pblist)); 249 ClearPageNosave(virt_to_page(pblist));
250 ClearPageNosaveFree(virt_to_page(pblist)); 250 if (clear_nosave_free)
251 ClearPageNosaveFree(virt_to_page(pblist));
251 free_page((unsigned long)pblist); 252 free_page((unsigned long)pblist);
252 pblist = pbe; 253 pblist = pbe;
253 } 254 }
@@ -389,7 +390,7 @@ struct pbe *alloc_pagedir(unsigned int nr_pages, gfp_t gfp_mask, int safe_needed
389 pbe->next = alloc_image_page(gfp_mask, safe_needed); 390 pbe->next = alloc_image_page(gfp_mask, safe_needed);
390 } 391 }
391 if (!pbe) { /* get_zeroed_page() failed */ 392 if (!pbe) { /* get_zeroed_page() failed */
392 free_pagedir(pblist); 393 free_pagedir(pblist, 1);
393 pblist = NULL; 394 pblist = NULL;
394 } else 395 } else
395 create_pbe_list(pblist, nr_pages); 396 create_pbe_list(pblist, nr_pages);
@@ -736,7 +737,7 @@ static int create_image(struct snapshot_handle *handle)
736 pblist = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 1); 737 pblist = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 1);
737 if (pblist) 738 if (pblist)
738 copy_page_backup_list(pblist, p); 739 copy_page_backup_list(pblist, p);
739 free_pagedir(p); 740 free_pagedir(p, 0);
740 if (!pblist) 741 if (!pblist)
741 error = -ENOMEM; 742 error = -ENOMEM;
742 } 743 }
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 0eeb7e66722c..4e0f0ec003f7 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -56,10 +56,6 @@ void ptrace_untrace(task_t *child)
56 signal_wake_up(child, 1); 56 signal_wake_up(child, 1);
57 } 57 }
58 } 58 }
59 if (child->signal->flags & SIGNAL_GROUP_EXIT) {
60 sigaddset(&child->pending.signal, SIGKILL);
61 signal_wake_up(child, 1);
62 }
63 spin_unlock(&child->sighand->siglock); 59 spin_unlock(&child->sighand->siglock);
64} 60}
65 61
@@ -81,7 +77,8 @@ void __ptrace_unlink(task_t *child)
81 add_parent(child); 77 add_parent(child);
82 } 78 }
83 79
84 ptrace_untrace(child); 80 if (child->state == TASK_TRACED)
81 ptrace_untrace(child);
85} 82}
86 83
87/* 84/*
diff --git a/kernel/sched.c b/kernel/sched.c
index dd153d6f8a04..365f0b90b4de 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -665,13 +665,55 @@ static int effective_prio(task_t *p)
665} 665}
666 666
667/* 667/*
668 * We place interactive tasks back into the active array, if possible.
669 *
670 * To guarantee that this does not starve expired tasks we ignore the
671 * interactivity of a task if the first expired task had to wait more
672 * than a 'reasonable' amount of time. This deadline timeout is
673 * load-dependent, as the frequency of array switched decreases with
674 * increasing number of running tasks. We also ignore the interactivity
675 * if a better static_prio task has expired, and switch periodically
676 * regardless, to ensure that highly interactive tasks do not starve
677 * the less fortunate for unreasonably long periods.
678 */
679static inline int expired_starving(runqueue_t *rq)
680{
681 int limit;
682
683 /*
684 * Arrays were recently switched, all is well
685 */
686 if (!rq->expired_timestamp)
687 return 0;
688
689 limit = STARVATION_LIMIT * rq->nr_running;
690
691 /*
692 * It's time to switch arrays
693 */
694 if (jiffies - rq->expired_timestamp >= limit)
695 return 1;
696
697 /*
698 * There's a better selection in the expired array
699 */
700 if (rq->curr->static_prio > rq->best_expired_prio)
701 return 1;
702
703 /*
704 * All is well
705 */
706 return 0;
707}
708
709/*
668 * __activate_task - move a task to the runqueue. 710 * __activate_task - move a task to the runqueue.
669 */ 711 */
670static void __activate_task(task_t *p, runqueue_t *rq) 712static void __activate_task(task_t *p, runqueue_t *rq)
671{ 713{
672 prio_array_t *target = rq->active; 714 prio_array_t *target = rq->active;
673 715
674 if (batch_task(p)) 716 if (unlikely(batch_task(p) || (expired_starving(rq) && !rt_task(p))))
675 target = rq->expired; 717 target = rq->expired;
676 enqueue_task(p, target); 718 enqueue_task(p, target);
677 rq->nr_running++; 719 rq->nr_running++;
@@ -2490,22 +2532,6 @@ unsigned long long current_sched_time(const task_t *tsk)
2490} 2532}
2491 2533
2492/* 2534/*
2493 * We place interactive tasks back into the active array, if possible.
2494 *
2495 * To guarantee that this does not starve expired tasks we ignore the
2496 * interactivity of a task if the first expired task had to wait more
2497 * than a 'reasonable' amount of time. This deadline timeout is
2498 * load-dependent, as the frequency of array switched decreases with
2499 * increasing number of running tasks. We also ignore the interactivity
2500 * if a better static_prio task has expired:
2501 */
2502#define EXPIRED_STARVING(rq) \
2503 ((STARVATION_LIMIT && ((rq)->expired_timestamp && \
2504 (jiffies - (rq)->expired_timestamp >= \
2505 STARVATION_LIMIT * ((rq)->nr_running) + 1))) || \
2506 ((rq)->curr->static_prio > (rq)->best_expired_prio))
2507
2508/*
2509 * Account user cpu time to a process. 2535 * Account user cpu time to a process.
2510 * @p: the process that the cpu time gets accounted to 2536 * @p: the process that the cpu time gets accounted to
2511 * @hardirq_offset: the offset to subtract from hardirq_count() 2537 * @hardirq_offset: the offset to subtract from hardirq_count()
@@ -2640,7 +2666,7 @@ void scheduler_tick(void)
2640 2666
2641 if (!rq->expired_timestamp) 2667 if (!rq->expired_timestamp)
2642 rq->expired_timestamp = jiffies; 2668 rq->expired_timestamp = jiffies;
2643 if (!TASK_INTERACTIVE(p) || EXPIRED_STARVING(rq)) { 2669 if (!TASK_INTERACTIVE(p) || expired_starving(rq)) {
2644 enqueue_task(p, rq->expired); 2670 enqueue_task(p, rq->expired);
2645 if (p->static_prio < rq->best_expired_prio) 2671 if (p->static_prio < rq->best_expired_prio)
2646 rq->best_expired_prio = p->static_prio; 2672 rq->best_expired_prio = p->static_prio;
diff --git a/kernel/signal.c b/kernel/signal.c
index 5ccaac505e8d..e5f8aea78ffe 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -868,7 +868,6 @@ __group_complete_signal(int sig, struct task_struct *p)
868 if (t == NULL) 868 if (t == NULL)
869 /* restart balancing at this thread */ 869 /* restart balancing at this thread */
870 t = p->signal->curr_target = p; 870 t = p->signal->curr_target = p;
871 BUG_ON(t->tgid != p->tgid);
872 871
873 while (!wants_signal(sig, t)) { 872 while (!wants_signal(sig, t)) {
874 t = next_thread(t); 873 t = next_thread(t);
@@ -1755,9 +1754,9 @@ relock:
1755 /* Let the debugger run. */ 1754 /* Let the debugger run. */
1756 ptrace_stop(signr, signr, info); 1755 ptrace_stop(signr, signr, info);
1757 1756
1758 /* We're back. Did the debugger cancel the sig or group_exit? */ 1757 /* We're back. Did the debugger cancel the sig? */
1759 signr = current->exit_code; 1758 signr = current->exit_code;
1760 if (signr == 0 || current->signal->flags & SIGNAL_GROUP_EXIT) 1759 if (signr == 0)
1761 continue; 1760 continue;
1762 1761
1763 current->exit_code = 0; 1762 current->exit_code = 0;
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index d82864c4a617..5433195040f1 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -120,3 +120,15 @@ cond_syscall(sys32_sysctl);
120cond_syscall(ppc_rtas); 120cond_syscall(ppc_rtas);
121cond_syscall(sys_spu_run); 121cond_syscall(sys_spu_run);
122cond_syscall(sys_spu_create); 122cond_syscall(sys_spu_create);
123
124/* mmu depending weak syscall entries */
125cond_syscall(sys_mprotect);
126cond_syscall(sys_msync);
127cond_syscall(sys_mlock);
128cond_syscall(sys_munlock);
129cond_syscall(sys_mlockall);
130cond_syscall(sys_munlockall);
131cond_syscall(sys_mincore);
132cond_syscall(sys_madvise);
133cond_syscall(sys_mremap);
134cond_syscall(sys_remap_file_pages);
diff --git a/kernel/timer.c b/kernel/timer.c
index c3a874f1393c..883773788836 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -81,9 +81,10 @@ struct tvec_t_base_s {
81} ____cacheline_aligned_in_smp; 81} ____cacheline_aligned_in_smp;
82 82
83typedef struct tvec_t_base_s tvec_base_t; 83typedef struct tvec_t_base_s tvec_base_t;
84static DEFINE_PER_CPU(tvec_base_t *, tvec_bases); 84
85tvec_base_t boot_tvec_bases; 85tvec_base_t boot_tvec_bases;
86EXPORT_SYMBOL(boot_tvec_bases); 86EXPORT_SYMBOL(boot_tvec_bases);
87static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = { &boot_tvec_bases };
87 88
88static inline void set_running_timer(tvec_base_t *base, 89static inline void set_running_timer(tvec_base_t *base,
89 struct timer_list *timer) 90 struct timer_list *timer)
@@ -1224,28 +1225,36 @@ static int __devinit init_timers_cpu(int cpu)
1224{ 1225{
1225 int j; 1226 int j;
1226 tvec_base_t *base; 1227 tvec_base_t *base;
1228 static char __devinitdata tvec_base_done[NR_CPUS];
1227 1229
1228 base = per_cpu(tvec_bases, cpu); 1230 if (!tvec_base_done[cpu]) {
1229 if (!base) {
1230 static char boot_done; 1231 static char boot_done;
1231 1232
1232 /*
1233 * Cannot do allocation in init_timers as that runs before the
1234 * allocator initializes (and would waste memory if there are
1235 * more possible CPUs than will ever be installed/brought up).
1236 */
1237 if (boot_done) { 1233 if (boot_done) {
1234 /*
1235 * The APs use this path later in boot
1236 */
1238 base = kmalloc_node(sizeof(*base), GFP_KERNEL, 1237 base = kmalloc_node(sizeof(*base), GFP_KERNEL,
1239 cpu_to_node(cpu)); 1238 cpu_to_node(cpu));
1240 if (!base) 1239 if (!base)
1241 return -ENOMEM; 1240 return -ENOMEM;
1242 memset(base, 0, sizeof(*base)); 1241 memset(base, 0, sizeof(*base));
1242 per_cpu(tvec_bases, cpu) = base;
1243 } else { 1243 } else {
1244 base = &boot_tvec_bases; 1244 /*
1245 * This is for the boot CPU - we use compile-time
1246 * static initialisation because per-cpu memory isn't
1247 * ready yet and because the memory allocators are not
1248 * initialised either.
1249 */
1245 boot_done = 1; 1250 boot_done = 1;
1251 base = &boot_tvec_bases;
1246 } 1252 }
1247 per_cpu(tvec_bases, cpu) = base; 1253 tvec_base_done[cpu] = 1;
1254 } else {
1255 base = per_cpu(tvec_bases, cpu);
1248 } 1256 }
1257
1249 spin_lock_init(&base->lock); 1258 spin_lock_init(&base->lock);
1250 for (j = 0; j < TVN_SIZE; j++) { 1259 for (j = 0; j < TVN_SIZE; j++) {
1251 INIT_LIST_HEAD(base->tv5.vec + j); 1260 INIT_LIST_HEAD(base->tv5.vec + j);
@@ -1455,7 +1464,7 @@ static void time_interpolator_update(long delta_nsec)
1455 */ 1464 */
1456 if (jiffies % INTERPOLATOR_ADJUST == 0) 1465 if (jiffies % INTERPOLATOR_ADJUST == 0)
1457 { 1466 {
1458 if (time_interpolator->skips == 0 && time_interpolator->offset > TICK_NSEC) 1467 if (time_interpolator->skips == 0 && time_interpolator->offset > tick_nsec)
1459 time_interpolator->nsec_per_cyc--; 1468 time_interpolator->nsec_per_cyc--;
1460 if (time_interpolator->ns_skipped > INTERPOLATOR_MAX_SKIP && time_interpolator->offset == 0) 1469 if (time_interpolator->ns_skipped > INTERPOLATOR_MAX_SKIP && time_interpolator->offset == 0)
1461 time_interpolator->nsec_per_cyc++; 1470 time_interpolator->nsec_per_cyc++;
diff --git a/kernel/uid16.c b/kernel/uid16.c
index aa25605027c8..187e2a423878 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -20,43 +20,67 @@
20 20
21asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) 21asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group)
22{ 22{
23 return sys_chown(filename, low2highuid(user), low2highgid(group)); 23 long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
24 /* avoid REGPARM breakage on x86: */
25 prevent_tail_call(ret);
26 return ret;
24} 27}
25 28
26asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) 29asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group)
27{ 30{
28 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 31 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
32 /* avoid REGPARM breakage on x86: */
33 prevent_tail_call(ret);
34 return ret;
29} 35}
30 36
31asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) 37asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
32{ 38{
33 return sys_fchown(fd, low2highuid(user), low2highgid(group)); 39 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
40 /* avoid REGPARM breakage on x86: */
41 prevent_tail_call(ret);
42 return ret;
34} 43}
35 44
36asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) 45asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
37{ 46{
38 return sys_setregid(low2highgid(rgid), low2highgid(egid)); 47 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
48 /* avoid REGPARM breakage on x86: */
49 prevent_tail_call(ret);
50 return ret;
39} 51}
40 52
41asmlinkage long sys_setgid16(old_gid_t gid) 53asmlinkage long sys_setgid16(old_gid_t gid)
42{ 54{
43 return sys_setgid(low2highgid(gid)); 55 long ret = sys_setgid(low2highgid(gid));
56 /* avoid REGPARM breakage on x86: */
57 prevent_tail_call(ret);
58 return ret;
44} 59}
45 60
46asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) 61asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
47{ 62{
48 return sys_setreuid(low2highuid(ruid), low2highuid(euid)); 63 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
64 /* avoid REGPARM breakage on x86: */
65 prevent_tail_call(ret);
66 return ret;
49} 67}
50 68
51asmlinkage long sys_setuid16(old_uid_t uid) 69asmlinkage long sys_setuid16(old_uid_t uid)
52{ 70{
53 return sys_setuid(low2highuid(uid)); 71 long ret = sys_setuid(low2highuid(uid));
72 /* avoid REGPARM breakage on x86: */
73 prevent_tail_call(ret);
74 return ret;
54} 75}
55 76
56asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) 77asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
57{ 78{
58 return sys_setresuid(low2highuid(ruid), low2highuid(euid), 79 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
59 low2highuid(suid)); 80 low2highuid(suid));
81 /* avoid REGPARM breakage on x86: */
82 prevent_tail_call(ret);
83 return ret;
60} 84}
61 85
62asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) 86asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid)
@@ -72,8 +96,11 @@ asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid,
72 96
73asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) 97asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
74{ 98{
75 return sys_setresgid(low2highgid(rgid), low2highgid(egid), 99 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
76 low2highgid(sgid)); 100 low2highgid(sgid));
101 /* avoid REGPARM breakage on x86: */
102 prevent_tail_call(ret);
103 return ret;
77} 104}
78 105
79asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) 106asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid)
@@ -89,12 +116,18 @@ asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid,
89 116
90asmlinkage long sys_setfsuid16(old_uid_t uid) 117asmlinkage long sys_setfsuid16(old_uid_t uid)
91{ 118{
92 return sys_setfsuid(low2highuid(uid)); 119 long ret = sys_setfsuid(low2highuid(uid));
120 /* avoid REGPARM breakage on x86: */
121 prevent_tail_call(ret);
122 return ret;
93} 123}
94 124
95asmlinkage long sys_setfsgid16(old_gid_t gid) 125asmlinkage long sys_setfsgid16(old_gid_t gid)
96{ 126{
97 return sys_setfsgid(low2highgid(gid)); 127 long ret = sys_setfsgid(low2highgid(gid));
128 /* avoid REGPARM breakage on x86: */
129 prevent_tail_call(ret);
130 return ret;
98} 131}
99 132
100static int groups16_to_user(old_gid_t __user *grouplist, 133static int groups16_to_user(old_gid_t __user *grouplist,
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d57fd9181b18..6ecc180beb71 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -101,7 +101,7 @@ config DEBUG_PREEMPT
101 101
102config DEBUG_MUTEXES 102config DEBUG_MUTEXES
103 bool "Mutex debugging, deadlock detection" 103 bool "Mutex debugging, deadlock detection"
104 default y 104 default n
105 depends on DEBUG_KERNEL 105 depends on DEBUG_KERNEL
106 help 106 help
107 This allows mutex semantics violations and mutex related deadlocks 107 This allows mutex semantics violations and mutex related deadlocks
diff --git a/lib/kobject.c b/lib/kobject.c
index 25204a41a9b0..01d957513940 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -128,6 +128,7 @@ void kobject_init(struct kobject * kobj)
128{ 128{
129 kref_init(&kobj->kref); 129 kref_init(&kobj->kref);
130 INIT_LIST_HEAD(&kobj->entry); 130 INIT_LIST_HEAD(&kobj->entry);
131 init_waitqueue_head(&kobj->poll);
131 kobj->kset = kset_get(kobj->kset); 132 kobj->kset = kset_get(kobj->kset);
132} 133}
133 134
diff --git a/lib/string.c b/lib/string.c
index b3c28a3f6332..064f6315b1c3 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -362,6 +362,7 @@ size_t strspn(const char *s, const char *accept)
362EXPORT_SYMBOL(strspn); 362EXPORT_SYMBOL(strspn);
363#endif 363#endif
364 364
365#ifndef __HAVE_ARCH_STRCSPN
365/** 366/**
366 * strcspn - Calculate the length of the initial substring of @s which does 367 * strcspn - Calculate the length of the initial substring of @s which does
367 * not contain letters in @reject 368 * not contain letters in @reject
@@ -384,6 +385,7 @@ size_t strcspn(const char *s, const char *reject)
384 return count; 385 return count;
385} 386}
386EXPORT_SYMBOL(strcspn); 387EXPORT_SYMBOL(strcspn);
388#endif
387 389
388#ifndef __HAVE_ARCH_STRPBRK 390#ifndef __HAVE_ARCH_STRPBRK
389/** 391/**
@@ -403,6 +405,7 @@ char *strpbrk(const char *cs, const char *ct)
403 } 405 }
404 return NULL; 406 return NULL;
405} 407}
408EXPORT_SYMBOL(strpbrk);
406#endif 409#endif
407 410
408#ifndef __HAVE_ARCH_STRSEP 411#ifndef __HAVE_ARCH_STRSEP
@@ -467,7 +470,7 @@ EXPORT_SYMBOL(memset);
467void *memcpy(void *dest, const void *src, size_t count) 470void *memcpy(void *dest, const void *src, size_t count)
468{ 471{
469 char *tmp = dest; 472 char *tmp = dest;
470 char *s = src; 473 const char *s = src;
471 474
472 while (count--) 475 while (count--)
473 *tmp++ = *s++; 476 *tmp++ = *s++;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index d3e3bd2ffcea..d213feded10d 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -401,7 +401,7 @@ unsigned long __init free_all_bootmem (void)
401 return(free_all_bootmem_core(NODE_DATA(0))); 401 return(free_all_bootmem_core(NODE_DATA(0)));
402} 402}
403 403
404void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned long goal) 404void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, unsigned long goal)
405{ 405{
406 bootmem_data_t *bdata; 406 bootmem_data_t *bdata;
407 void *ptr; 407 void *ptr;
@@ -409,7 +409,14 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned
409 list_for_each_entry(bdata, &bdata_list, list) 409 list_for_each_entry(bdata, &bdata_list, list)
410 if ((ptr = __alloc_bootmem_core(bdata, size, align, goal, 0))) 410 if ((ptr = __alloc_bootmem_core(bdata, size, align, goal, 0)))
411 return(ptr); 411 return(ptr);
412 return NULL;
413}
412 414
415void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned long goal)
416{
417 void *mem = __alloc_bootmem_nopanic(size,align,goal);
418 if (mem)
419 return mem;
413 /* 420 /*
414 * Whoops, we cannot satisfy the allocation request. 421 * Whoops, we cannot satisfy the allocation request.
415 */ 422 */
diff --git a/mm/madvise.c b/mm/madvise.c
index af3d573b0141..4e196155a0c3 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -168,6 +168,9 @@ static long madvise_remove(struct vm_area_struct *vma,
168 return -EINVAL; 168 return -EINVAL;
169 } 169 }
170 170
171 if ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE))
172 return -EACCES;
173
171 mapping = vma->vm_file->f_mapping; 174 mapping = vma->vm_file->f_mapping;
172 175
173 offset = (loff_t)(start - vma->vm_start) 176 offset = (loff_t)(start - vma->vm_start)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index dec8249e972d..8778f58880c4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1761,7 +1761,6 @@ static void gather_stats(struct page *page, void *private, int pte_dirty)
1761 md->mapcount_max = count; 1761 md->mapcount_max = count;
1762 1762
1763 md->node[page_to_nid(page)]++; 1763 md->node[page_to_nid(page)]++;
1764 cond_resched();
1765} 1764}
1766 1765
1767#ifdef CONFIG_HUGETLB_PAGE 1766#ifdef CONFIG_HUGETLB_PAGE
diff --git a/mm/migrate.c b/mm/migrate.c
index 09f6e4aa87fc..d444229f2599 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -16,8 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/buffer_head.h> /* for try_to_release_page(), 19#include <linux/buffer_head.h>
20 buffer_heads_over_limit */
21#include <linux/mm_inline.h> 20#include <linux/mm_inline.h>
22#include <linux/pagevec.h> 21#include <linux/pagevec.h>
23#include <linux/rmap.h> 22#include <linux/rmap.h>
@@ -28,8 +27,6 @@
28 27
29#include "internal.h" 28#include "internal.h"
30 29
31#include "internal.h"
32
33/* The maximum number of pages to take off the LRU for migration */ 30/* The maximum number of pages to take off the LRU for migration */
34#define MIGRATE_CHUNK_SIZE 256 31#define MIGRATE_CHUNK_SIZE 256
35 32
@@ -176,7 +173,6 @@ unlock_retry:
176retry: 173retry:
177 return -EAGAIN; 174 return -EAGAIN;
178} 175}
179EXPORT_SYMBOL(swap_page);
180 176
181/* 177/*
182 * Remove references for a page and establish the new page with the correct 178 * Remove references for a page and establish the new page with the correct
@@ -234,7 +230,7 @@ int migrate_page_remove_references(struct page *newpage,
234 if (!page_mapping(page) || page_count(page) != nr_refs || 230 if (!page_mapping(page) || page_count(page) != nr_refs ||
235 *radix_pointer != page) { 231 *radix_pointer != page) {
236 write_unlock_irq(&mapping->tree_lock); 232 write_unlock_irq(&mapping->tree_lock);
237 return 1; 233 return -EAGAIN;
238 } 234 }
239 235
240 /* 236 /*
diff --git a/mm/mmap.c b/mm/mmap.c
index e780d19aa214..e6ee12344b13 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -121,14 +121,26 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
121 * only call if we're about to fail. 121 * only call if we're about to fail.
122 */ 122 */
123 n = nr_free_pages(); 123 n = nr_free_pages();
124
125 /*
126 * Leave reserved pages. The pages are not for anonymous pages.
127 */
128 if (n <= totalreserve_pages)
129 goto error;
130 else
131 n -= totalreserve_pages;
132
133 /*
134 * Leave the last 3% for root
135 */
124 if (!cap_sys_admin) 136 if (!cap_sys_admin)
125 n -= n / 32; 137 n -= n / 32;
126 free += n; 138 free += n;
127 139
128 if (free > pages) 140 if (free > pages)
129 return 0; 141 return 0;
130 vm_unacct_memory(pages); 142
131 return -ENOMEM; 143 goto error;
132 } 144 }
133 145
134 allowed = (totalram_pages - hugetlb_total_pages()) 146 allowed = (totalram_pages - hugetlb_total_pages())
@@ -150,7 +162,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
150 */ 162 */
151 if (atomic_read(&vm_committed_space) < (long)allowed) 163 if (atomic_read(&vm_committed_space) < (long)allowed)
152 return 0; 164 return 0;
153 165error:
154 vm_unacct_memory(pages); 166 vm_unacct_memory(pages);
155 167
156 return -ENOMEM; 168 return -ENOMEM;
@@ -220,6 +232,17 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
220 232
221 if (brk < mm->end_code) 233 if (brk < mm->end_code)
222 goto out; 234 goto out;
235
236 /*
237 * Check against rlimit here. If this check is done later after the test
238 * of oldbrk with newbrk then it can escape the test and let the data
239 * segment grow beyond its set limit the in case where the limit is
240 * not page aligned -Ram Gupta
241 */
242 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
243 if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
244 goto out;
245
223 newbrk = PAGE_ALIGN(brk); 246 newbrk = PAGE_ALIGN(brk);
224 oldbrk = PAGE_ALIGN(mm->brk); 247 oldbrk = PAGE_ALIGN(mm->brk);
225 if (oldbrk == newbrk) 248 if (oldbrk == newbrk)
@@ -232,11 +255,6 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
232 goto out; 255 goto out;
233 } 256 }
234 257
235 /* Check against rlimit.. */
236 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
237 if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
238 goto out;
239
240 /* Check against existing mmap mappings. */ 258 /* Check against existing mmap mappings. */
241 if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) 259 if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
242 goto out; 260 goto out;
diff --git a/mm/nommu.c b/mm/nommu.c
index db45efac17cc..029fadac0fb5 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1147,14 +1147,26 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
1147 * only call if we're about to fail. 1147 * only call if we're about to fail.
1148 */ 1148 */
1149 n = nr_free_pages(); 1149 n = nr_free_pages();
1150
1151 /*
1152 * Leave reserved pages. The pages are not for anonymous pages.
1153 */
1154 if (n <= totalreserve_pages)
1155 goto error;
1156 else
1157 n -= totalreserve_pages;
1158
1159 /*
1160 * Leave the last 3% for root
1161 */
1150 if (!cap_sys_admin) 1162 if (!cap_sys_admin)
1151 n -= n / 32; 1163 n -= n / 32;
1152 free += n; 1164 free += n;
1153 1165
1154 if (free > pages) 1166 if (free > pages)
1155 return 0; 1167 return 0;
1156 vm_unacct_memory(pages); 1168
1157 return -ENOMEM; 1169 goto error;
1158 } 1170 }
1159 1171
1160 allowed = totalram_pages * sysctl_overcommit_ratio / 100; 1172 allowed = totalram_pages * sysctl_overcommit_ratio / 100;
@@ -1175,7 +1187,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
1175 */ 1187 */
1176 if (atomic_read(&vm_committed_space) < (long)allowed) 1188 if (atomic_read(&vm_committed_space) < (long)allowed)
1177 return 0; 1189 return 0;
1178 1190error:
1179 vm_unacct_memory(pages); 1191 vm_unacct_memory(pages);
1180 1192
1181 return -ENOMEM; 1193 return -ENOMEM;
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 78747afad6b0..042e6436c3ee 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -46,15 +46,25 @@
46unsigned long badness(struct task_struct *p, unsigned long uptime) 46unsigned long badness(struct task_struct *p, unsigned long uptime)
47{ 47{
48 unsigned long points, cpu_time, run_time, s; 48 unsigned long points, cpu_time, run_time, s;
49 struct list_head *tsk; 49 struct mm_struct *mm;
50 struct task_struct *child;
50 51
51 if (!p->mm) 52 task_lock(p);
53 mm = p->mm;
54 if (!mm) {
55 task_unlock(p);
52 return 0; 56 return 0;
57 }
53 58
54 /* 59 /*
55 * The memory size of the process is the basis for the badness. 60 * The memory size of the process is the basis for the badness.
56 */ 61 */
57 points = p->mm->total_vm; 62 points = mm->total_vm;
63
64 /*
65 * After this unlock we can no longer dereference local variable `mm'
66 */
67 task_unlock(p);
58 68
59 /* 69 /*
60 * Processes which fork a lot of child processes are likely 70 * Processes which fork a lot of child processes are likely
@@ -64,11 +74,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
64 * child is eating the vast majority of memory, adding only half 74 * child is eating the vast majority of memory, adding only half
65 * to the parents will make the child our kill candidate of choice. 75 * to the parents will make the child our kill candidate of choice.
66 */ 76 */
67 list_for_each(tsk, &p->children) { 77 list_for_each_entry(child, &p->children, sibling) {
68 struct task_struct *chld; 78 task_lock(child);
69 chld = list_entry(tsk, struct task_struct, sibling); 79 if (child->mm != mm && child->mm)
70 if (chld->mm != p->mm && chld->mm) 80 points += child->mm->total_vm/2 + 1;
71 points += chld->mm->total_vm/2 + 1; 81 task_unlock(child);
72 } 82 }
73 83
74 /* 84 /*
@@ -244,17 +254,24 @@ static void __oom_kill_task(task_t *p, const char *message)
244 force_sig(SIGKILL, p); 254 force_sig(SIGKILL, p);
245} 255}
246 256
247static struct mm_struct *oom_kill_task(task_t *p, const char *message) 257static int oom_kill_task(task_t *p, const char *message)
248{ 258{
249 struct mm_struct *mm = get_task_mm(p); 259 struct mm_struct *mm;
250 task_t * g, * q; 260 task_t * g, * q;
251 261
252 if (!mm) 262 mm = p->mm;
253 return NULL; 263
254 if (mm == &init_mm) { 264 /* WARNING: mm may not be dereferenced since we did not obtain its
255 mmput(mm); 265 * value from get_task_mm(p). This is OK since all we need to do is
256 return NULL; 266 * compare mm to q->mm below.
257 } 267 *
268 * Furthermore, even if mm contains a non-NULL value, p->mm may
269 * change to NULL at any time since we do not hold task_lock(p).
270 * However, this is of no concern to us.
271 */
272
273 if (mm == NULL || mm == &init_mm)
274 return 1;
258 275
259 __oom_kill_task(p, message); 276 __oom_kill_task(p, message);
260 /* 277 /*
@@ -266,13 +283,12 @@ static struct mm_struct *oom_kill_task(task_t *p, const char *message)
266 __oom_kill_task(q, message); 283 __oom_kill_task(q, message);
267 while_each_thread(g, q); 284 while_each_thread(g, q);
268 285
269 return mm; 286 return 0;
270} 287}
271 288
272static struct mm_struct *oom_kill_process(struct task_struct *p, 289static int oom_kill_process(struct task_struct *p, unsigned long points,
273 unsigned long points, const char *message) 290 const char *message)
274{ 291{
275 struct mm_struct *mm;
276 struct task_struct *c; 292 struct task_struct *c;
277 struct list_head *tsk; 293 struct list_head *tsk;
278 294
@@ -283,9 +299,8 @@ static struct mm_struct *oom_kill_process(struct task_struct *p,
283 c = list_entry(tsk, struct task_struct, sibling); 299 c = list_entry(tsk, struct task_struct, sibling);
284 if (c->mm == p->mm) 300 if (c->mm == p->mm)
285 continue; 301 continue;
286 mm = oom_kill_task(c, message); 302 if (!oom_kill_task(c, message))
287 if (mm) 303 return 0;
288 return mm;
289 } 304 }
290 return oom_kill_task(p, message); 305 return oom_kill_task(p, message);
291} 306}
@@ -300,7 +315,6 @@ static struct mm_struct *oom_kill_process(struct task_struct *p,
300 */ 315 */
301void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) 316void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
302{ 317{
303 struct mm_struct *mm = NULL;
304 task_t *p; 318 task_t *p;
305 unsigned long points = 0; 319 unsigned long points = 0;
306 320
@@ -320,12 +334,12 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
320 */ 334 */
321 switch (constrained_alloc(zonelist, gfp_mask)) { 335 switch (constrained_alloc(zonelist, gfp_mask)) {
322 case CONSTRAINT_MEMORY_POLICY: 336 case CONSTRAINT_MEMORY_POLICY:
323 mm = oom_kill_process(current, points, 337 oom_kill_process(current, points,
324 "No available memory (MPOL_BIND)"); 338 "No available memory (MPOL_BIND)");
325 break; 339 break;
326 340
327 case CONSTRAINT_CPUSET: 341 case CONSTRAINT_CPUSET:
328 mm = oom_kill_process(current, points, 342 oom_kill_process(current, points,
329 "No available memory in cpuset"); 343 "No available memory in cpuset");
330 break; 344 break;
331 345
@@ -347,8 +361,7 @@ retry:
347 panic("Out of memory and no killable processes...\n"); 361 panic("Out of memory and no killable processes...\n");
348 } 362 }
349 363
350 mm = oom_kill_process(p, points, "Out of memory"); 364 if (oom_kill_process(p, points, "Out of memory"))
351 if (!mm)
352 goto retry; 365 goto retry;
353 366
354 break; 367 break;
@@ -357,8 +370,6 @@ retry:
357out: 370out:
358 read_unlock(&tasklist_lock); 371 read_unlock(&tasklist_lock);
359 cpuset_unlock(); 372 cpuset_unlock();
360 if (mm)
361 mmput(mm);
362 373
363 /* 374 /*
364 * Give "p" a good chance of killing itself before we 375 * Give "p" a good chance of killing itself before we
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 6dcce3a4bbdc..75d7f48b79bb 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -72,13 +72,12 @@ int dirty_background_ratio = 10;
72int vm_dirty_ratio = 40; 72int vm_dirty_ratio = 40;
73 73
74/* 74/*
75 * The interval between `kupdate'-style writebacks, in centiseconds 75 * The interval between `kupdate'-style writebacks, in jiffies
76 * (hundredths of a second)
77 */ 76 */
78int dirty_writeback_interval = 5 * HZ; 77int dirty_writeback_interval = 5 * HZ;
79 78
80/* 79/*
81 * The longest number of centiseconds for which data is allowed to remain dirty 80 * The longest number of jiffies for which data is allowed to remain dirty
82 */ 81 */
83int dirty_expire_interval = 30 * HZ; 82int dirty_expire_interval = 30 * HZ;
84 83
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dc523a1f270d..123c60586740 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -51,6 +51,7 @@ nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
51EXPORT_SYMBOL(node_possible_map); 51EXPORT_SYMBOL(node_possible_map);
52unsigned long totalram_pages __read_mostly; 52unsigned long totalram_pages __read_mostly;
53unsigned long totalhigh_pages __read_mostly; 53unsigned long totalhigh_pages __read_mostly;
54unsigned long totalreserve_pages __read_mostly;
54long nr_swap_pages; 55long nr_swap_pages;
55int percpu_pagelist_fraction; 56int percpu_pagelist_fraction;
56 57
@@ -151,7 +152,8 @@ static void bad_page(struct page *page)
151 1 << PG_reclaim | 152 1 << PG_reclaim |
152 1 << PG_slab | 153 1 << PG_slab |
153 1 << PG_swapcache | 154 1 << PG_swapcache |
154 1 << PG_writeback ); 155 1 << PG_writeback |
156 1 << PG_buddy );
155 set_page_count(page, 0); 157 set_page_count(page, 0);
156 reset_page_mapcount(page); 158 reset_page_mapcount(page);
157 page->mapping = NULL; 159 page->mapping = NULL;
@@ -230,18 +232,20 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
230 * zone->lock is already acquired when we use these. 232 * zone->lock is already acquired when we use these.
231 * So, we don't need atomic page->flags operations here. 233 * So, we don't need atomic page->flags operations here.
232 */ 234 */
233static inline unsigned long page_order(struct page *page) { 235static inline unsigned long page_order(struct page *page)
236{
234 return page_private(page); 237 return page_private(page);
235} 238}
236 239
237static inline void set_page_order(struct page *page, int order) { 240static inline void set_page_order(struct page *page, int order)
241{
238 set_page_private(page, order); 242 set_page_private(page, order);
239 __SetPagePrivate(page); 243 __SetPageBuddy(page);
240} 244}
241 245
242static inline void rmv_page_order(struct page *page) 246static inline void rmv_page_order(struct page *page)
243{ 247{
244 __ClearPagePrivate(page); 248 __ClearPageBuddy(page);
245 set_page_private(page, 0); 249 set_page_private(page, 0);
246} 250}
247 251
@@ -280,11 +284,13 @@ __find_combined_index(unsigned long page_idx, unsigned int order)
280 * This function checks whether a page is free && is the buddy 284 * This function checks whether a page is free && is the buddy
281 * we can do coalesce a page and its buddy if 285 * we can do coalesce a page and its buddy if
282 * (a) the buddy is not in a hole && 286 * (a) the buddy is not in a hole &&
283 * (b) the buddy is free && 287 * (b) the buddy is in the buddy system &&
284 * (c) the buddy is on the buddy system && 288 * (c) a page and its buddy have the same order.
285 * (d) a page and its buddy have the same order.
286 * for recording page's order, we use page_private(page) and PG_private.
287 * 289 *
290 * For recording whether a page is in the buddy system, we use PG_buddy.
291 * Setting, clearing, and testing PG_buddy is serialized by zone->lock.
292 *
293 * For recording page's order, we use page_private(page).
288 */ 294 */
289static inline int page_is_buddy(struct page *page, int order) 295static inline int page_is_buddy(struct page *page, int order)
290{ 296{
@@ -293,11 +299,11 @@ static inline int page_is_buddy(struct page *page, int order)
293 return 0; 299 return 0;
294#endif 300#endif
295 301
296 if (PagePrivate(page) && 302 if (PageBuddy(page) && page_order(page) == order) {
297 (page_order(page) == order) && 303 BUG_ON(page_count(page) != 0);
298 page_count(page) == 0) 304 return 1;
299 return 1; 305 }
300 return 0; 306 return 0;
301} 307}
302 308
303/* 309/*
@@ -313,7 +319,7 @@ static inline int page_is_buddy(struct page *page, int order)
313 * as necessary, plus some accounting needed to play nicely with other 319 * as necessary, plus some accounting needed to play nicely with other
314 * parts of the VM system. 320 * parts of the VM system.
315 * At each level, we keep a list of pages, which are heads of continuous 321 * At each level, we keep a list of pages, which are heads of continuous
316 * free pages of length of (1 << order) and marked with PG_Private.Page's 322 * free pages of length of (1 << order) and marked with PG_buddy. Page's
317 * order is recorded in page_private(page) field. 323 * order is recorded in page_private(page) field.
318 * So when we are allocating or freeing one, we can derive the state of the 324 * So when we are allocating or freeing one, we can derive the state of the
319 * other. That is, if we allocate a small block, and both were 325 * other. That is, if we allocate a small block, and both were
@@ -376,7 +382,8 @@ static inline int free_pages_check(struct page *page)
376 1 << PG_slab | 382 1 << PG_slab |
377 1 << PG_swapcache | 383 1 << PG_swapcache |
378 1 << PG_writeback | 384 1 << PG_writeback |
379 1 << PG_reserved )))) 385 1 << PG_reserved |
386 1 << PG_buddy ))))
380 bad_page(page); 387 bad_page(page);
381 if (PageDirty(page)) 388 if (PageDirty(page))
382 __ClearPageDirty(page); 389 __ClearPageDirty(page);
@@ -524,7 +531,8 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags)
524 1 << PG_slab | 531 1 << PG_slab |
525 1 << PG_swapcache | 532 1 << PG_swapcache |
526 1 << PG_writeback | 533 1 << PG_writeback |
527 1 << PG_reserved )))) 534 1 << PG_reserved |
535 1 << PG_buddy ))))
528 bad_page(page); 536 bad_page(page);
529 537
530 /* 538 /*
@@ -2472,6 +2480,38 @@ void __init page_alloc_init(void)
2472} 2480}
2473 2481
2474/* 2482/*
2483 * calculate_totalreserve_pages - called when sysctl_lower_zone_reserve_ratio
2484 * or min_free_kbytes changes.
2485 */
2486static void calculate_totalreserve_pages(void)
2487{
2488 struct pglist_data *pgdat;
2489 unsigned long reserve_pages = 0;
2490 int i, j;
2491
2492 for_each_online_pgdat(pgdat) {
2493 for (i = 0; i < MAX_NR_ZONES; i++) {
2494 struct zone *zone = pgdat->node_zones + i;
2495 unsigned long max = 0;
2496
2497 /* Find valid and maximum lowmem_reserve in the zone */
2498 for (j = i; j < MAX_NR_ZONES; j++) {
2499 if (zone->lowmem_reserve[j] > max)
2500 max = zone->lowmem_reserve[j];
2501 }
2502
2503 /* we treat pages_high as reserved pages. */
2504 max += zone->pages_high;
2505
2506 if (max > zone->present_pages)
2507 max = zone->present_pages;
2508 reserve_pages += max;
2509 }
2510 }
2511 totalreserve_pages = reserve_pages;
2512}
2513
2514/*
2475 * setup_per_zone_lowmem_reserve - called whenever 2515 * setup_per_zone_lowmem_reserve - called whenever
2476 * sysctl_lower_zone_reserve_ratio changes. Ensures that each zone 2516 * sysctl_lower_zone_reserve_ratio changes. Ensures that each zone
2477 * has a correct pages reserved value, so an adequate number of 2517 * has a correct pages reserved value, so an adequate number of
@@ -2502,6 +2542,9 @@ static void setup_per_zone_lowmem_reserve(void)
2502 } 2542 }
2503 } 2543 }
2504 } 2544 }
2545
2546 /* update totalreserve_pages */
2547 calculate_totalreserve_pages();
2505} 2548}
2506 2549
2507/* 2550/*
@@ -2556,6 +2599,9 @@ void setup_per_zone_pages_min(void)
2556 zone->pages_high = zone->pages_min + tmp / 2; 2599 zone->pages_high = zone->pages_min + tmp / 2;
2557 spin_unlock_irqrestore(&zone->lru_lock, flags); 2600 spin_unlock_irqrestore(&zone->lru_lock, flags);
2558 } 2601 }
2602
2603 /* update totalreserve_pages */
2604 calculate_totalreserve_pages();
2559} 2605}
2560 2606
2561/* 2607/*
diff --git a/mm/slab.c b/mm/slab.c
index f055c1420216..e6ef9bd52335 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -420,6 +420,7 @@ struct kmem_cache {
420 unsigned long max_freeable; 420 unsigned long max_freeable;
421 unsigned long node_allocs; 421 unsigned long node_allocs;
422 unsigned long node_frees; 422 unsigned long node_frees;
423 unsigned long node_overflow;
423 atomic_t allochit; 424 atomic_t allochit;
424 atomic_t allocmiss; 425 atomic_t allocmiss;
425 atomic_t freehit; 426 atomic_t freehit;
@@ -465,6 +466,7 @@ struct kmem_cache {
465#define STATS_INC_ERR(x) ((x)->errors++) 466#define STATS_INC_ERR(x) ((x)->errors++)
466#define STATS_INC_NODEALLOCS(x) ((x)->node_allocs++) 467#define STATS_INC_NODEALLOCS(x) ((x)->node_allocs++)
467#define STATS_INC_NODEFREES(x) ((x)->node_frees++) 468#define STATS_INC_NODEFREES(x) ((x)->node_frees++)
469#define STATS_INC_ACOVERFLOW(x) ((x)->node_overflow++)
468#define STATS_SET_FREEABLE(x, i) \ 470#define STATS_SET_FREEABLE(x, i) \
469 do { \ 471 do { \
470 if ((x)->max_freeable < i) \ 472 if ((x)->max_freeable < i) \
@@ -484,6 +486,7 @@ struct kmem_cache {
484#define STATS_INC_ERR(x) do { } while (0) 486#define STATS_INC_ERR(x) do { } while (0)
485#define STATS_INC_NODEALLOCS(x) do { } while (0) 487#define STATS_INC_NODEALLOCS(x) do { } while (0)
486#define STATS_INC_NODEFREES(x) do { } while (0) 488#define STATS_INC_NODEFREES(x) do { } while (0)
489#define STATS_INC_ACOVERFLOW(x) do { } while (0)
487#define STATS_SET_FREEABLE(x, i) do { } while (0) 490#define STATS_SET_FREEABLE(x, i) do { } while (0)
488#define STATS_INC_ALLOCHIT(x) do { } while (0) 491#define STATS_INC_ALLOCHIT(x) do { } while (0)
489#define STATS_INC_ALLOCMISS(x) do { } while (0) 492#define STATS_INC_ALLOCMISS(x) do { } while (0)
@@ -1453,7 +1456,14 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
1453 int i; 1456 int i;
1454 1457
1455 flags |= cachep->gfpflags; 1458 flags |= cachep->gfpflags;
1459#ifndef CONFIG_MMU
1460 /* nommu uses slab's for process anonymous memory allocations, so
1461 * requires __GFP_COMP to properly refcount higher order allocations"
1462 */
1463 page = alloc_pages_node(nodeid, (flags | __GFP_COMP), cachep->gfporder);
1464#else
1456 page = alloc_pages_node(nodeid, flags, cachep->gfporder); 1465 page = alloc_pages_node(nodeid, flags, cachep->gfporder);
1466#endif
1457 if (!page) 1467 if (!page)
1458 return NULL; 1468 return NULL;
1459 addr = page_address(page); 1469 addr = page_address(page);
@@ -2318,13 +2328,15 @@ EXPORT_SYMBOL(kmem_cache_destroy);
2318 2328
2319/* Get the memory for a slab management obj. */ 2329/* Get the memory for a slab management obj. */
2320static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp, 2330static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
2321 int colour_off, gfp_t local_flags) 2331 int colour_off, gfp_t local_flags,
2332 int nodeid)
2322{ 2333{
2323 struct slab *slabp; 2334 struct slab *slabp;
2324 2335
2325 if (OFF_SLAB(cachep)) { 2336 if (OFF_SLAB(cachep)) {
2326 /* Slab management obj is off-slab. */ 2337 /* Slab management obj is off-slab. */
2327 slabp = kmem_cache_alloc(cachep->slabp_cache, local_flags); 2338 slabp = kmem_cache_alloc_node(cachep->slabp_cache,
2339 local_flags, nodeid);
2328 if (!slabp) 2340 if (!slabp)
2329 return NULL; 2341 return NULL;
2330 } else { 2342 } else {
@@ -2334,6 +2346,7 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
2334 slabp->inuse = 0; 2346 slabp->inuse = 0;
2335 slabp->colouroff = colour_off; 2347 slabp->colouroff = colour_off;
2336 slabp->s_mem = objp + colour_off; 2348 slabp->s_mem = objp + colour_off;
2349 slabp->nodeid = nodeid;
2337 return slabp; 2350 return slabp;
2338} 2351}
2339 2352
@@ -2519,7 +2532,7 @@ static int cache_grow(struct kmem_cache *cachep, gfp_t flags, int nodeid)
2519 goto failed; 2532 goto failed;
2520 2533
2521 /* Get slab management. */ 2534 /* Get slab management. */
2522 slabp = alloc_slabmgmt(cachep, objp, offset, local_flags); 2535 slabp = alloc_slabmgmt(cachep, objp, offset, local_flags, nodeid);
2523 if (!slabp) 2536 if (!slabp)
2524 goto opps1; 2537 goto opps1;
2525 2538
@@ -3080,9 +3093,11 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp)
3080 if (l3->alien && l3->alien[nodeid]) { 3093 if (l3->alien && l3->alien[nodeid]) {
3081 alien = l3->alien[nodeid]; 3094 alien = l3->alien[nodeid];
3082 spin_lock(&alien->lock); 3095 spin_lock(&alien->lock);
3083 if (unlikely(alien->avail == alien->limit)) 3096 if (unlikely(alien->avail == alien->limit)) {
3097 STATS_INC_ACOVERFLOW(cachep);
3084 __drain_alien_cache(cachep, 3098 __drain_alien_cache(cachep,
3085 alien, nodeid); 3099 alien, nodeid);
3100 }
3086 alien->entry[alien->avail++] = objp; 3101 alien->entry[alien->avail++] = objp;
3087 spin_unlock(&alien->lock); 3102 spin_unlock(&alien->lock);
3088 } else { 3103 } else {
@@ -3760,7 +3775,7 @@ static void print_slabinfo_header(struct seq_file *m)
3760 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>"); 3775 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
3761#if STATS 3776#if STATS
3762 seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> " 3777 seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> "
3763 "<error> <maxfreeable> <nodeallocs> <remotefrees>"); 3778 "<error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
3764 seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>"); 3779 seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
3765#endif 3780#endif
3766 seq_putc(m, '\n'); 3781 seq_putc(m, '\n');
@@ -3874,11 +3889,12 @@ static int s_show(struct seq_file *m, void *p)
3874 unsigned long max_freeable = cachep->max_freeable; 3889 unsigned long max_freeable = cachep->max_freeable;
3875 unsigned long node_allocs = cachep->node_allocs; 3890 unsigned long node_allocs = cachep->node_allocs;
3876 unsigned long node_frees = cachep->node_frees; 3891 unsigned long node_frees = cachep->node_frees;
3892 unsigned long overflows = cachep->node_overflow;
3877 3893
3878 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \ 3894 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \
3879 %4lu %4lu %4lu %4lu", allocs, high, grown, 3895 %4lu %4lu %4lu %4lu %4lu", allocs, high, grown,
3880 reaped, errors, max_freeable, node_allocs, 3896 reaped, errors, max_freeable, node_allocs,
3881 node_frees); 3897 node_frees, overflows);
3882 } 3898 }
3883 /* cpu stats */ 3899 /* cpu stats */
3884 { 3900 {
diff --git a/mm/slob.c b/mm/slob.c
index 9bcc7e2cabfd..a68255ba4553 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -354,9 +354,7 @@ void *__alloc_percpu(size_t size)
354 if (!pdata) 354 if (!pdata)
355 return NULL; 355 return NULL;
356 356
357 for (i = 0; i < NR_CPUS; i++) { 357 for_each_possible_cpu(i) {
358 if (!cpu_possible(i))
359 continue;
360 pdata->ptrs[i] = kmalloc(size, GFP_KERNEL); 358 pdata->ptrs[i] = kmalloc(size, GFP_KERNEL);
361 if (!pdata->ptrs[i]) 359 if (!pdata->ptrs[i])
362 goto unwind_oom; 360 goto unwind_oom;
@@ -383,11 +381,9 @@ free_percpu(const void *objp)
383 int i; 381 int i;
384 struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); 382 struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);
385 383
386 for (i = 0; i < NR_CPUS; i++) { 384 for_each_possible_cpu(i)
387 if (!cpu_possible(i))
388 continue;
389 kfree(p->ptrs[i]); 385 kfree(p->ptrs[i]);
390 } 386
391 kfree(p); 387 kfree(p);
392} 388}
393EXPORT_SYMBOL(free_percpu); 389EXPORT_SYMBOL(free_percpu);
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 3ab4e7947bab..1a786bfaa416 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -2,7 +2,6 @@
2 2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5
6#include <linux/config.h> 5#include <linux/config.h>
7#include <linux/string.h> 6#include <linux/string.h>
8#include <linux/errno.h> 7#include <linux/errno.h>
@@ -54,24 +53,24 @@ static struct net_device *clip_devs;
54static struct atm_vcc *atmarpd; 53static struct atm_vcc *atmarpd;
55static struct neigh_table clip_tbl; 54static struct neigh_table clip_tbl;
56static struct timer_list idle_timer; 55static struct timer_list idle_timer;
57static int start_timer = 1;
58
59 56
60static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip) 57static int to_atmarpd(enum atmarp_ctrl_type type, int itf, unsigned long ip)
61{ 58{
62 struct sock *sk; 59 struct sock *sk;
63 struct atmarp_ctrl *ctrl; 60 struct atmarp_ctrl *ctrl;
64 struct sk_buff *skb; 61 struct sk_buff *skb;
65 62
66 DPRINTK("to_atmarpd(%d)\n",type); 63 DPRINTK("to_atmarpd(%d)\n", type);
67 if (!atmarpd) return -EUNATCH; 64 if (!atmarpd)
65 return -EUNATCH;
68 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC); 66 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC);
69 if (!skb) return -ENOMEM; 67 if (!skb)
68 return -ENOMEM;
70 ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl)); 69 ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl));
71 ctrl->type = type; 70 ctrl->type = type;
72 ctrl->itf_num = itf; 71 ctrl->itf_num = itf;
73 ctrl->ip = ip; 72 ctrl->ip = ip;
74 atm_force_charge(atmarpd,skb->truesize); 73 atm_force_charge(atmarpd, skb->truesize);
75 74
76 sk = sk_atm(atmarpd); 75 sk = sk_atm(atmarpd);
77 skb_queue_tail(&sk->sk_receive_queue, skb); 76 skb_queue_tail(&sk->sk_receive_queue, skb);
@@ -79,26 +78,24 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
79 return 0; 78 return 0;
80} 79}
81 80
82 81static void link_vcc(struct clip_vcc *clip_vcc, struct atmarp_entry *entry)
83static void link_vcc(struct clip_vcc *clip_vcc,struct atmarp_entry *entry)
84{ 82{
85 DPRINTK("link_vcc %p to entry %p (neigh %p)\n",clip_vcc,entry, 83 DPRINTK("link_vcc %p to entry %p (neigh %p)\n", clip_vcc, entry,
86 entry->neigh); 84 entry->neigh);
87 clip_vcc->entry = entry; 85 clip_vcc->entry = entry;
88 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */ 86 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */
89 clip_vcc->next = entry->vccs; 87 clip_vcc->next = entry->vccs;
90 entry->vccs = clip_vcc; 88 entry->vccs = clip_vcc;
91 entry->neigh->used = jiffies; 89 entry->neigh->used = jiffies;
92} 90}
93 91
94
95static void unlink_clip_vcc(struct clip_vcc *clip_vcc) 92static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
96{ 93{
97 struct atmarp_entry *entry = clip_vcc->entry; 94 struct atmarp_entry *entry = clip_vcc->entry;
98 struct clip_vcc **walk; 95 struct clip_vcc **walk;
99 96
100 if (!entry) { 97 if (!entry) {
101 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n",clip_vcc); 98 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n", clip_vcc);
102 return; 99 return;
103 } 100 }
104 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ 101 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */
@@ -107,24 +104,24 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
107 if (*walk == clip_vcc) { 104 if (*walk == clip_vcc) {
108 int error; 105 int error;
109 106
110 *walk = clip_vcc->next; /* atomic */ 107 *walk = clip_vcc->next; /* atomic */
111 clip_vcc->entry = NULL; 108 clip_vcc->entry = NULL;
112 if (clip_vcc->xoff) 109 if (clip_vcc->xoff)
113 netif_wake_queue(entry->neigh->dev); 110 netif_wake_queue(entry->neigh->dev);
114 if (entry->vccs) 111 if (entry->vccs)
115 goto out; 112 goto out;
116 entry->expires = jiffies-1; 113 entry->expires = jiffies - 1;
117 /* force resolution or expiration */ 114 /* force resolution or expiration */
118 error = neigh_update(entry->neigh, NULL, NUD_NONE, 115 error = neigh_update(entry->neigh, NULL, NUD_NONE,
119 NEIGH_UPDATE_F_ADMIN); 116 NEIGH_UPDATE_F_ADMIN);
120 if (error) 117 if (error)
121 printk(KERN_CRIT "unlink_clip_vcc: " 118 printk(KERN_CRIT "unlink_clip_vcc: "
122 "neigh_update failed with %d\n",error); 119 "neigh_update failed with %d\n", error);
123 goto out; 120 goto out;
124 } 121 }
125 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " 122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc "
126 "0x%p)\n",entry,clip_vcc); 123 "0x%p)\n", entry, clip_vcc);
127out: 124 out:
128 spin_unlock_bh(&entry->neigh->dev->xmit_lock); 125 spin_unlock_bh(&entry->neigh->dev->xmit_lock);
129} 126}
130 127
@@ -153,13 +150,13 @@ static int neigh_check_cb(struct neighbour *n)
153 DPRINTK("destruction postponed with ref %d\n", 150 DPRINTK("destruction postponed with ref %d\n",
154 atomic_read(&n->refcnt)); 151 atomic_read(&n->refcnt));
155 152
156 while ((skb = skb_dequeue(&n->arp_queue)) != NULL) 153 while ((skb = skb_dequeue(&n->arp_queue)) != NULL)
157 dev_kfree_skb(skb); 154 dev_kfree_skb(skb);
158 155
159 return 0; 156 return 0;
160 } 157 }
161 158
162 DPRINTK("expired neigh %p\n",n); 159 DPRINTK("expired neigh %p\n", n);
163 return 1; 160 return 1;
164} 161}
165 162
@@ -167,7 +164,7 @@ static void idle_timer_check(unsigned long dummy)
167{ 164{
168 write_lock(&clip_tbl.lock); 165 write_lock(&clip_tbl.lock);
169 __neigh_for_each_release(&clip_tbl, neigh_check_cb); 166 __neigh_for_each_release(&clip_tbl, neigh_check_cb);
170 mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ); 167 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ);
171 write_unlock(&clip_tbl.lock); 168 write_unlock(&clip_tbl.lock);
172} 169}
173 170
@@ -177,13 +174,13 @@ static int clip_arp_rcv(struct sk_buff *skb)
177 174
178 DPRINTK("clip_arp_rcv\n"); 175 DPRINTK("clip_arp_rcv\n");
179 vcc = ATM_SKB(skb)->vcc; 176 vcc = ATM_SKB(skb)->vcc;
180 if (!vcc || !atm_charge(vcc,skb->truesize)) { 177 if (!vcc || !atm_charge(vcc, skb->truesize)) {
181 dev_kfree_skb_any(skb); 178 dev_kfree_skb_any(skb);
182 return 0; 179 return 0;
183 } 180 }
184 DPRINTK("pushing to %p\n",vcc); 181 DPRINTK("pushing to %p\n", vcc);
185 DPRINTK("using %p\n",CLIP_VCC(vcc)->old_push); 182 DPRINTK("using %p\n", CLIP_VCC(vcc)->old_push);
186 CLIP_VCC(vcc)->old_push(vcc,skb); 183 CLIP_VCC(vcc)->old_push(vcc, skb);
187 return 0; 184 return 0;
188} 185}
189 186
@@ -193,34 +190,38 @@ static const unsigned char llc_oui[] = {
193 0x03, /* Ctrl: Unnumbered Information Command PDU */ 190 0x03, /* Ctrl: Unnumbered Information Command PDU */
194 0x00, /* OUI: EtherType */ 191 0x00, /* OUI: EtherType */
195 0x00, 192 0x00,
196 0x00 }; 193 0x00
194};
197 195
198static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) 196static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
199{ 197{
200 struct clip_vcc *clip_vcc = CLIP_VCC(vcc); 198 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
201 199
202 DPRINTK("clip push\n"); 200 DPRINTK("clip push\n");
203 if (!skb) { 201 if (!skb) {
204 DPRINTK("removing VCC %p\n",clip_vcc); 202 DPRINTK("removing VCC %p\n", clip_vcc);
205 if (clip_vcc->entry) unlink_clip_vcc(clip_vcc); 203 if (clip_vcc->entry)
206 clip_vcc->old_push(vcc,NULL); /* pass on the bad news */ 204 unlink_clip_vcc(clip_vcc);
205 clip_vcc->old_push(vcc, NULL); /* pass on the bad news */
207 kfree(clip_vcc); 206 kfree(clip_vcc);
208 return; 207 return;
209 } 208 }
210 atm_return(vcc,skb->truesize); 209 atm_return(vcc, skb->truesize);
211 skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs; 210 skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;
212 /* clip_vcc->entry == NULL if we don't have an IP address yet */ 211 /* clip_vcc->entry == NULL if we don't have an IP address yet */
213 if (!skb->dev) { 212 if (!skb->dev) {
214 dev_kfree_skb_any(skb); 213 dev_kfree_skb_any(skb);
215 return; 214 return;
216 } 215 }
217 ATM_SKB(skb)->vcc = vcc; 216 ATM_SKB(skb)->vcc = vcc;
218 skb->mac.raw = skb->data; 217 skb->mac.raw = skb->data;
219 if (!clip_vcc->encap || skb->len < RFC1483LLC_LEN || memcmp(skb->data, 218 if (!clip_vcc->encap
220 llc_oui,sizeof(llc_oui))) skb->protocol = htons(ETH_P_IP); 219 || skb->len < RFC1483LLC_LEN
220 || memcmp(skb->data, llc_oui, sizeof (llc_oui)))
221 skb->protocol = htons(ETH_P_IP);
221 else { 222 else {
222 skb->protocol = ((u16 *) skb->data)[3]; 223 skb->protocol = ((u16 *) skb->data)[3];
223 skb_pull(skb,RFC1483LLC_LEN); 224 skb_pull(skb, RFC1483LLC_LEN);
224 if (skb->protocol == htons(ETH_P_ARP)) { 225 if (skb->protocol == htons(ETH_P_ARP)) {
225 PRIV(skb->dev)->stats.rx_packets++; 226 PRIV(skb->dev)->stats.rx_packets++;
226 PRIV(skb->dev)->stats.rx_bytes += skb->len; 227 PRIV(skb->dev)->stats.rx_bytes += skb->len;
@@ -235,58 +236,54 @@ static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb)
235 netif_rx(skb); 236 netif_rx(skb);
236} 237}
237 238
238
239/* 239/*
240 * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that 240 * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that
241 * clip_pop is atomic with respect to the critical section in clip_start_xmit. 241 * clip_pop is atomic with respect to the critical section in clip_start_xmit.
242 */ 242 */
243 243
244 244static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
245static void clip_pop(struct atm_vcc *vcc,struct sk_buff *skb)
246{ 245{
247 struct clip_vcc *clip_vcc = CLIP_VCC(vcc); 246 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
248 struct net_device *dev = skb->dev; 247 struct net_device *dev = skb->dev;
249 int old; 248 int old;
250 unsigned long flags; 249 unsigned long flags;
251 250
252 DPRINTK("clip_pop(vcc %p)\n",vcc); 251 DPRINTK("clip_pop(vcc %p)\n", vcc);
253 clip_vcc->old_pop(vcc,skb); 252 clip_vcc->old_pop(vcc, skb);
254 /* skb->dev == NULL in outbound ARP packets */ 253 /* skb->dev == NULL in outbound ARP packets */
255 if (!dev) return; 254 if (!dev)
256 spin_lock_irqsave(&PRIV(dev)->xoff_lock,flags); 255 return;
257 if (atm_may_send(vcc,0)) { 256 spin_lock_irqsave(&PRIV(dev)->xoff_lock, flags);
258 old = xchg(&clip_vcc->xoff,0); 257 if (atm_may_send(vcc, 0)) {
259 if (old) netif_wake_queue(dev); 258 old = xchg(&clip_vcc->xoff, 0);
259 if (old)
260 netif_wake_queue(dev);
260 } 261 }
261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock,flags); 262 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags);
262} 263}
263 264
264
265static void clip_neigh_destroy(struct neighbour *neigh) 265static void clip_neigh_destroy(struct neighbour *neigh)
266{ 266{
267 DPRINTK("clip_neigh_destroy (neigh %p)\n",neigh); 267 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
268 if (NEIGH2ENTRY(neigh)->vccs) 268 if (NEIGH2ENTRY(neigh)->vccs)
269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n"); 269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
270 NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef; 270 NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef;
271} 271}
272 272
273 273static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
274static void clip_neigh_solicit(struct neighbour *neigh,struct sk_buff *skb)
275{ 274{
276 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n",neigh,skb); 275 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
277 to_atmarpd(act_need,PRIV(neigh->dev)->number,NEIGH2ENTRY(neigh)->ip); 276 to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip);
278} 277}
279 278
280 279static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb)
281static void clip_neigh_error(struct neighbour *neigh,struct sk_buff *skb)
282{ 280{
283#ifndef CONFIG_ATM_CLIP_NO_ICMP 281#ifndef CONFIG_ATM_CLIP_NO_ICMP
284 icmp_send(skb,ICMP_DEST_UNREACH,ICMP_HOST_UNREACH,0); 282 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
285#endif 283#endif
286 kfree_skb(skb); 284 kfree_skb(skb);
287} 285}
288 286
289
290static struct neigh_ops clip_neigh_ops = { 287static struct neigh_ops clip_neigh_ops = {
291 .family = AF_INET, 288 .family = AF_INET,
292 .solicit = clip_neigh_solicit, 289 .solicit = clip_neigh_solicit,
@@ -297,7 +294,6 @@ static struct neigh_ops clip_neigh_ops = {
297 .queue_xmit = dev_queue_xmit, 294 .queue_xmit = dev_queue_xmit,
298}; 295};
299 296
300
301static int clip_constructor(struct neighbour *neigh) 297static int clip_constructor(struct neighbour *neigh)
302{ 298{
303 struct atmarp_entry *entry = NEIGH2ENTRY(neigh); 299 struct atmarp_entry *entry = NEIGH2ENTRY(neigh);
@@ -305,9 +301,10 @@ static int clip_constructor(struct neighbour *neigh)
305 struct in_device *in_dev; 301 struct in_device *in_dev;
306 struct neigh_parms *parms; 302 struct neigh_parms *parms;
307 303
308 DPRINTK("clip_constructor (neigh %p, entry %p)\n",neigh,entry); 304 DPRINTK("clip_constructor (neigh %p, entry %p)\n", neigh, entry);
309 neigh->type = inet_addr_type(entry->ip); 305 neigh->type = inet_addr_type(entry->ip);
310 if (neigh->type != RTN_UNICAST) return -EINVAL; 306 if (neigh->type != RTN_UNICAST)
307 return -EINVAL;
311 308
312 rcu_read_lock(); 309 rcu_read_lock();
313 in_dev = __in_dev_get_rcu(dev); 310 in_dev = __in_dev_get_rcu(dev);
@@ -326,13 +323,13 @@ static int clip_constructor(struct neighbour *neigh)
326 neigh->ops->connected_output : neigh->ops->output; 323 neigh->ops->connected_output : neigh->ops->output;
327 entry->neigh = neigh; 324 entry->neigh = neigh;
328 entry->vccs = NULL; 325 entry->vccs = NULL;
329 entry->expires = jiffies-1; 326 entry->expires = jiffies - 1;
330 return 0; 327 return 0;
331} 328}
332 329
333static u32 clip_hash(const void *pkey, const struct net_device *dev) 330static u32 clip_hash(const void *pkey, const struct net_device *dev)
334{ 331{
335 return jhash_2words(*(u32 *)pkey, dev->ifindex, clip_tbl.hash_rnd); 332 return jhash_2words(*(u32 *) pkey, dev->ifindex, clip_tbl.hash_rnd);
336} 333}
337 334
338static struct neigh_table clip_tbl = { 335static struct neigh_table clip_tbl = {
@@ -366,7 +363,6 @@ static struct neigh_table clip_tbl = {
366 .gc_thresh3 = 1024, 363 .gc_thresh3 = 1024,
367}; 364};
368 365
369
370/* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */ 366/* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */
371 367
372/* 368/*
@@ -376,15 +372,13 @@ static struct neigh_table clip_tbl = {
376 * clip_setentry. 372 * clip_setentry.
377 */ 373 */
378 374
379 375static int clip_encap(struct atm_vcc *vcc, int mode)
380static int clip_encap(struct atm_vcc *vcc,int mode)
381{ 376{
382 CLIP_VCC(vcc)->encap = mode; 377 CLIP_VCC(vcc)->encap = mode;
383 return 0; 378 return 0;
384} 379}
385 380
386 381static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
387static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
388{ 382{
389 struct clip_priv *clip_priv = PRIV(dev); 383 struct clip_priv *clip_priv = PRIV(dev);
390 struct atmarp_entry *entry; 384 struct atmarp_entry *entry;
@@ -392,7 +386,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
392 int old; 386 int old;
393 unsigned long flags; 387 unsigned long flags;
394 388
395 DPRINTK("clip_start_xmit (skb %p)\n",skb); 389 DPRINTK("clip_start_xmit (skb %p)\n", skb);
396 if (!skb->dst) { 390 if (!skb->dst) {
397 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n"); 391 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n");
398 dev_kfree_skb(skb); 392 dev_kfree_skb(skb);
@@ -401,9 +395,9 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
401 } 395 }
402 if (!skb->dst->neighbour) { 396 if (!skb->dst->neighbour) {
403#if 0 397#if 0
404 skb->dst->neighbour = clip_find_neighbour(skb->dst,1); 398 skb->dst->neighbour = clip_find_neighbour(skb->dst, 1);
405 if (!skb->dst->neighbour) { 399 if (!skb->dst->neighbour) {
406 dev_kfree_skb(skb); /* lost that one */ 400 dev_kfree_skb(skb); /* lost that one */
407 clip_priv->stats.tx_dropped++; 401 clip_priv->stats.tx_dropped++;
408 return 0; 402 return 0;
409 } 403 }
@@ -417,73 +411,73 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
417 if (!entry->vccs) { 411 if (!entry->vccs) {
418 if (time_after(jiffies, entry->expires)) { 412 if (time_after(jiffies, entry->expires)) {
419 /* should be resolved */ 413 /* should be resolved */
420 entry->expires = jiffies+ATMARP_RETRY_DELAY*HZ; 414 entry->expires = jiffies + ATMARP_RETRY_DELAY * HZ;
421 to_atmarpd(act_need,PRIV(dev)->number,entry->ip); 415 to_atmarpd(act_need, PRIV(dev)->number, entry->ip);
422 } 416 }
423 if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS) 417 if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS)
424 skb_queue_tail(&entry->neigh->arp_queue,skb); 418 skb_queue_tail(&entry->neigh->arp_queue, skb);
425 else { 419 else {
426 dev_kfree_skb(skb); 420 dev_kfree_skb(skb);
427 clip_priv->stats.tx_dropped++; 421 clip_priv->stats.tx_dropped++;
428 } 422 }
429 return 0; 423 return 0;
430 } 424 }
431 DPRINTK("neigh %p, vccs %p\n",entry,entry->vccs); 425 DPRINTK("neigh %p, vccs %p\n", entry, entry->vccs);
432 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc; 426 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc;
433 DPRINTK("using neighbour %p, vcc %p\n",skb->dst->neighbour,vcc); 427 DPRINTK("using neighbour %p, vcc %p\n", skb->dst->neighbour, vcc);
434 if (entry->vccs->encap) { 428 if (entry->vccs->encap) {
435 void *here; 429 void *here;
436 430
437 here = skb_push(skb,RFC1483LLC_LEN); 431 here = skb_push(skb, RFC1483LLC_LEN);
438 memcpy(here,llc_oui,sizeof(llc_oui)); 432 memcpy(here, llc_oui, sizeof(llc_oui));
439 ((u16 *) here)[3] = skb->protocol; 433 ((u16 *) here)[3] = skb->protocol;
440 } 434 }
441 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 435 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
442 ATM_SKB(skb)->atm_options = vcc->atm_options; 436 ATM_SKB(skb)->atm_options = vcc->atm_options;
443 entry->vccs->last_use = jiffies; 437 entry->vccs->last_use = jiffies;
444 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev); 438 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev);
445 old = xchg(&entry->vccs->xoff,1); /* assume XOFF ... */ 439 old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */
446 if (old) { 440 if (old) {
447 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n"); 441 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n");
448 return 0; 442 return 0;
449 } 443 }
450 clip_priv->stats.tx_packets++; 444 clip_priv->stats.tx_packets++;
451 clip_priv->stats.tx_bytes += skb->len; 445 clip_priv->stats.tx_bytes += skb->len;
452 (void) vcc->send(vcc,skb); 446 vcc->send(vcc, skb);
453 if (atm_may_send(vcc,0)) { 447 if (atm_may_send(vcc, 0)) {
454 entry->vccs->xoff = 0; 448 entry->vccs->xoff = 0;
455 return 0; 449 return 0;
456 } 450 }
457 spin_lock_irqsave(&clip_priv->xoff_lock,flags); 451 spin_lock_irqsave(&clip_priv->xoff_lock, flags);
458 netif_stop_queue(dev); /* XOFF -> throttle immediately */ 452 netif_stop_queue(dev); /* XOFF -> throttle immediately */
459 barrier(); 453 barrier();
460 if (!entry->vccs->xoff) 454 if (!entry->vccs->xoff)
461 netif_start_queue(dev); 455 netif_start_queue(dev);
462 /* Oh, we just raced with clip_pop. netif_start_queue should be 456 /* Oh, we just raced with clip_pop. netif_start_queue should be
463 good enough, because nothing should really be asleep because 457 good enough, because nothing should really be asleep because
464 of the brief netif_stop_queue. If this isn't true or if it 458 of the brief netif_stop_queue. If this isn't true or if it
465 changes, use netif_wake_queue instead. */ 459 changes, use netif_wake_queue instead. */
466 spin_unlock_irqrestore(&clip_priv->xoff_lock,flags); 460 spin_unlock_irqrestore(&clip_priv->xoff_lock, flags);
467 return 0; 461 return 0;
468} 462}
469 463
470
471static struct net_device_stats *clip_get_stats(struct net_device *dev) 464static struct net_device_stats *clip_get_stats(struct net_device *dev)
472{ 465{
473 return &PRIV(dev)->stats; 466 return &PRIV(dev)->stats;
474} 467}
475 468
476 469static int clip_mkip(struct atm_vcc *vcc, int timeout)
477static int clip_mkip(struct atm_vcc *vcc,int timeout)
478{ 470{
479 struct clip_vcc *clip_vcc; 471 struct clip_vcc *clip_vcc;
480 struct sk_buff_head copy; 472 struct sk_buff_head copy;
481 struct sk_buff *skb; 473 struct sk_buff *skb;
482 474
483 if (!vcc->push) return -EBADFD; 475 if (!vcc->push)
484 clip_vcc = kmalloc(sizeof(struct clip_vcc),GFP_KERNEL); 476 return -EBADFD;
485 if (!clip_vcc) return -ENOMEM; 477 clip_vcc = kmalloc(sizeof(struct clip_vcc), GFP_KERNEL);
486 DPRINTK("mkip clip_vcc %p vcc %p\n",clip_vcc,vcc); 478 if (!clip_vcc)
479 return -ENOMEM;
480 DPRINTK("mkip clip_vcc %p vcc %p\n", clip_vcc, vcc);
487 clip_vcc->vcc = vcc; 481 clip_vcc->vcc = vcc;
488 vcc->user_back = clip_vcc; 482 vcc->user_back = clip_vcc;
489 set_bit(ATM_VF_IS_CLIP, &vcc->flags); 483 set_bit(ATM_VF_IS_CLIP, &vcc->flags);
@@ -491,7 +485,7 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout)
491 clip_vcc->xoff = 0; 485 clip_vcc->xoff = 0;
492 clip_vcc->encap = 1; 486 clip_vcc->encap = 1;
493 clip_vcc->last_use = jiffies; 487 clip_vcc->last_use = jiffies;
494 clip_vcc->idle_timeout = timeout*HZ; 488 clip_vcc->idle_timeout = timeout * HZ;
495 clip_vcc->old_push = vcc->push; 489 clip_vcc->old_push = vcc->push;
496 clip_vcc->old_pop = vcc->pop; 490 clip_vcc->old_pop = vcc->pop;
497 vcc->push = clip_push; 491 vcc->push = clip_push;
@@ -501,27 +495,25 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout)
501 /* re-process everything received between connection setup and MKIP */ 495 /* re-process everything received between connection setup and MKIP */
502 while ((skb = skb_dequeue(&copy)) != NULL) 496 while ((skb = skb_dequeue(&copy)) != NULL)
503 if (!clip_devs) { 497 if (!clip_devs) {
504 atm_return(vcc,skb->truesize); 498 atm_return(vcc, skb->truesize);
505 kfree_skb(skb); 499 kfree_skb(skb);
506 } 500 } else {
507 else {
508 unsigned int len = skb->len; 501 unsigned int len = skb->len;
509 502
510 clip_push(vcc,skb); 503 clip_push(vcc, skb);
511 PRIV(skb->dev)->stats.rx_packets--; 504 PRIV(skb->dev)->stats.rx_packets--;
512 PRIV(skb->dev)->stats.rx_bytes -= len; 505 PRIV(skb->dev)->stats.rx_bytes -= len;
513 } 506 }
514 return 0; 507 return 0;
515} 508}
516 509
517 510static int clip_setentry(struct atm_vcc *vcc, u32 ip)
518static int clip_setentry(struct atm_vcc *vcc,u32 ip)
519{ 511{
520 struct neighbour *neigh; 512 struct neighbour *neigh;
521 struct atmarp_entry *entry; 513 struct atmarp_entry *entry;
522 int error; 514 int error;
523 struct clip_vcc *clip_vcc; 515 struct clip_vcc *clip_vcc;
524 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1 } } }; 516 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1}} };
525 struct rtable *rt; 517 struct rtable *rt;
526 518
527 if (vcc->push != clip_push) { 519 if (vcc->push != clip_push) {
@@ -538,28 +530,29 @@ static int clip_setentry(struct atm_vcc *vcc,u32 ip)
538 unlink_clip_vcc(clip_vcc); 530 unlink_clip_vcc(clip_vcc);
539 return 0; 531 return 0;
540 } 532 }
541 error = ip_route_output_key(&rt,&fl); 533 error = ip_route_output_key(&rt, &fl);
542 if (error) return error; 534 if (error)
543 neigh = __neigh_lookup(&clip_tbl,&ip,rt->u.dst.dev,1); 535 return error;
536 neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1);
544 ip_rt_put(rt); 537 ip_rt_put(rt);
545 if (!neigh) 538 if (!neigh)
546 return -ENOMEM; 539 return -ENOMEM;
547 entry = NEIGH2ENTRY(neigh); 540 entry = NEIGH2ENTRY(neigh);
548 if (entry != clip_vcc->entry) { 541 if (entry != clip_vcc->entry) {
549 if (!clip_vcc->entry) DPRINTK("setentry: add\n"); 542 if (!clip_vcc->entry)
543 DPRINTK("setentry: add\n");
550 else { 544 else {
551 DPRINTK("setentry: update\n"); 545 DPRINTK("setentry: update\n");
552 unlink_clip_vcc(clip_vcc); 546 unlink_clip_vcc(clip_vcc);
553 } 547 }
554 link_vcc(clip_vcc,entry); 548 link_vcc(clip_vcc, entry);
555 } 549 }
556 error = neigh_update(neigh, llc_oui, NUD_PERMANENT, 550 error = neigh_update(neigh, llc_oui, NUD_PERMANENT,
557 NEIGH_UPDATE_F_OVERRIDE|NEIGH_UPDATE_F_ADMIN); 551 NEIGH_UPDATE_F_OVERRIDE | NEIGH_UPDATE_F_ADMIN);
558 neigh_release(neigh); 552 neigh_release(neigh);
559 return error; 553 return error;
560} 554}
561 555
562
563static void clip_setup(struct net_device *dev) 556static void clip_setup(struct net_device *dev)
564{ 557{
565 dev->hard_start_xmit = clip_start_xmit; 558 dev->hard_start_xmit = clip_start_xmit;
@@ -568,15 +561,14 @@ static void clip_setup(struct net_device *dev)
568 dev->type = ARPHRD_ATM; 561 dev->type = ARPHRD_ATM;
569 dev->hard_header_len = RFC1483LLC_LEN; 562 dev->hard_header_len = RFC1483LLC_LEN;
570 dev->mtu = RFC1626_MTU; 563 dev->mtu = RFC1626_MTU;
571 dev->tx_queue_len = 100; /* "normal" queue (packets) */ 564 dev->tx_queue_len = 100; /* "normal" queue (packets) */
572 /* When using a "real" qdisc, the qdisc determines the queue */ 565 /* When using a "real" qdisc, the qdisc determines the queue */
573 /* length. tx_queue_len is only used for the default case, */ 566 /* length. tx_queue_len is only used for the default case, */
574 /* without any more elaborate queuing. 100 is a reasonable */ 567 /* without any more elaborate queuing. 100 is a reasonable */
575 /* compromise between decent burst-tolerance and protection */ 568 /* compromise between decent burst-tolerance and protection */
576 /* against memory hogs. */ 569 /* against memory hogs. */
577} 570}
578 571
579
580static int clip_create(int number) 572static int clip_create(int number)
581{ 573{
582 struct net_device *dev; 574 struct net_device *dev;
@@ -585,19 +577,19 @@ static int clip_create(int number)
585 577
586 if (number != -1) { 578 if (number != -1) {
587 for (dev = clip_devs; dev; dev = PRIV(dev)->next) 579 for (dev = clip_devs; dev; dev = PRIV(dev)->next)
588 if (PRIV(dev)->number == number) return -EEXIST; 580 if (PRIV(dev)->number == number)
589 } 581 return -EEXIST;
590 else { 582 } else {
591 number = 0; 583 number = 0;
592 for (dev = clip_devs; dev; dev = PRIV(dev)->next) 584 for (dev = clip_devs; dev; dev = PRIV(dev)->next)
593 if (PRIV(dev)->number >= number) 585 if (PRIV(dev)->number >= number)
594 number = PRIV(dev)->number+1; 586 number = PRIV(dev)->number + 1;
595 } 587 }
596 dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup); 588 dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup);
597 if (!dev) 589 if (!dev)
598 return -ENOMEM; 590 return -ENOMEM;
599 clip_priv = PRIV(dev); 591 clip_priv = PRIV(dev);
600 sprintf(dev->name,"atm%d",number); 592 sprintf(dev->name, "atm%d", number);
601 spin_lock_init(&clip_priv->xoff_lock); 593 spin_lock_init(&clip_priv->xoff_lock);
602 clip_priv->number = number; 594 clip_priv->number = number;
603 error = register_netdev(dev); 595 error = register_netdev(dev);
@@ -607,53 +599,48 @@ static int clip_create(int number)
607 } 599 }
608 clip_priv->next = clip_devs; 600 clip_priv->next = clip_devs;
609 clip_devs = dev; 601 clip_devs = dev;
610 DPRINTK("registered (net:%s)\n",dev->name); 602 DPRINTK("registered (net:%s)\n", dev->name);
611 return number; 603 return number;
612} 604}
613 605
614 606static int clip_device_event(struct notifier_block *this, unsigned long event,
615static int clip_device_event(struct notifier_block *this,unsigned long event, 607 void *arg)
616 void *dev)
617{ 608{
609 struct net_device *dev = arg;
610
611 if (event == NETDEV_UNREGISTER) {
612 neigh_ifdown(&clip_tbl, dev);
613 return NOTIFY_DONE;
614 }
615
618 /* ignore non-CLIP devices */ 616 /* ignore non-CLIP devices */
619 if (((struct net_device *) dev)->type != ARPHRD_ATM || 617 if (dev->type != ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit)
620 ((struct net_device *) dev)->hard_start_xmit != clip_start_xmit)
621 return NOTIFY_DONE; 618 return NOTIFY_DONE;
619
622 switch (event) { 620 switch (event) {
623 case NETDEV_UP: 621 case NETDEV_UP:
624 DPRINTK("clip_device_event NETDEV_UP\n"); 622 DPRINTK("clip_device_event NETDEV_UP\n");
625 (void) to_atmarpd(act_up,PRIV(dev)->number,0); 623 to_atmarpd(act_up, PRIV(dev)->number, 0);
626 break; 624 break;
627 case NETDEV_GOING_DOWN: 625 case NETDEV_GOING_DOWN:
628 DPRINTK("clip_device_event NETDEV_DOWN\n"); 626 DPRINTK("clip_device_event NETDEV_DOWN\n");
629 (void) to_atmarpd(act_down,PRIV(dev)->number,0); 627 to_atmarpd(act_down, PRIV(dev)->number, 0);
630 break; 628 break;
631 case NETDEV_CHANGE: 629 case NETDEV_CHANGE:
632 case NETDEV_CHANGEMTU: 630 case NETDEV_CHANGEMTU:
633 DPRINTK("clip_device_event NETDEV_CHANGE*\n"); 631 DPRINTK("clip_device_event NETDEV_CHANGE*\n");
634 (void) to_atmarpd(act_change,PRIV(dev)->number,0); 632 to_atmarpd(act_change, PRIV(dev)->number, 0);
635 break; 633 break;
636 case NETDEV_REBOOT:
637 case NETDEV_REGISTER:
638 case NETDEV_DOWN:
639 DPRINTK("clip_device_event %ld\n",event);
640 /* ignore */
641 break;
642 default:
643 printk(KERN_WARNING "clip_device_event: unknown event "
644 "%ld\n",event);
645 break;
646 } 634 }
647 return NOTIFY_DONE; 635 return NOTIFY_DONE;
648} 636}
649 637
650 638static int clip_inet_event(struct notifier_block *this, unsigned long event,
651static int clip_inet_event(struct notifier_block *this,unsigned long event, 639 void *ifa)
652 void *ifa)
653{ 640{
654 struct in_device *in_dev; 641 struct in_device *in_dev;
655 642
656 in_dev = ((struct in_ifaddr *) ifa)->ifa_dev; 643 in_dev = ((struct in_ifaddr *)ifa)->ifa_dev;
657 if (!in_dev || !in_dev->dev) { 644 if (!in_dev || !in_dev->dev) {
658 printk(KERN_WARNING "clip_inet_event: no device\n"); 645 printk(KERN_WARNING "clip_inet_event: no device\n");
659 return NOTIFY_DONE; 646 return NOTIFY_DONE;
@@ -662,23 +649,20 @@ static int clip_inet_event(struct notifier_block *this,unsigned long event,
662 * Transitions are of the down-change-up type, so it's sufficient to 649 * Transitions are of the down-change-up type, so it's sufficient to
663 * handle the change on up. 650 * handle the change on up.
664 */ 651 */
665 if (event != NETDEV_UP) return NOTIFY_DONE; 652 if (event != NETDEV_UP)
666 return clip_device_event(this,NETDEV_CHANGE,in_dev->dev); 653 return NOTIFY_DONE;
654 return clip_device_event(this, NETDEV_CHANGE, in_dev->dev);
667} 655}
668 656
669 657
670static struct notifier_block clip_dev_notifier = { 658static struct notifier_block clip_dev_notifier = {
671 clip_device_event, 659 .notifier_call = clip_device_event,
672 NULL,
673 0
674}; 660};
675 661
676 662
677 663
678static struct notifier_block clip_inet_notifier = { 664static struct notifier_block clip_inet_notifier = {
679 clip_inet_event, 665 .notifier_call = clip_inet_event,
680 NULL,
681 0
682}; 666};
683 667
684 668
@@ -686,14 +670,12 @@ static struct notifier_block clip_inet_notifier = {
686static void atmarpd_close(struct atm_vcc *vcc) 670static void atmarpd_close(struct atm_vcc *vcc)
687{ 671{
688 DPRINTK("atmarpd_close\n"); 672 DPRINTK("atmarpd_close\n");
689 atmarpd = NULL; /* assumed to be atomic */ 673
690 barrier(); 674 rtnl_lock();
691 unregister_inetaddr_notifier(&clip_inet_notifier); 675 atmarpd = NULL;
692 unregister_netdevice_notifier(&clip_dev_notifier);
693 if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
694 printk(KERN_ERR "atmarpd_close: closing with requests "
695 "pending\n");
696 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue); 676 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);
677 rtnl_unlock();
678
697 DPRINTK("(done)\n"); 679 DPRINTK("(done)\n");
698 module_put(THIS_MODULE); 680 module_put(THIS_MODULE);
699} 681}
@@ -714,14 +696,14 @@ static struct atm_dev atmarpd_dev = {
714 696
715static int atm_init_atmarp(struct atm_vcc *vcc) 697static int atm_init_atmarp(struct atm_vcc *vcc)
716{ 698{
717 if (atmarpd) return -EADDRINUSE; 699 rtnl_lock();
718 if (start_timer) { 700 if (atmarpd) {
719 start_timer = 0; 701 rtnl_unlock();
720 init_timer(&idle_timer); 702 return -EADDRINUSE;
721 idle_timer.expires = jiffies+CLIP_CHECK_INTERVAL*HZ;
722 idle_timer.function = idle_timer_check;
723 add_timer(&idle_timer);
724 } 703 }
704
705 mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ);
706
725 atmarpd = vcc; 707 atmarpd = vcc;
726 set_bit(ATM_VF_META,&vcc->flags); 708 set_bit(ATM_VF_META,&vcc->flags);
727 set_bit(ATM_VF_READY,&vcc->flags); 709 set_bit(ATM_VF_READY,&vcc->flags);
@@ -731,10 +713,7 @@ static int atm_init_atmarp(struct atm_vcc *vcc)
731 vcc->push = NULL; 713 vcc->push = NULL;
732 vcc->pop = NULL; /* crash */ 714 vcc->pop = NULL; /* crash */
733 vcc->push_oam = NULL; /* crash */ 715 vcc->push_oam = NULL; /* crash */
734 if (register_netdevice_notifier(&clip_dev_notifier)) 716 rtnl_unlock();
735 printk(KERN_ERR "register_netdevice_notifier failed\n");
736 if (register_inetaddr_notifier(&clip_inet_notifier))
737 printk(KERN_ERR "register_inetaddr_notifier failed\n");
738 return 0; 717 return 0;
739} 718}
740 719
@@ -744,53 +723,53 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
744 int err = 0; 723 int err = 0;
745 724
746 switch (cmd) { 725 switch (cmd) {
747 case SIOCMKCLIP: 726 case SIOCMKCLIP:
748 case ATMARPD_CTRL: 727 case ATMARPD_CTRL:
749 case ATMARP_MKIP: 728 case ATMARP_MKIP:
750 case ATMARP_SETENTRY: 729 case ATMARP_SETENTRY:
751 case ATMARP_ENCAP: 730 case ATMARP_ENCAP:
752 if (!capable(CAP_NET_ADMIN)) 731 if (!capable(CAP_NET_ADMIN))
753 return -EPERM; 732 return -EPERM;
754 break; 733 break;
755 default: 734 default:
756 return -ENOIOCTLCMD; 735 return -ENOIOCTLCMD;
757 } 736 }
758 737
759 switch (cmd) { 738 switch (cmd) {
760 case SIOCMKCLIP: 739 case SIOCMKCLIP:
761 err = clip_create(arg); 740 err = clip_create(arg);
762 break; 741 break;
763 case ATMARPD_CTRL: 742 case ATMARPD_CTRL:
764 err = atm_init_atmarp(vcc); 743 err = atm_init_atmarp(vcc);
765 if (!err) { 744 if (!err) {
766 sock->state = SS_CONNECTED; 745 sock->state = SS_CONNECTED;
767 __module_get(THIS_MODULE); 746 __module_get(THIS_MODULE);
768 } 747 }
769 break; 748 break;
770 case ATMARP_MKIP: 749 case ATMARP_MKIP:
771 err = clip_mkip(vcc ,arg); 750 err = clip_mkip(vcc, arg);
772 break; 751 break;
773 case ATMARP_SETENTRY: 752 case ATMARP_SETENTRY:
774 err = clip_setentry(vcc, arg); 753 err = clip_setentry(vcc, arg);
775 break; 754 break;
776 case ATMARP_ENCAP: 755 case ATMARP_ENCAP:
777 err = clip_encap(vcc, arg); 756 err = clip_encap(vcc, arg);
778 break; 757 break;
779 } 758 }
780 return err; 759 return err;
781} 760}
782 761
783static struct atm_ioctl clip_ioctl_ops = { 762static struct atm_ioctl clip_ioctl_ops = {
784 .owner = THIS_MODULE, 763 .owner = THIS_MODULE,
785 .ioctl = clip_ioctl, 764 .ioctl = clip_ioctl,
786}; 765};
787 766
788#ifdef CONFIG_PROC_FS 767#ifdef CONFIG_PROC_FS
789 768
790static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) 769static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
791{ 770{
792 static int code[] = { 1,2,10,6,1,0 }; 771 static int code[] = { 1, 2, 10, 6, 1, 0 };
793 static int e164[] = { 1,8,4,6,1,0 }; 772 static int e164[] = { 1, 8, 4, 6, 1, 0 };
794 773
795 if (*addr->sas_addr.pub) { 774 if (*addr->sas_addr.pub) {
796 seq_printf(seq, "%s", addr->sas_addr.pub); 775 seq_printf(seq, "%s", addr->sas_addr.pub);
@@ -809,7 +788,7 @@ static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
809 for (i = 0; fields[i]; i++) { 788 for (i = 0; fields[i]; i++) {
810 for (j = fields[i]; j; j--) 789 for (j = fields[i]; j; j--)
811 seq_printf(seq, "%02X", *prv++); 790 seq_printf(seq, "%02X", *prv++);
812 if (fields[i+1]) 791 if (fields[i + 1])
813 seq_putc(seq, '.'); 792 seq_putc(seq, '.');
814 } 793 }
815 } 794 }
@@ -828,8 +807,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
828 svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || 807 svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) ||
829 (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC)); 808 (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC));
830 809
831 llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || 810 llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || clip_vcc->encap);
832 clip_vcc->encap);
833 811
834 if (clip_vcc == SEQ_NO_VCC_TOKEN) 812 if (clip_vcc == SEQ_NO_VCC_TOKEN)
835 exp = entry->neigh->used; 813 exp = entry->neigh->used;
@@ -839,10 +817,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
839 exp = (jiffies - exp) / HZ; 817 exp = (jiffies - exp) / HZ;
840 818
841 seq_printf(seq, "%-6s%-4s%-4s%5ld ", 819 seq_printf(seq, "%-6s%-4s%-4s%5ld ",
842 dev->name, 820 dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp);
843 svc ? "SVC" : "PVC",
844 llc ? "LLC" : "NULL",
845 exp);
846 821
847 off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", 822 off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d",
848 NIPQUAD(entry->ip)); 823 NIPQUAD(entry->ip));
@@ -860,8 +835,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
860 } else if (!svc) { 835 } else if (!svc) {
861 seq_printf(seq, "%d.%d.%d\n", 836 seq_printf(seq, "%d.%d.%d\n",
862 clip_vcc->vcc->dev->number, 837 clip_vcc->vcc->dev->number,
863 clip_vcc->vcc->vpi, 838 clip_vcc->vcc->vpi, clip_vcc->vcc->vci);
864 clip_vcc->vcc->vci);
865 } else { 839 } else {
866 svc_addr(seq, &clip_vcc->vcc->remote); 840 svc_addr(seq, &clip_vcc->vcc->remote);
867 seq_putc(seq, '\n'); 841 seq_putc(seq, '\n');
@@ -894,7 +868,7 @@ static struct clip_vcc *clip_seq_next_vcc(struct atmarp_entry *e,
894} 868}
895 869
896static void *clip_seq_vcc_walk(struct clip_seq_state *state, 870static void *clip_seq_vcc_walk(struct clip_seq_state *state,
897 struct atmarp_entry *e, loff_t *pos) 871 struct atmarp_entry *e, loff_t * pos)
898{ 872{
899 struct clip_vcc *vcc = state->vcc; 873 struct clip_vcc *vcc = state->vcc;
900 874
@@ -911,24 +885,24 @@ static void *clip_seq_vcc_walk(struct clip_seq_state *state,
911 885
912 return vcc; 886 return vcc;
913} 887}
914 888
915static void *clip_seq_sub_iter(struct neigh_seq_state *_state, 889static void *clip_seq_sub_iter(struct neigh_seq_state *_state,
916 struct neighbour *n, loff_t *pos) 890 struct neighbour *n, loff_t * pos)
917{ 891{
918 struct clip_seq_state *state = (struct clip_seq_state *) _state; 892 struct clip_seq_state *state = (struct clip_seq_state *)_state;
919 893
920 return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos); 894 return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos);
921} 895}
922 896
923static void *clip_seq_start(struct seq_file *seq, loff_t *pos) 897static void *clip_seq_start(struct seq_file *seq, loff_t * pos)
924{ 898{
925 return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY); 899 return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY);
926} 900}
927 901
928static int clip_seq_show(struct seq_file *seq, void *v) 902static int clip_seq_show(struct seq_file *seq, void *v)
929{ 903{
930 static char atm_arp_banner[] = 904 static char atm_arp_banner[] =
931 "IPitf TypeEncp Idle IP address ATM address\n"; 905 "IPitf TypeEncp Idle IP address ATM address\n";
932 906
933 if (v == SEQ_START_TOKEN) { 907 if (v == SEQ_START_TOKEN) {
934 seq_puts(seq, atm_arp_banner); 908 seq_puts(seq, atm_arp_banner);
@@ -939,7 +913,7 @@ static int clip_seq_show(struct seq_file *seq, void *v)
939 913
940 atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc); 914 atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc);
941 } 915 }
942 return 0; 916 return 0;
943} 917}
944 918
945static struct seq_operations arp_seq_ops = { 919static struct seq_operations arp_seq_ops = {
@@ -988,20 +962,19 @@ static struct file_operations arp_seq_fops = {
988 962
989static int __init atm_clip_init(void) 963static int __init atm_clip_init(void)
990{ 964{
965 struct proc_dir_entry *p;
991 neigh_table_init(&clip_tbl); 966 neigh_table_init(&clip_tbl);
992 967
993 clip_tbl_hook = &clip_tbl; 968 clip_tbl_hook = &clip_tbl;
994 register_atm_ioctl(&clip_ioctl_ops); 969 register_atm_ioctl(&clip_ioctl_ops);
970 register_netdevice_notifier(&clip_dev_notifier);
971 register_inetaddr_notifier(&clip_inet_notifier);
995 972
996#ifdef CONFIG_PROC_FS 973 setup_timer(&idle_timer, idle_timer_check, 0);
997{
998 struct proc_dir_entry *p;
999 974
1000 p = create_proc_entry("arp", S_IRUGO, atm_proc_root); 975 p = create_proc_entry("arp", S_IRUGO, atm_proc_root);
1001 if (p) 976 if (p)
1002 p->proc_fops = &arp_seq_fops; 977 p->proc_fops = &arp_seq_fops;
1003}
1004#endif
1005 978
1006 return 0; 979 return 0;
1007} 980}
@@ -1012,13 +985,15 @@ static void __exit atm_clip_exit(void)
1012 985
1013 remove_proc_entry("arp", atm_proc_root); 986 remove_proc_entry("arp", atm_proc_root);
1014 987
988 unregister_inetaddr_notifier(&clip_inet_notifier);
989 unregister_netdevice_notifier(&clip_dev_notifier);
990
1015 deregister_atm_ioctl(&clip_ioctl_ops); 991 deregister_atm_ioctl(&clip_ioctl_ops);
1016 992
1017 /* First, stop the idle timer, so it stops banging 993 /* First, stop the idle timer, so it stops banging
1018 * on the table. 994 * on the table.
1019 */ 995 */
1020 if (start_timer == 0) 996 del_timer_sync(&idle_timer);
1021 del_timer(&idle_timer);
1022 997
1023 /* Next, purge the table, so that the device 998 /* Next, purge the table, so that the device
1024 * unregister loop below does not hang due to 999 * unregister loop below does not hang due to
@@ -1042,5 +1017,6 @@ static void __exit atm_clip_exit(void)
1042 1017
1043module_init(atm_clip_init); 1018module_init(atm_clip_init);
1044module_exit(atm_clip_exit); 1019module_exit(atm_clip_exit);
1045 1020MODULE_AUTHOR("Werner Almesberger");
1021MODULE_DESCRIPTION("Classical/IP over ATM interface");
1046MODULE_LICENSE("GPL"); 1022MODULE_LICENSE("GPL");
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 6b61323ce23c..0c2d13ad69bb 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -255,7 +255,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
255 } 255 }
256 256
257 if ((err = hci_send_sco(conn->hcon, skb)) < 0) 257 if ((err = hci_send_sco(conn->hcon, skb)) < 0)
258 goto fail; 258 return err;
259 259
260 return count; 260 return count;
261 261
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index b7766562d72c..b0b7f55c1edd 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -125,9 +125,6 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
125 struct sk_buff *skb = *pskb; 125 struct sk_buff *skb = *pskb;
126 const unsigned char *dest = eth_hdr(skb)->h_dest; 126 const unsigned char *dest = eth_hdr(skb)->h_dest;
127 127
128 if (p->state == BR_STATE_DISABLED)
129 goto err;
130
131 if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) 128 if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
132 goto err; 129 goto err;
133 130
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index f29450b788be..3da9264449f7 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -765,6 +765,15 @@ out:
765 return NF_STOLEN; 765 return NF_STOLEN;
766} 766}
767 767
768static int br_nf_dev_queue_xmit(struct sk_buff *skb)
769{
770 if (skb->protocol == htons(ETH_P_IP) &&
771 skb->len > skb->dev->mtu &&
772 !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size))
773 return ip_fragment(skb, br_dev_queue_push_xmit);
774 else
775 return br_dev_queue_push_xmit(skb);
776}
768 777
769/* PF_BRIDGE/POST_ROUTING ********************************************/ 778/* PF_BRIDGE/POST_ROUTING ********************************************/
770static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, 779static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
@@ -824,7 +833,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
824 realoutdev = nf_bridge->netoutdev; 833 realoutdev = nf_bridge->netoutdev;
825#endif 834#endif
826 NF_HOOK(pf, NF_IP_POST_ROUTING, skb, NULL, realoutdev, 835 NF_HOOK(pf, NF_IP_POST_ROUTING, skb, NULL, realoutdev,
827 br_dev_queue_push_xmit); 836 br_nf_dev_queue_xmit);
828 837
829 return NF_STOLEN; 838 return NF_STOLEN;
830 839
@@ -869,7 +878,7 @@ static unsigned int ip_sabotage_out(unsigned int hook, struct sk_buff **pskb,
869 878
870 if ((out->hard_start_xmit == br_dev_xmit && 879 if ((out->hard_start_xmit == br_dev_xmit &&
871 okfn != br_nf_forward_finish && 880 okfn != br_nf_forward_finish &&
872 okfn != br_nf_local_out_finish && okfn != br_dev_queue_push_xmit) 881 okfn != br_nf_local_out_finish && okfn != br_nf_dev_queue_xmit)
873#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 882#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
874 || ((out->priv_flags & IFF_802_1Q_VLAN) && 883 || ((out->priv_flags & IFF_802_1Q_VLAN) &&
875 VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit) 884 VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 01eae97c53d9..3a13ed643459 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -824,14 +824,14 @@ static int translate_table(struct ebt_replace *repl,
824 if (udc_cnt) { 824 if (udc_cnt) {
825 /* this will get free'd in do_replace()/ebt_register_table() 825 /* this will get free'd in do_replace()/ebt_register_table()
826 if an error occurs */ 826 if an error occurs */
827 newinfo->chainstack = (struct ebt_chainstack **) 827 newinfo->chainstack =
828 vmalloc((highest_possible_processor_id()+1) 828 vmalloc((highest_possible_processor_id()+1)
829 * sizeof(struct ebt_chainstack)); 829 * sizeof(*(newinfo->chainstack)));
830 if (!newinfo->chainstack) 830 if (!newinfo->chainstack)
831 return -ENOMEM; 831 return -ENOMEM;
832 for_each_cpu(i) { 832 for_each_possible_cpu(i) {
833 newinfo->chainstack[i] = 833 newinfo->chainstack[i] =
834 vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); 834 vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0])));
835 if (!newinfo->chainstack[i]) { 835 if (!newinfo->chainstack[i]) {
836 while (i) 836 while (i)
837 vfree(newinfo->chainstack[--i]); 837 vfree(newinfo->chainstack[--i]);
@@ -841,8 +841,7 @@ static int translate_table(struct ebt_replace *repl,
841 } 841 }
842 } 842 }
843 843
844 cl_s = (struct ebt_cl_stack *) 844 cl_s = vmalloc(udc_cnt * sizeof(*cl_s));
845 vmalloc(udc_cnt * sizeof(struct ebt_cl_stack));
846 if (!cl_s) 845 if (!cl_s)
847 return -ENOMEM; 846 return -ENOMEM;
848 i = 0; /* the i'th udc */ 847 i = 0; /* the i'th udc */
@@ -901,7 +900,7 @@ static void get_counters(struct ebt_counter *oldcounters,
901 sizeof(struct ebt_counter) * nentries); 900 sizeof(struct ebt_counter) * nentries);
902 901
903 /* add other counters to those of cpu 0 */ 902 /* add other counters to those of cpu 0 */
904 for_each_cpu(cpu) { 903 for_each_possible_cpu(cpu) {
905 if (cpu == 0) 904 if (cpu == 0)
906 continue; 905 continue;
907 counter_base = COUNTER_BASE(oldcounters, nentries, cpu); 906 counter_base = COUNTER_BASE(oldcounters, nentries, cpu);
@@ -944,8 +943,7 @@ static int do_replace(void __user *user, unsigned int len)
944 943
945 countersize = COUNTER_OFFSET(tmp.nentries) * 944 countersize = COUNTER_OFFSET(tmp.nentries) *
946 (highest_possible_processor_id()+1); 945 (highest_possible_processor_id()+1);
947 newinfo = (struct ebt_table_info *) 946 newinfo = vmalloc(sizeof(*newinfo) + countersize);
948 vmalloc(sizeof(struct ebt_table_info) + countersize);
949 if (!newinfo) 947 if (!newinfo)
950 return -ENOMEM; 948 return -ENOMEM;
951 949
@@ -967,8 +965,7 @@ static int do_replace(void __user *user, unsigned int len)
967 /* the user wants counters back 965 /* the user wants counters back
968 the check on the size is done later, when we have the lock */ 966 the check on the size is done later, when we have the lock */
969 if (tmp.num_counters) { 967 if (tmp.num_counters) {
970 counterstmp = (struct ebt_counter *) 968 counterstmp = vmalloc(tmp.num_counters * sizeof(*counterstmp));
971 vmalloc(tmp.num_counters * sizeof(struct ebt_counter));
972 if (!counterstmp) { 969 if (!counterstmp) {
973 ret = -ENOMEM; 970 ret = -ENOMEM;
974 goto free_entries; 971 goto free_entries;
@@ -1036,7 +1033,7 @@ static int do_replace(void __user *user, unsigned int len)
1036 1033
1037 vfree(table->entries); 1034 vfree(table->entries);
1038 if (table->chainstack) { 1035 if (table->chainstack) {
1039 for_each_cpu(i) 1036 for_each_possible_cpu(i)
1040 vfree(table->chainstack[i]); 1037 vfree(table->chainstack[i]);
1041 vfree(table->chainstack); 1038 vfree(table->chainstack);
1042 } 1039 }
@@ -1054,7 +1051,7 @@ free_counterstmp:
1054 vfree(counterstmp); 1051 vfree(counterstmp);
1055 /* can be initialized in translate_table() */ 1052 /* can be initialized in translate_table() */
1056 if (newinfo->chainstack) { 1053 if (newinfo->chainstack) {
1057 for_each_cpu(i) 1054 for_each_possible_cpu(i)
1058 vfree(newinfo->chainstack[i]); 1055 vfree(newinfo->chainstack[i]);
1059 vfree(newinfo->chainstack); 1056 vfree(newinfo->chainstack);
1060 } 1057 }
@@ -1148,8 +1145,7 @@ int ebt_register_table(struct ebt_table *table)
1148 1145
1149 countersize = COUNTER_OFFSET(table->table->nentries) * 1146 countersize = COUNTER_OFFSET(table->table->nentries) *
1150 (highest_possible_processor_id()+1); 1147 (highest_possible_processor_id()+1);
1151 newinfo = (struct ebt_table_info *) 1148 newinfo = vmalloc(sizeof(*newinfo) + countersize);
1152 vmalloc(sizeof(struct ebt_table_info) + countersize);
1153 ret = -ENOMEM; 1149 ret = -ENOMEM;
1154 if (!newinfo) 1150 if (!newinfo)
1155 return -ENOMEM; 1151 return -ENOMEM;
@@ -1201,7 +1197,7 @@ free_unlock:
1201 mutex_unlock(&ebt_mutex); 1197 mutex_unlock(&ebt_mutex);
1202free_chainstack: 1198free_chainstack:
1203 if (newinfo->chainstack) { 1199 if (newinfo->chainstack) {
1204 for_each_cpu(i) 1200 for_each_possible_cpu(i)
1205 vfree(newinfo->chainstack[i]); 1201 vfree(newinfo->chainstack[i]);
1206 vfree(newinfo->chainstack); 1202 vfree(newinfo->chainstack);
1207 } 1203 }
@@ -1224,7 +1220,7 @@ void ebt_unregister_table(struct ebt_table *table)
1224 mutex_unlock(&ebt_mutex); 1220 mutex_unlock(&ebt_mutex);
1225 vfree(table->private->entries); 1221 vfree(table->private->entries);
1226 if (table->private->chainstack) { 1222 if (table->private->chainstack) {
1227 for_each_cpu(i) 1223 for_each_possible_cpu(i)
1228 vfree(table->private->chainstack[i]); 1224 vfree(table->private->chainstack[i]);
1229 vfree(table->private->chainstack); 1225 vfree(table->private->chainstack);
1230 } 1226 }
@@ -1247,8 +1243,7 @@ static int update_counters(void __user *user, unsigned int len)
1247 if (hlp.num_counters == 0) 1243 if (hlp.num_counters == 0)
1248 return -EINVAL; 1244 return -EINVAL;
1249 1245
1250 if ( !(tmp = (struct ebt_counter *) 1246 if (!(tmp = vmalloc(hlp.num_counters * sizeof(*tmp)))) {
1251 vmalloc(hlp.num_counters * sizeof(struct ebt_counter))) ){
1252 MEMPRINT("Update_counters && nomemory\n"); 1247 MEMPRINT("Update_counters && nomemory\n");
1253 return -ENOMEM; 1248 return -ENOMEM;
1254 } 1249 }
@@ -1377,8 +1372,7 @@ static int copy_everything_to_user(struct ebt_table *t, void __user *user,
1377 BUGPRINT("Num_counters wrong\n"); 1372 BUGPRINT("Num_counters wrong\n");
1378 return -EINVAL; 1373 return -EINVAL;
1379 } 1374 }
1380 counterstmp = (struct ebt_counter *) 1375 counterstmp = vmalloc(nentries * sizeof(*counterstmp));
1381 vmalloc(nentries * sizeof(struct ebt_counter));
1382 if (!counterstmp) { 1376 if (!counterstmp) {
1383 MEMPRINT("Couldn't copy counters, out of memory\n"); 1377 MEMPRINT("Couldn't copy counters, out of memory\n");
1384 return -ENOMEM; 1378 return -ENOMEM;
diff --git a/net/core/dev.c b/net/core/dev.c
index 434220d093aa..3bad1afc89fa 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2698,7 +2698,8 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
2698 /* If command is `set a parameter', or 2698 /* If command is `set a parameter', or
2699 * `get the encoding parameters', check if 2699 * `get the encoding parameters', check if
2700 * the user has the right to do it */ 2700 * the user has the right to do it */
2701 if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE) { 2701 if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE
2702 || cmd == SIOCGIWENCODEEXT) {
2702 if (!capable(CAP_NET_ADMIN)) 2703 if (!capable(CAP_NET_ADMIN))
2703 return -EPERM; 2704 return -EPERM;
2704 } 2705 }
@@ -3042,11 +3043,11 @@ void netdev_run_todo(void)
3042 3043
3043 switch(dev->reg_state) { 3044 switch(dev->reg_state) {
3044 case NETREG_REGISTERING: 3045 case NETREG_REGISTERING:
3046 dev->reg_state = NETREG_REGISTERED;
3045 err = netdev_register_sysfs(dev); 3047 err = netdev_register_sysfs(dev);
3046 if (err) 3048 if (err)
3047 printk(KERN_ERR "%s: failed sysfs registration (%d)\n", 3049 printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
3048 dev->name, err); 3050 dev->name, err);
3049 dev->reg_state = NETREG_REGISTERED;
3050 break; 3051 break;
3051 3052
3052 case NETREG_UNREGISTERING: 3053 case NETREG_UNREGISTERING:
@@ -3100,12 +3101,11 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
3100 alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; 3101 alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
3101 alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; 3102 alloc_size += sizeof_priv + NETDEV_ALIGN_CONST;
3102 3103
3103 p = kmalloc(alloc_size, GFP_KERNEL); 3104 p = kzalloc(alloc_size, GFP_KERNEL);
3104 if (!p) { 3105 if (!p) {
3105 printk(KERN_ERR "alloc_dev: Unable to allocate device.\n"); 3106 printk(KERN_ERR "alloc_dev: Unable to allocate device.\n");
3106 return NULL; 3107 return NULL;
3107 } 3108 }
3108 memset(p, 0, alloc_size);
3109 3109
3110 dev = (struct net_device *) 3110 dev = (struct net_device *)
3111 (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); 3111 (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
@@ -3347,7 +3347,7 @@ static int __init net_dev_init(void)
3347 * Initialise the packet receive queues. 3347 * Initialise the packet receive queues.
3348 */ 3348 */
3349 3349
3350 for_each_cpu(i) { 3350 for_each_possible_cpu(i) {
3351 struct softnet_data *queue; 3351 struct softnet_data *queue;
3352 3352
3353 queue = &per_cpu(softnet_data, i); 3353 queue = &per_cpu(softnet_data, i);
diff --git a/net/core/dv.c b/net/core/dv.c
index cf581407538c..29ee77f15932 100644
--- a/net/core/dv.c
+++ b/net/core/dv.c
@@ -55,15 +55,12 @@ int alloc_divert_blk(struct net_device *dev)
55 55
56 dev->divert = NULL; 56 dev->divert = NULL;
57 if (dev->type == ARPHRD_ETHER) { 57 if (dev->type == ARPHRD_ETHER) {
58 dev->divert = (struct divert_blk *) 58 dev->divert = kzalloc(alloc_size, GFP_KERNEL);
59 kmalloc(alloc_size, GFP_KERNEL);
60 if (dev->divert == NULL) { 59 if (dev->divert == NULL) {
61 printk(KERN_INFO "divert: unable to allocate divert_blk for %s\n", 60 printk(KERN_INFO "divert: unable to allocate divert_blk for %s\n",
62 dev->name); 61 dev->name);
63 return -ENOMEM; 62 return -ENOMEM;
64 } 63 }
65
66 memset(dev->divert, 0, sizeof(struct divert_blk));
67 dev_hold(dev); 64 dev_hold(dev);
68 } 65 }
69 66
diff --git a/net/core/filter.c b/net/core/filter.c
index 93fbd01d2259..5b4486a60cf6 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -34,6 +34,7 @@
34#include <linux/timer.h> 34#include <linux/timer.h>
35#include <asm/system.h> 35#include <asm/system.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/unaligned.h>
37#include <linux/filter.h> 38#include <linux/filter.h>
38 39
39/* No hurry in this branch */ 40/* No hurry in this branch */
@@ -177,7 +178,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
177load_w: 178load_w:
178 ptr = load_pointer(skb, k, 4, &tmp); 179 ptr = load_pointer(skb, k, 4, &tmp);
179 if (ptr != NULL) { 180 if (ptr != NULL) {
180 A = ntohl(*(u32 *)ptr); 181 A = ntohl(get_unaligned((u32 *)ptr));
181 continue; 182 continue;
182 } 183 }
183 break; 184 break;
@@ -186,7 +187,7 @@ load_w:
186load_h: 187load_h:
187 ptr = load_pointer(skb, k, 2, &tmp); 188 ptr = load_pointer(skb, k, 2, &tmp);
188 if (ptr != NULL) { 189 if (ptr != NULL) {
189 A = ntohs(*(u16 *)ptr); 190 A = ntohs(get_unaligned((u16 *)ptr));
190 continue; 191 continue;
191 } 192 }
192 break; 193 break;
diff --git a/net/core/flow.c b/net/core/flow.c
index 55789f832eda..2191af5f26ac 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -79,7 +79,7 @@ static void flow_cache_new_hashrnd(unsigned long arg)
79{ 79{
80 int i; 80 int i;
81 81
82 for_each_cpu(i) 82 for_each_possible_cpu(i)
83 flow_hash_rnd_recalc(i) = 1; 83 flow_hash_rnd_recalc(i) = 1;
84 84
85 flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD; 85 flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
@@ -318,12 +318,10 @@ static void __devinit flow_cache_cpu_prepare(int cpu)
318 /* NOTHING */; 318 /* NOTHING */;
319 319
320 flow_table(cpu) = (struct flow_cache_entry **) 320 flow_table(cpu) = (struct flow_cache_entry **)
321 __get_free_pages(GFP_KERNEL, order); 321 __get_free_pages(GFP_KERNEL|__GFP_ZERO, order);
322 if (!flow_table(cpu)) 322 if (!flow_table(cpu))
323 panic("NET: failed to allocate flow cache order %lu\n", order); 323 panic("NET: failed to allocate flow cache order %lu\n", order);
324 324
325 memset(flow_table(cpu), 0, PAGE_SIZE << order);
326
327 flow_hash_rnd_recalc(cpu) = 1; 325 flow_hash_rnd_recalc(cpu) = 1;
328 flow_count(cpu) = 0; 326 flow_count(cpu) = 0;
329 327
@@ -363,7 +361,7 @@ static int __init flow_cache_init(void)
363 flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD; 361 flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
364 add_timer(&flow_hash_rnd_timer); 362 add_timer(&flow_hash_rnd_timer);
365 363
366 for_each_cpu(i) 364 for_each_possible_cpu(i)
367 flow_cache_cpu_prepare(i); 365 flow_cache_cpu_prepare(i);
368 366
369 hotcpu_notifier(flow_cache_cpu, 0); 367 hotcpu_notifier(flow_cache_cpu, 0);
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index b07c029e8219..3cad026764f0 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -159,11 +159,10 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
159 if (parm->interval < -2 || parm->interval > 3) 159 if (parm->interval < -2 || parm->interval > 3)
160 return -EINVAL; 160 return -EINVAL;
161 161
162 est = kmalloc(sizeof(*est), GFP_KERNEL); 162 est = kzalloc(sizeof(*est), GFP_KERNEL);
163 if (est == NULL) 163 if (est == NULL)
164 return -ENOBUFS; 164 return -ENOBUFS;
165 165
166 memset(est, 0, sizeof(*est));
167 est->interval = parm->interval + 2; 166 est->interval = parm->interval + 2;
168 est->bstats = bstats; 167 est->bstats = bstats;
169 est->rate_est = rate_est; 168 est->rate_est = rate_est;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 0c8666872d10..4cf878efdb49 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -284,14 +284,11 @@ static struct neighbour **neigh_hash_alloc(unsigned int entries)
284 struct neighbour **ret; 284 struct neighbour **ret;
285 285
286 if (size <= PAGE_SIZE) { 286 if (size <= PAGE_SIZE) {
287 ret = kmalloc(size, GFP_ATOMIC); 287 ret = kzalloc(size, GFP_ATOMIC);
288 } else { 288 } else {
289 ret = (struct neighbour **) 289 ret = (struct neighbour **)
290 __get_free_pages(GFP_ATOMIC, get_order(size)); 290 __get_free_pages(GFP_ATOMIC|__GFP_ZERO, get_order(size));
291 } 291 }
292 if (ret)
293 memset(ret, 0, size);
294
295 return ret; 292 return ret;
296} 293}
297 294
@@ -1089,8 +1086,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
1089 if (hh->hh_type == protocol) 1086 if (hh->hh_type == protocol)
1090 break; 1087 break;
1091 1088
1092 if (!hh && (hh = kmalloc(sizeof(*hh), GFP_ATOMIC)) != NULL) { 1089 if (!hh && (hh = kzalloc(sizeof(*hh), GFP_ATOMIC)) != NULL) {
1093 memset(hh, 0, sizeof(struct hh_cache));
1094 rwlock_init(&hh->hh_lock); 1090 rwlock_init(&hh->hh_lock);
1095 hh->hh_type = protocol; 1091 hh->hh_type = protocol;
1096 atomic_set(&hh->hh_refcnt, 0); 1092 atomic_set(&hh->hh_refcnt, 0);
@@ -1366,13 +1362,11 @@ void neigh_table_init(struct neigh_table *tbl)
1366 tbl->hash_buckets = neigh_hash_alloc(tbl->hash_mask + 1); 1362 tbl->hash_buckets = neigh_hash_alloc(tbl->hash_mask + 1);
1367 1363
1368 phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *); 1364 phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *);
1369 tbl->phash_buckets = kmalloc(phsize, GFP_KERNEL); 1365 tbl->phash_buckets = kzalloc(phsize, GFP_KERNEL);
1370 1366
1371 if (!tbl->hash_buckets || !tbl->phash_buckets) 1367 if (!tbl->hash_buckets || !tbl->phash_buckets)
1372 panic("cannot allocate neighbour cache hashes"); 1368 panic("cannot allocate neighbour cache hashes");
1373 1369
1374 memset(tbl->phash_buckets, 0, phsize);
1375
1376 get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd)); 1370 get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
1377 1371
1378 rwlock_init(&tbl->lock); 1372 rwlock_init(&tbl->lock);
@@ -1633,7 +1627,7 @@ static int neightbl_fill_info(struct neigh_table *tbl, struct sk_buff *skb,
1633 1627
1634 memset(&ndst, 0, sizeof(ndst)); 1628 memset(&ndst, 0, sizeof(ndst));
1635 1629
1636 for_each_cpu(cpu) { 1630 for_each_possible_cpu(cpu) {
1637 struct neigh_statistics *st; 1631 struct neigh_statistics *st;
1638 1632
1639 st = per_cpu_ptr(tbl->stats, cpu); 1633 st = per_cpu_ptr(tbl->stats, cpu);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 21b68464cabb..c12990c9c603 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -165,7 +165,7 @@ static ssize_t show_operstate(struct class_device *dev, char *buf)
165 operstate = IF_OPER_DOWN; 165 operstate = IF_OPER_DOWN;
166 read_unlock(&dev_base_lock); 166 read_unlock(&dev_base_lock);
167 167
168 if (operstate >= sizeof(operstates)) 168 if (operstate >= ARRAY_SIZE(operstates))
169 return -EINVAL; /* should not happen */ 169 return -EINVAL; /* should not happen */
170 170
171 return sprintf(buf, "%s\n", operstates[operstate]); 171 return sprintf(buf, "%s\n", operstates[operstate]);
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 1e44eda1fda9..79ebd75fbe4d 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -38,13 +38,11 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
38{ 38{
39 const int lopt_size = sizeof(struct listen_sock) + 39 const int lopt_size = sizeof(struct listen_sock) +
40 nr_table_entries * sizeof(struct request_sock *); 40 nr_table_entries * sizeof(struct request_sock *);
41 struct listen_sock *lopt = kmalloc(lopt_size, GFP_KERNEL); 41 struct listen_sock *lopt = kzalloc(lopt_size, GFP_KERNEL);
42 42
43 if (lopt == NULL) 43 if (lopt == NULL)
44 return -ENOMEM; 44 return -ENOMEM;
45 45
46 memset(lopt, 0, lopt_size);
47
48 for (lopt->max_qlen_log = 6; 46 for (lopt->max_qlen_log = 6;
49 (1 << lopt->max_qlen_log) < sysctl_max_syn_backlog; 47 (1 << lopt->max_qlen_log) < sysctl_max_syn_backlog;
50 lopt->max_qlen_log++); 48 lopt->max_qlen_log++);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 09464fa8d72f..fb3770f9c094 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -112,6 +112,14 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
112 BUG(); 112 BUG();
113} 113}
114 114
115void skb_truesize_bug(struct sk_buff *skb)
116{
117 printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
118 "len=%u, sizeof(sk_buff)=%Zd\n",
119 skb->truesize, skb->len, sizeof(struct sk_buff));
120}
121EXPORT_SYMBOL(skb_truesize_bug);
122
115/* Allocate a new skbuff. We do this ourselves so we can fill in a few 123/* Allocate a new skbuff. We do this ourselves so we can fill in a few
116 * 'private' fields and also do memory statistics to find all the 124 * 'private' fields and also do memory statistics to find all the
117 * [BEEP] leaks. 125 * [BEEP] leaks.
diff --git a/net/core/stream.c b/net/core/stream.c
index 35e25259fd95..e9489696f694 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -176,6 +176,7 @@ void sk_stream_rfree(struct sk_buff *skb)
176{ 176{
177 struct sock *sk = skb->sk; 177 struct sock *sk = skb->sk;
178 178
179 skb_truesize_check(skb);
179 atomic_sub(skb->truesize, &sk->sk_rmem_alloc); 180 atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
180 sk->sk_forward_alloc += skb->truesize; 181 sk->sk_forward_alloc += skb->truesize;
181} 182}
diff --git a/net/core/utils.c b/net/core/utils.c
index fdc4f38bc46c..4f96f389243d 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -121,7 +121,7 @@ void __init net_random_init(void)
121{ 121{
122 int i; 122 int i;
123 123
124 for_each_cpu(i) { 124 for_each_possible_cpu(i) {
125 struct nrnd_state *state = &per_cpu(net_rand_state,i); 125 struct nrnd_state *state = &per_cpu(net_rand_state,i);
126 __net_srandom(state, i+jiffies); 126 __net_srandom(state, i+jiffies);
127 } 127 }
@@ -133,7 +133,7 @@ static int net_random_reseed(void)
133 unsigned long seed[NR_CPUS]; 133 unsigned long seed[NR_CPUS];
134 134
135 get_random_bytes(seed, sizeof(seed)); 135 get_random_bytes(seed, sizeof(seed));
136 for_each_cpu(i) { 136 for_each_possible_cpu(i) {
137 struct nrnd_state *state = &per_cpu(net_rand_state,i); 137 struct nrnd_state *state = &per_cpu(net_rand_state,i);
138 __net_srandom(state, seed[i]); 138 __net_srandom(state, seed[i]);
139 } 139 }
diff --git a/net/core/wireless.c b/net/core/wireless.c
index 81d6995fcfdb..d2bc72d318f7 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -1726,6 +1726,14 @@ int wireless_rtnetlink_get(struct net_device * dev,
1726 if(!IW_IS_GET(request->cmd)) 1726 if(!IW_IS_GET(request->cmd))
1727 return -EOPNOTSUPP; 1727 return -EOPNOTSUPP;
1728 1728
1729 /* If command is `get the encoding parameters', check if
1730 * the user has the right to do it */
1731 if (request->cmd == SIOCGIWENCODE ||
1732 request->cmd == SIOCGIWENCODEEXT) {
1733 if (!capable(CAP_NET_ADMIN))
1734 return -EPERM;
1735 }
1736
1729 /* Special cases */ 1737 /* Special cases */
1730 if(request->cmd == SIOCGIWSTATS) 1738 if(request->cmd == SIOCGIWSTATS)
1731 /* Get Wireless Stats */ 1739 /* Get Wireless Stats */
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 29047995c695..f2c011fd2ba1 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -498,7 +498,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
498 goto drop; 498 goto drop;
499 499
500 if (dccp_parse_options(sk, skb)) 500 if (dccp_parse_options(sk, skb))
501 goto drop; 501 goto drop_and_free;
502 502
503 dccp_openreq_init(req, &dp, skb); 503 dccp_openreq_init(req, &dp, skb);
504 504
diff --git a/net/ieee80211/softmac/Kconfig b/net/ieee80211/softmac/Kconfig
index 6cd9f3427be6..f2a27cc6ecb1 100644
--- a/net/ieee80211/softmac/Kconfig
+++ b/net/ieee80211/softmac/Kconfig
@@ -1,6 +1,7 @@
1config IEEE80211_SOFTMAC 1config IEEE80211_SOFTMAC
2 tristate "Software MAC add-on to the IEEE 802.11 networking stack" 2 tristate "Software MAC add-on to the IEEE 802.11 networking stack"
3 depends on IEEE80211 && EXPERIMENTAL 3 depends on IEEE80211 && EXPERIMENTAL
4 select WIRELESS_EXT
4 ---help--- 5 ---help---
5 This option enables the hardware independent software MAC addon 6 This option enables the hardware independent software MAC addon
6 for the IEEE 802.11 networking stack. 7 for the IEEE 802.11 networking stack.
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c
index be61de78dfa4..4498023841dc 100644
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason)
101 /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ 101 /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */
102 mac->associated = 0; 102 mac->associated = 0;
103 mac->associnfo.associating = 0; 103 mac->associnfo.associating = 0;
104 ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
104 spin_unlock_irqrestore(&mac->lock, flags); 105 spin_unlock_irqrestore(&mac->lock, flags);
105} 106}
106 107
@@ -373,6 +374,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev,
373 spin_lock_irqsave(&mac->lock, flags); 374 spin_lock_irqsave(&mac->lock, flags);
374 mac->associnfo.bssvalid = 0; 375 mac->associnfo.bssvalid = 0;
375 mac->associated = 0; 376 mac->associated = 0;
377 ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
376 schedule_work(&mac->associnfo.work); 378 schedule_work(&mac->associnfo.work);
377 spin_unlock_irqrestore(&mac->lock, flags); 379 spin_unlock_irqrestore(&mac->lock, flags);
378 380
@@ -391,6 +393,7 @@ ieee80211softmac_handle_reassoc_req(struct net_device * dev,
391 dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); 393 dprintkl(KERN_INFO PFX "reassoc request from unknown network\n");
392 return 0; 394 return 0;
393 } 395 }
394 ieee80211softmac_assoc(mac, network); 396 schedule_work(&mac->associnfo.work);
397
395 return 0; 398 return 0;
396} 399}
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c
index 0a52bbda1e4c..8cc8f3f0f8e7 100644
--- a/net/ieee80211/softmac/ieee80211softmac_event.c
+++ b/net/ieee80211/softmac/ieee80211softmac_event.c
@@ -67,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = {
67 "authenticating failed", 67 "authenticating failed",
68 "authenticating timed out", 68 "authenticating timed out",
69 "associating failed because no suitable network was found", 69 "associating failed because no suitable network was found",
70 "disassociated",
70}; 71};
71 72
72 73
@@ -128,13 +129,42 @@ void
128ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) 129ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx)
129{ 130{
130 struct ieee80211softmac_event *eventptr, *tmp; 131 struct ieee80211softmac_event *eventptr, *tmp;
131 union iwreq_data wrqu; 132 struct ieee80211softmac_network *network;
132 char *msg;
133 133
134 if (event >= 0) { 134 if (event >= 0) {
135 msg = event_descriptions[event]; 135 union iwreq_data wrqu;
136 wrqu.data.length = strlen(msg); 136 int we_event;
137 wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); 137 char *msg = NULL;
138
139 switch(event) {
140 case IEEE80211SOFTMAC_EVENT_ASSOCIATED:
141 network = (struct ieee80211softmac_network *)event_ctx;
142 wrqu.data.length = 0;
143 wrqu.data.flags = 0;
144 memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN);
145 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
146 we_event = SIOCGIWAP;
147 break;
148 case IEEE80211SOFTMAC_EVENT_DISASSOCIATED:
149 wrqu.data.length = 0;
150 wrqu.data.flags = 0;
151 memset(&wrqu, '\0', sizeof (union iwreq_data));
152 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
153 we_event = SIOCGIWAP;
154 break;
155 case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED:
156 wrqu.data.length = 0;
157 wrqu.data.flags = 0;
158 memset(&wrqu, '\0', sizeof (union iwreq_data));
159 we_event = SIOCGIWSCAN;
160 break;
161 default:
162 msg = event_descriptions[event];
163 wrqu.data.length = strlen(msg);
164 we_event = IWEVCUSTOM;
165 break;
166 }
167 wireless_send_event(mac->dev, we_event, &wrqu, msg);
138 } 168 }
139 169
140 if (!list_empty(&mac->events)) 170 if (!list_empty(&mac->events))
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c
index febc51dbb412..cc6cd56c85b1 100644
--- a/net/ieee80211/softmac/ieee80211softmac_io.c
+++ b/net/ieee80211/softmac/ieee80211softmac_io.c
@@ -180,9 +180,21 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
180 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); 180 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid);
181 181
182 /* Fill in capability Info */ 182 /* Fill in capability Info */
183 (*pkt)->capability = (mac->ieee->iw_mode == IW_MODE_MASTER) || (mac->ieee->iw_mode == IW_MODE_INFRA) ? 183 switch (mac->ieee->iw_mode) {
184 cpu_to_le16(WLAN_CAPABILITY_ESS) : 184 case IW_MODE_INFRA:
185 cpu_to_le16(WLAN_CAPABILITY_IBSS); 185 (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_ESS);
186 break;
187 case IW_MODE_ADHOC:
188 (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS);
189 break;
190 case IW_MODE_AUTO:
191 (*pkt)->capability = net->capabilities & (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS);
192 break;
193 default:
194 /* bleh. we don't ever go to these modes */
195 printk(KERN_ERR PFX "invalid iw_mode!\n");
196 break;
197 }
186 /* Need to add this 198 /* Need to add this
187 (*pkt)->capability |= mac->ieee->short_slot ? 199 (*pkt)->capability |= mac->ieee->short_slot ?
188 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; 200 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0;
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c
index bb9ab8b45d09..2b9e7edfa3ce 100644
--- a/net/ieee80211/softmac/ieee80211softmac_scan.c
+++ b/net/ieee80211/softmac/ieee80211softmac_scan.c
@@ -47,6 +47,7 @@ ieee80211softmac_start_scan(struct ieee80211softmac_device *sm)
47 sm->scanning = 1; 47 sm->scanning = 1;
48 spin_unlock_irqrestore(&sm->lock, flags); 48 spin_unlock_irqrestore(&sm->lock, flags);
49 49
50 netif_tx_disable(sm->ieee->dev);
50 ret = sm->start_scan(sm->dev); 51 ret = sm->start_scan(sm->dev);
51 if (ret) { 52 if (ret) {
52 spin_lock_irqsave(&sm->lock, flags); 53 spin_lock_irqsave(&sm->lock, flags);
@@ -239,6 +240,7 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm)
239 if (net) 240 if (net)
240 sm->set_channel(sm->dev, net->channel); 241 sm->set_channel(sm->dev, net->channel);
241 } 242 }
243 netif_wake_queue(sm->ieee->dev);
242 ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); 244 ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL);
243} 245}
244EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); 246EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished);
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index b559aa9b5507..00f0d4f71897 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -41,13 +41,23 @@ ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
41EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan); 41EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan);
42 42
43 43
44/* if we're still scanning, return -EAGAIN so that userspace tools
45 * can get the complete scan results, otherwise return 0. */
44int 46int
45ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, 47ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
46 struct iw_request_info *info, 48 struct iw_request_info *info,
47 union iwreq_data *data, 49 union iwreq_data *data,
48 char *extra) 50 char *extra)
49{ 51{
52 unsigned long flags;
50 struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); 53 struct ieee80211softmac_device *sm = ieee80211_priv(net_dev);
54
55 spin_lock_irqsave(&sm->lock, flags);
56 if (sm->scanning) {
57 spin_unlock_irqrestore(&sm->lock, flags);
58 return -EAGAIN;
59 }
60 spin_unlock_irqrestore(&sm->lock, flags);
51 return ieee80211_wx_get_scan(sm->ieee, info, data, extra); 61 return ieee80211_wx_get_scan(sm->ieee, info, data, extra);
52} 62}
53EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results); 63EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 041dadde31af..4749d504c629 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -928,7 +928,8 @@ static void parp_redo(struct sk_buff *skb)
928 * Receive an arp request from the device layer. 928 * Receive an arp request from the device layer.
929 */ 929 */
930 930
931int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) 931static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
932 struct packet_type *pt, struct net_device *orig_dev)
932{ 933{
933 struct arphdr *arp; 934 struct arphdr *arp;
934 935
@@ -1417,7 +1418,6 @@ static int __init arp_proc_init(void)
1417 1418
1418EXPORT_SYMBOL(arp_broken_ops); 1419EXPORT_SYMBOL(arp_broken_ops);
1419EXPORT_SYMBOL(arp_find); 1420EXPORT_SYMBOL(arp_find);
1420EXPORT_SYMBOL(arp_rcv);
1421EXPORT_SYMBOL(arp_create); 1421EXPORT_SYMBOL(arp_create);
1422EXPORT_SYMBOL(arp_xmit); 1422EXPORT_SYMBOL(arp_xmit);
1423EXPORT_SYMBOL(arp_send); 1423EXPORT_SYMBOL(arp_send);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 81c2f7885292..54419b27686f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1556,7 +1556,6 @@ void __init devinet_init(void)
1556#endif 1556#endif
1557} 1557}
1558 1558
1559EXPORT_SYMBOL(devinet_ioctl);
1560EXPORT_SYMBOL(in_dev_finish_destroy); 1559EXPORT_SYMBOL(in_dev_finish_destroy);
1561EXPORT_SYMBOL(inet_select_addr); 1560EXPORT_SYMBOL(inet_select_addr);
1562EXPORT_SYMBOL(inetdev_by_index); 1561EXPORT_SYMBOL(inetdev_by_index);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4e3d3811dea2..cdde96390960 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -666,4 +666,3 @@ void __init ip_fib_init(void)
666} 666}
667 667
668EXPORT_SYMBOL(inet_addr_type); 668EXPORT_SYMBOL(inet_addr_type);
669EXPORT_SYMBOL(ip_rt_ioctl);
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index ccd3efc6a173..95a639f2e3db 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -50,7 +50,7 @@
50 * Patrick McHardy <kaber@trash.net> 50 * Patrick McHardy <kaber@trash.net>
51 */ 51 */
52 52
53#define VERSION "0.406" 53#define VERSION "0.407"
54 54
55#include <linux/config.h> 55#include <linux/config.h>
56#include <asm/uaccess.h> 56#include <asm/uaccess.h>
@@ -314,11 +314,6 @@ static void __leaf_free_rcu(struct rcu_head *head)
314 kfree(container_of(head, struct leaf, rcu)); 314 kfree(container_of(head, struct leaf, rcu));
315} 315}
316 316
317static inline void free_leaf(struct leaf *leaf)
318{
319 call_rcu(&leaf->rcu, __leaf_free_rcu);
320}
321
322static void __leaf_info_free_rcu(struct rcu_head *head) 317static void __leaf_info_free_rcu(struct rcu_head *head)
323{ 318{
324 kfree(container_of(head, struct leaf_info, rcu)); 319 kfree(container_of(head, struct leaf_info, rcu));
@@ -357,7 +352,12 @@ static void __tnode_free_rcu(struct rcu_head *head)
357 352
358static inline void tnode_free(struct tnode *tn) 353static inline void tnode_free(struct tnode *tn)
359{ 354{
360 call_rcu(&tn->rcu, __tnode_free_rcu); 355 if(IS_LEAF(tn)) {
356 struct leaf *l = (struct leaf *) tn;
357 call_rcu_bh(&l->rcu, __leaf_free_rcu);
358 }
359 else
360 call_rcu(&tn->rcu, __tnode_free_rcu);
361} 361}
362 362
363static struct leaf *leaf_new(void) 363static struct leaf *leaf_new(void)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 9831fd2c73a0..2a0455911ee0 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1107,7 +1107,7 @@ void __init icmp_init(struct net_proto_family *ops)
1107 struct inet_sock *inet; 1107 struct inet_sock *inet;
1108 int i; 1108 int i;
1109 1109
1110 for_each_cpu(i) { 1110 for_each_possible_cpu(i) {
1111 int err; 1111 int err;
1112 1112
1113 err = sock_create_kern(PF_INET, SOCK_RAW, IPPROTO_ICMP, 1113 err = sock_create_kern(PF_INET, SOCK_RAW, IPPROTO_ICMP,
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index ef7366fc132f..ee9b5515b9ae 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -43,8 +43,6 @@ struct inet_bind_bucket *inet_bind_bucket_create(kmem_cache_t *cachep,
43 return tb; 43 return tb;
44} 44}
45 45
46EXPORT_SYMBOL(inet_bind_bucket_create);
47
48/* 46/*
49 * Caller must hold hashbucket lock for this tb with local BH disabled 47 * Caller must hold hashbucket lock for this tb with local BH disabled
50 */ 48 */
@@ -64,8 +62,6 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
64 inet_csk(sk)->icsk_bind_hash = tb; 62 inet_csk(sk)->icsk_bind_hash = tb;
65} 63}
66 64
67EXPORT_SYMBOL(inet_bind_hash);
68
69/* 65/*
70 * Get rid of any references to a local port held by the given sock. 66 * Get rid of any references to a local port held by the given sock.
71 */ 67 */
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 2a8adda15e11..da734c439179 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -304,13 +304,17 @@ out:
304 304
305/* Creation primitives. */ 305/* Creation primitives. */
306 306
307static struct ipq *ip_frag_intern(unsigned int hash, struct ipq *qp_in) 307static struct ipq *ip_frag_intern(struct ipq *qp_in)
308{ 308{
309 struct ipq *qp; 309 struct ipq *qp;
310#ifdef CONFIG_SMP 310#ifdef CONFIG_SMP
311 struct hlist_node *n; 311 struct hlist_node *n;
312#endif 312#endif
313 unsigned int hash;
314
313 write_lock(&ipfrag_lock); 315 write_lock(&ipfrag_lock);
316 hash = ipqhashfn(qp_in->id, qp_in->saddr, qp_in->daddr,
317 qp_in->protocol);
314#ifdef CONFIG_SMP 318#ifdef CONFIG_SMP
315 /* With SMP race we have to recheck hash table, because 319 /* With SMP race we have to recheck hash table, because
316 * such entry could be created on other cpu, while we 320 * such entry could be created on other cpu, while we
@@ -345,7 +349,7 @@ static struct ipq *ip_frag_intern(unsigned int hash, struct ipq *qp_in)
345} 349}
346 350
347/* Add an entry to the 'ipq' queue for a newly received IP datagram. */ 351/* Add an entry to the 'ipq' queue for a newly received IP datagram. */
348static struct ipq *ip_frag_create(unsigned hash, struct iphdr *iph, u32 user) 352static struct ipq *ip_frag_create(struct iphdr *iph, u32 user)
349{ 353{
350 struct ipq *qp; 354 struct ipq *qp;
351 355
@@ -371,7 +375,7 @@ static struct ipq *ip_frag_create(unsigned hash, struct iphdr *iph, u32 user)
371 spin_lock_init(&qp->lock); 375 spin_lock_init(&qp->lock);
372 atomic_set(&qp->refcnt, 1); 376 atomic_set(&qp->refcnt, 1);
373 377
374 return ip_frag_intern(hash, qp); 378 return ip_frag_intern(qp);
375 379
376out_nomem: 380out_nomem:
377 LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); 381 LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n");
@@ -387,11 +391,12 @@ static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
387 __u32 saddr = iph->saddr; 391 __u32 saddr = iph->saddr;
388 __u32 daddr = iph->daddr; 392 __u32 daddr = iph->daddr;
389 __u8 protocol = iph->protocol; 393 __u8 protocol = iph->protocol;
390 unsigned int hash = ipqhashfn(id, saddr, daddr, protocol); 394 unsigned int hash;
391 struct ipq *qp; 395 struct ipq *qp;
392 struct hlist_node *n; 396 struct hlist_node *n;
393 397
394 read_lock(&ipfrag_lock); 398 read_lock(&ipfrag_lock);
399 hash = ipqhashfn(id, saddr, daddr, protocol);
395 hlist_for_each_entry(qp, n, &ipq_hash[hash], list) { 400 hlist_for_each_entry(qp, n, &ipq_hash[hash], list) {
396 if(qp->id == id && 401 if(qp->id == id &&
397 qp->saddr == saddr && 402 qp->saddr == saddr &&
@@ -405,7 +410,7 @@ static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
405 } 410 }
406 read_unlock(&ipfrag_lock); 411 read_unlock(&ipfrag_lock);
407 412
408 return ip_frag_create(hash, iph, user); 413 return ip_frag_create(iph, user);
409} 414}
410 415
411/* Is the fragment too far ahead to be part of ipq? */ 416/* Is the fragment too far ahead to be part of ipq? */
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9981dcd68f11..ab99bebdcdc8 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -656,7 +656,7 @@ static int ipgre_rcv(struct sk_buff *skb)
656 read_unlock(&ipgre_lock); 656 read_unlock(&ipgre_lock);
657 return(0); 657 return(0);
658 } 658 }
659 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); 659 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
660 660
661drop: 661drop:
662 read_unlock(&ipgre_lock); 662 read_unlock(&ipgre_lock);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index f75ff1d96551..cff9c3a72daf 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -86,8 +86,6 @@
86 86
87int sysctl_ip_default_ttl = IPDEFTTL; 87int sysctl_ip_default_ttl = IPDEFTTL;
88 88
89static int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*));
90
91/* Generate a checksum for an outgoing IP datagram. */ 89/* Generate a checksum for an outgoing IP datagram. */
92__inline__ void ip_send_check(struct iphdr *iph) 90__inline__ void ip_send_check(struct iphdr *iph)
93{ 91{
@@ -421,7 +419,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
421 * single device frame, and queue such a frame for sending. 419 * single device frame, and queue such a frame for sending.
422 */ 420 */
423 421
424static int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) 422int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
425{ 423{
426 struct iphdr *iph; 424 struct iphdr *iph;
427 int raw = 0; 425 int raw = 0;
@@ -673,6 +671,8 @@ fail:
673 return err; 671 return err;
674} 672}
675 673
674EXPORT_SYMBOL(ip_fragment);
675
676int 676int
677ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb) 677ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb)
678{ 678{
@@ -904,7 +904,7 @@ alloc_new_skb:
904 * because we have no idea what fragment will be 904 * because we have no idea what fragment will be
905 * the last. 905 * the last.
906 */ 906 */
907 if (datalen == length) 907 if (datalen == length + fraggap)
908 alloclen += rt->u.dst.trailer_len; 908 alloclen += rt->u.dst.trailer_len;
909 909
910 if (transhdrlen) { 910 if (transhdrlen) {
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 0a1d86a0f632..cd810f41af1a 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -290,11 +290,8 @@ static void ipcomp_free_scratches(void)
290 if (!scratches) 290 if (!scratches)
291 return; 291 return;
292 292
293 for_each_cpu(i) { 293 for_each_possible_cpu(i)
294 void *scratch = *per_cpu_ptr(scratches, i); 294 vfree(*per_cpu_ptr(scratches, i));
295 if (scratch)
296 vfree(scratch);
297 }
298 295
299 free_percpu(scratches); 296 free_percpu(scratches);
300} 297}
@@ -313,7 +310,7 @@ static void **ipcomp_alloc_scratches(void)
313 310
314 ipcomp_scratches = scratches; 311 ipcomp_scratches = scratches;
315 312
316 for_each_cpu(i) { 313 for_each_possible_cpu(i) {
317 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); 314 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE);
318 if (!scratch) 315 if (!scratch)
319 return NULL; 316 return NULL;
@@ -344,7 +341,7 @@ static void ipcomp_free_tfms(struct crypto_tfm **tfms)
344 if (!tfms) 341 if (!tfms)
345 return; 342 return;
346 343
347 for_each_cpu(cpu) { 344 for_each_possible_cpu(cpu) {
348 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); 345 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu);
349 crypto_free_tfm(tfm); 346 crypto_free_tfm(tfm);
350 } 347 }
@@ -384,7 +381,7 @@ static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name)
384 if (!tfms) 381 if (!tfms)
385 goto error; 382 goto error;
386 383
387 for_each_cpu(cpu) { 384 for_each_possible_cpu(cpu) {
388 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); 385 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0);
389 if (!tfm) 386 if (!tfm)
390 goto error; 387 goto error;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index eef07b0916a3..ea398ee43f28 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -474,9 +474,6 @@ static int ipip_rcv(struct sk_buff *skb)
474 struct iphdr *iph; 474 struct iphdr *iph;
475 struct ip_tunnel *tunnel; 475 struct ip_tunnel *tunnel;
476 476
477 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
478 goto out;
479
480 iph = skb->nh.iph; 477 iph = skb->nh.iph;
481 478
482 read_lock(&ipip_lock); 479 read_lock(&ipip_lock);
@@ -508,7 +505,6 @@ static int ipip_rcv(struct sk_buff *skb)
508 } 505 }
509 read_unlock(&ipip_lock); 506 read_unlock(&ipip_lock);
510 507
511out:
512 return -1; 508 return -1;
513} 509}
514 510
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index b5ad9ac2fbcc..6a9e34b794bc 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -133,7 +133,7 @@ struct ip_rt_info {
133 u_int8_t tos; 133 u_int8_t tos;
134}; 134};
135 135
136static void queue_save(const struct sk_buff *skb, struct nf_info *info) 136static void nf_ip_saveroute(const struct sk_buff *skb, struct nf_info *info)
137{ 137{
138 struct ip_rt_info *rt_info = nf_info_reroute(info); 138 struct ip_rt_info *rt_info = nf_info_reroute(info);
139 139
@@ -146,7 +146,7 @@ static void queue_save(const struct sk_buff *skb, struct nf_info *info)
146 } 146 }
147} 147}
148 148
149static int queue_reroute(struct sk_buff **pskb, const struct nf_info *info) 149static int nf_ip_reroute(struct sk_buff **pskb, const struct nf_info *info)
150{ 150{
151 const struct ip_rt_info *rt_info = nf_info_reroute(info); 151 const struct ip_rt_info *rt_info = nf_info_reroute(info);
152 152
@@ -161,20 +161,54 @@ static int queue_reroute(struct sk_buff **pskb, const struct nf_info *info)
161 return 0; 161 return 0;
162} 162}
163 163
164static struct nf_queue_rerouter ip_reroute = { 164unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
165 .rer_size = sizeof(struct ip_rt_info), 165 unsigned int dataoff, u_int8_t protocol)
166 .save = queue_save, 166{
167 .reroute = queue_reroute, 167 struct iphdr *iph = skb->nh.iph;
168 unsigned int csum = 0;
169
170 switch (skb->ip_summed) {
171 case CHECKSUM_HW:
172 if (hook != NF_IP_PRE_ROUTING && hook != NF_IP_LOCAL_IN)
173 break;
174 if ((protocol == 0 && !(u16)csum_fold(skb->csum)) ||
175 !csum_tcpudp_magic(iph->saddr, iph->daddr,
176 skb->len - dataoff, protocol,
177 skb->csum)) {
178 skb->ip_summed = CHECKSUM_UNNECESSARY;
179 break;
180 }
181 /* fall through */
182 case CHECKSUM_NONE:
183 if (protocol == 0)
184 skb->csum = 0;
185 else
186 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr,
187 skb->len - dataoff,
188 protocol, 0);
189 csum = __skb_checksum_complete(skb);
190 }
191 return csum;
192}
193
194EXPORT_SYMBOL(nf_ip_checksum);
195
196static struct nf_afinfo nf_ip_afinfo = {
197 .family = AF_INET,
198 .checksum = nf_ip_checksum,
199 .saveroute = nf_ip_saveroute,
200 .reroute = nf_ip_reroute,
201 .route_key_size = sizeof(struct ip_rt_info),
168}; 202};
169 203
170static int ipv4_netfilter_init(void) 204static int ipv4_netfilter_init(void)
171{ 205{
172 return nf_register_queue_rerouter(PF_INET, &ip_reroute); 206 return nf_register_afinfo(&nf_ip_afinfo);
173} 207}
174 208
175static void ipv4_netfilter_fini(void) 209static void ipv4_netfilter_fini(void)
176{ 210{
177 nf_unregister_queue_rerouter(PF_INET); 211 nf_unregister_afinfo(&nf_ip_afinfo);
178} 212}
179 213
180module_init(ipv4_netfilter_init); 214module_init(ipv4_netfilter_init);
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 77855ccd6b43..c60fd5c4ea1e 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -69,6 +69,7 @@ config IP_NF_CONNTRACK_NETLINK
69 tristate 'Connection tracking netlink interface (EXPERIMENTAL)' 69 tristate 'Connection tracking netlink interface (EXPERIMENTAL)'
70 depends on EXPERIMENTAL && IP_NF_CONNTRACK && NETFILTER_NETLINK 70 depends on EXPERIMENTAL && IP_NF_CONNTRACK && NETFILTER_NETLINK
71 depends on IP_NF_CONNTRACK!=y || NETFILTER_NETLINK!=m 71 depends on IP_NF_CONNTRACK!=y || NETFILTER_NETLINK!=m
72 depends on IP_NF_NAT=n || IP_NF_NAT
72 help 73 help
73 This option enables support for a netlink-based userspace interface 74 This option enables support for a netlink-based userspace interface
74 75
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index a44a5d73457d..c2d92f99a2b8 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -646,7 +646,7 @@ static int translate_table(const char *name,
646 } 646 }
647 647
648 /* And one copy for every other CPU */ 648 /* And one copy for every other CPU */
649 for_each_cpu(i) { 649 for_each_possible_cpu(i) {
650 if (newinfo->entries[i] && newinfo->entries[i] != entry0) 650 if (newinfo->entries[i] && newinfo->entries[i] != entry0)
651 memcpy(newinfo->entries[i], entry0, newinfo->size); 651 memcpy(newinfo->entries[i], entry0, newinfo->size);
652 } 652 }
@@ -696,7 +696,7 @@ static void get_counters(const struct xt_table_info *t,
696 counters, 696 counters,
697 &i); 697 &i);
698 698
699 for_each_cpu(cpu) { 699 for_each_possible_cpu(cpu) {
700 if (cpu == curcpu) 700 if (cpu == curcpu)
701 continue; 701 continue;
702 i = 0; 702 i = 0;
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
index d0d379c7df9a..d7c472faa53b 100644
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -181,33 +181,26 @@ static struct nf_hook_ops arpt_ops[] = {
181 181
182static int __init arptable_filter_init(void) 182static int __init arptable_filter_init(void)
183{ 183{
184 int ret, i; 184 int ret;
185 185
186 /* Register table */ 186 /* Register table */
187 ret = arpt_register_table(&packet_filter, &initial_table.repl); 187 ret = arpt_register_table(&packet_filter, &initial_table.repl);
188 if (ret < 0) 188 if (ret < 0)
189 return ret; 189 return ret;
190 190
191 for (i = 0; i < ARRAY_SIZE(arpt_ops); i++) 191 ret = nf_register_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
192 if ((ret = nf_register_hook(&arpt_ops[i])) < 0) 192 if (ret < 0)
193 goto cleanup_hooks; 193 goto cleanup_table;
194 return ret; 194 return ret;
195 195
196cleanup_hooks: 196cleanup_table:
197 while (--i >= 0)
198 nf_unregister_hook(&arpt_ops[i]);
199
200 arpt_unregister_table(&packet_filter); 197 arpt_unregister_table(&packet_filter);
201 return ret; 198 return ret;
202} 199}
203 200
204static void __exit arptable_filter_fini(void) 201static void __exit arptable_filter_fini(void)
205{ 202{
206 unsigned int i; 203 nf_unregister_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
207
208 for (i = 0; i < ARRAY_SIZE(arpt_ops); i++)
209 nf_unregister_hook(&arpt_ops[i]);
210
211 arpt_unregister_table(&packet_filter); 204 arpt_unregister_table(&packet_filter);
212} 205}
213 206
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index ceaabc18202b..979a2eac6f00 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -133,7 +133,7 @@ static void ip_ct_event_cache_flush(void)
133 struct ip_conntrack_ecache *ecache; 133 struct ip_conntrack_ecache *ecache;
134 int cpu; 134 int cpu;
135 135
136 for_each_cpu(cpu) { 136 for_each_possible_cpu(cpu) {
137 ecache = &per_cpu(ip_conntrack_ecache, cpu); 137 ecache = &per_cpu(ip_conntrack_ecache, cpu);
138 if (ecache->ct) 138 if (ecache->ct)
139 ip_conntrack_put(ecache->ct); 139 ip_conntrack_put(ecache->ct);
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
index daeb1395faa4..2c2fb700d835 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
@@ -9,37 +9,6 @@
9 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> 9 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 * 10 *
11 * For more information, please see http://nath323.sourceforge.net/ 11 * For more information, please see http://nath323.sourceforge.net/
12 *
13 * Changes:
14 * 2006-02-01 - initial version 0.1
15 *
16 * 2006-02-20 - version 0.2
17 * 1. Changed source format to follow kernel conventions
18 * 2. Deleted some unnecessary structures
19 * 3. Minor fixes
20 *
21 * 2006-03-10 - version 0.3
22 * 1. Added support for multiple TPKTs in one packet (suggested by
23 * Patrick McHardy)
24 * 2. Avoid excessive stack usage (based on Patrick McHardy's patch)
25 * 3. Added support for non-linear skb (based on Patrick McHardy's patch)
26 * 4. Fixed missing H.245 module owner (Patrick McHardy)
27 * 5. Avoid long RAS expectation chains (Patrick McHardy)
28 * 6. Fixed incorrect __exit attribute (Patrick McHardy)
29 * 7. Eliminated unnecessary return code
30 * 8. Fixed incorrect use of NAT data from conntrack code (suggested by
31 * Patrick McHardy)
32 * 9. Fixed TTL calculation error in RCF
33 * 10. Added TTL support in RRQ
34 * 11. Better support for separate TPKT header and data
35 *
36 * 2006-03-15 - version 0.4
37 * 1. Added support for T.120 channels
38 * 2. Added parameter gkrouted_only (suggested by Patrick McHardy)
39 * 3. Splitted ASN.1 code and data (suggested by Patrick McHardy)
40 * 4. Sort ASN.1 data to avoid forwarding declarations (suggested by
41 * Patrick McHardy)
42 * 5. Reset next TPKT data length in get_tpkt_data()
43 */ 12 */
44 13
45#include <linux/config.h> 14#include <linux/config.h>
@@ -54,8 +23,6 @@
54#include <linux/netfilter_ipv4/ip_conntrack_h323.h> 23#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
55#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
56 25
57#include "ip_conntrack_helper_h323_asn1.h"
58
59#if 0 26#if 0
60#define DEBUGP printk 27#define DEBUGP printk
61#else 28#else
@@ -63,6 +30,10 @@
63#endif 30#endif
64 31
65/* Parameters */ 32/* Parameters */
33static unsigned int default_rrq_ttl = 300;
34module_param(default_rrq_ttl, uint, 0600);
35MODULE_PARM_DESC(default_rrq_ttl, "use this TTL if it's missing in RRQ");
36
66static int gkrouted_only = 1; 37static int gkrouted_only = 1;
67module_param(gkrouted_only, int, 0600); 38module_param(gkrouted_only, int, 0600);
68MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper"); 39MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper");
@@ -222,8 +193,8 @@ static int get_tpkt_data(struct sk_buff **pskb, struct ip_conntrack *ct,
222} 193}
223 194
224/****************************************************************************/ 195/****************************************************************************/
225int get_h245_addr(unsigned char *data, H245_TransportAddress * addr, 196static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr,
226 u_int32_t * ip, u_int16_t * port) 197 u_int32_t * ip, u_int16_t * port)
227{ 198{
228 unsigned char *p; 199 unsigned char *p;
229 200
@@ -1302,7 +1273,7 @@ static int process_rrq(struct sk_buff **pskb, struct ip_conntrack *ct,
1302 DEBUGP("ip_ct_ras: RRQ TTL = %u seconds\n", rrq->timeToLive); 1273 DEBUGP("ip_ct_ras: RRQ TTL = %u seconds\n", rrq->timeToLive);
1303 info->timeout = rrq->timeToLive; 1274 info->timeout = rrq->timeToLive;
1304 } else 1275 } else
1305 info->timeout = 0; 1276 info->timeout = default_rrq_ttl;
1306 1277
1307 return 0; 1278 return 0;
1308} 1279}
@@ -1713,18 +1684,17 @@ static int __init init(void)
1713module_init(init); 1684module_init(init);
1714module_exit(fini); 1685module_exit(fini);
1715 1686
1716EXPORT_SYMBOL(get_h245_addr); 1687EXPORT_SYMBOL_GPL(get_h225_addr);
1717EXPORT_SYMBOL(get_h225_addr); 1688EXPORT_SYMBOL_GPL(ip_conntrack_h245_expect);
1718EXPORT_SYMBOL(ip_conntrack_h245_expect); 1689EXPORT_SYMBOL_GPL(ip_conntrack_q931_expect);
1719EXPORT_SYMBOL(ip_conntrack_q931_expect); 1690EXPORT_SYMBOL_GPL(set_h245_addr_hook);
1720EXPORT_SYMBOL(set_h245_addr_hook); 1691EXPORT_SYMBOL_GPL(set_h225_addr_hook);
1721EXPORT_SYMBOL(set_h225_addr_hook); 1692EXPORT_SYMBOL_GPL(set_sig_addr_hook);
1722EXPORT_SYMBOL(set_sig_addr_hook); 1693EXPORT_SYMBOL_GPL(set_ras_addr_hook);
1723EXPORT_SYMBOL(set_ras_addr_hook); 1694EXPORT_SYMBOL_GPL(nat_rtp_rtcp_hook);
1724EXPORT_SYMBOL(nat_rtp_rtcp_hook); 1695EXPORT_SYMBOL_GPL(nat_t120_hook);
1725EXPORT_SYMBOL(nat_t120_hook); 1696EXPORT_SYMBOL_GPL(nat_h245_hook);
1726EXPORT_SYMBOL(nat_h245_hook); 1697EXPORT_SYMBOL_GPL(nat_q931_hook);
1727EXPORT_SYMBOL(nat_q931_hook);
1728 1698
1729MODULE_AUTHOR("Jing Min Zhao <zhaojingmin@users.sourceforge.net>"); 1699MODULE_AUTHOR("Jing Min Zhao <zhaojingmin@users.sourceforge.net>");
1730MODULE_DESCRIPTION("H.323 connection tracking helper"); 1700MODULE_DESCRIPTION("H.323 connection tracking helper");
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
index afa525129b51..48078002e450 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
@@ -15,7 +15,7 @@
15#else 15#else
16#include <stdio.h> 16#include <stdio.h>
17#endif 17#endif
18#include "ip_conntrack_helper_h323_asn1.h" 18#include <linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h>
19 19
20/* Trace Flag */ 20/* Trace Flag */
21#ifndef H323_TRACE 21#ifndef H323_TRACE
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index 3021af0910f1..d8b14a9010a6 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -224,25 +224,14 @@ icmp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
224 } 224 }
225 225
226 /* See ip_conntrack_proto_tcp.c */ 226 /* See ip_conntrack_proto_tcp.c */
227 if (hooknum != NF_IP_PRE_ROUTING) 227 if (hooknum == NF_IP_PRE_ROUTING &&
228 goto checksum_skipped; 228 nf_ip_checksum(skb, hooknum, skb->nh.iph->ihl * 4, 0)) {
229 229 if (LOG_INVALID(IPPROTO_ICMP))
230 switch (skb->ip_summed) { 230 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
231 case CHECKSUM_HW: 231 "ip_ct_icmp: bad ICMP checksum ");
232 if (!(u16)csum_fold(skb->csum)) 232 return -NF_ACCEPT;
233 break;
234 /* fall through */
235 case CHECKSUM_NONE:
236 skb->csum = 0;
237 if (__skb_checksum_complete(skb)) {
238 if (LOG_INVALID(IPPROTO_ICMP))
239 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
240 "ip_ct_icmp: bad ICMP checksum ");
241 return -NF_ACCEPT;
242 }
243 } 233 }
244 234
245checksum_skipped:
246 /* 235 /*
247 * 18 is the highest 'known' ICMP type. Anything else is a mystery 236 * 18 is the highest 'known' ICMP type. Anything else is a mystery
248 * 237 *
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index e0dc37063545..062b252b58ad 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -870,11 +870,8 @@ static int tcp_error(struct sk_buff *skb,
870 * and moreover root might send raw packets. 870 * and moreover root might send raw packets.
871 */ 871 */
872 /* FIXME: Source route IP option packets --RR */ 872 /* FIXME: Source route IP option packets --RR */
873 if (hooknum == NF_IP_PRE_ROUTING 873 if (hooknum == NF_IP_PRE_ROUTING &&
874 && skb->ip_summed != CHECKSUM_UNNECESSARY 874 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_TCP)) {
875 && csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP,
876 skb->ip_summed == CHECKSUM_HW ? skb->csum
877 : skb_checksum(skb, iph->ihl*4, tcplen, 0))) {
878 if (LOG_INVALID(IPPROTO_TCP)) 875 if (LOG_INVALID(IPPROTO_TCP))
879 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 876 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
880 "ip_ct_tcp: bad TCP checksum "); 877 "ip_ct_tcp: bad TCP checksum ");
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
index 55b7d3210adf..70899868783b 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
@@ -120,11 +120,8 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
120 * because the semantic of CHECKSUM_HW is different there 120 * because the semantic of CHECKSUM_HW is different there
121 * and moreover root might send raw packets. 121 * and moreover root might send raw packets.
122 * FIXME: Source route IP option packets --RR */ 122 * FIXME: Source route IP option packets --RR */
123 if (hooknum == NF_IP_PRE_ROUTING 123 if (hooknum == NF_IP_PRE_ROUTING &&
124 && skb->ip_summed != CHECKSUM_UNNECESSARY 124 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) {
125 && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP,
126 skb->ip_summed == CHECKSUM_HW ? skb->csum
127 : skb_checksum(skb, iph->ihl*4, udplen, 0))) {
128 if (LOG_INVALID(IPPROTO_UDP)) 125 if (LOG_INVALID(IPPROTO_UDP))
129 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 126 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
130 "ip_ct_udp: bad UDP checksum "); 127 "ip_ct_udp: bad UDP checksum ");
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index 52076026db36..929d61f7be91 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -469,70 +469,63 @@ static unsigned int ip_conntrack_local(unsigned int hooknum,
469 469
470/* Connection tracking may drop packets, but never alters them, so 470/* Connection tracking may drop packets, but never alters them, so
471 make it the first hook. */ 471 make it the first hook. */
472static struct nf_hook_ops ip_conntrack_defrag_ops = { 472static struct nf_hook_ops ip_conntrack_ops[] = {
473 .hook = ip_conntrack_defrag, 473 {
474 .owner = THIS_MODULE, 474 .hook = ip_conntrack_defrag,
475 .pf = PF_INET, 475 .owner = THIS_MODULE,
476 .hooknum = NF_IP_PRE_ROUTING, 476 .pf = PF_INET,
477 .priority = NF_IP_PRI_CONNTRACK_DEFRAG, 477 .hooknum = NF_IP_PRE_ROUTING,
478}; 478 .priority = NF_IP_PRI_CONNTRACK_DEFRAG,
479 479 },
480static struct nf_hook_ops ip_conntrack_in_ops = { 480 {
481 .hook = ip_conntrack_in, 481 .hook = ip_conntrack_in,
482 .owner = THIS_MODULE, 482 .owner = THIS_MODULE,
483 .pf = PF_INET, 483 .pf = PF_INET,
484 .hooknum = NF_IP_PRE_ROUTING, 484 .hooknum = NF_IP_PRE_ROUTING,
485 .priority = NF_IP_PRI_CONNTRACK, 485 .priority = NF_IP_PRI_CONNTRACK,
486}; 486 },
487 487 {
488static struct nf_hook_ops ip_conntrack_defrag_local_out_ops = { 488 .hook = ip_conntrack_defrag,
489 .hook = ip_conntrack_defrag, 489 .owner = THIS_MODULE,
490 .owner = THIS_MODULE, 490 .pf = PF_INET,
491 .pf = PF_INET, 491 .hooknum = NF_IP_LOCAL_OUT,
492 .hooknum = NF_IP_LOCAL_OUT, 492 .priority = NF_IP_PRI_CONNTRACK_DEFRAG,
493 .priority = NF_IP_PRI_CONNTRACK_DEFRAG, 493 },
494}; 494 {
495 495 .hook = ip_conntrack_local,
496static struct nf_hook_ops ip_conntrack_local_out_ops = { 496 .owner = THIS_MODULE,
497 .hook = ip_conntrack_local, 497 .pf = PF_INET,
498 .owner = THIS_MODULE, 498 .hooknum = NF_IP_LOCAL_OUT,
499 .pf = PF_INET, 499 .priority = NF_IP_PRI_CONNTRACK,
500 .hooknum = NF_IP_LOCAL_OUT, 500 },
501 .priority = NF_IP_PRI_CONNTRACK, 501 {
502}; 502 .hook = ip_conntrack_help,
503 503 .owner = THIS_MODULE,
504/* helpers */ 504 .pf = PF_INET,
505static struct nf_hook_ops ip_conntrack_helper_out_ops = { 505 .hooknum = NF_IP_POST_ROUTING,
506 .hook = ip_conntrack_help, 506 .priority = NF_IP_PRI_CONNTRACK_HELPER,
507 .owner = THIS_MODULE, 507 },
508 .pf = PF_INET, 508 {
509 .hooknum = NF_IP_POST_ROUTING, 509 .hook = ip_conntrack_help,
510 .priority = NF_IP_PRI_CONNTRACK_HELPER, 510 .owner = THIS_MODULE,
511}; 511 .pf = PF_INET,
512 512 .hooknum = NF_IP_LOCAL_IN,
513static struct nf_hook_ops ip_conntrack_helper_in_ops = { 513 .priority = NF_IP_PRI_CONNTRACK_HELPER,
514 .hook = ip_conntrack_help, 514 },
515 .owner = THIS_MODULE, 515 {
516 .pf = PF_INET, 516 .hook = ip_confirm,
517 .hooknum = NF_IP_LOCAL_IN, 517 .owner = THIS_MODULE,
518 .priority = NF_IP_PRI_CONNTRACK_HELPER, 518 .pf = PF_INET,
519}; 519 .hooknum = NF_IP_POST_ROUTING,
520 520 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
521/* Refragmenter; last chance. */ 521 },
522static struct nf_hook_ops ip_conntrack_out_ops = { 522 {
523 .hook = ip_confirm, 523 .hook = ip_confirm,
524 .owner = THIS_MODULE, 524 .owner = THIS_MODULE,
525 .pf = PF_INET, 525 .pf = PF_INET,
526 .hooknum = NF_IP_POST_ROUTING, 526 .hooknum = NF_IP_LOCAL_IN,
527 .priority = NF_IP_PRI_CONNTRACK_CONFIRM, 527 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
528}; 528 },
529
530static struct nf_hook_ops ip_conntrack_local_in_ops = {
531 .hook = ip_confirm,
532 .owner = THIS_MODULE,
533 .pf = PF_INET,
534 .hooknum = NF_IP_LOCAL_IN,
535 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
536}; 529};
537 530
538/* Sysctl support */ 531/* Sysctl support */
@@ -783,18 +776,46 @@ static ctl_table ip_ct_net_table[] = {
783EXPORT_SYMBOL(ip_ct_log_invalid); 776EXPORT_SYMBOL(ip_ct_log_invalid);
784#endif /* CONFIG_SYSCTL */ 777#endif /* CONFIG_SYSCTL */
785 778
786static int init_or_cleanup(int init) 779/* FIXME: Allow NULL functions and sub in pointers to generic for
780 them. --RR */
781int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
782{
783 int ret = 0;
784
785 write_lock_bh(&ip_conntrack_lock);
786 if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) {
787 ret = -EBUSY;
788 goto out;
789 }
790 ip_ct_protos[proto->proto] = proto;
791 out:
792 write_unlock_bh(&ip_conntrack_lock);
793 return ret;
794}
795
796void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto)
797{
798 write_lock_bh(&ip_conntrack_lock);
799 ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol;
800 write_unlock_bh(&ip_conntrack_lock);
801
802 /* Somebody could be still looking at the proto in bh. */
803 synchronize_net();
804
805 /* Remove all contrack entries for this protocol */
806 ip_ct_iterate_cleanup(kill_proto, &proto->proto);
807}
808
809static int __init ip_conntrack_standalone_init(void)
787{ 810{
788#ifdef CONFIG_PROC_FS 811#ifdef CONFIG_PROC_FS
789 struct proc_dir_entry *proc, *proc_exp, *proc_stat; 812 struct proc_dir_entry *proc, *proc_exp, *proc_stat;
790#endif 813#endif
791 int ret = 0; 814 int ret = 0;
792 815
793 if (!init) goto cleanup;
794
795 ret = ip_conntrack_init(); 816 ret = ip_conntrack_init();
796 if (ret < 0) 817 if (ret < 0)
797 goto cleanup_nothing; 818 return ret;
798 819
799#ifdef CONFIG_PROC_FS 820#ifdef CONFIG_PROC_FS
800 ret = -ENOMEM; 821 ret = -ENOMEM;
@@ -813,78 +834,25 @@ static int init_or_cleanup(int init)
813 proc_stat->owner = THIS_MODULE; 834 proc_stat->owner = THIS_MODULE;
814#endif 835#endif
815 836
816 ret = nf_register_hook(&ip_conntrack_defrag_ops); 837 ret = nf_register_hooks(ip_conntrack_ops, ARRAY_SIZE(ip_conntrack_ops));
817 if (ret < 0) { 838 if (ret < 0) {
818 printk("ip_conntrack: can't register pre-routing defrag hook.\n"); 839 printk("ip_conntrack: can't register hooks.\n");
819 goto cleanup_proc_stat; 840 goto cleanup_proc_stat;
820 } 841 }
821 ret = nf_register_hook(&ip_conntrack_defrag_local_out_ops);
822 if (ret < 0) {
823 printk("ip_conntrack: can't register local_out defrag hook.\n");
824 goto cleanup_defragops;
825 }
826 ret = nf_register_hook(&ip_conntrack_in_ops);
827 if (ret < 0) {
828 printk("ip_conntrack: can't register pre-routing hook.\n");
829 goto cleanup_defraglocalops;
830 }
831 ret = nf_register_hook(&ip_conntrack_local_out_ops);
832 if (ret < 0) {
833 printk("ip_conntrack: can't register local out hook.\n");
834 goto cleanup_inops;
835 }
836 ret = nf_register_hook(&ip_conntrack_helper_in_ops);
837 if (ret < 0) {
838 printk("ip_conntrack: can't register local in helper hook.\n");
839 goto cleanup_inandlocalops;
840 }
841 ret = nf_register_hook(&ip_conntrack_helper_out_ops);
842 if (ret < 0) {
843 printk("ip_conntrack: can't register postrouting helper hook.\n");
844 goto cleanup_helperinops;
845 }
846 ret = nf_register_hook(&ip_conntrack_out_ops);
847 if (ret < 0) {
848 printk("ip_conntrack: can't register post-routing hook.\n");
849 goto cleanup_helperoutops;
850 }
851 ret = nf_register_hook(&ip_conntrack_local_in_ops);
852 if (ret < 0) {
853 printk("ip_conntrack: can't register local in hook.\n");
854 goto cleanup_inoutandlocalops;
855 }
856#ifdef CONFIG_SYSCTL 842#ifdef CONFIG_SYSCTL
857 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0); 843 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0);
858 if (ip_ct_sysctl_header == NULL) { 844 if (ip_ct_sysctl_header == NULL) {
859 printk("ip_conntrack: can't register to sysctl.\n"); 845 printk("ip_conntrack: can't register to sysctl.\n");
860 ret = -ENOMEM; 846 ret = -ENOMEM;
861 goto cleanup_localinops; 847 goto cleanup_hooks;
862 } 848 }
863#endif 849#endif
864
865 return ret; 850 return ret;
866 851
867 cleanup:
868 synchronize_net();
869#ifdef CONFIG_SYSCTL 852#ifdef CONFIG_SYSCTL
870 unregister_sysctl_table(ip_ct_sysctl_header); 853 cleanup_hooks:
871 cleanup_localinops: 854 nf_unregister_hooks(ip_conntrack_ops, ARRAY_SIZE(ip_conntrack_ops));
872#endif 855#endif
873 nf_unregister_hook(&ip_conntrack_local_in_ops);
874 cleanup_inoutandlocalops:
875 nf_unregister_hook(&ip_conntrack_out_ops);
876 cleanup_helperoutops:
877 nf_unregister_hook(&ip_conntrack_helper_out_ops);
878 cleanup_helperinops:
879 nf_unregister_hook(&ip_conntrack_helper_in_ops);
880 cleanup_inandlocalops:
881 nf_unregister_hook(&ip_conntrack_local_out_ops);
882 cleanup_inops:
883 nf_unregister_hook(&ip_conntrack_in_ops);
884 cleanup_defraglocalops:
885 nf_unregister_hook(&ip_conntrack_defrag_local_out_ops);
886 cleanup_defragops:
887 nf_unregister_hook(&ip_conntrack_defrag_ops);
888 cleanup_proc_stat: 856 cleanup_proc_stat:
889#ifdef CONFIG_PROC_FS 857#ifdef CONFIG_PROC_FS
890 remove_proc_entry("ip_conntrack", proc_net_stat); 858 remove_proc_entry("ip_conntrack", proc_net_stat);
@@ -895,48 +863,22 @@ static int init_or_cleanup(int init)
895 cleanup_init: 863 cleanup_init:
896#endif /* CONFIG_PROC_FS */ 864#endif /* CONFIG_PROC_FS */
897 ip_conntrack_cleanup(); 865 ip_conntrack_cleanup();
898 cleanup_nothing:
899 return ret;
900}
901
902/* FIXME: Allow NULL functions and sub in pointers to generic for
903 them. --RR */
904int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
905{
906 int ret = 0;
907
908 write_lock_bh(&ip_conntrack_lock);
909 if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) {
910 ret = -EBUSY;
911 goto out;
912 }
913 ip_ct_protos[proto->proto] = proto;
914 out:
915 write_unlock_bh(&ip_conntrack_lock);
916 return ret; 866 return ret;
917} 867}
918 868
919void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto)
920{
921 write_lock_bh(&ip_conntrack_lock);
922 ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol;
923 write_unlock_bh(&ip_conntrack_lock);
924
925 /* Somebody could be still looking at the proto in bh. */
926 synchronize_net();
927
928 /* Remove all contrack entries for this protocol */
929 ip_ct_iterate_cleanup(kill_proto, &proto->proto);
930}
931
932static int __init ip_conntrack_standalone_init(void)
933{
934 return init_or_cleanup(1);
935}
936
937static void __exit ip_conntrack_standalone_fini(void) 869static void __exit ip_conntrack_standalone_fini(void)
938{ 870{
939 init_or_cleanup(0); 871 synchronize_net();
872#ifdef CONFIG_SYSCTL
873 unregister_sysctl_table(ip_ct_sysctl_header);
874#endif
875 nf_unregister_hooks(ip_conntrack_ops, ARRAY_SIZE(ip_conntrack_ops));
876#ifdef CONFIG_PROC_FS
877 remove_proc_entry("ip_conntrack", proc_net_stat);
878 proc_net_remove("ip_conntrack_expect");
879 proc_net_remove("ip_conntrack");
880#endif /* CONFIG_PROC_FS */
881 ip_conntrack_cleanup();
940} 882}
941 883
942module_init(ip_conntrack_standalone_init); 884module_init(ip_conntrack_standalone_init);
diff --git a/net/ipv4/netfilter/ip_nat_helper_h323.c b/net/ipv4/netfilter/ip_nat_helper_h323.c
index a0bc883928c0..d45663d137a7 100644
--- a/net/ipv4/netfilter/ip_nat_helper_h323.c
+++ b/net/ipv4/netfilter/ip_nat_helper_h323.c
@@ -7,24 +7,6 @@
7 * 7 *
8 * Based on the 'brute force' H.323 NAT module by 8 * Based on the 'brute force' H.323 NAT module by
9 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> 9 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 *
11 * Changes:
12 * 2006-02-01 - initial version 0.1
13 *
14 * 2006-02-20 - version 0.2
15 * 1. Changed source format to follow kernel conventions
16 * 2. Deleted some unnecessary structures
17 * 3. Minor fixes
18 *
19 * 2006-03-10 - version 0.3
20 * 1. Added support for multiple TPKTs in one packet (suggested by
21 * Patrick McHardy)
22 * 2. Added support for non-linear skb (based on Patrick McHardy's patch)
23 * 3. Eliminated unnecessary return code
24 *
25 * 2006-03-15 - version 0.4
26 * 1. Added support for T.120 channels
27 * 2. Added parameter gkrouted_only (suggested by Patrick McHardy)
28 */ 10 */
29 11
30#include <linux/module.h> 12#include <linux/module.h>
@@ -41,65 +23,12 @@
41#include <linux/netfilter_ipv4/ip_conntrack_h323.h> 23#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
42#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 24#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
43 25
44#include "ip_conntrack_helper_h323_asn1.h"
45
46#if 0 26#if 0
47#define DEBUGP printk 27#define DEBUGP printk
48#else 28#else
49#define DEBUGP(format, args...) 29#define DEBUGP(format, args...)
50#endif 30#endif
51 31
52extern int get_h245_addr(unsigned char *data, H245_TransportAddress * addr,
53 u_int32_t * ip, u_int16_t * port);
54extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
55 u_int32_t * ip, u_int16_t * port);
56extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
57 struct ip_conntrack_expect *this);
58extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
59 struct ip_conntrack_expect *this);
60extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
61 unsigned char **data, int dataoff,
62 H245_TransportAddress * addr,
63 u_int32_t ip, u_int16_t port);
64extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
65 unsigned char **data, int dataoff,
66 TransportAddress * addr,
67 u_int32_t ip, u_int16_t port);
68extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
69 struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data,
72 TransportAddress * addr, int count);
73extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
74 struct ip_conntrack * ct,
75 enum ip_conntrack_info ctinfo,
76 unsigned char **data,
77 TransportAddress * addr, int count);
78extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
79 struct ip_conntrack * ct,
80 enum ip_conntrack_info ctinfo,
81 unsigned char **data, int dataoff,
82 H245_TransportAddress * addr,
83 u_int16_t port, u_int16_t rtp_port,
84 struct ip_conntrack_expect * rtp_exp,
85 struct ip_conntrack_expect * rtcp_exp);
86extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
87 enum ip_conntrack_info ctinfo,
88 unsigned char **data, int dataoff,
89 H245_TransportAddress * addr, u_int16_t port,
90 struct ip_conntrack_expect * exp);
91extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
92 enum ip_conntrack_info ctinfo,
93 unsigned char **data, int dataoff,
94 TransportAddress * addr, u_int16_t port,
95 struct ip_conntrack_expect * exp);
96extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
97 enum ip_conntrack_info ctinfo,
98 unsigned char **data, TransportAddress * addr,
99 int idx, u_int16_t port,
100 struct ip_conntrack_expect * exp);
101
102
103/****************************************************************************/ 32/****************************************************************************/
104static int set_addr(struct sk_buff **pskb, 33static int set_addr(struct sk_buff **pskb,
105 unsigned char **data, int dataoff, 34 unsigned char **data, int dataoff,
diff --git a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
index efba8c4e42e0..1aba926c1cb0 100644
--- a/net/ipv4/netfilter/ip_nat_rule.c
+++ b/net/ipv4/netfilter/ip_nat_rule.c
@@ -279,7 +279,7 @@ static struct ipt_target ipt_dnat_reg = {
279 .target = ipt_dnat_target, 279 .target = ipt_dnat_target,
280 .targetsize = sizeof(struct ip_nat_multi_range_compat), 280 .targetsize = sizeof(struct ip_nat_multi_range_compat),
281 .table = "nat", 281 .table = "nat",
282 .hooks = 1 << NF_IP_PRE_ROUTING, 282 .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_OUT),
283 .checkentry = ipt_dnat_checkentry, 283 .checkentry = ipt_dnat_checkentry,
284}; 284};
285 285
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 3505b0de2e04..8f760b28617e 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -299,69 +299,63 @@ ip_nat_adjust(unsigned int hooknum,
299 299
300/* We must be after connection tracking and before packet filtering. */ 300/* We must be after connection tracking and before packet filtering. */
301 301
302/* Before packet filtering, change destination */ 302static struct nf_hook_ops ip_nat_ops[] = {
303static struct nf_hook_ops ip_nat_in_ops = { 303 /* Before packet filtering, change destination */
304 .hook = ip_nat_in, 304 {
305 .owner = THIS_MODULE, 305 .hook = ip_nat_in,
306 .pf = PF_INET, 306 .owner = THIS_MODULE,
307 .hooknum = NF_IP_PRE_ROUTING, 307 .pf = PF_INET,
308 .priority = NF_IP_PRI_NAT_DST, 308 .hooknum = NF_IP_PRE_ROUTING,
309 .priority = NF_IP_PRI_NAT_DST,
310 },
311 /* After packet filtering, change source */
312 {
313 .hook = ip_nat_out,
314 .owner = THIS_MODULE,
315 .pf = PF_INET,
316 .hooknum = NF_IP_POST_ROUTING,
317 .priority = NF_IP_PRI_NAT_SRC,
318 },
319 /* After conntrack, adjust sequence number */
320 {
321 .hook = ip_nat_adjust,
322 .owner = THIS_MODULE,
323 .pf = PF_INET,
324 .hooknum = NF_IP_POST_ROUTING,
325 .priority = NF_IP_PRI_NAT_SEQ_ADJUST,
326 },
327 /* Before packet filtering, change destination */
328 {
329 .hook = ip_nat_local_fn,
330 .owner = THIS_MODULE,
331 .pf = PF_INET,
332 .hooknum = NF_IP_LOCAL_OUT,
333 .priority = NF_IP_PRI_NAT_DST,
334 },
335 /* After packet filtering, change source */
336 {
337 .hook = ip_nat_fn,
338 .owner = THIS_MODULE,
339 .pf = PF_INET,
340 .hooknum = NF_IP_LOCAL_IN,
341 .priority = NF_IP_PRI_NAT_SRC,
342 },
343 /* After conntrack, adjust sequence number */
344 {
345 .hook = ip_nat_adjust,
346 .owner = THIS_MODULE,
347 .pf = PF_INET,
348 .hooknum = NF_IP_LOCAL_IN,
349 .priority = NF_IP_PRI_NAT_SEQ_ADJUST,
350 },
309}; 351};
310 352
311/* After packet filtering, change source */ 353static int __init ip_nat_standalone_init(void)
312static struct nf_hook_ops ip_nat_out_ops = {
313 .hook = ip_nat_out,
314 .owner = THIS_MODULE,
315 .pf = PF_INET,
316 .hooknum = NF_IP_POST_ROUTING,
317 .priority = NF_IP_PRI_NAT_SRC,
318};
319
320/* After conntrack, adjust sequence number */
321static struct nf_hook_ops ip_nat_adjust_out_ops = {
322 .hook = ip_nat_adjust,
323 .owner = THIS_MODULE,
324 .pf = PF_INET,
325 .hooknum = NF_IP_POST_ROUTING,
326 .priority = NF_IP_PRI_NAT_SEQ_ADJUST,
327};
328
329/* Before packet filtering, change destination */
330static struct nf_hook_ops ip_nat_local_out_ops = {
331 .hook = ip_nat_local_fn,
332 .owner = THIS_MODULE,
333 .pf = PF_INET,
334 .hooknum = NF_IP_LOCAL_OUT,
335 .priority = NF_IP_PRI_NAT_DST,
336};
337
338/* After packet filtering, change source for reply packets of LOCAL_OUT DNAT */
339static struct nf_hook_ops ip_nat_local_in_ops = {
340 .hook = ip_nat_fn,
341 .owner = THIS_MODULE,
342 .pf = PF_INET,
343 .hooknum = NF_IP_LOCAL_IN,
344 .priority = NF_IP_PRI_NAT_SRC,
345};
346
347/* After conntrack, adjust sequence number */
348static struct nf_hook_ops ip_nat_adjust_in_ops = {
349 .hook = ip_nat_adjust,
350 .owner = THIS_MODULE,
351 .pf = PF_INET,
352 .hooknum = NF_IP_LOCAL_IN,
353 .priority = NF_IP_PRI_NAT_SEQ_ADJUST,
354};
355
356
357static int init_or_cleanup(int init)
358{ 354{
359 int ret = 0; 355 int ret = 0;
360 356
361 need_conntrack(); 357 need_conntrack();
362 358
363 if (!init) goto cleanup;
364
365#ifdef CONFIG_XFRM 359#ifdef CONFIG_XFRM
366 BUG_ON(ip_nat_decode_session != NULL); 360 BUG_ON(ip_nat_decode_session != NULL);
367 ip_nat_decode_session = nat_decode_session; 361 ip_nat_decode_session = nat_decode_session;
@@ -371,50 +365,13 @@ static int init_or_cleanup(int init)
371 printk("ip_nat_init: can't setup rules.\n"); 365 printk("ip_nat_init: can't setup rules.\n");
372 goto cleanup_decode_session; 366 goto cleanup_decode_session;
373 } 367 }
374 ret = nf_register_hook(&ip_nat_in_ops); 368 ret = nf_register_hooks(ip_nat_ops, ARRAY_SIZE(ip_nat_ops));
375 if (ret < 0) { 369 if (ret < 0) {
376 printk("ip_nat_init: can't register in hook.\n"); 370 printk("ip_nat_init: can't register hooks.\n");
377 goto cleanup_rule_init; 371 goto cleanup_rule_init;
378 } 372 }
379 ret = nf_register_hook(&ip_nat_out_ops);
380 if (ret < 0) {
381 printk("ip_nat_init: can't register out hook.\n");
382 goto cleanup_inops;
383 }
384 ret = nf_register_hook(&ip_nat_adjust_in_ops);
385 if (ret < 0) {
386 printk("ip_nat_init: can't register adjust in hook.\n");
387 goto cleanup_outops;
388 }
389 ret = nf_register_hook(&ip_nat_adjust_out_ops);
390 if (ret < 0) {
391 printk("ip_nat_init: can't register adjust out hook.\n");
392 goto cleanup_adjustin_ops;
393 }
394 ret = nf_register_hook(&ip_nat_local_out_ops);
395 if (ret < 0) {
396 printk("ip_nat_init: can't register local out hook.\n");
397 goto cleanup_adjustout_ops;
398 }
399 ret = nf_register_hook(&ip_nat_local_in_ops);
400 if (ret < 0) {
401 printk("ip_nat_init: can't register local in hook.\n");
402 goto cleanup_localoutops;
403 }
404 return ret; 373 return ret;
405 374
406 cleanup:
407 nf_unregister_hook(&ip_nat_local_in_ops);
408 cleanup_localoutops:
409 nf_unregister_hook(&ip_nat_local_out_ops);
410 cleanup_adjustout_ops:
411 nf_unregister_hook(&ip_nat_adjust_out_ops);
412 cleanup_adjustin_ops:
413 nf_unregister_hook(&ip_nat_adjust_in_ops);
414 cleanup_outops:
415 nf_unregister_hook(&ip_nat_out_ops);
416 cleanup_inops:
417 nf_unregister_hook(&ip_nat_in_ops);
418 cleanup_rule_init: 375 cleanup_rule_init:
419 ip_nat_rule_cleanup(); 376 ip_nat_rule_cleanup();
420 cleanup_decode_session: 377 cleanup_decode_session:
@@ -425,14 +382,14 @@ static int init_or_cleanup(int init)
425 return ret; 382 return ret;
426} 383}
427 384
428static int __init ip_nat_standalone_init(void)
429{
430 return init_or_cleanup(1);
431}
432
433static void __exit ip_nat_standalone_fini(void) 385static void __exit ip_nat_standalone_fini(void)
434{ 386{
435 init_or_cleanup(0); 387 nf_unregister_hooks(ip_nat_ops, ARRAY_SIZE(ip_nat_ops));
388 ip_nat_rule_cleanup();
389#ifdef CONFIG_XFRM
390 ip_nat_decode_session = NULL;
391 synchronize_net();
392#endif
436} 393}
437 394
438module_init(ip_nat_standalone_init); 395module_init(ip_nat_standalone_init);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 896a244f8f91..b93f0494362f 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -662,15 +662,11 @@ static struct nf_queue_handler nfqh = {
662 .outfn = &ipq_enqueue_packet, 662 .outfn = &ipq_enqueue_packet,
663}; 663};
664 664
665static int 665static int __init ip_queue_init(void)
666init_or_cleanup(int init)
667{ 666{
668 int status = -ENOMEM; 667 int status = -ENOMEM;
669 struct proc_dir_entry *proc; 668 struct proc_dir_entry *proc;
670 669
671 if (!init)
672 goto cleanup;
673
674 netlink_register_notifier(&ipq_nl_notifier); 670 netlink_register_notifier(&ipq_nl_notifier);
675 ipqnl = netlink_kernel_create(NETLINK_FIREWALL, 0, ipq_rcv_sk, 671 ipqnl = netlink_kernel_create(NETLINK_FIREWALL, 0, ipq_rcv_sk,
676 THIS_MODULE); 672 THIS_MODULE);
@@ -697,11 +693,6 @@ init_or_cleanup(int init)
697 } 693 }
698 return status; 694 return status;
699 695
700cleanup:
701 nf_unregister_queue_handlers(&nfqh);
702 synchronize_net();
703 ipq_flush(NF_DROP);
704
705cleanup_sysctl: 696cleanup_sysctl:
706 unregister_sysctl_table(ipq_sysctl_header); 697 unregister_sysctl_table(ipq_sysctl_header);
707 unregister_netdevice_notifier(&ipq_dev_notifier); 698 unregister_netdevice_notifier(&ipq_dev_notifier);
@@ -717,15 +708,21 @@ cleanup_netlink_notifier:
717 return status; 708 return status;
718} 709}
719 710
720static int __init ip_queue_init(void)
721{
722
723 return init_or_cleanup(1);
724}
725
726static void __exit ip_queue_fini(void) 711static void __exit ip_queue_fini(void)
727{ 712{
728 init_or_cleanup(0); 713 nf_unregister_queue_handlers(&nfqh);
714 synchronize_net();
715 ipq_flush(NF_DROP);
716
717 unregister_sysctl_table(ipq_sysctl_header);
718 unregister_netdevice_notifier(&ipq_dev_notifier);
719 proc_net_remove(IPQ_PROC_FS_NAME);
720
721 sock_release(ipqnl->sk_socket);
722 mutex_lock(&ipqnl_mutex);
723 mutex_unlock(&ipqnl_mutex);
724
725 netlink_unregister_notifier(&ipq_nl_notifier);
729} 726}
730 727
731MODULE_DESCRIPTION("IPv4 packet queue handler"); 728MODULE_DESCRIPTION("IPv4 packet queue handler");
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index d5b8cdd361ce..d25ac8ba6eba 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -735,7 +735,7 @@ translate_table(const char *name,
735 } 735 }
736 736
737 /* And one copy for every other CPU */ 737 /* And one copy for every other CPU */
738 for_each_cpu(i) { 738 for_each_possible_cpu(i) {
739 if (newinfo->entries[i] && newinfo->entries[i] != entry0) 739 if (newinfo->entries[i] && newinfo->entries[i] != entry0)
740 memcpy(newinfo->entries[i], entry0, newinfo->size); 740 memcpy(newinfo->entries[i], entry0, newinfo->size);
741 } 741 }
@@ -788,7 +788,7 @@ get_counters(const struct xt_table_info *t,
788 counters, 788 counters,
789 &i); 789 &i);
790 790
791 for_each_cpu(cpu) { 791 for_each_possible_cpu(cpu) {
792 if (cpu == curcpu) 792 if (cpu == curcpu)
793 continue; 793 continue;
794 i = 0; 794 i = 0;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index e4768a31718b..aad9d28c8d71 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -725,22 +725,17 @@ static struct file_operations clusterip_proc_fops = {
725 725
726#endif /* CONFIG_PROC_FS */ 726#endif /* CONFIG_PROC_FS */
727 727
728static int init_or_cleanup(int fini) 728static int __init ipt_clusterip_init(void)
729{ 729{
730 int ret; 730 int ret;
731 731
732 if (fini) 732 ret = ipt_register_target(&clusterip_tgt);
733 goto cleanup; 733 if (ret < 0)
734 734 return ret;
735 if (ipt_register_target(&clusterip_tgt)) {
736 ret = -EINVAL;
737 goto cleanup_none;
738 }
739 735
740 if (nf_register_hook(&cip_arp_ops) < 0) { 736 ret = nf_register_hook(&cip_arp_ops);
741 ret = -EINVAL; 737 if (ret < 0)
742 goto cleanup_target; 738 goto cleanup_target;
743 }
744 739
745#ifdef CONFIG_PROC_FS 740#ifdef CONFIG_PROC_FS
746 clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", proc_net); 741 clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", proc_net);
@@ -753,31 +748,24 @@ static int init_or_cleanup(int fini)
753 748
754 printk(KERN_NOTICE "ClusterIP Version %s loaded successfully\n", 749 printk(KERN_NOTICE "ClusterIP Version %s loaded successfully\n",
755 CLUSTERIP_VERSION); 750 CLUSTERIP_VERSION);
756
757 return 0; 751 return 0;
758 752
759cleanup:
760 printk(KERN_NOTICE "ClusterIP Version %s unloading\n",
761 CLUSTERIP_VERSION);
762#ifdef CONFIG_PROC_FS
763 remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent);
764#endif
765cleanup_hook: 753cleanup_hook:
766 nf_unregister_hook(&cip_arp_ops); 754 nf_unregister_hook(&cip_arp_ops);
767cleanup_target: 755cleanup_target:
768 ipt_unregister_target(&clusterip_tgt); 756 ipt_unregister_target(&clusterip_tgt);
769cleanup_none: 757 return ret;
770 return -EINVAL;
771}
772
773static int __init ipt_clusterip_init(void)
774{
775 return init_or_cleanup(0);
776} 758}
777 759
778static void __exit ipt_clusterip_fini(void) 760static void __exit ipt_clusterip_fini(void)
779{ 761{
780 init_or_cleanup(1); 762 printk(KERN_NOTICE "ClusterIP Version %s unloading\n",
763 CLUSTERIP_VERSION);
764#ifdef CONFIG_PROC_FS
765 remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent);
766#endif
767 nf_unregister_hook(&cip_arp_ops);
768 ipt_unregister_target(&clusterip_tgt);
781} 769}
782 770
783module_init(ipt_clusterip_init); 771module_init(ipt_clusterip_init);
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 4269a5440d43..0bba3c2bb786 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -106,7 +106,6 @@ static void send_reset(struct sk_buff *oldskb, int hook)
106 struct rtable *rt; 106 struct rtable *rt;
107 u_int16_t tmp_port; 107 u_int16_t tmp_port;
108 u_int32_t tmp_addr; 108 u_int32_t tmp_addr;
109 unsigned int tcplen;
110 int needs_ack; 109 int needs_ack;
111 int hh_len; 110 int hh_len;
112 111
@@ -124,13 +123,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
124 return; 123 return;
125 124
126 /* Check checksum */ 125 /* Check checksum */
127 tcplen = oldskb->len - iph->ihl * 4; 126 if (nf_ip_checksum(oldskb, hook, iph->ihl * 4, IPPROTO_TCP))
128 if (((hook != NF_IP_LOCAL_IN && oldskb->ip_summed != CHECKSUM_HW) ||
129 (hook == NF_IP_LOCAL_IN &&
130 oldskb->ip_summed != CHECKSUM_UNNECESSARY)) &&
131 csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP,
132 oldskb->ip_summed == CHECKSUM_HW ? oldskb->csum :
133 skb_checksum(oldskb, iph->ihl * 4, tcplen, 0)))
134 return; 127 return;
135 128
136 if ((rt = route_reverse(oldskb, oth, hook)) == NULL) 129 if ((rt = route_reverse(oldskb, oth, hook)) == NULL)
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
index 3d80aefe9cfa..7f417484bfbf 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -157,37 +157,20 @@ static int __init iptable_filter_init(void)
157 return ret; 157 return ret;
158 158
159 /* Register hooks */ 159 /* Register hooks */
160 ret = nf_register_hook(&ipt_ops[0]); 160 ret = nf_register_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
161 if (ret < 0) 161 if (ret < 0)
162 goto cleanup_table; 162 goto cleanup_table;
163 163
164 ret = nf_register_hook(&ipt_ops[1]);
165 if (ret < 0)
166 goto cleanup_hook0;
167
168 ret = nf_register_hook(&ipt_ops[2]);
169 if (ret < 0)
170 goto cleanup_hook1;
171
172 return ret; 164 return ret;
173 165
174 cleanup_hook1:
175 nf_unregister_hook(&ipt_ops[1]);
176 cleanup_hook0:
177 nf_unregister_hook(&ipt_ops[0]);
178 cleanup_table: 166 cleanup_table:
179 ipt_unregister_table(&packet_filter); 167 ipt_unregister_table(&packet_filter);
180
181 return ret; 168 return ret;
182} 169}
183 170
184static void __exit iptable_filter_fini(void) 171static void __exit iptable_filter_fini(void)
185{ 172{
186 unsigned int i; 173 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
187
188 for (i = 0; i < sizeof(ipt_ops)/sizeof(struct nf_hook_ops); i++)
189 nf_unregister_hook(&ipt_ops[i]);
190
191 ipt_unregister_table(&packet_filter); 174 ipt_unregister_table(&packet_filter);
192} 175}
193 176
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index 412fc96cc896..397b95cc026b 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -211,49 +211,20 @@ static int __init iptable_mangle_init(void)
211 return ret; 211 return ret;
212 212
213 /* Register hooks */ 213 /* Register hooks */
214 ret = nf_register_hook(&ipt_ops[0]); 214 ret = nf_register_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
215 if (ret < 0) 215 if (ret < 0)
216 goto cleanup_table; 216 goto cleanup_table;
217 217
218 ret = nf_register_hook(&ipt_ops[1]);
219 if (ret < 0)
220 goto cleanup_hook0;
221
222 ret = nf_register_hook(&ipt_ops[2]);
223 if (ret < 0)
224 goto cleanup_hook1;
225
226 ret = nf_register_hook(&ipt_ops[3]);
227 if (ret < 0)
228 goto cleanup_hook2;
229
230 ret = nf_register_hook(&ipt_ops[4]);
231 if (ret < 0)
232 goto cleanup_hook3;
233
234 return ret; 218 return ret;
235 219
236 cleanup_hook3:
237 nf_unregister_hook(&ipt_ops[3]);
238 cleanup_hook2:
239 nf_unregister_hook(&ipt_ops[2]);
240 cleanup_hook1:
241 nf_unregister_hook(&ipt_ops[1]);
242 cleanup_hook0:
243 nf_unregister_hook(&ipt_ops[0]);
244 cleanup_table: 220 cleanup_table:
245 ipt_unregister_table(&packet_mangler); 221 ipt_unregister_table(&packet_mangler);
246
247 return ret; 222 return ret;
248} 223}
249 224
250static void __exit iptable_mangle_fini(void) 225static void __exit iptable_mangle_fini(void)
251{ 226{
252 unsigned int i; 227 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
253
254 for (i = 0; i < sizeof(ipt_ops)/sizeof(struct nf_hook_ops); i++)
255 nf_unregister_hook(&ipt_ops[i]);
256
257 ipt_unregister_table(&packet_mangler); 228 ipt_unregister_table(&packet_mangler);
258} 229}
259 230
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index 03cc79a6160a..7912cce1e1b8 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -101,18 +101,18 @@ ipt_hook(unsigned int hook,
101/* 'raw' is the very first table. */ 101/* 'raw' is the very first table. */
102static struct nf_hook_ops ipt_ops[] = { 102static struct nf_hook_ops ipt_ops[] = {
103 { 103 {
104 .hook = ipt_hook, 104 .hook = ipt_hook,
105 .pf = PF_INET, 105 .pf = PF_INET,
106 .hooknum = NF_IP_PRE_ROUTING, 106 .hooknum = NF_IP_PRE_ROUTING,
107 .priority = NF_IP_PRI_RAW, 107 .priority = NF_IP_PRI_RAW,
108 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
109 }, 109 },
110 { 110 {
111 .hook = ipt_hook, 111 .hook = ipt_hook,
112 .pf = PF_INET, 112 .pf = PF_INET,
113 .hooknum = NF_IP_LOCAL_OUT, 113 .hooknum = NF_IP_LOCAL_OUT,
114 .priority = NF_IP_PRI_RAW, 114 .priority = NF_IP_PRI_RAW,
115 .owner = THIS_MODULE, 115 .owner = THIS_MODULE,
116 }, 116 },
117}; 117};
118 118
@@ -126,31 +126,20 @@ static int __init iptable_raw_init(void)
126 return ret; 126 return ret;
127 127
128 /* Register hooks */ 128 /* Register hooks */
129 ret = nf_register_hook(&ipt_ops[0]); 129 ret = nf_register_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
130 if (ret < 0) 130 if (ret < 0)
131 goto cleanup_table; 131 goto cleanup_table;
132 132
133 ret = nf_register_hook(&ipt_ops[1]);
134 if (ret < 0)
135 goto cleanup_hook0;
136
137 return ret; 133 return ret;
138 134
139 cleanup_hook0:
140 nf_unregister_hook(&ipt_ops[0]);
141 cleanup_table: 135 cleanup_table:
142 ipt_unregister_table(&packet_raw); 136 ipt_unregister_table(&packet_raw);
143
144 return ret; 137 return ret;
145} 138}
146 139
147static void __exit iptable_raw_fini(void) 140static void __exit iptable_raw_fini(void)
148{ 141{
149 unsigned int i; 142 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
150
151 for (i = 0; i < sizeof(ipt_ops)/sizeof(struct nf_hook_ops); i++)
152 nf_unregister_hook(&ipt_ops[i]);
153
154 ipt_unregister_table(&packet_raw); 143 ipt_unregister_table(&packet_raw);
155} 144}
156 145
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 4afbc699d3ba..5bc9f64d7b5b 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -210,71 +210,63 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum,
210 210
211/* Connection tracking may drop packets, but never alters them, so 211/* Connection tracking may drop packets, but never alters them, so
212 make it the first hook. */ 212 make it the first hook. */
213static struct nf_hook_ops ipv4_conntrack_defrag_ops = { 213static struct nf_hook_ops ipv4_conntrack_ops[] = {
214 .hook = ipv4_conntrack_defrag, 214 {
215 .owner = THIS_MODULE, 215 .hook = ipv4_conntrack_defrag,
216 .pf = PF_INET, 216 .owner = THIS_MODULE,
217 .hooknum = NF_IP_PRE_ROUTING, 217 .pf = PF_INET,
218 .priority = NF_IP_PRI_CONNTRACK_DEFRAG, 218 .hooknum = NF_IP_PRE_ROUTING,
219}; 219 .priority = NF_IP_PRI_CONNTRACK_DEFRAG,
220 220 },
221static struct nf_hook_ops ipv4_conntrack_in_ops = { 221 {
222 .hook = ipv4_conntrack_in, 222 .hook = ipv4_conntrack_in,
223 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
224 .pf = PF_INET, 224 .pf = PF_INET,
225 .hooknum = NF_IP_PRE_ROUTING, 225 .hooknum = NF_IP_PRE_ROUTING,
226 .priority = NF_IP_PRI_CONNTRACK, 226 .priority = NF_IP_PRI_CONNTRACK,
227}; 227 },
228 228 {
229static struct nf_hook_ops ipv4_conntrack_defrag_local_out_ops = { 229 .hook = ipv4_conntrack_defrag,
230 .hook = ipv4_conntrack_defrag, 230 .owner = THIS_MODULE,
231 .owner = THIS_MODULE, 231 .pf = PF_INET,
232 .pf = PF_INET, 232 .hooknum = NF_IP_LOCAL_OUT,
233 .hooknum = NF_IP_LOCAL_OUT, 233 .priority = NF_IP_PRI_CONNTRACK_DEFRAG,
234 .priority = NF_IP_PRI_CONNTRACK_DEFRAG, 234 },
235}; 235 {
236 236 .hook = ipv4_conntrack_local,
237static struct nf_hook_ops ipv4_conntrack_local_out_ops = { 237 .owner = THIS_MODULE,
238 .hook = ipv4_conntrack_local, 238 .pf = PF_INET,
239 .owner = THIS_MODULE, 239 .hooknum = NF_IP_LOCAL_OUT,
240 .pf = PF_INET, 240 .priority = NF_IP_PRI_CONNTRACK,
241 .hooknum = NF_IP_LOCAL_OUT, 241 },
242 .priority = NF_IP_PRI_CONNTRACK, 242 {
243}; 243 .hook = ipv4_conntrack_help,
244 244 .owner = THIS_MODULE,
245/* helpers */ 245 .pf = PF_INET,
246static struct nf_hook_ops ipv4_conntrack_helper_out_ops = { 246 .hooknum = NF_IP_POST_ROUTING,
247 .hook = ipv4_conntrack_help, 247 .priority = NF_IP_PRI_CONNTRACK_HELPER,
248 .owner = THIS_MODULE, 248 },
249 .pf = PF_INET, 249 {
250 .hooknum = NF_IP_POST_ROUTING, 250 .hook = ipv4_conntrack_help,
251 .priority = NF_IP_PRI_CONNTRACK_HELPER, 251 .owner = THIS_MODULE,
252}; 252 .pf = PF_INET,
253 253 .hooknum = NF_IP_LOCAL_IN,
254static struct nf_hook_ops ipv4_conntrack_helper_in_ops = { 254 .priority = NF_IP_PRI_CONNTRACK_HELPER,
255 .hook = ipv4_conntrack_help, 255 },
256 .owner = THIS_MODULE, 256 {
257 .pf = PF_INET, 257 .hook = ipv4_confirm,
258 .hooknum = NF_IP_LOCAL_IN, 258 .owner = THIS_MODULE,
259 .priority = NF_IP_PRI_CONNTRACK_HELPER, 259 .pf = PF_INET,
260}; 260 .hooknum = NF_IP_POST_ROUTING,
261 261 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
262 262 },
263/* Refragmenter; last chance. */ 263 {
264static struct nf_hook_ops ipv4_conntrack_out_ops = { 264 .hook = ipv4_confirm,
265 .hook = ipv4_confirm, 265 .owner = THIS_MODULE,
266 .owner = THIS_MODULE, 266 .pf = PF_INET,
267 .pf = PF_INET, 267 .hooknum = NF_IP_LOCAL_IN,
268 .hooknum = NF_IP_POST_ROUTING, 268 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
269 .priority = NF_IP_PRI_CONNTRACK_CONFIRM, 269 },
270};
271
272static struct nf_hook_ops ipv4_conntrack_local_in_ops = {
273 .hook = ipv4_confirm,
274 .owner = THIS_MODULE,
275 .pf = PF_INET,
276 .hooknum = NF_IP_LOCAL_IN,
277 .priority = NF_IP_PRI_CONNTRACK_CONFIRM,
278}; 270};
279 271
280#ifdef CONFIG_SYSCTL 272#ifdef CONFIG_SYSCTL
@@ -440,16 +432,20 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 = {
440extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp4; 432extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp4;
441extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4; 433extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4;
442extern struct nf_conntrack_protocol nf_conntrack_protocol_icmp; 434extern struct nf_conntrack_protocol nf_conntrack_protocol_icmp;
443static int init_or_cleanup(int init) 435
436MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
437MODULE_LICENSE("GPL");
438
439static int __init nf_conntrack_l3proto_ipv4_init(void)
444{ 440{
445 int ret = 0; 441 int ret = 0;
446 442
447 if (!init) goto cleanup; 443 need_conntrack();
448 444
449 ret = nf_register_sockopt(&so_getorigdst); 445 ret = nf_register_sockopt(&so_getorigdst);
450 if (ret < 0) { 446 if (ret < 0) {
451 printk(KERN_ERR "Unable to register netfilter socket option\n"); 447 printk(KERN_ERR "Unable to register netfilter socket option\n");
452 goto cleanup_nothing; 448 return ret;
453 } 449 }
454 450
455 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_tcp4); 451 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_tcp4);
@@ -476,84 +472,26 @@ static int init_or_cleanup(int init)
476 goto cleanup_icmp; 472 goto cleanup_icmp;
477 } 473 }
478 474
479 ret = nf_register_hook(&ipv4_conntrack_defrag_ops); 475 ret = nf_register_hooks(ipv4_conntrack_ops,
476 ARRAY_SIZE(ipv4_conntrack_ops));
480 if (ret < 0) { 477 if (ret < 0) {
481 printk("nf_conntrack_ipv4: can't register pre-routing defrag hook.\n"); 478 printk("nf_conntrack_ipv4: can't register hooks.\n");
482 goto cleanup_ipv4; 479 goto cleanup_ipv4;
483 } 480 }
484 ret = nf_register_hook(&ipv4_conntrack_defrag_local_out_ops);
485 if (ret < 0) {
486 printk("nf_conntrack_ipv4: can't register local_out defrag hook.\n");
487 goto cleanup_defragops;
488 }
489
490 ret = nf_register_hook(&ipv4_conntrack_in_ops);
491 if (ret < 0) {
492 printk("nf_conntrack_ipv4: can't register pre-routing hook.\n");
493 goto cleanup_defraglocalops;
494 }
495
496 ret = nf_register_hook(&ipv4_conntrack_local_out_ops);
497 if (ret < 0) {
498 printk("nf_conntrack_ipv4: can't register local out hook.\n");
499 goto cleanup_inops;
500 }
501
502 ret = nf_register_hook(&ipv4_conntrack_helper_in_ops);
503 if (ret < 0) {
504 printk("nf_conntrack_ipv4: can't register local helper hook.\n");
505 goto cleanup_inandlocalops;
506 }
507
508 ret = nf_register_hook(&ipv4_conntrack_helper_out_ops);
509 if (ret < 0) {
510 printk("nf_conntrack_ipv4: can't register postrouting helper hook.\n");
511 goto cleanup_helperinops;
512 }
513
514 ret = nf_register_hook(&ipv4_conntrack_out_ops);
515 if (ret < 0) {
516 printk("nf_conntrack_ipv4: can't register post-routing hook.\n");
517 goto cleanup_helperoutops;
518 }
519
520 ret = nf_register_hook(&ipv4_conntrack_local_in_ops);
521 if (ret < 0) {
522 printk("nf_conntrack_ipv4: can't register local in hook.\n");
523 goto cleanup_inoutandlocalops;
524 }
525
526#ifdef CONFIG_SYSCTL 481#ifdef CONFIG_SYSCTL
527 nf_ct_ipv4_sysctl_header = register_sysctl_table(nf_ct_net_table, 0); 482 nf_ct_ipv4_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
528 if (nf_ct_ipv4_sysctl_header == NULL) { 483 if (nf_ct_ipv4_sysctl_header == NULL) {
529 printk("nf_conntrack: can't register to sysctl.\n"); 484 printk("nf_conntrack: can't register to sysctl.\n");
530 ret = -ENOMEM; 485 ret = -ENOMEM;
531 goto cleanup_localinops; 486 goto cleanup_hooks;
532 } 487 }
533#endif 488#endif
534 return ret; 489 return ret;
535 490
536 cleanup:
537 synchronize_net();
538#ifdef CONFIG_SYSCTL 491#ifdef CONFIG_SYSCTL
539 unregister_sysctl_table(nf_ct_ipv4_sysctl_header); 492 cleanup_hooks:
540 cleanup_localinops: 493 nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops));
541#endif 494#endif
542 nf_unregister_hook(&ipv4_conntrack_local_in_ops);
543 cleanup_inoutandlocalops:
544 nf_unregister_hook(&ipv4_conntrack_out_ops);
545 cleanup_helperoutops:
546 nf_unregister_hook(&ipv4_conntrack_helper_out_ops);
547 cleanup_helperinops:
548 nf_unregister_hook(&ipv4_conntrack_helper_in_ops);
549 cleanup_inandlocalops:
550 nf_unregister_hook(&ipv4_conntrack_local_out_ops);
551 cleanup_inops:
552 nf_unregister_hook(&ipv4_conntrack_in_ops);
553 cleanup_defraglocalops:
554 nf_unregister_hook(&ipv4_conntrack_defrag_local_out_ops);
555 cleanup_defragops:
556 nf_unregister_hook(&ipv4_conntrack_defrag_ops);
557 cleanup_ipv4: 495 cleanup_ipv4:
558 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); 496 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4);
559 cleanup_icmp: 497 cleanup_icmp:
@@ -564,22 +502,21 @@ static int init_or_cleanup(int init)
564 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp4); 502 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp4);
565 cleanup_sockopt: 503 cleanup_sockopt:
566 nf_unregister_sockopt(&so_getorigdst); 504 nf_unregister_sockopt(&so_getorigdst);
567 cleanup_nothing:
568 return ret; 505 return ret;
569} 506}
570 507
571MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
572MODULE_LICENSE("GPL");
573
574static int __init nf_conntrack_l3proto_ipv4_init(void)
575{
576 need_conntrack();
577 return init_or_cleanup(1);
578}
579
580static void __exit nf_conntrack_l3proto_ipv4_fini(void) 508static void __exit nf_conntrack_l3proto_ipv4_fini(void)
581{ 509{
582 init_or_cleanup(0); 510 synchronize_net();
511#ifdef CONFIG_SYSCTL
512 unregister_sysctl_table(nf_ct_ipv4_sysctl_header);
513#endif
514 nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops));
515 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4);
516 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_icmp);
517 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_udp4);
518 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp4);
519 nf_unregister_sockopt(&so_getorigdst);
583} 520}
584 521
585module_init(nf_conntrack_l3proto_ipv4_init); 522module_init(nf_conntrack_l3proto_ipv4_init);
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 52dc175be39a..4b0d361cc6e6 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -235,30 +235,14 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff,
235 } 235 }
236 236
237 /* See ip_conntrack_proto_tcp.c */ 237 /* See ip_conntrack_proto_tcp.c */
238 if (hooknum != NF_IP_PRE_ROUTING) 238 if (hooknum == NF_IP_PRE_ROUTING &&
239 goto checksum_skipped; 239 nf_ip_checksum(skb, hooknum, dataoff, 0)) {
240
241 switch (skb->ip_summed) {
242 case CHECKSUM_HW:
243 if (!(u16)csum_fold(skb->csum))
244 break;
245 if (LOG_INVALID(IPPROTO_ICMP)) 240 if (LOG_INVALID(IPPROTO_ICMP))
246 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 241 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
247 "nf_ct_icmp: bad HW ICMP checksum "); 242 "nf_ct_icmp: bad HW ICMP checksum ");
248 return -NF_ACCEPT; 243 return -NF_ACCEPT;
249 case CHECKSUM_NONE:
250 if ((u16)csum_fold(skb_checksum(skb, 0, skb->len, 0))) {
251 if (LOG_INVALID(IPPROTO_ICMP))
252 nf_log_packet(PF_INET, 0, skb, NULL, NULL,
253 NULL,
254 "nf_ct_icmp: bad ICMP checksum ");
255 return -NF_ACCEPT;
256 }
257 default:
258 break;
259 } 244 }
260 245
261checksum_skipped:
262 /* 246 /*
263 * 18 is the highest 'known' ICMP type. Anything else is a mystery 247 * 18 is the highest 'known' ICMP type. Anything else is a mystery
264 * 248 *
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 1b167c4bb3be..d61e2a9d394d 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -49,7 +49,7 @@ static int fold_prot_inuse(struct proto *proto)
49 int res = 0; 49 int res = 0;
50 int cpu; 50 int cpu;
51 51
52 for_each_cpu(cpu) 52 for_each_possible_cpu(cpu)
53 res += proto->stats[cpu].inuse; 53 res += proto->stats[cpu].inuse;
54 54
55 return res; 55 return res;
@@ -91,7 +91,7 @@ fold_field(void *mib[], int offt)
91 unsigned long res = 0; 91 unsigned long res = 0;
92 int i; 92 int i;
93 93
94 for_each_cpu(i) { 94 for_each_possible_cpu(i) {
95 res += *(((unsigned long *) per_cpu_ptr(mib[0], i)) + offt); 95 res += *(((unsigned long *) per_cpu_ptr(mib[0], i)) + offt);
96 res += *(((unsigned long *) per_cpu_ptr(mib[1], i)) + offt); 96 res += *(((unsigned long *) per_cpu_ptr(mib[1], i)) + offt);
97 } 97 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 94fcbc5e5a1b..cc9423de7311 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2741,7 +2741,10 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2741 /* Reserve room for dummy headers, this skb can pass 2741 /* Reserve room for dummy headers, this skb can pass
2742 through good chunk of routing engine. 2742 through good chunk of routing engine.
2743 */ 2743 */
2744 skb->mac.raw = skb->data; 2744 skb->mac.raw = skb->nh.raw = skb->data;
2745
2746 /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
2747 skb->nh.iph->protocol = IPPROTO_ICMP;
2745 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); 2748 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
2746 2749
2747 if (rta[RTA_SRC - 1]) 2750 if (rta[RTA_SRC - 1])
@@ -3083,7 +3086,7 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
3083 memcpy(dst, src, length); 3086 memcpy(dst, src, length);
3084 3087
3085 /* Add the other cpus in, one int at a time */ 3088 /* Add the other cpus in, one int at a time */
3086 for_each_cpu(i) { 3089 for_each_possible_cpu(i) {
3087 unsigned int j; 3090 unsigned int j;
3088 3091
3089 src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset; 3092 src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 195d83584558..9f0cca4c4fae 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4559,7 +4559,6 @@ discard:
4559 4559
4560EXPORT_SYMBOL(sysctl_tcp_ecn); 4560EXPORT_SYMBOL(sysctl_tcp_ecn);
4561EXPORT_SYMBOL(sysctl_tcp_reordering); 4561EXPORT_SYMBOL(sysctl_tcp_reordering);
4562EXPORT_SYMBOL(sysctl_tcp_abc);
4563EXPORT_SYMBOL(tcp_parse_options); 4562EXPORT_SYMBOL(tcp_parse_options);
4564EXPORT_SYMBOL(tcp_rcv_established); 4563EXPORT_SYMBOL(tcp_rcv_established);
4565EXPORT_SYMBOL(tcp_rcv_state_process); 4564EXPORT_SYMBOL(tcp_rcv_state_process);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9e85c0416109..672950e54c49 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1859,5 +1859,4 @@ EXPORT_SYMBOL(tcp_proc_unregister);
1859#endif 1859#endif
1860EXPORT_SYMBOL(sysctl_local_port_range); 1860EXPORT_SYMBOL(sysctl_local_port_range);
1861EXPORT_SYMBOL(sysctl_tcp_low_latency); 1861EXPORT_SYMBOL(sysctl_tcp_low_latency);
1862EXPORT_SYMBOL(sysctl_tcp_tw_reuse);
1863 1862
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9d79546d384e..a28ae593b976 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -59,9 +59,6 @@ int sysctl_tcp_tso_win_divisor = 3;
59int sysctl_tcp_mtu_probing = 0; 59int sysctl_tcp_mtu_probing = 0;
60int sysctl_tcp_base_mss = 512; 60int sysctl_tcp_base_mss = 512;
61 61
62EXPORT_SYMBOL(sysctl_tcp_mtu_probing);
63EXPORT_SYMBOL(sysctl_tcp_base_mss);
64
65static void update_send_head(struct sock *sk, struct tcp_sock *tp, 62static void update_send_head(struct sock *sk, struct tcp_sock *tp,
66 struct sk_buff *skb) 63 struct sk_buff *skb)
67{ 64{
@@ -536,6 +533,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
536 struct tcp_sock *tp = tcp_sk(sk); 533 struct tcp_sock *tp = tcp_sk(sk);
537 struct sk_buff *buff; 534 struct sk_buff *buff;
538 int nsize, old_factor; 535 int nsize, old_factor;
536 int nlen;
539 u16 flags; 537 u16 flags;
540 538
541 BUG_ON(len > skb->len); 539 BUG_ON(len > skb->len);
@@ -554,7 +552,11 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
554 buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC); 552 buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC);
555 if (buff == NULL) 553 if (buff == NULL)
556 return -ENOMEM; /* We'll just try again later. */ 554 return -ENOMEM; /* We'll just try again later. */
555
557 sk_charge_skb(sk, buff); 556 sk_charge_skb(sk, buff);
557 nlen = skb->len - len - nsize;
558 buff->truesize += nlen;
559 skb->truesize -= nlen;
558 560
559 /* Correct the sequence numbers. */ 561 /* Correct the sequence numbers. */
560 TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; 562 TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len;
@@ -1040,7 +1042,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
1040 if (unlikely(buff == NULL)) 1042 if (unlikely(buff == NULL))
1041 return -ENOMEM; 1043 return -ENOMEM;
1042 1044
1043 buff->truesize = nlen; 1045 sk_charge_skb(sk, buff);
1046 buff->truesize += nlen;
1044 skb->truesize -= nlen; 1047 skb->truesize -= nlen;
1045 1048
1046 /* Correct the sequence numbers. */ 1049 /* Correct the sequence numbers. */
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index 0d7d386dac22..8d30c48f090e 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -8,6 +8,8 @@
8#include <linux/mutex.h> 8#include <linux/mutex.h>
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/skbuff.h> 10#include <linux/skbuff.h>
11#include <net/icmp.h>
12#include <net/ip.h>
11#include <net/protocol.h> 13#include <net/protocol.h>
12#include <net/xfrm.h> 14#include <net/xfrm.h>
13 15
@@ -70,10 +72,16 @@ static int tunnel4_rcv(struct sk_buff *skb)
70{ 72{
71 struct xfrm_tunnel *handler; 73 struct xfrm_tunnel *handler;
72 74
75 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
76 goto drop;
77
73 for (handler = tunnel4_handlers; handler; handler = handler->next) 78 for (handler = tunnel4_handlers; handler; handler = handler->next)
74 if (!handler->handler(skb)) 79 if (!handler->handler(skb))
75 return 0; 80 return 0;
76 81
82 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
83
84drop:
77 kfree_skb(skb); 85 kfree_skb(skb);
78 return 0; 86 return 0;
79} 87}
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index e1b8f4b90d80..3e174c83bfe7 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -37,8 +37,6 @@ static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
37{ 37{
38 switch (nexthdr) { 38 switch (nexthdr) {
39 case IPPROTO_IPIP: 39 case IPPROTO_IPIP:
40 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
41 return -EINVAL;
42 *spi = skb->nh.iph->saddr; 40 *spi = skb->nh.iph->saddr;
43 *seq = 0; 41 *seq = 0;
44 return 0; 42 return 0;
@@ -90,7 +88,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
90 if (unlikely(x->km.state != XFRM_STATE_VALID)) 88 if (unlikely(x->km.state != XFRM_STATE_VALID))
91 goto drop_unlock; 89 goto drop_unlock;
92 90
93 if (x->encap->encap_type != encap_type) 91 if ((x->encap ? x->encap->encap_type : 0) != encap_type)
94 goto drop_unlock; 92 goto drop_unlock;
95 93
96 if (x->props.replay_window && xfrm_replay_check(x, seq)) 94 if (x->props.replay_window && xfrm_replay_check(x, seq))
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 2a1e7e45b890..a18d4256372c 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -485,15 +485,27 @@ static struct tlvtype_proc tlvprochopopt_lst[] = {
485 { -1, } 485 { -1, }
486}; 486};
487 487
488int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff) 488int ipv6_parse_hopopts(struct sk_buff *skb)
489{ 489{
490 struct inet6_skb_parm *opt = IP6CB(skb); 490 struct inet6_skb_parm *opt = IP6CB(skb);
491 491
492 /*
493 * skb->nh.raw is equal to skb->data, and
494 * skb->h.raw - skb->nh.raw is always equal to
495 * sizeof(struct ipv6hdr) by definition of
496 * hop-by-hop options.
497 */
498 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + 8) ||
499 !pskb_may_pull(skb, sizeof(struct ipv6hdr) + ((skb->h.raw[1] + 1) << 3))) {
500 kfree_skb(skb);
501 return -1;
502 }
503
492 opt->hop = sizeof(struct ipv6hdr); 504 opt->hop = sizeof(struct ipv6hdr);
493 if (ip6_parse_tlv(tlvprochopopt_lst, skb)) { 505 if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
494 skb->h.raw += (skb->h.raw[1]+1)<<3; 506 skb->h.raw += (skb->h.raw[1]+1)<<3;
495 opt->nhoff = sizeof(struct ipv6hdr); 507 opt->nhoff = sizeof(struct ipv6hdr);
496 return sizeof(struct ipv6hdr); 508 return 1;
497 } 509 }
498 return -1; 510 return -1;
499} 511}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 21eb725e885f..1044b6fce0d5 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -717,7 +717,7 @@ int __init icmpv6_init(struct net_proto_family *ops)
717 struct sock *sk; 717 struct sock *sk;
718 int err, i, j; 718 int err, i, j;
719 719
720 for_each_cpu(i) { 720 for_each_possible_cpu(i) {
721 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, 721 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6,
722 &per_cpu(__icmpv6_socket, i)); 722 &per_cpu(__icmpv6_socket, i));
723 if (err < 0) { 723 if (err < 0) {
@@ -763,7 +763,7 @@ void icmpv6_cleanup(void)
763{ 763{
764 int i; 764 int i;
765 765
766 for_each_cpu(i) { 766 for_each_possible_cpu(i) {
767 sock_release(per_cpu(__icmpv6_socket, i)); 767 sock_release(per_cpu(__icmpv6_socket, i));
768 } 768 }
769 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); 769 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index bb8ffb8a14c5..2ae84c961678 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -23,6 +23,86 @@
23#include <net/inet6_hashtables.h> 23#include <net/inet6_hashtables.h>
24#include <net/ip.h> 24#include <net/ip.h>
25 25
26void __inet6_hash(struct inet_hashinfo *hashinfo,
27 struct sock *sk)
28{
29 struct hlist_head *list;
30 rwlock_t *lock;
31
32 BUG_TRAP(sk_unhashed(sk));
33
34 if (sk->sk_state == TCP_LISTEN) {
35 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
36 lock = &hashinfo->lhash_lock;
37 inet_listen_wlock(hashinfo);
38 } else {
39 unsigned int hash;
40 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
41 hash &= (hashinfo->ehash_size - 1);
42 list = &hashinfo->ehash[hash].chain;
43 lock = &hashinfo->ehash[hash].lock;
44 write_lock(lock);
45 }
46
47 __sk_add_node(sk, list);
48 sock_prot_inc_use(sk->sk_prot);
49 write_unlock(lock);
50}
51EXPORT_SYMBOL(__inet6_hash);
52
53/*
54 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
55 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
56 *
57 * The sockhash lock must be held as a reader here.
58 */
59struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
60 const struct in6_addr *saddr,
61 const u16 sport,
62 const struct in6_addr *daddr,
63 const u16 hnum,
64 const int dif)
65{
66 struct sock *sk;
67 const struct hlist_node *node;
68 const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
69 /* Optimize here for direct hit, only listening connections can
70 * have wildcards anyways.
71 */
72 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
73 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
74
75 prefetch(head->chain.first);
76 read_lock(&head->lock);
77 sk_for_each(sk, node, &head->chain) {
78 /* For IPV6 do the cheaper port and family tests first. */
79 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif))
80 goto hit; /* You sunk my battleship! */
81 }
82 /* Must check for a TIME_WAIT'er before going to listener hash. */
83 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
84 const struct inet_timewait_sock *tw = inet_twsk(sk);
85
86 if(*((__u32 *)&(tw->tw_dport)) == ports &&
87 sk->sk_family == PF_INET6) {
88 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
89
90 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
91 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
92 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
93 goto hit;
94 }
95 }
96 read_unlock(&head->lock);
97 return NULL;
98
99hit:
100 sock_hold(sk);
101 read_unlock(&head->lock);
102 return sk;
103}
104EXPORT_SYMBOL(__inet6_lookup_established);
105
26struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 106struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
27 const struct in6_addr *daddr, 107 const struct in6_addr *daddr,
28 const unsigned short hnum, const int dif) 108 const unsigned short hnum, const int dif)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 29f73592e68e..aceee252503d 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -114,11 +114,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
114 } 114 }
115 115
116 if (hdr->nexthdr == NEXTHDR_HOP) { 116 if (hdr->nexthdr == NEXTHDR_HOP) {
117 if (ipv6_parse_hopopts(skb, IP6CB(skb)->nhoff) < 0) { 117 if (ipv6_parse_hopopts(skb) < 0) {
118 IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); 118 IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
119 return 0; 119 return 0;
120 } 120 }
121 hdr = skb->nh.ipv6h;
122 } 121 }
123 122
124 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); 123 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ff9040c92556..a995796b5a57 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -519,9 +519,6 @@ ip6ip6_rcv(struct sk_buff *skb)
519 struct ipv6hdr *ipv6h; 519 struct ipv6hdr *ipv6h;
520 struct ip6_tnl *t; 520 struct ip6_tnl *t;
521 521
522 if (!pskb_may_pull(skb, sizeof (*ipv6h)))
523 goto discard;
524
525 ipv6h = skb->nh.ipv6h; 522 ipv6h = skb->nh.ipv6h;
526 523
527 read_lock(&ip6ip6_lock); 524 read_lock(&ip6ip6_lock);
@@ -529,8 +526,7 @@ ip6ip6_rcv(struct sk_buff *skb)
529 if ((t = ip6ip6_tnl_lookup(&ipv6h->saddr, &ipv6h->daddr)) != NULL) { 526 if ((t = ip6ip6_tnl_lookup(&ipv6h->saddr, &ipv6h->daddr)) != NULL) {
530 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 527 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
531 read_unlock(&ip6ip6_lock); 528 read_unlock(&ip6ip6_lock);
532 kfree_skb(skb); 529 goto discard;
533 return 0;
534 } 530 }
535 531
536 if (!(t->parms.flags & IP6_TNL_F_CAP_RCV)) { 532 if (!(t->parms.flags & IP6_TNL_F_CAP_RCV)) {
@@ -557,9 +553,11 @@ ip6ip6_rcv(struct sk_buff *skb)
557 return 0; 553 return 0;
558 } 554 }
559 read_unlock(&ip6ip6_lock); 555 read_unlock(&ip6ip6_lock);
560 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev);
561discard:
562 return 1; 556 return 1;
557
558discard:
559 kfree_skb(skb);
560 return 0;
563} 561}
564 562
565static inline struct ipv6_txoptions *create_tel(__u8 encap_limit) 563static inline struct ipv6_txoptions *create_tel(__u8 encap_limit)
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 00f3fadfcca7..05eb67def39f 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -290,7 +290,7 @@ static void ipcomp6_free_scratches(void)
290 if (!scratches) 290 if (!scratches)
291 return; 291 return;
292 292
293 for_each_cpu(i) { 293 for_each_possible_cpu(i) {
294 void *scratch = *per_cpu_ptr(scratches, i); 294 void *scratch = *per_cpu_ptr(scratches, i);
295 295
296 vfree(scratch); 296 vfree(scratch);
@@ -313,7 +313,7 @@ static void **ipcomp6_alloc_scratches(void)
313 313
314 ipcomp6_scratches = scratches; 314 ipcomp6_scratches = scratches;
315 315
316 for_each_cpu(i) { 316 for_each_possible_cpu(i) {
317 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); 317 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE);
318 if (!scratch) 318 if (!scratch)
319 return NULL; 319 return NULL;
@@ -344,7 +344,7 @@ static void ipcomp6_free_tfms(struct crypto_tfm **tfms)
344 if (!tfms) 344 if (!tfms)
345 return; 345 return;
346 346
347 for_each_cpu(cpu) { 347 for_each_possible_cpu(cpu) {
348 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); 348 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu);
349 crypto_free_tfm(tfm); 349 crypto_free_tfm(tfm);
350 } 350 }
@@ -384,7 +384,7 @@ static struct crypto_tfm **ipcomp6_alloc_tfms(const char *alg_name)
384 if (!tfms) 384 if (!tfms)
385 goto error; 385 goto error;
386 386
387 for_each_cpu(cpu) { 387 for_each_possible_cpu(cpu) {
388 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); 388 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0);
389 if (!tfm) 389 if (!tfm)
390 goto error; 390 goto error;
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index d750cfc019dc..395a417ba955 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -7,6 +7,7 @@
7#include <net/ipv6.h> 7#include <net/ipv6.h>
8#include <net/ip6_route.h> 8#include <net/ip6_route.h>
9#include <net/xfrm.h> 9#include <net/xfrm.h>
10#include <net/ip6_checksum.h>
10 11
11int ip6_route_me_harder(struct sk_buff *skb) 12int ip6_route_me_harder(struct sk_buff *skb)
12{ 13{
@@ -54,7 +55,7 @@ struct ip6_rt_info {
54 struct in6_addr saddr; 55 struct in6_addr saddr;
55}; 56};
56 57
57static void save(const struct sk_buff *skb, struct nf_info *info) 58static void nf_ip6_saveroute(const struct sk_buff *skb, struct nf_info *info)
58{ 59{
59 struct ip6_rt_info *rt_info = nf_info_reroute(info); 60 struct ip6_rt_info *rt_info = nf_info_reroute(info);
60 61
@@ -66,7 +67,7 @@ static void save(const struct sk_buff *skb, struct nf_info *info)
66 } 67 }
67} 68}
68 69
69static int reroute(struct sk_buff **pskb, const struct nf_info *info) 70static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
70{ 71{
71 struct ip6_rt_info *rt_info = nf_info_reroute(info); 72 struct ip6_rt_info *rt_info = nf_info_reroute(info);
72 73
@@ -79,15 +80,50 @@ static int reroute(struct sk_buff **pskb, const struct nf_info *info)
79 return 0; 80 return 0;
80} 81}
81 82
82static struct nf_queue_rerouter ip6_reroute = { 83unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
83 .rer_size = sizeof(struct ip6_rt_info), 84 unsigned int dataoff, u_int8_t protocol)
84 .save = &save, 85{
85 .reroute = &reroute, 86 struct ipv6hdr *ip6h = skb->nh.ipv6h;
87 unsigned int csum = 0;
88
89 switch (skb->ip_summed) {
90 case CHECKSUM_HW:
91 if (hook != NF_IP6_PRE_ROUTING && hook != NF_IP6_LOCAL_IN)
92 break;
93 if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
94 skb->len - dataoff, protocol,
95 csum_sub(skb->csum,
96 skb_checksum(skb, 0,
97 dataoff, 0)))) {
98 skb->ip_summed = CHECKSUM_UNNECESSARY;
99 break;
100 }
101 /* fall through */
102 case CHECKSUM_NONE:
103 skb->csum = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
104 skb->len - dataoff,
105 protocol,
106 csum_sub(0,
107 skb_checksum(skb, 0,
108 dataoff, 0)));
109 csum = __skb_checksum_complete(skb);
110 }
111 return csum;
112}
113
114EXPORT_SYMBOL(nf_ip6_checksum);
115
116static struct nf_afinfo nf_ip6_afinfo = {
117 .family = AF_INET6,
118 .checksum = nf_ip6_checksum,
119 .saveroute = nf_ip6_saveroute,
120 .reroute = nf_ip6_reroute,
121 .route_key_size = sizeof(struct ip6_rt_info),
86}; 122};
87 123
88int __init ipv6_netfilter_init(void) 124int __init ipv6_netfilter_init(void)
89{ 125{
90 return nf_register_queue_rerouter(PF_INET6, &ip6_reroute); 126 return nf_register_afinfo(&nf_ip6_afinfo);
91} 127}
92 128
93/* This can be called from inet6_init() on errors, so it cannot 129/* This can be called from inet6_init() on errors, so it cannot
@@ -95,5 +131,5 @@ int __init ipv6_netfilter_init(void)
95 */ 131 */
96void ipv6_netfilter_fini(void) 132void ipv6_netfilter_fini(void)
97{ 133{
98 nf_unregister_queue_rerouter(PF_INET6); 134 nf_unregister_afinfo(&nf_ip6_afinfo);
99} 135}
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index e81c6a9dab81..b4b7d441af25 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -658,15 +658,11 @@ static struct nf_queue_handler nfqh = {
658 .outfn = &ipq_enqueue_packet, 658 .outfn = &ipq_enqueue_packet,
659}; 659};
660 660
661static int 661static int __init ip6_queue_init(void)
662init_or_cleanup(int init)
663{ 662{
664 int status = -ENOMEM; 663 int status = -ENOMEM;
665 struct proc_dir_entry *proc; 664 struct proc_dir_entry *proc;
666 665
667 if (!init)
668 goto cleanup;
669
670 netlink_register_notifier(&ipq_nl_notifier); 666 netlink_register_notifier(&ipq_nl_notifier);
671 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk, 667 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk,
672 THIS_MODULE); 668 THIS_MODULE);
@@ -693,11 +689,6 @@ init_or_cleanup(int init)
693 } 689 }
694 return status; 690 return status;
695 691
696cleanup:
697 nf_unregister_queue_handlers(&nfqh);
698 synchronize_net();
699 ipq_flush(NF_DROP);
700
701cleanup_sysctl: 692cleanup_sysctl:
702 unregister_sysctl_table(ipq_sysctl_header); 693 unregister_sysctl_table(ipq_sysctl_header);
703 unregister_netdevice_notifier(&ipq_dev_notifier); 694 unregister_netdevice_notifier(&ipq_dev_notifier);
@@ -713,15 +704,21 @@ cleanup_netlink_notifier:
713 return status; 704 return status;
714} 705}
715 706
716static int __init ip6_queue_init(void)
717{
718
719 return init_or_cleanup(1);
720}
721
722static void __exit ip6_queue_fini(void) 707static void __exit ip6_queue_fini(void)
723{ 708{
724 init_or_cleanup(0); 709 nf_unregister_queue_handlers(&nfqh);
710 synchronize_net();
711 ipq_flush(NF_DROP);
712
713 unregister_sysctl_table(ipq_sysctl_header);
714 unregister_netdevice_notifier(&ipq_dev_notifier);
715 proc_net_remove(IPQ_PROC_FS_NAME);
716
717 sock_release(ipqnl->sk_socket);
718 mutex_lock(&ipqnl_mutex);
719 mutex_unlock(&ipqnl_mutex);
720
721 netlink_unregister_notifier(&ipq_nl_notifier);
725} 722}
726 723
727MODULE_DESCRIPTION("IPv6 packet queue handler"); 724MODULE_DESCRIPTION("IPv6 packet queue handler");
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 3ecf2db841f8..642b4b11464f 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -788,7 +788,7 @@ translate_table(const char *name,
788 } 788 }
789 789
790 /* And one copy for every other CPU */ 790 /* And one copy for every other CPU */
791 for_each_cpu(i) { 791 for_each_possible_cpu(i) {
792 if (newinfo->entries[i] && newinfo->entries[i] != entry0) 792 if (newinfo->entries[i] && newinfo->entries[i] != entry0)
793 memcpy(newinfo->entries[i], entry0, newinfo->size); 793 memcpy(newinfo->entries[i], entry0, newinfo->size);
794 } 794 }
@@ -841,7 +841,7 @@ get_counters(const struct xt_table_info *t,
841 counters, 841 counters,
842 &i); 842 &i);
843 843
844 for_each_cpu(cpu) { 844 for_each_possible_cpu(cpu) {
845 if (cpu == curcpu) 845 if (cpu == curcpu)
846 continue; 846 continue;
847 i = 0; 847 i = 0;
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
index e5e724d9ee60..60976c0c58e8 100644
--- a/net/ipv6/netfilter/ip6table_filter.c
+++ b/net/ipv6/netfilter/ip6table_filter.c
@@ -177,37 +177,20 @@ static int __init ip6table_filter_init(void)
177 return ret; 177 return ret;
178 178
179 /* Register hooks */ 179 /* Register hooks */
180 ret = nf_register_hook(&ip6t_ops[0]); 180 ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
181 if (ret < 0) 181 if (ret < 0)
182 goto cleanup_table; 182 goto cleanup_table;
183 183
184 ret = nf_register_hook(&ip6t_ops[1]);
185 if (ret < 0)
186 goto cleanup_hook0;
187
188 ret = nf_register_hook(&ip6t_ops[2]);
189 if (ret < 0)
190 goto cleanup_hook1;
191
192 return ret; 184 return ret;
193 185
194 cleanup_hook1:
195 nf_unregister_hook(&ip6t_ops[1]);
196 cleanup_hook0:
197 nf_unregister_hook(&ip6t_ops[0]);
198 cleanup_table: 186 cleanup_table:
199 ip6t_unregister_table(&packet_filter); 187 ip6t_unregister_table(&packet_filter);
200
201 return ret; 188 return ret;
202} 189}
203 190
204static void __exit ip6table_filter_fini(void) 191static void __exit ip6table_filter_fini(void)
205{ 192{
206 unsigned int i; 193 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
207
208 for (i = 0; i < sizeof(ip6t_ops)/sizeof(struct nf_hook_ops); i++)
209 nf_unregister_hook(&ip6t_ops[i]);
210
211 ip6t_unregister_table(&packet_filter); 194 ip6t_unregister_table(&packet_filter);
212} 195}
213 196
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index e1f0f6ae9841..03a13eab1dae 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -238,49 +238,20 @@ static int __init ip6table_mangle_init(void)
238 return ret; 238 return ret;
239 239
240 /* Register hooks */ 240 /* Register hooks */
241 ret = nf_register_hook(&ip6t_ops[0]); 241 ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
242 if (ret < 0) 242 if (ret < 0)
243 goto cleanup_table; 243 goto cleanup_table;
244 244
245 ret = nf_register_hook(&ip6t_ops[1]);
246 if (ret < 0)
247 goto cleanup_hook0;
248
249 ret = nf_register_hook(&ip6t_ops[2]);
250 if (ret < 0)
251 goto cleanup_hook1;
252
253 ret = nf_register_hook(&ip6t_ops[3]);
254 if (ret < 0)
255 goto cleanup_hook2;
256
257 ret = nf_register_hook(&ip6t_ops[4]);
258 if (ret < 0)
259 goto cleanup_hook3;
260
261 return ret; 245 return ret;
262 246
263 cleanup_hook3:
264 nf_unregister_hook(&ip6t_ops[3]);
265 cleanup_hook2:
266 nf_unregister_hook(&ip6t_ops[2]);
267 cleanup_hook1:
268 nf_unregister_hook(&ip6t_ops[1]);
269 cleanup_hook0:
270 nf_unregister_hook(&ip6t_ops[0]);
271 cleanup_table: 247 cleanup_table:
272 ip6t_unregister_table(&packet_mangler); 248 ip6t_unregister_table(&packet_mangler);
273
274 return ret; 249 return ret;
275} 250}
276 251
277static void __exit ip6table_mangle_fini(void) 252static void __exit ip6table_mangle_fini(void)
278{ 253{
279 unsigned int i; 254 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
280
281 for (i = 0; i < sizeof(ip6t_ops)/sizeof(struct nf_hook_ops); i++)
282 nf_unregister_hook(&ip6t_ops[i]);
283
284 ip6t_unregister_table(&packet_mangler); 255 ip6t_unregister_table(&packet_mangler);
285} 256}
286 257
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index 54d1fffd62ba..61a7c58e99f8 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -152,31 +152,20 @@ static int __init ip6table_raw_init(void)
152 return ret; 152 return ret;
153 153
154 /* Register hooks */ 154 /* Register hooks */
155 ret = nf_register_hook(&ip6t_ops[0]); 155 ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
156 if (ret < 0) 156 if (ret < 0)
157 goto cleanup_table; 157 goto cleanup_table;
158 158
159 ret = nf_register_hook(&ip6t_ops[1]);
160 if (ret < 0)
161 goto cleanup_hook0;
162
163 return ret; 159 return ret;
164 160
165 cleanup_hook0:
166 nf_unregister_hook(&ip6t_ops[0]);
167 cleanup_table: 161 cleanup_table:
168 ip6t_unregister_table(&packet_raw); 162 ip6t_unregister_table(&packet_raw);
169
170 return ret; 163 return ret;
171} 164}
172 165
173static void __exit ip6table_raw_fini(void) 166static void __exit ip6table_raw_fini(void)
174{ 167{
175 unsigned int i; 168 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
176
177 for (i = 0; i < sizeof(ip6t_ops)/sizeof(struct nf_hook_ops); i++)
178 nf_unregister_hook(&ip6t_ops[i]);
179
180 ip6t_unregister_table(&packet_raw); 169 ip6t_unregister_table(&packet_raw);
181} 170}
182 171
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index c8b5a96cbb0f..93bae36f2663 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -286,55 +286,49 @@ static unsigned int ipv6_conntrack_local(unsigned int hooknum,
286 return ipv6_conntrack_in(hooknum, pskb, in, out, okfn); 286 return ipv6_conntrack_in(hooknum, pskb, in, out, okfn);
287} 287}
288 288
289/* Connection tracking may drop packets, but never alters them, so 289static struct nf_hook_ops ipv6_conntrack_ops[] = {
290 make it the first hook. */ 290 {
291static struct nf_hook_ops ipv6_conntrack_defrag_ops = { 291 .hook = ipv6_defrag,
292 .hook = ipv6_defrag, 292 .owner = THIS_MODULE,
293 .owner = THIS_MODULE, 293 .pf = PF_INET6,
294 .pf = PF_INET6, 294 .hooknum = NF_IP6_PRE_ROUTING,
295 .hooknum = NF_IP6_PRE_ROUTING, 295 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
296 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG, 296 },
297}; 297 {
298 298 .hook = ipv6_conntrack_in,
299static struct nf_hook_ops ipv6_conntrack_in_ops = { 299 .owner = THIS_MODULE,
300 .hook = ipv6_conntrack_in, 300 .pf = PF_INET6,
301 .owner = THIS_MODULE, 301 .hooknum = NF_IP6_PRE_ROUTING,
302 .pf = PF_INET6, 302 .priority = NF_IP6_PRI_CONNTRACK,
303 .hooknum = NF_IP6_PRE_ROUTING, 303 },
304 .priority = NF_IP6_PRI_CONNTRACK, 304 {
305}; 305 .hook = ipv6_conntrack_local,
306 306 .owner = THIS_MODULE,
307static struct nf_hook_ops ipv6_conntrack_local_out_ops = { 307 .pf = PF_INET6,
308 .hook = ipv6_conntrack_local, 308 .hooknum = NF_IP6_LOCAL_OUT,
309 .owner = THIS_MODULE, 309 .priority = NF_IP6_PRI_CONNTRACK,
310 .pf = PF_INET6, 310 },
311 .hooknum = NF_IP6_LOCAL_OUT, 311 {
312 .priority = NF_IP6_PRI_CONNTRACK, 312 .hook = ipv6_defrag,
313}; 313 .owner = THIS_MODULE,
314 314 .pf = PF_INET6,
315static struct nf_hook_ops ipv6_conntrack_defrag_local_out_ops = { 315 .hooknum = NF_IP6_LOCAL_OUT,
316 .hook = ipv6_defrag, 316 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
317 .owner = THIS_MODULE, 317 },
318 .pf = PF_INET6, 318 {
319 .hooknum = NF_IP6_LOCAL_OUT, 319 .hook = ipv6_confirm,
320 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG, 320 .owner = THIS_MODULE,
321}; 321 .pf = PF_INET6,
322 322 .hooknum = NF_IP6_POST_ROUTING,
323/* Refragmenter; last chance. */ 323 .priority = NF_IP6_PRI_LAST,
324static struct nf_hook_ops ipv6_conntrack_out_ops = { 324 },
325 .hook = ipv6_confirm, 325 {
326 .owner = THIS_MODULE, 326 .hook = ipv6_confirm,
327 .pf = PF_INET6, 327 .owner = THIS_MODULE,
328 .hooknum = NF_IP6_POST_ROUTING, 328 .pf = PF_INET6,
329 .priority = NF_IP6_PRI_LAST, 329 .hooknum = NF_IP6_LOCAL_IN,
330}; 330 .priority = NF_IP6_PRI_LAST-1,
331 331 },
332static struct nf_hook_ops ipv6_conntrack_local_in_ops = {
333 .hook = ipv6_confirm,
334 .owner = THIS_MODULE,
335 .pf = PF_INET6,
336 .hooknum = NF_IP6_LOCAL_IN,
337 .priority = NF_IP6_PRI_LAST-1,
338}; 332};
339 333
340#ifdef CONFIG_SYSCTL 334#ifdef CONFIG_SYSCTL
@@ -470,16 +464,21 @@ extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6;
470extern struct nf_conntrack_protocol nf_conntrack_protocol_icmpv6; 464extern struct nf_conntrack_protocol nf_conntrack_protocol_icmpv6;
471extern int nf_ct_frag6_init(void); 465extern int nf_ct_frag6_init(void);
472extern void nf_ct_frag6_cleanup(void); 466extern void nf_ct_frag6_cleanup(void);
473static int init_or_cleanup(int init) 467
468MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
469MODULE_LICENSE("GPL");
470MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>");
471
472static int __init nf_conntrack_l3proto_ipv6_init(void)
474{ 473{
475 int ret = 0; 474 int ret = 0;
476 475
477 if (!init) goto cleanup; 476 need_conntrack();
478 477
479 ret = nf_ct_frag6_init(); 478 ret = nf_ct_frag6_init();
480 if (ret < 0) { 479 if (ret < 0) {
481 printk("nf_conntrack_ipv6: can't initialize frag6.\n"); 480 printk("nf_conntrack_ipv6: can't initialize frag6.\n");
482 goto cleanup_nothing; 481 return ret;
483 } 482 }
484 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_tcp6); 483 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_tcp6);
485 if (ret < 0) { 484 if (ret < 0) {
@@ -505,71 +504,27 @@ static int init_or_cleanup(int init)
505 goto cleanup_icmpv6; 504 goto cleanup_icmpv6;
506 } 505 }
507 506
508 ret = nf_register_hook(&ipv6_conntrack_defrag_ops); 507 ret = nf_register_hooks(ipv6_conntrack_ops,
508 ARRAY_SIZE(ipv6_conntrack_ops));
509 if (ret < 0) { 509 if (ret < 0) {
510 printk("nf_conntrack_ipv6: can't register pre-routing defrag " 510 printk("nf_conntrack_ipv6: can't register pre-routing defrag "
511 "hook.\n"); 511 "hook.\n");
512 goto cleanup_ipv6; 512 goto cleanup_ipv6;
513 } 513 }
514
515 ret = nf_register_hook(&ipv6_conntrack_defrag_local_out_ops);
516 if (ret < 0) {
517 printk("nf_conntrack_ipv6: can't register local_out defrag "
518 "hook.\n");
519 goto cleanup_defragops;
520 }
521
522 ret = nf_register_hook(&ipv6_conntrack_in_ops);
523 if (ret < 0) {
524 printk("nf_conntrack_ipv6: can't register pre-routing hook.\n");
525 goto cleanup_defraglocalops;
526 }
527
528 ret = nf_register_hook(&ipv6_conntrack_local_out_ops);
529 if (ret < 0) {
530 printk("nf_conntrack_ipv6: can't register local out hook.\n");
531 goto cleanup_inops;
532 }
533
534 ret = nf_register_hook(&ipv6_conntrack_out_ops);
535 if (ret < 0) {
536 printk("nf_conntrack_ipv6: can't register post-routing hook.\n");
537 goto cleanup_inandlocalops;
538 }
539
540 ret = nf_register_hook(&ipv6_conntrack_local_in_ops);
541 if (ret < 0) {
542 printk("nf_conntrack_ipv6: can't register local in hook.\n");
543 goto cleanup_inoutandlocalops;
544 }
545
546#ifdef CONFIG_SYSCTL 514#ifdef CONFIG_SYSCTL
547 nf_ct_ipv6_sysctl_header = register_sysctl_table(nf_ct_net_table, 0); 515 nf_ct_ipv6_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
548 if (nf_ct_ipv6_sysctl_header == NULL) { 516 if (nf_ct_ipv6_sysctl_header == NULL) {
549 printk("nf_conntrack: can't register to sysctl.\n"); 517 printk("nf_conntrack: can't register to sysctl.\n");
550 ret = -ENOMEM; 518 ret = -ENOMEM;
551 goto cleanup_localinops; 519 goto cleanup_hooks;
552 } 520 }
553#endif 521#endif
554 return ret; 522 return ret;
555 523
556 cleanup:
557 synchronize_net();
558#ifdef CONFIG_SYSCTL 524#ifdef CONFIG_SYSCTL
559 unregister_sysctl_table(nf_ct_ipv6_sysctl_header); 525 cleanup_hooks:
560 cleanup_localinops: 526 nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops));
561#endif 527#endif
562 nf_unregister_hook(&ipv6_conntrack_local_in_ops);
563 cleanup_inoutandlocalops:
564 nf_unregister_hook(&ipv6_conntrack_out_ops);
565 cleanup_inandlocalops:
566 nf_unregister_hook(&ipv6_conntrack_local_out_ops);
567 cleanup_inops:
568 nf_unregister_hook(&ipv6_conntrack_in_ops);
569 cleanup_defraglocalops:
570 nf_unregister_hook(&ipv6_conntrack_defrag_local_out_ops);
571 cleanup_defragops:
572 nf_unregister_hook(&ipv6_conntrack_defrag_ops);
573 cleanup_ipv6: 528 cleanup_ipv6:
574 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6); 529 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
575 cleanup_icmpv6: 530 cleanup_icmpv6:
@@ -580,23 +535,21 @@ static int init_or_cleanup(int init)
580 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp6); 535 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp6);
581 cleanup_frag6: 536 cleanup_frag6:
582 nf_ct_frag6_cleanup(); 537 nf_ct_frag6_cleanup();
583 cleanup_nothing:
584 return ret; 538 return ret;
585} 539}
586 540
587MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
588MODULE_LICENSE("GPL");
589MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>");
590
591static int __init nf_conntrack_l3proto_ipv6_init(void)
592{
593 need_conntrack();
594 return init_or_cleanup(1);
595}
596
597static void __exit nf_conntrack_l3proto_ipv6_fini(void) 541static void __exit nf_conntrack_l3proto_ipv6_fini(void)
598{ 542{
599 init_or_cleanup(0); 543 synchronize_net();
544#ifdef CONFIG_SYSCTL
545 unregister_sysctl_table(nf_ct_ipv6_sysctl_header);
546#endif
547 nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops));
548 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
549 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_icmpv6);
550 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_udp6);
551 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp6);
552 nf_ct_frag6_cleanup();
600} 553}
601 554
602module_init(nf_conntrack_l3proto_ipv6_init); 555module_init(nf_conntrack_l3proto_ipv6_init);
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 09945c333055..86c6703265d0 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -233,21 +233,13 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff,
233 return -NF_ACCEPT; 233 return -NF_ACCEPT;
234 } 234 }
235 235
236 if (hooknum != NF_IP6_PRE_ROUTING) 236 if (hooknum == NF_IP6_PRE_ROUTING &&
237 goto skipped; 237 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) {
238
239 /* Ignore it if the checksum's bogus. */
240 if (csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
241 skb->len - dataoff, IPPROTO_ICMPV6,
242 skb_checksum(skb, dataoff,
243 skb->len - dataoff, 0))) {
244 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 238 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
245 "nf_ct_icmpv6: ICMPv6 checksum failed\n"); 239 "nf_ct_icmpv6: ICMPv6 checksum failed\n");
246 return -NF_ACCEPT; 240 return -NF_ACCEPT;
247 } 241 }
248 242
249skipped:
250
251 /* is not error message ? */ 243 /* is not error message ? */
252 if (icmp6h->icmp6_type >= 128) 244 if (icmp6h->icmp6_type >= 128)
253 return NF_ACCEPT; 245 return NF_ACCEPT;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 4238b1ed8860..779ddf77f4d4 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -38,7 +38,7 @@ static int fold_prot_inuse(struct proto *proto)
38 int res = 0; 38 int res = 0;
39 int cpu; 39 int cpu;
40 40
41 for_each_cpu(cpu) 41 for_each_possible_cpu(cpu)
42 res += proto->stats[cpu].inuse; 42 res += proto->stats[cpu].inuse;
43 43
44 return res; 44 return res;
@@ -140,7 +140,7 @@ fold_field(void *mib[], int offt)
140 unsigned long res = 0; 140 unsigned long res = 0;
141 int i; 141 int i;
142 142
143 for_each_cpu(i) { 143 for_each_possible_cpu(i) {
144 res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); 144 res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt);
145 res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); 145 res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt);
146 } 146 }
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index b67a45fb93e9..eef985e010ea 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -121,6 +121,10 @@ static __inline__ void fq_unlink(struct frag_queue *fq)
121 write_unlock(&ip6_frag_lock); 121 write_unlock(&ip6_frag_lock);
122} 122}
123 123
124/*
125 * callers should be careful not to use the hash value outside the ipfrag_lock
126 * as doing so could race with ipfrag_hash_rnd being recalculated.
127 */
124static unsigned int ip6qhashfn(u32 id, struct in6_addr *saddr, 128static unsigned int ip6qhashfn(u32 id, struct in6_addr *saddr,
125 struct in6_addr *daddr) 129 struct in6_addr *daddr)
126{ 130{
@@ -324,15 +328,16 @@ out:
324/* Creation primitives. */ 328/* Creation primitives. */
325 329
326 330
327static struct frag_queue *ip6_frag_intern(unsigned int hash, 331static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
328 struct frag_queue *fq_in)
329{ 332{
330 struct frag_queue *fq; 333 struct frag_queue *fq;
334 unsigned int hash;
331#ifdef CONFIG_SMP 335#ifdef CONFIG_SMP
332 struct hlist_node *n; 336 struct hlist_node *n;
333#endif 337#endif
334 338
335 write_lock(&ip6_frag_lock); 339 write_lock(&ip6_frag_lock);
340 hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr);
336#ifdef CONFIG_SMP 341#ifdef CONFIG_SMP
337 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { 342 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) {
338 if (fq->id == fq_in->id && 343 if (fq->id == fq_in->id &&
@@ -362,7 +367,7 @@ static struct frag_queue *ip6_frag_intern(unsigned int hash,
362 367
363 368
364static struct frag_queue * 369static struct frag_queue *
365ip6_frag_create(unsigned int hash, u32 id, struct in6_addr *src, struct in6_addr *dst) 370ip6_frag_create(u32 id, struct in6_addr *src, struct in6_addr *dst)
366{ 371{
367 struct frag_queue *fq; 372 struct frag_queue *fq;
368 373
@@ -379,7 +384,7 @@ ip6_frag_create(unsigned int hash, u32 id, struct in6_addr *src, struct in6_addr
379 spin_lock_init(&fq->lock); 384 spin_lock_init(&fq->lock);
380 atomic_set(&fq->refcnt, 1); 385 atomic_set(&fq->refcnt, 1);
381 386
382 return ip6_frag_intern(hash, fq); 387 return ip6_frag_intern(fq);
383 388
384oom: 389oom:
385 IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS); 390 IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
@@ -391,9 +396,10 @@ fq_find(u32 id, struct in6_addr *src, struct in6_addr *dst)
391{ 396{
392 struct frag_queue *fq; 397 struct frag_queue *fq;
393 struct hlist_node *n; 398 struct hlist_node *n;
394 unsigned int hash = ip6qhashfn(id, src, dst); 399 unsigned int hash;
395 400
396 read_lock(&ip6_frag_lock); 401 read_lock(&ip6_frag_lock);
402 hash = ip6qhashfn(id, src, dst);
397 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { 403 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) {
398 if (fq->id == id && 404 if (fq->id == id &&
399 ipv6_addr_equal(src, &fq->saddr) && 405 ipv6_addr_equal(src, &fq->saddr) &&
@@ -405,7 +411,7 @@ fq_find(u32 id, struct in6_addr *src, struct in6_addr *dst)
405 } 411 }
406 read_unlock(&ip6_frag_lock); 412 read_unlock(&ip6_frag_lock);
407 413
408 return ip6_frag_create(hash, id, src, dst); 414 return ip6_frag_create(id, src, dst);
409} 415}
410 416
411 417
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index c2d3e17beae6..6578c3080f47 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -397,7 +397,7 @@ static int ipip6_rcv(struct sk_buff *skb)
397 return 0; 397 return 0;
398 } 398 }
399 399
400 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); 400 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
401 kfree_skb(skb); 401 kfree_skb(skb);
402 read_unlock(&ipip6_lock); 402 read_unlock(&ipip6_lock);
403out: 403out:
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c
index 5659b52284bd..0ef9a35798d1 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -19,11 +19,13 @@
19 * YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> 19 * YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
20 */ 20 */
21 21
22#include <linux/icmpv6.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/module.h> 24#include <linux/module.h>
24#include <linux/mutex.h> 25#include <linux/mutex.h>
25#include <linux/netdevice.h> 26#include <linux/netdevice.h>
26#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <net/ipv6.h>
27#include <net/protocol.h> 29#include <net/protocol.h>
28#include <net/xfrm.h> 30#include <net/xfrm.h>
29 31
@@ -87,10 +89,16 @@ static int tunnel6_rcv(struct sk_buff **pskb)
87 struct sk_buff *skb = *pskb; 89 struct sk_buff *skb = *pskb;
88 struct xfrm6_tunnel *handler; 90 struct xfrm6_tunnel *handler;
89 91
92 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
93 goto drop;
94
90 for (handler = tunnel6_handlers; handler; handler = handler->next) 95 for (handler = tunnel6_handlers; handler; handler = handler->next)
91 if (!handler->handler(skb)) 96 if (!handler->handler(skb))
92 return 0; 97 return 0;
93 98
99 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, skb->dev);
100
101drop:
94 kfree_skb(skb); 102 kfree_skb(skb);
95 return 0; 103 return 0;
96} 104}
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 91cce8b2d7a5..88c840f1beb6 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -191,16 +191,18 @@ error:
191static inline void 191static inline void
192_decode_session6(struct sk_buff *skb, struct flowi *fl) 192_decode_session6(struct sk_buff *skb, struct flowi *fl)
193{ 193{
194 u16 offset = sizeof(struct ipv6hdr); 194 u16 offset = skb->h.raw - skb->nh.raw;
195 struct ipv6hdr *hdr = skb->nh.ipv6h; 195 struct ipv6hdr *hdr = skb->nh.ipv6h;
196 struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); 196 struct ipv6_opt_hdr *exthdr;
197 u8 nexthdr = skb->nh.ipv6h->nexthdr; 197 u8 nexthdr = skb->nh.raw[IP6CB(skb)->nhoff];
198 198
199 memset(fl, 0, sizeof(struct flowi)); 199 memset(fl, 0, sizeof(struct flowi));
200 ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); 200 ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr);
201 ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); 201 ipv6_addr_copy(&fl->fl6_src, &hdr->saddr);
202 202
203 while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) { 203 while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) {
204 exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
205
204 switch (nexthdr) { 206 switch (nexthdr) {
205 case NEXTHDR_ROUTING: 207 case NEXTHDR_ROUTING:
206 case NEXTHDR_HOP: 208 case NEXTHDR_HOP:
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 8f3addf0724c..d62e0f9b9da3 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -118,7 +118,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
118 u16 pdulen = eth_hdr(skb)->h_proto, 118 u16 pdulen = eth_hdr(skb)->h_proto,
119 data_size = ntohs(pdulen) - llc_len; 119 data_size = ntohs(pdulen) - llc_len;
120 120
121 skb_trim(skb, data_size); 121 if (unlikely(pskb_trim_rcsum(skb, data_size)))
122 return 0;
122 } 123 }
123 return 1; 124 return 1;
124} 125}
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 1ceb1a6c254b..8455a32ea5c4 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -27,6 +27,29 @@
27 27
28#include "nf_internals.h" 28#include "nf_internals.h"
29 29
30static DEFINE_SPINLOCK(afinfo_lock);
31
32struct nf_afinfo *nf_afinfo[NPROTO];
33EXPORT_SYMBOL(nf_afinfo);
34
35int nf_register_afinfo(struct nf_afinfo *afinfo)
36{
37 spin_lock(&afinfo_lock);
38 rcu_assign_pointer(nf_afinfo[afinfo->family], afinfo);
39 spin_unlock(&afinfo_lock);
40 return 0;
41}
42EXPORT_SYMBOL_GPL(nf_register_afinfo);
43
44void nf_unregister_afinfo(struct nf_afinfo *afinfo)
45{
46 spin_lock(&afinfo_lock);
47 rcu_assign_pointer(nf_afinfo[afinfo->family], NULL);
48 spin_unlock(&afinfo_lock);
49 synchronize_rcu();
50}
51EXPORT_SYMBOL_GPL(nf_unregister_afinfo);
52
30/* In this code, we can be waiting indefinitely for userspace to 53/* In this code, we can be waiting indefinitely for userspace to
31 * service a packet if a hook returns NF_QUEUE. We could keep a count 54 * service a packet if a hook returns NF_QUEUE. We could keep a count
32 * of skbuffs queued for userspace, and not deregister a hook unless 55 * of skbuffs queued for userspace, and not deregister a hook unless
@@ -63,6 +86,34 @@ void nf_unregister_hook(struct nf_hook_ops *reg)
63} 86}
64EXPORT_SYMBOL(nf_unregister_hook); 87EXPORT_SYMBOL(nf_unregister_hook);
65 88
89int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n)
90{
91 unsigned int i;
92 int err = 0;
93
94 for (i = 0; i < n; i++) {
95 err = nf_register_hook(&reg[i]);
96 if (err)
97 goto err;
98 }
99 return err;
100
101err:
102 if (i > 0)
103 nf_unregister_hooks(reg, i);
104 return err;
105}
106EXPORT_SYMBOL(nf_register_hooks);
107
108void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n)
109{
110 unsigned int i;
111
112 for (i = 0; i < n; i++)
113 nf_unregister_hook(&reg[i]);
114}
115EXPORT_SYMBOL(nf_unregister_hooks);
116
66unsigned int nf_iterate(struct list_head *head, 117unsigned int nf_iterate(struct list_head *head,
67 struct sk_buff **skb, 118 struct sk_buff **skb,
68 int hook, 119 int hook,
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 56389c83557c..e581190fb6c3 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -146,7 +146,7 @@ static void nf_ct_event_cache_flush(void)
146 struct nf_conntrack_ecache *ecache; 146 struct nf_conntrack_ecache *ecache;
147 int cpu; 147 int cpu;
148 148
149 for_each_cpu(cpu) { 149 for_each_possible_cpu(cpu) {
150 ecache = &per_cpu(nf_conntrack_ecache, cpu); 150 ecache = &per_cpu(nf_conntrack_ecache, cpu);
151 if (ecache->ct) 151 if (ecache->ct)
152 nf_ct_put(ecache->ct); 152 nf_ct_put(ecache->ct);
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 6492ed66fb3c..69899f27d26a 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -799,8 +799,7 @@ static int tcp_error(struct sk_buff *skb,
799 unsigned int dataoff, 799 unsigned int dataoff,
800 enum ip_conntrack_info *ctinfo, 800 enum ip_conntrack_info *ctinfo,
801 int pf, 801 int pf,
802 unsigned int hooknum, 802 unsigned int hooknum)
803 int(*csum)(const struct sk_buff *,unsigned int))
804{ 803{
805 struct tcphdr _tcph, *th; 804 struct tcphdr _tcph, *th;
806 unsigned int tcplen = skb->len - dataoff; 805 unsigned int tcplen = skb->len - dataoff;
@@ -830,9 +829,8 @@ static int tcp_error(struct sk_buff *skb,
830 */ 829 */
831 /* FIXME: Source route IP option packets --RR */ 830 /* FIXME: Source route IP option packets --RR */
832 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || 831 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
833 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) 832 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) &&
834 && skb->ip_summed != CHECKSUM_UNNECESSARY 833 nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) {
835 && csum(skb, dataoff)) {
836 if (LOG_INVALID(IPPROTO_TCP)) 834 if (LOG_INVALID(IPPROTO_TCP))
837 nf_log_packet(pf, 0, skb, NULL, NULL, NULL, 835 nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
838 "nf_ct_tcp: bad TCP checksum "); 836 "nf_ct_tcp: bad TCP checksum ");
@@ -851,44 +849,6 @@ static int tcp_error(struct sk_buff *skb,
851 return NF_ACCEPT; 849 return NF_ACCEPT;
852} 850}
853 851
854static int csum4(const struct sk_buff *skb, unsigned int dataoff)
855{
856 return csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr,
857 skb->len - dataoff, IPPROTO_TCP,
858 skb->ip_summed == CHECKSUM_HW ? skb->csum
859 : skb_checksum(skb, dataoff,
860 skb->len - dataoff, 0));
861}
862
863static int csum6(const struct sk_buff *skb, unsigned int dataoff)
864{
865 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
866 skb->len - dataoff, IPPROTO_TCP,
867 skb->ip_summed == CHECKSUM_HW
868 ? csum_sub(skb->csum,
869 skb_checksum(skb, 0, dataoff, 0))
870 : skb_checksum(skb, dataoff, skb->len - dataoff,
871 0));
872}
873
874static int tcp_error4(struct sk_buff *skb,
875 unsigned int dataoff,
876 enum ip_conntrack_info *ctinfo,
877 int pf,
878 unsigned int hooknum)
879{
880 return tcp_error(skb, dataoff, ctinfo, pf, hooknum, csum4);
881}
882
883static int tcp_error6(struct sk_buff *skb,
884 unsigned int dataoff,
885 enum ip_conntrack_info *ctinfo,
886 int pf,
887 unsigned int hooknum)
888{
889 return tcp_error(skb, dataoff, ctinfo, pf, hooknum, csum6);
890}
891
892/* Returns verdict for packet, or -1 for invalid. */ 852/* Returns verdict for packet, or -1 for invalid. */
893static int tcp_packet(struct nf_conn *conntrack, 853static int tcp_packet(struct nf_conn *conntrack,
894 const struct sk_buff *skb, 854 const struct sk_buff *skb,
@@ -1218,7 +1178,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_tcp4 =
1218 .print_conntrack = tcp_print_conntrack, 1178 .print_conntrack = tcp_print_conntrack,
1219 .packet = tcp_packet, 1179 .packet = tcp_packet,
1220 .new = tcp_new, 1180 .new = tcp_new,
1221 .error = tcp_error4, 1181 .error = tcp_error,
1222#if defined(CONFIG_NF_CT_NETLINK) || \ 1182#if defined(CONFIG_NF_CT_NETLINK) || \
1223 defined(CONFIG_NF_CT_NETLINK_MODULE) 1183 defined(CONFIG_NF_CT_NETLINK_MODULE)
1224 .to_nfattr = tcp_to_nfattr, 1184 .to_nfattr = tcp_to_nfattr,
@@ -1239,7 +1199,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_tcp6 =
1239 .print_conntrack = tcp_print_conntrack, 1199 .print_conntrack = tcp_print_conntrack,
1240 .packet = tcp_packet, 1200 .packet = tcp_packet,
1241 .new = tcp_new, 1201 .new = tcp_new,
1242 .error = tcp_error6, 1202 .error = tcp_error,
1243#if defined(CONFIG_NF_CT_NETLINK) || \ 1203#if defined(CONFIG_NF_CT_NETLINK) || \
1244 defined(CONFIG_NF_CT_NETLINK_MODULE) 1204 defined(CONFIG_NF_CT_NETLINK_MODULE)
1245 .to_nfattr = tcp_to_nfattr, 1205 .to_nfattr = tcp_to_nfattr,
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 831d206344e0..d93edbfde9e3 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -103,8 +103,7 @@ static int udp_new(struct nf_conn *conntrack, const struct sk_buff *skb,
103static int udp_error(struct sk_buff *skb, unsigned int dataoff, 103static int udp_error(struct sk_buff *skb, unsigned int dataoff,
104 enum ip_conntrack_info *ctinfo, 104 enum ip_conntrack_info *ctinfo,
105 int pf, 105 int pf,
106 unsigned int hooknum, 106 unsigned int hooknum)
107 int (*csum)(const struct sk_buff *, unsigned int))
108{ 107{
109 unsigned int udplen = skb->len - dataoff; 108 unsigned int udplen = skb->len - dataoff;
110 struct udphdr _hdr, *hdr; 109 struct udphdr _hdr, *hdr;
@@ -136,9 +135,8 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
136 * and moreover root might send raw packets. 135 * and moreover root might send raw packets.
137 * FIXME: Source route IP option packets --RR */ 136 * FIXME: Source route IP option packets --RR */
138 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || 137 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
139 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) 138 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) &&
140 && skb->ip_summed != CHECKSUM_UNNECESSARY 139 nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
141 && csum(skb, dataoff)) {
142 if (LOG_INVALID(IPPROTO_UDP)) 140 if (LOG_INVALID(IPPROTO_UDP))
143 nf_log_packet(pf, 0, skb, NULL, NULL, NULL, 141 nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
144 "nf_ct_udp: bad UDP checksum "); 142 "nf_ct_udp: bad UDP checksum ");
@@ -148,44 +146,6 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
148 return NF_ACCEPT; 146 return NF_ACCEPT;
149} 147}
150 148
151static int csum4(const struct sk_buff *skb, unsigned int dataoff)
152{
153 return csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr,
154 skb->len - dataoff, IPPROTO_UDP,
155 skb->ip_summed == CHECKSUM_HW ? skb->csum
156 : skb_checksum(skb, dataoff,
157 skb->len - dataoff, 0));
158}
159
160static int csum6(const struct sk_buff *skb, unsigned int dataoff)
161{
162 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
163 skb->len - dataoff, IPPROTO_UDP,
164 skb->ip_summed == CHECKSUM_HW
165 ? csum_sub(skb->csum,
166 skb_checksum(skb, 0, dataoff, 0))
167 : skb_checksum(skb, dataoff, skb->len - dataoff,
168 0));
169}
170
171static int udp_error4(struct sk_buff *skb,
172 unsigned int dataoff,
173 enum ip_conntrack_info *ctinfo,
174 int pf,
175 unsigned int hooknum)
176{
177 return udp_error(skb, dataoff, ctinfo, pf, hooknum, csum4);
178}
179
180static int udp_error6(struct sk_buff *skb,
181 unsigned int dataoff,
182 enum ip_conntrack_info *ctinfo,
183 int pf,
184 unsigned int hooknum)
185{
186 return udp_error(skb, dataoff, ctinfo, pf, hooknum, csum6);
187}
188
189struct nf_conntrack_protocol nf_conntrack_protocol_udp4 = 149struct nf_conntrack_protocol nf_conntrack_protocol_udp4 =
190{ 150{
191 .l3proto = PF_INET, 151 .l3proto = PF_INET,
@@ -197,7 +157,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_udp4 =
197 .print_conntrack = udp_print_conntrack, 157 .print_conntrack = udp_print_conntrack,
198 .packet = udp_packet, 158 .packet = udp_packet,
199 .new = udp_new, 159 .new = udp_new,
200 .error = udp_error4, 160 .error = udp_error,
201#if defined(CONFIG_NF_CT_NETLINK) || \ 161#if defined(CONFIG_NF_CT_NETLINK) || \
202 defined(CONFIG_NF_CT_NETLINK_MODULE) 162 defined(CONFIG_NF_CT_NETLINK_MODULE)
203 .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, 163 .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
@@ -216,7 +176,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_udp6 =
216 .print_conntrack = udp_print_conntrack, 176 .print_conntrack = udp_print_conntrack,
217 .packet = udp_packet, 177 .packet = udp_packet,
218 .new = udp_new, 178 .new = udp_new,
219 .error = udp_error6, 179 .error = udp_error,
220#if defined(CONFIG_NF_CT_NETLINK) || \ 180#if defined(CONFIG_NF_CT_NETLINK) || \
221 defined(CONFIG_NF_CT_NETLINK_MODULE) 181 defined(CONFIG_NF_CT_NETLINK_MODULE)
222 .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, 182 .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index c72aa3cd22e4..408960c6a544 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -649,63 +649,6 @@ static ctl_table nf_ct_net_table[] = {
649EXPORT_SYMBOL(nf_ct_log_invalid); 649EXPORT_SYMBOL(nf_ct_log_invalid);
650#endif /* CONFIG_SYSCTL */ 650#endif /* CONFIG_SYSCTL */
651 651
652static int init_or_cleanup(int init)
653{
654#ifdef CONFIG_PROC_FS
655 struct proc_dir_entry *proc, *proc_exp, *proc_stat;
656#endif
657 int ret = 0;
658
659 if (!init) goto cleanup;
660
661 ret = nf_conntrack_init();
662 if (ret < 0)
663 goto cleanup_nothing;
664
665#ifdef CONFIG_PROC_FS
666 proc = proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops);
667 if (!proc) goto cleanup_init;
668
669 proc_exp = proc_net_fops_create("nf_conntrack_expect", 0440,
670 &exp_file_ops);
671 if (!proc_exp) goto cleanup_proc;
672
673 proc_stat = create_proc_entry("nf_conntrack", S_IRUGO, proc_net_stat);
674 if (!proc_stat)
675 goto cleanup_proc_exp;
676
677 proc_stat->proc_fops = &ct_cpu_seq_fops;
678 proc_stat->owner = THIS_MODULE;
679#endif
680#ifdef CONFIG_SYSCTL
681 nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
682 if (nf_ct_sysctl_header == NULL) {
683 printk("nf_conntrack: can't register to sysctl.\n");
684 ret = -ENOMEM;
685 goto cleanup_proc_stat;
686 }
687#endif
688
689 return ret;
690
691 cleanup:
692#ifdef CONFIG_SYSCTL
693 unregister_sysctl_table(nf_ct_sysctl_header);
694 cleanup_proc_stat:
695#endif
696#ifdef CONFIG_PROC_FS
697 remove_proc_entry("nf_conntrack", proc_net_stat);
698 cleanup_proc_exp:
699 proc_net_remove("nf_conntrack_expect");
700 cleanup_proc:
701 proc_net_remove("nf_conntrack");
702 cleanup_init:
703#endif /* CNFIG_PROC_FS */
704 nf_conntrack_cleanup();
705 cleanup_nothing:
706 return ret;
707}
708
709int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto) 652int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto)
710{ 653{
711 int ret = 0; 654 int ret = 0;
@@ -808,12 +751,66 @@ void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto)
808 751
809static int __init nf_conntrack_standalone_init(void) 752static int __init nf_conntrack_standalone_init(void)
810{ 753{
811 return init_or_cleanup(1); 754#ifdef CONFIG_PROC_FS
755 struct proc_dir_entry *proc, *proc_exp, *proc_stat;
756#endif
757 int ret = 0;
758
759 ret = nf_conntrack_init();
760 if (ret < 0)
761 return ret;
762
763#ifdef CONFIG_PROC_FS
764 proc = proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops);
765 if (!proc) goto cleanup_init;
766
767 proc_exp = proc_net_fops_create("nf_conntrack_expect", 0440,
768 &exp_file_ops);
769 if (!proc_exp) goto cleanup_proc;
770
771 proc_stat = create_proc_entry("nf_conntrack", S_IRUGO, proc_net_stat);
772 if (!proc_stat)
773 goto cleanup_proc_exp;
774
775 proc_stat->proc_fops = &ct_cpu_seq_fops;
776 proc_stat->owner = THIS_MODULE;
777#endif
778#ifdef CONFIG_SYSCTL
779 nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
780 if (nf_ct_sysctl_header == NULL) {
781 printk("nf_conntrack: can't register to sysctl.\n");
782 ret = -ENOMEM;
783 goto cleanup_proc_stat;
784 }
785#endif
786 return ret;
787
788#ifdef CONFIG_SYSCTL
789 cleanup_proc_stat:
790#endif
791#ifdef CONFIG_PROC_FS
792 remove_proc_entry("nf_conntrack", proc_net_stat);
793 cleanup_proc_exp:
794 proc_net_remove("nf_conntrack_expect");
795 cleanup_proc:
796 proc_net_remove("nf_conntrack");
797 cleanup_init:
798#endif /* CNFIG_PROC_FS */
799 nf_conntrack_cleanup();
800 return ret;
812} 801}
813 802
814static void __exit nf_conntrack_standalone_fini(void) 803static void __exit nf_conntrack_standalone_fini(void)
815{ 804{
816 init_or_cleanup(0); 805#ifdef CONFIG_SYSCTL
806 unregister_sysctl_table(nf_ct_sysctl_header);
807#endif
808#ifdef CONFIG_PROC_FS
809 remove_proc_entry("nf_conntrack", proc_net_stat);
810 proc_net_remove("nf_conntrack_expect");
811 proc_net_remove("nf_conntrack");
812#endif /* CNFIG_PROC_FS */
813 nf_conntrack_cleanup();
817} 814}
818 815
819module_init(nf_conntrack_standalone_init); 816module_init(nf_conntrack_standalone_init);
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index d9f0d7ef103b..ee8f70889f47 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -17,7 +17,6 @@
17 * for queueing and must reinject all packets it receives, no matter what. 17 * for queueing and must reinject all packets it receives, no matter what.
18 */ 18 */
19static struct nf_queue_handler *queue_handler[NPROTO]; 19static struct nf_queue_handler *queue_handler[NPROTO];
20static struct nf_queue_rerouter *queue_rerouter[NPROTO];
21 20
22static DEFINE_RWLOCK(queue_handler_lock); 21static DEFINE_RWLOCK(queue_handler_lock);
23 22
@@ -59,32 +58,6 @@ int nf_unregister_queue_handler(int pf)
59} 58}
60EXPORT_SYMBOL(nf_unregister_queue_handler); 59EXPORT_SYMBOL(nf_unregister_queue_handler);
61 60
62int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer)
63{
64 if (pf >= NPROTO)
65 return -EINVAL;
66
67 write_lock_bh(&queue_handler_lock);
68 rcu_assign_pointer(queue_rerouter[pf], rer);
69 write_unlock_bh(&queue_handler_lock);
70
71 return 0;
72}
73EXPORT_SYMBOL_GPL(nf_register_queue_rerouter);
74
75int nf_unregister_queue_rerouter(int pf)
76{
77 if (pf >= NPROTO)
78 return -EINVAL;
79
80 write_lock_bh(&queue_handler_lock);
81 rcu_assign_pointer(queue_rerouter[pf], NULL);
82 write_unlock_bh(&queue_handler_lock);
83 synchronize_rcu();
84 return 0;
85}
86EXPORT_SYMBOL_GPL(nf_unregister_queue_rerouter);
87
88void nf_unregister_queue_handlers(struct nf_queue_handler *qh) 61void nf_unregister_queue_handlers(struct nf_queue_handler *qh)
89{ 62{
90 int pf; 63 int pf;
@@ -116,7 +89,7 @@ int nf_queue(struct sk_buff **skb,
116 struct net_device *physindev = NULL; 89 struct net_device *physindev = NULL;
117 struct net_device *physoutdev = NULL; 90 struct net_device *physoutdev = NULL;
118#endif 91#endif
119 struct nf_queue_rerouter *rerouter; 92 struct nf_afinfo *afinfo;
120 93
121 /* QUEUE == DROP if noone is waiting, to be safe. */ 94 /* QUEUE == DROP if noone is waiting, to be safe. */
122 read_lock(&queue_handler_lock); 95 read_lock(&queue_handler_lock);
@@ -126,7 +99,14 @@ int nf_queue(struct sk_buff **skb,
126 return 1; 99 return 1;
127 } 100 }
128 101
129 info = kmalloc(sizeof(*info)+queue_rerouter[pf]->rer_size, GFP_ATOMIC); 102 afinfo = nf_get_afinfo(pf);
103 if (!afinfo) {
104 read_unlock(&queue_handler_lock);
105 kfree_skb(*skb);
106 return 1;
107 }
108
109 info = kmalloc(sizeof(*info) + afinfo->route_key_size, GFP_ATOMIC);
130 if (!info) { 110 if (!info) {
131 if (net_ratelimit()) 111 if (net_ratelimit())
132 printk(KERN_ERR "OOM queueing packet %p\n", 112 printk(KERN_ERR "OOM queueing packet %p\n",
@@ -158,10 +138,7 @@ int nf_queue(struct sk_buff **skb,
158 if (physoutdev) dev_hold(physoutdev); 138 if (physoutdev) dev_hold(physoutdev);
159 } 139 }
160#endif 140#endif
161 rerouter = rcu_dereference(queue_rerouter[pf]); 141 afinfo->saveroute(*skb, info);
162 if (rerouter)
163 rerouter->save(*skb, info);
164
165 status = queue_handler[pf]->outfn(*skb, info, queuenum, 142 status = queue_handler[pf]->outfn(*skb, info, queuenum,
166 queue_handler[pf]->data); 143 queue_handler[pf]->data);
167 144
@@ -190,7 +167,7 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
190{ 167{
191 struct list_head *elem = &info->elem->list; 168 struct list_head *elem = &info->elem->list;
192 struct list_head *i; 169 struct list_head *i;
193 struct nf_queue_rerouter *rerouter; 170 struct nf_afinfo *afinfo;
194 171
195 rcu_read_lock(); 172 rcu_read_lock();
196 173
@@ -228,8 +205,8 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
228 } 205 }
229 206
230 if (verdict == NF_ACCEPT) { 207 if (verdict == NF_ACCEPT) {
231 rerouter = rcu_dereference(queue_rerouter[info->pf]); 208 afinfo = nf_get_afinfo(info->pf);
232 if (rerouter && rerouter->reroute(&skb, info) < 0) 209 if (!afinfo || afinfo->reroute(&skb, info) < 0)
233 verdict = NF_DROP; 210 verdict = NF_DROP;
234 } 211 }
235 212
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 3e3f5448bacb..c60273cad778 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1033,17 +1033,13 @@ static struct file_operations nful_file_ops = {
1033 1033
1034#endif /* PROC_FS */ 1034#endif /* PROC_FS */
1035 1035
1036static int 1036static int __init nfnetlink_log_init(void)
1037init_or_cleanup(int init)
1038{ 1037{
1039 int i, status = -ENOMEM; 1038 int i, status = -ENOMEM;
1040#ifdef CONFIG_PROC_FS 1039#ifdef CONFIG_PROC_FS
1041 struct proc_dir_entry *proc_nful; 1040 struct proc_dir_entry *proc_nful;
1042#endif 1041#endif
1043 1042
1044 if (!init)
1045 goto cleanup;
1046
1047 for (i = 0; i < INSTANCE_BUCKETS; i++) 1043 for (i = 0; i < INSTANCE_BUCKETS; i++)
1048 INIT_HLIST_HEAD(&instance_table[i]); 1044 INIT_HLIST_HEAD(&instance_table[i]);
1049 1045
@@ -1066,30 +1062,25 @@ init_or_cleanup(int init)
1066 goto cleanup_subsys; 1062 goto cleanup_subsys;
1067 proc_nful->proc_fops = &nful_file_ops; 1063 proc_nful->proc_fops = &nful_file_ops;
1068#endif 1064#endif
1069
1070 return status; 1065 return status;
1071 1066
1072cleanup:
1073 nf_log_unregister_logger(&nfulnl_logger);
1074#ifdef CONFIG_PROC_FS 1067#ifdef CONFIG_PROC_FS
1075 remove_proc_entry("nfnetlink_log", proc_net_netfilter);
1076cleanup_subsys: 1068cleanup_subsys:
1077#endif
1078 nfnetlink_subsys_unregister(&nfulnl_subsys); 1069 nfnetlink_subsys_unregister(&nfulnl_subsys);
1070#endif
1079cleanup_netlink_notifier: 1071cleanup_netlink_notifier:
1080 netlink_unregister_notifier(&nfulnl_rtnl_notifier); 1072 netlink_unregister_notifier(&nfulnl_rtnl_notifier);
1081 return status; 1073 return status;
1082} 1074}
1083 1075
1084static int __init nfnetlink_log_init(void)
1085{
1086
1087 return init_or_cleanup(1);
1088}
1089
1090static void __exit nfnetlink_log_fini(void) 1076static void __exit nfnetlink_log_fini(void)
1091{ 1077{
1092 init_or_cleanup(0); 1078 nf_log_unregister_logger(&nfulnl_logger);
1079#ifdef CONFIG_PROC_FS
1080 remove_proc_entry("nfnetlink_log", proc_net_netfilter);
1081#endif
1082 nfnetlink_subsys_unregister(&nfulnl_subsys);
1083 netlink_unregister_notifier(&nfulnl_rtnl_notifier);
1093} 1084}
1094 1085
1095MODULE_DESCRIPTION("netfilter userspace logging"); 1086MODULE_DESCRIPTION("netfilter userspace logging");
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index d0e62f68139f..86a4ac33de34 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1071,17 +1071,13 @@ static struct file_operations nfqnl_file_ops = {
1071 1071
1072#endif /* PROC_FS */ 1072#endif /* PROC_FS */
1073 1073
1074static int 1074static int __init nfnetlink_queue_init(void)
1075init_or_cleanup(int init)
1076{ 1075{
1077 int i, status = -ENOMEM; 1076 int i, status = -ENOMEM;
1078#ifdef CONFIG_PROC_FS 1077#ifdef CONFIG_PROC_FS
1079 struct proc_dir_entry *proc_nfqueue; 1078 struct proc_dir_entry *proc_nfqueue;
1080#endif 1079#endif
1081 1080
1082 if (!init)
1083 goto cleanup;
1084
1085 for (i = 0; i < INSTANCE_BUCKETS; i++) 1081 for (i = 0; i < INSTANCE_BUCKETS; i++)
1086 INIT_HLIST_HEAD(&instance_table[i]); 1082 INIT_HLIST_HEAD(&instance_table[i]);
1087 1083
@@ -1101,31 +1097,26 @@ init_or_cleanup(int init)
1101#endif 1097#endif
1102 1098
1103 register_netdevice_notifier(&nfqnl_dev_notifier); 1099 register_netdevice_notifier(&nfqnl_dev_notifier);
1104
1105 return status; 1100 return status;
1106 1101
1107cleanup:
1108 nf_unregister_queue_handlers(&nfqh);
1109 unregister_netdevice_notifier(&nfqnl_dev_notifier);
1110#ifdef CONFIG_PROC_FS 1102#ifdef CONFIG_PROC_FS
1111 remove_proc_entry("nfnetlink_queue", proc_net_netfilter);
1112cleanup_subsys: 1103cleanup_subsys:
1113#endif
1114 nfnetlink_subsys_unregister(&nfqnl_subsys); 1104 nfnetlink_subsys_unregister(&nfqnl_subsys);
1105#endif
1115cleanup_netlink_notifier: 1106cleanup_netlink_notifier:
1116 netlink_unregister_notifier(&nfqnl_rtnl_notifier); 1107 netlink_unregister_notifier(&nfqnl_rtnl_notifier);
1117 return status; 1108 return status;
1118} 1109}
1119 1110
1120static int __init nfnetlink_queue_init(void)
1121{
1122
1123 return init_or_cleanup(1);
1124}
1125
1126static void __exit nfnetlink_queue_fini(void) 1111static void __exit nfnetlink_queue_fini(void)
1127{ 1112{
1128 init_or_cleanup(0); 1113 nf_unregister_queue_handlers(&nfqh);
1114 unregister_netdevice_notifier(&nfqnl_dev_notifier);
1115#ifdef CONFIG_PROC_FS
1116 remove_proc_entry("nfnetlink_queue", proc_net_netfilter);
1117#endif
1118 nfnetlink_subsys_unregister(&nfqnl_subsys);
1119 netlink_unregister_notifier(&nfqnl_rtnl_notifier);
1129} 1120}
1130 1121
1131MODULE_DESCRIPTION("netfilter packet queue handler"); 1122MODULE_DESCRIPTION("netfilter packet queue handler");
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index feb8a9e066b0..00cf0a4f4d92 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -413,7 +413,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
413 413
414 newinfo->size = size; 414 newinfo->size = size;
415 415
416 for_each_cpu(cpu) { 416 for_each_possible_cpu(cpu) {
417 if (size <= PAGE_SIZE) 417 if (size <= PAGE_SIZE)
418 newinfo->entries[cpu] = kmalloc_node(size, 418 newinfo->entries[cpu] = kmalloc_node(size,
419 GFP_KERNEL, 419 GFP_KERNEL,
@@ -436,7 +436,7 @@ void xt_free_table_info(struct xt_table_info *info)
436{ 436{
437 int cpu; 437 int cpu;
438 438
439 for_each_cpu(cpu) { 439 for_each_possible_cpu(cpu) {
440 if (info->size <= PAGE_SIZE) 440 if (info->size <= PAGE_SIZE)
441 kfree(info->entries[cpu]); 441 kfree(info->entries[cpu]);
442 else 442 else
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index fa877f8f652c..24c348fa8922 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -66,7 +66,7 @@ static __inline__ struct tcf_police * tcf_police_lookup(u32 index)
66} 66}
67 67
68#ifdef CONFIG_NET_CLS_ACT 68#ifdef CONFIG_NET_CLS_ACT
69static int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, 69static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb,
70 int type, struct tc_action *a) 70 int type, struct tc_action *a)
71{ 71{
72 struct tcf_police *p; 72 struct tcf_police *p;
@@ -113,7 +113,7 @@ rtattr_failure:
113} 113}
114 114
115static inline int 115static inline int
116tcf_hash_search(struct tc_action *a, u32 index) 116tcf_act_police_hash_search(struct tc_action *a, u32 index)
117{ 117{
118 struct tcf_police *p = tcf_police_lookup(index); 118 struct tcf_police *p = tcf_police_lookup(index);
119 119
@@ -387,9 +387,9 @@ static struct tc_action_ops act_police_ops = {
387 .act = tcf_act_police, 387 .act = tcf_act_police,
388 .dump = tcf_act_police_dump, 388 .dump = tcf_act_police_dump,
389 .cleanup = tcf_act_police_cleanup, 389 .cleanup = tcf_act_police_cleanup,
390 .lookup = tcf_hash_search, 390 .lookup = tcf_act_police_hash_search,
391 .init = tcf_act_police_locate, 391 .init = tcf_act_police_locate,
392 .walk = tcf_generic_walker 392 .walk = tcf_act_police_walker
393}; 393};
394 394
395static int __init 395static int __init
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index d47a52c303a8..5b3b0e0ae7e5 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -69,7 +69,7 @@ fold_field(void *mib[], int nr)
69 unsigned long res = 0; 69 unsigned long res = 0;
70 int i; 70 int i;
71 71
72 for_each_cpu(i) { 72 for_each_possible_cpu(i) {
73 res += 73 res +=
74 *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) + 74 *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
75 sizeof (unsigned long) * nr)); 75 sizeof (unsigned long) * nr));
diff --git a/net/socket.c b/net/socket.c
index b807f360e02c..0ce12dfc7a71 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -119,10 +119,6 @@ static ssize_t sock_writev(struct file *file, const struct iovec *vector,
119static ssize_t sock_sendpage(struct file *file, struct page *page, 119static ssize_t sock_sendpage(struct file *file, struct page *page,
120 int offset, size_t size, loff_t *ppos, int more); 120 int offset, size_t size, loff_t *ppos, int more);
121 121
122extern ssize_t generic_splice_sendpage(struct inode *inode, struct file *out,
123 size_t len, unsigned int flags);
124
125
126/* 122/*
127 * Socket files have a set of 'special' operations as well as the generic file ones. These don't appear 123 * Socket files have a set of 'special' operations as well as the generic file ones. These don't appear
128 * in the operation structures but are done directly via the socketcall() multiplexor. 124 * in the operation structures but are done directly via the socketcall() multiplexor.
@@ -494,6 +490,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
494 struct file *file; 490 struct file *file;
495 struct socket *sock; 491 struct socket *sock;
496 492
493 *err = -EBADF;
497 file = fget_light(fd, fput_needed); 494 file = fget_light(fd, fput_needed);
498 if (file) { 495 if (file) {
499 sock = sock_from_file(file, err); 496 sock = sock_from_file(file, err);
@@ -2136,7 +2133,7 @@ void socket_seq_show(struct seq_file *seq)
2136 int cpu; 2133 int cpu;
2137 int counter = 0; 2134 int counter = 0;
2138 2135
2139 for_each_cpu(cpu) 2136 for_each_possible_cpu(cpu)
2140 counter += per_cpu(sockets_in_use, cpu); 2137 counter += per_cpu(sockets_in_use, cpu);
2141 2138
2142 /* It can be negative, by the way. 8) */ 2139 /* It can be negative, by the way. 8) */
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 900ef31f5a0e..519ebc17c028 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -794,7 +794,6 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
794 794
795out_err: 795out_err:
796 dprintk("RPC: gss_create_cred failed with error %d\n", err); 796 dprintk("RPC: gss_create_cred failed with error %d\n", err);
797 if (cred) gss_destroy_cred(&cred->gc_base);
798 return ERR_PTR(err); 797 return ERR_PTR(err);
799} 798}
800 799
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 97c981fa6b8e..76b969e6904f 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -212,7 +212,6 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
212 char *cksumname; 212 char *cksumname;
213 struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */ 213 struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */
214 struct scatterlist sg[1]; 214 struct scatterlist sg[1];
215 u32 code = GSS_S_FAILURE;
216 215
217 switch (cksumtype) { 216 switch (cksumtype) {
218 case CKSUMTYPE_RSA_MD5: 217 case CKSUMTYPE_RSA_MD5:
@@ -221,13 +220,11 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
221 default: 220 default:
222 dprintk("RPC: krb5_make_checksum:" 221 dprintk("RPC: krb5_make_checksum:"
223 " unsupported checksum %d", cksumtype); 222 " unsupported checksum %d", cksumtype);
224 goto out; 223 return GSS_S_FAILURE;
225 } 224 }
226 if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP))) 225 if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP)))
227 goto out; 226 return GSS_S_FAILURE;
228 cksum->len = crypto_tfm_alg_digestsize(tfm); 227 cksum->len = crypto_tfm_alg_digestsize(tfm);
229 if ((cksum->data = kmalloc(cksum->len, GFP_KERNEL)) == NULL)
230 goto out;
231 228
232 crypto_digest_init(tfm); 229 crypto_digest_init(tfm);
233 sg_set_buf(sg, header, hdrlen); 230 sg_set_buf(sg, header, hdrlen);
@@ -235,10 +232,8 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
235 process_xdr_buf(body, body_offset, body->len - body_offset, 232 process_xdr_buf(body, body_offset, body->len - body_offset,
236 checksummer, tfm); 233 checksummer, tfm);
237 crypto_digest_final(tfm, cksum->data); 234 crypto_digest_final(tfm, cksum->data);
238 code = 0;
239out:
240 crypto_free_tfm(tfm); 235 crypto_free_tfm(tfm);
241 return code; 236 return 0;
242} 237}
243 238
244EXPORT_SYMBOL(make_checksum); 239EXPORT_SYMBOL(make_checksum);
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 4d7eb9e704da..d51e316c5821 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1122,18 +1122,20 @@ svcauth_gss_release(struct svc_rqst *rqstp)
1122 integ_len)) 1122 integ_len))
1123 BUG(); 1123 BUG();
1124 if (resbuf->page_len == 0 1124 if (resbuf->page_len == 0
1125 && resbuf->tail[0].iov_len + RPC_MAX_AUTH_SIZE 1125 && resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE
1126 < PAGE_SIZE) { 1126 < PAGE_SIZE) {
1127 BUG_ON(resbuf->tail[0].iov_len); 1127 BUG_ON(resbuf->tail[0].iov_len);
1128 /* Use head for everything */ 1128 /* Use head for everything */
1129 resv = &resbuf->head[0]; 1129 resv = &resbuf->head[0];
1130 } else if (resbuf->tail[0].iov_base == NULL) { 1130 } else if (resbuf->tail[0].iov_base == NULL) {
1131 /* copied from nfsd4_encode_read */ 1131 if (resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE
1132 svc_take_page(rqstp); 1132 > PAGE_SIZE)
1133 resbuf->tail[0].iov_base = page_address(rqstp 1133 goto out_err;
1134 ->rq_respages[rqstp->rq_resused-1]); 1134 resbuf->tail[0].iov_base =
1135 rqstp->rq_restailpage = rqstp->rq_resused-1; 1135 resbuf->head[0].iov_base
1136 + resbuf->head[0].iov_len;
1136 resbuf->tail[0].iov_len = 0; 1137 resbuf->tail[0].iov_len = 0;
1138 rqstp->rq_restailpage = 0;
1137 resv = &resbuf->tail[0]; 1139 resv = &resbuf->tail[0];
1138 } else { 1140 } else {
1139 resv = &resbuf->tail[0]; 1141 resv = &resbuf->tail[0];
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index dea529666d69..15c2db26767b 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -176,7 +176,8 @@ void rpc_count_iostats(struct rpc_task *task)
176 op_metrics->om_execute += execute; 176 op_metrics->om_execute += execute;
177} 177}
178 178
179void _print_name(struct seq_file *seq, unsigned int op, struct rpc_procinfo *procs) 179static void _print_name(struct seq_file *seq, unsigned int op,
180 struct rpc_procinfo *procs)
180{ 181{
181 if (procs[op].p_name) 182 if (procs[op].p_name)
182 seq_printf(seq, "\t%12s: ", procs[op].p_name); 183 seq_printf(seq, "\t%12s: ", procs[op].p_name);
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 953307a9df1d..a3bbc891f959 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -229,8 +229,7 @@ static void node_is_down(struct publication *publ)
229 publ->node, publ->ref, publ->key); 229 publ->node, publ->ref, publ->key);
230 assert(p == publ); 230 assert(p == publ);
231 write_unlock_bh(&tipc_nametbl_lock); 231 write_unlock_bh(&tipc_nametbl_lock);
232 if (publ) 232 kfree(publ);
233 kfree(publ);
234} 233}
235 234
236/** 235/**
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
index 8b9bf4a763b5..b1265187b4a8 100644
--- a/net/wanrouter/af_wanpipe.c
+++ b/net/wanrouter/af_wanpipe.c
@@ -55,12 +55,10 @@
55#include <asm/uaccess.h> 55#include <asm/uaccess.h>
56#include <linux/module.h> 56#include <linux/module.h>
57#include <linux/init.h> 57#include <linux/init.h>
58#include <linux/wanpipe.h>
59#include <linux/if_wanpipe.h> 58#include <linux/if_wanpipe.h>
60#include <linux/pkt_sched.h> 59#include <linux/pkt_sched.h>
61#include <linux/tcp_states.h> 60#include <linux/tcp_states.h>
62#include <linux/if_wanpipe_common.h> 61#include <linux/if_wanpipe_common.h>
63#include <linux/sdla_x25.h>
64 62
65#ifdef CONFIG_INET 63#ifdef CONFIG_INET
66#include <net/inet_common.h> 64#include <net/inet_common.h>
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a8e14dc1b04e..3dc3e1f3b7aa 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -805,16 +805,22 @@ void xfrm_replay_notify(struct xfrm_state *x, int event)
805 case XFRM_REPLAY_UPDATE: 805 case XFRM_REPLAY_UPDATE:
806 if (x->replay_maxdiff && 806 if (x->replay_maxdiff &&
807 (x->replay.seq - x->preplay.seq < x->replay_maxdiff) && 807 (x->replay.seq - x->preplay.seq < x->replay_maxdiff) &&
808 (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff)) 808 (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff)) {
809 return; 809 if (x->xflags & XFRM_TIME_DEFER)
810 event = XFRM_REPLAY_TIMEOUT;
811 else
812 return;
813 }
810 814
811 break; 815 break;
812 816
813 case XFRM_REPLAY_TIMEOUT: 817 case XFRM_REPLAY_TIMEOUT:
814 if ((x->replay.seq == x->preplay.seq) && 818 if ((x->replay.seq == x->preplay.seq) &&
815 (x->replay.bitmap == x->preplay.bitmap) && 819 (x->replay.bitmap == x->preplay.bitmap) &&
816 (x->replay.oseq == x->preplay.oseq)) 820 (x->replay.oseq == x->preplay.oseq)) {
821 x->xflags |= XFRM_TIME_DEFER;
817 return; 822 return;
823 }
818 824
819 break; 825 break;
820 } 826 }
@@ -825,8 +831,10 @@ void xfrm_replay_notify(struct xfrm_state *x, int event)
825 km_state_notify(x, &c); 831 km_state_notify(x, &c);
826 832
827 if (x->replay_maxage && 833 if (x->replay_maxage &&
828 !mod_timer(&x->rtimer, jiffies + x->replay_maxage)) 834 !mod_timer(&x->rtimer, jiffies + x->replay_maxage)) {
829 xfrm_state_hold(x); 835 xfrm_state_hold(x);
836 x->xflags &= ~XFRM_TIME_DEFER;
837 }
830} 838}
831EXPORT_SYMBOL(xfrm_replay_notify); 839EXPORT_SYMBOL(xfrm_replay_notify);
832 840
@@ -836,10 +844,15 @@ static void xfrm_replay_timer_handler(unsigned long data)
836 844
837 spin_lock(&x->lock); 845 spin_lock(&x->lock);
838 846
839 if (xfrm_aevent_is_on() && x->km.state == XFRM_STATE_VALID) 847 if (x->km.state == XFRM_STATE_VALID) {
840 xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT); 848 if (xfrm_aevent_is_on())
849 xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT);
850 else
851 x->xflags |= XFRM_TIME_DEFER;
852 }
841 853
842 spin_unlock(&x->lock); 854 spin_unlock(&x->lock);
855 xfrm_state_put(x);
843} 856}
844 857
845int xfrm_replay_check(struct xfrm_state *x, u32 seq) 858int xfrm_replay_check(struct xfrm_state *x, u32 seq)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 59620b1554e0..b0d067be7390 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -87,6 +87,11 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
87# $(Q)$(MAKE) $(build)=dir 87# $(Q)$(MAKE) $(build)=dir
88build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj 88build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
89 89
90# Prefix -I with $(srctree) if it is not an absolute path
91addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
92# Find all -I options and call addtree
93flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
94
90# If quiet is set, only print short version of command 95# If quiet is set, only print short version of command
91cmd = @$(echo-cmd) $(cmd_$(1)) 96cmd = @$(echo-cmd) $(cmd_$(1))
92 97
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 550798f57da5..2cb4935e85d1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -99,11 +99,6 @@ __a_flags = $(_a_flags)
99__cpp_flags = $(_cpp_flags) 99__cpp_flags = $(_cpp_flags)
100else 100else
101 101
102# Prefix -I with $(srctree) if it is not an absolute path
103addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
104# Find all -I options and call addtree
105flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
106
107# -I$(obj) locates generated .h files 102# -I$(obj) locates generated .h files
108# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files 103# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
109# and locates generated .h files 104# and locates generated .h files
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 75f21d843c1d..75f21d843c1d 100644..100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index dadfa20ffec0..dadfa20ffec0 100644..100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 6d411169bfa6..56b3bed1108f 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -1,22 +1,55 @@
1#!/bin/bash 1#!/bin/bash
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> 2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Released under the terms of the GNU GPL 3# Copyright (c) 2006 Sam Ravnborg <sam@ravnborg.org>
4#
5# Generate a newline separated list of entries from the file/directory
6# supplied as an argument.
7#
8# If a file/directory is not supplied then generate a small dummy file.
9# 4#
10# The output is suitable for gen_init_cpio built from usr/gen_init_cpio.c. 5# Released under the terms of the GNU GPL
11# 6#
7# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
8# the cpio archive, and gzip to pack it.
9# The script may also be used to generate the inputfile used for gen_init_cpio
10# This script assumes that gen_init_cpio is located in usr/ directory
11
12# error out on errors
13set -e
14
15usage() {
16cat << EOF
17Usage:
18$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
19 -o <file> Create gzipped initramfs file named <file> using
20 gen_init_cpio and gzip
21 -u <uid> User ID to map to user ID 0 (root).
22 <uid> is only meaningful if <cpio_source>
23 is a directory.
24 -g <gid> Group ID to map to group ID 0 (root).
25 <gid> is only meaningful if <cpio_source>
26 is a directory.
27 <cpio_source> File list or directory for cpio archive.
28 If <cpio_source> is a .cpio file it will be used
29 as direct input to initramfs.
30 -d Output the default cpio list.
31
32All options except -o and -l may be repeated and are interpreted
33sequentially and immediately. -u and -g states are preserved across
34<cpio_source> options so an explicit "-u 0 -g 0" is required
35to reset the root/group mapping.
36EOF
37}
38
39list_default_initramfs() {
40 # echo usr/kinit/kinit
41 :
42}
12 43
13default_initramfs() { 44default_initramfs() {
14 cat <<-EOF 45 cat <<-EOF >> ${output}
15 # This is a very simple, default initramfs 46 # This is a very simple, default initramfs
16 47
17 dir /dev 0755 0 0 48 dir /dev 0755 0 0
18 nod /dev/console 0600 0 0 c 5 1 49 nod /dev/console 0600 0 0 c 5 1
19 dir /root 0700 0 0 50 dir /root 0700 0 0
51 # file /kinit usr/kinit/kinit 0755 0 0
52 # slink /init kinit 0755 0 0
20 EOF 53 EOF
21} 54}
22 55
@@ -42,18 +75,28 @@ filetype() {
42 return 0 75 return 0
43} 76}
44 77
78list_print_mtime() {
79 :
80}
81
45print_mtime() { 82print_mtime() {
46 local argv1="$1"
47 local my_mtime="0" 83 local my_mtime="0"
48 84
49 if [ -e "${argv1}" ]; then 85 if [ -e "$1" ]; then
50 my_mtime=$(find "${argv1}" -printf "%T@\n" | sort -r | head -n 1) 86 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
51 fi 87 fi
52 88
53 echo "# Last modified: ${my_mtime}" 89 echo "# Last modified: ${my_mtime}" >> ${output}
54 echo 90 echo "" >> ${output}
91}
92
93list_parse() {
94 echo "$1 \\"
55} 95}
56 96
97# for each file print a line in following format
98# <filetype> <name> <path to file> <octal mode> <uid> <gid>
99# for links, devices etc the format differs. See gen_init_cpio for details
57parse() { 100parse() {
58 local location="$1" 101 local location="$1"
59 local name="${location/${srcdir}//}" 102 local name="${location/${srcdir}//}"
@@ -99,80 +142,112 @@ parse() {
99 ;; 142 ;;
100 esac 143 esac
101 144
102 echo "${str}" 145 echo "${str}" >> ${output}
103 146
104 return 0 147 return 0
105} 148}
106 149
107usage() { 150unknown_option() {
108 printf "Usage:\n" 151 printf "ERROR: unknown option \"$arg\"\n" >&2
109 printf "$0 [ [-u <root_uid>] [-g <root_gid>] [-d | <cpio_source>] ] . . .\n" 152 printf "If the filename validly begins with '-', " >&2
110 printf "\n" 153 printf "then it must be prefixed\n" >&2
111 printf -- "-u <root_uid> User ID to map to user ID 0 (root).\n" 154 printf "by './' so that it won't be interpreted as an option." >&2
112 printf " <root_uid> is only meaningful if <cpio_source>\n" 155 printf "\n" >&2
113 printf " is a directory.\n" 156 usage >&2
114 printf -- "-g <root_gid> Group ID to map to group ID 0 (root).\n" 157 exit 1
115 printf " <root_gid> is only meaningful if <cpio_source>\n" 158}
116 printf " is a directory.\n" 159
117 printf "<cpio_source> File list or directory for cpio archive.\n" 160list_header() {
118 printf " If <cpio_source> is not provided then a\n" 161 echo "deps_initramfs := \\"
119 printf " a default list will be output.\n" 162}
120 printf -- "-d Output the default cpio list. If no <cpio_source>\n" 163
121 printf " is given then the default cpio list will be output.\n" 164header() {
122 printf "\n" 165 printf "\n#####################\n# $1\n" >> ${output}
123 printf "All options may be repeated and are interpreted sequentially\n" 166}
124 printf "and immediately. -u and -g states are preserved across\n" 167
125 printf "<cpio_source> options so an explicit \"-u 0 -g 0\" is required\n" 168# process one directory (incl sub-directories)
126 printf "to reset the root/group mapping.\n" 169dir_filelist() {
170 ${dep_list}header "$1"
171
172 srcdir=$(echo "$1" | sed -e 's://*:/:g')
173 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null)
174
175 # If $dirlist is only one line, then the directory is empty
176 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
177 ${dep_list}print_mtime "$1"
178
179 echo "${dirlist}" | \
180 while read x; do
181 ${dep_list}parse ${x}
182 done
183 fi
127} 184}
128 185
129build_list() { 186# if only one file is specified and it is .cpio file then use it direct as fs
130 printf "\n#####################\n# $cpio_source\n" 187# if a directory is specified then add all files in given direcotry to fs
131 188# if a regular file is specified assume it is in gen_initramfs format
132 if [ -f "$cpio_source" ]; then 189input_file() {
133 print_mtime "$cpio_source" 190 source="$1"
134 cat "$cpio_source" 191 if [ -f "$1" ]; then
135 elif [ -d "$cpio_source" ]; then 192 ${dep_list}header "$1"
136 srcdir=$(echo "$cpio_source" | sed -e 's://*:/:g') 193 is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')"
137 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) 194 if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
138 195 cpio_file=$1
139 # If $dirlist is only one line, then the directory is empty 196 [ ! -z ${dep_list} ] && echo "$1"
140 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then 197 return 0
141 print_mtime "$cpio_source" 198 fi
142 199 if [ -z ${dep_list} ]; then
143 echo "${dirlist}" | \ 200 print_mtime "$1" >> ${output}
144 while read x; do 201 cat "$1" >> ${output}
145 parse ${x}
146 done
147 else 202 else
148 # Failsafe in case directory is empty 203 grep ^file "$1" | cut -d ' ' -f 3
149 default_initramfs
150 fi 204 fi
205 elif [ -d "$1" ]; then
206 dir_filelist "$1"
151 else 207 else
152 echo " $0: Cannot open '$cpio_source'" >&2 208 echo " ${prog}: Cannot open '$1'" >&2
153 exit 1 209 exit 1
154 fi 210 fi
155} 211}
156 212
157 213prog=$0
158root_uid=0 214root_uid=0
159root_gid=0 215root_gid=0
216dep_list=
217cpio_file=
218cpio_list=
219output="/dev/stdout"
220output_file=""
160 221
222arg="$1"
223case "$arg" in
224 "-l") # files included in initramfs - used by kbuild
225 dep_list="list_"
226 shift
227 ;;
228 "-o") # generate gzipped cpio image named $1
229 shift
230 output_file="$1"
231 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
232 output=${cpio_list}
233 shift
234 ;;
235esac
161while [ $# -gt 0 ]; do 236while [ $# -gt 0 ]; do
162 arg="$1" 237 arg="$1"
163 shift 238 shift
164 case "$arg" in 239 case "$arg" in
165 "-u") 240 "-u") # map $1 to uid=0 (root)
166 root_uid="$1" 241 root_uid="$1"
167 shift 242 shift
168 ;; 243 ;;
169 "-g") 244 "-g") # map $1 to gid=0 (root)
170 root_gid="$1" 245 root_gid="$1"
171 shift 246 shift
172 ;; 247 ;;
173 "-d") 248 "-d") # display default initramfs list
174 default_list="$arg" 249 default_list="$arg"
175 default_initramfs 250 ${dep_list}default_initramfs
176 ;; 251 ;;
177 "-h") 252 "-h")
178 usage 253 usage
@@ -181,23 +256,27 @@ while [ $# -gt 0 ]; do
181 *) 256 *)
182 case "$arg" in 257 case "$arg" in
183 "-"*) 258 "-"*)
184 printf "ERROR: unknown option \"$arg\"\n" >&2 259 unknown_option
185 printf "If the filename validly begins with '-', then it must be prefixed\n" >&2
186 printf "by './' so that it won't be interpreted as an option." >&2
187 printf "\n" >&2
188 usage >&2
189 exit 1
190 ;; 260 ;;
191 *) 261 *) # input file/dir - process it
192 cpio_source="$arg" 262 input_file "$arg" "$#"
193 build_list
194 ;; 263 ;;
195 esac 264 esac
196 ;; 265 ;;
197 esac 266 esac
198done 267done
199 268
200# spit out the default cpio list if a source hasn't been specified 269# If output_file is set we will generate cpio archive and gzip it
201[ -z "$cpio_source" -a -z "$default_list" ] && default_initramfs 270# we are carefull to delete tmp files
202 271if [ ! -z ${output_file} ]; then
272 if [ -z ${cpio_file} ]; then
273 cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
274 usr/gen_init_cpio ${cpio_list} > ${cpio_tfile}
275 else
276 cpio_tfile=${cpio_file}
277 fi
278 rm ${cpio_list}
279 cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
280 [ -z ${cpio_file} ] && rm ${cpio_tfile}
281fi
203exit 0 282exit 0
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 10eeae53d827..8012d1076876 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -5,6 +5,7 @@
5 5
6#include <ctype.h> 6#include <ctype.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h>
8#include <string.h> 9#include <string.h>
9#include <unistd.h> 10#include <unistd.h>
10#include <time.h> 11#include <time.h>
@@ -63,20 +64,6 @@ static void check_stdin(void)
63 } 64 }
64} 65}
65 66
66static char *fgets_check_stream(char *s, int size, FILE *stream)
67{
68 char *ret = fgets(s, size, stream);
69
70 if (ret == NULL && feof(stream)) {
71 printf(_("aborted!\n\n"));
72 printf(_("Console input is closed. "));
73 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
74 exit(1);
75 }
76
77 return ret;
78}
79
80static void conf_askvalue(struct symbol *sym, const char *def) 67static void conf_askvalue(struct symbol *sym, const char *def)
81{ 68{
82 enum symbol_type type = sym_get_type(sym); 69 enum symbol_type type = sym_get_type(sym);
@@ -114,7 +101,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
114 check_stdin(); 101 check_stdin();
115 case ask_all: 102 case ask_all:
116 fflush(stdout); 103 fflush(stdout);
117 fgets_check_stream(line, 128, stdin); 104 fgets(line, 128, stdin);
118 return; 105 return;
119 case set_default: 106 case set_default:
120 printf("%s\n", def); 107 printf("%s\n", def);
@@ -328,8 +315,7 @@ static int conf_choice(struct menu *menu)
328 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 315 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
329 def_sym = sym_get_choice_value(sym); 316 def_sym = sym_get_choice_value(sym);
330 cnt = def = 0; 317 cnt = def = 0;
331 line[0] = '0'; 318 line[0] = 0;
332 line[1] = 0;
333 for (child = menu->list; child; child = child->next) { 319 for (child = menu->list; child; child = child->next) {
334 if (!menu_is_visible(child)) 320 if (!menu_is_visible(child))
335 continue; 321 continue;
@@ -370,7 +356,7 @@ static int conf_choice(struct menu *menu)
370 check_stdin(); 356 check_stdin();
371 case ask_all: 357 case ask_all:
372 fflush(stdout); 358 fflush(stdout);
373 fgets_check_stream(line, 128, stdin); 359 fgets(line, 128, stdin);
374 strip(line); 360 strip(line);
375 if (line[0] == '?') { 361 if (line[0] == '?') {
376 printf("\n%s\n", menu->sym->help ? 362 printf("\n%s\n", menu->sym->help ?
@@ -546,7 +532,7 @@ int main(int ac, char **av)
546 break; 532 break;
547 case 'h': 533 case 'h':
548 case '?': 534 case '?':
549 printf("%s [-o|-s] config\n", av[0]); 535 fprintf(stderr, "See README for usage info\n");
550 exit(0); 536 exit(0);
551 } 537 }
552 } 538 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 1b8882ddbc74..1b5df589f3ae 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -325,7 +325,7 @@ int conf_read(const char *name)
325 sym->flags |= e->right.sym->flags & SYMBOL_NEW; 325 sym->flags |= e->right.sym->flags & SYMBOL_NEW;
326 } 326 }
327 327
328 sym_change_count = conf_warnings && conf_unsaved; 328 sym_change_count = conf_warnings || conf_unsaved;
329 329
330 return 0; 330 return 0;
331} 331}
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index db07ae73e051..be0200e9cdaf 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -196,8 +196,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
196 196
197 print_buttons(dialog, height, width, 0); 197 print_buttons(dialog, height, width, 0);
198 198
199 wnoutrefresh(list);
200 wnoutrefresh(dialog); 199 wnoutrefresh(dialog);
200 wnoutrefresh(list);
201 doupdate(); 201 doupdate();
202 202
203 while (key != ESC) { 203 while (key != ESC) {
@@ -225,12 +225,11 @@ int dialog_checklist(const char *title, const char *prompt, int height,
225 } 225 }
226 scroll--; 226 scroll--;
227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); 227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE);
228 wnoutrefresh(list);
229
230 print_arrows(dialog, choice, item_no, 228 print_arrows(dialog, choice, item_no,
231 scroll, box_y, box_x + check_x + 5, list_height); 229 scroll, box_y, box_x + check_x + 5, list_height);
232 230
233 wrefresh(dialog); 231 wnoutrefresh(dialog);
232 wrefresh(list);
234 233
235 continue; /* wait for another key press */ 234 continue; /* wait for another key press */
236 } else 235 } else
@@ -252,12 +251,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
252 scroll++; 251 scroll++;
253 print_item(list, items[(scroll + max_choice - 1) * 3 + 1], 252 print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
254 status[scroll + max_choice - 1], max_choice - 1, TRUE); 253 status[scroll + max_choice - 1], max_choice - 1, TRUE);
255 wnoutrefresh(list);
256 254
257 print_arrows(dialog, choice, item_no, 255 print_arrows(dialog, choice, item_no,
258 scroll, box_y, box_x + check_x + 5, list_height); 256 scroll, box_y, box_x + check_x + 5, list_height);
259 257
260 wrefresh(dialog); 258 wnoutrefresh(dialog);
259 wrefresh(list);
261 260
262 continue; /* wait for another key press */ 261 continue; /* wait for another key press */
263 } else 262 } else
@@ -271,8 +270,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
271 choice = i; 270 choice = i;
272 print_item(list, items[(scroll + choice) * 3 + 1], 271 print_item(list, items[(scroll + choice) * 3 + 1],
273 status[scroll + choice], choice, TRUE); 272 status[scroll + choice], choice, TRUE);
274 wnoutrefresh(list); 273 wnoutrefresh(dialog);
275 wrefresh(dialog); 274 wrefresh(list);
276 } 275 }
277 continue; /* wait for another key press */ 276 continue; /* wait for another key press */
278 } 277 }
@@ -306,8 +305,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
306 print_item(list, items[(scroll + i) * 3 + 1], 305 print_item(list, items[(scroll + i) * 3 + 1],
307 status[scroll + i], i, i == choice); 306 status[scroll + i], i, i == choice);
308 } 307 }
309 wnoutrefresh(list); 308 wnoutrefresh(dialog);
310 wrefresh(dialog); 309 wrefresh(list);
311 310
312 for (i = 0; i < item_no; i++) 311 for (i = 0; i < item_no; i++)
313 if (status[i]) 312 if (status[i])
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 09512b544375..bf8052f4fd4a 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -58,8 +58,7 @@
58 58
59#include "dialog.h" 59#include "dialog.h"
60 60
61#define ITEM_IDENT 1 /* Indent of menu entries. Fixed for all menus */ 61static int menu_width, item_x;
62static int menu_width;
63 62
64/* 63/*
65 * Print menu item 64 * Print menu item
@@ -70,7 +69,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
70 int j; 69 int j;
71 char *menu_item = malloc(menu_width + 1); 70 char *menu_item = malloc(menu_width + 1);
72 71
73 strncpy(menu_item, item, menu_width - ITEM_IDENT); 72 strncpy(menu_item, item, menu_width - item_x);
74 menu_item[menu_width] = 0; 73 menu_item[menu_width] = 0;
75 j = first_alpha(menu_item, "YyNnMmHh"); 74 j = first_alpha(menu_item, "YyNnMmHh");
76 75
@@ -87,13 +86,13 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
87 wclrtoeol(win); 86 wclrtoeol(win);
88#endif 87#endif
89 wattrset(win, selected ? item_selected_attr : item_attr); 88 wattrset(win, selected ? item_selected_attr : item_attr);
90 mvwaddstr(win, choice, ITEM_IDENT, menu_item); 89 mvwaddstr(win, choice, item_x, menu_item);
91 if (hotkey) { 90 if (hotkey) {
92 wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); 91 wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
93 mvwaddch(win, choice, ITEM_IDENT + j, menu_item[j]); 92 mvwaddch(win, choice, item_x + j, menu_item[j]);
94 } 93 }
95 if (selected) { 94 if (selected) {
96 wmove(win, choice, ITEM_IDENT + 1); 95 wmove(win, choice, item_x + 1);
97 } 96 }
98 free(menu_item); 97 free(menu_item);
99 wrefresh(win); 98 wrefresh(win);
@@ -227,6 +226,8 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
227 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, 226 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
228 menubox_border_attr, menubox_attr); 227 menubox_border_attr, menubox_attr);
229 228
229 item_x = (menu_width - 70) / 2;
230
230 /* Set choice to default item */ 231 /* Set choice to default item */
231 for (i = 0; i < item_no; i++) 232 for (i = 0; i < item_no; i++)
232 if (strcmp(current, items[i * 2]) == 0) 233 if (strcmp(current, items[i * 2]) == 0)
@@ -263,10 +264,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
263 wnoutrefresh(menu); 264 wnoutrefresh(menu);
264 265
265 print_arrows(dialog, item_no, scroll, 266 print_arrows(dialog, item_no, scroll,
266 box_y, box_x + ITEM_IDENT + 1, menu_height); 267 box_y, box_x + item_x + 1, menu_height);
267 268
268 print_buttons(dialog, height, width, 0); 269 print_buttons(dialog, height, width, 0);
269 wmove(menu, choice, ITEM_IDENT + 1); 270 wmove(menu, choice, item_x + 1);
270 wrefresh(menu); 271 wrefresh(menu);
271 272
272 while (key != ESC) { 273 while (key != ESC) {
@@ -349,7 +350,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
349 print_item(scroll + choice, choice, TRUE); 350 print_item(scroll + choice, choice, TRUE);
350 351
351 print_arrows(dialog, item_no, scroll, 352 print_arrows(dialog, item_no, scroll,
352 box_y, box_x + ITEM_IDENT + 1, menu_height); 353 box_y, box_x + item_x + 1, menu_height);
353 354
354 wnoutrefresh(dialog); 355 wnoutrefresh(dialog);
355 wrefresh(menu); 356 wrefresh(menu);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0b92ddff26fd..cd00e9f07589 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -492,17 +492,19 @@ static int strrcmp(const char *s, const char *sub)
492 * These functions may often be marked __init and we do not want to 492 * These functions may often be marked __init and we do not want to
493 * warn here. 493 * warn here.
494 * the pattern is identified by: 494 * the pattern is identified by:
495 * tosec = .init.text | .exit.text 495 * tosec = .init.text | .exit.text | .init.data
496 * fromsec = .data 496 * fromsec = .data
497 * atsym = *_driver, *_ops, *_probe, *probe_one 497 * atsym = *_driver, *_template, *_sht, *_ops, *_probe, *probe_one
498 **/ 498 **/
499static int secref_whitelist(const char *tosec, const char *fromsec, 499static int secref_whitelist(const char *tosec, const char *fromsec,
500 const char *atsym) 500 const char *atsym)
501{ 501{
502 int f1 = 1, f2 = 1; 502 int f1 = 1, f2 = 1;
503 const char **s; 503 const char **s;
504 const char *pat2sym[] = { 504 const char *pat2sym[] = {
505 "_driver", 505 "_driver",
506 "_template", /* scsi uses *_template a lot */
507 "_sht", /* scsi also used *_sht to some extent */
506 "_ops", 508 "_ops",
507 "_probe", 509 "_probe",
508 "_probe_one", 510 "_probe_one",
@@ -522,7 +524,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
522 524
523 /* Check for pattern 2 */ 525 /* Check for pattern 2 */
524 if ((strcmp(tosec, ".init.text") != 0) && 526 if ((strcmp(tosec, ".init.text") != 0) &&
525 (strcmp(tosec, ".exit.text") != 0)) 527 (strcmp(tosec, ".exit.text") != 0) &&
528 (strcmp(tosec, ".init.data") != 0))
526 f2 = 0; 529 f2 = 0;
527 if (strcmp(fromsec, ".data") != 0) 530 if (strcmp(fromsec, ".data") != 0)
528 f2 = 0; 531 f2 = 0;
@@ -658,7 +661,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
658 warn("%s - Section mismatch: reference to %s:%s from %s " 661 warn("%s - Section mismatch: reference to %s:%s from %s "
659 "before '%s' (at offset -0x%llx)\n", 662 "before '%s' (at offset -0x%llx)\n",
660 modname, secname, refsymname, fromsec, 663 modname, secname, refsymname, fromsec,
661 elf->strtab + before->st_name, 664 elf->strtab + after->st_name,
662 (long long)r.r_offset); 665 (long long)r.r_offset);
663 } else { 666 } else {
664 warn("%s - Section mismatch: reference to %s:%s from %s " 667 warn("%s - Section mismatch: reference to %s:%s from %s "
@@ -820,6 +823,7 @@ static int exit_section(const char *name)
820 * For our future {in}sanity, add a comment that this is the ppc .opd 823 * For our future {in}sanity, add a comment that this is the ppc .opd
821 * section, not the ia64 .opd section. 824 * section, not the ia64 .opd section.
822 * ia64 .opd should not point to discarded sections. 825 * ia64 .opd should not point to discarded sections.
826 * [.rodata] like for .init.text we ignore .rodata references -same reason
823 **/ 827 **/
824static int exit_section_ref_ok(const char *name) 828static int exit_section_ref_ok(const char *name)
825{ 829{
@@ -829,6 +833,7 @@ static int exit_section_ref_ok(const char *name)
829 ".exit.text", 833 ".exit.text",
830 ".exit.data", 834 ".exit.data",
831 ".init.text", 835 ".init.text",
836 ".rodata",
832 ".opd", /* See comment [OPD] */ 837 ".opd", /* See comment [OPD] */
833 ".toc1", /* used by ppc64 */ 838 ".toc1", /* used by ppc64 */
834 ".altinstructions", 839 ".altinstructions",
diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index f34373853ef8..f34373853ef8 100644..100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
diff --git a/scripts/show_delta b/scripts/show_delta
index 48a706ab3d0c..48a706ab3d0c 100644..100755
--- a/scripts/show_delta
+++ b/scripts/show_delta
diff --git a/scripts/ver_linux b/scripts/ver_linux
index beb43ef7f761..84999f69773d 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -39,10 +39,10 @@ tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \
39fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ 39fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \
40'NR==1 {print "jfsutils ", $3}' 40'NR==1 {print "jfsutils ", $3}'
41 41
42reiserfsck -V 2>&1 | grep reiserfsck | awk \ 42reiserfsck -V 2>&1 | grep ^reiserfsck | awk \
43'NR==1{print "reiserfsprogs ", $2}' 43'NR==1{print "reiserfsprogs ", $2}'
44 44
45fsck.reiser4 -V 2>&1 | grep fsck.reiser4 | awk \ 45fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
46'NR==1{print "reiser4progs ", $2}' 46'NR==1{print "reiser4progs ", $2}'
47 47
48xfs_db -V 2>&1 | grep version | awk \ 48xfs_db -V 2>&1 | grep version | awk \
diff --git a/security/keys/key.c b/security/keys/key.c
index a057e3311aad..b6061fa29da7 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -785,6 +785,10 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
785 785
786 key_check(keyring); 786 key_check(keyring);
787 787
788 key_ref = ERR_PTR(-ENOTDIR);
789 if (keyring->type != &key_type_keyring)
790 goto error_2;
791
788 down_write(&keyring->sem); 792 down_write(&keyring->sem);
789 793
790 /* if we're going to allocate a new key, we're going to have 794 /* if we're going to allocate a new key, we're going to have
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index d65a180f888d..bffa924c1f88 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -437,6 +437,7 @@ EXPORT_SYMBOL(keyring_search);
437/* 437/*
438 * search the given keyring only (no recursion) 438 * search the given keyring only (no recursion)
439 * - keyring must be locked by caller 439 * - keyring must be locked by caller
440 * - caller must guarantee that the keyring is a keyring
440 */ 441 */
441key_ref_t __keyring_search_one(key_ref_t keyring_ref, 442key_ref_t __keyring_search_one(key_ref_t keyring_ref,
442 const struct key_type *ktype, 443 const struct key_type *ktype,
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index f6940618e345..217a0bef3c82 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -168,11 +168,12 @@ error:
168 */ 168 */
169int install_process_keyring(struct task_struct *tsk) 169int install_process_keyring(struct task_struct *tsk)
170{ 170{
171 unsigned long flags;
172 struct key *keyring; 171 struct key *keyring;
173 char buf[20]; 172 char buf[20];
174 int ret; 173 int ret;
175 174
175 might_sleep();
176
176 if (!tsk->signal->process_keyring) { 177 if (!tsk->signal->process_keyring) {
177 sprintf(buf, "_pid.%u", tsk->tgid); 178 sprintf(buf, "_pid.%u", tsk->tgid);
178 179
@@ -183,12 +184,12 @@ int install_process_keyring(struct task_struct *tsk)
183 } 184 }
184 185
185 /* attach keyring */ 186 /* attach keyring */
186 spin_lock_irqsave(&tsk->sighand->siglock, flags); 187 spin_lock_irq(&tsk->sighand->siglock);
187 if (!tsk->signal->process_keyring) { 188 if (!tsk->signal->process_keyring) {
188 tsk->signal->process_keyring = keyring; 189 tsk->signal->process_keyring = keyring;
189 keyring = NULL; 190 keyring = NULL;
190 } 191 }
191 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 192 spin_unlock_irq(&tsk->sighand->siglock);
192 193
193 key_put(keyring); 194 key_put(keyring);
194 } 195 }
@@ -207,38 +208,37 @@ error:
207static int install_session_keyring(struct task_struct *tsk, 208static int install_session_keyring(struct task_struct *tsk,
208 struct key *keyring) 209 struct key *keyring)
209{ 210{
210 unsigned long flags;
211 struct key *old; 211 struct key *old;
212 char buf[20]; 212 char buf[20];
213 int ret; 213
214 might_sleep();
214 215
215 /* create an empty session keyring */ 216 /* create an empty session keyring */
216 if (!keyring) { 217 if (!keyring) {
217 sprintf(buf, "_ses.%u", tsk->tgid); 218 sprintf(buf, "_ses.%u", tsk->tgid);
218 219
219 keyring = keyring_alloc(buf, tsk->uid, tsk->gid, 1, NULL); 220 keyring = keyring_alloc(buf, tsk->uid, tsk->gid, 1, NULL);
220 if (IS_ERR(keyring)) { 221 if (IS_ERR(keyring))
221 ret = PTR_ERR(keyring); 222 return PTR_ERR(keyring);
222 goto error;
223 }
224 } 223 }
225 else { 224 else {
226 atomic_inc(&keyring->usage); 225 atomic_inc(&keyring->usage);
227 } 226 }
228 227
229 /* install the keyring */ 228 /* install the keyring */
230 spin_lock_irqsave(&tsk->sighand->siglock, flags); 229 spin_lock_irq(&tsk->sighand->siglock);
231 old = rcu_dereference(tsk->signal->session_keyring); 230 old = tsk->signal->session_keyring;
232 rcu_assign_pointer(tsk->signal->session_keyring, keyring); 231 rcu_assign_pointer(tsk->signal->session_keyring, keyring);
233 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 232 spin_unlock_irq(&tsk->sighand->siglock);
234 233
235 ret = 0; 234 /* we're using RCU on the pointer, but there's no point synchronising
235 * on it if it didn't previously point to anything */
236 if (old) {
237 synchronize_rcu();
238 key_put(old);
239 }
236 240
237 /* we're using RCU on the pointer */ 241 return 0;
238 synchronize_rcu();
239 key_put(old);
240error:
241 return ret;
242 242
243} /* end install_session_keyring() */ 243} /* end install_session_keyring() */
244 244
@@ -311,7 +311,6 @@ void exit_keys(struct task_struct *tsk)
311 */ 311 */
312int exec_keys(struct task_struct *tsk) 312int exec_keys(struct task_struct *tsk)
313{ 313{
314 unsigned long flags;
315 struct key *old; 314 struct key *old;
316 315
317 /* newly exec'd tasks don't get a thread keyring */ 316 /* newly exec'd tasks don't get a thread keyring */
@@ -323,10 +322,10 @@ int exec_keys(struct task_struct *tsk)
323 key_put(old); 322 key_put(old);
324 323
325 /* discard the process keyring from a newly exec'd task */ 324 /* discard the process keyring from a newly exec'd task */
326 spin_lock_irqsave(&tsk->sighand->siglock, flags); 325 spin_lock_irq(&tsk->sighand->siglock);
327 old = tsk->signal->process_keyring; 326 old = tsk->signal->process_keyring;
328 tsk->signal->process_keyring = NULL; 327 tsk->signal->process_keyring = NULL;
329 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 328 spin_unlock_irq(&tsk->sighand->siglock);
330 329
331 key_put(old); 330 key_put(old);
332 331
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index 640d0bfdbc68..84047f69f9c1 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -264,7 +264,7 @@ int mls_context_to_sid(char oldc,
264 264
265 if (!selinux_mls_enabled) { 265 if (!selinux_mls_enabled) {
266 if (def_sid != SECSID_NULL && oldc) 266 if (def_sid != SECSID_NULL && oldc)
267 *scontext += strlen(*scontext); 267 *scontext += strlen(*scontext)+1;
268 return 0; 268 return 0;
269 } 269 }
270 270
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index dfab6c886698..abe99d881376 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -281,7 +281,7 @@ u32 selinux_socket_getpeer_dgram(struct sk_buff *skb)
281 int i; 281 int i;
282 282
283 for (i = sp->len-1; i >= 0; i--) { 283 for (i = sp->len-1; i >= 0; i--) {
284 struct xfrm_state *x = sp->x[i].xvec; 284 struct xfrm_state *x = sp->xvec[i];
285 if (selinux_authorizable_xfrm(x)) { 285 if (selinux_authorizable_xfrm(x)) {
286 struct xfrm_sec_ctx *ctx = x->security; 286 struct xfrm_sec_ctx *ctx = x->security;
287 return ctx->ctx_sid; 287 return ctx->ctx_sid;
@@ -314,7 +314,7 @@ int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb)
314 * Only need to verify the existence of an authorizable sp. 314 * Only need to verify the existence of an authorizable sp.
315 */ 315 */
316 for (i = 0; i < sp->len; i++) { 316 for (i = 0; i < sp->len; i++) {
317 struct xfrm_state *x = sp->x[i].xvec; 317 struct xfrm_state *x = sp->xvec[i];
318 318
319 if (x && selinux_authorizable_xfrm(x)) 319 if (x && selinux_authorizable_xfrm(x))
320 goto accept; 320 goto accept;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 91114c7aeff5..c5978d6c6080 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1682,7 +1682,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
1682 substream->oss.setup = *setup; 1682 substream->oss.setup = *setup;
1683 if (setup->nonblock) 1683 if (setup->nonblock)
1684 substream->ffile->f_flags |= O_NONBLOCK; 1684 substream->ffile->f_flags |= O_NONBLOCK;
1685 else 1685 else if (setup->block)
1686 substream->ffile->f_flags &= ~O_NONBLOCK; 1686 substream->ffile->f_flags &= ~O_NONBLOCK;
1687 runtime = substream->runtime; 1687 runtime = substream->runtime;
1688 runtime->oss.params = 1; 1688 runtime->oss.params = 1;
@@ -1757,10 +1757,11 @@ static int snd_pcm_oss_open_file(struct file *file,
1757 } 1757 }
1758 1758
1759 pcm_oss_file->streams[idx] = substream; 1759 pcm_oss_file->streams[idx] = substream;
1760 substream->file = pcm_oss_file;
1760 snd_pcm_oss_init_substream(substream, &setup[idx], minor); 1761 snd_pcm_oss_init_substream(substream, &setup[idx], minor);
1761 } 1762 }
1762 1763
1763 if (! pcm_oss_file->streams[0] && pcm_oss_file->streams[1]) { 1764 if (!pcm_oss_file->streams[0] && !pcm_oss_file->streams[1]) {
1764 snd_pcm_oss_release_file(pcm_oss_file); 1765 snd_pcm_oss_release_file(pcm_oss_file);
1765 return -EINVAL; 1766 return -EINVAL;
1766 } 1767 }
@@ -1809,7 +1810,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1809 err = -EFAULT; 1810 err = -EFAULT;
1810 goto __error; 1811 goto __error;
1811 } 1812 }
1812 memset(setup, 0, sizeof(*setup)); 1813 memset(setup, 0, sizeof(setup));
1813 if (file->f_mode & FMODE_WRITE) 1814 if (file->f_mode & FMODE_WRITE)
1814 snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK, 1815 snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK,
1815 task_name, &setup[0]); 1816 task_name, &setup[0]);
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 5d7eb123b999..122e10a61ab9 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -196,7 +196,7 @@ static char *snd_pcm_format_names[] = {
196 FORMAT(U18_3BE), 196 FORMAT(U18_3BE),
197}; 197};
198 198
199const char *snd_pcm_format_name(snd_pcm_format_t format) 199static const char *snd_pcm_format_name(snd_pcm_format_t format)
200{ 200{
201 return snd_pcm_format_names[format]; 201 return snd_pcm_format_names[format];
202} 202}
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 964e4c47a7f1..0860c5a84502 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2007,14 +2007,16 @@ static void pcm_release_private(struct snd_pcm_substream *substream)
2007void snd_pcm_release_substream(struct snd_pcm_substream *substream) 2007void snd_pcm_release_substream(struct snd_pcm_substream *substream)
2008{ 2008{
2009 snd_pcm_drop(substream); 2009 snd_pcm_drop(substream);
2010 if (substream->pcm_release)
2011 substream->pcm_release(substream);
2012 if (substream->hw_opened) { 2010 if (substream->hw_opened) {
2013 if (substream->ops->hw_free != NULL) 2011 if (substream->ops->hw_free != NULL)
2014 substream->ops->hw_free(substream); 2012 substream->ops->hw_free(substream);
2015 substream->ops->close(substream); 2013 substream->ops->close(substream);
2016 substream->hw_opened = 0; 2014 substream->hw_opened = 0;
2017 } 2015 }
2016 if (substream->pcm_release) {
2017 substream->pcm_release(substream);
2018 substream->pcm_release = NULL;
2019 }
2018 snd_pcm_detach_substream(substream); 2020 snd_pcm_detach_substream(substream);
2019} 2021}
2020 2022
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 8687ae3c66b8..b49a45cbf67a 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -183,7 +183,8 @@ static void snd_mpu401_uart_remove_timer (struct snd_mpu401 *mpu, int input)
183 183
184 */ 184 */
185 185
186static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int ack) 186static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd,
187 int ack)
187{ 188{
188 unsigned long flags; 189 unsigned long flags;
189 int timeout, ok; 190 int timeout, ok;
@@ -218,9 +219,11 @@ static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int
218 ok = 1; 219 ok = 1;
219 } 220 }
220 spin_unlock_irqrestore(&mpu->input_lock, flags); 221 spin_unlock_irqrestore(&mpu->input_lock, flags);
221 if (! ok) 222 if (!ok) {
222 snd_printk("cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); 223 snd_printk("cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu)));
223 // snd_printk("cmd: 0x%x at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); 224 return 1;
225 }
226 return 0;
224} 227}
225 228
226/* 229/*
@@ -235,12 +238,19 @@ static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream)
235 if (mpu->open_input && (err = mpu->open_input(mpu)) < 0) 238 if (mpu->open_input && (err = mpu->open_input(mpu)) < 0)
236 return err; 239 return err;
237 if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) { 240 if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) {
238 snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); 241 if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1))
239 snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); 242 goto error_out;
243 if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1))
244 goto error_out;
240 } 245 }
241 mpu->substream_input = substream; 246 mpu->substream_input = substream;
242 set_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); 247 set_bit(MPU401_MODE_BIT_INPUT, &mpu->mode);
243 return 0; 248 return 0;
249
250error_out:
251 if (mpu->open_input && mpu->close_input)
252 mpu->close_input(mpu);
253 return -EIO;
244} 254}
245 255
246static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) 256static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream)
@@ -252,39 +262,52 @@ static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream)
252 if (mpu->open_output && (err = mpu->open_output(mpu)) < 0) 262 if (mpu->open_output && (err = mpu->open_output(mpu)) < 0)
253 return err; 263 return err;
254 if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { 264 if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) {
255 snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); 265 if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1))
256 snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); 266 goto error_out;
267 if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1))
268 goto error_out;
257 } 269 }
258 mpu->substream_output = substream; 270 mpu->substream_output = substream;
259 set_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); 271 set_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
260 return 0; 272 return 0;
273
274error_out:
275 if (mpu->open_output && mpu->close_output)
276 mpu->close_output(mpu);
277 return -EIO;
261} 278}
262 279
263static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream) 280static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream)
264{ 281{
265 struct snd_mpu401 *mpu; 282 struct snd_mpu401 *mpu;
283 int err = 0;
266 284
267 mpu = substream->rmidi->private_data; 285 mpu = substream->rmidi->private_data;
268 clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); 286 clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode);
269 mpu->substream_input = NULL; 287 mpu->substream_input = NULL;
270 if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) 288 if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode))
271 snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); 289 err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
272 if (mpu->close_input) 290 if (mpu->close_input)
273 mpu->close_input(mpu); 291 mpu->close_input(mpu);
292 if (err)
293 return -EIO;
274 return 0; 294 return 0;
275} 295}
276 296
277static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream) 297static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream)
278{ 298{
279 struct snd_mpu401 *mpu; 299 struct snd_mpu401 *mpu;
300 int err = 0;
280 301
281 mpu = substream->rmidi->private_data; 302 mpu = substream->rmidi->private_data;
282 clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); 303 clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
283 mpu->substream_output = NULL; 304 mpu->substream_output = NULL;
284 if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) 305 if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
285 snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); 306 err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
286 if (mpu->close_output) 307 if (mpu->close_output)
287 mpu->close_output(mpu); 308 mpu->close_output(mpu);
309 if (err)
310 return -EIO;
288 return 0; 311 return 0;
289} 312}
290 313
@@ -316,6 +339,7 @@ static void snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substrea
316 snd_mpu401_uart_remove_timer(mpu, 1); 339 snd_mpu401_uart_remove_timer(mpu, 1);
317 clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode); 340 clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode);
318 } 341 }
342
319} 343}
320 344
321/* 345/*
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 326a057f752f..99908e44124d 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -193,9 +193,11 @@ static int __init alsa_card_ad1848_init(void)
193 continue; 193 continue;
194 device = platform_device_register_simple(SND_AD1848_DRIVER, 194 device = platform_device_register_simple(SND_AD1848_DRIVER,
195 i, NULL, 0); 195 i, NULL, 0);
196 if (IS_ERR(device)) { 196 if (IS_ERR(device))
197 err = PTR_ERR(device); 197 continue;
198 goto errout; 198 if (!platform_get_drvdata(device)) {
199 platform_device_unregister(device);
200 continue;
199 } 201 }
200 devices[i] = device; 202 devices[i] = device;
201 cards++; 203 cards++;
@@ -204,14 +206,10 @@ static int __init alsa_card_ad1848_init(void)
204#ifdef MODULE 206#ifdef MODULE
205 printk(KERN_ERR "AD1848 soundcard not found or device busy\n"); 207 printk(KERN_ERR "AD1848 soundcard not found or device busy\n");
206#endif 208#endif
207 err = -ENODEV; 209 snd_ad1848_unregister_all();
208 goto errout; 210 return -ENODEV;
209 } 211 }
210 return 0; 212 return 0;
211
212 errout:
213 snd_ad1848_unregister_all();
214 return err;
215} 213}
216 214
217static void __exit alsa_card_ad1848_exit(void) 215static void __exit alsa_card_ad1848_exit(void)
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index a253a14e6a45..1124344ed948 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device)
43 struct snd_card *card; 43 struct snd_card *card;
44 struct snd_opl3 *opl3; 44 struct snd_opl3 *opl3;
45 45
46 int error; 46 int error, i = device->id;
47 int i = device->id;
48 47
49 if (port[i] == SNDRV_AUTO_PORT) { 48 if (port[i] == SNDRV_AUTO_PORT) {
50 snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); 49 snd_printk(KERN_ERR DRV_NAME ": please specify port\n");
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device)
95 return 0; 94 return 0;
96 95
97out1: snd_card_free(card); 96out1: snd_card_free(card);
98 out0: error = -EINVAL; /* FIXME: should be the original error code */ 97out0: return error;
99 return error;
100} 98}
101 99
102static int __devexit snd_adlib_remove(struct platform_device *device) 100static int __devexit snd_adlib_remove(struct platform_device *device)
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(void)
134 if (IS_ERR(device)) 132 if (IS_ERR(device))
135 continue; 133 continue;
136 134
135 if (!platform_get_drvdata(device)) {
136 platform_device_unregister(device);
137 continue;
138 }
139
137 devices[i] = device; 140 devices[i] = device;
138 cards++; 141 cards++;
139 } 142 }
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index bc0f5ebf5d3c..3c1e9fd56fe0 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -699,9 +699,11 @@ static int __init alsa_card_cmi8330_init(void)
699 continue; 699 continue;
700 device = platform_device_register_simple(CMI8330_DRIVER, 700 device = platform_device_register_simple(CMI8330_DRIVER,
701 i, NULL, 0); 701 i, NULL, 0);
702 if (IS_ERR(device)) { 702 if (IS_ERR(device))
703 err = PTR_ERR(device); 703 continue;
704 goto errout; 704 if (!platform_get_drvdata(device)) {
705 platform_device_unregister(device);
706 continue;
705 } 707 }
706 platform_devices[i] = device; 708 platform_devices[i] = device;
707 cards++; 709 cards++;
@@ -719,14 +721,10 @@ static int __init alsa_card_cmi8330_init(void)
719#ifdef MODULE 721#ifdef MODULE
720 snd_printk(KERN_ERR "CMI8330 not found or device busy\n"); 722 snd_printk(KERN_ERR "CMI8330 not found or device busy\n");
721#endif 723#endif
722 err = -ENODEV; 724 snd_cmi8330_unregister_all();
723 goto errout; 725 return -ENODEV;
724 } 726 }
725 return 0; 727 return 0;
726
727 errout:
728 snd_cmi8330_unregister_all();
729 return err;
730} 728}
731 729
732static void __exit alsa_card_cmi8330_exit(void) 730static void __exit alsa_card_cmi8330_exit(void)
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index a30dcd962525..397310f358b7 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -209,9 +209,11 @@ static int __init alsa_card_cs4231_init(void)
209 continue; 209 continue;
210 device = platform_device_register_simple(SND_CS4231_DRIVER, 210 device = platform_device_register_simple(SND_CS4231_DRIVER,
211 i, NULL, 0); 211 i, NULL, 0);
212 if (IS_ERR(device)) { 212 if (IS_ERR(device))
213 err = PTR_ERR(device); 213 continue;
214 goto errout; 214 if (!platform_get_drvdata(device)) {
215 platform_device_unregister(device);
216 continue;
215 } 217 }
216 devices[i] = device; 218 devices[i] = device;
217 cards++; 219 cards++;
@@ -220,14 +222,10 @@ static int __init alsa_card_cs4231_init(void)
220#ifdef MODULE 222#ifdef MODULE
221 printk(KERN_ERR "CS4231 soundcard not found or device busy\n"); 223 printk(KERN_ERR "CS4231 soundcard not found or device busy\n");
222#endif 224#endif
223 err = -ENODEV; 225 snd_cs4231_unregister_all();
224 goto errout; 226 return -ENODEV;
225 } 227 }
226 return 0; 228 return 0;
227
228 errout:
229 snd_cs4231_unregister_all();
230 return err;
231} 229}
232 230
233static void __exit alsa_card_cs4231_exit(void) 231static void __exit alsa_card_cs4231_exit(void)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 382bb17ef49f..f7fa779347ff 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -780,9 +780,11 @@ static int __init alsa_card_cs423x_init(void)
780 continue; 780 continue;
781 device = platform_device_register_simple(CS423X_DRIVER, 781 device = platform_device_register_simple(CS423X_DRIVER,
782 i, NULL, 0); 782 i, NULL, 0);
783 if (IS_ERR(device)) { 783 if (IS_ERR(device))
784 err = PTR_ERR(device); 784 continue;
785 goto errout; 785 if (!platform_get_drvdata(device)) {
786 platform_device_unregister(device);
787 continue;
786 } 788 }
787 platform_devices[i] = device; 789 platform_devices[i] = device;
788 snd_cs423x_devices++; 790 snd_cs423x_devices++;
@@ -802,14 +804,10 @@ static int __init alsa_card_cs423x_init(void)
802#ifdef MODULE 804#ifdef MODULE
803 printk(KERN_ERR IDENT " soundcard not found or device busy\n"); 805 printk(KERN_ERR IDENT " soundcard not found or device busy\n");
804#endif 806#endif
805 err = -ENODEV; 807 snd_cs423x_unregister_all();
806 goto errout; 808 return -ENODEV;
807 } 809 }
808 return 0; 810 return 0;
809
810 errout:
811 snd_cs423x_unregister_all();
812 return err;
813} 811}
814 812
815static void __exit alsa_card_cs423x_exit(void) 813static void __exit alsa_card_cs423x_exit(void)
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 2b69fc829265..e90689ee162f 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -213,9 +213,11 @@ static int __init alsa_card_es1688_init(void)
213 continue; 213 continue;
214 device = platform_device_register_simple(ES1688_DRIVER, 214 device = platform_device_register_simple(ES1688_DRIVER,
215 i, NULL, 0); 215 i, NULL, 0);
216 if (IS_ERR(device)) { 216 if (IS_ERR(device))
217 err = PTR_ERR(device); 217 continue;
218 goto errout; 218 if (!platform_get_drvdata(device)) {
219 platform_device_unregister(device);
220 continue;
219 } 221 }
220 devices[i] = device; 222 devices[i] = device;
221 cards++; 223 cards++;
@@ -224,14 +226,10 @@ static int __init alsa_card_es1688_init(void)
224#ifdef MODULE 226#ifdef MODULE
225 printk(KERN_ERR "ESS AudioDrive ES1688 soundcard not found or device busy\n"); 227 printk(KERN_ERR "ESS AudioDrive ES1688 soundcard not found or device busy\n");
226#endif 228#endif
227 err = -ENODEV; 229 snd_es1688_unregister_all();
228 goto errout; 230 return -ENODEV;
229 } 231 }
230 return 0; 232 return 0;
231
232 errout:
233 snd_es1688_unregister_all();
234 return err;
235} 233}
236 234
237static void __exit alsa_card_es1688_exit(void) 235static void __exit alsa_card_es1688_exit(void)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 9fbc185b4cc2..a36ec1daa5cb 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2391,9 +2391,11 @@ static int __init alsa_card_es18xx_init(void)
2391 continue; 2391 continue;
2392 device = platform_device_register_simple(ES18XX_DRIVER, 2392 device = platform_device_register_simple(ES18XX_DRIVER,
2393 i, NULL, 0); 2393 i, NULL, 0);
2394 if (IS_ERR(device)) { 2394 if (IS_ERR(device))
2395 err = PTR_ERR(device); 2395 continue;
2396 goto errout; 2396 if (!platform_get_drvdata(device)) {
2397 platform_device_unregister(device);
2398 continue;
2397 } 2399 }
2398 platform_devices[i] = device; 2400 platform_devices[i] = device;
2399 cards++; 2401 cards++;
@@ -2411,14 +2413,10 @@ static int __init alsa_card_es18xx_init(void)
2411#ifdef MODULE 2413#ifdef MODULE
2412 snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); 2414 snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n");
2413#endif 2415#endif
2414 err = -ENODEV; 2416 snd_es18xx_unregister_all();
2415 goto errout; 2417 return -ENODEV;
2416 } 2418 }
2417 return 0; 2419 return 0;
2418
2419 errout:
2420 snd_es18xx_unregister_all();
2421 return err;
2422} 2420}
2423 2421
2424static void __exit alsa_card_es18xx_exit(void) 2422static void __exit alsa_card_es18xx_exit(void)
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 26dccfea2437..37057a37dc30 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -253,9 +253,11 @@ static int __init alsa_card_gusclassic_init(void)
253 continue; 253 continue;
254 device = platform_device_register_simple(GUSCLASSIC_DRIVER, 254 device = platform_device_register_simple(GUSCLASSIC_DRIVER,
255 i, NULL, 0); 255 i, NULL, 0);
256 if (IS_ERR(device)) { 256 if (IS_ERR(device))
257 err = PTR_ERR(device); 257 continue;
258 goto errout; 258 if (!platform_get_drvdata(device)) {
259 platform_device_unregister(device);
260 continue;
259 } 261 }
260 devices[i] = device; 262 devices[i] = device;
261 cards++; 263 cards++;
@@ -264,14 +266,10 @@ static int __init alsa_card_gusclassic_init(void)
264#ifdef MODULE 266#ifdef MODULE
265 printk(KERN_ERR "GUS Classic soundcard not found or device busy\n"); 267 printk(KERN_ERR "GUS Classic soundcard not found or device busy\n");
266#endif 268#endif
267 err = -ENODEV; 269 snd_gusclassic_unregister_all();
268 goto errout; 270 return -ENODEV;
269 } 271 }
270 return 0; 272 return 0;
271
272 errout:
273 snd_gusclassic_unregister_all();
274 return err;
275} 273}
276 274
277static void __exit alsa_card_gusclassic_exit(void) 275static void __exit alsa_card_gusclassic_exit(void)
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 31dc20501d0c..05852fcc613b 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -363,9 +363,11 @@ static int __init alsa_card_gusextreme_init(void)
363 continue; 363 continue;
364 device = platform_device_register_simple(GUSEXTREME_DRIVER, 364 device = platform_device_register_simple(GUSEXTREME_DRIVER,
365 i, NULL, 0); 365 i, NULL, 0);
366 if (IS_ERR(device)) { 366 if (IS_ERR(device))
367 err = PTR_ERR(device); 367 continue;
368 goto errout; 368 if (!platform_get_drvdata(device)) {
369 platform_device_unregister(device);
370 continue;
369 } 371 }
370 devices[i] = device; 372 devices[i] = device;
371 cards++; 373 cards++;
@@ -374,14 +376,10 @@ static int __init alsa_card_gusextreme_init(void)
374#ifdef MODULE 376#ifdef MODULE
375 printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n"); 377 printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n");
376#endif 378#endif
377 err = -ENODEV; 379 snd_gusextreme_unregister_all();
378 goto errout; 380 return -ENODEV;
379 } 381 }
380 return 0; 382 return 0;
381
382 errout:
383 snd_gusextreme_unregister_all();
384 return err;
385} 383}
386 384
387static void __exit alsa_card_gusextreme_exit(void) 385static void __exit alsa_card_gusextreme_exit(void)
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index cafb9b67fa72..fcf2c8fe6f94 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -390,9 +390,11 @@ static int __init alsa_card_gusmax_init(void)
390 continue; 390 continue;
391 device = platform_device_register_simple(GUSMAX_DRIVER, 391 device = platform_device_register_simple(GUSMAX_DRIVER,
392 i, NULL, 0); 392 i, NULL, 0);
393 if (IS_ERR(device)) { 393 if (IS_ERR(device))
394 err = PTR_ERR(device); 394 continue;
395 goto errout; 395 if (!platform_get_drvdata(device)) {
396 platform_device_unregister(device);
397 continue;
396 } 398 }
397 devices[i] = device; 399 devices[i] = device;
398 cards++; 400 cards++;
@@ -401,14 +403,10 @@ static int __init alsa_card_gusmax_init(void)
401#ifdef MODULE 403#ifdef MODULE
402 printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); 404 printk(KERN_ERR "GUS MAX soundcard not found or device busy\n");
403#endif 405#endif
404 err = -ENODEV; 406 snd_gusmax_unregister_all();
405 goto errout; 407 return -ENODEV;
406 } 408 }
407 return 0; 409 return 0;
408
409 errout:
410 snd_gusmax_unregister_all();
411 return err;
412} 410}
413 411
414static void __exit alsa_card_gusmax_exit(void) 412static void __exit alsa_card_gusmax_exit(void)
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index de71b7a99c83..4298d339e786 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -947,9 +947,11 @@ static int __init alsa_card_interwave_init(void)
947#endif 947#endif
948 device = platform_device_register_simple(INTERWAVE_DRIVER, 948 device = platform_device_register_simple(INTERWAVE_DRIVER,
949 i, NULL, 0); 949 i, NULL, 0);
950 if (IS_ERR(device)) { 950 if (IS_ERR(device))
951 err = PTR_ERR(device); 951 continue;
952 goto errout; 952 if (!platform_get_drvdata(device)) {
953 platform_device_unregister(device);
954 continue;
953 } 955 }
954 platform_devices[i] = device; 956 platform_devices[i] = device;
955 cards++; 957 cards++;
@@ -966,14 +968,10 @@ static int __init alsa_card_interwave_init(void)
966#ifdef MODULE 968#ifdef MODULE
967 printk(KERN_ERR "InterWave soundcard not found or device busy\n"); 969 printk(KERN_ERR "InterWave soundcard not found or device busy\n");
968#endif 970#endif
969 err = -ENODEV; 971 snd_interwave_unregister_all();
970 goto errout; 972 return -ENODEV;
971 } 973 }
972 return 0; 974 return 0;
973
974 errout:
975 snd_interwave_unregister_all();
976 return err;
977} 975}
978 976
979static void __exit alsa_card_interwave_exit(void) 977static void __exit alsa_card_interwave_exit(void)
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index c906e205d7d5..6d889052c32c 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -962,9 +962,11 @@ static int __init alsa_card_opl3sa2_init(void)
962#endif 962#endif
963 device = platform_device_register_simple(OPL3SA2_DRIVER, 963 device = platform_device_register_simple(OPL3SA2_DRIVER,
964 i, NULL, 0); 964 i, NULL, 0);
965 if (IS_ERR(device)) { 965 if (IS_ERR(device))
966 err = PTR_ERR(device); 966 continue;
967 goto errout; 967 if (!platform_get_drvdata(device)) {
968 platform_device_unregister(device);
969 continue;
968 } 970 }
969 platform_devices[i] = device; 971 platform_devices[i] = device;
970 snd_opl3sa2_devices++; 972 snd_opl3sa2_devices++;
@@ -983,14 +985,10 @@ static int __init alsa_card_opl3sa2_init(void)
983#ifdef MODULE 985#ifdef MODULE
984 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); 986 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n");
985#endif 987#endif
986 err = -ENODEV; 988 snd_opl3sa2_unregister_all();
987 goto errout; 989 return -ENODEV;
988 } 990 }
989 return 0; 991 return 0;
990
991 errout:
992 snd_opl3sa2_unregister_all();
993 return err;
994} 992}
995 993
996static void __exit alsa_card_opl3sa2_exit(void) 994static void __exit alsa_card_opl3sa2_exit(void)
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 09384d03dc31..83d64bc07ff0 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -1436,8 +1436,11 @@ static int __init alsa_card_miro_init(void)
1436 if ((error = platform_driver_register(&snd_miro_driver)) < 0) 1436 if ((error = platform_driver_register(&snd_miro_driver)) < 0)
1437 return error; 1437 return error;
1438 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); 1438 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
1439 if (! IS_ERR(device)) 1439 if (! IS_ERR(device)) {
1440 return 0; 1440 if (platform_get_drvdata(device))
1441 return 0;
1442 platform_device_unregister(device);
1443 }
1441#ifdef MODULE 1444#ifdef MODULE
1442 printk(KERN_ERR "no miro soundcard found\n"); 1445 printk(KERN_ERR "no miro soundcard found\n");
1443#endif 1446#endif
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 65b28cbc0ebd..8ee0d70536f9 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -2099,8 +2099,11 @@ static int __init alsa_card_opti9xx_init(void)
2099 return error; 2099 return error;
2100 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); 2100 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
2101 if (!IS_ERR(device)) { 2101 if (!IS_ERR(device)) {
2102 snd_opti9xx_platform_device = device; 2102 if (platform_get_drvdata(device)) {
2103 return 0; 2103 snd_opti9xx_platform_device = device;
2104 return 0;
2105 }
2106 platform_device_unregister(device);
2104 } 2107 }
2105 platform_driver_unregister(&snd_opti9xx_driver); 2108 platform_driver_unregister(&snd_opti9xx_driver);
2106 } 2109 }
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 21ea65925a9e..6333f900eaee 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -720,9 +720,11 @@ static int __init alsa_card_sb16_init(void)
720 continue; 720 continue;
721 device = platform_device_register_simple(SND_SB16_DRIVER, 721 device = platform_device_register_simple(SND_SB16_DRIVER,
722 i, NULL, 0); 722 i, NULL, 0);
723 if (IS_ERR(device)) { 723 if (IS_ERR(device))
724 err = PTR_ERR(device); 724 continue;
725 goto errout; 725 if (!platform_get_drvdata(device)) {
726 platform_device_unregister(device);
727 continue;
726 } 728 }
727 platform_devices[i] = device; 729 platform_devices[i] = device;
728 cards++; 730 cards++;
@@ -745,14 +747,10 @@ static int __init alsa_card_sb16_init(void)
745 snd_printk(KERN_ERR "In case, if you have AWE card, try snd-sbawe module\n"); 747 snd_printk(KERN_ERR "In case, if you have AWE card, try snd-sbawe module\n");
746#endif 748#endif
747#endif 749#endif
748 err = -ENODEV; 750 snd_sb16_unregister_all();
749 goto errout; 751 return -ENODEV;
750 } 752 }
751 return 0; 753 return 0;
752
753 errout:
754 snd_sb16_unregister_all();
755 return err;
756} 754}
757 755
758static void __exit alsa_card_sb16_exit(void) 756static void __exit alsa_card_sb16_exit(void)
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 3efa23d303c3..141400c01426 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -264,9 +264,11 @@ static int __init alsa_card_sb8_init(void)
264 continue; 264 continue;
265 device = platform_device_register_simple(SND_SB8_DRIVER, 265 device = platform_device_register_simple(SND_SB8_DRIVER,
266 i, NULL, 0); 266 i, NULL, 0);
267 if (IS_ERR(device)) { 267 if (IS_ERR(device))
268 err = PTR_ERR(device); 268 continue;
269 goto errout; 269 if (!platform_get_drvdata(device)) {
270 platform_device_unregister(device);
271 continue;
270 } 272 }
271 devices[i] = device; 273 devices[i] = device;
272 cards++; 274 cards++;
@@ -275,14 +277,10 @@ static int __init alsa_card_sb8_init(void)
275#ifdef MODULE 277#ifdef MODULE
276 snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n"); 278 snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n");
277#endif 279#endif
278 err = -ENODEV; 280 snd_sb8_unregister_all();
279 goto errout; 281 return -ENODEV;
280 } 282 }
281 return 0; 283 return 0;
282
283 errout:
284 snd_sb8_unregister_all();
285 return err;
286} 284}
287 285
288static void __exit alsa_card_sb8_exit(void) 286static void __exit alsa_card_sb8_exit(void)
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index a60e66afbf90..09c8e8c6b5e3 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -366,9 +366,11 @@ static int __init alsa_card_sgalaxy_init(void)
366 continue; 366 continue;
367 device = platform_device_register_simple(SND_SGALAXY_DRIVER, 367 device = platform_device_register_simple(SND_SGALAXY_DRIVER,
368 i, NULL, 0); 368 i, NULL, 0);
369 if (IS_ERR(device)) { 369 if (IS_ERR(device))
370 err = PTR_ERR(device); 370 continue;
371 goto errout; 371 if (!platform_get_drvdata(device)) {
372 platform_device_unregister(device);
373 continue;
372 } 374 }
373 devices[i] = device; 375 devices[i] = device;
374 cards++; 376 cards++;
@@ -377,14 +379,10 @@ static int __init alsa_card_sgalaxy_init(void)
377#ifdef MODULE 379#ifdef MODULE
378 snd_printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n"); 380 snd_printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n");
379#endif 381#endif
380 err = -ENODEV; 382 snd_sgalaxy_unregister_all();
381 goto errout; 383 return -ENODEV;
382 } 384 }
383 return 0; 385 return 0;
384
385 errout:
386 snd_sgalaxy_unregister_all();
387 return err;
388} 386}
389 387
390static void __exit alsa_card_sgalaxy_exit(void) 388static void __exit alsa_card_sgalaxy_exit(void)
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 48e5552d3444..d2a856f0fde2 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1427,8 +1427,8 @@ static int __init sscape_manual_probe(void)
1427 dma[i] == SNDRV_AUTO_DMA) { 1427 dma[i] == SNDRV_AUTO_DMA) {
1428 printk(KERN_INFO 1428 printk(KERN_INFO
1429 "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); 1429 "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n");
1430 ret = -ENXIO; 1430 sscape_unregister_all();
1431 goto errout; 1431 return -ENXIO;
1432 } 1432 }
1433 1433
1434 /* 1434 /*
@@ -1436,17 +1436,15 @@ static int __init sscape_manual_probe(void)
1436 */ 1436 */
1437 device = platform_device_register_simple(SSCAPE_DRIVER, 1437 device = platform_device_register_simple(SSCAPE_DRIVER,
1438 i, NULL, 0); 1438 i, NULL, 0);
1439 if (IS_ERR(device)) { 1439 if (IS_ERR(device))
1440 ret = PTR_ERR(device); 1440 continue;
1441 goto errout; 1441 if (!platform_get_drvdata(device)) {
1442 platform_device_unregister(device);
1443 continue;
1442 } 1444 }
1443 platform_devices[i] = device; 1445 platform_devices[i] = device;
1444 } 1446 }
1445 return 0; 1447 return 0;
1446
1447 errout:
1448 sscape_unregister_all();
1449 return ret;
1450} 1448}
1451 1449
1452static void sscape_exit(void) 1450static void sscape_exit(void)
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 2f13cd5d4dcb..7ae86f82c3fa 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -722,9 +722,11 @@ static int __init alsa_card_wavefront_init(void)
722#endif 722#endif
723 device = platform_device_register_simple(WAVEFRONT_DRIVER, 723 device = platform_device_register_simple(WAVEFRONT_DRIVER,
724 i, NULL, 0); 724 i, NULL, 0);
725 if (IS_ERR(device)) { 725 if (IS_ERR(device))
726 err = PTR_ERR(device); 726 continue;
727 goto errout; 727 if (!platform_get_drvdata(device)) {
728 platform_device_unregister(device);
729 continue;
728 } 730 }
729 platform_devices[i] = device; 731 platform_devices[i] = device;
730 cards++; 732 cards++;
@@ -742,14 +744,10 @@ static int __init alsa_card_wavefront_init(void)
742#ifdef MODULE 744#ifdef MODULE
743 printk (KERN_ERR "No WaveFront cards found or devices busy\n"); 745 printk (KERN_ERR "No WaveFront cards found or devices busy\n");
744#endif 746#endif
745 err = -ENODEV; 747 snd_wavefront_unregister_all();
746 goto errout; 748 return -ENODEV;
747 } 749 }
748 return 0; 750 return 0;
749
750 errout:
751 snd_wavefront_unregister_all();
752 return err;
753} 751}
754 752
755static void __exit alsa_card_wavefront_exit(void) 753static void __exit alsa_card_wavefront_exit(void)
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index 88e52dc84c09..6275266dde2e 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -5,23 +5,9 @@
5# 5#
6# Prompt user for primary drivers. 6# Prompt user for primary drivers.
7 7
8config OBSOLETE_OSS_DRIVER
9 bool "Obsolete OSS drivers"
10 depends on SOUND_PRIME
11 help
12 This option enables support for obsolete OSS drivers that
13 are scheduled for removal in the near future since there
14 are ALSA drivers for the same hardware.
15
16 Please contact Adrian Bunk <bunk@stusta.de> if you had to
17 say Y here because your soundcard is not properly supported
18 by ALSA.
19
20 If unsure, say N.
21
22config SOUND_BT878 8config SOUND_BT878
23 tristate "BT878 audio dma" 9 tristate "BT878 audio dma"
24 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER 10 depends on SOUND_PRIME && PCI
25 ---help--- 11 ---help---
26 Audio DMA support for bt878 based grabber boards. As you might have 12 Audio DMA support for bt878 based grabber boards. As you might have
27 already noticed, bt878 is listed with two functions in /proc/pci. 13 already noticed, bt878 is listed with two functions in /proc/pci.
@@ -35,48 +21,9 @@ config SOUND_BT878
35 To compile this driver as a module, choose M here: the module will 21 To compile this driver as a module, choose M here: the module will
36 be called btaudio. 22 be called btaudio.
37 23
38config SOUND_CMPCI
39 tristate "C-Media PCI (CMI8338/8738)"
40 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
41 help
42 Say Y or M if you have a PCI sound card using the CMI8338
43 or the CMI8738 chipset. Data on these chips are available at
44 <http://www.cmedia.com.tw/>.
45
46 A userspace utility to control some internal registers of these
47 chips is available at
48 <http://member.nifty.ne.jp/Breeze/softwares/unix/cmictl-e.html>.
49
50config SOUND_CMPCI_FM
51 bool "Enable legacy FM"
52 depends on SOUND_CMPCI && X86
53 help
54 Say Y here to enable the legacy FM (frequency-modulation) synthesizer
55 support on a card using the CMI8338 or CMI8378 chipset. Even it is
56 enabled, you need to set fmio as proper value to enable it.
57 Say N here if you don't need this.
58
59config SOUND_CMPCI_MIDI
60 bool "Enable legacy MPU-401"
61 depends on SOUND_CMPCI && X86
62 help
63 Say Y here to enable the legacy MPU401 MIDI synthesizer support on a
64 card using the CMI8338 or CMI8378 chipset. Even it is enabled,
65 you need to set mpuio as proper value to enable it.
66 Say N here if you don't need this.
67
68config SOUND_CMPCI_JOYSTICK
69 bool "Enable joystick"
70 depends on SOUND_CMPCI && X86 && (GAMEPORT=y || SOUND_CMPCI=GAMEPORT)
71 help
72 Say Y here in order to enable the joystick port on a sound card using
73 the CMI8338 or the CMI8738 chipset. You need to config the
74 gameport support and set joystick parameter as 1 to use it.
75 Say N here if you don't need this.
76
77config SOUND_EMU10K1 24config SOUND_EMU10K1
78 tristate "Creative SBLive! (EMU10K1)" 25 tristate "Creative SBLive! (EMU10K1)"
79 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER 26 depends on SOUND_PRIME && PCI
80 ---help--- 27 ---help---
81 Say Y or M if you have a PCI sound card using the EMU10K1 chipset, 28 Say Y or M if you have a PCI sound card using the EMU10K1 chipset,
82 such as the Creative SBLive!, SB PCI512 or Emu-APS. 29 such as the Creative SBLive!, SB PCI512 or Emu-APS.
@@ -108,13 +55,6 @@ config SOUND_FUSION
108 series) when wired as native sound drivers with AC97 codecs. If 55 series) when wired as native sound drivers with AC97 codecs. If
109 this driver does not work try the CS4232 driver. 56 this driver does not work try the CS4232 driver.
110 57
111config SOUND_CS4281
112 tristate "Crystal Sound CS4281"
113 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
114 help
115 Picture and feature list at
116 <http://www.pcbroker.com/crystal4281.html>.
117
118config SOUND_BCM_CS4297A 58config SOUND_BCM_CS4297A
119 tristate "Crystal Sound CS4297a (for Swarm)" 59 tristate "Crystal Sound CS4297a (for Swarm)"
120 depends on SOUND_PRIME && SIBYTE_SWARM 60 depends on SOUND_PRIME && SIBYTE_SWARM
@@ -125,22 +65,9 @@ config SOUND_BCM_CS4297A
125 note that CONFIG_KGDB should not be enabled at the same 65 note that CONFIG_KGDB should not be enabled at the same
126 time, since it also attempts to use this UART port. 66 time, since it also attempts to use this UART port.
127 67
128config SOUND_ES1370
129 tristate "Ensoniq AudioPCI (ES1370)"
130 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
131 help
132 Say Y or M if you have a PCI sound card utilizing the Ensoniq
133 ES1370 chipset, such as Ensoniq's AudioPCI (non-97). To find
134 out if your sound card uses an ES1370 without removing your
135 computer's cover, use lspci -n and look for the PCI ID
136 1274:5000. Since Ensoniq was bought by Creative Labs,
137 Sound Blaster 64/PCI models are either ES1370 or ES1371 based.
138 This driver differs slightly from OSS/Free, so PLEASE READ
139 <file:Documentation/sound/oss/es1370>.
140
141config SOUND_ES1371 68config SOUND_ES1371
142 tristate "Creative Ensoniq AudioPCI 97 (ES1371)" 69 tristate "Creative Ensoniq AudioPCI 97 (ES1371)"
143 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER 70 depends on SOUND_PRIME && PCI
144 help 71 help
145 Say Y or M if you have a PCI sound card utilizing the Ensoniq 72 Say Y or M if you have a PCI sound card utilizing the Ensoniq
146 ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if 73 ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if
@@ -151,33 +78,6 @@ config SOUND_ES1371
151 slightly from OSS/Free, so PLEASE READ 78 slightly from OSS/Free, so PLEASE READ
152 <file:Documentation/sound/oss/es1371>. 79 <file:Documentation/sound/oss/es1371>.
153 80
154config SOUND_ESSSOLO1
155 tristate "ESS Technology Solo1"
156 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
157 help
158 Say Y or M if you have a PCI sound card utilizing the ESS Technology
159 Solo1 chip. To find out if your sound card uses a
160 Solo1 chip without removing your computer's cover, use
161 lspci -n and look for the PCI ID 125D:1969. This driver
162 differs slightly from OSS/Free, so PLEASE READ
163 <file:Documentation/sound/oss/solo1>.
164
165config SOUND_MAESTRO
166 tristate "ESS Maestro, Maestro2, Maestro2E driver"
167 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
168 help
169 Say Y or M if you have a sound system driven by ESS's Maestro line
170 of PCI sound chips. These include the Maestro 1, Maestro 2, and
171 Maestro 2E. See <file:Documentation/sound/oss/Maestro> for more
172 details.
173
174config SOUND_MAESTRO3
175 tristate "ESS Maestro3/Allegro driver (EXPERIMENTAL)"
176 depends on SOUND_PRIME && PCI && EXPERIMENTAL && OBSOLETE_OSS_DRIVER
177 help
178 Say Y or M if you have a sound system driven by ESS's Maestro 3
179 PCI sound chip.
180
181config SOUND_ICH 81config SOUND_ICH
182 tristate "Intel ICH (i8xx) audio support" 82 tristate "Intel ICH (i8xx) audio support"
183 depends on SOUND_PRIME && PCI 83 depends on SOUND_PRIME && PCI
@@ -185,24 +85,6 @@ config SOUND_ICH
185 Support for integral audio in Intel's I/O Controller Hub (ICH) 85 Support for integral audio in Intel's I/O Controller Hub (ICH)
186 chipset, as used on the 810/820/840 motherboards. 86 chipset, as used on the 810/820/840 motherboards.
187 87
188config SOUND_HARMONY
189 tristate "PA Harmony audio driver"
190 depends on GSC_LASI && SOUND_PRIME && OBSOLETE_OSS_DRIVER
191 help
192 Say 'Y' or 'M' to include support for Harmony soundchip
193 on HP 712, 715/new and many other GSC based machines.
194
195config SOUND_SONICVIBES
196 tristate "S3 SonicVibes"
197 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
198 help
199 Say Y or M if you have a PCI sound card utilizing the S3
200 SonicVibes chipset. To find out if your sound card uses a
201 SonicVibes chip without removing your computer's cover, use
202 lspci -n and look for the PCI ID 5333:CA00. This driver
203 differs slightly from OSS/Free, so PLEASE READ
204 <file:Documentation/sound/oss/sonicvibes>.
205
206config SOUND_VWSND 88config SOUND_VWSND
207 tristate "SGI Visual Workstation Sound" 89 tristate "SGI Visual Workstation Sound"
208 depends on SOUND_PRIME && X86_VISWS 90 depends on SOUND_PRIME && X86_VISWS
@@ -231,10 +113,6 @@ config SOUND_VRC5477
231 integrated, multi-function controller chip for MIPS CPUs. Works 113 integrated, multi-function controller chip for MIPS CPUs. Works
232 with the AC97 codec. 114 with the AC97 codec.
233 115
234config SOUND_AU1000
235 tristate "Au1000 Sound"
236 depends on SOUND_PRIME && (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && OBSOLETE_OSS_DRIVER
237
238config SOUND_AU1550_AC97 116config SOUND_AU1550_AC97
239 tristate "Au1550 AC97 Sound" 117 tristate "Au1550 AC97 Sound"
240 depends on SOUND_PRIME && SOC_AU1550 118 depends on SOUND_PRIME && SOC_AU1550
@@ -507,7 +385,7 @@ config MSND_FIFOSIZE
507 385
508config SOUND_VIA82CXXX 386config SOUND_VIA82CXXX
509 tristate "VIA 82C686 Audio Codec" 387 tristate "VIA 82C686 Audio Codec"
510 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER 388 depends on SOUND_PRIME && PCI
511 help 389 help
512 Say Y here to include support for the audio codec found on VIA 390 Say Y here to include support for the audio codec found on VIA
513 82Cxxx-based chips. Typically these are built into a motherboard. 391 82Cxxx-based chips. Typically these are built into a motherboard.
@@ -576,18 +454,6 @@ config SOUND_AD1889
576 Say M here if you have a sound card based on the Analog Devices 454 Say M here if you have a sound card based on the Analog Devices
577 AD1889 chip. 455 AD1889 chip.
578 456
579config SOUND_SGALAXY
580 tristate "Aztech Sound Galaxy (non-PnP) cards"
581 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
582 help
583 This module initializes the older non Plug and Play sound galaxy
584 cards from Aztech. It supports the Waverider Pro 32 - 3D and the
585 Galaxy Washington 16.
586
587 If you compile the driver into the kernel, you have to add
588 "sgalaxy=<io>,<irq>,<dma>,<dma2>,<sgbase>" to the kernel command
589 line.
590
591config SOUND_ADLIB 457config SOUND_ADLIB
592 tristate "Adlib Cards" 458 tristate "Adlib Cards"
593 depends on SOUND_OSS 459 depends on SOUND_OSS
@@ -612,56 +478,6 @@ config SOUND_ACI_MIXER
612 478
613 This driver is also available as a module and will be called aci. 479 This driver is also available as a module and will be called aci.
614 480
615config SOUND_CS4232
616 tristate "Crystal CS4232 based (PnP) cards"
617 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
618 help
619 Say Y here if you have a card based on the Crystal CS4232 chip set,
620 which uses its own Plug and Play protocol.
621
622 If you compile the driver into the kernel, you have to add
623 "cs4232=<io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq>" to the kernel
624 command line.
625
626 See <file:Documentation/sound/oss/CS4232> for more information on
627 configuring this card.
628
629config SOUND_SSCAPE
630 tristate "Ensoniq SoundScape support"
631 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
632 help
633 Answer Y if you have a sound card based on the Ensoniq SoundScape
634 chipset. Such cards are being manufactured at least by Ensoniq, Spea
635 and Reveal (Reveal makes also other cards).
636
637 If you compile the driver into the kernel, you have to add
638 "sscape=<io>,<irq>,<dma>,<mpuio>,<mpuirq>" to the kernel command
639 line.
640
641config SOUND_GUS
642 tristate "Gravis Ultrasound support"
643 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
644 help
645 Say Y here for any type of Gravis Ultrasound card, including the GUS
646 or GUS MAX. See also <file:Documentation/sound/oss/ultrasound> for more
647 information on configuring this card with modules.
648
649 If you compile the driver into the kernel, you have to add
650 "gus=<io>,<irq>,<dma>,<dma2>" to the kernel command line.
651
652config SOUND_GUS16
653 bool "16 bit sampling option of GUS (_NOT_ GUS MAX)"
654 depends on SOUND_GUS
655 help
656 Support for Gravis Ulstrasound (GUS) cards (other than the GUS),
657 sampling at 16-bit width.
658
659config SOUND_GUSMAX
660 bool "GUS MAX support"
661 depends on SOUND_GUS
662 help
663 Support for Gravis Ulstrasound MAX.
664
665config SOUND_VMIDI 481config SOUND_VMIDI
666 tristate "Loopback MIDI device support" 482 tristate "Loopback MIDI device support"
667 depends on SOUND_OSS 483 depends on SOUND_OSS
@@ -742,7 +558,7 @@ config SOUND_MPU401
742 558
743config SOUND_NM256 559config SOUND_NM256
744 tristate "NM256AV/NM256ZX audio support" 560 tristate "NM256AV/NM256ZX audio support"
745 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER 561 depends on SOUND_OSS
746 help 562 help
747 Say M here to include audio support for the NeoMagic 256AV/256ZX 563 Say M here to include audio support for the NeoMagic 256AV/256ZX
748 chipsets. These are the audio chipsets found in the Sony 564 chipsets. These are the audio chipsets found in the Sony
@@ -752,35 +568,6 @@ config SOUND_NM256
752 568
753 See <file:Documentation/sound/oss/NM256> for further information. 569 See <file:Documentation/sound/oss/NM256> for further information.
754 570
755config SOUND_MAD16
756 tristate "OPTi MAD16 and/or Mozart based cards"
757 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
758 ---help---
759 Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi
760 82C928 or 82C929 or 82C931) audio interface chip. These chips are
761 quite common so it's possible that many no-name cards have one of
762 them. In addition the MAD16 chip is used in some cards made by known
763 manufacturers such as Turtle Beach (Tropez), Reveal (some models)
764 and Diamond (latest ones). Note however that the Tropez sound cards
765 have their own driver; if you have one of those, say N here and Y or
766 M to "Full support for Turtle Beach WaveFront", below.
767
768 If you compile the driver into the kernel, you have to add
769 "mad16=<io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq>" to the
770 kernel command line.
771
772 See also <file:Documentation/sound/oss/Opti> and
773 <file:Documentation/sound/oss/MAD16> for more information on setting
774 these cards up as modules.
775
776config MAD16_OLDCARD
777 bool "Support MIDI in older MAD16 based cards (requires SB)"
778 depends on SOUND_MAD16
779 help
780 Answer Y (or M) if you have an older card based on the C928 or
781 Mozart chipset and you want to have MIDI support. If you enable this
782 option you also need to enable support for Sound Blaster.
783
784config SOUND_PAS 571config SOUND_PAS
785 tristate "ProAudioSpectrum 16 support" 572 tristate "ProAudioSpectrum 16 support"
786 depends on SOUND_OSS 573 depends on SOUND_OSS
@@ -873,53 +660,9 @@ config SOUND_SB
873 You can say M here to compile this driver as a module; the module is 660 You can say M here to compile this driver as a module; the module is
874 called sb. 661 called sb.
875 662
876config SOUND_AWE32_SYNTH
877 tristate "AWE32 synth"
878 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
879 help
880 Say Y here if you have a Sound Blaster SB32, AWE32-PnP, SB AWE64 or
881 similar sound card. See <file:Documentation/sound/oss/README.awe>,
882 <file:Documentation/sound/oss/AWE32> and the Soundblaster-AWE
883 mini-HOWTO, available from <http://www.tldp.org/docs.html#howto>
884 for more info.
885
886config SOUND_WAVEFRONT
887 tristate "Full support for Turtle Beach WaveFront (Tropez Plus, Tropez, Maui) synth/soundcards"
888 depends on SOUND_OSS && m && OBSOLETE_OSS_DRIVER
889 help
890 Answer Y or M if you have a Tropez Plus, Tropez or Maui sound card
891 and read the files <file:Documentation/sound/oss/Wavefront> and
892 <file:Documentation/sound/oss/Tropez+>.
893
894config SOUND_MAUI
895 tristate "Limited support for Turtle Beach Wave Front (Maui, Tropez) synthesizers"
896 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
897 help
898 Say Y here if you have a Turtle Beach Wave Front, Maui, or Tropez
899 sound card.
900
901 If you compile the driver into the kernel, you have to add
902 "maui=<io>,<irq>" to the kernel command line.
903
904config MAUI_HAVE_BOOT
905 bool "Have OSWF.MOT firmware file"
906 depends on SOUND_MAUI=y && !STANDALONE
907 help
908 Turtle Beach Maui and Tropez sound cards have a microcontroller
909 which needs to be initialized prior to use. OSWF.MOT is a file
910 distributed with the card's DOS/Windows drivers. Answer Y if you
911 have this file.
912
913config MAUI_BOOT_FILE
914 string "Full pathname of OSWF.MOT firmware file"
915 depends on MAUI_HAVE_BOOT
916 default "/etc/sound/oswf.mot"
917 help
918 Enter the full pathname of your OSWF.MOT file, starting from /.
919
920config SOUND_YM3812 663config SOUND_YM3812
921 tristate "Yamaha FM synthesizer (YM3812/OPL-3) support" 664 tristate "Yamaha FM synthesizer (YM3812/OPL-3) support"
922 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER 665 depends on SOUND_OSS
923 ---help--- 666 ---help---
924 Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). 667 Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4).
925 Answering Y is usually a safe and recommended choice, however some 668 Answering Y is usually a safe and recommended choice, however some
@@ -933,18 +676,6 @@ config SOUND_YM3812
933 676
934 If unsure, say Y. 677 If unsure, say Y.
935 678
936config SOUND_OPL3SA1
937 tristate "Yamaha OPL3-SA1 audio controller"
938 depends on SOUND_OSS && OBSOLETE_OSS_DRIVER
939 help
940 Say Y or M if you have a Yamaha OPL3-SA1 sound chip, which is
941 usually built into motherboards. Read
942 <file:Documentation/sound/oss/OPL3-SA> for details.
943
944 If you compile the driver into the kernel, you have to add
945 "opl3sa=<io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq>" to the kernel
946 command line.
947
948config SOUND_OPL3SA2 679config SOUND_OPL3SA2
949 tristate "Yamaha OPL3-SA2 and SA3 based PnP cards" 680 tristate "Yamaha OPL3-SA2 and SA3 based PnP cards"
950 depends on SOUND_OSS 681 depends on SOUND_OSS
@@ -959,19 +690,6 @@ config SOUND_OPL3SA2
959 "opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio>" to the kernel 690 "opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio>" to the kernel
960 command line. 691 command line.
961 692
962config SOUND_YMFPCI
963 tristate "Yamaha YMF7xx PCI audio (native mode)"
964 depends on SOUND_OSS && PCI && OBSOLETE_OSS_DRIVER
965 help
966 Support for Yamaha cards including the YMF711, YMF715, YMF718,
967 YMF719, YMF724, Waveforce 192XG, and Waveforce 192 Digital.
968
969config SOUND_YMFPCI_LEGACY
970 bool "Yamaha PCI legacy ports support"
971 depends on SOUND_YMFPCI
972 help
973 Support for YMF7xx PCI cards emulating an MP401.
974
975config SOUND_UART6850 693config SOUND_UART6850
976 tristate "6850 UART support" 694 tristate "6850 UART support"
977 depends on SOUND_OSS 695 depends on SOUND_OSS
@@ -1101,30 +819,6 @@ config SOUND_KAHLUA
1101 tristate "XpressAudio Sound Blaster emulation" 819 tristate "XpressAudio Sound Blaster emulation"
1102 depends on SOUND_SB 820 depends on SOUND_SB
1103 821
1104config SOUND_ALI5455
1105 tristate "ALi5455 audio support"
1106 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
1107
1108config SOUND_FORTE
1109 tristate "ForteMedia FM801 driver"
1110 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
1111 help
1112 Say Y or M if you want driver support for the ForteMedia FM801 PCI
1113 audio controller (Abit AU10, Genius Sound Maker, HP Workstation
1114 zx2000, and others).
1115
1116config SOUND_RME96XX
1117 tristate "RME Hammerfall (RME96XX) support"
1118 depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER
1119 help
1120 Say Y or M if you have a Hammerfall or Hammerfall light
1121 multichannel card from RME. If you want to access advanced
1122 features of the card, read <file:Documentation/sound/oss/rme96xx>.
1123
1124config SOUND_AD1980
1125 tristate "AD1980 front/back switch plugin"
1126 depends on SOUND_PRIME && OBSOLETE_OSS_DRIVER
1127
1128config SOUND_SH_DAC_AUDIO 822config SOUND_SH_DAC_AUDIO
1129 tristate "SuperH DAC audio support" 823 tristate "SuperH DAC audio support"
1130 depends on SOUND_PRIME && CPU_SH3 824 depends on SOUND_PRIME && CPU_SH3
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 0cd44a6f7ac0..3721c5857b90 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -94,6 +94,7 @@
94#include <linux/init.h> 94#include <linux/init.h>
95#include <linux/delay.h> 95#include <linux/delay.h>
96#include <linux/proc_fs.h> 96#include <linux/proc_fs.h>
97#include <linux/dma-mapping.h>
97 98
98#include "hwaccess.h" 99#include "hwaccess.h"
99#include "8010.h" 100#include "8010.h"
@@ -119,7 +120,7 @@
119 120
120 121
121/* the emu10k1 _seems_ to only supports 29 bit (512MiB) bit bus master */ 122/* the emu10k1 _seems_ to only supports 29 bit (512MiB) bit bus master */
122#define EMU10K1_DMA_MASK 0x1fffffff /* DMA buffer mask for pci_alloc_consist */ 123#define EMU10K1_DMA_MASK DMA_29BIT_MASK /* DMA buffer mask for pci_alloc_consist */
123 124
124#ifndef PCI_VENDOR_ID_CREATIVE 125#ifndef PCI_VENDOR_ID_CREATIVE
125#define PCI_VENDOR_ID_CREATIVE 0x1102 126#define PCI_VENDOR_ID_CREATIVE 0x1102
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 278319bbdea1..d05200741ac3 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -160,6 +160,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
160{ 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL }, 160{ 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL },
161{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF 161{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF
162{ 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF 162{ 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF
163{ 0x56494182, 0xffffffff, "VIA1618", NULL, NULL },
163{ 0x57454301, 0xffffffff, "W83971D", NULL, NULL }, 164{ 0x57454301, 0xffffffff, "W83971D", NULL, NULL },
164{ 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL }, 165{ 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL },
165{ 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL}, 166{ 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL},
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 37b80570a5c6..91899f87f037 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/dma-mapping.h>
38#include <linux/interrupt.h> 39#include <linux/interrupt.h>
39#include <linux/slab.h> 40#include <linux/slab.h>
40 41
@@ -691,8 +692,8 @@ static int __devinit snd_als300_create(snd_card_t *card,
691 if ((err = pci_enable_device(pci)) < 0) 692 if ((err = pci_enable_device(pci)) < 0)
692 return err; 693 return err;
693 694
694 if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || 695 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
695 pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { 696 pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
696 printk(KERN_ERR "error setting 28bit DMA mask\n"); 697 printk(KERN_ERR "error setting 28bit DMA mask\n");
697 pci_disable_device(pci); 698 pci_disable_device(pci);
698 return -ENXIO; 699 return -ENXIO;
diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h
index d65ccb1866a0..f078b716d2b0 100644
--- a/sound/pci/au88x0/au88x0.h
+++ b/sound/pci/au88x0/au88x0.h
@@ -19,7 +19,6 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/init.h>
23#include <linux/pci.h> 22#include <linux/pci.h>
24#include <asm/io.h> 23#include <asm/io.h>
25#include <sound/core.h> 24#include <sound/core.h>
@@ -277,14 +276,14 @@ static void vortex_Vort3D_InitializeSource(a3dsrc_t * a, int en);
277#endif 276#endif
278 277
279/* Driver stuff. */ 278/* Driver stuff. */
280static int __devinit vortex_gameport_register(vortex_t * card); 279static int vortex_gameport_register(vortex_t * card);
281static void vortex_gameport_unregister(vortex_t * card); 280static void vortex_gameport_unregister(vortex_t * card);
282#ifndef CHIP_AU8820 281#ifndef CHIP_AU8820
283static int __devinit vortex_eq_init(vortex_t * vortex); 282static int vortex_eq_init(vortex_t * vortex);
284static int __devexit vortex_eq_free(vortex_t * vortex); 283static int vortex_eq_free(vortex_t * vortex);
285#endif 284#endif
286/* ALSA stuff. */ 285/* ALSA stuff. */
287static int __devinit snd_vortex_new_pcm(vortex_t * vortex, int idx, int nr); 286static int snd_vortex_new_pcm(vortex_t * vortex, int idx, int nr);
288static int __devinit snd_vortex_mixer(vortex_t * vortex); 287static int snd_vortex_mixer(vortex_t * vortex);
289static int __devinit snd_vortex_midi(vortex_t * vortex); 288static int snd_vortex_midi(vortex_t * vortex);
290#endif 289#endif
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 9cac02e93b25..4347e6abc1d5 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -2658,7 +2658,7 @@ static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode)
2658 2658
2659/* Initialization */ 2659/* Initialization */
2660 2660
2661static int vortex_core_init(vortex_t * vortex) 2661static int __devinit vortex_core_init(vortex_t * vortex)
2662{ 2662{
2663 2663
2664 printk(KERN_INFO "Vortex: init.... "); 2664 printk(KERN_INFO "Vortex: init.... ");
diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c
index 64fbfbbaf816..0c86a31c4336 100644
--- a/sound/pci/au88x0/au88x0_eq.c
+++ b/sound/pci/au88x0/au88x0_eq.c
@@ -885,7 +885,7 @@ static char *EqBandLabels[10] __devinitdata = {
885}; 885};
886 886
887/* ALSA driver entry points. Init and exit. */ 887/* ALSA driver entry points. Init and exit. */
888static int vortex_eq_init(vortex_t * vortex) 888static int __devinit vortex_eq_init(vortex_t * vortex)
889{ 889{
890 struct snd_kcontrol *kcontrol; 890 struct snd_kcontrol *kcontrol;
891 int err, i; 891 int err, i;
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index 6a13ca1d545e..7b5baa173859 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -506,7 +506,7 @@ static int __devinit snd_vortex_new_pcm(vortex_t * chip, int idx, int nr)
506 int i; 506 int i;
507 int err, nr_capt; 507 int err, nr_capt;
508 508
509 if ((chip == 0) || (idx < 0) || (idx > VORTEX_PCM_LAST)) 509 if ((chip == 0) || (idx < 0) || (idx >= VORTEX_PCM_LAST))
510 return -ENODEV; 510 return -ENODEV;
511 511
512 /* idx indicates which kind of PCM device. ADB, SPDIF, I2S and A3D share the 512 /* idx indicates which kind of PCM device. ADB, SPDIF, I2S and A3D share the
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 31cb9b48bb59..6bfa08436efa 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -843,8 +843,11 @@ static struct snd_emu_chip_details emu_chip_details[] = {
843 .spdif_bug = 1, 843 .spdif_bug = 1,
844 .ac97_chip = 1} , 844 .ac97_chip = 1} ,
845 /* Tested by shane-alsa@cm.nu 5th Nov 2005 */ 845 /* Tested by shane-alsa@cm.nu 5th Nov 2005 */
846 /* The 0x20061102 does have SB0350 written on it
847 * Just like 0x20021102
848 */
846 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102, 849 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102,
847 .driver = "Audigy2", .name = "Audigy 2 [2006]", 850 .driver = "Audigy2", .name = "Audigy 2 [SB0350b]",
848 .id = "Audigy2", 851 .id = "Audigy2",
849 .emu10k2_chip = 1, 852 .emu10k2_chip = 1,
850 .ca0102_chip = 1, 853 .ca0102_chip = 1,
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2bfe37e8543c..bcfca159c6a2 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -801,6 +801,10 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
801 .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */ 801 .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */
802 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213, 802 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213,
803 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ 803 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */
804 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7,
805 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */
806 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af,
807 .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */
804 {} 808 {}
805}; 809};
806 810
@@ -1330,6 +1334,8 @@ static struct hda_board_config ad1981_cfg_tbl[] = {
1330 .config = AD1981_HP }, /* HP nx6320 */ 1334 .config = AD1981_HP }, /* HP nx6320 */
1331 { .pci_subvendor = 0x103c, .pci_subdevice = 0x309f, 1335 { .pci_subvendor = 0x103c, .pci_subdevice = 0x309f,
1332 .config = AD1981_HP }, /* HP nx9420 AngelFire */ 1336 .config = AD1981_HP }, /* HP nx9420 AngelFire */
1337 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30a2,
1338 .config = AD1981_HP }, /* HP nx9420 AngelFire */
1333 { .modelname = "basic", .config = AD1981_BASIC }, 1339 { .modelname = "basic", .config = AD1981_BASIC },
1334 {} 1340 {}
1335}; 1341};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index abe9493f0a2c..715260787953 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -310,6 +310,9 @@ static struct hda_board_config stac922x_cfg_tbl[] = {
310 .pci_subdevice = 0x0b0b, 310 .pci_subdevice = 0x0b0b,
311 .config = STAC_D945GTP3 }, /* Intel D945PSN - 3 Stack, 9221 A1 */ 311 .config = STAC_D945GTP3 }, /* Intel D945PSN - 3 Stack, 9221 A1 */
312 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 312 { .pci_subvendor = PCI_VENDOR_ID_INTEL,
313 .pci_subdevice = 0x0707,
314 .config = STAC_D945GTP5 }, /* Intel D945PSV - 5 Stack */
315 { .pci_subvendor = PCI_VENDOR_ID_INTEL,
313 .pci_subdevice = 0x0404, 316 .pci_subdevice = 0x0404,
314 .config = STAC_D945GTP5 }, /* Intel D945GTP - 5 Stack */ 317 .config = STAC_D945GTP5 }, /* Intel D945GTP - 5 Stack */
315 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 318 { .pci_subvendor = PCI_VENDOR_ID_INTEL,
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 1e7398de2865..0f171dd1377b 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2333,6 +2333,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2333 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ 2333 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */
2334 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ 2334 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */
2335 { .subvendor = 0x1019, .subdevice = 0xa101, .action = VIA_DXS_SRC }, 2335 { .subvendor = 0x1019, .subdevice = 0xa101, .action = VIA_DXS_SRC },
2336 { .subvendor = 0x1019, .subdevice = 0xaa01, .action = VIA_DXS_SRC }, /* ECS K8T890-A */
2336 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ 2337 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */
2337 { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */ 2338 { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */
2338 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ 2339 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
diff --git a/usr/Makefile b/usr/Makefile
index e2129cb570bb..19d74e6f2685 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -1,65 +1,48 @@
1#
2# kbuild file for usr/ - including initramfs image
3#
1 4
2obj-y := initramfs_data.o 5klibcdirs:;
3
4hostprogs-y := gen_init_cpio
5 6
6clean-files := initramfs_data.cpio.gz initramfs_list 7# Generate builtin.o based on initramfs_data.o
8obj-y := initramfs_data.o
7 9
8# initramfs_data.o contains the initramfs_data.cpio.gz image. 10# initramfs_data.o contains the initramfs_data.cpio.gz image.
9# The image is included using .incbin, a dependency which is not 11# The image is included using .incbin, a dependency which is not
10# tracked automatically. 12# tracked automatically.
11$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE 13$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
12 14
13ifdef CONFIG_INITRAMFS_ROOT_UID 15#####
14gen_initramfs_args += -u $(CONFIG_INITRAMFS_ROOT_UID) 16# Generate the initramfs cpio archive
15endif 17
16 18hostprogs-y := gen_init_cpio
17ifdef CONFIG_INITRAMFS_ROOT_GID 19initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
18gen_initramfs_args += -g $(CONFIG_INITRAMFS_ROOT_GID) 20ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
19endif 21 $(CONFIG_INITRAMFS_SOURCE),-d)
20 22ramfs-args := \
21# The $(shell echo $(CONFIG_INITRAMFS_SOURCE)) is to remove the 23 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
22# gratuitous begin and end quotes from the Kconfig string type. 24 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
23# Internal, escaped quotes in the Kconfig string will loose the 25 $(ramfs-input)
24# escape and become active quotes. 26
25quotefixed_initramfs_source := $(shell echo $(CONFIG_INITRAMFS_SOURCE)) 27# .initramfs_data.cpio.gz.d is used to identify all files included
26 28# in initramfs and to detect if any files are added/removed.
27filechk_initramfs_list = $(CONFIG_SHELL) \ 29# Removed files are identified by directory timestamp being updated
28 $(srctree)/scripts/gen_initramfs_list.sh $(gen_initramfs_args) $(quotefixed_initramfs_source) 30# The dependency list is generated by gen_initramfs.sh -l
29 31ifneq ($(wildcard $(obj)/.initramfs_data.cpio.gz.d),)
30$(obj)/initramfs_list: $(obj)/Makefile FORCE 32 include $(obj)/.initramfs_data.cpio.gz.d
31 $(call filechk,initramfs_list)
32
33quiet_cmd_cpio = CPIO $@
34 cmd_cpio = ./$< $(obj)/initramfs_list > $@
35
36
37# Check if the INITRAMFS_SOURCE is a cpio archive
38ifneq (,$(findstring .cpio,$(quotefixed_initramfs_source)))
39
40# INITRAMFS_SOURCE has a cpio archive - verify that it's a single file
41ifneq (1,$(words $(quotefixed_initramfs_source)))
42$(error Only a single file may be specified in CONFIG_INITRAMFS_SOURCE (="$(quotefixed_initramfs_source)") when a cpio archive is directly specified.)
43endif
44# Now use the cpio archive directly
45initramfs_data_cpio = $(quotefixed_initramfs_source)
46targets += $(quotefixed_initramfs_source)
47
48else
49
50# INITRAMFS_SOURCE is not a cpio archive - create one
51$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio \
52 $(initramfs-y) $(obj)/initramfs_list FORCE
53 $(call if_changed,cpio)
54
55targets += initramfs_data.cpio
56initramfs_data_cpio = $(obj)/initramfs_data.cpio
57
58endif 33endif
59 34
60 35quiet_cmd_initfs = GEN $@
61$(obj)/initramfs_data.cpio.gz: $(initramfs_data_cpio) FORCE 36 cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
62 $(call if_changed,gzip) 37
63 38targets := initramfs_data.cpio.gz
64targets += initramfs_data.cpio.gz 39$(deps_initramfs): klibcdirs
40# We rebuild initramfs_data.cpio.gz if:
41# 1) Any included file is newer then initramfs_data.cpio.gz
42# 2) There are changes in which files are included (added or deleted)
43# 3) If gen_init_cpio are newer than initramfs_data.cpio.gz
44# 4) arguments to gen_initramfs.sh changes
45$(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
46 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.gz.d
47 $(call if_changed,initfs)
65 48
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 33dbcbf77c5b..83acd6cc0b3c 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -471,6 +471,7 @@ int main (int argc, char *argv[])
471 "ERROR: incorrect format, could not locate file type line %d: '%s'\n", 471 "ERROR: incorrect format, could not locate file type line %d: '%s'\n",
472 line_nr, line); 472 line_nr, line);
473 ec = -1; 473 ec = -1;
474 break;
474 } 475 }
475 476
476 if ('\n' == *type) { 477 if ('\n' == *type) {
@@ -506,7 +507,8 @@ int main (int argc, char *argv[])
506 line_nr, line); 507 line_nr, line);
507 } 508 }
508 } 509 }
509 cpio_trailer(); 510 if (ec == 0)
511 cpio_trailer();
510 512
511 exit(ec); 513 exit(ec);
512} 514}